From: support Date: Thu, 17 Nov 2022 15:14:40 +0000 (+0000) Subject: Built motion from commit 18370e0e.|2.6.22 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/www.w3.org/TR/wai-aria-practices?a=commitdiff_plain;h=a27e5f3ad92b4b5d37366c5f9015140f81a8719b;p=motion2.git Built motion from commit 18370e0e.|2.6.22 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0e20a3a..6468d8c 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-17T14:27:45.485Z", + "time": "2022-11-17T15:06:33.774Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8990862..8547283 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-17T14:27:45.485Z", + "time": "2022-11-17T15:06:33.774Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index e0c183d..4fa5fc4 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 _0x495f=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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[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]','sequelize','exports','VIRTUAL','getDataValue','action','integration','motionbar'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x495f,0x111));var _0xf495=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x495f[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0xf495('0x0'));module[_0xf495('0x1')]={'name':{'type':Sequelize[_0xf495('0x2')],'get':function(_0x29cefb){return this[_0xf495('0x3')](_0xf495('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xf495('0x5'),_0xf495('0x6'),_0xf495('0x7'),_0xf495('0x8'),_0xf495('0x9'),_0xf495('0xa'),_0xf495('0xb')]],'msg':_0xf495('0xc')}},'comment':_0xf495('0xc')},'data1':{'type':Sequelize[_0xf495('0xd')](0x1000),'comment':_0xf495('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xf495('0xd')](0x1000),'comment':_0xf495('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xf495('0xd')](0x1000),'comments':_0xf495('0x10')},'data6':{'type':Sequelize[_0xf495('0xd')],'comments':_0xf495('0x11')},'data7':{'type':Sequelize[_0xf495('0x12')],'comments':_0xf495('0x13')}}; \ No newline at end of file +var _0x254b=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','browser','script','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]'];(function(_0xf33388,_0x591c5d){var _0x4a4358=function(_0x539358){while(--_0x539358){_0xf33388['push'](_0xf33388['shift']());}};_0x4a4358(++_0x591c5d);}(_0x254b,0x110));var _0xb254=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x254b[_0x593564];return _0x211a89;};'use strict';var Sequelize=require(_0xb254('0x0'));module[_0xb254('0x1')]={'name':{'type':Sequelize[_0xb254('0x2')],'get':function(_0x1e5e0e){return this[_0xb254('0x3')]('action');}},'action':{'type':Sequelize[_0xb254('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb254('0x5'),_0xb254('0x6'),_0xb254('0x7'),_0xb254('0x8'),'urlForward',_0xb254('0x9'),'bot',_0xb254('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xb254('0x4')](0x1000),'comment':_0xb254('0xb')},'data2':{'type':Sequelize[_0xb254('0x4')](0x1000),'comment':_0xb254('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xb254('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xb254('0xd')},'data6':{'type':Sequelize[_0xb254('0x4')],'comments':_0xb254('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a35d98b..490b309 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 _0xc237=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','body','Action','params','catch','destroy','find'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc237,0x180));var _0x7c23=function(_0x35b3c4,_0xc1f277){_0x35b3c4=_0x35b3c4-0x0;var _0x403033=_0xc237[_0x35b3c4];return _0x403033;};'use strict';var emlformat=require(_0x7c23('0x0'));var rimraf=require(_0x7c23('0x1'));var zipdir=require(_0x7c23('0x2'));var jsonpatch=require(_0x7c23('0x3'));var rp=require(_0x7c23('0x4'));var moment=require('moment');var BPromise=require(_0x7c23('0x5'));var Mustache=require(_0x7c23('0x6'));var util=require(_0x7c23('0x7'));var path=require(_0x7c23('0x8'));var sox=require(_0x7c23('0x9'));var csv=require(_0x7c23('0xa'));var ejs=require(_0x7c23('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7c23('0xc'));var crypto=require(_0x7c23('0xd'));var jsforce=require(_0x7c23('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7c23('0xa'));var querystring=require(_0x7c23('0xf'));var Papa=require(_0x7c23('0x10'));var Redis=require(_0x7c23('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7c23('0x12'));var hardwareService=require(_0x7c23('0x13'));var logger=require(_0x7c23('0x14'))(_0x7c23('0x15'));var utils=require(_0x7c23('0x16'));var config=require(_0x7c23('0x17'));var licenseUtil=require(_0x7c23('0x18'));var db=require(_0x7c23('0x19'))['db'];function respondWithStatusCode(_0x1eb56f,_0x50a511){_0x50a511=_0x50a511||0xcc;return function(_0x404cdb){if(_0x404cdb){return _0x1eb56f['sendStatus'](_0x50a511);}return _0x1eb56f[_0x7c23('0x1a')](_0x50a511)['end']();};}function respondWithResult(_0x55e5dc,_0x47de15){_0x47de15=_0x47de15||0xc8;return function(_0x1357f2){if(_0x1357f2){return _0x55e5dc[_0x7c23('0x1a')](_0x47de15)[_0x7c23('0x1b')](_0x1357f2);}};}function respondWithFilteredResult(_0x2900a4,_0x199806){return function(_0x33010b){if(_0x33010b){var _0xcee1da=typeof _0x199806[_0x7c23('0x1c')]==='undefined'&&typeof _0x199806[_0x7c23('0x1d')]===_0x7c23('0x1e');var _0x4b0c7a=_0x33010b[_0x7c23('0x1f')];var _0x760800=_0xcee1da?0x0:_0x199806[_0x7c23('0x1c')];var _0xbc674e=_0xcee1da?_0x33010b[_0x7c23('0x1f')]:_0x199806[_0x7c23('0x1c')]+_0x199806[_0x7c23('0x1d')];var _0x4335df;if(_0xbc674e>=_0x4b0c7a){_0xbc674e=_0x4b0c7a;_0x4335df=0xc8;}else{_0x4335df=0xce;}_0x2900a4['status'](_0x4335df);return _0x2900a4[_0x7c23('0x20')](_0x7c23('0x21'),_0x760800+'-'+_0xbc674e+'/'+_0x4b0c7a)[_0x7c23('0x1b')](_0x33010b);}return null;};}function patchUpdates(_0xf5f2e5){return function(_0x26ecdc){try{jsonpatch[_0x7c23('0x22')](_0x26ecdc,_0xf5f2e5,!![]);}catch(_0x40960d){return BPromise[_0x7c23('0x23')](_0x40960d);}return _0x26ecdc['save']();};}function saveUpdates(_0x40b545,_0x1096d2){return function(_0x35f322){if(_0x35f322){return _0x35f322[_0x7c23('0x24')](_0x40b545)[_0x7c23('0x25')](function(_0x322b1f){return _0x322b1f;});}return null;};}function removeEntity(_0x5d2e9b,_0xd3d67a){return function(_0x42beab){if(_0x42beab){return _0x42beab['destroy']()[_0x7c23('0x25')](function(){_0x5d2e9b[_0x7c23('0x1a')](0xcc)[_0x7c23('0x26')]();});}};}function handleEntityNotFound(_0x5ed43a,_0x440482){return function(_0x41381c){if(!_0x41381c){_0x5ed43a['sendStatus'](0x194);}return _0x41381c;};}function handleError(_0x3911fb,_0x51d9ab){_0x51d9ab=_0x51d9ab||0x1f4;return function(_0x36f22b){logger[_0x7c23('0x27')](_0x36f22b[_0x7c23('0x28')]);if(_0x36f22b[_0x7c23('0x29')]){delete _0x36f22b['name'];}_0x3911fb[_0x7c23('0x1a')](_0x51d9ab)['send'](_0x36f22b);};}exports[_0x7c23('0x24')]=function(_0x4f783b,_0x4965a6){if(_0x4f783b[_0x7c23('0x2a')]['id']){delete _0x4f783b[_0x7c23('0x2a')]['id'];}return db[_0x7c23('0x2b')]['find']({'where':{'id':_0x4f783b[_0x7c23('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4965a6,null))['then'](saveUpdates(_0x4f783b['body'],null))[_0x7c23('0x25')](respondWithResult(_0x4965a6,null))[_0x7c23('0x2d')](handleError(_0x4965a6,null));};exports[_0x7c23('0x2e')]=function(_0x8b3567,_0x3fef5a){return db[_0x7c23('0x2b')][_0x7c23('0x2f')]({'where':{'id':_0x8b3567['params']['id']}})[_0x7c23('0x25')](handleEntityNotFound(_0x3fef5a,null))[_0x7c23('0x25')](removeEntity(_0x3fef5a,null))['catch'](handleError(_0x3fef5a,null));}; \ No newline at end of file +var _0x2592=['limit','undefined','set','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','body','Action','find','params','catch','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset'];(function(_0x1ba8c2,_0x1957ab){var _0x19576e=function(_0x4538a6){while(--_0x4538a6){_0x1ba8c2['push'](_0x1ba8c2['shift']());}};_0x19576e(++_0x1957ab);}(_0x2592,0x108));var _0x2259=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0x2592[_0x1a7edf];return _0x56c1d9;};'use strict';var emlformat=require(_0x2259('0x0'));var rimraf=require(_0x2259('0x1'));var zipdir=require(_0x2259('0x2'));var jsonpatch=require(_0x2259('0x3'));var rp=require(_0x2259('0x4'));var moment=require('moment');var BPromise=require(_0x2259('0x5'));var Mustache=require(_0x2259('0x6'));var util=require(_0x2259('0x7'));var path=require(_0x2259('0x8'));var sox=require(_0x2259('0x9'));var csv=require(_0x2259('0xa'));var ejs=require(_0x2259('0xb'));var fs=require('fs');var fs_extra=require(_0x2259('0xc'));var _=require(_0x2259('0xd'));var squel=require(_0x2259('0xe'));var crypto=require(_0x2259('0xf'));var jsforce=require(_0x2259('0x10'));var deskjs=require(_0x2259('0x11'));var toCsv=require(_0x2259('0xa'));var querystring=require(_0x2259('0x12'));var Papa=require('papaparse');var Redis=require(_0x2259('0x13'));var authService=require(_0x2259('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2259('0x15'));var hardwareService=require(_0x2259('0x16'));var logger=require(_0x2259('0x17'))('api');var utils=require(_0x2259('0x18'));var config=require(_0x2259('0x19'));var licenseUtil=require(_0x2259('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49135d,_0x26bbb5){_0x26bbb5=_0x26bbb5||0xcc;return function(_0x163ea1){if(_0x163ea1){return _0x49135d['sendStatus'](_0x26bbb5);}return _0x49135d[_0x2259('0x1b')](_0x26bbb5)[_0x2259('0x1c')]();};}function respondWithResult(_0x5a5762,_0x43f34c){_0x43f34c=_0x43f34c||0xc8;return function(_0x592843){if(_0x592843){return _0x5a5762[_0x2259('0x1b')](_0x43f34c)['json'](_0x592843);}};}function respondWithFilteredResult(_0x41472d,_0x30b12c){return function(_0x39c24b){if(_0x39c24b){var _0x6b9783=typeof _0x30b12c[_0x2259('0x1d')]==='undefined'&&typeof _0x30b12c[_0x2259('0x1e')]===_0x2259('0x1f');var _0x4bfa39=_0x39c24b['count'];var _0x45adbb=_0x6b9783?0x0:_0x30b12c[_0x2259('0x1d')];var _0x590d2a=_0x6b9783?_0x39c24b['count']:_0x30b12c[_0x2259('0x1d')]+_0x30b12c[_0x2259('0x1e')];var _0xcc7c36;if(_0x590d2a>=_0x4bfa39){_0x590d2a=_0x4bfa39;_0xcc7c36=0xc8;}else{_0xcc7c36=0xce;}_0x41472d[_0x2259('0x1b')](_0xcc7c36);return _0x41472d[_0x2259('0x20')]('Content-Range',_0x45adbb+'-'+_0x590d2a+'/'+_0x4bfa39)[_0x2259('0x21')](_0x39c24b);}return null;};}function patchUpdates(_0x59cf70){return function(_0x173dbb){try{jsonpatch[_0x2259('0x22')](_0x173dbb,_0x59cf70,!![]);}catch(_0x3a2e99){return BPromise[_0x2259('0x23')](_0x3a2e99);}return _0x173dbb[_0x2259('0x24')]();};}function saveUpdates(_0x1a9355,_0x27d230){return function(_0x25a565){if(_0x25a565){return _0x25a565[_0x2259('0x25')](_0x1a9355)[_0x2259('0x26')](function(_0x25029b){return _0x25029b;});}return null;};}function removeEntity(_0x31d09e,_0x3ea5fe){return function(_0x34d555){if(_0x34d555){return _0x34d555[_0x2259('0x27')]()[_0x2259('0x26')](function(){_0x31d09e['status'](0xcc)[_0x2259('0x1c')]();});}};}function handleEntityNotFound(_0x5d91ac,_0x50d1e9){return function(_0xd80fd4){if(!_0xd80fd4){_0x5d91ac[_0x2259('0x28')](0x194);}return _0xd80fd4;};}function handleError(_0x4f90bd,_0x118c71){_0x118c71=_0x118c71||0x1f4;return function(_0x215a3a){logger[_0x2259('0x29')](_0x215a3a['stack']);if(_0x215a3a['name']){delete _0x215a3a[_0x2259('0x2a')];}_0x4f90bd[_0x2259('0x1b')](_0x118c71)[_0x2259('0x2b')](_0x215a3a);};}exports[_0x2259('0x25')]=function(_0x1542fd,_0x553aae){if(_0x1542fd['body']['id']){delete _0x1542fd[_0x2259('0x2c')]['id'];}return db[_0x2259('0x2d')][_0x2259('0x2e')]({'where':{'id':_0x1542fd[_0x2259('0x2f')]['id']}})[_0x2259('0x26')](handleEntityNotFound(_0x553aae,null))[_0x2259('0x26')](saveUpdates(_0x1542fd[_0x2259('0x2c')],null))['then'](respondWithResult(_0x553aae,null))[_0x2259('0x30')](handleError(_0x553aae,null));};exports[_0x2259('0x27')]=function(_0x20ec2d,_0x3262d4){return db[_0x2259('0x2d')][_0x2259('0x2e')]({'where':{'id':_0x20ec2d['params']['id']}})[_0x2259('0x26')](handleEntityNotFound(_0x3262d4,null))[_0x2259('0x26')](removeEntity(_0x3262d4,null))[_0x2259('0x30')](handleError(_0x3262d4,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b9d5fce..136f179 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 _0x672e=['Action','tools_actions','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./action.attributes','exports','define'];(function(_0x20e467,_0x1a707d){var _0x54694e=function(_0x387383){while(--_0x387383){_0x20e467['push'](_0x20e467['shift']());}};_0x54694e(++_0x1a707d);}(_0x672e,0x1e2));var _0xe672=function(_0x15b0d4,_0xe11bfb){_0x15b0d4=_0x15b0d4-0x0;var _0x5e3be7=_0x672e[_0x15b0d4];return _0x5e3be7;};'use strict';var _=require(_0xe672('0x0'));var util=require('util');var logger=require(_0xe672('0x1'))(_0xe672('0x2'));var moment=require(_0xe672('0x3'));var BPromise=require(_0xe672('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe672('0x5'));var rimraf=require('rimraf');var config=require(_0xe672('0x6'));var attributes=require(_0xe672('0x7'));module[_0xe672('0x8')]=function(_0x4d2ef9,_0x37c809){return _0x4d2ef9[_0xe672('0x9')](_0xe672('0xa'),attributes,{'tableName':_0xe672('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe213=['exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29dc38,_0x5651e7){var _0x593e0f=function(_0x50cad0){while(--_0x50cad0){_0x29dc38['push'](_0x29dc38['shift']());}};_0x593e0f(++_0x5651e7);}(_0xe213,0x11c));var _0x3e21=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe213[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x3e21('0x0'));var util=require(_0x3e21('0x1'));var logger=require(_0x3e21('0x2'))(_0x3e21('0x3'));var moment=require(_0x3e21('0x4'));var BPromise=require(_0x3e21('0x5'));var rp=require(_0x3e21('0x6'));var fs=require('fs');var path=require(_0x3e21('0x7'));var rimraf=require(_0x3e21('0x8'));var config=require(_0x3e21('0x9'));var attributes=require('./action.attributes');module[_0x3e21('0xa')]=function(_0x4410b3,_0x401c4d){return _0x4410b3[_0x3e21('0xb')](_0x3e21('0xc'),attributes,{'tableName':_0x3e21('0xd'),'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 e4141c3..ee2cdcc 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x422634,_0x49f610){var _0x17da9f=function(_0x4735de){while(--_0x4735de){_0x422634['push'](_0x422634['shift']());}};_0x17da9f(++_0x49f610);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7217,0x19e));var _0x7721=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x7217[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4759649..5273558 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 _0x2924=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x1fc16f,_0x5cdc65){var _0x4c475f=function(_0x9205e6){while(--_0x9205e6){_0x1fc16f['push'](_0x1fc16f['shift']());}};_0x4c475f(++_0x5cdc65);}(_0x2924,0x133));var _0x4292=function(_0x4de1c3,_0xbe77b9){_0x4de1c3=_0x4de1c3-0x0;var _0x26acfe=_0x2924[_0x4de1c3];return _0x26acfe;};'use strict';var multer=require(_0x4292('0x0'));var util=require(_0x4292('0x1'));var path=require(_0x4292('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4292('0x3')]();var fs_extra=require(_0x4292('0x4'));var auth=require(_0x4292('0x5'));var interaction=require(_0x4292('0x6'));var config=require(_0x4292('0x7'));var controller=require(_0x4292('0x8'));router[_0x4292('0x9')](_0x4292('0xa'),auth[_0x4292('0xb')](),controller[_0x4292('0xc')]);router[_0x4292('0xd')](_0x4292('0xa'),auth['isAuthenticated'](),controller[_0x4292('0xe')]);module[_0x4292('0xf')]=router; \ No newline at end of file +var _0x74b7=['isAuthenticated','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete'];(function(_0x241685,_0x1ab0ae){var _0x535d7f=function(_0x24475c){while(--_0x24475c){_0x241685['push'](_0x241685['shift']());}};_0x535d7f(++_0x1ab0ae);}(_0x74b7,0xa8));var _0x774b=function(_0x4a032e,_0x1475f5){_0x4a032e=_0x4a032e-0x0;var _0x4c2e30=_0x74b7[_0x4a032e];return _0x4c2e30;};'use strict';var multer=require('multer');var util=require(_0x774b('0x0'));var path=require('path');var timeout=require(_0x774b('0x1'));var express=require('express');var router=express[_0x774b('0x2')]();var fs_extra=require(_0x774b('0x3'));var auth=require(_0x774b('0x4'));var interaction=require(_0x774b('0x5'));var config=require(_0x774b('0x6'));var controller=require(_0x774b('0x7'));router[_0x774b('0x8')](_0x774b('0x9'),auth['isAuthenticated'](),controller[_0x774b('0xa')]);router[_0x774b('0xb')](_0x774b('0x9'),auth[_0x774b('0xc')](),controller[_0x774b('0xd')]);module[_0x774b('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 279f711..0a21dab 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x5fd1,0x155));var _0x15fd=function(_0xda3281,_0x3da7dd){_0xda3281=_0xda3281-0x0;var _0x40ada8=_0x5fd1[_0xda3281];return _0x40ada8;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x219ed5,_0x245b2a){var _0x2c7599=function(_0x5ea2df){while(--_0x5ea2df){_0x219ed5['push'](_0x219ed5['shift']());}};_0x2c7599(++_0x245b2a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x5fc3[_0x270a54];return _0x4d07d0;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9e559f2..9e54626 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 _0x223f=['DESC','alias','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','SEC_TO_TIME(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','field','condition','select','web','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','run','runReport','HOUR(%s)','keyBy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','send','map','fieldName','key','model','name','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy'];(function(_0x2a6580,_0x15f1fb){var _0x21489f=function(_0x1fd3c0){while(--_0x1fd3c0){_0x2a6580['push'](_0x2a6580['shift']());}};_0x21489f(++_0x15f1fb);}(_0x223f,0xd6));var _0xf223=function(_0x88e351,_0x3a1211){_0x88e351=_0x88e351-0x0;var _0x5ec895=_0x223f[_0x88e351];return _0x5ec895;};'use strict';var emlformat=require(_0xf223('0x0'));var rimraf=require(_0xf223('0x1'));var zipdir=require(_0xf223('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf223('0x3'));var moment=require(_0xf223('0x4'));var BPromise=require(_0xf223('0x5'));var Mustache=require(_0xf223('0x6'));var util=require(_0xf223('0x7'));var path=require(_0xf223('0x8'));var sox=require('sox');var csv=require(_0xf223('0x9'));var ejs=require(_0xf223('0xa'));var fs=require('fs');var fs_extra=require(_0xf223('0xb'));var _=require(_0xf223('0xc'));var squel=require(_0xf223('0xd'));var crypto=require(_0xf223('0xe'));var jsforce=require(_0xf223('0xf'));var deskjs=require(_0xf223('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf223('0x11'));var Papa=require(_0xf223('0x12'));var Redis=require(_0xf223('0x13'));var authService=require(_0xf223('0x14'));var qs=require(_0xf223('0x15'));var as=require(_0xf223('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf223('0x17'))('api');var utils=require(_0xf223('0x18'));var config=require(_0xf223('0x19'));var licenseUtil=require(_0xf223('0x1a'));var db=require(_0xf223('0x1b'))['db'];var dbH=require(_0xf223('0x1b'))[_0xf223('0x1c')];function respondWithStatusCode(_0x2fff66,_0x3d00df){_0x3d00df=_0x3d00df||0xcc;return function(_0x4079c7){if(_0x4079c7){return _0x2fff66['sendStatus'](_0x3d00df);}return _0x2fff66[_0xf223('0x1d')](_0x3d00df)[_0xf223('0x1e')]();};}function respondWithResult(_0x18cb8d,_0x3a6920){_0x3a6920=_0x3a6920||0xc8;return function(_0x4cf51e){if(_0x4cf51e){return _0x18cb8d[_0xf223('0x1d')](_0x3a6920)[_0xf223('0x1f')](_0x4cf51e);}};}function respondWithFilteredResult(_0x380a97,_0x22ab3d){return function(_0x30c8e2){if(_0x30c8e2){var _0x2b64db=typeof _0x22ab3d[_0xf223('0x20')]===_0xf223('0x21')&&typeof _0x22ab3d[_0xf223('0x22')]===_0xf223('0x21');var _0x3e39b7=_0x30c8e2[_0xf223('0x23')];var _0x3bcd14=_0x2b64db?0x0:_0x22ab3d[_0xf223('0x20')];var _0x3439a6=_0x2b64db?_0x30c8e2[_0xf223('0x23')]:_0x22ab3d[_0xf223('0x20')]+_0x22ab3d[_0xf223('0x22')];var _0x6e36bb;if(_0x3439a6>=_0x3e39b7){_0x3439a6=_0x3e39b7;_0x6e36bb=0xc8;}else{_0x6e36bb=0xce;}_0x380a97[_0xf223('0x1d')](_0x6e36bb);return _0x380a97[_0xf223('0x24')](_0xf223('0x25'),_0x3bcd14+'-'+_0x3439a6+'/'+_0x3e39b7)['json'](_0x30c8e2);}return null;};}function patchUpdates(_0x37f87d){return function(_0xa09c78){try{jsonpatch[_0xf223('0x26')](_0xa09c78,_0x37f87d,!![]);}catch(_0x8ab296){return BPromise['reject'](_0x8ab296);}return _0xa09c78[_0xf223('0x27')]();};}function saveUpdates(_0x1c26b3,_0x3197eb){return function(_0xc9dd65){if(_0xc9dd65){return _0xc9dd65[_0xf223('0x28')](_0x1c26b3)[_0xf223('0x29')](function(_0x393e9f){return _0x393e9f;});}return null;};}function removeEntity(_0x58826e,_0x3a1f05){return function(_0x17a9b4){if(_0x17a9b4){return _0x17a9b4[_0xf223('0x2a')]()[_0xf223('0x29')](function(){var _0xe1c863=_0x17a9b4[_0xf223('0x2b')]({'plain':!![]});var _0x312022=_0xf223('0x2c');return db[_0xf223('0x2d')][_0xf223('0x2a')]({'where':{'type':_0x312022,'resourceId':_0xe1c863['id']}})[_0xf223('0x29')](function(){return _0x17a9b4;});})[_0xf223('0x29')](function(){_0x58826e[_0xf223('0x1d')](0xcc)[_0xf223('0x1e')]();});}};}function handleEntityNotFound(_0x177781,_0x23a7b7){return function(_0x3679e9){if(!_0x3679e9){_0x177781[_0xf223('0x2e')](0x194);}return _0x3679e9;};}function handleError(_0x24ad84,_0x169e16){_0x169e16=_0x169e16||0x1f4;return function(_0x41aaf6){logger[_0xf223('0x2f')](_0x41aaf6[_0xf223('0x30')]);if(_0x41aaf6['name']){delete _0x41aaf6['name'];}_0x24ad84['status'](_0x169e16)[_0xf223('0x31')](_0x41aaf6);};}exports['index']=function(_0x36fea8,_0x419a8b){var _0x2bfc3e={},_0x28f92a={},_0x359a97={'count':0x0,'rows':[]};var _0x1fd24f=_[_0xf223('0x32')](db['AnalyticCustomReport']['rawAttributes'],function(_0x159435){return{'name':_0x159435[_0xf223('0x33')],'type':_0x159435['type'][_0xf223('0x34')]};});_0x28f92a[_0xf223('0x35')]=_[_0xf223('0x32')](_0x1fd24f,_0xf223('0x36'));_0x28f92a['query']=_[_0xf223('0x37')](_0x36fea8['query']);_0x28f92a['filters']=_[_0xf223('0x38')](_0x28f92a[_0xf223('0x35')],_0x28f92a[_0xf223('0x39')]);_0x2bfc3e[_0xf223('0x3a')]=_[_0xf223('0x38')](_0x28f92a[_0xf223('0x35')],qs[_0xf223('0x3b')](_0x36fea8[_0xf223('0x39')][_0xf223('0x3b')]));_0x2bfc3e[_0xf223('0x3a')]=_0x2bfc3e[_0xf223('0x3a')][_0xf223('0x3c')]?_0x2bfc3e['attributes']:_0x28f92a['model'];if(!_0x36fea8[_0xf223('0x39')][_0xf223('0x3d')](_0xf223('0x3e'))){_0x2bfc3e['limit']=qs['limit'](_0x36fea8['query'][_0xf223('0x22')]);_0x2bfc3e[_0xf223('0x20')]=qs[_0xf223('0x20')](_0x36fea8['query'][_0xf223('0x20')]);}_0x2bfc3e[_0xf223('0x3f')]=qs[_0xf223('0x40')](_0x36fea8[_0xf223('0x39')][_0xf223('0x40')]);_0x2bfc3e[_0xf223('0x41')]=qs[_0xf223('0x42')](_['pick'](_0x36fea8['query'],_0x28f92a[_0xf223('0x42')]),_0x1fd24f);if(_0x36fea8[_0xf223('0x39')]['filter']){_0x2bfc3e[_0xf223('0x41')]=_[_0xf223('0x43')](_0x2bfc3e[_0xf223('0x41')],{'$or':_[_0xf223('0x32')](_0x1fd24f,function(_0x2aaec6){if(_0x2aaec6[_0xf223('0x44')]!=='VIRTUAL'){var _0x178697={};_0x178697[_0x2aaec6[_0xf223('0x36')]]={'$like':'%'+_0x36fea8[_0xf223('0x39')][_0xf223('0x45')]+'%'};return _0x178697;}})});}_0x2bfc3e=_[_0xf223('0x43')]({},_0x2bfc3e,_0x36fea8[_0xf223('0x46')]);var _0x17a2d8={'where':_0x2bfc3e[_0xf223('0x41')]};return db[_0xf223('0x47')][_0xf223('0x23')](_0x17a2d8)[_0xf223('0x29')](function(_0x1b60ab){_0x359a97[_0xf223('0x23')]=_0x1b60ab;if(_0x36fea8[_0xf223('0x39')][_0xf223('0x48')]){_0x2bfc3e[_0xf223('0x49')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xf223('0x4a')](_0x2bfc3e);})[_0xf223('0x29')](function(_0x18ed8c){_0x359a97[_0xf223('0x4b')]=_0x18ed8c;return _0x359a97;})[_0xf223('0x29')](respondWithFilteredResult(_0x419a8b,_0x2bfc3e))[_0xf223('0x4c')](handleError(_0x419a8b,null));};exports[_0xf223('0x4d')]=function(_0x3feded,_0x2a28bb){var _0x34a78b={'raw':![],'where':{'id':_0x3feded[_0xf223('0x4e')]['id']}},_0x4bf1fb={};_0x4bf1fb[_0xf223('0x35')]=_[_0xf223('0x37')](db[_0xf223('0x47')][_0xf223('0x4f')]);_0x4bf1fb[_0xf223('0x39')]=_['keys'](_0x3feded[_0xf223('0x39')]);_0x4bf1fb[_0xf223('0x42')]=_[_0xf223('0x38')](_0x4bf1fb[_0xf223('0x35')],_0x4bf1fb[_0xf223('0x39')]);_0x34a78b['attributes']=_[_0xf223('0x38')](_0x4bf1fb[_0xf223('0x35')],qs[_0xf223('0x3b')](_0x3feded[_0xf223('0x39')][_0xf223('0x3b')]));_0x34a78b['attributes']=_0x34a78b[_0xf223('0x3a')][_0xf223('0x3c')]?_0x34a78b[_0xf223('0x3a')]:_0x4bf1fb[_0xf223('0x35')];if(_0x3feded[_0xf223('0x39')]['includeAll']){_0x34a78b[_0xf223('0x49')]=[{'all':!![]}];}_0x34a78b=_[_0xf223('0x43')]({},_0x34a78b,_0x3feded[_0xf223('0x46')]);return db[_0xf223('0x47')][_0xf223('0x50')](_0x34a78b)[_0xf223('0x29')](handleEntityNotFound(_0x2a28bb,null))[_0xf223('0x29')](respondWithResult(_0x2a28bb,null))[_0xf223('0x4c')](handleError(_0x2a28bb,null));};exports[_0xf223('0x51')]=function(_0x11a226,_0x33c5c4){return db[_0xf223('0x47')]['create'](_0x11a226['body'],{})['then'](function(_0x4767b4){var _0x1ce691=_0x11a226[_0xf223('0x52')]['get']({'plain':!![]});if(!_0x1ce691)throw new Error(_0xf223('0x53'));if(_0x1ce691[_0xf223('0x54')]===_0xf223('0x52')){var _0x34516d=_0x4767b4[_0xf223('0x2b')]({'plain':!![]});var _0x9899=_0xf223('0x55');return db[_0xf223('0x56')]['find']({'where':{'name':_0x9899,'userProfileId':_0x1ce691[_0xf223('0x57')]},'raw':!![]})[_0xf223('0x29')](function(_0x2f2e5a){if(_0x2f2e5a&&_0x2f2e5a[_0xf223('0x58')]===0x0){return db[_0xf223('0x2d')][_0xf223('0x51')]({'name':_0x34516d['name'],'resourceId':_0x34516d['id'],'type':_0xf223('0x2c'),'sectionId':_0x2f2e5a['id']},{})[_0xf223('0x29')](function(){return _0x4767b4;});}else{return _0x4767b4;}})['catch'](function(_0xfe2ef1){logger[_0xf223('0x2f')](_0xf223('0x59'),_0xfe2ef1);throw _0xfe2ef1;});}return _0x4767b4;})[_0xf223('0x29')](respondWithResult(_0x33c5c4,0xc9))[_0xf223('0x4c')](handleError(_0x33c5c4,null));};exports[_0xf223('0x28')]=function(_0x50c2c4,_0x343f9c){if(_0x50c2c4[_0xf223('0x5a')]['id']){delete _0x50c2c4[_0xf223('0x5a')]['id'];}return db['AnalyticCustomReport'][_0xf223('0x50')]({'where':{'id':_0x50c2c4['params']['id']}})[_0xf223('0x29')](handleEntityNotFound(_0x343f9c,null))[_0xf223('0x29')](saveUpdates(_0x50c2c4['body'],null))[_0xf223('0x29')](respondWithResult(_0x343f9c,null))['catch'](handleError(_0x343f9c,null));};exports['destroy']=function(_0x20712d,_0x148225){return db[_0xf223('0x47')]['find']({'where':{'id':_0x20712d[_0xf223('0x4e')]['id']}})['then'](handleEntityNotFound(_0x148225,null))[_0xf223('0x29')](removeEntity(_0x148225,null))['catch'](handleError(_0x148225,null));};exports[_0xf223('0x5b')]=function(_0x5cbb32,_0x3fb8da){var _0x9504a4=0xa;var _0x32dad0=[_0xf223('0x5c'),_0xf223('0x5d'),_0xf223('0x5e'),_0xf223('0x5f')];var _0x4b8028={'SUM':_0xf223('0x60'),'COUNT':_0xf223('0x61'),'COUNT DISTINCT':_0xf223('0x62'),'MAX':_0xf223('0x63'),'MIN':_0xf223('0x64'),'AVG':_0xf223('0x65'),'GROUP_CONCAT':_0xf223('0x66'),'GROUP_CONCAT ASC':_0xf223('0x67'),'GROUP_CONCAT DESC':_0xf223('0x68')};var _0x1b01b8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf223('0x69'),'HOUR':'HOUR(%s)','ROUND':_0xf223('0x6a'),'UNIX_TIMESTAMP':_0xf223('0x6b')};var _0x1f2ac2=function(_0x58b37d){return!_[_0xf223('0x6c')]([_0xf223('0x6d'),_0xf223('0x6e'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x58b37d);};var _0x1fbc7c=function(_0x358146){if(!_0x358146||!_0x358146[_0xf223('0x6f')][_0xf223('0x3c')]){return'';}for(var _0x1f2a16='(',_0x59e604=0x0;_0x59e604<_0x358146[_0xf223('0x6f')]['length'];_0x59e604+=0x1){_0x59e604>0x0&&(_0x1f2a16+='\x20'+_0x358146['operator']+'\x20');_0x1f2a16+=_0x358146[_0xf223('0x6f')][_0x59e604][_0xf223('0x70')]?_0x1fbc7c(_0x358146[_0xf223('0x6f')][_0x59e604][_0xf223('0x70')]):_0x358146['rules'][_0x59e604]['field']+'\x20'+_0x358146[_0xf223('0x6f')][_0x59e604]['condition']+(_0x1f2ac2(_0x358146['rules'][_0x59e604]['condition'])?'\x20'+_0x358146[_0xf223('0x6f')][_0x59e604][_0xf223('0x71')]:'');}return _0x1f2a16+')';};var _0x366732={'where':{'id':_0x5cbb32[_0xf223('0x4e')]['id']}},_0x151bb8,_0x856813,_0x1a7fe9,_0x11d401,_0xf0ea6a;_0x366732=_[_0xf223('0x43')]({},_0x366732,_0x5cbb32[_0xf223('0x46')]);return db['AnalyticCustomReport']['find'](_0x366732)[_0xf223('0x29')](function(_0x26baa2){if(_0x26baa2){_0x151bb8=_0x26baa2;return _0x26baa2[_0xf223('0x72')]();}return null;})[_0xf223('0x29')](function(_0x3c49f3){if(_0x3c49f3){if(!_0x3c49f3[_0xf223('0x3c')]){throw new db[(_0xf223('0x73'))][(_0xf223('0x74'))](_0xf223('0x75'),0x193);}_0x856813=_0x3c49f3;return db[_0xf223('0x76')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x46915f){if(_0x46915f){_0x1a7fe9=_['keyBy'](_0x46915f,'id');var _0x2f6ce9;var _0x1e91c2=squel['select']();_0x1e91c2[_0xf223('0x77')](_0x151bb8[_0xf223('0x78')]);for(var _0x4a1bfc=0x0;_0x4a1bfc<_0x856813['length'];_0x4a1bfc+=0x1){_0x2f6ce9=_0x856813[_0x4a1bfc]['MetricId']?_0x1a7fe9[_0x856813[_0x4a1bfc][_0xf223('0x79')]][_0xf223('0x7a')]:_0x856813[_0x4a1bfc]['field'];_0x2f6ce9=_0x856813[_0x4a1bfc][_0xf223('0x7b')]?_[_0xf223('0x7c')](_0x4b8028[_0x856813[_0x4a1bfc][_0xf223('0x7b')]],'%s',_0x2f6ce9):_0x2f6ce9;_0x2f6ce9=_0x856813[_0x4a1bfc]['format']?_[_0xf223('0x7c')](_0x1b01b8[_0x856813[_0x4a1bfc][_0xf223('0x7d')]],'%s',_0x2f6ce9):_0x2f6ce9;if(_0x856813[_0x4a1bfc][_0xf223('0x7e')]){_0x1e91c2['group'](_0x2f6ce9);}_0x856813[_0x4a1bfc][_0xf223('0x7f')]&&_0x1e91c2['order'](_0x2f6ce9,_0x856813[_0x4a1bfc][_0xf223('0x7f')]===_0xf223('0x80')?![]:!![]);_0x1e91c2['field'](_0x2f6ce9,_0x856813[_0x4a1bfc][_0xf223('0x81')]||_0x2f6ce9);}if(_0x151bb8[_0xf223('0x82')]){_0x151bb8['joins']=JSON[_0xf223('0x83')](_0x151bb8['joins']);for(var _0x37a76b=0x0;_0x37a76b<_0x151bb8[_0xf223('0x82')][_0xf223('0x3c')];_0x37a76b+=0x1){if(_0x151bb8[_0xf223('0x82')][_0x37a76b][_0xf223('0x44')]&&_[_0xf223('0x6c')](_0x32dad0,_0x151bb8['joins'][_0x37a76b]['type'])&&_0x151bb8[_0xf223('0x82')][_0x37a76b]['parentKey']&&_0x151bb8['joins'][_0x37a76b]['foreignTable']&&_0x151bb8[_0xf223('0x82')][_0x37a76b][_0xf223('0x84')]){_0x1e91c2[_0x151bb8[_0xf223('0x82')][_0x37a76b]['type']](_0x151bb8[_0xf223('0x82')][_0x37a76b][_0xf223('0x85')],null,util[_0xf223('0x7d')](_0xf223('0x86'),_0x151bb8[_0xf223('0x78')],_0x151bb8['joins'][_0x37a76b][_0xf223('0x87')],_0x151bb8['joins'][_0x37a76b][_0xf223('0x85')],_0x151bb8['joins'][_0x37a76b][_0xf223('0x84')]));}}}if(_0x151bb8[_0xf223('0x88')]){_0x151bb8[_0xf223('0x88')]=JSON[_0xf223('0x83')](_0x151bb8['conditions']);_0x1e91c2[_0xf223('0x41')](_0x1fbc7c(_0x151bb8[_0xf223('0x88')]['group']));}_0xf0ea6a=_0x1e91c2[_0xf223('0x89')]();_0x1e91c2[_0xf223('0x22')](_0x9504a4);_0x1e91c2['offset'](0x0);logger[_0xf223('0x8a')](_0xf223('0x8b'),_0x1e91c2[_0xf223('0x8c')]());return dbH['sequelize']['query'](_0x1e91c2[_0xf223('0x8c')](),{'type':dbH[_0xf223('0x8d')]['QueryTypes'][_0xf223('0x8e')]});}})[_0xf223('0x29')](respondWithResult(_0x3fb8da,null))[_0xf223('0x4c')](handleError(_0x3fb8da,null));};function runReport(_0x42959e,_0x2054e7,_0x5d0cd9){var _0x4c593e=_0x2054e7[_0xf223('0x36')];var _0x4c32a5=0xa;var _0x405ca1=[_0xf223('0x5c'),_0xf223('0x5d'),_0xf223('0x5e'),_0xf223('0x5f')];var _0x51181e={'SUM':_0xf223('0x60'),'COUNT':_0xf223('0x61'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf223('0x64'),'AVG':_0xf223('0x65'),'GROUP_CONCAT':_0xf223('0x66'),'GROUP_CONCAT ASC':_0xf223('0x67'),'GROUP_CONCAT DESC':_0xf223('0x68')};var _0x37ae7a={'SEC_TO_TIME':_0xf223('0x8f'),'DATE':_0xf223('0x69'),'HOUR':'HOUR(%s)','ROUND':_0xf223('0x6a'),'UNIX_TIMESTAMP':_0xf223('0x6b')};var _0x5a25d5=function(_0x3afd69){return!_[_0xf223('0x6c')](['IS\x20NULL',_0xf223('0x6e'),_0xf223('0x90'),_0xf223('0x91')],_0x3afd69);};var _0x40596a=function(_0x36eebd){if(!_0x36eebd||!_0x36eebd[_0xf223('0x6f')][_0xf223('0x3c')]){return'';}for(var _0x10d0da='(',_0x2fc469=0x0;_0x2fc469<_0x36eebd[_0xf223('0x6f')][_0xf223('0x3c')];_0x2fc469+=0x1){_0x2fc469>0x0&&(_0x10d0da+='\x20'+_0x36eebd[_0xf223('0x92')]+'\x20');_0x10d0da+=_0x36eebd['rules'][_0x2fc469]['group']?_0x40596a(_0x36eebd[_0xf223('0x6f')][_0x2fc469][_0xf223('0x70')]):_0x36eebd[_0xf223('0x6f')][_0x2fc469][_0xf223('0x93')]+'\x20'+_0x36eebd['rules'][_0x2fc469][_0xf223('0x94')]+(_0x5a25d5(_0x36eebd[_0xf223('0x6f')][_0x2fc469][_0xf223('0x94')])?'\x20'+_0x36eebd['rules'][_0x2fc469][_0xf223('0x71')]:'');}return _0x10d0da+')';};var _0x49f367={'where':{'id':_0x42959e['id']}},_0x560dda,_0x40ac3e,_0x3d4df7,_0x32c20e,_0xed80bf;_0x49f367=_[_0xf223('0x43')]({},_0x49f367,_0x5d0cd9);return db['AnalyticCustomReport'][_0xf223('0x50')](_0x49f367)['then'](function(_0x1c3679){if(_0x1c3679){_0x560dda=_0x1c3679;return _0x1c3679[_0xf223('0x72')]();}return null;})[_0xf223('0x29')](function(_0x1411ef){if(_0x1411ef){if(!_0x1411ef[_0xf223('0x3c')]){throw new db[(_0xf223('0x73'))][(_0xf223('0x74'))](_0xf223('0x75'),0x193);}_0x40ac3e=_0x1411ef;return db[_0xf223('0x76')]['findAll']({'raw':!![]});}return null;})[_0xf223('0x29')](function(_0x56ff91){if(_0x56ff91){_0x3d4df7=_['keyBy'](_0x56ff91,'id');var _0x5dcf37;var _0x1ce72b=squel[_0xf223('0x95')]();_0x1ce72b['from'](_0x560dda[_0xf223('0x78')]);for(var _0x5a0ed0=0x0;_0x5a0ed0<_0x40ac3e[_0xf223('0x3c')];_0x5a0ed0+=0x1){_0x5dcf37=_0x40ac3e[_0x5a0ed0][_0xf223('0x79')]?_0x3d4df7[_0x40ac3e[_0x5a0ed0]['MetricId']]['metric']:_0x40ac3e[_0x5a0ed0]['field'];_0x5dcf37=_0x40ac3e[_0x5a0ed0][_0xf223('0x7b')]?_['replace'](_0x51181e[_0x40ac3e[_0x5a0ed0][_0xf223('0x7b')]],'%s',_0x5dcf37):_0x5dcf37;_0x5dcf37=_0x40ac3e[_0x5a0ed0][_0xf223('0x7d')]?_[_0xf223('0x7c')](_0x37ae7a[_0x40ac3e[_0x5a0ed0][_0xf223('0x7d')]],'%s',_0x5dcf37):_0x5dcf37;if(_0x40ac3e[_0x5a0ed0][_0xf223('0x7e')]){_0x1ce72b['group'](_0x5dcf37);}_0x40ac3e[_0x5a0ed0][_0xf223('0x7f')]&&_0x1ce72b[_0xf223('0x3f')](_0x5dcf37,_0x40ac3e[_0x5a0ed0]['orderBy']===_0xf223('0x80')?![]:!![]);_0x1ce72b[_0xf223('0x93')](_0x5dcf37,_0x40ac3e[_0x5a0ed0]['alias']||_0x5dcf37);}if(_0x560dda['joins']){_0x560dda[_0xf223('0x82')]=JSON[_0xf223('0x83')](_0x560dda[_0xf223('0x82')]);for(var _0x3791ec=0x0;_0x3791ec<_0x560dda[_0xf223('0x82')][_0xf223('0x3c')];_0x3791ec+=0x1){if(_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x44')]&&_[_0xf223('0x6c')](_0x405ca1,_0x560dda[_0xf223('0x82')][_0x3791ec]['type'])&&_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x87')]&&_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x85')]&&_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x84')]){_0x1ce72b[_0x560dda['joins'][_0x3791ec][_0xf223('0x44')]](_0x560dda['joins'][_0x3791ec][_0xf223('0x85')],null,util[_0xf223('0x7d')](_0xf223('0x86'),_0x560dda['table'],_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x87')],_0x560dda['joins'][_0x3791ec]['foreignTable'],_0x560dda[_0xf223('0x82')][_0x3791ec][_0xf223('0x84')]));}}}if(_0x560dda[_0xf223('0x88')]){_0x560dda[_0xf223('0x88')]=JSON['parse'](_0x560dda[_0xf223('0x88')]);_0x1ce72b[_0xf223('0x41')](_0x40596a(_0x560dda['conditions'][_0xf223('0x70')]));}_0xed80bf=_0x1ce72b[_0xf223('0x89')]();_0x1ce72b[_0xf223('0x22')](_0x4c32a5);_0x1ce72b[_0xf223('0x20')](0x0);return;}})[_0xf223('0x29')](function(){if(_0x2054e7['output']===_0xf223('0x96')){return null;}var _0x7266f9=_[_0xf223('0x43')](_0x2054e7,{'name':_0x2054e7['fullPath']||_0x2054e7['name']||_0x560dda[_0xf223('0x36')],'basename':_0x4c593e,'savename':util[_0xf223('0x7d')](_0xf223('0x97'),_0x2054e7[_0xf223('0x36')]||_0x560dda['name'],require(_0xf223('0x98'))['generate'](0x4),_0x2054e7[_0xf223('0x99')]||_0xf223('0x9a')),'reportId':_0x560dda['id'],'reportType':_0xf223('0x9b')});return db[_0xf223('0x9c')]['create'](_0x7266f9,{'raw':!![]});})[_0xf223('0x29')](function(_0xc78898){if(_0x560dda[_0xf223('0x78')]==='cdr'){_0xed80bf[_0xf223('0x41')](_0x560dda[_0xf223('0x78')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2054e7[_0xf223('0x9d')],_0x2054e7[_0xf223('0x9e')]);}else{_0xed80bf[_0xf223('0x41')](_0x560dda['table']+_0xf223('0x9f'),_0x2054e7[_0xf223('0x9d')],_0x2054e7[_0xf223('0x9e')]);}if(_0xc78898){logger[_0xf223('0xa0')]('Run\x20Query:',_0xed80bf[_0xf223('0x8c')]());require(_0xf223('0xa1'))[_0xf223('0xa2')](path[_0xf223('0x5c')](__dirname,_0xf223('0xa3'),_0xc78898[_0xf223('0x99')]),[_0xc78898['id'],_0xed80bf[_0xf223('0x8c')](),path[_0xf223('0x5c')](__dirname,_0xf223('0xa4'),_0xc78898[_0xf223('0xa5')]),_0x4c593e]);return _0xc78898;}else{var _0x500e42=squel['select']();_0x500e42[_0xf223('0x77')]('('+_0xed80bf['toString']()+')','countTable');_0x500e42[_0xf223('0x93')]('COUNT(*)','count');_0xed80bf[_0xf223('0x22')](_0x2054e7[_0xf223('0x22')]||_0x4c32a5);_0xed80bf['offset'](_0x2054e7[_0xf223('0x20')]||0x0);return dbH[_0xf223('0x8d')][_0xf223('0x39')](_0x500e42[_0xf223('0x8c')](),{'type':dbH[_0xf223('0x8d')][_0xf223('0xa6')]['SELECT']})[_0xf223('0x29')](function(_0x2ef023){if(!_0x2ef023[_0xf223('0x3c')]){_0x32c20e=0x0;}else{_0x32c20e=_0x2ef023[0x0]['count']||0x0;}return dbH[_0xf223('0x8d')][_0xf223('0x39')](_0xed80bf[_0xf223('0x8c')](),{'type':dbH[_0xf223('0x8d')][_0xf223('0xa6')]['SELECT']});})[_0xf223('0x29')](function(_0xe92b88){return{'rows':_0xe92b88||[],'count':_0x32c20e};});}});}exports[_0xf223('0xa7')]=function(_0x3c62b3,_0x4e3adf){return runReport(_0x3c62b3[_0xf223('0x4e')],_0x3c62b3[_0xf223('0x39')],_0x3c62b3[_0xf223('0x46')])['then'](respondWithResult(_0x4e3adf,null))[_0xf223('0x4c')](handleError(_0x4e3adf,null));};exports[_0xf223('0xa8')]=runReport;exports['query']=function(_0x15ee3f,_0x372d09){var _0x36bbd6=0xa;var _0x192a5f=[_0xf223('0x5c'),'left_join','right_join',_0xf223('0x5f')];var _0x2e7ab6={'SUM':'SUM(%s)','COUNT':_0xf223('0x61'),'COUNT DISTINCT':_0xf223('0x62'),'MAX':_0xf223('0x63'),'MIN':'MIN(%s)','AVG':_0xf223('0x65'),'GROUP_CONCAT':_0xf223('0x66'),'GROUP_CONCAT ASC':_0xf223('0x67'),'GROUP_CONCAT DESC':_0xf223('0x68')};var _0x59133b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xf223('0xa9'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf223('0x6b')};var _0x37ffbb=function(_0x5ca33e){return!_['includes'](['IS\x20NULL',_0xf223('0x6e'),_0xf223('0x90'),_0xf223('0x91')],_0x5ca33e);};var _0x3851f2=function(_0x3feaa2){if(!_0x3feaa2||!_0x3feaa2['rules'][_0xf223('0x3c')]){return'';}for(var _0x622c84='(',_0x26b199=0x0;_0x26b199<_0x3feaa2['rules']['length'];_0x26b199+=0x1){_0x26b199>0x0&&(_0x622c84+='\x20'+_0x3feaa2['operator']+'\x20');_0x622c84+=_0x3feaa2[_0xf223('0x6f')][_0x26b199][_0xf223('0x70')]?_0x3851f2(_0x3feaa2['rules'][_0x26b199][_0xf223('0x70')]):_0x3feaa2[_0xf223('0x6f')][_0x26b199]['field']+'\x20'+_0x3feaa2[_0xf223('0x6f')][_0x26b199]['condition']+(_0x37ffbb(_0x3feaa2[_0xf223('0x6f')][_0x26b199][_0xf223('0x94')])?'\x20'+_0x3feaa2[_0xf223('0x6f')][_0x26b199][_0xf223('0x71')]:'');}return _0x622c84+')';};var _0x43ad65={'where':{'id':_0x15ee3f['params']['id']}},_0x142d5c,_0x5b37bf,_0x3efc1a,_0x269ce4,_0x3812d9;_0x43ad65=_[_0xf223('0x43')]({},_0x43ad65,_0x15ee3f['options']);return db[_0xf223('0x47')][_0xf223('0x50')](_0x43ad65)[_0xf223('0x29')](function(_0x4cdc84){if(_0x4cdc84){_0x142d5c=_0x4cdc84;return _0x4cdc84['getFields']();}return null;})[_0xf223('0x29')](function(_0x113610){if(_0x113610){if(!_0x113610[_0xf223('0x3c')]){throw new db[(_0xf223('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5b37bf=_0x113610;return db['AnalyticMetric'][_0xf223('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x586251){if(_0x586251){_0x3efc1a=_[_0xf223('0xaa')](_0x586251,'id');var _0xfca25b;var _0x5eccdd=squel[_0xf223('0x95')]();_0x5eccdd[_0xf223('0x77')](_0x142d5c[_0xf223('0x78')]);for(var _0x3e81f0=0x0;_0x3e81f0<_0x5b37bf[_0xf223('0x3c')];_0x3e81f0+=0x1){_0xfca25b=_0x5b37bf[_0x3e81f0]['MetricId']?_0x3efc1a[_0x5b37bf[_0x3e81f0]['MetricId']]['metric']:_0x5b37bf[_0x3e81f0][_0xf223('0x93')];_0xfca25b=_0x5b37bf[_0x3e81f0][_0xf223('0x7b')]?_[_0xf223('0x7c')](_0x2e7ab6[_0x5b37bf[_0x3e81f0][_0xf223('0x7b')]],'%s',_0xfca25b):_0xfca25b;_0xfca25b=_0x5b37bf[_0x3e81f0][_0xf223('0x7d')]?_[_0xf223('0x7c')](_0x59133b[_0x5b37bf[_0x3e81f0][_0xf223('0x7d')]],'%s',_0xfca25b):_0xfca25b;if(_0x5b37bf[_0x3e81f0]['groupBy']){_0x5eccdd[_0xf223('0x70')](_0xfca25b);}_0x5b37bf[_0x3e81f0][_0xf223('0x7f')]&&_0x5eccdd[_0xf223('0x3f')](_0xfca25b,_0x5b37bf[_0x3e81f0][_0xf223('0x7f')]===_0xf223('0x80')?![]:!![]);_0x5eccdd[_0xf223('0x93')](_0xfca25b,_0x5b37bf[_0x3e81f0][_0xf223('0x81')]||_0xfca25b);}if(_0x142d5c[_0xf223('0x82')]){_0x142d5c['joins']=JSON[_0xf223('0x83')](_0x142d5c[_0xf223('0x82')]);for(var _0x15ba50=0x0;_0x15ba50<_0x142d5c[_0xf223('0x82')][_0xf223('0x3c')];_0x15ba50+=0x1){if(_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x44')]&&_['includes'](_0x192a5f,_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x44')])&&_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x87')]&&_0x142d5c['joins'][_0x15ba50][_0xf223('0x85')]&&_0x142d5c['joins'][_0x15ba50][_0xf223('0x84')]){_0x5eccdd[_0x142d5c['joins'][_0x15ba50][_0xf223('0x44')]](_0x142d5c['joins'][_0x15ba50][_0xf223('0x85')],null,util['format'](_0xf223('0x86'),_0x142d5c[_0xf223('0x78')],_0x142d5c[_0xf223('0x82')][_0x15ba50]['parentKey'],_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x85')],_0x142d5c[_0xf223('0x82')][_0x15ba50][_0xf223('0x84')]));}}}if(_0x142d5c[_0xf223('0x88')]){_0x142d5c[_0xf223('0x88')]=JSON[_0xf223('0x83')](_0x142d5c[_0xf223('0x88')]);_0x5eccdd[_0xf223('0x41')](_0x3851f2(_0x142d5c[_0xf223('0x88')][_0xf223('0x70')]));}_0x3812d9=_0x5eccdd[_0xf223('0x89')]();_0x5eccdd[_0xf223('0x22')](_0x36bbd6);_0x5eccdd[_0xf223('0x20')](0x0);logger[_0xf223('0x8a')]('Limited\x20Query:',_0x5eccdd[_0xf223('0x8c')]());return dbH[_0xf223('0x8d')]['query'](_0x5eccdd['toString'](),{'type':dbH[_0xf223('0x8d')][_0xf223('0xa6')][_0xf223('0x8e')]});}})[_0xf223('0x29')](function(){return{'sql':_0x3812d9['toString']()};})[_0xf223('0x29')](respondWithResult(_0x372d09,null))[_0xf223('0x4c')](handleError(_0x372d09,null));}; \ No newline at end of file +var _0x3caa=['table','MetricId','metric','field','function','replace','format','orderBy','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','Sequelize','findAll','groupBy','order','DESC','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','SELECT','run','runReport','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','get','CustomReports','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','AnalyticCustomReport','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3caa,0x186));var _0xa3ca=function(_0x197bc8,_0x11e353){_0x197bc8=_0x197bc8-0x0;var _0x229eda=_0x3caa[_0x197bc8];return _0x229eda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3ca('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3ca('0x1'));var rp=require(_0xa3ca('0x2'));var moment=require(_0xa3ca('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3ca('0x4'));var path=require(_0xa3ca('0x5'));var sox=require(_0xa3ca('0x6'));var csv=require(_0xa3ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3ca('0x8'));var _=require('lodash');var squel=require(_0xa3ca('0x9'));var crypto=require('crypto');var jsforce=require(_0xa3ca('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa3ca('0x7'));var querystring=require('querystring');var Papa=require(_0xa3ca('0xb'));var Redis=require(_0xa3ca('0xc'));var authService=require(_0xa3ca('0xd'));var qs=require(_0xa3ca('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3ca('0xf'));var logger=require(_0xa3ca('0x10'))(_0xa3ca('0x11'));var utils=require(_0xa3ca('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa3ca('0x13'))['db'];var dbH=require(_0xa3ca('0x13'))[_0xa3ca('0x14')];function respondWithStatusCode(_0x33f2c6,_0x23e9bb){_0x23e9bb=_0x23e9bb||0xcc;return function(_0x553d35){if(_0x553d35){return _0x33f2c6[_0xa3ca('0x15')](_0x23e9bb);}return _0x33f2c6[_0xa3ca('0x16')](_0x23e9bb)[_0xa3ca('0x17')]();};}function respondWithResult(_0x4ac506,_0x49e71d){_0x49e71d=_0x49e71d||0xc8;return function(_0x2a2d1b){if(_0x2a2d1b){return _0x4ac506[_0xa3ca('0x16')](_0x49e71d)[_0xa3ca('0x18')](_0x2a2d1b);}};}function respondWithFilteredResult(_0x175046,_0x406ff4){return function(_0x33d771){if(_0x33d771){var _0x2475da=typeof _0x406ff4[_0xa3ca('0x19')]===_0xa3ca('0x1a')&&typeof _0x406ff4[_0xa3ca('0x1b')]===_0xa3ca('0x1a');var _0x5ab867=_0x33d771[_0xa3ca('0x1c')];var _0x4dd086=_0x2475da?0x0:_0x406ff4['offset'];var _0xe6f4c2=_0x2475da?_0x33d771[_0xa3ca('0x1c')]:_0x406ff4['offset']+_0x406ff4[_0xa3ca('0x1b')];var _0x14c27c;if(_0xe6f4c2>=_0x5ab867){_0xe6f4c2=_0x5ab867;_0x14c27c=0xc8;}else{_0x14c27c=0xce;}_0x175046[_0xa3ca('0x16')](_0x14c27c);return _0x175046['set'](_0xa3ca('0x1d'),_0x4dd086+'-'+_0xe6f4c2+'/'+_0x5ab867)['json'](_0x33d771);}return null;};}function patchUpdates(_0x11de93){return function(_0x5cc0fb){try{jsonpatch['apply'](_0x5cc0fb,_0x11de93,!![]);}catch(_0xf7253c){return BPromise[_0xa3ca('0x1e')](_0xf7253c);}return _0x5cc0fb[_0xa3ca('0x1f')]();};}function saveUpdates(_0x157242,_0x1f22de){return function(_0x1de02a){if(_0x1de02a){return _0x1de02a['update'](_0x157242)[_0xa3ca('0x20')](function(_0x4610fe){return _0x4610fe;});}return null;};}function removeEntity(_0x122132,_0x383431){return function(_0x17bd87){if(_0x17bd87){return _0x17bd87['destroy']()[_0xa3ca('0x20')](function(){var _0x2dac30=_0x17bd87[_0xa3ca('0x21')]({'plain':!![]});var _0x476d82=_0xa3ca('0x22');return db['UserProfileResource'][_0xa3ca('0x23')]({'where':{'type':_0x476d82,'resourceId':_0x2dac30['id']}})[_0xa3ca('0x20')](function(){return _0x17bd87;});})[_0xa3ca('0x20')](function(){_0x122132[_0xa3ca('0x16')](0xcc)[_0xa3ca('0x17')]();});}};}function handleEntityNotFound(_0x412b2e,_0x5ea65f){return function(_0x3fbeb5){if(!_0x3fbeb5){_0x412b2e[_0xa3ca('0x15')](0x194);}return _0x3fbeb5;};}function handleError(_0x104e09,_0x47ed5f){_0x47ed5f=_0x47ed5f||0x1f4;return function(_0x490fd1){logger[_0xa3ca('0x24')](_0x490fd1[_0xa3ca('0x25')]);if(_0x490fd1[_0xa3ca('0x26')]){delete _0x490fd1[_0xa3ca('0x26')];}_0x104e09[_0xa3ca('0x16')](_0x47ed5f)[_0xa3ca('0x27')](_0x490fd1);};}exports[_0xa3ca('0x28')]=function(_0x478c65,_0x25540d){var _0x4b689a={},_0x4ba4e7={},_0x5aee6d={'count':0x0,'rows':[]};var _0x489ab2=_['map'](db['AnalyticCustomReport'][_0xa3ca('0x29')],function(_0x22aa34){return{'name':_0x22aa34[_0xa3ca('0x2a')],'type':_0x22aa34[_0xa3ca('0x2b')][_0xa3ca('0x2c')]};});_0x4ba4e7[_0xa3ca('0x2d')]=_[_0xa3ca('0x2e')](_0x489ab2,'name');_0x4ba4e7[_0xa3ca('0x2f')]=_[_0xa3ca('0x30')](_0x478c65[_0xa3ca('0x2f')]);_0x4ba4e7[_0xa3ca('0x31')]=_[_0xa3ca('0x32')](_0x4ba4e7[_0xa3ca('0x2d')],_0x4ba4e7['query']);_0x4b689a[_0xa3ca('0x33')]=_[_0xa3ca('0x32')](_0x4ba4e7[_0xa3ca('0x2d')],qs[_0xa3ca('0x34')](_0x478c65[_0xa3ca('0x2f')][_0xa3ca('0x34')]));_0x4b689a[_0xa3ca('0x33')]=_0x4b689a[_0xa3ca('0x33')][_0xa3ca('0x35')]?_0x4b689a[_0xa3ca('0x33')]:_0x4ba4e7[_0xa3ca('0x2d')];if(!_0x478c65[_0xa3ca('0x2f')][_0xa3ca('0x36')](_0xa3ca('0x37'))){_0x4b689a['limit']=qs[_0xa3ca('0x1b')](_0x478c65[_0xa3ca('0x2f')][_0xa3ca('0x1b')]);_0x4b689a[_0xa3ca('0x19')]=qs['offset'](_0x478c65[_0xa3ca('0x2f')][_0xa3ca('0x19')]);}_0x4b689a['order']=qs[_0xa3ca('0x38')](_0x478c65[_0xa3ca('0x2f')]['sort']);_0x4b689a[_0xa3ca('0x39')]=qs[_0xa3ca('0x31')](_[_0xa3ca('0x3a')](_0x478c65[_0xa3ca('0x2f')],_0x4ba4e7[_0xa3ca('0x31')]),_0x489ab2);if(_0x478c65[_0xa3ca('0x2f')][_0xa3ca('0x3b')]){_0x4b689a[_0xa3ca('0x39')]=_[_0xa3ca('0x3c')](_0x4b689a[_0xa3ca('0x39')],{'$or':_[_0xa3ca('0x2e')](_0x489ab2,function(_0x428d65){if(_0x428d65[_0xa3ca('0x2b')]!==_0xa3ca('0x3d')){var _0x2c0680={};_0x2c0680[_0x428d65[_0xa3ca('0x26')]]={'$like':'%'+_0x478c65[_0xa3ca('0x2f')][_0xa3ca('0x3b')]+'%'};return _0x2c0680;}})});}_0x4b689a=_[_0xa3ca('0x3c')]({},_0x4b689a,_0x478c65['options']);var _0x4c827e={'where':_0x4b689a['where']};return db['AnalyticCustomReport']['count'](_0x4c827e)[_0xa3ca('0x20')](function(_0x888c4a){_0x5aee6d[_0xa3ca('0x1c')]=_0x888c4a;if(_0x478c65[_0xa3ca('0x2f')][_0xa3ca('0x3e')]){_0x4b689a[_0xa3ca('0x3f')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x4b689a);})[_0xa3ca('0x20')](function(_0x1fb37b){_0x5aee6d[_0xa3ca('0x40')]=_0x1fb37b;return _0x5aee6d;})[_0xa3ca('0x20')](respondWithFilteredResult(_0x25540d,_0x4b689a))[_0xa3ca('0x41')](handleError(_0x25540d,null));};exports[_0xa3ca('0x42')]=function(_0x256648,_0x1853b5){var _0x5bf8cd={'raw':![],'where':{'id':_0x256648['params']['id']}},_0x39096f={};_0x39096f[_0xa3ca('0x2d')]=_[_0xa3ca('0x30')](db[_0xa3ca('0x43')][_0xa3ca('0x29')]);_0x39096f[_0xa3ca('0x2f')]=_[_0xa3ca('0x30')](_0x256648[_0xa3ca('0x2f')]);_0x39096f[_0xa3ca('0x31')]=_[_0xa3ca('0x32')](_0x39096f[_0xa3ca('0x2d')],_0x39096f[_0xa3ca('0x2f')]);_0x5bf8cd[_0xa3ca('0x33')]=_[_0xa3ca('0x32')](_0x39096f['model'],qs[_0xa3ca('0x34')](_0x256648['query'][_0xa3ca('0x34')]));_0x5bf8cd[_0xa3ca('0x33')]=_0x5bf8cd[_0xa3ca('0x33')][_0xa3ca('0x35')]?_0x5bf8cd[_0xa3ca('0x33')]:_0x39096f['model'];if(_0x256648[_0xa3ca('0x2f')]['includeAll']){_0x5bf8cd[_0xa3ca('0x3f')]=[{'all':!![]}];}_0x5bf8cd=_['merge']({},_0x5bf8cd,_0x256648['options']);return db['AnalyticCustomReport']['find'](_0x5bf8cd)['then'](handleEntityNotFound(_0x1853b5,null))[_0xa3ca('0x20')](respondWithResult(_0x1853b5,null))[_0xa3ca('0x41')](handleError(_0x1853b5,null));};exports[_0xa3ca('0x44')]=function(_0xaeca9c,_0x2a04ea){return db['AnalyticCustomReport'][_0xa3ca('0x44')](_0xaeca9c[_0xa3ca('0x45')],{})[_0xa3ca('0x20')](function(_0x3592bd){var _0x3e8c3e=_0xaeca9c['user'][_0xa3ca('0x21')]({'plain':!![]});if(!_0x3e8c3e)throw new Error(_0xa3ca('0x46'));if(_0x3e8c3e[_0xa3ca('0x47')]===_0xa3ca('0x48')){var _0x12e259=_0x3592bd[_0xa3ca('0x21')]({'plain':!![]});var _0x2449f3=_0xa3ca('0x49');return db[_0xa3ca('0x4a')]['find']({'where':{'name':_0x2449f3,'userProfileId':_0x3e8c3e[_0xa3ca('0x4b')]},'raw':!![]})[_0xa3ca('0x20')](function(_0x308cef){if(_0x308cef&&_0x308cef['autoAssociation']===0x0){return db[_0xa3ca('0x4c')][_0xa3ca('0x44')]({'name':_0x12e259[_0xa3ca('0x26')],'resourceId':_0x12e259['id'],'type':'CustomReports','sectionId':_0x308cef['id']},{})[_0xa3ca('0x20')](function(){return _0x3592bd;});}else{return _0x3592bd;}})[_0xa3ca('0x41')](function(_0x464e4a){logger[_0xa3ca('0x24')](_0xa3ca('0x4d'),_0x464e4a);throw _0x464e4a;});}return _0x3592bd;})[_0xa3ca('0x20')](respondWithResult(_0x2a04ea,0xc9))[_0xa3ca('0x41')](handleError(_0x2a04ea,null));};exports[_0xa3ca('0x4e')]=function(_0x4022ba,_0x4ad229){if(_0x4022ba['body']['id']){delete _0x4022ba[_0xa3ca('0x45')]['id'];}return db[_0xa3ca('0x43')][_0xa3ca('0x4f')]({'where':{'id':_0x4022ba['params']['id']}})['then'](handleEntityNotFound(_0x4ad229,null))[_0xa3ca('0x20')](saveUpdates(_0x4022ba[_0xa3ca('0x45')],null))[_0xa3ca('0x20')](respondWithResult(_0x4ad229,null))['catch'](handleError(_0x4ad229,null));};exports[_0xa3ca('0x23')]=function(_0x8c3699,_0x4378c1){return db[_0xa3ca('0x43')][_0xa3ca('0x4f')]({'where':{'id':_0x8c3699[_0xa3ca('0x50')]['id']}})['then'](handleEntityNotFound(_0x4378c1,null))[_0xa3ca('0x20')](removeEntity(_0x4378c1,null))[_0xa3ca('0x41')](handleError(_0x4378c1,null));};exports[_0xa3ca('0x51')]=function(_0x55a34e,_0x5adecd){var _0x53e8e5=0xa;var _0x47eddc=[_0xa3ca('0x52'),_0xa3ca('0x53'),_0xa3ca('0x54'),_0xa3ca('0x55')];var _0x32c1a2={'SUM':'SUM(%s)','COUNT':_0xa3ca('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xa3ca('0x57'),'AVG':_0xa3ca('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa3ca('0x59'),'GROUP_CONCAT DESC':_0xa3ca('0x5a')};var _0x6c3421={'SEC_TO_TIME':_0xa3ca('0x5b'),'DATE':'DATE(%s)','HOUR':_0xa3ca('0x5c'),'ROUND':_0xa3ca('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x11f3bb=function(_0x1da8c2){return!_['includes']([_0xa3ca('0x5e'),_0xa3ca('0x5f'),_0xa3ca('0x60'),_0xa3ca('0x61')],_0x1da8c2);};var _0x1b4f33=function(_0xfb6558){if(!_0xfb6558||!_0xfb6558[_0xa3ca('0x62')][_0xa3ca('0x35')]){return'';}for(var _0x321b07='(',_0x4ff482=0x0;_0x4ff482<_0xfb6558[_0xa3ca('0x62')]['length'];_0x4ff482+=0x1){_0x4ff482>0x0&&(_0x321b07+='\x20'+_0xfb6558[_0xa3ca('0x63')]+'\x20');_0x321b07+=_0xfb6558['rules'][_0x4ff482][_0xa3ca('0x64')]?_0x1b4f33(_0xfb6558[_0xa3ca('0x62')][_0x4ff482][_0xa3ca('0x64')]):_0xfb6558[_0xa3ca('0x62')][_0x4ff482]['field']+'\x20'+_0xfb6558['rules'][_0x4ff482][_0xa3ca('0x65')]+(_0x11f3bb(_0xfb6558[_0xa3ca('0x62')][_0x4ff482][_0xa3ca('0x65')])?'\x20'+_0xfb6558[_0xa3ca('0x62')][_0x4ff482][_0xa3ca('0x66')]:'');}return _0x321b07+')';};var _0x8c6e1b={'where':{'id':_0x55a34e[_0xa3ca('0x50')]['id']}},_0x44b1c7,_0xe2e2f2,_0x2a9c8a,_0x40e85d,_0xa69fb3;_0x8c6e1b=_['merge']({},_0x8c6e1b,_0x55a34e[_0xa3ca('0x67')]);return db[_0xa3ca('0x43')][_0xa3ca('0x4f')](_0x8c6e1b)[_0xa3ca('0x20')](function(_0x5dbad5){if(_0x5dbad5){_0x44b1c7=_0x5dbad5;return _0x5dbad5[_0xa3ca('0x68')]();}return null;})['then'](function(_0x4c7dc7){if(_0x4c7dc7){if(!_0x4c7dc7['length']){throw new db['Sequelize'][(_0xa3ca('0x69'))](_0xa3ca('0x6a'),0x193);}_0xe2e2f2=_0x4c7dc7;return db[_0xa3ca('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x314b85){if(_0x314b85){_0x2a9c8a=_[_0xa3ca('0x6c')](_0x314b85,'id');var _0x4cf547;var _0x5e8784=squel[_0xa3ca('0x6d')]();_0x5e8784[_0xa3ca('0x6e')](_0x44b1c7[_0xa3ca('0x6f')]);for(var _0x32dc72=0x0;_0x32dc72<_0xe2e2f2[_0xa3ca('0x35')];_0x32dc72+=0x1){_0x4cf547=_0xe2e2f2[_0x32dc72][_0xa3ca('0x70')]?_0x2a9c8a[_0xe2e2f2[_0x32dc72]['MetricId']][_0xa3ca('0x71')]:_0xe2e2f2[_0x32dc72][_0xa3ca('0x72')];_0x4cf547=_0xe2e2f2[_0x32dc72][_0xa3ca('0x73')]?_[_0xa3ca('0x74')](_0x32c1a2[_0xe2e2f2[_0x32dc72][_0xa3ca('0x73')]],'%s',_0x4cf547):_0x4cf547;_0x4cf547=_0xe2e2f2[_0x32dc72][_0xa3ca('0x75')]?_[_0xa3ca('0x74')](_0x6c3421[_0xe2e2f2[_0x32dc72][_0xa3ca('0x75')]],'%s',_0x4cf547):_0x4cf547;if(_0xe2e2f2[_0x32dc72]['groupBy']){_0x5e8784[_0xa3ca('0x64')](_0x4cf547);}_0xe2e2f2[_0x32dc72][_0xa3ca('0x76')]&&_0x5e8784['order'](_0x4cf547,_0xe2e2f2[_0x32dc72][_0xa3ca('0x76')]==='DESC'?![]:!![]);_0x5e8784[_0xa3ca('0x72')](_0x4cf547,_0xe2e2f2[_0x32dc72]['alias']||_0x4cf547);}if(_0x44b1c7['joins']){_0x44b1c7[_0xa3ca('0x77')]=JSON[_0xa3ca('0x78')](_0x44b1c7[_0xa3ca('0x77')]);for(var _0x5b7174=0x0;_0x5b7174<_0x44b1c7[_0xa3ca('0x77')][_0xa3ca('0x35')];_0x5b7174+=0x1){if(_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x2b')]&&_[_0xa3ca('0x79')](_0x47eddc,_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x2b')])&&_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x7a')]&&_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x7b')]&&_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x7c')]){_0x5e8784[_0x44b1c7[_0xa3ca('0x77')][_0x5b7174]['type']](_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x7b')],null,util[_0xa3ca('0x75')](_0xa3ca('0x7d'),_0x44b1c7[_0xa3ca('0x6f')],_0x44b1c7['joins'][_0x5b7174][_0xa3ca('0x7a')],_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x7b')],_0x44b1c7[_0xa3ca('0x77')][_0x5b7174][_0xa3ca('0x7c')]));}}}if(_0x44b1c7[_0xa3ca('0x7e')]){_0x44b1c7['conditions']=JSON[_0xa3ca('0x78')](_0x44b1c7[_0xa3ca('0x7e')]);_0x5e8784[_0xa3ca('0x39')](_0x1b4f33(_0x44b1c7['conditions']['group']));}_0xa69fb3=_0x5e8784[_0xa3ca('0x7f')]();_0x5e8784[_0xa3ca('0x1b')](_0x53e8e5);_0x5e8784[_0xa3ca('0x19')](0x0);logger[_0xa3ca('0x80')](_0xa3ca('0x81'),_0x5e8784[_0xa3ca('0x82')]());return dbH[_0xa3ca('0x83')]['query'](_0x5e8784[_0xa3ca('0x82')](),{'type':dbH[_0xa3ca('0x83')][_0xa3ca('0x84')]['SELECT']});}})[_0xa3ca('0x20')](respondWithResult(_0x5adecd,null))[_0xa3ca('0x41')](handleError(_0x5adecd,null));};function runReport(_0x5f29cc,_0x46b722,_0x2981a8){var _0x1138f3=_0x46b722['name'];var _0xf1e3d2=0xa;var _0x5d2092=[_0xa3ca('0x52'),'left_join',_0xa3ca('0x54'),_0xa3ca('0x55')];var _0x38cab3={'SUM':_0xa3ca('0x85'),'COUNT':_0xa3ca('0x56'),'COUNT DISTINCT':_0xa3ca('0x86'),'MAX':_0xa3ca('0x87'),'MIN':_0xa3ca('0x57'),'AVG':_0xa3ca('0x58'),'GROUP_CONCAT':_0xa3ca('0x88'),'GROUP_CONCAT ASC':_0xa3ca('0x59'),'GROUP_CONCAT DESC':_0xa3ca('0x5a')};var _0x3a42d0={'SEC_TO_TIME':_0xa3ca('0x5b'),'DATE':_0xa3ca('0x89'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa3ca('0x8a')};var _0x17afb1=function(_0x3a7196){return!_[_0xa3ca('0x79')]([_0xa3ca('0x5e'),_0xa3ca('0x5f'),'IS\x20EMPTY',_0xa3ca('0x61')],_0x3a7196);};var _0x4144a5=function(_0x5154af){if(!_0x5154af||!_0x5154af[_0xa3ca('0x62')][_0xa3ca('0x35')]){return'';}for(var _0x337326='(',_0x165656=0x0;_0x165656<_0x5154af[_0xa3ca('0x62')][_0xa3ca('0x35')];_0x165656+=0x1){_0x165656>0x0&&(_0x337326+='\x20'+_0x5154af[_0xa3ca('0x63')]+'\x20');_0x337326+=_0x5154af[_0xa3ca('0x62')][_0x165656][_0xa3ca('0x64')]?_0x4144a5(_0x5154af[_0xa3ca('0x62')][_0x165656][_0xa3ca('0x64')]):_0x5154af['rules'][_0x165656]['field']+'\x20'+_0x5154af[_0xa3ca('0x62')][_0x165656][_0xa3ca('0x65')]+(_0x17afb1(_0x5154af[_0xa3ca('0x62')][_0x165656]['condition'])?'\x20'+_0x5154af[_0xa3ca('0x62')][_0x165656][_0xa3ca('0x66')]:'');}return _0x337326+')';};var _0x56cd71={'where':{'id':_0x5f29cc['id']}},_0x2744ff,_0x17c74a,_0x183b05,_0x518719,_0x452a53;_0x56cd71=_[_0xa3ca('0x3c')]({},_0x56cd71,_0x2981a8);return db['AnalyticCustomReport'][_0xa3ca('0x4f')](_0x56cd71)[_0xa3ca('0x20')](function(_0x1da933){if(_0x1da933){_0x2744ff=_0x1da933;return _0x1da933[_0xa3ca('0x68')]();}return null;})[_0xa3ca('0x20')](function(_0x4c0437){if(_0x4c0437){if(!_0x4c0437[_0xa3ca('0x35')]){throw new db[(_0xa3ca('0x8b'))][(_0xa3ca('0x69'))](_0xa3ca('0x6a'),0x193);}_0x17c74a=_0x4c0437;return db['AnalyticMetric'][_0xa3ca('0x8c')]({'raw':!![]});}return null;})[_0xa3ca('0x20')](function(_0x41a054){if(_0x41a054){_0x183b05=_[_0xa3ca('0x6c')](_0x41a054,'id');var _0x71c9a1;var _0x5d65ac=squel[_0xa3ca('0x6d')]();_0x5d65ac['from'](_0x2744ff[_0xa3ca('0x6f')]);for(var _0x198839=0x0;_0x198839<_0x17c74a[_0xa3ca('0x35')];_0x198839+=0x1){_0x71c9a1=_0x17c74a[_0x198839][_0xa3ca('0x70')]?_0x183b05[_0x17c74a[_0x198839][_0xa3ca('0x70')]][_0xa3ca('0x71')]:_0x17c74a[_0x198839]['field'];_0x71c9a1=_0x17c74a[_0x198839]['function']?_[_0xa3ca('0x74')](_0x38cab3[_0x17c74a[_0x198839][_0xa3ca('0x73')]],'%s',_0x71c9a1):_0x71c9a1;_0x71c9a1=_0x17c74a[_0x198839]['format']?_['replace'](_0x3a42d0[_0x17c74a[_0x198839]['format']],'%s',_0x71c9a1):_0x71c9a1;if(_0x17c74a[_0x198839][_0xa3ca('0x8d')]){_0x5d65ac[_0xa3ca('0x64')](_0x71c9a1);}_0x17c74a[_0x198839][_0xa3ca('0x76')]&&_0x5d65ac[_0xa3ca('0x8e')](_0x71c9a1,_0x17c74a[_0x198839]['orderBy']===_0xa3ca('0x8f')?![]:!![]);_0x5d65ac['field'](_0x71c9a1,_0x17c74a[_0x198839][_0xa3ca('0x90')]||_0x71c9a1);}if(_0x2744ff['joins']){_0x2744ff[_0xa3ca('0x77')]=JSON[_0xa3ca('0x78')](_0x2744ff[_0xa3ca('0x77')]);for(var _0x4f0c4b=0x0;_0x4f0c4b<_0x2744ff[_0xa3ca('0x77')][_0xa3ca('0x35')];_0x4f0c4b+=0x1){if(_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b]['type']&&_['includes'](_0x5d2092,_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b][_0xa3ca('0x2b')])&&_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b]['parentKey']&&_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b]['foreignTable']&&_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b]['foreignKey']){_0x5d65ac[_0x2744ff['joins'][_0x4f0c4b][_0xa3ca('0x2b')]](_0x2744ff['joins'][_0x4f0c4b]['foreignTable'],null,util[_0xa3ca('0x75')](_0xa3ca('0x7d'),_0x2744ff[_0xa3ca('0x6f')],_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b][_0xa3ca('0x7a')],_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b][_0xa3ca('0x7b')],_0x2744ff[_0xa3ca('0x77')][_0x4f0c4b][_0xa3ca('0x7c')]));}}}if(_0x2744ff[_0xa3ca('0x7e')]){_0x2744ff[_0xa3ca('0x7e')]=JSON['parse'](_0x2744ff[_0xa3ca('0x7e')]);_0x5d65ac[_0xa3ca('0x39')](_0x4144a5(_0x2744ff['conditions'][_0xa3ca('0x64')]));}_0x452a53=_0x5d65ac[_0xa3ca('0x7f')]();_0x5d65ac['limit'](_0xf1e3d2);_0x5d65ac[_0xa3ca('0x19')](0x0);return;}})[_0xa3ca('0x20')](function(){if(_0x46b722[_0xa3ca('0x91')]==='web'){return null;}var _0x35b175=_[_0xa3ca('0x3c')](_0x46b722,{'name':_0x46b722[_0xa3ca('0x92')]||_0x46b722['name']||_0x2744ff[_0xa3ca('0x26')],'basename':_0x1138f3,'savename':util['format'](_0xa3ca('0x93'),_0x46b722[_0xa3ca('0x26')]||_0x2744ff['name'],require(_0xa3ca('0x94'))[_0xa3ca('0x95')](0x4),_0x46b722[_0xa3ca('0x91')]||_0xa3ca('0x96')),'reportId':_0x2744ff['id'],'reportType':_0xa3ca('0x97')});return db[_0xa3ca('0x98')][_0xa3ca('0x44')](_0x35b175,{'raw':!![]});})['then'](function(_0x11861){if(_0x2744ff[_0xa3ca('0x6f')]===_0xa3ca('0x99')){_0x452a53[_0xa3ca('0x39')](_0x2744ff[_0xa3ca('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x46b722[_0xa3ca('0x9a')],_0x46b722[_0xa3ca('0x9b')]);}else{_0x452a53[_0xa3ca('0x39')](_0x2744ff[_0xa3ca('0x6f')]+_0xa3ca('0x9c'),_0x46b722[_0xa3ca('0x9a')],_0x46b722['endDate']);}if(_0x11861){logger[_0xa3ca('0x9d')]('Run\x20Query:',_0x452a53['toString']());require(_0xa3ca('0x9e'))[_0xa3ca('0x9f')](path['join'](__dirname,_0xa3ca('0xa0'),_0x11861[_0xa3ca('0x91')]),[_0x11861['id'],_0x452a53[_0xa3ca('0x82')](),path['join'](__dirname,_0xa3ca('0xa1'),_0x11861['savename']),_0x1138f3]);return _0x11861;}else{var _0x5cf81b=squel[_0xa3ca('0x6d')]();_0x5cf81b[_0xa3ca('0x6e')]('('+_0x452a53['toString']()+')',_0xa3ca('0xa2'));_0x5cf81b[_0xa3ca('0x72')](_0xa3ca('0xa3'),_0xa3ca('0x1c'));_0x452a53[_0xa3ca('0x1b')](_0x46b722[_0xa3ca('0x1b')]||_0xf1e3d2);_0x452a53[_0xa3ca('0x19')](_0x46b722['offset']||0x0);return dbH[_0xa3ca('0x83')][_0xa3ca('0x2f')](_0x5cf81b['toString'](),{'type':dbH[_0xa3ca('0x83')][_0xa3ca('0x84')][_0xa3ca('0xa4')]})[_0xa3ca('0x20')](function(_0x5a91cc){if(!_0x5a91cc['length']){_0x518719=0x0;}else{_0x518719=_0x5a91cc[0x0]['count']||0x0;}return dbH[_0xa3ca('0x83')][_0xa3ca('0x2f')](_0x452a53[_0xa3ca('0x82')](),{'type':dbH[_0xa3ca('0x83')][_0xa3ca('0x84')][_0xa3ca('0xa4')]});})['then'](function(_0x204434){return{'rows':_0x204434||[],'count':_0x518719};});}});}exports[_0xa3ca('0xa5')]=function(_0x3b7707,_0x2cb58d){return runReport(_0x3b7707[_0xa3ca('0x50')],_0x3b7707[_0xa3ca('0x2f')],_0x3b7707['options'])[_0xa3ca('0x20')](respondWithResult(_0x2cb58d,null))[_0xa3ca('0x41')](handleError(_0x2cb58d,null));};exports[_0xa3ca('0xa6')]=runReport;exports[_0xa3ca('0x2f')]=function(_0x391992,_0x3d5775){var _0x135ce1=0xa;var _0x1e5564=[_0xa3ca('0x52'),_0xa3ca('0x53'),_0xa3ca('0x54'),_0xa3ca('0x55')];var _0x461241={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3ca('0x86'),'MAX':_0xa3ca('0x87'),'MIN':_0xa3ca('0x57'),'AVG':_0xa3ca('0x58'),'GROUP_CONCAT':_0xa3ca('0x88'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa3ca('0x5a')};var _0x1a28ac={'SEC_TO_TIME':_0xa3ca('0x5b'),'DATE':'DATE(%s)','HOUR':_0xa3ca('0x5c'),'ROUND':_0xa3ca('0x5d'),'UNIX_TIMESTAMP':_0xa3ca('0x8a')};var _0x583acd=function(_0x312aac){return!_[_0xa3ca('0x79')](['IS\x20NULL',_0xa3ca('0x5f'),_0xa3ca('0x60'),'IS\x20NOT\x20EMPTY'],_0x312aac);};var _0x2d0103=function(_0x29eced){if(!_0x29eced||!_0x29eced[_0xa3ca('0x62')]['length']){return'';}for(var _0x44ad14='(',_0x61a417=0x0;_0x61a417<_0x29eced[_0xa3ca('0x62')]['length'];_0x61a417+=0x1){_0x61a417>0x0&&(_0x44ad14+='\x20'+_0x29eced['operator']+'\x20');_0x44ad14+=_0x29eced['rules'][_0x61a417][_0xa3ca('0x64')]?_0x2d0103(_0x29eced[_0xa3ca('0x62')][_0x61a417][_0xa3ca('0x64')]):_0x29eced['rules'][_0x61a417]['field']+'\x20'+_0x29eced[_0xa3ca('0x62')][_0x61a417][_0xa3ca('0x65')]+(_0x583acd(_0x29eced[_0xa3ca('0x62')][_0x61a417][_0xa3ca('0x65')])?'\x20'+_0x29eced[_0xa3ca('0x62')][_0x61a417][_0xa3ca('0x66')]:'');}return _0x44ad14+')';};var _0x43cb57={'where':{'id':_0x391992[_0xa3ca('0x50')]['id']}},_0x36156f,_0x152898,_0x4d27cc,_0x1c38e2,_0x4c6ebd;_0x43cb57=_[_0xa3ca('0x3c')]({},_0x43cb57,_0x391992['options']);return db[_0xa3ca('0x43')]['find'](_0x43cb57)['then'](function(_0x2fb5bb){if(_0x2fb5bb){_0x36156f=_0x2fb5bb;return _0x2fb5bb['getFields']();}return null;})[_0xa3ca('0x20')](function(_0x5198da){if(_0x5198da){if(!_0x5198da['length']){throw new db[(_0xa3ca('0x8b'))][(_0xa3ca('0x69'))](_0xa3ca('0x6a'),0x193);}_0x152898=_0x5198da;return db[_0xa3ca('0x6b')][_0xa3ca('0x8c')]({'raw':!![]});}return null;})[_0xa3ca('0x20')](function(_0x556534){if(_0x556534){_0x4d27cc=_[_0xa3ca('0x6c')](_0x556534,'id');var _0x202980;var _0xe58405=squel[_0xa3ca('0x6d')]();_0xe58405[_0xa3ca('0x6e')](_0x36156f[_0xa3ca('0x6f')]);for(var _0x203249=0x0;_0x203249<_0x152898[_0xa3ca('0x35')];_0x203249+=0x1){_0x202980=_0x152898[_0x203249]['MetricId']?_0x4d27cc[_0x152898[_0x203249][_0xa3ca('0x70')]][_0xa3ca('0x71')]:_0x152898[_0x203249][_0xa3ca('0x72')];_0x202980=_0x152898[_0x203249]['function']?_[_0xa3ca('0x74')](_0x461241[_0x152898[_0x203249][_0xa3ca('0x73')]],'%s',_0x202980):_0x202980;_0x202980=_0x152898[_0x203249][_0xa3ca('0x75')]?_[_0xa3ca('0x74')](_0x1a28ac[_0x152898[_0x203249]['format']],'%s',_0x202980):_0x202980;if(_0x152898[_0x203249]['groupBy']){_0xe58405[_0xa3ca('0x64')](_0x202980);}_0x152898[_0x203249][_0xa3ca('0x76')]&&_0xe58405[_0xa3ca('0x8e')](_0x202980,_0x152898[_0x203249]['orderBy']==='DESC'?![]:!![]);_0xe58405['field'](_0x202980,_0x152898[_0x203249][_0xa3ca('0x90')]||_0x202980);}if(_0x36156f['joins']){_0x36156f['joins']=JSON['parse'](_0x36156f[_0xa3ca('0x77')]);for(var _0x57ecc5=0x0;_0x57ecc5<_0x36156f[_0xa3ca('0x77')][_0xa3ca('0x35')];_0x57ecc5+=0x1){if(_0x36156f[_0xa3ca('0x77')][_0x57ecc5][_0xa3ca('0x2b')]&&_[_0xa3ca('0x79')](_0x1e5564,_0x36156f[_0xa3ca('0x77')][_0x57ecc5][_0xa3ca('0x2b')])&&_0x36156f[_0xa3ca('0x77')][_0x57ecc5][_0xa3ca('0x7a')]&&_0x36156f[_0xa3ca('0x77')][_0x57ecc5][_0xa3ca('0x7b')]&&_0x36156f[_0xa3ca('0x77')][_0x57ecc5][_0xa3ca('0x7c')]){_0xe58405[_0x36156f[_0xa3ca('0x77')][_0x57ecc5][_0xa3ca('0x2b')]](_0x36156f[_0xa3ca('0x77')][_0x57ecc5]['foreignTable'],null,util[_0xa3ca('0x75')]('%s.%s\x20=\x20%s.%s',_0x36156f[_0xa3ca('0x6f')],_0x36156f[_0xa3ca('0x77')][_0x57ecc5][_0xa3ca('0x7a')],_0x36156f[_0xa3ca('0x77')][_0x57ecc5]['foreignTable'],_0x36156f[_0xa3ca('0x77')][_0x57ecc5]['foreignKey']));}}}if(_0x36156f['conditions']){_0x36156f[_0xa3ca('0x7e')]=JSON['parse'](_0x36156f['conditions']);_0xe58405[_0xa3ca('0x39')](_0x2d0103(_0x36156f['conditions'][_0xa3ca('0x64')]));}_0x4c6ebd=_0xe58405[_0xa3ca('0x7f')]();_0xe58405[_0xa3ca('0x1b')](_0x135ce1);_0xe58405['offset'](0x0);logger[_0xa3ca('0x80')](_0xa3ca('0x81'),_0xe58405[_0xa3ca('0x82')]());return dbH['sequelize'][_0xa3ca('0x2f')](_0xe58405[_0xa3ca('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0xa3ca('0xa4')]});}})[_0xa3ca('0x20')](function(){return{'sql':_0x4c6ebd[_0xa3ca('0x82')]()};})[_0xa3ca('0x20')](respondWithResult(_0x3d5775,null))[_0xa3ca('0x41')](handleError(_0x3d5775,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f0c8bb6..fbd871d 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 _0x28a9=['define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x28a9,0x18f));var _0x928a=function(_0x401274,_0x3490f2){_0x401274=_0x401274-0x0;var _0x195f0b=_0x28a9[_0x401274];return _0x195f0b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x928a('0x0'))(_0x928a('0x1'));var moment=require('moment');var BPromise=require(_0x928a('0x2'));var rp=require(_0x928a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x928a('0x4'));var config=require(_0x928a('0x5'));var attributes=require(_0x928a('0x6'));module[_0x928a('0x7')]=function(_0x2ce098,_0x2d81e0){return _0x2ce098[_0x928a('0x8')](_0x928a('0x9'),attributes,{'tableName':_0x928a('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd20=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','analytics_custom_reports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xcd20,0x108));var _0x0cd2=function(_0x5ecaab,_0x2f3053){_0x5ecaab=_0x5ecaab-0x0;var _0x3db1a8=_0xcd20[_0x5ecaab];return _0x3db1a8;};'use strict';var _=require(_0x0cd2('0x0'));var util=require('util');var logger=require(_0x0cd2('0x1'))(_0x0cd2('0x2'));var moment=require(_0x0cd2('0x3'));var BPromise=require(_0x0cd2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cd2('0x5'));var rimraf=require(_0x0cd2('0x6'));var config=require(_0x0cd2('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x0cd2('0x8')]=function(_0x413745,_0x11fbbd){return _0x413745[_0x0cd2('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x0cd2('0xa'),'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 defd7e8..759561b 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 _0x609b=['request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http'];(function(_0xbf1875,_0x34b144){var _0x2e598b=function(_0xd104ec){while(--_0xd104ec){_0xbf1875['push'](_0xbf1875['shift']());}};_0x2e598b(++_0x34b144);}(_0x609b,0xf4));var _0xb609=function(_0x3df17b,_0x471504){_0x3df17b=_0x3df17b-0x0;var _0x2a66cd=_0x609b[_0x3df17b];return _0x2a66cd;};'use strict';var _=require('lodash');var util=require(_0xb609('0x0'));var moment=require(_0xb609('0x1'));var BPromise=require('bluebird');var rs=require(_0xb609('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb609('0x3'));var logger=require('../../config/logger')(_0xb609('0x4'));var config=require(_0xb609('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb609('0x6')][_0xb609('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1546ad,_0x12a9af,_0x49719a){return new BPromise(function(_0x3f0565,_0x343606){return client[_0xb609('0x8')](_0x1546ad,_0x49719a)[_0xb609('0x9')](function(_0x45f342){logger['info'](_0xb609('0xa'),_0x12a9af,_0xb609('0xb'));logger[_0xb609('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x12a9af,_0xb609('0xb'),JSON['stringify'](_0x45f342));if(_0x45f342[_0xb609('0xd')]){if(_0x45f342['error']['code']===0x1f4){logger[_0xb609('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x12a9af,_0x45f342[_0xb609('0xd')][_0xb609('0xe')]);return _0x343606(_0x45f342[_0xb609('0xd')]['message']);}logger['error'](_0xb609('0xa'),_0x12a9af,_0x45f342[_0xb609('0xd')][_0xb609('0xe')]);return _0x3f0565(_0x45f342[_0xb609('0xd')][_0xb609('0xe')]);}else{logger[_0xb609('0xf')](_0xb609('0xa'),_0x12a9af,_0xb609('0xb'));_0x3f0565(_0x45f342[_0xb609('0x10')][_0xb609('0xe')]);}})[_0xb609('0x11')](function(_0x25e834){logger['error'](_0xb609('0xa'),_0x12a9af,_0x25e834);_0x343606(_0x25e834);});});} \ No newline at end of file +var _0x6105=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1f475f,_0x422721){var _0x1b4b06=function(_0x3eb696){while(--_0x3eb696){_0x1f475f['push'](_0x1f475f['shift']());}};_0x1b4b06(++_0x422721);}(_0x6105,0x161));var _0x5610=function(_0x125f1e,_0x29fe2e){_0x125f1e=_0x125f1e-0x0;var _0x193656=_0x6105[_0x125f1e];return _0x193656;};'use strict';var _=require(_0x5610('0x0'));var util=require('util');var moment=require(_0x5610('0x1'));var BPromise=require(_0x5610('0x2'));var rs=require(_0x5610('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5610('0x4'))['db'];var utils=require(_0x5610('0x5'));var logger=require(_0x5610('0x6'))(_0x5610('0x7'));var config=require('../../config/environment');var jayson=require(_0x5610('0x8'));var client=jayson[_0x5610('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34220d,_0x52ad9d,_0xeb6c9b){return new BPromise(function(_0x9aad06,_0x3a3de3){return client[_0x5610('0xa')](_0x34220d,_0xeb6c9b)['then'](function(_0x35165d){logger[_0x5610('0xb')](_0x5610('0xc'),_0x52ad9d,_0x5610('0xd'));logger[_0x5610('0xe')](_0x5610('0xf'),_0x52ad9d,'request\x20sent',JSON[_0x5610('0x10')](_0x35165d));if(_0x35165d[_0x5610('0x11')]){if(_0x35165d['error'][_0x5610('0x12')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x52ad9d,_0x35165d[_0x5610('0x11')][_0x5610('0x13')]);return _0x3a3de3(_0x35165d[_0x5610('0x11')]['message']);}logger[_0x5610('0x11')](_0x5610('0xc'),_0x52ad9d,_0x35165d[_0x5610('0x11')]['message']);return _0x9aad06(_0x35165d['error'][_0x5610('0x13')]);}else{logger['info'](_0x5610('0xc'),_0x52ad9d,_0x5610('0xd'));_0x9aad06(_0x35165d[_0x5610('0x14')][_0x5610('0x13')]);}})[_0x5610('0x15')](function(_0x3410db){logger['error'](_0x5610('0xc'),_0x52ad9d,_0x3410db);_0x3a3de3(_0x3410db);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2eef22b..aa761f0 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 _0x3690=['multer','util','path','express','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','/:id','show','get','/:id/preview','/:id/run','/:id/query','query','post','put','update','delete','destroy','exports'];(function(_0xebb86a,_0x5c67db){var _0x2bf8ca=function(_0x29b2b2){while(--_0x29b2b2){_0xebb86a['push'](_0xebb86a['shift']());}};_0x2bf8ca(++_0x5c67db);}(_0x3690,0xbd));var _0x0369=function(_0x1cddc5,_0x1e81da){_0x1cddc5=_0x1cddc5-0x0;var _0x398df2=_0x3690[_0x1cddc5];return _0x398df2;};'use strict';var multer=require(_0x0369('0x0'));var util=require(_0x0369('0x1'));var path=require(_0x0369('0x2'));var timeout=require('connect-timeout');var express=require(_0x0369('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0369('0x4'));var config=require(_0x0369('0x5'));var controller=require(_0x0369('0x6'));router['get']('/',auth[_0x0369('0x7')](),controller['index']);router['get'](_0x0369('0x8'),auth[_0x0369('0x7')](),controller[_0x0369('0x9')]);router[_0x0369('0xa')](_0x0369('0xb'),auth[_0x0369('0x7')](),controller['preview']);router[_0x0369('0xa')](_0x0369('0xc'),auth[_0x0369('0x7')](),controller['run']);router[_0x0369('0xa')](_0x0369('0xd'),auth[_0x0369('0x7')](),controller[_0x0369('0xe')]);router[_0x0369('0xf')]('/',auth[_0x0369('0x7')](),controller['create']);router[_0x0369('0x10')](_0x0369('0x8'),auth[_0x0369('0x7')](),controller[_0x0369('0x11')]);router[_0x0369('0x12')](_0x0369('0x8'),auth['isAuthenticated'](),controller[_0x0369('0x13')]);module[_0x0369('0x14')]=router; \ No newline at end of file +var _0x9893=['isAuthenticated','index','/:id','show','preview','/:id/run','run','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x4a0625,_0x161560){var _0x36c056=function(_0x28030a){while(--_0x28030a){_0x4a0625['push'](_0x4a0625['shift']());}};_0x36c056(++_0x161560);}(_0x9893,0xfc));var _0x3989=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9893[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3989('0x0'));var util=require(_0x3989('0x1'));var path=require(_0x3989('0x2'));var timeout=require(_0x3989('0x3'));var express=require(_0x3989('0x4'));var router=express[_0x3989('0x5')]();var fs_extra=require(_0x3989('0x6'));var auth=require(_0x3989('0x7'));var interaction=require(_0x3989('0x8'));var config=require(_0x3989('0x9'));var controller=require(_0x3989('0xa'));router[_0x3989('0xb')]('/',auth[_0x3989('0xc')](),controller[_0x3989('0xd')]);router['get'](_0x3989('0xe'),auth[_0x3989('0xc')](),controller[_0x3989('0xf')]);router[_0x3989('0xb')]('/:id/preview',auth[_0x3989('0xc')](),controller[_0x3989('0x10')]);router[_0x3989('0xb')](_0x3989('0x11'),auth['isAuthenticated'](),controller[_0x3989('0x12')]);router[_0x3989('0xb')]('/:id/query',auth[_0x3989('0xc')](),controller['query']);router[_0x3989('0x13')]('/',auth[_0x3989('0xc')](),controller[_0x3989('0x14')]);router[_0x3989('0x15')](_0x3989('0xe'),auth[_0x3989('0xc')](),controller[_0x3989('0x16')]);router['delete'](_0x3989('0xe'),auth[_0x3989('0xc')](),controller[_0x3989('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c9da996..f0e2995 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['STRING','TEXT'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0x7fbe[_0x221a6f];return _0x3db53d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0x5d58=['TEXT','STRING'];(function(_0x353a41,_0x1a9561){var _0x3807a5=function(_0x1838c4){while(--_0x1838c4){_0x353a41['push'](_0x353a41['shift']());}};_0x3807a5(++_0x1a9561);}(_0x5d58,0x187));var _0x85d5=function(_0x576dcd,_0xc62d81){_0x576dcd=_0x576dcd-0x0;var _0x3f53f6=_0x5d58[_0x576dcd];return _0x3f53f6;};'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/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index fa9a800..af9b968 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x1361be,_0xd9f68c){var _0x1243a8=function(_0x4a3c1a){while(--_0x4a3c1a){_0x1361be['push'](_0x1361be['shift']());}};_0x1243a8(++_0xd9f68c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3bbd4e,_0x502b91){_0x3bbd4e=_0x3bbd4e-0x0;var _0x4dfeb8=_0x3f8a[_0x3bbd4e];return _0x4dfeb8;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0xa42a47,_0x2fd355){var _0x5c92bc=function(_0x1013f6){while(--_0x1013f6){_0xa42a47['push'](_0xa42a47['shift']());}};_0x5c92bc(++_0x2fd355);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2c3714,_0x20929e){_0x2c3714=_0x2c3714-0x0;var _0x360e7c=_0x1cb9[_0x2c3714];return _0x360e7c;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 77f7e62..a3272db 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 _0xd5db=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util'];(function(_0x3578a4,_0x5c15c6){var _0x2432cf=function(_0x235840){while(--_0x235840){_0x3578a4['push'](_0x3578a4['shift']());}};_0x2432cf(++_0x5c15c6);}(_0xd5db,0xe2));var _0xbd5d=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xd5db[_0xa8883];return _0x479426;};'use strict';var _=require(_0xbd5d('0x0'));var util=require(_0xbd5d('0x1'));var logger=require(_0xbd5d('0x2'))(_0xbd5d('0x3'));var moment=require('moment');var BPromise=require(_0xbd5d('0x4'));var rp=require(_0xbd5d('0x5'));var fs=require('fs');var path=require(_0xbd5d('0x6'));var rimraf=require(_0xbd5d('0x7'));var config=require(_0xbd5d('0x8'));var attributes=require(_0xbd5d('0x9'));module['exports']=function(_0x2104d5,_0x3b62ba){return _0x2104d5[_0xbd5d('0xa')](_0xbd5d('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb916=['moment','bluebird','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x3b04fd,_0x37beb0){var _0x378573=function(_0x17ce5b){while(--_0x17ce5b){_0x3b04fd['push'](_0x3b04fd['shift']());}};_0x378573(++_0x37beb0);}(_0xb916,0x1e0));var _0x6b91=function(_0xc8023,_0xd1912){_0xc8023=_0xc8023-0x0;var _0x448b50=_0xb916[_0xc8023];return _0x448b50;};'use strict';var _=require(_0x6b91('0x0'));var util=require(_0x6b91('0x1'));var logger=require(_0x6b91('0x2'))(_0x6b91('0x3'));var moment=require(_0x6b91('0x4'));var BPromise=require(_0x6b91('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b91('0x6'));var attributes=require(_0x6b91('0x7'));module[_0x6b91('0x8')]=function(_0x129564,_0x1084d3){return _0x129564[_0x6b91('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x6b91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 234ba33..bd2473c 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 _0x68ad=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3148b3,_0x422bfc){var _0x1ecee2=function(_0x5e3443){while(--_0x5e3443){_0x3148b3['push'](_0x3148b3['shift']());}};_0x1ecee2(++_0x422bfc);}(_0x68ad,0xb2));var _0xd68a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd68a('0x0'));var util=require(_0xd68a('0x1'));var moment=require(_0xd68a('0x2'));var BPromise=require(_0xd68a('0x3'));var rs=require(_0xd68a('0x4'));var fs=require('fs');var Redis=require(_0xd68a('0x5'));var db=require(_0xd68a('0x6'))['db'];var utils=require(_0xd68a('0x7'));var logger=require('../../config/logger')(_0xd68a('0x8'));var config=require(_0xd68a('0x9'));var jayson=require(_0xd68a('0xa'));var client=jayson[_0xd68a('0xb')][_0xd68a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302cc9,_0x321748,_0x29c4fd){return new BPromise(function(_0x95fae8,_0x19a49){return client[_0xd68a('0xd')](_0x302cc9,_0x29c4fd)[_0xd68a('0xe')](function(_0x44af83){logger[_0xd68a('0xf')](_0xd68a('0x10'),_0x321748,'request\x20sent');logger[_0xd68a('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x321748,_0xd68a('0x12'),JSON[_0xd68a('0x13')](_0x44af83));if(_0x44af83['error']){if(_0x44af83[_0xd68a('0x14')][_0xd68a('0x15')]===0x1f4){logger[_0xd68a('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x321748,_0x44af83[_0xd68a('0x14')]['message']);return _0x19a49(_0x44af83[_0xd68a('0x14')][_0xd68a('0x16')]);}logger[_0xd68a('0x14')](_0xd68a('0x10'),_0x321748,_0x44af83['error'][_0xd68a('0x16')]);return _0x95fae8(_0x44af83[_0xd68a('0x14')][_0xd68a('0x16')]);}else{logger['info'](_0xd68a('0x10'),_0x321748,_0xd68a('0x12'));_0x95fae8(_0x44af83['result']['message']);}})[_0xd68a('0x17')](function(_0x5ada77){logger[_0xd68a('0x14')](_0xd68a('0x10'),_0x321748,_0x5ada77);_0x19a49(_0x5ada77);});});} \ No newline at end of file +var _0x0d23=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c7fb0,_0x56a361){var _0x51d0f3=function(_0x499e5a){while(--_0x499e5a){_0x1c7fb0['push'](_0x1c7fb0['shift']());}};_0x51d0f3(++_0x56a361);}(_0x0d23,0x1e2));var _0x30d2=function(_0xc477b7,_0x2b8074){_0xc477b7=_0xc477b7-0x0;var _0x4ee9b0=_0x0d23[_0xc477b7];return _0x4ee9b0;};'use strict';var _=require(_0x30d2('0x0'));var util=require(_0x30d2('0x1'));var moment=require(_0x30d2('0x2'));var BPromise=require(_0x30d2('0x3'));var rs=require(_0x30d2('0x4'));var fs=require('fs');var Redis=require(_0x30d2('0x5'));var db=require(_0x30d2('0x6'))['db'];var utils=require(_0x30d2('0x7'));var logger=require(_0x30d2('0x8'))(_0x30d2('0x9'));var config=require(_0x30d2('0xa'));var jayson=require(_0x30d2('0xb'));var client=jayson[_0x30d2('0xc')][_0x30d2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x72031f,_0x400c7c,_0x2f24a3){return new BPromise(function(_0x234507,_0x2ab8d9){return client[_0x30d2('0xe')](_0x72031f,_0x2f24a3)[_0x30d2('0xf')](function(_0x1f4568){logger[_0x30d2('0x10')](_0x30d2('0x11'),_0x400c7c,'request\x20sent');logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x400c7c,'request\x20sent',JSON[_0x30d2('0x12')](_0x1f4568));if(_0x1f4568[_0x30d2('0x13')]){if(_0x1f4568['error'][_0x30d2('0x14')]===0x1f4){logger[_0x30d2('0x13')](_0x30d2('0x11'),_0x400c7c,_0x1f4568[_0x30d2('0x13')][_0x30d2('0x15')]);return _0x2ab8d9(_0x1f4568['error']['message']);}logger['error'](_0x30d2('0x11'),_0x400c7c,_0x1f4568['error'][_0x30d2('0x15')]);return _0x234507(_0x1f4568[_0x30d2('0x13')][_0x30d2('0x15')]);}else{logger[_0x30d2('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x400c7c,_0x30d2('0x16'));_0x234507(_0x1f4568['result'][_0x30d2('0x15')]);}})[_0x30d2('0x17')](function(_0x505be3){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x400c7c,_0x505be3);_0x2ab8d9(_0x505be3);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 38ecfe4..a37246c 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 _0xa9ee=['/:id/preview','preview','run','/:id/query','query','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show'];(function(_0x4c352c,_0x3f604a){var _0x2e97db=function(_0x5cab75){while(--_0x5cab75){_0x4c352c['push'](_0x4c352c['shift']());}};_0x2e97db(++_0x3f604a);}(_0xa9ee,0x1a3));var _0xea9e=function(_0x1ec656,_0x21f375){_0x1ec656=_0x1ec656-0x0;var _0x484618=_0xa9ee[_0x1ec656];return _0x484618;};'use strict';var multer=require(_0xea9e('0x0'));var util=require(_0xea9e('0x1'));var path=require(_0xea9e('0x2'));var timeout=require(_0xea9e('0x3'));var express=require(_0xea9e('0x4'));var router=express[_0xea9e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xea9e('0x6'));var interaction=require(_0xea9e('0x7'));var config=require(_0xea9e('0x8'));var controller=require(_0xea9e('0x9'));router[_0xea9e('0xa')]('/',auth[_0xea9e('0xb')](),controller['index']);router[_0xea9e('0xa')]('/:id',auth[_0xea9e('0xb')](),controller[_0xea9e('0xc')]);router[_0xea9e('0xa')](_0xea9e('0xd'),auth['isAuthenticated'](),controller[_0xea9e('0xe')]);router[_0xea9e('0xa')]('/:id/run',auth[_0xea9e('0xb')](),controller[_0xea9e('0xf')]);router[_0xea9e('0xa')](_0xea9e('0x10'),auth[_0xea9e('0xb')](),controller[_0xea9e('0x11')]);router[_0xea9e('0x12')]('/',auth[_0xea9e('0xb')](),controller[_0xea9e('0x13')]);router[_0xea9e('0x14')](_0xea9e('0x15'),auth[_0xea9e('0xb')](),controller[_0xea9e('0x16')]);router['delete'](_0xea9e('0x15'),auth[_0xea9e('0xb')](),controller[_0xea9e('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd809=['index','get','/:id','show','/:id/preview','isAuthenticated','preview','/:id/run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x12ab82,_0x159df4){var _0x281e79=function(_0x1242e8){while(--_0x1242e8){_0x12ab82['push'](_0x12ab82['shift']());}};_0x281e79(++_0x159df4);}(_0xd809,0x1ca));var _0x9d80=function(_0x4c3c26,_0x4ee54c){_0x4c3c26=_0x4c3c26-0x0;var _0x255d21=_0xd809[_0x4c3c26];return _0x255d21;};'use strict';var multer=require(_0x9d80('0x0'));var util=require(_0x9d80('0x1'));var path=require(_0x9d80('0x2'));var timeout=require(_0x9d80('0x3'));var express=require(_0x9d80('0x4'));var router=express[_0x9d80('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9d80('0x6'));var interaction=require(_0x9d80('0x7'));var config=require(_0x9d80('0x8'));var controller=require(_0x9d80('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d80('0xa')]);router[_0x9d80('0xb')](_0x9d80('0xc'),auth['isAuthenticated'](),controller[_0x9d80('0xd')]);router[_0x9d80('0xb')](_0x9d80('0xe'),auth[_0x9d80('0xf')](),controller[_0x9d80('0x10')]);router[_0x9d80('0xb')](_0x9d80('0x11'),auth[_0x9d80('0xf')](),controller['run']);router[_0x9d80('0xb')](_0x9d80('0x12'),auth[_0x9d80('0xf')](),controller[_0x9d80('0x13')]);router['post']('/',auth[_0x9d80('0xf')](),controller[_0x9d80('0x14')]);router[_0x9d80('0x15')](_0x9d80('0xc'),auth[_0x9d80('0xf')](),controller[_0x9d80('0x16')]);router[_0x9d80('0x17')](_0x9d80('0xc'),auth[_0x9d80('0xf')](),controller[_0x9d80('0x18')]);module[_0x9d80('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index b657046..630079b 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 _0xcd03=['csv','pdf','xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x1d05a3,_0x125a86){var _0x48d934=function(_0x44f447){while(--_0x44f447){_0x1d05a3['push'](_0x1d05a3['shift']());}};_0x48d934(++_0x125a86);}(_0xcd03,0xaf));var _0x3cd0=function(_0x3af733,_0x5a735f){_0x3af733=_0x3af733-0x0;var _0x34481d=_0xcd03[_0x3af733];return _0x34481d;};'use strict';var Sequelize=require(_0x3cd0('0x0'));var moment=require(_0x3cd0('0x1'));module[_0x3cd0('0x2')]={'name':{'type':Sequelize[_0x3cd0('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x3cd0('0x4')](_0x3cd0('0x5'),_0x3cd0('0x6'),_0x3cd0('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3cd0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3cd0('0x8')]},'endDate':{'type':Sequelize[_0x3cd0('0x8')]},'status':{'type':Sequelize[_0x3cd0('0x3')],'defaultValue':_0x3cd0('0x9')},'type':{'type':Sequelize[_0x3cd0('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x3cd0('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x3cd0('0xb')]},'reportType':{'type':Sequelize[_0x3cd0('0x3')]}}; \ No newline at end of file +var _0x770d=['ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','STRING'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x770d,0x81));var _0xd770=function(_0x50e670,_0x491d5e){_0x50e670=_0x50e670-0x0;var _0x310633=_0x770d[_0x50e670];return _0x310633;};'use strict';var Sequelize=require(_0xd770('0x0'));var moment=require(_0xd770('0x1'));module['exports']={'name':{'type':Sequelize[_0xd770('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd770('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd770('0x3')](_0xd770('0x4'),_0xd770('0x5'),_0xd770('0x6')),'allowNull':![],'defaultValue':_0xd770('0x4')},'savename':{'type':Sequelize[_0xd770('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xd770('0x7')]},'status':{'type':Sequelize[_0xd770('0x2')],'defaultValue':_0xd770('0x8')},'type':{'type':Sequelize['ENUM'](_0xd770('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xd770('0xa')](0xb)[_0xd770('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 60780e9..37e515e 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 _0x1370=['basename','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ExtractedReports','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','existsSync','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s'];(function(_0x1367db,_0x18b809){var _0x380e1d=function(_0x256e8c){while(--_0x256e8c){_0x1367db['push'](_0x1367db['shift']());}};_0x380e1d(++_0x18b809);}(_0x1370,0x1dc));var _0x0137=function(_0x1a2d1c,_0x4a1873){_0x1a2d1c=_0x1a2d1c-0x0;var _0x56eb67=_0x1370[_0x1a2d1c];return _0x56eb67;};'use strict';var emlformat=require(_0x0137('0x0'));var rimraf=require(_0x0137('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0137('0x2'));var rp=require('request-promise');var moment=require(_0x0137('0x3'));var BPromise=require(_0x0137('0x4'));var Mustache=require(_0x0137('0x5'));var util=require('util');var path=require(_0x0137('0x6'));var sox=require(_0x0137('0x7'));var csv=require(_0x0137('0x8'));var ejs=require(_0x0137('0x9'));var fs=require('fs');var fs_extra=require(_0x0137('0xa'));var _=require(_0x0137('0xb'));var squel=require(_0x0137('0xc'));var crypto=require(_0x0137('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0137('0xe'));var toCsv=require(_0x0137('0x8'));var querystring=require('querystring');var Papa=require(_0x0137('0xf'));var Redis=require(_0x0137('0x10'));var authService=require(_0x0137('0x11'));var qs=require(_0x0137('0x12'));var as=require(_0x0137('0x13'));var hardwareService=require(_0x0137('0x14'));var logger=require(_0x0137('0x15'))(_0x0137('0x16'));var utils=require(_0x0137('0x17'));var config=require(_0x0137('0x18'));var licenseUtil=require(_0x0137('0x19'));var db=require(_0x0137('0x1a'))['db'];function respondWithStatusCode(_0x1b7635,_0x3771ba){_0x3771ba=_0x3771ba||0xcc;return function(_0x137b3d){if(_0x137b3d){return _0x1b7635[_0x0137('0x1b')](_0x3771ba);}return _0x1b7635['status'](_0x3771ba)[_0x0137('0x1c')]();};}function respondWithResult(_0x68ae70,_0x2a3264){_0x2a3264=_0x2a3264||0xc8;return function(_0x1b3d76){if(_0x1b3d76){return _0x68ae70[_0x0137('0x1d')](_0x2a3264)[_0x0137('0x1e')](_0x1b3d76);}};}function respondWithFilteredResult(_0x3f9ebb,_0x519538){return function(_0x57e51d){if(_0x57e51d){var _0x1ee3d7=typeof _0x519538['offset']==='undefined'&&typeof _0x519538[_0x0137('0x1f')]===_0x0137('0x20');var _0x49bfd3=_0x57e51d[_0x0137('0x21')];var _0x4aaf67=_0x1ee3d7?0x0:_0x519538['offset'];var _0xcba097=_0x1ee3d7?_0x57e51d[_0x0137('0x21')]:_0x519538[_0x0137('0x22')]+_0x519538[_0x0137('0x1f')];var _0x11a79a;if(_0xcba097>=_0x49bfd3){_0xcba097=_0x49bfd3;_0x11a79a=0xc8;}else{_0x11a79a=0xce;}_0x3f9ebb[_0x0137('0x1d')](_0x11a79a);return _0x3f9ebb['set'](_0x0137('0x23'),_0x4aaf67+'-'+_0xcba097+'/'+_0x49bfd3)[_0x0137('0x1e')](_0x57e51d);}return null;};}function patchUpdates(_0x36c0ef){return function(_0x8dae82){try{jsonpatch[_0x0137('0x24')](_0x8dae82,_0x36c0ef,!![]);}catch(_0xdb96a1){return BPromise[_0x0137('0x25')](_0xdb96a1);}return _0x8dae82[_0x0137('0x26')]();};}function saveUpdates(_0x4f9592,_0x4cd829){return function(_0x39f307){if(_0x39f307){return _0x39f307['update'](_0x4f9592)[_0x0137('0x27')](function(_0x4057a8){return _0x4057a8;});}return null;};}function removeEntity(_0x3865c0,_0xd5293f){return function(_0x5a67fa){if(_0x5a67fa){return _0x5a67fa['destroy']()['then'](function(){var _0x3c30f1=_0x5a67fa[_0x0137('0x28')]({'plain':!![]});var _0x466e14='ExtractedReports';return db[_0x0137('0x29')][_0x0137('0x2a')]({'where':{'type':_0x466e14,'resourceId':_0x3c30f1['id']}})['then'](function(){return _0x5a67fa;});})[_0x0137('0x27')](function(){_0x3865c0[_0x0137('0x1d')](0xcc)[_0x0137('0x1c')]();});}};}function handleEntityNotFound(_0x4cde44,_0x5d1f50){return function(_0x378af9){if(!_0x378af9){_0x4cde44[_0x0137('0x1b')](0x194);}return _0x378af9;};}function handleError(_0x1b422b,_0xc2a9e2){_0xc2a9e2=_0xc2a9e2||0x1f4;return function(_0x27df50){logger['error'](_0x27df50[_0x0137('0x2b')]);if(_0x27df50['name']){delete _0x27df50['name'];}_0x1b422b[_0x0137('0x1d')](_0xc2a9e2)[_0x0137('0x2c')](_0x27df50);};}exports[_0x0137('0x2d')]=function(_0x4bbecd,_0x119d37){var _0x504bbd={},_0x517a3a={},_0x57067f={'count':0x0,'rows':[]};var _0x35bda6=_[_0x0137('0x2e')](db[_0x0137('0x2f')][_0x0137('0x30')],function(_0x4a5239){return{'name':_0x4a5239[_0x0137('0x31')],'type':_0x4a5239[_0x0137('0x32')][_0x0137('0x33')]};});_0x517a3a[_0x0137('0x34')]=_['map'](_0x35bda6,_0x0137('0x35'));_0x517a3a['query']=_[_0x0137('0x36')](_0x4bbecd['query']);_0x517a3a[_0x0137('0x37')]=_[_0x0137('0x38')](_0x517a3a[_0x0137('0x34')],_0x517a3a[_0x0137('0x39')]);_0x504bbd[_0x0137('0x3a')]=_[_0x0137('0x38')](_0x517a3a[_0x0137('0x34')],qs[_0x0137('0x3b')](_0x4bbecd[_0x0137('0x39')]['fields']));_0x504bbd[_0x0137('0x3a')]=_0x504bbd['attributes'][_0x0137('0x3c')]?_0x504bbd['attributes']:_0x517a3a[_0x0137('0x34')];if(!_0x4bbecd[_0x0137('0x39')][_0x0137('0x3d')](_0x0137('0x3e'))){_0x504bbd['limit']=qs[_0x0137('0x1f')](_0x4bbecd[_0x0137('0x39')][_0x0137('0x1f')]);_0x504bbd[_0x0137('0x22')]=qs['offset'](_0x4bbecd[_0x0137('0x39')]['offset']);}_0x504bbd['order']=qs[_0x0137('0x3f')](_0x4bbecd[_0x0137('0x39')][_0x0137('0x3f')]);_0x504bbd[_0x0137('0x40')]=qs['filters'](_[_0x0137('0x41')](_0x4bbecd['query'],_0x517a3a[_0x0137('0x37')]),_0x35bda6);if(_0x4bbecd['query'][_0x0137('0x42')]){_0x504bbd[_0x0137('0x40')]=_[_0x0137('0x43')](_0x504bbd[_0x0137('0x40')],{'$or':_['map'](_0x35bda6,function(_0x553834){if(_0x553834[_0x0137('0x32')]!==_0x0137('0x44')){var _0x12708b={};_0x12708b[_0x553834[_0x0137('0x35')]]={'$like':'%'+_0x4bbecd['query'][_0x0137('0x42')]+'%'};return _0x12708b;}})});}_0x504bbd=_[_0x0137('0x43')]({},_0x504bbd,_0x4bbecd[_0x0137('0x45')]);var _0x461d46={'where':_0x504bbd[_0x0137('0x40')]};return db[_0x0137('0x2f')][_0x0137('0x21')](_0x461d46)['then'](function(_0x2b6f44){_0x57067f['count']=_0x2b6f44;if(_0x4bbecd[_0x0137('0x39')][_0x0137('0x46')]){_0x504bbd[_0x0137('0x47')]=[{'all':!![]}];}return db[_0x0137('0x2f')][_0x0137('0x48')](_0x504bbd);})[_0x0137('0x27')](function(_0x550aab){_0x57067f[_0x0137('0x49')]=_0x550aab;return _0x57067f;})[_0x0137('0x27')](respondWithFilteredResult(_0x119d37,_0x504bbd))['catch'](handleError(_0x119d37,null));};exports['show']=function(_0x57f8a3,_0x456487){var _0x57712c={'raw':!![],'where':{'id':_0x57f8a3[_0x0137('0x4a')]['id']}},_0x1eaf73={};_0x1eaf73['model']=_[_0x0137('0x36')](db[_0x0137('0x2f')][_0x0137('0x30')]);_0x1eaf73[_0x0137('0x39')]=_['keys'](_0x57f8a3[_0x0137('0x39')]);_0x1eaf73[_0x0137('0x37')]=_[_0x0137('0x38')](_0x1eaf73['model'],_0x1eaf73['query']);_0x57712c[_0x0137('0x3a')]=_[_0x0137('0x38')](_0x1eaf73[_0x0137('0x34')],qs[_0x0137('0x3b')](_0x57f8a3[_0x0137('0x39')]['fields']));_0x57712c[_0x0137('0x3a')]=_0x57712c[_0x0137('0x3a')]['length']?_0x57712c[_0x0137('0x3a')]:_0x1eaf73[_0x0137('0x34')];if(_0x57f8a3[_0x0137('0x39')]['includeAll']){_0x57712c[_0x0137('0x47')]=[{'all':!![]}];}_0x57712c=_['merge']({},_0x57712c,_0x57f8a3[_0x0137('0x45')]);return db[_0x0137('0x2f')][_0x0137('0x4b')](_0x57712c)[_0x0137('0x27')](handleEntityNotFound(_0x456487,null))['then'](respondWithResult(_0x456487,null))[_0x0137('0x4c')](handleError(_0x456487,null));};exports[_0x0137('0x4d')]=function(_0x161187,_0x2dc372){return db[_0x0137('0x2f')][_0x0137('0x4d')](_0x161187['body'],{})[_0x0137('0x27')](function(_0x360e85){var _0x2511d7=_0x161187['user'][_0x0137('0x28')]({'plain':!![]});if(!_0x2511d7)throw new Error(_0x0137('0x4e'));if(_0x2511d7['role']===_0x0137('0x4f')){var _0x53e4d=_0x360e85[_0x0137('0x28')]({'plain':!![]});var _0x22453f=_0x0137('0x50');return db['UserProfileSection'][_0x0137('0x4b')]({'where':{'name':_0x22453f,'userProfileId':_0x2511d7['userProfileId']},'raw':!![]})[_0x0137('0x27')](function(_0x495cf2){if(_0x495cf2&&_0x495cf2[_0x0137('0x51')]===0x0){return db[_0x0137('0x29')][_0x0137('0x4d')]({'name':_0x53e4d['name'],'resourceId':_0x53e4d['id'],'type':_0x495cf2['name'],'sectionId':_0x495cf2['id']},{})[_0x0137('0x27')](function(){return _0x360e85;});}else{return _0x360e85;}})[_0x0137('0x4c')](function(_0x33d4ce){logger[_0x0137('0x52')](_0x0137('0x53'),_0x33d4ce);throw _0x33d4ce;});}return _0x360e85;})[_0x0137('0x27')](respondWithResult(_0x2dc372,0xc9))[_0x0137('0x4c')](handleError(_0x2dc372,null));};exports['update']=function(_0x5d193a,_0x3d5b84){if(_0x5d193a[_0x0137('0x54')]['id']){delete _0x5d193a['body']['id'];}return db[_0x0137('0x2f')][_0x0137('0x4b')]({'where':{'id':_0x5d193a[_0x0137('0x4a')]['id']}})[_0x0137('0x27')](handleEntityNotFound(_0x3d5b84,null))[_0x0137('0x27')](saveUpdates(_0x5d193a[_0x0137('0x54')],null))[_0x0137('0x27')](respondWithResult(_0x3d5b84,null))[_0x0137('0x4c')](handleError(_0x3d5b84,null));};exports[_0x0137('0x2a')]=function(_0x4fb0b2,_0x111e70){return db[_0x0137('0x2f')][_0x0137('0x4b')]({'where':{'id':_0x4fb0b2['params']['id']}})['then'](handleEntityNotFound(_0x111e70,null))[_0x0137('0x27')](removeEntity(_0x111e70,null))['catch'](handleError(_0x111e70,null));};exports[_0x0137('0x55')]=function(_0x1a86c3,_0x347e6c,_0x515497){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1a86c3['params']['id']},'attributes':[_0x0137('0x35'),'basename',_0x0137('0x56'),'output'],'raw':!![]})[_0x0137('0x27')](handleEntityNotFound(_0x347e6c,null))[_0x0137('0x27')](function(_0x38b397){if(_0x38b397){if(!fs[_0x0137('0x57')](path[_0x0137('0x58')](config[_0x0137('0x59')],'server/files/reports',_0x38b397['savename']))){throw new db['Sequelize'][(_0x0137('0x5a'))](_0x0137('0x5b'));}if(_0x1a86c3[_0x0137('0x39')][_0x0137('0x5c')]){return _0x347e6c['sendStatus'](0xc8);}return _0x347e6c[_0x0137('0x55')](path[_0x0137('0x58')](config['root'],'server/files/reports',_0x38b397[_0x0137('0x56')]),util['format'](_0x0137('0x5d'),_0x38b397[_0x0137('0x5e')]||_0x38b397[_0x0137('0x35')],_0x38b397['output']['toLowerCase']()));}})[_0x0137('0x4c')](handleError(_0x347e6c,null));}; \ No newline at end of file +var _0xe7d3=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','output','toLowerCase','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','AnalyticExtractedReport','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','userProfileId'];(function(_0x1ce7b1,_0x3c5b65){var _0x154d68=function(_0x12fbc2){while(--_0x12fbc2){_0x1ce7b1['push'](_0x1ce7b1['shift']());}};_0x154d68(++_0x3c5b65);}(_0xe7d3,0x6a));var _0x3e7d=function(_0x38295c,_0x326655){_0x38295c=_0x38295c-0x0;var _0x3d8b76=_0xe7d3[_0x38295c];return _0x3d8b76;};'use strict';var emlformat=require(_0x3e7d('0x0'));var rimraf=require(_0x3e7d('0x1'));var zipdir=require(_0x3e7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e7d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e7d('0x4'));var util=require(_0x3e7d('0x5'));var path=require(_0x3e7d('0x6'));var sox=require(_0x3e7d('0x7'));var csv=require(_0x3e7d('0x8'));var ejs=require(_0x3e7d('0x9'));var fs=require('fs');var fs_extra=require(_0x3e7d('0xa'));var _=require(_0x3e7d('0xb'));var squel=require(_0x3e7d('0xc'));var crypto=require(_0x3e7d('0xd'));var jsforce=require(_0x3e7d('0xe'));var deskjs=require(_0x3e7d('0xf'));var toCsv=require(_0x3e7d('0x8'));var querystring=require(_0x3e7d('0x10'));var Papa=require(_0x3e7d('0x11'));var Redis=require(_0x3e7d('0x12'));var authService=require(_0x3e7d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3e7d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e7d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3e7d('0x16'));var licenseUtil=require(_0x3e7d('0x17'));var db=require(_0x3e7d('0x18'))['db'];function respondWithStatusCode(_0x5cf4ea,_0x374c4c){_0x374c4c=_0x374c4c||0xcc;return function(_0x2914f0){if(_0x2914f0){return _0x5cf4ea['sendStatus'](_0x374c4c);}return _0x5cf4ea['status'](_0x374c4c)[_0x3e7d('0x19')]();};}function respondWithResult(_0x4488a1,_0xb016fd){_0xb016fd=_0xb016fd||0xc8;return function(_0x58d040){if(_0x58d040){return _0x4488a1[_0x3e7d('0x1a')](_0xb016fd)[_0x3e7d('0x1b')](_0x58d040);}};}function respondWithFilteredResult(_0x26fca4,_0x2b5d8a){return function(_0x32e651){if(_0x32e651){var _0x19a084=typeof _0x2b5d8a[_0x3e7d('0x1c')]===_0x3e7d('0x1d')&&typeof _0x2b5d8a[_0x3e7d('0x1e')]===_0x3e7d('0x1d');var _0x486a9a=_0x32e651[_0x3e7d('0x1f')];var _0xf3829d=_0x19a084?0x0:_0x2b5d8a[_0x3e7d('0x1c')];var _0x43d68f=_0x19a084?_0x32e651[_0x3e7d('0x1f')]:_0x2b5d8a[_0x3e7d('0x1c')]+_0x2b5d8a[_0x3e7d('0x1e')];var _0x2d4997;if(_0x43d68f>=_0x486a9a){_0x43d68f=_0x486a9a;_0x2d4997=0xc8;}else{_0x2d4997=0xce;}_0x26fca4[_0x3e7d('0x1a')](_0x2d4997);return _0x26fca4['set'](_0x3e7d('0x20'),_0xf3829d+'-'+_0x43d68f+'/'+_0x486a9a)[_0x3e7d('0x1b')](_0x32e651);}return null;};}function patchUpdates(_0x331475){return function(_0x167f3e){try{jsonpatch[_0x3e7d('0x21')](_0x167f3e,_0x331475,!![]);}catch(_0x79a62b){return BPromise[_0x3e7d('0x22')](_0x79a62b);}return _0x167f3e[_0x3e7d('0x23')]();};}function saveUpdates(_0x502deb,_0x3af43d){return function(_0xffa20f){if(_0xffa20f){return _0xffa20f[_0x3e7d('0x24')](_0x502deb)[_0x3e7d('0x25')](function(_0x34ce9a){return _0x34ce9a;});}return null;};}function removeEntity(_0x3c9655,_0x1eb5c3){return function(_0x297823){if(_0x297823){return _0x297823[_0x3e7d('0x26')]()[_0x3e7d('0x25')](function(){var _0x2c8eaa=_0x297823[_0x3e7d('0x27')]({'plain':!![]});var _0x3b8700='ExtractedReports';return db[_0x3e7d('0x28')][_0x3e7d('0x26')]({'where':{'type':_0x3b8700,'resourceId':_0x2c8eaa['id']}})['then'](function(){return _0x297823;});})['then'](function(){_0x3c9655[_0x3e7d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27de81,_0x55295a){return function(_0x3c6dd9){if(!_0x3c6dd9){_0x27de81[_0x3e7d('0x29')](0x194);}return _0x3c6dd9;};}function handleError(_0x3c176f,_0x2b3485){_0x2b3485=_0x2b3485||0x1f4;return function(_0x56bada){logger[_0x3e7d('0x2a')](_0x56bada[_0x3e7d('0x2b')]);if(_0x56bada['name']){delete _0x56bada[_0x3e7d('0x2c')];}_0x3c176f[_0x3e7d('0x1a')](_0x2b3485)[_0x3e7d('0x2d')](_0x56bada);};}exports[_0x3e7d('0x2e')]=function(_0x498c9c,_0x469c0a){var _0x524eee={},_0x5d5863={},_0x1917f0={'count':0x0,'rows':[]};var _0x4ab895=_[_0x3e7d('0x2f')](db['AnalyticExtractedReport'][_0x3e7d('0x30')],function(_0x22d70f){return{'name':_0x22d70f['fieldName'],'type':_0x22d70f['type']['key']};});_0x5d5863['model']=_[_0x3e7d('0x2f')](_0x4ab895,'name');_0x5d5863[_0x3e7d('0x31')]=_[_0x3e7d('0x32')](_0x498c9c['query']);_0x5d5863[_0x3e7d('0x33')]=_['intersection'](_0x5d5863['model'],_0x5d5863[_0x3e7d('0x31')]);_0x524eee[_0x3e7d('0x34')]=_[_0x3e7d('0x35')](_0x5d5863[_0x3e7d('0x36')],qs['fields'](_0x498c9c[_0x3e7d('0x31')][_0x3e7d('0x37')]));_0x524eee[_0x3e7d('0x34')]=_0x524eee['attributes'][_0x3e7d('0x38')]?_0x524eee[_0x3e7d('0x34')]:_0x5d5863[_0x3e7d('0x36')];if(!_0x498c9c[_0x3e7d('0x31')][_0x3e7d('0x39')]('nolimit')){_0x524eee['limit']=qs[_0x3e7d('0x1e')](_0x498c9c['query'][_0x3e7d('0x1e')]);_0x524eee[_0x3e7d('0x1c')]=qs[_0x3e7d('0x1c')](_0x498c9c[_0x3e7d('0x31')]['offset']);}_0x524eee[_0x3e7d('0x3a')]=qs[_0x3e7d('0x3b')](_0x498c9c[_0x3e7d('0x31')]['sort']);_0x524eee[_0x3e7d('0x3c')]=qs[_0x3e7d('0x33')](_['pick'](_0x498c9c['query'],_0x5d5863[_0x3e7d('0x33')]),_0x4ab895);if(_0x498c9c[_0x3e7d('0x31')][_0x3e7d('0x3d')]){_0x524eee[_0x3e7d('0x3c')]=_['merge'](_0x524eee['where'],{'$or':_['map'](_0x4ab895,function(_0x205538){if(_0x205538[_0x3e7d('0x3e')]!==_0x3e7d('0x3f')){var _0x1e0429={};_0x1e0429[_0x205538[_0x3e7d('0x2c')]]={'$like':'%'+_0x498c9c[_0x3e7d('0x31')]['filter']+'%'};return _0x1e0429;}})});}_0x524eee=_['merge']({},_0x524eee,_0x498c9c['options']);var _0xbccb68={'where':_0x524eee[_0x3e7d('0x3c')]};return db[_0x3e7d('0x40')]['count'](_0xbccb68)[_0x3e7d('0x25')](function(_0x41ba64){_0x1917f0['count']=_0x41ba64;if(_0x498c9c[_0x3e7d('0x31')][_0x3e7d('0x41')]){_0x524eee[_0x3e7d('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x524eee);})[_0x3e7d('0x25')](function(_0x4b4114){_0x1917f0[_0x3e7d('0x43')]=_0x4b4114;return _0x1917f0;})['then'](respondWithFilteredResult(_0x469c0a,_0x524eee))[_0x3e7d('0x44')](handleError(_0x469c0a,null));};exports[_0x3e7d('0x45')]=function(_0x1c616e,_0x5dc5df){var _0x439947={'raw':!![],'where':{'id':_0x1c616e[_0x3e7d('0x46')]['id']}},_0x148428={};_0x148428[_0x3e7d('0x36')]=_[_0x3e7d('0x32')](db[_0x3e7d('0x40')][_0x3e7d('0x30')]);_0x148428[_0x3e7d('0x31')]=_[_0x3e7d('0x32')](_0x1c616e[_0x3e7d('0x31')]);_0x148428[_0x3e7d('0x33')]=_[_0x3e7d('0x35')](_0x148428[_0x3e7d('0x36')],_0x148428[_0x3e7d('0x31')]);_0x439947[_0x3e7d('0x34')]=_[_0x3e7d('0x35')](_0x148428['model'],qs[_0x3e7d('0x37')](_0x1c616e[_0x3e7d('0x31')][_0x3e7d('0x37')]));_0x439947[_0x3e7d('0x34')]=_0x439947[_0x3e7d('0x34')][_0x3e7d('0x38')]?_0x439947[_0x3e7d('0x34')]:_0x148428[_0x3e7d('0x36')];if(_0x1c616e[_0x3e7d('0x31')][_0x3e7d('0x41')]){_0x439947[_0x3e7d('0x42')]=[{'all':!![]}];}_0x439947=_['merge']({},_0x439947,_0x1c616e[_0x3e7d('0x47')]);return db[_0x3e7d('0x40')][_0x3e7d('0x48')](_0x439947)[_0x3e7d('0x25')](handleEntityNotFound(_0x5dc5df,null))['then'](respondWithResult(_0x5dc5df,null))[_0x3e7d('0x44')](handleError(_0x5dc5df,null));};exports[_0x3e7d('0x49')]=function(_0x4dce87,_0x3165ab){return db[_0x3e7d('0x40')]['create'](_0x4dce87[_0x3e7d('0x4a')],{})['then'](function(_0x243e4d){var _0xa09afe=_0x4dce87['user'][_0x3e7d('0x27')]({'plain':!![]});if(!_0xa09afe)throw new Error(_0x3e7d('0x4b'));if(_0xa09afe[_0x3e7d('0x4c')]===_0x3e7d('0x4d')){var _0x3ca3a5=_0x243e4d[_0x3e7d('0x27')]({'plain':!![]});var _0x360f6c=_0x3e7d('0x4e');return db['UserProfileSection'][_0x3e7d('0x48')]({'where':{'name':_0x360f6c,'userProfileId':_0xa09afe[_0x3e7d('0x4f')]},'raw':!![]})[_0x3e7d('0x25')](function(_0x2c7895){if(_0x2c7895&&_0x2c7895['autoAssociation']===0x0){return db[_0x3e7d('0x28')][_0x3e7d('0x49')]({'name':_0x3ca3a5[_0x3e7d('0x2c')],'resourceId':_0x3ca3a5['id'],'type':_0x2c7895[_0x3e7d('0x2c')],'sectionId':_0x2c7895['id']},{})[_0x3e7d('0x25')](function(){return _0x243e4d;});}else{return _0x243e4d;}})[_0x3e7d('0x44')](function(_0x412b42){logger[_0x3e7d('0x2a')](_0x3e7d('0x50'),_0x412b42);throw _0x412b42;});}return _0x243e4d;})['then'](respondWithResult(_0x3165ab,0xc9))[_0x3e7d('0x44')](handleError(_0x3165ab,null));};exports[_0x3e7d('0x24')]=function(_0x135f4e,_0x3a36c6){if(_0x135f4e[_0x3e7d('0x4a')]['id']){delete _0x135f4e['body']['id'];}return db[_0x3e7d('0x40')][_0x3e7d('0x48')]({'where':{'id':_0x135f4e[_0x3e7d('0x46')]['id']}})[_0x3e7d('0x25')](handleEntityNotFound(_0x3a36c6,null))[_0x3e7d('0x25')](saveUpdates(_0x135f4e['body'],null))[_0x3e7d('0x25')](respondWithResult(_0x3a36c6,null))['catch'](handleError(_0x3a36c6,null));};exports[_0x3e7d('0x26')]=function(_0x59f4c4,_0x25dbf3){return db[_0x3e7d('0x40')][_0x3e7d('0x48')]({'where':{'id':_0x59f4c4[_0x3e7d('0x46')]['id']}})[_0x3e7d('0x25')](handleEntityNotFound(_0x25dbf3,null))[_0x3e7d('0x25')](removeEntity(_0x25dbf3,null))[_0x3e7d('0x44')](handleError(_0x25dbf3,null));};exports['download']=function(_0x187c5a,_0x1ec16b,_0x518f8d){return db[_0x3e7d('0x40')][_0x3e7d('0x48')]({'where':{'id':_0x187c5a[_0x3e7d('0x46')]['id']},'attributes':[_0x3e7d('0x2c'),_0x3e7d('0x51'),_0x3e7d('0x52'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x1ec16b,null))[_0x3e7d('0x25')](function(_0x5de71a){if(_0x5de71a){if(!fs['existsSync'](path[_0x3e7d('0x53')](config[_0x3e7d('0x54')],_0x3e7d('0x55'),_0x5de71a[_0x3e7d('0x52')]))){throw new db[(_0x3e7d('0x56'))][(_0x3e7d('0x57'))](_0x3e7d('0x58'));}if(_0x187c5a[_0x3e7d('0x31')][_0x3e7d('0x59')]){return _0x1ec16b[_0x3e7d('0x29')](0xc8);}return _0x1ec16b[_0x3e7d('0x5a')](path[_0x3e7d('0x53')](config['root'],'server/files/reports',_0x5de71a[_0x3e7d('0x52')]),util['format']('%s.%s',_0x5de71a[_0x3e7d('0x51')]||_0x5de71a[_0x3e7d('0x2c')],_0x5de71a[_0x3e7d('0x5b')][_0x3e7d('0x5c')]()));}})[_0x3e7d('0x44')](handleError(_0x1ec16b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8f2fa1e..b75ecff 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 _0x71fb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api'];(function(_0x282999,_0x4df660){var _0x30681f=function(_0x50e926){while(--_0x50e926){_0x282999['push'](_0x282999['shift']());}};_0x30681f(++_0x4df660);}(_0x71fb,0x14d));var _0xb71f=function(_0x5bd3f1,_0x57864a){_0x5bd3f1=_0x5bd3f1-0x0;var _0x12b904=_0x71fb[_0x5bd3f1];return _0x12b904;};'use strict';var _=require(_0xb71f('0x0'));var util=require(_0xb71f('0x1'));var logger=require('../../config/logger')(_0xb71f('0x2'));var moment=require(_0xb71f('0x3'));var BPromise=require(_0xb71f('0x4'));var rp=require(_0xb71f('0x5'));var fs=require('fs');var path=require(_0xb71f('0x6'));var rimraf=require(_0xb71f('0x7'));var config=require(_0xb71f('0x8'));var attributes=require(_0xb71f('0x9'));module[_0xb71f('0xa')]=function(_0x1435a9,_0x47717f){return _0x1435a9[_0xb71f('0xb')](_0xb71f('0xc'),attributes,{'tableName':_0xb71f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9936=['analytics_extracted_reports','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticExtractedReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9936,0x85));var _0x6993=function(_0x5dbb2,_0x1e3317){_0x5dbb2=_0x5dbb2-0x0;var _0x4ba922=_0x9936[_0x5dbb2];return _0x4ba922;};'use strict';var _=require(_0x6993('0x0'));var util=require(_0x6993('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6993('0x2'));var BPromise=require(_0x6993('0x3'));var rp=require(_0x6993('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6993('0x5'));var config=require(_0x6993('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x6993('0x7')]=function(_0x539d3e,_0xfc49d4){return _0x539d3e[_0x6993('0x8')](_0x6993('0x9'),attributes,{'tableName':_0x6993('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index cbdbd7a..67b8c4e 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 _0x42ec=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x3cc64d,_0x51b49c){var _0x567522=function(_0x1df776){while(--_0x1df776){_0x3cc64d['push'](_0x3cc64d['shift']());}};_0x567522(++_0x51b49c);}(_0x42ec,0x1bf));var _0xc42e=function(_0x4bb29a,_0x368b43){_0x4bb29a=_0x4bb29a-0x0;var _0x20770a=_0x42ec[_0x4bb29a];return _0x20770a;};'use strict';var _=require('lodash');var util=require(_0xc42e('0x0'));var moment=require(_0xc42e('0x1'));var BPromise=require(_0xc42e('0x2'));var rs=require(_0xc42e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc42e('0x4'));var logger=require(_0xc42e('0x5'))(_0xc42e('0x6'));var config=require(_0xc42e('0x7'));var jayson=require(_0xc42e('0x8'));var client=jayson[_0xc42e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43977a,_0x31fc77,_0x113847){return new BPromise(function(_0x5c726b,_0x3130d7){return client[_0xc42e('0xa')](_0x43977a,_0x113847)[_0xc42e('0xb')](function(_0x164298){logger[_0xc42e('0xc')](_0xc42e('0xd'),_0x31fc77,_0xc42e('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x31fc77,_0xc42e('0xe'),JSON[_0xc42e('0xf')](_0x164298));if(_0x164298[_0xc42e('0x10')]){if(_0x164298[_0xc42e('0x10')][_0xc42e('0x11')]===0x1f4){logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);return _0x3130d7(_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);}logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0x164298[_0xc42e('0x10')][_0xc42e('0x12')]);return _0x5c726b(_0x164298['error'][_0xc42e('0x12')]);}else{logger[_0xc42e('0xc')](_0xc42e('0xd'),_0x31fc77,'request\x20sent');_0x5c726b(_0x164298[_0xc42e('0x13')][_0xc42e('0x12')]);}})['catch'](function(_0xf366cd){logger[_0xc42e('0x10')](_0xc42e('0xd'),_0x31fc77,_0xf366cd);_0x3130d7(_0xf366cd);});});} \ No newline at end of file +var _0x9343=['stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x3fc210,_0x570e60){var _0x961f53=function(_0x7c2917){while(--_0x7c2917){_0x3fc210['push'](_0x3fc210['shift']());}};_0x961f53(++_0x570e60);}(_0x9343,0x76));var _0x3934=function(_0x3c84f4,_0x4d3044){_0x3c84f4=_0x3c84f4-0x0;var _0x45577b=_0x9343[_0x3c84f4];return _0x45577b;};'use strict';var _=require(_0x3934('0x0'));var util=require(_0x3934('0x1'));var moment=require('moment');var BPromise=require(_0x3934('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3934('0x3'));var db=require(_0x3934('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3934('0x5'))(_0x3934('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3934('0x7')][_0x3934('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d0827,_0x38fa22,_0x44d7b7){return new BPromise(function(_0xaf5c22,_0x23dbdf){return client[_0x3934('0x9')](_0x4d0827,_0x44d7b7)[_0x3934('0xa')](function(_0x1e8e7b){logger['info'](_0x3934('0xb'),_0x38fa22,'request\x20sent');logger[_0x3934('0xc')](_0x3934('0xd'),_0x38fa22,'request\x20sent',JSON[_0x3934('0xe')](_0x1e8e7b));if(_0x1e8e7b['error']){if(_0x1e8e7b[_0x3934('0xf')][_0x3934('0x10')]===0x1f4){logger[_0x3934('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x38fa22,_0x1e8e7b[_0x3934('0xf')][_0x3934('0x11')]);return _0x23dbdf(_0x1e8e7b[_0x3934('0xf')][_0x3934('0x11')]);}logger[_0x3934('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x38fa22,_0x1e8e7b['error'][_0x3934('0x11')]);return _0xaf5c22(_0x1e8e7b['error'][_0x3934('0x11')]);}else{logger[_0x3934('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x38fa22,_0x3934('0x13'));_0xaf5c22(_0x1e8e7b[_0x3934('0x14')]['message']);}})[_0x3934('0x15')](function(_0x11e4d0){logger[_0x3934('0xf')](_0x3934('0xb'),_0x38fa22,_0x11e4d0);_0x23dbdf(_0x11e4d0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index cd0ef36..c950a74 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 _0x4181=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','download','create','put'];(function(_0x59de9f,_0x32b173){var _0x2e7611=function(_0x16a092){while(--_0x16a092){_0x59de9f['push'](_0x59de9f['shift']());}};_0x2e7611(++_0x32b173);}(_0x4181,0x1df));var _0x1418=function(_0xfbf494,_0x166255){_0xfbf494=_0xfbf494-0x0;var _0x3081d0=_0x4181[_0xfbf494];return _0x3081d0;};'use strict';var multer=require(_0x1418('0x0'));var util=require(_0x1418('0x1'));var path=require(_0x1418('0x2'));var timeout=require(_0x1418('0x3'));var express=require(_0x1418('0x4'));var router=express[_0x1418('0x5')]();var fs_extra=require(_0x1418('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1418('0x7'));var controller=require(_0x1418('0x8'));router[_0x1418('0x9')]('/',auth[_0x1418('0xa')](),controller[_0x1418('0xb')]);router[_0x1418('0x9')]('/:id',auth[_0x1418('0xa')](),controller['show']);router[_0x1418('0x9')]('/:id/download',auth[_0x1418('0xa')](),controller[_0x1418('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1418('0xd')]);router[_0x1418('0xe')]('/:id',auth[_0x1418('0xa')](),controller[_0x1418('0xf')]);router[_0x1418('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1418('0x11')]);module[_0x1418('0x12')]=router; \ No newline at end of file +var _0xb32a=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x135c21,_0x5c2dbc){var _0x47be83=function(_0x40e42c){while(--_0x40e42c){_0x135c21['push'](_0x135c21['shift']());}};_0x47be83(++_0x5c2dbc);}(_0xb32a,0x15f));var _0xab32=function(_0x1d2782,_0x109a9c){_0x1d2782=_0x1d2782-0x0;var _0x59937f=_0xb32a[_0x1d2782];return _0x59937f;};'use strict';var multer=require(_0xab32('0x0'));var util=require(_0xab32('0x1'));var path=require(_0xab32('0x2'));var timeout=require(_0xab32('0x3'));var express=require(_0xab32('0x4'));var router=express[_0xab32('0x5')]();var fs_extra=require(_0xab32('0x6'));var auth=require(_0xab32('0x7'));var interaction=require(_0xab32('0x8'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xab32('0x9')]('/',auth[_0xab32('0xa')](),controller[_0xab32('0xb')]);router[_0xab32('0x9')](_0xab32('0xc'),auth[_0xab32('0xa')](),controller[_0xab32('0xd')]);router[_0xab32('0x9')](_0xab32('0xe'),auth[_0xab32('0xa')](),controller[_0xab32('0xf')]);router[_0xab32('0x10')]('/',auth[_0xab32('0xa')](),controller[_0xab32('0x11')]);router[_0xab32('0x12')](_0xab32('0xc'),auth[_0xab32('0xa')](),controller['update']);router[_0xab32('0x13')]('/:id',auth[_0xab32('0xa')](),controller['destroy']);module[_0xab32('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ed79627..8dd6c89 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 _0x55cb=['STRING','BOOLEAN','exports'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x55cb,0x16a));var _0xb55c=function(_0x20229e,_0xa59f8a){_0x20229e=_0x20229e-0x0;var _0x317377=_0x55cb[_0x20229e];return _0x317377;};'use strict';var Sequelize=require('sequelize');module[_0xb55c('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xb55c('0x1')]},'function':{'type':Sequelize[_0xb55c('0x1')]},'format':{'type':Sequelize[_0xb55c('0x1')]},'groupBy':{'type':Sequelize[_0xb55c('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb55c('0x1')]},'custom':{'type':Sequelize[_0xb55c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe7de=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0xe7de,0x6e));var _0xee7d=function(_0x8ed406,_0x5c7466){_0x8ed406=_0x8ed406-0x0;var _0x2ad447=_0xe7de[_0x8ed406];return _0x2ad447;};'use strict';var Sequelize=require(_0xee7d('0x0'));module['exports']={'field':{'type':Sequelize[_0xee7d('0x1')]},'alias':{'type':Sequelize[_0xee7d('0x2')]},'function':{'type':Sequelize[_0xee7d('0x2')]},'format':{'type':Sequelize[_0xee7d('0x2')]},'groupBy':{'type':Sequelize[_0xee7d('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xee7d('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f0280ab..c2afd81 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 _0x6528=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','AnalyticFieldReport','findAll','rows','catch','show','params','keys','options','create','bulkCreate','body','update','find','bulkDestroy','ids','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key'];(function(_0x331929,_0x66d000){var _0x3e05ff=function(_0x7fc15f){while(--_0x7fc15f){_0x331929['push'](_0x331929['shift']());}};_0x3e05ff(++_0x66d000);}(_0x6528,0x1cd));var _0x8652=function(_0x4c0fc3,_0x2bcb44){_0x4c0fc3=_0x4c0fc3-0x0;var _0x10b7dd=_0x6528[_0x4c0fc3];return _0x10b7dd;};'use strict';var emlformat=require(_0x8652('0x0'));var rimraf=require(_0x8652('0x1'));var zipdir=require(_0x8652('0x2'));var jsonpatch=require(_0x8652('0x3'));var rp=require(_0x8652('0x4'));var moment=require(_0x8652('0x5'));var BPromise=require(_0x8652('0x6'));var Mustache=require(_0x8652('0x7'));var util=require(_0x8652('0x8'));var path=require(_0x8652('0x9'));var sox=require(_0x8652('0xa'));var csv=require('to-csv');var ejs=require(_0x8652('0xb'));var fs=require('fs');var fs_extra=require(_0x8652('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8652('0xd'));var jsforce=require(_0x8652('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8652('0xf'));var querystring=require(_0x8652('0x10'));var Papa=require(_0x8652('0x11'));var Redis=require(_0x8652('0x12'));var authService=require(_0x8652('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8652('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8652('0x15'))(_0x8652('0x16'));var utils=require(_0x8652('0x17'));var config=require(_0x8652('0x18'));var licenseUtil=require(_0x8652('0x19'));var db=require(_0x8652('0x1a'))['db'];function respondWithStatusCode(_0x4daa4a,_0xdf3423){_0xdf3423=_0xdf3423||0xcc;return function(_0xaf5953){if(_0xaf5953){return _0x4daa4a[_0x8652('0x1b')](_0xdf3423);}return _0x4daa4a[_0x8652('0x1c')](_0xdf3423)[_0x8652('0x1d')]();};}function respondWithResult(_0x4f2b52,_0x1bb27b){_0x1bb27b=_0x1bb27b||0xc8;return function(_0x117854){if(_0x117854){return _0x4f2b52[_0x8652('0x1c')](_0x1bb27b)[_0x8652('0x1e')](_0x117854);}};}function respondWithFilteredResult(_0x295ea4,_0x23bf78){return function(_0x281527){if(_0x281527){var _0x1bba22=typeof _0x23bf78[_0x8652('0x1f')]===_0x8652('0x20')&&typeof _0x23bf78[_0x8652('0x21')]===_0x8652('0x20');var _0x5597ca=_0x281527[_0x8652('0x22')];var _0x46f9b9=_0x1bba22?0x0:_0x23bf78[_0x8652('0x1f')];var _0x2192e0=_0x1bba22?_0x281527[_0x8652('0x22')]:_0x23bf78[_0x8652('0x1f')]+_0x23bf78[_0x8652('0x21')];var _0x35e015;if(_0x2192e0>=_0x5597ca){_0x2192e0=_0x5597ca;_0x35e015=0xc8;}else{_0x35e015=0xce;}_0x295ea4[_0x8652('0x1c')](_0x35e015);return _0x295ea4['set'](_0x8652('0x23'),_0x46f9b9+'-'+_0x2192e0+'/'+_0x5597ca)[_0x8652('0x1e')](_0x281527);}return null;};}function patchUpdates(_0x36b80e){return function(_0x185369){try{jsonpatch[_0x8652('0x24')](_0x185369,_0x36b80e,!![]);}catch(_0x1a4d73){return BPromise[_0x8652('0x25')](_0x1a4d73);}return _0x185369[_0x8652('0x26')]();};}function saveUpdates(_0x4f95b9,_0xfbfbfd){return function(_0x38ac26){if(_0x38ac26){return _0x38ac26['update'](_0x4f95b9)[_0x8652('0x27')](function(_0x178b6a){return _0x178b6a;});}return null;};}function removeEntity(_0x2ab1bf,_0x29251e){return function(_0x232053){if(_0x232053){return _0x232053[_0x8652('0x28')]()['then'](function(){_0x2ab1bf['status'](0xcc)[_0x8652('0x1d')]();});}};}function handleEntityNotFound(_0x2cc8f1,_0x23470d){return function(_0x4ce6d0){if(!_0x4ce6d0){_0x2cc8f1[_0x8652('0x1b')](0x194);}return _0x4ce6d0;};}function handleError(_0x351e11,_0x3522ff){_0x3522ff=_0x3522ff||0x1f4;return function(_0x306de4){logger[_0x8652('0x29')](_0x306de4[_0x8652('0x2a')]);if(_0x306de4[_0x8652('0x2b')]){delete _0x306de4[_0x8652('0x2b')];}_0x351e11[_0x8652('0x1c')](_0x3522ff)['send'](_0x306de4);};}exports['index']=function(_0x43d7f5,_0x1420a1){var _0xd9d013={},_0x5e67a9={},_0x3facba={'count':0x0,'rows':[]};var _0x2504a8=_[_0x8652('0x2c')](db['AnalyticFieldReport'][_0x8652('0x2d')],function(_0x45d8d2){return{'name':_0x45d8d2[_0x8652('0x2e')],'type':_0x45d8d2[_0x8652('0x2f')][_0x8652('0x30')]};});_0x5e67a9[_0x8652('0x31')]=_[_0x8652('0x2c')](_0x2504a8,_0x8652('0x2b'));_0x5e67a9[_0x8652('0x32')]=_['keys'](_0x43d7f5[_0x8652('0x32')]);_0x5e67a9[_0x8652('0x33')]=_[_0x8652('0x34')](_0x5e67a9[_0x8652('0x31')],_0x5e67a9[_0x8652('0x32')]);_0xd9d013['attributes']=_[_0x8652('0x34')](_0x5e67a9[_0x8652('0x31')],qs[_0x8652('0x35')](_0x43d7f5['query'][_0x8652('0x35')]));_0xd9d013[_0x8652('0x36')]=_0xd9d013[_0x8652('0x36')][_0x8652('0x37')]?_0xd9d013[_0x8652('0x36')]:_0x5e67a9[_0x8652('0x31')];if(!_0x43d7f5[_0x8652('0x32')][_0x8652('0x38')](_0x8652('0x39'))){_0xd9d013[_0x8652('0x21')]=qs[_0x8652('0x21')](_0x43d7f5[_0x8652('0x32')][_0x8652('0x21')]);_0xd9d013[_0x8652('0x1f')]=qs[_0x8652('0x1f')](_0x43d7f5[_0x8652('0x32')][_0x8652('0x1f')]);}_0xd9d013[_0x8652('0x3a')]=qs[_0x8652('0x3b')](_0x43d7f5[_0x8652('0x32')][_0x8652('0x3b')]);_0xd9d013['where']=qs[_0x8652('0x33')](_[_0x8652('0x3c')](_0x43d7f5[_0x8652('0x32')],_0x5e67a9['filters']),_0x2504a8);if(_0x43d7f5[_0x8652('0x32')][_0x8652('0x3d')]){_0xd9d013[_0x8652('0x3e')]=_['merge'](_0xd9d013['where'],{'$or':_[_0x8652('0x2c')](_0x2504a8,function(_0x405373){if(_0x405373[_0x8652('0x2f')]!==_0x8652('0x3f')){var _0x4f65bc={};_0x4f65bc[_0x405373[_0x8652('0x2b')]]={'$like':'%'+_0x43d7f5['query'][_0x8652('0x3d')]+'%'};return _0x4f65bc;}})});}_0xd9d013=_[_0x8652('0x40')]({},_0xd9d013,_0x43d7f5['options']);var _0x3913cf={'where':_0xd9d013['where']};return db['AnalyticFieldReport'][_0x8652('0x22')](_0x3913cf)[_0x8652('0x27')](function(_0x181dc2){_0x3facba[_0x8652('0x22')]=_0x181dc2;if(_0x43d7f5[_0x8652('0x32')][_0x8652('0x41')]){_0xd9d013[_0x8652('0x42')]=[{'all':!![]}];}return db[_0x8652('0x43')][_0x8652('0x44')](_0xd9d013);})[_0x8652('0x27')](function(_0x26d26c){_0x3facba[_0x8652('0x45')]=_0x26d26c;return _0x3facba;})[_0x8652('0x27')](respondWithFilteredResult(_0x1420a1,_0xd9d013))[_0x8652('0x46')](handleError(_0x1420a1,null));};exports[_0x8652('0x47')]=function(_0x5834f4,_0x333a24){var _0x49ce41={'raw':![],'where':{'id':_0x5834f4[_0x8652('0x48')]['id']}},_0x5cf341={};_0x5cf341[_0x8652('0x31')]=_[_0x8652('0x49')](db[_0x8652('0x43')][_0x8652('0x2d')]);_0x5cf341[_0x8652('0x32')]=_[_0x8652('0x49')](_0x5834f4[_0x8652('0x32')]);_0x5cf341[_0x8652('0x33')]=_[_0x8652('0x34')](_0x5cf341[_0x8652('0x31')],_0x5cf341['query']);_0x49ce41[_0x8652('0x36')]=_[_0x8652('0x34')](_0x5cf341[_0x8652('0x31')],qs['fields'](_0x5834f4[_0x8652('0x32')][_0x8652('0x35')]));_0x49ce41[_0x8652('0x36')]=_0x49ce41[_0x8652('0x36')][_0x8652('0x37')]?_0x49ce41['attributes']:_0x5cf341[_0x8652('0x31')];if(_0x5834f4[_0x8652('0x32')][_0x8652('0x41')]){_0x49ce41['include']=[{'all':!![]}];}_0x49ce41=_['merge']({},_0x49ce41,_0x5834f4[_0x8652('0x4a')]);return db[_0x8652('0x43')]['find'](_0x49ce41)[_0x8652('0x27')](handleEntityNotFound(_0x333a24,null))['then'](respondWithResult(_0x333a24,null))['catch'](handleError(_0x333a24,null));};exports[_0x8652('0x4b')]=function(_0x3bc00c,_0x2e98c6){return db[_0x8652('0x43')]['create'](_0x3bc00c['body'],{})[_0x8652('0x27')](respondWithResult(_0x2e98c6,0xc9))[_0x8652('0x46')](handleError(_0x2e98c6,null));};exports[_0x8652('0x4c')]=function(_0x469c56,_0x175a94){return db[_0x8652('0x43')][_0x8652('0x4c')](_0x469c56[_0x8652('0x4d')],{'raw':![],'individualHooks':!![]})[_0x8652('0x27')](respondWithResult(_0x175a94,0xc9))['catch'](handleError(_0x175a94,null));};exports[_0x8652('0x4e')]=function(_0x4e33c2,_0x361afe){if(_0x4e33c2[_0x8652('0x4d')]['id']){delete _0x4e33c2['body']['id'];}return db[_0x8652('0x43')][_0x8652('0x4f')]({'where':{'id':_0x4e33c2[_0x8652('0x48')]['id']}})[_0x8652('0x27')](handleEntityNotFound(_0x361afe,null))[_0x8652('0x27')](saveUpdates(_0x4e33c2['body'],null))[_0x8652('0x27')](respondWithResult(_0x361afe,null))[_0x8652('0x46')](handleError(_0x361afe,null));};exports[_0x8652('0x28')]=function(_0x31c3c7,_0x5799b7){return db[_0x8652('0x43')][_0x8652('0x4f')]({'where':{'id':_0x31c3c7[_0x8652('0x48')]['id']}})[_0x8652('0x27')](handleEntityNotFound(_0x5799b7,null))[_0x8652('0x27')](removeEntity(_0x5799b7,null))[_0x8652('0x46')](handleError(_0x5799b7,null));};exports[_0x8652('0x50')]=function(_0x4a3378,_0x2b71d3){return db[_0x8652('0x43')][_0x8652('0x28')]({'where':{'id':_0x4a3378[_0x8652('0x32')][_0x8652('0x51')]||[]},'raw':![],'individualHooks':!![]})[_0x8652('0x27')](respondWithResult(_0x2b71d3,0xcc))['catch'](handleError(_0x2b71d3,null));};exports['addFields']=function(_0x402254,_0x33bd8e,_0x262281){return db[_0x8652('0x52')]['findOne']({'where':{'id':_0x402254['params']['id']}})[_0x8652('0x27')](handleEntityNotFound(_0x33bd8e,null))[_0x8652('0x27')](function(_0x375cbb){if(_0x375cbb){return db[_0x8652('0x53')]['transaction'](function(_0x5e437e){return db[_0x8652('0x43')][_0x8652('0x28')]({'where':{'CustomReportId':_0x402254['params']['id']},'transaction':_0x5e437e})['then'](function(_0x520ffb){var _0x1062c1=_[_0x8652('0x2c')](_0x402254[_0x8652('0x4d')],function(_0x573cbe){delete _0x573cbe['id'];_0x573cbe[_0x8652('0x54')]=_0x402254[_0x8652('0x48')]['id'];return _0x573cbe;});return db[_0x8652('0x43')][_0x8652('0x4c')](_0x1062c1,{'transaction':_0x5e437e});});})[_0x8652('0x27')](function(){return db[_0x8652('0x43')][_0x8652('0x44')]({'where':{'CustomReportId':_0x402254[_0x8652('0x48')]['id']}});});}})[_0x8652('0x27')](respondWithResult(_0x33bd8e,null))['catch'](handleError(_0x33bd8e,null));}; \ No newline at end of file +var _0x5725=['fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','create','body','bulkCreate','catch','update','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir'];(function(_0xbc107a,_0x2cf678){var _0x102943=function(_0x3432af){while(--_0x3432af){_0xbc107a['push'](_0xbc107a['shift']());}};_0x102943(++_0x2cf678);}(_0x5725,0xa5));var _0x5572=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5725[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x5572('0x0'));var rimraf=require(_0x5572('0x1'));var zipdir=require(_0x5572('0x2'));var jsonpatch=require(_0x5572('0x3'));var rp=require(_0x5572('0x4'));var moment=require('moment');var BPromise=require(_0x5572('0x5'));var Mustache=require(_0x5572('0x6'));var util=require('util');var path=require(_0x5572('0x7'));var sox=require(_0x5572('0x8'));var csv=require(_0x5572('0x9'));var ejs=require(_0x5572('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5572('0xb'));var squel=require(_0x5572('0xc'));var crypto=require(_0x5572('0xd'));var jsforce=require(_0x5572('0xe'));var deskjs=require(_0x5572('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5572('0x10'));var Redis=require(_0x5572('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5572('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5572('0x13'));var logger=require(_0x5572('0x14'))('api');var utils=require(_0x5572('0x15'));var config=require(_0x5572('0x16'));var licenseUtil=require(_0x5572('0x17'));var db=require(_0x5572('0x18'))['db'];function respondWithStatusCode(_0x14e656,_0x3e91a0){_0x3e91a0=_0x3e91a0||0xcc;return function(_0x550fb5){if(_0x550fb5){return _0x14e656[_0x5572('0x19')](_0x3e91a0);}return _0x14e656[_0x5572('0x1a')](_0x3e91a0)['end']();};}function respondWithResult(_0x1b7db7,_0x58fb02){_0x58fb02=_0x58fb02||0xc8;return function(_0x5278ad){if(_0x5278ad){return _0x1b7db7[_0x5572('0x1a')](_0x58fb02)[_0x5572('0x1b')](_0x5278ad);}};}function respondWithFilteredResult(_0x5be315,_0x4cf7bb){return function(_0x304550){if(_0x304550){var _0x537748=typeof _0x4cf7bb[_0x5572('0x1c')]===_0x5572('0x1d')&&typeof _0x4cf7bb[_0x5572('0x1e')]==='undefined';var _0x1100a9=_0x304550[_0x5572('0x1f')];var _0x1c2096=_0x537748?0x0:_0x4cf7bb[_0x5572('0x1c')];var _0x56b1c8=_0x537748?_0x304550[_0x5572('0x1f')]:_0x4cf7bb[_0x5572('0x1c')]+_0x4cf7bb['limit'];var _0x1a1c3b;if(_0x56b1c8>=_0x1100a9){_0x56b1c8=_0x1100a9;_0x1a1c3b=0xc8;}else{_0x1a1c3b=0xce;}_0x5be315['status'](_0x1a1c3b);return _0x5be315[_0x5572('0x20')]('Content-Range',_0x1c2096+'-'+_0x56b1c8+'/'+_0x1100a9)['json'](_0x304550);}return null;};}function patchUpdates(_0x2d46ad){return function(_0x265bbe){try{jsonpatch[_0x5572('0x21')](_0x265bbe,_0x2d46ad,!![]);}catch(_0x2ed35b){return BPromise[_0x5572('0x22')](_0x2ed35b);}return _0x265bbe[_0x5572('0x23')]();};}function saveUpdates(_0x3619f5,_0xb5af44){return function(_0x234eed){if(_0x234eed){return _0x234eed['update'](_0x3619f5)[_0x5572('0x24')](function(_0x3a6080){return _0x3a6080;});}return null;};}function removeEntity(_0x4f8e10,_0x5840ff){return function(_0x4e1a4d){if(_0x4e1a4d){return _0x4e1a4d[_0x5572('0x25')]()['then'](function(){_0x4f8e10[_0x5572('0x1a')](0xcc)[_0x5572('0x26')]();});}};}function handleEntityNotFound(_0x591f82,_0x139456){return function(_0x3f2277){if(!_0x3f2277){_0x591f82[_0x5572('0x19')](0x194);}return _0x3f2277;};}function handleError(_0x38e10d,_0x3ad2d){_0x3ad2d=_0x3ad2d||0x1f4;return function(_0x5531c6){logger[_0x5572('0x27')](_0x5531c6[_0x5572('0x28')]);if(_0x5531c6[_0x5572('0x29')]){delete _0x5531c6[_0x5572('0x29')];}_0x38e10d['status'](_0x3ad2d)[_0x5572('0x2a')](_0x5531c6);};}exports[_0x5572('0x2b')]=function(_0x1d22fb,_0x3fde60){var _0x2126b8={},_0x889048={},_0x37b361={'count':0x0,'rows':[]};var _0x3f92c0=_['map'](db[_0x5572('0x2c')][_0x5572('0x2d')],function(_0x197ce3){return{'name':_0x197ce3[_0x5572('0x2e')],'type':_0x197ce3['type'][_0x5572('0x2f')]};});_0x889048[_0x5572('0x30')]=_[_0x5572('0x31')](_0x3f92c0,'name');_0x889048[_0x5572('0x32')]=_[_0x5572('0x33')](_0x1d22fb['query']);_0x889048['filters']=_[_0x5572('0x34')](_0x889048[_0x5572('0x30')],_0x889048[_0x5572('0x32')]);_0x2126b8[_0x5572('0x35')]=_[_0x5572('0x34')](_0x889048[_0x5572('0x30')],qs['fields'](_0x1d22fb['query'][_0x5572('0x36')]));_0x2126b8['attributes']=_0x2126b8[_0x5572('0x35')]['length']?_0x2126b8[_0x5572('0x35')]:_0x889048[_0x5572('0x30')];if(!_0x1d22fb['query'][_0x5572('0x37')](_0x5572('0x38'))){_0x2126b8['limit']=qs['limit'](_0x1d22fb[_0x5572('0x32')][_0x5572('0x1e')]);_0x2126b8[_0x5572('0x1c')]=qs['offset'](_0x1d22fb['query'][_0x5572('0x1c')]);}_0x2126b8[_0x5572('0x39')]=qs[_0x5572('0x3a')](_0x1d22fb[_0x5572('0x32')][_0x5572('0x3a')]);_0x2126b8[_0x5572('0x3b')]=qs[_0x5572('0x3c')](_[_0x5572('0x3d')](_0x1d22fb[_0x5572('0x32')],_0x889048[_0x5572('0x3c')]),_0x3f92c0);if(_0x1d22fb[_0x5572('0x32')]['filter']){_0x2126b8[_0x5572('0x3b')]=_['merge'](_0x2126b8[_0x5572('0x3b')],{'$or':_[_0x5572('0x31')](_0x3f92c0,function(_0x28b8fe){if(_0x28b8fe[_0x5572('0x3e')]!==_0x5572('0x3f')){var _0x49a42e={};_0x49a42e[_0x28b8fe[_0x5572('0x29')]]={'$like':'%'+_0x1d22fb[_0x5572('0x32')][_0x5572('0x40')]+'%'};return _0x49a42e;}})});}_0x2126b8=_[_0x5572('0x41')]({},_0x2126b8,_0x1d22fb[_0x5572('0x42')]);var _0x2eb0b3={'where':_0x2126b8['where']};return db[_0x5572('0x2c')][_0x5572('0x1f')](_0x2eb0b3)[_0x5572('0x24')](function(_0x4c49fc){_0x37b361[_0x5572('0x1f')]=_0x4c49fc;if(_0x1d22fb[_0x5572('0x32')][_0x5572('0x43')]){_0x2126b8[_0x5572('0x44')]=[{'all':!![]}];}return db[_0x5572('0x2c')][_0x5572('0x45')](_0x2126b8);})['then'](function(_0x1f6e20){_0x37b361[_0x5572('0x46')]=_0x1f6e20;return _0x37b361;})[_0x5572('0x24')](respondWithFilteredResult(_0x3fde60,_0x2126b8))['catch'](handleError(_0x3fde60,null));};exports[_0x5572('0x47')]=function(_0x23d29d,_0x5a2862){var _0x4f9564={'raw':![],'where':{'id':_0x23d29d[_0x5572('0x48')]['id']}},_0x168fc9={};_0x168fc9[_0x5572('0x30')]=_[_0x5572('0x33')](db['AnalyticFieldReport'][_0x5572('0x2d')]);_0x168fc9[_0x5572('0x32')]=_[_0x5572('0x33')](_0x23d29d[_0x5572('0x32')]);_0x168fc9[_0x5572('0x3c')]=_[_0x5572('0x34')](_0x168fc9[_0x5572('0x30')],_0x168fc9[_0x5572('0x32')]);_0x4f9564[_0x5572('0x35')]=_['intersection'](_0x168fc9[_0x5572('0x30')],qs['fields'](_0x23d29d[_0x5572('0x32')]['fields']));_0x4f9564[_0x5572('0x35')]=_0x4f9564[_0x5572('0x35')]['length']?_0x4f9564[_0x5572('0x35')]:_0x168fc9[_0x5572('0x30')];if(_0x23d29d[_0x5572('0x32')][_0x5572('0x43')]){_0x4f9564[_0x5572('0x44')]=[{'all':!![]}];}_0x4f9564=_[_0x5572('0x41')]({},_0x4f9564,_0x23d29d['options']);return db[_0x5572('0x2c')]['find'](_0x4f9564)[_0x5572('0x24')](handleEntityNotFound(_0x5a2862,null))[_0x5572('0x24')](respondWithResult(_0x5a2862,null))['catch'](handleError(_0x5a2862,null));};exports['create']=function(_0x38b459,_0x4eff2e){return db[_0x5572('0x2c')][_0x5572('0x49')](_0x38b459[_0x5572('0x4a')],{})[_0x5572('0x24')](respondWithResult(_0x4eff2e,0xc9))['catch'](handleError(_0x4eff2e,null));};exports[_0x5572('0x4b')]=function(_0x491265,_0x59b9ce){return db[_0x5572('0x2c')][_0x5572('0x4b')](_0x491265[_0x5572('0x4a')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x59b9ce,0xc9))[_0x5572('0x4c')](handleError(_0x59b9ce,null));};exports[_0x5572('0x4d')]=function(_0x3d8f49,_0x265389){if(_0x3d8f49['body']['id']){delete _0x3d8f49['body']['id'];}return db['AnalyticFieldReport'][_0x5572('0x4e')]({'where':{'id':_0x3d8f49['params']['id']}})[_0x5572('0x24')](handleEntityNotFound(_0x265389,null))['then'](saveUpdates(_0x3d8f49[_0x5572('0x4a')],null))[_0x5572('0x24')](respondWithResult(_0x265389,null))[_0x5572('0x4c')](handleError(_0x265389,null));};exports['destroy']=function(_0x417a61,_0x4a72c3){return db['AnalyticFieldReport'][_0x5572('0x4e')]({'where':{'id':_0x417a61['params']['id']}})[_0x5572('0x24')](handleEntityNotFound(_0x4a72c3,null))['then'](removeEntity(_0x4a72c3,null))[_0x5572('0x4c')](handleError(_0x4a72c3,null));};exports[_0x5572('0x4f')]=function(_0x1b80d9,_0xa16eb4){return db[_0x5572('0x2c')][_0x5572('0x25')]({'where':{'id':_0x1b80d9[_0x5572('0x32')][_0x5572('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x5572('0x24')](respondWithResult(_0xa16eb4,0xcc))[_0x5572('0x4c')](handleError(_0xa16eb4,null));};exports[_0x5572('0x51')]=function(_0x5144b6,_0x17dab7,_0x24531f){return db[_0x5572('0x52')][_0x5572('0x53')]({'where':{'id':_0x5144b6[_0x5572('0x48')]['id']}})[_0x5572('0x24')](handleEntityNotFound(_0x17dab7,null))[_0x5572('0x24')](function(_0x3283ee){if(_0x3283ee){return db['sequelize']['transaction'](function(_0xe690f){return db[_0x5572('0x2c')][_0x5572('0x25')]({'where':{'CustomReportId':_0x5144b6[_0x5572('0x48')]['id']},'transaction':_0xe690f})[_0x5572('0x24')](function(_0x3a63ad){var _0x36f139=_['map'](_0x5144b6[_0x5572('0x4a')],function(_0x5c2bb8){delete _0x5c2bb8['id'];_0x5c2bb8['CustomReportId']=_0x5144b6[_0x5572('0x48')]['id'];return _0x5c2bb8;});return db[_0x5572('0x2c')][_0x5572('0x4b')](_0x36f139,{'transaction':_0xe690f});});})['then'](function(){return db['AnalyticFieldReport'][_0x5572('0x45')]({'where':{'CustomReportId':_0x5144b6[_0x5572('0x48')]['id']}});});}})['then'](respondWithResult(_0x17dab7,null))[_0x5572('0x4c')](handleError(_0x17dab7,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b2e22de..a63b084 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 _0x26a3=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x10bc60,_0x589add){var _0x5de17c=function(_0x20d769){while(--_0x20d769){_0x10bc60['push'](_0x10bc60['shift']());}};_0x5de17c(++_0x589add);}(_0x26a3,0x171));var _0x326a=function(_0x51aaaa,_0x3f44c1){_0x51aaaa=_0x51aaaa-0x0;var _0x2e21ab=_0x26a3[_0x51aaaa];return _0x2e21ab;};'use strict';var _=require(_0x326a('0x0'));var util=require('util');var logger=require(_0x326a('0x1'))(_0x326a('0x2'));var moment=require(_0x326a('0x3'));var BPromise=require(_0x326a('0x4'));var rp=require(_0x326a('0x5'));var fs=require('fs');var path=require(_0x326a('0x6'));var rimraf=require(_0x326a('0x7'));var config=require(_0x326a('0x8'));var attributes=require(_0x326a('0x9'));module[_0x326a('0xa')]=function(_0xb833ec,_0x5c29f9){return _0xb833ec[_0x326a('0xb')](_0x326a('0xc'),attributes,{'tableName':_0x326a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb823=['rimraf','../../config/environment','exports','analytics_report_fields','lodash','bluebird','request-promise','path'];(function(_0x253b14,_0x267f87){var _0x5b4ad3=function(_0x4744f3){while(--_0x4744f3){_0x253b14['push'](_0x253b14['shift']());}};_0x5b4ad3(++_0x267f87);}(_0xb823,0x1a4));var _0x3b82=function(_0x533381,_0x8a69fa){_0x533381=_0x533381-0x0;var _0x2877ed=_0xb823[_0x533381];return _0x2877ed;};'use strict';var _=require(_0x3b82('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3b82('0x1'));var rp=require(_0x3b82('0x2'));var fs=require('fs');var path=require(_0x3b82('0x3'));var rimraf=require(_0x3b82('0x4'));var config=require(_0x3b82('0x5'));var attributes=require('./analyticFieldReport.attributes');module[_0x3b82('0x6')]=function(_0x143615,_0x6b0586){return _0x143615['define']('AnalyticFieldReport',attributes,{'tableName':_0x3b82('0x7'),'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 658f203..ba997e0 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 _0x282d=['message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x573508,_0x1f6d7b){var _0x440e39=function(_0x3442fb){while(--_0x3442fb){_0x573508['push'](_0x573508['shift']());}};_0x440e39(++_0x1f6d7b);}(_0x282d,0x191));var _0xd282=function(_0x5b3028,_0x446c66){_0x5b3028=_0x5b3028-0x0;var _0x309076=_0x282d[_0x5b3028];return _0x309076;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd282('0x0'));var BPromise=require(_0xd282('0x1'));var rs=require(_0xd282('0x2'));var fs=require('fs');var Redis=require(_0xd282('0x3'));var db=require(_0xd282('0x4'))['db'];var utils=require(_0xd282('0x5'));var logger=require(_0xd282('0x6'))('rpc');var config=require(_0xd282('0x7'));var jayson=require(_0xd282('0x8'));var client=jayson['client'][_0xd282('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x460e84,_0xaae95c,_0xca16a4){return new BPromise(function(_0x141a43,_0x160bfd){return client[_0xd282('0xa')](_0x460e84,_0xca16a4)[_0xd282('0xb')](function(_0x1a861e){logger[_0xd282('0xc')](_0xd282('0xd'),_0xaae95c,_0xd282('0xe'));logger[_0xd282('0xf')](_0xd282('0x10'),_0xaae95c,_0xd282('0xe'),JSON[_0xd282('0x11')](_0x1a861e));if(_0x1a861e[_0xd282('0x12')]){if(_0x1a861e[_0xd282('0x12')]['code']===0x1f4){logger[_0xd282('0x12')](_0xd282('0xd'),_0xaae95c,_0x1a861e[_0xd282('0x12')][_0xd282('0x13')]);return _0x160bfd(_0x1a861e[_0xd282('0x12')]['message']);}logger[_0xd282('0x12')](_0xd282('0xd'),_0xaae95c,_0x1a861e[_0xd282('0x12')][_0xd282('0x13')]);return _0x141a43(_0x1a861e[_0xd282('0x12')][_0xd282('0x13')]);}else{logger[_0xd282('0xc')](_0xd282('0xd'),_0xaae95c,_0xd282('0xe'));_0x141a43(_0x1a861e['result'][_0xd282('0x13')]);}})[_0xd282('0x14')](function(_0x1f7a20){logger[_0xd282('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0xaae95c,_0x1f7a20);_0x160bfd(_0x1f7a20);});});} \ No newline at end of file +var _0x70a7=['rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x561576,_0x301a97){var _0xe58e06=function(_0x188a65){while(--_0x188a65){_0x561576['push'](_0x561576['shift']());}};_0xe58e06(++_0x301a97);}(_0x70a7,0x67));var _0x770a=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x70a7[_0x31a938];return _0x1bf341;};'use strict';var _=require('lodash');var util=require(_0x770a('0x0'));var moment=require(_0x770a('0x1'));var BPromise=require(_0x770a('0x2'));var rs=require(_0x770a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x770a('0x4'))['db'];var utils=require(_0x770a('0x5'));var logger=require(_0x770a('0x6'))(_0x770a('0x7'));var config=require(_0x770a('0x8'));var jayson=require(_0x770a('0x9'));var client=jayson[_0x770a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16a3ff,_0x4a73da,_0x38a907){return new BPromise(function(_0x5f311e,_0x20329f){return client[_0x770a('0xb')](_0x16a3ff,_0x38a907)[_0x770a('0xc')](function(_0x26b769){logger[_0x770a('0xd')](_0x770a('0xe'),_0x4a73da,'request\x20sent');logger['debug'](_0x770a('0xf'),_0x4a73da,_0x770a('0x10'),JSON[_0x770a('0x11')](_0x26b769));if(_0x26b769[_0x770a('0x12')]){if(_0x26b769[_0x770a('0x12')]['code']===0x1f4){logger[_0x770a('0x12')](_0x770a('0xe'),_0x4a73da,_0x26b769[_0x770a('0x12')][_0x770a('0x13')]);return _0x20329f(_0x26b769[_0x770a('0x12')][_0x770a('0x13')]);}logger[_0x770a('0x12')](_0x770a('0xe'),_0x4a73da,_0x26b769[_0x770a('0x12')]['message']);return _0x5f311e(_0x26b769[_0x770a('0x12')]['message']);}else{logger['info'](_0x770a('0xe'),_0x4a73da,_0x770a('0x10'));_0x5f311e(_0x26b769[_0x770a('0x14')][_0x770a('0x13')]);}})[_0x770a('0x15')](function(_0x51c744){logger[_0x770a('0x12')](_0x770a('0xe'),_0x4a73da,_0x51c744);_0x20329f(_0x51c744);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d8b8aec..3a5e768 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(_0xeef9e1,_0xb4c1ee){var _0xadd459=function(_0x50868e){while(--_0x50868e){_0xeef9e1['push'](_0xeef9e1['shift']());}};_0xadd459(++_0xb4c1ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x9bf10c,_0xcc7e3a){var _0x53f63d=function(_0x40350a){while(--_0x40350a){_0x9bf10c['push'](_0x9bf10c['shift']());}};_0x53f63d(++_0xcc7e3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 fa60a85..664dfac 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 _0x76d2=['sequelize','exports','STRING','TEXT'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x76d2,0xf8));var _0x276d=function(_0x4e220c,_0x13756b){_0x4e220c=_0x4e220c-0x0;var _0x4166bf=_0x76d2[_0x4e220c];return _0x4166bf;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'name':{'type':Sequelize[_0x276d('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x276d('0x2')]},'metric':{'type':Sequelize[_0x276d('0x3')]},'description':{'type':Sequelize[_0x276d('0x2')]}}; \ No newline at end of file +var _0x4746=['name','TEXT','STRING','sequelize','exports'];(function(_0x23ca3a,_0xe44c43){var _0x5c1aab=function(_0x29bcdd){while(--_0x29bcdd){_0x23ca3a['push'](_0x23ca3a['shift']());}};_0x5c1aab(++_0xe44c43);}(_0x4746,0xc6));var _0x6474=function(_0x4511f0,_0x365662){_0x4511f0=_0x4511f0-0x0;var _0x5b71ef=_0x4746[_0x4511f0];return _0x5b71ef;};'use strict';var Sequelize=require(_0x6474('0x0'));module[_0x6474('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6474('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x6474('0x3')]},'description':{'type':Sequelize[_0x6474('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index d23fa21..728237d 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x84ab,0x12f));var _0xb84a=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x84ab[_0x13ff53];return _0x290228;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x233d5f,_0x58c7b7){var _0x2cfd78=function(_0xa8860d){while(--_0xa8860d){_0x233d5f['push'](_0x233d5f['shift']());}};_0x2cfd78(++_0x58c7b7);}(_0x9a19,0x114));var _0x99a1=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x9a19[_0x1e9424];return _0x1bd96c;};'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'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index a60299b..99a6308 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 _0x5078=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x5078,0x148));var _0x8507=function(_0x275e50,_0x1d52b8){_0x275e50=_0x275e50-0x0;var _0x1b1ab0=_0x5078[_0x275e50];return _0x1b1ab0;};'use strict';var _=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var logger=require(_0x8507('0x2'))(_0x8507('0x3'));var moment=require(_0x8507('0x4'));var BPromise=require(_0x8507('0x5'));var rp=require(_0x8507('0x6'));var fs=require('fs');var path=require(_0x8507('0x7'));var rimraf=require(_0x8507('0x8'));var config=require(_0x8507('0x9'));var attributes=require(_0x8507('0xa'));module[_0x8507('0xb')]=function(_0x37519c,_0x5a359c){return _0x37519c[_0x8507('0xc')](_0x8507('0xd'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4f=['lodash','../../config/logger','moment','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x5e2f89,_0x7b2df8){var _0x30ebe6=function(_0xfc58c1){while(--_0xfc58c1){_0x5e2f89['push'](_0x5e2f89['shift']());}};_0x30ebe6(++_0x7b2df8);}(_0xac4f,0x122));var _0xfac4=function(_0x56dbbd,_0x53a898){_0x56dbbd=_0x56dbbd-0x0;var _0x26012c=_0xac4f[_0x56dbbd];return _0x26012c;};'use strict';var _=require(_0xfac4('0x0'));var util=require('util');var logger=require(_0xfac4('0x1'))('api');var moment=require(_0xfac4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfac4('0x3'));var rimraf=require(_0xfac4('0x4'));var config=require('../../config/environment');var attributes=require(_0xfac4('0x5'));module[_0xfac4('0x6')]=function(_0x1aae1c,_0x48f014){return _0x1aae1c[_0xfac4('0x7')](_0xfac4('0x8'),attributes,{'tableName':_0xfac4('0x9'),'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 e9aa7b4..c7667b6 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 _0x6ec9=['code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x1fd934,_0x4b6112){var _0x4ea0fb=function(_0x1f1c59){while(--_0x1f1c59){_0x1fd934['push'](_0x1fd934['shift']());}};_0x4ea0fb(++_0x4b6112);}(_0x6ec9,0x17b));var _0x96ec=function(_0x1d649a,_0x5ecbeb){_0x1d649a=_0x1d649a-0x0;var _0x1c8642=_0x6ec9[_0x1d649a];return _0x1c8642;};'use strict';var _=require(_0x96ec('0x0'));var util=require(_0x96ec('0x1'));var moment=require(_0x96ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x96ec('0x3'));var fs=require('fs');var Redis=require(_0x96ec('0x4'));var db=require(_0x96ec('0x5'))['db'];var utils=require(_0x96ec('0x6'));var logger=require(_0x96ec('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x96ec('0x8'));var client=jayson[_0x96ec('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43525f,_0x289f2c,_0x5b2d56){return new BPromise(function(_0x2e9103,_0x2e041f){return client[_0x96ec('0xa')](_0x43525f,_0x5b2d56)[_0x96ec('0xb')](function(_0xeac19f){logger[_0x96ec('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x289f2c,_0x96ec('0xd'));logger[_0x96ec('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x289f2c,_0x96ec('0xd'),JSON[_0x96ec('0xf')](_0xeac19f));if(_0xeac19f[_0x96ec('0x10')]){if(_0xeac19f[_0x96ec('0x10')][_0x96ec('0x11')]===0x1f4){logger[_0x96ec('0x10')](_0x96ec('0x12'),_0x289f2c,_0xeac19f[_0x96ec('0x10')][_0x96ec('0x13')]);return _0x2e041f(_0xeac19f[_0x96ec('0x10')]['message']);}logger['error'](_0x96ec('0x12'),_0x289f2c,_0xeac19f['error']['message']);return _0x2e9103(_0xeac19f[_0x96ec('0x10')]['message']);}else{logger[_0x96ec('0xc')](_0x96ec('0x12'),_0x289f2c,_0x96ec('0xd'));_0x2e9103(_0xeac19f[_0x96ec('0x14')][_0x96ec('0x13')]);}})[_0x96ec('0x15')](function(_0x3eed58){logger[_0x96ec('0x10')](_0x96ec('0x12'),_0x289f2c,_0x3eed58);_0x2e041f(_0x3eed58);});});} \ No newline at end of file +var _0x22e4=['debug','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','client','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0xafdaf4,_0x5bd4d1){var _0x1e70a8=function(_0x33bd10){while(--_0x33bd10){_0xafdaf4['push'](_0xafdaf4['shift']());}};_0x1e70a8(++_0x5bd4d1);}(_0x22e4,0x116));var _0x422e=function(_0x23f006,_0x22a905){_0x23f006=_0x23f006-0x0;var _0x3f9da6=_0x22e4[_0x23f006];return _0x3f9da6;};'use strict';var _=require(_0x422e('0x0'));var util=require(_0x422e('0x1'));var moment=require(_0x422e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x422e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x422e('0x4'))(_0x422e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x422e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d57be,_0x5cf854,_0xa18ba7){return new BPromise(function(_0x4c9bc4,_0xaddb3c){return client[_0x422e('0x7')](_0x4d57be,_0xa18ba7)[_0x422e('0x8')](function(_0x19e11d){logger[_0x422e('0x9')](_0x422e('0xa'),_0x5cf854,'request\x20sent');logger[_0x422e('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5cf854,'request\x20sent',JSON['stringify'](_0x19e11d));if(_0x19e11d[_0x422e('0xc')]){if(_0x19e11d['error'][_0x422e('0xd')]===0x1f4){logger[_0x422e('0xc')](_0x422e('0xa'),_0x5cf854,_0x19e11d['error'][_0x422e('0xe')]);return _0xaddb3c(_0x19e11d[_0x422e('0xc')][_0x422e('0xe')]);}logger[_0x422e('0xc')](_0x422e('0xa'),_0x5cf854,_0x19e11d[_0x422e('0xc')][_0x422e('0xe')]);return _0x4c9bc4(_0x19e11d[_0x422e('0xc')][_0x422e('0xe')]);}else{logger[_0x422e('0x9')](_0x422e('0xa'),_0x5cf854,'request\x20sent');_0x4c9bc4(_0x19e11d[_0x422e('0xf')][_0x422e('0xe')]);}})[_0x422e('0x10')](function(_0x811e2a){logger[_0x422e('0xc')](_0x422e('0xa'),_0x5cf854,_0x811e2a);_0xaddb3c(_0x811e2a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d903d0a..01944ce 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 _0x9a14=['get','/:id','isAuthenticated','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x399dbd,_0x3bb9bf){var _0xcad897=function(_0x69cc77){while(--_0x69cc77){_0x399dbd['push'](_0x399dbd['shift']());}};_0xcad897(++_0x3bb9bf);}(_0x9a14,0xa8));var _0x49a1=function(_0x1bb465,_0x39d473){_0x1bb465=_0x1bb465-0x0;var _0x5201a1=_0x9a14[_0x1bb465];return _0x5201a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49a1('0x0'));var timeout=require(_0x49a1('0x1'));var express=require(_0x49a1('0x2'));var router=express[_0x49a1('0x3')]();var fs_extra=require(_0x49a1('0x4'));var auth=require(_0x49a1('0x5'));var interaction=require(_0x49a1('0x6'));var config=require(_0x49a1('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x49a1('0x8')](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller['show']);router[_0x49a1('0xb')]('/',auth[_0x49a1('0xa')](),controller[_0x49a1('0xc')]);router['put'](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller['update']);router[_0x49a1('0xd')](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller[_0x49a1('0xe')]);module[_0x49a1('0xf')]=router; \ No newline at end of file +var _0x39d9=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x57d40d,_0x3eaa66){var _0x28f92a=function(_0x5bd704){while(--_0x5bd704){_0x57d40d['push'](_0x57d40d['shift']());}};_0x28f92a(++_0x3eaa66);}(_0x39d9,0x17f));var _0x939d=function(_0x447bba,_0x322692){_0x447bba=_0x447bba-0x0;var _0x30ff09=_0x39d9[_0x447bba];return _0x30ff09;};'use strict';var multer=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var path=require(_0x939d('0x2'));var timeout=require(_0x939d('0x3'));var express=require(_0x939d('0x4'));var router=express[_0x939d('0x5')]();var fs_extra=require(_0x939d('0x6'));var auth=require(_0x939d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x939d('0x8'));var controller=require(_0x939d('0x9'));router[_0x939d('0xa')]('/',auth['isAuthenticated'](),controller[_0x939d('0xb')]);router['get'](_0x939d('0xc'),auth[_0x939d('0xd')](),controller[_0x939d('0xe')]);router[_0x939d('0xf')]('/',auth[_0x939d('0xd')](),controller[_0x939d('0x10')]);router[_0x939d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x939d('0x12')]);router[_0x939d('0x13')](_0x939d('0xc'),auth[_0x939d('0xd')](),controller[_0x939d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cd625f8..1ae2e58 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 _0x1581=['sequelize','exports'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x1581,0x118));var _0x1158=function(_0x5cd7d4,_0x1e4937){_0x5cd7d4=_0x5cd7d4-0x0;var _0x133fea=_0x1581[_0x5cd7d4];return _0x133fea;};'use strict';var Sequelize=require(_0x1158('0x0'));module[_0x1158('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x5f05=['TEXT','exports'];(function(_0x1dea0d,_0x25de3f){var _0x11f547=function(_0x25bfcf){while(--_0x25bfcf){_0x1dea0d['push'](_0x1dea0d['shift']());}};_0x11f547(++_0x25de3f);}(_0x5f05,0x125));var _0x55f0=function(_0x3b5c6e,_0x3e8584){_0x3b5c6e=_0x3b5c6e-0x0;var _0x220846=_0x5f05[_0x3b5c6e];return _0x220846;};'use strict';var Sequelize=require('sequelize');module[_0x55f0('0x0')]={'tree':{'type':Sequelize[_0x55f0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 24629a5..fd4e6be 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 _0x2576=['findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','error','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x462b76,_0x50c1dd){var _0x52f60d=function(_0x476bc8){while(--_0x476bc8){_0x462b76['push'](_0x462b76['shift']());}};_0x52f60d(++_0x50c1dd);}(_0x2576,0x171));var _0x6257=function(_0x48a010,_0x20f883){_0x48a010=_0x48a010-0x0;var _0xf78b79=_0x2576[_0x48a010];return _0xf78b79;};'use strict';var emlformat=require(_0x6257('0x0'));var rimraf=require(_0x6257('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6257('0x2'));var rp=require(_0x6257('0x3'));var moment=require(_0x6257('0x4'));var BPromise=require(_0x6257('0x5'));var Mustache=require(_0x6257('0x6'));var util=require('util');var path=require(_0x6257('0x7'));var sox=require('sox');var csv=require(_0x6257('0x8'));var ejs=require(_0x6257('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6257('0xa'));var squel=require(_0x6257('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6257('0xc'));var toCsv=require(_0x6257('0x8'));var querystring=require(_0x6257('0xd'));var Papa=require(_0x6257('0xe'));var Redis=require(_0x6257('0xf'));var authService=require(_0x6257('0x10'));var qs=require(_0x6257('0x11'));var as=require(_0x6257('0x12'));var hardwareService=require(_0x6257('0x13'));var logger=require(_0x6257('0x14'))(_0x6257('0x15'));var utils=require('../../config/utils');var config=require(_0x6257('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6257('0x17'))['db'];function respondWithStatusCode(_0x5ce000,_0x239867){_0x239867=_0x239867||0xcc;return function(_0x259032){if(_0x259032){return _0x5ce000[_0x6257('0x18')](_0x239867);}return _0x5ce000[_0x6257('0x19')](_0x239867)['end']();};}function respondWithResult(_0x15f44a,_0x110f7f){_0x110f7f=_0x110f7f||0xc8;return function(_0x24c2c5){if(_0x24c2c5){return _0x15f44a[_0x6257('0x19')](_0x110f7f)[_0x6257('0x1a')](_0x24c2c5);}};}function respondWithFilteredResult(_0x43ceb0,_0x3c9605){return function(_0x204d81){if(_0x204d81){var _0xa72c04=typeof _0x3c9605[_0x6257('0x1b')]==='undefined'&&typeof _0x3c9605[_0x6257('0x1c')]===_0x6257('0x1d');var _0x480615=_0x204d81['count'];var _0x301ead=_0xa72c04?0x0:_0x3c9605[_0x6257('0x1b')];var _0x26aaab=_0xa72c04?_0x204d81[_0x6257('0x1e')]:_0x3c9605[_0x6257('0x1b')]+_0x3c9605[_0x6257('0x1c')];var _0x28fd41;if(_0x26aaab>=_0x480615){_0x26aaab=_0x480615;_0x28fd41=0xc8;}else{_0x28fd41=0xce;}_0x43ceb0[_0x6257('0x19')](_0x28fd41);return _0x43ceb0[_0x6257('0x1f')](_0x6257('0x20'),_0x301ead+'-'+_0x26aaab+'/'+_0x480615)[_0x6257('0x1a')](_0x204d81);}return null;};}function patchUpdates(_0x4241e9){return function(_0x111f54){try{jsonpatch[_0x6257('0x21')](_0x111f54,_0x4241e9,!![]);}catch(_0x12c6ba){return BPromise[_0x6257('0x22')](_0x12c6ba);}return _0x111f54['save']();};}function saveUpdates(_0x39200c,_0x4fa450){return function(_0x27b5de){if(_0x27b5de){return _0x27b5de[_0x6257('0x23')](_0x39200c)[_0x6257('0x24')](function(_0x44a247){return _0x44a247;});}return null;};}function removeEntity(_0x51641d,_0x507efd){return function(_0x1ae170){if(_0x1ae170){return _0x1ae170['destroy']()['then'](function(){_0x51641d[_0x6257('0x19')](0xcc)[_0x6257('0x25')]();});}};}function handleEntityNotFound(_0x3d21ea,_0x4875e4){return function(_0x31b531){if(!_0x31b531){_0x3d21ea[_0x6257('0x18')](0x194);}return _0x31b531;};}function handleError(_0x1ac9d4,_0x51f289){_0x51f289=_0x51f289||0x1f4;return function(_0x5b1c9b){logger[_0x6257('0x26')](_0x5b1c9b['stack']);if(_0x5b1c9b[_0x6257('0x27')]){delete _0x5b1c9b[_0x6257('0x27')];}_0x1ac9d4[_0x6257('0x19')](_0x51f289)[_0x6257('0x28')](_0x5b1c9b);};}exports['index']=function(_0x2e2788,_0x39457a){var _0x4e0e1e={},_0x92975d={},_0x57a19a={'count':0x0,'rows':[]};var _0x5ac5d8=_[_0x6257('0x29')](db[_0x6257('0x2a')][_0x6257('0x2b')],function(_0x274c6c){return{'name':_0x274c6c[_0x6257('0x2c')],'type':_0x274c6c[_0x6257('0x2d')][_0x6257('0x2e')]};});_0x92975d[_0x6257('0x2f')]=_['map'](_0x5ac5d8,_0x6257('0x27'));_0x92975d[_0x6257('0x30')]=_[_0x6257('0x31')](_0x2e2788[_0x6257('0x30')]);_0x92975d[_0x6257('0x32')]=_['intersection'](_0x92975d[_0x6257('0x2f')],_0x92975d[_0x6257('0x30')]);_0x4e0e1e[_0x6257('0x33')]=_[_0x6257('0x34')](_0x92975d[_0x6257('0x2f')],qs['fields'](_0x2e2788['query'][_0x6257('0x35')]));_0x4e0e1e[_0x6257('0x33')]=_0x4e0e1e[_0x6257('0x33')]['length']?_0x4e0e1e['attributes']:_0x92975d[_0x6257('0x2f')];if(!_0x2e2788[_0x6257('0x30')]['hasOwnProperty']('nolimit')){_0x4e0e1e[_0x6257('0x1c')]=qs['limit'](_0x2e2788['query'][_0x6257('0x1c')]);_0x4e0e1e[_0x6257('0x1b')]=qs[_0x6257('0x1b')](_0x2e2788['query'][_0x6257('0x1b')]);}_0x4e0e1e['order']=qs[_0x6257('0x36')](_0x2e2788[_0x6257('0x30')]['sort']);_0x4e0e1e[_0x6257('0x37')]=qs['filters'](_[_0x6257('0x38')](_0x2e2788[_0x6257('0x30')],_0x92975d[_0x6257('0x32')]),_0x5ac5d8);if(_0x2e2788[_0x6257('0x30')]['filter']){_0x4e0e1e[_0x6257('0x37')]=_[_0x6257('0x39')](_0x4e0e1e[_0x6257('0x37')],{'$or':_[_0x6257('0x29')](_0x5ac5d8,function(_0xfaa7ac){if(_0xfaa7ac[_0x6257('0x2d')]!==_0x6257('0x3a')){var _0x38a114={};_0x38a114[_0xfaa7ac[_0x6257('0x27')]]={'$like':'%'+_0x2e2788[_0x6257('0x30')][_0x6257('0x3b')]+'%'};return _0x38a114;}})});}_0x4e0e1e=_['merge']({},_0x4e0e1e,_0x2e2788[_0x6257('0x3c')]);var _0x181a58={'where':_0x4e0e1e[_0x6257('0x37')]};return db[_0x6257('0x2a')][_0x6257('0x1e')](_0x181a58)[_0x6257('0x24')](function(_0x297b59){_0x57a19a[_0x6257('0x1e')]=_0x297b59;if(_0x2e2788[_0x6257('0x30')][_0x6257('0x3d')]){_0x4e0e1e[_0x6257('0x3e')]=[{'all':!![]}];}return db[_0x6257('0x2a')][_0x6257('0x3f')](_0x4e0e1e);})[_0x6257('0x24')](function(_0xb47984){_0x57a19a[_0x6257('0x40')]=_0xb47984;return _0x57a19a;})['then'](respondWithFilteredResult(_0x39457a,_0x4e0e1e))[_0x6257('0x41')](handleError(_0x39457a,null));};exports[_0x6257('0x42')]=function(_0x2cd909,_0x5efa82){var _0x4334d0={'raw':!![],'where':{'id':_0x2cd909['params']['id']}},_0x5e1acf={};_0x5e1acf['model']=_[_0x6257('0x31')](db[_0x6257('0x2a')][_0x6257('0x2b')]);_0x5e1acf['query']=_[_0x6257('0x31')](_0x2cd909['query']);_0x5e1acf[_0x6257('0x32')]=_[_0x6257('0x34')](_0x5e1acf['model'],_0x5e1acf[_0x6257('0x30')]);_0x4334d0['attributes']=_[_0x6257('0x34')](_0x5e1acf[_0x6257('0x2f')],qs['fields'](_0x2cd909[_0x6257('0x30')][_0x6257('0x35')]));_0x4334d0['attributes']=_0x4334d0[_0x6257('0x33')][_0x6257('0x43')]?_0x4334d0['attributes']:_0x5e1acf[_0x6257('0x2f')];if(_0x2cd909[_0x6257('0x30')][_0x6257('0x3d')]){_0x4334d0[_0x6257('0x3e')]=[{'all':!![]}];}_0x4334d0=_[_0x6257('0x39')]({},_0x4334d0,_0x2cd909[_0x6257('0x3c')]);return db[_0x6257('0x2a')][_0x6257('0x44')](_0x4334d0)['then'](handleEntityNotFound(_0x5efa82,null))[_0x6257('0x24')](respondWithResult(_0x5efa82,null))['catch'](handleError(_0x5efa82,null));};exports['create']=function(_0x52ea7d,_0x263bdc){return db[_0x6257('0x2a')][_0x6257('0x45')](_0x52ea7d[_0x6257('0x46')],{})[_0x6257('0x24')](respondWithResult(_0x263bdc,0xc9))[_0x6257('0x41')](handleError(_0x263bdc,null));};exports[_0x6257('0x23')]=function(_0x565d16,_0x2cf573){if(_0x565d16[_0x6257('0x46')]['id']){delete _0x565d16[_0x6257('0x46')]['id'];}return db[_0x6257('0x2a')][_0x6257('0x44')]({'where':{'id':_0x565d16[_0x6257('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cf573,null))[_0x6257('0x24')](saveUpdates(_0x565d16[_0x6257('0x46')],null))['then'](respondWithResult(_0x2cf573,null))[_0x6257('0x41')](handleError(_0x2cf573,null));};exports['destroy']=function(_0x4bbdac,_0x333ce6){return db[_0x6257('0x2a')][_0x6257('0x44')]({'where':{'id':_0x4bbdac[_0x6257('0x47')]['id']}})['then'](handleEntityNotFound(_0x333ce6,null))[_0x6257('0x24')](removeEntity(_0x333ce6,null))[_0x6257('0x41')](handleError(_0x333ce6,null));}; \ No newline at end of file +var _0x34d3=['map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','filters','filter','merge','where','VIRTUAL','options','include','findAll','show','params','includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send'];(function(_0x2ed92f,_0x54091f){var _0x26ff04=function(_0x5ed317){while(--_0x5ed317){_0x2ed92f['push'](_0x2ed92f['shift']());}};_0x26ff04(++_0x54091f);}(_0x34d3,0x187));var _0x334d=function(_0x27c4c4,_0x1a8f3c){_0x27c4c4=_0x27c4c4-0x0;var _0x363415=_0x34d3[_0x27c4c4];return _0x363415;};'use strict';var emlformat=require(_0x334d('0x0'));var rimraf=require(_0x334d('0x1'));var zipdir=require(_0x334d('0x2'));var jsonpatch=require(_0x334d('0x3'));var rp=require(_0x334d('0x4'));var moment=require('moment');var BPromise=require(_0x334d('0x5'));var Mustache=require(_0x334d('0x6'));var util=require(_0x334d('0x7'));var path=require(_0x334d('0x8'));var sox=require(_0x334d('0x9'));var csv=require('to-csv');var ejs=require(_0x334d('0xa'));var fs=require('fs');var fs_extra=require(_0x334d('0xb'));var _=require(_0x334d('0xc'));var squel=require(_0x334d('0xd'));var crypto=require(_0x334d('0xe'));var jsforce=require(_0x334d('0xf'));var deskjs=require(_0x334d('0x10'));var toCsv=require(_0x334d('0x11'));var querystring=require('querystring');var Papa=require(_0x334d('0x12'));var Redis=require('ioredis');var authService=require(_0x334d('0x13'));var qs=require(_0x334d('0x14'));var as=require(_0x334d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x334d('0x16'));var licenseUtil=require(_0x334d('0x17'));var db=require(_0x334d('0x18'))['db'];function respondWithStatusCode(_0x40f89e,_0x146762){_0x146762=_0x146762||0xcc;return function(_0xdc76ea){if(_0xdc76ea){return _0x40f89e[_0x334d('0x19')](_0x146762);}return _0x40f89e[_0x334d('0x1a')](_0x146762)[_0x334d('0x1b')]();};}function respondWithResult(_0xb2235,_0x2537d4){_0x2537d4=_0x2537d4||0xc8;return function(_0x42d57f){if(_0x42d57f){return _0xb2235['status'](_0x2537d4)['json'](_0x42d57f);}};}function respondWithFilteredResult(_0x5d51c0,_0x4e55f9){return function(_0x53e415){if(_0x53e415){var _0x10ddd0=typeof _0x4e55f9[_0x334d('0x1c')]===_0x334d('0x1d')&&typeof _0x4e55f9[_0x334d('0x1e')]===_0x334d('0x1d');var _0x6522eb=_0x53e415[_0x334d('0x1f')];var _0x46ba88=_0x10ddd0?0x0:_0x4e55f9[_0x334d('0x1c')];var _0x24ff7f=_0x10ddd0?_0x53e415[_0x334d('0x1f')]:_0x4e55f9[_0x334d('0x1c')]+_0x4e55f9[_0x334d('0x1e')];var _0x2bdfd0;if(_0x24ff7f>=_0x6522eb){_0x24ff7f=_0x6522eb;_0x2bdfd0=0xc8;}else{_0x2bdfd0=0xce;}_0x5d51c0[_0x334d('0x1a')](_0x2bdfd0);return _0x5d51c0[_0x334d('0x20')](_0x334d('0x21'),_0x46ba88+'-'+_0x24ff7f+'/'+_0x6522eb)['json'](_0x53e415);}return null;};}function patchUpdates(_0x154ac9){return function(_0x509053){try{jsonpatch[_0x334d('0x22')](_0x509053,_0x154ac9,!![]);}catch(_0x2ed27a){return BPromise[_0x334d('0x23')](_0x2ed27a);}return _0x509053[_0x334d('0x24')]();};}function saveUpdates(_0x509def,_0x4503d8){return function(_0x54bbd0){if(_0x54bbd0){return _0x54bbd0[_0x334d('0x25')](_0x509def)[_0x334d('0x26')](function(_0x3b688c){return _0x3b688c;});}return null;};}function removeEntity(_0x5b0e2e,_0x30b93a){return function(_0x42c08c){if(_0x42c08c){return _0x42c08c['destroy']()['then'](function(){_0x5b0e2e[_0x334d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x405ff7,_0x7fd827){return function(_0x3f1b3b){if(!_0x3f1b3b){_0x405ff7[_0x334d('0x19')](0x194);}return _0x3f1b3b;};}function handleError(_0x4be150,_0x5329f4){_0x5329f4=_0x5329f4||0x1f4;return function(_0x22e6ad){logger['error'](_0x22e6ad['stack']);if(_0x22e6ad[_0x334d('0x27')]){delete _0x22e6ad[_0x334d('0x27')];}_0x4be150['status'](_0x5329f4)[_0x334d('0x28')](_0x22e6ad);};}exports['index']=function(_0x270452,_0x5989e6){var _0x4dda4d={},_0x35f29e={},_0x2fb6eb={'count':0x0,'rows':[]};var _0x4d79f9=_[_0x334d('0x29')](db[_0x334d('0x2a')][_0x334d('0x2b')],function(_0xc40808){return{'name':_0xc40808[_0x334d('0x2c')],'type':_0xc40808[_0x334d('0x2d')][_0x334d('0x2e')]};});_0x35f29e['model']=_[_0x334d('0x29')](_0x4d79f9,'name');_0x35f29e[_0x334d('0x2f')]=_[_0x334d('0x30')](_0x270452[_0x334d('0x2f')]);_0x35f29e['filters']=_['intersection'](_0x35f29e[_0x334d('0x31')],_0x35f29e['query']);_0x4dda4d[_0x334d('0x32')]=_[_0x334d('0x33')](_0x35f29e[_0x334d('0x31')],qs[_0x334d('0x34')](_0x270452[_0x334d('0x2f')][_0x334d('0x34')]));_0x4dda4d['attributes']=_0x4dda4d[_0x334d('0x32')]['length']?_0x4dda4d[_0x334d('0x32')]:_0x35f29e['model'];if(!_0x270452[_0x334d('0x2f')][_0x334d('0x35')](_0x334d('0x36'))){_0x4dda4d[_0x334d('0x1e')]=qs[_0x334d('0x1e')](_0x270452[_0x334d('0x2f')]['limit']);_0x4dda4d[_0x334d('0x1c')]=qs[_0x334d('0x1c')](_0x270452[_0x334d('0x2f')][_0x334d('0x1c')]);}_0x4dda4d[_0x334d('0x37')]=qs['sort'](_0x270452[_0x334d('0x2f')]['sort']);_0x4dda4d['where']=qs[_0x334d('0x38')](_['pick'](_0x270452['query'],_0x35f29e['filters']),_0x4d79f9);if(_0x270452[_0x334d('0x2f')][_0x334d('0x39')]){_0x4dda4d['where']=_[_0x334d('0x3a')](_0x4dda4d[_0x334d('0x3b')],{'$or':_[_0x334d('0x29')](_0x4d79f9,function(_0xedb308){if(_0xedb308[_0x334d('0x2d')]!==_0x334d('0x3c')){var _0x15f16e={};_0x15f16e[_0xedb308[_0x334d('0x27')]]={'$like':'%'+_0x270452['query']['filter']+'%'};return _0x15f16e;}})});}_0x4dda4d=_[_0x334d('0x3a')]({},_0x4dda4d,_0x270452[_0x334d('0x3d')]);var _0x48c292={'where':_0x4dda4d['where']};return db[_0x334d('0x2a')][_0x334d('0x1f')](_0x48c292)[_0x334d('0x26')](function(_0x10d3f3){_0x2fb6eb[_0x334d('0x1f')]=_0x10d3f3;if(_0x270452[_0x334d('0x2f')]['includeAll']){_0x4dda4d[_0x334d('0x3e')]=[{'all':!![]}];}return db[_0x334d('0x2a')][_0x334d('0x3f')](_0x4dda4d);})['then'](function(_0x4d3c4f){_0x2fb6eb['rows']=_0x4d3c4f;return _0x2fb6eb;})[_0x334d('0x26')](respondWithFilteredResult(_0x5989e6,_0x4dda4d))['catch'](handleError(_0x5989e6,null));};exports[_0x334d('0x40')]=function(_0x544ce9,_0x4a3c8b){var _0x3cf9c1={'raw':!![],'where':{'id':_0x544ce9[_0x334d('0x41')]['id']}},_0x344d22={};_0x344d22['model']=_[_0x334d('0x30')](db[_0x334d('0x2a')]['rawAttributes']);_0x344d22[_0x334d('0x2f')]=_[_0x334d('0x30')](_0x544ce9['query']);_0x344d22['filters']=_[_0x334d('0x33')](_0x344d22[_0x334d('0x31')],_0x344d22['query']);_0x3cf9c1[_0x334d('0x32')]=_[_0x334d('0x33')](_0x344d22[_0x334d('0x31')],qs[_0x334d('0x34')](_0x544ce9['query'][_0x334d('0x34')]));_0x3cf9c1['attributes']=_0x3cf9c1[_0x334d('0x32')]['length']?_0x3cf9c1[_0x334d('0x32')]:_0x344d22[_0x334d('0x31')];if(_0x544ce9[_0x334d('0x2f')][_0x334d('0x42')]){_0x3cf9c1[_0x334d('0x3e')]=[{'all':!![]}];}_0x3cf9c1=_[_0x334d('0x3a')]({},_0x3cf9c1,_0x544ce9[_0x334d('0x3d')]);return db[_0x334d('0x2a')][_0x334d('0x43')](_0x3cf9c1)[_0x334d('0x26')](handleEntityNotFound(_0x4a3c8b,null))[_0x334d('0x26')](respondWithResult(_0x4a3c8b,null))[_0x334d('0x44')](handleError(_0x4a3c8b,null));};exports['create']=function(_0x2098ac,_0x2af8a9){return db[_0x334d('0x2a')][_0x334d('0x45')](_0x2098ac[_0x334d('0x46')],{})['then'](respondWithResult(_0x2af8a9,0xc9))[_0x334d('0x44')](handleError(_0x2af8a9,null));};exports['update']=function(_0x37be5e,_0x86859b){if(_0x37be5e[_0x334d('0x46')]['id']){delete _0x37be5e['body']['id'];}return db[_0x334d('0x2a')][_0x334d('0x43')]({'where':{'id':_0x37be5e[_0x334d('0x41')]['id']}})['then'](handleEntityNotFound(_0x86859b,null))['then'](saveUpdates(_0x37be5e['body'],null))[_0x334d('0x26')](respondWithResult(_0x86859b,null))[_0x334d('0x44')](handleError(_0x86859b,null));};exports[_0x334d('0x47')]=function(_0x4788a7,_0x10310e){return db[_0x334d('0x2a')][_0x334d('0x43')]({'where':{'id':_0x4788a7[_0x334d('0x41')]['id']}})[_0x334d('0x26')](handleEntityNotFound(_0x10310e,null))['then'](removeEntity(_0x10310e,null))[_0x334d('0x44')](handleError(_0x10310e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 31c4e31..2d8ea4f 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 _0xbbe8=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f3e42,_0x43128b){var _0x45c9d5=function(_0x39ccb9){while(--_0x39ccb9){_0x3f3e42['push'](_0x3f3e42['shift']());}};_0x45c9d5(++_0x43128b);}(_0xbbe8,0x158));var _0x8bbe=function(_0x338491,_0x25f9f9){_0x338491=_0x338491-0x0;var _0x4bf6fc=_0xbbe8[_0x338491];return _0x4bf6fc;};'use strict';var _=require(_0x8bbe('0x0'));var util=require(_0x8bbe('0x1'));var logger=require(_0x8bbe('0x2'))(_0x8bbe('0x3'));var moment=require(_0x8bbe('0x4'));var BPromise=require(_0x8bbe('0x5'));var rp=require(_0x8bbe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bbe('0x7'));var config=require(_0x8bbe('0x8'));var attributes=require(_0x8bbe('0x9'));module[_0x8bbe('0xa')]=function(_0x2475bb,_0x5c2ba0){return _0x2475bb[_0x8bbe('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x8bbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b2a=['path','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x5d05fc,_0x2dc690){var _0x363c83=function(_0x35cd67){while(--_0x35cd67){_0x5d05fc['push'](_0x5d05fc['shift']());}};_0x363c83(++_0x2dc690);}(_0x5b2a,0xec));var _0xa5b2=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x5b2a[_0x540dcb];return _0x49353c;};'use strict';var _=require(_0xa5b2('0x0'));var util=require(_0xa5b2('0x1'));var logger=require(_0xa5b2('0x2'))(_0xa5b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5b2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5b2('0x5'));module[_0xa5b2('0x6')]=function(_0x52a1bf,_0x59c593){return _0x52a1bf[_0xa5b2('0x7')](_0xa5b2('0x8'),attributes,{'tableName':_0xa5b2('0x9'),'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 f2e9c33..91c70e2 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5aa8a4,_0x1910eb){var _0x3fb749=function(_0x1f440d){while(--_0x1f440d){_0x5aa8a4['push'](_0x5aa8a4['shift']());}};_0x3fb749(++_0x1910eb);}(_0x1261,0x144));var _0x1126=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0x1261[_0x451735];return _0x41d1e2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _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(_0x312606,_0x4214d5){var _0x3b0859=function(_0x4c5774){while(--_0x4c5774){_0x312606['push'](_0x312606['shift']());}};_0x3b0859(++_0x4214d5);}(_0xdb28,0x106));var _0x8db2=function(_0x14664b,_0x5e3d4b){_0x14664b=_0x14664b-0x0;var _0x4dd935=_0xdb28[_0x14664b];return _0x4dd935;};'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 bdd2418..5590478 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 _0x6a45=['show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated'];(function(_0x483ccd,_0x47ea21){var _0x7fd74c=function(_0x3693ed){while(--_0x3693ed){_0x483ccd['push'](_0x483ccd['shift']());}};_0x7fd74c(++_0x47ea21);}(_0x6a45,0xe8));var _0x56a4=function(_0x3aeb0e,_0x3f6d34){_0x3aeb0e=_0x3aeb0e-0x0;var _0x2e0032=_0x6a45[_0x3aeb0e];return _0x2e0032;};'use strict';var multer=require(_0x56a4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x56a4('0x1'));var express=require(_0x56a4('0x2'));var router=express['Router']();var fs_extra=require(_0x56a4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x56a4('0x4'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x56a4('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x56a4('0x6'),auth[_0x56a4('0x7')](),controller[_0x56a4('0x8')]);router[_0x56a4('0x9')]('/',auth[_0x56a4('0x7')](),controller[_0x56a4('0xa')]);router['put']('/:id',auth[_0x56a4('0x7')](),controller[_0x56a4('0xb')]);router[_0x56a4('0xc')](_0x56a4('0x6'),auth['isAuthenticated'](),controller[_0x56a4('0xd')]);module[_0x56a4('0xe')]=router; \ No newline at end of file +var _0x559c=['../../config/environment','./analyticTreeReport.controller','get','index','/:id','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x559c,0x98));var _0xc559=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x559c[_0x2c0be1];return _0x3d4bd2;};'use strict';var multer=require(_0xc559('0x0'));var util=require(_0xc559('0x1'));var path=require('path');var timeout=require(_0xc559('0x2'));var express=require(_0xc559('0x3'));var router=express[_0xc559('0x4')]();var fs_extra=require(_0xc559('0x5'));var auth=require(_0xc559('0x6'));var interaction=require(_0xc559('0x7'));var config=require(_0xc559('0x8'));var controller=require(_0xc559('0x9'));router[_0xc559('0xa')]('/',auth['isAuthenticated'](),controller[_0xc559('0xb')]);router[_0xc559('0xa')](_0xc559('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc559('0xd')]('/',auth[_0xc559('0xe')](),controller['create']);router[_0xc559('0xf')](_0xc559('0xc'),auth[_0xc559('0xe')](),controller[_0xc559('0x10')]);router[_0xc559('0x11')](_0xc559('0xc'),auth[_0xc559('0xe')](),controller[_0xc559('0x12')]);module[_0xc559('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9a4ac4d..53233f1 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 _0xbc17=['STRING','sequelize','exports'];(function(_0x1246ba,_0x314721){var _0x4a6dfb=function(_0x4030d1){while(--_0x4030d1){_0x1246ba['push'](_0x1246ba['shift']());}};_0x4a6dfb(++_0x314721);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x181c12,_0x42241d){_0x181c12=_0x181c12-0x0;var _0x219ffd=_0xbc17[_0x181c12];return _0x219ffd;};'use strict';var Sequelize=require(_0x7bc1('0x0'));module[_0x7bc1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x7bc1('0x2')]},'type':{'type':Sequelize[_0x7bc1('0x2')]}}; \ No newline at end of file +var _0x1df5=['STRING','sequelize','exports'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x1df5,0xfd));var _0x51df=function(_0x403acb,_0x54cb18){_0x403acb=_0x403acb-0x0;var _0x13f39e=_0x1df5[_0x403acb];return _0x13f39e;};'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 diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 63bed9f..21b9ad5 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 _0x980e=['rows','show','params','keys','includeAll','find','clone','merge','get','omit','updatedAt','body','createdAt','create','catch','update','basename','filename','file','mimetype','findOne','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll'];(function(_0x24afd2,_0x3c22a8){var _0x383a35=function(_0x3f4a54){while(--_0x3f4a54){_0x24afd2['push'](_0x24afd2['shift']());}};_0x383a35(++_0x3c22a8);}(_0x980e,0x73));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe980('0x0'));var rimraf=require(_0xe980('0x1'));var zipdir=require(_0xe980('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe980('0x3'));var moment=require(_0xe980('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe980('0x5'));var util=require(_0xe980('0x6'));var path=require(_0xe980('0x7'));var sox=require(_0xe980('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe980('0x9'));var squel=require(_0xe980('0xa'));var crypto=require(_0xe980('0xb'));var jsforce=require(_0xe980('0xc'));var deskjs=require(_0xe980('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe980('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe980('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe980('0x10'));var hardwareService=require(_0xe980('0x11'));var logger=require(_0xe980('0x12'))(_0xe980('0x13'));var utils=require(_0xe980('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe980('0x15'))['db'];function respondWithStatusCode(_0x2a21bf,_0x11468b){_0x11468b=_0x11468b||0xcc;return function(_0x45017c){if(_0x45017c){return _0x2a21bf[_0xe980('0x16')](_0x11468b);}return _0x2a21bf[_0xe980('0x17')](_0x11468b)[_0xe980('0x18')]();};}function respondWithResult(_0x342a57,_0x267332){_0x267332=_0x267332||0xc8;return function(_0x2f3e76){if(_0x2f3e76){return _0x342a57[_0xe980('0x17')](_0x267332)['json'](_0x2f3e76);}};}function respondWithFilteredResult(_0x25644f,_0x173268){return function(_0x31be0e){if(_0x31be0e){var _0x9952e8=typeof _0x173268[_0xe980('0x19')]===_0xe980('0x1a')&&typeof _0x173268[_0xe980('0x1b')]===_0xe980('0x1a');var _0x3d6453=_0x31be0e[_0xe980('0x1c')];var _0x241405=_0x9952e8?0x0:_0x173268[_0xe980('0x19')];var _0x2c25ef=_0x9952e8?_0x31be0e[_0xe980('0x1c')]:_0x173268[_0xe980('0x19')]+_0x173268[_0xe980('0x1b')];var _0x2b8769;if(_0x2c25ef>=_0x3d6453){_0x2c25ef=_0x3d6453;_0x2b8769=0xc8;}else{_0x2b8769=0xce;}_0x25644f[_0xe980('0x17')](_0x2b8769);return _0x25644f[_0xe980('0x1d')](_0xe980('0x1e'),_0x241405+'-'+_0x2c25ef+'/'+_0x3d6453)[_0xe980('0x1f')](_0x31be0e);}return null;};}function patchUpdates(_0x5e401c){return function(_0x4bd82c){try{jsonpatch[_0xe980('0x20')](_0x4bd82c,_0x5e401c,!![]);}catch(_0x37c428){return BPromise['reject'](_0x37c428);}return _0x4bd82c[_0xe980('0x21')]();};}function saveUpdates(_0x34a936,_0x1b3497){return function(_0x3dcd4d){if(_0x3dcd4d){return _0x3dcd4d['update'](_0x34a936)[_0xe980('0x22')](function(_0x1fc3a8){return _0x1fc3a8;});}return null;};}function removeEntity(_0x359e47,_0x28d50c){return function(_0x25e734){if(_0x25e734){return _0x25e734[_0xe980('0x23')]()[_0xe980('0x22')](function(){_0x359e47['status'](0xcc)[_0xe980('0x18')]();});}};}function handleEntityNotFound(_0x473c63,_0x176a1d){return function(_0x1f451e){if(!_0x1f451e){_0x473c63[_0xe980('0x16')](0x194);}return _0x1f451e;};}function handleError(_0x3bf66d,_0x11c5e6){_0x11c5e6=_0x11c5e6||0x1f4;return function(_0x57f1d4){logger[_0xe980('0x24')](_0x57f1d4[_0xe980('0x25')]);if(_0x57f1d4[_0xe980('0x26')]){delete _0x57f1d4[_0xe980('0x26')];}_0x3bf66d[_0xe980('0x17')](_0x11c5e6)['send'](_0x57f1d4);};}exports['index']=function(_0x2121eb,_0x314875){var _0x503005={},_0x493bcf={},_0x4c7fe4={'count':0x0,'rows':[]};var _0x5d63ec=_[_0xe980('0x27')](db[_0xe980('0x28')][_0xe980('0x29')],function(_0x161888){return{'name':_0x161888[_0xe980('0x2a')],'type':_0x161888[_0xe980('0x2b')][_0xe980('0x2c')]};});_0x493bcf[_0xe980('0x2d')]=_['map'](_0x5d63ec,_0xe980('0x26'));_0x493bcf['query']=_['keys'](_0x2121eb[_0xe980('0x2e')]);_0x493bcf[_0xe980('0x2f')]=_[_0xe980('0x30')](_0x493bcf[_0xe980('0x2d')],_0x493bcf[_0xe980('0x2e')]);_0x503005['attributes']=_[_0xe980('0x30')](_0x493bcf['model'],qs[_0xe980('0x31')](_0x2121eb['query']['fields']));_0x503005[_0xe980('0x32')]=_0x503005['attributes'][_0xe980('0x33')]?_0x503005[_0xe980('0x32')]:_0x493bcf['model'];if(!_0x2121eb['query'][_0xe980('0x34')](_0xe980('0x35'))){_0x503005[_0xe980('0x1b')]=qs['limit'](_0x2121eb[_0xe980('0x2e')][_0xe980('0x1b')]);_0x503005[_0xe980('0x19')]=qs[_0xe980('0x19')](_0x2121eb[_0xe980('0x2e')][_0xe980('0x19')]);}_0x503005[_0xe980('0x36')]=qs[_0xe980('0x37')](_0x2121eb[_0xe980('0x2e')]['sort']);_0x503005[_0xe980('0x38')]=qs[_0xe980('0x2f')](_[_0xe980('0x39')](_0x2121eb[_0xe980('0x2e')],_0x493bcf[_0xe980('0x2f')]),_0x5d63ec);if(_0x2121eb[_0xe980('0x2e')][_0xe980('0x3a')]){_0x503005[_0xe980('0x38')]=_['merge'](_0x503005[_0xe980('0x38')],{'$or':_[_0xe980('0x27')](_0x5d63ec,function(_0x54dcda){if(_0x54dcda[_0xe980('0x2b')]!==_0xe980('0x3b')){var _0x918653={};_0x918653[_0x54dcda[_0xe980('0x26')]]={'$like':'%'+_0x2121eb[_0xe980('0x2e')][_0xe980('0x3a')]+'%'};return _0x918653;}})});}_0x503005=_['merge']({},_0x503005,_0x2121eb[_0xe980('0x3c')]);var _0x31d178={'where':_0x503005[_0xe980('0x38')]};return db['Attachment']['count'](_0x31d178)[_0xe980('0x22')](function(_0x1d210e){_0x4c7fe4['count']=_0x1d210e;if(_0x2121eb[_0xe980('0x2e')]['includeAll']){_0x503005[_0xe980('0x3d')]=[{'all':!![]}];}return db[_0xe980('0x28')][_0xe980('0x3e')](_0x503005);})[_0xe980('0x22')](function(_0x214551){_0x4c7fe4[_0xe980('0x3f')]=_0x214551;return _0x4c7fe4;})[_0xe980('0x22')](respondWithFilteredResult(_0x314875,_0x503005))['catch'](handleError(_0x314875,null));};exports[_0xe980('0x40')]=function(_0x387bfd,_0x4ab47f){var _0x3d2631={'raw':!![],'where':{'id':_0x387bfd[_0xe980('0x41')]['id']}},_0x29e6e8={};_0x29e6e8['model']=_[_0xe980('0x42')](db['Attachment'][_0xe980('0x29')]);_0x29e6e8[_0xe980('0x2e')]=_[_0xe980('0x42')](_0x387bfd[_0xe980('0x2e')]);_0x29e6e8[_0xe980('0x2f')]=_[_0xe980('0x30')](_0x29e6e8[_0xe980('0x2d')],_0x29e6e8[_0xe980('0x2e')]);_0x3d2631[_0xe980('0x32')]=_[_0xe980('0x30')](_0x29e6e8[_0xe980('0x2d')],qs[_0xe980('0x31')](_0x387bfd[_0xe980('0x2e')]['fields']));_0x3d2631[_0xe980('0x32')]=_0x3d2631[_0xe980('0x32')][_0xe980('0x33')]?_0x3d2631[_0xe980('0x32')]:_0x29e6e8[_0xe980('0x2d')];if(_0x387bfd[_0xe980('0x2e')][_0xe980('0x43')]){_0x3d2631[_0xe980('0x3d')]=[{'all':!![]}];}_0x3d2631=_['merge']({},_0x3d2631,_0x387bfd[_0xe980('0x3c')]);return db[_0xe980('0x28')][_0xe980('0x44')](_0x3d2631)[_0xe980('0x22')](handleEntityNotFound(_0x4ab47f,null))[_0xe980('0x22')](respondWithResult(_0x4ab47f,null))['catch'](handleError(_0x4ab47f,null));};exports[_0xe980('0x45')]=function(_0x475fbc,_0x1cae80){var _0x3a0144={'where':{'id':_0x475fbc[_0xe980('0x41')]['id']}},_0x507437={};_0x507437[_0xe980('0x2d')]=_['keys'](db['Attachment'][_0xe980('0x29')]);_0x3a0144['attributes']=_[_0xe980('0x30')](_0x507437['model'],qs[_0xe980('0x31')](_0x475fbc[_0xe980('0x2e')][_0xe980('0x31')]));_0x3a0144[_0xe980('0x32')]=_0x3a0144[_0xe980('0x32')][_0xe980('0x33')]?_0x3a0144[_0xe980('0x32')]:_0x507437[_0xe980('0x2d')];if(_0x475fbc['query'][_0xe980('0x43')]){_0x3a0144[_0xe980('0x3d')]=[{'all':!![]}];}_0x3a0144=_[_0xe980('0x46')]({},_0x3a0144,_0x475fbc[_0xe980('0x3c')]);return db[_0xe980('0x28')][_0xe980('0x44')](_0x3a0144)[_0xe980('0x22')](handleEntityNotFound(_0x1cae80,null))[_0xe980('0x22')](function(_0x45d7ab){if(_0x45d7ab){var _0x2203e1=_0x45d7ab[_0xe980('0x47')]({'plain':!![]});_0x2203e1=qs[_0xe980('0x48')](_0x2203e1,['id','createdAt',_0xe980('0x49')]);_0x475fbc[_0xe980('0x4a')]=_[_0xe980('0x48')](_0x475fbc[_0xe980('0x4a')],['id',_0xe980('0x4b'),_0xe980('0x49')]);return db[_0xe980('0x28')][_0xe980('0x4c')](_[_0xe980('0x46')](_0x2203e1,_0x475fbc[_0xe980('0x4a')]),{'include':_0x475fbc['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xe980('0x22')](respondWithResult(_0x1cae80,0xc9))[_0xe980('0x4d')](handleError(_0x1cae80,null));};exports[_0xe980('0x4e')]=function(_0x26bfe3,_0xa91b7f){if(_0x26bfe3[_0xe980('0x4a')]['id']){delete _0x26bfe3[_0xe980('0x4a')]['id'];}return db[_0xe980('0x28')][_0xe980('0x44')]({'where':{'id':_0x26bfe3[_0xe980('0x41')]['id']}})[_0xe980('0x22')](handleEntityNotFound(_0xa91b7f,null))['then'](saveUpdates(_0x26bfe3['body'],null))[_0xe980('0x22')](respondWithResult(_0xa91b7f,null))['catch'](handleError(_0xa91b7f,null));};exports[_0xe980('0x23')]=function(_0x217422,_0x3f954d){return db[_0xe980('0x28')][_0xe980('0x44')]({'where':{'id':_0x217422[_0xe980('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f954d,null))[_0xe980('0x22')](removeEntity(_0x3f954d,null))[_0xe980('0x4d')](handleError(_0x3f954d,null));};exports[_0xe980('0x4c')]=function(_0x54ccb2,_0x55bd1f,_0x2d101){_0x54ccb2[_0xe980('0x4a')][_0xe980('0x26')]=_0x54ccb2['file']['originalname'];_0x54ccb2[_0xe980('0x4a')][_0xe980('0x4f')]=_0x54ccb2['file'][_0xe980('0x50')];_0x54ccb2[_0xe980('0x4a')]['type']=_0x54ccb2[_0xe980('0x51')][_0xe980('0x52')];return db['Attachment'][_0xe980('0x4c')](_0x54ccb2[_0xe980('0x4a')])[_0xe980('0x22')](respondWithResult(_0x55bd1f,0xc9))[_0xe980('0x4d')](handleError(_0x55bd1f,null));};exports['download']=function(_0x205cd8,_0x2d997c,_0x2ab341){return db[_0xe980('0x28')][_0xe980('0x53')]({'where':{'id':_0x205cd8[_0xe980('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2d997c,null))[_0xe980('0x22')](function(_0x494a0e){if(_0x494a0e){var _0x23991c=_0x494a0e[_0xe980('0x54')]!==null;var _0x1456c7=path['join'](config['root'],_0xe980('0x55'));if(_0x23991c){_0x1456c7=path[_0xe980('0x56')](_0x1456c7,_0xe980('0x57'));}var _0x10a2c7=path['join'](_0x1456c7,_0x494a0e['basename']);return _0x2d997c[_0xe980('0x58')](_0x10a2c7);}})[_0xe980('0x4d')](handleError(_0x2d997c,null));}; \ No newline at end of file +var _0x072e=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','find','clone','params','get','omit','updatedAt','body','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','root','join','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x132903,_0x20700f){var _0x48d4b1=function(_0x54d260){while(--_0x54d260){_0x132903['push'](_0x132903['shift']());}};_0x48d4b1(++_0x20700f);}(_0x072e,0xfb));var _0xe072=function(_0x4f6972,_0x15953b){_0x4f6972=_0x4f6972-0x0;var _0xdd3d18=_0x072e[_0x4f6972];return _0xdd3d18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe072('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe072('0x1'));var rp=require(_0xe072('0x2'));var moment=require(_0xe072('0x3'));var BPromise=require(_0xe072('0x4'));var Mustache=require(_0xe072('0x5'));var util=require('util');var path=require(_0xe072('0x6'));var sox=require(_0xe072('0x7'));var csv=require(_0xe072('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe072('0x9'));var _=require(_0xe072('0xa'));var squel=require('squel');var crypto=require(_0xe072('0xb'));var jsforce=require(_0xe072('0xc'));var deskjs=require(_0xe072('0xd'));var toCsv=require(_0xe072('0x8'));var querystring=require(_0xe072('0xe'));var Papa=require(_0xe072('0xf'));var Redis=require(_0xe072('0x10'));var authService=require(_0xe072('0x11'));var qs=require(_0xe072('0x12'));var as=require(_0xe072('0x13'));var hardwareService=require(_0xe072('0x14'));var logger=require('../../config/logger')(_0xe072('0x15'));var utils=require(_0xe072('0x16'));var config=require(_0xe072('0x17'));var licenseUtil=require(_0xe072('0x18'));var db=require(_0xe072('0x19'))['db'];function respondWithStatusCode(_0x3aa9bf,_0x1e4239){_0x1e4239=_0x1e4239||0xcc;return function(_0x769da5){if(_0x769da5){return _0x3aa9bf[_0xe072('0x1a')](_0x1e4239);}return _0x3aa9bf[_0xe072('0x1b')](_0x1e4239)[_0xe072('0x1c')]();};}function respondWithResult(_0x132134,_0x21539f){_0x21539f=_0x21539f||0xc8;return function(_0x52eacb){if(_0x52eacb){return _0x132134[_0xe072('0x1b')](_0x21539f)[_0xe072('0x1d')](_0x52eacb);}};}function respondWithFilteredResult(_0x3fa6fc,_0x14eb84){return function(_0x214650){if(_0x214650){var _0x3c77ab=typeof _0x14eb84[_0xe072('0x1e')]===_0xe072('0x1f')&&typeof _0x14eb84[_0xe072('0x20')]===_0xe072('0x1f');var _0xb522=_0x214650[_0xe072('0x21')];var _0x4c6d2b=_0x3c77ab?0x0:_0x14eb84[_0xe072('0x1e')];var _0x2f696a=_0x3c77ab?_0x214650['count']:_0x14eb84[_0xe072('0x1e')]+_0x14eb84[_0xe072('0x20')];var _0x26c939;if(_0x2f696a>=_0xb522){_0x2f696a=_0xb522;_0x26c939=0xc8;}else{_0x26c939=0xce;}_0x3fa6fc['status'](_0x26c939);return _0x3fa6fc['set']('Content-Range',_0x4c6d2b+'-'+_0x2f696a+'/'+_0xb522)[_0xe072('0x1d')](_0x214650);}return null;};}function patchUpdates(_0x4ed925){return function(_0x428dcb){try{jsonpatch['apply'](_0x428dcb,_0x4ed925,!![]);}catch(_0x44b9f8){return BPromise[_0xe072('0x22')](_0x44b9f8);}return _0x428dcb[_0xe072('0x23')]();};}function saveUpdates(_0x207221,_0x45d2c7){return function(_0x54fcbc){if(_0x54fcbc){return _0x54fcbc[_0xe072('0x24')](_0x207221)['then'](function(_0x16b8a3){return _0x16b8a3;});}return null;};}function removeEntity(_0x5b5385,_0x5d5ee9){return function(_0x31915e){if(_0x31915e){return _0x31915e[_0xe072('0x25')]()[_0xe072('0x26')](function(){_0x5b5385[_0xe072('0x1b')](0xcc)[_0xe072('0x1c')]();});}};}function handleEntityNotFound(_0x42ff74,_0x1619fe){return function(_0x415942){if(!_0x415942){_0x42ff74[_0xe072('0x1a')](0x194);}return _0x415942;};}function handleError(_0x21a5c0,_0x1ed6be){_0x1ed6be=_0x1ed6be||0x1f4;return function(_0x545227){logger[_0xe072('0x27')](_0x545227[_0xe072('0x28')]);if(_0x545227[_0xe072('0x29')]){delete _0x545227[_0xe072('0x29')];}_0x21a5c0[_0xe072('0x1b')](_0x1ed6be)[_0xe072('0x2a')](_0x545227);};}exports[_0xe072('0x2b')]=function(_0x22a24c,_0x4f8b37){var _0x179d4d={},_0x1d3754={},_0x5ef4c6={'count':0x0,'rows':[]};var _0x2958cb=_[_0xe072('0x2c')](db[_0xe072('0x2d')][_0xe072('0x2e')],function(_0x3994c9){return{'name':_0x3994c9[_0xe072('0x2f')],'type':_0x3994c9[_0xe072('0x30')][_0xe072('0x31')]};});_0x1d3754[_0xe072('0x32')]=_[_0xe072('0x2c')](_0x2958cb,_0xe072('0x29'));_0x1d3754[_0xe072('0x33')]=_[_0xe072('0x34')](_0x22a24c[_0xe072('0x33')]);_0x1d3754[_0xe072('0x35')]=_['intersection'](_0x1d3754[_0xe072('0x32')],_0x1d3754[_0xe072('0x33')]);_0x179d4d[_0xe072('0x36')]=_['intersection'](_0x1d3754[_0xe072('0x32')],qs[_0xe072('0x37')](_0x22a24c['query'][_0xe072('0x37')]));_0x179d4d[_0xe072('0x36')]=_0x179d4d[_0xe072('0x36')][_0xe072('0x38')]?_0x179d4d['attributes']:_0x1d3754[_0xe072('0x32')];if(!_0x22a24c[_0xe072('0x33')][_0xe072('0x39')](_0xe072('0x3a'))){_0x179d4d[_0xe072('0x20')]=qs[_0xe072('0x20')](_0x22a24c['query'][_0xe072('0x20')]);_0x179d4d['offset']=qs['offset'](_0x22a24c['query'][_0xe072('0x1e')]);}_0x179d4d[_0xe072('0x3b')]=qs['sort'](_0x22a24c[_0xe072('0x33')]['sort']);_0x179d4d[_0xe072('0x3c')]=qs[_0xe072('0x35')](_['pick'](_0x22a24c[_0xe072('0x33')],_0x1d3754[_0xe072('0x35')]),_0x2958cb);if(_0x22a24c['query'][_0xe072('0x3d')]){_0x179d4d['where']=_[_0xe072('0x3e')](_0x179d4d[_0xe072('0x3c')],{'$or':_[_0xe072('0x2c')](_0x2958cb,function(_0x3d3864){if(_0x3d3864[_0xe072('0x30')]!==_0xe072('0x3f')){var _0x1aab56={};_0x1aab56[_0x3d3864['name']]={'$like':'%'+_0x22a24c[_0xe072('0x33')][_0xe072('0x3d')]+'%'};return _0x1aab56;}})});}_0x179d4d=_['merge']({},_0x179d4d,_0x22a24c[_0xe072('0x40')]);var _0x20b8f9={'where':_0x179d4d[_0xe072('0x3c')]};return db['Attachment'][_0xe072('0x21')](_0x20b8f9)[_0xe072('0x26')](function(_0x27cea4){_0x5ef4c6['count']=_0x27cea4;if(_0x22a24c[_0xe072('0x33')][_0xe072('0x41')]){_0x179d4d[_0xe072('0x42')]=[{'all':!![]}];}return db[_0xe072('0x2d')]['findAll'](_0x179d4d);})['then'](function(_0x521fd2){_0x5ef4c6[_0xe072('0x43')]=_0x521fd2;return _0x5ef4c6;})[_0xe072('0x26')](respondWithFilteredResult(_0x4f8b37,_0x179d4d))[_0xe072('0x44')](handleError(_0x4f8b37,null));};exports[_0xe072('0x45')]=function(_0x109a12,_0x4b6263){var _0x4a7571={'raw':!![],'where':{'id':_0x109a12['params']['id']}},_0x19c86f={};_0x19c86f[_0xe072('0x32')]=_[_0xe072('0x34')](db['Attachment'][_0xe072('0x2e')]);_0x19c86f[_0xe072('0x33')]=_[_0xe072('0x34')](_0x109a12[_0xe072('0x33')]);_0x19c86f[_0xe072('0x35')]=_[_0xe072('0x46')](_0x19c86f[_0xe072('0x32')],_0x19c86f['query']);_0x4a7571['attributes']=_[_0xe072('0x46')](_0x19c86f['model'],qs['fields'](_0x109a12[_0xe072('0x33')][_0xe072('0x37')]));_0x4a7571[_0xe072('0x36')]=_0x4a7571[_0xe072('0x36')]['length']?_0x4a7571[_0xe072('0x36')]:_0x19c86f['model'];if(_0x109a12[_0xe072('0x33')][_0xe072('0x41')]){_0x4a7571[_0xe072('0x42')]=[{'all':!![]}];}_0x4a7571=_['merge']({},_0x4a7571,_0x109a12[_0xe072('0x40')]);return db[_0xe072('0x2d')][_0xe072('0x47')](_0x4a7571)[_0xe072('0x26')](handleEntityNotFound(_0x4b6263,null))[_0xe072('0x26')](respondWithResult(_0x4b6263,null))['catch'](handleError(_0x4b6263,null));};exports[_0xe072('0x48')]=function(_0x3347a0,_0x43e0cc){var _0x160027={'where':{'id':_0x3347a0[_0xe072('0x49')]['id']}},_0x21e6c3={};_0x21e6c3[_0xe072('0x32')]=_['keys'](db[_0xe072('0x2d')][_0xe072('0x2e')]);_0x160027[_0xe072('0x36')]=_[_0xe072('0x46')](_0x21e6c3[_0xe072('0x32')],qs[_0xe072('0x37')](_0x3347a0[_0xe072('0x33')][_0xe072('0x37')]));_0x160027['attributes']=_0x160027['attributes'][_0xe072('0x38')]?_0x160027[_0xe072('0x36')]:_0x21e6c3['model'];if(_0x3347a0[_0xe072('0x33')][_0xe072('0x41')]){_0x160027[_0xe072('0x42')]=[{'all':!![]}];}_0x160027=_['merge']({},_0x160027,_0x3347a0[_0xe072('0x40')]);return db[_0xe072('0x2d')][_0xe072('0x47')](_0x160027)[_0xe072('0x26')](handleEntityNotFound(_0x43e0cc,null))['then'](function(_0x18a58a){if(_0x18a58a){var _0x3034ed=_0x18a58a[_0xe072('0x4a')]({'plain':!![]});_0x3034ed=qs[_0xe072('0x4b')](_0x3034ed,['id','createdAt',_0xe072('0x4c')]);_0x3347a0['body']=_[_0xe072('0x4b')](_0x3347a0[_0xe072('0x4d')],['id','createdAt',_0xe072('0x4c')]);return db['Attachment']['create'](_[_0xe072('0x3e')](_0x3034ed,_0x3347a0[_0xe072('0x4d')]),{'include':_0x3347a0[_0xe072('0x33')][_0xe072('0x41')]?[{'all':!![]}]:undefined});}})[_0xe072('0x26')](respondWithResult(_0x43e0cc,0xc9))[_0xe072('0x44')](handleError(_0x43e0cc,null));};exports[_0xe072('0x24')]=function(_0x7e0b4f,_0x1463c5){if(_0x7e0b4f['body']['id']){delete _0x7e0b4f[_0xe072('0x4d')]['id'];}return db['Attachment']['find']({'where':{'id':_0x7e0b4f[_0xe072('0x49')]['id']}})[_0xe072('0x26')](handleEntityNotFound(_0x1463c5,null))[_0xe072('0x26')](saveUpdates(_0x7e0b4f['body'],null))[_0xe072('0x26')](respondWithResult(_0x1463c5,null))[_0xe072('0x44')](handleError(_0x1463c5,null));};exports[_0xe072('0x25')]=function(_0x452828,_0x1b5027){return db['Attachment'][_0xe072('0x47')]({'where':{'id':_0x452828[_0xe072('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b5027,null))['then'](removeEntity(_0x1b5027,null))[_0xe072('0x44')](handleError(_0x1b5027,null));};exports[_0xe072('0x4e')]=function(_0x4c5d12,_0x172dfb,_0x500737){_0x4c5d12[_0xe072('0x4d')][_0xe072('0x29')]=_0x4c5d12[_0xe072('0x4f')][_0xe072('0x50')];_0x4c5d12['body'][_0xe072('0x51')]=_0x4c5d12['file']['filename'];_0x4c5d12[_0xe072('0x4d')][_0xe072('0x30')]=_0x4c5d12[_0xe072('0x4f')][_0xe072('0x52')];return db[_0xe072('0x2d')][_0xe072('0x4e')](_0x4c5d12['body'])[_0xe072('0x26')](respondWithResult(_0x172dfb,0xc9))['catch'](handleError(_0x172dfb,null));};exports[_0xe072('0x53')]=function(_0x1fed35,_0xb3ca0a,_0x3e1df2){return db[_0xe072('0x2d')][_0xe072('0x54')]({'where':{'id':_0x1fed35[_0xe072('0x49')]['id']},'raw':!![]})[_0xe072('0x26')](handleEntityNotFound(_0xb3ca0a,null))['then'](function(_0x50081a){if(_0x50081a){var _0x52f35f=_0x50081a[_0xe072('0x55')]!==null;var _0x55e7d5=path['join'](config[_0xe072('0x56')],'server/files/attachments/');if(_0x52f35f){_0x55e7d5=path[_0xe072('0x57')](_0x55e7d5,'offline-chat/');}var _0x526e03=path[_0xe072('0x57')](_0x55e7d5,_0x50081a[_0xe072('0x51')]);return _0xb3ca0a[_0xe072('0x53')](_0x526e03);}})[_0xe072('0x44')](handleError(_0xb3ca0a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index e80e630..4bcf8f3 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 _0x8a3a=['Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4a9433,_0x5337cb){var _0x434947=function(_0x3ab6cd){while(--_0x3ab6cd){_0x4a9433['push'](_0x4a9433['shift']());}};_0x434947(++_0x5337cb);}(_0x8a3a,0x18e));var _0xa8a3=function(_0x2465ff,_0x203af5){_0x2465ff=_0x2465ff-0x0;var _0x39459c=_0x8a3a[_0x2465ff];return _0x39459c;};'use strict';var _=require(_0xa8a3('0x0'));var util=require(_0xa8a3('0x1'));var logger=require(_0xa8a3('0x2'))(_0xa8a3('0x3'));var moment=require(_0xa8a3('0x4'));var BPromise=require(_0xa8a3('0x5'));var rp=require(_0xa8a3('0x6'));var fs=require('fs');var path=require(_0xa8a3('0x7'));var rimraf=require('rimraf');var config=require(_0xa8a3('0x8'));var attributes=require('./attachment.attributes');module['exports']=function(_0x1718de,_0x4b04e6){return _0x1718de[_0xa8a3('0x9')](_0xa8a3('0xa'),attributes,{'tableName':_0xa8a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2540=['api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','../../config/logger'];(function(_0x5307f1,_0x66442d){var _0x212ae1=function(_0x471731){while(--_0x471731){_0x5307f1['push'](_0x5307f1['shift']());}};_0x212ae1(++_0x66442d);}(_0x2540,0x11e));var _0x0254=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x2540[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x0254('0x0'));var util=require('util');var logger=require(_0x0254('0x1'))(_0x0254('0x2'));var moment=require(_0x0254('0x3'));var BPromise=require(_0x0254('0x4'));var rp=require(_0x0254('0x5'));var fs=require('fs');var path=require(_0x0254('0x6'));var rimraf=require('rimraf');var config=require(_0x0254('0x7'));var attributes=require(_0x0254('0x8'));module[_0x0254('0x9')]=function(_0x21b651,_0x1c2aaf){return _0x21b651['define'](_0x0254('0xa'),attributes,{'tableName':_0x0254('0xb'),'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 ac0f5e2..d51b2fd 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 _0xf109=['code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dca49,_0x66a57e){var _0x3df140=function(_0x583752){while(--_0x583752){_0x2dca49['push'](_0x2dca49['shift']());}};_0x3df140(++_0x66a57e);}(_0xf109,0xce));var _0x9f10=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xf109[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});}exports[_0x9f10('0x17')]=function(_0x509fba){var _0x150813=this;return new Promise(function(_0x53bfbd,_0xe221d0){return db['Attachment'][_0x9f10('0x18')](_0x509fba['body'],{'raw':_0x509fba['options']?_0x509fba[_0x9f10('0x19')][_0x9f10('0x1a')]===undefined?!![]:![]:!![]})[_0x9f10('0xc')](function(_0x3a78be){logger[_0x9f10('0xd')](_0x9f10('0x17'),_0x509fba);logger[_0x9f10('0xf')]('CreateAttachment',_0x509fba,JSON[_0x9f10('0x1b')](_0x3a78be));_0x53bfbd(_0x3a78be);})['catch'](function(_0x293990){logger[_0x9f10('0x11')](_0x9f10('0x17'),_0x293990['message'],_0x509fba);_0xe221d0(_0x150813[_0x9f10('0x11')](0x1f4,_0x293990[_0x9f10('0x14')]));});});}; \ No newline at end of file +var _0xa74d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateAttachment','Attachment','create','body','options','raw','catch','util'];(function(_0x36932b,_0x280fd3){var _0x18fc2b=function(_0x114079){while(--_0x114079){_0x36932b['push'](_0x36932b['shift']());}};_0x18fc2b(++_0x280fd3);}(_0xa74d,0x1cf));var _0xda74=function(_0x311f9d,_0x653511){_0x311f9d=_0x311f9d-0x0;var _0x4a64c2=_0xa74d[_0x311f9d];return _0x4a64c2;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2113f2,_0x3fa4e7,_0x5da443){return new BPromise(function(_0x23d5f5,_0x517251){return client['request'](_0x2113f2,_0x5da443)[_0xda74('0xc')](function(_0x411790){logger['info'](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));logger[_0xda74('0xf')](_0xda74('0x10'),_0x3fa4e7,_0xda74('0xe'),JSON[_0xda74('0x11')](_0x411790));if(_0x411790[_0xda74('0x12')]){if(_0x411790[_0xda74('0x12')]['code']===0x1f4){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')]['message']);return _0x517251(_0x411790[_0xda74('0x12')][_0xda74('0x13')]);}logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')][_0xda74('0x13')]);return _0x23d5f5(_0x411790[_0xda74('0x12')]['message']);}else{logger[_0xda74('0x14')](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));_0x23d5f5(_0x411790[_0xda74('0x15')][_0xda74('0x13')]);}})['catch'](function(_0x1535d3){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x1535d3);_0x517251(_0x1535d3);});});}exports[_0xda74('0x16')]=function(_0x28baa9){var _0xd22576=this;return new Promise(function(_0x179a63,_0x504c77){return db[_0xda74('0x17')][_0xda74('0x18')](_0x28baa9[_0xda74('0x19')],{'raw':_0x28baa9[_0xda74('0x1a')]?_0x28baa9[_0xda74('0x1a')][_0xda74('0x1b')]===undefined?!![]:![]:!![]})[_0xda74('0xc')](function(_0x291dd6){logger['info']('CreateAttachment',_0x28baa9);logger['debug'](_0xda74('0x16'),_0x28baa9,JSON[_0xda74('0x11')](_0x291dd6));_0x179a63(_0x291dd6);})[_0xda74('0x1c')](function(_0x4494ad){logger['error']('CreateAttachment',_0x4494ad[_0xda74('0x13')],_0x28baa9);_0x504c77(_0xd22576[_0xda74('0x12')](0x1f4,_0x4494ad[_0xda74('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index dd32ef7..da9b48c 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3d4f6d,_0x5b4e31){var _0x457798=function(_0x3db234){while(--_0x3db234){_0x3d4f6d['push'](_0x3d4f6d['shift']());}};_0x457798(++_0x5b4e31);}(_0x2032,0xd9));var _0x2203=function(_0x471029,_0xb5ea43){_0x471029=_0x471029-0x0;var _0x225d1e=_0x2032[_0x471029];return _0x225d1e;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _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(_0x4f4caa,_0x29522f){var _0x2a3b35=function(_0x32d11f){while(--_0x32d11f){_0x4f4caa['push'](_0x4f4caa['shift']());}};_0x2a3b35(++_0x29522f);}(_0x757a,0xde));var _0xa757=function(_0x47f0e7,_0x4e4f4d){_0x47f0e7=_0x47f0e7-0x0;var _0x5c808a=_0x757a[_0x47f0e7];return _0x5c808a;};'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 8a87e7a..8db656f 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 _0x39f8=['then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','disabled','online','admin','user','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','login','role','signToken','json','use','ad-login','User','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','domain','authenticate','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','adSsoEnabled','blockDuration'];(function(_0x5d8afd,_0xd7f769){var _0x336c61=function(_0x539e58){while(--_0x539e58){_0x5d8afd['push'](_0x5d8afd['shift']());}};_0x336c61(++_0xd7f769);}(_0x39f8,0x161));var _0x839f=function(_0x13dde6,_0x56edd8){_0x13dde6=_0x13dde6-0x0;var _0x39d336=_0x39f8[_0x13dde6];return _0x39d336;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x839f('0x0'))[_0x839f('0x1')];var moment=require(_0x839f('0x2'));var ActiveDirectory=require(_0x839f('0x3'));var BPromise=require('bluebird');var util=require(_0x839f('0x4'));var db=require(_0x839f('0x5'))['db'];var authService=require(_0x839f('0x6'));var utils=require(_0x839f('0x7'));var config=require('../../config/environment');var logger=require(_0x839f('0x8'))(_0x839f('0x9'));function isActiveDirectoryConfigured(_0x43735b){var _0x22d131=![];if(typeof _0x43735b[_0x839f('0xa')]!==_0x839f('0xb')){_0x22d131=_0x43735b['activedirectory']['baseDN']&&_0x43735b[_0x839f('0xa')]['url']&&_0x43735b[_0x839f('0xa')][_0x839f('0xc')];}return _0x22d131;}function adAuthenticate(_0x3d9628,_0x929697,_0x44d6ed){return new BPromise(function(_0x234231,_0x1777d9){try{var _0x33daa8=new ActiveDirectory(_0x3d9628);_0x33daa8[_0x839f('0xd')](_0x929697,_0x44d6ed,function(_0x5568fa,_0x24650b){if(_0x5568fa){logger[_0x839f('0xe')](_0x839f('0xf'),_0x929697,util['inspect'](_0x5568fa,{'showHidden':![],'depth':null}));_0x1777d9(_0x839f('0x10'));}else if(!_0x24650b){logger[_0x839f('0xe')](_0x839f('0x11'),_0x929697);_0x1777d9(_0x839f('0x10'));}else{_0x234231(_0x24650b);}});}catch(_0x5b24df){_0x1777d9(_0x5b24df);}});}function ActiveDirectoryAuthenticate(_0x5bb280,_0x148a9f,_0x31345b,_0x32f0b7){var _0x571f11,_0x4dbcce;if(!isActiveDirectoryConfigured(config)){logger[_0x839f('0xe')](_0x839f('0x12'),_0x148a9f);return _0x32f0b7(null,![],{'message':_0x839f('0x10')});}return db[_0x839f('0x13')][_0x839f('0x14')]({'where':{'id':0x1},'attributes':[_0x839f('0x15'),_0x839f('0x16')],'raw':!![]})[_0x839f('0x17')](function(_0x2406f3){_0x571f11=_0x2406f3;if(!_0x571f11[_0x839f('0x15')]){logger[_0x839f('0xe')](_0x839f('0x18'),_0x148a9f);throw new Error(_0x839f('0x10'));}return _0x5bb280[_0x839f('0x14')]({'attributes':['id',_0x839f('0x19'),'password',_0x839f('0x1a'),'role',_0x839f('0x1b'),'blocked','blockedAt',_0x839f('0x1c')],'where':{'name':_0x148a9f,'role':{'$or':[_0x839f('0x1d'),_0x839f('0x1e'),'agent']},'adSsoEnabled':!![]}});})[_0x839f('0x17')](function(_0x4eb116){if(!_0x4eb116||_0x4eb116&&_0x4eb116[_0x839f('0x19')]!==_0x148a9f){throw new Error(_0x839f('0x10'));}_0x4dbcce=_0x4eb116;var _0x1bc56f=_0x4dbcce[_0x839f('0x19')]+'@'+config['activedirectory'][_0x839f('0xc')];return adAuthenticate(config['activedirectory'],_0x1bc56f,_0x31345b);})['then'](function(_0x345072){if(_0x4dbcce[_0x839f('0x1b')]){throw new Error(_0x839f('0x10'));}if(_0x571f11[_0x839f('0x16')]>0x0){if(_0x4dbcce[_0x839f('0x1f')]){if(moment(_0x4dbcce[_0x839f('0x20')])[_0x839f('0x21')](_0x571f11[_0x839f('0x16')],_0x839f('0x22'))>moment()){throw new Error(_0x839f('0x10'));}return utils[_0x839f('0x23')](_0x4dbcce,0x0,![],null)[_0x839f('0x17')](function(){return utils[_0x839f('0x24')](_0x4dbcce);})[_0x839f('0x17')](function(){return _0x32f0b7(null,_0x4dbcce);});}else{return utils['getLicense'](_0x4dbcce)['then'](function(){return _0x32f0b7(null,_0x4dbcce);});}}else{return utils[_0x839f('0x24')](_0x4dbcce)[_0x839f('0x17')](function(){return _0x32f0b7(null,_0x4dbcce);});}})[_0x839f('0x25')](function(_0xe7f43b){return _0x32f0b7(null,![],_0xe7f43b);});}function handleError(_0xf5ad4e,_0x3c87dc,_0x276cd6){return _0xf5ad4e[_0x839f('0x26')](_0x3c87dc||0x1f4)[_0x839f('0x27')]({'message':_0x276cd6?_0x276cd6['message']||_0x276cd6:''});}exports[_0x839f('0x28')]=function(_0x572247,_0x477b6e,_0x43cd72){passport[_0x839f('0xd')]('ad-login',function(_0x3c28ff,_0x2d6fe8,_0x2bede4){var _0x445951=_0x3c28ff||_0x2bede4;if(_0x445951){return handleError(_0x477b6e,0x191,_0x445951);}if(!_0x2d6fe8){return handleError(_0x477b6e,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x857d59={'payload':{'id':_0x2d6fe8['id'],'role':_0x2d6fe8[_0x839f('0x29')]},'options':{'expiresIn':0x15180}};return authService[_0x839f('0x2a')](_0x857d59)[_0x839f('0x17')](function(_0x3ff58c){_0x477b6e[_0x839f('0x2b')]({'id':_0x2d6fe8['id'],'token':_0x3ff58c,'statusCall':'','isAlreadyLogged':_0x2d6fe8[_0x839f('0x1c')]});});}})(_0x572247,_0x477b6e,_0x43cd72);};passport[_0x839f('0x2c')](_0x839f('0x2d'),new LocalStrategy({'usernameField':_0x839f('0x19'),'passwordField':'password'},function(_0x53f386,_0x12d4be,_0x27fd84){return ActiveDirectoryAuthenticate(db[_0x839f('0x2e')],_0x53f386,_0x12d4be,_0x27fd84);})); \ No newline at end of file +var _0x1475=['disabled','blocked','admin','user','agent','blockedAt','add','minutes','clearBlockUser','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','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','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role'];(function(_0x4aa257,_0x5ebe39){var _0x2c320f=function(_0x408544){while(--_0x408544){_0x4aa257['push'](_0x4aa257['shift']());}};_0x2c320f(++_0x5ebe39);}(_0x1475,0x1e8));var _0x5147=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x1475[_0x5e77db];return _0x34b675;};'use strict';var passport=require(_0x5147('0x0'));var LocalStrategy=require(_0x5147('0x1'))[_0x5147('0x2')];var moment=require(_0x5147('0x3'));var ActiveDirectory=require(_0x5147('0x4'));var BPromise=require(_0x5147('0x5'));var util=require('util');var db=require(_0x5147('0x6'))['db'];var authService=require(_0x5147('0x7'));var utils=require(_0x5147('0x8'));var config=require(_0x5147('0x9'));var logger=require(_0x5147('0xa'))('api');function isActiveDirectoryConfigured(_0x1126c6){var _0xc247f0=![];if(typeof _0x1126c6[_0x5147('0xb')]!==_0x5147('0xc')){_0xc247f0=_0x1126c6[_0x5147('0xb')][_0x5147('0xd')]&&_0x1126c6['activedirectory']['url']&&_0x1126c6[_0x5147('0xb')][_0x5147('0xe')];}return _0xc247f0;}function adAuthenticate(_0x13373b,_0x2adf36,_0x5c4c27){return new BPromise(function(_0x2d5572,_0x14ed39){try{var _0x13a532=new ActiveDirectory(_0x13373b);_0x13a532[_0x5147('0xf')](_0x2adf36,_0x5c4c27,function(_0x39c616,_0x30c706){if(_0x39c616){logger[_0x5147('0x10')](_0x5147('0x11'),_0x2adf36,util[_0x5147('0x12')](_0x39c616,{'showHidden':![],'depth':null}));_0x14ed39(_0x5147('0x13'));}else if(!_0x30c706){logger[_0x5147('0x10')](_0x5147('0x14'),_0x2adf36);_0x14ed39('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2d5572(_0x30c706);}});}catch(_0x300b89){_0x14ed39(_0x300b89);}});}function ActiveDirectoryAuthenticate(_0x253e9e,_0x5b6e6f,_0x5c5df9,_0x313775){var _0x2f05bc,_0xb46a62;if(!isActiveDirectoryConfigured(config)){logger[_0x5147('0x10')](_0x5147('0x15'),_0x5b6e6f);return _0x313775(null,![],{'message':_0x5147('0x13')});}return db[_0x5147('0x16')]['findOne']({'where':{'id':0x1},'attributes':[_0x5147('0x17'),_0x5147('0x18')],'raw':!![]})[_0x5147('0x19')](function(_0x416886){_0x2f05bc=_0x416886;if(!_0x2f05bc[_0x5147('0x17')]){logger[_0x5147('0x10')](_0x5147('0x1a'),_0x5b6e6f);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x253e9e[_0x5147('0x1b')]({'attributes':['id',_0x5147('0x1c'),_0x5147('0x1d'),_0x5147('0x1e'),_0x5147('0x1f'),_0x5147('0x20'),_0x5147('0x21'),'blockedAt','online'],'where':{'name':_0x5b6e6f,'role':{'$or':[_0x5147('0x22'),_0x5147('0x23'),_0x5147('0x24')]},'adSsoEnabled':!![]}});})[_0x5147('0x19')](function(_0x1322cf){if(!_0x1322cf||_0x1322cf&&_0x1322cf[_0x5147('0x1c')]!==_0x5b6e6f){throw new Error(_0x5147('0x13'));}_0xb46a62=_0x1322cf;var _0xce9e8f=_0xb46a62['name']+'@'+config[_0x5147('0xb')]['domain'];return adAuthenticate(config[_0x5147('0xb')],_0xce9e8f,_0x5c5df9);})[_0x5147('0x19')](function(_0x3c60bb){if(_0xb46a62[_0x5147('0x20')]){throw new Error(_0x5147('0x13'));}if(_0x2f05bc[_0x5147('0x18')]>0x0){if(_0xb46a62[_0x5147('0x21')]){if(moment(_0xb46a62[_0x5147('0x25')])[_0x5147('0x26')](_0x2f05bc[_0x5147('0x18')],_0x5147('0x27'))>moment()){throw new Error(_0x5147('0x13'));}return utils[_0x5147('0x28')](_0xb46a62,0x0,![],null)[_0x5147('0x19')](function(){return utils[_0x5147('0x29')](_0xb46a62);})['then'](function(){return _0x313775(null,_0xb46a62);});}else{return utils[_0x5147('0x29')](_0xb46a62)[_0x5147('0x19')](function(){return _0x313775(null,_0xb46a62);});}}else{return utils[_0x5147('0x29')](_0xb46a62)['then'](function(){return _0x313775(null,_0xb46a62);});}})[_0x5147('0x2a')](function(_0x241a41){return _0x313775(null,![],_0x241a41);});}function handleError(_0x1afd29,_0x51e240,_0x338add){return _0x1afd29['status'](_0x51e240||0x1f4)[_0x5147('0x2b')]({'message':_0x338add?_0x338add[_0x5147('0x2c')]||_0x338add:''});}exports[_0x5147('0x2d')]=function(_0x33b8f8,_0x441a54,_0x300bc4){passport[_0x5147('0xf')](_0x5147('0x2e'),function(_0x3e1963,_0x460f88,_0x2e1c7d){var _0x2609df=_0x3e1963||_0x2e1c7d;if(_0x2609df){return handleError(_0x441a54,0x191,_0x2609df);}if(!_0x460f88){return handleError(_0x441a54,0x194,{'message':_0x5147('0x2f')});}else{var _0x434c86={'payload':{'id':_0x460f88['id'],'role':_0x460f88[_0x5147('0x1f')]},'options':{'expiresIn':0x15180}};return authService[_0x5147('0x30')](_0x434c86)['then'](function(_0x28ddb9){_0x441a54['json']({'id':_0x460f88['id'],'token':_0x28ddb9,'statusCall':'','isAlreadyLogged':_0x460f88[_0x5147('0x31')]});});}})(_0x33b8f8,_0x441a54,_0x300bc4);};passport[_0x5147('0x32')](_0x5147('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':_0x5147('0x1d')},function(_0x152bb8,_0x47bbfc,_0x1d32e8){return ActiveDirectoryAuthenticate(db[_0x5147('0x33')],_0x152bb8,_0x47bbfc,_0x1d32e8);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 9222912..5fb2844 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 _0x0b6d=['exports','express','Router','login'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x0b6d,0x151));var _0xd0b6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x0b6d[_0x26462c];return _0x509a42;};'use strict';var express=require(_0xd0b6('0x0'));var router=express[_0xd0b6('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xd0b6('0x2')]);module[_0xd0b6('0x3')]=router; \ No newline at end of file +var _0xd858=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd858,0x1b1));var _0x8d85=function(_0x28c95a,_0x5d32e4){_0x28c95a=_0x28c95a-0x0;var _0x294352=_0xd858[_0x28c95a];return _0x294352;};'use strict';var express=require(_0x8d85('0x0'));var router=express[_0x8d85('0x1')]();var controller=require(_0x8d85('0x2'));router[_0x8d85('0x3')]('/',controller[_0x8d85('0x4')]);module[_0x8d85('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index ceeb336..4655f6a 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 _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(_0x35e44d,_0x34def6){var _0x35ec48=function(_0xb33742){while(--_0xb33742){_0x35e44d['push'](_0x35e44d['shift']());}};_0x35ec48(++_0x34def6);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 +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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7a54,0x106));var _0x47a5=function(_0x496972,_0x397c2d){_0x496972=_0x496972-0x0;var _0x1f0132=_0x7a54[_0x496972];return _0x1f0132;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1e4bfdb..e4e692f 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 _0xf6d8=['express','passport','Router','./authGoogle.controller','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x3110ab,_0x5b6a7a){var _0x24c310=function(_0x3cbbc9){while(--_0x3cbbc9){_0x3110ab['push'](_0x3110ab['shift']());}};_0x24c310(++_0x5b6a7a);}(_0xf6d8,0xb4));var _0x8f6d=function(_0x4d7f55,_0x53a87d){_0x4d7f55=_0x4d7f55-0x0;var _0x16fc1e=_0xf6d8[_0x4d7f55];return _0x16fc1e;};'use strict';var express=require(_0x8f6d('0x0'));var passport=require(_0x8f6d('0x1'));var router=express[_0x8f6d('0x2')]();var controller=require(_0x8f6d('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x8f6d('0x4'));router[_0x8f6d('0x5')]('/',controller['login']);router[_0x8f6d('0x5')](_0x8f6d('0x6'),controller[_0x8f6d('0x7')],authService[_0x8f6d('0x8')],userController[_0x8f6d('0x9')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x6f8a=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6f8a,0x1e0));var _0xa6f8=function(_0x3e7855,_0x582859){_0x3e7855=_0x3e7855-0x0;var _0x5a96dd=_0x6f8a[_0x3e7855];return _0x5a96dd;};'use strict';var express=require(_0xa6f8('0x0'));var passport=require(_0xa6f8('0x1'));var router=express[_0xa6f8('0x2')]();var controller=require(_0xa6f8('0x3'));var userController=require(_0xa6f8('0x4'));var authService=require(_0xa6f8('0x5'));router[_0xa6f8('0x6')]('/',controller[_0xa6f8('0x7')]);router[_0xa6f8('0x6')](_0xa6f8('0x8'),controller[_0xa6f8('0x9')],authService[_0xa6f8('0xa')],userController['login'],authService[_0xa6f8('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2c3fdda..edc6c9b 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 _0x9f33=['user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','User','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','password','role','disabled','blocked','blockedAt','loginAttempts','admin'];(function(_0x53a822,_0x550c4d){var _0x5e0aa1=function(_0x537f4f){while(--_0x537f4f){_0x53a822['push'](_0x53a822['shift']());}};_0x5e0aa1(++_0x550c4d);}(_0x9f33,0x135));var _0x39f3=function(_0x646603,_0x1a1119){_0x646603=_0x646603-0x0;var _0x232a83=_0x9f33[_0x646603];return _0x232a83;};'use strict';var util=require(_0x39f3('0x0'));var passport=require(_0x39f3('0x1'));var LocalStrategy=require(_0x39f3('0x2'))[_0x39f3('0x3')];var jayson=require('jayson/promise');var _=require(_0x39f3('0x4'));var rs=require(_0x39f3('0x5'));var moment=require(_0x39f3('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x39f3('0x7'));var utils=require(_0x39f3('0x8'));var client=jayson[_0x39f3('0x9')][_0x39f3('0xa')]({'port':0x232b});function localAuthenticate(_0x11874,_0x2246c3,_0x34dca5,_0x2e8720){var _0x4308ff,_0x4e3b31;return db[_0x39f3('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x39f3('0xc'),_0x39f3('0xd')],'raw':!![]})[_0x39f3('0xe')](function(_0x1f024d){_0x4308ff=_0x1f024d;return _0x11874[_0x39f3('0xf')]({'attributes':['id','name',_0x39f3('0x10'),'salt',_0x39f3('0x11'),_0x39f3('0x12'),_0x39f3('0x13'),_0x39f3('0x14'),_0x39f3('0x15')],'where':{'name':_0x2246c3,'role':{'$or':[_0x39f3('0x16'),_0x39f3('0x17'),_0x39f3('0x18')]}}});})['then'](function(_0x4afe8a){if(!_0x4afe8a||_0x4afe8a&&_0x4afe8a[_0x39f3('0x19')]!==_0x2246c3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4e3b31=_0x4afe8a;return _0x4e3b31;}})[_0x39f3('0xe')](function(){_0x4e3b31['authenticate'](_0x34dca5,function(_0x4c8723,_0x20d1ec){var _0x4139e1=_0x4e3b31[_0x39f3('0x15')]+0x1;if(_0x4c8723){return _0x2e8720(_0x4c8723);}else if(!_0x20d1ec){if(_0x4e3b31[_0x39f3('0x12')]){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else if(_0x4308ff['allowedLoginAttempts']>0x0){if(_0x4e3b31[_0x39f3('0x13')]){if(_0x4308ff['blockDuration']>0x0){if(moment(_0x4e3b31[_0x39f3('0x14')])[_0x39f3('0x1b')](_0x4308ff[_0x39f3('0xd')],_0x39f3('0x1c'))>moment()){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else{return utils[_0x39f3('0x1d')](_0x4e3b31,_0x4139e1,![],null)[_0x39f3('0xe')](function(){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});});}}else{return _0x2e8720(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4139e1>=_0x4308ff['allowedLoginAttempts']){return utils[_0x39f3('0x1d')](_0x4e3b31,0x0,!![],moment())[_0x39f3('0xe')](function(){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});});}else{return utils['clearBlockUser'](_0x4e3b31,_0x4139e1,![],null)[_0x39f3('0xe')](function(){return _0x2e8720(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}}else{if(_0x4e3b31[_0x39f3('0x12')]){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else if(_0x4308ff[_0x39f3('0xc')]>0x0){if(_0x4e3b31[_0x39f3('0x13')]){if(_0x4308ff[_0x39f3('0xd')]>0x0){if(moment(_0x4e3b31[_0x39f3('0x14')])['add'](_0x4308ff[_0x39f3('0xd')],_0x39f3('0x1c'))>moment()){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else{return utils[_0x39f3('0x1d')](_0x4e3b31,0x0,![],null)[_0x39f3('0xe')](function(){return utils[_0x39f3('0x1e')](_0x4e3b31);})[_0x39f3('0xe')](function(){return _0x2e8720(null,_0x4e3b31);});}}else{return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}}else{return utils[_0x39f3('0x1d')](_0x4e3b31,0x0,![],null)[_0x39f3('0xe')](function(){return utils[_0x39f3('0x1e')](_0x4e3b31);})[_0x39f3('0xe')](function(){return _0x2e8720(null,_0x4e3b31);})[_0x39f3('0x1f')](function(_0x3ab963){return _0x2e8720(null,![],_0x3ab963);});}}else{if(_0x4e3b31['blocked']){return _0x2e8720(null,![],{'message':_0x39f3('0x1a')});}else{return utils[_0x39f3('0x1e')](_0x4e3b31)['then'](function(){return _0x2e8720(null,_0x4e3b31);});}}}});})[_0x39f3('0x1f')](function(_0x143ced){return _0x2e8720(null,![],_0x143ced);});}function sendServiceMail(_0x469159){return db[_0x39f3('0x20')]['find']({'where':{'service':!![]},'attributes':['id',_0x39f3('0x19'),_0x39f3('0x21')],'include':[{'model':db[_0x39f3('0x22')],'as':_0x39f3('0x23'),'include':[{'model':db[_0x39f3('0x24')],'as':_0x39f3('0x24')}]}]})[_0x39f3('0xe')](function(_0x164ec0){if(!_0x164ec0){throw new Error(_0x39f3('0x25'));}var _0x58ebd2=_0x164ec0[_0x39f3('0x26')]();var _0x4931cd={'account':_0x58ebd2,'message':_[_0x39f3('0x27')]({'from':util[_0x39f3('0x28')]('\x22%s\x22\x20<%s>',_0x164ec0[_0x39f3('0x19')],_0x164ec0['email']||_0x164ec0[_0x39f3('0x23')]['user'])},_0x469159)};return client[_0x39f3('0x29')](_0x39f3('0x2a'),_0x4931cd);})[_0x39f3('0xe')](function(_0x783ab7){if(_0x783ab7[_0x39f3('0x2b')]){throw new Error(util[_0x39f3('0x28')](_0x39f3('0x2c'),_0x783ab7[_0x39f3('0x2b')]['message']||JSON[_0x39f3('0x2d')](_0x783ab7[_0x39f3('0x2b')])));}return!![];});}function handleError(_0x546b39,_0x3a4ea9,_0x294a88){return _0x546b39[_0x39f3('0x2e')](_0x3a4ea9||0x1f4)[_0x39f3('0x2f')]({'message':_0x294a88?_0x294a88[_0x39f3('0x30')]||_0x294a88:''});}exports['login']=function(_0x17e8e3,_0x29cc6b,_0x3b36cd){passport[_0x39f3('0x31')](_0x39f3('0x32'),function(_0x4d27c8,_0x5c975e,_0x338cba){var _0x133938=_0x4d27c8||_0x338cba;if(_0x133938){return handleError(_0x29cc6b,0x191,_0x133938);}if(!_0x5c975e){return handleError(_0x29cc6b,0x194,{'message':_0x39f3('0x33')});}else{var _0x396b2d={'payload':{'id':_0x5c975e['id'],'role':_0x5c975e['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x396b2d)[_0x39f3('0xe')](function(_0x4b2439){_0x29cc6b[_0x39f3('0x34')]({'id':_0x5c975e['id'],'token':_0x4b2439,'statusCall':'','isAlreadyLogged':_0x5c975e[_0x39f3('0x35')]});});}})(_0x17e8e3,_0x29cc6b,_0x3b36cd);};exports[_0x39f3('0x36')]=function(_0x3c3ab6,_0x1db9ee){if(!_0x3c3ab6[_0x39f3('0x37')][_0x39f3('0x21')]){return handleError(_0x1db9ee,0x1f4,{'message':_0x39f3('0x38')});}var _0x2d79ce=rs['generate']();_0x3c3ab6[_0x39f3('0x37')][_0x39f3('0x21')]=_0x3c3ab6[_0x39f3('0x37')][_0x39f3('0x21')][_0x39f3('0x39')]()[_0x39f3('0x3a')]();var _0x2baed5;return db['Setting'][_0x39f3('0xf')]({'where':{'id':0x1},'attributes':[_0x39f3('0xc'),_0x39f3('0xd')],'raw':!![]})[_0x39f3('0xe')](function(_0x8c5a1b){_0x2baed5=_0x8c5a1b;return db['User'][_0x39f3('0x3b')]({'where':{'email':_0x3c3ab6['body'][_0x39f3('0x21')]}});})[_0x39f3('0xe')](function(_0x5feb24){if(!_0x5feb24){throw new Error(_0x39f3('0x3c'));}if(_0x5feb24[_0x39f3('0x12')]){throw new Error(_0x39f3('0x3d'));}if(_0x5feb24['blocked']){if(moment(_0x5feb24[_0x39f3('0x14')])[_0x39f3('0x1b')](_0x2baed5[_0x39f3('0xd')],_0x39f3('0x1c'))>moment()){throw new Error(_0x39f3('0x3e'));}else{_0x5feb24[_0x39f3('0x13')]=![];_0x5feb24['blockedAt']=null;}}_0x5feb24[_0x39f3('0x3f')]=_0x2d79ce;_0x5feb24['resetPasswordExpires']=Date[_0x39f3('0x40')]()+0x36ee80;return _0x5feb24['save']();})[_0x39f3('0xe')](function(){return sendServiceMail({'to':_0x3c3ab6[_0x39f3('0x37')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x39f3('0x41')+_0x39f3('0x42')+_0x39f3('0x43')+_0x3c3ab6[_0x39f3('0x44')][_0x39f3('0x45')]+_0x39f3('0x46')+_0x2d79ce+'\x0a\x0a'+_0x39f3('0x47')});})[_0x39f3('0xe')](function(){_0x1db9ee[_0x39f3('0x2e')](0xc8)[_0x39f3('0x2f')]({'message':_0x39f3('0x48')});})['catch'](function(_0x32fa47){return handleError(_0x1db9ee,0x1f4,_0x32fa47);});};exports[_0x39f3('0x49')]=function(_0x5024a6,_0xf5cce1){return db['User']['find']({'where':{'resetPasswordToken':_0x5024a6[_0x39f3('0x4a')][_0x39f3('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x39f3('0xe')](function(_0xd91408){if(!_0xd91408){throw new Error(_0x39f3('0x4c'));}return db['Setting']['findOne']({'attributes':['id',_0x39f3('0x4d'),_0x39f3('0x4e'),_0x39f3('0x4f')]})[_0x39f3('0xe')](function(_0x237b13){if(_0x237b13[_0x39f3('0x4d')])authService['validatePasswordPattern'](_0x5024a6[_0x39f3('0x37')][_0x39f3('0x10')]);if(!_0x237b13[_0x39f3('0x4e')]||!_0xd91408[_0x39f3('0x50')])return _0xd91408;authService[_0x39f3('0x51')](_0x5024a6['body'][_0x39f3('0x10')],_0xd91408[_0x39f3('0x50')],_0x237b13[_0x39f3('0x4f')]);return _0xd91408;})['then'](function(){_0xd91408[_0x39f3('0x10')]=_0x5024a6[_0x39f3('0x37')][_0x39f3('0x10')];_0xd91408[_0x39f3('0x3f')]=null;_0xd91408['resetPasswordExpires']=null;return _0xd91408['save']();});})[_0x39f3('0xe')](function(){_0xf5cce1[_0x39f3('0x2e')](0xc8)[_0x39f3('0x2f')]({'message':'Password\x20reset!'});})[_0x39f3('0x1f')](function(_0x8e7be6){return handleError(_0xf5cce1,0x1f4,_0x8e7be6);});};passport['use'](_0x39f3('0x32'),new LocalStrategy({'usernameField':_0x39f3('0x19'),'passwordField':_0x39f3('0x10')},function(_0x321de0,_0x38e7ea,_0x3fd7d6){return localAuthenticate(db[_0x39f3('0x52')],_0x321de0,_0x38e7ea,_0x3fd7d6);})); \ No newline at end of file +var _0x2cd9=['password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','user','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','status','Reset\x20Email\x20sent!','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','util','passport','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then'];(function(_0x40a218,_0x3ebf5a){var _0x42060d=function(_0x31130c){while(--_0x31130c){_0x40a218['push'](_0x40a218['shift']());}};_0x42060d(++_0x3ebf5a);}(_0x2cd9,0xdf));var _0x92cd=function(_0x13f54f,_0x4fff11){_0x13f54f=_0x13f54f-0x0;var _0x1753e4=_0x2cd9[_0x13f54f];return _0x1753e4;};'use strict';var util=require(_0x92cd('0x0'));var passport=require(_0x92cd('0x1'));var LocalStrategy=require('passport-local')[_0x92cd('0x2')];var jayson=require('jayson/promise');var _=require(_0x92cd('0x3'));var rs=require('randomstring');var moment=require(_0x92cd('0x4'));var db=require(_0x92cd('0x5'))['db'];var authService=require(_0x92cd('0x6'));var utils=require(_0x92cd('0x7'));var client=jayson[_0x92cd('0x8')][_0x92cd('0x9')]({'port':0x232b});function localAuthenticate(_0x3c7509,_0x481395,_0x15c9b9,_0x391603){var _0x5d5558,_0x3f4c1b;return db['Setting'][_0x92cd('0xa')]({'where':{'id':0x1},'attributes':[_0x92cd('0xb'),_0x92cd('0xc')],'raw':!![]})[_0x92cd('0xd')](function(_0x38f016){_0x5d5558=_0x38f016;return _0x3c7509[_0x92cd('0xa')]({'attributes':['id','name',_0x92cd('0xe'),_0x92cd('0xf'),_0x92cd('0x10'),_0x92cd('0x11'),_0x92cd('0x12'),_0x92cd('0x13'),_0x92cd('0x14')],'where':{'name':_0x481395,'role':{'$or':[_0x92cd('0x15'),'user',_0x92cd('0x16')]}}});})['then'](function(_0x4a1213){if(!_0x4a1213||_0x4a1213&&_0x4a1213[_0x92cd('0x17')]!==_0x481395){throw new Error(_0x92cd('0x18'));}else{_0x3f4c1b=_0x4a1213;return _0x3f4c1b;}})[_0x92cd('0xd')](function(){_0x3f4c1b[_0x92cd('0x19')](_0x15c9b9,function(_0x4ac90b,_0x1049ad){var _0x1f0d08=_0x3f4c1b[_0x92cd('0x14')]+0x1;if(_0x4ac90b){return _0x391603(_0x4ac90b);}else if(!_0x1049ad){if(_0x3f4c1b[_0x92cd('0x11')]){return _0x391603(null,![],{'message':_0x92cd('0x18')});}else if(_0x5d5558[_0x92cd('0xb')]>0x0){if(_0x3f4c1b[_0x92cd('0x12')]){if(_0x5d5558[_0x92cd('0xc')]>0x0){if(moment(_0x3f4c1b[_0x92cd('0x13')])['add'](_0x5d5558[_0x92cd('0xc')],_0x92cd('0x1a'))>moment()){return _0x391603(null,![],{'message':_0x92cd('0x18')});}else{return utils[_0x92cd('0x1b')](_0x3f4c1b,_0x1f0d08,![],null)[_0x92cd('0xd')](function(){return _0x391603(null,![],{'message':_0x92cd('0x18')});});}}else{return _0x391603(null,![],{'message':_0x92cd('0x18')});}}else{if(_0x1f0d08>=_0x5d5558[_0x92cd('0xb')]){return utils[_0x92cd('0x1b')](_0x3f4c1b,0x0,!![],moment())[_0x92cd('0xd')](function(){return _0x391603(null,![],{'message':_0x92cd('0x18')});});}else{return utils[_0x92cd('0x1b')](_0x3f4c1b,_0x1f0d08,![],null)['then'](function(){return _0x391603(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x391603(null,![],{'message':_0x92cd('0x18')});}}else{if(_0x3f4c1b[_0x92cd('0x11')]){return _0x391603(null,![],{'message':_0x92cd('0x18')});}else if(_0x5d5558[_0x92cd('0xb')]>0x0){if(_0x3f4c1b[_0x92cd('0x12')]){if(_0x5d5558[_0x92cd('0xc')]>0x0){if(moment(_0x3f4c1b[_0x92cd('0x13')])[_0x92cd('0x1c')](_0x5d5558[_0x92cd('0xc')],_0x92cd('0x1a'))>moment()){return _0x391603(null,![],{'message':_0x92cd('0x18')});}else{return utils[_0x92cd('0x1b')](_0x3f4c1b,0x0,![],null)[_0x92cd('0xd')](function(){return utils['getLicense'](_0x3f4c1b);})[_0x92cd('0xd')](function(){return _0x391603(null,_0x3f4c1b);});}}else{return _0x391603(null,![],{'message':_0x92cd('0x18')});}}else{return utils[_0x92cd('0x1b')](_0x3f4c1b,0x0,![],null)[_0x92cd('0xd')](function(){return utils[_0x92cd('0x1d')](_0x3f4c1b);})[_0x92cd('0xd')](function(){return _0x391603(null,_0x3f4c1b);})[_0x92cd('0x1e')](function(_0x2dadc3){return _0x391603(null,![],_0x2dadc3);});}}else{if(_0x3f4c1b[_0x92cd('0x12')]){return _0x391603(null,![],{'message':_0x92cd('0x18')});}else{return utils[_0x92cd('0x1d')](_0x3f4c1b)[_0x92cd('0xd')](function(){return _0x391603(null,_0x3f4c1b);});}}}});})[_0x92cd('0x1e')](function(_0x13abcf){return _0x391603(null,![],_0x13abcf);});}function sendServiceMail(_0x59036f){return db[_0x92cd('0x1f')][_0x92cd('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x92cd('0x21')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x92cd('0x22')}]}]})[_0x92cd('0xd')](function(_0x32c9e6){if(!_0x32c9e6){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x141ec1=_0x32c9e6[_0x92cd('0x23')]();var _0x16d396={'account':_0x141ec1,'message':_[_0x92cd('0x24')]({'from':util[_0x92cd('0x25')](_0x92cd('0x26'),_0x32c9e6[_0x92cd('0x17')],_0x32c9e6[_0x92cd('0x21')]||_0x32c9e6[_0x92cd('0x27')][_0x92cd('0x28')])},_0x59036f)};return client['request'](_0x92cd('0x29'),_0x16d396);})['then'](function(_0x228602){if(_0x228602[_0x92cd('0x2a')]){throw new Error(util[_0x92cd('0x25')](_0x92cd('0x2b'),_0x228602[_0x92cd('0x2a')][_0x92cd('0x2c')]||JSON['stringify'](_0x228602[_0x92cd('0x2a')])));}return!![];});}function handleError(_0x18995f,_0x456837,_0x8347a3){return _0x18995f['status'](_0x456837||0x1f4)[_0x92cd('0x2d')]({'message':_0x8347a3?_0x8347a3[_0x92cd('0x2c')]||_0x8347a3:''});}exports[_0x92cd('0x2e')]=function(_0x2dce50,_0x265344,_0x47d94a){passport[_0x92cd('0x19')](_0x92cd('0x2f'),function(_0x2de903,_0x411f99,_0x38bb86){var _0xd8619f=_0x2de903||_0x38bb86;if(_0xd8619f){return handleError(_0x265344,0x191,_0xd8619f);}if(!_0x411f99){return handleError(_0x265344,0x194,{'message':_0x92cd('0x30')});}else{var _0x32fe18={'payload':{'id':_0x411f99['id'],'role':_0x411f99[_0x92cd('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x92cd('0x31')](_0x32fe18)[_0x92cd('0xd')](function(_0x5088c5){_0x265344[_0x92cd('0x32')]({'id':_0x411f99['id'],'token':_0x5088c5,'statusCall':'','isAlreadyLogged':_0x411f99['online']});});}})(_0x2dce50,_0x265344,_0x47d94a);};exports['forgot']=function(_0x42489e,_0x238124){if(!_0x42489e[_0x92cd('0x33')]['email']){return handleError(_0x238124,0x1f4,{'message':_0x92cd('0x34')});}var _0x43e1e6=rs['generate']();_0x42489e[_0x92cd('0x33')][_0x92cd('0x21')]=_0x42489e['body'][_0x92cd('0x21')][_0x92cd('0x35')]()[_0x92cd('0x36')]();var _0x484182;return db[_0x92cd('0x37')][_0x92cd('0xa')]({'where':{'id':0x1},'attributes':[_0x92cd('0xb'),'blockDuration'],'raw':!![]})[_0x92cd('0xd')](function(_0x9fa12a){_0x484182=_0x9fa12a;return db[_0x92cd('0x38')]['find']({'where':{'email':_0x42489e[_0x92cd('0x33')][_0x92cd('0x21')]}});})['then'](function(_0x2755b4){if(!_0x2755b4){throw new Error(_0x92cd('0x39'));}if(_0x2755b4[_0x92cd('0x11')]){throw new Error(_0x92cd('0x3a'));}if(_0x2755b4[_0x92cd('0x12')]){if(moment(_0x2755b4[_0x92cd('0x13')])['add'](_0x484182['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2755b4[_0x92cd('0x12')]=![];_0x2755b4[_0x92cd('0x13')]=null;}}_0x2755b4['resetPasswordToken']=_0x43e1e6;_0x2755b4[_0x92cd('0x3b')]=Date['now']()+0x36ee80;return _0x2755b4[_0x92cd('0x3c')]();})[_0x92cd('0xd')](function(){return sendServiceMail({'to':_0x42489e[_0x92cd('0x33')][_0x92cd('0x21')],'subject':_0x92cd('0x3d'),'text':_0x92cd('0x3e')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x92cd('0x3f')+_0x42489e[_0x92cd('0x40')][_0x92cd('0x41')]+'/reset/'+_0x43e1e6+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x238124[_0x92cd('0x42')](0xc8)[_0x92cd('0x2d')]({'message':_0x92cd('0x43')});})['catch'](function(_0x456230){return handleError(_0x238124,0x1f4,_0x456230);});};exports[_0x92cd('0x44')]=function(_0x5daeb4,_0x9eb9cc){return db[_0x92cd('0x38')][_0x92cd('0x20')]({'where':{'resetPasswordToken':_0x5daeb4[_0x92cd('0x45')]['token'],'resetPasswordExpires':{'$gt':Date[_0x92cd('0x46')]()}}})[_0x92cd('0xd')](function(_0xc7d228){if(!_0xc7d228){throw new Error(_0x92cd('0x47'));}return db[_0x92cd('0x37')][_0x92cd('0xa')]({'attributes':['id','securePassword',_0x92cd('0x48'),_0x92cd('0x49')]})['then'](function(_0x5087c7){if(_0x5087c7['securePassword'])authService[_0x92cd('0x4a')](_0x5daeb4[_0x92cd('0x33')]['password']);if(!_0x5087c7[_0x92cd('0x48')]||!_0xc7d228[_0x92cd('0x4b')])return _0xc7d228;authService[_0x92cd('0x4c')](_0x5daeb4[_0x92cd('0x33')][_0x92cd('0xe')],_0xc7d228[_0x92cd('0x4b')],_0x5087c7[_0x92cd('0x49')]);return _0xc7d228;})[_0x92cd('0xd')](function(){_0xc7d228[_0x92cd('0xe')]=_0x5daeb4[_0x92cd('0x33')][_0x92cd('0xe')];_0xc7d228[_0x92cd('0x4d')]=null;_0xc7d228['resetPasswordExpires']=null;return _0xc7d228[_0x92cd('0x3c')]();});})[_0x92cd('0xd')](function(){_0x9eb9cc[_0x92cd('0x42')](0xc8)['send']({'message':_0x92cd('0x4e')});})[_0x92cd('0x1e')](function(_0x375957){return handleError(_0x9eb9cc,0x1f4,_0x375957);});};passport['use'](_0x92cd('0x2f'),new LocalStrategy({'usernameField':_0x92cd('0x17'),'passwordField':_0x92cd('0xe')},function(_0x5f3b1a,_0x22d4ef,_0x41e0b){return localAuthenticate(db['User'],_0x5f3b1a,_0x22d4ef,_0x41e0b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4fcb30e..fe3099f 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 _0x98c5=['express','./authLocal.controller','post','forgot','/reset/:token','exports'];(function(_0x3ecc0a,_0x36082c){var _0x4fc0a4=function(_0x39488e){while(--_0x39488e){_0x3ecc0a['push'](_0x3ecc0a['shift']());}};_0x4fc0a4(++_0x36082c);}(_0x98c5,0x102));var _0x598c=function(_0x65a834,_0x45d48a){_0x65a834=_0x65a834-0x0;var _0x5ca46f=_0x98c5[_0x65a834];return _0x5ca46f;};'use strict';var express=require(_0x598c('0x0'));var router=express['Router']();var controller=require(_0x598c('0x1'));router[_0x598c('0x2')]('/',controller['login']);router[_0x598c('0x2')]('/forgot',controller[_0x598c('0x3')]);router[_0x598c('0x2')](_0x598c('0x4'),controller['reset']);module[_0x598c('0x5')]=router; \ No newline at end of file +var _0xd613=['./authLocal.controller','login','/forgot','forgot','post','/reset/:token','reset','exports','express','Router'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xd613,0x6c));var _0x3d61=function(_0x587580,_0x523ea5){_0x587580=_0x587580-0x0;var _0x5568a3=_0xd613[_0x587580];return _0x5568a3;};'use strict';var express=require(_0x3d61('0x0'));var router=express[_0x3d61('0x1')]();var controller=require(_0x3d61('0x2'));router['post']('/',controller[_0x3d61('0x3')]);router['post'](_0x3d61('0x4'),controller[_0x3d61('0x5')]);router[_0x3d61('0x6')](_0x3d61('0x7'),controller[_0x3d61('0x8')]);module[_0x3d61('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 08db53f..d388102 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 _0x491d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x15ac8d,_0x52cce1){var _0x55e8de=function(_0x41d478){while(--_0x41d478){_0x15ac8d['push'](_0x15ac8d['shift']());}};_0x55e8de(++_0x52cce1);}(_0x491d,0x177));var _0xd491=function(_0x1bef47,_0x337f1a){_0x1bef47=_0x1bef47-0x0;var _0x4e67c8=_0x491d[_0x1bef47];return _0x4e67c8;};'use strict';var Sequelize=require(_0xd491('0x0'));module[_0xd491('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xd491('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd491('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x1717=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x19a74b,_0x4cd4f2){var _0x436d29=function(_0x426574){while(--_0x426574){_0x19a74b['push'](_0x19a74b['shift']());}};_0x436d29(++_0x4cd4f2);}(_0x1717,0x1e4));var _0x7171=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x1717[_0x1e4f2d];return _0xd05ce5;};'use strict';var Sequelize=require(_0x7171('0x0'));module[_0x7171('0x1')]={'name':{'type':Sequelize[_0x7171('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x7171('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x7171('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7171('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 56b6cd9..bf14427 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 _0x4040=['filter','where','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','addConditions','Condition','ids','omit','getConditions','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','undefined','count','offset','set','Content-Range','save','update','then','destroy','end','stack','name','send','Automation','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4040,0x1ba));var _0x0404=function(_0x470ed3,_0x239cdd){_0x470ed3=_0x470ed3-0x0;var _0x297913=_0x4040[_0x470ed3];return _0x297913;};'use strict';var emlformat=require(_0x0404('0x0'));var rimraf=require(_0x0404('0x1'));var zipdir=require(_0x0404('0x2'));var jsonpatch=require(_0x0404('0x3'));var rp=require('request-promise');var moment=require(_0x0404('0x4'));var BPromise=require(_0x0404('0x5'));var Mustache=require(_0x0404('0x6'));var util=require(_0x0404('0x7'));var path=require(_0x0404('0x8'));var sox=require(_0x0404('0x9'));var csv=require(_0x0404('0xa'));var ejs=require(_0x0404('0xb'));var fs=require('fs');var fs_extra=require(_0x0404('0xc'));var _=require(_0x0404('0xd'));var squel=require(_0x0404('0xe'));var crypto=require(_0x0404('0xf'));var jsforce=require(_0x0404('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0404('0xa'));var querystring=require(_0x0404('0x11'));var Papa=require(_0x0404('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0404('0x13'));var as=require(_0x0404('0x14'));var hardwareService=require(_0x0404('0x15'));var logger=require('../../config/logger')(_0x0404('0x16'));var utils=require(_0x0404('0x17'));var config=require(_0x0404('0x18'));var licenseUtil=require(_0x0404('0x19'));var db=require(_0x0404('0x1a'))['db'];function respondWithStatusCode(_0x5bdb03,_0x5aa70f){_0x5aa70f=_0x5aa70f||0xcc;return function(_0x26bbfe){if(_0x26bbfe){return _0x5bdb03[_0x0404('0x1b')](_0x5aa70f);}return _0x5bdb03[_0x0404('0x1c')](_0x5aa70f)['end']();};}function respondWithResult(_0x59490b,_0x169896){_0x169896=_0x169896||0xc8;return function(_0x5ed89c){if(_0x5ed89c){return _0x59490b[_0x0404('0x1c')](_0x169896)[_0x0404('0x1d')](_0x5ed89c);}};}function respondWithFilteredResult(_0x18107b,_0x11b2a9){return function(_0x3cc56b){if(_0x3cc56b){var _0x116d2a=typeof _0x11b2a9['offset']===_0x0404('0x1e')&&typeof _0x11b2a9['limit']===_0x0404('0x1e');var _0x3c1bc2=_0x3cc56b[_0x0404('0x1f')];var _0x395df7=_0x116d2a?0x0:_0x11b2a9['offset'];var _0x52d37e=_0x116d2a?_0x3cc56b[_0x0404('0x1f')]:_0x11b2a9[_0x0404('0x20')]+_0x11b2a9['limit'];var _0x14ad1e;if(_0x52d37e>=_0x3c1bc2){_0x52d37e=_0x3c1bc2;_0x14ad1e=0xc8;}else{_0x14ad1e=0xce;}_0x18107b[_0x0404('0x1c')](_0x14ad1e);return _0x18107b[_0x0404('0x21')](_0x0404('0x22'),_0x395df7+'-'+_0x52d37e+'/'+_0x3c1bc2)['json'](_0x3cc56b);}return null;};}function patchUpdates(_0x3f08ab){return function(_0x3257df){try{jsonpatch['apply'](_0x3257df,_0x3f08ab,!![]);}catch(_0x22b419){return BPromise['reject'](_0x22b419);}return _0x3257df[_0x0404('0x23')]();};}function saveUpdates(_0x185fd5,_0x241a6d){return function(_0x3c0f9c){if(_0x3c0f9c){return _0x3c0f9c[_0x0404('0x24')](_0x185fd5)[_0x0404('0x25')](function(_0x5e6c26){return _0x5e6c26;});}return null;};}function removeEntity(_0x5aaaa0,_0x152b55){return function(_0x2736fd){if(_0x2736fd){return _0x2736fd[_0x0404('0x26')]()[_0x0404('0x25')](function(){_0x5aaaa0[_0x0404('0x1c')](0xcc)[_0x0404('0x27')]();});}};}function handleEntityNotFound(_0x5a45ce,_0x53f1df){return function(_0x2f3fa5){if(!_0x2f3fa5){_0x5a45ce[_0x0404('0x1b')](0x194);}return _0x2f3fa5;};}function handleError(_0xb2176c,_0x10f5df){_0x10f5df=_0x10f5df||0x1f4;return function(_0x58154d){logger['error'](_0x58154d[_0x0404('0x28')]);if(_0x58154d[_0x0404('0x29')]){delete _0x58154d[_0x0404('0x29')];}_0xb2176c[_0x0404('0x1c')](_0x10f5df)[_0x0404('0x2a')](_0x58154d);};}exports['index']=function(_0x338d71,_0x91b50f){var _0x28a3f4={},_0x260845={},_0x214d85={'count':0x0,'rows':[]};var _0x2ba933=_['map'](db[_0x0404('0x2b')][_0x0404('0x2c')],function(_0x23eaa3){return{'name':_0x23eaa3['fieldName'],'type':_0x23eaa3[_0x0404('0x2d')][_0x0404('0x2e')]};});_0x260845[_0x0404('0x2f')]=_[_0x0404('0x30')](_0x2ba933,_0x0404('0x29'));_0x260845[_0x0404('0x31')]=_[_0x0404('0x32')](_0x338d71[_0x0404('0x31')]);_0x260845['filters']=_['intersection'](_0x260845[_0x0404('0x2f')],_0x260845[_0x0404('0x31')]);_0x28a3f4[_0x0404('0x33')]=_[_0x0404('0x34')](_0x260845['model'],qs[_0x0404('0x35')](_0x338d71[_0x0404('0x31')][_0x0404('0x35')]));_0x28a3f4['attributes']=_0x28a3f4[_0x0404('0x33')][_0x0404('0x36')]?_0x28a3f4[_0x0404('0x33')]:_0x260845[_0x0404('0x2f')];if(!_0x338d71[_0x0404('0x31')][_0x0404('0x37')](_0x0404('0x38'))){_0x28a3f4[_0x0404('0x39')]=qs[_0x0404('0x39')](_0x338d71[_0x0404('0x31')][_0x0404('0x39')]);_0x28a3f4[_0x0404('0x20')]=qs[_0x0404('0x20')](_0x338d71[_0x0404('0x31')]['offset']);}_0x28a3f4[_0x0404('0x3a')]=qs[_0x0404('0x3b')](_0x338d71[_0x0404('0x31')][_0x0404('0x3b')]);_0x28a3f4['where']=qs['filters'](_[_0x0404('0x3c')](_0x338d71['query'],_0x260845[_0x0404('0x3d')]),_0x2ba933);if(_0x338d71['query'][_0x0404('0x3e')]){_0x28a3f4[_0x0404('0x3f')]=_[_0x0404('0x40')](_0x28a3f4[_0x0404('0x3f')],{'$or':_[_0x0404('0x30')](_0x2ba933,function(_0x447172){if(_0x447172[_0x0404('0x2d')]!=='VIRTUAL'){var _0x49968f={};_0x49968f[_0x447172[_0x0404('0x29')]]={'$like':'%'+_0x338d71['query'][_0x0404('0x3e')]+'%'};return _0x49968f;}})});}_0x28a3f4=_[_0x0404('0x40')]({},_0x28a3f4,_0x338d71[_0x0404('0x41')]);var _0x166590={'where':_0x28a3f4[_0x0404('0x3f')]};return db[_0x0404('0x2b')]['count'](_0x166590)[_0x0404('0x25')](function(_0x4e5c93){_0x214d85['count']=_0x4e5c93;if(_0x338d71[_0x0404('0x31')]['includeAll']){_0x28a3f4[_0x0404('0x42')]=[{'all':!![]}];}return db[_0x0404('0x2b')][_0x0404('0x43')](_0x28a3f4);})[_0x0404('0x25')](function(_0x188fda){_0x214d85[_0x0404('0x44')]=_0x188fda;return _0x214d85;})[_0x0404('0x25')](respondWithFilteredResult(_0x91b50f,_0x28a3f4))[_0x0404('0x45')](handleError(_0x91b50f,null));};exports[_0x0404('0x46')]=function(_0x52f14e,_0x5c3c91){var _0xf00f0a={'raw':![],'where':{'id':_0x52f14e[_0x0404('0x47')]['id']}},_0x3f56de={};_0x3f56de['model']=_[_0x0404('0x32')](db['Automation'][_0x0404('0x2c')]);_0x3f56de[_0x0404('0x31')]=_[_0x0404('0x32')](_0x52f14e[_0x0404('0x31')]);_0x3f56de['filters']=_[_0x0404('0x34')](_0x3f56de[_0x0404('0x2f')],_0x3f56de[_0x0404('0x31')]);_0xf00f0a['attributes']=_[_0x0404('0x34')](_0x3f56de[_0x0404('0x2f')],qs['fields'](_0x52f14e[_0x0404('0x31')]['fields']));_0xf00f0a['attributes']=_0xf00f0a[_0x0404('0x33')][_0x0404('0x36')]?_0xf00f0a[_0x0404('0x33')]:_0x3f56de[_0x0404('0x2f')];if(_0x52f14e['query'][_0x0404('0x48')]){_0xf00f0a[_0x0404('0x42')]=[{'all':!![]}];}_0xf00f0a=_[_0x0404('0x40')]({},_0xf00f0a,_0x52f14e['options']);return db[_0x0404('0x2b')]['find'](_0xf00f0a)[_0x0404('0x25')](handleEntityNotFound(_0x5c3c91,null))['then'](respondWithResult(_0x5c3c91,null))[_0x0404('0x45')](handleError(_0x5c3c91,null));};exports[_0x0404('0x49')]=function(_0x402f82,_0x407a5d){return db[_0x0404('0x2b')][_0x0404('0x49')](_0x402f82[_0x0404('0x4a')],{})[_0x0404('0x25')](respondWithResult(_0x407a5d,0xc9))['catch'](handleError(_0x407a5d,null));};exports[_0x0404('0x24')]=function(_0x3e62ba,_0x4e3b47){if(_0x3e62ba[_0x0404('0x4a')]['id']){delete _0x3e62ba['body']['id'];}return db[_0x0404('0x2b')]['find']({'where':{'id':_0x3e62ba['params']['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x4e3b47,null))[_0x0404('0x25')](saveUpdates(_0x3e62ba[_0x0404('0x4a')],null))[_0x0404('0x25')](respondWithResult(_0x4e3b47,null))[_0x0404('0x45')](handleError(_0x4e3b47,null));};exports[_0x0404('0x26')]=function(_0x1c2b5e,_0x58a67e){return db[_0x0404('0x2b')][_0x0404('0x4b')]({'where':{'id':_0x1c2b5e[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x58a67e,null))[_0x0404('0x25')](removeEntity(_0x58a67e,null))['catch'](handleError(_0x58a67e,null));};exports[_0x0404('0x4c')]=function(_0x46ab76,_0x57bdb3,_0x159862){return db[_0x0404('0x4d')][_0x0404('0x4b')]({'where':{'id':_0x46ab76[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x57bdb3,null))['then'](function(_0x5ca9ab){if(_0x5ca9ab){return _0x5ca9ab[_0x0404('0x4c')](_0x46ab76[_0x0404('0x4a')][_0x0404('0x4e')],_[_0x0404('0x4f')](_0x46ab76[_0x0404('0x4a')],[_0x0404('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x57bdb3,null))[_0x0404('0x45')](handleError(_0x57bdb3,null));};exports['getConditions']=function(_0x459cc1,_0x5051ca,_0x25f908){var _0x288eb2={};var _0x109d42={};var _0x49cad7;var _0x5246f4;return db[_0x0404('0x2b')]['findOne']({'where':{'id':_0x459cc1[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x5051ca,null))[_0x0404('0x25')](function(_0x4dc68a){if(_0x4dc68a){_0x49cad7=_0x4dc68a;_0x109d42[_0x0404('0x2f')]=_[_0x0404('0x32')](db[_0x0404('0x4d')]['rawAttributes']);_0x109d42['query']=_[_0x0404('0x32')](_0x459cc1[_0x0404('0x31')]);_0x109d42[_0x0404('0x3d')]=_[_0x0404('0x34')](_0x109d42[_0x0404('0x2f')],_0x109d42[_0x0404('0x31')]);_0x288eb2['attributes']=_['intersection'](_0x109d42['model'],qs['fields'](_0x459cc1[_0x0404('0x31')]['fields']));_0x288eb2[_0x0404('0x33')]=_0x288eb2[_0x0404('0x33')]['length']?_0x288eb2[_0x0404('0x33')]:_0x109d42[_0x0404('0x2f')];_0x288eb2[_0x0404('0x3a')]=qs[_0x0404('0x3b')](_0x459cc1[_0x0404('0x31')][_0x0404('0x3b')]);_0x288eb2[_0x0404('0x3f')]=qs[_0x0404('0x3d')](_[_0x0404('0x3c')](_0x459cc1['query'],_0x109d42[_0x0404('0x3d')]));if(_0x459cc1[_0x0404('0x31')][_0x0404('0x3e')]){_0x288eb2[_0x0404('0x3f')]=_[_0x0404('0x40')](_0x288eb2[_0x0404('0x3f')],{'$or':_[_0x0404('0x30')](_0x288eb2['attributes'],function(_0x1854f3){var _0x5be71d={};_0x5be71d[_0x1854f3]={'$like':'%'+_0x459cc1[_0x0404('0x31')][_0x0404('0x3e')]+'%'};return _0x5be71d;})});}_0x288eb2=_[_0x0404('0x40')]({},_0x288eb2,_0x459cc1[_0x0404('0x41')]);return _0x49cad7[_0x0404('0x50')](_0x288eb2);}})['then'](function(_0x1c98fd){if(_0x1c98fd){_0x5246f4=_0x1c98fd[_0x0404('0x36')];if(!_0x459cc1[_0x0404('0x31')]['hasOwnProperty'](_0x0404('0x38'))){_0x288eb2['limit']=qs['limit'](_0x459cc1[_0x0404('0x31')][_0x0404('0x39')]);_0x288eb2['offset']=qs['offset'](_0x459cc1[_0x0404('0x31')][_0x0404('0x20')]);}return _0x49cad7[_0x0404('0x50')](_0x288eb2);}})['then'](function(_0x553526){if(_0x553526){return _0x553526?{'count':_0x5246f4,'rows':_0x553526}:null;}})[_0x0404('0x25')](respondWithResult(_0x5051ca,null))[_0x0404('0x45')](handleError(_0x5051ca,null));};exports[_0x0404('0x51')]=function(_0x3e6b6e,_0x1d9c8b,_0x22c9ce){return db[_0x0404('0x52')][_0x0404('0x4b')]({'where':{'id':_0x3e6b6e[_0x0404('0x47')]['id']}})[_0x0404('0x25')](handleEntityNotFound(_0x1d9c8b,null))['then'](function(_0x5d488c){if(_0x5d488c){return _0x5d488c['addActions'](_0x3e6b6e[_0x0404('0x4a')][_0x0404('0x4e')],_[_0x0404('0x4f')](_0x3e6b6e[_0x0404('0x4a')],[_0x0404('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x1d9c8b,null))[_0x0404('0x45')](handleError(_0x1d9c8b,null));};exports[_0x0404('0x53')]=function(_0x1e611e,_0x4f8e9,_0x40c478){var _0xccb4b1={};var _0x153db6={};var _0x17106e;var _0x2f9b10;return db[_0x0404('0x2b')]['findOne']({'where':{'id':_0x1e611e[_0x0404('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f8e9,null))[_0x0404('0x25')](function(_0x6585ea){if(_0x6585ea){_0x17106e=_0x6585ea;_0x153db6[_0x0404('0x2f')]=_['keys'](db['Action']['rawAttributes']);_0x153db6[_0x0404('0x31')]=_[_0x0404('0x32')](_0x1e611e[_0x0404('0x31')]);_0x153db6[_0x0404('0x3d')]=_['intersection'](_0x153db6[_0x0404('0x2f')],_0x153db6[_0x0404('0x31')]);_0xccb4b1['attributes']=_[_0x0404('0x34')](_0x153db6[_0x0404('0x2f')],qs['fields'](_0x1e611e[_0x0404('0x31')][_0x0404('0x35')]));_0xccb4b1[_0x0404('0x33')]=_0xccb4b1[_0x0404('0x33')][_0x0404('0x36')]?_0xccb4b1[_0x0404('0x33')]:_0x153db6['model'];_0xccb4b1[_0x0404('0x3a')]=qs['sort'](_0x1e611e[_0x0404('0x31')][_0x0404('0x3b')]);_0xccb4b1[_0x0404('0x3f')]=qs[_0x0404('0x3d')](_[_0x0404('0x3c')](_0x1e611e['query'],_0x153db6['filters']));if(_0x1e611e[_0x0404('0x31')][_0x0404('0x3e')]){_0xccb4b1[_0x0404('0x3f')]=_[_0x0404('0x40')](_0xccb4b1[_0x0404('0x3f')],{'$or':_[_0x0404('0x30')](_0xccb4b1[_0x0404('0x33')],function(_0xec98f1){var _0x5e461e={};_0x5e461e[_0xec98f1]={'$like':'%'+_0x1e611e['query'][_0x0404('0x3e')]+'%'};return _0x5e461e;})});}_0xccb4b1=_['merge']({},_0xccb4b1,_0x1e611e[_0x0404('0x41')]);return _0x17106e[_0x0404('0x53')](_0xccb4b1);}})[_0x0404('0x25')](function(_0x3629ed){if(_0x3629ed){_0x2f9b10=_0x3629ed['length'];if(!_0x1e611e[_0x0404('0x31')][_0x0404('0x37')]('nolimit')){_0xccb4b1[_0x0404('0x39')]=qs[_0x0404('0x39')](_0x1e611e[_0x0404('0x31')]['limit']);_0xccb4b1[_0x0404('0x20')]=qs['offset'](_0x1e611e[_0x0404('0x31')]['offset']);}return _0x17106e['getActions'](_0xccb4b1);}})[_0x0404('0x25')](function(_0x2ee864){if(_0x2ee864){return _0x2ee864?{'count':_0x2f9b10,'rows':_0x2ee864}:null;}})[_0x0404('0x25')](respondWithResult(_0x4f8e9,null))['catch'](handleError(_0x4f8e9,null));}; \ No newline at end of file +var _0x75a3=['model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','length','includeAll','options','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','addActions','getActions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','status','apply','reject','save','update','then','destroy','end','error','name','send','index','map','Automation','rawAttributes','fieldName','type','key'];(function(_0x1f166b,_0x51a201){var _0x3cc857=function(_0x2ed0ca){while(--_0x2ed0ca){_0x1f166b['push'](_0x1f166b['shift']());}};_0x3cc857(++_0x51a201);}(_0x75a3,0x78));var _0x375a=function(_0x3d005b,_0x298e07){_0x3d005b=_0x3d005b-0x0;var _0x40d342=_0x75a3[_0x3d005b];return _0x40d342;};'use strict';var emlformat=require(_0x375a('0x0'));var rimraf=require(_0x375a('0x1'));var zipdir=require(_0x375a('0x2'));var jsonpatch=require(_0x375a('0x3'));var rp=require(_0x375a('0x4'));var moment=require(_0x375a('0x5'));var BPromise=require(_0x375a('0x6'));var Mustache=require(_0x375a('0x7'));var util=require(_0x375a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x375a('0x9'));var _=require(_0x375a('0xa'));var squel=require('squel');var crypto=require(_0x375a('0xb'));var jsforce=require(_0x375a('0xc'));var deskjs=require(_0x375a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x375a('0xe'));var Papa=require(_0x375a('0xf'));var Redis=require('ioredis');var authService=require(_0x375a('0x10'));var qs=require(_0x375a('0x11'));var as=require(_0x375a('0x12'));var hardwareService=require(_0x375a('0x13'));var logger=require(_0x375a('0x14'))('api');var utils=require(_0x375a('0x15'));var config=require(_0x375a('0x16'));var licenseUtil=require(_0x375a('0x17'));var db=require(_0x375a('0x18'))['db'];function respondWithStatusCode(_0x5811be,_0x34e6bb){_0x34e6bb=_0x34e6bb||0xcc;return function(_0x260cd2){if(_0x260cd2){return _0x5811be[_0x375a('0x19')](_0x34e6bb);}return _0x5811be['status'](_0x34e6bb)['end']();};}function respondWithResult(_0x143904,_0x1ab146){_0x1ab146=_0x1ab146||0xc8;return function(_0xaf1e0c){if(_0xaf1e0c){return _0x143904['status'](_0x1ab146)[_0x375a('0x1a')](_0xaf1e0c);}};}function respondWithFilteredResult(_0x313db8,_0x40878e){return function(_0xf15dc){if(_0xf15dc){var _0x4e072c=typeof _0x40878e['offset']==='undefined'&&typeof _0x40878e['limit']===_0x375a('0x1b');var _0x177ccc=_0xf15dc[_0x375a('0x1c')];var _0x56c745=_0x4e072c?0x0:_0x40878e['offset'];var _0x47d094=_0x4e072c?_0xf15dc[_0x375a('0x1c')]:_0x40878e[_0x375a('0x1d')]+_0x40878e['limit'];var _0x2cbd19;if(_0x47d094>=_0x177ccc){_0x47d094=_0x177ccc;_0x2cbd19=0xc8;}else{_0x2cbd19=0xce;}_0x313db8[_0x375a('0x1e')](_0x2cbd19);return _0x313db8['set']('Content-Range',_0x56c745+'-'+_0x47d094+'/'+_0x177ccc)[_0x375a('0x1a')](_0xf15dc);}return null;};}function patchUpdates(_0x10063c){return function(_0x38c9a4){try{jsonpatch[_0x375a('0x1f')](_0x38c9a4,_0x10063c,!![]);}catch(_0x57ef8f){return BPromise[_0x375a('0x20')](_0x57ef8f);}return _0x38c9a4[_0x375a('0x21')]();};}function saveUpdates(_0x19c3d1,_0x37e3d6){return function(_0x2874e9){if(_0x2874e9){return _0x2874e9[_0x375a('0x22')](_0x19c3d1)[_0x375a('0x23')](function(_0x400545){return _0x400545;});}return null;};}function removeEntity(_0x58571c,_0x30b3a8){return function(_0x4cc510){if(_0x4cc510){return _0x4cc510[_0x375a('0x24')]()[_0x375a('0x23')](function(){_0x58571c['status'](0xcc)[_0x375a('0x25')]();});}};}function handleEntityNotFound(_0x214fec,_0x2914ac){return function(_0x38088c){if(!_0x38088c){_0x214fec['sendStatus'](0x194);}return _0x38088c;};}function handleError(_0x1ef891,_0x280a5e){_0x280a5e=_0x280a5e||0x1f4;return function(_0x7d942f){logger[_0x375a('0x26')](_0x7d942f['stack']);if(_0x7d942f[_0x375a('0x27')]){delete _0x7d942f[_0x375a('0x27')];}_0x1ef891[_0x375a('0x1e')](_0x280a5e)[_0x375a('0x28')](_0x7d942f);};}exports[_0x375a('0x29')]=function(_0x13a2c8,_0x5c6bc8){var _0x2efc99={},_0x16dce7={},_0xa9270a={'count':0x0,'rows':[]};var _0x1e8b54=_[_0x375a('0x2a')](db[_0x375a('0x2b')][_0x375a('0x2c')],function(_0x29489f){return{'name':_0x29489f[_0x375a('0x2d')],'type':_0x29489f[_0x375a('0x2e')][_0x375a('0x2f')]};});_0x16dce7[_0x375a('0x30')]=_[_0x375a('0x2a')](_0x1e8b54,'name');_0x16dce7['query']=_[_0x375a('0x31')](_0x13a2c8[_0x375a('0x32')]);_0x16dce7[_0x375a('0x33')]=_[_0x375a('0x34')](_0x16dce7[_0x375a('0x30')],_0x16dce7['query']);_0x2efc99['attributes']=_[_0x375a('0x34')](_0x16dce7[_0x375a('0x30')],qs[_0x375a('0x35')](_0x13a2c8[_0x375a('0x32')][_0x375a('0x35')]));_0x2efc99[_0x375a('0x36')]=_0x2efc99[_0x375a('0x36')]['length']?_0x2efc99[_0x375a('0x36')]:_0x16dce7['model'];if(!_0x13a2c8[_0x375a('0x32')][_0x375a('0x37')]('nolimit')){_0x2efc99['limit']=qs[_0x375a('0x38')](_0x13a2c8[_0x375a('0x32')][_0x375a('0x38')]);_0x2efc99[_0x375a('0x1d')]=qs[_0x375a('0x1d')](_0x13a2c8[_0x375a('0x32')][_0x375a('0x1d')]);}_0x2efc99[_0x375a('0x39')]=qs[_0x375a('0x3a')](_0x13a2c8['query'][_0x375a('0x3a')]);_0x2efc99[_0x375a('0x3b')]=qs[_0x375a('0x33')](_[_0x375a('0x3c')](_0x13a2c8[_0x375a('0x32')],_0x16dce7['filters']),_0x1e8b54);if(_0x13a2c8[_0x375a('0x32')][_0x375a('0x3d')]){_0x2efc99[_0x375a('0x3b')]=_[_0x375a('0x3e')](_0x2efc99[_0x375a('0x3b')],{'$or':_[_0x375a('0x2a')](_0x1e8b54,function(_0x1d254a){if(_0x1d254a[_0x375a('0x2e')]!==_0x375a('0x3f')){var _0x1465b5={};_0x1465b5[_0x1d254a[_0x375a('0x27')]]={'$like':'%'+_0x13a2c8[_0x375a('0x32')][_0x375a('0x3d')]+'%'};return _0x1465b5;}})});}_0x2efc99=_[_0x375a('0x3e')]({},_0x2efc99,_0x13a2c8['options']);var _0x261602={'where':_0x2efc99[_0x375a('0x3b')]};return db[_0x375a('0x2b')][_0x375a('0x1c')](_0x261602)['then'](function(_0x4cd89d){_0xa9270a[_0x375a('0x1c')]=_0x4cd89d;if(_0x13a2c8['query']['includeAll']){_0x2efc99[_0x375a('0x40')]=[{'all':!![]}];}return db[_0x375a('0x2b')]['findAll'](_0x2efc99);})[_0x375a('0x23')](function(_0x2702b5){_0xa9270a[_0x375a('0x41')]=_0x2702b5;return _0xa9270a;})[_0x375a('0x23')](respondWithFilteredResult(_0x5c6bc8,_0x2efc99))[_0x375a('0x42')](handleError(_0x5c6bc8,null));};exports[_0x375a('0x43')]=function(_0xe0d6f1,_0x26c7ca){var _0x421dda={'raw':![],'where':{'id':_0xe0d6f1[_0x375a('0x44')]['id']}},_0x37ba36={};_0x37ba36[_0x375a('0x30')]=_[_0x375a('0x31')](db['Automation']['rawAttributes']);_0x37ba36['query']=_['keys'](_0xe0d6f1[_0x375a('0x32')]);_0x37ba36[_0x375a('0x33')]=_[_0x375a('0x34')](_0x37ba36[_0x375a('0x30')],_0x37ba36[_0x375a('0x32')]);_0x421dda[_0x375a('0x36')]=_[_0x375a('0x34')](_0x37ba36[_0x375a('0x30')],qs[_0x375a('0x35')](_0xe0d6f1[_0x375a('0x32')][_0x375a('0x35')]));_0x421dda[_0x375a('0x36')]=_0x421dda[_0x375a('0x36')][_0x375a('0x45')]?_0x421dda[_0x375a('0x36')]:_0x37ba36['model'];if(_0xe0d6f1['query'][_0x375a('0x46')]){_0x421dda[_0x375a('0x40')]=[{'all':!![]}];}_0x421dda=_[_0x375a('0x3e')]({},_0x421dda,_0xe0d6f1[_0x375a('0x47')]);return db['Automation'][_0x375a('0x48')](_0x421dda)['then'](handleEntityNotFound(_0x26c7ca,null))[_0x375a('0x23')](respondWithResult(_0x26c7ca,null))[_0x375a('0x42')](handleError(_0x26c7ca,null));};exports[_0x375a('0x49')]=function(_0x4f721e,_0x157ab3){return db[_0x375a('0x2b')][_0x375a('0x49')](_0x4f721e[_0x375a('0x4a')],{})[_0x375a('0x23')](respondWithResult(_0x157ab3,0xc9))['catch'](handleError(_0x157ab3,null));};exports['update']=function(_0x5df68b,_0x5e326c){if(_0x5df68b[_0x375a('0x4a')]['id']){delete _0x5df68b['body']['id'];}return db['Automation'][_0x375a('0x48')]({'where':{'id':_0x5df68b[_0x375a('0x44')]['id']}})[_0x375a('0x23')](handleEntityNotFound(_0x5e326c,null))[_0x375a('0x23')](saveUpdates(_0x5df68b['body'],null))[_0x375a('0x23')](respondWithResult(_0x5e326c,null))[_0x375a('0x42')](handleError(_0x5e326c,null));};exports[_0x375a('0x24')]=function(_0x43c78d,_0x94ca21){return db['Automation'][_0x375a('0x48')]({'where':{'id':_0x43c78d['params']['id']}})['then'](handleEntityNotFound(_0x94ca21,null))[_0x375a('0x23')](removeEntity(_0x94ca21,null))[_0x375a('0x42')](handleError(_0x94ca21,null));};exports[_0x375a('0x4b')]=function(_0x280992,_0x11d716,_0x1215ba){return db[_0x375a('0x4c')][_0x375a('0x48')]({'where':{'id':_0x280992[_0x375a('0x44')]['id']}})[_0x375a('0x23')](handleEntityNotFound(_0x11d716,null))[_0x375a('0x23')](function(_0x5798cd){if(_0x5798cd){return _0x5798cd[_0x375a('0x4b')](_0x280992['body'][_0x375a('0x4d')],_[_0x375a('0x4e')](_0x280992['body'],[_0x375a('0x4d'),'id'])||{});}})[_0x375a('0x23')](respondWithResult(_0x11d716,null))[_0x375a('0x42')](handleError(_0x11d716,null));};exports['getConditions']=function(_0x1a4e31,_0x271fd,_0x514b67){var _0x4494bb={};var _0x4c7e42={};var _0x131f2b;var _0x289abd;return db[_0x375a('0x2b')][_0x375a('0x4f')]({'where':{'id':_0x1a4e31[_0x375a('0x44')]['id']}})[_0x375a('0x23')](handleEntityNotFound(_0x271fd,null))[_0x375a('0x23')](function(_0x585def){if(_0x585def){_0x131f2b=_0x585def;_0x4c7e42[_0x375a('0x30')]=_[_0x375a('0x31')](db['Condition'][_0x375a('0x2c')]);_0x4c7e42[_0x375a('0x32')]=_[_0x375a('0x31')](_0x1a4e31[_0x375a('0x32')]);_0x4c7e42[_0x375a('0x33')]=_[_0x375a('0x34')](_0x4c7e42[_0x375a('0x30')],_0x4c7e42[_0x375a('0x32')]);_0x4494bb['attributes']=_['intersection'](_0x4c7e42[_0x375a('0x30')],qs[_0x375a('0x35')](_0x1a4e31[_0x375a('0x32')][_0x375a('0x35')]));_0x4494bb[_0x375a('0x36')]=_0x4494bb[_0x375a('0x36')]['length']?_0x4494bb[_0x375a('0x36')]:_0x4c7e42['model'];_0x4494bb[_0x375a('0x39')]=qs[_0x375a('0x3a')](_0x1a4e31[_0x375a('0x32')][_0x375a('0x3a')]);_0x4494bb[_0x375a('0x3b')]=qs[_0x375a('0x33')](_['pick'](_0x1a4e31['query'],_0x4c7e42[_0x375a('0x33')]));if(_0x1a4e31[_0x375a('0x32')][_0x375a('0x3d')]){_0x4494bb[_0x375a('0x3b')]=_[_0x375a('0x3e')](_0x4494bb[_0x375a('0x3b')],{'$or':_[_0x375a('0x2a')](_0x4494bb['attributes'],function(_0x435ffd){var _0x3919d9={};_0x3919d9[_0x435ffd]={'$like':'%'+_0x1a4e31[_0x375a('0x32')][_0x375a('0x3d')]+'%'};return _0x3919d9;})});}_0x4494bb=_[_0x375a('0x3e')]({},_0x4494bb,_0x1a4e31[_0x375a('0x47')]);return _0x131f2b['getConditions'](_0x4494bb);}})['then'](function(_0x409805){if(_0x409805){_0x289abd=_0x409805[_0x375a('0x45')];if(!_0x1a4e31[_0x375a('0x32')][_0x375a('0x37')]('nolimit')){_0x4494bb[_0x375a('0x38')]=qs[_0x375a('0x38')](_0x1a4e31['query']['limit']);_0x4494bb['offset']=qs[_0x375a('0x1d')](_0x1a4e31[_0x375a('0x32')]['offset']);}return _0x131f2b[_0x375a('0x50')](_0x4494bb);}})[_0x375a('0x23')](function(_0x5c23ed){if(_0x5c23ed){return _0x5c23ed?{'count':_0x289abd,'rows':_0x5c23ed}:null;}})[_0x375a('0x23')](respondWithResult(_0x271fd,null))[_0x375a('0x42')](handleError(_0x271fd,null));};exports[_0x375a('0x51')]=function(_0x52fa7a,_0x2345ae,_0x47c9df){return db['Action'][_0x375a('0x48')]({'where':{'id':_0x52fa7a['params']['id']}})['then'](handleEntityNotFound(_0x2345ae,null))[_0x375a('0x23')](function(_0x7b5607){if(_0x7b5607){return _0x7b5607[_0x375a('0x51')](_0x52fa7a[_0x375a('0x4a')]['ids'],_['omit'](_0x52fa7a[_0x375a('0x4a')],[_0x375a('0x4d'),'id'])||{});}})[_0x375a('0x23')](respondWithResult(_0x2345ae,null))['catch'](handleError(_0x2345ae,null));};exports[_0x375a('0x52')]=function(_0x162dc1,_0x1a1adc,_0x29a005){var _0x16aac7={};var _0x34272b={};var _0x4de058;var _0x297539;return db[_0x375a('0x2b')][_0x375a('0x4f')]({'where':{'id':_0x162dc1[_0x375a('0x44')]['id']}})[_0x375a('0x23')](handleEntityNotFound(_0x1a1adc,null))[_0x375a('0x23')](function(_0xc94b2c){if(_0xc94b2c){_0x4de058=_0xc94b2c;_0x34272b[_0x375a('0x30')]=_[_0x375a('0x31')](db['Action'][_0x375a('0x2c')]);_0x34272b[_0x375a('0x32')]=_[_0x375a('0x31')](_0x162dc1[_0x375a('0x32')]);_0x34272b['filters']=_[_0x375a('0x34')](_0x34272b[_0x375a('0x30')],_0x34272b[_0x375a('0x32')]);_0x16aac7[_0x375a('0x36')]=_[_0x375a('0x34')](_0x34272b['model'],qs[_0x375a('0x35')](_0x162dc1[_0x375a('0x32')][_0x375a('0x35')]));_0x16aac7['attributes']=_0x16aac7[_0x375a('0x36')]['length']?_0x16aac7[_0x375a('0x36')]:_0x34272b[_0x375a('0x30')];_0x16aac7[_0x375a('0x39')]=qs[_0x375a('0x3a')](_0x162dc1[_0x375a('0x32')][_0x375a('0x3a')]);_0x16aac7[_0x375a('0x3b')]=qs[_0x375a('0x33')](_[_0x375a('0x3c')](_0x162dc1[_0x375a('0x32')],_0x34272b[_0x375a('0x33')]));if(_0x162dc1['query'][_0x375a('0x3d')]){_0x16aac7[_0x375a('0x3b')]=_[_0x375a('0x3e')](_0x16aac7[_0x375a('0x3b')],{'$or':_['map'](_0x16aac7[_0x375a('0x36')],function(_0x25cfb7){var _0x2f6abc={};_0x2f6abc[_0x25cfb7]={'$like':'%'+_0x162dc1['query']['filter']+'%'};return _0x2f6abc;})});}_0x16aac7=_[_0x375a('0x3e')]({},_0x16aac7,_0x162dc1[_0x375a('0x47')]);return _0x4de058[_0x375a('0x52')](_0x16aac7);}})[_0x375a('0x23')](function(_0x7b6105){if(_0x7b6105){_0x297539=_0x7b6105[_0x375a('0x45')];if(!_0x162dc1[_0x375a('0x32')][_0x375a('0x37')](_0x375a('0x53'))){_0x16aac7['limit']=qs['limit'](_0x162dc1['query'][_0x375a('0x38')]);_0x16aac7[_0x375a('0x1d')]=qs[_0x375a('0x1d')](_0x162dc1[_0x375a('0x32')][_0x375a('0x1d')]);}return _0x4de058[_0x375a('0x52')](_0x16aac7);}})[_0x375a('0x23')](function(_0x242c7c){if(_0x242c7c){return _0x242c7c?{'count':_0x297539,'rows':_0x242c7c}:null;}})['then'](respondWithResult(_0x1a1adc,null))[_0x375a('0x42')](handleError(_0x1a1adc,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2cec904..96003b5 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 _0xa15d=['rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','util','moment','bluebird','request-promise','path'];(function(_0x691a6c,_0x2fd078){var _0x70d560=function(_0x54b2d8){while(--_0x54b2d8){_0x691a6c['push'](_0x691a6c['shift']());}};_0x70d560(++_0x2fd078);}(_0xa15d,0xf8));var _0xda15=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xa15d[_0x4a93bb];return _0x208468;};'use strict';var _=require('lodash');var util=require(_0xda15('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xda15('0x1'));var BPromise=require(_0xda15('0x2'));var rp=require(_0xda15('0x3'));var fs=require('fs');var path=require(_0xda15('0x4'));var rimraf=require(_0xda15('0x5'));var config=require(_0xda15('0x6'));var attributes=require(_0xda15('0x7'));module[_0xda15('0x8')]=function(_0x42f384,_0x39d090){return _0x42f384['define'](_0xda15('0x9'),attributes,{'tableName':_0xda15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5a8=['bluebird','request-promise','path','rimraf','../../config/environment','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0x55c10e,_0x316772){var _0x2a9399=function(_0x1de638){while(--_0x1de638){_0x55c10e['push'](_0x55c10e['shift']());}};_0x2a9399(++_0x316772);}(_0xd5a8,0xb1));var _0x8d5a=function(_0xbe499b,_0x3af60c){_0xbe499b=_0xbe499b-0x0;var _0x482afe=_0xd5a8[_0xbe499b];return _0x482afe;};'use strict';var _=require(_0x8d5a('0x0'));var util=require(_0x8d5a('0x1'));var logger=require(_0x8d5a('0x2'))(_0x8d5a('0x3'));var moment=require(_0x8d5a('0x4'));var BPromise=require(_0x8d5a('0x5'));var rp=require(_0x8d5a('0x6'));var fs=require('fs');var path=require(_0x8d5a('0x7'));var rimraf=require(_0x8d5a('0x8'));var config=require(_0x8d5a('0x9'));var attributes=require('./automation.attributes');module['exports']=function(_0x56de2f,_0x1dbfba){return _0x56de2f[_0x8d5a('0xa')](_0x8d5a('0xb'),attributes,{'tableName':_0x8d5a('0xc'),'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 384c5b9..86dc0e3 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 _0xc274=['../../config/logger','rpc','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c0814,_0xd84796){var _0x4e2bd9=function(_0x4d53cc){while(--_0x4d53cc){_0x1c0814['push'](_0x1c0814['shift']());}};_0x4e2bd9(++_0xd84796);}(_0xc274,0x151));var _0x4c27=function(_0x34d7ec,_0x5abd13){_0x34d7ec=_0x34d7ec-0x0;var _0x5cdb4e=_0xc274[_0x34d7ec];return _0x5cdb4e;};'use strict';var _=require('lodash');var util=require(_0x4c27('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c27('0x1'));var fs=require('fs');var Redis=require(_0x4c27('0x2'));var db=require(_0x4c27('0x3'))['db'];var utils=require(_0x4c27('0x4'));var logger=require(_0x4c27('0x5'))(_0x4c27('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c27('0x7'));var client=jayson['client'][_0x4c27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18fd2c,_0x38de2d,_0x5f5058){return new BPromise(function(_0x478a91,_0x36daa2){return client['request'](_0x18fd2c,_0x5f5058)[_0x4c27('0x9')](function(_0x2a0c76){logger[_0x4c27('0xa')](_0x4c27('0xb'),_0x38de2d,_0x4c27('0xc'));logger['debug'](_0x4c27('0xd'),_0x38de2d,_0x4c27('0xc'),JSON[_0x4c27('0xe')](_0x2a0c76));if(_0x2a0c76[_0x4c27('0xf')]){if(_0x2a0c76['error']['code']===0x1f4){logger[_0x4c27('0xf')](_0x4c27('0xb'),_0x38de2d,_0x2a0c76['error']['message']);return _0x36daa2(_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);}logger[_0x4c27('0xf')]('Automation,\x20%s,\x20%s',_0x38de2d,_0x2a0c76[_0x4c27('0xf')][_0x4c27('0x10')]);return _0x478a91(_0x2a0c76[_0x4c27('0xf')]['message']);}else{logger[_0x4c27('0xa')]('Automation,\x20%s,\x20%s',_0x38de2d,'request\x20sent');_0x478a91(_0x2a0c76[_0x4c27('0x11')][_0x4c27('0x10')]);}})[_0x4c27('0x12')](function(_0x4762ad){logger['error'](_0x4c27('0xb'),_0x38de2d,_0x4762ad);_0x36daa2(_0x4762ad);});});} \ No newline at end of file +var _0x63a6=['../../config/environment','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5bc1f2,_0x38509c){var _0x5f22f4=function(_0x4b51a2){while(--_0x4b51a2){_0x5bc1f2['push'](_0x5bc1f2['shift']());}};_0x5f22f4(++_0x38509c);}(_0x63a6,0x1c7));var _0x663a=function(_0xa1de8d,_0x1399a8){_0xa1de8d=_0xa1de8d-0x0;var _0x478b44=_0x63a6[_0xa1de8d];return _0x478b44;};'use strict';var _=require('lodash');var util=require(_0x663a('0x0'));var moment=require(_0x663a('0x1'));var BPromise=require('bluebird');var rs=require(_0x663a('0x2'));var fs=require('fs');var Redis=require(_0x663a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x663a('0x4'));var logger=require(_0x663a('0x5'))(_0x663a('0x6'));var config=require(_0x663a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14b552,_0x20203b,_0x4b1314){return new BPromise(function(_0x4d4249,_0x326b53){return client[_0x663a('0x8')](_0x14b552,_0x4b1314)[_0x663a('0x9')](function(_0x4aa93a){logger['info'](_0x663a('0xa'),_0x20203b,_0x663a('0xb'));logger[_0x663a('0xc')](_0x663a('0xd'),_0x20203b,_0x663a('0xb'),JSON[_0x663a('0xe')](_0x4aa93a));if(_0x4aa93a['error']){if(_0x4aa93a[_0x663a('0xf')][_0x663a('0x10')]===0x1f4){logger[_0x663a('0xf')]('Automation,\x20%s,\x20%s',_0x20203b,_0x4aa93a['error'][_0x663a('0x11')]);return _0x326b53(_0x4aa93a['error']['message']);}logger[_0x663a('0xf')](_0x663a('0xa'),_0x20203b,_0x4aa93a['error'][_0x663a('0x11')]);return _0x4d4249(_0x4aa93a['error'][_0x663a('0x11')]);}else{logger[_0x663a('0x12')](_0x663a('0xa'),_0x20203b,_0x663a('0xb'));_0x4d4249(_0x4aa93a[_0x663a('0x13')]['message']);}})[_0x663a('0x14')](function(_0x5cc6ab){logger[_0x663a('0xf')](_0x663a('0xa'),_0x20203b,_0x5cc6ab);_0x326b53(_0x5cc6ab);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6bc8775..e7afb2a 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 _0x55e0=['isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x55e0,0xdc));var _0x055e=function(_0x560fc6,_0x59bd68){_0x560fc6=_0x560fc6-0x0;var _0x14d08a=_0x55e0[_0x560fc6];return _0x14d08a;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['getConditions']);router[_0x055e('0x9')](_0x055e('0xd'),auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x055e('0xf')]('/:id/conditions',auth[_0x055e('0xa')](),controller[_0x055e('0x10')]);router[_0x055e('0xf')](_0x055e('0xd'),auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);router[_0x055e('0x12')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x13')]);router[_0x055e('0x14')](_0x055e('0x15'),auth[_0x055e('0xa')](),controller['destroy']);module[_0x055e('0x16')]=router; \ No newline at end of file +var _0xd04b=['update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions'];(function(_0x248a82,_0x4fca3e){var _0x4bef56=function(_0x1d68f6){while(--_0x1d68f6){_0x248a82['push'](_0x248a82['shift']());}};_0x4bef56(++_0x4fca3e);}(_0xd04b,0x145));var _0xbd04=function(_0x38693e,_0xd16b24){_0x38693e=_0x38693e-0x0;var _0x4db10a=_0xd04b[_0x38693e];return _0x4db10a;};'use strict';var multer=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var path=require(_0xbd04('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd04('0x3'));var router=express['Router']();var fs_extra=require(_0xbd04('0x4'));var auth=require(_0xbd04('0x5'));var interaction=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var controller=require(_0xbd04('0x8'));router[_0xbd04('0x9')]('/',auth[_0xbd04('0xa')](),controller[_0xbd04('0xb')]);router[_0xbd04('0x9')](_0xbd04('0xc'),auth[_0xbd04('0xa')](),controller['show']);router[_0xbd04('0x9')](_0xbd04('0xd'),auth[_0xbd04('0xa')](),controller[_0xbd04('0xe')]);router[_0xbd04('0x9')](_0xbd04('0xf'),auth[_0xbd04('0xa')](),controller[_0xbd04('0x10')]);router['post']('/',auth[_0xbd04('0xa')](),controller[_0xbd04('0x11')]);router[_0xbd04('0x12')](_0xbd04('0xd'),auth['isAuthenticated'](),controller[_0xbd04('0x13')]);router[_0xbd04('0x12')](_0xbd04('0xf'),auth['isAuthenticated'](),controller['addActions']);router['put']('/:id',auth[_0xbd04('0xa')](),controller[_0xbd04('0x14')]);router[_0xbd04('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbd04('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 e523a90..08c3c93 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 _0x18f3=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','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\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x126f6e,_0xee248a){var _0x1df007=function(_0x1ded1f){while(--_0x1ded1f){_0x126f6e['push'](_0x126f6e['shift']());}};_0x1df007(++_0xee248a);}(_0x18f3,0x19f));var _0x318f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x18f3[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require('sequelize');module[_0x318f('0x0')]={'name':{'type':Sequelize[_0x318f('0x1')],'unique':_0x318f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x318f('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x318f('0x4')],'defaultValue':0x0,'comment':_0x318f('0x5')},'limitCalls':{'type':Sequelize[_0x318f('0x6')](0x4)[_0x318f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x318f('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x318f('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'comment':_0x318f('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x318f('0xe')},'dialTimezone':{'type':Sequelize[_0x318f('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x318f('0x1')],'defaultValue':_0x318f('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x318f('0x10')]('always',_0x318f('0x11'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x318f('0x4')],'defaultValue':0x0,'comment':_0x318f('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x318f('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x318f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x318f('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x318f('0x6')](0x9)[_0x318f('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x318f('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x318f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x318f('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x318f('0x6')](0x9)[_0x318f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x318f('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x318f('0x6')](0x9)[_0x318f('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x318f('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x318f('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x318f('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x318f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x318f('0x10')]('DESC',_0x318f('0x1a')),'defaultValue':_0x318f('0x1b')},'dialPrefix':{'type':Sequelize[_0x318f('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x318f('0x1c')},'dialCutDigit':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x318f('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x318f('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x318f('0x6')](0x3)[_0x318f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x318f('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x318f('0x6')](0x5)[_0x318f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xae41=['#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_0xae41,0xaf));var _0x1ae4=function(_0x4e0908,_0x2fcd04){_0x4e0908=_0x4e0908-0x0;var _0xb6ec20=_0xae41[_0x4e0908];return _0xb6ec20;};'use strict';var Sequelize=require(_0x1ae4('0x0'));module[_0x1ae4('0x1')]={'name':{'type':Sequelize[_0x1ae4('0x2')],'unique':_0x1ae4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x1ae4('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1ae4('0x4')},'limitCalls':{'type':Sequelize[_0x1ae4('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1ae4('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1ae4('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ae4('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1ae4('0x5')](0x5)[_0x1ae4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1ae4('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ae4('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'defaultValue':0x3,'comment':_0x1ae4('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1ae4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ae4('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1ae4('0xc')},'dialTimezone':{'type':Sequelize[_0x1ae4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1ae4('0xd')](_0x1ae4('0xe'),_0x1ae4('0xf'),_0x1ae4('0x10')),'defaultValue':_0x1ae4('0xe')},'dialAMDActive':{'type':Sequelize[_0x1ae4('0x11')],'defaultValue':0x0,'comment':_0x1ae4('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1ae4('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1ae4('0x5')](0x9)[_0x1ae4('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1ae4('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1ae4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1ae4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ae4('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x1ae4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1ae4('0x5')](0x9)[_0x1ae4('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1ae4('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1ae4('0x5')](0x9)[_0x1ae4('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1ae4('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1ae4('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1ae4('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1ae4('0x5')](0x9)[_0x1ae4('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ae4('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1ae4('0x19'),_0x1ae4('0x1a')),'defaultValue':_0x1ae4('0x19')},'dialPrefix':{'type':Sequelize[_0x1ae4('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ae4('0x1b')},'dialCutDigit':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ae4('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1ae4('0x5')](0x5)[_0x1ae4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ae4('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ae4('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1ae4('0x5')](0x5)[_0x1ae4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ae4('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ae4('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1ae4('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ae4('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ae4('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1ae4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1ae4('0x5')](0x3)[_0x1ae4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ae4('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1ae4('0x5')](0x5)[_0x1ae4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ae4('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 0028ab1..a0ac2b1 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 _0x32d3=['intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','clone','params','length','updatedAt','omit','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','findAll','getHopperHistories','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','field','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','CampaignId\x20=\x20?','into','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x46327a,_0x17137c){var _0x1c6834=function(_0x718d81){while(--_0x718d81){_0x46327a['push'](_0x46327a['shift']());}};_0x1c6834(++_0x17137c);}(_0x32d3,0xee));var _0x332d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x32d3[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x332d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x332d('0x1'));var BPromise=require(_0x332d('0x2'));var Mustache=require(_0x332d('0x3'));var util=require(_0x332d('0x4'));var path=require('path');var sox=require(_0x332d('0x5'));var csv=require('to-csv');var ejs=require(_0x332d('0x6'));var fs=require('fs');var fs_extra=require(_0x332d('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x332d('0x8'));var jsforce=require(_0x332d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x332d('0xa'));var querystring=require('querystring');var Papa=require(_0x332d('0xb'));var Redis=require(_0x332d('0xc'));var authService=require(_0x332d('0xd'));var qs=require(_0x332d('0xe'));var as=require(_0x332d('0xf'));var hardwareService=require(_0x332d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x332d('0x11'));var config=require(_0x332d('0x12'));var licenseUtil=require(_0x332d('0x13'));var db=require(_0x332d('0x14'))['db'];function respondWithStatusCode(_0x40a446,_0xc71fba){_0xc71fba=_0xc71fba||0xcc;return function(_0x295245){if(_0x295245){return _0x40a446['sendStatus'](_0xc71fba);}return _0x40a446[_0x332d('0x15')](_0xc71fba)[_0x332d('0x16')]();};}function respondWithResult(_0x3db576,_0x528377){_0x528377=_0x528377||0xc8;return function(_0x38dc23){if(_0x38dc23){return _0x3db576[_0x332d('0x15')](_0x528377)[_0x332d('0x17')](_0x38dc23);}};}function respondWithFilteredResult(_0x1a4330,_0x118a6d){return function(_0x2896a9){if(_0x2896a9){var _0x5092ca=typeof _0x118a6d[_0x332d('0x18')]==='undefined'&&typeof _0x118a6d['limit']===_0x332d('0x19');var _0xbdb53d=_0x2896a9[_0x332d('0x1a')];var _0xc63cba=_0x5092ca?0x0:_0x118a6d[_0x332d('0x18')];var _0x2edae3=_0x5092ca?_0x2896a9[_0x332d('0x1a')]:_0x118a6d[_0x332d('0x18')]+_0x118a6d['limit'];var _0x5bd6f3;if(_0x2edae3>=_0xbdb53d){_0x2edae3=_0xbdb53d;_0x5bd6f3=0xc8;}else{_0x5bd6f3=0xce;}_0x1a4330[_0x332d('0x15')](_0x5bd6f3);return _0x1a4330[_0x332d('0x1b')]('Content-Range',_0xc63cba+'-'+_0x2edae3+'/'+_0xbdb53d)[_0x332d('0x17')](_0x2896a9);}return null;};}function patchUpdates(_0x46b208){return function(_0x1983e9){try{jsonpatch[_0x332d('0x1c')](_0x1983e9,_0x46b208,!![]);}catch(_0x1c589d){return BPromise['reject'](_0x1c589d);}return _0x1983e9['save']();};}function saveUpdates(_0x56aee9,_0x14fa2f){return function(_0x2dcb2c){if(_0x2dcb2c){return _0x2dcb2c[_0x332d('0x1d')](_0x56aee9)[_0x332d('0x1e')](function(_0x3f421e){return _0x3f421e;});}return null;};}function removeEntity(_0x237fa4,_0x12a398){return function(_0x3b32f0){if(_0x3b32f0){return _0x3b32f0[_0x332d('0x1f')]()[_0x332d('0x1e')](function(){var _0x5263d4=_0x3b32f0[_0x332d('0x20')]({'plain':!![]});var _0x43ce73=_0x332d('0x21');return db[_0x332d('0x22')][_0x332d('0x1f')]({'where':{'type':_0x43ce73,'resourceId':_0x5263d4['id']}})[_0x332d('0x1e')](function(){return _0x3b32f0;});})[_0x332d('0x1e')](function(){_0x237fa4[_0x332d('0x15')](0xcc)[_0x332d('0x16')]();});}};}function handleEntityNotFound(_0x46b5ab,_0x1a3163){return function(_0x599e4f){if(!_0x599e4f){_0x46b5ab['sendStatus'](0x194);}return _0x599e4f;};}function handleError(_0x46c268,_0x1a4a24){_0x1a4a24=_0x1a4a24||0x1f4;return function(_0x2cd43e){logger['error'](_0x2cd43e[_0x332d('0x23')]);if(_0x2cd43e[_0x332d('0x24')]){delete _0x2cd43e[_0x332d('0x24')];}_0x46c268[_0x332d('0x15')](_0x1a4a24)[_0x332d('0x25')](_0x2cd43e);};}exports['index']=function(_0x4367f1,_0xcdd271){var _0x3ff2a3={},_0x233362={},_0x1f53de={'count':0x0,'rows':[]};var _0x47efa1=_[_0x332d('0x26')](db['Campaign'][_0x332d('0x27')],function(_0x166be6){return{'name':_0x166be6[_0x332d('0x28')],'type':_0x166be6[_0x332d('0x29')][_0x332d('0x2a')]};});_0x233362[_0x332d('0x2b')]=_[_0x332d('0x26')](_0x47efa1,'name');_0x233362[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x4367f1['query']);_0x233362['filters']=_[_0x332d('0x2e')](_0x233362['model'],_0x233362['query']);_0x3ff2a3[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x233362[_0x332d('0x2b')],qs['fields'](_0x4367f1[_0x332d('0x2c')][_0x332d('0x30')]));_0x3ff2a3[_0x332d('0x2f')]=_0x3ff2a3[_0x332d('0x2f')]['length']?_0x3ff2a3[_0x332d('0x2f')]:_0x233362[_0x332d('0x2b')];if(!_0x4367f1[_0x332d('0x2c')][_0x332d('0x31')](_0x332d('0x32'))){_0x3ff2a3['limit']=qs[_0x332d('0x33')](_0x4367f1['query'][_0x332d('0x33')]);_0x3ff2a3[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x4367f1[_0x332d('0x2c')]['offset']);}_0x3ff2a3[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x4367f1[_0x332d('0x2c')][_0x332d('0x35')]);_0x3ff2a3[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x4367f1['query'],_0x233362[_0x332d('0x37')]),_0x47efa1);if(_0x4367f1[_0x332d('0x2c')][_0x332d('0x39')]){_0x3ff2a3['where']=_[_0x332d('0x3a')](_0x3ff2a3['where'],{'$or':_[_0x332d('0x26')](_0x47efa1,function(_0x33d38c){if(_0x33d38c[_0x332d('0x29')]!==_0x332d('0x3b')){var _0xb8859c={};_0xb8859c[_0x33d38c[_0x332d('0x24')]]={'$like':'%'+_0x4367f1['query'][_0x332d('0x39')]+'%'};return _0xb8859c;}})});}_0x3ff2a3=_[_0x332d('0x3a')]({},_0x3ff2a3,_0x4367f1[_0x332d('0x3c')]);var _0x36ad78={'where':_0x3ff2a3[_0x332d('0x36')]};return db[_0x332d('0x3d')][_0x332d('0x1a')](_0x36ad78)[_0x332d('0x1e')](function(_0x5e97e3){_0x1f53de[_0x332d('0x1a')]=_0x5e97e3;if(_0x4367f1[_0x332d('0x2c')][_0x332d('0x3e')]){_0x3ff2a3[_0x332d('0x3f')]=[{'all':!![]}];}return db[_0x332d('0x3d')]['findAll'](_0x3ff2a3);})[_0x332d('0x1e')](function(_0x4074e9){_0x1f53de[_0x332d('0x40')]=_0x4074e9;return _0x1f53de;})[_0x332d('0x1e')](respondWithFilteredResult(_0xcdd271,_0x3ff2a3))['catch'](handleError(_0xcdd271,null));};exports[_0x332d('0x41')]=function(_0x192c0a,_0x2df00f){var _0x23bd55={'raw':![],'where':{'id':_0x192c0a['params']['id']}},_0x3fa8fe={};_0x3fa8fe[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['Campaign'][_0x332d('0x27')]);_0x3fa8fe[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x192c0a[_0x332d('0x2c')]);_0x3fa8fe[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x3fa8fe[_0x332d('0x2b')],_0x3fa8fe[_0x332d('0x2c')]);_0x23bd55[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x3fa8fe[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x192c0a[_0x332d('0x2c')][_0x332d('0x30')]));_0x23bd55[_0x332d('0x2f')]=_0x23bd55['attributes']['length']?_0x23bd55['attributes']:_0x3fa8fe[_0x332d('0x2b')];if(_0x192c0a['query'][_0x332d('0x3e')]){_0x23bd55[_0x332d('0x3f')]=[{'all':!![]}];}_0x23bd55=_['merge']({},_0x23bd55,_0x192c0a['options']);return db[_0x332d('0x3d')][_0x332d('0x42')](_0x23bd55)[_0x332d('0x1e')](handleEntityNotFound(_0x2df00f,null))[_0x332d('0x1e')](respondWithResult(_0x2df00f,null))[_0x332d('0x43')](handleError(_0x2df00f,null));};exports[_0x332d('0x44')]=function(_0x2770b8,_0x39c240){return db[_0x332d('0x3d')]['create'](_0x2770b8[_0x332d('0x45')],{})[_0x332d('0x1e')](function(_0x1f9cb3){var _0x350cb0=_0x2770b8['user'][_0x332d('0x20')]({'plain':!![]});if(!_0x350cb0)throw new Error(_0x332d('0x46'));if(_0x350cb0[_0x332d('0x47')]===_0x332d('0x48')){var _0x35699e=_0x1f9cb3['get']({'plain':!![]});var _0x5438f2=_0x332d('0x21');return db[_0x332d('0x49')][_0x332d('0x42')]({'where':{'name':_0x5438f2,'userProfileId':_0x350cb0['userProfileId']},'raw':!![]})['then'](function(_0x12c21f){if(_0x12c21f&&_0x12c21f[_0x332d('0x4a')]===0x0){return db['UserProfileResource'][_0x332d('0x44')]({'name':_0x35699e[_0x332d('0x24')],'resourceId':_0x35699e['id'],'type':_0x12c21f[_0x332d('0x24')],'sectionId':_0x12c21f['id']},{})[_0x332d('0x1e')](function(){return _0x1f9cb3;});}else{return _0x1f9cb3;}})[_0x332d('0x43')](function(_0x5b6a92){logger[_0x332d('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b6a92);throw _0x5b6a92;});}return _0x1f9cb3;})['then'](respondWithResult(_0x39c240,0xc9))[_0x332d('0x43')](handleError(_0x39c240,null));};exports[_0x332d('0x4c')]=function(_0xcdc4b6,_0x17ec91){var _0x53daba={'where':{'id':_0xcdc4b6[_0x332d('0x4d')]['id']}},_0x1b8c55={};_0x1b8c55[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['Campaign'][_0x332d('0x27')]);_0x53daba['attributes']=_[_0x332d('0x2e')](_0x1b8c55[_0x332d('0x2b')],qs[_0x332d('0x30')](_0xcdc4b6[_0x332d('0x2c')]['fields']));_0x53daba[_0x332d('0x2f')]=_0x53daba[_0x332d('0x2f')][_0x332d('0x4e')]?_0x53daba[_0x332d('0x2f')]:_0x1b8c55[_0x332d('0x2b')];if(_0xcdc4b6['query'][_0x332d('0x3e')]){_0x53daba[_0x332d('0x3f')]=[{'all':!![]}];}_0x53daba=_[_0x332d('0x3a')]({},_0x53daba,_0xcdc4b6[_0x332d('0x3c')]);return db[_0x332d('0x3d')][_0x332d('0x42')](_0x53daba)[_0x332d('0x1e')](handleEntityNotFound(_0x17ec91,null))[_0x332d('0x1e')](function(_0x5af047){if(_0x5af047){var _0x341bd8=_0x5af047[_0x332d('0x20')]({'plain':!![]});_0x341bd8=qs['omit'](_0x341bd8,['id','createdAt',_0x332d('0x4f')]);_0xcdc4b6[_0x332d('0x45')]=_[_0x332d('0x50')](_0xcdc4b6[_0x332d('0x45')],['id','createdAt',_0x332d('0x4f')]);return db[_0x332d('0x3d')][_0x332d('0x44')](_[_0x332d('0x3a')](_0x341bd8,_0xcdc4b6[_0x332d('0x45')]),{'include':_0xcdc4b6['query'][_0x332d('0x3e')]?[{'all':!![]}]:undefined})[_0x332d('0x1e')](function(_0x2ab79e){var _0x2ad064=_0xcdc4b6[_0x332d('0x48')]['get']({'plain':!![]});if(!_0x2ad064)throw new Error(_0x332d('0x46'));if(_0x2ad064[_0x332d('0x47')]===_0x332d('0x48')){var _0x14c073=_0x2ab79e['get']({'plain':!![]});var _0x41129a=_0x332d('0x21');return db[_0x332d('0x49')][_0x332d('0x42')]({'where':{'name':_0x41129a,'userProfileId':_0x2ad064[_0x332d('0x51')]},'raw':!![]})[_0x332d('0x1e')](function(_0x3c456a){if(_0x3c456a&&_0x3c456a['autoAssociation']===0x0){return db[_0x332d('0x22')]['create']({'name':_0x14c073[_0x332d('0x24')],'resourceId':_0x14c073['id'],'type':_0x3c456a[_0x332d('0x24')],'sectionId':_0x3c456a['id']},{})['then'](function(){return _0x2ab79e;});}else{return _0x2ab79e;}})[_0x332d('0x43')](function(_0x589544){logger[_0x332d('0x4b')](_0x332d('0x52'),_0x589544);throw _0x589544;});}return _0x2ab79e;});}})['then'](respondWithResult(_0x17ec91,0xc9))[_0x332d('0x43')](handleError(_0x17ec91,null));};exports['update']=function(_0x205b02,_0x580ac6){if(_0x205b02[_0x332d('0x45')]['id']){delete _0x205b02['body']['id'];}return db[_0x332d('0x3d')][_0x332d('0x42')]({'where':{'id':_0x205b02['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x580ac6,null))[_0x332d('0x1e')](saveUpdates(_0x205b02['body'],null))[_0x332d('0x1e')](respondWithResult(_0x580ac6,null))[_0x332d('0x43')](handleError(_0x580ac6,null));};exports['destroy']=function(_0x240c54,_0x13cd68){return db['Campaign']['find']({'where':{'id':_0x240c54['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x13cd68,null))[_0x332d('0x1e')](removeEntity(_0x13cd68,null))[_0x332d('0x43')](handleError(_0x13cd68,null));};exports[_0x332d('0x53')]=function(_0x4ebc83,_0x346657,_0x439c1f){var _0x5cc33e={'raw':!![],'where':{}};var _0x32167e={};var _0x162068={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x4ebc83[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x346657,null))[_0x332d('0x1e')](function(_0x2c2915){if(_0x2c2915){_0x32167e[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x55')]['rawAttributes']);_0x32167e[_0x332d('0x2c')]=_['keys'](_0x4ebc83['query']);_0x32167e[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x32167e[_0x332d('0x2b')],_0x32167e[_0x332d('0x2c')]);_0x5cc33e[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x32167e[_0x332d('0x2b')],qs['fields'](_0x4ebc83[_0x332d('0x2c')]['fields']));_0x5cc33e['attributes']=_0x5cc33e[_0x332d('0x2f')][_0x332d('0x4e')]?_0x5cc33e[_0x332d('0x2f')]:_0x32167e[_0x332d('0x2b')];if(!_0x4ebc83[_0x332d('0x2c')][_0x332d('0x31')](_0x332d('0x32'))){_0x5cc33e['limit']=qs[_0x332d('0x33')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x33')]);_0x5cc33e[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x18')]);}_0x5cc33e[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x35')]);_0x5cc33e[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x4ebc83['query'],_0x32167e['filters']));_0x5cc33e[_0x332d('0x36')]['CampaignId']=_0x2c2915['id'];if(_0x4ebc83['query'][_0x332d('0x39')]){_0x5cc33e[_0x332d('0x36')]=_[_0x332d('0x3a')](_0x5cc33e['where'],{'$or':_[_0x332d('0x26')](_0x5cc33e[_0x332d('0x2f')],function(_0x54ed46){var _0x472a48={};_0x472a48[_0x54ed46]={'$like':'%'+_0x4ebc83[_0x332d('0x2c')]['filter']+'%'};return _0x472a48;})});}_0x5cc33e=_[_0x332d('0x3a')]({},_0x5cc33e,_0x4ebc83[_0x332d('0x3c')]);return db[_0x332d('0x55')][_0x332d('0x1a')]({'where':_0x5cc33e[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x54d861){_0x162068[_0x332d('0x1a')]=_0x54d861;if(_0x4ebc83[_0x332d('0x2c')][_0x332d('0x3e')]){_0x5cc33e[_0x332d('0x3f')]=[{'all':!![]}];}return db[_0x332d('0x55')][_0x332d('0x56')](_0x5cc33e);})[_0x332d('0x1e')](function(_0x50d7c7){_0x162068['rows']=_0x50d7c7;return _0x162068;});}})[_0x332d('0x1e')](respondWithFilteredResult(_0x346657,_0x5cc33e))[_0x332d('0x43')](handleError(_0x346657,null));};exports[_0x332d('0x57')]=function(_0x28b42d,_0x2a14bd,_0x1594f1){var _0x8bcfea={'raw':!![],'where':{}};var _0x42464d={};var _0x41700b={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x28b42d[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x2a14bd,null))['then'](function(_0x5646df){if(_0x5646df){_0x42464d[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['CmHopperHistory'][_0x332d('0x27')]);_0x42464d['query']=_[_0x332d('0x2d')](_0x28b42d[_0x332d('0x2c')]);_0x42464d['filters']=_[_0x332d('0x2e')](_0x42464d[_0x332d('0x2b')],_0x42464d[_0x332d('0x2c')]);_0x8bcfea['attributes']=_['intersection'](_0x42464d[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x28b42d['query'][_0x332d('0x30')]));_0x8bcfea[_0x332d('0x2f')]=_0x8bcfea[_0x332d('0x2f')][_0x332d('0x4e')]?_0x8bcfea['attributes']:_0x42464d['model'];if(!_0x28b42d[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x8bcfea[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x28b42d['query'][_0x332d('0x33')]);_0x8bcfea['offset']=qs['offset'](_0x28b42d[_0x332d('0x2c')][_0x332d('0x18')]);}_0x8bcfea[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x28b42d[_0x332d('0x2c')][_0x332d('0x35')]);_0x8bcfea[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x28b42d[_0x332d('0x2c')],_0x42464d[_0x332d('0x37')]));_0x8bcfea['where'][_0x332d('0x58')]=_0x5646df['id'];if(_0x28b42d[_0x332d('0x2c')][_0x332d('0x39')]){_0x8bcfea[_0x332d('0x36')]=_['merge'](_0x8bcfea[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x8bcfea[_0x332d('0x2f')],function(_0x4c37cf){var _0x56f9a9={};_0x56f9a9[_0x4c37cf]={'$like':'%'+_0x28b42d[_0x332d('0x2c')]['filter']+'%'};return _0x56f9a9;})});}_0x8bcfea=_[_0x332d('0x3a')]({},_0x8bcfea,_0x28b42d['options']);return db[_0x332d('0x59')][_0x332d('0x1a')]({'where':_0x8bcfea[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x505e78){_0x41700b['count']=_0x505e78;if(_0x28b42d[_0x332d('0x2c')]['includeAll']){_0x8bcfea[_0x332d('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x332d('0x56')](_0x8bcfea);})[_0x332d('0x1e')](function(_0x576836){_0x41700b[_0x332d('0x40')]=_0x576836;return _0x41700b;});}})['then'](respondWithFilteredResult(_0x2a14bd,_0x8bcfea))[_0x332d('0x43')](handleError(_0x2a14bd,null));};exports[_0x332d('0x5a')]=function(_0x416ad0,_0x18d349,_0x536dcd){var _0x2d4354={'raw':!![],'where':{}};var _0x5022e1={};var _0x486990={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x416ad0[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x18d349,null))[_0x332d('0x1e')](function(_0x34f23){if(_0x34f23){_0x5022e1[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5b')][_0x332d('0x27')]);_0x5022e1['query']=_['keys'](_0x416ad0[_0x332d('0x2c')]);_0x5022e1[_0x332d('0x37')]=_['intersection'](_0x5022e1[_0x332d('0x2b')],_0x5022e1[_0x332d('0x2c')]);_0x2d4354['attributes']=_[_0x332d('0x2e')](_0x5022e1[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x30')]));_0x2d4354[_0x332d('0x2f')]=_0x2d4354['attributes']['length']?_0x2d4354['attributes']:_0x5022e1[_0x332d('0x2b')];if(!_0x416ad0['query']['hasOwnProperty'](_0x332d('0x32'))){_0x2d4354[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x33')]);_0x2d4354[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x18')]);}_0x2d4354[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x416ad0[_0x332d('0x2c')][_0x332d('0x35')]);_0x2d4354[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x416ad0[_0x332d('0x2c')],_0x5022e1[_0x332d('0x37')]));_0x2d4354[_0x332d('0x36')]['CampaignId']=_0x34f23['id'];if(_0x416ad0['query'][_0x332d('0x39')]){_0x2d4354['where']=_[_0x332d('0x3a')](_0x2d4354[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x2d4354['attributes'],function(_0x14fc36){var _0x27ed1c={};_0x27ed1c[_0x14fc36]={'$like':'%'+_0x416ad0[_0x332d('0x2c')][_0x332d('0x39')]+'%'};return _0x27ed1c;})});}_0x2d4354=_[_0x332d('0x3a')]({},_0x2d4354,_0x416ad0[_0x332d('0x3c')]);return db[_0x332d('0x5b')]['count']({'where':_0x2d4354[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x2d2438){_0x486990[_0x332d('0x1a')]=_0x2d2438;if(_0x416ad0[_0x332d('0x2c')][_0x332d('0x3e')]){_0x2d4354[_0x332d('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2d4354);})[_0x332d('0x1e')](function(_0x27bb25){_0x486990[_0x332d('0x40')]=_0x27bb25;return _0x486990;});}})[_0x332d('0x1e')](respondWithFilteredResult(_0x18d349,_0x2d4354))[_0x332d('0x43')](handleError(_0x18d349,null));};exports[_0x332d('0x5c')]=function(_0x28fcea,_0x4c6246,_0x467cc8){var _0x4e61a4={'raw':!![],'where':{}};var _0x278a24={};var _0x36b7a8={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x28fcea['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x4c6246,null))[_0x332d('0x1e')](function(_0x12303d){if(_0x12303d){_0x278a24[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5d')][_0x332d('0x27')]);_0x278a24[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x28fcea[_0x332d('0x2c')]);_0x278a24[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x278a24[_0x332d('0x2b')],_0x278a24[_0x332d('0x2c')]);_0x4e61a4[_0x332d('0x2f')]=_['intersection'](_0x278a24['model'],qs['fields'](_0x28fcea[_0x332d('0x2c')][_0x332d('0x30')]));_0x4e61a4['attributes']=_0x4e61a4['attributes']['length']?_0x4e61a4[_0x332d('0x2f')]:_0x278a24[_0x332d('0x2b')];if(!_0x28fcea[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x4e61a4[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x28fcea[_0x332d('0x2c')][_0x332d('0x33')]);_0x4e61a4[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x28fcea[_0x332d('0x2c')][_0x332d('0x18')]);}_0x4e61a4[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x28fcea[_0x332d('0x2c')][_0x332d('0x35')]);_0x4e61a4[_0x332d('0x36')]=qs['filters'](_[_0x332d('0x38')](_0x28fcea['query'],_0x278a24['filters']));_0x4e61a4['where'][_0x332d('0x58')]=_0x12303d['id'];if(_0x28fcea[_0x332d('0x2c')][_0x332d('0x39')]){_0x4e61a4[_0x332d('0x36')]=_[_0x332d('0x3a')](_0x4e61a4[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x4e61a4['attributes'],function(_0x1bc499){var _0xe201cd={};_0xe201cd[_0x1bc499]={'$like':'%'+_0x28fcea[_0x332d('0x2c')][_0x332d('0x39')]+'%'};return _0xe201cd;})});}_0x4e61a4=_[_0x332d('0x3a')]({},_0x4e61a4,_0x28fcea[_0x332d('0x3c')]);return db[_0x332d('0x5d')][_0x332d('0x1a')]({'where':_0x4e61a4['where']})[_0x332d('0x1e')](function(_0x4baf92){_0x36b7a8['count']=_0x4baf92;if(_0x28fcea[_0x332d('0x2c')][_0x332d('0x3e')]){_0x4e61a4[_0x332d('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x332d('0x56')](_0x4e61a4);})[_0x332d('0x1e')](function(_0x45cee5){_0x36b7a8[_0x332d('0x40')]=_0x45cee5;return _0x36b7a8;});}})['then'](respondWithFilteredResult(_0x4c6246,_0x4e61a4))[_0x332d('0x43')](handleError(_0x4c6246,null));};exports[_0x332d('0x5e')]=function(_0x5cc2cc,_0x417994,_0x26f0ca){var _0x7877ad={};var _0x31c186={};var _0x483978;var _0x377b7c;return db['Campaign'][_0x332d('0x54')]({'where':{'id':_0x5cc2cc[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x417994,null))['then'](function(_0x39d336){if(_0x39d336){_0x483978=_0x39d336;_0x31c186[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5f')][_0x332d('0x27')]);_0x31c186[_0x332d('0x2c')]=_['keys'](_0x5cc2cc[_0x332d('0x2c')]);_0x31c186['filters']=_[_0x332d('0x2e')](_0x31c186['model'],_0x31c186[_0x332d('0x2c')]);_0x7877ad['attributes']=_[_0x332d('0x2e')](_0x31c186[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x5cc2cc[_0x332d('0x2c')]['fields']));_0x7877ad['attributes']=_0x7877ad[_0x332d('0x2f')][_0x332d('0x4e')]?_0x7877ad[_0x332d('0x2f')]:_0x31c186[_0x332d('0x2b')];_0x7877ad[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x5cc2cc['query'][_0x332d('0x35')]);_0x7877ad[_0x332d('0x36')]=qs[_0x332d('0x37')](_['pick'](_0x5cc2cc['query'],_0x31c186[_0x332d('0x37')]));if(_0x5cc2cc[_0x332d('0x2c')][_0x332d('0x39')]){_0x7877ad[_0x332d('0x36')]=_[_0x332d('0x3a')](_0x7877ad[_0x332d('0x36')],{'$or':_['map'](_0x7877ad[_0x332d('0x2f')],function(_0x529d70){var _0x4c7df9={};_0x4c7df9[_0x529d70]={'$like':'%'+_0x5cc2cc[_0x332d('0x2c')][_0x332d('0x39')]+'%'};return _0x4c7df9;})});}_0x7877ad=_[_0x332d('0x3a')]({},_0x7877ad,_0x5cc2cc[_0x332d('0x3c')]);return _0x483978['getLists'](_0x7877ad);}})[_0x332d('0x1e')](function(_0x201b4c){if(_0x201b4c){_0x377b7c=_0x201b4c[_0x332d('0x4e')];if(!_0x5cc2cc[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x7877ad[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x5cc2cc[_0x332d('0x2c')]['limit']);_0x7877ad[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x5cc2cc[_0x332d('0x2c')][_0x332d('0x18')]);}return _0x483978[_0x332d('0x5e')](_0x7877ad);}})[_0x332d('0x1e')](function(_0x370485){if(_0x370485){return _0x370485?{'count':_0x377b7c,'rows':_0x370485}:null;}})[_0x332d('0x1e')](respondWithResult(_0x417994,null))['catch'](handleError(_0x417994,null));};exports[_0x332d('0x60')]=function(_0x3fdc2f,_0x5d6cbb,_0x42ceb2){var _0x11d198,_0x1d2f9f;var _0x1d4f1e=[];var _0x1fc1af=moment()[_0x332d('0x61')](_0x332d('0x62'));return db['Campaign'][_0x332d('0x42')]({'where':{'id':_0x3fdc2f['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x5d6cbb,null))[_0x332d('0x1e')](function(_0x44ce86){if(_0x44ce86){_0x1d2f9f=_0x44ce86;return _0x44ce86[_0x332d('0x60')](_0x3fdc2f['body'][_0x332d('0x63')],_[_0x332d('0x50')](_0x3fdc2f[_0x332d('0x45')],[_0x332d('0x63'),'id'])||{});}return null;})[_0x332d('0x64')](function(_0x4d7fc9){var _0x3d2c93;var _0x435cfb;_0x11d198=_0x4d7fc9||[];var _0x3f95a1=[];if(_0x4d7fc9){for(var _0x4cb026=0x0;_0x4cb026<_0x4d7fc9[_0x332d('0x4e')];_0x4cb026+=0x1){var _0x2de76a=_0x4d7fc9[_0x4cb026][_0x332d('0x20')]({'plain':!![]});_0x1d2f9f[_0x332d('0x65')]=_0x3fdc2f[_0x332d('0x45')][_0x332d('0x65')]?_0x3fdc2f[_0x332d('0x45')][_0x332d('0x65')]:_0x1d2f9f['dialCheckDuplicateType'];switch(_0x1d2f9f[_0x332d('0x65')]){case _0x332d('0x66'):_0x3d2c93=squel[_0x332d('0x67')]()['into']('cm_hopper')[_0x332d('0x68')]([_0x332d('0x69'),_0x332d('0x6a'),_0x332d('0x6b'),_0x332d('0x6c'),'CampaignId',_0x332d('0x6d'),_0x332d('0x4f')],squel['select']()[_0x332d('0x6e')](_0x332d('0x69'),_0x332d('0x69'))['field'](_0x332d('0x6f'),_0x332d('0x6a'))[_0x332d('0x6e')]('id',_0x332d('0x6b'))[_0x332d('0x6e')](_0x2de76a[_0x332d('0x70')]['toString'](),'ListId')[_0x332d('0x6e')](_0x3fdc2f[_0x332d('0x4d')]['id']['toString'](),'CampaignId')[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x4f'))[_0x332d('0x71')](_0x332d('0x72'))[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')](_0x332d('0x74'),_0x2de76a[_0x332d('0x70')][_0x332d('0x75')]())['where'](_0x332d('0x76'))[_0x332d('0x36')](_0x332d('0x77'),squel[_0x332d('0x78')]()[_0x332d('0x6e')](_0x332d('0x79'))['from'](_0x332d('0x7a'))[_0x332d('0x36')]('CampaignId\x20=\x20?',_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')]()))['where'](_0x332d('0x77'),squel['select']()[_0x332d('0x6e')](_0x332d('0x7b'))[_0x332d('0x71')](_0x332d('0x7c'))['where']('CampaignId\x20=\x20?',_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')]())))[_0x332d('0x75')]();break;case _0x332d('0x7d'):_0x3d2c93=squel[_0x332d('0x67')]()['into'](_0x332d('0x7c'))[_0x332d('0x68')]([_0x332d('0x69'),_0x332d('0x6a'),_0x332d('0x6b'),'ListId',_0x332d('0x58'),_0x332d('0x6d'),'updatedAt'],squel[_0x332d('0x78')]()[_0x332d('0x6e')](_0x332d('0x69'),_0x332d('0x69'))[_0x332d('0x6e')]('NOW()',_0x332d('0x6a'))['field']('id',_0x332d('0x6b'))['field'](_0x2de76a[_0x332d('0x70')]['toString'](),_0x332d('0x6c'))[_0x332d('0x6e')](_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')](),'CampaignId')[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x4f'))['from'](_0x332d('0x72'))[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')](_0x332d('0x74'),_0x2de76a[_0x332d('0x70')][_0x332d('0x75')]())[_0x332d('0x36')]('phone\x20IS\x20NOT\x20NULL')[_0x332d('0x36')](_0x332d('0x77'),squel[_0x332d('0x78')]()[_0x332d('0x6e')]('COALESCE(phone,\x27\x27)')[_0x332d('0x71')](_0x332d('0x7c'))['where'](_0x332d('0x7e'),_0x3fdc2f[_0x332d('0x4d')]['id']['toString']())))['toString']();break;default:_0x3d2c93=squel[_0x332d('0x67')]()[_0x332d('0x7f')]('cm_hopper')[_0x332d('0x68')](['phone',_0x332d('0x6a'),_0x332d('0x6b'),_0x332d('0x6c'),_0x332d('0x58'),_0x332d('0x6d'),_0x332d('0x4f')],squel[_0x332d('0x78')]()[_0x332d('0x6e')](_0x332d('0x69'),_0x332d('0x69'))['field'](_0x332d('0x6f'),_0x332d('0x6a'))[_0x332d('0x6e')]('id','ContactId')[_0x332d('0x6e')](_0x2de76a[_0x332d('0x70')][_0x332d('0x75')](),_0x332d('0x6c'))[_0x332d('0x6e')](_0x3fdc2f['params']['id'][_0x332d('0x75')](),_0x332d('0x58'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27','updatedAt')[_0x332d('0x71')]('cm_contacts')[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')](_0x332d('0x74'),_0x2de76a[_0x332d('0x70')][_0x332d('0x75')]())[_0x332d('0x36')](_0x332d('0x76')))['toString']();}_0x435cfb=squel[_0x332d('0x67')]()[_0x332d('0x7f')](_0x332d('0x80'))[_0x332d('0x68')](['cmHopperId',_0x332d('0x6a'),_0x332d('0x69'),_0x332d('0x81'),_0x332d('0x6d'),'updatedAt'],squel[_0x332d('0x78')]()['field']('h.id','id')[_0x332d('0x6e')](_0x332d('0x6f'),'scheduledAt')[_0x332d('0x6e')](_0x332d('0x82'),_0x332d('0x69'))[_0x332d('0x6e')](_0x332d('0x83'),_0x332d('0x81'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27',_0x332d('0x6d'))[_0x332d('0x6e')]('\x27'+_0x1fc1af+'\x27','updatedAt')[_0x332d('0x71')](_0x332d('0x84'),'ci')['join']('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x332d('0x36')](_0x332d('0x85'),_0x2de76a['CmListId'][_0x332d('0x75')]())[_0x332d('0x36')]('h.CampaignId=?',_0x3fdc2f[_0x332d('0x4d')]['id'][_0x332d('0x75')]())[_0x332d('0x36')]('h.createdAt\x20=\x20?',_0x1fc1af))[_0x332d('0x75')]();_0x3f95a1[_0x332d('0x86')](db[_0x332d('0x87')][_0x332d('0x2c')](_0x3d2c93));_0x1d4f1e[_0x332d('0x86')](db['sequelize'][_0x332d('0x2c')](_0x435cfb));}return BPromise['all'](_0x3f95a1);}})['then'](function(){return BPromise['all'](_0x1d4f1e);})[_0x332d('0x1e')](function(){return _0x11d198;})['then'](respondWithResult(_0x5d6cbb,null))['catch'](handleError(_0x5d6cbb,null));};exports[_0x332d('0x88')]=function(_0x309b9c,_0x3969ed,_0x263c62){return db['Campaign'][_0x332d('0x42')]({'where':{'id':_0x309b9c['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x3969ed,null))[_0x332d('0x1e')](function(_0x5f1dda){if(_0x5f1dda){return _0x5f1dda[_0x332d('0x88')](_0x309b9c['query'][_0x332d('0x63')]);}})[_0x332d('0x1e')](function(_0x268c0b){if(_0x268c0b){return db[_0x332d('0x55')][_0x332d('0x1f')]({'where':{'ListId':_0x309b9c[_0x332d('0x2c')][_0x332d('0x63')],'CampaignId':_0x309b9c['params']['id']}})[_0x332d('0x1e')](function(){return _0x268c0b;});}})[_0x332d('0x1e')](respondWithStatusCode(_0x3969ed,null))[_0x332d('0x43')](handleError(_0x3969ed,null));};exports['getBlackLists']=function(_0x52d7d2,_0x1cb405,_0x536649){var _0x987568={};var _0x63f9f3={};var _0x4d36a2;var _0x30342c;return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x52d7d2[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x1cb405,null))['then'](function(_0x261e3f){if(_0x261e3f){_0x4d36a2=_0x261e3f;_0x63f9f3[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x5f')][_0x332d('0x27')]);_0x63f9f3[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x52d7d2[_0x332d('0x2c')]);_0x63f9f3[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x63f9f3[_0x332d('0x2b')],_0x63f9f3['query']);_0x987568['attributes']=_[_0x332d('0x2e')](_0x63f9f3[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x52d7d2[_0x332d('0x2c')][_0x332d('0x30')]));_0x987568[_0x332d('0x2f')]=_0x987568[_0x332d('0x2f')][_0x332d('0x4e')]?_0x987568[_0x332d('0x2f')]:_0x63f9f3[_0x332d('0x2b')];_0x987568[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x52d7d2['query'][_0x332d('0x35')]);_0x987568[_0x332d('0x36')]=qs['filters'](_[_0x332d('0x38')](_0x52d7d2[_0x332d('0x2c')],_0x63f9f3[_0x332d('0x37')]));if(_0x52d7d2[_0x332d('0x2c')][_0x332d('0x39')]){_0x987568['where']=_[_0x332d('0x3a')](_0x987568[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x987568[_0x332d('0x2f')],function(_0x88c21){var _0x1202e6={};_0x1202e6[_0x88c21]={'$like':'%'+_0x52d7d2[_0x332d('0x2c')]['filter']+'%'};return _0x1202e6;})});}_0x987568=_['merge']({},_0x987568,_0x52d7d2['options']);return _0x4d36a2[_0x332d('0x89')](_0x987568);}})[_0x332d('0x1e')](function(_0x20f20c){if(_0x20f20c){_0x30342c=_0x20f20c[_0x332d('0x4e')];if(!_0x52d7d2[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x987568[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x52d7d2[_0x332d('0x2c')][_0x332d('0x33')]);_0x987568['offset']=qs[_0x332d('0x18')](_0x52d7d2['query'][_0x332d('0x18')]);}return _0x4d36a2[_0x332d('0x89')](_0x987568);}})[_0x332d('0x1e')](function(_0x1d48f4){if(_0x1d48f4){return _0x1d48f4?{'count':_0x30342c,'rows':_0x1d48f4}:null;}})[_0x332d('0x1e')](respondWithResult(_0x1cb405,null))[_0x332d('0x43')](handleError(_0x1cb405,null));};exports[_0x332d('0x8a')]=function(_0x246027,_0x181aa9,_0x23f410){var _0xd8db80,_0x261291;var _0x45eafe=[];var _0x37bee8=moment()[_0x332d('0x61')](_0x332d('0x62'));return db[_0x332d('0x3d')][_0x332d('0x42')]({'where':{'id':_0x246027[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x181aa9,null))[_0x332d('0x1e')](function(_0x4f4627){if(_0x4f4627){_0x261291=_0x4f4627;return _0x4f4627[_0x332d('0x8a')](_0x246027[_0x332d('0x45')][_0x332d('0x63')],_[_0x332d('0x50')](_0x246027[_0x332d('0x45')],['ids','id'])||{});}return null;})[_0x332d('0x64')](function(_0x12d53d){var _0x5b3aa0;var _0x5d2c7d;_0xd8db80=_0x12d53d||[];var _0x3259fe=[];if(_0x12d53d){for(var _0x4dadba=0x0;_0x4dadba<_0x12d53d[_0x332d('0x4e')];_0x4dadba+=0x1){var _0x3c177e=_0x12d53d[_0x4dadba]['get']({'plain':!![]});_0x5b3aa0=squel[_0x332d('0x67')]()['into'](_0x332d('0x8b'))[_0x332d('0x68')]([_0x332d('0x69'),'ContactId','ListId',_0x332d('0x58'),'createdAt',_0x332d('0x4f')],squel['select']()[_0x332d('0x6e')](_0x332d('0x69'),'phone')[_0x332d('0x6e')]('id',_0x332d('0x6b'))[_0x332d('0x6e')](_0x3c177e[_0x332d('0x70')][_0x332d('0x75')](),_0x332d('0x6c'))[_0x332d('0x6e')](_0x246027[_0x332d('0x4d')]['id'][_0x332d('0x75')](),_0x332d('0x58'))[_0x332d('0x6e')](_0x332d('0x6f'),_0x332d('0x6d'))[_0x332d('0x6e')]('NOW()','updatedAt')['from'](_0x332d('0x72'))[_0x332d('0x36')](_0x332d('0x73'))[_0x332d('0x36')]('ListId\x20=\x20?',_0x3c177e[_0x332d('0x70')][_0x332d('0x75')]())[_0x332d('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0x332d('0x75')]();_0x3259fe[_0x332d('0x86')](db[_0x332d('0x87')][_0x332d('0x2c')](_0x5b3aa0));}return BPromise[_0x332d('0x8c')](_0x3259fe);}})['then'](function(){return _0xd8db80;})[_0x332d('0x1e')](respondWithResult(_0x181aa9,null))[_0x332d('0x43')](handleError(_0x181aa9,null));};exports[_0x332d('0x8d')]=function(_0x217014,_0x3e2446,_0x1245c7){return db[_0x332d('0x3d')][_0x332d('0x42')]({'where':{'id':_0x217014[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x3e2446,null))[_0x332d('0x1e')](function(_0x5ddc72){if(_0x5ddc72){return _0x5ddc72[_0x332d('0x8d')](_0x217014[_0x332d('0x2c')][_0x332d('0x63')]);}})[_0x332d('0x1e')](function(_0x3acc8a){if(_0x3acc8a){return db[_0x332d('0x5d')]['destroy']({'where':{'ListId':_0x217014['query']['ids'],'CampaignId':_0x217014[_0x332d('0x4d')]['id']}})['then'](function(){return _0x3acc8a;});}})['then'](respondWithStatusCode(_0x3e2446,null))[_0x332d('0x43')](handleError(_0x3e2446,null));}; \ No newline at end of file +var _0x6f59=['NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','IvrCampaigns','name','map','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','Campaign','include','findAll','rows','catch','params','includeAll','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','clone','omit','createdAt','updatedAt','autoAssociation','getHoppers','CmHopper','CampaignId','findOne','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','fromQuery','ContactId'];(function(_0x275951,_0x24de53){var _0x24f26e=function(_0x1b093c){while(--_0x1b093c){_0x275951['push'](_0x275951['shift']());}};_0x24f26e(++_0x24de53);}(_0x6f59,0x1be));var _0x96f5=function(_0x566b7e,_0x9dd6c4){_0x566b7e=_0x566b7e-0x0;var _0x10fd26=_0x6f59[_0x566b7e];return _0x10fd26;};'use strict';var emlformat=require(_0x96f5('0x0'));var rimraf=require(_0x96f5('0x1'));var zipdir=require(_0x96f5('0x2'));var jsonpatch=require(_0x96f5('0x3'));var rp=require(_0x96f5('0x4'));var moment=require(_0x96f5('0x5'));var BPromise=require(_0x96f5('0x6'));var Mustache=require(_0x96f5('0x7'));var util=require(_0x96f5('0x8'));var path=require(_0x96f5('0x9'));var sox=require(_0x96f5('0xa'));var csv=require(_0x96f5('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96f5('0xc'));var _=require('lodash');var squel=require(_0x96f5('0xd'));var crypto=require('crypto');var jsforce=require(_0x96f5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x96f5('0xb'));var querystring=require(_0x96f5('0xf'));var Papa=require(_0x96f5('0x10'));var Redis=require(_0x96f5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x96f5('0x12'));var as=require(_0x96f5('0x13'));var hardwareService=require(_0x96f5('0x14'));var logger=require(_0x96f5('0x15'))(_0x96f5('0x16'));var utils=require(_0x96f5('0x17'));var config=require(_0x96f5('0x18'));var licenseUtil=require(_0x96f5('0x19'));var db=require(_0x96f5('0x1a'))['db'];function respondWithStatusCode(_0x42363c,_0x3a7b37){_0x3a7b37=_0x3a7b37||0xcc;return function(_0x24a490){if(_0x24a490){return _0x42363c[_0x96f5('0x1b')](_0x3a7b37);}return _0x42363c['status'](_0x3a7b37)[_0x96f5('0x1c')]();};}function respondWithResult(_0x21fe69,_0x1eaa4a){_0x1eaa4a=_0x1eaa4a||0xc8;return function(_0x3c13fc){if(_0x3c13fc){return _0x21fe69[_0x96f5('0x1d')](_0x1eaa4a)[_0x96f5('0x1e')](_0x3c13fc);}};}function respondWithFilteredResult(_0x4ac17c,_0x37a101){return function(_0x5b2017){if(_0x5b2017){var _0x3f6dcf=typeof _0x37a101[_0x96f5('0x1f')]===_0x96f5('0x20')&&typeof _0x37a101[_0x96f5('0x21')]===_0x96f5('0x20');var _0x4c81f6=_0x5b2017[_0x96f5('0x22')];var _0x4f19c3=_0x3f6dcf?0x0:_0x37a101[_0x96f5('0x1f')];var _0x5b6d40=_0x3f6dcf?_0x5b2017[_0x96f5('0x22')]:_0x37a101[_0x96f5('0x1f')]+_0x37a101['limit'];var _0x388604;if(_0x5b6d40>=_0x4c81f6){_0x5b6d40=_0x4c81f6;_0x388604=0xc8;}else{_0x388604=0xce;}_0x4ac17c['status'](_0x388604);return _0x4ac17c[_0x96f5('0x23')]('Content-Range',_0x4f19c3+'-'+_0x5b6d40+'/'+_0x4c81f6)[_0x96f5('0x1e')](_0x5b2017);}return null;};}function patchUpdates(_0x212f41){return function(_0x55c1e4){try{jsonpatch[_0x96f5('0x24')](_0x55c1e4,_0x212f41,!![]);}catch(_0x1c1aa3){return BPromise[_0x96f5('0x25')](_0x1c1aa3);}return _0x55c1e4[_0x96f5('0x26')]();};}function saveUpdates(_0x3dcd36,_0xae4a2a){return function(_0x399f14){if(_0x399f14){return _0x399f14[_0x96f5('0x27')](_0x3dcd36)[_0x96f5('0x28')](function(_0x17b3d1){return _0x17b3d1;});}return null;};}function removeEntity(_0x2b1588,_0x4bac26){return function(_0x119fd3){if(_0x119fd3){return _0x119fd3[_0x96f5('0x29')]()[_0x96f5('0x28')](function(){var _0x413769=_0x119fd3[_0x96f5('0x2a')]({'plain':!![]});var _0x314917=_0x96f5('0x2b');return db['UserProfileResource'][_0x96f5('0x29')]({'where':{'type':_0x314917,'resourceId':_0x413769['id']}})['then'](function(){return _0x119fd3;});})[_0x96f5('0x28')](function(){_0x2b1588[_0x96f5('0x1d')](0xcc)[_0x96f5('0x1c')]();});}};}function handleEntityNotFound(_0x30d226,_0x2eafd4){return function(_0x481328){if(!_0x481328){_0x30d226[_0x96f5('0x1b')](0x194);}return _0x481328;};}function handleError(_0x2c2eca,_0x4b6b77){_0x4b6b77=_0x4b6b77||0x1f4;return function(_0x5a8bb8){logger['error'](_0x5a8bb8['stack']);if(_0x5a8bb8[_0x96f5('0x2c')]){delete _0x5a8bb8[_0x96f5('0x2c')];}_0x2c2eca[_0x96f5('0x1d')](_0x4b6b77)['send'](_0x5a8bb8);};}exports['index']=function(_0xdae513,_0x1ec9ca){var _0x381129={},_0x2320e2={},_0x48ba78={'count':0x0,'rows':[]};var _0xf9910d=_[_0x96f5('0x2d')](db['Campaign'][_0x96f5('0x2e')],function(_0x29e66c){return{'name':_0x29e66c[_0x96f5('0x2f')],'type':_0x29e66c['type']['key']};});_0x2320e2['model']=_['map'](_0xf9910d,'name');_0x2320e2[_0x96f5('0x30')]=_[_0x96f5('0x31')](_0xdae513[_0x96f5('0x30')]);_0x2320e2[_0x96f5('0x32')]=_['intersection'](_0x2320e2['model'],_0x2320e2[_0x96f5('0x30')]);_0x381129['attributes']=_[_0x96f5('0x33')](_0x2320e2[_0x96f5('0x34')],qs[_0x96f5('0x35')](_0xdae513[_0x96f5('0x30')]['fields']));_0x381129['attributes']=_0x381129[_0x96f5('0x36')][_0x96f5('0x37')]?_0x381129[_0x96f5('0x36')]:_0x2320e2[_0x96f5('0x34')];if(!_0xdae513[_0x96f5('0x30')][_0x96f5('0x38')](_0x96f5('0x39'))){_0x381129[_0x96f5('0x21')]=qs['limit'](_0xdae513[_0x96f5('0x30')]['limit']);_0x381129[_0x96f5('0x1f')]=qs[_0x96f5('0x1f')](_0xdae513[_0x96f5('0x30')]['offset']);}_0x381129[_0x96f5('0x3a')]=qs[_0x96f5('0x3b')](_0xdae513[_0x96f5('0x30')][_0x96f5('0x3b')]);_0x381129['where']=qs[_0x96f5('0x32')](_[_0x96f5('0x3c')](_0xdae513['query'],_0x2320e2['filters']),_0xf9910d);if(_0xdae513[_0x96f5('0x30')][_0x96f5('0x3d')]){_0x381129[_0x96f5('0x3e')]=_[_0x96f5('0x3f')](_0x381129[_0x96f5('0x3e')],{'$or':_[_0x96f5('0x2d')](_0xf9910d,function(_0x227d1d){if(_0x227d1d[_0x96f5('0x40')]!==_0x96f5('0x41')){var _0x20a2a6={};_0x20a2a6[_0x227d1d[_0x96f5('0x2c')]]={'$like':'%'+_0xdae513[_0x96f5('0x30')][_0x96f5('0x3d')]+'%'};return _0x20a2a6;}})});}_0x381129=_[_0x96f5('0x3f')]({},_0x381129,_0xdae513[_0x96f5('0x42')]);var _0x3e9d8a={'where':_0x381129[_0x96f5('0x3e')]};return db[_0x96f5('0x43')]['count'](_0x3e9d8a)[_0x96f5('0x28')](function(_0x14c7de){_0x48ba78[_0x96f5('0x22')]=_0x14c7de;if(_0xdae513['query']['includeAll']){_0x381129[_0x96f5('0x44')]=[{'all':!![]}];}return db['Campaign'][_0x96f5('0x45')](_0x381129);})[_0x96f5('0x28')](function(_0x3b2b13){_0x48ba78[_0x96f5('0x46')]=_0x3b2b13;return _0x48ba78;})[_0x96f5('0x28')](respondWithFilteredResult(_0x1ec9ca,_0x381129))[_0x96f5('0x47')](handleError(_0x1ec9ca,null));};exports['show']=function(_0x445574,_0x432a9b){var _0x3aae10={'raw':![],'where':{'id':_0x445574[_0x96f5('0x48')]['id']}},_0x26bd56={};_0x26bd56['model']=_[_0x96f5('0x31')](db['Campaign'][_0x96f5('0x2e')]);_0x26bd56[_0x96f5('0x30')]=_[_0x96f5('0x31')](_0x445574[_0x96f5('0x30')]);_0x26bd56[_0x96f5('0x32')]=_['intersection'](_0x26bd56[_0x96f5('0x34')],_0x26bd56[_0x96f5('0x30')]);_0x3aae10[_0x96f5('0x36')]=_['intersection'](_0x26bd56[_0x96f5('0x34')],qs[_0x96f5('0x35')](_0x445574[_0x96f5('0x30')]['fields']));_0x3aae10[_0x96f5('0x36')]=_0x3aae10['attributes']['length']?_0x3aae10['attributes']:_0x26bd56[_0x96f5('0x34')];if(_0x445574[_0x96f5('0x30')][_0x96f5('0x49')]){_0x3aae10[_0x96f5('0x44')]=[{'all':!![]}];}_0x3aae10=_[_0x96f5('0x3f')]({},_0x3aae10,_0x445574[_0x96f5('0x42')]);return db[_0x96f5('0x43')][_0x96f5('0x4a')](_0x3aae10)['then'](handleEntityNotFound(_0x432a9b,null))[_0x96f5('0x28')](respondWithResult(_0x432a9b,null))[_0x96f5('0x47')](handleError(_0x432a9b,null));};exports[_0x96f5('0x4b')]=function(_0x1ed12f,_0x16cb69){return db['Campaign'][_0x96f5('0x4b')](_0x1ed12f[_0x96f5('0x4c')],{})['then'](function(_0x2c6690){var _0x3908dc=_0x1ed12f[_0x96f5('0x4d')]['get']({'plain':!![]});if(!_0x3908dc)throw new Error(_0x96f5('0x4e'));if(_0x3908dc[_0x96f5('0x4f')]===_0x96f5('0x4d')){var _0x5e888c=_0x2c6690['get']({'plain':!![]});var _0x5cad59=_0x96f5('0x2b');return db[_0x96f5('0x50')][_0x96f5('0x4a')]({'where':{'name':_0x5cad59,'userProfileId':_0x3908dc[_0x96f5('0x51')]},'raw':!![]})['then'](function(_0x3a16c9){if(_0x3a16c9&&_0x3a16c9['autoAssociation']===0x0){return db[_0x96f5('0x52')][_0x96f5('0x4b')]({'name':_0x5e888c[_0x96f5('0x2c')],'resourceId':_0x5e888c['id'],'type':_0x3a16c9[_0x96f5('0x2c')],'sectionId':_0x3a16c9['id']},{})[_0x96f5('0x28')](function(){return _0x2c6690;});}else{return _0x2c6690;}})[_0x96f5('0x47')](function(_0x420da1){logger['error'](_0x96f5('0x53'),_0x420da1);throw _0x420da1;});}return _0x2c6690;})[_0x96f5('0x28')](respondWithResult(_0x16cb69,0xc9))[_0x96f5('0x47')](handleError(_0x16cb69,null));};exports[_0x96f5('0x54')]=function(_0x5485a2,_0x54e218){var _0x8a9d5c={'where':{'id':_0x5485a2['params']['id']}},_0x2360c0={};_0x2360c0[_0x96f5('0x34')]=_[_0x96f5('0x31')](db[_0x96f5('0x43')]['rawAttributes']);_0x8a9d5c['attributes']=_['intersection'](_0x2360c0['model'],qs[_0x96f5('0x35')](_0x5485a2['query'][_0x96f5('0x35')]));_0x8a9d5c[_0x96f5('0x36')]=_0x8a9d5c[_0x96f5('0x36')]['length']?_0x8a9d5c['attributes']:_0x2360c0[_0x96f5('0x34')];if(_0x5485a2['query'][_0x96f5('0x49')]){_0x8a9d5c[_0x96f5('0x44')]=[{'all':!![]}];}_0x8a9d5c=_[_0x96f5('0x3f')]({},_0x8a9d5c,_0x5485a2[_0x96f5('0x42')]);return db[_0x96f5('0x43')][_0x96f5('0x4a')](_0x8a9d5c)['then'](handleEntityNotFound(_0x54e218,null))['then'](function(_0x14d1ac){if(_0x14d1ac){var _0x49ff70=_0x14d1ac[_0x96f5('0x2a')]({'plain':!![]});_0x49ff70=qs[_0x96f5('0x55')](_0x49ff70,['id',_0x96f5('0x56'),_0x96f5('0x57')]);_0x5485a2['body']=_[_0x96f5('0x55')](_0x5485a2[_0x96f5('0x4c')],['id','createdAt',_0x96f5('0x57')]);return db[_0x96f5('0x43')][_0x96f5('0x4b')](_['merge'](_0x49ff70,_0x5485a2[_0x96f5('0x4c')]),{'include':_0x5485a2[_0x96f5('0x30')][_0x96f5('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x3b480d){var _0x57df5f=_0x5485a2[_0x96f5('0x4d')][_0x96f5('0x2a')]({'plain':!![]});if(!_0x57df5f)throw new Error(_0x96f5('0x4e'));if(_0x57df5f[_0x96f5('0x4f')]===_0x96f5('0x4d')){var _0x136bd8=_0x3b480d[_0x96f5('0x2a')]({'plain':!![]});var _0x212a43='IvrCampaigns';return db[_0x96f5('0x50')][_0x96f5('0x4a')]({'where':{'name':_0x212a43,'userProfileId':_0x57df5f[_0x96f5('0x51')]},'raw':!![]})[_0x96f5('0x28')](function(_0x11e76d){if(_0x11e76d&&_0x11e76d[_0x96f5('0x58')]===0x0){return db[_0x96f5('0x52')][_0x96f5('0x4b')]({'name':_0x136bd8[_0x96f5('0x2c')],'resourceId':_0x136bd8['id'],'type':_0x11e76d[_0x96f5('0x2c')],'sectionId':_0x11e76d['id']},{})[_0x96f5('0x28')](function(){return _0x3b480d;});}else{return _0x3b480d;}})['catch'](function(_0x1e9995){logger['error'](_0x96f5('0x53'),_0x1e9995);throw _0x1e9995;});}return _0x3b480d;});}})[_0x96f5('0x28')](respondWithResult(_0x54e218,0xc9))[_0x96f5('0x47')](handleError(_0x54e218,null));};exports[_0x96f5('0x27')]=function(_0x4841b5,_0x47205b){if(_0x4841b5[_0x96f5('0x4c')]['id']){delete _0x4841b5[_0x96f5('0x4c')]['id'];}return db['Campaign'][_0x96f5('0x4a')]({'where':{'id':_0x4841b5['params']['id']}})['then'](handleEntityNotFound(_0x47205b,null))[_0x96f5('0x28')](saveUpdates(_0x4841b5['body'],null))['then'](respondWithResult(_0x47205b,null))[_0x96f5('0x47')](handleError(_0x47205b,null));};exports['destroy']=function(_0x82ed7a,_0x551077){return db['Campaign']['find']({'where':{'id':_0x82ed7a[_0x96f5('0x48')]['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x551077,null))[_0x96f5('0x28')](removeEntity(_0x551077,null))[_0x96f5('0x47')](handleError(_0x551077,null));};exports[_0x96f5('0x59')]=function(_0x2821af,_0x460df9,_0x584269){var _0x5b26e2={'raw':!![],'where':{}};var _0x1fccc1={};var _0x3c3246={'count':0x0,'rows':[]};return db[_0x96f5('0x43')]['findOne']({'where':{'id':_0x2821af['params']['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x460df9,null))[_0x96f5('0x28')](function(_0x21ca89){if(_0x21ca89){_0x1fccc1[_0x96f5('0x34')]=_[_0x96f5('0x31')](db[_0x96f5('0x5a')]['rawAttributes']);_0x1fccc1[_0x96f5('0x30')]=_[_0x96f5('0x31')](_0x2821af[_0x96f5('0x30')]);_0x1fccc1[_0x96f5('0x32')]=_[_0x96f5('0x33')](_0x1fccc1[_0x96f5('0x34')],_0x1fccc1[_0x96f5('0x30')]);_0x5b26e2['attributes']=_[_0x96f5('0x33')](_0x1fccc1[_0x96f5('0x34')],qs[_0x96f5('0x35')](_0x2821af[_0x96f5('0x30')][_0x96f5('0x35')]));_0x5b26e2['attributes']=_0x5b26e2[_0x96f5('0x36')]['length']?_0x5b26e2[_0x96f5('0x36')]:_0x1fccc1[_0x96f5('0x34')];if(!_0x2821af[_0x96f5('0x30')][_0x96f5('0x38')](_0x96f5('0x39'))){_0x5b26e2[_0x96f5('0x21')]=qs[_0x96f5('0x21')](_0x2821af[_0x96f5('0x30')][_0x96f5('0x21')]);_0x5b26e2[_0x96f5('0x1f')]=qs[_0x96f5('0x1f')](_0x2821af[_0x96f5('0x30')][_0x96f5('0x1f')]);}_0x5b26e2['order']=qs[_0x96f5('0x3b')](_0x2821af[_0x96f5('0x30')]['sort']);_0x5b26e2[_0x96f5('0x3e')]=qs[_0x96f5('0x32')](_['pick'](_0x2821af[_0x96f5('0x30')],_0x1fccc1[_0x96f5('0x32')]));_0x5b26e2[_0x96f5('0x3e')][_0x96f5('0x5b')]=_0x21ca89['id'];if(_0x2821af['query'][_0x96f5('0x3d')]){_0x5b26e2[_0x96f5('0x3e')]=_[_0x96f5('0x3f')](_0x5b26e2[_0x96f5('0x3e')],{'$or':_[_0x96f5('0x2d')](_0x5b26e2[_0x96f5('0x36')],function(_0x35730f){var _0x262569={};_0x262569[_0x35730f]={'$like':'%'+_0x2821af[_0x96f5('0x30')][_0x96f5('0x3d')]+'%'};return _0x262569;})});}_0x5b26e2=_[_0x96f5('0x3f')]({},_0x5b26e2,_0x2821af[_0x96f5('0x42')]);return db[_0x96f5('0x5a')][_0x96f5('0x22')]({'where':_0x5b26e2[_0x96f5('0x3e')]})[_0x96f5('0x28')](function(_0x15ecff){_0x3c3246[_0x96f5('0x22')]=_0x15ecff;if(_0x2821af['query']['includeAll']){_0x5b26e2['include']=[{'all':!![]}];}return db['CmHopper'][_0x96f5('0x45')](_0x5b26e2);})['then'](function(_0x35b447){_0x3c3246[_0x96f5('0x46')]=_0x35b447;return _0x3c3246;});}})[_0x96f5('0x28')](respondWithFilteredResult(_0x460df9,_0x5b26e2))[_0x96f5('0x47')](handleError(_0x460df9,null));};exports['getHopperHistories']=function(_0x5cd842,_0xe797b2,_0x106964){var _0x3843a8={'raw':!![],'where':{}};var _0xee35b5={};var _0x5f061a={'count':0x0,'rows':[]};return db[_0x96f5('0x43')][_0x96f5('0x5c')]({'where':{'id':_0x5cd842['params']['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0xe797b2,null))[_0x96f5('0x28')](function(_0x3e87fa){if(_0x3e87fa){_0xee35b5[_0x96f5('0x34')]=_['keys'](db['CmHopperHistory'][_0x96f5('0x2e')]);_0xee35b5[_0x96f5('0x30')]=_[_0x96f5('0x31')](_0x5cd842[_0x96f5('0x30')]);_0xee35b5[_0x96f5('0x32')]=_[_0x96f5('0x33')](_0xee35b5[_0x96f5('0x34')],_0xee35b5['query']);_0x3843a8[_0x96f5('0x36')]=_['intersection'](_0xee35b5[_0x96f5('0x34')],qs['fields'](_0x5cd842[_0x96f5('0x30')][_0x96f5('0x35')]));_0x3843a8[_0x96f5('0x36')]=_0x3843a8['attributes'][_0x96f5('0x37')]?_0x3843a8[_0x96f5('0x36')]:_0xee35b5[_0x96f5('0x34')];if(!_0x5cd842[_0x96f5('0x30')]['hasOwnProperty'](_0x96f5('0x39'))){_0x3843a8[_0x96f5('0x21')]=qs['limit'](_0x5cd842['query'][_0x96f5('0x21')]);_0x3843a8[_0x96f5('0x1f')]=qs[_0x96f5('0x1f')](_0x5cd842[_0x96f5('0x30')][_0x96f5('0x1f')]);}_0x3843a8[_0x96f5('0x3a')]=qs['sort'](_0x5cd842[_0x96f5('0x30')]['sort']);_0x3843a8[_0x96f5('0x3e')]=qs[_0x96f5('0x32')](_[_0x96f5('0x3c')](_0x5cd842[_0x96f5('0x30')],_0xee35b5[_0x96f5('0x32')]));_0x3843a8['where']['CampaignId']=_0x3e87fa['id'];if(_0x5cd842[_0x96f5('0x30')][_0x96f5('0x3d')]){_0x3843a8[_0x96f5('0x3e')]=_[_0x96f5('0x3f')](_0x3843a8[_0x96f5('0x3e')],{'$or':_[_0x96f5('0x2d')](_0x3843a8[_0x96f5('0x36')],function(_0x5c2c78){var _0x5c016b={};_0x5c016b[_0x5c2c78]={'$like':'%'+_0x5cd842[_0x96f5('0x30')][_0x96f5('0x3d')]+'%'};return _0x5c016b;})});}_0x3843a8=_[_0x96f5('0x3f')]({},_0x3843a8,_0x5cd842[_0x96f5('0x42')]);return db[_0x96f5('0x5d')]['count']({'where':_0x3843a8[_0x96f5('0x3e')]})['then'](function(_0x27d085){_0x5f061a[_0x96f5('0x22')]=_0x27d085;if(_0x5cd842[_0x96f5('0x30')][_0x96f5('0x49')]){_0x3843a8[_0x96f5('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x96f5('0x45')](_0x3843a8);})[_0x96f5('0x28')](function(_0x309271){_0x5f061a[_0x96f5('0x46')]=_0x309271;return _0x5f061a;});}})['then'](respondWithFilteredResult(_0xe797b2,_0x3843a8))['catch'](handleError(_0xe797b2,null));};exports['getHopperFinals']=function(_0x6204c9,_0x473f48,_0x20465e){var _0x96670b={'raw':!![],'where':{}};var _0x34f5cd={};var _0x4e9c16={'count':0x0,'rows':[]};return db[_0x96f5('0x43')][_0x96f5('0x5c')]({'where':{'id':_0x6204c9[_0x96f5('0x48')]['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x473f48,null))[_0x96f5('0x28')](function(_0x2b4210){if(_0x2b4210){_0x34f5cd[_0x96f5('0x34')]=_[_0x96f5('0x31')](db[_0x96f5('0x5e')][_0x96f5('0x2e')]);_0x34f5cd[_0x96f5('0x30')]=_['keys'](_0x6204c9[_0x96f5('0x30')]);_0x34f5cd[_0x96f5('0x32')]=_[_0x96f5('0x33')](_0x34f5cd[_0x96f5('0x34')],_0x34f5cd[_0x96f5('0x30')]);_0x96670b['attributes']=_[_0x96f5('0x33')](_0x34f5cd['model'],qs['fields'](_0x6204c9[_0x96f5('0x30')][_0x96f5('0x35')]));_0x96670b[_0x96f5('0x36')]=_0x96670b['attributes'][_0x96f5('0x37')]?_0x96670b[_0x96f5('0x36')]:_0x34f5cd[_0x96f5('0x34')];if(!_0x6204c9['query'][_0x96f5('0x38')]('nolimit')){_0x96670b[_0x96f5('0x21')]=qs[_0x96f5('0x21')](_0x6204c9['query'][_0x96f5('0x21')]);_0x96670b[_0x96f5('0x1f')]=qs[_0x96f5('0x1f')](_0x6204c9[_0x96f5('0x30')][_0x96f5('0x1f')]);}_0x96670b[_0x96f5('0x3a')]=qs[_0x96f5('0x3b')](_0x6204c9[_0x96f5('0x30')][_0x96f5('0x3b')]);_0x96670b[_0x96f5('0x3e')]=qs['filters'](_[_0x96f5('0x3c')](_0x6204c9[_0x96f5('0x30')],_0x34f5cd[_0x96f5('0x32')]));_0x96670b[_0x96f5('0x3e')][_0x96f5('0x5b')]=_0x2b4210['id'];if(_0x6204c9[_0x96f5('0x30')][_0x96f5('0x3d')]){_0x96670b[_0x96f5('0x3e')]=_[_0x96f5('0x3f')](_0x96670b['where'],{'$or':_['map'](_0x96670b[_0x96f5('0x36')],function(_0x5d1f8e){var _0x496716={};_0x496716[_0x5d1f8e]={'$like':'%'+_0x6204c9[_0x96f5('0x30')][_0x96f5('0x3d')]+'%'};return _0x496716;})});}_0x96670b=_['merge']({},_0x96670b,_0x6204c9[_0x96f5('0x42')]);return db[_0x96f5('0x5e')][_0x96f5('0x22')]({'where':_0x96670b[_0x96f5('0x3e')]})[_0x96f5('0x28')](function(_0x3c9b17){_0x4e9c16[_0x96f5('0x22')]=_0x3c9b17;if(_0x6204c9[_0x96f5('0x30')][_0x96f5('0x49')]){_0x96670b['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x96f5('0x45')](_0x96670b);})[_0x96f5('0x28')](function(_0x151b78){_0x4e9c16[_0x96f5('0x46')]=_0x151b78;return _0x4e9c16;});}})[_0x96f5('0x28')](respondWithFilteredResult(_0x473f48,_0x96670b))['catch'](handleError(_0x473f48,null));};exports['getHopperBlacks']=function(_0x45eede,_0x5937af,_0x1a25f5){var _0x48cc5e={'raw':!![],'where':{}};var _0x43763a={};var _0xdf136c={'count':0x0,'rows':[]};return db[_0x96f5('0x43')][_0x96f5('0x5c')]({'where':{'id':_0x45eede[_0x96f5('0x48')]['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x5937af,null))['then'](function(_0x14b477){if(_0x14b477){_0x43763a['model']=_[_0x96f5('0x31')](db[_0x96f5('0x5f')][_0x96f5('0x2e')]);_0x43763a['query']=_[_0x96f5('0x31')](_0x45eede['query']);_0x43763a[_0x96f5('0x32')]=_['intersection'](_0x43763a[_0x96f5('0x34')],_0x43763a['query']);_0x48cc5e['attributes']=_[_0x96f5('0x33')](_0x43763a[_0x96f5('0x34')],qs[_0x96f5('0x35')](_0x45eede[_0x96f5('0x30')][_0x96f5('0x35')]));_0x48cc5e[_0x96f5('0x36')]=_0x48cc5e[_0x96f5('0x36')][_0x96f5('0x37')]?_0x48cc5e[_0x96f5('0x36')]:_0x43763a['model'];if(!_0x45eede['query']['hasOwnProperty']('nolimit')){_0x48cc5e['limit']=qs['limit'](_0x45eede[_0x96f5('0x30')][_0x96f5('0x21')]);_0x48cc5e['offset']=qs[_0x96f5('0x1f')](_0x45eede['query']['offset']);}_0x48cc5e['order']=qs[_0x96f5('0x3b')](_0x45eede['query'][_0x96f5('0x3b')]);_0x48cc5e[_0x96f5('0x3e')]=qs['filters'](_[_0x96f5('0x3c')](_0x45eede[_0x96f5('0x30')],_0x43763a[_0x96f5('0x32')]));_0x48cc5e[_0x96f5('0x3e')][_0x96f5('0x5b')]=_0x14b477['id'];if(_0x45eede['query'][_0x96f5('0x3d')]){_0x48cc5e['where']=_[_0x96f5('0x3f')](_0x48cc5e[_0x96f5('0x3e')],{'$or':_['map'](_0x48cc5e['attributes'],function(_0x24c030){var _0x2c3c58={};_0x2c3c58[_0x24c030]={'$like':'%'+_0x45eede[_0x96f5('0x30')][_0x96f5('0x3d')]+'%'};return _0x2c3c58;})});}_0x48cc5e=_[_0x96f5('0x3f')]({},_0x48cc5e,_0x45eede[_0x96f5('0x42')]);return db[_0x96f5('0x5f')]['count']({'where':_0x48cc5e[_0x96f5('0x3e')]})[_0x96f5('0x28')](function(_0x4d83b2){_0xdf136c['count']=_0x4d83b2;if(_0x45eede[_0x96f5('0x30')][_0x96f5('0x49')]){_0x48cc5e[_0x96f5('0x44')]=[{'all':!![]}];}return db[_0x96f5('0x5f')][_0x96f5('0x45')](_0x48cc5e);})[_0x96f5('0x28')](function(_0x5f5476){_0xdf136c[_0x96f5('0x46')]=_0x5f5476;return _0xdf136c;});}})[_0x96f5('0x28')](respondWithFilteredResult(_0x5937af,_0x48cc5e))['catch'](handleError(_0x5937af,null));};exports[_0x96f5('0x60')]=function(_0x1ec2f1,_0x3dbb90,_0x3e0c86){var _0x2cf674={};var _0x4ec983={};var _0x2dda08;var _0x518408;return db['Campaign'][_0x96f5('0x5c')]({'where':{'id':_0x1ec2f1['params']['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x3dbb90,null))[_0x96f5('0x28')](function(_0x533d10){if(_0x533d10){_0x2dda08=_0x533d10;_0x4ec983[_0x96f5('0x34')]=_['keys'](db[_0x96f5('0x61')][_0x96f5('0x2e')]);_0x4ec983['query']=_[_0x96f5('0x31')](_0x1ec2f1['query']);_0x4ec983[_0x96f5('0x32')]=_['intersection'](_0x4ec983[_0x96f5('0x34')],_0x4ec983['query']);_0x2cf674[_0x96f5('0x36')]=_[_0x96f5('0x33')](_0x4ec983[_0x96f5('0x34')],qs['fields'](_0x1ec2f1[_0x96f5('0x30')]['fields']));_0x2cf674[_0x96f5('0x36')]=_0x2cf674[_0x96f5('0x36')][_0x96f5('0x37')]?_0x2cf674[_0x96f5('0x36')]:_0x4ec983[_0x96f5('0x34')];_0x2cf674[_0x96f5('0x3a')]=qs[_0x96f5('0x3b')](_0x1ec2f1[_0x96f5('0x30')][_0x96f5('0x3b')]);_0x2cf674['where']=qs[_0x96f5('0x32')](_[_0x96f5('0x3c')](_0x1ec2f1[_0x96f5('0x30')],_0x4ec983[_0x96f5('0x32')]));if(_0x1ec2f1[_0x96f5('0x30')]['filter']){_0x2cf674['where']=_[_0x96f5('0x3f')](_0x2cf674[_0x96f5('0x3e')],{'$or':_[_0x96f5('0x2d')](_0x2cf674[_0x96f5('0x36')],function(_0x40e115){var _0x440548={};_0x440548[_0x40e115]={'$like':'%'+_0x1ec2f1[_0x96f5('0x30')][_0x96f5('0x3d')]+'%'};return _0x440548;})});}_0x2cf674=_['merge']({},_0x2cf674,_0x1ec2f1[_0x96f5('0x42')]);return _0x2dda08[_0x96f5('0x60')](_0x2cf674);}})[_0x96f5('0x28')](function(_0x1c3db5){if(_0x1c3db5){_0x518408=_0x1c3db5[_0x96f5('0x37')];if(!_0x1ec2f1[_0x96f5('0x30')][_0x96f5('0x38')](_0x96f5('0x39'))){_0x2cf674['limit']=qs[_0x96f5('0x21')](_0x1ec2f1[_0x96f5('0x30')][_0x96f5('0x21')]);_0x2cf674[_0x96f5('0x1f')]=qs[_0x96f5('0x1f')](_0x1ec2f1[_0x96f5('0x30')][_0x96f5('0x1f')]);}return _0x2dda08['getLists'](_0x2cf674);}})[_0x96f5('0x28')](function(_0xabca60){if(_0xabca60){return _0xabca60?{'count':_0x518408,'rows':_0xabca60}:null;}})['then'](respondWithResult(_0x3dbb90,null))[_0x96f5('0x47')](handleError(_0x3dbb90,null));};exports[_0x96f5('0x62')]=function(_0x503813,_0xcc3e91,_0x3da4bf){var _0x39dda8,_0x73eab5;var _0x25c8e8=[];var _0x2e5de3=moment()[_0x96f5('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x96f5('0x4a')]({'where':{'id':_0x503813['params']['id']}})['then'](handleEntityNotFound(_0xcc3e91,null))[_0x96f5('0x28')](function(_0x4a2a69){if(_0x4a2a69){_0x73eab5=_0x4a2a69;return _0x4a2a69[_0x96f5('0x62')](_0x503813[_0x96f5('0x4c')][_0x96f5('0x64')],_[_0x96f5('0x55')](_0x503813[_0x96f5('0x4c')],[_0x96f5('0x64'),'id'])||{});}return null;})[_0x96f5('0x65')](function(_0x338389){var _0x3b7c62;var _0x4ecd88;_0x39dda8=_0x338389||[];var _0x27d5a4=[];if(_0x338389){for(var _0x294de0=0x0;_0x294de0<_0x338389['length'];_0x294de0+=0x1){var _0x1f060a=_0x338389[_0x294de0]['get']({'plain':!![]});_0x73eab5[_0x96f5('0x66')]=_0x503813[_0x96f5('0x4c')][_0x96f5('0x66')]?_0x503813[_0x96f5('0x4c')][_0x96f5('0x66')]:_0x73eab5['dialCheckDuplicateType'];switch(_0x73eab5[_0x96f5('0x66')]){case _0x96f5('0x67'):_0x3b7c62=squel[_0x96f5('0x68')]()[_0x96f5('0x69')]('cm_hopper')['fromQuery']([_0x96f5('0x6a'),_0x96f5('0x6b'),'ContactId',_0x96f5('0x6c'),_0x96f5('0x5b'),_0x96f5('0x56'),_0x96f5('0x57')],squel[_0x96f5('0x6d')]()[_0x96f5('0x6e')](_0x96f5('0x6a'),_0x96f5('0x6a'))['field']('NOW()','scheduledAt')[_0x96f5('0x6e')]('id','ContactId')[_0x96f5('0x6e')](_0x1f060a[_0x96f5('0x6f')][_0x96f5('0x70')](),_0x96f5('0x6c'))[_0x96f5('0x6e')](_0x503813[_0x96f5('0x48')]['id'][_0x96f5('0x70')](),_0x96f5('0x5b'))[_0x96f5('0x6e')]('\x27'+_0x2e5de3+'\x27','createdAt')[_0x96f5('0x6e')]('\x27'+_0x2e5de3+'\x27',_0x96f5('0x57'))[_0x96f5('0x71')](_0x96f5('0x72'))[_0x96f5('0x3e')](_0x96f5('0x73'))[_0x96f5('0x3e')](_0x96f5('0x74'),_0x1f060a[_0x96f5('0x6f')][_0x96f5('0x70')]())['where'](_0x96f5('0x75'))['where'](_0x96f5('0x76'),squel[_0x96f5('0x6d')]()['field'](_0x96f5('0x77'))[_0x96f5('0x71')](_0x96f5('0x78'))[_0x96f5('0x3e')]('CampaignId\x20=\x20?',_0x503813['params']['id'][_0x96f5('0x70')]()))[_0x96f5('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x96f5('0x6d')]()['field'](_0x96f5('0x79'))['from'](_0x96f5('0x7a'))['where'](_0x96f5('0x7b'),_0x503813[_0x96f5('0x48')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x3b7c62=squel['insert']()[_0x96f5('0x69')]('cm_hopper')[_0x96f5('0x7c')]([_0x96f5('0x6a'),'scheduledAt',_0x96f5('0x7d'),_0x96f5('0x6c'),_0x96f5('0x5b'),_0x96f5('0x56'),_0x96f5('0x57')],squel[_0x96f5('0x6d')]()[_0x96f5('0x6e')](_0x96f5('0x6a'),_0x96f5('0x6a'))['field'](_0x96f5('0x7e'),_0x96f5('0x6b'))[_0x96f5('0x6e')]('id',_0x96f5('0x7d'))[_0x96f5('0x6e')](_0x1f060a[_0x96f5('0x6f')][_0x96f5('0x70')](),_0x96f5('0x6c'))[_0x96f5('0x6e')](_0x503813[_0x96f5('0x48')]['id']['toString'](),_0x96f5('0x5b'))[_0x96f5('0x6e')]('\x27'+_0x2e5de3+'\x27',_0x96f5('0x56'))[_0x96f5('0x6e')]('\x27'+_0x2e5de3+'\x27',_0x96f5('0x57'))[_0x96f5('0x71')](_0x96f5('0x72'))[_0x96f5('0x3e')]('deletedAt\x20IS\x20NULL')[_0x96f5('0x3e')](_0x96f5('0x74'),_0x1f060a[_0x96f5('0x6f')]['toString']())[_0x96f5('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x96f5('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x96f5('0x6d')]()[_0x96f5('0x6e')](_0x96f5('0x79'))[_0x96f5('0x71')]('cm_hopper')[_0x96f5('0x3e')]('CampaignId\x20=\x20?',_0x503813[_0x96f5('0x48')]['id'][_0x96f5('0x70')]())))[_0x96f5('0x70')]();break;default:_0x3b7c62=squel[_0x96f5('0x68')]()['into'](_0x96f5('0x7a'))[_0x96f5('0x7c')]([_0x96f5('0x6a'),'scheduledAt','ContactId',_0x96f5('0x6c'),_0x96f5('0x5b'),_0x96f5('0x56'),_0x96f5('0x57')],squel[_0x96f5('0x6d')]()[_0x96f5('0x6e')](_0x96f5('0x6a'),_0x96f5('0x6a'))[_0x96f5('0x6e')](_0x96f5('0x7e'),_0x96f5('0x6b'))[_0x96f5('0x6e')]('id',_0x96f5('0x7d'))['field'](_0x1f060a[_0x96f5('0x6f')][_0x96f5('0x70')](),_0x96f5('0x6c'))[_0x96f5('0x6e')](_0x503813[_0x96f5('0x48')]['id'][_0x96f5('0x70')](),_0x96f5('0x5b'))[_0x96f5('0x6e')]('\x27'+_0x2e5de3+'\x27',_0x96f5('0x56'))['field']('\x27'+_0x2e5de3+'\x27',_0x96f5('0x57'))[_0x96f5('0x71')]('cm_contacts')[_0x96f5('0x3e')](_0x96f5('0x73'))[_0x96f5('0x3e')](_0x96f5('0x74'),_0x1f060a['CmListId'][_0x96f5('0x70')]())[_0x96f5('0x3e')](_0x96f5('0x75')))[_0x96f5('0x70')]();}_0x4ecd88=squel[_0x96f5('0x68')]()[_0x96f5('0x69')](_0x96f5('0x7f'))[_0x96f5('0x7c')]([_0x96f5('0x80'),_0x96f5('0x6b'),_0x96f5('0x6a'),_0x96f5('0x81'),_0x96f5('0x56'),_0x96f5('0x57')],squel[_0x96f5('0x6d')]()[_0x96f5('0x6e')](_0x96f5('0x82'),'id')[_0x96f5('0x6e')]('NOW()','scheduledAt')[_0x96f5('0x6e')](_0x96f5('0x83'),'phone')[_0x96f5('0x6e')]('ci.OrderBY',_0x96f5('0x81'))['field']('\x27'+_0x2e5de3+'\x27','createdAt')[_0x96f5('0x6e')]('\x27'+_0x2e5de3+'\x27',_0x96f5('0x57'))[_0x96f5('0x71')](_0x96f5('0x84'),'ci')[_0x96f5('0x85')](_0x96f5('0x7a'),'h',_0x96f5('0x86'))['where']('h.ListId\x20=\x20?',_0x1f060a[_0x96f5('0x6f')][_0x96f5('0x70')]())['where']('h.CampaignId=?',_0x503813[_0x96f5('0x48')]['id'][_0x96f5('0x70')]())['where'](_0x96f5('0x87'),_0x2e5de3))[_0x96f5('0x70')]();_0x27d5a4['push'](db[_0x96f5('0x88')][_0x96f5('0x30')](_0x3b7c62));_0x25c8e8[_0x96f5('0x89')](db[_0x96f5('0x88')][_0x96f5('0x30')](_0x4ecd88));}return BPromise[_0x96f5('0x8a')](_0x27d5a4);}})['then'](function(){return BPromise[_0x96f5('0x8a')](_0x25c8e8);})[_0x96f5('0x28')](function(){return _0x39dda8;})[_0x96f5('0x28')](respondWithResult(_0xcc3e91,null))['catch'](handleError(_0xcc3e91,null));};exports[_0x96f5('0x8b')]=function(_0x479357,_0x30aed2,_0x5efc7d){return db[_0x96f5('0x43')]['find']({'where':{'id':_0x479357[_0x96f5('0x48')]['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x30aed2,null))[_0x96f5('0x28')](function(_0x500ea5){if(_0x500ea5){return _0x500ea5[_0x96f5('0x8b')](_0x479357[_0x96f5('0x30')][_0x96f5('0x64')]);}})[_0x96f5('0x28')](function(_0x3cd6af){if(_0x3cd6af){return db[_0x96f5('0x5a')][_0x96f5('0x29')]({'where':{'ListId':_0x479357['query'][_0x96f5('0x64')],'CampaignId':_0x479357['params']['id']}})[_0x96f5('0x28')](function(){return _0x3cd6af;});}})['then'](respondWithStatusCode(_0x30aed2,null))[_0x96f5('0x47')](handleError(_0x30aed2,null));};exports[_0x96f5('0x8c')]=function(_0x225b1f,_0x402f44,_0xc9ce5e){var _0x4ddb41={};var _0x360a40={};var _0x35d1cf;var _0x38f163;return db[_0x96f5('0x43')][_0x96f5('0x5c')]({'where':{'id':_0x225b1f[_0x96f5('0x48')]['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x402f44,null))[_0x96f5('0x28')](function(_0x239469){if(_0x239469){_0x35d1cf=_0x239469;_0x360a40[_0x96f5('0x34')]=_['keys'](db[_0x96f5('0x61')][_0x96f5('0x2e')]);_0x360a40[_0x96f5('0x30')]=_[_0x96f5('0x31')](_0x225b1f[_0x96f5('0x30')]);_0x360a40[_0x96f5('0x32')]=_[_0x96f5('0x33')](_0x360a40[_0x96f5('0x34')],_0x360a40[_0x96f5('0x30')]);_0x4ddb41[_0x96f5('0x36')]=_['intersection'](_0x360a40[_0x96f5('0x34')],qs['fields'](_0x225b1f[_0x96f5('0x30')][_0x96f5('0x35')]));_0x4ddb41[_0x96f5('0x36')]=_0x4ddb41['attributes'][_0x96f5('0x37')]?_0x4ddb41['attributes']:_0x360a40['model'];_0x4ddb41['order']=qs['sort'](_0x225b1f[_0x96f5('0x30')][_0x96f5('0x3b')]);_0x4ddb41[_0x96f5('0x3e')]=qs['filters'](_['pick'](_0x225b1f[_0x96f5('0x30')],_0x360a40[_0x96f5('0x32')]));if(_0x225b1f[_0x96f5('0x30')][_0x96f5('0x3d')]){_0x4ddb41[_0x96f5('0x3e')]=_[_0x96f5('0x3f')](_0x4ddb41['where'],{'$or':_[_0x96f5('0x2d')](_0x4ddb41[_0x96f5('0x36')],function(_0x1567d3){var _0x540c5e={};_0x540c5e[_0x1567d3]={'$like':'%'+_0x225b1f['query'][_0x96f5('0x3d')]+'%'};return _0x540c5e;})});}_0x4ddb41=_[_0x96f5('0x3f')]({},_0x4ddb41,_0x225b1f[_0x96f5('0x42')]);return _0x35d1cf[_0x96f5('0x8c')](_0x4ddb41);}})[_0x96f5('0x28')](function(_0x16536c){if(_0x16536c){_0x38f163=_0x16536c[_0x96f5('0x37')];if(!_0x225b1f[_0x96f5('0x30')]['hasOwnProperty']('nolimit')){_0x4ddb41['limit']=qs[_0x96f5('0x21')](_0x225b1f[_0x96f5('0x30')][_0x96f5('0x21')]);_0x4ddb41[_0x96f5('0x1f')]=qs[_0x96f5('0x1f')](_0x225b1f[_0x96f5('0x30')][_0x96f5('0x1f')]);}return _0x35d1cf[_0x96f5('0x8c')](_0x4ddb41);}})[_0x96f5('0x28')](function(_0x4fccbe){if(_0x4fccbe){return _0x4fccbe?{'count':_0x38f163,'rows':_0x4fccbe}:null;}})[_0x96f5('0x28')](respondWithResult(_0x402f44,null))['catch'](handleError(_0x402f44,null));};exports['addBlackLists']=function(_0x495ed8,_0x55518e,_0x272517){var _0x16468c,_0x521afe;var _0x5c625a=[];var _0x49ff4a=moment()['format'](_0x96f5('0x8d'));return db[_0x96f5('0x43')]['find']({'where':{'id':_0x495ed8['params']['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x55518e,null))[_0x96f5('0x28')](function(_0x187519){if(_0x187519){_0x521afe=_0x187519;return _0x187519[_0x96f5('0x8e')](_0x495ed8[_0x96f5('0x4c')]['ids'],_[_0x96f5('0x55')](_0x495ed8[_0x96f5('0x4c')],['ids','id'])||{});}return null;})[_0x96f5('0x65')](function(_0x480579){var _0x496679;var _0x2238ab;_0x16468c=_0x480579||[];var _0x40d3c9=[];if(_0x480579){for(var _0x223c5c=0x0;_0x223c5c<_0x480579[_0x96f5('0x37')];_0x223c5c+=0x1){var _0x499ba7=_0x480579[_0x223c5c][_0x96f5('0x2a')]({'plain':!![]});_0x496679=squel[_0x96f5('0x68')]()['into']('cm_hopper_black')['fromQuery']([_0x96f5('0x6a'),_0x96f5('0x7d'),_0x96f5('0x6c'),'CampaignId',_0x96f5('0x56'),'updatedAt'],squel[_0x96f5('0x6d')]()[_0x96f5('0x6e')](_0x96f5('0x6a'),_0x96f5('0x6a'))[_0x96f5('0x6e')]('id',_0x96f5('0x7d'))[_0x96f5('0x6e')](_0x499ba7[_0x96f5('0x6f')][_0x96f5('0x70')](),_0x96f5('0x6c'))[_0x96f5('0x6e')](_0x495ed8[_0x96f5('0x48')]['id'][_0x96f5('0x70')](),_0x96f5('0x5b'))[_0x96f5('0x6e')](_0x96f5('0x7e'),_0x96f5('0x56'))[_0x96f5('0x6e')](_0x96f5('0x7e'),'updatedAt')[_0x96f5('0x71')](_0x96f5('0x72'))['where']('deletedAt\x20IS\x20NULL')[_0x96f5('0x3e')](_0x96f5('0x74'),_0x499ba7[_0x96f5('0x6f')]['toString']())[_0x96f5('0x3e')](_0x96f5('0x75')))['toString']();_0x40d3c9['push'](db[_0x96f5('0x88')][_0x96f5('0x30')](_0x496679));}return BPromise['all'](_0x40d3c9);}})[_0x96f5('0x28')](function(){return _0x16468c;})['then'](respondWithResult(_0x55518e,null))[_0x96f5('0x47')](handleError(_0x55518e,null));};exports['removeBlackLists']=function(_0x3e145e,_0x1d7600,_0x5ba30){return db[_0x96f5('0x43')][_0x96f5('0x4a')]({'where':{'id':_0x3e145e[_0x96f5('0x48')]['id']}})[_0x96f5('0x28')](handleEntityNotFound(_0x1d7600,null))[_0x96f5('0x28')](function(_0x4a3d2b){if(_0x4a3d2b){return _0x4a3d2b['removeBlackLists'](_0x3e145e[_0x96f5('0x30')][_0x96f5('0x64')]);}})[_0x96f5('0x28')](function(_0x47be41){if(_0x47be41){return db[_0x96f5('0x5f')][_0x96f5('0x29')]({'where':{'ListId':_0x3e145e[_0x96f5('0x30')][_0x96f5('0x64')],'CampaignId':_0x3e145e[_0x96f5('0x48')]['id']}})['then'](function(){return _0x47be41;});}})[_0x96f5('0x28')](respondWithStatusCode(_0x1d7600,null))[_0x96f5('0x47')](handleError(_0x1d7600,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 2d4f7bc..d301c99 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1e8690,_0x5c6b4c){var _0x414bea=function(_0x6284dd){while(--_0x6284dd){_0x1e8690['push'](_0x1e8690['shift']());}};_0x414bea(++_0x5c6b4c);}(_0x7a54,0x106));var _0x47a5=function(_0xbff22d,_0x5eaf11){_0xbff22d=_0xbff22d-0x0;var _0x47a481=_0x7a54[_0xbff22d];return _0x47a481;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 f6fcfe9..f914799 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 _0x01fe=['raw','attributes','limit','include','map','model','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','findAll','options'];(function(_0x544f1d,_0x2b946a){var _0xa329a7=function(_0x56324a){while(--_0x56324a){_0x544f1d['push'](_0x544f1d['shift']());}};_0xa329a7(++_0x2b946a);}(_0x01fe,0x102));var _0xe01f=function(_0x16523f,_0xf2bcf3){_0x16523f=_0x16523f-0x0;var _0x562c8c=_0x01fe[_0x16523f];return _0x562c8c;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var moment=require(_0xe01f('0x1'));var BPromise=require(_0xe01f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe01f('0x3'))['db'];var utils=require(_0xe01f('0x4'));var logger=require(_0xe01f('0x5'))(_0xe01f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe01f('0x7'));var client=jayson['client'][_0xe01f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b754f,_0x45431b,_0x40376f){return new BPromise(function(_0x377881,_0x4d1775){return client[_0xe01f('0x9')](_0x3b754f,_0x40376f)[_0xe01f('0xa')](function(_0x47dc30){logger[_0xe01f('0xb')]('Campaign,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'));logger[_0xe01f('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'),JSON['stringify'](_0x47dc30));if(_0x47dc30[_0xe01f('0xe')]){if(_0x47dc30[_0xe01f('0xe')][_0xe01f('0xf')]===0x1f4){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x4d1775(_0x47dc30[_0xe01f('0xe')]['message']);}logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x377881(_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);}else{logger[_0xe01f('0xb')]('Campaign,\x20%s,\x20%s',_0x45431b,'request\x20sent');_0x377881(_0x47dc30['result'][_0xe01f('0x11')]);}})[_0xe01f('0x12')](function(_0x88606f){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x88606f);_0x4d1775(_0x88606f);});});}exports[_0xe01f('0x13')]=function(_0x144eef){var _0x26cd4d=this;return new Promise(function(_0x9ee4b5,_0x2ddaa3){return db['Campaign'][_0xe01f('0x14')]({'raw':_0x144eef['options']?_0x144eef[_0xe01f('0x15')][_0xe01f('0x16')]===undefined?!![]:![]:!![],'where':_0x144eef[_0xe01f('0x15')]?_0x144eef[_0xe01f('0x15')]['where']||null:null,'attributes':_0x144eef[_0xe01f('0x15')]?_0x144eef[_0xe01f('0x15')][_0xe01f('0x17')]||null:null,'limit':_0x144eef[_0xe01f('0x15')]?_0x144eef[_0xe01f('0x15')][_0xe01f('0x18')]||null:null,'include':_0x144eef['options']?_0x144eef[_0xe01f('0x15')][_0xe01f('0x19')]?_[_0xe01f('0x1a')](_0x144eef[_0xe01f('0x15')][_0xe01f('0x19')],function(_0x38efcc){return{'model':db[_0x38efcc[_0xe01f('0x1b')]],'as':_0x38efcc['as'],'attributes':_0x38efcc[_0xe01f('0x17')],'include':_0x38efcc[_0xe01f('0x19')]?_['map'](_0x38efcc['include'],function(_0x3138d3){return{'model':db[_0x3138d3[_0xe01f('0x1b')]],'as':_0x3138d3['as'],'attributes':_0x3138d3[_0xe01f('0x17')],'include':_0x3138d3[_0xe01f('0x19')]?_['map'](_0x3138d3[_0xe01f('0x19')],function(_0x42b213){return{'model':db[_0x42b213['model']],'as':_0x42b213['as'],'attributes':_0x42b213[_0xe01f('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b77c8){logger[_0xe01f('0xb')](_0xe01f('0x13'),_0x144eef);logger['debug'](_0xe01f('0x13'),_0x144eef,JSON['stringify'](_0x1b77c8));_0x9ee4b5(_0x1b77c8);})[_0xe01f('0x12')](function(_0x232ad1){logger[_0xe01f('0xe')](_0xe01f('0x13'),_0x232ad1[_0xe01f('0x11')],_0x144eef);_0x2ddaa3(_0x26cd4d[_0xe01f('0xe')](0x1f4,_0x232ad1[_0xe01f('0x11')]));});});}; \ No newline at end of file +var _0x53d5=['code','message','result','Campaign','findAll','options','raw','map','include','model','attributes','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4da968,_0x13cae2){var _0x2c693a=function(_0x19384b){while(--_0x19384b){_0x4da968['push'](_0x4da968['shift']());}};_0x2c693a(++_0x13cae2);}(_0x53d5,0x1cc));var _0x553d=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x53d5[_0x5c846d];return _0xd064e4;};'use strict';var _=require(_0x553d('0x0'));var util=require(_0x553d('0x1'));var moment=require(_0x553d('0x2'));var BPromise=require(_0x553d('0x3'));var rs=require(_0x553d('0x4'));var fs=require('fs');var Redis=require(_0x553d('0x5'));var db=require(_0x553d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x553d('0x7'))(_0x553d('0x8'));var config=require(_0x553d('0x9'));var jayson=require(_0x553d('0xa'));var client=jayson[_0x553d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d5a5e,_0x39ad58,_0x1c38b2){return new BPromise(function(_0x14ef22,_0x3ae967){return client[_0x553d('0xc')](_0x1d5a5e,_0x1c38b2)[_0x553d('0xd')](function(_0x3c08bf){logger[_0x553d('0xe')](_0x553d('0xf'),_0x39ad58,_0x553d('0x10'));logger[_0x553d('0x11')]('Campaign,\x20%s,\x20%s,\x20%s',_0x39ad58,'request\x20sent',JSON[_0x553d('0x12')](_0x3c08bf));if(_0x3c08bf['error']){if(_0x3c08bf[_0x553d('0x13')][_0x553d('0x14')]===0x1f4){logger[_0x553d('0x13')](_0x553d('0xf'),_0x39ad58,_0x3c08bf[_0x553d('0x13')][_0x553d('0x15')]);return _0x3ae967(_0x3c08bf[_0x553d('0x13')][_0x553d('0x15')]);}logger[_0x553d('0x13')](_0x553d('0xf'),_0x39ad58,_0x3c08bf[_0x553d('0x13')][_0x553d('0x15')]);return _0x14ef22(_0x3c08bf['error'][_0x553d('0x15')]);}else{logger['info'](_0x553d('0xf'),_0x39ad58,_0x553d('0x10'));_0x14ef22(_0x3c08bf[_0x553d('0x16')]['message']);}})['catch'](function(_0x321038){logger[_0x553d('0x13')](_0x553d('0xf'),_0x39ad58,_0x321038);_0x3ae967(_0x321038);});});}exports['GetCampaign']=function(_0x2ab468){var _0x328865=this;return new Promise(function(_0x343ce5,_0x3ff58f){return db[_0x553d('0x17')][_0x553d('0x18')]({'raw':_0x2ab468[_0x553d('0x19')]?_0x2ab468[_0x553d('0x19')][_0x553d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ab468[_0x553d('0x19')]?_0x2ab468[_0x553d('0x19')]['where']||null:null,'attributes':_0x2ab468[_0x553d('0x19')]?_0x2ab468[_0x553d('0x19')]['attributes']||null:null,'limit':_0x2ab468[_0x553d('0x19')]?_0x2ab468[_0x553d('0x19')]['limit']||null:null,'include':_0x2ab468['options']?_0x2ab468['options']['include']?_[_0x553d('0x1b')](_0x2ab468['options'][_0x553d('0x1c')],function(_0xacc984){return{'model':db[_0xacc984[_0x553d('0x1d')]],'as':_0xacc984['as'],'attributes':_0xacc984[_0x553d('0x1e')],'include':_0xacc984[_0x553d('0x1c')]?_['map'](_0xacc984['include'],function(_0x2caed9){return{'model':db[_0x2caed9['model']],'as':_0x2caed9['as'],'attributes':_0x2caed9[_0x553d('0x1e')],'include':_0x2caed9[_0x553d('0x1c')]?_['map'](_0x2caed9[_0x553d('0x1c')],function(_0x2c0484){return{'model':db[_0x2c0484[_0x553d('0x1d')]],'as':_0x2c0484['as'],'attributes':_0x2c0484['attributes']};}):[]};}):[]};}):[]:[]})[_0x553d('0xd')](function(_0x349b3f){logger[_0x553d('0xe')]('GetCampaign',_0x2ab468);logger[_0x553d('0x11')](_0x553d('0x1f'),_0x2ab468,JSON[_0x553d('0x12')](_0x349b3f));_0x343ce5(_0x349b3f);})['catch'](function(_0x37ddd7){logger[_0x553d('0x13')](_0x553d('0x1f'),_0x37ddd7['message'],_0x2ab468);_0x3ff58f(_0x328865[_0x553d('0x13')](0x1f4,_0x37ddd7['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a1466de..8c47270 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 _0x0582=['put','update','delete','destroy','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','/:id/clone','addLists','post','addBlackLists'];(function(_0x35923f,_0xf96238){var _0x1b0b02=function(_0x5249c0){while(--_0x5249c0){_0x35923f['push'](_0x35923f['shift']());}};_0x1b0b02(++_0xf96238);}(_0x0582,0x150));var _0x2058=function(_0x1a4ee9,_0x453bfa){_0x1a4ee9=_0x1a4ee9-0x0;var _0x2f8680=_0x0582[_0x1a4ee9];return _0x2f8680;};'use strict';var multer=require('multer');var util=require(_0x2058('0x0'));var path=require(_0x2058('0x1'));var timeout=require(_0x2058('0x2'));var express=require(_0x2058('0x3'));var router=express[_0x2058('0x4')]();var fs_extra=require(_0x2058('0x5'));var auth=require(_0x2058('0x6'));var interaction=require(_0x2058('0x7'));var config=require(_0x2058('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x2058('0x9')](),controller[_0x2058('0xa')]);router[_0x2058('0xb')](_0x2058('0xc'),auth[_0x2058('0x9')](),controller[_0x2058('0xd')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0x2058('0xb')](_0x2058('0xe'),auth[_0x2058('0x9')](),controller[_0x2058('0xf')]);router[_0x2058('0xb')](_0x2058('0x10'),auth[_0x2058('0x9')](),controller[_0x2058('0x11')]);router[_0x2058('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x2058('0x12')]);router['get'](_0x2058('0x13'),auth[_0x2058('0x9')](),controller[_0x2058('0x14')]);router[_0x2058('0xb')](_0x2058('0x15'),auth[_0x2058('0x9')](),controller['getBlackLists']);router['post']('/',auth[_0x2058('0x9')](),controller[_0x2058('0x16')]);router['post'](_0x2058('0x17'),auth[_0x2058('0x9')](),controller['clone']);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x2058('0x18')]);router[_0x2058('0x19')](_0x2058('0x15'),auth['isAuthenticated'](),controller[_0x2058('0x1a')]);router[_0x2058('0x1b')](_0x2058('0xc'),auth[_0x2058('0x9')](),controller[_0x2058('0x1c')]);router[_0x2058('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x2058('0x1e')]);router[_0x2058('0x1d')]('/:id/lists',auth[_0x2058('0x9')](),controller[_0x2058('0x1f')]);router[_0x2058('0x1d')]('/:id/blacklists',auth[_0x2058('0x9')](),controller[_0x2058('0x20')]);module['exports']=router; \ No newline at end of file +var _0x350a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addBlackLists','put','update','delete','/:id','destroy','removeLists','removeBlackLists','multer','util','path'];(function(_0x43e6ab,_0x4d0d9b){var _0x394da=function(_0x345edd){while(--_0x345edd){_0x43e6ab['push'](_0x43e6ab['shift']());}};_0x394da(++_0x4d0d9b);}(_0x350a,0xb1));var _0xa350=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x350a[_0x233cb1];return _0x29ee7e;};'use strict';var multer=require(_0xa350('0x0'));var util=require(_0xa350('0x1'));var path=require(_0xa350('0x2'));var timeout=require('connect-timeout');var express=require(_0xa350('0x3'));var router=express[_0xa350('0x4')]();var fs_extra=require(_0xa350('0x5'));var auth=require(_0xa350('0x6'));var interaction=require(_0xa350('0x7'));var config=require(_0xa350('0x8'));var controller=require('./campaign.controller');router[_0xa350('0x9')]('/',auth[_0xa350('0xa')](),controller[_0xa350('0xb')]);router[_0xa350('0x9')]('/:id',auth[_0xa350('0xa')](),controller[_0xa350('0xc')]);router['get'](_0xa350('0xd'),auth[_0xa350('0xa')](),controller[_0xa350('0xe')]);router['get'](_0xa350('0xf'),auth[_0xa350('0xa')](),controller[_0xa350('0x10')]);router[_0xa350('0x9')](_0xa350('0x11'),auth[_0xa350('0xa')](),controller[_0xa350('0x12')]);router[_0xa350('0x9')](_0xa350('0x13'),auth['isAuthenticated'](),controller[_0xa350('0x14')]);router[_0xa350('0x9')](_0xa350('0x15'),auth['isAuthenticated'](),controller[_0xa350('0x16')]);router['get'](_0xa350('0x17'),auth[_0xa350('0xa')](),controller[_0xa350('0x18')]);router[_0xa350('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa350('0x1a'),auth[_0xa350('0xa')](),controller[_0xa350('0x1b')]);router[_0xa350('0x19')]('/:id/lists',auth[_0xa350('0xa')](),controller['addLists']);router[_0xa350('0x19')](_0xa350('0x17'),auth['isAuthenticated'](),controller[_0xa350('0x1c')]);router[_0xa350('0x1d')]('/:id',auth[_0xa350('0xa')](),controller[_0xa350('0x1e')]);router[_0xa350('0x1f')](_0xa350('0x20'),auth[_0xa350('0xa')](),controller[_0xa350('0x21')]);router[_0xa350('0x1f')]('/:id/lists',auth[_0xa350('0xa')](),controller[_0xa350('0x22')]);router[_0xa350('0x1f')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xa350('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 0fbb821..d411a40 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 _0xc073=['key','sequelize','exports','medium','STRING','getDataValue'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xc073,0xa3));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3c07('0x0'));module[_0x3c07('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x3c07('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3c07('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3c07('0x4')](_0x3c07('0x5'));}}}; \ No newline at end of file +var _0xaedf=['exports','STRING','medium','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaedf,0x173));var _0xfaed=function(_0x353528,_0x25beb0){_0x353528=_0x353528-0x0;var _0x4f6e68=_0xaedf[_0x353528];return _0x4f6e68;};'use strict';var Sequelize=require(_0xfaed('0x0'));module[_0xfaed('0x1')]={'key':{'type':Sequelize[_0xfaed('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xfaed('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfaed('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6f8707c..e28f639 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 _0xad5c=['bluebird','mustache','util','path','to-csv','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','end','error','stack','name','index','map','CannedAnswer','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x717d04,_0xe8ef52){var _0x5c52de=function(_0x5d242d){while(--_0x5d242d){_0x717d04['push'](_0x717d04['shift']());}};_0x5c52de(++_0xe8ef52);}(_0xad5c,0xa1));var _0xcad5=function(_0x4c3f08,_0x2c22c0){_0x4c3f08=_0x4c3f08-0x0;var _0x442de5=_0xad5c[_0x4c3f08];return _0x442de5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcad5('0x0'));var zipdir=require(_0xcad5('0x1'));var jsonpatch=require(_0xcad5('0x2'));var rp=require(_0xcad5('0x3'));var moment=require(_0xcad5('0x4'));var BPromise=require(_0xcad5('0x5'));var Mustache=require(_0xcad5('0x6'));var util=require(_0xcad5('0x7'));var path=require(_0xcad5('0x8'));var sox=require('sox');var csv=require(_0xcad5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcad5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcad5('0xb'));var toCsv=require(_0xcad5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcad5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xcad5('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcad5('0xe'));var utils=require(_0xcad5('0xf'));var config=require(_0xcad5('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bb8db,_0x5cd603){_0x5cd603=_0x5cd603||0xcc;return function(_0x53515c){if(_0x53515c){return _0x5bb8db[_0xcad5('0x11')](_0x5cd603);}return _0x5bb8db[_0xcad5('0x12')](_0x5cd603)['end']();};}function respondWithResult(_0x182d3e,_0x1a1cdb){_0x1a1cdb=_0x1a1cdb||0xc8;return function(_0x25e8a1){if(_0x25e8a1){return _0x182d3e[_0xcad5('0x12')](_0x1a1cdb)[_0xcad5('0x13')](_0x25e8a1);}};}function respondWithFilteredResult(_0x40bdc4,_0x4fe8b9){return function(_0x5e108d){if(_0x5e108d){var _0x5324f4=typeof _0x4fe8b9[_0xcad5('0x14')]===_0xcad5('0x15')&&typeof _0x4fe8b9['limit']===_0xcad5('0x15');var _0x2410a5=_0x5e108d[_0xcad5('0x16')];var _0x4d73c9=_0x5324f4?0x0:_0x4fe8b9[_0xcad5('0x14')];var _0xe042bd=_0x5324f4?_0x5e108d['count']:_0x4fe8b9[_0xcad5('0x14')]+_0x4fe8b9[_0xcad5('0x17')];var _0x468f83;if(_0xe042bd>=_0x2410a5){_0xe042bd=_0x2410a5;_0x468f83=0xc8;}else{_0x468f83=0xce;}_0x40bdc4[_0xcad5('0x12')](_0x468f83);return _0x40bdc4[_0xcad5('0x18')](_0xcad5('0x19'),_0x4d73c9+'-'+_0xe042bd+'/'+_0x2410a5)[_0xcad5('0x13')](_0x5e108d);}return null;};}function patchUpdates(_0x39fd99){return function(_0x248c52){try{jsonpatch[_0xcad5('0x1a')](_0x248c52,_0x39fd99,!![]);}catch(_0x10c6ca){return BPromise[_0xcad5('0x1b')](_0x10c6ca);}return _0x248c52[_0xcad5('0x1c')]();};}function saveUpdates(_0x396e7b,_0x24fa46){return function(_0x19df28){if(_0x19df28){return _0x19df28['update'](_0x396e7b)[_0xcad5('0x1d')](function(_0x21b43a){return _0x21b43a;});}return null;};}function removeEntity(_0x45ec02,_0x1fa985){return function(_0x20b5ca){if(_0x20b5ca){return _0x20b5ca[_0xcad5('0x1e')]()['then'](function(){var _0x124fee=_0x20b5ca[_0xcad5('0x1f')]({'plain':!![]});var _0x18e7e8=_0xcad5('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x18e7e8,'resourceId':_0x124fee['id']}})[_0xcad5('0x1d')](function(){return _0x20b5ca;});})[_0xcad5('0x1d')](function(){_0x45ec02[_0xcad5('0x12')](0xcc)[_0xcad5('0x21')]();});}};}function handleEntityNotFound(_0x31d868,_0x1931da){return function(_0x2b4559){if(!_0x2b4559){_0x31d868[_0xcad5('0x11')](0x194);}return _0x2b4559;};}function handleError(_0x2181c2,_0x1e128b){_0x1e128b=_0x1e128b||0x1f4;return function(_0x2870fb){logger[_0xcad5('0x22')](_0x2870fb[_0xcad5('0x23')]);if(_0x2870fb[_0xcad5('0x24')]){delete _0x2870fb[_0xcad5('0x24')];}_0x2181c2[_0xcad5('0x12')](_0x1e128b)['send'](_0x2870fb);};}exports[_0xcad5('0x25')]=function(_0x3bfdea,_0x2c338e){var _0x58067e={},_0x5d31e7={},_0x5ddacc={'count':0x0,'rows':[]};var _0x20a5e2=_[_0xcad5('0x26')](db[_0xcad5('0x27')]['rawAttributes'],function(_0x3c3647){return{'name':_0x3c3647[_0xcad5('0x28')],'type':_0x3c3647[_0xcad5('0x29')]['key']};});_0x5d31e7[_0xcad5('0x2a')]=_[_0xcad5('0x26')](_0x20a5e2,_0xcad5('0x24'));_0x5d31e7[_0xcad5('0x2b')]=_[_0xcad5('0x2c')](_0x3bfdea[_0xcad5('0x2b')]);_0x5d31e7[_0xcad5('0x2d')]=_['intersection'](_0x5d31e7['model'],_0x5d31e7['query']);_0x58067e[_0xcad5('0x2e')]=_[_0xcad5('0x2f')](_0x5d31e7[_0xcad5('0x2a')],qs[_0xcad5('0x30')](_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x30')]));_0x58067e[_0xcad5('0x2e')]=_0x58067e['attributes'][_0xcad5('0x31')]?_0x58067e[_0xcad5('0x2e')]:_0x5d31e7[_0xcad5('0x2a')];if(!_0x3bfdea[_0xcad5('0x2b')]['hasOwnProperty'](_0xcad5('0x32'))){_0x58067e[_0xcad5('0x17')]=qs[_0xcad5('0x17')](_0x3bfdea['query'][_0xcad5('0x17')]);_0x58067e[_0xcad5('0x14')]=qs[_0xcad5('0x14')](_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x14')]);}_0x58067e['order']=qs['sort'](_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x33')]);_0x58067e[_0xcad5('0x34')]=qs['filters'](_['pick'](_0x3bfdea[_0xcad5('0x2b')],_0x5d31e7[_0xcad5('0x2d')]),_0x20a5e2);if(_0x3bfdea['query'][_0xcad5('0x35')]){_0x58067e[_0xcad5('0x34')]=_[_0xcad5('0x36')](_0x58067e[_0xcad5('0x34')],{'$or':[{'key':{'$like':'%'+_0x3bfdea['query'][_0xcad5('0x35')]+'%'}},{'value':{'$like':'%'+_0x3bfdea[_0xcad5('0x2b')][_0xcad5('0x35')]+'%'}}]});}_0x58067e=_[_0xcad5('0x36')]({},_0x58067e,_0x3bfdea[_0xcad5('0x37')]);var _0x326e87={'where':_0x58067e[_0xcad5('0x34')]};return db[_0xcad5('0x27')][_0xcad5('0x16')](_0x326e87)[_0xcad5('0x1d')](function(_0x19b46e){_0x5ddacc[_0xcad5('0x16')]=_0x19b46e;if(_0x3bfdea['query']['includeAll']){_0x58067e[_0xcad5('0x38')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcad5('0x39')](_0x58067e);})[_0xcad5('0x1d')](function(_0x41e872){_0x5ddacc[_0xcad5('0x3a')]=_0x41e872;return _0x5ddacc;})[_0xcad5('0x1d')](respondWithFilteredResult(_0x2c338e,_0x58067e))['catch'](handleError(_0x2c338e,null));};exports[_0xcad5('0x3b')]=function(_0x348539,_0x21fbfc){var _0x315fcf={'raw':!![],'where':{'id':_0x348539[_0xcad5('0x3c')]['id']}},_0x1f6894={};_0x1f6894[_0xcad5('0x2a')]=_[_0xcad5('0x2c')](db[_0xcad5('0x27')][_0xcad5('0x3d')]);_0x1f6894['query']=_[_0xcad5('0x2c')](_0x348539['query']);_0x1f6894[_0xcad5('0x2d')]=_[_0xcad5('0x2f')](_0x1f6894['model'],_0x1f6894[_0xcad5('0x2b')]);_0x315fcf[_0xcad5('0x2e')]=_[_0xcad5('0x2f')](_0x1f6894['model'],qs['fields'](_0x348539['query'][_0xcad5('0x30')]));_0x315fcf[_0xcad5('0x2e')]=_0x315fcf[_0xcad5('0x2e')][_0xcad5('0x31')]?_0x315fcf[_0xcad5('0x2e')]:_0x1f6894[_0xcad5('0x2a')];if(_0x348539['query'][_0xcad5('0x3e')]){_0x315fcf[_0xcad5('0x38')]=[{'all':!![]}];}_0x315fcf=_[_0xcad5('0x36')]({},_0x315fcf,_0x348539[_0xcad5('0x37')]);return db[_0xcad5('0x27')][_0xcad5('0x3f')](_0x315fcf)[_0xcad5('0x1d')](handleEntityNotFound(_0x21fbfc,null))[_0xcad5('0x1d')](respondWithResult(_0x21fbfc,null))[_0xcad5('0x40')](handleError(_0x21fbfc,null));};exports[_0xcad5('0x41')]=function(_0xf537e1,_0xb5d592){if(_0xf537e1[_0xcad5('0x42')]['id']){delete _0xf537e1[_0xcad5('0x42')]['id'];}return db[_0xcad5('0x27')]['find']({'where':{'id':_0xf537e1[_0xcad5('0x3c')]['id']}})[_0xcad5('0x1d')](handleEntityNotFound(_0xb5d592,null))[_0xcad5('0x1d')](saveUpdates(_0xf537e1[_0xcad5('0x42')],null))['then'](respondWithResult(_0xb5d592,null))[_0xcad5('0x40')](handleError(_0xb5d592,null));};exports[_0xcad5('0x1e')]=function(_0x261920,_0x3e8245){return db[_0xcad5('0x27')][_0xcad5('0x3f')]({'where':{'id':_0x261920[_0xcad5('0x3c')]['id']}})[_0xcad5('0x1d')](handleEntityNotFound(_0x3e8245,null))[_0xcad5('0x1d')](removeEntity(_0x3e8245,null))[_0xcad5('0x40')](handleError(_0x3e8245,null));};exports[_0xcad5('0x43')]=function(_0x546e4a,_0x3a47dc){var _0x35f753={'key':_0x546e4a[_0xcad5('0x42')][_0xcad5('0x44')]};if(_0x546e4a['body'][_0xcad5('0x45')]){_0x35f753[_0xcad5('0x45')]=_0x546e4a[_0xcad5('0x42')][_0xcad5('0x45')];}else if(_0x546e4a[_0xcad5('0x42')][_0xcad5('0x46')]){_0x35f753[_0xcad5('0x46')]=_0x546e4a[_0xcad5('0x42')][_0xcad5('0x46')];}else if(_0x546e4a[_0xcad5('0x42')][_0xcad5('0x47')]){_0x35f753[_0xcad5('0x47')]=_0x546e4a[_0xcad5('0x42')][_0xcad5('0x47')];}else if(_0x546e4a['body']['ChatWebsiteId']){_0x35f753[_0xcad5('0x48')]=_0x546e4a['body'][_0xcad5('0x48')];}return db[_0xcad5('0x27')][_0xcad5('0x3f')]({'where':_0x35f753})['then'](function(_0x1183ad){if(_0x1183ad){throw new db[(_0xcad5('0x49'))][(_0xcad5('0x4a'))](_0xcad5('0x4b'));}return db[_0xcad5('0x27')][_0xcad5('0x43')](_0x546e4a[_0xcad5('0x42')]);})[_0xcad5('0x1d')](function(_0x422f73){var _0x156d23=_0x546e4a[_0xcad5('0x4c')][_0xcad5('0x1f')]({'plain':!![]});if(!_0x156d23)throw new Error(_0xcad5('0x4d'));if(_0x156d23[_0xcad5('0x4e')]==='user'){var _0x53f090=_0x422f73[_0xcad5('0x1f')]({'plain':!![]});return db[_0xcad5('0x4f')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x156d23[_0xcad5('0x50')]},'raw':!![]})[_0xcad5('0x1d')](function(_0x3d2019){if(_0x3d2019&&_0x3d2019[_0xcad5('0x51')]===0x0){return db[_0xcad5('0x52')][_0xcad5('0x43')]({'name':_0x53f090[_0xcad5('0x24')],'resourceId':_0x53f090['id'],'type':_0x3d2019[_0xcad5('0x24')],'sectionId':_0x3d2019['id']},{})['then'](function(){return _0x422f73;});}else{return _0x422f73;}})[_0xcad5('0x40')](function(_0x121af4){logger[_0xcad5('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x121af4);throw _0x121af4;});}return _0x422f73;})['then'](respondWithResult(_0x3a47dc,0xc9))['catch'](handleError(_0x3a47dc,null));}; \ No newline at end of file +var _0x3ec3=['where','pick','merge','filter','options','CannedAnswer','includeAll','show','params','intersection','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x3ec3,0x1ed));var _0x33ec=function(_0x3bc82d,_0x59187f){_0x3bc82d=_0x3bc82d-0x0;var _0x2cfb3d=_0x3ec3[_0x3bc82d];return _0x2cfb3d;};'use strict';var emlformat=require(_0x33ec('0x0'));var rimraf=require(_0x33ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33ec('0x2'));var rp=require(_0x33ec('0x3'));var moment=require('moment');var BPromise=require(_0x33ec('0x4'));var Mustache=require('mustache');var util=require(_0x33ec('0x5'));var path=require('path');var sox=require(_0x33ec('0x6'));var csv=require('to-csv');var ejs=require(_0x33ec('0x7'));var fs=require('fs');var fs_extra=require(_0x33ec('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x33ec('0x9'));var jsforce=require(_0x33ec('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x33ec('0xb'));var querystring=require(_0x33ec('0xc'));var Papa=require(_0x33ec('0xd'));var Redis=require('ioredis');var authService=require(_0x33ec('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33ec('0xf'));var logger=require(_0x33ec('0x10'))(_0x33ec('0x11'));var utils=require('../../config/utils');var config=require(_0x33ec('0x12'));var licenseUtil=require(_0x33ec('0x13'));var db=require(_0x33ec('0x14'))['db'];function respondWithStatusCode(_0x56e4ba,_0x9c2383){_0x9c2383=_0x9c2383||0xcc;return function(_0x49f46d){if(_0x49f46d){return _0x56e4ba[_0x33ec('0x15')](_0x9c2383);}return _0x56e4ba[_0x33ec('0x16')](_0x9c2383)['end']();};}function respondWithResult(_0x5daa07,_0x22aee8){_0x22aee8=_0x22aee8||0xc8;return function(_0x347ea6){if(_0x347ea6){return _0x5daa07[_0x33ec('0x16')](_0x22aee8)['json'](_0x347ea6);}};}function respondWithFilteredResult(_0x5c086f,_0x2905ac){return function(_0x673c9a){if(_0x673c9a){var _0x53deac=typeof _0x2905ac['offset']===_0x33ec('0x17')&&typeof _0x2905ac[_0x33ec('0x18')]===_0x33ec('0x17');var _0x584b02=_0x673c9a[_0x33ec('0x19')];var _0x50d131=_0x53deac?0x0:_0x2905ac[_0x33ec('0x1a')];var _0x38a717=_0x53deac?_0x673c9a['count']:_0x2905ac['offset']+_0x2905ac['limit'];var _0x5d42d2;if(_0x38a717>=_0x584b02){_0x38a717=_0x584b02;_0x5d42d2=0xc8;}else{_0x5d42d2=0xce;}_0x5c086f['status'](_0x5d42d2);return _0x5c086f['set'](_0x33ec('0x1b'),_0x50d131+'-'+_0x38a717+'/'+_0x584b02)[_0x33ec('0x1c')](_0x673c9a);}return null;};}function patchUpdates(_0x124517){return function(_0x5b9c6f){try{jsonpatch['apply'](_0x5b9c6f,_0x124517,!![]);}catch(_0x3ef892){return BPromise[_0x33ec('0x1d')](_0x3ef892);}return _0x5b9c6f[_0x33ec('0x1e')]();};}function saveUpdates(_0x369c89,_0x5a420c){return function(_0x3eae01){if(_0x3eae01){return _0x3eae01[_0x33ec('0x1f')](_0x369c89)['then'](function(_0x399ea1){return _0x399ea1;});}return null;};}function removeEntity(_0x29d5a0,_0x481c1d){return function(_0x426c1f){if(_0x426c1f){return _0x426c1f[_0x33ec('0x20')]()[_0x33ec('0x21')](function(){var _0x22cb6d=_0x426c1f[_0x33ec('0x22')]({'plain':!![]});var _0x5bd080=_0x33ec('0x23');return db[_0x33ec('0x24')][_0x33ec('0x20')]({'where':{'type':_0x5bd080,'resourceId':_0x22cb6d['id']}})[_0x33ec('0x21')](function(){return _0x426c1f;});})[_0x33ec('0x21')](function(){_0x29d5a0[_0x33ec('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a122e,_0x458365){return function(_0x4bf60a){if(!_0x4bf60a){_0x1a122e[_0x33ec('0x15')](0x194);}return _0x4bf60a;};}function handleError(_0x5190eb,_0x4be4dd){_0x4be4dd=_0x4be4dd||0x1f4;return function(_0x1dd944){logger[_0x33ec('0x25')](_0x1dd944[_0x33ec('0x26')]);if(_0x1dd944[_0x33ec('0x27')]){delete _0x1dd944['name'];}_0x5190eb[_0x33ec('0x16')](_0x4be4dd)['send'](_0x1dd944);};}exports[_0x33ec('0x28')]=function(_0x3c8191,_0x897eb0){var _0x3d72e6={},_0x50c966={},_0x7aae7={'count':0x0,'rows':[]};var _0x5c8608=_[_0x33ec('0x29')](db['CannedAnswer'][_0x33ec('0x2a')],function(_0x5d8ed2){return{'name':_0x5d8ed2['fieldName'],'type':_0x5d8ed2[_0x33ec('0x2b')]['key']};});_0x50c966[_0x33ec('0x2c')]=_[_0x33ec('0x29')](_0x5c8608,_0x33ec('0x27'));_0x50c966[_0x33ec('0x2d')]=_[_0x33ec('0x2e')](_0x3c8191[_0x33ec('0x2d')]);_0x50c966[_0x33ec('0x2f')]=_['intersection'](_0x50c966[_0x33ec('0x2c')],_0x50c966[_0x33ec('0x2d')]);_0x3d72e6[_0x33ec('0x30')]=_['intersection'](_0x50c966[_0x33ec('0x2c')],qs[_0x33ec('0x31')](_0x3c8191[_0x33ec('0x2d')]['fields']));_0x3d72e6[_0x33ec('0x30')]=_0x3d72e6[_0x33ec('0x30')][_0x33ec('0x32')]?_0x3d72e6[_0x33ec('0x30')]:_0x50c966['model'];if(!_0x3c8191[_0x33ec('0x2d')][_0x33ec('0x33')](_0x33ec('0x34'))){_0x3d72e6[_0x33ec('0x18')]=qs[_0x33ec('0x18')](_0x3c8191['query'][_0x33ec('0x18')]);_0x3d72e6[_0x33ec('0x1a')]=qs['offset'](_0x3c8191['query']['offset']);}_0x3d72e6['order']=qs['sort'](_0x3c8191[_0x33ec('0x2d')]['sort']);_0x3d72e6[_0x33ec('0x35')]=qs[_0x33ec('0x2f')](_[_0x33ec('0x36')](_0x3c8191[_0x33ec('0x2d')],_0x50c966[_0x33ec('0x2f')]),_0x5c8608);if(_0x3c8191[_0x33ec('0x2d')]['filter']){_0x3d72e6['where']=_[_0x33ec('0x37')](_0x3d72e6[_0x33ec('0x35')],{'$or':[{'key':{'$like':'%'+_0x3c8191['query'][_0x33ec('0x38')]+'%'}},{'value':{'$like':'%'+_0x3c8191['query']['filter']+'%'}}]});}_0x3d72e6=_[_0x33ec('0x37')]({},_0x3d72e6,_0x3c8191[_0x33ec('0x39')]);var _0x543ef5={'where':_0x3d72e6[_0x33ec('0x35')]};return db[_0x33ec('0x3a')][_0x33ec('0x19')](_0x543ef5)[_0x33ec('0x21')](function(_0x24059e){_0x7aae7[_0x33ec('0x19')]=_0x24059e;if(_0x3c8191[_0x33ec('0x2d')][_0x33ec('0x3b')]){_0x3d72e6['include']=[{'all':!![]}];}return db[_0x33ec('0x3a')]['findAll'](_0x3d72e6);})[_0x33ec('0x21')](function(_0x5d44d4){_0x7aae7['rows']=_0x5d44d4;return _0x7aae7;})['then'](respondWithFilteredResult(_0x897eb0,_0x3d72e6))['catch'](handleError(_0x897eb0,null));};exports[_0x33ec('0x3c')]=function(_0x58f1a1,_0x297c10){var _0x327c39={'raw':!![],'where':{'id':_0x58f1a1[_0x33ec('0x3d')]['id']}},_0x1608ce={};_0x1608ce[_0x33ec('0x2c')]=_[_0x33ec('0x2e')](db[_0x33ec('0x3a')][_0x33ec('0x2a')]);_0x1608ce['query']=_[_0x33ec('0x2e')](_0x58f1a1['query']);_0x1608ce[_0x33ec('0x2f')]=_[_0x33ec('0x3e')](_0x1608ce[_0x33ec('0x2c')],_0x1608ce['query']);_0x327c39['attributes']=_[_0x33ec('0x3e')](_0x1608ce['model'],qs[_0x33ec('0x31')](_0x58f1a1[_0x33ec('0x2d')][_0x33ec('0x31')]));_0x327c39['attributes']=_0x327c39[_0x33ec('0x30')]['length']?_0x327c39[_0x33ec('0x30')]:_0x1608ce[_0x33ec('0x2c')];if(_0x58f1a1[_0x33ec('0x2d')][_0x33ec('0x3b')]){_0x327c39['include']=[{'all':!![]}];}_0x327c39=_['merge']({},_0x327c39,_0x58f1a1[_0x33ec('0x39')]);return db['CannedAnswer'][_0x33ec('0x3f')](_0x327c39)['then'](handleEntityNotFound(_0x297c10,null))[_0x33ec('0x21')](respondWithResult(_0x297c10,null))['catch'](handleError(_0x297c10,null));};exports[_0x33ec('0x1f')]=function(_0x4f51d3,_0x3fd11e){if(_0x4f51d3[_0x33ec('0x40')]['id']){delete _0x4f51d3[_0x33ec('0x40')]['id'];}return db[_0x33ec('0x3a')][_0x33ec('0x3f')]({'where':{'id':_0x4f51d3['params']['id']}})[_0x33ec('0x21')](handleEntityNotFound(_0x3fd11e,null))[_0x33ec('0x21')](saveUpdates(_0x4f51d3[_0x33ec('0x40')],null))['then'](respondWithResult(_0x3fd11e,null))[_0x33ec('0x41')](handleError(_0x3fd11e,null));};exports[_0x33ec('0x20')]=function(_0x254941,_0x2bcf3d){return db[_0x33ec('0x3a')][_0x33ec('0x3f')]({'where':{'id':_0x254941[_0x33ec('0x3d')]['id']}})[_0x33ec('0x21')](handleEntityNotFound(_0x2bcf3d,null))[_0x33ec('0x21')](removeEntity(_0x2bcf3d,null))[_0x33ec('0x41')](handleError(_0x2bcf3d,null));};exports[_0x33ec('0x42')]=function(_0x179d0c,_0x19138a){var _0x59ab15={'key':_0x179d0c['body']['key']};if(_0x179d0c[_0x33ec('0x40')][_0x33ec('0x43')]){_0x59ab15['MailAccountId']=_0x179d0c[_0x33ec('0x40')]['MailAccountId'];}else if(_0x179d0c[_0x33ec('0x40')][_0x33ec('0x44')]){_0x59ab15['SmsAccountId']=_0x179d0c[_0x33ec('0x40')][_0x33ec('0x44')];}else if(_0x179d0c[_0x33ec('0x40')]['OpenchannelAccountId']){_0x59ab15[_0x33ec('0x45')]=_0x179d0c[_0x33ec('0x40')][_0x33ec('0x45')];}else if(_0x179d0c[_0x33ec('0x40')][_0x33ec('0x46')]){_0x59ab15[_0x33ec('0x46')]=_0x179d0c[_0x33ec('0x40')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x59ab15})[_0x33ec('0x21')](function(_0x353e5a){if(_0x353e5a){throw new db[(_0x33ec('0x47'))][(_0x33ec('0x48'))](_0x33ec('0x49'));}return db[_0x33ec('0x3a')]['create'](_0x179d0c[_0x33ec('0x40')]);})['then'](function(_0x34b913){var _0x3b1fa4=_0x179d0c[_0x33ec('0x4a')][_0x33ec('0x22')]({'plain':!![]});if(!_0x3b1fa4)throw new Error(_0x33ec('0x4b'));if(_0x3b1fa4['role']==='user'){var _0x531b19=_0x34b913[_0x33ec('0x22')]({'plain':!![]});return db[_0x33ec('0x4c')][_0x33ec('0x3f')]({'where':{'name':'CannedAnswers','userProfileId':_0x3b1fa4['userProfileId']},'raw':!![]})[_0x33ec('0x21')](function(_0x4ab798){if(_0x4ab798&&_0x4ab798['autoAssociation']===0x0){return db[_0x33ec('0x24')][_0x33ec('0x42')]({'name':_0x531b19[_0x33ec('0x27')],'resourceId':_0x531b19['id'],'type':_0x4ab798[_0x33ec('0x27')],'sectionId':_0x4ab798['id']},{})[_0x33ec('0x21')](function(){return _0x34b913;});}else{return _0x34b913;}})['catch'](function(_0x5059b3){logger[_0x33ec('0x25')](_0x33ec('0x4d'),_0x5059b3);throw _0x5059b3;});}return _0x34b913;})[_0x33ec('0x21')](respondWithResult(_0x19138a,0xc9))[_0x33ec('0x41')](handleError(_0x19138a,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 64dbb99..10edbec 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 _0x0901=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x19883a,_0x98963a){var _0x529e8a=function(_0x1513b8){while(--_0x1513b8){_0x19883a['push'](_0x19883a['shift']());}};_0x529e8a(++_0x98963a);}(_0x0901,0x7c));var _0x1090=function(_0x2f6654,_0x3bf51d){_0x2f6654=_0x2f6654-0x0;var _0xbb3c4=_0x0901[_0x2f6654];return _0xbb3c4;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var logger=require(_0x1090('0x2'))(_0x1090('0x3'));var moment=require(_0x1090('0x4'));var BPromise=require('bluebird');var rp=require(_0x1090('0x5'));var fs=require('fs');var path=require(_0x1090('0x6'));var rimraf=require('rimraf');var config=require(_0x1090('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x1090('0x8')]=function(_0x18d4d7,_0x3c6d2f){return _0x18d4d7[_0x1090('0x9')](_0x1090('0xa'),attributes,{'tableName':_0x1090('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1090('0xc'),'collate':_0x1090('0xd')});}; \ No newline at end of file +var _0xaa53=['request-promise','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','bluebird'];(function(_0xc8a02c,_0x4809d3){var _0x3d89da=function(_0x5903d8){while(--_0x5903d8){_0xc8a02c['push'](_0xc8a02c['shift']());}};_0x3d89da(++_0x4809d3);}(_0xaa53,0xb0));var _0x3aa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa53[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3aa5('0x0'));var util=require(_0x3aa5('0x1'));var logger=require(_0x3aa5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3aa5('0x3'));var rp=require(_0x3aa5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3aa5('0x5'));var config=require('../../config/environment');var attributes=require(_0x3aa5('0x6'));module[_0x3aa5('0x7')]=function(_0x2c0962,_0xe00d41){return _0x2c0962[_0x3aa5('0x8')](_0x3aa5('0x9'),attributes,{'tableName':_0x3aa5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3aa5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5e255b9..de82f9d 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(_0x165a92,_0x4eb3ad){var _0x1f77fe=function(_0x693ed0){while(--_0x693ed0){_0x165a92['push'](_0x165a92['shift']());}};_0x1f77fe(++_0x4eb3ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x34360e,_0x70cffb){var _0x1ea2e4=function(_0x4a4153){while(--_0x4a4153){_0x34360e['push'](_0x34360e['shift']());}};_0x1ea2e4(++_0x70cffb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index b1e1c9b..302780e 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 _0x5631=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put','update','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f2ce8,_0x103851){var _0x2d5b1b=function(_0x394cd5){while(--_0x394cd5){_0x4f2ce8['push'](_0x4f2ce8['shift']());}};_0x2d5b1b(++_0x103851);}(_0x5631,0x190));var _0x1563=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x5631[_0x4fd109];return _0x30f0a6;};'use strict';var multer=require(_0x1563('0x0'));var util=require(_0x1563('0x1'));var path=require('path');var timeout=require(_0x1563('0x2'));var express=require(_0x1563('0x3'));var router=express['Router']();var fs_extra=require(_0x1563('0x4'));var auth=require(_0x1563('0x5'));var interaction=require(_0x1563('0x6'));var config=require(_0x1563('0x7'));var controller=require(_0x1563('0x8'));router[_0x1563('0x9')]('/',auth[_0x1563('0xa')](),controller[_0x1563('0xb')]);router[_0x1563('0x9')](_0x1563('0xc'),auth[_0x1563('0xa')](),controller[_0x1563('0xd')]);router[_0x1563('0xe')]('/',auth[_0x1563('0xa')](),controller['create']);router[_0x1563('0xf')](_0x1563('0xc'),auth[_0x1563('0xa')](),controller[_0x1563('0x10')]);router['delete'](_0x1563('0xc'),auth[_0x1563('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x23cc=['destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','update'];(function(_0x47092f,_0x5c7281){var _0x3f0d9c=function(_0xc93dcf){while(--_0xc93dcf){_0x47092f['push'](_0x47092f['shift']());}};_0x3f0d9c(++_0x5c7281);}(_0x23cc,0xa2));var _0xc23c=function(_0x508b42,_0x46d89f){_0x508b42=_0x508b42-0x0;var _0x2ff324=_0x23cc[_0x508b42];return _0x2ff324;};'use strict';var multer=require('multer');var util=require(_0xc23c('0x0'));var path=require(_0xc23c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc23c('0x2'));var router=express[_0xc23c('0x3')]();var fs_extra=require(_0xc23c('0x4'));var auth=require(_0xc23c('0x5'));var interaction=require(_0xc23c('0x6'));var config=require(_0xc23c('0x7'));var controller=require(_0xc23c('0x8'));router[_0xc23c('0x9')]('/',auth[_0xc23c('0xa')](),controller[_0xc23c('0xb')]);router['get'](_0xc23c('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc23c('0xa')](),controller['create']);router['put'](_0xc23c('0xc'),auth[_0xc23c('0xa')](),controller[_0xc23c('0xd')]);router['delete'](_0xc23c('0xc'),auth['isAuthenticated'](),controller[_0xc23c('0xe')]);module[_0xc23c('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4f3a735..b705491 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 _0x3b75=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x2693fc,_0x7bd551){var _0x23d573=function(_0x2bb5fb){while(--_0x2bb5fb){_0x2693fc['push'](_0x2693fc['shift']());}};_0x23d573(++_0x7bd551);}(_0x3b75,0xdc));var _0x53b7=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x3b75[_0x1dd82f];return _0x353ca4;};'use strict';var Sequelize=require(_0x53b7('0x0'));module[_0x53b7('0x1')]={'calldate':{'type':Sequelize[_0x53b7('0x2')],'allowNull':![],'defaultValue':_0x53b7('0x3')},'clid':{'type':Sequelize[_0x53b7('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x53b7('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x53b7('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x53b7('0x4')]},'lastdata':{'type':Sequelize[_0x53b7('0x4')]},'duration':{'type':Sequelize[_0x53b7('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x53b7('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x53b7('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x53b7('0x4')]},'userfield':{'type':Sequelize[_0x53b7('0x4')]},'uniqueid':{'type':Sequelize[_0x53b7('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x53b7('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x53b7('0x4')]},'tag':{'type':Sequelize[_0x53b7('0x4')]}}; \ No newline at end of file +var _0xc116=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x130faf,_0x142193){var _0x2b86c8=function(_0x2046a2){while(--_0x2046a2){_0x130faf['push'](_0x130faf['shift']());}};_0x2b86c8(++_0x142193);}(_0xc116,0x164));var _0x6c11=function(_0x4def48,_0x3a0955){_0x4def48=_0x4def48-0x0;var _0x2b7a70=_0xc116[_0x4def48];return _0x2b7a70;};'use strict';var Sequelize=require(_0x6c11('0x0'));module[_0x6c11('0x1')]={'calldate':{'type':Sequelize[_0x6c11('0x2')],'allowNull':![],'defaultValue':_0x6c11('0x3')},'clid':{'type':Sequelize[_0x6c11('0x4')]},'src':{'type':Sequelize[_0x6c11('0x4')]},'dst':{'type':Sequelize[_0x6c11('0x4')]},'dcontext':{'type':Sequelize[_0x6c11('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x6c11('0x4')]},'lastapp':{'type':Sequelize[_0x6c11('0x4')]},'lastdata':{'type':Sequelize[_0x6c11('0x4')]},'duration':{'type':Sequelize[_0x6c11('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6c11('0x4')]},'amaflags':{'type':Sequelize[_0x6c11('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x6c11('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x6c11('0x4')]},'peeraccount':{'type':Sequelize[_0x6c11('0x4')]},'type':{'type':Sequelize[_0x6c11('0x4')]},'tag':{'type':Sequelize[_0x6c11('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d064c03..578e612 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 _0xe5d5=['status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x16146e,_0x2b9e52){var _0x4c8b1b=function(_0x2dd072){while(--_0x2dd072){_0x16146e['push'](_0x16146e['shift']());}};_0x4c8b1b(++_0x2b9e52);}(_0xe5d5,0x156));var _0x5e5d=function(_0x404b87,_0x1318b0){_0x404b87=_0x404b87-0x0;var _0x59eace=_0xe5d5[_0x404b87];return _0x59eace;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e5d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e5d('0x1'));var moment=require('moment');var BPromise=require(_0x5e5d('0x2'));var Mustache=require('mustache');var util=require(_0x5e5d('0x3'));var path=require(_0x5e5d('0x4'));var sox=require(_0x5e5d('0x5'));var csv=require(_0x5e5d('0x6'));var ejs=require(_0x5e5d('0x7'));var fs=require('fs');var fs_extra=require(_0x5e5d('0x8'));var _=require(_0x5e5d('0x9'));var squel=require(_0x5e5d('0xa'));var crypto=require(_0x5e5d('0xb'));var jsforce=require(_0x5e5d('0xc'));var deskjs=require(_0x5e5d('0xd'));var toCsv=require(_0x5e5d('0x6'));var querystring=require(_0x5e5d('0xe'));var Papa=require(_0x5e5d('0xf'));var Redis=require('ioredis');var authService=require(_0x5e5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e5d('0x11'));var hardwareService=require(_0x5e5d('0x12'));var logger=require('../../config/logger')(_0x5e5d('0x13'));var utils=require(_0x5e5d('0x14'));var config=require(_0x5e5d('0x15'));var licenseUtil=require(_0x5e5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff045,_0x442aed){_0x442aed=_0x442aed||0xcc;return function(_0x1e9be5){if(_0x1e9be5){return _0x4ff045['sendStatus'](_0x442aed);}return _0x4ff045[_0x5e5d('0x17')](_0x442aed)[_0x5e5d('0x18')]();};}function respondWithResult(_0x5a4474,_0x42f1f8){_0x42f1f8=_0x42f1f8||0xc8;return function(_0x3402cf){if(_0x3402cf){return _0x5a4474['status'](_0x42f1f8)['json'](_0x3402cf);}};}function respondWithFilteredResult(_0x5bf617,_0x1a3e5c){return function(_0x3dfb7e){if(_0x3dfb7e){var _0x79e8c1=typeof _0x1a3e5c[_0x5e5d('0x19')]==='undefined'&&typeof _0x1a3e5c[_0x5e5d('0x1a')]===_0x5e5d('0x1b');var _0x39964a=_0x3dfb7e[_0x5e5d('0x1c')];var _0x46b129=_0x79e8c1?0x0:_0x1a3e5c[_0x5e5d('0x19')];var _0x3b655b=_0x79e8c1?_0x3dfb7e[_0x5e5d('0x1c')]:_0x1a3e5c['offset']+_0x1a3e5c[_0x5e5d('0x1a')];var _0x1ceea7;if(_0x3b655b>=_0x39964a){_0x3b655b=_0x39964a;_0x1ceea7=0xc8;}else{_0x1ceea7=0xce;}_0x5bf617[_0x5e5d('0x17')](_0x1ceea7);return _0x5bf617[_0x5e5d('0x1d')](_0x5e5d('0x1e'),_0x46b129+'-'+_0x3b655b+'/'+_0x39964a)[_0x5e5d('0x1f')](_0x3dfb7e);}return null;};}function patchUpdates(_0x517b89){return function(_0x186fa6){try{jsonpatch['apply'](_0x186fa6,_0x517b89,!![]);}catch(_0x968d4b){return BPromise[_0x5e5d('0x20')](_0x968d4b);}return _0x186fa6[_0x5e5d('0x21')]();};}function saveUpdates(_0x4c9973,_0xbacdcb){return function(_0x488a49){if(_0x488a49){return _0x488a49[_0x5e5d('0x22')](_0x4c9973)[_0x5e5d('0x23')](function(_0x3e8a1d){return _0x3e8a1d;});}return null;};}function removeEntity(_0x49a558,_0x49d2e5){return function(_0x271af4){if(_0x271af4){return _0x271af4[_0x5e5d('0x24')]()['then'](function(){_0x49a558['status'](0xcc)[_0x5e5d('0x18')]();});}};}function handleEntityNotFound(_0x4063d5,_0xd466f7){return function(_0x479a1a){if(!_0x479a1a){_0x4063d5[_0x5e5d('0x25')](0x194);}return _0x479a1a;};}function handleError(_0x4de26a,_0x477d54){_0x477d54=_0x477d54||0x1f4;return function(_0x4ed6e5){logger[_0x5e5d('0x26')](_0x4ed6e5[_0x5e5d('0x27')]);if(_0x4ed6e5[_0x5e5d('0x28')]){delete _0x4ed6e5[_0x5e5d('0x28')];}_0x4de26a[_0x5e5d('0x17')](_0x477d54)[_0x5e5d('0x29')](_0x4ed6e5);};}exports[_0x5e5d('0x2a')]=function(_0x56b166,_0x3e407f){var _0x29a123={},_0x3442c1={},_0x4511cd={'count':0x0,'rows':[]};var _0x1f8484=_[_0x5e5d('0x2b')](db[_0x5e5d('0x2c')][_0x5e5d('0x2d')],function(_0x4fe915){return{'name':_0x4fe915['fieldName'],'type':_0x4fe915[_0x5e5d('0x2e')]['key']};});_0x3442c1['model']=_[_0x5e5d('0x2b')](_0x1f8484,_0x5e5d('0x28'));_0x3442c1[_0x5e5d('0x2f')]=_[_0x5e5d('0x30')](_0x56b166[_0x5e5d('0x2f')]);_0x3442c1['filters']=_[_0x5e5d('0x31')](_0x3442c1[_0x5e5d('0x32')],_0x3442c1[_0x5e5d('0x2f')]);_0x29a123[_0x5e5d('0x33')]=_[_0x5e5d('0x31')](_0x3442c1[_0x5e5d('0x32')],qs[_0x5e5d('0x34')](_0x56b166['query'][_0x5e5d('0x34')]));_0x29a123[_0x5e5d('0x33')]=_0x29a123['attributes']['length']?_0x29a123[_0x5e5d('0x33')]:_0x3442c1[_0x5e5d('0x32')];if(!_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x35')](_0x5e5d('0x36'))){_0x29a123[_0x5e5d('0x1a')]=qs['limit'](_0x56b166[_0x5e5d('0x2f')]['limit']);_0x29a123[_0x5e5d('0x19')]=qs[_0x5e5d('0x19')](_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x19')]);}_0x29a123[_0x5e5d('0x37')]=qs['sort'](_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x38')]);_0x29a123['where']=qs[_0x5e5d('0x39')](_['pick'](_0x56b166[_0x5e5d('0x2f')],_0x3442c1[_0x5e5d('0x39')]),_0x1f8484);if(_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3a')]){_0x29a123[_0x5e5d('0x3b')]=_[_0x5e5d('0x3c')](_0x29a123[_0x5e5d('0x3b')],{'$or':_[_0x5e5d('0x2b')](_0x1f8484,function(_0xa51e05){if(_0xa51e05[_0x5e5d('0x2e')]!==_0x5e5d('0x3d')){var _0x1e3106={};_0x1e3106[_0xa51e05['name']]={'$like':'%'+_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3a')]+'%'};return _0x1e3106;}})});}_0x29a123=_[_0x5e5d('0x3c')]({},_0x29a123,_0x56b166[_0x5e5d('0x3e')]);var _0x225ad5={'where':_0x29a123[_0x5e5d('0x3b')]};return db['Cdr'][_0x5e5d('0x1c')](_0x225ad5)[_0x5e5d('0x23')](function(_0x4c2667){_0x4511cd[_0x5e5d('0x1c')]=_0x4c2667;if(_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3f')]){_0x29a123[_0x5e5d('0x40')]=[{'all':!![]}];}return db[_0x5e5d('0x2c')][_0x5e5d('0x41')](_0x29a123);})['then'](function(_0x502aac){_0x4511cd[_0x5e5d('0x42')]=_0x502aac;return _0x4511cd;})['then'](respondWithFilteredResult(_0x3e407f,_0x29a123))[_0x5e5d('0x43')](handleError(_0x3e407f,null));};exports['show']=function(_0x53d75c,_0x2d12cd){var _0x52648c={'raw':!![],'where':{'id':_0x53d75c[_0x5e5d('0x44')]['id']}},_0x550d7a={};_0x550d7a[_0x5e5d('0x32')]=_[_0x5e5d('0x30')](db[_0x5e5d('0x2c')][_0x5e5d('0x2d')]);_0x550d7a[_0x5e5d('0x2f')]=_['keys'](_0x53d75c['query']);_0x550d7a['filters']=_[_0x5e5d('0x31')](_0x550d7a['model'],_0x550d7a[_0x5e5d('0x2f')]);_0x52648c[_0x5e5d('0x33')]=_['intersection'](_0x550d7a[_0x5e5d('0x32')],qs[_0x5e5d('0x34')](_0x53d75c['query'][_0x5e5d('0x34')]));_0x52648c[_0x5e5d('0x33')]=_0x52648c[_0x5e5d('0x33')][_0x5e5d('0x45')]?_0x52648c[_0x5e5d('0x33')]:_0x550d7a['model'];if(_0x53d75c[_0x5e5d('0x2f')][_0x5e5d('0x3f')]){_0x52648c[_0x5e5d('0x40')]=[{'all':!![]}];}_0x52648c=_[_0x5e5d('0x3c')]({},_0x52648c,_0x53d75c[_0x5e5d('0x3e')]);return db[_0x5e5d('0x2c')][_0x5e5d('0x46')](_0x52648c)[_0x5e5d('0x23')](handleEntityNotFound(_0x2d12cd,null))['then'](respondWithResult(_0x2d12cd,null))[_0x5e5d('0x43')](handleError(_0x2d12cd,null));};exports[_0x5e5d('0x47')]=function(_0x1824ec,_0x5d6369){return db[_0x5e5d('0x2c')][_0x5e5d('0x47')](_0x1824ec['body'],{})[_0x5e5d('0x23')](respondWithResult(_0x5d6369,0xc9))[_0x5e5d('0x43')](handleError(_0x5d6369,null));};exports[_0x5e5d('0x22')]=function(_0x56e0ac,_0x3df625){if(_0x56e0ac[_0x5e5d('0x48')]['id']){delete _0x56e0ac[_0x5e5d('0x48')]['id'];}return db[_0x5e5d('0x2c')][_0x5e5d('0x46')]({'where':{'id':_0x56e0ac['params']['id']}})[_0x5e5d('0x23')](handleEntityNotFound(_0x3df625,null))['then'](saveUpdates(_0x56e0ac['body'],null))[_0x5e5d('0x23')](respondWithResult(_0x3df625,null))['catch'](handleError(_0x3df625,null));};exports[_0x5e5d('0x24')]=function(_0x41c3a0,_0x5b3149){return db[_0x5e5d('0x2c')][_0x5e5d('0x46')]({'where':{'id':_0x41c3a0['params']['id']}})['then'](handleEntityNotFound(_0x5b3149,null))[_0x5e5d('0x23')](removeEntity(_0x5b3149,null))[_0x5e5d('0x43')](handleError(_0x5b3149,null));};exports['describe']=function(_0x25065c,_0x46ff94){return db[_0x5e5d('0x2c')]['describe']()[_0x5e5d('0x23')](respondWithResult(_0x46ff94,null))[_0x5e5d('0x43')](handleError(_0x46ff94,null));}; \ No newline at end of file +var _0x4074=['params','rawAttributes','intersection','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','Cdr','then','includeAll','findAll','rows','show'];(function(_0x5d5e6d,_0x54525c){var _0x461385=function(_0x4ee386){while(--_0x4ee386){_0x5d5e6d['push'](_0x5d5e6d['shift']());}};_0x461385(++_0x54525c);}(_0x4074,0xf0));var _0x4407=function(_0x1907f4,_0xcce11f){_0x1907f4=_0x1907f4-0x0;var _0xbeccd3=_0x4074[_0x1907f4];return _0xbeccd3;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){_0x16272f[_0x4407('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309274,_0x5386f4){return function(_0x40fb1e){if(!_0x40fb1e){_0x309274['sendStatus'](0x194);}return _0x40fb1e;};}function handleError(_0x374754,_0x4bf227){_0x4bf227=_0x4bf227||0x1f4;return function(_0x57ba27){logger[_0x4407('0x27')](_0x57ba27[_0x4407('0x28')]);if(_0x57ba27[_0x4407('0x29')]){delete _0x57ba27['name'];}_0x374754['status'](_0x4bf227)['send'](_0x57ba27);};}exports[_0x4407('0x2a')]=function(_0x2feb6b,_0x1f9828){var _0x84a8a={},_0x1d6b3d={},_0x37fba1={'count':0x0,'rows':[]};var _0x182bd9=_['map'](db['Cdr']['rawAttributes'],function(_0x28e99e){return{'name':_0x28e99e[_0x4407('0x2b')],'type':_0x28e99e[_0x4407('0x2c')][_0x4407('0x2d')]};});_0x1d6b3d[_0x4407('0x2e')]=_[_0x4407('0x2f')](_0x182bd9,_0x4407('0x29'));_0x1d6b3d[_0x4407('0x30')]=_[_0x4407('0x31')](_0x2feb6b[_0x4407('0x30')]);_0x1d6b3d['filters']=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],_0x1d6b3d[_0x4407('0x30')]);_0x84a8a[_0x4407('0x32')]=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],qs[_0x4407('0x33')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x33')]));_0x84a8a[_0x4407('0x32')]=_0x84a8a['attributes'][_0x4407('0x34')]?_0x84a8a['attributes']:_0x1d6b3d[_0x4407('0x2e')];if(!_0x2feb6b['query']['hasOwnProperty'](_0x4407('0x35'))){_0x84a8a[_0x4407('0x1f')]=qs[_0x4407('0x1f')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x1f')]);_0x84a8a[_0x4407('0x21')]=qs[_0x4407('0x21')](_0x2feb6b['query'][_0x4407('0x21')]);}_0x84a8a[_0x4407('0x36')]=qs[_0x4407('0x37')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x37')]);_0x84a8a['where']=qs[_0x4407('0x38')](_['pick'](_0x2feb6b[_0x4407('0x30')],_0x1d6b3d[_0x4407('0x38')]),_0x182bd9);if(_0x2feb6b[_0x4407('0x30')][_0x4407('0x39')]){_0x84a8a['where']=_[_0x4407('0x3a')](_0x84a8a[_0x4407('0x3b')],{'$or':_[_0x4407('0x2f')](_0x182bd9,function(_0x1bf4e2){if(_0x1bf4e2[_0x4407('0x2c')]!==_0x4407('0x3c')){var _0x30de66={};_0x30de66[_0x1bf4e2[_0x4407('0x29')]]={'$like':'%'+_0x2feb6b[_0x4407('0x30')]['filter']+'%'};return _0x30de66;}})});}_0x84a8a=_['merge']({},_0x84a8a,_0x2feb6b[_0x4407('0x3d')]);var _0xc47d0e={'where':_0x84a8a[_0x4407('0x3b')]};return db[_0x4407('0x3e')]['count'](_0xc47d0e)[_0x4407('0x3f')](function(_0x2cb65e){_0x37fba1[_0x4407('0x20')]=_0x2cb65e;if(_0x2feb6b['query'][_0x4407('0x40')]){_0x84a8a['include']=[{'all':!![]}];}return db['Cdr'][_0x4407('0x41')](_0x84a8a);})[_0x4407('0x3f')](function(_0x234fa5){_0x37fba1[_0x4407('0x42')]=_0x234fa5;return _0x37fba1;})[_0x4407('0x3f')](respondWithFilteredResult(_0x1f9828,_0x84a8a))['catch'](handleError(_0x1f9828,null));};exports[_0x4407('0x43')]=function(_0xf79768,_0x819b8b){var _0x15ba7b={'raw':!![],'where':{'id':_0xf79768[_0x4407('0x44')]['id']}},_0x5b41cf={};_0x5b41cf[_0x4407('0x2e')]=_[_0x4407('0x31')](db[_0x4407('0x3e')][_0x4407('0x45')]);_0x5b41cf['query']=_[_0x4407('0x31')](_0xf79768['query']);_0x5b41cf['filters']=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],_0x5b41cf['query']);_0x15ba7b[_0x4407('0x32')]=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],qs[_0x4407('0x33')](_0xf79768['query'][_0x4407('0x33')]));_0x15ba7b[_0x4407('0x32')]=_0x15ba7b[_0x4407('0x32')][_0x4407('0x34')]?_0x15ba7b[_0x4407('0x32')]:_0x5b41cf['model'];if(_0xf79768[_0x4407('0x30')][_0x4407('0x40')]){_0x15ba7b[_0x4407('0x47')]=[{'all':!![]}];}_0x15ba7b=_[_0x4407('0x3a')]({},_0x15ba7b,_0xf79768[_0x4407('0x3d')]);return db['Cdr'][_0x4407('0x48')](_0x15ba7b)[_0x4407('0x3f')](handleEntityNotFound(_0x819b8b,null))[_0x4407('0x3f')](respondWithResult(_0x819b8b,null))[_0x4407('0x49')](handleError(_0x819b8b,null));};exports['create']=function(_0x18ff16,_0x2b18b8){return db['Cdr'][_0x4407('0x4a')](_0x18ff16[_0x4407('0x4b')],{})['then'](respondWithResult(_0x2b18b8,0xc9))[_0x4407('0x49')](handleError(_0x2b18b8,null));};exports[_0x4407('0x25')]=function(_0x5ea36,_0x4fbc1f){if(_0x5ea36[_0x4407('0x4b')]['id']){delete _0x5ea36['body']['id'];}return db['Cdr'][_0x4407('0x48')]({'where':{'id':_0x5ea36[_0x4407('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fbc1f,null))[_0x4407('0x3f')](saveUpdates(_0x5ea36[_0x4407('0x4b')],null))[_0x4407('0x3f')](respondWithResult(_0x4fbc1f,null))[_0x4407('0x49')](handleError(_0x4fbc1f,null));};exports[_0x4407('0x26')]=function(_0x5a2c2b,_0x39865e){return db[_0x4407('0x3e')][_0x4407('0x48')]({'where':{'id':_0x5a2c2b[_0x4407('0x44')]['id']}})[_0x4407('0x3f')](handleEntityNotFound(_0x39865e,null))[_0x4407('0x3f')](removeEntity(_0x39865e,null))[_0x4407('0x49')](handleError(_0x39865e,null));};exports[_0x4407('0x4c')]=function(_0xd1dd66,_0x55f0ef){return db[_0x4407('0x3e')]['describe']()[_0x4407('0x3f')](respondWithResult(_0x55f0ef,null))[_0x4407('0x49')](handleError(_0x55f0ef,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 659e1c8..a97a3da 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5cae2c,_0x2ba5c4){var _0x53441e=function(_0x22177d){while(--_0x22177d){_0x5cae2c['push'](_0x5cae2c['shift']());}};_0x53441e(++_0x2ba5c4);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x416c3a,_0x5ab571){var _0x6ff9fd=function(_0x33efa3){while(--_0x33efa3){_0x416c3a['push'](_0x416c3a['shift']());}};_0x6ff9fd(++_0x5ab571);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 914a7eb..badf8c7 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 _0x1f4c=['error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x1f4c,0x17f));var _0xc1f4=function(_0x1787cb,_0x13a8ad){_0x1787cb=_0x1787cb-0x0;var _0x23e5d0=_0x1f4c[_0x1787cb];return _0x23e5d0;};'use strict';var _=require('lodash');var util=require(_0xc1f4('0x0'));var moment=require(_0xc1f4('0x1'));var BPromise=require(_0xc1f4('0x2'));var rs=require(_0xc1f4('0x3'));var fs=require('fs');var Redis=require(_0xc1f4('0x4'));var db=require(_0xc1f4('0x5'))['db'];var utils=require(_0xc1f4('0x6'));var logger=require(_0xc1f4('0x7'))(_0xc1f4('0x8'));var config=require(_0xc1f4('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc1f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aee52,_0x3a8ec9,_0xd5580d){return new BPromise(function(_0x66939d,_0x109a50){return client[_0xc1f4('0xb')](_0x2aee52,_0xd5580d)[_0xc1f4('0xc')](function(_0x29a3e0){logger[_0xc1f4('0xd')](_0xc1f4('0xe'),_0x3a8ec9,_0xc1f4('0xf'));logger[_0xc1f4('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3a8ec9,_0xc1f4('0xf'),JSON['stringify'](_0x29a3e0));if(_0x29a3e0[_0xc1f4('0x11')]){if(_0x29a3e0[_0xc1f4('0x11')]['code']===0x1f4){logger[_0xc1f4('0x11')](_0xc1f4('0xe'),_0x3a8ec9,_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);return _0x109a50(_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);}logger[_0xc1f4('0x11')](_0xc1f4('0xe'),_0x3a8ec9,_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);return _0x66939d(_0x29a3e0[_0xc1f4('0x11')][_0xc1f4('0x12')]);}else{logger[_0xc1f4('0xd')](_0xc1f4('0xe'),_0x3a8ec9,'request\x20sent');_0x66939d(_0x29a3e0[_0xc1f4('0x13')][_0xc1f4('0x12')]);}})['catch'](function(_0x5de677){logger[_0xc1f4('0x11')](_0xc1f4('0xe'),_0x3a8ec9,_0x5de677);_0x109a50(_0x5de677);});});} \ No newline at end of file +var _0xa30b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','bluebird','ioredis'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa30b,0x1c5));var _0xba30=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa30b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba30('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba30('0x3'))(_0xba30('0x4'));var config=require(_0xba30('0x5'));var jayson=require(_0xba30('0x6'));var client=jayson[_0xba30('0x7')][_0xba30('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f313c,_0x47255d,_0x132832){return new BPromise(function(_0x34dfb0,_0x195dd5){return client[_0xba30('0x9')](_0x2f313c,_0x132832)['then'](function(_0x2ff4ff){logger['info'](_0xba30('0xa'),_0x47255d,_0xba30('0xb'));logger[_0xba30('0xc')]('Cdr,\x20%s,\x20%s,\x20%s',_0x47255d,'request\x20sent',JSON[_0xba30('0xd')](_0x2ff4ff));if(_0x2ff4ff[_0xba30('0xe')]){if(_0x2ff4ff['error']['code']===0x1f4){logger[_0xba30('0xe')](_0xba30('0xa'),_0x47255d,_0x2ff4ff[_0xba30('0xe')]['message']);return _0x195dd5(_0x2ff4ff[_0xba30('0xe')][_0xba30('0xf')]);}logger[_0xba30('0xe')](_0xba30('0xa'),_0x47255d,_0x2ff4ff[_0xba30('0xe')][_0xba30('0xf')]);return _0x34dfb0(_0x2ff4ff[_0xba30('0xe')][_0xba30('0xf')]);}else{logger[_0xba30('0x10')](_0xba30('0xa'),_0x47255d,_0xba30('0xb'));_0x34dfb0(_0x2ff4ff[_0xba30('0x11')][_0xba30('0xf')]);}})[_0xba30('0x12')](function(_0x214d16){logger[_0xba30('0xe')](_0xba30('0xa'),_0x47255d,_0x214d16);_0x195dd5(_0x214d16);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fb9aba5..a966d51 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(_0x562456,_0x9ad741){var _0x46d4a9=function(_0x3e9f18){while(--_0x3e9f18){_0x562456['push'](_0x562456['shift']());}};_0x46d4a9(++_0x9ad741);}(_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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a12d338..5160aca 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 _0x38dc=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2fd970,_0x4161d9){var _0x1992a1=function(_0x5f4130){while(--_0x5f4130){_0x2fd970['push'](_0x2fd970['shift']());}};_0x1992a1(++_0x4161d9);}(_0x38dc,0xf7));var _0xc38d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x38dc[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xc38d('0x0'));module[_0xc38d('0x1')]={'priority':{'type':Sequelize[_0xc38d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc38d('0x3')],'allowNull':![],'defaultValue':_0xc38d('0x4')},'appdata':{'type':Sequelize[_0xc38d('0x5')]()},'description':{'type':Sequelize[_0xc38d('0x3')]},'interval':{'type':Sequelize[_0xc38d('0x3')],'defaultValue':_0xc38d('0x6')}}; \ No newline at end of file +var _0x4804=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x41de47,_0x20722e){var _0x35133e=function(_0x219807){while(--_0x219807){_0x41de47['push'](_0x41de47['shift']());}};_0x35133e(++_0x20722e);}(_0x4804,0x149));var _0x4480=function(_0x5928c7,_0x37e9cf){_0x5928c7=_0x5928c7-0x0;var _0x59d1b2=_0x4804[_0x5928c7];return _0x59d1b2;};'use strict';var Sequelize=require(_0x4480('0x0'));module[_0x4480('0x1')]={'priority':{'type':Sequelize[_0x4480('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4480('0x3')],'allowNull':![],'defaultValue':_0x4480('0x4')},'appdata':{'type':Sequelize[_0x4480('0x5')]()},'description':{'type':Sequelize[_0x4480('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 64a30c7..79c0a1f 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 _0x3360=['destroy','end','stack','name','send','show','ChatApplication','rawAttributes','query','keys','filters','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','params','eml-format','rimraf','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','count','offset','limit','json','apply','reject','save','update','then'];(function(_0x180b77,_0x51415a){var _0x4a00f4=function(_0x33705a){while(--_0x33705a){_0x180b77['push'](_0x180b77['shift']());}};_0x4a00f4(++_0x51415a);}(_0x3360,0x1d7));var _0x0336=function(_0x30e6e0,_0x146e93){_0x30e6e0=_0x30e6e0-0x0;var _0x54b2ed=_0x3360[_0x30e6e0];return _0x54b2ed;};'use strict';var emlformat=require(_0x0336('0x0'));var rimraf=require(_0x0336('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0336('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0336('0x3'));var path=require(_0x0336('0x4'));var sox=require(_0x0336('0x5'));var csv=require(_0x0336('0x6'));var ejs=require(_0x0336('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0336('0x8'));var crypto=require(_0x0336('0x9'));var jsforce=require(_0x0336('0xa'));var deskjs=require(_0x0336('0xb'));var toCsv=require(_0x0336('0x6'));var querystring=require('querystring');var Papa=require(_0x0336('0xc'));var Redis=require(_0x0336('0xd'));var authService=require(_0x0336('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0336('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0336('0x10'))(_0x0336('0x11'));var utils=require(_0x0336('0x12'));var config=require(_0x0336('0x13'));var licenseUtil=require(_0x0336('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bf62c,_0xa90c0a){_0xa90c0a=_0xa90c0a||0xcc;return function(_0x26f444){if(_0x26f444){return _0x3bf62c[_0x0336('0x15')](_0xa90c0a);}return _0x3bf62c[_0x0336('0x16')](_0xa90c0a)['end']();};}function respondWithResult(_0x103899,_0x406614){_0x406614=_0x406614||0xc8;return function(_0x260584){if(_0x260584){return _0x103899[_0x0336('0x16')](_0x406614)['json'](_0x260584);}};}function respondWithFilteredResult(_0x188076,_0x55b910){return function(_0x2279d1){if(_0x2279d1){var _0x451c76=typeof _0x55b910['offset']==='undefined'&&typeof _0x55b910['limit']===_0x0336('0x17');var _0x15a59b=_0x2279d1[_0x0336('0x18')];var _0x2f6e9a=_0x451c76?0x0:_0x55b910[_0x0336('0x19')];var _0x5c57fc=_0x451c76?_0x2279d1[_0x0336('0x18')]:_0x55b910[_0x0336('0x19')]+_0x55b910[_0x0336('0x1a')];var _0xafcdd9;if(_0x5c57fc>=_0x15a59b){_0x5c57fc=_0x15a59b;_0xafcdd9=0xc8;}else{_0xafcdd9=0xce;}_0x188076['status'](_0xafcdd9);return _0x188076['set']('Content-Range',_0x2f6e9a+'-'+_0x5c57fc+'/'+_0x15a59b)[_0x0336('0x1b')](_0x2279d1);}return null;};}function patchUpdates(_0x1e0027){return function(_0x1f3d95){try{jsonpatch[_0x0336('0x1c')](_0x1f3d95,_0x1e0027,!![]);}catch(_0x5d9f83){return BPromise[_0x0336('0x1d')](_0x5d9f83);}return _0x1f3d95[_0x0336('0x1e')]();};}function saveUpdates(_0x41ccd3,_0x578575){return function(_0x5c9e4d){if(_0x5c9e4d){return _0x5c9e4d[_0x0336('0x1f')](_0x41ccd3)[_0x0336('0x20')](function(_0x63af92){return _0x63af92;});}return null;};}function removeEntity(_0x19de7f,_0x25ba54){return function(_0x1a2616){if(_0x1a2616){return _0x1a2616[_0x0336('0x21')]()['then'](function(){_0x19de7f[_0x0336('0x16')](0xcc)[_0x0336('0x22')]();});}};}function handleEntityNotFound(_0x3d2c31,_0xcfbd3b){return function(_0x39677a){if(!_0x39677a){_0x3d2c31[_0x0336('0x15')](0x194);}return _0x39677a;};}function handleError(_0xe9d2dd,_0x52ef7f){_0x52ef7f=_0x52ef7f||0x1f4;return function(_0x2156d0){logger['error'](_0x2156d0[_0x0336('0x23')]);if(_0x2156d0[_0x0336('0x24')]){delete _0x2156d0[_0x0336('0x24')];}_0xe9d2dd[_0x0336('0x16')](_0x52ef7f)[_0x0336('0x25')](_0x2156d0);};}exports[_0x0336('0x26')]=function(_0x331317,_0x493cd4){var _0x25d2d9={'raw':!![],'where':{'id':_0x331317['params']['id']}},_0x4714c2={};_0x4714c2['model']=_['keys'](db[_0x0336('0x27')][_0x0336('0x28')]);_0x4714c2[_0x0336('0x29')]=_[_0x0336('0x2a')](_0x331317[_0x0336('0x29')]);_0x4714c2[_0x0336('0x2b')]=_['intersection'](_0x4714c2[_0x0336('0x2c')],_0x4714c2[_0x0336('0x29')]);_0x25d2d9[_0x0336('0x2d')]=_['intersection'](_0x4714c2[_0x0336('0x2c')],qs[_0x0336('0x2e')](_0x331317[_0x0336('0x29')][_0x0336('0x2e')]));_0x25d2d9[_0x0336('0x2d')]=_0x25d2d9['attributes'][_0x0336('0x2f')]?_0x25d2d9[_0x0336('0x2d')]:_0x4714c2[_0x0336('0x2c')];if(_0x331317['query'][_0x0336('0x30')]){_0x25d2d9[_0x0336('0x31')]=[{'all':!![]}];}_0x25d2d9=_[_0x0336('0x32')]({},_0x25d2d9,_0x331317[_0x0336('0x33')]);return db['ChatApplication'][_0x0336('0x34')](_0x25d2d9)[_0x0336('0x20')](handleEntityNotFound(_0x493cd4,null))[_0x0336('0x20')](respondWithResult(_0x493cd4,null))[_0x0336('0x35')](handleError(_0x493cd4,null));};exports[_0x0336('0x1f')]=function(_0x2ef62c,_0x64c8c3){if(_0x2ef62c[_0x0336('0x36')]['id']){delete _0x2ef62c[_0x0336('0x36')]['id'];}return db[_0x0336('0x27')][_0x0336('0x34')]({'where':{'id':_0x2ef62c['params']['id']}})[_0x0336('0x20')](handleEntityNotFound(_0x64c8c3,null))[_0x0336('0x20')](saveUpdates(_0x2ef62c['body'],null))['then'](respondWithResult(_0x64c8c3,null))[_0x0336('0x35')](handleError(_0x64c8c3,null));};exports[_0x0336('0x21')]=function(_0x4c1ba8,_0x15db29){return db[_0x0336('0x27')][_0x0336('0x34')]({'where':{'id':_0x4c1ba8[_0x0336('0x37')]['id']}})['then'](handleEntityNotFound(_0x15db29,null))[_0x0336('0x20')](removeEntity(_0x15db29,null))[_0x0336('0x35')](handleError(_0x15db29,null));}; \ No newline at end of file +var _0xbfa6=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','show','params','keys','ChatApplication','query','filters','intersection','model','attributes','fields','length','includeAll','include','options','find','body','catch','destroy','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x392c8d,_0x4f947a){var _0x53adda=function(_0x1a55fa){while(--_0x1a55fa){_0x392c8d['push'](_0x392c8d['shift']());}};_0x53adda(++_0x4f947a);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0xf93b08,_0x2559d7){_0xf93b08=_0xf93b08-0x0;var _0x12f72e=_0xbfa6[_0xf93b08];return _0x12f72e;};'use strict';var emlformat=require(_0x6bfa('0x0'));var rimraf=require(_0x6bfa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bfa('0x2'));var BPromise=require(_0x6bfa('0x3'));var Mustache=require(_0x6bfa('0x4'));var util=require('util');var path=require(_0x6bfa('0x5'));var sox=require(_0x6bfa('0x6'));var csv=require(_0x6bfa('0x7'));var ejs=require(_0x6bfa('0x8'));var fs=require('fs');var fs_extra=require(_0x6bfa('0x9'));var _=require(_0x6bfa('0xa'));var squel=require(_0x6bfa('0xb'));var crypto=require('crypto');var jsforce=require(_0x6bfa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6bfa('0x7'));var querystring=require(_0x6bfa('0xd'));var Papa=require(_0x6bfa('0xe'));var Redis=require(_0x6bfa('0xf'));var authService=require(_0x6bfa('0x10'));var qs=require(_0x6bfa('0x11'));var as=require(_0x6bfa('0x12'));var hardwareService=require(_0x6bfa('0x13'));var logger=require(_0x6bfa('0x14'))(_0x6bfa('0x15'));var utils=require('../../config/utils');var config=require(_0x6bfa('0x16'));var licenseUtil=require(_0x6bfa('0x17'));var db=require(_0x6bfa('0x18'))['db'];function respondWithStatusCode(_0x4a0ad1,_0x39cc55){_0x39cc55=_0x39cc55||0xcc;return function(_0x1a4c63){if(_0x1a4c63){return _0x4a0ad1[_0x6bfa('0x19')](_0x39cc55);}return _0x4a0ad1[_0x6bfa('0x1a')](_0x39cc55)[_0x6bfa('0x1b')]();};}function respondWithResult(_0x5d2c05,_0x33a3fc){_0x33a3fc=_0x33a3fc||0xc8;return function(_0x581c13){if(_0x581c13){return _0x5d2c05[_0x6bfa('0x1a')](_0x33a3fc)[_0x6bfa('0x1c')](_0x581c13);}};}function respondWithFilteredResult(_0x18512b,_0x305210){return function(_0x2c4944){if(_0x2c4944){var _0x2a11ac=typeof _0x305210[_0x6bfa('0x1d')]===_0x6bfa('0x1e')&&typeof _0x305210[_0x6bfa('0x1f')]==='undefined';var _0xe94ad2=_0x2c4944['count'];var _0x1b4c11=_0x2a11ac?0x0:_0x305210[_0x6bfa('0x1d')];var _0x23db95=_0x2a11ac?_0x2c4944[_0x6bfa('0x20')]:_0x305210['offset']+_0x305210['limit'];var _0x569f86;if(_0x23db95>=_0xe94ad2){_0x23db95=_0xe94ad2;_0x569f86=0xc8;}else{_0x569f86=0xce;}_0x18512b['status'](_0x569f86);return _0x18512b[_0x6bfa('0x21')]('Content-Range',_0x1b4c11+'-'+_0x23db95+'/'+_0xe94ad2)[_0x6bfa('0x1c')](_0x2c4944);}return null;};}function patchUpdates(_0x1125f3){return function(_0x26f925){try{jsonpatch[_0x6bfa('0x22')](_0x26f925,_0x1125f3,!![]);}catch(_0x237712){return BPromise[_0x6bfa('0x23')](_0x237712);}return _0x26f925[_0x6bfa('0x24')]();};}function saveUpdates(_0x241318,_0x35a6ad){return function(_0x3e71b8){if(_0x3e71b8){return _0x3e71b8[_0x6bfa('0x25')](_0x241318)[_0x6bfa('0x26')](function(_0xa24a21){return _0xa24a21;});}return null;};}function removeEntity(_0x213602,_0xe8d74){return function(_0x2903cc){if(_0x2903cc){return _0x2903cc['destroy']()[_0x6bfa('0x26')](function(){_0x213602[_0x6bfa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c388b,_0x1e5507){return function(_0x19f8ea){if(!_0x19f8ea){_0x2c388b[_0x6bfa('0x19')](0x194);}return _0x19f8ea;};}function handleError(_0x2fd4f9,_0x401cc9){_0x401cc9=_0x401cc9||0x1f4;return function(_0x47bab5){logger['error'](_0x47bab5[_0x6bfa('0x27')]);if(_0x47bab5[_0x6bfa('0x28')]){delete _0x47bab5[_0x6bfa('0x28')];}_0x2fd4f9[_0x6bfa('0x1a')](_0x401cc9)[_0x6bfa('0x29')](_0x47bab5);};}exports[_0x6bfa('0x2a')]=function(_0x40f66c,_0x720bc2){var _0x243c94={'raw':!![],'where':{'id':_0x40f66c[_0x6bfa('0x2b')]['id']}},_0x2154f0={};_0x2154f0['model']=_[_0x6bfa('0x2c')](db[_0x6bfa('0x2d')]['rawAttributes']);_0x2154f0[_0x6bfa('0x2e')]=_['keys'](_0x40f66c[_0x6bfa('0x2e')]);_0x2154f0[_0x6bfa('0x2f')]=_[_0x6bfa('0x30')](_0x2154f0[_0x6bfa('0x31')],_0x2154f0[_0x6bfa('0x2e')]);_0x243c94[_0x6bfa('0x32')]=_['intersection'](_0x2154f0[_0x6bfa('0x31')],qs[_0x6bfa('0x33')](_0x40f66c[_0x6bfa('0x2e')][_0x6bfa('0x33')]));_0x243c94[_0x6bfa('0x32')]=_0x243c94[_0x6bfa('0x32')][_0x6bfa('0x34')]?_0x243c94[_0x6bfa('0x32')]:_0x2154f0[_0x6bfa('0x31')];if(_0x40f66c['query'][_0x6bfa('0x35')]){_0x243c94[_0x6bfa('0x36')]=[{'all':!![]}];}_0x243c94=_['merge']({},_0x243c94,_0x40f66c[_0x6bfa('0x37')]);return db['ChatApplication'][_0x6bfa('0x38')](_0x243c94)[_0x6bfa('0x26')](handleEntityNotFound(_0x720bc2,null))[_0x6bfa('0x26')](respondWithResult(_0x720bc2,null))['catch'](handleError(_0x720bc2,null));};exports[_0x6bfa('0x25')]=function(_0x7eb741,_0x3f76b4){if(_0x7eb741[_0x6bfa('0x39')]['id']){delete _0x7eb741['body']['id'];}return db[_0x6bfa('0x2d')][_0x6bfa('0x38')]({'where':{'id':_0x7eb741[_0x6bfa('0x2b')]['id']}})[_0x6bfa('0x26')](handleEntityNotFound(_0x3f76b4,null))[_0x6bfa('0x26')](saveUpdates(_0x7eb741[_0x6bfa('0x39')],null))['then'](respondWithResult(_0x3f76b4,null))[_0x6bfa('0x3a')](handleError(_0x3f76b4,null));};exports[_0x6bfa('0x3b')]=function(_0x452b39,_0x3f154f){return db[_0x6bfa('0x2d')][_0x6bfa('0x38')]({'where':{'id':_0x452b39[_0x6bfa('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3f154f,null))['then'](removeEntity(_0x3f154f,null))['catch'](handleError(_0x3f154f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index dd46e1f..a9b1f54 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 _0x6953=['chat_applications','utf8mb4','lodash','util','bluebird','path','rimraf','../../config/environment','exports','define','ChatApplication'];(function(_0x233dc0,_0x2866ad){var _0x1fc160=function(_0x51e38b){while(--_0x51e38b){_0x233dc0['push'](_0x233dc0['shift']());}};_0x1fc160(++_0x2866ad);}(_0x6953,0x91));var _0x3695=function(_0x2df5c6,_0x259b3c){_0x2df5c6=_0x2df5c6-0x0;var _0x2fdcd2=_0x6953[_0x2df5c6];return _0x2fdcd2;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./chatApplication.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3695('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x36f1=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x55ffa5,_0x3fc2c9){var _0x2c978e=function(_0x54c169){while(--_0x54c169){_0x55ffa5['push'](_0x55ffa5['shift']());}};_0x2c978e(++_0x3fc2c9);}(_0x36f1,0x19f));var _0x136f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x36f1[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x136f('0x0'));var util=require(_0x136f('0x1'));var logger=require(_0x136f('0x2'))('api');var moment=require(_0x136f('0x3'));var BPromise=require(_0x136f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x4f8e5c,_0x11b000){return _0x4f8e5c['define']('ChatApplication',attributes,{'tableName':_0x136f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x136f('0xb'),'collate':_0x136f('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5b77dca..6a4e0a8 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 _0xfa8c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash'];(function(_0x223c0e,_0xa23c8a){var _0x48e91c=function(_0x3339a9){while(--_0x3339a9){_0x223c0e['push'](_0x223c0e['shift']());}};_0x48e91c(++_0xa23c8a);}(_0xfa8c,0x153));var _0xcfa8=function(_0x25414b,_0x3a32b4){_0x25414b=_0x25414b-0x0;var _0x9433e=_0xfa8c[_0x25414b];return _0x9433e;};'use strict';var _=require(_0xcfa8('0x0'));var util=require('util');var moment=require(_0xcfa8('0x1'));var BPromise=require(_0xcfa8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfa8('0x3'));var db=require(_0xcfa8('0x4'))['db'];var utils=require(_0xcfa8('0x5'));var logger=require(_0xcfa8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcfa8('0x7'));var client=jayson[_0xcfa8('0x8')][_0xcfa8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8f37,_0x3a13bf,_0x4de7cf){return new BPromise(function(_0x5dea88,_0x55985b){return client['request'](_0x3f8f37,_0x4de7cf)[_0xcfa8('0xa')](function(_0x430c25){logger['info'](_0xcfa8('0xb'),_0x3a13bf,_0xcfa8('0xc'));logger[_0xcfa8('0xd')](_0xcfa8('0xe'),_0x3a13bf,_0xcfa8('0xc'),JSON[_0xcfa8('0xf')](_0x430c25));if(_0x430c25[_0xcfa8('0x10')]){if(_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x11')]===0x1f4){logger[_0xcfa8('0x10')](_0xcfa8('0xb'),_0x3a13bf,_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x12')]);return _0x55985b(_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x12')]);}logger[_0xcfa8('0x10')](_0xcfa8('0xb'),_0x3a13bf,_0x430c25[_0xcfa8('0x10')][_0xcfa8('0x12')]);return _0x5dea88(_0x430c25['error']['message']);}else{logger[_0xcfa8('0x13')](_0xcfa8('0xb'),_0x3a13bf,_0xcfa8('0xc'));_0x5dea88(_0x430c25['result'][_0xcfa8('0x12')]);}})['catch'](function(_0x2bbdbe){logger['error'](_0xcfa8('0xb'),_0x3a13bf,_0x2bbdbe);_0x55985b(_0x2bbdbe);});});} \ No newline at end of file +var _0xbd37=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xbd37,0x121));var _0x7bd3=function(_0x56b0f0,_0x529649){_0x56b0f0=_0x56b0f0-0x0;var _0x1f8f53=_0xbd37[_0x56b0f0];return _0x1f8f53;};'use strict';var _=require(_0x7bd3('0x0'));var util=require(_0x7bd3('0x1'));var moment=require(_0x7bd3('0x2'));var BPromise=require(_0x7bd3('0x3'));var rs=require(_0x7bd3('0x4'));var fs=require('fs');var Redis=require(_0x7bd3('0x5'));var db=require(_0x7bd3('0x6'))['db'];var utils=require(_0x7bd3('0x7'));var logger=require(_0x7bd3('0x8'))(_0x7bd3('0x9'));var config=require(_0x7bd3('0xa'));var jayson=require(_0x7bd3('0xb'));var client=jayson[_0x7bd3('0xc')][_0x7bd3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5cf44d,_0x336b4e,_0x59c160){return new BPromise(function(_0x509bcd,_0x4913d1){return client[_0x7bd3('0xe')](_0x5cf44d,_0x59c160)[_0x7bd3('0xf')](function(_0x5d7e62){logger['info'](_0x7bd3('0x10'),_0x336b4e,_0x7bd3('0x11'));logger[_0x7bd3('0x12')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x336b4e,'request\x20sent',JSON['stringify'](_0x5d7e62));if(_0x5d7e62[_0x7bd3('0x13')]){if(_0x5d7e62[_0x7bd3('0x13')]['code']===0x1f4){logger[_0x7bd3('0x13')](_0x7bd3('0x10'),_0x336b4e,_0x5d7e62[_0x7bd3('0x13')][_0x7bd3('0x14')]);return _0x4913d1(_0x5d7e62[_0x7bd3('0x13')][_0x7bd3('0x14')]);}logger[_0x7bd3('0x13')](_0x7bd3('0x10'),_0x336b4e,_0x5d7e62[_0x7bd3('0x13')][_0x7bd3('0x14')]);return _0x509bcd(_0x5d7e62[_0x7bd3('0x13')]['message']);}else{logger[_0x7bd3('0x15')](_0x7bd3('0x10'),_0x336b4e,'request\x20sent');_0x509bcd(_0x5d7e62[_0x7bd3('0x16')][_0x7bd3('0x14')]);}})[_0x7bd3('0x17')](function(_0x38c5b5){logger[_0x7bd3('0x13')]('ChatApplication,\x20%s,\x20%s',_0x336b4e,_0x38c5b5);_0x4913d1(_0x38c5b5);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index cfc9cc0..8f87527 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 _0xb1e5=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x53a565,_0x39f4a4){var _0x273609=function(_0x41fad4){while(--_0x41fad4){_0x53a565['push'](_0x53a565['shift']());}};_0x273609(++_0x39f4a4);}(_0xb1e5,0x134));var _0x5b1e=function(_0xc45636,_0x1e7676){_0xc45636=_0xc45636-0x0;var _0x49bf12=_0xb1e5[_0xc45636];return _0x49bf12;};'use strict';var multer=require(_0x5b1e('0x0'));var util=require('util');var path=require(_0x5b1e('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b1e('0x2'));var router=express[_0x5b1e('0x3')]();var fs_extra=require(_0x5b1e('0x4'));var auth=require(_0x5b1e('0x5'));var interaction=require(_0x5b1e('0x6'));var config=require(_0x5b1e('0x7'));var controller=require(_0x5b1e('0x8'));router[_0x5b1e('0x9')](_0x5b1e('0xa'),auth[_0x5b1e('0xb')](),controller[_0x5b1e('0xc')]);router[_0x5b1e('0xd')](_0x5b1e('0xa'),auth['isAuthenticated'](),controller[_0x5b1e('0xe')]);router[_0x5b1e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5b1e('0x10')]);module[_0x5b1e('0x11')]=router; \ No newline at end of file +var _0xec7c=['put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','isAuthenticated','show'];(function(_0x461bb8,_0x44678a){var _0x538ede=function(_0x50d776){while(--_0x50d776){_0x461bb8['push'](_0x461bb8['shift']());}};_0x538ede(++_0x44678a);}(_0xec7c,0x125));var _0xcec7=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xec7c[_0x34c063];return _0x2c63a3;};'use strict';var multer=require(_0xcec7('0x0'));var util=require('util');var path=require(_0xcec7('0x1'));var timeout=require('connect-timeout');var express=require(_0xcec7('0x2'));var router=express[_0xcec7('0x3')]();var fs_extra=require(_0xcec7('0x4'));var auth=require(_0xcec7('0x5'));var interaction=require(_0xcec7('0x6'));var config=require(_0xcec7('0x7'));var controller=require(_0xcec7('0x8'));router['get']('/:id',auth[_0xcec7('0x9')](),controller[_0xcec7('0xa')]);router[_0xcec7('0xb')](_0xcec7('0xc'),auth[_0xcec7('0x9')](),controller[_0xcec7('0xd')]);router['delete'](_0xcec7('0xc'),auth[_0xcec7('0x9')](),controller[_0xcec7('0xe')]);module[_0xcec7('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 17b68f1..55862ea 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 _0x234b=['sequelize','exports','BOOLEAN'];(function(_0x5f7894,_0x1e1d60){var _0x4d7731=function(_0x4d4e67){while(--_0x4d4e67){_0x5f7894['push'](_0x5f7894['shift']());}};_0x4d7731(++_0x1e1d60);}(_0x234b,0x183));var _0xb234=function(_0x4d6657,_0x421c7c){_0x4d6657=_0x4d6657-0x0;var _0x2a157c=_0x234b[_0x4d6657];return _0x2a157c;};'use strict';var Sequelize=require(_0xb234('0x0'));module[_0xb234('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb234('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcc20=['sequelize','exports','STRING','BOOLEAN'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xcc20,0x114));var _0x0cc2=function(_0x427ccb,_0x3528a8){_0x427ccb=_0x427ccb-0x0;var _0x324246=_0xcc20[_0x427ccb];return _0x324246;};'use strict';var Sequelize=require(_0x0cc2('0x0'));module[_0x0cc2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0cc2('0x2')]},'write':{'type':Sequelize[_0x0cc2('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 2fc4f5e..a0cdf32 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 _0x75ae=['ChatInternalMessage','user','toInteger','addMembers','omit','ids','findOne','length','order','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x75ae,0x1ec));var _0xe75a=function(_0x33db2f,_0x5ed0dd){_0x33db2f=_0x33db2f-0x0;var _0x4dd48a=_0x75ae[_0x33db2f];return _0x4dd48a;};'use strict';var emlformat=require(_0xe75a('0x0'));var rimraf=require(_0xe75a('0x1'));var zipdir=require(_0xe75a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe75a('0x3'));var BPromise=require(_0xe75a('0x4'));var Mustache=require(_0xe75a('0x5'));var util=require(_0xe75a('0x6'));var path=require(_0xe75a('0x7'));var sox=require('sox');var csv=require(_0xe75a('0x8'));var ejs=require(_0xe75a('0x9'));var fs=require('fs');var fs_extra=require(_0xe75a('0xa'));var _=require(_0xe75a('0xb'));var squel=require(_0xe75a('0xc'));var crypto=require(_0xe75a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe75a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe75a('0xf'));var Papa=require(_0xe75a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe75a('0x11'));var as=require(_0xe75a('0x12'));var hardwareService=require(_0xe75a('0x13'));var logger=require(_0xe75a('0x14'))(_0xe75a('0x15'));var utils=require('../../config/utils');var config=require(_0xe75a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe75a('0x17'))['db'];config['redis']=_[_0xe75a('0x18')](config['redis'],{'host':_0xe75a('0x19'),'port':0x18eb});var socket=require(_0xe75a('0x1a'))(new Redis(config[_0xe75a('0x1b')]));require(_0xe75a('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d115d,_0x424f75){_0x424f75=_0x424f75||0xcc;return function(_0x301c93){if(_0x301c93){return _0x5d115d['sendStatus'](_0x424f75);}return _0x5d115d['status'](_0x424f75)[_0xe75a('0x1d')]();};}function respondWithResult(_0x4d9923,_0x496076){_0x496076=_0x496076||0xc8;return function(_0x141ca1){if(_0x141ca1){return _0x4d9923[_0xe75a('0x1e')](_0x496076)[_0xe75a('0x1f')](_0x141ca1);}};}function respondWithFilteredResult(_0x28a913,_0x3185c7){return function(_0x86d5f0){if(_0x86d5f0){var _0x2fa9d1=typeof _0x3185c7[_0xe75a('0x20')]===_0xe75a('0x21')&&typeof _0x3185c7[_0xe75a('0x22')]===_0xe75a('0x21');var _0x304f56=_0x86d5f0[_0xe75a('0x23')];var _0x279726=_0x2fa9d1?0x0:_0x3185c7[_0xe75a('0x20')];var _0x3ca5f1=_0x2fa9d1?_0x86d5f0[_0xe75a('0x23')]:_0x3185c7[_0xe75a('0x20')]+_0x3185c7[_0xe75a('0x22')];var _0x31721d;if(_0x3ca5f1>=_0x304f56){_0x3ca5f1=_0x304f56;_0x31721d=0xc8;}else{_0x31721d=0xce;}_0x28a913[_0xe75a('0x1e')](_0x31721d);return _0x28a913[_0xe75a('0x24')](_0xe75a('0x25'),_0x279726+'-'+_0x3ca5f1+'/'+_0x304f56)[_0xe75a('0x1f')](_0x86d5f0);}return null;};}function patchUpdates(_0x35a67a){return function(_0x427f40){try{jsonpatch[_0xe75a('0x26')](_0x427f40,_0x35a67a,!![]);}catch(_0x26f335){return BPromise[_0xe75a('0x27')](_0x26f335);}return _0x427f40[_0xe75a('0x28')]();};}function saveUpdates(_0x849c7f,_0x180a6e){return function(_0x16edba){if(_0x16edba){return _0x16edba['update'](_0x849c7f)[_0xe75a('0x29')](function(_0x58294b){return _0x58294b;});}return null;};}function removeEntity(_0x5c009d,_0x5a4809){return function(_0x58bcf0){if(_0x58bcf0){return _0x58bcf0[_0xe75a('0x2a')]()[_0xe75a('0x29')](function(){_0x5c009d[_0xe75a('0x1e')](0xcc)[_0xe75a('0x1d')]();});}};}function handleEntityNotFound(_0x222119,_0x402f35){return function(_0x578ef2){if(!_0x578ef2){_0x222119[_0xe75a('0x2b')](0x194);}return _0x578ef2;};}function handleError(_0x2ff9e9,_0x2106bf){_0x2106bf=_0x2106bf||0x1f4;return function(_0x531650){logger['error'](_0x531650['stack']);if(_0x531650['name']){delete _0x531650[_0xe75a('0x2c')];}_0x2ff9e9[_0xe75a('0x1e')](_0x2106bf)[_0xe75a('0x2d')](_0x531650);};}exports[_0xe75a('0x2e')]=function(_0x1256b0,_0x4f1519){var _0x524dad={},_0x3a6417={},_0x241be2={'count':0x0,'rows':[]};var _0x46560b=_[_0xe75a('0x2f')](db[_0xe75a('0x30')][_0xe75a('0x31')],function(_0x35cc70){return{'name':_0x35cc70['fieldName'],'type':_0x35cc70[_0xe75a('0x32')][_0xe75a('0x33')]};});_0x3a6417[_0xe75a('0x34')]=_[_0xe75a('0x2f')](_0x46560b,_0xe75a('0x2c'));_0x3a6417[_0xe75a('0x35')]=_[_0xe75a('0x36')](_0x1256b0[_0xe75a('0x35')]);_0x3a6417[_0xe75a('0x37')]=_[_0xe75a('0x38')](_0x3a6417['model'],_0x3a6417['query']);_0x524dad['attributes']=_[_0xe75a('0x38')](_0x3a6417[_0xe75a('0x34')],qs['fields'](_0x1256b0[_0xe75a('0x35')][_0xe75a('0x39')]));_0x524dad[_0xe75a('0x3a')]=_0x524dad[_0xe75a('0x3a')]['length']?_0x524dad[_0xe75a('0x3a')]:_0x3a6417[_0xe75a('0x34')];if(!_0x1256b0[_0xe75a('0x35')]['hasOwnProperty'](_0xe75a('0x3b'))){_0x524dad[_0xe75a('0x22')]=qs['limit'](_0x1256b0[_0xe75a('0x35')][_0xe75a('0x22')]);_0x524dad[_0xe75a('0x20')]=qs[_0xe75a('0x20')](_0x1256b0[_0xe75a('0x35')]['offset']);}_0x524dad['order']=qs[_0xe75a('0x3c')](_0x1256b0[_0xe75a('0x35')][_0xe75a('0x3c')]);_0x524dad[_0xe75a('0x3d')]=qs[_0xe75a('0x37')](_[_0xe75a('0x3e')](_0x1256b0[_0xe75a('0x35')],_0x3a6417[_0xe75a('0x37')]),_0x46560b);if(_0x1256b0[_0xe75a('0x35')][_0xe75a('0x3f')]){_0x524dad[_0xe75a('0x3d')]=_[_0xe75a('0x40')](_0x524dad['where'],{'$or':_['map'](_0x46560b,function(_0x4c5d84){if(_0x4c5d84['type']!==_0xe75a('0x41')){var _0x6bfb33={};_0x6bfb33[_0x4c5d84['name']]={'$like':'%'+_0x1256b0[_0xe75a('0x35')][_0xe75a('0x3f')]+'%'};return _0x6bfb33;}})});}_0x524dad=_['merge']({},_0x524dad,_0x1256b0[_0xe75a('0x42')]);var _0x5a2dc7={'where':_0x524dad[_0xe75a('0x3d')]};return db['ChatGroup'][_0xe75a('0x23')](_0x5a2dc7)['then'](function(_0x4a8d89){_0x241be2['count']=_0x4a8d89;if(_0x1256b0['query'][_0xe75a('0x43')]){_0x524dad[_0xe75a('0x44')]=[{'all':!![]}];}return db[_0xe75a('0x30')][_0xe75a('0x45')](_0x524dad);})[_0xe75a('0x29')](function(_0x388e4c){_0x241be2[_0xe75a('0x46')]=_0x388e4c;return _0x241be2;})[_0xe75a('0x29')](respondWithFilteredResult(_0x4f1519,_0x524dad))['catch'](handleError(_0x4f1519,null));};exports[_0xe75a('0x47')]=function(_0x330ed1,_0x39ef7){var _0x1a4944={'raw':!![],'where':{'id':_0x330ed1[_0xe75a('0x48')]['id']}},_0x2959f1={};_0x2959f1[_0xe75a('0x34')]=_['keys'](db[_0xe75a('0x30')][_0xe75a('0x31')]);_0x2959f1[_0xe75a('0x35')]=_[_0xe75a('0x36')](_0x330ed1[_0xe75a('0x35')]);_0x2959f1['filters']=_[_0xe75a('0x38')](_0x2959f1[_0xe75a('0x34')],_0x2959f1[_0xe75a('0x35')]);_0x1a4944[_0xe75a('0x3a')]=_[_0xe75a('0x38')](_0x2959f1[_0xe75a('0x34')],qs[_0xe75a('0x39')](_0x330ed1[_0xe75a('0x35')][_0xe75a('0x39')]));_0x1a4944['attributes']=_0x1a4944[_0xe75a('0x3a')]['length']?_0x1a4944['attributes']:_0x2959f1[_0xe75a('0x34')];if(_0x330ed1[_0xe75a('0x35')][_0xe75a('0x43')]){_0x1a4944[_0xe75a('0x44')]=[{'all':!![]}];}_0x1a4944=_['merge']({},_0x1a4944,_0x330ed1['options']);return db[_0xe75a('0x30')]['find'](_0x1a4944)[_0xe75a('0x29')](handleEntityNotFound(_0x39ef7,null))[_0xe75a('0x29')](respondWithResult(_0x39ef7,null))[_0xe75a('0x49')](handleError(_0x39ef7,null));};exports[_0xe75a('0x4a')]=function(_0x2bcef3,_0x537c1d){return db[_0xe75a('0x30')]['create'](_0x2bcef3[_0xe75a('0x4b')],{})[_0xe75a('0x29')](respondWithResult(_0x537c1d,0xc9))[_0xe75a('0x49')](handleError(_0x537c1d,null));};exports['update']=function(_0x54a782,_0x9503b7){if(_0x54a782[_0xe75a('0x4b')]['id']){delete _0x54a782[_0xe75a('0x4b')]['id'];}return db[_0xe75a('0x30')][_0xe75a('0x4c')]({'where':{'id':_0x54a782[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x9503b7,null))[_0xe75a('0x29')](saveUpdates(_0x54a782[_0xe75a('0x4b')],null))[_0xe75a('0x29')](respondWithResult(_0x9503b7,null))[_0xe75a('0x49')](handleError(_0x9503b7,null));};exports[_0xe75a('0x2a')]=function(_0x5aee81,_0xb042e5){return db[_0xe75a('0x30')][_0xe75a('0x4c')]({'where':{'id':_0x5aee81[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0xb042e5,null))[_0xe75a('0x29')](removeEntity(_0xb042e5,null))[_0xe75a('0x49')](handleError(_0xb042e5,null));};exports[_0xe75a('0x4d')]=function(_0xef98bf,_0x452c6e){return db[_0xe75a('0x30')]['describe']()[_0xe75a('0x29')](respondWithResult(_0x452c6e,null))[_0xe75a('0x49')](handleError(_0x452c6e,null));};exports['getUnread']=function(_0x438288,_0x147822,_0x56d134){return db[_0xe75a('0x4e')][_0xe75a('0x23')]({'where':{'ChatGroupId':_0x438288['params']['id'],'ToId':_0x438288[_0xe75a('0x4f')]['id'],'read':![]}})[_0xe75a('0x29')](function(_0x16d229){return{'id':_[_0xe75a('0x50')](_0x438288[_0xe75a('0x48')]['id']),'count':_0x16d229};})[_0xe75a('0x29')](respondWithResult(_0x147822,null))[_0xe75a('0x49')](handleError(_0x147822,null));};exports[_0xe75a('0x51')]=function(_0x1dd9ed,_0x48917e,_0xb5bcc5){return db[_0xe75a('0x30')][_0xe75a('0x4c')]({'where':{'id':_0x1dd9ed[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x48917e,null))[_0xe75a('0x29')](function(_0x310d0f){if(_0x310d0f){return _0x310d0f['addMembers'](_0x1dd9ed[_0xe75a('0x4b')]['ids'],_[_0xe75a('0x52')](_0x1dd9ed[_0xe75a('0x4b')],[_0xe75a('0x53'),'id'])||{});}})[_0xe75a('0x29')](respondWithResult(_0x48917e,null))[_0xe75a('0x49')](handleError(_0x48917e,null));};exports['getMembers']=function(_0x4803dc,_0x53cdee,_0x1b0677){var _0x21d958={};var _0x302e27={};var _0x226022;var _0x1ae4f1;return db['ChatGroup'][_0xe75a('0x54')]({'where':{'id':_0x4803dc[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x53cdee,null))['then'](function(_0x497684){if(_0x497684){_0x226022=_0x497684;_0x302e27[_0xe75a('0x34')]=_[_0xe75a('0x36')](db['User'][_0xe75a('0x31')]);_0x302e27[_0xe75a('0x35')]=_['keys'](_0x4803dc[_0xe75a('0x35')]);_0x302e27[_0xe75a('0x37')]=_[_0xe75a('0x38')](_0x302e27[_0xe75a('0x34')],_0x302e27[_0xe75a('0x35')]);_0x21d958[_0xe75a('0x3a')]=_[_0xe75a('0x38')](_0x302e27[_0xe75a('0x34')],qs[_0xe75a('0x39')](_0x4803dc['query']['fields']));_0x21d958[_0xe75a('0x3a')]=_0x21d958['attributes'][_0xe75a('0x55')]?_0x21d958[_0xe75a('0x3a')]:_0x302e27['model'];_0x21d958[_0xe75a('0x56')]=qs[_0xe75a('0x3c')](_0x4803dc[_0xe75a('0x35')]['sort']);_0x21d958[_0xe75a('0x3d')]=qs[_0xe75a('0x37')](_[_0xe75a('0x3e')](_0x4803dc[_0xe75a('0x35')],_0x302e27[_0xe75a('0x37')]));if(_0x4803dc[_0xe75a('0x35')][_0xe75a('0x3f')]){_0x21d958[_0xe75a('0x3d')]=_[_0xe75a('0x40')](_0x21d958[_0xe75a('0x3d')],{'$or':_[_0xe75a('0x2f')](_0x21d958[_0xe75a('0x3a')],function(_0x324052){var _0x2447fe={};_0x2447fe[_0x324052]={'$like':'%'+_0x4803dc[_0xe75a('0x35')][_0xe75a('0x3f')]+'%'};return _0x2447fe;})});}_0x21d958=_[_0xe75a('0x40')]({},_0x21d958,_0x4803dc[_0xe75a('0x42')]);return _0x226022[_0xe75a('0x57')](_0x21d958);}})[_0xe75a('0x29')](function(_0x1f7b3f){if(_0x1f7b3f){_0x1ae4f1=_0x1f7b3f['length'];if(!_0x4803dc[_0xe75a('0x35')]['hasOwnProperty'](_0xe75a('0x3b'))){_0x21d958[_0xe75a('0x22')]=qs[_0xe75a('0x22')](_0x4803dc[_0xe75a('0x35')][_0xe75a('0x22')]);_0x21d958[_0xe75a('0x20')]=qs[_0xe75a('0x20')](_0x4803dc['query'][_0xe75a('0x20')]);}return _0x226022[_0xe75a('0x57')](_0x21d958);}})['then'](function(_0x657200){if(_0x657200){return _0x657200?{'count':_0x1ae4f1,'rows':_0x657200}:null;}})[_0xe75a('0x29')](respondWithResult(_0x53cdee,null))[_0xe75a('0x49')](handleError(_0x53cdee,null));};exports[_0xe75a('0x58')]=function(_0xb761be,_0x4ec5b7,_0x15628b){return db[_0xe75a('0x30')]['find']({'where':{'id':_0xb761be[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x4ec5b7,null))[_0xe75a('0x29')](function(_0x31c83f){if(_0x31c83f){return _0x31c83f['removeMembers'](_0xb761be[_0xe75a('0x35')][_0xe75a('0x53')]);}})[_0xe75a('0x29')](respondWithStatusCode(_0x4ec5b7,null))[_0xe75a('0x49')](handleError(_0x4ec5b7,null));};exports[_0xe75a('0x59')]=function(_0x1fb283,_0x1a9b95,_0x2f59d9){if(_0x1fb283['body']['id']){delete _0x1fb283[_0xe75a('0x4b')]['id'];}return db['ChatGroup'][_0xe75a('0x4c')]({'where':{'id':_0x1fb283[_0xe75a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a9b95,null))[_0xe75a('0x29')](function(_0x52b668){if(_0x52b668){_0x1fb283[_0xe75a('0x4b')][_0xe75a('0x5a')]=_0x52b668['id'];return db[_0xe75a('0x4e')][_0xe75a('0x4a')](_0x1fb283[_0xe75a('0x4b')]);}})[_0xe75a('0x29')](respondWithResult(_0x1a9b95,null))[_0xe75a('0x49')](handleError(_0x1a9b95,null));};exports[_0xe75a('0x5b')]=function(_0xbf93d9,_0x52c66b,_0x149fdf){var _0x3de410={};var _0x1cd0b6={};var _0x32097e;var _0x1fb216;return db['ChatGroup'][_0xe75a('0x54')]({'where':{'id':_0xbf93d9[_0xe75a('0x48')]['id']}})[_0xe75a('0x29')](handleEntityNotFound(_0x52c66b,null))[_0xe75a('0x29')](function(_0x3e14be){if(_0x3e14be){_0x32097e=_0x3e14be;_0x1cd0b6[_0xe75a('0x34')]=_[_0xe75a('0x36')](db[_0xe75a('0x4e')][_0xe75a('0x31')]);_0x1cd0b6[_0xe75a('0x35')]=_['keys'](_0xbf93d9[_0xe75a('0x35')]);_0x1cd0b6[_0xe75a('0x37')]=_[_0xe75a('0x38')](_0x1cd0b6[_0xe75a('0x34')],_0x1cd0b6[_0xe75a('0x35')]);_0x3de410['attributes']=_[_0xe75a('0x38')](_0x1cd0b6[_0xe75a('0x34')],qs['fields'](_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x39')]));_0x3de410['attributes']=_0x3de410['attributes'][_0xe75a('0x55')]?_0x3de410[_0xe75a('0x3a')]:_0x1cd0b6[_0xe75a('0x34')];_0x3de410[_0xe75a('0x56')]=qs['sort'](_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x3c')]);_0x3de410[_0xe75a('0x3d')]=qs[_0xe75a('0x37')](_[_0xe75a('0x3e')](_0xbf93d9[_0xe75a('0x35')],_0x1cd0b6[_0xe75a('0x37')]));if(_0xbf93d9['query'][_0xe75a('0x3f')]){_0x3de410[_0xe75a('0x3d')]=_[_0xe75a('0x40')](_0x3de410[_0xe75a('0x3d')],{'$or':_[_0xe75a('0x2f')](_0x3de410[_0xe75a('0x3a')],function(_0x3ffcfa){var _0x11c767={};_0x11c767[_0x3ffcfa]={'$like':'%'+_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x3f')]+'%'};return _0x11c767;})});}if(_0xbf93d9[_0xe75a('0x35')][_0xe75a('0x5c')]){var _0x4e6e98=_0xbf93d9['query'][_0xe75a('0x5c')][_0xe75a('0x5d')](',');var _0x2b2e02={};_0x2b2e02[_0x4e6e98[0x0]]={'$gte':moment(_0x4e6e98[0x1])['format'](_0xe75a('0x5e'))};_0x3de410[_0xe75a('0x3d')]=_['merge'](_0x3de410[_0xe75a('0x3d')],_0x2b2e02);}_0x3de410=_['merge']({},_0x3de410,_0xbf93d9[_0xe75a('0x42')]);return _0x32097e[_0xe75a('0x5b')](_0x3de410);}})[_0xe75a('0x29')](function(_0x77cc8e){if(_0x77cc8e){_0x1fb216=_0x77cc8e[_0xe75a('0x55')];if(!_0xbf93d9[_0xe75a('0x35')]['hasOwnProperty'](_0xe75a('0x3b'))){_0x3de410[_0xe75a('0x22')]=qs[_0xe75a('0x22')](_0xbf93d9[_0xe75a('0x35')]['limit']);_0x3de410[_0xe75a('0x20')]=qs[_0xe75a('0x20')](_0xbf93d9['query'][_0xe75a('0x20')]);}return _0x32097e[_0xe75a('0x5b')](_0x3de410);}})['then'](function(_0x1d93bd){if(_0x1d93bd){return _0x1d93bd?{'count':_0x1fb216,'rows':_0x1d93bd}:null;}})[_0xe75a('0x29')](respondWithResult(_0x52c66b,null))[_0xe75a('0x49')](handleError(_0x52c66b,null));}; \ No newline at end of file +var _0xc3f1=['includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','count','apply','reject','update','then','destroy','error','name','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x4a7415,_0x37172e){var _0x33e1d7=function(_0x2b350c){while(--_0x2b350c){_0x4a7415['push'](_0x4a7415['shift']());}};_0x33e1d7(++_0x37172e);}(_0xc3f1,0x197));var _0x1c3f=function(_0x4dd158,_0x13b845){_0x4dd158=_0x4dd158-0x0;var _0x5a82b4=_0xc3f1[_0x4dd158];return _0x5a82b4;};'use strict';var emlformat=require(_0x1c3f('0x0'));var rimraf=require(_0x1c3f('0x1'));var zipdir=require(_0x1c3f('0x2'));var jsonpatch=require(_0x1c3f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1c3f('0x4'));var Mustache=require(_0x1c3f('0x5'));var util=require(_0x1c3f('0x6'));var path=require(_0x1c3f('0x7'));var sox=require(_0x1c3f('0x8'));var csv=require('to-csv');var ejs=require(_0x1c3f('0x9'));var fs=require('fs');var fs_extra=require(_0x1c3f('0xa'));var _=require(_0x1c3f('0xb'));var squel=require('squel');var crypto=require(_0x1c3f('0xc'));var jsforce=require(_0x1c3f('0xd'));var deskjs=require(_0x1c3f('0xe'));var toCsv=require(_0x1c3f('0xf'));var querystring=require(_0x1c3f('0x10'));var Papa=require(_0x1c3f('0x11'));var Redis=require(_0x1c3f('0x12'));var authService=require(_0x1c3f('0x13'));var qs=require(_0x1c3f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c3f('0x15'));var logger=require('../../config/logger')(_0x1c3f('0x16'));var utils=require('../../config/utils');var config=require(_0x1c3f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x1c3f('0x18')](config[_0x1c3f('0x19')],{'host':_0x1c3f('0x1a'),'port':0x18eb});var socket=require(_0x1c3f('0x1b'))(new Redis(config['redis']));require(_0x1c3f('0x1c'))[_0x1c3f('0x1d')](socket);function respondWithStatusCode(_0x19e3a5,_0x548f2f){_0x548f2f=_0x548f2f||0xcc;return function(_0x558d21){if(_0x558d21){return _0x19e3a5[_0x1c3f('0x1e')](_0x548f2f);}return _0x19e3a5[_0x1c3f('0x1f')](_0x548f2f)[_0x1c3f('0x20')]();};}function respondWithResult(_0xa85f22,_0x41b783){_0x41b783=_0x41b783||0xc8;return function(_0x7462bc){if(_0x7462bc){return _0xa85f22[_0x1c3f('0x1f')](_0x41b783)[_0x1c3f('0x21')](_0x7462bc);}};}function respondWithFilteredResult(_0x114852,_0x5635f6){return function(_0x15cdf6){if(_0x15cdf6){var _0x4e299f=typeof _0x5635f6[_0x1c3f('0x22')]==='undefined'&&typeof _0x5635f6[_0x1c3f('0x23')]==='undefined';var _0x48ff03=_0x15cdf6[_0x1c3f('0x24')];var _0x13ca8f=_0x4e299f?0x0:_0x5635f6[_0x1c3f('0x22')];var _0x5e0987=_0x4e299f?_0x15cdf6['count']:_0x5635f6['offset']+_0x5635f6[_0x1c3f('0x23')];var _0x24fde7;if(_0x5e0987>=_0x48ff03){_0x5e0987=_0x48ff03;_0x24fde7=0xc8;}else{_0x24fde7=0xce;}_0x114852[_0x1c3f('0x1f')](_0x24fde7);return _0x114852['set']('Content-Range',_0x13ca8f+'-'+_0x5e0987+'/'+_0x48ff03)['json'](_0x15cdf6);}return null;};}function patchUpdates(_0x196c43){return function(_0x258475){try{jsonpatch[_0x1c3f('0x25')](_0x258475,_0x196c43,!![]);}catch(_0x5ed02){return BPromise[_0x1c3f('0x26')](_0x5ed02);}return _0x258475['save']();};}function saveUpdates(_0x233426,_0x4c3247){return function(_0x4f7e6c){if(_0x4f7e6c){return _0x4f7e6c[_0x1c3f('0x27')](_0x233426)[_0x1c3f('0x28')](function(_0x29ff7d){return _0x29ff7d;});}return null;};}function removeEntity(_0x3d9121,_0x30152b){return function(_0x372afe){if(_0x372afe){return _0x372afe[_0x1c3f('0x29')]()[_0x1c3f('0x28')](function(){_0x3d9121[_0x1c3f('0x1f')](0xcc)[_0x1c3f('0x20')]();});}};}function handleEntityNotFound(_0x5420a2,_0x39b9da){return function(_0x33c130){if(!_0x33c130){_0x5420a2[_0x1c3f('0x1e')](0x194);}return _0x33c130;};}function handleError(_0x531f24,_0x544c5e){_0x544c5e=_0x544c5e||0x1f4;return function(_0x193e4a){logger[_0x1c3f('0x2a')](_0x193e4a['stack']);if(_0x193e4a[_0x1c3f('0x2b')]){delete _0x193e4a[_0x1c3f('0x2b')];}_0x531f24['status'](_0x544c5e)['send'](_0x193e4a);};}exports[_0x1c3f('0x2c')]=function(_0x4cbb01,_0x24c0ef){var _0x4bbb17={},_0x2da52c={},_0x5d9ad6={'count':0x0,'rows':[]};var _0x22dd39=_['map'](db[_0x1c3f('0x2d')][_0x1c3f('0x2e')],function(_0x114a6c){return{'name':_0x114a6c[_0x1c3f('0x2f')],'type':_0x114a6c[_0x1c3f('0x30')][_0x1c3f('0x31')]};});_0x2da52c[_0x1c3f('0x32')]=_[_0x1c3f('0x33')](_0x22dd39,'name');_0x2da52c[_0x1c3f('0x34')]=_[_0x1c3f('0x35')](_0x4cbb01[_0x1c3f('0x34')]);_0x2da52c[_0x1c3f('0x36')]=_[_0x1c3f('0x37')](_0x2da52c[_0x1c3f('0x32')],_0x2da52c[_0x1c3f('0x34')]);_0x4bbb17[_0x1c3f('0x38')]=_[_0x1c3f('0x37')](_0x2da52c[_0x1c3f('0x32')],qs[_0x1c3f('0x39')](_0x4cbb01['query'][_0x1c3f('0x39')]));_0x4bbb17[_0x1c3f('0x38')]=_0x4bbb17[_0x1c3f('0x38')][_0x1c3f('0x3a')]?_0x4bbb17['attributes']:_0x2da52c[_0x1c3f('0x32')];if(!_0x4cbb01[_0x1c3f('0x34')][_0x1c3f('0x3b')](_0x1c3f('0x3c'))){_0x4bbb17[_0x1c3f('0x23')]=qs[_0x1c3f('0x23')](_0x4cbb01['query'][_0x1c3f('0x23')]);_0x4bbb17['offset']=qs[_0x1c3f('0x22')](_0x4cbb01[_0x1c3f('0x34')][_0x1c3f('0x22')]);}_0x4bbb17[_0x1c3f('0x3d')]=qs[_0x1c3f('0x3e')](_0x4cbb01[_0x1c3f('0x34')][_0x1c3f('0x3e')]);_0x4bbb17[_0x1c3f('0x3f')]=qs[_0x1c3f('0x36')](_[_0x1c3f('0x40')](_0x4cbb01['query'],_0x2da52c[_0x1c3f('0x36')]),_0x22dd39);if(_0x4cbb01['query'][_0x1c3f('0x41')]){_0x4bbb17[_0x1c3f('0x3f')]=_[_0x1c3f('0x42')](_0x4bbb17[_0x1c3f('0x3f')],{'$or':_[_0x1c3f('0x33')](_0x22dd39,function(_0x101159){if(_0x101159[_0x1c3f('0x30')]!=='VIRTUAL'){var _0x5bb158={};_0x5bb158[_0x101159[_0x1c3f('0x2b')]]={'$like':'%'+_0x4cbb01[_0x1c3f('0x34')][_0x1c3f('0x41')]+'%'};return _0x5bb158;}})});}_0x4bbb17=_[_0x1c3f('0x42')]({},_0x4bbb17,_0x4cbb01[_0x1c3f('0x43')]);var _0x1627ee={'where':_0x4bbb17[_0x1c3f('0x3f')]};return db[_0x1c3f('0x2d')][_0x1c3f('0x24')](_0x1627ee)[_0x1c3f('0x28')](function(_0x2e1ec2){_0x5d9ad6[_0x1c3f('0x24')]=_0x2e1ec2;if(_0x4cbb01[_0x1c3f('0x34')][_0x1c3f('0x44')]){_0x4bbb17[_0x1c3f('0x45')]=[{'all':!![]}];}return db[_0x1c3f('0x2d')][_0x1c3f('0x46')](_0x4bbb17);})[_0x1c3f('0x28')](function(_0x21913d){_0x5d9ad6[_0x1c3f('0x47')]=_0x21913d;return _0x5d9ad6;})[_0x1c3f('0x28')](respondWithFilteredResult(_0x24c0ef,_0x4bbb17))[_0x1c3f('0x48')](handleError(_0x24c0ef,null));};exports[_0x1c3f('0x49')]=function(_0x408ad5,_0x3a6cf2){var _0x3a1571={'raw':!![],'where':{'id':_0x408ad5['params']['id']}},_0x3d42f4={};_0x3d42f4[_0x1c3f('0x32')]=_['keys'](db[_0x1c3f('0x2d')][_0x1c3f('0x2e')]);_0x3d42f4['query']=_['keys'](_0x408ad5[_0x1c3f('0x34')]);_0x3d42f4[_0x1c3f('0x36')]=_[_0x1c3f('0x37')](_0x3d42f4[_0x1c3f('0x32')],_0x3d42f4['query']);_0x3a1571[_0x1c3f('0x38')]=_[_0x1c3f('0x37')](_0x3d42f4[_0x1c3f('0x32')],qs[_0x1c3f('0x39')](_0x408ad5[_0x1c3f('0x34')]['fields']));_0x3a1571[_0x1c3f('0x38')]=_0x3a1571['attributes'][_0x1c3f('0x3a')]?_0x3a1571[_0x1c3f('0x38')]:_0x3d42f4[_0x1c3f('0x32')];if(_0x408ad5[_0x1c3f('0x34')][_0x1c3f('0x44')]){_0x3a1571[_0x1c3f('0x45')]=[{'all':!![]}];}_0x3a1571=_[_0x1c3f('0x42')]({},_0x3a1571,_0x408ad5[_0x1c3f('0x43')]);return db[_0x1c3f('0x2d')][_0x1c3f('0x4a')](_0x3a1571)['then'](handleEntityNotFound(_0x3a6cf2,null))[_0x1c3f('0x28')](respondWithResult(_0x3a6cf2,null))['catch'](handleError(_0x3a6cf2,null));};exports[_0x1c3f('0x4b')]=function(_0x1f69ae,_0x4963a9){return db[_0x1c3f('0x2d')][_0x1c3f('0x4b')](_0x1f69ae[_0x1c3f('0x4c')],{})[_0x1c3f('0x28')](respondWithResult(_0x4963a9,0xc9))[_0x1c3f('0x48')](handleError(_0x4963a9,null));};exports[_0x1c3f('0x27')]=function(_0x4297c0,_0x4a7e13){if(_0x4297c0[_0x1c3f('0x4c')]['id']){delete _0x4297c0[_0x1c3f('0x4c')]['id'];}return db[_0x1c3f('0x2d')][_0x1c3f('0x4a')]({'where':{'id':_0x4297c0[_0x1c3f('0x4d')]['id']}})[_0x1c3f('0x28')](handleEntityNotFound(_0x4a7e13,null))[_0x1c3f('0x28')](saveUpdates(_0x4297c0[_0x1c3f('0x4c')],null))['then'](respondWithResult(_0x4a7e13,null))[_0x1c3f('0x48')](handleError(_0x4a7e13,null));};exports['destroy']=function(_0x2da111,_0x1f1ad6){return db['ChatGroup']['find']({'where':{'id':_0x2da111[_0x1c3f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f1ad6,null))[_0x1c3f('0x28')](removeEntity(_0x1f1ad6,null))[_0x1c3f('0x48')](handleError(_0x1f1ad6,null));};exports[_0x1c3f('0x4e')]=function(_0x5a22be,_0x13b7bc){return db[_0x1c3f('0x2d')][_0x1c3f('0x4e')]()[_0x1c3f('0x28')](respondWithResult(_0x13b7bc,null))[_0x1c3f('0x48')](handleError(_0x13b7bc,null));};exports[_0x1c3f('0x4f')]=function(_0xc253fd,_0x2e5ecb,_0x1b93b5){return db[_0x1c3f('0x50')]['count']({'where':{'ChatGroupId':_0xc253fd[_0x1c3f('0x4d')]['id'],'ToId':_0xc253fd['user']['id'],'read':![]}})['then'](function(_0x15ca31){return{'id':_[_0x1c3f('0x51')](_0xc253fd[_0x1c3f('0x4d')]['id']),'count':_0x15ca31};})[_0x1c3f('0x28')](respondWithResult(_0x2e5ecb,null))[_0x1c3f('0x48')](handleError(_0x2e5ecb,null));};exports[_0x1c3f('0x52')]=function(_0x9ee898,_0x133ad8,_0x5d51ba){return db['ChatGroup'][_0x1c3f('0x4a')]({'where':{'id':_0x9ee898[_0x1c3f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x133ad8,null))[_0x1c3f('0x28')](function(_0x291046){if(_0x291046){return _0x291046[_0x1c3f('0x52')](_0x9ee898['body'][_0x1c3f('0x53')],_[_0x1c3f('0x54')](_0x9ee898[_0x1c3f('0x4c')],[_0x1c3f('0x53'),'id'])||{});}})[_0x1c3f('0x28')](respondWithResult(_0x133ad8,null))[_0x1c3f('0x48')](handleError(_0x133ad8,null));};exports[_0x1c3f('0x55')]=function(_0x4a06dd,_0x5525f0,_0x58f883){var _0x3b0f8b={};var _0x20db9={};var _0x125382;var _0x11a707;return db[_0x1c3f('0x2d')][_0x1c3f('0x56')]({'where':{'id':_0x4a06dd['params']['id']}})[_0x1c3f('0x28')](handleEntityNotFound(_0x5525f0,null))[_0x1c3f('0x28')](function(_0x254aec){if(_0x254aec){_0x125382=_0x254aec;_0x20db9[_0x1c3f('0x32')]=_[_0x1c3f('0x35')](db[_0x1c3f('0x57')][_0x1c3f('0x2e')]);_0x20db9[_0x1c3f('0x34')]=_['keys'](_0x4a06dd[_0x1c3f('0x34')]);_0x20db9[_0x1c3f('0x36')]=_[_0x1c3f('0x37')](_0x20db9[_0x1c3f('0x32')],_0x20db9[_0x1c3f('0x34')]);_0x3b0f8b[_0x1c3f('0x38')]=_[_0x1c3f('0x37')](_0x20db9[_0x1c3f('0x32')],qs['fields'](_0x4a06dd['query'][_0x1c3f('0x39')]));_0x3b0f8b[_0x1c3f('0x38')]=_0x3b0f8b[_0x1c3f('0x38')][_0x1c3f('0x3a')]?_0x3b0f8b[_0x1c3f('0x38')]:_0x20db9[_0x1c3f('0x32')];_0x3b0f8b[_0x1c3f('0x3d')]=qs[_0x1c3f('0x3e')](_0x4a06dd[_0x1c3f('0x34')][_0x1c3f('0x3e')]);_0x3b0f8b[_0x1c3f('0x3f')]=qs[_0x1c3f('0x36')](_['pick'](_0x4a06dd[_0x1c3f('0x34')],_0x20db9[_0x1c3f('0x36')]));if(_0x4a06dd[_0x1c3f('0x34')]['filter']){_0x3b0f8b['where']=_[_0x1c3f('0x42')](_0x3b0f8b[_0x1c3f('0x3f')],{'$or':_[_0x1c3f('0x33')](_0x3b0f8b[_0x1c3f('0x38')],function(_0x3f18e3){var _0x5c0788={};_0x5c0788[_0x3f18e3]={'$like':'%'+_0x4a06dd[_0x1c3f('0x34')][_0x1c3f('0x41')]+'%'};return _0x5c0788;})});}_0x3b0f8b=_['merge']({},_0x3b0f8b,_0x4a06dd[_0x1c3f('0x43')]);return _0x125382[_0x1c3f('0x55')](_0x3b0f8b);}})[_0x1c3f('0x28')](function(_0xf90150){if(_0xf90150){_0x11a707=_0xf90150[_0x1c3f('0x3a')];if(!_0x4a06dd[_0x1c3f('0x34')][_0x1c3f('0x3b')]('nolimit')){_0x3b0f8b[_0x1c3f('0x23')]=qs[_0x1c3f('0x23')](_0x4a06dd[_0x1c3f('0x34')][_0x1c3f('0x23')]);_0x3b0f8b[_0x1c3f('0x22')]=qs[_0x1c3f('0x22')](_0x4a06dd[_0x1c3f('0x34')][_0x1c3f('0x22')]);}return _0x125382[_0x1c3f('0x55')](_0x3b0f8b);}})[_0x1c3f('0x28')](function(_0x173910){if(_0x173910){return _0x173910?{'count':_0x11a707,'rows':_0x173910}:null;}})[_0x1c3f('0x28')](respondWithResult(_0x5525f0,null))[_0x1c3f('0x48')](handleError(_0x5525f0,null));};exports[_0x1c3f('0x58')]=function(_0x5bc5b7,_0x18a440,_0x3dbd99){return db[_0x1c3f('0x2d')][_0x1c3f('0x4a')]({'where':{'id':_0x5bc5b7[_0x1c3f('0x4d')]['id']}})[_0x1c3f('0x28')](handleEntityNotFound(_0x18a440,null))[_0x1c3f('0x28')](function(_0x5af10e){if(_0x5af10e){return _0x5af10e[_0x1c3f('0x58')](_0x5bc5b7['query']['ids']);}})[_0x1c3f('0x28')](respondWithStatusCode(_0x18a440,null))[_0x1c3f('0x48')](handleError(_0x18a440,null));};exports['addMessage']=function(_0x3c7677,_0x20a397,_0x47b8b8){if(_0x3c7677['body']['id']){delete _0x3c7677[_0x1c3f('0x4c')]['id'];}return db[_0x1c3f('0x2d')][_0x1c3f('0x4a')]({'where':{'id':_0x3c7677[_0x1c3f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x20a397,null))[_0x1c3f('0x28')](function(_0x443d92){if(_0x443d92){_0x3c7677[_0x1c3f('0x4c')][_0x1c3f('0x59')]=_0x443d92['id'];return db[_0x1c3f('0x50')][_0x1c3f('0x4b')](_0x3c7677['body']);}})[_0x1c3f('0x28')](respondWithResult(_0x20a397,null))[_0x1c3f('0x48')](handleError(_0x20a397,null));};exports['getMessages']=function(_0x1c1c65,_0x1a7d27,_0x3b315e){var _0xe58a16={};var _0x4cb6d0={};var _0x2eb902;var _0x4fcffc;return db[_0x1c3f('0x2d')][_0x1c3f('0x56')]({'where':{'id':_0x1c1c65['params']['id']}})[_0x1c3f('0x28')](handleEntityNotFound(_0x1a7d27,null))[_0x1c3f('0x28')](function(_0x36e89f){if(_0x36e89f){_0x2eb902=_0x36e89f;_0x4cb6d0['model']=_[_0x1c3f('0x35')](db[_0x1c3f('0x50')][_0x1c3f('0x2e')]);_0x4cb6d0[_0x1c3f('0x34')]=_[_0x1c3f('0x35')](_0x1c1c65[_0x1c3f('0x34')]);_0x4cb6d0[_0x1c3f('0x36')]=_[_0x1c3f('0x37')](_0x4cb6d0[_0x1c3f('0x32')],_0x4cb6d0['query']);_0xe58a16[_0x1c3f('0x38')]=_[_0x1c3f('0x37')](_0x4cb6d0['model'],qs[_0x1c3f('0x39')](_0x1c1c65[_0x1c3f('0x34')][_0x1c3f('0x39')]));_0xe58a16[_0x1c3f('0x38')]=_0xe58a16['attributes'][_0x1c3f('0x3a')]?_0xe58a16[_0x1c3f('0x38')]:_0x4cb6d0[_0x1c3f('0x32')];_0xe58a16['order']=qs[_0x1c3f('0x3e')](_0x1c1c65[_0x1c3f('0x34')][_0x1c3f('0x3e')]);_0xe58a16[_0x1c3f('0x3f')]=qs[_0x1c3f('0x36')](_[_0x1c3f('0x40')](_0x1c1c65[_0x1c3f('0x34')],_0x4cb6d0[_0x1c3f('0x36')]));if(_0x1c1c65[_0x1c3f('0x34')][_0x1c3f('0x41')]){_0xe58a16[_0x1c3f('0x3f')]=_[_0x1c3f('0x42')](_0xe58a16['where'],{'$or':_[_0x1c3f('0x33')](_0xe58a16[_0x1c3f('0x38')],function(_0x2f9338){var _0xdd62a9={};_0xdd62a9[_0x2f9338]={'$like':'%'+_0x1c1c65['query'][_0x1c3f('0x41')]+'%'};return _0xdd62a9;})});}if(_0x1c1c65[_0x1c3f('0x34')][_0x1c3f('0x5a')]){var _0x1e3c48=_0x1c1c65[_0x1c3f('0x34')][_0x1c3f('0x5a')][_0x1c3f('0x5b')](',');var _0x558b2d={};_0x558b2d[_0x1e3c48[0x0]]={'$gte':moment(_0x1e3c48[0x1])[_0x1c3f('0x5c')](_0x1c3f('0x5d'))};_0xe58a16[_0x1c3f('0x3f')]=_[_0x1c3f('0x42')](_0xe58a16[_0x1c3f('0x3f')],_0x558b2d);}_0xe58a16=_[_0x1c3f('0x42')]({},_0xe58a16,_0x1c1c65[_0x1c3f('0x43')]);return _0x2eb902[_0x1c3f('0x5e')](_0xe58a16);}})[_0x1c3f('0x28')](function(_0x2053ac){if(_0x2053ac){_0x4fcffc=_0x2053ac['length'];if(!_0x1c1c65[_0x1c3f('0x34')][_0x1c3f('0x3b')](_0x1c3f('0x3c'))){_0xe58a16[_0x1c3f('0x23')]=qs['limit'](_0x1c1c65[_0x1c3f('0x34')]['limit']);_0xe58a16[_0x1c3f('0x22')]=qs[_0x1c3f('0x22')](_0x1c1c65['query'][_0x1c3f('0x22')]);}return _0x2eb902[_0x1c3f('0x5e')](_0xe58a16);}})['then'](function(_0x14cdf2){if(_0x14cdf2){return _0x14cdf2?{'count':_0x4fcffc,'rows':_0x14cdf2}:null;}})['then'](respondWithResult(_0x1a7d27,null))[_0x1c3f('0x48')](handleError(_0x1a7d27,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5672914..47f4b43 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 _0x069e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3c2b22,_0x322f05){var _0x312cdf=function(_0x2717b7){while(--_0x2717b7){_0x3c2b22['push'](_0x3c2b22['shift']());}};_0x312cdf(++_0x322f05);}(_0x069e,0x108));var _0xe069=function(_0x4b418f,_0x3b6a96){_0x4b418f=_0x4b418f-0x0;var _0x2ed208=_0x069e[_0x4b418f];return _0x2ed208;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xe069('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe069('0x1')](0x0);var events={'afterCreate':_0xe069('0x2'),'afterUpdate':_0xe069('0x3'),'afterDestroy':_0xe069('0x4')};function emitEvent(_0x3e83dc){return function(_0x4631eb,_0x43383f,_0x2f5a5c){ChatGroupEvents[_0xe069('0x5')](_0x3e83dc+':'+_0x4631eb['id'],_0x4631eb);ChatGroupEvents[_0xe069('0x5')](_0x3e83dc,_0x4631eb);_0x2f5a5c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe069('0x6')](e,emitEvent(event));}}module[_0xe069('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x8ebd=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save'];(function(_0x31c120,_0x3eb37c){var _0x368c49=function(_0x1a00d7){while(--_0x1a00d7){_0x31c120['push'](_0x31c120['shift']());}};_0x368c49(++_0x3eb37c);}(_0x8ebd,0x16d));var _0xd8eb=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x8ebd[_0x13b02f];return _0x12e9a6;};'use strict';var EventEmitter=require(_0xd8eb('0x0'));var ChatGroup=require(_0xd8eb('0x1'))['db'][_0xd8eb('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd8eb('0x3'),'afterUpdate':'update','afterDestroy':_0xd8eb('0x4')};function emitEvent(_0x211f1e){return function(_0x2374b4,_0x3d3bdf,_0x17e849){ChatGroupEvents[_0xd8eb('0x5')](_0x211f1e+':'+_0x2374b4['id'],_0x2374b4);ChatGroupEvents[_0xd8eb('0x5')](_0x211f1e,_0x2374b4);_0x17e849(null);};}for(var e in events){if(events[_0xd8eb('0x6')](e)){var event=events[e];ChatGroup[_0xd8eb('0x7')](e,emitEvent(event));}}module[_0xd8eb('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 4dba106..6f301c8 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 _0x764f=['api','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','../../config/logger'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x764f,0xe7));var _0xf764=function(_0x56d1c6,_0x273a92){_0x56d1c6=_0x56d1c6-0x0;var _0x3622f0=_0x764f[_0x56d1c6];return _0x3622f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf764('0x0'))(_0xf764('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf764('0x2'));var rimraf=require('rimraf');var config=require(_0xf764('0x3'));var attributes=require(_0xf764('0x4'));module[_0xf764('0x5')]=function(_0x431edf,_0x356a20){return _0x431edf[_0xf764('0x6')](_0xf764('0x7'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5544=['ChatGroup','chat_groups','lodash','api','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define'];(function(_0x1861da,_0x1e939d){var _0x4403cc=function(_0x336a39){while(--_0x336a39){_0x1861da['push'](_0x1861da['shift']());}};_0x4403cc(++_0x1e939d);}(_0x5544,0x1ba));var _0x4554=function(_0x5c3ba8,_0x96943c){_0x5c3ba8=_0x5c3ba8-0x0;var _0x280ef2=_0x5544[_0x5c3ba8];return _0x280ef2;};'use strict';var _=require(_0x4554('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4554('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4554('0x2'));var fs=require('fs');var path=require(_0x4554('0x3'));var rimraf=require(_0x4554('0x4'));var config=require(_0x4554('0x5'));var attributes=require(_0x4554('0x6'));module['exports']=function(_0x194507,_0x5259ee){return _0x194507[_0x4554('0x7')](_0x4554('0x8'),attributes,{'tableName':_0x4554('0x9'),'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 d3e3045..9fcfa17 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 _0x5b7f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x214aa8,_0x4e8a53){var _0x1deb27=function(_0x22f9b9){while(--_0x22f9b9){_0x214aa8['push'](_0x214aa8['shift']());}};_0x1deb27(++_0x4e8a53);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x2f7421,_0x53ce33){_0x2f7421=_0x2f7421-0x0;var _0x58299f=_0x5b7f[_0x2f7421];return _0x58299f;};'use strict';var _=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var moment=require(_0xf5b7('0x2'));var BPromise=require(_0xf5b7('0x3'));var rs=require(_0xf5b7('0x4'));var fs=require('fs');var Redis=require(_0xf5b7('0x5'));var db=require(_0xf5b7('0x6'))['db'];var utils=require(_0xf5b7('0x7'));var logger=require(_0xf5b7('0x8'))(_0xf5b7('0x9'));var config=require(_0xf5b7('0xa'));var jayson=require(_0xf5b7('0xb'));var client=jayson[_0xf5b7('0xc')][_0xf5b7('0xd')]({'port':0x232a});config[_0xf5b7('0xe')]=_[_0xf5b7('0xf')](config[_0xf5b7('0xe')],{'host':_0xf5b7('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0xf5b7('0x11')](socket);function respondWithRpcPromise(_0x15f7f8,_0x2e3315,_0x4595c1){return new BPromise(function(_0x299eba,_0x3d2a12){return client[_0xf5b7('0x12')](_0x15f7f8,_0x4595c1)[_0xf5b7('0x13')](function(_0x43da63){logger[_0xf5b7('0x14')](_0xf5b7('0x15'),_0x2e3315,_0xf5b7('0x16'));logger['debug'](_0xf5b7('0x17'),_0x2e3315,_0xf5b7('0x16'),JSON[_0xf5b7('0x18')](_0x43da63));if(_0x43da63[_0xf5b7('0x19')]){if(_0x43da63[_0xf5b7('0x19')]['code']===0x1f4){logger[_0xf5b7('0x19')]('ChatGroup,\x20%s,\x20%s',_0x2e3315,_0x43da63['error']['message']);return _0x3d2a12(_0x43da63['error'][_0xf5b7('0x1a')]);}logger[_0xf5b7('0x19')](_0xf5b7('0x15'),_0x2e3315,_0x43da63[_0xf5b7('0x19')][_0xf5b7('0x1a')]);return _0x299eba(_0x43da63['error'][_0xf5b7('0x1a')]);}else{logger[_0xf5b7('0x14')](_0xf5b7('0x15'),_0x2e3315,_0xf5b7('0x16'));_0x299eba(_0x43da63[_0xf5b7('0x1b')][_0xf5b7('0x1a')]);}})['catch'](function(_0x2d112f){logger[_0xf5b7('0x19')](_0xf5b7('0x15'),_0x2e3315,_0x2d112f);_0x3d2a12(_0x2d112f);});});} \ No newline at end of file +var _0x3074=['http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x4b4f4b,_0x4ebaa9){var _0x1bc4d8=function(_0x47a747){while(--_0x47a747){_0x4b4f4b['push'](_0x4b4f4b['shift']());}};_0x1bc4d8(++_0x4ebaa9);}(_0x3074,0x1dd));var _0x4307=function(_0x14b26a,_0x2b7757){_0x14b26a=_0x14b26a-0x0;var _0x2f4937=_0x3074[_0x14b26a];return _0x2f4937;};'use strict';var _=require(_0x4307('0x0'));var util=require('util');var moment=require(_0x4307('0x1'));var BPromise=require(_0x4307('0x2'));var rs=require(_0x4307('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4307('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4307('0x5'))(_0x4307('0x6'));var config=require('../../config/environment');var jayson=require(_0x4307('0x7'));var client=jayson[_0x4307('0x8')][_0x4307('0x9')]({'port':0x232a});config['redis']=_[_0x4307('0xa')](config[_0x4307('0xb')],{'host':_0x4307('0xc'),'port':0x18eb});var socket=require(_0x4307('0xd'))(new Redis(config[_0x4307('0xb')]));require(_0x4307('0xe'))[_0x4307('0xf')](socket);function respondWithRpcPromise(_0x406a2c,_0x286263,_0x4eea15){return new BPromise(function(_0x5b185c,_0x4f5cc9){return client[_0x4307('0x10')](_0x406a2c,_0x4eea15)['then'](function(_0x469cfc){logger[_0x4307('0x11')](_0x4307('0x12'),_0x286263,_0x4307('0x13'));logger[_0x4307('0x14')](_0x4307('0x15'),_0x286263,_0x4307('0x13'),JSON[_0x4307('0x16')](_0x469cfc));if(_0x469cfc['error']){if(_0x469cfc[_0x4307('0x17')][_0x4307('0x18')]===0x1f4){logger[_0x4307('0x17')](_0x4307('0x12'),_0x286263,_0x469cfc['error'][_0x4307('0x19')]);return _0x4f5cc9(_0x469cfc['error'][_0x4307('0x19')]);}logger['error'](_0x4307('0x12'),_0x286263,_0x469cfc[_0x4307('0x17')][_0x4307('0x19')]);return _0x5b185c(_0x469cfc[_0x4307('0x17')][_0x4307('0x19')]);}else{logger[_0x4307('0x11')](_0x4307('0x12'),_0x286263,'request\x20sent');_0x5b185c(_0x469cfc['result'][_0x4307('0x19')]);}})[_0x4307('0x1a')](function(_0x3174a0){logger[_0x4307('0x17')](_0x4307('0x12'),_0x286263,_0x3174a0);_0x4f5cc9(_0x3174a0);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 42870b5..0db4917 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 _0x4e4e=['save','update','length','chatGroup:','./chatGroup.events'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4e4e,0x112));var _0xe4e4=function(_0x416a6b,_0x3cb267){_0x416a6b=_0x416a6b-0x0;var _0x16d29d=_0x4e4e[_0x416a6b];return _0x16d29d;};'use strict';var ChatGroupEvents=require(_0xe4e4('0x0'));var events=[_0xe4e4('0x1'),'remove',_0xe4e4('0x2')];function createListener(_0x517e43,_0x2ec6b3){return function(_0x6ec466){_0x2ec6b3['emit'](_0x517e43,_0x6ec466);};}function removeListener(_0x82cfd1,_0x2c7f31){return function(){ChatGroupEvents['removeListener'](_0x82cfd1,_0x2c7f31);};}exports['register']=function(_0x5719a8){for(var _0x26237f=0x0,_0x4e486f=events[_0xe4e4('0x3')];_0x26237f<_0x4e486f;_0x26237f++){var _0x12be0e=events[_0x26237f];var _0x3a54a1=createListener(_0xe4e4('0x4')+_0x12be0e,_0x5719a8);ChatGroupEvents['on'](_0x12be0e,_0x3a54a1);}}; \ No newline at end of file +var _0x2e0a=['remove','length','chatGroup:','./chatGroup.events','save'];(function(_0x3ed7bc,_0x2d7257){var _0x58e6e1=function(_0xad2ef6){while(--_0xad2ef6){_0x3ed7bc['push'](_0x3ed7bc['shift']());}};_0x58e6e1(++_0x2d7257);}(_0x2e0a,0x1f2));var _0xa2e0=function(_0x51e3d5,_0x2aaeb3){_0x51e3d5=_0x51e3d5-0x0;var _0x560a39=_0x2e0a[_0x51e3d5];return _0x560a39;};'use strict';var ChatGroupEvents=require(_0xa2e0('0x0'));var events=[_0xa2e0('0x1'),_0xa2e0('0x2'),'update'];function createListener(_0x332491,_0x3e38eb){return function(_0x5c1bc7){_0x3e38eb['emit'](_0x332491,_0x5c1bc7);};}function removeListener(_0x59b7d4,_0x29971a){return function(){ChatGroupEvents['removeListener'](_0x59b7d4,_0x29971a);};}exports['register']=function(_0x2fa4a1){for(var _0x11d897=0x0,_0xbbc9ab=events[_0xa2e0('0x3')];_0x11d897<_0xbbc9ab;_0x11d897++){var _0x13c934=events[_0x11d897];var _0x31bc57=createListener(_0xa2e0('0x4')+_0x13c934,_0x2fa4a1);ChatGroupEvents['on'](_0x13c934,_0x31bc57);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 409d77e..63176bb 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 _0xb730=['update','delete','destroy','removeMembers','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','/:id'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0xb730,0x18b));var _0x0b73=function(_0x4f9f08,_0x43d059){_0x4f9f08=_0x4f9f08-0x0;var _0x52b6d6=_0xb730[_0x4f9f08];return _0x52b6d6;};'use strict';var multer=require(_0x0b73('0x0'));var util=require(_0x0b73('0x1'));var path=require(_0x0b73('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0b73('0x3'));var interaction=require(_0x0b73('0x4'));var config=require(_0x0b73('0x5'));var controller=require(_0x0b73('0x6'));router['get']('/',auth[_0x0b73('0x7')](),controller[_0x0b73('0x8')]);router[_0x0b73('0x9')]('/describe',auth[_0x0b73('0x7')](),controller['describe']);router[_0x0b73('0x9')]('/:id',auth[_0x0b73('0x7')](),controller[_0x0b73('0xa')]);router[_0x0b73('0x9')](_0x0b73('0xb'),auth['isAuthenticated'](),controller[_0x0b73('0xc')]);router[_0x0b73('0x9')](_0x0b73('0xd'),auth[_0x0b73('0x7')](),controller[_0x0b73('0xe')]);router[_0x0b73('0x9')](_0x0b73('0xf'),auth[_0x0b73('0x7')](),controller[_0x0b73('0x10')]);router[_0x0b73('0x11')]('/',auth[_0x0b73('0x7')](),controller[_0x0b73('0x12')]);router[_0x0b73('0x11')]('/:id/members',auth[_0x0b73('0x7')](),controller[_0x0b73('0x13')]);router[_0x0b73('0x11')](_0x0b73('0xf'),auth[_0x0b73('0x7')](),controller['addMessage']);router['put'](_0x0b73('0x14'),auth[_0x0b73('0x7')](),controller[_0x0b73('0x15')]);router[_0x0b73('0x16')]('/:id',auth[_0x0b73('0x7')](),controller[_0x0b73('0x17')]);router['delete'](_0x0b73('0xd'),auth[_0x0b73('0x7')](),controller[_0x0b73('0x18')]);module[_0x0b73('0x19')]=router; \ No newline at end of file +var _0x99ae=['index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','put','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x99ae,0xa3));var _0xe99a=function(_0x1dca2e,_0x46196c){_0x1dca2e=_0x1dca2e-0x0;var _0x21f423=_0x99ae[_0x1dca2e];return _0x21f423;};'use strict';var multer=require(_0xe99a('0x0'));var util=require('util');var path=require(_0xe99a('0x1'));var timeout=require(_0xe99a('0x2'));var express=require(_0xe99a('0x3'));var router=express[_0xe99a('0x4')]();var fs_extra=require(_0xe99a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe99a('0x6'));var config=require(_0xe99a('0x7'));var controller=require(_0xe99a('0x8'));router[_0xe99a('0x9')]('/',auth[_0xe99a('0xa')](),controller[_0xe99a('0xb')]);router[_0xe99a('0x9')](_0xe99a('0xc'),auth[_0xe99a('0xa')](),controller['describe']);router[_0xe99a('0x9')](_0xe99a('0xd'),auth['isAuthenticated'](),controller[_0xe99a('0xe')]);router[_0xe99a('0x9')](_0xe99a('0xf'),auth[_0xe99a('0xa')](),controller[_0xe99a('0x10')]);router[_0xe99a('0x9')](_0xe99a('0x11'),auth['isAuthenticated'](),controller[_0xe99a('0x12')]);router[_0xe99a('0x9')](_0xe99a('0x13'),auth[_0xe99a('0xa')](),controller[_0xe99a('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe99a('0x15')]);router[_0xe99a('0x16')](_0xe99a('0x11'),auth[_0xe99a('0xa')](),controller[_0xe99a('0x17')]);router[_0xe99a('0x16')](_0xe99a('0x13'),auth[_0xe99a('0xa')](),controller['addMessage']);router[_0xe99a('0x18')](_0xe99a('0xd'),auth[_0xe99a('0xa')](),controller['update']);router[_0xe99a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xe99a('0x1a')]);router[_0xe99a('0x19')](_0xe99a('0x11'),auth[_0xe99a('0xa')](),controller[_0xe99a('0x1b')]);module[_0xe99a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 5d915a3..8f9032a 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 _0xe6ef=['INTEGER','ENUM','star','thumb','TEXT','DATE','STRING','long','BOOLEAN'];(function(_0x727dfa,_0x2327cf){var _0x1562ad=function(_0x47cd05){while(--_0x47cd05){_0x727dfa['push'](_0x727dfa['shift']());}};_0x1562ad(++_0x2327cf);}(_0xe6ef,0x19d));var _0xfe6e=function(_0x5c9658,_0x5acc0c){_0x5c9658=_0x5c9658-0x0;var _0x5beae4=_0xe6ef[_0x5c9658];return _0x5beae4;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xfe6e('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfe6e('0x1')]},'ratingType':{'type':Sequelize[_0xfe6e('0x2')](_0xfe6e('0x3'),_0xfe6e('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xfe6e('0x5')]},'pathTranscript':{'type':Sequelize[_0xfe6e('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfe6e('0x6')]},'disposition':{'type':Sequelize[_0xfe6e('0x7')]},'secondDisposition':{'type':Sequelize[_0xfe6e('0x7')]},'thirdDisposition':{'type':Sequelize[_0xfe6e('0x7')]},'note':{'type':Sequelize[_0xfe6e('0x7')]},'browserName':{'type':Sequelize[_0xfe6e('0x7')]},'browserVersion':{'type':Sequelize[_0xfe6e('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xfe6e('0x7')]},'deviceModel':{'type':Sequelize[_0xfe6e('0x7')]},'deviceVendor':{'type':Sequelize[_0xfe6e('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xfe6e('0x7')]},'formData':{'type':Sequelize[_0xfe6e('0x5')](_0xfe6e('0x8'))},'read1stAt':{'type':Sequelize[_0xfe6e('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfe6e('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfe6e('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xfe6e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xfe6e('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfe6e('0x1')]}}; \ No newline at end of file +var _0xb41c=['star','TEXT','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM'];(function(_0x5b11a2,_0x1db209){var _0xbcfe1a=function(_0x1ac8af){while(--_0x1ac8af){_0x5b11a2['push'](_0x5b11a2['shift']());}};_0xbcfe1a(++_0x1db209);}(_0xb41c,0x1b3));var _0xcb41=function(_0x25695d,_0x40b580){_0x25695d=_0x25695d-0x0;var _0x5a68ae=_0xb41c[_0x25695d];return _0x5a68ae;};'use strict';var Sequelize=require(_0xcb41('0x0'));module[_0xcb41('0x1')]={'closed':{'type':Sequelize[_0xcb41('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xcb41('0x3')]},'ratingType':{'type':Sequelize[_0xcb41('0x4')](_0xcb41('0x5'),'thumb'),'defaultValue':_0xcb41('0x5')},'ratingMessage':{'type':Sequelize[_0xcb41('0x6')]},'pathTranscript':{'type':Sequelize[_0xcb41('0x6')]},'mailTranscript':{'type':Sequelize[_0xcb41('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcb41('0x7')]},'secondDisposition':{'type':Sequelize[_0xcb41('0x7')]},'thirdDisposition':{'type':Sequelize[_0xcb41('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xcb41('0x7')]},'browserVersion':{'type':Sequelize[_0xcb41('0x7')]},'osName':{'type':Sequelize[_0xcb41('0x7')]},'osVersion':{'type':Sequelize[_0xcb41('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xcb41('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xcb41('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcb41('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xcb41('0x7')]},'customerPort':{'type':Sequelize[_0xcb41('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xcb41('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xcb41('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xcb41('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e62d524..897d57c 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 _0x9991=['../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','sendStatus','status','undefined','limit','count','set','json','update','end','stack','name','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','query','catch','show','keys','ChatInteraction','filters','intersection','attributes','fields','model','options','find','create','params','destroy','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','transcript-%s.txt','pathTranscript','User','ContactId','Messages','length','format','%s%d','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','offset','order','sort','where','ChatInteractionId','filter','$gte','split','includeAll','include','findAll','rows','getMyMessages','nolimit','pick','secret','includeAgent','push','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','ioredis'];(function(_0x164467,_0x5df59a){var _0x56529f=function(_0x4ced8f){while(--_0x4ced8f){_0x164467['push'](_0x164467['shift']());}};_0x56529f(++_0x5df59a);}(_0x9991,0xc4));var _0x1999=function(_0x5e5a1e,_0x51ce7e){_0x5e5a1e=_0x5e5a1e-0x0;var _0x48fc13=_0x9991[_0x5e5a1e];return _0x48fc13;};'use strict';var rimraf=require(_0x1999('0x0'));var zipdir=require(_0x1999('0x1'));var rp=require(_0x1999('0x2'));var moment=require(_0x1999('0x3'));var BPromise=require(_0x1999('0x4'));var Mustache=require(_0x1999('0x5'));var util=require(_0x1999('0x6'));var path=require(_0x1999('0x7'));var ejs=require(_0x1999('0x8'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1999('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0x1999('0xa'));var pdf=require(_0x1999('0xb'));var logger=require(_0x1999('0xc'))('api');var config=require(_0x1999('0xd'));var db=require('../../mysqldb')['db'];config[_0x1999('0xe')]=_[_0x1999('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1999('0x10'))(new Redis(config[_0x1999('0xe')]));require(_0x1999('0x11'))['register'](socket);var jayson=require(_0x1999('0x12'));var client=jayson['client'][_0x1999('0x13')]({'port':0x232b});var client9004=jayson['client'][_0x1999('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x11ec6f,_0x41b578,_0x508555,_0x37fe3c){return new BPromise(function(_0x55f6f3,_0x5bc788){var _0x81afe2=_0x37fe3c||client;return _0x81afe2[_0x1999('0x14')](_0x11ec6f,_0x508555)[_0x1999('0x15')](function(_0xb4c479){logger['info'](_0x1999('0x16'),_0x41b578,_0x1999('0x17'));logger['debug'](_0x1999('0x18'),_0x41b578,'request\x20sent',JSON[_0x1999('0x19')](_0xb4c479));if(_0xb4c479['error']){if(_0xb4c479['error'][_0x1999('0x1a')]===0x1f4){logger[_0x1999('0x1b')](_0x1999('0x16'),_0x41b578,_0xb4c479[_0x1999('0x1b')]['message']);return _0x5bc788(_0xb4c479[_0x1999('0x1b')][_0x1999('0x1c')]);}logger[_0x1999('0x1b')](_0x1999('0x16'),_0x41b578,_0xb4c479[_0x1999('0x1b')][_0x1999('0x1c')]);return _0x55f6f3(_0xb4c479[_0x1999('0x1b')][_0x1999('0x1c')]);}else{logger[_0x1999('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x41b578,_0x1999('0x17'));_0x55f6f3(_0xb4c479[_0x1999('0x1e')][_0x1999('0x1c')]);}})['catch'](function(_0xbb7dc0){logger[_0x1999('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x41b578,_0xbb7dc0);_0x5bc788(_0xbb7dc0);});});}function respondWithStatusCode(_0x35773d,_0x1dc0d0){_0x1dc0d0=_0x1dc0d0||0xcc;return function(_0x273019){if(_0x273019){return _0x35773d[_0x1999('0x1f')](_0x1dc0d0);}return _0x35773d[_0x1999('0x20')](_0x1dc0d0)['end']();};}function respondWithResult(_0x4d8de5,_0x365b59){_0x365b59=_0x365b59||0xc8;return function(_0x257be5){if(_0x257be5){return _0x4d8de5[_0x1999('0x20')](_0x365b59)['json'](_0x257be5);}};}function respondWithFilteredResult(_0x33d5cf,_0x209e31){return function(_0x54db26){if(_0x54db26){var _0x4f66f6=typeof _0x209e31['offset']===_0x1999('0x21')&&typeof _0x209e31[_0x1999('0x22')]===_0x1999('0x21');var _0x43a036=_0x54db26[_0x1999('0x23')];var _0x26a9d2=_0x4f66f6?0x0:_0x209e31['offset'];var _0x5db2ce=_0x4f66f6?_0x54db26['count']:_0x209e31['offset']+_0x209e31['limit'];var _0x54eada;if(_0x5db2ce>=_0x43a036){_0x5db2ce=_0x43a036;_0x54eada=0xc8;}else{_0x54eada=0xce;}_0x33d5cf[_0x1999('0x20')](_0x54eada);return _0x33d5cf[_0x1999('0x24')]('Content-Range',_0x26a9d2+'-'+_0x5db2ce+'/'+_0x43a036)[_0x1999('0x25')](_0x54db26);}return null;};}function saveUpdates(_0x4e12ec){return function(_0x6b3c77){if(_0x6b3c77){return _0x6b3c77[_0x1999('0x26')](_0x4e12ec)[_0x1999('0x15')](function(_0x4783d9){return _0x4783d9;});}return null;};}function removeEntity(_0x514751){return function(_0x13844b){if(_0x13844b){return _0x13844b['destroy']()[_0x1999('0x15')](function(){_0x514751['status'](0xcc)[_0x1999('0x27')]();});}};}function handleEntityNotFound(_0x2ebcdf){return function(_0x1b4826){if(!_0x1b4826){_0x2ebcdf['sendStatus'](0x194);}return _0x1b4826;};}function handleError(_0x28d09f,_0xb670a6){_0xb670a6=_0xb670a6||0x1f4;return function(_0x2792f9){logger[_0x1999('0x1b')](_0x2792f9[_0x1999('0x28')]);if(_0x2792f9[_0x1999('0x29')]){delete _0x2792f9[_0x1999('0x29')];}_0x28d09f[_0x1999('0x20')](_0xb670a6)['send'](_0x2792f9);};}function getMustacheRender(_0x3ccf65,_0x4e5535){return Mustache['render'](_0x3ccf65,_[_0x1999('0x2a')](_0x4e5535[_0x1999('0x2b')],{'contact':_0x4e5535[_0x1999('0x2c')],'message':_0x4e5535['message'],'agent':_0x4e5535[_0x1999('0x2d')],'interaction':_0x4e5535[_0x1999('0x2e')],'account':_0x4e5535[_0x1999('0x2f')]}))||'';}exports[_0x1999('0x30')]=function(_0x29e56c,_0x2d8c22){var _0x40d9f6={};var _0x1c4e3b=_[_0x1999('0x31')](db['ChatInteraction'][_0x1999('0x32')],function(_0x1cb7de){return{'name':_0x1cb7de[_0x1999('0x33')],'type':_0x1cb7de[_0x1999('0x34')]['key']};});_0x40d9f6=qs['getOptions'](_0x1c4e3b,_0x29e56c);return interaction['findAll']('chat',_0x29e56c[_0x1999('0x35')],_0x29e56c['user'],_0x40d9f6,_0x1c4e3b)[_0x1999('0x15')](respondWithFilteredResult(_0x2d8c22,_0x40d9f6))[_0x1999('0x36')](handleError(_0x2d8c22,null));};exports[_0x1999('0x37')]=function(_0x54986a,_0x38cfa0){var _0x2951ba={'raw':![],'where':{'id':_0x54986a['params']['id']}},_0xe8d087={};_0xe8d087['model']=_[_0x1999('0x38')](db[_0x1999('0x39')][_0x1999('0x32')]);_0xe8d087['query']=_[_0x1999('0x38')](_0x54986a['query']);_0xe8d087[_0x1999('0x3a')]=_[_0x1999('0x3b')](_0xe8d087['model'],_0xe8d087[_0x1999('0x35')]);_0x2951ba[_0x1999('0x3c')]=_[_0x1999('0x3b')](_0xe8d087['model'],qs[_0x1999('0x3d')](_0x54986a[_0x1999('0x35')][_0x1999('0x3d')]));_0x2951ba[_0x1999('0x3c')]=_0x2951ba[_0x1999('0x3c')]['length']?_0x2951ba[_0x1999('0x3c')]:_0xe8d087[_0x1999('0x3e')];if(_0x54986a[_0x1999('0x35')]['includeAll']){_0x2951ba['include']=[{'all':!![]}];}_0x2951ba=_[_0x1999('0x2a')]({},_0x2951ba,_0x54986a[_0x1999('0x3f')]);return db[_0x1999('0x39')][_0x1999('0x40')](_0x2951ba)[_0x1999('0x15')](handleEntityNotFound(_0x38cfa0,null))[_0x1999('0x15')](respondWithResult(_0x38cfa0,null))[_0x1999('0x36')](handleError(_0x38cfa0,null));};exports[_0x1999('0x41')]=function(_0x54adc4,_0x47c575){return db[_0x1999('0x39')][_0x1999('0x41')](_0x54adc4[_0x1999('0x2b')],{})[_0x1999('0x15')](respondWithResult(_0x47c575,0xc9))[_0x1999('0x36')](handleError(_0x47c575,null));};exports[_0x1999('0x26')]=function(_0x19e41d,_0x1128e0){if(_0x19e41d[_0x1999('0x2b')]['id']){delete _0x19e41d[_0x1999('0x2b')]['id'];}return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x19e41d[_0x1999('0x42')]['id']}})['then'](handleEntityNotFound(_0x1128e0,null))[_0x1999('0x15')](saveUpdates(_0x19e41d[_0x1999('0x2b')],null))['then'](respondWithResult(_0x1128e0,null))[_0x1999('0x36')](handleError(_0x1128e0,null));};exports[_0x1999('0x43')]=function(_0x2e7c8d,_0x111cd4){return db['ChatInteraction'][_0x1999('0x40')]({'where':{'id':_0x2e7c8d[_0x1999('0x42')]['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x111cd4,null))['then'](removeEntity(_0x111cd4,null))[_0x1999('0x36')](handleError(_0x111cd4,null));};exports['describe']=function(_0x389432,_0x454d92){return db['ChatInteraction']['describe']()[_0x1999('0x15')](respondWithResult(_0x454d92,null))[_0x1999('0x36')](handleError(_0x454d92,null));};exports[_0x1999('0x44')]=function(_0x1ba7c9,_0x3d90bc){var _0x513e8b=_0x1ba7c9[_0x1999('0x42')]['id'];var _0x48ed23;var _0x512414;var _0x18ead1;return db[_0x1999('0x39')][_0x1999('0x45')]({'where':{'id':_0x513e8b}})[_0x1999('0x15')](function(_0x29da28){_0x48ed23=_0x29da28;return db[_0x1999('0x46')]['findOne']({'where':{'id':_0x29da28[_0x1999('0x47')]},'attributes':['id',_0x1999('0x48'),_0x1999('0x49'),_0x1999('0x4a'),_0x1999('0x4b'),_0x1999('0x4c')],'raw':!![]});})[_0x1999('0x15')](function(_0x4f7f71){if(_0x4f7f71&&_0x4f7f71[_0x1999('0x48')]&&_0x4f7f71[_0x1999('0x49')]){_0x512414=_0x4f7f71;var _0x3e11d2={'interaction':{'id':_0x513e8b},'agent':{'id':_0x1ba7c9[_0x1999('0x4d')]['id'],'name':_0x1ba7c9[_0x1999('0x4d')][_0x1999('0x29')],'fullname':_0x1ba7c9[_0x1999('0x4d')][_0x1999('0x4e')],'email':_0x1ba7c9[_0x1999('0x4d')][_0x1999('0x4f')]},'contact':_0x1ba7c9[_0x1999('0x2b')][_0x1999('0x2c')],'account':_0x1ba7c9['body'][_0x1999('0x2f')]};var _0x5ec35f={'rejectUnauthorized':![],'method':_0x1999('0x50'),'url':_0x1999('0x51'),'headers':{'X-APIKEY':_0x4f7f71['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1ba7c9['user'][_0x1999('0x4f')]],'buttons':null,'topic':_0x512414['vidaooTopic'],'note':_['isNull'](_0x512414[_0x1999('0x4b')])?null:getMustacheRender(_0x512414[_0x1999('0x4b')],_0x3e11d2),'metadata':null},'redirect':_0x1999('0x52'),'json':!![]};try{if(!_[_0x1999('0x53')](_0x512414[_0x1999('0x4c')])){var _0x1cd65d=getMustacheRender(_0x512414[_0x1999('0x4c')],_0x3e11d2);var _0x44ea21=JSON['parse'](_0x1cd65d);_0x5ec35f[_0x1999('0x2b')][_0x1999('0x54')]=_0x44ea21;}}catch(_0x197145){throw new db[(_0x1999('0x55'))]['ValidationError'](_0x1999('0x56'));}return rp(_0x5ec35f);}else{throw new db[(_0x1999('0x55'))][(_0x1999('0x57'))](_0x1999('0x58'));}})[_0x1999('0x15')](function(_0x43b56a){_0x18ead1=_0x43b56a;if(_0x18ead1['id']){var _0x5f1121={'body':_0x18ead1[_0x1999('0x59')],'ChatWebsiteId':_0x512414['id'],'ChatInteractionId':_0x48ed23['id'],'direction':'out','UserId':_0x1ba7c9[_0x1999('0x4d')]['id']};return db[_0x1999('0x5a')][_0x1999('0x41')](_0x5f1121,{});}else{throw new db[(_0x1999('0x55'))][(_0x1999('0x57'))](_0x1999('0x5b'));}})[_0x1999('0x15')](function(){return _0x48ed23['updateAttributes']({'vidaooSessionId':_0x18ead1['id']});})['then'](respondWithResult(_0x3d90bc,null))[_0x1999('0x36')](handleError(_0x3d90bc,null));};exports[_0x1999('0x5c')]=function(_0x35bfec,_0x4db864){if(_0x35bfec[_0x1999('0x2b')]['id']){delete _0x35bfec['body']['id'];}return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x35bfec[_0x1999('0x42')]['id']},'include':[{'model':db[_0x1999('0x5d')],'as':_0x1999('0x5e')}]})[_0x1999('0x15')](handleEntityNotFound(_0x4db864,null))[_0x1999('0x15')](saveUpdates(_0x35bfec['body'],null))[_0x1999('0x15')](respondWithResult(_0x4db864,null))[_0x1999('0x36')](handleError(_0x4db864,null));};exports['abandon']=function(_0x1f8ccf,_0x3a8179){if(_0x1f8ccf[_0x1999('0x2b')]['id']){delete _0x1f8ccf[_0x1999('0x2b')]['id'];}return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x1f8ccf[_0x1999('0x42')]['id']}})[_0x1999('0x15')](function(_0x450b09){if(!_0x450b09){logger['error'](_0x1999('0x5f'),'abandon',0x194,'entity\x20not\x20found');_0x3a8179[_0x1999('0x1f')](0x194);}else{if(_0x450b09[_0x1999('0x60')]){throw new db['Sequelize']['ValidationError'](_0x1999('0x61'));}}return _0x450b09;})['then'](function(_0x5ec5b7){if(_0x5ec5b7){return _0x5ec5b7['update']({'closed':_0x1f8ccf[_0x1999('0x2b')][_0x1999('0x62')],'disposition':_0x1f8ccf[_0x1999('0x2b')][_0x1999('0x63')]})[_0x1999('0x15')](function(_0x2cbf2e){return _0x2cbf2e;});}})[_0x1999('0x15')](function(){return respondWithRpcPromise(_0x1999('0x64'),_0x1999('0x65'),_0x1f8ccf[_0x1999('0x2b')],client9004);})[_0x1999('0x15')](respondWithResult(_0x3a8179,null))[_0x1999('0x36')](handleError(_0x3a8179,null));};exports[_0x1999('0x66')]=function(_0x45306f,_0x2d8c2e){_0x45306f['body'][_0x1999('0x29')]=_0x45306f['file'][_0x1999('0x67')];_0x45306f[_0x1999('0x2b')][_0x1999('0x68')]=_0x45306f['file']['filename'];_0x45306f[_0x1999('0x2b')][_0x1999('0x34')]=_0x45306f[_0x1999('0x69')][_0x1999('0x6a')];return db[_0x1999('0x6b')]['create'](_0x45306f[_0x1999('0x2b')])[_0x1999('0x15')](respondWithResult(_0x2d8c2e,0xc9))[_0x1999('0x36')](handleError(_0x2d8c2e,null));};exports[_0x1999('0x6c')]=function(_0xb58e95,_0x4af665){return db['ChatInteraction'][_0x1999('0x45')]({'where':{'id':_0xb58e95[_0x1999('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4af665,null))[_0x1999('0x15')](function(_0x4e7373){if(_0x4e7373){if(_0x4e7373[_0x1999('0x62')]){return _0x4af665[_0x1999('0x20')](0x193)[_0x1999('0x25')]({'status':0x193,'message':_0x1999('0x6d')});}return db[_0x1999('0x6b')][_0x1999('0x45')]({'where':{'id':_0xb58e95['query'][_0x1999('0x6e')]},'raw':!![]})[_0x1999('0x15')](handleEntityNotFound(_0x4af665,null));}})[_0x1999('0x15')](function(_0x351315){if(_0x351315){var _0x438113=_0x351315[_0x1999('0x6f')]!==null;var _0x24b424=path[_0x1999('0x70')](config[_0x1999('0x71')],'server/files/attachments/');if(_0x438113){_0x24b424=path[_0x1999('0x70')](_0x24b424,_0x1999('0x72'));}var _0x586e5a=path[_0x1999('0x70')](_0x24b424,_0x351315[_0x1999('0x68')]);return _0x4af665[_0x1999('0x73')](_0x586e5a);}})[_0x1999('0x36')](handleError(_0x4af665,null));};exports[_0x1999('0x74')]=function(_0x435d33,_0x4d424){var _0x4febc6=null;var _0x1be2eb=null;var _0x46826c=null;if(_0x435d33[_0x1999('0x2b')]['id']){delete _0x435d33[_0x1999('0x2b')]['id'];}if(_0x435d33[_0x1999('0x2b')]['mailTranscript']){_0x46826c=path['join'](config[_0x1999('0x71')],'server/files/chat/upload/',util['format'](_0x1999('0x75'),Date['now']()));_0x435d33[_0x1999('0x2b')][_0x1999('0x76')]=_0x46826c;}return db[_0x1999('0x39')]['find']({'where':{'id':_0x435d33[_0x1999('0x42')]['id']},'include':[{'model':db[_0x1999('0x5a')],'as':'Messages','include':[{'model':db[_0x1999('0x77')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x4d424,null))['then'](saveUpdates(_0x435d33[_0x1999('0x2b')],null))[_0x1999('0x15')](function(_0x1bd522){if(_0x1bd522){_0x4febc6=_0x1bd522;return db[_0x1999('0x46')][_0x1999('0x40')]({'where':{'id':_0x4febc6[_0x1999('0x47')]}});}})[_0x1999('0x15')](function(_0x398c21){if(_0x398c21){_0x1be2eb=_0x398c21;return db['CmContact'][_0x1999('0x40')]({'where':{'id':_0x4febc6[_0x1999('0x78')]}});}})['then'](function(_0x4dbed5){if(_0x4dbed5){if(_0x46826c){var _0x1d7a65=null;for(var _0x30a3dd=0x1;_0x30a3dd<_0x4febc6[_0x1999('0x79')][_0x1999('0x7a')];++_0x30a3dd){_0x1d7a65=_0x4febc6[_0x1999('0x79')][_0x30a3dd];var _0x1ec186=_0x1d7a65[_0x1999('0x60')]?util[_0x1999('0x7b')](_0x1999('0x7c'),_0x1be2eb[_0x1999('0x7d')],_0x1d7a65['UserId']):_0x1999('0x7e');var _0xed2458=_0x435d33['body']['customer']||util[_0x1999('0x7b')](_0x1999('0x7c'),'Visitor',_0x1d7a65[_0x1999('0x78')]);switch(_0x1be2eb['agentIdentifier']){case'website_alias':_0x1ec186=_0x1d7a65[_0x1999('0x60')]?util['format']('%s%d',_0x1be2eb[_0x1999('0x7d')],_0x1d7a65[_0x1999('0x60')]):_0x1999('0x7e');break;case _0x1999('0x7f'):_0x1ec186=_0x1d7a65[_0x1999('0x60')]?_0x1d7a65['User'][_0x1999('0x80')]||_0x1d7a65[_0x1999('0x77')][_0x1999('0x4e')]:_0x1999('0x7e');break;case _0x1999('0x81'):_0x1ec186=_0x1d7a65[_0x1999('0x60')]?_0x1d7a65['User'][_0x1999('0x4e')]:_0x1999('0x7e');break;default:_0x1ec186=_0x1d7a65['UserId']?util[_0x1999('0x7b')](_0x1999('0x7c'),_0x1be2eb[_0x1999('0x7d')],_0x1d7a65[_0x1999('0x60')]):_0x1999('0x7e');}var _0x46677a=util[_0x1999('0x7b')](_0x1999('0x82'),moment(_0x1d7a65[_0x1999('0x83')])['format'](_0x1999('0x84')),_0x1d7a65[_0x1999('0x85')]==='in'?_0xed2458:_0x1ec186,_0x1d7a65[_0x1999('0x2b')]);if(!_0x1d7a65['secret']){fs[_0x1999('0x86')](_0x46826c,_0x46677a);}}return db[_0x1999('0x87')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1999('0x88')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x1999('0x15')](function(_0x250cb4){if(!_0x250cb4||!_0x250cb4[_0x1999('0x89')]||!_0x435d33[_0x1999('0x2b')])return _0x4febc6;var _0x2d8848=_0x250cb4[_0x1999('0x8a')]();return respondWithRpcPromise(_0x1999('0x8b'),_0x1999('0x8c'),{'account':_0x2d8848,'message':{'from':util[_0x1999('0x7b')]('\x22%s\x22\x20<%s>',_0x250cb4['name'],_0x250cb4[_0x1999('0x4f')]||_0x250cb4[_0x1999('0x89')]['user']),'to':_0x435d33[_0x1999('0x2b')][_0x1999('0x8d')],'subject':_0x1999('0x8e'),'text':util['format'](_0x1999('0x8f'),_0x435d33[_0x1999('0x2b')][_0x1999('0x8d')]),'attachments':[{'path':_0x46826c}]}})['then'](function(){return _0x4febc6;})[_0x1999('0x36')](function(_0x1b2444){logger[_0x1999('0x1b')](_0x1b2444);});})['then'](respondWithStatusCode(_0x4d424,0xc8))['catch'](handleError(_0x4d424,null));};exports['addMessage']=function(_0x1ddf15,_0xd3f0f3){return db[_0x1999('0x5a')]['find']({'where':{'id':_0x1ddf15[_0x1999('0x42')]['id']}})['then'](handleEntityNotFound(_0xd3f0f3,null))[_0x1999('0x15')](function(_0x1b0264){if(_0x1b0264){return _0x1b0264[_0x1999('0x90')](_0x1ddf15[_0x1999('0x2b')][_0x1999('0x91')],_[_0x1999('0x92')](_0x1ddf15[_0x1999('0x2b')],[_0x1999('0x91'),'id'])||{});}})[_0x1999('0x15')](respondWithResult(_0xd3f0f3,null))[_0x1999('0x36')](handleError(_0xd3f0f3,null));};exports[_0x1999('0x93')]=function(_0x188a76,_0x52e7b1){var _0x4b42a0={'raw':![],'where':{}};var _0x151c21={};var _0x5bc1da={'count':0x0,'rows':[]};return db[_0x1999('0x39')][_0x1999('0x45')]({'where':{'id':_0x188a76['params']['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x52e7b1,null))['then'](function(_0x358834){if(_0x358834){_0x151c21['model']=_[_0x1999('0x38')](db[_0x1999('0x5a')][_0x1999('0x32')]);_0x151c21[_0x1999('0x35')]=_[_0x1999('0x38')](_0x188a76['query']);_0x151c21[_0x1999('0x3a')]=_['intersection'](_0x151c21['model'],_0x151c21[_0x1999('0x35')]);_0x4b42a0[_0x1999('0x3c')]=_[_0x1999('0x3b')](_0x151c21[_0x1999('0x3e')],qs[_0x1999('0x3d')](_0x188a76['query'][_0x1999('0x3d')]));_0x4b42a0['attributes']=_0x4b42a0[_0x1999('0x3c')]['length']?_0x4b42a0[_0x1999('0x3c')]:_0x151c21[_0x1999('0x3e')];if(!_0x188a76[_0x1999('0x35')][_0x1999('0x94')]('nolimit')){_0x4b42a0['limit']=qs['limit'](_0x188a76[_0x1999('0x35')][_0x1999('0x22')]);_0x4b42a0['offset']=qs['offset'](_0x188a76[_0x1999('0x35')][_0x1999('0x95')]);}_0x4b42a0[_0x1999('0x96')]=qs[_0x1999('0x97')](_0x188a76[_0x1999('0x35')][_0x1999('0x97')]);_0x4b42a0[_0x1999('0x98')]=qs[_0x1999('0x3a')](_['pick'](_0x188a76[_0x1999('0x35')],_0x151c21['filters']));_0x4b42a0[_0x1999('0x98')][_0x1999('0x99')]=_0x358834['id'];if(_0x188a76[_0x1999('0x35')]['filter']){_0x4b42a0[_0x1999('0x98')]=_[_0x1999('0x2a')](_0x4b42a0[_0x1999('0x98')],{'$or':_['map'](_0x4b42a0[_0x1999('0x3c')],function(_0x23f1ae){var _0x2b70e8={};_0x2b70e8[_0x23f1ae]={'$like':'%'+_0x188a76['query'][_0x1999('0x9a')]+'%'};return _0x2b70e8;})});}if(_0x188a76[_0x1999('0x35')][_0x1999('0x9b')]){var _0x5c5bb1=_0x188a76[_0x1999('0x35')]['$gte'][_0x1999('0x9c')](',');var _0x33160d={};_0x33160d[_0x5c5bb1[0x0]]={'$gte':moment(_0x5c5bb1[0x1])[_0x1999('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4b42a0[_0x1999('0x98')]=_[_0x1999('0x2a')](_0x4b42a0[_0x1999('0x98')],_0x33160d);}_0x4b42a0=_[_0x1999('0x2a')]({},_0x4b42a0,_0x188a76[_0x1999('0x3f')]);return db['ChatMessage'][_0x1999('0x23')]({'where':_0x4b42a0[_0x1999('0x98')]})[_0x1999('0x15')](function(_0x1a5422){_0x5bc1da[_0x1999('0x23')]=_0x1a5422;if(_0x188a76['query'][_0x1999('0x9d')]){_0x4b42a0[_0x1999('0x9e')]=[{'all':!![]}];}return db['ChatMessage'][_0x1999('0x9f')](_0x4b42a0);})['then'](function(_0x2c6216){_0x5bc1da[_0x1999('0xa0')]=_0x2c6216;return _0x5bc1da;});}})[_0x1999('0x15')](respondWithFilteredResult(_0x52e7b1,_0x4b42a0))[_0x1999('0x36')](handleError(_0x52e7b1,null));};exports[_0x1999('0xa1')]=function(_0x14d416,_0x135904){var _0x49167d={'where':{}},_0x550c23={},_0x2dc717={'count':0x0,'rows':[]};return db[_0x1999('0x39')]['findOne']({'where':{'id':_0x14d416['params']['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x135904,null))[_0x1999('0x15')](function(_0x592eaf){if(_0x592eaf){_0x550c23['model']=_['keys'](db[_0x1999('0x5a')][_0x1999('0x32')]);_0x550c23[_0x1999('0x35')]=_[_0x1999('0x38')](_0x14d416[_0x1999('0x35')]);_0x550c23['filters']=_[_0x1999('0x3b')](_0x550c23[_0x1999('0x3e')],_0x550c23[_0x1999('0x35')]);_0x49167d['attributes']=_['intersection'](_0x550c23[_0x1999('0x3e')],qs[_0x1999('0x3d')](_0x14d416['query'][_0x1999('0x3d')]));_0x49167d[_0x1999('0x3c')]=_0x49167d[_0x1999('0x3c')][_0x1999('0x7a')]?_0x49167d[_0x1999('0x3c')]:_0x550c23['model'];if(!_0x14d416[_0x1999('0x35')][_0x1999('0x94')](_0x1999('0xa2'))){_0x49167d[_0x1999('0x22')]=qs[_0x1999('0x22')](_0x14d416[_0x1999('0x35')][_0x1999('0x22')]);_0x49167d[_0x1999('0x95')]=qs[_0x1999('0x95')](_0x14d416[_0x1999('0x35')][_0x1999('0x95')]);}_0x49167d[_0x1999('0x96')]=qs[_0x1999('0x97')](_0x14d416[_0x1999('0x35')]['sort']);_0x49167d['where']=qs['filters'](_[_0x1999('0xa3')](_0x14d416[_0x1999('0x35')],_0x550c23[_0x1999('0x3a')]));_0x49167d[_0x1999('0x98')][_0x1999('0x99')]=_0x592eaf['id'];if(_0x14d416[_0x1999('0x35')][_0x1999('0x9a')]){_0x49167d[_0x1999('0x98')]=_['merge'](_0x49167d[_0x1999('0x98')],{'$or':_[_0x1999('0x31')](_0x49167d['attributes'],function(_0x1a7026){var _0x15d741={};_0x15d741[_0x1a7026]={'$like':'%'+_0x14d416['query'][_0x1999('0x9a')]+'%'};return _0x15d741;})});}_0x49167d[_0x1999('0x98')][_0x1999('0xa4')]=![];if(_0x14d416[_0x1999('0x35')]['id']){_0x49167d[_0x1999('0x98')]['id']={'$gt':_0x14d416[_0x1999('0x35')]['id']};}_0x49167d=_[_0x1999('0x2a')]({},_0x49167d,_0x14d416[_0x1999('0x3f')]);return db[_0x1999('0x5a')]['count']({'where':_0x49167d[_0x1999('0x98')]})[_0x1999('0x15')](function(_0x492094){_0x2dc717[_0x1999('0x23')]=_0x492094;_0x49167d[_0x1999('0x9e')]=[];if(_0x14d416[_0x1999('0x35')][_0x1999('0xa5')]){_0x49167d[_0x1999('0x9e')][_0x1999('0xa6')]({'model':db[_0x1999('0x77')],'as':_0x1999('0x77'),'attributes':['id',_0x1999('0x4e'),_0x1999('0x80')]});}if(_0x14d416[_0x1999('0x35')][_0x1999('0x9d')]){_0x49167d[_0x1999('0x9e')]=[{'all':!![]}];}return db[_0x1999('0x5a')][_0x1999('0x9f')](_0x49167d);})[_0x1999('0x15')](function(_0x57c61a){_0x2dc717[_0x1999('0xa0')]=_0x57c61a;return _0x2dc717;});}})[_0x1999('0x15')](respondWithFilteredResult(_0x135904,_0x49167d))[_0x1999('0x36')](handleError(_0x135904,null));};exports[_0x1999('0xa7')]=function(_0x3cce77,_0x5527c6){return db[_0x1999('0x39')]['find']({'where':{'id':_0x3cce77[_0x1999('0x42')]['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x5527c6,null))[_0x1999('0x15')](function(_0x3dcf3e){if(_0x3dcf3e){return _0x3dcf3e[_0x1999('0xa8')](_0x3cce77[_0x1999('0x2b')][_0x1999('0x91')],_[_0x1999('0x92')](_0x3cce77['body'],[_0x1999('0x91'),'id'])||{})[_0x1999('0xa9')](function(){return db[_0x1999('0xaa')][_0x1999('0x9f')]({'attributes':['id',_0x1999('0x29'),'color'],'where':{'id':_0x3cce77[_0x1999('0x2b')][_0x1999('0x91')]}});})[_0x1999('0x15')](function(_0x20e9d1){socket['emit'](_0x1999('0xab'),{'id':Number(_0x3cce77[_0x1999('0x42')]['id']),'tags':_0x20e9d1||[]});return{'id':Number(_0x3cce77[_0x1999('0x42')]['id']),'tags':_0x20e9d1||[]};});}})['then'](respondWithResult(_0x5527c6,null))[_0x1999('0x36')](handleError(_0x5527c6,null));};exports[_0x1999('0xac')]=function(_0x49d376,_0x589905){return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x49d376[_0x1999('0x42')]['id']}})[_0x1999('0x15')](handleEntityNotFound(_0x589905,null))[_0x1999('0x15')](function(_0x53f681){if(_0x53f681){return _0x53f681['removeTags'](_0x49d376[_0x1999('0x35')][_0x1999('0x91')]);}})[_0x1999('0x15')](respondWithStatusCode(_0x589905,null))[_0x1999('0x36')](handleError(_0x589905,null));};exports['download']=function(_0x491c26,_0x19ca94){var _0x289c59=moment()[_0x1999('0xad')]()['toString']();var _0x540664=path[_0x1999('0x70')](config[_0x1999('0x71')],_0x1999('0xae'),_0x1999('0xaf'),_0x1999('0xb0'));var _0x5084cf=path['join'](config['root'],_0x1999('0xae'),_0x1999('0xaf'),_0x1999('0xb1'));var _0x29579e=path[_0x1999('0x70')](_0x540664,_0x289c59);var _0x1e33c4=util[_0x1999('0x7b')](_0x1999('0xb2'),_0x491c26['params']['id'],_0x289c59);var _0x386033=path[_0x1999('0x70')](_0x540664,_0x1e33c4);var _0x566856=[];_0x566856[_0x1999('0xa6')]({'model':db[_0x1999('0x77')],'as':_0x1999('0x77'),'attributes':['id',_0x1999('0x4e')],'raw':!![]});_0x566856[_0x1999('0xa6')]({'model':db[_0x1999('0x5d')],'as':_0x1999('0x5e'),'attributes':['id',_0x1999('0xb3'),_0x1999('0xb4')],'raw':!![]});if(_0x491c26['query'][_0x1999('0xb1')]){_0x566856[_0x1999('0xa6')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3efdcb=[{'model':db[_0x1999('0x5a')],'as':_0x1999('0x79'),'attributes':['id',_0x1999('0x2b'),_0x1999('0x83'),'direction',_0x1999('0xa4'),_0x1999('0xb5')],'include':_0x566856}];_0x3efdcb[_0x1999('0xa6')]({'model':db[_0x1999('0x46')],'as':_0x1999('0xb6'),'attributes':['id',_0x1999('0x29')]});_0x3efdcb[_0x1999('0xa6')]({'model':db[_0x1999('0x77')],'as':_0x1999('0xb7'),'attributes':['id',_0x1999('0x4e')]});return db[_0x1999('0x39')][_0x1999('0x40')]({'where':{'id':_0x491c26[_0x1999('0x42')]['id']},'include':_0x3efdcb})['then'](handleEntityNotFound(_0x19ca94,null))['then'](function(_0x238416){if(_0x238416){var _0x7b170f=_0x238416['get']({'plain':!![]});fs['mkdirSync'](_0x29579e);var _0x4fd077={'channel':_0x1999('0xb8'),'account':_0x7b170f[_0x1999('0xb6')][_0x1999('0x29')],'agent':_0x7b170f['Owner']?_0x7b170f[_0x1999('0xb7')]['fullname']:_0x1999('0xb9'),'createdAt':moment(_0x7b170f[_0x1999('0x83')])[_0x1999('0x7b')](_0x1999('0xba'))[_0x1999('0xbb')](),'closedAt':_0x7b170f['closed']?moment(_0x7b170f[_0x1999('0xbc')])[_0x1999('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1999('0xbb')]():'','disposition':_0x7b170f[_0x1999('0x63')],'chatInfo':{'browser':_0x7b170f['browserName'],'os':_0x7b170f[_0x1999('0xbd')],'referer':_0x7b170f[_0x1999('0xbe')],'customerIp':_0x7b170f[_0x1999('0xbf')],'customerPort':_0x7b170f[_0x1999('0xc0')]?_0x7b170f['customerPort']:_0x1999('0xb9')},'messages':_(_0x7b170f[_0x1999('0x79')])[_0x1999('0xc1')]()[_0x1999('0x9a')]({'secret':![]})['map'](function(_0x53e62c){if(_0x53e62c['Attachment']){var _0x4b0fa8=path[_0x1999('0x70')](_0x5084cf,_0x53e62c[_0x1999('0x6b')][_0x1999('0x68')]);if(fs[_0x1999('0xc2')](_0x4b0fa8)){fs[_0x1999('0xc3')](_0x4b0fa8)['pipe'](fs[_0x1999('0xc4')](path[_0x1999('0x70')](_0x29579e,_0x53e62c[_0x1999('0x6b')]['basename'])));}}return{'date':moment(_0x53e62c[_0x1999('0x83')])[_0x1999('0x7b')](_0x1999('0xba'))[_0x1999('0xbb')](),'sender':_0x53e62c[_0x1999('0x85')]===_0x1999('0xc5')?_0x53e62c[_0x1999('0x77')]?_0x53e62c['User'][_0x1999('0x4e')]:_0x1999('0x7e'):_0x53e62c[_0x1999('0x5e')][_0x1999('0xb3')]+(_0x53e62c[_0x1999('0x5e')][_0x1999('0xb4')]?'\x20'+_0x53e62c[_0x1999('0x5e')]['lastName']:''),'body':_0x53e62c[_0x1999('0x6b')]?_0x53e62c[_0x1999('0x6b')]['basename']:_0x53e62c[_0x1999('0x2b')],'direction':_0x53e62c['direction']===_0x1999('0xc5')?'A':'C','secret':_0x53e62c[_0x1999('0xa4')],'read':_0x53e62c[_0x1999('0xb5')],'attachment':_0x53e62c[_0x1999('0x6b')]};})[_0x1999('0xc6')]()};return ejs[_0x1999('0xc7')](path[_0x1999('0x70')](config[_0x1999('0x71')],_0x1999('0xae'),_0x1999('0xc8'),_0x1999('0xc9')),{'interaction':_0x4fd077})['then'](function(_0x28c668){var _0x20b6c4=path[_0x1999('0x70')](_0x29579e,'transcript-'+_0x7b170f['id']+'-'+_0x289c59+_0x1999('0xca'));var _0x5d1172={'path':_0x20b6c4,'channel':_0x1999('0xb8'),'interactionId':_0x7b170f['id']};return pdf[_0x1999('0xcb')](_0x28c668,_0x5d1172);})['then'](function(){return new Promise(function(_0x3ea04,_0x4d64e7){zipdir(_0x29579e,{'saveTo':_0x386033},function(_0x2e5c26,_0x5c7707){if(_0x2e5c26)return _0x4d64e7(_0x2e5c26);return _0x3ea04(_0x5c7707);});})[_0x1999('0x15')](function(){return new BPromise(function(_0x33c3b7,_0x5bb82f){rimraf(_0x29579e,function(_0x56c7fa){if(_0x56c7fa)_0x5bb82f(_0x56c7fa);return _0x33c3b7();});});})[_0x1999('0x15')](function(){return _0x19ca94[_0x1999('0x73')](_0x386033,_0x1e33c4,function(_0x2a8b53){if(_0x2a8b53){logger[_0x1999('0x1b')](_0x1999('0xcc'),_0x2a8b53);}else{fs[_0x1999('0xcd')](_0x386033);}});});});}else{return _0x19ca94[_0x1999('0x1f')](0xc8);}})[_0x1999('0x36')](handleError(_0x19ca94,null));}; \ No newline at end of file +var _0xbc35=['mustache','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','stack','name','send','render','body','contact','agent','account','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','ChatInteraction','filters','intersection','attributes','fields','includeAll','include','merge','create','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','format','now','ChatMessage','User','Messages','length','%s%d','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','sort','pick','where','ChatInteractionId','filter','$gte','split','rows','order','secret','options','includeAgent','push','spread','Tag','color','emit','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','lastName','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird'];(function(_0x455680,_0x3891d0){var _0x19d21c=function(_0xa165ee){while(--_0xa165ee){_0x455680['push'](_0x455680['shift']());}};_0x19d21c(++_0x3891d0);}(_0xbc35,0xcf));var _0x5bc3=function(_0x1e6a67,_0x4be852){_0x1e6a67=_0x1e6a67-0x0;var _0xa3b117=_0xbc35[_0x1e6a67];return _0xa3b117;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5bc3('0x0'));var rp=require(_0x5bc3('0x1'));var moment=require(_0x5bc3('0x2'));var BPromise=require(_0x5bc3('0x3'));var Mustache=require(_0x5bc3('0x4'));var util=require(_0x5bc3('0x5'));var path=require('path');var ejs=require(_0x5bc3('0x6'));var fs=require('fs');var _=require(_0x5bc3('0x7'));var Redis=require(_0x5bc3('0x8'));var interaction=require(_0x5bc3('0x9'));var qs=require(_0x5bc3('0xa'));var pdf=require(_0x5bc3('0xb'));var logger=require(_0x5bc3('0xc'))(_0x5bc3('0xd'));var config=require(_0x5bc3('0xe'));var db=require(_0x5bc3('0xf'))['db'];config[_0x5bc3('0x10')]=_[_0x5bc3('0x11')](config[_0x5bc3('0x10')],{'host':_0x5bc3('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bc3('0x10')]));require('./chatInteraction.socket')[_0x5bc3('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5bc3('0x14')]['http']({'port':0x232b});var client9004=jayson[_0x5bc3('0x14')][_0x5bc3('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x5e5358,_0x34aee7,_0x118e55,_0x372559){return new BPromise(function(_0x1b977a,_0x2de31f){var _0x4b0405=_0x372559||client;return _0x4b0405['request'](_0x5e5358,_0x118e55)[_0x5bc3('0x16')](function(_0x37084f){logger['info'](_0x5bc3('0x17'),_0x34aee7,_0x5bc3('0x18'));logger[_0x5bc3('0x19')](_0x5bc3('0x1a'),_0x34aee7,_0x5bc3('0x18'),JSON[_0x5bc3('0x1b')](_0x37084f));if(_0x37084f[_0x5bc3('0x1c')]){if(_0x37084f[_0x5bc3('0x1c')][_0x5bc3('0x1d')]===0x1f4){logger[_0x5bc3('0x1c')](_0x5bc3('0x17'),_0x34aee7,_0x37084f[_0x5bc3('0x1c')]['message']);return _0x2de31f(_0x37084f[_0x5bc3('0x1c')][_0x5bc3('0x1e')]);}logger['error'](_0x5bc3('0x17'),_0x34aee7,_0x37084f['error'][_0x5bc3('0x1e')]);return _0x1b977a(_0x37084f[_0x5bc3('0x1c')][_0x5bc3('0x1e')]);}else{logger[_0x5bc3('0x1f')](_0x5bc3('0x17'),_0x34aee7,_0x5bc3('0x18'));_0x1b977a(_0x37084f[_0x5bc3('0x20')]['message']);}})[_0x5bc3('0x21')](function(_0x55c7fe){logger['error'](_0x5bc3('0x17'),_0x34aee7,_0x55c7fe);_0x2de31f(_0x55c7fe);});});}function respondWithStatusCode(_0x20c564,_0x41404c){_0x41404c=_0x41404c||0xcc;return function(_0x267628){if(_0x267628){return _0x20c564[_0x5bc3('0x22')](_0x41404c);}return _0x20c564[_0x5bc3('0x23')](_0x41404c)[_0x5bc3('0x24')]();};}function respondWithResult(_0x79a15b,_0x5b3fe4){_0x5b3fe4=_0x5b3fe4||0xc8;return function(_0x5c6da8){if(_0x5c6da8){return _0x79a15b[_0x5bc3('0x23')](_0x5b3fe4)['json'](_0x5c6da8);}};}function respondWithFilteredResult(_0x52c6ee,_0x545ff8){return function(_0x43d7d3){if(_0x43d7d3){var _0x560bb8=typeof _0x545ff8[_0x5bc3('0x25')]===_0x5bc3('0x26')&&typeof _0x545ff8[_0x5bc3('0x27')]==='undefined';var _0x11197a=_0x43d7d3[_0x5bc3('0x28')];var _0x1e0722=_0x560bb8?0x0:_0x545ff8['offset'];var _0x58fef8=_0x560bb8?_0x43d7d3['count']:_0x545ff8[_0x5bc3('0x25')]+_0x545ff8['limit'];var _0x1551de;if(_0x58fef8>=_0x11197a){_0x58fef8=_0x11197a;_0x1551de=0xc8;}else{_0x1551de=0xce;}_0x52c6ee[_0x5bc3('0x23')](_0x1551de);return _0x52c6ee[_0x5bc3('0x29')](_0x5bc3('0x2a'),_0x1e0722+'-'+_0x58fef8+'/'+_0x11197a)[_0x5bc3('0x2b')](_0x43d7d3);}return null;};}function saveUpdates(_0x3b12fe){return function(_0x25f23b){if(_0x25f23b){return _0x25f23b[_0x5bc3('0x2c')](_0x3b12fe)[_0x5bc3('0x16')](function(_0x5043e9){return _0x5043e9;});}return null;};}function removeEntity(_0x4abd7c){return function(_0x4f83ed){if(_0x4f83ed){return _0x4f83ed['destroy']()['then'](function(){_0x4abd7c['status'](0xcc)[_0x5bc3('0x24')]();});}};}function handleEntityNotFound(_0x5df249){return function(_0x48dbd2){if(!_0x48dbd2){_0x5df249[_0x5bc3('0x22')](0x194);}return _0x48dbd2;};}function handleError(_0x1cf5fb,_0x58e9e8){_0x58e9e8=_0x58e9e8||0x1f4;return function(_0xa5d020){logger[_0x5bc3('0x1c')](_0xa5d020[_0x5bc3('0x2d')]);if(_0xa5d020[_0x5bc3('0x2e')]){delete _0xa5d020['name'];}_0x1cf5fb['status'](_0x58e9e8)[_0x5bc3('0x2f')](_0xa5d020);};}function getMustacheRender(_0x1374b,_0x3aab00){return Mustache[_0x5bc3('0x30')](_0x1374b,_['merge'](_0x3aab00[_0x5bc3('0x31')],{'contact':_0x3aab00[_0x5bc3('0x32')],'message':_0x3aab00[_0x5bc3('0x1e')],'agent':_0x3aab00[_0x5bc3('0x33')],'interaction':_0x3aab00['interaction'],'account':_0x3aab00[_0x5bc3('0x34')]}))||'';}exports[_0x5bc3('0x35')]=function(_0x47ef53,_0x377736){var _0x35d171={};var _0x1a0ca8=_[_0x5bc3('0x36')](db['ChatInteraction'][_0x5bc3('0x37')],function(_0xe897f1){return{'name':_0xe897f1[_0x5bc3('0x38')],'type':_0xe897f1[_0x5bc3('0x39')][_0x5bc3('0x3a')]};});_0x35d171=qs[_0x5bc3('0x3b')](_0x1a0ca8,_0x47ef53);return interaction[_0x5bc3('0x3c')](_0x5bc3('0x3d'),_0x47ef53[_0x5bc3('0x3e')],_0x47ef53[_0x5bc3('0x3f')],_0x35d171,_0x1a0ca8)[_0x5bc3('0x16')](respondWithFilteredResult(_0x377736,_0x35d171))[_0x5bc3('0x21')](handleError(_0x377736,null));};exports[_0x5bc3('0x40')]=function(_0x569bc3,_0x5385c8){var _0x191a3f={'raw':![],'where':{'id':_0x569bc3[_0x5bc3('0x41')]['id']}},_0xe62f54={};_0xe62f54[_0x5bc3('0x42')]=_[_0x5bc3('0x43')](db[_0x5bc3('0x44')][_0x5bc3('0x37')]);_0xe62f54['query']=_[_0x5bc3('0x43')](_0x569bc3[_0x5bc3('0x3e')]);_0xe62f54[_0x5bc3('0x45')]=_[_0x5bc3('0x46')](_0xe62f54[_0x5bc3('0x42')],_0xe62f54[_0x5bc3('0x3e')]);_0x191a3f[_0x5bc3('0x47')]=_[_0x5bc3('0x46')](_0xe62f54[_0x5bc3('0x42')],qs[_0x5bc3('0x48')](_0x569bc3[_0x5bc3('0x3e')][_0x5bc3('0x48')]));_0x191a3f[_0x5bc3('0x47')]=_0x191a3f[_0x5bc3('0x47')]['length']?_0x191a3f[_0x5bc3('0x47')]:_0xe62f54[_0x5bc3('0x42')];if(_0x569bc3[_0x5bc3('0x3e')][_0x5bc3('0x49')]){_0x191a3f[_0x5bc3('0x4a')]=[{'all':!![]}];}_0x191a3f=_[_0x5bc3('0x4b')]({},_0x191a3f,_0x569bc3['options']);return db['ChatInteraction']['find'](_0x191a3f)[_0x5bc3('0x16')](handleEntityNotFound(_0x5385c8,null))['then'](respondWithResult(_0x5385c8,null))['catch'](handleError(_0x5385c8,null));};exports[_0x5bc3('0x4c')]=function(_0x502343,_0x2496a8){return db['ChatInteraction'][_0x5bc3('0x4c')](_0x502343[_0x5bc3('0x31')],{})['then'](respondWithResult(_0x2496a8,0xc9))[_0x5bc3('0x21')](handleError(_0x2496a8,null));};exports[_0x5bc3('0x2c')]=function(_0x184ab5,_0x43da9d){if(_0x184ab5[_0x5bc3('0x31')]['id']){delete _0x184ab5[_0x5bc3('0x31')]['id'];}return db[_0x5bc3('0x44')][_0x5bc3('0x4d')]({'where':{'id':_0x184ab5['params']['id']}})[_0x5bc3('0x16')](handleEntityNotFound(_0x43da9d,null))[_0x5bc3('0x16')](saveUpdates(_0x184ab5['body'],null))['then'](respondWithResult(_0x43da9d,null))[_0x5bc3('0x21')](handleError(_0x43da9d,null));};exports[_0x5bc3('0x4e')]=function(_0x50d88d,_0x478781){return db[_0x5bc3('0x44')][_0x5bc3('0x4d')]({'where':{'id':_0x50d88d[_0x5bc3('0x41')]['id']}})[_0x5bc3('0x16')](handleEntityNotFound(_0x478781,null))[_0x5bc3('0x16')](removeEntity(_0x478781,null))[_0x5bc3('0x21')](handleError(_0x478781,null));};exports[_0x5bc3('0x4f')]=function(_0x5bccd9,_0x3da5c1){return db[_0x5bc3('0x44')]['describe']()['then'](respondWithResult(_0x3da5c1,null))[_0x5bc3('0x21')](handleError(_0x3da5c1,null));};exports[_0x5bc3('0x50')]=function(_0x4cbca0,_0x145349){var _0x51cdb0=_0x4cbca0[_0x5bc3('0x41')]['id'];var _0x494b45;var _0x37f104;var _0x3c3c19;return db[_0x5bc3('0x44')][_0x5bc3('0x51')]({'where':{'id':_0x51cdb0}})[_0x5bc3('0x16')](function(_0x266db0){_0x494b45=_0x266db0;return db[_0x5bc3('0x52')][_0x5bc3('0x51')]({'where':{'id':_0x266db0[_0x5bc3('0x53')]},'attributes':['id',_0x5bc3('0x54'),_0x5bc3('0x55'),_0x5bc3('0x56'),_0x5bc3('0x57'),_0x5bc3('0x58')],'raw':!![]});})[_0x5bc3('0x16')](function(_0x5ddcf0){if(_0x5ddcf0&&_0x5ddcf0[_0x5bc3('0x54')]&&_0x5ddcf0[_0x5bc3('0x55')]){_0x37f104=_0x5ddcf0;var _0x204104={'interaction':{'id':_0x51cdb0},'agent':{'id':_0x4cbca0[_0x5bc3('0x3f')]['id'],'name':_0x4cbca0[_0x5bc3('0x3f')][_0x5bc3('0x2e')],'fullname':_0x4cbca0['user'][_0x5bc3('0x59')],'email':_0x4cbca0[_0x5bc3('0x3f')][_0x5bc3('0x5a')]},'contact':_0x4cbca0[_0x5bc3('0x31')][_0x5bc3('0x32')],'account':_0x4cbca0[_0x5bc3('0x31')][_0x5bc3('0x34')]};var _0x4b48d0={'rejectUnauthorized':![],'method':'POST','url':_0x5bc3('0x5b'),'headers':{'X-APIKEY':_0x5ddcf0[_0x5bc3('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4cbca0[_0x5bc3('0x3f')][_0x5bc3('0x5a')]],'buttons':null,'topic':_0x37f104['vidaooTopic'],'note':_['isNull'](_0x37f104[_0x5bc3('0x57')])?null:getMustacheRender(_0x37f104[_0x5bc3('0x57')],_0x204104),'metadata':null},'redirect':_0x5bc3('0x5c'),'json':!![]};try{if(!_[_0x5bc3('0x5d')](_0x37f104[_0x5bc3('0x58')])){var _0x444dfa=getMustacheRender(_0x37f104['vidaooMetadata'],_0x204104);var _0x57e243=JSON[_0x5bc3('0x5e')](_0x444dfa);_0x4b48d0[_0x5bc3('0x31')][_0x5bc3('0x5f')]=_0x57e243;}}catch(_0x2e3cf7){throw new db[(_0x5bc3('0x60'))][(_0x5bc3('0x61'))](_0x5bc3('0x62'));}return rp(_0x4b48d0);}else{throw new db[(_0x5bc3('0x60'))][(_0x5bc3('0x61'))](_0x5bc3('0x63'));}})[_0x5bc3('0x16')](function(_0x2a7129){_0x3c3c19=_0x2a7129;if(_0x3c3c19['id']){var _0x3da594={'body':_0x3c3c19[_0x5bc3('0x64')],'ChatWebsiteId':_0x37f104['id'],'ChatInteractionId':_0x494b45['id'],'direction':_0x5bc3('0x65'),'UserId':_0x4cbca0['user']['id']};return db['ChatMessage'][_0x5bc3('0x4c')](_0x3da594,{});}else{throw new db[(_0x5bc3('0x60'))][(_0x5bc3('0x61'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x5bc3('0x16')](function(){return _0x494b45[_0x5bc3('0x66')]({'vidaooSessionId':_0x3c3c19['id']});})['then'](respondWithResult(_0x145349,null))[_0x5bc3('0x21')](handleError(_0x145349,null));};exports[_0x5bc3('0x67')]=function(_0xdc2ef1,_0x6e0eeb){if(_0xdc2ef1['body']['id']){delete _0xdc2ef1[_0x5bc3('0x31')]['id'];}return db[_0x5bc3('0x44')]['find']({'where':{'id':_0xdc2ef1[_0x5bc3('0x41')]['id']},'include':[{'model':db[_0x5bc3('0x68')],'as':_0x5bc3('0x69')}]})[_0x5bc3('0x16')](handleEntityNotFound(_0x6e0eeb,null))['then'](saveUpdates(_0xdc2ef1['body'],null))['then'](respondWithResult(_0x6e0eeb,null))[_0x5bc3('0x21')](handleError(_0x6e0eeb,null));};exports['abandon']=function(_0x3aaa51,_0x13cd60){if(_0x3aaa51[_0x5bc3('0x31')]['id']){delete _0x3aaa51['body']['id'];}return db[_0x5bc3('0x44')]['find']({'where':{'id':_0x3aaa51[_0x5bc3('0x41')]['id']}})[_0x5bc3('0x16')](function(_0x562992){if(!_0x562992){logger[_0x5bc3('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x5bc3('0x6a'),0x194,_0x5bc3('0x6b'));_0x13cd60[_0x5bc3('0x22')](0x194);}else{if(_0x562992[_0x5bc3('0x6c')]){throw new db['Sequelize'][(_0x5bc3('0x61'))]('Interaction\x20already\x20assigned');}}return _0x562992;})[_0x5bc3('0x16')](function(_0x36876c){if(_0x36876c){return _0x36876c[_0x5bc3('0x2c')]({'closed':_0x3aaa51[_0x5bc3('0x31')][_0x5bc3('0x6d')],'disposition':_0x3aaa51[_0x5bc3('0x31')][_0x5bc3('0x6e')]})['then'](function(_0xf489e8){return _0xf489e8;});}})[_0x5bc3('0x16')](function(){return respondWithRpcPromise(_0x5bc3('0x6f'),'abandon',_0x3aaa51[_0x5bc3('0x31')],client9004);})[_0x5bc3('0x16')](respondWithResult(_0x13cd60,null))[_0x5bc3('0x21')](handleError(_0x13cd60,null));};exports[_0x5bc3('0x70')]=function(_0x57fb95,_0x4e7c8f){_0x57fb95[_0x5bc3('0x31')][_0x5bc3('0x2e')]=_0x57fb95['file'][_0x5bc3('0x71')];_0x57fb95[_0x5bc3('0x31')][_0x5bc3('0x72')]=_0x57fb95['file']['filename'];_0x57fb95['body'][_0x5bc3('0x39')]=_0x57fb95[_0x5bc3('0x73')][_0x5bc3('0x74')];return db[_0x5bc3('0x75')][_0x5bc3('0x4c')](_0x57fb95[_0x5bc3('0x31')])[_0x5bc3('0x16')](respondWithResult(_0x4e7c8f,0xc9))[_0x5bc3('0x21')](handleError(_0x4e7c8f,null));};exports[_0x5bc3('0x76')]=function(_0x5bfb77,_0x302966){return db[_0x5bc3('0x44')][_0x5bc3('0x51')]({'where':{'id':_0x5bfb77[_0x5bc3('0x41')]['id']},'raw':!![]})[_0x5bc3('0x16')](handleEntityNotFound(_0x302966,null))[_0x5bc3('0x16')](function(_0x3a7523){if(_0x3a7523){if(_0x3a7523['closed']){return _0x302966[_0x5bc3('0x23')](0x193)[_0x5bc3('0x2b')]({'status':0x193,'message':_0x5bc3('0x77')});}return db['Attachment']['findOne']({'where':{'id':_0x5bfb77['query'][_0x5bc3('0x78')]},'raw':!![]})[_0x5bc3('0x16')](handleEntityNotFound(_0x302966,null));}})['then'](function(_0x4dd5f9){if(_0x4dd5f9){var _0x2af31f=_0x4dd5f9[_0x5bc3('0x79')]!==null;var _0xff2013=path[_0x5bc3('0x7a')](config[_0x5bc3('0x7b')],_0x5bc3('0x7c'));if(_0x2af31f){_0xff2013=path['join'](_0xff2013,'offline-chat/');}var _0xb7e64a=path[_0x5bc3('0x7a')](_0xff2013,_0x4dd5f9[_0x5bc3('0x72')]);return _0x302966[_0x5bc3('0x7d')](_0xb7e64a);}})[_0x5bc3('0x21')](handleError(_0x302966,null));};exports[_0x5bc3('0x7e')]=function(_0x57ddfa,_0x5a0871){var _0x48b194=null;var _0x17df23=null;var _0x3c367a=null;if(_0x57ddfa['body']['id']){delete _0x57ddfa[_0x5bc3('0x31')]['id'];}if(_0x57ddfa['body'][_0x5bc3('0x7f')]){_0x3c367a=path[_0x5bc3('0x7a')](config[_0x5bc3('0x7b')],_0x5bc3('0x80'),util[_0x5bc3('0x81')]('transcript-%s.txt',Date[_0x5bc3('0x82')]()));_0x57ddfa['body']['pathTranscript']=_0x3c367a;}return db[_0x5bc3('0x44')]['find']({'where':{'id':_0x57ddfa[_0x5bc3('0x41')]['id']},'include':[{'model':db[_0x5bc3('0x83')],'as':'Messages','include':[{'model':db[_0x5bc3('0x84')],'as':_0x5bc3('0x84')}]}]})[_0x5bc3('0x16')](handleEntityNotFound(_0x5a0871,null))[_0x5bc3('0x16')](saveUpdates(_0x57ddfa[_0x5bc3('0x31')],null))[_0x5bc3('0x16')](function(_0x381fdd){if(_0x381fdd){_0x48b194=_0x381fdd;return db[_0x5bc3('0x52')]['find']({'where':{'id':_0x48b194[_0x5bc3('0x53')]}});}})[_0x5bc3('0x16')](function(_0x5319b6){if(_0x5319b6){_0x17df23=_0x5319b6;return db['CmContact'][_0x5bc3('0x4d')]({'where':{'id':_0x48b194['ContactId']}});}})[_0x5bc3('0x16')](function(_0x534db5){if(_0x534db5){if(_0x3c367a){var _0x1af338=null;for(var _0x395a71=0x1;_0x395a71<_0x48b194[_0x5bc3('0x85')][_0x5bc3('0x86')];++_0x395a71){_0x1af338=_0x48b194['Messages'][_0x395a71];var _0x8c3d79=_0x1af338[_0x5bc3('0x6c')]?util['format'](_0x5bc3('0x87'),_0x17df23['agentAlias'],_0x1af338[_0x5bc3('0x6c')]):'System';var _0xe7b331=_0x57ddfa[_0x5bc3('0x31')][_0x5bc3('0x88')]||util['format'](_0x5bc3('0x87'),_0x5bc3('0x89'),_0x1af338['ContactId']);switch(_0x17df23[_0x5bc3('0x8a')]){case _0x5bc3('0x8b'):_0x8c3d79=_0x1af338[_0x5bc3('0x6c')]?util['format']('%s%d',_0x17df23[_0x5bc3('0x8c')],_0x1af338[_0x5bc3('0x6c')]):'System';break;case _0x5bc3('0x8d'):_0x8c3d79=_0x1af338['UserId']?_0x1af338[_0x5bc3('0x84')]['alias']||_0x1af338[_0x5bc3('0x84')]['fullname']:_0x5bc3('0x8e');break;case _0x5bc3('0x8f'):_0x8c3d79=_0x1af338[_0x5bc3('0x6c')]?_0x1af338['User'][_0x5bc3('0x59')]:_0x5bc3('0x8e');break;default:_0x8c3d79=_0x1af338[_0x5bc3('0x6c')]?util[_0x5bc3('0x81')]('%s%d',_0x17df23[_0x5bc3('0x8c')],_0x1af338[_0x5bc3('0x6c')]):_0x5bc3('0x8e');}var _0x147adf=util[_0x5bc3('0x81')](_0x5bc3('0x90'),moment(_0x1af338[_0x5bc3('0x91')])[_0x5bc3('0x81')](_0x5bc3('0x92')),_0x1af338[_0x5bc3('0x93')]==='in'?_0xe7b331:_0x8c3d79,_0x1af338[_0x5bc3('0x31')]);if(!_0x1af338['secret']){fs[_0x5bc3('0x94')](_0x3c367a,_0x147adf);}}return db[_0x5bc3('0x95')][_0x5bc3('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0x5bc3('0x96')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5bc3('0x97'),'raw':!![]}]}]});}}})[_0x5bc3('0x16')](function(_0x145f18){if(!_0x145f18||!_0x145f18[_0x5bc3('0x98')]||!_0x57ddfa[_0x5bc3('0x31')])return _0x48b194;var _0x2e2569=_0x145f18[_0x5bc3('0x99')]();return respondWithRpcPromise(_0x5bc3('0x9a'),'sendMail',{'account':_0x2e2569,'message':{'from':util[_0x5bc3('0x81')]('\x22%s\x22\x20<%s>',_0x145f18['name'],_0x145f18[_0x5bc3('0x5a')]||_0x145f18[_0x5bc3('0x98')][_0x5bc3('0x3f')]),'to':_0x57ddfa[_0x5bc3('0x31')]['mailTranscript'],'subject':_0x5bc3('0x9b'),'text':util[_0x5bc3('0x81')](_0x5bc3('0x9c'),_0x57ddfa['body'][_0x5bc3('0x7f')]),'attachments':[{'path':_0x3c367a}]}})[_0x5bc3('0x16')](function(){return _0x48b194;})[_0x5bc3('0x21')](function(_0x36743c){logger[_0x5bc3('0x1c')](_0x36743c);});})[_0x5bc3('0x16')](respondWithStatusCode(_0x5a0871,0xc8))['catch'](handleError(_0x5a0871,null));};exports[_0x5bc3('0x9d')]=function(_0xd291ef,_0x1bb028){return db['ChatMessage'][_0x5bc3('0x4d')]({'where':{'id':_0xd291ef[_0x5bc3('0x41')]['id']}})[_0x5bc3('0x16')](handleEntityNotFound(_0x1bb028,null))[_0x5bc3('0x16')](function(_0x36166e){if(_0x36166e){return _0x36166e['addMessage'](_0xd291ef['body'][_0x5bc3('0x9e')],_[_0x5bc3('0x9f')](_0xd291ef[_0x5bc3('0x31')],[_0x5bc3('0x9e'),'id'])||{});}})[_0x5bc3('0x16')](respondWithResult(_0x1bb028,null))['catch'](handleError(_0x1bb028,null));};exports[_0x5bc3('0xa0')]=function(_0x3f47c4,_0x3b3f83){var _0x512a23={'raw':![],'where':{}};var _0x3f6704={};var _0x34d6a2={'count':0x0,'rows':[]};return db[_0x5bc3('0x44')][_0x5bc3('0x51')]({'where':{'id':_0x3f47c4[_0x5bc3('0x41')]['id']}})[_0x5bc3('0x16')](handleEntityNotFound(_0x3b3f83,null))[_0x5bc3('0x16')](function(_0x354515){if(_0x354515){_0x3f6704['model']=_[_0x5bc3('0x43')](db[_0x5bc3('0x83')]['rawAttributes']);_0x3f6704[_0x5bc3('0x3e')]=_[_0x5bc3('0x43')](_0x3f47c4[_0x5bc3('0x3e')]);_0x3f6704[_0x5bc3('0x45')]=_[_0x5bc3('0x46')](_0x3f6704[_0x5bc3('0x42')],_0x3f6704[_0x5bc3('0x3e')]);_0x512a23[_0x5bc3('0x47')]=_[_0x5bc3('0x46')](_0x3f6704[_0x5bc3('0x42')],qs[_0x5bc3('0x48')](_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0x48')]));_0x512a23[_0x5bc3('0x47')]=_0x512a23[_0x5bc3('0x47')][_0x5bc3('0x86')]?_0x512a23['attributes']:_0x3f6704['model'];if(!_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0xa1')]('nolimit')){_0x512a23[_0x5bc3('0x27')]=qs[_0x5bc3('0x27')](_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0x27')]);_0x512a23['offset']=qs[_0x5bc3('0x25')](_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0x25')]);}_0x512a23['order']=qs['sort'](_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0xa2')]);_0x512a23['where']=qs[_0x5bc3('0x45')](_[_0x5bc3('0xa3')](_0x3f47c4[_0x5bc3('0x3e')],_0x3f6704[_0x5bc3('0x45')]));_0x512a23[_0x5bc3('0xa4')][_0x5bc3('0xa5')]=_0x354515['id'];if(_0x3f47c4['query'][_0x5bc3('0xa6')]){_0x512a23[_0x5bc3('0xa4')]=_[_0x5bc3('0x4b')](_0x512a23[_0x5bc3('0xa4')],{'$or':_[_0x5bc3('0x36')](_0x512a23[_0x5bc3('0x47')],function(_0x4d3bbf){var _0x55fdd8={};_0x55fdd8[_0x4d3bbf]={'$like':'%'+_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0xa6')]+'%'};return _0x55fdd8;})});}if(_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0xa7')]){var _0x3a0eeb=_0x3f47c4['query']['$gte'][_0x5bc3('0xa8')](',');var _0x5b1353={};_0x5b1353[_0x3a0eeb[0x0]]={'$gte':moment(_0x3a0eeb[0x1])[_0x5bc3('0x81')]('YYYY-MM-DD\x20HH:mm:ss')};_0x512a23[_0x5bc3('0xa4')]=_['merge'](_0x512a23[_0x5bc3('0xa4')],_0x5b1353);}_0x512a23=_[_0x5bc3('0x4b')]({},_0x512a23,_0x3f47c4['options']);return db[_0x5bc3('0x83')]['count']({'where':_0x512a23[_0x5bc3('0xa4')]})['then'](function(_0x1265a4){_0x34d6a2[_0x5bc3('0x28')]=_0x1265a4;if(_0x3f47c4[_0x5bc3('0x3e')][_0x5bc3('0x49')]){_0x512a23[_0x5bc3('0x4a')]=[{'all':!![]}];}return db[_0x5bc3('0x83')][_0x5bc3('0x3c')](_0x512a23);})[_0x5bc3('0x16')](function(_0x4819f6){_0x34d6a2[_0x5bc3('0xa9')]=_0x4819f6;return _0x34d6a2;});}})[_0x5bc3('0x16')](respondWithFilteredResult(_0x3b3f83,_0x512a23))[_0x5bc3('0x21')](handleError(_0x3b3f83,null));};exports['getMyMessages']=function(_0x233c70,_0x769003){var _0x478b3={'where':{}},_0x5e0b38={},_0x3f6b2c={'count':0x0,'rows':[]};return db[_0x5bc3('0x44')][_0x5bc3('0x51')]({'where':{'id':_0x233c70[_0x5bc3('0x41')]['id']}})[_0x5bc3('0x16')](handleEntityNotFound(_0x769003,null))[_0x5bc3('0x16')](function(_0x1c125a){if(_0x1c125a){_0x5e0b38[_0x5bc3('0x42')]=_[_0x5bc3('0x43')](db['ChatMessage'][_0x5bc3('0x37')]);_0x5e0b38[_0x5bc3('0x3e')]=_[_0x5bc3('0x43')](_0x233c70[_0x5bc3('0x3e')]);_0x5e0b38[_0x5bc3('0x45')]=_[_0x5bc3('0x46')](_0x5e0b38['model'],_0x5e0b38[_0x5bc3('0x3e')]);_0x478b3[_0x5bc3('0x47')]=_[_0x5bc3('0x46')](_0x5e0b38[_0x5bc3('0x42')],qs[_0x5bc3('0x48')](_0x233c70[_0x5bc3('0x3e')]['fields']));_0x478b3[_0x5bc3('0x47')]=_0x478b3[_0x5bc3('0x47')][_0x5bc3('0x86')]?_0x478b3[_0x5bc3('0x47')]:_0x5e0b38[_0x5bc3('0x42')];if(!_0x233c70[_0x5bc3('0x3e')][_0x5bc3('0xa1')]('nolimit')){_0x478b3[_0x5bc3('0x27')]=qs[_0x5bc3('0x27')](_0x233c70[_0x5bc3('0x3e')][_0x5bc3('0x27')]);_0x478b3['offset']=qs[_0x5bc3('0x25')](_0x233c70[_0x5bc3('0x3e')][_0x5bc3('0x25')]);}_0x478b3[_0x5bc3('0xaa')]=qs[_0x5bc3('0xa2')](_0x233c70[_0x5bc3('0x3e')][_0x5bc3('0xa2')]);_0x478b3[_0x5bc3('0xa4')]=qs[_0x5bc3('0x45')](_[_0x5bc3('0xa3')](_0x233c70[_0x5bc3('0x3e')],_0x5e0b38[_0x5bc3('0x45')]));_0x478b3[_0x5bc3('0xa4')][_0x5bc3('0xa5')]=_0x1c125a['id'];if(_0x233c70[_0x5bc3('0x3e')]['filter']){_0x478b3[_0x5bc3('0xa4')]=_[_0x5bc3('0x4b')](_0x478b3['where'],{'$or':_[_0x5bc3('0x36')](_0x478b3[_0x5bc3('0x47')],function(_0x148e79){var _0x555106={};_0x555106[_0x148e79]={'$like':'%'+_0x233c70[_0x5bc3('0x3e')][_0x5bc3('0xa6')]+'%'};return _0x555106;})});}_0x478b3['where'][_0x5bc3('0xab')]=![];if(_0x233c70[_0x5bc3('0x3e')]['id']){_0x478b3[_0x5bc3('0xa4')]['id']={'$gt':_0x233c70[_0x5bc3('0x3e')]['id']};}_0x478b3=_[_0x5bc3('0x4b')]({},_0x478b3,_0x233c70[_0x5bc3('0xac')]);return db[_0x5bc3('0x83')][_0x5bc3('0x28')]({'where':_0x478b3[_0x5bc3('0xa4')]})[_0x5bc3('0x16')](function(_0x4f9fb0){_0x3f6b2c[_0x5bc3('0x28')]=_0x4f9fb0;_0x478b3['include']=[];if(_0x233c70[_0x5bc3('0x3e')][_0x5bc3('0xad')]){_0x478b3[_0x5bc3('0x4a')][_0x5bc3('0xae')]({'model':db['User'],'as':'User','attributes':['id',_0x5bc3('0x59'),'alias']});}if(_0x233c70['query'][_0x5bc3('0x49')]){_0x478b3[_0x5bc3('0x4a')]=[{'all':!![]}];}return db['ChatMessage'][_0x5bc3('0x3c')](_0x478b3);})[_0x5bc3('0x16')](function(_0x54fda7){_0x3f6b2c['rows']=_0x54fda7;return _0x3f6b2c;});}})[_0x5bc3('0x16')](respondWithFilteredResult(_0x769003,_0x478b3))[_0x5bc3('0x21')](handleError(_0x769003,null));};exports['addTags']=function(_0xe48fd6,_0x2ff4d6){return db['ChatInteraction']['find']({'where':{'id':_0xe48fd6[_0x5bc3('0x41')]['id']}})[_0x5bc3('0x16')](handleEntityNotFound(_0x2ff4d6,null))['then'](function(_0x1fb9c7){if(_0x1fb9c7){return _0x1fb9c7['setTags'](_0xe48fd6[_0x5bc3('0x31')][_0x5bc3('0x9e')],_['omit'](_0xe48fd6[_0x5bc3('0x31')],[_0x5bc3('0x9e'),'id'])||{})[_0x5bc3('0xaf')](function(){return db[_0x5bc3('0xb0')][_0x5bc3('0x3c')]({'attributes':['id',_0x5bc3('0x2e'),_0x5bc3('0xb1')],'where':{'id':_0xe48fd6['body'][_0x5bc3('0x9e')]}});})[_0x5bc3('0x16')](function(_0x2970db){socket[_0x5bc3('0xb2')]('chatInteractionTags:save',{'id':Number(_0xe48fd6[_0x5bc3('0x41')]['id']),'tags':_0x2970db||[]});return{'id':Number(_0xe48fd6['params']['id']),'tags':_0x2970db||[]};});}})[_0x5bc3('0x16')](respondWithResult(_0x2ff4d6,null))['catch'](handleError(_0x2ff4d6,null));};exports[_0x5bc3('0xb3')]=function(_0x5554d0,_0x431cca){return db[_0x5bc3('0x44')]['find']({'where':{'id':_0x5554d0[_0x5bc3('0x41')]['id']}})[_0x5bc3('0x16')](handleEntityNotFound(_0x431cca,null))[_0x5bc3('0x16')](function(_0x59276f){if(_0x59276f){return _0x59276f['removeTags'](_0x5554d0[_0x5bc3('0x3e')][_0x5bc3('0x9e')]);}})[_0x5bc3('0x16')](respondWithStatusCode(_0x431cca,null))[_0x5bc3('0x21')](handleError(_0x431cca,null));};exports['download']=function(_0x30b7fd,_0x5b60e2){var _0x310dcb=moment()[_0x5bc3('0xb4')]()['toString']();var _0x4bf5fa=path[_0x5bc3('0x7a')](config[_0x5bc3('0x7b')],_0x5bc3('0xb5'),_0x5bc3('0xb6'),'tmp');var _0x4f1c0b=path[_0x5bc3('0x7a')](config['root'],_0x5bc3('0xb5'),_0x5bc3('0xb6'),_0x5bc3('0xb7'));var _0x2bdf1d=path[_0x5bc3('0x7a')](_0x4bf5fa,_0x310dcb);var _0x51942f=util['format'](_0x5bc3('0xb8'),_0x30b7fd[_0x5bc3('0x41')]['id'],_0x310dcb);var _0xb43db=path['join'](_0x4bf5fa,_0x51942f);var _0x1f1813=[];_0x1f1813[_0x5bc3('0xae')]({'model':db['User'],'as':_0x5bc3('0x84'),'attributes':['id',_0x5bc3('0x59')],'raw':!![]});_0x1f1813[_0x5bc3('0xae')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x5bc3('0xb9')],'raw':!![]});if(_0x30b7fd[_0x5bc3('0x3e')][_0x5bc3('0xb7')]){_0x1f1813['push']({'model':db[_0x5bc3('0x75')],'as':_0x5bc3('0x75'),'raw':!![]});}var _0x456f7e=[{'model':db[_0x5bc3('0x83')],'as':'Messages','attributes':['id','body','createdAt',_0x5bc3('0x93'),_0x5bc3('0xab'),_0x5bc3('0xba')],'include':_0x1f1813}];_0x456f7e['push']({'model':db[_0x5bc3('0x52')],'as':_0x5bc3('0xbb'),'attributes':['id','name']});_0x456f7e[_0x5bc3('0xae')]({'model':db['User'],'as':_0x5bc3('0xbc'),'attributes':['id',_0x5bc3('0x59')]});return db['ChatInteraction'][_0x5bc3('0x4d')]({'where':{'id':_0x30b7fd[_0x5bc3('0x41')]['id']},'include':_0x456f7e})[_0x5bc3('0x16')](handleEntityNotFound(_0x5b60e2,null))[_0x5bc3('0x16')](function(_0x2e6f06){if(_0x2e6f06){var _0x706455=_0x2e6f06['get']({'plain':!![]});fs['mkdirSync'](_0x2bdf1d);var _0x25ef9e={'channel':_0x5bc3('0xbd'),'account':_0x706455[_0x5bc3('0xbb')][_0x5bc3('0x2e')],'agent':_0x706455[_0x5bc3('0xbc')]?_0x706455[_0x5bc3('0xbc')][_0x5bc3('0x59')]:_0x5bc3('0xbe'),'createdAt':moment(_0x706455[_0x5bc3('0x91')])[_0x5bc3('0x81')](_0x5bc3('0xbf'))[_0x5bc3('0xc0')](),'closedAt':_0x706455[_0x5bc3('0x6d')]?moment(_0x706455[_0x5bc3('0xc1')])['format'](_0x5bc3('0xbf'))[_0x5bc3('0xc0')]():'','disposition':_0x706455[_0x5bc3('0x6e')],'chatInfo':{'browser':_0x706455[_0x5bc3('0xc2')],'os':_0x706455[_0x5bc3('0xc3')],'referer':_0x706455[_0x5bc3('0xc4')],'customerIp':_0x706455['customerIp'],'customerPort':_0x706455[_0x5bc3('0xc5')]?_0x706455[_0x5bc3('0xc5')]:_0x5bc3('0xbe')},'messages':_(_0x706455['Messages'])[_0x5bc3('0xc6')]()[_0x5bc3('0xa6')]({'secret':![]})[_0x5bc3('0x36')](function(_0x52d355){if(_0x52d355['Attachment']){var _0x1fb9f3=path['join'](_0x4f1c0b,_0x52d355['Attachment']['basename']);if(fs[_0x5bc3('0xc7')](_0x1fb9f3)){fs[_0x5bc3('0xc8')](_0x1fb9f3)['pipe'](fs[_0x5bc3('0xc9')](path['join'](_0x2bdf1d,_0x52d355[_0x5bc3('0x75')]['basename'])));}}return{'date':moment(_0x52d355[_0x5bc3('0x91')])[_0x5bc3('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5bc3('0xc0')](),'sender':_0x52d355['direction']===_0x5bc3('0x65')?_0x52d355[_0x5bc3('0x84')]?_0x52d355[_0x5bc3('0x84')][_0x5bc3('0x59')]:_0x5bc3('0x8e'):_0x52d355[_0x5bc3('0x69')][_0x5bc3('0xca')]+(_0x52d355[_0x5bc3('0x69')][_0x5bc3('0xb9')]?'\x20'+_0x52d355[_0x5bc3('0x69')][_0x5bc3('0xb9')]:''),'body':_0x52d355['Attachment']?_0x52d355[_0x5bc3('0x75')][_0x5bc3('0x72')]:_0x52d355[_0x5bc3('0x31')],'direction':_0x52d355['direction']==='out'?'A':'C','secret':_0x52d355[_0x5bc3('0xab')],'read':_0x52d355[_0x5bc3('0xba')],'attachment':_0x52d355[_0x5bc3('0x75')]};})[_0x5bc3('0xcb')]()};return ejs[_0x5bc3('0xcc')](path[_0x5bc3('0x7a')](config[_0x5bc3('0x7b')],'server',_0x5bc3('0xcd'),_0x5bc3('0xce')),{'interaction':_0x25ef9e})[_0x5bc3('0x16')](function(_0x1887e8){var _0x4b51ae=path[_0x5bc3('0x7a')](_0x2bdf1d,'transcript-'+_0x706455['id']+'-'+_0x310dcb+_0x5bc3('0xcf'));var _0x483178={'path':_0x4b51ae,'channel':_0x5bc3('0xbd'),'interactionId':_0x706455['id']};return pdf[_0x5bc3('0xd0')](_0x1887e8,_0x483178);})[_0x5bc3('0x16')](function(){return new Promise(function(_0x4339bb,_0x10cb57){zipdir(_0x2bdf1d,{'saveTo':_0xb43db},function(_0x18982,_0x2b66b8){if(_0x18982)return _0x10cb57(_0x18982);return _0x4339bb(_0x2b66b8);});})[_0x5bc3('0x16')](function(){return new BPromise(function(_0x276543,_0x118afa){rimraf(_0x2bdf1d,function(_0x65194f){if(_0x65194f)_0x118afa(_0x65194f);return _0x276543();});});})[_0x5bc3('0x16')](function(){return _0x5b60e2[_0x5bc3('0x7d')](_0xb43db,_0x51942f,function(_0x3384c0){if(_0x3384c0){logger[_0x5bc3('0x1c')](_0x5bc3('0xd1'),_0x3384c0);}else{fs[_0x5bc3('0xd2')](_0xb43db);}});});});}else{return _0x5b60e2[_0x5bc3('0x22')](0xc8);}})[_0x5bc3('0x21')](handleError(_0x5b60e2,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 17b65c4..bbcc6d5 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 _0x7ebf=['ChatMessage','setMaxListeners','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction'];(function(_0x40cdc3,_0x76825d){var _0x5bda2b=function(_0x1fc318){while(--_0x1fc318){_0x40cdc3['push'](_0x40cdc3['shift']());}};_0x5bda2b(++_0x76825d);}(_0x7ebf,0x141));var _0xf7eb=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x7ebf[_0x3a0ebd];return _0x51a660;};'use strict';var EventEmitter=require(_0xf7eb('0x0'));var ChatInteraction=require(_0xf7eb('0x1'))['db'][_0xf7eb('0x2')];var ChatMessage=require(_0xf7eb('0x1'))['db'][_0xf7eb('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf7eb('0x4')](0x0);var events={'afterCreate':_0xf7eb('0x5'),'afterUpdate':_0xf7eb('0x6'),'afterDestroy':_0xf7eb('0x7')};function emitEvent(_0x2e6431){return function(_0x2200e7,_0xa6e637,_0x21b200){_0x2200e7['getUsers']({'attributes':['id'],'raw':!![]})[_0xf7eb('0x8')](function(_0x385c7d){_0x2200e7['setDataValue']('Users',_0x385c7d[_0xf7eb('0x9')](function(_0x208ee8){return{'id':_0x208ee8['id']};}));return ChatMessage[_0xf7eb('0xa')]({'where':{'ChatInteractionId':_0x2200e7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf7eb('0x8')](function(_0x4f7fda){_0x2200e7[_0xf7eb('0xb')](_0xf7eb('0xc'),_0x4f7fda[_0xf7eb('0xd')]);ChatInteractionEvents[_0xf7eb('0xe')](_0x2e6431+':'+_0x2200e7['id'],_0x2200e7);ChatInteractionEvents['emit'](_0x2e6431,_0x2200e7);_0x21b200(null);})['catch'](_0x21b200(null));};}for(var e in events){if(events[_0xf7eb('0xf')](e)){var event=events[e];ChatInteraction[_0xf7eb('0x10')](e,emitEvent(event));}}module[_0xf7eb('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x76fe=['Users','map','length','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x76fe,0xd6));var _0xe76f=function(_0x465aa9,_0x1bf1c8){_0x465aa9=_0x465aa9-0x0;var _0x4104e4=_0x76fe[_0x465aa9];return _0x4104e4;};'use strict';var EventEmitter=require(_0xe76f('0x0'));var ChatInteraction=require(_0xe76f('0x1'))['db'][_0xe76f('0x2')];var ChatMessage=require(_0xe76f('0x1'))['db'][_0xe76f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe76f('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe76f('0x5'),'afterDestroy':_0xe76f('0x6')};function emitEvent(_0x24fb2b){return function(_0x17647f,_0xa48b60,_0x373b04){_0x17647f[_0xe76f('0x7')]({'attributes':['id'],'raw':!![]})[_0xe76f('0x8')](function(_0x447a88){_0x17647f[_0xe76f('0x9')](_0xe76f('0xa'),_0x447a88[_0xe76f('0xb')](function(_0xe213eb){return{'id':_0xe213eb['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x17647f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd62da0){_0x17647f[_0xe76f('0x9')]('unreadMessages',_0xd62da0[_0xe76f('0xc')]);ChatInteractionEvents['emit'](_0x24fb2b+':'+_0x17647f['id'],_0x17647f);ChatInteractionEvents['emit'](_0x24fb2b,_0x17647f);_0x373b04(null);})['catch'](_0x373b04(null));};}for(var e in events){if(events[_0xe76f('0xd')](e)){var event=events[e];ChatInteraction[_0xe76f('0xe')](e,emitEvent(event));}}module[_0xe76f('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index af85900..f0d7c1e 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 _0x9ea1=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','api'];(function(_0x3ee869,_0x4b1e01){var _0x4169a9=function(_0x3413b0){while(--_0x3413b0){_0x3ee869['push'](_0x3ee869['shift']());}};_0x4169a9(++_0x4b1e01);}(_0x9ea1,0xa2));var _0x19ea=function(_0x1d9a76,_0x91187d){_0x1d9a76=_0x1d9a76-0x0;var _0x20dbbd=_0x9ea1[_0x1d9a76];return _0x20dbbd;};'use strict';var _=require(_0x19ea('0x0'));var util=require(_0x19ea('0x1'));var logger=require('../../config/logger')(_0x19ea('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19ea('0x3'));var rimraf=require(_0x19ea('0x4'));var config=require(_0x19ea('0x5'));var attributes=require(_0x19ea('0x6'));module[_0x19ea('0x7')]=function(_0x1476cc,_0x1d1e29){return _0x1476cc[_0x19ea('0x8')](_0x19ea('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x440f46,_0x19d060,_0x398b34){if(_0x440f46[_0x19ea('0xa')](_0x19ea('0xb'))){_0x440f46[_0x19ea('0xc')]=moment()['format'](_0x19ea('0xd'));}_0x398b34(null,_0x440f46);}},'charset':_0x19ea('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9fdc=['./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x25ce33,_0x595d76){var _0x45c699=function(_0x3c7297){while(--_0x3c7297){_0x25ce33['push'](_0x25ce33['shift']());}};_0x45c699(++_0x595d76);}(_0x9fdc,0x1a1));var _0xc9fd=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x9fdc[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xc9fd('0x0'));var util=require(_0xc9fd('0x1'));var logger=require(_0xc9fd('0x2'))('api');var moment=require(_0xc9fd('0x3'));var BPromise=require(_0xc9fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9fd('0x5'));var rimraf=require(_0xc9fd('0x6'));var config=require(_0xc9fd('0x7'));var attributes=require(_0xc9fd('0x8'));module[_0xc9fd('0x9')]=function(_0x11c76e,_0x3fe840){return _0x11c76e['define'](_0xc9fd('0xa'),attributes,{'tableName':_0xc9fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cf95f,_0x863d0c,_0x40b91e){if(_0x2cf95f[_0xc9fd('0xc')](_0xc9fd('0xd'))){_0x2cf95f[_0xc9fd('0xe')]=moment()['format'](_0xc9fd('0xf'));}_0x40b91e(null,_0x2cf95f);}},'charset':'utf8mb4','collate':_0xc9fd('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 1f0826e..4a3c1a7 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 _0x8e4d=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatInteraction','options','where','attributes','limit','then','UpdateChatInteraction','debug','catch','AddTagsToChatInteraction','addTags','body','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8e4d,0x169));var _0xd8e4=function(_0x4fe8d8,_0x15ad31){_0x4fe8d8=_0x4fe8d8-0x0;var _0x2817e0=_0x8e4d[_0x4fe8d8];return _0x2817e0;};'use strict';var _=require(_0xd8e4('0x0'));var util=require(_0xd8e4('0x1'));var moment=require(_0xd8e4('0x2'));var BPromise=require(_0xd8e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8e4('0x4'));var db=require(_0xd8e4('0x5'))['db'];var utils=require(_0xd8e4('0x6'));var logger=require(_0xd8e4('0x7'))(_0xd8e4('0x8'));var config=require(_0xd8e4('0x9'));var jayson=require(_0xd8e4('0xa'));var client=jayson[_0xd8e4('0xb')]['http']({'port':0x232a});config[_0xd8e4('0xc')]=_[_0xd8e4('0xd')](config[_0xd8e4('0xc')],{'host':_0xd8e4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8e4('0xc')]));require(_0xd8e4('0xf'))[_0xd8e4('0x10')](socket);function respondWithRpcPromise(_0x253983,_0x64ead3,_0x5d1da4){return new BPromise(function(_0x533061,_0x21585c){return client[_0xd8e4('0x11')](_0x253983,_0x5d1da4)['then'](function(_0xde8cf1){logger[_0xd8e4('0x12')](_0xd8e4('0x13'),_0x64ead3,_0xd8e4('0x14'));logger['debug'](_0xd8e4('0x15'),_0x64ead3,'request\x20sent',JSON[_0xd8e4('0x16')](_0xde8cf1));if(_0xde8cf1[_0xd8e4('0x17')]){if(_0xde8cf1[_0xd8e4('0x17')]['code']===0x1f4){logger[_0xd8e4('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x64ead3,_0xde8cf1[_0xd8e4('0x17')][_0xd8e4('0x18')]);return _0x21585c(_0xde8cf1[_0xd8e4('0x17')]['message']);}logger[_0xd8e4('0x17')](_0xd8e4('0x13'),_0x64ead3,_0xde8cf1[_0xd8e4('0x17')][_0xd8e4('0x18')]);return _0x533061(_0xde8cf1['error'][_0xd8e4('0x18')]);}else{logger[_0xd8e4('0x12')](_0xd8e4('0x13'),_0x64ead3,_0xd8e4('0x14'));_0x533061(_0xde8cf1[_0xd8e4('0x19')]['message']);}})['catch'](function(_0x29d556){logger[_0xd8e4('0x17')](_0xd8e4('0x13'),_0x64ead3,_0x29d556);_0x21585c(_0x29d556);});});}exports['UpdateChatInteraction']=function(_0x1afa39){var _0x2e72d8=this;return new Promise(function(_0x39a77a,_0x25b22e){return db[_0xd8e4('0x1a')]['update'](_0x1afa39['body'],{'raw':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39[_0xd8e4('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39[_0xd8e4('0x1b')][_0xd8e4('0x1c')]||null:null,'attributes':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39['options'][_0xd8e4('0x1d')]||null:null,'limit':_0x1afa39[_0xd8e4('0x1b')]?_0x1afa39[_0xd8e4('0x1b')][_0xd8e4('0x1e')]||null:null})[_0xd8e4('0x1f')](function(_0x31dd8e){logger[_0xd8e4('0x12')](_0xd8e4('0x20'),_0x1afa39);logger[_0xd8e4('0x21')](_0xd8e4('0x20'),_0x1afa39,JSON[_0xd8e4('0x16')](_0x31dd8e));_0x39a77a(_0x31dd8e);})[_0xd8e4('0x22')](function(_0x573e21){logger[_0xd8e4('0x17')](_0xd8e4('0x20'),_0x573e21[_0xd8e4('0x18')],_0x1afa39);_0x25b22e(_0x2e72d8['error'](0x1f4,_0x573e21['message']));});});};exports[_0xd8e4('0x23')]=function(_0x2efa13){return new Promise(function(_0x48b0bf,_0x26cf0d){return db[_0xd8e4('0x1a')]['find']({'where':_0x2efa13[_0xd8e4('0x1b')]?_0x2efa13[_0xd8e4('0x1b')]['where']||null:null})[_0xd8e4('0x1f')](function(_0x1e900c){if(_0x1e900c){return _0x1e900c[_0xd8e4('0x24')](_0x2efa13[_0xd8e4('0x25')]['ids'],_[_0xd8e4('0x26')](_0x2efa13[_0xd8e4('0x25')],['ids','id'])||{});}})[_0xd8e4('0x27')](function(_0x2917b0){logger[_0xd8e4('0x12')](_0xd8e4('0x28'),_0x2efa13);logger[_0xd8e4('0x21')](_0xd8e4('0x28'),_0x2efa13,JSON['stringify'](_0x2917b0));_0x48b0bf(_0x2917b0);})[_0xd8e4('0x22')](function(_0x3731aa){logger[_0xd8e4('0x17')]('AddTags',_0x3731aa['message'],_0x2efa13);_0x26cf0d(_this[_0xd8e4('0x17')](0x1f4,_0x3731aa[_0xd8e4('0x18')]));});});}; \ No newline at end of file +var _0xac05=['where','ids','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','debug'];(function(_0x48f58f,_0x3a9b8c){var _0x307523=function(_0x39b455){while(--_0x39b455){_0x48f58f['push'](_0x48f58f['shift']());}};_0x307523(++_0x3a9b8c);}(_0xac05,0x1e5));var _0x5ac0=function(_0x433fe6,_0x465a4b){_0x433fe6=_0x433fe6-0x0;var _0x154a7d=_0xac05[_0x433fe6];return _0x154a7d;};'use strict';var _=require(_0x5ac0('0x0'));var util=require(_0x5ac0('0x1'));var moment=require(_0x5ac0('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ac0('0x3'));var fs=require('fs');var Redis=require(_0x5ac0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ac0('0x5'));var logger=require('../../config/logger')(_0x5ac0('0x6'));var config=require(_0x5ac0('0x7'));var jayson=require(_0x5ac0('0x8'));var client=jayson[_0x5ac0('0x9')][_0x5ac0('0xa')]({'port':0x232a});config['redis']=_[_0x5ac0('0xb')](config[_0x5ac0('0xc')],{'host':_0x5ac0('0xd'),'port':0x18eb});var socket=require(_0x5ac0('0xe'))(new Redis(config[_0x5ac0('0xc')]));require(_0x5ac0('0xf'))[_0x5ac0('0x10')](socket);function respondWithRpcPromise(_0x581666,_0x23440b,_0x508175){return new BPromise(function(_0x437a9b,_0x4b97e8){return client[_0x5ac0('0x11')](_0x581666,_0x508175)[_0x5ac0('0x12')](function(_0xf67a72){logger[_0x5ac0('0x13')](_0x5ac0('0x14'),_0x23440b,'request\x20sent');logger['debug'](_0x5ac0('0x15'),_0x23440b,_0x5ac0('0x16'),JSON[_0x5ac0('0x17')](_0xf67a72));if(_0xf67a72[_0x5ac0('0x18')]){if(_0xf67a72[_0x5ac0('0x18')][_0x5ac0('0x19')]===0x1f4){logger[_0x5ac0('0x18')](_0x5ac0('0x14'),_0x23440b,_0xf67a72[_0x5ac0('0x18')][_0x5ac0('0x1a')]);return _0x4b97e8(_0xf67a72['error'][_0x5ac0('0x1a')]);}logger[_0x5ac0('0x18')](_0x5ac0('0x14'),_0x23440b,_0xf67a72[_0x5ac0('0x18')]['message']);return _0x437a9b(_0xf67a72['error'][_0x5ac0('0x1a')]);}else{logger[_0x5ac0('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x23440b,_0x5ac0('0x16'));_0x437a9b(_0xf67a72[_0x5ac0('0x1b')]['message']);}})['catch'](function(_0x1bed85){logger[_0x5ac0('0x18')](_0x5ac0('0x14'),_0x23440b,_0x1bed85);_0x4b97e8(_0x1bed85);});});}exports[_0x5ac0('0x1c')]=function(_0x473d55){var _0x4c172b=this;return new Promise(function(_0x28af2f,_0x43df26){return db[_0x5ac0('0x1d')][_0x5ac0('0x1e')](_0x473d55[_0x5ac0('0x1f')],{'raw':_0x473d55[_0x5ac0('0x20')]?_0x473d55[_0x5ac0('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x473d55[_0x5ac0('0x20')]?_0x473d55[_0x5ac0('0x20')]['where']||null:null,'attributes':_0x473d55[_0x5ac0('0x20')]?_0x473d55[_0x5ac0('0x20')][_0x5ac0('0x21')]||null:null,'limit':_0x473d55[_0x5ac0('0x20')]?_0x473d55[_0x5ac0('0x20')]['limit']||null:null})['then'](function(_0x571802){logger[_0x5ac0('0x13')](_0x5ac0('0x1c'),_0x473d55);logger[_0x5ac0('0x22')](_0x5ac0('0x1c'),_0x473d55,JSON[_0x5ac0('0x17')](_0x571802));_0x28af2f(_0x571802);})['catch'](function(_0x2e5c3a){logger[_0x5ac0('0x18')](_0x5ac0('0x1c'),_0x2e5c3a[_0x5ac0('0x1a')],_0x473d55);_0x43df26(_0x4c172b[_0x5ac0('0x18')](0x1f4,_0x2e5c3a[_0x5ac0('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x434cbe){return new Promise(function(_0x556dc5,_0x15489f){return db[_0x5ac0('0x1d')]['find']({'where':_0x434cbe['options']?_0x434cbe[_0x5ac0('0x20')][_0x5ac0('0x23')]||null:null})[_0x5ac0('0x12')](function(_0x2bd3b9){if(_0x2bd3b9){return _0x2bd3b9['addTags'](_0x434cbe[_0x5ac0('0x1f')][_0x5ac0('0x24')],_['omit'](_0x434cbe[_0x5ac0('0x1f')],[_0x5ac0('0x24'),'id'])||{});}})[_0x5ac0('0x25')](function(_0x2d71ee){logger['info'](_0x5ac0('0x26'),_0x434cbe);logger['debug']('AddTags',_0x434cbe,JSON[_0x5ac0('0x17')](_0x2d71ee));_0x556dc5(_0x2d71ee);})[_0x5ac0('0x27')](function(_0x235a1e){logger['error']('AddTags',_0x235a1e['message'],_0x434cbe);_0x15489f(_this[_0x5ac0('0x18')](0x1f4,_0x235a1e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index af32999..43af632 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 _0x5934=['chatInteraction:','remove','emit','removeListener','length'];(function(_0x3f91c2,_0x1c3955){var _0x81e0ae=function(_0x103b89){while(--_0x103b89){_0x3f91c2['push'](_0x3f91c2['shift']());}};_0x81e0ae(++_0x1c3955);}(_0x5934,0xb5));var _0x4593=function(_0x4dfbb7,_0x50fbdd){_0x4dfbb7=_0x4dfbb7-0x0;var _0x46ac2c=_0x5934[_0x4dfbb7];return _0x46ac2c;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x4593('0x0'),'update'];function createListener(_0x46aa8f,_0x5af51e){return function(_0xe56064){_0x5af51e[_0x4593('0x1')](_0x46aa8f,_0xe56064);};}function removeListener(_0x512435,_0x2d8dea){return function(){ChatInteractionEvents[_0x4593('0x2')](_0x512435,_0x2d8dea);};}exports['register']=function(_0x1dd2ff){for(var _0x506b87=0x0,_0xb2e8a5=events[_0x4593('0x3')];_0x506b87<_0xb2e8a5;_0x506b87++){var _0x30ceed=events[_0x506b87];var _0xc7352c=createListener(_0x4593('0x4')+_0x30ceed,_0x1dd2ff);ChatInteractionEvents['on'](_0x30ceed,_0xc7352c);}}; \ No newline at end of file +var _0x59a0=['remove','emit','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x493ff1,_0x26d5ef){var _0x4baaa9=function(_0x15d2de){while(--_0x15d2de){_0x493ff1['push'](_0x493ff1['shift']());}};_0x4baaa9(++_0x26d5ef);}(_0x59a0,0x184));var _0x059a=function(_0x584501,_0x528e38){_0x584501=_0x584501-0x0;var _0xe2a6e1=_0x59a0[_0x584501];return _0xe2a6e1;};'use strict';var ChatInteractionEvents=require(_0x059a('0x0'));var events=[_0x059a('0x1'),_0x059a('0x2'),'update'];function createListener(_0xe10971,_0x156f81){return function(_0x64f014){_0x156f81[_0x059a('0x3')](_0xe10971,_0x64f014);};}function removeListener(_0x542f60,_0x5a637e){return function(){ChatInteractionEvents['removeListener'](_0x542f60,_0x5a637e);};}exports['register']=function(_0x1a267c){for(var _0x5c5b25=0x0,_0x213b93=events[_0x059a('0x4')];_0x5c5b25<_0x213b93;_0x5c5b25++){var _0x87e906=events[_0x5c5b25];var _0x3e762b=createListener(_0x059a('0x5')+_0x87e906,_0x1a267c);ChatInteractionEvents['on'](_0x87e906,_0x3e762b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ac2b644..72d748a 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 _0xdc28=['destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','tracked','chatinteraction:destroy'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xdc28,0x175));var _0x8dc2=function(_0x136efa,_0x5ba8e3){_0x136efa=_0x136efa-0x0;var _0x3c77dd=_0xdc28[_0x136efa];return _0x3c77dd;};'use strict';var multer=require(_0x8dc2('0x0'));var util=require(_0x8dc2('0x1'));var path=require('path');var timeout=require(_0x8dc2('0x2'));var express=require(_0x8dc2('0x3'));var router=express['Router']();var fs_extra=require(_0x8dc2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8dc2('0x5'));var config=require(_0x8dc2('0x6'));var controller=require(_0x8dc2('0x7'));router[_0x8dc2('0x8')]('/',auth[_0x8dc2('0x9')](),controller[_0x8dc2('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8dc2('0xb')]);router[_0x8dc2('0x8')](_0x8dc2('0xc'),auth[_0x8dc2('0xd')](),controller[_0x8dc2('0xe')]);router[_0x8dc2('0x8')]('/:id/attachment_download',auth[_0x8dc2('0xd')](),controller[_0x8dc2('0xf')]);router[_0x8dc2('0x8')](_0x8dc2('0x10'),auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x11')]);router[_0x8dc2('0x8')]('/:id/my_messages',auth[_0x8dc2('0xd')](),controller[_0x8dc2('0x12')]);router[_0x8dc2('0x8')](_0x8dc2('0x13'),auth['isAuthenticated'](),controller[_0x8dc2('0x14')]);router['post']('/',auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x15')]);router[_0x8dc2('0x16')](_0x8dc2('0x17'),auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x18')]);var upload=multer({'storage':multer[_0x8dc2('0x19')]({'destination':function(_0x39cd78,_0x485066,_0x18add7){_0x18add7(null,path[_0x8dc2('0x1a')](config[_0x8dc2('0x1b')],_0x8dc2('0x1c')));},'filename':function(_0x32ae44,_0x3b7ff0,_0x4ddae3){_0x4ddae3(null,util['format'](_0x8dc2('0x1d'),Date[_0x8dc2('0x1e')](),_0x3b7ff0[_0x8dc2('0x1f')][_0x8dc2('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8dc2('0x16')](_0x8dc2('0x21'),upload[_0x8dc2('0x22')](_0x8dc2('0x23')),controller['attachmentUpload']);router[_0x8dc2('0x16')](_0x8dc2('0x10'),auth[_0x8dc2('0xd')](),controller[_0x8dc2('0x24')]);router['post'](_0x8dc2('0x25'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x8dc2('0x26')),controller[_0x8dc2('0x27')]);router[_0x8dc2('0x28')](_0x8dc2('0xc'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x8dc2('0x29')),controller[_0x8dc2('0x2a')]);router[_0x8dc2('0x28')](_0x8dc2('0x2b'),controller[_0x8dc2('0x2c')]);router['put'](_0x8dc2('0x2d'),auth[_0x8dc2('0xd')](),controller[_0x8dc2('0x2e')]);router[_0x8dc2('0x28')](_0x8dc2('0x2f'),controller['close']);router[_0x8dc2('0x30')](_0x8dc2('0xc'),auth[_0x8dc2('0x9')](),interaction[_0x8dc2('0x31')]('chat',_0x8dc2('0x32')),controller[_0x8dc2('0x33')]);router['delete'](_0x8dc2('0x25'),auth[_0x8dc2('0x9')](),controller[_0x8dc2('0x34')]);module['exports']=router; \ No newline at end of file +var _0xea35=['file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','/:id','chatinteraction:update','/:id/custom_update','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','%s-%s','now','originalname','replace','/:id/attachment_upload','single'];(function(_0x5794dd,_0x37af14){var _0x1a32a7=function(_0x3637dd){while(--_0x3637dd){_0x5794dd['push'](_0x5794dd['shift']());}};_0x1a32a7(++_0x37af14);}(_0xea35,0x110));var _0x5ea3=function(_0x3a0026,_0x322c88){_0x3a0026=_0x3a0026-0x0;var _0x29510d=_0xea35[_0x3a0026];return _0x29510d;};'use strict';var multer=require(_0x5ea3('0x0'));var util=require(_0x5ea3('0x1'));var path=require(_0x5ea3('0x2'));var timeout=require(_0x5ea3('0x3'));var express=require(_0x5ea3('0x4'));var router=express[_0x5ea3('0x5')]();var fs_extra=require(_0x5ea3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5ea3('0x7'));var config=require(_0x5ea3('0x8'));var controller=require('./chatInteraction.controller');router[_0x5ea3('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ea3('0xa')]);router[_0x5ea3('0x9')](_0x5ea3('0xb'),auth[_0x5ea3('0xc')](),controller[_0x5ea3('0xd')]);router['get']('/:id',auth[_0x5ea3('0xe')](),controller['show']);router[_0x5ea3('0x9')](_0x5ea3('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x5ea3('0x10')]);router['get'](_0x5ea3('0x11'),auth[_0x5ea3('0xc')](),controller[_0x5ea3('0x12')]);router[_0x5ea3('0x9')](_0x5ea3('0x13'),auth[_0x5ea3('0xe')](),controller[_0x5ea3('0x14')]);router[_0x5ea3('0x9')]('/:id/download',auth[_0x5ea3('0xc')](),controller[_0x5ea3('0x15')]);router[_0x5ea3('0x16')]('/',auth['isAuthenticated'](),controller[_0x5ea3('0x17')]);router['post'](_0x5ea3('0x18'),auth[_0x5ea3('0xc')](),controller[_0x5ea3('0x19')]);var upload=multer({'storage':multer[_0x5ea3('0x1a')]({'destination':function(_0x3289da,_0x2c5aa2,_0x47ab1e){_0x47ab1e(null,path['join'](config[_0x5ea3('0x1b')],'server/files/attachments/'));},'filename':function(_0x1a1396,_0x481da8,_0x498bfc){_0x498bfc(null,util['format'](_0x5ea3('0x1c'),Date[_0x5ea3('0x1d')](),_0x481da8[_0x5ea3('0x1e')][_0x5ea3('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5ea3('0x16')](_0x5ea3('0x20'),upload[_0x5ea3('0x21')](_0x5ea3('0x22')),controller['attachmentUpload']);router[_0x5ea3('0x16')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x5ea3('0x23')]);router[_0x5ea3('0x16')](_0x5ea3('0x24'),auth[_0x5ea3('0xc')](),interaction[_0x5ea3('0x25')](_0x5ea3('0x26'),_0x5ea3('0x27')),controller['addTags']);router[_0x5ea3('0x28')](_0x5ea3('0x29'),auth[_0x5ea3('0xc')](),interaction[_0x5ea3('0x25')]('chat',_0x5ea3('0x2a')),controller['update']);router['put'](_0x5ea3('0x2b'),controller['customUpdate']);router['put']('/:id/abandon',auth[_0x5ea3('0xe')](),controller[_0x5ea3('0x2c')]);router[_0x5ea3('0x28')](_0x5ea3('0x2d'),controller['close']);router[_0x5ea3('0x2e')]('/:id',auth[_0x5ea3('0xc')](),interaction[_0x5ea3('0x25')]('chat',_0x5ea3('0x2f')),controller[_0x5ea3('0x30')]);router[_0x5ea3('0x2e')](_0x5ea3('0x24'),auth[_0x5ea3('0xc')](),controller[_0x5ea3('0x31')]);module[_0x5ea3('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fc8d710..23c8676 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 _0x36ec=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x474f05,_0x3a9247){var _0x34ae54=function(_0x1cbb23){while(--_0x1cbb23){_0x474f05['push'](_0x474f05['shift']());}};_0x34ae54(++_0x3a9247);}(_0x36ec,0x126));var _0xc36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc36e('0x0'));module['exports']={'body':{'type':Sequelize[_0xc36e('0x1')](_0xc36e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc36e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc36e('0x4')]}}; \ No newline at end of file +var _0xd983=['exports','TEXT','medium','BOOLEAN','sequelize'];(function(_0x1ec908,_0x95c177){var _0x523833=function(_0x40fab7){while(--_0x40fab7){_0x1ec908['push'](_0x1ec908['shift']());}};_0x523833(++_0x95c177);}(_0xd983,0x95));var _0x3d98=function(_0x7dd97f,_0x262e14){_0x7dd97f=_0x7dd97f-0x0;var _0x1747e1=_0xd983[_0x7dd97f];return _0x1747e1;};'use strict';var Sequelize=require(_0x3d98('0x0'));module[_0x3d98('0x1')]={'body':{'type':Sequelize[_0x3d98('0x2')](_0x3d98('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3d98('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d22e4f9..66c393e 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 _0xcfd1=['lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','user','fullname','role','userpic','internal','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','map','ChatInternalMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','get','messages'];(function(_0x134d1d,_0x22b473){var _0x30b003=function(_0x5930dc){while(--_0x5930dc){_0x134d1d['push'](_0x134d1d['shift']());}};_0x30b003(++_0x22b473);}(_0xcfd1,0x1c2));var _0x1cfd=function(_0x24c3a1,_0x4a69e6){_0x24c3a1=_0x24c3a1-0x0;var _0x452f46=_0xcfd1[_0x24c3a1];return _0x452f46;};'use strict';var emlformat=require(_0x1cfd('0x0'));var rimraf=require(_0x1cfd('0x1'));var zipdir=require(_0x1cfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cfd('0x3'));var moment=require(_0x1cfd('0x4'));var BPromise=require(_0x1cfd('0x5'));var Mustache=require('mustache');var util=require(_0x1cfd('0x6'));var path=require('path');var sox=require(_0x1cfd('0x7'));var csv=require(_0x1cfd('0x8'));var ejs=require(_0x1cfd('0x9'));var fs=require('fs');var fs_extra=require(_0x1cfd('0xa'));var _=require(_0x1cfd('0xb'));var squel=require('squel');var crypto=require(_0x1cfd('0xc'));var jsforce=require(_0x1cfd('0xd'));var deskjs=require(_0x1cfd('0xe'));var toCsv=require(_0x1cfd('0x8'));var querystring=require('querystring');var Papa=require(_0x1cfd('0xf'));var Redis=require('ioredis');var authService=require(_0x1cfd('0x10'));var qs=require(_0x1cfd('0x11'));var as=require(_0x1cfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cfd('0x13'));var utils=require(_0x1cfd('0x14'));var config=require(_0x1cfd('0x15'));var licenseUtil=require(_0x1cfd('0x16'));var db=require(_0x1cfd('0x17'))['db'];config['redis']=_[_0x1cfd('0x18')](config[_0x1cfd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cfd('0x1a'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x1cfd('0x1b')](socket);function respondWithStatusCode(_0x9d799,_0x19677a){_0x19677a=_0x19677a||0xcc;return function(_0x4375f6){if(_0x4375f6){return _0x9d799[_0x1cfd('0x1c')](_0x19677a);}return _0x9d799[_0x1cfd('0x1d')](_0x19677a)[_0x1cfd('0x1e')]();};}function respondWithResult(_0x21da01,_0x1b4b56){_0x1b4b56=_0x1b4b56||0xc8;return function(_0x38e0cd){if(_0x38e0cd){return _0x21da01[_0x1cfd('0x1d')](_0x1b4b56)[_0x1cfd('0x1f')](_0x38e0cd);}};}function respondWithFilteredResult(_0x58289c,_0x4fec5f){return function(_0x43aa09){if(_0x43aa09){var _0x2f982e=typeof _0x4fec5f[_0x1cfd('0x20')]==='undefined'&&typeof _0x4fec5f[_0x1cfd('0x21')]==='undefined';var _0xcad212=_0x43aa09[_0x1cfd('0x22')];var _0x295657=_0x2f982e?0x0:_0x4fec5f[_0x1cfd('0x20')];var _0x1aeb40=_0x2f982e?_0x43aa09['count']:_0x4fec5f[_0x1cfd('0x20')]+_0x4fec5f[_0x1cfd('0x21')];var _0x4048ea;if(_0x1aeb40>=_0xcad212){_0x1aeb40=_0xcad212;_0x4048ea=0xc8;}else{_0x4048ea=0xce;}_0x58289c['status'](_0x4048ea);return _0x58289c[_0x1cfd('0x23')](_0x1cfd('0x24'),_0x295657+'-'+_0x1aeb40+'/'+_0xcad212)['json'](_0x43aa09);}return null;};}function patchUpdates(_0x327a9d){return function(_0x29c3f1){try{jsonpatch[_0x1cfd('0x25')](_0x29c3f1,_0x327a9d,!![]);}catch(_0x555954){return BPromise[_0x1cfd('0x26')](_0x555954);}return _0x29c3f1['save']();};}function saveUpdates(_0x1c63df,_0x2c28c4){return function(_0x4bcc0c){if(_0x4bcc0c){return _0x4bcc0c[_0x1cfd('0x27')](_0x1c63df)[_0x1cfd('0x28')](function(_0x35b7b0){return _0x35b7b0;});}return null;};}function removeEntity(_0x5de27a,_0x48ed54){return function(_0x47e8ac){if(_0x47e8ac){return _0x47e8ac['destroy']()[_0x1cfd('0x28')](function(){_0x5de27a[_0x1cfd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a8b6,_0x113790){return function(_0x1871ce){if(!_0x1871ce){_0x32a8b6[_0x1cfd('0x1c')](0x194);}return _0x1871ce;};}function handleError(_0xb027b2,_0xe93611){_0xe93611=_0xe93611||0x1f4;return function(_0x2b18e0){logger[_0x1cfd('0x29')](_0x2b18e0[_0x1cfd('0x2a')]);if(_0x2b18e0['name']){delete _0x2b18e0[_0x1cfd('0x2b')];}_0xb027b2[_0x1cfd('0x1d')](_0xe93611)['send'](_0x2b18e0);};}exports['index']=function(_0x261ae5,_0x596544){var _0x314b2f={},_0x4c38ff={},_0x413df1={'count':0x0,'rows':[]};var _0x4d3bca=_[_0x1cfd('0x2c')](db[_0x1cfd('0x2d')]['rawAttributes'],function(_0x1e1ea4){return{'name':_0x1e1ea4[_0x1cfd('0x2e')],'type':_0x1e1ea4[_0x1cfd('0x2f')][_0x1cfd('0x30')]};});_0x4c38ff[_0x1cfd('0x31')]=_[_0x1cfd('0x2c')](_0x4d3bca,'name');_0x4c38ff[_0x1cfd('0x32')]=_[_0x1cfd('0x33')](_0x261ae5[_0x1cfd('0x32')]);_0x4c38ff['filters']=_[_0x1cfd('0x34')](_0x4c38ff[_0x1cfd('0x31')],_0x4c38ff[_0x1cfd('0x32')]);_0x314b2f[_0x1cfd('0x35')]=_[_0x1cfd('0x34')](_0x4c38ff[_0x1cfd('0x31')],qs[_0x1cfd('0x36')](_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x36')]));_0x314b2f[_0x1cfd('0x35')]=_0x314b2f[_0x1cfd('0x35')][_0x1cfd('0x37')]?_0x314b2f[_0x1cfd('0x35')]:_0x4c38ff[_0x1cfd('0x31')];if(!_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x38')](_0x1cfd('0x39'))){_0x314b2f['limit']=qs[_0x1cfd('0x21')](_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x21')]);_0x314b2f[_0x1cfd('0x20')]=qs['offset'](_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x20')]);}_0x314b2f[_0x1cfd('0x3a')]=qs[_0x1cfd('0x3b')](_0x261ae5['query']['sort']);_0x314b2f[_0x1cfd('0x3c')]=qs[_0x1cfd('0x3d')](_['pick'](_0x261ae5['query'],_0x4c38ff[_0x1cfd('0x3d')]),_0x4d3bca);if(_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x3e')]){_0x314b2f[_0x1cfd('0x3c')]=_[_0x1cfd('0x3f')](_0x314b2f[_0x1cfd('0x3c')],{'$or':_[_0x1cfd('0x2c')](_0x4d3bca,function(_0x28785a){if(_0x28785a['type']!==_0x1cfd('0x40')){var _0x2eccd4={};_0x2eccd4[_0x28785a[_0x1cfd('0x2b')]]={'$like':'%'+_0x261ae5['query'][_0x1cfd('0x3e')]+'%'};return _0x2eccd4;}})});}_0x314b2f=_['merge']({},_0x314b2f,_0x261ae5[_0x1cfd('0x41')]);var _0xc038e7={'where':_0x314b2f['where']};return db[_0x1cfd('0x2d')]['count'](_0xc038e7)['then'](function(_0x348ccb){_0x413df1[_0x1cfd('0x22')]=_0x348ccb;if(_0x261ae5[_0x1cfd('0x32')][_0x1cfd('0x42')]){_0x314b2f[_0x1cfd('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x1cfd('0x44')](_0x314b2f);})[_0x1cfd('0x28')](function(_0x53547d){_0x413df1[_0x1cfd('0x45')]=_0x53547d;return _0x413df1;})[_0x1cfd('0x28')](respondWithFilteredResult(_0x596544,_0x314b2f))[_0x1cfd('0x46')](handleError(_0x596544,null));};exports[_0x1cfd('0x47')]=function(_0xd682e1,_0xa86916){var _0x554001={'raw':!![],'where':{'id':_0xd682e1[_0x1cfd('0x48')]['id']}},_0xa6f7db={};_0xa6f7db[_0x1cfd('0x31')]=_[_0x1cfd('0x33')](db[_0x1cfd('0x2d')][_0x1cfd('0x49')]);_0xa6f7db[_0x1cfd('0x32')]=_['keys'](_0xd682e1['query']);_0xa6f7db['filters']=_[_0x1cfd('0x34')](_0xa6f7db[_0x1cfd('0x31')],_0xa6f7db[_0x1cfd('0x32')]);_0x554001[_0x1cfd('0x35')]=_[_0x1cfd('0x34')](_0xa6f7db[_0x1cfd('0x31')],qs['fields'](_0xd682e1[_0x1cfd('0x32')][_0x1cfd('0x36')]));_0x554001[_0x1cfd('0x35')]=_0x554001[_0x1cfd('0x35')][_0x1cfd('0x37')]?_0x554001[_0x1cfd('0x35')]:_0xa6f7db['model'];if(_0xd682e1[_0x1cfd('0x32')]['includeAll']){_0x554001[_0x1cfd('0x43')]=[{'all':!![]}];}_0x554001=_[_0x1cfd('0x3f')]({},_0x554001,_0xd682e1[_0x1cfd('0x41')]);return db['ChatInternalMessage'][_0x1cfd('0x4a')](_0x554001)[_0x1cfd('0x28')](handleEntityNotFound(_0xa86916,null))[_0x1cfd('0x28')](respondWithResult(_0xa86916,null))['catch'](handleError(_0xa86916,null));};exports['create']=function(_0x1a5eb9,_0x11ac92){return db[_0x1cfd('0x2d')][_0x1cfd('0x4b')](_0x1a5eb9[_0x1cfd('0x4c')],{})[_0x1cfd('0x28')](respondWithResult(_0x11ac92,0xc9))[_0x1cfd('0x46')](handleError(_0x11ac92,null));};exports[_0x1cfd('0x27')]=function(_0x480909,_0x321848){if(_0x480909[_0x1cfd('0x4c')]['id']){delete _0x480909[_0x1cfd('0x4c')]['id'];}return db[_0x1cfd('0x2d')][_0x1cfd('0x4a')]({'where':{'id':_0x480909['params']['id']}})[_0x1cfd('0x28')](handleEntityNotFound(_0x321848,null))[_0x1cfd('0x28')](saveUpdates(_0x480909[_0x1cfd('0x4c')],null))['then'](respondWithResult(_0x321848,null))['catch'](handleError(_0x321848,null));};exports[_0x1cfd('0x4d')]=function(_0x3c93da,_0x53c8eb){return db[_0x1cfd('0x2d')][_0x1cfd('0x4a')]({'where':{'id':_0x3c93da[_0x1cfd('0x48')]['id']}})[_0x1cfd('0x28')](handleEntityNotFound(_0x53c8eb,null))['then'](removeEntity(_0x53c8eb,null))[_0x1cfd('0x46')](handleError(_0x53c8eb,null));};exports['describe']=function(_0xb64623,_0x275c69){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x275c69,null))[_0x1cfd('0x46')](handleError(_0x275c69,null));};function wrapUser(_0x2486de){return function(_0x5e6008){var _0x323946=_0x2486de[_0x1cfd('0x4e')]({'plain':!![]});_0x323946[_0x1cfd('0x4f')]=[];if(_0x5e6008){_0x323946[_0x1cfd('0x50')]=_0x5e6008[_0x1cfd('0x51')];_0x323946[_0x1cfd('0x52')]=_0x5e6008;}else{_0x323946['lastMessageAt']=moment(0x0)[_0x1cfd('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x323946[_0x1cfd('0x52')]={};}return _0x323946;};}exports[_0x1cfd('0x54')]=function(_0x54d3f4,_0x18c8c7,_0x20fdf6){var _0x5a67a5=[];return db[_0x1cfd('0x55')][_0x1cfd('0x44')]({'where':{'role':[_0x1cfd('0x56'),'admin',_0x1cfd('0x57')]},'attributes':['id',_0x1cfd('0x58'),'name',_0x1cfd('0x59'),_0x1cfd('0x5a'),_0x1cfd('0x5b'),'online','lastLoginAt',_0x1cfd('0x5c'),_0x1cfd('0x5d')],'order':qs[_0x1cfd('0x3b')](_0x1cfd('0x5e')),'include':[{'model':db[_0x1cfd('0x5f')],'as':_0x1cfd('0x60'),'attributes':['id',_0x1cfd('0x2b'),_0x1cfd('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x52cb5a){if(_0x52cb5a){var _0x51b72f=_0x54d3f4[_0x1cfd('0x57')][_0x1cfd('0x4e')]({'plain':!![]});if(!_0x51b72f)throw new Error(_0x1cfd('0x61'));if(_0x51b72f[_0x1cfd('0x59')]===_0x1cfd('0x57')){return db['UserProfileSection'][_0x1cfd('0x4a')]({'where':{'name':_0x1cfd('0x62'),'userProfileId':_0x51b72f['userProfileId']},'raw':!![]})['then'](function(_0x38415a){if(_0x38415a){if(_0x38415a['autoAssociation']===0x0){return db['UserProfileResource'][_0x1cfd('0x44')]({'where':{'sectionId':_0x38415a['id']},'raw':!![]})[_0x1cfd('0x28')](function(_0x4d137c){var _0x58b3a3=[];if(_['isEmpty'](_0x4d137c)){_0x58b3a3=_[_0x1cfd('0x3e')](_0x52cb5a,function(_0x171fc5){if(_0x171fc5['role']!==_0x1cfd('0x56')){return _0x171fc5;}});return _0x58b3a3;}else{for(var _0x3f9bd7=0x0;_0x3f9bd7<_0x52cb5a[_0x1cfd('0x37')];_0x3f9bd7++){var _0xd5b846=_0x52cb5a[_0x3f9bd7];if(_0xd5b846[_0x1cfd('0x59')]==='agent'){var _0x324993=_[_0x1cfd('0x4a')](_0x4d137c,function(_0x2c7b04){return _0x2c7b04[_0x1cfd('0x63')]===_0xd5b846['id'];});if(_0x324993)_0x58b3a3[_0x1cfd('0x64')](_0xd5b846);}else{_0x58b3a3[_0x1cfd('0x64')](_0xd5b846);}}return _0x58b3a3;}});}else{return _0x52cb5a;}}else{var _0x3f05d2=_[_0x1cfd('0x3e')](_0x52cb5a,function(_0x25c9f6){if(_0x25c9f6[_0x1cfd('0x59')]!==_0x1cfd('0x56')){return _0x25c9f6;}});return _0x3f05d2;}});}else{return _0x52cb5a;}}})['then'](function(_0x2cd8e3){var _0x3819b8=[];if(_0x2cd8e3){_0x5a67a5=_0x2cd8e3;for(var _0x1644fa=0x0;_0x1644fa<_0x2cd8e3[_0x1cfd('0x37')];_0x1644fa+=0x1){_0x5a67a5[_0x1644fa][_0x1cfd('0x4f')]=[];_0x3819b8[_0x1cfd('0x64')](db[_0x1cfd('0x2d')][_0x1cfd('0x4a')]({'where':{'FromId':[_0x54d3f4[_0x1cfd('0x57')]['id'],_0x2cd8e3[_0x1644fa]['id']],'ToId':[_0x54d3f4[_0x1cfd('0x57')]['id'],_0x2cd8e3[_0x1644fa]['id']],'ChatGroupId':null},'attributes':['id',_0x1cfd('0x51'),_0x1cfd('0x65'),_0x1cfd('0x66'),_0x1cfd('0x67'),_0x1cfd('0x4c')],'order':qs[_0x1cfd('0x3b')](_0x1cfd('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2cd8e3[_0x1644fa])));}return BPromise[_0x1cfd('0x69')](_0x3819b8);}return[];})['then'](function(_0x166417){return{'rows':_0x166417,'count':_0x166417[_0x1cfd('0x37')]};})['then'](respondWithResult(_0x18c8c7,null))['catch'](handleError(_0x18c8c7,null));}; \ No newline at end of file +var _0x731a=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','key','keys','query'];(function(_0xfbea97,_0x5b44b5){var _0x58c718=function(_0x10538c){while(--_0x10538c){_0xfbea97['push'](_0xfbea97['shift']());}};_0x58c718(++_0x5b44b5);}(_0x731a,0x19b));var _0xa731=function(_0x52ddc8,_0xada5d6){_0x52ddc8=_0x52ddc8-0x0;var _0x41e9c3=_0x731a[_0x52ddc8];return _0x41e9c3;};'use strict';var emlformat=require(_0xa731('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa731('0x1'));var jsonpatch=require(_0xa731('0x2'));var rp=require(_0xa731('0x3'));var moment=require(_0xa731('0x4'));var BPromise=require(_0xa731('0x5'));var Mustache=require(_0xa731('0x6'));var util=require(_0xa731('0x7'));var path=require('path');var sox=require(_0xa731('0x8'));var csv=require(_0xa731('0x9'));var ejs=require(_0xa731('0xa'));var fs=require('fs');var fs_extra=require(_0xa731('0xb'));var _=require('lodash');var squel=require(_0xa731('0xc'));var crypto=require(_0xa731('0xd'));var jsforce=require(_0xa731('0xe'));var deskjs=require(_0xa731('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa731('0x10'));var Papa=require(_0xa731('0x11'));var Redis=require(_0xa731('0x12'));var authService=require(_0xa731('0x13'));var qs=require(_0xa731('0x14'));var as=require(_0xa731('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa731('0x16'))(_0xa731('0x17'));var utils=require(_0xa731('0x18'));var config=require(_0xa731('0x19'));var licenseUtil=require(_0xa731('0x1a'));var db=require(_0xa731('0x1b'))['db'];config['redis']=_[_0xa731('0x1c')](config[_0xa731('0x1d')],{'host':_0xa731('0x1e'),'port':0x18eb});var socket=require(_0xa731('0x1f'))(new Redis(config['redis']));require(_0xa731('0x20'))['register'](socket);function respondWithStatusCode(_0x6203fe,_0x20180f){_0x20180f=_0x20180f||0xcc;return function(_0x7371b6){if(_0x7371b6){return _0x6203fe[_0xa731('0x21')](_0x20180f);}return _0x6203fe['status'](_0x20180f)[_0xa731('0x22')]();};}function respondWithResult(_0x425994,_0x1dad77){_0x1dad77=_0x1dad77||0xc8;return function(_0x182dcc){if(_0x182dcc){return _0x425994[_0xa731('0x23')](_0x1dad77)['json'](_0x182dcc);}};}function respondWithFilteredResult(_0x2ea3ab,_0x496a3e){return function(_0x595cb7){if(_0x595cb7){var _0x2afe0a=typeof _0x496a3e[_0xa731('0x24')]===_0xa731('0x25')&&typeof _0x496a3e[_0xa731('0x26')]===_0xa731('0x25');var _0xdfbf51=_0x595cb7['count'];var _0x3f8179=_0x2afe0a?0x0:_0x496a3e[_0xa731('0x24')];var _0x1fed0e=_0x2afe0a?_0x595cb7[_0xa731('0x27')]:_0x496a3e[_0xa731('0x24')]+_0x496a3e[_0xa731('0x26')];var _0x2f0460;if(_0x1fed0e>=_0xdfbf51){_0x1fed0e=_0xdfbf51;_0x2f0460=0xc8;}else{_0x2f0460=0xce;}_0x2ea3ab['status'](_0x2f0460);return _0x2ea3ab[_0xa731('0x28')](_0xa731('0x29'),_0x3f8179+'-'+_0x1fed0e+'/'+_0xdfbf51)[_0xa731('0x2a')](_0x595cb7);}return null;};}function patchUpdates(_0x3e055f){return function(_0x3dde01){try{jsonpatch['apply'](_0x3dde01,_0x3e055f,!![]);}catch(_0x893127){return BPromise[_0xa731('0x2b')](_0x893127);}return _0x3dde01[_0xa731('0x2c')]();};}function saveUpdates(_0x1fa671,_0x3cd778){return function(_0x3301e0){if(_0x3301e0){return _0x3301e0['update'](_0x1fa671)['then'](function(_0x562c77){return _0x562c77;});}return null;};}function removeEntity(_0x55c604,_0x283b11){return function(_0x43a1d0){if(_0x43a1d0){return _0x43a1d0[_0xa731('0x2d')]()[_0xa731('0x2e')](function(){_0x55c604[_0xa731('0x23')](0xcc)[_0xa731('0x22')]();});}};}function handleEntityNotFound(_0x4cddc5,_0x1e1132){return function(_0x2c08fb){if(!_0x2c08fb){_0x4cddc5[_0xa731('0x21')](0x194);}return _0x2c08fb;};}function handleError(_0x424f1a,_0x508218){_0x508218=_0x508218||0x1f4;return function(_0x32bc30){logger[_0xa731('0x2f')](_0x32bc30['stack']);if(_0x32bc30[_0xa731('0x30')]){delete _0x32bc30[_0xa731('0x30')];}_0x424f1a['status'](_0x508218)[_0xa731('0x31')](_0x32bc30);};}exports[_0xa731('0x32')]=function(_0x5b88d6,_0x260f25){var _0x1517b4={},_0x1b9176={},_0x3d5f65={'count':0x0,'rows':[]};var _0x3927ff=_[_0xa731('0x33')](db['ChatInternalMessage'][_0xa731('0x34')],function(_0x5ecfea){return{'name':_0x5ecfea[_0xa731('0x35')],'type':_0x5ecfea['type'][_0xa731('0x36')]};});_0x1b9176['model']=_[_0xa731('0x33')](_0x3927ff,_0xa731('0x30'));_0x1b9176['query']=_[_0xa731('0x37')](_0x5b88d6[_0xa731('0x38')]);_0x1b9176[_0xa731('0x39')]=_[_0xa731('0x3a')](_0x1b9176[_0xa731('0x3b')],_0x1b9176[_0xa731('0x38')]);_0x1517b4[_0xa731('0x3c')]=_[_0xa731('0x3a')](_0x1b9176[_0xa731('0x3b')],qs[_0xa731('0x3d')](_0x5b88d6[_0xa731('0x38')][_0xa731('0x3d')]));_0x1517b4[_0xa731('0x3c')]=_0x1517b4[_0xa731('0x3c')]['length']?_0x1517b4[_0xa731('0x3c')]:_0x1b9176[_0xa731('0x3b')];if(!_0x5b88d6[_0xa731('0x38')][_0xa731('0x3e')](_0xa731('0x3f'))){_0x1517b4[_0xa731('0x26')]=qs[_0xa731('0x26')](_0x5b88d6[_0xa731('0x38')][_0xa731('0x26')]);_0x1517b4[_0xa731('0x24')]=qs[_0xa731('0x24')](_0x5b88d6[_0xa731('0x38')][_0xa731('0x24')]);}_0x1517b4[_0xa731('0x40')]=qs[_0xa731('0x41')](_0x5b88d6[_0xa731('0x38')][_0xa731('0x41')]);_0x1517b4['where']=qs['filters'](_['pick'](_0x5b88d6[_0xa731('0x38')],_0x1b9176[_0xa731('0x39')]),_0x3927ff);if(_0x5b88d6[_0xa731('0x38')][_0xa731('0x42')]){_0x1517b4[_0xa731('0x43')]=_[_0xa731('0x44')](_0x1517b4[_0xa731('0x43')],{'$or':_[_0xa731('0x33')](_0x3927ff,function(_0x5e9f2a){if(_0x5e9f2a[_0xa731('0x45')]!==_0xa731('0x46')){var _0x17bdc3={};_0x17bdc3[_0x5e9f2a[_0xa731('0x30')]]={'$like':'%'+_0x5b88d6[_0xa731('0x38')][_0xa731('0x42')]+'%'};return _0x17bdc3;}})});}_0x1517b4=_[_0xa731('0x44')]({},_0x1517b4,_0x5b88d6[_0xa731('0x47')]);var _0x2c1e59={'where':_0x1517b4['where']};return db[_0xa731('0x48')][_0xa731('0x27')](_0x2c1e59)[_0xa731('0x2e')](function(_0x56f87d){_0x3d5f65[_0xa731('0x27')]=_0x56f87d;if(_0x5b88d6[_0xa731('0x38')][_0xa731('0x49')]){_0x1517b4[_0xa731('0x4a')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xa731('0x4b')](_0x1517b4);})[_0xa731('0x2e')](function(_0x5a0325){_0x3d5f65[_0xa731('0x4c')]=_0x5a0325;return _0x3d5f65;})[_0xa731('0x2e')](respondWithFilteredResult(_0x260f25,_0x1517b4))[_0xa731('0x4d')](handleError(_0x260f25,null));};exports['show']=function(_0xe66db2,_0x2b1a11){var _0x4c2787={'raw':!![],'where':{'id':_0xe66db2[_0xa731('0x4e')]['id']}},_0x5a4698={};_0x5a4698[_0xa731('0x3b')]=_[_0xa731('0x37')](db[_0xa731('0x48')][_0xa731('0x34')]);_0x5a4698[_0xa731('0x38')]=_['keys'](_0xe66db2[_0xa731('0x38')]);_0x5a4698[_0xa731('0x39')]=_[_0xa731('0x3a')](_0x5a4698[_0xa731('0x3b')],_0x5a4698['query']);_0x4c2787[_0xa731('0x3c')]=_[_0xa731('0x3a')](_0x5a4698[_0xa731('0x3b')],qs[_0xa731('0x3d')](_0xe66db2['query'][_0xa731('0x3d')]));_0x4c2787[_0xa731('0x3c')]=_0x4c2787[_0xa731('0x3c')][_0xa731('0x4f')]?_0x4c2787[_0xa731('0x3c')]:_0x5a4698[_0xa731('0x3b')];if(_0xe66db2[_0xa731('0x38')][_0xa731('0x49')]){_0x4c2787['include']=[{'all':!![]}];}_0x4c2787=_['merge']({},_0x4c2787,_0xe66db2['options']);return db[_0xa731('0x48')][_0xa731('0x50')](_0x4c2787)['then'](handleEntityNotFound(_0x2b1a11,null))[_0xa731('0x2e')](respondWithResult(_0x2b1a11,null))[_0xa731('0x4d')](handleError(_0x2b1a11,null));};exports['create']=function(_0x40992a,_0x795463){return db[_0xa731('0x48')][_0xa731('0x51')](_0x40992a[_0xa731('0x52')],{})[_0xa731('0x2e')](respondWithResult(_0x795463,0xc9))[_0xa731('0x4d')](handleError(_0x795463,null));};exports[_0xa731('0x53')]=function(_0x54734f,_0x5ac8ed){if(_0x54734f[_0xa731('0x52')]['id']){delete _0x54734f[_0xa731('0x52')]['id'];}return db[_0xa731('0x48')]['find']({'where':{'id':_0x54734f['params']['id']}})[_0xa731('0x2e')](handleEntityNotFound(_0x5ac8ed,null))[_0xa731('0x2e')](saveUpdates(_0x54734f[_0xa731('0x52')],null))[_0xa731('0x2e')](respondWithResult(_0x5ac8ed,null))[_0xa731('0x4d')](handleError(_0x5ac8ed,null));};exports['destroy']=function(_0x103d1d,_0x57ac9c){return db['ChatInternalMessage'][_0xa731('0x50')]({'where':{'id':_0x103d1d['params']['id']}})[_0xa731('0x2e')](handleEntityNotFound(_0x57ac9c,null))[_0xa731('0x2e')](removeEntity(_0x57ac9c,null))[_0xa731('0x4d')](handleError(_0x57ac9c,null));};exports[_0xa731('0x54')]=function(_0x2ca617,_0x168a83){return db['ChatInternalMessage'][_0xa731('0x54')]()[_0xa731('0x2e')](respondWithResult(_0x168a83,null))['catch'](handleError(_0x168a83,null));};function wrapUser(_0x5db96d){return function(_0x3494eb){var _0x388f45=_0x5db96d[_0xa731('0x55')]({'plain':!![]});_0x388f45[_0xa731('0x56')]=[];if(_0x3494eb){_0x388f45['lastMessageAt']=_0x3494eb[_0xa731('0x57')];_0x388f45[_0xa731('0x58')]=_0x3494eb;}else{_0x388f45[_0xa731('0x59')]=moment(0x0)[_0xa731('0x5a')](_0xa731('0x5b'));_0x388f45[_0xa731('0x58')]={};}return _0x388f45;};}exports[_0xa731('0x5c')]=function(_0x43ebe6,_0x326d47,_0x49afe7){var _0x2f1546=[];return db[_0xa731('0x5d')][_0xa731('0x4b')]({'where':{'role':[_0xa731('0x5e'),_0xa731('0x5f'),'user']},'attributes':['id','fullname',_0xa731('0x30'),'role',_0xa731('0x60'),_0xa731('0x61'),_0xa731('0x62'),_0xa731('0x63'),_0xa731('0x64'),_0xa731('0x65')],'order':qs[_0xa731('0x41')](_0xa731('0x66')),'include':[{'model':db[_0xa731('0x67')],'as':'VoiceQueues','attributes':['id',_0xa731('0x30'),'type'],'through':{'attributes':[]}}]})[_0xa731('0x2e')](function(_0x373ac0){if(_0x373ac0){var _0x4b7967=_0x43ebe6[_0xa731('0x68')][_0xa731('0x55')]({'plain':!![]});if(!_0x4b7967)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b7967[_0xa731('0x69')]===_0xa731('0x68')){return db[_0xa731('0x6a')][_0xa731('0x50')]({'where':{'name':_0xa731('0x6b'),'userProfileId':_0x4b7967[_0xa731('0x6c')]},'raw':!![]})[_0xa731('0x2e')](function(_0x3014dd){if(_0x3014dd){if(_0x3014dd[_0xa731('0x6d')]===0x0){return db[_0xa731('0x6e')][_0xa731('0x4b')]({'where':{'sectionId':_0x3014dd['id']},'raw':!![]})[_0xa731('0x2e')](function(_0xb06b5){var _0x5978b2=[];if(_[_0xa731('0x6f')](_0xb06b5)){_0x5978b2=_[_0xa731('0x42')](_0x373ac0,function(_0x49c422){if(_0x49c422['role']!=='agent'){return _0x49c422;}});return _0x5978b2;}else{for(var _0x9527d8=0x0;_0x9527d8<_0x373ac0['length'];_0x9527d8++){var _0x23a0f8=_0x373ac0[_0x9527d8];if(_0x23a0f8[_0xa731('0x69')]==='agent'){var _0x3c6439=_['find'](_0xb06b5,function(_0x216540){return _0x216540[_0xa731('0x70')]===_0x23a0f8['id'];});if(_0x3c6439)_0x5978b2[_0xa731('0x71')](_0x23a0f8);}else{_0x5978b2[_0xa731('0x71')](_0x23a0f8);}}return _0x5978b2;}});}else{return _0x373ac0;}}else{var _0x11fd0a=_['filter'](_0x373ac0,function(_0x48ae81){if(_0x48ae81['role']!==_0xa731('0x5e')){return _0x48ae81;}});return _0x11fd0a;}});}else{return _0x373ac0;}}})[_0xa731('0x2e')](function(_0x6ecdff){var _0x2716cf=[];if(_0x6ecdff){_0x2f1546=_0x6ecdff;for(var _0x431b4e=0x0;_0x431b4e<_0x6ecdff[_0xa731('0x4f')];_0x431b4e+=0x1){_0x2f1546[_0x431b4e][_0xa731('0x56')]=[];_0x2716cf[_0xa731('0x71')](db[_0xa731('0x48')][_0xa731('0x50')]({'where':{'FromId':[_0x43ebe6['user']['id'],_0x6ecdff[_0x431b4e]['id']],'ToId':[_0x43ebe6[_0xa731('0x68')]['id'],_0x6ecdff[_0x431b4e]['id']],'ChatGroupId':null},'attributes':['id',_0xa731('0x57'),_0xa731('0x72'),'ToId','read','body'],'order':qs[_0xa731('0x41')](_0xa731('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x6ecdff[_0x431b4e])));}return BPromise[_0xa731('0x74')](_0x2716cf);}return[];})[_0xa731('0x2e')](function(_0x1eadf8){return{'rows':_0x1eadf8,'count':_0x1eadf8[_0xa731('0x4f')]};})[_0xa731('0x2e')](respondWithResult(_0x326d47,null))['catch'](handleError(_0x326d47,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8bbc484..99af022 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 _0xc195=['save','update','emit','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x431e0d,_0x2140c0){var _0x2f0c81=function(_0x4f148f){while(--_0x4f148f){_0x431e0d['push'](_0x431e0d['shift']());}};_0x2f0c81(++_0x2140c0);}(_0xc195,0x95));var _0x5c19=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0xc195[_0x32b30c];return _0xcfc212;};'use strict';var EventEmitter=require(_0x5c19('0x0'));var ChatInternalMessage=require(_0x5c19('0x1'))['db'][_0x5c19('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c19('0x3'),'afterUpdate':_0x5c19('0x4'),'afterDestroy':'remove'};function emitEvent(_0x44b265){return function(_0x475591,_0x17c4b6,_0x3243f2){ChatInternalMessageEvents[_0x5c19('0x5')](_0x44b265+':'+_0x475591['id'],_0x475591);ChatInternalMessageEvents[_0x5c19('0x5')](_0x44b265,_0x475591);_0x3243f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x5c19('0x6')](e,emitEvent(event));}}module[_0x5c19('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6e87=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6e87,0x7e));var _0x76e8=function(_0x36d15a,_0x46622f){_0x36d15a=_0x36d15a-0x0;var _0x438101=_0x6e87[_0x36d15a];return _0x438101;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x76e8('0x0'))['db'][_0x76e8('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x76e8('0x2')](0x0);var events={'afterCreate':_0x76e8('0x3'),'afterUpdate':_0x76e8('0x4'),'afterDestroy':_0x76e8('0x5')};function emitEvent(_0x4f58ba){return function(_0x595090,_0x329714,_0x10fb54){ChatInternalMessageEvents[_0x76e8('0x6')](_0x4f58ba+':'+_0x595090['id'],_0x595090);ChatInternalMessageEvents[_0x76e8('0x6')](_0x4f58ba,_0x595090);_0x10fb54(null);};}for(var e in events){if(events[_0x76e8('0x7')](e)){var event=events[e];ChatInternalMessage[_0x76e8('0x8')](e,emitEvent(event));}}module[_0x76e8('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 149873b..11f83cd 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 _0xadc4=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xadc4,0x195));var _0x4adc=function(_0x1b0601,_0x553222){_0x1b0601=_0x1b0601-0x0;var _0x40dbdc=_0xadc4[_0x1b0601];return _0x40dbdc;};'use strict';var _=require(_0x4adc('0x0'));var util=require(_0x4adc('0x1'));var logger=require('../../config/logger')(_0x4adc('0x2'));var moment=require(_0x4adc('0x3'));var BPromise=require(_0x4adc('0x4'));var rp=require(_0x4adc('0x5'));var fs=require('fs');var path=require(_0x4adc('0x6'));var rimraf=require(_0x4adc('0x7'));var config=require(_0x4adc('0x8'));var attributes=require(_0x4adc('0x9'));module[_0x4adc('0xa')]=function(_0x396bbe,_0x56b207){return _0x396bbe['define']('ChatInternalMessage',attributes,{'tableName':_0x4adc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4adc('0xc'),'collate':_0x4adc('0xd')});}; \ No newline at end of file +var _0x3324=['request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','../../config/logger','moment','bluebird'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x3324,0x1bc));var _0x4332=function(_0x33b8e3,_0x1cb00a){_0x33b8e3=_0x33b8e3-0x0;var _0x225c53=_0x3324[_0x33b8e3];return _0x225c53;};'use strict';var _=require(_0x4332('0x0'));var util=require('util');var logger=require(_0x4332('0x1'))('api');var moment=require(_0x4332('0x2'));var BPromise=require(_0x4332('0x3'));var rp=require(_0x4332('0x4'));var fs=require('fs');var path=require(_0x4332('0x5'));var rimraf=require(_0x4332('0x6'));var config=require(_0x4332('0x7'));var attributes=require(_0x4332('0x8'));module[_0x4332('0x9')]=function(_0x145adb,_0x18933c){return _0x145adb[_0x4332('0xa')](_0x4332('0xb'),attributes,{'tableName':_0x4332('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4332('0xd'),'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 3c7ddd6..21ae23d 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 _0x4891=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent'];(function(_0x36016f,_0x2c389d){var _0x504656=function(_0x22bb15){while(--_0x22bb15){_0x36016f['push'](_0x36016f['shift']());}};_0x504656(++_0x2c389d);}(_0x4891,0x166));var _0x1489=function(_0x4d9863,_0x4a7666){_0x4d9863=_0x4d9863-0x0;var _0x4c6e64=_0x4891[_0x4d9863];return _0x4c6e64;};'use strict';var _=require(_0x1489('0x0'));var util=require(_0x1489('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1489('0x2'));var db=require(_0x1489('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1489('0x4'))('rpc');var config=require(_0x1489('0x5'));var jayson=require(_0x1489('0x6'));var client=jayson[_0x1489('0x7')]['http']({'port':0x232a});config[_0x1489('0x8')]=_['defaults'](config[_0x1489('0x8')],{'host':_0x1489('0x9'),'port':0x18eb});var socket=require(_0x1489('0xa'))(new Redis(config[_0x1489('0x8')]));require(_0x1489('0xb'))[_0x1489('0xc')](socket);function respondWithRpcPromise(_0x109fea,_0x48805c,_0x550283){return new BPromise(function(_0x243644,_0x423118){return client[_0x1489('0xd')](_0x109fea,_0x550283)[_0x1489('0xe')](function(_0x321df5){logger[_0x1489('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x1489('0x10'));logger['debug'](_0x1489('0x11'),_0x48805c,_0x1489('0x10'),JSON[_0x1489('0x12')](_0x321df5));if(_0x321df5[_0x1489('0x13')]){if(_0x321df5[_0x1489('0x13')][_0x1489('0x14')]===0x1f4){logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5['error'][_0x1489('0x15')]);return _0x423118(_0x321df5['error'][_0x1489('0x15')]);}logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);return _0x243644(_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);}else{logger[_0x1489('0xf')](_0x1489('0x16'),_0x48805c,'request\x20sent');_0x243644(_0x321df5[_0x1489('0x17')][_0x1489('0x15')]);}})[_0x1489('0x18')](function(_0x597b4f){logger[_0x1489('0x13')](_0x1489('0x16'),_0x48805c,_0x597b4f);_0x423118(_0x597b4f);});});} \ No newline at end of file +var _0xf589=['info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then'];(function(_0x219c85,_0x3996cd){var _0x2418a1=function(_0x18c511){while(--_0x18c511){_0x219c85['push'](_0x219c85['shift']());}};_0x2418a1(++_0x3996cd);}(_0xf589,0xe1));var _0x9f58=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xf589[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x9f58('0x0'));var util=require(_0x9f58('0x1'));var moment=require('moment');var BPromise=require(_0x9f58('0x2'));var rs=require(_0x9f58('0x3'));var fs=require('fs');var Redis=require(_0x9f58('0x4'));var db=require(_0x9f58('0x5'))['db'];var utils=require(_0x9f58('0x6'));var logger=require(_0x9f58('0x7'))(_0x9f58('0x8'));var config=require('../../config/environment');var jayson=require(_0x9f58('0x9'));var client=jayson['client'][_0x9f58('0xa')]({'port':0x232a});config[_0x9f58('0xb')]=_[_0x9f58('0xc')](config[_0x9f58('0xb')],{'host':_0x9f58('0xd'),'port':0x18eb});var socket=require(_0x9f58('0xe'))(new Redis(config[_0x9f58('0xb')]));require(_0x9f58('0xf'))['register'](socket);function respondWithRpcPromise(_0x399624,_0x196cd7,_0x3ceb43){return new BPromise(function(_0x52262a,_0x2da168){return client[_0x9f58('0x10')](_0x399624,_0x3ceb43)[_0x9f58('0x11')](function(_0x477e40){logger[_0x9f58('0x12')](_0x9f58('0x13'),_0x196cd7,_0x9f58('0x14'));logger[_0x9f58('0x15')](_0x9f58('0x16'),_0x196cd7,_0x9f58('0x14'),JSON[_0x9f58('0x17')](_0x477e40));if(_0x477e40[_0x9f58('0x18')]){if(_0x477e40[_0x9f58('0x18')]['code']===0x1f4){logger[_0x9f58('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x196cd7,_0x477e40[_0x9f58('0x18')][_0x9f58('0x19')]);return _0x2da168(_0x477e40['error'][_0x9f58('0x19')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x196cd7,_0x477e40[_0x9f58('0x18')]['message']);return _0x52262a(_0x477e40[_0x9f58('0x18')][_0x9f58('0x19')]);}else{logger[_0x9f58('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x196cd7,'request\x20sent');_0x52262a(_0x477e40['result'][_0x9f58('0x19')]);}})[_0x9f58('0x1a')](function(_0x1d5b1b){logger[_0x9f58('0x18')](_0x9f58('0x13'),_0x196cd7,_0x1d5b1b);_0x2da168(_0x1d5b1b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 353de52..6791516 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 _0x3b4d=['remove','update','emit','removeListener'];(function(_0x54845b,_0x2357db){var _0x430c18=function(_0x214e41){while(--_0x214e41){_0x54845b['push'](_0x54845b['shift']());}};_0x430c18(++_0x2357db);}(_0x3b4d,0x9c));var _0xd3b4=function(_0x442dbf,_0x117087){_0x442dbf=_0x442dbf-0x0;var _0x294658=_0x3b4d[_0x442dbf];return _0x294658;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xd3b4('0x0'),_0xd3b4('0x1')];function createListener(_0x120ec8,_0x345560){return function(_0x35d8c8){_0x345560[_0xd3b4('0x2')](_0x120ec8,_0x35d8c8);};}function removeListener(_0x5221a8,_0x4d4d9a){return function(){ChatInternalMessageEvents[_0xd3b4('0x3')](_0x5221a8,_0x4d4d9a);};}exports['register']=function(_0x16c0aa){for(var _0x452275=0x0,_0x2f6bb4=events['length'];_0x452275<_0x2f6bb4;_0x452275++){var _0x400c6b=events[_0x452275];var _0x477346=createListener('chatInternalMessage:'+_0x400c6b,_0x16c0aa);ChatInternalMessageEvents['on'](_0x400c6b,_0x477346);}}; \ No newline at end of file +var _0x0baf=['remove','removeListener','chatInternalMessage:'];(function(_0x3842cb,_0x4ed85f){var _0x5f9e18=function(_0x20eb16){while(--_0x20eb16){_0x3842cb['push'](_0x3842cb['shift']());}};_0x5f9e18(++_0x4ed85f);}(_0x0baf,0x72));var _0xf0ba=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x0baf[_0x44a64f];return _0x52024b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xf0ba('0x0'),'update'];function createListener(_0x472e9e,_0x4d5c41){return function(_0x16df08){_0x4d5c41['emit'](_0x472e9e,_0x16df08);};}function removeListener(_0x36e9e2,_0x5491fc){return function(){ChatInternalMessageEvents[_0xf0ba('0x1')](_0x36e9e2,_0x5491fc);};}exports['register']=function(_0xf9a59a){for(var _0x1f6395=0x0,_0x227d3c=events['length'];_0x1f6395<_0x227d3c;_0x1f6395++){var _0x3297dc=events[_0x1f6395];var _0xfb6697=createListener(_0xf0ba('0x2')+_0x3297dc,_0xf9a59a);ChatInternalMessageEvents['on'](_0x3297dc,_0xfb6697);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 00be6d4..ca8b32f 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 _0xfce1=['delete','util','path','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','create','put','/:id','update'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xfce1,0xf1));var _0x1fce=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xfce1[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x1fce('0x0'));var path=require(_0x1fce('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1fce('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1fce('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1fce('0x4'));var controller=require(_0x1fce('0x5'));router[_0x1fce('0x6')]('/',auth[_0x1fce('0x7')](),controller['index']);router[_0x1fce('0x6')](_0x1fce('0x8'),auth[_0x1fce('0x7')](),controller[_0x1fce('0x9')]);router[_0x1fce('0x6')]('/users',auth[_0x1fce('0x7')](),controller[_0x1fce('0xa')]);router['get']('/:id',auth[_0x1fce('0x7')](),controller['show']);router['post']('/',auth[_0x1fce('0x7')](),controller[_0x1fce('0xb')]);router[_0x1fce('0xc')](_0x1fce('0xd'),controller[_0x1fce('0xe')]);router[_0x1fce('0xf')]('/:id',auth[_0x1fce('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdaa2=['delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdaa2,0xf9));var _0x2daa=function(_0x48da1f,_0x1a6b9d){_0x48da1f=_0x48da1f-0x0;var _0x335649=_0xdaa2[_0x48da1f];return _0x335649;};'use strict';var multer=require(_0x2daa('0x0'));var util=require('util');var path=require(_0x2daa('0x1'));var timeout=require('connect-timeout');var express=require(_0x2daa('0x2'));var router=express['Router']();var fs_extra=require(_0x2daa('0x3'));var auth=require(_0x2daa('0x4'));var interaction=require(_0x2daa('0x5'));var config=require('../../config/environment');var controller=require(_0x2daa('0x6'));router[_0x2daa('0x7')]('/',auth[_0x2daa('0x8')](),controller[_0x2daa('0x9')]);router[_0x2daa('0x7')]('/describe',auth[_0x2daa('0x8')](),controller[_0x2daa('0xa')]);router[_0x2daa('0x7')](_0x2daa('0xb'),auth['isAuthenticated'](),controller[_0x2daa('0xc')]);router[_0x2daa('0x7')](_0x2daa('0xd'),auth['isAuthenticated'](),controller[_0x2daa('0xe')]);router[_0x2daa('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2daa('0xd'),controller[_0x2daa('0x10')]);router[_0x2daa('0x11')](_0x2daa('0xd'),auth['isAuthenticated'](),controller[_0x2daa('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b01f37f..2cdff8a 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 _0xb84e=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x28f12b,_0x3d0701){var _0x2f2375=function(_0x27a6b1){while(--_0x27a6b1){_0x28f12b['push'](_0x28f12b['shift']());}};_0x2f2375(++_0x3d0701);}(_0xb84e,0xbf));var _0xeb84=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0xb84e[_0x38ce4c];return _0x5d4544;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'body':{'type':Sequelize[_0xeb84('0x1')](_0xeb84('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeb84('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xeb84('0x4')),'defaultValue':_0xeb84('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb84('0x5')]},'providerName':{'type':Sequelize[_0xeb84('0x6')]},'providerResponse':{'type':Sequelize[_0xeb84('0x1')]}}; \ No newline at end of file +var _0x153c=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x28b820,_0x414481){var _0x4ae8c5=function(_0x3916c8){while(--_0x3916c8){_0x28b820['push'](_0x28b820['shift']());}};_0x4ae8c5(++_0x414481);}(_0x153c,0x8c));var _0xc153=function(_0x164800,_0x8d7cf2){_0x164800=_0x164800-0x0;var _0x3c641b=_0x153c[_0x164800];return _0x3c641b;};'use strict';var Sequelize=require(_0xc153('0x0'));module[_0xc153('0x1')]={'body':{'type':Sequelize[_0xc153('0x2')](_0xc153('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xc153('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc153('0x5')]('in',_0xc153('0x6')),'defaultValue':_0xc153('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc153('0x7')]},'providerName':{'type':Sequelize[_0xc153('0x8')]},'providerResponse':{'type':Sequelize[_0xc153('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d423c70..4124f39 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 _0x890a=['ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','describe','chat-interactions','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x229f6f,_0x22674e){var _0x9c3565=function(_0x435499){while(--_0x435499){_0x229f6f['push'](_0x229f6f['shift']());}};_0x9c3565(++_0x22674e);}(_0x890a,0xe8));var _0xa890=function(_0x391e33,_0x448af9){_0x391e33=_0x391e33-0x0;var _0x5cdf62=_0x890a[_0x391e33];return _0x5cdf62;};'use strict';var emlformat=require(_0xa890('0x0'));var rimraf=require(_0xa890('0x1'));var zipdir=require(_0xa890('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa890('0x3'));var moment=require(_0xa890('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa890('0x5'));var path=require(_0xa890('0x6'));var sox=require(_0xa890('0x7'));var csv=require(_0xa890('0x8'));var ejs=require(_0xa890('0x9'));var fs=require('fs');var fs_extra=require(_0xa890('0xa'));var _=require(_0xa890('0xb'));var squel=require('squel');var crypto=require(_0xa890('0xc'));var jsforce=require(_0xa890('0xd'));var deskjs=require(_0xa890('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa890('0xf'));var Papa=require(_0xa890('0x10'));var Redis=require(_0xa890('0x11'));var authService=require(_0xa890('0x12'));var qs=require(_0xa890('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa890('0x14'))(_0xa890('0x15'));var utils=require(_0xa890('0x16'));var config=require(_0xa890('0x17'));var licenseUtil=require(_0xa890('0x18'));var db=require(_0xa890('0x19'))['db'];config[_0xa890('0x1a')]=_[_0xa890('0x1b')](config['redis'],{'host':_0xa890('0x1c'),'port':0x18eb});var socket=require(_0xa890('0x1d'))(new Redis(config[_0xa890('0x1a')]));require('./chatMessage.socket')[_0xa890('0x1e')](socket);var jayson=require(_0xa890('0x1f'));var client=jayson[_0xa890('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xa890('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18e69b,_0x17b383,_0x359c67,_0x260682){return new BPromise(function(_0x4c8000,_0x163c58){var _0xe965fb=_0x260682||client;return _0xe965fb[_0xa890('0x21')](_0x18e69b,_0x359c67)[_0xa890('0x22')](function(_0x48b057){logger[_0xa890('0x23')]('ChatMessage,\x20%s,\x20%s',_0x17b383,_0xa890('0x24'));logger[_0xa890('0x25')](_0xa890('0x26'),_0x17b383,'request\x20sent',JSON[_0xa890('0x27')](_0x48b057));if(_0x48b057[_0xa890('0x28')]){if(_0x48b057[_0xa890('0x28')][_0xa890('0x29')]===0x1f4){logger[_0xa890('0x28')](_0xa890('0x2a'),_0x17b383,_0x48b057[_0xa890('0x28')][_0xa890('0x2b')]);return _0x163c58(_0x48b057[_0xa890('0x28')]['message']);}logger[_0xa890('0x28')](_0xa890('0x2a'),_0x17b383,_0x48b057[_0xa890('0x28')][_0xa890('0x2b')]);return _0x4c8000(_0x48b057[_0xa890('0x28')][_0xa890('0x2b')]);}else{logger[_0xa890('0x23')](_0xa890('0x2a'),_0x17b383,_0xa890('0x24'));_0x4c8000(_0x48b057[_0xa890('0x2c')]['message']);}})[_0xa890('0x2d')](function(_0x19c466){logger[_0xa890('0x28')](_0xa890('0x2a'),_0x17b383,_0x19c466);_0x163c58(_0x19c466);});});}function respondWithStatusCode(_0xc13efe,_0x12b18c){_0x12b18c=_0x12b18c||0xcc;return function(_0xedd4c7){if(_0xedd4c7){return _0xc13efe[_0xa890('0x2e')](_0x12b18c);}return _0xc13efe[_0xa890('0x2f')](_0x12b18c)[_0xa890('0x30')]();};}function respondWithResult(_0x4baa35,_0xee9d29){_0xee9d29=_0xee9d29||0xc8;return function(_0x156c01){if(_0x156c01){return _0x4baa35[_0xa890('0x2f')](_0xee9d29)['json'](_0x156c01);}};}function respondWithFilteredResult(_0x2a1ffe,_0x5e1968){return function(_0x3e7cde){if(_0x3e7cde){var _0x219db4=typeof _0x5e1968[_0xa890('0x31')]===_0xa890('0x32')&&typeof _0x5e1968[_0xa890('0x33')]===_0xa890('0x32');var _0x3698a8=_0x3e7cde['count'];var _0x553da2=_0x219db4?0x0:_0x5e1968['offset'];var _0x8d9f48=_0x219db4?_0x3e7cde['count']:_0x5e1968[_0xa890('0x31')]+_0x5e1968[_0xa890('0x33')];var _0x307cd1;if(_0x8d9f48>=_0x3698a8){_0x8d9f48=_0x3698a8;_0x307cd1=0xc8;}else{_0x307cd1=0xce;}_0x2a1ffe[_0xa890('0x2f')](_0x307cd1);return _0x2a1ffe[_0xa890('0x34')](_0xa890('0x35'),_0x553da2+'-'+_0x8d9f48+'/'+_0x3698a8)[_0xa890('0x36')](_0x3e7cde);}return null;};}function patchUpdates(_0x2c80ee){return function(_0x5e2794){try{jsonpatch[_0xa890('0x37')](_0x5e2794,_0x2c80ee,!![]);}catch(_0x76c444){return BPromise[_0xa890('0x38')](_0x76c444);}return _0x5e2794[_0xa890('0x39')]();};}function saveUpdates(_0x765fde,_0x35628d){return function(_0x361b73){if(_0x361b73){return _0x361b73[_0xa890('0x3a')](_0x765fde)[_0xa890('0x22')](function(_0x295086){return _0x295086;});}return null;};}function removeEntity(_0x92711,_0x5b18b8){return function(_0x106f0d){if(_0x106f0d){return _0x106f0d[_0xa890('0x3b')]()['then'](function(){_0x92711['status'](0xcc)[_0xa890('0x30')]();});}};}function handleEntityNotFound(_0x471816,_0xe3eac3){return function(_0x4d1d74){if(!_0x4d1d74){_0x471816[_0xa890('0x2e')](0x194);}return _0x4d1d74;};}function handleError(_0x2969cb,_0x121b37){_0x121b37=_0x121b37||0x1f4;return function(_0x4903a8){logger[_0xa890('0x28')](_0x4903a8[_0xa890('0x3c')]);if(_0x4903a8[_0xa890('0x3d')]){delete _0x4903a8[_0xa890('0x3d')];}_0x2969cb[_0xa890('0x2f')](_0x121b37)[_0xa890('0x3e')](_0x4903a8);};}exports[_0xa890('0x3f')]=function(_0x159ef6,_0x10456d){var _0x111a51={},_0x3ab943={},_0x84d081={'count':0x0,'rows':[]};var _0x9e946f=_[_0xa890('0x40')](db[_0xa890('0x41')]['rawAttributes'],function(_0x26b526){return{'name':_0x26b526[_0xa890('0x42')],'type':_0x26b526['type']['key']};});_0x3ab943[_0xa890('0x43')]=_[_0xa890('0x40')](_0x9e946f,'name');_0x3ab943[_0xa890('0x44')]=_[_0xa890('0x45')](_0x159ef6[_0xa890('0x44')]);_0x3ab943[_0xa890('0x46')]=_['intersection'](_0x3ab943[_0xa890('0x43')],_0x3ab943['query']);_0x111a51['attributes']=_[_0xa890('0x47')](_0x3ab943[_0xa890('0x43')],qs['fields'](_0x159ef6[_0xa890('0x44')][_0xa890('0x48')]));_0x111a51[_0xa890('0x49')]=_0x111a51['attributes']['length']?_0x111a51[_0xa890('0x49')]:_0x3ab943[_0xa890('0x43')];if(!_0x159ef6['query'][_0xa890('0x4a')](_0xa890('0x4b'))){_0x111a51[_0xa890('0x33')]=qs[_0xa890('0x33')](_0x159ef6['query']['limit']);_0x111a51['offset']=qs[_0xa890('0x31')](_0x159ef6['query'][_0xa890('0x31')]);}_0x111a51[_0xa890('0x4c')]=qs[_0xa890('0x4d')](_0x159ef6[_0xa890('0x44')]['sort']);_0x111a51[_0xa890('0x4e')]=qs[_0xa890('0x46')](_[_0xa890('0x4f')](_0x159ef6[_0xa890('0x44')],_0x3ab943[_0xa890('0x46')]),_0x9e946f);if(_0x159ef6[_0xa890('0x44')][_0xa890('0x50')]){_0x111a51[_0xa890('0x4e')]=_['merge'](_0x111a51[_0xa890('0x4e')],{'$or':_[_0xa890('0x40')](_0x9e946f,function(_0x461cec){if(_0x461cec['type']!==_0xa890('0x51')){var _0x432049={};_0x432049[_0x461cec['name']]={'$like':'%'+_0x159ef6[_0xa890('0x44')]['filter']+'%'};return _0x432049;}})});}_0x111a51=_[_0xa890('0x52')]({},_0x111a51,_0x159ef6[_0xa890('0x53')]);var _0x2ab6b3={'where':_0x111a51['where']};return db['ChatMessage']['count'](_0x2ab6b3)[_0xa890('0x22')](function(_0x108bcb){_0x84d081[_0xa890('0x54')]=_0x108bcb;if(_0x159ef6[_0xa890('0x44')]['includeAll']){_0x111a51[_0xa890('0x55')]=[{'all':!![]}];}return db[_0xa890('0x41')][_0xa890('0x56')](_0x111a51);})[_0xa890('0x22')](function(_0xb3a8ee){_0x84d081[_0xa890('0x57')]=_0xb3a8ee;return _0x84d081;})[_0xa890('0x22')](respondWithFilteredResult(_0x10456d,_0x111a51))[_0xa890('0x2d')](handleError(_0x10456d,null));};exports[_0xa890('0x58')]=function(_0x4021e3,_0x3b0905){var _0x4ebec6={'raw':!![],'where':{'id':_0x4021e3[_0xa890('0x59')]['id']}},_0x3ffffa={};_0x3ffffa['model']=_[_0xa890('0x45')](db[_0xa890('0x41')][_0xa890('0x5a')]);_0x3ffffa[_0xa890('0x44')]=_[_0xa890('0x45')](_0x4021e3[_0xa890('0x44')]);_0x3ffffa['filters']=_[_0xa890('0x47')](_0x3ffffa[_0xa890('0x43')],_0x3ffffa[_0xa890('0x44')]);_0x4ebec6['attributes']=_[_0xa890('0x47')](_0x3ffffa[_0xa890('0x43')],qs[_0xa890('0x48')](_0x4021e3[_0xa890('0x44')][_0xa890('0x48')]));_0x4ebec6[_0xa890('0x49')]=_0x4ebec6[_0xa890('0x49')]['length']?_0x4ebec6[_0xa890('0x49')]:_0x3ffffa[_0xa890('0x43')];if(_0x4021e3[_0xa890('0x44')][_0xa890('0x5b')]){_0x4ebec6[_0xa890('0x55')]=[{'all':!![]}];}_0x4ebec6=_[_0xa890('0x52')]({},_0x4ebec6,_0x4021e3[_0xa890('0x53')]);return db[_0xa890('0x41')][_0xa890('0x5c')](_0x4ebec6)[_0xa890('0x22')](handleEntityNotFound(_0x3b0905,null))[_0xa890('0x22')](respondWithResult(_0x3b0905,null))[_0xa890('0x2d')](handleError(_0x3b0905,null));};exports['create']=function(_0x418406,_0x25c0ac){return db[_0xa890('0x41')][_0xa890('0x5d')](_0x418406['body'],{})[_0xa890('0x22')](respondWithResult(_0x25c0ac,0xc9))['catch'](handleError(_0x25c0ac,null));};exports['update']=function(_0x454faf,_0x2402a1){if(_0x454faf[_0xa890('0x5e')]['id']){delete _0x454faf[_0xa890('0x5e')]['id'];}return db['ChatMessage'][_0xa890('0x5c')]({'where':{'id':_0x454faf[_0xa890('0x59')]['id']}})['then'](handleEntityNotFound(_0x2402a1,null))[_0xa890('0x22')](saveUpdates(_0x454faf[_0xa890('0x5e')],null))[_0xa890('0x22')](respondWithResult(_0x2402a1,null))[_0xa890('0x2d')](handleError(_0x2402a1,null));};exports[_0xa890('0x3b')]=function(_0x4ca066,_0x43ca88){return db[_0xa890('0x41')]['find']({'where':{'id':_0x4ca066[_0xa890('0x59')]['id']}})[_0xa890('0x22')](handleEntityNotFound(_0x43ca88,null))[_0xa890('0x22')](removeEntity(_0x43ca88,null))['catch'](handleError(_0x43ca88,null));};exports[_0xa890('0x5f')]=function(_0x25a78b,_0xde87ae){return db[_0xa890('0x41')][_0xa890('0x5f')]()['then'](respondWithResult(_0xde87ae,null))[_0xa890('0x2d')](handleError(_0xde87ae,null));};var interaction_log=require(_0xa890('0x14'))(_0xa890('0x60'));exports['accept']=function(_0x3b5b70,_0x1a7984,_0x3b8933){var _0x5775a8={'agent':{},'channel':_0xa890('0x61')};if(_0x3b5b70['body']['id']){delete _0x3b5b70[_0xa890('0x5e')]['id'];}_0x3b5b70['body'][_0xa890('0x62')]=!![];_0x3b5b70[_0xa890('0x5e')]['readAt']=moment()[_0xa890('0x63')](_0xa890('0x64'));_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')]=_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')]||_0x3b5b70[_0xa890('0x66')]['id'];_0x5775a8[_0xa890('0x67')]['id']=_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')];return db[_0xa890('0x41')]['find']({'where':{'id':_0x3b5b70['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a7984,null))[_0xa890('0x22')](saveUpdates(_0x3b5b70[_0xa890('0x5e')],null))[_0xa890('0x22')](function(_0xde5d07){if(_0xde5d07){_0x5775a8['message']=_0xde5d07[_0xa890('0x68')]({'plain':!![]});return db[_0xa890('0x69')][_0xa890('0x5c')]({'where':{'id':_0xde5d07[_0xa890('0x6a')]}});}return null;})[_0xa890('0x22')](handleEntityNotFound(_0x1a7984,null))[_0xa890('0x22')](function(_0x1611fa){if(_0x1611fa){return _0x1611fa[_0xa890('0x3a')]({'UserId':_0x3b5b70['body'][_0xa890('0x65')],'read1stAt':_[_0xa890('0x6b')](_0x1611fa['read1stAt'])?moment()[_0xa890('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa890('0x22')](function(_0x4b3022){if(_0x4b3022){_0x5775a8[_0xa890('0x6c')]=_0x4b3022[_0xa890('0x68')]({'plain':!![]});interaction_log['info'](_0xa890('0x6d'),_0x3b5b70['user']['id'],_0x3b5b70[_0xa890('0x66')][_0xa890('0x3d')],_0x3b5b70[_0xa890('0x66')][_0xa890('0x6e')],_0x5775a8[_0xa890('0x6c')]['id'],_0x3b5b70[_0xa890('0x5e')]?JSON[_0xa890('0x27')](_0x3b5b70[_0xa890('0x5e')]):_0xa890('0x6f'));return respondWithRpcPromise(_0xa890('0x70'),_0xa890('0x71'),_0x5775a8);}return null;})['then'](function(_0x46e83c){var _0x577a04=_0xa890('0x72')+_0x46e83c[_0xa890('0x2b')][_0xa890('0x73')];return db[_0xa890('0x74')][_0xa890('0x44')](_0x577a04,{'type':db[_0xa890('0x75')][_0xa890('0x76')][_0xa890('0x77')],'raw':!![]})[_0xa890('0x22')](function(_0x3287c9){return _0x3287c9;});})[_0xa890('0x22')](function(_0x48e82b){if(_0x48e82b){_0x5775a8[_0xa890('0x2b')][_0xa890('0x78')]=_0x48e82b[0x0];if(!_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')])return;return db[_0xa890('0x79')][_0xa890('0x5c')]({'where':{'id':_0x3b5b70[_0xa890('0x5e')][_0xa890('0x65')],'role':_0xa890('0x67')},'attributes':['id',_0xa890('0x3d'),_0xa890('0x7a'),_0xa890('0x7b'),_0xa890('0x7c')],'raw':!![]});}return null;})[_0xa890('0x22')](function(_0xdab831){if(!_0xdab831)return null;_0x5775a8[_0xa890('0x2b')][_0xa890('0x67')]=_0xdab831;return _0x5775a8;})[_0xa890('0x22')](function(_0x1280e8){if(_0x1280e8){if(_0x3b5b70[_0xa890('0x5e')][_0xa890('0x7d')]){_0x5775a8[_0xa890('0x2b')][_0xa890('0x7e')]=util[_0xa890('0x63')]('SIP/%s',_0x3b5b70[_0xa890('0x66')][_0xa890('0x3d')]);_0x5775a8[_0xa890('0x2b')]['channel']=_0x5775a8[_0xa890('0x7f')];_0x5775a8[_0xa890('0x2b')][_0xa890('0x80')]=_0x5775a8['channel'];_0x5775a8[_0xa890('0x2b')][_0xa890('0x81')]=_0xa890('0x82');return respondWithRpcPromise(_0xa890('0x83'),'EventManager',{'event':'acceptmessage','message':_[_0xa890('0x52')](_0x5775a8[_0xa890('0x2b')],JSON['parse'](_0x5775a8[_0xa890('0x6c')]['formData']))},client9002)[_0xa890('0x22')](function(){return _0x5775a8;});}return _0x5775a8;}return null;})['then'](respondWithResult(_0x1a7984,null))[_0xa890('0x2d')](handleError(_0x1a7984,null));};var interaction_log=require('../../config/logger')(_0xa890('0x60'));exports[_0xa890('0x38')]=function(_0x516681,_0x2f8131,_0x290a5d){var _0x25f1e5={'agent':{},'channel':_0xa890('0x61')};if(_0x516681[_0xa890('0x5e')]['id']){delete _0x516681['body']['id'];}_0x516681[_0xa890('0x5e')][_0xa890('0x65')]=_0x516681[_0xa890('0x5e')][_0xa890('0x65')]||_0x516681[_0xa890('0x66')]['id'];_0x25f1e5[_0xa890('0x67')]['id']=_0x516681[_0xa890('0x5e')][_0xa890('0x65')];return db[_0xa890('0x41')]['find']({'where':{'id':_0x516681['params']['id'],'UserId':null}})[_0xa890('0x22')](handleEntityNotFound(_0x2f8131,null))[_0xa890('0x22')](function(_0x2215b9){if(_0x2215b9){_0x25f1e5[_0xa890('0x2b')]=_0x2215b9['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2215b9['ChatInteractionId']}});}return null;})[_0xa890('0x22')](handleEntityNotFound(_0x2f8131,null))[_0xa890('0x22')](function(_0x5bb85d){if(_0x5bb85d){_0x25f1e5[_0xa890('0x6c')]=_0x5bb85d[_0xa890('0x68')]({'plain':!![]});interaction_log[_0xa890('0x23')](_0xa890('0x84'),_0x516681['user']['id'],_0x516681[_0xa890('0x66')][_0xa890('0x3d')],_0x516681[_0xa890('0x66')][_0xa890('0x6e')],_0x25f1e5[_0xa890('0x6c')]['id'],_0x516681[_0xa890('0x5e')]?JSON[_0xa890('0x27')](_0x516681[_0xa890('0x5e')]):_0xa890('0x6f'));return respondWithRpcPromise('RejectMessage',_0xa890('0x85'),_0x25f1e5);}return null;})[_0xa890('0x22')](function(_0x83a89d){var _0x1e718d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x83a89d['message'][_0xa890('0x73')];return db['sequelize'][_0xa890('0x44')](_0x1e718d,{'type':db[_0xa890('0x75')][_0xa890('0x76')][_0xa890('0x77')],'raw':!![]})[_0xa890('0x22')](function(_0x5a419b){return _0x5a419b;});})[_0xa890('0x22')](function(_0x271aa6){if(_0x271aa6){_0x25f1e5[_0xa890('0x2b')][_0xa890('0x78')]=_0x271aa6[0x0];if(!_0x516681[_0xa890('0x5e')][_0xa890('0x65')])return;return db[_0xa890('0x79')][_0xa890('0x5c')]({'where':{'id':_0x516681[_0xa890('0x5e')]['UserId'],'role':_0xa890('0x67')},'attributes':['id',_0xa890('0x3d'),'fullname',_0xa890('0x7b'),_0xa890('0x7c')],'raw':!![]});}return null;})[_0xa890('0x22')](function(_0x548acd){if(!_0x548acd)return null;_0x25f1e5[_0xa890('0x2b')][_0xa890('0x67')]=_0x548acd;return _0x25f1e5;})[_0xa890('0x22')](function(_0x5f55ce){if(_0x5f55ce){_0x5f55ce[_0xa890('0x2b')][_0xa890('0x7e')]=util[_0xa890('0x63')](_0xa890('0x86'),_0x516681[_0xa890('0x66')][_0xa890('0x3d')]);_0x5f55ce[_0xa890('0x2b')][_0xa890('0x7f')]=_0x25f1e5[_0xa890('0x7f')];_0x5f55ce[_0xa890('0x2b')][_0xa890('0x80')]=_0x25f1e5[_0xa890('0x7f')];_0x5f55ce['message'][_0xa890('0x81')]=_0xa890('0x38');respondWithRpcPromise(_0xa890('0x83'),'EventManager',{'event':_0xa890('0x87'),'message':_[_0xa890('0x52')](_0x25f1e5[_0xa890('0x2b')],JSON['parse'](_0x25f1e5[_0xa890('0x6c')][_0xa890('0x88')]))},client9002);return _0x25f1e5;}return null;})[_0xa890('0x22')](respondWithResult(_0x2f8131,null))[_0xa890('0x2d')](handleError(_0x2f8131,null));}; \ No newline at end of file +var _0x7d41=['client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','ChatMessage','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','../../config/logger','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','event','rejectmessage','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise'];(function(_0x18c70c,_0x47f991){var _0x75fc46=function(_0x586805){while(--_0x586805){_0x18c70c['push'](_0x18c70c['shift']());}};_0x75fc46(++_0x47f991);}(_0x7d41,0x67));var _0x17d4=function(_0x575a9e,_0x2f44c9){_0x575a9e=_0x575a9e-0x0;var _0x56f267=_0x7d41[_0x575a9e];return _0x56f267;};'use strict';var emlformat=require(_0x17d4('0x0'));var rimraf=require(_0x17d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x17d4('0x2'));var rp=require(_0x17d4('0x3'));var moment=require(_0x17d4('0x4'));var BPromise=require(_0x17d4('0x5'));var Mustache=require(_0x17d4('0x6'));var util=require('util');var path=require(_0x17d4('0x7'));var sox=require('sox');var csv=require(_0x17d4('0x8'));var ejs=require(_0x17d4('0x9'));var fs=require('fs');var fs_extra=require(_0x17d4('0xa'));var _=require(_0x17d4('0xb'));var squel=require(_0x17d4('0xc'));var crypto=require(_0x17d4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x17d4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17d4('0xf'));var Papa=require(_0x17d4('0x10'));var Redis=require(_0x17d4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x17d4('0x12'));var utils=require('../../config/utils');var config=require(_0x17d4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x17d4('0x14'))['db'];config[_0x17d4('0x15')]=_[_0x17d4('0x16')](config[_0x17d4('0x15')],{'host':_0x17d4('0x17'),'port':0x18eb});var socket=require(_0x17d4('0x18'))(new Redis(config[_0x17d4('0x15')]));require(_0x17d4('0x19'))['register'](socket);var jayson=require(_0x17d4('0x1a'));var client=jayson[_0x17d4('0x1b')][_0x17d4('0x1c')]({'port':0x232c});var client9002=jayson[_0x17d4('0x1b')][_0x17d4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1b3ca1,_0x4dd50e,_0x3baa67,_0x1b3f09){return new BPromise(function(_0xf9c9a4,_0x22c588){var _0x536dd3=_0x1b3f09||client;return _0x536dd3['request'](_0x1b3ca1,_0x3baa67)['then'](function(_0x553f98){logger[_0x17d4('0x1d')](_0x17d4('0x1e'),_0x4dd50e,_0x17d4('0x1f'));logger[_0x17d4('0x20')](_0x17d4('0x21'),_0x4dd50e,_0x17d4('0x1f'),JSON['stringify'](_0x553f98));if(_0x553f98[_0x17d4('0x22')]){if(_0x553f98[_0x17d4('0x22')][_0x17d4('0x23')]===0x1f4){logger[_0x17d4('0x22')](_0x17d4('0x1e'),_0x4dd50e,_0x553f98[_0x17d4('0x22')]['message']);return _0x22c588(_0x553f98[_0x17d4('0x22')][_0x17d4('0x24')]);}logger[_0x17d4('0x22')]('ChatMessage,\x20%s,\x20%s',_0x4dd50e,_0x553f98[_0x17d4('0x22')][_0x17d4('0x24')]);return _0xf9c9a4(_0x553f98[_0x17d4('0x22')]['message']);}else{logger['info'](_0x17d4('0x1e'),_0x4dd50e,_0x17d4('0x1f'));_0xf9c9a4(_0x553f98[_0x17d4('0x25')][_0x17d4('0x24')]);}})['catch'](function(_0x1e91eb){logger[_0x17d4('0x22')]('ChatMessage,\x20%s,\x20%s',_0x4dd50e,_0x1e91eb);_0x22c588(_0x1e91eb);});});}function respondWithStatusCode(_0x436810,_0x53e2dc){_0x53e2dc=_0x53e2dc||0xcc;return function(_0x18688b){if(_0x18688b){return _0x436810[_0x17d4('0x26')](_0x53e2dc);}return _0x436810[_0x17d4('0x27')](_0x53e2dc)[_0x17d4('0x28')]();};}function respondWithResult(_0x321048,_0x466ad8){_0x466ad8=_0x466ad8||0xc8;return function(_0x4d25a7){if(_0x4d25a7){return _0x321048['status'](_0x466ad8)[_0x17d4('0x29')](_0x4d25a7);}};}function respondWithFilteredResult(_0xd8f91f,_0xb4785d){return function(_0x387ab5){if(_0x387ab5){var _0x9ae786=typeof _0xb4785d[_0x17d4('0x2a')]===_0x17d4('0x2b')&&typeof _0xb4785d[_0x17d4('0x2c')]==='undefined';var _0x5636bd=_0x387ab5['count'];var _0x569e9c=_0x9ae786?0x0:_0xb4785d[_0x17d4('0x2a')];var _0x445d59=_0x9ae786?_0x387ab5[_0x17d4('0x2d')]:_0xb4785d[_0x17d4('0x2a')]+_0xb4785d[_0x17d4('0x2c')];var _0x29c764;if(_0x445d59>=_0x5636bd){_0x445d59=_0x5636bd;_0x29c764=0xc8;}else{_0x29c764=0xce;}_0xd8f91f[_0x17d4('0x27')](_0x29c764);return _0xd8f91f[_0x17d4('0x2e')](_0x17d4('0x2f'),_0x569e9c+'-'+_0x445d59+'/'+_0x5636bd)[_0x17d4('0x29')](_0x387ab5);}return null;};}function patchUpdates(_0x581f2b){return function(_0x33d9df){try{jsonpatch['apply'](_0x33d9df,_0x581f2b,!![]);}catch(_0x530bd5){return BPromise[_0x17d4('0x30')](_0x530bd5);}return _0x33d9df[_0x17d4('0x31')]();};}function saveUpdates(_0x8f87bc,_0x41ca9e){return function(_0x332396){if(_0x332396){return _0x332396[_0x17d4('0x32')](_0x8f87bc)['then'](function(_0x5a9f70){return _0x5a9f70;});}return null;};}function removeEntity(_0x4c2107,_0x2ce48d){return function(_0x125745){if(_0x125745){return _0x125745[_0x17d4('0x33')]()[_0x17d4('0x34')](function(){_0x4c2107['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ee9a,_0x3173a3){return function(_0x25e3df){if(!_0x25e3df){_0x56ee9a[_0x17d4('0x26')](0x194);}return _0x25e3df;};}function handleError(_0x461478,_0xb01944){_0xb01944=_0xb01944||0x1f4;return function(_0x39dd3b){logger[_0x17d4('0x22')](_0x39dd3b[_0x17d4('0x35')]);if(_0x39dd3b[_0x17d4('0x36')]){delete _0x39dd3b['name'];}_0x461478[_0x17d4('0x27')](_0xb01944)[_0x17d4('0x37')](_0x39dd3b);};}exports[_0x17d4('0x38')]=function(_0xceb8bb,_0x32a0bd){var _0x1ccd4e={},_0x57b173={},_0x379f5f={'count':0x0,'rows':[]};var _0x3ef408=_[_0x17d4('0x39')](db[_0x17d4('0x3a')]['rawAttributes'],function(_0x469297){return{'name':_0x469297['fieldName'],'type':_0x469297['type'][_0x17d4('0x3b')]};});_0x57b173[_0x17d4('0x3c')]=_['map'](_0x3ef408,_0x17d4('0x36'));_0x57b173[_0x17d4('0x3d')]=_[_0x17d4('0x3e')](_0xceb8bb['query']);_0x57b173[_0x17d4('0x3f')]=_[_0x17d4('0x40')](_0x57b173['model'],_0x57b173[_0x17d4('0x3d')]);_0x1ccd4e[_0x17d4('0x41')]=_['intersection'](_0x57b173['model'],qs[_0x17d4('0x42')](_0xceb8bb[_0x17d4('0x3d')][_0x17d4('0x42')]));_0x1ccd4e[_0x17d4('0x41')]=_0x1ccd4e['attributes'][_0x17d4('0x43')]?_0x1ccd4e['attributes']:_0x57b173[_0x17d4('0x3c')];if(!_0xceb8bb['query'][_0x17d4('0x44')]('nolimit')){_0x1ccd4e[_0x17d4('0x2c')]=qs[_0x17d4('0x2c')](_0xceb8bb[_0x17d4('0x3d')]['limit']);_0x1ccd4e[_0x17d4('0x2a')]=qs[_0x17d4('0x2a')](_0xceb8bb['query'][_0x17d4('0x2a')]);}_0x1ccd4e['order']=qs[_0x17d4('0x45')](_0xceb8bb[_0x17d4('0x3d')]['sort']);_0x1ccd4e[_0x17d4('0x46')]=qs[_0x17d4('0x3f')](_[_0x17d4('0x47')](_0xceb8bb[_0x17d4('0x3d')],_0x57b173[_0x17d4('0x3f')]),_0x3ef408);if(_0xceb8bb[_0x17d4('0x3d')][_0x17d4('0x48')]){_0x1ccd4e[_0x17d4('0x46')]=_[_0x17d4('0x49')](_0x1ccd4e[_0x17d4('0x46')],{'$or':_[_0x17d4('0x39')](_0x3ef408,function(_0x31e650){if(_0x31e650[_0x17d4('0x4a')]!=='VIRTUAL'){var _0x5f83b5={};_0x5f83b5[_0x31e650['name']]={'$like':'%'+_0xceb8bb[_0x17d4('0x3d')]['filter']+'%'};return _0x5f83b5;}})});}_0x1ccd4e=_[_0x17d4('0x49')]({},_0x1ccd4e,_0xceb8bb[_0x17d4('0x4b')]);var _0x5b0bc1={'where':_0x1ccd4e[_0x17d4('0x46')]};return db[_0x17d4('0x3a')][_0x17d4('0x2d')](_0x5b0bc1)[_0x17d4('0x34')](function(_0x4dd087){_0x379f5f[_0x17d4('0x2d')]=_0x4dd087;if(_0xceb8bb[_0x17d4('0x3d')][_0x17d4('0x4c')]){_0x1ccd4e[_0x17d4('0x4d')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x1ccd4e);})[_0x17d4('0x34')](function(_0x39b063){_0x379f5f[_0x17d4('0x4e')]=_0x39b063;return _0x379f5f;})[_0x17d4('0x34')](respondWithFilteredResult(_0x32a0bd,_0x1ccd4e))[_0x17d4('0x4f')](handleError(_0x32a0bd,null));};exports[_0x17d4('0x50')]=function(_0xb8165b,_0x2ae06a){var _0x553b2a={'raw':!![],'where':{'id':_0xb8165b['params']['id']}},_0x12e7ea={};_0x12e7ea[_0x17d4('0x3c')]=_['keys'](db[_0x17d4('0x3a')][_0x17d4('0x51')]);_0x12e7ea[_0x17d4('0x3d')]=_['keys'](_0xb8165b[_0x17d4('0x3d')]);_0x12e7ea['filters']=_[_0x17d4('0x40')](_0x12e7ea[_0x17d4('0x3c')],_0x12e7ea['query']);_0x553b2a['attributes']=_[_0x17d4('0x40')](_0x12e7ea['model'],qs['fields'](_0xb8165b[_0x17d4('0x3d')]['fields']));_0x553b2a[_0x17d4('0x41')]=_0x553b2a[_0x17d4('0x41')]['length']?_0x553b2a[_0x17d4('0x41')]:_0x12e7ea['model'];if(_0xb8165b['query']['includeAll']){_0x553b2a[_0x17d4('0x4d')]=[{'all':!![]}];}_0x553b2a=_['merge']({},_0x553b2a,_0xb8165b[_0x17d4('0x4b')]);return db['ChatMessage'][_0x17d4('0x52')](_0x553b2a)[_0x17d4('0x34')](handleEntityNotFound(_0x2ae06a,null))[_0x17d4('0x34')](respondWithResult(_0x2ae06a,null))[_0x17d4('0x4f')](handleError(_0x2ae06a,null));};exports[_0x17d4('0x53')]=function(_0x579f00,_0x15ccd2){return db[_0x17d4('0x3a')][_0x17d4('0x53')](_0x579f00[_0x17d4('0x54')],{})[_0x17d4('0x34')](respondWithResult(_0x15ccd2,0xc9))[_0x17d4('0x4f')](handleError(_0x15ccd2,null));};exports['update']=function(_0x53c408,_0x4df88e){if(_0x53c408[_0x17d4('0x54')]['id']){delete _0x53c408[_0x17d4('0x54')]['id'];}return db[_0x17d4('0x3a')][_0x17d4('0x52')]({'where':{'id':_0x53c408['params']['id']}})[_0x17d4('0x34')](handleEntityNotFound(_0x4df88e,null))[_0x17d4('0x34')](saveUpdates(_0x53c408[_0x17d4('0x54')],null))[_0x17d4('0x34')](respondWithResult(_0x4df88e,null))['catch'](handleError(_0x4df88e,null));};exports['destroy']=function(_0x2b8d8b,_0xde8fd0){return db[_0x17d4('0x3a')][_0x17d4('0x52')]({'where':{'id':_0x2b8d8b[_0x17d4('0x55')]['id']}})['then'](handleEntityNotFound(_0xde8fd0,null))[_0x17d4('0x34')](removeEntity(_0xde8fd0,null))[_0x17d4('0x4f')](handleError(_0xde8fd0,null));};exports[_0x17d4('0x56')]=function(_0x1380d5,_0xdd2ed7){return db[_0x17d4('0x3a')][_0x17d4('0x56')]()[_0x17d4('0x34')](respondWithResult(_0xdd2ed7,null))['catch'](handleError(_0xdd2ed7,null));};var interaction_log=require(_0x17d4('0x57'))('chat-interactions');exports[_0x17d4('0x58')]=function(_0x116523,_0x2c4ebb,_0x20889c){var _0x1e5292={'agent':{},'channel':_0x17d4('0x59')};if(_0x116523['body']['id']){delete _0x116523[_0x17d4('0x54')]['id'];}_0x116523['body'][_0x17d4('0x5a')]=!![];_0x116523['body']['readAt']=moment()[_0x17d4('0x5b')](_0x17d4('0x5c'));_0x116523[_0x17d4('0x54')][_0x17d4('0x5d')]=_0x116523[_0x17d4('0x54')][_0x17d4('0x5d')]||_0x116523[_0x17d4('0x5e')]['id'];_0x1e5292['agent']['id']=_0x116523[_0x17d4('0x54')]['UserId'];return db['ChatMessage'][_0x17d4('0x52')]({'where':{'id':_0x116523[_0x17d4('0x55')]['id'],'UserId':null}})[_0x17d4('0x34')](handleEntityNotFound(_0x2c4ebb,null))[_0x17d4('0x34')](saveUpdates(_0x116523[_0x17d4('0x54')],null))[_0x17d4('0x34')](function(_0x50b05a){if(_0x50b05a){_0x1e5292[_0x17d4('0x24')]=_0x50b05a['get']({'plain':!![]});return db[_0x17d4('0x5f')]['find']({'where':{'id':_0x50b05a[_0x17d4('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x2c4ebb,null))[_0x17d4('0x34')](function(_0x29a8df){if(_0x29a8df){return _0x29a8df[_0x17d4('0x32')]({'UserId':_0x116523['body'][_0x17d4('0x5d')],'read1stAt':_[_0x17d4('0x61')](_0x29a8df[_0x17d4('0x62')])?moment()['format'](_0x17d4('0x5c')):undefined});}return null;})[_0x17d4('0x34')](function(_0x594836){if(_0x594836){_0x1e5292[_0x17d4('0x63')]=_0x594836[_0x17d4('0x64')]({'plain':!![]});interaction_log[_0x17d4('0x1d')](_0x17d4('0x65'),_0x116523[_0x17d4('0x5e')]['id'],_0x116523[_0x17d4('0x5e')][_0x17d4('0x36')],_0x116523[_0x17d4('0x5e')][_0x17d4('0x66')],_0x1e5292['interaction']['id'],_0x116523[_0x17d4('0x54')]?JSON['stringify'](_0x116523['body']):_0x17d4('0x67'));return respondWithRpcPromise(_0x17d4('0x68'),_0x17d4('0x69'),_0x1e5292);}return null;})[_0x17d4('0x34')](function(_0xb35f66){var _0x11200d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb35f66[_0x17d4('0x24')][_0x17d4('0x6a')];return db[_0x17d4('0x6b')]['query'](_0x11200d,{'type':db[_0x17d4('0x6c')]['QueryTypes'][_0x17d4('0x6d')],'raw':!![]})['then'](function(_0x5231f8){return _0x5231f8;});})[_0x17d4('0x34')](function(_0x414a1e){if(_0x414a1e){_0x1e5292[_0x17d4('0x24')][_0x17d4('0x6e')]=_0x414a1e[0x0];if(!_0x116523[_0x17d4('0x54')][_0x17d4('0x5d')])return;return db[_0x17d4('0x6f')][_0x17d4('0x52')]({'where':{'id':_0x116523[_0x17d4('0x54')][_0x17d4('0x5d')],'role':_0x17d4('0x70')},'attributes':['id',_0x17d4('0x36'),_0x17d4('0x71'),_0x17d4('0x72'),'internal'],'raw':!![]});}return null;})[_0x17d4('0x34')](function(_0x5d237c){if(!_0x5d237c)return null;_0x1e5292['message'][_0x17d4('0x70')]=_0x5d237c;return _0x1e5292;})[_0x17d4('0x34')](function(_0x2dc38e){if(_0x2dc38e){if(_0x116523[_0x17d4('0x54')][_0x17d4('0x73')]){_0x1e5292['message'][_0x17d4('0x74')]=util['format'](_0x17d4('0x75'),_0x116523[_0x17d4('0x5e')][_0x17d4('0x36')]);_0x1e5292[_0x17d4('0x24')][_0x17d4('0x76')]=_0x1e5292[_0x17d4('0x76')];_0x1e5292['message'][_0x17d4('0x77')]=_0x1e5292[_0x17d4('0x76')];_0x1e5292[_0x17d4('0x24')]['event']=_0x17d4('0x58');return respondWithRpcPromise(_0x17d4('0x78'),_0x17d4('0x78'),{'event':_0x17d4('0x79'),'message':_[_0x17d4('0x49')](_0x1e5292['message'],JSON[_0x17d4('0x7a')](_0x1e5292[_0x17d4('0x63')]['formData']))},client9002)[_0x17d4('0x34')](function(){return _0x1e5292;});}return _0x1e5292;}return null;})['then'](respondWithResult(_0x2c4ebb,null))[_0x17d4('0x4f')](handleError(_0x2c4ebb,null));};var interaction_log=require(_0x17d4('0x57'))('chat-interactions');exports[_0x17d4('0x30')]=function(_0x5d1b7e,_0x17cc9c,_0x32aa9c){var _0x3d748a={'agent':{},'channel':_0x17d4('0x59')};if(_0x5d1b7e[_0x17d4('0x54')]['id']){delete _0x5d1b7e[_0x17d4('0x54')]['id'];}_0x5d1b7e[_0x17d4('0x54')]['UserId']=_0x5d1b7e['body']['UserId']||_0x5d1b7e['user']['id'];_0x3d748a[_0x17d4('0x70')]['id']=_0x5d1b7e[_0x17d4('0x54')][_0x17d4('0x5d')];return db[_0x17d4('0x3a')][_0x17d4('0x52')]({'where':{'id':_0x5d1b7e[_0x17d4('0x55')]['id'],'UserId':null}})[_0x17d4('0x34')](handleEntityNotFound(_0x17cc9c,null))[_0x17d4('0x34')](function(_0x2e7de5){if(_0x2e7de5){_0x3d748a[_0x17d4('0x24')]=_0x2e7de5['get']({'plain':!![]});return db[_0x17d4('0x5f')][_0x17d4('0x52')]({'where':{'id':_0x2e7de5[_0x17d4('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x17cc9c,null))[_0x17d4('0x34')](function(_0x5e29a4){if(_0x5e29a4){_0x3d748a[_0x17d4('0x63')]=_0x5e29a4[_0x17d4('0x64')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d1b7e[_0x17d4('0x5e')]['id'],_0x5d1b7e['user']['name'],_0x5d1b7e['user'][_0x17d4('0x66')],_0x3d748a[_0x17d4('0x63')]['id'],_0x5d1b7e['body']?JSON[_0x17d4('0x7b')](_0x5d1b7e[_0x17d4('0x54')]):_0x17d4('0x67'));return respondWithRpcPromise('RejectMessage',_0x17d4('0x7c'),_0x3d748a);}return null;})[_0x17d4('0x34')](function(_0x19794f){var _0x5930f8=_0x17d4('0x7d')+_0x19794f[_0x17d4('0x24')][_0x17d4('0x6a')];return db['sequelize'][_0x17d4('0x3d')](_0x5930f8,{'type':db[_0x17d4('0x6c')][_0x17d4('0x7e')][_0x17d4('0x6d')],'raw':!![]})[_0x17d4('0x34')](function(_0x3b0cb3){return _0x3b0cb3;});})[_0x17d4('0x34')](function(_0x3bd795){if(_0x3bd795){_0x3d748a['message'][_0x17d4('0x6e')]=_0x3bd795[0x0];if(!_0x5d1b7e[_0x17d4('0x54')][_0x17d4('0x5d')])return;return db[_0x17d4('0x6f')][_0x17d4('0x52')]({'where':{'id':_0x5d1b7e['body'][_0x17d4('0x5d')],'role':'agent'},'attributes':['id','name',_0x17d4('0x71'),'email','internal'],'raw':!![]});}return null;})[_0x17d4('0x34')](function(_0x30de56){if(!_0x30de56)return null;_0x3d748a['message'][_0x17d4('0x70')]=_0x30de56;return _0x3d748a;})[_0x17d4('0x34')](function(_0x1adc0c){if(_0x1adc0c){_0x1adc0c['message']['interface']=util[_0x17d4('0x5b')]('SIP/%s',_0x5d1b7e[_0x17d4('0x5e')]['name']);_0x1adc0c[_0x17d4('0x24')][_0x17d4('0x76')]=_0x3d748a['channel'];_0x1adc0c[_0x17d4('0x24')]['motionChannel']=_0x3d748a[_0x17d4('0x76')];_0x1adc0c[_0x17d4('0x24')][_0x17d4('0x7f')]='reject';respondWithRpcPromise(_0x17d4('0x78'),_0x17d4('0x78'),{'event':_0x17d4('0x80'),'message':_[_0x17d4('0x49')](_0x3d748a[_0x17d4('0x24')],JSON[_0x17d4('0x7a')](_0x3d748a['interaction'][_0x17d4('0x81')]))},client9002);return _0x3d748a;}return null;})[_0x17d4('0x34')](respondWithResult(_0x17cc9c,null))[_0x17d4('0x4f')](handleError(_0x17cc9c,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d929fa0..b570f7a 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 _0x975f=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatMessage','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x975f,0x1f0));var _0xf975=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x975f[_0x5447aa];return _0xb21e53;};'use strict';var EventEmitter=require(_0xf975('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xf975('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf975('0x2')](0x0);var events={'afterCreate':_0xf975('0x3'),'afterUpdate':_0xf975('0x4'),'afterDestroy':_0xf975('0x5')};function emitEvent(_0x5c591e){return function(_0x1c3f94,_0x43bff3,_0x1a2390){ChatMessageEvents[_0xf975('0x6')](_0x5c591e+':'+_0x1c3f94['id'],_0x1c3f94);ChatMessageEvents[_0xf975('0x6')](_0x5c591e,_0x1c3f94);_0x1a2390(null);};}for(var e in events){if(events[_0xf975('0x7')](e)){var event=events[e];ChatMessage[_0xf975('0x8')](e,emitEvent(event));}}module[_0xf975('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xc042=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xc042,0x1c7));var _0x2c04=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xc042[_0x1147ab];return _0x55cb5a;};'use strict';var EventEmitter=require(_0x2c04('0x0'));var ChatMessage=require(_0x2c04('0x1'))['db'][_0x2c04('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2c04('0x3')](0x0);var events={'afterCreate':_0x2c04('0x4'),'afterUpdate':_0x2c04('0x5'),'afterDestroy':_0x2c04('0x6')};function emitEvent(_0x4df260){return function(_0xaaf4ff,_0xb52e5f,_0x106f22){ChatMessageEvents[_0x2c04('0x7')](_0x4df260+':'+_0xaaf4ff['id'],_0xaaf4ff);ChatMessageEvents[_0x2c04('0x7')](_0x4df260,_0xaaf4ff);_0x106f22(null);};}for(var e in events){if(events[_0x2c04('0x8')](e)){var event=events[e];ChatMessage[_0x2c04('0x9')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e34f5a0..9ab5c55 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 _0x8c28=['get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','body','models'];(function(_0x543e9b,_0x25541){var _0x3a2c22=function(_0x265fa1){while(--_0x265fa1){_0x543e9b['push'](_0x543e9b['shift']());}};_0x3a2c22(++_0x25541);}(_0x8c28,0x198));var _0x88c2=function(_0x3d3679,_0x40cce7){_0x3d3679=_0x3d3679-0x0;var _0x4e8180=_0x8c28[_0x3d3679];return _0x4e8180;};'use strict';var _=require(_0x88c2('0x0'));var util=require(_0x88c2('0x1'));var logger=require(_0x88c2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x88c2('0x3'));var rp=require(_0x88c2('0x4'));var fs=require('fs');var path=require(_0x88c2('0x5'));var rimraf=require(_0x88c2('0x6'));var config=require(_0x88c2('0x7'));var attributes=require(_0x88c2('0x8'));module['exports']=function(_0x2fe9f3,_0x81a9d2){return _0x2fe9f3[_0x88c2('0x9')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x88c2('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d22b9,_0x6b9a70,_0x39bfdc){var _0x3edafc=_0x2fe9f3[_0x88c2('0xb')];var _0x3026e7=_0x3d22b9[_0x88c2('0xc')]({'plain':!![]});if(_0x3026e7['direction'][_0x88c2('0xd')]()==='in'||_0x3026e7[_0x88c2('0xe')][_0x88c2('0xd')]()===_0x88c2('0xf')&&!_0x3026e7[_0x88c2('0x10')]&&!_[_0x88c2('0x11')](_0x3026e7[_0x88c2('0x12')])){_0x3edafc[_0x88c2('0x13')][_0x88c2('0x14')]({'where':{'id':_0x3026e7[_0x88c2('0x15')]}})[_0x88c2('0x16')](function(_0xd24b2a){if(_0xd24b2a){_0xd24b2a[_0x88c2('0x17')]({'lastMsgAt':_0x3026e7[_0x88c2('0x18')],'lastMsgDirection':_0x3026e7[_0x88c2('0xe')][_0x88c2('0xd')]()});}})[_0x88c2('0x19')](function(_0x2eb4c4){console['error'](_0x2eb4c4);});}_0x39bfdc();}},'charset':_0x88c2('0x1a'),'collate':_0x88c2('0x1b')});}; \ No newline at end of file +var _0x2001=['error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','update','createdAt','catch'];(function(_0x58e39a,_0x474e33){var _0x5233f4=function(_0x3fa875){while(--_0x3fa875){_0x58e39a['push'](_0x58e39a['shift']());}};_0x5233f4(++_0x474e33);}(_0x2001,0xf3));var _0x1200=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x2001[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x1200('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1200('0x1'));var moment=require(_0x1200('0x2'));var BPromise=require(_0x1200('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1200('0x4'));var rimraf=require(_0x1200('0x5'));var config=require(_0x1200('0x6'));var attributes=require(_0x1200('0x7'));module[_0x1200('0x8')]=function(_0x1bba62,_0x3db51e){return _0x1bba62[_0x1200('0x9')](_0x1200('0xa'),attributes,{'tableName':_0x1200('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x1200('0xc')],'type':_0x1200('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a01a5,_0x5dadaa,_0x3a05c2){var _0x55d16c=_0x1bba62[_0x1200('0xe')];var _0x36af96=_0x4a01a5[_0x1200('0xf')]({'plain':!![]});if(_0x36af96[_0x1200('0x10')][_0x1200('0x11')]()==='in'||_0x36af96[_0x1200('0x10')][_0x1200('0x11')]()===_0x1200('0x12')&&!_0x36af96[_0x1200('0x13')]&&!_[_0x1200('0x14')](_0x36af96['UserId'])){_0x55d16c[_0x1200('0x15')][_0x1200('0x16')]({'where':{'id':_0x36af96['ChatInteractionId']}})[_0x1200('0x17')](function(_0x12db48){if(_0x12db48){_0x12db48[_0x1200('0x18')]({'lastMsgAt':_0x36af96[_0x1200('0x19')],'lastMsgDirection':_0x36af96[_0x1200('0x10')]['toLowerCase']()});}})[_0x1200('0x1a')](function(_0x1cc82d){console[_0x1200('0x1b')](_0x1cc82d);});}_0x3a05c2();}},'charset':_0x1200('0x1c'),'collate':_0x1200('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a04bd32..5791f2d 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 _0x3a0b=['raw','stringify','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','ChatMessage,\x20%s,\x20%s','message','info','catch','CreateChatMessage','ChatMessage','create','body','options'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x3a0b,0x7a));var _0xb3a0=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x3a0b[_0x21353c];return _0xa99120;};'use strict';var _=require(_0xb3a0('0x0'));var util=require(_0xb3a0('0x1'));var moment=require(_0xb3a0('0x2'));var BPromise=require(_0xb3a0('0x3'));var rs=require(_0xb3a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb3a0('0x5'));var config=require(_0xb3a0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb3a0('0x7')][_0xb3a0('0x8')]({'port':0x232a});config[_0xb3a0('0x9')]=_[_0xb3a0('0xa')](config[_0xb3a0('0x9')],{'host':_0xb3a0('0xb'),'port':0x18eb});var socket=require(_0xb3a0('0xc'))(new Redis(config[_0xb3a0('0x9')]));require(_0xb3a0('0xd'))[_0xb3a0('0xe')](socket);function respondWithRpcPromise(_0xcb09ef,_0x6d3a62,_0x34504d){return new BPromise(function(_0x14dd6d,_0x2e8dfe){return client['request'](_0xcb09ef,_0x34504d)['then'](function(_0x504775){logger['info']('ChatMessage,\x20%s,\x20%s',_0x6d3a62,_0xb3a0('0xf'));logger[_0xb3a0('0x10')](_0xb3a0('0x11'),_0x6d3a62,_0xb3a0('0xf'),JSON['stringify'](_0x504775));if(_0x504775[_0xb3a0('0x12')]){if(_0x504775[_0xb3a0('0x12')]['code']===0x1f4){logger[_0xb3a0('0x12')](_0xb3a0('0x13'),_0x6d3a62,_0x504775['error'][_0xb3a0('0x14')]);return _0x2e8dfe(_0x504775[_0xb3a0('0x12')]['message']);}logger[_0xb3a0('0x12')](_0xb3a0('0x13'),_0x6d3a62,_0x504775[_0xb3a0('0x12')][_0xb3a0('0x14')]);return _0x14dd6d(_0x504775[_0xb3a0('0x12')]['message']);}else{logger[_0xb3a0('0x15')](_0xb3a0('0x13'),_0x6d3a62,_0xb3a0('0xf'));_0x14dd6d(_0x504775['result']['message']);}})[_0xb3a0('0x16')](function(_0x382ceb){logger[_0xb3a0('0x12')]('ChatMessage,\x20%s,\x20%s',_0x6d3a62,_0x382ceb);_0x2e8dfe(_0x382ceb);});});}exports[_0xb3a0('0x17')]=function(_0x104ed7){var _0x3dfbf0=this;return new Promise(function(_0x47e321,_0x275df0){return db[_0xb3a0('0x18')][_0xb3a0('0x19')](_0x104ed7[_0xb3a0('0x1a')],{'raw':_0x104ed7['options']?_0x104ed7[_0xb3a0('0x1b')][_0xb3a0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5cf36a){logger['info'](_0xb3a0('0x17'),_0x104ed7);logger[_0xb3a0('0x10')]('CreateChatMessage',_0x104ed7,JSON[_0xb3a0('0x1d')](_0x5cf36a));_0x47e321(_0x5cf36a);})[_0xb3a0('0x16')](function(_0x5d88b3){logger[_0xb3a0('0x12')](_0xb3a0('0x17'),_0x5d88b3[_0xb3a0('0x14')],_0x104ed7);_0x275df0(_0x3dfbf0[_0xb3a0('0x12')](0x1f4,_0x5d88b3[_0xb3a0('0x14')]));});});}; \ No newline at end of file +var _0xd7d6=['client','http','defaults','localhost','./chatMessage.socket','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xd7d6,0xb5));var _0x6d7d=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0xd7d6[_0x11d95f];return _0x2b1a14;};'use strict';var _=require(_0x6d7d('0x0'));var util=require(_0x6d7d('0x1'));var moment=require(_0x6d7d('0x2'));var BPromise=require(_0x6d7d('0x3'));var rs=require(_0x6d7d('0x4'));var fs=require('fs');var Redis=require(_0x6d7d('0x5'));var db=require(_0x6d7d('0x6'))['db'];var utils=require(_0x6d7d('0x7'));var logger=require(_0x6d7d('0x8'))(_0x6d7d('0x9'));var config=require(_0x6d7d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6d7d('0xb')][_0x6d7d('0xc')]({'port':0x232a});config['redis']=_[_0x6d7d('0xd')](config['redis'],{'host':_0x6d7d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6d7d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5f3389,_0x212e8e,_0x3657f2){return new BPromise(function(_0x379569,_0x277ae8){return client[_0x6d7d('0x10')](_0x5f3389,_0x3657f2)['then'](function(_0x2825ef){logger['info'](_0x6d7d('0x11'),_0x212e8e,_0x6d7d('0x12'));logger[_0x6d7d('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x212e8e,_0x6d7d('0x12'),JSON['stringify'](_0x2825ef));if(_0x2825ef[_0x6d7d('0x14')]){if(_0x2825ef[_0x6d7d('0x14')][_0x6d7d('0x15')]===0x1f4){logger[_0x6d7d('0x14')](_0x6d7d('0x11'),_0x212e8e,_0x2825ef[_0x6d7d('0x14')][_0x6d7d('0x16')]);return _0x277ae8(_0x2825ef[_0x6d7d('0x14')]['message']);}logger[_0x6d7d('0x14')](_0x6d7d('0x11'),_0x212e8e,_0x2825ef['error'][_0x6d7d('0x16')]);return _0x379569(_0x2825ef[_0x6d7d('0x14')]['message']);}else{logger[_0x6d7d('0x17')]('ChatMessage,\x20%s,\x20%s',_0x212e8e,_0x6d7d('0x12'));_0x379569(_0x2825ef[_0x6d7d('0x18')][_0x6d7d('0x16')]);}})[_0x6d7d('0x19')](function(_0x2932a1){logger[_0x6d7d('0x14')](_0x6d7d('0x11'),_0x212e8e,_0x2932a1);_0x277ae8(_0x2932a1);});});}exports[_0x6d7d('0x1a')]=function(_0x1a09c0){var _0x4c72fd=this;return new Promise(function(_0x42c01b,_0x2f163c){return db[_0x6d7d('0x1b')][_0x6d7d('0x1c')](_0x1a09c0['body'],{'raw':_0x1a09c0[_0x6d7d('0x1d')]?_0x1a09c0[_0x6d7d('0x1d')][_0x6d7d('0x1e')]===undefined?!![]:![]:!![]})[_0x6d7d('0x1f')](function(_0x5cab9c){logger[_0x6d7d('0x17')](_0x6d7d('0x1a'),_0x1a09c0);logger[_0x6d7d('0x13')](_0x6d7d('0x1a'),_0x1a09c0,JSON['stringify'](_0x5cab9c));_0x42c01b(_0x5cab9c);})[_0x6d7d('0x19')](function(_0x369d1f){logger[_0x6d7d('0x14')]('CreateChatMessage',_0x369d1f[_0x6d7d('0x16')],_0x1a09c0);_0x2f163c(_0x4c72fd[_0x6d7d('0x14')](0x1f4,_0x369d1f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d494f43..331e138 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 _0xc5c7=['length','save','remove','update','removeListener','register'];(function(_0x2a0bc8,_0x2b4938){var _0x305879=function(_0x4d2891){while(--_0x4d2891){_0x2a0bc8['push'](_0x2a0bc8['shift']());}};_0x305879(++_0x2b4938);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x347b50,_0x2ad222){_0x347b50=_0x347b50-0x0;var _0x1495ab=_0xc5c7[_0x347b50];return _0x1495ab;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7c5c('0x0'),_0x7c5c('0x1'),_0x7c5c('0x2')];function createListener(_0x18d013,_0x15e755){return function(_0x1932ff){_0x15e755['emit'](_0x18d013,_0x1932ff);};}function removeListener(_0xff325e,_0x2b4355){return function(){ChatMessageEvents[_0x7c5c('0x3')](_0xff325e,_0x2b4355);};}exports[_0x7c5c('0x4')]=function(_0x1dc034){for(var _0x4dd500=0x0,_0x5ec99e=events[_0x7c5c('0x5')];_0x4dd500<_0x5ec99e;_0x4dd500++){var _0x5895b5=events[_0x4dd500];var _0x402b70=createListener('chatMessage:'+_0x5895b5,_0x1dc034);ChatMessageEvents['on'](_0x5895b5,_0x402b70);}}; \ No newline at end of file +var _0xf0ba=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x2e3210,_0x555b54){var _0x399fad=function(_0x104a6d){while(--_0x104a6d){_0x2e3210['push'](_0x2e3210['shift']());}};_0x399fad(++_0x555b54);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var ChatMessageEvents=require(_0xaf0b('0x0'));var events=[_0xaf0b('0x1'),_0xaf0b('0x2'),_0xaf0b('0x3')];function createListener(_0xea88b2,_0x555620){return function(_0x277920){_0x555620[_0xaf0b('0x4')](_0xea88b2,_0x277920);};}function removeListener(_0x4cffa5,_0xcd565f){return function(){ChatMessageEvents['removeListener'](_0x4cffa5,_0xcd565f);};}exports[_0xaf0b('0x5')]=function(_0x4b3b85){for(var _0x4d1479=0x0,_0x53b32d=events[_0xaf0b('0x6')];_0x4d1479<_0x53b32d;_0x4d1479++){var _0x17b6d5=events[_0x4d1479];var _0x3439d5=createListener(_0xaf0b('0x7')+_0x17b6d5,_0x4b3b85);ChatMessageEvents['on'](_0x17b6d5,_0x3439d5);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e27c2fc..28d2bb2 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 _0x8d9d=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','path'];(function(_0x199de6,_0x551e33){var _0x3fa9ba=function(_0x43a63a){while(--_0x43a63a){_0x199de6['push'](_0x199de6['shift']());}};_0x3fa9ba(++_0x551e33);}(_0x8d9d,0x1c9));var _0xd8d9=function(_0x1632fa,_0x273ab0){_0x1632fa=_0x1632fa-0x0;var _0x573d0f=_0x8d9d[_0x1632fa];return _0x573d0f;};'use strict';var multer=require(_0xd8d9('0x0'));var util=require('util');var path=require(_0xd8d9('0x1'));var timeout=require(_0xd8d9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd8d9('0x3'));var auth=require(_0xd8d9('0x4'));var interaction=require(_0xd8d9('0x5'));var config=require(_0xd8d9('0x6'));var controller=require(_0xd8d9('0x7'));router[_0xd8d9('0x8')]('/',auth['isAuthenticated'](),controller[_0xd8d9('0x9')]);router[_0xd8d9('0x8')](_0xd8d9('0xa'),auth[_0xd8d9('0xb')](),controller[_0xd8d9('0xc')]);router['get'](_0xd8d9('0xd'),auth['isAuthenticated'](),controller[_0xd8d9('0xe')]);router[_0xd8d9('0xf')]('/',auth[_0xd8d9('0xb')](),interaction[_0xd8d9('0x10')](_0xd8d9('0x11'),_0xd8d9('0x12')),controller[_0xd8d9('0x13')]);router[_0xd8d9('0x14')](_0xd8d9('0xd'),controller[_0xd8d9('0x15')]);router['put'](_0xd8d9('0x16'),auth['isAuthenticated'](),controller[_0xd8d9('0x17')]);router[_0xd8d9('0x14')](_0xd8d9('0x18'),auth['isAuthenticated'](),controller[_0xd8d9('0x19')]);router['delete'](_0xd8d9('0xd'),auth[_0xd8d9('0xb')](),controller[_0xd8d9('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xe03f=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','put','update','accept','reject','delete','destroy','exports','multer','util','path'];(function(_0x42b789,_0x46d8d4){var _0x3dee14=function(_0x2fe865){while(--_0x2fe865){_0x42b789['push'](_0x42b789['shift']());}};_0x3dee14(++_0x46d8d4);}(_0xe03f,0x7f));var _0xfe03=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe03f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfe03('0x0'));var util=require(_0xfe03('0x1'));var path=require(_0xfe03('0x2'));var timeout=require(_0xfe03('0x3'));var express=require(_0xfe03('0x4'));var router=express[_0xfe03('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfe03('0x6'));var interaction=require(_0xfe03('0x7'));var config=require(_0xfe03('0x8'));var controller=require('./chatMessage.controller');router[_0xfe03('0x9')]('/',auth[_0xfe03('0xa')](),controller[_0xfe03('0xb')]);router[_0xfe03('0x9')](_0xfe03('0xc'),auth[_0xfe03('0xa')](),controller[_0xfe03('0xd')]);router[_0xfe03('0x9')](_0xfe03('0xe'),auth[_0xfe03('0xa')](),controller['show']);router[_0xfe03('0xf')]('/',auth[_0xfe03('0xa')](),interaction[_0xfe03('0x10')](_0xfe03('0x11'),_0xfe03('0x12')),controller['create']);router[_0xfe03('0x13')](_0xfe03('0xe'),controller[_0xfe03('0x14')]);router['put']('/:id/accept',auth[_0xfe03('0xa')](),controller[_0xfe03('0x15')]);router[_0xfe03('0x13')]('/:id/reject',auth[_0xfe03('0xa')](),controller[_0xfe03('0x16')]);router[_0xfe03('0x17')](_0xfe03('0xe'),auth[_0xfe03('0xa')](),controller[_0xfe03('0x18')]);module[_0xfe03('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index db59a38..79bdfe8 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 _0x2032=['medium','exports','TEXT'];(function(_0x5cd23e,_0x20777b){var _0x216550=function(_0x2935bb){while(--_0x2935bb){_0x5cd23e['push'](_0x5cd23e['shift']());}};_0x216550(++_0x20777b);}(_0x2032,0xd9));var _0x2203=function(_0x2d7887,_0x31055d){_0x2d7887=_0x2d7887-0x0;var _0xd9d54a=_0x2032[_0x2d7887];return _0xd9d54a;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x757a,0xde));var _0xa757=function(_0x415da4,_0x2f006d){_0x415da4=_0x415da4-0x0;var _0x4ede48=_0x757a[_0x415da4];return _0x4ede48;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2d4b047..438ab2a 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(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x7a54,0x106));var _0x47a5=function(_0xa44c0b,_0x2056ba){_0xa44c0b=_0xa44c0b-0x0;var _0x32bc3e=_0x7a54[_0xa44c0b];return _0x32bc3e;};'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(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x7a54,0x106));var _0x47a5=function(_0x548de7,_0xe4b7d9){_0x548de7=_0x548de7-0x0;var _0x14afc8=_0x7a54[_0x548de7];return _0x14afc8;};'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 3ce1b45..b85f89b 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 _0x94a1=['setMaxListeners','update','emit','hasOwnProperty','events'];(function(_0x20ca38,_0xec17bf){var _0x5ce527=function(_0x346b62){while(--_0x346b62){_0x20ca38['push'](_0x20ca38['shift']());}};_0x5ce527(++_0xec17bf);}(_0x94a1,0x10d));var _0x194a=function(_0x5a810f,_0x3deefb){_0x5a810f=_0x5a810f-0x0;var _0x2ed176=_0x94a1[_0x5a810f];return _0x2ed176;};'use strict';var EventEmitter=require(_0x194a('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x194a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x194a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b2955){return function(_0x2b15e6,_0xd157ee,_0x3b1152){ChatOfflineMessageEvents[_0x194a('0x3')](_0x4b2955+':'+_0x2b15e6['id'],_0x2b15e6);ChatOfflineMessageEvents[_0x194a('0x3')](_0x4b2955,_0x2b15e6);_0x3b1152(null);};}for(var e in events){if(events[_0x194a('0x4')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3c96=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x3ccc44,_0x207b0c){var _0x5d74bb=function(_0x59989a){while(--_0x59989a){_0x3ccc44['push'](_0x3ccc44['shift']());}};_0x5d74bb(++_0x207b0c);}(_0x3c96,0xfa));var _0x63c9=function(_0x27bdb9,_0x11039c){_0x27bdb9=_0x27bdb9-0x0;var _0x238a7b=_0x3c96[_0x27bdb9];return _0x238a7b;};'use strict';var EventEmitter=require(_0x63c9('0x0'));var ChatOfflineMessage=require(_0x63c9('0x1'))['db'][_0x63c9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x63c9('0x3')](0x0);var events={'afterCreate':_0x63c9('0x4'),'afterUpdate':_0x63c9('0x5'),'afterDestroy':_0x63c9('0x6')};function emitEvent(_0x40560a){return function(_0x36478b,_0x784db4,_0x1d0bb3){ChatOfflineMessageEvents['emit'](_0x40560a+':'+_0x36478b['id'],_0x36478b);ChatOfflineMessageEvents['emit'](_0x40560a,_0x36478b);_0x1d0bb3(null);};}for(var e in events){if(events[_0x63c9('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x63c9('0x8')](e,emitEvent(event));}}module[_0x63c9('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 02463ce..c5aaad7 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 _0x8a33=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x8a33,0x138));var _0x38a3=function(_0x1a3c9b,_0x3eb0cb){_0x1a3c9b=_0x1a3c9b-0x0;var _0x57f1d8=_0x8a33[_0x1a3c9b];return _0x57f1d8;};'use strict';var attributes=require(_0x38a3('0x0'));module[_0x38a3('0x1')]=function(_0x324ece){return _0x324ece[_0x38a3('0x2')](_0x38a3('0x3'),attributes,{'tableName':_0x38a3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38a3('0x5'),'collate':_0x38a3('0x6')});}; \ No newline at end of file +var _0x4c02=['./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x2083e6,_0x5a997a){var _0x3b1aae=function(_0x3d3df3){while(--_0x3d3df3){_0x2083e6['push'](_0x2083e6['shift']());}};_0x3b1aae(++_0x5a997a);}(_0x4c02,0x127));var _0x24c0=function(_0x17249c,_0x168d62){_0x17249c=_0x17249c-0x0;var _0x324e7b=_0x4c02[_0x17249c];return _0x324e7b;};'use strict';var attributes=require(_0x24c0('0x0'));module[_0x24c0('0x1')]=function(_0x2011b1){return _0x2011b1[_0x24c0('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x24c0('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x24c0('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e48bf20..5b19a12 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 _0x2e0a=['jayson/promise','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2e0a,0xa3));var _0xa2e0=function(_0x375cc1,_0x25c2cf){_0x375cc1=_0x375cc1-0x0;var _0x2440f6=_0x2e0a[_0x375cc1];return _0x2440f6;};'use strict';var _=require(_0xa2e0('0x0'));var util=require(_0xa2e0('0x1'));var moment=require(_0xa2e0('0x2'));var BPromise=require(_0xa2e0('0x3'));var rs=require(_0xa2e0('0x4'));var fs=require('fs');var Redis=require(_0xa2e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2e0('0x6'));var logger=require(_0xa2e0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa2e0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c54b6,_0x37f4ea,_0x21c7b6){return new BPromise(function(_0x13b222,_0x35adeb){return client['request'](_0x5c54b6,_0x21c7b6)[_0xa2e0('0x9')](function(_0xf6267){logger[_0xa2e0('0xa')](_0xa2e0('0xb'),_0x37f4ea,_0xa2e0('0xc'));logger[_0xa2e0('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x37f4ea,_0xa2e0('0xc'),JSON[_0xa2e0('0xe')](_0xf6267));if(_0xf6267[_0xa2e0('0xf')]){if(_0xf6267[_0xa2e0('0xf')]['code']===0x1f4){logger[_0xa2e0('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37f4ea,_0xf6267['error']['message']);return _0x35adeb(_0xf6267[_0xa2e0('0xf')][_0xa2e0('0x10')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x37f4ea,_0xf6267[_0xa2e0('0xf')]['message']);return _0x13b222(_0xf6267['error']['message']);}else{logger['info'](_0xa2e0('0xb'),_0x37f4ea,'request\x20sent');_0x13b222(_0xf6267[_0xa2e0('0x11')][_0xa2e0('0x10')]);}})[_0xa2e0('0x12')](function(_0x564f72){logger[_0xa2e0('0xf')](_0xa2e0('0xb'),_0x37f4ea,_0x564f72);_0x35adeb(_0x564f72);});});} \ No newline at end of file +var _0xefa0=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3c0da7,_0x35fa06){var _0x2182f0=function(_0x493c93){while(--_0x493c93){_0x3c0da7['push'](_0x3c0da7['shift']());}};_0x2182f0(++_0x35fa06);}(_0xefa0,0xbc));var _0x0efa=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xefa0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0efa('0x0'));var util=require(_0x0efa('0x1'));var moment=require('moment');var BPromise=require(_0x0efa('0x2'));var rs=require(_0x0efa('0x3'));var fs=require('fs');var Redis=require(_0x0efa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0efa('0x5'));var logger=require(_0x0efa('0x6'))(_0x0efa('0x7'));var config=require(_0x0efa('0x8'));var jayson=require(_0x0efa('0x9'));var client=jayson[_0x0efa('0xa')][_0x0efa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d563,_0x4ccdee,_0x3c2463){return new BPromise(function(_0x127b7e,_0x2a527b){return client[_0x0efa('0xc')](_0x51d563,_0x3c2463)[_0x0efa('0xd')](function(_0x52b99e){logger[_0x0efa('0xe')](_0x0efa('0xf'),_0x4ccdee,'request\x20sent');logger[_0x0efa('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4ccdee,_0x0efa('0x11'),JSON[_0x0efa('0x12')](_0x52b99e));if(_0x52b99e[_0x0efa('0x13')]){if(_0x52b99e[_0x0efa('0x13')][_0x0efa('0x14')]===0x1f4){logger[_0x0efa('0x13')](_0x0efa('0xf'),_0x4ccdee,_0x52b99e['error'][_0x0efa('0x15')]);return _0x2a527b(_0x52b99e[_0x0efa('0x13')]['message']);}logger[_0x0efa('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4ccdee,_0x52b99e[_0x0efa('0x13')][_0x0efa('0x15')]);return _0x127b7e(_0x52b99e[_0x0efa('0x13')][_0x0efa('0x15')]);}else{logger[_0x0efa('0xe')](_0x0efa('0xf'),_0x4ccdee,_0x0efa('0x11'));_0x127b7e(_0x52b99e[_0x0efa('0x16')][_0x0efa('0x15')]);}})[_0x0efa('0x17')](function(_0x438956){logger[_0x0efa('0x13')](_0x0efa('0xf'),_0x4ccdee,_0x438956);_0x2a527b(_0x438956);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c8cc636..abdc0cc 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 _0x1c70=['destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete'];(function(_0x3e69ca,_0x44181b){var _0x328195=function(_0x333691){while(--_0x333691){_0x3e69ca['push'](_0x3e69ca['shift']());}};_0x328195(++_0x44181b);}(_0x1c70,0xbf));var _0x01c7=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x1c70[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x01c7('0x0'));var timeout=require(_0x01c7('0x1'));var express=require('express');var router=express[_0x01c7('0x2')]();var fs_extra=require(_0x01c7('0x3'));var auth=require(_0x01c7('0x4'));var interaction=require(_0x01c7('0x5'));var config=require(_0x01c7('0x6'));var controller=require(_0x01c7('0x7'));router[_0x01c7('0x8')]('/',auth[_0x01c7('0x9')](),controller[_0x01c7('0xa')]);router[_0x01c7('0x8')](_0x01c7('0xb'),auth[_0x01c7('0x9')](),controller[_0x01c7('0xc')]);router[_0x01c7('0x8')](_0x01c7('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x01c7('0x9')](),controller[_0x01c7('0xe')]);router[_0x01c7('0xf')](_0x01c7('0xd'),auth[_0x01c7('0x9')](),controller[_0x01c7('0x10')]);router[_0x01c7('0x11')](_0x01c7('0xd'),auth['isAuthenticated'](),controller[_0x01c7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1cf6=['get','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','/describe','describe'];(function(_0x2e846f,_0x57929a){var _0x42f147=function(_0x3fff97){while(--_0x3fff97){_0x2e846f['push'](_0x2e846f['shift']());}};_0x42f147(++_0x57929a);}(_0x1cf6,0x1a7));var _0x61cf=function(_0x31c0bb,_0x40ee20){_0x31c0bb=_0x31c0bb-0x0;var _0x319c9c=_0x1cf6[_0x31c0bb];return _0x319c9c;};'use strict';var multer=require(_0x61cf('0x0'));var util=require(_0x61cf('0x1'));var path=require(_0x61cf('0x2'));var timeout=require(_0x61cf('0x3'));var express=require(_0x61cf('0x4'));var router=express[_0x61cf('0x5')]();var fs_extra=require(_0x61cf('0x6'));var auth=require(_0x61cf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x61cf('0x8'));var controller=require(_0x61cf('0x9'));router['get']('/',auth[_0x61cf('0xa')](),controller[_0x61cf('0xb')]);router['get'](_0x61cf('0xc'),auth[_0x61cf('0xa')](),controller[_0x61cf('0xd')]);router[_0x61cf('0xe')](_0x61cf('0xf'),auth['isAuthenticated'](),controller[_0x61cf('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x61cf('0xf'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x11')]);router['delete'](_0x61cf('0xf'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4da8d37..39b21cc 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 _0xb2cc=['exports','ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x780b69,_0x557b9e){var _0x4c3934=function(_0x198ea7){while(--_0x198ea7){_0x780b69['push'](_0x780b69['shift']());}};_0x4c3934(++_0x557b9e);}(_0xb2cc,0x99));var _0xcb2c=function(_0x5880d8,_0x30b0a5){_0x5880d8=_0x5880d8-0x0;var _0x88264a=_0xb2cc[_0x5880d8];return _0x88264a;};'use strict';var Sequelize=require(_0xcb2c('0x0'));module[_0xcb2c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcb2c('0x2')](_0xcb2c('0x3'),_0xcb2c('0x4')),'defaultValue':_0xcb2c('0x3')},'selector':{'type':Sequelize[_0xcb2c('0x5')]},'timeout':{'type':Sequelize[_0xcb2c('0x6')]}}; \ No newline at end of file +var _0xd5be=['mouseOver','STRING','INTEGER','sequelize','exports','ENUM'];(function(_0x25656f,_0x4cf8be){var _0x6e703f=function(_0x334697){while(--_0x334697){_0x25656f['push'](_0x25656f['shift']());}};_0x6e703f(++_0x4cf8be);}(_0xd5be,0xe1));var _0xed5b=function(_0x97a80f,_0x3d70d7){_0x97a80f=_0x97a80f-0x0;var _0x534071=_0xd5be[_0x97a80f];return _0x534071;};'use strict';var Sequelize=require(_0xed5b('0x0'));module[_0xed5b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xed5b('0x2')]('mouseOver','timeout'),'defaultValue':_0xed5b('0x3')},'selector':{'type':Sequelize[_0xed5b('0x4')]},'timeout':{'type':Sequelize[_0xed5b('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5a8c5ca..a69142f 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 _0x4ab0=['undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','params','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','catch','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4ab0,0xd5));var _0x04ab=function(_0x10d58a,_0x1a2e7b){_0x10d58a=_0x10d58a-0x0;var _0x479bb4=_0x4ab0[_0x10d58a];return _0x479bb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ab('0x0'));var zipdir=require(_0x04ab('0x1'));var jsonpatch=require(_0x04ab('0x2'));var rp=require(_0x04ab('0x3'));var moment=require(_0x04ab('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04ab('0x5'));var path=require(_0x04ab('0x6'));var sox=require('sox');var csv=require(_0x04ab('0x7'));var ejs=require(_0x04ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x7'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var licenseUtil=require(_0x04ab('0x16'));var db=require(_0x04ab('0x17'))['db'];function respondWithStatusCode(_0x386d0a,_0x4a6b39){_0x4a6b39=_0x4a6b39||0xcc;return function(_0x710503){if(_0x710503){return _0x386d0a['sendStatus'](_0x4a6b39);}return _0x386d0a[_0x04ab('0x18')](_0x4a6b39)[_0x04ab('0x19')]();};}function respondWithResult(_0x2abdf8,_0x428798){_0x428798=_0x428798||0xc8;return function(_0x4f0da1){if(_0x4f0da1){return _0x2abdf8['status'](_0x428798)['json'](_0x4f0da1);}};}function respondWithFilteredResult(_0x103ca8,_0x3cee44){return function(_0x149fd2){if(_0x149fd2){var _0x2b10b0=typeof _0x3cee44[_0x04ab('0x1a')]===_0x04ab('0x1b')&&typeof _0x3cee44[_0x04ab('0x1c')]===_0x04ab('0x1b');var _0x1f3251=_0x149fd2[_0x04ab('0x1d')];var _0x5ce43c=_0x2b10b0?0x0:_0x3cee44[_0x04ab('0x1a')];var _0x83ab27=_0x2b10b0?_0x149fd2[_0x04ab('0x1d')]:_0x3cee44[_0x04ab('0x1a')]+_0x3cee44[_0x04ab('0x1c')];var _0x10669a;if(_0x83ab27>=_0x1f3251){_0x83ab27=_0x1f3251;_0x10669a=0xc8;}else{_0x10669a=0xce;}_0x103ca8[_0x04ab('0x18')](_0x10669a);return _0x103ca8[_0x04ab('0x1e')](_0x04ab('0x1f'),_0x5ce43c+'-'+_0x83ab27+'/'+_0x1f3251)['json'](_0x149fd2);}return null;};}function patchUpdates(_0x75a04e){return function(_0x4a6679){try{jsonpatch[_0x04ab('0x20')](_0x4a6679,_0x75a04e,!![]);}catch(_0x1d04c2){return BPromise[_0x04ab('0x21')](_0x1d04c2);}return _0x4a6679['save']();};}function saveUpdates(_0x15a36b,_0x1c08f4){return function(_0xf6275e){if(_0xf6275e){return _0xf6275e['update'](_0x15a36b)['then'](function(_0xc8358e){return _0xc8358e;});}return null;};}function removeEntity(_0x2f614a,_0x5885bd){return function(_0x551583){if(_0x551583){return _0x551583[_0x04ab('0x22')]()[_0x04ab('0x23')](function(){_0x2f614a[_0x04ab('0x18')](0xcc)[_0x04ab('0x19')]();});}};}function handleEntityNotFound(_0x26bb81,_0xa3838a){return function(_0x21d9b7){if(!_0x21d9b7){_0x26bb81[_0x04ab('0x24')](0x194);}return _0x21d9b7;};}function handleError(_0x222557,_0x5cf1e5){_0x5cf1e5=_0x5cf1e5||0x1f4;return function(_0x86bf80){logger[_0x04ab('0x25')](_0x86bf80[_0x04ab('0x26')]);if(_0x86bf80[_0x04ab('0x27')]){delete _0x86bf80['name'];}_0x222557['status'](_0x5cf1e5)[_0x04ab('0x28')](_0x86bf80);};}exports['show']=function(_0x404eae,_0x30db64){var _0x2e069d={'raw':!![],'where':{'id':_0x404eae[_0x04ab('0x29')]['id']}},_0x3c25fb={};_0x3c25fb['model']=_['keys'](db[_0x04ab('0x2a')][_0x04ab('0x2b')]);_0x3c25fb[_0x04ab('0x2c')]=_[_0x04ab('0x2d')](_0x404eae[_0x04ab('0x2c')]);_0x3c25fb[_0x04ab('0x2e')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],_0x3c25fb[_0x04ab('0x2c')]);_0x2e069d[_0x04ab('0x31')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],qs[_0x04ab('0x32')](_0x404eae['query'][_0x04ab('0x32')]));_0x2e069d[_0x04ab('0x31')]=_0x2e069d['attributes'][_0x04ab('0x33')]?_0x2e069d[_0x04ab('0x31')]:_0x3c25fb['model'];if(_0x404eae[_0x04ab('0x2c')][_0x04ab('0x34')]){_0x2e069d['include']=[{'all':!![]}];}_0x2e069d=_[_0x04ab('0x35')]({},_0x2e069d,_0x404eae[_0x04ab('0x36')]);return db[_0x04ab('0x2a')][_0x04ab('0x37')](_0x2e069d)[_0x04ab('0x23')](handleEntityNotFound(_0x30db64,null))[_0x04ab('0x23')](respondWithResult(_0x30db64,null))['catch'](handleError(_0x30db64,null));};exports[_0x04ab('0x38')]=function(_0x3f4d83,_0x2ad8ee){return db['ChatProactiveAction'][_0x04ab('0x38')](_0x3f4d83['body'],{})['then'](respondWithResult(_0x2ad8ee,0xc9))[_0x04ab('0x39')](handleError(_0x2ad8ee,null));};exports[_0x04ab('0x3a')]=function(_0x5569ba,_0x40995c){if(_0x5569ba['body']['id']){delete _0x5569ba[_0x04ab('0x3b')]['id'];}return db[_0x04ab('0x2a')][_0x04ab('0x37')]({'where':{'id':_0x5569ba[_0x04ab('0x29')]['id']}})[_0x04ab('0x23')](handleEntityNotFound(_0x40995c,null))[_0x04ab('0x23')](saveUpdates(_0x5569ba[_0x04ab('0x3b')],null))[_0x04ab('0x23')](respondWithResult(_0x40995c,null))[_0x04ab('0x39')](handleError(_0x40995c,null));};exports[_0x04ab('0x22')]=function(_0x2b79f8,_0x3f145){return db['ChatProactiveAction'][_0x04ab('0x37')]({'where':{'id':_0x2b79f8[_0x04ab('0x29')]['id']}})['then'](handleEntityNotFound(_0x3f145,null))['then'](removeEntity(_0x3f145,null))[_0x04ab('0x39')](handleError(_0x3f145,null));}; \ No newline at end of file +var _0x1738=['limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','send','show','params','model','ChatProactiveAction','keys','query','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x2f9290,_0x330528){var _0x3b0fb6=function(_0xa094c){while(--_0xa094c){_0x2f9290['push'](_0x2f9290['shift']());}};_0x3b0fb6(++_0x330528);}(_0x1738,0x1bc));var _0x8173=function(_0x53d79e,_0x48919d){_0x53d79e=_0x53d79e-0x0;var _0x14f2d8=_0x1738[_0x53d79e];return _0x14f2d8;};'use strict';var emlformat=require(_0x8173('0x0'));var rimraf=require(_0x8173('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8173('0x2'));var moment=require(_0x8173('0x3'));var BPromise=require(_0x8173('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8173('0x5'));var sox=require(_0x8173('0x6'));var csv=require(_0x8173('0x7'));var ejs=require(_0x8173('0x8'));var fs=require('fs');var fs_extra=require(_0x8173('0x9'));var _=require(_0x8173('0xa'));var squel=require(_0x8173('0xb'));var crypto=require(_0x8173('0xc'));var jsforce=require(_0x8173('0xd'));var deskjs=require(_0x8173('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8173('0xf'));var Redis=require(_0x8173('0x10'));var authService=require(_0x8173('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8173('0x12'));var logger=require(_0x8173('0x13'))(_0x8173('0x14'));var utils=require(_0x8173('0x15'));var config=require(_0x8173('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8173('0x17'))['db'];function respondWithStatusCode(_0x56f877,_0x25f678){_0x25f678=_0x25f678||0xcc;return function(_0x135911){if(_0x135911){return _0x56f877[_0x8173('0x18')](_0x25f678);}return _0x56f877[_0x8173('0x19')](_0x25f678)[_0x8173('0x1a')]();};}function respondWithResult(_0x4c7bc5,_0x40bb6b){_0x40bb6b=_0x40bb6b||0xc8;return function(_0x12c705){if(_0x12c705){return _0x4c7bc5[_0x8173('0x19')](_0x40bb6b)['json'](_0x12c705);}};}function respondWithFilteredResult(_0x5a3870,_0xd37c80){return function(_0x40bf0e){if(_0x40bf0e){var _0x2e7ca5=typeof _0xd37c80['offset']===_0x8173('0x1b')&&typeof _0xd37c80[_0x8173('0x1c')]==='undefined';var _0x70e7fc=_0x40bf0e[_0x8173('0x1d')];var _0x1caca9=_0x2e7ca5?0x0:_0xd37c80[_0x8173('0x1e')];var _0x1c78cd=_0x2e7ca5?_0x40bf0e['count']:_0xd37c80[_0x8173('0x1e')]+_0xd37c80[_0x8173('0x1c')];var _0xce80fe;if(_0x1c78cd>=_0x70e7fc){_0x1c78cd=_0x70e7fc;_0xce80fe=0xc8;}else{_0xce80fe=0xce;}_0x5a3870[_0x8173('0x19')](_0xce80fe);return _0x5a3870[_0x8173('0x1f')](_0x8173('0x20'),_0x1caca9+'-'+_0x1c78cd+'/'+_0x70e7fc)[_0x8173('0x21')](_0x40bf0e);}return null;};}function patchUpdates(_0x167845){return function(_0x1ed102){try{jsonpatch[_0x8173('0x22')](_0x1ed102,_0x167845,!![]);}catch(_0x4d9be1){return BPromise[_0x8173('0x23')](_0x4d9be1);}return _0x1ed102[_0x8173('0x24')]();};}function saveUpdates(_0x4c0556,_0x3f613f){return function(_0x5c6d79){if(_0x5c6d79){return _0x5c6d79[_0x8173('0x25')](_0x4c0556)['then'](function(_0x2d58ef){return _0x2d58ef;});}return null;};}function removeEntity(_0x5c6831,_0x117ca6){return function(_0x4545db){if(_0x4545db){return _0x4545db['destroy']()[_0x8173('0x26')](function(){_0x5c6831['status'](0xcc)[_0x8173('0x1a')]();});}};}function handleEntityNotFound(_0x189acd,_0x14050f){return function(_0x39d430){if(!_0x39d430){_0x189acd[_0x8173('0x18')](0x194);}return _0x39d430;};}function handleError(_0x39cb27,_0x27b92a){_0x27b92a=_0x27b92a||0x1f4;return function(_0x49893f){logger[_0x8173('0x27')](_0x49893f[_0x8173('0x28')]);if(_0x49893f['name']){delete _0x49893f['name'];}_0x39cb27[_0x8173('0x19')](_0x27b92a)[_0x8173('0x29')](_0x49893f);};}exports[_0x8173('0x2a')]=function(_0x5ee6e0,_0x50a935){var _0x223a9c={'raw':!![],'where':{'id':_0x5ee6e0[_0x8173('0x2b')]['id']}},_0x469a51={};_0x469a51[_0x8173('0x2c')]=_['keys'](db[_0x8173('0x2d')]['rawAttributes']);_0x469a51['query']=_[_0x8173('0x2e')](_0x5ee6e0[_0x8173('0x2f')]);_0x469a51['filters']=_['intersection'](_0x469a51[_0x8173('0x2c')],_0x469a51[_0x8173('0x2f')]);_0x223a9c[_0x8173('0x30')]=_['intersection'](_0x469a51[_0x8173('0x2c')],qs[_0x8173('0x31')](_0x5ee6e0[_0x8173('0x2f')][_0x8173('0x31')]));_0x223a9c[_0x8173('0x30')]=_0x223a9c['attributes'][_0x8173('0x32')]?_0x223a9c[_0x8173('0x30')]:_0x469a51[_0x8173('0x2c')];if(_0x5ee6e0['query'][_0x8173('0x33')]){_0x223a9c[_0x8173('0x34')]=[{'all':!![]}];}_0x223a9c=_[_0x8173('0x35')]({},_0x223a9c,_0x5ee6e0[_0x8173('0x36')]);return db[_0x8173('0x2d')][_0x8173('0x37')](_0x223a9c)[_0x8173('0x26')](handleEntityNotFound(_0x50a935,null))[_0x8173('0x26')](respondWithResult(_0x50a935,null))[_0x8173('0x38')](handleError(_0x50a935,null));};exports['create']=function(_0x46bde2,_0x240e4e){return db[_0x8173('0x2d')][_0x8173('0x39')](_0x46bde2['body'],{})[_0x8173('0x26')](respondWithResult(_0x240e4e,0xc9))[_0x8173('0x38')](handleError(_0x240e4e,null));};exports[_0x8173('0x25')]=function(_0x10432a,_0x4f5de9){if(_0x10432a[_0x8173('0x3a')]['id']){delete _0x10432a[_0x8173('0x3a')]['id'];}return db[_0x8173('0x2d')][_0x8173('0x37')]({'where':{'id':_0x10432a['params']['id']}})[_0x8173('0x26')](handleEntityNotFound(_0x4f5de9,null))[_0x8173('0x26')](saveUpdates(_0x10432a[_0x8173('0x3a')],null))[_0x8173('0x26')](respondWithResult(_0x4f5de9,null))['catch'](handleError(_0x4f5de9,null));};exports['destroy']=function(_0x595713,_0x403a54){return db['ChatProactiveAction'][_0x8173('0x37')]({'where':{'id':_0x595713['params']['id']}})['then'](handleEntityNotFound(_0x403a54,null))[_0x8173('0x26')](removeEntity(_0x403a54,null))[_0x8173('0x38')](handleError(_0x403a54,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index a6564c8..bbffe19 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 _0xcfe1=['exports','define','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes'];(function(_0x26bafe,_0x13e506){var _0x307879=function(_0x5a1548){while(--_0x5a1548){_0x26bafe['push'](_0x26bafe['shift']());}};_0x307879(++_0x13e506);}(_0xcfe1,0xdb));var _0x1cfe=function(_0x255b87,_0x4cd7d6){_0x255b87=_0x255b87-0x0;var _0x6e624e=_0xcfe1[_0x255b87];return _0x6e624e;};'use strict';var _=require(_0x1cfe('0x0'));var util=require(_0x1cfe('0x1'));var logger=require(_0x1cfe('0x2'))('api');var moment=require(_0x1cfe('0x3'));var BPromise=require(_0x1cfe('0x4'));var rp=require(_0x1cfe('0x5'));var fs=require('fs');var path=require(_0x1cfe('0x6'));var rimraf=require('rimraf');var config=require(_0x1cfe('0x7'));var attributes=require(_0x1cfe('0x8'));module[_0x1cfe('0x9')]=function(_0x33768a,_0x5d6f59){return _0x33768a[_0x1cfe('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x1cfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e13=['moment','bluebird','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5e13,0x1e9));var _0x35e1=function(_0x2e90e5,_0x25117c){_0x2e90e5=_0x2e90e5-0x0;var _0x1271b1=_0x5e13[_0x2e90e5];return _0x1271b1;};'use strict';var _=require(_0x35e1('0x0'));var util=require('util');var logger=require(_0x35e1('0x1'))(_0x35e1('0x2'));var moment=require(_0x35e1('0x3'));var BPromise=require(_0x35e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x35e1('0x5'));var config=require(_0x35e1('0x6'));var attributes=require(_0x35e1('0x7'));module[_0x35e1('0x8')]=function(_0x571c13,_0x3fdbba){return _0x571c13[_0x35e1('0x9')](_0x35e1('0xa'),attributes,{'tableName':_0x35e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 805630c..9c8455b 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 _0x2dd9=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0x42832b,_0x5ed47f){var _0x54a0a0=function(_0x53c150){while(--_0x53c150){_0x42832b['push'](_0x42832b['shift']());}};_0x54a0a0(++_0x5ed47f);}(_0x2dd9,0xd9));var _0x92dd=function(_0x4d5812,_0x27a69c){_0x4d5812=_0x4d5812-0x0;var _0x5649ef=_0x2dd9[_0x4d5812];return _0x5649ef;};'use strict';var _=require(_0x92dd('0x0'));var util=require(_0x92dd('0x1'));var moment=require(_0x92dd('0x2'));var BPromise=require(_0x92dd('0x3'));var rs=require(_0x92dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92dd('0x5'))['db'];var utils=require(_0x92dd('0x6'));var logger=require(_0x92dd('0x7'))(_0x92dd('0x8'));var config=require(_0x92dd('0x9'));var jayson=require(_0x92dd('0xa'));var client=jayson[_0x92dd('0xb')][_0x92dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24c604,_0x1a5ce4,_0x34ed71){return new BPromise(function(_0x1cce7a,_0x2d5b4d){return client[_0x92dd('0xd')](_0x24c604,_0x34ed71)[_0x92dd('0xe')](function(_0x313b4c){logger[_0x92dd('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a5ce4,_0x92dd('0x10'));logger[_0x92dd('0x11')](_0x92dd('0x12'),_0x1a5ce4,'request\x20sent',JSON['stringify'](_0x313b4c));if(_0x313b4c[_0x92dd('0x13')]){if(_0x313b4c[_0x92dd('0x13')][_0x92dd('0x14')]===0x1f4){logger[_0x92dd('0x13')](_0x92dd('0x15'),_0x1a5ce4,_0x313b4c[_0x92dd('0x13')]['message']);return _0x2d5b4d(_0x313b4c['error']['message']);}logger[_0x92dd('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a5ce4,_0x313b4c[_0x92dd('0x13')][_0x92dd('0x16')]);return _0x1cce7a(_0x313b4c['error'][_0x92dd('0x16')]);}else{logger[_0x92dd('0xf')](_0x92dd('0x15'),_0x1a5ce4,_0x92dd('0x10'));_0x1cce7a(_0x313b4c[_0x92dd('0x17')]['message']);}})['catch'](function(_0x3013f2){logger[_0x92dd('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a5ce4,_0x3013f2);_0x2d5b4d(_0x3013f2);});});} \ No newline at end of file +var _0x24ef=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','info','ChatProactiveAction,\x20%s,\x20%s','debug'];(function(_0x2fe86e,_0x41dfee){var _0x178080=function(_0x98b233){while(--_0x98b233){_0x2fe86e['push'](_0x2fe86e['shift']());}};_0x178080(++_0x41dfee);}(_0x24ef,0x1bb));var _0xf24e=function(_0x543608,_0x354e43){_0x543608=_0x543608-0x0;var _0x216746=_0x24ef[_0x543608];return _0x216746;};'use strict';var _=require(_0xf24e('0x0'));var util=require(_0xf24e('0x1'));var moment=require(_0xf24e('0x2'));var BPromise=require(_0xf24e('0x3'));var rs=require(_0xf24e('0x4'));var fs=require('fs');var Redis=require(_0xf24e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf24e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf24e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf24e('0x8')][_0xf24e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe84137,_0x5f1285,_0x480b57){return new BPromise(function(_0x15cf19,_0x1d5155){return client['request'](_0xe84137,_0x480b57)['then'](function(_0x1ed992){logger[_0xf24e('0xa')](_0xf24e('0xb'),_0x5f1285,'request\x20sent');logger[_0xf24e('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5f1285,_0xf24e('0xd'),JSON[_0xf24e('0xe')](_0x1ed992));if(_0x1ed992[_0xf24e('0xf')]){if(_0x1ed992[_0xf24e('0xf')]['code']===0x1f4){logger[_0xf24e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x5f1285,_0x1ed992[_0xf24e('0xf')][_0xf24e('0x10')]);return _0x1d5155(_0x1ed992[_0xf24e('0xf')][_0xf24e('0x10')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x5f1285,_0x1ed992[_0xf24e('0xf')][_0xf24e('0x10')]);return _0x15cf19(_0x1ed992[_0xf24e('0xf')][_0xf24e('0x10')]);}else{logger[_0xf24e('0xa')](_0xf24e('0xb'),_0x5f1285,_0xf24e('0xd'));_0x15cf19(_0x1ed992[_0xf24e('0x11')][_0xf24e('0x10')]);}})[_0xf24e('0x12')](function(_0x11c89d){logger[_0xf24e('0xf')](_0xf24e('0xb'),_0x5f1285,_0x11c89d);_0x1d5155(_0x11c89d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f327df7..43325a1 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xabce,0x103));var _0xeabc=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xabce[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0x7da7,0x10d));var _0x77da=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x7da7[_0x27604f];return _0x40d189;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index e1327ef..92337b2 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 _0x4880=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x20600f,_0x2e573e){var _0x2cdbec=function(_0x2dfc5b){while(--_0x2dfc5b){_0x20600f['push'](_0x20600f['shift']());}};_0x2cdbec(++_0x2e573e);}(_0x4880,0xb8));var _0x0488=function(_0x5c9023,_0x56d6d9){_0x5c9023=_0x5c9023-0x0;var _0x56efd0=_0x4880[_0x5c9023];return _0x56efd0;};'use strict';var Sequelize=require(_0x0488('0x0'));module[_0x0488('0x1')]={'name':{'type':Sequelize[_0x0488('0x2')],'unique':_0x0488('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0488('0x2')]},'timeout':{'type':Sequelize[_0x0488('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0488('0x5')](_0x0488('0x6'),_0x0488('0x7'),_0x0488('0x8'))}}; \ No newline at end of file +var _0x07bd=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x255f12,_0x4fb8a6){var _0x3ea173=function(_0x2344b2){while(--_0x2344b2){_0x255f12['push'](_0x255f12['shift']());}};_0x3ea173(++_0x4fb8a6);}(_0x07bd,0x1e0));var _0xd07b=function(_0x5c5e34,_0x2e3f93){_0x5c5e34=_0x5c5e34-0x0;var _0x16c7c9=_0x07bd[_0x5c5e34];return _0x16c7c9;};'use strict';var Sequelize=require(_0xd07b('0x0'));module[_0xd07b('0x1')]={'name':{'type':Sequelize[_0xd07b('0x2')],'unique':_0xd07b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd07b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd07b('0x5')](_0xd07b('0x6'),_0xd07b('0x7'),_0xd07b('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c3dcfab..21a66a8 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 _0x594b=['stack','name','send','index','map','ChatQueue','rawAttributes','type','key','getOptions','include','query','rows','catch','show','params','model','keys','attributes','intersection','fields','length','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','order','sort','where','pick','filter','merge','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','nolimit','addTeams','ids','findAll','Agents','interface','flatMap','sequelize','findOrCreate','emit','userChatQueue:save','select','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','ChatQueues','UserProfileResource'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x594b,0x147));var _0xb594=function(_0x523525,_0x58a8c5){_0x523525=_0x523525-0x0;var _0x3f42bb=_0x594b[_0x523525];return _0x3f42bb;};'use strict';var BPromise=require(_0xb594('0x0'));var util=require('util');var _=require(_0xb594('0x1'));var squel=require(_0xb594('0x2'));var Redis=require('ioredis');var qs=require(_0xb594('0x3'));var logger=require('../../config/logger')(_0xb594('0x4'));var config=require(_0xb594('0x5'));var db=require('../../mysqldb')['db'];config[_0xb594('0x6')]=_[_0xb594('0x7')](config['redis'],{'host':_0xb594('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb594('0x6')]));require('./chatQueue.socket')[_0xb594('0x9')](socket);function respondWithStatusCode(_0x2512fb,_0x254660){_0x254660=_0x254660||0xcc;return function(_0x9574dd){if(_0x9574dd){return _0x2512fb[_0xb594('0xa')](_0x254660);}return _0x2512fb[_0xb594('0xb')](_0x254660)[_0xb594('0xc')]();};}function respondWithResult(_0x183ae0,_0x3242a5){_0x3242a5=_0x3242a5||0xc8;return function(_0x5af4f6){if(_0x5af4f6){return _0x183ae0['status'](_0x3242a5)['json'](_0x5af4f6);}};}function respondWithFilteredResult(_0x15a7a7,_0x33d363){return function(_0x492459){if(_0x492459){var _0x43c12e=typeof _0x33d363[_0xb594('0xd')]===_0xb594('0xe')&&typeof _0x33d363[_0xb594('0xf')]==='undefined';var _0x575e1e=_0x492459[_0xb594('0x10')];var _0xcb6387=_0x43c12e?0x0:_0x33d363[_0xb594('0xd')];var _0x822e08=_0x43c12e?_0x492459[_0xb594('0x10')]:_0x33d363['offset']+_0x33d363['limit'];var _0x416611;if(_0x822e08>=_0x575e1e){_0x822e08=_0x575e1e;_0x416611=0xc8;}else{_0x416611=0xce;}_0x15a7a7[_0xb594('0xb')](_0x416611);return _0x15a7a7[_0xb594('0x11')](_0xb594('0x12'),_0xcb6387+'-'+_0x822e08+'/'+_0x575e1e)[_0xb594('0x13')](_0x492459);}return null;};}function saveUpdates(_0x18f6b0){return function(_0x4be4b1){if(_0x4be4b1){return _0x4be4b1['update'](_0x18f6b0)[_0xb594('0x14')](function(_0x4e2f70){return _0x4e2f70;});}return null;};}function removeEntity(_0x149b99){return function(_0x22acf8){if(_0x22acf8){return _0x22acf8[_0xb594('0x15')]()[_0xb594('0x14')](function(){var _0x59eef2=_0x22acf8['get']({'plain':!![]});var _0x2e299a=_0xb594('0x16');return db[_0xb594('0x17')][_0xb594('0x15')]({'where':{'type':_0x2e299a,'resourceId':_0x59eef2['id']}})[_0xb594('0x14')](function(){return _0x22acf8;});})[_0xb594('0x14')](function(){_0x149b99[_0xb594('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41897f){return function(_0x47c06a){if(!_0x47c06a){_0x41897f[_0xb594('0xa')](0x194);}return _0x47c06a;};}function handleError(_0x3b8dd2,_0x5f2a5e){_0x5f2a5e=_0x5f2a5e||0x1f4;return function(_0x485293){logger['error'](_0x485293[_0xb594('0x18')]);if(_0x485293[_0xb594('0x19')]){delete _0x485293[_0xb594('0x19')];}_0x3b8dd2[_0xb594('0xb')](_0x5f2a5e)[_0xb594('0x1a')](_0x485293);};}exports[_0xb594('0x1b')]=function(_0x28a425,_0x3a8ac8){var _0x5ac4aa={};var _0x3976df={'count':0x0,'rows':[]};var _0x5a5a2b=_[_0xb594('0x1c')](db[_0xb594('0x1d')][_0xb594('0x1e')],function(_0x2291e7){return{'name':_0x2291e7['fieldName'],'type':_0x2291e7[_0xb594('0x1f')][_0xb594('0x20')]};});_0x5ac4aa=qs[_0xb594('0x21')](_0x5a5a2b,_0x28a425);var _0x58dd5d={'where':_0x5ac4aa['where']};return db[_0xb594('0x1d')]['count'](_0x58dd5d)['then'](function(_0x203403){_0x3976df[_0xb594('0x10')]=_0x203403;_0x5ac4aa[_0xb594('0x22')]=qs[_0xb594('0x22')](_0x28a425[_0xb594('0x23')]);return db[_0xb594('0x1d')]['findAll'](_0x5ac4aa);})[_0xb594('0x14')](function(_0x5e0c94){_0x3976df[_0xb594('0x24')]=_0x5e0c94;return _0x3976df;})[_0xb594('0x14')](respondWithFilteredResult(_0x3a8ac8,_0x5ac4aa))[_0xb594('0x25')](handleError(_0x3a8ac8,null));};exports[_0xb594('0x26')]=function(_0x4bdae0,_0x535766){var _0x4fbb48={'raw':!![],'where':{'id':_0x4bdae0[_0xb594('0x27')]['id']}},_0x1ef790={};_0x1ef790[_0xb594('0x28')]=_['keys'](db[_0xb594('0x1d')][_0xb594('0x1e')]);_0x1ef790[_0xb594('0x23')]=_[_0xb594('0x29')](_0x4bdae0[_0xb594('0x23')]);_0x1ef790['filters']=_['intersection'](_0x1ef790[_0xb594('0x28')],_0x1ef790['query']);_0x4fbb48[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0x1ef790[_0xb594('0x28')],qs['fields'](_0x4bdae0[_0xb594('0x23')][_0xb594('0x2c')]));_0x4fbb48[_0xb594('0x2a')]=_0x4fbb48[_0xb594('0x2a')][_0xb594('0x2d')]?_0x4fbb48[_0xb594('0x2a')]:_0x1ef790[_0xb594('0x28')];if(_0x4bdae0[_0xb594('0x23')]['includeAll']){_0x4fbb48[_0xb594('0x22')]=[{'all':!![]}];}_0x4fbb48=_['merge']({},_0x4fbb48,_0x4bdae0[_0xb594('0x2e')]);return db[_0xb594('0x1d')][_0xb594('0x2f')](_0x4fbb48)[_0xb594('0x14')](handleEntityNotFound(_0x535766,null))['then'](respondWithResult(_0x535766,null))[_0xb594('0x25')](handleError(_0x535766,null));};exports[_0xb594('0x30')]=function(_0x174671,_0x4d0518){return db[_0xb594('0x1d')]['create'](_0x174671[_0xb594('0x31')],{})[_0xb594('0x14')](function(_0x2c8ccd){var _0x3ffe2e=_0x174671[_0xb594('0x32')][_0xb594('0x33')]({'plain':!![]});if(!_0x3ffe2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ffe2e[_0xb594('0x34')]===_0xb594('0x32')){var _0x41cf12=_0x2c8ccd['get']({'plain':!![]});var _0x3823ad=_0xb594('0x16');return db[_0xb594('0x35')]['find']({'where':{'name':_0x3823ad,'userProfileId':_0x3ffe2e[_0xb594('0x36')]},'raw':!![]})[_0xb594('0x14')](function(_0x3f09a9){if(_0x3f09a9&&_0x3f09a9[_0xb594('0x37')]===0x0){return db[_0xb594('0x17')][_0xb594('0x30')]({'name':_0x41cf12[_0xb594('0x19')],'resourceId':_0x41cf12['id'],'type':_0x3f09a9[_0xb594('0x19')],'sectionId':_0x3f09a9['id']},{})['then'](function(){return _0x2c8ccd;});}else{return _0x2c8ccd;}})[_0xb594('0x25')](function(_0x32e088){logger[_0xb594('0x38')](_0xb594('0x39'),_0x32e088);throw _0x32e088;});}return _0x2c8ccd;})[_0xb594('0x14')](respondWithResult(_0x4d0518,0xc9))['catch'](handleError(_0x4d0518,null));};exports[_0xb594('0x3a')]=function(_0x418c86,_0x50bd1d){if(_0x418c86[_0xb594('0x31')]['id']){delete _0x418c86[_0xb594('0x31')]['id'];}return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x418c86['params']['id']}})['then'](handleEntityNotFound(_0x50bd1d,null))[_0xb594('0x14')](saveUpdates(_0x418c86['body'],null))[_0xb594('0x14')](respondWithResult(_0x50bd1d,null))[_0xb594('0x25')](handleError(_0x50bd1d,null));};exports[_0xb594('0x15')]=function(_0xc37ec2,_0x24f247){return db[_0xb594('0x1d')]['find']({'where':{'id':_0xc37ec2[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x24f247,null))[_0xb594('0x14')](removeEntity(_0x24f247,null))[_0xb594('0x25')](handleError(_0x24f247,null));};exports[_0xb594('0x3b')]=function(_0x129393,_0x560aed){return db[_0xb594('0x1d')][_0xb594('0x3b')]()['then'](respondWithResult(_0x560aed,null))['catch'](handleError(_0x560aed,null));};exports[_0xb594('0x3c')]=function(_0x215f12,_0x5d763c){var _0x62b729={'raw':!![],'where':{}},_0x107b90={},_0x5d1c0d;return db[_0xb594('0x1d')][_0xb594('0x3d')]({'where':{'id':_0x215f12[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x5d763c,null))['then'](function(_0xf37cdb){if(_0xf37cdb){_0x5d1c0d=_0xf37cdb[_0xb594('0x33')]({'plain':!![]});_0x107b90[_0xb594('0x28')]=_['keys'](db[_0xb594('0x3e')][_0xb594('0x1e')]);_0x107b90[_0xb594('0x23')]=_[_0xb594('0x29')](_0x215f12['query']);_0x107b90[_0xb594('0x3f')]=_[_0xb594('0x2b')](_0x107b90['model'],_0x107b90[_0xb594('0x23')]);_0x62b729[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0x107b90['model'],qs[_0xb594('0x2c')](_0x215f12[_0xb594('0x23')][_0xb594('0x2c')]));_0x62b729[_0xb594('0x2a')]=_0x62b729[_0xb594('0x2a')][_0xb594('0x2d')]?_0x62b729[_0xb594('0x2a')]:_0x107b90[_0xb594('0x28')];if(!_0x215f12['query'][_0xb594('0x40')]('nolimit')){_0x62b729['limit']=qs[_0xb594('0xf')](_0x215f12['query'][_0xb594('0xf')]);_0x62b729[_0xb594('0xd')]=qs[_0xb594('0xd')](_0x215f12[_0xb594('0x23')][_0xb594('0xd')]);}_0x62b729[_0xb594('0x41')]=qs[_0xb594('0x42')](_0x215f12[_0xb594('0x23')][_0xb594('0x42')]);_0x62b729[_0xb594('0x43')]=qs[_0xb594('0x3f')](_[_0xb594('0x44')](_0x215f12[_0xb594('0x23')],_0x107b90[_0xb594('0x3f')]));_0x62b729[_0xb594('0x43')]['ChatQueueId']=_0xf37cdb['id'];if(_0x215f12[_0xb594('0x23')][_0xb594('0x45')]){_0x62b729[_0xb594('0x43')]=_['merge'](_0x62b729[_0xb594('0x43')],{'$or':_[_0xb594('0x1c')](_0x62b729[_0xb594('0x2a')],function(_0x3f21e3){var _0x1e768b={};_0x1e768b[_0x3f21e3]={'$like':'%'+_0x215f12['query'][_0xb594('0x45')]+'%'};return _0x1e768b;})});}_0x62b729=_[_0xb594('0x46')]({},_0x62b729,_0x215f12[_0xb594('0x2e')]);return db[_0xb594('0x3e')]['findAll'](_0x62b729);}})[_0xb594('0x14')](function(_0x45b363){if(_0x45b363){return db[_0xb594('0x47')][_0xb594('0x48')]({'where':{'id':_[_0xb594('0x1c')](_0x45b363,_0xb594('0x49')),'role':_0xb594('0x4a')},'attributes':['id',_0xb594('0x19'),_0xb594('0x4b'),_0xb594('0x4c'),'createdAt']});}})['then'](function(_0x314e7c){if(_0x314e7c){return{'count':_0x314e7c['count'],'rows':_[_0xb594('0x1c')](_0x314e7c[_0xb594('0x24')],function(_0x43f4d5){return{'membername':_0x43f4d5[_0xb594('0x19')],'UserId':_0x43f4d5['id'],'queue_name':_0x5d1c0d[_0xb594('0x19')],'ChatQueueId':_0x5d1c0d['id'],'interface':util[_0xb594('0x4d')](_0xb594('0x4e'),'SIP',_0x43f4d5[_0xb594('0x19')]),'penalty':0x0,'paused':_0x43f4d5[_0xb594('0x4b')],'createdAt':_0x43f4d5[_0xb594('0x4f')],'updatedAt':_0x43f4d5[_0xb594('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb594('0x14')](respondWithFilteredResult(_0x5d763c,_0x62b729))[_0xb594('0x25')](handleError(_0x5d763c,null));};exports[_0xb594('0x50')]=function(_0x184d12,_0x1d4577){var _0x18017b={};var _0x4d567f={};var _0x1571f2;var _0x13a422;return db['ChatQueue'][_0xb594('0x3d')]({'where':{'id':_0x184d12[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x1d4577,null))[_0xb594('0x14')](function(_0x1944c8){if(_0x1944c8){_0x1571f2=_0x1944c8;_0x4d567f[_0xb594('0x28')]=_[_0xb594('0x29')](db[_0xb594('0x51')][_0xb594('0x1e')]);_0x4d567f['query']=_[_0xb594('0x29')](_0x184d12[_0xb594('0x23')]);_0x4d567f[_0xb594('0x3f')]=_[_0xb594('0x2b')](_0x4d567f[_0xb594('0x28')],_0x4d567f[_0xb594('0x23')]);_0x18017b[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0x4d567f[_0xb594('0x28')],qs[_0xb594('0x2c')](_0x184d12['query'][_0xb594('0x2c')]));_0x18017b[_0xb594('0x2a')]=_0x18017b['attributes']['length']?_0x18017b[_0xb594('0x2a')]:_0x4d567f[_0xb594('0x28')];_0x18017b['order']=qs[_0xb594('0x42')](_0x184d12[_0xb594('0x23')][_0xb594('0x42')]);_0x18017b[_0xb594('0x43')]=qs[_0xb594('0x3f')](_[_0xb594('0x44')](_0x184d12[_0xb594('0x23')],_0x4d567f[_0xb594('0x3f')]));if(_0x184d12[_0xb594('0x23')]['filter']){_0x18017b[_0xb594('0x43')]=_['merge'](_0x18017b[_0xb594('0x43')],{'$or':_[_0xb594('0x1c')](_0x18017b[_0xb594('0x2a')],function(_0x4a98b1){var _0x25a3fa={};_0x25a3fa[_0x4a98b1]={'$like':'%'+_0x184d12[_0xb594('0x23')][_0xb594('0x45')]+'%'};return _0x25a3fa;})});}_0x18017b=_[_0xb594('0x46')]({},_0x18017b,_0x184d12[_0xb594('0x2e')]);return _0x1571f2[_0xb594('0x50')](_0x18017b);}})[_0xb594('0x14')](function(_0x5bd437){if(_0x5bd437){_0x13a422=_0x5bd437['length'];if(!_0x184d12[_0xb594('0x23')]['hasOwnProperty'](_0xb594('0x52'))){_0x18017b[_0xb594('0xf')]=qs[_0xb594('0xf')](_0x184d12[_0xb594('0x23')][_0xb594('0xf')]);_0x18017b[_0xb594('0xd')]=qs[_0xb594('0xd')](_0x184d12[_0xb594('0x23')][_0xb594('0xd')]);}return _0x1571f2['getTeams'](_0x18017b);}})[_0xb594('0x14')](function(_0xd3be7b){if(_0xd3be7b){return _0xd3be7b?{'count':_0x13a422,'rows':_0xd3be7b}:null;}})[_0xb594('0x14')](respondWithResult(_0x1d4577,null))['catch'](handleError(_0x1d4577,null));};exports[_0xb594('0x53')]=function(_0x5975eb,_0xb796e6){var _0x193979=_0x5975eb[_0xb594('0x31')][_0xb594('0x54')];return db[_0xb594('0x51')][_0xb594('0x55')]({'where':{'id':_0x193979},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb594('0x56'),'attributes':['id',_0xb594('0x19'),'online','voicePause',_0xb594('0x57')],'raw':!![]}]})[_0xb594('0x14')](function(_0x4acd69){if(_0x4acd69){var _0x5144ac=_[_0xb594('0x58')](_0x4acd69,function(_0x6301c6){var _0xc36974=_0x6301c6[_0xb594('0x33')]({'plain':!![]});return _0xc36974[_0xb594('0x56')];});return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x5975eb[_0xb594('0x27')]['id']}})['then'](function(_0x4f8c7e){return db[_0xb594('0x59')]['transaction'](function(_0x165470){return _0x4f8c7e[_0xb594('0x53')](_0x193979,{'transaction':_0x165470})['then'](function(){return BPromise['each'](_0x5144ac,function(_0x2b3d89){return db[_0xb594('0x3e')][_0xb594('0x5a')]({'where':{'UserId':_0x2b3d89['id'],'ChatQueueId':_0x5975eb[_0xb594('0x27')]['id']},'transaction':_0x165470});});})['then'](function(){_0x5144ac['forEach'](function(_0x50dabf){socket[_0xb594('0x5b')](_0xb594('0x5c'),{'UserId':_0x50dabf['id'],'ChatQueueId':_0x4f8c7e['id']});});});});});}})[_0xb594('0x14')](respondWithStatusCode(_0xb796e6,null))['catch'](handleError(_0xb796e6,null));};exports['removeTeams']=function(_0x5bc115,_0x4642cd){return db[_0xb594('0x51')]['findAll']({'where':{'id':_0x5bc115[_0xb594('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb594('0x47')],'as':_0xb594('0x56'),'attributes':['id'],'raw':!![]}]})[_0xb594('0x14')](handleEntityNotFound(_0x4642cd,null))[_0xb594('0x14')](function(_0x1bbcfa){var _0x4d697c=_[_0xb594('0x1c')](_0x1bbcfa,'id');var _0x493da3=[];var _0x3539dd=[];var _0x53e22e=squel[_0xb594('0x5d')]();_0x53e22e['field'](_0xb594('0x5e'))['from'](_0xb594('0x5f'),'tq')[_0xb594('0x60')]('user_has_teams','ut',_0xb594('0x61'))[_0xb594('0x43')]('ChatQueueId\x20=\x20?',_0x5bc115[_0xb594('0x27')]['id']);for(var _0x17ba52=0x0;_0x17ba52<_0x1bbcfa[_0xb594('0x2d')];_0x17ba52+=0x1){let _0x3e4ecc=_0x1bbcfa[_0x17ba52];for(var _0xca68c3=0x0;_0xca68c3<_0x3e4ecc[_0xb594('0x56')]['length'];_0xca68c3+=0x1){let _0xea148c=_0x3e4ecc[_0xb594('0x56')][_0xca68c3];var _0x2e7026=_0x53e22e[_0xb594('0x62')]();_0x2e7026['where']('ut.UserId\x20=\x20?',_0xea148c['id']);_0x3539dd[_0xb594('0x63')](db[_0xb594('0x59')][_0xb594('0x23')](_0x2e7026[_0xb594('0x64')](),{'type':db['sequelize'][_0xb594('0x65')][_0xb594('0x66')]})[_0xb594('0x14')](function(_0x2a939c){if(_0x2a939c[_0xb594('0x2d')]===0x1){return _0xea148c['id'];}else{var _0x2fa1de=_[_0xb594('0x67')](_['map'](_0x2a939c,_0xb594('0x68')),function(_0x19fc35){return _[_0xb594('0x69')](_0x4d697c,_0x19fc35);});if(_0x2fa1de){return _0xea148c['id'];}}}));}}return BPromise[_0xb594('0x6a')](_0x3539dd)[_0xb594('0x14')](function(_0xc95873){_0x493da3=_(_0x493da3)[_0xb594('0x6b')](_0xc95873)[_0xb594('0x6c')]()[_0xb594('0x6d')]();return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x5bc115['params']['id']}})[_0xb594('0x14')](function(_0x5d56f7){return db['sequelize']['transaction'](function(_0x49aeec){return _0x5d56f7[_0xb594('0x6e')](_0x5bc115['query'][_0xb594('0x54')],{'transaction':_0x49aeec})['then'](function(){if(!_['isEmpty'](_0x493da3)){return _0x5d56f7[_0xb594('0x6f')](_0x493da3,{'transaction':_0x49aeec});}})['then'](function(){_0x493da3['forEach'](function(_0x5ede50){socket[_0xb594('0x5b')](_0xb594('0x70'),{'UserId':_0x5ede50,'ChatQueueId':_0x5d56f7['id']});});});});});});})[_0xb594('0x14')](respondWithStatusCode(_0x4642cd,null))[_0xb594('0x25')](handleError(_0x4642cd,null));};exports[_0xb594('0x71')]=function(_0x14c94f,_0x2cd560){return db[_0xb594('0x1d')][_0xb594('0x2f')]({'where':{'id':_0x14c94f[_0xb594('0x27')]['id']}})['then'](handleEntityNotFound(_0x2cd560,null))['then'](function(_0x3a6875){if(_0x3a6875){return _0x3a6875[_0xb594('0x71')](_0x14c94f[_0xb594('0x31')][_0xb594('0x54')],_['omit'](_0x14c94f['body'],[_0xb594('0x54'),'id'])||{})[_0xb594('0x72')](function(_0x4f50f3){for(var _0x551183=0x0;_0x551183<_0x14c94f['body']['ids'][_0xb594('0x2d')];_0x551183+=0x1){socket[_0xb594('0x5b')](_0xb594('0x5c'),{'UserId':Number(_0x14c94f[_0xb594('0x31')]['ids'][_0x551183]),'ChatQueueId':Number(_0x14c94f['params']['id'])});}return _0x4f50f3;});}})[_0xb594('0x14')](respondWithResult(_0x2cd560,null))['catch'](handleError(_0x2cd560,null));};exports[_0xb594('0x6f')]=function(_0x3b7c58,_0x166cc3){return db[_0xb594('0x1d')]['find']({'where':{'id':_0x3b7c58[_0xb594('0x27')]['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x166cc3,null))[_0xb594('0x14')](function(_0x30855a){if(_0x30855a){return _0x30855a['removeAgents'](_0x3b7c58[_0xb594('0x23')]['ids'])[_0xb594('0x14')](function(){if(_[_0xb594('0x73')](_0x3b7c58['query'][_0xb594('0x54')])){for(var _0x3b7eca=0x0;_0x3b7eca<_0x3b7c58[_0xb594('0x23')][_0xb594('0x54')]['length'];_0x3b7eca+=0x1){socket['emit'](_0xb594('0x70'),{'UserId':Number(_0x3b7c58[_0xb594('0x23')][_0xb594('0x54')][_0x3b7eca]),'ChatQueueId':Number(_0x3b7c58[_0xb594('0x27')]['id'])});}}else{socket[_0xb594('0x5b')](_0xb594('0x70'),{'UserId':Number(_0x3b7c58[_0xb594('0x23')]['ids']),'ChatQueueId':Number(_0x3b7c58[_0xb594('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x166cc3,null))['catch'](handleError(_0x166cc3,null));};exports[_0xb594('0x74')]=function(_0x1213c8,_0x2962cc){var _0x1ee3ee={};var _0xc0d9f={};var _0x36ef16;var _0x46a5ca;return db['ChatQueue'][_0xb594('0x3d')]({'where':{'id':_0x1213c8['params']['id']}})[_0xb594('0x14')](handleEntityNotFound(_0x2962cc,null))[_0xb594('0x14')](function(_0x432f20){if(_0x432f20){_0x36ef16=_0x432f20;_0xc0d9f['model']=_[_0xb594('0x29')](db[_0xb594('0x47')][_0xb594('0x1e')]);_0xc0d9f['query']=_[_0xb594('0x29')](_0x1213c8[_0xb594('0x23')]);_0xc0d9f[_0xb594('0x3f')]=_[_0xb594('0x2b')](_0xc0d9f[_0xb594('0x28')],_0xc0d9f[_0xb594('0x23')]);_0x1ee3ee[_0xb594('0x2a')]=_[_0xb594('0x2b')](_0xc0d9f[_0xb594('0x28')],qs[_0xb594('0x2c')](_0x1213c8['query'][_0xb594('0x2c')]));_0x1ee3ee[_0xb594('0x2a')]=_0x1ee3ee['attributes']['length']?_0x1ee3ee[_0xb594('0x2a')]:_0xc0d9f[_0xb594('0x28')];_0x1ee3ee[_0xb594('0x41')]=qs['sort'](_0x1213c8[_0xb594('0x23')][_0xb594('0x42')]);_0x1ee3ee[_0xb594('0x43')]=qs[_0xb594('0x3f')](_[_0xb594('0x44')](_0x1213c8[_0xb594('0x23')],_0xc0d9f[_0xb594('0x3f')]));if(_0x1213c8[_0xb594('0x23')][_0xb594('0x45')]){_0x1ee3ee['where']=_[_0xb594('0x46')](_0x1ee3ee['where'],{'$or':_[_0xb594('0x1c')](_0x1ee3ee['attributes'],function(_0x3b9738){var _0x42e9d7={};_0x42e9d7[_0x3b9738]={'$like':'%'+_0x1213c8['query'][_0xb594('0x45')]+'%'};return _0x42e9d7;})});}_0x1ee3ee=_[_0xb594('0x46')]({},_0x1ee3ee,_0x1213c8[_0xb594('0x2e')]);return _0x36ef16['getAgents'](_0x1ee3ee);}})[_0xb594('0x14')](function(_0x2edb1f){if(_0x2edb1f){_0x46a5ca=_0x2edb1f['length'];if(!_0x1213c8['query'][_0xb594('0x40')](_0xb594('0x52'))){_0x1ee3ee[_0xb594('0xf')]=qs[_0xb594('0xf')](_0x1213c8[_0xb594('0x23')]['limit']);_0x1ee3ee[_0xb594('0xd')]=qs[_0xb594('0xd')](_0x1213c8[_0xb594('0x23')][_0xb594('0xd')]);}return _0x36ef16[_0xb594('0x74')](_0x1ee3ee);}})[_0xb594('0x14')](function(_0x2391e6){if(_0x2391e6){return _0x2391e6?{'count':_0x46a5ca,'rows':_0x2391e6}:null;}})[_0xb594('0x14')](respondWithResult(_0x2962cc,null))[_0xb594('0x25')](handleError(_0x2962cc,null));}; \ No newline at end of file +var _0x189c=['sort','pick','ChatQueueId','filter','findAndCountAll','map','UserId','agent','updatedAt','format','%s/%s','SIP','chatPause','createdAt','getTeams','Team','nolimit','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','set','Content-Range','destroy','then','get','ChatQueues','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','ChatQueue','count','findAll','rows','catch','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order'];(function(_0xeb7786,_0x53a053){var _0x120bbc=function(_0x291f05){while(--_0x291f05){_0xeb7786['push'](_0xeb7786['shift']());}};_0x120bbc(++_0x53a053);}(_0x189c,0x1b0));var _0xc189=function(_0x46131d,_0x4e701d){_0x46131d=_0x46131d-0x0;var _0x301c71=_0x189c[_0x46131d];return _0x301c71;};'use strict';var BPromise=require(_0xc189('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xc189('0x1'));var qs=require(_0xc189('0x2'));var logger=require(_0xc189('0x3'))('api');var config=require(_0xc189('0x4'));var db=require(_0xc189('0x5'))['db'];config[_0xc189('0x6')]=_[_0xc189('0x7')](config[_0xc189('0x6')],{'host':_0xc189('0x8'),'port':0x18eb});var socket=require(_0xc189('0x9'))(new Redis(config[_0xc189('0x6')]));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x35602a,_0x552991){_0x552991=_0x552991||0xcc;return function(_0x4f1dcb){if(_0x4f1dcb){return _0x35602a['sendStatus'](_0x552991);}return _0x35602a[_0xc189('0xa')](_0x552991)[_0xc189('0xb')]();};}function respondWithResult(_0x3833a8,_0x2f5231){_0x2f5231=_0x2f5231||0xc8;return function(_0x2cd1d2){if(_0x2cd1d2){return _0x3833a8[_0xc189('0xa')](_0x2f5231)[_0xc189('0xc')](_0x2cd1d2);}};}function respondWithFilteredResult(_0x243909,_0x2798d8){return function(_0x3868e9){if(_0x3868e9){var _0x4a348e=typeof _0x2798d8[_0xc189('0xd')]===_0xc189('0xe')&&typeof _0x2798d8[_0xc189('0xf')]===_0xc189('0xe');var _0x26146a=_0x3868e9['count'];var _0x5ec840=_0x4a348e?0x0:_0x2798d8['offset'];var _0x23c585=_0x4a348e?_0x3868e9['count']:_0x2798d8[_0xc189('0xd')]+_0x2798d8[_0xc189('0xf')];var _0x4caf0c;if(_0x23c585>=_0x26146a){_0x23c585=_0x26146a;_0x4caf0c=0xc8;}else{_0x4caf0c=0xce;}_0x243909[_0xc189('0xa')](_0x4caf0c);return _0x243909[_0xc189('0x10')](_0xc189('0x11'),_0x5ec840+'-'+_0x23c585+'/'+_0x26146a)[_0xc189('0xc')](_0x3868e9);}return null;};}function saveUpdates(_0x4decea){return function(_0x580e51){if(_0x580e51){return _0x580e51['update'](_0x4decea)['then'](function(_0x52e4e8){return _0x52e4e8;});}return null;};}function removeEntity(_0x5288be){return function(_0x5d2911){if(_0x5d2911){return _0x5d2911[_0xc189('0x12')]()[_0xc189('0x13')](function(){var _0x597ebd=_0x5d2911[_0xc189('0x14')]({'plain':!![]});var _0xd80405=_0xc189('0x15');return db[_0xc189('0x16')][_0xc189('0x12')]({'where':{'type':_0xd80405,'resourceId':_0x597ebd['id']}})['then'](function(){return _0x5d2911;});})[_0xc189('0x13')](function(){_0x5288be[_0xc189('0xa')](0xcc)[_0xc189('0xb')]();});}};}function handleEntityNotFound(_0x106055){return function(_0x12e4a9){if(!_0x12e4a9){_0x106055[_0xc189('0x17')](0x194);}return _0x12e4a9;};}function handleError(_0x68c385,_0x54cf12){_0x54cf12=_0x54cf12||0x1f4;return function(_0x2b79cb){logger[_0xc189('0x18')](_0x2b79cb[_0xc189('0x19')]);if(_0x2b79cb[_0xc189('0x1a')]){delete _0x2b79cb[_0xc189('0x1a')];}_0x68c385[_0xc189('0xa')](_0x54cf12)[_0xc189('0x1b')](_0x2b79cb);};}exports[_0xc189('0x1c')]=function(_0x3cf5c9,_0x5e420b){var _0x2a3db8={};var _0x2192e6={'count':0x0,'rows':[]};var _0x3be75f=_['map'](db['ChatQueue'][_0xc189('0x1d')],function(_0x3e0461){return{'name':_0x3e0461[_0xc189('0x1e')],'type':_0x3e0461['type'][_0xc189('0x1f')]};});_0x2a3db8=qs[_0xc189('0x20')](_0x3be75f,_0x3cf5c9);var _0x353856={'where':_0x2a3db8[_0xc189('0x21')]};return db[_0xc189('0x22')][_0xc189('0x23')](_0x353856)[_0xc189('0x13')](function(_0x1ba9d5){_0x2192e6[_0xc189('0x23')]=_0x1ba9d5;_0x2a3db8['include']=qs['include'](_0x3cf5c9['query']);return db[_0xc189('0x22')][_0xc189('0x24')](_0x2a3db8);})[_0xc189('0x13')](function(_0x156cca){_0x2192e6[_0xc189('0x25')]=_0x156cca;return _0x2192e6;})[_0xc189('0x13')](respondWithFilteredResult(_0x5e420b,_0x2a3db8))[_0xc189('0x26')](handleError(_0x5e420b,null));};exports['show']=function(_0xc91295,_0x9fca74){var _0x1b4ed1={'raw':!![],'where':{'id':_0xc91295['params']['id']}},_0x38dcea={};_0x38dcea[_0xc189('0x27')]=_[_0xc189('0x28')](db['ChatQueue'][_0xc189('0x1d')]);_0x38dcea[_0xc189('0x29')]=_['keys'](_0xc91295[_0xc189('0x29')]);_0x38dcea[_0xc189('0x2a')]=_[_0xc189('0x2b')](_0x38dcea[_0xc189('0x27')],_0x38dcea[_0xc189('0x29')]);_0x1b4ed1['attributes']=_[_0xc189('0x2b')](_0x38dcea[_0xc189('0x27')],qs[_0xc189('0x2c')](_0xc91295[_0xc189('0x29')]['fields']));_0x1b4ed1[_0xc189('0x2d')]=_0x1b4ed1[_0xc189('0x2d')][_0xc189('0x2e')]?_0x1b4ed1[_0xc189('0x2d')]:_0x38dcea[_0xc189('0x27')];if(_0xc91295[_0xc189('0x29')][_0xc189('0x2f')]){_0x1b4ed1[_0xc189('0x30')]=[{'all':!![]}];}_0x1b4ed1=_[_0xc189('0x31')]({},_0x1b4ed1,_0xc91295[_0xc189('0x32')]);return db['ChatQueue'][_0xc189('0x33')](_0x1b4ed1)['then'](handleEntityNotFound(_0x9fca74,null))[_0xc189('0x13')](respondWithResult(_0x9fca74,null))[_0xc189('0x26')](handleError(_0x9fca74,null));};exports[_0xc189('0x34')]=function(_0x16a8d4,_0x429e44){return db[_0xc189('0x22')][_0xc189('0x34')](_0x16a8d4[_0xc189('0x35')],{})['then'](function(_0x1127a6){var _0x3f4888=_0x16a8d4[_0xc189('0x36')][_0xc189('0x14')]({'plain':!![]});if(!_0x3f4888)throw new Error(_0xc189('0x37'));if(_0x3f4888[_0xc189('0x38')]===_0xc189('0x36')){var _0x140c96=_0x1127a6[_0xc189('0x14')]({'plain':!![]});var _0x2b0685=_0xc189('0x15');return db['UserProfileSection'][_0xc189('0x33')]({'where':{'name':_0x2b0685,'userProfileId':_0x3f4888[_0xc189('0x39')]},'raw':!![]})[_0xc189('0x13')](function(_0x59b8a6){if(_0x59b8a6&&_0x59b8a6[_0xc189('0x3a')]===0x0){return db[_0xc189('0x16')]['create']({'name':_0x140c96[_0xc189('0x1a')],'resourceId':_0x140c96['id'],'type':_0x59b8a6[_0xc189('0x1a')],'sectionId':_0x59b8a6['id']},{})[_0xc189('0x13')](function(){return _0x1127a6;});}else{return _0x1127a6;}})[_0xc189('0x26')](function(_0x4e39bb){logger[_0xc189('0x18')](_0xc189('0x3b'),_0x4e39bb);throw _0x4e39bb;});}return _0x1127a6;})[_0xc189('0x13')](respondWithResult(_0x429e44,0xc9))[_0xc189('0x26')](handleError(_0x429e44,null));};exports[_0xc189('0x3c')]=function(_0x2441c2,_0x31a873){if(_0x2441c2[_0xc189('0x35')]['id']){delete _0x2441c2[_0xc189('0x35')]['id'];}return db[_0xc189('0x22')][_0xc189('0x33')]({'where':{'id':_0x2441c2[_0xc189('0x3d')]['id']}})['then'](handleEntityNotFound(_0x31a873,null))[_0xc189('0x13')](saveUpdates(_0x2441c2[_0xc189('0x35')],null))[_0xc189('0x13')](respondWithResult(_0x31a873,null))[_0xc189('0x26')](handleError(_0x31a873,null));};exports[_0xc189('0x12')]=function(_0x3669f8,_0x4e9bf6){return db['ChatQueue']['find']({'where':{'id':_0x3669f8[_0xc189('0x3d')]['id']}})[_0xc189('0x13')](handleEntityNotFound(_0x4e9bf6,null))[_0xc189('0x13')](removeEntity(_0x4e9bf6,null))[_0xc189('0x26')](handleError(_0x4e9bf6,null));};exports[_0xc189('0x3e')]=function(_0x441020,_0x193752){return db['ChatQueue'][_0xc189('0x3e')]()['then'](respondWithResult(_0x193752,null))[_0xc189('0x26')](handleError(_0x193752,null));};exports[_0xc189('0x3f')]=function(_0x29deb3,_0x5c12f3){var _0x84be87={'raw':!![],'where':{}},_0x14a8d8={},_0x22d72b;return db['ChatQueue'][_0xc189('0x40')]({'where':{'id':_0x29deb3['params']['id']}})[_0xc189('0x13')](handleEntityNotFound(_0x5c12f3,null))[_0xc189('0x13')](function(_0x518449){if(_0x518449){_0x22d72b=_0x518449[_0xc189('0x14')]({'plain':!![]});_0x14a8d8[_0xc189('0x27')]=_[_0xc189('0x28')](db[_0xc189('0x41')]['rawAttributes']);_0x14a8d8['query']=_['keys'](_0x29deb3[_0xc189('0x29')]);_0x14a8d8[_0xc189('0x2a')]=_[_0xc189('0x2b')](_0x14a8d8[_0xc189('0x27')],_0x14a8d8[_0xc189('0x29')]);_0x84be87[_0xc189('0x2d')]=_[_0xc189('0x2b')](_0x14a8d8[_0xc189('0x27')],qs[_0xc189('0x2c')](_0x29deb3['query'][_0xc189('0x2c')]));_0x84be87['attributes']=_0x84be87[_0xc189('0x2d')][_0xc189('0x2e')]?_0x84be87[_0xc189('0x2d')]:_0x14a8d8[_0xc189('0x27')];if(!_0x29deb3['query'][_0xc189('0x42')]('nolimit')){_0x84be87[_0xc189('0xf')]=qs[_0xc189('0xf')](_0x29deb3['query'][_0xc189('0xf')]);_0x84be87[_0xc189('0xd')]=qs[_0xc189('0xd')](_0x29deb3[_0xc189('0x29')][_0xc189('0xd')]);}_0x84be87[_0xc189('0x43')]=qs[_0xc189('0x44')](_0x29deb3[_0xc189('0x29')][_0xc189('0x44')]);_0x84be87['where']=qs[_0xc189('0x2a')](_[_0xc189('0x45')](_0x29deb3[_0xc189('0x29')],_0x14a8d8['filters']));_0x84be87[_0xc189('0x21')][_0xc189('0x46')]=_0x518449['id'];if(_0x29deb3[_0xc189('0x29')][_0xc189('0x47')]){_0x84be87[_0xc189('0x21')]=_[_0xc189('0x31')](_0x84be87[_0xc189('0x21')],{'$or':_['map'](_0x84be87[_0xc189('0x2d')],function(_0x29b409){var _0x2e1d10={};_0x2e1d10[_0x29b409]={'$like':'%'+_0x29deb3['query'][_0xc189('0x47')]+'%'};return _0x2e1d10;})});}_0x84be87=_[_0xc189('0x31')]({},_0x84be87,_0x29deb3[_0xc189('0x32')]);return db[_0xc189('0x41')][_0xc189('0x24')](_0x84be87);}})[_0xc189('0x13')](function(_0x4141d2){if(_0x4141d2){return db['User'][_0xc189('0x48')]({'where':{'id':_[_0xc189('0x49')](_0x4141d2,_0xc189('0x4a')),'role':_0xc189('0x4b')},'attributes':['id',_0xc189('0x1a'),'chatPause',_0xc189('0x4c'),'createdAt']});}})[_0xc189('0x13')](function(_0x2ee5dc){if(_0x2ee5dc){return{'count':_0x2ee5dc[_0xc189('0x23')],'rows':_[_0xc189('0x49')](_0x2ee5dc[_0xc189('0x25')],function(_0x2bc56d){return{'membername':_0x2bc56d[_0xc189('0x1a')],'UserId':_0x2bc56d['id'],'queue_name':_0x22d72b[_0xc189('0x1a')],'ChatQueueId':_0x22d72b['id'],'interface':util[_0xc189('0x4d')](_0xc189('0x4e'),_0xc189('0x4f'),_0x2bc56d[_0xc189('0x1a')]),'penalty':0x0,'paused':_0x2bc56d[_0xc189('0x50')],'createdAt':_0x2bc56d[_0xc189('0x51')],'updatedAt':_0x2bc56d[_0xc189('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc189('0x13')](respondWithFilteredResult(_0x5c12f3,_0x84be87))[_0xc189('0x26')](handleError(_0x5c12f3,null));};exports[_0xc189('0x52')]=function(_0x438ba6,_0x1202f3){var _0x1e25af={};var _0x29c711={};var _0x491d59;var _0x15fa10;return db[_0xc189('0x22')][_0xc189('0x40')]({'where':{'id':_0x438ba6[_0xc189('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1202f3,null))[_0xc189('0x13')](function(_0x173e97){if(_0x173e97){_0x491d59=_0x173e97;_0x29c711[_0xc189('0x27')]=_[_0xc189('0x28')](db[_0xc189('0x53')][_0xc189('0x1d')]);_0x29c711[_0xc189('0x29')]=_[_0xc189('0x28')](_0x438ba6[_0xc189('0x29')]);_0x29c711[_0xc189('0x2a')]=_[_0xc189('0x2b')](_0x29c711[_0xc189('0x27')],_0x29c711[_0xc189('0x29')]);_0x1e25af['attributes']=_[_0xc189('0x2b')](_0x29c711[_0xc189('0x27')],qs[_0xc189('0x2c')](_0x438ba6[_0xc189('0x29')][_0xc189('0x2c')]));_0x1e25af[_0xc189('0x2d')]=_0x1e25af[_0xc189('0x2d')]['length']?_0x1e25af[_0xc189('0x2d')]:_0x29c711[_0xc189('0x27')];_0x1e25af[_0xc189('0x43')]=qs[_0xc189('0x44')](_0x438ba6[_0xc189('0x29')][_0xc189('0x44')]);_0x1e25af[_0xc189('0x21')]=qs['filters'](_['pick'](_0x438ba6[_0xc189('0x29')],_0x29c711[_0xc189('0x2a')]));if(_0x438ba6[_0xc189('0x29')]['filter']){_0x1e25af[_0xc189('0x21')]=_[_0xc189('0x31')](_0x1e25af[_0xc189('0x21')],{'$or':_[_0xc189('0x49')](_0x1e25af['attributes'],function(_0x111571){var _0x358b9f={};_0x358b9f[_0x111571]={'$like':'%'+_0x438ba6[_0xc189('0x29')][_0xc189('0x47')]+'%'};return _0x358b9f;})});}_0x1e25af=_[_0xc189('0x31')]({},_0x1e25af,_0x438ba6[_0xc189('0x32')]);return _0x491d59[_0xc189('0x52')](_0x1e25af);}})['then'](function(_0x30abe8){if(_0x30abe8){_0x15fa10=_0x30abe8['length'];if(!_0x438ba6[_0xc189('0x29')][_0xc189('0x42')](_0xc189('0x54'))){_0x1e25af[_0xc189('0xf')]=qs[_0xc189('0xf')](_0x438ba6[_0xc189('0x29')][_0xc189('0xf')]);_0x1e25af['offset']=qs[_0xc189('0xd')](_0x438ba6[_0xc189('0x29')][_0xc189('0xd')]);}return _0x491d59[_0xc189('0x52')](_0x1e25af);}})[_0xc189('0x13')](function(_0x278ff8){if(_0x278ff8){return _0x278ff8?{'count':_0x15fa10,'rows':_0x278ff8}:null;}})[_0xc189('0x13')](respondWithResult(_0x1202f3,null))[_0xc189('0x26')](handleError(_0x1202f3,null));};exports[_0xc189('0x55')]=function(_0x188dcd,_0x4ba8ea){var _0x3ebbd7=_0x188dcd[_0xc189('0x35')][_0xc189('0x56')];return db['Team'][_0xc189('0x24')]({'where':{'id':_0x3ebbd7},'attributes':['id'],'include':[{'model':db[_0xc189('0x57')],'as':_0xc189('0x58'),'attributes':['id',_0xc189('0x1a'),_0xc189('0x59'),_0xc189('0x5a'),_0xc189('0x5b')],'raw':!![]}]})[_0xc189('0x13')](function(_0x47005d){if(_0x47005d){var _0x32cb4a=_[_0xc189('0x5c')](_0x47005d,function(_0x344e5c){var _0x541f5c=_0x344e5c['get']({'plain':!![]});return _0x541f5c[_0xc189('0x58')];});return db[_0xc189('0x22')][_0xc189('0x33')]({'where':{'id':_0x188dcd['params']['id']}})[_0xc189('0x13')](function(_0x14b07d){return db[_0xc189('0x5d')][_0xc189('0x5e')](function(_0x7b4ef0){return _0x14b07d[_0xc189('0x55')](_0x3ebbd7,{'transaction':_0x7b4ef0})[_0xc189('0x13')](function(){return BPromise[_0xc189('0x5f')](_0x32cb4a,function(_0x12ff76){return db[_0xc189('0x41')][_0xc189('0x60')]({'where':{'UserId':_0x12ff76['id'],'ChatQueueId':_0x188dcd[_0xc189('0x3d')]['id']},'transaction':_0x7b4ef0});});})[_0xc189('0x13')](function(){_0x32cb4a[_0xc189('0x61')](function(_0x475b58){socket['emit'](_0xc189('0x62'),{'UserId':_0x475b58['id'],'ChatQueueId':_0x14b07d['id']});});});});});}})['then'](respondWithStatusCode(_0x4ba8ea,null))[_0xc189('0x26')](handleError(_0x4ba8ea,null));};exports[_0xc189('0x63')]=function(_0x65e4cf,_0x5efaaf){return db[_0xc189('0x53')][_0xc189('0x24')]({'where':{'id':_0x65e4cf[_0xc189('0x29')][_0xc189('0x56')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc189('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc189('0x13')](handleEntityNotFound(_0x5efaaf,null))[_0xc189('0x13')](function(_0x2ccf17){var _0x44e05c=_['map'](_0x2ccf17,'id');var _0x5b73cb=[];var _0x5b690d=[];var _0xd448fe=squel['select']();_0xd448fe[_0xc189('0x64')](_0xc189('0x65'))['from']('team_has_chat_queues','tq')[_0xc189('0x66')](_0xc189('0x67'),'ut',_0xc189('0x68'))[_0xc189('0x21')](_0xc189('0x69'),_0x65e4cf[_0xc189('0x3d')]['id']);for(var _0x405e72=0x0;_0x405e72<_0x2ccf17['length'];_0x405e72+=0x1){let _0x2c5463=_0x2ccf17[_0x405e72];for(var _0x525695=0x0;_0x525695<_0x2c5463[_0xc189('0x58')][_0xc189('0x2e')];_0x525695+=0x1){let _0x32a3c9=_0x2c5463[_0xc189('0x58')][_0x525695];var _0x4db65a=_0xd448fe[_0xc189('0x6a')]();_0x4db65a[_0xc189('0x21')](_0xc189('0x6b'),_0x32a3c9['id']);_0x5b690d[_0xc189('0x6c')](db[_0xc189('0x5d')][_0xc189('0x29')](_0x4db65a[_0xc189('0x6d')](),{'type':db[_0xc189('0x5d')][_0xc189('0x6e')]['SELECT']})['then'](function(_0x4ba3a0){if(_0x4ba3a0[_0xc189('0x2e')]===0x1){return _0x32a3c9['id'];}else{var _0x3fdf36=_[_0xc189('0x6f')](_['map'](_0x4ba3a0,'TeamId'),function(_0x352f66){return _[_0xc189('0x70')](_0x44e05c,_0x352f66);});if(_0x3fdf36){return _0x32a3c9['id'];}}}));}}return BPromise[_0xc189('0x71')](_0x5b690d)[_0xc189('0x13')](function(_0x7f08bd){_0x5b73cb=_(_0x5b73cb)[_0xc189('0x72')](_0x7f08bd)[_0xc189('0x73')]()[_0xc189('0x74')]();return db[_0xc189('0x22')][_0xc189('0x33')]({'where':{'id':_0x65e4cf[_0xc189('0x3d')]['id']}})['then'](function(_0x25327d){return db[_0xc189('0x5d')]['transaction'](function(_0x335712){return _0x25327d[_0xc189('0x63')](_0x65e4cf[_0xc189('0x29')][_0xc189('0x56')],{'transaction':_0x335712})[_0xc189('0x13')](function(){if(!_['isEmpty'](_0x5b73cb)){return _0x25327d[_0xc189('0x75')](_0x5b73cb,{'transaction':_0x335712});}})['then'](function(){_0x5b73cb[_0xc189('0x61')](function(_0x2df077){socket[_0xc189('0x76')](_0xc189('0x77'),{'UserId':_0x2df077,'ChatQueueId':_0x25327d['id']});});});});});});})[_0xc189('0x13')](respondWithStatusCode(_0x5efaaf,null))['catch'](handleError(_0x5efaaf,null));};exports[_0xc189('0x78')]=function(_0x15da48,_0x24f04c){return db[_0xc189('0x22')]['find']({'where':{'id':_0x15da48[_0xc189('0x3d')]['id']}})[_0xc189('0x13')](handleEntityNotFound(_0x24f04c,null))[_0xc189('0x13')](function(_0x2dcd46){if(_0x2dcd46){return _0x2dcd46[_0xc189('0x78')](_0x15da48[_0xc189('0x35')]['ids'],_[_0xc189('0x79')](_0x15da48[_0xc189('0x35')],[_0xc189('0x56'),'id'])||{})[_0xc189('0x7a')](function(_0xe9973e){for(var _0x2b86ca=0x0;_0x2b86ca<_0x15da48['body'][_0xc189('0x56')][_0xc189('0x2e')];_0x2b86ca+=0x1){socket[_0xc189('0x76')](_0xc189('0x62'),{'UserId':Number(_0x15da48[_0xc189('0x35')]['ids'][_0x2b86ca]),'ChatQueueId':Number(_0x15da48[_0xc189('0x3d')]['id'])});}return _0xe9973e;});}})['then'](respondWithResult(_0x24f04c,null))[_0xc189('0x26')](handleError(_0x24f04c,null));};exports['removeAgents']=function(_0x4e2bf4,_0x574022){return db[_0xc189('0x22')][_0xc189('0x33')]({'where':{'id':_0x4e2bf4['params']['id']}})[_0xc189('0x13')](handleEntityNotFound(_0x574022,null))[_0xc189('0x13')](function(_0x1872eb){if(_0x1872eb){return _0x1872eb[_0xc189('0x75')](_0x4e2bf4[_0xc189('0x29')][_0xc189('0x56')])[_0xc189('0x13')](function(){if(_[_0xc189('0x7b')](_0x4e2bf4[_0xc189('0x29')][_0xc189('0x56')])){for(var _0x15baa3=0x0;_0x15baa3<_0x4e2bf4[_0xc189('0x29')]['ids'][_0xc189('0x2e')];_0x15baa3+=0x1){socket[_0xc189('0x76')](_0xc189('0x77'),{'UserId':Number(_0x4e2bf4[_0xc189('0x29')][_0xc189('0x56')][_0x15baa3]),'ChatQueueId':Number(_0x4e2bf4[_0xc189('0x3d')]['id'])});}}else{socket[_0xc189('0x76')](_0xc189('0x77'),{'UserId':Number(_0x4e2bf4['query'][_0xc189('0x56')]),'ChatQueueId':Number(_0x4e2bf4[_0xc189('0x3d')]['id'])});}});}})[_0xc189('0x13')](respondWithStatusCode(_0x574022,null))[_0xc189('0x26')](handleError(_0x574022,null));};exports['getAgents']=function(_0x521037,_0x1c85c3){var _0x5f2bcf={};var _0x53a6fb={};var _0xe5371c;var _0x2c1e5d;return db[_0xc189('0x22')][_0xc189('0x40')]({'where':{'id':_0x521037[_0xc189('0x3d')]['id']}})[_0xc189('0x13')](handleEntityNotFound(_0x1c85c3,null))[_0xc189('0x13')](function(_0x33479d){if(_0x33479d){_0xe5371c=_0x33479d;_0x53a6fb[_0xc189('0x27')]=_[_0xc189('0x28')](db[_0xc189('0x57')][_0xc189('0x1d')]);_0x53a6fb[_0xc189('0x29')]=_[_0xc189('0x28')](_0x521037['query']);_0x53a6fb[_0xc189('0x2a')]=_[_0xc189('0x2b')](_0x53a6fb[_0xc189('0x27')],_0x53a6fb[_0xc189('0x29')]);_0x5f2bcf[_0xc189('0x2d')]=_['intersection'](_0x53a6fb[_0xc189('0x27')],qs[_0xc189('0x2c')](_0x521037[_0xc189('0x29')][_0xc189('0x2c')]));_0x5f2bcf[_0xc189('0x2d')]=_0x5f2bcf['attributes'][_0xc189('0x2e')]?_0x5f2bcf[_0xc189('0x2d')]:_0x53a6fb[_0xc189('0x27')];_0x5f2bcf['order']=qs[_0xc189('0x44')](_0x521037[_0xc189('0x29')][_0xc189('0x44')]);_0x5f2bcf['where']=qs['filters'](_[_0xc189('0x45')](_0x521037[_0xc189('0x29')],_0x53a6fb[_0xc189('0x2a')]));if(_0x521037['query'][_0xc189('0x47')]){_0x5f2bcf[_0xc189('0x21')]=_[_0xc189('0x31')](_0x5f2bcf[_0xc189('0x21')],{'$or':_[_0xc189('0x49')](_0x5f2bcf[_0xc189('0x2d')],function(_0x7e0cf7){var _0x5bde2f={};_0x5bde2f[_0x7e0cf7]={'$like':'%'+_0x521037[_0xc189('0x29')][_0xc189('0x47')]+'%'};return _0x5bde2f;})});}_0x5f2bcf=_[_0xc189('0x31')]({},_0x5f2bcf,_0x521037[_0xc189('0x32')]);return _0xe5371c[_0xc189('0x7c')](_0x5f2bcf);}})[_0xc189('0x13')](function(_0x574b6a){if(_0x574b6a){_0x2c1e5d=_0x574b6a[_0xc189('0x2e')];if(!_0x521037[_0xc189('0x29')][_0xc189('0x42')](_0xc189('0x54'))){_0x5f2bcf[_0xc189('0xf')]=qs[_0xc189('0xf')](_0x521037[_0xc189('0x29')][_0xc189('0xf')]);_0x5f2bcf[_0xc189('0xd')]=qs['offset'](_0x521037[_0xc189('0x29')][_0xc189('0xd')]);}return _0xe5371c['getAgents'](_0x5f2bcf);}})[_0xc189('0x13')](function(_0x571eca){if(_0x571eca){return _0x571eca?{'count':_0x2c1e5d,'rows':_0x571eca}:null;}})[_0xc189('0x13')](respondWithResult(_0x1c85c3,null))['catch'](handleError(_0x1c85c3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 315c9cb..9e06819 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 _0x6fd7=['update','remove','emit','hasOwnProperty','events','ChatQueue','setMaxListeners'];(function(_0x229f8d,_0x48402c){var _0x3e193c=function(_0x58009d){while(--_0x58009d){_0x229f8d['push'](_0x229f8d['shift']());}};_0x3e193c(++_0x48402c);}(_0x6fd7,0x11c));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x76fd('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x76fd('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x76fd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x76fd('0x3'),'afterDestroy':_0x76fd('0x4')};function emitEvent(_0xda228d){return function(_0x481987,_0x34e6b8,_0x25446){ChatQueueEvents['emit'](_0xda228d+':'+_0x481987['id'],_0x481987);ChatQueueEvents[_0x76fd('0x5')](_0xda228d,_0x481987);_0x25446(null);};}for(var e in events){if(events[_0x76fd('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x7e20=['hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e20,0x7b));var _0x07e2=function(_0x3f8558,_0x220003){_0x3f8558=_0x3f8558-0x0;var _0x2a6ee1=_0x7e20[_0x3f8558];return _0x2a6ee1;};'use strict';var EventEmitter=require(_0x07e2('0x0'));var ChatQueue=require(_0x07e2('0x1'))['db'][_0x07e2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x07e2('0x3')](0x0);var events={'afterCreate':_0x07e2('0x4'),'afterUpdate':_0x07e2('0x5'),'afterDestroy':_0x07e2('0x6')};function emitEvent(_0x45ad4c){return function(_0x49db70,_0x16d972,_0x5c65b9){ChatQueueEvents[_0x07e2('0x7')](_0x45ad4c+':'+_0x49db70['id'],_0x49db70);ChatQueueEvents[_0x07e2('0x7')](_0x45ad4c,_0x49db70);_0x5c65b9(null);};}for(var e in events){if(events[_0x07e2('0x8')](e)){var event=events[e];ChatQueue[_0x07e2('0x9')](e,emitEvent(event));}}module[_0x07e2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9f0ad84..c4bfd13 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 _0xf030=['api','moment','request-promise','path','rimraf','../../config/environment','ChatQueue','chat_queues','util','../../config/logger'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf030,0xb2));var _0x0f03=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf030[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x0f03('0x0'));var logger=require(_0x0f03('0x1'))(_0x0f03('0x2'));var moment=require(_0x0f03('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f03('0x4'));var fs=require('fs');var path=require(_0x0f03('0x5'));var rimraf=require(_0x0f03('0x6'));var config=require(_0x0f03('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x41921d,_0x329b34){return _0x41921d['define'](_0x0f03('0x8'),attributes,{'tableName':_0x0f03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x455f=['./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b42dc,_0x5bd3d2){var _0x13e94e=function(_0x1b337e){while(--_0x1b337e){_0x4b42dc['push'](_0x4b42dc['shift']());}};_0x13e94e(++_0x5bd3d2);}(_0x455f,0x13c));var _0xf455=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x455f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf455('0x0'));var util=require(_0xf455('0x1'));var logger=require(_0xf455('0x2'))(_0xf455('0x3'));var moment=require(_0xf455('0x4'));var BPromise=require(_0xf455('0x5'));var rp=require(_0xf455('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf455('0x7'));var config=require(_0xf455('0x8'));var attributes=require(_0xf455('0x9'));module[_0xf455('0xa')]=function(_0xee23f6,_0x1c7cf3){return _0xee23f6['define'](_0xf455('0xb'),attributes,{'tableName':_0xf455('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 db62112..3d87689 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 _0x3aa2=['error','code','message','result','GetChatQueue','findAll','options','raw','where','limit','include','attributes','map','model','debug','catch','ChatQueue','find','ShowChatQueue','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x21b43f,_0x206e22){var _0x2d4d49=function(_0xfc013c){while(--_0xfc013c){_0x21b43f['push'](_0x21b43f['shift']());}};_0x2d4d49(++_0x206e22);}(_0x3aa2,0x13b));var _0x23aa=function(_0x5ce781,_0x736b15){_0x5ce781=_0x5ce781-0x0;var _0xa70499=_0x3aa2[_0x5ce781];return _0xa70499;};'use strict';var _=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));var moment=require('moment');var BPromise=require(_0x23aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23aa('0x3'))['db'];var utils=require(_0x23aa('0x4'));var logger=require('../../config/logger')(_0x23aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x23aa('0x6'));var client=jayson[_0x23aa('0x7')]['http']({'port':0x232a});config[_0x23aa('0x8')]=_[_0x23aa('0x9')](config[_0x23aa('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x23aa('0xa'))(new Redis(config[_0x23aa('0x8')]));require(_0x23aa('0xb'))['register'](socket);function respondWithRpcPromise(_0x4b8b1a,_0xb70adc,_0x5100f4){return new BPromise(function(_0x3f9456,_0x155c20){return client[_0x23aa('0xc')](_0x4b8b1a,_0x5100f4)[_0x23aa('0xd')](function(_0x106b13){logger[_0x23aa('0xe')](_0x23aa('0xf'),_0xb70adc,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xb70adc,_0x23aa('0x10'),JSON[_0x23aa('0x11')](_0x106b13));if(_0x106b13[_0x23aa('0x12')]){if(_0x106b13[_0x23aa('0x12')][_0x23aa('0x13')]===0x1f4){logger[_0x23aa('0x12')](_0x23aa('0xf'),_0xb70adc,_0x106b13[_0x23aa('0x12')]['message']);return _0x155c20(_0x106b13[_0x23aa('0x12')]['message']);}logger['error'](_0x23aa('0xf'),_0xb70adc,_0x106b13[_0x23aa('0x12')][_0x23aa('0x14')]);return _0x3f9456(_0x106b13[_0x23aa('0x12')][_0x23aa('0x14')]);}else{logger[_0x23aa('0xe')]('ChatQueue,\x20%s,\x20%s',_0xb70adc,_0x23aa('0x10'));_0x3f9456(_0x106b13[_0x23aa('0x15')]['message']);}})['catch'](function(_0x4d660f){logger['error'](_0x23aa('0xf'),_0xb70adc,_0x4d660f);_0x155c20(_0x4d660f);});});}exports[_0x23aa('0x16')]=function(_0x14a8a){var _0x545ac6=this;return new Promise(function(_0x2f5918,_0x140c66){return db['ChatQueue'][_0x23aa('0x17')]({'raw':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')][_0x23aa('0x19')]===undefined?!![]:![]:!![],'where':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')][_0x23aa('0x1a')]||null:null,'attributes':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')]['attributes']||null:null,'limit':_0x14a8a[_0x23aa('0x18')]?_0x14a8a[_0x23aa('0x18')][_0x23aa('0x1b')]||null:null,'include':_0x14a8a[_0x23aa('0x18')]?_0x14a8a['options'][_0x23aa('0x1c')]?_['map'](_0x14a8a[_0x23aa('0x18')][_0x23aa('0x1c')],function(_0x305eff){return{'model':db[_0x305eff['model']],'as':_0x305eff['as'],'attributes':_0x305eff[_0x23aa('0x1d')],'include':_0x305eff[_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x305eff[_0x23aa('0x1c')],function(_0x593354){return{'model':db[_0x593354['model']],'as':_0x593354['as'],'attributes':_0x593354['attributes'],'include':_0x593354[_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x593354[_0x23aa('0x1c')],function(_0x7139ef){return{'model':db[_0x7139ef[_0x23aa('0x1f')]],'as':_0x7139ef['as'],'attributes':_0x7139ef[_0x23aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23aa('0xd')](function(_0x2163c0){logger[_0x23aa('0xe')](_0x23aa('0x16'),_0x14a8a);logger[_0x23aa('0x20')](_0x23aa('0x16'),_0x14a8a,JSON[_0x23aa('0x11')](_0x2163c0));_0x2f5918(_0x2163c0);})[_0x23aa('0x21')](function(_0x5a21e1){logger['error'](_0x23aa('0x16'),_0x5a21e1[_0x23aa('0x14')],_0x14a8a);_0x140c66(_0x545ac6[_0x23aa('0x12')](0x1f4,_0x5a21e1['message']));});});};exports['ShowChatQueue']=function(_0x2ea616){var _0x21fc15=this;return new Promise(function(_0x46553e,_0x52a419){return db[_0x23aa('0x22')][_0x23aa('0x23')]({'raw':_0x2ea616['options']?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x19')]===undefined?!![]:![]:!![],'where':_0x2ea616['options']?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x1a')]||null:null,'attributes':_0x2ea616['options']?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x1d')]||null:null,'include':_0x2ea616[_0x23aa('0x18')]?_0x2ea616[_0x23aa('0x18')][_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x2ea616[_0x23aa('0x18')]['include'],function(_0x29500e){return{'model':db[_0x29500e[_0x23aa('0x1f')]],'as':_0x29500e['as'],'attributes':_0x29500e[_0x23aa('0x1d')],'include':_0x29500e['include']?_['map'](_0x29500e[_0x23aa('0x1c')],function(_0x369dcc){return{'model':db[_0x369dcc[_0x23aa('0x1f')]],'as':_0x369dcc['as'],'attributes':_0x369dcc['attributes'],'include':_0x369dcc[_0x23aa('0x1c')]?_[_0x23aa('0x1e')](_0x369dcc[_0x23aa('0x1c')],function(_0x348aa5){return{'model':db[_0x348aa5[_0x23aa('0x1f')]],'as':_0x348aa5['as'],'attributes':_0x348aa5[_0x23aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23aa('0xd')](function(_0xb231c0){logger[_0x23aa('0xe')](_0x23aa('0x24'),_0x2ea616);logger[_0x23aa('0x20')](_0x23aa('0x24'),_0x2ea616,JSON['stringify'](_0xb231c0));_0x46553e(_0xb231c0);})['catch'](function(_0x1cd967){logger['error']('ShowChatQueue',_0x1cd967[_0x23aa('0x14')],_0x2ea616);_0x52a419(_0x21fc15['error'](0x1f4,_0x1cd967[_0x23aa('0x14')]));});});}; \ No newline at end of file +var _0x6f4f=['jayson/promise','client','redis','defaults','localhost','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetChatQueue','ChatQueue','options','where','limit','model','map','include','attributes','then','find','ShowChatQueue','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x23f4fd,_0x2e809a){var _0x21409b=function(_0xf41348){while(--_0xf41348){_0x23f4fd['push'](_0x23f4fd['shift']());}};_0x21409b(++_0x2e809a);}(_0x6f4f,0x187));var _0xf6f4=function(_0x3f8379,_0x42b010){_0x3f8379=_0x3f8379-0x0;var _0x5bd21f=_0x6f4f[_0x3f8379];return _0x5bd21f;};'use strict';var _=require(_0xf6f4('0x0'));var util=require(_0xf6f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf6f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6f4('0x3'))['db'];var utils=require(_0xf6f4('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf6f4('0x5'));var client=jayson[_0xf6f4('0x6')]['http']({'port':0x232a});config[_0xf6f4('0x7')]=_[_0xf6f4('0x8')](config['redis'],{'host':_0xf6f4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0xf6f4('0xa')](socket);function respondWithRpcPromise(_0x21787f,_0x243122,_0x4b4310){return new BPromise(function(_0x1621de,_0x5cd977){return client[_0xf6f4('0xb')](_0x21787f,_0x4b4310)['then'](function(_0x2f0ac2){logger[_0xf6f4('0xc')](_0xf6f4('0xd'),_0x243122,_0xf6f4('0xe'));logger[_0xf6f4('0xf')](_0xf6f4('0x10'),_0x243122,_0xf6f4('0xe'),JSON[_0xf6f4('0x11')](_0x2f0ac2));if(_0x2f0ac2[_0xf6f4('0x12')]){if(_0x2f0ac2[_0xf6f4('0x12')]['code']===0x1f4){logger['error'](_0xf6f4('0xd'),_0x243122,_0x2f0ac2[_0xf6f4('0x12')][_0xf6f4('0x13')]);return _0x5cd977(_0x2f0ac2['error'][_0xf6f4('0x13')]);}logger[_0xf6f4('0x12')](_0xf6f4('0xd'),_0x243122,_0x2f0ac2['error'][_0xf6f4('0x13')]);return _0x1621de(_0x2f0ac2[_0xf6f4('0x12')][_0xf6f4('0x13')]);}else{logger[_0xf6f4('0xc')](_0xf6f4('0xd'),_0x243122,_0xf6f4('0xe'));_0x1621de(_0x2f0ac2[_0xf6f4('0x14')]['message']);}})['catch'](function(_0x3a1f51){logger[_0xf6f4('0x12')](_0xf6f4('0xd'),_0x243122,_0x3a1f51);_0x5cd977(_0x3a1f51);});});}exports[_0xf6f4('0x15')]=function(_0x58e734){var _0x49c236=this;return new Promise(function(_0x1d48de,_0x1c008b){return db[_0xf6f4('0x16')]['findAll']({'raw':_0x58e734[_0xf6f4('0x17')]?_0x58e734[_0xf6f4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58e734['options']?_0x58e734[_0xf6f4('0x17')][_0xf6f4('0x18')]||null:null,'attributes':_0x58e734[_0xf6f4('0x17')]?_0x58e734['options']['attributes']||null:null,'limit':_0x58e734['options']?_0x58e734[_0xf6f4('0x17')][_0xf6f4('0x19')]||null:null,'include':_0x58e734[_0xf6f4('0x17')]?_0x58e734[_0xf6f4('0x17')]['include']?_['map'](_0x58e734[_0xf6f4('0x17')]['include'],function(_0x55ce10){return{'model':db[_0x55ce10[_0xf6f4('0x1a')]],'as':_0x55ce10['as'],'attributes':_0x55ce10['attributes'],'include':_0x55ce10['include']?_[_0xf6f4('0x1b')](_0x55ce10[_0xf6f4('0x1c')],function(_0x934c7){return{'model':db[_0x934c7[_0xf6f4('0x1a')]],'as':_0x934c7['as'],'attributes':_0x934c7[_0xf6f4('0x1d')],'include':_0x934c7[_0xf6f4('0x1c')]?_[_0xf6f4('0x1b')](_0x934c7['include'],function(_0x4d6999){return{'model':db[_0x4d6999[_0xf6f4('0x1a')]],'as':_0x4d6999['as'],'attributes':_0x4d6999[_0xf6f4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf6f4('0x1e')](function(_0x26b2fd){logger[_0xf6f4('0xc')](_0xf6f4('0x15'),_0x58e734);logger[_0xf6f4('0xf')](_0xf6f4('0x15'),_0x58e734,JSON[_0xf6f4('0x11')](_0x26b2fd));_0x1d48de(_0x26b2fd);})['catch'](function(_0x5884f8){logger[_0xf6f4('0x12')](_0xf6f4('0x15'),_0x5884f8[_0xf6f4('0x13')],_0x58e734);_0x1c008b(_0x49c236[_0xf6f4('0x12')](0x1f4,_0x5884f8[_0xf6f4('0x13')]));});});};exports['ShowChatQueue']=function(_0x1abdf5){var _0x552b45=this;return new Promise(function(_0x1f10b5,_0x2bd38a){return db[_0xf6f4('0x16')][_0xf6f4('0x1f')]({'raw':_0x1abdf5[_0xf6f4('0x17')]?_0x1abdf5[_0xf6f4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1abdf5[_0xf6f4('0x17')]?_0x1abdf5[_0xf6f4('0x17')][_0xf6f4('0x18')]||null:null,'attributes':_0x1abdf5[_0xf6f4('0x17')]?_0x1abdf5[_0xf6f4('0x17')][_0xf6f4('0x1d')]||null:null,'include':_0x1abdf5[_0xf6f4('0x17')]?_0x1abdf5[_0xf6f4('0x17')][_0xf6f4('0x1c')]?_['map'](_0x1abdf5[_0xf6f4('0x17')][_0xf6f4('0x1c')],function(_0x35262d){return{'model':db[_0x35262d[_0xf6f4('0x1a')]],'as':_0x35262d['as'],'attributes':_0x35262d[_0xf6f4('0x1d')],'include':_0x35262d[_0xf6f4('0x1c')]?_[_0xf6f4('0x1b')](_0x35262d['include'],function(_0x10d45e){return{'model':db[_0x10d45e[_0xf6f4('0x1a')]],'as':_0x10d45e['as'],'attributes':_0x10d45e['attributes'],'include':_0x10d45e[_0xf6f4('0x1c')]?_[_0xf6f4('0x1b')](_0x10d45e[_0xf6f4('0x1c')],function(_0xe2e1f7){return{'model':db[_0xe2e1f7[_0xf6f4('0x1a')]],'as':_0xe2e1f7['as'],'attributes':_0xe2e1f7[_0xf6f4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf6f4('0x1e')](function(_0x4ad111){logger[_0xf6f4('0xc')]('ShowChatQueue',_0x1abdf5);logger['debug']('ShowChatQueue',_0x1abdf5,JSON['stringify'](_0x4ad111));_0x1f10b5(_0x4ad111);})['catch'](function(_0x869452){logger[_0xf6f4('0x12')](_0xf6f4('0x20'),_0x869452[_0xf6f4('0x13')],_0x1abdf5);_0x2bd38a(_0x552b45[_0xf6f4('0x12')](0x1f4,_0x869452[_0xf6f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7f12126..0381a42 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 _0xf3cd=['remove','update','emit','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3050b5,_0x182c6a){_0x3050b5=_0x3050b5-0x0;var _0x37cceb=_0xf3cd[_0x3050b5];return _0x37cceb;};'use strict';var ChatQueueEvents=require(_0xdf3c('0x0'));var events=[_0xdf3c('0x1'),_0xdf3c('0x2'),_0xdf3c('0x3')];function createListener(_0x1839ec,_0x433a7f){return function(_0x54db05){_0x433a7f[_0xdf3c('0x4')](_0x1839ec,_0x54db05);};}function removeListener(_0x71b446,_0x9f71cb){return function(){ChatQueueEvents['removeListener'](_0x71b446,_0x9f71cb);};}exports[_0xdf3c('0x5')]=function(_0x17d42a){for(var _0x1313d5=0x0,_0x1f0601=events[_0xdf3c('0x6')];_0x1313d5<_0x1f0601;_0x1313d5++){var _0x28edae=events[_0x1313d5];var _0x52c073=createListener(_0xdf3c('0x7')+_0x28edae,_0x17d42a);ChatQueueEvents['on'](_0x28edae,_0x52c073);}}; \ No newline at end of file +var _0xb332=['emit','register','./chatQueue.events','remove','update'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xb332,0xd9));var _0x2b33=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xb332[_0x25efdf];return _0x22c495;};'use strict';var ChatQueueEvents=require(_0x2b33('0x0'));var events=['save',_0x2b33('0x1'),_0x2b33('0x2')];function createListener(_0x5ee720,_0xf8c6a7){return function(_0x548a70){_0xf8c6a7[_0x2b33('0x3')](_0x5ee720,_0x548a70);};}function removeListener(_0x4c6634,_0x34b111){return function(){ChatQueueEvents['removeListener'](_0x4c6634,_0x34b111);};}exports[_0x2b33('0x4')]=function(_0x22d66){for(var _0x478214=0x0,_0x461d44=events['length'];_0x478214<_0x461d44;_0x478214++){var _0x5ccf2d=events[_0x478214];var _0x4302b7=createListener('chatQueue:'+_0x5ccf2d,_0x22d66);ChatQueueEvents['on'](_0x5ccf2d,_0x4302b7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 5827739..478bd08 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x5e3ab0,_0x4cf6dc){var _0x1dece8=function(_0x110dda){while(--_0x110dda){_0x5e3ab0['push'](_0x5e3ab0['shift']());}};_0x1dece8(++_0x4cf6dc);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x3076f9,_0x379308){var _0x552d12=function(_0x58627e){while(--_0x58627e){_0x3076f9['push'](_0x3076f9['shift']());}};_0x552d12(++_0x379308);}(_0xe14b,0x93));var _0xbe14=function(_0x36f28b,_0x3f09d0){_0x36f28b=_0x36f28b-0x0;var _0x4693d5=_0xe14b[_0x36f28b];return _0x4693d5;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 9f95e5a..4b24d7e 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 _0x455d=['DATE','exports','STRING'];(function(_0xccb95,_0x300783){var _0x382f46=function(_0x18519f){while(--_0x18519f){_0xccb95['push'](_0xccb95['shift']());}};_0x382f46(++_0x300783);}(_0x455d,0x190));var _0xd455=function(_0x45cbfd,_0x48ea7d){_0x45cbfd=_0x45cbfd-0x0;var _0x112e2e=_0x455d[_0x45cbfd];return _0x112e2e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd455('0x0')]={'uniqueid':{'type':Sequelize[_0xd455('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd455('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd455('0x2')]},'acceptAt':{'type':Sequelize[_0xd455('0x2')]},'exitAt':{'type':Sequelize[_0xd455('0x2')]},'reason':{'type':Sequelize[_0xd455('0x1')]}}; \ No newline at end of file +var _0x1572=['DATE','moment','STRING'];(function(_0x3066c0,_0x1f9dbd){var _0x27ec53=function(_0x3db91f){while(--_0x3db91f){_0x3066c0['push'](_0x3066c0['shift']());}};_0x27ec53(++_0x1f9dbd);}(_0x1572,0xf7));var _0x2157=function(_0x4c4c79,_0x2b98cf){_0x4c4c79=_0x4c4c79-0x0;var _0x45cb00=_0x1572[_0x4c4c79];return _0x45cb00;};'use strict';var moment=require(_0x2157('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x2157('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x2157('0x1')]},'joinAt':{'type':Sequelize[_0x2157('0x2')]},'leaveAt':{'type':Sequelize[_0x2157('0x2')]},'acceptAt':{'type':Sequelize[_0x2157('0x2')]},'exitAt':{'type':Sequelize[_0x2157('0x2')]},'reason':{'type':Sequelize[_0x2157('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 53bcf85..49a3906 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 _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x915de9,_0xabf9e5){var _0x274129=function(_0x27fd79){while(--_0x27fd79){_0x915de9['push'](_0x915de9['shift']());}};_0x274129(++_0xabf9e5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'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['ChatQueueReport']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['ChatQueueReport'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file +var _0xf603=['moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x1048a7,_0x3e9182){var _0x41c4e9=function(_0x1f8492){while(--_0x1f8492){_0x1048a7['push'](_0x1048a7['shift']());}};_0x41c4e9(++_0x3e9182);}(_0xf603,0x124));var _0x3f60=function(_0x5f12a9,_0x272231){_0x5f12a9=_0x5f12a9-0x0;var _0x5d2bc4=_0xf603[_0x5f12a9];return _0x5d2bc4;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f60('0x2'));var rp=require(_0x3f60('0x3'));var moment=require(_0x3f60('0x4'));var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require(_0x3f60('0x7'));var path=require(_0x3f60('0x8'));var sox=require(_0x3f60('0x9'));var csv=require(_0x3f60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f60('0xb'));var crypto=require(_0x3f60('0xc'));var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0xa'));var querystring=require(_0x3f60('0xf'));var Papa=require(_0x3f60('0x10'));var Redis=require(_0x3f60('0x11'));var authService=require(_0x3f60('0x12'));var qs=require(_0x3f60('0x13'));var as=require(_0x3f60('0x14'));var hardwareService=require(_0x3f60('0x15'));var logger=require(_0x3f60('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];function respondWithStatusCode(_0x2e79e8,_0x58e120){_0x58e120=_0x58e120||0xcc;return function(_0xeb6151){if(_0xeb6151){return _0x2e79e8[_0x3f60('0x19')](_0x58e120);}return _0x2e79e8['status'](_0x58e120)[_0x3f60('0x1a')]();};}function respondWithResult(_0x1b3e74,_0x53ec7a){_0x53ec7a=_0x53ec7a||0xc8;return function(_0x1ec7f4){if(_0x1ec7f4){return _0x1b3e74['status'](_0x53ec7a)[_0x3f60('0x1b')](_0x1ec7f4);}};}function respondWithFilteredResult(_0x2cd28f,_0x5e7718){return function(_0x3c0e9d){if(_0x3c0e9d){var _0x4e84b5=typeof _0x5e7718[_0x3f60('0x1c')]==='undefined'&&typeof _0x5e7718[_0x3f60('0x1d')]===_0x3f60('0x1e');var _0xbc26c=_0x3c0e9d[_0x3f60('0x1f')];var _0x3ae771=_0x4e84b5?0x0:_0x5e7718[_0x3f60('0x1c')];var _0x52aa44=_0x4e84b5?_0x3c0e9d[_0x3f60('0x1f')]:_0x5e7718[_0x3f60('0x1c')]+_0x5e7718[_0x3f60('0x1d')];var _0x9c845f;if(_0x52aa44>=_0xbc26c){_0x52aa44=_0xbc26c;_0x9c845f=0xc8;}else{_0x9c845f=0xce;}_0x2cd28f[_0x3f60('0x20')](_0x9c845f);return _0x2cd28f[_0x3f60('0x21')]('Content-Range',_0x3ae771+'-'+_0x52aa44+'/'+_0xbc26c)[_0x3f60('0x1b')](_0x3c0e9d);}return null;};}function patchUpdates(_0x2f1735){return function(_0x4dace9){try{jsonpatch[_0x3f60('0x22')](_0x4dace9,_0x2f1735,!![]);}catch(_0x2dba08){return BPromise[_0x3f60('0x23')](_0x2dba08);}return _0x4dace9[_0x3f60('0x24')]();};}function saveUpdates(_0x1d23bb,_0x1b161e){return function(_0x44b665){if(_0x44b665){return _0x44b665[_0x3f60('0x25')](_0x1d23bb)[_0x3f60('0x26')](function(_0x31847d){return _0x31847d;});}return null;};}function removeEntity(_0x3f6fa7,_0x35b8f6){return function(_0x1f9390){if(_0x1f9390){return _0x1f9390[_0x3f60('0x27')]()[_0x3f60('0x26')](function(){_0x3f6fa7['status'](0xcc)[_0x3f60('0x1a')]();});}};}function handleEntityNotFound(_0x3cdef4,_0x15315b){return function(_0x4581d6){if(!_0x4581d6){_0x3cdef4[_0x3f60('0x19')](0x194);}return _0x4581d6;};}function handleError(_0x36dfdb,_0xc106a9){_0xc106a9=_0xc106a9||0x1f4;return function(_0x23e265){logger['error'](_0x23e265[_0x3f60('0x28')]);if(_0x23e265[_0x3f60('0x29')]){delete _0x23e265[_0x3f60('0x29')];}_0x36dfdb[_0x3f60('0x20')](_0xc106a9)[_0x3f60('0x2a')](_0x23e265);};}exports[_0x3f60('0x2b')]=function(_0x39e14c,_0x4520a5){var _0x16b590={},_0x3cd0a7={},_0x2f1bc9={'count':0x0,'rows':[]};var _0x457e5b=_[_0x3f60('0x2c')](db[_0x3f60('0x2d')][_0x3f60('0x2e')],function(_0x14d83c){return{'name':_0x14d83c[_0x3f60('0x2f')],'type':_0x14d83c[_0x3f60('0x30')][_0x3f60('0x31')]};});_0x3cd0a7[_0x3f60('0x32')]=_[_0x3f60('0x2c')](_0x457e5b,_0x3f60('0x29'));_0x3cd0a7[_0x3f60('0x33')]=_[_0x3f60('0x34')](_0x39e14c[_0x3f60('0x33')]);_0x3cd0a7[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x3cd0a7[_0x3f60('0x32')],_0x3cd0a7[_0x3f60('0x33')]);_0x16b590[_0x3f60('0x37')]=_[_0x3f60('0x36')](_0x3cd0a7['model'],qs[_0x3f60('0x38')](_0x39e14c[_0x3f60('0x33')]['fields']));_0x16b590[_0x3f60('0x37')]=_0x16b590[_0x3f60('0x37')][_0x3f60('0x39')]?_0x16b590[_0x3f60('0x37')]:_0x3cd0a7['model'];if(!_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3a')]('nolimit')){_0x16b590['limit']=qs[_0x3f60('0x1d')](_0x39e14c['query'][_0x3f60('0x1d')]);_0x16b590[_0x3f60('0x1c')]=qs[_0x3f60('0x1c')](_0x39e14c[_0x3f60('0x33')]['offset']);}_0x16b590['order']=qs[_0x3f60('0x3b')](_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3b')]);_0x16b590[_0x3f60('0x3c')]=qs[_0x3f60('0x35')](_[_0x3f60('0x3d')](_0x39e14c['query'],_0x3cd0a7[_0x3f60('0x35')]),_0x457e5b);if(_0x39e14c['query'][_0x3f60('0x3e')]){_0x16b590['where']=_[_0x3f60('0x3f')](_0x16b590[_0x3f60('0x3c')],{'$or':_[_0x3f60('0x2c')](_0x457e5b,function(_0x466d05){if(_0x466d05[_0x3f60('0x30')]!=='VIRTUAL'){var _0x4fa98d={};_0x4fa98d[_0x466d05[_0x3f60('0x29')]]={'$like':'%'+_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3e')]+'%'};return _0x4fa98d;}})});}_0x16b590=_['merge']({},_0x16b590,_0x39e14c[_0x3f60('0x40')]);var _0x42f82d={'where':_0x16b590['where']};return db['ChatQueueReport'][_0x3f60('0x1f')](_0x42f82d)[_0x3f60('0x26')](function(_0x3f2129){_0x2f1bc9[_0x3f60('0x1f')]=_0x3f2129;if(_0x39e14c[_0x3f60('0x33')]['includeAll']){_0x16b590[_0x3f60('0x41')]=[{'all':!![]}];}return db[_0x3f60('0x2d')][_0x3f60('0x42')](_0x16b590);})[_0x3f60('0x26')](function(_0x4c6346){_0x2f1bc9[_0x3f60('0x43')]=_0x4c6346;return _0x2f1bc9;})['then'](respondWithFilteredResult(_0x4520a5,_0x16b590))['catch'](handleError(_0x4520a5,null));};exports[_0x3f60('0x44')]=function(_0x20422a,_0x4ef8f2){var _0x5cfc2f={'raw':!![],'where':{'id':_0x20422a[_0x3f60('0x45')]['id']}},_0x4f0752={};_0x4f0752[_0x3f60('0x32')]=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x4f0752[_0x3f60('0x33')]=_['keys'](_0x20422a['query']);_0x4f0752[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x4f0752['model'],_0x4f0752['query']);_0x5cfc2f[_0x3f60('0x37')]=_['intersection'](_0x4f0752[_0x3f60('0x32')],qs['fields'](_0x20422a[_0x3f60('0x33')][_0x3f60('0x38')]));_0x5cfc2f[_0x3f60('0x37')]=_0x5cfc2f[_0x3f60('0x37')][_0x3f60('0x39')]?_0x5cfc2f['attributes']:_0x4f0752[_0x3f60('0x32')];if(_0x20422a[_0x3f60('0x33')]['includeAll']){_0x5cfc2f['include']=[{'all':!![]}];}_0x5cfc2f=_[_0x3f60('0x3f')]({},_0x5cfc2f,_0x20422a[_0x3f60('0x40')]);return db[_0x3f60('0x2d')][_0x3f60('0x46')](_0x5cfc2f)[_0x3f60('0x26')](handleEntityNotFound(_0x4ef8f2,null))['then'](respondWithResult(_0x4ef8f2,null))[_0x3f60('0x47')](handleError(_0x4ef8f2,null));};exports['create']=function(_0xe5a2a6,_0x253d2f){return db[_0x3f60('0x2d')]['create'](_0xe5a2a6[_0x3f60('0x48')],{})[_0x3f60('0x26')](respondWithResult(_0x253d2f,0xc9))[_0x3f60('0x47')](handleError(_0x253d2f,null));};exports['update']=function(_0x217348,_0x55f75f){if(_0x217348[_0x3f60('0x48')]['id']){delete _0x217348[_0x3f60('0x48')]['id'];}return db[_0x3f60('0x2d')][_0x3f60('0x46')]({'where':{'id':_0x217348['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55f75f,null))[_0x3f60('0x26')](saveUpdates(_0x217348['body'],null))[_0x3f60('0x26')](respondWithResult(_0x55f75f,null))['catch'](handleError(_0x55f75f,null));};exports['destroy']=function(_0x4ce17d,_0x55dd97){return db['ChatQueueReport'][_0x3f60('0x46')]({'where':{'id':_0x4ce17d['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55dd97,null))[_0x3f60('0x26')](removeEntity(_0x55dd97,null))[_0x3f60('0x47')](handleError(_0x55dd97,null));};exports['describe']=function(_0x1f9921,_0x1c09a0){return db[_0x3f60('0x2d')][_0x3f60('0x49')]()[_0x3f60('0x26')](respondWithResult(_0x1c09a0,null))[_0x3f60('0x47')](handleError(_0x1c09a0,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ac1c878..da7fc45 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x45e2ec,_0x47d252){var _0x423716=function(_0x292a4d){while(--_0x292a4d){_0x45e2ec['push'](_0x45e2ec['shift']());}};_0x423716(++_0x47d252);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3614d1,_0x3cfb67){var _0x4ae3b7=function(_0x31cb31){while(--_0x31cb31){_0x3614d1['push'](_0x3614d1['shift']());}};_0x4ae3b7(++_0x3cfb67);}(_0xb7e7,0x121));var _0x7b7e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb7e7[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4bad53d..838a48a 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 _0x6d96=['rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','info','request\x20sent','result','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6d96,0x13c));var _0x66d9=function(_0x304655,_0x15b109){_0x304655=_0x304655-0x0;var _0x2fa58a=_0x6d96[_0x304655];return _0x2fa58a;};'use strict';var _=require(_0x66d9('0x0'));var util=require(_0x66d9('0x1'));var moment=require(_0x66d9('0x2'));var BPromise=require(_0x66d9('0x3'));var rs=require(_0x66d9('0x4'));var fs=require('fs');var Redis=require(_0x66d9('0x5'));var db=require(_0x66d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x66d9('0x7'))(_0x66d9('0x8'));var config=require(_0x66d9('0x9'));var jayson=require(_0x66d9('0xa'));var client=jayson[_0x66d9('0xb')][_0x66d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6b7a0e,_0x416301,_0x56411e){return new BPromise(function(_0x3d4690,_0x470aa5){return client[_0x66d9('0xd')](_0x6b7a0e,_0x56411e)[_0x66d9('0xe')](function(_0x201f7f){logger['info'](_0x66d9('0xf'),_0x416301,'request\x20sent');logger[_0x66d9('0x10')](_0x66d9('0x11'),_0x416301,'request\x20sent',JSON[_0x66d9('0x12')](_0x201f7f));if(_0x201f7f[_0x66d9('0x13')]){if(_0x201f7f[_0x66d9('0x13')][_0x66d9('0x14')]===0x1f4){logger[_0x66d9('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x416301,_0x201f7f[_0x66d9('0x13')]['message']);return _0x470aa5(_0x201f7f[_0x66d9('0x13')]['message']);}logger[_0x66d9('0x13')](_0x66d9('0xf'),_0x416301,_0x201f7f[_0x66d9('0x13')]['message']);return _0x3d4690(_0x201f7f[_0x66d9('0x13')]['message']);}else{logger[_0x66d9('0x15')](_0x66d9('0xf'),_0x416301,_0x66d9('0x16'));_0x3d4690(_0x201f7f[_0x66d9('0x17')][_0x66d9('0x18')]);}})[_0x66d9('0x19')](function(_0x1a4db6){logger['error'](_0x66d9('0xf'),_0x416301,_0x1a4db6);_0x470aa5(_0x1a4db6);});});}exports[_0x66d9('0x1a')]=function(_0x548a59){var _0x445607=this;return new Promise(function(_0xd36d7f,_0x151e77){return db[_0x66d9('0x1b')][_0x66d9('0x1c')](_0x548a59[_0x66d9('0x1d')],{'raw':_0x548a59['options']?_0x548a59[_0x66d9('0x1e')][_0x66d9('0x1f')]===undefined?!![]:![]:!![]})[_0x66d9('0xe')](function(_0x35a58e){logger[_0x66d9('0x15')](_0x66d9('0x1a'),_0x548a59);logger['debug'](_0x66d9('0x1a'),_0x548a59,JSON[_0x66d9('0x12')](_0x35a58e));_0xd36d7f(_0x35a58e);})[_0x66d9('0x19')](function(_0x513314){logger[_0x66d9('0x13')](_0x66d9('0x1a'),_0x513314[_0x66d9('0x18')],_0x548a59);_0x151e77(_0x445607['error'](0x1f4,_0x513314[_0x66d9('0x18')]));});});};exports['UpdateChatQueueReport']=function(_0x10dd00){var _0x525435=this;return new Promise(function(_0x861cd6,_0x257967){return db[_0x66d9('0x1b')][_0x66d9('0x20')](_0x10dd00[_0x66d9('0x1d')],{'raw':_0x10dd00['options']?_0x10dd00[_0x66d9('0x1e')][_0x66d9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10dd00[_0x66d9('0x1e')]?_0x10dd00[_0x66d9('0x1e')][_0x66d9('0x21')]||null:null,'attributes':_0x10dd00[_0x66d9('0x1e')]?_0x10dd00[_0x66d9('0x1e')]['attributes']||null:null,'limit':_0x10dd00['options']?_0x10dd00[_0x66d9('0x1e')][_0x66d9('0x22')]||null:null})[_0x66d9('0xe')](function(_0x586f8e){logger['info'](_0x66d9('0x23'),_0x10dd00);logger[_0x66d9('0x10')](_0x66d9('0x23'),_0x10dd00,JSON['stringify'](_0x586f8e));_0x861cd6(_0x586f8e);})[_0x66d9('0x19')](function(_0x3b2edf){logger[_0x66d9('0x13')](_0x66d9('0x23'),_0x3b2edf[_0x66d9('0x18')],_0x10dd00);_0x257967(_0x525435[_0x66d9('0x13')](0x1f4,_0x3b2edf['message']));});});}; \ No newline at end of file +var _0x6722=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatQueueReport','create','body','options','info','CreateChatQueueReport','catch','UpdateChatQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then'];(function(_0x586e45,_0x42c80e){var _0x480ad9=function(_0x3e48f6){while(--_0x3e48f6){_0x586e45['push'](_0x586e45['shift']());}};_0x480ad9(++_0x42c80e);}(_0x6722,0x134));var _0x2672=function(_0x4bfc08,_0x7b6e6f){_0x4bfc08=_0x4bfc08-0x0;var _0x27cded=_0x6722[_0x4bfc08];return _0x27cded;};'use strict';var _=require(_0x2672('0x0'));var util=require(_0x2672('0x1'));var moment=require(_0x2672('0x2'));var BPromise=require(_0x2672('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2672('0x4'));var db=require(_0x2672('0x5'))['db'];var utils=require(_0x2672('0x6'));var logger=require(_0x2672('0x7'))(_0x2672('0x8'));var config=require('../../config/environment');var jayson=require(_0x2672('0x9'));var client=jayson[_0x2672('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bed98,_0xe88a11,_0x1a9785){return new BPromise(function(_0x4006a1,_0x5f28f0){return client['request'](_0x1bed98,_0x1a9785)[_0x2672('0xb')](function(_0x283393){logger['info'](_0x2672('0xc'),_0xe88a11,_0x2672('0xd'));logger[_0x2672('0xe')](_0x2672('0xf'),_0xe88a11,_0x2672('0xd'),JSON[_0x2672('0x10')](_0x283393));if(_0x283393[_0x2672('0x11')]){if(_0x283393[_0x2672('0x11')]['code']===0x1f4){logger['error'](_0x2672('0xc'),_0xe88a11,_0x283393[_0x2672('0x11')]['message']);return _0x5f28f0(_0x283393[_0x2672('0x11')][_0x2672('0x12')]);}logger[_0x2672('0x11')](_0x2672('0xc'),_0xe88a11,_0x283393[_0x2672('0x11')][_0x2672('0x12')]);return _0x4006a1(_0x283393[_0x2672('0x11')][_0x2672('0x12')]);}else{logger['info'](_0x2672('0xc'),_0xe88a11,_0x2672('0xd'));_0x4006a1(_0x283393[_0x2672('0x13')][_0x2672('0x12')]);}})['catch'](function(_0x3d49ad){logger[_0x2672('0x11')](_0x2672('0xc'),_0xe88a11,_0x3d49ad);_0x5f28f0(_0x3d49ad);});});}exports['CreateChatQueueReport']=function(_0x56cc22){var _0x134868=this;return new Promise(function(_0x39f1f4,_0x95dd40){return db[_0x2672('0x14')][_0x2672('0x15')](_0x56cc22[_0x2672('0x16')],{'raw':_0x56cc22['options']?_0x56cc22[_0x2672('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2672('0xb')](function(_0x498df6){logger[_0x2672('0x18')](_0x2672('0x19'),_0x56cc22);logger[_0x2672('0xe')]('CreateChatQueueReport',_0x56cc22,JSON['stringify'](_0x498df6));_0x39f1f4(_0x498df6);})[_0x2672('0x1a')](function(_0x3e127d){logger[_0x2672('0x11')](_0x2672('0x19'),_0x3e127d[_0x2672('0x12')],_0x56cc22);_0x95dd40(_0x134868[_0x2672('0x11')](0x1f4,_0x3e127d[_0x2672('0x12')]));});});};exports[_0x2672('0x1b')]=function(_0x1b19ed){var _0x371d6e=this;return new Promise(function(_0x3f2b85,_0x2a495e){return db[_0x2672('0x14')][_0x2672('0x1c')](_0x1b19ed[_0x2672('0x16')],{'raw':_0x1b19ed[_0x2672('0x17')]?_0x1b19ed['options'][_0x2672('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b19ed[_0x2672('0x17')]?_0x1b19ed[_0x2672('0x17')][_0x2672('0x1e')]||null:null,'attributes':_0x1b19ed[_0x2672('0x17')]?_0x1b19ed[_0x2672('0x17')]['attributes']||null:null,'limit':_0x1b19ed['options']?_0x1b19ed['options'][_0x2672('0x1f')]||null:null})[_0x2672('0xb')](function(_0x202ac1){logger[_0x2672('0x18')]('UpdateChatQueueReport',_0x1b19ed);logger[_0x2672('0xe')](_0x2672('0x1b'),_0x1b19ed,JSON[_0x2672('0x10')](_0x202ac1));_0x3f2b85(_0x202ac1);})[_0x2672('0x1a')](function(_0x158df0){logger[_0x2672('0x11')]('UpdateChatQueueReport',_0x158df0[_0x2672('0x12')],_0x1b19ed);_0x2a495e(_0x371d6e[_0x2672('0x11')](0x1f4,_0x158df0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ec0d6be..7d2807c 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 _0x9892=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1e0eba,_0x15a84c){var _0x631c66=function(_0x36e68){while(--_0x36e68){_0x1e0eba['push'](_0x1e0eba['shift']());}};_0x631c66(++_0x15a84c);}(_0x9892,0xae));var _0x2989=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x9892[_0x46b22a];return _0x44c2e8;};'use strict';var multer=require(_0x2989('0x0'));var util=require(_0x2989('0x1'));var path=require(_0x2989('0x2'));var timeout=require(_0x2989('0x3'));var express=require(_0x2989('0x4'));var router=express[_0x2989('0x5')]();var fs_extra=require(_0x2989('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2989('0x7'));var config=require(_0x2989('0x8'));var controller=require(_0x2989('0x9'));router[_0x2989('0xa')]('/',auth[_0x2989('0xb')](),controller[_0x2989('0xc')]);router[_0x2989('0xa')]('/describe',auth[_0x2989('0xb')](),controller['describe']);router[_0x2989('0xa')](_0x2989('0xd'),auth[_0x2989('0xb')](),controller[_0x2989('0xe')]);router[_0x2989('0xf')]('/',auth['isAuthenticated'](),controller[_0x2989('0x10')]);router[_0x2989('0x11')]('/:id',auth[_0x2989('0xb')](),controller['update']);router[_0x2989('0x12')](_0x2989('0xd'),auth[_0x2989('0xb')](),controller[_0x2989('0x13')]);module[_0x2989('0x14')]=router; \ No newline at end of file +var _0x9665=['get','isAuthenticated','index','/:id','post','put','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x1f21d9,_0x1df02e){var _0x46db9c=function(_0x20fae3){while(--_0x20fae3){_0x1f21d9['push'](_0x1f21d9['shift']());}};_0x46db9c(++_0x1df02e);}(_0x9665,0xbc));var _0x5966=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9665[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require(_0x5966('0x0'));var path=require(_0x5966('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5966('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5966('0x3'));var interaction=require(_0x5966('0x4'));var config=require(_0x5966('0x5'));var controller=require(_0x5966('0x6'));router[_0x5966('0x7')]('/',auth[_0x5966('0x8')](),controller[_0x5966('0x9')]);router[_0x5966('0x7')]('/describe',auth[_0x5966('0x8')](),controller['describe']);router[_0x5966('0x7')](_0x5966('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x5966('0xb')]('/',auth[_0x5966('0x8')](),controller['create']);router[_0x5966('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5966('0xa'),auth[_0x5966('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 5bafe5b..f68adf4 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x88ba56,_0x5caa1e){var _0x1c1639=function(_0x377bc2){while(--_0x377bc2){_0x88ba56['push'](_0x88ba56['shift']());}};_0x1c1639(++_0x5caa1e);}(_0xedd9,0xfc));var _0x9edd=function(_0x20da4,_0x33a01e){_0x20da4=_0x20da4-0x0;var _0x10a2ea=_0xedd9[_0x20da4];return _0x10a2ea;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x45a5a3,_0x4bbd82){var _0x5ba07c=function(_0xaedf7f){while(--_0xaedf7f){_0x45a5a3['push'](_0x45a5a3['shift']());}};_0x5ba07c(++_0x4bbd82);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 644f72a..9334330 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 _0x6d54=['fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','then','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','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/environment','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','destroy','error','stack','name','send','ChatTransferReport','rawAttributes'];(function(_0x341517,_0x5297d1){var _0x106eab=function(_0x3796e2){while(--_0x3796e2){_0x341517['push'](_0x341517['shift']());}};_0x106eab(++_0x5297d1);}(_0x6d54,0xab));var _0x46d5=function(_0x469100,_0x537385){_0x469100=_0x469100-0x0;var _0x26efb8=_0x6d54[_0x469100];return _0x26efb8;};'use strict';var emlformat=require(_0x46d5('0x0'));var rimraf=require(_0x46d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46d5('0x2'));var rp=require(_0x46d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x46d5('0x4'));var sox=require(_0x46d5('0x5'));var csv=require(_0x46d5('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46d5('0x7'));var _=require(_0x46d5('0x8'));var squel=require('squel');var crypto=require(_0x46d5('0x9'));var jsforce=require(_0x46d5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x46d5('0x6'));var querystring=require(_0x46d5('0xb'));var Papa=require(_0x46d5('0xc'));var Redis=require(_0x46d5('0xd'));var authService=require(_0x46d5('0xe'));var qs=require(_0x46d5('0xf'));var as=require(_0x46d5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46d5('0x11'))(_0x46d5('0x12'));var utils=require(_0x46d5('0x13'));var config=require(_0x46d5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x157599,_0x5a9fa4){_0x5a9fa4=_0x5a9fa4||0xcc;return function(_0x23b309){if(_0x23b309){return _0x157599[_0x46d5('0x15')](_0x5a9fa4);}return _0x157599[_0x46d5('0x16')](_0x5a9fa4)[_0x46d5('0x17')]();};}function respondWithResult(_0x43a577,_0x13eb69){_0x13eb69=_0x13eb69||0xc8;return function(_0x4710ec){if(_0x4710ec){return _0x43a577[_0x46d5('0x16')](_0x13eb69)[_0x46d5('0x18')](_0x4710ec);}};}function respondWithFilteredResult(_0x30eba7,_0x275dcf){return function(_0x2d190b){if(_0x2d190b){var _0x4368a6=typeof _0x275dcf[_0x46d5('0x19')]===_0x46d5('0x1a')&&typeof _0x275dcf[_0x46d5('0x1b')]===_0x46d5('0x1a');var _0xae9ec=_0x2d190b[_0x46d5('0x1c')];var _0x954bdb=_0x4368a6?0x0:_0x275dcf['offset'];var _0x1a1125=_0x4368a6?_0x2d190b[_0x46d5('0x1c')]:_0x275dcf[_0x46d5('0x19')]+_0x275dcf[_0x46d5('0x1b')];var _0xcc40f;if(_0x1a1125>=_0xae9ec){_0x1a1125=_0xae9ec;_0xcc40f=0xc8;}else{_0xcc40f=0xce;}_0x30eba7[_0x46d5('0x16')](_0xcc40f);return _0x30eba7['set']('Content-Range',_0x954bdb+'-'+_0x1a1125+'/'+_0xae9ec)[_0x46d5('0x18')](_0x2d190b);}return null;};}function patchUpdates(_0x4243df){return function(_0x1bd19e){try{jsonpatch[_0x46d5('0x1d')](_0x1bd19e,_0x4243df,!![]);}catch(_0x2282e1){return BPromise['reject'](_0x2282e1);}return _0x1bd19e[_0x46d5('0x1e')]();};}function saveUpdates(_0x2b3481,_0x44e891){return function(_0x30aaa3){if(_0x30aaa3){return _0x30aaa3[_0x46d5('0x1f')](_0x2b3481)['then'](function(_0x1456f0){return _0x1456f0;});}return null;};}function removeEntity(_0x36f9af,_0x4e1526){return function(_0x2d47b0){if(_0x2d47b0){return _0x2d47b0[_0x46d5('0x20')]()['then'](function(){_0x36f9af[_0x46d5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42cb85,_0x50ead4){return function(_0x2fe76f){if(!_0x2fe76f){_0x42cb85['sendStatus'](0x194);}return _0x2fe76f;};}function handleError(_0x5c506b,_0xee02de){_0xee02de=_0xee02de||0x1f4;return function(_0x5b64f1){logger[_0x46d5('0x21')](_0x5b64f1[_0x46d5('0x22')]);if(_0x5b64f1[_0x46d5('0x23')]){delete _0x5b64f1[_0x46d5('0x23')];}_0x5c506b[_0x46d5('0x16')](_0xee02de)[_0x46d5('0x24')](_0x5b64f1);};}exports['index']=function(_0x4c8a5c,_0x3720a6){var _0x38e285={},_0x5884b6={},_0x24e0e6={'count':0x0,'rows':[]};var _0x2726c1=_['map'](db[_0x46d5('0x25')][_0x46d5('0x26')],function(_0x52fc2e){return{'name':_0x52fc2e[_0x46d5('0x27')],'type':_0x52fc2e[_0x46d5('0x28')]['key']};});_0x5884b6[_0x46d5('0x29')]=_[_0x46d5('0x2a')](_0x2726c1,_0x46d5('0x23'));_0x5884b6['query']=_['keys'](_0x4c8a5c[_0x46d5('0x2b')]);_0x5884b6['filters']=_[_0x46d5('0x2c')](_0x5884b6['model'],_0x5884b6['query']);_0x38e285[_0x46d5('0x2d')]=_['intersection'](_0x5884b6[_0x46d5('0x29')],qs[_0x46d5('0x2e')](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x2e')]));_0x38e285['attributes']=_0x38e285[_0x46d5('0x2d')][_0x46d5('0x2f')]?_0x38e285[_0x46d5('0x2d')]:_0x5884b6[_0x46d5('0x29')];if(!_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x30')](_0x46d5('0x31'))){_0x38e285[_0x46d5('0x1b')]=qs['limit'](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x1b')]);_0x38e285[_0x46d5('0x19')]=qs['offset'](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x19')]);}_0x38e285[_0x46d5('0x32')]=qs['sort'](_0x4c8a5c[_0x46d5('0x2b')][_0x46d5('0x33')]);_0x38e285['where']=qs[_0x46d5('0x34')](_['pick'](_0x4c8a5c[_0x46d5('0x2b')],_0x5884b6[_0x46d5('0x34')]),_0x2726c1);if(_0x4c8a5c[_0x46d5('0x2b')]['filter']){_0x38e285[_0x46d5('0x35')]=_[_0x46d5('0x36')](_0x38e285['where'],{'$or':_[_0x46d5('0x2a')](_0x2726c1,function(_0x407fb8){if(_0x407fb8[_0x46d5('0x28')]!==_0x46d5('0x37')){var _0x311aa8={};_0x311aa8[_0x407fb8[_0x46d5('0x23')]]={'$like':'%'+_0x4c8a5c['query'][_0x46d5('0x38')]+'%'};return _0x311aa8;}})});}_0x38e285=_[_0x46d5('0x36')]({},_0x38e285,_0x4c8a5c['options']);var _0x9fc212={'where':_0x38e285['where']};return db[_0x46d5('0x25')][_0x46d5('0x1c')](_0x9fc212)[_0x46d5('0x39')](function(_0x56c305){_0x24e0e6[_0x46d5('0x1c')]=_0x56c305;if(_0x4c8a5c[_0x46d5('0x2b')]['includeAll']){_0x38e285[_0x46d5('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x46d5('0x3b')](_0x38e285);})['then'](function(_0x1d7be0){_0x24e0e6[_0x46d5('0x3c')]=_0x1d7be0;return _0x24e0e6;})[_0x46d5('0x39')](respondWithFilteredResult(_0x3720a6,_0x38e285))[_0x46d5('0x3d')](handleError(_0x3720a6,null));};exports['show']=function(_0x185d73,_0x4dc285){var _0x4e70df={'raw':!![],'where':{'id':_0x185d73[_0x46d5('0x3e')]['id']}},_0x87713d={};_0x87713d[_0x46d5('0x29')]=_[_0x46d5('0x3f')](db[_0x46d5('0x25')][_0x46d5('0x26')]);_0x87713d[_0x46d5('0x2b')]=_['keys'](_0x185d73[_0x46d5('0x2b')]);_0x87713d[_0x46d5('0x34')]=_['intersection'](_0x87713d[_0x46d5('0x29')],_0x87713d[_0x46d5('0x2b')]);_0x4e70df[_0x46d5('0x2d')]=_['intersection'](_0x87713d['model'],qs[_0x46d5('0x2e')](_0x185d73['query'][_0x46d5('0x2e')]));_0x4e70df[_0x46d5('0x2d')]=_0x4e70df[_0x46d5('0x2d')][_0x46d5('0x2f')]?_0x4e70df['attributes']:_0x87713d[_0x46d5('0x29')];if(_0x185d73[_0x46d5('0x2b')][_0x46d5('0x40')]){_0x4e70df[_0x46d5('0x3a')]=[{'all':!![]}];}_0x4e70df=_[_0x46d5('0x36')]({},_0x4e70df,_0x185d73[_0x46d5('0x41')]);return db[_0x46d5('0x25')][_0x46d5('0x42')](_0x4e70df)[_0x46d5('0x39')](handleEntityNotFound(_0x4dc285,null))[_0x46d5('0x39')](respondWithResult(_0x4dc285,null))[_0x46d5('0x3d')](handleError(_0x4dc285,null));};exports[_0x46d5('0x43')]=function(_0x48d9f8,_0x1b6ba9){return db[_0x46d5('0x25')][_0x46d5('0x43')](_0x48d9f8['body'],{})[_0x46d5('0x39')](respondWithResult(_0x1b6ba9,0xc9))[_0x46d5('0x3d')](handleError(_0x1b6ba9,null));};exports[_0x46d5('0x1f')]=function(_0x4e06b3,_0x2a92e2){if(_0x4e06b3[_0x46d5('0x44')]['id']){delete _0x4e06b3[_0x46d5('0x44')]['id'];}return db[_0x46d5('0x25')][_0x46d5('0x42')]({'where':{'id':_0x4e06b3['params']['id']}})['then'](handleEntityNotFound(_0x2a92e2,null))['then'](saveUpdates(_0x4e06b3['body'],null))[_0x46d5('0x39')](respondWithResult(_0x2a92e2,null))['catch'](handleError(_0x2a92e2,null));};exports[_0x46d5('0x20')]=function(_0x3ea800,_0x3700a7){return db[_0x46d5('0x25')][_0x46d5('0x42')]({'where':{'id':_0x3ea800[_0x46d5('0x3e')]['id']}})[_0x46d5('0x39')](handleEntityNotFound(_0x3700a7,null))[_0x46d5('0x39')](removeEntity(_0x3700a7,null))[_0x46d5('0x3d')](handleError(_0x3700a7,null));};exports[_0x46d5('0x45')]=function(_0x2419f3,_0x1a0251){return db[_0x46d5('0x25')][_0x46d5('0x45')]()[_0x46d5('0x39')](respondWithResult(_0x1a0251,null))['catch'](handleError(_0x1a0251,null));}; \ No newline at end of file +var _0xa43d=['set','Content-Range','reject','save','then','destroy','error','stack','map','ChatTransferReport','key','name','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','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','end','json','offset','undefined','limit','count','status'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xa43d,0x143));var _0xda43=function(_0x250c78,_0x25b838){_0x250c78=_0x250c78-0x0;var _0x44f07a=_0xa43d[_0x250c78];return _0x44f07a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda43('0x0'));var zipdir=require(_0xda43('0x1'));var jsonpatch=require(_0xda43('0x2'));var rp=require('request-promise');var moment=require(_0xda43('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xda43('0x4'));var util=require('util');var path=require(_0xda43('0x5'));var sox=require(_0xda43('0x6'));var csv=require(_0xda43('0x7'));var ejs=require(_0xda43('0x8'));var fs=require('fs');var fs_extra=require(_0xda43('0x9'));var _=require('lodash');var squel=require(_0xda43('0xa'));var crypto=require(_0xda43('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xda43('0xc'));var toCsv=require(_0xda43('0x7'));var querystring=require(_0xda43('0xd'));var Papa=require(_0xda43('0xe'));var Redis=require(_0xda43('0xf'));var authService=require(_0xda43('0x10'));var qs=require(_0xda43('0x11'));var as=require(_0xda43('0x12'));var hardwareService=require(_0xda43('0x13'));var logger=require(_0xda43('0x14'))(_0xda43('0x15'));var utils=require(_0xda43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda43('0x17'))['db'];function respondWithStatusCode(_0x1dafd9,_0xfbd923){_0xfbd923=_0xfbd923||0xcc;return function(_0x4d14d3){if(_0x4d14d3){return _0x1dafd9[_0xda43('0x18')](_0xfbd923);}return _0x1dafd9['status'](_0xfbd923)[_0xda43('0x19')]();};}function respondWithResult(_0x4cdbe8,_0x59a89c){_0x59a89c=_0x59a89c||0xc8;return function(_0x2970fe){if(_0x2970fe){return _0x4cdbe8['status'](_0x59a89c)[_0xda43('0x1a')](_0x2970fe);}};}function respondWithFilteredResult(_0x4a6448,_0x325dd3){return function(_0x50fb23){if(_0x50fb23){var _0x28dbd4=typeof _0x325dd3[_0xda43('0x1b')]===_0xda43('0x1c')&&typeof _0x325dd3[_0xda43('0x1d')]===_0xda43('0x1c');var _0xf32fd0=_0x50fb23[_0xda43('0x1e')];var _0x78ff2=_0x28dbd4?0x0:_0x325dd3[_0xda43('0x1b')];var _0x3c8676=_0x28dbd4?_0x50fb23['count']:_0x325dd3[_0xda43('0x1b')]+_0x325dd3[_0xda43('0x1d')];var _0x4c06c8;if(_0x3c8676>=_0xf32fd0){_0x3c8676=_0xf32fd0;_0x4c06c8=0xc8;}else{_0x4c06c8=0xce;}_0x4a6448[_0xda43('0x1f')](_0x4c06c8);return _0x4a6448[_0xda43('0x20')](_0xda43('0x21'),_0x78ff2+'-'+_0x3c8676+'/'+_0xf32fd0)[_0xda43('0x1a')](_0x50fb23);}return null;};}function patchUpdates(_0x5bb17c){return function(_0x3039a9){try{jsonpatch['apply'](_0x3039a9,_0x5bb17c,!![]);}catch(_0x497b10){return BPromise[_0xda43('0x22')](_0x497b10);}return _0x3039a9[_0xda43('0x23')]();};}function saveUpdates(_0x286466,_0x4b1a0d){return function(_0x2ab956){if(_0x2ab956){return _0x2ab956['update'](_0x286466)[_0xda43('0x24')](function(_0x5c8dce){return _0x5c8dce;});}return null;};}function removeEntity(_0x5b70ad,_0x27efd2){return function(_0x4af0cb){if(_0x4af0cb){return _0x4af0cb[_0xda43('0x25')]()[_0xda43('0x24')](function(){_0x5b70ad[_0xda43('0x1f')](0xcc)[_0xda43('0x19')]();});}};}function handleEntityNotFound(_0x727cd3,_0x3a47a4){return function(_0x44b187){if(!_0x44b187){_0x727cd3[_0xda43('0x18')](0x194);}return _0x44b187;};}function handleError(_0x56bcc8,_0x57406a){_0x57406a=_0x57406a||0x1f4;return function(_0x3c0410){logger[_0xda43('0x26')](_0x3c0410[_0xda43('0x27')]);if(_0x3c0410['name']){delete _0x3c0410['name'];}_0x56bcc8[_0xda43('0x1f')](_0x57406a)['send'](_0x3c0410);};}exports['index']=function(_0x267a29,_0x3b65ff){var _0x2e477a={},_0x486da1={},_0x2cac33={'count':0x0,'rows':[]};var _0x3cdf51=_[_0xda43('0x28')](db[_0xda43('0x29')]['rawAttributes'],function(_0x44a396){return{'name':_0x44a396['fieldName'],'type':_0x44a396['type'][_0xda43('0x2a')]};});_0x486da1['model']=_[_0xda43('0x28')](_0x3cdf51,_0xda43('0x2b'));_0x486da1[_0xda43('0x2c')]=_['keys'](_0x267a29['query']);_0x486da1[_0xda43('0x2d')]=_['intersection'](_0x486da1['model'],_0x486da1['query']);_0x2e477a['attributes']=_[_0xda43('0x2e')](_0x486da1[_0xda43('0x2f')],qs['fields'](_0x267a29[_0xda43('0x2c')][_0xda43('0x30')]));_0x2e477a[_0xda43('0x31')]=_0x2e477a[_0xda43('0x31')][_0xda43('0x32')]?_0x2e477a[_0xda43('0x31')]:_0x486da1[_0xda43('0x2f')];if(!_0x267a29[_0xda43('0x2c')]['hasOwnProperty'](_0xda43('0x33'))){_0x2e477a[_0xda43('0x1d')]=qs[_0xda43('0x1d')](_0x267a29[_0xda43('0x2c')]['limit']);_0x2e477a[_0xda43('0x1b')]=qs[_0xda43('0x1b')](_0x267a29[_0xda43('0x2c')][_0xda43('0x1b')]);}_0x2e477a[_0xda43('0x34')]=qs[_0xda43('0x35')](_0x267a29['query'][_0xda43('0x35')]);_0x2e477a[_0xda43('0x36')]=qs[_0xda43('0x2d')](_[_0xda43('0x37')](_0x267a29[_0xda43('0x2c')],_0x486da1['filters']),_0x3cdf51);if(_0x267a29['query'][_0xda43('0x38')]){_0x2e477a[_0xda43('0x36')]=_['merge'](_0x2e477a[_0xda43('0x36')],{'$or':_[_0xda43('0x28')](_0x3cdf51,function(_0x271d3d){if(_0x271d3d['type']!==_0xda43('0x39')){var _0x30c68e={};_0x30c68e[_0x271d3d[_0xda43('0x2b')]]={'$like':'%'+_0x267a29['query'][_0xda43('0x38')]+'%'};return _0x30c68e;}})});}_0x2e477a=_[_0xda43('0x3a')]({},_0x2e477a,_0x267a29[_0xda43('0x3b')]);var _0x4f760d={'where':_0x2e477a[_0xda43('0x36')]};return db['ChatTransferReport'][_0xda43('0x1e')](_0x4f760d)[_0xda43('0x24')](function(_0x5591f1){_0x2cac33['count']=_0x5591f1;if(_0x267a29[_0xda43('0x2c')]['includeAll']){_0x2e477a[_0xda43('0x3c')]=[{'all':!![]}];}return db[_0xda43('0x29')][_0xda43('0x3d')](_0x2e477a);})[_0xda43('0x24')](function(_0x5a6929){_0x2cac33['rows']=_0x5a6929;return _0x2cac33;})[_0xda43('0x24')](respondWithFilteredResult(_0x3b65ff,_0x2e477a))[_0xda43('0x3e')](handleError(_0x3b65ff,null));};exports[_0xda43('0x3f')]=function(_0x1bd5bd,_0x9453bd){var _0x491ed4={'raw':!![],'where':{'id':_0x1bd5bd[_0xda43('0x40')]['id']}},_0x292965={};_0x292965[_0xda43('0x2f')]=_[_0xda43('0x41')](db[_0xda43('0x29')]['rawAttributes']);_0x292965[_0xda43('0x2c')]=_[_0xda43('0x41')](_0x1bd5bd[_0xda43('0x2c')]);_0x292965['filters']=_[_0xda43('0x2e')](_0x292965[_0xda43('0x2f')],_0x292965['query']);_0x491ed4[_0xda43('0x31')]=_[_0xda43('0x2e')](_0x292965[_0xda43('0x2f')],qs[_0xda43('0x30')](_0x1bd5bd[_0xda43('0x2c')][_0xda43('0x30')]));_0x491ed4[_0xda43('0x31')]=_0x491ed4[_0xda43('0x31')][_0xda43('0x32')]?_0x491ed4[_0xda43('0x31')]:_0x292965[_0xda43('0x2f')];if(_0x1bd5bd[_0xda43('0x2c')][_0xda43('0x42')]){_0x491ed4[_0xda43('0x3c')]=[{'all':!![]}];}_0x491ed4=_[_0xda43('0x3a')]({},_0x491ed4,_0x1bd5bd[_0xda43('0x3b')]);return db[_0xda43('0x29')]['find'](_0x491ed4)[_0xda43('0x24')](handleEntityNotFound(_0x9453bd,null))[_0xda43('0x24')](respondWithResult(_0x9453bd,null))[_0xda43('0x3e')](handleError(_0x9453bd,null));};exports['create']=function(_0xd1739b,_0x24d17a){return db[_0xda43('0x29')][_0xda43('0x43')](_0xd1739b[_0xda43('0x44')],{})[_0xda43('0x24')](respondWithResult(_0x24d17a,0xc9))[_0xda43('0x3e')](handleError(_0x24d17a,null));};exports['update']=function(_0x500563,_0x1f8940){if(_0x500563[_0xda43('0x44')]['id']){delete _0x500563[_0xda43('0x44')]['id'];}return db[_0xda43('0x29')]['find']({'where':{'id':_0x500563['params']['id']}})[_0xda43('0x24')](handleEntityNotFound(_0x1f8940,null))[_0xda43('0x24')](saveUpdates(_0x500563[_0xda43('0x44')],null))['then'](respondWithResult(_0x1f8940,null))['catch'](handleError(_0x1f8940,null));};exports[_0xda43('0x25')]=function(_0x29e4bf,_0x5c75a7){return db[_0xda43('0x29')][_0xda43('0x45')]({'where':{'id':_0x29e4bf[_0xda43('0x40')]['id']}})[_0xda43('0x24')](handleEntityNotFound(_0x5c75a7,null))['then'](removeEntity(_0x5c75a7,null))[_0xda43('0x3e')](handleError(_0x5c75a7,null));};exports[_0xda43('0x46')]=function(_0x46d1f5,_0x2cadb7){return db[_0xda43('0x29')][_0xda43('0x46')]()[_0xda43('0x24')](respondWithResult(_0x2cadb7,null))[_0xda43('0x3e')](handleError(_0x2cadb7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1115c9c..2c9c0c5 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 _0x70d3=['../../config/environment','./chatTransferReport.attributes','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x70d3,0x75));var _0x370d=function(_0x51bafd,_0x3e783e){_0x51bafd=_0x51bafd-0x0;var _0x12cba0=_0x70d3[_0x51bafd];return _0x12cba0;};'use strict';var _=require(_0x370d('0x0'));var util=require(_0x370d('0x1'));var logger=require(_0x370d('0x2'))(_0x370d('0x3'));var moment=require(_0x370d('0x4'));var BPromise=require(_0x370d('0x5'));var rp=require(_0x370d('0x6'));var fs=require('fs');var path=require(_0x370d('0x7'));var rimraf=require(_0x370d('0x8'));var config=require(_0x370d('0x9'));var attributes=require(_0x370d('0xa'));module['exports']=function(_0x1e78b2,_0x58340e){return _0x1e78b2['define'](_0x370d('0xb'),attributes,{'tableName':_0x370d('0xc'),'paranoid':![],'indexes':[{'name':_0x370d('0xd'),'fields':[_0x370d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8ab=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x157aa9,_0x11340f){var _0x519af8=function(_0x4f060f){while(--_0x4f060f){_0x157aa9['push'](_0x157aa9['shift']());}};_0x519af8(++_0x11340f);}(_0xb8ab,0x11e));var _0xbb8a=function(_0x467e27,_0x546b7d){_0x467e27=_0x467e27-0x0;var _0x27ec20=_0xb8ab[_0x467e27];return _0x27ec20;};'use strict';var _=require(_0xbb8a('0x0'));var util=require(_0xbb8a('0x1'));var logger=require(_0xbb8a('0x2'))(_0xbb8a('0x3'));var moment=require(_0xbb8a('0x4'));var BPromise=require(_0xbb8a('0x5'));var rp=require(_0xbb8a('0x6'));var fs=require('fs');var path=require(_0xbb8a('0x7'));var rimraf=require(_0xbb8a('0x8'));var config=require(_0xbb8a('0x9'));var attributes=require(_0xbb8a('0xa'));module[_0xbb8a('0xb')]=function(_0x936c7c,_0xdffee){return _0x936c7c[_0xbb8a('0xc')](_0xbb8a('0xd'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xbb8a('0xe'),'fields':[_0xbb8a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0e31747..96596a7 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 _0xbefd=['jayson/promise','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0xbefd,0x1a3));var _0xdbef=function(_0x2ba8b4,_0x46bfcc){_0x2ba8b4=_0x2ba8b4-0x0;var _0x41d675=_0xbefd[_0x2ba8b4];return _0x41d675;};'use strict';var _=require(_0xdbef('0x0'));var util=require('util');var moment=require(_0xdbef('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbef('0x2'));var db=require(_0xdbef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdbef('0x4'))('rpc');var config=require(_0xdbef('0x5'));var jayson=require(_0xdbef('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc1d1c0,_0x4a22b2,_0x459a3c){return new BPromise(function(_0x50fd4f,_0x2a57a1){return client[_0xdbef('0x7')](_0xc1d1c0,_0x459a3c)['then'](function(_0x44d9aa){logger[_0xdbef('0x8')](_0xdbef('0x9'),_0x4a22b2,_0xdbef('0xa'));logger[_0xdbef('0xb')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4a22b2,_0xdbef('0xa'),JSON[_0xdbef('0xc')](_0x44d9aa));if(_0x44d9aa[_0xdbef('0xd')]){if(_0x44d9aa['error'][_0xdbef('0xe')]===0x1f4){logger[_0xdbef('0xd')](_0xdbef('0x9'),_0x4a22b2,_0x44d9aa[_0xdbef('0xd')][_0xdbef('0xf')]);return _0x2a57a1(_0x44d9aa[_0xdbef('0xd')][_0xdbef('0xf')]);}logger[_0xdbef('0xd')](_0xdbef('0x9'),_0x4a22b2,_0x44d9aa[_0xdbef('0xd')]['message']);return _0x50fd4f(_0x44d9aa[_0xdbef('0xd')][_0xdbef('0xf')]);}else{logger['info'](_0xdbef('0x9'),_0x4a22b2,'request\x20sent');_0x50fd4f(_0x44d9aa[_0xdbef('0x10')][_0xdbef('0xf')]);}})['catch'](function(_0x5af497){logger['error'](_0xdbef('0x9'),_0x4a22b2,_0x5af497);_0x2a57a1(_0x5af497);});});} \ No newline at end of file +var _0x82da=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis'];(function(_0x3eb2c7,_0x19fba5){var _0x22083f=function(_0x4dda83){while(--_0x4dda83){_0x3eb2c7['push'](_0x3eb2c7['shift']());}};_0x22083f(++_0x19fba5);}(_0x82da,0xad));var _0xa82d=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x82da[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xa82d('0x0'));var util=require('util');var moment=require(_0xa82d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa82d('0x2'));var db=require(_0xa82d('0x3'))['db'];var utils=require(_0xa82d('0x4'));var logger=require(_0xa82d('0x5'))(_0xa82d('0x6'));var config=require(_0xa82d('0x7'));var jayson=require(_0xa82d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5268ba,_0x48a1e2,_0x7a0325){return new BPromise(function(_0x2f5416,_0x28d539){return client[_0xa82d('0x9')](_0x5268ba,_0x7a0325)[_0xa82d('0xa')](function(_0x33a894){logger[_0xa82d('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x48a1e2,_0xa82d('0xc'));logger[_0xa82d('0xd')](_0xa82d('0xe'),_0x48a1e2,_0xa82d('0xc'),JSON[_0xa82d('0xf')](_0x33a894));if(_0x33a894[_0xa82d('0x10')]){if(_0x33a894[_0xa82d('0x10')][_0xa82d('0x11')]===0x1f4){logger[_0xa82d('0x10')](_0xa82d('0x12'),_0x48a1e2,_0x33a894[_0xa82d('0x10')][_0xa82d('0x13')]);return _0x28d539(_0x33a894[_0xa82d('0x10')][_0xa82d('0x13')]);}logger[_0xa82d('0x10')](_0xa82d('0x12'),_0x48a1e2,_0x33a894[_0xa82d('0x10')][_0xa82d('0x13')]);return _0x2f5416(_0x33a894[_0xa82d('0x10')][_0xa82d('0x13')]);}else{logger['info'](_0xa82d('0x12'),_0x48a1e2,'request\x20sent');_0x2f5416(_0x33a894[_0xa82d('0x14')]['message']);}})[_0xa82d('0x15')](function(_0x11a020){logger[_0xa82d('0x10')](_0xa82d('0x12'),_0x48a1e2,_0x11a020);_0x28d539(_0x11a020);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b34e627..4b6d790 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 _0xd227=['/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','isAuthenticated','describe','show','create','put'];(function(_0x17cd5c,_0x48bc4c){var _0x92496a=function(_0x31ec4e){while(--_0x31ec4e){_0x17cd5c['push'](_0x17cd5c['shift']());}};_0x92496a(++_0x48bc4c);}(_0xd227,0xf4));var _0x7d22=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0xd227[_0x2dfd0e];return _0x343af6;};'use strict';var multer=require('multer');var util=require(_0x7d22('0x0'));var path=require(_0x7d22('0x1'));var timeout=require(_0x7d22('0x2'));var express=require('express');var router=express[_0x7d22('0x3')]();var fs_extra=require(_0x7d22('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7d22('0x5'));var config=require(_0x7d22('0x6'));var controller=require(_0x7d22('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d22('0x8')]);router[_0x7d22('0x9')](_0x7d22('0xa'),auth[_0x7d22('0xb')](),controller[_0x7d22('0xc')]);router['get']('/:id',auth[_0x7d22('0xb')](),controller[_0x7d22('0xd')]);router['post']('/',auth[_0x7d22('0xb')](),controller[_0x7d22('0xe')]);router[_0x7d22('0xf')](_0x7d22('0x10'),auth[_0x7d22('0xb')](),controller['update']);router[_0x7d22('0x11')](_0x7d22('0x10'),auth[_0x7d22('0xb')](),controller[_0x7d22('0x12')]);module[_0x7d22('0x13')]=router; \ No newline at end of file +var _0xb935=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x57622c,_0x3959ef){var _0x5b5a3a=function(_0x57ba45){while(--_0x57ba45){_0x57622c['push'](_0x57622c['shift']());}};_0x5b5a3a(++_0x3959ef);}(_0xb935,0x17f));var _0x5b93=function(_0x44d993,_0x55cec9){_0x44d993=_0x44d993-0x0;var _0x1d7ae4=_0xb935[_0x44d993];return _0x1d7ae4;};'use strict';var multer=require('multer');var util=require(_0x5b93('0x0'));var path=require(_0x5b93('0x1'));var timeout=require(_0x5b93('0x2'));var express=require(_0x5b93('0x3'));var router=express[_0x5b93('0x4')]();var fs_extra=require(_0x5b93('0x5'));var auth=require(_0x5b93('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5b93('0x7'));var controller=require(_0x5b93('0x8'));router[_0x5b93('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b93('0xa')]);router[_0x5b93('0x9')](_0x5b93('0xb'),auth[_0x5b93('0xc')](),controller[_0x5b93('0xd')]);router[_0x5b93('0x9')](_0x5b93('0xe'),auth[_0x5b93('0xc')](),controller[_0x5b93('0xf')]);router[_0x5b93('0x10')]('/',auth[_0x5b93('0xc')](),controller[_0x5b93('0x11')]);router['put']('/:id',auth[_0x5b93('0xc')](),controller[_0x5b93('0x12')]);router[_0x5b93('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5b93('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 93c762c..2e8e297 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 _0x90d3=['mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','text','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3e9895,_0x246574){var _0x8ec2c8=function(_0x2d8e1b){while(--_0x2d8e1b){_0x3e9895['push'](_0x3e9895['shift']());}};_0x8ec2c8(++_0x246574);}(_0x90d3,0x68));var _0x390d=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x90d3[_0x21353c];return _0xa99120;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x390d('0x0'));module[_0x390d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'unique':_0x390d('0x3')},'description':{'type':Sequelize[_0x390d('0x2')]},'mapKey':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x4')},'mapKeyOffline':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x4')},'key':{'type':Sequelize[_0x390d('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x390d('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x390d('0x2')]},'animation':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x390d('0x8')](_0x390d('0x9'),_0x390d('0xa')),'defaultValue':_0x390d('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0xb')},'start_chat_button':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0xc')},'offline_chat_button':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0xd')},'header_offline':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0xe')},'download_transcript':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x390d('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x390d('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x13')},'noteTitle':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x14')},'closingMessageButton':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x15')},'conditionAgreement':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x390d('0x17'),'thumb'),'defaultValue':_0x390d('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x390d('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x390d('0x18')]({'items':[{'type':_0x390d('0x19'),'variable':null,'config':{'placeholder':_0x390d('0x1a'),'type':_0x390d('0x1b'),'required':!![]},'props':{'title':_0x390d('0x1a'),'helpText':''}},{'type':_0x390d('0x19'),'props':{'title':_0x390d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x390d('0x4'),'type':_0x390d('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x390d('0x1c'))?JSON[_0x390d('0x1d')](this['getDataValue']('onlineForm')):{};},'set':function(_0x152d37){return this[_0x390d('0x1e')]('onlineForm',JSON[_0x390d('0x18')](_0x152d37));}},'offlineForm':{'type':Sequelize[_0x390d('0x11')],'defaultValue':function(){return JSON[_0x390d('0x18')]({'items':[{'type':'input','props':{'title':_0x390d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x390d('0x4'),'type':_0x390d('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x390d('0x1f')},'props':{'title':_0x390d('0x1f'),'helpText':_0x390d('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x390d('0x21')](_0x390d('0x22'))?JSON[_0x390d('0x1d')](this['getDataValue'](_0x390d('0x22'))):{};},'set':function(_0x1d32c7){return this['setDataValue']('offlineForm',JSON[_0x390d('0x18')](_0x1d32c7));}},'token':{'type':Sequelize[_0x390d('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x390d('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x23')},'waitingMessage':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x25')},'skipUnmanaged':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x390d('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x390d('0x2')]},'notificationTemplate':{'type':Sequelize[_0x390d('0x11')],'defaultValue':function(){return _0x390d('0x26');}},'notificationSound':{'type':Sequelize[_0x390d('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x390d('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x390d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x27')},'verticalAlignment':{'type':Sequelize[_0x390d('0xf')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x28')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x390d('0x29')},'defaultTitle':{'type':Sequelize[_0x390d('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x390d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x390d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x390d('0x2')],'defaultValue':_0x390d('0x2b')},'systemAvatar':{'type':Sequelize[_0x390d('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x390d('0xf')],'comment':_0x390d('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x390d('0x2d'),'set':function(_0xdea78a){if(!_0xdea78a)this[_0x390d('0x1e')](_0x390d('0x2e'),null);this[_0x390d('0x1e')](_0x390d('0x2f'),_0xdea78a);}},'vidaooEscalation':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x390d('0x2')]},'vidaooTopic':{'type':Sequelize[_0x390d('0x2')],'allowNull':![],'defaultValue':_0x390d('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x390d('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x390d('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x390d('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x390d('0x11')]}}; \ No newline at end of file +var _0x2c14=['textarea','Comments','offlineForm','parse','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','onlineForm','getDataValue','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c14,0x127));var _0x42c1=function(_0x4daeac,_0x50e0d2){_0x4daeac=_0x4daeac-0x0;var _0x1c837d=_0x2c14[_0x4daeac];return _0x1c837d;};'use strict';var Sequelize=require(_0x42c1('0x0'));var rs=require(_0x42c1('0x1'));module[_0x42c1('0x2')]={'name':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![],'unique':_0x42c1('0x4')},'description':{'type':Sequelize[_0x42c1('0x3')]},'mapKey':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x5')},'mapKeyOffline':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x6')},'customerAlias':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![],'defaultValue':_0x42c1('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![],'defaultValue':_0x42c1('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![],'defaultValue':_0x42c1('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x42c1('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x42c1('0x3')]},'animation':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x42c1('0xb')](_0x42c1('0xc'),_0x42c1('0xd')),'defaultValue':_0x42c1('0xc')},'header_online':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x42c1('0xf')},'header_offline':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x10')},'download_transcript':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x42c1('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x42c1('0x12')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x42c1('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x15')},'noteTitle':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x16')},'placeholderMessage':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x17')},'closingMessageButton':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0xf')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x42c1('0x18')},'conditionAgreement':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x19')},'ratingType':{'type':Sequelize[_0x42c1('0xb')](_0x42c1('0x1a'),_0x42c1('0x1b')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x42c1('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x42c1('0x12')],'defaultValue':function(){return JSON[_0x42c1('0x1c')]({'items':[{'type':_0x42c1('0x1d'),'variable':null,'config':{'placeholder':_0x42c1('0x1e'),'type':_0x42c1('0x1f'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x42c1('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x42c1('0x5'),'type':_0x42c1('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x42c1('0x20'))?JSON['parse'](this[_0x42c1('0x21')]('onlineForm')):{};},'set':function(_0x3966dd){return this[_0x42c1('0x22')]('onlineForm',JSON[_0x42c1('0x1c')](_0x3966dd));}},'offlineForm':{'type':Sequelize[_0x42c1('0x12')],'defaultValue':function(){return JSON[_0x42c1('0x1c')]({'items':[{'type':_0x42c1('0x1d'),'props':{'title':_0x42c1('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x42c1('0x5'),'type':_0x42c1('0x5')},'variable':null},{'type':_0x42c1('0x23'),'config':{'placeholder':_0x42c1('0x24')},'props':{'title':_0x42c1('0x24'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x42c1('0x25'))?JSON[_0x42c1('0x26')](this['getDataValue']('offlineForm')):{};},'set':function(_0x5d50e7){return this[_0x42c1('0x22')](_0x42c1('0x25'),JSON[_0x42c1('0x1c')](_0x5d50e7));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x42c1('0x27')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x42c1('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x42c1('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x42c1('0x3')]},'notificationTemplate':{'type':Sequelize[_0x42c1('0x12')],'defaultValue':function(){return _0x42c1('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x42c1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x2e')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x42c1('0x2f')},'defaultTitle':{'type':Sequelize[_0x42c1('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x42c1('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![],'defaultValue':_0x42c1('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x42c1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x42c1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x42c1('0x3')],'defaultValue':_0x42c1('0x31')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x42c1('0x9')],'comment':_0x42c1('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![],'comment':_0x42c1('0x33'),'set':function(_0x38b79f){if(!_0x38b79f)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x42c1('0x22')](_0x42c1('0x34'),_0x38b79f);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x42c1('0x3')]},'vidaooTopic':{'type':Sequelize[_0x42c1('0x3')],'allowNull':![],'defaultValue':_0x42c1('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x42c1('0x36');}},'vidaooMetadata':{'type':Sequelize[_0x42c1('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x42c1('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x42c1('0x12')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6c6c7cc..e3fa1b7 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 _0xa9e0=['getAgents','mustache','util','path','lodash','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','defaults','register','client','http','request','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','catch','params','mandatoryDispositionPause','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','createdAt','updatedAt','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','ifTime','account','list','applications','orderBy','priority','asc','threadId','ChatInteraction','externalUrl','interaction','contact','lastName','messageId','created','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','ValidationError','no\x20available\x20attributes','difference','CompanyId','send','Sequelize','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','remove','addInteraction','omit','Contact','fullname','internal','Tags','color','tag','getSnippet','virtual','increment','chatLicenseExceeded','URL','address','origin','remote','headers','connection','remoteAddress','replace','alignment','labelText','textColor','backgroundColor','IntervalId','Transaction','ISOLATION_LEVELS','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','removeAgents','isArray','userChatWebsite:remove'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Mustache=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a9e('0x3'));var querystring=require('querystring');var htmlToText=require(_0x0a9e('0x4'));var Redis=require(_0x0a9e('0x5'));var jayson=require(_0x0a9e('0x6'));var url=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var logger=require('../../config/logger')(_0x0a9e('0x9'));var config=require(_0x0a9e('0xa'));var APIBadRequestError=require(_0x0a9e('0xb'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x0a9e('0xc')];var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APIHandleError=require(_0x0a9e('0xb'))[_0x0a9e('0xd')];var db=require(_0x0a9e('0xe'))['db'];config[_0x0a9e('0xf')]=_[_0x0a9e('0x10')](config[_0x0a9e('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x0a9e('0x11')](socket);var client=jayson[_0x0a9e('0x12')][_0x0a9e('0x13')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x12')][_0x0a9e('0x13')]({'port':0x232a});var client9003=jayson[_0x0a9e('0x12')]['http']({'port':0x232b});var client9001=jayson[_0x0a9e('0x12')][_0x0a9e('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){return new Promise(function(_0x52a03d,_0x22dccb){var _0x5d0880=_0x4d5611||client;return _0x5d0880[_0x0a9e('0x14')](_0x2b4227,_0x44dcfd)['then'](function(_0x16033c){logger[_0x0a9e('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x281129,_0x0a9e('0x16'));logger['debug'](_0x0a9e('0x17'),_0x281129,_0x0a9e('0x16'),JSON[_0x0a9e('0x18')](_0x16033c));if(_0x16033c[_0x0a9e('0x19')]){if(_0x16033c[_0x0a9e('0x19')][_0x0a9e('0x1a')]===0x1f4){logger[_0x0a9e('0x19')](_0x0a9e('0x1b'),_0x281129,_0x16033c[_0x0a9e('0x19')][_0x0a9e('0x1c')]);return _0x22dccb(_0x16033c[_0x0a9e('0x19')][_0x0a9e('0x1c')]);}logger['error'](_0x0a9e('0x1b'),_0x281129,_0x16033c[_0x0a9e('0x19')]['message']);return _0x52a03d(_0x16033c[_0x0a9e('0x19')]['message']);}else{logger['info'](_0x0a9e('0x1b'),_0x281129,_0x0a9e('0x16'));_0x52a03d(_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x1c')]);}})['catch'](function(_0xfb6e48){logger[_0x0a9e('0x19')](_0x0a9e('0x1b'),_0x281129,_0xfb6e48);_0x22dccb(_0xfb6e48);});});}function respondWithStatusCode(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0xcc;return function(_0x42ac8f){if(_0x42ac8f){return _0x4d00e6[_0x0a9e('0x1e')](_0x370d86);}return _0x4d00e6['status'](_0x370d86)['end']();};}function respondWithResult(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xc8;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x1f')](_0x3a8e58)['json'](_0x40c424);}};}function respondWithFilteredResult(_0x384319,_0x479bc4){return function(_0x45a1e7){if(_0x45a1e7){var _0x5bfb33=typeof _0x479bc4[_0x0a9e('0x20')]===_0x0a9e('0x21')&&typeof _0x479bc4[_0x0a9e('0x22')]===_0x0a9e('0x21');var _0x140511=_0x45a1e7[_0x0a9e('0x23')];var _0x11c3b6=_0x5bfb33?0x0:_0x479bc4[_0x0a9e('0x20')];var _0x5a101a=_0x5bfb33?_0x45a1e7[_0x0a9e('0x23')]:_0x479bc4[_0x0a9e('0x20')]+_0x479bc4[_0x0a9e('0x22')];var _0x2ec755;if(_0x5a101a>=_0x140511){_0x5a101a=_0x140511;_0x2ec755=0xc8;}else{_0x2ec755=0xce;}_0x384319['status'](_0x2ec755);return _0x384319[_0x0a9e('0x24')](_0x0a9e('0x25'),_0x11c3b6+'-'+_0x5a101a+'/'+_0x140511)[_0x0a9e('0x26')](_0x45a1e7);}return null;};}function saveUpdates(_0x824a4f){return function(_0x58b06f){if(_0x58b06f){return _0x58b06f[_0x0a9e('0x27')](_0x824a4f)[_0x0a9e('0x28')](function(_0x2e8759){return _0x2e8759;});}return null;};}function removeEntity(_0x1dbde2){return function(_0x540530){if(_0x540530){return _0x540530[_0x0a9e('0x29')]()['then'](function(){var _0x2407f9=_0x540530[_0x0a9e('0x2a')]({'plain':!![]});var _0x1122db=_0x0a9e('0x2b');return db[_0x0a9e('0x2c')]['destroy']({'where':{'type':_0x1122db,'resourceId':_0x2407f9['id']}})[_0x0a9e('0x28')](function(){return _0x540530;});})[_0x0a9e('0x28')](function(){_0x1dbde2[_0x0a9e('0x1f')](0xcc)[_0x0a9e('0x2d')]();});}};}function handleEntityNotFound(_0x2b45ea){return function(_0x409319){if(!_0x409319){_0x2b45ea[_0x0a9e('0x1e')](0x194);}return _0x409319;};}function handleError(_0x39e565,_0x5583a4){_0x5583a4=_0x5583a4||0x1f4;return function(_0x44295a){logger['error'](_0x44295a[_0x0a9e('0x2e')]);if(_0x44295a[_0x0a9e('0x2f')]){delete _0x44295a[_0x0a9e('0x2f')];}_0x39e565[_0x0a9e('0x1f')](_0x5583a4)['send'](_0x44295a);};}function createInteractionObject(_0x191e91,_0xd1836d,_0x1fa90d,_0x15de0e){var _0x4853b1=require('user-agent-parser');var _0x1e8694=new _0x4853b1();var _0x5640eb=_0x1e8694[_0x0a9e('0x30')](_0x1fa90d[_0x0a9e('0x31')])[_0x0a9e('0x32')]();var _0x1ef87a=_0xd1836d['customerIp'];if(_0x1fa90d[_0x0a9e('0x33')]){_0x1ef87a=_0x1fa90d[_0x0a9e('0x33')];}else if(_0x1fa90d[_0x0a9e('0x34')]){_0x1ef87a=_['first'](_0x1fa90d[_0x0a9e('0x34')][_0x0a9e('0x35')](','));}return{'ContactId':_0x15de0e['id'],'ChatWebsiteId':_0x191e91,'from':(_0x15de0e[_0x0a9e('0x36')]||'')+'\x20'+(_0x15de0e['lastName']||''),'customerIp':_0x1ef87a,'customerPort':_0x1fa90d['x-real-port']?_0x1fa90d[_0x0a9e('0x37')]:null,'referer':_0xd1836d[_0x0a9e('0x38')],'browserName':_0x5640eb['browser'][_0x0a9e('0x2f')]&&_0x5640eb[_0x0a9e('0x39')][_0x0a9e('0x3a')]?util[_0x0a9e('0x3b')]('%s\x20%s',_0x5640eb['browser'][_0x0a9e('0x2f')],_0x5640eb[_0x0a9e('0x39')]['version']):_0x0a9e('0x3c'),'browserVersion':_0x5640eb[_0x0a9e('0x39')][_0x0a9e('0x3a')]||'unknown','osName':util[_0x0a9e('0x3b')](_0x0a9e('0x3d'),_0x5640eb['os'][_0x0a9e('0x2f')],_0x5640eb['os'][_0x0a9e('0x3a')]),'osVersion':_0x5640eb['os'][_0x0a9e('0x3a')],'deviceModel':_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x3f')]&&_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x40')]?util[_0x0a9e('0x3b')](_0x0a9e('0x41'),_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x40')],_0x5640eb['device']['type']):null,'deviceVendor':_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x40')],'deviceType':_0x5640eb[_0x0a9e('0x3e')][_0x0a9e('0x42')],'formData':JSON[_0x0a9e('0x18')](_0xd1836d)};}exports[_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){var _0x432fcc={'include':[{'model':db[_0x0a9e('0x44')],'as':'mandatoryDispositionPause'}]},_0x25c6e6={},_0x2c2cb0={'count':0x0,'rows':[]};var _0x117c99=_[_0x0a9e('0x45')](db[_0x0a9e('0x46')][_0x0a9e('0x47')],function(_0x2e8caf){return{'name':_0x2e8caf[_0x0a9e('0x48')],'type':_0x2e8caf[_0x0a9e('0x42')][_0x0a9e('0x49')]};});_0x25c6e6['model']=_[_0x0a9e('0x45')](_0x117c99,'name');_0x25c6e6[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x10b040[_0x0a9e('0x4a')]);_0x25c6e6['filters']=_[_0x0a9e('0x4c')](_0x25c6e6[_0x0a9e('0x3f')],_0x25c6e6[_0x0a9e('0x4a')]);_0x432fcc[_0x0a9e('0x4d')]=_[_0x0a9e('0x4c')](_0x25c6e6[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x10b040['query'][_0x0a9e('0x4e')]));_0x432fcc[_0x0a9e('0x4d')]=_0x432fcc[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x432fcc[_0x0a9e('0x4d')]:_0x25c6e6[_0x0a9e('0x3f')];if(!_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x432fcc['limit']=qs[_0x0a9e('0x22')](_0x10b040[_0x0a9e('0x4a')]['limit']);_0x432fcc['offset']=qs['offset'](_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x432fcc[_0x0a9e('0x52')]=qs[_0x0a9e('0x53')](_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x432fcc[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_['pick'](_0x10b040['query'],_0x25c6e6['filters']),_0x117c99);if(_0x10b040[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x432fcc[_0x0a9e('0x54')]=_['merge'](_0x432fcc[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x117c99,function(_0x53d113){if(_0x53d113['type']!==_0x0a9e('0x57')){var _0x59c6ff={};_0x59c6ff[_0x53d113[_0x0a9e('0x2f')]]={'$like':'%'+_0x10b040['query'][_0x0a9e('0x56')]+'%'};return _0x59c6ff;}})});}_0x432fcc=_[_0x0a9e('0x58')]({},_0x432fcc,_0x10b040[_0x0a9e('0x59')]);var _0x53613a={'where':_0x432fcc[_0x0a9e('0x54')]};return db[_0x0a9e('0x46')]['count'](_0x53613a)['then'](function(_0x128aa6){_0x2c2cb0[_0x0a9e('0x23')]=_0x128aa6;if(_0x10b040['query'][_0x0a9e('0x5a')]){_0x432fcc['include']=[{'all':!![]}];}return db[_0x0a9e('0x46')]['findAll'](_0x432fcc);})[_0x0a9e('0x28')](function(_0x4a6deb){_0x2c2cb0['rows']=_0x4a6deb;return _0x2c2cb0;})['then'](respondWithFilteredResult(_0x445e25,_0x432fcc))[_0x0a9e('0x5b')](handleError(_0x445e25,null));};exports['show']=function(_0x2f7092,_0x65432){var _0x3cfd00={'raw':![],'where':{'id':_0x2f7092[_0x0a9e('0x5c')]['id']},'include':[{'model':db[_0x0a9e('0x44')],'as':_0x0a9e('0x5d')}]},_0x19b4df={};_0x19b4df[_0x0a9e('0x3f')]=_['keys'](db[_0x0a9e('0x46')][_0x0a9e('0x47')]);_0x19b4df[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x2f7092[_0x0a9e('0x4a')]);_0x19b4df[_0x0a9e('0x55')]=_['intersection'](_0x19b4df[_0x0a9e('0x3f')],_0x19b4df[_0x0a9e('0x4a')]);_0x3cfd00['attributes']=_[_0x0a9e('0x4c')](_0x19b4df['model'],qs[_0x0a9e('0x4e')](_0x2f7092['query']['fields']));_0x3cfd00['attributes']=_0x3cfd00[_0x0a9e('0x4d')]['length']?_0x3cfd00[_0x0a9e('0x4d')]:_0x19b4df[_0x0a9e('0x3f')];if(_0x2f7092[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x3cfd00[_0x0a9e('0x5e')]=[{'all':!![]}];}_0x3cfd00=_[_0x0a9e('0x58')]({},_0x3cfd00,_0x2f7092['options']);return db[_0x0a9e('0x46')]['find'](_0x3cfd00)[_0x0a9e('0x28')](handleEntityNotFound(_0x65432,null))[_0x0a9e('0x28')](respondWithResult(_0x65432,null))[_0x0a9e('0x5b')](handleError(_0x65432,null));};exports['create']=function(_0x453360,_0x156f1c){return db[_0x0a9e('0x46')][_0x0a9e('0x5f')](_0x453360['body'],{})[_0x0a9e('0x28')](function(_0xe05a5a){var _0x54327c=_0x453360[_0x0a9e('0x60')][_0x0a9e('0x2a')]({'plain':!![]});if(!_0x54327c)throw new Error(_0x0a9e('0x61'));if(_0x54327c[_0x0a9e('0x62')]===_0x0a9e('0x60')){var _0x4d4a35=_0xe05a5a[_0x0a9e('0x2a')]({'plain':!![]});var _0x2937e0=_0x0a9e('0x2b');return db['UserProfileSection'][_0x0a9e('0x63')]({'where':{'name':_0x2937e0,'userProfileId':_0x54327c['userProfileId']},'raw':!![]})['then'](function(_0x242745){if(_0x242745&&_0x242745[_0x0a9e('0x64')]===0x0){return db[_0x0a9e('0x2c')][_0x0a9e('0x5f')]({'name':_0x4d4a35[_0x0a9e('0x2f')],'resourceId':_0x4d4a35['id'],'type':_0x242745[_0x0a9e('0x2f')],'sectionId':_0x242745['id']},{})[_0x0a9e('0x28')](function(){return _0xe05a5a;});}else{return _0xe05a5a;}})[_0x0a9e('0x5b')](function(_0x2d7205){logger[_0x0a9e('0x19')](_0x0a9e('0x65'),_0x2d7205);throw _0x2d7205;});}return _0xe05a5a;})[_0x0a9e('0x28')](respondWithResult(_0x156f1c,0xc9))[_0x0a9e('0x5b')](handleError(_0x156f1c,null));};exports[_0x0a9e('0x27')]=function(_0x320898,_0x412a72){if(_0x320898[_0x0a9e('0x66')]['id']){delete _0x320898[_0x0a9e('0x66')]['id'];}return db['ChatWebsite'][_0x0a9e('0x63')]({'where':{'id':_0x320898[_0x0a9e('0x5c')]['id']},'include':[{'model':db[_0x0a9e('0x44')],'as':'mandatoryDispositionPause'}]})[_0x0a9e('0x28')](handleEntityNotFound(_0x412a72,null))[_0x0a9e('0x28')](saveUpdates(_0x320898['body'],null))[_0x0a9e('0x28')](respondWithResult(_0x412a72,null))[_0x0a9e('0x5b')](handleError(_0x412a72,null));};exports[_0x0a9e('0x29')]=function(_0x427946,_0x13b5c0){return db['ChatWebsite']['find']({'where':{'id':_0x427946['params']['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x28')](removeEntity(_0x13b5c0,null))[_0x0a9e('0x5b')](handleError(_0x13b5c0,null));};exports[_0x0a9e('0x67')]=function(_0x6abd03,_0x380ab3){return db[_0x0a9e('0x46')][_0x0a9e('0x67')]()['then'](respondWithResult(_0x380ab3,null))[_0x0a9e('0x5b')](handleError(_0x380ab3,null));};exports[_0x0a9e('0x68')]=function(_0x12ccdb,_0x4a4fc7){if(_0x12ccdb[_0x0a9e('0x66')]['id']){delete _0x12ccdb['body']['id'];}return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x12ccdb['params']['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x4a4fc7,null))[_0x0a9e('0x28')](function(_0x2cc7a7){if(_0x2cc7a7){_0x12ccdb[_0x0a9e('0x66')]['ChatWebsiteId']=_0x2cc7a7['id'];return db[_0x0a9e('0x69')][_0x0a9e('0x5f')](_0x12ccdb[_0x0a9e('0x66')]);}})[_0x0a9e('0x28')](respondWithResult(_0x4a4fc7,null))['catch'](handleError(_0x4a4fc7,null));};exports[_0x0a9e('0x6a')]=function(_0x3d91db,_0x2d5506){var _0x361b21={'raw':![],'where':{}};var _0x4abc8f={};var _0x290d43={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x3d91db[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x28')](function(_0x40fc56){if(_0x40fc56){_0x4abc8f[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0x69')][_0x0a9e('0x47')]);_0x4abc8f[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x3d91db[_0x0a9e('0x4a')]);_0x4abc8f['filters']=_[_0x0a9e('0x4c')](_0x4abc8f[_0x0a9e('0x3f')],_0x4abc8f[_0x0a9e('0x4a')]);_0x361b21['attributes']=_[_0x0a9e('0x4c')](_0x4abc8f[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x3d91db[_0x0a9e('0x4a')]['fields']));_0x361b21['attributes']=_0x361b21[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x361b21['attributes']:_0x4abc8f[_0x0a9e('0x3f')];if(!_0x3d91db['query'][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x361b21['limit']=qs[_0x0a9e('0x22')](_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x22')]);_0x361b21[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x361b21['order']=qs[_0x0a9e('0x53')](_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x361b21[_0x0a9e('0x54')]=qs['filters'](_[_0x0a9e('0x6c')](_0x3d91db[_0x0a9e('0x4a')],_0x4abc8f['filters']));_0x361b21[_0x0a9e('0x54')]['ChatWebsiteId']=_0x40fc56['id'];if(_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x361b21[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x361b21['where'],{'$or':_['map'](_0x361b21[_0x0a9e('0x4d')],function(_0x2b9c01){var _0x94dcf5={};_0x94dcf5[_0x2b9c01]={'$like':'%'+_0x3d91db['query'][_0x0a9e('0x56')]+'%'};return _0x94dcf5;})});}_0x361b21=_[_0x0a9e('0x58')]({},_0x361b21,_0x3d91db['options']);return db['Disposition'][_0x0a9e('0x23')]({'where':_0x361b21['where']})['then'](function(_0x4dc6b3){_0x290d43[_0x0a9e('0x23')]=_0x4dc6b3;if(_0x3d91db[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x361b21[_0x0a9e('0x5e')]=[{'all':!![]}];}return db[_0x0a9e('0x69')][_0x0a9e('0x6d')](_0x361b21);})['then'](function(_0x5fd5db){_0x290d43['rows']=_0x5fd5db;return _0x290d43;});}})[_0x0a9e('0x28')](respondWithFilteredResult(_0x2d5506,_0x361b21))[_0x0a9e('0x5b')](handleError(_0x2d5506,null));};exports[_0x0a9e('0x6e')]=function(_0x4566b0,_0x50f8d7){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x4566b0[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x50f8d7,null))[_0x0a9e('0x28')](function(_0x21e592){if(_0x21e592){return _0x21e592[_0x0a9e('0x6e')](_0x4566b0[_0x0a9e('0x4a')][_0x0a9e('0x6f')]);}})[_0x0a9e('0x28')](respondWithStatusCode(_0x50f8d7,null))[_0x0a9e('0x5b')](handleError(_0x50f8d7,null));};exports[_0x0a9e('0x70')]=function(_0x509efe,_0x2645d6){if(_0x509efe[_0x0a9e('0x66')]['id']){delete _0x509efe['body']['id'];}return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x509efe[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2645d6,null))[_0x0a9e('0x28')](function(_0x52ec10){if(_0x52ec10){_0x509efe[_0x0a9e('0x66')][_0x0a9e('0x71')]=_0x52ec10['id'];return db[_0x0a9e('0x72')][_0x0a9e('0x5f')](_0x509efe[_0x0a9e('0x66')]);}})[_0x0a9e('0x28')](respondWithResult(_0x2645d6,null))[_0x0a9e('0x5b')](handleError(_0x2645d6,null));};exports[_0x0a9e('0x73')]=function(_0x501050,_0x329d88){var _0x31d25a={'raw':![],'where':{}};var _0x17f692={};var _0x30ef6e={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x501050[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x329d88,null))[_0x0a9e('0x28')](function(_0x31af8c){if(_0x31af8c){_0x17f692[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0x72')]['rawAttributes']);_0x17f692[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x501050[_0x0a9e('0x4a')]);_0x17f692[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x17f692['model'],_0x17f692[_0x0a9e('0x4a')]);_0x31d25a[_0x0a9e('0x4d')]=_['intersection'](_0x17f692[_0x0a9e('0x3f')],qs['fields'](_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x31d25a[_0x0a9e('0x4d')]=_0x31d25a[_0x0a9e('0x4d')]['length']?_0x31d25a[_0x0a9e('0x4d')]:_0x17f692['model'];if(!_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x50')]('nolimit')){_0x31d25a[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x501050[_0x0a9e('0x4a')]['limit']);_0x31d25a['offset']=qs[_0x0a9e('0x20')](_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x31d25a[_0x0a9e('0x52')]=qs[_0x0a9e('0x53')](_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x31d25a[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_['pick'](_0x501050[_0x0a9e('0x4a')],_0x17f692['filters']));_0x31d25a[_0x0a9e('0x54')][_0x0a9e('0x71')]=_0x31af8c['id'];if(_0x501050[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x31d25a[_0x0a9e('0x54')]=_['merge'](_0x31d25a[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x31d25a[_0x0a9e('0x4d')],function(_0x2aa5f2){var _0x2263f1={};_0x2263f1[_0x2aa5f2]={'$like':'%'+_0x501050['query']['filter']+'%'};return _0x2263f1;})});}_0x31d25a=_[_0x0a9e('0x58')]({},_0x31d25a,_0x501050['options']);return db[_0x0a9e('0x72')][_0x0a9e('0x23')]({'where':_0x31d25a[_0x0a9e('0x54')]})[_0x0a9e('0x28')](function(_0x2ad54b){_0x30ef6e[_0x0a9e('0x23')]=_0x2ad54b;if(_0x501050['query']['includeAll']){_0x31d25a[_0x0a9e('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0a9e('0x6d')](_0x31d25a);})['then'](function(_0x427ccc){_0x30ef6e['rows']=_0x427ccc;return _0x30ef6e;});}})['then'](respondWithFilteredResult(_0x329d88,_0x31d25a))[_0x0a9e('0x5b')](handleError(_0x329d88,null));};exports[_0x0a9e('0x74')]=function(_0x5e9b0b,_0x170af6){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x5e9b0b[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x170af6,null))['then'](function(_0x5505f4){if(_0x5505f4){return _0x5505f4[_0x0a9e('0x74')](_0x5e9b0b[_0x0a9e('0x4a')][_0x0a9e('0x6f')]);}})[_0x0a9e('0x28')](respondWithStatusCode(_0x170af6,null))[_0x0a9e('0x5b')](handleError(_0x170af6,null));};exports['addLogo']=function(_0x45b03c,_0xadce3d){_0x45b03c['body'][_0x0a9e('0x75')]=_0x45b03c[_0x0a9e('0x76')][_0x0a9e('0x77')];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x45b03c[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0xadce3d,null))[_0x0a9e('0x28')](saveUpdates(_0x45b03c[_0x0a9e('0x66')],null))[_0x0a9e('0x28')](respondWithResult(_0xadce3d,null))['catch'](handleError(_0xadce3d,null));};exports[_0x0a9e('0x78')]=function(_0x301047,_0x2ada60){_0x301047[_0x0a9e('0x66')][_0x0a9e('0x79')]=_0x301047['file']['filename'];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x301047[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x2ada60,null))[_0x0a9e('0x28')](saveUpdates(_0x301047['body'],null))[_0x0a9e('0x28')](respondWithResult(_0x2ada60,null))[_0x0a9e('0x5b')](handleError(_0x2ada60,null));};exports[_0x0a9e('0x7a')]=function(_0x52b661,_0x318fc3){_0x52b661['body'][_0x0a9e('0x7b')]=_0x52b661['file'][_0x0a9e('0x77')];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x52b661['params']['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x318fc3,null))['then'](saveUpdates(_0x52b661[_0x0a9e('0x66')],null))[_0x0a9e('0x28')](respondWithResult(_0x318fc3,null))[_0x0a9e('0x5b')](handleError(_0x318fc3,null));};exports[_0x0a9e('0x7c')]=function(_0x3a5836,_0x1bee04){_0x3a5836[_0x0a9e('0x66')][_0x0a9e('0x7d')]=_0x3a5836[_0x0a9e('0x76')][_0x0a9e('0x77')];return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x3a5836[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x1bee04,null))[_0x0a9e('0x28')](saveUpdates(_0x3a5836[_0x0a9e('0x66')],null))['then'](respondWithResult(_0x1bee04,null))['catch'](handleError(_0x1bee04,null));};exports[_0x0a9e('0x7e')]=function(_0x5c4be0,_0x1d999b){var _0x3428c9=path['join'](config[_0x0a9e('0x7f')],_0x0a9e('0x80'));var _0x387bbe={'where':{'id':_0x5c4be0[_0x0a9e('0x5c')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x148fd9=![];return require(_0x0a9e('0x81'))[_0x0a9e('0x82')]()[_0x0a9e('0x28')](function(_0x5d0e1f){if(_0x5d0e1f){_0x148fd9=_0x5d0e1f[_0x0a9e('0x83')];}})[_0x0a9e('0x28')](function(){return db[_0x0a9e('0x46')]['find'](_0x387bbe);})[_0x0a9e('0x28')](handleEntityNotFound(_0x1d999b,null))[_0x0a9e('0x28')](function(_0x17b29d){if(_0x17b29d){if(!_['isNil'](_0x17b29d[_0x0a9e('0x75')])){if(fs[_0x0a9e('0x84')](path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x86'),_0x17b29d['sitepic']))&&_0x148fd9){_0x3428c9=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],'server/files/images/logos/',_0x17b29d[_0x0a9e('0x75')]);}}return _0x1d999b[_0x0a9e('0x87')](_0x3428c9);}})[_0x0a9e('0x5b')](handleError(_0x1d999b,null));};exports['getAvatar']=function(_0x5c3b6f,_0x523d08){var _0x1015aa=path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x88'));var _0x1f78b4={'where':{'id':_0x5c3b6f[_0x0a9e('0x5c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x0a9e('0x46')][_0x0a9e('0x63')](_0x1f78b4)[_0x0a9e('0x28')](handleEntityNotFound(_0x523d08,null))[_0x0a9e('0x28')](function(_0x46956b){if(_0x46956b){if(!_[_0x0a9e('0x89')](_0x46956b[_0x0a9e('0x79')])){if(fs[_0x0a9e('0x84')](path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x8a'),_0x46956b['agentAvatar']))){_0x1015aa=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8a'),_0x46956b[_0x0a9e('0x79')]);}}return _0x523d08[_0x0a9e('0x87')](_0x1015aa);}})[_0x0a9e('0x5b')](handleError(_0x523d08,null));};exports['getCustomerAvatar']=function(_0x1a0314,_0x33da81){var _0xe25eb5=path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x8b'));var _0x3c9135={'where':{'id':_0x1a0314[_0x0a9e('0x5c')]['id']},'attributes':['id',_0x0a9e('0x7b'),_0x0a9e('0x8c')],'raw':!![]};return db[_0x0a9e('0x46')][_0x0a9e('0x63')](_0x3c9135)[_0x0a9e('0x28')](handleEntityNotFound(_0x33da81,null))[_0x0a9e('0x28')](function(_0x3539b7){if(_0x3539b7){if(!_['isNil'](_0x3539b7[_0x0a9e('0x7b')])){if(fs[_0x0a9e('0x84')](path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8a'),_0x3539b7[_0x0a9e('0x7b')]))&&_0x3539b7[_0x0a9e('0x8c')]){_0xe25eb5=path[_0x0a9e('0x85')](config['root'],_0x0a9e('0x8a'),_0x3539b7[_0x0a9e('0x7b')]);}}return _0x33da81[_0x0a9e('0x87')](_0xe25eb5);}})['catch'](handleError(_0x33da81,null));};exports[_0x0a9e('0x8d')]=function(_0x41e446,_0xb0af1e){var _0x97d5b5=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8e'));var _0x336a19={'where':{'id':_0x41e446[_0x0a9e('0x5c')]['id']},'attributes':['id',_0x0a9e('0x7d')],'raw':!![]};return db['ChatWebsite'][_0x0a9e('0x63')](_0x336a19)[_0x0a9e('0x28')](handleEntityNotFound(_0xb0af1e,null))[_0x0a9e('0x28')](function(_0x3db98f){if(_0x3db98f){if(!_[_0x0a9e('0x89')](_0x3db98f[_0x0a9e('0x7d')])){if(fs['existsSync'](path[_0x0a9e('0x85')](config['root'],'server/files/images/avatars/',_0x3db98f['systemAvatar']))){_0x97d5b5=path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0x8a'),_0x3db98f[_0x0a9e('0x7d')]);}}return _0xb0af1e['download'](_0x97d5b5);}})[_0x0a9e('0x5b')](handleError(_0xb0af1e,null));};exports[_0x0a9e('0x8f')]=function(_0x3ddbc7,_0x1fdb10){var _0x2c8d1d={'body':_0x3ddbc7['body'],'channel':'chat'};var _0x9484c8=[];var _0x33bcb2=[];var _0x2a293f={};var _0x5e85d0=![];if(_0x3ddbc7[_0x0a9e('0x66')]['id']){delete _0x3ddbc7[_0x0a9e('0x66')]['id'];}if(_[_0x0a9e('0x89')](_0x3ddbc7['body'][_0x0a9e('0x90')])){throw new APIBadRequestError(_0x0a9e('0x91'));}if(_[_0x0a9e('0x89')](_0x3ddbc7['body'][_0x0a9e('0x92')])){throw new APIBadRequestError(_0x0a9e('0x93'));}if(_[_0x0a9e('0x94')](_0x3ddbc7['body']['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}return db[_0x0a9e('0x95')][_0x0a9e('0x67')]()[_0x0a9e('0x28')](function(_0x26931c){if(!_0x26931c){throw new Error('No\x20available\x20attributes');}_0x9484c8=Object[_0x0a9e('0x4b')](_0x26931c)['filter'](function(_0x3b4af9){return![_0x0a9e('0x96'),_0x0a9e('0x97')]['includes'](_0x3b4af9);});_0x33bcb2=Object[_0x0a9e('0x4b')](_0x26931c)[_0x0a9e('0x56')](function(_0xb8a476){return!['createdAt',_0x0a9e('0x97'),'CompanyId',_0x0a9e('0x98')]['includes'](_0xb8a476);});if(!_[_0x0a9e('0x99')](_0x33bcb2,_0x3ddbc7['body'][_0x0a9e('0x92')])){throw new APIBadRequestError(_0x0a9e('0x9a')+_0x33bcb2[_0x0a9e('0x85')](',\x20'));}_0x2a293f[_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x92')]]=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x90')];})['then'](function(){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x3ddbc7['params']['id']},'include':[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c'),'include':[{'model':db['CmContact'],'as':_0x0a9e('0x9d'),'where':_0x2a293f,'limit':0x1,'order':[[_0x0a9e('0x97'),_0x0a9e('0x9e')]]}]},{'model':db['ChatApplication'],'as':_0x0a9e('0x9f')},{'model':db[_0x0a9e('0xa0')],'as':_0x0a9e('0xa0'),'include':[{'model':db[_0x0a9e('0xa0')],'as':_0x0a9e('0xa1'),'attributes':['id',_0x0a9e('0xa2')],'raw':!![]}]}]});})[_0x0a9e('0x28')](function(_0x74d9b8){if(!_0x74d9b8){throw new APINotFoundError(util[_0x0a9e('0x3b')](_0x0a9e('0xa3'),_0x3ddbc7['params']['id']));}var _0x1799d8=_0x74d9b8['Interval'];if(_0x1799d8){var _0x3c9854=_0x74d9b8[_0x0a9e('0xa4')]||undefined;return _0x1799d8[_0x0a9e('0xa5')](_0x3c9854)[_0x0a9e('0x28')](function(_0x5d577b){if(!_0x5d577b){throw new APIOutOfIntervalError();}return _0x74d9b8;});}else{return _0x74d9b8;}})[_0x0a9e('0x28')](function(_0x5691ac){if(!_0x5691ac[_0x0a9e('0x9c')]){return;}_0x2c8d1d[_0x0a9e('0xa6')]=_0x5691ac;_0x2c8d1d[_0x0a9e('0xa7')]=_0x5691ac['List'];_0x2c8d1d[_0x0a9e('0xa8')]=_[_0x0a9e('0xa9')](_0x5691ac[_0x0a9e('0x9f')],[_0x0a9e('0xaa')],[_0x0a9e('0xab')]);if(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0x9f')]){delete _0x2c8d1d['account'][_0x0a9e('0x9f')];}if(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0x9c')]&&_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0x9c')][_0x0a9e('0x9d')][_0x0a9e('0x4f')]){return _0x2c8d1d['account']['List'][_0x0a9e('0x9d')][0x0];}var _0x3f507c=_[_0x0a9e('0x10')](_0x3ddbc7[_0x0a9e('0x66')],{'firstName':_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x90')],'ListId':_0x5691ac[_0x0a9e('0x98')]});_0x3f507c[_0x3ddbc7['body'][_0x0a9e('0x92')]]=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x90')];return db[_0x0a9e('0x95')][_0x0a9e('0x5f')](_0x3f507c,{'fields':_0x9484c8,'raw':!![]});})[_0x0a9e('0x28')](function(_0x16be7e){_0x2c8d1d['contact']=_0x16be7e;var _0x311288=createInteractionObject(_0x3ddbc7[_0x0a9e('0x5c')]['id'],_0x3ddbc7[_0x0a9e('0x66')],_0x3ddbc7['headers'],_0x16be7e);var _0x2b8ad4={'ChatWebsiteId':_0x3ddbc7[_0x0a9e('0x5c')]['id'],'closed':![]};if(_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')]){_0x2b8ad4['threadId']=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')];return db[_0x0a9e('0xad')][_0x0a9e('0x63')]({'where':_0x2b8ad4})[_0x0a9e('0x28')](function(_0x20c130){if(_0x20c130){_0x5e85d0=!![];return _0x20c130;}_0x311288[_0x0a9e('0xac')]=_0x3ddbc7[_0x0a9e('0x66')]['threadId'];_0x311288[_0x0a9e('0xae')]=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xae')];return db[_0x0a9e('0xad')]['create'](_0x311288);});}_0x2b8ad4['ContactId']=_0x16be7e['id'];if(_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xaf')]&&_0x3ddbc7[_0x0a9e('0x66')]['interaction']['id']){_0x2b8ad4['id']=_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xaf')]['id'];return db['ChatInteraction'][_0x0a9e('0x63')]({'where':_0x2b8ad4})['then'](function(_0x35cc2a){if(_0x35cc2a){_0x5e85d0=!![];return _0x35cc2a;}return db['ChatInteraction']['create'](_0x311288);});}return db['ChatInteraction'][_0x0a9e('0x5f')](_0x311288);})[_0x0a9e('0x28')](function(_0x19f800){if(!_0x5e85d0){return _0x19f800;}var _0x20007e={'from':(_0x2c8d1d[_0x0a9e('0xb0')][_0x0a9e('0x36')]||'')+'\x20'+(_0x2c8d1d['contact'][_0x0a9e('0xb1')]||'')};if(_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')]&&_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xb2')]&&_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0xac')]!=_0x3ddbc7['body']['messageId']){_0x20007e[_0x0a9e('0xac')]=_0x3ddbc7['body'][_0x0a9e('0xb2')];}return _0x19f800[_0x0a9e('0x27')](_0x20007e);})[_0x0a9e('0x28')](function(_0xa3695f){_0x2c8d1d[_0x0a9e('0xaf')]=_0xa3695f[_0x0a9e('0x2a')]({'plain':!![]});_0x2c8d1d['interaction'][_0x0a9e('0xb3')]=!_0x5e85d0;if(_0x2c8d1d['interaction']['created']){if(_0x2c8d1d[_0x0a9e('0xa6')]['autoclose']){_0x2c8d1d[_0x0a9e('0xa8')]['push']({'id':0x0,'priority':_0x2c8d1d['applications'][_0x0a9e('0x4f')]+0x1,'app':'close','appdata':_0x0a9e('0xb4'),'interval':_0x0a9e('0xb5')});}}return db[_0x0a9e('0xb6')]['create']({'body':_0x3ddbc7[_0x0a9e('0x66')][_0x0a9e('0x66')],'ChatWebsiteId':_0x3ddbc7[_0x0a9e('0x5c')]['id'],'ChatInteractionId':_0xa3695f['id'],'direction':'in','ContactId':_0x2c8d1d['contact']['id'],'AttachmentId':_0x3ddbc7['body'][_0x0a9e('0xb7')]});})[_0x0a9e('0x28')](function(_0x89d2cb){_0x2c8d1d[_0x0a9e('0x1c')]=_0x89d2cb;if(!_0x2c8d1d[_0x0a9e('0xaf')][_0x0a9e('0xb8')]){return;}return db[_0x0a9e('0xb9')][_0x0a9e('0x63')]({'attributes':['id',_0x0a9e('0x2f')],'where':{'id':_0x2c8d1d[_0x0a9e('0xaf')]['UserId']}});})['then'](function(_0x558171){if(_0x558171){_0x2c8d1d[_0x0a9e('0xa8')][_0x0a9e('0xba')]({'id':0x0,'priority':0x0,'app':_0x0a9e('0xbb'),'appdata':_0x558171[_0x0a9e('0x2f')]+','+(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0xbc')]||0xa),'interval':_0x0a9e('0xb5')});_0x2c8d1d[_0x0a9e('0xbd')]=!![];}if(!_0x2c8d1d['interaction']['queueId']){return;}return db[_0x0a9e('0xbe')][_0x0a9e('0x63')]({'attributes':['id','name'],'where':{'id':_0x2c8d1d[_0x0a9e('0xaf')][_0x0a9e('0xbf')]}});})[_0x0a9e('0x28')](function(_0x19e024){if(_0x19e024){_0x2c8d1d[_0x0a9e('0xa8')][_0x0a9e('0xba')]({'id':0x0,'priority':0x1,'app':_0x0a9e('0xc0'),'appdata':_0x19e024[_0x0a9e('0x2f')]+','+(_0x2c8d1d[_0x0a9e('0xa6')][_0x0a9e('0xc1')]||0x12c),'interval':_0x0a9e('0xb5')});}return respondWithRpcPromise(_0x0a9e('0xc2'),'startRouting',_0x2c8d1d);})[_0x0a9e('0x28')](function(_0x261ef8){respondWithRpcPromise(_0x0a9e('0xc3'),_0x0a9e('0xc3'),{'event':_0x0a9e('0x8f'),'message':_0x261ef8},client9002);return _0x261ef8;})[_0x0a9e('0x28')](respondWithResult(_0x1fdb10,null))[_0x0a9e('0x5b')](APIHandleError(_0x1fdb10));};exports[_0x0a9e('0xc4')]=function(_0x3a9c0f,_0x3f1959){var _0x6b048e,_0x3ba472,_0x4e6eb9;var _0x572a72=[];var _0x3e5182={};var _0x401207=_0x3a9c0f[_0x0a9e('0xc5')]||[];var _0x1ee9d3=[];var _0x33359a;return db[_0x0a9e('0x95')][_0x0a9e('0x67')]()['then'](function(_0x26a204){if(!_0x26a204){throw new db['Sequelize'][(_0x0a9e('0xc6'))](_0x0a9e('0xc7'));}_0x572a72=_[_0x0a9e('0xc8')](_[_0x0a9e('0x4b')](_0x26a204),[_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0xc9'),_0x0a9e('0x98')]);if(_0x3a9c0f[_0x0a9e('0x66')]['id']){delete _0x3a9c0f[_0x0a9e('0x66')]['id'];}if(_[_0x0a9e('0x89')](_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0x90')])){throw _0x3f1959[_0x0a9e('0x1f')](0x1f4)[_0x0a9e('0xca')](new db[(_0x0a9e('0xcb'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x0a9e('0x89')](_0x3a9c0f[_0x0a9e('0x66')]['body'])||_0x3a9c0f['body'][_0x0a9e('0x66')]===''){throw _0x3f1959[_0x0a9e('0x1f')](0x1f4)[_0x0a9e('0xca')](new db['Sequelize'][(_0x0a9e('0xc6'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0a9e('0x89')](_0x3a9c0f['body'][_0x0a9e('0xcc')])){throw _0x3f1959['status'](0x1f4)[_0x0a9e('0xca')](new db[(_0x0a9e('0xcb'))][(_0x0a9e('0xc6'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x572a72));}if(!_[_0x0a9e('0x99')](_0x572a72,_0x3a9c0f['body']['mapKeyOffline'])){throw _0x3f1959[_0x0a9e('0x1f')](0x1f4)[_0x0a9e('0xca')](new db[(_0x0a9e('0xcb'))][(_0x0a9e('0xc6'))](_0x0a9e('0xcd')+_0x572a72));}_0x3e5182[_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0xcc')]]=_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0x90')];})[_0x0a9e('0x28')](function(){return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x3a9c0f[_0x0a9e('0x5c')]['id']},'include':[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')},{'model':db[_0x0a9e('0xce')],'as':_0x0a9e('0xce')}]});})[_0x0a9e('0x28')](handleEntityNotFound(_0x3f1959,null))[_0x0a9e('0x28')](function(_0x51a987){if(_0x51a987&&_0x51a987[_0x0a9e('0x9c')]){_0x3ba472=_0x51a987;var _0xf780f5=_[_0x0a9e('0x10')](_0x3a9c0f[_0x0a9e('0x66')],{'firstName':_0x3a9c0f['body']['from'],'phone':_0x3a9c0f['body'][_0x0a9e('0x90')],'ListId':_0x51a987['ListId']});_0xf780f5[_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0xcc')]]=_0x3a9c0f[_0x0a9e('0x66')][_0x0a9e('0x90')];return db[_0x0a9e('0x95')][_0x0a9e('0xcf')]({'where':_0x3e5182,'defaults':_0xf780f5});}})[_0x0a9e('0xd0')](function(_0x1cc73e){if(_0x1cc73e){_0x4e6eb9=_0x1cc73e;var _0x2154d8=fs[_0x0a9e('0xd1')](path['join'](config[_0x0a9e('0x7f')],'server/files/templates/chatOfflineMessage.ejs'),_0x0a9e('0xd2'));var _0x586d2f=ejs[_0x0a9e('0xd3')](_0x2154d8,{'body':_[_0x0a9e('0xd4')](_0x3a9c0f[_0x0a9e('0x66')]['body']),'bodyTitle':_0x3ba472[_0x0a9e('0xd5')]});return db[_0x0a9e('0xd6')]['create']({'body':_0x586d2f,'plainBody':htmlToText['fromString'](_0x586d2f),'ContactId':_0x1cc73e['id'],'ChatWebsiteId':_0x3ba472['id']});}})[_0x0a9e('0x28')](function(_0x41e19e){_0x33359a=_0x41e19e;if(_0x401207[_0x0a9e('0x4f')]){var _0x5e2939=_0x401207['map'](function(_0x4869c1){return{'name':_0x4869c1[_0x0a9e('0xd7')],'basename':_0x4869c1[_0x0a9e('0x77')],'type':_0x4869c1[_0x0a9e('0xd8')],'ChatOfflineMessageId':_0x41e19e['id']};});_0x1ee9d3=_0x5e2939[_0x0a9e('0x45')](_0x3d4349=>{var _0x23e6b5={'filename':_0x3d4349[_0x0a9e('0x2f')],'path':path[_0x0a9e('0x85')](config[_0x0a9e('0x7f')],_0x0a9e('0xd9'),_0x0a9e('0xc5'),_0x0a9e('0xda'),_0x0a9e('0xdb'),_0x3d4349[_0x0a9e('0xdc')])};return _0x23e6b5;});if(!_0x3ba472[_0x0a9e('0xdd')]){return db[_0x0a9e('0xde')][_0x0a9e('0xdf')](function(_0x320367){return db['Attachment'][_0x0a9e('0xe0')](_0x5e2939,{'transaction':_0x320367});});}}})[_0x0a9e('0x28')](function(){if(_0x33359a){_0x6b048e=_0x33359a;return db[_0x0a9e('0xce')][_0x0a9e('0x6b')]({'where':{'service':!![]},'include':[{'model':db[_0x0a9e('0xe1')],'as':_0x0a9e('0xe2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0a9e('0xe3'),'raw':!![]}]}]});}})[_0x0a9e('0x28')](function(_0x3a14d7){if(_0x3a14d7&&_0x3a14d7[_0x0a9e('0xe2')]&&_0x3ba472[_0x0a9e('0xe4')]&&_0x3ba472[_0x0a9e('0xe5')]){var _0x103ad9=_0x3a14d7[_0x0a9e('0xe6')]();return respondWithRpcPromise(_0x0a9e('0xe7'),'sendMail',{'account':_0x103ad9,'message':{'from':util['format'](_0x0a9e('0xe8'),_0x3a14d7[_0x0a9e('0x2f')],_0x3a14d7['email']||_0x3a14d7[_0x0a9e('0xe2')][_0x0a9e('0x60')]),'to':_0x3ba472['forwardOfflineAddress'],'subject':_0x3ba472[_0x0a9e('0xe9')],'html':_0x6b048e['body'],'attachments':_0x1ee9d3}},client9003)[_0x0a9e('0x28')](function(){return _0x6b048e;})[_0x0a9e('0x5b')](function(_0x58c53c){logger[_0x0a9e('0x19')](_0x58c53c);});}})[_0x0a9e('0x28')](function(){if(_0x3ba472&&_0x3ba472['openNewInteraction']&&_0x3ba472[_0x0a9e('0xea')]){var _0x44e01f=[];if(_0x401207['length']){_0x44e01f=_0x401207[_0x0a9e('0x45')](function(_0x237994){return{'name':_0x237994[_0x0a9e('0xd7')],'basename':_0x237994[_0x0a9e('0x77')],'type':_0x237994[_0x0a9e('0xd8')],'ChatOfflineMessageId':_0x33359a['id']};});}var _0x17a0d5;if(!_['isNil'](_0x3ba472[_0x0a9e('0xeb')])){var _0x36dc4f=_['map'](_0x3a9c0f[_0x0a9e('0x66')],function(_0x2bbb3f){return _0x2bbb3f;});var _0x22c390=_[_0x0a9e('0xec')](_0x36dc4f)[0x0];var _0x3fae71=_[_0x0a9e('0xed')](_0x22c390,function(_0x368a12){return _0x368a12;});_0x17a0d5=_0x3fae71[0x1][_0x3ba472['subjectOffline']];}var _0x49e1b8={'from':_0x4e6eb9['email'],'firstName':_0x4e6eb9['firstName'],'lastName':_0x4e6eb9['lastName'],'mapKey':_0x0a9e('0xee'),'message':{'from':_0x4e6eb9[_0x0a9e('0xee')],'to':_0x3ba472['MailAccount']['email'],'cc':'','subject':_[_0x0a9e('0x89')](_0x17a0d5)?_0x3ba472['offlineMessageSubject']:_0x17a0d5,'messageId':'','sentAt':new Date(),'attach':_0x44e01f[_0x0a9e('0x4f')],'attachments':_0x44e01f,'originChannel':_0x0a9e('0xef'),'ChatWebsiteId':_0x3ba472['id'],'ChatOfflineMessageId':_0x6b048e['id'],'originTo':_0x3ba472[_0x0a9e('0xce')][_0x0a9e('0xee')]},'body':_0x6b048e[_0x0a9e('0x66')]};var _0x14a683={'account':{'id':_0x3ba472['MailAccountId']},'body':_0x49e1b8,'log':_0x0a9e('0xf0')};return respondWithRpcPromise(_0x0a9e('0xf0'),'notifyMail',_0x14a683,client9001)[_0x0a9e('0x28')](function(){return _0x6b048e;})[_0x0a9e('0x5b')](function(_0x2e0e9b){logger[_0x0a9e('0x19')](_0x2e0e9b);});}return;})[_0x0a9e('0x28')](function(){if(_0x6b048e){return _0x6b048e;}})[_0x0a9e('0x28')](respondWithResult(_0x3f1959,null))[_0x0a9e('0x5b')](function(){for(var _0x4a36df of _0x401207){var _0x331216=path['join'](config[_0x0a9e('0x7f')],_0x0a9e('0xd9'),'files',_0x0a9e('0xda'),_0x0a9e('0xdb'),_0x4a36df['filename']);fs_extra[_0x0a9e('0xf1')](_0x331216)['catch'](function(_0x4552b5){logger[_0x0a9e('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x331216,_0x4552b5);});}});};exports[_0x0a9e('0xf2')]=function(_0x4a9682,_0x1d046c){return db[_0x0a9e('0xad')][_0x0a9e('0x63')]({'where':{'id':_0x4a9682[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x1d046c,null))[_0x0a9e('0x28')](function(_0xa45906){if(_0xa45906){return _0xa45906['addInteraction'](_0x4a9682[_0x0a9e('0x66')][_0x0a9e('0x6f')],_[_0x0a9e('0xf3')](_0x4a9682[_0x0a9e('0x66')],[_0x0a9e('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x1d046c,null))[_0x0a9e('0x5b')](handleError(_0x1d046c,null));};exports['getInteractions']=function(_0x5d1159,_0x3a459c){var _0x58efc5={'raw':![],'where':{}};var _0x43cb0={};var _0x255ed6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a9e('0x6b')]({'where':{'id':_0x5d1159[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x3a459c,null))[_0x0a9e('0x28')](function(_0x2e1adc){if(_0x2e1adc){_0x43cb0[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0xad')][_0x0a9e('0x47')]);_0x43cb0['query']=_[_0x0a9e('0x4b')](_0x5d1159[_0x0a9e('0x4a')]);_0x43cb0[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x43cb0['model'],_0x43cb0[_0x0a9e('0x4a')]);_0x58efc5[_0x0a9e('0x4d')]=_[_0x0a9e('0x4c')](_0x43cb0['model'],qs[_0x0a9e('0x4e')](_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x58efc5['attributes']=_0x58efc5[_0x0a9e('0x4d')]['length']?_0x58efc5[_0x0a9e('0x4d')]:_0x43cb0[_0x0a9e('0x3f')];if(!_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x58efc5[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x5d1159['query'][_0x0a9e('0x22')]);_0x58efc5[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}_0x58efc5[_0x0a9e('0x52')]=qs[_0x0a9e('0x53')](_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x58efc5[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_[_0x0a9e('0x6c')](_0x5d1159[_0x0a9e('0x4a')],_0x43cb0[_0x0a9e('0x55')]));_0x58efc5[_0x0a9e('0x54')][_0x0a9e('0x71')]=_0x2e1adc['id'];if(_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x58efc5[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x58efc5[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x58efc5[_0x0a9e('0x4d')],function(_0x58ebb0){var _0x86cb95={};_0x86cb95[_0x58ebb0]={'$like':'%'+_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x56')]+'%'};return _0x86cb95;})});}_0x58efc5=_['merge']({},_0x58efc5,_0x5d1159[_0x0a9e('0x59')]);return db['ChatInteraction'][_0x0a9e('0x23')]({'where':_0x58efc5[_0x0a9e('0x54')]})[_0x0a9e('0x28')](function(_0x39c4da){_0x255ed6[_0x0a9e('0x23')]=_0x39c4da;if(_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x58efc5[_0x0a9e('0x5e')]=[{'model':db['CmContact'],'as':_0x0a9e('0xf4'),'required':![]},{'model':db[_0x0a9e('0xb9')],'as':'Owner','attributes':[_0x0a9e('0x2f'),_0x0a9e('0xf5'),_0x0a9e('0xf6')],'required':![]},{'model':db['Tag'],'as':_0x0a9e('0xf7'),'attributes':['id',_0x0a9e('0x2f'),_0x0a9e('0xf8')],'where':_0x5d1159[_0x0a9e('0x4a')]['tag']?{'id':_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0xf9')]}:undefined,'required':_0x5d1159[_0x0a9e('0x4a')][_0x0a9e('0xf9')]?!![]:![]}];}return db[_0x0a9e('0xad')]['findAll'](_0x58efc5);})[_0x0a9e('0x28')](function(_0x3fc431){_0x255ed6['rows']=_0x3fc431;return _0x255ed6;});}})[_0x0a9e('0x28')](respondWithFilteredResult(_0x3a459c,_0x58efc5))[_0x0a9e('0x5b')](handleError(_0x3a459c,null));};exports[_0x0a9e('0xfa')]=function(_0x54246a,_0x557ef8){var _0x45ef37=0x0;var _0x36d905=0x0;var _0x271485=![];var _0x283bbb;var _0x23a073;return db[_0x0a9e('0x46')][_0x0a9e('0x63')]({'where':{'id':_0x54246a[_0x0a9e('0x5c')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x0a9e('0xa0')],'as':'Intervals','attributes':['id',_0x0a9e('0xa2')]}]}]})[_0x0a9e('0x28')](handleEntityNotFound(_0x557ef8,null))[_0x0a9e('0x28')](function(_0x413f0f){if(_0x413f0f){_0x283bbb=_0x413f0f;return _0x413f0f['getProactiveActions']({'raw':!![]});}})[_0x0a9e('0x28')](function(_0x43c1d1){if(_0x283bbb){if(_0x43c1d1){_0x23a073=_0x43c1d1;}}return require('../../config/license/util')[_0x0a9e('0x82')]();})['then'](function(_0x2e1de7){if(_0x2e1de7){_0x36d905=_0x2e1de7[_0x0a9e('0xfb')];_0x271485=_0x2e1de7[_0x0a9e('0x83')];}})[_0x0a9e('0x28')](function(){return db[_0x0a9e('0xad')][_0x0a9e('0x23')]({'where':{'closed':![]}});})['then'](function(_0x16d50b){_0x45ef37=_0x16d50b;if(_0x36d905&&_0x16d50b>_0x36d905){return db['License'][_0x0a9e('0x6b')]({'where':{'id':0x1}})[_0x0a9e('0x28')](function(_0x4229e6){if(_0x4229e6){_0x4229e6[_0x0a9e('0xfc')](_0x0a9e('0xfd'));}});}})[_0x0a9e('0x28')](function(){var _0x2d7d76=_0x283bbb['Interval'];var _0x37d9b9=_0x283bbb[_0x0a9e('0xa4')]||undefined;return _0x2d7d76[_0x0a9e('0xa5')](_0x37d9b9);})[_0x0a9e('0x28')](function(_0x132d6d){var _0x534f61=fs[_0x0a9e('0xd1')](path[_0x0a9e('0x85')](config['root'],'server/files/chat/iframe.ejs'),_0x0a9e('0xd2'));var _0x11b33b=new url[(_0x0a9e('0xfe'))](_0x283bbb[_0x0a9e('0xff')])[_0x0a9e('0x100')];var _0x1f1f36='3.7.0';var _0x1e31c2=![];var _0x13782b={'chatVersion':_0x1f1f36,'chatWebsiteAddressOrigin':_0x11b33b,'remote':_0x283bbb[_0x0a9e('0x101')],'query':querystring['stringify'](_[_0x0a9e('0x58')](_0x283bbb[_0x0a9e('0x2a')]({'plain':!![]}),{'customerIp':_0x54246a[_0x0a9e('0x102')][_0x0a9e('0x34')]||_0x54246a['headers']['x-real-ip']||_0x54246a[_0x0a9e('0x103')][_0x0a9e('0x104')]||_0x54246a['ip'],'referer':_0x54246a[_0x0a9e('0x102')][_0x0a9e('0x38')],'openedInteractions':_0x45ef37,'maxInteractions':_0x36d905,'virtual':_0x271485[_0x0a9e('0xfb')],'online':_0x132d6d,'custom':_0x271485}))[_0x0a9e('0x105')](/'/g,'\x5c\x27')};_0x557ef8[_0x0a9e('0xca')](ejs[_0x0a9e('0xd3')](Mustache['render'](_0x534f61,_0x13782b),{'proactiveActions':_0x23a073,'alignment':_0x283bbb[_0x0a9e('0x106')],'verticalAlignment':_0x283bbb['verticalAlignment'],'div_color':_0x283bbb[_0x0a9e('0xf8')],'labelText':_0x283bbb[_0x0a9e('0x107')],'text_color':_0x283bbb[_0x0a9e('0x108')],'text_button_color':_0x283bbb['textButtonColor'],'button_color':_0x283bbb['color_button'],'background_color':_0x283bbb[_0x0a9e('0x109')],'hideWhenOffline':_0x283bbb['hideWhenOffline'],'intervalId':_0x283bbb[_0x0a9e('0x10a')],'isDevelopment':_0x1e31c2,'chatVersion':_0x1f1f36}));})['catch'](handleError(_0x557ef8,null));};exports['addApplications']=function(_0x229d20,_0x2a17d0){var _0x452b04=_0x229d20[_0x0a9e('0x5c')]['id'];var _0x1f0776=_0x229d20[_0x0a9e('0x66')];var _0x2f64ef=0xc8;var _0x36287b=null;return db[_0x0a9e('0xde')][_0x0a9e('0xdf')]({'isolationLevel':db[_0x0a9e('0xde')][_0x0a9e('0x10b')][_0x0a9e('0x10c')]['READ_COMMITTED']},function(_0x58f251){return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x452b04},'transaction':_0x58f251})[_0x0a9e('0x28')](function(_0x1db652){if(_0x1db652){return db[_0x0a9e('0x10d')]['destroy']({'where':{'ChatWebsiteId':_0x452b04},'transaction':_0x58f251})['then'](function(){var _0x428009=_[_0x0a9e('0x45')](_0x1f0776,function(_0x2c316b){_0x2c316b[_0x0a9e('0x71')]=_0x452b04;return _0x2c316b;});return db[_0x0a9e('0x10d')][_0x0a9e('0xe0')](_0x428009,{'transaction':_0x58f251});});}else{_0x2f64ef=0x194;_0x36287b=[];}});})[_0x0a9e('0x28')](function(){if(_0x2f64ef!==0x194){return db['ChatApplication'][_0x0a9e('0x10e')]({'where':{'ChatWebsiteId':_0x452b04},'order':'priority'})[_0x0a9e('0x28')](function(_0xb76c50){_0x36287b=_0xb76c50;});}})['catch'](function(_0x1fe77c){_0x2f64ef=0x1f4;logger[_0x0a9e('0x19')](_0x1fe77c[_0x0a9e('0x2e')]);if(_0x1fe77c[_0x0a9e('0x2f')]){delete _0x1fe77c[_0x0a9e('0x2f')];}_0x36287b=_0x1fe77c;})[_0x0a9e('0x10f')](function(){if(_0x36287b===null){_0x2a17d0['sendStatus'](_0x2f64ef);}else{if(_0x2f64ef===0x1f4){_0x2a17d0[_0x0a9e('0x1f')](_0x2f64ef)[_0x0a9e('0xca')](_0x36287b);}else{_0x2a17d0[_0x0a9e('0x1f')](_0x2f64ef)['json'](_0x36287b);}}});};exports[_0x0a9e('0x110')]=function(_0x934f69,_0x24dc3f){var _0x525928={};var _0x459173={};var _0x3607c6;var _0x37257e;return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x934f69[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x24dc3f,null))['then'](function(_0x36bf7d){if(_0x36bf7d){_0x3607c6=_0x36bf7d;_0x459173[_0x0a9e('0x3f')]=_['keys'](db[_0x0a9e('0x10d')][_0x0a9e('0x47')]);_0x459173[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x934f69[_0x0a9e('0x4a')]);_0x459173[_0x0a9e('0x55')]=_['intersection'](_0x459173[_0x0a9e('0x3f')],_0x459173[_0x0a9e('0x4a')]);_0x525928[_0x0a9e('0x4d')]=_['intersection'](_0x459173[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x525928['attributes']=_0x525928['attributes'][_0x0a9e('0x4f')]?_0x525928[_0x0a9e('0x4d')]:_0x459173[_0x0a9e('0x3f')];_0x525928['order']=qs[_0x0a9e('0x53')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x525928[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_[_0x0a9e('0x6c')](_0x934f69[_0x0a9e('0x4a')],_0x459173[_0x0a9e('0x55')]));if(_0x934f69['query']['filter']){_0x525928[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x525928['where'],{'$or':_[_0x0a9e('0x45')](_0x525928['attributes'],function(_0x1f80cb){var _0xfb2f3a={};_0xfb2f3a[_0x1f80cb]={'$like':'%'+_0x934f69['query'][_0x0a9e('0x56')]+'%'};return _0xfb2f3a;})});}_0x525928=_[_0x0a9e('0x58')]({},_0x525928,_0x934f69['options']);return _0x3607c6[_0x0a9e('0x110')](_0x525928);}})[_0x0a9e('0x28')](function(_0x6933ab){if(_0x6933ab){_0x37257e=_0x6933ab[_0x0a9e('0x4f')];if(!_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x525928['limit']=qs[_0x0a9e('0x22')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x22')]);_0x525928[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x934f69[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}return _0x3607c6['getApplications'](_0x525928);}})['then'](function(_0x435688){if(_0x435688){return _0x435688?{'count':_0x37257e,'rows':_0x435688}:null;}})[_0x0a9e('0x28')](respondWithResult(_0x24dc3f,null))[_0x0a9e('0x5b')](handleError(_0x24dc3f,null));};exports['addProactiveActions']=function(_0x5cf1ba,_0xf7ddca){return db['chatProactiveAction'][_0x0a9e('0x63')]({'where':{'id':_0x5cf1ba[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0xf7ddca,null))[_0x0a9e('0x28')](function(_0x20f4cb){if(_0x20f4cb){return _0x20f4cb[_0x0a9e('0x111')](_0x5cf1ba[_0x0a9e('0x66')][_0x0a9e('0x6f')],_[_0x0a9e('0xf3')](_0x5cf1ba['body'],['ids','id'])||{});}})[_0x0a9e('0x28')](respondWithResult(_0xf7ddca,null))['catch'](handleError(_0xf7ddca,null));};exports[_0x0a9e('0x112')]=function(_0x14ff88,_0xb44070){var _0x3b684b={};var _0x4ad6fc={};var _0xaa43da;var _0x2ee2fc;return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x14ff88[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0xb44070,null))[_0x0a9e('0x28')](function(_0x5c09d6){if(_0x5c09d6){_0xaa43da=_0x5c09d6;_0x4ad6fc[_0x0a9e('0x3f')]=_[_0x0a9e('0x4b')](db[_0x0a9e('0x113')][_0x0a9e('0x47')]);_0x4ad6fc[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x14ff88['query']);_0x4ad6fc['filters']=_[_0x0a9e('0x4c')](_0x4ad6fc[_0x0a9e('0x3f')],_0x4ad6fc[_0x0a9e('0x4a')]);_0x3b684b['attributes']=_['intersection'](_0x4ad6fc[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x14ff88[_0x0a9e('0x4a')]['fields']));_0x3b684b['attributes']=_0x3b684b[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x3b684b[_0x0a9e('0x4d')]:_0x4ad6fc[_0x0a9e('0x3f')];_0x3b684b[_0x0a9e('0x52')]=qs['sort'](_0x14ff88[_0x0a9e('0x4a')]['sort']);_0x3b684b[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_['pick'](_0x14ff88[_0x0a9e('0x4a')],_0x4ad6fc['filters']));if(_0x14ff88[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x3b684b[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x3b684b[_0x0a9e('0x54')],{'$or':_['map'](_0x3b684b[_0x0a9e('0x4d')],function(_0x2ef5c8){var _0x226d6f={};_0x226d6f[_0x2ef5c8]={'$like':'%'+_0x14ff88['query'][_0x0a9e('0x56')]+'%'};return _0x226d6f;})});}_0x3b684b=_['merge']({},_0x3b684b,_0x14ff88[_0x0a9e('0x59')]);return _0xaa43da[_0x0a9e('0x112')](_0x3b684b);}})[_0x0a9e('0x28')](function(_0x498d4e){if(_0x498d4e){_0x2ee2fc=_0x498d4e[_0x0a9e('0x4f')];if(!_0x14ff88[_0x0a9e('0x4a')][_0x0a9e('0x50')](_0x0a9e('0x51'))){_0x3b684b[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x14ff88['query'][_0x0a9e('0x22')]);_0x3b684b[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x14ff88[_0x0a9e('0x4a')][_0x0a9e('0x20')]);}return _0xaa43da[_0x0a9e('0x112')](_0x3b684b);}})[_0x0a9e('0x28')](function(_0x3e43ea){if(_0x3e43ea){return _0x3e43ea?{'count':_0x2ee2fc,'rows':_0x3e43ea}:null;}})['then'](respondWithResult(_0xb44070,null))[_0x0a9e('0x5b')](handleError(_0xb44070,null));};exports[_0x0a9e('0x114')]=function(_0x3813ac,_0x40948d){var _0x55a300=_0x3813ac[_0x0a9e('0x4a')]['online']===_0x0a9e('0x115')?_0x0a9e('0x116'):_0x0a9e('0x117');return db['ChatWebsite'][_0x0a9e('0x63')]({'attributes':['id',_0x55a300],'where':{'id':_0x3813ac[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x40948d,null))[_0x0a9e('0x28')](function(_0x53e0fc){if(_0x53e0fc){var _0x110b3a=_0x53e0fc[_0x55a300];var _0x319a78=_0x110b3a&&_0x110b3a[_0x0a9e('0x118')]?_0x110b3a[_0x0a9e('0x118')]:[];_0x40948d[_0x0a9e('0xca')]({'fromKey':_[_0x0a9e('0x89')](_0x110b3a[_0x0a9e('0x119')])?undefined:_0x110b3a['fromKey'],'count':_0x319a78[_0x0a9e('0x4f')],'rows':_0x319a78});}})[_0x0a9e('0x5b')](handleError(_0x40948d,null));};exports[_0x0a9e('0x11a')]=function(_0xa42055,_0x52cdf4){var _0x1b6dde={'raw':![],'where':{}};var _0x4bd161={};var _0x2b8f51={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0xa42055[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x52cdf4,null))[_0x0a9e('0x28')](function(_0x2eaeeb){if(_0x2eaeeb){_0x4bd161['model']=_[_0x0a9e('0x4b')](db['ChatOfflineMessage'][_0x0a9e('0x47')]);_0x4bd161[_0x0a9e('0x4a')]=_['keys'](_0xa42055[_0x0a9e('0x4a')]);_0x4bd161[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x4bd161[_0x0a9e('0x3f')],_0x4bd161['query']);_0x1b6dde[_0x0a9e('0x4d')]=_[_0x0a9e('0x4c')](_0x4bd161['model'],qs[_0x0a9e('0x4e')](_0xa42055['query']['fields']));_0x1b6dde['attributes']=_0x1b6dde[_0x0a9e('0x4d')][_0x0a9e('0x4f')]?_0x1b6dde['attributes']:_0x4bd161[_0x0a9e('0x3f')];if(!_0xa42055[_0x0a9e('0x4a')]['hasOwnProperty'](_0x0a9e('0x51'))){_0x1b6dde[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x22')]);_0x1b6dde[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0xa42055['query'][_0x0a9e('0x20')]);}_0x1b6dde['order']=qs[_0x0a9e('0x53')](_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x53')]);_0x1b6dde[_0x0a9e('0x54')]=qs[_0x0a9e('0x55')](_[_0x0a9e('0x6c')](_0xa42055['query'],_0x4bd161[_0x0a9e('0x55')]));_0x1b6dde[_0x0a9e('0x54')][_0x0a9e('0x71')]=_0x2eaeeb['id'];if(_0xa42055['query'][_0x0a9e('0x56')]){_0x1b6dde[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x1b6dde[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x1b6dde[_0x0a9e('0x4d')],function(_0x3bc55c){var _0x1f1b80={};_0x1f1b80[_0x3bc55c]={'$like':'%'+_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x56')]+'%'};return _0x1f1b80;})});}_0x1b6dde=_[_0x0a9e('0x58')]({},_0x1b6dde,_0xa42055[_0x0a9e('0x59')]);return db[_0x0a9e('0xd6')][_0x0a9e('0x23')]({'where':_0x1b6dde[_0x0a9e('0x54')]})[_0x0a9e('0x28')](function(_0x515f8f){_0x2b8f51[_0x0a9e('0x23')]=_0x515f8f;if(_0xa42055[_0x0a9e('0x4a')][_0x0a9e('0x5a')]){_0x1b6dde['include']=[{'all':!![]}];}else{_0x1b6dde[_0x0a9e('0x5e')]=[{'model':db[_0x0a9e('0x95')],'as':_0x0a9e('0xf4'),'required':![]},{'model':db[_0x0a9e('0x11b')],'as':'Attachments','required':![]}];}return db[_0x0a9e('0xd6')][_0x0a9e('0x6d')](_0x1b6dde);})[_0x0a9e('0x28')](function(_0x409232){_0x2b8f51['rows']=_0x409232;return _0x2b8f51;});}})[_0x0a9e('0x28')](respondWithFilteredResult(_0x52cdf4,_0x1b6dde))[_0x0a9e('0x5b')](handleError(_0x52cdf4,null));};exports[_0x0a9e('0x11c')]=function(_0x1da167,_0x58a46f){return db['ChatWebsite'][_0x0a9e('0x63')]({'where':{'id':_0x1da167[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x58a46f,null))[_0x0a9e('0x28')](function(_0x8c1ac4){if(_0x8c1ac4){return _0x8c1ac4[_0x0a9e('0x11c')](_0x1da167[_0x0a9e('0x66')][_0x0a9e('0x6f')],_[_0x0a9e('0xf3')](_0x1da167[_0x0a9e('0x66')],[_0x0a9e('0x6f'),'id'])||{})[_0x0a9e('0xd0')](function(_0x347629){for(var _0x30c231=0x0;_0x30c231<_0x1da167['body'][_0x0a9e('0x6f')][_0x0a9e('0x4f')];_0x30c231+=0x1){socket[_0x0a9e('0x11d')]('userChatWebsite:save',{'UserId':Number(_0x1da167['body'][_0x0a9e('0x6f')][_0x30c231]),'ChatWebsiteId':Number(_0x1da167['params']['id'])});}return _0x347629;});}})[_0x0a9e('0x28')](respondWithResult(_0x58a46f,null))[_0x0a9e('0x5b')](handleError(_0x58a46f,null));};exports[_0x0a9e('0x11e')]=function(_0x12a7e,_0x56caca){return db['ChatWebsite'][_0x0a9e('0x63')]({'where':{'id':_0x12a7e[_0x0a9e('0x5c')]['id']}})[_0x0a9e('0x28')](handleEntityNotFound(_0x56caca,null))[_0x0a9e('0x28')](function(_0x557115){if(_0x557115){return _0x557115[_0x0a9e('0x11e')](_0x12a7e[_0x0a9e('0x4a')][_0x0a9e('0x6f')])[_0x0a9e('0x28')](function(){if(_[_0x0a9e('0x11f')](_0x12a7e['query']['ids'])){for(var _0x35b0e6=0x0;_0x35b0e6<_0x12a7e[_0x0a9e('0x4a')][_0x0a9e('0x6f')][_0x0a9e('0x4f')];_0x35b0e6+=0x1){socket[_0x0a9e('0x11d')](_0x0a9e('0x120'),{'UserId':Number(_0x12a7e[_0x0a9e('0x4a')]['ids'][_0x35b0e6]),'ChatWebsiteId':Number(_0x12a7e[_0x0a9e('0x5c')]['id'])});}}else{socket[_0x0a9e('0x11d')](_0x0a9e('0x120'),{'UserId':Number(_0x12a7e['query']['ids']),'ChatWebsiteId':Number(_0x12a7e['params']['id'])});}});}})[_0x0a9e('0x28')](respondWithStatusCode(_0x56caca,null))[_0x0a9e('0x5b')](handleError(_0x56caca,null));};exports['getAgents']=function(_0x419d9e,_0x257b65){var _0x42d776={};var _0x583347={};var _0x571931;var _0x18010e;return db[_0x0a9e('0x46')][_0x0a9e('0x6b')]({'where':{'id':_0x419d9e[_0x0a9e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x257b65,null))[_0x0a9e('0x28')](function(_0x5ccb5a){if(_0x5ccb5a){_0x571931=_0x5ccb5a;_0x583347['model']=_[_0x0a9e('0x4b')](db['User'][_0x0a9e('0x47')]);_0x583347[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_0x419d9e['query']);_0x583347[_0x0a9e('0x55')]=_[_0x0a9e('0x4c')](_0x583347[_0x0a9e('0x3f')],_0x583347['query']);_0x42d776['attributes']=_[_0x0a9e('0x4c')](_0x583347[_0x0a9e('0x3f')],qs[_0x0a9e('0x4e')](_0x419d9e[_0x0a9e('0x4a')][_0x0a9e('0x4e')]));_0x42d776[_0x0a9e('0x4d')]=_0x42d776['attributes']['length']?_0x42d776[_0x0a9e('0x4d')]:_0x583347[_0x0a9e('0x3f')];_0x42d776['order']=qs['sort'](_0x419d9e['query']['sort']);_0x42d776['where']=qs['filters'](_[_0x0a9e('0x6c')](_0x419d9e['query'],_0x583347[_0x0a9e('0x55')]));if(_0x419d9e[_0x0a9e('0x4a')][_0x0a9e('0x56')]){_0x42d776[_0x0a9e('0x54')]=_[_0x0a9e('0x58')](_0x42d776[_0x0a9e('0x54')],{'$or':_[_0x0a9e('0x45')](_0x42d776['attributes'],function(_0x2866e7){var _0x13e8bd={};_0x13e8bd[_0x2866e7]={'$like':'%'+_0x419d9e[_0x0a9e('0x4a')][_0x0a9e('0x56')]+'%'};return _0x13e8bd;})});}_0x42d776=_[_0x0a9e('0x58')]({},_0x42d776,_0x419d9e[_0x0a9e('0x59')]);return _0x571931[_0x0a9e('0x121')](_0x42d776);}})[_0x0a9e('0x28')](function(_0x1911d0){if(_0x1911d0){_0x18010e=_0x1911d0[_0x0a9e('0x4f')];if(!_0x419d9e[_0x0a9e('0x4a')]['hasOwnProperty'](_0x0a9e('0x51'))){_0x42d776[_0x0a9e('0x22')]=qs['limit'](_0x419d9e[_0x0a9e('0x4a')]['limit']);_0x42d776[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x419d9e['query']['offset']);}return _0x571931[_0x0a9e('0x121')](_0x42d776);}})['then'](function(_0x176612){if(_0x176612){return _0x176612?{'count':_0x18010e,'rows':_0x176612}:null;}})[_0x0a9e('0x28')](respondWithResult(_0x257b65,null))[_0x0a9e('0x5b')](handleError(_0x257b65,null));}; \ No newline at end of file +var _0x5aec=['Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','mapKey','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','DESC','ChatApplication','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','ifTime','account','list','orderBy','Applications','asc','Contacts','ListId','CmContact','contact','headers','threadId','ChatInteraction','ContactId','interaction','firstName','messageId','autoclose','applications','push','close','*,*,*,*','AttachmentId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','difference','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','mimetype','server','files','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','internal','color','tag','getProactiveActions','virtual','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','origin','3.7.0','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','User','mustache','path','ejs','lodash','querystring','ioredis','jayson/promise','url','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','limit','undefined','count','set','json','update','get','ChatWebsites','stack','name','send','user-agent-parser','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','ChatWebsiteId','findOne','Disposition','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','systemAvatar','download','chat','from','From\x20is\x20mandatory','isEmpty'];(function(_0x350732,_0x499627){var _0x2e7291=function(_0x18feab){while(--_0x18feab){_0x350732['push'](_0x350732['shift']());}};_0x2e7291(++_0x499627);}(_0x5aec,0x96));var _0xc5ae=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x5aec[_0x209941];return _0x1e8729;};'use strict';var Mustache=require(_0xc5ae('0x0'));var util=require('util');var path=require(_0xc5ae('0x1'));var ejs=require(_0xc5ae('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc5ae('0x3'));var querystring=require(_0xc5ae('0x4'));var htmlToText=require('html-to-text');var Redis=require(_0xc5ae('0x5'));var jayson=require(_0xc5ae('0x6'));var url=require(_0xc5ae('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xc5ae('0x8'))(_0xc5ae('0x9'));var config=require(_0xc5ae('0xa'));var APIBadRequestError=require(_0xc5ae('0xb'))['APIBadRequestError'];var APINotFoundError=require(_0xc5ae('0xb'))[_0xc5ae('0xc')];var APIOutOfIntervalError=require(_0xc5ae('0xb'))[_0xc5ae('0xd')];var APIHandleError=require('../../errors/api')[_0xc5ae('0xe')];var db=require('../../mysqldb')['db'];config[_0xc5ae('0xf')]=_[_0xc5ae('0x10')](config[_0xc5ae('0xf')],{'host':_0xc5ae('0x11'),'port':0x18eb});var socket=require(_0xc5ae('0x12'))(new Redis(config[_0xc5ae('0xf')]));require(_0xc5ae('0x13'))[_0xc5ae('0x14')](socket);var client=jayson[_0xc5ae('0x15')][_0xc5ae('0x16')]({'port':0x232c});var client9002=jayson[_0xc5ae('0x15')][_0xc5ae('0x16')]({'port':0x232a});var client9003=jayson[_0xc5ae('0x15')][_0xc5ae('0x16')]({'port':0x232b});var client9001=jayson['client'][_0xc5ae('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x1f5015,_0x387058,_0x1dbb73,_0x4f74fa){return new Promise(function(_0x3a6caf,_0x125eeb){var _0x138d6a=_0x4f74fa||client;return _0x138d6a[_0xc5ae('0x17')](_0x1f5015,_0x1dbb73)[_0xc5ae('0x18')](function(_0x2baedb){logger[_0xc5ae('0x19')](_0xc5ae('0x1a'),_0x387058,_0xc5ae('0x1b'));logger[_0xc5ae('0x1c')](_0xc5ae('0x1d'),_0x387058,_0xc5ae('0x1b'),JSON[_0xc5ae('0x1e')](_0x2baedb));if(_0x2baedb[_0xc5ae('0x1f')]){if(_0x2baedb[_0xc5ae('0x1f')]['code']===0x1f4){logger[_0xc5ae('0x1f')](_0xc5ae('0x1a'),_0x387058,_0x2baedb[_0xc5ae('0x1f')][_0xc5ae('0x20')]);return _0x125eeb(_0x2baedb[_0xc5ae('0x1f')][_0xc5ae('0x20')]);}logger['error'](_0xc5ae('0x1a'),_0x387058,_0x2baedb['error']['message']);return _0x3a6caf(_0x2baedb[_0xc5ae('0x1f')][_0xc5ae('0x20')]);}else{logger[_0xc5ae('0x19')](_0xc5ae('0x1a'),_0x387058,_0xc5ae('0x1b'));_0x3a6caf(_0x2baedb[_0xc5ae('0x21')]['message']);}})['catch'](function(_0x2a2bd9){logger[_0xc5ae('0x1f')](_0xc5ae('0x1a'),_0x387058,_0x2a2bd9);_0x125eeb(_0x2a2bd9);});});}function respondWithStatusCode(_0x30956b,_0x1b4c4c){_0x1b4c4c=_0x1b4c4c||0xcc;return function(_0x35903f){if(_0x35903f){return _0x30956b[_0xc5ae('0x22')](_0x1b4c4c);}return _0x30956b[_0xc5ae('0x23')](_0x1b4c4c)[_0xc5ae('0x24')]();};}function respondWithResult(_0x24910b,_0x3da656){_0x3da656=_0x3da656||0xc8;return function(_0x5bd479){if(_0x5bd479){return _0x24910b['status'](_0x3da656)['json'](_0x5bd479);}};}function respondWithFilteredResult(_0x35487e,_0x4a83a7){return function(_0x41c6cf){if(_0x41c6cf){var _0x1cdb55=typeof _0x4a83a7[_0xc5ae('0x25')]==='undefined'&&typeof _0x4a83a7[_0xc5ae('0x26')]===_0xc5ae('0x27');var _0x6ed06f=_0x41c6cf['count'];var _0x19a169=_0x1cdb55?0x0:_0x4a83a7[_0xc5ae('0x25')];var _0x55ce0d=_0x1cdb55?_0x41c6cf[_0xc5ae('0x28')]:_0x4a83a7[_0xc5ae('0x25')]+_0x4a83a7['limit'];var _0x30877b;if(_0x55ce0d>=_0x6ed06f){_0x55ce0d=_0x6ed06f;_0x30877b=0xc8;}else{_0x30877b=0xce;}_0x35487e[_0xc5ae('0x23')](_0x30877b);return _0x35487e[_0xc5ae('0x29')]('Content-Range',_0x19a169+'-'+_0x55ce0d+'/'+_0x6ed06f)[_0xc5ae('0x2a')](_0x41c6cf);}return null;};}function saveUpdates(_0x5a7da1){return function(_0x5205c7){if(_0x5205c7){return _0x5205c7[_0xc5ae('0x2b')](_0x5a7da1)[_0xc5ae('0x18')](function(_0x4dcc9f){return _0x4dcc9f;});}return null;};}function removeEntity(_0x39e902){return function(_0x3ca153){if(_0x3ca153){return _0x3ca153['destroy']()[_0xc5ae('0x18')](function(){var _0x451323=_0x3ca153[_0xc5ae('0x2c')]({'plain':!![]});var _0x254b40=_0xc5ae('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x254b40,'resourceId':_0x451323['id']}})[_0xc5ae('0x18')](function(){return _0x3ca153;});})[_0xc5ae('0x18')](function(){_0x39e902[_0xc5ae('0x23')](0xcc)[_0xc5ae('0x24')]();});}};}function handleEntityNotFound(_0x33947b){return function(_0x2e2931){if(!_0x2e2931){_0x33947b[_0xc5ae('0x22')](0x194);}return _0x2e2931;};}function handleError(_0x502028,_0x381b72){_0x381b72=_0x381b72||0x1f4;return function(_0x46e9b0){logger[_0xc5ae('0x1f')](_0x46e9b0[_0xc5ae('0x2e')]);if(_0x46e9b0[_0xc5ae('0x2f')]){delete _0x46e9b0[_0xc5ae('0x2f')];}_0x502028[_0xc5ae('0x23')](_0x381b72)[_0xc5ae('0x30')](_0x46e9b0);};}function createInteractionObject(_0x98ddf1,_0x35d347,_0x477910,_0x119405){var _0x1459d3=require(_0xc5ae('0x31'));var _0x11ecbe=new _0x1459d3();var _0x217dea=_0x11ecbe['setUA'](_0x477910['user-agent'])['getResult']();var _0x72cd0f=_0x35d347[_0xc5ae('0x32')];if(_0x477910[_0xc5ae('0x33')]){_0x72cd0f=_0x477910[_0xc5ae('0x33')];}else if(_0x477910[_0xc5ae('0x34')]){_0x72cd0f=_[_0xc5ae('0x35')](_0x477910[_0xc5ae('0x34')][_0xc5ae('0x36')](','));}return{'ContactId':_0x119405['id'],'ChatWebsiteId':_0x98ddf1,'from':(_0x119405['firstName']||'')+'\x20'+(_0x119405[_0xc5ae('0x37')]||''),'customerIp':_0x72cd0f,'customerPort':_0x477910[_0xc5ae('0x38')]?_0x477910[_0xc5ae('0x38')]:null,'referer':_0x35d347[_0xc5ae('0x39')],'browserName':_0x217dea['browser'][_0xc5ae('0x2f')]&&_0x217dea[_0xc5ae('0x3a')][_0xc5ae('0x3b')]?util[_0xc5ae('0x3c')](_0xc5ae('0x3d'),_0x217dea[_0xc5ae('0x3a')][_0xc5ae('0x2f')],_0x217dea[_0xc5ae('0x3a')][_0xc5ae('0x3b')]):_0xc5ae('0x3e'),'browserVersion':_0x217dea[_0xc5ae('0x3a')][_0xc5ae('0x3b')]||_0xc5ae('0x3e'),'osName':util[_0xc5ae('0x3c')]('%s\x20%s',_0x217dea['os'][_0xc5ae('0x2f')],_0x217dea['os']['version']),'osVersion':_0x217dea['os'][_0xc5ae('0x3b')],'deviceModel':_0x217dea[_0xc5ae('0x3f')][_0xc5ae('0x40')]&&_0x217dea[_0xc5ae('0x3f')][_0xc5ae('0x41')]?util[_0xc5ae('0x3c')](_0xc5ae('0x42'),_0x217dea[_0xc5ae('0x3f')][_0xc5ae('0x40')],_0x217dea[_0xc5ae('0x3f')][_0xc5ae('0x41')],_0x217dea[_0xc5ae('0x3f')][_0xc5ae('0x43')]):null,'deviceVendor':_0x217dea[_0xc5ae('0x3f')][_0xc5ae('0x41')],'deviceType':_0x217dea[_0xc5ae('0x3f')][_0xc5ae('0x43')],'formData':JSON['stringify'](_0x35d347)};}exports[_0xc5ae('0x44')]=function(_0x4ce5b4,_0x1fc1d3){var _0x51f20c={'include':[{'model':db[_0xc5ae('0x45')],'as':_0xc5ae('0x46')}]},_0x1227f0={},_0xd347f4={'count':0x0,'rows':[]};var _0x5550f5=_[_0xc5ae('0x47')](db[_0xc5ae('0x48')][_0xc5ae('0x49')],function(_0x591de0){return{'name':_0x591de0['fieldName'],'type':_0x591de0['type']['key']};});_0x1227f0[_0xc5ae('0x40')]=_[_0xc5ae('0x47')](_0x5550f5,'name');_0x1227f0[_0xc5ae('0x4a')]=_[_0xc5ae('0x4b')](_0x4ce5b4[_0xc5ae('0x4a')]);_0x1227f0[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x1227f0[_0xc5ae('0x40')],_0x1227f0['query']);_0x51f20c['attributes']=_['intersection'](_0x1227f0[_0xc5ae('0x40')],qs[_0xc5ae('0x4e')](_0x4ce5b4[_0xc5ae('0x4a')][_0xc5ae('0x4e')]));_0x51f20c[_0xc5ae('0x4f')]=_0x51f20c[_0xc5ae('0x4f')]['length']?_0x51f20c[_0xc5ae('0x4f')]:_0x1227f0[_0xc5ae('0x40')];if(!_0x4ce5b4['query'][_0xc5ae('0x50')](_0xc5ae('0x51'))){_0x51f20c[_0xc5ae('0x26')]=qs[_0xc5ae('0x26')](_0x4ce5b4[_0xc5ae('0x4a')]['limit']);_0x51f20c[_0xc5ae('0x25')]=qs['offset'](_0x4ce5b4[_0xc5ae('0x4a')][_0xc5ae('0x25')]);}_0x51f20c['order']=qs[_0xc5ae('0x52')](_0x4ce5b4[_0xc5ae('0x4a')][_0xc5ae('0x52')]);_0x51f20c[_0xc5ae('0x53')]=qs[_0xc5ae('0x4c')](_[_0xc5ae('0x54')](_0x4ce5b4['query'],_0x1227f0[_0xc5ae('0x4c')]),_0x5550f5);if(_0x4ce5b4[_0xc5ae('0x4a')][_0xc5ae('0x55')]){_0x51f20c[_0xc5ae('0x53')]=_[_0xc5ae('0x56')](_0x51f20c[_0xc5ae('0x53')],{'$or':_[_0xc5ae('0x47')](_0x5550f5,function(_0x339f0a){if(_0x339f0a['type']!=='VIRTUAL'){var _0x2c0a4e={};_0x2c0a4e[_0x339f0a[_0xc5ae('0x2f')]]={'$like':'%'+_0x4ce5b4[_0xc5ae('0x4a')]['filter']+'%'};return _0x2c0a4e;}})});}_0x51f20c=_[_0xc5ae('0x56')]({},_0x51f20c,_0x4ce5b4['options']);var _0x5ec48d={'where':_0x51f20c[_0xc5ae('0x53')]};return db[_0xc5ae('0x48')][_0xc5ae('0x28')](_0x5ec48d)['then'](function(_0x568f58){_0xd347f4['count']=_0x568f58;if(_0x4ce5b4[_0xc5ae('0x4a')][_0xc5ae('0x57')]){_0x51f20c[_0xc5ae('0x58')]=[{'all':!![]}];}return db[_0xc5ae('0x48')][_0xc5ae('0x59')](_0x51f20c);})[_0xc5ae('0x18')](function(_0x40f589){_0xd347f4[_0xc5ae('0x5a')]=_0x40f589;return _0xd347f4;})[_0xc5ae('0x18')](respondWithFilteredResult(_0x1fc1d3,_0x51f20c))[_0xc5ae('0x5b')](handleError(_0x1fc1d3,null));};exports[_0xc5ae('0x5c')]=function(_0x44cb74,_0x5ec1c3){var _0x33ab2f={'raw':![],'where':{'id':_0x44cb74[_0xc5ae('0x5d')]['id']},'include':[{'model':db[_0xc5ae('0x45')],'as':_0xc5ae('0x46')}]},_0x1ed450={};_0x1ed450[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db[_0xc5ae('0x48')][_0xc5ae('0x49')]);_0x1ed450[_0xc5ae('0x4a')]=_[_0xc5ae('0x4b')](_0x44cb74[_0xc5ae('0x4a')]);_0x1ed450[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x1ed450[_0xc5ae('0x40')],_0x1ed450[_0xc5ae('0x4a')]);_0x33ab2f[_0xc5ae('0x4f')]=_[_0xc5ae('0x4d')](_0x1ed450[_0xc5ae('0x40')],qs[_0xc5ae('0x4e')](_0x44cb74[_0xc5ae('0x4a')][_0xc5ae('0x4e')]));_0x33ab2f[_0xc5ae('0x4f')]=_0x33ab2f[_0xc5ae('0x4f')][_0xc5ae('0x5e')]?_0x33ab2f['attributes']:_0x1ed450['model'];if(_0x44cb74[_0xc5ae('0x4a')][_0xc5ae('0x57')]){_0x33ab2f[_0xc5ae('0x58')]=[{'all':!![]}];}_0x33ab2f=_[_0xc5ae('0x56')]({},_0x33ab2f,_0x44cb74[_0xc5ae('0x5f')]);return db['ChatWebsite']['find'](_0x33ab2f)[_0xc5ae('0x18')](handleEntityNotFound(_0x5ec1c3,null))['then'](respondWithResult(_0x5ec1c3,null))[_0xc5ae('0x5b')](handleError(_0x5ec1c3,null));};exports[_0xc5ae('0x60')]=function(_0x45f80d,_0xa3a2ba){return db[_0xc5ae('0x48')][_0xc5ae('0x60')](_0x45f80d['body'],{})['then'](function(_0x3eaa97){var _0xb44aaf=_0x45f80d[_0xc5ae('0x61')][_0xc5ae('0x2c')]({'plain':!![]});if(!_0xb44aaf)throw new Error(_0xc5ae('0x62'));if(_0xb44aaf[_0xc5ae('0x63')]===_0xc5ae('0x61')){var _0x4b7f89=_0x3eaa97[_0xc5ae('0x2c')]({'plain':!![]});var _0x102026=_0xc5ae('0x2d');return db['UserProfileSection'][_0xc5ae('0x64')]({'where':{'name':_0x102026,'userProfileId':_0xb44aaf[_0xc5ae('0x65')]},'raw':!![]})['then'](function(_0x25bb94){if(_0x25bb94&&_0x25bb94[_0xc5ae('0x66')]===0x0){return db['UserProfileResource'][_0xc5ae('0x60')]({'name':_0x4b7f89[_0xc5ae('0x2f')],'resourceId':_0x4b7f89['id'],'type':_0x25bb94[_0xc5ae('0x2f')],'sectionId':_0x25bb94['id']},{})[_0xc5ae('0x18')](function(){return _0x3eaa97;});}else{return _0x3eaa97;}})[_0xc5ae('0x5b')](function(_0x356a88){logger['error'](_0xc5ae('0x67'),_0x356a88);throw _0x356a88;});}return _0x3eaa97;})[_0xc5ae('0x18')](respondWithResult(_0xa3a2ba,0xc9))['catch'](handleError(_0xa3a2ba,null));};exports[_0xc5ae('0x2b')]=function(_0x13423e,_0x52ca25){if(_0x13423e[_0xc5ae('0x68')]['id']){delete _0x13423e[_0xc5ae('0x68')]['id'];}return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x13423e[_0xc5ae('0x5d')]['id']},'include':[{'model':db[_0xc5ae('0x45')],'as':_0xc5ae('0x46')}]})[_0xc5ae('0x18')](handleEntityNotFound(_0x52ca25,null))['then'](saveUpdates(_0x13423e['body'],null))['then'](respondWithResult(_0x52ca25,null))[_0xc5ae('0x5b')](handleError(_0x52ca25,null));};exports[_0xc5ae('0x69')]=function(_0x205da7,_0x145ae6){return db['ChatWebsite'][_0xc5ae('0x64')]({'where':{'id':_0x205da7['params']['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x145ae6,null))[_0xc5ae('0x18')](removeEntity(_0x145ae6,null))['catch'](handleError(_0x145ae6,null));};exports[_0xc5ae('0x6a')]=function(_0x24329e,_0x2ff0db){return db['ChatWebsite'][_0xc5ae('0x6a')]()[_0xc5ae('0x18')](respondWithResult(_0x2ff0db,null))[_0xc5ae('0x5b')](handleError(_0x2ff0db,null));};exports[_0xc5ae('0x6b')]=function(_0x41e23b,_0x1e0bf1){if(_0x41e23b[_0xc5ae('0x68')]['id']){delete _0x41e23b[_0xc5ae('0x68')]['id'];}return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x41e23b['params']['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x1e0bf1,null))['then'](function(_0x2f4ea2){if(_0x2f4ea2){_0x41e23b[_0xc5ae('0x68')][_0xc5ae('0x6c')]=_0x2f4ea2['id'];return db['Disposition'][_0xc5ae('0x60')](_0x41e23b[_0xc5ae('0x68')]);}})['then'](respondWithResult(_0x1e0bf1,null))[_0xc5ae('0x5b')](handleError(_0x1e0bf1,null));};exports['getDispositions']=function(_0x11c01c,_0x236fdb){var _0x5323f4={'raw':![],'where':{}};var _0x59329f={};var _0x5099e8={'count':0x0,'rows':[]};return db[_0xc5ae('0x48')][_0xc5ae('0x6d')]({'where':{'id':_0x11c01c[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x236fdb,null))[_0xc5ae('0x18')](function(_0x4ecb5a){if(_0x4ecb5a){_0x59329f[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db[_0xc5ae('0x6e')][_0xc5ae('0x49')]);_0x59329f['query']=_['keys'](_0x11c01c[_0xc5ae('0x4a')]);_0x59329f[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x59329f[_0xc5ae('0x40')],_0x59329f[_0xc5ae('0x4a')]);_0x5323f4['attributes']=_[_0xc5ae('0x4d')](_0x59329f[_0xc5ae('0x40')],qs[_0xc5ae('0x4e')](_0x11c01c['query'][_0xc5ae('0x4e')]));_0x5323f4['attributes']=_0x5323f4['attributes'][_0xc5ae('0x5e')]?_0x5323f4[_0xc5ae('0x4f')]:_0x59329f['model'];if(!_0x11c01c[_0xc5ae('0x4a')][_0xc5ae('0x50')]('nolimit')){_0x5323f4[_0xc5ae('0x26')]=qs[_0xc5ae('0x26')](_0x11c01c[_0xc5ae('0x4a')]['limit']);_0x5323f4[_0xc5ae('0x25')]=qs[_0xc5ae('0x25')](_0x11c01c['query'][_0xc5ae('0x25')]);}_0x5323f4[_0xc5ae('0x6f')]=qs[_0xc5ae('0x52')](_0x11c01c[_0xc5ae('0x4a')]['sort']);_0x5323f4[_0xc5ae('0x53')]=qs[_0xc5ae('0x4c')](_[_0xc5ae('0x54')](_0x11c01c[_0xc5ae('0x4a')],_0x59329f['filters']));_0x5323f4[_0xc5ae('0x53')]['ChatWebsiteId']=_0x4ecb5a['id'];if(_0x11c01c[_0xc5ae('0x4a')][_0xc5ae('0x55')]){_0x5323f4[_0xc5ae('0x53')]=_[_0xc5ae('0x56')](_0x5323f4['where'],{'$or':_['map'](_0x5323f4[_0xc5ae('0x4f')],function(_0x254a4b){var _0x4d496a={};_0x4d496a[_0x254a4b]={'$like':'%'+_0x11c01c[_0xc5ae('0x4a')][_0xc5ae('0x55')]+'%'};return _0x4d496a;})});}_0x5323f4=_[_0xc5ae('0x56')]({},_0x5323f4,_0x11c01c['options']);return db['Disposition'][_0xc5ae('0x28')]({'where':_0x5323f4[_0xc5ae('0x53')]})['then'](function(_0x59d3ac){_0x5099e8[_0xc5ae('0x28')]=_0x59d3ac;if(_0x11c01c[_0xc5ae('0x4a')][_0xc5ae('0x57')]){_0x5323f4[_0xc5ae('0x58')]=[{'all':!![]}];}return db[_0xc5ae('0x6e')][_0xc5ae('0x59')](_0x5323f4);})[_0xc5ae('0x18')](function(_0x238c9f){_0x5099e8['rows']=_0x238c9f;return _0x5099e8;});}})['then'](respondWithFilteredResult(_0x236fdb,_0x5323f4))[_0xc5ae('0x5b')](handleError(_0x236fdb,null));};exports[_0xc5ae('0x70')]=function(_0x3c9a71,_0xa1530c){return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x3c9a71[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0xa1530c,null))[_0xc5ae('0x18')](function(_0xb47988){if(_0xb47988){return _0xb47988[_0xc5ae('0x70')](_0x3c9a71[_0xc5ae('0x4a')]['ids']);}})[_0xc5ae('0x18')](respondWithStatusCode(_0xa1530c,null))[_0xc5ae('0x5b')](handleError(_0xa1530c,null));};exports[_0xc5ae('0x71')]=function(_0x2a5781,_0x360572){if(_0x2a5781[_0xc5ae('0x68')]['id']){delete _0x2a5781[_0xc5ae('0x68')]['id'];}return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x2a5781[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x360572,null))[_0xc5ae('0x18')](function(_0x2a122b){if(_0x2a122b){_0x2a5781['body'][_0xc5ae('0x6c')]=_0x2a122b['id'];return db[_0xc5ae('0x72')][_0xc5ae('0x60')](_0x2a5781['body']);}})[_0xc5ae('0x18')](respondWithResult(_0x360572,null))[_0xc5ae('0x5b')](handleError(_0x360572,null));};exports[_0xc5ae('0x73')]=function(_0x528a64,_0x54376f){var _0x483ff5={'raw':![],'where':{}};var _0x32c3ed={};var _0x55c3ea={'count':0x0,'rows':[]};return db[_0xc5ae('0x48')]['findOne']({'where':{'id':_0x528a64['params']['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x54376f,null))[_0xc5ae('0x18')](function(_0x4f41e2){if(_0x4f41e2){_0x32c3ed[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db['CannedAnswer'][_0xc5ae('0x49')]);_0x32c3ed[_0xc5ae('0x4a')]=_['keys'](_0x528a64[_0xc5ae('0x4a')]);_0x32c3ed['filters']=_[_0xc5ae('0x4d')](_0x32c3ed[_0xc5ae('0x40')],_0x32c3ed[_0xc5ae('0x4a')]);_0x483ff5[_0xc5ae('0x4f')]=_['intersection'](_0x32c3ed['model'],qs[_0xc5ae('0x4e')](_0x528a64[_0xc5ae('0x4a')][_0xc5ae('0x4e')]));_0x483ff5['attributes']=_0x483ff5[_0xc5ae('0x4f')]['length']?_0x483ff5[_0xc5ae('0x4f')]:_0x32c3ed['model'];if(!_0x528a64[_0xc5ae('0x4a')][_0xc5ae('0x50')]('nolimit')){_0x483ff5[_0xc5ae('0x26')]=qs[_0xc5ae('0x26')](_0x528a64['query'][_0xc5ae('0x26')]);_0x483ff5['offset']=qs['offset'](_0x528a64[_0xc5ae('0x4a')]['offset']);}_0x483ff5[_0xc5ae('0x6f')]=qs[_0xc5ae('0x52')](_0x528a64[_0xc5ae('0x4a')][_0xc5ae('0x52')]);_0x483ff5[_0xc5ae('0x53')]=qs['filters'](_['pick'](_0x528a64['query'],_0x32c3ed[_0xc5ae('0x4c')]));_0x483ff5[_0xc5ae('0x53')][_0xc5ae('0x6c')]=_0x4f41e2['id'];if(_0x528a64[_0xc5ae('0x4a')]['filter']){_0x483ff5[_0xc5ae('0x53')]=_[_0xc5ae('0x56')](_0x483ff5[_0xc5ae('0x53')],{'$or':_[_0xc5ae('0x47')](_0x483ff5['attributes'],function(_0x426ca7){var _0x27e658={};_0x27e658[_0x426ca7]={'$like':'%'+_0x528a64['query'][_0xc5ae('0x55')]+'%'};return _0x27e658;})});}_0x483ff5=_[_0xc5ae('0x56')]({},_0x483ff5,_0x528a64[_0xc5ae('0x5f')]);return db[_0xc5ae('0x72')][_0xc5ae('0x28')]({'where':_0x483ff5[_0xc5ae('0x53')]})[_0xc5ae('0x18')](function(_0x47fe99){_0x55c3ea['count']=_0x47fe99;if(_0x528a64[_0xc5ae('0x4a')][_0xc5ae('0x57')]){_0x483ff5['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xc5ae('0x59')](_0x483ff5);})[_0xc5ae('0x18')](function(_0x4a09b1){_0x55c3ea[_0xc5ae('0x5a')]=_0x4a09b1;return _0x55c3ea;});}})[_0xc5ae('0x18')](respondWithFilteredResult(_0x54376f,_0x483ff5))[_0xc5ae('0x5b')](handleError(_0x54376f,null));};exports[_0xc5ae('0x74')]=function(_0x22875a,_0x344406){return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x22875a[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x344406,null))[_0xc5ae('0x18')](function(_0x20a33f){if(_0x20a33f){return _0x20a33f['removeAnswers'](_0x22875a[_0xc5ae('0x4a')][_0xc5ae('0x75')]);}})[_0xc5ae('0x18')](respondWithStatusCode(_0x344406,null))[_0xc5ae('0x5b')](handleError(_0x344406,null));};exports[_0xc5ae('0x76')]=function(_0x1fab46,_0x3eafbf){_0x1fab46[_0xc5ae('0x68')]['sitepic']=_0x1fab46[_0xc5ae('0x77')]['filename'];return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x1fab46[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x3eafbf,null))[_0xc5ae('0x18')](saveUpdates(_0x1fab46['body'],null))[_0xc5ae('0x18')](respondWithResult(_0x3eafbf,null))['catch'](handleError(_0x3eafbf,null));};exports[_0xc5ae('0x78')]=function(_0x167128,_0x5c7354){_0x167128['body'][_0xc5ae('0x79')]=_0x167128['file'][_0xc5ae('0x7a')];return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x167128[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x5c7354,null))[_0xc5ae('0x18')](saveUpdates(_0x167128[_0xc5ae('0x68')],null))[_0xc5ae('0x18')](respondWithResult(_0x5c7354,null))[_0xc5ae('0x5b')](handleError(_0x5c7354,null));};exports[_0xc5ae('0x7b')]=function(_0x6b368a,_0x18a4a3){_0x6b368a['body'][_0xc5ae('0x7c')]=_0x6b368a[_0xc5ae('0x77')][_0xc5ae('0x7a')];return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x6b368a['params']['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x18a4a3,null))[_0xc5ae('0x18')](saveUpdates(_0x6b368a[_0xc5ae('0x68')],null))[_0xc5ae('0x18')](respondWithResult(_0x18a4a3,null))[_0xc5ae('0x5b')](handleError(_0x18a4a3,null));};exports['addSystemAvatar']=function(_0x324a62,_0x33b735){_0x324a62[_0xc5ae('0x68')]['systemAvatar']=_0x324a62['file'][_0xc5ae('0x7a')];return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x324a62[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x33b735,null))[_0xc5ae('0x18')](saveUpdates(_0x324a62[_0xc5ae('0x68')],null))[_0xc5ae('0x18')](respondWithResult(_0x33b735,null))[_0xc5ae('0x5b')](handleError(_0x33b735,null));};exports[_0xc5ae('0x7d')]=function(_0x326ad4,_0x3ceee1){var _0x10bf79=path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0x80'));var _0x59db14={'where':{'id':_0x326ad4[_0xc5ae('0x5d')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x25ede0=![];return require(_0xc5ae('0x81'))[_0xc5ae('0x82')]()['then'](function(_0x439046){if(_0x439046){_0x25ede0=_0x439046[_0xc5ae('0x83')];}})['then'](function(){return db['ChatWebsite']['find'](_0x59db14);})['then'](handleEntityNotFound(_0x3ceee1,null))[_0xc5ae('0x18')](function(_0x30e9e6){if(_0x30e9e6){if(!_[_0xc5ae('0x84')](_0x30e9e6[_0xc5ae('0x85')])){if(fs[_0xc5ae('0x86')](path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0x87'),_0x30e9e6[_0xc5ae('0x85')]))&&_0x25ede0){_0x10bf79=path[_0xc5ae('0x7e')](config['root'],_0xc5ae('0x87'),_0x30e9e6[_0xc5ae('0x85')]);}}return _0x3ceee1['download'](_0x10bf79);}})[_0xc5ae('0x5b')](handleError(_0x3ceee1,null));};exports[_0xc5ae('0x88')]=function(_0x4891d7,_0x422cc5){var _0x1e7579=path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],'server/files/images/avatars/default_avatar.png');var _0x3048cd={'where':{'id':_0x4891d7[_0xc5ae('0x5d')]['id']},'attributes':['id',_0xc5ae('0x79')],'raw':!![]};return db[_0xc5ae('0x48')][_0xc5ae('0x64')](_0x3048cd)[_0xc5ae('0x18')](handleEntityNotFound(_0x422cc5,null))[_0xc5ae('0x18')](function(_0x4069ac){if(_0x4069ac){if(!_[_0xc5ae('0x84')](_0x4069ac[_0xc5ae('0x79')])){if(fs[_0xc5ae('0x86')](path['join'](config[_0xc5ae('0x7f')],_0xc5ae('0x89'),_0x4069ac[_0xc5ae('0x79')]))){_0x1e7579=path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0x89'),_0x4069ac[_0xc5ae('0x79')]);}}return _0x422cc5['download'](_0x1e7579);}})['catch'](handleError(_0x422cc5,null));};exports[_0xc5ae('0x8a')]=function(_0x49e986,_0x52aaca){var _0x1e1d3f=path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0x8b'));var _0x5cb2b3={'where':{'id':_0x49e986[_0xc5ae('0x5d')]['id']},'attributes':['id',_0xc5ae('0x7c'),_0xc5ae('0x8c')],'raw':!![]};return db[_0xc5ae('0x48')]['find'](_0x5cb2b3)[_0xc5ae('0x18')](handleEntityNotFound(_0x52aaca,null))[_0xc5ae('0x18')](function(_0x28cab1){if(_0x28cab1){if(!_[_0xc5ae('0x84')](_0x28cab1[_0xc5ae('0x7c')])){if(fs[_0xc5ae('0x86')](path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0x89'),_0x28cab1[_0xc5ae('0x7c')]))&&_0x28cab1['showCustomerAvatar']){_0x1e1d3f=path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0x89'),_0x28cab1[_0xc5ae('0x7c')]);}}return _0x52aaca['download'](_0x1e1d3f);}})[_0xc5ae('0x5b')](handleError(_0x52aaca,null));};exports['getSystemAvatar']=function(_0x155435,_0x3c5fa9){var _0x43969b=path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],'server/files/images/avatars/system_avatar.png');var _0x1dcfd3={'where':{'id':_0x155435[_0xc5ae('0x5d')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xc5ae('0x48')][_0xc5ae('0x64')](_0x1dcfd3)[_0xc5ae('0x18')](handleEntityNotFound(_0x3c5fa9,null))['then'](function(_0x44c6ad){if(_0x44c6ad){if(!_['isNil'](_0x44c6ad['systemAvatar'])){if(fs[_0xc5ae('0x86')](path[_0xc5ae('0x7e')](config['root'],'server/files/images/avatars/',_0x44c6ad[_0xc5ae('0x8d')]))){_0x43969b=path[_0xc5ae('0x7e')](config['root'],'server/files/images/avatars/',_0x44c6ad[_0xc5ae('0x8d')]);}}return _0x3c5fa9[_0xc5ae('0x8e')](_0x43969b);}})[_0xc5ae('0x5b')](handleError(_0x3c5fa9,null));};exports['notify']=function(_0x338f87,_0x56bbe1){var _0x43f1ef={'body':_0x338f87[_0xc5ae('0x68')],'channel':_0xc5ae('0x8f')};var _0x52e373=[];var _0x34a1c7=[];var _0x2fa59c={};var _0xc19031=![];if(_0x338f87[_0xc5ae('0x68')]['id']){delete _0x338f87[_0xc5ae('0x68')]['id'];}if(_[_0xc5ae('0x84')](_0x338f87[_0xc5ae('0x68')][_0xc5ae('0x90')])){throw new APIBadRequestError(_0xc5ae('0x91'));}if(_[_0xc5ae('0x84')](_0x338f87[_0xc5ae('0x68')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xc5ae('0x92')](_0x338f87[_0xc5ae('0x68')][_0xc5ae('0x68')])){throw new APIBadRequestError(_0xc5ae('0x93'));}return db['CmContact'][_0xc5ae('0x6a')]()[_0xc5ae('0x18')](function(_0x20511a){if(!_0x20511a){throw new Error(_0xc5ae('0x94'));}_0x52e373=Object[_0xc5ae('0x4b')](_0x20511a)[_0xc5ae('0x55')](function(_0x18663c){return![_0xc5ae('0x95'),_0xc5ae('0x96')][_0xc5ae('0x97')](_0x18663c);});_0x34a1c7=Object[_0xc5ae('0x4b')](_0x20511a)[_0xc5ae('0x55')](function(_0xa4063b){return![_0xc5ae('0x95'),_0xc5ae('0x96'),_0xc5ae('0x98'),'ListId'][_0xc5ae('0x97')](_0xa4063b);});if(!_[_0xc5ae('0x97')](_0x34a1c7,_0x338f87[_0xc5ae('0x68')][_0xc5ae('0x99')])){throw new APIBadRequestError(_0xc5ae('0x9a')+_0x34a1c7['join'](',\x20'));}_0x2fa59c[_0x338f87[_0xc5ae('0x68')]['mapKey']]=_0x338f87['body']['from'];})['then'](function(){return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x338f87[_0xc5ae('0x5d')]['id']},'include':[{'model':db[_0xc5ae('0x9b')],'as':_0xc5ae('0x9c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2fa59c,'limit':0x1,'order':[[_0xc5ae('0x96'),_0xc5ae('0x9d')]]}]},{'model':db[_0xc5ae('0x9e')],'as':'Applications'},{'model':db[_0xc5ae('0x9f')],'as':_0xc5ae('0x9f'),'include':[{'model':db[_0xc5ae('0x9f')],'as':_0xc5ae('0xa0'),'attributes':['id',_0xc5ae('0xa1')],'raw':!![]}]}]});})[_0xc5ae('0x18')](function(_0x5db85c){if(!_0x5db85c){throw new APINotFoundError(util[_0xc5ae('0x3c')](_0xc5ae('0xa2'),_0x338f87[_0xc5ae('0x5d')]['id']));}var _0x3018d5=_0x5db85c[_0xc5ae('0x9f')];if(_0x3018d5){var _0x44b7b4=_0x5db85c[_0xc5ae('0xa3')]||undefined;return _0x3018d5[_0xc5ae('0xa4')](_0x44b7b4)[_0xc5ae('0x18')](function(_0x1f224d){if(!_0x1f224d){throw new APIOutOfIntervalError();}return _0x5db85c;});}else{return _0x5db85c;}})[_0xc5ae('0x18')](function(_0x56ff2a){if(!_0x56ff2a['List']){return;}_0x43f1ef[_0xc5ae('0xa5')]=_0x56ff2a;_0x43f1ef[_0xc5ae('0xa6')]=_0x56ff2a[_0xc5ae('0x9c')];_0x43f1ef['applications']=_[_0xc5ae('0xa7')](_0x56ff2a[_0xc5ae('0xa8')],['priority'],[_0xc5ae('0xa9')]);if(_0x43f1ef[_0xc5ae('0xa5')]['Applications']){delete _0x43f1ef[_0xc5ae('0xa5')]['Applications'];}if(_0x43f1ef[_0xc5ae('0xa5')][_0xc5ae('0x9c')]&&_0x43f1ef[_0xc5ae('0xa5')][_0xc5ae('0x9c')][_0xc5ae('0xaa')][_0xc5ae('0x5e')]){return _0x43f1ef['account'][_0xc5ae('0x9c')]['Contacts'][0x0];}var _0x19b7e2=_[_0xc5ae('0x10')](_0x338f87[_0xc5ae('0x68')],{'firstName':_0x338f87[_0xc5ae('0x68')][_0xc5ae('0x90')],'ListId':_0x56ff2a[_0xc5ae('0xab')]});_0x19b7e2[_0x338f87['body'][_0xc5ae('0x99')]]=_0x338f87['body'][_0xc5ae('0x90')];return db[_0xc5ae('0xac')][_0xc5ae('0x60')](_0x19b7e2,{'fields':_0x52e373,'raw':!![]});})[_0xc5ae('0x18')](function(_0x4d3b8c){_0x43f1ef[_0xc5ae('0xad')]=_0x4d3b8c;var _0x4eea36=createInteractionObject(_0x338f87[_0xc5ae('0x5d')]['id'],_0x338f87['body'],_0x338f87[_0xc5ae('0xae')],_0x4d3b8c);var _0x5aa2e2={'ChatWebsiteId':_0x338f87[_0xc5ae('0x5d')]['id'],'closed':![]};if(_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xaf')]){_0x5aa2e2[_0xc5ae('0xaf')]=_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xaf')];return db[_0xc5ae('0xb0')][_0xc5ae('0x64')]({'where':_0x5aa2e2})[_0xc5ae('0x18')](function(_0x3d8fc6){if(_0x3d8fc6){_0xc19031=!![];return _0x3d8fc6;}_0x4eea36[_0xc5ae('0xaf')]=_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xaf')];_0x4eea36['externalUrl']=_0x338f87[_0xc5ae('0x68')]['externalUrl'];return db[_0xc5ae('0xb0')]['create'](_0x4eea36);});}_0x5aa2e2[_0xc5ae('0xb1')]=_0x4d3b8c['id'];if(_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xb2')]&&_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xb2')]['id']){_0x5aa2e2['id']=_0x338f87[_0xc5ae('0x68')]['interaction']['id'];return db[_0xc5ae('0xb0')][_0xc5ae('0x64')]({'where':_0x5aa2e2})[_0xc5ae('0x18')](function(_0x5cfb89){if(_0x5cfb89){_0xc19031=!![];return _0x5cfb89;}return db[_0xc5ae('0xb0')]['create'](_0x4eea36);});}return db[_0xc5ae('0xb0')][_0xc5ae('0x60')](_0x4eea36);})['then'](function(_0x1c6181){if(!_0xc19031){return _0x1c6181;}var _0x56a4b={'from':(_0x43f1ef[_0xc5ae('0xad')][_0xc5ae('0xb3')]||'')+'\x20'+(_0x43f1ef[_0xc5ae('0xad')][_0xc5ae('0x37')]||'')};if(_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xaf')]&&_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xb4')]&&_0x338f87['body'][_0xc5ae('0xaf')]!=_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xb4')]){_0x56a4b['threadId']=_0x338f87['body'][_0xc5ae('0xb4')];}return _0x1c6181[_0xc5ae('0x2b')](_0x56a4b);})[_0xc5ae('0x18')](function(_0x184202){_0x43f1ef[_0xc5ae('0xb2')]=_0x184202[_0xc5ae('0x2c')]({'plain':!![]});_0x43f1ef[_0xc5ae('0xb2')]['created']=!_0xc19031;if(_0x43f1ef['interaction']['created']){if(_0x43f1ef[_0xc5ae('0xa5')][_0xc5ae('0xb5')]){_0x43f1ef[_0xc5ae('0xb6')][_0xc5ae('0xb7')]({'id':0x0,'priority':_0x43f1ef[_0xc5ae('0xb6')][_0xc5ae('0x5e')]+0x1,'app':_0xc5ae('0xb8'),'appdata':'unmanaged','interval':_0xc5ae('0xb9')});}}return db['ChatMessage'][_0xc5ae('0x60')]({'body':_0x338f87[_0xc5ae('0x68')][_0xc5ae('0x68')],'ChatWebsiteId':_0x338f87[_0xc5ae('0x5d')]['id'],'ChatInteractionId':_0x184202['id'],'direction':'in','ContactId':_0x43f1ef[_0xc5ae('0xad')]['id'],'AttachmentId':_0x338f87[_0xc5ae('0x68')][_0xc5ae('0xba')]});})[_0xc5ae('0x18')](function(_0x5c2b89){_0x43f1ef['message']=_0x5c2b89;if(!_0x43f1ef[_0xc5ae('0xb2')]['UserId']){return;}return db['User'][_0xc5ae('0x64')]({'attributes':['id',_0xc5ae('0x2f')],'where':{'id':_0x43f1ef[_0xc5ae('0xb2')]['UserId']}});})['then'](function(_0x321249){if(_0x321249){_0x43f1ef['applications'][_0xc5ae('0xbb')]({'id':0x0,'priority':0x0,'app':_0xc5ae('0xbc'),'appdata':_0x321249[_0xc5ae('0x2f')]+','+(_0x43f1ef[_0xc5ae('0xa5')][_0xc5ae('0xbd')]||0xa),'interval':_0xc5ae('0xb9')});_0x43f1ef[_0xc5ae('0xbe')]=!![];}if(!_0x43f1ef[_0xc5ae('0xb2')][_0xc5ae('0xbf')]){return;}return db['ChatQueue'][_0xc5ae('0x64')]({'attributes':['id',_0xc5ae('0x2f')],'where':{'id':_0x43f1ef[_0xc5ae('0xb2')]['queueId']}});})[_0xc5ae('0x18')](function(_0x4ee1af){if(_0x4ee1af){_0x43f1ef['applications'][_0xc5ae('0xbb')]({'id':0x0,'priority':0x1,'app':_0xc5ae('0xc0'),'appdata':_0x4ee1af[_0xc5ae('0x2f')]+','+(_0x43f1ef[_0xc5ae('0xa5')][_0xc5ae('0xc1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc5ae('0xc2'),_0xc5ae('0xc3'),_0x43f1ef);})[_0xc5ae('0x18')](function(_0x3a4b86){respondWithRpcPromise(_0xc5ae('0xc4'),_0xc5ae('0xc4'),{'event':'notify','message':_0x3a4b86},client9002);return _0x3a4b86;})[_0xc5ae('0x18')](respondWithResult(_0x56bbe1,null))['catch'](APIHandleError(_0x56bbe1));};exports[_0xc5ae('0xc5')]=function(_0x138999,_0x599b80){var _0x39281d,_0x5b5833,_0xb9dd2e;var _0x5957cc=[];var _0x37fc9a={};var _0x4d00ca=_0x138999['files']||[];var _0x37fff8=[];var _0x163b6c;return db[_0xc5ae('0xac')]['describe']()[_0xc5ae('0x18')](function(_0x239c53){if(!_0x239c53){throw new db['Sequelize'][(_0xc5ae('0xc6'))](_0xc5ae('0xc7'));}_0x5957cc=_[_0xc5ae('0xc8')](_[_0xc5ae('0x4b')](_0x239c53),[_0xc5ae('0x95'),_0xc5ae('0x96'),'CompanyId',_0xc5ae('0xab')]);if(_0x138999[_0xc5ae('0x68')]['id']){delete _0x138999[_0xc5ae('0x68')]['id'];}if(_[_0xc5ae('0x84')](_0x138999[_0xc5ae('0x68')]['from'])){throw _0x599b80[_0xc5ae('0x23')](0x1f4)[_0xc5ae('0x30')](new db[(_0xc5ae('0xc9'))][(_0xc5ae('0xc6'))](_0xc5ae('0xca')));}if(_[_0xc5ae('0x84')](_0x138999[_0xc5ae('0x68')][_0xc5ae('0x68')])||_0x138999['body'][_0xc5ae('0x68')]===''){throw _0x599b80[_0xc5ae('0x23')](0x1f4)[_0xc5ae('0x30')](new db[(_0xc5ae('0xc9'))][(_0xc5ae('0xc6'))](_0xc5ae('0xcb')));}if(_[_0xc5ae('0x84')](_0x138999['body'][_0xc5ae('0xcc')])){throw _0x599b80[_0xc5ae('0x23')](0x1f4)[_0xc5ae('0x30')](new db['Sequelize']['ValidationError'](_0xc5ae('0xcd')+_0x5957cc));}if(!_[_0xc5ae('0x97')](_0x5957cc,_0x138999['body'][_0xc5ae('0xcc')])){throw _0x599b80[_0xc5ae('0x23')](0x1f4)[_0xc5ae('0x30')](new db[(_0xc5ae('0xc9'))][(_0xc5ae('0xc6'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5957cc));}_0x37fc9a[_0x138999['body'][_0xc5ae('0xcc')]]=_0x138999[_0xc5ae('0x68')][_0xc5ae('0x90')];})['then'](function(){return db['ChatWebsite'][_0xc5ae('0x64')]({'where':{'id':_0x138999[_0xc5ae('0x5d')]['id']},'include':[{'model':db[_0xc5ae('0x9b')],'as':_0xc5ae('0x9c')},{'model':db['MailAccount'],'as':_0xc5ae('0xce')}]});})[_0xc5ae('0x18')](handleEntityNotFound(_0x599b80,null))[_0xc5ae('0x18')](function(_0x50bc17){if(_0x50bc17&&_0x50bc17[_0xc5ae('0x9c')]){_0x5b5833=_0x50bc17;var _0x12fa3b=_[_0xc5ae('0x10')](_0x138999[_0xc5ae('0x68')],{'firstName':_0x138999[_0xc5ae('0x68')][_0xc5ae('0x90')],'phone':_0x138999[_0xc5ae('0x68')]['from'],'ListId':_0x50bc17[_0xc5ae('0xab')]});_0x12fa3b[_0x138999['body'][_0xc5ae('0xcc')]]=_0x138999[_0xc5ae('0x68')][_0xc5ae('0x90')];return db[_0xc5ae('0xac')][_0xc5ae('0xcf')]({'where':_0x37fc9a,'defaults':_0x12fa3b});}})[_0xc5ae('0xd0')](function(_0x49a29c){if(_0x49a29c){_0xb9dd2e=_0x49a29c;var _0x4f7ca8=fs[_0xc5ae('0xd1')](path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0xd2')),_0xc5ae('0xd3'));var _0x4cbba0=ejs['render'](_0x4f7ca8,{'body':_[_0xc5ae('0xd4')](_0x138999[_0xc5ae('0x68')][_0xc5ae('0x68')]),'bodyTitle':_0x5b5833['offlineMessageBody']});return db[_0xc5ae('0xd5')][_0xc5ae('0x60')]({'body':_0x4cbba0,'plainBody':htmlToText['fromString'](_0x4cbba0),'ContactId':_0x49a29c['id'],'ChatWebsiteId':_0x5b5833['id']});}})[_0xc5ae('0x18')](function(_0x21fe48){_0x163b6c=_0x21fe48;if(_0x4d00ca[_0xc5ae('0x5e')]){var _0xb6603=_0x4d00ca[_0xc5ae('0x47')](function(_0x1eead4){return{'name':_0x1eead4['originalname'],'basename':_0x1eead4[_0xc5ae('0x7a')],'type':_0x1eead4[_0xc5ae('0xd6')],'ChatOfflineMessageId':_0x21fe48['id']};});_0x37fff8=_0xb6603[_0xc5ae('0x47')](_0x40b183=>{var _0x3b693c={'filename':_0x40b183[_0xc5ae('0x2f')],'path':path[_0xc5ae('0x7e')](config['root'],_0xc5ae('0xd7'),_0xc5ae('0xd8'),_0xc5ae('0xd9'),_0xc5ae('0xda'),_0x40b183[_0xc5ae('0xdb')])};return _0x3b693c;});if(!_0x5b5833['openNewInteraction']){return db[_0xc5ae('0xdc')][_0xc5ae('0xdd')](function(_0x5ae379){return db[_0xc5ae('0xde')][_0xc5ae('0xdf')](_0xb6603,{'transaction':_0x5ae379});});}}})[_0xc5ae('0x18')](function(){if(_0x163b6c){_0x39281d=_0x163b6c;return db[_0xc5ae('0xce')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xc5ae('0xe0')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xc5ae('0xe1')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xc5ae('0x18')](function(_0x43fdbc){if(_0x43fdbc&&_0x43fdbc[_0xc5ae('0xe2')]&&_0x5b5833[_0xc5ae('0xe3')]&&_0x5b5833['forwardOfflineAddress']){var _0xe144f2=_0x43fdbc[_0xc5ae('0xe4')]();return respondWithRpcPromise('SendMail',_0xc5ae('0xe5'),{'account':_0xe144f2,'message':{'from':util[_0xc5ae('0x3c')](_0xc5ae('0xe6'),_0x43fdbc[_0xc5ae('0x2f')],_0x43fdbc[_0xc5ae('0xe7')]||_0x43fdbc[_0xc5ae('0xe2')][_0xc5ae('0x61')]),'to':_0x5b5833['forwardOfflineAddress'],'subject':_0x5b5833[_0xc5ae('0xe8')],'html':_0x39281d['body'],'attachments':_0x37fff8}},client9003)[_0xc5ae('0x18')](function(){return _0x39281d;})[_0xc5ae('0x5b')](function(_0x50018b){logger[_0xc5ae('0x1f')](_0x50018b);});}})[_0xc5ae('0x18')](function(){if(_0x5b5833&&_0x5b5833[_0xc5ae('0xe9')]&&_0x5b5833[_0xc5ae('0xea')]){var _0x3f8f06=[];if(_0x4d00ca[_0xc5ae('0x5e')]){_0x3f8f06=_0x4d00ca[_0xc5ae('0x47')](function(_0x566e92){return{'name':_0x566e92[_0xc5ae('0xeb')],'basename':_0x566e92['filename'],'type':_0x566e92['mimetype'],'ChatOfflineMessageId':_0x163b6c['id']};});}var _0x39f0f9;if(!_[_0xc5ae('0x84')](_0x5b5833[_0xc5ae('0xec')])){var _0xa791a4=_[_0xc5ae('0x47')](_0x138999[_0xc5ae('0x68')],function(_0xfb0efb){return _0xfb0efb;});var _0x22ea87=_[_0xc5ae('0xed')](_0xa791a4)[0x0];var _0xb5b841=_[_0xc5ae('0xee')](_0x22ea87,function(_0x9f95e9){return _0x9f95e9;});_0x39f0f9=_0xb5b841[0x1][_0x5b5833['subjectOffline']];}var _0x49f421={'from':_0xb9dd2e[_0xc5ae('0xe7')],'firstName':_0xb9dd2e[_0xc5ae('0xb3')],'lastName':_0xb9dd2e['lastName'],'mapKey':'email','message':{'from':_0xb9dd2e['email'],'to':_0x5b5833[_0xc5ae('0xce')]['email'],'cc':'','subject':_[_0xc5ae('0x84')](_0x39f0f9)?_0x5b5833[_0xc5ae('0xe8')]:_0x39f0f9,'messageId':'','sentAt':new Date(),'attach':_0x3f8f06['length'],'attachments':_0x3f8f06,'originChannel':_0xc5ae('0xef'),'ChatWebsiteId':_0x5b5833['id'],'ChatOfflineMessageId':_0x39281d['id'],'originTo':_0x5b5833[_0xc5ae('0xce')][_0xc5ae('0xe7')]},'body':_0x39281d[_0xc5ae('0x68')]};var _0x14a783={'account':{'id':_0x5b5833[_0xc5ae('0xea')]},'body':_0x49f421,'log':_0xc5ae('0xf0')};return respondWithRpcPromise(_0xc5ae('0xf0'),_0xc5ae('0xf1'),_0x14a783,client9001)['then'](function(){return _0x39281d;})[_0xc5ae('0x5b')](function(_0x72c8d5){logger[_0xc5ae('0x1f')](_0x72c8d5);});}return;})[_0xc5ae('0x18')](function(){if(_0x39281d){return _0x39281d;}})[_0xc5ae('0x18')](respondWithResult(_0x599b80,null))[_0xc5ae('0x5b')](function(){for(var _0x1da7f2 of _0x4d00ca){var _0x408523=path['join'](config[_0xc5ae('0x7f')],_0xc5ae('0xd7'),_0xc5ae('0xd8'),_0xc5ae('0xd9'),_0xc5ae('0xda'),_0x1da7f2[_0xc5ae('0x7a')]);fs_extra[_0xc5ae('0xf2')](_0x408523)['catch'](function(_0x2f2df2){logger[_0xc5ae('0x1f')](_0xc5ae('0xf3'),_0x408523,_0x2f2df2);});}});};exports[_0xc5ae('0xf4')]=function(_0x4c7606,_0x5aaaef){return db['ChatInteraction']['find']({'where':{'id':_0x4c7606['params']['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x5aaaef,null))[_0xc5ae('0x18')](function(_0x2e0ed6){if(_0x2e0ed6){return _0x2e0ed6[_0xc5ae('0xf4')](_0x4c7606[_0xc5ae('0x68')][_0xc5ae('0x75')],_[_0xc5ae('0xf5')](_0x4c7606[_0xc5ae('0x68')],['ids','id'])||{});}})[_0xc5ae('0x18')](respondWithResult(_0x5aaaef,null))['catch'](handleError(_0x5aaaef,null));};exports['getInteractions']=function(_0x7717ef,_0x57aace){var _0xd59e3f={'raw':![],'where':{}};var _0x4e0318={};var _0x5aaa35={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc5ae('0x6d')]({'where':{'id':_0x7717ef[_0xc5ae('0x5d')]['id']}})['then'](handleEntityNotFound(_0x57aace,null))['then'](function(_0x575123){if(_0x575123){_0x4e0318[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db[_0xc5ae('0xb0')][_0xc5ae('0x49')]);_0x4e0318[_0xc5ae('0x4a')]=_['keys'](_0x7717ef[_0xc5ae('0x4a')]);_0x4e0318[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x4e0318[_0xc5ae('0x40')],_0x4e0318[_0xc5ae('0x4a')]);_0xd59e3f[_0xc5ae('0x4f')]=_['intersection'](_0x4e0318['model'],qs['fields'](_0x7717ef['query'][_0xc5ae('0x4e')]));_0xd59e3f[_0xc5ae('0x4f')]=_0xd59e3f['attributes']['length']?_0xd59e3f[_0xc5ae('0x4f')]:_0x4e0318[_0xc5ae('0x40')];if(!_0x7717ef[_0xc5ae('0x4a')]['hasOwnProperty'](_0xc5ae('0x51'))){_0xd59e3f[_0xc5ae('0x26')]=qs['limit'](_0x7717ef['query'][_0xc5ae('0x26')]);_0xd59e3f[_0xc5ae('0x25')]=qs[_0xc5ae('0x25')](_0x7717ef[_0xc5ae('0x4a')]['offset']);}_0xd59e3f['order']=qs[_0xc5ae('0x52')](_0x7717ef[_0xc5ae('0x4a')]['sort']);_0xd59e3f[_0xc5ae('0x53')]=qs[_0xc5ae('0x4c')](_['pick'](_0x7717ef[_0xc5ae('0x4a')],_0x4e0318['filters']));_0xd59e3f[_0xc5ae('0x53')][_0xc5ae('0x6c')]=_0x575123['id'];if(_0x7717ef[_0xc5ae('0x4a')]['filter']){_0xd59e3f[_0xc5ae('0x53')]=_[_0xc5ae('0x56')](_0xd59e3f[_0xc5ae('0x53')],{'$or':_[_0xc5ae('0x47')](_0xd59e3f[_0xc5ae('0x4f')],function(_0x4bd113){var _0x4cf18a={};_0x4cf18a[_0x4bd113]={'$like':'%'+_0x7717ef[_0xc5ae('0x4a')][_0xc5ae('0x55')]+'%'};return _0x4cf18a;})});}_0xd59e3f=_[_0xc5ae('0x56')]({},_0xd59e3f,_0x7717ef[_0xc5ae('0x5f')]);return db[_0xc5ae('0xb0')][_0xc5ae('0x28')]({'where':_0xd59e3f[_0xc5ae('0x53')]})[_0xc5ae('0x18')](function(_0x389f0c){_0x5aaa35['count']=_0x389f0c;if(_0x7717ef[_0xc5ae('0x4a')]['includeAll']){_0xd59e3f[_0xc5ae('0x58')]=[{'model':db[_0xc5ae('0xac')],'as':_0xc5ae('0xf6'),'required':![]},{'model':db['User'],'as':_0xc5ae('0xf7'),'attributes':[_0xc5ae('0x2f'),'fullname',_0xc5ae('0xf8')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xc5ae('0xf9')],'where':_0x7717ef[_0xc5ae('0x4a')][_0xc5ae('0xfa')]?{'id':_0x7717ef[_0xc5ae('0x4a')]['tag']}:undefined,'required':_0x7717ef[_0xc5ae('0x4a')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xc5ae('0x59')](_0xd59e3f);})[_0xc5ae('0x18')](function(_0xab4a64){_0x5aaa35[_0xc5ae('0x5a')]=_0xab4a64;return _0x5aaa35;});}})[_0xc5ae('0x18')](respondWithFilteredResult(_0x57aace,_0xd59e3f))[_0xc5ae('0x5b')](handleError(_0x57aace,null));};exports['getSnippet']=function(_0x58ae39,_0x2662bc){var _0x3556f5=0x0;var _0x1dff35=0x0;var _0x3f0c37=![];var _0x4e7ea1;var _0x239e0a;return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0x58ae39['params']['id']},'include':[{'model':db[_0xc5ae('0x9f')],'as':_0xc5ae('0x9f'),'include':[{'model':db[_0xc5ae('0x9f')],'as':_0xc5ae('0xa0'),'attributes':['id','interval']}]}]})[_0xc5ae('0x18')](handleEntityNotFound(_0x2662bc,null))[_0xc5ae('0x18')](function(_0x4d35eb){if(_0x4d35eb){_0x4e7ea1=_0x4d35eb;return _0x4d35eb[_0xc5ae('0xfb')]({'raw':!![]});}})['then'](function(_0x43f9d7){if(_0x4e7ea1){if(_0x43f9d7){_0x239e0a=_0x43f9d7;}}return require('../../config/license/util')[_0xc5ae('0x82')]();})[_0xc5ae('0x18')](function(_0x309d7a){if(_0x309d7a){_0x1dff35=_0x309d7a[_0xc5ae('0xfc')];_0x3f0c37=_0x309d7a[_0xc5ae('0x83')];}})[_0xc5ae('0x18')](function(){return db['ChatInteraction'][_0xc5ae('0x28')]({'where':{'closed':![]}});})[_0xc5ae('0x18')](function(_0x1908d6){_0x3556f5=_0x1908d6;if(_0x1dff35&&_0x1908d6>_0x1dff35){return db['License'][_0xc5ae('0x6d')]({'where':{'id':0x1}})['then'](function(_0x30bfe7){if(_0x30bfe7){_0x30bfe7[_0xc5ae('0xfd')](_0xc5ae('0xfe'));}});}})[_0xc5ae('0x18')](function(){var _0x21c487=_0x4e7ea1[_0xc5ae('0x9f')];var _0x2fdbc8=_0x4e7ea1[_0xc5ae('0xa3')]||undefined;return _0x21c487?_0x21c487[_0xc5ae('0xa4')](_0x2fdbc8):!![];})[_0xc5ae('0x18')](function(_0x119d15){var _0x46b983=fs['readFileSync'](path[_0xc5ae('0x7e')](config[_0xc5ae('0x7f')],_0xc5ae('0xff')),_0xc5ae('0xd3'));var _0x1ce2b6=new url[(_0xc5ae('0x100'))](_0x4e7ea1[_0xc5ae('0x101')])[_0xc5ae('0x102')];var _0x1b2663=_0xc5ae('0x103');var _0x40c83c=![];var _0x2849b1={'chatVersion':_0x1b2663,'chatWebsiteAddressOrigin':_0x1ce2b6,'remote':_0x4e7ea1[_0xc5ae('0x104')],'query':querystring['stringify'](_[_0xc5ae('0x56')](_0x4e7ea1[_0xc5ae('0x2c')]({'plain':!![]}),{'customerIp':_0x58ae39[_0xc5ae('0xae')]['x-forwarded-for']||_0x58ae39[_0xc5ae('0xae')][_0xc5ae('0x105')]||_0x58ae39[_0xc5ae('0x106')][_0xc5ae('0x107')]||_0x58ae39['ip'],'referer':_0x58ae39[_0xc5ae('0xae')][_0xc5ae('0x39')],'openedInteractions':_0x3556f5,'maxInteractions':_0x1dff35,'virtual':_0x3f0c37[_0xc5ae('0xfc')],'online':_0x119d15,'custom':_0x3f0c37}))[_0xc5ae('0x108')](/'/g,'\x5c\x27')};_0x2662bc[_0xc5ae('0x30')](ejs[_0xc5ae('0x109')](Mustache['render'](_0x46b983,_0x2849b1),{'proactiveActions':_0x239e0a,'alignment':_0x4e7ea1[_0xc5ae('0x10a')],'verticalAlignment':_0x4e7ea1[_0xc5ae('0x10b')],'div_color':_0x4e7ea1[_0xc5ae('0xf9')],'labelText':_0x4e7ea1['labelText'],'text_color':_0x4e7ea1[_0xc5ae('0x10c')],'text_button_color':_0x4e7ea1['textButtonColor'],'button_color':_0x4e7ea1[_0xc5ae('0x10d')],'background_color':_0x4e7ea1['backgroundColor'],'hideWhenOffline':_0x4e7ea1[_0xc5ae('0x10e')],'intervalId':_0x4e7ea1[_0xc5ae('0x10f')],'isDevelopment':_0x40c83c,'chatVersion':_0x1b2663}));})[_0xc5ae('0x5b')](handleError(_0x2662bc,null));};exports[_0xc5ae('0x110')]=function(_0xd2efe6,_0x372673){var _0x38abcc=_0xd2efe6[_0xc5ae('0x5d')]['id'];var _0x54e514=_0xd2efe6['body'];var _0xe77e1e=0xc8;var _0x14dbf5=null;return db[_0xc5ae('0xdc')][_0xc5ae('0xdd')]({'isolationLevel':db[_0xc5ae('0xdc')][_0xc5ae('0x111')][_0xc5ae('0x112')][_0xc5ae('0x113')]},function(_0x3db756){return db[_0xc5ae('0x48')]['findOne']({'where':{'id':_0x38abcc},'transaction':_0x3db756})[_0xc5ae('0x18')](function(_0x282758){if(_0x282758){return db[_0xc5ae('0x9e')]['destroy']({'where':{'ChatWebsiteId':_0x38abcc},'transaction':_0x3db756})[_0xc5ae('0x18')](function(){var _0xa48599=_[_0xc5ae('0x47')](_0x54e514,function(_0x284d6f){_0x284d6f[_0xc5ae('0x6c')]=_0x38abcc;return _0x284d6f;});return db['ChatApplication'][_0xc5ae('0xdf')](_0xa48599,{'transaction':_0x3db756});});}else{_0xe77e1e=0x194;_0x14dbf5=[];}});})['then'](function(){if(_0xe77e1e!==0x194){return db[_0xc5ae('0x9e')][_0xc5ae('0x114')]({'where':{'ChatWebsiteId':_0x38abcc},'order':_0xc5ae('0x115')})[_0xc5ae('0x18')](function(_0x106e1a){_0x14dbf5=_0x106e1a;});}})['catch'](function(_0x3bc411){_0xe77e1e=0x1f4;logger[_0xc5ae('0x1f')](_0x3bc411[_0xc5ae('0x2e')]);if(_0x3bc411[_0xc5ae('0x2f')]){delete _0x3bc411[_0xc5ae('0x2f')];}_0x14dbf5=_0x3bc411;})[_0xc5ae('0x116')](function(){if(_0x14dbf5===null){_0x372673[_0xc5ae('0x22')](_0xe77e1e);}else{if(_0xe77e1e===0x1f4){_0x372673['status'](_0xe77e1e)[_0xc5ae('0x30')](_0x14dbf5);}else{_0x372673[_0xc5ae('0x23')](_0xe77e1e)[_0xc5ae('0x2a')](_0x14dbf5);}}});};exports[_0xc5ae('0x117')]=function(_0x2d0d4f,_0x3dbb69){var _0x31c403={};var _0x5ce954={};var _0x4f0bd0;var _0x3a3735;return db['ChatWebsite'][_0xc5ae('0x6d')]({'where':{'id':_0x2d0d4f[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x3dbb69,null))[_0xc5ae('0x18')](function(_0x17e855){if(_0x17e855){_0x4f0bd0=_0x17e855;_0x5ce954[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db[_0xc5ae('0x9e')][_0xc5ae('0x49')]);_0x5ce954[_0xc5ae('0x4a')]=_[_0xc5ae('0x4b')](_0x2d0d4f[_0xc5ae('0x4a')]);_0x5ce954[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x5ce954[_0xc5ae('0x40')],_0x5ce954[_0xc5ae('0x4a')]);_0x31c403[_0xc5ae('0x4f')]=_[_0xc5ae('0x4d')](_0x5ce954[_0xc5ae('0x40')],qs[_0xc5ae('0x4e')](_0x2d0d4f[_0xc5ae('0x4a')]['fields']));_0x31c403[_0xc5ae('0x4f')]=_0x31c403[_0xc5ae('0x4f')][_0xc5ae('0x5e')]?_0x31c403['attributes']:_0x5ce954[_0xc5ae('0x40')];_0x31c403['order']=qs['sort'](_0x2d0d4f[_0xc5ae('0x4a')]['sort']);_0x31c403['where']=qs[_0xc5ae('0x4c')](_[_0xc5ae('0x54')](_0x2d0d4f[_0xc5ae('0x4a')],_0x5ce954[_0xc5ae('0x4c')]));if(_0x2d0d4f[_0xc5ae('0x4a')][_0xc5ae('0x55')]){_0x31c403['where']=_[_0xc5ae('0x56')](_0x31c403[_0xc5ae('0x53')],{'$or':_[_0xc5ae('0x47')](_0x31c403['attributes'],function(_0x499bf0){var _0x1fa9aa={};_0x1fa9aa[_0x499bf0]={'$like':'%'+_0x2d0d4f[_0xc5ae('0x4a')][_0xc5ae('0x55')]+'%'};return _0x1fa9aa;})});}_0x31c403=_[_0xc5ae('0x56')]({},_0x31c403,_0x2d0d4f[_0xc5ae('0x5f')]);return _0x4f0bd0[_0xc5ae('0x117')](_0x31c403);}})[_0xc5ae('0x18')](function(_0x210af2){if(_0x210af2){_0x3a3735=_0x210af2['length'];if(!_0x2d0d4f['query'][_0xc5ae('0x50')](_0xc5ae('0x51'))){_0x31c403['limit']=qs['limit'](_0x2d0d4f[_0xc5ae('0x4a')][_0xc5ae('0x26')]);_0x31c403[_0xc5ae('0x25')]=qs['offset'](_0x2d0d4f[_0xc5ae('0x4a')][_0xc5ae('0x25')]);}return _0x4f0bd0[_0xc5ae('0x117')](_0x31c403);}})['then'](function(_0x3b39f9){if(_0x3b39f9){return _0x3b39f9?{'count':_0x3a3735,'rows':_0x3b39f9}:null;}})['then'](respondWithResult(_0x3dbb69,null))[_0xc5ae('0x5b')](handleError(_0x3dbb69,null));};exports[_0xc5ae('0x118')]=function(_0x44f464,_0x3bf456){return db['chatProactiveAction']['find']({'where':{'id':_0x44f464[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x3bf456,null))[_0xc5ae('0x18')](function(_0x237de1){if(_0x237de1){return _0x237de1['addProactiveActions'](_0x44f464[_0xc5ae('0x68')][_0xc5ae('0x75')],_[_0xc5ae('0xf5')](_0x44f464[_0xc5ae('0x68')],['ids','id'])||{});}})[_0xc5ae('0x18')](respondWithResult(_0x3bf456,null))[_0xc5ae('0x5b')](handleError(_0x3bf456,null));};exports[_0xc5ae('0xfb')]=function(_0x298854,_0x4528d8){var _0x131d56={};var _0x5f0cd4={};var _0x49e9d1;var _0x502686;return db[_0xc5ae('0x48')][_0xc5ae('0x6d')]({'where':{'id':_0x298854[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x4528d8,null))['then'](function(_0x4b16a3){if(_0x4b16a3){_0x49e9d1=_0x4b16a3;_0x5f0cd4[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db[_0xc5ae('0x119')][_0xc5ae('0x49')]);_0x5f0cd4[_0xc5ae('0x4a')]=_['keys'](_0x298854['query']);_0x5f0cd4[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x5f0cd4[_0xc5ae('0x40')],_0x5f0cd4[_0xc5ae('0x4a')]);_0x131d56['attributes']=_[_0xc5ae('0x4d')](_0x5f0cd4[_0xc5ae('0x40')],qs['fields'](_0x298854[_0xc5ae('0x4a')]['fields']));_0x131d56[_0xc5ae('0x4f')]=_0x131d56[_0xc5ae('0x4f')][_0xc5ae('0x5e')]?_0x131d56[_0xc5ae('0x4f')]:_0x5f0cd4[_0xc5ae('0x40')];_0x131d56[_0xc5ae('0x6f')]=qs[_0xc5ae('0x52')](_0x298854[_0xc5ae('0x4a')]['sort']);_0x131d56[_0xc5ae('0x53')]=qs[_0xc5ae('0x4c')](_['pick'](_0x298854['query'],_0x5f0cd4[_0xc5ae('0x4c')]));if(_0x298854['query'][_0xc5ae('0x55')]){_0x131d56['where']=_[_0xc5ae('0x56')](_0x131d56[_0xc5ae('0x53')],{'$or':_['map'](_0x131d56[_0xc5ae('0x4f')],function(_0x3b8e2d){var _0x13cac0={};_0x13cac0[_0x3b8e2d]={'$like':'%'+_0x298854[_0xc5ae('0x4a')][_0xc5ae('0x55')]+'%'};return _0x13cac0;})});}_0x131d56=_[_0xc5ae('0x56')]({},_0x131d56,_0x298854[_0xc5ae('0x5f')]);return _0x49e9d1['getProactiveActions'](_0x131d56);}})[_0xc5ae('0x18')](function(_0x144fab){if(_0x144fab){_0x502686=_0x144fab[_0xc5ae('0x5e')];if(!_0x298854[_0xc5ae('0x4a')][_0xc5ae('0x50')](_0xc5ae('0x51'))){_0x131d56[_0xc5ae('0x26')]=qs[_0xc5ae('0x26')](_0x298854[_0xc5ae('0x4a')][_0xc5ae('0x26')]);_0x131d56[_0xc5ae('0x25')]=qs[_0xc5ae('0x25')](_0x298854[_0xc5ae('0x4a')][_0xc5ae('0x25')]);}return _0x49e9d1[_0xc5ae('0xfb')](_0x131d56);}})[_0xc5ae('0x18')](function(_0x25d0c8){if(_0x25d0c8){return _0x25d0c8?{'count':_0x502686,'rows':_0x25d0c8}:null;}})[_0xc5ae('0x18')](respondWithResult(_0x4528d8,null))['catch'](handleError(_0x4528d8,null));};exports[_0xc5ae('0x11a')]=function(_0x27f874,_0x40a0b0){var _0x46649b=_0x27f874[_0xc5ae('0x4a')]['online']===_0xc5ae('0x11b')?_0xc5ae('0x11c'):_0xc5ae('0x11d');return db['ChatWebsite']['find']({'attributes':['id',_0x46649b],'where':{'id':_0x27f874[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x40a0b0,null))[_0xc5ae('0x18')](function(_0x81671d){if(_0x81671d){var _0xa76cc3=_0x81671d[_0x46649b];var _0x40c3f8=_0xa76cc3&&_0xa76cc3[_0xc5ae('0x11e')]?_0xa76cc3['items']:[];_0x40a0b0[_0xc5ae('0x30')]({'fromKey':_['isNil'](_0xa76cc3['fromKey'])?undefined:_0xa76cc3[_0xc5ae('0x11f')],'count':_0x40c3f8[_0xc5ae('0x5e')],'rows':_0x40c3f8});}})[_0xc5ae('0x5b')](handleError(_0x40a0b0,null));};exports[_0xc5ae('0x120')]=function(_0x4649b5,_0x285f10){var _0x4e59eb={'raw':![],'where':{}};var _0x584230={};var _0x3be682={'count':0x0,'rows':[]};return db[_0xc5ae('0x48')][_0xc5ae('0x6d')]({'where':{'id':_0x4649b5[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x285f10,null))[_0xc5ae('0x18')](function(_0x39c5ca){if(_0x39c5ca){_0x584230[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db[_0xc5ae('0xd5')][_0xc5ae('0x49')]);_0x584230['query']=_['keys'](_0x4649b5['query']);_0x584230[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x584230[_0xc5ae('0x40')],_0x584230[_0xc5ae('0x4a')]);_0x4e59eb['attributes']=_['intersection'](_0x584230[_0xc5ae('0x40')],qs[_0xc5ae('0x4e')](_0x4649b5['query'][_0xc5ae('0x4e')]));_0x4e59eb[_0xc5ae('0x4f')]=_0x4e59eb[_0xc5ae('0x4f')]['length']?_0x4e59eb['attributes']:_0x584230[_0xc5ae('0x40')];if(!_0x4649b5[_0xc5ae('0x4a')][_0xc5ae('0x50')](_0xc5ae('0x51'))){_0x4e59eb[_0xc5ae('0x26')]=qs[_0xc5ae('0x26')](_0x4649b5['query']['limit']);_0x4e59eb['offset']=qs[_0xc5ae('0x25')](_0x4649b5[_0xc5ae('0x4a')][_0xc5ae('0x25')]);}_0x4e59eb[_0xc5ae('0x6f')]=qs[_0xc5ae('0x52')](_0x4649b5['query']['sort']);_0x4e59eb['where']=qs[_0xc5ae('0x4c')](_['pick'](_0x4649b5[_0xc5ae('0x4a')],_0x584230[_0xc5ae('0x4c')]));_0x4e59eb[_0xc5ae('0x53')][_0xc5ae('0x6c')]=_0x39c5ca['id'];if(_0x4649b5[_0xc5ae('0x4a')][_0xc5ae('0x55')]){_0x4e59eb[_0xc5ae('0x53')]=_[_0xc5ae('0x56')](_0x4e59eb[_0xc5ae('0x53')],{'$or':_[_0xc5ae('0x47')](_0x4e59eb[_0xc5ae('0x4f')],function(_0x5096d9){var _0x2b7f91={};_0x2b7f91[_0x5096d9]={'$like':'%'+_0x4649b5[_0xc5ae('0x4a')][_0xc5ae('0x55')]+'%'};return _0x2b7f91;})});}_0x4e59eb=_['merge']({},_0x4e59eb,_0x4649b5[_0xc5ae('0x5f')]);return db[_0xc5ae('0xd5')]['count']({'where':_0x4e59eb['where']})['then'](function(_0x4e9620){_0x3be682[_0xc5ae('0x28')]=_0x4e9620;if(_0x4649b5['query'][_0xc5ae('0x57')]){_0x4e59eb['include']=[{'all':!![]}];}else{_0x4e59eb[_0xc5ae('0x58')]=[{'model':db[_0xc5ae('0xac')],'as':_0xc5ae('0xf6'),'required':![]},{'model':db[_0xc5ae('0xde')],'as':_0xc5ae('0x121'),'required':![]}];}return db[_0xc5ae('0xd5')][_0xc5ae('0x59')](_0x4e59eb);})[_0xc5ae('0x18')](function(_0x52701f){_0x3be682[_0xc5ae('0x5a')]=_0x52701f;return _0x3be682;});}})[_0xc5ae('0x18')](respondWithFilteredResult(_0x285f10,_0x4e59eb))['catch'](handleError(_0x285f10,null));};exports[_0xc5ae('0x122')]=function(_0xed63eb,_0x41122b){return db[_0xc5ae('0x48')][_0xc5ae('0x64')]({'where':{'id':_0xed63eb[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x41122b,null))['then'](function(_0x54c3ca){if(_0x54c3ca){return _0x54c3ca[_0xc5ae('0x122')](_0xed63eb['body'][_0xc5ae('0x75')],_['omit'](_0xed63eb['body'],[_0xc5ae('0x75'),'id'])||{})[_0xc5ae('0xd0')](function(_0x16bb24){for(var _0x308db0=0x0;_0x308db0<_0xed63eb[_0xc5ae('0x68')]['ids'][_0xc5ae('0x5e')];_0x308db0+=0x1){socket[_0xc5ae('0x123')]('userChatWebsite:save',{'UserId':Number(_0xed63eb['body'][_0xc5ae('0x75')][_0x308db0]),'ChatWebsiteId':Number(_0xed63eb[_0xc5ae('0x5d')]['id'])});}return _0x16bb24;});}})[_0xc5ae('0x18')](respondWithResult(_0x41122b,null))[_0xc5ae('0x5b')](handleError(_0x41122b,null));};exports[_0xc5ae('0x124')]=function(_0xcd73c6,_0x55efc3){return db['ChatWebsite'][_0xc5ae('0x64')]({'where':{'id':_0xcd73c6[_0xc5ae('0x5d')]['id']}})['then'](handleEntityNotFound(_0x55efc3,null))[_0xc5ae('0x18')](function(_0x2735e5){if(_0x2735e5){return _0x2735e5[_0xc5ae('0x124')](_0xcd73c6[_0xc5ae('0x4a')]['ids'])[_0xc5ae('0x18')](function(){if(_[_0xc5ae('0x125')](_0xcd73c6[_0xc5ae('0x4a')][_0xc5ae('0x75')])){for(var _0x68e2b4=0x0;_0x68e2b4<_0xcd73c6[_0xc5ae('0x4a')]['ids'][_0xc5ae('0x5e')];_0x68e2b4+=0x1){socket[_0xc5ae('0x123')](_0xc5ae('0x126'),{'UserId':Number(_0xcd73c6[_0xc5ae('0x4a')][_0xc5ae('0x75')][_0x68e2b4]),'ChatWebsiteId':Number(_0xcd73c6['params']['id'])});}}else{socket['emit'](_0xc5ae('0x126'),{'UserId':Number(_0xcd73c6[_0xc5ae('0x4a')]['ids']),'ChatWebsiteId':Number(_0xcd73c6['params']['id'])});}});}})[_0xc5ae('0x18')](respondWithStatusCode(_0x55efc3,null))['catch'](handleError(_0x55efc3,null));};exports[_0xc5ae('0x127')]=function(_0x5bece,_0x2ffc96){var _0x2c01b7={};var _0x57cfdd={};var _0x20d25d;var _0x550482;return db[_0xc5ae('0x48')]['findOne']({'where':{'id':_0x5bece[_0xc5ae('0x5d')]['id']}})[_0xc5ae('0x18')](handleEntityNotFound(_0x2ffc96,null))[_0xc5ae('0x18')](function(_0xd807b9){if(_0xd807b9){_0x20d25d=_0xd807b9;_0x57cfdd[_0xc5ae('0x40')]=_[_0xc5ae('0x4b')](db[_0xc5ae('0x128')][_0xc5ae('0x49')]);_0x57cfdd[_0xc5ae('0x4a')]=_[_0xc5ae('0x4b')](_0x5bece[_0xc5ae('0x4a')]);_0x57cfdd[_0xc5ae('0x4c')]=_[_0xc5ae('0x4d')](_0x57cfdd['model'],_0x57cfdd['query']);_0x2c01b7['attributes']=_[_0xc5ae('0x4d')](_0x57cfdd[_0xc5ae('0x40')],qs[_0xc5ae('0x4e')](_0x5bece[_0xc5ae('0x4a')][_0xc5ae('0x4e')]));_0x2c01b7[_0xc5ae('0x4f')]=_0x2c01b7[_0xc5ae('0x4f')]['length']?_0x2c01b7[_0xc5ae('0x4f')]:_0x57cfdd[_0xc5ae('0x40')];_0x2c01b7[_0xc5ae('0x6f')]=qs[_0xc5ae('0x52')](_0x5bece[_0xc5ae('0x4a')][_0xc5ae('0x52')]);_0x2c01b7[_0xc5ae('0x53')]=qs[_0xc5ae('0x4c')](_[_0xc5ae('0x54')](_0x5bece[_0xc5ae('0x4a')],_0x57cfdd[_0xc5ae('0x4c')]));if(_0x5bece[_0xc5ae('0x4a')][_0xc5ae('0x55')]){_0x2c01b7[_0xc5ae('0x53')]=_[_0xc5ae('0x56')](_0x2c01b7[_0xc5ae('0x53')],{'$or':_[_0xc5ae('0x47')](_0x2c01b7[_0xc5ae('0x4f')],function(_0x2c99f0){var _0x59231b={};_0x59231b[_0x2c99f0]={'$like':'%'+_0x5bece[_0xc5ae('0x4a')][_0xc5ae('0x55')]+'%'};return _0x59231b;})});}_0x2c01b7=_[_0xc5ae('0x56')]({},_0x2c01b7,_0x5bece[_0xc5ae('0x5f')]);return _0x20d25d[_0xc5ae('0x127')](_0x2c01b7);}})[_0xc5ae('0x18')](function(_0x12917a){if(_0x12917a){_0x550482=_0x12917a[_0xc5ae('0x5e')];if(!_0x5bece[_0xc5ae('0x4a')][_0xc5ae('0x50')](_0xc5ae('0x51'))){_0x2c01b7[_0xc5ae('0x26')]=qs[_0xc5ae('0x26')](_0x5bece[_0xc5ae('0x4a')][_0xc5ae('0x26')]);_0x2c01b7[_0xc5ae('0x25')]=qs[_0xc5ae('0x25')](_0x5bece[_0xc5ae('0x4a')][_0xc5ae('0x25')]);}return _0x20d25d[_0xc5ae('0x127')](_0x2c01b7);}})['then'](function(_0x473394){if(_0x473394){return _0x473394?{'count':_0x550482,'rows':_0x473394}:null;}})[_0xc5ae('0x18')](respondWithResult(_0x2ffc96,null))[_0xc5ae('0x5b')](handleError(_0x2ffc96,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index fdef41a..f947c77 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 _0xe14f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x37ba32,_0x10bc80){var _0x23ad43=function(_0x5b61bd){while(--_0x5b61bd){_0x37ba32['push'](_0x37ba32['shift']());}};_0x23ad43(++_0x10bc80);}(_0xe14f,0xea));var _0xfe14=function(_0x23b940,_0x2b824b){_0x23b940=_0x23b940-0x0;var _0x2b264e=_0xe14f[_0x23b940];return _0x2b264e;};'use strict';var EventEmitter=require(_0xfe14('0x0'));var ChatWebsite=require(_0xfe14('0x1'))['db'][_0xfe14('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xfe14('0x3')](0x0);var events={'afterCreate':_0xfe14('0x4'),'afterUpdate':_0xfe14('0x5'),'afterDestroy':_0xfe14('0x6')};function emitEvent(_0x3afd97){return function(_0x2b7784,_0x4b7546,_0x576d90){ChatWebsiteEvents[_0xfe14('0x7')](_0x3afd97+':'+_0x2b7784['id'],_0x2b7784);ChatWebsiteEvents['emit'](_0x3afd97,_0x2b7784);_0x576d90(null);};}for(var e in events){if(events[_0xfe14('0x8')](e)){var event=events[e];ChatWebsite[_0xfe14('0x9')](e,emitEvent(event));}}module[_0xfe14('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf50b=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x58b310,_0x35b507){var _0x5de8cb=function(_0x1ae45a){while(--_0x1ae45a){_0x58b310['push'](_0x58b310['shift']());}};_0x5de8cb(++_0x35b507);}(_0xf50b,0xc8));var _0xbf50=function(_0x3d59e,_0x1ca039){_0x3d59e=_0x3d59e-0x0;var _0x925f6b=_0xf50b[_0x3d59e];return _0x925f6b;};'use strict';var EventEmitter=require(_0xbf50('0x0'));var ChatWebsite=require(_0xbf50('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbf50('0x2')](0x0);var events={'afterCreate':_0xbf50('0x3'),'afterUpdate':_0xbf50('0x4'),'afterDestroy':_0xbf50('0x5')};function emitEvent(_0x5f0c1a){return function(_0x32217d,_0x4f5ba8,_0x36e4d6){ChatWebsiteEvents[_0xbf50('0x6')](_0x5f0c1a+':'+_0x32217d['id'],_0x32217d);ChatWebsiteEvents[_0xbf50('0x6')](_0x5f0c1a,_0x32217d);_0x36e4d6(null);};}for(var e in events){if(events[_0xbf50('0x7')](e)){var event=events[e];ChatWebsite[_0xbf50('0x8')](e,emitEvent(event));}}module[_0xbf50('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 35bd4d7..707b9fc 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 _0xaffb=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0xaffb,0xa5));var _0xbaff=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0xaffb[_0x509c83];return _0x534626;};'use strict';var _=require(_0xbaff('0x0'));var util=require('util');var logger=require(_0xbaff('0x1'))(_0xbaff('0x2'));var moment=require('moment');var BPromise=require(_0xbaff('0x3'));var rp=require(_0xbaff('0x4'));var fs=require('fs');var path=require(_0xbaff('0x5'));var rimraf=require('rimraf');var config=require(_0xbaff('0x6'));var attributes=require(_0xbaff('0x7'));module[_0xbaff('0x8')]=function(_0x23354a,_0x6bf3c3){return _0x23354a[_0xbaff('0x9')]('ChatWebsite',attributes,{'tableName':_0xbaff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e60=['define','ChatWebsite','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x2e7549,_0x16864b){var _0x1db86a=function(_0x2a975e){while(--_0x2a975e){_0x2e7549['push'](_0x2e7549['shift']());}};_0x1db86a(++_0x16864b);}(_0x9e60,0x182));var _0x09e6=function(_0x162dde,_0x710b14){_0x162dde=_0x162dde-0x0;var _0x3a8b91=_0x9e60[_0x162dde];return _0x3a8b91;};'use strict';var _=require(_0x09e6('0x0'));var util=require('util');var logger=require(_0x09e6('0x1'))(_0x09e6('0x2'));var moment=require(_0x09e6('0x3'));var BPromise=require(_0x09e6('0x4'));var rp=require(_0x09e6('0x5'));var fs=require('fs');var path=require(_0x09e6('0x6'));var rimraf=require('rimraf');var config=require(_0x09e6('0x7'));var attributes=require(_0x09e6('0x8'));module[_0x09e6('0x9')]=function(_0x8dbf0,_0x35a130){return _0x8dbf0[_0x09e6('0xa')](_0x09e6('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index c5e6ff9..bd121cb 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 _0x0cfb=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x3cb962,_0x39edfe){var _0x548c28=function(_0x2ccfb6){while(--_0x2ccfb6){_0x3cb962['push'](_0x3cb962['shift']());}};_0x548c28(++_0x39edfe);}(_0x0cfb,0x123));var _0xb0cf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0cfb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb0cf('0x0'));var util=require(_0xb0cf('0x1'));var moment=require(_0xb0cf('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0cf('0x4'))['db'];var utils=require(_0xb0cf('0x5'));var logger=require('../../config/logger')(_0xb0cf('0x6'));var config=require(_0xb0cf('0x7'));var jayson=require(_0xb0cf('0x8'));var client=jayson[_0xb0cf('0x9')][_0xb0cf('0xa')]({'port':0x232a});config[_0xb0cf('0xb')]=_[_0xb0cf('0xc')](config[_0xb0cf('0xb')],{'host':_0xb0cf('0xd'),'port':0x18eb});var socket=require(_0xb0cf('0xe'))(new Redis(config[_0xb0cf('0xb')]));require(_0xb0cf('0xf'))[_0xb0cf('0x10')](socket);function respondWithRpcPromise(_0xd0a71d,_0x5e7d46,_0x9b1d76){return new BPromise(function(_0xa99eb0,_0x109534){return client[_0xb0cf('0x11')](_0xd0a71d,_0x9b1d76)[_0xb0cf('0x12')](function(_0x57fd11){logger[_0xb0cf('0x13')](_0xb0cf('0x14'),_0x5e7d46,_0xb0cf('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5e7d46,_0xb0cf('0x15'),JSON[_0xb0cf('0x16')](_0x57fd11));if(_0x57fd11[_0xb0cf('0x17')]){if(_0x57fd11['error']['code']===0x1f4){logger[_0xb0cf('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5e7d46,_0x57fd11['error']['message']);return _0x109534(_0x57fd11[_0xb0cf('0x17')]['message']);}logger[_0xb0cf('0x17')](_0xb0cf('0x14'),_0x5e7d46,_0x57fd11[_0xb0cf('0x17')][_0xb0cf('0x18')]);return _0xa99eb0(_0x57fd11['error'][_0xb0cf('0x18')]);}else{logger[_0xb0cf('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x5e7d46,_0xb0cf('0x15'));_0xa99eb0(_0x57fd11[_0xb0cf('0x19')][_0xb0cf('0x18')]);}})[_0xb0cf('0x1a')](function(_0x5dceeb){logger['error'](_0xb0cf('0x14'),_0x5e7d46,_0x5dceeb);_0x109534(_0x5dceeb);});});} \ No newline at end of file +var _0x9932=['info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','socket.io-emitter','redis','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x292d23,_0x384602){var _0x14f22f=function(_0x3d06e2){while(--_0x3d06e2){_0x292d23['push'](_0x292d23['shift']());}};_0x14f22f(++_0x384602);}(_0x9932,0x66));var _0x2993=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x9932[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0x2993('0x0'));var util=require('util');var moment=require(_0x2993('0x1'));var BPromise=require(_0x2993('0x2'));var rs=require(_0x2993('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2993('0x4'))['db'];var utils=require(_0x2993('0x5'));var logger=require(_0x2993('0x6'))(_0x2993('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2993('0x8')][_0x2993('0x9')]({'port':0x232a});config['redis']=_[_0x2993('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2993('0xb'))(new Redis(config[_0x2993('0xc')]));require(_0x2993('0xd'))[_0x2993('0xe')](socket);function respondWithRpcPromise(_0x5cf40a,_0xd014aa,_0x11604c){return new BPromise(function(_0x510865,_0x4ac006){return client[_0x2993('0xf')](_0x5cf40a,_0x11604c)['then'](function(_0xa7bb07){logger['info'](_0x2993('0x10'),_0xd014aa,'request\x20sent');logger[_0x2993('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xd014aa,_0x2993('0x12'),JSON[_0x2993('0x13')](_0xa7bb07));if(_0xa7bb07[_0x2993('0x14')]){if(_0xa7bb07[_0x2993('0x14')][_0x2993('0x15')]===0x1f4){logger[_0x2993('0x14')](_0x2993('0x10'),_0xd014aa,_0xa7bb07[_0x2993('0x14')][_0x2993('0x16')]);return _0x4ac006(_0xa7bb07['error'][_0x2993('0x16')]);}logger[_0x2993('0x14')](_0x2993('0x10'),_0xd014aa,_0xa7bb07[_0x2993('0x14')]['message']);return _0x510865(_0xa7bb07['error'][_0x2993('0x16')]);}else{logger[_0x2993('0x17')](_0x2993('0x10'),_0xd014aa,_0x2993('0x12'));_0x510865(_0xa7bb07[_0x2993('0x18')][_0x2993('0x16')]);}})['catch'](function(_0x5c2ce3){logger['error'](_0x2993('0x10'),_0xd014aa,_0x5c2ce3);_0x4ac006(_0x5c2ce3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c5c1b33..724d1c6 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 _0xa25c=['update','emit','length','chatWebsite:','save','remove'];(function(_0x46990f,_0x49e763){var _0x46009a=function(_0x462e13){while(--_0x462e13){_0x46990f['push'](_0x46990f['shift']());}};_0x46009a(++_0x49e763);}(_0xa25c,0x12a));var _0xca25=function(_0x120c7a,_0x553651){_0x120c7a=_0x120c7a-0x0;var _0x402568=_0xa25c[_0x120c7a];return _0x402568;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xca25('0x0'),_0xca25('0x1'),_0xca25('0x2')];function createListener(_0x1350c7,_0x5694e5){return function(_0x3b3f5c){_0x5694e5[_0xca25('0x3')](_0x1350c7,_0x3b3f5c);};}function removeListener(_0x3f5f97,_0x84fb54){return function(){ChatWebsiteEvents['removeListener'](_0x3f5f97,_0x84fb54);};}exports['register']=function(_0x508dc1){for(var _0x2031c6=0x0,_0x1f8b63=events[_0xca25('0x4')];_0x2031c6<_0x1f8b63;_0x2031c6++){var _0x2773c6=events[_0x2031c6];var _0x4dc78e=createListener(_0xca25('0x5')+_0x2773c6,_0x508dc1);ChatWebsiteEvents['on'](_0x2773c6,_0x4dc78e);}}; \ No newline at end of file +var _0xc39f=['save','remove','emit','register','chatWebsite:'];(function(_0x1aef24,_0x1f1c07){var _0xe2626d=function(_0x43a953){while(--_0x43a953){_0x1aef24['push'](_0x1aef24['shift']());}};_0xe2626d(++_0x1f1c07);}(_0xc39f,0x73));var _0xfc39=function(_0xc7caa8,_0x4a92db){_0xc7caa8=_0xc7caa8-0x0;var _0x28ada3=_0xc39f[_0xc7caa8];return _0x28ada3;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xfc39('0x0'),_0xfc39('0x1'),'update'];function createListener(_0x340c0a,_0x1bc032){return function(_0x419e9e){_0x1bc032[_0xfc39('0x2')](_0x340c0a,_0x419e9e);};}function removeListener(_0x4d2ff4,_0x4f50fd){return function(){ChatWebsiteEvents['removeListener'](_0x4d2ff4,_0x4f50fd);};}exports[_0xfc39('0x3')]=function(_0x1928f6){for(var _0x511edd=0x0,_0x2fa0ea=events['length'];_0x511edd<_0x2fa0ea;_0x511edd++){var _0x447380=events[_0x511edd];var _0x5c1550=createListener(_0xfc39('0x4')+_0x447380,_0x1928f6);ChatWebsiteEvents['on'](_0x447380,_0x5c1550);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index bda225a..0e260b4 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 _0x450e=['getAnswers','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','join','root','format','%s-%s','originalname','single','file','addLogo','diskStorage','now','/:id/avatar','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','offline-chat','ensureDir','replace','extname','/:id/offline','/:id/interactions','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','getDispositions','/:id/canned_answers'];(function(_0x52b49b,_0x337b45){var _0x579974=function(_0x71899e){while(--_0x71899e){_0x52b49b['push'](_0x52b49b['shift']());}};_0x579974(++_0x337b45);}(_0x450e,0x194));var _0xe450=function(_0x4ebfbb,_0x3ff78e){_0x4ebfbb=_0x4ebfbb-0x0;var _0x2aec79=_0x450e[_0x4ebfbb];return _0x2aec79;};'use strict';var multer=require(_0xe450('0x0'));var util=require(_0xe450('0x1'));var path=require(_0xe450('0x2'));var timeout=require(_0xe450('0x3'));var express=require(_0xe450('0x4'));var router=express[_0xe450('0x5')]();var fs_extra=require(_0xe450('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe450('0x7'));var config=require('../../config/environment');var controller=require(_0xe450('0x8'));router['get']('/',auth[_0xe450('0x9')](),controller[_0xe450('0xa')]);router[_0xe450('0xb')](_0xe450('0xc'),auth[_0xe450('0x9')](),controller['describe']);router[_0xe450('0xb')](_0xe450('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe450('0xb')]('/:id/dispositions',auth[_0xe450('0x9')](),controller[_0xe450('0xe')]);router[_0xe450('0xb')](_0xe450('0xf'),auth[_0xe450('0x9')](),controller[_0xe450('0x10')]);router[_0xe450('0xb')](_0xe450('0x11'),controller[_0xe450('0x12')]);router[_0xe450('0xb')]('/:id/avatar',controller[_0xe450('0x13')]);router[_0xe450('0xb')]('/:id/customer_avatar',controller[_0xe450('0x14')]);router[_0xe450('0xb')](_0xe450('0x15'),controller[_0xe450('0x16')]);router[_0xe450('0xb')]('/:id/interactions',auth[_0xe450('0x9')](),controller[_0xe450('0x17')]);router['get']('/:id/snippet',controller[_0xe450('0x18')]);router[_0xe450('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe450('0x19')]);router[_0xe450('0xb')](_0xe450('0x1a'),auth[_0xe450('0x9')](),controller['getProactiveActions']);router['get'](_0xe450('0x1b'),controller['getFields']);router['get'](_0xe450('0x1c'),auth[_0xe450('0x9')](),controller[_0xe450('0x1d')]);router[_0xe450('0xb')](_0xe450('0x1e'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe450('0x1f')]('/',auth[_0xe450('0x9')](),controller[_0xe450('0x20')]);router['post'](_0xe450('0x21'),auth['isAuthenticated'](),controller[_0xe450('0x22')]);router[_0xe450('0x1f')]('/:id/canned_answers',auth[_0xe450('0x9')](),controller[_0xe450('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x714d8b,_0x12ad4a,_0x435e00){_0x435e00(null,path[_0xe450('0x24')](config[_0xe450('0x25')],'server/files/images/logos/'));},'filename':function(_0x48583a,_0x7309e7,_0x28abe0){_0x28abe0(null,util[_0xe450('0x26')](_0xe450('0x27'),Date['now'](),_0x7309e7[_0xe450('0x28')]));}})});router[_0xe450('0x1f')](_0xe450('0x11'),upload[_0xe450('0x29')](_0xe450('0x2a')),controller[_0xe450('0x2b')]);var upload=multer({'storage':multer[_0xe450('0x2c')]({'destination':function(_0x40613b,_0x55f5a7,_0x1fa75a){_0x1fa75a(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4c4f81,_0x137cd2,_0x4dee86){_0x4dee86(null,util[_0xe450('0x26')]('%s-%s',Date[_0xe450('0x2d')](),_0x137cd2[_0xe450('0x28')]));}})});router[_0xe450('0x1f')](_0xe450('0x2e'),upload[_0xe450('0x29')](_0xe450('0x2a')),controller[_0xe450('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46c5cb,_0x5968ae,_0x12fc63){_0x12fc63(null,path[_0xe450('0x24')](config[_0xe450('0x25')],_0xe450('0x30')));},'filename':function(_0x30bce0,_0x8fed00,_0x4f17e3){_0x4f17e3(null,util[_0xe450('0x26')](_0xe450('0x27'),Date['now'](),_0x8fed00['originalname']));}})});router[_0xe450('0x1f')](_0xe450('0x31'),upload['single'](_0xe450('0x2a')),controller[_0xe450('0x32')]);var upload=multer({'storage':multer[_0xe450('0x2c')]({'destination':function(_0x3d96aa,_0x495035,_0x493128){_0x493128(null,path[_0xe450('0x24')](config[_0xe450('0x25')],_0xe450('0x30')));},'filename':function(_0x24c73f,_0x348ecf,_0x54ba68){_0x54ba68(null,util[_0xe450('0x26')](_0xe450('0x27'),Date['now'](),_0x348ecf['originalname']));}})});router[_0xe450('0x1f')](_0xe450('0x15'),upload['single']('file'),controller[_0xe450('0x33')]);router[_0xe450('0x1f')](_0xe450('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x368025,_0x1ee9cc,_0x256f50){const _0xfb0ce4=path[_0xe450('0x24')](config[_0xe450('0x25')],'server/files','attachments',_0xe450('0x35'));fs_extra[_0xe450('0x36')](_0xfb0ce4,function(){_0x256f50(null,_0xfb0ce4);});},'filename':function(_0x3cc074,_0x2f87d9,_0x4d5cab){const _0x5a4912=_0x2f87d9['originalname'][_0xe450('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x41fdd4=path[_0xe450('0x38')](_0x5a4912);const _0x4e0c5c=Date['now']()+'-'+_0x5a4912[_0xe450('0x37')](_0x41fdd4,'')+_0x41fdd4;_0x4d5cab(null,_0x4e0c5c);}})});router['post'](_0xe450('0x39'),offlineUploadMulter['any'](),controller['offline']);router[_0xe450('0x1f')](_0xe450('0x3a'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xe450('0x1f')](_0xe450('0x3b'),auth['isAuthenticated'](),controller[_0xe450('0x3c')]);router['post'](_0xe450('0x1a'),auth['isAuthenticated'](),controller[_0xe450('0x3d')]);router[_0xe450('0x1f')](_0xe450('0x1e'),auth[_0xe450('0x9')](),controller[_0xe450('0x3e')]);router[_0xe450('0x3f')](_0xe450('0xd'),auth[_0xe450('0x9')](),controller[_0xe450('0x40')]);router[_0xe450('0x41')](_0xe450('0xd'),auth[_0xe450('0x9')](),controller[_0xe450('0x42')]);router['delete'](_0xe450('0x21'),auth[_0xe450('0x9')](),controller[_0xe450('0x43')]);router[_0xe450('0x41')](_0xe450('0xf'),auth[_0xe450('0x9')](),controller[_0xe450('0x44')]);router['delete'](_0xe450('0x1e'),auth[_0xe450('0x9')](),controller[_0xe450('0x45')]);module['exports']=router; \ No newline at end of file +var _0x81ef=['/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','post','create','diskStorage','join','root','format','%s-%s','now','originalname','single','file','server/files/images/avatars/','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x81ef,0xf7));var _0xf81e=function(_0x215cfe,_0x36efa5){_0x215cfe=_0x215cfe-0x0;var _0x34a0f0=_0x81ef[_0x215cfe];return _0x34a0f0;};'use strict';var multer=require(_0xf81e('0x0'));var util=require(_0xf81e('0x1'));var path=require(_0xf81e('0x2'));var timeout=require(_0xf81e('0x3'));var express=require(_0xf81e('0x4'));var router=express[_0xf81e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf81e('0x6'));var interaction=require(_0xf81e('0x7'));var config=require(_0xf81e('0x8'));var controller=require(_0xf81e('0x9'));router[_0xf81e('0xa')]('/',auth[_0xf81e('0xb')](),controller[_0xf81e('0xc')]);router[_0xf81e('0xa')](_0xf81e('0xd'),auth[_0xf81e('0xb')](),controller[_0xf81e('0xe')]);router[_0xf81e('0xa')](_0xf81e('0xf'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x10')]);router['get']('/:id/dispositions',auth[_0xf81e('0xb')](),controller['getDispositions']);router[_0xf81e('0xa')](_0xf81e('0x11'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x12')]);router['get'](_0xf81e('0x13'),controller[_0xf81e('0x14')]);router[_0xf81e('0xa')](_0xf81e('0x15'),controller[_0xf81e('0x16')]);router[_0xf81e('0xa')]('/:id/customer_avatar',controller[_0xf81e('0x17')]);router[_0xf81e('0xa')]('/:id/system_avatar',controller[_0xf81e('0x18')]);router['get'](_0xf81e('0x19'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x1a')]);router[_0xf81e('0xa')](_0xf81e('0x1b'),controller[_0xf81e('0x1c')]);router[_0xf81e('0xa')]('/:id/applications',auth[_0xf81e('0xb')](),controller[_0xf81e('0x1d')]);router[_0xf81e('0xa')](_0xf81e('0x1e'),auth['isAuthenticated'](),controller[_0xf81e('0x1f')]);router[_0xf81e('0xa')](_0xf81e('0x20'),controller[_0xf81e('0x21')]);router[_0xf81e('0xa')]('/:id/offline_messages',auth[_0xf81e('0xb')](),controller[_0xf81e('0x22')]);router[_0xf81e('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xf81e('0x23')]);router[_0xf81e('0x24')]('/',auth[_0xf81e('0xb')](),controller[_0xf81e('0x25')]);router[_0xf81e('0x24')]('/:id/dispositions',auth[_0xf81e('0xb')](),controller['addDisposition']);router[_0xf81e('0x24')](_0xf81e('0x11'),auth[_0xf81e('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xf81e('0x26')]({'destination':function(_0x373bc4,_0x9b89eb,_0x5d914f){_0x5d914f(null,path[_0xf81e('0x27')](config[_0xf81e('0x28')],'server/files/images/logos/'));},'filename':function(_0x3136f0,_0x458041,_0x7a446b){_0x7a446b(null,util[_0xf81e('0x29')](_0xf81e('0x2a'),Date[_0xf81e('0x2b')](),_0x458041[_0xf81e('0x2c')]));}})});router[_0xf81e('0x24')](_0xf81e('0x13'),upload[_0xf81e('0x2d')](_0xf81e('0x2e')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x541e63,_0x5e1d87,_0x205d03){_0x205d03(null,path['join'](config[_0xf81e('0x28')],_0xf81e('0x2f')));},'filename':function(_0x5d16ac,_0x57f9de,_0x3bcc22){_0x3bcc22(null,util['format'](_0xf81e('0x2a'),Date[_0xf81e('0x2b')](),_0x57f9de[_0xf81e('0x2c')]));}})});router[_0xf81e('0x24')](_0xf81e('0x15'),upload['single'](_0xf81e('0x2e')),controller[_0xf81e('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39b371,_0x215480,_0x1812b4){_0x1812b4(null,path['join'](config[_0xf81e('0x28')],_0xf81e('0x2f')));},'filename':function(_0x420485,_0x4c0061,_0x1c75ee){_0x1c75ee(null,util[_0xf81e('0x29')]('%s-%s',Date[_0xf81e('0x2b')](),_0x4c0061[_0xf81e('0x2c')]));}})});router[_0xf81e('0x24')](_0xf81e('0x31'),upload['single'](_0xf81e('0x2e')),controller[_0xf81e('0x32')]);var upload=multer({'storage':multer[_0xf81e('0x26')]({'destination':function(_0x23ae27,_0x4941a6,_0x2d7002){_0x2d7002(null,path[_0xf81e('0x27')](config['root'],_0xf81e('0x2f')));},'filename':function(_0x2e9531,_0x18bd8f,_0x21d36a){_0x21d36a(null,util[_0xf81e('0x29')](_0xf81e('0x2a'),Date[_0xf81e('0x2b')](),_0x18bd8f[_0xf81e('0x2c')]));}})});router[_0xf81e('0x24')](_0xf81e('0x33'),upload['single'](_0xf81e('0x2e')),controller[_0xf81e('0x34')]);router[_0xf81e('0x24')](_0xf81e('0x35'),controller[_0xf81e('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xf81e('0x26')]({'destination':function(_0x47f0b5,_0x19a950,_0x4a13c9){const _0x2db025=path['join'](config[_0xf81e('0x28')],_0xf81e('0x37'),_0xf81e('0x38'),_0xf81e('0x39'));fs_extra[_0xf81e('0x3a')](_0x2db025,function(){_0x4a13c9(null,_0x2db025);});},'filename':function(_0x33c2bd,_0x34139f,_0x217165){const _0x4ffc51=_0x34139f['originalname'][_0xf81e('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x464847=path[_0xf81e('0x3c')](_0x4ffc51);const _0xbbb1f5=Date[_0xf81e('0x2b')]()+'-'+_0x4ffc51[_0xf81e('0x3b')](_0x464847,'')+_0x464847;_0x217165(null,_0xbbb1f5);}})});router[_0xf81e('0x24')](_0xf81e('0x3d'),offlineUploadMulter[_0xf81e('0x3e')](),controller[_0xf81e('0x3f')]);router[_0xf81e('0x24')](_0xf81e('0x19'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x40')]);router['post']('/:id/applications',auth[_0xf81e('0xb')](),controller[_0xf81e('0x41')]);router[_0xf81e('0x24')](_0xf81e('0x1e'),auth['isAuthenticated'](),controller[_0xf81e('0x42')]);router[_0xf81e('0x24')](_0xf81e('0x43'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x44')]);router[_0xf81e('0x45')](_0xf81e('0xf'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x46')]);router[_0xf81e('0x47')]('/:id',auth[_0xf81e('0xb')](),controller[_0xf81e('0x48')]);router[_0xf81e('0x47')](_0xf81e('0x49'),auth[_0xf81e('0xb')](),controller[_0xf81e('0x4a')]);router[_0xf81e('0x47')](_0xf81e('0x11'),auth[_0xf81e('0xb')](),controller['removeAnswers']);router['delete'](_0xf81e('0x43'),auth['isAuthenticated'](),controller[_0xf81e('0x4b')]);module[_0xf81e('0x4c')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 89aeb71..bd59cd3 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 _0xe929=['beaver-logger/server','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports'];(function(_0x359cfb,_0x1040ba){var _0x3eef3b=function(_0x3bde59){while(--_0x3bde59){_0x359cfb['push'](_0x359cfb['shift']());}};_0x3eef3b(++_0x1040ba);}(_0xe929,0x78));var _0x9e92=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xe929[_0x521929];return _0x632436;};var beaverLogger=require(_0x9e92('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x9e92('0x1')]();var isProduction=config[_0x9e92('0x2')]===_0x9e92('0x3')||![];function clientSideLogs(_0x3200d0,_0x3763da,_0x516798){var _0x12c5ee=_0x3200d0[_0x9e92('0x4')]['get'](_0x9e92('0x5'));if(!_0x12c5ee){throw new Error(_0x9e92('0x6'));}return beaverLogger[_0x9e92('0x7')]({'uri':_0x9e92('0x8'),'logger':_0x12c5ee,'enableCors':!isProduction})(_0x3200d0,_0x3763da,_0x516798);}router[_0x9e92('0x9')](auth[_0x9e92('0xa')](),clientSideLogs);module[_0x9e92('0xb')]=router; \ No newline at end of file +var _0x6130=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','express','../components/auth/service','../config/environment','Router','env'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6130,0x13d));var _0x0613=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6130[_0x138adb];return _0x1b27f2;};var beaverLogger=require('beaver-logger/server');var express=require(_0x0613('0x0'));var auth=require(_0x0613('0x1'));var config=require(_0x0613('0x2'));var router=express[_0x0613('0x3')]();var isProduction=config[_0x0613('0x4')]===_0x0613('0x5')||![];function clientSideLogs(_0x1f7eb4,_0x32fba9,_0x1017f1){var _0x407007=_0x1f7eb4[_0x0613('0x6')][_0x0613('0x7')](_0x0613('0x8'));if(!_0x407007){throw new Error(_0x0613('0x9'));}return beaverLogger[_0x0613('0xa')]({'uri':_0x0613('0xb'),'logger':_0x407007,'enableCors':!isProduction})(_0x1f7eb4,_0x32fba9,_0x1017f1);}router[_0x0613('0xc')](auth[_0x0613('0xd')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 84d64dc..c0bf55c 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 _0x8416=['ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8416,0xdd));var _0x6841=function(_0x5c2e65,_0x20e630){_0x5c2e65=_0x5c2e65-0x0;var _0x445359=_0x8416[_0x5c2e65];return _0x445359;};'use strict';var Sequelize=require(_0x6841('0x0'));module[_0x6841('0x1')]={'name':{'type':Sequelize[_0x6841('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6841('0x3')](_0x6841('0x4'),'Google',_0x6841('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6841('0x3')](_0x6841('0x6'),_0x6841('0x7'))},'data1':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0x8')},'data2':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0x9')},'data3':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0xa')},'data4':{'type':Sequelize[_0x6841('0x2')],'comment':_0x6841('0xb')},'data5':{'type':Sequelize[_0x6841('0xc')],'comment':_0x6841('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0x6841('0xe')},'data7':{'type':Sequelize[_0x6841('0xc')],'comment':_0x6841('0xf')}}; \ No newline at end of file +var _0x6c3e=['Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING'];(function(_0x335266,_0x33fba3){var _0x18659f=function(_0x22b235){while(--_0x22b235){_0x335266['push'](_0x335266['shift']());}};_0x18659f(++_0x33fba3);}(_0x6c3e,0xc1));var _0xe6c3=function(_0x4cdb78,_0x26235a){_0x4cdb78=_0x4cdb78-0x0;var _0x222e23=_0x6c3e[_0x4cdb78];return _0x222e23;};'use strict';var Sequelize=require(_0xe6c3('0x0'));module['exports']={'name':{'type':Sequelize[_0xe6c3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0xe6c3('0x2'),_0xe6c3('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe6c3('0x4')](_0xe6c3('0x5'),_0xe6c3('0x6'))},'data1':{'type':Sequelize[_0xe6c3('0x1')],'comment':_0xe6c3('0x7')},'data2':{'type':Sequelize[_0xe6c3('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xe6c3('0x1')],'comment':_0xe6c3('0x8')},'data4':{'type':Sequelize['STRING'],'comment':_0xe6c3('0x9')},'data5':{'type':Sequelize[_0xe6c3('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xe6c3('0xa')],'comment':_0xe6c3('0xb')},'data7':{'type':Sequelize[_0xe6c3('0xa')],'comment':_0xe6c3('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d6c749f..f438bae 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 _0x86b7=['refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','set','update','then','destroy','error','stack','name','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','include','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6'];(function(_0x2cc77e,_0x229fbf){var _0x2332fa=function(_0xbd19f){while(--_0xbd19f){_0x2cc77e['push'](_0x2cc77e['shift']());}};_0x2332fa(++_0x229fbf);}(_0x86b7,0x139));var _0x786b=function(_0x3f1085,_0x2c3424){_0x3f1085=_0x3f1085-0x0;var _0x49bc8b=_0x86b7[_0x3f1085];return _0x49bc8b;};'use strict';var _=require(_0x786b('0x0'));var Redis=require(_0x786b('0x1'));var qs=require(_0x786b('0x2'));var encryptor=require(_0x786b('0x3'));var config=require('../../config/environment');var logger=require(_0x786b('0x4'))(_0x786b('0x5'));var db=require(_0x786b('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x786b('0x7')]=_[_0x786b('0x8')](config[_0x786b('0x7')],{'host':_0x786b('0x9'),'port':0x18eb});var socket=require(_0x786b('0xa'))(new Redis(config[_0x786b('0x7')]));var redis=new Redis(config[_0x786b('0x7')]);function respondWithStatusCode(_0x1d960b,_0x4f5935){_0x4f5935=_0x4f5935||0xcc;return function(_0x35d61a){if(_0x35d61a){return _0x1d960b[_0x786b('0xb')](_0x4f5935);}return _0x1d960b[_0x786b('0xc')](_0x4f5935)[_0x786b('0xd')]();};}function respondWithResult(_0xaaea94,_0x34a961){_0x34a961=_0x34a961||0xc8;return function(_0x5612ef){if(_0x5612ef){return _0xaaea94[_0x786b('0xc')](_0x34a961)[_0x786b('0xe')](_0x5612ef);}};}function respondWithFilteredResult(_0x275f18,_0x13ef1d){return function(_0x1039ec){if(_0x1039ec){var _0x480f03=typeof _0x13ef1d[_0x786b('0xf')]===_0x786b('0x10')&&typeof _0x13ef1d['limit']==='undefined';var _0x5b430e=_0x1039ec[_0x786b('0x11')];var _0x5dfc49=_0x480f03?0x0:_0x13ef1d[_0x786b('0xf')];var _0x5b93b6=_0x480f03?_0x1039ec[_0x786b('0x11')]:_0x13ef1d[_0x786b('0xf')]+_0x13ef1d['limit'];var _0x341591;if(_0x5b93b6>=_0x5b430e){_0x5b93b6=_0x5b430e;_0x341591=0xc8;}else{_0x341591=0xce;}_0x275f18[_0x786b('0xc')](_0x341591);return _0x275f18[_0x786b('0x12')]('Content-Range',_0x5dfc49+'-'+_0x5b93b6+'/'+_0x5b430e)[_0x786b('0xe')](_0x1039ec);}return null;};}function saveUpdates(_0x35052f){return function(_0x2053e1){if(_0x2053e1){return _0x2053e1[_0x786b('0x13')](_0x35052f)[_0x786b('0x14')](function(_0x4aa4e1){return _0x4aa4e1;});}return null;};}function removeEntity(_0x1c1968){return function(_0x37cd2e){if(_0x37cd2e){return _0x37cd2e[_0x786b('0x15')]()[_0x786b('0x14')](function(){_0x1c1968['status'](0xcc)[_0x786b('0xd')]();});}};}function handleEntityNotFound(_0x439f3f){return function(_0x4e8424){if(!_0x4e8424){_0x439f3f[_0x786b('0xb')](0x194);}return _0x4e8424;};}function handleError(_0x475003,_0x31e2c3){_0x31e2c3=_0x31e2c3||0x1f4;return function(_0x60c554){logger[_0x786b('0x16')](_0x60c554[_0x786b('0x17')]);if(_0x60c554[_0x786b('0x18')]){delete _0x60c554['name'];}_0x475003[_0x786b('0xc')](_0x31e2c3)['send'](_0x60c554);};}function maskClientSecret(_0x4c4a76){return _[_0x786b('0x19')](_0x4c4a76[_0x786b('0x1a')](0x0,0x3),0x14,'*');}exports[_0x786b('0x1b')]=function(_0x2f1533,_0x32f7ad){var _0x2aa4c5={},_0x1cd287={},_0xee751a={'count':0x0,'rows':[]};var _0x31a861=_['map'](db[_0x786b('0x1c')][_0x786b('0x1d')],function(_0x317e49){return{'name':_0x317e49[_0x786b('0x1e')],'type':_0x317e49[_0x786b('0x1f')][_0x786b('0x20')]};});_0x1cd287[_0x786b('0x21')]=_[_0x786b('0x22')](_0x31a861,_0x786b('0x18'));_0x1cd287[_0x786b('0x23')]=_[_0x786b('0x24')](_0x2f1533[_0x786b('0x23')]);_0x1cd287['filters']=_[_0x786b('0x25')](_0x1cd287[_0x786b('0x21')],_0x1cd287[_0x786b('0x23')]);_0x2aa4c5['attributes']=_[_0x786b('0x25')](_0x1cd287[_0x786b('0x21')],qs[_0x786b('0x26')](_0x2f1533['query'][_0x786b('0x26')]));_0x2aa4c5[_0x786b('0x27')]=_0x2aa4c5['attributes'][_0x786b('0x28')]?_0x2aa4c5[_0x786b('0x27')]:_0x1cd287[_0x786b('0x21')];if(!_0x2f1533['query'][_0x786b('0x29')](_0x786b('0x2a'))){_0x2aa4c5['limit']=qs[_0x786b('0x2b')](_0x2f1533[_0x786b('0x23')]['limit']);_0x2aa4c5[_0x786b('0xf')]=qs['offset'](_0x2f1533[_0x786b('0x23')][_0x786b('0xf')]);}_0x2aa4c5[_0x786b('0x2c')]=qs[_0x786b('0x2d')](_0x2f1533['query'][_0x786b('0x2d')]);_0x2aa4c5[_0x786b('0x2e')]=qs[_0x786b('0x2f')](_[_0x786b('0x30')](_0x2f1533['query'],_0x1cd287[_0x786b('0x2f')]),_0x31a861);if(_0x2f1533[_0x786b('0x23')][_0x786b('0x31')]){_0x2aa4c5[_0x786b('0x2e')]=_[_0x786b('0x32')](_0x2aa4c5['where'],{'$or':_[_0x786b('0x22')](_0x31a861,function(_0x323458){if(_0x323458[_0x786b('0x1f')]!==_0x786b('0x33')){var _0x4e6a82={};_0x4e6a82[_0x323458[_0x786b('0x18')]]={'$like':'%'+_0x2f1533[_0x786b('0x23')][_0x786b('0x31')]+'%'};return _0x4e6a82;}})});}_0x2aa4c5=_['merge']({},_0x2aa4c5,_0x2f1533[_0x786b('0x34')]);var _0x38288f={'where':_0x2aa4c5[_0x786b('0x2e')]};return db['CloudProvider']['count'](_0x38288f)['then'](function(_0x59ee8e){_0xee751a[_0x786b('0x11')]=_0x59ee8e;if(_0x2f1533['query'][_0x786b('0x35')]){_0x2aa4c5['include']=[{'all':!![]}];}return db[_0x786b('0x1c')][_0x786b('0x36')](_0x2aa4c5);})[_0x786b('0x14')](function(_0x438cb3){_0xee751a[_0x786b('0x37')]=_[_0x786b('0x22')](_0x438cb3,function(_0x35a1e8){if(_0x35a1e8[_0x786b('0x38')]===_0x786b('0x39')){var _0xbfb93a=encryptor[_0x786b('0x3a')](_0x35a1e8['data3']);_0x35a1e8[_0x786b('0x3b')]=maskClientSecret(_0xbfb93a);}return _0x35a1e8;});return _0xee751a;})[_0x786b('0x14')](respondWithFilteredResult(_0x32f7ad,_0x2aa4c5))[_0x786b('0x3c')](handleError(_0x32f7ad,null));};exports[_0x786b('0x3d')]=function(_0x3c7a1a,_0x313d4a){var _0x5b6297={'raw':!![],'where':{'id':_0x3c7a1a[_0x786b('0x3e')]['id']}},_0x9a5cff={};_0x9a5cff[_0x786b('0x21')]=_['keys'](db[_0x786b('0x1c')][_0x786b('0x1d')]);_0x9a5cff[_0x786b('0x23')]=_[_0x786b('0x24')](_0x3c7a1a[_0x786b('0x23')]);_0x9a5cff['filters']=_[_0x786b('0x25')](_0x9a5cff['model'],_0x9a5cff[_0x786b('0x23')]);_0x5b6297[_0x786b('0x27')]=_[_0x786b('0x25')](_0x9a5cff[_0x786b('0x21')],qs[_0x786b('0x26')](_0x3c7a1a[_0x786b('0x23')]['fields']));_0x5b6297['attributes']=_0x5b6297[_0x786b('0x27')]['length']?_0x5b6297[_0x786b('0x27')]:_0x9a5cff[_0x786b('0x21')];if(_0x3c7a1a['query'][_0x786b('0x35')]){_0x5b6297[_0x786b('0x3f')]=[{'all':!![]}];}_0x5b6297=_[_0x786b('0x32')]({},_0x5b6297,_0x3c7a1a[_0x786b('0x34')]);return db[_0x786b('0x1c')][_0x786b('0x40')](_0x5b6297)[_0x786b('0x14')](handleEntityNotFound(_0x313d4a,null))['then'](function(_0x3c43ba){if(_0x3c43ba['service']===_0x786b('0x39')){var _0x5ecba7=encryptor[_0x786b('0x3a')](_0x3c43ba[_0x786b('0x3b')]);_0x3c43ba[_0x786b('0x3b')]=maskClientSecret(_0x5ecba7);}return _0x3c43ba;})[_0x786b('0x14')](respondWithResult(_0x313d4a,null))['catch'](handleError(_0x313d4a,null));};exports[_0x786b('0x41')]=function(_0x5566ac,_0x5e1beb){if(!_0x5566ac[_0x786b('0x42')][_0x786b('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x5566ac[_0x786b('0x42')][_0x786b('0x38')])throw new Error(_0x786b('0x43'));var _0x49be70=db['CloudProvider']['rawAttributes'][_0x786b('0x38')][_0x786b('0x44')];if(!_0x49be70[_0x786b('0x45')](_0x5566ac[_0x786b('0x42')][_0x786b('0x38')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x49be70[_0x786b('0x46')](',\x20'));if(_0x5566ac[_0x786b('0x42')][_0x786b('0x38')]===_0x786b('0x39')&&_0x5566ac[_0x786b('0x42')][_0x786b('0x3b')]){_0x5566ac[_0x786b('0x42')][_0x786b('0x3b')]=encryptor[_0x786b('0x47')](_0x5566ac[_0x786b('0x42')][_0x786b('0x3b')]);}return db['CloudProvider']['create'](_0x5566ac[_0x786b('0x42')],{})[_0x786b('0x14')](respondWithResult(_0x5e1beb,0xc9))[_0x786b('0x3c')](handleError(_0x5e1beb,null));};exports['update']=function(_0x257974,_0xde8281){if(_0x257974[_0x786b('0x42')]['id']){delete _0x257974[_0x786b('0x42')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x257974['params']['id']}})['then'](handleEntityNotFound(_0xde8281,null))['then'](function(_0x6d0720){if(_0x6d0720[_0x786b('0x38')]===_0x786b('0x39')&&_0x257974[_0x786b('0x42')][_0x786b('0x3b')]){_0x257974[_0x786b('0x42')]['data3']=encryptor[_0x786b('0x47')](_0x257974[_0x786b('0x42')]['data3']);}return _0x6d0720;})[_0x786b('0x14')](saveUpdates(_0x257974[_0x786b('0x42')],null))['then'](respondWithResult(_0xde8281,null))[_0x786b('0x3c')](handleError(_0xde8281,null));};exports[_0x786b('0x15')]=function(_0x461c6f,_0x3e534e){return db[_0x786b('0x1c')][_0x786b('0x40')]({'where':{'id':_0x461c6f['params']['id']}})[_0x786b('0x14')](handleEntityNotFound(_0x3e534e,null))[_0x786b('0x14')](removeEntity(_0x3e534e,null))[_0x786b('0x3c')](handleError(_0x3e534e,null));};exports[_0x786b('0x48')]=function(_0x43d306,_0x13c10c){return db[_0x786b('0x1c')][_0x786b('0x49')]({'where':{'id':_0x43d306['params']['id']},'raw':!![]})[_0x786b('0x14')](function(_0x42e51c){if(!_0x42e51c)return _0x13c10c[_0x786b('0xb')](0x194);return{'url':oauth[_0x786b('0x4a')](_0x42e51c,_0x43d306[_0x786b('0x4b')]['id'])};})[_0x786b('0x14')](respondWithResult(_0x13c10c,null))[_0x786b('0x3c')](handleError(_0x13c10c,null));};exports[_0x786b('0x4c')]=function(_0x3fdd4f,_0x229bb3){var _0xb493e8=_0x3fdd4f['body'];var _0x25fce4;var _0x22b9f8;if(_0xb493e8[_0x786b('0x16')])throw _0xb493e8;redis['get'](_0xb493e8[_0x786b('0x4d')])['then'](function(_0x254ff8){if(!_0x254ff8)throw new Error(_0x786b('0x4e'));_0x25fce4=JSON[_0x786b('0x4f')](_0x254ff8);var _0x229138=Buffer[_0x786b('0x50')](_0xb493e8[_0x786b('0x4d')],_0x786b('0x51'))['toString'](_0x786b('0x52'));_0x22b9f8=JSON[_0x786b('0x4f')](_0x229138);if(!oauth['isValidIdToken'](_0xb493e8[_0x786b('0x53')],_0x25fce4[_0x786b('0x54')]))throw new Error(_0x786b('0x55'));redis['del'](_0xb493e8['state']);return oauth[_0x786b('0x56')](_0xb493e8[_0x786b('0x57')],_0x25fce4);})['then'](function(_0x4c7ba2){_0x25fce4[_0x786b('0x58')]=_0x4c7ba2[_0x786b('0x59')];_0x25fce4[_0x786b('0x5a')]=_0x4c7ba2[_0x786b('0x5b')];return db[_0x786b('0x1c')][_0x786b('0x13')]({'data5':_0x25fce4[_0x786b('0x58')],'data6':_0x25fce4['data6']},{'where':{'id':_0x25fce4['id']}});})[_0x786b('0x14')](function(){oauth[_0x786b('0x5c')](_0x25fce4);socket[_0x786b('0x5d')](_0x786b('0x5e'),{'id':_0x22b9f8['id']});return;})[_0x786b('0x14')](respondWithStatusCode(_0x229bb3,null))[_0x786b('0x3c')](function(_0x45cf48){if(_0x22b9f8){socket['emit'](_0x786b('0x5f'),{'id':_0x22b9f8['id']});}if(!_0x25fce4){logger[_0x786b('0x16')](_0x786b('0x60'),_0x45cf48);return _0x229bb3['status'](0x1f4)[_0x786b('0x61')](_0x45cf48[_0x786b('0x62')]);}logger[_0x786b('0x16')](_0x786b('0x63'),_0x25fce4['id'],JSON[_0x786b('0x64')](_0x45cf48));});}; \ No newline at end of file +var _0xd775=['id_token','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','keys','options','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','toString','ascii','isValidIdToken'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd775,0x1e0));var _0x5d77=function(_0xe8c1de,_0x21b601){_0xe8c1de=_0xe8c1de-0x0;var _0x38a2e0=_0xd775[_0xe8c1de];return _0x38a2e0;};'use strict';var _=require('lodash');var Redis=require(_0x5d77('0x0'));var qs=require(_0x5d77('0x1'));var encryptor=require(_0x5d77('0x2'));var config=require(_0x5d77('0x3'));var logger=require('../../config/logger')(_0x5d77('0x4'));var db=require(_0x5d77('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x5d77('0x6')]=_['defaults'](config['redis'],{'host':_0x5d77('0x7'),'port':0x18eb});var socket=require(_0x5d77('0x8'))(new Redis(config[_0x5d77('0x6')]));var redis=new Redis(config[_0x5d77('0x6')]);function respondWithStatusCode(_0x104e69,_0x1ad844){_0x1ad844=_0x1ad844||0xcc;return function(_0x49f2bc){if(_0x49f2bc){return _0x104e69[_0x5d77('0x9')](_0x1ad844);}return _0x104e69[_0x5d77('0xa')](_0x1ad844)[_0x5d77('0xb')]();};}function respondWithResult(_0x3694b7,_0x451be0){_0x451be0=_0x451be0||0xc8;return function(_0x3c6cc6){if(_0x3c6cc6){return _0x3694b7[_0x5d77('0xa')](_0x451be0)[_0x5d77('0xc')](_0x3c6cc6);}};}function respondWithFilteredResult(_0x6f18b8,_0x541320){return function(_0x4bb7e9){if(_0x4bb7e9){var _0xce8e37=typeof _0x541320[_0x5d77('0xd')]===_0x5d77('0xe')&&typeof _0x541320[_0x5d77('0xf')]===_0x5d77('0xe');var _0x3f32f6=_0x4bb7e9[_0x5d77('0x10')];var _0x11c094=_0xce8e37?0x0:_0x541320[_0x5d77('0xd')];var _0xa501d5=_0xce8e37?_0x4bb7e9[_0x5d77('0x10')]:_0x541320['offset']+_0x541320[_0x5d77('0xf')];var _0x361024;if(_0xa501d5>=_0x3f32f6){_0xa501d5=_0x3f32f6;_0x361024=0xc8;}else{_0x361024=0xce;}_0x6f18b8[_0x5d77('0xa')](_0x361024);return _0x6f18b8[_0x5d77('0x11')](_0x5d77('0x12'),_0x11c094+'-'+_0xa501d5+'/'+_0x3f32f6)[_0x5d77('0xc')](_0x4bb7e9);}return null;};}function saveUpdates(_0x4285c7){return function(_0x4c787e){if(_0x4c787e){return _0x4c787e[_0x5d77('0x13')](_0x4285c7)[_0x5d77('0x14')](function(_0x3d1888){return _0x3d1888;});}return null;};}function removeEntity(_0x229b27){return function(_0x44aefd){if(_0x44aefd){return _0x44aefd[_0x5d77('0x15')]()[_0x5d77('0x14')](function(){_0x229b27[_0x5d77('0xa')](0xcc)[_0x5d77('0xb')]();});}};}function handleEntityNotFound(_0x286d34){return function(_0x4c3d65){if(!_0x4c3d65){_0x286d34[_0x5d77('0x9')](0x194);}return _0x4c3d65;};}function handleError(_0x1e5fec,_0x8f021e){_0x8f021e=_0x8f021e||0x1f4;return function(_0x17d176){logger['error'](_0x17d176[_0x5d77('0x16')]);if(_0x17d176[_0x5d77('0x17')]){delete _0x17d176[_0x5d77('0x17')];}_0x1e5fec[_0x5d77('0xa')](_0x8f021e)[_0x5d77('0x18')](_0x17d176);};}function maskClientSecret(_0x3f6990){return _[_0x5d77('0x19')](_0x3f6990[_0x5d77('0x1a')](0x0,0x3),0x14,'*');}exports[_0x5d77('0x1b')]=function(_0x11928e,_0x27e012){var _0xb3f51c={},_0x4af192={},_0x52121c={'count':0x0,'rows':[]};var _0x1cfbfb=_[_0x5d77('0x1c')](db[_0x5d77('0x1d')][_0x5d77('0x1e')],function(_0x216ff6){return{'name':_0x216ff6[_0x5d77('0x1f')],'type':_0x216ff6[_0x5d77('0x20')][_0x5d77('0x21')]};});_0x4af192['model']=_[_0x5d77('0x1c')](_0x1cfbfb,'name');_0x4af192[_0x5d77('0x22')]=_['keys'](_0x11928e[_0x5d77('0x22')]);_0x4af192[_0x5d77('0x23')]=_[_0x5d77('0x24')](_0x4af192[_0x5d77('0x25')],_0x4af192[_0x5d77('0x22')]);_0xb3f51c[_0x5d77('0x26')]=_[_0x5d77('0x24')](_0x4af192[_0x5d77('0x25')],qs[_0x5d77('0x27')](_0x11928e[_0x5d77('0x22')][_0x5d77('0x27')]));_0xb3f51c[_0x5d77('0x26')]=_0xb3f51c[_0x5d77('0x26')][_0x5d77('0x28')]?_0xb3f51c['attributes']:_0x4af192[_0x5d77('0x25')];if(!_0x11928e[_0x5d77('0x22')][_0x5d77('0x29')](_0x5d77('0x2a'))){_0xb3f51c[_0x5d77('0xf')]=qs[_0x5d77('0xf')](_0x11928e['query'][_0x5d77('0xf')]);_0xb3f51c[_0x5d77('0xd')]=qs[_0x5d77('0xd')](_0x11928e[_0x5d77('0x22')][_0x5d77('0xd')]);}_0xb3f51c[_0x5d77('0x2b')]=qs[_0x5d77('0x2c')](_0x11928e[_0x5d77('0x22')][_0x5d77('0x2c')]);_0xb3f51c[_0x5d77('0x2d')]=qs[_0x5d77('0x23')](_[_0x5d77('0x2e')](_0x11928e[_0x5d77('0x22')],_0x4af192[_0x5d77('0x23')]),_0x1cfbfb);if(_0x11928e[_0x5d77('0x22')][_0x5d77('0x2f')]){_0xb3f51c[_0x5d77('0x2d')]=_[_0x5d77('0x30')](_0xb3f51c[_0x5d77('0x2d')],{'$or':_[_0x5d77('0x1c')](_0x1cfbfb,function(_0x473cc5){if(_0x473cc5[_0x5d77('0x20')]!==_0x5d77('0x31')){var _0x8c2e74={};_0x8c2e74[_0x473cc5['name']]={'$like':'%'+_0x11928e['query'][_0x5d77('0x2f')]+'%'};return _0x8c2e74;}})});}_0xb3f51c=_['merge']({},_0xb3f51c,_0x11928e['options']);var _0x118b1f={'where':_0xb3f51c[_0x5d77('0x2d')]};return db['CloudProvider'][_0x5d77('0x10')](_0x118b1f)['then'](function(_0x101f0c){_0x52121c['count']=_0x101f0c;if(_0x11928e[_0x5d77('0x22')][_0x5d77('0x32')]){_0xb3f51c[_0x5d77('0x33')]=[{'all':!![]}];}return db['CloudProvider'][_0x5d77('0x34')](_0xb3f51c);})[_0x5d77('0x14')](function(_0x5a1424){_0x52121c[_0x5d77('0x35')]=_['map'](_0x5a1424,function(_0x468b4d){if(_0x468b4d[_0x5d77('0x36')]===_0x5d77('0x37')){var _0x37fa7b=encryptor['decryptString'](_0x468b4d[_0x5d77('0x38')]);_0x468b4d[_0x5d77('0x38')]=maskClientSecret(_0x37fa7b);}return _0x468b4d;});return _0x52121c;})[_0x5d77('0x14')](respondWithFilteredResult(_0x27e012,_0xb3f51c))[_0x5d77('0x39')](handleError(_0x27e012,null));};exports[_0x5d77('0x3a')]=function(_0x265838,_0x3cd1ec){var _0x33113e={'raw':!![],'where':{'id':_0x265838[_0x5d77('0x3b')]['id']}},_0x2bb0ca={};_0x2bb0ca[_0x5d77('0x25')]=_[_0x5d77('0x3c')](db[_0x5d77('0x1d')]['rawAttributes']);_0x2bb0ca[_0x5d77('0x22')]=_[_0x5d77('0x3c')](_0x265838[_0x5d77('0x22')]);_0x2bb0ca[_0x5d77('0x23')]=_[_0x5d77('0x24')](_0x2bb0ca[_0x5d77('0x25')],_0x2bb0ca[_0x5d77('0x22')]);_0x33113e[_0x5d77('0x26')]=_['intersection'](_0x2bb0ca['model'],qs['fields'](_0x265838[_0x5d77('0x22')]['fields']));_0x33113e[_0x5d77('0x26')]=_0x33113e['attributes'][_0x5d77('0x28')]?_0x33113e[_0x5d77('0x26')]:_0x2bb0ca[_0x5d77('0x25')];if(_0x265838[_0x5d77('0x22')][_0x5d77('0x32')]){_0x33113e[_0x5d77('0x33')]=[{'all':!![]}];}_0x33113e=_[_0x5d77('0x30')]({},_0x33113e,_0x265838[_0x5d77('0x3d')]);return db[_0x5d77('0x1d')]['find'](_0x33113e)[_0x5d77('0x14')](handleEntityNotFound(_0x3cd1ec,null))[_0x5d77('0x14')](function(_0x14f358){if(_0x14f358['service']===_0x5d77('0x37')){var _0x59cb6c=encryptor[_0x5d77('0x3e')](_0x14f358[_0x5d77('0x38')]);_0x14f358[_0x5d77('0x38')]=maskClientSecret(_0x59cb6c);}return _0x14f358;})[_0x5d77('0x14')](respondWithResult(_0x3cd1ec,null))[_0x5d77('0x39')](handleError(_0x3cd1ec,null));};exports[_0x5d77('0x3f')]=function(_0xa261ae,_0x2e1732){if(!_0xa261ae[_0x5d77('0x40')]['name'])throw new Error(_0x5d77('0x41'));if(!_0xa261ae['body'][_0x5d77('0x36')])throw new Error(_0x5d77('0x42'));var _0x14dd88=db[_0x5d77('0x1d')][_0x5d77('0x1e')][_0x5d77('0x36')]['values'];if(!_0x14dd88['includes'](_0xa261ae['body'][_0x5d77('0x36')]))throw new Error(_0x5d77('0x43')+_0x14dd88[_0x5d77('0x44')](',\x20'));if(_0xa261ae['body']['service']===_0x5d77('0x37')&&_0xa261ae[_0x5d77('0x40')][_0x5d77('0x38')]){_0xa261ae[_0x5d77('0x40')][_0x5d77('0x38')]=encryptor[_0x5d77('0x45')](_0xa261ae[_0x5d77('0x40')][_0x5d77('0x38')]);}return db[_0x5d77('0x1d')][_0x5d77('0x3f')](_0xa261ae[_0x5d77('0x40')],{})[_0x5d77('0x14')](respondWithResult(_0x2e1732,0xc9))['catch'](handleError(_0x2e1732,null));};exports[_0x5d77('0x13')]=function(_0x458ec6,_0x167c2f){if(_0x458ec6[_0x5d77('0x40')]['id']){delete _0x458ec6['body']['id'];}return db[_0x5d77('0x1d')][_0x5d77('0x46')]({'where':{'id':_0x458ec6[_0x5d77('0x3b')]['id']}})[_0x5d77('0x14')](handleEntityNotFound(_0x167c2f,null))['then'](function(_0x145096){if(_0x145096[_0x5d77('0x36')]===_0x5d77('0x37')&&_0x458ec6['body']['data3']){_0x458ec6[_0x5d77('0x40')][_0x5d77('0x38')]=encryptor[_0x5d77('0x45')](_0x458ec6[_0x5d77('0x40')][_0x5d77('0x38')]);}return _0x145096;})[_0x5d77('0x14')](saveUpdates(_0x458ec6['body'],null))[_0x5d77('0x14')](respondWithResult(_0x167c2f,null))[_0x5d77('0x39')](handleError(_0x167c2f,null));};exports[_0x5d77('0x15')]=function(_0x9e3396,_0x5ebdde){return db[_0x5d77('0x1d')][_0x5d77('0x46')]({'where':{'id':_0x9e3396['params']['id']}})[_0x5d77('0x14')](handleEntityNotFound(_0x5ebdde,null))[_0x5d77('0x14')](removeEntity(_0x5ebdde,null))['catch'](handleError(_0x5ebdde,null));};exports[_0x5d77('0x47')]=function(_0x1f2db1,_0x6e39db){return db[_0x5d77('0x1d')][_0x5d77('0x48')]({'where':{'id':_0x1f2db1[_0x5d77('0x3b')]['id']},'raw':!![]})[_0x5d77('0x14')](function(_0x40d81e){if(!_0x40d81e)return _0x6e39db['sendStatus'](0x194);return{'url':oauth[_0x5d77('0x49')](_0x40d81e,_0x1f2db1[_0x5d77('0x4a')]['id'])};})[_0x5d77('0x14')](respondWithResult(_0x6e39db,null))[_0x5d77('0x39')](handleError(_0x6e39db,null));};exports[_0x5d77('0x4b')]=function(_0xdd4624,_0x3de496){var _0x1136ba=_0xdd4624[_0x5d77('0x40')];var _0x39deec;var _0x2a3a98;if(_0x1136ba[_0x5d77('0x4c')])throw _0x1136ba;redis[_0x5d77('0x4d')](_0x1136ba[_0x5d77('0x4e')])[_0x5d77('0x14')](function(_0x4f974a){if(!_0x4f974a)throw new Error(_0x5d77('0x4f'));_0x39deec=JSON[_0x5d77('0x50')](_0x4f974a);var _0x17c3ab=Buffer['from'](_0x1136ba[_0x5d77('0x4e')],'base64')[_0x5d77('0x51')](_0x5d77('0x52'));_0x2a3a98=JSON['parse'](_0x17c3ab);if(!oauth[_0x5d77('0x53')](_0x1136ba[_0x5d77('0x54')],_0x39deec['oauth2Claims']))throw new Error(_0x5d77('0x55'));redis['del'](_0x1136ba[_0x5d77('0x4e')]);return oauth[_0x5d77('0x56')](_0x1136ba[_0x5d77('0x57')],_0x39deec);})[_0x5d77('0x14')](function(_0x361bcd){_0x39deec[_0x5d77('0x58')]=_0x361bcd['access_token'];_0x39deec['data6']=_0x361bcd['refresh_token'];return db[_0x5d77('0x1d')][_0x5d77('0x13')]({'data5':_0x39deec[_0x5d77('0x58')],'data6':_0x39deec['data6']},{'where':{'id':_0x39deec['id']}});})[_0x5d77('0x14')](function(){oauth[_0x5d77('0x59')](_0x39deec);socket[_0x5d77('0x5a')](_0x5d77('0x5b'),{'id':_0x2a3a98['id']});return;})[_0x5d77('0x14')](respondWithStatusCode(_0x3de496,null))[_0x5d77('0x39')](function(_0xd5931c){if(_0x2a3a98){socket['emit'](_0x5d77('0x5c'),{'id':_0x2a3a98['id']});}if(!_0x39deec){logger[_0x5d77('0x4c')](_0x5d77('0x5d'),_0xd5931c);return _0x3de496['status'](0x1f4)[_0x5d77('0x18')](_0xd5931c['message']);}logger[_0x5d77('0x4c')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x39deec['id'],JSON['stringify'](_0xd5931c));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 1bd7232..e58e6c7 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 _0x375c=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x273ccb,_0x3af838){var _0x42a6c0=function(_0x10efa1){while(--_0x10efa1){_0x273ccb['push'](_0x273ccb['shift']());}};_0x42a6c0(++_0x3af838);}(_0x375c,0x1a3));var _0xc375=function(_0xea24cc,_0x410f40){_0xea24cc=_0xea24cc-0x0;var _0x5c8b26=_0x375c[_0xea24cc];return _0x5c8b26;};'use strict';var _=require(_0xc375('0x0'));var util=require(_0xc375('0x1'));var logger=require(_0xc375('0x2'))(_0xc375('0x3'));var moment=require('moment');var BPromise=require(_0xc375('0x4'));var rp=require(_0xc375('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc375('0x6'));var config=require(_0xc375('0x7'));var attributes=require(_0xc375('0x8'));module[_0xc375('0x9')]=function(_0x20f640,_0x30e1ed){return _0x20f640[_0xc375('0xa')](_0xc375('0xb'),attributes,{'tableName':_0xc375('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64e6=['exports','define','CloudProvider','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30156e,_0x4f5e62){var _0x3fdd6d=function(_0x2bf853){while(--_0x2bf853){_0x30156e['push'](_0x30156e['shift']());}};_0x3fdd6d(++_0x4f5e62);}(_0x64e6,0xdb));var _0x664e=function(_0x1478a4,_0x50b99f){_0x1478a4=_0x1478a4-0x0;var _0x5ee8f3=_0x64e6[_0x1478a4];return _0x5ee8f3;};'use strict';var _=require(_0x664e('0x0'));var util=require(_0x664e('0x1'));var logger=require(_0x664e('0x2'))(_0x664e('0x3'));var moment=require('moment');var BPromise=require(_0x664e('0x4'));var rp=require(_0x664e('0x5'));var fs=require('fs');var path=require(_0x664e('0x6'));var rimraf=require(_0x664e('0x7'));var config=require(_0x664e('0x8'));var attributes=require('./cloudProvider.attributes');module[_0x664e('0x9')]=function(_0x3b610b,_0x46f2c4){return _0x3b610b[_0x664e('0xa')](_0x664e('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index a9b6241..c4d8430 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 _0x1789=['jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','/.default','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','data1','response_type','join','redirect_uri','data4','form_post','state','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','data3','CloudProvider','then','data6','POST','access_token','refresh_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','replace','intervals','bind','findAll','all','inspect','exports'];(function(_0x182ded,_0x5e0182){var _0x4d1f14=function(_0x4f6456){while(--_0x4f6456){_0x182ded['push'](_0x182ded['shift']());}};_0x4d1f14(++_0x5e0182);}(_0x1789,0x1ec));var _0x9178=function(_0x2ed88f,_0x5bc5ae){_0x2ed88f=_0x2ed88f-0x0;var _0x17ca96=_0x1789[_0x2ed88f];return _0x17ca96;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x9178('0x0'));var moment=require('moment');var Redis=require(_0x9178('0x1'));var rp=require(_0x9178('0x2'));var util=require(_0x9178('0x3'));var encryptor=require(_0x9178('0x4'));var config=require(_0x9178('0x5'));var logger=require(_0x9178('0x6'))(_0x9178('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x9178('0x8'))['db'];config[_0x9178('0x9')]=_[_0x9178('0xa')](config[_0x9178('0x9')],{'host':_0x9178('0xb'),'port':0x18eb});var redis=new Redis(config[_0x9178('0x9')]);var MICROSOFT_AUTH_URL=_0x9178('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9178('0xd'),_0x9178('0xe'),_0x9178('0xf'),_0x9178('0x10'),_0x9178('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0x9178('0x12')],'Dynamics365':[_0x9178('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x9178('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x9178('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1aa2fd){var _0x324802=_[_0x9178('0x15')](AZURE_AUTH_SCOPES[_0x1aa2fd[_0x9178('0x16')]]);if(_0x1aa2fd[_0x9178('0x16')]===_0x9178('0x17'))_0x324802['push'](_0x1aa2fd[_0x9178('0x18')]+_0x9178('0x19'));return _0x324802['join']('\x20');}function getAccessTokenScope(_0x2e8850){if(_0x2e8850[_0x9178('0x16')]===_0x9178('0x1a'))return _0x9178('0x11');if(_0x2e8850[_0x9178('0x16')]===_0x9178('0x17'))return _0x2e8850['data7']+_0x9178('0x19');}function generateMicrosoftAuthorizationUrl(_0x5a62ec,_0x5001ac){var _0x88a071=MICROSOFT_AUTH_URL['replace'](_0x9178('0x1b'),_0x5a62ec[_0x9178('0x1c')]);var _0x29435c=[_0x9178('0x1d'),_0x9178('0x1e')];var _0x284d0e=Buffer[_0x9178('0x1f')](JSON[_0x9178('0x20')]({'id':_0x5001ac}))[_0x9178('0x21')](_0x9178('0x22'));var _0x315658=crypto[_0x9178('0x23')](0x10)[_0x9178('0x21')]('hex');var _0xcf23c2=getAuthorizationScopes(_0x5a62ec);var _0x134857=[{'key':_0x9178('0x24'),'value':_0x5a62ec[_0x9178('0x25')]},{'key':_0x9178('0x26'),'value':encodeURIComponent(_0x29435c[_0x9178('0x27')]('\x20'))},{'key':_0x9178('0x28'),'value':_0x5a62ec[_0x9178('0x29')]},{'key':'response_mode','value':_0x9178('0x2a')},{'key':'scope','value':encodeURIComponent(_0xcf23c2)},{'key':_0x9178('0x2b'),'value':_0x284d0e},{'key':'nonce','value':_0x315658},{'key':_0x9178('0x2c'),'value':_0x9178('0x2d')}];var _0x3377e2=_0x88a071+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9178('0x15')](_0x134857,function(_0x3395ca){return _0x3395ca[_0x9178('0x2e')]+'='+_0x3395ca[_0x9178('0x2f')];})[_0x9178('0x27')]('&');_0x5a62ec[_0x9178('0x30')]={'issuer':_0x88a071['replace'](_0x9178('0x31'),''),'audience':_0x5a62ec['data1'],'state':_0x284d0e,'nonce':_0x315658};redis[_0x9178('0x32')](_0x284d0e,JSON[_0x9178('0x20')](_0x5a62ec));return _0x3377e2;}function isValidIdToken(_0x42a757,_0x5b6ba4){try{var _0x124e72=jwt[_0x9178('0x33')](_0x42a757,{'complete':!![]});var _0x2c49d2=_0x124e72[_0x9178('0x34')];if(_0x2c49d2[_0x9178('0x35')]!==_0x5b6ba4[_0x9178('0x36')])return![];if(_0x2c49d2[_0x9178('0x37')]!==_0x5b6ba4[_0x9178('0x38')])return![];if(_0x2c49d2[_0x9178('0x39')]!==_0x5b6ba4[_0x9178('0x39')])return![];if(moment()[_0x9178('0x3a')](moment[_0x9178('0x3b')](_0x2c49d2[_0x9178('0x3c')])))return![];return!![];}catch(_0x3b5042){throw _0x3b5042;}}function refreshOauth2MicrosoftAccessToken(_0x281673){return Promise[_0x9178('0x3d')]()['then'](function(){if(_0x281673[_0x9178('0x3e')])return _0x281673;return db[_0x9178('0x3f')]['findOne']({'where':{'id':_0x281673['id']},'raw':!![]});})[_0x9178('0x40')](function(_0x16007d){var _0x41347f={'grant_type':'refresh_token','refresh_token':_0x16007d[_0x9178('0x41')],'scope':getAccessTokenScope(_0x16007d),'redirect_uri':_0x16007d['data4'],'client_id':_0x16007d[_0x9178('0x25')],'client_secret':encryptor['decryptString'](_0x16007d['data3'])};var _0x260b7a={'method':_0x9178('0x42'),'uri':MICROSOFT_AUTH_URL['replace'](_0x9178('0x1b'),_0x16007d['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x41347f,'json':!![]};return rp(_0x260b7a);})['then'](function(_0x5561f3){_0x281673['data5']=_0x5561f3[_0x9178('0x43')];_0x281673[_0x9178('0x41')]=_0x5561f3[_0x9178('0x44')];return db['CloudProvider'][_0x9178('0x45')]({'data5':_0x281673[_0x9178('0x46')],'data6':_0x281673['data6']},{'where':{'id':_0x281673['id']}});})[_0x9178('0x40')](function(){return _0x281673;})[_0x9178('0x47')](function(_0xa51cf3){logger[_0x9178('0x48')](_0x9178('0x49'),_0x281673['id'],_0xa51cf3);});}function getOauth2MicrosoftAccessToken(_0x2c682c,_0x17e543){var _0x26abd9={'grant_type':'authorization_code','code':_0x2c682c,'scope':getAccessTokenScope(_0x17e543),'redirect_uri':_0x17e543[_0x9178('0x29')],'client_id':_0x17e543[_0x9178('0x25')],'client_secret':encryptor[_0x9178('0x4a')](_0x17e543[_0x9178('0x3e')])};var _0x2ed339={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x9178('0x4b')](_0x9178('0x1b'),_0x17e543[_0x9178('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x26abd9,'json':!![]};return rp(_0x2ed339);}function startRefreshInterval(_0x1e8455){var _0x37d0ac=schedule[_0x9178('0x4c')];if(_0x37d0ac[_0x1e8455['id']])clearInterval(_0x37d0ac[_0x1e8455['id']]);_0x37d0ac[_0x1e8455['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9178('0x4d')](this,{'id':_0x1e8455['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x37d0ac;}function startAllRefreshIntervals(){return db[_0x9178('0x3f')][_0x9178('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9178('0x40')](function(_0x50fb95){var _0x2b8e46=_0x50fb95[_0x9178('0x15')](function(_0x28afdb){return refreshOauth2MicrosoftAccessToken(_0x28afdb)[_0x9178('0x40')](function(_0x82ec46){startRefreshInterval(_0x82ec46);});});return Promise[_0x9178('0x4f')](_0x2b8e46);})[_0x9178('0x47')](function(_0x311f74){var _0x271a11=_0x311f74?util[_0x9178('0x50')](_0x311f74,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x271a11);});}module[_0x9178('0x51')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xebc6=['defaults','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','map','type','Dynamics365','data7','/.default','join','Outlook365','data2','id_token','stringify','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','response_mode','state','prompt','login','value','oauth2Claims','replace','oauth2/','set','decode','payload','iss','issuer','aud','audience','nonce','unix','exp','resolve','then','CloudProvider','refresh_token','data6','data1','decryptString','data3','POST','{TENANT_ID}','access_token','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis'];(function(_0x189a31,_0xc76d59){var _0x5c130a=function(_0x4a5cb4){while(--_0x4a5cb4){_0x189a31['push'](_0x189a31['shift']());}};_0x5c130a(++_0xc76d59);}(_0xebc6,0x11c));var _0x6ebc=function(_0x43a882,_0x1212b0){_0x43a882=_0x43a882-0x0;var _0x5b3ca5=_0xebc6[_0x43a882];return _0x5b3ca5;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x6ebc('0x0'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x6ebc('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x6ebc('0x2'));var logger=require(_0x6ebc('0x3'))(_0x6ebc('0x4'));var schedule=require(_0x6ebc('0x5'));var db=require(_0x6ebc('0x6'))['db'];config[_0x6ebc('0x7')]=_[_0x6ebc('0x8')](config[_0x6ebc('0x7')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x6ebc('0x7')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x6ebc('0x9'),_0x6ebc('0xa'),_0x6ebc('0xb'),_0x6ebc('0xc'),_0x6ebc('0xd'),_0x6ebc('0xe'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x6ebc('0x9'),_0x6ebc('0xc')]};var MICROSOFT_AUTH_ENDPOINT=_0x6ebc('0xf');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2439dc){var _0xb5dd1e=_[_0x6ebc('0x10')](AZURE_AUTH_SCOPES[_0x2439dc[_0x6ebc('0x11')]]);if(_0x2439dc['type']===_0x6ebc('0x12'))_0xb5dd1e['push'](_0x2439dc[_0x6ebc('0x13')]+_0x6ebc('0x14'));return _0xb5dd1e[_0x6ebc('0x15')]('\x20');}function getAccessTokenScope(_0xd34a01){if(_0xd34a01[_0x6ebc('0x11')]===_0x6ebc('0x16'))return _0x6ebc('0xd');if(_0xd34a01['type']===_0x6ebc('0x12'))return _0xd34a01[_0x6ebc('0x13')]+_0x6ebc('0x14');}function generateMicrosoftAuthorizationUrl(_0x34957b,_0x31326c){var _0x3425a1=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x34957b[_0x6ebc('0x17')]);var _0x1e0383=['code',_0x6ebc('0x18')];var _0x29f582=Buffer['from'](JSON[_0x6ebc('0x19')]({'id':_0x31326c}))['toString'](_0x6ebc('0x1a'));var _0x2e7eae=crypto[_0x6ebc('0x1b')](0x10)['toString'](_0x6ebc('0x1c'));var _0x48a08c=getAuthorizationScopes(_0x34957b);var _0x5bbc9d=[{'key':_0x6ebc('0x1d'),'value':_0x34957b['data1']},{'key':_0x6ebc('0x1e'),'value':encodeURIComponent(_0x1e0383[_0x6ebc('0x15')]('\x20'))},{'key':_0x6ebc('0x1f'),'value':_0x34957b[_0x6ebc('0x20')]},{'key':_0x6ebc('0x21'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x48a08c)},{'key':_0x6ebc('0x22'),'value':_0x29f582},{'key':'nonce','value':_0x2e7eae},{'key':_0x6ebc('0x23'),'value':_0x6ebc('0x24')}];var _0x38fb31=_0x3425a1+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x5bbc9d,function(_0x372f1e){return _0x372f1e['key']+'='+_0x372f1e[_0x6ebc('0x25')];})['join']('&');_0x34957b[_0x6ebc('0x26')]={'issuer':_0x3425a1[_0x6ebc('0x27')](_0x6ebc('0x28'),''),'audience':_0x34957b['data1'],'state':_0x29f582,'nonce':_0x2e7eae};redis[_0x6ebc('0x29')](_0x29f582,JSON[_0x6ebc('0x19')](_0x34957b));return _0x38fb31;}function isValidIdToken(_0x42f136,_0x1a593b){try{var _0xf56c28=jwt[_0x6ebc('0x2a')](_0x42f136,{'complete':!![]});var _0x2bed2f=_0xf56c28[_0x6ebc('0x2b')];if(_0x2bed2f[_0x6ebc('0x2c')]!==_0x1a593b[_0x6ebc('0x2d')])return![];if(_0x2bed2f[_0x6ebc('0x2e')]!==_0x1a593b[_0x6ebc('0x2f')])return![];if(_0x2bed2f[_0x6ebc('0x30')]!==_0x1a593b[_0x6ebc('0x30')])return![];if(moment()['isAfter'](moment[_0x6ebc('0x31')](_0x2bed2f[_0x6ebc('0x32')])))return![];return!![];}catch(_0x363418){throw _0x363418;}}function refreshOauth2MicrosoftAccessToken(_0x5d9ea3){return Promise[_0x6ebc('0x33')]()[_0x6ebc('0x34')](function(){if(_0x5d9ea3['data3'])return _0x5d9ea3;return db[_0x6ebc('0x35')]['findOne']({'where':{'id':_0x5d9ea3['id']},'raw':!![]});})[_0x6ebc('0x34')](function(_0x3f36e){var _0x28d24f={'grant_type':_0x6ebc('0x36'),'refresh_token':_0x3f36e[_0x6ebc('0x37')],'scope':getAccessTokenScope(_0x3f36e),'redirect_uri':_0x3f36e['data4'],'client_id':_0x3f36e[_0x6ebc('0x38')],'client_secret':encryptor[_0x6ebc('0x39')](_0x3f36e[_0x6ebc('0x3a')])};var _0x55a28f={'method':_0x6ebc('0x3b'),'uri':MICROSOFT_AUTH_URL['replace'](_0x6ebc('0x3c'),_0x3f36e[_0x6ebc('0x17')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28d24f,'json':!![]};return rp(_0x55a28f);})[_0x6ebc('0x34')](function(_0x34854c){_0x5d9ea3['data5']=_0x34854c[_0x6ebc('0x3d')];_0x5d9ea3[_0x6ebc('0x37')]=_0x34854c[_0x6ebc('0x36')];return db[_0x6ebc('0x35')][_0x6ebc('0x3e')]({'data5':_0x5d9ea3[_0x6ebc('0x3f')],'data6':_0x5d9ea3[_0x6ebc('0x37')]},{'where':{'id':_0x5d9ea3['id']}});})[_0x6ebc('0x34')](function(){return _0x5d9ea3;})['catch'](function(_0x23d8c7){logger[_0x6ebc('0x40')](_0x6ebc('0x41'),_0x5d9ea3['id'],_0x23d8c7);});}function getOauth2MicrosoftAccessToken(_0x7768f4,_0x5c7949){var _0xaf090b={'grant_type':_0x6ebc('0x42'),'code':_0x7768f4,'scope':getAccessTokenScope(_0x5c7949),'redirect_uri':_0x5c7949['data4'],'client_id':_0x5c7949[_0x6ebc('0x38')],'client_secret':encryptor['decryptString'](_0x5c7949[_0x6ebc('0x3a')])};var _0x4cc3a5={'method':_0x6ebc('0x3b'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x5c7949[_0x6ebc('0x17')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xaf090b,'json':!![]};return rp(_0x4cc3a5);}function startRefreshInterval(_0x4794bf){var _0x13c7f7=schedule[_0x6ebc('0x43')];if(_0x13c7f7[_0x4794bf['id']])clearInterval(_0x13c7f7[_0x4794bf['id']]);_0x13c7f7[_0x4794bf['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x4794bf['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x6ebc('0x43')]=_0x13c7f7;}function startAllRefreshIntervals(){return db[_0x6ebc('0x35')][_0x6ebc('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x6ebc('0x34')](function(_0x1034f8){var _0x3d2492=_0x1034f8[_0x6ebc('0x10')](function(_0x1cf1bb){return refreshOauth2MicrosoftAccessToken(_0x1cf1bb)[_0x6ebc('0x34')](function(_0x148b00){startRefreshInterval(_0x148b00);});});return Promise[_0x6ebc('0x45')](_0x3d2492);})['catch'](function(_0x20e083){var _0x32e0e9=_0x20e083?util[_0x6ebc('0x46')](_0x20e083,{'showHidden':![],'depth':null}):'';logger[_0x6ebc('0x40')](_0x6ebc('0x47'),_0x32e0e9);});}module[_0x6ebc('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 37c6409..ed94734 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 _0x288a=['jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x2b073d,_0x336089){var _0x3d99c2=function(_0x49d90){while(--_0x49d90){_0x2b073d['push'](_0x2b073d['shift']());}};_0x3d99c2(++_0x336089);}(_0x288a,0x188));var _0xa288=function(_0x3bc431,_0x4dda88){_0x3bc431=_0x3bc431-0x0;var _0x14a200=_0x288a[_0x3bc431];return _0x14a200;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var moment=require(_0xa288('0x1'));var BPromise=require(_0xa288('0x2'));var rs=require(_0xa288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa288('0x4'));var logger=require('../../config/logger')(_0xa288('0x5'));var config=require(_0xa288('0x6'));var jayson=require(_0xa288('0x7'));var client=jayson['client'][_0xa288('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaee90c,_0x156720,_0x57f445){return new BPromise(function(_0x14e4a6,_0x1e8412){return client[_0xa288('0x9')](_0xaee90c,_0x57f445)[_0xa288('0xa')](function(_0x1a0c06){logger[_0xa288('0xb')](_0xa288('0xc'),_0x156720,_0xa288('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x156720,'request\x20sent',JSON[_0xa288('0xe')](_0x1a0c06));if(_0x1a0c06[_0xa288('0xf')]){if(_0x1a0c06['error'][_0xa288('0x10')]===0x1f4){logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);return _0x1e8412(_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);}logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);return _0x14e4a6(_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);}else{logger[_0xa288('0xb')](_0xa288('0xc'),_0x156720,_0xa288('0xd'));_0x14e4a6(_0x1a0c06['result'][_0xa288('0x11')]);}})[_0xa288('0x12')](function(_0x299ede){logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x299ede);_0x1e8412(_0x299ede);});});} \ No newline at end of file +var _0xdec3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x5c1bdf,_0x336d29){var _0x1a0f8d=function(_0x2e9bf0){while(--_0x2e9bf0){_0x5c1bdf['push'](_0x5c1bdf['shift']());}};_0x1a0f8d(++_0x336d29);}(_0xdec3,0x89));var _0x3dec=function(_0x455a49,_0x441ef7){_0x455a49=_0x455a49-0x0;var _0x2c1e7a=_0xdec3[_0x455a49];return _0x2c1e7a;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var moment=require(_0x3dec('0x1'));var BPromise=require(_0x3dec('0x2'));var rs=require(_0x3dec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dec('0x4'))['db'];var utils=require(_0x3dec('0x5'));var logger=require(_0x3dec('0x6'))(_0x3dec('0x7'));var config=require('../../config/environment');var jayson=require(_0x3dec('0x8'));var client=jayson[_0x3dec('0x9')][_0x3dec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd3208e,_0x1826ab,_0x311a74){return new BPromise(function(_0x207dcf,_0x4b32d2){return client[_0x3dec('0xb')](_0xd3208e,_0x311a74)[_0x3dec('0xc')](function(_0x599552){logger[_0x3dec('0xd')]('CloudProvider,\x20%s,\x20%s',_0x1826ab,'request\x20sent');logger[_0x3dec('0xe')](_0x3dec('0xf'),_0x1826ab,'request\x20sent',JSON[_0x3dec('0x10')](_0x599552));if(_0x599552[_0x3dec('0x11')]){if(_0x599552['error'][_0x3dec('0x12')]===0x1f4){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x599552[_0x3dec('0x11')][_0x3dec('0x14')]);return _0x4b32d2(_0x599552[_0x3dec('0x11')]['message']);}logger['error'](_0x3dec('0x13'),_0x1826ab,_0x599552['error'][_0x3dec('0x14')]);return _0x207dcf(_0x599552[_0x3dec('0x11')]['message']);}else{logger['info'](_0x3dec('0x13'),_0x1826ab,'request\x20sent');_0x207dcf(_0x599552[_0x3dec('0x15')]['message']);}})[_0x3dec('0x16')](function(_0x51cb2c){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x51cb2c);_0x4b32d2(_0x51cb2c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index eac6c57..a17301b 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(_0x39cc01,_0x4163f5){var _0x131c09=function(_0x112538){while(--_0x112538){_0x39cc01['push'](_0x39cc01['shift']());}};_0x131c09(++_0x4163f5);}(_0xadb5,0xad));var _0x5adb=function(_0x10a518,_0x59bdbb){_0x10a518=_0x10a518-0x0;var _0x23f223=_0xadb5[_0x10a518];return _0x23f223;};'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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x1fd0e9,_0x1b4490){var _0xe6251f=function(_0xc9a345){while(--_0xc9a345){_0x1fd0e9['push'](_0x1fd0e9['shift']());}};_0xe6251f(++_0x1b4490);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);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 0c4cb8e..238c863 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 _0x9033=['name','sequelize','STRING'];(function(_0x41d656,_0x299008){var _0x28025b=function(_0x171d15){while(--_0x171d15){_0x41d656['push'](_0x41d656['shift']());}};_0x28025b(++_0x299008);}(_0x9033,0xf7));var _0x3903=function(_0x31cd64,_0x2315f2){_0x31cd64=_0x31cd64-0x0;var _0x1e2106=_0x9033[_0x31cd64];return _0x1e2106;};'use strict';var Sequelize=require(_0x3903('0x0'));module['exports']={'name':{'type':Sequelize[_0x3903('0x1')],'unique':_0x3903('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3903('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3903('0x1')]},'fax':{'type':Sequelize[_0x3903('0x1')]},'type':{'type':Sequelize[_0x3903('0x1')]},'street':{'type':Sequelize[_0x3903('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3903('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3903('0x1')]},'sPostalCode':{'type':Sequelize[_0x3903('0x1')]},'sCity':{'type':Sequelize[_0x3903('0x1')]},'sCountry':{'type':Sequelize[_0x3903('0x1')]},'description':{'type':Sequelize[_0x3903('0x1')]}}; \ No newline at end of file +var _0xa75b=['name','STRING'];(function(_0x185807,_0x3e7706){var _0x1b9d80=function(_0x4efaaf){while(--_0x4efaaf){_0x185807['push'](_0x185807['shift']());}};_0x1b9d80(++_0x3e7706);}(_0xa75b,0x1c1));var _0xba75=function(_0xea83d2,_0x1a6895){_0xea83d2=_0xea83d2-0x0;var _0x620f79=_0xa75b[_0xea83d2];return _0x620f79;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xba75('0x0')],'unique':_0xba75('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xba75('0x0')]},'website':{'type':Sequelize[_0xba75('0x0')]},'phone':{'type':Sequelize[_0xba75('0x0')]},'fax':{'type':Sequelize[_0xba75('0x0')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xba75('0x0')]},'postalCode':{'type':Sequelize[_0xba75('0x0')]},'city':{'type':Sequelize[_0xba75('0x0')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xba75('0x0')]},'sStreet':{'type':Sequelize[_0xba75('0x0')]},'sPostalCode':{'type':Sequelize[_0xba75('0x0')]},'sCity':{'type':Sequelize[_0xba75('0x0')]},'sCountry':{'type':Sequelize[_0xba75('0x0')]},'description':{'type':Sequelize[_0xba75('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f47bedc..2e36118 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 _0x878c=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Companies','UserProfileSection','userProfileId','UserProfileResource','destroy','addContacts','CmContact','omit','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body'];(function(_0x315d69,_0x1a9224){var _0x599dca=function(_0x51feeb){while(--_0x51feeb){_0x315d69['push'](_0x315d69['shift']());}};_0x599dca(++_0x1a9224);}(_0x878c,0x11a));var _0xc878=function(_0x1168e6,_0x4580fc){_0x1168e6=_0x1168e6-0x0;var _0x27c4c2=_0x878c[_0x1168e6];return _0x27c4c2;};'use strict';var emlformat=require(_0xc878('0x0'));var rimraf=require(_0xc878('0x1'));var zipdir=require(_0xc878('0x2'));var jsonpatch=require(_0xc878('0x3'));var rp=require(_0xc878('0x4'));var moment=require(_0xc878('0x5'));var BPromise=require(_0xc878('0x6'));var Mustache=require(_0xc878('0x7'));var util=require('util');var path=require(_0xc878('0x8'));var sox=require('sox');var csv=require(_0xc878('0x9'));var ejs=require(_0xc878('0xa'));var fs=require('fs');var fs_extra=require(_0xc878('0xb'));var _=require(_0xc878('0xc'));var squel=require(_0xc878('0xd'));var crypto=require(_0xc878('0xe'));var jsforce=require(_0xc878('0xf'));var deskjs=require(_0xc878('0x10'));var toCsv=require(_0xc878('0x9'));var querystring=require(_0xc878('0x11'));var Papa=require('papaparse');var Redis=require(_0xc878('0x12'));var authService=require(_0xc878('0x13'));var qs=require(_0xc878('0x14'));var as=require(_0xc878('0x15'));var hardwareService=require(_0xc878('0x16'));var logger=require(_0xc878('0x17'))(_0xc878('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc878('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46dcde,_0x9b5234){_0x9b5234=_0x9b5234||0xcc;return function(_0x243814){if(_0x243814){return _0x46dcde['sendStatus'](_0x9b5234);}return _0x46dcde[_0xc878('0x1a')](_0x9b5234)[_0xc878('0x1b')]();};}function respondWithResult(_0x25e601,_0x2ae75c){_0x2ae75c=_0x2ae75c||0xc8;return function(_0x419c8d){if(_0x419c8d){return _0x25e601[_0xc878('0x1a')](_0x2ae75c)[_0xc878('0x1c')](_0x419c8d);}};}function respondWithFilteredResult(_0x4f34dc,_0x113d2f){return function(_0x3a0c54){if(_0x3a0c54){var _0x5b891d=typeof _0x113d2f[_0xc878('0x1d')]===_0xc878('0x1e')&&typeof _0x113d2f[_0xc878('0x1f')]===_0xc878('0x1e');var _0x7609ba=_0x3a0c54[_0xc878('0x20')];var _0x115c58=_0x5b891d?0x0:_0x113d2f[_0xc878('0x1d')];var _0x52cdee=_0x5b891d?_0x3a0c54[_0xc878('0x20')]:_0x113d2f[_0xc878('0x1d')]+_0x113d2f[_0xc878('0x1f')];var _0x40afd0;if(_0x52cdee>=_0x7609ba){_0x52cdee=_0x7609ba;_0x40afd0=0xc8;}else{_0x40afd0=0xce;}_0x4f34dc[_0xc878('0x1a')](_0x40afd0);return _0x4f34dc[_0xc878('0x21')](_0xc878('0x22'),_0x115c58+'-'+_0x52cdee+'/'+_0x7609ba)[_0xc878('0x1c')](_0x3a0c54);}return null;};}function patchUpdates(_0x577359){return function(_0x5386b0){try{jsonpatch[_0xc878('0x23')](_0x5386b0,_0x577359,!![]);}catch(_0x1888ec){return BPromise[_0xc878('0x24')](_0x1888ec);}return _0x5386b0[_0xc878('0x25')]();};}function saveUpdates(_0x4196a7,_0x3df6c4){return function(_0x365058){if(_0x365058){return _0x365058[_0xc878('0x26')](_0x4196a7)[_0xc878('0x27')](function(_0x4e5d98){return _0x4e5d98;});}return null;};}function removeEntity(_0x2c26d7,_0x14cbfb){return function(_0x98e36e){if(_0x98e36e){return _0x98e36e['destroy']()[_0xc878('0x27')](function(){var _0x3d015d=_0x98e36e['get']({'plain':!![]});var _0x2ac7ab='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x2ac7ab,'resourceId':_0x3d015d['id']}})[_0xc878('0x27')](function(){return _0x98e36e;});})[_0xc878('0x27')](function(){_0x2c26d7[_0xc878('0x1a')](0xcc)[_0xc878('0x1b')]();});}};}function handleEntityNotFound(_0xace4d9,_0x53cee1){return function(_0x3a830a){if(!_0x3a830a){_0xace4d9[_0xc878('0x28')](0x194);}return _0x3a830a;};}function handleError(_0x460bef,_0xabb6e2){_0xabb6e2=_0xabb6e2||0x1f4;return function(_0x3584db){logger[_0xc878('0x29')](_0x3584db[_0xc878('0x2a')]);if(_0x3584db[_0xc878('0x2b')]){delete _0x3584db[_0xc878('0x2b')];}_0x460bef[_0xc878('0x1a')](_0xabb6e2)['send'](_0x3584db);};}exports[_0xc878('0x2c')]=function(_0xf60bcc,_0xe3e19c){var _0x5843b3={},_0x4c21fb={},_0x248b05={'count':0x0,'rows':[]};return db[_0xc878('0x2d')][_0xc878('0x2e')]()[_0xc878('0x27')](function(_0x8a58b4){_0x4c21fb[_0xc878('0x2f')]=_[_0xc878('0x30')](_0x8a58b4);_0x4c21fb[_0xc878('0x31')]=_[_0xc878('0x30')](_0xf60bcc['query']);_0x4c21fb[_0xc878('0x32')]=_[_0xc878('0x33')](_0x4c21fb[_0xc878('0x2f')],_0x4c21fb['query']);_0x5843b3[_0xc878('0x34')]=_['intersection'](_0x4c21fb['model'],qs[_0xc878('0x35')](_0xf60bcc[_0xc878('0x31')][_0xc878('0x35')]));_0x5843b3['attributes']=_0x5843b3[_0xc878('0x34')]['length']?_0x5843b3['attributes']:_0x4c21fb[_0xc878('0x2f')];if(!_0xf60bcc[_0xc878('0x31')][_0xc878('0x36')]('nolimit')){_0x5843b3[_0xc878('0x1f')]=qs['limit'](_0xf60bcc[_0xc878('0x31')][_0xc878('0x1f')]);_0x5843b3['offset']=qs[_0xc878('0x1d')](_0xf60bcc[_0xc878('0x31')][_0xc878('0x1d')]);}_0x5843b3[_0xc878('0x37')]=qs[_0xc878('0x38')](_0xf60bcc[_0xc878('0x31')][_0xc878('0x38')]);_0x5843b3[_0xc878('0x39')]=qs[_0xc878('0x32')](_[_0xc878('0x3a')](_0xf60bcc[_0xc878('0x31')],_0x4c21fb[_0xc878('0x32')]),_0x8a58b4);if(_0xf60bcc[_0xc878('0x31')][_0xc878('0x3b')]){_0x5843b3['where']=_[_0xc878('0x3c')](_0x5843b3[_0xc878('0x39')],{'$or':_[_0xc878('0x3d')](_0x5843b3[_0xc878('0x34')],function(_0x49e3d3){var _0x16d49d={};_0x16d49d[_0x49e3d3]={'$like':'%'+_0xf60bcc[_0xc878('0x31')]['filter']+'%'};return _0x16d49d;})});}_0x5843b3=_[_0xc878('0x3c')]({},_0x5843b3,_0xf60bcc[_0xc878('0x3e')]);var _0x233b0a={'where':_0x5843b3[_0xc878('0x39')]};return db[_0xc878('0x2d')][_0xc878('0x20')](_0x233b0a)[_0xc878('0x27')](function(_0x578dad){_0x248b05['count']=_0x578dad;if(_0xf60bcc[_0xc878('0x31')][_0xc878('0x3f')]){_0x5843b3[_0xc878('0x40')]=[{'all':!![]}];}return db[_0xc878('0x2d')][_0xc878('0x41')](_0x5843b3);})['then'](function(_0x5eb89c){_0x248b05[_0xc878('0x42')]=_0x5eb89c;return _0x248b05;})[_0xc878('0x27')](respondWithFilteredResult(_0xe3e19c,_0x5843b3))['catch'](handleError(_0xe3e19c,null));})[_0xc878('0x43')](handleError(_0xe3e19c,null));};exports['show']=function(_0x3dd40e,_0x3c1aaa){var _0x319750={'raw':![],'where':{'id':_0x3dd40e[_0xc878('0x44')]['id']}},_0xd29016={};_0xd29016[_0xc878('0x2f')]=_[_0xc878('0x30')](db[_0xc878('0x2d')][_0xc878('0x45')]);_0xd29016[_0xc878('0x31')]=_[_0xc878('0x30')](_0x3dd40e['query']);_0xd29016[_0xc878('0x32')]=_[_0xc878('0x33')](_0xd29016['model'],_0xd29016['query']);_0x319750[_0xc878('0x34')]=_[_0xc878('0x33')](_0xd29016[_0xc878('0x2f')],qs[_0xc878('0x35')](_0x3dd40e[_0xc878('0x31')][_0xc878('0x35')]));_0x319750['attributes']=_0x319750[_0xc878('0x34')][_0xc878('0x46')]?_0x319750[_0xc878('0x34')]:_0xd29016[_0xc878('0x2f')];if(_0x3dd40e['query']['includeAll']){_0x319750[_0xc878('0x40')]=[{'all':!![]}];}_0x319750=_[_0xc878('0x3c')]({},_0x319750,_0x3dd40e[_0xc878('0x3e')]);return db[_0xc878('0x2d')][_0xc878('0x47')](_0x319750)['then'](handleEntityNotFound(_0x3c1aaa,null))['then'](respondWithResult(_0x3c1aaa,null))[_0xc878('0x43')](handleError(_0x3c1aaa,null));};exports[_0xc878('0x48')]=function(_0x113de2,_0x500c0a){return db[_0xc878('0x2d')][_0xc878('0x48')](_0x113de2[_0xc878('0x49')],{})[_0xc878('0x27')](function(_0x467ddc){var _0x1052b8=_0x113de2['user'][_0xc878('0x4a')]({'plain':!![]});if(!_0x1052b8)throw new Error(_0xc878('0x4b'));if(_0x1052b8[_0xc878('0x4c')]===_0xc878('0x4d')){var _0x3cbde0=_0x467ddc['get']({'plain':!![]});var _0x5a37b9=_0xc878('0x4e');return db[_0xc878('0x4f')][_0xc878('0x47')]({'where':{'name':_0x5a37b9,'userProfileId':_0x1052b8[_0xc878('0x50')]},'raw':!![]})[_0xc878('0x27')](function(_0x52e4c4){if(_0x52e4c4&&_0x52e4c4['autoAssociation']===0x0){return db[_0xc878('0x51')]['create']({'name':_0x3cbde0[_0xc878('0x2b')],'resourceId':_0x3cbde0['id'],'type':_0x52e4c4[_0xc878('0x2b')],'sectionId':_0x52e4c4['id']},{})['then'](function(){return _0x467ddc;});}else{return _0x467ddc;}})[_0xc878('0x43')](function(_0x1dded0){logger[_0xc878('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dded0);throw _0x1dded0;});}return _0x467ddc;})[_0xc878('0x27')](respondWithResult(_0x500c0a,0xc9))['catch'](handleError(_0x500c0a,null));};exports['update']=function(_0x3b9a08,_0xd3b72d){if(_0x3b9a08[_0xc878('0x49')]['id']){delete _0x3b9a08[_0xc878('0x49')]['id'];}return db[_0xc878('0x2d')]['find']({'where':{'id':_0x3b9a08[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0xd3b72d,null))[_0xc878('0x27')](saveUpdates(_0x3b9a08[_0xc878('0x49')],null))[_0xc878('0x27')](respondWithResult(_0xd3b72d,null))['catch'](handleError(_0xd3b72d,null));};exports[_0xc878('0x52')]=function(_0x37a3f6,_0x16a9ab){return db[_0xc878('0x2d')][_0xc878('0x47')]({'where':{'id':_0x37a3f6[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0x16a9ab,null))[_0xc878('0x27')](removeEntity(_0x16a9ab,null))[_0xc878('0x43')](handleError(_0x16a9ab,null));};exports['describe']=function(_0x45aba2,_0x36bc9a){return db[_0xc878('0x2d')][_0xc878('0x2e')]()[_0xc878('0x27')](respondWithResult(_0x36bc9a,null))['catch'](handleError(_0x36bc9a,null));};exports[_0xc878('0x53')]=function(_0x394175,_0x47d34e,_0x1deaac){return db[_0xc878('0x54')][_0xc878('0x47')]({'where':{'id':_0x394175[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0x47d34e,null))[_0xc878('0x27')](function(_0x3a9941){if(_0x3a9941){return _0x3a9941['addContacts'](_0x394175[_0xc878('0x49')]['ids'],_[_0xc878('0x55')](_0x394175[_0xc878('0x49')],[_0xc878('0x56'),'id'])||{});}})[_0xc878('0x27')](respondWithResult(_0x47d34e,null))['catch'](handleError(_0x47d34e,null));};exports[_0xc878('0x57')]=function(_0x33b85d,_0x4d9baf,_0x8abd2a){var _0x422404={};var _0x44e69f={};var _0x3120fb;var _0x37feb5;return db[_0xc878('0x2d')][_0xc878('0x58')]({'where':{'id':_0x33b85d[_0xc878('0x44')]['id']}})[_0xc878('0x27')](handleEntityNotFound(_0x4d9baf,null))[_0xc878('0x27')](function(_0x121f68){if(_0x121f68){_0x3120fb=_0x121f68;_0x44e69f[_0xc878('0x2f')]=_[_0xc878('0x30')](db['CmContact'][_0xc878('0x45')]);_0x44e69f[_0xc878('0x31')]=_['keys'](_0x33b85d[_0xc878('0x31')]);_0x44e69f[_0xc878('0x32')]=_[_0xc878('0x33')](_0x44e69f[_0xc878('0x2f')],_0x44e69f[_0xc878('0x31')]);_0x422404[_0xc878('0x34')]=_[_0xc878('0x33')](_0x44e69f['model'],qs[_0xc878('0x35')](_0x33b85d['query'][_0xc878('0x35')]));_0x422404[_0xc878('0x34')]=_0x422404['attributes'][_0xc878('0x46')]?_0x422404['attributes']:_0x44e69f[_0xc878('0x2f')];_0x422404['order']=qs[_0xc878('0x38')](_0x33b85d[_0xc878('0x31')][_0xc878('0x38')]);_0x422404[_0xc878('0x39')]=qs[_0xc878('0x32')](_['pick'](_0x33b85d[_0xc878('0x31')],_0x44e69f[_0xc878('0x32')]));if(_0x33b85d[_0xc878('0x31')][_0xc878('0x3b')]){_0x422404[_0xc878('0x39')]=_[_0xc878('0x3c')](_0x422404['where'],{'$or':_[_0xc878('0x3d')](_0x422404[_0xc878('0x34')],function(_0x1a9210){var _0x3c3481={};_0x3c3481[_0x1a9210]={'$like':'%'+_0x33b85d[_0xc878('0x31')][_0xc878('0x3b')]+'%'};return _0x3c3481;})});}_0x422404=_[_0xc878('0x3c')]({},_0x422404,_0x33b85d['options']);return _0x3120fb[_0xc878('0x57')](_0x422404);}})[_0xc878('0x27')](function(_0x7f17ab){if(_0x7f17ab){_0x37feb5=_0x7f17ab[_0xc878('0x46')];if(!_0x33b85d['query']['hasOwnProperty']('nolimit')){_0x422404[_0xc878('0x1f')]=qs[_0xc878('0x1f')](_0x33b85d[_0xc878('0x31')][_0xc878('0x1f')]);_0x422404['offset']=qs[_0xc878('0x1d')](_0x33b85d[_0xc878('0x31')][_0xc878('0x1d')]);}return _0x3120fb[_0xc878('0x57')](_0x422404);}})['then'](function(_0x579e68){if(_0x579e68){return _0x579e68?{'count':_0x37feb5,'rows':_0x579e68}:null;}})[_0xc878('0x27')](respondWithResult(_0x4d9baf,null))[_0xc878('0x43')](handleError(_0x4d9baf,null));}; \ No newline at end of file +var _0x71f7=['destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','CmCompany','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','omit','getContacts','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x71f7,0x1e3));var _0x771f=function(_0x115cda,_0x228388){_0x115cda=_0x115cda-0x0;var _0x50acc9=_0x71f7[_0x115cda];return _0x50acc9;};'use strict';var emlformat=require(_0x771f('0x0'));var rimraf=require(_0x771f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x771f('0x2'));var rp=require('request-promise');var moment=require(_0x771f('0x3'));var BPromise=require(_0x771f('0x4'));var Mustache=require(_0x771f('0x5'));var util=require('util');var path=require(_0x771f('0x6'));var sox=require(_0x771f('0x7'));var csv=require('to-csv');var ejs=require(_0x771f('0x8'));var fs=require('fs');var fs_extra=require(_0x771f('0x9'));var _=require(_0x771f('0xa'));var squel=require(_0x771f('0xb'));var crypto=require(_0x771f('0xc'));var jsforce=require(_0x771f('0xd'));var deskjs=require(_0x771f('0xe'));var toCsv=require(_0x771f('0xf'));var querystring=require('querystring');var Papa=require(_0x771f('0x10'));var Redis=require(_0x771f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x771f('0x12'));var as=require(_0x771f('0x13'));var hardwareService=require(_0x771f('0x14'));var logger=require(_0x771f('0x15'))(_0x771f('0x16'));var utils=require('../../config/utils');var config=require(_0x771f('0x17'));var licenseUtil=require(_0x771f('0x18'));var db=require(_0x771f('0x19'))['db'];function respondWithStatusCode(_0x4c9913,_0x137240){_0x137240=_0x137240||0xcc;return function(_0x4ab86b){if(_0x4ab86b){return _0x4c9913[_0x771f('0x1a')](_0x137240);}return _0x4c9913['status'](_0x137240)[_0x771f('0x1b')]();};}function respondWithResult(_0x11836a,_0x1a2372){_0x1a2372=_0x1a2372||0xc8;return function(_0x34845a){if(_0x34845a){return _0x11836a[_0x771f('0x1c')](_0x1a2372)[_0x771f('0x1d')](_0x34845a);}};}function respondWithFilteredResult(_0x5b9c83,_0xa9a3c9){return function(_0x500989){if(_0x500989){var _0x2b6d0b=typeof _0xa9a3c9[_0x771f('0x1e')]===_0x771f('0x1f')&&typeof _0xa9a3c9['limit']==='undefined';var _0x3b7e6a=_0x500989[_0x771f('0x20')];var _0xd23be1=_0x2b6d0b?0x0:_0xa9a3c9['offset'];var _0x564e48=_0x2b6d0b?_0x500989[_0x771f('0x20')]:_0xa9a3c9[_0x771f('0x1e')]+_0xa9a3c9[_0x771f('0x21')];var _0x1c40d7;if(_0x564e48>=_0x3b7e6a){_0x564e48=_0x3b7e6a;_0x1c40d7=0xc8;}else{_0x1c40d7=0xce;}_0x5b9c83[_0x771f('0x1c')](_0x1c40d7);return _0x5b9c83[_0x771f('0x22')](_0x771f('0x23'),_0xd23be1+'-'+_0x564e48+'/'+_0x3b7e6a)['json'](_0x500989);}return null;};}function patchUpdates(_0x1572a0){return function(_0x19af10){try{jsonpatch['apply'](_0x19af10,_0x1572a0,!![]);}catch(_0x283249){return BPromise['reject'](_0x283249);}return _0x19af10[_0x771f('0x24')]();};}function saveUpdates(_0x38cb4d,_0x3f0fa2){return function(_0x295111){if(_0x295111){return _0x295111[_0x771f('0x25')](_0x38cb4d)[_0x771f('0x26')](function(_0x2223d5){return _0x2223d5;});}return null;};}function removeEntity(_0x56b4c5,_0x219708){return function(_0x32be01){if(_0x32be01){return _0x32be01[_0x771f('0x27')]()[_0x771f('0x26')](function(){var _0x5062a8=_0x32be01[_0x771f('0x28')]({'plain':!![]});var _0x4099dd=_0x771f('0x29');return db[_0x771f('0x2a')][_0x771f('0x27')]({'where':{'type':_0x4099dd,'resourceId':_0x5062a8['id']}})[_0x771f('0x26')](function(){return _0x32be01;});})[_0x771f('0x26')](function(){_0x56b4c5[_0x771f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a446,_0x28cd4f){return function(_0x4b8023){if(!_0x4b8023){_0x28a446['sendStatus'](0x194);}return _0x4b8023;};}function handleError(_0x106a9d,_0x312bf5){_0x312bf5=_0x312bf5||0x1f4;return function(_0xf89d6c){logger[_0x771f('0x2b')](_0xf89d6c[_0x771f('0x2c')]);if(_0xf89d6c[_0x771f('0x2d')]){delete _0xf89d6c[_0x771f('0x2d')];}_0x106a9d[_0x771f('0x1c')](_0x312bf5)[_0x771f('0x2e')](_0xf89d6c);};}exports[_0x771f('0x2f')]=function(_0x33932b,_0x177393){var _0x160866={},_0x1f6896={},_0x4e0d0b={'count':0x0,'rows':[]};return db['CmCompany'][_0x771f('0x30')]()[_0x771f('0x26')](function(_0x20fb1e){_0x1f6896[_0x771f('0x31')]=_[_0x771f('0x32')](_0x20fb1e);_0x1f6896['query']=_[_0x771f('0x32')](_0x33932b[_0x771f('0x33')]);_0x1f6896[_0x771f('0x34')]=_['intersection'](_0x1f6896[_0x771f('0x31')],_0x1f6896[_0x771f('0x33')]);_0x160866['attributes']=_[_0x771f('0x35')](_0x1f6896['model'],qs[_0x771f('0x36')](_0x33932b[_0x771f('0x33')][_0x771f('0x36')]));_0x160866[_0x771f('0x37')]=_0x160866['attributes'][_0x771f('0x38')]?_0x160866[_0x771f('0x37')]:_0x1f6896[_0x771f('0x31')];if(!_0x33932b['query'][_0x771f('0x39')](_0x771f('0x3a'))){_0x160866[_0x771f('0x21')]=qs['limit'](_0x33932b[_0x771f('0x33')][_0x771f('0x21')]);_0x160866[_0x771f('0x1e')]=qs[_0x771f('0x1e')](_0x33932b['query']['offset']);}_0x160866['order']=qs[_0x771f('0x3b')](_0x33932b[_0x771f('0x33')][_0x771f('0x3b')]);_0x160866[_0x771f('0x3c')]=qs[_0x771f('0x34')](_[_0x771f('0x3d')](_0x33932b[_0x771f('0x33')],_0x1f6896[_0x771f('0x34')]),_0x20fb1e);if(_0x33932b['query'][_0x771f('0x3e')]){_0x160866['where']=_['merge'](_0x160866['where'],{'$or':_[_0x771f('0x3f')](_0x160866['attributes'],function(_0xb38f10){var _0x35072a={};_0x35072a[_0xb38f10]={'$like':'%'+_0x33932b[_0x771f('0x33')][_0x771f('0x3e')]+'%'};return _0x35072a;})});}_0x160866=_['merge']({},_0x160866,_0x33932b['options']);var _0x2f4da9={'where':_0x160866['where']};return db[_0x771f('0x40')][_0x771f('0x20')](_0x2f4da9)['then'](function(_0x4e7fda){_0x4e0d0b[_0x771f('0x20')]=_0x4e7fda;if(_0x33932b[_0x771f('0x33')][_0x771f('0x41')]){_0x160866[_0x771f('0x42')]=[{'all':!![]}];}return db[_0x771f('0x40')][_0x771f('0x43')](_0x160866);})[_0x771f('0x26')](function(_0x266e7e){_0x4e0d0b[_0x771f('0x44')]=_0x266e7e;return _0x4e0d0b;})[_0x771f('0x26')](respondWithFilteredResult(_0x177393,_0x160866))[_0x771f('0x45')](handleError(_0x177393,null));})['catch'](handleError(_0x177393,null));};exports['show']=function(_0x52d9f5,_0xa7305){var _0x126f86={'raw':![],'where':{'id':_0x52d9f5[_0x771f('0x46')]['id']}},_0x52a144={};_0x52a144[_0x771f('0x31')]=_[_0x771f('0x32')](db[_0x771f('0x40')][_0x771f('0x47')]);_0x52a144['query']=_[_0x771f('0x32')](_0x52d9f5[_0x771f('0x33')]);_0x52a144[_0x771f('0x34')]=_[_0x771f('0x35')](_0x52a144[_0x771f('0x31')],_0x52a144[_0x771f('0x33')]);_0x126f86['attributes']=_[_0x771f('0x35')](_0x52a144['model'],qs[_0x771f('0x36')](_0x52d9f5[_0x771f('0x33')][_0x771f('0x36')]));_0x126f86[_0x771f('0x37')]=_0x126f86['attributes'][_0x771f('0x38')]?_0x126f86[_0x771f('0x37')]:_0x52a144[_0x771f('0x31')];if(_0x52d9f5[_0x771f('0x33')]['includeAll']){_0x126f86[_0x771f('0x42')]=[{'all':!![]}];}_0x126f86=_[_0x771f('0x48')]({},_0x126f86,_0x52d9f5[_0x771f('0x49')]);return db[_0x771f('0x40')][_0x771f('0x4a')](_0x126f86)[_0x771f('0x26')](handleEntityNotFound(_0xa7305,null))[_0x771f('0x26')](respondWithResult(_0xa7305,null))['catch'](handleError(_0xa7305,null));};exports['create']=function(_0x2e067f,_0x4655c1){return db[_0x771f('0x40')][_0x771f('0x4b')](_0x2e067f[_0x771f('0x4c')],{})[_0x771f('0x26')](function(_0x23beef){var _0x1ff1bd=_0x2e067f['user'][_0x771f('0x28')]({'plain':!![]});if(!_0x1ff1bd)throw new Error(_0x771f('0x4d'));if(_0x1ff1bd[_0x771f('0x4e')]==='user'){var _0x138cc2=_0x23beef['get']({'plain':!![]});var _0x376f21='Companies';return db['UserProfileSection'][_0x771f('0x4a')]({'where':{'name':_0x376f21,'userProfileId':_0x1ff1bd[_0x771f('0x4f')]},'raw':!![]})['then'](function(_0x453a8f){if(_0x453a8f&&_0x453a8f[_0x771f('0x50')]===0x0){return db[_0x771f('0x2a')][_0x771f('0x4b')]({'name':_0x138cc2[_0x771f('0x2d')],'resourceId':_0x138cc2['id'],'type':_0x453a8f['name'],'sectionId':_0x453a8f['id']},{})['then'](function(){return _0x23beef;});}else{return _0x23beef;}})[_0x771f('0x45')](function(_0x21bbd7){logger[_0x771f('0x2b')](_0x771f('0x51'),_0x21bbd7);throw _0x21bbd7;});}return _0x23beef;})[_0x771f('0x26')](respondWithResult(_0x4655c1,0xc9))[_0x771f('0x45')](handleError(_0x4655c1,null));};exports[_0x771f('0x25')]=function(_0x410cfe,_0x49dfe9){if(_0x410cfe[_0x771f('0x4c')]['id']){delete _0x410cfe[_0x771f('0x4c')]['id'];}return db[_0x771f('0x40')][_0x771f('0x4a')]({'where':{'id':_0x410cfe['params']['id']}})[_0x771f('0x26')](handleEntityNotFound(_0x49dfe9,null))[_0x771f('0x26')](saveUpdates(_0x410cfe[_0x771f('0x4c')],null))[_0x771f('0x26')](respondWithResult(_0x49dfe9,null))[_0x771f('0x45')](handleError(_0x49dfe9,null));};exports[_0x771f('0x27')]=function(_0x39d831,_0x18c368){return db[_0x771f('0x40')][_0x771f('0x4a')]({'where':{'id':_0x39d831[_0x771f('0x46')]['id']}})['then'](handleEntityNotFound(_0x18c368,null))[_0x771f('0x26')](removeEntity(_0x18c368,null))[_0x771f('0x45')](handleError(_0x18c368,null));};exports[_0x771f('0x30')]=function(_0x17084a,_0x1c4f28){return db['CmCompany']['describe']()[_0x771f('0x26')](respondWithResult(_0x1c4f28,null))['catch'](handleError(_0x1c4f28,null));};exports['addContacts']=function(_0x5bad9a,_0x1e7d20,_0x27717c){return db[_0x771f('0x52')][_0x771f('0x4a')]({'where':{'id':_0x5bad9a[_0x771f('0x46')]['id']}})[_0x771f('0x26')](handleEntityNotFound(_0x1e7d20,null))[_0x771f('0x26')](function(_0x46b8c8){if(_0x46b8c8){return _0x46b8c8[_0x771f('0x53')](_0x5bad9a[_0x771f('0x4c')][_0x771f('0x54')],_[_0x771f('0x55')](_0x5bad9a[_0x771f('0x4c')],[_0x771f('0x54'),'id'])||{});}})[_0x771f('0x26')](respondWithResult(_0x1e7d20,null))[_0x771f('0x45')](handleError(_0x1e7d20,null));};exports[_0x771f('0x56')]=function(_0x1a90ab,_0x4f87c0,_0x1d4cb9){var _0xa91f07={};var _0x69e660={};var _0x262d9a;var _0x527d77;return db['CmCompany']['findOne']({'where':{'id':_0x1a90ab['params']['id']}})['then'](handleEntityNotFound(_0x4f87c0,null))[_0x771f('0x26')](function(_0x1c6062){if(_0x1c6062){_0x262d9a=_0x1c6062;_0x69e660[_0x771f('0x31')]=_[_0x771f('0x32')](db[_0x771f('0x52')]['rawAttributes']);_0x69e660[_0x771f('0x33')]=_['keys'](_0x1a90ab[_0x771f('0x33')]);_0x69e660[_0x771f('0x34')]=_[_0x771f('0x35')](_0x69e660[_0x771f('0x31')],_0x69e660[_0x771f('0x33')]);_0xa91f07[_0x771f('0x37')]=_[_0x771f('0x35')](_0x69e660['model'],qs[_0x771f('0x36')](_0x1a90ab['query']['fields']));_0xa91f07[_0x771f('0x37')]=_0xa91f07[_0x771f('0x37')]['length']?_0xa91f07['attributes']:_0x69e660[_0x771f('0x31')];_0xa91f07['order']=qs['sort'](_0x1a90ab[_0x771f('0x33')][_0x771f('0x3b')]);_0xa91f07[_0x771f('0x3c')]=qs[_0x771f('0x34')](_['pick'](_0x1a90ab[_0x771f('0x33')],_0x69e660[_0x771f('0x34')]));if(_0x1a90ab[_0x771f('0x33')][_0x771f('0x3e')]){_0xa91f07[_0x771f('0x3c')]=_[_0x771f('0x48')](_0xa91f07[_0x771f('0x3c')],{'$or':_[_0x771f('0x3f')](_0xa91f07[_0x771f('0x37')],function(_0x3021cb){var _0x567fef={};_0x567fef[_0x3021cb]={'$like':'%'+_0x1a90ab[_0x771f('0x33')][_0x771f('0x3e')]+'%'};return _0x567fef;})});}_0xa91f07=_[_0x771f('0x48')]({},_0xa91f07,_0x1a90ab[_0x771f('0x49')]);return _0x262d9a[_0x771f('0x56')](_0xa91f07);}})['then'](function(_0x1e5ba7){if(_0x1e5ba7){_0x527d77=_0x1e5ba7[_0x771f('0x38')];if(!_0x1a90ab['query'][_0x771f('0x39')]('nolimit')){_0xa91f07[_0x771f('0x21')]=qs[_0x771f('0x21')](_0x1a90ab['query'][_0x771f('0x21')]);_0xa91f07[_0x771f('0x1e')]=qs['offset'](_0x1a90ab[_0x771f('0x33')]['offset']);}return _0x262d9a[_0x771f('0x56')](_0xa91f07);}})[_0x771f('0x26')](function(_0x3b0dbd){if(_0x3b0dbd){return _0x3b0dbd?{'count':_0x527d77,'rows':_0x3b0dbd}:null;}})[_0x771f('0x26')](respondWithResult(_0x4f87c0,null))[_0x771f('0x45')](handleError(_0x4f87c0,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ecb3507..2771242 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 _0xb115=['util','../../config/logger','api','moment','bluebird','./cmCompany.attributes','exports','define','CmCompany','lodash'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0xb115,0xd1));var _0x5b11=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb115[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5b11('0x0'));var util=require(_0x5b11('0x1'));var logger=require(_0x5b11('0x2'))(_0x5b11('0x3'));var moment=require(_0x5b11('0x4'));var BPromise=require(_0x5b11('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(_0x5b11('0x6'));module[_0x5b11('0x7')]=function(_0x1abda5,_0x333a96){return _0x1abda5[_0x5b11('0x8')](_0x5b11('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa01c=['../../config/environment','./cmCompany.attributes','CmCompany','cm_companies','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x49b47b,_0x3f5c8b){var _0x96bf5d=function(_0x206f37){while(--_0x206f37){_0x49b47b['push'](_0x49b47b['shift']());}};_0x96bf5d(++_0x3f5c8b);}(_0xa01c,0x162));var _0xca01=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa01c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xca01('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xca01('0x1'));var BPromise=require(_0xca01('0x2'));var rp=require(_0xca01('0x3'));var fs=require('fs');var path=require(_0xca01('0x4'));var rimraf=require(_0xca01('0x5'));var config=require(_0xca01('0x6'));var attributes=require(_0xca01('0x7'));module['exports']=function(_0x116686,_0x22d60f){return _0x116686['define'](_0xca01('0x8'),attributes,{'tableName':_0xca01('0x9'),'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 0d3b7d1..de5ff19 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 _0xc422=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x487b09,_0x349b11){var _0x28830b=function(_0x51705f){while(--_0x51705f){_0x487b09['push'](_0x487b09['shift']());}};_0x28830b(++_0x349b11);}(_0xc422,0xb1));var _0x2c42=function(_0x3f4b81,_0x3fd592){_0x3f4b81=_0x3f4b81-0x0;var _0x480fc6=_0xc422[_0x3f4b81];return _0x480fc6;};'use strict';var _=require(_0x2c42('0x0'));var util=require(_0x2c42('0x1'));var moment=require(_0x2c42('0x2'));var BPromise=require(_0x2c42('0x3'));var rs=require(_0x2c42('0x4'));var fs=require('fs');var Redis=require(_0x2c42('0x5'));var db=require(_0x2c42('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c42('0x7'));var config=require(_0x2c42('0x8'));var jayson=require(_0x2c42('0x9'));var client=jayson[_0x2c42('0xa')][_0x2c42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xba9e76,_0x60ee77,_0x4caf83){return new BPromise(function(_0x4fbcc0,_0x3ba866){return client[_0x2c42('0xc')](_0xba9e76,_0x4caf83)[_0x2c42('0xd')](function(_0x41d9c8){logger[_0x2c42('0xe')](_0x2c42('0xf'),_0x60ee77,_0x2c42('0x10'));logger['debug'](_0x2c42('0x11'),_0x60ee77,_0x2c42('0x10'),JSON[_0x2c42('0x12')](_0x41d9c8));if(_0x41d9c8['error']){if(_0x41d9c8[_0x2c42('0x13')][_0x2c42('0x14')]===0x1f4){logger[_0x2c42('0x13')](_0x2c42('0xf'),_0x60ee77,_0x41d9c8['error'][_0x2c42('0x15')]);return _0x3ba866(_0x41d9c8[_0x2c42('0x13')][_0x2c42('0x15')]);}logger['error'](_0x2c42('0xf'),_0x60ee77,_0x41d9c8[_0x2c42('0x13')][_0x2c42('0x15')]);return _0x4fbcc0(_0x41d9c8[_0x2c42('0x13')]['message']);}else{logger[_0x2c42('0xe')]('CmCompany,\x20%s,\x20%s',_0x60ee77,_0x2c42('0x10'));_0x4fbcc0(_0x41d9c8['result'][_0x2c42('0x15')]);}})[_0x2c42('0x16')](function(_0x3d8c46){logger[_0x2c42('0x13')](_0x2c42('0xf'),_0x60ee77,_0x3d8c46);_0x3ba866(_0x3d8c46);});});} \ No newline at end of file +var _0x17c3=['request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x17c3,0x1d9));var _0x317c=function(_0x308ae5,_0x3b1dea){_0x308ae5=_0x308ae5-0x0;var _0x5b3ad7=_0x17c3[_0x308ae5];return _0x5b3ad7;};'use strict';var _=require(_0x317c('0x0'));var util=require(_0x317c('0x1'));var moment=require(_0x317c('0x2'));var BPromise=require(_0x317c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x317c('0x4'));var db=require(_0x317c('0x5'))['db'];var utils=require(_0x317c('0x6'));var logger=require('../../config/logger')(_0x317c('0x7'));var config=require(_0x317c('0x8'));var jayson=require(_0x317c('0x9'));var client=jayson['client'][_0x317c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b2bff,_0x1c8008,_0x1735bd){return new BPromise(function(_0x1aec06,_0x313f66){return client[_0x317c('0xb')](_0x5b2bff,_0x1735bd)[_0x317c('0xc')](function(_0xe1d459){logger[_0x317c('0xd')](_0x317c('0xe'),_0x1c8008,_0x317c('0xf'));logger['debug'](_0x317c('0x10'),_0x1c8008,_0x317c('0xf'),JSON[_0x317c('0x11')](_0xe1d459));if(_0xe1d459[_0x317c('0x12')]){if(_0xe1d459['error']['code']===0x1f4){logger[_0x317c('0x12')](_0x317c('0xe'),_0x1c8008,_0xe1d459[_0x317c('0x12')][_0x317c('0x13')]);return _0x313f66(_0xe1d459[_0x317c('0x12')][_0x317c('0x13')]);}logger[_0x317c('0x12')](_0x317c('0xe'),_0x1c8008,_0xe1d459['error'][_0x317c('0x13')]);return _0x1aec06(_0xe1d459[_0x317c('0x12')][_0x317c('0x13')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x1c8008,_0x317c('0xf'));_0x1aec06(_0xe1d459[_0x317c('0x14')][_0x317c('0x13')]);}})[_0x317c('0x15')](function(_0x3a66de){logger[_0x317c('0x12')]('CmCompany,\x20%s,\x20%s',_0x1c8008,_0x3a66de);_0x313f66(_0x3a66de);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0ecbe94..3210115 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 _0xdc73=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/contacts','getContacts','post','put','delete','destroy','exports','util','path'];(function(_0x46ee3c,_0x1c08f0){var _0x530a97=function(_0x194bba){while(--_0x194bba){_0x46ee3c['push'](_0x46ee3c['shift']());}};_0x530a97(++_0x1c08f0);}(_0xdc73,0x19c));var _0x3dc7=function(_0x482923,_0x4df687){_0x482923=_0x482923-0x0;var _0x13474e=_0xdc73[_0x482923];return _0x13474e;};'use strict';var multer=require('multer');var util=require(_0x3dc7('0x0'));var path=require(_0x3dc7('0x1'));var timeout=require(_0x3dc7('0x2'));var express=require(_0x3dc7('0x3'));var router=express[_0x3dc7('0x4')]();var fs_extra=require(_0x3dc7('0x5'));var auth=require(_0x3dc7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3dc7('0x7'));var controller=require('./cmCompany.controller');router[_0x3dc7('0x8')]('/',auth[_0x3dc7('0x9')](),controller['index']);router['get']('/describe',auth[_0x3dc7('0x9')](),controller['describe']);router[_0x3dc7('0x8')](_0x3dc7('0xa'),auth[_0x3dc7('0x9')](),controller['show']);router[_0x3dc7('0x8')](_0x3dc7('0xb'),auth['isAuthenticated'](),controller[_0x3dc7('0xc')]);router[_0x3dc7('0xd')]('/',auth[_0x3dc7('0x9')](),controller['create']);router['post'](_0x3dc7('0xb'),auth[_0x3dc7('0x9')](),controller['addContacts']);router[_0x3dc7('0xe')]('/:id',auth[_0x3dc7('0x9')](),controller['update']);router[_0x3dc7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3dc7('0x10')]);module[_0x3dc7('0x11')]=router; \ No newline at end of file +var _0x1dcb=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','describe','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','destroy','exports','util'];(function(_0x38b0ad,_0x2f5d41){var _0x40b625=function(_0x370b6f){while(--_0x370b6f){_0x38b0ad['push'](_0x38b0ad['shift']());}};_0x40b625(++_0x2f5d41);}(_0x1dcb,0x1a3));var _0xb1dc=function(_0xa16598,_0x1d0266){_0xa16598=_0xa16598-0x0;var _0x3ba740=_0x1dcb[_0xa16598];return _0x3ba740;};'use strict';var multer=require('multer');var util=require(_0xb1dc('0x0'));var path=require(_0xb1dc('0x1'));var timeout=require(_0xb1dc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb1dc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb1dc('0x4'));var config=require(_0xb1dc('0x5'));var controller=require(_0xb1dc('0x6'));router[_0xb1dc('0x7')]('/',auth[_0xb1dc('0x8')](),controller['index']);router[_0xb1dc('0x7')]('/describe',auth[_0xb1dc('0x8')](),controller[_0xb1dc('0x9')]);router[_0xb1dc('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xb1dc('0xa'),auth[_0xb1dc('0x8')](),controller[_0xb1dc('0xb')]);router[_0xb1dc('0xc')]('/',auth[_0xb1dc('0x8')](),controller[_0xb1dc('0xd')]);router[_0xb1dc('0xc')](_0xb1dc('0xa'),auth[_0xb1dc('0x8')](),controller[_0xb1dc('0xe')]);router[_0xb1dc('0xf')](_0xb1dc('0x10'),auth[_0xb1dc('0x8')](),controller[_0xb1dc('0x11')]);router['delete']('/:id',auth[_0xb1dc('0x8')](),controller[_0xb1dc('0x12')]);module[_0xb1dc('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0c0b099..6126f6e 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 _0x3a98=['exports','STRING','INTEGER','DATE','lodash','sequelize'];(function(_0x48918f,_0xc04b98){var _0x4a62dd=function(_0x55c146){while(--_0x55c146){_0x48918f['push'](_0x48918f['shift']());}};_0x4a62dd(++_0xc04b98);}(_0x3a98,0xa6));var _0x83a9=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0x3a98[_0x539fb2];return _0x4d583d;};'use strict';var _=require(_0x83a9('0x0'));var Sequelize=require(_0x83a9('0x1'));module[_0x83a9('0x2')]={'firstName':{'type':Sequelize[_0x83a9('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x83a9('0x3')]},'street':{'type':Sequelize[_0x83a9('0x3')]},'postalCode':{'type':Sequelize[_0x83a9('0x3')]},'city':{'type':Sequelize[_0x83a9('0x3')]},'country':{'type':Sequelize[_0x83a9('0x3')]},'dateOfBirth':{'type':Sequelize[_0x83a9('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x83a9('0x3')]},'mobile':{'type':Sequelize[_0x83a9('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x83a9('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x83a9('0x3')]},'twitter':{'type':Sequelize[_0x83a9('0x3')]},'skype':{'type':Sequelize[_0x83a9('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x83a9('0x3')]},'line':{'type':Sequelize[_0x83a9('0x3')]},'wechat':{'type':Sequelize[_0x83a9('0x3')]},'telegram':{'type':Sequelize[_0x83a9('0x3')]},'UserId':{'type':Sequelize[_0x83a9('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x83a9('0x3')]},'priority':{'type':Sequelize[_0x83a9('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x83a9('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x83a9('0x4')]}}; \ No newline at end of file +var _0xc3f6=['DATE','NOW','sequelize','exports','STRING','INTEGER','UNSIGNED'];(function(_0x20b1fc,_0x4d0ff4){var _0x5cc0c0=function(_0x3cb0d8){while(--_0x3cb0d8){_0x20b1fc['push'](_0x20b1fc['shift']());}};_0x5cc0c0(++_0x4d0ff4);}(_0xc3f6,0x1ad));var _0x6c3f=function(_0x31543a,_0x40e08a){_0x31543a=_0x31543a-0x0;var _0x19fae9=_0xc3f6[_0x31543a];return _0x19fae9;};'use strict';var _=require('lodash');var Sequelize=require(_0x6c3f('0x0'));module[_0x6c3f('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6c3f('0x2')]},'country':{'type':Sequelize[_0x6c3f('0x2')]},'dateOfBirth':{'type':Sequelize[_0x6c3f('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6c3f('0x2')]},'email':{'type':Sequelize[_0x6c3f('0x2')]},'url':{'type':Sequelize[_0x6c3f('0x2')]},'facebook':{'type':Sequelize[_0x6c3f('0x2')]},'fb_data':{'type':Sequelize[_0x6c3f('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x6c3f('0x2')]},'teams':{'type':Sequelize[_0x6c3f('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x6c3f('0x2')]},'wechat':{'type':Sequelize[_0x6c3f('0x2')]},'telegram':{'type':Sequelize[_0x6c3f('0x2')]},'UserId':{'type':Sequelize[_0x6c3f('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x6c3f('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x6c3f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6c3f('0x5')],'defaultValue':Sequelize[_0x6c3f('0x6')]},'dialTimezone':{'type':Sequelize[_0x6c3f('0x2')]},'utcOffset':{'type':Sequelize[_0x6c3f('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 05f9969..cadb291 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 _0xb640=['attributes','fields','order','sort','filters','pick','map','options','getTags','nolimit','setTags','ids','CmContactHasItem','OrderBy','items','item_types','description','ItemTypeId','PHONE','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','hopperId','getHoppers','ContactId','filter','includeAll','include','getHopperHistories','CmHopperHistory','rawAttributes','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','send','path','parse','json','meta','import','agent','binding','../../components/import/cm/csv2','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','User','No\x20firstName\x20column\x20specified','stringify','getJourney','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','endtime','duration','note','userSecondDisposition','userThirdDisposition','UserId','createdAt','DESC','findAndCountAll','fullname','Website','Account','closed','closedAt','key','Owner','browserName','customerIp','deviceModel','ratingMessage','ratingValue','referer','substatus','externalUrl','threadId','startCase','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','limit','offset','count','then','destroy','end','sendStatus','stack','name','index','describe','user','catch','CmContact','params','keys','length','startsWith','columnName','displayName','query','analytics','CmCustomField','findAll','cf_','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','create','isNil','dialTimezone','timezones','additionalPhones','bulkCreate','each','duplicates','where','$or','push','findOrCreate','spread','all','find','Tag','Tags','color','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','ListId','$and','omit','format','cf_%d','utcOffset','pickBy','table','setFields','toParam','phone','findOne','intersection','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb640,0x184));var _0x0b64=function(_0x47fa8c,_0x214d2a){_0x47fa8c=_0x47fa8c-0x0;var _0x574620=_0xb640[_0x47fa8c];return _0x574620;};'use strict';var moment=require(_0x0b64('0x0'));var BPromise=require(_0x0b64('0x1'));var util=require(_0x0b64('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0b64('0x3'));var Papa=require('papaparse');var Redis=require(_0x0b64('0x4'));var contacts=require(_0x0b64('0x5'));var qs=require(_0x0b64('0x6'));var logger=require(_0x0b64('0x7'))(_0x0b64('0x8'));var config=require(_0x0b64('0x9'));var shared=require(_0x0b64('0xa'));var db=require('../../mysqldb')['db'];config[_0x0b64('0xb')]=_[_0x0b64('0xc')](config['redis'],{'host':_0x0b64('0xd'),'port':0x18eb});var socket=require(_0x0b64('0xe'))(new Redis(config[_0x0b64('0xb')]));require(_0x0b64('0xf'))[_0x0b64('0x10')](socket);function respondWithResult(_0x6f5afa,_0x273301){_0x273301=_0x273301||0xc8;return function(_0x29b79a){if(_0x29b79a){return _0x6f5afa[_0x0b64('0x11')](_0x273301)['json'](_0x29b79a);}};}function respondWithFilteredResult(_0x1302e6,_0x210ec7){return function(_0xfb3e7d){if(_0xfb3e7d){var _0x1ff1a6=typeof _0x210ec7['offset']===_0x0b64('0x12')&&typeof _0x210ec7[_0x0b64('0x13')]===_0x0b64('0x12');var _0x29e15f=_0xfb3e7d['count'];var _0x3baffc=_0x1ff1a6?0x0:_0x210ec7[_0x0b64('0x14')];var _0x2f41cd=_0x1ff1a6?_0xfb3e7d[_0x0b64('0x15')]:_0x210ec7[_0x0b64('0x14')]+_0x210ec7['limit'];var _0x695e7a;if(_0x2f41cd>=_0x29e15f){_0x2f41cd=_0x29e15f;_0x695e7a=0xc8;}else{_0x695e7a=0xce;}_0x1302e6[_0x0b64('0x11')](_0x695e7a);return _0x1302e6['set']('Content-Range',_0x3baffc+'-'+_0x2f41cd+'/'+_0x29e15f)['json'](_0xfb3e7d);}return null;};}function saveUpdates(_0x2dcc9f){return function(_0x43ad02){if(_0x43ad02){return _0x43ad02['update'](_0x2dcc9f)[_0x0b64('0x16')](function(_0x20cc17){return _0x20cc17;});}return null;};}function removeEntity(_0x125a0d){return function(_0x38067e){if(_0x38067e){return _0x38067e[_0x0b64('0x17')]()[_0x0b64('0x16')](function(){_0x125a0d[_0x0b64('0x11')](0xcc)[_0x0b64('0x18')]();});}};}function handleEntityNotFound(_0x585ea8){return function(_0x617d1e){if(!_0x617d1e){_0x585ea8[_0x0b64('0x19')](0x194);}return _0x617d1e;};}function handleError(_0x17d3f5,_0x374a99){_0x374a99=_0x374a99||0x1f4;return function(_0x20c448){logger['error'](_0x20c448[_0x0b64('0x1a')]);if(_0x20c448[_0x0b64('0x1b')]){delete _0x20c448[_0x0b64('0x1b')];}_0x17d3f5[_0x0b64('0x11')](_0x374a99)['send'](_0x20c448);};}exports[_0x0b64('0x1c')]=function(_0x802ffd,_0x375010){var _0x21fa71={};return contacts[_0x0b64('0x1d')]()[_0x0b64('0x16')](function(_0x1e8a3a){_0x21fa71=qs['getOptions'](_0x1e8a3a,_0x802ffd);return contacts['findAll'](_0x802ffd['query'],_0x802ffd[_0x0b64('0x1e')],_0x21fa71,_0x1e8a3a);})[_0x0b64('0x16')](respondWithFilteredResult(_0x375010,_0x21fa71))[_0x0b64('0x1f')](handleError(_0x375010,null));};exports['destroy']=function(_0x217cb7,_0x4b8f18){return db[_0x0b64('0x20')]['find']({'where':{'id':_0x217cb7[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x4b8f18,null))[_0x0b64('0x16')](removeEntity(_0x4b8f18,null))['catch'](handleError(_0x4b8f18,null));};exports[_0x0b64('0x1d')]=function(_0x5a3231,_0x4c7c11){return db[_0x0b64('0x20')][_0x0b64('0x1d')]()[_0x0b64('0x16')](function(_0x228d0d){delete _0x228d0d['tags'];for(var _0x54a8e7=0x0;_0x54a8e70x0){return new Promise(function(_0x11881e){var _0x43fc4b=[];for(var _0x363356=0x0;_0x363356<_0x3120f3[_0x0b64('0x23')];_0x363356++){_0x43fc4b['push'](insertAdditionalPhones(_0x3120f3[_0x363356]['contact'],_0x3120f3[_0x363356][_0x0b64('0x59')]));}Promise[_0x0b64('0x62')](_0x43fc4b)[_0x0b64('0x16')](function(){_0x11881e(0x1);});})[_0x0b64('0x16')](function(){return{'success':_0xcf4998,'failure':_0x24a995,'duplicates':_0x3f730a};});}else{return{'success':_0xcf4998,'failure':_0x24a995,'duplicates':_0x3f730a};}}})[_0x0b64('0x16')](respondWithResult(_0x3772a9,0xc9))[_0x0b64('0x1f')](handleError(_0x3772a9,null));};exports['show']=function(_0x12c4b5,_0x5167f8){var _0x3e7544;return db[_0x0b64('0x20')][_0x0b64('0x1d')]()[_0x0b64('0x16')](function(_0x367ea0){return db[_0x0b64('0x20')][_0x0b64('0x63')]({'where':{'id':_0x12c4b5[_0x0b64('0x21')]['id']},'include':[{'model':db[_0x0b64('0x64')],'as':_0x0b64('0x65'),'attributes':['id',_0x0b64('0x1b'),_0x0b64('0x66')],'required':_0x12c4b5[_0x0b64('0x27')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0b64('0x67'),'where':{'CmContactId':_0x12c4b5['params']['id']},'required':![],'include':[{'model':db[_0x0b64('0x68')],'as':_0x0b64('0x69')}]}],'order':[db['sequelize'][_0x0b64('0x6a')](_0x0b64('0x6b'))],'attributes':_[_0x0b64('0x22')](_0x367ea0)});})[_0x0b64('0x16')](function(_0x2ba52f){if(!_[_0x0b64('0x56')](_0x2ba52f)){_0x3e7544=_0x2ba52f['get']({'plain':!![]});var _0x7aa8f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2ba52f&&_0x2ba52f['ListId']){if(_0x2ba52f[_0x0b64('0x6c')]){_0x7aa8f['where'][_0x0b64('0x6d')][_0x0b64('0x5f')]({'ListId':{'$ne':_0x2ba52f[_0x0b64('0x6c')]}});}}return db[_0x0b64('0x29')][_0x0b64('0x2a')](_0x7aa8f);}})[_0x0b64('0x16')](function(_0x489eb5){if(!_['isNil'](_0x489eb5)){return _[_0x0b64('0x6e')](_0x3e7544,_['map'](_0x489eb5,function(_0x5043b5){return util[_0x0b64('0x6f')](_0x0b64('0x70'),_0x5043b5['id']);}));}})['then'](handleEntityNotFound(_0x5167f8,null))['then'](respondWithResult(_0x5167f8,null))[_0x0b64('0x1f')](handleError(_0x5167f8,null));};exports[_0x0b64('0x42')]=function(_0x46e2f6,_0x4583e5){var _0x13b789;if(_0x46e2f6[_0x0b64('0x35')]['id']){delete _0x46e2f6[_0x0b64('0x35')]['id'];}if(!_['isNil'](_0x46e2f6['body'][_0x0b64('0x57')])){var _0x38f3ca=_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x57')];if(!_[_0x0b64('0x56')](shared['timezones'][_0x38f3ca]))_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x71')]=shared[_0x0b64('0x58')][_0x38f3ca][_0x0b64('0x71')];}return db[_0x0b64('0x20')][_0x0b64('0x63')]({'where':{'id':_0x46e2f6[_0x0b64('0x21')]['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x4583e5,null))[_0x0b64('0x16')](saveUpdates(_0x46e2f6[_0x0b64('0x35')],null))['then'](function(_0x3eb2bf){_0x13b789=_0x3eb2bf;var _0x5add41={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3eb2bf&&_0x3eb2bf[_0x0b64('0x6c')]){if(_0x3eb2bf[_0x0b64('0x6c')]){_0x5add41[_0x0b64('0x5d')]['$and'][_0x0b64('0x5f')]({'ListId':{'$ne':_0x3eb2bf[_0x0b64('0x6c')]}});}}return db[_0x0b64('0x29')][_0x0b64('0x2a')](_0x5add41);})[_0x0b64('0x16')](function(_0x1a97c1){if(_0x1a97c1){return _[_0x0b64('0x6e')](_[_0x0b64('0x72')](_0x46e2f6[_0x0b64('0x35')],function(_0x5531ba,_0x48127a){return _[_0x0b64('0x24')](_0x48127a,_0x0b64('0x2b'));}),_['map'](_0x1a97c1,function(_0x2e8255){return util[_0x0b64('0x6f')](_0x0b64('0x70'),_0x2e8255['id']);}));}})[_0x0b64('0x16')](function(_0x9c2d46){if(_0x9c2d46&&!_['isEmpty'](_0x9c2d46)){var _0x104773=squel[_0x0b64('0x42')]()[_0x0b64('0x73')]('cm_contacts')[_0x0b64('0x74')](_0x9c2d46)['where']('id\x20=\x20?',_0x46e2f6[_0x0b64('0x21')]['id'])[_0x0b64('0x75')]();return db['sequelize'][_0x0b64('0x27')](_0x104773['text'],{'replacements':_0x104773[_0x0b64('0x2f')]});}})[_0x0b64('0x16')](function(){if(_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x76')]&&_0x13b789){return db[_0x0b64('0x3d')][_0x0b64('0x42')]({'phone':_0x46e2f6[_0x0b64('0x35')][_0x0b64('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x13b789['id']}});}})[_0x0b64('0x16')](function(){return _0x13b789;})[_0x0b64('0x16')](respondWithResult(_0x4583e5,null))[_0x0b64('0x1f')](handleError(_0x4583e5,null));};exports['getTags']=function(_0x129474,_0x14a65b){var _0x169697={};var _0x1124d3={};var _0x5d421a;var _0x5dcce1;return db[_0x0b64('0x20')][_0x0b64('0x77')]({'where':{'id':_0x129474[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x14a65b,null))[_0x0b64('0x16')](function(_0x4635a1){if(_0x4635a1){_0x5d421a=_0x4635a1;_0x1124d3['model']=_[_0x0b64('0x22')](db[_0x0b64('0x64')]['rawAttributes']);_0x1124d3[_0x0b64('0x27')]=_[_0x0b64('0x22')](_0x129474[_0x0b64('0x27')]);_0x1124d3['filters']=_[_0x0b64('0x78')](_0x1124d3[_0x0b64('0x79')],_0x1124d3['query']);_0x169697[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x1124d3[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x129474['query']['fields']));_0x169697[_0x0b64('0x7a')]=_0x169697['attributes'][_0x0b64('0x23')]?_0x169697[_0x0b64('0x7a')]:_0x1124d3[_0x0b64('0x79')];_0x169697[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x129474['query'][_0x0b64('0x7d')]);_0x169697['where']=qs[_0x0b64('0x7e')](_[_0x0b64('0x7f')](_0x129474[_0x0b64('0x27')],_0x1124d3[_0x0b64('0x7e')]));if(_0x129474[_0x0b64('0x27')]['filter']){_0x169697[_0x0b64('0x5d')]=_['merge'](_0x169697['where'],{'$or':_[_0x0b64('0x80')](_0x169697[_0x0b64('0x7a')],function(_0x31f143){var _0x27108a={};_0x27108a[_0x31f143]={'$like':'%'+_0x129474[_0x0b64('0x27')]['filter']+'%'};return _0x27108a;})});}_0x169697=_[_0x0b64('0x34')]({},_0x169697,_0x129474[_0x0b64('0x81')]);return _0x5d421a[_0x0b64('0x82')](_0x169697);}})[_0x0b64('0x16')](function(_0x2cdcd1){if(_0x2cdcd1){_0x5dcce1=_0x2cdcd1[_0x0b64('0x23')];if(!_0x129474['query'][_0x0b64('0x33')](_0x0b64('0x83'))){_0x169697[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x129474[_0x0b64('0x27')][_0x0b64('0x13')]);_0x169697['offset']=qs[_0x0b64('0x14')](_0x129474['query'][_0x0b64('0x14')]);}return _0x5d421a[_0x0b64('0x82')](_0x169697);}})[_0x0b64('0x16')](function(_0x32669e){if(_0x32669e){return _0x32669e?{'count':_0x5dcce1,'rows':_0x32669e}:null;}})[_0x0b64('0x16')](respondWithResult(_0x14a65b,null))[_0x0b64('0x1f')](handleError(_0x14a65b,null));};exports[_0x0b64('0x84')]=function(_0x429c18,_0x452719){if(_0x429c18[_0x0b64('0x35')]['id']){delete _0x429c18[_0x0b64('0x35')]['id'];}return db['CmContact'][_0x0b64('0x77')]({'where':{'id':_0x429c18[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x452719,null))[_0x0b64('0x16')](function(_0x329c89){if(_0x329c89){return _0x329c89[_0x0b64('0x84')](_0x429c18[_0x0b64('0x35')][_0x0b64('0x85')]||[]);}return null;})[_0x0b64('0x16')](respondWithResult(_0x452719,null))['catch'](handleError(_0x452719,null));};exports['setAdditionalPhones']=function(_0xb5a774,_0x3277f0){var _0x4ce86b=[];_0x4ce86b[_0x0b64('0x5f')](addAdditionalPhones(_0xb5a774[_0x0b64('0x35')]));Promise[_0x0b64('0x62')](_0x4ce86b)[_0x0b64('0x16')](function(){_0x4ce86b=[];_0x4ce86b[_0x0b64('0x5f')](deleteCmHopperPhones(_0xb5a774[_0x0b64('0x35')]['id']));_0x4ce86b[_0x0b64('0x5f')](addCmHopperPhones(_0xb5a774[_0x0b64('0x35')]['id']));Promise['all'](_0x4ce86b)[_0x0b64('0x16')](function(){return[0x1];})['then'](respondWithResult(_0x3277f0,null));});};function addAdditionalPhones(_0x198840){var _0x75ac0;return new Promise(function(_0x5ef8b8){return db[_0x0b64('0x86')][_0x0b64('0x17')]({'where':{'CmContactId':_0x198840['id']}})[_0x0b64('0x16')](function(){db[_0x0b64('0x68')][_0x0b64('0x2a')]({'raw':!![],'attributes':['id',_0x0b64('0x87')]})['then'](function(_0x178082){var _0x297a2d=[];for(var _0x1fcb88=0x0;_0x1fcb88<_0x198840[_0x0b64('0x88')]['length'];_0x1fcb88++){var _0x4f94bc=_0x198840[_0x0b64('0x89')]?_['isNil'](_0x198840[_0x0b64('0x89')][_0x1fcb88])?'':_0x198840['item_types'][_0x1fcb88]:_0x198840[_0x0b64('0x88')][_0x1fcb88]['ItemTypeId']?_0x198840[_0x0b64('0x88')][_0x1fcb88]['ItemTypeId']:'';var _0x43f160=_[_0x0b64('0x56')](_0x198840['items'][_0x1fcb88]['description'])?'':_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8a')];var _0x5e7c55=_0x4f94bc+':'+_0x198840['items'][_0x1fcb88]['phone']+'§'+_0x43f160;if(_[_0x0b64('0x56')](_0x75ac0))_0x75ac0=_0x5e7c55;else _0x75ac0+=';'+_0x5e7c55;var _0x4ba5da=null;var _0x12bef6=null;if(_0x198840[_0x0b64('0x89')]){if(!_[_0x0b64('0x56')](_0x198840['item_types'][_0x1fcb88])){_0x12bef6=_[_0x0b64('0x63')](_0x178082,function(_0x504d4b){return _0x504d4b['id']===_0x198840[_0x0b64('0x89')][_0x1fcb88];});if(!_['isNil'](_0x12bef6)){_0x4ba5da=_0x12bef6[_0x0b64('0x87')];}}}else{if(!_[_0x0b64('0x56')](_0x198840[_0x0b64('0x88')][_0x1fcb88])){_0x12bef6=_[_0x0b64('0x63')](_0x178082,function(_0x34dc53){return _0x34dc53['id']===_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8b')];});if(!_[_0x0b64('0x56')](_0x12bef6)){_0x4ba5da=_0x1fcb88;}}}if(_[_0x0b64('0x56')](_0x4ba5da)){_0x4ba5da=0x64;}_0x297a2d[_0x0b64('0x5f')](addAdditionalPhone(_0x198840['id'],_0x198840[_0x0b64('0x88')][_0x1fcb88]['phone'],_0x198840[_0x0b64('0x89')]?_[_0x0b64('0x56')](_0x198840[_0x0b64('0x89')][_0x1fcb88])?null:_0x198840[_0x0b64('0x89')][_0x1fcb88]:_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8b')]?_0x198840[_0x0b64('0x88')][_0x1fcb88][_0x0b64('0x8b')]:null,_0x4ba5da,_0x43f160));}Promise['all'](_0x297a2d)['then'](function(){db[_0x0b64('0x20')][_0x0b64('0x42')]({'AdditionalPhones':_0x75ac0},{'where':{'id':_0x198840['id']}})[_0x0b64('0x16')](function(){_0x5ef8b8(0x1);});});});});});}function addAdditionalPhone(_0x4216fe,_0x285512,_0x31d6a6,_0x530124,_0x204fc2){return db[_0x0b64('0x86')][_0x0b64('0x63')]({'where':{'CmContactId':_0x4216fe,'item':_0x285512}})[_0x0b64('0x16')](function(_0x127852){if(_0x127852)logger[_0x0b64('0x30')]('contact\x20phone\x20exists',_0x127852);else{db[_0x0b64('0x86')][_0x0b64('0x55')]({'CmContactId':_0x4216fe,'item':_0x285512,'ItemTypeId':_0x31d6a6,'OrderBy':_0x530124,'ItemClass':_0x0b64('0x8c'),'description':_0x204fc2});}});}function deleteCmHopperPhones(_0x3c015a){return new Promise(function(_0x1c6f8a){return db[_0x0b64('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3c015a}})[_0x0b64('0x16')](function(_0x336998){db['CmHopperAdditionalPhone'][_0x0b64('0x17')]({'where':{'CmHopperId':{'$in':_[_0x0b64('0x80')](_0x336998,'id')}}});})['then'](function(){_0x1c6f8a(0x1);});});}function addCmHopperPhones(_0x3099bf){return new Promise(function(_0x4f10be){return db[_0x0b64('0x3d')][_0x0b64('0x2a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3099bf}})[_0x0b64('0x16')](function(_0x2c35a1){var _0xf5d093=[];_[_0x0b64('0x80')](_0x2c35a1,function(_0x1b39ff){_0xf5d093[_0x0b64('0x5f')](createCmHopperPhone(_0x3099bf,_0x1b39ff['id']));});Promise[_0x0b64('0x62')](_0xf5d093)['then'](function(){_0x4f10be(0x1);});});});}function createCmHopperPhone(_0x37c3b8,_0xf019de){return new Promise(function(_0x5a458e){db[_0x0b64('0x86')][_0x0b64('0x2a')]({'raw':!![],'attributes':['item',_0x0b64('0x87')],'where':{'CmContactId':_0x37c3b8,'ItemClass':_0x0b64('0x8c')},'include':[{'model':db[_0x0b64('0x68')],'attributes':[_0x0b64('0x87')],'as':_0x0b64('0x69')}],'order':[_0x0b64('0x87'),db[_0x0b64('0x8d')]['literal'](_0x0b64('0x8e'))]})[_0x0b64('0x16')](function(_0xcfc7d){var _0x403fba=0x1;var _0x290114=_[_0x0b64('0x80')](_0xcfc7d,function(_0x2d945c){_0x2d945c[_0x0b64('0x8f')]=_0xf019de;_0x2d945c[_0x0b64('0x76')]=_0x2d945c['item'];_0x2d945c[_0x0b64('0x87')]=_0x403fba;delete _0x2d945c[_0x0b64('0x90')];_0x403fba=_0x403fba+0x1;return _0x2d945c;});return db[_0x0b64('0x91')][_0x0b64('0x5a')](_0x290114,{});})['then'](function(){_0x5a458e(0x1);});});}function insertAdditionalPhones(_0x5d1036,_0x251bb3){return new Promise(function(_0x341d37){var _0x510d6c=[];for(var _0x2f8f0d=0x0;_0x2f8f0d<_0x251bb3[_0x0b64('0x23')];_0x2f8f0d++){var _0x1f63da=_0x251bb3[_0x2f8f0d];_0x510d6c[_0x0b64('0x5f')](parseContactItemType(_0x1f63da));}Promise['all'](_0x510d6c)[_0x0b64('0x16')](function(){var _0xa9b737={'id':_0x5d1036['id'],'items':_0x251bb3};return addAdditionalPhones(_0xa9b737)[_0x0b64('0x16')](function(){return addCmHopperPhones(_0x5d1036['id']);});})[_0x0b64('0x16')](function(){_0x341d37(_0x5d1036);});});}function parseContactItemType(_0x2722fd){return new Promise(function(_0x435edb){if(_0x2722fd['hasOwnProperty'](_0x0b64('0x8b'))){_0x435edb(_0x2722fd);}else{return db[_0x0b64('0x68')][_0x0b64('0x63')]({'where':{'name':_0x2722fd[_0x0b64('0x69')]}})[_0x0b64('0x16')](function(_0x533aa0){if(_[_0x0b64('0x56')](_0x533aa0))_0x2722fd[_0x0b64('0x8b')]=null;else _0x2722fd[_0x0b64('0x8b')]=_0x533aa0['id'];_0x435edb(_0x2722fd);});}});}exports[_0x0b64('0x92')]=function(_0x185059,_0x2b95e0){return db[_0x0b64('0x86')][_0x0b64('0x2a')]({'raw':!![],'where':{'CmContactId':_0x185059[_0x0b64('0x21')]['id'],'ItemClass':_0x0b64('0x8c')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x0b64('0x87')],[db[_0x0b64('0x8d')][_0x0b64('0x6a')](_0x0b64('0x8e'))]]})[_0x0b64('0x16')](function(_0x1910ba){return _0x1910ba;})['then'](respondWithResult(_0x2b95e0,null))['catch'](handleError(_0x2b95e0,null));};exports[_0x0b64('0x93')]=function(_0x1f9d43,_0x3412c1){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x1f9d43[_0x0b64('0x35')]['fromContactId']}})[_0x0b64('0x16')](function(_0x3654c1){var _0x14756f=_['map'](_0x3654c1,function(_0x587050){_0x587050[_0x0b64('0x94')]=_0x1f9d43[_0x0b64('0x35')][_0x0b64('0x95')];return _0x587050;});return db['CmContactHasItem'][_0x0b64('0x5a')](_0x14756f,{});})[_0x0b64('0x16')](function(){return addCmHopperPhones(_0x1f9d43[_0x0b64('0x35')][_0x0b64('0x95')]);})[_0x0b64('0x16')](function(){return['ok'];})[_0x0b64('0x16')](respondWithResult(_0x3412c1,null))['catch'](handleError(_0x3412c1,null));};exports['rescheduleAdditionalPhones']=function(_0x43d4aa,_0x17b9e5){var _0x4390d2=[];_0x4390d2[_0x0b64('0x5f')](createCmHopperPhone(_0x43d4aa[_0x0b64('0x35')]['id'],_0x43d4aa['body'][_0x0b64('0x96')]));Promise[_0x0b64('0x62')](_0x4390d2)[_0x0b64('0x16')](function(){return[0x1];})['then'](respondWithResult(_0x17b9e5,null));};exports[_0x0b64('0x97')]=function(_0x29a820,_0x2736bf){var _0x283971={'raw':![],'where':{}};var _0x57cf1f={};var _0x545d13={'count':0x0,'rows':[]};return db[_0x0b64('0x20')][_0x0b64('0x77')]({'where':{'id':_0x29a820['params']['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x2736bf,null))[_0x0b64('0x16')](function(_0x57500c){if(_0x57500c){_0x57cf1f[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0x3d')]['rawAttributes']);_0x57cf1f[_0x0b64('0x27')]=_['keys'](_0x29a820[_0x0b64('0x27')]);_0x57cf1f['filters']=_[_0x0b64('0x78')](_0x57cf1f[_0x0b64('0x79')],_0x57cf1f[_0x0b64('0x27')]);_0x283971[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x57cf1f[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x29a820[_0x0b64('0x27')][_0x0b64('0x7b')]));_0x283971[_0x0b64('0x7a')]=_0x283971[_0x0b64('0x7a')][_0x0b64('0x23')]?_0x283971['attributes']:_0x57cf1f[_0x0b64('0x79')];if(!_0x29a820[_0x0b64('0x27')][_0x0b64('0x33')](_0x0b64('0x83'))){_0x283971['limit']=qs['limit'](_0x29a820[_0x0b64('0x27')][_0x0b64('0x13')]);_0x283971[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x29a820[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x283971[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x29a820[_0x0b64('0x27')]['sort']);_0x283971['where']=qs[_0x0b64('0x7e')](_['pick'](_0x29a820[_0x0b64('0x27')],_0x57cf1f[_0x0b64('0x7e')]));_0x283971[_0x0b64('0x5d')][_0x0b64('0x98')]=_0x57500c['id'];if(_0x29a820[_0x0b64('0x27')][_0x0b64('0x99')]){_0x283971[_0x0b64('0x5d')]=_[_0x0b64('0x34')](_0x283971[_0x0b64('0x5d')],{'$or':_[_0x0b64('0x80')](_0x283971[_0x0b64('0x7a')],function(_0xe79fd6){var _0x1efcc9={};_0x1efcc9[_0xe79fd6]={'$like':'%'+_0x29a820[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0x1efcc9;})});}_0x283971=_[_0x0b64('0x34')]({},_0x283971,_0x29a820[_0x0b64('0x81')]);return db[_0x0b64('0x3d')]['count']({'where':_0x283971[_0x0b64('0x5d')]})['then'](function(_0x1f7014){_0x545d13[_0x0b64('0x15')]=_0x1f7014;if(_0x29a820[_0x0b64('0x27')][_0x0b64('0x9a')]){_0x283971[_0x0b64('0x9b')]=[{'all':!![]}];}return db[_0x0b64('0x3d')]['findAll'](_0x283971);})[_0x0b64('0x16')](function(_0x29280a){_0x545d13['rows']=_0x29280a;return _0x545d13;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x2736bf,_0x283971))[_0x0b64('0x1f')](handleError(_0x2736bf,null));};exports[_0x0b64('0x9c')]=function(_0x19bba5,_0x5f2005){var _0x32afe3={'raw':!![],'where':{}};var _0x44fced={};var _0x368f1d={'count':0x0,'rows':[]};return db['CmContact'][_0x0b64('0x77')]({'where':{'id':_0x19bba5[_0x0b64('0x21')]['id']}})['then'](handleEntityNotFound(_0x5f2005,null))[_0x0b64('0x16')](function(_0x16abfe){if(_0x16abfe){_0x44fced[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0x9d')][_0x0b64('0x9e')]);_0x44fced[_0x0b64('0x27')]=_[_0x0b64('0x22')](_0x19bba5[_0x0b64('0x27')]);_0x44fced[_0x0b64('0x7e')]=_[_0x0b64('0x78')](_0x44fced[_0x0b64('0x79')],_0x44fced[_0x0b64('0x27')]);_0x32afe3[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x44fced[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x7b')]));_0x32afe3[_0x0b64('0x7a')]=_0x32afe3['attributes']['length']?_0x32afe3['attributes']:_0x44fced['model'];if(!_0x19bba5[_0x0b64('0x27')][_0x0b64('0x33')]('nolimit')){_0x32afe3['limit']=qs['limit'](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x13')]);_0x32afe3[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x32afe3[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x19bba5[_0x0b64('0x27')][_0x0b64('0x7d')]);_0x32afe3[_0x0b64('0x5d')]=qs[_0x0b64('0x7e')](_[_0x0b64('0x7f')](_0x19bba5[_0x0b64('0x27')],_0x44fced[_0x0b64('0x7e')]));_0x32afe3[_0x0b64('0x5d')]['ContactId']=_0x16abfe['id'];if(_0x19bba5[_0x0b64('0x27')][_0x0b64('0x99')]){_0x32afe3[_0x0b64('0x5d')]=_[_0x0b64('0x34')](_0x32afe3[_0x0b64('0x5d')],{'$or':_[_0x0b64('0x80')](_0x32afe3[_0x0b64('0x7a')],function(_0x3e0b7f){var _0x4235a0={};_0x4235a0[_0x3e0b7f]={'$like':'%'+_0x19bba5[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0x4235a0;})});}_0x32afe3=_['merge']({},_0x32afe3,_0x19bba5[_0x0b64('0x81')]);return db[_0x0b64('0x9d')][_0x0b64('0x15')]({'where':_0x32afe3[_0x0b64('0x5d')]})[_0x0b64('0x16')](function(_0x48d0f9){_0x368f1d[_0x0b64('0x15')]=_0x48d0f9;if(_0x19bba5[_0x0b64('0x27')]['includeAll']){_0x32afe3[_0x0b64('0x9b')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x32afe3);})[_0x0b64('0x16')](function(_0x36f8a4){_0x368f1d[_0x0b64('0x9f')]=_0x36f8a4;return _0x368f1d;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x5f2005,_0x32afe3))[_0x0b64('0x1f')](handleError(_0x5f2005,null));};exports[_0x0b64('0xa0')]=function(_0x273510,_0x2e72b4){var _0x40487d={'raw':!![],'where':{}};var _0x26c325={};var _0x57918d={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x273510[_0x0b64('0x21')]['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x2e72b4,null))[_0x0b64('0x16')](function(_0xf07438){if(_0xf07438){_0x26c325[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0x4c')]['rawAttributes']);_0x26c325['query']=_[_0x0b64('0x22')](_0x273510[_0x0b64('0x27')]);_0x26c325[_0x0b64('0x7e')]=_['intersection'](_0x26c325[_0x0b64('0x79')],_0x26c325[_0x0b64('0x27')]);_0x40487d[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x26c325['model'],qs['fields'](_0x273510['query'][_0x0b64('0x7b')]));_0x40487d[_0x0b64('0x7a')]=_0x40487d[_0x0b64('0x7a')][_0x0b64('0x23')]?_0x40487d[_0x0b64('0x7a')]:_0x26c325[_0x0b64('0x79')];if(!_0x273510['query'][_0x0b64('0x33')]('nolimit')){_0x40487d[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x273510[_0x0b64('0x27')][_0x0b64('0x13')]);_0x40487d[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x273510[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x40487d[_0x0b64('0x7c')]=qs[_0x0b64('0x7d')](_0x273510[_0x0b64('0x27')][_0x0b64('0x7d')]);_0x40487d[_0x0b64('0x5d')]=qs[_0x0b64('0x7e')](_[_0x0b64('0x7f')](_0x273510[_0x0b64('0x27')],_0x26c325[_0x0b64('0x7e')]));_0x40487d[_0x0b64('0x5d')][_0x0b64('0x98')]=_0xf07438['id'];if(_0x273510[_0x0b64('0x27')]['filter']){_0x40487d[_0x0b64('0x5d')]=_[_0x0b64('0x34')](_0x40487d['where'],{'$or':_[_0x0b64('0x80')](_0x40487d[_0x0b64('0x7a')],function(_0x534330){var _0xe9ea71={};_0xe9ea71[_0x534330]={'$like':'%'+_0x273510[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0xe9ea71;})});}_0x40487d=_[_0x0b64('0x34')]({},_0x40487d,_0x273510[_0x0b64('0x81')]);return db[_0x0b64('0x4c')][_0x0b64('0x15')]({'where':_0x40487d[_0x0b64('0x5d')]})[_0x0b64('0x16')](function(_0x2db24a){_0x57918d['count']=_0x2db24a;if(_0x273510['query']['includeAll']){_0x40487d[_0x0b64('0x9b')]=[{'all':!![]}];}return db[_0x0b64('0x4c')][_0x0b64('0x2a')](_0x40487d);})[_0x0b64('0x16')](function(_0x478736){_0x57918d[_0x0b64('0x9f')]=_0x478736;return _0x57918d;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x2e72b4,_0x40487d))[_0x0b64('0x1f')](handleError(_0x2e72b4,null));};exports[_0x0b64('0xa1')]=function(_0x1d8f40,_0x33cdbf){var _0x1c1735={'raw':!![],'where':{}};var _0x407d7e={};var _0x503a4b={'count':0x0,'rows':[]};return db[_0x0b64('0x20')]['findOne']({'where':{'id':_0x1d8f40[_0x0b64('0x21')]['id']}})[_0x0b64('0x16')](handleEntityNotFound(_0x33cdbf,null))[_0x0b64('0x16')](function(_0x2b5bd9){if(_0x2b5bd9){_0x407d7e[_0x0b64('0x79')]=_[_0x0b64('0x22')](db[_0x0b64('0xa2')]['rawAttributes']);_0x407d7e[_0x0b64('0x27')]=_['keys'](_0x1d8f40['query']);_0x407d7e['filters']=_[_0x0b64('0x78')](_0x407d7e[_0x0b64('0x79')],_0x407d7e['query']);_0x1c1735[_0x0b64('0x7a')]=_[_0x0b64('0x78')](_0x407d7e[_0x0b64('0x79')],qs[_0x0b64('0x7b')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x7b')]));_0x1c1735['attributes']=_0x1c1735['attributes'][_0x0b64('0x23')]?_0x1c1735[_0x0b64('0x7a')]:_0x407d7e[_0x0b64('0x79')];if(!_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x33')]('nolimit')){_0x1c1735[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x13')]);_0x1c1735[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x14')]);}_0x1c1735['order']=qs[_0x0b64('0x7d')](_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x7d')]);_0x1c1735['where']=qs['filters'](_[_0x0b64('0x7f')](_0x1d8f40[_0x0b64('0x27')],_0x407d7e['filters']));_0x1c1735[_0x0b64('0x5d')][_0x0b64('0x98')]=_0x2b5bd9['id'];if(_0x1d8f40[_0x0b64('0x27')]['filter']){_0x1c1735['where']=_[_0x0b64('0x34')](_0x1c1735[_0x0b64('0x5d')],{'$or':_[_0x0b64('0x80')](_0x1c1735[_0x0b64('0x7a')],function(_0xde043b){var _0x345bc3={};_0x345bc3[_0xde043b]={'$like':'%'+_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x99')]+'%'};return _0x345bc3;})});}_0x1c1735=_['merge']({},_0x1c1735,_0x1d8f40[_0x0b64('0x81')]);return db[_0x0b64('0xa2')][_0x0b64('0x15')]({'where':_0x1c1735[_0x0b64('0x5d')]})[_0x0b64('0x16')](function(_0x302671){_0x503a4b['count']=_0x302671;if(_0x1d8f40[_0x0b64('0x27')][_0x0b64('0x9a')]){_0x1c1735[_0x0b64('0x9b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1c1735);})[_0x0b64('0x16')](function(_0x42fc5a){_0x503a4b[_0x0b64('0x9f')]=_0x42fc5a;return _0x503a4b;});}})[_0x0b64('0x16')](respondWithFilteredResult(_0x33cdbf,_0x1c1735))[_0x0b64('0x1f')](handleError(_0x33cdbf,null));};exports['uploadCsv']=function(_0x4e5c8a,_0x233736){try{if(!_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x6c')]){throw new Error(_0x0b64('0xa3'));}if(!_0x4e5c8a['body'][_0x0b64('0xa4')]){throw new Error(_0x0b64('0xa5'));}if(!_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0xa6')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x4e5c8a['body'][_0x0b64('0xa7')]){throw new Error(_0x0b64('0xa8'));}var _0x6162eb=_0x4e5c8a[_0x0b64('0x35')]['binding_keys'][_0x0b64('0xa9')](',');var _0x35e278=_0x4e5c8a[_0x0b64('0x35')]['binding_values']['split'](',');if(!_0x6162eb[_0x0b64('0x23')]||!_0x35e278[_0x0b64('0x23')]||_0x6162eb['length']!==_0x35e278[_0x0b64('0x23')]){throw new Error(_0x0b64('0xaa'));}_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x7b')]=_[_0x0b64('0xab')](_0x6162eb,_0x35e278);if(!_0x4e5c8a['body'][_0x0b64('0x7b')][_0x0b64('0x76')]){throw new Error(_0x0b64('0xac'));}if(!_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x7b')][_0x0b64('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x586557=path[_0x0b64('0x3b')](config['root'],_0x0b64('0xae'),_0x4e5c8a[_0x0b64('0xaf')][_0x0b64('0xb0')]);fs[_0x0b64('0xb1')](_0x586557,parseInt(_0x0b64('0xb2'),0x8));var _0x4dc69d=require(_0x0b64('0xb3'))[_0x0b64('0xb4')](path[_0x0b64('0x3b')](__dirname,_0x0b64('0xb5')),[_0x586557,_0x4e5c8a['body'][_0x0b64('0xa4')],_0x4e5c8a['body']['binding_values'],_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x6c')],_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0xb6')],_0x4e5c8a[_0x0b64('0x35')][_0x0b64('0x5c')],_0x4e5c8a['body'][_0x0b64('0xa7')]]);return _0x233736[_0x0b64('0x11')](0xc8)['json']({'message':_0x0b64('0xb7'),'pid':_0x4dc69d['pid']});}catch(_0x519819){return _0x233736[_0x0b64('0x11')](0x1f4)[_0x0b64('0xb8')](_0x519819);}};exports['upload']=function(_0x54af9f,_0x4f2ced){var _0x273e1f=fs['createReadStream'](_0x54af9f[_0x0b64('0xaf')][_0x0b64('0xb9')]);Papa[_0x0b64('0xba')](_0x273e1f,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x989962){return _0x4f2ced['status'](0xc8)[_0x0b64('0xbb')]({'file':_0x54af9f[_0x0b64('0xaf')],'fields':_0x989962[_0x0b64('0xbc')][_0x0b64('0x7b')]});}});};exports[_0x0b64('0xbd')]=function(_0x40bc19,_0x3dd0e7){return db['User'][_0x0b64('0x2a')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0b64('0xbe')}})['then'](function(_0xd9ec95){var _0x22090f=![];if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0x6c')]){throw new Error(_0x0b64('0xa3'));}if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0xbf')][_0x0b64('0x76')]){throw new Error(_0x0b64('0xac'));}if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0xbf')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x40bc19[_0x0b64('0x35')][_0x0b64('0xa7')]){throw new Error(_0x0b64('0xa8'));}var _0x2032ff=require('child_process')[_0x0b64('0xb4')](path[_0x0b64('0x3b')](__dirname,_0x0b64('0xc0')),[_0x40bc19[_0x0b64('0x21')]['id'],JSON['stringify'](_0x40bc19[_0x0b64('0x35')]),JSON['stringify'](_0xd9ec95)]);_0x2032ff['on'](_0x0b64('0xc1'),function(){_0x22090f=!![];return _0x3dd0e7[_0x0b64('0x11')](0xc8)[_0x0b64('0xbb')]({'message':_0x0b64('0xc2'),'pid':_0x2032ff[_0x0b64('0xc3')]});});_0x2032ff['on'](_0x0b64('0xc4'),function(_0x247c54){if(_0x247c54&&!_0x22090f){return _0x3dd0e7['status'](0x1f4)['json']({'message':_0x0b64('0xc5'),'pid':_0x2032ff[_0x0b64('0xc3')]});}});})['catch'](handleError(_0x3dd0e7,null));};exports[_0x0b64('0xc6')]=function(_0x5b3afd,_0x2e5ffe){return db[_0x0b64('0xc7')][_0x0b64('0x2a')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0b64('0xbe')}})[_0x0b64('0x16')](function(_0x22ba42){var _0x44bbe4=![];if(!_0x5b3afd[_0x0b64('0x35')][_0x0b64('0x6c')]){throw new Error(_0x0b64('0xa3'));}if(!_0x5b3afd[_0x0b64('0x35')][_0x0b64('0xbf')][_0x0b64('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5b3afd['body'][_0x0b64('0xbf')]['firstName']){throw new Error(_0x0b64('0xc8'));}if(!_0x5b3afd['body'][_0x0b64('0xa7')]){throw new Error(_0x0b64('0xa8'));}var _0x3570dd=require('child_process')[_0x0b64('0xb4')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x5b3afd[_0x0b64('0x21')]['id'],JSON[_0x0b64('0xc9')](_0x5b3afd['body']),JSON[_0x0b64('0xc9')](_0x22ba42)]);_0x3570dd['on'](_0x0b64('0xc1'),function(){_0x44bbe4=!![];return _0x2e5ffe['status'](0xc8)['json']({'message':_0x0b64('0xc2'),'pid':_0x3570dd[_0x0b64('0xc3')]});});_0x3570dd['on'](_0x0b64('0xc4'),function(_0x5910a9){if(_0x5910a9&&!_0x44bbe4){return _0x2e5ffe[_0x0b64('0x11')](0x1f4)['json']({'message':_0x0b64('0xc5'),'pid':_0x3570dd[_0x0b64('0xc3')]});}});})[_0x0b64('0x1f')](handleError(_0x2e5ffe,null));};exports[_0x0b64('0xca')]=function(_0x231487,_0x2e1359){var _0x51a67c=[_0x0b64('0xcb'),_0x0b64('0xcc'),'sms',_0x0b64('0xcd'),_0x0b64('0xce'),_0x0b64('0xcf'),_0x0b64('0xd0')];var _0x521318={'offset':0x0,'order':qs[_0x0b64('0x7d')](_0x0b64('0xd1'))},_0x79c44f={'count':0x0,'rows':[]};Promise[_0x0b64('0xd2')]()[_0x0b64('0x16')](function(){if(_0x231487['query']['channel']){if(!_['includes'](_0x51a67c,_0x231487[_0x0b64('0x27')][_0x0b64('0xd3')][_0x0b64('0xd4')]())){throw new Error(_0x0b64('0xd5'));}_0x51a67c=[_0x231487[_0x0b64('0x27')][_0x0b64('0xd3')][_0x0b64('0xd4')]()];}if(_0x231487['query'][_0x0b64('0xd6')]){try{var _0x212cd5=JSON[_0x0b64('0xba')](_0x231487[_0x0b64('0x27')]['range']);if(!moment(_0x212cd5[_0x0b64('0x36')])['isValid']()){throw new Error(_0x0b64('0xd7'));}if(!moment(_0x212cd5['to'])[_0x0b64('0xd8')]()){throw new Error(_0x0b64('0xd9'));}}catch(_0xedbd6c){throw new Error(_0x0b64('0xda'));}}if(!_0x231487[_0x0b64('0x27')][_0x0b64('0x33')](_0x0b64('0x83'))){_0x521318[_0x0b64('0x13')]=qs[_0x0b64('0x13')](_0x231487[_0x0b64('0x27')]['limit']||0xa);_0x521318[_0x0b64('0x14')]=qs[_0x0b64('0x14')](_0x231487['query'][_0x0b64('0x14')]);}var _0x2c08fd=_0x51a67c[_0x0b64('0x80')](function(_0x39e664){if(_0x39e664===_0x0b64('0xd0')){var _0x571f5e={'attributes':['id','uniqueid',_0x0b64('0x2e'),_0x0b64('0xdb'),_0x0b64('0xdc'),_0x0b64('0xdd'),_0x0b64('0xde'),_0x0b64('0xdf'),_0x0b64('0xe0'),_0x0b64('0xe1'),'createdAt','userDisposition',_0x0b64('0xe2'),_0x0b64('0xe3'),_0x0b64('0xe4')],'where':{'ContactId':_0x231487[_0x0b64('0x21')]['id']},'include':[{'model':db[_0x0b64('0xc7')],'as':'User','attributes':['id',_0x0b64('0x1b'),'fullname',_0x0b64('0x2c')]}],'order':[[_0x0b64('0xe5'),_0x0b64('0xe6')]]};if(_0x231487[_0x0b64('0x27')][_0x0b64('0xd6')]){_0x571f5e[_0x0b64('0x5d')][_0x0b64('0xe5')]={'$gte':_0x212cd5[_0x0b64('0x36')],'$lte':_0x212cd5['to']};}return db[_0x0b64('0x4e')][_0x0b64('0xe7')](_0x571f5e)[_0x0b64('0x16')](function(_0x1479cb){_0x79c44f[_0x0b64('0x15')]+=_0x1479cb['count'];return _[_0x0b64('0x80')](_0x1479cb[_0x0b64('0x9f')],function(_0x1b0610){var _0x50a07f=_0x1b0610[_0x0b64('0x37')]({'plain':!![]});_0x50a07f[_0x0b64('0xd3')]=_0x39e664;if(_0x50a07f[_0x0b64('0xc7')]){_0x50a07f[_0x0b64('0xc7')]={'id':_0x50a07f['User']['id'],'name':_0x50a07f[_0x0b64('0xc7')][_0x0b64('0x1b')],'fullname':_0x50a07f[_0x0b64('0xc7')][_0x0b64('0xe8')],'alias':_0x50a07f[_0x0b64('0xc7')]['alias']};}return _0x50a07f;});});}else{var _0x44ad55=_['startCase'](_0x39e664)+(_0x39e664==='chat'?_0x0b64('0xe9'):_0x0b64('0xea'));var _0x2f201c={'attributes':['id',_0x0b64('0xeb'),_0x0b64('0xec'),'createdAt','note','disposition','secondDisposition','thirdDisposition',_0x0b64('0xe4'),_0x44ad55+'Id'],'where':{'ContactId':_0x231487[_0x0b64('0x21')]['id']},'include':[{'model':db[_0x44ad55],'as':_0x0b64('0xea'),'attributes':['id','name',_0x0b64('0xed')]},{'model':db[_0x0b64('0xc7')],'as':_0x0b64('0xee'),'attributes':['id','name','fullname']},{'model':db[_0x0b64('0x64')],'as':_0x0b64('0x65'),'attributes':['id','name',_0x0b64('0x66')],'through':{'attributes':[]}}],'order':[['createdAt',_0x0b64('0xe6')]]};if(_0x231487['query']['range']){_0x2f201c[_0x0b64('0x5d')][_0x0b64('0xe5')]={'$gte':_0x212cd5['from'],'$lte':_0x212cd5['to']};}switch(_0x39e664){case _0x0b64('0xcc'):_0x2f201c[_0x0b64('0x7a')][_0x0b64('0x5f')](_0x0b64('0xef'),_0x0b64('0xf0'),'customerPort',_0x0b64('0xf1'),'osName',_0x0b64('0xf2'),'ratingType',_0x0b64('0xf3'),_0x0b64('0xf4'));break;case'mail':_0x2f201c[_0x0b64('0x7a')]['push']('subject',_0x0b64('0xf5'));break;case _0x0b64('0xcd'):_0x2f201c[_0x0b64('0x7a')]['push'](_0x0b64('0xf6'),_0x0b64('0xf7'));break;}return db[_[_0x0b64('0xf8')](_0x39e664)+_0x0b64('0xf9')]['findAndCountAll'](_0x2f201c)[_0x0b64('0x16')](function(_0x14b495){_0x79c44f[_0x0b64('0x15')]+=_0x14b495[_0x0b64('0x15')];return _[_0x0b64('0x80')](_0x14b495['rows'],function(_0x176d85){var _0x2eaa81=_0x176d85['get']({'plain':!![]});_0x2eaa81[_0x0b64('0xd3')]=_0x39e664;if(_0x2eaa81[_0x0b64('0xee')]){_0x2eaa81[_0x0b64('0xee')]={'id':_0x2eaa81['Owner']['id'],'name':_0x2eaa81[_0x0b64('0xee')][_0x0b64('0x1b')],'fullname':_0x2eaa81[_0x0b64('0xee')][_0x0b64('0xe8')]};}return _0x2eaa81;});});}});return Promise[_0x0b64('0x62')](_0x2c08fd);})['then'](function(_0x7d3f8a){return _(_0x7d3f8a)[_0x0b64('0xfa')]()[_0x0b64('0xfb')](_0x0b64('0xe5'))[_0x0b64('0xfc')]()[_0x0b64('0xfd')]();})['then'](function(_0x4c5935){_0x79c44f[_0x0b64('0x9f')]=_0x521318['limit']?_0x4c5935[_0x0b64('0xfe')](_0x521318[_0x0b64('0x14')],_0x521318[_0x0b64('0x14')]+_0x521318['limit']):_0x4c5935;return _0x79c44f;})[_0x0b64('0x16')](respondWithFilteredResult(_0x2e1359,_0x521318))[_0x0b64('0x1f')](handleError(_0x2e1359,null));}; \ No newline at end of file +var _0xc083=['server/files/tmp','file','filename','0777','fork','../../components/import/cm/csv','binding_values','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','import','User','agent','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','exit','importUpdates','../../components/import/cm/csvUpdates','message','mail','openchannel','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','note','createdAt','userDisposition','userSecondDisposition','UserId','DESC','findAndCountAll','startCase','chat','Website','closed','closedAt','thirdDisposition','Account','key','Owner','fullname','browserName','customerIp','customerPort','deviceModel','osName','ratingValue','referer','subject','Interaction','flatten','sortBy','reverse','value','slice','bluebird','util','path','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','limit','undefined','count','offset','Content-Range','then','end','sendStatus','error','stack','name','send','describe','findAll','query','user','destroy','CmContact','find','params','catch','tags','keys','length','startsWith','cf_','displayName','analytics','CmCustomField','columnName','alias','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','show','Tag','Tags','color','tag','Phones','sequelize','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ContactItemType','ItemType','literal','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root'];(function(_0x2fb1dc,_0x37bf60){var _0x16256a=function(_0x4257eb){while(--_0x4257eb){_0x2fb1dc['push'](_0x2fb1dc['shift']());}};_0x16256a(++_0x37bf60);}(_0xc083,0x144));var _0x3c08=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc083[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var BPromise=require(_0x3c08('0x0'));var util=require(_0x3c08('0x1'));var path=require(_0x3c08('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c08('0x3'));var Papa=require(_0x3c08('0x4'));var Redis=require(_0x3c08('0x5'));var contacts=require(_0x3c08('0x6'));var qs=require(_0x3c08('0x7'));var logger=require(_0x3c08('0x8'))('api');var config=require(_0x3c08('0x9'));var shared=require('../../config/environment/shared');var db=require(_0x3c08('0xa'))['db'];config[_0x3c08('0xb')]=_[_0x3c08('0xc')](config[_0x3c08('0xb')],{'host':_0x3c08('0xd'),'port':0x18eb});var socket=require(_0x3c08('0xe'))(new Redis(config[_0x3c08('0xb')]));require('./cmContact.socket')[_0x3c08('0xf')](socket);function respondWithResult(_0x467425,_0x4bcbc2){_0x4bcbc2=_0x4bcbc2||0xc8;return function(_0x2a2278){if(_0x2a2278){return _0x467425[_0x3c08('0x10')](_0x4bcbc2)[_0x3c08('0x11')](_0x2a2278);}};}function respondWithFilteredResult(_0x4b2a4f,_0x22c396){return function(_0x1bb09d){if(_0x1bb09d){var _0x31372c=typeof _0x22c396['offset']==='undefined'&&typeof _0x22c396[_0x3c08('0x12')]===_0x3c08('0x13');var _0x3378f7=_0x1bb09d[_0x3c08('0x14')];var _0x31d199=_0x31372c?0x0:_0x22c396[_0x3c08('0x15')];var _0xfdf771=_0x31372c?_0x1bb09d[_0x3c08('0x14')]:_0x22c396[_0x3c08('0x15')]+_0x22c396[_0x3c08('0x12')];var _0x128ee0;if(_0xfdf771>=_0x3378f7){_0xfdf771=_0x3378f7;_0x128ee0=0xc8;}else{_0x128ee0=0xce;}_0x4b2a4f[_0x3c08('0x10')](_0x128ee0);return _0x4b2a4f['set'](_0x3c08('0x16'),_0x31d199+'-'+_0xfdf771+'/'+_0x3378f7)[_0x3c08('0x11')](_0x1bb09d);}return null;};}function saveUpdates(_0x289499){return function(_0x377848){if(_0x377848){return _0x377848['update'](_0x289499)[_0x3c08('0x17')](function(_0x5527dd){return _0x5527dd;});}return null;};}function removeEntity(_0x4731eb){return function(_0x1fb7ca){if(_0x1fb7ca){return _0x1fb7ca['destroy']()['then'](function(){_0x4731eb[_0x3c08('0x10')](0xcc)[_0x3c08('0x18')]();});}};}function handleEntityNotFound(_0x1f4e5c){return function(_0x5bf6ef){if(!_0x5bf6ef){_0x1f4e5c[_0x3c08('0x19')](0x194);}return _0x5bf6ef;};}function handleError(_0xac9e9f,_0x559493){_0x559493=_0x559493||0x1f4;return function(_0x1d5651){logger[_0x3c08('0x1a')](_0x1d5651[_0x3c08('0x1b')]);if(_0x1d5651[_0x3c08('0x1c')]){delete _0x1d5651['name'];}_0xac9e9f['status'](_0x559493)[_0x3c08('0x1d')](_0x1d5651);};}exports['index']=function(_0x311c01,_0x3b2576){var _0x2b5bb5={};return contacts[_0x3c08('0x1e')]()[_0x3c08('0x17')](function(_0x18c777){_0x2b5bb5=qs['getOptions'](_0x18c777,_0x311c01);return contacts[_0x3c08('0x1f')](_0x311c01[_0x3c08('0x20')],_0x311c01[_0x3c08('0x21')],_0x2b5bb5,_0x18c777);})[_0x3c08('0x17')](respondWithFilteredResult(_0x3b2576,_0x2b5bb5))['catch'](handleError(_0x3b2576,null));};exports[_0x3c08('0x22')]=function(_0x3191b8,_0xb17a65){return db[_0x3c08('0x23')][_0x3c08('0x24')]({'where':{'id':_0x3191b8[_0x3c08('0x25')]['id']}})[_0x3c08('0x17')](handleEntityNotFound(_0xb17a65,null))['then'](removeEntity(_0xb17a65,null))[_0x3c08('0x26')](handleError(_0xb17a65,null));};exports[_0x3c08('0x1e')]=function(_0x3181c0,_0x5ac76f){return db[_0x3c08('0x23')][_0x3c08('0x1e')]()[_0x3c08('0x17')](function(_0x1746a6){delete _0x1746a6[_0x3c08('0x27')];for(var _0xff2c30=0x0;_0xff2c300x0){return new Promise(function(_0x4ffdc3){var _0x38e2fd=[];for(var _0x3817e2=0x0;_0x3817e2<_0x496484[_0x3c08('0x29')];_0x3817e2++){_0x38e2fd['push'](insertAdditionalPhones(_0x496484[_0x3817e2]['contact'],_0x496484[_0x3817e2][_0x3c08('0x5a')]));}Promise['all'](_0x38e2fd)[_0x3c08('0x17')](function(){_0x4ffdc3(0x1);});})['then'](function(){return{'success':_0x525c1e,'failure':_0x403f93,'duplicates':_0x13395e};});}else{return{'success':_0x525c1e,'failure':_0x403f93,'duplicates':_0x13395e};}}})[_0x3c08('0x17')](respondWithResult(_0x41f48e,0xc9))[_0x3c08('0x26')](handleError(_0x41f48e,null));};exports[_0x3c08('0x63')]=function(_0x341c28,_0x29a13a){var _0x16449b;return db['CmContact'][_0x3c08('0x1e')]()[_0x3c08('0x17')](function(_0x153af8){return db['CmContact'][_0x3c08('0x24')]({'where':{'id':_0x341c28[_0x3c08('0x25')]['id']},'include':[{'model':db[_0x3c08('0x64')],'as':_0x3c08('0x65'),'attributes':['id','name',_0x3c08('0x66')],'required':_0x341c28[_0x3c08('0x20')][_0x3c08('0x67')]?!![]:![]},{'model':db[_0x3c08('0x49')],'as':_0x3c08('0x68'),'where':{'CmContactId':_0x341c28[_0x3c08('0x25')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db[_0x3c08('0x69')]['literal'](_0x3c08('0x6a'))],'attributes':_[_0x3c08('0x28')](_0x153af8)});})[_0x3c08('0x17')](function(_0x3a1cc8){if(!_[_0x3c08('0x56')](_0x3a1cc8)){_0x16449b=_0x3a1cc8[_0x3c08('0x3a')]({'plain':!![]});var _0x2d57fe={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3a1cc8&&_0x3a1cc8[_0x3c08('0x60')]){if(_0x3a1cc8[_0x3c08('0x60')]){_0x2d57fe['where'][_0x3c08('0x6b')]['push']({'ListId':{'$ne':_0x3a1cc8[_0x3c08('0x60')]}});}}return db[_0x3c08('0x2e')][_0x3c08('0x1f')](_0x2d57fe);}})['then'](function(_0x57c934){if(!_['isNil'](_0x57c934)){return _[_0x3c08('0x6c')](_0x16449b,_[_0x3c08('0x6d')](_0x57c934,function(_0x38b2ce){return util[_0x3c08('0x6e')](_0x3c08('0x6f'),_0x38b2ce['id']);}));}})[_0x3c08('0x17')](handleEntityNotFound(_0x29a13a,null))[_0x3c08('0x17')](respondWithResult(_0x29a13a,null))[_0x3c08('0x26')](handleError(_0x29a13a,null));};exports[_0x3c08('0x40')]=function(_0x1bf802,_0x1ced17){var _0x130872;if(_0x1bf802['body']['id']){delete _0x1bf802[_0x3c08('0x38')]['id'];}if(!_[_0x3c08('0x56')](_0x1bf802[_0x3c08('0x38')][_0x3c08('0x57')])){var _0x1cade5=_0x1bf802['body']['dialTimezone'];if(!_['isNil'](shared[_0x3c08('0x58')][_0x1cade5]))_0x1bf802['body'][_0x3c08('0x59')]=shared[_0x3c08('0x58')][_0x1cade5][_0x3c08('0x59')];}return db[_0x3c08('0x23')][_0x3c08('0x24')]({'where':{'id':_0x1bf802[_0x3c08('0x25')]['id']}})[_0x3c08('0x17')](handleEntityNotFound(_0x1ced17,null))['then'](saveUpdates(_0x1bf802[_0x3c08('0x38')],null))[_0x3c08('0x17')](function(_0x3b8a6d){_0x130872=_0x3b8a6d;var _0x388edc={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3b8a6d&&_0x3b8a6d[_0x3c08('0x60')]){if(_0x3b8a6d['ListId']){_0x388edc['where'][_0x3c08('0x6b')]['push']({'ListId':{'$ne':_0x3b8a6d[_0x3c08('0x60')]}});}}return db[_0x3c08('0x2e')][_0x3c08('0x1f')](_0x388edc);})[_0x3c08('0x17')](function(_0x18a7ad){if(_0x18a7ad){return _[_0x3c08('0x6c')](_[_0x3c08('0x70')](_0x1bf802['body'],function(_0x4cb795,_0x1ea70a){return _[_0x3c08('0x2a')](_0x1ea70a,_0x3c08('0x2b'));}),_[_0x3c08('0x6d')](_0x18a7ad,function(_0x1ddb66){return util[_0x3c08('0x6e')](_0x3c08('0x6f'),_0x1ddb66['id']);}));}})[_0x3c08('0x17')](function(_0x5ac2e4){if(_0x5ac2e4&&!_[_0x3c08('0x71')](_0x5ac2e4)){var _0x5a7634=squel[_0x3c08('0x40')]()['table'](_0x3c08('0x72'))['setFields'](_0x5ac2e4)[_0x3c08('0x5e')](_0x3c08('0x73'),_0x1bf802[_0x3c08('0x25')]['id'])[_0x3c08('0x74')]();return db['sequelize'][_0x3c08('0x20')](_0x5a7634[_0x3c08('0x75')],{'replacements':_0x5a7634[_0x3c08('0x76')]});}})[_0x3c08('0x17')](function(){if(_0x1bf802['body']['phone']&&_0x130872){return db[_0x3c08('0x3d')][_0x3c08('0x40')]({'phone':_0x1bf802[_0x3c08('0x38')][_0x3c08('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x130872['id']}});}})[_0x3c08('0x17')](function(){return _0x130872;})[_0x3c08('0x17')](respondWithResult(_0x1ced17,null))['catch'](handleError(_0x1ced17,null));};exports[_0x3c08('0x78')]=function(_0x2ad47a,_0x48a3e4){var _0x36ca7b={};var _0x2e3769={};var _0x3d54ab;var _0x365b2c;return db[_0x3c08('0x23')][_0x3c08('0x79')]({'where':{'id':_0x2ad47a[_0x3c08('0x25')]['id']}})[_0x3c08('0x17')](handleEntityNotFound(_0x48a3e4,null))[_0x3c08('0x17')](function(_0x252486){if(_0x252486){_0x3d54ab=_0x252486;_0x2e3769['model']=_['keys'](db['Tag'][_0x3c08('0x7a')]);_0x2e3769[_0x3c08('0x20')]=_[_0x3c08('0x28')](_0x2ad47a[_0x3c08('0x20')]);_0x2e3769[_0x3c08('0x7b')]=_[_0x3c08('0x7c')](_0x2e3769[_0x3c08('0x7d')],_0x2e3769[_0x3c08('0x20')]);_0x36ca7b[_0x3c08('0x7e')]=_[_0x3c08('0x7c')](_0x2e3769['model'],qs[_0x3c08('0x7f')](_0x2ad47a['query'][_0x3c08('0x7f')]));_0x36ca7b['attributes']=_0x36ca7b[_0x3c08('0x7e')][_0x3c08('0x29')]?_0x36ca7b[_0x3c08('0x7e')]:_0x2e3769[_0x3c08('0x7d')];_0x36ca7b[_0x3c08('0x80')]=qs[_0x3c08('0x81')](_0x2ad47a[_0x3c08('0x20')][_0x3c08('0x81')]);_0x36ca7b[_0x3c08('0x5e')]=qs[_0x3c08('0x7b')](_[_0x3c08('0x82')](_0x2ad47a['query'],_0x2e3769['filters']));if(_0x2ad47a[_0x3c08('0x20')][_0x3c08('0x83')]){_0x36ca7b[_0x3c08('0x5e')]=_[_0x3c08('0x37')](_0x36ca7b[_0x3c08('0x5e')],{'$or':_[_0x3c08('0x6d')](_0x36ca7b['attributes'],function(_0x1e6631){var _0x49b496={};_0x49b496[_0x1e6631]={'$like':'%'+_0x2ad47a['query'][_0x3c08('0x83')]+'%'};return _0x49b496;})});}_0x36ca7b=_[_0x3c08('0x37')]({},_0x36ca7b,_0x2ad47a[_0x3c08('0x84')]);return _0x3d54ab['getTags'](_0x36ca7b);}})[_0x3c08('0x17')](function(_0x3c503d){if(_0x3c503d){_0x365b2c=_0x3c503d[_0x3c08('0x29')];if(!_0x2ad47a[_0x3c08('0x20')][_0x3c08('0x36')](_0x3c08('0x85'))){_0x36ca7b[_0x3c08('0x12')]=qs[_0x3c08('0x12')](_0x2ad47a[_0x3c08('0x20')][_0x3c08('0x12')]);_0x36ca7b['offset']=qs[_0x3c08('0x15')](_0x2ad47a['query'][_0x3c08('0x15')]);}return _0x3d54ab[_0x3c08('0x78')](_0x36ca7b);}})[_0x3c08('0x17')](function(_0x23e142){if(_0x23e142){return _0x23e142?{'count':_0x365b2c,'rows':_0x23e142}:null;}})[_0x3c08('0x17')](respondWithResult(_0x48a3e4,null))['catch'](handleError(_0x48a3e4,null));};exports[_0x3c08('0x86')]=function(_0x467838,_0x5306f0){if(_0x467838[_0x3c08('0x38')]['id']){delete _0x467838[_0x3c08('0x38')]['id'];}return db[_0x3c08('0x23')][_0x3c08('0x79')]({'where':{'id':_0x467838[_0x3c08('0x25')]['id']}})[_0x3c08('0x17')](handleEntityNotFound(_0x5306f0,null))[_0x3c08('0x17')](function(_0x5b0357){if(_0x5b0357){return _0x5b0357[_0x3c08('0x86')](_0x467838[_0x3c08('0x38')][_0x3c08('0x87')]||[]);}return null;})[_0x3c08('0x17')](respondWithResult(_0x5306f0,null))['catch'](handleError(_0x5306f0,null));};exports[_0x3c08('0x88')]=function(_0x366d5d,_0x476165){var _0x29ff71=[];_0x29ff71['push'](addAdditionalPhones(_0x366d5d['body']));Promise[_0x3c08('0x89')](_0x29ff71)[_0x3c08('0x17')](function(){_0x29ff71=[];_0x29ff71[_0x3c08('0x5f')](deleteCmHopperPhones(_0x366d5d['body']['id']));_0x29ff71['push'](addCmHopperPhones(_0x366d5d['body']['id']));Promise[_0x3c08('0x89')](_0x29ff71)['then'](function(){return[0x1];})[_0x3c08('0x17')](respondWithResult(_0x476165,null));});};function addAdditionalPhones(_0x55160c){var _0x364661;return new Promise(function(_0x2469db){return db['CmContactHasItem'][_0x3c08('0x22')]({'where':{'CmContactId':_0x55160c['id']}})[_0x3c08('0x17')](function(){db['ContactItemType'][_0x3c08('0x1f')]({'raw':!![],'attributes':['id',_0x3c08('0x8a')]})['then'](function(_0x4c2ed9){var _0x23de02=[];for(var _0x4bc0a7=0x0;_0x4bc0a7<_0x55160c[_0x3c08('0x8b')][_0x3c08('0x29')];_0x4bc0a7++){var _0x39192e=_0x55160c[_0x3c08('0x8c')]?_[_0x3c08('0x56')](_0x55160c[_0x3c08('0x8c')][_0x4bc0a7])?'':_0x55160c[_0x3c08('0x8c')][_0x4bc0a7]:_0x55160c[_0x3c08('0x8b')][_0x4bc0a7][_0x3c08('0x8d')]?_0x55160c[_0x3c08('0x8b')][_0x4bc0a7][_0x3c08('0x8d')]:'';var _0x4e7bd1=_[_0x3c08('0x56')](_0x55160c[_0x3c08('0x8b')][_0x4bc0a7]['description'])?'':_0x55160c['items'][_0x4bc0a7][_0x3c08('0x8e')];var _0x20fc32=_0x39192e+':'+_0x55160c['items'][_0x4bc0a7]['phone']+'§'+_0x4e7bd1;if(_[_0x3c08('0x56')](_0x364661))_0x364661=_0x20fc32;else _0x364661+=';'+_0x20fc32;var _0x15e73a=null;var _0x5955c3=null;if(_0x55160c[_0x3c08('0x8c')]){if(!_[_0x3c08('0x56')](_0x55160c[_0x3c08('0x8c')][_0x4bc0a7])){_0x5955c3=_[_0x3c08('0x24')](_0x4c2ed9,function(_0x4dcd2c){return _0x4dcd2c['id']===_0x55160c[_0x3c08('0x8c')][_0x4bc0a7];});if(!_[_0x3c08('0x56')](_0x5955c3)){_0x15e73a=_0x5955c3['OrderBy'];}}}else{if(!_[_0x3c08('0x56')](_0x55160c[_0x3c08('0x8b')][_0x4bc0a7])){_0x5955c3=_[_0x3c08('0x24')](_0x4c2ed9,function(_0x3dc4fc){return _0x3dc4fc['id']===_0x55160c['items'][_0x4bc0a7]['ItemTypeId'];});if(!_['isNil'](_0x5955c3)){_0x15e73a=_0x4bc0a7;}}}if(_[_0x3c08('0x56')](_0x15e73a)){_0x15e73a=0x64;}_0x23de02[_0x3c08('0x5f')](addAdditionalPhone(_0x55160c['id'],_0x55160c[_0x3c08('0x8b')][_0x4bc0a7][_0x3c08('0x77')],_0x55160c[_0x3c08('0x8c')]?_[_0x3c08('0x56')](_0x55160c[_0x3c08('0x8c')][_0x4bc0a7])?null:_0x55160c[_0x3c08('0x8c')][_0x4bc0a7]:_0x55160c['items'][_0x4bc0a7][_0x3c08('0x8d')]?_0x55160c[_0x3c08('0x8b')][_0x4bc0a7][_0x3c08('0x8d')]:null,_0x15e73a,_0x4e7bd1));}Promise[_0x3c08('0x89')](_0x23de02)[_0x3c08('0x17')](function(){db['CmContact'][_0x3c08('0x40')]({'AdditionalPhones':_0x364661},{'where':{'id':_0x55160c['id']}})[_0x3c08('0x17')](function(){_0x2469db(0x1);});});});});});}function addAdditionalPhone(_0x4208e1,_0x487da1,_0x400fdb,_0x56b8df,_0x409c8f){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x4208e1,'item':_0x487da1}})[_0x3c08('0x17')](function(_0x2c48a1){if(_0x2c48a1)logger[_0x3c08('0x33')](_0x3c08('0x8f'),_0x2c48a1);else{db['CmContactHasItem']['create']({'CmContactId':_0x4208e1,'item':_0x487da1,'ItemTypeId':_0x400fdb,'OrderBy':_0x56b8df,'ItemClass':_0x3c08('0x90'),'description':_0x409c8f});}});}function deleteCmHopperPhones(_0x3a2199){return new Promise(function(_0x221a50){return db[_0x3c08('0x3d')][_0x3c08('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3a2199}})[_0x3c08('0x17')](function(_0x101340){db[_0x3c08('0x91')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x3c08('0x6d')](_0x101340,'id')}}});})['then'](function(){_0x221a50(0x1);});});}function addCmHopperPhones(_0x49f1d){return new Promise(function(_0xc4fbbf){return db[_0x3c08('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x49f1d}})[_0x3c08('0x17')](function(_0xb4e2ee){var _0x51483c=[];_[_0x3c08('0x6d')](_0xb4e2ee,function(_0xe94eac){_0x51483c['push'](createCmHopperPhone(_0x49f1d,_0xe94eac['id']));});Promise['all'](_0x51483c)[_0x3c08('0x17')](function(){_0xc4fbbf(0x1);});});});}function createCmHopperPhone(_0x3045cd,_0x2b2bfc){return new Promise(function(_0xd69d93){db[_0x3c08('0x49')][_0x3c08('0x1f')]({'raw':!![],'attributes':[_0x3c08('0x92'),_0x3c08('0x8a')],'where':{'CmContactId':_0x3045cd,'ItemClass':_0x3c08('0x90')},'include':[{'model':db[_0x3c08('0x93')],'attributes':[_0x3c08('0x8a')],'as':_0x3c08('0x94')}],'order':[_0x3c08('0x8a'),db[_0x3c08('0x69')][_0x3c08('0x95')](_0x3c08('0x96'))]})['then'](function(_0x26c6f0){var _0x1d0161=0x1;var _0x39fde9=_['map'](_0x26c6f0,function(_0x5a06ac){_0x5a06ac[_0x3c08('0x97')]=_0x2b2bfc;_0x5a06ac[_0x3c08('0x77')]=_0x5a06ac['item'];_0x5a06ac[_0x3c08('0x8a')]=_0x1d0161;delete _0x5a06ac['ItemType.OrderBy'];_0x1d0161=_0x1d0161+0x1;return _0x5a06ac;});return db['CmHopperAdditionalPhone'][_0x3c08('0x5b')](_0x39fde9,{});})[_0x3c08('0x17')](function(){_0xd69d93(0x1);});});}function insertAdditionalPhones(_0x3b3674,_0x42ad6b){return new Promise(function(_0x20ab32){var _0x291937=[];for(var _0x1f7169=0x0;_0x1f7169<_0x42ad6b[_0x3c08('0x29')];_0x1f7169++){var _0x4b1548=_0x42ad6b[_0x1f7169];_0x291937['push'](parseContactItemType(_0x4b1548));}Promise[_0x3c08('0x89')](_0x291937)['then'](function(){var _0x436345={'id':_0x3b3674['id'],'items':_0x42ad6b};return addAdditionalPhones(_0x436345)[_0x3c08('0x17')](function(){return addCmHopperPhones(_0x3b3674['id']);});})[_0x3c08('0x17')](function(){_0x20ab32(_0x3b3674);});});}function parseContactItemType(_0x4e177b){return new Promise(function(_0x83491e){if(_0x4e177b[_0x3c08('0x36')](_0x3c08('0x8d'))){_0x83491e(_0x4e177b);}else{return db[_0x3c08('0x93')]['find']({'where':{'name':_0x4e177b[_0x3c08('0x94')]}})['then'](function(_0x459a63){if(_[_0x3c08('0x56')](_0x459a63))_0x4e177b[_0x3c08('0x8d')]=null;else _0x4e177b['ItemTypeId']=_0x459a63['id'];_0x83491e(_0x4e177b);});}});}exports[_0x3c08('0x98')]=function(_0xafe981,_0x235d4d){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0xafe981['params']['id'],'ItemClass':_0x3c08('0x90')},'include':[{'model':db[_0x3c08('0x93')],'as':'ItemType'}],'order':[[_0x3c08('0x8a')],[db['sequelize'][_0x3c08('0x95')](_0x3c08('0x96'))]]})['then'](function(_0x20068d){return _0x20068d;})[_0x3c08('0x17')](respondWithResult(_0x235d4d,null))[_0x3c08('0x26')](handleError(_0x235d4d,null));};exports[_0x3c08('0x99')]=function(_0x3fa088,_0x3d5ff6){return db[_0x3c08('0x49')][_0x3c08('0x1f')]({'raw':!![],'where':{'CmContactId':_0x3fa088[_0x3c08('0x38')][_0x3c08('0x9a')]}})[_0x3c08('0x17')](function(_0x3ace04){var _0x55ff33=_[_0x3c08('0x6d')](_0x3ace04,function(_0x5993c1){_0x5993c1[_0x3c08('0x9b')]=_0x3fa088[_0x3c08('0x38')][_0x3c08('0x9c')];return _0x5993c1;});return db[_0x3c08('0x49')][_0x3c08('0x5b')](_0x55ff33,{});})[_0x3c08('0x17')](function(){return addCmHopperPhones(_0x3fa088[_0x3c08('0x38')][_0x3c08('0x9c')]);})[_0x3c08('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x3d5ff6,null))[_0x3c08('0x26')](handleError(_0x3d5ff6,null));};exports['rescheduleAdditionalPhones']=function(_0x3cfaf6,_0x4383db){var _0x35af94=[];_0x35af94[_0x3c08('0x5f')](createCmHopperPhone(_0x3cfaf6[_0x3c08('0x38')]['id'],_0x3cfaf6['body'][_0x3c08('0x9d')]));Promise[_0x3c08('0x89')](_0x35af94)[_0x3c08('0x17')](function(){return[0x1];})[_0x3c08('0x17')](respondWithResult(_0x4383db,null));};exports['getHoppers']=function(_0x5ea97a,_0x5b88cc){var _0xc125dc={'raw':![],'where':{}};var _0x5ec744={};var _0x4de923={'count':0x0,'rows':[]};return db[_0x3c08('0x23')][_0x3c08('0x79')]({'where':{'id':_0x5ea97a[_0x3c08('0x25')]['id']}})['then'](handleEntityNotFound(_0x5b88cc,null))[_0x3c08('0x17')](function(_0x15823e){if(_0x15823e){_0x5ec744['model']=_[_0x3c08('0x28')](db[_0x3c08('0x3d')][_0x3c08('0x7a')]);_0x5ec744['query']=_[_0x3c08('0x28')](_0x5ea97a[_0x3c08('0x20')]);_0x5ec744['filters']=_[_0x3c08('0x7c')](_0x5ec744[_0x3c08('0x7d')],_0x5ec744[_0x3c08('0x20')]);_0xc125dc[_0x3c08('0x7e')]=_[_0x3c08('0x7c')](_0x5ec744[_0x3c08('0x7d')],qs[_0x3c08('0x7f')](_0x5ea97a[_0x3c08('0x20')][_0x3c08('0x7f')]));_0xc125dc[_0x3c08('0x7e')]=_0xc125dc['attributes'][_0x3c08('0x29')]?_0xc125dc[_0x3c08('0x7e')]:_0x5ec744[_0x3c08('0x7d')];if(!_0x5ea97a['query'][_0x3c08('0x36')](_0x3c08('0x85'))){_0xc125dc[_0x3c08('0x12')]=qs[_0x3c08('0x12')](_0x5ea97a['query'][_0x3c08('0x12')]);_0xc125dc[_0x3c08('0x15')]=qs[_0x3c08('0x15')](_0x5ea97a[_0x3c08('0x20')][_0x3c08('0x15')]);}_0xc125dc[_0x3c08('0x80')]=qs['sort'](_0x5ea97a[_0x3c08('0x20')]['sort']);_0xc125dc[_0x3c08('0x5e')]=qs[_0x3c08('0x7b')](_[_0x3c08('0x82')](_0x5ea97a[_0x3c08('0x20')],_0x5ec744[_0x3c08('0x7b')]));_0xc125dc[_0x3c08('0x5e')][_0x3c08('0x9e')]=_0x15823e['id'];if(_0x5ea97a['query'][_0x3c08('0x83')]){_0xc125dc['where']=_[_0x3c08('0x37')](_0xc125dc[_0x3c08('0x5e')],{'$or':_[_0x3c08('0x6d')](_0xc125dc[_0x3c08('0x7e')],function(_0x562cd6){var _0x1612d0={};_0x1612d0[_0x562cd6]={'$like':'%'+_0x5ea97a[_0x3c08('0x20')][_0x3c08('0x83')]+'%'};return _0x1612d0;})});}_0xc125dc=_[_0x3c08('0x37')]({},_0xc125dc,_0x5ea97a['options']);return db['CmHopper'][_0x3c08('0x14')]({'where':_0xc125dc[_0x3c08('0x5e')]})[_0x3c08('0x17')](function(_0x569cd2){_0x4de923[_0x3c08('0x14')]=_0x569cd2;if(_0x5ea97a[_0x3c08('0x20')][_0x3c08('0x9f')]){_0xc125dc[_0x3c08('0xa0')]=[{'all':!![]}];}return db['CmHopper'][_0x3c08('0x1f')](_0xc125dc);})[_0x3c08('0x17')](function(_0x1140a5){_0x4de923['rows']=_0x1140a5;return _0x4de923;});}})['then'](respondWithFilteredResult(_0x5b88cc,_0xc125dc))[_0x3c08('0x26')](handleError(_0x5b88cc,null));};exports[_0x3c08('0xa1')]=function(_0x266556,_0x1e41fe){var _0x3661ef={'raw':!![],'where':{}};var _0x3e70a8={};var _0x3b77c3={'count':0x0,'rows':[]};return db[_0x3c08('0x23')][_0x3c08('0x79')]({'where':{'id':_0x266556[_0x3c08('0x25')]['id']}})['then'](handleEntityNotFound(_0x1e41fe,null))[_0x3c08('0x17')](function(_0x46cc49){if(_0x46cc49){_0x3e70a8[_0x3c08('0x7d')]=_[_0x3c08('0x28')](db[_0x3c08('0xa2')][_0x3c08('0x7a')]);_0x3e70a8['query']=_[_0x3c08('0x28')](_0x266556['query']);_0x3e70a8['filters']=_[_0x3c08('0x7c')](_0x3e70a8[_0x3c08('0x7d')],_0x3e70a8['query']);_0x3661ef[_0x3c08('0x7e')]=_[_0x3c08('0x7c')](_0x3e70a8['model'],qs[_0x3c08('0x7f')](_0x266556['query'][_0x3c08('0x7f')]));_0x3661ef[_0x3c08('0x7e')]=_0x3661ef[_0x3c08('0x7e')][_0x3c08('0x29')]?_0x3661ef[_0x3c08('0x7e')]:_0x3e70a8[_0x3c08('0x7d')];if(!_0x266556['query'][_0x3c08('0x36')](_0x3c08('0x85'))){_0x3661ef['limit']=qs[_0x3c08('0x12')](_0x266556['query'][_0x3c08('0x12')]);_0x3661ef[_0x3c08('0x15')]=qs[_0x3c08('0x15')](_0x266556[_0x3c08('0x20')][_0x3c08('0x15')]);}_0x3661ef[_0x3c08('0x80')]=qs['sort'](_0x266556[_0x3c08('0x20')][_0x3c08('0x81')]);_0x3661ef['where']=qs['filters'](_[_0x3c08('0x82')](_0x266556['query'],_0x3e70a8[_0x3c08('0x7b')]));_0x3661ef[_0x3c08('0x5e')][_0x3c08('0x9e')]=_0x46cc49['id'];if(_0x266556['query']['filter']){_0x3661ef['where']=_[_0x3c08('0x37')](_0x3661ef['where'],{'$or':_[_0x3c08('0x6d')](_0x3661ef[_0x3c08('0x7e')],function(_0x378e8f){var _0x4ecce5={};_0x4ecce5[_0x378e8f]={'$like':'%'+_0x266556[_0x3c08('0x20')][_0x3c08('0x83')]+'%'};return _0x4ecce5;})});}_0x3661ef=_[_0x3c08('0x37')]({},_0x3661ef,_0x266556['options']);return db['CmHopperHistory'][_0x3c08('0x14')]({'where':_0x3661ef[_0x3c08('0x5e')]})[_0x3c08('0x17')](function(_0x152f2a){_0x3b77c3[_0x3c08('0x14')]=_0x152f2a;if(_0x266556[_0x3c08('0x20')][_0x3c08('0x9f')]){_0x3661ef['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x3c08('0x1f')](_0x3661ef);})[_0x3c08('0x17')](function(_0x32cc96){_0x3b77c3[_0x3c08('0xa3')]=_0x32cc96;return _0x3b77c3;});}})[_0x3c08('0x17')](respondWithFilteredResult(_0x1e41fe,_0x3661ef))[_0x3c08('0x26')](handleError(_0x1e41fe,null));};exports['getHopperFinals']=function(_0x40b371,_0x5fac1a){var _0x3896e0={'raw':!![],'where':{}};var _0x2c6e75={};var _0x374366={'count':0x0,'rows':[]};return db[_0x3c08('0x23')][_0x3c08('0x79')]({'where':{'id':_0x40b371[_0x3c08('0x25')]['id']}})[_0x3c08('0x17')](handleEntityNotFound(_0x5fac1a,null))[_0x3c08('0x17')](function(_0x2b6c33){if(_0x2b6c33){_0x2c6e75[_0x3c08('0x7d')]=_[_0x3c08('0x28')](db[_0x3c08('0x4a')][_0x3c08('0x7a')]);_0x2c6e75[_0x3c08('0x20')]=_[_0x3c08('0x28')](_0x40b371[_0x3c08('0x20')]);_0x2c6e75['filters']=_['intersection'](_0x2c6e75[_0x3c08('0x7d')],_0x2c6e75[_0x3c08('0x20')]);_0x3896e0[_0x3c08('0x7e')]=_[_0x3c08('0x7c')](_0x2c6e75[_0x3c08('0x7d')],qs['fields'](_0x40b371[_0x3c08('0x20')][_0x3c08('0x7f')]));_0x3896e0[_0x3c08('0x7e')]=_0x3896e0[_0x3c08('0x7e')]['length']?_0x3896e0[_0x3c08('0x7e')]:_0x2c6e75[_0x3c08('0x7d')];if(!_0x40b371['query'][_0x3c08('0x36')](_0x3c08('0x85'))){_0x3896e0[_0x3c08('0x12')]=qs[_0x3c08('0x12')](_0x40b371['query'][_0x3c08('0x12')]);_0x3896e0[_0x3c08('0x15')]=qs[_0x3c08('0x15')](_0x40b371[_0x3c08('0x20')]['offset']);}_0x3896e0[_0x3c08('0x80')]=qs[_0x3c08('0x81')](_0x40b371['query']['sort']);_0x3896e0[_0x3c08('0x5e')]=qs['filters'](_['pick'](_0x40b371[_0x3c08('0x20')],_0x2c6e75[_0x3c08('0x7b')]));_0x3896e0[_0x3c08('0x5e')][_0x3c08('0x9e')]=_0x2b6c33['id'];if(_0x40b371[_0x3c08('0x20')][_0x3c08('0x83')]){_0x3896e0[_0x3c08('0x5e')]=_[_0x3c08('0x37')](_0x3896e0[_0x3c08('0x5e')],{'$or':_[_0x3c08('0x6d')](_0x3896e0['attributes'],function(_0xbb5c99){var _0x372c46={};_0x372c46[_0xbb5c99]={'$like':'%'+_0x40b371[_0x3c08('0x20')][_0x3c08('0x83')]+'%'};return _0x372c46;})});}_0x3896e0=_[_0x3c08('0x37')]({},_0x3896e0,_0x40b371[_0x3c08('0x84')]);return db[_0x3c08('0x4a')]['count']({'where':_0x3896e0[_0x3c08('0x5e')]})[_0x3c08('0x17')](function(_0x2de41c){_0x374366[_0x3c08('0x14')]=_0x2de41c;if(_0x40b371[_0x3c08('0x20')][_0x3c08('0x9f')]){_0x3896e0['include']=[{'all':!![]}];}return db[_0x3c08('0x4a')][_0x3c08('0x1f')](_0x3896e0);})[_0x3c08('0x17')](function(_0x15a814){_0x374366[_0x3c08('0xa3')]=_0x15a814;return _0x374366;});}})[_0x3c08('0x17')](respondWithFilteredResult(_0x5fac1a,_0x3896e0))[_0x3c08('0x26')](handleError(_0x5fac1a,null));};exports[_0x3c08('0xa4')]=function(_0xfe42df,_0x258f4e){var _0x3a9b30={'raw':!![],'where':{}};var _0x4ebdb0={};var _0x40aaca={'count':0x0,'rows':[]};return db[_0x3c08('0x23')]['findOne']({'where':{'id':_0xfe42df[_0x3c08('0x25')]['id']}})['then'](handleEntityNotFound(_0x258f4e,null))[_0x3c08('0x17')](function(_0x5419a2){if(_0x5419a2){_0x4ebdb0[_0x3c08('0x7d')]=_[_0x3c08('0x28')](db[_0x3c08('0x50')][_0x3c08('0x7a')]);_0x4ebdb0['query']=_[_0x3c08('0x28')](_0xfe42df[_0x3c08('0x20')]);_0x4ebdb0[_0x3c08('0x7b')]=_[_0x3c08('0x7c')](_0x4ebdb0[_0x3c08('0x7d')],_0x4ebdb0[_0x3c08('0x20')]);_0x3a9b30[_0x3c08('0x7e')]=_['intersection'](_0x4ebdb0['model'],qs[_0x3c08('0x7f')](_0xfe42df['query'][_0x3c08('0x7f')]));_0x3a9b30[_0x3c08('0x7e')]=_0x3a9b30[_0x3c08('0x7e')][_0x3c08('0x29')]?_0x3a9b30[_0x3c08('0x7e')]:_0x4ebdb0[_0x3c08('0x7d')];if(!_0xfe42df[_0x3c08('0x20')][_0x3c08('0x36')](_0x3c08('0x85'))){_0x3a9b30[_0x3c08('0x12')]=qs[_0x3c08('0x12')](_0xfe42df[_0x3c08('0x20')][_0x3c08('0x12')]);_0x3a9b30[_0x3c08('0x15')]=qs[_0x3c08('0x15')](_0xfe42df[_0x3c08('0x20')]['offset']);}_0x3a9b30[_0x3c08('0x80')]=qs[_0x3c08('0x81')](_0xfe42df['query'][_0x3c08('0x81')]);_0x3a9b30[_0x3c08('0x5e')]=qs[_0x3c08('0x7b')](_[_0x3c08('0x82')](_0xfe42df['query'],_0x4ebdb0[_0x3c08('0x7b')]));_0x3a9b30[_0x3c08('0x5e')][_0x3c08('0x9e')]=_0x5419a2['id'];if(_0xfe42df[_0x3c08('0x20')][_0x3c08('0x83')]){_0x3a9b30['where']=_[_0x3c08('0x37')](_0x3a9b30[_0x3c08('0x5e')],{'$or':_[_0x3c08('0x6d')](_0x3a9b30['attributes'],function(_0x5e9e6c){var _0x5f5bc3={};_0x5f5bc3[_0x5e9e6c]={'$like':'%'+_0xfe42df[_0x3c08('0x20')][_0x3c08('0x83')]+'%'};return _0x5f5bc3;})});}_0x3a9b30=_['merge']({},_0x3a9b30,_0xfe42df['options']);return db[_0x3c08('0x50')][_0x3c08('0x14')]({'where':_0x3a9b30['where']})[_0x3c08('0x17')](function(_0x3b4209){_0x40aaca[_0x3c08('0x14')]=_0x3b4209;if(_0xfe42df[_0x3c08('0x20')][_0x3c08('0x9f')]){_0x3a9b30['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3c08('0x1f')](_0x3a9b30);})[_0x3c08('0x17')](function(_0x1916c0){_0x40aaca['rows']=_0x1916c0;return _0x40aaca;});}})[_0x3c08('0x17')](respondWithFilteredResult(_0x258f4e,_0x3a9b30))['catch'](handleError(_0x258f4e,null));};exports[_0x3c08('0xa5')]=function(_0xf7121e,_0x53e649){try{if(!_0xf7121e['body']['ListId']){throw new Error(_0x3c08('0xa6'));}if(!_0xf7121e[_0x3c08('0x38')][_0x3c08('0xa7')]){throw new Error(_0x3c08('0xa8'));}if(!_0xf7121e[_0x3c08('0x38')]['binding_values']){throw new Error(_0x3c08('0xa9'));}if(!_0xf7121e['body'][_0x3c08('0xaa')]){throw new Error(_0x3c08('0xab'));}var _0x4e63dc=_0xf7121e['body'][_0x3c08('0xa7')][_0x3c08('0xac')](',');var _0x17dacd=_0xf7121e[_0x3c08('0x38')]['binding_values'][_0x3c08('0xac')](',');if(!_0x4e63dc[_0x3c08('0x29')]||!_0x17dacd['length']||_0x4e63dc[_0x3c08('0x29')]!==_0x17dacd[_0x3c08('0x29')]){throw new Error(_0x3c08('0xad'));}_0xf7121e[_0x3c08('0x38')][_0x3c08('0x7f')]=_['zipObject'](_0x4e63dc,_0x17dacd);if(!_0xf7121e[_0x3c08('0x38')][_0x3c08('0x7f')][_0x3c08('0x77')]){throw new Error(_0x3c08('0xae'));}if(!_0xf7121e[_0x3c08('0x38')][_0x3c08('0x7f')][_0x3c08('0xaf')]){throw new Error(_0x3c08('0xb0'));}var _0x4ec2a3=path['join'](config[_0x3c08('0xb1')],_0x3c08('0xb2'),_0xf7121e[_0x3c08('0xb3')][_0x3c08('0xb4')]);fs['chmodSync'](_0x4ec2a3,parseInt(_0x3c08('0xb5'),0x8));var _0x196a79=require('child_process')[_0x3c08('0xb6')](path['join'](__dirname,_0x3c08('0xb7')),[_0x4ec2a3,_0xf7121e[_0x3c08('0x38')][_0x3c08('0xa7')],_0xf7121e[_0x3c08('0x38')][_0x3c08('0xb8')],_0xf7121e[_0x3c08('0x38')][_0x3c08('0x60')],_0xf7121e[_0x3c08('0x38')][_0x3c08('0xb9')],_0xf7121e[_0x3c08('0x38')][_0x3c08('0x5d')],_0xf7121e[_0x3c08('0x38')][_0x3c08('0xaa')]]);return _0x53e649['status'](0xc8)[_0x3c08('0x11')]({'message':_0x3c08('0xba'),'pid':_0x196a79['pid']});}catch(_0x52aaa8){return _0x53e649[_0x3c08('0x10')](0x1f4)[_0x3c08('0x1d')](_0x52aaa8);}};exports[_0x3c08('0xbb')]=function(_0x1c58de,_0x13eb91){var _0x37157c=fs[_0x3c08('0xbc')](_0x1c58de[_0x3c08('0xb3')][_0x3c08('0x2')]);Papa[_0x3c08('0xbd')](_0x37157c,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3f70d1){return _0x13eb91['status'](0xc8)[_0x3c08('0x11')]({'file':_0x1c58de[_0x3c08('0xb3')],'fields':_0x3f70d1['meta'][_0x3c08('0x7f')]});}});};exports[_0x3c08('0xbe')]=function(_0x21dd55,_0x54b146){return db[_0x3c08('0xbf')][_0x3c08('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3c08('0xc0')}})[_0x3c08('0x17')](function(_0x5f5101){var _0x5a1dd2=![];if(!_0x21dd55['body'][_0x3c08('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x21dd55[_0x3c08('0x38')][_0x3c08('0xc1')][_0x3c08('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x21dd55[_0x3c08('0x38')]['binding']['firstName']){throw new Error(_0x3c08('0xb0'));}if(!_0x21dd55[_0x3c08('0x38')][_0x3c08('0xaa')]){throw new Error(_0x3c08('0xab'));}var _0x5eb400=require('child_process')[_0x3c08('0xb6')](path[_0x3c08('0x55')](__dirname,_0x3c08('0xc2')),[_0x21dd55['params']['id'],JSON[_0x3c08('0xc3')](_0x21dd55[_0x3c08('0x38')]),JSON[_0x3c08('0xc3')](_0x5f5101)]);_0x5eb400['on']('message',function(){_0x5a1dd2=!![];return _0x54b146[_0x3c08('0x10')](0xc8)[_0x3c08('0x11')]({'message':_0x3c08('0xc4'),'pid':_0x5eb400[_0x3c08('0xc5')]});});_0x5eb400['on'](_0x3c08('0xc6'),function(_0x463462){if(_0x463462&&!_0x5a1dd2){return _0x54b146[_0x3c08('0x10')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x5eb400[_0x3c08('0xc5')]});}});})[_0x3c08('0x26')](handleError(_0x54b146,null));};exports[_0x3c08('0xc7')]=function(_0x1cb85a,_0x831d89){return db[_0x3c08('0xbf')][_0x3c08('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3c08('0xc0')}})[_0x3c08('0x17')](function(_0xaa1a81){var _0x345e3a=![];if(!_0x1cb85a[_0x3c08('0x38')]['ListId']){throw new Error(_0x3c08('0xa6'));}if(!_0x1cb85a[_0x3c08('0x38')]['binding']['phone']){throw new Error(_0x3c08('0xae'));}if(!_0x1cb85a[_0x3c08('0x38')][_0x3c08('0xc1')][_0x3c08('0xaf')]){throw new Error(_0x3c08('0xb0'));}if(!_0x1cb85a['body']['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3579bb=require('child_process')[_0x3c08('0xb6')](path[_0x3c08('0x55')](__dirname,_0x3c08('0xc8')),[_0x1cb85a[_0x3c08('0x25')]['id'],JSON[_0x3c08('0xc3')](_0x1cb85a['body']),JSON[_0x3c08('0xc3')](_0xaa1a81)]);_0x3579bb['on'](_0x3c08('0xc9'),function(){_0x345e3a=!![];return _0x831d89['status'](0xc8)['json']({'message':_0x3c08('0xc4'),'pid':_0x3579bb[_0x3c08('0xc5')]});});_0x3579bb['on'](_0x3c08('0xc6'),function(_0x3cbc30){if(_0x3cbc30&&!_0x345e3a){return _0x831d89[_0x3c08('0x10')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x3579bb['pid']});}});})[_0x3c08('0x26')](handleError(_0x831d89,null));};exports['getJourney']=function(_0x204155,_0x4b05bc){var _0x2369f0=[_0x3c08('0xca'),'chat','sms',_0x3c08('0xcb'),'fax','whatsapp',_0x3c08('0xcc')];var _0xac0370={'offset':0x0,'order':qs[_0x3c08('0x81')](_0x3c08('0xcd'))},_0x213155={'count':0x0,'rows':[]};Promise[_0x3c08('0xce')]()[_0x3c08('0x17')](function(){if(_0x204155[_0x3c08('0x20')][_0x3c08('0xcf')]){if(!_[_0x3c08('0xd0')](_0x2369f0,_0x204155[_0x3c08('0x20')][_0x3c08('0xcf')][_0x3c08('0xd1')]())){throw new Error(_0x3c08('0xd2'));}_0x2369f0=[_0x204155[_0x3c08('0x20')][_0x3c08('0xcf')][_0x3c08('0xd1')]()];}if(_0x204155[_0x3c08('0x20')][_0x3c08('0xd3')]){try{var _0x1e73db=JSON[_0x3c08('0xbd')](_0x204155[_0x3c08('0x20')][_0x3c08('0xd3')]);if(!moment(_0x1e73db[_0x3c08('0x39')])[_0x3c08('0xd4')]()){throw new Error(_0x3c08('0xd5'));}if(!moment(_0x1e73db['to'])['isValid']()){throw new Error(_0x3c08('0xd6'));}}catch(_0x2d9675){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x204155[_0x3c08('0x20')][_0x3c08('0x36')](_0x3c08('0x85'))){_0xac0370[_0x3c08('0x12')]=qs[_0x3c08('0x12')](_0x204155[_0x3c08('0x20')]['limit']||0xa);_0xac0370[_0x3c08('0x15')]=qs[_0x3c08('0x15')](_0x204155[_0x3c08('0x20')][_0x3c08('0x15')]);}var _0x224444=_0x2369f0[_0x3c08('0x6d')](function(_0x1ba843){if(_0x1ba843==='voice'){var _0x74cbfd={'attributes':['id',_0x3c08('0xd7'),_0x3c08('0x32'),_0x3c08('0xd8'),_0x3c08('0xd9'),_0x3c08('0xda'),_0x3c08('0xdb'),'endtime','duration',_0x3c08('0xdc'),_0x3c08('0xdd'),_0x3c08('0xde'),_0x3c08('0xdf'),'userThirdDisposition',_0x3c08('0xe0')],'where':{'ContactId':_0x204155[_0x3c08('0x25')]['id']},'include':[{'model':db[_0x3c08('0xbf')],'as':_0x3c08('0xbf'),'attributes':['id',_0x3c08('0x1c'),'fullname',_0x3c08('0x30')]}],'order':[['createdAt',_0x3c08('0xe1')]]};if(_0x204155[_0x3c08('0x20')]['range']){_0x74cbfd[_0x3c08('0x5e')][_0x3c08('0xdd')]={'$gte':_0x1e73db[_0x3c08('0x39')],'$lte':_0x1e73db['to']};}return db['VoiceCallReport'][_0x3c08('0xe2')](_0x74cbfd)[_0x3c08('0x17')](function(_0xc8802c){_0x213155['count']+=_0xc8802c['count'];return _['map'](_0xc8802c[_0x3c08('0xa3')],function(_0x220be8){var _0x55b19a=_0x220be8[_0x3c08('0x3a')]({'plain':!![]});_0x55b19a[_0x3c08('0xcf')]=_0x1ba843;if(_0x55b19a[_0x3c08('0xbf')]){_0x55b19a['User']={'id':_0x55b19a['User']['id'],'name':_0x55b19a[_0x3c08('0xbf')][_0x3c08('0x1c')],'fullname':_0x55b19a[_0x3c08('0xbf')]['fullname'],'alias':_0x55b19a[_0x3c08('0xbf')][_0x3c08('0x30')]};}return _0x55b19a;});});}else{var _0x48d6f4=_[_0x3c08('0xe3')](_0x1ba843)+(_0x1ba843===_0x3c08('0xe4')?_0x3c08('0xe5'):'Account');var _0x39d7dc={'attributes':['id',_0x3c08('0xe6'),_0x3c08('0xe7'),_0x3c08('0xdd'),_0x3c08('0xdc'),'disposition','secondDisposition',_0x3c08('0xe8'),_0x3c08('0xe0'),_0x48d6f4+'Id'],'where':{'ContactId':_0x204155['params']['id']},'include':[{'model':db[_0x48d6f4],'as':_0x3c08('0xe9'),'attributes':['id',_0x3c08('0x1c'),_0x3c08('0xea')]},{'model':db[_0x3c08('0xbf')],'as':_0x3c08('0xeb'),'attributes':['id','name',_0x3c08('0xec')]},{'model':db[_0x3c08('0x64')],'as':_0x3c08('0x65'),'attributes':['id',_0x3c08('0x1c'),_0x3c08('0x66')],'through':{'attributes':[]}}],'order':[[_0x3c08('0xdd'),_0x3c08('0xe1')]]};if(_0x204155['query'][_0x3c08('0xd3')]){_0x39d7dc[_0x3c08('0x5e')]['createdAt']={'$gte':_0x1e73db[_0x3c08('0x39')],'$lte':_0x1e73db['to']};}switch(_0x1ba843){case _0x3c08('0xe4'):_0x39d7dc[_0x3c08('0x7e')][_0x3c08('0x5f')](_0x3c08('0xed'),_0x3c08('0xee'),_0x3c08('0xef'),_0x3c08('0xf0'),_0x3c08('0xf1'),'ratingMessage','ratingType',_0x3c08('0xf2'),_0x3c08('0xf3'));break;case'mail':_0x39d7dc[_0x3c08('0x7e')][_0x3c08('0x5f')](_0x3c08('0xf4'),'substatus');break;case _0x3c08('0xcb'):_0x39d7dc[_0x3c08('0x7e')][_0x3c08('0x5f')]('externalUrl','threadId');break;}return db[_[_0x3c08('0xe3')](_0x1ba843)+_0x3c08('0xf5')][_0x3c08('0xe2')](_0x39d7dc)['then'](function(_0x71f1e){_0x213155[_0x3c08('0x14')]+=_0x71f1e[_0x3c08('0x14')];return _[_0x3c08('0x6d')](_0x71f1e[_0x3c08('0xa3')],function(_0x2489e8){var _0x34aa66=_0x2489e8[_0x3c08('0x3a')]({'plain':!![]});_0x34aa66[_0x3c08('0xcf')]=_0x1ba843;if(_0x34aa66[_0x3c08('0xeb')]){_0x34aa66[_0x3c08('0xeb')]={'id':_0x34aa66[_0x3c08('0xeb')]['id'],'name':_0x34aa66[_0x3c08('0xeb')][_0x3c08('0x1c')],'fullname':_0x34aa66[_0x3c08('0xeb')][_0x3c08('0xec')]};}return _0x34aa66;});});}});return Promise[_0x3c08('0x89')](_0x224444);})[_0x3c08('0x17')](function(_0x23c404){return _(_0x23c404)[_0x3c08('0xf6')]()[_0x3c08('0xf7')](_0x3c08('0xdd'))[_0x3c08('0xf8')]()[_0x3c08('0xf9')]();})[_0x3c08('0x17')](function(_0x5cc885){_0x213155['rows']=_0xac0370[_0x3c08('0x12')]?_0x5cc885[_0x3c08('0xfa')](_0xac0370[_0x3c08('0x15')],_0xac0370[_0x3c08('0x15')]+_0xac0370[_0x3c08('0x12')]):_0x5cc885;return _0x213155;})[_0x3c08('0x17')](respondWithFilteredResult(_0x4b05bc,_0xac0370))[_0x3c08('0x26')](handleError(_0x4b05bc,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index a9a9c6e..cfbd333 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 _0xed13=['../../mysqldb','CmContact','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3d63f6,_0x8cd7e4){var _0x2ac67b=function(_0x4dd921){while(--_0x4dd921){_0x3d63f6['push'](_0x3d63f6['shift']());}};_0x2ac67b(++_0x8cd7e4);}(_0xed13,0x198));var _0x3ed1=function(_0x2a418f,_0x39b19c){_0x2a418f=_0x2a418f-0x0;var _0x5ebd7e=_0xed13[_0x2a418f];return _0x5ebd7e;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x3ed1('0x0'))['db'][_0x3ed1('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ed1('0x2'),'afterUpdate':_0x3ed1('0x3'),'afterDestroy':_0x3ed1('0x4')};function emitEvent(_0x41b17a){return function(_0x4cc3c2,_0x308b47,_0x472fbe){CmContactEvents['emit'](_0x41b17a+':'+_0x4cc3c2['id'],_0x4cc3c2);CmContactEvents[_0x3ed1('0x5')](_0x41b17a,_0x4cc3c2);_0x472fbe(null);};}for(var e in events){if(events[_0x3ed1('0x6')](e)){var event=events[e];CmContact[_0x3ed1('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x01aa=['hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','update','remove','emit'];(function(_0x5191ba,_0x4b5f9c){var _0x3c2bf8=function(_0xa3da25){while(--_0xa3da25){_0x5191ba['push'](_0x5191ba['shift']());}};_0x3c2bf8(++_0x4b5f9c);}(_0x01aa,0x162));var _0xa01a=function(_0x2b11e9,_0x116811){_0x2b11e9=_0x2b11e9-0x0;var _0x3e845a=_0x01aa[_0x2b11e9];return _0x3e845a;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xa01a('0x0'))['db'][_0xa01a('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa01a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa01a('0x3'),'afterDestroy':_0xa01a('0x4')};function emitEvent(_0x1b71f9){return function(_0x182662,_0x1af0b3,_0x541812){CmContactEvents[_0xa01a('0x5')](_0x1b71f9+':'+_0x182662['id'],_0x182662);CmContactEvents[_0xa01a('0x5')](_0x1b71f9,_0x182662);_0x541812(null);};}for(var e in events){if(events[_0xa01a('0x6')](e)){var event=events[e];CmContact[_0xa01a('0x7')](e,emitEvent(event));}}module[_0xa01a('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 934436d..4361332 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 _0xf68d=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','Lists','length','dialCheckDuplicateType','always','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','CmList','onlyIfOpen','message','error','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','scheduledat','add','minutes','ret','CmHopper','create','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'];(function(_0x2154ec,_0x1ff139){var _0x1d672f=function(_0x45a25c){while(--_0x45a25c){_0x2154ec['push'](_0x2154ec['shift']());}};_0x1d672f(++_0x1ff139);}(_0xf68d,0x199));var _0xdf68=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xf68d[_0x543084];return _0x306a57;};'use strict';var _=require(_0xdf68('0x0'));var util=require(_0xdf68('0x1'));var logger=require(_0xdf68('0x2'))('api');var moment=require(_0xdf68('0x3'));var BPromise=require(_0xdf68('0x4'));var rp=require(_0xdf68('0x5'));var fs=require('fs');var path=require(_0xdf68('0x6'));var rimraf=require(_0xdf68('0x7'));var config=require(_0xdf68('0x8'));var shared=require(_0xdf68('0x9'));var attributes=require(_0xdf68('0xa'));module[_0xdf68('0xb')]=function(_0x1005a9,_0x34d926){return _0x1005a9[_0xdf68('0xc')]('CmContact',attributes,{'tableName':_0xdf68('0xd'),'paranoid':!![],'indexes':[{'name':_0xdf68('0xe'),'fields':[_0xdf68('0xe')]},{'name':'fti_cm_contacts','fields':[_0xdf68('0xf'),_0xdf68('0x10'),_0xdf68('0xe'),_0xdf68('0x11'),_0xdf68('0x12'),_0xdf68('0x13')],'type':_0xdf68('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xdf68('0x15'),'hooks':{'afterCreate':function(_0x47f372,_0x218640,_0x5ade50){var _0x572f36=_0x1005a9[_0xdf68('0x16')];var _0x37a1a0=_0x47f372[_0xdf68('0x17')]({'plain':!![]});function _0x388e50(){return function(_0x54b5e1){logger['error'](_0xdf68('0x18'),_0xdf68('0x19'),util['inspect'](_0x54b5e1,{'showHidden':![],'depth':null}));};}function _0x374f2f(_0x3a05ad,_0x4eaee0){var _0x11a2a5=_0x4eaee0['scheduledat']?_0x4eaee0['scheduledat']:moment()[_0xdf68('0x1a')](_0xdf68('0x1b'));return new BPromise(function(_0x16f247,_0x11844b){if(_['isNil'](_0x4eaee0[_0xdf68('0x1c')])){_0x16f247({'ret':_0x11a2a5});}else{_0x572f36[_0xdf68('0x1d')][_0xdf68('0x1e')]({'where':{'id':_0x3a05ad['id']}})[_0xdf68('0x1f')](function(_0x5e25a5){if(!_['isNil'](_0x5e25a5)){var _0x5c75b8=_0x5e25a5[_0xdf68('0x1c')];if(!_[_0xdf68('0x20')](_0x5c75b8)){var _0x2aceb9=shared[_0xdf68('0x21')];var _0x6ebdc8=_0x2aceb9[_0x5c75b8];var _0x1d2025=_0x2aceb9[_0x4eaee0[_0xdf68('0x1c')]];if(!_[_0xdf68('0x20')](_0x6ebdc8)&&!_[_0xdf68('0x20')](_0x1d2025)){var _0x5b182f=_0x6ebdc8[_0xdf68('0x22')]-_0x1d2025[_0xdf68('0x22')];_0x11a2a5=_0x4eaee0[_0xdf68('0x23')]?_0x4eaee0['scheduledat']:moment();var _0x12c0f8=moment(_0x11a2a5)[_0xdf68('0x24')](_0x5b182f,_0xdf68('0x25'));_0x16f247({'ret':_0x12c0f8[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x16f247({'ret':_0x11a2a5});}else _0x16f247({'ret':_0x11a2a5});}else{_0x16f247({'ret':_0x11a2a5});}});}});return 0xa;}var _0x34a4f6=function(_0x1f7411){return new BPromise(function(_0x58ee4d,_0x348c49){_0x374f2f(_0x1f7411,_0x37a1a0)[_0xdf68('0x1f')](function(_0x238100){_0x37a1a0[_0xdf68('0x23')]=_0x238100[_0xdf68('0x26')];_0x572f36[_0xdf68('0x27')][_0xdf68('0x1e')]({'where':{'phone':_0x37a1a0[_0xdf68('0xe')],'VoiceQueueId':_0x1f7411['id']}})[_0xdf68('0x1f')](function(_0x4924b9){if(!_[_0xdf68('0x20')](_0x4924b9)){throw new Error('cmContact,\x20afterCreate\x20'+_0x37a1a0[_0xdf68('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1f7411['id']);}return _0x572f36[_0xdf68('0x27')][_0xdf68('0x28')]({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1f7411['id']});})[_0xdf68('0x2c')](function(_0x15ffdb){_0x348c49(_0x15ffdb);});});});};var _0x1206d8=function(_0x5b5385){return new BPromise(function(_0x2c49c0,_0x4cb483){_0x374f2f(_0x5b5385,_0x37a1a0)[_0xdf68('0x1f')](function(_0x58091b){_0x37a1a0[_0xdf68('0x23')]=_0x58091b[_0xdf68('0x26')];_0x572f36['CmHopper']['findOne']({'where':{'phone':_0x37a1a0[_0xdf68('0xe')],'VoiceQueueId':_0x5b5385['id']}})[_0xdf68('0x1f')](function(_0x273126){if(!_['isNil'](_0x273126)){throw new Error(_0xdf68('0x2d')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x2e')+_0x5b5385['id']);}return _0x572f36[_0xdf68('0x2f')][_0xdf68('0x1e')]({'where':{'calleridnum':_0x37a1a0[_0xdf68('0xe')],'VoiceQueueId':_0x5b5385['id']}});})['then'](function(_0x4e9ddf){if(!_['isNil'](_0x4e9ddf)){throw new Error(_0xdf68('0x30')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x31')+_0x5b5385['id']);}return _0x572f36[_0xdf68('0x27')][_0xdf68('0x28')]({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()[_0xdf68('0x1a')](_0xdf68('0x1b')),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0['callbackUniqueid']?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()['format'](_0xdf68('0x1b')):undefined,'VoiceQueueId':_0x5b5385['id']});})['catch'](function(_0x5a6129){_0x4cb483(_0x5a6129);});});});};function _0xc458cd(){return function(_0x53a6dc){logger['error']('cmContact',_0xdf68('0x19'),util['inspect'](_0x53a6dc,{'showHidden':![],'depth':null}));};}function _0x260cc4(_0x7f557d,_0x3bf9de){var _0x3d7735=_0x3bf9de['scheduledat']?_0x3bf9de[_0xdf68('0x23')]:moment()[_0xdf68('0x1a')](_0xdf68('0x1b'));return new BPromise(function(_0x1e3310,_0x2400b1){if(_[_0xdf68('0x20')](_0x3bf9de[_0xdf68('0x1c')])){_0x1e3310({'ret':_0x3d7735});}else{_0x572f36[_0xdf68('0x32')][_0xdf68('0x1e')]({'where':{'id':_0x7f557d['id']}})[_0xdf68('0x1f')](function(_0x470a6a){if(!_[_0xdf68('0x20')](_0x470a6a)){var _0x1415b4=_0x470a6a[_0xdf68('0x1c')];if(!_[_0xdf68('0x20')](_0x1415b4)){var _0x50787d=shared[_0xdf68('0x21')];var _0x2a4976=_0x50787d[_0x1415b4];var _0x132cd1=_0x50787d[_0x3bf9de[_0xdf68('0x1c')]];if(!_['isNil'](_0x2a4976)&&!_[_0xdf68('0x20')](_0x132cd1)){var _0x3a0777=_0x2a4976['utcOffset']-_0x132cd1['utcOffset'];_0x3d7735=_0x3bf9de[_0xdf68('0x23')]?_0x3bf9de[_0xdf68('0x23')]:moment();var _0x39edf8=moment(_0x3d7735)[_0xdf68('0x24')](_0x3a0777,'minutes');_0x1e3310({'ret':_0x39edf8[_0xdf68('0x1a')](_0xdf68('0x1b'))});}else _0x1e3310({'ret':_0x3d7735});}else _0x1e3310({'ret':_0x3d7735});}else{_0x1e3310({'ret':_0x3d7735});}});}});return 0xa;}var _0x251caf=function(_0x3573b9){return new BPromise(function(_0x3c1984,_0x3bd85e){_0x260cc4(_0x3573b9,_0x37a1a0)['then'](function(_0x476e56){_0x37a1a0[_0xdf68('0x23')]=_0x476e56[_0xdf68('0x26')];_0x572f36[_0xdf68('0x27')][_0xdf68('0x1e')]({'where':{'phone':_0x37a1a0[_0xdf68('0xe')],'CampaignId':_0x3573b9['id']}})[_0xdf68('0x1f')](function(_0x33884f){if(!_[_0xdf68('0x20')](_0x33884f)){throw new Error(_0xdf68('0x2d')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x33')+_0x3573b9['id']);}return _0x572f36[_0xdf68('0x27')][_0xdf68('0x28')]({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0['scheduledat']?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()[_0xdf68('0x1a')](_0xdf68('0x1b')):undefined,'CampaignId':_0x3573b9['id']});})['catch'](function(_0x332469){_0x3bd85e(_0x332469);});});});};var _0x1d21f0=function(_0x57dbac){return new BPromise(function(_0x18fcd6,_0x4e2ac4){_0x260cc4(_0x57dbac,_0x37a1a0)[_0xdf68('0x1f')](function(_0x33cd25){_0x37a1a0['scheduledat']=_0x33cd25['ret'];_0x572f36[_0xdf68('0x27')][_0xdf68('0x1e')]({'where':{'phone':_0x37a1a0['phone'],'CampaignId':_0x57dbac['id']}})[_0xdf68('0x1f')](function(_0x208609){if(!_[_0xdf68('0x20')](_0x208609)){throw new Error(_0xdf68('0x2d')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x34')+_0x57dbac['id']);}return _0x572f36[_0xdf68('0x2f')][_0xdf68('0x1e')]({'where':{'calleridnum':_0x37a1a0[_0xdf68('0xe')],'CampaignId':_0x57dbac['id']}});})[_0xdf68('0x1f')](function(_0x2a6180){if(!_[_0xdf68('0x20')](_0x2a6180)){throw new Error(_0xdf68('0x30')+_0x37a1a0[_0xdf68('0xe')]+_0xdf68('0x35')+_0x57dbac['id']);}return _0x572f36[_0xdf68('0x27')]['create']({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0['ListId'],'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()[_0xdf68('0x1a')](_0xdf68('0x1b')):undefined,'CampaignId':_0x57dbac['id']});})[_0xdf68('0x2c')](function(_0x4904d7){_0x4e2ac4(_0x4904d7);});});});};if(_0x37a1a0[_0xdf68('0x29')]){_0x572f36[_0xdf68('0x1d')]['findAll']({'where':{'type':_0xdf68('0x36')},'attributes':['id','dialCheckDuplicateType',_0xdf68('0x1c')],'include':[{'model':_0x572f36['CmList'],'as':_0xdf68('0x37'),'where':{'id':_0x37a1a0['ListId']}}]})['then'](function(_0xe6f103){if(_0xe6f103){var _0xe1994e=[];for(var _0x68c213=0x0,_0xa4e4c8;_0x68c213<_0xe6f103[_0xdf68('0x38')];_0x68c213+=0x1){_0xa4e4c8=_0xe6f103[_0x68c213]['get']({'plain':!![]});switch(_0xa4e4c8[_0xdf68('0x39')]){case _0xdf68('0x3a'):_0x1206d8(_0xa4e4c8)['catch'](_0x388e50());break;case'onlyIfOpen':_0x34a4f6(_0xa4e4c8)['catch'](_0x388e50());break;default:_0x260cc4(_0xa4e4c8,_0x37a1a0)['then'](function(_0x1cceec){_0x37a1a0[_0xdf68('0x23')]=_0x1cceec[_0xdf68('0x26')];_0x572f36[_0xdf68('0x27')]['create']({'phone':_0x37a1a0[_0xdf68('0xe')],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'scheduledat':_0x37a1a0['scheduledat']?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'callback':_0x37a1a0[_0xdf68('0x2b')]?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0[_0xdf68('0x2b')]:undefined,'callbackat':_0x37a1a0[_0xdf68('0x2b')]?moment()['format'](_0xdf68('0x1b')):undefined,'VoiceQueueId':_0xa4e4c8['id']})[_0xdf68('0x2c')](_0x388e50());});}}}})[_0xdf68('0x1f')](function(){return _0x572f36[_0xdf68('0x1d')][_0xdf68('0x3b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x572f36['CmList'],'as':_0xdf68('0x3c'),'where':{'id':_0x37a1a0['ListId']}}]})['then'](function(_0x1a217c){if(_0x1a217c){var _0x41c69e=[];for(var _0x524e6c=0x0,_0x4796a5;_0x524e6c<_0x1a217c['length'];_0x524e6c+=0x1){_0x4796a5=_0x1a217c[_0x524e6c]['get']({'plain':!![]});_0x572f36[_0xdf68('0x3d')][_0xdf68('0x28')]({'phone':_0x37a1a0['phone'],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'VoiceQueueId':_0x4796a5['id']})[_0xdf68('0x2c')](function(_0x1f91b7){logger['error'](_0xdf68('0x3e'),_0xdf68('0x19'),_0x1f91b7['message']);});}}});})[_0xdf68('0x1f')](function(){return _0x572f36['Campaign'][_0xdf68('0x3b')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x572f36[_0xdf68('0x3f')],'as':_0xdf68('0x37'),'where':{'id':_0x37a1a0[_0xdf68('0x29')]}}]})[_0xdf68('0x1f')](function(_0x59f9ea){if(_0x59f9ea){var _0x3dfc59=[];for(var _0x5b4e0f=0x0,_0x44f883;_0x5b4e0f<_0x59f9ea['length'];_0x5b4e0f+=0x1){_0x44f883=_0x59f9ea[_0x5b4e0f][_0xdf68('0x17')]({'plain':!![]});switch(_0x44f883[_0xdf68('0x39')]){case'always':_0x1d21f0(_0x44f883)['catch'](_0xc458cd());break;case _0xdf68('0x40'):_0x251caf(_0x44f883)[_0xdf68('0x2c')](_0xc458cd());break;default:_0x572f36[_0xdf68('0x27')]['create']({'phone':_0x37a1a0['phone'],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'scheduledat':_0x37a1a0[_0xdf68('0x23')]?_0x37a1a0[_0xdf68('0x23')]:moment()['format'](_0xdf68('0x1b')),'priority':_0x37a1a0[_0xdf68('0x2a')]?_0x37a1a0[_0xdf68('0x2a')]:0x2,'callback':_0x37a1a0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x37a1a0[_0xdf68('0x2b')]?_0x37a1a0['callbackUniqueid']:undefined,'callbackat':_0x37a1a0['callbackUniqueid']?moment()[_0xdf68('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x44f883['id']})[_0xdf68('0x2c')](_0xc458cd());}}}});})[_0xdf68('0x1f')](function(){return _0x572f36['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x572f36[_0xdf68('0x3f')],'as':_0xdf68('0x3c'),'where':{'id':_0x37a1a0['ListId']}}]})[_0xdf68('0x1f')](function(_0xd78c36){if(_0xd78c36){var _0x5aa90f=[];for(var _0x1600e1=0x0,_0x5ab177;_0x1600e1<_0xd78c36[_0xdf68('0x38')];_0x1600e1+=0x1){_0x5ab177=_0xd78c36[_0x1600e1][_0xdf68('0x17')]({'plain':!![]});_0x572f36[_0xdf68('0x3d')][_0xdf68('0x28')]({'phone':_0x37a1a0['phone'],'ContactId':_0x37a1a0['id'],'ListId':_0x37a1a0[_0xdf68('0x29')],'CampaignId':_0x5ab177['id']})[_0xdf68('0x2c')](function(_0x2c12e4){logger['error'](_0xdf68('0x3e'),_0xdf68('0x19'),_0x2c12e4[_0xdf68('0x41')]);});}}});})['then'](function(){_0x5ade50();})[_0xdf68('0x2c')](function(_0xcdcf37){logger[_0xdf68('0x42')](_0xdf68('0x3e'),_0xdf68('0x19'),_0xcdcf37[_0xdf68('0x41')]);_0x5ade50(_0xcdcf37);});}else{_0x5ade50(new Error(_0xdf68('0x43')));}},'afterDestroy':function(_0x2c46f5,_0x4cb0de,_0x4e6439){var _0x127b51=_0x1005a9[_0xdf68('0x16')];var _0x22c781=_0x2c46f5[_0xdf68('0x17')]({'plain':!![]});return _0x127b51[_0xdf68('0x27')]['findAll']({'raw':!![],'where':{'ListId':_0x22c781[_0xdf68('0x29')],'ContactId':_0x22c781['id']}})[_0xdf68('0x1f')](function(_0x2fb77c){if(!_[_0xdf68('0x44')](_0x2fb77c)){var _0x423862=[];for(var _0x1a52c7=0x0;_0x1a52c7<_0x2fb77c[_0xdf68('0x38')];_0x1a52c7+=0x1){var _0x2874ef=_0x127b51[_0xdf68('0x27')]['destroy']({'where':{'ListId':_0x2fb77c[_0x1a52c7]['ListId'],'ContactId':_0x2fb77c[_0x1a52c7][_0xdf68('0x45')],'VoiceQueueId':_0x2fb77c[_0x1a52c7][_0xdf68('0x46')],'CampaignId':_0x2fb77c[_0x1a52c7]['CampaignId']}});_0x423862[_0xdf68('0x47')](_0x2874ef);}return BPromise[_0xdf68('0x48')](_0x423862);}})[_0xdf68('0x1f')](function(_0x1fd69c){logger[_0xdf68('0x49')](_0xdf68('0x4a'),util[_0xdf68('0x4b')](_0x1fd69c,{'showHidden':![],'depth':null}));_0x4e6439();})[_0xdf68('0x2c')](function(_0x35fb76){logger[_0xdf68('0x42')](_0xdf68('0x4c'),util['inspect'](_0x35fb76,{'showHidden':![],'depth':null}));_0x4e6439(_0x35fb76);});}}});}; \ No newline at end of file +var _0x2afb=['utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','then','isNil','timezones','utcOffset','scheduledat','minutes','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact','Campaign','add','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','cmContact,\x20afterCreate,\x20','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','FULLTEXT'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x2afb,0x151));var _0xb2af=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0x2afb[_0x22cd0c];return _0x439eba;};'use strict';var _=require(_0xb2af('0x0'));var util=require(_0xb2af('0x1'));var logger=require(_0xb2af('0x2'))(_0xb2af('0x3'));var moment=require(_0xb2af('0x4'));var BPromise=require('bluebird');var rp=require(_0xb2af('0x5'));var fs=require('fs');var path=require(_0xb2af('0x6'));var rimraf=require(_0xb2af('0x7'));var config=require(_0xb2af('0x8'));var shared=require(_0xb2af('0x9'));var attributes=require('./cmContact.attributes');module['exports']=function(_0x577e42,_0x152249){return _0x577e42[_0xb2af('0xa')]('CmContact',attributes,{'tableName':_0xb2af('0xb'),'paranoid':!![],'indexes':[{'name':_0xb2af('0xc'),'fields':[_0xb2af('0xc')]},{'name':_0xb2af('0xd'),'fields':[_0xb2af('0xe'),_0xb2af('0xf'),'phone','mobile',_0xb2af('0x10'),'email'],'type':_0xb2af('0x11')}],'timestamps':!![],'charset':_0xb2af('0x12'),'collate':_0xb2af('0x13'),'hooks':{'afterCreate':function(_0x3beba7,_0x5c1bd4,_0x5322c){var _0x261781=_0x577e42[_0xb2af('0x14')];var _0x55106e=_0x3beba7[_0xb2af('0x15')]({'plain':!![]});function _0x590002(){return function(_0x1f3a6c){logger[_0xb2af('0x16')]('cmContact',_0xb2af('0x17'),util[_0xb2af('0x18')](_0x1f3a6c,{'showHidden':![],'depth':null}));};}function _0x1c0e52(_0x31a958,_0x3b95f5){var _0x3456ef=_0x3b95f5['scheduledat']?_0x3b95f5['scheduledat']:moment()[_0xb2af('0x19')](_0xb2af('0x1a'));return new BPromise(function(_0x41760a,_0x283bae){if(_['isNil'](_0x3b95f5[_0xb2af('0x1b')])){_0x41760a({'ret':_0x3456ef});}else{_0x261781[_0xb2af('0x1c')]['findOne']({'where':{'id':_0x31a958['id']}})[_0xb2af('0x1d')](function(_0x50ecdd){if(!_[_0xb2af('0x1e')](_0x50ecdd)){var _0x4fe568=_0x50ecdd[_0xb2af('0x1b')];if(!_[_0xb2af('0x1e')](_0x4fe568)){var _0x19d13d=shared[_0xb2af('0x1f')];var _0x168e7f=_0x19d13d[_0x4fe568];var _0x181bbd=_0x19d13d[_0x3b95f5[_0xb2af('0x1b')]];if(!_[_0xb2af('0x1e')](_0x168e7f)&&!_[_0xb2af('0x1e')](_0x181bbd)){var _0x406382=_0x168e7f[_0xb2af('0x20')]-_0x181bbd[_0xb2af('0x20')];_0x3456ef=_0x3b95f5['scheduledat']?_0x3b95f5[_0xb2af('0x21')]:moment();var _0x46da39=moment(_0x3456ef)['add'](_0x406382,_0xb2af('0x22'));_0x41760a({'ret':_0x46da39[_0xb2af('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x41760a({'ret':_0x3456ef});}else _0x41760a({'ret':_0x3456ef});}else{_0x41760a({'ret':_0x3456ef});}});}});return 0xa;}var _0x807f80=function(_0x542406){return new BPromise(function(_0x247ce0,_0x532059){_0x1c0e52(_0x542406,_0x55106e)['then'](function(_0x1cbf01){_0x55106e[_0xb2af('0x21')]=_0x1cbf01['ret'];_0x261781[_0xb2af('0x23')][_0xb2af('0x24')]({'where':{'phone':_0x55106e[_0xb2af('0xc')],'VoiceQueueId':_0x542406['id']}})['then'](function(_0x1791e6){if(!_['isNil'](_0x1791e6)){throw new Error(_0xb2af('0x25')+_0x55106e[_0xb2af('0xc')]+_0xb2af('0x26')+_0x542406['id']);}return _0x261781['CmHopper']['create']({'phone':_0x55106e['phone'],'ContactId':_0x55106e['id'],'ListId':_0x55106e[_0xb2af('0x27')],'priority':_0x55106e[_0xb2af('0x28')]?_0x55106e[_0xb2af('0x28')]:0x2,'scheduledat':_0x55106e[_0xb2af('0x21')]?_0x55106e['scheduledat']:moment()[_0xb2af('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x55106e[_0xb2af('0x29')]?!![]:![],'callbackuniqueid':_0x55106e[_0xb2af('0x29')]?_0x55106e[_0xb2af('0x29')]:undefined,'callbackat':_0x55106e[_0xb2af('0x29')]?moment()[_0xb2af('0x19')](_0xb2af('0x1a')):undefined,'VoiceQueueId':_0x542406['id']});})[_0xb2af('0x2a')](function(_0x57c414){_0x532059(_0x57c414);});});});};var _0x444b5c=function(_0x5c90c5){return new BPromise(function(_0x5c73dd,_0xf97474){_0x1c0e52(_0x5c90c5,_0x55106e)[_0xb2af('0x1d')](function(_0xe7f33c){_0x55106e[_0xb2af('0x21')]=_0xe7f33c['ret'];_0x261781[_0xb2af('0x23')]['findOne']({'where':{'phone':_0x55106e[_0xb2af('0xc')],'VoiceQueueId':_0x5c90c5['id']}})[_0xb2af('0x1d')](function(_0x1d6df4){if(!_[_0xb2af('0x1e')](_0x1d6df4)){throw new Error(_0xb2af('0x25')+_0x55106e['phone']+_0xb2af('0x2b')+_0x5c90c5['id']);}return _0x261781[_0xb2af('0x2c')][_0xb2af('0x24')]({'where':{'calleridnum':_0x55106e[_0xb2af('0xc')],'VoiceQueueId':_0x5c90c5['id']}});})[_0xb2af('0x1d')](function(_0x28319b){if(!_[_0xb2af('0x1e')](_0x28319b)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x55106e['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x5c90c5['id']);}return _0x261781['CmHopper']['create']({'phone':_0x55106e[_0xb2af('0xc')],'ContactId':_0x55106e['id'],'ListId':_0x55106e[_0xb2af('0x27')],'priority':_0x55106e[_0xb2af('0x28')]?_0x55106e[_0xb2af('0x28')]:0x2,'scheduledat':_0x55106e[_0xb2af('0x21')]?_0x55106e['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x55106e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x55106e[_0xb2af('0x29')]?_0x55106e['callbackUniqueid']:undefined,'callbackat':_0x55106e[_0xb2af('0x29')]?moment()[_0xb2af('0x19')](_0xb2af('0x1a')):undefined,'VoiceQueueId':_0x5c90c5['id']});})['catch'](function(_0x3139b1){_0xf97474(_0x3139b1);});});});};function _0x4872d1(){return function(_0x1fa27b){logger[_0xb2af('0x16')](_0xb2af('0x2d'),_0xb2af('0x17'),util[_0xb2af('0x18')](_0x1fa27b,{'showHidden':![],'depth':null}));};}function _0x55f28c(_0x31755f,_0x118269){var _0x381576=_0x118269['scheduledat']?_0x118269[_0xb2af('0x21')]:moment()[_0xb2af('0x19')](_0xb2af('0x1a'));return new BPromise(function(_0x10cddc,_0x508425){if(_['isNil'](_0x118269[_0xb2af('0x1b')])){_0x10cddc({'ret':_0x381576});}else{_0x261781[_0xb2af('0x2e')][_0xb2af('0x24')]({'where':{'id':_0x31755f['id']}})[_0xb2af('0x1d')](function(_0x35efbb){if(!_[_0xb2af('0x1e')](_0x35efbb)){var _0x35e8ad=_0x35efbb[_0xb2af('0x1b')];if(!_[_0xb2af('0x1e')](_0x35e8ad)){var _0xa41c04=shared[_0xb2af('0x1f')];var _0x26991b=_0xa41c04[_0x35e8ad];var _0x428f94=_0xa41c04[_0x118269[_0xb2af('0x1b')]];if(!_[_0xb2af('0x1e')](_0x26991b)&&!_['isNil'](_0x428f94)){var _0x39248f=_0x26991b[_0xb2af('0x20')]-_0x428f94[_0xb2af('0x20')];_0x381576=_0x118269[_0xb2af('0x21')]?_0x118269[_0xb2af('0x21')]:moment();var _0x3d294e=moment(_0x381576)[_0xb2af('0x2f')](_0x39248f,_0xb2af('0x22'));_0x10cddc({'ret':_0x3d294e[_0xb2af('0x19')](_0xb2af('0x1a'))});}else _0x10cddc({'ret':_0x381576});}else _0x10cddc({'ret':_0x381576});}else{_0x10cddc({'ret':_0x381576});}});}});return 0xa;}var _0x4219d4=function(_0x152dde){return new BPromise(function(_0x3b9a48,_0x3f867c){_0x55f28c(_0x152dde,_0x55106e)[_0xb2af('0x1d')](function(_0x4b2b39){_0x55106e[_0xb2af('0x21')]=_0x4b2b39[_0xb2af('0x30')];_0x261781[_0xb2af('0x23')][_0xb2af('0x24')]({'where':{'phone':_0x55106e[_0xb2af('0xc')],'CampaignId':_0x152dde['id']}})[_0xb2af('0x1d')](function(_0x594c75){if(!_[_0xb2af('0x1e')](_0x594c75)){throw new Error(_0xb2af('0x25')+_0x55106e[_0xb2af('0xc')]+_0xb2af('0x31')+_0x152dde['id']);}return _0x261781['CmHopper'][_0xb2af('0x32')]({'phone':_0x55106e['phone'],'ContactId':_0x55106e['id'],'ListId':_0x55106e[_0xb2af('0x27')],'priority':_0x55106e['priority']?_0x55106e[_0xb2af('0x28')]:0x2,'scheduledat':_0x55106e['scheduledat']?_0x55106e[_0xb2af('0x21')]:moment()[_0xb2af('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x55106e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x55106e['callbackUniqueid']?_0x55106e[_0xb2af('0x29')]:undefined,'callbackat':_0x55106e[_0xb2af('0x29')]?moment()[_0xb2af('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x152dde['id']});})[_0xb2af('0x2a')](function(_0x3fe19){_0x3f867c(_0x3fe19);});});});};var _0x28434e=function(_0x15112b){return new BPromise(function(_0x38144e,_0x3c935a){_0x55f28c(_0x15112b,_0x55106e)[_0xb2af('0x1d')](function(_0x159c03){_0x55106e['scheduledat']=_0x159c03[_0xb2af('0x30')];_0x261781[_0xb2af('0x23')][_0xb2af('0x24')]({'where':{'phone':_0x55106e['phone'],'CampaignId':_0x15112b['id']}})['then'](function(_0x49e95d){if(!_[_0xb2af('0x1e')](_0x49e95d)){throw new Error(_0xb2af('0x25')+_0x55106e[_0xb2af('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x15112b['id']);}return _0x261781[_0xb2af('0x2c')]['findOne']({'where':{'calleridnum':_0x55106e[_0xb2af('0xc')],'CampaignId':_0x15112b['id']}});})[_0xb2af('0x1d')](function(_0x1ab7c0){if(!_[_0xb2af('0x1e')](_0x1ab7c0)){throw new Error(_0xb2af('0x33')+_0x55106e[_0xb2af('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x15112b['id']);}return _0x261781[_0xb2af('0x23')][_0xb2af('0x32')]({'phone':_0x55106e['phone'],'ContactId':_0x55106e['id'],'ListId':_0x55106e[_0xb2af('0x27')],'priority':_0x55106e[_0xb2af('0x28')]?_0x55106e[_0xb2af('0x28')]:0x2,'scheduledat':_0x55106e[_0xb2af('0x21')]?_0x55106e[_0xb2af('0x21')]:moment()[_0xb2af('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x55106e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x55106e['callbackUniqueid']?_0x55106e['callbackUniqueid']:undefined,'callbackat':_0x55106e[_0xb2af('0x29')]?moment()[_0xb2af('0x19')](_0xb2af('0x1a')):undefined,'CampaignId':_0x15112b['id']});})[_0xb2af('0x2a')](function(_0x3eb293){_0x3c935a(_0x3eb293);});});});};if(_0x55106e[_0xb2af('0x27')]){_0x261781[_0xb2af('0x1c')][_0xb2af('0x34')]({'where':{'type':_0xb2af('0x35')},'attributes':['id','dialCheckDuplicateType',_0xb2af('0x1b')],'include':[{'model':_0x261781[_0xb2af('0x36')],'as':_0xb2af('0x37'),'where':{'id':_0x55106e[_0xb2af('0x27')]}}]})['then'](function(_0x937e54){if(_0x937e54){var _0x4ba6c9=[];for(var _0x4e9e27=0x0,_0x41978e;_0x4e9e27<_0x937e54[_0xb2af('0x38')];_0x4e9e27+=0x1){_0x41978e=_0x937e54[_0x4e9e27][_0xb2af('0x15')]({'plain':!![]});switch(_0x41978e[_0xb2af('0x39')]){case _0xb2af('0x3a'):_0x444b5c(_0x41978e)[_0xb2af('0x2a')](_0x590002());break;case _0xb2af('0x3b'):_0x807f80(_0x41978e)['catch'](_0x590002());break;default:_0x55f28c(_0x41978e,_0x55106e)['then'](function(_0x1eb9d8){_0x55106e[_0xb2af('0x21')]=_0x1eb9d8[_0xb2af('0x30')];_0x261781[_0xb2af('0x23')][_0xb2af('0x32')]({'phone':_0x55106e[_0xb2af('0xc')],'ContactId':_0x55106e['id'],'ListId':_0x55106e[_0xb2af('0x27')],'scheduledat':_0x55106e[_0xb2af('0x21')]?_0x55106e[_0xb2af('0x21')]:moment()[_0xb2af('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x55106e[_0xb2af('0x28')]?_0x55106e[_0xb2af('0x28')]:0x2,'callback':_0x55106e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x55106e[_0xb2af('0x29')]?_0x55106e['callbackUniqueid']:undefined,'callbackat':_0x55106e[_0xb2af('0x29')]?moment()['format'](_0xb2af('0x1a')):undefined,'VoiceQueueId':_0x41978e['id']})['catch'](_0x590002());});}}}})['then'](function(){return _0x261781['VoiceQueue'][_0xb2af('0x34')]({'where':{'type':_0xb2af('0x35')},'attributes':['id'],'include':[{'model':_0x261781[_0xb2af('0x36')],'as':_0xb2af('0x3c'),'where':{'id':_0x55106e['ListId']}}]})[_0xb2af('0x1d')](function(_0x36d50a){if(_0x36d50a){var _0xef355c=[];for(var _0x4aacfb=0x0,_0x1d149d;_0x4aacfb<_0x36d50a[_0xb2af('0x38')];_0x4aacfb+=0x1){_0x1d149d=_0x36d50a[_0x4aacfb]['get']({'plain':!![]});_0x261781[_0xb2af('0x3d')][_0xb2af('0x32')]({'phone':_0x55106e[_0xb2af('0xc')],'ContactId':_0x55106e['id'],'ListId':_0x55106e['ListId'],'VoiceQueueId':_0x1d149d['id']})[_0xb2af('0x2a')](function(_0x4d6770){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0x4d6770['message']);});}}});})[_0xb2af('0x1d')](function(){return _0x261781[_0xb2af('0x2e')]['findAll']({'attributes':['id','dialCheckDuplicateType',_0xb2af('0x1b')],'include':[{'model':_0x261781[_0xb2af('0x36')],'as':'Lists','where':{'id':_0x55106e['ListId']}}]})['then'](function(_0x24bbb0){if(_0x24bbb0){var _0x6c47b=[];for(var _0x945bab=0x0,_0x37ed96;_0x945bab<_0x24bbb0[_0xb2af('0x38')];_0x945bab+=0x1){_0x37ed96=_0x24bbb0[_0x945bab][_0xb2af('0x15')]({'plain':!![]});switch(_0x37ed96[_0xb2af('0x39')]){case _0xb2af('0x3a'):_0x28434e(_0x37ed96)['catch'](_0x4872d1());break;case _0xb2af('0x3b'):_0x4219d4(_0x37ed96)[_0xb2af('0x2a')](_0x4872d1());break;default:_0x261781['CmHopper'][_0xb2af('0x32')]({'phone':_0x55106e[_0xb2af('0xc')],'ContactId':_0x55106e['id'],'ListId':_0x55106e[_0xb2af('0x27')],'scheduledat':_0x55106e[_0xb2af('0x21')]?_0x55106e['scheduledat']:moment()['format'](_0xb2af('0x1a')),'priority':_0x55106e[_0xb2af('0x28')]?_0x55106e['priority']:0x2,'callback':_0x55106e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x55106e[_0xb2af('0x29')]?_0x55106e[_0xb2af('0x29')]:undefined,'callbackat':_0x55106e['callbackUniqueid']?moment()[_0xb2af('0x19')](_0xb2af('0x1a')):undefined,'CampaignId':_0x37ed96['id']})[_0xb2af('0x2a')](_0x4872d1());}}}});})[_0xb2af('0x1d')](function(){return _0x261781['Campaign'][_0xb2af('0x34')]({'attributes':['id'],'include':[{'model':_0x261781[_0xb2af('0x36')],'as':_0xb2af('0x3c'),'where':{'id':_0x55106e[_0xb2af('0x27')]}}]})[_0xb2af('0x1d')](function(_0x3d9749){if(_0x3d9749){var _0x35aef8=[];for(var _0x2cf27a=0x0,_0x36a039;_0x2cf27a<_0x3d9749[_0xb2af('0x38')];_0x2cf27a+=0x1){_0x36a039=_0x3d9749[_0x2cf27a][_0xb2af('0x15')]({'plain':!![]});_0x261781[_0xb2af('0x3d')]['create']({'phone':_0x55106e[_0xb2af('0xc')],'ContactId':_0x55106e['id'],'ListId':_0x55106e['ListId'],'CampaignId':_0x36a039['id']})[_0xb2af('0x2a')](function(_0x151117){logger[_0xb2af('0x16')](_0xb2af('0x3e'),_0xb2af('0x17'),_0x151117[_0xb2af('0x3f')]);});}}});})[_0xb2af('0x1d')](function(){_0x5322c();})['catch'](function(_0x3a17df){logger['error'](_0xb2af('0x3e'),_0xb2af('0x17'),_0x3a17df['message']);_0x5322c(_0x3a17df);});}else{_0x5322c(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x5bcc6b,_0x36d763,_0x3f5f76){var _0x332a40=_0x577e42['models'];var _0x14d7da=_0x5bcc6b['get']({'plain':!![]});return _0x332a40[_0xb2af('0x23')][_0xb2af('0x34')]({'raw':!![],'where':{'ListId':_0x14d7da[_0xb2af('0x27')],'ContactId':_0x14d7da['id']}})['then'](function(_0x5e7d84){if(!_['isEmpty'](_0x5e7d84)){var _0x2cc22f=[];for(var _0x1728a0=0x0;_0x1728a0<_0x5e7d84[_0xb2af('0x38')];_0x1728a0+=0x1){var _0x2b51c2=_0x332a40[_0xb2af('0x23')][_0xb2af('0x40')]({'where':{'ListId':_0x5e7d84[_0x1728a0][_0xb2af('0x27')],'ContactId':_0x5e7d84[_0x1728a0][_0xb2af('0x41')],'VoiceQueueId':_0x5e7d84[_0x1728a0][_0xb2af('0x42')],'CampaignId':_0x5e7d84[_0x1728a0]['CampaignId']}});_0x2cc22f[_0xb2af('0x43')](_0x2b51c2);}return BPromise[_0xb2af('0x44')](_0x2cc22f);}})['then'](function(_0x1f5170){logger[_0xb2af('0x45')]('[CmContact][afterDestroy][Succesfull]',util[_0xb2af('0x18')](_0x1f5170,{'showHidden':![],'depth':null}));_0x3f5f76();})['catch'](function(_0x4d8a13){logger[_0xb2af('0x16')](_0xb2af('0x46'),util[_0xb2af('0x18')](_0x4d8a13,{'showHidden':![],'depth':null}));_0x3f5f76(_0x4d8a13);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 646135d..633a780 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(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x3075a3,_0x2673eb){var _0x2fd756=function(_0x3913bc){while(--_0x3913bc){_0x3075a3['push'](_0x3075a3['shift']());}};_0x2fd756(++_0x2673eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 7a9b578..5e1a2a7 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 _0x3df4=['INTEGER','STRING','PHONE'];(function(_0x2dfd0e,_0x13739e){var _0x343af6=function(_0x206e2f){while(--_0x206e2f){_0x2dfd0e['push'](_0x2dfd0e['shift']());}};_0x343af6(++_0x13739e);}(_0x3df4,0x102));var _0x43df=function(_0x74d8,_0x43a04c){_0x74d8=_0x74d8-0x0;var _0x317d00=_0x3df4[_0x74d8];return _0x317d00;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x43df('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x43df('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x43df('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x43df('0x1')],'defaultValue':_0x43df('0x2')},'OrderBy':{'type':Sequelize[_0x43df('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x43df('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x97a2=['PHONE','sequelize','INTEGER','STRING'];(function(_0x247519,_0x3f328b){var _0x1e8b5b=function(_0x79cb55){while(--_0x79cb55){_0x247519['push'](_0x247519['shift']());}};_0x1e8b5b(++_0x3f328b);}(_0x97a2,0x1b1));var _0x297a=function(_0x2e6b0b,_0x1d33d3){_0x2e6b0b=_0x2e6b0b-0x0;var _0x11b425=_0x97a2[_0x2e6b0b];return _0x11b425;};'use strict';var Sequelize=require(_0x297a('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x297a('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x297a('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x297a('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x297a('0x2')],'defaultValue':_0x297a('0x3')},'OrderBy':{'type':Sequelize[_0x297a('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x297a('0x2')],'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 c76afb7..8d0b8be 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 _0x8a11=['attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','CmContactHasItem','findAll','rows','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8a11,0x163));var _0x18a1=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x8a11[_0x9729d7];return _0x3c4ac6;};'use strict';var emlformat=require(_0x18a1('0x0'));var rimraf=require(_0x18a1('0x1'));var zipdir=require(_0x18a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18a1('0x3'));var moment=require('moment');var BPromise=require(_0x18a1('0x4'));var Mustache=require(_0x18a1('0x5'));var util=require('util');var path=require(_0x18a1('0x6'));var sox=require(_0x18a1('0x7'));var csv=require(_0x18a1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18a1('0x9'));var _=require(_0x18a1('0xa'));var squel=require(_0x18a1('0xb'));var crypto=require(_0x18a1('0xc'));var jsforce=require(_0x18a1('0xd'));var deskjs=require(_0x18a1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18a1('0xf'));var Redis=require(_0x18a1('0x10'));var authService=require(_0x18a1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x18a1('0x12'));var hardwareService=require(_0x18a1('0x13'));var logger=require(_0x18a1('0x14'))(_0x18a1('0x15'));var utils=require(_0x18a1('0x16'));var config=require(_0x18a1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x18a1('0x18'))['db'];function respondWithStatusCode(_0x503830,_0x37ada9){_0x37ada9=_0x37ada9||0xcc;return function(_0x3dde6a){if(_0x3dde6a){return _0x503830[_0x18a1('0x19')](_0x37ada9);}return _0x503830[_0x18a1('0x1a')](_0x37ada9)[_0x18a1('0x1b')]();};}function respondWithResult(_0x1172a8,_0x1c8085){_0x1c8085=_0x1c8085||0xc8;return function(_0x4ff4ba){if(_0x4ff4ba){return _0x1172a8[_0x18a1('0x1a')](_0x1c8085)[_0x18a1('0x1c')](_0x4ff4ba);}};}function respondWithFilteredResult(_0x2efc02,_0x4bddb4){return function(_0x8f3b69){if(_0x8f3b69){var _0x553e89=typeof _0x4bddb4[_0x18a1('0x1d')]===_0x18a1('0x1e')&&typeof _0x4bddb4[_0x18a1('0x1f')]===_0x18a1('0x1e');var _0x340615=_0x8f3b69[_0x18a1('0x20')];var _0x541b56=_0x553e89?0x0:_0x4bddb4[_0x18a1('0x1d')];var _0x80fd2f=_0x553e89?_0x8f3b69[_0x18a1('0x20')]:_0x4bddb4[_0x18a1('0x1d')]+_0x4bddb4[_0x18a1('0x1f')];var _0x2179f5;if(_0x80fd2f>=_0x340615){_0x80fd2f=_0x340615;_0x2179f5=0xc8;}else{_0x2179f5=0xce;}_0x2efc02[_0x18a1('0x1a')](_0x2179f5);return _0x2efc02[_0x18a1('0x21')]('Content-Range',_0x541b56+'-'+_0x80fd2f+'/'+_0x340615)[_0x18a1('0x1c')](_0x8f3b69);}return null;};}function patchUpdates(_0xc9e5d8){return function(_0x5b6550){try{jsonpatch['apply'](_0x5b6550,_0xc9e5d8,!![]);}catch(_0x46cb2b){return BPromise[_0x18a1('0x22')](_0x46cb2b);}return _0x5b6550[_0x18a1('0x23')]();};}function saveUpdates(_0x52529b,_0x5a666c){return function(_0x56344e){if(_0x56344e){return _0x56344e[_0x18a1('0x24')](_0x52529b)['then'](function(_0x5e429a){return _0x5e429a;});}return null;};}function removeEntity(_0x11726d,_0x1cdb0c){return function(_0x5f38c4){if(_0x5f38c4){return _0x5f38c4[_0x18a1('0x25')]()[_0x18a1('0x26')](function(){var _0x14488c=_0x5f38c4[_0x18a1('0x27')]({'plain':!![]});var _0x189100=_0x18a1('0x28');return db[_0x18a1('0x29')][_0x18a1('0x25')]({'where':{'type':_0x189100,'resourceId':_0x14488c['id']}})[_0x18a1('0x26')](function(){return _0x5f38c4;});})[_0x18a1('0x26')](function(){_0x11726d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a59b9,_0x24899c){return function(_0x434748){if(!_0x434748){_0x4a59b9[_0x18a1('0x19')](0x194);}return _0x434748;};}function handleError(_0x7274e4,_0x5287f2){_0x5287f2=_0x5287f2||0x1f4;return function(_0x102cbe){logger[_0x18a1('0x2a')](_0x102cbe[_0x18a1('0x2b')]);if(_0x102cbe[_0x18a1('0x2c')]){delete _0x102cbe[_0x18a1('0x2c')];}_0x7274e4[_0x18a1('0x1a')](_0x5287f2)[_0x18a1('0x2d')](_0x102cbe);};}exports['index']=function(_0x1d6a66,_0x421f04){var _0x11baf5={},_0x1ecfba={},_0x4829ec={'count':0x0,'rows':[]};var _0xe0cd04=_[_0x18a1('0x2e')](db['CmContactHasItem'][_0x18a1('0x2f')],function(_0x149de1){return{'name':_0x149de1[_0x18a1('0x30')],'type':_0x149de1[_0x18a1('0x31')]['key']};});_0x1ecfba[_0x18a1('0x32')]=_['map'](_0xe0cd04,_0x18a1('0x2c'));_0x1ecfba[_0x18a1('0x33')]=_[_0x18a1('0x34')](_0x1d6a66[_0x18a1('0x33')]);_0x1ecfba[_0x18a1('0x35')]=_[_0x18a1('0x36')](_0x1ecfba[_0x18a1('0x32')],_0x1ecfba[_0x18a1('0x33')]);_0x11baf5[_0x18a1('0x37')]=_['intersection'](_0x1ecfba[_0x18a1('0x32')],qs[_0x18a1('0x38')](_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x38')]));_0x11baf5[_0x18a1('0x37')]=_0x11baf5['attributes']['length']?_0x11baf5[_0x18a1('0x37')]:_0x1ecfba[_0x18a1('0x32')];if(!_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x39')]('nolimit')){_0x11baf5[_0x18a1('0x1f')]=qs[_0x18a1('0x1f')](_0x1d6a66['query'][_0x18a1('0x1f')]);_0x11baf5[_0x18a1('0x1d')]=qs['offset'](_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x1d')]);}_0x11baf5[_0x18a1('0x3a')]=qs['sort'](_0x1d6a66['query'][_0x18a1('0x3b')]);_0x11baf5['where']=qs[_0x18a1('0x35')](_[_0x18a1('0x3c')](_0x1d6a66['query'],_0x1ecfba[_0x18a1('0x35')]),_0xe0cd04);if(_0x1d6a66[_0x18a1('0x33')]['filter']){_0x11baf5[_0x18a1('0x3d')]=_[_0x18a1('0x3e')](_0x11baf5[_0x18a1('0x3d')],{'$or':_[_0x18a1('0x2e')](_0xe0cd04,function(_0x4e36cc){if(_0x4e36cc[_0x18a1('0x31')]!==_0x18a1('0x3f')){var _0x4bc1a8={};_0x4bc1a8[_0x4e36cc[_0x18a1('0x2c')]]={'$like':'%'+_0x1d6a66[_0x18a1('0x33')][_0x18a1('0x40')]+'%'};return _0x4bc1a8;}})});}_0x11baf5=_['merge']({},_0x11baf5,_0x1d6a66['options']);var _0x17ce0b={'where':_0x11baf5[_0x18a1('0x3d')]};return db[_0x18a1('0x41')][_0x18a1('0x20')](_0x17ce0b)[_0x18a1('0x26')](function(_0x1f0b57){_0x4829ec['count']=_0x1f0b57;if(_0x1d6a66['query']['includeAll']){_0x11baf5['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x18a1('0x42')](_0x11baf5);})[_0x18a1('0x26')](function(_0xce5adf){_0x4829ec[_0x18a1('0x43')]=_0xce5adf;return _0x4829ec;})[_0x18a1('0x26')](respondWithFilteredResult(_0x421f04,_0x11baf5))['catch'](handleError(_0x421f04,null));};exports[_0x18a1('0x44')]=function(_0x2c80bd,_0x3bf032){var _0x139aeb={'raw':!![],'where':{'id':_0x2c80bd['params']['id']}},_0x196e7b={};_0x196e7b['model']=_[_0x18a1('0x34')](db[_0x18a1('0x41')]['rawAttributes']);_0x196e7b[_0x18a1('0x33')]=_[_0x18a1('0x34')](_0x2c80bd[_0x18a1('0x33')]);_0x196e7b['filters']=_['intersection'](_0x196e7b['model'],_0x196e7b[_0x18a1('0x33')]);_0x139aeb[_0x18a1('0x37')]=_['intersection'](_0x196e7b[_0x18a1('0x32')],qs[_0x18a1('0x38')](_0x2c80bd[_0x18a1('0x33')]['fields']));_0x139aeb[_0x18a1('0x37')]=_0x139aeb[_0x18a1('0x37')][_0x18a1('0x45')]?_0x139aeb[_0x18a1('0x37')]:_0x196e7b[_0x18a1('0x32')];if(_0x2c80bd[_0x18a1('0x33')][_0x18a1('0x46')]){_0x139aeb['include']=[{'all':!![]}];}_0x139aeb=_['merge']({},_0x139aeb,_0x2c80bd['options']);return db[_0x18a1('0x41')][_0x18a1('0x47')](_0x139aeb)[_0x18a1('0x26')](handleEntityNotFound(_0x3bf032,null))[_0x18a1('0x26')](respondWithResult(_0x3bf032,null))['catch'](handleError(_0x3bf032,null));};exports[_0x18a1('0x48')]=function(_0x56ff3e,_0x1a8c83){return db[_0x18a1('0x41')][_0x18a1('0x48')](_0x56ff3e[_0x18a1('0x49')],{})['then'](function(_0x5c8762){var _0x4ac0cb=_0x56ff3e[_0x18a1('0x4a')][_0x18a1('0x27')]({'plain':!![]});if(!_0x4ac0cb)throw new Error(_0x18a1('0x4b'));if(_0x4ac0cb[_0x18a1('0x4c')]===_0x18a1('0x4a')){var _0x3e53ec=_0x5c8762[_0x18a1('0x27')]({'plain':!![]});var _0x6cabf1='CmContactHasItems';return db[_0x18a1('0x4d')][_0x18a1('0x47')]({'where':{'name':_0x6cabf1,'userProfileId':_0x4ac0cb['userProfileId']},'raw':!![]})[_0x18a1('0x26')](function(_0x51a415){if(_0x51a415&&_0x51a415[_0x18a1('0x4e')]===0x0){return db[_0x18a1('0x29')][_0x18a1('0x48')]({'name':_0x3e53ec[_0x18a1('0x2c')],'resourceId':_0x3e53ec['id'],'type':_0x51a415[_0x18a1('0x2c')],'sectionId':_0x51a415['id']},{})['then'](function(){return _0x5c8762;});}else{return _0x5c8762;}})[_0x18a1('0x4f')](function(_0x5cc9b6){logger[_0x18a1('0x2a')](_0x18a1('0x50'),_0x5cc9b6);throw _0x5cc9b6;});}return _0x5c8762;})[_0x18a1('0x26')](respondWithResult(_0x1a8c83,0xc9))[_0x18a1('0x4f')](handleError(_0x1a8c83,null));};exports[_0x18a1('0x24')]=function(_0x3280c9,_0x14e1a6){if(_0x3280c9[_0x18a1('0x49')]['id']){delete _0x3280c9['body']['id'];}return db[_0x18a1('0x41')][_0x18a1('0x47')]({'where':{'id':_0x3280c9[_0x18a1('0x51')]['id']}})[_0x18a1('0x26')](handleEntityNotFound(_0x14e1a6,null))[_0x18a1('0x26')](saveUpdates(_0x3280c9['body'],null))['then'](respondWithResult(_0x14e1a6,null))[_0x18a1('0x4f')](handleError(_0x14e1a6,null));};exports['destroy']=function(_0xb05bc2,_0x10eca2){return db[_0x18a1('0x41')][_0x18a1('0x47')]({'where':{'id':_0xb05bc2[_0x18a1('0x51')]['id']}})[_0x18a1('0x26')](handleEntityNotFound(_0x10eca2,null))[_0x18a1('0x26')](removeEntity(_0x10eca2,null))['catch'](handleError(_0x10eca2,null));}; \ No newline at end of file +var _0x5de9=['then','get','CmContactHasItems','sendStatus','error','stack','name','index','map','CmContactHasItem','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','set','apply','reject','update','destroy'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x5de9,0x119));var _0x95de=function(_0x419ffd,_0x10bdfe){_0x419ffd=_0x419ffd-0x0;var _0xb0b19d=_0x5de9[_0x419ffd];return _0xb0b19d;};'use strict';var emlformat=require(_0x95de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x95de('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95de('0x2'));var util=require(_0x95de('0x3'));var path=require(_0x95de('0x4'));var sox=require('sox');var csv=require(_0x95de('0x5'));var ejs=require(_0x95de('0x6'));var fs=require('fs');var fs_extra=require(_0x95de('0x7'));var _=require(_0x95de('0x8'));var squel=require('squel');var crypto=require(_0x95de('0x9'));var jsforce=require(_0x95de('0xa'));var deskjs=require(_0x95de('0xb'));var toCsv=require('to-csv');var querystring=require(_0x95de('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x95de('0xd'));var qs=require(_0x95de('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95de('0xf'));var logger=require(_0x95de('0x10'))(_0x95de('0x11'));var utils=require('../../config/utils');var config=require(_0x95de('0x12'));var licenseUtil=require(_0x95de('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x255b25,_0x399872){_0x399872=_0x399872||0xcc;return function(_0x1ceeca){if(_0x1ceeca){return _0x255b25['sendStatus'](_0x399872);}return _0x255b25[_0x95de('0x14')](_0x399872)[_0x95de('0x15')]();};}function respondWithResult(_0x3d5443,_0x4920cd){_0x4920cd=_0x4920cd||0xc8;return function(_0x4f1d2b){if(_0x4f1d2b){return _0x3d5443[_0x95de('0x14')](_0x4920cd)[_0x95de('0x16')](_0x4f1d2b);}};}function respondWithFilteredResult(_0x284a14,_0x16320e){return function(_0x1d3495){if(_0x1d3495){var _0x9ac0ce=typeof _0x16320e['offset']===_0x95de('0x17')&&typeof _0x16320e['limit']===_0x95de('0x17');var _0x172b45=_0x1d3495[_0x95de('0x18')];var _0x2258e4=_0x9ac0ce?0x0:_0x16320e[_0x95de('0x19')];var _0x1d6fc2=_0x9ac0ce?_0x1d3495[_0x95de('0x18')]:_0x16320e[_0x95de('0x19')]+_0x16320e['limit'];var _0x3ddd7a;if(_0x1d6fc2>=_0x172b45){_0x1d6fc2=_0x172b45;_0x3ddd7a=0xc8;}else{_0x3ddd7a=0xce;}_0x284a14[_0x95de('0x14')](_0x3ddd7a);return _0x284a14[_0x95de('0x1a')]('Content-Range',_0x2258e4+'-'+_0x1d6fc2+'/'+_0x172b45)[_0x95de('0x16')](_0x1d3495);}return null;};}function patchUpdates(_0x51c2d0){return function(_0x1681cb){try{jsonpatch[_0x95de('0x1b')](_0x1681cb,_0x51c2d0,!![]);}catch(_0x4db95e){return BPromise[_0x95de('0x1c')](_0x4db95e);}return _0x1681cb['save']();};}function saveUpdates(_0x1b199b,_0x4cfd9a){return function(_0x386459){if(_0x386459){return _0x386459[_0x95de('0x1d')](_0x1b199b)['then'](function(_0x410c75){return _0x410c75;});}return null;};}function removeEntity(_0x32203d,_0xb6fc30){return function(_0x84e99e){if(_0x84e99e){return _0x84e99e[_0x95de('0x1e')]()[_0x95de('0x1f')](function(){var _0x587796=_0x84e99e[_0x95de('0x20')]({'plain':!![]});var _0x49bcb6=_0x95de('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x49bcb6,'resourceId':_0x587796['id']}})[_0x95de('0x1f')](function(){return _0x84e99e;});})[_0x95de('0x1f')](function(){_0x32203d[_0x95de('0x14')](0xcc)[_0x95de('0x15')]();});}};}function handleEntityNotFound(_0x5d6722,_0x3cb61d){return function(_0x330669){if(!_0x330669){_0x5d6722[_0x95de('0x22')](0x194);}return _0x330669;};}function handleError(_0x3993c5,_0x392250){_0x392250=_0x392250||0x1f4;return function(_0x13b1b9){logger[_0x95de('0x23')](_0x13b1b9[_0x95de('0x24')]);if(_0x13b1b9['name']){delete _0x13b1b9[_0x95de('0x25')];}_0x3993c5[_0x95de('0x14')](_0x392250)['send'](_0x13b1b9);};}exports[_0x95de('0x26')]=function(_0x14ad1a,_0x6c8ed1){var _0x4e2f4d={},_0x4da08b={},_0x218150={'count':0x0,'rows':[]};var _0x1e1f2d=_[_0x95de('0x27')](db[_0x95de('0x28')]['rawAttributes'],function(_0x1ece07){return{'name':_0x1ece07[_0x95de('0x29')],'type':_0x1ece07[_0x95de('0x2a')][_0x95de('0x2b')]};});_0x4da08b['model']=_[_0x95de('0x27')](_0x1e1f2d,_0x95de('0x25'));_0x4da08b['query']=_['keys'](_0x14ad1a[_0x95de('0x2c')]);_0x4da08b['filters']=_[_0x95de('0x2d')](_0x4da08b[_0x95de('0x2e')],_0x4da08b[_0x95de('0x2c')]);_0x4e2f4d[_0x95de('0x2f')]=_['intersection'](_0x4da08b[_0x95de('0x2e')],qs['fields'](_0x14ad1a[_0x95de('0x2c')][_0x95de('0x30')]));_0x4e2f4d['attributes']=_0x4e2f4d[_0x95de('0x2f')][_0x95de('0x31')]?_0x4e2f4d[_0x95de('0x2f')]:_0x4da08b[_0x95de('0x2e')];if(!_0x14ad1a[_0x95de('0x2c')][_0x95de('0x32')](_0x95de('0x33'))){_0x4e2f4d[_0x95de('0x34')]=qs[_0x95de('0x34')](_0x14ad1a['query'][_0x95de('0x34')]);_0x4e2f4d[_0x95de('0x19')]=qs[_0x95de('0x19')](_0x14ad1a[_0x95de('0x2c')][_0x95de('0x19')]);}_0x4e2f4d[_0x95de('0x35')]=qs[_0x95de('0x36')](_0x14ad1a[_0x95de('0x2c')][_0x95de('0x36')]);_0x4e2f4d[_0x95de('0x37')]=qs[_0x95de('0x38')](_[_0x95de('0x39')](_0x14ad1a['query'],_0x4da08b['filters']),_0x1e1f2d);if(_0x14ad1a[_0x95de('0x2c')]['filter']){_0x4e2f4d['where']=_[_0x95de('0x3a')](_0x4e2f4d[_0x95de('0x37')],{'$or':_[_0x95de('0x27')](_0x1e1f2d,function(_0x2ec339){if(_0x2ec339[_0x95de('0x2a')]!==_0x95de('0x3b')){var _0x9337ab={};_0x9337ab[_0x2ec339[_0x95de('0x25')]]={'$like':'%'+_0x14ad1a[_0x95de('0x2c')]['filter']+'%'};return _0x9337ab;}})});}_0x4e2f4d=_[_0x95de('0x3a')]({},_0x4e2f4d,_0x14ad1a['options']);var _0x22e08e={'where':_0x4e2f4d['where']};return db[_0x95de('0x28')]['count'](_0x22e08e)[_0x95de('0x1f')](function(_0x1b6022){_0x218150[_0x95de('0x18')]=_0x1b6022;if(_0x14ad1a['query'][_0x95de('0x3c')]){_0x4e2f4d[_0x95de('0x3d')]=[{'all':!![]}];}return db[_0x95de('0x28')]['findAll'](_0x4e2f4d);})['then'](function(_0x4782b2){_0x218150[_0x95de('0x3e')]=_0x4782b2;return _0x218150;})[_0x95de('0x1f')](respondWithFilteredResult(_0x6c8ed1,_0x4e2f4d))[_0x95de('0x3f')](handleError(_0x6c8ed1,null));};exports[_0x95de('0x40')]=function(_0x4ecc7c,_0xabedce){var _0x2c6ca0={'raw':!![],'where':{'id':_0x4ecc7c[_0x95de('0x41')]['id']}},_0x27c861={};_0x27c861[_0x95de('0x2e')]=_[_0x95de('0x42')](db[_0x95de('0x28')][_0x95de('0x43')]);_0x27c861[_0x95de('0x2c')]=_[_0x95de('0x42')](_0x4ecc7c[_0x95de('0x2c')]);_0x27c861[_0x95de('0x38')]=_[_0x95de('0x2d')](_0x27c861['model'],_0x27c861['query']);_0x2c6ca0[_0x95de('0x2f')]=_[_0x95de('0x2d')](_0x27c861['model'],qs[_0x95de('0x30')](_0x4ecc7c[_0x95de('0x2c')][_0x95de('0x30')]));_0x2c6ca0[_0x95de('0x2f')]=_0x2c6ca0['attributes'][_0x95de('0x31')]?_0x2c6ca0['attributes']:_0x27c861[_0x95de('0x2e')];if(_0x4ecc7c[_0x95de('0x2c')][_0x95de('0x3c')]){_0x2c6ca0[_0x95de('0x3d')]=[{'all':!![]}];}_0x2c6ca0=_[_0x95de('0x3a')]({},_0x2c6ca0,_0x4ecc7c[_0x95de('0x44')]);return db['CmContactHasItem'][_0x95de('0x45')](_0x2c6ca0)[_0x95de('0x1f')](handleEntityNotFound(_0xabedce,null))[_0x95de('0x1f')](respondWithResult(_0xabedce,null))[_0x95de('0x3f')](handleError(_0xabedce,null));};exports[_0x95de('0x46')]=function(_0xcd7357,_0x2ef2f7){return db['CmContactHasItem'][_0x95de('0x46')](_0xcd7357['body'],{})[_0x95de('0x1f')](function(_0x46a430){var _0x148851=_0xcd7357[_0x95de('0x47')][_0x95de('0x20')]({'plain':!![]});if(!_0x148851)throw new Error(_0x95de('0x48'));if(_0x148851['role']===_0x95de('0x47')){var _0x35d6be=_0x46a430[_0x95de('0x20')]({'plain':!![]});var _0x3c31f4=_0x95de('0x21');return db[_0x95de('0x49')][_0x95de('0x45')]({'where':{'name':_0x3c31f4,'userProfileId':_0x148851[_0x95de('0x4a')]},'raw':!![]})[_0x95de('0x1f')](function(_0x4e71b1){if(_0x4e71b1&&_0x4e71b1['autoAssociation']===0x0){return db[_0x95de('0x4b')]['create']({'name':_0x35d6be[_0x95de('0x25')],'resourceId':_0x35d6be['id'],'type':_0x4e71b1[_0x95de('0x25')],'sectionId':_0x4e71b1['id']},{})[_0x95de('0x1f')](function(){return _0x46a430;});}else{return _0x46a430;}})[_0x95de('0x3f')](function(_0x52215c){logger[_0x95de('0x23')](_0x95de('0x4c'),_0x52215c);throw _0x52215c;});}return _0x46a430;})[_0x95de('0x1f')](respondWithResult(_0x2ef2f7,0xc9))[_0x95de('0x3f')](handleError(_0x2ef2f7,null));};exports['update']=function(_0x405d22,_0x283c42){if(_0x405d22[_0x95de('0x4d')]['id']){delete _0x405d22[_0x95de('0x4d')]['id'];}return db[_0x95de('0x28')][_0x95de('0x45')]({'where':{'id':_0x405d22[_0x95de('0x41')]['id']}})[_0x95de('0x1f')](handleEntityNotFound(_0x283c42,null))[_0x95de('0x1f')](saveUpdates(_0x405d22[_0x95de('0x4d')],null))[_0x95de('0x1f')](respondWithResult(_0x283c42,null))[_0x95de('0x3f')](handleError(_0x283c42,null));};exports[_0x95de('0x1e')]=function(_0x54ce20,_0x59b454){return db[_0x95de('0x28')]['find']({'where':{'id':_0x54ce20[_0x95de('0x41')]['id']}})[_0x95de('0x1f')](handleEntityNotFound(_0x59b454,null))[_0x95de('0x1f')](removeEntity(_0x59b454,null))[_0x95de('0x3f')](handleError(_0x59b454,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 981a345..4404e17 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 _0x958a=['rimraf','../../config/environment','define','CmContactHasItem','cm_contact_has_items','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3008ba,_0x31eb74){var _0x213537=function(_0x1210c1){while(--_0x1210c1){_0x3008ba['push'](_0x3008ba['shift']());}};_0x213537(++_0x31eb74);}(_0x958a,0x144));var _0xa958=function(_0x1d9dc1,_0x52bdaa){_0x1d9dc1=_0x1d9dc1-0x0;var _0x42f69c=_0x958a[_0x1d9dc1];return _0x42f69c;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa958('0x2'));var BPromise=require(_0xa958('0x3'));var rp=require(_0xa958('0x4'));var fs=require('fs');var path=require(_0xa958('0x5'));var rimraf=require(_0xa958('0x6'));var config=require(_0xa958('0x7'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x4f0403,_0x492c28){return _0x4f0403[_0xa958('0x8')](_0xa958('0x9'),attributes,{'tableName':_0xa958('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1502=['exports','define','cm_contact_has_items','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x586095,_0x437df0){var _0x25ea21=function(_0x21df9c){while(--_0x21df9c){_0x586095['push'](_0x586095['shift']());}};_0x25ea21(++_0x437df0);}(_0x1502,0x1e3));var _0x2150=function(_0x10a3d2,_0x5275fd){_0x10a3d2=_0x10a3d2-0x0;var _0x2631e8=_0x1502[_0x10a3d2];return _0x2631e8;};'use strict';var _=require('lodash');var util=require(_0x2150('0x0'));var logger=require(_0x2150('0x1'))('api');var moment=require(_0x2150('0x2'));var BPromise=require(_0x2150('0x3'));var rp=require(_0x2150('0x4'));var fs=require('fs');var path=require(_0x2150('0x5'));var rimraf=require(_0x2150('0x6'));var config=require(_0x2150('0x7'));var attributes=require(_0x2150('0x8'));module[_0x2150('0x9')]=function(_0x2cf18f,_0x287001){return _0x2cf18f[_0x2150('0xa')]('CmContactHasItem',attributes,{'tableName':_0x2150('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 2664d1e..891bd5c 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 _0x6301=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code','CmContactHasItem,\x20%s,\x20%s','message','error','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5b02f2,_0x50c550){var _0x2e6c85=function(_0x2f23bc){while(--_0x2f23bc){_0x5b02f2['push'](_0x5b02f2['shift']());}};_0x2e6c85(++_0x50c550);}(_0x6301,0x1aa));var _0x1630=function(_0x1c8567,_0x5180c6){_0x1c8567=_0x1c8567-0x0;var _0x5309fd=_0x6301[_0x1c8567];return _0x5309fd;};'use strict';var _=require(_0x1630('0x0'));var util=require(_0x1630('0x1'));var moment=require(_0x1630('0x2'));var BPromise=require('bluebird');var rs=require(_0x1630('0x3'));var fs=require('fs');var Redis=require(_0x1630('0x4'));var db=require(_0x1630('0x5'))['db'];var utils=require(_0x1630('0x6'));var logger=require(_0x1630('0x7'))(_0x1630('0x8'));var config=require(_0x1630('0x9'));var jayson=require(_0x1630('0xa'));var client=jayson[_0x1630('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x534d9e,_0x33f879,_0x57bcab){return new BPromise(function(_0x5c7ac1,_0x31f831){return client[_0x1630('0xc')](_0x534d9e,_0x57bcab)[_0x1630('0xd')](function(_0x487662){logger[_0x1630('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x33f879,_0x1630('0xf'));logger[_0x1630('0x10')](_0x1630('0x11'),_0x33f879,'request\x20sent',JSON[_0x1630('0x12')](_0x487662));if(_0x487662['error']){if(_0x487662['error'][_0x1630('0x13')]===0x1f4){logger['error'](_0x1630('0x14'),_0x33f879,_0x487662['error'][_0x1630('0x15')]);return _0x31f831(_0x487662[_0x1630('0x16')][_0x1630('0x15')]);}logger[_0x1630('0x16')](_0x1630('0x14'),_0x33f879,_0x487662[_0x1630('0x16')][_0x1630('0x15')]);return _0x5c7ac1(_0x487662[_0x1630('0x16')]['message']);}else{logger[_0x1630('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x33f879,'request\x20sent');_0x5c7ac1(_0x487662['result'][_0x1630('0x15')]);}})[_0x1630('0x17')](function(_0x2cbcd2){logger[_0x1630('0x16')](_0x1630('0x14'),_0x33f879,_0x2cbcd2);_0x31f831(_0x2cbcd2);});});} \ No newline at end of file +var _0x72cb=['request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x14106a,_0x1f1d87){var _0x5d35a1=function(_0x21802d){while(--_0x21802d){_0x14106a['push'](_0x14106a['shift']());}};_0x5d35a1(++_0x1f1d87);}(_0x72cb,0x157));var _0xb72c=function(_0x3df935,_0x2f6877){_0x3df935=_0x3df935-0x0;var _0x152412=_0x72cb[_0x3df935];return _0x152412;};'use strict';var _=require(_0xb72c('0x0'));var util=require(_0xb72c('0x1'));var moment=require('moment');var BPromise=require(_0xb72c('0x2'));var rs=require(_0xb72c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb72c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb72c('0x5'))(_0xb72c('0x6'));var config=require(_0xb72c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb72c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a62bf,_0xf65090,_0x192609){return new BPromise(function(_0x1359f5,_0x5950cc){return client[_0xb72c('0x9')](_0x8a62bf,_0x192609)[_0xb72c('0xa')](function(_0x414729){logger[_0xb72c('0xb')](_0xb72c('0xc'),_0xf65090,'request\x20sent');logger[_0xb72c('0xd')](_0xb72c('0xe'),_0xf65090,_0xb72c('0xf'),JSON[_0xb72c('0x10')](_0x414729));if(_0x414729[_0xb72c('0x11')]){if(_0x414729[_0xb72c('0x11')][_0xb72c('0x12')]===0x1f4){logger[_0xb72c('0x11')](_0xb72c('0xc'),_0xf65090,_0x414729[_0xb72c('0x11')][_0xb72c('0x13')]);return _0x5950cc(_0x414729[_0xb72c('0x11')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0xf65090,_0x414729['error'][_0xb72c('0x13')]);return _0x1359f5(_0x414729[_0xb72c('0x11')][_0xb72c('0x13')]);}else{logger[_0xb72c('0xb')](_0xb72c('0xc'),_0xf65090,_0xb72c('0xf'));_0x1359f5(_0x414729[_0xb72c('0x14')][_0xb72c('0x13')]);}})[_0xb72c('0x15')](function(_0x514bb5){logger[_0xb72c('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0xf65090,_0x514bb5);_0x5950cc(_0x514bb5);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9e0453e..bb0ca34 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 _0x65b0=['/:id','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x3410a9,_0x8ab806){var _0x95512b=function(_0x5e45b6){while(--_0x5e45b6){_0x3410a9['push'](_0x3410a9['shift']());}};_0x95512b(++_0x8ab806);}(_0x65b0,0x18f));var _0x065b=function(_0x2ad5cb,_0x450f8c){_0x2ad5cb=_0x2ad5cb-0x0;var _0x68afbc=_0x65b0[_0x2ad5cb];return _0x68afbc;};'use strict';var multer=require('multer');var util=require(_0x065b('0x0'));var path=require(_0x065b('0x1'));var timeout=require('connect-timeout');var express=require(_0x065b('0x2'));var router=express[_0x065b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x065b('0x4'));var config=require('../../config/environment');var controller=require(_0x065b('0x5'));router[_0x065b('0x6')]('/',auth[_0x065b('0x7')](),controller[_0x065b('0x8')]);router['get'](_0x065b('0x9'),auth[_0x065b('0x7')](),controller['show']);router[_0x065b('0xa')]('/',auth['isAuthenticated'](),controller[_0x065b('0xb')]);router[_0x065b('0xc')](_0x065b('0x9'),auth[_0x065b('0x7')](),controller[_0x065b('0xd')]);router[_0x065b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x065b('0xf')]);module[_0x065b('0x10')]=router; \ No newline at end of file +var _0x4458=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete'];(function(_0x4be0fb,_0x238edf){var _0x483897=function(_0x2fef55){while(--_0x2fef55){_0x4be0fb['push'](_0x4be0fb['shift']());}};_0x483897(++_0x238edf);}(_0x4458,0x1e4));var _0x8445=function(_0x5e8aad,_0x165d36){_0x5e8aad=_0x5e8aad-0x0;var _0x2f2d40=_0x4458[_0x5e8aad];return _0x2f2d40;};'use strict';var multer=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var path=require(_0x8445('0x2'));var timeout=require(_0x8445('0x3'));var express=require(_0x8445('0x4'));var router=express[_0x8445('0x5')]();var fs_extra=require(_0x8445('0x6'));var auth=require(_0x8445('0x7'));var interaction=require(_0x8445('0x8'));var config=require(_0x8445('0x9'));var controller=require(_0x8445('0xa'));router['get']('/',auth[_0x8445('0xb')](),controller[_0x8445('0xc')]);router[_0x8445('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8445('0xe')]);router[_0x8445('0xf')]('/',auth[_0x8445('0xb')](),controller['create']);router[_0x8445('0x10')](_0x8445('0x11'),auth['isAuthenticated'](),controller[_0x8445('0x12')]);router[_0x8445('0x13')](_0x8445('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x8445('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index d1b9d19..af97573 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 _0xa5fa=['type','parse','values','isArray','stringify','BOOLEAN','voice','exports','getDataValue','alias','STRING','setDataValue','long'];(function(_0x29411b,_0x29fe3d){var _0x14afde=function(_0x28c831){while(--_0x28c831){_0x29411b['push'](_0x29411b['shift']());}};_0x14afde(++_0x29fe3d);}(_0xa5fa,0x10b));var _0xaa5f=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0xa5fa[_0x3124f8];return _0x5bab5f;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xaa5f('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x341e83){return this[_0xaa5f('0x1')](_0xaa5f('0x2'));}},'alias':{'type':Sequelize[_0xaa5f('0x3')],'allowNull':![],'set':function(_0x2ecfe9){this[_0xaa5f('0x4')]('alias',_0x2ecfe9?_0x2ecfe9:this[_0xaa5f('0x1')]('name'));}},'type':{'type':Sequelize[_0xaa5f('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xaa5f('0x5')),'get':function(){if(this[_0xaa5f('0x1')](_0xaa5f('0x6'))==='select'){return JSON[_0xaa5f('0x7')](this[_0xaa5f('0x1')](_0xaa5f('0x8')));}else{return this[_0xaa5f('0x1')](_0xaa5f('0x8'));}},'set':function(_0x2f850b){if(Array[_0xaa5f('0x9')](_0x2f850b)){this[_0xaa5f('0x4')]('values',JSON[_0xaa5f('0xa')](_0x2f850b));}else{this['setDataValue'](_0xaa5f('0x8'),_0x2f850b);}}},'required':{'type':Sequelize[_0xaa5f('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xaa5f('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xaa5f('0xc'))}}; \ No newline at end of file +var _0x046a=['parse','values','isArray','stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','name','TEXT','long','type','select'];(function(_0x1fda18,_0x2bbb57){var _0x406ae6=function(_0x37d5b9){while(--_0x37d5b9){_0x1fda18['push'](_0x1fda18['shift']());}};_0x406ae6(++_0x2bbb57);}(_0x046a,0x67));var _0xa046=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x046a[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0xa046('0x0'));var _=require(_0xa046('0x1'));module[_0xa046('0x2')]={'name':{'type':Sequelize[_0xa046('0x3')],'get':function(_0x5c364d){return this[_0xa046('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3fc5f3){this['setDataValue'](_0xa046('0x5'),_0x3fc5f3?_0x3fc5f3:this['getDataValue'](_0xa046('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xa046('0x7')](_0xa046('0x8')),'get':function(){if(this[_0xa046('0x4')](_0xa046('0x9'))===_0xa046('0xa')){return JSON[_0xa046('0xb')](this[_0xa046('0x4')](_0xa046('0xc')));}else{return this[_0xa046('0x4')]('values');}},'set':function(_0x35765d){if(Array[_0xa046('0xd')](_0x35765d)){this['setDataValue'](_0xa046('0xc'),JSON[_0xa046('0xe')](_0x35765d));}else{this[_0xa046('0xf')](_0xa046('0xc'),_0x35765d);}}},'required':{'type':Sequelize[_0xa046('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa046('0x11')](_0xa046('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 37ae609..fb94508 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 _0xc7f4=['VIRTUAL','options','includeAll','include','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','save','then','error','stack','name','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge'];(function(_0xfc4e4c,_0x17ff55){var _0x3dd89e=function(_0x5dd51d){while(--_0x5dd51d){_0xfc4e4c['push'](_0xfc4e4c['shift']());}};_0x3dd89e(++_0x17ff55);}(_0xc7f4,0x10e));var _0x4c7f=function(_0x252765,_0x101135){_0x252765=_0x252765-0x0;var _0x138e2a=_0xc7f4[_0x252765];return _0x138e2a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c7f('0x0'));var jsonpatch=require(_0x4c7f('0x1'));var rp=require(_0x4c7f('0x2'));var moment=require('moment');var BPromise=require(_0x4c7f('0x3'));var Mustache=require(_0x4c7f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4c7f('0x5'));var csv=require(_0x4c7f('0x6'));var ejs=require(_0x4c7f('0x7'));var fs=require('fs');var fs_extra=require(_0x4c7f('0x8'));var _=require('lodash');var squel=require(_0x4c7f('0x9'));var crypto=require(_0x4c7f('0xa'));var jsforce=require(_0x4c7f('0xb'));var deskjs=require(_0x4c7f('0xc'));var toCsv=require(_0x4c7f('0x6'));var querystring=require(_0x4c7f('0xd'));var Papa=require(_0x4c7f('0xe'));var Redis=require(_0x4c7f('0xf'));var authService=require(_0x4c7f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4c7f('0x11'));var hardwareService=require(_0x4c7f('0x12'));var logger=require(_0x4c7f('0x13'))(_0x4c7f('0x14'));var utils=require(_0x4c7f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4c7f('0x16'));var db=require(_0x4c7f('0x17'))['db'];function respondWithStatusCode(_0x39a4ee,_0xe441af){_0xe441af=_0xe441af||0xcc;return function(_0x53aa68){if(_0x53aa68){return _0x39a4ee[_0x4c7f('0x18')](_0xe441af);}return _0x39a4ee[_0x4c7f('0x19')](_0xe441af)[_0x4c7f('0x1a')]();};}function respondWithResult(_0x5ca578,_0x5cf1d8){_0x5cf1d8=_0x5cf1d8||0xc8;return function(_0x1c20a4){if(_0x1c20a4){return _0x5ca578[_0x4c7f('0x19')](_0x5cf1d8)[_0x4c7f('0x1b')](_0x1c20a4);}};}function respondWithFilteredResult(_0x44287f,_0x119784){return function(_0x2cf3d2){if(_0x2cf3d2){var _0x5abbdb=typeof _0x119784['offset']==='undefined'&&typeof _0x119784['limit']===_0x4c7f('0x1c');var _0xe9ce2d=_0x2cf3d2[_0x4c7f('0x1d')];var _0x481061=_0x5abbdb?0x0:_0x119784[_0x4c7f('0x1e')];var _0x353436=_0x5abbdb?_0x2cf3d2[_0x4c7f('0x1d')]:_0x119784[_0x4c7f('0x1e')]+_0x119784[_0x4c7f('0x1f')];var _0x3bb719;if(_0x353436>=_0xe9ce2d){_0x353436=_0xe9ce2d;_0x3bb719=0xc8;}else{_0x3bb719=0xce;}_0x44287f[_0x4c7f('0x19')](_0x3bb719);return _0x44287f['set'](_0x4c7f('0x20'),_0x481061+'-'+_0x353436+'/'+_0xe9ce2d)[_0x4c7f('0x1b')](_0x2cf3d2);}return null;};}function patchUpdates(_0x5d5965){return function(_0x52058a){try{jsonpatch['apply'](_0x52058a,_0x5d5965,!![]);}catch(_0x61fb58){return BPromise['reject'](_0x61fb58);}return _0x52058a[_0x4c7f('0x21')]();};}function saveUpdates(_0x3bb6f4,_0x13c458){return function(_0x4de074){if(_0x4de074){return _0x4de074['update'](_0x3bb6f4)[_0x4c7f('0x22')](function(_0xe41f0b){return _0xe41f0b;});}return null;};}function removeEntity(_0x242ebf,_0x53dd7e){return function(_0x2ed65d){if(_0x2ed65d){return _0x2ed65d['destroy']()[_0x4c7f('0x22')](function(){_0x242ebf['status'](0xcc)[_0x4c7f('0x1a')]();});}};}function handleEntityNotFound(_0x2608a9,_0x4a5a66){return function(_0x1b07b2){if(!_0x1b07b2){_0x2608a9[_0x4c7f('0x18')](0x194);}return _0x1b07b2;};}function handleError(_0x26ce0f,_0x544fdd){_0x544fdd=_0x544fdd||0x1f4;return function(_0x1172e8){logger[_0x4c7f('0x23')](_0x1172e8[_0x4c7f('0x24')]);if(_0x1172e8[_0x4c7f('0x25')]){delete _0x1172e8[_0x4c7f('0x25')];}_0x26ce0f[_0x4c7f('0x19')](_0x544fdd)['send'](_0x1172e8);};}exports['index']=function(_0x31f5c7,_0x4974fd){var _0x3c4090={},_0x316e2e={},_0x2a5727={'count':0x0,'rows':[]};var _0x1bb76a=_[_0x4c7f('0x26')](db[_0x4c7f('0x27')][_0x4c7f('0x28')],function(_0x1b267e){return{'name':_0x1b267e[_0x4c7f('0x29')],'type':_0x1b267e[_0x4c7f('0x2a')][_0x4c7f('0x2b')]};});_0x316e2e[_0x4c7f('0x2c')]=_[_0x4c7f('0x2d')](_[_0x4c7f('0x26')](_0x1bb76a,'name'),[_0x4c7f('0x25')]);_0x316e2e['query']=_[_0x4c7f('0x2e')](_0x31f5c7[_0x4c7f('0x2f')]);_0x316e2e[_0x4c7f('0x30')]=_[_0x4c7f('0x31')](_0x316e2e['model'],_0x316e2e['query']);_0x3c4090['attributes']=_[_0x4c7f('0x31')](_0x316e2e['model'],qs[_0x4c7f('0x32')](_0x31f5c7['query'][_0x4c7f('0x32')]));_0x3c4090[_0x4c7f('0x33')]=_0x3c4090[_0x4c7f('0x33')]['length']?_0x3c4090[_0x4c7f('0x33')]:_0x316e2e[_0x4c7f('0x2c')];if(!_0x31f5c7[_0x4c7f('0x2f')][_0x4c7f('0x34')](_0x4c7f('0x35'))){_0x3c4090['limit']=qs[_0x4c7f('0x1f')](_0x31f5c7[_0x4c7f('0x2f')][_0x4c7f('0x1f')]);_0x3c4090[_0x4c7f('0x1e')]=qs[_0x4c7f('0x1e')](_0x31f5c7['query']['offset']);}_0x3c4090['order']=qs[_0x4c7f('0x36')](_0x31f5c7[_0x4c7f('0x2f')]['sort']);_0x3c4090['where']=qs[_0x4c7f('0x30')](_['pick'](_0x31f5c7[_0x4c7f('0x2f')],_0x316e2e['filters']),_0x1bb76a);if(_0x31f5c7[_0x4c7f('0x2f')][_0x4c7f('0x37')]){_0x3c4090[_0x4c7f('0x38')]=_[_0x4c7f('0x39')](_0x3c4090[_0x4c7f('0x38')],{'$or':_['map'](_0x1bb76a,function(_0x320fb1){if(_0x320fb1[_0x4c7f('0x2a')]!==_0x4c7f('0x3a')){var _0x31693a={};_0x31693a[_0x320fb1[_0x4c7f('0x25')]]={'$like':'%'+_0x31f5c7[_0x4c7f('0x2f')]['filter']+'%'};return _0x31693a;}})});}_0x3c4090=_[_0x4c7f('0x39')]({},_0x3c4090,_0x31f5c7[_0x4c7f('0x3b')]);var _0x2bc547={'where':_0x3c4090[_0x4c7f('0x38')]};return db[_0x4c7f('0x27')][_0x4c7f('0x1d')](_0x2bc547)[_0x4c7f('0x22')](function(_0x5e180c){_0x2a5727[_0x4c7f('0x1d')]=_0x5e180c;if(_0x31f5c7['query'][_0x4c7f('0x3c')]){_0x3c4090[_0x4c7f('0x3d')]=[{'all':!![]}];}return db[_0x4c7f('0x27')]['findAll'](_0x3c4090);})[_0x4c7f('0x22')](function(_0x49d23b){_0x2a5727['rows']=_0x49d23b;return _0x2a5727;})['then'](respondWithFilteredResult(_0x4974fd,_0x3c4090))[_0x4c7f('0x3e')](handleError(_0x4974fd,null));};exports[_0x4c7f('0x3f')]=function(_0x1d7535,_0x42bb5e){var _0x11837c={'raw':!![],'where':{'id':_0x1d7535[_0x4c7f('0x40')]['id']}},_0x2cade6={};_0x2cade6[_0x4c7f('0x2c')]=_[_0x4c7f('0x2e')](db[_0x4c7f('0x27')][_0x4c7f('0x28')]);_0x2cade6[_0x4c7f('0x2f')]=_[_0x4c7f('0x2e')](_0x1d7535[_0x4c7f('0x2f')]);_0x2cade6[_0x4c7f('0x30')]=_[_0x4c7f('0x31')](_0x2cade6[_0x4c7f('0x2c')],_0x2cade6[_0x4c7f('0x2f')]);_0x11837c[_0x4c7f('0x33')]=_[_0x4c7f('0x31')](_0x2cade6[_0x4c7f('0x2c')],qs[_0x4c7f('0x32')](_0x1d7535[_0x4c7f('0x2f')][_0x4c7f('0x32')]));_0x11837c['attributes']=_0x11837c['attributes']['length']?_0x11837c[_0x4c7f('0x33')]:_0x2cade6[_0x4c7f('0x2c')];if(_0x1d7535[_0x4c7f('0x2f')][_0x4c7f('0x3c')]){_0x11837c[_0x4c7f('0x3d')]=[{'all':!![]}];}_0x11837c=_['merge']({},_0x11837c,_0x1d7535[_0x4c7f('0x3b')]);return db[_0x4c7f('0x27')][_0x4c7f('0x41')](_0x11837c)[_0x4c7f('0x22')](handleEntityNotFound(_0x42bb5e,null))[_0x4c7f('0x22')](respondWithResult(_0x42bb5e,null))['catch'](handleError(_0x42bb5e,null));};exports['update']=function(_0x404cf5,_0x50ca38){if(_0x404cf5[_0x4c7f('0x42')]['id']){delete _0x404cf5[_0x4c7f('0x42')]['id'];}return db[_0x4c7f('0x27')][_0x4c7f('0x41')]({'where':{'id':_0x404cf5['params']['id']}})['then'](handleEntityNotFound(_0x50ca38,null))[_0x4c7f('0x22')](saveUpdates(_0x404cf5[_0x4c7f('0x42')],null))[_0x4c7f('0x22')](respondWithResult(_0x50ca38,null))[_0x4c7f('0x3e')](handleError(_0x50ca38,null));};exports['destroy']=function(_0x43831e,_0xbe6ead){return db[_0x4c7f('0x27')][_0x4c7f('0x41')]({'where':{'id':_0x43831e[_0x4c7f('0x40')]['id']}})[_0x4c7f('0x22')](handleEntityNotFound(_0xbe6ead,null))[_0x4c7f('0x22')](removeEntity(_0xbe6ead,null))[_0x4c7f('0x3e')](handleError(_0xbe6ead,null));};exports[_0x4c7f('0x43')]=function(_0x234cda,_0x45e55a){var _0x4187c2;return db[_0x4c7f('0x44')][_0x4c7f('0x45')](function(_0x349888){return db['CmCustomField'][_0x4c7f('0x43')](_0x234cda['body'],{'transaction':_0x349888})[_0x4c7f('0x22')](function(_0x3c9556){_0x4187c2=_0x3c9556;var _0x6253cd={'type':db[_0x4c7f('0x46')][_0x4c7f('0x47')],'transaction':_0x349888};switch(_0x234cda['body']['type']){case _0x4c7f('0x48'):_0x6253cd[_0x4c7f('0x2a')]=db[_0x4c7f('0x46')][_0x4c7f('0x47')];break;case _0x4c7f('0x49'):_0x6253cd['type']=db[_0x4c7f('0x46')][_0x4c7f('0x4a')];break;case _0x4c7f('0x4b'):_0x6253cd['type']=db[_0x4c7f('0x46')][_0x4c7f('0x4c')];_0x6253cd[_0x4c7f('0x4d')]=![];break;default:}return db[_0x4c7f('0x44')][_0x4c7f('0x4e')][_0x4c7f('0x4f')](_0x4c7f('0x50'),util[_0x4c7f('0x51')]('cf_%d',_0x4187c2['id']),_0x6253cd);})['then'](function(){return _0x4187c2;});})[_0x4c7f('0x22')](respondWithResult(_0x45e55a,0xc9))[_0x4c7f('0x3e')](handleError(_0x45e55a,null));}; \ No newline at end of file +var _0x27cd=['bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','index','map','CmCustomField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','length','find','body','params','destroy','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x27cd,0x108));var _0xd27c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x27cd[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0xd27c('0x0'));var rimraf=require(_0xd27c('0x1'));var zipdir=require(_0xd27c('0x2'));var jsonpatch=require(_0xd27c('0x3'));var rp=require(_0xd27c('0x4'));var moment=require(_0xd27c('0x5'));var BPromise=require(_0xd27c('0x6'));var Mustache=require('mustache');var util=require(_0xd27c('0x7'));var path=require(_0xd27c('0x8'));var sox=require(_0xd27c('0x9'));var csv=require(_0xd27c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd27c('0xb'));var _=require(_0xd27c('0xc'));var squel=require(_0xd27c('0xd'));var crypto=require(_0xd27c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd27c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd27c('0x10'));var Papa=require(_0xd27c('0x11'));var Redis=require(_0xd27c('0x12'));var authService=require(_0xd27c('0x13'));var qs=require(_0xd27c('0x14'));var as=require(_0xd27c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd27c('0x16'))(_0xd27c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd27c('0x18'));var db=require(_0xd27c('0x19'))['db'];function respondWithStatusCode(_0x7b638c,_0x26f5d6){_0x26f5d6=_0x26f5d6||0xcc;return function(_0x52cd6c){if(_0x52cd6c){return _0x7b638c[_0xd27c('0x1a')](_0x26f5d6);}return _0x7b638c[_0xd27c('0x1b')](_0x26f5d6)['end']();};}function respondWithResult(_0x2f7ceb,_0x3b8329){_0x3b8329=_0x3b8329||0xc8;return function(_0x4a0edd){if(_0x4a0edd){return _0x2f7ceb[_0xd27c('0x1b')](_0x3b8329)[_0xd27c('0x1c')](_0x4a0edd);}};}function respondWithFilteredResult(_0x472b81,_0x2212e6){return function(_0x5d1bd4){if(_0x5d1bd4){var _0x3753ae=typeof _0x2212e6[_0xd27c('0x1d')]===_0xd27c('0x1e')&&typeof _0x2212e6[_0xd27c('0x1f')]===_0xd27c('0x1e');var _0x2d9ab8=_0x5d1bd4[_0xd27c('0x20')];var _0x51a9d0=_0x3753ae?0x0:_0x2212e6['offset'];var _0x4c9f80=_0x3753ae?_0x5d1bd4[_0xd27c('0x20')]:_0x2212e6[_0xd27c('0x1d')]+_0x2212e6['limit'];var _0x2cf471;if(_0x4c9f80>=_0x2d9ab8){_0x4c9f80=_0x2d9ab8;_0x2cf471=0xc8;}else{_0x2cf471=0xce;}_0x472b81[_0xd27c('0x1b')](_0x2cf471);return _0x472b81[_0xd27c('0x21')]('Content-Range',_0x51a9d0+'-'+_0x4c9f80+'/'+_0x2d9ab8)['json'](_0x5d1bd4);}return null;};}function patchUpdates(_0x5a4cf9){return function(_0x5c6aa0){try{jsonpatch[_0xd27c('0x22')](_0x5c6aa0,_0x5a4cf9,!![]);}catch(_0xa9874e){return BPromise[_0xd27c('0x23')](_0xa9874e);}return _0x5c6aa0[_0xd27c('0x24')]();};}function saveUpdates(_0xb1f801,_0x268c12){return function(_0x1be342){if(_0x1be342){return _0x1be342[_0xd27c('0x25')](_0xb1f801)[_0xd27c('0x26')](function(_0x19114a){return _0x19114a;});}return null;};}function removeEntity(_0x4351bd,_0x231867){return function(_0x394b68){if(_0x394b68){return _0x394b68['destroy']()[_0xd27c('0x26')](function(){_0x4351bd[_0xd27c('0x1b')](0xcc)[_0xd27c('0x27')]();});}};}function handleEntityNotFound(_0x572168,_0x382d23){return function(_0x35667d){if(!_0x35667d){_0x572168[_0xd27c('0x1a')](0x194);}return _0x35667d;};}function handleError(_0x10491f,_0x4d99a5){_0x4d99a5=_0x4d99a5||0x1f4;return function(_0x26f916){logger[_0xd27c('0x28')](_0x26f916[_0xd27c('0x29')]);if(_0x26f916[_0xd27c('0x2a')]){delete _0x26f916['name'];}_0x10491f[_0xd27c('0x1b')](_0x4d99a5)['send'](_0x26f916);};}exports[_0xd27c('0x2b')]=function(_0x3526c8,_0x4faef3){var _0x5995c5={},_0x155707={},_0x510b45={'count':0x0,'rows':[]};var _0x1ddbf3=_[_0xd27c('0x2c')](db[_0xd27c('0x2d')]['rawAttributes'],function(_0x5381cd){return{'name':_0x5381cd[_0xd27c('0x2e')],'type':_0x5381cd[_0xd27c('0x2f')][_0xd27c('0x30')]};});_0x155707[_0xd27c('0x31')]=_['differenceBy'](_[_0xd27c('0x2c')](_0x1ddbf3,_0xd27c('0x2a')),['name']);_0x155707[_0xd27c('0x32')]=_[_0xd27c('0x33')](_0x3526c8[_0xd27c('0x32')]);_0x155707[_0xd27c('0x34')]=_[_0xd27c('0x35')](_0x155707['model'],_0x155707[_0xd27c('0x32')]);_0x5995c5[_0xd27c('0x36')]=_[_0xd27c('0x35')](_0x155707[_0xd27c('0x31')],qs[_0xd27c('0x37')](_0x3526c8[_0xd27c('0x32')]['fields']));_0x5995c5[_0xd27c('0x36')]=_0x5995c5['attributes']['length']?_0x5995c5[_0xd27c('0x36')]:_0x155707[_0xd27c('0x31')];if(!_0x3526c8[_0xd27c('0x32')][_0xd27c('0x38')](_0xd27c('0x39'))){_0x5995c5[_0xd27c('0x1f')]=qs['limit'](_0x3526c8['query'][_0xd27c('0x1f')]);_0x5995c5['offset']=qs[_0xd27c('0x1d')](_0x3526c8[_0xd27c('0x32')]['offset']);}_0x5995c5[_0xd27c('0x3a')]=qs['sort'](_0x3526c8[_0xd27c('0x32')]['sort']);_0x5995c5[_0xd27c('0x3b')]=qs[_0xd27c('0x34')](_[_0xd27c('0x3c')](_0x3526c8['query'],_0x155707[_0xd27c('0x34')]),_0x1ddbf3);if(_0x3526c8[_0xd27c('0x32')][_0xd27c('0x3d')]){_0x5995c5[_0xd27c('0x3b')]=_[_0xd27c('0x3e')](_0x5995c5['where'],{'$or':_['map'](_0x1ddbf3,function(_0x88b46b){if(_0x88b46b['type']!==_0xd27c('0x3f')){var _0x560e8a={};_0x560e8a[_0x88b46b['name']]={'$like':'%'+_0x3526c8[_0xd27c('0x32')]['filter']+'%'};return _0x560e8a;}})});}_0x5995c5=_[_0xd27c('0x3e')]({},_0x5995c5,_0x3526c8[_0xd27c('0x40')]);var _0x1165da={'where':_0x5995c5[_0xd27c('0x3b')]};return db[_0xd27c('0x2d')][_0xd27c('0x20')](_0x1165da)['then'](function(_0x2b8585){_0x510b45[_0xd27c('0x20')]=_0x2b8585;if(_0x3526c8[_0xd27c('0x32')][_0xd27c('0x41')]){_0x5995c5[_0xd27c('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0xd27c('0x43')](_0x5995c5);})['then'](function(_0x2b7c9d){_0x510b45['rows']=_0x2b7c9d;return _0x510b45;})[_0xd27c('0x26')](respondWithFilteredResult(_0x4faef3,_0x5995c5))[_0xd27c('0x44')](handleError(_0x4faef3,null));};exports[_0xd27c('0x45')]=function(_0x11e100,_0x142333){var _0x137ab4={'raw':!![],'where':{'id':_0x11e100['params']['id']}},_0x332c8d={};_0x332c8d[_0xd27c('0x31')]=_['keys'](db[_0xd27c('0x2d')][_0xd27c('0x46')]);_0x332c8d[_0xd27c('0x32')]=_['keys'](_0x11e100[_0xd27c('0x32')]);_0x332c8d[_0xd27c('0x34')]=_['intersection'](_0x332c8d[_0xd27c('0x31')],_0x332c8d[_0xd27c('0x32')]);_0x137ab4['attributes']=_[_0xd27c('0x35')](_0x332c8d[_0xd27c('0x31')],qs['fields'](_0x11e100[_0xd27c('0x32')][_0xd27c('0x37')]));_0x137ab4[_0xd27c('0x36')]=_0x137ab4[_0xd27c('0x36')][_0xd27c('0x47')]?_0x137ab4[_0xd27c('0x36')]:_0x332c8d[_0xd27c('0x31')];if(_0x11e100['query'][_0xd27c('0x41')]){_0x137ab4[_0xd27c('0x42')]=[{'all':!![]}];}_0x137ab4=_['merge']({},_0x137ab4,_0x11e100[_0xd27c('0x40')]);return db[_0xd27c('0x2d')][_0xd27c('0x48')](_0x137ab4)[_0xd27c('0x26')](handleEntityNotFound(_0x142333,null))['then'](respondWithResult(_0x142333,null))[_0xd27c('0x44')](handleError(_0x142333,null));};exports[_0xd27c('0x25')]=function(_0x13c29a,_0x191ac0){if(_0x13c29a[_0xd27c('0x49')]['id']){delete _0x13c29a['body']['id'];}return db[_0xd27c('0x2d')]['find']({'where':{'id':_0x13c29a[_0xd27c('0x4a')]['id']}})[_0xd27c('0x26')](handleEntityNotFound(_0x191ac0,null))[_0xd27c('0x26')](saveUpdates(_0x13c29a[_0xd27c('0x49')],null))['then'](respondWithResult(_0x191ac0,null))[_0xd27c('0x44')](handleError(_0x191ac0,null));};exports[_0xd27c('0x4b')]=function(_0x4e5b42,_0x1e39ca){return db[_0xd27c('0x2d')][_0xd27c('0x48')]({'where':{'id':_0x4e5b42['params']['id']}})[_0xd27c('0x26')](handleEntityNotFound(_0x1e39ca,null))[_0xd27c('0x26')](removeEntity(_0x1e39ca,null))[_0xd27c('0x44')](handleError(_0x1e39ca,null));};exports['create']=function(_0x4ce254,_0x2cefbd){var _0x161e5e;return db['sequelize'][_0xd27c('0x4c')](function(_0x44a381){return db[_0xd27c('0x2d')]['create'](_0x4ce254[_0xd27c('0x49')],{'transaction':_0x44a381})['then'](function(_0x19651a){_0x161e5e=_0x19651a;var _0x1f223c={'type':db['Sequelize'][_0xd27c('0x4d')],'transaction':_0x44a381};switch(_0x4ce254['body'][_0xd27c('0x2f')]){case _0xd27c('0x4e'):_0x1f223c['type']=db[_0xd27c('0x4f')][_0xd27c('0x4d')];break;case _0xd27c('0x50'):_0x1f223c[_0xd27c('0x2f')]=db[_0xd27c('0x4f')][_0xd27c('0x51')];break;case _0xd27c('0x52'):_0x1f223c[_0xd27c('0x2f')]=db['Sequelize'][_0xd27c('0x53')];_0x1f223c[_0xd27c('0x54')]=![];break;default:}return db[_0xd27c('0x55')][_0xd27c('0x56')][_0xd27c('0x57')](_0xd27c('0x58'),util['format'](_0xd27c('0x59'),_0x161e5e['id']),_0x1f223c);})[_0xd27c('0x26')](function(){return _0x161e5e;});})[_0xd27c('0x26')](respondWithResult(_0x2cefbd,0xc9))[_0xd27c('0x44')](handleError(_0x2cefbd,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index cac4cfa..3240193 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 _0x3183=['CmCustomField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x2fc48a,_0x3210a0){var _0x5b0f59=function(_0x183685){while(--_0x183685){_0x2fc48a['push'](_0x2fc48a['shift']());}};_0x5b0f59(++_0x3210a0);}(_0x3183,0x1e2));var _0x3318=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x3183[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require(_0x3318('0x0'));var util=require(_0x3318('0x1'));var logger=require('../../config/logger')(_0x3318('0x2'));var moment=require(_0x3318('0x3'));var BPromise=require(_0x3318('0x4'));var rp=require(_0x3318('0x5'));var fs=require('fs');var path=require(_0x3318('0x6'));var rimraf=require(_0x3318('0x7'));var config=require(_0x3318('0x8'));var attributes=require(_0x3318('0x9'));module[_0x3318('0xa')]=function(_0x18e36e,_0x5c5715){return _0x18e36e[_0x3318('0xb')](_0x3318('0xc'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31a6=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util'];(function(_0x2b92a5,_0x242e46){var _0x5b5c60=function(_0x1e5b9e){while(--_0x1e5b9e){_0x2b92a5['push'](_0x2b92a5['shift']());}};_0x5b5c60(++_0x242e46);}(_0x31a6,0x1ba));var _0x631a=function(_0x5a0f2c,_0x17f13c){_0x5a0f2c=_0x5a0f2c-0x0;var _0x269fc5=_0x31a6[_0x5a0f2c];return _0x269fc5;};'use strict';var _=require(_0x631a('0x0'));var util=require(_0x631a('0x1'));var logger=require(_0x631a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x631a('0x3'));var rp=require(_0x631a('0x4'));var fs=require('fs');var path=require(_0x631a('0x5'));var rimraf=require(_0x631a('0x6'));var config=require(_0x631a('0x7'));var attributes=require(_0x631a('0x8'));module[_0x631a('0x9')]=function(_0x22b9ef,_0x588b11){return _0x22b9ef[_0x631a('0xa')](_0x631a('0xb'),attributes,{'tableName':'cm_custom_fields','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 6192f1d..426924f 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 _0x5e6e=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5e6e,0x74));var _0xe5e6=function(_0x39d1c2,_0x170148){_0x39d1c2=_0x39d1c2-0x0;var _0x369078=_0x5e6e[_0x39d1c2];return _0x369078;};'use strict';var _=require(_0xe5e6('0x0'));var util=require(_0xe5e6('0x1'));var moment=require(_0xe5e6('0x2'));var BPromise=require(_0xe5e6('0x3'));var rs=require(_0xe5e6('0x4'));var fs=require('fs');var Redis=require(_0xe5e6('0x5'));var db=require(_0xe5e6('0x6'))['db'];var utils=require(_0xe5e6('0x7'));var logger=require('../../config/logger')(_0xe5e6('0x8'));var config=require(_0xe5e6('0x9'));var jayson=require(_0xe5e6('0xa'));var client=jayson[_0xe5e6('0xb')][_0xe5e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f65ba,_0xe4fce8,_0x27873c){return new BPromise(function(_0x1a0b92,_0x38d98c){return client[_0xe5e6('0xd')](_0x4f65ba,_0x27873c)[_0xe5e6('0xe')](function(_0x5ee22b){logger['info'](_0xe5e6('0xf'),_0xe4fce8,'request\x20sent');logger[_0xe5e6('0x10')](_0xe5e6('0x11'),_0xe4fce8,_0xe5e6('0x12'),JSON[_0xe5e6('0x13')](_0x5ee22b));if(_0x5ee22b['error']){if(_0x5ee22b[_0xe5e6('0x14')][_0xe5e6('0x15')]===0x1f4){logger[_0xe5e6('0x14')](_0xe5e6('0xf'),_0xe4fce8,_0x5ee22b[_0xe5e6('0x14')][_0xe5e6('0x16')]);return _0x38d98c(_0x5ee22b['error'][_0xe5e6('0x16')]);}logger[_0xe5e6('0x14')](_0xe5e6('0xf'),_0xe4fce8,_0x5ee22b['error'][_0xe5e6('0x16')]);return _0x1a0b92(_0x5ee22b[_0xe5e6('0x14')][_0xe5e6('0x16')]);}else{logger['info'](_0xe5e6('0xf'),_0xe4fce8,_0xe5e6('0x12'));_0x1a0b92(_0x5ee22b[_0xe5e6('0x17')]['message']);}})['catch'](function(_0x58beb0){logger[_0xe5e6('0x14')]('CmCustomField,\x20%s,\x20%s',_0xe4fce8,_0x58beb0);_0x38d98c(_0x58beb0);});});} \ No newline at end of file +var _0xb2d5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x4a55b9,_0x39be51){var _0x31c6aa=function(_0x5d8faf){while(--_0x5d8faf){_0x4a55b9['push'](_0x4a55b9['shift']());}};_0x31c6aa(++_0x39be51);}(_0xb2d5,0x1ca));var _0x5b2d=function(_0x2fddad,_0x36cd47){_0x2fddad=_0x2fddad-0x0;var _0x1ec397=_0xb2d5[_0x2fddad];return _0x1ec397;};'use strict';var _=require(_0x5b2d('0x0'));var util=require('util');var moment=require(_0x5b2d('0x1'));var BPromise=require(_0x5b2d('0x2'));var rs=require(_0x5b2d('0x3'));var fs=require('fs');var Redis=require(_0x5b2d('0x4'));var db=require(_0x5b2d('0x5'))['db'];var utils=require(_0x5b2d('0x6'));var logger=require(_0x5b2d('0x7'))(_0x5b2d('0x8'));var config=require(_0x5b2d('0x9'));var jayson=require(_0x5b2d('0xa'));var client=jayson['client'][_0x5b2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13ae91,_0x489f36,_0x42cfa1){return new BPromise(function(_0x590d0b,_0x2eb5a7){return client[_0x5b2d('0xc')](_0x13ae91,_0x42cfa1)['then'](function(_0x475f4d){logger[_0x5b2d('0xd')](_0x5b2d('0xe'),_0x489f36,_0x5b2d('0xf'));logger[_0x5b2d('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x489f36,'request\x20sent',JSON[_0x5b2d('0x11')](_0x475f4d));if(_0x475f4d[_0x5b2d('0x12')]){if(_0x475f4d['error'][_0x5b2d('0x13')]===0x1f4){logger[_0x5b2d('0x12')](_0x5b2d('0xe'),_0x489f36,_0x475f4d[_0x5b2d('0x12')][_0x5b2d('0x14')]);return _0x2eb5a7(_0x475f4d[_0x5b2d('0x12')][_0x5b2d('0x14')]);}logger[_0x5b2d('0x12')](_0x5b2d('0xe'),_0x489f36,_0x475f4d[_0x5b2d('0x12')]['message']);return _0x590d0b(_0x475f4d['error']['message']);}else{logger[_0x5b2d('0xd')](_0x5b2d('0xe'),_0x489f36,'request\x20sent');_0x590d0b(_0x475f4d[_0x5b2d('0x15')][_0x5b2d('0x14')]);}})[_0x5b2d('0x16')](function(_0x3b80d1){logger[_0x5b2d('0x12')]('CmCustomField,\x20%s,\x20%s',_0x489f36,_0x3b80d1);_0x2eb5a7(_0x3b80d1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 33aa39d..2b164d2 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 _0x5aa1=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x2ff55a,_0x2900b3){var _0x107366=function(_0x301b5d){while(--_0x301b5d){_0x2ff55a['push'](_0x2ff55a['shift']());}};_0x107366(++_0x2900b3);}(_0x5aa1,0x158));var _0x15aa=function(_0x1a4b26,_0xbbc926){_0x1a4b26=_0x1a4b26-0x0;var _0x497306=_0x5aa1[_0x1a4b26];return _0x497306;};'use strict';var multer=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var path=require(_0x15aa('0x2'));var timeout=require(_0x15aa('0x3'));var express=require(_0x15aa('0x4'));var router=express['Router']();var fs_extra=require(_0x15aa('0x5'));var auth=require(_0x15aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x15aa('0x7'));var controller=require(_0x15aa('0x8'));router[_0x15aa('0x9')]('/',auth[_0x15aa('0xa')](),controller['index']);router[_0x15aa('0x9')](_0x15aa('0xb'),auth['isAuthenticated'](),controller[_0x15aa('0xc')]);router[_0x15aa('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x15aa('0xe')](_0x15aa('0xb'),auth[_0x15aa('0xa')](),controller[_0x15aa('0xf')]);router['delete'](_0x15aa('0xb'),auth[_0x15aa('0xa')](),controller[_0x15aa('0x10')]);module[_0x15aa('0x11')]=router; \ No newline at end of file +var _0x04e7=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x3df586,_0x4bae96){var _0x51005f=function(_0x1be95b){while(--_0x1be95b){_0x3df586['push'](_0x3df586['shift']());}};_0x51005f(++_0x4bae96);}(_0x04e7,0x121));var _0x704e=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x04e7[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x704e('0x0'));var util=require(_0x704e('0x1'));var path=require(_0x704e('0x2'));var timeout=require(_0x704e('0x3'));var express=require(_0x704e('0x4'));var router=express[_0x704e('0x5')]();var fs_extra=require(_0x704e('0x6'));var auth=require(_0x704e('0x7'));var interaction=require(_0x704e('0x8'));var config=require(_0x704e('0x9'));var controller=require(_0x704e('0xa'));router[_0x704e('0xb')]('/',auth['isAuthenticated'](),controller[_0x704e('0xc')]);router[_0x704e('0xb')](_0x704e('0xd'),auth[_0x704e('0xe')](),controller[_0x704e('0xf')]);router[_0x704e('0x10')]('/',auth[_0x704e('0xe')](),controller[_0x704e('0x11')]);router[_0x704e('0x12')](_0x704e('0xd'),auth[_0x704e('0xe')](),controller[_0x704e('0x13')]);router['delete'](_0x704e('0xd'),auth[_0x704e('0xe')](),controller[_0x704e('0x14')]);module[_0x704e('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 9b00db2..1291303 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 _0xc2bd=['sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment'];(function(_0x24693e,_0x2ba888){var _0x53e672=function(_0x5f6cff){while(--_0x5f6cff){_0x24693e['push'](_0x24693e['shift']());}};_0x53e672(++_0x2ba888);}(_0xc2bd,0xf1));var _0xdc2b=function(_0xf6d425,_0x2c23b8){_0xf6d425=_0xf6d425-0x0;var _0x20531d=_0xc2bd[_0xf6d425];return _0x20531d;};'use strict';var moment=require(_0xdc2b('0x0'));var Sequelize=require(_0xdc2b('0x1'));module[_0xdc2b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xdc2b('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdc2b('0x4')],'defaultValue':moment()[_0xdc2b('0x5')](_0xdc2b('0x6'))},'countbusyretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdc2b('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdc2b('0x4')]},'priority':{'type':Sequelize[_0xdc2b('0x7')](0x2)[_0xdc2b('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdc2b('0x7')],'unique':_0xdc2b('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xdc2b('0xa')},'UserId':{'type':Sequelize[_0xdc2b('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdc2b('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xdc2b('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdc2b('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0xdc2b('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x94c7=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x94c7,0xa4));var _0x794c=function(_0x2c16d1,_0x34b6ba){_0x2c16d1=_0x2c16d1-0x0;var _0x4a39e0=_0x94c7[_0x2c16d1];return _0x4a39e0;};'use strict';var moment=require('moment');var Sequelize=require(_0x794c('0x0'));module[_0x794c('0x1')]={'phone':{'type':Sequelize[_0x794c('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x794c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x794c('0x4')],'defaultValue':moment()[_0x794c('0x5')](_0x794c('0x6'))},'countbusyretry':{'type':Sequelize[_0x794c('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x794c('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x794c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x794c('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x794c('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x794c('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x794c('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x794c('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x794c('0x9')},'UserId':{'type':Sequelize[_0x794c('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x794c('0x7')],'unique':_0x794c('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x794c('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x794c('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x794c('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x794c('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x794c('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x794c('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c912276..72db0a1 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 _0x8a28=['set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','fieldName','model','query','keys','filters','intersection','concat','$or','$gt','$lte','$ne','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','updatedAt','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','literal','DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','dialActive','getPreviewRecall','findOne','recallme','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset'];(function(_0x3c5784,_0x2597ad){var _0x5a6dc1=function(_0x16cbd6){while(--_0x16cbd6){_0x3c5784['push'](_0x3c5784['shift']());}};_0x5a6dc1(++_0x2597ad);}(_0x8a28,0xfd));var _0x88a2=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8a28[_0x5ddb1c];return _0x354adc;};'use strict';var moment=require(_0x88a2('0x0'));var _=require(_0x88a2('0x1'));var qs=require(_0x88a2('0x2'));var logger=require(_0x88a2('0x3'))(_0x88a2('0x4'));var shared=require(_0x88a2('0x5'));var db=require(_0x88a2('0x6'))['db'];function respondWithResult(_0x3fc89d,_0x5d5b92){_0x5d5b92=_0x5d5b92||0xc8;return function(_0x2f482e){if(_0x2f482e){return _0x3fc89d[_0x88a2('0x7')](_0x5d5b92)[_0x88a2('0x8')](_0x2f482e);}};}function respondWithFilteredResult(_0x438e32,_0x29ce92){return function(_0x5cb591){if(_0x5cb591){var _0x1629ea=typeof _0x29ce92['offset']===_0x88a2('0x9')&&typeof _0x29ce92[_0x88a2('0xa')]===_0x88a2('0x9');var _0xdbb322=_0x5cb591[_0x88a2('0xb')];var _0x2d0fce=_0x1629ea?0x0:_0x29ce92[_0x88a2('0xc')];var _0x306a59=_0x1629ea?_0x5cb591[_0x88a2('0xb')]:_0x29ce92['offset']+_0x29ce92['limit'];var _0x854332;if(_0x306a59>=_0xdbb322){_0x306a59=_0xdbb322;_0x854332=0xc8;}else{_0x854332=0xce;}_0x438e32[_0x88a2('0x7')](_0x854332);return _0x438e32[_0x88a2('0xd')](_0x88a2('0xe'),_0x2d0fce+'-'+_0x306a59+'/'+_0xdbb322)[_0x88a2('0x8')](_0x5cb591);}return null;};}function saveUpdates(_0x4887fc,_0x210a52){return function(_0x1a4056){if(_0x1a4056){return _0x1a4056[_0x88a2('0xf')](_0x4887fc)[_0x88a2('0x10')](function(_0x5093c0){return _0x5093c0;});}return null;};}function handleEntityNotFound(_0x923706,_0x407ef0){return function(_0x3b83ce){if(!_0x3b83ce){_0x923706['sendStatus'](0x194);}return _0x3b83ce;};}function handleError(_0x34f19e,_0x207b12){_0x207b12=_0x207b12||0x1f4;return function(_0x462b7b){logger[_0x88a2('0x11')](_0x462b7b[_0x88a2('0x12')]);if(_0x462b7b[_0x88a2('0x13')]){delete _0x462b7b[_0x88a2('0x13')];}_0x34f19e[_0x88a2('0x7')](_0x207b12)[_0x88a2('0x14')](_0x462b7b);};}exports[_0x88a2('0x15')]=function(_0x235b75,_0x3c030e){var _0x188f6a={},_0x29dc1b={},_0x34d34a={'count':0x0,'rows':[]};var _0x162b5f=_[_0x88a2('0x16')](db[_0x88a2('0x17')]['rawAttributes'],function(_0x190aac){return{'name':_0x190aac[_0x88a2('0x18')],'type':_0x190aac['type']['key']};});_0x29dc1b[_0x88a2('0x19')]=_[_0x88a2('0x16')](_0x162b5f,_0x88a2('0x13'));_0x29dc1b[_0x88a2('0x1a')]=_[_0x88a2('0x1b')](_0x235b75['query']);_0x29dc1b[_0x88a2('0x1c')]=_[_0x88a2('0x1d')](_0x29dc1b[_0x88a2('0x19')],_0x29dc1b[_0x88a2('0x1a')]);_0x29dc1b['filters']=_[_0x88a2('0x1e')](_0x29dc1b['filters'],['$and',_0x88a2('0x1f'),_0x88a2('0x20'),'$gte','$lt',_0x88a2('0x21'),_0x88a2('0x22'),'$eq',_0x88a2('0x23'),_0x88a2('0x24'),_0x88a2('0x25'),_0x88a2('0x26'),'$notIn',_0x88a2('0x27'),'$notLike',_0x88a2('0x28'),_0x88a2('0x29'),_0x88a2('0x27'),'$overlap',_0x88a2('0x2a'),_0x88a2('0x2b'),'$any']);_0x188f6a[_0x88a2('0x2c')]=_[_0x88a2('0x1d')](_0x29dc1b['model'],qs['fields'](_0x235b75[_0x88a2('0x1a')][_0x88a2('0x2d')]));_0x188f6a[_0x88a2('0x2c')]=_0x188f6a[_0x88a2('0x2c')][_0x88a2('0x2e')]?_0x188f6a[_0x88a2('0x2c')]:_0x29dc1b['model'];if(!_0x235b75[_0x88a2('0x1a')][_0x88a2('0x2f')](_0x88a2('0x30'))){_0x188f6a[_0x88a2('0xa')]=qs[_0x88a2('0xa')](_0x235b75[_0x88a2('0x1a')][_0x88a2('0xa')]);_0x188f6a[_0x88a2('0xc')]=qs[_0x88a2('0xc')](_0x235b75[_0x88a2('0x1a')]['offset']);}_0x188f6a['order']=qs[_0x88a2('0x31')](_0x235b75[_0x88a2('0x1a')][_0x88a2('0x31')]);_0x188f6a['where']=qs[_0x88a2('0x1c')](_[_0x88a2('0x32')](_0x235b75['query'],_0x29dc1b[_0x88a2('0x1c')]),_0x162b5f);if(_0x235b75[_0x88a2('0x1a')][_0x88a2('0x33')]){_0x188f6a['where']=_['merge'](_0x188f6a[_0x88a2('0x34')],{'$or':_[_0x88a2('0x16')](_0x162b5f,function(_0x4cb19f){if(_0x4cb19f[_0x88a2('0x35')]!==_0x88a2('0x36')){var _0x327a80={};_0x327a80[_0x4cb19f[_0x88a2('0x13')]]={'$like':'%'+_0x235b75[_0x88a2('0x1a')][_0x88a2('0x33')]+'%'};return _0x327a80;}})});}_0x188f6a=_[_0x88a2('0x37')]({},_0x188f6a,_0x235b75[_0x88a2('0x38')]);var _0x4fdacc={'where':_0x188f6a[_0x88a2('0x34')]};return db[_0x88a2('0x17')]['count'](_0x4fdacc)[_0x88a2('0x10')](function(_0x38cc76){_0x34d34a[_0x88a2('0xb')]=_0x38cc76;if(_0x235b75[_0x88a2('0x1a')][_0x88a2('0x39')]){_0x188f6a[_0x88a2('0x3a')]=[{'all':!![]}];}return db[_0x88a2('0x17')][_0x88a2('0x3b')](_0x188f6a);})[_0x88a2('0x10')](function(_0x1fa0c6){_0x34d34a[_0x88a2('0x3c')]=_0x1fa0c6;return _0x34d34a;})[_0x88a2('0x10')](respondWithFilteredResult(_0x3c030e,_0x188f6a))[_0x88a2('0x3d')](handleError(_0x3c030e,null));};exports[_0x88a2('0x3e')]=function(_0x42b8f7,_0xb21338){var _0x1496d9={'raw':!![],'where':{'id':_0x42b8f7[_0x88a2('0x3f')]['id']}},_0x23cdc2={};_0x23cdc2[_0x88a2('0x19')]=_[_0x88a2('0x1b')](db[_0x88a2('0x17')][_0x88a2('0x40')]);_0x23cdc2[_0x88a2('0x1a')]=_[_0x88a2('0x1b')](_0x42b8f7['query']);_0x23cdc2['filters']=_[_0x88a2('0x1d')](_0x23cdc2[_0x88a2('0x19')],_0x23cdc2['query']);_0x1496d9[_0x88a2('0x2c')]=_[_0x88a2('0x1d')](_0x23cdc2[_0x88a2('0x19')],qs[_0x88a2('0x2d')](_0x42b8f7[_0x88a2('0x1a')][_0x88a2('0x2d')]));_0x1496d9['attributes']=_0x1496d9[_0x88a2('0x2c')][_0x88a2('0x2e')]?_0x1496d9[_0x88a2('0x2c')]:_0x23cdc2['model'];if(_0x42b8f7[_0x88a2('0x1a')][_0x88a2('0x39')]){_0x1496d9[_0x88a2('0x3a')]=[{'all':!![]}];}_0x1496d9=_[_0x88a2('0x37')]({},_0x1496d9,_0x42b8f7['options']);return db[_0x88a2('0x17')][_0x88a2('0x41')](_0x1496d9)[_0x88a2('0x10')](handleEntityNotFound(_0xb21338,null))[_0x88a2('0x10')](respondWithResult(_0xb21338,null))[_0x88a2('0x3d')](handleError(_0xb21338,null));};exports[_0x88a2('0x42')]=function(_0x682411,_0x363475){return db[_0x88a2('0x17')][_0x88a2('0x42')](_0x682411[_0x88a2('0x43')],{})[_0x88a2('0x10')](respondWithResult(_0x363475,0xc9))[_0x88a2('0x3d')](handleError(_0x363475,null));};exports[_0x88a2('0xf')]=function(_0xe8d957,_0x9ef5ac){if(_0xe8d957[_0x88a2('0x43')]['id']){delete _0xe8d957[_0x88a2('0x43')]['id'];}return db[_0x88a2('0x17')][_0x88a2('0x41')]({'where':{'id':_0xe8d957['params']['id']}})[_0x88a2('0x10')](handleEntityNotFound(_0x9ef5ac,null))['then'](saveUpdates(_0xe8d957[_0x88a2('0x43')],null))['then'](respondWithResult(_0x9ef5ac,null))[_0x88a2('0x3d')](handleError(_0x9ef5ac,null));};exports[_0x88a2('0x44')]=function(_0x1c5e6b,_0x37319d){return db[_0x88a2('0x17')][_0x88a2('0x44')]()[_0x88a2('0x10')](respondWithResult(_0x37319d,null))[_0x88a2('0x3d')](handleError(_0x37319d,null));};exports['destroy']=function(_0x1d773c,_0x1cc256){var _0x5b1f66;var _0x341e08=_0x1d773c['params']['id'];return db[_0x88a2('0x17')]['find']({'where':{'id':_0x1d773c[_0x88a2('0x3f')]['id']}})[_0x88a2('0x10')](handleEntityNotFound(_0x1cc256,null))[_0x88a2('0x10')](function(_0x18dae2){if(_0x18dae2){return _0x18dae2[_0x88a2('0x45')]()[_0x88a2('0x10')](function(_0x39bffe){return _0x39bffe;});}})[_0x88a2('0x10')](function(_0x2cf43b){_0x5b1f66=_0x2cf43b;if(_0x2cf43b){if(_0x2cf43b[_0x88a2('0x46')]||_0x2cf43b[_0x88a2('0x47')]){return db[_0x2cf43b[_0x88a2('0x46')]?'VoiceQueue':'Campaign'][_0x88a2('0x41')]({'where':{'id':_0x2cf43b[_0x88a2('0x46')]?_0x2cf43b[_0x88a2('0x46')]:_0x2cf43b[_0x88a2('0x47')]},'attributes':['id',_0x88a2('0x13')],'raw':!![]});}}})['then'](function(_0x2bc03d){var _0x4793ee={};if(_0x2bc03d){_['merge'](_0x4793ee,_[_0x88a2('0x48')](_0x5b1f66[_0x88a2('0x49')],['createdAt',_0x88a2('0x4a'),'id']));_0x4793ee['state']=0x15;_0x4793ee[_0x88a2('0x4b')]=_0x88a2('0x4c');_0x4793ee[_0x88a2('0x4d')]=_0x2bc03d[_0x88a2('0x13')];_0x4793ee[_0x88a2('0x4e')]=_0x1d773c[_0x88a2('0x4f')]['name'];_0x4793ee[_0x88a2('0x50')]=_0x1d773c[_0x88a2('0x4f')]['id'];_0x4793ee[_0x88a2('0x4c')]=!![];_0x4793ee['deletedat']=moment()[_0x88a2('0x51')](_0x88a2('0x52'));_0x4793ee['calleridnum']=_0x5b1f66[_0x88a2('0x53')];_0x4793ee[_0x88a2('0x54')]=_0x5b1f66['VoiceQueueId']?'queue':_0x88a2('0x55');return db[_0x88a2('0x56')]['find']({'where':{'id':_0x4793ee[_0x88a2('0x57')]},'attributes':[_0x88a2('0x58'),_0x88a2('0x59')]})[_0x88a2('0x10')](function(_0xa62fec){if(!_[_0x88a2('0x5a')](_0x1cc256)&&!_[_0x88a2('0x5a')](_0xa62fec['firstName'])){_0x4793ee[_0x88a2('0x5b')]=_0xa62fec[_0x88a2('0x58')];if(!_[_0x88a2('0x5a')](_0xa62fec['lastName'])){_0x4793ee['calleridname']+='\x20'+_0xa62fec['lastName'];}}})[_0x88a2('0x5c')](function(){return db[_0x88a2('0x5d')][_0x88a2('0x42')](_0x4793ee);});}})['then'](function(_0x3aba26){return db[_0x88a2('0x5e')][_0x88a2('0x45')]({'where':{'CmHopperId':_0x341e08}});})[_0x88a2('0x10')](function(){return _0x1cc256[_0x88a2('0x7')](0xcc)[_0x88a2('0x5f')]();})['catch'](handleError(_0x1cc256,null));};exports['getPreview']=function(_0x29371a,_0x5599d1){var _0x4d4411=[];return db[_0x88a2('0x56')][_0x88a2('0x44')]()[_0x88a2('0x10')](function(_0x291f1f){_0x4d4411=_[_0x88a2('0x1b')](_0x291f1f);return _0x29371a['user']['getVoiceQueues']({'where':{'type':_0x88a2('0x60'),'dialActive':!![],'dialMethod':_0x88a2('0x61')},'attributes':['id',_0x88a2('0x62'),_0x88a2('0x63')],'raw':!![]});})[_0x88a2('0x10')](function(_0xb99aaa){if(_0xb99aaa&&_0xb99aaa[_0x88a2('0x2e')]){return db[_0x88a2('0x64')][_0x88a2('0x65')](function(_0x485489){var _0x541172={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x88a2('0x51')](_0x88a2('0x52'))},'VoiceQueueId':{'$in':_['map'](_0xb99aaa,'id')},'$or':[{'UserId':null},{'UserId':_0x29371a['user']['id']}]};var _0x5e538c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb99aaa)[_0x88a2('0x33')]([_0x88a2('0x63'),0x0])[_0x88a2('0x16')]('id')[_0x88a2('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x29371a['user']['id']}]};var _0x203e60={'$or':[_0x541172,_0x5e538c]};var _0x3b76bf=[];if(_0x29371a[_0x88a2('0x43')][_0x88a2('0x67')]&&_0x29371a[_0x88a2('0x43')][_0x88a2('0x67')]===_0x88a2('0x68')){if(!_['isEmpty'](_0x29371a['body'][_0x88a2('0x69')])){_0x203e60['id']={'$in':_0x29371a['body']['hopperIds']};}_0x3b76bf=[[_0x88a2('0x6a'),_0x88a2('0x6b')],[_0x88a2('0x6c'),_0xb99aaa[0x0][_0x88a2('0x62')]===_0x88a2('0x6b')?'DESC':_0x88a2('0x6b')],db['sequelize'][_0x88a2('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x88a2('0x6e')]];}else{if(!_['isEmpty'](_0x29371a[_0x88a2('0x43')][_0x88a2('0x69')])){_0x203e60['id']={'$notIn':_0x29371a[_0x88a2('0x43')][_0x88a2('0x69')]};}_0x3b76bf=[[_0x88a2('0x6a'),_0x88a2('0x6e')],[_0x88a2('0x6c'),_0xb99aaa[0x0][_0x88a2('0x62')]],db[_0x88a2('0x64')][_0x88a2('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x88a2('0x6b')]];}return db[_0x88a2('0x17')]['findOne']({'attributes':['id',_0x88a2('0x6f'),'phone','recallme'],'where':_0x203e60,'order':_0x3b76bf,'transaction':_0x485489,'lock':_0x485489[_0x88a2('0x70')][_0x88a2('0x71')],'include':[{'model':db[_0x88a2('0x56')],'as':_0x88a2('0x72'),'attributes':_0x4d4411,'include':[{'model':db[_0x88a2('0x73')],'as':_0x88a2('0x74'),'attributes':['id','name']}]},{'model':db[_0x88a2('0x75')],'as':_0x88a2('0x76'),'attributes':['id',_0x88a2('0x13')]},{'model':db[_0x88a2('0x77')],'as':'Queue','attributes':['id','name',_0x88a2('0x78')]}]})[_0x88a2('0x10')](function(_0x585409){if(_0x585409){return _0x585409[_0x88a2('0xf')]({'UserId':_0x29371a[_0x88a2('0x4f')]['id']},{'transaction':_0x485489});}});});}})[_0x88a2('0x10')](handleEntityNotFound(_0x5599d1,null))[_0x88a2('0x10')](respondWithResult(_0x5599d1,null))['catch'](handleError(_0x5599d1,null));};exports[_0x88a2('0x79')]=function(_0x14c831,_0x1db40c,_0x1350b2){var _0x54b65d=[];var _0x3c8f98=_0x14c831['params']['id'];var _0x149f0e=_0x14c831[_0x88a2('0x4f')]['id'];return db[_0x88a2('0x56')]['describe']()[_0x88a2('0x10')](function(_0x381ea4){_0x54b65d=_['keys'](_0x381ea4);return db[_0x88a2('0x64')][_0x88a2('0x65')](function(_0x1bf412){const _0xf9f243={'id':_0x3c8f98};return db[_0x88a2('0x17')][_0x88a2('0x7a')]({'attributes':['id',_0x88a2('0x6f'),_0x88a2('0x7b')],'where':_0xf9f243,'transaction':_0x1bf412,'lock':_0x1bf412['LOCK'][_0x88a2('0x71')],'include':[{'model':db[_0x88a2('0x56')],'as':_0x88a2('0x72'),'attributes':_0x54b65d,'include':[{'model':db[_0x88a2('0x73')],'as':'Company','attributes':['id',_0x88a2('0x13')]}]},{'model':db[_0x88a2('0x75')],'as':_0x88a2('0x76'),'attributes':['id',_0x88a2('0x13')]},{'model':db[_0x88a2('0x77')],'as':_0x88a2('0x7c'),'attributes':['id',_0x88a2('0x13'),_0x88a2('0x78')]}]})[_0x88a2('0x10')](function(_0xcb1375){if(_0xcb1375){return _0xcb1375['update']({'UserId':_0x149f0e},{'transaction':_0x1bf412});}});});})[_0x88a2('0x10')](handleEntityNotFound(_0x1db40c,null))[_0x88a2('0x10')](respondWithResult(_0x1db40c,null))[_0x88a2('0x3d')](handleError(_0x1db40c,null));};exports[_0x88a2('0x7d')]=function(_0x9d26d1,_0xc3c2f2){return _0x9d26d1[_0x88a2('0x4f')]['getVoiceQueues']({'where':{'type':_0x88a2('0x60'),'dialActive':!![],'dialMethod':_0x88a2('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x1f1824){if(_0x1f1824&&_0x1f1824[_0x88a2('0x2e')]){return db['CmHopper'][_0x88a2('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x88a2('0x51')](_0x88a2('0x52'))},'VoiceQueueId':{'$in':_[_0x88a2('0x16')](_0x1f1824,'id')},'$or':[{'UserId':null},{'UserId':_0x9d26d1[_0x88a2('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x5abf8c){if(!_['isNil'](_0x5abf8c)&&_[_0x88a2('0x7e')](_0x5abf8c)){return _0xc3c2f2[_0x88a2('0x7')](0xc8)[_0x88a2('0x8')]({'contacts':_0x5abf8c});}else{logger[_0x88a2('0x11')](_0x88a2('0x7f'),_0x88a2('0x7d'),0x194,_0x88a2('0x80'));_0xc3c2f2['sendStatus'](0x194);}})[_0x88a2('0x3d')](handleError(_0xc3c2f2,null));};exports['getTimezones']=function(_0x912355,_0x5abbd9){var _0x1430ef=shared['timezones'];var _0x526b5a=[];_[_0x88a2('0x16')](_0x1430ef,function(_0x4d9afd){_0x526b5a[_0x88a2('0x81')]({'id':_0x4d9afd['name'],'name':_0x4d9afd[_0x88a2('0x13')],'utcOffset':_0x4d9afd[_0x88a2('0x82')]});});return _0x5abbd9[_0x88a2('0x7')](0xc8)['json']({'tz':_0x526b5a});};exports[_0x88a2('0x83')]=function(_0x4612b5,_0x5212aa){var _0x392317=shared[_0x88a2('0x84')];var _0x24c54a={};if(!_[_0x88a2('0x5a')](_0x392317[_0x4612b5['body']['id']]))_0x24c54a=_0x392317[_0x4612b5[_0x88a2('0x43')]['id']];return _0x5212aa[_0x88a2('0x7')](0xc8)['json'](_0x24c54a);}; \ No newline at end of file +var _0x8ece=['index','CmHopper','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','statedesc','deleted','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','UPDATE','Contact','CmCompany','Company','List','VoiceQueue','dialActive','getPreviewRecall','findOne','recallme','LOCK','CmList','getOpenContacts','isNumber','error','entity\x20not\x20found','getTimezones','timezones','push','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','sendStatus','stack','name','send'];(function(_0x46c949,_0xeb8d6e){var _0x3c6d98=function(_0x233f0d){while(--_0x233f0d){_0x46c949['push'](_0x46c949['shift']());}};_0x3c6d98(++_0xeb8d6e);}(_0x8ece,0x195));var _0xe8ec=function(_0x181333,_0x2ad931){_0x181333=_0x181333-0x0;var _0x2ea180=_0x8ece[_0x181333];return _0x2ea180;};'use strict';var moment=require(_0xe8ec('0x0'));var _=require(_0xe8ec('0x1'));var qs=require(_0xe8ec('0x2'));var logger=require(_0xe8ec('0x3'))('api');var shared=require('../../config/environment');var db=require(_0xe8ec('0x4'))['db'];function respondWithResult(_0x30c05a,_0x5047e7){_0x5047e7=_0x5047e7||0xc8;return function(_0x433734){if(_0x433734){return _0x30c05a[_0xe8ec('0x5')](_0x5047e7)['json'](_0x433734);}};}function respondWithFilteredResult(_0x346577,_0x23fa35){return function(_0x64ed4c){if(_0x64ed4c){var _0x234b67=typeof _0x23fa35[_0xe8ec('0x6')]===_0xe8ec('0x7')&&typeof _0x23fa35[_0xe8ec('0x8')]==='undefined';var _0x44d128=_0x64ed4c['count'];var _0x1345e0=_0x234b67?0x0:_0x23fa35['offset'];var _0x1b0a84=_0x234b67?_0x64ed4c[_0xe8ec('0x9')]:_0x23fa35[_0xe8ec('0x6')]+_0x23fa35[_0xe8ec('0x8')];var _0x235e18;if(_0x1b0a84>=_0x44d128){_0x1b0a84=_0x44d128;_0x235e18=0xc8;}else{_0x235e18=0xce;}_0x346577[_0xe8ec('0x5')](_0x235e18);return _0x346577[_0xe8ec('0xa')](_0xe8ec('0xb'),_0x1345e0+'-'+_0x1b0a84+'/'+_0x44d128)[_0xe8ec('0xc')](_0x64ed4c);}return null;};}function saveUpdates(_0x69a424,_0xf72aa7){return function(_0x153203){if(_0x153203){return _0x153203[_0xe8ec('0xd')](_0x69a424)['then'](function(_0x15de29){return _0x15de29;});}return null;};}function handleEntityNotFound(_0x431723,_0x2e5a88){return function(_0x167ebb){if(!_0x167ebb){_0x431723[_0xe8ec('0xe')](0x194);}return _0x167ebb;};}function handleError(_0xdb2565,_0x1e76ac){_0x1e76ac=_0x1e76ac||0x1f4;return function(_0x218a4b){logger['error'](_0x218a4b[_0xe8ec('0xf')]);if(_0x218a4b[_0xe8ec('0x10')]){delete _0x218a4b[_0xe8ec('0x10')];}_0xdb2565['status'](_0x1e76ac)[_0xe8ec('0x11')](_0x218a4b);};}exports[_0xe8ec('0x12')]=function(_0x2a3b73,_0x34a582){var _0x9a6f0c={},_0x39e557={},_0x1d183a={'count':0x0,'rows':[]};var _0x2e54f0=_['map'](db[_0xe8ec('0x13')][_0xe8ec('0x14')],function(_0x13c5c8){return{'name':_0x13c5c8[_0xe8ec('0x15')],'type':_0x13c5c8[_0xe8ec('0x16')][_0xe8ec('0x17')]};});_0x39e557[_0xe8ec('0x18')]=_[_0xe8ec('0x19')](_0x2e54f0,_0xe8ec('0x10'));_0x39e557['query']=_[_0xe8ec('0x1a')](_0x2a3b73[_0xe8ec('0x1b')]);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x39e557[_0xe8ec('0x18')],_0x39e557['query']);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1e')](_0x39e557[_0xe8ec('0x1c')],[_0xe8ec('0x1f'),_0xe8ec('0x20'),_0xe8ec('0x21'),'$gte','$lt',_0xe8ec('0x22'),_0xe8ec('0x23'),_0xe8ec('0x24'),_0xe8ec('0x25'),_0xe8ec('0x26'),_0xe8ec('0x27'),_0xe8ec('0x28'),_0xe8ec('0x29'),_0xe8ec('0x2a'),_0xe8ec('0x2b'),_0xe8ec('0x2c'),_0xe8ec('0x2d'),_0xe8ec('0x2a'),_0xe8ec('0x2e'),_0xe8ec('0x2f'),'$contained',_0xe8ec('0x30')]);_0x9a6f0c[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x39e557['model'],qs[_0xe8ec('0x32')](_0x2a3b73['query'][_0xe8ec('0x32')]));_0x9a6f0c[_0xe8ec('0x31')]=_0x9a6f0c[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x9a6f0c[_0xe8ec('0x31')]:_0x39e557['model'];if(!_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x34')](_0xe8ec('0x35'))){_0x9a6f0c['limit']=qs[_0xe8ec('0x8')](_0x2a3b73['query'][_0xe8ec('0x8')]);_0x9a6f0c[_0xe8ec('0x6')]=qs[_0xe8ec('0x6')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x6')]);}_0x9a6f0c[_0xe8ec('0x36')]=qs[_0xe8ec('0x37')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x37')]);_0x9a6f0c['where']=qs[_0xe8ec('0x1c')](_[_0xe8ec('0x38')](_0x2a3b73[_0xe8ec('0x1b')],_0x39e557['filters']),_0x2e54f0);if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]){_0x9a6f0c['where']=_[_0xe8ec('0x3a')](_0x9a6f0c[_0xe8ec('0x3b')],{'$or':_[_0xe8ec('0x19')](_0x2e54f0,function(_0x15dd54){if(_0x15dd54['type']!==_0xe8ec('0x3c')){var _0x3c3a12={};_0x3c3a12[_0x15dd54[_0xe8ec('0x10')]]={'$like':'%'+_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]+'%'};return _0x3c3a12;}})});}_0x9a6f0c=_[_0xe8ec('0x3a')]({},_0x9a6f0c,_0x2a3b73[_0xe8ec('0x3d')]);var _0x29f78a={'where':_0x9a6f0c['where']};return db['CmHopper'][_0xe8ec('0x9')](_0x29f78a)[_0xe8ec('0x3e')](function(_0x25406d){_0x1d183a[_0xe8ec('0x9')]=_0x25406d;if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x3f')]){_0x9a6f0c[_0xe8ec('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xe8ec('0x41')](_0x9a6f0c);})['then'](function(_0x341c75){_0x1d183a[_0xe8ec('0x42')]=_0x341c75;return _0x1d183a;})['then'](respondWithFilteredResult(_0x34a582,_0x9a6f0c))['catch'](handleError(_0x34a582,null));};exports[_0xe8ec('0x43')]=function(_0x2591e5,_0x34c572){var _0x5c99cd={'raw':!![],'where':{'id':_0x2591e5[_0xe8ec('0x44')]['id']}},_0x1223b8={};_0x1223b8[_0xe8ec('0x18')]=_[_0xe8ec('0x1a')](db[_0xe8ec('0x13')]['rawAttributes']);_0x1223b8['query']=_[_0xe8ec('0x1a')](_0x2591e5['query']);_0x1223b8[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],_0x1223b8[_0xe8ec('0x1b')]);_0x5c99cd[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],qs['fields'](_0x2591e5[_0xe8ec('0x1b')][_0xe8ec('0x32')]));_0x5c99cd[_0xe8ec('0x31')]=_0x5c99cd[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x5c99cd[_0xe8ec('0x31')]:_0x1223b8[_0xe8ec('0x18')];if(_0x2591e5[_0xe8ec('0x1b')]['includeAll']){_0x5c99cd[_0xe8ec('0x40')]=[{'all':!![]}];}_0x5c99cd=_[_0xe8ec('0x3a')]({},_0x5c99cd,_0x2591e5[_0xe8ec('0x3d')]);return db['CmHopper'][_0xe8ec('0x45')](_0x5c99cd)['then'](handleEntityNotFound(_0x34c572,null))[_0xe8ec('0x3e')](respondWithResult(_0x34c572,null))[_0xe8ec('0x46')](handleError(_0x34c572,null));};exports[_0xe8ec('0x47')]=function(_0x5e8740,_0x230305){return db[_0xe8ec('0x13')]['create'](_0x5e8740[_0xe8ec('0x48')],{})['then'](respondWithResult(_0x230305,0xc9))[_0xe8ec('0x46')](handleError(_0x230305,null));};exports['update']=function(_0x82a0db,_0x1028dd){if(_0x82a0db[_0xe8ec('0x48')]['id']){delete _0x82a0db[_0xe8ec('0x48')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x82a0db['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x1028dd,null))[_0xe8ec('0x3e')](saveUpdates(_0x82a0db[_0xe8ec('0x48')],null))['then'](respondWithResult(_0x1028dd,null))[_0xe8ec('0x46')](handleError(_0x1028dd,null));};exports[_0xe8ec('0x49')]=function(_0x96ca5f,_0x1f96d9){return db[_0xe8ec('0x13')]['describe']()[_0xe8ec('0x3e')](respondWithResult(_0x1f96d9,null))[_0xe8ec('0x46')](handleError(_0x1f96d9,null));};exports[_0xe8ec('0x4a')]=function(_0x3de7aa,_0x329ef3){var _0xd3127;var _0x37611a=_0x3de7aa['params']['id'];return db[_0xe8ec('0x13')][_0xe8ec('0x45')]({'where':{'id':_0x3de7aa['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x329ef3,null))[_0xe8ec('0x3e')](function(_0x40b8e6){if(_0x40b8e6){return _0x40b8e6[_0xe8ec('0x4a')]()['then'](function(_0x30f211){return _0x30f211;});}})[_0xe8ec('0x3e')](function(_0x3ae6ae){_0xd3127=_0x3ae6ae;if(_0x3ae6ae){if(_0x3ae6ae[_0xe8ec('0x4b')]||_0x3ae6ae[_0xe8ec('0x4c')]){return db[_0x3ae6ae[_0xe8ec('0x4b')]?'VoiceQueue':_0xe8ec('0x4d')][_0xe8ec('0x45')]({'where':{'id':_0x3ae6ae['VoiceQueueId']?_0x3ae6ae['VoiceQueueId']:_0x3ae6ae[_0xe8ec('0x4c')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x3bd3fb){var _0xb2731e={};if(_0x3bd3fb){_[_0xe8ec('0x3a')](_0xb2731e,_[_0xe8ec('0x4e')](_0xd3127[_0xe8ec('0x4f')],[_0xe8ec('0x50'),'updatedAt','id']));_0xb2731e['state']=0x15;_0xb2731e[_0xe8ec('0x51')]=_0xe8ec('0x52');_0xb2731e['campaign']=_0x3bd3fb['name'];_0xb2731e[_0xe8ec('0x53')]=_0x3de7aa[_0xe8ec('0x54')][_0xe8ec('0x10')];_0xb2731e['UserId']=_0x3de7aa['user']['id'];_0xb2731e[_0xe8ec('0x52')]=!![];_0xb2731e[_0xe8ec('0x55')]=moment()[_0xe8ec('0x56')](_0xe8ec('0x57'));_0xb2731e['calleridnum']=_0xd3127['phone'];_0xb2731e[_0xe8ec('0x58')]=_0xd3127['VoiceQueueId']?_0xe8ec('0x59'):_0xe8ec('0x5a');return db['CmContact'][_0xe8ec('0x45')]({'where':{'id':_0xb2731e['ContactId']},'attributes':[_0xe8ec('0x5b'),'lastName']})[_0xe8ec('0x3e')](function(_0x307fce){if(!_[_0xe8ec('0x5c')](_0x329ef3)&&!_[_0xe8ec('0x5c')](_0x307fce[_0xe8ec('0x5b')])){_0xb2731e[_0xe8ec('0x5d')]=_0x307fce['firstName'];if(!_[_0xe8ec('0x5c')](_0x307fce['lastName'])){_0xb2731e[_0xe8ec('0x5d')]+='\x20'+_0x307fce[_0xe8ec('0x5e')];}}})[_0xe8ec('0x5f')](function(){return db[_0xe8ec('0x60')][_0xe8ec('0x47')](_0xb2731e);});}})['then'](function(_0x471a6a){return db[_0xe8ec('0x61')]['destroy']({'where':{'CmHopperId':_0x37611a}});})['then'](function(){return _0x329ef3[_0xe8ec('0x5')](0xcc)[_0xe8ec('0x62')]();})['catch'](handleError(_0x329ef3,null));};exports[_0xe8ec('0x63')]=function(_0x41e5a5,_0x4ee845){var _0x492062=[];return db[_0xe8ec('0x64')][_0xe8ec('0x49')]()['then'](function(_0x4fef2b){_0x492062=_[_0xe8ec('0x1a')](_0x4fef2b);return _0x41e5a5[_0xe8ec('0x54')][_0xe8ec('0x65')]({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id',_0xe8ec('0x68'),_0xe8ec('0x69')],'raw':!![]});})[_0xe8ec('0x3e')](function(_0x6071b5){if(_0x6071b5&&_0x6071b5[_0xe8ec('0x33')]){return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x903ed5){var _0x277fc0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x6071b5,'id')},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x27850d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x6071b5)[_0xe8ec('0x39')]([_0xe8ec('0x69'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x50c78d={'$or':[_0x277fc0,_0x27850d]};var _0x1ae75a=[];if(_0x41e5a5['body'][_0xe8ec('0x6c')]&&_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6c')]===_0xe8ec('0x6d')){if(!_[_0xe8ec('0x6e')](_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')])){_0x50c78d['id']={'$in':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'ASC'],[_0xe8ec('0x71'),_0x6071b5[0x0][_0xe8ec('0x68')]===_0xe8ec('0x72')?_0xe8ec('0x73'):'ASC'],db[_0xe8ec('0x6a')]['literal'](_0xe8ec('0x74')),['id','DESC']];}else{if(!_[_0xe8ec('0x6e')](_0x41e5a5['body'][_0xe8ec('0x6f')])){_0x50c78d['id']={'$notIn':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'DESC'],[_0xe8ec('0x71'),_0x6071b5[0x0]['dialOrderByScheduledAt']],db[_0xe8ec('0x6a')][_0xe8ec('0x75')](_0xe8ec('0x76')),['id',_0xe8ec('0x72')]];}return db[_0xe8ec('0x13')]['findOne']({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x78'),'recallme'],'where':_0x50c78d,'order':_0x1ae75a,'transaction':_0x903ed5,'lock':_0x903ed5['LOCK'][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':_0xe8ec('0x7a'),'attributes':_0x492062,'include':[{'model':db[_0xe8ec('0x7b')],'as':_0xe8ec('0x7c'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db[_0xe8ec('0x7e')],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})['then'](function(_0x39928f){if(_0x39928f){return _0x39928f['update']({'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']},{'transaction':_0x903ed5});}});});}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x4ee845,null))[_0xe8ec('0x3e')](respondWithResult(_0x4ee845,null))['catch'](handleError(_0x4ee845,null));};exports[_0xe8ec('0x80')]=function(_0x173dd9,_0x543a25,_0x16a85b){var _0x31125a=[];var _0x1bd095=_0x173dd9[_0xe8ec('0x44')]['id'];var _0x5a5aa7=_0x173dd9[_0xe8ec('0x54')]['id'];return db['CmContact'][_0xe8ec('0x49')]()[_0xe8ec('0x3e')](function(_0x4f116c){_0x31125a=_[_0xe8ec('0x1a')](_0x4f116c);return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x49e13b){const _0x43af9b={'id':_0x1bd095};return db[_0xe8ec('0x13')][_0xe8ec('0x81')]({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x82')],'where':_0x43af9b,'transaction':_0x49e13b,'lock':_0x49e13b[_0xe8ec('0x83')][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':'Contact','attributes':_0x31125a,'include':[{'model':db['CmCompany'],'as':_0xe8ec('0x7c'),'attributes':['id',_0xe8ec('0x10')]}]},{'model':db[_0xe8ec('0x84')],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})[_0xe8ec('0x3e')](function(_0xb0dce6){if(_0xb0dce6){return _0xb0dce6[_0xe8ec('0xd')]({'UserId':_0x5a5aa7},{'transaction':_0x49e13b});}});});})[_0xe8ec('0x3e')](handleEntityNotFound(_0x543a25,null))['then'](respondWithResult(_0x543a25,null))['catch'](handleError(_0x543a25,null));};exports[_0xe8ec('0x85')]=function(_0x229753,_0x2f0f34){return _0x229753[_0xe8ec('0x54')]['getVoiceQueues']({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id'],'raw':!![]})[_0xe8ec('0x3e')](function(_0x5c20ba){if(_0x5c20ba&&_0x5c20ba[_0xe8ec('0x33')]){return db[_0xe8ec('0x13')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_[_0xe8ec('0x19')](_0x5c20ba,'id')},'$or':[{'UserId':null},{'UserId':_0x229753[_0xe8ec('0x54')]['id']}]}});}return 0x0;})[_0xe8ec('0x3e')](function(_0x24c698){if(!_[_0xe8ec('0x5c')](_0x24c698)&&_[_0xe8ec('0x86')](_0x24c698)){return _0x2f0f34[_0xe8ec('0x5')](0xc8)[_0xe8ec('0xc')]({'contacts':_0x24c698});}else{logger[_0xe8ec('0x87')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xe8ec('0x85'),0x194,_0xe8ec('0x88'));_0x2f0f34[_0xe8ec('0xe')](0x194);}})['catch'](handleError(_0x2f0f34,null));};exports[_0xe8ec('0x89')]=function(_0x155a68,_0x1011f5){var _0x32b42c=shared[_0xe8ec('0x8a')];var _0x473c23=[];_['map'](_0x32b42c,function(_0x52fffa){_0x473c23[_0xe8ec('0x8b')]({'id':_0x52fffa['name'],'name':_0x52fffa[_0xe8ec('0x10')],'utcOffset':_0x52fffa['utcOffset']});});return _0x1011f5[_0xe8ec('0x5')](0xc8)['json']({'tz':_0x473c23});};exports[_0xe8ec('0x8c')]=function(_0x380048,_0x336204){var _0x54851b=shared['timezones'];var _0x1bd533={};if(!_[_0xe8ec('0x5c')](_0x54851b[_0x380048[_0xe8ec('0x48')]['id']]))_0x1bd533=_0x54851b[_0x380048[_0xe8ec('0x48')]['id']];return _0x336204['status'](0xc8)[_0xe8ec('0xc')](_0x1bd533);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a066d02..d90d5cc 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 _0x01d9=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x4c8812,_0xa9d102){var _0x42d129=function(_0x139047){while(--_0x139047){_0x4c8812['push'](_0x4c8812['shift']());}};_0x42d129(++_0xa9d102);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['define','CmHopper','cm_hopper','scheduledat','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xda19,0xd5));var _0x9da1=function(_0xf4e1ba,_0x3afa76){_0xf4e1ba=_0xf4e1ba-0x0;var _0x1cf3c8=_0xda19[_0xf4e1ba];return _0x1cf3c8;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0x9da1('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0575786..bfb08de 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 _0x1bf0=['catch','error','message','ShowCmHopper','stringify','CreateCmHopper','create','then','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','limit','order','LOCK','UPDATE','User','Agent','voicePause','length','UserId','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','raw','options','where','map','include','model','attributes','info','GetCmHopper','debug'];(function(_0xf54c17,_0x76e3e7){var _0xe8844f=function(_0x1fcd11){while(--_0x1fcd11){_0xf54c17['push'](_0xf54c17['shift']());}};_0xe8844f(++_0x76e3e7);}(_0x1bf0,0x8f));var _0x01bf=function(_0x50cbc8,_0x427241){_0x50cbc8=_0x50cbc8-0x0;var _0x13e466=_0x1bf0[_0x50cbc8];return _0x13e466;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x01bf('0x0'));var BPromise=require(_0x01bf('0x1'));var db=require(_0x01bf('0x2'))['db'];var logger=require(_0x01bf('0x3'))(_0x01bf('0x4'));exports['GetCmHopper']=function(_0x32829a){var _0x5d11bb=this;return new Promise(function(_0x55b767,_0x39b2d5){return db[_0x01bf('0x5')][_0x01bf('0x6')]({'raw':_0x32829a['options']?_0x32829a['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x32829a[_0x01bf('0x8')]?_0x32829a['options'][_0x01bf('0x9')]||null:null,'attributes':_0x32829a[_0x01bf('0x8')]?_0x32829a[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x32829a[_0x01bf('0x8')]?_0x32829a[_0x01bf('0x8')]['limit']||null:null,'include':_0x32829a[_0x01bf('0x8')]?_0x32829a[_0x01bf('0x8')]['include']?_[_0x01bf('0xa')](_0x32829a[_0x01bf('0x8')][_0x01bf('0xb')],function(_0x3f71fc){return{'model':db[_0x3f71fc['model']],'as':_0x3f71fc['as'],'attributes':_0x3f71fc['attributes'],'include':_0x3f71fc[_0x01bf('0xb')]?_['map'](_0x3f71fc[_0x01bf('0xb')],function(_0x1cad69){return{'model':db[_0x1cad69[_0x01bf('0xc')]],'as':_0x1cad69['as'],'attributes':_0x1cad69['attributes'],'include':_0x1cad69[_0x01bf('0xb')]?_['map'](_0x1cad69[_0x01bf('0xb')],function(_0x4dc6ce){return{'model':db[_0x4dc6ce[_0x01bf('0xc')]],'as':_0x4dc6ce['as'],'attributes':_0x4dc6ce[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x504210){logger[_0x01bf('0xe')](_0x01bf('0xf'),_0x32829a);logger[_0x01bf('0x10')](_0x01bf('0xf'),_0x32829a,JSON['stringify'](_0x504210));_0x55b767(_0x504210);})[_0x01bf('0x11')](function(_0x19ef49){logger[_0x01bf('0x12')]('GetCmHopper',_0x19ef49[_0x01bf('0x13')],_0x32829a);_0x39b2d5(_0x5d11bb[_0x01bf('0x12')](0x1f4,_0x19ef49[_0x01bf('0x13')]));});});};exports[_0x01bf('0x14')]=function(_0x4f5a8f){var _0xef1a3=this;return new Promise(function(_0x203cb7,_0x4b12c6){return db['CmHopper']['find']({'raw':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')][_0x01bf('0x9')]||null:null,'attributes':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')]['attributes']||null:null,'include':_0x4f5a8f[_0x01bf('0x8')]?_0x4f5a8f[_0x01bf('0x8')][_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x4f5a8f['options'][_0x01bf('0xb')],function(_0x12cbd9){return{'model':db[_0x12cbd9['model']],'as':_0x12cbd9['as'],'attributes':_0x12cbd9[_0x01bf('0xd')],'include':_0x12cbd9['include']?_[_0x01bf('0xa')](_0x12cbd9[_0x01bf('0xb')],function(_0x112bd6){return{'model':db[_0x112bd6[_0x01bf('0xc')]],'as':_0x112bd6['as'],'attributes':_0x112bd6['attributes'],'include':_0x112bd6['include']?_[_0x01bf('0xa')](_0x112bd6[_0x01bf('0xb')],function(_0x4694c3){return{'model':db[_0x4694c3['model']],'as':_0x4694c3['as'],'attributes':_0x4694c3[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550976){logger['info'](_0x01bf('0x14'),_0x4f5a8f);logger['debug'](_0x01bf('0x14'),_0x4f5a8f,JSON[_0x01bf('0x15')](_0x550976));_0x203cb7(_0x550976);})[_0x01bf('0x11')](function(_0x5a4187){logger[_0x01bf('0x12')]('ShowCmHopper',_0x5a4187[_0x01bf('0x13')],_0x4f5a8f);_0x4b12c6(_0xef1a3[_0x01bf('0x12')](0x1f4,_0x5a4187[_0x01bf('0x13')]));});});};exports[_0x01bf('0x16')]=function(_0x57137d){var _0x2912e9=this;return new Promise(function(_0x15e747,_0x345b25){return db[_0x01bf('0x5')][_0x01bf('0x17')](_0x57137d['body'],{'raw':_0x57137d['options']?_0x57137d['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![]})[_0x01bf('0x18')](function(_0x3118cd){logger[_0x01bf('0xe')](_0x01bf('0x16'),_0x57137d);logger[_0x01bf('0x10')](_0x01bf('0x16'),_0x57137d,JSON['stringify'](_0x3118cd));_0x15e747(_0x3118cd);})[_0x01bf('0x11')](function(_0x2487e4){logger[_0x01bf('0x12')](_0x01bf('0x16'),_0x2487e4[_0x01bf('0x13')],_0x57137d);_0x345b25(_0x2912e9[_0x01bf('0x12')](0x1f4,_0x2487e4[_0x01bf('0x13')]));});});};exports[_0x01bf('0x19')]=function(_0x2d301e){var _0x30eaf2=this;return new Promise(function(_0x2f1e3f,_0xc8d5c3){return db[_0x01bf('0x5')][_0x01bf('0x1a')](_0x2d301e[_0x01bf('0x1b')],{'raw':_0x2d301e[_0x01bf('0x8')]?_0x2d301e['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d301e[_0x01bf('0x8')]?_0x2d301e[_0x01bf('0x8')]['where']||null:null,'attributes':_0x2d301e['options']?_0x2d301e[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x2d301e['options']?_0x2d301e[_0x01bf('0x8')]['limit']||null:null})[_0x01bf('0x18')](function(_0x14f07f){logger[_0x01bf('0xe')]('UpdateCmHopper',_0x2d301e);logger[_0x01bf('0xe')](_0x01bf('0x1c'),JSON[_0x01bf('0x15')](_0x2d301e[_0x01bf('0x8')]['where']),_0x2d301e[_0x01bf('0x1b')][_0x01bf('0x1d')]);logger[_0x01bf('0x10')](_0x01bf('0x19'),_0x2d301e,JSON[_0x01bf('0x15')](_0x14f07f));_0x2f1e3f(_0x14f07f);})['catch'](function(_0xa02f51){logger[_0x01bf('0x12')](_0x01bf('0x19'),_0xa02f51['message'],_0x2d301e);_0xc8d5c3(_0x30eaf2['error'](0x1f4,_0xa02f51[_0x01bf('0x13')]));});});};exports[_0x01bf('0x1e')]=function(_0x18d41d){var _0x3686b9=this;return new Promise(function(_0x259a41,_0x235e90){return db[_0x01bf('0x5')][_0x01bf('0x1f')]({'where':_0x18d41d[_0x01bf('0x8')]?_0x18d41d[_0x01bf('0x8')]['where']||null:null})[_0x01bf('0x18')](function(_0x17e37f){logger['info']('DestroyCmHopper',_0x18d41d);logger[_0x01bf('0x10')]('DestroyCmHopper',_0x18d41d,JSON[_0x01bf('0x15')](_0x17e37f));_0x259a41(_0x17e37f);})[_0x01bf('0x11')](function(_0x305519){logger[_0x01bf('0x12')](_0x01bf('0x1e'),_0x305519[_0x01bf('0x13')],_0x18d41d);_0x235e90(_0x3686b9[_0x01bf('0x12')](0x1f4,_0x305519['message']));});});};exports[_0x01bf('0x20')]=function(_0x40ee21){var _0x3390d6=this;return new Promise(function(_0x2a6436,_0x53aa40){return db[_0x01bf('0x21')][_0x01bf('0x22')]()[_0x01bf('0x18')](function(_0xc7a6c4){return db[_0x01bf('0x23')][_0x01bf('0x24')](function(_0x3e29c8){return db['CmHopper'][_0x01bf('0x6')]({'where':_0x40ee21[_0x01bf('0x8')]?_0x40ee21[_0x01bf('0x8')][_0x01bf('0x9')]||null:null,'attributes':_0x40ee21['options']?_0x40ee21[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x40ee21['options']?_0x40ee21[_0x01bf('0x8')][_0x01bf('0x25')]||null:null,'order':_0x40ee21[_0x01bf('0x8')]?_0x40ee21[_0x01bf('0x8')][_0x01bf('0x26')]||null:null,'transaction':_0x3e29c8,'lock':_0x3e29c8[_0x01bf('0x27')][_0x01bf('0x28')],'include':[{'model':db[_0x01bf('0x21')],'as':'Contact','attributes':_['keys'](_0xc7a6c4)},{'model':db[_0x01bf('0x29')],'as':_0x01bf('0x2a'),'attributes':['id','name',_0x01bf('0x2b')]}]})[_0x01bf('0x18')](function(_0x284875){var _0x2198d4=[];var _0x57c9b3=[];for(var _0x333879=0x0;_0x333879<_0x284875[_0x01bf('0x2c')];_0x333879+=0x1){var _0xb3baf3=_0x284875[_0x333879][_0x01bf('0x2d')];if(_0xb3baf3===null){_0x2198d4['push'](_0x284875[_0x333879]['update'](_0x40ee21[_0x01bf('0x1b')],{'transaction':_0x3e29c8}));}else if(!_0x57c9b3[_0x01bf('0x2e')](_0xb3baf3)){_0x57c9b3['push'](_0xb3baf3);_0x2198d4[_0x01bf('0x2f')](_0x284875[_0x333879][_0x01bf('0x1a')](_0x40ee21['body'],{'transaction':_0x3e29c8}));}}return BPromise[_0x01bf('0x30')](_0x2198d4);});})[_0x01bf('0x18')](function(_0x1e02ec){logger['info'](_0x01bf('0x20'),_0x40ee21);if(_0x1e02ec[_0x01bf('0x2c')]>0x0){logger[_0x01bf('0xe')](_0x01bf('0x31'),_0x1e02ec[0x0]['dataValues']['id'],_0x1e02ec[0x0][_0x01bf('0x32')][_0x01bf('0x33')],_0x1e02ec[0x0][_0x01bf('0x32')][_0x01bf('0x1d')]);}logger[_0x01bf('0x10')](_0x01bf('0x20'),_0x40ee21,JSON['stringify'](_0x1e02ec));_0x2a6436(_0x1e02ec);})[_0x01bf('0x11')](function(_0x327492){logger[_0x01bf('0x12')]('GetContactDialer',_0x327492[_0x01bf('0x13')],_0x40ee21);_0x53aa40(_0x3390d6[_0x01bf('0x12')](0x1f4,_0x327492['message']));});});});};exports[_0x01bf('0x34')]=function(_0x3bdb04){var _0x1a1b16=this;return new Promise(function(_0x827be0,_0xbc571f){return db['sequelize']['transaction'](function(_0x5684e1){return db[_0x01bf('0x35')][_0x01bf('0x17')](_0x3bdb04[_0x01bf('0x1b')],{'raw':_0x3bdb04[_0x01bf('0x8')]?_0x3bdb04[_0x01bf('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5684e1})[_0x01bf('0x18')](function(){logger[_0x01bf('0xe')](_0x01bf('0x36'),JSON[_0x01bf('0x15')](_0x3bdb04[_0x01bf('0x8')][_0x01bf('0x9')]),_0x3bdb04[_0x01bf('0x8')]['where'][_0x01bf('0x1d')]);return db['CmHopper'][_0x01bf('0x1f')]({'where':_0x3bdb04[_0x01bf('0x8')]?_0x3bdb04['options']['where']||null:null,'transaction':_0x5684e1});});})[_0x01bf('0x18')](function(_0x2725ac){logger[_0x01bf('0xe')]('MoveContactManagedDialer',_0x3bdb04);logger['debug'](_0x01bf('0x34'),_0x3bdb04,JSON['stringify'](_0x2725ac));_0x827be0(_0x2725ac);})['catch'](function(_0x57fe97){logger[_0x01bf('0x12')]('MoveContactManagedDialer',_0x57fe97[_0x01bf('0x13')],_0x3bdb04);_0xbc571f(_0x1a1b16[_0x01bf('0x12')](0x1f4,_0x57fe97['message']));});});};exports[_0x01bf('0x37')]=function(_0x300847){var _0x1dca4a=this;return new Promise(function(_0x4a2db8,_0x411519){return db[_0x01bf('0x5')][_0x01bf('0x6')]({'raw':_0x300847[_0x01bf('0x8')]?_0x300847[_0x01bf('0x8')][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x300847[_0x01bf('0x8')]?_0x300847[_0x01bf('0x8')]['where']||null:null,'attributes':[[db[_0x01bf('0x23')]['fn'](_0x01bf('0x38'),db[_0x01bf('0x23')]['fn']('IF',db[_0x01bf('0x23')][_0x01bf('0x39')](_0x01bf('0x3a')+util[_0x01bf('0x3b')](_0x01bf('0x3c'),moment()[_0x01bf('0x3b')](_0x01bf('0x3d')))+'\x20,\x201,\x20null'))),_0x01bf('0x3e')]]})[_0x01bf('0x18')](function(_0x285149){logger['info'](_0x01bf('0x37'),_0x300847);logger[_0x01bf('0x10')](_0x01bf('0x37'),_0x300847,JSON[_0x01bf('0x15')](_0x285149));_0x4a2db8(_0x285149);})[_0x01bf('0x11')](function(_0x59a275){logger['error']('CountReScheduled',_0x59a275['message'],_0x300847);_0x411519(_0x1dca4a['error'](0x1f4,_0x59a275[_0x01bf('0x13')]));});});};exports[_0x01bf('0x3f')]=function(_0x489f43){var _0x21aa05=this;return new Promise(function(_0x36ea85,_0x23716c){return db['CmContact'][_0x01bf('0x22')]()[_0x01bf('0x18')](function(){return db[_0x01bf('0x23')]['transaction'](function(_0xfa8bee){return db['CmHopper'][_0x01bf('0x6')]({'where':_0x489f43[_0x01bf('0x8')]?_0x489f43[_0x01bf('0x8')]['where']||null:null,'attributes':_0x489f43['options']?_0x489f43[_0x01bf('0x8')][_0x01bf('0xd')]||null:null,'limit':0x1,'order':_0x489f43[_0x01bf('0x8')]?_0x489f43[_0x01bf('0x8')][_0x01bf('0x26')]||null:null,'group':db[_0x01bf('0x5')][_0x01bf('0x2d')],'transaction':_0xfa8bee,'lock':_0xfa8bee[_0x01bf('0x27')][_0x01bf('0x28')],'include':_0x489f43[_0x01bf('0x8')]?_0x489f43[_0x01bf('0x8')]['include']?_[_0x01bf('0xa')](_0x489f43[_0x01bf('0x8')][_0x01bf('0xb')],function(_0x470804){return{'model':db[_0x470804[_0x01bf('0xc')]],'as':_0x470804['as'],'attributes':_0x470804['attributes'],'include':_0x470804[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x470804['include'],function(_0x2d174c){return{'model':db[_0x2d174c['model']],'as':_0x2d174c['as'],'attributes':_0x2d174c[_0x01bf('0xd')],'include':_0x2d174c[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x2d174c[_0x01bf('0xb')],function(_0x1b7533){return{'model':db[_0x1b7533[_0x01bf('0xc')]],'as':_0x1b7533['as'],'attributes':_0x1b7533[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x01bf('0x18')](function(_0x3470d1){var _0x5124fa=[];for(var _0x4fe679=0x0;_0x4fe679<_0x3470d1['length'];_0x4fe679+=0x1){_0x5124fa[_0x01bf('0x2f')](_0x3470d1[_0x4fe679][_0x01bf('0x1a')](_0x489f43[_0x01bf('0x1b')],{'transaction':_0xfa8bee}));}return BPromise[_0x01bf('0x30')](_0x5124fa);});})['then'](function(_0x1ccb16){logger[_0x01bf('0xe')](_0x01bf('0x3f'),_0x489f43);logger[_0x01bf('0x10')](_0x01bf('0x3f'),_0x489f43,JSON[_0x01bf('0x15')](_0x1ccb16));_0x36ea85(_0x1ccb16);})[_0x01bf('0x11')](function(_0x1104b0){logger[_0x01bf('0x12')](_0x01bf('0x3f'),_0x1104b0[_0x01bf('0x13')],_0x489f43);_0x23716c(_0x21aa05['error'](0x1f4,_0x1104b0['message']));});});});};exports[_0x01bf('0x40')]=function(_0x148b3b){var _0x252dbb=this;return new Promise(function(_0x309d6b,_0x2688a3){db[_0x01bf('0x21')][_0x01bf('0x22')]()['then'](function(_0x1c61d6){return db['CmHopper'][_0x01bf('0x6')]({'raw':_0x148b3b[_0x01bf('0x8')]?_0x148b3b['options'][_0x01bf('0x7')]===undefined?!![]:![]:!![],'where':_0x148b3b[_0x01bf('0x8')]?_0x148b3b['options'][_0x01bf('0x9')]||null:null,'attributes':_0x148b3b[_0x01bf('0x8')]?_0x148b3b[_0x01bf('0x8')]['attributes']||null:null,'limit':_0x148b3b[_0x01bf('0x8')]?_0x148b3b[_0x01bf('0x8')][_0x01bf('0x25')]||null:null,'include':_0x148b3b[_0x01bf('0x8')]?_0x148b3b['options'][_0x01bf('0xb')]?_['map'](_0x148b3b[_0x01bf('0x8')][_0x01bf('0xb')],function(_0x330a6e){return{'model':db[_0x330a6e[_0x01bf('0xc')]],'as':_0x330a6e['as'],'attributes':_0x330a6e['as']===_0x01bf('0x41')?_[_0x01bf('0x42')](_0x1c61d6):_0x330a6e[_0x01bf('0xd')],'include':_0x330a6e[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x330a6e[_0x01bf('0xb')],function(_0x1a9c9c){return{'model':db[_0x1a9c9c['model']],'as':_0x1a9c9c['as'],'attributes':_0x1a9c9c[_0x01bf('0xd')],'include':_0x1a9c9c[_0x01bf('0xb')]?_[_0x01bf('0xa')](_0x1a9c9c[_0x01bf('0xb')],function(_0x5a4d38){return{'model':db[_0x5a4d38[_0x01bf('0xc')]],'as':_0x5a4d38['as'],'attributes':_0x5a4d38[_0x01bf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x01bf('0x18')](function(_0x32f745){logger[_0x01bf('0xe')]('GetCmHopper',_0x148b3b);logger[_0x01bf('0x10')](_0x01bf('0xf'),_0x148b3b,JSON['stringify'](_0x32f745));_0x309d6b(_0x32f745);})['catch'](function(_0x129d40){logger[_0x01bf('0x12')](_0x01bf('0xf'),_0x129d40[_0x01bf('0x13')],_0x148b3b);_0x2688a3(_0x252dbb['error'](0x1f4,_0x129d40[_0x01bf('0x13')]));});});});};exports[_0x01bf('0x43')]=function(_0x4e373a){var _0x408324=this;return new Promise(function(_0x512001,_0x49e2d2){return db[_0x01bf('0x21')][_0x01bf('0x44')]({'raw':!![],'where':{'phone':_0x4e373a[_0x01bf('0x8')][_0x01bf('0x9')][_0x01bf('0x45')]},'attributes':['id','dialTimezone'],'order':[['id',_0x01bf('0x46')]]})[_0x01bf('0x18')](function(_0x7d71ed){logger['info'](_0x01bf('0x47'),_0x4e373a);logger[_0x01bf('0x10')](_0x01bf('0x47'),_0x4e373a,JSON[_0x01bf('0x15')](_0x7d71ed));_0x512001(_0x7d71ed);})[_0x01bf('0x11')](function(_0x28d7d0){logger['error'](_0x01bf('0x47'),_0x28d7d0[_0x01bf('0x13')],_0x4e373a);_0x49e2d2(_0x408324[_0x01bf('0x12')](0x1f4,_0x28d7d0[_0x01bf('0x13')]));});});};exports[_0x01bf('0x48')]=function(_0x331b2a){var _0x5d4abf=this;return new Promise(function(_0x5c6c54,_0x5b17d5){return db[_0x01bf('0x23')][_0x01bf('0x24')](function(_0x401c85){var _0x4e31c6=_0x331b2a[_0x01bf('0x8')]&&_0x331b2a[_0x01bf('0x8')][_0x01bf('0x9')]?_0x331b2a[_0x01bf('0x8')][_0x01bf('0x9')]:{};return db[_0x01bf('0x5')]['update'](_0x331b2a[_0x01bf('0x1b')],{'where':_0x4e31c6,'transaction':_0x401c85})['then'](function(_0xd27695){logger[_0x01bf('0xe')](_0x01bf('0x48'),_0x331b2a);logger['debug'](_0x01bf('0x48'),_0x331b2a,JSON[_0x01bf('0x15')](_0xd27695));_0x5c6c54(_0xd27695);})['catch'](function(_0x1bc474){logger[_0x01bf('0x12')](_0x01bf('0x48'),_0x1bc474[_0x01bf('0x13')],_0x331b2a);_0x5b17d5(_0x5d4abf[_0x01bf('0x12')](0x1f4,_0x1bc474[_0x01bf('0x13')]));});});});};exports[_0x01bf('0x49')]=function(_0x29d04f){var _0x112fdc=this;var _0x629d45=_0x29d04f[_0x01bf('0x1b')][_0x01bf('0x9')]['voiceQueueIds'];var _0x17625f=_0x29d04f[_0x01bf('0x1b')][_0x01bf('0x9')][_0x01bf('0x4a')];var _0x406cb2=_0x29d04f[_0x01bf('0x1b')]['where'][_0x01bf('0x4b')];return new Promise(function(_0x231eee,_0x4b3688){return db[_0x01bf('0x5')][_0x01bf('0x6')]({'where':{'voiceQueueId':{'$in':_0x629d45},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x01bf('0x23')]['literal'](_0x01bf('0x4c')+_0x17625f+'\x20MINUTE'),'$gt':db[_0x01bf('0x23')]['literal'](_0x01bf('0x4d'))}},'UserId':{'$in':_0x406cb2}},'include':[{'model':db['CmContact'],'as':_0x01bf('0x41')},{'model':db[_0x01bf('0x29')],'as':_0x01bf('0x2a'),'attributes':['id','name','voicePause']},{'model':db[_0x01bf('0x4e')],'as':_0x01bf('0x4f')}]})[_0x01bf('0x18')](function(_0x3d01b1){if(_0x3d01b1[_0x01bf('0x2c')]>0x0){return db[_0x01bf('0x23')]['transaction'](function(_0x553052){return db[_0x01bf('0x5')]['update']({'recallmeNotifiedDate':db[_0x01bf('0x23')][_0x01bf('0x39')](_0x01bf('0x4d'))},{'where':{'id':{'$in':_[_0x01bf('0xa')](_0x3d01b1,'id')}},'transaction':_0x553052})[_0x01bf('0x18')](function(){_0x231eee(_0x3d01b1);})[_0x01bf('0x11')](function(_0xffc0b0){logger['error'](_0x01bf('0x49'),_0xffc0b0['message'],_0x29d04f);_0x4b3688(_0x112fdc[_0x01bf('0x12')](0x1f4,_0xffc0b0['message']));});})['catch'](function(_0x563796){logger['error'](_0x01bf('0x49'),_0x563796[_0x01bf('0x13')],_0x29d04f);_0x4b3688(_0x112fdc[_0x01bf('0x12')](0x1f4,_0x563796['message']));});}else{_0x231eee(_0x3d01b1);}});});}; \ No newline at end of file +var _0x3609=['findAll','options','where','attributes','limit','include','model','map','stringify','error','ShowCmHopper','find','raw','then','info','debug','catch','message','CreateCmHopper','create','body','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UPDATE','GetContactRecallMe','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','name','voicePause','CmList','NOW()','lodash','util','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper'];(function(_0x10ee11,_0x168295){var _0x50c443=function(_0x559d27){while(--_0x559d27){_0x10ee11['push'](_0x10ee11['shift']());}};_0x50c443(++_0x168295);}(_0x3609,0xdd));var _0x9360=function(_0x5de3dc,_0x18cc5f){_0x5de3dc=_0x5de3dc-0x0;var _0x5212aa=_0x3609[_0x5de3dc];return _0x5212aa;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require('moment');var BPromise=require(_0x9360('0x2'));var db=require(_0x9360('0x3'))['db'];var logger=require('../../config/logger')(_0x9360('0x4'));exports[_0x9360('0x5')]=function(_0x1879de){var _0x410eec=this;return new Promise(function(_0x5b2a90,_0x6eb32b){return db[_0x9360('0x6')][_0x9360('0x7')]({'raw':_0x1879de['options']?_0x1879de[_0x9360('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1879de[_0x9360('0x8')]?_0x1879de[_0x9360('0x8')][_0x9360('0x9')]||null:null,'attributes':_0x1879de[_0x9360('0x8')]?_0x1879de['options'][_0x9360('0xa')]||null:null,'limit':_0x1879de['options']?_0x1879de[_0x9360('0x8')][_0x9360('0xb')]||null:null,'include':_0x1879de[_0x9360('0x8')]?_0x1879de[_0x9360('0x8')]['include']?_['map'](_0x1879de[_0x9360('0x8')][_0x9360('0xc')],function(_0x1773ff){return{'model':db[_0x1773ff[_0x9360('0xd')]],'as':_0x1773ff['as'],'attributes':_0x1773ff['attributes'],'include':_0x1773ff['include']?_[_0x9360('0xe')](_0x1773ff[_0x9360('0xc')],function(_0x515d1f){return{'model':db[_0x515d1f[_0x9360('0xd')]],'as':_0x515d1f['as'],'attributes':_0x515d1f[_0x9360('0xa')],'include':_0x515d1f['include']?_['map'](_0x515d1f[_0x9360('0xc')],function(_0x149b5d){return{'model':db[_0x149b5d['model']],'as':_0x149b5d['as'],'attributes':_0x149b5d[_0x9360('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xde17d8){logger['info'](_0x9360('0x5'),_0x1879de);logger['debug'](_0x9360('0x5'),_0x1879de,JSON[_0x9360('0xf')](_0xde17d8));_0x5b2a90(_0xde17d8);})['catch'](function(_0x219900){logger[_0x9360('0x10')](_0x9360('0x5'),_0x219900['message'],_0x1879de);_0x6eb32b(_0x410eec[_0x9360('0x10')](0x1f4,_0x219900['message']));});});};exports[_0x9360('0x11')]=function(_0x2c8e75){var _0x1baab9=this;return new Promise(function(_0x3cedf3,_0x2e98e9){return db[_0x9360('0x6')][_0x9360('0x12')]({'raw':_0x2c8e75[_0x9360('0x8')]?_0x2c8e75[_0x9360('0x8')][_0x9360('0x13')]===undefined?!![]:![]:!![],'where':_0x2c8e75[_0x9360('0x8')]?_0x2c8e75['options'][_0x9360('0x9')]||null:null,'attributes':_0x2c8e75[_0x9360('0x8')]?_0x2c8e75[_0x9360('0x8')][_0x9360('0xa')]||null:null,'include':_0x2c8e75[_0x9360('0x8')]?_0x2c8e75[_0x9360('0x8')][_0x9360('0xc')]?_[_0x9360('0xe')](_0x2c8e75['options'][_0x9360('0xc')],function(_0x54690c){return{'model':db[_0x54690c[_0x9360('0xd')]],'as':_0x54690c['as'],'attributes':_0x54690c['attributes'],'include':_0x54690c['include']?_[_0x9360('0xe')](_0x54690c[_0x9360('0xc')],function(_0x448030){return{'model':db[_0x448030[_0x9360('0xd')]],'as':_0x448030['as'],'attributes':_0x448030[_0x9360('0xa')],'include':_0x448030[_0x9360('0xc')]?_[_0x9360('0xe')](_0x448030[_0x9360('0xc')],function(_0x704808){return{'model':db[_0x704808[_0x9360('0xd')]],'as':_0x704808['as'],'attributes':_0x704808['attributes']};}):[]};}):[]};}):[]:[]})[_0x9360('0x14')](function(_0x237cbd){logger[_0x9360('0x15')]('ShowCmHopper',_0x2c8e75);logger[_0x9360('0x16')](_0x9360('0x11'),_0x2c8e75,JSON[_0x9360('0xf')](_0x237cbd));_0x3cedf3(_0x237cbd);})[_0x9360('0x17')](function(_0x16cc98){logger[_0x9360('0x10')](_0x9360('0x11'),_0x16cc98[_0x9360('0x18')],_0x2c8e75);_0x2e98e9(_0x1baab9[_0x9360('0x10')](0x1f4,_0x16cc98[_0x9360('0x18')]));});});};exports[_0x9360('0x19')]=function(_0x182140){var _0x484019=this;return new Promise(function(_0x34e387,_0xee5f38){return db[_0x9360('0x6')][_0x9360('0x1a')](_0x182140[_0x9360('0x1b')],{'raw':_0x182140[_0x9360('0x8')]?_0x182140[_0x9360('0x8')][_0x9360('0x13')]===undefined?!![]:![]:!![]})[_0x9360('0x14')](function(_0x39c623){logger['info'](_0x9360('0x19'),_0x182140);logger['debug'](_0x9360('0x19'),_0x182140,JSON['stringify'](_0x39c623));_0x34e387(_0x39c623);})[_0x9360('0x17')](function(_0xc8f331){logger[_0x9360('0x10')](_0x9360('0x19'),_0xc8f331[_0x9360('0x18')],_0x182140);_0xee5f38(_0x484019['error'](0x1f4,_0xc8f331[_0x9360('0x18')]));});});};exports['UpdateCmHopper']=function(_0x129387){var _0x558bae=this;return new Promise(function(_0x396f53,_0x556e6a){return db[_0x9360('0x6')][_0x9360('0x1c')](_0x129387['body'],{'raw':_0x129387[_0x9360('0x8')]?_0x129387[_0x9360('0x8')][_0x9360('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129387[_0x9360('0x8')]?_0x129387[_0x9360('0x8')][_0x9360('0x9')]||null:null,'attributes':_0x129387[_0x9360('0x8')]?_0x129387[_0x9360('0x8')][_0x9360('0xa')]||null:null,'limit':_0x129387[_0x9360('0x8')]?_0x129387[_0x9360('0x8')]['limit']||null:null})[_0x9360('0x14')](function(_0x53d0c2){logger[_0x9360('0x15')]('UpdateCmHopper',_0x129387);logger[_0x9360('0x15')](_0x9360('0x1d'),JSON['stringify'](_0x129387[_0x9360('0x8')][_0x9360('0x9')]),_0x129387[_0x9360('0x1b')][_0x9360('0x1e')]);logger[_0x9360('0x16')]('UpdateCmHopper',_0x129387,JSON[_0x9360('0xf')](_0x53d0c2));_0x396f53(_0x53d0c2);})['catch'](function(_0x4f8601){logger[_0x9360('0x10')](_0x9360('0x1f'),_0x4f8601[_0x9360('0x18')],_0x129387);_0x556e6a(_0x558bae[_0x9360('0x10')](0x1f4,_0x4f8601[_0x9360('0x18')]));});});};exports[_0x9360('0x20')]=function(_0x2c6a96){var _0x2192e1=this;return new Promise(function(_0xa9a45,_0x1c9fd1){return db[_0x9360('0x6')][_0x9360('0x21')]({'where':_0x2c6a96['options']?_0x2c6a96[_0x9360('0x8')][_0x9360('0x9')]||null:null})['then'](function(_0x811ce2){logger[_0x9360('0x15')]('DestroyCmHopper',_0x2c6a96);logger[_0x9360('0x16')](_0x9360('0x20'),_0x2c6a96,JSON[_0x9360('0xf')](_0x811ce2));_0xa9a45(_0x811ce2);})[_0x9360('0x17')](function(_0x5a28fd){logger['error'](_0x9360('0x20'),_0x5a28fd['message'],_0x2c6a96);_0x1c9fd1(_0x2192e1[_0x9360('0x10')](0x1f4,_0x5a28fd[_0x9360('0x18')]));});});};exports[_0x9360('0x22')]=function(_0x9e6623){var _0x547439=this;return new Promise(function(_0xe4839c,_0x2cd758){return db[_0x9360('0x23')][_0x9360('0x24')]()[_0x9360('0x14')](function(_0x575c93){return db[_0x9360('0x25')][_0x9360('0x26')](function(_0x56eabb){return db[_0x9360('0x6')][_0x9360('0x7')]({'where':_0x9e6623[_0x9360('0x8')]?_0x9e6623[_0x9360('0x8')][_0x9360('0x9')]||null:null,'attributes':_0x9e6623['options']?_0x9e6623[_0x9360('0x8')][_0x9360('0xa')]||null:null,'limit':_0x9e6623[_0x9360('0x8')]?_0x9e6623[_0x9360('0x8')][_0x9360('0xb')]||null:null,'order':_0x9e6623[_0x9360('0x8')]?_0x9e6623[_0x9360('0x8')][_0x9360('0x27')]||null:null,'transaction':_0x56eabb,'lock':_0x56eabb[_0x9360('0x28')]['UPDATE'],'include':[{'model':db[_0x9360('0x23')],'as':_0x9360('0x29'),'attributes':_[_0x9360('0x2a')](_0x575c93)},{'model':db[_0x9360('0x2b')],'as':'Agent','attributes':['id','name','voicePause']}]})[_0x9360('0x14')](function(_0x5253ce){var _0x420d7d=[];var _0x23aafd=[];for(var _0x1ac1fb=0x0;_0x1ac1fb<_0x5253ce[_0x9360('0x2c')];_0x1ac1fb+=0x1){var _0x1e4af6=_0x5253ce[_0x1ac1fb][_0x9360('0x2d')];if(_0x1e4af6===null){_0x420d7d[_0x9360('0x2e')](_0x5253ce[_0x1ac1fb][_0x9360('0x1c')](_0x9e6623[_0x9360('0x1b')],{'transaction':_0x56eabb}));}else if(!_0x23aafd[_0x9360('0x2f')](_0x1e4af6)){_0x23aafd['push'](_0x1e4af6);_0x420d7d[_0x9360('0x2e')](_0x5253ce[_0x1ac1fb]['update'](_0x9e6623['body'],{'transaction':_0x56eabb}));}}return BPromise[_0x9360('0x30')](_0x420d7d);});})['then'](function(_0x34e7ab){logger['info'](_0x9360('0x22'),_0x9e6623);if(_0x34e7ab[_0x9360('0x2c')]>0x0){logger['info'](_0x9360('0x31'),_0x34e7ab[0x0][_0x9360('0x32')]['id'],_0x34e7ab[0x0][_0x9360('0x32')][_0x9360('0x33')],_0x34e7ab[0x0][_0x9360('0x32')][_0x9360('0x1e')]);}logger[_0x9360('0x16')]('GetContactDialer',_0x9e6623,JSON[_0x9360('0xf')](_0x34e7ab));_0xe4839c(_0x34e7ab);})[_0x9360('0x17')](function(_0x35f917){logger['error'](_0x9360('0x22'),_0x35f917[_0x9360('0x18')],_0x9e6623);_0x2cd758(_0x547439[_0x9360('0x10')](0x1f4,_0x35f917[_0x9360('0x18')]));});});});};exports[_0x9360('0x34')]=function(_0x53db12){var _0x5f4ee3=this;return new Promise(function(_0x4b2f66,_0x59291a){return db['sequelize']['transaction'](function(_0x162e5a){return db['CmHopperFinal'][_0x9360('0x1a')](_0x53db12[_0x9360('0x1b')],{'raw':_0x53db12[_0x9360('0x8')]?_0x53db12[_0x9360('0x8')][_0x9360('0x13')]===undefined?!![]:![]:!![],'transaction':_0x162e5a})[_0x9360('0x14')](function(){logger[_0x9360('0x15')](_0x9360('0x35'),JSON['stringify'](_0x53db12[_0x9360('0x8')][_0x9360('0x9')]),_0x53db12['options'][_0x9360('0x9')][_0x9360('0x1e')]);return db[_0x9360('0x6')]['destroy']({'where':_0x53db12[_0x9360('0x8')]?_0x53db12[_0x9360('0x8')][_0x9360('0x9')]||null:null,'transaction':_0x162e5a});});})['then'](function(_0x3ed81f){logger['info'](_0x9360('0x34'),_0x53db12);logger[_0x9360('0x16')](_0x9360('0x34'),_0x53db12,JSON[_0x9360('0xf')](_0x3ed81f));_0x4b2f66(_0x3ed81f);})[_0x9360('0x17')](function(_0x40c428){logger['error']('MoveContactManagedDialer',_0x40c428[_0x9360('0x18')],_0x53db12);_0x59291a(_0x5f4ee3[_0x9360('0x10')](0x1f4,_0x40c428[_0x9360('0x18')]));});});};exports[_0x9360('0x36')]=function(_0x444edc){var _0x5f4c5f=this;return new Promise(function(_0x54ac5e,_0x5cc35f){return db[_0x9360('0x6')][_0x9360('0x7')]({'raw':_0x444edc['options']?_0x444edc['options']['raw']===undefined?!![]:![]:!![],'where':_0x444edc[_0x9360('0x8')]?_0x444edc[_0x9360('0x8')][_0x9360('0x9')]||null:null,'attributes':[[db['sequelize']['fn'](_0x9360('0x37'),db[_0x9360('0x25')]['fn']('IF',db[_0x9360('0x25')]['literal'](_0x9360('0x38')+util[_0x9360('0x39')]('\x22%s\x22',moment()[_0x9360('0x39')](_0x9360('0x3a')))+_0x9360('0x3b')))),_0x9360('0x3c')]]})['then'](function(_0x535921){logger[_0x9360('0x15')](_0x9360('0x36'),_0x444edc);logger[_0x9360('0x16')](_0x9360('0x36'),_0x444edc,JSON[_0x9360('0xf')](_0x535921));_0x54ac5e(_0x535921);})[_0x9360('0x17')](function(_0x497843){logger[_0x9360('0x10')](_0x9360('0x36'),_0x497843[_0x9360('0x18')],_0x444edc);_0x5cc35f(_0x5f4c5f[_0x9360('0x10')](0x1f4,_0x497843[_0x9360('0x18')]));});});};exports['GetContactRecallMe']=function(_0x4366de){var _0x57c5f8=this;return new Promise(function(_0x5c445b,_0x3428ad){return db[_0x9360('0x23')]['describe']()[_0x9360('0x14')](function(){return db[_0x9360('0x25')]['transaction'](function(_0x919c94){return db[_0x9360('0x6')][_0x9360('0x7')]({'where':_0x4366de[_0x9360('0x8')]?_0x4366de[_0x9360('0x8')]['where']||null:null,'attributes':_0x4366de[_0x9360('0x8')]?_0x4366de['options'][_0x9360('0xa')]||null:null,'limit':0x1,'order':_0x4366de[_0x9360('0x8')]?_0x4366de['options']['order']||null:null,'group':db[_0x9360('0x6')]['UserId'],'transaction':_0x919c94,'lock':_0x919c94[_0x9360('0x28')][_0x9360('0x3d')],'include':_0x4366de[_0x9360('0x8')]?_0x4366de[_0x9360('0x8')][_0x9360('0xc')]?_[_0x9360('0xe')](_0x4366de[_0x9360('0x8')][_0x9360('0xc')],function(_0x2f37b0){return{'model':db[_0x2f37b0['model']],'as':_0x2f37b0['as'],'attributes':_0x2f37b0['attributes'],'include':_0x2f37b0[_0x9360('0xc')]?_[_0x9360('0xe')](_0x2f37b0[_0x9360('0xc')],function(_0x10369e){return{'model':db[_0x10369e['model']],'as':_0x10369e['as'],'attributes':_0x10369e[_0x9360('0xa')],'include':_0x10369e[_0x9360('0xc')]?_[_0x9360('0xe')](_0x10369e['include'],function(_0x17cf42){return{'model':db[_0x17cf42[_0x9360('0xd')]],'as':_0x17cf42['as'],'attributes':_0x17cf42['attributes']};}):[]};}):[]};}):[]:[]})[_0x9360('0x14')](function(_0x1881e3){var _0x4c7ea4=[];for(var _0x96a434=0x0;_0x96a434<_0x1881e3[_0x9360('0x2c')];_0x96a434+=0x1){_0x4c7ea4['push'](_0x1881e3[_0x96a434][_0x9360('0x1c')](_0x4366de[_0x9360('0x1b')],{'transaction':_0x919c94}));}return BPromise[_0x9360('0x30')](_0x4c7ea4);});})[_0x9360('0x14')](function(_0x3771fd){logger[_0x9360('0x15')]('GetContactRecallMe',_0x4366de);logger[_0x9360('0x16')](_0x9360('0x3e'),_0x4366de,JSON[_0x9360('0xf')](_0x3771fd));_0x5c445b(_0x3771fd);})[_0x9360('0x17')](function(_0x4fbc9f){logger[_0x9360('0x10')](_0x9360('0x3e'),_0x4fbc9f[_0x9360('0x18')],_0x4366de);_0x3428ad(_0x57c5f8[_0x9360('0x10')](0x1f4,_0x4fbc9f[_0x9360('0x18')]));});});});};exports['GetCmHopperPreview']=function(_0x9c70e1){var _0x4ef004=this;return new Promise(function(_0x1baf57,_0x5d44f6){db[_0x9360('0x23')][_0x9360('0x24')]()[_0x9360('0x14')](function(_0x34ad02){return db[_0x9360('0x6')][_0x9360('0x7')]({'raw':_0x9c70e1[_0x9360('0x8')]?_0x9c70e1[_0x9360('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x9c70e1[_0x9360('0x8')]?_0x9c70e1[_0x9360('0x8')]['where']||null:null,'attributes':_0x9c70e1[_0x9360('0x8')]?_0x9c70e1[_0x9360('0x8')][_0x9360('0xa')]||null:null,'limit':_0x9c70e1[_0x9360('0x8')]?_0x9c70e1[_0x9360('0x8')][_0x9360('0xb')]||null:null,'include':_0x9c70e1[_0x9360('0x8')]?_0x9c70e1[_0x9360('0x8')][_0x9360('0xc')]?_['map'](_0x9c70e1[_0x9360('0x8')][_0x9360('0xc')],function(_0x364592){return{'model':db[_0x364592[_0x9360('0xd')]],'as':_0x364592['as'],'attributes':_0x364592['as']===_0x9360('0x29')?_['keys'](_0x34ad02):_0x364592[_0x9360('0xa')],'include':_0x364592[_0x9360('0xc')]?_[_0x9360('0xe')](_0x364592[_0x9360('0xc')],function(_0x2655d7){return{'model':db[_0x2655d7[_0x9360('0xd')]],'as':_0x2655d7['as'],'attributes':_0x2655d7['attributes'],'include':_0x2655d7[_0x9360('0xc')]?_[_0x9360('0xe')](_0x2655d7[_0x9360('0xc')],function(_0x285c48){return{'model':db[_0x285c48[_0x9360('0xd')]],'as':_0x285c48['as'],'attributes':_0x285c48[_0x9360('0xa')]};}):[]};}):[]};}):[]:[]})[_0x9360('0x14')](function(_0x5497e2){logger['info']('GetCmHopper',_0x9c70e1);logger[_0x9360('0x16')](_0x9360('0x5'),_0x9c70e1,JSON[_0x9360('0xf')](_0x5497e2));_0x1baf57(_0x5497e2);})[_0x9360('0x17')](function(_0x2b6a3e){logger[_0x9360('0x10')](_0x9360('0x5'),_0x2b6a3e['message'],_0x9c70e1);_0x5d44f6(_0x4ef004[_0x9360('0x10')](0x1f4,_0x2b6a3e[_0x9360('0x18')]));});});});};exports[_0x9360('0x3f')]=function(_0x29e55b){var _0x306825=this;return new Promise(function(_0x1364cc,_0x1f792e){return db[_0x9360('0x23')][_0x9360('0x40')]({'raw':!![],'where':{'phone':_0x29e55b[_0x9360('0x8')]['where'][_0x9360('0x41')]},'attributes':['id',_0x9360('0x42')],'order':[['id',_0x9360('0x43')]]})[_0x9360('0x14')](function(_0x162d12){logger[_0x9360('0x15')](_0x9360('0x44'),_0x29e55b);logger[_0x9360('0x16')](_0x9360('0x44'),_0x29e55b,JSON[_0x9360('0xf')](_0x162d12));_0x1364cc(_0x162d12);})[_0x9360('0x17')](function(_0x23f371){logger['error'](_0x9360('0x44'),_0x23f371['message'],_0x29e55b);_0x1f792e(_0x306825['error'](0x1f4,_0x23f371[_0x9360('0x18')]));});});};exports[_0x9360('0x45')]=function(_0x3606ca){var _0x1a4d33=this;return new Promise(function(_0x357f8f,_0x13dcf1){return db[_0x9360('0x25')][_0x9360('0x26')](function(_0x568276){var _0x1d7809=_0x3606ca[_0x9360('0x8')]&&_0x3606ca[_0x9360('0x8')][_0x9360('0x9')]?_0x3606ca[_0x9360('0x8')][_0x9360('0x9')]:{};return db['CmHopper'][_0x9360('0x1c')](_0x3606ca[_0x9360('0x1b')],{'where':_0x1d7809,'transaction':_0x568276})[_0x9360('0x14')](function(_0x2b4f40){logger[_0x9360('0x15')]('ResetActiveCalls',_0x3606ca);logger[_0x9360('0x16')](_0x9360('0x45'),_0x3606ca,JSON['stringify'](_0x2b4f40));_0x357f8f(_0x2b4f40);})[_0x9360('0x17')](function(_0x213d2a){logger[_0x9360('0x10')](_0x9360('0x45'),_0x213d2a[_0x9360('0x18')],_0x3606ca);_0x13dcf1(_0x1a4d33['error'](0x1f4,_0x213d2a[_0x9360('0x18')]));});});});};exports[_0x9360('0x46')]=function(_0x4056ea){var _0x16b4a4=this;var _0x2036f5=_0x4056ea['body'][_0x9360('0x9')][_0x9360('0x47')];var _0x4b14e6=_0x4056ea['body']['where']['interval'];var _0x3ef80e=_0x4056ea[_0x9360('0x1b')][_0x9360('0x9')]['availableAgentsIds'];return new Promise(function(_0xb8d1b7,_0x4cc340){return db[_0x9360('0x6')][_0x9360('0x7')]({'where':{'voiceQueueId':{'$in':_0x2036f5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x4b14e6+'\x20MINUTE'),'$gt':db[_0x9360('0x25')]['literal']('NOW()')}},'UserId':{'$in':_0x3ef80e}},'include':[{'model':db[_0x9360('0x23')],'as':_0x9360('0x29')},{'model':db[_0x9360('0x2b')],'as':'Agent','attributes':['id',_0x9360('0x48'),_0x9360('0x49')]},{'model':db[_0x9360('0x4a')],'as':'List'}]})[_0x9360('0x14')](function(_0x1c4ad2){if(_0x1c4ad2[_0x9360('0x2c')]>0x0){return db[_0x9360('0x25')][_0x9360('0x26')](function(_0x45ce90){return db['CmHopper'][_0x9360('0x1c')]({'recallmeNotifiedDate':db[_0x9360('0x25')]['literal'](_0x9360('0x4b'))},{'where':{'id':{'$in':_['map'](_0x1c4ad2,'id')}},'transaction':_0x45ce90})[_0x9360('0x14')](function(){_0xb8d1b7(_0x1c4ad2);})[_0x9360('0x17')](function(_0xc4c9be){logger[_0x9360('0x10')](_0x9360('0x46'),_0xc4c9be[_0x9360('0x18')],_0x4056ea);_0x4cc340(_0x16b4a4[_0x9360('0x10')](0x1f4,_0xc4c9be[_0x9360('0x18')]));});})[_0x9360('0x17')](function(_0xf03eaa){logger['error']('CmHopperHandlePreviewRecallNotifications',_0xf03eaa['message'],_0x4056ea);_0x4cc340(_0x16b4a4[_0x9360('0x10')](0x1f4,_0xf03eaa[_0x9360('0x18')]));});}else{_0xb8d1b7(_0x1c4ad2);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 86657a2..d5be43c 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 _0x400f=['Router','../../components/auth/service','./cmHopper.controller','get','/describe','describe','/opencontacts','isAuthenticated','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','exports','express'];(function(_0x41c180,_0xb61130){var _0x530899=function(_0x1dac19){while(--_0x1dac19){_0x41c180['push'](_0x41c180['shift']());}};_0x530899(++_0xb61130);}(_0x400f,0x197));var _0xf400=function(_0x5c4813,_0x1990a5){_0x5c4813=_0x5c4813-0x0;var _0x22fa96=_0x400f[_0x5c4813];return _0x22fa96;};'use strict';var express=require(_0xf400('0x0'));var router=express[_0xf400('0x1')]();var auth=require(_0xf400('0x2'));var controller=require(_0xf400('0x3'));router[_0xf400('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf400('0x4')](_0xf400('0x5'),auth['isAuthenticated'](),controller[_0xf400('0x6')]);router[_0xf400('0x4')](_0xf400('0x7'),auth[_0xf400('0x8')](),controller['getOpenContacts']);router[_0xf400('0x4')](_0xf400('0x9'),auth[_0xf400('0x8')](),controller[_0xf400('0xa')]);router['get'](_0xf400('0xb'),auth[_0xf400('0x8')](),controller['show']);router['get'](_0xf400('0xc'),auth[_0xf400('0x8')](),controller[_0xf400('0xd')]);router[_0xf400('0xe')]('/',auth[_0xf400('0x8')](),controller[_0xf400('0xf')]);router[_0xf400('0xe')](_0xf400('0x10'),auth[_0xf400('0x8')](),controller[_0xf400('0x11')]);router['post'](_0xf400('0x12'),auth['isAuthenticated'](),controller[_0xf400('0x13')]);router['put'](_0xf400('0xb'),auth[_0xf400('0x8')](),controller[_0xf400('0x14')]);router[_0xf400('0x15')](_0xf400('0xb'),auth[_0xf400('0x8')](),controller[_0xf400('0x16')]);module[_0xf400('0x17')]=router; \ No newline at end of file +var _0x8e70=['/:id/previewrecall','post','getPreview','/timezone','getTimezone','put','update','delete','express','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x1540a1,_0x2a2868){var _0x49df92=function(_0x316a1b){while(--_0x316a1b){_0x1540a1['push'](_0x1540a1['shift']());}};_0x49df92(++_0x2a2868);}(_0x8e70,0x198));var _0x08e7=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8e70[_0x5f3f88];return _0xd08119;};'use strict';var express=require(_0x08e7('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x08e7('0x1'));router[_0x08e7('0x2')]('/',auth[_0x08e7('0x3')](),controller[_0x08e7('0x4')]);router[_0x08e7('0x2')](_0x08e7('0x5'),auth[_0x08e7('0x3')](),controller[_0x08e7('0x6')]);router[_0x08e7('0x2')](_0x08e7('0x7'),auth[_0x08e7('0x3')](),controller[_0x08e7('0x8')]);router[_0x08e7('0x2')](_0x08e7('0x9'),auth[_0x08e7('0x3')](),controller[_0x08e7('0xa')]);router[_0x08e7('0x2')](_0x08e7('0xb'),auth[_0x08e7('0x3')](),controller['show']);router[_0x08e7('0x2')](_0x08e7('0xc'),auth[_0x08e7('0x3')](),controller['getPreviewRecall']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x08e7('0xd')]('/preview',auth[_0x08e7('0x3')](),controller[_0x08e7('0xe')]);router[_0x08e7('0xd')](_0x08e7('0xf'),auth[_0x08e7('0x3')](),controller[_0x08e7('0x10')]);router[_0x08e7('0x11')](_0x08e7('0xb'),auth[_0x08e7('0x3')](),controller[_0x08e7('0x12')]);router[_0x08e7('0x13')](_0x08e7('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index b974e0d..22ba6de 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 _0x265b=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','STRING'];(function(_0x52c574,_0x4a2363){var _0x443112=function(_0x397077){while(--_0x397077){_0x52c574['push'](_0x52c574['shift']());}};_0x443112(++_0x4a2363);}(_0x265b,0x1f4));var _0xb265=function(_0x2361d1,_0x45da47){_0x2361d1=_0x2361d1-0x0;var _0x455a08=_0x265b[_0x2361d1];return _0x455a08;};'use strict';var moment=require(_0xb265('0x0'));var Sequelize=require('sequelize');module[_0xb265('0x1')]={'CmHopperId':{'type':Sequelize[_0xb265('0x2')]},'phone':{'type':Sequelize[_0xb265('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb265('0x4')],'defaultValue':moment()[_0xb265('0x5')](_0xb265('0x6'))},'countbusyretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb265('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd593=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd593,0x1a3));var _0x3d59=function(_0x53b488,_0x1fa987){_0x53b488=_0x53b488-0x0;var _0x133185=_0xd593[_0x53b488];return _0x133185;};'use strict';var moment=require(_0x3d59('0x0'));var Sequelize=require(_0x3d59('0x1'));module[_0x3d59('0x2')]={'CmHopperId':{'type':Sequelize[_0x3d59('0x3')]},'phone':{'type':Sequelize[_0x3d59('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3d59('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3d59('0x5')],'defaultValue':moment()[_0x3d59('0x6')](_0x3d59('0x7'))},'countbusyretry':{'type':Sequelize[_0x3d59('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3d59('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3d59('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3d59('0x3')],'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/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index c9e0647..991564b 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 _0xb127=['find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','keys','includeAll'];(function(_0x5a5f1d,_0x3359d8){var _0x597cf4=function(_0x5456d2){while(--_0x5456d2){_0x5a5f1d['push'](_0x5a5f1d['shift']());}};_0x597cf4(++_0x3359d8);}(_0xb127,0x19e));var _0x7b12=function(_0x20ad33,_0xf8c753){_0x20ad33=_0x20ad33-0x0;var _0x362c55=_0xb127[_0x20ad33];return _0x362c55;};'use strict';var emlformat=require(_0x7b12('0x0'));var rimraf=require(_0x7b12('0x1'));var zipdir=require(_0x7b12('0x2'));var jsonpatch=require(_0x7b12('0x3'));var rp=require(_0x7b12('0x4'));var moment=require('moment');var BPromise=require(_0x7b12('0x5'));var Mustache=require('mustache');var util=require(_0x7b12('0x6'));var path=require(_0x7b12('0x7'));var sox=require('sox');var csv=require(_0x7b12('0x8'));var ejs=require(_0x7b12('0x9'));var fs=require('fs');var fs_extra=require(_0x7b12('0xa'));var _=require(_0x7b12('0xb'));var squel=require(_0x7b12('0xc'));var crypto=require(_0x7b12('0xd'));var jsforce=require(_0x7b12('0xe'));var deskjs=require(_0x7b12('0xf'));var toCsv=require(_0x7b12('0x8'));var querystring=require(_0x7b12('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7b12('0x11'));var hardwareService=require(_0x7b12('0x12'));var logger=require(_0x7b12('0x13'))(_0x7b12('0x14'));var utils=require('../../config/utils');var config=require(_0x7b12('0x15'));var licenseUtil=require(_0x7b12('0x16'));var db=require(_0x7b12('0x17'))['db'];function respondWithStatusCode(_0x4b24e1,_0x31aeae){_0x31aeae=_0x31aeae||0xcc;return function(_0x160db2){if(_0x160db2){return _0x4b24e1[_0x7b12('0x18')](_0x31aeae);}return _0x4b24e1[_0x7b12('0x19')](_0x31aeae)[_0x7b12('0x1a')]();};}function respondWithResult(_0x55b3d8,_0x557636){_0x557636=_0x557636||0xc8;return function(_0x96ff80){if(_0x96ff80){return _0x55b3d8[_0x7b12('0x19')](_0x557636)[_0x7b12('0x1b')](_0x96ff80);}};}function respondWithFilteredResult(_0x3a0b5d,_0x122f0f){return function(_0x3ffdea){if(_0x3ffdea){var _0x20cc05=typeof _0x122f0f[_0x7b12('0x1c')]===_0x7b12('0x1d')&&typeof _0x122f0f[_0x7b12('0x1e')]==='undefined';var _0x593f4e=_0x3ffdea[_0x7b12('0x1f')];var _0x53979f=_0x20cc05?0x0:_0x122f0f['offset'];var _0x41a086=_0x20cc05?_0x3ffdea['count']:_0x122f0f['offset']+_0x122f0f[_0x7b12('0x1e')];var _0x1d1737;if(_0x41a086>=_0x593f4e){_0x41a086=_0x593f4e;_0x1d1737=0xc8;}else{_0x1d1737=0xce;}_0x3a0b5d['status'](_0x1d1737);return _0x3a0b5d['set']('Content-Range',_0x53979f+'-'+_0x41a086+'/'+_0x593f4e)[_0x7b12('0x1b')](_0x3ffdea);}return null;};}function patchUpdates(_0x50ec75){return function(_0x30d96f){try{jsonpatch[_0x7b12('0x20')](_0x30d96f,_0x50ec75,!![]);}catch(_0x295492){return BPromise['reject'](_0x295492);}return _0x30d96f[_0x7b12('0x21')]();};}function saveUpdates(_0x1c4636,_0x2388b5){return function(_0x2fdcb6){if(_0x2fdcb6){return _0x2fdcb6[_0x7b12('0x22')](_0x1c4636)['then'](function(_0x32bded){return _0x32bded;});}return null;};}function removeEntity(_0x5f2e71,_0x408872){return function(_0x19b18a){if(_0x19b18a){return _0x19b18a['destroy']()['then'](function(){var _0x31b6c2=_0x19b18a[_0x7b12('0x23')]({'plain':!![]});var _0x1b182c=_0x7b12('0x24');return db[_0x7b12('0x25')][_0x7b12('0x26')]({'where':{'type':_0x1b182c,'resourceId':_0x31b6c2['id']}})['then'](function(){return _0x19b18a;});})['then'](function(){_0x5f2e71[_0x7b12('0x19')](0xcc)[_0x7b12('0x1a')]();});}};}function handleEntityNotFound(_0x368961,_0x1237bd){return function(_0x1badfe){if(!_0x1badfe){_0x368961[_0x7b12('0x18')](0x194);}return _0x1badfe;};}function handleError(_0x1f2c58,_0x3a3cc9){_0x3a3cc9=_0x3a3cc9||0x1f4;return function(_0x31d44a){logger[_0x7b12('0x27')](_0x31d44a[_0x7b12('0x28')]);if(_0x31d44a['name']){delete _0x31d44a[_0x7b12('0x29')];}_0x1f2c58[_0x7b12('0x19')](_0x3a3cc9)[_0x7b12('0x2a')](_0x31d44a);};}exports[_0x7b12('0x2b')]=function(_0x45e0c3,_0x178155){var _0x1964d1={},_0x51094e={},_0x50241c={'count':0x0,'rows':[]};var _0x11e302=_[_0x7b12('0x2c')](db[_0x7b12('0x2d')][_0x7b12('0x2e')],function(_0x22bed3){return{'name':_0x22bed3[_0x7b12('0x2f')],'type':_0x22bed3[_0x7b12('0x30')][_0x7b12('0x31')]};});_0x51094e[_0x7b12('0x32')]=_['map'](_0x11e302,_0x7b12('0x29'));_0x51094e[_0x7b12('0x33')]=_['keys'](_0x45e0c3[_0x7b12('0x33')]);_0x51094e[_0x7b12('0x34')]=_[_0x7b12('0x35')](_0x51094e[_0x7b12('0x32')],_0x51094e[_0x7b12('0x33')]);_0x1964d1[_0x7b12('0x36')]=_[_0x7b12('0x35')](_0x51094e[_0x7b12('0x32')],qs[_0x7b12('0x37')](_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x37')]));_0x1964d1[_0x7b12('0x36')]=_0x1964d1[_0x7b12('0x36')][_0x7b12('0x38')]?_0x1964d1[_0x7b12('0x36')]:_0x51094e[_0x7b12('0x32')];if(!_0x45e0c3[_0x7b12('0x33')]['hasOwnProperty']('nolimit')){_0x1964d1[_0x7b12('0x1e')]=qs[_0x7b12('0x1e')](_0x45e0c3['query']['limit']);_0x1964d1[_0x7b12('0x1c')]=qs['offset'](_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x1c')]);}_0x1964d1[_0x7b12('0x39')]=qs[_0x7b12('0x3a')](_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x3a')]);_0x1964d1[_0x7b12('0x3b')]=qs[_0x7b12('0x34')](_[_0x7b12('0x3c')](_0x45e0c3[_0x7b12('0x33')],_0x51094e[_0x7b12('0x34')]),_0x11e302);if(_0x45e0c3[_0x7b12('0x33')][_0x7b12('0x3d')]){_0x1964d1[_0x7b12('0x3b')]=_[_0x7b12('0x3e')](_0x1964d1['where'],{'$or':_['map'](_0x11e302,function(_0x2cceb6){if(_0x2cceb6['type']!==_0x7b12('0x3f')){var _0x300332={};_0x300332[_0x2cceb6[_0x7b12('0x29')]]={'$like':'%'+_0x45e0c3[_0x7b12('0x33')]['filter']+'%'};return _0x300332;}})});}_0x1964d1=_['merge']({},_0x1964d1,_0x45e0c3[_0x7b12('0x40')]);var _0x165f57={'where':_0x1964d1[_0x7b12('0x3b')]};return db['CmHopperAdditionalPhone'][_0x7b12('0x1f')](_0x165f57)[_0x7b12('0x41')](function(_0xf79122){_0x50241c['count']=_0xf79122;if(_0x45e0c3[_0x7b12('0x33')]['includeAll']){_0x1964d1[_0x7b12('0x42')]=[{'all':!![]}];}return db[_0x7b12('0x2d')][_0x7b12('0x43')](_0x1964d1);})[_0x7b12('0x41')](function(_0x1b38fb){_0x50241c[_0x7b12('0x44')]=_0x1b38fb;return _0x50241c;})['then'](respondWithFilteredResult(_0x178155,_0x1964d1))[_0x7b12('0x45')](handleError(_0x178155,null));};exports['show']=function(_0x59af71,_0x5e2739){var _0x787371={'raw':!![],'where':{'id':_0x59af71['params']['id']}},_0x3c9a55={};_0x3c9a55['model']=_['keys'](db[_0x7b12('0x2d')][_0x7b12('0x2e')]);_0x3c9a55['query']=_[_0x7b12('0x46')](_0x59af71[_0x7b12('0x33')]);_0x3c9a55[_0x7b12('0x34')]=_[_0x7b12('0x35')](_0x3c9a55[_0x7b12('0x32')],_0x3c9a55[_0x7b12('0x33')]);_0x787371[_0x7b12('0x36')]=_['intersection'](_0x3c9a55[_0x7b12('0x32')],qs[_0x7b12('0x37')](_0x59af71[_0x7b12('0x33')][_0x7b12('0x37')]));_0x787371[_0x7b12('0x36')]=_0x787371[_0x7b12('0x36')]['length']?_0x787371[_0x7b12('0x36')]:_0x3c9a55['model'];if(_0x59af71[_0x7b12('0x33')][_0x7b12('0x47')]){_0x787371[_0x7b12('0x42')]=[{'all':!![]}];}_0x787371=_[_0x7b12('0x3e')]({},_0x787371,_0x59af71[_0x7b12('0x40')]);return db['CmHopperAdditionalPhone'][_0x7b12('0x48')](_0x787371)[_0x7b12('0x41')](handleEntityNotFound(_0x5e2739,null))['then'](respondWithResult(_0x5e2739,null))['catch'](handleError(_0x5e2739,null));};exports[_0x7b12('0x49')]=function(_0x398255,_0x5a2185){return db[_0x7b12('0x2d')][_0x7b12('0x49')](_0x398255[_0x7b12('0x4a')],{})[_0x7b12('0x41')](function(_0x5ea439){var _0x593478=_0x398255[_0x7b12('0x4b')][_0x7b12('0x23')]({'plain':!![]});if(!_0x593478)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x593478[_0x7b12('0x4c')]===_0x7b12('0x4b')){var _0x4cf9e3=_0x5ea439[_0x7b12('0x23')]({'plain':!![]});var _0x151050=_0x7b12('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x151050,'userProfileId':_0x593478[_0x7b12('0x4d')]},'raw':!![]})[_0x7b12('0x41')](function(_0xe139e){if(_0xe139e&&_0xe139e[_0x7b12('0x4e')]===0x0){return db[_0x7b12('0x25')][_0x7b12('0x49')]({'name':_0x4cf9e3[_0x7b12('0x29')],'resourceId':_0x4cf9e3['id'],'type':_0xe139e[_0x7b12('0x29')],'sectionId':_0xe139e['id']},{})[_0x7b12('0x41')](function(){return _0x5ea439;});}else{return _0x5ea439;}})[_0x7b12('0x45')](function(_0xdd20a1){logger[_0x7b12('0x27')](_0x7b12('0x4f'),_0xdd20a1);throw _0xdd20a1;});}return _0x5ea439;})['then'](respondWithResult(_0x5a2185,0xc9))[_0x7b12('0x45')](handleError(_0x5a2185,null));};exports['update']=function(_0x4cea5b,_0x5539dd){if(_0x4cea5b[_0x7b12('0x4a')]['id']){delete _0x4cea5b[_0x7b12('0x4a')]['id'];}return db[_0x7b12('0x2d')]['find']({'where':{'id':_0x4cea5b[_0x7b12('0x50')]['id']}})[_0x7b12('0x41')](handleEntityNotFound(_0x5539dd,null))[_0x7b12('0x41')](saveUpdates(_0x4cea5b[_0x7b12('0x4a')],null))[_0x7b12('0x41')](respondWithResult(_0x5539dd,null))[_0x7b12('0x45')](handleError(_0x5539dd,null));};exports[_0x7b12('0x26')]=function(_0x58846b,_0x31657f){return db['CmHopperAdditionalPhone'][_0x7b12('0x48')]({'where':{'id':_0x58846b[_0x7b12('0x50')]['id']}})[_0x7b12('0x41')](handleEntityNotFound(_0x31657f,null))['then'](removeEntity(_0x31657f,null))[_0x7b12('0x45')](handleError(_0x31657f,null));}; \ No newline at end of file +var _0x880e=['fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes'];(function(_0xeeb6ae,_0x451cde){var _0x4507aa=function(_0x45edbe){while(--_0x45edbe){_0xeeb6ae['push'](_0xeeb6ae['shift']());}};_0x4507aa(++_0x451cde);}(_0x880e,0x111));var _0xe880=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x880e[_0x2a3c4d];return _0x55c390;};'use strict';var emlformat=require(_0xe880('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe880('0x1'));var jsonpatch=require(_0xe880('0x2'));var rp=require(_0xe880('0x3'));var moment=require(_0xe880('0x4'));var BPromise=require(_0xe880('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe880('0x6'));var sox=require('sox');var csv=require(_0xe880('0x7'));var ejs=require(_0xe880('0x8'));var fs=require('fs');var fs_extra=require(_0xe880('0x9'));var _=require(_0xe880('0xa'));var squel=require(_0xe880('0xb'));var crypto=require('crypto');var jsforce=require(_0xe880('0xc'));var deskjs=require(_0xe880('0xd'));var toCsv=require(_0xe880('0x7'));var querystring=require(_0xe880('0xe'));var Papa=require(_0xe880('0xf'));var Redis=require(_0xe880('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe880('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe880('0x12'));var utils=require(_0xe880('0x13'));var config=require(_0xe880('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe880('0x15'))['db'];function respondWithStatusCode(_0x473cf2,_0xc339ce){_0xc339ce=_0xc339ce||0xcc;return function(_0x1a6926){if(_0x1a6926){return _0x473cf2[_0xe880('0x16')](_0xc339ce);}return _0x473cf2[_0xe880('0x17')](_0xc339ce)[_0xe880('0x18')]();};}function respondWithResult(_0x427528,_0x2d7eb1){_0x2d7eb1=_0x2d7eb1||0xc8;return function(_0x3aef91){if(_0x3aef91){return _0x427528[_0xe880('0x17')](_0x2d7eb1)[_0xe880('0x19')](_0x3aef91);}};}function respondWithFilteredResult(_0x2894d2,_0x408179){return function(_0x55fb06){if(_0x55fb06){var _0x57c921=typeof _0x408179['offset']===_0xe880('0x1a')&&typeof _0x408179[_0xe880('0x1b')]===_0xe880('0x1a');var _0x9b321e=_0x55fb06['count'];var _0x55f059=_0x57c921?0x0:_0x408179[_0xe880('0x1c')];var _0x143932=_0x57c921?_0x55fb06[_0xe880('0x1d')]:_0x408179[_0xe880('0x1c')]+_0x408179[_0xe880('0x1b')];var _0x54c9e8;if(_0x143932>=_0x9b321e){_0x143932=_0x9b321e;_0x54c9e8=0xc8;}else{_0x54c9e8=0xce;}_0x2894d2[_0xe880('0x17')](_0x54c9e8);return _0x2894d2[_0xe880('0x1e')](_0xe880('0x1f'),_0x55f059+'-'+_0x143932+'/'+_0x9b321e)[_0xe880('0x19')](_0x55fb06);}return null;};}function patchUpdates(_0x3f25c3){return function(_0x1972af){try{jsonpatch[_0xe880('0x20')](_0x1972af,_0x3f25c3,!![]);}catch(_0x47aca3){return BPromise[_0xe880('0x21')](_0x47aca3);}return _0x1972af['save']();};}function saveUpdates(_0x420d8e,_0x4a661b){return function(_0x35c4ee){if(_0x35c4ee){return _0x35c4ee[_0xe880('0x22')](_0x420d8e)['then'](function(_0x34ec9a){return _0x34ec9a;});}return null;};}function removeEntity(_0x5154b6,_0x2be973){return function(_0x2f2200){if(_0x2f2200){return _0x2f2200[_0xe880('0x23')]()[_0xe880('0x24')](function(){var _0x54423c=_0x2f2200[_0xe880('0x25')]({'plain':!![]});var _0xe1f423=_0xe880('0x26');return db[_0xe880('0x27')][_0xe880('0x23')]({'where':{'type':_0xe1f423,'resourceId':_0x54423c['id']}})[_0xe880('0x24')](function(){return _0x2f2200;});})[_0xe880('0x24')](function(){_0x5154b6['status'](0xcc)[_0xe880('0x18')]();});}};}function handleEntityNotFound(_0x2082ab,_0x5e31a8){return function(_0x98e276){if(!_0x98e276){_0x2082ab['sendStatus'](0x194);}return _0x98e276;};}function handleError(_0x3fef70,_0x4293a8){_0x4293a8=_0x4293a8||0x1f4;return function(_0x138edf){logger[_0xe880('0x28')](_0x138edf[_0xe880('0x29')]);if(_0x138edf[_0xe880('0x2a')]){delete _0x138edf[_0xe880('0x2a')];}_0x3fef70['status'](_0x4293a8)[_0xe880('0x2b')](_0x138edf);};}exports['index']=function(_0x5522fe,_0x532f98){var _0x19df2a={},_0x1a983c={},_0x549e70={'count':0x0,'rows':[]};var _0x27f564=_[_0xe880('0x2c')](db[_0xe880('0x2d')][_0xe880('0x2e')],function(_0x1288c6){return{'name':_0x1288c6[_0xe880('0x2f')],'type':_0x1288c6[_0xe880('0x30')]['key']};});_0x1a983c[_0xe880('0x31')]=_[_0xe880('0x2c')](_0x27f564,_0xe880('0x2a'));_0x1a983c[_0xe880('0x32')]=_[_0xe880('0x33')](_0x5522fe[_0xe880('0x32')]);_0x1a983c[_0xe880('0x34')]=_[_0xe880('0x35')](_0x1a983c[_0xe880('0x31')],_0x1a983c[_0xe880('0x32')]);_0x19df2a['attributes']=_[_0xe880('0x35')](_0x1a983c['model'],qs[_0xe880('0x36')](_0x5522fe[_0xe880('0x32')]['fields']));_0x19df2a[_0xe880('0x37')]=_0x19df2a[_0xe880('0x37')][_0xe880('0x38')]?_0x19df2a[_0xe880('0x37')]:_0x1a983c[_0xe880('0x31')];if(!_0x5522fe[_0xe880('0x32')][_0xe880('0x39')]('nolimit')){_0x19df2a[_0xe880('0x1b')]=qs[_0xe880('0x1b')](_0x5522fe[_0xe880('0x32')][_0xe880('0x1b')]);_0x19df2a[_0xe880('0x1c')]=qs[_0xe880('0x1c')](_0x5522fe[_0xe880('0x32')][_0xe880('0x1c')]);}_0x19df2a[_0xe880('0x3a')]=qs[_0xe880('0x3b')](_0x5522fe[_0xe880('0x32')][_0xe880('0x3b')]);_0x19df2a[_0xe880('0x3c')]=qs[_0xe880('0x34')](_['pick'](_0x5522fe['query'],_0x1a983c[_0xe880('0x34')]),_0x27f564);if(_0x5522fe[_0xe880('0x32')][_0xe880('0x3d')]){_0x19df2a[_0xe880('0x3c')]=_[_0xe880('0x3e')](_0x19df2a[_0xe880('0x3c')],{'$or':_[_0xe880('0x2c')](_0x27f564,function(_0x212bae){if(_0x212bae[_0xe880('0x30')]!==_0xe880('0x3f')){var _0x2bba9c={};_0x2bba9c[_0x212bae[_0xe880('0x2a')]]={'$like':'%'+_0x5522fe['query']['filter']+'%'};return _0x2bba9c;}})});}_0x19df2a=_[_0xe880('0x3e')]({},_0x19df2a,_0x5522fe[_0xe880('0x40')]);var _0x2a24d4={'where':_0x19df2a['where']};return db[_0xe880('0x2d')][_0xe880('0x1d')](_0x2a24d4)[_0xe880('0x24')](function(_0x1139a9){_0x549e70[_0xe880('0x1d')]=_0x1139a9;if(_0x5522fe[_0xe880('0x32')][_0xe880('0x41')]){_0x19df2a[_0xe880('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xe880('0x43')](_0x19df2a);})[_0xe880('0x24')](function(_0x8605bd){_0x549e70['rows']=_0x8605bd;return _0x549e70;})[_0xe880('0x24')](respondWithFilteredResult(_0x532f98,_0x19df2a))[_0xe880('0x44')](handleError(_0x532f98,null));};exports[_0xe880('0x45')]=function(_0x30f50c,_0x298933){var _0x5aeffa={'raw':!![],'where':{'id':_0x30f50c[_0xe880('0x46')]['id']}},_0x2f9665={};_0x2f9665[_0xe880('0x31')]=_['keys'](db['CmHopperAdditionalPhone'][_0xe880('0x2e')]);_0x2f9665['query']=_['keys'](_0x30f50c['query']);_0x2f9665['filters']=_[_0xe880('0x35')](_0x2f9665[_0xe880('0x31')],_0x2f9665[_0xe880('0x32')]);_0x5aeffa[_0xe880('0x37')]=_[_0xe880('0x35')](_0x2f9665[_0xe880('0x31')],qs[_0xe880('0x36')](_0x30f50c[_0xe880('0x32')][_0xe880('0x36')]));_0x5aeffa[_0xe880('0x37')]=_0x5aeffa[_0xe880('0x37')]['length']?_0x5aeffa['attributes']:_0x2f9665[_0xe880('0x31')];if(_0x30f50c[_0xe880('0x32')][_0xe880('0x41')]){_0x5aeffa[_0xe880('0x42')]=[{'all':!![]}];}_0x5aeffa=_[_0xe880('0x3e')]({},_0x5aeffa,_0x30f50c[_0xe880('0x40')]);return db[_0xe880('0x2d')][_0xe880('0x47')](_0x5aeffa)[_0xe880('0x24')](handleEntityNotFound(_0x298933,null))[_0xe880('0x24')](respondWithResult(_0x298933,null))[_0xe880('0x44')](handleError(_0x298933,null));};exports[_0xe880('0x48')]=function(_0x13da18,_0x488477){return db['CmHopperAdditionalPhone'][_0xe880('0x48')](_0x13da18[_0xe880('0x49')],{})['then'](function(_0x9584b){var _0x313a08=_0x13da18[_0xe880('0x4a')][_0xe880('0x25')]({'plain':!![]});if(!_0x313a08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x313a08[_0xe880('0x4b')]==='user'){var _0x3469dc=_0x9584b[_0xe880('0x25')]({'plain':!![]});var _0x3f31e9='CmHopperAdditionalPhones';return db[_0xe880('0x4c')][_0xe880('0x47')]({'where':{'name':_0x3f31e9,'userProfileId':_0x313a08[_0xe880('0x4d')]},'raw':!![]})[_0xe880('0x24')](function(_0x14ab75){if(_0x14ab75&&_0x14ab75[_0xe880('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3469dc['name'],'resourceId':_0x3469dc['id'],'type':_0x14ab75[_0xe880('0x2a')],'sectionId':_0x14ab75['id']},{})[_0xe880('0x24')](function(){return _0x9584b;});}else{return _0x9584b;}})['catch'](function(_0x59ceec){logger['error'](_0xe880('0x4f'),_0x59ceec);throw _0x59ceec;});}return _0x9584b;})[_0xe880('0x24')](respondWithResult(_0x488477,0xc9))[_0xe880('0x44')](handleError(_0x488477,null));};exports['update']=function(_0x239e4d,_0x570636){if(_0x239e4d['body']['id']){delete _0x239e4d[_0xe880('0x49')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x239e4d[_0xe880('0x46')]['id']}})[_0xe880('0x24')](handleEntityNotFound(_0x570636,null))[_0xe880('0x24')](saveUpdates(_0x239e4d[_0xe880('0x49')],null))['then'](respondWithResult(_0x570636,null))[_0xe880('0x44')](handleError(_0x570636,null));};exports[_0xe880('0x23')]=function(_0x203989,_0x536de6){return db[_0xe880('0x2d')]['find']({'where':{'id':_0x203989[_0xe880('0x46')]['id']}})[_0xe880('0x24')](handleEntityNotFound(_0x536de6,null))[_0xe880('0x24')](removeEntity(_0x536de6,null))[_0xe880('0x44')](handleError(_0x536de6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index cabb9c6..0895d16 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 _0x7eed=['moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x34dd6e,_0x44ff16){var _0x3d2171=function(_0x4f1d4d){while(--_0x4f1d4d){_0x34dd6e['push'](_0x34dd6e['shift']());}};_0x3d2171(++_0x44ff16);}(_0x7eed,0xcc));var _0xd7ee=function(_0x49e77b,_0x59ced7){_0x49e77b=_0x49e77b-0x0;var _0x58b978=_0x7eed[_0x49e77b];return _0x58b978;};'use strict';var _=require(_0xd7ee('0x0'));var util=require(_0xd7ee('0x1'));var logger=require(_0xd7ee('0x2'))(_0xd7ee('0x3'));var moment=require(_0xd7ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xd7ee('0x5'));var fs=require('fs');var path=require(_0xd7ee('0x6'));var rimraf=require(_0xd7ee('0x7'));var config=require(_0xd7ee('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xd7ee('0x9')]=function(_0x347d92,_0x3e286f){return _0x347d92[_0xd7ee('0xa')](_0xd7ee('0xb'),attributes,{'tableName':_0xd7ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2318=['request-promise','../../config/environment','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','moment','bluebird'];(function(_0x3d142f,_0x31cabc){var _0x19bbea=function(_0x1bd32d){while(--_0x1bd32d){_0x3d142f['push'](_0x3d142f['shift']());}};_0x19bbea(++_0x31cabc);}(_0x2318,0x149));var _0x8231=function(_0x5cba43,_0x2a45c6){_0x5cba43=_0x5cba43-0x0;var _0x1a3055=_0x2318[_0x5cba43];return _0x1a3055;};'use strict';var _=require(_0x8231('0x0'));var util=require(_0x8231('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8231('0x2'));var BPromise=require(_0x8231('0x3'));var rp=require(_0x8231('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8231('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x62da24,_0x20535f){return _0x62da24[_0x8231('0x6')](_0x8231('0x7'),attributes,{'tableName':_0x8231('0x8'),'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 00ff2b8..550a88d 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 _0x972c=['countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','catch','SwapAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry'];(function(_0x29df5d,_0x4dbd4f){var _0x10d79c=function(_0x11b77f){while(--_0x11b77f){_0x29df5d['push'](_0x29df5d['shift']());}};_0x10d79c(++_0x4dbd4f);}(_0x972c,0x8c));var _0xc972=function(_0x4adcd6,_0x82da4c){_0x4adcd6=_0x4adcd6-0x0;var _0x267d62=_0x972c[_0x4adcd6];return _0x267d62;};'use strict';var _=require(_0xc972('0x0'));var util=require(_0xc972('0x1'));var moment=require(_0xc972('0x2'));var BPromise=require(_0xc972('0x3'));var rs=require(_0xc972('0x4'));var fs=require('fs');var Redis=require(_0xc972('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc972('0x6'));var logger=require(_0xc972('0x7'))(_0xc972('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x518144,_0x3437df,_0x1cc62d){return new BPromise(function(_0x9b2f0,_0x43271c){return client[_0xc972('0xa')](_0x518144,_0x1cc62d)[_0xc972('0xb')](function(_0x5b8481){logger[_0xc972('0xc')](_0xc972('0xd'),_0x3437df,_0xc972('0xe'));logger[_0xc972('0xf')](_0xc972('0x10'),_0x3437df,_0xc972('0xe'),JSON[_0xc972('0x11')](_0x5b8481));if(_0x5b8481[_0xc972('0x12')]){if(_0x5b8481[_0xc972('0x12')]['code']===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3437df,_0x5b8481[_0xc972('0x12')][_0xc972('0x13')]);return _0x43271c(_0x5b8481['error'][_0xc972('0x13')]);}logger['error'](_0xc972('0xd'),_0x3437df,_0x5b8481[_0xc972('0x12')]['message']);return _0x9b2f0(_0x5b8481[_0xc972('0x12')][_0xc972('0x13')]);}else{logger[_0xc972('0xc')](_0xc972('0xd'),_0x3437df,_0xc972('0xe'));_0x9b2f0(_0x5b8481[_0xc972('0x14')][_0xc972('0x13')]);}})['catch'](function(_0x56ed75){logger['error'](_0xc972('0xd'),_0x3437df,_0x56ed75);_0x43271c(_0x56ed75);});});}exports[_0xc972('0x15')]=function(_0x1eb608){var _0x5af5c7=this;return new Promise(function(_0x19d6c5,_0x15d129){return db['CmHopper'][_0xc972('0x16')]({'raw':!![],'where':{'ContactId':_0x1eb608[_0xc972('0x17')][_0xc972('0x18')],'ListId':_0x1eb608[_0xc972('0x17')][_0xc972('0x19')],'VoiceQueueId':_0x1eb608[_0xc972('0x17')][_0xc972('0x1a')]===undefined?null:_0x1eb608['body']['VoiceQueueId'],'CampaignId':_0x1eb608[_0xc972('0x17')][_0xc972('0x1b')]===undefined?null:_0x1eb608[_0xc972('0x17')][_0xc972('0x1b')]}})[_0xc972('0xb')](function(_0x5c88b0){if(_0x5c88b0!=null){return db[_0xc972('0x1c')][_0xc972('0x16')]({'raw':!![],'where':{'CmHopperId':_0x5c88b0['id'],'OrderBy':{'$gt':_0x5c88b0['OrderBy']}},'order':[[_0xc972('0x1d'),_0xc972('0x1e')]]})[_0xc972('0xb')](function(_0x334f5d){var _0x30c3e9=0x0;if(_0x334f5d){if(_0x334f5d[_0xc972('0x1f')]+_0x334f5d[_0xc972('0x20')]+_0x334f5d['countnoanswerretry']+_0x334f5d['countnosuchnumberretry']+_0x334f5d[_0xc972('0x21')]+_0x334f5d[_0xc972('0x22')]+_0x334f5d[_0xc972('0x23')]+_0x334f5d[_0xc972('0x24')]<_0x1eb608[_0xc972('0x25')][_0xc972('0x26')])_0x30c3e9=0x1;_0x19d6c5({'additional':_0x30c3e9});}else{return db[_0xc972('0x1c')][_0xc972('0x16')]({'raw':!![],'where':{'CmHopperId':_0x5c88b0['id']},'order':[['OrderBy',_0xc972('0x1e')]]})[_0xc972('0xb')](function(_0x3575a0){var _0x41ffa0=0x0;if(_0x3575a0){if(_0x3575a0[_0xc972('0x1f')]+_0x3575a0['countcongestionretry']+_0x3575a0[_0xc972('0x27')]+_0x3575a0[_0xc972('0x28')]+_0x3575a0[_0xc972('0x21')]+_0x3575a0[_0xc972('0x22')]+_0x3575a0['countmachineretry']+_0x3575a0[_0xc972('0x24')]<_0x1eb608[_0xc972('0x25')][_0xc972('0x26')])_0x41ffa0=0x1;_0x19d6c5({'additional':_0x41ffa0});}else{_0x19d6c5({'additional':0x0});}})[_0xc972('0x29')](function(_0x3b9397){logger[_0xc972('0x12')](_0xc972('0x15'),_0x3b9397['message']);_0x15d129(_0x5af5c7[_0xc972('0x12')](0x1f4,_0x3b9397['message']));});}})[_0xc972('0x29')](function(_0x3d8b54){logger[_0xc972('0x12')](_0xc972('0x15'),_0x3d8b54[_0xc972('0x13')]);_0x15d129(_0x5af5c7['error'](0x1f4,_0x3d8b54[_0xc972('0x13')]));});}else _0x19d6c5({'additional':0x0});});});};exports[_0xc972('0x2a')]=function(_0x30caf9){var _0x3d431b=this;return new Promise(function(_0xb79a3b,_0x375fe2){return db[_0xc972('0x2b')][_0xc972('0x16')]({'raw':!![],'where':{'ContactId':_0x30caf9[_0xc972('0x17')][_0xc972('0x18')],'ListId':_0x30caf9[_0xc972('0x17')][_0xc972('0x19')],'VoiceQueueId':_0x30caf9[_0xc972('0x17')][_0xc972('0x1a')]===undefined?null:_0x30caf9[_0xc972('0x17')]['VoiceQueueId'],'CampaignId':_0x30caf9[_0xc972('0x17')]['CampaignId']===undefined?null:_0x30caf9[_0xc972('0x17')]['CampaignId']}})[_0xc972('0xb')](function(_0x5f208f){if(_0x5f208f!=null){return db[_0xc972('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f208f['id'],'OrderBy':{'$gte':_0x5f208f[_0xc972('0x1d')]}},'order':[[_0xc972('0x1d'),_0xc972('0x1e')]]})['then'](function(_0x51dff3){if(_0x51dff3)return activateAdditionalPhone(_0x5f208f,_0x30caf9[_0xc972('0x17')],_0x51dff3,_0x30caf9[_0xc972('0x2c')],_0x30caf9[_0xc972('0x2d')])[_0xc972('0xb')](function(_0x28db1e){_0xb79a3b(_0x28db1e);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f208f['id']},'order':[[_0xc972('0x1d'),'ASC']]})[_0xc972('0xb')](function(_0x6ac75d){if(_0x6ac75d)return activateAdditionalPhone(_0x5f208f,_0x30caf9[_0xc972('0x17')],_0x6ac75d,_0x30caf9[_0xc972('0x2c')],_0x30caf9[_0xc972('0x2d')])[_0xc972('0xb')](function(_0x58f38e){_0xb79a3b(_0x58f38e);});else{_0xb79a3b({'id':_0x5f208f['id'],'phone':''});}})[_0xc972('0x29')](function(_0x344e62){logger['error'](_0xc972('0x15'),_0x344e62[_0xc972('0x13')]);_0x375fe2(_0x3d431b['error'](0x1f4,_0x344e62['message']));});}})['catch'](function(_0x5eda06){logger[_0xc972('0x12')](_0xc972('0x15'),_0x5eda06['message']);_0x375fe2(_0x3d431b[_0xc972('0x12')](0x1f4,_0x5eda06['message']));});}else _0xb79a3b(0x1);});});};function activateAdditionalPhone(_0x1e3375,_0xe9a686,_0x41ba3a,_0x334d59,_0x23a19e){return new Promise(function(_0x476e34,_0x5482d9){var _0x1d478d;if(_[_0xc972('0x2e')](_0x41ba3a[_0xc972('0x2f')])){_0x41ba3a[_0xc972('0x2f')]=moment();}if(moment()>moment(_0x41ba3a[_0xc972('0x2f')])){_0x1d478d=moment()[_0xc972('0x30')](_0x23a19e||0x3,_0xc972('0x31'));}else{if(_0x41ba3a[_0xc972('0x1d')]==0x0){_0x1d478d=moment(_0x41ba3a[_0xc972('0x2f')]);}else{_0x1d478d=moment()['add'](_0x23a19e||0x3,_0xc972('0x31'));}}if(_[_0xc972('0x2e')](_0x1d478d)){_0x1d478d=moment()[_0xc972('0x30')](_0x23a19e||0x3,'minutes');}var _0x4e257f={'phone':_0x1e3375[_0xc972('0x32')],'active':0x0,'OrderBy':_[_0xc972('0x2e')](_0x1e3375[_0xc972('0x1d')])?0x0:_0x1e3375[_0xc972('0x1d')],'scheduledat':moment()[_0xc972('0x30')](_0x334d59||0x1,_0xc972('0x31')),'countbusyretry':_0xe9a686[_0xc972('0x1f')],'countcongestionretry':_0xe9a686[_0xc972('0x20')],'countnoanswerretry':_0xe9a686[_0xc972('0x27')],'countnosuchnumberretry':_0xe9a686[_0xc972('0x28')],'countdropretry':_0xe9a686['countdropretry'],'countabandonedretry':_0xe9a686['countabandonedretry'],'countmachineretry':_0xe9a686['countmachineretry'],'countagentrejectretry':_0xe9a686[_0xc972('0x24')],'createdAt':_0xe9a686['createdAt'],'updatedAt':_0xe9a686[_0xc972('0x33')]};var _0x21abac={'CmHopperId':_0x1e3375['id'],'phone':_0x41ba3a[_0xc972('0x32')],'active':0x0,'OrderBy':_[_0xc972('0x2e')](_0x41ba3a['OrderBy'])?0x0:_0x41ba3a[_0xc972('0x1d')],'scheduledat':_0x1d478d,'countbusyretry':_0x41ba3a[_0xc972('0x1f')],'countcongestionretry':_0x41ba3a[_0xc972('0x20')],'countnoanswerretry':_0x41ba3a['countnoanswerretry'],'countnosuchnumberretry':_0x41ba3a['countnosuchnumberretry'],'countdropretry':_0x41ba3a[_0xc972('0x21')],'countabandonedretry':_0x41ba3a['countabandonedretry'],'countmachineretry':_0x41ba3a[_0xc972('0x23')],'countagentrejectretry':_0x41ba3a[_0xc972('0x24')],'createdAt':_0x41ba3a[_0xc972('0x34')],'updatedAt':_0x41ba3a['updatedAt']};return db[_0xc972('0x35')][_0xc972('0x36')](function(_0x4efa83){return db['CmHopperAdditionalPhone'][_0xc972('0x37')](_0x4e257f,{'where':{'id':_0x41ba3a['id']}},{'transaction':_0x4efa83})[_0xc972('0xb')](function(){return db[_0xc972('0x2b')]['update'](_0x21abac,{'where':{'id':_0x1e3375['id']}},{'transaction':_0x4efa83});});})[_0xc972('0xb')](function(_0x3f03c9){_0x476e34({'id':_0x1e3375['id'],'phone':_0x41ba3a['phone']});})[_0xc972('0x29')](function(_0x227c87){logger[_0xc972('0x12')]('activateAdditionalPhone',_0x227c87['message']);_0x5482d9({'error':_0x227c87[_0xc972('0x13')]});});});}exports[_0xc972('0x38')]=function(_0x3970da){var _0x5191a0=this;return new Promise(function(_0x7fa372,_0x3132d9){return db[_0xc972('0x2b')]['update'](_0x3970da[_0xc972('0x17')][_0xc972('0x39')],{'where':{'id':_0x3970da[_0xc972('0x17')]['id']}})[_0xc972('0xb')](function(_0x36c5ba){_0x7fa372(_0x36c5ba);})['catch'](function(_0x1a81c2){logger['error'](_0xc972('0x38'),_0x1a81c2[_0xc972('0x13')]);_0x3132d9(_0x5191a0['error'](0x1f4,_0x1a81c2[_0xc972('0x13')]));});});}; \ No newline at end of file +var _0x1a86=['debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','result','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countbusyretry','countnosuchnumberretry','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countnoanswerretry','countmachineretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1a86,0x1a3));var _0x61a8=function(_0x196f0a,_0x422060){_0x196f0a=_0x196f0a-0x0;var _0x24505b=_0x1a86[_0x196f0a];return _0x24505b;};'use strict';var _=require(_0x61a8('0x0'));var util=require('util');var moment=require(_0x61a8('0x1'));var BPromise=require(_0x61a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61a8('0x3'))(_0x61a8('0x4'));var config=require(_0x61a8('0x5'));var jayson=require(_0x61a8('0x6'));var client=jayson[_0x61a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bf11a,_0x385fe5,_0x2becf0){return new BPromise(function(_0x49d900,_0x5b45f9){return client[_0x61a8('0x8')](_0x2bf11a,_0x2becf0)[_0x61a8('0x9')](function(_0x4dbf8b){logger[_0x61a8('0xa')](_0x61a8('0xb'),_0x385fe5,_0x61a8('0xc'));logger[_0x61a8('0xd')](_0x61a8('0xe'),_0x385fe5,_0x61a8('0xc'),JSON['stringify'](_0x4dbf8b));if(_0x4dbf8b['error']){if(_0x4dbf8b['error']['code']===0x1f4){logger[_0x61a8('0xf')](_0x61a8('0xb'),_0x385fe5,_0x4dbf8b[_0x61a8('0xf')][_0x61a8('0x10')]);return _0x5b45f9(_0x4dbf8b[_0x61a8('0xf')]['message']);}logger['error'](_0x61a8('0xb'),_0x385fe5,_0x4dbf8b[_0x61a8('0xf')][_0x61a8('0x10')]);return _0x49d900(_0x4dbf8b[_0x61a8('0xf')][_0x61a8('0x10')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x385fe5,'request\x20sent');_0x49d900(_0x4dbf8b[_0x61a8('0x11')][_0x61a8('0x10')]);}})['catch'](function(_0x191364){logger[_0x61a8('0xf')](_0x61a8('0xb'),_0x385fe5,_0x191364);_0x5b45f9(_0x191364);});});}exports[_0x61a8('0x12')]=function(_0x5b08ad){var _0x2a0745=this;return new Promise(function(_0x51714f,_0xca54d){return db[_0x61a8('0x13')][_0x61a8('0x14')]({'raw':!![],'where':{'ContactId':_0x5b08ad['body'][_0x61a8('0x15')],'ListId':_0x5b08ad[_0x61a8('0x16')]['ListId'],'VoiceQueueId':_0x5b08ad['body'][_0x61a8('0x17')]===undefined?null:_0x5b08ad['body'][_0x61a8('0x17')],'CampaignId':_0x5b08ad[_0x61a8('0x16')][_0x61a8('0x18')]===undefined?null:_0x5b08ad[_0x61a8('0x16')][_0x61a8('0x18')]}})['then'](function(_0x19a007){if(_0x19a007!=null){return db['CmHopperAdditionalPhone'][_0x61a8('0x14')]({'raw':!![],'where':{'CmHopperId':_0x19a007['id'],'OrderBy':{'$gt':_0x19a007[_0x61a8('0x19')]}},'order':[[_0x61a8('0x19'),_0x61a8('0x1a')]]})[_0x61a8('0x9')](function(_0x2ce2ed){var _0x367f63=0x0;if(_0x2ce2ed){if(_0x2ce2ed['countbusyretry']+_0x2ce2ed[_0x61a8('0x1b')]+_0x2ce2ed['countnoanswerretry']+_0x2ce2ed['countnosuchnumberretry']+_0x2ce2ed[_0x61a8('0x1c')]+_0x2ce2ed[_0x61a8('0x1d')]+_0x2ce2ed['countmachineretry']+_0x2ce2ed[_0x61a8('0x1e')]<_0x5b08ad[_0x61a8('0x1f')][_0x61a8('0x20')])_0x367f63=0x1;_0x51714f({'additional':_0x367f63});}else{return db[_0x61a8('0x21')][_0x61a8('0x14')]({'raw':!![],'where':{'CmHopperId':_0x19a007['id']},'order':[[_0x61a8('0x19'),_0x61a8('0x1a')]]})['then'](function(_0x476b53){var _0x20f5f9=0x0;if(_0x476b53){if(_0x476b53[_0x61a8('0x22')]+_0x476b53[_0x61a8('0x1b')]+_0x476b53['countnoanswerretry']+_0x476b53[_0x61a8('0x23')]+_0x476b53[_0x61a8('0x1c')]+_0x476b53[_0x61a8('0x1d')]+_0x476b53['countmachineretry']+_0x476b53[_0x61a8('0x1e')]<_0x5b08ad[_0x61a8('0x1f')]['dialGlobalMaxRetry'])_0x20f5f9=0x1;_0x51714f({'additional':_0x20f5f9});}else{_0x51714f({'additional':0x0});}})[_0x61a8('0x24')](function(_0x379231){logger[_0x61a8('0xf')](_0x61a8('0x12'),_0x379231[_0x61a8('0x10')]);_0xca54d(_0x2a0745['error'](0x1f4,_0x379231[_0x61a8('0x10')]));});}})[_0x61a8('0x24')](function(_0x47cd4c){logger['error'](_0x61a8('0x12'),_0x47cd4c['message']);_0xca54d(_0x2a0745[_0x61a8('0xf')](0x1f4,_0x47cd4c[_0x61a8('0x10')]));});}else _0x51714f({'additional':0x0});});});};exports[_0x61a8('0x25')]=function(_0x55acd2){var _0x2364b1=this;return new Promise(function(_0x10e2ce,_0xf400b5){return db[_0x61a8('0x13')][_0x61a8('0x14')]({'raw':!![],'where':{'ContactId':_0x55acd2[_0x61a8('0x16')][_0x61a8('0x15')],'ListId':_0x55acd2['body']['ListId'],'VoiceQueueId':_0x55acd2[_0x61a8('0x16')][_0x61a8('0x17')]===undefined?null:_0x55acd2[_0x61a8('0x16')][_0x61a8('0x17')],'CampaignId':_0x55acd2[_0x61a8('0x16')][_0x61a8('0x18')]===undefined?null:_0x55acd2[_0x61a8('0x16')][_0x61a8('0x18')]}})[_0x61a8('0x9')](function(_0x10e209){if(_0x10e209!=null){return db[_0x61a8('0x21')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x10e209['id'],'OrderBy':{'$gte':_0x10e209['OrderBy']}},'order':[[_0x61a8('0x19'),_0x61a8('0x1a')]]})[_0x61a8('0x9')](function(_0x1a7034){if(_0x1a7034)return activateAdditionalPhone(_0x10e209,_0x55acd2[_0x61a8('0x16')],_0x1a7034,_0x55acd2[_0x61a8('0x26')],_0x55acd2[_0x61a8('0x27')])['then'](function(_0xe38cfe){_0x10e2ce(_0xe38cfe);});else{return db['CmHopperAdditionalPhone'][_0x61a8('0x14')]({'raw':!![],'where':{'CmHopperId':_0x10e209['id']},'order':[['OrderBy',_0x61a8('0x1a')]]})[_0x61a8('0x9')](function(_0x248046){if(_0x248046)return activateAdditionalPhone(_0x10e209,_0x55acd2[_0x61a8('0x16')],_0x248046,_0x55acd2[_0x61a8('0x26')],_0x55acd2[_0x61a8('0x27')])[_0x61a8('0x9')](function(_0xc27006){_0x10e2ce(_0xc27006);});else{_0x10e2ce({'id':_0x10e209['id'],'phone':''});}})[_0x61a8('0x24')](function(_0x5d8563){logger[_0x61a8('0xf')](_0x61a8('0x12'),_0x5d8563['message']);_0xf400b5(_0x2364b1['error'](0x1f4,_0x5d8563[_0x61a8('0x10')]));});}})[_0x61a8('0x24')](function(_0x33c58d){logger['error'](_0x61a8('0x12'),_0x33c58d[_0x61a8('0x10')]);_0xf400b5(_0x2364b1[_0x61a8('0xf')](0x1f4,_0x33c58d[_0x61a8('0x10')]));});}else _0x10e2ce(0x1);});});};function activateAdditionalPhone(_0x3a0192,_0x3e0728,_0x29dd49,_0x8dce82,_0x420690){return new Promise(function(_0x168534,_0x57ea77){var _0x33530f;if(_['isNil'](_0x29dd49[_0x61a8('0x28')])){_0x29dd49[_0x61a8('0x28')]=moment();}if(moment()>moment(_0x29dd49['scheduledat'])){_0x33530f=moment()[_0x61a8('0x29')](_0x420690||0x3,_0x61a8('0x2a'));}else{if(_0x29dd49[_0x61a8('0x19')]==0x0){_0x33530f=moment(_0x29dd49['scheduledat']);}else{_0x33530f=moment()[_0x61a8('0x29')](_0x420690||0x3,_0x61a8('0x2a'));}}if(_[_0x61a8('0x2b')](_0x33530f)){_0x33530f=moment()[_0x61a8('0x29')](_0x420690||0x3,'minutes');}var _0x40544f={'phone':_0x3a0192[_0x61a8('0x2c')],'active':0x0,'OrderBy':_[_0x61a8('0x2b')](_0x3a0192['OrderBy'])?0x0:_0x3a0192[_0x61a8('0x19')],'scheduledat':moment()[_0x61a8('0x29')](_0x8dce82||0x1,_0x61a8('0x2a')),'countbusyretry':_0x3e0728['countbusyretry'],'countcongestionretry':_0x3e0728[_0x61a8('0x1b')],'countnoanswerretry':_0x3e0728[_0x61a8('0x2d')],'countnosuchnumberretry':_0x3e0728['countnosuchnumberretry'],'countdropretry':_0x3e0728['countdropretry'],'countabandonedretry':_0x3e0728[_0x61a8('0x1d')],'countmachineretry':_0x3e0728[_0x61a8('0x2e')],'countagentrejectretry':_0x3e0728[_0x61a8('0x1e')],'createdAt':_0x3e0728[_0x61a8('0x2f')],'updatedAt':_0x3e0728[_0x61a8('0x30')]};var _0x4a10f3={'CmHopperId':_0x3a0192['id'],'phone':_0x29dd49['phone'],'active':0x0,'OrderBy':_['isNil'](_0x29dd49[_0x61a8('0x19')])?0x0:_0x29dd49[_0x61a8('0x19')],'scheduledat':_0x33530f,'countbusyretry':_0x29dd49[_0x61a8('0x22')],'countcongestionretry':_0x29dd49[_0x61a8('0x1b')],'countnoanswerretry':_0x29dd49[_0x61a8('0x2d')],'countnosuchnumberretry':_0x29dd49[_0x61a8('0x23')],'countdropretry':_0x29dd49['countdropretry'],'countabandonedretry':_0x29dd49[_0x61a8('0x1d')],'countmachineretry':_0x29dd49[_0x61a8('0x2e')],'countagentrejectretry':_0x29dd49[_0x61a8('0x1e')],'createdAt':_0x29dd49[_0x61a8('0x2f')],'updatedAt':_0x29dd49[_0x61a8('0x30')]};return db[_0x61a8('0x31')][_0x61a8('0x32')](function(_0x75ba4b){return db[_0x61a8('0x21')]['update'](_0x40544f,{'where':{'id':_0x29dd49['id']}},{'transaction':_0x75ba4b})[_0x61a8('0x9')](function(){return db[_0x61a8('0x13')][_0x61a8('0x33')](_0x4a10f3,{'where':{'id':_0x3a0192['id']}},{'transaction':_0x75ba4b});});})['then'](function(_0x19e07d){_0x168534({'id':_0x3a0192['id'],'phone':_0x29dd49['phone']});})[_0x61a8('0x24')](function(_0x553a0f){logger[_0x61a8('0xf')](_0x61a8('0x34'),_0x553a0f[_0x61a8('0x10')]);_0x57ea77({'error':_0x553a0f[_0x61a8('0x10')]});});});}exports['IncrementPreviewCounters']=function(_0x37989e){var _0x4c72dc=this;return new Promise(function(_0x3ed8be,_0x5cf8d1){return db['CmHopper'][_0x61a8('0x33')](_0x37989e[_0x61a8('0x16')]['field'],{'where':{'id':_0x37989e[_0x61a8('0x16')]['id']}})['then'](function(_0x4b19de){_0x3ed8be(_0x4b19de);})[_0x61a8('0x24')](function(_0x4b3b65){logger['error'](_0x61a8('0x35'),_0x4b3b65[_0x61a8('0x10')]);_0x5cf8d1(_0x4c72dc[_0x61a8('0xf')](0x1f4,_0x4b3b65['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 6070ebe..6dde223 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 _0x048e=['destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x45fcb7,_0x124683){var _0x51c2bf=function(_0x236201){while(--_0x236201){_0x45fcb7['push'](_0x45fcb7['shift']());}};_0x51c2bf(++_0x124683);}(_0x048e,0x1aa));var _0xe048=function(_0x157f1c,_0x329bdb){_0x157f1c=_0x157f1c-0x0;var _0x552cd8=_0x048e[_0x157f1c];return _0x552cd8;};'use strict';var multer=require(_0xe048('0x0'));var util=require('util');var path=require(_0xe048('0x1'));var timeout=require(_0xe048('0x2'));var express=require(_0xe048('0x3'));var router=express[_0xe048('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe048('0x5'));var interaction=require(_0xe048('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xe048('0x7')]('/',auth[_0xe048('0x8')](),controller['index']);router[_0xe048('0x7')]('/:id',auth[_0xe048('0x8')](),controller[_0xe048('0x9')]);router[_0xe048('0xa')]('/',auth[_0xe048('0x8')](),controller[_0xe048('0xb')]);router[_0xe048('0xc')](_0xe048('0xd'),auth[_0xe048('0x8')](),controller[_0xe048('0xe')]);router[_0xe048('0xf')](_0xe048('0xd'),auth[_0xe048('0x8')](),controller[_0xe048('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa1e0=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x18f5a1,_0x3bbf94){var _0x11f297=function(_0x51a660){while(--_0x51a660){_0x18f5a1['push'](_0x18f5a1['shift']());}};_0x11f297(++_0x3bbf94);}(_0xa1e0,0xb2));var _0x0a1e=function(_0x50506d,_0x121c44){_0x50506d=_0x50506d-0x0;var _0x1aa668=_0xa1e0[_0x50506d];return _0x1aa668;};'use strict';var multer=require(_0x0a1e('0x0'));var util=require(_0x0a1e('0x1'));var path=require(_0x0a1e('0x2'));var timeout=require(_0x0a1e('0x3'));var express=require(_0x0a1e('0x4'));var router=express['Router']();var fs_extra=require(_0x0a1e('0x5'));var auth=require(_0x0a1e('0x6'));var interaction=require(_0x0a1e('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x0a1e('0x8')]('/',auth[_0x0a1e('0x9')](),controller[_0x0a1e('0xa')]);router[_0x0a1e('0x8')](_0x0a1e('0xb'),auth[_0x0a1e('0x9')](),controller[_0x0a1e('0xc')]);router[_0x0a1e('0xd')]('/',auth[_0x0a1e('0x9')](),controller[_0x0a1e('0xe')]);router['put'](_0x0a1e('0xb'),auth[_0x0a1e('0x9')](),controller[_0x0a1e('0xf')]);router[_0x0a1e('0x10')](_0x0a1e('0xb'),auth['isAuthenticated'](),controller[_0x0a1e('0x11')]);module[_0x0a1e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 7ceaf97..4007b3e 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 _0xdd0c=['STRING','contactListQueue','INTEGER','moment','sequelize','exports'];(function(_0x19046c,_0x2494b5){var _0x469c79=function(_0x59cd03){while(--_0x59cd03){_0x19046c['push'](_0x19046c['shift']());}};_0x469c79(++_0x2494b5);}(_0xdd0c,0x1ad));var _0xcdd0=function(_0x54dd38,_0x1d4189){_0x54dd38=_0x54dd38-0x0;var _0x4ecfe1=_0xdd0c[_0x54dd38];return _0x4ecfe1;};'use strict';var moment=require(_0xcdd0('0x0'));var Sequelize=require(_0xcdd0('0x1'));module[_0xcdd0('0x2')]={'phone':{'type':Sequelize[_0xcdd0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xcdd0('0x4')},'ListId':{'type':Sequelize[_0xcdd0('0x5')],'unique':_0xcdd0('0x4')},'VoiceQueueId':{'type':Sequelize[_0xcdd0('0x5')],'unique':_0xcdd0('0x4')}}; \ No newline at end of file +var _0xb782=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x4cfc05,_0x50ac65){var _0x2916d3=function(_0x3a13d0){while(--_0x3a13d0){_0x4cfc05['push'](_0x4cfc05['shift']());}};_0x2916d3(++_0x50ac65);}(_0xb782,0xd1));var _0x2b78=function(_0x18c17c,_0x3bf837){_0x18c17c=_0x18c17c-0x0;var _0x289f5c=_0xb782[_0x18c17c];return _0x289f5c;};'use strict';var moment=require(_0x2b78('0x0'));var Sequelize=require(_0x2b78('0x1'));module[_0x2b78('0x2')]={'phone':{'type':Sequelize[_0x2b78('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2b78('0x4')],'unique':_0x2b78('0x5')},'ListId':{'type':Sequelize[_0x2b78('0x4')],'unique':_0x2b78('0x5')},'VoiceQueueId':{'type':Sequelize[_0x2b78('0x4')],'unique':_0x2b78('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6a6caa4..0e71703 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 _0x4d60=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','CmHopperBlack','then','includeAll','include','findAll','rows','catch','intersection','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4d60,0x7d));var _0x04d6=function(_0x38e370,_0x2f9d10){_0x38e370=_0x38e370-0x0;var _0x53a265=_0x4d60[_0x38e370];return _0x53a265;};'use strict';var emlformat=require(_0x04d6('0x0'));var rimraf=require(_0x04d6('0x1'));var zipdir=require(_0x04d6('0x2'));var jsonpatch=require(_0x04d6('0x3'));var rp=require(_0x04d6('0x4'));var moment=require('moment');var BPromise=require(_0x04d6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x04d6('0x6'));var sox=require('sox');var csv=require(_0x04d6('0x7'));var ejs=require(_0x04d6('0x8'));var fs=require('fs');var fs_extra=require(_0x04d6('0x9'));var _=require(_0x04d6('0xa'));var squel=require(_0x04d6('0xb'));var crypto=require(_0x04d6('0xc'));var jsforce=require(_0x04d6('0xd'));var deskjs=require(_0x04d6('0xe'));var toCsv=require(_0x04d6('0x7'));var querystring=require(_0x04d6('0xf'));var Papa=require(_0x04d6('0x10'));var Redis=require(_0x04d6('0x11'));var authService=require(_0x04d6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x04d6('0x13'));var hardwareService=require(_0x04d6('0x14'));var logger=require(_0x04d6('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bc085,_0x2cb375){_0x2cb375=_0x2cb375||0xcc;return function(_0x376f0b){if(_0x376f0b){return _0x1bc085[_0x04d6('0x16')](_0x2cb375);}return _0x1bc085[_0x04d6('0x17')](_0x2cb375)[_0x04d6('0x18')]();};}function respondWithResult(_0x589733,_0x3c734e){_0x3c734e=_0x3c734e||0xc8;return function(_0x53c6be){if(_0x53c6be){return _0x589733[_0x04d6('0x17')](_0x3c734e)['json'](_0x53c6be);}};}function respondWithFilteredResult(_0x316025,_0x189d20){return function(_0x608194){if(_0x608194){var _0x46900e=typeof _0x189d20[_0x04d6('0x19')]===_0x04d6('0x1a')&&typeof _0x189d20[_0x04d6('0x1b')]===_0x04d6('0x1a');var _0x503ffd=_0x608194[_0x04d6('0x1c')];var _0x1382f5=_0x46900e?0x0:_0x189d20[_0x04d6('0x19')];var _0x2dd1d5=_0x46900e?_0x608194[_0x04d6('0x1c')]:_0x189d20[_0x04d6('0x19')]+_0x189d20[_0x04d6('0x1b')];var _0x28bb2b;if(_0x2dd1d5>=_0x503ffd){_0x2dd1d5=_0x503ffd;_0x28bb2b=0xc8;}else{_0x28bb2b=0xce;}_0x316025[_0x04d6('0x17')](_0x28bb2b);return _0x316025[_0x04d6('0x1d')](_0x04d6('0x1e'),_0x1382f5+'-'+_0x2dd1d5+'/'+_0x503ffd)[_0x04d6('0x1f')](_0x608194);}return null;};}function patchUpdates(_0x2b662c){return function(_0x12948f){try{jsonpatch['apply'](_0x12948f,_0x2b662c,!![]);}catch(_0x1567cb){return BPromise[_0x04d6('0x20')](_0x1567cb);}return _0x12948f[_0x04d6('0x21')]();};}function saveUpdates(_0x2787c5,_0x5e109b){return function(_0x37535d){if(_0x37535d){return _0x37535d[_0x04d6('0x22')](_0x2787c5)['then'](function(_0x48946e){return _0x48946e;});}return null;};}function removeEntity(_0x112690,_0x443d18){return function(_0x2d0b3b){if(_0x2d0b3b){return _0x2d0b3b[_0x04d6('0x23')]()['then'](function(){_0x112690[_0x04d6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fc52,_0x5b0d8b){return function(_0xca4aa8){if(!_0xca4aa8){_0x40fc52[_0x04d6('0x16')](0x194);}return _0xca4aa8;};}function handleError(_0x46ed9b,_0x12bebc){_0x12bebc=_0x12bebc||0x1f4;return function(_0x59fa29){logger[_0x04d6('0x24')](_0x59fa29[_0x04d6('0x25')]);if(_0x59fa29[_0x04d6('0x26')]){delete _0x59fa29[_0x04d6('0x26')];}_0x46ed9b[_0x04d6('0x17')](_0x12bebc)[_0x04d6('0x27')](_0x59fa29);};}exports['index']=function(_0x262a23,_0x52d868){var _0x268282={},_0x3a8550={},_0x8fe1d0={'count':0x0,'rows':[]};var _0x57162e=_[_0x04d6('0x28')](db['CmHopperBlack'][_0x04d6('0x29')],function(_0x3117d7){return{'name':_0x3117d7[_0x04d6('0x2a')],'type':_0x3117d7['type'][_0x04d6('0x2b')]};});_0x3a8550['model']=_[_0x04d6('0x28')](_0x57162e,_0x04d6('0x26'));_0x3a8550[_0x04d6('0x2c')]=_[_0x04d6('0x2d')](_0x262a23[_0x04d6('0x2c')]);_0x3a8550[_0x04d6('0x2e')]=_['intersection'](_0x3a8550[_0x04d6('0x2f')],_0x3a8550['query']);_0x268282[_0x04d6('0x30')]=_['intersection'](_0x3a8550[_0x04d6('0x2f')],qs[_0x04d6('0x31')](_0x262a23[_0x04d6('0x2c')][_0x04d6('0x31')]));_0x268282['attributes']=_0x268282[_0x04d6('0x30')][_0x04d6('0x32')]?_0x268282[_0x04d6('0x30')]:_0x3a8550[_0x04d6('0x2f')];if(!_0x262a23[_0x04d6('0x2c')]['hasOwnProperty'](_0x04d6('0x33'))){_0x268282[_0x04d6('0x1b')]=qs[_0x04d6('0x1b')](_0x262a23['query'][_0x04d6('0x1b')]);_0x268282[_0x04d6('0x19')]=qs['offset'](_0x262a23[_0x04d6('0x2c')][_0x04d6('0x19')]);}_0x268282['order']=qs[_0x04d6('0x34')](_0x262a23[_0x04d6('0x2c')][_0x04d6('0x34')]);_0x268282[_0x04d6('0x35')]=qs[_0x04d6('0x2e')](_['pick'](_0x262a23['query'],_0x3a8550[_0x04d6('0x2e')]),_0x57162e);if(_0x262a23[_0x04d6('0x2c')][_0x04d6('0x36')]){_0x268282['where']=_[_0x04d6('0x37')](_0x268282[_0x04d6('0x35')],{'$or':_[_0x04d6('0x28')](_0x57162e,function(_0x4fd562){if(_0x4fd562[_0x04d6('0x38')]!==_0x04d6('0x39')){var _0x1e9661={};_0x1e9661[_0x4fd562[_0x04d6('0x26')]]={'$like':'%'+_0x262a23[_0x04d6('0x2c')][_0x04d6('0x36')]+'%'};return _0x1e9661;}})});}_0x268282=_[_0x04d6('0x37')]({},_0x268282,_0x262a23[_0x04d6('0x3a')]);var _0x22ee3b={'where':_0x268282[_0x04d6('0x35')]};return db[_0x04d6('0x3b')]['count'](_0x22ee3b)[_0x04d6('0x3c')](function(_0x17b8e3){_0x8fe1d0[_0x04d6('0x1c')]=_0x17b8e3;if(_0x262a23[_0x04d6('0x2c')][_0x04d6('0x3d')]){_0x268282[_0x04d6('0x3e')]=[{'all':!![]}];}return db[_0x04d6('0x3b')][_0x04d6('0x3f')](_0x268282);})[_0x04d6('0x3c')](function(_0x424284){_0x8fe1d0[_0x04d6('0x40')]=_0x424284;return _0x8fe1d0;})[_0x04d6('0x3c')](respondWithFilteredResult(_0x52d868,_0x268282))[_0x04d6('0x41')](handleError(_0x52d868,null));};exports['show']=function(_0x47664b,_0x100943){var _0x2e6e90={'raw':!![],'where':{'id':_0x47664b['params']['id']}},_0xc1e72e={};_0xc1e72e[_0x04d6('0x2f')]=_['keys'](db[_0x04d6('0x3b')]['rawAttributes']);_0xc1e72e[_0x04d6('0x2c')]=_['keys'](_0x47664b[_0x04d6('0x2c')]);_0xc1e72e[_0x04d6('0x2e')]=_[_0x04d6('0x42')](_0xc1e72e[_0x04d6('0x2f')],_0xc1e72e[_0x04d6('0x2c')]);_0x2e6e90['attributes']=_[_0x04d6('0x42')](_0xc1e72e[_0x04d6('0x2f')],qs['fields'](_0x47664b[_0x04d6('0x2c')]['fields']));_0x2e6e90[_0x04d6('0x30')]=_0x2e6e90['attributes'][_0x04d6('0x32')]?_0x2e6e90['attributes']:_0xc1e72e[_0x04d6('0x2f')];if(_0x47664b[_0x04d6('0x2c')][_0x04d6('0x3d')]){_0x2e6e90[_0x04d6('0x3e')]=[{'all':!![]}];}_0x2e6e90=_[_0x04d6('0x37')]({},_0x2e6e90,_0x47664b[_0x04d6('0x3a')]);return db[_0x04d6('0x3b')][_0x04d6('0x43')](_0x2e6e90)['then'](handleEntityNotFound(_0x100943,null))[_0x04d6('0x3c')](respondWithResult(_0x100943,null))[_0x04d6('0x41')](handleError(_0x100943,null));};exports['update']=function(_0x160b68,_0x490098){if(_0x160b68[_0x04d6('0x44')]['id']){delete _0x160b68[_0x04d6('0x44')]['id'];}return db[_0x04d6('0x3b')][_0x04d6('0x43')]({'where':{'id':_0x160b68[_0x04d6('0x45')]['id']}})[_0x04d6('0x3c')](handleEntityNotFound(_0x490098,null))[_0x04d6('0x3c')](saveUpdates(_0x160b68['body'],null))[_0x04d6('0x3c')](respondWithResult(_0x490098,null))['catch'](handleError(_0x490098,null));};exports['destroy']=function(_0x2d5ae8,_0x3892c){return db['CmHopperBlack']['find']({'where':{'id':_0x2d5ae8['params']['id']}})['then'](handleEntityNotFound(_0x3892c,null))['then'](removeEntity(_0x3892c,null))['catch'](handleError(_0x3892c,null));};exports['describe']=function(_0x26472a,_0xc1daf3){return db[_0x04d6('0x3b')][_0x04d6('0x46')]()[_0x04d6('0x3c')](respondWithResult(_0xc1daf3,null))[_0x04d6('0x41')](handleError(_0xc1daf3,null));}; \ No newline at end of file +var _0x6bab=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','CmHopperBlack','include','rows','catch','show','includeAll','options','find','body','params','describe','eml-format'];(function(_0x1cebb9,_0x378fcb){var _0xcbde6c=function(_0x25c5e9){while(--_0x25c5e9){_0x1cebb9['push'](_0x1cebb9['shift']());}};_0xcbde6c(++_0x378fcb);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0x6bab[_0x46111d];return _0xe82586;};'use strict';var emlformat=require(_0xb6ba('0x0'));var rimraf=require(_0xb6ba('0x1'));var zipdir=require(_0xb6ba('0x2'));var jsonpatch=require(_0xb6ba('0x3'));var rp=require('request-promise');var moment=require(_0xb6ba('0x4'));var BPromise=require(_0xb6ba('0x5'));var Mustache=require(_0xb6ba('0x6'));var util=require(_0xb6ba('0x7'));var path=require(_0xb6ba('0x8'));var sox=require('sox');var csv=require(_0xb6ba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6ba('0xa'));var _=require(_0xb6ba('0xb'));var squel=require(_0xb6ba('0xc'));var crypto=require(_0xb6ba('0xd'));var jsforce=require(_0xb6ba('0xe'));var deskjs=require(_0xb6ba('0xf'));var toCsv=require(_0xb6ba('0x9'));var querystring=require(_0xb6ba('0x10'));var Papa=require(_0xb6ba('0x11'));var Redis=require('ioredis');var authService=require(_0xb6ba('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6ba('0x13'))(_0xb6ba('0x14'));var utils=require(_0xb6ba('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb6ba('0x16'));var db=require(_0xb6ba('0x17'))['db'];function respondWithStatusCode(_0xc4497e,_0xba683e){_0xba683e=_0xba683e||0xcc;return function(_0xb7620d){if(_0xb7620d){return _0xc4497e[_0xb6ba('0x18')](_0xba683e);}return _0xc4497e[_0xb6ba('0x19')](_0xba683e)[_0xb6ba('0x1a')]();};}function respondWithResult(_0x36d352,_0x431ce5){_0x431ce5=_0x431ce5||0xc8;return function(_0x210454){if(_0x210454){return _0x36d352[_0xb6ba('0x19')](_0x431ce5)[_0xb6ba('0x1b')](_0x210454);}};}function respondWithFilteredResult(_0x1d8ed6,_0x15d2e8){return function(_0x3a5ad2){if(_0x3a5ad2){var _0x3ec867=typeof _0x15d2e8[_0xb6ba('0x1c')]===_0xb6ba('0x1d')&&typeof _0x15d2e8['limit']===_0xb6ba('0x1d');var _0x4ed16d=_0x3a5ad2['count'];var _0x24fa69=_0x3ec867?0x0:_0x15d2e8[_0xb6ba('0x1c')];var _0x49a48e=_0x3ec867?_0x3a5ad2[_0xb6ba('0x1e')]:_0x15d2e8[_0xb6ba('0x1c')]+_0x15d2e8['limit'];var _0x1cf948;if(_0x49a48e>=_0x4ed16d){_0x49a48e=_0x4ed16d;_0x1cf948=0xc8;}else{_0x1cf948=0xce;}_0x1d8ed6[_0xb6ba('0x19')](_0x1cf948);return _0x1d8ed6[_0xb6ba('0x1f')](_0xb6ba('0x20'),_0x24fa69+'-'+_0x49a48e+'/'+_0x4ed16d)[_0xb6ba('0x1b')](_0x3a5ad2);}return null;};}function patchUpdates(_0x40b66e){return function(_0x213a36){try{jsonpatch[_0xb6ba('0x21')](_0x213a36,_0x40b66e,!![]);}catch(_0x102cb7){return BPromise[_0xb6ba('0x22')](_0x102cb7);}return _0x213a36[_0xb6ba('0x23')]();};}function saveUpdates(_0x444f90,_0x2350a5){return function(_0x35dbc9){if(_0x35dbc9){return _0x35dbc9[_0xb6ba('0x24')](_0x444f90)[_0xb6ba('0x25')](function(_0x57d6e9){return _0x57d6e9;});}return null;};}function removeEntity(_0x4d6345,_0x31e991){return function(_0x48d466){if(_0x48d466){return _0x48d466[_0xb6ba('0x26')]()[_0xb6ba('0x25')](function(){_0x4d6345[_0xb6ba('0x19')](0xcc)[_0xb6ba('0x1a')]();});}};}function handleEntityNotFound(_0x43704b,_0x4e4b6a){return function(_0x5ce5d7){if(!_0x5ce5d7){_0x43704b[_0xb6ba('0x18')](0x194);}return _0x5ce5d7;};}function handleError(_0x57471f,_0x418394){_0x418394=_0x418394||0x1f4;return function(_0x253f32){logger[_0xb6ba('0x27')](_0x253f32[_0xb6ba('0x28')]);if(_0x253f32[_0xb6ba('0x29')]){delete _0x253f32[_0xb6ba('0x29')];}_0x57471f[_0xb6ba('0x19')](_0x418394)[_0xb6ba('0x2a')](_0x253f32);};}exports['index']=function(_0x2d5038,_0x5f0864){var _0x1534fb={},_0x1041e8={},_0x190ee3={'count':0x0,'rows':[]};var _0x563df2=_[_0xb6ba('0x2b')](db['CmHopperBlack'][_0xb6ba('0x2c')],function(_0x1d1bc7){return{'name':_0x1d1bc7[_0xb6ba('0x2d')],'type':_0x1d1bc7[_0xb6ba('0x2e')]['key']};});_0x1041e8['model']=_[_0xb6ba('0x2b')](_0x563df2,_0xb6ba('0x29'));_0x1041e8[_0xb6ba('0x2f')]=_[_0xb6ba('0x30')](_0x2d5038[_0xb6ba('0x2f')]);_0x1041e8[_0xb6ba('0x31')]=_[_0xb6ba('0x32')](_0x1041e8['model'],_0x1041e8['query']);_0x1534fb[_0xb6ba('0x33')]=_[_0xb6ba('0x32')](_0x1041e8[_0xb6ba('0x34')],qs['fields'](_0x2d5038[_0xb6ba('0x2f')][_0xb6ba('0x35')]));_0x1534fb[_0xb6ba('0x33')]=_0x1534fb[_0xb6ba('0x33')][_0xb6ba('0x36')]?_0x1534fb[_0xb6ba('0x33')]:_0x1041e8[_0xb6ba('0x34')];if(!_0x2d5038['query'][_0xb6ba('0x37')](_0xb6ba('0x38'))){_0x1534fb[_0xb6ba('0x39')]=qs[_0xb6ba('0x39')](_0x2d5038[_0xb6ba('0x2f')][_0xb6ba('0x39')]);_0x1534fb[_0xb6ba('0x1c')]=qs['offset'](_0x2d5038[_0xb6ba('0x2f')][_0xb6ba('0x1c')]);}_0x1534fb[_0xb6ba('0x3a')]=qs[_0xb6ba('0x3b')](_0x2d5038['query'][_0xb6ba('0x3b')]);_0x1534fb['where']=qs['filters'](_[_0xb6ba('0x3c')](_0x2d5038[_0xb6ba('0x2f')],_0x1041e8[_0xb6ba('0x31')]),_0x563df2);if(_0x2d5038[_0xb6ba('0x2f')][_0xb6ba('0x3d')]){_0x1534fb[_0xb6ba('0x3e')]=_['merge'](_0x1534fb[_0xb6ba('0x3e')],{'$or':_['map'](_0x563df2,function(_0x164491){if(_0x164491[_0xb6ba('0x2e')]!==_0xb6ba('0x3f')){var _0x49231e={};_0x49231e[_0x164491[_0xb6ba('0x29')]]={'$like':'%'+_0x2d5038[_0xb6ba('0x2f')][_0xb6ba('0x3d')]+'%'};return _0x49231e;}})});}_0x1534fb=_[_0xb6ba('0x40')]({},_0x1534fb,_0x2d5038['options']);var _0x41c897={'where':_0x1534fb[_0xb6ba('0x3e')]};return db[_0xb6ba('0x41')][_0xb6ba('0x1e')](_0x41c897)[_0xb6ba('0x25')](function(_0x4205cb){_0x190ee3[_0xb6ba('0x1e')]=_0x4205cb;if(_0x2d5038[_0xb6ba('0x2f')]['includeAll']){_0x1534fb[_0xb6ba('0x42')]=[{'all':!![]}];}return db[_0xb6ba('0x41')]['findAll'](_0x1534fb);})[_0xb6ba('0x25')](function(_0x18ecb1){_0x190ee3[_0xb6ba('0x43')]=_0x18ecb1;return _0x190ee3;})['then'](respondWithFilteredResult(_0x5f0864,_0x1534fb))[_0xb6ba('0x44')](handleError(_0x5f0864,null));};exports[_0xb6ba('0x45')]=function(_0x385278,_0x399326){var _0x8ff870={'raw':!![],'where':{'id':_0x385278['params']['id']}},_0x1c2def={};_0x1c2def[_0xb6ba('0x34')]=_[_0xb6ba('0x30')](db[_0xb6ba('0x41')][_0xb6ba('0x2c')]);_0x1c2def[_0xb6ba('0x2f')]=_['keys'](_0x385278[_0xb6ba('0x2f')]);_0x1c2def['filters']=_[_0xb6ba('0x32')](_0x1c2def['model'],_0x1c2def[_0xb6ba('0x2f')]);_0x8ff870[_0xb6ba('0x33')]=_[_0xb6ba('0x32')](_0x1c2def['model'],qs[_0xb6ba('0x35')](_0x385278[_0xb6ba('0x2f')]['fields']));_0x8ff870[_0xb6ba('0x33')]=_0x8ff870[_0xb6ba('0x33')][_0xb6ba('0x36')]?_0x8ff870['attributes']:_0x1c2def['model'];if(_0x385278[_0xb6ba('0x2f')][_0xb6ba('0x46')]){_0x8ff870[_0xb6ba('0x42')]=[{'all':!![]}];}_0x8ff870=_[_0xb6ba('0x40')]({},_0x8ff870,_0x385278[_0xb6ba('0x47')]);return db[_0xb6ba('0x41')][_0xb6ba('0x48')](_0x8ff870)[_0xb6ba('0x25')](handleEntityNotFound(_0x399326,null))['then'](respondWithResult(_0x399326,null))[_0xb6ba('0x44')](handleError(_0x399326,null));};exports[_0xb6ba('0x24')]=function(_0x5f4b15,_0x5deb50){if(_0x5f4b15[_0xb6ba('0x49')]['id']){delete _0x5f4b15[_0xb6ba('0x49')]['id'];}return db[_0xb6ba('0x41')]['find']({'where':{'id':_0x5f4b15[_0xb6ba('0x4a')]['id']}})[_0xb6ba('0x25')](handleEntityNotFound(_0x5deb50,null))[_0xb6ba('0x25')](saveUpdates(_0x5f4b15[_0xb6ba('0x49')],null))[_0xb6ba('0x25')](respondWithResult(_0x5deb50,null))[_0xb6ba('0x44')](handleError(_0x5deb50,null));};exports[_0xb6ba('0x26')]=function(_0x5c62a6,_0x1d74ab){return db[_0xb6ba('0x41')][_0xb6ba('0x48')]({'where':{'id':_0x5c62a6[_0xb6ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d74ab,null))[_0xb6ba('0x25')](removeEntity(_0x1d74ab,null))['catch'](handleError(_0x1d74ab,null));};exports[_0xb6ba('0x4b')]=function(_0x3e8d56,_0x282534){return db[_0xb6ba('0x41')][_0xb6ba('0x4b')]()['then'](respondWithResult(_0x282534,null))[_0xb6ba('0x44')](handleError(_0x282534,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d67cc7c..a85177a 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 _0x8899=['bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','moment'];(function(_0xfaa291,_0x33534f){var _0x8ad402=function(_0x45d5e8){while(--_0x45d5e8){_0xfaa291['push'](_0xfaa291['shift']());}};_0x8ad402(++_0x33534f);}(_0x8899,0x129));var _0x9889=function(_0x25f67c,_0x45c809){_0x25f67c=_0x25f67c-0x0;var _0x9e68f7=_0x8899[_0x25f67c];return _0x9e68f7;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9889('0x2'));var BPromise=require(_0x9889('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9889('0x4'));var rimraf=require(_0x9889('0x5'));var config=require(_0x9889('0x6'));var attributes=require(_0x9889('0x7'));module[_0x9889('0x8')]=function(_0x4e1149,_0x15ec02){return _0x4e1149[_0x9889('0x9')](_0x9889('0xa'),attributes,{'tableName':_0x9889('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6e5=['define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0xba7fba,_0x47539d){var _0x8c73bb=function(_0x4b56f5){while(--_0x4b56f5){_0xba7fba['push'](_0xba7fba['shift']());}};_0x8c73bb(++_0x47539d);}(_0xf6e5,0x1ef));var _0x5f6e=function(_0x3f409c,_0x877eb){_0x3f409c=_0x3f409c-0x0;var _0x15654c=_0xf6e5[_0x3f409c];return _0x15654c;};'use strict';var _=require(_0x5f6e('0x0'));var util=require(_0x5f6e('0x1'));var logger=require(_0x5f6e('0x2'))(_0x5f6e('0x3'));var moment=require(_0x5f6e('0x4'));var BPromise=require(_0x5f6e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f6e('0x6'));var config=require(_0x5f6e('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x5f6e('0x8')]=function(_0x522129,_0x121369){return _0x522129[_0x5f6e('0x9')](_0x5f6e('0xa'),attributes,{'tableName':_0x5f6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 01cf031..b1789ac 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 _0x3d98=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','map','model','include','attributes','then','update','body','where','UpdateCmHopperBlack','debug','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3d98,0xf8));var _0x83d9=function(_0x2b309e,_0xb5625a){_0x2b309e=_0x2b309e-0x0;var _0x569be2=_0x3d98[_0x2b309e];return _0x569be2;};'use strict';var _=require('lodash');var util=require(_0x83d9('0x0'));var moment=require(_0x83d9('0x1'));var BPromise=require(_0x83d9('0x2'));var rs=require(_0x83d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x83d9('0x5'))(_0x83d9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x83d9('0x7')][_0x83d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32e667,_0x51127d,_0x2d7629){return new BPromise(function(_0x1b5014,_0x1b9c6f){return client[_0x83d9('0x9')](_0x32e667,_0x2d7629)['then'](function(_0x5d9ca6){logger[_0x83d9('0xa')](_0x83d9('0xb'),_0x51127d,'request\x20sent');logger['debug'](_0x83d9('0xc'),_0x51127d,_0x83d9('0xd'),JSON[_0x83d9('0xe')](_0x5d9ca6));if(_0x5d9ca6[_0x83d9('0xf')]){if(_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x10')]===0x1f4){logger[_0x83d9('0xf')](_0x83d9('0xb'),_0x51127d,_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x11')]);return _0x1b9c6f(_0x5d9ca6['error'][_0x83d9('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x51127d,_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x11')]);return _0x1b5014(_0x5d9ca6[_0x83d9('0xf')][_0x83d9('0x11')]);}else{logger['info'](_0x83d9('0xb'),_0x51127d,'request\x20sent');_0x1b5014(_0x5d9ca6[_0x83d9('0x12')][_0x83d9('0x11')]);}})[_0x83d9('0x13')](function(_0x490fc2){logger['error'](_0x83d9('0xb'),_0x51127d,_0x490fc2);_0x1b9c6f(_0x490fc2);});});}exports[_0x83d9('0x14')]=function(_0x5d2b0a){var _0xe5f857=this;return new Promise(function(_0xca61aa,_0x1e0faf){return db[_0x83d9('0x15')][_0x83d9('0x16')]({'raw':_0x5d2b0a['options']?_0x5d2b0a[_0x83d9('0x17')][_0x83d9('0x18')]===undefined?!![]:![]:!![],'where':_0x5d2b0a[_0x83d9('0x17')]?_0x5d2b0a[_0x83d9('0x17')]['where']||null:null,'attributes':_0x5d2b0a[_0x83d9('0x17')]?_0x5d2b0a[_0x83d9('0x17')]['attributes']||null:null,'limit':_0x5d2b0a['options']?_0x5d2b0a['options'][_0x83d9('0x19')]||null:null,'include':_0x5d2b0a[_0x83d9('0x17')]?_0x5d2b0a[_0x83d9('0x17')]['include']?_[_0x83d9('0x1a')](_0x5d2b0a[_0x83d9('0x17')]['include'],function(_0x5371fc){return{'model':db[_0x5371fc[_0x83d9('0x1b')]],'as':_0x5371fc['as'],'attributes':_0x5371fc['attributes'],'include':_0x5371fc[_0x83d9('0x1c')]?_[_0x83d9('0x1a')](_0x5371fc[_0x83d9('0x1c')],function(_0x195942){return{'model':db[_0x195942['model']],'as':_0x195942['as'],'attributes':_0x195942[_0x83d9('0x1d')],'include':_0x195942[_0x83d9('0x1c')]?_[_0x83d9('0x1a')](_0x195942[_0x83d9('0x1c')],function(_0xc826ea){return{'model':db[_0xc826ea[_0x83d9('0x1b')]],'as':_0xc826ea['as'],'attributes':_0xc826ea[_0x83d9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x83d9('0x1e')](function(_0x588051){logger[_0x83d9('0xa')](_0x83d9('0x14'),_0x5d2b0a);logger['debug'](_0x83d9('0x14'),_0x5d2b0a,JSON[_0x83d9('0xe')](_0x588051));_0xca61aa(_0x588051);})['catch'](function(_0x617ae4){logger[_0x83d9('0xf')](_0x83d9('0x14'),_0x617ae4[_0x83d9('0x11')],_0x5d2b0a);_0x1e0faf(_0xe5f857[_0x83d9('0xf')](0x1f4,_0x617ae4['message']));});});};exports['UpdateCmHopperBlack']=function(_0x31af31){var _0x3e5ec4=this;return new Promise(function(_0x5a8961,_0x24adc5){return db[_0x83d9('0x15')][_0x83d9('0x1f')](_0x31af31[_0x83d9('0x20')],{'raw':_0x31af31[_0x83d9('0x17')]?_0x31af31['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31af31[_0x83d9('0x17')]?_0x31af31['options'][_0x83d9('0x21')]||null:null,'attributes':_0x31af31[_0x83d9('0x17')]?_0x31af31[_0x83d9('0x17')][_0x83d9('0x1d')]||null:null,'limit':_0x31af31[_0x83d9('0x17')]?_0x31af31['options'][_0x83d9('0x19')]||null:null})[_0x83d9('0x1e')](function(_0x50eb23){logger[_0x83d9('0xa')](_0x83d9('0x22'),_0x31af31);logger[_0x83d9('0x23')]('UpdateCmHopperBlack',_0x31af31,JSON[_0x83d9('0xe')](_0x50eb23));_0x5a8961(_0x50eb23);})[_0x83d9('0x13')](function(_0x50e650){logger[_0x83d9('0xf')](_0x83d9('0x22'),_0x50e650[_0x83d9('0x11')],_0x31af31);_0x24adc5(_0x3e5ec4[_0x83d9('0xf')](0x1f4,_0x50e650['message']));});});};exports[_0x83d9('0x24')]=function(_0x1d840a){var _0x22803e=this;return new Promise(function(_0xeb5ad7,_0x3ee4d6){return db['CmHopperBlack'][_0x83d9('0x25')]({'where':_0x1d840a[_0x83d9('0x17')]?_0x1d840a[_0x83d9('0x17')]['where']||null:null})[_0x83d9('0x1e')](function(_0x44a21c){logger['info'](_0x83d9('0x24'),_0x1d840a);logger[_0x83d9('0x23')](_0x83d9('0x24'),_0x1d840a,JSON[_0x83d9('0xe')](_0x44a21c));_0xeb5ad7(_0x44a21c);})[_0x83d9('0x13')](function(_0x1f9fb8){logger[_0x83d9('0xf')]('DestroyCmHopperBlack',_0x1f9fb8[_0x83d9('0x11')],_0x1d840a);_0x3ee4d6(_0x22803e[_0x83d9('0xf')](0x1f4,_0x1f9fb8[_0x83d9('0x11')]));});});}; \ No newline at end of file +var _0x844b=['update','body','where','destroy','DestroyCmHopperBlack','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','map','model','include','UpdateCmHopperBlack'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x844b,0x1c1));var _0xb844=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x844b[_0x31df6f];return _0x31e353;};'use strict';var _=require(_0xb844('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb844('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb844('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb844('0x3'));var logger=require(_0xb844('0x4'))(_0xb844('0x5'));var config=require(_0xb844('0x6'));var jayson=require(_0xb844('0x7'));var client=jayson[_0xb844('0x8')][_0xb844('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x68bd89,_0x9733d6,_0x20149d){return new BPromise(function(_0x5e522f,_0x5bd308){return client[_0xb844('0xa')](_0x68bd89,_0x20149d)[_0xb844('0xb')](function(_0x2659f0){logger[_0xb844('0xc')](_0xb844('0xd'),_0x9733d6,'request\x20sent');logger[_0xb844('0xe')](_0xb844('0xf'),_0x9733d6,_0xb844('0x10'),JSON[_0xb844('0x11')](_0x2659f0));if(_0x2659f0['error']){if(_0x2659f0[_0xb844('0x12')]['code']===0x1f4){logger[_0xb844('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x9733d6,_0x2659f0[_0xb844('0x12')][_0xb844('0x13')]);return _0x5bd308(_0x2659f0['error'][_0xb844('0x13')]);}logger[_0xb844('0x12')](_0xb844('0xd'),_0x9733d6,_0x2659f0[_0xb844('0x12')][_0xb844('0x13')]);return _0x5e522f(_0x2659f0[_0xb844('0x12')][_0xb844('0x13')]);}else{logger[_0xb844('0xc')](_0xb844('0xd'),_0x9733d6,_0xb844('0x10'));_0x5e522f(_0x2659f0[_0xb844('0x14')]['message']);}})[_0xb844('0x15')](function(_0x394891){logger['error'](_0xb844('0xd'),_0x9733d6,_0x394891);_0x5bd308(_0x394891);});});}exports[_0xb844('0x16')]=function(_0xa5b0a3){var _0x38d292=this;return new Promise(function(_0x435b9a,_0x4e0631){return db[_0xb844('0x17')]['findAll']({'raw':_0xa5b0a3[_0xb844('0x18')]?_0xa5b0a3['options'][_0xb844('0x19')]===undefined?!![]:![]:!![],'where':_0xa5b0a3[_0xb844('0x18')]?_0xa5b0a3[_0xb844('0x18')]['where']||null:null,'attributes':_0xa5b0a3[_0xb844('0x18')]?_0xa5b0a3[_0xb844('0x18')][_0xb844('0x1a')]||null:null,'limit':_0xa5b0a3[_0xb844('0x18')]?_0xa5b0a3[_0xb844('0x18')][_0xb844('0x1b')]||null:null,'include':_0xa5b0a3[_0xb844('0x18')]?_0xa5b0a3[_0xb844('0x18')]['include']?_[_0xb844('0x1c')](_0xa5b0a3[_0xb844('0x18')]['include'],function(_0x3555dd){return{'model':db[_0x3555dd[_0xb844('0x1d')]],'as':_0x3555dd['as'],'attributes':_0x3555dd[_0xb844('0x1a')],'include':_0x3555dd[_0xb844('0x1e')]?_['map'](_0x3555dd['include'],function(_0x3c501d){return{'model':db[_0x3c501d[_0xb844('0x1d')]],'as':_0x3c501d['as'],'attributes':_0x3c501d[_0xb844('0x1a')],'include':_0x3c501d[_0xb844('0x1e')]?_[_0xb844('0x1c')](_0x3c501d[_0xb844('0x1e')],function(_0x387de1){return{'model':db[_0x387de1[_0xb844('0x1d')]],'as':_0x387de1['as'],'attributes':_0x387de1['attributes']};}):[]};}):[]};}):[]:[]})[_0xb844('0xb')](function(_0x44bd78){logger['info'](_0xb844('0x16'),_0xa5b0a3);logger['debug'](_0xb844('0x16'),_0xa5b0a3,JSON[_0xb844('0x11')](_0x44bd78));_0x435b9a(_0x44bd78);})[_0xb844('0x15')](function(_0x355085){logger['error'](_0xb844('0x16'),_0x355085[_0xb844('0x13')],_0xa5b0a3);_0x4e0631(_0x38d292[_0xb844('0x12')](0x1f4,_0x355085['message']));});});};exports[_0xb844('0x1f')]=function(_0x275230){var _0x1ff848=this;return new Promise(function(_0x4505fe,_0x5a1a7b){return db[_0xb844('0x17')][_0xb844('0x20')](_0x275230[_0xb844('0x21')],{'raw':_0x275230['options']?_0x275230[_0xb844('0x18')][_0xb844('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x275230['options']?_0x275230['options'][_0xb844('0x22')]||null:null,'attributes':_0x275230['options']?_0x275230['options']['attributes']||null:null,'limit':_0x275230['options']?_0x275230['options'][_0xb844('0x1b')]||null:null})[_0xb844('0xb')](function(_0x502c8b){logger['info'](_0xb844('0x1f'),_0x275230);logger['debug']('UpdateCmHopperBlack',_0x275230,JSON[_0xb844('0x11')](_0x502c8b));_0x4505fe(_0x502c8b);})[_0xb844('0x15')](function(_0x71c71f){logger[_0xb844('0x12')](_0xb844('0x1f'),_0x71c71f[_0xb844('0x13')],_0x275230);_0x5a1a7b(_0x1ff848[_0xb844('0x12')](0x1f4,_0x71c71f[_0xb844('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x5c378d){var _0x66f0af=this;return new Promise(function(_0x48a6e2,_0x4f1e56){return db['CmHopperBlack'][_0xb844('0x23')]({'where':_0x5c378d[_0xb844('0x18')]?_0x5c378d['options'][_0xb844('0x22')]||null:null})['then'](function(_0xef146e){logger['info'](_0xb844('0x24'),_0x5c378d);logger[_0xb844('0xe')]('DestroyCmHopperBlack',_0x5c378d,JSON[_0xb844('0x11')](_0xef146e));_0x48a6e2(_0xef146e);})[_0xb844('0x15')](function(_0x322b3f){logger[_0xb844('0x12')](_0xb844('0x24'),_0x322b3f[_0xb844('0x13')],_0x5c378d);_0x4f1e56(_0x66f0af[_0xb844('0x12')](0x1f4,_0x322b3f[_0xb844('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 077d1a4..4e9c7f5 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 _0xfb65=['put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3fba58,_0x273bde){var _0x329f81=function(_0x528f38){while(--_0x528f38){_0x3fba58['push'](_0x3fba58['shift']());}};_0x329f81(++_0x273bde);}(_0xfb65,0x82));var _0x5fb6=function(_0x46a509,_0x44fa7d){_0x46a509=_0x46a509-0x0;var _0x23832f=_0xfb65[_0x46a509];return _0x23832f;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var fs_extra=require(_0x5fb6('0x3'));var auth=require(_0x5fb6('0x4'));var interaction=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router[_0x5fb6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5fb6('0x8')](_0x5fb6('0x9'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xb')]);router['get'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xd')]);router[_0x5fb6('0xe')]('/:id',auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xf')]);router['delete'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0x10')]);module[_0x5fb6('0x11')]=router; \ No newline at end of file +var _0x57ca=['../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x352d76,_0x1afeb4){var _0x4990f3=function(_0x13cc28){while(--_0x13cc28){_0x352d76['push'](_0x352d76['shift']());}};_0x4990f3(++_0x1afeb4);}(_0x57ca,0x108));var _0xa57c=function(_0x540e11,_0x46f768){_0x540e11=_0x540e11-0x0;var _0x5dec89=_0x57ca[_0x540e11];return _0x5dec89;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/:id',auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x10')](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0x11')]);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 890906d..6df1998 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 _0x289f=['sequelize','moment','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x4d1761,_0x2d9fa4){var _0x502cfb=function(_0x23f0e6){while(--_0x23f0e6){_0x4d1761['push'](_0x4d1761['shift']());}};_0x502cfb(++_0x2d9fa4);}(_0x289f,0x9c));var _0xf289=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x289f[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0xf289('0x0'));var moment=require(_0xf289('0x1'));module[_0xf289('0x2')]={'state':{'type':Sequelize[_0xf289('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf289('0x4')]},'countbusyretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf289('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xf289('0x5')]},'originatecalleridname':{'type':Sequelize[_0xf289('0x5')]},'calleridnum':{'type':Sequelize[_0xf289('0x5')]},'calleridname':{'type':Sequelize[_0xf289('0x5')]},'starttime':{'type':Sequelize[_0xf289('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf289('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf289('0x5')]},'campaign':{'type':Sequelize[_0xf289('0x5')]},'campaigntype':{'type':Sequelize[_0xf289('0x5')]},'membername':{'type':Sequelize[_0xf289('0x5')]},'reason':{'type':Sequelize[_0xf289('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf289('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf289('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x49b8df){var _0x5cd80e=this[_0xf289('0x6')](_0xf289('0x7'));if(_0x5cd80e&&_0x49b8df){this[_0xf289('0x8')](_0xf289('0x9'),moment(_0x49b8df)[_0xf289('0xa')](moment(_0x5cd80e),_0xf289('0xb')));}}},'amd':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf289('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf289('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf289('0x4')]},'recallme':{'type':Sequelize[_0xf289('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf289('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf289('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c0a=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','exports','INTEGER'];(function(_0x3f5f08,_0x1ccd7f){var _0x566dd9=function(_0x952e6a){while(--_0x952e6a){_0x3f5f08['push'](_0x3f5f08['shift']());}};_0x566dd9(++_0x1ccd7f);}(_0x9c0a,0x1c0));var _0xa9c0=function(_0x4180ec,_0x1d2656){_0x4180ec=_0x4180ec-0x0;var _0x53c5d4=_0x9c0a[_0x4180ec];return _0x53c5d4;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xa9c0('0x0')]={'state':{'type':Sequelize[_0xa9c0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa9c0('0x2')]},'scheduledat':{'type':Sequelize[_0xa9c0('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa9c0('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa9c0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xa9c0('0x3')]},'responsetime':{'type':Sequelize[_0xa9c0('0x3')]},'answertime':{'type':Sequelize[_0xa9c0('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa9c0('0x3')]},'ringtime':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa9c0('0x2')]},'campaign':{'type':Sequelize[_0xa9c0('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa9c0('0x2')]},'disposition':{'type':Sequelize[_0xa9c0('0x2')]},'secondDisposition':{'type':Sequelize[_0xa9c0('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3206e8){var _0x1797cc=this[_0xa9c0('0x4')](_0xa9c0('0x5'));if(_0x1797cc&&_0x3206e8){this[_0xa9c0('0x6')](_0xa9c0('0x7'),moment(_0x3206e8)[_0xa9c0('0x8')](moment(_0x1797cc),'seconds'));}}},'amd':{'type':Sequelize[_0xa9c0('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa9c0('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa9c0('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa9c0('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa9c0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa9c0('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa9c0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa9c0('0x1')],'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 5869fa2..27bc8b6 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 _0xe2fe=['calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','select','calleridnum','state\x20=\x204','group','scheduledAt','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','CmHopperFinal','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','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','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state'];(function(_0x3dd1d6,_0x208fb8){var _0x13f57e=function(_0x3aa764){while(--_0x3aa764){_0x3dd1d6['push'](_0x3dd1d6['shift']());}};_0x13f57e(++_0x208fb8);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['CmHopperFinal']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['describe']=function(_0x1609f0,_0x54cc44){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x54cc44,null))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x32da72,_0x584383){if(_0x32da72[_0xee2f('0x3e')]['uniqueid']){delete _0x32da72[_0xee2f('0x3e')][_0xee2f('0x3f')];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'uniqueid':_0x32da72[_0xee2f('0x40')]['id']}})['then'](handleEntityNotFound(_0x584383,null))['then'](saveUpdates(_0x32da72[_0xee2f('0x3e')],null))['then'](respondWithResult(_0x584383,null))[_0xee2f('0x3b')](handleError(_0x584383,null));};exports[_0xee2f('0x41')]=function(_0x1928f8,_0x88e683,_0x4fb3a0){return db['CmHopperFinal'][_0xee2f('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x1928f8[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x46')))),_0xee2f('0x47')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x48')))),_0xee2f('0x49')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')]['literal'](_0xee2f('0x4e')))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x50')))),_0xee2f('0x51')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x52')))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x88e683,null))['then'](respondWithResult(_0x88e683,null))['catch'](handleError(_0x88e683,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x8f90e6,_0x511e54,_0x2891ed){return db[_0xee2f('0x23')][_0xee2f('0x42')]({'raw':![],'where':{'CampaignId':_0x8f90e6[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x200,\x201,\x20null'))),_0xee2f('0x47')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x48')))),'noAnswerContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2019,\x201,\x20null'))),_0xee2f('0x55')]]})[_0xee2f('0x1c')](handleEntityNotFound(_0x511e54,null))[_0xee2f('0x1c')](respondWithResult(_0x511e54,null))[_0xee2f('0x3b')](handleError(_0x511e54,null));};exports[_0xee2f('0x56')]=function(_0x2adcc6,_0x43b883,_0x97edb2){return db[_0xee2f('0x57')]['find']({'where':{'id':_0x2adcc6['params']['id']}})['then'](handleEntityNotFound(_0x43b883,null))[_0xee2f('0x1c')](function(_0x19ce25){var _0x4288eb;if(_0x19ce25){_0x4288eb=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')]([_0xee2f('0x5b'),'scheduledAt',_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x5e'),'createdAt',_0xee2f('0x5f')],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),'phone')[_0xee2f('0x60')](_0xee2f('0x62'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0xee2f('0x5c'))['field']('ANY_VALUE(ListId)',_0xee2f('0x5d'))[_0xee2f('0x60')]('ANY_VALUE(VoiceQueueId)',_0xee2f('0x5e'))['field'](_0xee2f('0x62'),_0xee2f('0x63'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))['where'](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2adcc6['body'][_0xee2f('0x69')][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')](_0xee2f('0x6b'),squel['select']()['field'](_0xee2f('0x5b'))[_0xee2f('0x64')](_0xee2f('0x6c'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x6e'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6f')))[_0xee2f('0x70')]('ContactId'))['toString']();return db[_0xee2f('0x43')]['query'](_0x4288eb);}return[];})['then'](respondWithResult(_0x43b883,null))['catch'](handleError(_0x43b883,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2ea31f,_0x277507,_0x500459){return db['Campaign'][_0xee2f('0x3d')]({'where':{'id':_0x2ea31f[_0xee2f('0x40')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x277507,null))['then'](function(_0x4aeae5){var _0x2b6f0f;if(_0x4aeae5){_0x2b6f0f=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')](['phone',_0xee2f('0x71'),'ContactId',_0xee2f('0x5d'),_0xee2f('0x72'),_0xee2f('0x63'),'updatedAt'],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),_0xee2f('0x5b'))['field'](_0xee2f('0x62'),_0xee2f('0x71'))[_0xee2f('0x60')](_0xee2f('0x73'),_0xee2f('0x5c'))[_0xee2f('0x60')](_0xee2f('0x74'),_0xee2f('0x5d'))[_0xee2f('0x60')](_0xee2f('0x75'),_0xee2f('0x72'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x63'))['field'](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x76'),_0x2ea31f[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2ea31f[_0xee2f('0x3e')]['state'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x5b'))['from']('cm_hopper')[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f['params']['id']['toString']()))[_0xee2f('0x32')](_0xee2f('0x6b'),squel[_0xee2f('0x6d')]()[_0xee2f('0x60')]('calleridnum')[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f[_0xee2f('0x40')]['id']['toString']())[_0xee2f('0x32')]('state\x20=\x204'))['group'](_0xee2f('0x5c')))['toString']();return db[_0xee2f('0x43')]['query'](_0x2b6f0f);}return[];})['then'](respondWithResult(_0x277507,null))[_0xee2f('0x3b')](handleError(_0x277507,null));};exports[_0xee2f('0x77')]=function(_0x4fed80,_0x2685ed,_0x34f882){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5e')],'CampaignId':_0x4fed80['body'][_0xee2f('0x72')],'ContactId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5c')]}})[_0xee2f('0x1c')](handleEntityNotFound(_0x2685ed,null))[_0xee2f('0x1c')](function(_0x4f20e9){if(_0x4f20e9){return _0x4f20e9;}return null;})['then'](respondWithResult(_0x2685ed,null))['catch'](handleError(_0x2685ed,null));}; \ No newline at end of file +var _0xba34=['insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0xba34,0x119));var _0x4ba3=function(_0x246c61,_0x4e2925){_0x246c61=_0x246c61-0x0;var _0x501e6a=_0xba34[_0x246c61];return _0x501e6a;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['describe']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['describe']()[_0x4ba3('0x26')](respondWithResult(_0x1fe115,null))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports[_0x4ba3('0x25')]=function(_0x58648d,_0x47f588){if(_0x58648d[_0x4ba3('0x49')]['uniqueid']){delete _0x58648d[_0x4ba3('0x49')][_0x4ba3('0x4a')];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'uniqueid':_0x58648d[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x47f588,null))['then'](saveUpdates(_0x58648d[_0x4ba3('0x49')],null))[_0x4ba3('0x26')](respondWithResult(_0x47f588,null))['catch'](handleError(_0x47f588,null));};exports[_0x4ba3('0x4c')]=function(_0x12ae6f,_0x156c2d,_0x19d6a3){return db[_0x4ba3('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x12ae6f[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),_0x4ba3('0x53')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4ba3('0x54')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5a')))),_0x4ba3('0x5b')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x156c2d,null))[_0x4ba3('0x26')](respondWithResult(_0x156c2d,null))[_0x4ba3('0x46')](handleError(_0x156c2d,null));};exports[_0x4ba3('0x5d')]=function(_0xf0fd32,_0x4b5289,_0x3d9a7e){return db[_0x4ba3('0x2d')][_0x4ba3('0x44')]({'raw':![],'where':{'CampaignId':_0xf0fd32[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),'noAnswerContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x5e')))),'busyContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5f')))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4ba3('0x5b')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x4b5289,null))['then'](respondWithResult(_0x4b5289,null))[_0x4ba3('0x46')](handleError(_0x4b5289,null));};exports[_0x4ba3('0x60')]=function(_0x5dce8f,_0x37fedb,_0x2ed729){return db[_0x4ba3('0x61')][_0x4ba3('0x48')]({'where':{'id':_0x5dce8f[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x37fedb,null))[_0x4ba3('0x26')](function(_0x329874){var _0x360127;if(_0x329874){_0x360127=squel['insert']()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),_0x4ba3('0x66'),_0x4ba3('0x67'),_0x4ba3('0x68'),_0x4ba3('0x69'),_0x4ba3('0x6a'),_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')]('ANY_VALUE(calleridnum)',_0x4ba3('0x65'))[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')]('ANY_VALUE(ContactId)','ContactId')[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x6f'),_0x4ba3('0x69'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')]('state\x20=\x20?',_0x5dce8f[_0x4ba3('0x49')][_0x4ba3('0x75')][_0x4ba3('0x74')]())['where'](_0x4ba3('0x76'))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')]('cm_hopper')['where'](_0x4ba3('0x73'),_0x5dce8f['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field']('calleridnum')[_0x4ba3('0x71')](_0x4ba3('0x72'))['where'](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')](_0x4ba3('0x67')))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x360127);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x37fedb,null))['catch'](handleError(_0x37fedb,null));};exports[_0x4ba3('0x7a')]=function(_0x13dbc4,_0x4e334c,_0x39d1d3){return db[_0x4ba3('0x7b')]['find']({'where':{'id':_0x13dbc4['params']['id']}})['then'](handleEntityNotFound(_0x4e334c,null))['then'](function(_0x206e93){var _0x2d57a7;if(_0x206e93){_0x2d57a7=squel[_0x4ba3('0x7c')]()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),'scheduledAt',_0x4ba3('0x67'),'ListId',_0x4ba3('0x7d'),'createdAt',_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x7e'),_0x4ba3('0x65'))['field']('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')](_0x4ba3('0x7f'),_0x4ba3('0x67'))[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x80'),_0x4ba3('0x7d'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x81'),_0x13dbc4['body']['state'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x76'))['where'](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')](_0x4ba3('0x63'))['where'](_0x4ba3('0x82'),_0x13dbc4['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field'](_0x4ba3('0x83'))[_0x4ba3('0x71')]('cm_hopper_final')[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')]('ContactId'))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x2d57a7);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x4e334c,null))['catch'](handleError(_0x4e334c,null));};exports[_0x4ba3('0x84')]=function(_0x38a7a8,_0x5553eb,_0x402ab1){return db[_0x4ba3('0x85')][_0x4ba3('0x86')]({'where':{'VoiceQueueId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x69')],'CampaignId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x7d')],'ContactId':_0x38a7a8[_0x4ba3('0x49')]['ContactId']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5553eb,null))[_0x4ba3('0x26')](function(_0xfb16a6){if(_0xfb16a6){return _0xfb16a6;}return null;})[_0x4ba3('0x26')](respondWithResult(_0x5553eb,null))[_0x4ba3('0x46')](handleError(_0x5553eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2c8e9f1..4e52b69 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 _0x49d6=['bluebird','rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5d4000,_0x4209b7){var _0xc41b07=function(_0x2ae10e){while(--_0x2ae10e){_0x5d4000['push'](_0x5d4000['shift']());}};_0xc41b07(++_0x4209b7);}(_0x49d6,0x1c2));var _0x649d=function(_0x4b4bd3,_0x5d9048){_0x4b4bd3=_0x4b4bd3-0x0;var _0x55a967=_0x49d6[_0x4b4bd3];return _0x55a967;};'use strict';var _=require(_0x649d('0x0'));var util=require(_0x649d('0x1'));var logger=require(_0x649d('0x2'))(_0x649d('0x3'));var moment=require(_0x649d('0x4'));var BPromise=require(_0x649d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x649d('0x6'));var config=require('../../config/environment');var attributes=require(_0x649d('0x7'));module[_0x649d('0x8')]=function(_0x17d472,_0x3ed7d8){return _0x17d472[_0x649d('0x9')]('CmHopperFinal',attributes,{'tableName':_0x649d('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x649d('0xb')]},{'name':_0x649d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4820=['moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x4820,0xdd));var _0x0482=function(_0x506782,_0x4dcb99){_0x506782=_0x506782-0x0;var _0x32fa34=_0x4820[_0x506782];return _0x32fa34;};'use strict';var _=require(_0x0482('0x0'));var util=require(_0x0482('0x1'));var logger=require(_0x0482('0x2'))(_0x0482('0x3'));var moment=require(_0x0482('0x4'));var BPromise=require(_0x0482('0x5'));var rp=require(_0x0482('0x6'));var fs=require('fs');var path=require(_0x0482('0x7'));var rimraf=require(_0x0482('0x8'));var config=require('../../config/environment');var attributes=require(_0x0482('0x9'));module[_0x0482('0xa')]=function(_0x4bdc64,_0x307ddf){return _0x4bdc64[_0x0482('0xb')]('CmHopperFinal',attributes,{'tableName':_0x0482('0xc'),'paranoid':![],'indexes':[{'name':_0x0482('0xd'),'fields':[_0x0482('0xd')]},{'name':_0x0482('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 46a7215..e258a04 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(_0x5138a0,_0x475498){var _0x2eeee1=function(_0x942f90){while(--_0x942f90){_0x5138a0['push'](_0x5138a0['shift']());}};_0x2eeee1(++_0x475498);}(_0x7a54,0x106));var _0x47a5=function(_0x41629a,_0x581f02){_0x41629a=_0x41629a-0x0;var _0x3cc27e=_0x7a54[_0x41629a];return _0x3cc27e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2c35c6,_0x171545){var _0x21db3f=function(_0x3db585){while(--_0x3db585){_0x2c35c6['push'](_0x2c35c6['shift']());}};_0x21db3f(++_0x171545);}(_0x7a54,0x106));var _0x47a5=function(_0x5d57ed,_0x2a0482){_0x5d57ed=_0x5d57ed-0x0;var _0x1755c3=_0x7a54[_0x5d57ed];return _0x1755c3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 31cb797..9d68c18 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 _0x07cb=['/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post'];(function(_0x3722b3,_0x18a764){var _0x4614ae=function(_0x522c8e){while(--_0x522c8e){_0x3722b3['push'](_0x3722b3['shift']());}};_0x4614ae(++_0x18a764);}(_0x07cb,0x149));var _0xb07c=function(_0xe455e7,_0x29fb65){_0xe455e7=_0xe455e7-0x0;var _0xfc683e=_0x07cb[_0xe455e7];return _0xfc683e;};'use strict';var multer=require(_0xb07c('0x0'));var util=require(_0xb07c('0x1'));var path=require('path');var timeout=require(_0xb07c('0x2'));var express=require(_0xb07c('0x3'));var router=express[_0xb07c('0x4')]();var fs_extra=require(_0xb07c('0x5'));var auth=require(_0xb07c('0x6'));var interaction=require(_0xb07c('0x7'));var config=require(_0xb07c('0x8'));var controller=require(_0xb07c('0x9'));router[_0xb07c('0xa')]('/',auth['isAuthenticated'](),controller[_0xb07c('0xb')]);router['get'](_0xb07c('0xc'),auth[_0xb07c('0xd')](),controller[_0xb07c('0xe')]);router['get'](_0xb07c('0xf'),auth[_0xb07c('0xd')](),controller['show']);router[_0xb07c('0xa')](_0xb07c('0x10'),auth[_0xb07c('0xd')](),controller[_0xb07c('0x11')]);router[_0xb07c('0xa')](_0xb07c('0x12'),auth[_0xb07c('0xd')](),controller[_0xb07c('0x13')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xb07c('0xd')](),controller[_0xb07c('0x14')]);router[_0xb07c('0x15')](_0xb07c('0x16'),auth[_0xb07c('0xd')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xb07c('0x15')]('/checkContactHopper',auth[_0xb07c('0xd')](),controller[_0xb07c('0x17')]);router[_0xb07c('0x18')]('/:id',auth[_0xb07c('0xd')](),controller[_0xb07c('0x19')]);module[_0xb07c('0x1a')]=router; \ No newline at end of file +var _0x7c5a=['describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','update','exports','util','path','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x7c5a,0x184));var _0xa7c5=function(_0x3c4873,_0x5aab79){_0x3c4873=_0x3c4873-0x0;var _0x332ab1=_0x7c5a[_0x3c4873];return _0x332ab1;};'use strict';var multer=require('multer');var util=require(_0xa7c5('0x0'));var path=require(_0xa7c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa7c5('0x2'));var interaction=require(_0xa7c5('0x3'));var config=require('../../config/environment');var controller=require(_0xa7c5('0x4'));router['get']('/',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x6')]);router[_0xa7c5('0x7')]('/describe',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x8')]);router[_0xa7c5('0x7')](_0xa7c5('0x9'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0xa')]);router[_0xa7c5('0x7')](_0xa7c5('0xb'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xa7c5('0xc'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0xd')]);router[_0xa7c5('0xe')](_0xa7c5('0xf'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x10')]);router['post'](_0xa7c5('0x11'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x12')]);router['post']('/checkContactHopper',auth[_0xa7c5('0x5')](),controller['checkContactHopper']);router[_0xa7c5('0x13')](_0xa7c5('0x9'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x14')]);module[_0xa7c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 4b6f526..3de5623 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 _0xe76b=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x3439b4,_0x3689e1){var _0x2ce10b=function(_0x5a567e){while(--_0x5a567e){_0x3439b4['push'](_0x3439b4['shift']());}};_0x2ce10b(++_0x3689e1);}(_0xe76b,0x72));var _0xbe76=function(_0x4b3f3e,_0x47dfcc){_0x4b3f3e=_0x4b3f3e-0x0;var _0x921fc3=_0xe76b[_0x4b3f3e];return _0x921fc3;};'use strict';var Sequelize=require('sequelize');module[_0xbe76('0x0')]={'state':{'type':Sequelize[_0xbe76('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xbe76('0x2')]},'scheduledat':{'type':Sequelize[_0xbe76('0x3')]},'countbusyretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbe76('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbe76('0x2')]},'originatecalleridname':{'type':Sequelize[_0xbe76('0x2')]},'calleridnum':{'type':Sequelize[_0xbe76('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbe76('0x3')]},'answertime':{'type':Sequelize[_0xbe76('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbe76('0x3')]},'ringtime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xbe76('0x2')]},'campaigntype':{'type':Sequelize[_0xbe76('0x2')]},'membername':{'type':Sequelize[_0xbe76('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbe76('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbe76('0x3')]},'recallme':{'type':Sequelize[_0xbe76('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbe76('0x3')]},'edited':{'type':Sequelize[_0xbe76('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbe76('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xbe76('0x2')]}}; \ No newline at end of file +var _0x5b3e=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x12bdbd,_0x2b3ae9){var _0x248f2c=function(_0x3103c4){while(--_0x3103c4){_0x12bdbd['push'](_0x12bdbd['shift']());}};_0x248f2c(++_0x2b3ae9);}(_0x5b3e,0x160));var _0xe5b3=function(_0x1ea1ac,_0x16fd71){_0x1ea1ac=_0x1ea1ac-0x0;var _0x2b5316=_0x5b3e[_0x1ea1ac];return _0x2b5316;};'use strict';var Sequelize=require(_0xe5b3('0x0'));module['exports']={'state':{'type':Sequelize[_0xe5b3('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe5b3('0x2')]},'scheduledat':{'type':Sequelize[_0xe5b3('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe5b3('0x2')]},'originatecalleridname':{'type':Sequelize[_0xe5b3('0x2')]},'calleridnum':{'type':Sequelize[_0xe5b3('0x2')]},'calleridname':{'type':Sequelize[_0xe5b3('0x2')]},'starttime':{'type':Sequelize[_0xe5b3('0x3')]},'responsetime':{'type':Sequelize[_0xe5b3('0x3')]},'answertime':{'type':Sequelize[_0xe5b3('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe5b3('0x3')]},'ringtime':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe5b3('0x2')]},'campaign':{'type':Sequelize[_0xe5b3('0x2')]},'campaigntype':{'type':Sequelize[_0xe5b3('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe5b3('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe5b3('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe5b3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe5b3('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe5b3('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe5b3('0x3')]},'edited':{'type':Sequelize[_0xe5b3('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe5b3('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9c69084..b0891af 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 _0xb50d=['show','params','includeAll','find','catch','create','body','uniqueid','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','status','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','CmHopperHistory','findAll','rows'];(function(_0x593948,_0x190869){var _0x4e2792=function(_0x4e2d9f){while(--_0x4e2d9f){_0x593948['push'](_0x593948['shift']());}};_0x4e2792(++_0x190869);}(_0xb50d,0xf5));var _0xdb50=function(_0x390a10,_0x2066fb){_0x390a10=_0x390a10-0x0;var _0x3a5c9a=_0xb50d[_0x390a10];return _0x3a5c9a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdb50('0x0'));var jsonpatch=require(_0xdb50('0x1'));var rp=require('request-promise');var moment=require(_0xdb50('0x2'));var BPromise=require(_0xdb50('0x3'));var Mustache=require(_0xdb50('0x4'));var util=require(_0xdb50('0x5'));var path=require(_0xdb50('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb50('0x7'));var fs=require('fs');var fs_extra=require(_0xdb50('0x8'));var _=require(_0xdb50('0x9'));var squel=require(_0xdb50('0xa'));var crypto=require(_0xdb50('0xb'));var jsforce=require(_0xdb50('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdb50('0xd'));var querystring=require(_0xdb50('0xe'));var Papa=require(_0xdb50('0xf'));var Redis=require(_0xdb50('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdb50('0x11'));var as=require(_0xdb50('0x12'));var hardwareService=require(_0xdb50('0x13'));var logger=require(_0xdb50('0x14'))(_0xdb50('0x15'));var utils=require(_0xdb50('0x16'));var config=require(_0xdb50('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb50('0x18'))['db'];function respondWithStatusCode(_0x596a55,_0x3ebb35){_0x3ebb35=_0x3ebb35||0xcc;return function(_0x1562a4){if(_0x1562a4){return _0x596a55[_0xdb50('0x19')](_0x3ebb35);}return _0x596a55['status'](_0x3ebb35)[_0xdb50('0x1a')]();};}function respondWithResult(_0x16d3df,_0x300721){_0x300721=_0x300721||0xc8;return function(_0x36255b){if(_0x36255b){return _0x16d3df['status'](_0x300721)[_0xdb50('0x1b')](_0x36255b);}};}function respondWithFilteredResult(_0x1208d2,_0x121994){return function(_0x36309f){if(_0x36309f){var _0x39c721=typeof _0x121994[_0xdb50('0x1c')]==='undefined'&&typeof _0x121994[_0xdb50('0x1d')]===_0xdb50('0x1e');var _0x4cb978=_0x36309f['count'];var _0x44cab0=_0x39c721?0x0:_0x121994[_0xdb50('0x1c')];var _0x4498cc=_0x39c721?_0x36309f[_0xdb50('0x1f')]:_0x121994['offset']+_0x121994['limit'];var _0x66a8b9;if(_0x4498cc>=_0x4cb978){_0x4498cc=_0x4cb978;_0x66a8b9=0xc8;}else{_0x66a8b9=0xce;}_0x1208d2['status'](_0x66a8b9);return _0x1208d2[_0xdb50('0x20')](_0xdb50('0x21'),_0x44cab0+'-'+_0x4498cc+'/'+_0x4cb978)['json'](_0x36309f);}return null;};}function patchUpdates(_0xfe3b37){return function(_0x959138){try{jsonpatch[_0xdb50('0x22')](_0x959138,_0xfe3b37,!![]);}catch(_0x1f46f7){return BPromise[_0xdb50('0x23')](_0x1f46f7);}return _0x959138['save']();};}function saveUpdates(_0x7fe381,_0x32d012){return function(_0x3abfc2){if(_0x3abfc2){return _0x3abfc2[_0xdb50('0x24')](_0x7fe381)[_0xdb50('0x25')](function(_0x1c1b1d){return _0x1c1b1d;});}return null;};}function removeEntity(_0x1c0e9a,_0x5afc0a){return function(_0x46e4a3){if(_0x46e4a3){return _0x46e4a3[_0xdb50('0x26')]()[_0xdb50('0x25')](function(){_0x1c0e9a[_0xdb50('0x27')](0xcc)[_0xdb50('0x1a')]();});}};}function handleEntityNotFound(_0x54dd8a,_0x560a2f){return function(_0x557610){if(!_0x557610){_0x54dd8a[_0xdb50('0x19')](0x194);}return _0x557610;};}function handleError(_0xc99019,_0x42a3d1){_0x42a3d1=_0x42a3d1||0x1f4;return function(_0x2a56e2){logger['error'](_0x2a56e2[_0xdb50('0x28')]);if(_0x2a56e2[_0xdb50('0x29')]){delete _0x2a56e2[_0xdb50('0x29')];}_0xc99019[_0xdb50('0x27')](_0x42a3d1)[_0xdb50('0x2a')](_0x2a56e2);};}exports[_0xdb50('0x2b')]=function(_0x21bb49,_0xe72375){var _0x5ca71b={},_0x57d094={},_0x57c4c7={'count':0x0,'rows':[]};var _0x5d9c29=_[_0xdb50('0x2c')](db['CmHopperHistory'][_0xdb50('0x2d')],function(_0x52ed49){return{'name':_0x52ed49[_0xdb50('0x2e')],'type':_0x52ed49['type'][_0xdb50('0x2f')]};});_0x57d094[_0xdb50('0x30')]=_[_0xdb50('0x2c')](_0x5d9c29,_0xdb50('0x29'));_0x57d094[_0xdb50('0x31')]=_[_0xdb50('0x32')](_0x21bb49['query']);_0x57d094['filters']=_[_0xdb50('0x33')](_0x57d094['model'],_0x57d094[_0xdb50('0x31')]);_0x5ca71b['attributes']=_[_0xdb50('0x33')](_0x57d094['model'],qs[_0xdb50('0x34')](_0x21bb49['query'][_0xdb50('0x34')]));_0x5ca71b[_0xdb50('0x35')]=_0x5ca71b[_0xdb50('0x35')][_0xdb50('0x36')]?_0x5ca71b[_0xdb50('0x35')]:_0x57d094[_0xdb50('0x30')];if(!_0x21bb49['query'][_0xdb50('0x37')](_0xdb50('0x38'))){_0x5ca71b[_0xdb50('0x1d')]=qs['limit'](_0x21bb49['query'][_0xdb50('0x1d')]);_0x5ca71b[_0xdb50('0x1c')]=qs[_0xdb50('0x1c')](_0x21bb49[_0xdb50('0x31')][_0xdb50('0x1c')]);}_0x5ca71b[_0xdb50('0x39')]=qs[_0xdb50('0x3a')](_0x21bb49['query'][_0xdb50('0x3a')]);_0x5ca71b[_0xdb50('0x3b')]=qs[_0xdb50('0x3c')](_[_0xdb50('0x3d')](_0x21bb49[_0xdb50('0x31')],_0x57d094[_0xdb50('0x3c')]),_0x5d9c29);if(_0x21bb49['query'][_0xdb50('0x3e')]){_0x5ca71b[_0xdb50('0x3b')]=_[_0xdb50('0x3f')](_0x5ca71b[_0xdb50('0x3b')],{'$or':_[_0xdb50('0x2c')](_0x5d9c29,function(_0x2d40ba){if(_0x2d40ba[_0xdb50('0x40')]!==_0xdb50('0x41')){var _0x450600={};_0x450600[_0x2d40ba['name']]={'$like':'%'+_0x21bb49['query'][_0xdb50('0x3e')]+'%'};return _0x450600;}})});}_0x5ca71b=_[_0xdb50('0x3f')]({},_0x5ca71b,_0x21bb49[_0xdb50('0x42')]);var _0x1665f3={'where':_0x5ca71b[_0xdb50('0x3b')]};return db['CmHopperHistory'][_0xdb50('0x1f')](_0x1665f3)[_0xdb50('0x25')](function(_0x341ec0){_0x57c4c7[_0xdb50('0x1f')]=_0x341ec0;if(_0x21bb49['query']['includeAll']){_0x5ca71b[_0xdb50('0x43')]=[{'all':!![]}];}return db[_0xdb50('0x44')][_0xdb50('0x45')](_0x5ca71b);})[_0xdb50('0x25')](function(_0x6a3e8c){_0x57c4c7[_0xdb50('0x46')]=_0x6a3e8c;return _0x57c4c7;})['then'](respondWithFilteredResult(_0xe72375,_0x5ca71b))['catch'](handleError(_0xe72375,null));};exports[_0xdb50('0x47')]=function(_0x5a2776,_0x66ceda){var _0x526eb6={'raw':!![],'where':{'id':_0x5a2776[_0xdb50('0x48')]['id']}},_0xe15bd8={};_0xe15bd8['model']=_[_0xdb50('0x32')](db[_0xdb50('0x44')][_0xdb50('0x2d')]);_0xe15bd8[_0xdb50('0x31')]=_[_0xdb50('0x32')](_0x5a2776[_0xdb50('0x31')]);_0xe15bd8[_0xdb50('0x3c')]=_[_0xdb50('0x33')](_0xe15bd8['model'],_0xe15bd8[_0xdb50('0x31')]);_0x526eb6['attributes']=_[_0xdb50('0x33')](_0xe15bd8[_0xdb50('0x30')],qs[_0xdb50('0x34')](_0x5a2776['query'][_0xdb50('0x34')]));_0x526eb6[_0xdb50('0x35')]=_0x526eb6[_0xdb50('0x35')]['length']?_0x526eb6['attributes']:_0xe15bd8[_0xdb50('0x30')];if(_0x5a2776[_0xdb50('0x31')][_0xdb50('0x49')]){_0x526eb6[_0xdb50('0x43')]=[{'all':!![]}];}_0x526eb6=_[_0xdb50('0x3f')]({},_0x526eb6,_0x5a2776[_0xdb50('0x42')]);return db[_0xdb50('0x44')][_0xdb50('0x4a')](_0x526eb6)[_0xdb50('0x25')](handleEntityNotFound(_0x66ceda,null))['then'](respondWithResult(_0x66ceda,null))[_0xdb50('0x4b')](handleError(_0x66ceda,null));};exports[_0xdb50('0x4c')]=function(_0x504776,_0xd2962d){return db[_0xdb50('0x44')]['create'](_0x504776[_0xdb50('0x4d')],{})[_0xdb50('0x25')](respondWithResult(_0xd2962d,0xc9))[_0xdb50('0x4b')](handleError(_0xd2962d,null));};exports['describe']=function(_0x21ae7f,_0x5701b6){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x5701b6,null))[_0xdb50('0x4b')](handleError(_0x5701b6,null));};exports['update']=function(_0x2b01ec,_0x3c60be){if(_0x2b01ec['body'][_0xdb50('0x4e')]){delete _0x2b01ec['body']['uniqueid'];}return db['CmHopperHistory'][_0xdb50('0x4a')]({'where':{'uniqueid':_0x2b01ec[_0xdb50('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c60be,null))['then'](saveUpdates(_0x2b01ec[_0xdb50('0x4d')],null))['then'](respondWithResult(_0x3c60be,null))[_0xdb50('0x4b')](handleError(_0x3c60be,null));}; \ No newline at end of file +var _0xc3d5=['uniqueid','find','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','apply','update','then','destroy','sendStatus','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','body','describe'];(function(_0x3b9455,_0x19a3a3){var _0x56840a=function(_0x36d4a2){while(--_0x36d4a2){_0x3b9455['push'](_0x3b9455['shift']());}};_0x56840a(++_0x19a3a3);}(_0xc3d5,0x1b2));var _0x5c3d=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0xc3d5[_0x146be0];return _0x1bcc25;};'use strict';var emlformat=require(_0x5c3d('0x0'));var rimraf=require(_0x5c3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5c3d('0x2'));var moment=require('moment');var BPromise=require(_0x5c3d('0x3'));var Mustache=require(_0x5c3d('0x4'));var util=require(_0x5c3d('0x5'));var path=require(_0x5c3d('0x6'));var sox=require(_0x5c3d('0x7'));var csv=require('to-csv');var ejs=require(_0x5c3d('0x8'));var fs=require('fs');var fs_extra=require(_0x5c3d('0x9'));var _=require(_0x5c3d('0xa'));var squel=require(_0x5c3d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5c3d('0xc'));var deskjs=require(_0x5c3d('0xd'));var toCsv=require(_0x5c3d('0xe'));var querystring=require(_0x5c3d('0xf'));var Papa=require('papaparse');var Redis=require(_0x5c3d('0x10'));var authService=require(_0x5c3d('0x11'));var qs=require(_0x5c3d('0x12'));var as=require(_0x5c3d('0x13'));var hardwareService=require(_0x5c3d('0x14'));var logger=require('../../config/logger')(_0x5c3d('0x15'));var utils=require(_0x5c3d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5c3d('0x17'));var db=require(_0x5c3d('0x18'))['db'];function respondWithStatusCode(_0x2a8b3b,_0x35c885){_0x35c885=_0x35c885||0xcc;return function(_0x99e260){if(_0x99e260){return _0x2a8b3b['sendStatus'](_0x35c885);}return _0x2a8b3b[_0x5c3d('0x19')](_0x35c885)[_0x5c3d('0x1a')]();};}function respondWithResult(_0x400df7,_0x4c4ca5){_0x4c4ca5=_0x4c4ca5||0xc8;return function(_0x55582c){if(_0x55582c){return _0x400df7[_0x5c3d('0x19')](_0x4c4ca5)['json'](_0x55582c);}};}function respondWithFilteredResult(_0x2e6572,_0x58358a){return function(_0x2e8bed){if(_0x2e8bed){var _0xa5f34f=typeof _0x58358a['offset']==='undefined'&&typeof _0x58358a[_0x5c3d('0x1b')]===_0x5c3d('0x1c');var _0x2abe7a=_0x2e8bed[_0x5c3d('0x1d')];var _0xf052dd=_0xa5f34f?0x0:_0x58358a[_0x5c3d('0x1e')];var _0x4ca652=_0xa5f34f?_0x2e8bed[_0x5c3d('0x1d')]:_0x58358a[_0x5c3d('0x1e')]+_0x58358a[_0x5c3d('0x1b')];var _0x41d9bc;if(_0x4ca652>=_0x2abe7a){_0x4ca652=_0x2abe7a;_0x41d9bc=0xc8;}else{_0x41d9bc=0xce;}_0x2e6572[_0x5c3d('0x19')](_0x41d9bc);return _0x2e6572[_0x5c3d('0x1f')]('Content-Range',_0xf052dd+'-'+_0x4ca652+'/'+_0x2abe7a)['json'](_0x2e8bed);}return null;};}function patchUpdates(_0x183877){return function(_0x386835){try{jsonpatch[_0x5c3d('0x20')](_0x386835,_0x183877,!![]);}catch(_0x40ebdf){return BPromise['reject'](_0x40ebdf);}return _0x386835['save']();};}function saveUpdates(_0x2d3b5d,_0x1c0c8a){return function(_0x154991){if(_0x154991){return _0x154991[_0x5c3d('0x21')](_0x2d3b5d)[_0x5c3d('0x22')](function(_0xa9471c){return _0xa9471c;});}return null;};}function removeEntity(_0x15f04b,_0x305b84){return function(_0x3b59a4){if(_0x3b59a4){return _0x3b59a4[_0x5c3d('0x23')]()[_0x5c3d('0x22')](function(){_0x15f04b['status'](0xcc)[_0x5c3d('0x1a')]();});}};}function handleEntityNotFound(_0x106e5d,_0x3d9f97){return function(_0x19db23){if(!_0x19db23){_0x106e5d[_0x5c3d('0x24')](0x194);}return _0x19db23;};}function handleError(_0x34bedd,_0x2a2ab7){_0x2a2ab7=_0x2a2ab7||0x1f4;return function(_0x3cc454){logger['error'](_0x3cc454['stack']);if(_0x3cc454[_0x5c3d('0x25')]){delete _0x3cc454[_0x5c3d('0x25')];}_0x34bedd['status'](_0x2a2ab7)[_0x5c3d('0x26')](_0x3cc454);};}exports[_0x5c3d('0x27')]=function(_0x5d1dbc,_0x23c1c0){var _0x23eb0f={},_0x52ac9e={},_0x22881f={'count':0x0,'rows':[]};var _0x3e5d96=_[_0x5c3d('0x28')](db[_0x5c3d('0x29')][_0x5c3d('0x2a')],function(_0x35f556){return{'name':_0x35f556[_0x5c3d('0x2b')],'type':_0x35f556['type'][_0x5c3d('0x2c')]};});_0x52ac9e[_0x5c3d('0x2d')]=_[_0x5c3d('0x28')](_0x3e5d96,'name');_0x52ac9e['query']=_['keys'](_0x5d1dbc[_0x5c3d('0x2e')]);_0x52ac9e[_0x5c3d('0x2f')]=_[_0x5c3d('0x30')](_0x52ac9e[_0x5c3d('0x2d')],_0x52ac9e[_0x5c3d('0x2e')]);_0x23eb0f[_0x5c3d('0x31')]=_[_0x5c3d('0x30')](_0x52ac9e['model'],qs[_0x5c3d('0x32')](_0x5d1dbc[_0x5c3d('0x2e')]['fields']));_0x23eb0f[_0x5c3d('0x31')]=_0x23eb0f[_0x5c3d('0x31')][_0x5c3d('0x33')]?_0x23eb0f['attributes']:_0x52ac9e[_0x5c3d('0x2d')];if(!_0x5d1dbc[_0x5c3d('0x2e')][_0x5c3d('0x34')]('nolimit')){_0x23eb0f[_0x5c3d('0x1b')]=qs[_0x5c3d('0x1b')](_0x5d1dbc[_0x5c3d('0x2e')]['limit']);_0x23eb0f[_0x5c3d('0x1e')]=qs[_0x5c3d('0x1e')](_0x5d1dbc[_0x5c3d('0x2e')][_0x5c3d('0x1e')]);}_0x23eb0f['order']=qs[_0x5c3d('0x35')](_0x5d1dbc[_0x5c3d('0x2e')][_0x5c3d('0x35')]);_0x23eb0f[_0x5c3d('0x36')]=qs[_0x5c3d('0x2f')](_[_0x5c3d('0x37')](_0x5d1dbc[_0x5c3d('0x2e')],_0x52ac9e[_0x5c3d('0x2f')]),_0x3e5d96);if(_0x5d1dbc['query'][_0x5c3d('0x38')]){_0x23eb0f['where']=_[_0x5c3d('0x39')](_0x23eb0f['where'],{'$or':_[_0x5c3d('0x28')](_0x3e5d96,function(_0x1c3152){if(_0x1c3152[_0x5c3d('0x3a')]!==_0x5c3d('0x3b')){var _0x400ce4={};_0x400ce4[_0x1c3152['name']]={'$like':'%'+_0x5d1dbc['query'][_0x5c3d('0x38')]+'%'};return _0x400ce4;}})});}_0x23eb0f=_[_0x5c3d('0x39')]({},_0x23eb0f,_0x5d1dbc[_0x5c3d('0x3c')]);var _0x4172ca={'where':_0x23eb0f[_0x5c3d('0x36')]};return db[_0x5c3d('0x29')][_0x5c3d('0x1d')](_0x4172ca)[_0x5c3d('0x22')](function(_0x4b3773){_0x22881f[_0x5c3d('0x1d')]=_0x4b3773;if(_0x5d1dbc[_0x5c3d('0x2e')]['includeAll']){_0x23eb0f[_0x5c3d('0x3d')]=[{'all':!![]}];}return db[_0x5c3d('0x29')][_0x5c3d('0x3e')](_0x23eb0f);})['then'](function(_0x1b4d88){_0x22881f['rows']=_0x1b4d88;return _0x22881f;})[_0x5c3d('0x22')](respondWithFilteredResult(_0x23c1c0,_0x23eb0f))[_0x5c3d('0x3f')](handleError(_0x23c1c0,null));};exports[_0x5c3d('0x40')]=function(_0x8fa311,_0x257024){var _0x4a8d86={'raw':!![],'where':{'id':_0x8fa311[_0x5c3d('0x41')]['id']}},_0x4ee485={};_0x4ee485['model']=_[_0x5c3d('0x42')](db[_0x5c3d('0x29')]['rawAttributes']);_0x4ee485[_0x5c3d('0x2e')]=_[_0x5c3d('0x42')](_0x8fa311['query']);_0x4ee485['filters']=_[_0x5c3d('0x30')](_0x4ee485[_0x5c3d('0x2d')],_0x4ee485[_0x5c3d('0x2e')]);_0x4a8d86['attributes']=_[_0x5c3d('0x30')](_0x4ee485[_0x5c3d('0x2d')],qs['fields'](_0x8fa311['query']['fields']));_0x4a8d86[_0x5c3d('0x31')]=_0x4a8d86[_0x5c3d('0x31')][_0x5c3d('0x33')]?_0x4a8d86[_0x5c3d('0x31')]:_0x4ee485['model'];if(_0x8fa311[_0x5c3d('0x2e')][_0x5c3d('0x43')]){_0x4a8d86[_0x5c3d('0x3d')]=[{'all':!![]}];}_0x4a8d86=_[_0x5c3d('0x39')]({},_0x4a8d86,_0x8fa311['options']);return db[_0x5c3d('0x29')]['find'](_0x4a8d86)['then'](handleEntityNotFound(_0x257024,null))[_0x5c3d('0x22')](respondWithResult(_0x257024,null))[_0x5c3d('0x3f')](handleError(_0x257024,null));};exports['create']=function(_0x2acb6e,_0x1427fe){return db[_0x5c3d('0x29')]['create'](_0x2acb6e[_0x5c3d('0x44')],{})['then'](respondWithResult(_0x1427fe,0xc9))[_0x5c3d('0x3f')](handleError(_0x1427fe,null));};exports[_0x5c3d('0x45')]=function(_0x42de47,_0x5302a7){return db['CmHopperHistory'][_0x5c3d('0x45')]()[_0x5c3d('0x22')](respondWithResult(_0x5302a7,null))[_0x5c3d('0x3f')](handleError(_0x5302a7,null));};exports['update']=function(_0xcb701,_0x25ef9e){if(_0xcb701[_0x5c3d('0x44')][_0x5c3d('0x46')]){delete _0xcb701[_0x5c3d('0x44')][_0x5c3d('0x46')];}return db[_0x5c3d('0x29')][_0x5c3d('0x47')]({'where':{'uniqueid':_0xcb701[_0x5c3d('0x41')]['id']}})['then'](handleEntityNotFound(_0x25ef9e,null))['then'](saveUpdates(_0xcb701[_0x5c3d('0x44')],null))[_0x5c3d('0x22')](respondWithResult(_0x25ef9e,null))[_0x5c3d('0x3f')](handleError(_0x25ef9e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d2a6053..aeec637 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 _0xb458=['define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x23e2ed,_0x40980b){var _0x46645a=function(_0x1c2146){while(--_0x1c2146){_0x23e2ed['push'](_0x23e2ed['shift']());}};_0x46645a(++_0x40980b);}(_0xb458,0x94));var _0x8b45=function(_0x40936a,_0x54a96f){_0x40936a=_0x40936a-0x0;var _0x4b432b=_0xb458[_0x40936a];return _0x4b432b;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b45('0x4'));var rimraf=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var attributes=require(_0x8b45('0x7'));module['exports']=function(_0xfe8757,_0xd23b88){return _0xfe8757[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x8b45('0xb'),'fields':[_0x8b45('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d07=['CmHopperHistory','endtime','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x2d72ec,_0x45939a){var _0x4ba358=function(_0x3af91d){while(--_0x3af91d){_0x2d72ec['push'](_0x2d72ec['shift']());}};_0x4ba358(++_0x45939a);}(_0x2d07,0x13a));var _0x72d0=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x2d07[_0x5ee3d3];return _0x4b272f;};'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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index a69fa07..18e3266 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 _0x48b2=['`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateCmHopperHistory','CmHopperHistory','body','options','info','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x345640,_0x36a3f1){var _0x349423=function(_0x180e72){while(--_0x180e72){_0x345640['push'](_0x345640['shift']());}};_0x349423(++_0x36a3f1);}(_0x48b2,0x176));var _0x248b=function(_0x514d12,_0x573315){_0x514d12=_0x514d12-0x0;var _0x35db14=_0x48b2[_0x514d12];return _0x35db14;};'use strict';var _=require(_0x248b('0x0'));var util=require(_0x248b('0x1'));var moment=require(_0x248b('0x2'));var BPromise=require(_0x248b('0x3'));var rs=require(_0x248b('0x4'));var fs=require('fs');var Redis=require(_0x248b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x248b('0x6'));var logger=require('../../config/logger')(_0x248b('0x7'));var config=require(_0x248b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x248b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5189bb,_0x14fc46,_0x109fd7){return new BPromise(function(_0xa580ff,_0x376960){return client[_0x248b('0xa')](_0x5189bb,_0x109fd7)[_0x248b('0xb')](function(_0x5be12f){logger['info'](_0x248b('0xc'),_0x14fc46,'request\x20sent');logger[_0x248b('0xd')](_0x248b('0xe'),_0x14fc46,'request\x20sent',JSON[_0x248b('0xf')](_0x5be12f));if(_0x5be12f[_0x248b('0x10')]){if(_0x5be12f['error'][_0x248b('0x11')]===0x1f4){logger[_0x248b('0x10')](_0x248b('0xc'),_0x14fc46,_0x5be12f['error']['message']);return _0x376960(_0x5be12f[_0x248b('0x10')][_0x248b('0x12')]);}logger[_0x248b('0x10')](_0x248b('0xc'),_0x14fc46,_0x5be12f[_0x248b('0x10')][_0x248b('0x12')]);return _0xa580ff(_0x5be12f[_0x248b('0x10')]['message']);}else{logger['info'](_0x248b('0xc'),_0x14fc46,_0x248b('0x13'));_0xa580ff(_0x5be12f['result'][_0x248b('0x12')]);}})[_0x248b('0x14')](function(_0x304dba){logger[_0x248b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x14fc46,_0x304dba);_0x376960(_0x304dba);});});}exports[_0x248b('0x15')]=function(_0x146300){var _0xaa8232=this;return new Promise(function(_0x3bb21f,_0x4de01a){return db[_0x248b('0x16')]['create'](_0x146300[_0x248b('0x17')],{'raw':_0x146300[_0x248b('0x18')]?_0x146300[_0x248b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x248b('0xb')](function(_0x40a6b7){logger[_0x248b('0x19')](_0x248b('0x15'),_0x146300);logger[_0x248b('0xd')](_0x248b('0x15'),_0x146300,JSON['stringify'](_0x40a6b7));_0x3bb21f(_0x40a6b7);})[_0x248b('0x14')](function(_0x1cb2a7){logger[_0x248b('0x10')]('CreateCmHopperHistory',_0x1cb2a7[_0x248b('0x12')],_0x146300);_0x4de01a(_0xaa8232[_0x248b('0x10')](0x1f4,_0x1cb2a7['message']));});});};exports['AvgHandleTime']=function(_0x20123f){var _0x25ad0d=this;return new Promise(function(_0x2657e3,_0x4980b4){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0x20123f[_0x248b('0x18')]?_0x20123f['options']['raw']===undefined?!![]:![]:!![],'where':_0x20123f['options']?_0x20123f['options'][_0x248b('0x1b')]||null:null,'attributes':[[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize'][_0x248b('0x1e')]('id')),_0x248b('0x1f')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x22')))),_0x248b('0x23')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0x248b('0x24')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x25'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x26')))),_0x248b('0x27')],[db[_0x248b('0x1c')]['fn']('AVG',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x28')))),_0x248b('0x29')]]})[_0x248b('0xb')](function(_0x127c7c){logger[_0x248b('0x19')]('AvgHandleTime',_0x20123f);logger[_0x248b('0xd')](_0x248b('0x2a'),_0x20123f,JSON[_0x248b('0xf')](_0x127c7c));_0x2657e3(_0x127c7c);})['catch'](function(_0x24e99e){logger['error'](_0x248b('0x2a'),_0x24e99e[_0x248b('0x12')],_0x20123f);_0x4980b4(_0x25ad0d[_0x248b('0x10')](0x1f4,_0x24e99e[_0x248b('0x12')]));});});};exports[_0x248b('0x2b')]=function(_0xe2e7e1){var _0x274036=this;return new Promise(function(_0x28b074,_0x536e3a){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0xe2e7e1[_0x248b('0x18')]?_0xe2e7e1['options']['raw']===undefined?!![]:![]:!![],'where':_0xe2e7e1['options']?_0xe2e7e1['options']['where']||null:null,'attributes':[[_0x248b('0x2c'),'name'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x2d')))),_0x248b('0x2e')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x2f')))),_0x248b('0x30')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x21')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x248b('0x31')],[db['sequelize']['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0x248b('0x32')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x34')))),_0x248b('0x35')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x36')))),_0x248b('0x37')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x38')))),_0x248b('0x39')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x3a')))),_0x248b('0x3b')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0x248b('0x3c')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db['sequelize'][_0x248b('0x20')](_0x248b('0x3d')))),_0x248b('0x3e')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')]['literal'](_0x248b('0x3f')))),_0x248b('0x3c')],[db[_0x248b('0x1c')]['fn']('COUNT',db[_0x248b('0x1c')]['fn']('IF',db[_0x248b('0x1c')][_0x248b('0x20')](_0x248b('0x40')))),_0x248b('0x41')]],'group':[_0x248b('0x2c')]})[_0x248b('0xb')](function(_0x39c0b5){logger[_0x248b('0x19')](_0x248b('0x2b'),_0xe2e7e1);logger['debug'](_0x248b('0x2b'),_0xe2e7e1,JSON[_0x248b('0xf')](_0x39c0b5));_0x28b074(_0x39c0b5);})[_0x248b('0x14')](function(_0x4adba8){logger['error'](_0x248b('0x2b'),_0x4adba8[_0x248b('0x12')],_0xe2e7e1);_0x536e3a(_0x274036[_0x248b('0x10')](0x1f4,_0x4adba8[_0x248b('0x12')]));});});};exports[_0x248b('0x42')]=function(_0x297128){var _0x5cab1b=this;return new Promise(function(_0x2c00a2,_0x57a5b){return db[_0x248b('0x16')][_0x248b('0x1a')]({'raw':_0x297128['options']?_0x297128[_0x248b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x297128['options']?_0x297128[_0x248b('0x18')][_0x248b('0x1b')]||null:null,'attributes':[['campaign',_0x248b('0x43')],[db[_0x248b('0x1c')]['fn'](_0x248b('0x1d'),db['sequelize'][_0x248b('0x1e')]('id')),_0x248b('0x44')],[db[_0x248b('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x248b('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x248b('0x2c')]})[_0x248b('0xb')](function(_0x8a3d5a){logger[_0x248b('0x19')](_0x248b('0x42'),_0x297128);logger[_0x248b('0xd')](_0x248b('0x42'),_0x297128,JSON[_0x248b('0xf')](_0x8a3d5a));_0x2c00a2(_0x8a3d5a);})[_0x248b('0x14')](function(_0x5a19ad){logger[_0x248b('0x10')](_0x248b('0x42'),_0x5a19ad[_0x248b('0x12')],_0x297128);_0x57a5b(_0x5cab1b[_0x248b('0x10')](0x1f4,_0x5a19ad['message']));});});}; \ No newline at end of file +var _0xf257=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','debug','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','literal','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf257,0x82));var _0x7f25=function(_0xbe6968,_0x2d5094){_0xbe6968=_0xbe6968-0x0;var _0x53d936=_0xf257[_0xbe6968];return _0x53d936;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f25('0x0'));var BPromise=require(_0x7f25('0x1'));var rs=require(_0x7f25('0x2'));var fs=require('fs');var Redis=require(_0x7f25('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f25('0x4'));var logger=require(_0x7f25('0x5'))(_0x7f25('0x6'));var config=require(_0x7f25('0x7'));var jayson=require(_0x7f25('0x8'));var client=jayson[_0x7f25('0x9')][_0x7f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242a3e,_0x369a09,_0x16e278){return new BPromise(function(_0x31a5d8,_0x1ae607){return client[_0x7f25('0xb')](_0x242a3e,_0x16e278)[_0x7f25('0xc')](function(_0x57ba17){logger[_0x7f25('0xd')](_0x7f25('0xe'),_0x369a09,'request\x20sent');logger['debug'](_0x7f25('0xf'),_0x369a09,'request\x20sent',JSON[_0x7f25('0x10')](_0x57ba17));if(_0x57ba17[_0x7f25('0x11')]){if(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x12')]===0x1f4){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')]['message']);return _0x1ae607(_0x57ba17['error'][_0x7f25('0x13')]);}logger['error'](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);return _0x31a5d8(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x369a09,'request\x20sent');_0x31a5d8(_0x57ba17[_0x7f25('0x14')][_0x7f25('0x13')]);}})[_0x7f25('0x15')](function(_0x167363){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x167363);_0x1ae607(_0x167363);});});}exports[_0x7f25('0x16')]=function(_0x26d4aa){var _0x5e0067=this;return new Promise(function(_0x23f30c,_0x1cd6c1){return db[_0x7f25('0x17')][_0x7f25('0x18')](_0x26d4aa[_0x7f25('0x19')],{'raw':_0x26d4aa[_0x7f25('0x1a')]?_0x26d4aa['options']['raw']===undefined?!![]:![]:!![]})[_0x7f25('0xc')](function(_0x57275e){logger[_0x7f25('0xd')](_0x7f25('0x16'),_0x26d4aa);logger[_0x7f25('0x1b')](_0x7f25('0x16'),_0x26d4aa,JSON[_0x7f25('0x10')](_0x57275e));_0x23f30c(_0x57275e);})[_0x7f25('0x15')](function(_0x31bf5f){logger['error'](_0x7f25('0x16'),_0x31bf5f[_0x7f25('0x13')],_0x26d4aa);_0x1cd6c1(_0x5e0067[_0x7f25('0x11')](0x1f4,_0x31bf5f[_0x7f25('0x13')]));});});};exports[_0x7f25('0x1c')]=function(_0x4955e0){var _0x27ba8d=this;return new Promise(function(_0x89d687,_0x1bf53e){return db['CmHopperHistory'][_0x7f25('0x1d')]({'raw':_0x4955e0['options']?_0x4955e0[_0x7f25('0x1a')][_0x7f25('0x1e')]===undefined?!![]:![]:!![],'where':_0x4955e0[_0x7f25('0x1a')]?_0x4955e0[_0x7f25('0x1a')][_0x7f25('0x1f')]||null:null,'attributes':[[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')][_0x7f25('0x22')]('id')),_0x7f25('0x23')],[db['sequelize']['fn']('COUNT',db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')]['literal'](_0x7f25('0x24')))),_0x7f25('0x25')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')]['literal'](_0x7f25('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x7f25('0x20')]['fn']('COUNT',db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')]('`state`\x20=\x2011,\x201,\x20null'))),_0x7f25('0x28')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x29'),db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x2a')))),_0x7f25('0x2b')],[db['sequelize']['fn'](_0x7f25('0x29'),db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x2c')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x56ac18){logger[_0x7f25('0xd')](_0x7f25('0x1c'),_0x4955e0);logger[_0x7f25('0x1b')]('AvgHandleTime',_0x4955e0,JSON[_0x7f25('0x10')](_0x56ac18));_0x89d687(_0x56ac18);})[_0x7f25('0x15')](function(_0x4ed4e3){logger[_0x7f25('0x11')]('AvgHandleTime',_0x4ed4e3[_0x7f25('0x13')],_0x4955e0);_0x1bf53e(_0x27ba8d[_0x7f25('0x11')](0x1f4,_0x4ed4e3['message']));});});};exports[_0x7f25('0x2d')]=function(_0x162152){var _0x2edab1=this;return new Promise(function(_0x18dd4b,_0x457cbb){return db[_0x7f25('0x17')]['findAll']({'raw':_0x162152[_0x7f25('0x1a')]?_0x162152[_0x7f25('0x1a')][_0x7f25('0x1e')]===undefined?!![]:![]:!![],'where':_0x162152['options']?_0x162152[_0x7f25('0x1a')][_0x7f25('0x1f')]||null:null,'attributes':[[_0x7f25('0x2e'),_0x7f25('0x2f')],[db[_0x7f25('0x20')]['fn']('COUNT',db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x30')))),_0x7f25('0x31')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')]['fn']('IF',db['sequelize'][_0x7f25('0x27')]('`state`\x20=\x203,\x201,\x20null'))),_0x7f25('0x32')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')]['literal'](_0x7f25('0x24')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x7f25('0x20')]['fn']('IF',db['sequelize'][_0x7f25('0x27')](_0x7f25('0x33')))),_0x7f25('0x34')],[db['sequelize']['fn']('COUNT',db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x35')))),'outboundCongestionCallsDay'],[db[_0x7f25('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7f25('0x27')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7f25('0x36')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7f25('0x37')],[db['sequelize']['fn']('COUNT',db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x38')))),_0x7f25('0x39')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x7f25('0x27')](_0x7f25('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')]['fn']('IF',db['sequelize'][_0x7f25('0x27')]('`state`\x20=\x2014,\x201,\x20null'))),_0x7f25('0x3b')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db['sequelize']['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x3c')))),_0x7f25('0x3d')],[db['sequelize']['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')]['literal'](_0x7f25('0x3e')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7f25('0x27')](_0x7f25('0x3f')))),_0x7f25('0x3d')],[db[_0x7f25('0x20')]['fn']('COUNT',db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x40')))),'outboundReCallsDay']],'group':[_0x7f25('0x2e')]})[_0x7f25('0xc')](function(_0x1ef4c0){logger['info']('GetVoiceQueueHopperHistory',_0x162152);logger[_0x7f25('0x1b')](_0x7f25('0x2d'),_0x162152,JSON[_0x7f25('0x10')](_0x1ef4c0));_0x18dd4b(_0x1ef4c0);})[_0x7f25('0x15')](function(_0x57ba8e){logger[_0x7f25('0x11')]('GetVoiceQueueHopperHistory',_0x57ba8e[_0x7f25('0x13')],_0x162152);_0x457cbb(_0x2edab1[_0x7f25('0x11')](0x1f4,_0x57ba8e['message']));});});};exports[_0x7f25('0x41')]=function(_0x5f2373){var _0x405eaa=this;return new Promise(function(_0x49ffb1,_0x4e3322){return db['CmHopperHistory'][_0x7f25('0x1d')]({'raw':_0x5f2373[_0x7f25('0x1a')]?_0x5f2373['options'][_0x7f25('0x1e')]===undefined?!![]:![]:!![],'where':_0x5f2373[_0x7f25('0x1a')]?_0x5f2373[_0x7f25('0x1a')]['where']||null:null,'attributes':[['campaign','name'],[db['sequelize']['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')][_0x7f25('0x22')]('id')),_0x7f25('0x42')],[db[_0x7f25('0x20')]['fn'](_0x7f25('0x21'),db[_0x7f25('0x20')]['fn']('IF',db[_0x7f25('0x20')][_0x7f25('0x27')](_0x7f25('0x24')))),_0x7f25('0x43')]],'group':[_0x7f25('0x2e')]})[_0x7f25('0xc')](function(_0xbbe14b){logger['info'](_0x7f25('0x41'),_0x5f2373);logger[_0x7f25('0x1b')](_0x7f25('0x41'),_0x5f2373,JSON['stringify'](_0xbbe14b));_0x49ffb1(_0xbbe14b);})[_0x7f25('0x15')](function(_0x24d2e5){logger[_0x7f25('0x11')]('GetCampaignHopperHistory',_0x24d2e5['message'],_0x5f2373);_0x4e3322(_0x405eaa[_0x7f25('0x11')](0x1f4,_0x24d2e5['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2f6fc03..bdc5a76 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 _0x181f=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','post','create','put'];(function(_0x8b7225,_0x256c14){var _0x24e36b=function(_0x5d3b8d){while(--_0x5d3b8d){_0x8b7225['push'](_0x8b7225['shift']());}};_0x24e36b(++_0x256c14);}(_0x181f,0xf1));var _0xf181=function(_0x41b7b8,_0x11082e){_0x41b7b8=_0x41b7b8-0x0;var _0x57a0f2=_0x181f[_0x41b7b8];return _0x57a0f2;};'use strict';var multer=require('multer');var util=require(_0xf181('0x0'));var path=require(_0xf181('0x1'));var timeout=require(_0xf181('0x2'));var express=require(_0xf181('0x3'));var router=express[_0xf181('0x4')]();var fs_extra=require(_0xf181('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf181('0x6'));var config=require('../../config/environment');var controller=require(_0xf181('0x7'));router[_0xf181('0x8')]('/',auth[_0xf181('0x9')](),controller['index']);router[_0xf181('0x8')](_0xf181('0xa'),auth[_0xf181('0x9')](),controller[_0xf181('0xb')]);router[_0xf181('0x8')]('/:id',auth[_0xf181('0x9')](),controller['show']);router[_0xf181('0xc')]('/',auth[_0xf181('0x9')](),controller[_0xf181('0xd')]);router[_0xf181('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xf181('0xf')]=router; \ No newline at end of file +var _0xea95=['put','update','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','/:id','show','post'];(function(_0x2c02ee,_0x31c866){var _0x7dace1=function(_0x157462){while(--_0x157462){_0x2c02ee['push'](_0x2c02ee['shift']());}};_0x7dace1(++_0x31c866);}(_0xea95,0xdb));var _0x5ea9=function(_0x5bf643,_0x45911d){_0x5bf643=_0x5bf643-0x0;var _0xd0633a=_0xea95[_0x5bf643];return _0xd0633a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ea9('0x0'));var timeout=require('connect-timeout');var express=require(_0x5ea9('0x1'));var router=express[_0x5ea9('0x2')]();var fs_extra=require(_0x5ea9('0x3'));var auth=require(_0x5ea9('0x4'));var interaction=require(_0x5ea9('0x5'));var config=require(_0x5ea9('0x6'));var controller=require(_0x5ea9('0x7'));router['get']('/',auth[_0x5ea9('0x8')](),controller[_0x5ea9('0x9')]);router[_0x5ea9('0xa')](_0x5ea9('0xb'),auth[_0x5ea9('0x8')](),controller['describe']);router[_0x5ea9('0xa')](_0x5ea9('0xc'),auth[_0x5ea9('0x8')](),controller[_0x5ea9('0xd')]);router[_0x5ea9('0xe')]('/',auth[_0x5ea9('0x8')](),controller['create']);router[_0x5ea9('0xf')](_0x5ea9('0xc'),auth[_0x5ea9('0x8')](),controller[_0x5ea9('0x10')]);module[_0x5ea9('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 44f822e..3ba85ca 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 _0xb4e6=['sequelize','exports','STRING','name'];(function(_0xee615b,_0x51fd57){var _0x5d635c=function(_0x39ea3c){while(--_0x39ea3c){_0xee615b['push'](_0xee615b['shift']());}};_0x5d635c(++_0x51fd57);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xb4e6[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]={'name':{'type':Sequelize[_0x6b4e('0x2')],'unique':_0x6b4e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6b4e('0x2')]},'dialPrefix':{'type':Sequelize[_0x6b4e('0x2')]}}; \ No newline at end of file +var _0xf2ca=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xf2ca[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaf2c('0x2')]},'dialPrefix':{'type':Sequelize[_0xaf2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ec1c640..f8035a9 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 _0x51cb=['getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./cmList.socket','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','include','findAll','show','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','hasOwnProperty','pick','includeAll','removeDispositions','ids','addContacts','tags','join','isArray','each','omit','success','push','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CmContact','concat','CustomFields','format','raw','getContactsCsv','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields'];(function(_0x1e58c9,_0x43075e){var _0x22dc89=function(_0x48179d){while(--_0x48179d){_0x1e58c9['push'](_0x1e58c9['shift']());}};_0x22dc89(++_0x43075e);}(_0x51cb,0x159));var _0xb51c=function(_0x5073dd,_0x54a03a){_0x5073dd=_0x5073dd-0x0;var _0x53b35f=_0x51cb[_0x5073dd];return _0x53b35f;};'use strict';var emlformat=require(_0xb51c('0x0'));var rimraf=require(_0xb51c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb51c('0x2'));var moment=require('moment');var BPromise=require(_0xb51c('0x3'));var Mustache=require(_0xb51c('0x4'));var util=require('util');var path=require(_0xb51c('0x5'));var sox=require(_0xb51c('0x6'));var csv=require(_0xb51c('0x7'));var ejs=require(_0xb51c('0x8'));var fs=require('fs');var fs_extra=require(_0xb51c('0x9'));var _=require(_0xb51c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb51c('0xb'));var deskjs=require(_0xb51c('0xc'));var toCsv=require(_0xb51c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb51c('0xd'));var authService=require(_0xb51c('0xe'));var qs=require(_0xb51c('0xf'));var as=require(_0xb51c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb51c('0x11'))(_0xb51c('0x12'));var utils=require(_0xb51c('0x13'));var config=require(_0xb51c('0x14'));var licenseUtil=require(_0xb51c('0x15'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0xb51c('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb51c('0x17'))(new Redis(config[_0xb51c('0x18')]));require(_0xb51c('0x19'))['register'](socket);function respondWithStatusCode(_0x5db8f5,_0xc0a634){_0xc0a634=_0xc0a634||0xcc;return function(_0x43bcac){if(_0x43bcac){return _0x5db8f5['sendStatus'](_0xc0a634);}return _0x5db8f5['status'](_0xc0a634)['end']();};}function respondWithResult(_0x2a2c99,_0x8c9865){_0x8c9865=_0x8c9865||0xc8;return function(_0x1e72d9){if(_0x1e72d9){return _0x2a2c99[_0xb51c('0x1a')](_0x8c9865)[_0xb51c('0x1b')](_0x1e72d9);}};}function respondWithFilteredResult(_0x872d54,_0x351129){return function(_0x410f9b){if(_0x410f9b){var _0x3aad88=typeof _0x351129[_0xb51c('0x1c')]===_0xb51c('0x1d')&&typeof _0x351129[_0xb51c('0x1e')]===_0xb51c('0x1d');var _0x2d4402=_0x410f9b['count'];var _0x108ab5=_0x3aad88?0x0:_0x351129['offset'];var _0x2588bf=_0x3aad88?_0x410f9b[_0xb51c('0x1f')]:_0x351129[_0xb51c('0x1c')]+_0x351129[_0xb51c('0x1e')];var _0x2c809c;if(_0x2588bf>=_0x2d4402){_0x2588bf=_0x2d4402;_0x2c809c=0xc8;}else{_0x2c809c=0xce;}_0x872d54[_0xb51c('0x1a')](_0x2c809c);return _0x872d54[_0xb51c('0x20')]('Content-Range',_0x108ab5+'-'+_0x2588bf+'/'+_0x2d4402)['json'](_0x410f9b);}return null;};}function patchUpdates(_0x331cc0){return function(_0x596928){try{jsonpatch[_0xb51c('0x21')](_0x596928,_0x331cc0,!![]);}catch(_0x5dea5c){return BPromise[_0xb51c('0x22')](_0x5dea5c);}return _0x596928[_0xb51c('0x23')]();};}function saveUpdates(_0xf0c5ee,_0x211ff2){return function(_0x1ff723){if(_0x1ff723){return _0x1ff723[_0xb51c('0x24')](_0xf0c5ee)['then'](function(_0x2b221e){return _0x2b221e;});}return null;};}function removeEntity(_0x579751,_0x1027e2){return function(_0x1a2880){if(_0x1a2880){return _0x1a2880[_0xb51c('0x25')]()[_0xb51c('0x26')](function(){var _0x384103=_0x1a2880[_0xb51c('0x27')]({'plain':!![]});var _0x48d35e=_0xb51c('0x28');return db[_0xb51c('0x29')]['destroy']({'where':{'type':_0x48d35e,'resourceId':_0x384103['id']}})[_0xb51c('0x26')](function(){return _0x1a2880;});})['then'](function(){_0x579751[_0xb51c('0x1a')](0xcc)[_0xb51c('0x2a')]();});}};}function handleEntityNotFound(_0x4eb1ed,_0x578946){return function(_0x3e2677){if(!_0x3e2677){_0x4eb1ed[_0xb51c('0x2b')](0x194);}return _0x3e2677;};}function handleError(_0x5d60ab,_0x28bb09){_0x28bb09=_0x28bb09||0x1f4;return function(_0x2e692e){logger[_0xb51c('0x2c')](_0x2e692e[_0xb51c('0x2d')]);if(_0x2e692e[_0xb51c('0x2e')]){delete _0x2e692e[_0xb51c('0x2e')];}_0x5d60ab[_0xb51c('0x1a')](_0x28bb09)[_0xb51c('0x2f')](_0x2e692e);};}exports[_0xb51c('0x30')]=function(_0x4151ae,_0x51f5c9){var _0x324d14={},_0x366100={},_0x1b3175={'count':0x0,'rows':[]};var _0xee3728=_[_0xb51c('0x31')](db[_0xb51c('0x32')][_0xb51c('0x33')],function(_0x369b9f){return{'name':_0x369b9f[_0xb51c('0x34')],'type':_0x369b9f[_0xb51c('0x35')][_0xb51c('0x36')]};});_0x366100['model']=_[_0xb51c('0x31')](_0xee3728,_0xb51c('0x2e'));_0x366100[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x4151ae[_0xb51c('0x37')]);_0x366100[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0x366100[_0xb51c('0x3b')],_0x366100['query']);_0x324d14['attributes']=_[_0xb51c('0x3a')](_0x366100[_0xb51c('0x3b')],qs[_0xb51c('0x3c')](_0x4151ae[_0xb51c('0x37')][_0xb51c('0x3c')]));_0x324d14[_0xb51c('0x3d')]=_0x324d14[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x324d14[_0xb51c('0x3d')]:_0x366100[_0xb51c('0x3b')];if(!_0x4151ae[_0xb51c('0x37')]['hasOwnProperty'](_0xb51c('0x3f'))){_0x324d14[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x4151ae[_0xb51c('0x37')][_0xb51c('0x1e')]);_0x324d14['offset']=qs[_0xb51c('0x1c')](_0x4151ae['query'][_0xb51c('0x1c')]);}_0x324d14[_0xb51c('0x40')]=qs[_0xb51c('0x41')](_0x4151ae[_0xb51c('0x37')][_0xb51c('0x41')]);_0x324d14[_0xb51c('0x42')]=qs['filters'](_['pick'](_0x4151ae[_0xb51c('0x37')],_0x366100[_0xb51c('0x39')]),_0xee3728);if(_0x4151ae['query'][_0xb51c('0x43')]){_0x324d14[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x324d14['where'],{'$or':_[_0xb51c('0x31')](_0xee3728,function(_0x2839ba){if(_0x2839ba['type']!=='VIRTUAL'){var _0x4f8177={};_0x4f8177[_0x2839ba[_0xb51c('0x2e')]]={'$like':'%'+_0x4151ae[_0xb51c('0x37')][_0xb51c('0x43')]+'%'};return _0x4f8177;}})});}_0x324d14=_[_0xb51c('0x44')]({},_0x324d14,_0x4151ae[_0xb51c('0x45')]);var _0x1fb098={'where':_0x324d14[_0xb51c('0x42')]};return db[_0xb51c('0x32')][_0xb51c('0x1f')](_0x1fb098)[_0xb51c('0x26')](function(_0x1f9681){_0x1b3175['count']=_0x1f9681;if(_0x4151ae[_0xb51c('0x37')]['includeAll']){_0x324d14[_0xb51c('0x46')]=[{'all':!![]}];}return db[_0xb51c('0x32')][_0xb51c('0x47')](_0x324d14);})[_0xb51c('0x26')](function(_0x10b0e1){_0x1b3175['rows']=_0x10b0e1;return _0x1b3175;})['then'](respondWithFilteredResult(_0x51f5c9,_0x324d14))['catch'](handleError(_0x51f5c9,null));};exports[_0xb51c('0x48')]=function(_0x202cbc,_0xa85f0f){var _0x1fa5ba={'raw':![],'where':{'id':_0x202cbc[_0xb51c('0x49')]['id']}},_0x50346e={};_0x50346e[_0xb51c('0x3b')]=_[_0xb51c('0x38')](db['CmList'][_0xb51c('0x33')]);_0x50346e[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x202cbc[_0xb51c('0x37')]);_0x50346e['filters']=_['intersection'](_0x50346e['model'],_0x50346e['query']);_0x1fa5ba['attributes']=_[_0xb51c('0x3a')](_0x50346e[_0xb51c('0x3b')],qs['fields'](_0x202cbc[_0xb51c('0x37')][_0xb51c('0x3c')]));_0x1fa5ba[_0xb51c('0x3d')]=_0x1fa5ba[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x1fa5ba['attributes']:_0x50346e['model'];if(_0x202cbc['query']['includeAll']){_0x1fa5ba[_0xb51c('0x46')]=[{'all':!![]}];}_0x1fa5ba=_[_0xb51c('0x44')]({},_0x1fa5ba,_0x202cbc[_0xb51c('0x45')]);return db[_0xb51c('0x32')][_0xb51c('0x4a')](_0x1fa5ba)['then'](handleEntityNotFound(_0xa85f0f,null))[_0xb51c('0x26')](respondWithResult(_0xa85f0f,null))[_0xb51c('0x4b')](handleError(_0xa85f0f,null));};exports[_0xb51c('0x4c')]=function(_0x58c382,_0x51e57c){return db[_0xb51c('0x32')][_0xb51c('0x4c')](_0x58c382[_0xb51c('0x4d')],{})[_0xb51c('0x26')](function(_0x38f690){var _0x159cc1=_0x58c382[_0xb51c('0x4e')]['get']({'plain':!![]});if(!_0x159cc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159cc1[_0xb51c('0x4f')]===_0xb51c('0x4e')){var _0x5ca17b=_0x38f690['get']({'plain':!![]});var _0x5482ae=_0xb51c('0x28');return db[_0xb51c('0x50')][_0xb51c('0x4a')]({'where':{'name':_0x5482ae,'userProfileId':_0x159cc1[_0xb51c('0x51')]},'raw':!![]})[_0xb51c('0x26')](function(_0x2b1c85){if(_0x2b1c85&&_0x2b1c85[_0xb51c('0x52')]===0x0){return db['UserProfileResource'][_0xb51c('0x4c')]({'name':_0x5ca17b['name'],'resourceId':_0x5ca17b['id'],'type':_0x2b1c85[_0xb51c('0x2e')],'sectionId':_0x2b1c85['id']},{})['then'](function(){return _0x38f690;});}else{return _0x38f690;}})[_0xb51c('0x4b')](function(_0x3a1b23){logger[_0xb51c('0x2c')](_0xb51c('0x53'),_0x3a1b23);throw _0x3a1b23;});}return _0x38f690;})['then'](respondWithResult(_0x51e57c,0xc9))['catch'](handleError(_0x51e57c,null));};exports[_0xb51c('0x24')]=function(_0x17817a,_0x244109){if(_0x17817a[_0xb51c('0x4d')]['id']){delete _0x17817a['body']['id'];}return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x17817a[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x244109,null))['then'](saveUpdates(_0x17817a[_0xb51c('0x4d')],null))[_0xb51c('0x26')](respondWithResult(_0x244109,null))[_0xb51c('0x4b')](handleError(_0x244109,null));};exports[_0xb51c('0x25')]=function(_0x26aa8d,_0x37ae97){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x26aa8d['params']['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x37ae97,null))[_0xb51c('0x26')](removeEntity(_0x37ae97,null))[_0xb51c('0x4b')](handleError(_0x37ae97,null));};exports[_0xb51c('0x54')]=function(_0x55a579,_0x972c02){return db[_0xb51c('0x32')][_0xb51c('0x54')]()['then'](respondWithResult(_0x972c02,null))[_0xb51c('0x4b')](handleError(_0x972c02,null));};exports[_0xb51c('0x55')]=function(_0x169421,_0x4ea0eb,_0x2d4e2d){if(_0x169421[_0xb51c('0x4d')]['id']){delete _0x169421[_0xb51c('0x4d')]['id'];}return db['CmList'][_0xb51c('0x4a')]({'where':{'id':_0x169421[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x4ea0eb,null))[_0xb51c('0x26')](function(_0x4fceac){if(_0x4fceac){_0x169421['body'][_0xb51c('0x56')]=_0x4fceac['id'];return db[_0xb51c('0x57')][_0xb51c('0x4c')](_0x169421[_0xb51c('0x4d')]);}})[_0xb51c('0x26')](respondWithResult(_0x4ea0eb,null))[_0xb51c('0x4b')](handleError(_0x4ea0eb,null));};exports['getDispositions']=function(_0x4f7a48,_0xb21d43,_0x4844fd){var _0x117fc3={'raw':![],'where':{}};var _0xd1d103={};var _0x12d61c={'count':0x0,'rows':[]};return db[_0xb51c('0x32')]['findOne']({'where':{'id':_0x4f7a48[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0xb21d43,null))[_0xb51c('0x26')](function(_0x50559d){if(_0x50559d){_0xd1d103[_0xb51c('0x3b')]=_['keys'](db['Disposition'][_0xb51c('0x33')]);_0xd1d103[_0xb51c('0x37')]=_['keys'](_0x4f7a48[_0xb51c('0x37')]);_0xd1d103[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0xd1d103[_0xb51c('0x3b')],_0xd1d103[_0xb51c('0x37')]);_0x117fc3[_0xb51c('0x3d')]=_['intersection'](_0xd1d103['model'],qs[_0xb51c('0x3c')](_0x4f7a48['query'][_0xb51c('0x3c')]));_0x117fc3[_0xb51c('0x3d')]=_0x117fc3[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x117fc3['attributes']:_0xd1d103[_0xb51c('0x3b')];if(!_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x58')]('nolimit')){_0x117fc3[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x4f7a48[_0xb51c('0x37')]['limit']);_0x117fc3['offset']=qs['offset'](_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x1c')]);}_0x117fc3[_0xb51c('0x40')]=qs[_0xb51c('0x41')](_0x4f7a48[_0xb51c('0x37')]['sort']);_0x117fc3['where']=qs[_0xb51c('0x39')](_[_0xb51c('0x59')](_0x4f7a48[_0xb51c('0x37')],_0xd1d103[_0xb51c('0x39')]));_0x117fc3[_0xb51c('0x42')][_0xb51c('0x56')]=_0x50559d['id'];if(_0x4f7a48[_0xb51c('0x37')]['filter']){_0x117fc3[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x117fc3['where'],{'$or':_[_0xb51c('0x31')](_0x117fc3[_0xb51c('0x3d')],function(_0x54254f){var _0x5a3f0a={};_0x5a3f0a[_0x54254f]={'$like':'%'+_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x43')]+'%'};return _0x5a3f0a;})});}_0x117fc3=_[_0xb51c('0x44')]({},_0x117fc3,_0x4f7a48[_0xb51c('0x45')]);return db[_0xb51c('0x57')]['count']({'where':_0x117fc3[_0xb51c('0x42')]})[_0xb51c('0x26')](function(_0xf62983){_0x12d61c['count']=_0xf62983;if(_0x4f7a48[_0xb51c('0x37')][_0xb51c('0x5a')]){_0x117fc3[_0xb51c('0x46')]=[{'all':!![]}];}return db[_0xb51c('0x57')][_0xb51c('0x47')](_0x117fc3);})['then'](function(_0xd576e8){_0x12d61c['rows']=_0xd576e8;return _0x12d61c;});}})[_0xb51c('0x26')](respondWithFilteredResult(_0xb21d43,_0x117fc3))[_0xb51c('0x4b')](handleError(_0xb21d43,null));};exports[_0xb51c('0x5b')]=function(_0x48c821,_0x4447fe,_0x593c31){return db['CmList']['find']({'where':{'id':_0x48c821[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x4447fe,null))[_0xb51c('0x26')](function(_0x4b566b){if(_0x4b566b){return _0x4b566b['removeDispositions'](_0x48c821['query'][_0xb51c('0x5c')]);}})[_0xb51c('0x26')](respondWithStatusCode(_0x4447fe,null))[_0xb51c('0x4b')](handleError(_0x4447fe,null));};exports[_0xb51c('0x5d')]=function(_0x3d6aa6,_0x3e7dbb,_0x4ed97a){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x3d6aa6[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x3e7dbb,null))[_0xb51c('0x26')](function(_0x3047d0){if(_0x3047d0){var _0x26f9c6=[];var _0x231a53={'success':[],'errors':[]};return db['CmContact'][_0xb51c('0x54')]()[_0xb51c('0x26')](function(_0x4bff4f){if(_0x3d6aa6[_0xb51c('0x4d')][_0xb51c('0x5e')]&&_['isArray'](_0x3d6aa6['body'][_0xb51c('0x5e')])){if(_0x3d6aa6[_0xb51c('0x4d')][_0xb51c('0x5e')][_0xb51c('0x3e')]){_0x3d6aa6[_0xb51c('0x4d')]['tags']=_0x3d6aa6[_0xb51c('0x4d')][_0xb51c('0x5e')][_0xb51c('0x5f')](';')+';';}else{_0x3d6aa6[_0xb51c('0x4d')]['tags']=null;}}else{_0x3d6aa6['body'][_0xb51c('0x5e')]=null;}if(_0x3d6aa6[_0xb51c('0x4d')]&&_[_0xb51c('0x60')](_0x3d6aa6[_0xb51c('0x4d')])){for(var _0x23076b=0x0;_0x23076b<_0x3d6aa6[_0xb51c('0x4d')]['length'];_0x23076b+=0x1){_0x3d6aa6[_0xb51c('0x4d')][_0x23076b][_0xb51c('0x56')]=_0x3d6aa6[_0xb51c('0x49')]['id'];_0x26f9c6['push'](_0x3d6aa6[_0xb51c('0x4d')][_0x23076b]);}return BPromise[_0xb51c('0x61')](_0x26f9c6,function(_0x78baea){return db['CmContact'][_0xb51c('0x4c')](_[_0xb51c('0x62')](_0x78baea,[_0xb51c('0x5c'),'id'])||{},{'fields':_[_0xb51c('0x38')](_0x4bff4f),'raw':!![]})[_0xb51c('0x26')](function(_0x6b5c55){_0x231a53[_0xb51c('0x63')][_0xb51c('0x64')](_0x6b5c55[_0xb51c('0x65')]);})['catch'](function(_0x527bfc){_0x231a53['errors'][_0xb51c('0x64')]({'data':_0x78baea,'error':_0x527bfc['message']});});})[_0xb51c('0x26')](function(_0x337d86){return _0x231a53;})[_0xb51c('0x4b')](function(_0x381fcd){return _0x381fcd;});}else{_0x3e7dbb[_0xb51c('0x1a')](0x190)[_0xb51c('0x1b')]({'message':_0xb51c('0x66')});}});}})[_0xb51c('0x26')](respondWithResult(_0x3e7dbb,null))[_0xb51c('0x4b')](handleError(_0x3e7dbb,null));};exports[_0xb51c('0x67')]=function(_0x34304b,_0xcf61ad,_0x209d15){var _0xbfffda;return db['CmList'][_0xb51c('0x4a')]({'where':{'id':_0x34304b[_0xb51c('0x49')]['id']},'include':[{'model':db[_0xb51c('0x68')],'as':'CustomFields'}]})[_0xb51c('0x26')](handleEntityNotFound(_0xcf61ad,null))['then'](function(_0x3e6479){if(_0x3e6479){_0xbfffda=_0x3e6479;return db[_0xb51c('0x69')][_0xb51c('0x33')];}})['then'](function(_0x2f4418){if(_0x2f4418){var _0x35ceab={};var _0x1d155c={};_0x1d155c[_0xb51c('0x3b')]=_[_0xb51c('0x6a')](_[_0xb51c('0x38')](_0x2f4418),_[_0xb51c('0x31')](_0xbfffda[_0xb51c('0x6b')],function(_0x652e7a){return util[_0xb51c('0x6c')]('cf_%d',_0x652e7a['id']);}));_0x1d155c[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x34304b['query']);_0x1d155c[_0xb51c('0x39')]=_['intersection'](_0x1d155c['model'],_0x1d155c[_0xb51c('0x37')]);_0x35ceab[_0xb51c('0x3d')]=_['intersection'](_0x1d155c[_0xb51c('0x3b')],qs[_0xb51c('0x3c')](_0x34304b[_0xb51c('0x37')]['fields']));_0x35ceab[_0xb51c('0x3d')]=_0x35ceab[_0xb51c('0x3d')]['length']?_0x35ceab[_0xb51c('0x3d')]:_0x1d155c[_0xb51c('0x3b')];if(!_0x34304b[_0xb51c('0x37')][_0xb51c('0x58')](_0xb51c('0x3f'))){_0x35ceab[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x34304b[_0xb51c('0x37')][_0xb51c('0x1e')]);_0x35ceab['offset']=qs[_0xb51c('0x1c')](_0x34304b[_0xb51c('0x37')]['offset']);}_0x35ceab[_0xb51c('0x40')]=qs['sort'](_0x34304b[_0xb51c('0x37')][_0xb51c('0x41')]);_0x35ceab[_0xb51c('0x42')]=qs['filters'](_[_0xb51c('0x59')](_0x34304b['query'],_0x1d155c[_0xb51c('0x39')]));_0x35ceab[_0xb51c('0x6d')]=!![];if(_0x34304b[_0xb51c('0x37')][_0xb51c('0x43')]){_0x35ceab[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x35ceab['where'],{'$or':_[_0xb51c('0x31')](_0x35ceab[_0xb51c('0x3d')],function(_0x2f71eb){var _0x475fc6={};_0x475fc6[_0x2f71eb]={'$like':'%'+_0x34304b['query'][_0xb51c('0x43')]+'%'};return _0x475fc6;})});}_0x35ceab=_['merge']({},_0x35ceab,_0x34304b[_0xb51c('0x45')]);return _0xbfffda[_0xb51c('0x67')](_0x35ceab);}})[_0xb51c('0x26')](respondWithResult(_0xcf61ad,null))[_0xb51c('0x4b')](handleError(_0xcf61ad,null));};exports[_0xb51c('0x6e')]=function(_0x555f35,_0x277bda,_0x1461e6){var _0x46fb76;var _0x8106c1;var _0x5257cc;var _0x56da43=_0x555f35[_0xb51c('0x49')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0xb51c('0x6f')]})[_0xb51c('0x26')](function(_0x39a4a7){_0x46fb76=_0x39a4a7;var _0x476e8b=_[_0xb51c('0x38')](db[_0xb51c('0x69')][_0xb51c('0x33')]);return db[_0xb51c('0x68')][_0xb51c('0x47')]({'raw':!![],'attributes':['id',_0xb51c('0x70')]})[_0xb51c('0x26')](function(_0x50d3cb){_0x8106c1=_0x50d3cb;var _0x1fd4ed=squel[_0xb51c('0x71')]()[_0xb51c('0x3c')](_0x476e8b)['from'](_0xb51c('0x72'),'c')['where'](_0xb51c('0x73'),_0x56da43)['where'](_0xb51c('0x74'))[_0xb51c('0x75')]();for(var _0x5d2925=0x0;_0x5d2925<_0x8106c1[_0xb51c('0x3e')];_0x5d2925++){_0x1fd4ed[_0xb51c('0x76')](_0xb51c('0x77')+_0x8106c1[_0x5d2925]['id'],_0xb51c('0x78')+_0x8106c1[_0x5d2925][_0xb51c('0x70')]);}for(var _0x5d2925=0x0;_0x5d2925<_0x46fb76['length'];_0x5d2925++){_0x1fd4ed[_0xb51c('0x76')](squel[_0xb51c('0x71')]()['field'](_0xb51c('0x79'))[_0xb51c('0x7a')](_0xb51c('0x7b'))[_0xb51c('0x42')]('ItemTypeId\x20=\x20?',_0x46fb76[_0x5d2925]['id'])[_0xb51c('0x42')](_0xb51c('0x7c')),_0xb51c('0x7d')+_0x46fb76[_0x5d2925][_0xb51c('0x2e')]);_0x1fd4ed[_0xb51c('0x76')](squel[_0xb51c('0x71')]()[_0xb51c('0x76')](_0xb51c('0x7e'))[_0xb51c('0x7a')](_0xb51c('0x7b'))['where'](_0xb51c('0x7f'),_0x46fb76[_0x5d2925]['id'])[_0xb51c('0x42')](_0xb51c('0x7c')),_0xb51c('0x80')+_0x46fb76[_0x5d2925][_0xb51c('0x2e')]);}var _0x2f1156=[];_0x2f1156['push'](_0x1fd4ed[_0xb51c('0x81')]());BPromise[_0xb51c('0x61')](_0x2f1156,handleQuery)[_0xb51c('0x26')](function(_0x4d0dea){handleQuery(_0x1fd4ed[_0xb51c('0x81')]());var _0x4d044b=csv_results[0x0];if(!_[_0xb51c('0x82')](_0x4d044b)){var _0x2b284a=toCsv(_0x4d044b);var _0xb544e7=Date[_0xb51c('0x83')]();fs[_0xb51c('0x84')](util[_0xb51c('0x6c')](_0xb51c('0x85'),_0x56da43,_0xb544e7),_0x2b284a);_0x277bda[_0xb51c('0x86')](_0xb51c('0x87'),_0xb51c('0x88')+util[_0xb51c('0x6c')]('list_%d_%s.csv',_0x56da43,_0xb544e7));_0x277bda['setHeader'](_0xb51c('0x89'),_0xb51c('0x8a'));return _0x277bda[_0xb51c('0x8b')](util[_0xb51c('0x6c')](_0xb51c('0x85'),_0x56da43,_0xb544e7));}else{return _0x277bda['sendStatus'](0xcc);}});});});};exports[_0xb51c('0x8c')]=function(_0x9559ff,_0x57bf4f,_0x3bd9a8){var _0x79c720;delete _0x9559ff[_0xb51c('0x4d')]['id'];return db['CmList'][_0xb51c('0x8d')]({'where':{'id':_0x9559ff[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x57bf4f,null))[_0xb51c('0x26')](function(_0xee483c){if(_0xee483c){return db[_0xb51c('0x8e')]['transaction'](function(_0x5d678e){return db['CmCustomField']['create'](_0x9559ff[_0xb51c('0x4d')],{'transaction':_0x5d678e})[_0xb51c('0x26')](function(_0x43c5d6){_0x79c720=_0x43c5d6;return _0xee483c[_0xb51c('0x8f')](_0x43c5d6,{'transaction':_0x5d678e});})[_0xb51c('0x26')](function(){var _0x296b1b={'type':db[_0xb51c('0x90')][_0xb51c('0x91')],'transaction':_0x5d678e};switch(_0x9559ff[_0xb51c('0x4d')]['type']){case _0xb51c('0x92'):_0x296b1b[_0xb51c('0x35')]=db['Sequelize'][_0xb51c('0x91')];break;case _0xb51c('0x93'):_0x296b1b[_0xb51c('0x35')]=db[_0xb51c('0x90')][_0xb51c('0x94')];break;case _0xb51c('0x95'):_0x296b1b['type']=db['Sequelize'][_0xb51c('0x96')];_0x296b1b[_0xb51c('0x97')]=![];break;default:}return db['sequelize'][_0xb51c('0x98')][_0xb51c('0x99')](_0xb51c('0x72'),util['format'](_0xb51c('0x9a'),_0x79c720['id']),_0x296b1b);})['then'](function(){return _0x79c720;});});}})[_0xb51c('0x26')](respondWithResult(_0x57bf4f,null))[_0xb51c('0x4b')](handleError(_0x57bf4f,null));};exports[_0xb51c('0x9b')]=function(_0x258e1f,_0x35a174,_0x2985d0){var _0x16390f={};var _0x4a2c15={};var _0x4c8067;var _0x362793;return db[_0xb51c('0x32')][_0xb51c('0x8d')]({'where':{'id':_0x258e1f[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x35a174,null))['then'](function(_0x5bcc2a){if(_0x5bcc2a){_0x4c8067=_0x5bcc2a;_0x4a2c15[_0xb51c('0x3b')]=_[_0xb51c('0x38')](db[_0xb51c('0x68')]['rawAttributes']);_0x4a2c15[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x258e1f[_0xb51c('0x37')]);_0x4a2c15[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0x4a2c15[_0xb51c('0x3b')],_0x4a2c15[_0xb51c('0x37')]);_0x16390f[_0xb51c('0x3d')]=_['intersection'](_0x4a2c15[_0xb51c('0x3b')],qs['fields'](_0x258e1f['query'][_0xb51c('0x3c')]));_0x16390f[_0xb51c('0x3d')]=_0x16390f[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x16390f['attributes']:_0x4a2c15[_0xb51c('0x3b')];_0x16390f[_0xb51c('0x40')]=qs[_0xb51c('0x41')](_0x258e1f[_0xb51c('0x37')][_0xb51c('0x41')]);_0x16390f['where']=qs[_0xb51c('0x39')](_[_0xb51c('0x59')](_0x258e1f[_0xb51c('0x37')],_0x4a2c15['filters']));_0x16390f[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x16390f[_0xb51c('0x42')],{'$or':[{'ListId':_0x5bcc2a['id']},{'ListId':null}]});if(_0x258e1f['query'][_0xb51c('0x43')]){_0x16390f[_0xb51c('0x42')]=_[_0xb51c('0x44')](_0x16390f[_0xb51c('0x42')],{'$or':_[_0xb51c('0x31')](_0x16390f[_0xb51c('0x3d')],function(_0xfd7ec3){var _0x3485be={};_0x3485be[_0xfd7ec3]={'$like':'%'+_0x258e1f[_0xb51c('0x37')]['filter']+'%'};return _0x3485be;})});}_0x16390f=_[_0xb51c('0x44')]({},_0x16390f,_0x258e1f[_0xb51c('0x45')]);return db[_0xb51c('0x68')]['findAndCountAll'](_0x16390f);}})[_0xb51c('0x26')](respondWithResult(_0x35a174,null))[_0xb51c('0x4b')](handleError(_0x35a174,null));};exports[_0xb51c('0x9c')]=function(_0x358909,_0x5f07e7){return db['CmCustomField'][_0xb51c('0x9d')]({'where':{'ListId':null}})[_0xb51c('0x26')](handleEntityNotFound(_0x5f07e7,null))[_0xb51c('0x26')](function(_0x3b0e2f){return _0x3b0e2f;})['then'](respondWithResult(_0x5f07e7,null))[_0xb51c('0x4b')](handleError(_0x5f07e7,null));};exports['addAgents']=function(_0x5ef41c,_0x47adc0,_0x40a319){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0x5ef41c[_0xb51c('0x49')]['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x47adc0,null))[_0xb51c('0x26')](function(_0x32cbcf){if(_0x32cbcf){return _0x32cbcf[_0xb51c('0x9e')](_0x5ef41c[_0xb51c('0x4d')][_0xb51c('0x5c')],_[_0xb51c('0x62')](_0x5ef41c[_0xb51c('0x4d')],[_0xb51c('0x5c'),'id'])||{})[_0xb51c('0x9f')](function(_0x300498){for(var _0x477c3b=0x0;_0x477c3b<_0x5ef41c[_0xb51c('0x4d')][_0xb51c('0x5c')][_0xb51c('0x3e')];_0x477c3b+=0x1){socket[_0xb51c('0xa0')](_0xb51c('0xa1'),{'UserId':Number(_0x5ef41c['body'][_0xb51c('0x5c')][_0x477c3b]),'CmListId':Number(_0x5ef41c['params']['id'])});}return _0x300498;});}})['then'](respondWithResult(_0x47adc0,null))[_0xb51c('0x4b')](handleError(_0x47adc0,null));};exports[_0xb51c('0xa2')]=function(_0xe06f05,_0x4ec244,_0x4e2d5c){return db[_0xb51c('0x32')][_0xb51c('0x4a')]({'where':{'id':_0xe06f05['params']['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x4ec244,null))['then'](function(_0x311416){if(_0x311416){return _0x311416[_0xb51c('0xa2')](_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')])[_0xb51c('0x26')](function(){if(_['isArray'](_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')])){for(var _0x21aeb5=0x0;_0x21aeb5<_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')]['length'];_0x21aeb5+=0x1){socket[_0xb51c('0xa0')](_0xb51c('0xa3'),{'UserId':Number(_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')][_0x21aeb5]),'CmListId':Number(_0xe06f05[_0xb51c('0x49')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0xe06f05[_0xb51c('0x37')][_0xb51c('0x5c')]),'CmListId':Number(_0xe06f05[_0xb51c('0x49')]['id'])});}});}})[_0xb51c('0x26')](respondWithStatusCode(_0x4ec244,null))['catch'](handleError(_0x4ec244,null));};exports['getAgents']=function(_0x4cb21b,_0x53b5ed,_0x57e2d5){var _0x42a85d={};var _0x325d3c={};var _0x4c7dcb;var _0x15a767;return db['CmList']['findOne']({'where':{'id':_0x4cb21b['params']['id']}})[_0xb51c('0x26')](handleEntityNotFound(_0x53b5ed,null))['then'](function(_0x446c1b){if(_0x446c1b){_0x4c7dcb=_0x446c1b;_0x325d3c[_0xb51c('0x3b')]=_[_0xb51c('0x38')](db[_0xb51c('0xa4')]['rawAttributes']);_0x325d3c[_0xb51c('0x37')]=_[_0xb51c('0x38')](_0x4cb21b[_0xb51c('0x37')]);_0x325d3c[_0xb51c('0x39')]=_[_0xb51c('0x3a')](_0x325d3c['model'],_0x325d3c[_0xb51c('0x37')]);_0x42a85d['attributes']=_['intersection'](_0x325d3c[_0xb51c('0x3b')],qs['fields'](_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x3c')]));_0x42a85d[_0xb51c('0x3d')]=_0x42a85d[_0xb51c('0x3d')][_0xb51c('0x3e')]?_0x42a85d[_0xb51c('0x3d')]:_0x325d3c[_0xb51c('0x3b')];_0x42a85d['order']=qs['sort'](_0x4cb21b[_0xb51c('0x37')]['sort']);_0x42a85d[_0xb51c('0x42')]=qs[_0xb51c('0x39')](_[_0xb51c('0x59')](_0x4cb21b[_0xb51c('0x37')],_0x325d3c[_0xb51c('0x39')]));if(_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x43')]){_0x42a85d[_0xb51c('0x42')]=_['merge'](_0x42a85d['where'],{'$or':_['map'](_0x42a85d[_0xb51c('0x3d')],function(_0xb454d2){var _0x5dfd53={};_0x5dfd53[_0xb454d2]={'$like':'%'+_0x4cb21b['query'][_0xb51c('0x43')]+'%'};return _0x5dfd53;})});}_0x42a85d=_[_0xb51c('0x44')]({},_0x42a85d,_0x4cb21b['options']);return _0x4c7dcb[_0xb51c('0xa5')](_0x42a85d);}})[_0xb51c('0x26')](function(_0x22af08){if(_0x22af08){_0x15a767=_0x22af08[_0xb51c('0x3e')];if(!_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x58')](_0xb51c('0x3f'))){_0x42a85d[_0xb51c('0x1e')]=qs[_0xb51c('0x1e')](_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x1e')]);_0x42a85d[_0xb51c('0x1c')]=qs['offset'](_0x4cb21b[_0xb51c('0x37')][_0xb51c('0x1c')]);}return _0x4c7dcb[_0xb51c('0xa5')](_0x42a85d);}})[_0xb51c('0x26')](function(_0x3ee458){if(_0x3ee458){return _0x3ee458?{'count':_0x15a767,'rows':_0x3ee458}:null;}})['then'](respondWithResult(_0x53b5ed,null))[_0xb51c('0x4b')](handleError(_0x53b5ed,null));};function handleQuery(_0x5ec208){logger[_0xb51c('0xa6')](_0x5ec208);return db[_0xb51c('0x8e')][_0xb51c('0x37')](_0x5ec208)['spread'](function(_0x30fcfa){csv_results[_0xb51c('0x64')](_0x30fcfa);})[_0xb51c('0x4b')](function(_0x4e8af1){logger['error'](_0x4e8af1['message']);});} \ No newline at end of file +var _0x85b3=['then','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','customField_','select','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','isEmpty','writeFileSync','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','addCustomField','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','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','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./cmList.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','save','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85b3,0x7d));var _0x385b=function(_0x166597,_0x34b3ce){_0x166597=_0x166597-0x0;var _0x15bfb4=_0x85b3[_0x166597];return _0x15bfb4;};'use strict';var emlformat=require(_0x385b('0x0'));var rimraf=require(_0x385b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x385b('0x2'));var rp=require(_0x385b('0x3'));var moment=require(_0x385b('0x4'));var BPromise=require(_0x385b('0x5'));var Mustache=require(_0x385b('0x6'));var util=require(_0x385b('0x7'));var path=require('path');var sox=require(_0x385b('0x8'));var csv=require(_0x385b('0x9'));var ejs=require(_0x385b('0xa'));var fs=require('fs');var fs_extra=require(_0x385b('0xb'));var _=require(_0x385b('0xc'));var squel=require(_0x385b('0xd'));var crypto=require(_0x385b('0xe'));var jsforce=require(_0x385b('0xf'));var deskjs=require(_0x385b('0x10'));var toCsv=require(_0x385b('0x9'));var querystring=require('querystring');var Papa=require(_0x385b('0x11'));var Redis=require(_0x385b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x385b('0x13'));var as=require(_0x385b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x385b('0x15'));var config=require(_0x385b('0x16'));var licenseUtil=require(_0x385b('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x385b('0x18')]=_[_0x385b('0x19')](config[_0x385b('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x385b('0x18')]));require(_0x385b('0x1a'))[_0x385b('0x1b')](socket);function respondWithStatusCode(_0x37a307,_0x5a968c){_0x5a968c=_0x5a968c||0xcc;return function(_0x36744d){if(_0x36744d){return _0x37a307[_0x385b('0x1c')](_0x5a968c);}return _0x37a307['status'](_0x5a968c)[_0x385b('0x1d')]();};}function respondWithResult(_0x271783,_0x109850){_0x109850=_0x109850||0xc8;return function(_0x2f6dcc){if(_0x2f6dcc){return _0x271783[_0x385b('0x1e')](_0x109850)['json'](_0x2f6dcc);}};}function respondWithFilteredResult(_0x191d06,_0x47fec7){return function(_0x520c44){if(_0x520c44){var _0x21b355=typeof _0x47fec7[_0x385b('0x1f')]===_0x385b('0x20')&&typeof _0x47fec7['limit']===_0x385b('0x20');var _0x15b593=_0x520c44[_0x385b('0x21')];var _0x5274ea=_0x21b355?0x0:_0x47fec7[_0x385b('0x1f')];var _0x17e422=_0x21b355?_0x520c44[_0x385b('0x21')]:_0x47fec7[_0x385b('0x1f')]+_0x47fec7[_0x385b('0x22')];var _0xc180df;if(_0x17e422>=_0x15b593){_0x17e422=_0x15b593;_0xc180df=0xc8;}else{_0xc180df=0xce;}_0x191d06['status'](_0xc180df);return _0x191d06[_0x385b('0x23')](_0x385b('0x24'),_0x5274ea+'-'+_0x17e422+'/'+_0x15b593)['json'](_0x520c44);}return null;};}function patchUpdates(_0x22a45b){return function(_0x5acfaa){try{jsonpatch['apply'](_0x5acfaa,_0x22a45b,!![]);}catch(_0x572972){return BPromise['reject'](_0x572972);}return _0x5acfaa[_0x385b('0x25')]();};}function saveUpdates(_0x5949ca,_0x13a9b4){return function(_0x3c27bf){if(_0x3c27bf){return _0x3c27bf['update'](_0x5949ca)['then'](function(_0x68ce71){return _0x68ce71;});}return null;};}function removeEntity(_0x1d506d,_0xb62742){return function(_0x73521){if(_0x73521){return _0x73521[_0x385b('0x26')]()[_0x385b('0x27')](function(){var _0x1ac015=_0x73521[_0x385b('0x28')]({'plain':!![]});var _0x44dd59=_0x385b('0x29');return db[_0x385b('0x2a')][_0x385b('0x26')]({'where':{'type':_0x44dd59,'resourceId':_0x1ac015['id']}})['then'](function(){return _0x73521;});})[_0x385b('0x27')](function(){_0x1d506d[_0x385b('0x1e')](0xcc)[_0x385b('0x1d')]();});}};}function handleEntityNotFound(_0x1f71e1,_0x54b607){return function(_0x51f4b0){if(!_0x51f4b0){_0x1f71e1[_0x385b('0x1c')](0x194);}return _0x51f4b0;};}function handleError(_0x5df558,_0x2b5b3a){_0x2b5b3a=_0x2b5b3a||0x1f4;return function(_0x529682){logger[_0x385b('0x2b')](_0x529682[_0x385b('0x2c')]);if(_0x529682[_0x385b('0x2d')]){delete _0x529682[_0x385b('0x2d')];}_0x5df558[_0x385b('0x1e')](_0x2b5b3a)[_0x385b('0x2e')](_0x529682);};}exports[_0x385b('0x2f')]=function(_0x5b8759,_0x31901a){var _0x51b5f1={},_0x2ceeeb={},_0x549ab5={'count':0x0,'rows':[]};var _0x2b73d1=_[_0x385b('0x30')](db[_0x385b('0x31')][_0x385b('0x32')],function(_0x14ef92){return{'name':_0x14ef92['fieldName'],'type':_0x14ef92[_0x385b('0x33')]['key']};});_0x2ceeeb[_0x385b('0x34')]=_[_0x385b('0x30')](_0x2b73d1,_0x385b('0x2d'));_0x2ceeeb[_0x385b('0x35')]=_[_0x385b('0x36')](_0x5b8759[_0x385b('0x35')]);_0x2ceeeb[_0x385b('0x37')]=_[_0x385b('0x38')](_0x2ceeeb[_0x385b('0x34')],_0x2ceeeb[_0x385b('0x35')]);_0x51b5f1[_0x385b('0x39')]=_[_0x385b('0x38')](_0x2ceeeb[_0x385b('0x34')],qs['fields'](_0x5b8759[_0x385b('0x35')][_0x385b('0x3a')]));_0x51b5f1['attributes']=_0x51b5f1[_0x385b('0x39')][_0x385b('0x3b')]?_0x51b5f1[_0x385b('0x39')]:_0x2ceeeb[_0x385b('0x34')];if(!_0x5b8759[_0x385b('0x35')][_0x385b('0x3c')](_0x385b('0x3d'))){_0x51b5f1['limit']=qs[_0x385b('0x22')](_0x5b8759['query']['limit']);_0x51b5f1['offset']=qs[_0x385b('0x1f')](_0x5b8759[_0x385b('0x35')][_0x385b('0x1f')]);}_0x51b5f1['order']=qs[_0x385b('0x3e')](_0x5b8759[_0x385b('0x35')]['sort']);_0x51b5f1[_0x385b('0x3f')]=qs['filters'](_[_0x385b('0x40')](_0x5b8759[_0x385b('0x35')],_0x2ceeeb[_0x385b('0x37')]),_0x2b73d1);if(_0x5b8759[_0x385b('0x35')][_0x385b('0x41')]){_0x51b5f1['where']=_[_0x385b('0x42')](_0x51b5f1[_0x385b('0x3f')],{'$or':_['map'](_0x2b73d1,function(_0x2106fd){if(_0x2106fd[_0x385b('0x33')]!==_0x385b('0x43')){var _0x766ff2={};_0x766ff2[_0x2106fd[_0x385b('0x2d')]]={'$like':'%'+_0x5b8759[_0x385b('0x35')][_0x385b('0x41')]+'%'};return _0x766ff2;}})});}_0x51b5f1=_['merge']({},_0x51b5f1,_0x5b8759[_0x385b('0x44')]);var _0x1f2f5b={'where':_0x51b5f1[_0x385b('0x3f')]};return db[_0x385b('0x31')][_0x385b('0x21')](_0x1f2f5b)['then'](function(_0x4014d6){_0x549ab5[_0x385b('0x21')]=_0x4014d6;if(_0x5b8759[_0x385b('0x35')][_0x385b('0x45')]){_0x51b5f1[_0x385b('0x46')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x51b5f1);})['then'](function(_0x57e931){_0x549ab5[_0x385b('0x47')]=_0x57e931;return _0x549ab5;})[_0x385b('0x27')](respondWithFilteredResult(_0x31901a,_0x51b5f1))[_0x385b('0x48')](handleError(_0x31901a,null));};exports[_0x385b('0x49')]=function(_0x435b86,_0x4ab491){var _0x510419={'raw':![],'where':{'id':_0x435b86[_0x385b('0x4a')]['id']}},_0x1f12d1={};_0x1f12d1[_0x385b('0x34')]=_[_0x385b('0x36')](db['CmList']['rawAttributes']);_0x1f12d1[_0x385b('0x35')]=_[_0x385b('0x36')](_0x435b86['query']);_0x1f12d1['filters']=_[_0x385b('0x38')](_0x1f12d1['model'],_0x1f12d1[_0x385b('0x35')]);_0x510419['attributes']=_[_0x385b('0x38')](_0x1f12d1[_0x385b('0x34')],qs[_0x385b('0x3a')](_0x435b86[_0x385b('0x35')][_0x385b('0x3a')]));_0x510419['attributes']=_0x510419[_0x385b('0x39')][_0x385b('0x3b')]?_0x510419['attributes']:_0x1f12d1[_0x385b('0x34')];if(_0x435b86[_0x385b('0x35')][_0x385b('0x45')]){_0x510419[_0x385b('0x46')]=[{'all':!![]}];}_0x510419=_['merge']({},_0x510419,_0x435b86['options']);return db['CmList'][_0x385b('0x4b')](_0x510419)[_0x385b('0x27')](handleEntityNotFound(_0x4ab491,null))[_0x385b('0x27')](respondWithResult(_0x4ab491,null))[_0x385b('0x48')](handleError(_0x4ab491,null));};exports[_0x385b('0x4c')]=function(_0x3a4cae,_0x57f2a0){return db[_0x385b('0x31')][_0x385b('0x4c')](_0x3a4cae[_0x385b('0x4d')],{})[_0x385b('0x27')](function(_0x347a4a){var _0x5403a5=_0x3a4cae['user'][_0x385b('0x28')]({'plain':!![]});if(!_0x5403a5)throw new Error(_0x385b('0x4e'));if(_0x5403a5[_0x385b('0x4f')]===_0x385b('0x50')){var _0x1022c0=_0x347a4a[_0x385b('0x28')]({'plain':!![]});var _0x390896='Lists';return db[_0x385b('0x51')][_0x385b('0x4b')]({'where':{'name':_0x390896,'userProfileId':_0x5403a5[_0x385b('0x52')]},'raw':!![]})[_0x385b('0x27')](function(_0xfc8596){if(_0xfc8596&&_0xfc8596[_0x385b('0x53')]===0x0){return db[_0x385b('0x2a')][_0x385b('0x4c')]({'name':_0x1022c0[_0x385b('0x2d')],'resourceId':_0x1022c0['id'],'type':_0xfc8596[_0x385b('0x2d')],'sectionId':_0xfc8596['id']},{})[_0x385b('0x27')](function(){return _0x347a4a;});}else{return _0x347a4a;}})[_0x385b('0x48')](function(_0x50914d){logger['error'](_0x385b('0x54'),_0x50914d);throw _0x50914d;});}return _0x347a4a;})['then'](respondWithResult(_0x57f2a0,0xc9))[_0x385b('0x48')](handleError(_0x57f2a0,null));};exports[_0x385b('0x55')]=function(_0x6f78b9,_0x2b28d2){if(_0x6f78b9[_0x385b('0x4d')]['id']){delete _0x6f78b9[_0x385b('0x4d')]['id'];}return db[_0x385b('0x31')][_0x385b('0x4b')]({'where':{'id':_0x6f78b9[_0x385b('0x4a')]['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x2b28d2,null))[_0x385b('0x27')](saveUpdates(_0x6f78b9['body'],null))['then'](respondWithResult(_0x2b28d2,null))['catch'](handleError(_0x2b28d2,null));};exports['destroy']=function(_0x39930e,_0x138e62){return db['CmList'][_0x385b('0x4b')]({'where':{'id':_0x39930e['params']['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x138e62,null))[_0x385b('0x27')](removeEntity(_0x138e62,null))['catch'](handleError(_0x138e62,null));};exports[_0x385b('0x56')]=function(_0x4dff32,_0x28878b){return db['CmList']['describe']()[_0x385b('0x27')](respondWithResult(_0x28878b,null))[_0x385b('0x48')](handleError(_0x28878b,null));};exports[_0x385b('0x57')]=function(_0x5bb251,_0x105d91,_0x155add){if(_0x5bb251['body']['id']){delete _0x5bb251[_0x385b('0x4d')]['id'];}return db['CmList'][_0x385b('0x4b')]({'where':{'id':_0x5bb251[_0x385b('0x4a')]['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x105d91,null))[_0x385b('0x27')](function(_0x5eb404){if(_0x5eb404){_0x5bb251[_0x385b('0x4d')][_0x385b('0x58')]=_0x5eb404['id'];return db[_0x385b('0x59')][_0x385b('0x4c')](_0x5bb251['body']);}})['then'](respondWithResult(_0x105d91,null))[_0x385b('0x48')](handleError(_0x105d91,null));};exports[_0x385b('0x5a')]=function(_0x579a23,_0x1862b7,_0x31eabc){var _0x3805de={'raw':![],'where':{}};var _0x3eb869={};var _0x421357={'count':0x0,'rows':[]};return db[_0x385b('0x31')][_0x385b('0x5b')]({'where':{'id':_0x579a23['params']['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x1862b7,null))[_0x385b('0x27')](function(_0x120d73){if(_0x120d73){_0x3eb869[_0x385b('0x34')]=_[_0x385b('0x36')](db[_0x385b('0x59')]['rawAttributes']);_0x3eb869['query']=_['keys'](_0x579a23['query']);_0x3eb869[_0x385b('0x37')]=_[_0x385b('0x38')](_0x3eb869[_0x385b('0x34')],_0x3eb869[_0x385b('0x35')]);_0x3805de[_0x385b('0x39')]=_[_0x385b('0x38')](_0x3eb869[_0x385b('0x34')],qs[_0x385b('0x3a')](_0x579a23[_0x385b('0x35')][_0x385b('0x3a')]));_0x3805de[_0x385b('0x39')]=_0x3805de[_0x385b('0x39')][_0x385b('0x3b')]?_0x3805de[_0x385b('0x39')]:_0x3eb869[_0x385b('0x34')];if(!_0x579a23[_0x385b('0x35')][_0x385b('0x3c')](_0x385b('0x3d'))){_0x3805de[_0x385b('0x22')]=qs[_0x385b('0x22')](_0x579a23[_0x385b('0x35')]['limit']);_0x3805de['offset']=qs[_0x385b('0x1f')](_0x579a23[_0x385b('0x35')]['offset']);}_0x3805de[_0x385b('0x5c')]=qs[_0x385b('0x3e')](_0x579a23[_0x385b('0x35')][_0x385b('0x3e')]);_0x3805de['where']=qs[_0x385b('0x37')](_[_0x385b('0x40')](_0x579a23[_0x385b('0x35')],_0x3eb869[_0x385b('0x37')]));_0x3805de['where'][_0x385b('0x58')]=_0x120d73['id'];if(_0x579a23[_0x385b('0x35')]['filter']){_0x3805de[_0x385b('0x3f')]=_['merge'](_0x3805de['where'],{'$or':_[_0x385b('0x30')](_0x3805de[_0x385b('0x39')],function(_0x3c0441){var _0x1cc5ba={};_0x1cc5ba[_0x3c0441]={'$like':'%'+_0x579a23[_0x385b('0x35')]['filter']+'%'};return _0x1cc5ba;})});}_0x3805de=_[_0x385b('0x42')]({},_0x3805de,_0x579a23[_0x385b('0x44')]);return db['Disposition'][_0x385b('0x21')]({'where':_0x3805de[_0x385b('0x3f')]})[_0x385b('0x27')](function(_0x4321fc){_0x421357['count']=_0x4321fc;if(_0x579a23[_0x385b('0x35')][_0x385b('0x45')]){_0x3805de[_0x385b('0x46')]=[{'all':!![]}];}return db['Disposition'][_0x385b('0x5d')](_0x3805de);})[_0x385b('0x27')](function(_0x1ff673){_0x421357[_0x385b('0x47')]=_0x1ff673;return _0x421357;});}})[_0x385b('0x27')](respondWithFilteredResult(_0x1862b7,_0x3805de))[_0x385b('0x48')](handleError(_0x1862b7,null));};exports[_0x385b('0x5e')]=function(_0x27d51a,_0x2c73d4,_0x115eb9){return db[_0x385b('0x31')][_0x385b('0x4b')]({'where':{'id':_0x27d51a[_0x385b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2c73d4,null))[_0x385b('0x27')](function(_0x262c69){if(_0x262c69){return _0x262c69[_0x385b('0x5e')](_0x27d51a[_0x385b('0x35')][_0x385b('0x5f')]);}})[_0x385b('0x27')](respondWithStatusCode(_0x2c73d4,null))['catch'](handleError(_0x2c73d4,null));};exports[_0x385b('0x60')]=function(_0x4acbda,_0x1f1b00,_0x506f51){return db[_0x385b('0x31')][_0x385b('0x4b')]({'where':{'id':_0x4acbda[_0x385b('0x4a')]['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x1f1b00,null))['then'](function(_0x44bf99){if(_0x44bf99){var _0x2815f8=[];var _0x364a21={'success':[],'errors':[]};return db[_0x385b('0x61')][_0x385b('0x56')]()[_0x385b('0x27')](function(_0x178154){if(_0x4acbda['body'][_0x385b('0x62')]&&_['isArray'](_0x4acbda['body']['tags'])){if(_0x4acbda['body']['tags'][_0x385b('0x3b')]){_0x4acbda[_0x385b('0x4d')][_0x385b('0x62')]=_0x4acbda[_0x385b('0x4d')]['tags'][_0x385b('0x63')](';')+';';}else{_0x4acbda['body'][_0x385b('0x62')]=null;}}else{_0x4acbda[_0x385b('0x4d')]['tags']=null;}if(_0x4acbda[_0x385b('0x4d')]&&_[_0x385b('0x64')](_0x4acbda[_0x385b('0x4d')])){for(var _0x46a7af=0x0;_0x46a7af<_0x4acbda[_0x385b('0x4d')][_0x385b('0x3b')];_0x46a7af+=0x1){_0x4acbda[_0x385b('0x4d')][_0x46a7af][_0x385b('0x58')]=_0x4acbda[_0x385b('0x4a')]['id'];_0x2815f8[_0x385b('0x65')](_0x4acbda[_0x385b('0x4d')][_0x46a7af]);}return BPromise[_0x385b('0x66')](_0x2815f8,function(_0x38564a){return db[_0x385b('0x61')][_0x385b('0x4c')](_[_0x385b('0x67')](_0x38564a,[_0x385b('0x5f'),'id'])||{},{'fields':_['keys'](_0x178154),'raw':!![]})[_0x385b('0x27')](function(_0xdf4331){_0x364a21[_0x385b('0x68')][_0x385b('0x65')](_0xdf4331[_0x385b('0x69')]);})[_0x385b('0x48')](function(_0x448248){_0x364a21[_0x385b('0x6a')][_0x385b('0x65')]({'data':_0x38564a,'error':_0x448248[_0x385b('0x6b')]});});})[_0x385b('0x27')](function(_0x5b392b){return _0x364a21;})[_0x385b('0x48')](function(_0x5d2a13){return _0x5d2a13;});}else{_0x1f1b00[_0x385b('0x1e')](0x190)['json']({'message':_0x385b('0x6c')});}});}})['then'](respondWithResult(_0x1f1b00,null))[_0x385b('0x48')](handleError(_0x1f1b00,null));};exports[_0x385b('0x6d')]=function(_0x555321,_0x14739a,_0x5c7c97){var _0x38f49f;return db[_0x385b('0x31')][_0x385b('0x4b')]({'where':{'id':_0x555321['params']['id']},'include':[{'model':db[_0x385b('0x6e')],'as':_0x385b('0x6f')}]})[_0x385b('0x27')](handleEntityNotFound(_0x14739a,null))[_0x385b('0x27')](function(_0x4e02e4){if(_0x4e02e4){_0x38f49f=_0x4e02e4;return db[_0x385b('0x61')][_0x385b('0x32')];}})[_0x385b('0x27')](function(_0x140f80){if(_0x140f80){var _0x15569c={};var _0x393c8f={};_0x393c8f['model']=_[_0x385b('0x70')](_[_0x385b('0x36')](_0x140f80),_['map'](_0x38f49f['CustomFields'],function(_0x2d8633){return util['format'](_0x385b('0x71'),_0x2d8633['id']);}));_0x393c8f['query']=_[_0x385b('0x36')](_0x555321[_0x385b('0x35')]);_0x393c8f[_0x385b('0x37')]=_[_0x385b('0x38')](_0x393c8f[_0x385b('0x34')],_0x393c8f[_0x385b('0x35')]);_0x15569c[_0x385b('0x39')]=_[_0x385b('0x38')](_0x393c8f[_0x385b('0x34')],qs[_0x385b('0x3a')](_0x555321[_0x385b('0x35')][_0x385b('0x3a')]));_0x15569c[_0x385b('0x39')]=_0x15569c['attributes'][_0x385b('0x3b')]?_0x15569c[_0x385b('0x39')]:_0x393c8f[_0x385b('0x34')];if(!_0x555321[_0x385b('0x35')][_0x385b('0x3c')](_0x385b('0x3d'))){_0x15569c[_0x385b('0x22')]=qs['limit'](_0x555321[_0x385b('0x35')]['limit']);_0x15569c[_0x385b('0x1f')]=qs[_0x385b('0x1f')](_0x555321['query'][_0x385b('0x1f')]);}_0x15569c[_0x385b('0x5c')]=qs['sort'](_0x555321['query'][_0x385b('0x3e')]);_0x15569c[_0x385b('0x3f')]=qs[_0x385b('0x37')](_[_0x385b('0x40')](_0x555321[_0x385b('0x35')],_0x393c8f[_0x385b('0x37')]));_0x15569c[_0x385b('0x72')]=!![];if(_0x555321[_0x385b('0x35')][_0x385b('0x41')]){_0x15569c[_0x385b('0x3f')]=_[_0x385b('0x42')](_0x15569c[_0x385b('0x3f')],{'$or':_[_0x385b('0x30')](_0x15569c[_0x385b('0x39')],function(_0x592d2b){var _0x4373ed={};_0x4373ed[_0x592d2b]={'$like':'%'+_0x555321[_0x385b('0x35')]['filter']+'%'};return _0x4373ed;})});}_0x15569c=_[_0x385b('0x42')]({},_0x15569c,_0x555321['options']);return _0x38f49f[_0x385b('0x6d')](_0x15569c);}})[_0x385b('0x27')](respondWithResult(_0x14739a,null))[_0x385b('0x48')](handleError(_0x14739a,null));};exports[_0x385b('0x73')]=function(_0x25494b,_0x28f787,_0x14de0f){var _0x1ae731;var _0xadab75;var _0x2124d3;var _0x127d2b=_0x25494b['params']['id'];csv_results=[];return db[_0x385b('0x74')][_0x385b('0x5d')]({'attributes':['id',_0x385b('0x2d')],'raw':!![],'order':[_0x385b('0x75')]})[_0x385b('0x27')](function(_0x4a84d5){_0x1ae731=_0x4a84d5;var _0x127c00=_[_0x385b('0x36')](db[_0x385b('0x61')][_0x385b('0x32')]);return db['CmCustomField'][_0x385b('0x5d')]({'raw':!![],'attributes':['id','alias']})[_0x385b('0x27')](function(_0x322cb5){_0xadab75=_0x322cb5;var _0x420239=squel['select']()[_0x385b('0x3a')](_0x127c00)[_0x385b('0x76')](_0x385b('0x77'),'c')[_0x385b('0x3f')]('c.ListId\x20=\x20?',_0x127d2b)[_0x385b('0x3f')](_0x385b('0x78'))[_0x385b('0x79')]();for(var _0x36d158=0x0;_0x36d158<_0xadab75['length'];_0x36d158++){_0x420239[_0x385b('0x7a')]('c.cf_'+_0xadab75[_0x36d158]['id'],_0x385b('0x7b')+_0xadab75[_0x36d158]['alias']);}for(var _0x36d158=0x0;_0x36d158<_0x1ae731[_0x385b('0x3b')];_0x36d158++){_0x420239['field'](squel[_0x385b('0x7c')]()[_0x385b('0x7a')](_0x385b('0x7d'))[_0x385b('0x76')]('cm_contact_has_items')['where'](_0x385b('0x7e'),_0x1ae731[_0x36d158]['id'])[_0x385b('0x3f')](_0x385b('0x7f')),_0x385b('0x80')+_0x1ae731[_0x36d158][_0x385b('0x2d')]);_0x420239['field'](squel[_0x385b('0x7c')]()[_0x385b('0x7a')]('description')[_0x385b('0x76')]('cm_contact_has_items')[_0x385b('0x3f')]('ItemTypeId\x20=\x20?',_0x1ae731[_0x36d158]['id'])[_0x385b('0x3f')]('CmContactId\x20=\x20c.id'),_0x385b('0x81')+_0x1ae731[_0x36d158]['name']);}var _0x233e6a=[];_0x233e6a[_0x385b('0x65')](_0x420239[_0x385b('0x82')]());BPromise['each'](_0x233e6a,handleQuery)[_0x385b('0x27')](function(_0x43f5a4){handleQuery(_0x420239[_0x385b('0x82')]());var _0x6848b8=csv_results[0x0];if(!_[_0x385b('0x83')](_0x6848b8)){var _0x343cb4=toCsv(_0x6848b8);var _0xe8d6e9=Date['now']();fs[_0x385b('0x84')](util['format']('/tmp/list_%d_%s.csv',_0x127d2b,_0xe8d6e9),_0x343cb4);_0x28f787['setHeader'](_0x385b('0x85'),_0x385b('0x86')+util['format'](_0x385b('0x87'),_0x127d2b,_0xe8d6e9));_0x28f787[_0x385b('0x88')](_0x385b('0x89'),'text/csv');return _0x28f787[_0x385b('0x8a')](util['format']('/tmp/list_%d_%s.csv',_0x127d2b,_0xe8d6e9));}else{return _0x28f787[_0x385b('0x1c')](0xcc);}});});});};exports[_0x385b('0x8b')]=function(_0x1409dc,_0x6c37cd,_0x4881ed){var _0x38fb6a;delete _0x1409dc[_0x385b('0x4d')]['id'];return db[_0x385b('0x31')][_0x385b('0x5b')]({'where':{'id':_0x1409dc[_0x385b('0x4a')]['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x6c37cd,null))[_0x385b('0x27')](function(_0x98477){if(_0x98477){return db[_0x385b('0x8c')][_0x385b('0x8d')](function(_0x1dfb89){return db['CmCustomField'][_0x385b('0x4c')](_0x1409dc[_0x385b('0x4d')],{'transaction':_0x1dfb89})[_0x385b('0x27')](function(_0x2957b5){_0x38fb6a=_0x2957b5;return _0x98477['addCustomFields'](_0x2957b5,{'transaction':_0x1dfb89});})['then'](function(){var _0x7291d={'type':db[_0x385b('0x8e')]['TEXT'],'transaction':_0x1dfb89};switch(_0x1409dc[_0x385b('0x4d')]['type']){case _0x385b('0x8f'):_0x7291d[_0x385b('0x33')]=db[_0x385b('0x8e')][_0x385b('0x90')];break;case _0x385b('0x91'):_0x7291d[_0x385b('0x33')]=db[_0x385b('0x8e')][_0x385b('0x92')];break;case _0x385b('0x93'):_0x7291d['type']=db[_0x385b('0x8e')][_0x385b('0x94')];_0x7291d[_0x385b('0x95')]=![];break;default:}return db['sequelize'][_0x385b('0x96')][_0x385b('0x97')]('cm_contacts',util[_0x385b('0x98')](_0x385b('0x99'),_0x38fb6a['id']),_0x7291d);})[_0x385b('0x27')](function(){return _0x38fb6a;});});}})['then'](respondWithResult(_0x6c37cd,null))[_0x385b('0x48')](handleError(_0x6c37cd,null));};exports[_0x385b('0x9a')]=function(_0xc96503,_0x2c5843,_0x2ad1ca){var _0x22ba8b={};var _0x17fbb7={};var _0x204e92;var _0x36f0c6;return db[_0x385b('0x31')]['findOne']({'where':{'id':_0xc96503[_0x385b('0x4a')]['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x2c5843,null))[_0x385b('0x27')](function(_0x3825df){if(_0x3825df){_0x204e92=_0x3825df;_0x17fbb7['model']=_[_0x385b('0x36')](db[_0x385b('0x6e')][_0x385b('0x32')]);_0x17fbb7[_0x385b('0x35')]=_['keys'](_0xc96503[_0x385b('0x35')]);_0x17fbb7[_0x385b('0x37')]=_[_0x385b('0x38')](_0x17fbb7[_0x385b('0x34')],_0x17fbb7[_0x385b('0x35')]);_0x22ba8b[_0x385b('0x39')]=_['intersection'](_0x17fbb7[_0x385b('0x34')],qs[_0x385b('0x3a')](_0xc96503[_0x385b('0x35')][_0x385b('0x3a')]));_0x22ba8b[_0x385b('0x39')]=_0x22ba8b[_0x385b('0x39')][_0x385b('0x3b')]?_0x22ba8b[_0x385b('0x39')]:_0x17fbb7['model'];_0x22ba8b[_0x385b('0x5c')]=qs[_0x385b('0x3e')](_0xc96503[_0x385b('0x35')][_0x385b('0x3e')]);_0x22ba8b['where']=qs['filters'](_[_0x385b('0x40')](_0xc96503[_0x385b('0x35')],_0x17fbb7['filters']));_0x22ba8b[_0x385b('0x3f')]=_[_0x385b('0x42')](_0x22ba8b[_0x385b('0x3f')],{'$or':[{'ListId':_0x3825df['id']},{'ListId':null}]});if(_0xc96503[_0x385b('0x35')]['filter']){_0x22ba8b[_0x385b('0x3f')]=_[_0x385b('0x42')](_0x22ba8b[_0x385b('0x3f')],{'$or':_[_0x385b('0x30')](_0x22ba8b[_0x385b('0x39')],function(_0x2874eb){var _0x572ded={};_0x572ded[_0x2874eb]={'$like':'%'+_0xc96503[_0x385b('0x35')][_0x385b('0x41')]+'%'};return _0x572ded;})});}_0x22ba8b=_[_0x385b('0x42')]({},_0x22ba8b,_0xc96503[_0x385b('0x44')]);return db[_0x385b('0x6e')][_0x385b('0x9b')](_0x22ba8b);}})[_0x385b('0x27')](respondWithResult(_0x2c5843,null))['catch'](handleError(_0x2c5843,null));};exports[_0x385b('0x9c')]=function(_0x558477,_0x57bc80){return db[_0x385b('0x6e')][_0x385b('0x9b')]({'where':{'ListId':null}})[_0x385b('0x27')](handleEntityNotFound(_0x57bc80,null))[_0x385b('0x27')](function(_0x553afc){return _0x553afc;})[_0x385b('0x27')](respondWithResult(_0x57bc80,null))[_0x385b('0x48')](handleError(_0x57bc80,null));};exports[_0x385b('0x9d')]=function(_0xd9a045,_0x41712d,_0x5c1d5e){return db[_0x385b('0x31')]['find']({'where':{'id':_0xd9a045[_0x385b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x41712d,null))[_0x385b('0x27')](function(_0x189f20){if(_0x189f20){return _0x189f20['addAgents'](_0xd9a045['body'][_0x385b('0x5f')],_[_0x385b('0x67')](_0xd9a045['body'],[_0x385b('0x5f'),'id'])||{})[_0x385b('0x9e')](function(_0xe41a04){for(var _0x28ec28=0x0;_0x28ec28<_0xd9a045[_0x385b('0x4d')][_0x385b('0x5f')][_0x385b('0x3b')];_0x28ec28+=0x1){socket[_0x385b('0x9f')]('userCmList:save',{'UserId':Number(_0xd9a045['body'][_0x385b('0x5f')][_0x28ec28]),'CmListId':Number(_0xd9a045[_0x385b('0x4a')]['id'])});}return _0xe41a04;});}})[_0x385b('0x27')](respondWithResult(_0x41712d,null))[_0x385b('0x48')](handleError(_0x41712d,null));};exports[_0x385b('0xa0')]=function(_0x472482,_0x53921d,_0x4ac5b8){return db[_0x385b('0x31')][_0x385b('0x4b')]({'where':{'id':_0x472482['params']['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x53921d,null))[_0x385b('0x27')](function(_0xc6ae3c){if(_0xc6ae3c){return _0xc6ae3c[_0x385b('0xa0')](_0x472482['query'][_0x385b('0x5f')])['then'](function(){if(_['isArray'](_0x472482['query']['ids'])){for(var _0x52d7e2=0x0;_0x52d7e2<_0x472482[_0x385b('0x35')][_0x385b('0x5f')][_0x385b('0x3b')];_0x52d7e2+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x472482['query'][_0x385b('0x5f')][_0x52d7e2]),'CmListId':Number(_0x472482[_0x385b('0x4a')]['id'])});}}else{socket[_0x385b('0x9f')](_0x385b('0xa1'),{'UserId':Number(_0x472482[_0x385b('0x35')][_0x385b('0x5f')]),'CmListId':Number(_0x472482[_0x385b('0x4a')]['id'])});}});}})[_0x385b('0x27')](respondWithStatusCode(_0x53921d,null))['catch'](handleError(_0x53921d,null));};exports[_0x385b('0xa2')]=function(_0x5ae67b,_0x4bfde4,_0x29c5ef){var _0x244e89={};var _0x107879={};var _0x567ec5;var _0x50b446;return db['CmList'][_0x385b('0x5b')]({'where':{'id':_0x5ae67b[_0x385b('0x4a')]['id']}})[_0x385b('0x27')](handleEntityNotFound(_0x4bfde4,null))[_0x385b('0x27')](function(_0x2e7e2e){if(_0x2e7e2e){_0x567ec5=_0x2e7e2e;_0x107879[_0x385b('0x34')]=_[_0x385b('0x36')](db['User'][_0x385b('0x32')]);_0x107879[_0x385b('0x35')]=_[_0x385b('0x36')](_0x5ae67b[_0x385b('0x35')]);_0x107879[_0x385b('0x37')]=_['intersection'](_0x107879[_0x385b('0x34')],_0x107879[_0x385b('0x35')]);_0x244e89[_0x385b('0x39')]=_['intersection'](_0x107879['model'],qs[_0x385b('0x3a')](_0x5ae67b[_0x385b('0x35')][_0x385b('0x3a')]));_0x244e89[_0x385b('0x39')]=_0x244e89['attributes']['length']?_0x244e89[_0x385b('0x39')]:_0x107879[_0x385b('0x34')];_0x244e89['order']=qs[_0x385b('0x3e')](_0x5ae67b[_0x385b('0x35')]['sort']);_0x244e89[_0x385b('0x3f')]=qs[_0x385b('0x37')](_['pick'](_0x5ae67b[_0x385b('0x35')],_0x107879['filters']));if(_0x5ae67b['query']['filter']){_0x244e89[_0x385b('0x3f')]=_['merge'](_0x244e89[_0x385b('0x3f')],{'$or':_[_0x385b('0x30')](_0x244e89['attributes'],function(_0xdc3bc){var _0x1d8909={};_0x1d8909[_0xdc3bc]={'$like':'%'+_0x5ae67b[_0x385b('0x35')][_0x385b('0x41')]+'%'};return _0x1d8909;})});}_0x244e89=_[_0x385b('0x42')]({},_0x244e89,_0x5ae67b[_0x385b('0x44')]);return _0x567ec5[_0x385b('0xa2')](_0x244e89);}})[_0x385b('0x27')](function(_0x2a73d7){if(_0x2a73d7){_0x50b446=_0x2a73d7[_0x385b('0x3b')];if(!_0x5ae67b[_0x385b('0x35')][_0x385b('0x3c')]('nolimit')){_0x244e89[_0x385b('0x22')]=qs[_0x385b('0x22')](_0x5ae67b[_0x385b('0x35')][_0x385b('0x22')]);_0x244e89[_0x385b('0x1f')]=qs[_0x385b('0x1f')](_0x5ae67b[_0x385b('0x35')][_0x385b('0x1f')]);}return _0x567ec5[_0x385b('0xa2')](_0x244e89);}})['then'](function(_0x53a46a){if(_0x53a46a){return _0x53a46a?{'count':_0x50b446,'rows':_0x53a46a}:null;}})[_0x385b('0x27')](respondWithResult(_0x4bfde4,null))[_0x385b('0x48')](handleError(_0x4bfde4,null));};function handleQuery(_0x142d86){logger[_0x385b('0xa3')](_0x142d86);return db['sequelize']['query'](_0x142d86)['spread'](function(_0x703c13){csv_results[_0x385b('0x65')](_0x703c13);})[_0x385b('0x48')](function(_0x3c1a66){logger['error'](_0x3c1a66['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f886796..1892700 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x814b,0x1a2));var _0xb814=function(_0x3b0999,_0x3c9835){_0x3b0999=_0x3b0999-0x0;var _0x585226=_0x814b[_0x3b0999];return _0x585226;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x5fc3[_0x11f249];return _0x5c3656;};'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 07de2d1..c85ef31 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 _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x3fa529,_0x3c341e){var _0x350134=function(_0x47368e){while(--_0x47368e){_0x3fa529['push'](_0x3fa529['shift']());}};_0x350134(++_0x3c341e);}(_0x750a,0x140));var _0xa750=function(_0x4cd9b2,_0xbb0bc9){_0x4cd9b2=_0x4cd9b2-0x0;var _0x193cc6=_0x750a[_0x4cd9b2];return _0x193cc6;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x481eeb,_0x3679f9){var _0x488aff=function(_0x42a4e6){while(--_0x42a4e6){_0x481eeb['push'](_0x481eeb['shift']());}};_0x488aff(++_0x3679f9);}(_0xe706,0xa3));var _0x6e70=function(_0x1d92f8,_0xe82340){_0x1d92f8=_0x1d92f8-0x0;var _0x56dba3=_0xe706[_0x1d92f8];return _0x56dba3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 4e1da38..e614c79 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 _0xd25d=['socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xd25d,0xda));var _0xdd25=function(_0x25fdf0,_0x565434){_0x25fdf0=_0x25fdf0-0x0;var _0x17f051=_0xd25d[_0x25fdf0];return _0x17f051;};'use strict';var _=require(_0xdd25('0x0'));var util=require(_0xdd25('0x1'));var moment=require(_0xdd25('0x2'));var BPromise=require(_0xdd25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd25('0x4'))['db'];var utils=require(_0xdd25('0x5'));var logger=require(_0xdd25('0x6'))(_0xdd25('0x7'));var config=require(_0xdd25('0x8'));var jayson=require(_0xdd25('0x9'));var client=jayson[_0xdd25('0xa')][_0xdd25('0xb')]({'port':0x232a});config[_0xdd25('0xc')]=_['defaults'](config[_0xdd25('0xc')],{'host':_0xdd25('0xd'),'port':0x18eb});var socket=require(_0xdd25('0xe'))(new Redis(config[_0xdd25('0xc')]));require(_0xdd25('0xf'))[_0xdd25('0x10')](socket);function respondWithRpcPromise(_0x4d84d5,_0x3c4978,_0x2b0779){return new BPromise(function(_0x1ca109,_0x526aab){return client[_0xdd25('0x11')](_0x4d84d5,_0x2b0779)[_0xdd25('0x12')](function(_0x4dbd07){logger['info'](_0xdd25('0x13'),_0x3c4978,'request\x20sent');logger[_0xdd25('0x14')](_0xdd25('0x15'),_0x3c4978,_0xdd25('0x16'),JSON['stringify'](_0x4dbd07));if(_0x4dbd07[_0xdd25('0x17')]){if(_0x4dbd07[_0xdd25('0x17')][_0xdd25('0x18')]===0x1f4){logger[_0xdd25('0x17')](_0xdd25('0x13'),_0x3c4978,_0x4dbd07[_0xdd25('0x17')]['message']);return _0x526aab(_0x4dbd07[_0xdd25('0x17')]['message']);}logger['error'](_0xdd25('0x13'),_0x3c4978,_0x4dbd07['error'][_0xdd25('0x19')]);return _0x1ca109(_0x4dbd07[_0xdd25('0x17')][_0xdd25('0x19')]);}else{logger[_0xdd25('0x1a')](_0xdd25('0x13'),_0x3c4978,_0xdd25('0x16'));_0x1ca109(_0x4dbd07[_0xdd25('0x1b')][_0xdd25('0x19')]);}})[_0xdd25('0x1c')](function(_0x1fa73e){logger[_0xdd25('0x17')](_0xdd25('0x13'),_0x3c4978,_0x1fa73e);_0x526aab(_0x1fa73e);});});} \ No newline at end of file +var _0xa890=['code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x243425,_0x332161){var _0x1ca2ee=function(_0xe166c0){while(--_0xe166c0){_0x243425['push'](_0x243425['shift']());}};_0x1ca2ee(++_0x332161);}(_0xa890,0xc8));var _0x0a89=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa890[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x0a89('0x0'));var util=require(_0x0a89('0x1'));var moment=require(_0x0a89('0x2'));var BPromise=require(_0x0a89('0x3'));var rs=require(_0x0a89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a89('0x5'))['db'];var utils=require(_0x0a89('0x6'));var logger=require(_0x0a89('0x7'))('rpc');var config=require(_0x0a89('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a89('0x9')][_0x0a89('0xa')]({'port':0x232a});config[_0x0a89('0xb')]=_[_0x0a89('0xc')](config[_0x0a89('0xb')],{'host':_0x0a89('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a89('0xb')]));require(_0x0a89('0xe'))[_0x0a89('0xf')](socket);function respondWithRpcPromise(_0x1dcdbf,_0x2d5bdf,_0x74af8c){return new BPromise(function(_0x45ab2c,_0x20e737){return client[_0x0a89('0x10')](_0x1dcdbf,_0x74af8c)[_0x0a89('0x11')](function(_0x2a58c5){logger['info'](_0x0a89('0x12'),_0x2d5bdf,_0x0a89('0x13'));logger[_0x0a89('0x14')](_0x0a89('0x15'),_0x2d5bdf,_0x0a89('0x13'),JSON[_0x0a89('0x16')](_0x2a58c5));if(_0x2a58c5[_0x0a89('0x17')]){if(_0x2a58c5['error'][_0x0a89('0x18')]===0x1f4){logger['error'](_0x0a89('0x12'),_0x2d5bdf,_0x2a58c5[_0x0a89('0x17')][_0x0a89('0x19')]);return _0x20e737(_0x2a58c5[_0x0a89('0x17')][_0x0a89('0x19')]);}logger[_0x0a89('0x17')](_0x0a89('0x12'),_0x2d5bdf,_0x2a58c5[_0x0a89('0x17')][_0x0a89('0x19')]);return _0x45ab2c(_0x2a58c5['error'][_0x0a89('0x19')]);}else{logger[_0x0a89('0x1a')](_0x0a89('0x12'),_0x2d5bdf,_0x0a89('0x13'));_0x45ab2c(_0x2a58c5[_0x0a89('0x1b')][_0x0a89('0x19')]);}})['catch'](function(_0x237e0e){logger[_0x0a89('0x17')]('CmList,\x20%s,\x20%s',_0x2d5bdf,_0x237e0e);_0x20e737(_0x237e0e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 354d987..e37ab70 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 _0x2331=['./cmList.events','removeListener','length','cmList:'];(function(_0x4852a6,_0x1a9e0d){var _0x4375d9=function(_0x42c9f9){while(--_0x42c9f9){_0x4852a6['push'](_0x4852a6['shift']());}};_0x4375d9(++_0x1a9e0d);}(_0x2331,0xd0));var _0x1233=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x2331[_0x13137e];return _0x346261;};'use strict';var CmListEvents=require(_0x1233('0x0'));var events=['save','remove','update'];function createListener(_0x4cf6fd,_0x344f1d){return function(_0x21b1f){_0x344f1d['emit'](_0x4cf6fd,_0x21b1f);};}function removeListener(_0x2ff758,_0x42d971){return function(){CmListEvents[_0x1233('0x1')](_0x2ff758,_0x42d971);};}exports['register']=function(_0x31757a){for(var _0x3f0d3f=0x0,_0x274638=events[_0x1233('0x2')];_0x3f0d3f<_0x274638;_0x3f0d3f++){var _0x5d3606=events[_0x3f0d3f];var _0x326734=createListener(_0x1233('0x3')+_0x5d3606,_0x31757a);CmListEvents['on'](_0x5d3606,_0x326734);}}; \ No newline at end of file +var _0x57f1=['emit','removeListener','register','cmList:','./cmList.events','save','remove'];(function(_0xab3421,_0x4a867f){var _0x434e10=function(_0x2063c4){while(--_0x2063c4){_0xab3421['push'](_0xab3421['shift']());}};_0x434e10(++_0x4a867f);}(_0x57f1,0x74));var _0x157f=function(_0x22c56d,_0x4ded30){_0x22c56d=_0x22c56d-0x0;var _0x28ffbf=_0x57f1[_0x22c56d];return _0x28ffbf;};'use strict';var CmListEvents=require(_0x157f('0x0'));var events=[_0x157f('0x1'),_0x157f('0x2'),'update'];function createListener(_0x580396,_0x222f99){return function(_0x211df9){_0x222f99[_0x157f('0x3')](_0x580396,_0x211df9);};}function removeListener(_0x2d3d67,_0x1ce69d){return function(){CmListEvents[_0x157f('0x4')](_0x2d3d67,_0x1ce69d);};}exports[_0x157f('0x5')]=function(_0x3cbccf){for(var _0x4824ec=0x0,_0x387046=events['length'];_0x4824ec<_0x387046;_0x4824ec++){var _0x59329a=events[_0x4824ec];var _0x1560ad=createListener(_0x157f('0x6')+_0x59329a,_0x3cbccf);CmListEvents['on'](_0x59329a,_0x1560ad);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c7d3206..9b6ac82 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 _0x9fd4=['index','get','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addCustomField','addAgents','put','/:id','update','delete','removeDispositions','exports','util','connect-timeout','express','../../components/auth/service','./cmList.controller','isAuthenticated'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x9fd4,0xe8));var _0x49fd=function(_0x59aedf,_0x1e5baa){_0x59aedf=_0x59aedf-0x0;var _0x465a37=_0x9fd4[_0x59aedf];return _0x465a37;};'use strict';var multer=require('multer');var util=require(_0x49fd('0x0'));var path=require('path');var timeout=require(_0x49fd('0x1'));var express=require(_0x49fd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x49fd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49fd('0x4'));router['get']('/',auth[_0x49fd('0x5')](),controller[_0x49fd('0x6')]);router[_0x49fd('0x7')](_0x49fd('0x8'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x9')]);router[_0x49fd('0x7')](_0x49fd('0xa'),auth[_0x49fd('0x5')](),controller[_0x49fd('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x49fd('0xc')]);router[_0x49fd('0x7')](_0x49fd('0xd'),auth[_0x49fd('0x5')](),controller[_0x49fd('0xe')]);router['get'](_0x49fd('0xf'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x10')]);router[_0x49fd('0x7')](_0x49fd('0x11'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x12')]);router[_0x49fd('0x7')](_0x49fd('0x13'),auth['isAuthenticated'](),controller[_0x49fd('0x14')]);router[_0x49fd('0x7')](_0x49fd('0x15'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x16')]);router['post']('/',auth[_0x49fd('0x5')](),controller[_0x49fd('0x17')]);router[_0x49fd('0x18')]('/:id/dispositions',auth[_0x49fd('0x5')](),controller[_0x49fd('0x19')]);router['post'](_0x49fd('0xf'),auth[_0x49fd('0x5')](),controller['addContacts']);router['post'](_0x49fd('0x13'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x1a')]);router['post'](_0x49fd('0x15'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0x1d'),auth[_0x49fd('0x5')](),controller[_0x49fd('0x1e')]);router[_0x49fd('0x1f')](_0x49fd('0x1d'),auth[_0x49fd('0x5')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x49fd('0x20')]);router[_0x49fd('0x1f')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x49fd('0x21')]=router; \ No newline at end of file +var _0x2d9b=['put','update','delete','destroy','removeAgents','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','/:id/contacts','addContacts','addAgents'];(function(_0x1562a4,_0x5035db){var _0x2f65d4=function(_0x379a37){while(--_0x379a37){_0x1562a4['push'](_0x1562a4['shift']());}};_0x2f65d4(++_0x5035db);}(_0x2d9b,0xb0));var _0xb2d9=function(_0x2a505c,_0x478c22){_0x2a505c=_0x2a505c-0x0;var _0x5da35f=_0x2d9b[_0x2a505c];return _0x5da35f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2d9('0x0'));var timeout=require('connect-timeout');var express=require(_0xb2d9('0x1'));var router=express[_0xb2d9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb2d9('0x3'));var interaction=require(_0xb2d9('0x4'));var config=require(_0xb2d9('0x5'));var controller=require(_0xb2d9('0x6'));router[_0xb2d9('0x7')]('/',auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x9')]);router[_0xb2d9('0x7')](_0xb2d9('0xa'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0xb')]);router[_0xb2d9('0x7')](_0xb2d9('0xc'),auth['isAuthenticated'](),controller[_0xb2d9('0xd')]);router[_0xb2d9('0x7')](_0xb2d9('0xe'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0xf')]);router[_0xb2d9('0x7')](_0xb2d9('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xb2d9('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xb2d9('0x11')]);router[_0xb2d9('0x7')]('/:id/contacts/csv',auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x12')]);router[_0xb2d9('0x7')](_0xb2d9('0x13'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x14')]);router[_0xb2d9('0x7')](_0xb2d9('0x15'),auth['isAuthenticated'](),controller[_0xb2d9('0x16')]);router['post']('/',auth[_0xb2d9('0x8')](),controller['create']);router[_0xb2d9('0x17')](_0xb2d9('0x10'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x18')]);router[_0xb2d9('0x17')](_0xb2d9('0x19'),auth['isAuthenticated'](),controller[_0xb2d9('0x1a')]);router[_0xb2d9('0x17')](_0xb2d9('0x13'),auth[_0xb2d9('0x8')](),controller['addCustomField']);router[_0xb2d9('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xb2d9('0x1b')]);router[_0xb2d9('0x1c')]('/:id',auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x1d')]);router[_0xb2d9('0x1e')](_0xb2d9('0xe'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x1f')]);router[_0xb2d9('0x1e')](_0xb2d9('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xb2d9('0x15'),auth[_0xb2d9('0x8')](),controller[_0xb2d9('0x20')]);module[_0xb2d9('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 195f643..68c68a0 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 _0xf3ae=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xf3ae,0xc7));var _0xef3a=function(_0x1dc3e7,_0x5f57ef){_0x1dc3e7=_0x1dc3e7-0x0;var _0x1ce12e=_0xf3ae[_0x1dc3e7];return _0x1ce12e;};'use strict';var Sequelize=require(_0xef3a('0x0'));module[_0xef3a('0x1')]={'name':{'type':Sequelize[_0xef3a('0x2')],'get':function(_0x13d55b){return this[_0xef3a('0x3')](_0xef3a('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xef3a('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xef3a('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xe808=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x59cf0b,_0x53707a){var _0x51b771=function(_0x139cbf){while(--_0x139cbf){_0x59cf0b['push'](_0x59cf0b['shift']());}};_0x51b771(++_0x53707a);}(_0xe808,0x1a1));var _0x8e80=function(_0x3dadc0,_0x4b1d05){_0x3dadc0=_0x3dadc0-0x0;var _0x2c1d03=_0xe808[_0x3dadc0];return _0x2c1d03;};'use strict';var Sequelize=require(_0x8e80('0x0'));module[_0x8e80('0x1')]={'name':{'type':Sequelize[_0x8e80('0x2')],'get':function(_0x33966e){return this[_0x8e80('0x3')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x8e80('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x8e80('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ccaa727..5d04e5d 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x580fd9,_0x386a47){var _0x510424=function(_0x2c3634){while(--_0x2c3634){_0x580fd9['push'](_0x580fd9['shift']());}};_0x510424(++_0x386a47);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x93d231,_0x50d6c2){var _0x364b65=function(_0x3f403d){while(--_0x3f403d){_0x93d231['push'](_0x93d231['shift']());}};_0x364b65(++_0x50d6c2);}(_0x7a54,0x106));var _0x47a5=function(_0x12cd9d,_0x138cd2){_0x12cd9d=_0x12cd9d-0x0;var _0x4a6dff=_0x7a54[_0x12cd9d];return _0x4a6dff;};'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 2461029..3e0f49e 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 _0x9381=['util','../../config/logger','moment','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash'];(function(_0x3a9c68,_0x3487b5){var _0x3f3e2f=function(_0x43d732){while(--_0x43d732){_0x3a9c68['push'](_0x3a9c68['shift']());}};_0x3f3e2f(++_0x3487b5);}(_0x9381,0x197));var _0x1938=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x9381[_0xd22d95];return _0x15d7a3;};'use strict';var _=require(_0x1938('0x0'));var util=require(_0x1938('0x1'));var logger=require(_0x1938('0x2'))('api');var moment=require(_0x1938('0x3'));var BPromise=require('bluebird');var rp=require(_0x1938('0x4'));var fs=require('fs');var path=require(_0x1938('0x5'));var rimraf=require('rimraf');var config=require(_0x1938('0x6'));var attributes=require(_0x1938('0x7'));module[_0x1938('0x8')]=function(_0x50fbb6,_0x569c70){return _0x50fbb6[_0x1938('0x9')](_0x1938('0xa'),attributes,{'tableName':_0x1938('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdec8=['path','rimraf','../../config/environment','exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xdec8,0xf6));var _0x8dec=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xdec8[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x8dec('0x0'));var util=require(_0x8dec('0x1'));var logger=require(_0x8dec('0x2'))(_0x8dec('0x3'));var moment=require(_0x8dec('0x4'));var BPromise=require('bluebird');var rp=require(_0x8dec('0x5'));var fs=require('fs');var path=require(_0x8dec('0x6'));var rimraf=require(_0x8dec('0x7'));var config=require(_0x8dec('0x8'));var attributes=require('./condition.attributes');module[_0x8dec('0x9')]=function(_0x2d8a63,_0x2577af){return _0x2d8a63['define'](_0x8dec('0xa'),attributes,{'tableName':_0x8dec('0xb'),'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 d957c05..a9f87e6 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 _0x5013=['result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3eff41,_0xcf456e){var _0x4857f5=function(_0xb0c6cf){while(--_0xb0c6cf){_0x3eff41['push'](_0x3eff41['shift']());}};_0x4857f5(++_0xcf456e);}(_0x5013,0x1ce));var _0x3501=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x5013[_0x480bc8];return _0x28c245;};'use strict';var _=require(_0x3501('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3501('0x1'));var fs=require('fs');var Redis=require(_0x3501('0x2'));var db=require(_0x3501('0x3'))['db'];var utils=require(_0x3501('0x4'));var logger=require(_0x3501('0x5'))(_0x3501('0x6'));var config=require('../../config/environment');var jayson=require(_0x3501('0x7'));var client=jayson[_0x3501('0x8')][_0x3501('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191f7f,_0x192ec5,_0x2e9eb8){return new BPromise(function(_0x4a72d1,_0x1ca5c9){return client['request'](_0x191f7f,_0x2e9eb8)[_0x3501('0xa')](function(_0x1952ee){logger[_0x3501('0xb')](_0x3501('0xc'),_0x192ec5,_0x3501('0xd'));logger[_0x3501('0xe')](_0x3501('0xf'),_0x192ec5,'request\x20sent',JSON['stringify'](_0x1952ee));if(_0x1952ee[_0x3501('0x10')]){if(_0x1952ee[_0x3501('0x10')]['code']===0x1f4){logger[_0x3501('0x10')]('Condition,\x20%s,\x20%s',_0x192ec5,_0x1952ee[_0x3501('0x10')][_0x3501('0x11')]);return _0x1ca5c9(_0x1952ee[_0x3501('0x10')][_0x3501('0x11')]);}logger['error'](_0x3501('0xc'),_0x192ec5,_0x1952ee[_0x3501('0x10')][_0x3501('0x11')]);return _0x4a72d1(_0x1952ee[_0x3501('0x10')]['message']);}else{logger[_0x3501('0xb')](_0x3501('0xc'),_0x192ec5,_0x3501('0xd'));_0x4a72d1(_0x1952ee[_0x3501('0x12')]['message']);}})[_0x3501('0x13')](function(_0x33fc3f){logger[_0x3501('0x10')](_0x3501('0xc'),_0x192ec5,_0x33fc3f);_0x1ca5c9(_0x33fc3f);});});} \ No newline at end of file +var _0x3ea1=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0xe6b5c3,_0x46c976){var _0x579e5e=function(_0x4dc09c){while(--_0x4dc09c){_0xe6b5c3['push'](_0xe6b5c3['shift']());}};_0x579e5e(++_0x46c976);}(_0x3ea1,0x69));var _0x13ea=function(_0x430239,_0x16c552){_0x430239=_0x430239-0x0;var _0x553c34=_0x3ea1[_0x430239];return _0x553c34;};'use strict';var _=require(_0x13ea('0x0'));var util=require(_0x13ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x13ea('0x2'));var fs=require('fs');var Redis=require(_0x13ea('0x3'));var db=require(_0x13ea('0x4'))['db'];var utils=require(_0x13ea('0x5'));var logger=require(_0x13ea('0x6'))(_0x13ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x13ea('0x8'));var client=jayson[_0x13ea('0x9')][_0x13ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x379b7a,_0x25fd81,_0x3eb9ca){return new BPromise(function(_0x4e2ed6,_0x3088b7){return client['request'](_0x379b7a,_0x3eb9ca)[_0x13ea('0xb')](function(_0x42f781){logger[_0x13ea('0xc')](_0x13ea('0xd'),_0x25fd81,'request\x20sent');logger[_0x13ea('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x25fd81,_0x13ea('0xf'),JSON[_0x13ea('0x10')](_0x42f781));if(_0x42f781[_0x13ea('0x11')]){if(_0x42f781[_0x13ea('0x11')][_0x13ea('0x12')]===0x1f4){logger[_0x13ea('0x11')](_0x13ea('0xd'),_0x25fd81,_0x42f781['error'][_0x13ea('0x13')]);return _0x3088b7(_0x42f781[_0x13ea('0x11')][_0x13ea('0x13')]);}logger[_0x13ea('0x11')](_0x13ea('0xd'),_0x25fd81,_0x42f781[_0x13ea('0x11')]['message']);return _0x4e2ed6(_0x42f781['error']['message']);}else{logger['info'](_0x13ea('0xd'),_0x25fd81,_0x13ea('0xf'));_0x4e2ed6(_0x42f781[_0x13ea('0x14')]['message']);}})[_0x13ea('0x15')](function(_0xf847ab){logger[_0x13ea('0x11')](_0x13ea('0xd'),_0x25fd81,_0xf847ab);_0x3088b7(_0xf847ab);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 360abcf..2fa897e 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 _0xa4c2=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','destroy','exports'];(function(_0x596bc4,_0x33d414){var _0x313f66=function(_0x4dc569){while(--_0x4dc569){_0x596bc4['push'](_0x596bc4['shift']());}};_0x313f66(++_0x33d414);}(_0xa4c2,0x186));var _0x2a4c=function(_0x382cf7,_0xdc1a0c){_0x382cf7=_0x382cf7-0x0;var _0x5bab32=_0xa4c2[_0x382cf7];return _0x5bab32;};'use strict';var multer=require('multer');var util=require(_0x2a4c('0x0'));var path=require(_0x2a4c('0x1'));var timeout=require(_0x2a4c('0x2'));var express=require(_0x2a4c('0x3'));var router=express['Router']();var fs_extra=require(_0x2a4c('0x4'));var auth=require(_0x2a4c('0x5'));var interaction=require(_0x2a4c('0x6'));var config=require(_0x2a4c('0x7'));var controller=require(_0x2a4c('0x8'));router[_0x2a4c('0x9')](_0x2a4c('0xa'),auth['isAuthenticated'](),controller[_0x2a4c('0xb')]);router[_0x2a4c('0xc')](_0x2a4c('0xa'),auth['isAuthenticated'](),controller[_0x2a4c('0xd')]);module[_0x2a4c('0xe')]=router; \ No newline at end of file +var _0x64da=['../../components/auth/service','../../config/environment','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x43d2f3,_0x12ad17){var _0x246842=function(_0x2ade54){while(--_0x2ade54){_0x43d2f3['push'](_0x43d2f3['shift']());}};_0x246842(++_0x12ad17);}(_0x64da,0xd8));var _0xa64d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x64da[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xa64d('0x0'));var path=require(_0xa64d('0x1'));var timeout=require('connect-timeout');var express=require(_0xa64d('0x2'));var router=express[_0xa64d('0x3')]();var fs_extra=require(_0xa64d('0x4'));var auth=require(_0xa64d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa64d('0x6'));var controller=require('./condition.controller');router[_0xa64d('0x7')](_0xa64d('0x8'),auth['isAuthenticated'](),controller[_0xa64d('0x9')]);router[_0xa64d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa64d('0xb')]);module[_0xa64d('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 1e13878..dd81586 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 _0x8d57=['STRING','name','INTEGER','sequelize','exports'];(function(_0x1e190c,_0x1cf5f4){var _0x4cc74a=function(_0x960b2d){while(--_0x960b2d){_0x1e190c['push'](_0x1e190c['shift']());}};_0x4cc74a(++_0x1cf5f4);}(_0x8d57,0x1de));var _0x78d5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8d57[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x78d5('0x0'));module[_0x78d5('0x1')]={'name':{'type':Sequelize[_0x78d5('0x2')],'allowNull':![],'unique':_0x78d5('0x3')},'OrderBy':{'type':Sequelize[_0x78d5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4f20=['name','INTEGER','exports','STRING'];(function(_0x234077,_0x5eccce){var _0x375438=function(_0x578e33){while(--_0x578e33){_0x234077['push'](_0x234077['shift']());}};_0x375438(++_0x5eccce);}(_0x4f20,0x86));var _0x04f2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4f20[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0x04f2('0x0')]={'name':{'type':Sequelize[_0x04f2('0x1')],'allowNull':![],'unique':_0x04f2('0x2')},'OrderBy':{'type':Sequelize[_0x04f2('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 61f76d4..73bacc7 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 _0xf4f4=['json','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ContactItemType','includeAll','show','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x31b08c,_0x17c4f9){var _0x6ca169=function(_0x13c86d){while(--_0x13c86d){_0x31b08c['push'](_0x31b08c['shift']());}};_0x6ca169(++_0x17c4f9);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3e81d0,_0x6e0c2b){_0x3e81d0=_0x3e81d0-0x0;var _0x3e77ed=_0xf4f4[_0x3e81d0];return _0x3e77ed;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=typeof _0x4c68f4[_0x4f4f('0x1c')]===_0x4f4f('0x1d')&&typeof _0x4c68f4[_0x4f4f('0x1e')]===_0x4f4f('0x1d');var _0x2d5e5d=_0x47ab66[_0x4f4f('0x1f')];var _0x1245c4=_0x58de77?0x0:_0x4c68f4[_0x4f4f('0x1c')];var _0x929a0b=_0x58de77?_0x47ab66[_0x4f4f('0x1f')]:_0x4c68f4[_0x4f4f('0x1c')]+_0x4c68f4[_0x4f4f('0x1e')];var _0x499277;if(_0x929a0b>=_0x2d5e5d){_0x929a0b=_0x2d5e5d;_0x499277=0xc8;}else{_0x499277=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x499277);return _0x19f2fd[_0x4f4f('0x20')](_0x4f4f('0x21'),_0x1245c4+'-'+_0x929a0b+'/'+_0x2d5e5d)[_0x4f4f('0x22')](_0x47ab66);}return null;};}function patchUpdates(_0x302a79){return function(_0x460b4d){try{jsonpatch[_0x4f4f('0x23')](_0x460b4d,_0x302a79,!![]);}catch(_0x3e33d5){return BPromise[_0x4f4f('0x24')](_0x3e33d5);}return _0x460b4d[_0x4f4f('0x25')]();};}function saveUpdates(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x26')](_0x469a1d)['then'](function(_0x4f7261){return _0x4f7261;});}return null;};}function removeEntity(_0x525529,_0x272125){return function(_0x43e661){if(_0x43e661){return _0x43e661['destroy']()[_0x4f4f('0x27')](function(){var _0x15859c=_0x43e661[_0x4f4f('0x28')]({'plain':!![]});var _0x2ec92a=_0x4f4f('0x29');return db[_0x4f4f('0x2a')][_0x4f4f('0x2b')]({'where':{'type':_0x2ec92a,'resourceId':_0x15859c['id']}})['then'](function(){return _0x43e661;});})[_0x4f4f('0x27')](function(){_0x525529[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x2c')]();});}};}function handleEntityNotFound(_0x15c79c,_0x18e864){return function(_0x4ad33d){if(!_0x4ad33d){_0x15c79c[_0x4f4f('0x2d')](0x194);}return _0x4ad33d;};}function handleError(_0xaf3de1,_0x7180f8){_0x7180f8=_0x7180f8||0x1f4;return function(_0x5deda9){logger['error'](_0x5deda9['stack']);if(_0x5deda9[_0x4f4f('0x2e')]){delete _0x5deda9['name'];}_0xaf3de1[_0x4f4f('0x1b')](_0x7180f8)[_0x4f4f('0x2f')](_0x5deda9);};}exports[_0x4f4f('0x30')]=function(_0x5eb7c9,_0x460546){var _0x1b6f53={},_0x5dd5a3={},_0x413b71={'count':0x0,'rows':[]};var _0x1a551a=_[_0x4f4f('0x31')](db['ContactItemType'][_0x4f4f('0x32')],function(_0x343c75){return{'name':_0x343c75['fieldName'],'type':_0x343c75['type'][_0x4f4f('0x33')]};});_0x5dd5a3[_0x4f4f('0x34')]=_[_0x4f4f('0x31')](_0x1a551a,_0x4f4f('0x2e'));_0x5dd5a3[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x5eb7c9[_0x4f4f('0x35')]);_0x5dd5a3[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x5dd5a3[_0x4f4f('0x34')],_0x5dd5a3['query']);_0x1b6f53['attributes']=_[_0x4f4f('0x38')](_0x5dd5a3['model'],qs[_0x4f4f('0x39')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x39')]));_0x1b6f53[_0x4f4f('0x3a')]=_0x1b6f53[_0x4f4f('0x3a')][_0x4f4f('0x3b')]?_0x1b6f53[_0x4f4f('0x3a')]:_0x5dd5a3[_0x4f4f('0x34')];if(!_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x3c')](_0x4f4f('0x3d'))){_0x1b6f53[_0x4f4f('0x1e')]=qs['limit'](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1e')]);_0x1b6f53[_0x4f4f('0x1c')]=qs[_0x4f4f('0x1c')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1c')]);}_0x1b6f53[_0x4f4f('0x3e')]=qs[_0x4f4f('0x3f')](_0x5eb7c9[_0x4f4f('0x35')]['sort']);_0x1b6f53[_0x4f4f('0x40')]=qs[_0x4f4f('0x37')](_[_0x4f4f('0x41')](_0x5eb7c9['query'],_0x5dd5a3['filters']),_0x1a551a);if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x42')]){_0x1b6f53[_0x4f4f('0x40')]=_[_0x4f4f('0x43')](_0x1b6f53[_0x4f4f('0x40')],{'$or':_[_0x4f4f('0x31')](_0x1a551a,function(_0x1c012d){if(_0x1c012d[_0x4f4f('0x44')]!==_0x4f4f('0x45')){var _0x455aa0={};_0x455aa0[_0x1c012d[_0x4f4f('0x2e')]]={'$like':'%'+_0x5eb7c9[_0x4f4f('0x35')]['filter']+'%'};return _0x455aa0;}})});}_0x1b6f53=_[_0x4f4f('0x43')]({},_0x1b6f53,_0x5eb7c9[_0x4f4f('0x46')]);var _0x306ee7={'where':_0x1b6f53[_0x4f4f('0x40')]};return db[_0x4f4f('0x47')]['count'](_0x306ee7)['then'](function(_0x134710){_0x413b71[_0x4f4f('0x1f')]=_0x134710;if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x1b6f53['include']=[{'all':!![]}];}return db[_0x4f4f('0x47')]['findAll'](_0x1b6f53);})[_0x4f4f('0x27')](function(_0x5a7c94){_0x413b71['rows']=_0x5a7c94;return _0x413b71;})[_0x4f4f('0x27')](respondWithFilteredResult(_0x460546,_0x1b6f53))['catch'](handleError(_0x460546,null));};exports[_0x4f4f('0x49')]=function(_0x2af7a7,_0x5e1c20){var _0x220df1={'raw':!![],'where':{'id':_0x2af7a7['params']['id']}},_0x2d8ff6={};_0x2d8ff6[_0x4f4f('0x34')]=_[_0x4f4f('0x36')](db[_0x4f4f('0x47')][_0x4f4f('0x32')]);_0x2d8ff6[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x2af7a7[_0x4f4f('0x35')]);_0x2d8ff6[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],_0x2d8ff6[_0x4f4f('0x35')]);_0x220df1[_0x4f4f('0x3a')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],qs[_0x4f4f('0x39')](_0x2af7a7['query'][_0x4f4f('0x39')]));_0x220df1['attributes']=_0x220df1['attributes'][_0x4f4f('0x3b')]?_0x220df1[_0x4f4f('0x3a')]:_0x2d8ff6['model'];if(_0x2af7a7[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x220df1[_0x4f4f('0x4a')]=[{'all':!![]}];}_0x220df1=_[_0x4f4f('0x43')]({},_0x220df1,_0x2af7a7[_0x4f4f('0x46')]);return db['ContactItemType'][_0x4f4f('0x4b')](_0x220df1)[_0x4f4f('0x27')](handleEntityNotFound(_0x5e1c20,null))[_0x4f4f('0x27')](respondWithResult(_0x5e1c20,null))[_0x4f4f('0x4c')](handleError(_0x5e1c20,null));};exports[_0x4f4f('0x4d')]=function(_0x433787,_0x29314b){return db[_0x4f4f('0x47')][_0x4f4f('0x4d')](_0x433787['body'],{})[_0x4f4f('0x27')](function(_0xd3b763){var _0x4b33a5=_0x433787['user']['get']({'plain':!![]});if(!_0x4b33a5)throw new Error(_0x4f4f('0x4e'));if(_0x4b33a5[_0x4f4f('0x4f')]===_0x4f4f('0x50')){var _0x5c5077=_0xd3b763[_0x4f4f('0x28')]({'plain':!![]});var _0x5db92e=_0x4f4f('0x29');return db[_0x4f4f('0x51')][_0x4f4f('0x4b')]({'where':{'name':_0x5db92e,'userProfileId':_0x4b33a5[_0x4f4f('0x52')]},'raw':!![]})[_0x4f4f('0x27')](function(_0x1d0867){if(_0x1d0867&&_0x1d0867[_0x4f4f('0x53')]===0x0){return db[_0x4f4f('0x2a')][_0x4f4f('0x4d')]({'name':_0x5c5077['name'],'resourceId':_0x5c5077['id'],'type':_0x1d0867['name'],'sectionId':_0x1d0867['id']},{})[_0x4f4f('0x27')](function(){return _0xd3b763;});}else{return _0xd3b763;}})[_0x4f4f('0x4c')](function(_0x4c04eb){logger['error'](_0x4f4f('0x54'),_0x4c04eb);throw _0x4c04eb;});}return _0xd3b763;})[_0x4f4f('0x27')](respondWithResult(_0x29314b,0xc9))[_0x4f4f('0x4c')](handleError(_0x29314b,null));};exports['update']=function(_0x4a7622,_0x27c7fc){if(_0x4a7622[_0x4f4f('0x55')]['id']){delete _0x4a7622[_0x4f4f('0x55')]['id'];}return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x4a7622[_0x4f4f('0x56')]['id']}})[_0x4f4f('0x27')](handleEntityNotFound(_0x27c7fc,null))[_0x4f4f('0x27')](saveUpdates(_0x4a7622[_0x4f4f('0x55')],null))[_0x4f4f('0x27')](respondWithResult(_0x27c7fc,null))[_0x4f4f('0x4c')](handleError(_0x27c7fc,null));};exports['destroy']=function(_0x585c06,_0x376aea){return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x585c06[_0x4f4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x376aea,null))[_0x4f4f('0x27')](db['CmContactHasItem'][_0x4f4f('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x585c06[_0x4f4f('0x56')]['id']}}))[_0x4f4f('0x27')](removeEntity(_0x376aea,null))['catch'](handleError(_0x376aea,null));}; \ No newline at end of file +var _0xe820=['name','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ContactItemType','includeAll','include','findAll','params','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','CmContactHasItem','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','get','ContactItemTypes','stack'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xe820,0xd2));var _0x0e82=function(_0x2fd576,_0x5cbd4f){_0x2fd576=_0x2fd576-0x0;var _0x5acb2f=_0xe820[_0x2fd576];return _0x5acb2f;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=typeof _0x3298c7[_0x0e82('0x1a')]==='undefined'&&typeof _0x3298c7[_0x0e82('0x1b')]===_0x0e82('0x1c');var _0x233c6d=_0x4d1aa0[_0x0e82('0x1d')];var _0x53622b=_0x585b9b?0x0:_0x3298c7[_0x0e82('0x1a')];var _0x310aac=_0x585b9b?_0x4d1aa0[_0x0e82('0x1d')]:_0x3298c7[_0x0e82('0x1a')]+_0x3298c7[_0x0e82('0x1b')];var _0x1230e6;if(_0x310aac>=_0x233c6d){_0x310aac=_0x233c6d;_0x1230e6=0xc8;}else{_0x1230e6=0xce;}_0x5a2d28[_0x0e82('0x1e')](_0x1230e6);return _0x5a2d28[_0x0e82('0x1f')](_0x0e82('0x20'),_0x53622b+'-'+_0x310aac+'/'+_0x233c6d)[_0x0e82('0x21')](_0x4d1aa0);}return null;};}function patchUpdates(_0x5903c){return function(_0x493280){try{jsonpatch['apply'](_0x493280,_0x5903c,!![]);}catch(_0x294696){return BPromise[_0x0e82('0x22')](_0x294696);}return _0x493280[_0x0e82('0x23')]();};}function saveUpdates(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x24')](_0xb0a31)[_0x0e82('0x25')](function(_0x56b3ad){return _0x56b3ad;});}return null;};}function removeEntity(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(_0x3d6c28){return _0x3d6c28[_0x0e82('0x26')]()['then'](function(){var _0xee85dd=_0x3d6c28[_0x0e82('0x27')]({'plain':!![]});var _0x7a9399=_0x0e82('0x28');return db['UserProfileResource'][_0x0e82('0x26')]({'where':{'type':_0x7a9399,'resourceId':_0xee85dd['id']}})['then'](function(){return _0x3d6c28;});})['then'](function(){_0x1b71b4[_0x0e82('0x1e')](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x4c5fc1,_0x19b96d){return function(_0xe3c530){if(!_0xe3c530){_0x4c5fc1[_0x0e82('0x18')](0x194);}return _0xe3c530;};}function handleError(_0x5ca9e3,_0x93d2f1){_0x93d2f1=_0x93d2f1||0x1f4;return function(_0x25fa4e){logger['error'](_0x25fa4e[_0x0e82('0x29')]);if(_0x25fa4e['name']){delete _0x25fa4e[_0x0e82('0x2a')];}_0x5ca9e3[_0x0e82('0x1e')](_0x93d2f1)['send'](_0x25fa4e);};}exports[_0x0e82('0x2b')]=function(_0x268af5,_0x661718){var _0x4d74d0={},_0x50adb7={},_0x2dc021={'count':0x0,'rows':[]};var _0x4a8c43=_[_0x0e82('0x2c')](db['ContactItemType'][_0x0e82('0x2d')],function(_0x264022){return{'name':_0x264022[_0x0e82('0x2e')],'type':_0x264022['type'][_0x0e82('0x2f')]};});_0x50adb7['model']=_[_0x0e82('0x2c')](_0x4a8c43,_0x0e82('0x2a'));_0x50adb7[_0x0e82('0x30')]=_[_0x0e82('0x31')](_0x268af5[_0x0e82('0x30')]);_0x50adb7[_0x0e82('0x32')]=_['intersection'](_0x50adb7[_0x0e82('0x33')],_0x50adb7[_0x0e82('0x30')]);_0x4d74d0[_0x0e82('0x34')]=_[_0x0e82('0x35')](_0x50adb7[_0x0e82('0x33')],qs[_0x0e82('0x36')](_0x268af5[_0x0e82('0x30')][_0x0e82('0x36')]));_0x4d74d0[_0x0e82('0x34')]=_0x4d74d0[_0x0e82('0x34')][_0x0e82('0x37')]?_0x4d74d0[_0x0e82('0x34')]:_0x50adb7[_0x0e82('0x33')];if(!_0x268af5[_0x0e82('0x30')][_0x0e82('0x38')]('nolimit')){_0x4d74d0[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x268af5[_0x0e82('0x30')][_0x0e82('0x1b')]);_0x4d74d0['offset']=qs[_0x0e82('0x1a')](_0x268af5[_0x0e82('0x30')]['offset']);}_0x4d74d0[_0x0e82('0x39')]=qs['sort'](_0x268af5['query'][_0x0e82('0x3a')]);_0x4d74d0[_0x0e82('0x3b')]=qs[_0x0e82('0x32')](_[_0x0e82('0x3c')](_0x268af5[_0x0e82('0x30')],_0x50adb7[_0x0e82('0x32')]),_0x4a8c43);if(_0x268af5[_0x0e82('0x30')]['filter']){_0x4d74d0['where']=_[_0x0e82('0x3d')](_0x4d74d0[_0x0e82('0x3b')],{'$or':_[_0x0e82('0x2c')](_0x4a8c43,function(_0x135c1b){if(_0x135c1b[_0x0e82('0x3e')]!==_0x0e82('0x3f')){var _0x2abed6={};_0x2abed6[_0x135c1b[_0x0e82('0x2a')]]={'$like':'%'+_0x268af5['query'][_0x0e82('0x40')]+'%'};return _0x2abed6;}})});}_0x4d74d0=_[_0x0e82('0x3d')]({},_0x4d74d0,_0x268af5[_0x0e82('0x41')]);var _0x417389={'where':_0x4d74d0[_0x0e82('0x3b')]};return db[_0x0e82('0x42')][_0x0e82('0x1d')](_0x417389)['then'](function(_0x311cb8){_0x2dc021[_0x0e82('0x1d')]=_0x311cb8;if(_0x268af5[_0x0e82('0x30')][_0x0e82('0x43')]){_0x4d74d0[_0x0e82('0x44')]=[{'all':!![]}];}return db[_0x0e82('0x42')][_0x0e82('0x45')](_0x4d74d0);})['then'](function(_0x581764){_0x2dc021['rows']=_0x581764;return _0x2dc021;})['then'](respondWithFilteredResult(_0x661718,_0x4d74d0))['catch'](handleError(_0x661718,null));};exports['show']=function(_0x651c76,_0x182333){var _0x3d37e8={'raw':!![],'where':{'id':_0x651c76[_0x0e82('0x46')]['id']}},_0x199495={};_0x199495[_0x0e82('0x33')]=_[_0x0e82('0x31')](db[_0x0e82('0x42')]['rawAttributes']);_0x199495['query']=_[_0x0e82('0x31')](_0x651c76[_0x0e82('0x30')]);_0x199495[_0x0e82('0x32')]=_[_0x0e82('0x35')](_0x199495[_0x0e82('0x33')],_0x199495[_0x0e82('0x30')]);_0x3d37e8[_0x0e82('0x34')]=_[_0x0e82('0x35')](_0x199495['model'],qs[_0x0e82('0x36')](_0x651c76['query'][_0x0e82('0x36')]));_0x3d37e8['attributes']=_0x3d37e8[_0x0e82('0x34')]['length']?_0x3d37e8[_0x0e82('0x34')]:_0x199495[_0x0e82('0x33')];if(_0x651c76[_0x0e82('0x30')]['includeAll']){_0x3d37e8['include']=[{'all':!![]}];}_0x3d37e8=_[_0x0e82('0x3d')]({},_0x3d37e8,_0x651c76[_0x0e82('0x41')]);return db[_0x0e82('0x42')]['find'](_0x3d37e8)[_0x0e82('0x25')](handleEntityNotFound(_0x182333,null))['then'](respondWithResult(_0x182333,null))[_0x0e82('0x47')](handleError(_0x182333,null));};exports[_0x0e82('0x48')]=function(_0x162890,_0x64406e){return db[_0x0e82('0x42')][_0x0e82('0x48')](_0x162890[_0x0e82('0x49')],{})[_0x0e82('0x25')](function(_0x1bd904){var _0x287abc=_0x162890[_0x0e82('0x4a')][_0x0e82('0x27')]({'plain':!![]});if(!_0x287abc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x287abc[_0x0e82('0x4b')]===_0x0e82('0x4a')){var _0x576726=_0x1bd904[_0x0e82('0x27')]({'plain':!![]});var _0x5f4fbc='ContactItemTypes';return db[_0x0e82('0x4c')]['find']({'where':{'name':_0x5f4fbc,'userProfileId':_0x287abc[_0x0e82('0x4d')]},'raw':!![]})[_0x0e82('0x25')](function(_0x1ed324){if(_0x1ed324&&_0x1ed324[_0x0e82('0x4e')]===0x0){return db[_0x0e82('0x4f')]['create']({'name':_0x576726[_0x0e82('0x2a')],'resourceId':_0x576726['id'],'type':_0x1ed324['name'],'sectionId':_0x1ed324['id']},{})[_0x0e82('0x25')](function(){return _0x1bd904;});}else{return _0x1bd904;}})[_0x0e82('0x47')](function(_0x42c4a7){logger[_0x0e82('0x50')](_0x0e82('0x51'),_0x42c4a7);throw _0x42c4a7;});}return _0x1bd904;})['then'](respondWithResult(_0x64406e,0xc9))[_0x0e82('0x47')](handleError(_0x64406e,null));};exports[_0x0e82('0x24')]=function(_0x183808,_0x4546bd){if(_0x183808[_0x0e82('0x49')]['id']){delete _0x183808['body']['id'];}return db[_0x0e82('0x42')][_0x0e82('0x52')]({'where':{'id':_0x183808[_0x0e82('0x46')]['id']}})[_0x0e82('0x25')](handleEntityNotFound(_0x4546bd,null))[_0x0e82('0x25')](saveUpdates(_0x183808[_0x0e82('0x49')],null))[_0x0e82('0x25')](respondWithResult(_0x4546bd,null))[_0x0e82('0x47')](handleError(_0x4546bd,null));};exports[_0x0e82('0x26')]=function(_0x2852d4,_0x4cc3fd){return db['ContactItemType']['find']({'where':{'id':_0x2852d4[_0x0e82('0x46')]['id']}})['then'](handleEntityNotFound(_0x4cc3fd,null))[_0x0e82('0x25')](db[_0x0e82('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x2852d4['params']['id']}}))[_0x0e82('0x25')](removeEntity(_0x4cc3fd,null))[_0x0e82('0x47')](handleError(_0x4cc3fd,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d6f42aa..fff44ce 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 _0x10dc=['./contactItemType.attributes','exports','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0xb42d97,_0x25ad2b){var _0x6bb565=function(_0x5c5e48){while(--_0x5c5e48){_0xb42d97['push'](_0xb42d97['shift']());}};_0x6bb565(++_0x25ad2b);}(_0x10dc,0x1f2));var _0xc10d=function(_0x17e315,_0x361db6){_0x17e315=_0x17e315-0x0;var _0x3e7afb=_0x10dc[_0x17e315];return _0x3e7afb;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var logger=require(_0xc10d('0x2'))(_0xc10d('0x3'));var moment=require(_0xc10d('0x4'));var BPromise=require(_0xc10d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc10d('0x6'));var rimraf=require('rimraf');var config=require(_0xc10d('0x7'));var attributes=require(_0xc10d('0x8'));module[_0xc10d('0x9')]=function(_0x41800f,_0x5caa22){return _0x41800f['define']('ContactItemType',attributes,{'tableName':_0xc10d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab82=['ContactItemType','tools_contact_item_types','lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xab82,0xf4));var _0x2ab8=function(_0x3b0575,_0xc73bc5){_0x3b0575=_0x3b0575-0x0;var _0x448f7a=_0xab82[_0x3b0575];return _0x448f7a;};'use strict';var _=require(_0x2ab8('0x0'));var util=require(_0x2ab8('0x1'));var logger=require('../../config/logger')(_0x2ab8('0x2'));var moment=require(_0x2ab8('0x3'));var BPromise=require(_0x2ab8('0x4'));var rp=require(_0x2ab8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2ab8('0x6'));var attributes=require('./contactItemType.attributes');module[_0x2ab8('0x7')]=function(_0xad8eee,_0x9c9333){return _0xad8eee[_0x2ab8('0x8')](_0x2ab8('0x9'),attributes,{'tableName':_0x2ab8('0xa'),'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 0c63da9..83e2077 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 _0xc2e9=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xc2e9,0xce));var _0x9c2e=function(_0x2db400,_0xa167c8){_0x2db400=_0x2db400-0x0;var _0x4074a6=_0xc2e9[_0x2db400];return _0x4074a6;};'use strict';var _=require(_0x9c2e('0x0'));var util=require(_0x9c2e('0x1'));var moment=require(_0x9c2e('0x2'));var BPromise=require(_0x9c2e('0x3'));var rs=require(_0x9c2e('0x4'));var fs=require('fs');var Redis=require(_0x9c2e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c2e('0x6'));var logger=require(_0x9c2e('0x7'))('rpc');var config=require(_0x9c2e('0x8'));var jayson=require(_0x9c2e('0x9'));var client=jayson[_0x9c2e('0xa')][_0x9c2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b3425,_0x4ae4d9,_0x19d0c3){return new BPromise(function(_0x1ef014,_0xc7f2c5){return client['request'](_0x3b3425,_0x19d0c3)['then'](function(_0xe4e95c){logger[_0x9c2e('0xc')](_0x9c2e('0xd'),_0x4ae4d9,_0x9c2e('0xe'));logger[_0x9c2e('0xf')](_0x9c2e('0x10'),_0x4ae4d9,_0x9c2e('0xe'),JSON[_0x9c2e('0x11')](_0xe4e95c));if(_0xe4e95c[_0x9c2e('0x12')]){if(_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x13')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x4ae4d9,_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x14')]);return _0xc7f2c5(_0xe4e95c[_0x9c2e('0x12')]['message']);}logger[_0x9c2e('0x12')](_0x9c2e('0xd'),_0x4ae4d9,_0xe4e95c[_0x9c2e('0x12')]['message']);return _0x1ef014(_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x14')]);}else{logger['info'](_0x9c2e('0xd'),_0x4ae4d9,_0x9c2e('0xe'));_0x1ef014(_0xe4e95c[_0x9c2e('0x15')][_0x9c2e('0x14')]);}})[_0x9c2e('0x16')](function(_0x9a64ca){logger[_0x9c2e('0x12')](_0x9c2e('0xd'),_0x4ae4d9,_0x9a64ca);_0xc7f2c5(_0x9a64ca);});});} \ No newline at end of file +var _0xefa1=['randomstring','ioredis','rpc','../../config/environment','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x50054f,_0x337ae8){var _0xa09e16=function(_0x5e648e){while(--_0x5e648e){_0x50054f['push'](_0x50054f['shift']());}};_0xa09e16(++_0x337ae8);}(_0xefa1,0xce));var _0x1efa=function(_0x970b64,_0x29c3a7){_0x970b64=_0x970b64-0x0;var _0x152011=_0xefa1[_0x970b64];return _0x152011;};'use strict';var _=require(_0x1efa('0x0'));var util=require(_0x1efa('0x1'));var moment=require(_0x1efa('0x2'));var BPromise=require(_0x1efa('0x3'));var rs=require(_0x1efa('0x4'));var fs=require('fs');var Redis=require(_0x1efa('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1efa('0x6'));var config=require(_0x1efa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1efa('0x8')][_0x1efa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57b62f,_0x1397f4,_0x129aa0){return new BPromise(function(_0x13acdc,_0x428874){return client['request'](_0x57b62f,_0x129aa0)[_0x1efa('0xa')](function(_0x2732bf){logger[_0x1efa('0xb')](_0x1efa('0xc'),_0x1397f4,_0x1efa('0xd'));logger[_0x1efa('0xe')](_0x1efa('0xf'),_0x1397f4,_0x1efa('0xd'),JSON[_0x1efa('0x10')](_0x2732bf));if(_0x2732bf[_0x1efa('0x11')]){if(_0x2732bf['error'][_0x1efa('0x12')]===0x1f4){logger[_0x1efa('0x11')](_0x1efa('0xc'),_0x1397f4,_0x2732bf[_0x1efa('0x11')][_0x1efa('0x13')]);return _0x428874(_0x2732bf[_0x1efa('0x11')][_0x1efa('0x13')]);}logger[_0x1efa('0x11')]('ContactItemType,\x20%s,\x20%s',_0x1397f4,_0x2732bf['error'][_0x1efa('0x13')]);return _0x13acdc(_0x2732bf[_0x1efa('0x11')][_0x1efa('0x13')]);}else{logger[_0x1efa('0xb')](_0x1efa('0xc'),_0x1397f4,'request\x20sent');_0x13acdc(_0x2732bf['result'][_0x1efa('0x13')]);}})[_0x1efa('0x14')](function(_0x592467){logger[_0x1efa('0x11')]('ContactItemType,\x20%s,\x20%s',_0x1397f4,_0x592467);_0x428874(_0x592467);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 50d8fa5..e382006 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 _0x14a1=['create','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x14cc92,_0x350557){var _0x2c1883=function(_0x5f3b11){while(--_0x5f3b11){_0x14cc92['push'](_0x14cc92['shift']());}};_0x2c1883(++_0x350557);}(_0x14a1,0x17e));var _0x114a=function(_0x336667,_0x5b0005){_0x336667=_0x336667-0x0;var _0x6fe29c=_0x14a1[_0x336667];return _0x6fe29c;};'use strict';var multer=require(_0x114a('0x0'));var util=require('util');var path=require(_0x114a('0x1'));var timeout=require(_0x114a('0x2'));var express=require('express');var router=express[_0x114a('0x3')]();var fs_extra=require(_0x114a('0x4'));var auth=require(_0x114a('0x5'));var interaction=require(_0x114a('0x6'));var config=require(_0x114a('0x7'));var controller=require('./contactItemType.controller');router[_0x114a('0x8')]('/',auth[_0x114a('0x9')](),controller[_0x114a('0xa')]);router['get'](_0x114a('0xb'),auth['isAuthenticated'](),controller[_0x114a('0xc')]);router[_0x114a('0xd')]('/',auth[_0x114a('0x9')](),controller[_0x114a('0xe')]);router['put'](_0x114a('0xb'),auth[_0x114a('0x9')](),controller[_0x114a('0xf')]);router[_0x114a('0x10')]('/:id',auth[_0x114a('0x9')](),controller['destroy']);module[_0x114a('0x11')]=router; \ No newline at end of file +var _0x9c11=['/:id','show','create','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c11,0x72));var _0x19c1=function(_0x2c3972,_0x5d7c1d){_0x2c3972=_0x2c3972-0x0;var _0x4b1f88=_0x9c11[_0x2c3972];return _0x4b1f88;};'use strict';var multer=require(_0x19c1('0x0'));var util=require('util');var path=require(_0x19c1('0x1'));var timeout=require(_0x19c1('0x2'));var express=require(_0x19c1('0x3'));var router=express[_0x19c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x19c1('0x5'));var interaction=require(_0x19c1('0x6'));var config=require(_0x19c1('0x7'));var controller=require(_0x19c1('0x8'));router['get']('/',auth[_0x19c1('0x9')](),controller[_0x19c1('0xa')]);router[_0x19c1('0xb')](_0x19c1('0xc'),auth['isAuthenticated'](),controller[_0x19c1('0xd')]);router['post']('/',auth[_0x19c1('0x9')](),controller[_0x19c1('0xe')]);router['put'](_0x19c1('0xc'),auth[_0x19c1('0x9')](),controller[_0x19c1('0xf')]);router['delete']('/:id',auth[_0x19c1('0x9')](),controller[_0x19c1('0x10')]);module[_0x19c1('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d3dc64a..98d36f6 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 _0x757a=['exports','STRING'];(function(_0x2e82c0,_0x2f0a17){var _0xeea72c=function(_0x5093d9){while(--_0x5093d9){_0x2e82c0['push'](_0x2e82c0['shift']());}};_0xeea72c(++_0x2f0a17);}(_0x757a,0xde));var _0xa757=function(_0x76fb8d,_0x29d8d6){_0x76fb8d=_0x76fb8d-0x0;var _0x4a8d84=_0x757a[_0x76fb8d];return _0x4a8d84;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x212f01,_0x13fe44){var _0x4a85ee=function(_0x2237f7){while(--_0x2237f7){_0x212f01['push'](_0x212f01['shift']());}};_0x4a85ee(++_0x13fe44);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fc75a,_0x1a125c){_0x3fc75a=_0x3fc75a-0x0;var _0x1d3083=_0xb10b[_0x3fc75a];return _0x1d3083;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 093378e..a35913b 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 _0x6dee=['fieldName','model','keys','query','filters','attributes','intersection','fields','length','sort','where','pick','merge','type','VIRTUAL','filter','options','Dashboard','includeAll','findAll','rows','catch','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','clone','include','omit','createdAt','updatedAt','role','CustomDashboards','iframe','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','total','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrChannel','web-report','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','order','hasOwnProperty','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','rawAttributes'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x6dee,0x14a));var _0xe6de=function(_0x332887,_0x4a9530){_0x332887=_0x332887-0x0;var _0x1cc068=_0x6dee[_0x332887];return _0x1cc068;};'use strict';var emlformat=require(_0xe6de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6de('0x1'));var rp=require('request-promise');var moment=require(_0xe6de('0x2'));var BPromise=require(_0xe6de('0x3'));var Mustache=require(_0xe6de('0x4'));var util=require(_0xe6de('0x5'));var path=require(_0xe6de('0x6'));var sox=require(_0xe6de('0x7'));var csv=require(_0xe6de('0x8'));var ejs=require(_0xe6de('0x9'));var fs=require('fs');var fs_extra=require(_0xe6de('0xa'));var _=require(_0xe6de('0xb'));var squel=require(_0xe6de('0xc'));var crypto=require(_0xe6de('0xd'));var jsforce=require(_0xe6de('0xe'));var deskjs=require(_0xe6de('0xf'));var toCsv=require(_0xe6de('0x8'));var querystring=require(_0xe6de('0x10'));var Papa=require('papaparse');var Redis=require(_0xe6de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe6de('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6de('0x13'));var logger=require(_0xe6de('0x14'))(_0xe6de('0x15'));var utils=require(_0xe6de('0x16'));var config=require(_0xe6de('0x17'));var licenseUtil=require(_0xe6de('0x18'));var db=require(_0xe6de('0x19'))['db'];config['redis']=_[_0xe6de('0x1a')](config[_0xe6de('0x1b')],{'host':_0xe6de('0x1c'),'port':0x18eb});var socket=require(_0xe6de('0x1d'))(new Redis(config[_0xe6de('0x1b')]));require(_0xe6de('0x1e'))['register'](socket);function respondWithStatusCode(_0x59d2a7,_0x34ceb5){_0x34ceb5=_0x34ceb5||0xcc;return function(_0x22098f){if(_0x22098f){return _0x59d2a7[_0xe6de('0x1f')](_0x34ceb5);}return _0x59d2a7[_0xe6de('0x20')](_0x34ceb5)['end']();};}function respondWithResult(_0x845ac4,_0x2aed2c){_0x2aed2c=_0x2aed2c||0xc8;return function(_0x23f1a3){if(_0x23f1a3){return _0x845ac4['status'](_0x2aed2c)['json'](_0x23f1a3);}};}function respondWithFilteredResult(_0x1c6785,_0x2d63b8){return function(_0x13b8c0){if(_0x13b8c0){var _0x5112de=typeof _0x2d63b8['offset']===_0xe6de('0x21')&&typeof _0x2d63b8[_0xe6de('0x22')]===_0xe6de('0x21');var _0x5dbbcb=_0x13b8c0[_0xe6de('0x23')];var _0x177806=_0x5112de?0x0:_0x2d63b8[_0xe6de('0x24')];var _0x2db8f3=_0x5112de?_0x13b8c0['count']:_0x2d63b8[_0xe6de('0x24')]+_0x2d63b8['limit'];var _0x41b4ca;if(_0x2db8f3>=_0x5dbbcb){_0x2db8f3=_0x5dbbcb;_0x41b4ca=0xc8;}else{_0x41b4ca=0xce;}_0x1c6785[_0xe6de('0x20')](_0x41b4ca);return _0x1c6785[_0xe6de('0x25')](_0xe6de('0x26'),_0x177806+'-'+_0x2db8f3+'/'+_0x5dbbcb)[_0xe6de('0x27')](_0x13b8c0);}return null;};}function patchUpdates(_0x189c5d){return function(_0x468a52){try{jsonpatch[_0xe6de('0x28')](_0x468a52,_0x189c5d,!![]);}catch(_0x195d70){return BPromise[_0xe6de('0x29')](_0x195d70);}return _0x468a52['save']();};}function saveUpdates(_0x188cfb,_0x1ce27e){return function(_0x3f64eb){if(_0x3f64eb){return _0x3f64eb[_0xe6de('0x2a')](_0x188cfb)[_0xe6de('0x2b')](function(_0x4e6b14){return _0x4e6b14;});}return null;};}function removeEntity(_0x35e530,_0x368089){return function(_0xef1cd6){if(_0xef1cd6){return _0xef1cd6[_0xe6de('0x2c')]()['then'](function(){var _0x4be4ae=_0xef1cd6[_0xe6de('0x2d')]({'plain':!![]});var _0x4afdd0='CustomDashboards';return db[_0xe6de('0x2e')][_0xe6de('0x2c')]({'where':{'type':_0x4afdd0,'resourceId':_0x4be4ae['id']}})[_0xe6de('0x2b')](function(){return _0xef1cd6;});})[_0xe6de('0x2b')](function(){_0x35e530[_0xe6de('0x20')](0xcc)[_0xe6de('0x2f')]();});}};}function handleEntityNotFound(_0x1bbad4,_0x114bb1){return function(_0x3c9278){if(!_0x3c9278){_0x1bbad4[_0xe6de('0x1f')](0x194);}return _0x3c9278;};}function handleError(_0x36d096,_0x3a5952){_0x3a5952=_0x3a5952||0x1f4;return function(_0x95afba){logger[_0xe6de('0x30')](_0x95afba[_0xe6de('0x31')]);if(_0x95afba[_0xe6de('0x32')]){delete _0x95afba[_0xe6de('0x32')];}_0x36d096[_0xe6de('0x20')](_0x3a5952)['send'](_0x95afba);};}exports[_0xe6de('0x33')]=function(_0x2f2588,_0x3042e7){var _0x431b1b={},_0x1ca46e={},_0x50d6fa={'count':0x0,'rows':[]};var _0x1d5a7=_[_0xe6de('0x34')](db['Dashboard'][_0xe6de('0x35')],function(_0xc666f2){return{'name':_0xc666f2[_0xe6de('0x36')],'type':_0xc666f2['type']['key']};});_0x1ca46e[_0xe6de('0x37')]=_['map'](_0x1d5a7,'name');_0x1ca46e['query']=_[_0xe6de('0x38')](_0x2f2588[_0xe6de('0x39')]);_0x1ca46e[_0xe6de('0x3a')]=_['intersection'](_0x1ca46e[_0xe6de('0x37')],_0x1ca46e[_0xe6de('0x39')]);_0x431b1b[_0xe6de('0x3b')]=_[_0xe6de('0x3c')](_0x1ca46e['model'],qs[_0xe6de('0x3d')](_0x2f2588['query'][_0xe6de('0x3d')]));_0x431b1b['attributes']=_0x431b1b['attributes'][_0xe6de('0x3e')]?_0x431b1b['attributes']:_0x1ca46e[_0xe6de('0x37')];if(!_0x2f2588[_0xe6de('0x39')]['hasOwnProperty']('nolimit')){_0x431b1b[_0xe6de('0x22')]=qs['limit'](_0x2f2588[_0xe6de('0x39')][_0xe6de('0x22')]);_0x431b1b[_0xe6de('0x24')]=qs['offset'](_0x2f2588[_0xe6de('0x39')][_0xe6de('0x24')]);}_0x431b1b['order']=qs[_0xe6de('0x3f')](_0x2f2588[_0xe6de('0x39')]['sort']);_0x431b1b[_0xe6de('0x40')]=qs['filters'](_[_0xe6de('0x41')](_0x2f2588[_0xe6de('0x39')],_0x1ca46e['filters']),_0x1d5a7);if(_0x2f2588[_0xe6de('0x39')]['filter']){_0x431b1b[_0xe6de('0x40')]=_[_0xe6de('0x42')](_0x431b1b[_0xe6de('0x40')],{'$or':_[_0xe6de('0x34')](_0x1d5a7,function(_0x4bbfb8){if(_0x4bbfb8[_0xe6de('0x43')]!==_0xe6de('0x44')){var _0x46ea38={};_0x46ea38[_0x4bbfb8['name']]={'$like':'%'+_0x2f2588[_0xe6de('0x39')][_0xe6de('0x45')]+'%'};return _0x46ea38;}})});}_0x431b1b=_['merge']({},_0x431b1b,_0x2f2588[_0xe6de('0x46')]);var _0x29dcec={'where':_0x431b1b[_0xe6de('0x40')]};return db[_0xe6de('0x47')][_0xe6de('0x23')](_0x29dcec)[_0xe6de('0x2b')](function(_0xba16c3){_0x50d6fa[_0xe6de('0x23')]=_0xba16c3;if(_0x2f2588[_0xe6de('0x39')][_0xe6de('0x48')]){_0x431b1b['include']=[{'all':!![]}];}return db[_0xe6de('0x47')][_0xe6de('0x49')](_0x431b1b);})[_0xe6de('0x2b')](function(_0x1b8135){_0x50d6fa[_0xe6de('0x4a')]=_0x1b8135;return _0x50d6fa;})[_0xe6de('0x2b')](respondWithFilteredResult(_0x3042e7,_0x431b1b))[_0xe6de('0x4b')](handleError(_0x3042e7,null));};exports['show']=function(_0x13f20e,_0x73be44){var _0x5702da={'raw':![],'where':{'id':_0x13f20e[_0xe6de('0x4c')]['id']}},_0xd4b501={};_0xd4b501[_0xe6de('0x37')]=_[_0xe6de('0x38')](db[_0xe6de('0x47')][_0xe6de('0x35')]);_0xd4b501['query']=_[_0xe6de('0x38')](_0x13f20e[_0xe6de('0x39')]);_0xd4b501[_0xe6de('0x3a')]=_[_0xe6de('0x3c')](_0xd4b501[_0xe6de('0x37')],_0xd4b501[_0xe6de('0x39')]);_0x5702da['attributes']=_[_0xe6de('0x3c')](_0xd4b501[_0xe6de('0x37')],qs['fields'](_0x13f20e[_0xe6de('0x39')][_0xe6de('0x3d')]));_0x5702da['attributes']=_0x5702da[_0xe6de('0x3b')][_0xe6de('0x3e')]?_0x5702da[_0xe6de('0x3b')]:_0xd4b501['model'];if(_0x13f20e['query'][_0xe6de('0x48')]){_0x5702da['include']=[{'all':!![]}];}_0x5702da=_[_0xe6de('0x42')]({},_0x5702da,_0x13f20e[_0xe6de('0x46')]);return db[_0xe6de('0x47')][_0xe6de('0x4d')](_0x5702da)[_0xe6de('0x2b')](handleEntityNotFound(_0x73be44,null))[_0xe6de('0x2b')](respondWithResult(_0x73be44,null))[_0xe6de('0x4b')](handleError(_0x73be44,null));};exports[_0xe6de('0x4e')]=function(_0x1ff6d6,_0x3d7c80){return db[_0xe6de('0x47')]['create'](_0x1ff6d6[_0xe6de('0x4f')],{})[_0xe6de('0x2b')](function(_0x57f521){var _0x2f23bb=_0x1ff6d6[_0xe6de('0x50')][_0xe6de('0x2d')]({'plain':!![]});if(!_0x2f23bb)throw new Error(_0xe6de('0x51'));if(_0x2f23bb['role']==='user'){var _0x393de9=_0x57f521[_0xe6de('0x2d')]({'plain':!![]});var _0x1bd0cc='CustomDashboards';return db[_0xe6de('0x52')][_0xe6de('0x4d')]({'where':{'name':_0x1bd0cc,'userProfileId':_0x2f23bb[_0xe6de('0x53')]},'raw':!![]})[_0xe6de('0x2b')](function(_0x235758){if(_0x235758&&_0x235758[_0xe6de('0x54')]===0x0){return db[_0xe6de('0x2e')]['create']({'name':_0x393de9[_0xe6de('0x32')],'resourceId':_0x393de9['id'],'type':_0x235758['name'],'sectionId':_0x235758['id']},{})[_0xe6de('0x2b')](function(){return _0x57f521;});}else{return _0x57f521;}})[_0xe6de('0x4b')](function(_0x3b4816){logger[_0xe6de('0x30')](_0xe6de('0x55'),_0x3b4816);throw _0x3b4816;});}return _0x57f521;})[_0xe6de('0x2b')](respondWithResult(_0x3d7c80,0xc9))[_0xe6de('0x4b')](handleError(_0x3d7c80,null));};exports[_0xe6de('0x56')]=function(_0x579718,_0x104427){var _0xfe5100={'where':{'id':_0x579718[_0xe6de('0x4c')]['id']}},_0x30d981={};_0x30d981['model']=_[_0xe6de('0x38')](db[_0xe6de('0x47')]['rawAttributes']);_0xfe5100[_0xe6de('0x3b')]=_[_0xe6de('0x3c')](_0x30d981[_0xe6de('0x37')],qs[_0xe6de('0x3d')](_0x579718[_0xe6de('0x39')][_0xe6de('0x3d')]));_0xfe5100['attributes']=_0xfe5100[_0xe6de('0x3b')]['length']?_0xfe5100[_0xe6de('0x3b')]:_0x30d981[_0xe6de('0x37')];if(_0x579718[_0xe6de('0x39')]['includeAll']){_0xfe5100[_0xe6de('0x57')]=[{'all':!![]}];}_0xfe5100=_[_0xe6de('0x42')]({},_0xfe5100,_0x579718[_0xe6de('0x46')]);return db['Dashboard'][_0xe6de('0x4d')](_0xfe5100)[_0xe6de('0x2b')](handleEntityNotFound(_0x104427,null))[_0xe6de('0x2b')](function(_0x5f2a08){if(_0x5f2a08){var _0x1d54e8=_0x5f2a08[_0xe6de('0x2d')]({'plain':!![]});_0x1d54e8=qs[_0xe6de('0x58')](_0x1d54e8,['id',_0xe6de('0x59'),_0xe6de('0x5a')]);_0x579718[_0xe6de('0x4f')]=_[_0xe6de('0x58')](_0x579718[_0xe6de('0x4f')],['id',_0xe6de('0x59'),_0xe6de('0x5a')]);return db['Dashboard']['create'](_[_0xe6de('0x42')](_0x1d54e8,_0x579718[_0xe6de('0x4f')]),{'include':_0x579718['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x212836){var _0x437104=_0x579718[_0xe6de('0x50')][_0xe6de('0x2d')]({'plain':!![]});if(!_0x437104)throw new Error(_0xe6de('0x51'));if(_0x437104[_0xe6de('0x5b')]===_0xe6de('0x50')){var _0x58698d=_0x212836[_0xe6de('0x2d')]({'plain':!![]});var _0xa6b8a3=_0xe6de('0x5c');return db[_0xe6de('0x52')]['find']({'where':{'name':_0xa6b8a3,'userProfileId':_0x437104['userProfileId']},'raw':!![]})[_0xe6de('0x2b')](function(_0x28a932){if(_0x28a932&&_0x28a932[_0xe6de('0x54')]===0x0){return db[_0xe6de('0x2e')][_0xe6de('0x4e')]({'name':_0x58698d[_0xe6de('0x32')],'resourceId':_0x58698d['id'],'type':_0x28a932[_0xe6de('0x32')],'sectionId':_0x28a932['id']},{})['then'](function(){return _0x212836;});}else{return _0x212836;}})[_0xe6de('0x4b')](function(_0x58eed3){logger[_0xe6de('0x30')](_0xe6de('0x55'),_0x58eed3);throw _0x58eed3;});}return _0x212836;});}})['then'](respondWithResult(_0x104427,0xc9))['catch'](handleError(_0x104427,null));};exports[_0xe6de('0x2a')]=function(_0x3b28db,_0x145476){if(_0x3b28db['body']['id']){delete _0x3b28db['body']['id'];}return db[_0xe6de('0x47')][_0xe6de('0x4d')]({'where':{'id':_0x3b28db['params']['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x145476,null))[_0xe6de('0x2b')](saveUpdates(_0x3b28db['body'],null))[_0xe6de('0x2b')](respondWithResult(_0x145476,null))['catch'](handleError(_0x145476,null));};exports['destroy']=function(_0x1dfca9,_0x12c7cd){return db['Dashboard'][_0xe6de('0x4d')]({'where':{'id':_0x1dfca9[_0xe6de('0x4c')]['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x12c7cd,null))[_0xe6de('0x2b')](removeEntity(_0x12c7cd,null))[_0xe6de('0x4b')](handleError(_0x12c7cd,null));};function widgetAttributes(_0x4ebdfe){try{switch(_0x4ebdfe[_0xe6de('0x43')]){case _0xe6de('0x5d'):return[{'name':'attrUrl','value':_0x4ebdfe['attrUrl']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe['attrs'][0x0][_0xe6de('0x5f')]:undefined)||_0xe6de('0x60')}];case'custom':return[{'name':_0xe6de('0x61'),'value':_0x4ebdfe[_0xe6de('0x61')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0x0]?_0x4ebdfe['attrs'][0x0][_0xe6de('0x5f')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4ebdfe[_0xe6de('0x62')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe['attrs'][0x0][_0xe6de('0x5f')]:undefined)||_0xe6de('0x63')},{'name':'attrTimezone','value':_0x4ebdfe['attrTimezone']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe['attrs'][0x1][_0xe6de('0x5f')]:undefined)||'0.00'},{'name':_0xe6de('0x64'),'value':_0x4ebdfe[_0xe6de('0x64')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x2]?_0x4ebdfe[_0xe6de('0x5e')][0x2]['value']:undefined)||0xc}];case _0xe6de('0x65'):return[{'name':'attrMetric','value':_0x4ebdfe[_0xe6de('0x66')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0]['value']:undefined)||_0xe6de('0x67')},{'name':'attrVoiceQueues','value':_0x4ebdfe['attrVoiceQueues']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe[_0xe6de('0x5e')][0x1][_0xe6de('0x5f')]:undefined)||[]},{'name':_0xe6de('0x64'),'value':_0x4ebdfe[_0xe6de('0x64')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0x2]?_0x4ebdfe[_0xe6de('0x5e')][0x2][_0xe6de('0x5f')]:undefined)||0x14},{'name':'attrChannel','value':_0x4ebdfe['attrChannel']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x3]?_0x4ebdfe[_0xe6de('0x5e')][0x3][_0xe6de('0x5f')]:undefined)||_0xe6de('0x68')},{'name':_0xe6de('0x69'),'value':_0x4ebdfe['attrEmailAccounts']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x4]?_0x4ebdfe[_0xe6de('0x5e')][0x4][_0xe6de('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4ebdfe[_0xe6de('0x6a')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x5]?_0x4ebdfe[_0xe6de('0x5e')][0x5]['value']:undefined)||''},{'name':_0xe6de('0x6b'),'value':_0x4ebdfe['attrSmsAccounts']||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x6]?_0x4ebdfe['attrs'][0x6][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6c'),'value':_0x4ebdfe[_0xe6de('0x6c')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x7]?_0x4ebdfe['attrs'][0x7][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6d'),'value':_0x4ebdfe[_0xe6de('0x6d')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x8]?_0x4ebdfe[_0xe6de('0x5e')][0x8][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6e'),'value':_0x4ebdfe[_0xe6de('0x6e')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x9]?_0x4ebdfe[_0xe6de('0x5e')][0x9][_0xe6de('0x5f')]:undefined)||''}];case _0xe6de('0x6f'):case _0xe6de('0x70'):return[{'name':_0xe6de('0x71'),'value':_0x4ebdfe[_0xe6de('0x71')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0][_0xe6de('0x5f')]:undefined)||_0xe6de('0x67')},{'name':_0xe6de('0x72'),'value':_0x4ebdfe[_0xe6de('0x72')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe[_0xe6de('0x5e')][0x1][_0xe6de('0x5f')]:undefined)||null},{'name':_0xe6de('0x73'),'value':_0x4ebdfe[_0xe6de('0x73')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x2]?_0x4ebdfe[_0xe6de('0x5e')][0x2][_0xe6de('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4ebdfe[_0xe6de('0x74')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0x3]?_0x4ebdfe[_0xe6de('0x5e')][0x3][_0xe6de('0x5f')]:undefined)||[]},{'name':_0xe6de('0x75'),'value':_0x4ebdfe[_0xe6de('0x75')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x4]?_0x4ebdfe[_0xe6de('0x5e')][0x4][_0xe6de('0x5f')]:undefined)||_0xe6de('0x68')},{'name':_0xe6de('0x69'),'value':_0x4ebdfe[_0xe6de('0x69')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x5]?_0x4ebdfe[_0xe6de('0x5e')][0x5][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6a'),'value':_0x4ebdfe['attrFaxAccounts']||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x6]?_0x4ebdfe[_0xe6de('0x5e')][0x6][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6b'),'value':_0x4ebdfe[_0xe6de('0x6b')]||(_0x4ebdfe['attrs']&&_0x4ebdfe[_0xe6de('0x5e')][0x7]?_0x4ebdfe[_0xe6de('0x5e')][0x7][_0xe6de('0x5f')]:undefined)||''},{'name':_0xe6de('0x6c'),'value':_0x4ebdfe[_0xe6de('0x6c')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x8]?_0x4ebdfe[_0xe6de('0x5e')][0x8]['value']:undefined)||''},{'name':_0xe6de('0x6d'),'value':_0x4ebdfe[_0xe6de('0x6d')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x9]?_0x4ebdfe['attrs'][0x9]['value']:undefined)||''},{'name':_0xe6de('0x6e'),'value':_0x4ebdfe[_0xe6de('0x6e')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe['attrs'][0xa]?_0x4ebdfe[_0xe6de('0x5e')][0xa][_0xe6de('0x5f')]:undefined)||''}];case _0xe6de('0x76'):return[{'name':_0xe6de('0x77'),'type':_0x4ebdfe['reportType']||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0]['type']:undefined)||null,'value':_0x4ebdfe[_0xe6de('0x77')]||(_0x4ebdfe['attrs']&&_0x4ebdfe['attrs'][0x0]?_0x4ebdfe[_0xe6de('0x5e')][0x0]['value']:undefined)||null},{'name':_0xe6de('0x78'),'value':_0x4ebdfe[_0xe6de('0x78')]||(_0x4ebdfe[_0xe6de('0x5e')]&&_0x4ebdfe[_0xe6de('0x5e')][0x1]?_0x4ebdfe[_0xe6de('0x5e')][0x1][_0xe6de('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x2a19a6){logger[_0xe6de('0x30')]('widgetAttributes:\x20%s',JSON[_0xe6de('0x79')](_0x2a19a6));return[];}}exports['addItem']=function(_0x2d26da,_0x14b210,_0x42fcf7){if(_0x2d26da[_0xe6de('0x4f')]['id']){delete _0x2d26da['body']['id'];}return db['Dashboard'][_0xe6de('0x4d')]({'where':{'id':_0x2d26da['params']['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x14b210,null))[_0xe6de('0x2b')](function(_0x56ba17){if(_0x56ba17){_0x2d26da[_0xe6de('0x4f')][_0xe6de('0x7a')]=_0x56ba17['id'];_0x2d26da['body'][_0xe6de('0x5e')]=widgetAttributes(_0x2d26da['body']);return db[_0xe6de('0x7b')][_0xe6de('0x4e')](_0x2d26da[_0xe6de('0x4f')]);}})[_0xe6de('0x2b')](respondWithResult(_0x14b210,null))[_0xe6de('0x4b')](handleError(_0x14b210,null));};exports[_0xe6de('0x7c')]=function(_0x5d2a0b,_0x5edd41,_0x28a5d0){var _0x2d254b={};var _0x335b01={};var _0x42de9c;var _0x51f14c;return db[_0xe6de('0x47')][_0xe6de('0x7d')]({'where':{'id':_0x5d2a0b[_0xe6de('0x4c')]['id']}})[_0xe6de('0x2b')](handleEntityNotFound(_0x5edd41,null))[_0xe6de('0x2b')](function(_0x23124b){if(_0x23124b){_0x42de9c=_0x23124b;_0x335b01[_0xe6de('0x37')]=_['keys'](db[_0xe6de('0x7b')][_0xe6de('0x35')]);_0x335b01[_0xe6de('0x39')]=_['keys'](_0x5d2a0b[_0xe6de('0x39')]);_0x335b01['filters']=_[_0xe6de('0x3c')](_0x335b01[_0xe6de('0x37')],_0x335b01[_0xe6de('0x39')]);_0x2d254b[_0xe6de('0x3b')]=_[_0xe6de('0x3c')](_0x335b01[_0xe6de('0x37')],qs[_0xe6de('0x3d')](_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x3d')]));_0x2d254b[_0xe6de('0x3b')]=_0x2d254b['attributes'][_0xe6de('0x3e')]?_0x2d254b['attributes']:_0x335b01[_0xe6de('0x37')];_0x2d254b[_0xe6de('0x7e')]=qs[_0xe6de('0x3f')](_0x5d2a0b['query']['sort']);_0x2d254b[_0xe6de('0x40')]=qs[_0xe6de('0x3a')](_[_0xe6de('0x41')](_0x5d2a0b['query'],_0x335b01[_0xe6de('0x3a')]));if(_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x45')]){_0x2d254b[_0xe6de('0x40')]=_[_0xe6de('0x42')](_0x2d254b[_0xe6de('0x40')],{'$or':_[_0xe6de('0x34')](_0x2d254b[_0xe6de('0x3b')],function(_0x4cb89a){var _0x55ab86={};_0x55ab86[_0x4cb89a]={'$like':'%'+_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x45')]+'%'};return _0x55ab86;})});}_0x2d254b=_[_0xe6de('0x42')]({},_0x2d254b,_0x5d2a0b[_0xe6de('0x46')]);return _0x42de9c['getItems'](_0x2d254b);}})[_0xe6de('0x2b')](function(_0x1caedc){if(_0x1caedc){_0x51f14c=_0x1caedc[_0xe6de('0x3e')];if(!_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x7f')]('nolimit')){_0x2d254b[_0xe6de('0x22')]=qs[_0xe6de('0x22')](_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x22')]);_0x2d254b[_0xe6de('0x24')]=qs[_0xe6de('0x24')](_0x5d2a0b[_0xe6de('0x39')][_0xe6de('0x24')]);}return _0x42de9c[_0xe6de('0x7c')](_0x2d254b);}})['then'](function(_0x59cc2d){if(_0x59cc2d){return _0x59cc2d?{'count':_0x51f14c,'rows':_0x59cc2d}:null;}})[_0xe6de('0x2b')](respondWithResult(_0x5edd41,null))['catch'](handleError(_0x5edd41,null));}; \ No newline at end of file +var _0x7db0=['getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','sendStatus','stack','name','send','index','map','Dashboard','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','error','update','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie2','attrSerie3','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem'];(function(_0x1fe843,_0x146418){var _0x3211a4=function(_0x531676){while(--_0x531676){_0x1fe843['push'](_0x1fe843['shift']());}};_0x3211a4(++_0x146418);}(_0x7db0,0x10e));var _0x07db=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0x7db0[_0x115621];return _0x5ef5ce;};'use strict';var emlformat=require(_0x07db('0x0'));var rimraf=require(_0x07db('0x1'));var zipdir=require(_0x07db('0x2'));var jsonpatch=require(_0x07db('0x3'));var rp=require(_0x07db('0x4'));var moment=require(_0x07db('0x5'));var BPromise=require(_0x07db('0x6'));var Mustache=require(_0x07db('0x7'));var util=require(_0x07db('0x8'));var path=require(_0x07db('0x9'));var sox=require(_0x07db('0xa'));var csv=require(_0x07db('0xb'));var ejs=require(_0x07db('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x07db('0xd'));var crypto=require(_0x07db('0xe'));var jsforce=require(_0x07db('0xf'));var deskjs=require(_0x07db('0x10'));var toCsv=require('to-csv');var querystring=require(_0x07db('0x11'));var Papa=require('papaparse');var Redis=require(_0x07db('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x07db('0x13'));var as=require(_0x07db('0x14'));var hardwareService=require(_0x07db('0x15'));var logger=require(_0x07db('0x16'))(_0x07db('0x17'));var utils=require(_0x07db('0x18'));var config=require(_0x07db('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x07db('0x1a'))['db'];config[_0x07db('0x1b')]=_['defaults'](config['redis'],{'host':_0x07db('0x1c'),'port':0x18eb});var socket=require(_0x07db('0x1d'))(new Redis(config[_0x07db('0x1b')]));require(_0x07db('0x1e'))[_0x07db('0x1f')](socket);function respondWithStatusCode(_0x20070a,_0x18b4e7){_0x18b4e7=_0x18b4e7||0xcc;return function(_0x408fb1){if(_0x408fb1){return _0x20070a['sendStatus'](_0x18b4e7);}return _0x20070a[_0x07db('0x20')](_0x18b4e7)[_0x07db('0x21')]();};}function respondWithResult(_0xa03f20,_0x3639d9){_0x3639d9=_0x3639d9||0xc8;return function(_0x4f118c){if(_0x4f118c){return _0xa03f20[_0x07db('0x20')](_0x3639d9)[_0x07db('0x22')](_0x4f118c);}};}function respondWithFilteredResult(_0x427ddb,_0x314d41){return function(_0x32b1b8){if(_0x32b1b8){var _0xb2e757=typeof _0x314d41[_0x07db('0x23')]==='undefined'&&typeof _0x314d41[_0x07db('0x24')]==='undefined';var _0x3fcf61=_0x32b1b8['count'];var _0x574d06=_0xb2e757?0x0:_0x314d41[_0x07db('0x23')];var _0x1a74cf=_0xb2e757?_0x32b1b8[_0x07db('0x25')]:_0x314d41[_0x07db('0x23')]+_0x314d41['limit'];var _0xa6a15b;if(_0x1a74cf>=_0x3fcf61){_0x1a74cf=_0x3fcf61;_0xa6a15b=0xc8;}else{_0xa6a15b=0xce;}_0x427ddb[_0x07db('0x20')](_0xa6a15b);return _0x427ddb[_0x07db('0x26')](_0x07db('0x27'),_0x574d06+'-'+_0x1a74cf+'/'+_0x3fcf61)[_0x07db('0x22')](_0x32b1b8);}return null;};}function patchUpdates(_0x92160d){return function(_0x1532ec){try{jsonpatch[_0x07db('0x28')](_0x1532ec,_0x92160d,!![]);}catch(_0x4d4623){return BPromise[_0x07db('0x29')](_0x4d4623);}return _0x1532ec[_0x07db('0x2a')]();};}function saveUpdates(_0x51cd87,_0x38f7ff){return function(_0x2e5bdf){if(_0x2e5bdf){return _0x2e5bdf['update'](_0x51cd87)[_0x07db('0x2b')](function(_0x1fde98){return _0x1fde98;});}return null;};}function removeEntity(_0x57fcca,_0x2c3a37){return function(_0x1823d0){if(_0x1823d0){return _0x1823d0[_0x07db('0x2c')]()['then'](function(){var _0x5d3797=_0x1823d0[_0x07db('0x2d')]({'plain':!![]});var _0x1f0596=_0x07db('0x2e');return db['UserProfileResource'][_0x07db('0x2c')]({'where':{'type':_0x1f0596,'resourceId':_0x5d3797['id']}})['then'](function(){return _0x1823d0;});})[_0x07db('0x2b')](function(){_0x57fcca[_0x07db('0x20')](0xcc)[_0x07db('0x21')]();});}};}function handleEntityNotFound(_0x5ce9b7,_0x3f538f){return function(_0x2344f4){if(!_0x2344f4){_0x5ce9b7[_0x07db('0x2f')](0x194);}return _0x2344f4;};}function handleError(_0x22c83e,_0x4b6428){_0x4b6428=_0x4b6428||0x1f4;return function(_0x1f47df){logger['error'](_0x1f47df[_0x07db('0x30')]);if(_0x1f47df[_0x07db('0x31')]){delete _0x1f47df['name'];}_0x22c83e['status'](_0x4b6428)[_0x07db('0x32')](_0x1f47df);};}exports[_0x07db('0x33')]=function(_0x4bb5b0,_0x1215c1){var _0x2184cb={},_0x2e7582={},_0x3a494e={'count':0x0,'rows':[]};var _0x5aa85d=_[_0x07db('0x34')](db[_0x07db('0x35')]['rawAttributes'],function(_0x3b3ce1){return{'name':_0x3b3ce1[_0x07db('0x36')],'type':_0x3b3ce1[_0x07db('0x37')][_0x07db('0x38')]};});_0x2e7582[_0x07db('0x39')]=_['map'](_0x5aa85d,_0x07db('0x31'));_0x2e7582['query']=_[_0x07db('0x3a')](_0x4bb5b0[_0x07db('0x3b')]);_0x2e7582['filters']=_[_0x07db('0x3c')](_0x2e7582[_0x07db('0x39')],_0x2e7582[_0x07db('0x3b')]);_0x2184cb[_0x07db('0x3d')]=_[_0x07db('0x3c')](_0x2e7582['model'],qs[_0x07db('0x3e')](_0x4bb5b0[_0x07db('0x3b')][_0x07db('0x3e')]));_0x2184cb[_0x07db('0x3d')]=_0x2184cb[_0x07db('0x3d')]['length']?_0x2184cb[_0x07db('0x3d')]:_0x2e7582[_0x07db('0x39')];if(!_0x4bb5b0[_0x07db('0x3b')][_0x07db('0x3f')](_0x07db('0x40'))){_0x2184cb['limit']=qs['limit'](_0x4bb5b0[_0x07db('0x3b')][_0x07db('0x24')]);_0x2184cb[_0x07db('0x23')]=qs[_0x07db('0x23')](_0x4bb5b0['query'][_0x07db('0x23')]);}_0x2184cb[_0x07db('0x41')]=qs['sort'](_0x4bb5b0['query'][_0x07db('0x42')]);_0x2184cb[_0x07db('0x43')]=qs[_0x07db('0x44')](_[_0x07db('0x45')](_0x4bb5b0[_0x07db('0x3b')],_0x2e7582[_0x07db('0x44')]),_0x5aa85d);if(_0x4bb5b0[_0x07db('0x3b')][_0x07db('0x46')]){_0x2184cb['where']=_['merge'](_0x2184cb['where'],{'$or':_[_0x07db('0x34')](_0x5aa85d,function(_0x27115a){if(_0x27115a[_0x07db('0x37')]!==_0x07db('0x47')){var _0x35b2dd={};_0x35b2dd[_0x27115a[_0x07db('0x31')]]={'$like':'%'+_0x4bb5b0['query'][_0x07db('0x46')]+'%'};return _0x35b2dd;}})});}_0x2184cb=_['merge']({},_0x2184cb,_0x4bb5b0[_0x07db('0x48')]);var _0x5a7dda={'where':_0x2184cb['where']};return db[_0x07db('0x35')][_0x07db('0x25')](_0x5a7dda)[_0x07db('0x2b')](function(_0x6ccfc0){_0x3a494e[_0x07db('0x25')]=_0x6ccfc0;if(_0x4bb5b0['query'][_0x07db('0x49')]){_0x2184cb[_0x07db('0x4a')]=[{'all':!![]}];}return db[_0x07db('0x35')][_0x07db('0x4b')](_0x2184cb);})['then'](function(_0x1fae86){_0x3a494e[_0x07db('0x4c')]=_0x1fae86;return _0x3a494e;})[_0x07db('0x2b')](respondWithFilteredResult(_0x1215c1,_0x2184cb))[_0x07db('0x4d')](handleError(_0x1215c1,null));};exports[_0x07db('0x4e')]=function(_0x5a5b31,_0x2f5dbf){var _0x4ce218={'raw':![],'where':{'id':_0x5a5b31[_0x07db('0x4f')]['id']}},_0x458a1d={};_0x458a1d['model']=_[_0x07db('0x3a')](db[_0x07db('0x35')][_0x07db('0x50')]);_0x458a1d['query']=_['keys'](_0x5a5b31['query']);_0x458a1d[_0x07db('0x44')]=_[_0x07db('0x3c')](_0x458a1d['model'],_0x458a1d[_0x07db('0x3b')]);_0x4ce218[_0x07db('0x3d')]=_[_0x07db('0x3c')](_0x458a1d['model'],qs[_0x07db('0x3e')](_0x5a5b31[_0x07db('0x3b')][_0x07db('0x3e')]));_0x4ce218[_0x07db('0x3d')]=_0x4ce218[_0x07db('0x3d')][_0x07db('0x51')]?_0x4ce218[_0x07db('0x3d')]:_0x458a1d[_0x07db('0x39')];if(_0x5a5b31[_0x07db('0x3b')][_0x07db('0x49')]){_0x4ce218[_0x07db('0x4a')]=[{'all':!![]}];}_0x4ce218=_[_0x07db('0x52')]({},_0x4ce218,_0x5a5b31['options']);return db['Dashboard'][_0x07db('0x53')](_0x4ce218)[_0x07db('0x2b')](handleEntityNotFound(_0x2f5dbf,null))[_0x07db('0x2b')](respondWithResult(_0x2f5dbf,null))[_0x07db('0x4d')](handleError(_0x2f5dbf,null));};exports[_0x07db('0x54')]=function(_0x41b4ab,_0x273b7b){return db[_0x07db('0x35')][_0x07db('0x54')](_0x41b4ab[_0x07db('0x55')],{})[_0x07db('0x2b')](function(_0x37c995){var _0x493a6a=_0x41b4ab[_0x07db('0x56')][_0x07db('0x2d')]({'plain':!![]});if(!_0x493a6a)throw new Error(_0x07db('0x57'));if(_0x493a6a[_0x07db('0x58')]===_0x07db('0x56')){var _0x5250fe=_0x37c995[_0x07db('0x2d')]({'plain':!![]});var _0x5d908f=_0x07db('0x2e');return db[_0x07db('0x59')][_0x07db('0x53')]({'where':{'name':_0x5d908f,'userProfileId':_0x493a6a[_0x07db('0x5a')]},'raw':!![]})['then'](function(_0x5e0589){if(_0x5e0589&&_0x5e0589[_0x07db('0x5b')]===0x0){return db[_0x07db('0x5c')]['create']({'name':_0x5250fe[_0x07db('0x31')],'resourceId':_0x5250fe['id'],'type':_0x5e0589['name'],'sectionId':_0x5e0589['id']},{})[_0x07db('0x2b')](function(){return _0x37c995;});}else{return _0x37c995;}})[_0x07db('0x4d')](function(_0x417f67){logger['error'](_0x07db('0x5d'),_0x417f67);throw _0x417f67;});}return _0x37c995;})[_0x07db('0x2b')](respondWithResult(_0x273b7b,0xc9))[_0x07db('0x4d')](handleError(_0x273b7b,null));};exports[_0x07db('0x5e')]=function(_0x13d35,_0x20ffc6){var _0x1d3b67={'where':{'id':_0x13d35['params']['id']}},_0x4e86b3={};_0x4e86b3[_0x07db('0x39')]=_[_0x07db('0x3a')](db[_0x07db('0x35')][_0x07db('0x50')]);_0x1d3b67[_0x07db('0x3d')]=_['intersection'](_0x4e86b3[_0x07db('0x39')],qs[_0x07db('0x3e')](_0x13d35['query'][_0x07db('0x3e')]));_0x1d3b67[_0x07db('0x3d')]=_0x1d3b67[_0x07db('0x3d')][_0x07db('0x51')]?_0x1d3b67[_0x07db('0x3d')]:_0x4e86b3['model'];if(_0x13d35[_0x07db('0x3b')][_0x07db('0x49')]){_0x1d3b67[_0x07db('0x4a')]=[{'all':!![]}];}_0x1d3b67=_['merge']({},_0x1d3b67,_0x13d35[_0x07db('0x48')]);return db[_0x07db('0x35')][_0x07db('0x53')](_0x1d3b67)[_0x07db('0x2b')](handleEntityNotFound(_0x20ffc6,null))[_0x07db('0x2b')](function(_0x2141f5){if(_0x2141f5){var _0x4547e8=_0x2141f5[_0x07db('0x2d')]({'plain':!![]});_0x4547e8=qs[_0x07db('0x5f')](_0x4547e8,['id','createdAt','updatedAt']);_0x13d35[_0x07db('0x55')]=_['omit'](_0x13d35[_0x07db('0x55')],['id',_0x07db('0x60'),_0x07db('0x61')]);return db[_0x07db('0x35')][_0x07db('0x54')](_[_0x07db('0x52')](_0x4547e8,_0x13d35[_0x07db('0x55')]),{'include':_0x13d35[_0x07db('0x3b')][_0x07db('0x49')]?[{'all':!![]}]:undefined})[_0x07db('0x2b')](function(_0x3d7053){var _0x1e6418=_0x13d35[_0x07db('0x56')]['get']({'plain':!![]});if(!_0x1e6418)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e6418[_0x07db('0x58')]===_0x07db('0x56')){var _0x577e47=_0x3d7053[_0x07db('0x2d')]({'plain':!![]});var _0x2684a6=_0x07db('0x2e');return db['UserProfileSection'][_0x07db('0x53')]({'where':{'name':_0x2684a6,'userProfileId':_0x1e6418['userProfileId']},'raw':!![]})[_0x07db('0x2b')](function(_0x24f4a3){if(_0x24f4a3&&_0x24f4a3[_0x07db('0x5b')]===0x0){return db[_0x07db('0x5c')][_0x07db('0x54')]({'name':_0x577e47[_0x07db('0x31')],'resourceId':_0x577e47['id'],'type':_0x24f4a3[_0x07db('0x31')],'sectionId':_0x24f4a3['id']},{})[_0x07db('0x2b')](function(){return _0x3d7053;});}else{return _0x3d7053;}})[_0x07db('0x4d')](function(_0x4e4d9c){logger[_0x07db('0x62')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e4d9c);throw _0x4e4d9c;});}return _0x3d7053;});}})['then'](respondWithResult(_0x20ffc6,0xc9))[_0x07db('0x4d')](handleError(_0x20ffc6,null));};exports[_0x07db('0x63')]=function(_0x21b30a,_0x4bb060){if(_0x21b30a[_0x07db('0x55')]['id']){delete _0x21b30a[_0x07db('0x55')]['id'];}return db[_0x07db('0x35')][_0x07db('0x53')]({'where':{'id':_0x21b30a['params']['id']}})['then'](handleEntityNotFound(_0x4bb060,null))['then'](saveUpdates(_0x21b30a[_0x07db('0x55')],null))[_0x07db('0x2b')](respondWithResult(_0x4bb060,null))['catch'](handleError(_0x4bb060,null));};exports['destroy']=function(_0x1b3c1e,_0x1beaf8){return db[_0x07db('0x35')][_0x07db('0x53')]({'where':{'id':_0x1b3c1e[_0x07db('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1beaf8,null))[_0x07db('0x2b')](removeEntity(_0x1beaf8,null))[_0x07db('0x4d')](handleError(_0x1beaf8,null));};function widgetAttributes(_0x58a168){try{switch(_0x58a168[_0x07db('0x37')]){case _0x07db('0x64'):return[{'name':_0x07db('0x65'),'value':_0x58a168['attrUrl']||(_0x58a168[_0x07db('0x66')]&&_0x58a168['attrs'][0x0]?_0x58a168[_0x07db('0x66')][0x0][_0x07db('0x67')]:undefined)||'https://'}];case _0x07db('0x68'):return[{'name':_0x07db('0x69'),'value':_0x58a168[_0x07db('0x69')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x0]?_0x58a168[_0x07db('0x66')][0x0][_0x07db('0x67')]:undefined)||''}];case _0x07db('0x6a'):return[{'name':'attrHourFormat','value':_0x58a168['attrHourFormat']||(_0x58a168['attrs']&&_0x58a168[_0x07db('0x66')][0x0]?_0x58a168[_0x07db('0x66')][0x0][_0x07db('0x67')]:undefined)||'HH:mm:ss'},{'name':_0x07db('0x6b'),'value':_0x58a168['attrTimezone']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x1]?_0x58a168['attrs'][0x1][_0x07db('0x67')]:undefined)||_0x07db('0x6c')},{'name':'attrFontSize','value':_0x58a168['attrFontSize']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x2]?_0x58a168[_0x07db('0x66')][0x2][_0x07db('0x67')]:undefined)||0xc}];case _0x07db('0x6d'):return[{'name':'attrMetric','value':_0x58a168[_0x07db('0x6e')]||(_0x58a168['attrs']&&_0x58a168[_0x07db('0x66')][0x0]?_0x58a168[_0x07db('0x66')][0x0][_0x07db('0x67')]:undefined)||_0x07db('0x6f')},{'name':'attrVoiceQueues','value':_0x58a168[_0x07db('0x70')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x1]?_0x58a168['attrs'][0x1][_0x07db('0x67')]:undefined)||[]},{'name':_0x07db('0x71'),'value':_0x58a168[_0x07db('0x71')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168['attrs'][0x2]?_0x58a168['attrs'][0x2][_0x07db('0x67')]:undefined)||0x14},{'name':'attrChannel','value':_0x58a168[_0x07db('0x72')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x3]?_0x58a168[_0x07db('0x66')][0x3][_0x07db('0x67')]:undefined)||_0x07db('0x73')},{'name':'attrEmailAccounts','value':_0x58a168['attrEmailAccounts']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x4]?_0x58a168[_0x07db('0x66')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x58a168['attrFaxAccounts']||(_0x58a168['attrs']&&_0x58a168['attrs'][0x5]?_0x58a168[_0x07db('0x66')][0x5][_0x07db('0x67')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x58a168['attrSmsAccounts']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x6]?_0x58a168[_0x07db('0x66')][0x6][_0x07db('0x67')]:undefined)||''},{'name':_0x07db('0x74'),'value':_0x58a168['attrOpenchannelAccounts']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x7]?_0x58a168[_0x07db('0x66')][0x7]['value']:undefined)||''},{'name':_0x07db('0x75'),'value':_0x58a168[_0x07db('0x75')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168['attrs'][0x8]?_0x58a168['attrs'][0x8][_0x07db('0x67')]:undefined)||''},{'name':_0x07db('0x76'),'value':_0x58a168['attrChatWebsites']||(_0x58a168[_0x07db('0x66')]&&_0x58a168['attrs'][0x9]?_0x58a168[_0x07db('0x66')][0x9][_0x07db('0x67')]:undefined)||''}];case _0x07db('0x77'):case'pie-chart':return[{'name':'attrSerie1','value':_0x58a168['attrSerie1']||(_0x58a168['attrs']&&_0x58a168['attrs'][0x0]?_0x58a168[_0x07db('0x66')][0x0]['value']:undefined)||_0x07db('0x6f')},{'name':_0x07db('0x78'),'value':_0x58a168[_0x07db('0x78')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168['attrs'][0x1]?_0x58a168[_0x07db('0x66')][0x1][_0x07db('0x67')]:undefined)||null},{'name':_0x07db('0x79'),'value':_0x58a168[_0x07db('0x79')]||(_0x58a168['attrs']&&_0x58a168[_0x07db('0x66')][0x2]?_0x58a168[_0x07db('0x66')][0x2]['value']:undefined)||null},{'name':_0x07db('0x70'),'value':_0x58a168[_0x07db('0x70')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x3]?_0x58a168[_0x07db('0x66')][0x3][_0x07db('0x67')]:undefined)||[]},{'name':_0x07db('0x72'),'value':_0x58a168[_0x07db('0x72')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x4]?_0x58a168[_0x07db('0x66')][0x4]['value']:undefined)||_0x07db('0x73')},{'name':_0x07db('0x7a'),'value':_0x58a168[_0x07db('0x7a')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168['attrs'][0x5]?_0x58a168[_0x07db('0x66')][0x5][_0x07db('0x67')]:undefined)||''},{'name':_0x07db('0x7b'),'value':_0x58a168['attrFaxAccounts']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x6]?_0x58a168[_0x07db('0x66')][0x6][_0x07db('0x67')]:undefined)||''},{'name':_0x07db('0x7c'),'value':_0x58a168[_0x07db('0x7c')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168['attrs'][0x7]?_0x58a168[_0x07db('0x66')][0x7][_0x07db('0x67')]:undefined)||''},{'name':_0x07db('0x74'),'value':_0x58a168[_0x07db('0x74')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x8]?_0x58a168[_0x07db('0x66')][0x8][_0x07db('0x67')]:undefined)||''},{'name':_0x07db('0x75'),'value':_0x58a168[_0x07db('0x75')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x9]?_0x58a168[_0x07db('0x66')][0x9]['value']:undefined)||''},{'name':_0x07db('0x76'),'value':_0x58a168['attrChatWebsites']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0xa]?_0x58a168['attrs'][0xa]['value']:undefined)||''}];case _0x07db('0x7d'):return[{'name':_0x07db('0x7e'),'type':_0x58a168[_0x07db('0x7f')]||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x0]?_0x58a168['attrs'][0x0][_0x07db('0x37')]:undefined)||null,'value':_0x58a168['attrReport']||(_0x58a168[_0x07db('0x66')]&&_0x58a168[_0x07db('0x66')][0x0]?_0x58a168[_0x07db('0x66')][0x0][_0x07db('0x67')]:undefined)||null},{'name':_0x07db('0x80'),'value':_0x58a168[_0x07db('0x80')]||(_0x58a168['attrs']&&_0x58a168['attrs'][0x1]?_0x58a168[_0x07db('0x66')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x276db0){logger[_0x07db('0x62')]('widgetAttributes:\x20%s',JSON[_0x07db('0x81')](_0x276db0));return[];}}exports[_0x07db('0x82')]=function(_0x57ffa2,_0x3aeebc,_0x454127){if(_0x57ffa2[_0x07db('0x55')]['id']){delete _0x57ffa2['body']['id'];}return db['Dashboard'][_0x07db('0x53')]({'where':{'id':_0x57ffa2[_0x07db('0x4f')]['id']}})[_0x07db('0x2b')](handleEntityNotFound(_0x3aeebc,null))[_0x07db('0x2b')](function(_0x1cc244){if(_0x1cc244){_0x57ffa2[_0x07db('0x55')]['DashboardId']=_0x1cc244['id'];_0x57ffa2['body'][_0x07db('0x66')]=widgetAttributes(_0x57ffa2[_0x07db('0x55')]);return db[_0x07db('0x83')][_0x07db('0x54')](_0x57ffa2[_0x07db('0x55')]);}})[_0x07db('0x2b')](respondWithResult(_0x3aeebc,null))[_0x07db('0x4d')](handleError(_0x3aeebc,null));};exports[_0x07db('0x84')]=function(_0x5db40b,_0x101746,_0x42e066){var _0x12794b={};var _0x166cdf={};var _0x50ed99;var _0x27c172;return db[_0x07db('0x35')][_0x07db('0x85')]({'where':{'id':_0x5db40b[_0x07db('0x4f')]['id']}})[_0x07db('0x2b')](handleEntityNotFound(_0x101746,null))['then'](function(_0x268ee1){if(_0x268ee1){_0x50ed99=_0x268ee1;_0x166cdf['model']=_[_0x07db('0x3a')](db['DashboardItem'][_0x07db('0x50')]);_0x166cdf['query']=_['keys'](_0x5db40b[_0x07db('0x3b')]);_0x166cdf[_0x07db('0x44')]=_['intersection'](_0x166cdf[_0x07db('0x39')],_0x166cdf[_0x07db('0x3b')]);_0x12794b[_0x07db('0x3d')]=_[_0x07db('0x3c')](_0x166cdf[_0x07db('0x39')],qs[_0x07db('0x3e')](_0x5db40b[_0x07db('0x3b')]['fields']));_0x12794b[_0x07db('0x3d')]=_0x12794b[_0x07db('0x3d')][_0x07db('0x51')]?_0x12794b[_0x07db('0x3d')]:_0x166cdf[_0x07db('0x39')];_0x12794b['order']=qs['sort'](_0x5db40b['query'][_0x07db('0x42')]);_0x12794b['where']=qs[_0x07db('0x44')](_[_0x07db('0x45')](_0x5db40b['query'],_0x166cdf[_0x07db('0x44')]));if(_0x5db40b[_0x07db('0x3b')]['filter']){_0x12794b[_0x07db('0x43')]=_[_0x07db('0x52')](_0x12794b['where'],{'$or':_[_0x07db('0x34')](_0x12794b[_0x07db('0x3d')],function(_0x188fbb){var _0xe9afd5={};_0xe9afd5[_0x188fbb]={'$like':'%'+_0x5db40b[_0x07db('0x3b')]['filter']+'%'};return _0xe9afd5;})});}_0x12794b=_['merge']({},_0x12794b,_0x5db40b['options']);return _0x50ed99['getItems'](_0x12794b);}})[_0x07db('0x2b')](function(_0x270cce){if(_0x270cce){_0x27c172=_0x270cce[_0x07db('0x51')];if(!_0x5db40b[_0x07db('0x3b')][_0x07db('0x3f')](_0x07db('0x40'))){_0x12794b['limit']=qs[_0x07db('0x24')](_0x5db40b[_0x07db('0x3b')][_0x07db('0x24')]);_0x12794b['offset']=qs[_0x07db('0x23')](_0x5db40b[_0x07db('0x3b')][_0x07db('0x23')]);}return _0x50ed99[_0x07db('0x84')](_0x12794b);}})[_0x07db('0x2b')](function(_0x4c63ee){if(_0x4c63ee){return _0x4c63ee?{'count':_0x27c172,'rows':_0x4c63ee}:null;}})[_0x07db('0x2b')](respondWithResult(_0x101746,null))['catch'](handleError(_0x101746,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 3a4f600..4790a38 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 _0xe6c5=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x443214,_0x921a26){var _0x1a2f50=function(_0x330062){while(--_0x330062){_0x443214['push'](_0x443214['shift']());}};_0x1a2f50(++_0x921a26);}(_0xe6c5,0x67));var _0x5e6c=function(_0x3788ad,_0x2bfb37){_0x3788ad=_0x3788ad-0x0;var _0x2fb6a5=_0xe6c5[_0x3788ad];return _0x2fb6a5;};'use strict';var EventEmitter=require(_0x5e6c('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5e6c('0x1')](0x0);var events={'afterCreate':_0x5e6c('0x2'),'afterUpdate':_0x5e6c('0x3'),'afterDestroy':_0x5e6c('0x4')};function emitEvent(_0x56e3e3){return function(_0x29480c,_0x243866,_0x2e4a67){DashboardEvents[_0x5e6c('0x5')](_0x56e3e3+':'+_0x29480c['id'],_0x29480c);DashboardEvents['emit'](_0x56e3e3,_0x29480c);_0x2e4a67(null);};}for(var e in events){if(events[_0x5e6c('0x6')](e)){var event=events[e];Dashboard[_0x5e6c('0x7')](e,emitEvent(event));}}module[_0x5e6c('0x8')]=DashboardEvents; \ No newline at end of file +var _0x622a=['emit','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x46c353,_0x50f88d){var _0x238512=function(_0x1ea5b7){while(--_0x1ea5b7){_0x46c353['push'](_0x46c353['shift']());}};_0x238512(++_0x50f88d);}(_0x622a,0x1ce));var _0xa622=function(_0x217372,_0x1822ce){_0x217372=_0x217372-0x0;var _0x2715a1=_0x622a[_0x217372];return _0x2715a1;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xa622('0x0'))['db'][_0xa622('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa622('0x2')](0x0);var events={'afterCreate':_0xa622('0x3'),'afterUpdate':_0xa622('0x4'),'afterDestroy':_0xa622('0x5')};function emitEvent(_0x262059){return function(_0x3da6a5,_0x1ec487,_0x59f8e2){DashboardEvents[_0xa622('0x6')](_0x262059+':'+_0x3da6a5['id'],_0x3da6a5);DashboardEvents[_0xa622('0x6')](_0x262059,_0x3da6a5);_0x59f8e2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xa622('0x7')](e,emitEvent(event));}}module[_0xa622('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 0bd6fc9..4c8a639 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 _0xbdeb=['api','bluebird','request-promise','path','rimraf','exports','define','util'];(function(_0x26337b,_0x2b51bb){var _0x15aaa3=function(_0x154b85){while(--_0x154b85){_0x26337b['push'](_0x26337b['shift']());}};_0x15aaa3(++_0x2b51bb);}(_0xbdeb,0x6f));var _0xbbde=function(_0x52b993,_0x13ef76){_0x52b993=_0x52b993-0x0;var _0x1ac4ff=_0xbdeb[_0x52b993];return _0x1ac4ff;};'use strict';var _=require('lodash');var util=require(_0xbbde('0x0'));var logger=require('../../config/logger')(_0xbbde('0x1'));var moment=require('moment');var BPromise=require(_0xbbde('0x2'));var rp=require(_0xbbde('0x3'));var fs=require('fs');var path=require(_0xbbde('0x4'));var rimraf=require(_0xbbde('0x5'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xbbde('0x6')]=function(_0x1d4042,_0x278651){return _0x1d4042[_0xbbde('0x7')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8f2=['Dashboard','dashboards','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x9656d8,_0xbe7b4f){var _0x921f07=function(_0x4f390d){while(--_0x4f390d){_0x9656d8['push'](_0x9656d8['shift']());}};_0x921f07(++_0xbe7b4f);}(_0xc8f2,0x120));var _0x2c8f=function(_0xf68c85,_0x181a79){_0xf68c85=_0xf68c85-0x0;var _0x532904=_0xc8f2[_0xf68c85];return _0x532904;};'use strict';var _=require(_0x2c8f('0x0'));var util=require('util');var logger=require(_0x2c8f('0x1'))(_0x2c8f('0x2'));var moment=require(_0x2c8f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c8f('0x4'));var rimraf=require(_0x2c8f('0x5'));var config=require(_0x2c8f('0x6'));var attributes=require(_0x2c8f('0x7'));module[_0x2c8f('0x8')]=function(_0x136cd3,_0x3be988){return _0x136cd3['define'](_0x2c8f('0x9'),attributes,{'tableName':_0x2c8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 90db63f..468cee1 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 _0x2824=['socket.io-emitter','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x289fad,_0x43e23e){var _0x54a48a=function(_0x413d2a){while(--_0x413d2a){_0x289fad['push'](_0x289fad['shift']());}};_0x54a48a(++_0x43e23e);}(_0x2824,0xef));var _0x4282=function(_0x132b38,_0x2f5509){_0x132b38=_0x132b38-0x0;var _0x12a5b0=_0x2824[_0x132b38];return _0x12a5b0;};'use strict';var _=require('lodash');var util=require(_0x4282('0x0'));var moment=require(_0x4282('0x1'));var BPromise=require(_0x4282('0x2'));var rs=require(_0x4282('0x3'));var fs=require('fs');var Redis=require(_0x4282('0x4'));var db=require(_0x4282('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4282('0x6'))('rpc');var config=require(_0x4282('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4282('0x8')][_0x4282('0x9')]({'port':0x232a});config[_0x4282('0xa')]=_[_0x4282('0xb')](config[_0x4282('0xa')],{'host':_0x4282('0xc'),'port':0x18eb});var socket=require(_0x4282('0xd'))(new Redis(config[_0x4282('0xa')]));require('./dashboard.socket')[_0x4282('0xe')](socket);function respondWithRpcPromise(_0x4ac1b5,_0xf36f18,_0x3e8802){return new BPromise(function(_0x2d8708,_0x6a61da){return client[_0x4282('0xf')](_0x4ac1b5,_0x3e8802)[_0x4282('0x10')](function(_0x5c5d52){logger[_0x4282('0x11')]('Dashboard,\x20%s,\x20%s',_0xf36f18,_0x4282('0x12'));logger[_0x4282('0x13')](_0x4282('0x14'),_0xf36f18,'request\x20sent',JSON[_0x4282('0x15')](_0x5c5d52));if(_0x5c5d52[_0x4282('0x16')]){if(_0x5c5d52[_0x4282('0x16')][_0x4282('0x17')]===0x1f4){logger[_0x4282('0x16')]('Dashboard,\x20%s,\x20%s',_0xf36f18,_0x5c5d52[_0x4282('0x16')][_0x4282('0x18')]);return _0x6a61da(_0x5c5d52[_0x4282('0x16')]['message']);}logger['error'](_0x4282('0x19'),_0xf36f18,_0x5c5d52['error'][_0x4282('0x18')]);return _0x2d8708(_0x5c5d52[_0x4282('0x16')][_0x4282('0x18')]);}else{logger[_0x4282('0x11')]('Dashboard,\x20%s,\x20%s',_0xf36f18,'request\x20sent');_0x2d8708(_0x5c5d52[_0x4282('0x1a')][_0x4282('0x18')]);}})[_0x4282('0x1b')](function(_0x2da700){logger[_0x4282('0x16')](_0x4282('0x19'),_0xf36f18,_0x2da700);_0x6a61da(_0x2da700);});});} \ No newline at end of file +var _0xa9a2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9a2,0x14f));var _0x2a9a=function(_0x344b24,_0x2b6b0d){_0x344b24=_0x344b24-0x0;var _0x5b66cc=_0xa9a2[_0x344b24];return _0x5b66cc;};'use strict';var _=require(_0x2a9a('0x0'));var util=require(_0x2a9a('0x1'));var moment=require(_0x2a9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a9a('0x3'));var fs=require('fs');var Redis=require(_0x2a9a('0x4'));var db=require(_0x2a9a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a9a('0x6'))(_0x2a9a('0x7'));var config=require(_0x2a9a('0x8'));var jayson=require(_0x2a9a('0x9'));var client=jayson[_0x2a9a('0xa')][_0x2a9a('0xb')]({'port':0x232a});config['redis']=_[_0x2a9a('0xc')](config[_0x2a9a('0xd')],{'host':_0x2a9a('0xe'),'port':0x18eb});var socket=require(_0x2a9a('0xf'))(new Redis(config[_0x2a9a('0xd')]));require(_0x2a9a('0x10'))[_0x2a9a('0x11')](socket);function respondWithRpcPromise(_0x246d10,_0x1bf111,_0x3bd3cd){return new BPromise(function(_0x44dd52,_0x350a97){return client['request'](_0x246d10,_0x3bd3cd)['then'](function(_0x412dcf){logger[_0x2a9a('0x12')](_0x2a9a('0x13'),_0x1bf111,_0x2a9a('0x14'));logger[_0x2a9a('0x15')](_0x2a9a('0x16'),_0x1bf111,'request\x20sent',JSON['stringify'](_0x412dcf));if(_0x412dcf['error']){if(_0x412dcf[_0x2a9a('0x17')][_0x2a9a('0x18')]===0x1f4){logger[_0x2a9a('0x17')](_0x2a9a('0x13'),_0x1bf111,_0x412dcf[_0x2a9a('0x17')]['message']);return _0x350a97(_0x412dcf[_0x2a9a('0x17')][_0x2a9a('0x19')]);}logger[_0x2a9a('0x17')](_0x2a9a('0x13'),_0x1bf111,_0x412dcf[_0x2a9a('0x17')]['message']);return _0x44dd52(_0x412dcf[_0x2a9a('0x17')][_0x2a9a('0x19')]);}else{logger[_0x2a9a('0x12')](_0x2a9a('0x13'),_0x1bf111,_0x2a9a('0x14'));_0x44dd52(_0x412dcf[_0x2a9a('0x1a')][_0x2a9a('0x19')]);}})[_0x2a9a('0x1b')](function(_0x5b60aa){logger[_0x2a9a('0x17')]('Dashboard,\x20%s,\x20%s',_0x1bf111,_0x5b60aa);_0x350a97(_0x5b60aa);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5613bba..f61b057 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 _0x3c6d=['./dashboard.events','save','remove','update','removeListener'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3c6d,0x163));var _0xd3c6=function(_0x1c4042,_0xcf59a7){_0x1c4042=_0x1c4042-0x0;var _0x56c253=_0x3c6d[_0x1c4042];return _0x56c253;};'use strict';var DashboardEvents=require(_0xd3c6('0x0'));var events=[_0xd3c6('0x1'),_0xd3c6('0x2'),_0xd3c6('0x3')];function createListener(_0x17b649,_0x4a14e6){return function(_0x1cbfbe){_0x4a14e6['emit'](_0x17b649,_0x1cbfbe);};}function removeListener(_0x44d6db,_0x389600){return function(){DashboardEvents[_0xd3c6('0x4')](_0x44d6db,_0x389600);};}exports['register']=function(_0x14ba15){for(var _0x12a799=0x0,_0x19c050=events['length'];_0x12a799<_0x19c050;_0x12a799++){var _0x43e9a3=events[_0x12a799];var _0x3a0de3=createListener('dashboard:'+_0x43e9a3,_0x14ba15);DashboardEvents['on'](_0x43e9a3,_0x3a0de3);}}; \ No newline at end of file +var _0x2373=['update','emit','removeListener','register','length','./dashboard.events','save','remove'];(function(_0x321bd7,_0x4bc675){var _0x32fa71=function(_0x5da437){while(--_0x5da437){_0x321bd7['push'](_0x321bd7['shift']());}};_0x32fa71(++_0x4bc675);}(_0x2373,0x85));var _0x3237=function(_0x360ab7,_0x4133db){_0x360ab7=_0x360ab7-0x0;var _0x4b419d=_0x2373[_0x360ab7];return _0x4b419d;};'use strict';var DashboardEvents=require(_0x3237('0x0'));var events=[_0x3237('0x1'),_0x3237('0x2'),_0x3237('0x3')];function createListener(_0x417f0b,_0x357df4){return function(_0x2c79c6){_0x357df4[_0x3237('0x4')](_0x417f0b,_0x2c79c6);};}function removeListener(_0x288033,_0x4e3b1a){return function(){DashboardEvents[_0x3237('0x5')](_0x288033,_0x4e3b1a);};}exports[_0x3237('0x6')]=function(_0x468f02){for(var _0x4e16e2=0x0,_0xd27c3=events[_0x3237('0x7')];_0x4e16e2<_0xd27c3;_0x4e16e2++){var _0x346570=events[_0x4e16e2];var _0xabe812=createListener('dashboard:'+_0x346570,_0x468f02);DashboardEvents['on'](_0x346570,_0xabe812);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2aeb812..5eb1b1d 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 _0xaf27=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','update','delete'];(function(_0x53fbfb,_0x5a6957){var _0x59955a=function(_0x576765){while(--_0x576765){_0x53fbfb['push'](_0x53fbfb['shift']());}};_0x59955a(++_0x5a6957);}(_0xaf27,0x11e));var _0x7af2=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xaf27[_0xa3fadc];return _0x23ecb8;};'use strict';var multer=require(_0x7af2('0x0'));var util=require(_0x7af2('0x1'));var path=require('path');var timeout=require(_0x7af2('0x2'));var express=require(_0x7af2('0x3'));var router=express[_0x7af2('0x4')]();var fs_extra=require(_0x7af2('0x5'));var auth=require(_0x7af2('0x6'));var interaction=require(_0x7af2('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x7af2('0x8')](),controller[_0x7af2('0x9')]);router[_0x7af2('0xa')](_0x7af2('0xb'),auth['isAuthenticated'](),controller[_0x7af2('0xc')]);router[_0x7af2('0xa')](_0x7af2('0xd'),auth[_0x7af2('0x8')](),controller[_0x7af2('0xe')]);router[_0x7af2('0xf')]('/',auth['isAuthenticated'](),controller[_0x7af2('0x10')]);router[_0x7af2('0xf')](_0x7af2('0x11'),auth[_0x7af2('0x8')](),controller[_0x7af2('0x12')]);router[_0x7af2('0xf')]('/:id/items',auth[_0x7af2('0x8')](),controller[_0x7af2('0x13')]);router['put']('/:id',auth[_0x7af2('0x8')](),controller[_0x7af2('0x14')]);router[_0x7af2('0x15')]('/:id',auth[_0x7af2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbf43=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','update','delete','exports','path','connect-timeout','express'];(function(_0x18e00d,_0x1c9268){var _0x389a4a=function(_0x3eab1c){while(--_0x3eab1c){_0x18e00d['push'](_0x18e00d['shift']());}};_0x389a4a(++_0x1c9268);}(_0xbf43,0x9e));var _0x3bf4=function(_0x43c92d,_0x38487a){_0x43c92d=_0x43c92d-0x0;var _0x10d0dc=_0xbf43[_0x43c92d];return _0x10d0dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3bf4('0x0'));var timeout=require(_0x3bf4('0x1'));var express=require(_0x3bf4('0x2'));var router=express[_0x3bf4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3bf4('0x4'));var interaction=require(_0x3bf4('0x5'));var config=require(_0x3bf4('0x6'));var controller=require('./dashboard.controller');router[_0x3bf4('0x7')]('/',auth[_0x3bf4('0x8')](),controller[_0x3bf4('0x9')]);router[_0x3bf4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3bf4('0xa')]);router[_0x3bf4('0x7')](_0x3bf4('0xb'),auth[_0x3bf4('0x8')](),controller[_0x3bf4('0xc')]);router[_0x3bf4('0xd')]('/',auth['isAuthenticated'](),controller[_0x3bf4('0xe')]);router[_0x3bf4('0xd')](_0x3bf4('0xf'),auth[_0x3bf4('0x8')](),controller[_0x3bf4('0x10')]);router[_0x3bf4('0xd')]('/:id/items',auth[_0x3bf4('0x8')](),controller[_0x3bf4('0x11')]);router[_0x3bf4('0x12')](_0x3bf4('0x13'),auth[_0x3bf4('0x8')](),controller[_0x3bf4('0x14')]);router[_0x3bf4('0x15')](_0x3bf4('0x13'),auth[_0x3bf4('0x8')](),controller['destroy']);module[_0x3bf4('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index acd30fd..0d1d78d 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 _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xdae8e6,_0x34854a){_0xdae8e6=_0xdae8e6-0x0;var _0x24c7a7=_0xfdbd[_0xdae8e6];return _0x24c7a7;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 b8337be..1e43e6e 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 _0x1d7e=['attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter'];(function(_0x3a1f7c,_0x5a1208){var _0x4e505a=function(_0xb23336){while(--_0xb23336){_0x3a1f7c['push'](_0x3a1f7c['shift']());}};_0x4e505a(++_0x5a1208);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1d7e[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];config[_0xe1d7('0x17')]=_[_0xe1d7('0x18')](config[_0xe1d7('0x17')],{'host':_0xe1d7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1d7('0x17')]));require(_0xe1d7('0x1a'))[_0xe1d7('0x1b')](socket);function respondWithStatusCode(_0x3d3d8d,_0x193a0e){_0x193a0e=_0x193a0e||0xcc;return function(_0x2d017a){if(_0x2d017a){return _0x3d3d8d[_0xe1d7('0x1c')](_0x193a0e);}return _0x3d3d8d['status'](_0x193a0e)[_0xe1d7('0x1d')]();};}function respondWithResult(_0x328898,_0x419cf3){_0x419cf3=_0x419cf3||0xc8;return function(_0x56e1c6){if(_0x56e1c6){return _0x328898[_0xe1d7('0x1e')](_0x419cf3)[_0xe1d7('0x1f')](_0x56e1c6);}};}function respondWithFilteredResult(_0x800c15,_0x1f82ce){return function(_0x1dc61f){if(_0x1dc61f){var _0x446ce6=typeof _0x1f82ce[_0xe1d7('0x20')]===_0xe1d7('0x21')&&typeof _0x1f82ce[_0xe1d7('0x22')]===_0xe1d7('0x21');var _0x2035e7=_0x1dc61f[_0xe1d7('0x23')];var _0x4d8c7d=_0x446ce6?0x0:_0x1f82ce[_0xe1d7('0x20')];var _0x17317e=_0x446ce6?_0x1dc61f[_0xe1d7('0x23')]:_0x1f82ce[_0xe1d7('0x20')]+_0x1f82ce[_0xe1d7('0x22')];var _0x5f2053;if(_0x17317e>=_0x2035e7){_0x17317e=_0x2035e7;_0x5f2053=0xc8;}else{_0x5f2053=0xce;}_0x800c15[_0xe1d7('0x1e')](_0x5f2053);return _0x800c15[_0xe1d7('0x24')](_0xe1d7('0x25'),_0x4d8c7d+'-'+_0x17317e+'/'+_0x2035e7)[_0xe1d7('0x1f')](_0x1dc61f);}return null;};}function patchUpdates(_0x33ac20){return function(_0x48ae1f){try{jsonpatch[_0xe1d7('0x26')](_0x48ae1f,_0x33ac20,!![]);}catch(_0x370c92){return BPromise[_0xe1d7('0x27')](_0x370c92);}return _0x48ae1f[_0xe1d7('0x28')]();};}function saveUpdates(_0x25e3c9,_0x38fc1b){return function(_0x3568ce){if(_0x3568ce){return _0x3568ce[_0xe1d7('0x29')](_0x25e3c9)[_0xe1d7('0x2a')](function(_0x2e47f7){return _0x2e47f7;});}return null;};}function removeEntity(_0x55446d,_0x672bed){return function(_0x7c1923){if(_0x7c1923){return _0x7c1923[_0xe1d7('0x2b')]()['then'](function(){_0x55446d[_0xe1d7('0x1e')](0xcc)[_0xe1d7('0x1d')]();});}};}function handleEntityNotFound(_0x19c671,_0x303523){return function(_0x471c82){if(!_0x471c82){_0x19c671[_0xe1d7('0x1c')](0x194);}return _0x471c82;};}function handleError(_0x95f28c,_0x55f7dd){_0x55f7dd=_0x55f7dd||0x1f4;return function(_0x3e8ca3){logger['error'](_0x3e8ca3[_0xe1d7('0x2c')]);if(_0x3e8ca3[_0xe1d7('0x2d')]){delete _0x3e8ca3['name'];}_0x95f28c['status'](_0x55f7dd)[_0xe1d7('0x2e')](_0x3e8ca3);};}exports[_0xe1d7('0x2f')]=function(_0x34eea8,_0x329506){var _0x2786d0={'raw':![],'where':{'id':_0x34eea8[_0xe1d7('0x30')]['id']}},_0x5bf10c={};_0x5bf10c[_0xe1d7('0x31')]=_[_0xe1d7('0x32')](db[_0xe1d7('0x33')][_0xe1d7('0x34')]);_0x5bf10c['query']=_[_0xe1d7('0x32')](_0x34eea8[_0xe1d7('0x35')]);_0x5bf10c[_0xe1d7('0x36')]=_[_0xe1d7('0x37')](_0x5bf10c[_0xe1d7('0x31')],_0x5bf10c[_0xe1d7('0x35')]);_0x2786d0[_0xe1d7('0x38')]=_[_0xe1d7('0x37')](_0x5bf10c['model'],qs[_0xe1d7('0x39')](_0x34eea8[_0xe1d7('0x35')][_0xe1d7('0x39')]));_0x2786d0['attributes']=_0x2786d0[_0xe1d7('0x38')][_0xe1d7('0x3a')]?_0x2786d0[_0xe1d7('0x38')]:_0x5bf10c[_0xe1d7('0x31')];if(_0x34eea8[_0xe1d7('0x35')][_0xe1d7('0x3b')]){_0x2786d0['include']=[{'all':!![]}];}_0x2786d0=_[_0xe1d7('0x3c')]({},_0x2786d0,_0x34eea8[_0xe1d7('0x3d')]);return db[_0xe1d7('0x33')][_0xe1d7('0x3e')](_0x2786d0)[_0xe1d7('0x2a')](handleEntityNotFound(_0x329506,null))[_0xe1d7('0x2a')](respondWithResult(_0x329506,null))['catch'](handleError(_0x329506,null));};exports[_0xe1d7('0x2b')]=function(_0x228f2c,_0x36f1d6){return db['DashboardItem'][_0xe1d7('0x3e')]({'where':{'id':_0x228f2c[_0xe1d7('0x30')]['id']}})[_0xe1d7('0x2a')](handleEntityNotFound(_0x36f1d6,null))['then'](removeEntity(_0x36f1d6,null))[_0xe1d7('0x3f')](handleError(_0x36f1d6,null));};function widgetAttributes(_0x594f4a){try{switch(_0x594f4a[_0xe1d7('0x40')]){case _0xe1d7('0x41'):return[{'name':'attrUrl','value':_0x594f4a[_0xe1d7('0x42')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x0]?_0x594f4a['attrs'][0x0][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x45')}];case'custom':return[{'name':_0xe1d7('0x46'),'value':_0x594f4a['attrPath']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||''}];case _0xe1d7('0x47'):return[{'name':_0xe1d7('0x48'),'value':_0x594f4a[_0xe1d7('0x48')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||'HH:mm:ss'},{'name':_0xe1d7('0x49'),'value':_0x594f4a['attrTimezone']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a[_0xe1d7('0x43')][0x1][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x4a')},{'name':_0xe1d7('0x4b'),'value':_0x594f4a[_0xe1d7('0x4b')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x2]?_0x594f4a[_0xe1d7('0x43')][0x2][_0xe1d7('0x44')]:undefined)||0xc}];case _0xe1d7('0x4c'):return[{'name':_0xe1d7('0x4d'),'value':_0x594f4a[_0xe1d7('0x4d')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||'total'},{'name':_0xe1d7('0x4e'),'value':_0x594f4a[_0xe1d7('0x4e')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a[_0xe1d7('0x43')][0x1]['value']:undefined)||[]},{'name':_0xe1d7('0x4b'),'value':_0x594f4a[_0xe1d7('0x4b')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x2]?_0x594f4a[_0xe1d7('0x43')][0x2][_0xe1d7('0x44')]:undefined)||0x14},{'name':_0xe1d7('0x4f'),'value':_0x594f4a[_0xe1d7('0x4f')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x3]?_0x594f4a['attrs'][0x3][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x50')},{'name':_0xe1d7('0x51'),'value':_0x594f4a['attrEmailAccounts']||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x4]?_0x594f4a[_0xe1d7('0x43')][0x4][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x52'),'value':_0x594f4a[_0xe1d7('0x52')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x5]?_0x594f4a['attrs'][0x5][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x53'),'value':_0x594f4a[_0xe1d7('0x53')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x6]?_0x594f4a['attrs'][0x6][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x54'),'value':_0x594f4a[_0xe1d7('0x54')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x7]?_0x594f4a[_0xe1d7('0x43')][0x7][_0xe1d7('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x594f4a[_0xe1d7('0x55')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x8]?_0x594f4a[_0xe1d7('0x43')][0x8][_0xe1d7('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x594f4a['attrChatWebsites']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x9]?_0x594f4a[_0xe1d7('0x43')][0x9][_0xe1d7('0x44')]:undefined)||''}];case'multibar-chart':case _0xe1d7('0x56'):return[{'name':_0xe1d7('0x57'),'value':_0x594f4a[_0xe1d7('0x57')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x58')},{'name':_0xe1d7('0x59'),'value':_0x594f4a[_0xe1d7('0x59')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a[_0xe1d7('0x43')][0x1][_0xe1d7('0x44')]:undefined)||null},{'name':_0xe1d7('0x5a'),'value':_0x594f4a['attrSerie3']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x2]?_0x594f4a[_0xe1d7('0x43')][0x2][_0xe1d7('0x44')]:undefined)||null},{'name':_0xe1d7('0x4e'),'value':_0x594f4a[_0xe1d7('0x4e')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x3]?_0x594f4a[_0xe1d7('0x43')][0x3]['value']:undefined)||[]},{'name':_0xe1d7('0x4f'),'value':_0x594f4a[_0xe1d7('0x4f')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0x4]?_0x594f4a[_0xe1d7('0x43')][0x4][_0xe1d7('0x44')]:undefined)||_0xe1d7('0x50')},{'name':_0xe1d7('0x51'),'value':_0x594f4a[_0xe1d7('0x51')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x5]?_0x594f4a['attrs'][0x5]['value']:undefined)||''},{'name':_0xe1d7('0x52'),'value':_0x594f4a[_0xe1d7('0x52')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x6]?_0x594f4a['attrs'][0x6][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x53'),'value':_0x594f4a['attrSmsAccounts']||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x7]?_0x594f4a[_0xe1d7('0x43')][0x7][_0xe1d7('0x44')]:undefined)||''},{'name':_0xe1d7('0x54'),'value':_0x594f4a[_0xe1d7('0x54')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x8]?_0x594f4a['attrs'][0x8][_0xe1d7('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x594f4a[_0xe1d7('0x55')]||(_0x594f4a['attrs']&&_0x594f4a['attrs'][0x9]?_0x594f4a[_0xe1d7('0x43')][0x9]['value']:undefined)||''},{'name':_0xe1d7('0x5b'),'value':_0x594f4a['attrChatWebsites']||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a[_0xe1d7('0x43')][0xa]?_0x594f4a[_0xe1d7('0x43')][0xa][_0xe1d7('0x44')]:undefined)||''}];case _0xe1d7('0x5c'):return[{'name':_0xe1d7('0x5d'),'type':_0x594f4a[_0xe1d7('0x5e')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x40')]:undefined)||null,'value':_0x594f4a[_0xe1d7('0x5d')]||(_0x594f4a[_0xe1d7('0x43')]&&_0x594f4a['attrs'][0x0]?_0x594f4a[_0xe1d7('0x43')][0x0][_0xe1d7('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x594f4a[_0xe1d7('0x5f')]||(_0x594f4a['attrs']&&_0x594f4a[_0xe1d7('0x43')][0x1]?_0x594f4a['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x23c97c){logger[_0xe1d7('0x60')](_0xe1d7('0x61'),JSON[_0xe1d7('0x62')](_0x23c97c));return[];}}exports[_0xe1d7('0x63')]=function(_0x184902,_0x524871){if(_0x184902[_0xe1d7('0x64')]){_0x184902[_0xe1d7('0x64')]['attrs']=widgetAttributes(_0x184902[_0xe1d7('0x64')]);}return db[_0xe1d7('0x33')]['create'](_0x184902[_0xe1d7('0x64')],{})[_0xe1d7('0x2a')](respondWithResult(_0x524871,0xc9))[_0xe1d7('0x3f')](handleError(_0x524871,null));};exports[_0xe1d7('0x29')]=function(_0x4e1d73,_0x13084e){if(_0x4e1d73[_0xe1d7('0x64')]['id']){delete _0x4e1d73[_0xe1d7('0x64')]['id'];}_0x4e1d73[_0xe1d7('0x64')][_0xe1d7('0x43')]=widgetAttributes(_0x4e1d73[_0xe1d7('0x64')]);return db[_0xe1d7('0x33')]['find']({'where':{'id':_0x4e1d73[_0xe1d7('0x30')]['id']}})[_0xe1d7('0x2a')](handleEntityNotFound(_0x13084e,null))[_0xe1d7('0x2a')](saveUpdates(_0x4e1d73[_0xe1d7('0x64')],null))[_0xe1d7('0x2a')](respondWithResult(_0x13084e,null))[_0xe1d7('0x3f')](handleError(_0x13084e,null));}; \ No newline at end of file +var _0xefce=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','DashboardItem','catch','find','type','iframe','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','rimraf','request-promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xefce,0x1e8));var _0xeefc=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0xefce[_0x644560];return _0x41b76b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeefc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeefc('0x1'));var moment=require(_0xeefc('0x2'));var BPromise=require(_0xeefc('0x3'));var Mustache=require(_0xeefc('0x4'));var util=require(_0xeefc('0x5'));var path=require(_0xeefc('0x6'));var sox=require(_0xeefc('0x7'));var csv=require(_0xeefc('0x8'));var ejs=require(_0xeefc('0x9'));var fs=require('fs');var fs_extra=require(_0xeefc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeefc('0xb'));var jsforce=require(_0xeefc('0xc'));var deskjs=require(_0xeefc('0xd'));var toCsv=require(_0xeefc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeefc('0xe'));var authService=require(_0xeefc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeefc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeefc('0x11'))(_0xeefc('0x12'));var utils=require('../../config/utils');var config=require(_0xeefc('0x13'));var licenseUtil=require(_0xeefc('0x14'));var db=require(_0xeefc('0x15'))['db'];config['redis']=_[_0xeefc('0x16')](config[_0xeefc('0x17')],{'host':_0xeefc('0x18'),'port':0x18eb});var socket=require(_0xeefc('0x19'))(new Redis(config[_0xeefc('0x17')]));require(_0xeefc('0x1a'))[_0xeefc('0x1b')](socket);function respondWithStatusCode(_0x4537e2,_0x2d5fc1){_0x2d5fc1=_0x2d5fc1||0xcc;return function(_0x3ac92a){if(_0x3ac92a){return _0x4537e2[_0xeefc('0x1c')](_0x2d5fc1);}return _0x4537e2['status'](_0x2d5fc1)[_0xeefc('0x1d')]();};}function respondWithResult(_0x5c447b,_0x2ce41b){_0x2ce41b=_0x2ce41b||0xc8;return function(_0x2fe7c2){if(_0x2fe7c2){return _0x5c447b[_0xeefc('0x1e')](_0x2ce41b)[_0xeefc('0x1f')](_0x2fe7c2);}};}function respondWithFilteredResult(_0x15baaa,_0x49cfe2){return function(_0x1c247e){if(_0x1c247e){var _0x1ea90e=typeof _0x49cfe2['offset']===_0xeefc('0x20')&&typeof _0x49cfe2[_0xeefc('0x21')]===_0xeefc('0x20');var _0x4ba684=_0x1c247e[_0xeefc('0x22')];var _0x1f2825=_0x1ea90e?0x0:_0x49cfe2['offset'];var _0x25ca4d=_0x1ea90e?_0x1c247e['count']:_0x49cfe2[_0xeefc('0x23')]+_0x49cfe2[_0xeefc('0x21')];var _0x3cebaa;if(_0x25ca4d>=_0x4ba684){_0x25ca4d=_0x4ba684;_0x3cebaa=0xc8;}else{_0x3cebaa=0xce;}_0x15baaa[_0xeefc('0x1e')](_0x3cebaa);return _0x15baaa[_0xeefc('0x24')](_0xeefc('0x25'),_0x1f2825+'-'+_0x25ca4d+'/'+_0x4ba684)[_0xeefc('0x1f')](_0x1c247e);}return null;};}function patchUpdates(_0x4ec1c9){return function(_0x168700){try{jsonpatch[_0xeefc('0x26')](_0x168700,_0x4ec1c9,!![]);}catch(_0x6e690b){return BPromise[_0xeefc('0x27')](_0x6e690b);}return _0x168700['save']();};}function saveUpdates(_0x48246d,_0x1a8b12){return function(_0x1f2d59){if(_0x1f2d59){return _0x1f2d59[_0xeefc('0x28')](_0x48246d)[_0xeefc('0x29')](function(_0x4aeaa7){return _0x4aeaa7;});}return null;};}function removeEntity(_0x16e60e,_0x3ea299){return function(_0xceece3){if(_0xceece3){return _0xceece3[_0xeefc('0x2a')]()['then'](function(){_0x16e60e['status'](0xcc)[_0xeefc('0x1d')]();});}};}function handleEntityNotFound(_0x5b7d0d,_0x27f8cd){return function(_0x2d13b6){if(!_0x2d13b6){_0x5b7d0d['sendStatus'](0x194);}return _0x2d13b6;};}function handleError(_0x52dab1,_0x167fe8){_0x167fe8=_0x167fe8||0x1f4;return function(_0x56ea84){logger['error'](_0x56ea84[_0xeefc('0x2b')]);if(_0x56ea84[_0xeefc('0x2c')]){delete _0x56ea84['name'];}_0x52dab1['status'](_0x167fe8)[_0xeefc('0x2d')](_0x56ea84);};}exports[_0xeefc('0x2e')]=function(_0x4369c9,_0x13a33e){var _0x29fc6b={'raw':![],'where':{'id':_0x4369c9[_0xeefc('0x2f')]['id']}},_0x325578={};_0x325578[_0xeefc('0x30')]=_[_0xeefc('0x31')](db['DashboardItem'][_0xeefc('0x32')]);_0x325578[_0xeefc('0x33')]=_[_0xeefc('0x31')](_0x4369c9[_0xeefc('0x33')]);_0x325578[_0xeefc('0x34')]=_[_0xeefc('0x35')](_0x325578[_0xeefc('0x30')],_0x325578[_0xeefc('0x33')]);_0x29fc6b[_0xeefc('0x36')]=_[_0xeefc('0x35')](_0x325578[_0xeefc('0x30')],qs[_0xeefc('0x37')](_0x4369c9[_0xeefc('0x33')]['fields']));_0x29fc6b[_0xeefc('0x36')]=_0x29fc6b[_0xeefc('0x36')]['length']?_0x29fc6b[_0xeefc('0x36')]:_0x325578[_0xeefc('0x30')];if(_0x4369c9['query']['includeAll']){_0x29fc6b[_0xeefc('0x38')]=[{'all':!![]}];}_0x29fc6b=_[_0xeefc('0x39')]({},_0x29fc6b,_0x4369c9[_0xeefc('0x3a')]);return db[_0xeefc('0x3b')]['find'](_0x29fc6b)[_0xeefc('0x29')](handleEntityNotFound(_0x13a33e,null))['then'](respondWithResult(_0x13a33e,null))[_0xeefc('0x3c')](handleError(_0x13a33e,null));};exports[_0xeefc('0x2a')]=function(_0x52b74a,_0x38d4c2){return db[_0xeefc('0x3b')][_0xeefc('0x3d')]({'where':{'id':_0x52b74a[_0xeefc('0x2f')]['id']}})[_0xeefc('0x29')](handleEntityNotFound(_0x38d4c2,null))[_0xeefc('0x29')](removeEntity(_0x38d4c2,null))[_0xeefc('0x3c')](handleError(_0x38d4c2,null));};function widgetAttributes(_0x11186c){try{switch(_0x11186c[_0xeefc('0x3e')]){case _0xeefc('0x3f'):return[{'name':'attrUrl','value':_0x11186c['attrUrl']||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||_0xeefc('0x42')}];case'custom':return[{'name':_0xeefc('0x43'),'value':_0x11186c[_0xeefc('0x43')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c['attrs'][0x0][_0xeefc('0x41')]:undefined)||''}];case _0xeefc('0x44'):return[{'name':_0xeefc('0x45'),'value':_0x11186c[_0xeefc('0x45')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||_0xeefc('0x46')},{'name':_0xeefc('0x47'),'value':_0x11186c['attrTimezone']||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||_0xeefc('0x48')},{'name':_0xeefc('0x49'),'value':_0x11186c[_0xeefc('0x49')]||(_0x11186c['attrs']&&_0x11186c['attrs'][0x2]?_0x11186c[_0xeefc('0x40')][0x2][_0xeefc('0x41')]:undefined)||0xc}];case _0xeefc('0x4a'):return[{'name':_0xeefc('0x4b'),'value':_0x11186c[_0xeefc('0x4b')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||'total'},{'name':_0xeefc('0x4c'),'value':_0x11186c[_0xeefc('0x4c')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||[]},{'name':_0xeefc('0x49'),'value':_0x11186c[_0xeefc('0x49')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x2]?_0x11186c[_0xeefc('0x40')][0x2][_0xeefc('0x41')]:undefined)||0x14},{'name':_0xeefc('0x4d'),'value':_0x11186c[_0xeefc('0x4d')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x3]?_0x11186c[_0xeefc('0x40')][0x3][_0xeefc('0x41')]:undefined)||_0xeefc('0x4e')},{'name':_0xeefc('0x4f'),'value':_0x11186c[_0xeefc('0x4f')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x4]?_0x11186c[_0xeefc('0x40')][0x4][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x50'),'value':_0x11186c[_0xeefc('0x50')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x5]?_0x11186c[_0xeefc('0x40')][0x5]['value']:undefined)||''},{'name':_0xeefc('0x51'),'value':_0x11186c[_0xeefc('0x51')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x6]?_0x11186c['attrs'][0x6]['value']:undefined)||''},{'name':_0xeefc('0x52'),'value':_0x11186c[_0xeefc('0x52')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x7]?_0x11186c[_0xeefc('0x40')][0x7][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x53'),'value':_0x11186c[_0xeefc('0x53')]||(_0x11186c['attrs']&&_0x11186c['attrs'][0x8]?_0x11186c[_0xeefc('0x40')][0x8][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x54'),'value':_0x11186c['attrChatWebsites']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x9]?_0x11186c[_0xeefc('0x40')][0x9]['value']:undefined)||''}];case _0xeefc('0x55'):case _0xeefc('0x56'):return[{'name':_0xeefc('0x57'),'value':_0x11186c[_0xeefc('0x57')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c['attrs'][0x0]['value']:undefined)||_0xeefc('0x58')},{'name':_0xeefc('0x59'),'value':_0x11186c[_0xeefc('0x59')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c['attrs'][0x1][_0xeefc('0x41')]:undefined)||null},{'name':_0xeefc('0x5a'),'value':_0x11186c[_0xeefc('0x5a')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x2]?_0x11186c[_0xeefc('0x40')][0x2]['value']:undefined)||null},{'name':_0xeefc('0x4c'),'value':_0x11186c[_0xeefc('0x4c')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x3]?_0x11186c['attrs'][0x3][_0xeefc('0x41')]:undefined)||[]},{'name':_0xeefc('0x4d'),'value':_0x11186c['attrChannel']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x4]?_0x11186c[_0xeefc('0x40')][0x4][_0xeefc('0x41')]:undefined)||_0xeefc('0x4e')},{'name':_0xeefc('0x4f'),'value':_0x11186c['attrEmailAccounts']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x5]?_0x11186c[_0xeefc('0x40')][0x5][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x50'),'value':_0x11186c[_0xeefc('0x50')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x6]?_0x11186c[_0xeefc('0x40')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x11186c[_0xeefc('0x51')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x7]?_0x11186c[_0xeefc('0x40')][0x7][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x52'),'value':_0x11186c[_0xeefc('0x52')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x8]?_0x11186c['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x11186c[_0xeefc('0x53')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x9]?_0x11186c[_0xeefc('0x40')][0x9][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x54'),'value':_0x11186c[_0xeefc('0x54')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0xa]?_0x11186c[_0xeefc('0x40')][0xa][_0xeefc('0x41')]:undefined)||''}];case _0xeefc('0x5b'):return[{'name':_0xeefc('0x5c'),'type':_0x11186c['reportType']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x0]?_0x11186c['attrs'][0x0]['type']:undefined)||null,'value':_0x11186c[_0xeefc('0x5c')]||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0]['value']:undefined)||null},{'name':_0xeefc('0x5d'),'value':_0x11186c[_0xeefc('0x5d')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||0x0}];default:return[];}}catch(_0xa1c28f){logger[_0xeefc('0x5e')](_0xeefc('0x5f'),JSON['stringify'](_0xa1c28f));return[];}}exports[_0xeefc('0x60')]=function(_0x232c64,_0x5c5ec2){if(_0x232c64[_0xeefc('0x61')]){_0x232c64[_0xeefc('0x61')][_0xeefc('0x40')]=widgetAttributes(_0x232c64['body']);}return db['DashboardItem'][_0xeefc('0x60')](_0x232c64[_0xeefc('0x61')],{})[_0xeefc('0x29')](respondWithResult(_0x5c5ec2,0xc9))[_0xeefc('0x3c')](handleError(_0x5c5ec2,null));};exports[_0xeefc('0x28')]=function(_0x34a816,_0x1f5e28){if(_0x34a816['body']['id']){delete _0x34a816[_0xeefc('0x61')]['id'];}_0x34a816['body'][_0xeefc('0x40')]=widgetAttributes(_0x34a816[_0xeefc('0x61')]);return db[_0xeefc('0x3b')]['find']({'where':{'id':_0x34a816[_0xeefc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1f5e28,null))[_0xeefc('0x29')](saveUpdates(_0x34a816['body'],null))[_0xeefc('0x29')](respondWithResult(_0x1f5e28,null))[_0xeefc('0x3c')](handleError(_0x1f5e28,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 76a5c6a..e0b6f75 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 _0x1a50=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5671cd,_0x35c55d){var _0x507cd6=function(_0x303587){while(--_0x303587){_0x5671cd['push'](_0x5671cd['shift']());}};_0x507cd6(++_0x35c55d);}(_0x1a50,0x1eb));var _0x01a5=function(_0x8c318b,_0x309481){_0x8c318b=_0x8c318b-0x0;var _0x3c000a=_0x1a50[_0x8c318b];return _0x3c000a;};'use strict';var EventEmitter=require(_0x01a5('0x0'));var DashboardItem=require(_0x01a5('0x1'))['db'][_0x01a5('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x01a5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x01a5('0x4'),'afterDestroy':_0x01a5('0x5')};function emitEvent(_0x251950){return function(_0x35736f,_0x2597de,_0x2fd333){DashboardItemEvents[_0x01a5('0x6')](_0x251950+':'+_0x35736f['id'],_0x35736f);DashboardItemEvents[_0x01a5('0x6')](_0x251950,_0x35736f);_0x2fd333(null);};}for(var e in events){if(events[_0x01a5('0x7')](e)){var event=events[e];DashboardItem[_0x01a5('0x8')](e,emitEvent(event));}}module[_0x01a5('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x9470=['../../mysqldb','DashboardItem','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1c7985,_0x13f68f){var _0x3efa33=function(_0x64a295){while(--_0x64a295){_0x1c7985['push'](_0x1c7985['shift']());}};_0x3efa33(++_0x13f68f);}(_0x9470,0x98));var _0x0947=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0x9470[_0x271537];return _0x19dc22;};'use strict';var EventEmitter=require(_0x0947('0x0'));var DashboardItem=require(_0x0947('0x1'))['db'][_0x0947('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0947('0x3'),'afterUpdate':_0x0947('0x4'),'afterDestroy':_0x0947('0x5')};function emitEvent(_0x3e299e){return function(_0x34969a,_0x2045f5,_0x4c2261){DashboardItemEvents[_0x0947('0x6')](_0x3e299e+':'+_0x34969a['id'],_0x34969a);DashboardItemEvents[_0x0947('0x6')](_0x3e299e,_0x34969a);_0x4c2261(null);};}for(var e in events){if(events[_0x0947('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x0947('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 9f66381..a1f90ca 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 _0x2d19=['./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x1f8f22,_0x56552b){var _0x48d097=function(_0xf17ba){while(--_0xf17ba){_0x1f8f22['push'](_0x1f8f22['shift']());}};_0x48d097(++_0x56552b);}(_0x2d19,0x1b5));var _0x92d1=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x2d19[_0x48c2ae];return _0x8f7531;};'use strict';var _=require(_0x92d1('0x0'));var util=require('util');var logger=require(_0x92d1('0x1'))(_0x92d1('0x2'));var moment=require(_0x92d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x92d1('0x4'));var fs=require('fs');var path=require(_0x92d1('0x5'));var rimraf=require('rimraf');var config=require(_0x92d1('0x6'));var attributes=require(_0x92d1('0x7'));module[_0x92d1('0x8')]=function(_0x4e7929,_0x3cc294){return _0x4e7929[_0x92d1('0x9')](_0x92d1('0xa'),attributes,{'tableName':_0x92d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8c0=['exports','DashboardItem','dashboard_items','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes'];(function(_0x52b397,_0x1a5fda){var _0x1f5c02=function(_0x3196f9){while(--_0x3196f9){_0x52b397['push'](_0x52b397['shift']());}};_0x1f5c02(++_0x1a5fda);}(_0xc8c0,0x100));var _0x0c8c=function(_0x3b3b49,_0x35a502){_0x3b3b49=_0x3b3b49-0x0;var _0x1ca266=_0xc8c0[_0x3b3b49];return _0x1ca266;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c8c('0x0'))(_0x0c8c('0x1'));var moment=require(_0x0c8c('0x2'));var BPromise=require(_0x0c8c('0x3'));var rp=require(_0x0c8c('0x4'));var fs=require('fs');var path=require(_0x0c8c('0x5'));var rimraf=require('rimraf');var config=require(_0x0c8c('0x6'));var attributes=require(_0x0c8c('0x7'));module[_0x0c8c('0x8')]=function(_0x148e26,_0x4616a3){return _0x148e26['define'](_0x0c8c('0x9'),attributes,{'tableName':_0x0c8c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 348b624..e4f9f72 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 _0x53ee=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x53ee,0x1b8));var _0xe53e=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x53ee[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xe53e('0x0'));var util=require(_0xe53e('0x1'));var moment=require(_0xe53e('0x2'));var BPromise=require(_0xe53e('0x3'));var rs=require(_0xe53e('0x4'));var fs=require('fs');var Redis=require(_0xe53e('0x5'));var db=require(_0xe53e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe53e('0x7'));var jayson=require(_0xe53e('0x8'));var client=jayson[_0xe53e('0x9')][_0xe53e('0xa')]({'port':0x232a});config['redis']=_[_0xe53e('0xb')](config['redis'],{'host':_0xe53e('0xc'),'port':0x18eb});var socket=require(_0xe53e('0xd'))(new Redis(config[_0xe53e('0xe')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x56b2a0,_0x5ba1a6,_0x2ea65e){return new BPromise(function(_0xa5fb2d,_0x872dab){return client['request'](_0x56b2a0,_0x2ea65e)[_0xe53e('0xf')](function(_0x99d968){logger['info'](_0xe53e('0x10'),_0x5ba1a6,'request\x20sent');logger[_0xe53e('0x11')](_0xe53e('0x12'),_0x5ba1a6,_0xe53e('0x13'),JSON['stringify'](_0x99d968));if(_0x99d968[_0xe53e('0x14')]){if(_0x99d968[_0xe53e('0x14')][_0xe53e('0x15')]===0x1f4){logger[_0xe53e('0x14')](_0xe53e('0x10'),_0x5ba1a6,_0x99d968[_0xe53e('0x14')][_0xe53e('0x16')]);return _0x872dab(_0x99d968[_0xe53e('0x14')]['message']);}logger[_0xe53e('0x14')](_0xe53e('0x10'),_0x5ba1a6,_0x99d968[_0xe53e('0x14')][_0xe53e('0x16')]);return _0xa5fb2d(_0x99d968[_0xe53e('0x14')]['message']);}else{logger[_0xe53e('0x17')](_0xe53e('0x10'),_0x5ba1a6,_0xe53e('0x13'));_0xa5fb2d(_0x99d968[_0xe53e('0x18')]['message']);}})[_0xe53e('0x19')](function(_0x58035e){logger[_0xe53e('0x14')](_0xe53e('0x10'),_0x5ba1a6,_0x58035e);_0x872dab(_0x58035e);});});} \ No newline at end of file +var _0xde0a=['rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30a234,_0x3109ea){var _0x10e920=function(_0x515472){while(--_0x515472){_0x30a234['push'](_0x30a234['shift']());}};_0x10e920(++_0x3109ea);}(_0xde0a,0xad));var _0xade0=function(_0x1f65e5,_0x30203a){_0x1f65e5=_0x1f65e5-0x0;var _0x25ddb8=_0xde0a[_0x1f65e5];return _0x25ddb8;};'use strict';var _=require(_0xade0('0x0'));var util=require(_0xade0('0x1'));var moment=require(_0xade0('0x2'));var BPromise=require(_0xade0('0x3'));var rs=require(_0xade0('0x4'));var fs=require('fs');var Redis=require(_0xade0('0x5'));var db=require(_0xade0('0x6'))['db'];var utils=require(_0xade0('0x7'));var logger=require(_0xade0('0x8'))(_0xade0('0x9'));var config=require('../../config/environment');var jayson=require(_0xade0('0xa'));var client=jayson[_0xade0('0xb')][_0xade0('0xc')]({'port':0x232a});config[_0xade0('0xd')]=_['defaults'](config[_0xade0('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xade0('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xade0('0xf')](socket);function respondWithRpcPromise(_0x4c13de,_0x5a82e9,_0x498281){return new BPromise(function(_0x56b62a,_0x4e3a54){return client[_0xade0('0x10')](_0x4c13de,_0x498281)['then'](function(_0x3e996e){logger[_0xade0('0x11')](_0xade0('0x12'),_0x5a82e9,'request\x20sent');logger[_0xade0('0x13')](_0xade0('0x14'),_0x5a82e9,_0xade0('0x15'),JSON['stringify'](_0x3e996e));if(_0x3e996e[_0xade0('0x16')]){if(_0x3e996e[_0xade0('0x16')]['code']===0x1f4){logger[_0xade0('0x16')](_0xade0('0x12'),_0x5a82e9,_0x3e996e[_0xade0('0x16')][_0xade0('0x17')]);return _0x4e3a54(_0x3e996e[_0xade0('0x16')][_0xade0('0x17')]);}logger[_0xade0('0x16')](_0xade0('0x12'),_0x5a82e9,_0x3e996e[_0xade0('0x16')][_0xade0('0x17')]);return _0x56b62a(_0x3e996e[_0xade0('0x16')][_0xade0('0x17')]);}else{logger[_0xade0('0x11')](_0xade0('0x12'),_0x5a82e9,_0xade0('0x15'));_0x56b62a(_0x3e996e[_0xade0('0x18')][_0xade0('0x17')]);}})[_0xade0('0x19')](function(_0x49d9e1){logger[_0xade0('0x16')](_0xade0('0x12'),_0x5a82e9,_0x49d9e1);_0x4e3a54(_0x49d9e1);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 995b2ab..9693ffb 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 _0xa12c=['removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa12c,0xc3));var _0xca12=function(_0xd18935,_0x27358a){_0xd18935=_0xd18935-0x0;var _0x5ac0a9=_0xa12c[_0xd18935];return _0x5ac0a9;};'use strict';var DashboardItemEvents=require(_0xca12('0x0'));var events=[_0xca12('0x1'),_0xca12('0x2'),_0xca12('0x3')];function createListener(_0x207887,_0x54d005){return function(_0x3a4849){_0x54d005[_0xca12('0x4')](_0x207887,_0x3a4849);};}function removeListener(_0x4976d1,_0x24b012){return function(){DashboardItemEvents[_0xca12('0x5')](_0x4976d1,_0x24b012);};}exports[_0xca12('0x6')]=function(_0x11bbb4){for(var _0x257b6a=0x0,_0x4470aa=events['length'];_0x257b6a<_0x4470aa;_0x257b6a++){var _0x1977a4=events[_0x257b6a];var _0xc3b94c=createListener(_0xca12('0x7')+_0x1977a4,_0x11bbb4);DashboardItemEvents['on'](_0x1977a4,_0xc3b94c);}}; \ No newline at end of file +var _0x8c40=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x8c40,0xfd));var _0x08c4=function(_0x41df04,_0x443cd4){_0x41df04=_0x41df04-0x0;var _0x2ba8a9=_0x8c40[_0x41df04];return _0x2ba8a9;};'use strict';var DashboardItemEvents=require(_0x08c4('0x0'));var events=[_0x08c4('0x1'),_0x08c4('0x2'),'update'];function createListener(_0x1f3c4e,_0x321be8){return function(_0x4e61c6){_0x321be8[_0x08c4('0x3')](_0x1f3c4e,_0x4e61c6);};}function removeListener(_0x43c570,_0x3161b9){return function(){DashboardItemEvents[_0x08c4('0x4')](_0x43c570,_0x3161b9);};}exports[_0x08c4('0x5')]=function(_0x210984){for(var _0x17e96e=0x0,_0x674131=events[_0x08c4('0x6')];_0x17e96e<_0x674131;_0x17e96e++){var _0x373d67=events[_0x17e96e];var _0x3a011d=createListener(_0x08c4('0x7')+_0x373d67,_0x210984);DashboardItemEvents['on'](_0x373d67,_0x3a011d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d1d31d0..8fe269a 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 _0x62b4=['/:id','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put'];(function(_0x54d96a,_0x1ea8e8){var _0x591570=function(_0x401b69){while(--_0x401b69){_0x54d96a['push'](_0x54d96a['shift']());}};_0x591570(++_0x1ea8e8);}(_0x62b4,0xf4));var _0x462b=function(_0x70a8a5,_0x35a384){_0x70a8a5=_0x70a8a5-0x0;var _0x2b563b=_0x62b4[_0x70a8a5];return _0x2b563b;};'use strict';var multer=require('multer');var util=require(_0x462b('0x0'));var path=require(_0x462b('0x1'));var timeout=require('connect-timeout');var express=require(_0x462b('0x2'));var router=express['Router']();var fs_extra=require(_0x462b('0x3'));var auth=require(_0x462b('0x4'));var interaction=require(_0x462b('0x5'));var config=require(_0x462b('0x6'));var controller=require('./dashboardItem.controller');router[_0x462b('0x7')]('/:id',auth[_0x462b('0x8')](),controller[_0x462b('0x9')]);router[_0x462b('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x462b('0xb')](_0x462b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x462b('0xd')](_0x462b('0xc'),auth[_0x462b('0x8')](),controller[_0x462b('0xe')]);module[_0x462b('0xf')]=router; \ No newline at end of file +var _0x6bf8=['fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','show','isAuthenticated','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x6bf8,0x66));var _0x86bf=function(_0x1fa022,_0x5a1b71){_0x1fa022=_0x1fa022-0x0;var _0x1098d7=_0x6bf8[_0x1fa022];return _0x1098d7;};'use strict';var multer=require(_0x86bf('0x0'));var util=require(_0x86bf('0x1'));var path=require(_0x86bf('0x2'));var timeout=require(_0x86bf('0x3'));var express=require(_0x86bf('0x4'));var router=express[_0x86bf('0x5')]();var fs_extra=require(_0x86bf('0x6'));var auth=require(_0x86bf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x86bf('0x8'));var controller=require(_0x86bf('0x9'));router[_0x86bf('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x86bf('0xb')]);router['post']('/',auth[_0x86bf('0xc')](),controller[_0x86bf('0xd')]);router[_0x86bf('0xe')](_0x86bf('0xf'),auth['isAuthenticated'](),controller[_0x86bf('0x10')]);router['delete'](_0x86bf('0xf'),auth[_0x86bf('0xc')](),controller[_0x86bf('0x11')]);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 db8355d..b657c90 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 _0x6c81=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x16d171,_0x1af4f3){var _0x188de6=function(_0x2cbc1c){while(--_0x2cbc1c){_0x16d171['push'](_0x16d171['shift']());}};_0x188de6(++_0x1af4f3);}(_0x6c81,0xec));var _0x16c8=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0x6c81[_0x5e7b6c];return _0x3afdbd;};'use strict';var Sequelize=require(_0x16c8('0x0'));module[_0x16c8('0x1')]={'name':{'type':Sequelize[_0x16c8('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x16c8('0x3')](_0x16c8('0x4'),_0x16c8('0x5'),_0x16c8('0x6')),'allowNull':![],'defaultValue':_0x16c8('0x4')},'description':{'type':Sequelize[_0x16c8('0x2')]}}; \ No newline at end of file +var _0xd5df=['exports','STRING','ENUM','second','third','first'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5df,0x1c2));var _0xfd5d=function(_0x30a8ee,_0x2ec9ff){_0x30a8ee=_0x30a8ee-0x0;var _0x58fcf5=_0xd5df[_0x30a8ee];return _0x58fcf5;};'use strict';var Sequelize=require('sequelize');module[_0xfd5d('0x0')]={'name':{'type':Sequelize[_0xfd5d('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xfd5d('0x2')]('first',_0xfd5d('0x3'),_0xfd5d('0x4')),'allowNull':![],'defaultValue':_0xfd5d('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 494a0fd..7debdab 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 _0xeeda=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','options','Disposition','includeAll','include','rows','catch','show','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xeeda,0x1be));var _0xaeed=function(_0xa81468,_0x2986eb){_0xa81468=_0xa81468-0x0;var _0x30383b=_0xeeda[_0xa81468];return _0x30383b;};'use strict';var emlformat=require(_0xaeed('0x0'));var rimraf=require(_0xaeed('0x1'));var zipdir=require(_0xaeed('0x2'));var jsonpatch=require(_0xaeed('0x3'));var rp=require(_0xaeed('0x4'));var moment=require(_0xaeed('0x5'));var BPromise=require(_0xaeed('0x6'));var Mustache=require(_0xaeed('0x7'));var util=require(_0xaeed('0x8'));var path=require(_0xaeed('0x9'));var sox=require(_0xaeed('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaeed('0xb'));var _=require(_0xaeed('0xc'));var squel=require(_0xaeed('0xd'));var crypto=require(_0xaeed('0xe'));var jsforce=require(_0xaeed('0xf'));var deskjs=require(_0xaeed('0x10'));var toCsv=require(_0xaeed('0x11'));var querystring=require(_0xaeed('0x12'));var Papa=require(_0xaeed('0x13'));var Redis=require(_0xaeed('0x14'));var authService=require(_0xaeed('0x15'));var qs=require(_0xaeed('0x16'));var as=require(_0xaeed('0x17'));var hardwareService=require(_0xaeed('0x18'));var logger=require(_0xaeed('0x19'))(_0xaeed('0x1a'));var utils=require(_0xaeed('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xaeed('0x1c'));var db=require(_0xaeed('0x1d'))['db'];function respondWithStatusCode(_0x5716a2,_0x4d9a67){_0x4d9a67=_0x4d9a67||0xcc;return function(_0x49e7a4){if(_0x49e7a4){return _0x5716a2[_0xaeed('0x1e')](_0x4d9a67);}return _0x5716a2[_0xaeed('0x1f')](_0x4d9a67)[_0xaeed('0x20')]();};}function respondWithResult(_0x4d3712,_0x4130e5){_0x4130e5=_0x4130e5||0xc8;return function(_0xcb1ecb){if(_0xcb1ecb){return _0x4d3712['status'](_0x4130e5)[_0xaeed('0x21')](_0xcb1ecb);}};}function respondWithFilteredResult(_0x178831,_0x72cdbe){return function(_0x4e649b){if(_0x4e649b){var _0x391ff6=typeof _0x72cdbe['offset']===_0xaeed('0x22')&&typeof _0x72cdbe[_0xaeed('0x23')]===_0xaeed('0x22');var _0x53aae7=_0x4e649b[_0xaeed('0x24')];var _0x54380=_0x391ff6?0x0:_0x72cdbe['offset'];var _0x38e512=_0x391ff6?_0x4e649b[_0xaeed('0x24')]:_0x72cdbe[_0xaeed('0x25')]+_0x72cdbe['limit'];var _0x3ceb5e;if(_0x38e512>=_0x53aae7){_0x38e512=_0x53aae7;_0x3ceb5e=0xc8;}else{_0x3ceb5e=0xce;}_0x178831['status'](_0x3ceb5e);return _0x178831['set']('Content-Range',_0x54380+'-'+_0x38e512+'/'+_0x53aae7)[_0xaeed('0x21')](_0x4e649b);}return null;};}function patchUpdates(_0x62e353){return function(_0x48c9a9){try{jsonpatch[_0xaeed('0x26')](_0x48c9a9,_0x62e353,!![]);}catch(_0x511475){return BPromise[_0xaeed('0x27')](_0x511475);}return _0x48c9a9[_0xaeed('0x28')]();};}function saveUpdates(_0x45e48b,_0x1a5481){return function(_0x23517a){if(_0x23517a){return _0x23517a[_0xaeed('0x29')](_0x45e48b)[_0xaeed('0x2a')](function(_0x128c0f){return _0x128c0f;});}return null;};}function removeEntity(_0x514561,_0x368ce5){return function(_0x3fb569){if(_0x3fb569){return _0x3fb569[_0xaeed('0x2b')]()[_0xaeed('0x2a')](function(){var _0x3833e7=_0x3fb569[_0xaeed('0x2c')]({'plain':!![]});var _0x13bf50=_0xaeed('0x2d');return db[_0xaeed('0x2e')]['destroy']({'where':{'type':_0x13bf50,'resourceId':_0x3833e7['id']}})[_0xaeed('0x2a')](function(){return _0x3fb569;});})['then'](function(){_0x514561[_0xaeed('0x1f')](0xcc)[_0xaeed('0x20')]();});}};}function handleEntityNotFound(_0x596af9,_0x3c8d46){return function(_0x3c377a){if(!_0x3c377a){_0x596af9[_0xaeed('0x1e')](0x194);}return _0x3c377a;};}function handleError(_0x912604,_0x45bbf7){_0x45bbf7=_0x45bbf7||0x1f4;return function(_0x45455f){logger[_0xaeed('0x2f')](_0x45455f[_0xaeed('0x30')]);if(_0x45455f['name']){delete _0x45455f[_0xaeed('0x31')];}_0x912604[_0xaeed('0x1f')](_0x45bbf7)[_0xaeed('0x32')](_0x45455f);};}exports[_0xaeed('0x33')]=function(_0x369114,_0x4b41c1){var _0x1801ef={},_0x5507b4={},_0x1ec23b={'count':0x0,'rows':[]};var _0x13d7ec=_[_0xaeed('0x34')](db['Disposition']['rawAttributes'],function(_0x505751){return{'name':_0x505751['fieldName'],'type':_0x505751[_0xaeed('0x35')][_0xaeed('0x36')]};});_0x5507b4[_0xaeed('0x37')]=_[_0xaeed('0x34')](_0x13d7ec,_0xaeed('0x31'));_0x5507b4[_0xaeed('0x38')]=_[_0xaeed('0x39')](_0x369114[_0xaeed('0x38')]);_0x5507b4['filters']=_[_0xaeed('0x3a')](_0x5507b4[_0xaeed('0x37')],_0x5507b4[_0xaeed('0x38')]);_0x1801ef[_0xaeed('0x3b')]=_[_0xaeed('0x3a')](_0x5507b4[_0xaeed('0x37')],qs[_0xaeed('0x3c')](_0x369114['query'][_0xaeed('0x3c')]));_0x1801ef['attributes']=_0x1801ef['attributes'][_0xaeed('0x3d')]?_0x1801ef[_0xaeed('0x3b')]:_0x5507b4[_0xaeed('0x37')];if(!_0x369114['query'][_0xaeed('0x3e')](_0xaeed('0x3f'))){_0x1801ef[_0xaeed('0x23')]=qs[_0xaeed('0x23')](_0x369114[_0xaeed('0x38')]['limit']);_0x1801ef[_0xaeed('0x25')]=qs[_0xaeed('0x25')](_0x369114[_0xaeed('0x38')][_0xaeed('0x25')]);}_0x1801ef[_0xaeed('0x40')]=qs[_0xaeed('0x41')](_0x369114['query'][_0xaeed('0x41')]);_0x1801ef['where']=qs[_0xaeed('0x42')](_['pick'](_0x369114[_0xaeed('0x38')],_0x5507b4['filters']),_0x13d7ec);if(_0x369114['query'][_0xaeed('0x43')]){_0x1801ef[_0xaeed('0x44')]=_['merge'](_0x1801ef[_0xaeed('0x44')],{'$or':_[_0xaeed('0x34')](_0x13d7ec,function(_0x5d8364){if(_0x5d8364['type']!==_0xaeed('0x45')){var _0x3c2aa3={};_0x3c2aa3[_0x5d8364[_0xaeed('0x31')]]={'$like':'%'+_0x369114[_0xaeed('0x38')]['filter']+'%'};return _0x3c2aa3;}})});}_0x1801ef=_['merge']({},_0x1801ef,_0x369114[_0xaeed('0x46')]);var _0x306ab2={'where':_0x1801ef[_0xaeed('0x44')]};return db[_0xaeed('0x47')][_0xaeed('0x24')](_0x306ab2)[_0xaeed('0x2a')](function(_0x567624){_0x1ec23b[_0xaeed('0x24')]=_0x567624;if(_0x369114[_0xaeed('0x38')][_0xaeed('0x48')]){_0x1801ef[_0xaeed('0x49')]=[{'all':!![]}];}return db[_0xaeed('0x47')]['findAll'](_0x1801ef);})[_0xaeed('0x2a')](function(_0x5ca00a){_0x1ec23b[_0xaeed('0x4a')]=_0x5ca00a;return _0x1ec23b;})['then'](respondWithFilteredResult(_0x4b41c1,_0x1801ef))[_0xaeed('0x4b')](handleError(_0x4b41c1,null));};exports[_0xaeed('0x4c')]=function(_0x4ce5db,_0x3861da){var _0x324424={'raw':!![],'where':{'id':_0x4ce5db['params']['id']}},_0x5a1f87={};_0x5a1f87[_0xaeed('0x37')]=_['keys'](db[_0xaeed('0x47')][_0xaeed('0x4d')]);_0x5a1f87[_0xaeed('0x38')]=_[_0xaeed('0x39')](_0x4ce5db[_0xaeed('0x38')]);_0x5a1f87['filters']=_[_0xaeed('0x3a')](_0x5a1f87[_0xaeed('0x37')],_0x5a1f87['query']);_0x324424['attributes']=_['intersection'](_0x5a1f87[_0xaeed('0x37')],qs[_0xaeed('0x3c')](_0x4ce5db[_0xaeed('0x38')][_0xaeed('0x3c')]));_0x324424['attributes']=_0x324424['attributes'][_0xaeed('0x3d')]?_0x324424[_0xaeed('0x3b')]:_0x5a1f87[_0xaeed('0x37')];if(_0x4ce5db[_0xaeed('0x38')][_0xaeed('0x48')]){_0x324424[_0xaeed('0x49')]=[{'all':!![]}];}_0x324424=_[_0xaeed('0x4e')]({},_0x324424,_0x4ce5db[_0xaeed('0x46')]);return db[_0xaeed('0x47')][_0xaeed('0x4f')](_0x324424)[_0xaeed('0x2a')](handleEntityNotFound(_0x3861da,null))[_0xaeed('0x2a')](respondWithResult(_0x3861da,null))[_0xaeed('0x4b')](handleError(_0x3861da,null));};exports[_0xaeed('0x50')]=function(_0x254bef,_0xb9c251){return db[_0xaeed('0x47')][_0xaeed('0x50')](_0x254bef[_0xaeed('0x51')],{})[_0xaeed('0x2a')](function(_0x14aed9){var _0x504e94=_0x254bef[_0xaeed('0x52')][_0xaeed('0x2c')]({'plain':!![]});if(!_0x504e94)throw new Error(_0xaeed('0x53'));if(_0x504e94['role']===_0xaeed('0x52')){var _0x4fd05b=_0x14aed9['get']({'plain':!![]});var _0x5d11c5='Dispositions';return db[_0xaeed('0x54')][_0xaeed('0x4f')]({'where':{'name':_0x5d11c5,'userProfileId':_0x504e94[_0xaeed('0x55')]},'raw':!![]})[_0xaeed('0x2a')](function(_0x1242df){if(_0x1242df&&_0x1242df[_0xaeed('0x56')]===0x0){return db[_0xaeed('0x2e')][_0xaeed('0x50')]({'name':_0x4fd05b[_0xaeed('0x31')],'resourceId':_0x4fd05b['id'],'type':_0x1242df[_0xaeed('0x31')],'sectionId':_0x1242df['id']},{})[_0xaeed('0x2a')](function(){return _0x14aed9;});}else{return _0x14aed9;}})[_0xaeed('0x4b')](function(_0x8576ae){logger[_0xaeed('0x2f')](_0xaeed('0x57'),_0x8576ae);throw _0x8576ae;});}return _0x14aed9;})[_0xaeed('0x2a')](respondWithResult(_0xb9c251,0xc9))[_0xaeed('0x4b')](handleError(_0xb9c251,null));};exports['update']=function(_0x4fcb8d,_0x33ece9){if(_0x4fcb8d[_0xaeed('0x51')]['id']){delete _0x4fcb8d[_0xaeed('0x51')]['id'];}return db[_0xaeed('0x47')][_0xaeed('0x4f')]({'where':{'id':_0x4fcb8d[_0xaeed('0x58')]['id']}})[_0xaeed('0x2a')](handleEntityNotFound(_0x33ece9,null))['then'](saveUpdates(_0x4fcb8d[_0xaeed('0x51')],null))['then'](respondWithResult(_0x33ece9,null))[_0xaeed('0x4b')](handleError(_0x33ece9,null));};exports[_0xaeed('0x2b')]=function(_0x59d244,_0x4a9b77){return db['Disposition']['find']({'where':{'id':_0x59d244['params']['id']}})[_0xaeed('0x2a')](handleEntityNotFound(_0x4a9b77,null))['then'](removeEntity(_0x4a9b77,null))[_0xaeed('0x4b')](handleError(_0x4a9b77,null));}; \ No newline at end of file +var _0x94ba=['where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x284626,_0xc26002){var _0x17a2cf=function(_0x46a377){while(--_0x46a377){_0x284626['push'](_0x284626['shift']());}};_0x17a2cf(++_0xc26002);}(_0x94ba,0xbe));var _0xa94b=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x94ba[_0xd578cb];return _0x775533;};'use strict';var emlformat=require(_0xa94b('0x0'));var rimraf=require(_0xa94b('0x1'));var zipdir=require(_0xa94b('0x2'));var jsonpatch=require(_0xa94b('0x3'));var rp=require(_0xa94b('0x4'));var moment=require('moment');var BPromise=require(_0xa94b('0x5'));var Mustache=require('mustache');var util=require(_0xa94b('0x6'));var path=require(_0xa94b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa94b('0x8'));var fs=require('fs');var fs_extra=require(_0xa94b('0x9'));var _=require(_0xa94b('0xa'));var squel=require(_0xa94b('0xb'));var crypto=require('crypto');var jsforce=require(_0xa94b('0xc'));var deskjs=require(_0xa94b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa94b('0xe'));var Redis=require(_0xa94b('0xf'));var authService=require(_0xa94b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa94b('0x11'));var hardwareService=require(_0xa94b('0x12'));var logger=require(_0xa94b('0x13'))(_0xa94b('0x14'));var utils=require(_0xa94b('0x15'));var config=require(_0xa94b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa94b('0x17'))['db'];function respondWithStatusCode(_0x107c24,_0x25bb50){_0x25bb50=_0x25bb50||0xcc;return function(_0x258bd6){if(_0x258bd6){return _0x107c24[_0xa94b('0x18')](_0x25bb50);}return _0x107c24[_0xa94b('0x19')](_0x25bb50)[_0xa94b('0x1a')]();};}function respondWithResult(_0x4057cf,_0x557f4c){_0x557f4c=_0x557f4c||0xc8;return function(_0x38d344){if(_0x38d344){return _0x4057cf[_0xa94b('0x19')](_0x557f4c)['json'](_0x38d344);}};}function respondWithFilteredResult(_0xea3a9f,_0x5a7b9e){return function(_0x5465cf){if(_0x5465cf){var _0x511a2a=typeof _0x5a7b9e[_0xa94b('0x1b')]===_0xa94b('0x1c')&&typeof _0x5a7b9e[_0xa94b('0x1d')]===_0xa94b('0x1c');var _0x15d9d8=_0x5465cf[_0xa94b('0x1e')];var _0x37a08d=_0x511a2a?0x0:_0x5a7b9e[_0xa94b('0x1b')];var _0x34049f=_0x511a2a?_0x5465cf[_0xa94b('0x1e')]:_0x5a7b9e[_0xa94b('0x1b')]+_0x5a7b9e[_0xa94b('0x1d')];var _0x24e2b0;if(_0x34049f>=_0x15d9d8){_0x34049f=_0x15d9d8;_0x24e2b0=0xc8;}else{_0x24e2b0=0xce;}_0xea3a9f[_0xa94b('0x19')](_0x24e2b0);return _0xea3a9f[_0xa94b('0x1f')](_0xa94b('0x20'),_0x37a08d+'-'+_0x34049f+'/'+_0x15d9d8)[_0xa94b('0x21')](_0x5465cf);}return null;};}function patchUpdates(_0x14ba3b){return function(_0x44f20f){try{jsonpatch[_0xa94b('0x22')](_0x44f20f,_0x14ba3b,!![]);}catch(_0x394ac9){return BPromise['reject'](_0x394ac9);}return _0x44f20f[_0xa94b('0x23')]();};}function saveUpdates(_0x1db31b,_0x2740b4){return function(_0x1f2133){if(_0x1f2133){return _0x1f2133[_0xa94b('0x24')](_0x1db31b)[_0xa94b('0x25')](function(_0x20034a){return _0x20034a;});}return null;};}function removeEntity(_0x580b9e,_0x426ded){return function(_0x987123){if(_0x987123){return _0x987123[_0xa94b('0x26')]()[_0xa94b('0x25')](function(){var _0x29df3d=_0x987123[_0xa94b('0x27')]({'plain':!![]});var _0x6aa3e1=_0xa94b('0x28');return db[_0xa94b('0x29')]['destroy']({'where':{'type':_0x6aa3e1,'resourceId':_0x29df3d['id']}})['then'](function(){return _0x987123;});})[_0xa94b('0x25')](function(){_0x580b9e[_0xa94b('0x19')](0xcc)[_0xa94b('0x1a')]();});}};}function handleEntityNotFound(_0x1c598d,_0x242a7e){return function(_0x439d96){if(!_0x439d96){_0x1c598d[_0xa94b('0x18')](0x194);}return _0x439d96;};}function handleError(_0x539b33,_0x5cdbe1){_0x5cdbe1=_0x5cdbe1||0x1f4;return function(_0x1508e3){logger['error'](_0x1508e3[_0xa94b('0x2a')]);if(_0x1508e3[_0xa94b('0x2b')]){delete _0x1508e3[_0xa94b('0x2b')];}_0x539b33[_0xa94b('0x19')](_0x5cdbe1)[_0xa94b('0x2c')](_0x1508e3);};}exports['index']=function(_0x31573d,_0x35d24d){var _0x5783cf={},_0x38c9e2={},_0x548b86={'count':0x0,'rows':[]};var _0x173027=_[_0xa94b('0x2d')](db[_0xa94b('0x2e')][_0xa94b('0x2f')],function(_0x24d588){return{'name':_0x24d588[_0xa94b('0x30')],'type':_0x24d588[_0xa94b('0x31')][_0xa94b('0x32')]};});_0x38c9e2[_0xa94b('0x33')]=_[_0xa94b('0x2d')](_0x173027,_0xa94b('0x2b'));_0x38c9e2['query']=_[_0xa94b('0x34')](_0x31573d[_0xa94b('0x35')]);_0x38c9e2[_0xa94b('0x36')]=_[_0xa94b('0x37')](_0x38c9e2[_0xa94b('0x33')],_0x38c9e2[_0xa94b('0x35')]);_0x5783cf[_0xa94b('0x38')]=_[_0xa94b('0x37')](_0x38c9e2[_0xa94b('0x33')],qs[_0xa94b('0x39')](_0x31573d[_0xa94b('0x35')][_0xa94b('0x39')]));_0x5783cf[_0xa94b('0x38')]=_0x5783cf[_0xa94b('0x38')][_0xa94b('0x3a')]?_0x5783cf[_0xa94b('0x38')]:_0x38c9e2[_0xa94b('0x33')];if(!_0x31573d['query'][_0xa94b('0x3b')](_0xa94b('0x3c'))){_0x5783cf[_0xa94b('0x1d')]=qs[_0xa94b('0x1d')](_0x31573d['query'][_0xa94b('0x1d')]);_0x5783cf[_0xa94b('0x1b')]=qs['offset'](_0x31573d[_0xa94b('0x35')][_0xa94b('0x1b')]);}_0x5783cf['order']=qs[_0xa94b('0x3d')](_0x31573d[_0xa94b('0x35')][_0xa94b('0x3d')]);_0x5783cf[_0xa94b('0x3e')]=qs[_0xa94b('0x36')](_[_0xa94b('0x3f')](_0x31573d[_0xa94b('0x35')],_0x38c9e2[_0xa94b('0x36')]),_0x173027);if(_0x31573d['query'][_0xa94b('0x40')]){_0x5783cf[_0xa94b('0x3e')]=_['merge'](_0x5783cf[_0xa94b('0x3e')],{'$or':_[_0xa94b('0x2d')](_0x173027,function(_0x16695a){if(_0x16695a[_0xa94b('0x31')]!==_0xa94b('0x41')){var _0x2441fc={};_0x2441fc[_0x16695a[_0xa94b('0x2b')]]={'$like':'%'+_0x31573d[_0xa94b('0x35')]['filter']+'%'};return _0x2441fc;}})});}_0x5783cf=_[_0xa94b('0x42')]({},_0x5783cf,_0x31573d[_0xa94b('0x43')]);var _0x499e6d={'where':_0x5783cf['where']};return db[_0xa94b('0x2e')][_0xa94b('0x1e')](_0x499e6d)[_0xa94b('0x25')](function(_0x1dcdaa){_0x548b86[_0xa94b('0x1e')]=_0x1dcdaa;if(_0x31573d[_0xa94b('0x35')][_0xa94b('0x44')]){_0x5783cf['include']=[{'all':!![]}];}return db[_0xa94b('0x2e')][_0xa94b('0x45')](_0x5783cf);})[_0xa94b('0x25')](function(_0x56ad2d){_0x548b86[_0xa94b('0x46')]=_0x56ad2d;return _0x548b86;})['then'](respondWithFilteredResult(_0x35d24d,_0x5783cf))[_0xa94b('0x47')](handleError(_0x35d24d,null));};exports[_0xa94b('0x48')]=function(_0x54f906,_0x3d8f41){var _0x2765d6={'raw':!![],'where':{'id':_0x54f906['params']['id']}},_0x553584={};_0x553584[_0xa94b('0x33')]=_[_0xa94b('0x34')](db[_0xa94b('0x2e')]['rawAttributes']);_0x553584[_0xa94b('0x35')]=_['keys'](_0x54f906['query']);_0x553584[_0xa94b('0x36')]=_[_0xa94b('0x37')](_0x553584[_0xa94b('0x33')],_0x553584[_0xa94b('0x35')]);_0x2765d6[_0xa94b('0x38')]=_[_0xa94b('0x37')](_0x553584[_0xa94b('0x33')],qs[_0xa94b('0x39')](_0x54f906[_0xa94b('0x35')][_0xa94b('0x39')]));_0x2765d6[_0xa94b('0x38')]=_0x2765d6[_0xa94b('0x38')][_0xa94b('0x3a')]?_0x2765d6['attributes']:_0x553584['model'];if(_0x54f906['query'][_0xa94b('0x44')]){_0x2765d6[_0xa94b('0x49')]=[{'all':!![]}];}_0x2765d6=_[_0xa94b('0x42')]({},_0x2765d6,_0x54f906[_0xa94b('0x43')]);return db[_0xa94b('0x2e')][_0xa94b('0x4a')](_0x2765d6)[_0xa94b('0x25')](handleEntityNotFound(_0x3d8f41,null))[_0xa94b('0x25')](respondWithResult(_0x3d8f41,null))[_0xa94b('0x47')](handleError(_0x3d8f41,null));};exports[_0xa94b('0x4b')]=function(_0x3d5c7f,_0x9aa8bc){return db[_0xa94b('0x2e')][_0xa94b('0x4b')](_0x3d5c7f[_0xa94b('0x4c')],{})[_0xa94b('0x25')](function(_0x5b3966){var _0x4c152c=_0x3d5c7f[_0xa94b('0x4d')][_0xa94b('0x27')]({'plain':!![]});if(!_0x4c152c)throw new Error(_0xa94b('0x4e'));if(_0x4c152c[_0xa94b('0x4f')]===_0xa94b('0x4d')){var _0x59cb88=_0x5b3966[_0xa94b('0x27')]({'plain':!![]});var _0x4fdf4c=_0xa94b('0x28');return db[_0xa94b('0x50')][_0xa94b('0x4a')]({'where':{'name':_0x4fdf4c,'userProfileId':_0x4c152c['userProfileId']},'raw':!![]})[_0xa94b('0x25')](function(_0x4c96ec){if(_0x4c96ec&&_0x4c96ec[_0xa94b('0x51')]===0x0){return db['UserProfileResource'][_0xa94b('0x4b')]({'name':_0x59cb88[_0xa94b('0x2b')],'resourceId':_0x59cb88['id'],'type':_0x4c96ec[_0xa94b('0x2b')],'sectionId':_0x4c96ec['id']},{})[_0xa94b('0x25')](function(){return _0x5b3966;});}else{return _0x5b3966;}})[_0xa94b('0x47')](function(_0x19b7c2){logger['error'](_0xa94b('0x52'),_0x19b7c2);throw _0x19b7c2;});}return _0x5b3966;})[_0xa94b('0x25')](respondWithResult(_0x9aa8bc,0xc9))[_0xa94b('0x47')](handleError(_0x9aa8bc,null));};exports['update']=function(_0x8bd2cc,_0x48936b){if(_0x8bd2cc[_0xa94b('0x4c')]['id']){delete _0x8bd2cc[_0xa94b('0x4c')]['id'];}return db['Disposition'][_0xa94b('0x4a')]({'where':{'id':_0x8bd2cc['params']['id']}})[_0xa94b('0x25')](handleEntityNotFound(_0x48936b,null))[_0xa94b('0x25')](saveUpdates(_0x8bd2cc[_0xa94b('0x4c')],null))[_0xa94b('0x25')](respondWithResult(_0x48936b,null))[_0xa94b('0x47')](handleError(_0x48936b,null));};exports[_0xa94b('0x26')]=function(_0x4e3c95,_0x305f25){return db[_0xa94b('0x2e')][_0xa94b('0x4a')]({'where':{'id':_0x4e3c95[_0xa94b('0x53')]['id']}})[_0xa94b('0x25')](handleEntityNotFound(_0x305f25,null))[_0xa94b('0x25')](removeEntity(_0x305f25,null))[_0xa94b('0x47')](handleError(_0x305f25,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a689714..72b5c66 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 _0x2114=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_chat','name','ChatWebsiteId','name_mail','SmsAccountId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2114,0x1bd));var _0x4211=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x2114[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0x4211('0x0'));var util=require(_0x4211('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4211('0x2'));var BPromise=require(_0x4211('0x3'));var rp=require(_0x4211('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4211('0x5'));var config=require(_0x4211('0x6'));var attributes=require(_0x4211('0x7'));module[_0x4211('0x8')]=function(_0x4d07f4,_0x3a45b7){return _0x4d07f4[_0x4211('0x9')](_0x4211('0xa'),attributes,{'tableName':_0x4211('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x4211('0xc'),'fields':[_0x4211('0xd'),_0x4211('0xe')]},{'unique':!![],'name':_0x4211('0xf'),'fields':[_0x4211('0xd'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x4211('0xd'),_0x4211('0x10')]},{'unique':!![],'name':_0x4211('0x11'),'fields':[_0x4211('0xd'),_0x4211('0x12')]},{'unique':!![],'name':_0x4211('0x13'),'fields':[_0x4211('0xd'),_0x4211('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x4211('0xd'),_0x4211('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd54c=['request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x8e445f,_0x23edd7){var _0x5286fb=function(_0x2b2004){while(--_0x2b2004){_0x8e445f['push'](_0x8e445f['shift']());}};_0x5286fb(++_0x23edd7);}(_0xd54c,0x1c2));var _0xcd54=function(_0x443875,_0x5d3b2d){_0x443875=_0x443875-0x0;var _0x48d344=_0xd54c[_0x443875];return _0x48d344;};'use strict';var _=require(_0xcd54('0x0'));var util=require(_0xcd54('0x1'));var logger=require(_0xcd54('0x2'))(_0xcd54('0x3'));var moment=require(_0xcd54('0x4'));var BPromise=require(_0xcd54('0x5'));var rp=require(_0xcd54('0x6'));var fs=require('fs');var path=require(_0xcd54('0x7'));var rimraf=require(_0xcd54('0x8'));var config=require(_0xcd54('0x9'));var attributes=require(_0xcd54('0xa'));module[_0xcd54('0xb')]=function(_0x32bc14,_0x3b0c4b){return _0x32bc14['define'](_0xcd54('0xc'),attributes,{'tableName':_0xcd54('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xcd54('0xe'),_0xcd54('0xf')]},{'unique':!![],'name':_0xcd54('0x10'),'fields':[_0xcd54('0xe'),_0xcd54('0x11')]},{'unique':!![],'name':_0xcd54('0x12'),'fields':[_0xcd54('0xe'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':_0xcd54('0x13'),'fields':[_0xcd54('0xe'),_0xcd54('0x14')]},{'unique':!![],'name':_0xcd54('0x15'),'fields':[_0xcd54('0xe'),_0xcd54('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xcd54('0xe'),_0xcd54('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 1998431..71889c7 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(_0x8333f8,_0x23afe0){var _0xaa6fe0=function(_0x21a154){while(--_0x21a154){_0x8333f8['push'](_0x8333f8['shift']());}};_0xaa6fe0(++_0x23afe0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x550dce,_0x1ecf3b){var _0x55ca00=function(_0x157171){while(--_0x157171){_0x550dce['push'](_0x550dce['shift']());}};_0x55ca00(++_0x1ecf3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 5c183c1..3e01d2b 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 _0xfb3f=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xfb3f,0xe9));var _0xffb3=function(_0x231c70,_0x3a6518){_0x231c70=_0x231c70-0x0;var _0x245dcf=_0xfb3f[_0x231c70];return _0x245dcf;};'use strict';var multer=require('multer');var util=require(_0xffb3('0x0'));var path=require(_0xffb3('0x1'));var timeout=require(_0xffb3('0x2'));var express=require(_0xffb3('0x3'));var router=express[_0xffb3('0x4')]();var fs_extra=require(_0xffb3('0x5'));var auth=require(_0xffb3('0x6'));var interaction=require(_0xffb3('0x7'));var config=require(_0xffb3('0x8'));var controller=require(_0xffb3('0x9'));router[_0xffb3('0xa')]('/',auth[_0xffb3('0xb')](),controller[_0xffb3('0xc')]);router[_0xffb3('0xa')](_0xffb3('0xd'),auth['isAuthenticated'](),controller[_0xffb3('0xe')]);router[_0xffb3('0xf')]('/',auth['isAuthenticated'](),controller[_0xffb3('0x10')]);router['put'](_0xffb3('0xd'),auth[_0xffb3('0xb')](),controller[_0xffb3('0x11')]);router[_0xffb3('0x12')]('/:id',auth[_0xffb3('0xb')](),controller[_0xffb3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x37cc=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','create','put','/:id','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0x37cc,0x162));var _0xc37c=function(_0x3e4f8b,_0x3754ab){_0x3e4f8b=_0x3e4f8b-0x0;var _0x3025d6=_0x37cc[_0x3e4f8b];return _0x3025d6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc37c('0x0'));var timeout=require(_0xc37c('0x1'));var express=require(_0xc37c('0x2'));var router=express[_0xc37c('0x3')]();var fs_extra=require(_0xc37c('0x4'));var auth=require(_0xc37c('0x5'));var interaction=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var controller=require(_0xc37c('0x8'));router[_0xc37c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc37c('0x9')]('/:id',auth[_0xc37c('0xa')](),controller[_0xc37c('0xb')]);router['post']('/',auth[_0xc37c('0xa')](),controller[_0xc37c('0xc')]);router[_0xc37c('0xd')](_0xc37c('0xe'),auth[_0xc37c('0xa')](),controller[_0xc37c('0xf')]);router[_0xc37c('0x10')](_0xc37c('0xe'),auth[_0xc37c('0xa')](),controller['destroy']);module[_0xc37c('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index c65d8b2..dcfb7c9 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 _0xd101=['KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','INTEGER','SIP','DADHI'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd101,0xc1));var _0x1d10=function(_0x58ee90,_0x63a4f8){_0x58ee90=_0x58ee90-0x0;var _0x5769e9=_0xd101[_0x58ee90];return _0x5769e9;};'use strict';var Sequelize=require(_0x1d10('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d10('0x1')]},'ecm':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x3'),'no'),'defaultValue':_0x1d10('0x3')},'headerinfo':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':_0x1d10('0x4')},'localstationid':{'type':Sequelize[_0x1d10('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x5'),_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),_0x1d10('0x9'),_0x1d10('0xa')),'defaultValue':_0x1d10('0x6')},'maxrate':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x5'),_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),_0x1d10('0x9'),_0x1d10('0xa')),'defaultValue':_0x1d10('0xa')},'modem':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1d10('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0xc'),'IAX',_0x1d10('0xd'),_0x1d10('0xe')),'defaultValue':_0x1d10('0xc')},'key':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1d10('0xf')],'defaultValue':function(){return _0x1d10('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d10('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x1d10('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![],'comment':_0x1d10('0x13'),'set':function(_0x4528a6){if(!_0x4528a6)this['setDataValue'](_0x1d10('0x14'),null);this[_0x1d10('0x15')](_0x1d10('0x16'),_0x4528a6);}}}; \ No newline at end of file +var _0x8d0a=['SIP','IAX','DADHI','KHOMP','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER'];(function(_0xacee4a,_0x11f83b){var _0xf5f745=function(_0x3a5197){while(--_0x3a5197){_0xacee4a['push'](_0xacee4a['shift']());}};_0xf5f745(++_0x11f83b);}(_0x8d0a,0x65));var _0xa8d0=function(_0x4f2b17,_0x2312c3){_0x4f2b17=_0x4f2b17-0x0;var _0x1b45ab=_0x8d0a[_0x4f2b17];return _0x1b45ab;};'use strict';var Sequelize=require(_0xa8d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa8d0('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa8d0('0x1')]},'ecm':{'type':Sequelize[_0xa8d0('0x2')](_0xa8d0('0x3'),'no'),'defaultValue':_0xa8d0('0x3')},'headerinfo':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':_0xa8d0('0x4')},'localstationid':{'type':Sequelize[_0xa8d0('0x1')],'unique':_0xa8d0('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xa8d0('0x6'),_0xa8d0('0x7'),_0xa8d0('0x8'),_0xa8d0('0x9'),_0xa8d0('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xa8d0('0x2')](_0xa8d0('0x6'),'4800','7200','9600',_0xa8d0('0xa'),'14400'),'defaultValue':_0xa8d0('0xb')},'modem':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':_0xa8d0('0xc')},'gateway':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa8d0('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa8d0('0x2')](_0xa8d0('0xe'),_0xa8d0('0xf'),_0xa8d0('0x10'),_0xa8d0('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa8d0('0x1')],'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[_0xa8d0('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa8d0('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa8d0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa8d0('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa8d0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa8d0('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa8d0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa8d0('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa8d0('0x12')],'defaultValue':![],'comment':_0xa8d0('0x13'),'set':function(_0x5cf619){if(!_0x5cf619)this[_0xa8d0('0x14')](_0xa8d0('0x15'),null);this['setDataValue'](_0xa8d0('0x16'),_0x5cf619);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7f59b52..8c60b97 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 _0x43e6=['findOne','hasOwnProperty','includeAll','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','User','Owner','internal','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','CDR(type)=inbound-fax','Set','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','push','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','./faxAccount.socket','register','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','destroy','FaxAccounts','sendStatus','stack','name','send','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','findAll','rows','show','params','Pause','keys','length','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions'];(function(_0x17f543,_0x420152){var _0x4a1345=function(_0xb05876){while(--_0xb05876){_0x17f543['push'](_0x17f543['shift']());}};_0x4a1345(++_0x420152);}(_0x43e6,0x11b));var _0x643e=function(_0x1f8619,_0x279f35){_0x1f8619=_0x1f8619-0x0;var _0x19ea04=_0x43e6[_0x1f8619];return _0x19ea04;};'use strict';var emlformat=require(_0x643e('0x0'));var rimraf=require(_0x643e('0x1'));var zipdir=require(_0x643e('0x2'));var jsonpatch=require(_0x643e('0x3'));var rp=require(_0x643e('0x4'));var moment=require(_0x643e('0x5'));var BPromise=require(_0x643e('0x6'));var Mustache=require(_0x643e('0x7'));var util=require(_0x643e('0x8'));var path=require(_0x643e('0x9'));var sox=require(_0x643e('0xa'));var csv=require(_0x643e('0xb'));var ejs=require(_0x643e('0xc'));var fs=require('fs');var fs_extra=require(_0x643e('0xd'));var _=require(_0x643e('0xe'));var squel=require(_0x643e('0xf'));var crypto=require(_0x643e('0x10'));var jsforce=require(_0x643e('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x643e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x643e('0x12'));var authService=require(_0x643e('0x13'));var qs=require(_0x643e('0x14'));var as=require(_0x643e('0x15'));var hardwareService=require(_0x643e('0x16'));var logger=require(_0x643e('0x17'))(_0x643e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x643e('0x19'));var db=require('../../mysqldb')['db'];config[_0x643e('0x1a')]=_['defaults'](config['redis'],{'host':_0x643e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x643e('0x1a')]));require(_0x643e('0x1c'))[_0x643e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x643e('0x1e')][_0x643e('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x516290,_0x100280,_0x507fac,_0x29eb70){return new BPromise(function(_0x5a2ae5,_0x2c391c){var _0x167a73=_0x29eb70||client;return _0x167a73['request'](_0x516290,_0x507fac)[_0x643e('0x20')](function(_0x2eaf94){logger['info'](_0x643e('0x21'),_0x100280,_0x643e('0x22'));logger[_0x643e('0x23')](_0x643e('0x24'),_0x100280,_0x643e('0x22'),JSON[_0x643e('0x25')](_0x2eaf94));if(_0x2eaf94[_0x643e('0x26')]){if(_0x2eaf94[_0x643e('0x26')]['code']===0x1f4){logger[_0x643e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x100280,_0x2eaf94[_0x643e('0x26')][_0x643e('0x27')]);return _0x2c391c(_0x2eaf94[_0x643e('0x26')][_0x643e('0x27')]);}logger[_0x643e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x100280,_0x2eaf94[_0x643e('0x26')]['message']);return _0x5a2ae5(_0x2eaf94[_0x643e('0x26')][_0x643e('0x27')]);}else{logger[_0x643e('0x28')](_0x643e('0x21'),_0x100280,_0x643e('0x22'));_0x5a2ae5(_0x2eaf94[_0x643e('0x29')]['message']);}})[_0x643e('0x2a')](function(_0x207763){logger[_0x643e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x100280,_0x207763);_0x2c391c(_0x207763);});});}function respondWithStatusCode(_0x5e2fc1,_0x4aef73){_0x4aef73=_0x4aef73||0xcc;return function(_0x362f5d){if(_0x362f5d){return _0x5e2fc1['sendStatus'](_0x4aef73);}return _0x5e2fc1[_0x643e('0x2b')](_0x4aef73)[_0x643e('0x2c')]();};}function respondWithResult(_0xdb0892,_0x1ee11c){_0x1ee11c=_0x1ee11c||0xc8;return function(_0x1956c4){if(_0x1956c4){return _0xdb0892['status'](_0x1ee11c)[_0x643e('0x2d')](_0x1956c4);}};}function respondWithFilteredResult(_0x3b0326,_0xbea1e3){return function(_0x55783b){if(_0x55783b){var _0x55a9b2=typeof _0xbea1e3['offset']==='undefined'&&typeof _0xbea1e3['limit']===_0x643e('0x2e');var _0x219dd9=_0x55783b['count'];var _0x30dac8=_0x55a9b2?0x0:_0xbea1e3[_0x643e('0x2f')];var _0x59f219=_0x55a9b2?_0x55783b[_0x643e('0x30')]:_0xbea1e3[_0x643e('0x2f')]+_0xbea1e3[_0x643e('0x31')];var _0x3305a0;if(_0x59f219>=_0x219dd9){_0x59f219=_0x219dd9;_0x3305a0=0xc8;}else{_0x3305a0=0xce;}_0x3b0326['status'](_0x3305a0);return _0x3b0326[_0x643e('0x32')](_0x643e('0x33'),_0x30dac8+'-'+_0x59f219+'/'+_0x219dd9)['json'](_0x55783b);}return null;};}function patchUpdates(_0x44260b){return function(_0x3bc5e8){try{jsonpatch['apply'](_0x3bc5e8,_0x44260b,!![]);}catch(_0x592a04){return BPromise[_0x643e('0x34')](_0x592a04);}return _0x3bc5e8[_0x643e('0x35')]();};}function saveUpdates(_0x22be8f,_0x1ad47e){return function(_0x2f4a1d){if(_0x2f4a1d){return _0x2f4a1d[_0x643e('0x36')](_0x22be8f)[_0x643e('0x20')](function(_0x52c291){return _0x52c291;});}return null;};}function removeEntity(_0x48c05c,_0x3e63ab){return function(_0x5ba131){if(_0x5ba131){return _0x5ba131[_0x643e('0x37')]()[_0x643e('0x20')](function(){var _0x3e09d4=_0x5ba131['get']({'plain':!![]});var _0xd49852=_0x643e('0x38');return db['UserProfileResource'][_0x643e('0x37')]({'where':{'type':_0xd49852,'resourceId':_0x3e09d4['id']}})[_0x643e('0x20')](function(){return _0x5ba131;});})['then'](function(){_0x48c05c[_0x643e('0x2b')](0xcc)[_0x643e('0x2c')]();});}};}function handleEntityNotFound(_0x5f2946,_0x35e920){return function(_0x2a5c99){if(!_0x2a5c99){_0x5f2946[_0x643e('0x39')](0x194);}return _0x2a5c99;};}function handleError(_0x47e3e0,_0x3f836f){_0x3f836f=_0x3f836f||0x1f4;return function(_0x437b9b){logger['error'](_0x437b9b[_0x643e('0x3a')]);if(_0x437b9b[_0x643e('0x3b')]){delete _0x437b9b[_0x643e('0x3b')];}_0x47e3e0['status'](_0x3f836f)[_0x643e('0x3c')](_0x437b9b);};}exports['index']=function(_0x578898,_0x35cf35){var _0x101743={'include':[{'model':db['Pause'],'as':_0x643e('0x3d')}]},_0x358581={},_0x353962={'count':0x0,'rows':[]};var _0x1daede=_['map'](db[_0x643e('0x3e')][_0x643e('0x3f')],function(_0x3a4478){return{'name':_0x3a4478[_0x643e('0x40')],'type':_0x3a4478[_0x643e('0x41')][_0x643e('0x42')]};});_0x358581[_0x643e('0x43')]=_[_0x643e('0x44')](_0x1daede,_0x643e('0x3b'));_0x358581[_0x643e('0x45')]=_['keys'](_0x578898[_0x643e('0x45')]);_0x358581[_0x643e('0x46')]=_[_0x643e('0x47')](_0x358581[_0x643e('0x43')],_0x358581['query']);_0x101743[_0x643e('0x48')]=_[_0x643e('0x47')](_0x358581[_0x643e('0x43')],qs[_0x643e('0x49')](_0x578898[_0x643e('0x45')][_0x643e('0x49')]));_0x101743[_0x643e('0x48')]=_0x101743[_0x643e('0x48')]['length']?_0x101743[_0x643e('0x48')]:_0x358581['model'];if(!_0x578898['query']['hasOwnProperty'](_0x643e('0x4a'))){_0x101743[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x578898[_0x643e('0x45')][_0x643e('0x31')]);_0x101743['offset']=qs['offset'](_0x578898['query'][_0x643e('0x2f')]);}_0x101743[_0x643e('0x4b')]=qs['sort'](_0x578898[_0x643e('0x45')][_0x643e('0x4c')]);_0x101743[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x578898['query'],_0x358581[_0x643e('0x46')]),_0x1daede);if(_0x578898[_0x643e('0x45')][_0x643e('0x4f')]){_0x101743[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x101743[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x1daede,function(_0x236a06){if(_0x236a06[_0x643e('0x41')]!=='VIRTUAL'){var _0x55d9f9={};_0x55d9f9[_0x236a06[_0x643e('0x3b')]]={'$like':'%'+_0x578898[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x55d9f9;}})});}_0x101743=_['merge']({},_0x101743,_0x578898['options']);var _0x1889fb={'where':_0x101743[_0x643e('0x4d')]};return db[_0x643e('0x3e')][_0x643e('0x30')](_0x1889fb)['then'](function(_0x142688){_0x353962['count']=_0x142688;if(_0x578898[_0x643e('0x45')]['includeAll']){_0x101743['include']=[{'all':!![]}];}return db['FaxAccount'][_0x643e('0x51')](_0x101743);})['then'](function(_0x1d3978){_0x353962[_0x643e('0x52')]=_0x1d3978;return _0x353962;})[_0x643e('0x20')](respondWithFilteredResult(_0x35cf35,_0x101743))[_0x643e('0x2a')](handleError(_0x35cf35,null));};exports[_0x643e('0x53')]=function(_0x3bee44,_0x236868){var _0x3960e9={'raw':![],'where':{'id':_0x3bee44[_0x643e('0x54')]['id']},'include':[{'model':db[_0x643e('0x55')],'as':'mandatoryDispositionPause'}]},_0x4a6eaa={};_0x4a6eaa[_0x643e('0x43')]=_[_0x643e('0x56')](db['FaxAccount'][_0x643e('0x3f')]);_0x4a6eaa[_0x643e('0x45')]=_['keys'](_0x3bee44[_0x643e('0x45')]);_0x4a6eaa[_0x643e('0x46')]=_[_0x643e('0x47')](_0x4a6eaa[_0x643e('0x43')],_0x4a6eaa[_0x643e('0x45')]);_0x3960e9[_0x643e('0x48')]=_['intersection'](_0x4a6eaa[_0x643e('0x43')],qs['fields'](_0x3bee44[_0x643e('0x45')]['fields']));_0x3960e9[_0x643e('0x48')]=_0x3960e9[_0x643e('0x48')][_0x643e('0x57')]?_0x3960e9[_0x643e('0x48')]:_0x4a6eaa['model'];if(_0x3bee44[_0x643e('0x45')]['includeAll']){_0x3960e9[_0x643e('0x58')]=[{'all':!![]}];}_0x3960e9=_[_0x643e('0x50')]({},_0x3960e9,_0x3bee44[_0x643e('0x59')]);return db[_0x643e('0x3e')][_0x643e('0x5a')](_0x3960e9)[_0x643e('0x20')](handleEntityNotFound(_0x236868,null))[_0x643e('0x20')](respondWithResult(_0x236868,null))['catch'](handleError(_0x236868,null));};exports[_0x643e('0x5b')]=function(_0x1d1b3c,_0x46e5b5){return db['FaxAccount']['create'](_0x1d1b3c[_0x643e('0x5c')],{})[_0x643e('0x20')](function(_0x2f0102){var _0x28d407=_0x1d1b3c[_0x643e('0x5d')][_0x643e('0x5e')]({'plain':!![]});if(!_0x28d407)throw new Error(_0x643e('0x5f'));if(_0x28d407[_0x643e('0x60')]===_0x643e('0x5d')){var _0x430ae0=_0x2f0102['get']({'plain':!![]});var _0x34fa7d='FaxAccounts';return db['UserProfileSection'][_0x643e('0x5a')]({'where':{'name':_0x34fa7d,'userProfileId':_0x28d407[_0x643e('0x61')]},'raw':!![]})[_0x643e('0x20')](function(_0x3b454e){if(_0x3b454e&&_0x3b454e['autoAssociation']===0x0){return db[_0x643e('0x62')][_0x643e('0x5b')]({'name':_0x430ae0['name'],'resourceId':_0x430ae0['id'],'type':_0x3b454e[_0x643e('0x3b')],'sectionId':_0x3b454e['id']},{})[_0x643e('0x20')](function(){return _0x2f0102;});}else{return _0x2f0102;}})[_0x643e('0x2a')](function(_0x4a7c17){logger[_0x643e('0x26')](_0x643e('0x63'),_0x4a7c17);throw _0x4a7c17;});}return _0x2f0102;})[_0x643e('0x20')](respondWithResult(_0x46e5b5,0xc9))[_0x643e('0x2a')](handleError(_0x46e5b5,null));};exports[_0x643e('0x36')]=function(_0x457d2a,_0x21386a){if(_0x457d2a['body']['id']){delete _0x457d2a[_0x643e('0x5c')]['id'];}return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x457d2a[_0x643e('0x54')]['id']},'include':[{'model':db[_0x643e('0x55')],'as':'mandatoryDispositionPause'}]})[_0x643e('0x20')](handleEntityNotFound(_0x21386a,null))[_0x643e('0x20')](saveUpdates(_0x457d2a[_0x643e('0x5c')],null))[_0x643e('0x20')](respondWithResult(_0x21386a,null))[_0x643e('0x2a')](handleError(_0x21386a,null));};exports['destroy']=function(_0x56926b,_0x1d42f6){return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x56926b[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x1d42f6,null))[_0x643e('0x20')](removeEntity(_0x1d42f6,null))[_0x643e('0x2a')](handleError(_0x1d42f6,null));};exports[_0x643e('0x64')]=function(_0x3bb462,_0x46d3f3){return db[_0x643e('0x3e')][_0x643e('0x64')]()[_0x643e('0x20')](respondWithResult(_0x46d3f3,null))['catch'](handleError(_0x46d3f3,null));};exports[_0x643e('0x65')]=function(_0x5d07a9,_0x339301,_0x3eeee1){if(_0x5d07a9[_0x643e('0x5c')]['id']){delete _0x5d07a9[_0x643e('0x5c')]['id'];}return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x5d07a9[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x339301,null))[_0x643e('0x20')](function(_0x2e4ece){if(_0x2e4ece){_0x5d07a9[_0x643e('0x5c')][_0x643e('0x66')]=_0x2e4ece['id'];return db[_0x643e('0x67')]['create'](_0x5d07a9[_0x643e('0x5c')]);}})['then'](respondWithResult(_0x339301,null))[_0x643e('0x2a')](handleError(_0x339301,null));};exports[_0x643e('0x68')]=function(_0x37313e,_0x5cfade,_0x3b5f92){var _0x242be3={'raw':![],'where':{}};var _0x2524f9={};var _0x3d05fb={'count':0x0,'rows':[]};return db['FaxAccount'][_0x643e('0x69')]({'where':{'id':_0x37313e[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x5cfade,null))[_0x643e('0x20')](function(_0x981201){if(_0x981201){_0x2524f9[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x67')][_0x643e('0x3f')]);_0x2524f9[_0x643e('0x45')]=_[_0x643e('0x56')](_0x37313e[_0x643e('0x45')]);_0x2524f9[_0x643e('0x46')]=_['intersection'](_0x2524f9['model'],_0x2524f9['query']);_0x242be3[_0x643e('0x48')]=_[_0x643e('0x47')](_0x2524f9[_0x643e('0x43')],qs[_0x643e('0x49')](_0x37313e[_0x643e('0x45')]['fields']));_0x242be3['attributes']=_0x242be3[_0x643e('0x48')][_0x643e('0x57')]?_0x242be3['attributes']:_0x2524f9[_0x643e('0x43')];if(!_0x37313e[_0x643e('0x45')][_0x643e('0x6a')]('nolimit')){_0x242be3[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x37313e[_0x643e('0x45')][_0x643e('0x31')]);_0x242be3[_0x643e('0x2f')]=qs['offset'](_0x37313e[_0x643e('0x45')][_0x643e('0x2f')]);}_0x242be3['order']=qs[_0x643e('0x4c')](_0x37313e[_0x643e('0x45')][_0x643e('0x4c')]);_0x242be3[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x37313e[_0x643e('0x45')],_0x2524f9[_0x643e('0x46')]));_0x242be3[_0x643e('0x4d')][_0x643e('0x66')]=_0x981201['id'];if(_0x37313e['query'][_0x643e('0x4f')]){_0x242be3[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x242be3[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x242be3['attributes'],function(_0x313f93){var _0x503079={};_0x503079[_0x313f93]={'$like':'%'+_0x37313e[_0x643e('0x45')]['filter']+'%'};return _0x503079;})});}_0x242be3=_[_0x643e('0x50')]({},_0x242be3,_0x37313e[_0x643e('0x59')]);return db[_0x643e('0x67')][_0x643e('0x30')]({'where':_0x242be3[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x1a9096){_0x3d05fb[_0x643e('0x30')]=_0x1a9096;if(_0x37313e[_0x643e('0x45')][_0x643e('0x6b')]){_0x242be3[_0x643e('0x58')]=[{'all':!![]}];}return db[_0x643e('0x67')]['findAll'](_0x242be3);})['then'](function(_0x1a1e3c){_0x3d05fb[_0x643e('0x52')]=_0x1a1e3c;return _0x3d05fb;});}})[_0x643e('0x20')](respondWithFilteredResult(_0x5cfade,_0x242be3))[_0x643e('0x2a')](handleError(_0x5cfade,null));};exports[_0x643e('0x6c')]=function(_0x2ec7f6,_0x24749f,_0x4a8de5){return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x2ec7f6['params']['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x24749f,null))['then'](function(_0x5e619){if(_0x5e619){return _0x5e619['removeDispositions'](_0x2ec7f6[_0x643e('0x45')][_0x643e('0x6d')]);}})[_0x643e('0x20')](respondWithStatusCode(_0x24749f,null))[_0x643e('0x2a')](handleError(_0x24749f,null));};exports['addAnswer']=function(_0x56cf96,_0x5a2cec,_0x4ffe02){if(_0x56cf96[_0x643e('0x5c')]['id']){delete _0x56cf96['body']['id'];}return db[_0x643e('0x3e')][_0x643e('0x5a')]({'where':{'id':_0x56cf96[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x5a2cec,null))[_0x643e('0x20')](function(_0x5671b5){if(_0x5671b5){_0x56cf96[_0x643e('0x5c')][_0x643e('0x66')]=_0x5671b5['id'];return db[_0x643e('0x6e')][_0x643e('0x5b')](_0x56cf96['body']);}})[_0x643e('0x20')](respondWithResult(_0x5a2cec,null))[_0x643e('0x2a')](handleError(_0x5a2cec,null));};exports['getAnswers']=function(_0x241d77,_0x4f05ec,_0x425242){var _0x32db6c={'raw':![],'where':{}};var _0xdd0335={};var _0x1fc5f8={'count':0x0,'rows':[]};return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x241d77[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x4f05ec,null))['then'](function(_0x35ba04){if(_0x35ba04){_0xdd0335['model']=_[_0x643e('0x56')](db[_0x643e('0x6e')][_0x643e('0x3f')]);_0xdd0335[_0x643e('0x45')]=_[_0x643e('0x56')](_0x241d77[_0x643e('0x45')]);_0xdd0335['filters']=_['intersection'](_0xdd0335['model'],_0xdd0335[_0x643e('0x45')]);_0x32db6c[_0x643e('0x48')]=_[_0x643e('0x47')](_0xdd0335[_0x643e('0x43')],qs[_0x643e('0x49')](_0x241d77[_0x643e('0x45')][_0x643e('0x49')]));_0x32db6c['attributes']=_0x32db6c['attributes'][_0x643e('0x57')]?_0x32db6c[_0x643e('0x48')]:_0xdd0335['model'];if(!_0x241d77[_0x643e('0x45')]['hasOwnProperty']('nolimit')){_0x32db6c[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x241d77['query'][_0x643e('0x31')]);_0x32db6c[_0x643e('0x2f')]=qs[_0x643e('0x2f')](_0x241d77['query'][_0x643e('0x2f')]);}_0x32db6c[_0x643e('0x4b')]=qs[_0x643e('0x4c')](_0x241d77['query'][_0x643e('0x4c')]);_0x32db6c[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x241d77[_0x643e('0x45')],_0xdd0335[_0x643e('0x46')]));_0x32db6c['where'][_0x643e('0x66')]=_0x35ba04['id'];if(_0x241d77[_0x643e('0x45')][_0x643e('0x4f')]){_0x32db6c[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x32db6c[_0x643e('0x4d')],{'$or':_['map'](_0x32db6c[_0x643e('0x48')],function(_0x365399){var _0x13d321={};_0x13d321[_0x365399]={'$like':'%'+_0x241d77[_0x643e('0x45')]['filter']+'%'};return _0x13d321;})});}_0x32db6c=_['merge']({},_0x32db6c,_0x241d77[_0x643e('0x59')]);return db[_0x643e('0x6e')][_0x643e('0x30')]({'where':_0x32db6c[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x399aac){_0x1fc5f8[_0x643e('0x30')]=_0x399aac;if(_0x241d77['query'][_0x643e('0x6b')]){_0x32db6c['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x643e('0x51')](_0x32db6c);})[_0x643e('0x20')](function(_0x1c7017){_0x1fc5f8[_0x643e('0x52')]=_0x1c7017;return _0x1fc5f8;});}})[_0x643e('0x20')](respondWithFilteredResult(_0x4f05ec,_0x32db6c))[_0x643e('0x2a')](handleError(_0x4f05ec,null));};exports[_0x643e('0x6f')]=function(_0x5a785a,_0x15c742,_0x263c64){return db[_0x643e('0x3e')]['find']({'where':{'id':_0x5a785a[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x15c742,null))['then'](function(_0xb717f3){if(_0xb717f3){return _0xb717f3[_0x643e('0x6f')](_0x5a785a[_0x643e('0x45')][_0x643e('0x6d')]);}})['then'](respondWithStatusCode(_0x15c742,null))[_0x643e('0x2a')](handleError(_0x15c742,null));};exports[_0x643e('0x70')]=function(_0x1cd7d3,_0x23f7c3,_0x35b877){return db['FaxInteraction'][_0x643e('0x5a')]({'where':{'id':_0x1cd7d3['params']['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x23f7c3,null))['then'](function(_0x1ee96b){if(_0x1ee96b){return _0x1ee96b[_0x643e('0x70')](_0x1cd7d3[_0x643e('0x5c')][_0x643e('0x6d')],_[_0x643e('0x71')](_0x1cd7d3[_0x643e('0x5c')],[_0x643e('0x6d'),'id'])||{});}})[_0x643e('0x20')](respondWithResult(_0x23f7c3,null))[_0x643e('0x2a')](handleError(_0x23f7c3,null));};exports[_0x643e('0x72')]=function(_0x156d45,_0x6dd980,_0x462bca){var _0x3cf6e2={'raw':![],'where':{}};var _0x307db5={};var _0x1fc4ec={'count':0x0,'rows':[]};return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x156d45[_0x643e('0x54')]['id']}})['then'](handleEntityNotFound(_0x6dd980,null))[_0x643e('0x20')](function(_0x1aa879){if(_0x1aa879){_0x307db5[_0x643e('0x43')]=_['keys'](db[_0x643e('0x73')][_0x643e('0x3f')]);_0x307db5[_0x643e('0x45')]=_['keys'](_0x156d45[_0x643e('0x45')]);_0x307db5[_0x643e('0x46')]=_['intersection'](_0x307db5['model'],_0x307db5[_0x643e('0x45')]);_0x3cf6e2[_0x643e('0x48')]=_[_0x643e('0x47')](_0x307db5['model'],qs[_0x643e('0x49')](_0x156d45[_0x643e('0x45')][_0x643e('0x49')]));_0x3cf6e2['attributes']=_0x3cf6e2[_0x643e('0x48')][_0x643e('0x57')]?_0x3cf6e2[_0x643e('0x48')]:_0x307db5[_0x643e('0x43')];if(!_0x156d45[_0x643e('0x45')]['hasOwnProperty'](_0x643e('0x4a'))){_0x3cf6e2[_0x643e('0x31')]=qs['limit'](_0x156d45[_0x643e('0x45')][_0x643e('0x31')]);_0x3cf6e2[_0x643e('0x2f')]=qs['offset'](_0x156d45[_0x643e('0x45')][_0x643e('0x2f')]);}_0x3cf6e2[_0x643e('0x4b')]=qs['sort'](_0x156d45[_0x643e('0x45')][_0x643e('0x4c')]);_0x3cf6e2['where']=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x156d45['query'],_0x307db5[_0x643e('0x46')]));_0x3cf6e2[_0x643e('0x4d')][_0x643e('0x66')]=_0x1aa879['id'];if(_0x156d45[_0x643e('0x45')][_0x643e('0x4f')]){_0x3cf6e2[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x3cf6e2[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x3cf6e2[_0x643e('0x48')],function(_0x5ae4a0){var _0x33ee36={};_0x33ee36[_0x5ae4a0]={'$like':'%'+_0x156d45[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x33ee36;})});}_0x3cf6e2=_['merge']({},_0x3cf6e2,_0x156d45[_0x643e('0x59')]);return db['FaxInteraction'][_0x643e('0x30')]({'where':_0x3cf6e2[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x26bd0a){_0x1fc4ec[_0x643e('0x30')]=_0x26bd0a;if(_0x156d45[_0x643e('0x45')][_0x643e('0x6b')]){_0x3cf6e2[_0x643e('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x643e('0x74')],'as':_0x643e('0x75'),'attributes':['name','fullname',_0x643e('0x76')],'required':![]},{'model':db['Tag'],'as':_0x643e('0x77'),'attributes':['id',_0x643e('0x3b'),_0x643e('0x78')],'where':_0x156d45[_0x643e('0x45')][_0x643e('0x79')]?{'id':_0x156d45[_0x643e('0x45')][_0x643e('0x79')]}:undefined,'required':_0x156d45[_0x643e('0x45')][_0x643e('0x79')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x3cf6e2);})['then'](function(_0x31f1f7){_0x1fc4ec['rows']=_0x31f1f7;return _0x1fc4ec;});}})[_0x643e('0x20')](respondWithFilteredResult(_0x6dd980,_0x3cf6e2))[_0x643e('0x2a')](handleError(_0x6dd980,null));};exports[_0x643e('0x7a')]=function(_0x12f508,_0x16fb99){var _0x55fc04=_0x12f508['params']['id'];var _0x5b8763=_0x12f508[_0x643e('0x5c')];var _0x45e0f9=0xc8;var _0x1c917d=null;return db[_0x643e('0x7b')]['transaction']({'isolationLevel':db[_0x643e('0x7b')][_0x643e('0x7c')]['ISOLATION_LEVELS'][_0x643e('0x7d')]},function(_0x6a25e){return db['FaxAccount'][_0x643e('0x69')]({'where':{'id':_0x55fc04},'transaction':_0x6a25e})[_0x643e('0x20')](function(_0xdd48f3){if(_0xdd48f3){return db[_0x643e('0x7e')][_0x643e('0x37')]({'where':{'FaxAccountId':_0x55fc04},'transaction':_0x6a25e})[_0x643e('0x20')](function(){var _0x329778=_[_0x643e('0x44')](_0x5b8763,function(_0x5ed74f){_0x5ed74f[_0x643e('0x66')]=_0x55fc04;return _0x5ed74f;});return db[_0x643e('0x7e')]['bulkCreate'](_0x329778,{'transaction':_0x6a25e});});}else{_0x45e0f9=0x194;_0x1c917d=[];}});})[_0x643e('0x20')](function(){if(_0x45e0f9!==0x194){return db[_0x643e('0x7e')][_0x643e('0x7f')]({'where':{'FaxAccountId':_0x55fc04},'order':'priority'})[_0x643e('0x20')](function(_0x102f02){_0x1c917d=_0x102f02;});}})['catch'](function(_0x23a3f2){_0x45e0f9=0x1f4;logger[_0x643e('0x26')](_0x23a3f2[_0x643e('0x3a')]);if(_0x23a3f2['name']){delete _0x23a3f2['name'];}_0x1c917d=_0x23a3f2;})[_0x643e('0x80')](function(){if(_0x1c917d===null){_0x16fb99['sendStatus'](_0x45e0f9);}else{if(_0x45e0f9===0x1f4){_0x16fb99[_0x643e('0x2b')](_0x45e0f9)['send'](_0x1c917d);}else{_0x16fb99[_0x643e('0x2b')](_0x45e0f9)[_0x643e('0x2d')](_0x1c917d);}}});};exports[_0x643e('0x81')]=function(_0x5d477e,_0x411de2,_0x4d38a2){var _0x4a104a={};var _0x209135={};var _0x3a8919;var _0x3dd661;return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x5d477e[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x411de2,null))[_0x643e('0x20')](function(_0x27b70a){if(_0x27b70a){_0x3a8919=_0x27b70a;_0x209135[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x7e')]['rawAttributes']);_0x209135[_0x643e('0x45')]=_[_0x643e('0x56')](_0x5d477e[_0x643e('0x45')]);_0x209135[_0x643e('0x46')]=_[_0x643e('0x47')](_0x209135[_0x643e('0x43')],_0x209135[_0x643e('0x45')]);_0x4a104a['attributes']=_[_0x643e('0x47')](_0x209135[_0x643e('0x43')],qs[_0x643e('0x49')](_0x5d477e['query'][_0x643e('0x49')]));_0x4a104a[_0x643e('0x48')]=_0x4a104a['attributes'][_0x643e('0x57')]?_0x4a104a[_0x643e('0x48')]:_0x209135[_0x643e('0x43')];_0x4a104a[_0x643e('0x4b')]=qs[_0x643e('0x4c')](_0x5d477e[_0x643e('0x45')][_0x643e('0x4c')]);_0x4a104a[_0x643e('0x4d')]=qs[_0x643e('0x46')](_['pick'](_0x5d477e[_0x643e('0x45')],_0x209135[_0x643e('0x46')]));if(_0x5d477e[_0x643e('0x45')][_0x643e('0x4f')]){_0x4a104a[_0x643e('0x4d')]=_['merge'](_0x4a104a[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x4a104a[_0x643e('0x48')],function(_0x2777da){var _0x326361={};_0x326361[_0x2777da]={'$like':'%'+_0x5d477e['query']['filter']+'%'};return _0x326361;})});}_0x4a104a=_['merge']({},_0x4a104a,_0x5d477e[_0x643e('0x59')]);return _0x3a8919[_0x643e('0x81')](_0x4a104a);}})['then'](function(_0x53211e){if(_0x53211e){_0x3dd661=_0x53211e[_0x643e('0x57')];if(!_0x5d477e[_0x643e('0x45')]['hasOwnProperty'](_0x643e('0x4a'))){_0x4a104a[_0x643e('0x31')]=qs['limit'](_0x5d477e[_0x643e('0x45')][_0x643e('0x31')]);_0x4a104a[_0x643e('0x2f')]=qs[_0x643e('0x2f')](_0x5d477e[_0x643e('0x45')][_0x643e('0x2f')]);}return _0x3a8919[_0x643e('0x81')](_0x4a104a);}})[_0x643e('0x20')](function(_0x1be3f2){if(_0x1be3f2){return _0x1be3f2?{'count':_0x3dd661,'rows':_0x1be3f2}:null;}})[_0x643e('0x20')](respondWithResult(_0x411de2,null))['catch'](handleError(_0x411de2,null));};function Extension(_0xc06932,_0x41b9d9,_0x48dc63,_0x146606){this[_0x643e('0x82')]='from-voip-provider';this[_0x643e('0x83')]=_0xc06932[_0x643e('0x84')];this[_0x643e('0x85')]=_0x146606;this[_0x643e('0x41')]=_0x643e('0x86');this['description']=_0x643e('0x87');this['FaxAccountId']=_0xc06932['id'];this[_0x643e('0x88')]=_0x41b9d9;this[_0x643e('0x89')]=_0x48dc63;}function createExtensionsReciveFax(_0x209f40){var _0x45343f=0x1;var _0xc83034=[];_0xc83034['push'](new Extension(_0x209f40,_0x45343f,'','Answer'));_0x45343f+=0x1;_0xc83034['push'](new Extension(_0x209f40,_0x45343f,_0x643e('0x8a'),_0x643e('0x8b')));_0x45343f+=0x1;for(var _0x3ccca6 in _0x209f40){if(_0x209f40[_0x643e('0x6a')](_0x3ccca6)&&(_0x3ccca6==='ecm'||_0x3ccca6===_0x643e('0x84')||_0x3ccca6===_0x643e('0x8c')||_0x3ccca6==='faxdetect'||_0x3ccca6===_0x643e('0x8d')||_0x3ccca6===_0x643e('0x8e')||_0x3ccca6===_0x643e('0x8f')||_0x3ccca6==='modem'||_0x3ccca6===_0x643e('0x90'))){_0xc83034['push'](new Extension(_0x209f40,_0x45343f,_0x643e('0x91')+_0x3ccca6+')='+_0x209f40[_0x3ccca6],_0x643e('0x8b')));_0x45343f+=0x1;}}_0xc83034[_0x643e('0x92')](new Extension(_0x209f40,_0x45343f,'6',_0x643e('0x93')));_0x45343f+=0x1;_0xc83034[_0x643e('0x92')](new Extension(_0x209f40,_0x45343f,_0x643e('0x94'),'ReceiveFax'));_0x45343f=0x0;return _0xc83034;}exports[_0x643e('0x95')]=function(_0x543d20,_0x3eef36,_0x7224c3){var _0x4a5b12;return db[_0x643e('0x7b')][_0x643e('0x96')](function(_0x261a7d){return db[_0x643e('0x3e')][_0x643e('0x5b')](_0x543d20[_0x643e('0x5c')],{'transaction':_0x261a7d})[_0x643e('0x20')](function(_0x41f9b6){_0x4a5b12=_0x41f9b6['get']({'plain':!![]});return db[_0x643e('0x97')][_0x643e('0x98')](createExtensionsReciveFax(_0x4a5b12),{'transaction':_0x261a7d});});})[_0x643e('0x20')](function(){return _0x4a5b12;})[_0x643e('0x20')](respondWithResult(_0x3eef36,null))['catch'](handleError(_0x3eef36,null));};exports[_0x643e('0x99')]=function(_0x58077c,_0xf36406,_0x3db451){var _0x74b048;return db[_0x643e('0x7b')][_0x643e('0x96')](function(_0x4ab6d5){return db['FaxAccount']['update'](_0x58077c[_0x643e('0x5c')],{'where':{'id':_0x58077c['body']['id']},'transaction':_0x4ab6d5})['then'](function(_0x55b7c9){return db[_0x643e('0x97')]['destroy']({'where':{'FaxAccountId':_0x58077c[_0x643e('0x5c')]['id']},'transaction':_0x4ab6d5})[_0x643e('0x20')](function(_0x4571cf){return db[_0x643e('0x97')][_0x643e('0x98')](createExtensionsReciveFax(_[_0x643e('0x71')](_0x58077c[_0x643e('0x5c')],['tech',_0x643e('0x42'),_0x643e('0x9a'),_0x643e('0x9b'),_0x643e('0x9c'),'ListId'])),{'transaction':_0x4ab6d5});});});})[_0x643e('0x20')](function(){return db[_0x643e('0x3e')][_0x643e('0x9d')](_0x58077c['body']['id']);})['then'](respondWithResult(_0xf36406,null))[_0x643e('0x2a')](handleError(_0xf36406,null));};exports[_0x643e('0x9e')]=function(_0x4a7b9d,_0xa1ae6c,_0x468aaa){var _0x4c5e97={'raw':!![],'where':{}};var _0x48dc03={};var _0x34a3e9={'count':0x0,'rows':[]};return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x4a7b9d[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0xa1ae6c,null))[_0x643e('0x20')](function(_0xbf53e8){if(_0xbf53e8){_0x48dc03[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x9f')][_0x643e('0x3f')]);_0x48dc03[_0x643e('0x45')]=_['keys'](_0x4a7b9d[_0x643e('0x45')]);_0x48dc03[_0x643e('0x46')]=_['intersection'](_0x48dc03['model'],_0x48dc03[_0x643e('0x45')]);_0x4c5e97[_0x643e('0x48')]=_[_0x643e('0x47')](_0x48dc03[_0x643e('0x43')],qs[_0x643e('0x49')](_0x4a7b9d['query'][_0x643e('0x49')]));_0x4c5e97['attributes']=_0x4c5e97['attributes']['length']?_0x4c5e97[_0x643e('0x48')]:_0x48dc03[_0x643e('0x43')];if(!_0x4a7b9d[_0x643e('0x45')]['hasOwnProperty']('nolimit')){_0x4c5e97[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x4a7b9d[_0x643e('0x45')]['limit']);_0x4c5e97[_0x643e('0x2f')]=qs['offset'](_0x4a7b9d[_0x643e('0x45')][_0x643e('0x2f')]);}_0x4c5e97['order']=qs[_0x643e('0x4c')](_0x4a7b9d[_0x643e('0x45')][_0x643e('0x4c')]);_0x4c5e97[_0x643e('0x4d')]=qs[_0x643e('0x46')](_['pick'](_0x4a7b9d['query'],_0x48dc03[_0x643e('0x46')]));_0x4c5e97[_0x643e('0x4d')][_0x643e('0x66')]=_0xbf53e8['id'];if(_0x4a7b9d[_0x643e('0x45')][_0x643e('0x4f')]){_0x4c5e97[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x4c5e97[_0x643e('0x4d')],{'$or':_[_0x643e('0x44')](_0x4c5e97[_0x643e('0x48')],function(_0x36ce8b){var _0x50ed88={};_0x50ed88[_0x36ce8b]={'$like':'%'+_0x4a7b9d[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x50ed88;})});}if(_0x4a7b9d[_0x643e('0x45')]['$gte']){var _0x426992=_0x4a7b9d['query'][_0x643e('0xa0')][_0x643e('0xa1')](',');var _0x5ec240={};_0x5ec240[_0x426992[0x0]]={'$gte':moment(_0x426992[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4c5e97[_0x643e('0x4d')]=_['merge'](_0x4c5e97[_0x643e('0x4d')],_0x5ec240);}_0x4c5e97=_[_0x643e('0x50')]({},_0x4c5e97,_0x4a7b9d[_0x643e('0x59')]);return db[_0x643e('0x9f')]['count']({'where':_0x4c5e97[_0x643e('0x4d')]})[_0x643e('0x20')](function(_0x368e1d){_0x34a3e9['count']=_0x368e1d;if(_0x4a7b9d[_0x643e('0x45')][_0x643e('0x6b')]){_0x4c5e97[_0x643e('0x58')]=[{'all':!![]}];}return db[_0x643e('0x9f')]['findAll'](_0x4c5e97);})[_0x643e('0x20')](function(_0x4f04f3){_0x34a3e9[_0x643e('0x52')]=_0x4f04f3;return _0x34a3e9;});}})['then'](respondWithFilteredResult(_0xa1ae6c,_0x4c5e97))['catch'](handleError(_0xa1ae6c,null));};exports[_0x643e('0x3c')]=function(_0xb4c43e,_0x1f1d1c,_0x435879){var _0x360fce,_0x2cea70={},_0x2cdb73;if(_0xb4c43e[_0x643e('0x5c')]['to']){_0x2cdb73=_0xb4c43e['body']['to'][0x0];}return db['FaxAccount'][_0x643e('0x5a')]({'where':{'id':_0xb4c43e['params']['id']},'include':[{'model':db[_0x643e('0xa2')],'as':_0x643e('0xa3'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x2cdb73},'limit':0x1,'order':[[_0x643e('0x9b'),_0x643e('0xa4')]]}]}]})[_0x643e('0x20')](handleEntityNotFound(_0x1f1d1c,null))[_0x643e('0x20')](function(_0x316f19){_0x360fce=_0x316f19;if(_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')]&&_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x643e('0x57')]){for(var _0x4acb67=0x0;_0x4acb67<_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x643e('0x57')];_0x4acb67+=0x1){_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x4acb67]={'filename':_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x4acb67][_0x643e('0x3b')],'id':_0xb4c43e[_0x643e('0x5c')]['attachments'][_0x4acb67]['id'],'path':path[_0x643e('0xa6')](config[_0x643e('0xa7')],_0x643e('0xa8'),_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][_0x4acb67][_0x643e('0xa9')])};}}return respondWithRpcPromise(_0x643e('0xaa'),_0x643e('0xaa'),{'FaxAccountId':_['isNil'](_0xb4c43e[_0x643e('0x54')]['id'])?undefined:_0xb4c43e['params']['id'],'path':_[_0x643e('0xab')](_0xb4c43e['body']['attachments'][0x0][_0x643e('0x9')])?undefined:_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][0x0]['path'],'fax':_[_0x643e('0xab')](_0xb4c43e[_0x643e('0x5c')]['to'][0x0])?undefined:_0xb4c43e[_0x643e('0x5c')]['to'][0x0]},client9002);})[_0x643e('0x20')](function(){if(_0x360fce){if(_[_0x643e('0xab')](_0xb4c43e[_0x643e('0x5c')][_0x643e('0xac')])){_0xb4c43e['body'][_0x643e('0xac')]=util['format'](_0x643e('0xad'),_0x360fce[_0x643e('0x3b')],_0x360fce[_0x643e('0xae')]);}if(_0x360fce[_0x643e('0xa3')]){if(_0x360fce[_0x643e('0xa3')][_0x643e('0xaf')]['length']){return _0x360fce[_0x643e('0xa3')]['Contacts'][0x0];}else{return db[_0x643e('0xb0')][_0x643e('0x5b')](_[_0x643e('0xb1')](_0xb4c43e[_0x643e('0x5c')],{'firstName':_0xb4c43e[_0x643e('0x5c')]['to'][0x0],'phone':_0xb4c43e[_0x643e('0x5c')]['to'][0x0],'fax':_0xb4c43e['body']['to'][0x0],'ListId':_0x360fce['ListId']}));}}else{throw new Error(_0x643e('0xb2'));}}else{throw new Error(_0x643e('0xb3'));}})['then'](function(_0x631a63){if(_0x631a63){return db['FaxInteraction'][_0x643e('0x5a')]({'where':{'ContactId':_0x631a63['id'],'closed':![],'FaxAccountId':_0x360fce['id']}})[_0x643e('0x20')](function(_0x5a07bb){if(_0x5a07bb){return[_0x5a07bb,![]];}return db[_0x643e('0x73')]['create']({'UserId':_0xb4c43e['user']['id'],'ContactId':_0x631a63['id'],'FaxAccountId':_0x360fce['id'],'fax':_0xb4c43e['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x643e('0x50')](_0xb4c43e['body'],{'read':![],'body':_0xb4c43e['body'][_0x643e('0xa5')][0x0][_0x643e('0xb4')],'FaxAccountId':_0x360fce['id'],'UserId':_0xb4c43e['user']['id'],'ContactId':_0x631a63['id'],'AttachmentId':_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x643e('0x9f')],'as':_0x643e('0xb5')}]})[_0x643e('0x20')](function(_0x5f9746){return[_0x5f9746,!![]];});});}else{throw new Error(_0x643e('0xb6'));}})[_0x643e('0xb7')](function(_0x4e2ea6,_0x38d6fc){if(_0x38d6fc){return _0x4e2ea6;}return db[_0x643e('0x9f')]['create']({'direction':_0x643e('0xb8'),'read':![],'body':_0xb4c43e[_0x643e('0x5c')][_0x643e('0xa5')][0x0]['filename'],'FaxAccountId':_0x360fce['id'],'FaxInteractionId':_0x4e2ea6['id'],'UserId':_0xb4c43e[_0x643e('0x5d')]['id'],'ContactId':_0x4e2ea6['ContactId'],'AttachmentId':_0xb4c43e['body'][_0x643e('0xa5')][0x0]['id']})[_0x643e('0x20')](function(_0x4f878f){_0x4e2ea6[_0x643e('0xb9')][_0x643e('0xb5')]=[];_0x4e2ea6[_0x643e('0xb9')][_0x643e('0xb5')][_0x643e('0x92')](_0x4f878f[_0x643e('0xb9')]);return _0x4e2ea6;});})[_0x643e('0x20')](function(_0x54332d){respondWithRpcPromise(_0x643e('0xba'),_0x643e('0xba'),{'FaxAccountId':_[_0x643e('0xab')](_0xb4c43e[_0x643e('0x54')]['id'])?undefined:_0xb4c43e[_0x643e('0x54')]['id'],'path':_[_0x643e('0xab')](_0xb4c43e['body'][_0x643e('0xa5')][0x0][_0x643e('0x9')])?undefined:_0xb4c43e['body'][_0x643e('0xa5')][0x0][_0x643e('0x9')],'fax':_['isNil'](_0xb4c43e[_0x643e('0x5c')]['to'][0x0])?undefined:_0xb4c43e['body']['to'][0x0],'AttachmentId':_0xb4c43e[_0x643e('0x5c')]['attachments'][0x0]['id']},client9002)[_0x643e('0x20')](function(_0x250966){logger['info'](_0x643e('0xbb'),_0x250966);})[_0x643e('0x2a')](function(_0x54418e){logger[_0x643e('0x28')](_0x643e('0xbb'),_0x54418e);});return _0x54332d;})[_0x643e('0x20')](respondWithResult(_0x1f1d1c,null))[_0x643e('0x2a')](handleError(_0x1f1d1c,null));};exports['addAgents']=function(_0x4c0316,_0x591bd4,_0x2f1875){return db[_0x643e('0x3e')]['find']({'where':{'id':_0x4c0316['params']['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x591bd4,null))[_0x643e('0x20')](function(_0x2d5975){if(_0x2d5975){return _0x2d5975[_0x643e('0xbc')](_0x4c0316['body'][_0x643e('0x6d')],_['omit'](_0x4c0316[_0x643e('0x5c')],[_0x643e('0x6d'),'id'])||{})['spread'](function(_0x5fd04a){for(var _0x3f87ef=0x0;_0x3f87ef<_0x4c0316[_0x643e('0x5c')]['ids'][_0x643e('0x57')];_0x3f87ef+=0x1){socket[_0x643e('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x4c0316[_0x643e('0x5c')][_0x643e('0x6d')][_0x3f87ef]),'FaxAccountId':Number(_0x4c0316[_0x643e('0x54')]['id'])});}return _0x5fd04a;});}})[_0x643e('0x20')](respondWithResult(_0x591bd4,null))['catch'](handleError(_0x591bd4,null));};exports[_0x643e('0xbe')]=function(_0x25ad01,_0x383f54,_0x1d2211){return db['FaxAccount'][_0x643e('0x5a')]({'where':{'id':_0x25ad01[_0x643e('0x54')]['id']}})['then'](handleEntityNotFound(_0x383f54,null))[_0x643e('0x20')](function(_0x268686){if(_0x268686){return _0x268686['removeAgents'](_0x25ad01[_0x643e('0x45')]['ids'])[_0x643e('0x20')](function(){if(_[_0x643e('0xbf')](_0x25ad01[_0x643e('0x45')][_0x643e('0x6d')])){for(var _0x57a879=0x0;_0x57a879<_0x25ad01[_0x643e('0x45')][_0x643e('0x6d')]['length'];_0x57a879+=0x1){socket['emit'](_0x643e('0xc0'),{'UserId':Number(_0x25ad01[_0x643e('0x45')]['ids'][_0x57a879]),'FaxAccountId':Number(_0x25ad01[_0x643e('0x54')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x25ad01[_0x643e('0x45')]['ids']),'FaxAccountId':Number(_0x25ad01['params']['id'])});}});}})[_0x643e('0x20')](respondWithStatusCode(_0x383f54,null))['catch'](handleError(_0x383f54,null));};exports[_0x643e('0xc1')]=function(_0x2127c5,_0x2b64d5,_0x227a12){var _0x120a17={};var _0xecc5ff={};var _0xc6fb11;var _0x16b82f;return db[_0x643e('0x3e')][_0x643e('0x69')]({'where':{'id':_0x2127c5[_0x643e('0x54')]['id']}})[_0x643e('0x20')](handleEntityNotFound(_0x2b64d5,null))['then'](function(_0x267843){if(_0x267843){_0xc6fb11=_0x267843;_0xecc5ff[_0x643e('0x43')]=_[_0x643e('0x56')](db[_0x643e('0x74')][_0x643e('0x3f')]);_0xecc5ff['query']=_[_0x643e('0x56')](_0x2127c5[_0x643e('0x45')]);_0xecc5ff[_0x643e('0x46')]=_[_0x643e('0x47')](_0xecc5ff[_0x643e('0x43')],_0xecc5ff[_0x643e('0x45')]);_0x120a17['attributes']=_[_0x643e('0x47')](_0xecc5ff[_0x643e('0x43')],qs[_0x643e('0x49')](_0x2127c5[_0x643e('0x45')][_0x643e('0x49')]));_0x120a17[_0x643e('0x48')]=_0x120a17[_0x643e('0x48')][_0x643e('0x57')]?_0x120a17['attributes']:_0xecc5ff[_0x643e('0x43')];_0x120a17['order']=qs[_0x643e('0x4c')](_0x2127c5[_0x643e('0x45')][_0x643e('0x4c')]);_0x120a17[_0x643e('0x4d')]=qs[_0x643e('0x46')](_[_0x643e('0x4e')](_0x2127c5[_0x643e('0x45')],_0xecc5ff[_0x643e('0x46')]));if(_0x2127c5[_0x643e('0x45')][_0x643e('0x4f')]){_0x120a17[_0x643e('0x4d')]=_[_0x643e('0x50')](_0x120a17[_0x643e('0x4d')],{'$or':_['map'](_0x120a17[_0x643e('0x48')],function(_0x5561f2){var _0x2afd53={};_0x2afd53[_0x5561f2]={'$like':'%'+_0x2127c5[_0x643e('0x45')][_0x643e('0x4f')]+'%'};return _0x2afd53;})});}_0x120a17=_['merge']({},_0x120a17,_0x2127c5[_0x643e('0x59')]);return _0xc6fb11[_0x643e('0xc1')](_0x120a17);}})['then'](function(_0x44a847){if(_0x44a847){_0x16b82f=_0x44a847[_0x643e('0x57')];if(!_0x2127c5[_0x643e('0x45')][_0x643e('0x6a')](_0x643e('0x4a'))){_0x120a17[_0x643e('0x31')]=qs[_0x643e('0x31')](_0x2127c5[_0x643e('0x45')][_0x643e('0x31')]);_0x120a17[_0x643e('0x2f')]=qs[_0x643e('0x2f')](_0x2127c5[_0x643e('0x45')][_0x643e('0x2f')]);}return _0xc6fb11['getAgents'](_0x120a17);}})[_0x643e('0x20')](function(_0x1805c3){if(_0x1805c3){return _0x1805c3?{'count':_0x16b82f,'rows':_0x1805c3}:null;}})[_0x643e('0x20')](respondWithResult(_0x2b64d5,null))[_0x643e('0x2a')](handleError(_0x2b64d5,null));}; \ No newline at end of file +var _0x7bfa=['http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','undefined','limit','offset','apply','reject','save','update','get','FaxAccounts','destroy','status','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','finally','getApplications','context','from-voip-provider','app','system','description','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','ListId','$gte','split','format','FaxMessage','CmList','CmContact','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','Contacts','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client'];(function(_0x4f75ca,_0x530112){var _0x4f13c8=function(_0x8453a1){while(--_0x8453a1){_0x4f75ca['push'](_0x4f75ca['shift']());}};_0x4f13c8(++_0x530112);}(_0x7bfa,0x15e));var _0xa7bf=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x7bfa[_0x2e8418];return _0x548fe6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7bf('0x0'));var rp=require(_0xa7bf('0x1'));var moment=require(_0xa7bf('0x2'));var BPromise=require(_0xa7bf('0x3'));var Mustache=require(_0xa7bf('0x4'));var util=require(_0xa7bf('0x5'));var path=require(_0xa7bf('0x6'));var sox=require(_0xa7bf('0x7'));var csv=require(_0xa7bf('0x8'));var ejs=require(_0xa7bf('0x9'));var fs=require('fs');var fs_extra=require(_0xa7bf('0xa'));var _=require(_0xa7bf('0xb'));var squel=require(_0xa7bf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa7bf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa7bf('0xe'));var Papa=require(_0xa7bf('0xf'));var Redis=require(_0xa7bf('0x10'));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(_0xa7bf('0x11'))(_0xa7bf('0x12'));var utils=require(_0xa7bf('0x13'));var config=require(_0xa7bf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa7bf('0x15')]=_[_0xa7bf('0x16')](config[_0xa7bf('0x15')],{'host':_0xa7bf('0x17'),'port':0x18eb});var socket=require(_0xa7bf('0x18'))(new Redis(config[_0xa7bf('0x15')]));require(_0xa7bf('0x19'))['register'](socket);var jayson=require(_0xa7bf('0x1a'));var client=jayson[_0xa7bf('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xa7bf('0x1b')][_0xa7bf('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x409a3e,_0x36c372,_0x4de665,_0x465d63){return new BPromise(function(_0x5d241f,_0x4bbbe9){var _0x564a28=_0x465d63||client;return _0x564a28['request'](_0x409a3e,_0x4de665)[_0xa7bf('0x1d')](function(_0x5d8e4c){logger[_0xa7bf('0x1e')](_0xa7bf('0x1f'),_0x36c372,_0xa7bf('0x20'));logger[_0xa7bf('0x21')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x36c372,_0xa7bf('0x20'),JSON[_0xa7bf('0x22')](_0x5d8e4c));if(_0x5d8e4c[_0xa7bf('0x23')]){if(_0x5d8e4c[_0xa7bf('0x23')][_0xa7bf('0x24')]===0x1f4){logger[_0xa7bf('0x23')](_0xa7bf('0x1f'),_0x36c372,_0x5d8e4c[_0xa7bf('0x23')]['message']);return _0x4bbbe9(_0x5d8e4c['error'][_0xa7bf('0x25')]);}logger[_0xa7bf('0x23')]('FaxAccount,\x20%s,\x20%s',_0x36c372,_0x5d8e4c['error']['message']);return _0x5d241f(_0x5d8e4c[_0xa7bf('0x23')]['message']);}else{logger['info'](_0xa7bf('0x1f'),_0x36c372,_0xa7bf('0x20'));_0x5d241f(_0x5d8e4c[_0xa7bf('0x26')][_0xa7bf('0x25')]);}})[_0xa7bf('0x27')](function(_0x10f227){logger['error'](_0xa7bf('0x1f'),_0x36c372,_0x10f227);_0x4bbbe9(_0x10f227);});});}function respondWithStatusCode(_0x1039b0,_0x36a95f){_0x36a95f=_0x36a95f||0xcc;return function(_0x14c87f){if(_0x14c87f){return _0x1039b0['sendStatus'](_0x36a95f);}return _0x1039b0['status'](_0x36a95f)[_0xa7bf('0x28')]();};}function respondWithResult(_0x5bd4e0,_0x5602e3){_0x5602e3=_0x5602e3||0xc8;return function(_0x3e1698){if(_0x3e1698){return _0x5bd4e0['status'](_0x5602e3)[_0xa7bf('0x29')](_0x3e1698);}};}function respondWithFilteredResult(_0x2b8f57,_0x818e2){return function(_0x3fcc23){if(_0x3fcc23){var _0xe1c0a5=typeof _0x818e2['offset']===_0xa7bf('0x2a')&&typeof _0x818e2[_0xa7bf('0x2b')]===_0xa7bf('0x2a');var _0x51c9bf=_0x3fcc23['count'];var _0x1eec90=_0xe1c0a5?0x0:_0x818e2['offset'];var _0x4ad222=_0xe1c0a5?_0x3fcc23['count']:_0x818e2[_0xa7bf('0x2c')]+_0x818e2[_0xa7bf('0x2b')];var _0x58e453;if(_0x4ad222>=_0x51c9bf){_0x4ad222=_0x51c9bf;_0x58e453=0xc8;}else{_0x58e453=0xce;}_0x2b8f57['status'](_0x58e453);return _0x2b8f57['set']('Content-Range',_0x1eec90+'-'+_0x4ad222+'/'+_0x51c9bf)[_0xa7bf('0x29')](_0x3fcc23);}return null;};}function patchUpdates(_0x2ecced){return function(_0x393a09){try{jsonpatch[_0xa7bf('0x2d')](_0x393a09,_0x2ecced,!![]);}catch(_0xec9500){return BPromise[_0xa7bf('0x2e')](_0xec9500);}return _0x393a09[_0xa7bf('0x2f')]();};}function saveUpdates(_0x15c574,_0x245bb5){return function(_0x2a04eb){if(_0x2a04eb){return _0x2a04eb[_0xa7bf('0x30')](_0x15c574)['then'](function(_0x2a3d27){return _0x2a3d27;});}return null;};}function removeEntity(_0x159790,_0x50a1d7){return function(_0x40821f){if(_0x40821f){return _0x40821f['destroy']()[_0xa7bf('0x1d')](function(){var _0xaff3de=_0x40821f[_0xa7bf('0x31')]({'plain':!![]});var _0x5288b7=_0xa7bf('0x32');return db['UserProfileResource'][_0xa7bf('0x33')]({'where':{'type':_0x5288b7,'resourceId':_0xaff3de['id']}})[_0xa7bf('0x1d')](function(){return _0x40821f;});})['then'](function(){_0x159790[_0xa7bf('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df713,_0x19be22){return function(_0x48d431){if(!_0x48d431){_0x3df713[_0xa7bf('0x35')](0x194);}return _0x48d431;};}function handleError(_0x277d0b,_0x8f77be){_0x8f77be=_0x8f77be||0x1f4;return function(_0x1de874){logger[_0xa7bf('0x23')](_0x1de874[_0xa7bf('0x36')]);if(_0x1de874[_0xa7bf('0x37')]){delete _0x1de874[_0xa7bf('0x37')];}_0x277d0b[_0xa7bf('0x34')](_0x8f77be)[_0xa7bf('0x38')](_0x1de874);};}exports['index']=function(_0x123355,_0x40836f){var _0x5211bb={'include':[{'model':db[_0xa7bf('0x39')],'as':_0xa7bf('0x3a')}]},_0x13f98f={},_0x25d779={'count':0x0,'rows':[]};var _0x39e82d=_[_0xa7bf('0x3b')](db[_0xa7bf('0x3c')]['rawAttributes'],function(_0x43539a){return{'name':_0x43539a[_0xa7bf('0x3d')],'type':_0x43539a[_0xa7bf('0x3e')]['key']};});_0x13f98f[_0xa7bf('0x3f')]=_[_0xa7bf('0x3b')](_0x39e82d,_0xa7bf('0x37'));_0x13f98f['query']=_[_0xa7bf('0x40')](_0x123355[_0xa7bf('0x41')]);_0x13f98f[_0xa7bf('0x42')]=_[_0xa7bf('0x43')](_0x13f98f[_0xa7bf('0x3f')],_0x13f98f['query']);_0x5211bb['attributes']=_[_0xa7bf('0x43')](_0x13f98f[_0xa7bf('0x3f')],qs[_0xa7bf('0x44')](_0x123355[_0xa7bf('0x41')][_0xa7bf('0x44')]));_0x5211bb[_0xa7bf('0x45')]=_0x5211bb[_0xa7bf('0x45')][_0xa7bf('0x46')]?_0x5211bb[_0xa7bf('0x45')]:_0x13f98f[_0xa7bf('0x3f')];if(!_0x123355[_0xa7bf('0x41')][_0xa7bf('0x47')](_0xa7bf('0x48'))){_0x5211bb[_0xa7bf('0x2b')]=qs['limit'](_0x123355[_0xa7bf('0x41')][_0xa7bf('0x2b')]);_0x5211bb[_0xa7bf('0x2c')]=qs[_0xa7bf('0x2c')](_0x123355[_0xa7bf('0x41')]['offset']);}_0x5211bb[_0xa7bf('0x49')]=qs[_0xa7bf('0x4a')](_0x123355['query'][_0xa7bf('0x4a')]);_0x5211bb[_0xa7bf('0x4b')]=qs[_0xa7bf('0x42')](_[_0xa7bf('0x4c')](_0x123355['query'],_0x13f98f[_0xa7bf('0x42')]),_0x39e82d);if(_0x123355[_0xa7bf('0x41')][_0xa7bf('0x4d')]){_0x5211bb[_0xa7bf('0x4b')]=_[_0xa7bf('0x4e')](_0x5211bb['where'],{'$or':_[_0xa7bf('0x3b')](_0x39e82d,function(_0x325800){if(_0x325800[_0xa7bf('0x3e')]!==_0xa7bf('0x4f')){var _0x5df7f6={};_0x5df7f6[_0x325800[_0xa7bf('0x37')]]={'$like':'%'+_0x123355['query'][_0xa7bf('0x4d')]+'%'};return _0x5df7f6;}})});}_0x5211bb=_[_0xa7bf('0x4e')]({},_0x5211bb,_0x123355[_0xa7bf('0x50')]);var _0x3a2465={'where':_0x5211bb['where']};return db[_0xa7bf('0x3c')][_0xa7bf('0x51')](_0x3a2465)[_0xa7bf('0x1d')](function(_0x553e75){_0x25d779[_0xa7bf('0x51')]=_0x553e75;if(_0x123355['query'][_0xa7bf('0x52')]){_0x5211bb[_0xa7bf('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0xa7bf('0x54')](_0x5211bb);})[_0xa7bf('0x1d')](function(_0x58b81c){_0x25d779[_0xa7bf('0x55')]=_0x58b81c;return _0x25d779;})['then'](respondWithFilteredResult(_0x40836f,_0x5211bb))[_0xa7bf('0x27')](handleError(_0x40836f,null));};exports[_0xa7bf('0x56')]=function(_0x37ec74,_0x51b8e0){var _0xe9b6dc={'raw':![],'where':{'id':_0x37ec74[_0xa7bf('0x57')]['id']},'include':[{'model':db[_0xa7bf('0x39')],'as':_0xa7bf('0x3a')}]},_0x31a61d={};_0x31a61d[_0xa7bf('0x3f')]=_[_0xa7bf('0x40')](db['FaxAccount'][_0xa7bf('0x58')]);_0x31a61d['query']=_[_0xa7bf('0x40')](_0x37ec74[_0xa7bf('0x41')]);_0x31a61d['filters']=_[_0xa7bf('0x43')](_0x31a61d[_0xa7bf('0x3f')],_0x31a61d[_0xa7bf('0x41')]);_0xe9b6dc['attributes']=_[_0xa7bf('0x43')](_0x31a61d[_0xa7bf('0x3f')],qs['fields'](_0x37ec74[_0xa7bf('0x41')]['fields']));_0xe9b6dc[_0xa7bf('0x45')]=_0xe9b6dc[_0xa7bf('0x45')][_0xa7bf('0x46')]?_0xe9b6dc[_0xa7bf('0x45')]:_0x31a61d[_0xa7bf('0x3f')];if(_0x37ec74['query'][_0xa7bf('0x52')]){_0xe9b6dc[_0xa7bf('0x53')]=[{'all':!![]}];}_0xe9b6dc=_[_0xa7bf('0x4e')]({},_0xe9b6dc,_0x37ec74[_0xa7bf('0x50')]);return db[_0xa7bf('0x3c')][_0xa7bf('0x59')](_0xe9b6dc)[_0xa7bf('0x1d')](handleEntityNotFound(_0x51b8e0,null))[_0xa7bf('0x1d')](respondWithResult(_0x51b8e0,null))[_0xa7bf('0x27')](handleError(_0x51b8e0,null));};exports[_0xa7bf('0x5a')]=function(_0x2d7f2f,_0x3092c8){return db[_0xa7bf('0x3c')][_0xa7bf('0x5a')](_0x2d7f2f['body'],{})[_0xa7bf('0x1d')](function(_0x3e7404){var _0x5f48fd=_0x2d7f2f[_0xa7bf('0x5b')]['get']({'plain':!![]});if(!_0x5f48fd)throw new Error(_0xa7bf('0x5c'));if(_0x5f48fd[_0xa7bf('0x5d')]===_0xa7bf('0x5b')){var _0xb1a3cf=_0x3e7404[_0xa7bf('0x31')]({'plain':!![]});var _0x33f729=_0xa7bf('0x32');return db[_0xa7bf('0x5e')][_0xa7bf('0x59')]({'where':{'name':_0x33f729,'userProfileId':_0x5f48fd['userProfileId']},'raw':!![]})[_0xa7bf('0x1d')](function(_0x1d8e54){if(_0x1d8e54&&_0x1d8e54[_0xa7bf('0x5f')]===0x0){return db[_0xa7bf('0x60')][_0xa7bf('0x5a')]({'name':_0xb1a3cf[_0xa7bf('0x37')],'resourceId':_0xb1a3cf['id'],'type':_0x1d8e54['name'],'sectionId':_0x1d8e54['id']},{})[_0xa7bf('0x1d')](function(){return _0x3e7404;});}else{return _0x3e7404;}})[_0xa7bf('0x27')](function(_0x5a4498){logger[_0xa7bf('0x23')](_0xa7bf('0x61'),_0x5a4498);throw _0x5a4498;});}return _0x3e7404;})[_0xa7bf('0x1d')](respondWithResult(_0x3092c8,0xc9))[_0xa7bf('0x27')](handleError(_0x3092c8,null));};exports[_0xa7bf('0x30')]=function(_0x4f3745,_0x7c6453){if(_0x4f3745[_0xa7bf('0x62')]['id']){delete _0x4f3745[_0xa7bf('0x62')]['id'];}return db[_0xa7bf('0x3c')]['find']({'where':{'id':_0x4f3745[_0xa7bf('0x57')]['id']},'include':[{'model':db[_0xa7bf('0x39')],'as':'mandatoryDispositionPause'}]})[_0xa7bf('0x1d')](handleEntityNotFound(_0x7c6453,null))[_0xa7bf('0x1d')](saveUpdates(_0x4f3745[_0xa7bf('0x62')],null))[_0xa7bf('0x1d')](respondWithResult(_0x7c6453,null))['catch'](handleError(_0x7c6453,null));};exports[_0xa7bf('0x33')]=function(_0x414c9a,_0x5eb790){return db[_0xa7bf('0x3c')][_0xa7bf('0x59')]({'where':{'id':_0x414c9a[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x5eb790,null))[_0xa7bf('0x1d')](removeEntity(_0x5eb790,null))[_0xa7bf('0x27')](handleError(_0x5eb790,null));};exports['describe']=function(_0x35a6a2,_0x20b125){return db[_0xa7bf('0x3c')]['describe']()[_0xa7bf('0x1d')](respondWithResult(_0x20b125,null))[_0xa7bf('0x27')](handleError(_0x20b125,null));};exports[_0xa7bf('0x63')]=function(_0x5098da,_0xf5e1bc,_0x2b383c){if(_0x5098da[_0xa7bf('0x62')]['id']){delete _0x5098da[_0xa7bf('0x62')]['id'];}return db[_0xa7bf('0x3c')][_0xa7bf('0x59')]({'where':{'id':_0x5098da[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0xf5e1bc,null))['then'](function(_0x537ccf){if(_0x537ccf){_0x5098da[_0xa7bf('0x62')][_0xa7bf('0x64')]=_0x537ccf['id'];return db[_0xa7bf('0x65')][_0xa7bf('0x5a')](_0x5098da[_0xa7bf('0x62')]);}})['then'](respondWithResult(_0xf5e1bc,null))['catch'](handleError(_0xf5e1bc,null));};exports[_0xa7bf('0x66')]=function(_0x15cf75,_0x33ce2e,_0x472679){var _0x57097b={'raw':![],'where':{}};var _0x30a3b4={};var _0x51d0c3={'count':0x0,'rows':[]};return db[_0xa7bf('0x3c')][_0xa7bf('0x67')]({'where':{'id':_0x15cf75[_0xa7bf('0x57')]['id']}})['then'](handleEntityNotFound(_0x33ce2e,null))[_0xa7bf('0x1d')](function(_0x104ade){if(_0x104ade){_0x30a3b4[_0xa7bf('0x3f')]=_[_0xa7bf('0x40')](db[_0xa7bf('0x65')][_0xa7bf('0x58')]);_0x30a3b4['query']=_[_0xa7bf('0x40')](_0x15cf75[_0xa7bf('0x41')]);_0x30a3b4[_0xa7bf('0x42')]=_[_0xa7bf('0x43')](_0x30a3b4[_0xa7bf('0x3f')],_0x30a3b4[_0xa7bf('0x41')]);_0x57097b[_0xa7bf('0x45')]=_[_0xa7bf('0x43')](_0x30a3b4[_0xa7bf('0x3f')],qs[_0xa7bf('0x44')](_0x15cf75['query'][_0xa7bf('0x44')]));_0x57097b[_0xa7bf('0x45')]=_0x57097b[_0xa7bf('0x45')][_0xa7bf('0x46')]?_0x57097b[_0xa7bf('0x45')]:_0x30a3b4['model'];if(!_0x15cf75[_0xa7bf('0x41')][_0xa7bf('0x47')](_0xa7bf('0x48'))){_0x57097b[_0xa7bf('0x2b')]=qs[_0xa7bf('0x2b')](_0x15cf75[_0xa7bf('0x41')][_0xa7bf('0x2b')]);_0x57097b['offset']=qs[_0xa7bf('0x2c')](_0x15cf75[_0xa7bf('0x41')]['offset']);}_0x57097b[_0xa7bf('0x49')]=qs[_0xa7bf('0x4a')](_0x15cf75[_0xa7bf('0x41')]['sort']);_0x57097b[_0xa7bf('0x4b')]=qs[_0xa7bf('0x42')](_[_0xa7bf('0x4c')](_0x15cf75[_0xa7bf('0x41')],_0x30a3b4[_0xa7bf('0x42')]));_0x57097b['where'][_0xa7bf('0x64')]=_0x104ade['id'];if(_0x15cf75[_0xa7bf('0x41')]['filter']){_0x57097b[_0xa7bf('0x4b')]=_[_0xa7bf('0x4e')](_0x57097b['where'],{'$or':_[_0xa7bf('0x3b')](_0x57097b[_0xa7bf('0x45')],function(_0x59c8bc){var _0x55f464={};_0x55f464[_0x59c8bc]={'$like':'%'+_0x15cf75[_0xa7bf('0x41')][_0xa7bf('0x4d')]+'%'};return _0x55f464;})});}_0x57097b=_[_0xa7bf('0x4e')]({},_0x57097b,_0x15cf75[_0xa7bf('0x50')]);return db[_0xa7bf('0x65')]['count']({'where':_0x57097b['where']})[_0xa7bf('0x1d')](function(_0x420709){_0x51d0c3[_0xa7bf('0x51')]=_0x420709;if(_0x15cf75[_0xa7bf('0x41')][_0xa7bf('0x52')]){_0x57097b[_0xa7bf('0x53')]=[{'all':!![]}];}return db[_0xa7bf('0x65')]['findAll'](_0x57097b);})[_0xa7bf('0x1d')](function(_0x1758bc){_0x51d0c3[_0xa7bf('0x55')]=_0x1758bc;return _0x51d0c3;});}})['then'](respondWithFilteredResult(_0x33ce2e,_0x57097b))[_0xa7bf('0x27')](handleError(_0x33ce2e,null));};exports[_0xa7bf('0x68')]=function(_0x33f09d,_0x5e0ab6,_0x1533ed){return db['FaxAccount'][_0xa7bf('0x59')]({'where':{'id':_0x33f09d['params']['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x5e0ab6,null))[_0xa7bf('0x1d')](function(_0x44f841){if(_0x44f841){return _0x44f841[_0xa7bf('0x68')](_0x33f09d[_0xa7bf('0x41')]['ids']);}})[_0xa7bf('0x1d')](respondWithStatusCode(_0x5e0ab6,null))['catch'](handleError(_0x5e0ab6,null));};exports[_0xa7bf('0x69')]=function(_0x2d67ef,_0x516054,_0x345c91){if(_0x2d67ef[_0xa7bf('0x62')]['id']){delete _0x2d67ef['body']['id'];}return db[_0xa7bf('0x3c')][_0xa7bf('0x59')]({'where':{'id':_0x2d67ef[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x516054,null))[_0xa7bf('0x1d')](function(_0x21d48b){if(_0x21d48b){_0x2d67ef[_0xa7bf('0x62')]['FaxAccountId']=_0x21d48b['id'];return db['CannedAnswer'][_0xa7bf('0x5a')](_0x2d67ef[_0xa7bf('0x62')]);}})[_0xa7bf('0x1d')](respondWithResult(_0x516054,null))['catch'](handleError(_0x516054,null));};exports['getAnswers']=function(_0x35524b,_0x40a0f2,_0x4956b3){var _0x1706ab={'raw':![],'where':{}};var _0x4b5585={};var _0x4ed7c8={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa7bf('0x67')]({'where':{'id':_0x35524b[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x40a0f2,null))[_0xa7bf('0x1d')](function(_0x559c32){if(_0x559c32){_0x4b5585[_0xa7bf('0x3f')]=_['keys'](db[_0xa7bf('0x6a')][_0xa7bf('0x58')]);_0x4b5585[_0xa7bf('0x41')]=_['keys'](_0x35524b[_0xa7bf('0x41')]);_0x4b5585[_0xa7bf('0x42')]=_[_0xa7bf('0x43')](_0x4b5585['model'],_0x4b5585['query']);_0x1706ab[_0xa7bf('0x45')]=_[_0xa7bf('0x43')](_0x4b5585[_0xa7bf('0x3f')],qs['fields'](_0x35524b[_0xa7bf('0x41')][_0xa7bf('0x44')]));_0x1706ab['attributes']=_0x1706ab[_0xa7bf('0x45')][_0xa7bf('0x46')]?_0x1706ab[_0xa7bf('0x45')]:_0x4b5585[_0xa7bf('0x3f')];if(!_0x35524b[_0xa7bf('0x41')][_0xa7bf('0x47')](_0xa7bf('0x48'))){_0x1706ab[_0xa7bf('0x2b')]=qs[_0xa7bf('0x2b')](_0x35524b[_0xa7bf('0x41')][_0xa7bf('0x2b')]);_0x1706ab[_0xa7bf('0x2c')]=qs['offset'](_0x35524b['query'][_0xa7bf('0x2c')]);}_0x1706ab[_0xa7bf('0x49')]=qs[_0xa7bf('0x4a')](_0x35524b[_0xa7bf('0x41')][_0xa7bf('0x4a')]);_0x1706ab[_0xa7bf('0x4b')]=qs[_0xa7bf('0x42')](_[_0xa7bf('0x4c')](_0x35524b['query'],_0x4b5585[_0xa7bf('0x42')]));_0x1706ab[_0xa7bf('0x4b')][_0xa7bf('0x64')]=_0x559c32['id'];if(_0x35524b[_0xa7bf('0x41')][_0xa7bf('0x4d')]){_0x1706ab[_0xa7bf('0x4b')]=_[_0xa7bf('0x4e')](_0x1706ab[_0xa7bf('0x4b')],{'$or':_['map'](_0x1706ab['attributes'],function(_0x319d30){var _0x1d3e1a={};_0x1d3e1a[_0x319d30]={'$like':'%'+_0x35524b[_0xa7bf('0x41')][_0xa7bf('0x4d')]+'%'};return _0x1d3e1a;})});}_0x1706ab=_[_0xa7bf('0x4e')]({},_0x1706ab,_0x35524b[_0xa7bf('0x50')]);return db[_0xa7bf('0x6a')][_0xa7bf('0x51')]({'where':_0x1706ab[_0xa7bf('0x4b')]})['then'](function(_0x1c93ce){_0x4ed7c8['count']=_0x1c93ce;if(_0x35524b[_0xa7bf('0x41')]['includeAll']){_0x1706ab[_0xa7bf('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa7bf('0x54')](_0x1706ab);})['then'](function(_0x59bb0d){_0x4ed7c8[_0xa7bf('0x55')]=_0x59bb0d;return _0x4ed7c8;});}})[_0xa7bf('0x1d')](respondWithFilteredResult(_0x40a0f2,_0x1706ab))[_0xa7bf('0x27')](handleError(_0x40a0f2,null));};exports[_0xa7bf('0x6b')]=function(_0x3b6895,_0x2e13b1,_0x1412f5){return db[_0xa7bf('0x3c')][_0xa7bf('0x59')]({'where':{'id':_0x3b6895[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x2e13b1,null))['then'](function(_0x4fed85){if(_0x4fed85){return _0x4fed85['removeAnswers'](_0x3b6895['query'][_0xa7bf('0x6c')]);}})[_0xa7bf('0x1d')](respondWithStatusCode(_0x2e13b1,null))['catch'](handleError(_0x2e13b1,null));};exports['addInteraction']=function(_0x514984,_0x1d5311,_0xf45eba){return db[_0xa7bf('0x6d')][_0xa7bf('0x59')]({'where':{'id':_0x514984[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x1d5311,null))[_0xa7bf('0x1d')](function(_0x162675){if(_0x162675){return _0x162675[_0xa7bf('0x6e')](_0x514984['body']['ids'],_[_0xa7bf('0x6f')](_0x514984[_0xa7bf('0x62')],[_0xa7bf('0x6c'),'id'])||{});}})[_0xa7bf('0x1d')](respondWithResult(_0x1d5311,null))['catch'](handleError(_0x1d5311,null));};exports[_0xa7bf('0x70')]=function(_0x1cdd21,_0x47c7ee,_0x1b5c5d){var _0x277930={'raw':![],'where':{}};var _0x1d0011={};var _0x2445bc={'count':0x0,'rows':[]};return db[_0xa7bf('0x3c')][_0xa7bf('0x67')]({'where':{'id':_0x1cdd21[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x47c7ee,null))[_0xa7bf('0x1d')](function(_0x294311){if(_0x294311){_0x1d0011[_0xa7bf('0x3f')]=_[_0xa7bf('0x40')](db[_0xa7bf('0x6d')][_0xa7bf('0x58')]);_0x1d0011[_0xa7bf('0x41')]=_[_0xa7bf('0x40')](_0x1cdd21[_0xa7bf('0x41')]);_0x1d0011[_0xa7bf('0x42')]=_[_0xa7bf('0x43')](_0x1d0011['model'],_0x1d0011['query']);_0x277930[_0xa7bf('0x45')]=_[_0xa7bf('0x43')](_0x1d0011[_0xa7bf('0x3f')],qs[_0xa7bf('0x44')](_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x44')]));_0x277930[_0xa7bf('0x45')]=_0x277930[_0xa7bf('0x45')][_0xa7bf('0x46')]?_0x277930['attributes']:_0x1d0011[_0xa7bf('0x3f')];if(!_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x47')]('nolimit')){_0x277930[_0xa7bf('0x2b')]=qs['limit'](_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x2b')]);_0x277930['offset']=qs[_0xa7bf('0x2c')](_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x2c')]);}_0x277930[_0xa7bf('0x49')]=qs[_0xa7bf('0x4a')](_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x4a')]);_0x277930[_0xa7bf('0x4b')]=qs['filters'](_[_0xa7bf('0x4c')](_0x1cdd21[_0xa7bf('0x41')],_0x1d0011[_0xa7bf('0x42')]));_0x277930[_0xa7bf('0x4b')][_0xa7bf('0x64')]=_0x294311['id'];if(_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x4d')]){_0x277930[_0xa7bf('0x4b')]=_[_0xa7bf('0x4e')](_0x277930[_0xa7bf('0x4b')],{'$or':_['map'](_0x277930[_0xa7bf('0x45')],function(_0x51e63b){var _0xd6a47d={};_0xd6a47d[_0x51e63b]={'$like':'%'+_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x4d')]+'%'};return _0xd6a47d;})});}_0x277930=_['merge']({},_0x277930,_0x1cdd21[_0xa7bf('0x50')]);return db[_0xa7bf('0x6d')][_0xa7bf('0x51')]({'where':_0x277930[_0xa7bf('0x4b')]})['then'](function(_0x435889){_0x2445bc[_0xa7bf('0x51')]=_0x435889;if(_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x52')]){_0x277930[_0xa7bf('0x53')]=[{'model':db['CmContact'],'as':_0xa7bf('0x71'),'required':![]},{'model':db[_0xa7bf('0x72')],'as':'Owner','attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xa7bf('0x73')],'as':_0xa7bf('0x74'),'attributes':['id','name',_0xa7bf('0x75')],'where':_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x76')]?{'id':_0x1cdd21[_0xa7bf('0x41')]['tag']}:undefined,'required':_0x1cdd21[_0xa7bf('0x41')][_0xa7bf('0x76')]?!![]:![]}];}return db[_0xa7bf('0x6d')]['findAll'](_0x277930);})['then'](function(_0x400bba){_0x2445bc[_0xa7bf('0x55')]=_0x400bba;return _0x2445bc;});}})['then'](respondWithFilteredResult(_0x47c7ee,_0x277930))['catch'](handleError(_0x47c7ee,null));};exports[_0xa7bf('0x77')]=function(_0x1cc92d,_0x128b08){var _0x2847d1=_0x1cc92d[_0xa7bf('0x57')]['id'];var _0x260f76=_0x1cc92d[_0xa7bf('0x62')];var _0x4d302e=0xc8;var _0x1628e9=null;return db[_0xa7bf('0x78')][_0xa7bf('0x79')]({'isolationLevel':db[_0xa7bf('0x78')]['Transaction'][_0xa7bf('0x7a')][_0xa7bf('0x7b')]},function(_0x145452){return db[_0xa7bf('0x3c')][_0xa7bf('0x67')]({'where':{'id':_0x2847d1},'transaction':_0x145452})[_0xa7bf('0x1d')](function(_0x3129bd){if(_0x3129bd){return db[_0xa7bf('0x7c')][_0xa7bf('0x33')]({'where':{'FaxAccountId':_0x2847d1},'transaction':_0x145452})[_0xa7bf('0x1d')](function(){var _0x1759d4=_[_0xa7bf('0x3b')](_0x260f76,function(_0x3b55f9){_0x3b55f9[_0xa7bf('0x64')]=_0x2847d1;return _0x3b55f9;});return db[_0xa7bf('0x7c')][_0xa7bf('0x7d')](_0x1759d4,{'transaction':_0x145452});});}else{_0x4d302e=0x194;_0x1628e9=[];}});})['then'](function(){if(_0x4d302e!==0x194){return db[_0xa7bf('0x7c')]['findAndCountAll']({'where':{'FaxAccountId':_0x2847d1},'order':'priority'})[_0xa7bf('0x1d')](function(_0x292276){_0x1628e9=_0x292276;});}})[_0xa7bf('0x27')](function(_0x1b6727){_0x4d302e=0x1f4;logger['error'](_0x1b6727[_0xa7bf('0x36')]);if(_0x1b6727[_0xa7bf('0x37')]){delete _0x1b6727[_0xa7bf('0x37')];}_0x1628e9=_0x1b6727;})[_0xa7bf('0x7e')](function(){if(_0x1628e9===null){_0x128b08['sendStatus'](_0x4d302e);}else{if(_0x4d302e===0x1f4){_0x128b08['status'](_0x4d302e)[_0xa7bf('0x38')](_0x1628e9);}else{_0x128b08['status'](_0x4d302e)[_0xa7bf('0x29')](_0x1628e9);}}});};exports[_0xa7bf('0x7f')]=function(_0x433cfe,_0x2671d1,_0x2414bc){var _0x3a94fc={};var _0x108602={};var _0x2f94f0;var _0x51c710;return db['FaxAccount'][_0xa7bf('0x67')]({'where':{'id':_0x433cfe[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x2671d1,null))[_0xa7bf('0x1d')](function(_0x3fddd7){if(_0x3fddd7){_0x2f94f0=_0x3fddd7;_0x108602[_0xa7bf('0x3f')]=_[_0xa7bf('0x40')](db[_0xa7bf('0x7c')][_0xa7bf('0x58')]);_0x108602[_0xa7bf('0x41')]=_['keys'](_0x433cfe['query']);_0x108602[_0xa7bf('0x42')]=_['intersection'](_0x108602[_0xa7bf('0x3f')],_0x108602[_0xa7bf('0x41')]);_0x3a94fc[_0xa7bf('0x45')]=_[_0xa7bf('0x43')](_0x108602[_0xa7bf('0x3f')],qs['fields'](_0x433cfe[_0xa7bf('0x41')][_0xa7bf('0x44')]));_0x3a94fc[_0xa7bf('0x45')]=_0x3a94fc[_0xa7bf('0x45')][_0xa7bf('0x46')]?_0x3a94fc[_0xa7bf('0x45')]:_0x108602[_0xa7bf('0x3f')];_0x3a94fc[_0xa7bf('0x49')]=qs[_0xa7bf('0x4a')](_0x433cfe[_0xa7bf('0x41')][_0xa7bf('0x4a')]);_0x3a94fc[_0xa7bf('0x4b')]=qs[_0xa7bf('0x42')](_[_0xa7bf('0x4c')](_0x433cfe['query'],_0x108602[_0xa7bf('0x42')]));if(_0x433cfe[_0xa7bf('0x41')][_0xa7bf('0x4d')]){_0x3a94fc[_0xa7bf('0x4b')]=_[_0xa7bf('0x4e')](_0x3a94fc[_0xa7bf('0x4b')],{'$or':_[_0xa7bf('0x3b')](_0x3a94fc[_0xa7bf('0x45')],function(_0x21fb18){var _0x19f8cc={};_0x19f8cc[_0x21fb18]={'$like':'%'+_0x433cfe[_0xa7bf('0x41')][_0xa7bf('0x4d')]+'%'};return _0x19f8cc;})});}_0x3a94fc=_[_0xa7bf('0x4e')]({},_0x3a94fc,_0x433cfe['options']);return _0x2f94f0[_0xa7bf('0x7f')](_0x3a94fc);}})[_0xa7bf('0x1d')](function(_0x37180f){if(_0x37180f){_0x51c710=_0x37180f[_0xa7bf('0x46')];if(!_0x433cfe[_0xa7bf('0x41')]['hasOwnProperty'](_0xa7bf('0x48'))){_0x3a94fc[_0xa7bf('0x2b')]=qs[_0xa7bf('0x2b')](_0x433cfe['query'][_0xa7bf('0x2b')]);_0x3a94fc[_0xa7bf('0x2c')]=qs['offset'](_0x433cfe[_0xa7bf('0x41')]['offset']);}return _0x2f94f0[_0xa7bf('0x7f')](_0x3a94fc);}})[_0xa7bf('0x1d')](function(_0x43ccef){if(_0x43ccef){return _0x43ccef?{'count':_0x51c710,'rows':_0x43ccef}:null;}})[_0xa7bf('0x1d')](respondWithResult(_0x2671d1,null))[_0xa7bf('0x27')](handleError(_0x2671d1,null));};function Extension(_0x2c1c6e,_0x126c3a,_0x519932,_0x4f121b){this[_0xa7bf('0x80')]=_0xa7bf('0x81');this['exten']=_0x2c1c6e['localstationid'];this[_0xa7bf('0x82')]=_0x4f121b;this[_0xa7bf('0x3e')]=_0xa7bf('0x83');this[_0xa7bf('0x84')]=_0xa7bf('0x85');this[_0xa7bf('0x64')]=_0x2c1c6e['id'];this[_0xa7bf('0x86')]=_0x126c3a;this[_0xa7bf('0x87')]=_0x519932;}function createExtensionsReciveFax(_0x9dedc3){var _0x8ef77a=0x1;var _0x7a3dab=[];_0x7a3dab['push'](new Extension(_0x9dedc3,_0x8ef77a,'',_0xa7bf('0x88')));_0x8ef77a+=0x1;_0x7a3dab[_0xa7bf('0x89')](new Extension(_0x9dedc3,_0x8ef77a,_0xa7bf('0x8a'),_0xa7bf('0x8b')));_0x8ef77a+=0x1;for(var _0xfce005 in _0x9dedc3){if(_0x9dedc3[_0xa7bf('0x47')](_0xfce005)&&(_0xfce005===_0xa7bf('0x8c')||_0xfce005==='localstationid'||_0xfce005==='gateway'||_0xfce005===_0xa7bf('0x8d')||_0xfce005===_0xa7bf('0x8e')||_0xfce005==='maxrate'||_0xfce005===_0xa7bf('0x8f')||_0xfce005===_0xa7bf('0x90')||_0xfce005===_0xa7bf('0x91'))){_0x7a3dab[_0xa7bf('0x89')](new Extension(_0x9dedc3,_0x8ef77a,_0xa7bf('0x92')+_0xfce005+')='+_0x9dedc3[_0xfce005],_0xa7bf('0x8b')));_0x8ef77a+=0x1;}}_0x7a3dab[_0xa7bf('0x89')](new Extension(_0x9dedc3,_0x8ef77a,'6',_0xa7bf('0x93')));_0x8ef77a+=0x1;_0x7a3dab['push'](new Extension(_0x9dedc3,_0x8ef77a,_0xa7bf('0x94'),'ReceiveFax'));_0x8ef77a=0x0;return _0x7a3dab;}exports['addAccountApplications']=function(_0x233a4b,_0x1a76a1,_0x3ce252){var _0x42b8ba;return db[_0xa7bf('0x78')]['transaction'](function(_0x204a00){return db[_0xa7bf('0x3c')]['create'](_0x233a4b['body'],{'transaction':_0x204a00})[_0xa7bf('0x1d')](function(_0x3496e7){_0x42b8ba=_0x3496e7[_0xa7bf('0x31')]({'plain':!![]});return db[_0xa7bf('0x95')][_0xa7bf('0x7d')](createExtensionsReciveFax(_0x42b8ba),{'transaction':_0x204a00});});})[_0xa7bf('0x1d')](function(){return _0x42b8ba;})[_0xa7bf('0x1d')](respondWithResult(_0x1a76a1,null))[_0xa7bf('0x27')](handleError(_0x1a76a1,null));};exports['updateAccountApplications']=function(_0x4ec384,_0x120a65,_0x14a391){var _0x1ed774;return db[_0xa7bf('0x78')]['transaction'](function(_0xa98727){return db[_0xa7bf('0x3c')][_0xa7bf('0x30')](_0x4ec384[_0xa7bf('0x62')],{'where':{'id':_0x4ec384[_0xa7bf('0x62')]['id']},'transaction':_0xa98727})[_0xa7bf('0x1d')](function(_0x4d8c5f){return db[_0xa7bf('0x95')][_0xa7bf('0x33')]({'where':{'FaxAccountId':_0x4ec384[_0xa7bf('0x62')]['id']},'transaction':_0xa98727})[_0xa7bf('0x1d')](function(_0x3a20c8){return db[_0xa7bf('0x95')]['bulkCreate'](createExtensionsReciveFax(_[_0xa7bf('0x6f')](_0x4ec384['body'],[_0xa7bf('0x96'),_0xa7bf('0x97'),_0xa7bf('0x98'),_0xa7bf('0x99'),_0xa7bf('0x9a'),_0xa7bf('0x9b')])),{'transaction':_0xa98727});});});})[_0xa7bf('0x1d')](function(){return db[_0xa7bf('0x3c')]['findById'](_0x4ec384[_0xa7bf('0x62')]['id']);})['then'](respondWithResult(_0x120a65,null))['catch'](handleError(_0x120a65,null));};exports['getMessages']=function(_0x3a8323,_0x586b23,_0x40b941){var _0x2b87d6={'raw':!![],'where':{}};var _0x5eceac={};var _0xd78799={'count':0x0,'rows':[]};return db[_0xa7bf('0x3c')][_0xa7bf('0x67')]({'where':{'id':_0x3a8323[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x586b23,null))[_0xa7bf('0x1d')](function(_0x5d6425){if(_0x5d6425){_0x5eceac['model']=_[_0xa7bf('0x40')](db['FaxMessage']['rawAttributes']);_0x5eceac[_0xa7bf('0x41')]=_[_0xa7bf('0x40')](_0x3a8323[_0xa7bf('0x41')]);_0x5eceac[_0xa7bf('0x42')]=_['intersection'](_0x5eceac[_0xa7bf('0x3f')],_0x5eceac[_0xa7bf('0x41')]);_0x2b87d6['attributes']=_[_0xa7bf('0x43')](_0x5eceac['model'],qs[_0xa7bf('0x44')](_0x3a8323[_0xa7bf('0x41')][_0xa7bf('0x44')]));_0x2b87d6[_0xa7bf('0x45')]=_0x2b87d6[_0xa7bf('0x45')][_0xa7bf('0x46')]?_0x2b87d6[_0xa7bf('0x45')]:_0x5eceac[_0xa7bf('0x3f')];if(!_0x3a8323[_0xa7bf('0x41')][_0xa7bf('0x47')](_0xa7bf('0x48'))){_0x2b87d6[_0xa7bf('0x2b')]=qs[_0xa7bf('0x2b')](_0x3a8323[_0xa7bf('0x41')][_0xa7bf('0x2b')]);_0x2b87d6['offset']=qs['offset'](_0x3a8323['query'][_0xa7bf('0x2c')]);}_0x2b87d6['order']=qs['sort'](_0x3a8323[_0xa7bf('0x41')][_0xa7bf('0x4a')]);_0x2b87d6[_0xa7bf('0x4b')]=qs['filters'](_[_0xa7bf('0x4c')](_0x3a8323[_0xa7bf('0x41')],_0x5eceac[_0xa7bf('0x42')]));_0x2b87d6[_0xa7bf('0x4b')][_0xa7bf('0x64')]=_0x5d6425['id'];if(_0x3a8323[_0xa7bf('0x41')][_0xa7bf('0x4d')]){_0x2b87d6[_0xa7bf('0x4b')]=_[_0xa7bf('0x4e')](_0x2b87d6[_0xa7bf('0x4b')],{'$or':_['map'](_0x2b87d6[_0xa7bf('0x45')],function(_0x2c78c9){var _0x57dc7f={};_0x57dc7f[_0x2c78c9]={'$like':'%'+_0x3a8323[_0xa7bf('0x41')]['filter']+'%'};return _0x57dc7f;})});}if(_0x3a8323['query'][_0xa7bf('0x9c')]){var _0x27fc8=_0x3a8323[_0xa7bf('0x41')][_0xa7bf('0x9c')][_0xa7bf('0x9d')](',');var _0x250c77={};_0x250c77[_0x27fc8[0x0]]={'$gte':moment(_0x27fc8[0x1])[_0xa7bf('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2b87d6['where']=_[_0xa7bf('0x4e')](_0x2b87d6['where'],_0x250c77);}_0x2b87d6=_[_0xa7bf('0x4e')]({},_0x2b87d6,_0x3a8323[_0xa7bf('0x50')]);return db[_0xa7bf('0x9f')][_0xa7bf('0x51')]({'where':_0x2b87d6[_0xa7bf('0x4b')]})[_0xa7bf('0x1d')](function(_0x1045cc){_0xd78799['count']=_0x1045cc;if(_0x3a8323[_0xa7bf('0x41')]['includeAll']){_0x2b87d6[_0xa7bf('0x53')]=[{'all':!![]}];}return db[_0xa7bf('0x9f')][_0xa7bf('0x54')](_0x2b87d6);})[_0xa7bf('0x1d')](function(_0x4b7445){_0xd78799[_0xa7bf('0x55')]=_0x4b7445;return _0xd78799;});}})[_0xa7bf('0x1d')](respondWithFilteredResult(_0x586b23,_0x2b87d6))[_0xa7bf('0x27')](handleError(_0x586b23,null));};exports['send']=function(_0x57f295,_0x2b7cba,_0x26029e){var _0x181fe7,_0x3743ed={},_0x31423d;if(_0x57f295[_0xa7bf('0x62')]['to']){_0x31423d=_0x57f295['body']['to'][0x0];}return db[_0xa7bf('0x3c')][_0xa7bf('0x59')]({'where':{'id':_0x57f295[_0xa7bf('0x57')]['id']},'include':[{'model':db[_0xa7bf('0xa0')],'as':'List','include':[{'model':db[_0xa7bf('0xa1')],'as':'Contacts','where':{'fax':_0x31423d},'limit':0x1,'order':[[_0xa7bf('0x99'),_0xa7bf('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x2b7cba,null))[_0xa7bf('0x1d')](function(_0x443ecd){_0x181fe7=_0x443ecd;if(_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')]&&_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][_0xa7bf('0x46')]){for(var _0x5e08f4=0x0;_0x5e08f4<_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][_0xa7bf('0x46')];_0x5e08f4+=0x1){_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][_0x5e08f4]={'filename':_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][_0x5e08f4]['name'],'id':_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][_0x5e08f4]['id'],'path':path[_0xa7bf('0xa4')](config[_0xa7bf('0xa5')],_0xa7bf('0xa6'),_0x57f295[_0xa7bf('0x62')]['attachments'][_0x5e08f4]['basename'])};}}return respondWithRpcPromise(_0xa7bf('0xa7'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x57f295['params']['id'])?undefined:_0x57f295[_0xa7bf('0x57')]['id'],'path':_[_0xa7bf('0xa8')](_0x57f295['body'][_0xa7bf('0xa3')][0x0][_0xa7bf('0x6')])?undefined:_0x57f295['body']['attachments'][0x0][_0xa7bf('0x6')],'fax':_['isNil'](_0x57f295[_0xa7bf('0x62')]['to'][0x0])?undefined:_0x57f295[_0xa7bf('0x62')]['to'][0x0]},client9002);})[_0xa7bf('0x1d')](function(){if(_0x181fe7){if(_['isNil'](_0x57f295[_0xa7bf('0x62')]['from'])){_0x57f295['body'][_0xa7bf('0xa9')]=util[_0xa7bf('0x9e')](_0xa7bf('0xaa'),_0x181fe7[_0xa7bf('0x37')],_0x181fe7['fax']);}if(_0x181fe7[_0xa7bf('0xab')]){if(_0x181fe7[_0xa7bf('0xab')][_0xa7bf('0xac')][_0xa7bf('0x46')]){return _0x181fe7['List'][_0xa7bf('0xac')][0x0];}else{return db[_0xa7bf('0xa1')][_0xa7bf('0x5a')](_[_0xa7bf('0x16')](_0x57f295[_0xa7bf('0x62')],{'firstName':_0x57f295['body']['to'][0x0],'phone':_0x57f295['body']['to'][0x0],'fax':_0x57f295[_0xa7bf('0x62')]['to'][0x0],'ListId':_0x181fe7[_0xa7bf('0x9b')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xa7bf('0xad'));}})[_0xa7bf('0x1d')](function(_0x42af65){if(_0x42af65){return db['FaxInteraction'][_0xa7bf('0x59')]({'where':{'ContactId':_0x42af65['id'],'closed':![],'FaxAccountId':_0x181fe7['id']}})[_0xa7bf('0x1d')](function(_0x3499f8){if(_0x3499f8){return[_0x3499f8,![]];}return db[_0xa7bf('0x6d')][_0xa7bf('0x5a')]({'UserId':_0x57f295['user']['id'],'ContactId':_0x42af65['id'],'FaxAccountId':_0x181fe7['id'],'fax':_0x57f295['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa7bf('0x4e')](_0x57f295[_0xa7bf('0x62')],{'read':![],'body':_0x57f295[_0xa7bf('0x62')]['attachments'][0x0][_0xa7bf('0xae')],'FaxAccountId':_0x181fe7['id'],'UserId':_0x57f295[_0xa7bf('0x5b')]['id'],'ContactId':_0x42af65['id'],'AttachmentId':_0x57f295['body'][_0xa7bf('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0xa7bf('0x9f')],'as':_0xa7bf('0xaf')}]})['then'](function(_0x3d9ddf){return[_0x3d9ddf,!![]];});});}else{throw new Error(_0xa7bf('0xb0'));}})[_0xa7bf('0xb1')](function(_0x198ffc,_0x11ae89){if(_0x11ae89){return _0x198ffc;}return db['FaxMessage'][_0xa7bf('0x5a')]({'direction':_0xa7bf('0xb2'),'read':![],'body':_0x57f295[_0xa7bf('0x62')]['attachments'][0x0]['filename'],'FaxAccountId':_0x181fe7['id'],'FaxInteractionId':_0x198ffc['id'],'UserId':_0x57f295['user']['id'],'ContactId':_0x198ffc['ContactId'],'AttachmentId':_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][0x0]['id']})[_0xa7bf('0x1d')](function(_0x5974e4){_0x198ffc[_0xa7bf('0xb3')]['Messages']=[];_0x198ffc[_0xa7bf('0xb3')][_0xa7bf('0xaf')]['push'](_0x5974e4[_0xa7bf('0xb3')]);return _0x198ffc;});})[_0xa7bf('0x1d')](function(_0x317c3e){respondWithRpcPromise(_0xa7bf('0xb4'),'SendFax',{'FaxAccountId':_[_0xa7bf('0xa8')](_0x57f295[_0xa7bf('0x57')]['id'])?undefined:_0x57f295['params']['id'],'path':_[_0xa7bf('0xa8')](_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][0x0][_0xa7bf('0x6')])?undefined:_0x57f295['body'][_0xa7bf('0xa3')][0x0]['path'],'fax':_[_0xa7bf('0xa8')](_0x57f295[_0xa7bf('0x62')]['to'][0x0])?undefined:_0x57f295['body']['to'][0x0],'AttachmentId':_0x57f295[_0xa7bf('0x62')][_0xa7bf('0xa3')][0x0]['id']},client9002)['then'](function(_0x51a45c){logger[_0xa7bf('0x1e')](_0xa7bf('0xb5'),_0x51a45c);})[_0xa7bf('0x27')](function(_0x5471cd){logger[_0xa7bf('0x1e')](_0xa7bf('0xb5'),_0x5471cd);});return _0x317c3e;})[_0xa7bf('0x1d')](respondWithResult(_0x2b7cba,null))[_0xa7bf('0x27')](handleError(_0x2b7cba,null));};exports[_0xa7bf('0xb6')]=function(_0x38793c,_0x418528,_0x161ad3){return db[_0xa7bf('0x3c')][_0xa7bf('0x59')]({'where':{'id':_0x38793c[_0xa7bf('0x57')]['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x418528,null))[_0xa7bf('0x1d')](function(_0x24a2db){if(_0x24a2db){return _0x24a2db[_0xa7bf('0xb6')](_0x38793c[_0xa7bf('0x62')][_0xa7bf('0x6c')],_[_0xa7bf('0x6f')](_0x38793c['body'],[_0xa7bf('0x6c'),'id'])||{})[_0xa7bf('0xb1')](function(_0x57a2c6){for(var _0xf39a02=0x0;_0xf39a02<_0x38793c['body'][_0xa7bf('0x6c')]['length'];_0xf39a02+=0x1){socket[_0xa7bf('0xb7')](_0xa7bf('0xb8'),{'UserId':Number(_0x38793c[_0xa7bf('0x62')][_0xa7bf('0x6c')][_0xf39a02]),'FaxAccountId':Number(_0x38793c[_0xa7bf('0x57')]['id'])});}return _0x57a2c6;});}})[_0xa7bf('0x1d')](respondWithResult(_0x418528,null))['catch'](handleError(_0x418528,null));};exports[_0xa7bf('0xb9')]=function(_0x296572,_0x49c321,_0x57be5e){return db[_0xa7bf('0x3c')][_0xa7bf('0x59')]({'where':{'id':_0x296572['params']['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x49c321,null))[_0xa7bf('0x1d')](function(_0x37e1ff){if(_0x37e1ff){return _0x37e1ff[_0xa7bf('0xb9')](_0x296572['query'][_0xa7bf('0x6c')])[_0xa7bf('0x1d')](function(){if(_[_0xa7bf('0xba')](_0x296572[_0xa7bf('0x41')][_0xa7bf('0x6c')])){for(var _0x449156=0x0;_0x449156<_0x296572[_0xa7bf('0x41')][_0xa7bf('0x6c')][_0xa7bf('0x46')];_0x449156+=0x1){socket[_0xa7bf('0xb7')](_0xa7bf('0xbb'),{'UserId':Number(_0x296572['query'][_0xa7bf('0x6c')][_0x449156]),'FaxAccountId':Number(_0x296572[_0xa7bf('0x57')]['id'])});}}else{socket[_0xa7bf('0xb7')](_0xa7bf('0xbb'),{'UserId':Number(_0x296572[_0xa7bf('0x41')][_0xa7bf('0x6c')]),'FaxAccountId':Number(_0x296572[_0xa7bf('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x49c321,null))[_0xa7bf('0x27')](handleError(_0x49c321,null));};exports[_0xa7bf('0xbc')]=function(_0x360aed,_0x5b424f,_0xcd4c85){var _0x4dc35e={};var _0x450f56={};var _0xe8a90e;var _0x593441;return db['FaxAccount']['findOne']({'where':{'id':_0x360aed['params']['id']}})[_0xa7bf('0x1d')](handleEntityNotFound(_0x5b424f,null))[_0xa7bf('0x1d')](function(_0x13e69c){if(_0x13e69c){_0xe8a90e=_0x13e69c;_0x450f56[_0xa7bf('0x3f')]=_[_0xa7bf('0x40')](db[_0xa7bf('0x72')][_0xa7bf('0x58')]);_0x450f56[_0xa7bf('0x41')]=_[_0xa7bf('0x40')](_0x360aed['query']);_0x450f56[_0xa7bf('0x42')]=_[_0xa7bf('0x43')](_0x450f56[_0xa7bf('0x3f')],_0x450f56[_0xa7bf('0x41')]);_0x4dc35e['attributes']=_[_0xa7bf('0x43')](_0x450f56[_0xa7bf('0x3f')],qs[_0xa7bf('0x44')](_0x360aed[_0xa7bf('0x41')]['fields']));_0x4dc35e[_0xa7bf('0x45')]=_0x4dc35e[_0xa7bf('0x45')]['length']?_0x4dc35e[_0xa7bf('0x45')]:_0x450f56[_0xa7bf('0x3f')];_0x4dc35e['order']=qs[_0xa7bf('0x4a')](_0x360aed['query']['sort']);_0x4dc35e[_0xa7bf('0x4b')]=qs[_0xa7bf('0x42')](_[_0xa7bf('0x4c')](_0x360aed[_0xa7bf('0x41')],_0x450f56[_0xa7bf('0x42')]));if(_0x360aed[_0xa7bf('0x41')][_0xa7bf('0x4d')]){_0x4dc35e[_0xa7bf('0x4b')]=_[_0xa7bf('0x4e')](_0x4dc35e[_0xa7bf('0x4b')],{'$or':_[_0xa7bf('0x3b')](_0x4dc35e[_0xa7bf('0x45')],function(_0x5da21d){var _0x545d99={};_0x545d99[_0x5da21d]={'$like':'%'+_0x360aed[_0xa7bf('0x41')]['filter']+'%'};return _0x545d99;})});}_0x4dc35e=_[_0xa7bf('0x4e')]({},_0x4dc35e,_0x360aed[_0xa7bf('0x50')]);return _0xe8a90e[_0xa7bf('0xbc')](_0x4dc35e);}})[_0xa7bf('0x1d')](function(_0x57858a){if(_0x57858a){_0x593441=_0x57858a[_0xa7bf('0x46')];if(!_0x360aed['query'][_0xa7bf('0x47')]('nolimit')){_0x4dc35e[_0xa7bf('0x2b')]=qs['limit'](_0x360aed['query'][_0xa7bf('0x2b')]);_0x4dc35e[_0xa7bf('0x2c')]=qs[_0xa7bf('0x2c')](_0x360aed['query'][_0xa7bf('0x2c')]);}return _0xe8a90e[_0xa7bf('0xbc')](_0x4dc35e);}})['then'](function(_0x3baf3b){if(_0x3baf3b){return _0x3baf3b?{'count':_0x593441,'rows':_0x3baf3b}:null;}})['then'](respondWithResult(_0x5b424f,null))['catch'](handleError(_0x5b424f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 132772d..2f3dab5 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 _0x8c11=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x111adf,_0x1a3d56){var _0x244df9=function(_0xaac73e){while(--_0xaac73e){_0x111adf['push'](_0x111adf['shift']());}};_0x244df9(++_0x1a3d56);}(_0x8c11,0xf5));var _0x18c1=function(_0x3c6ecc,_0x1808a0){_0x3c6ecc=_0x3c6ecc-0x0;var _0x52343f=_0x8c11[_0x3c6ecc];return _0x52343f;};'use strict';var EventEmitter=require(_0x18c1('0x0'));var FaxAccount=require(_0x18c1('0x1'))['db'][_0x18c1('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x18c1('0x3')](0x0);var events={'afterCreate':_0x18c1('0x4'),'afterUpdate':_0x18c1('0x5'),'afterDestroy':_0x18c1('0x6')};function emitEvent(_0x479693){return function(_0x4751bd,_0x1acac7,_0x85ef4e){FaxAccountEvents[_0x18c1('0x7')](_0x479693+':'+_0x4751bd['id'],_0x4751bd);FaxAccountEvents[_0x18c1('0x7')](_0x479693,_0x4751bd);_0x85ef4e(null);};}for(var e in events){if(events[_0x18c1('0x8')](e)){var event=events[e];FaxAccount[_0x18c1('0x9')](e,emitEvent(event));}}module[_0x18c1('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0x63ea=['hasOwnProperty','hook','exports','FaxAccount','setMaxListeners','save','update','emit'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x63ea,0x113));var _0xa63e=function(_0x4925f2,_0x4b48b9){_0x4925f2=_0x4925f2-0x0;var _0x2c765f=_0x63ea[_0x4925f2];return _0x2c765f;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xa63e('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa63e('0x1')](0x0);var events={'afterCreate':_0xa63e('0x2'),'afterUpdate':_0xa63e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x313715){return function(_0x545ccd,_0x18ae45,_0x3d63c7){FaxAccountEvents[_0xa63e('0x4')](_0x313715+':'+_0x545ccd['id'],_0x545ccd);FaxAccountEvents['emit'](_0x313715,_0x545ccd);_0x3d63c7(null);};}for(var e in events){if(events[_0xa63e('0x5')](e)){var event=events[e];FaxAccount[_0xa63e('0x6')](e,emitEvent(event));}}module[_0xa63e('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 85dda44..78a0cd0 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 _0xc2d0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxAccount','../../config/logger','api','moment'];(function(_0x3f70bb,_0x329d02){var _0x865b97=function(_0x21374b){while(--_0x21374b){_0x3f70bb['push'](_0x3f70bb['shift']());}};_0x865b97(++_0x329d02);}(_0xc2d0,0x16f));var _0x0c2d=function(_0x2a100e,_0x263ba5){_0x2a100e=_0x2a100e-0x0;var _0x517ac8=_0xc2d0[_0x2a100e];return _0x517ac8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c2d('0x0'))(_0x0c2d('0x1'));var moment=require(_0x0c2d('0x2'));var BPromise=require(_0x0c2d('0x3'));var rp=require(_0x0c2d('0x4'));var fs=require('fs');var path=require(_0x0c2d('0x5'));var rimraf=require(_0x0c2d('0x6'));var config=require(_0x0c2d('0x7'));var attributes=require('./faxAccount.attributes');module[_0x0c2d('0x8')]=function(_0x6b64f3,_0x4773aa){return _0x6b64f3['define'](_0x0c2d('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c72=['api','moment','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x27d1c4,_0x394f97){var _0x587bbf=function(_0x1e4082){while(--_0x1e4082){_0x27d1c4['push'](_0x27d1c4['shift']());}};_0x587bbf(++_0x394f97);}(_0x4c72,0x165));var _0x24c7=function(_0x391802,_0x2ef659){_0x391802=_0x391802-0x0;var _0x2048ce=_0x4c72[_0x391802];return _0x2048ce;};'use strict';var _=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var logger=require(_0x24c7('0x2'))(_0x24c7('0x3'));var moment=require(_0x24c7('0x4'));var BPromise=require(_0x24c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24c7('0x6'));var rimraf=require(_0x24c7('0x7'));var config=require(_0x24c7('0x8'));var attributes=require(_0x24c7('0x9'));module[_0x24c7('0xa')]=function(_0x250b04,_0x147113){return _0x250b04[_0x24c7('0xb')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 11396d3..1ebb7ef 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 _0x5238=['Applications','get','applications','list','orderBy','priority','asc','Contacts','length','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','queueId','FaxQueue','waitForTheAssignedQueue','Start','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','options','limit','include','map','model','NotifyFaxAccount','body','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','CmContact','DESC','FaxApplication'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x5238,0xcc));var _0x8523=function(_0x4d3828,_0x21064b){_0x4d3828=_0x4d3828-0x0;var _0x27684d=_0x5238[_0x4d3828];return _0x27684d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8523('0x0'));var BPromise=require(_0x8523('0x1'));var rs=require(_0x8523('0x2'));var fs=require('fs');var Redis=require(_0x8523('0x3'));var db=require(_0x8523('0x4'))['db'];var utils=require(_0x8523('0x5'));var logger=require(_0x8523('0x6'))(_0x8523('0x7'));var config=require('../../config/environment');var jayson=require(_0x8523('0x8'));var client=jayson[_0x8523('0x9')][_0x8523('0xa')]({'port':0x232c});config[_0x8523('0xb')]=_[_0x8523('0xc')](config[_0x8523('0xb')],{'host':_0x8523('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8523('0xe'))['register'](socket);function respondWithRpcPromise(_0x203b39,_0x1b9fcc,_0x5b8a51){return new BPromise(function(_0x4a7d33,_0x140457){return client[_0x8523('0xf')](_0x203b39,_0x5b8a51)[_0x8523('0x10')](function(_0x561284){logger[_0x8523('0x11')](_0x8523('0x12'),_0x1b9fcc,'request\x20sent');logger[_0x8523('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1b9fcc,'request\x20sent',JSON[_0x8523('0x14')](_0x561284));if(_0x561284[_0x8523('0x15')]){if(_0x561284[_0x8523('0x15')]['code']===0x1f4){logger[_0x8523('0x15')](_0x8523('0x12'),_0x1b9fcc,_0x561284[_0x8523('0x15')][_0x8523('0x16')]);return _0x140457(_0x561284['error'][_0x8523('0x16')]);}logger[_0x8523('0x15')](_0x8523('0x12'),_0x1b9fcc,_0x561284['error']['message']);return _0x4a7d33(_0x561284['error']['message']);}else{logger[_0x8523('0x11')](_0x8523('0x12'),_0x1b9fcc,_0x8523('0x17'));_0x4a7d33(_0x561284[_0x8523('0x18')][_0x8523('0x16')]);}})[_0x8523('0x19')](function(_0x904f76){logger[_0x8523('0x15')]('FaxAccount,\x20%s,\x20%s',_0x1b9fcc,_0x904f76);_0x140457(_0x904f76);});});}exports[_0x8523('0x1a')]=function(_0xdfc206){var _0xaaceb2=this;return new Promise(function(_0x4b248f,_0x21f92d){return db[_0x8523('0x1b')]['findAll']({'raw':_0xdfc206[_0x8523('0x1c')]?_0xdfc206[_0x8523('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xdfc206[_0x8523('0x1c')]?_0xdfc206['options']['where']||null:null,'attributes':_0xdfc206['options']?_0xdfc206[_0x8523('0x1c')]['attributes']||null:null,'limit':_0xdfc206[_0x8523('0x1c')]?_0xdfc206[_0x8523('0x1c')][_0x8523('0x1d')]||null:null,'include':_0xdfc206['options']?_0xdfc206[_0x8523('0x1c')][_0x8523('0x1e')]?_[_0x8523('0x1f')](_0xdfc206[_0x8523('0x1c')][_0x8523('0x1e')],function(_0x3c880a){return{'model':db[_0x3c880a['model']],'as':_0x3c880a['as'],'attributes':_0x3c880a['attributes'],'include':_0x3c880a[_0x8523('0x1e')]?_[_0x8523('0x1f')](_0x3c880a[_0x8523('0x1e')],function(_0x5e5192){return{'model':db[_0x5e5192['model']],'as':_0x5e5192['as'],'attributes':_0x5e5192['attributes'],'include':_0x5e5192[_0x8523('0x1e')]?_[_0x8523('0x1f')](_0x5e5192[_0x8523('0x1e')],function(_0x54324b){return{'model':db[_0x54324b[_0x8523('0x20')]],'as':_0x54324b['as'],'attributes':_0x54324b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8523('0x10')](function(_0x3bde5e){logger['info'](_0x8523('0x1a'),_0xdfc206);logger[_0x8523('0x13')]('GetFaxAccount',_0xdfc206,JSON[_0x8523('0x14')](_0x3bde5e));_0x4b248f(_0x3bde5e);})['catch'](function(_0x5ba549){logger[_0x8523('0x15')](_0x8523('0x1a'),_0x5ba549[_0x8523('0x16')],_0xdfc206);_0x21f92d(_0xaaceb2[_0x8523('0x15')](0x1f4,_0x5ba549[_0x8523('0x16')]));});});};exports[_0x8523('0x21')]=function(_0x19f6c4,_0x236c51,_0x124768){var _0x5a3069=this;return new Promise(function(_0x1ce95c,_0x543d83){var _0x2fea2a={'body':_0x19f6c4[_0x8523('0x22')],'channel':'fax'};var _0x54c556=[];var _0xe59cf1=[];var _0x2eaf6d={};return db['CmContact']['describe']()['then'](function(_0x2ac063){if(!_0x2ac063){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x25'));}_0x54c556=_[_0x8523('0x26')](_[_0x8523('0x27')](_0x2ac063),['createdAt',_0x8523('0x28')]);_0xe59cf1=_[_0x8523('0x26')](_[_0x8523('0x27')](_0x2ac063),[_0x8523('0x29'),_0x8523('0x28'),'CompanyId','ListId']);if(_0x19f6c4[_0x8523('0x22')]['id']){delete _0x19f6c4[_0x8523('0x22')]['id'];}if(_[_0x8523('0x2a')](_0x19f6c4[_0x8523('0x22')][_0x8523('0x2b')])){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x2c'));}if(_[_0x8523('0x2a')](_0x19f6c4[_0x8523('0x22')]['body'])||_0x19f6c4[_0x8523('0x22')][_0x8523('0x22')]===''){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x2d'));}if(_[_0x8523('0x2a')](_0x19f6c4[_0x8523('0x22')]['mapKey'])){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe59cf1);}if(!_['includes'](_0xe59cf1,_0x19f6c4['body'][_0x8523('0x2e')])){throw new db[(_0x8523('0x23'))][(_0x8523('0x24'))](_0x8523('0x2f')+_0xe59cf1);}_0x2eaf6d[_0x19f6c4['body'][_0x8523('0x2e')]]=_0x19f6c4[_0x8523('0x22')][_0x8523('0x2b')];})['then'](function(){return db['FaxAccount'][_0x8523('0x30')]({'where':{'id':_0x19f6c4[_0x8523('0x31')]['id']},'include':[{'model':db['CmList'],'as':_0x8523('0x32'),'include':[{'model':db[_0x8523('0x33')],'as':'Contacts','where':_0x2eaf6d,'limit':0x1,'order':[[_0x8523('0x28'),_0x8523('0x34')]]}]},{'model':db[_0x8523('0x35')],'as':_0x8523('0x36')}]});})[_0x8523('0x10')](function(_0x35263e){if(_0x35263e&&_0x35263e[_0x8523('0x32')]){var _0x1c4c05=_0x35263e[_0x8523('0x37')]({'plain':!![]});_0x2fea2a[_0x8523('0x31')]=_0x1c4c05;_0x2fea2a[_0x8523('0x38')]=_0x1c4c05[_0x8523('0x36')];_0x2fea2a[_0x8523('0x39')]=_0x1c4c05['List'];_0x2fea2a[_0x8523('0x38')]=_[_0x8523('0x3a')](_0x2fea2a[_0x8523('0x38')],[_0x8523('0x3b')],[_0x8523('0x3c')]);if(_0x2fea2a[_0x8523('0x31')][_0x8523('0x36')]){delete _0x2fea2a['account']['Applications'];}if(_0x2fea2a['account'][_0x8523('0x32')]&&_0x2fea2a[_0x8523('0x31')][_0x8523('0x32')][_0x8523('0x3d')][_0x8523('0x3e')]){return _0x2fea2a['account']['List']['Contacts'][0x0];}var _0x1ae647=_['defaults'](_0x19f6c4[_0x8523('0x22')],{'firstName':_0x19f6c4[_0x8523('0x22')][_0x8523('0x2b')],'ListId':_0x1c4c05[_0x8523('0x3f')]});_0x1ae647[_0x19f6c4[_0x8523('0x22')]['mapKey']]=_0x19f6c4[_0x8523('0x22')]['from'];return db[_0x8523('0x33')][_0x8523('0x40')](_0x1ae647,{'fields':_0x54c556,'raw':!![]});}})[_0x8523('0x10')](function(_0x5a33d4){_0x2fea2a['contact']=_0x5a33d4;if(_0x5a33d4){var _0x102541={'ContactId':_0x5a33d4['id'],'FaxAccountId':_0x19f6c4[_0x8523('0x31')]['id'],'fax':_0x5a33d4['fax']};return db[_0x8523('0x41')][_0x8523('0x30')]({'where':{'ContactId':_0x5a33d4['id'],'closed':![],'FaxAccountId':_0x19f6c4[_0x8523('0x31')]['id']}})[_0x8523('0x10')](function(_0xedd652){if(_0xedd652){return[_0xedd652,![]];}return db['FaxInteraction'][_0x8523('0x40')](_0x102541)['then'](function(_0xe94756){return[_0xe94756,!![]];});});}else{throw new Error(_0x8523('0x42'));}})[_0x8523('0x43')](function(_0x533ac6,_0x322e61){var _0x3515f8=_0x533ac6[_0x8523('0x37')]({'plain':!![]});if(_0x322e61){if(_0x2fea2a['account'][_0x8523('0x44')]){_0x2fea2a[_0x8523('0x38')][_0x8523('0x45')]({'id':0x0,'priority':_0x2fea2a[_0x8523('0x38')][_0x8523('0x3e')]+0x1,'app':_0x8523('0x46'),'appdata':_0x8523('0x47'),'interval':_0x8523('0x48')});}_0x3515f8[_0x8523('0x49')]=!![];}else{_0x3515f8['created']=![];}_0x2fea2a[_0x8523('0x4a')]=_0x3515f8;return db[_0x8523('0x4b')]['create']({'body':_0x19f6c4['body'][_0x8523('0x22')],'FaxAccountId':_0x19f6c4[_0x8523('0x31')]['id'],'FaxInteractionId':_0x533ac6['id'],'direction':'in','ContactId':_0x533ac6[_0x8523('0x4c')],'AttachmentId':_0x19f6c4['body'][_0x8523('0x4d')]});})[_0x8523('0x10')](function(_0x4e424b){_0x2fea2a[_0x8523('0x16')]=_0x4e424b;if(!_0x2fea2a[_0x8523('0x4a')][_0x8523('0x4e')])return;return db['User'][_0x8523('0x30')]({'attributes':['id',_0x8523('0x4f')],'where':{'id':_0x2fea2a[_0x8523('0x4a')][_0x8523('0x4e')]}});})[_0x8523('0x10')](function(_0x357ecb){if(_0x357ecb){_0x2fea2a['applications'][_0x8523('0x50')]({'id':0x0,'priority':0x0,'app':_0x8523('0x51'),'appdata':_0x357ecb[_0x8523('0x4f')]+','+(_0x2fea2a[_0x8523('0x31')]['waitForTheAssignedAgent']||0xa),'interval':_0x8523('0x48')});}if(!_0x2fea2a[_0x8523('0x4a')][_0x8523('0x52')])return;return db[_0x8523('0x53')][_0x8523('0x30')]({'attributes':['id','name'],'where':{'id':_0x2fea2a[_0x8523('0x4a')][_0x8523('0x52')]}});})[_0x8523('0x10')](function(_0x127489){if(_0x127489){_0x2fea2a[_0x8523('0x38')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x127489['name']+','+(_0x2fea2a[_0x8523('0x31')][_0x8523('0x54')]||0x12c),'interval':_0x8523('0x48')});}return respondWithRpcPromise(_0x8523('0x55'),'startRouting',_0x2fea2a);})[_0x8523('0x10')](function(_0x9c4695){_0x1ce95c(_0x9c4695);})[_0x8523('0x19')](function(_0x1249c6){_0x543d83(_0x5a3069[_0x8523('0x15')](0x1f4,_0x1249c6[_0x8523('0x16')]));});});}; \ No newline at end of file +var _0x6619=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','body','from','from\x20is\x20mandatory','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','find','account','CmList','List','CmContact','Contacts','FaxApplication','Applications','get','applications','list','priority','asc','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','ContactId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x6619,0xad));var _0x9661=function(_0x1c684b,_0x2a6297){_0x1c684b=_0x1c684b-0x0;var _0x163202=_0x6619[_0x1c684b];return _0x163202;};'use strict';var _=require(_0x9661('0x0'));var util=require('util');var moment=require(_0x9661('0x1'));var BPromise=require('bluebird');var rs=require(_0x9661('0x2'));var fs=require('fs');var Redis=require(_0x9661('0x3'));var db=require(_0x9661('0x4'))['db'];var utils=require(_0x9661('0x5'));var logger=require(_0x9661('0x6'))(_0x9661('0x7'));var config=require('../../config/environment');var jayson=require(_0x9661('0x8'));var client=jayson[_0x9661('0x9')][_0x9661('0xa')]({'port':0x232c});config[_0x9661('0xb')]=_[_0x9661('0xc')](config[_0x9661('0xb')],{'host':_0x9661('0xd'),'port':0x18eb});var socket=require(_0x9661('0xe'))(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x32e38c,_0x26c57f,_0x106b28){return new BPromise(function(_0x50db9c,_0xbeab55){return client[_0x9661('0xf')](_0x32e38c,_0x106b28)[_0x9661('0x10')](function(_0x54d9bc){logger[_0x9661('0x11')](_0x9661('0x12'),_0x26c57f,_0x9661('0x13'));logger[_0x9661('0x14')](_0x9661('0x15'),_0x26c57f,_0x9661('0x13'),JSON[_0x9661('0x16')](_0x54d9bc));if(_0x54d9bc[_0x9661('0x17')]){if(_0x54d9bc[_0x9661('0x17')]['code']===0x1f4){logger['error'](_0x9661('0x12'),_0x26c57f,_0x54d9bc[_0x9661('0x17')][_0x9661('0x18')]);return _0xbeab55(_0x54d9bc[_0x9661('0x17')][_0x9661('0x18')]);}logger[_0x9661('0x17')]('FaxAccount,\x20%s,\x20%s',_0x26c57f,_0x54d9bc[_0x9661('0x17')][_0x9661('0x18')]);return _0x50db9c(_0x54d9bc[_0x9661('0x17')][_0x9661('0x18')]);}else{logger[_0x9661('0x11')](_0x9661('0x12'),_0x26c57f,_0x9661('0x13'));_0x50db9c(_0x54d9bc[_0x9661('0x19')][_0x9661('0x18')]);}})[_0x9661('0x1a')](function(_0x3afdc4){logger[_0x9661('0x17')](_0x9661('0x12'),_0x26c57f,_0x3afdc4);_0xbeab55(_0x3afdc4);});});}exports[_0x9661('0x1b')]=function(_0x347d86){var _0x420e72=this;return new Promise(function(_0x58256e,_0x399ed1){return db[_0x9661('0x1c')]['findAll']({'raw':_0x347d86[_0x9661('0x1d')]?_0x347d86['options'][_0x9661('0x1e')]===undefined?!![]:![]:!![],'where':_0x347d86[_0x9661('0x1d')]?_0x347d86[_0x9661('0x1d')][_0x9661('0x1f')]||null:null,'attributes':_0x347d86['options']?_0x347d86[_0x9661('0x1d')][_0x9661('0x20')]||null:null,'limit':_0x347d86[_0x9661('0x1d')]?_0x347d86[_0x9661('0x1d')][_0x9661('0x21')]||null:null,'include':_0x347d86[_0x9661('0x1d')]?_0x347d86[_0x9661('0x1d')][_0x9661('0x22')]?_[_0x9661('0x23')](_0x347d86[_0x9661('0x1d')]['include'],function(_0x364bc4){return{'model':db[_0x364bc4[_0x9661('0x24')]],'as':_0x364bc4['as'],'attributes':_0x364bc4[_0x9661('0x20')],'include':_0x364bc4[_0x9661('0x22')]?_[_0x9661('0x23')](_0x364bc4['include'],function(_0x337cdb){return{'model':db[_0x337cdb['model']],'as':_0x337cdb['as'],'attributes':_0x337cdb[_0x9661('0x20')],'include':_0x337cdb[_0x9661('0x22')]?_['map'](_0x337cdb['include'],function(_0xd6f712){return{'model':db[_0xd6f712[_0x9661('0x24')]],'as':_0xd6f712['as'],'attributes':_0xd6f712[_0x9661('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9661('0x10')](function(_0xe07eb5){logger[_0x9661('0x11')](_0x9661('0x1b'),_0x347d86);logger[_0x9661('0x14')](_0x9661('0x1b'),_0x347d86,JSON[_0x9661('0x16')](_0xe07eb5));_0x58256e(_0xe07eb5);})[_0x9661('0x1a')](function(_0x5d8d4f){logger['error'](_0x9661('0x1b'),_0x5d8d4f[_0x9661('0x18')],_0x347d86);_0x399ed1(_0x420e72['error'](0x1f4,_0x5d8d4f[_0x9661('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x447ecb,_0x40bef5,_0x1bdc98){var _0x582cdb=this;return new Promise(function(_0x2f2858,_0x31c2c8){var _0x40837f={'body':_0x447ecb['body'],'channel':'fax'};var _0x120195=[];var _0x26accb=[];var _0x19e861={};return db['CmContact'][_0x9661('0x25')]()[_0x9661('0x10')](function(_0x3e742f){if(!_0x3e742f){throw new db['Sequelize']['ValidationError'](_0x9661('0x26'));}_0x120195=_[_0x9661('0x27')](_['keys'](_0x3e742f),[_0x9661('0x28'),_0x9661('0x29')]);_0x26accb=_[_0x9661('0x27')](_[_0x9661('0x2a')](_0x3e742f),['createdAt',_0x9661('0x29'),_0x9661('0x2b'),'ListId']);if(_0x447ecb['body']['id']){delete _0x447ecb[_0x9661('0x2c')]['id'];}if(_['isNil'](_0x447ecb[_0x9661('0x2c')][_0x9661('0x2d')])){throw new db['Sequelize']['ValidationError'](_0x9661('0x2e'));}if(_[_0x9661('0x2f')](_0x447ecb[_0x9661('0x2c')][_0x9661('0x2c')])||_0x447ecb[_0x9661('0x2c')]['body']===''){throw new db[(_0x9661('0x30'))]['ValidationError'](_0x9661('0x31'));}if(_['isNil'](_0x447ecb[_0x9661('0x2c')][_0x9661('0x32')])){throw new db[(_0x9661('0x30'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26accb);}if(!_[_0x9661('0x33')](_0x26accb,_0x447ecb[_0x9661('0x2c')][_0x9661('0x32')])){throw new db[(_0x9661('0x30'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26accb);}_0x19e861[_0x447ecb['body']['mapKey']]=_0x447ecb['body'][_0x9661('0x2d')];})[_0x9661('0x10')](function(){return db[_0x9661('0x1c')][_0x9661('0x34')]({'where':{'id':_0x447ecb[_0x9661('0x35')]['id']},'include':[{'model':db[_0x9661('0x36')],'as':_0x9661('0x37'),'include':[{'model':db[_0x9661('0x38')],'as':_0x9661('0x39'),'where':_0x19e861,'limit':0x1,'order':[[_0x9661('0x29'),'DESC']]}]},{'model':db[_0x9661('0x3a')],'as':_0x9661('0x3b')}]});})[_0x9661('0x10')](function(_0xb3376f){if(_0xb3376f&&_0xb3376f[_0x9661('0x37')]){var _0x3da88b=_0xb3376f[_0x9661('0x3c')]({'plain':!![]});_0x40837f[_0x9661('0x35')]=_0x3da88b;_0x40837f[_0x9661('0x3d')]=_0x3da88b[_0x9661('0x3b')];_0x40837f[_0x9661('0x3e')]=_0x3da88b[_0x9661('0x37')];_0x40837f[_0x9661('0x3d')]=_['orderBy'](_0x40837f[_0x9661('0x3d')],[_0x9661('0x3f')],[_0x9661('0x40')]);if(_0x40837f[_0x9661('0x35')]['Applications']){delete _0x40837f['account']['Applications'];}if(_0x40837f['account'][_0x9661('0x37')]&&_0x40837f[_0x9661('0x35')][_0x9661('0x37')][_0x9661('0x39')]['length']){return _0x40837f[_0x9661('0x35')]['List'][_0x9661('0x39')][0x0];}var _0x53ee95=_[_0x9661('0xc')](_0x447ecb[_0x9661('0x2c')],{'firstName':_0x447ecb['body'][_0x9661('0x2d')],'ListId':_0x3da88b['ListId']});_0x53ee95[_0x447ecb['body'][_0x9661('0x32')]]=_0x447ecb[_0x9661('0x2c')]['from'];return db['CmContact'][_0x9661('0x41')](_0x53ee95,{'fields':_0x120195,'raw':!![]});}})['then'](function(_0x4f3cef){_0x40837f[_0x9661('0x42')]=_0x4f3cef;if(_0x4f3cef){var _0x3580fb={'ContactId':_0x4f3cef['id'],'FaxAccountId':_0x447ecb[_0x9661('0x35')]['id'],'fax':_0x4f3cef[_0x9661('0x43')]};return db[_0x9661('0x44')]['find']({'where':{'ContactId':_0x4f3cef['id'],'closed':![],'FaxAccountId':_0x447ecb[_0x9661('0x35')]['id']}})[_0x9661('0x10')](function(_0x8768ec){if(_0x8768ec){return[_0x8768ec,![]];}return db[_0x9661('0x44')]['create'](_0x3580fb)[_0x9661('0x10')](function(_0x237662){return[_0x237662,!![]];});});}else{throw new Error(_0x9661('0x45'));}})[_0x9661('0x46')](function(_0x2b3b47,_0x1278ec){var _0x573b38=_0x2b3b47['get']({'plain':!![]});if(_0x1278ec){if(_0x40837f[_0x9661('0x35')][_0x9661('0x47')]){_0x40837f['applications']['push']({'id':0x0,'priority':_0x40837f[_0x9661('0x3d')][_0x9661('0x48')]+0x1,'app':_0x9661('0x49'),'appdata':_0x9661('0x4a'),'interval':_0x9661('0x4b')});}_0x573b38[_0x9661('0x4c')]=!![];}else{_0x573b38[_0x9661('0x4c')]=![];}_0x40837f[_0x9661('0x4d')]=_0x573b38;return db['FaxMessage'][_0x9661('0x41')]({'body':_0x447ecb[_0x9661('0x2c')][_0x9661('0x2c')],'FaxAccountId':_0x447ecb[_0x9661('0x35')]['id'],'FaxInteractionId':_0x2b3b47['id'],'direction':'in','ContactId':_0x2b3b47[_0x9661('0x4e')],'AttachmentId':_0x447ecb[_0x9661('0x2c')]['AttachmentId']});})[_0x9661('0x10')](function(_0x1f51d5){_0x40837f['message']=_0x1f51d5;if(!_0x40837f['interaction']['UserId'])return;return db[_0x9661('0x4f')][_0x9661('0x34')]({'attributes':['id','name'],'where':{'id':_0x40837f['interaction'][_0x9661('0x50')]}});})[_0x9661('0x10')](function(_0x2ee5f6){if(_0x2ee5f6){_0x40837f[_0x9661('0x3d')][_0x9661('0x51')]({'id':0x0,'priority':0x0,'app':_0x9661('0x52'),'appdata':_0x2ee5f6[_0x9661('0x53')]+','+(_0x40837f[_0x9661('0x35')][_0x9661('0x54')]||0xa),'interval':_0x9661('0x4b')});}if(!_0x40837f[_0x9661('0x4d')][_0x9661('0x55')])return;return db[_0x9661('0x56')][_0x9661('0x34')]({'attributes':['id','name'],'where':{'id':_0x40837f[_0x9661('0x4d')]['queueId']}});})[_0x9661('0x10')](function(_0xf703e8){if(_0xf703e8){_0x40837f[_0x9661('0x3d')][_0x9661('0x51')]({'id':0x0,'priority':0x1,'app':_0x9661('0x57'),'appdata':_0xf703e8[_0x9661('0x53')]+','+(_0x40837f[_0x9661('0x35')][_0x9661('0x58')]||0x12c),'interval':_0x9661('0x4b')});}return respondWithRpcPromise(_0x9661('0x59'),'startRouting',_0x40837f);})['then'](function(_0x328152){_0x2f2858(_0x328152);})[_0x9661('0x1a')](function(_0x49aeff){_0x31c2c8(_0x582cdb[_0x9661('0x17')](0x1f4,_0x49aeff[_0x9661('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 52aac62..a2fd184 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 _0xc11e=['update','emit','removeListener','register','./faxAccount.events','save','remove'];(function(_0x1da848,_0x1b5d1e){var _0x196efe=function(_0x47c82b){while(--_0x47c82b){_0x1da848['push'](_0x1da848['shift']());}};_0x196efe(++_0x1b5d1e);}(_0xc11e,0x1e7));var _0xec11=function(_0x24dce9,_0x392609){_0x24dce9=_0x24dce9-0x0;var _0x3c7dcd=_0xc11e[_0x24dce9];return _0x3c7dcd;};'use strict';var FaxAccountEvents=require(_0xec11('0x0'));var events=[_0xec11('0x1'),_0xec11('0x2'),_0xec11('0x3')];function createListener(_0x52f30e,_0x358f12){return function(_0x3a0c05){_0x358f12[_0xec11('0x4')](_0x52f30e,_0x3a0c05);};}function removeListener(_0x45dd98,_0x3af641){return function(){FaxAccountEvents[_0xec11('0x5')](_0x45dd98,_0x3af641);};}exports[_0xec11('0x6')]=function(_0x142080){for(var _0x3c6979=0x0,_0x18d26c=events['length'];_0x3c6979<_0x18d26c;_0x3c6979++){var _0x29eb0c=events[_0x3c6979];var _0x8d27d1=createListener('faxAccount:'+_0x29eb0c,_0x142080);FaxAccountEvents['on'](_0x29eb0c,_0x8d27d1);}}; \ No newline at end of file +var _0x731e=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x731e,0xee));var _0xe731=function(_0x1492a3,_0x3fbe29){_0x1492a3=_0x1492a3-0x0;var _0x227f07=_0x731e[_0x1492a3];return _0x227f07;};'use strict';var FaxAccountEvents=require(_0xe731('0x0'));var events=[_0xe731('0x1'),_0xe731('0x2'),_0xe731('0x3')];function createListener(_0x180ee3,_0x4cd9a3){return function(_0x52db7a){_0x4cd9a3[_0xe731('0x4')](_0x180ee3,_0x52db7a);};}function removeListener(_0xad785d,_0x4d41d0){return function(){FaxAccountEvents[_0xe731('0x5')](_0xad785d,_0x4d41d0);};}exports[_0xe731('0x6')]=function(_0x2bf8b7){for(var _0x5c57e7=0x0,_0x573d8b=events[_0xe731('0x7')];_0x5c57e7<_0x573d8b;_0x5c57e7++){var _0x285273=events[_0x5c57e7];var _0x21cdd6=createListener(_0xe731('0x8')+_0x285273,_0x2bf8b7);FaxAccountEvents['on'](_0x285273,_0x21cdd6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 00fd3b3..e8a2df6 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 _0x9d00=['/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','addAgents','put','/:id','destroy','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','getDispositions'];(function(_0x58847b,_0x1ec00c){var _0x2541af=function(_0x16feae){while(--_0x16feae){_0x58847b['push'](_0x58847b['shift']());}};_0x2541af(++_0x1ec00c);}(_0x9d00,0x1ea));var _0x09d0=function(_0x44f605,_0x2d9569){_0x44f605=_0x44f605-0x0;var _0x285189=_0x9d00[_0x44f605];return _0x285189;};'use strict';var multer=require(_0x09d0('0x0'));var util=require(_0x09d0('0x1'));var path=require(_0x09d0('0x2'));var timeout=require(_0x09d0('0x3'));var express=require(_0x09d0('0x4'));var router=express['Router']();var fs_extra=require(_0x09d0('0x5'));var auth=require(_0x09d0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x09d0('0x7'));var controller=require(_0x09d0('0x8'));router[_0x09d0('0x9')]('/',auth[_0x09d0('0xa')](),controller[_0x09d0('0xb')]);router[_0x09d0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x09d0('0xc')]);router[_0x09d0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x09d0('0x9')]('/:id/dispositions',auth[_0x09d0('0xa')](),controller[_0x09d0('0xd')]);router[_0x09d0('0x9')](_0x09d0('0xe'),auth[_0x09d0('0xa')](),controller[_0x09d0('0xf')]);router[_0x09d0('0x9')](_0x09d0('0x10'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x11')]);router[_0x09d0('0x9')](_0x09d0('0x12'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x13')]);router[_0x09d0('0x9')]('/:id/messages',auth[_0x09d0('0xa')](),controller[_0x09d0('0x14')]);router[_0x09d0('0x9')]('/:id/users',auth[_0x09d0('0xa')](),controller[_0x09d0('0x15')]);router['post']('/',auth[_0x09d0('0xa')](),controller[_0x09d0('0x16')]);router[_0x09d0('0x17')](_0x09d0('0x18'),auth['isAuthenticated'](),controller[_0x09d0('0x19')]);router['post']('/:id/canned_answers',auth[_0x09d0('0xa')](),controller[_0x09d0('0x1a')]);router[_0x09d0('0x17')](_0x09d0('0x10'),auth[_0x09d0('0xa')](),controller['addInteraction']);router[_0x09d0('0x17')](_0x09d0('0x12'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x1b')]);router['post'](_0x09d0('0x1c'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x1d')]);router['post']('/updateaccountapplications',auth[_0x09d0('0xa')](),controller['updateAccountApplications']);router[_0x09d0('0x17')](_0x09d0('0x1e'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x1f')]);router['post']('/:id/users',auth[_0x09d0('0xa')](),controller[_0x09d0('0x20')]);router[_0x09d0('0x21')](_0x09d0('0x22'),auth[_0x09d0('0xa')](),controller['update']);router['delete'](_0x09d0('0x22'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x23')]);router[_0x09d0('0x24')](_0x09d0('0x18'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x25')]);router[_0x09d0('0x24')](_0x09d0('0xe'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x26')]);router[_0x09d0('0x24')](_0x09d0('0x27'),auth[_0x09d0('0xa')](),controller[_0x09d0('0x28')]);module[_0x09d0('0x29')]=router; \ No newline at end of file +var _0x8b08=['addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getInteractions','/:id/messages','getMessages','/:id/users','getAgents','post','addAnswer','/:id/interactions'];(function(_0x32a884,_0x183853){var _0x242f9b=function(_0x556c63){while(--_0x556c63){_0x32a884['push'](_0x32a884['shift']());}};_0x242f9b(++_0x183853);}(_0x8b08,0x16a));var _0x88b0=function(_0x3546bf,_0x22c590){_0x3546bf=_0x3546bf-0x0;var _0x3b7a02=_0x8b08[_0x3546bf];return _0x3b7a02;};'use strict';var multer=require('multer');var util=require(_0x88b0('0x0'));var path=require(_0x88b0('0x1'));var timeout=require(_0x88b0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x88b0('0x3'));var auth=require(_0x88b0('0x4'));var interaction=require(_0x88b0('0x5'));var config=require(_0x88b0('0x6'));var controller=require(_0x88b0('0x7'));router[_0x88b0('0x8')]('/',auth[_0x88b0('0x9')](),controller[_0x88b0('0xa')]);router[_0x88b0('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x88b0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x88b0('0x8')](_0x88b0('0xc'),auth['isAuthenticated'](),controller[_0x88b0('0xd')]);router[_0x88b0('0x8')](_0x88b0('0xe'),auth[_0x88b0('0x9')](),controller['getAnswers']);router[_0x88b0('0x8')]('/:id/interactions',auth[_0x88b0('0x9')](),controller[_0x88b0('0xf')]);router['get']('/:id/applications',auth[_0x88b0('0x9')](),controller['getApplications']);router[_0x88b0('0x8')](_0x88b0('0x10'),auth[_0x88b0('0x9')](),controller[_0x88b0('0x11')]);router[_0x88b0('0x8')](_0x88b0('0x12'),auth[_0x88b0('0x9')](),controller[_0x88b0('0x13')]);router['post']('/',auth[_0x88b0('0x9')](),controller['create']);router[_0x88b0('0x14')](_0x88b0('0xc'),auth[_0x88b0('0x9')](),controller['addDisposition']);router[_0x88b0('0x14')](_0x88b0('0xe'),auth['isAuthenticated'](),controller[_0x88b0('0x15')]);router[_0x88b0('0x14')](_0x88b0('0x16'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x88b0('0x14')]('/:id/applications',auth[_0x88b0('0x9')](),controller[_0x88b0('0x17')]);router[_0x88b0('0x14')](_0x88b0('0x18'),auth[_0x88b0('0x9')](),controller[_0x88b0('0x19')]);router[_0x88b0('0x14')](_0x88b0('0x1a'),auth['isAuthenticated'](),controller[_0x88b0('0x1b')]);router['post'](_0x88b0('0x1c'),auth[_0x88b0('0x9')](),controller['send']);router[_0x88b0('0x14')](_0x88b0('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x88b0('0xb'),auth[_0x88b0('0x9')](),controller[_0x88b0('0x1d')]);router[_0x88b0('0x1e')](_0x88b0('0xb'),auth['isAuthenticated'](),controller[_0x88b0('0x1f')]);router['delete']('/:id/dispositions',auth[_0x88b0('0x9')](),controller[_0x88b0('0x20')]);router[_0x88b0('0x1e')](_0x88b0('0xe'),auth[_0x88b0('0x9')](),controller[_0x88b0('0x21')]);router[_0x88b0('0x1e')](_0x88b0('0x12'),auth[_0x88b0('0x9')](),controller[_0x88b0('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 12b4b82..ef22035 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 _0x5b28=['TEXT','sequelize','exports','STRING'];(function(_0x2d6c22,_0x45cde2){var _0x2998fd=function(_0x3266c6){while(--_0x3266c6){_0x2d6c22['push'](_0x2d6c22['shift']());}};_0x2998fd(++_0x45cde2);}(_0x5b28,0x119));var _0x85b2=function(_0x50e5f3,_0x28ac93){_0x50e5f3=_0x50e5f3-0x0;var _0x55cb11=_0x5b28[_0x50e5f3];return _0x55cb11;};'use strict';var Sequelize=require(_0x85b2('0x0'));module[_0x85b2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x85b2('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x85b2('0x3')]()},'description':{'type':Sequelize[_0x85b2('0x2')]},'interval':{'type':Sequelize[_0x85b2('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xce9f=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x45797a,_0x5da0b0){var _0x27fba9=function(_0x48a91b){while(--_0x48a91b){_0x45797a['push'](_0x45797a['shift']());}};_0x27fba9(++_0x5da0b0);}(_0xce9f,0x84));var _0xfce9=function(_0x51aed0,_0x55ea5b){_0x51aed0=_0x51aed0-0x0;var _0x556e54=_0xce9f[_0x51aed0];return _0x556e54;};'use strict';var Sequelize=require('sequelize');module[_0xfce9('0x0')]={'priority':{'type':Sequelize[_0xfce9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfce9('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfce9('0x3')]()},'description':{'type':Sequelize[_0xfce9('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfce9('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d1ab72d..2eaa09f 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 _0x3759=['fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','index','map','FaxApplication'];(function(_0x5b1063,_0x4ab728){var _0x2d31af=function(_0xc2fa16){while(--_0xc2fa16){_0x5b1063['push'](_0x5b1063['shift']());}};_0x2d31af(++_0x4ab728);}(_0x3759,0x10e));var _0x9375=function(_0x5571ef,_0xd22668){_0x5571ef=_0x5571ef-0x0;var _0x2d3eb2=_0x3759[_0x5571ef];return _0x2d3eb2;};'use strict';var emlformat=require(_0x9375('0x0'));var rimraf=require(_0x9375('0x1'));var zipdir=require(_0x9375('0x2'));var jsonpatch=require(_0x9375('0x3'));var rp=require('request-promise');var moment=require(_0x9375('0x4'));var BPromise=require(_0x9375('0x5'));var Mustache=require(_0x9375('0x6'));var util=require(_0x9375('0x7'));var path=require(_0x9375('0x8'));var sox=require(_0x9375('0x9'));var csv=require(_0x9375('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9375('0xb'));var _=require(_0x9375('0xc'));var squel=require(_0x9375('0xd'));var crypto=require(_0x9375('0xe'));var jsforce=require(_0x9375('0xf'));var deskjs=require(_0x9375('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9375('0x11'));var authService=require(_0x9375('0x12'));var qs=require(_0x9375('0x13'));var as=require(_0x9375('0x14'));var hardwareService=require(_0x9375('0x15'));var logger=require(_0x9375('0x16'))('api');var utils=require(_0x9375('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9375('0x18'));var db=require(_0x9375('0x19'))['db'];function respondWithStatusCode(_0x163c9c,_0x5bdebe){_0x5bdebe=_0x5bdebe||0xcc;return function(_0x4153cc){if(_0x4153cc){return _0x163c9c['sendStatus'](_0x5bdebe);}return _0x163c9c[_0x9375('0x1a')](_0x5bdebe)['end']();};}function respondWithResult(_0x163e0e,_0x447b52){_0x447b52=_0x447b52||0xc8;return function(_0x1ec9d4){if(_0x1ec9d4){return _0x163e0e['status'](_0x447b52)['json'](_0x1ec9d4);}};}function respondWithFilteredResult(_0x4d1ef0,_0x146fc2){return function(_0x56e86d){if(_0x56e86d){var _0x2e6f2c=typeof _0x146fc2[_0x9375('0x1b')]===_0x9375('0x1c')&&typeof _0x146fc2[_0x9375('0x1d')]==='undefined';var _0x3c051f=_0x56e86d[_0x9375('0x1e')];var _0x3636e4=_0x2e6f2c?0x0:_0x146fc2[_0x9375('0x1b')];var _0x504540=_0x2e6f2c?_0x56e86d[_0x9375('0x1e')]:_0x146fc2[_0x9375('0x1b')]+_0x146fc2[_0x9375('0x1d')];var _0x3fd281;if(_0x504540>=_0x3c051f){_0x504540=_0x3c051f;_0x3fd281=0xc8;}else{_0x3fd281=0xce;}_0x4d1ef0[_0x9375('0x1a')](_0x3fd281);return _0x4d1ef0[_0x9375('0x1f')](_0x9375('0x20'),_0x3636e4+'-'+_0x504540+'/'+_0x3c051f)[_0x9375('0x21')](_0x56e86d);}return null;};}function patchUpdates(_0x25b1c7){return function(_0x1787d4){try{jsonpatch[_0x9375('0x22')](_0x1787d4,_0x25b1c7,!![]);}catch(_0x1da652){return BPromise[_0x9375('0x23')](_0x1da652);}return _0x1787d4[_0x9375('0x24')]();};}function saveUpdates(_0x25587b,_0xdd265e){return function(_0x1287ca){if(_0x1287ca){return _0x1287ca[_0x9375('0x25')](_0x25587b)['then'](function(_0x5907b1){return _0x5907b1;});}return null;};}function removeEntity(_0x3552bf,_0x1eeaee){return function(_0x2899b9){if(_0x2899b9){return _0x2899b9['destroy']()[_0x9375('0x26')](function(){_0x3552bf[_0x9375('0x1a')](0xcc)[_0x9375('0x27')]();});}};}function handleEntityNotFound(_0x5d8bbe,_0x1860c1){return function(_0x39ef8f){if(!_0x39ef8f){_0x5d8bbe[_0x9375('0x28')](0x194);}return _0x39ef8f;};}function handleError(_0x53b684,_0x581dd6){_0x581dd6=_0x581dd6||0x1f4;return function(_0x5de12e){logger[_0x9375('0x29')](_0x5de12e[_0x9375('0x2a')]);if(_0x5de12e['name']){delete _0x5de12e['name'];}_0x53b684['status'](_0x581dd6)['send'](_0x5de12e);};}exports[_0x9375('0x2b')]=function(_0x5cfcff,_0x85b33f){var _0x4dee28={},_0x5b86cf={},_0x2232ca={'count':0x0,'rows':[]};var _0x5cacc2=_[_0x9375('0x2c')](db[_0x9375('0x2d')]['rawAttributes'],function(_0x57a212){return{'name':_0x57a212[_0x9375('0x2e')],'type':_0x57a212[_0x9375('0x2f')][_0x9375('0x30')]};});_0x5b86cf[_0x9375('0x31')]=_['map'](_0x5cacc2,_0x9375('0x32'));_0x5b86cf[_0x9375('0x33')]=_[_0x9375('0x34')](_0x5cfcff[_0x9375('0x33')]);_0x5b86cf[_0x9375('0x35')]=_['intersection'](_0x5b86cf['model'],_0x5b86cf['query']);_0x4dee28[_0x9375('0x36')]=_[_0x9375('0x37')](_0x5b86cf[_0x9375('0x31')],qs['fields'](_0x5cfcff['query'][_0x9375('0x38')]));_0x4dee28[_0x9375('0x36')]=_0x4dee28[_0x9375('0x36')]['length']?_0x4dee28[_0x9375('0x36')]:_0x5b86cf['model'];if(!_0x5cfcff[_0x9375('0x33')][_0x9375('0x39')](_0x9375('0x3a'))){_0x4dee28[_0x9375('0x1d')]=qs[_0x9375('0x1d')](_0x5cfcff[_0x9375('0x33')]['limit']);_0x4dee28[_0x9375('0x1b')]=qs['offset'](_0x5cfcff[_0x9375('0x33')]['offset']);}_0x4dee28[_0x9375('0x3b')]=qs['sort'](_0x5cfcff[_0x9375('0x33')][_0x9375('0x3c')]);_0x4dee28['where']=qs['filters'](_[_0x9375('0x3d')](_0x5cfcff['query'],_0x5b86cf[_0x9375('0x35')]),_0x5cacc2);if(_0x5cfcff[_0x9375('0x33')]['filter']){_0x4dee28[_0x9375('0x3e')]=_[_0x9375('0x3f')](_0x4dee28[_0x9375('0x3e')],{'$or':_[_0x9375('0x2c')](_0x5cacc2,function(_0x37642c){if(_0x37642c[_0x9375('0x2f')]!==_0x9375('0x40')){var _0x5577b1={};_0x5577b1[_0x37642c['name']]={'$like':'%'+_0x5cfcff[_0x9375('0x33')][_0x9375('0x41')]+'%'};return _0x5577b1;}})});}_0x4dee28=_[_0x9375('0x3f')]({},_0x4dee28,_0x5cfcff[_0x9375('0x42')]);var _0xe32db5={'where':_0x4dee28['where']};return db['FaxApplication'][_0x9375('0x1e')](_0xe32db5)[_0x9375('0x26')](function(_0x50bba7){_0x2232ca[_0x9375('0x1e')]=_0x50bba7;if(_0x5cfcff[_0x9375('0x33')]['includeAll']){_0x4dee28[_0x9375('0x43')]=[{'all':!![]}];}return db[_0x9375('0x2d')][_0x9375('0x44')](_0x4dee28);})[_0x9375('0x26')](function(_0x3b9f99){_0x2232ca[_0x9375('0x45')]=_0x3b9f99;return _0x2232ca;})[_0x9375('0x26')](respondWithFilteredResult(_0x85b33f,_0x4dee28))[_0x9375('0x46')](handleError(_0x85b33f,null));};exports[_0x9375('0x47')]=function(_0x7b59d2,_0x95c38a){var _0x140055={'raw':!![],'where':{'id':_0x7b59d2['params']['id']}},_0x33fbd7={};_0x33fbd7[_0x9375('0x31')]=_['keys'](db[_0x9375('0x2d')]['rawAttributes']);_0x33fbd7[_0x9375('0x33')]=_[_0x9375('0x34')](_0x7b59d2[_0x9375('0x33')]);_0x33fbd7['filters']=_[_0x9375('0x37')](_0x33fbd7[_0x9375('0x31')],_0x33fbd7['query']);_0x140055['attributes']=_['intersection'](_0x33fbd7[_0x9375('0x31')],qs['fields'](_0x7b59d2[_0x9375('0x33')][_0x9375('0x38')]));_0x140055[_0x9375('0x36')]=_0x140055[_0x9375('0x36')][_0x9375('0x48')]?_0x140055[_0x9375('0x36')]:_0x33fbd7['model'];if(_0x7b59d2[_0x9375('0x33')][_0x9375('0x49')]){_0x140055[_0x9375('0x43')]=[{'all':!![]}];}_0x140055=_['merge']({},_0x140055,_0x7b59d2[_0x9375('0x42')]);return db['FaxApplication'][_0x9375('0x4a')](_0x140055)[_0x9375('0x26')](handleEntityNotFound(_0x95c38a,null))[_0x9375('0x26')](respondWithResult(_0x95c38a,null))[_0x9375('0x46')](handleError(_0x95c38a,null));};exports['create']=function(_0x51b662,_0x4bec72){return db[_0x9375('0x2d')][_0x9375('0x4b')](_0x51b662[_0x9375('0x4c')],{})[_0x9375('0x26')](respondWithResult(_0x4bec72,0xc9))[_0x9375('0x46')](handleError(_0x4bec72,null));};exports[_0x9375('0x25')]=function(_0x2a7313,_0x1a6fd7){if(_0x2a7313['body']['id']){delete _0x2a7313[_0x9375('0x4c')]['id'];}return db['FaxApplication'][_0x9375('0x4a')]({'where':{'id':_0x2a7313[_0x9375('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a6fd7,null))['then'](saveUpdates(_0x2a7313[_0x9375('0x4c')],null))[_0x9375('0x26')](respondWithResult(_0x1a6fd7,null))[_0x9375('0x46')](handleError(_0x1a6fd7,null));};exports[_0x9375('0x4e')]=function(_0x5f0d85,_0x2702bf){return db[_0x9375('0x2d')][_0x9375('0x4a')]({'where':{'id':_0x5f0d85[_0x9375('0x4d')]['id']}})[_0x9375('0x26')](handleEntityNotFound(_0x2702bf,null))['then'](removeEntity(_0x2702bf,null))[_0x9375('0x46')](handleError(_0x2702bf,null));}; \ No newline at end of file +var _0x7b9d=['offset','set','reject','save','update','then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','params','intersection','fields','find','catch','create','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count'];(function(_0x2e2f84,_0x24e46f){var _0x448191=function(_0x336e06){while(--_0x336e06){_0x2e2f84['push'](_0x2e2f84['shift']());}};_0x448191(++_0x24e46f);}(_0x7b9d,0x6c));var _0xd7b9=function(_0x3d3a3f,_0x41d1cc){_0x3d3a3f=_0x3d3a3f-0x0;var _0x89ee48=_0x7b9d[_0x3d3a3f];return _0x89ee48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd7b9('0x0'));var jsonpatch=require(_0xd7b9('0x1'));var rp=require('request-promise');var moment=require(_0xd7b9('0x2'));var BPromise=require(_0xd7b9('0x3'));var Mustache=require(_0xd7b9('0x4'));var util=require(_0xd7b9('0x5'));var path=require(_0xd7b9('0x6'));var sox=require(_0xd7b9('0x7'));var csv=require(_0xd7b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd7b9('0x9'));var jsforce=require(_0xd7b9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd7b9('0x8'));var querystring=require(_0xd7b9('0xb'));var Papa=require(_0xd7b9('0xc'));var Redis=require(_0xd7b9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd7b9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7b9('0xf'));var logger=require(_0xd7b9('0x10'))('api');var utils=require(_0xd7b9('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xd7b9('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ff75f,_0x557101){_0x557101=_0x557101||0xcc;return function(_0x2149f8){if(_0x2149f8){return _0x2ff75f[_0xd7b9('0x13')](_0x557101);}return _0x2ff75f[_0xd7b9('0x14')](_0x557101)[_0xd7b9('0x15')]();};}function respondWithResult(_0x4943fa,_0x4a30c2){_0x4a30c2=_0x4a30c2||0xc8;return function(_0x47195f){if(_0x47195f){return _0x4943fa[_0xd7b9('0x14')](_0x4a30c2)[_0xd7b9('0x16')](_0x47195f);}};}function respondWithFilteredResult(_0x37bc61,_0x2fc82a){return function(_0x5ac153){if(_0x5ac153){var _0x41fbcf=typeof _0x2fc82a['offset']===_0xd7b9('0x17')&&typeof _0x2fc82a[_0xd7b9('0x18')]===_0xd7b9('0x17');var _0x5a1cf8=_0x5ac153[_0xd7b9('0x19')];var _0x38ce46=_0x41fbcf?0x0:_0x2fc82a['offset'];var _0x136ac7=_0x41fbcf?_0x5ac153['count']:_0x2fc82a[_0xd7b9('0x1a')]+_0x2fc82a['limit'];var _0x3a7123;if(_0x136ac7>=_0x5a1cf8){_0x136ac7=_0x5a1cf8;_0x3a7123=0xc8;}else{_0x3a7123=0xce;}_0x37bc61[_0xd7b9('0x14')](_0x3a7123);return _0x37bc61[_0xd7b9('0x1b')]('Content-Range',_0x38ce46+'-'+_0x136ac7+'/'+_0x5a1cf8)['json'](_0x5ac153);}return null;};}function patchUpdates(_0xb79247){return function(_0x5a568e){try{jsonpatch['apply'](_0x5a568e,_0xb79247,!![]);}catch(_0x4d9023){return BPromise[_0xd7b9('0x1c')](_0x4d9023);}return _0x5a568e[_0xd7b9('0x1d')]();};}function saveUpdates(_0x50fdcc,_0x31f3bf){return function(_0xd5f0fe){if(_0xd5f0fe){return _0xd5f0fe[_0xd7b9('0x1e')](_0x50fdcc)[_0xd7b9('0x1f')](function(_0x86d190){return _0x86d190;});}return null;};}function removeEntity(_0x5c2208,_0x797ad4){return function(_0x55d63a){if(_0x55d63a){return _0x55d63a[_0xd7b9('0x20')]()[_0xd7b9('0x1f')](function(){_0x5c2208[_0xd7b9('0x14')](0xcc)[_0xd7b9('0x15')]();});}};}function handleEntityNotFound(_0x205fbd,_0x4c101c){return function(_0x406644){if(!_0x406644){_0x205fbd['sendStatus'](0x194);}return _0x406644;};}function handleError(_0x43db0e,_0x36e88f){_0x36e88f=_0x36e88f||0x1f4;return function(_0x1a549c){logger['error'](_0x1a549c[_0xd7b9('0x21')]);if(_0x1a549c['name']){delete _0x1a549c[_0xd7b9('0x22')];}_0x43db0e[_0xd7b9('0x14')](_0x36e88f)[_0xd7b9('0x23')](_0x1a549c);};}exports[_0xd7b9('0x24')]=function(_0x515827,_0x20a790){var _0x4ada04={},_0x1715a7={},_0x348934={'count':0x0,'rows':[]};var _0x4a8fad=_[_0xd7b9('0x25')](db[_0xd7b9('0x26')][_0xd7b9('0x27')],function(_0x39432d){return{'name':_0x39432d[_0xd7b9('0x28')],'type':_0x39432d[_0xd7b9('0x29')][_0xd7b9('0x2a')]};});_0x1715a7['model']=_[_0xd7b9('0x25')](_0x4a8fad,_0xd7b9('0x22'));_0x1715a7[_0xd7b9('0x2b')]=_[_0xd7b9('0x2c')](_0x515827['query']);_0x1715a7[_0xd7b9('0x2d')]=_['intersection'](_0x1715a7[_0xd7b9('0x2e')],_0x1715a7[_0xd7b9('0x2b')]);_0x4ada04[_0xd7b9('0x2f')]=_['intersection'](_0x1715a7[_0xd7b9('0x2e')],qs['fields'](_0x515827[_0xd7b9('0x2b')]['fields']));_0x4ada04[_0xd7b9('0x2f')]=_0x4ada04[_0xd7b9('0x2f')][_0xd7b9('0x30')]?_0x4ada04[_0xd7b9('0x2f')]:_0x1715a7[_0xd7b9('0x2e')];if(!_0x515827[_0xd7b9('0x2b')][_0xd7b9('0x31')](_0xd7b9('0x32'))){_0x4ada04[_0xd7b9('0x18')]=qs['limit'](_0x515827[_0xd7b9('0x2b')][_0xd7b9('0x18')]);_0x4ada04[_0xd7b9('0x1a')]=qs['offset'](_0x515827[_0xd7b9('0x2b')]['offset']);}_0x4ada04[_0xd7b9('0x33')]=qs[_0xd7b9('0x34')](_0x515827['query']['sort']);_0x4ada04[_0xd7b9('0x35')]=qs['filters'](_[_0xd7b9('0x36')](_0x515827[_0xd7b9('0x2b')],_0x1715a7[_0xd7b9('0x2d')]),_0x4a8fad);if(_0x515827['query'][_0xd7b9('0x37')]){_0x4ada04[_0xd7b9('0x35')]=_[_0xd7b9('0x38')](_0x4ada04[_0xd7b9('0x35')],{'$or':_['map'](_0x4a8fad,function(_0x5e7be5){if(_0x5e7be5[_0xd7b9('0x29')]!=='VIRTUAL'){var _0x35fb07={};_0x35fb07[_0x5e7be5['name']]={'$like':'%'+_0x515827[_0xd7b9('0x2b')][_0xd7b9('0x37')]+'%'};return _0x35fb07;}})});}_0x4ada04=_[_0xd7b9('0x38')]({},_0x4ada04,_0x515827[_0xd7b9('0x39')]);var _0x4a39c8={'where':_0x4ada04['where']};return db[_0xd7b9('0x26')][_0xd7b9('0x19')](_0x4a39c8)['then'](function(_0x472aaa){_0x348934[_0xd7b9('0x19')]=_0x472aaa;if(_0x515827[_0xd7b9('0x2b')][_0xd7b9('0x3a')]){_0x4ada04[_0xd7b9('0x3b')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x4ada04);})[_0xd7b9('0x1f')](function(_0x106c19){_0x348934['rows']=_0x106c19;return _0x348934;})[_0xd7b9('0x1f')](respondWithFilteredResult(_0x20a790,_0x4ada04))['catch'](handleError(_0x20a790,null));};exports['show']=function(_0x20478e,_0x3bb5ad){var _0x19e03a={'raw':!![],'where':{'id':_0x20478e[_0xd7b9('0x3c')]['id']}},_0x3d1513={};_0x3d1513[_0xd7b9('0x2e')]=_[_0xd7b9('0x2c')](db[_0xd7b9('0x26')][_0xd7b9('0x27')]);_0x3d1513[_0xd7b9('0x2b')]=_[_0xd7b9('0x2c')](_0x20478e[_0xd7b9('0x2b')]);_0x3d1513[_0xd7b9('0x2d')]=_[_0xd7b9('0x3d')](_0x3d1513[_0xd7b9('0x2e')],_0x3d1513[_0xd7b9('0x2b')]);_0x19e03a[_0xd7b9('0x2f')]=_[_0xd7b9('0x3d')](_0x3d1513[_0xd7b9('0x2e')],qs[_0xd7b9('0x3e')](_0x20478e[_0xd7b9('0x2b')]['fields']));_0x19e03a[_0xd7b9('0x2f')]=_0x19e03a[_0xd7b9('0x2f')][_0xd7b9('0x30')]?_0x19e03a[_0xd7b9('0x2f')]:_0x3d1513[_0xd7b9('0x2e')];if(_0x20478e['query'][_0xd7b9('0x3a')]){_0x19e03a[_0xd7b9('0x3b')]=[{'all':!![]}];}_0x19e03a=_[_0xd7b9('0x38')]({},_0x19e03a,_0x20478e['options']);return db[_0xd7b9('0x26')][_0xd7b9('0x3f')](_0x19e03a)['then'](handleEntityNotFound(_0x3bb5ad,null))[_0xd7b9('0x1f')](respondWithResult(_0x3bb5ad,null))[_0xd7b9('0x40')](handleError(_0x3bb5ad,null));};exports[_0xd7b9('0x41')]=function(_0x365ac5,_0x32102a){return db['FaxApplication'][_0xd7b9('0x41')](_0x365ac5[_0xd7b9('0x42')],{})[_0xd7b9('0x1f')](respondWithResult(_0x32102a,0xc9))['catch'](handleError(_0x32102a,null));};exports['update']=function(_0xe13928,_0x298f29){if(_0xe13928[_0xd7b9('0x42')]['id']){delete _0xe13928[_0xd7b9('0x42')]['id'];}return db[_0xd7b9('0x26')][_0xd7b9('0x3f')]({'where':{'id':_0xe13928[_0xd7b9('0x3c')]['id']}})[_0xd7b9('0x1f')](handleEntityNotFound(_0x298f29,null))[_0xd7b9('0x1f')](saveUpdates(_0xe13928[_0xd7b9('0x42')],null))[_0xd7b9('0x1f')](respondWithResult(_0x298f29,null))[_0xd7b9('0x40')](handleError(_0x298f29,null));};exports['destroy']=function(_0x169437,_0x3424c2){return db['FaxApplication'][_0xd7b9('0x3f')]({'where':{'id':_0x169437['params']['id']}})['then'](handleEntityNotFound(_0x3424c2,null))[_0xd7b9('0x1f')](removeEntity(_0x3424c2,null))[_0xd7b9('0x40')](handleError(_0x3424c2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 5929623..81ae3db 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 _0xf3e2=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xa7bbd0,_0x28c3f9){var _0x5e059c=function(_0x29eec2){while(--_0x29eec2){_0xa7bbd0['push'](_0xa7bbd0['shift']());}};_0x5e059c(++_0x28c3f9);}(_0xf3e2,0xc8));var _0x2f3e=function(_0x299f5c,_0x5738dd){_0x299f5c=_0x299f5c-0x0;var _0x5da026=_0xf3e2[_0x299f5c];return _0x5da026;};'use strict';var _=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var logger=require(_0x2f3e('0x2'))(_0x2f3e('0x3'));var moment=require(_0x2f3e('0x4'));var BPromise=require(_0x2f3e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2f3e('0x6'));var config=require(_0x2f3e('0x7'));var attributes=require(_0x2f3e('0x8'));module[_0x2f3e('0x9')]=function(_0x575f92,_0x4c5db4){return _0x575f92[_0x2f3e('0xa')](_0x2f3e('0xb'),attributes,{'tableName':_0x2f3e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x26ad=['request-promise','rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5dfc7a,_0x4686ce){var _0x431a8c=function(_0x462107){while(--_0x462107){_0x5dfc7a['push'](_0x5dfc7a['shift']());}};_0x431a8c(++_0x4686ce);}(_0x26ad,0x145));var _0xd26a=function(_0x2cd8d0,_0x5ddefb){_0x2cd8d0=_0x2cd8d0-0x0;var _0x49a221=_0x26ad[_0x2cd8d0];return _0x49a221;};'use strict';var _=require(_0xd26a('0x0'));var util=require('util');var logger=require(_0xd26a('0x1'))(_0xd26a('0x2'));var moment=require(_0xd26a('0x3'));var BPromise=require(_0xd26a('0x4'));var rp=require(_0xd26a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd26a('0x6'));var config=require(_0xd26a('0x7'));var attributes=require(_0xd26a('0x8'));module['exports']=function(_0x50971e,_0x49c82a){return _0x50971e['define'](_0xd26a('0x9'),attributes,{'tableName':_0xd26a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0358a1d..65fe720 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 _0xc6e9=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxApplication','update','options','raw','where','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x121f35,_0x5900cd){var _0x365177=function(_0x5a9952){while(--_0x5a9952){_0x121f35['push'](_0x121f35['shift']());}};_0x365177(++_0x5900cd);}(_0xc6e9,0x67));var _0x9c6e=function(_0x50bb38,_0x488c5f){_0x50bb38=_0x50bb38-0x0;var _0x54f944=_0xc6e9[_0x50bb38];return _0x54f944;};'use strict';var _=require(_0x9c6e('0x0'));var util=require(_0x9c6e('0x1'));var moment=require('moment');var BPromise=require(_0x9c6e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c6e('0x3'));var db=require(_0x9c6e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c6e('0x5'))(_0x9c6e('0x6'));var config=require(_0x9c6e('0x7'));var jayson=require(_0x9c6e('0x8'));var client=jayson[_0x9c6e('0x9')][_0x9c6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbccefe,_0x53b598,_0x24889d){return new BPromise(function(_0xad0f,_0xc5d011){return client['request'](_0xbccefe,_0x24889d)[_0x9c6e('0xb')](function(_0x4bf74c){logger[_0x9c6e('0xc')](_0x9c6e('0xd'),_0x53b598,_0x9c6e('0xe'));logger[_0x9c6e('0xf')](_0x9c6e('0x10'),_0x53b598,_0x9c6e('0xe'),JSON['stringify'](_0x4bf74c));if(_0x4bf74c['error']){if(_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x12')]===0x1f4){logger[_0x9c6e('0x11')](_0x9c6e('0xd'),_0x53b598,_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x13')]);return _0xc5d011(_0x4bf74c['error'][_0x9c6e('0x13')]);}logger[_0x9c6e('0x11')](_0x9c6e('0xd'),_0x53b598,_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x13')]);return _0xad0f(_0x4bf74c[_0x9c6e('0x11')][_0x9c6e('0x13')]);}else{logger[_0x9c6e('0xc')](_0x9c6e('0xd'),_0x53b598,_0x9c6e('0xe'));_0xad0f(_0x4bf74c['result'][_0x9c6e('0x13')]);}})[_0x9c6e('0x14')](function(_0x1bf9f2){logger[_0x9c6e('0x11')](_0x9c6e('0xd'),_0x53b598,_0x1bf9f2);_0xc5d011(_0x1bf9f2);});});}exports[_0x9c6e('0x15')]=function(_0x1f033a){var _0x9ac62f=this;return new Promise(function(_0x3cc8e4,_0x5cd7e4){return db['FaxApplication'][_0x9c6e('0x16')](_0x1f033a['body'],{'raw':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a[_0x9c6e('0x17')][_0x9c6e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a[_0x9c6e('0x17')][_0x9c6e('0x19')]||null:null,'attributes':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a['options'][_0x9c6e('0x1a')]||null:null,'limit':_0x1f033a[_0x9c6e('0x17')]?_0x1f033a[_0x9c6e('0x17')][_0x9c6e('0x1b')]||null:null})[_0x9c6e('0xb')](function(_0x40dc40){logger[_0x9c6e('0xc')]('UpdateFaxApplication',_0x1f033a);logger['debug'](_0x9c6e('0x15'),_0x1f033a,JSON[_0x9c6e('0x1c')](_0x40dc40));_0x3cc8e4(_0x40dc40);})[_0x9c6e('0x14')](function(_0x37ae9f){logger['error'](_0x9c6e('0x15'),_0x37ae9f[_0x9c6e('0x13')],_0x1f033a);_0x5cd7e4(_0x9ac62f[_0x9c6e('0x11')](0x1f4,_0x37ae9f['message']));});});}; \ No newline at end of file +var _0x6ffc=['client','http','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','FaxApplication,\x20%s,\x20%s','request\x20sent','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','stringify','catch','lodash','util','bluebird','randomstring','rpc','jayson/promise'];(function(_0x354074,_0x46df42){var _0x5582c4=function(_0x3b823e){while(--_0x3b823e){_0x354074['push'](_0x354074['shift']());}};_0x5582c4(++_0x46df42);}(_0x6ffc,0x11c));var _0xc6ff=function(_0x19efef,_0x48e207){_0x19efef=_0x19efef-0x0;var _0x16051f=_0x6ffc[_0x19efef];return _0x16051f;};'use strict';var _=require(_0xc6ff('0x0'));var util=require(_0xc6ff('0x1'));var moment=require('moment');var BPromise=require(_0xc6ff('0x2'));var rs=require(_0xc6ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6ff('0x4'));var config=require('../../config/environment');var jayson=require(_0xc6ff('0x5'));var client=jayson[_0xc6ff('0x6')][_0xc6ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb88126,_0x339ab9,_0x13c7b2){return new BPromise(function(_0x17cc8b,_0x35512a){return client[_0xc6ff('0x8')](_0xb88126,_0x13c7b2)[_0xc6ff('0x9')](function(_0x5252ab){logger[_0xc6ff('0xa')]('FaxApplication,\x20%s,\x20%s',_0x339ab9,'request\x20sent');logger[_0xc6ff('0xb')](_0xc6ff('0xc'),_0x339ab9,'request\x20sent',JSON['stringify'](_0x5252ab));if(_0x5252ab[_0xc6ff('0xd')]){if(_0x5252ab[_0xc6ff('0xd')][_0xc6ff('0xe')]===0x1f4){logger[_0xc6ff('0xd')]('FaxApplication,\x20%s,\x20%s',_0x339ab9,_0x5252ab['error']['message']);return _0x35512a(_0x5252ab[_0xc6ff('0xd')][_0xc6ff('0xf')]);}logger[_0xc6ff('0xd')](_0xc6ff('0x10'),_0x339ab9,_0x5252ab[_0xc6ff('0xd')]['message']);return _0x17cc8b(_0x5252ab[_0xc6ff('0xd')][_0xc6ff('0xf')]);}else{logger[_0xc6ff('0xa')](_0xc6ff('0x10'),_0x339ab9,_0xc6ff('0x11'));_0x17cc8b(_0x5252ab[_0xc6ff('0x12')][_0xc6ff('0xf')]);}})['catch'](function(_0x1c697e){logger[_0xc6ff('0xd')](_0xc6ff('0x10'),_0x339ab9,_0x1c697e);_0x35512a(_0x1c697e);});});}exports[_0xc6ff('0x13')]=function(_0x199602){var _0x3f5289=this;return new Promise(function(_0x2cf155,_0x343d58){return db[_0xc6ff('0x14')][_0xc6ff('0x15')](_0x199602[_0xc6ff('0x16')],{'raw':_0x199602[_0xc6ff('0x17')]?_0x199602[_0xc6ff('0x17')][_0xc6ff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x199602[_0xc6ff('0x17')]?_0x199602[_0xc6ff('0x17')]['where']||null:null,'attributes':_0x199602[_0xc6ff('0x17')]?_0x199602[_0xc6ff('0x17')][_0xc6ff('0x19')]||null:null,'limit':_0x199602[_0xc6ff('0x17')]?_0x199602['options'][_0xc6ff('0x1a')]||null:null})[_0xc6ff('0x9')](function(_0x2b5bc4){logger[_0xc6ff('0xa')](_0xc6ff('0x13'),_0x199602);logger[_0xc6ff('0xb')](_0xc6ff('0x13'),_0x199602,JSON[_0xc6ff('0x1b')](_0x2b5bc4));_0x2cf155(_0x2b5bc4);})[_0xc6ff('0x1c')](function(_0x5526dc){logger[_0xc6ff('0xd')]('UpdateFaxApplication',_0x5526dc[_0xc6ff('0xf')],_0x199602);_0x343d58(_0x3f5289[_0xc6ff('0xd')](0x1f4,_0x5526dc[_0xc6ff('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 746b0f8..00c68e3 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 _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1b8992,_0x1ddeba){var _0x3c0165=function(_0x5d860e){while(--_0x5d860e){_0x1b8992['push'](_0x1b8992['shift']());}};_0x3c0165(++_0x1ddeba);}(_0xb62e,0x1de));var _0xeb62=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb62e[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file +var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x1e0d8a,_0xb20f64){var _0x45e97d=function(_0x2caf6e){while(--_0x2caf6e){_0x1e0d8a['push'](_0x1e0d8a['shift']());}};_0x45e97d(++_0xb20f64);}(_0xa571,0x107));var _0x1a57=function(_0x6b9e34,_0x468b3a){_0x6b9e34=_0x6b9e34-0x0;var _0x479491=_0xa571[_0x6b9e34];return _0x479491;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 978174a..328d524 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 _0x4b17=['STRING','ENUM','out','DATE','INTEGER','sequelize','BOOLEAN'];(function(_0x12704a,_0x51c538){var _0x46e6ee=function(_0x5e8bc6){while(--_0x5e8bc6){_0x12704a['push'](_0x12704a['shift']());}};_0x46e6ee(++_0x51c538);}(_0x4b17,0x10f));var _0x74b1=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0x4b17[_0x44b7d6];return _0x5346f0;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x74b1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x74b1('0x2')]},'secondDisposition':{'type':Sequelize[_0x74b1('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74b1('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74b1('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x74b1('0x6')]}}; \ No newline at end of file +var _0x524e=['out','INTEGER','BOOLEAN','DATE','STRING','ENUM'];(function(_0xeeb5c6,_0x3d3361){var _0xed6d58=function(_0x12c1db){while(--_0x12c1db){_0xeeb5c6['push'](_0xeeb5c6['shift']());}};_0xed6d58(++_0x3d3361);}(_0x524e,0x15e));var _0xe524=function(_0x17ad3b,_0x3a27f6){_0x17ad3b=_0x17ad3b-0x0;var _0x1c4f89=_0x524e[_0x17ad3b];return _0x1c4f89;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xe524('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe524('0x1')]},'disposition':{'type':Sequelize[_0xe524('0x2')]},'secondDisposition':{'type':Sequelize[_0xe524('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe524('0x2')]},'note':{'type':Sequelize[_0xe524('0x2')]},'read1stAt':{'type':Sequelize[_0xe524('0x1')]},'fax':{'type':Sequelize[_0xe524('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xe524('0x3')]('in',_0xe524('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe524('0x3')]('in',_0xe524('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xe524('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 3cafa0d..c0239b6 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 _0x351f=['sort','where','FaxInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','faxInteractionTags:save','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','Content-Range','update','then','destroy','end','error','stack','name','send','index','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','includeAll','include','options','create','body','find','describe','FaxMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','limit','order'];(function(_0x15f258,_0xa128b6){var _0x3decc4=function(_0x1ef7a4){while(--_0x1ef7a4){_0x15f258['push'](_0x15f258['shift']());}};_0x3decc4(++_0xa128b6);}(_0x351f,0x1cf));var _0xf351=function(_0x180834,_0x890002){_0x180834=_0x180834-0x0;var _0x19f860=_0x351f[_0x180834];return _0x19f860;};'use strict';var rimraf=require(_0xf351('0x0'));var zipdir=require(_0xf351('0x1'));var moment=require('moment');var BPromise=require(_0xf351('0x2'));var util=require(_0xf351('0x3'));var path=require(_0xf351('0x4'));var fs=require('fs');var _=require(_0xf351('0x5'));var Redis=require('ioredis');var interaction=require(_0xf351('0x6'));var qs=require(_0xf351('0x7'));var logger=require(_0xf351('0x8'))('api');var config=require(_0xf351('0x9'));var db=require(_0xf351('0xa'))['db'];config[_0xf351('0xb')]=_[_0xf351('0xc')](config[_0xf351('0xb')],{'host':_0xf351('0xd'),'port':0x18eb});var socket=require(_0xf351('0xe'))(new Redis(config['redis']));require(_0xf351('0xf'))[_0xf351('0x10')](socket);function respondWithStatusCode(_0x4be565,_0x1113d7){_0x1113d7=_0x1113d7||0xcc;return function(_0x5353fd){if(_0x5353fd){return _0x4be565[_0xf351('0x11')](_0x1113d7);}return _0x4be565[_0xf351('0x12')](_0x1113d7)['end']();};}function respondWithResult(_0x2637f6,_0x1a6423){_0x1a6423=_0x1a6423||0xc8;return function(_0x4c029d){if(_0x4c029d){return _0x2637f6[_0xf351('0x12')](_0x1a6423)[_0xf351('0x13')](_0x4c029d);}};}function respondWithFilteredResult(_0x3460d1,_0x210aef){return function(_0x43f542){if(_0x43f542){var _0x520d2f=typeof _0x210aef[_0xf351('0x14')]===_0xf351('0x15')&&typeof _0x210aef['limit']===_0xf351('0x15');var _0x57e2f8=_0x43f542[_0xf351('0x16')];var _0x54f003=_0x520d2f?0x0:_0x210aef['offset'];var _0x17b479=_0x520d2f?_0x43f542[_0xf351('0x16')]:_0x210aef[_0xf351('0x14')]+_0x210aef['limit'];var _0x219ada;if(_0x17b479>=_0x57e2f8){_0x17b479=_0x57e2f8;_0x219ada=0xc8;}else{_0x219ada=0xce;}_0x3460d1[_0xf351('0x12')](_0x219ada);return _0x3460d1['set'](_0xf351('0x17'),_0x54f003+'-'+_0x17b479+'/'+_0x57e2f8)['json'](_0x43f542);}return null;};}function saveUpdates(_0x470495){return function(_0x491f6f){if(_0x491f6f){return _0x491f6f[_0xf351('0x18')](_0x470495)[_0xf351('0x19')](function(_0x20c669){return _0x20c669;});}return null;};}function removeEntity(_0x2c8641){return function(_0x359094){if(_0x359094){return _0x359094[_0xf351('0x1a')]()[_0xf351('0x19')](function(){_0x2c8641['status'](0xcc)[_0xf351('0x1b')]();});}};}function handleEntityNotFound(_0x963955){return function(_0x4a42f8){if(!_0x4a42f8){_0x963955['sendStatus'](0x194);}return _0x4a42f8;};}function handleError(_0x4d0e2c,_0x21ec32){_0x21ec32=_0x21ec32||0x1f4;return function(_0x291963){logger[_0xf351('0x1c')](_0x291963[_0xf351('0x1d')]);if(_0x291963[_0xf351('0x1e')]){delete _0x291963[_0xf351('0x1e')];}_0x4d0e2c['status'](_0x21ec32)[_0xf351('0x1f')](_0x291963);};}exports[_0xf351('0x20')]=function(_0x4b2fa5,_0x432f12){var _0x339f7b={};var _0x20f16b=_['map'](db[_0xf351('0x21')][_0xf351('0x22')],function(_0x3e59c6){return{'name':_0x3e59c6['fieldName'],'type':_0x3e59c6[_0xf351('0x23')][_0xf351('0x24')]};});_0x339f7b=qs[_0xf351('0x25')](_0x20f16b,_0x4b2fa5);return interaction[_0xf351('0x26')](_0xf351('0x27'),_0x4b2fa5[_0xf351('0x28')],_0x4b2fa5[_0xf351('0x29')],_0x339f7b,_0x20f16b)[_0xf351('0x19')](respondWithFilteredResult(_0x432f12,_0x339f7b))[_0xf351('0x2a')](handleError(_0x432f12,null));};exports[_0xf351('0x2b')]=function(_0x5f3879,_0x226624){var _0x4933a1={'raw':![],'where':{'id':_0x5f3879[_0xf351('0x2c')]['id']}},_0x5e10e1={};_0x5e10e1[_0xf351('0x2d')]=_[_0xf351('0x2e')](db[_0xf351('0x21')][_0xf351('0x22')]);_0x5e10e1['query']=_['keys'](_0x5f3879['query']);_0x5e10e1[_0xf351('0x2f')]=_[_0xf351('0x30')](_0x5e10e1[_0xf351('0x2d')],_0x5e10e1[_0xf351('0x28')]);_0x4933a1['attributes']=_[_0xf351('0x30')](_0x5e10e1[_0xf351('0x2d')],qs[_0xf351('0x31')](_0x5f3879['query'][_0xf351('0x31')]));_0x4933a1[_0xf351('0x32')]=_0x4933a1[_0xf351('0x32')]['length']?_0x4933a1['attributes']:_0x5e10e1[_0xf351('0x2d')];if(_0x5f3879[_0xf351('0x28')][_0xf351('0x33')]){_0x4933a1[_0xf351('0x34')]=[{'all':!![]}];}_0x4933a1=_['merge']({},_0x4933a1,_0x5f3879[_0xf351('0x35')]);return db[_0xf351('0x21')]['find'](_0x4933a1)[_0xf351('0x19')](handleEntityNotFound(_0x226624,null))[_0xf351('0x19')](respondWithResult(_0x226624,null))[_0xf351('0x2a')](handleError(_0x226624,null));};exports[_0xf351('0x36')]=function(_0x407911,_0x13c804){return db[_0xf351('0x21')][_0xf351('0x36')](_0x407911['body'],{})[_0xf351('0x19')](respondWithResult(_0x13c804,0xc9))[_0xf351('0x2a')](handleError(_0x13c804,null));};exports[_0xf351('0x18')]=function(_0x5ebef0,_0x21bcc1){if(_0x5ebef0[_0xf351('0x37')]['id']){delete _0x5ebef0[_0xf351('0x37')]['id'];}return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x5ebef0[_0xf351('0x2c')]['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x21bcc1,null))[_0xf351('0x19')](saveUpdates(_0x5ebef0[_0xf351('0x37')],null))['then'](respondWithResult(_0x21bcc1,null))['catch'](handleError(_0x21bcc1,null));};exports[_0xf351('0x1a')]=function(_0x2c7749,_0x345627){return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x2c7749[_0xf351('0x2c')]['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x345627,null))[_0xf351('0x19')](removeEntity(_0x345627,null))[_0xf351('0x2a')](handleError(_0x345627,null));};exports[_0xf351('0x39')]=function(_0x57fe12,_0x5dae4e){return db[_0xf351('0x21')][_0xf351('0x39')]()[_0xf351('0x19')](respondWithResult(_0x5dae4e,null))[_0xf351('0x2a')](handleError(_0x5dae4e,null));};exports['addMessage']=function(_0x467993,_0x27329d){return db[_0xf351('0x3a')][_0xf351('0x38')]({'where':{'id':_0x467993[_0xf351('0x2c')]['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x27329d,null))[_0xf351('0x19')](function(_0x56ce65){if(_0x56ce65){return _0x56ce65['addMessage'](_0x467993['body'][_0xf351('0x3b')],_[_0xf351('0x3c')](_0x467993[_0xf351('0x37')],[_0xf351('0x3b'),'id'])||{});}})[_0xf351('0x19')](respondWithResult(_0x27329d,null))[_0xf351('0x2a')](handleError(_0x27329d,null));};exports[_0xf351('0x3d')]=function(_0x43aea6,_0x82008d){var _0x324564={'raw':![],'where':{}};var _0x10bdd2={};var _0x4c30ab={'count':0x0,'rows':[]};return db[_0xf351('0x21')][_0xf351('0x3e')]({'where':{'id':_0x43aea6['params']['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x82008d,null))[_0xf351('0x19')](function(_0x10999c){if(_0x10999c){_0x10bdd2[_0xf351('0x2d')]=_['keys'](db['FaxMessage'][_0xf351('0x22')]);_0x10bdd2[_0xf351('0x28')]=_[_0xf351('0x2e')](_0x43aea6['query']);_0x10bdd2['filters']=_[_0xf351('0x30')](_0x10bdd2['model'],_0x10bdd2[_0xf351('0x28')]);_0x324564[_0xf351('0x32')]=_[_0xf351('0x30')](_0x10bdd2[_0xf351('0x2d')],qs[_0xf351('0x31')](_0x43aea6[_0xf351('0x28')][_0xf351('0x31')]));_0x324564[_0xf351('0x32')]=_0x324564['attributes'][_0xf351('0x3f')]?_0x324564['attributes']:_0x10bdd2[_0xf351('0x2d')];if(!_0x43aea6[_0xf351('0x28')][_0xf351('0x40')]('nolimit')){_0x324564[_0xf351('0x41')]=qs[_0xf351('0x41')](_0x43aea6[_0xf351('0x28')][_0xf351('0x41')]);_0x324564[_0xf351('0x14')]=qs[_0xf351('0x14')](_0x43aea6[_0xf351('0x28')][_0xf351('0x14')]);}_0x324564[_0xf351('0x42')]=qs[_0xf351('0x43')](_0x43aea6[_0xf351('0x28')]['sort']);_0x324564[_0xf351('0x44')]=qs[_0xf351('0x2f')](_['pick'](_0x43aea6['query'],_0x10bdd2[_0xf351('0x2f')]));_0x324564[_0xf351('0x44')][_0xf351('0x45')]=_0x10999c['id'];if(_0x43aea6[_0xf351('0x28')][_0xf351('0x46')]){_0x324564[_0xf351('0x44')]=_[_0xf351('0x47')](_0x324564[_0xf351('0x44')],{'$or':_[_0xf351('0x48')](_0x324564[_0xf351('0x32')],function(_0x40e7dd){var _0x8f54fa={};_0x8f54fa[_0x40e7dd]={'$like':'%'+_0x43aea6[_0xf351('0x28')][_0xf351('0x46')]+'%'};return _0x8f54fa;})});}if(_0x43aea6[_0xf351('0x28')][_0xf351('0x49')]){var _0x301b68=_0x43aea6[_0xf351('0x28')][_0xf351('0x49')][_0xf351('0x4a')](',');var _0x5da68d={};_0x5da68d[_0x301b68[0x0]]={'$gte':moment(_0x301b68[0x1])[_0xf351('0x4b')](_0xf351('0x4c'))};_0x324564[_0xf351('0x44')]=_[_0xf351('0x47')](_0x324564[_0xf351('0x44')],_0x5da68d);}_0x324564=_['merge']({},_0x324564,_0x43aea6['options']);return db[_0xf351('0x3a')]['count']({'where':_0x324564['where']})[_0xf351('0x19')](function(_0x54df7a){_0x4c30ab['count']=_0x54df7a;if(_0x43aea6[_0xf351('0x28')]['includeAll']){_0x324564['include']=[{'all':!![]}];}return db['FaxMessage'][_0xf351('0x26')](_0x324564);})[_0xf351('0x19')](function(_0x455e2c){_0x4c30ab[_0xf351('0x4d')]=_0x455e2c;return _0x4c30ab;});}})[_0xf351('0x19')](respondWithFilteredResult(_0x82008d,_0x324564))[_0xf351('0x2a')](handleError(_0x82008d,null));};exports['addTags']=function(_0x1ad52c,_0x4778bc){return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x1ad52c[_0xf351('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4778bc,null))['then'](function(_0x149f9d){if(_0x149f9d){return _0x149f9d[_0xf351('0x4e')](_0x1ad52c[_0xf351('0x37')][_0xf351('0x3b')],_[_0xf351('0x3c')](_0x1ad52c[_0xf351('0x37')],['ids','id'])||{})[_0xf351('0x4f')](function(){return db[_0xf351('0x50')][_0xf351('0x26')]({'attributes':['id','name',_0xf351('0x51')],'where':{'id':_0x1ad52c[_0xf351('0x37')]['ids']}});})[_0xf351('0x19')](function(_0x19cae1){socket['emit'](_0xf351('0x52'),{'id':Number(_0x1ad52c[_0xf351('0x2c')]['id']),'tags':_0x19cae1||[]});return{'id':Number(_0x1ad52c[_0xf351('0x2c')]['id']),'tags':_0x19cae1||[]};});}})['then'](respondWithResult(_0x4778bc,null))[_0xf351('0x2a')](handleError(_0x4778bc,null));};exports['removeTags']=function(_0x54ec0f,_0x452c90){return db[_0xf351('0x21')][_0xf351('0x38')]({'where':{'id':_0x54ec0f['params']['id']}})[_0xf351('0x19')](handleEntityNotFound(_0x452c90,null))[_0xf351('0x19')](function(_0xa898eb){if(_0xa898eb){return _0xa898eb['removeTags'](_0x54ec0f['query']['ids']);}})[_0xf351('0x19')](respondWithStatusCode(_0x452c90,null))['catch'](handleError(_0x452c90,null));};exports[_0xf351('0x53')]=function(_0x3288a5,_0x44d861){var _0xae4d61=moment()['unix']()[_0xf351('0x54')]();var _0xa102f1=path[_0xf351('0x55')](config[_0xf351('0x56')],_0xf351('0x57'),_0xf351('0x58'),_0xf351('0x59'));var _0x38f9a3=path['join'](config[_0xf351('0x56')],_0xf351('0x57'),_0xf351('0x58'),_0xf351('0x5a'));var _0x37c36c=path[_0xf351('0x55')](_0xa102f1,_0xae4d61);var _0xcf53b3=util['format'](_0xf351('0x5b'),_0x3288a5['params']['id'],_0xae4d61);var _0x66e673=path[_0xf351('0x55')](_0xa102f1,_0xcf53b3);var _0x126b56=[];_0x126b56[_0xf351('0x5c')]({'model':db[_0xf351('0x5d')],'as':_0xf351('0x5d'),'raw':!![]});var _0x246e1b=[{'model':db[_0xf351('0x3a')],'as':_0xf351('0x5e'),'attributes':['id','body',_0xf351('0x5f')],'include':_0x126b56}];return db['FaxInteraction'][_0xf351('0x38')]({'where':{'id':_0x3288a5[_0xf351('0x2c')]['id']},'include':_0x246e1b})[_0xf351('0x19')](handleEntityNotFound(_0x44d861,null))[_0xf351('0x19')](function(_0x22d43e){if(_0x22d43e&&_0x22d43e['Messages']){var _0x1bd8df=_0x22d43e[_0xf351('0x60')]({'plain':!![]});fs[_0xf351('0x61')](_0x37c36c);for(var _0x3e31b8=0x0;_0x3e31b8<_0x1bd8df['Messages'][_0xf351('0x3f')];_0x3e31b8++){var _0x3341db=_0x1bd8df[_0xf351('0x5e')][_0x3e31b8][_0xf351('0x5d')];if(_0x3341db){var _0x17170e=path[_0xf351('0x55')](_0x38f9a3,_0x3341db[_0xf351('0x62')]);if(fs['existsSync'](_0x17170e)){fs[_0xf351('0x63')](_0x17170e)[_0xf351('0x64')](fs[_0xf351('0x65')](path[_0xf351('0x55')](_0x37c36c,_0x3341db[_0xf351('0x62')])));}}}return BPromise[_0xf351('0x66')]()['then'](function(){return new BPromise(function(_0x29cc73,_0x18aaa2){zipdir(_0x37c36c,{'saveTo':_0x66e673},function(_0x113749,_0x588528){if(_0x113749)return _0x18aaa2(_0x113749);return _0x29cc73(_0x588528);});})[_0xf351('0x19')](function(){return new BPromise(function(_0x34916c,_0x17e26c){rimraf(_0x37c36c,function(_0x12986a){if(_0x12986a)_0x17e26c(_0x12986a);return _0x34916c();});});})[_0xf351('0x19')](function(){return _0x44d861[_0xf351('0x53')](_0x66e673,_0xcf53b3,function(_0xb1e84d){if(_0xb1e84d){console[_0xf351('0x67')](_0xf351('0x68'),_0xb1e84d);}else{fs[_0xf351('0x69')](_0x66e673);}});});});}else{return _0x44d861[_0xf351('0x11')](0xc8);}})[_0xf351('0x2a')](handleError(_0x44d861,null));}; \ No newline at end of file +var _0x4a2e=['hasOwnProperty','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','createdAt','get','Messages','basename','existsSync','createReadStream','pipe','resolve','download','err','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','fax','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','describe','addMessage','FaxMessage','ids','omit','getMessages'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0x4a2e,0x15c));var _0xe4a2=function(_0x37d225,_0x2ed664){_0x37d225=_0x37d225-0x0;var _0x26834b=_0x4a2e[_0x37d225];return _0x26834b;};'use strict';var rimraf=require(_0xe4a2('0x0'));var zipdir=require(_0xe4a2('0x1'));var moment=require(_0xe4a2('0x2'));var BPromise=require(_0xe4a2('0x3'));var util=require(_0xe4a2('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xe4a2('0x5'));var Redis=require('ioredis');var interaction=require(_0xe4a2('0x6'));var qs=require(_0xe4a2('0x7'));var logger=require('../../config/logger')(_0xe4a2('0x8'));var config=require(_0xe4a2('0x9'));var db=require(_0xe4a2('0xa'))['db'];config['redis']=_[_0xe4a2('0xb')](config[_0xe4a2('0xc')],{'host':_0xe4a2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4a2('0xc')]));require(_0xe4a2('0xe'))[_0xe4a2('0xf')](socket);function respondWithStatusCode(_0xab3ff1,_0x3cb3c5){_0x3cb3c5=_0x3cb3c5||0xcc;return function(_0x342bee){if(_0x342bee){return _0xab3ff1[_0xe4a2('0x10')](_0x3cb3c5);}return _0xab3ff1[_0xe4a2('0x11')](_0x3cb3c5)['end']();};}function respondWithResult(_0x4b9ebf,_0x35f4a9){_0x35f4a9=_0x35f4a9||0xc8;return function(_0x2e3d9b){if(_0x2e3d9b){return _0x4b9ebf[_0xe4a2('0x11')](_0x35f4a9)[_0xe4a2('0x12')](_0x2e3d9b);}};}function respondWithFilteredResult(_0x490f1e,_0x1f9b80){return function(_0x3b0ae4){if(_0x3b0ae4){var _0x3d31c7=typeof _0x1f9b80[_0xe4a2('0x13')]==='undefined'&&typeof _0x1f9b80[_0xe4a2('0x14')]===_0xe4a2('0x15');var _0x468375=_0x3b0ae4[_0xe4a2('0x16')];var _0x479e1b=_0x3d31c7?0x0:_0x1f9b80[_0xe4a2('0x13')];var _0x5989e3=_0x3d31c7?_0x3b0ae4[_0xe4a2('0x16')]:_0x1f9b80[_0xe4a2('0x13')]+_0x1f9b80[_0xe4a2('0x14')];var _0x4f7127;if(_0x5989e3>=_0x468375){_0x5989e3=_0x468375;_0x4f7127=0xc8;}else{_0x4f7127=0xce;}_0x490f1e[_0xe4a2('0x11')](_0x4f7127);return _0x490f1e[_0xe4a2('0x17')]('Content-Range',_0x479e1b+'-'+_0x5989e3+'/'+_0x468375)['json'](_0x3b0ae4);}return null;};}function saveUpdates(_0x20992c){return function(_0x1f6e29){if(_0x1f6e29){return _0x1f6e29[_0xe4a2('0x18')](_0x20992c)[_0xe4a2('0x19')](function(_0x31fd02){return _0x31fd02;});}return null;};}function removeEntity(_0x4236af){return function(_0x2a4e97){if(_0x2a4e97){return _0x2a4e97[_0xe4a2('0x1a')]()[_0xe4a2('0x19')](function(){_0x4236af[_0xe4a2('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x359b0e){return function(_0x2c2625){if(!_0x2c2625){_0x359b0e[_0xe4a2('0x10')](0x194);}return _0x2c2625;};}function handleError(_0x310097,_0x1826a5){_0x1826a5=_0x1826a5||0x1f4;return function(_0x55e12b){logger[_0xe4a2('0x1b')](_0x55e12b[_0xe4a2('0x1c')]);if(_0x55e12b['name']){delete _0x55e12b[_0xe4a2('0x1d')];}_0x310097[_0xe4a2('0x11')](_0x1826a5)[_0xe4a2('0x1e')](_0x55e12b);};}exports[_0xe4a2('0x1f')]=function(_0x1ed854,_0x47b6d1){var _0x56fda6={};var _0x38725e=_[_0xe4a2('0x20')](db[_0xe4a2('0x21')][_0xe4a2('0x22')],function(_0x2919f4){return{'name':_0x2919f4[_0xe4a2('0x23')],'type':_0x2919f4['type'][_0xe4a2('0x24')]};});_0x56fda6=qs[_0xe4a2('0x25')](_0x38725e,_0x1ed854);return interaction['findAll'](_0xe4a2('0x26'),_0x1ed854[_0xe4a2('0x27')],_0x1ed854[_0xe4a2('0x28')],_0x56fda6,_0x38725e)[_0xe4a2('0x19')](respondWithFilteredResult(_0x47b6d1,_0x56fda6))['catch'](handleError(_0x47b6d1,null));};exports[_0xe4a2('0x29')]=function(_0x1d4300,_0x587cf0){var _0x2e9b78={'raw':![],'where':{'id':_0x1d4300[_0xe4a2('0x2a')]['id']}},_0x46e730={};_0x46e730[_0xe4a2('0x2b')]=_[_0xe4a2('0x2c')](db['FaxInteraction'][_0xe4a2('0x22')]);_0x46e730['query']=_['keys'](_0x1d4300['query']);_0x46e730[_0xe4a2('0x2d')]=_[_0xe4a2('0x2e')](_0x46e730['model'],_0x46e730['query']);_0x2e9b78[_0xe4a2('0x2f')]=_[_0xe4a2('0x2e')](_0x46e730[_0xe4a2('0x2b')],qs['fields'](_0x1d4300[_0xe4a2('0x27')][_0xe4a2('0x30')]));_0x2e9b78[_0xe4a2('0x2f')]=_0x2e9b78[_0xe4a2('0x2f')][_0xe4a2('0x31')]?_0x2e9b78['attributes']:_0x46e730[_0xe4a2('0x2b')];if(_0x1d4300['query'][_0xe4a2('0x32')]){_0x2e9b78[_0xe4a2('0x33')]=[{'all':!![]}];}_0x2e9b78=_[_0xe4a2('0x34')]({},_0x2e9b78,_0x1d4300[_0xe4a2('0x35')]);return db[_0xe4a2('0x21')][_0xe4a2('0x36')](_0x2e9b78)[_0xe4a2('0x19')](handleEntityNotFound(_0x587cf0,null))[_0xe4a2('0x19')](respondWithResult(_0x587cf0,null))['catch'](handleError(_0x587cf0,null));};exports[_0xe4a2('0x37')]=function(_0x3a82e6,_0x4dda1b){return db[_0xe4a2('0x21')]['create'](_0x3a82e6[_0xe4a2('0x38')],{})[_0xe4a2('0x19')](respondWithResult(_0x4dda1b,0xc9))[_0xe4a2('0x39')](handleError(_0x4dda1b,null));};exports[_0xe4a2('0x18')]=function(_0x28c221,_0x4dcdd1){if(_0x28c221[_0xe4a2('0x38')]['id']){delete _0x28c221['body']['id'];}return db['FaxInteraction'][_0xe4a2('0x36')]({'where':{'id':_0x28c221['params']['id']}})[_0xe4a2('0x19')](handleEntityNotFound(_0x4dcdd1,null))['then'](saveUpdates(_0x28c221[_0xe4a2('0x38')],null))[_0xe4a2('0x19')](respondWithResult(_0x4dcdd1,null))[_0xe4a2('0x39')](handleError(_0x4dcdd1,null));};exports['destroy']=function(_0x1e0e8a,_0x5c2a3c){return db[_0xe4a2('0x21')][_0xe4a2('0x36')]({'where':{'id':_0x1e0e8a[_0xe4a2('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5c2a3c,null))[_0xe4a2('0x19')](removeEntity(_0x5c2a3c,null))['catch'](handleError(_0x5c2a3c,null));};exports[_0xe4a2('0x3a')]=function(_0x51e2c0,_0x3f4808){return db[_0xe4a2('0x21')]['describe']()['then'](respondWithResult(_0x3f4808,null))[_0xe4a2('0x39')](handleError(_0x3f4808,null));};exports[_0xe4a2('0x3b')]=function(_0x392239,_0x92c56){return db[_0xe4a2('0x3c')][_0xe4a2('0x36')]({'where':{'id':_0x392239[_0xe4a2('0x2a')]['id']}})['then'](handleEntityNotFound(_0x92c56,null))[_0xe4a2('0x19')](function(_0x55dab6){if(_0x55dab6){return _0x55dab6[_0xe4a2('0x3b')](_0x392239['body'][_0xe4a2('0x3d')],_[_0xe4a2('0x3e')](_0x392239[_0xe4a2('0x38')],[_0xe4a2('0x3d'),'id'])||{});}})[_0xe4a2('0x19')](respondWithResult(_0x92c56,null))[_0xe4a2('0x39')](handleError(_0x92c56,null));};exports[_0xe4a2('0x3f')]=function(_0x1c1393,_0x7e1d48){var _0x217581={'raw':![],'where':{}};var _0x292c98={};var _0x29e840={'count':0x0,'rows':[]};return db[_0xe4a2('0x21')]['findOne']({'where':{'id':_0x1c1393[_0xe4a2('0x2a')]['id']}})[_0xe4a2('0x19')](handleEntityNotFound(_0x7e1d48,null))[_0xe4a2('0x19')](function(_0x3f4059){if(_0x3f4059){_0x292c98[_0xe4a2('0x2b')]=_[_0xe4a2('0x2c')](db['FaxMessage'][_0xe4a2('0x22')]);_0x292c98[_0xe4a2('0x27')]=_[_0xe4a2('0x2c')](_0x1c1393[_0xe4a2('0x27')]);_0x292c98[_0xe4a2('0x2d')]=_[_0xe4a2('0x2e')](_0x292c98[_0xe4a2('0x2b')],_0x292c98[_0xe4a2('0x27')]);_0x217581['attributes']=_['intersection'](_0x292c98[_0xe4a2('0x2b')],qs[_0xe4a2('0x30')](_0x1c1393[_0xe4a2('0x27')][_0xe4a2('0x30')]));_0x217581[_0xe4a2('0x2f')]=_0x217581[_0xe4a2('0x2f')][_0xe4a2('0x31')]?_0x217581[_0xe4a2('0x2f')]:_0x292c98[_0xe4a2('0x2b')];if(!_0x1c1393[_0xe4a2('0x27')][_0xe4a2('0x40')]('nolimit')){_0x217581[_0xe4a2('0x14')]=qs[_0xe4a2('0x14')](_0x1c1393['query']['limit']);_0x217581[_0xe4a2('0x13')]=qs[_0xe4a2('0x13')](_0x1c1393[_0xe4a2('0x27')]['offset']);}_0x217581[_0xe4a2('0x41')]=qs[_0xe4a2('0x42')](_0x1c1393[_0xe4a2('0x27')][_0xe4a2('0x42')]);_0x217581[_0xe4a2('0x43')]=qs[_0xe4a2('0x2d')](_[_0xe4a2('0x44')](_0x1c1393['query'],_0x292c98[_0xe4a2('0x2d')]));_0x217581['where']['FaxInteractionId']=_0x3f4059['id'];if(_0x1c1393[_0xe4a2('0x27')][_0xe4a2('0x45')]){_0x217581['where']=_[_0xe4a2('0x34')](_0x217581[_0xe4a2('0x43')],{'$or':_['map'](_0x217581[_0xe4a2('0x2f')],function(_0x2d6cff){var _0xd6ebca={};_0xd6ebca[_0x2d6cff]={'$like':'%'+_0x1c1393['query']['filter']+'%'};return _0xd6ebca;})});}if(_0x1c1393[_0xe4a2('0x27')]['$gte']){var _0x393d1a=_0x1c1393[_0xe4a2('0x27')][_0xe4a2('0x46')][_0xe4a2('0x47')](',');var _0x178983={};_0x178983[_0x393d1a[0x0]]={'$gte':moment(_0x393d1a[0x1])['format'](_0xe4a2('0x48'))};_0x217581[_0xe4a2('0x43')]=_['merge'](_0x217581[_0xe4a2('0x43')],_0x178983);}_0x217581=_[_0xe4a2('0x34')]({},_0x217581,_0x1c1393[_0xe4a2('0x35')]);return db['FaxMessage'][_0xe4a2('0x16')]({'where':_0x217581[_0xe4a2('0x43')]})['then'](function(_0x7f307b){_0x29e840['count']=_0x7f307b;if(_0x1c1393[_0xe4a2('0x27')][_0xe4a2('0x32')]){_0x217581[_0xe4a2('0x33')]=[{'all':!![]}];}return db[_0xe4a2('0x3c')][_0xe4a2('0x49')](_0x217581);})[_0xe4a2('0x19')](function(_0x3cbab4){_0x29e840[_0xe4a2('0x4a')]=_0x3cbab4;return _0x29e840;});}})[_0xe4a2('0x19')](respondWithFilteredResult(_0x7e1d48,_0x217581))[_0xe4a2('0x39')](handleError(_0x7e1d48,null));};exports[_0xe4a2('0x4b')]=function(_0x3450e3,_0x33755c){return db[_0xe4a2('0x21')][_0xe4a2('0x36')]({'where':{'id':_0x3450e3[_0xe4a2('0x2a')]['id']}})[_0xe4a2('0x19')](handleEntityNotFound(_0x33755c,null))[_0xe4a2('0x19')](function(_0x4a637d){if(_0x4a637d){return _0x4a637d[_0xe4a2('0x4c')](_0x3450e3[_0xe4a2('0x38')][_0xe4a2('0x3d')],_['omit'](_0x3450e3[_0xe4a2('0x38')],[_0xe4a2('0x3d'),'id'])||{})[_0xe4a2('0x4d')](function(){return db['Tag'][_0xe4a2('0x49')]({'attributes':['id','name',_0xe4a2('0x4e')],'where':{'id':_0x3450e3['body'][_0xe4a2('0x3d')]}});})[_0xe4a2('0x19')](function(_0x233094){socket[_0xe4a2('0x4f')](_0xe4a2('0x50'),{'id':Number(_0x3450e3[_0xe4a2('0x2a')]['id']),'tags':_0x233094||[]});return{'id':Number(_0x3450e3[_0xe4a2('0x2a')]['id']),'tags':_0x233094||[]};});}})[_0xe4a2('0x19')](respondWithResult(_0x33755c,null))[_0xe4a2('0x39')](handleError(_0x33755c,null));};exports['removeTags']=function(_0x525635,_0x56297a){return db[_0xe4a2('0x21')][_0xe4a2('0x36')]({'where':{'id':_0x525635['params']['id']}})[_0xe4a2('0x19')](handleEntityNotFound(_0x56297a,null))[_0xe4a2('0x19')](function(_0x1d500a){if(_0x1d500a){return _0x1d500a[_0xe4a2('0x51')](_0x525635[_0xe4a2('0x27')]['ids']);}})[_0xe4a2('0x19')](respondWithStatusCode(_0x56297a,null))[_0xe4a2('0x39')](handleError(_0x56297a,null));};exports['download']=function(_0x5eaaea,_0x115c23){var _0x4ef8d0=moment()[_0xe4a2('0x52')]()[_0xe4a2('0x53')]();var _0x5b04f3=path[_0xe4a2('0x54')](config[_0xe4a2('0x55')],_0xe4a2('0x56'),'files',_0xe4a2('0x57'));var _0x405e3b=path[_0xe4a2('0x54')](config[_0xe4a2('0x55')],_0xe4a2('0x56'),'files',_0xe4a2('0x58'));var _0x30e26e=path[_0xe4a2('0x54')](_0x5b04f3,_0x4ef8d0);var _0x3eeb82=util[_0xe4a2('0x59')](_0xe4a2('0x5a'),_0x5eaaea['params']['id'],_0x4ef8d0);var _0xa52000=path[_0xe4a2('0x54')](_0x5b04f3,_0x3eeb82);var _0x5ccf4a=[];_0x5ccf4a[_0xe4a2('0x5b')]({'model':db[_0xe4a2('0x5c')],'as':'Attachment','raw':!![]});var _0x44c5a0=[{'model':db[_0xe4a2('0x3c')],'as':'Messages','attributes':['id',_0xe4a2('0x38'),_0xe4a2('0x5d')],'include':_0x5ccf4a}];return db['FaxInteraction'][_0xe4a2('0x36')]({'where':{'id':_0x5eaaea[_0xe4a2('0x2a')]['id']},'include':_0x44c5a0})[_0xe4a2('0x19')](handleEntityNotFound(_0x115c23,null))[_0xe4a2('0x19')](function(_0x110371){if(_0x110371&&_0x110371['Messages']){var _0x3c025c=_0x110371[_0xe4a2('0x5e')]({'plain':!![]});fs['mkdirSync'](_0x30e26e);for(var _0x423cd9=0x0;_0x423cd9<_0x3c025c[_0xe4a2('0x5f')]['length'];_0x423cd9++){var _0x3d78db=_0x3c025c[_0xe4a2('0x5f')][_0x423cd9]['Attachment'];if(_0x3d78db){var _0xbd1ef3=path['join'](_0x405e3b,_0x3d78db[_0xe4a2('0x60')]);if(fs[_0xe4a2('0x61')](_0xbd1ef3)){fs[_0xe4a2('0x62')](_0xbd1ef3)[_0xe4a2('0x63')](fs['createWriteStream'](path[_0xe4a2('0x54')](_0x30e26e,_0x3d78db['basename'])));}}}return BPromise[_0xe4a2('0x64')]()[_0xe4a2('0x19')](function(){return new BPromise(function(_0x18dd96,_0xf4731b){zipdir(_0x30e26e,{'saveTo':_0xa52000},function(_0x268aa3,_0x15c26e){if(_0x268aa3)return _0xf4731b(_0x268aa3);return _0x18dd96(_0x15c26e);});})['then'](function(){return new BPromise(function(_0x22bdc1,_0xa27018){rimraf(_0x30e26e,function(_0x1205a2){if(_0x1205a2)_0xa27018(_0x1205a2);return _0x22bdc1();});});})['then'](function(){return _0x115c23[_0xe4a2('0x65')](_0xa52000,_0x3eeb82,function(_0x519227){if(_0x519227){console['log'](_0xe4a2('0x66'),_0x519227);}else{fs['unlinkSync'](_0xa52000);}});});});}else{return _0x115c23['sendStatus'](0xc8);}})[_0xe4a2('0x39')](handleError(_0x115c23,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a8c576b..5567d7c 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 _0x3c0c=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x5e2461,_0x535010){var _0x28ba4f=function(_0x57bb27){while(--_0x57bb27){_0x5e2461['push'](_0x5e2461['shift']());}};_0x28ba4f(++_0x535010);}(_0x3c0c,0xf4));var _0xc3c0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3c0c[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xc3c0('0x0'));var FaxInteraction=require(_0xc3c0('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xc3c0('0x1'))['db'][_0xc3c0('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc3c0('0x3')](0x0);var events={'afterCreate':_0xc3c0('0x4'),'afterUpdate':_0xc3c0('0x5'),'afterDestroy':_0xc3c0('0x6')};function emitEvent(_0x148f33){return function(_0x17954c,_0x170da5,_0x1e86e0){_0x17954c[_0xc3c0('0x7')]({'attributes':['id'],'raw':!![]})[_0xc3c0('0x8')](function(_0x4b376b){_0x17954c[_0xc3c0('0x9')](_0xc3c0('0xa'),_0x4b376b[_0xc3c0('0xb')](function(_0x219759){return{'id':_0x219759['id']};}));return FaxMessage[_0xc3c0('0xc')]({'where':{'FaxInteractionId':_0x17954c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc3c0('0x8')](function(_0x42781e){_0x17954c[_0xc3c0('0x9')](_0xc3c0('0xd'),_0x42781e['length']);FaxInteractionEvents[_0xc3c0('0xe')](_0x148f33+':'+_0x17954c['id'],_0x17954c);FaxInteractionEvents[_0xc3c0('0xe')](_0x148f33,_0x17954c);_0x1e86e0(null);})[_0xc3c0('0xf')](_0x1e86e0(null));};}for(var e in events){if(events[_0xc3c0('0x10')](e)){var event=events[e];FaxInteraction[_0xc3c0('0x11')](e,emitEvent(event));}}module[_0xc3c0('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x13d7=['findAll','unreadMessages','emit','catch','hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','remove','setDataValue','Users','map'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x13d7,0x131));var _0x713d=function(_0x467ff3,_0x3e30d6){_0x467ff3=_0x467ff3-0x0;var _0x4959f2=_0x13d7[_0x467ff3];return _0x4959f2;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x713d('0x0'))['db'][_0x713d('0x1')];var FaxMessage=require(_0x713d('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x713d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x713d('0x3')};function emitEvent(_0x33978a){return function(_0x1860be,_0x6d7e29,_0x59d0c6){_0x1860be['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x128dd9){_0x1860be[_0x713d('0x4')](_0x713d('0x5'),_0x128dd9[_0x713d('0x6')](function(_0x507470){return{'id':_0x507470['id']};}));return FaxMessage[_0x713d('0x7')]({'where':{'FaxInteractionId':_0x1860be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x6b133d){_0x1860be[_0x713d('0x4')](_0x713d('0x8'),_0x6b133d['length']);FaxInteractionEvents['emit'](_0x33978a+':'+_0x1860be['id'],_0x1860be);FaxInteractionEvents[_0x713d('0x9')](_0x33978a,_0x1860be);_0x59d0c6(null);})[_0x713d('0xa')](_0x59d0c6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x713d('0xb')](e,emitEvent(event));}}module[_0x713d('0xc')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index fb2dd30..8a1683e 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 _0xeda7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x5bc88d,_0x535dff){var _0x396c0f=function(_0x1f2a78){while(--_0x1f2a78){_0x5bc88d['push'](_0x5bc88d['shift']());}};_0x396c0f(++_0x535dff);}(_0xeda7,0x196));var _0x7eda=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xeda7[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var logger=require(_0x7eda('0x2'))(_0x7eda('0x3'));var moment=require(_0x7eda('0x4'));var BPromise=require(_0x7eda('0x5'));var rp=require(_0x7eda('0x6'));var fs=require('fs');var path=require(_0x7eda('0x7'));var rimraf=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var attributes=require(_0x7eda('0xa'));module[_0x7eda('0xb')]=function(_0x6ee7be,_0x328430){return _0x6ee7be[_0x7eda('0xc')](_0x7eda('0xd'),attributes,{'tableName':_0x7eda('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2bc200,_0x11576a,_0xbaadd4){if(_0x2bc200['changed'](_0x7eda('0xf'))){_0x2bc200['closedAt']=moment()['format'](_0x7eda('0x10'));}_0xbaadd4(null,_0x2bc200);}}});}; \ No newline at end of file +var _0x39c4=['moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x39c4,0xdf));var _0x439c=function(_0x118077,_0x3ece3a){_0x118077=_0x118077-0x0;var _0x1efb12=_0x39c4[_0x118077];return _0x1efb12;};'use strict';var _=require(_0x439c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x439c('0x1'));var moment=require(_0x439c('0x2'));var BPromise=require('bluebird');var rp=require(_0x439c('0x3'));var fs=require('fs');var path=require(_0x439c('0x4'));var rimraf=require(_0x439c('0x5'));var config=require(_0x439c('0x6'));var attributes=require(_0x439c('0x7'));module['exports']=function(_0x13d2e4,_0x23a055){return _0x13d2e4[_0x439c('0x8')](_0x439c('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e906e,_0x277aba,_0x1cbda6){if(_0x5e906e[_0x439c('0xa')](_0x439c('0xb'))){_0x5e906e[_0x439c('0xc')]=moment()[_0x439c('0xd')](_0x439c('0xe'));}_0x1cbda6(null,_0x5e906e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 8e59d15..f648269 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 _0xd7ea=['FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57cbe5,_0x4cdeb4){var _0x8129a2=function(_0x27a2ba){while(--_0x27a2ba){_0x57cbe5['push'](_0x57cbe5['shift']());}};_0x8129a2(++_0x4cdeb4);}(_0xd7ea,0x13d));var _0xad7e=function(_0x53e9a6,_0x12377b){_0x53e9a6=_0x53e9a6-0x0;var _0x5703a2=_0xd7ea[_0x53e9a6];return _0x5703a2;};'use strict';var _=require(_0xad7e('0x0'));var util=require('util');var moment=require(_0xad7e('0x1'));var BPromise=require(_0xad7e('0x2'));var rs=require(_0xad7e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad7e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad7e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad7e('0x6'));var client=jayson[_0xad7e('0x7')]['http']({'port':0x232a});config[_0xad7e('0x8')]=_[_0xad7e('0x9')](config[_0xad7e('0x8')],{'host':_0xad7e('0xa'),'port':0x18eb});var socket=require(_0xad7e('0xb'))(new Redis(config['redis']));require(_0xad7e('0xc'))[_0xad7e('0xd')](socket);function respondWithRpcPromise(_0x33a6e6,_0x276b28,_0x377646){return new BPromise(function(_0x1ec104,_0x1d76af){return client[_0xad7e('0xe')](_0x33a6e6,_0x377646)[_0xad7e('0xf')](function(_0x33ea61){logger['info'](_0xad7e('0x10'),_0x276b28,_0xad7e('0x11'));logger[_0xad7e('0x12')](_0xad7e('0x13'),_0x276b28,_0xad7e('0x11'),JSON['stringify'](_0x33ea61));if(_0x33ea61['error']){if(_0x33ea61[_0xad7e('0x14')][_0xad7e('0x15')]===0x1f4){logger[_0xad7e('0x14')](_0xad7e('0x10'),_0x276b28,_0x33ea61[_0xad7e('0x14')]['message']);return _0x1d76af(_0x33ea61[_0xad7e('0x14')][_0xad7e('0x16')]);}logger['error'](_0xad7e('0x10'),_0x276b28,_0x33ea61[_0xad7e('0x14')][_0xad7e('0x16')]);return _0x1ec104(_0x33ea61[_0xad7e('0x14')][_0xad7e('0x16')]);}else{logger[_0xad7e('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x276b28,_0xad7e('0x11'));_0x1ec104(_0x33ea61[_0xad7e('0x18')]['message']);}})[_0xad7e('0x19')](function(_0x484308){logger[_0xad7e('0x14')](_0xad7e('0x10'),_0x276b28,_0x484308);_0x1d76af(_0x484308);});});}exports[_0xad7e('0x1a')]=function(_0x5de89e){var _0x42f591=this;return new Promise(function(_0x4a2caf,_0x336d6d){return db[_0xad7e('0x1b')][_0xad7e('0x1c')](_0x5de89e[_0xad7e('0x1d')],{'raw':_0x5de89e[_0xad7e('0x1e')]?_0x5de89e['options'][_0xad7e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5de89e['options']?_0x5de89e[_0xad7e('0x1e')][_0xad7e('0x20')]||null:null,'attributes':_0x5de89e[_0xad7e('0x1e')]?_0x5de89e[_0xad7e('0x1e')]['attributes']||null:null,'limit':_0x5de89e[_0xad7e('0x1e')]?_0x5de89e[_0xad7e('0x1e')][_0xad7e('0x21')]||null:null})['then'](function(_0xdf0e1d){logger[_0xad7e('0x17')](_0xad7e('0x1a'),_0x5de89e);logger['debug'](_0xad7e('0x1a'),_0x5de89e,JSON[_0xad7e('0x22')](_0xdf0e1d));_0x4a2caf(_0xdf0e1d);})[_0xad7e('0x19')](function(_0x15b65d){logger[_0xad7e('0x14')](_0xad7e('0x1a'),_0x15b65d['message'],_0x5de89e);_0x336d6d(_0x42f591[_0xad7e('0x14')](0x1f4,_0x15b65d[_0xad7e('0x16')]));});});};exports[_0xad7e('0x23')]=function(_0x8bdbb7){return new Promise(function(_0x54e83e,_0x4800f2){return db['FaxInteraction'][_0xad7e('0x24')]({'where':_0x8bdbb7[_0xad7e('0x1e')]?_0x8bdbb7[_0xad7e('0x1e')][_0xad7e('0x20')]||null:null})[_0xad7e('0xf')](function(_0x479ffc){if(_0x479ffc){return _0x479ffc[_0xad7e('0x25')](_0x8bdbb7[_0xad7e('0x1d')][_0xad7e('0x26')],_[_0xad7e('0x27')](_0x8bdbb7[_0xad7e('0x1d')],[_0xad7e('0x26'),'id'])||{});}})[_0xad7e('0x28')](function(_0x47a623){logger[_0xad7e('0x17')]('AddTags',_0x8bdbb7);logger[_0xad7e('0x12')](_0xad7e('0x29'),_0x8bdbb7,JSON[_0xad7e('0x22')](_0x47a623));_0x54e83e(_0x47a623);})[_0xad7e('0x19')](function(_0x3a040f){logger[_0xad7e('0x14')](_0xad7e('0x29'),_0x3a040f['message'],_0x8bdbb7);_0x4800f2(_this[_0xad7e('0x14')](0x1f4,_0x3a040f['message']));});});}; \ No newline at end of file +var _0x91af=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','FaxInteraction','update','body','options','raw','where','limit','UpdateFaxInteraction','find','addTags','ids','omit','spread','AddTags','stringify','lodash','util','bluebird','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then'];(function(_0x412d81,_0x3f7458){var _0x3e45cd=function(_0x4691c0){while(--_0x4691c0){_0x412d81['push'](_0x412d81['shift']());}};_0x3e45cd(++_0x3f7458);}(_0x91af,0xb4));var _0xf91a=function(_0x4bfc25,_0x1ceda5){_0x4bfc25=_0x4bfc25-0x0;var _0x1ae98d=_0x91af[_0x4bfc25];return _0x1ae98d;};'use strict';var _=require(_0xf91a('0x0'));var util=require(_0xf91a('0x1'));var moment=require('moment');var BPromise=require(_0xf91a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf91a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf91a('0x4'));var config=require('../../config/environment');var jayson=require(_0xf91a('0x5'));var client=jayson[_0xf91a('0x6')][_0xf91a('0x7')]({'port':0x232a});config[_0xf91a('0x8')]=_[_0xf91a('0x9')](config[_0xf91a('0x8')],{'host':_0xf91a('0xa'),'port':0x18eb});var socket=require(_0xf91a('0xb'))(new Redis(config[_0xf91a('0x8')]));require(_0xf91a('0xc'))[_0xf91a('0xd')](socket);function respondWithRpcPromise(_0x5ae368,_0x73bb4a,_0x5c765e){return new BPromise(function(_0x3c1c84,_0x3a85e9){return client['request'](_0x5ae368,_0x5c765e)[_0xf91a('0xe')](function(_0x112166){logger[_0xf91a('0xf')](_0xf91a('0x10'),_0x73bb4a,_0xf91a('0x11'));logger[_0xf91a('0x12')](_0xf91a('0x13'),_0x73bb4a,_0xf91a('0x11'),JSON['stringify'](_0x112166));if(_0x112166[_0xf91a('0x14')]){if(_0x112166[_0xf91a('0x14')][_0xf91a('0x15')]===0x1f4){logger[_0xf91a('0x14')](_0xf91a('0x10'),_0x73bb4a,_0x112166[_0xf91a('0x14')][_0xf91a('0x16')]);return _0x3a85e9(_0x112166['error'][_0xf91a('0x16')]);}logger[_0xf91a('0x14')](_0xf91a('0x10'),_0x73bb4a,_0x112166[_0xf91a('0x14')][_0xf91a('0x16')]);return _0x3c1c84(_0x112166[_0xf91a('0x14')][_0xf91a('0x16')]);}else{logger['info'](_0xf91a('0x10'),_0x73bb4a,_0xf91a('0x11'));_0x3c1c84(_0x112166['result']['message']);}})[_0xf91a('0x17')](function(_0x1c7f80){logger['error'](_0xf91a('0x10'),_0x73bb4a,_0x1c7f80);_0x3a85e9(_0x1c7f80);});});}exports['UpdateFaxInteraction']=function(_0x32681c){var _0x5342e5=this;return new Promise(function(_0x335def,_0x41111c){return db[_0xf91a('0x18')][_0xf91a('0x19')](_0x32681c[_0xf91a('0x1a')],{'raw':_0x32681c['options']?_0x32681c[_0xf91a('0x1b')][_0xf91a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32681c[_0xf91a('0x1b')]?_0x32681c[_0xf91a('0x1b')][_0xf91a('0x1d')]||null:null,'attributes':_0x32681c[_0xf91a('0x1b')]?_0x32681c[_0xf91a('0x1b')]['attributes']||null:null,'limit':_0x32681c['options']?_0x32681c['options'][_0xf91a('0x1e')]||null:null})['then'](function(_0x55f54d){logger[_0xf91a('0xf')](_0xf91a('0x1f'),_0x32681c);logger['debug'](_0xf91a('0x1f'),_0x32681c,JSON['stringify'](_0x55f54d));_0x335def(_0x55f54d);})[_0xf91a('0x17')](function(_0xbc3e){logger['error'](_0xf91a('0x1f'),_0xbc3e[_0xf91a('0x16')],_0x32681c);_0x41111c(_0x5342e5[_0xf91a('0x14')](0x1f4,_0xbc3e[_0xf91a('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x45909b){return new Promise(function(_0x1ef52d,_0x82c381){return db['FaxInteraction'][_0xf91a('0x20')]({'where':_0x45909b[_0xf91a('0x1b')]?_0x45909b[_0xf91a('0x1b')]['where']||null:null})[_0xf91a('0xe')](function(_0x1e9869){if(_0x1e9869){return _0x1e9869[_0xf91a('0x21')](_0x45909b[_0xf91a('0x1a')][_0xf91a('0x22')],_[_0xf91a('0x23')](_0x45909b[_0xf91a('0x1a')],['ids','id'])||{});}})[_0xf91a('0x24')](function(_0x576c03){logger[_0xf91a('0xf')]('AddTags',_0x45909b);logger[_0xf91a('0x12')](_0xf91a('0x25'),_0x45909b,JSON[_0xf91a('0x26')](_0x576c03));_0x1ef52d(_0x576c03);})[_0xf91a('0x17')](function(_0x47e6c3){logger[_0xf91a('0x14')](_0xf91a('0x25'),_0x47e6c3['message'],_0x45909b);_0x82c381(_this[_0xf91a('0x14')](0x1f4,_0x47e6c3[_0xf91a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5dc8904..f61e18e 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 _0x5afc=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x150aa7,_0x2d811f){var _0x20f4c3=function(_0x4ef83f){while(--_0x4ef83f){_0x150aa7['push'](_0x150aa7['shift']());}};_0x20f4c3(++_0x2d811f);}(_0x5afc,0xf3));var _0xc5af=function(_0x4dcdcb,_0x48ed21){_0x4dcdcb=_0x4dcdcb-0x0;var _0x2f21ac=_0x5afc[_0x4dcdcb];return _0x2f21ac;};'use strict';var FaxInteractionEvents=require(_0xc5af('0x0'));var events=['save',_0xc5af('0x1'),'update'];function createListener(_0x313639,_0x2c3090){return function(_0x592666){_0x2c3090[_0xc5af('0x2')](_0x313639,_0x592666);};}function removeListener(_0x11aa9d,_0x199ae2){return function(){FaxInteractionEvents[_0xc5af('0x3')](_0x11aa9d,_0x199ae2);};}exports[_0xc5af('0x4')]=function(_0x376e6e){for(var _0x4b9e7f=0x0,_0x487568=events[_0xc5af('0x5')];_0x4b9e7f<_0x487568;_0x4b9e7f++){var _0x54e97f=events[_0x4b9e7f];var _0x4906b7=createListener(_0xc5af('0x6')+_0x54e97f,_0x376e6e);FaxInteractionEvents['on'](_0x54e97f,_0x4906b7);}}; \ No newline at end of file +var _0xe958=['save','remove','update','emit','register','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe958,0x1c2));var _0x8e95=function(_0x46ff2f,_0x3487e9){_0x46ff2f=_0x46ff2f-0x0;var _0x71ed46=_0xe958[_0x46ff2f];return _0x71ed46;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x8e95('0x0'),_0x8e95('0x1'),_0x8e95('0x2')];function createListener(_0x4d902e,_0x52fe46){return function(_0x2580fa){_0x52fe46[_0x8e95('0x3')](_0x4d902e,_0x2580fa);};}function removeListener(_0x5e1c81,_0x478c7d){return function(){FaxInteractionEvents['removeListener'](_0x5e1c81,_0x478c7d);};}exports[_0x8e95('0x4')]=function(_0x47d97b){for(var _0x2f68aa=0x0,_0x2bf850=events[_0x8e95('0x5')];_0x2f68aa<_0x2bf850;_0x2f68aa++){var _0x2bad1e=events[_0x2f68aa];var _0x1039cd=createListener('faxInteraction:'+_0x2bad1e,_0x47d97b);FaxInteractionEvents['on'](_0x2bad1e,_0x1039cd);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 4936722..2331a6e 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 _0xd2c3=['removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','faxinteraction:update','delete','fax','faxinteraction:destroy','destroy'];(function(_0x3848ff,_0x2fe360){var _0x55991a=function(_0x6aea3f){while(--_0x6aea3f){_0x3848ff['push'](_0x3848ff['shift']());}};_0x55991a(++_0x2fe360);}(_0xd2c3,0x1c2));var _0x3d2c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd2c3[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x3d2c('0x0'));var util=require(_0x3d2c('0x1'));var path=require(_0x3d2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d2c('0x3'));var router=express[_0x3d2c('0x4')]();var fs_extra=require(_0x3d2c('0x5'));var auth=require(_0x3d2c('0x6'));var interaction=require(_0x3d2c('0x7'));var config=require('../../config/environment');var controller=require(_0x3d2c('0x8'));router[_0x3d2c('0x9')]('/',auth[_0x3d2c('0xa')](),controller[_0x3d2c('0xb')]);router[_0x3d2c('0x9')](_0x3d2c('0xc'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0xd')]);router[_0x3d2c('0x9')](_0x3d2c('0xe'),auth['isAuthenticated'](),controller[_0x3d2c('0xf')]);router[_0x3d2c('0x9')](_0x3d2c('0x10'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x11')]);router[_0x3d2c('0x9')](_0x3d2c('0x12'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x13')]);router[_0x3d2c('0x14')]('/',auth[_0x3d2c('0xa')](),controller['create']);router[_0x3d2c('0x14')](_0x3d2c('0x10'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x15')]);router[_0x3d2c('0x14')](_0x3d2c('0x16'),auth[_0x3d2c('0xa')](),interaction[_0x3d2c('0x17')]('fax',_0x3d2c('0x18')),controller['addTags']);router['put'](_0x3d2c('0xe'),auth[_0x3d2c('0xa')](),interaction[_0x3d2c('0x17')]('fax',_0x3d2c('0x19')),controller['update']);router[_0x3d2c('0x1a')](_0x3d2c('0xe'),auth[_0x3d2c('0xa')](),interaction[_0x3d2c('0x17')](_0x3d2c('0x1b'),_0x3d2c('0x1c')),controller[_0x3d2c('0x1d')]);router[_0x3d2c('0x1a')](_0x3d2c('0x16'),auth[_0x3d2c('0xa')](),controller[_0x3d2c('0x1e')]);module[_0x3d2c('0x1f')]=router; \ No newline at end of file +var _0xb234=['../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','faxinteraction:addtags','put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router'];(function(_0x19da85,_0x1b92eb){var _0x38df9f=function(_0x1fea33){while(--_0x1fea33){_0x19da85['push'](_0x19da85['shift']());}};_0x38df9f(++_0x1b92eb);}(_0xb234,0x150));var _0x4b23=function(_0x23be1a,_0x53c486){_0x23be1a=_0x23be1a-0x0;var _0xc79268=_0xb234[_0x23be1a];return _0xc79268;};'use strict';var multer=require(_0x4b23('0x0'));var util=require(_0x4b23('0x1'));var path=require(_0x4b23('0x2'));var timeout=require(_0x4b23('0x3'));var express=require('express');var router=express[_0x4b23('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4b23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4b23('0x6'));var controller=require(_0x4b23('0x7'));router[_0x4b23('0x8')]('/',auth[_0x4b23('0x9')](),controller['index']);router[_0x4b23('0x8')](_0x4b23('0xa'),auth[_0x4b23('0x9')](),controller[_0x4b23('0xb')]);router[_0x4b23('0x8')](_0x4b23('0xc'),auth[_0x4b23('0x9')](),controller['show']);router[_0x4b23('0x8')](_0x4b23('0xd'),auth['isAuthenticated'](),controller[_0x4b23('0xe')]);router['get'](_0x4b23('0xf'),auth['isAuthenticated'](),controller[_0x4b23('0x10')]);router[_0x4b23('0x11')]('/',auth['isAuthenticated'](),controller[_0x4b23('0x12')]);router['post'](_0x4b23('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0x4b23('0x11')](_0x4b23('0x13'),auth[_0x4b23('0x9')](),interaction[_0x4b23('0x14')]('fax',_0x4b23('0x15')),controller['addTags']);router[_0x4b23('0x16')](_0x4b23('0xc'),auth[_0x4b23('0x9')](),interaction[_0x4b23('0x14')]('fax',_0x4b23('0x17')),controller[_0x4b23('0x18')]);router[_0x4b23('0x19')]('/:id',auth[_0x4b23('0x9')](),interaction[_0x4b23('0x14')](_0x4b23('0x1a'),_0x4b23('0x1b')),controller[_0x4b23('0x1c')]);router['delete'](_0x4b23('0x13'),auth[_0x4b23('0x9')](),controller[_0x4b23('0x1d')]);module[_0x4b23('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d388f30..08a6616 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 _0xbec5=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x230457,_0x17efa8){var _0x3118d8=function(_0x2fa43d){while(--_0x2fa43d){_0x230457['push'](_0x230457['shift']());}};_0x3118d8(++_0x17efa8);}(_0xbec5,0xe5));var _0x5bec=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0xbec5[_0x550e29];return _0x3515b6;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5bec('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5bec('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5bec('0x4')]('in',_0x5bec('0x5')),'defaultValue':_0x5bec('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5bec('0x6')]}}; \ No newline at end of file +var _0xf323=['medium','ENUM','out','DATE','TEXT'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf323,0x1c6));var _0x3f32=function(_0x4a443d,_0x26a958){_0x4a443d=_0x4a443d-0x0;var _0x3b392f=_0xf323[_0x4a443d];return _0x3b392f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3f32('0x0')](_0x3f32('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3f32('0x2')]('in',_0x3f32('0x3')),'defaultValue':_0x3f32('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x3f32('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x3f32('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7107ac9..cd05421 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 _0x91c6=['name','FaxMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','rawAttributes','catch','find','params','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteractionId','isNil','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','fullname','motionChannel','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','server','files','attachments','join','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','end','stack'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x91c6,0x17e));var _0x691c=function(_0x3b6895,_0x3f604a){_0x3b6895=_0x3b6895-0x0;var _0xb17f55=_0x91c6[_0x3b6895];return _0xb17f55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x691c('0x0'));var zipdir=require(_0x691c('0x1'));var jsonpatch=require(_0x691c('0x2'));var rp=require(_0x691c('0x3'));var moment=require(_0x691c('0x4'));var BPromise=require(_0x691c('0x5'));var Mustache=require(_0x691c('0x6'));var util=require(_0x691c('0x7'));var path=require(_0x691c('0x8'));var sox=require(_0x691c('0x9'));var csv=require(_0x691c('0xa'));var ejs=require(_0x691c('0xb'));var fs=require('fs');var fs_extra=require(_0x691c('0xc'));var _=require(_0x691c('0xd'));var squel=require(_0x691c('0xe'));var crypto=require(_0x691c('0xf'));var jsforce=require(_0x691c('0x10'));var deskjs=require(_0x691c('0x11'));var toCsv=require(_0x691c('0xa'));var querystring=require(_0x691c('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x691c('0x13'));var qs=require(_0x691c('0x14'));var as=require(_0x691c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x691c('0x16'))(_0x691c('0x17'));var utils=require(_0x691c('0x18'));var config=require(_0x691c('0x19'));var licenseUtil=require(_0x691c('0x1a'));var db=require(_0x691c('0x1b'))['db'];config[_0x691c('0x1c')]=_[_0x691c('0x1d')](config['redis'],{'host':_0x691c('0x1e'),'port':0x18eb});var socket=require(_0x691c('0x1f'))(new Redis(config[_0x691c('0x1c')]));require('./faxMessage.socket')[_0x691c('0x20')](socket);var jayson=require(_0x691c('0x21'));var client=jayson[_0x691c('0x22')][_0x691c('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x691c('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3ff94c,_0x45b642,_0x1338a4,_0x119867){return new BPromise(function(_0x1db0fd,_0x50f2fe){var _0x53f409=_0x119867||client;return _0x53f409[_0x691c('0x24')](_0x3ff94c,_0x1338a4)[_0x691c('0x25')](function(_0x2ad1ff){logger[_0x691c('0x26')](_0x691c('0x27'),_0x45b642,'request\x20sent');logger[_0x691c('0x28')](_0x691c('0x29'),_0x45b642,'request\x20sent',JSON[_0x691c('0x2a')](_0x2ad1ff));if(_0x2ad1ff['error']){if(_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2c')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x45b642,_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);return _0x50f2fe(_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x45b642,_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);return _0x1db0fd(_0x2ad1ff[_0x691c('0x2b')][_0x691c('0x2d')]);}else{logger['info'](_0x691c('0x27'),_0x45b642,'request\x20sent');_0x1db0fd(_0x2ad1ff[_0x691c('0x2e')]['message']);}})['catch'](function(_0x1bf6ac){logger[_0x691c('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x45b642,_0x1bf6ac);_0x50f2fe(_0x1bf6ac);});});}function respondWithStatusCode(_0x5ce810,_0x1b6675){_0x1b6675=_0x1b6675||0xcc;return function(_0x37e342){if(_0x37e342){return _0x5ce810[_0x691c('0x2f')](_0x1b6675);}return _0x5ce810[_0x691c('0x30')](_0x1b6675)['end']();};}function respondWithResult(_0x1cfd97,_0x11dd7e){_0x11dd7e=_0x11dd7e||0xc8;return function(_0x232500){if(_0x232500){return _0x1cfd97['status'](_0x11dd7e)[_0x691c('0x31')](_0x232500);}};}function respondWithFilteredResult(_0x1ba65b,_0x1e698b){return function(_0x19018c){if(_0x19018c){var _0x1efd2a=typeof _0x1e698b[_0x691c('0x32')]===_0x691c('0x33')&&typeof _0x1e698b['limit']===_0x691c('0x33');var _0x1df28b=_0x19018c[_0x691c('0x34')];var _0x48aba5=_0x1efd2a?0x0:_0x1e698b['offset'];var _0x4fc347=_0x1efd2a?_0x19018c[_0x691c('0x34')]:_0x1e698b[_0x691c('0x32')]+_0x1e698b[_0x691c('0x35')];var _0x5e314c;if(_0x4fc347>=_0x1df28b){_0x4fc347=_0x1df28b;_0x5e314c=0xc8;}else{_0x5e314c=0xce;}_0x1ba65b[_0x691c('0x30')](_0x5e314c);return _0x1ba65b[_0x691c('0x36')]('Content-Range',_0x48aba5+'-'+_0x4fc347+'/'+_0x1df28b)[_0x691c('0x31')](_0x19018c);}return null;};}function patchUpdates(_0x31782a){return function(_0x437211){try{jsonpatch[_0x691c('0x37')](_0x437211,_0x31782a,!![]);}catch(_0x2921a4){return BPromise[_0x691c('0x38')](_0x2921a4);}return _0x437211[_0x691c('0x39')]();};}function saveUpdates(_0x45c429,_0x50b683){return function(_0x5f2453){if(_0x5f2453){return _0x5f2453[_0x691c('0x3a')](_0x45c429)[_0x691c('0x25')](function(_0x1a65c8){return _0x1a65c8;});}return null;};}function removeEntity(_0x146f1a,_0x56ac75){return function(_0x3878eb){if(_0x3878eb){return _0x3878eb[_0x691c('0x3b')]()['then'](function(){_0x146f1a[_0x691c('0x30')](0xcc)[_0x691c('0x3c')]();});}};}function handleEntityNotFound(_0x53c925,_0x4b99c5){return function(_0x2f77d1){if(!_0x2f77d1){_0x53c925[_0x691c('0x2f')](0x194);}return _0x2f77d1;};}function handleError(_0x579947,_0x40c87d){_0x40c87d=_0x40c87d||0x1f4;return function(_0x134795){logger['error'](_0x134795[_0x691c('0x3d')]);if(_0x134795['name']){delete _0x134795[_0x691c('0x3e')];}_0x579947[_0x691c('0x30')](_0x40c87d)['send'](_0x134795);};}exports['index']=function(_0x2bead9,_0x23b651){var _0x5b5a4b={},_0x3d45e7={},_0x3bda0f={'count':0x0,'rows':[]};var _0x461bdc=_['map'](db[_0x691c('0x3f')]['rawAttributes'],function(_0x21b141){return{'name':_0x21b141[_0x691c('0x40')],'type':_0x21b141[_0x691c('0x41')][_0x691c('0x42')]};});_0x3d45e7[_0x691c('0x43')]=_['map'](_0x461bdc,_0x691c('0x3e'));_0x3d45e7[_0x691c('0x44')]=_['keys'](_0x2bead9[_0x691c('0x44')]);_0x3d45e7[_0x691c('0x45')]=_[_0x691c('0x46')](_0x3d45e7[_0x691c('0x43')],_0x3d45e7['query']);_0x5b5a4b[_0x691c('0x47')]=_['intersection'](_0x3d45e7[_0x691c('0x43')],qs[_0x691c('0x48')](_0x2bead9[_0x691c('0x44')][_0x691c('0x48')]));_0x5b5a4b[_0x691c('0x47')]=_0x5b5a4b[_0x691c('0x47')][_0x691c('0x49')]?_0x5b5a4b[_0x691c('0x47')]:_0x3d45e7[_0x691c('0x43')];if(!_0x2bead9[_0x691c('0x44')][_0x691c('0x4a')](_0x691c('0x4b'))){_0x5b5a4b[_0x691c('0x35')]=qs[_0x691c('0x35')](_0x2bead9['query']['limit']);_0x5b5a4b['offset']=qs['offset'](_0x2bead9['query'][_0x691c('0x32')]);}_0x5b5a4b[_0x691c('0x4c')]=qs['sort'](_0x2bead9[_0x691c('0x44')][_0x691c('0x4d')]);_0x5b5a4b[_0x691c('0x4e')]=qs[_0x691c('0x45')](_['pick'](_0x2bead9['query'],_0x3d45e7['filters']),_0x461bdc);if(_0x2bead9[_0x691c('0x44')][_0x691c('0x4f')]){_0x5b5a4b['where']=_[_0x691c('0x50')](_0x5b5a4b[_0x691c('0x4e')],{'$or':_[_0x691c('0x51')](_0x461bdc,function(_0xb36f5d){if(_0xb36f5d[_0x691c('0x41')]!==_0x691c('0x52')){var _0x409d0b={};_0x409d0b[_0xb36f5d['name']]={'$like':'%'+_0x2bead9['query'][_0x691c('0x4f')]+'%'};return _0x409d0b;}})});}_0x5b5a4b=_[_0x691c('0x50')]({},_0x5b5a4b,_0x2bead9[_0x691c('0x53')]);var _0x1aa4f8={'where':_0x5b5a4b['where']};return db[_0x691c('0x3f')]['count'](_0x1aa4f8)[_0x691c('0x25')](function(_0x3e27d3){_0x3bda0f[_0x691c('0x34')]=_0x3e27d3;if(_0x2bead9[_0x691c('0x44')][_0x691c('0x54')]){_0x5b5a4b[_0x691c('0x55')]=[{'all':!![]}];}return db[_0x691c('0x3f')][_0x691c('0x56')](_0x5b5a4b);})[_0x691c('0x25')](function(_0x56dc83){_0x3bda0f[_0x691c('0x57')]=_0x56dc83;return _0x3bda0f;})[_0x691c('0x25')](respondWithFilteredResult(_0x23b651,_0x5b5a4b))['catch'](handleError(_0x23b651,null));};exports[_0x691c('0x58')]=function(_0x1d28fb,_0x316801){var _0x505038={'raw':!![],'where':{'id':_0x1d28fb['params']['id']}},_0x54143f={};_0x54143f[_0x691c('0x43')]=_[_0x691c('0x59')](db[_0x691c('0x3f')][_0x691c('0x5a')]);_0x54143f[_0x691c('0x44')]=_[_0x691c('0x59')](_0x1d28fb[_0x691c('0x44')]);_0x54143f[_0x691c('0x45')]=_['intersection'](_0x54143f[_0x691c('0x43')],_0x54143f[_0x691c('0x44')]);_0x505038[_0x691c('0x47')]=_[_0x691c('0x46')](_0x54143f[_0x691c('0x43')],qs[_0x691c('0x48')](_0x1d28fb['query'][_0x691c('0x48')]));_0x505038[_0x691c('0x47')]=_0x505038['attributes'][_0x691c('0x49')]?_0x505038[_0x691c('0x47')]:_0x54143f[_0x691c('0x43')];if(_0x1d28fb[_0x691c('0x44')][_0x691c('0x54')]){_0x505038['include']=[{'all':!![]}];}_0x505038=_[_0x691c('0x50')]({},_0x505038,_0x1d28fb[_0x691c('0x53')]);return db[_0x691c('0x3f')]['find'](_0x505038)['then'](handleEntityNotFound(_0x316801,null))[_0x691c('0x25')](respondWithResult(_0x316801,null))[_0x691c('0x5b')](handleError(_0x316801,null));};exports[_0x691c('0x3a')]=function(_0x37a13d,_0x3cd96b){if(_0x37a13d['body']['id']){delete _0x37a13d['body']['id'];}return db[_0x691c('0x3f')][_0x691c('0x5c')]({'where':{'id':_0x37a13d[_0x691c('0x5d')]['id']}})[_0x691c('0x25')](handleEntityNotFound(_0x3cd96b,null))['then'](saveUpdates(_0x37a13d[_0x691c('0x5e')],null))[_0x691c('0x25')](respondWithResult(_0x3cd96b,null))['catch'](handleError(_0x3cd96b,null));};exports[_0x691c('0x3b')]=function(_0x465375,_0x5ca99a){return db[_0x691c('0x3f')][_0x691c('0x5c')]({'where':{'id':_0x465375['params']['id']}})[_0x691c('0x25')](handleEntityNotFound(_0x5ca99a,null))[_0x691c('0x25')](removeEntity(_0x5ca99a,null))[_0x691c('0x5b')](handleError(_0x5ca99a,null));};exports[_0x691c('0x5f')]=function(_0x111155,_0x1c2a75){return db[_0x691c('0x3f')]['describe']()['then'](respondWithResult(_0x1c2a75,null))['catch'](handleError(_0x1c2a75,null));};var interaction_log=require(_0x691c('0x16'))(_0x691c('0x60'));exports[_0x691c('0x61')]=function(_0x4f810f,_0x311046,_0x5ea653){var _0x3ffe79={'agent':{},'channel':_0x691c('0x62')};if(_0x4f810f[_0x691c('0x5e')]['id']){delete _0x4f810f['body']['id'];}_0x4f810f[_0x691c('0x5e')][_0x691c('0x63')]=!![];_0x4f810f['body'][_0x691c('0x64')]=moment()['format'](_0x691c('0x65'));_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')]=_0x4f810f[_0x691c('0x5e')]['UserId']||_0x4f810f['user']['id'];_0x3ffe79['agent']['id']=_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')];return db[_0x691c('0x3f')]['find']({'where':{'id':_0x4f810f['params']['id'],'UserId':null}})[_0x691c('0x25')](handleEntityNotFound(_0x311046,null))[_0x691c('0x25')](saveUpdates(_0x4f810f['body'],null))[_0x691c('0x25')](function(_0xd0be55){if(_0xd0be55){_0x3ffe79[_0x691c('0x2d')]=_0xd0be55[_0x691c('0x67')]({'plain':!![]});return db['FaxInteraction'][_0x691c('0x5c')]({'where':{'id':_0xd0be55[_0x691c('0x68')]}});}return null;})[_0x691c('0x25')](handleEntityNotFound(_0x311046,null))['then'](function(_0x562283){if(_0x562283){return _0x562283[_0x691c('0x3a')]({'UserId':_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')],'read1stAt':_[_0x691c('0x69')](_0x562283['read1stAt'])?moment()[_0x691c('0x6a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x691c('0x25')](function(_0x4685f2){if(_0x4685f2){_0x3ffe79[_0x691c('0x6b')]=_0x4685f2['get']({'plain':!![]});interaction_log[_0x691c('0x26')](_0x691c('0x6c'),_0x4f810f[_0x691c('0x6d')]['id'],_0x4f810f[_0x691c('0x6d')][_0x691c('0x3e')],_0x4f810f[_0x691c('0x6d')]['role'],_0x3ffe79[_0x691c('0x6b')]['id'],_0x4f810f['body']?JSON[_0x691c('0x2a')](_0x4f810f[_0x691c('0x5e')]):'null');return respondWithRpcPromise(_0x691c('0x6e'),_0x691c('0x6f'),_0x3ffe79);}return null;})['then'](function(_0x133530){var _0x49578a=_0x691c('0x70')+_0x133530['message']['ContactId'];return db[_0x691c('0x71')][_0x691c('0x44')](_0x49578a,{'type':db[_0x691c('0x72')][_0x691c('0x73')][_0x691c('0x74')],'raw':!![]})[_0x691c('0x25')](function(_0x4dbbc5){return _0x4dbbc5;});})['then'](function(_0x29a5c5){if(_0x29a5c5){_0x3ffe79['message'][_0x691c('0x75')]=_0x29a5c5[0x0];if(!_0x4f810f[_0x691c('0x5e')][_0x691c('0x66')])return;return db[_0x691c('0x76')][_0x691c('0x5c')]({'where':{'id':_0x4f810f['body'][_0x691c('0x66')],'role':'agent'},'attributes':['id',_0x691c('0x3e'),'fullname','email',_0x691c('0x77')],'raw':!![]});}return null;})[_0x691c('0x25')](function(_0x264d46){if(!_0x264d46)return null;_0x3ffe79[_0x691c('0x2d')]['agent']=_0x264d46;return _0x3ffe79;})[_0x691c('0x25')](function(_0x5eb89a){if(_0x5eb89a){if(_0x4f810f[_0x691c('0x5e')][_0x691c('0x78')]){_0x3ffe79[_0x691c('0x2d')][_0x691c('0x79')]=util[_0x691c('0x6a')](_0x691c('0x7a'),_0x4f810f[_0x691c('0x6d')][_0x691c('0x3e')]);_0x3ffe79[_0x691c('0x2d')]['channel']=_0x3ffe79['channel'];_0x3ffe79[_0x691c('0x2d')]['motionChannel']=_0x3ffe79[_0x691c('0x7b')];_0x3ffe79[_0x691c('0x2d')]['event']=_0x691c('0x61');return respondWithRpcPromise(_0x691c('0x7c'),_0x691c('0x7c'),{'event':_0x691c('0x7d'),'message':_0x3ffe79[_0x691c('0x2d')]},client9002)[_0x691c('0x25')](function(){return _0x3ffe79;});}return _0x3ffe79;}return null;})[_0x691c('0x25')](respondWithResult(_0x311046,null))[_0x691c('0x5b')](handleError(_0x311046,null));};var interaction_log=require(_0x691c('0x16'))(_0x691c('0x60'));exports[_0x691c('0x38')]=function(_0x289eef,_0x13756f,_0x296ac0){var _0x4a0178={'agent':{},'channel':_0x691c('0x62')};if(_0x289eef['body']['id']){delete _0x289eef[_0x691c('0x5e')]['id'];}_0x289eef[_0x691c('0x5e')][_0x691c('0x66')]=_0x289eef[_0x691c('0x5e')]['UserId']||_0x289eef['user']['id'];_0x4a0178[_0x691c('0x7e')]['id']=_0x289eef[_0x691c('0x5e')]['UserId'];return db[_0x691c('0x3f')][_0x691c('0x5c')]({'where':{'id':_0x289eef['params']['id'],'UserId':null}})[_0x691c('0x25')](handleEntityNotFound(_0x13756f,null))['then'](function(_0x39024d){if(_0x39024d){_0x4a0178[_0x691c('0x2d')]=_0x39024d[_0x691c('0x67')]({'plain':!![]});return db[_0x691c('0x7f')]['find']({'where':{'id':_0x39024d[_0x691c('0x68')]}});}return null;})[_0x691c('0x25')](handleEntityNotFound(_0x13756f,null))['then'](function(_0x361fe6){if(_0x361fe6){_0x4a0178[_0x691c('0x6b')]=_0x361fe6[_0x691c('0x67')]({'plain':!![]});interaction_log[_0x691c('0x26')](_0x691c('0x80'),_0x289eef['user']['id'],_0x289eef[_0x691c('0x6d')][_0x691c('0x3e')],_0x289eef['user'][_0x691c('0x81')],_0x4a0178[_0x691c('0x6b')]['id'],_0x289eef[_0x691c('0x5e')]?JSON[_0x691c('0x2a')](_0x289eef[_0x691c('0x5e')]):_0x691c('0x82'));return respondWithRpcPromise('RejectMessage',_0x691c('0x83'),_0x4a0178);}return null;})[_0x691c('0x25')](function(_0x2d3191){var _0x59ba65='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d3191[_0x691c('0x2d')][_0x691c('0x84')];return db[_0x691c('0x71')][_0x691c('0x44')](_0x59ba65,{'type':db[_0x691c('0x72')][_0x691c('0x73')][_0x691c('0x74')],'raw':!![]})['then'](function(_0x30b2b8){return _0x30b2b8;});})[_0x691c('0x25')](function(_0x45fcfb){if(_0x45fcfb){_0x4a0178['message'][_0x691c('0x75')]=_0x45fcfb[0x0];if(!_0x289eef[_0x691c('0x5e')][_0x691c('0x66')])return;return db[_0x691c('0x76')][_0x691c('0x5c')]({'where':{'id':_0x289eef[_0x691c('0x5e')][_0x691c('0x66')],'role':'agent'},'attributes':['id',_0x691c('0x3e'),_0x691c('0x85'),'email',_0x691c('0x77')],'raw':!![]});}return null;})[_0x691c('0x25')](function(_0x548a5f){if(!_0x548a5f)return null;_0x4a0178['message'][_0x691c('0x7e')]=_0x548a5f;return _0x4a0178;})[_0x691c('0x25')](function(_0x2a8713){if(_0x2a8713){_0x2a8713[_0x691c('0x2d')][_0x691c('0x79')]=util[_0x691c('0x6a')](_0x691c('0x7a'),_0x289eef[_0x691c('0x6d')]['name']);_0x2a8713[_0x691c('0x2d')]['channel']=_0x4a0178[_0x691c('0x7b')];_0x2a8713[_0x691c('0x2d')][_0x691c('0x86')]=_0x4a0178[_0x691c('0x7b')];_0x2a8713[_0x691c('0x2d')]['event']=_0x691c('0x38');respondWithRpcPromise(_0x691c('0x7c'),_0x691c('0x7c'),{'event':'rejectmessage','message':_0x2a8713[_0x691c('0x2d')]},client9002);return _0x4a0178;}return null;})['then'](respondWithResult(_0x13756f,null))[_0x691c('0x5b')](handleError(_0x13756f,null));};exports[_0x691c('0x87')]=function(_0x103830,_0x550eab){var _0x3348ef;return db[_0x691c('0x3f')][_0x691c('0x87')](_0x103830[_0x691c('0x5e')],{})[_0x691c('0x25')](function(_0x29e512){_0x3348ef=_0x29e512;return db[_0x691c('0x88')][_0x691c('0x89')]({'where':{'id':_0x3348ef['ContactId']}});})[_0x691c('0x25')](function(_0x1ca1d0){if(_[_0x691c('0x69')](_0x1ca1d0)){return;}else{_0x3348ef[_0x691c('0x62')]=_0x1ca1d0[_0x691c('0x62')];return db[_0x691c('0x8a')][_0x691c('0x89')]({'where':{'id':_0x3348ef[_0x691c('0x8b')]}});}})[_0x691c('0x25')](function(_0x112a36){return respondWithRpcPromise(_0x691c('0x8c'),'SendFax',{'FaxAccountId':_[_0x691c('0x69')](_0x103830[_0x691c('0x5e')])?undefined:_0x103830['body']['FaxAccountId'],'path':_[_0x691c('0x69')](_0x112a36)?undefined:util[_0x691c('0x6a')](_0x691c('0x8d'),_0x112a36['basename']),'fax':_[_0x691c('0x69')](_0x3348ef['fax'])?undefined:_0x3348ef[_0x691c('0x62')],'AttachmentId':_0x3348ef['AttachmentId']},client9002);})[_0x691c('0x25')](respondWithResult(_0x550eab,0xc9))['catch'](handleError(_0x550eab,null));};exports[_0x691c('0x8e')]=function(_0x40989a,_0x223064){var _0x16ebcc=path['join'](config['root'],_0x691c('0x8f'),_0x691c('0x90'),_0x691c('0x91'));return db[_0x691c('0x3f')]['find']({'where':{'id':_0x40989a[_0x691c('0x5d')]['id']},'include':[{'model':db[_0x691c('0x8a')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x223064,null))[_0x691c('0x25')](function(_0x399a3b){if(_0x399a3b){return _0x223064[_0x691c('0x8e')](path[_0x691c('0x92')](_0x16ebcc,_0x399a3b[_0x691c('0x8a')][_0x691c('0x93')]));}})['catch'](handleError(_0x223064,null));}; \ No newline at end of file +var _0xd8a7=['offset','undefined','limit','count','set','save','update','destroy','end','stack','name','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','keys','fields','length','find','body','params','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','fax-interactions','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','sequelize','Sequelize','interface','event','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','attachments','join','rimraf','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json'];(function(_0x450e3f,_0x37e15f){var _0x494e6d=function(_0x1165bb){while(--_0x1165bb){_0x450e3f['push'](_0x450e3f['shift']());}};_0x494e6d(++_0x37e15f);}(_0xd8a7,0xf0));var _0x7d8a=function(_0x5d7621,_0x513e5c){_0x5d7621=_0x5d7621-0x0;var _0x33f2ca=_0xd8a7[_0x5d7621];return _0x33f2ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d8a('0x0'));var zipdir=require(_0x7d8a('0x1'));var jsonpatch=require(_0x7d8a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d8a('0x3'));var Mustache=require('mustache');var util=require(_0x7d8a('0x4'));var path=require(_0x7d8a('0x5'));var sox=require(_0x7d8a('0x6'));var csv=require(_0x7d8a('0x7'));var ejs=require(_0x7d8a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d8a('0x9'));var squel=require(_0x7d8a('0xa'));var crypto=require(_0x7d8a('0xb'));var jsforce=require(_0x7d8a('0xc'));var deskjs=require(_0x7d8a('0xd'));var toCsv=require(_0x7d8a('0x7'));var querystring=require(_0x7d8a('0xe'));var Papa=require(_0x7d8a('0xf'));var Redis=require(_0x7d8a('0x10'));var authService=require(_0x7d8a('0x11'));var qs=require(_0x7d8a('0x12'));var as=require(_0x7d8a('0x13'));var hardwareService=require(_0x7d8a('0x14'));var logger=require(_0x7d8a('0x15'))(_0x7d8a('0x16'));var utils=require(_0x7d8a('0x17'));var config=require(_0x7d8a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d8a('0x19'))['db'];config[_0x7d8a('0x1a')]=_['defaults'](config['redis'],{'host':_0x7d8a('0x1b'),'port':0x18eb});var socket=require(_0x7d8a('0x1c'))(new Redis(config[_0x7d8a('0x1a')]));require(_0x7d8a('0x1d'))[_0x7d8a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7d8a('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x7d8a('0x1f')][_0x7d8a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x21f910,_0x359d34,_0x1f99a4,_0x50b685){return new BPromise(function(_0x12307b,_0x36843c){var _0x5c1676=_0x50b685||client;return _0x5c1676['request'](_0x21f910,_0x1f99a4)[_0x7d8a('0x21')](function(_0x1b1190){logger[_0x7d8a('0x22')](_0x7d8a('0x23'),_0x359d34,_0x7d8a('0x24'));logger['debug'](_0x7d8a('0x25'),_0x359d34,'request\x20sent',JSON['stringify'](_0x1b1190));if(_0x1b1190[_0x7d8a('0x26')]){if(_0x1b1190[_0x7d8a('0x26')][_0x7d8a('0x27')]===0x1f4){logger[_0x7d8a('0x26')](_0x7d8a('0x23'),_0x359d34,_0x1b1190[_0x7d8a('0x26')][_0x7d8a('0x28')]);return _0x36843c(_0x1b1190['error'][_0x7d8a('0x28')]);}logger['error'](_0x7d8a('0x23'),_0x359d34,_0x1b1190[_0x7d8a('0x26')][_0x7d8a('0x28')]);return _0x12307b(_0x1b1190['error'][_0x7d8a('0x28')]);}else{logger[_0x7d8a('0x22')]('FaxMessage,\x20%s,\x20%s',_0x359d34,_0x7d8a('0x24'));_0x12307b(_0x1b1190[_0x7d8a('0x29')][_0x7d8a('0x28')]);}})[_0x7d8a('0x2a')](function(_0x556766){logger[_0x7d8a('0x26')](_0x7d8a('0x23'),_0x359d34,_0x556766);_0x36843c(_0x556766);});});}function respondWithStatusCode(_0x3cc0fa,_0x54ece9){_0x54ece9=_0x54ece9||0xcc;return function(_0x52cb51){if(_0x52cb51){return _0x3cc0fa[_0x7d8a('0x2b')](_0x54ece9);}return _0x3cc0fa['status'](_0x54ece9)['end']();};}function respondWithResult(_0x3639fc,_0x4ddd77){_0x4ddd77=_0x4ddd77||0xc8;return function(_0x4a5b7c){if(_0x4a5b7c){return _0x3639fc[_0x7d8a('0x2c')](_0x4ddd77)[_0x7d8a('0x2d')](_0x4a5b7c);}};}function respondWithFilteredResult(_0x158a91,_0x2f680a){return function(_0x2dbe91){if(_0x2dbe91){var _0xdb327b=typeof _0x2f680a[_0x7d8a('0x2e')]===_0x7d8a('0x2f')&&typeof _0x2f680a[_0x7d8a('0x30')]==='undefined';var _0x6e981e=_0x2dbe91['count'];var _0x3b0269=_0xdb327b?0x0:_0x2f680a[_0x7d8a('0x2e')];var _0x93eb96=_0xdb327b?_0x2dbe91[_0x7d8a('0x31')]:_0x2f680a[_0x7d8a('0x2e')]+_0x2f680a[_0x7d8a('0x30')];var _0xab5445;if(_0x93eb96>=_0x6e981e){_0x93eb96=_0x6e981e;_0xab5445=0xc8;}else{_0xab5445=0xce;}_0x158a91[_0x7d8a('0x2c')](_0xab5445);return _0x158a91[_0x7d8a('0x32')]('Content-Range',_0x3b0269+'-'+_0x93eb96+'/'+_0x6e981e)[_0x7d8a('0x2d')](_0x2dbe91);}return null;};}function patchUpdates(_0x25fcbc){return function(_0x8da439){try{jsonpatch['apply'](_0x8da439,_0x25fcbc,!![]);}catch(_0x11e28f){return BPromise['reject'](_0x11e28f);}return _0x8da439[_0x7d8a('0x33')]();};}function saveUpdates(_0x383fd3,_0x275b23){return function(_0x5238b0){if(_0x5238b0){return _0x5238b0[_0x7d8a('0x34')](_0x383fd3)[_0x7d8a('0x21')](function(_0x5c8f4c){return _0x5c8f4c;});}return null;};}function removeEntity(_0x128c34,_0x49c3e7){return function(_0x11f242){if(_0x11f242){return _0x11f242[_0x7d8a('0x35')]()[_0x7d8a('0x21')](function(){_0x128c34['status'](0xcc)[_0x7d8a('0x36')]();});}};}function handleEntityNotFound(_0x56be76,_0x338ada){return function(_0x511f8f){if(!_0x511f8f){_0x56be76[_0x7d8a('0x2b')](0x194);}return _0x511f8f;};}function handleError(_0x278cd4,_0x2c6a36){_0x2c6a36=_0x2c6a36||0x1f4;return function(_0x3f02c1){logger[_0x7d8a('0x26')](_0x3f02c1[_0x7d8a('0x37')]);if(_0x3f02c1['name']){delete _0x3f02c1[_0x7d8a('0x38')];}_0x278cd4[_0x7d8a('0x2c')](_0x2c6a36)['send'](_0x3f02c1);};}exports['index']=function(_0x386129,_0x3041f0){var _0xfd38ea={},_0x5e9067={},_0x4e7a17={'count':0x0,'rows':[]};var _0x761ee3=_[_0x7d8a('0x39')](db[_0x7d8a('0x3a')][_0x7d8a('0x3b')],function(_0x5747d1){return{'name':_0x5747d1[_0x7d8a('0x3c')],'type':_0x5747d1[_0x7d8a('0x3d')][_0x7d8a('0x3e')]};});_0x5e9067[_0x7d8a('0x3f')]=_[_0x7d8a('0x39')](_0x761ee3,_0x7d8a('0x38'));_0x5e9067['query']=_['keys'](_0x386129[_0x7d8a('0x40')]);_0x5e9067['filters']=_[_0x7d8a('0x41')](_0x5e9067['model'],_0x5e9067[_0x7d8a('0x40')]);_0xfd38ea[_0x7d8a('0x42')]=_[_0x7d8a('0x41')](_0x5e9067[_0x7d8a('0x3f')],qs['fields'](_0x386129[_0x7d8a('0x40')]['fields']));_0xfd38ea[_0x7d8a('0x42')]=_0xfd38ea['attributes']['length']?_0xfd38ea[_0x7d8a('0x42')]:_0x5e9067[_0x7d8a('0x3f')];if(!_0x386129['query']['hasOwnProperty'](_0x7d8a('0x43'))){_0xfd38ea[_0x7d8a('0x30')]=qs[_0x7d8a('0x30')](_0x386129['query'][_0x7d8a('0x30')]);_0xfd38ea[_0x7d8a('0x2e')]=qs['offset'](_0x386129['query']['offset']);}_0xfd38ea[_0x7d8a('0x44')]=qs[_0x7d8a('0x45')](_0x386129['query'][_0x7d8a('0x45')]);_0xfd38ea[_0x7d8a('0x46')]=qs[_0x7d8a('0x47')](_[_0x7d8a('0x48')](_0x386129['query'],_0x5e9067['filters']),_0x761ee3);if(_0x386129['query'][_0x7d8a('0x49')]){_0xfd38ea[_0x7d8a('0x46')]=_[_0x7d8a('0x4a')](_0xfd38ea['where'],{'$or':_[_0x7d8a('0x39')](_0x761ee3,function(_0x43a08b){if(_0x43a08b[_0x7d8a('0x3d')]!==_0x7d8a('0x4b')){var _0x189cd8={};_0x189cd8[_0x43a08b[_0x7d8a('0x38')]]={'$like':'%'+_0x386129['query']['filter']+'%'};return _0x189cd8;}})});}_0xfd38ea=_['merge']({},_0xfd38ea,_0x386129['options']);var _0x451b3b={'where':_0xfd38ea[_0x7d8a('0x46')]};return db[_0x7d8a('0x3a')][_0x7d8a('0x31')](_0x451b3b)[_0x7d8a('0x21')](function(_0x432c33){_0x4e7a17[_0x7d8a('0x31')]=_0x432c33;if(_0x386129[_0x7d8a('0x40')][_0x7d8a('0x4c')]){_0xfd38ea[_0x7d8a('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0x7d8a('0x4e')](_0xfd38ea);})[_0x7d8a('0x21')](function(_0x1450eb){_0x4e7a17['rows']=_0x1450eb;return _0x4e7a17;})[_0x7d8a('0x21')](respondWithFilteredResult(_0x3041f0,_0xfd38ea))[_0x7d8a('0x2a')](handleError(_0x3041f0,null));};exports[_0x7d8a('0x4f')]=function(_0x21acce,_0x3cc34f){var _0x1cac84={'raw':!![],'where':{'id':_0x21acce['params']['id']}},_0x53640={};_0x53640[_0x7d8a('0x3f')]=_['keys'](db[_0x7d8a('0x3a')][_0x7d8a('0x3b')]);_0x53640[_0x7d8a('0x40')]=_[_0x7d8a('0x50')](_0x21acce[_0x7d8a('0x40')]);_0x53640[_0x7d8a('0x47')]=_[_0x7d8a('0x41')](_0x53640[_0x7d8a('0x3f')],_0x53640[_0x7d8a('0x40')]);_0x1cac84['attributes']=_['intersection'](_0x53640[_0x7d8a('0x3f')],qs['fields'](_0x21acce[_0x7d8a('0x40')][_0x7d8a('0x51')]));_0x1cac84[_0x7d8a('0x42')]=_0x1cac84[_0x7d8a('0x42')][_0x7d8a('0x52')]?_0x1cac84[_0x7d8a('0x42')]:_0x53640[_0x7d8a('0x3f')];if(_0x21acce[_0x7d8a('0x40')][_0x7d8a('0x4c')]){_0x1cac84[_0x7d8a('0x4d')]=[{'all':!![]}];}_0x1cac84=_[_0x7d8a('0x4a')]({},_0x1cac84,_0x21acce['options']);return db[_0x7d8a('0x3a')][_0x7d8a('0x53')](_0x1cac84)[_0x7d8a('0x21')](handleEntityNotFound(_0x3cc34f,null))[_0x7d8a('0x21')](respondWithResult(_0x3cc34f,null))[_0x7d8a('0x2a')](handleError(_0x3cc34f,null));};exports[_0x7d8a('0x34')]=function(_0xc2c2a,_0x223abc){if(_0xc2c2a['body']['id']){delete _0xc2c2a[_0x7d8a('0x54')]['id'];}return db[_0x7d8a('0x3a')][_0x7d8a('0x53')]({'where':{'id':_0xc2c2a[_0x7d8a('0x55')]['id']}})['then'](handleEntityNotFound(_0x223abc,null))[_0x7d8a('0x21')](saveUpdates(_0xc2c2a[_0x7d8a('0x54')],null))['then'](respondWithResult(_0x223abc,null))['catch'](handleError(_0x223abc,null));};exports[_0x7d8a('0x35')]=function(_0x208b81,_0x1767e0){return db['FaxMessage'][_0x7d8a('0x53')]({'where':{'id':_0x208b81[_0x7d8a('0x55')]['id']}})[_0x7d8a('0x21')](handleEntityNotFound(_0x1767e0,null))[_0x7d8a('0x21')](removeEntity(_0x1767e0,null))[_0x7d8a('0x2a')](handleError(_0x1767e0,null));};exports[_0x7d8a('0x56')]=function(_0x472a62,_0x4345dd){return db['FaxMessage'][_0x7d8a('0x56')]()[_0x7d8a('0x21')](respondWithResult(_0x4345dd,null))['catch'](handleError(_0x4345dd,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x7d8a('0x57')]=function(_0x1dfb4a,_0x3899e8,_0x2131e6){var _0x56202a={'agent':{},'channel':_0x7d8a('0x58')};if(_0x1dfb4a[_0x7d8a('0x54')]['id']){delete _0x1dfb4a['body']['id'];}_0x1dfb4a[_0x7d8a('0x54')][_0x7d8a('0x59')]=!![];_0x1dfb4a[_0x7d8a('0x54')][_0x7d8a('0x5a')]=moment()[_0x7d8a('0x5b')](_0x7d8a('0x5c'));_0x1dfb4a['body'][_0x7d8a('0x5d')]=_0x1dfb4a[_0x7d8a('0x54')][_0x7d8a('0x5d')]||_0x1dfb4a[_0x7d8a('0x5e')]['id'];_0x56202a[_0x7d8a('0x5f')]['id']=_0x1dfb4a['body'][_0x7d8a('0x5d')];return db[_0x7d8a('0x3a')][_0x7d8a('0x53')]({'where':{'id':_0x1dfb4a[_0x7d8a('0x55')]['id'],'UserId':null}})[_0x7d8a('0x21')](handleEntityNotFound(_0x3899e8,null))[_0x7d8a('0x21')](saveUpdates(_0x1dfb4a[_0x7d8a('0x54')],null))[_0x7d8a('0x21')](function(_0x1d7261){if(_0x1d7261){_0x56202a['message']=_0x1d7261[_0x7d8a('0x60')]({'plain':!![]});return db[_0x7d8a('0x61')][_0x7d8a('0x53')]({'where':{'id':_0x1d7261['FaxInteractionId']}});}return null;})[_0x7d8a('0x21')](handleEntityNotFound(_0x3899e8,null))[_0x7d8a('0x21')](function(_0x33187f){if(_0x33187f){return _0x33187f[_0x7d8a('0x34')]({'UserId':_0x1dfb4a[_0x7d8a('0x54')][_0x7d8a('0x5d')],'read1stAt':_['isNil'](_0x33187f[_0x7d8a('0x62')])?moment()[_0x7d8a('0x5b')](_0x7d8a('0x5c')):undefined});}return null;})['then'](function(_0x1a49ce){if(_0x1a49ce){_0x56202a['interaction']=_0x1a49ce['get']({'plain':!![]});interaction_log[_0x7d8a('0x22')](_0x7d8a('0x63'),_0x1dfb4a[_0x7d8a('0x5e')]['id'],_0x1dfb4a[_0x7d8a('0x5e')][_0x7d8a('0x38')],_0x1dfb4a[_0x7d8a('0x5e')][_0x7d8a('0x64')],_0x56202a[_0x7d8a('0x65')]['id'],_0x1dfb4a['body']?JSON['stringify'](_0x1dfb4a[_0x7d8a('0x54')]):_0x7d8a('0x66'));return respondWithRpcPromise(_0x7d8a('0x67'),'acceptMessage',_0x56202a);}return null;})['then'](function(_0x12f66e){var _0x4b74d7=_0x7d8a('0x68')+_0x12f66e[_0x7d8a('0x28')][_0x7d8a('0x69')];return db['sequelize'][_0x7d8a('0x40')](_0x4b74d7,{'type':db['Sequelize'][_0x7d8a('0x6a')][_0x7d8a('0x6b')],'raw':!![]})[_0x7d8a('0x21')](function(_0x36f5ac){return _0x36f5ac;});})['then'](function(_0x253b10){if(_0x253b10){_0x56202a[_0x7d8a('0x28')][_0x7d8a('0x6c')]=_0x253b10[0x0];if(!_0x1dfb4a[_0x7d8a('0x54')]['UserId'])return;return db[_0x7d8a('0x6d')][_0x7d8a('0x53')]({'where':{'id':_0x1dfb4a[_0x7d8a('0x54')]['UserId'],'role':_0x7d8a('0x5f')},'attributes':['id','name',_0x7d8a('0x6e'),_0x7d8a('0x6f'),_0x7d8a('0x70')],'raw':!![]});}return null;})[_0x7d8a('0x21')](function(_0x2870b7){if(!_0x2870b7)return null;_0x56202a[_0x7d8a('0x28')]['agent']=_0x2870b7;return _0x56202a;})[_0x7d8a('0x21')](function(_0x8c3582){if(_0x8c3582){if(_0x1dfb4a[_0x7d8a('0x54')][_0x7d8a('0x71')]){_0x56202a[_0x7d8a('0x28')]['interface']=util[_0x7d8a('0x5b')](_0x7d8a('0x72'),_0x1dfb4a[_0x7d8a('0x5e')][_0x7d8a('0x38')]);_0x56202a[_0x7d8a('0x28')]['channel']=_0x56202a[_0x7d8a('0x73')];_0x56202a[_0x7d8a('0x28')][_0x7d8a('0x74')]=_0x56202a['channel'];_0x56202a[_0x7d8a('0x28')]['event']=_0x7d8a('0x57');return respondWithRpcPromise(_0x7d8a('0x75'),_0x7d8a('0x75'),{'event':'acceptmessage','message':_0x56202a[_0x7d8a('0x28')]},client9002)[_0x7d8a('0x21')](function(){return _0x56202a;});}return _0x56202a;}return null;})[_0x7d8a('0x21')](respondWithResult(_0x3899e8,null))[_0x7d8a('0x2a')](handleError(_0x3899e8,null));};var interaction_log=require(_0x7d8a('0x15'))(_0x7d8a('0x76'));exports[_0x7d8a('0x77')]=function(_0x379e56,_0x59ea2e,_0x29c65e){var _0x14fbe0={'agent':{},'channel':'fax'};if(_0x379e56[_0x7d8a('0x54')]['id']){delete _0x379e56[_0x7d8a('0x54')]['id'];}_0x379e56[_0x7d8a('0x54')]['UserId']=_0x379e56[_0x7d8a('0x54')][_0x7d8a('0x5d')]||_0x379e56[_0x7d8a('0x5e')]['id'];_0x14fbe0[_0x7d8a('0x5f')]['id']=_0x379e56['body'][_0x7d8a('0x5d')];return db['FaxMessage'][_0x7d8a('0x53')]({'where':{'id':_0x379e56[_0x7d8a('0x55')]['id'],'UserId':null}})[_0x7d8a('0x21')](handleEntityNotFound(_0x59ea2e,null))[_0x7d8a('0x21')](function(_0x55d246){if(_0x55d246){_0x14fbe0[_0x7d8a('0x28')]=_0x55d246[_0x7d8a('0x60')]({'plain':!![]});return db[_0x7d8a('0x61')][_0x7d8a('0x53')]({'where':{'id':_0x55d246['FaxInteractionId']}});}return null;})[_0x7d8a('0x21')](handleEntityNotFound(_0x59ea2e,null))[_0x7d8a('0x21')](function(_0x1fa1c9){if(_0x1fa1c9){_0x14fbe0['interaction']=_0x1fa1c9[_0x7d8a('0x60')]({'plain':!![]});interaction_log['info'](_0x7d8a('0x78'),_0x379e56[_0x7d8a('0x5e')]['id'],_0x379e56[_0x7d8a('0x5e')]['name'],_0x379e56[_0x7d8a('0x5e')][_0x7d8a('0x64')],_0x14fbe0[_0x7d8a('0x65')]['id'],_0x379e56['body']?JSON[_0x7d8a('0x79')](_0x379e56[_0x7d8a('0x54')]):_0x7d8a('0x66'));return respondWithRpcPromise(_0x7d8a('0x7a'),_0x7d8a('0x7b'),_0x14fbe0);}return null;})['then'](function(_0x4482ec){var _0x31d5cd=_0x7d8a('0x68')+_0x4482ec[_0x7d8a('0x28')]['ContactId'];return db[_0x7d8a('0x7c')][_0x7d8a('0x40')](_0x31d5cd,{'type':db[_0x7d8a('0x7d')][_0x7d8a('0x6a')][_0x7d8a('0x6b')],'raw':!![]})['then'](function(_0x1cba6d){return _0x1cba6d;});})[_0x7d8a('0x21')](function(_0x3bd491){if(_0x3bd491){_0x14fbe0[_0x7d8a('0x28')][_0x7d8a('0x6c')]=_0x3bd491[0x0];if(!_0x379e56[_0x7d8a('0x54')][_0x7d8a('0x5d')])return;return db[_0x7d8a('0x6d')]['find']({'where':{'id':_0x379e56[_0x7d8a('0x54')]['UserId'],'role':_0x7d8a('0x5f')},'attributes':['id',_0x7d8a('0x38'),_0x7d8a('0x6e'),_0x7d8a('0x6f'),_0x7d8a('0x70')],'raw':!![]});}return null;})[_0x7d8a('0x21')](function(_0x3b2bc5){if(!_0x3b2bc5)return null;_0x14fbe0[_0x7d8a('0x28')][_0x7d8a('0x5f')]=_0x3b2bc5;return _0x14fbe0;})[_0x7d8a('0x21')](function(_0x1f5c5d){if(_0x1f5c5d){_0x1f5c5d[_0x7d8a('0x28')][_0x7d8a('0x7e')]=util[_0x7d8a('0x5b')]('SIP/%s',_0x379e56[_0x7d8a('0x5e')][_0x7d8a('0x38')]);_0x1f5c5d['message'][_0x7d8a('0x73')]=_0x14fbe0[_0x7d8a('0x73')];_0x1f5c5d[_0x7d8a('0x28')]['motionChannel']=_0x14fbe0[_0x7d8a('0x73')];_0x1f5c5d['message'][_0x7d8a('0x7f')]=_0x7d8a('0x77');respondWithRpcPromise(_0x7d8a('0x75'),_0x7d8a('0x75'),{'event':_0x7d8a('0x80'),'message':_0x1f5c5d[_0x7d8a('0x28')]},client9002);return _0x14fbe0;}return null;})['then'](respondWithResult(_0x59ea2e,null))['catch'](handleError(_0x59ea2e,null));};exports[_0x7d8a('0x81')]=function(_0x399ad3,_0x1324dd){var _0x481f1f;return db[_0x7d8a('0x3a')][_0x7d8a('0x81')](_0x399ad3['body'],{})['then'](function(_0x35ed46){_0x481f1f=_0x35ed46;return db['CmContact'][_0x7d8a('0x82')]({'where':{'id':_0x481f1f[_0x7d8a('0x69')]}});})['then'](function(_0x37b8e4){if(_[_0x7d8a('0x83')](_0x37b8e4)){return;}else{_0x481f1f[_0x7d8a('0x58')]=_0x37b8e4[_0x7d8a('0x58')];return db[_0x7d8a('0x84')][_0x7d8a('0x82')]({'where':{'id':_0x481f1f[_0x7d8a('0x85')]}});}})[_0x7d8a('0x21')](function(_0x3b818d){return respondWithRpcPromise(_0x7d8a('0x86'),_0x7d8a('0x86'),{'FaxAccountId':_['isNil'](_0x399ad3[_0x7d8a('0x54')])?undefined:_0x399ad3[_0x7d8a('0x54')][_0x7d8a('0x87')],'path':_[_0x7d8a('0x83')](_0x3b818d)?undefined:util[_0x7d8a('0x5b')](_0x7d8a('0x88'),_0x3b818d[_0x7d8a('0x89')]),'fax':_['isNil'](_0x481f1f[_0x7d8a('0x58')])?undefined:_0x481f1f['fax'],'AttachmentId':_0x481f1f[_0x7d8a('0x85')]},client9002);})[_0x7d8a('0x21')](respondWithResult(_0x1324dd,0xc9))[_0x7d8a('0x2a')](handleError(_0x1324dd,null));};exports[_0x7d8a('0x8a')]=function(_0x38aca1,_0x2b8693){var _0x58f806=path['join'](config[_0x7d8a('0x8b')],_0x7d8a('0x8c'),'files',_0x7d8a('0x8d'));return db['FaxMessage'][_0x7d8a('0x53')]({'where':{'id':_0x38aca1[_0x7d8a('0x55')]['id']},'include':[{'model':db[_0x7d8a('0x84')],'as':'Attachment'}]})[_0x7d8a('0x21')](handleEntityNotFound(_0x2b8693,null))['then'](function(_0x346134){if(_0x346134){return _0x2b8693[_0x7d8a('0x8a')](path[_0x7d8a('0x8e')](_0x58f806,_0x346134[_0x7d8a('0x84')][_0x7d8a('0x89')]));}})[_0x7d8a('0x2a')](handleError(_0x2b8693,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6b4e87b..1601b08 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 _0x27eb=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1f3560,_0x262bb7){var _0x37b2f3=function(_0x29c572){while(--_0x29c572){_0x1f3560['push'](_0x1f3560['shift']());}};_0x37b2f3(++_0x262bb7);}(_0x27eb,0xd0));var _0xb27e=function(_0x548aea,_0x24ed9b){_0x548aea=_0x548aea-0x0;var _0x4f504d=_0x27eb[_0x548aea];return _0x4f504d;};'use strict';var EventEmitter=require(_0xb27e('0x0'));var FaxMessage=require(_0xb27e('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb27e('0x2'),'afterUpdate':_0xb27e('0x3'),'afterDestroy':_0xb27e('0x4')};function emitEvent(_0x5c9b37){return function(_0x2ed7d7,_0x1d82eb,_0x2aab8e){FaxMessageEvents[_0xb27e('0x5')](_0x5c9b37+':'+_0x2ed7d7['id'],_0x2ed7d7);FaxMessageEvents['emit'](_0x5c9b37,_0x2ed7d7);_0x2aab8e(null);};}for(var e in events){if(events[_0xb27e('0x6')](e)){var event=events[e];FaxMessage[_0xb27e('0x7')](e,emitEvent(event));}}module[_0xb27e('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xb296=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x55ac6b,_0x16c8cc){var _0x46fb85=function(_0x42ba08){while(--_0x42ba08){_0x55ac6b['push'](_0x55ac6b['shift']());}};_0x46fb85(++_0x16c8cc);}(_0xb296,0xa3));var _0x6b29=function(_0x8b62ca,_0x4d058e){_0x8b62ca=_0x8b62ca-0x0;var _0x615a0=_0xb296[_0x8b62ca];return _0x615a0;};'use strict';var EventEmitter=require(_0x6b29('0x0'));var FaxMessage=require(_0x6b29('0x1'))['db'][_0x6b29('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6b29('0x3')](0x0);var events={'afterCreate':_0x6b29('0x4'),'afterUpdate':_0x6b29('0x5'),'afterDestroy':_0x6b29('0x6')};function emitEvent(_0x48e967){return function(_0x3ff65c,_0x5c1cf5,_0x50a1ba){FaxMessageEvents[_0x6b29('0x7')](_0x48e967+':'+_0x3ff65c['id'],_0x3ff65c);FaxMessageEvents['emit'](_0x48e967,_0x3ff65c);_0x50a1ba(null);};}for(var e in events){if(events[_0x6b29('0x8')](e)){var event=events[e];FaxMessage[_0x6b29('0x9')](e,emitEvent(event));}}module[_0x6b29('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index fded9ac..12efe9b 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 _0xa925=['FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x1fc356,_0x5de529){var _0x4b5c33=function(_0x44b215){while(--_0x44b215){_0x1fc356['push'](_0x1fc356['shift']());}};_0x4b5c33(++_0x5de529);}(_0xa925,0x158));var _0x5a92=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa925[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5a92('0x0'));var util=require('util');var logger=require(_0x5a92('0x1'))('api');var moment=require(_0x5a92('0x2'));var BPromise=require(_0x5a92('0x3'));var rp=require(_0x5a92('0x4'));var fs=require('fs');var path=require(_0x5a92('0x5'));var rimraf=require(_0x5a92('0x6'));var config=require(_0x5a92('0x7'));var attributes=require(_0x5a92('0x8'));module[_0x5a92('0x9')]=function(_0x43d738,_0x4682e7){return _0x43d738['define'](_0x5a92('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x5a92('0xb'),'fields':[_0x5a92('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d50e1,_0x5419d2,_0x433147){var _0xf916e2=_0x43d738['models'];var _0x28343c=_0x3d50e1[_0x5a92('0xd')]({'plain':!![]});if(_0x28343c[_0x5a92('0xe')][_0x5a92('0xf')]()==='in'||_0x28343c[_0x5a92('0xe')][_0x5a92('0xf')]()===_0x5a92('0x10')&&!_0x28343c[_0x5a92('0x11')]&&!_[_0x5a92('0x12')](_0x28343c[_0x5a92('0x13')])){_0xf916e2[_0x5a92('0x14')][_0x5a92('0x15')]({'where':{'id':_0x28343c[_0x5a92('0x16')]}})[_0x5a92('0x17')](function(_0x2bfee6){if(_0x2bfee6){_0x2bfee6[_0x5a92('0x18')]({'lastMsgAt':_0x28343c['createdAt'],'lastMsgDirection':_0x28343c[_0x5a92('0xe')][_0x5a92('0xf')]()});}})[_0x5a92('0x19')](function(_0x5e798d){console[_0x5a92('0x1a')](_0x5e798d);});}_0x433147();}},'charset':_0x5a92('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd070=['secret','isNil','findOne','then','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xd070,0x1ed));var _0x0d07=function(_0x3b0fb8,_0x5a8266){_0x3b0fb8=_0x3b0fb8-0x0;var _0x29ee73=_0xd070[_0x3b0fb8];return _0x29ee73;};'use strict';var _=require(_0x0d07('0x0'));var util=require(_0x0d07('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0d07('0x2'));var BPromise=require(_0x0d07('0x3'));var rp=require(_0x0d07('0x4'));var fs=require('fs');var path=require(_0x0d07('0x5'));var rimraf=require(_0x0d07('0x6'));var config=require(_0x0d07('0x7'));var attributes=require(_0x0d07('0x8'));module[_0x0d07('0x9')]=function(_0x270846,_0x392917){return _0x270846[_0x0d07('0xa')](_0x0d07('0xb'),attributes,{'tableName':_0x0d07('0xc'),'paranoid':![],'indexes':[{'name':_0x0d07('0xd'),'fields':[_0x0d07('0xe')],'type':_0x0d07('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45f8b3,_0x4ff44f,_0xf9c9ce){var _0x5c38da=_0x270846[_0x0d07('0x10')];var _0x4d6fc1=_0x45f8b3[_0x0d07('0x11')]({'plain':!![]});if(_0x4d6fc1['direction']['toLowerCase']()==='in'||_0x4d6fc1[_0x0d07('0x12')][_0x0d07('0x13')]()==='out'&&!_0x4d6fc1[_0x0d07('0x14')]&&!_[_0x0d07('0x15')](_0x4d6fc1['UserId'])){_0x5c38da['FaxInteraction'][_0x0d07('0x16')]({'where':{'id':_0x4d6fc1['FaxInteractionId']}})[_0x0d07('0x17')](function(_0x2d200e){if(_0x2d200e){_0x2d200e[_0x0d07('0x18')]({'lastMsgAt':_0x4d6fc1['createdAt'],'lastMsgDirection':_0x4d6fc1[_0x0d07('0x12')][_0x0d07('0x13')]()});}})['catch'](function(_0xae9b02){console['error'](_0xae9b02);});}_0xf9c9ce();}},'charset':_0x0d07('0x19'),'collate':_0x0d07('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e3fe43a..6611895 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0xc95a63,_0x5f1313){var _0x302d4b=function(_0x1d84e1){while(--_0x1d84e1){_0xc95a63['push'](_0xc95a63['shift']());}};_0x302d4b(++_0x5f1313);}(_0x9f62,0x154));var _0x29f6=function(_0x260257,_0x7d43){_0x260257=_0x260257-0x0;var _0x113848=_0x9f62[_0x260257];return _0x113848;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0x5fd1=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','raw','catch','UpdateFaxMessage','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fd1,0x155));var _0x15fd=function(_0x3f9727,_0xf55e7e){_0x3f9727=_0x3f9727-0x0;var _0x522219=_0x5fd1[_0x3f9727];return _0x522219;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./faxMessage.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('FaxMessage,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});}exports[_0x15fd('0x19')]=function(_0x2fb919){var _0x36a90e=this;return new Promise(function(_0x3761db,_0x2f46f1){return db[_0x15fd('0x1a')][_0x15fd('0x1b')](_0x2fb919[_0x15fd('0x1c')],{'raw':_0x2fb919['options']?_0x2fb919['options'][_0x15fd('0x1d')]===undefined?!![]:![]:!![]})[_0x15fd('0xf')](function(_0x252a1c){logger[_0x15fd('0x10')](_0x15fd('0x19'),_0x2fb919);logger[_0x15fd('0x13')](_0x15fd('0x19'),_0x2fb919,JSON['stringify'](_0x252a1c));_0x3761db(_0x252a1c);})[_0x15fd('0x1e')](function(_0x2d19ac){logger[_0x15fd('0x16')]('CreateFaxMessage',_0x2d19ac[_0x15fd('0x17')],_0x2fb919);_0x2f46f1(_0x36a90e['error'](0x1f4,_0x2d19ac[_0x15fd('0x17')]));});});};exports[_0x15fd('0x1f')]=function(_0x21601d){var _0x4c9708=this;return new Promise(function(_0x16b87c,_0x1cbf2c){return db[_0x15fd('0x1a')]['update'](_0x21601d[_0x15fd('0x1c')],{'raw':_0x21601d['options']?_0x21601d[_0x15fd('0x20')][_0x15fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x21')]||null:null,'attributes':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x22')]||null:null,'limit':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x23')]||null:null})['then'](function(_0x47c22c){logger[_0x15fd('0x10')]('UpdateFaxMessage',_0x21601d);logger[_0x15fd('0x13')](_0x15fd('0x1f'),_0x21601d,JSON['stringify'](_0x47c22c));_0x16b87c(_0x47c22c);})[_0x15fd('0x1e')](function(_0x197d15){logger['error'](_0x15fd('0x1f'),_0x197d15[_0x15fd('0x17')],_0x21601d);_0x1cbf2c(_0x4c9708[_0x15fd('0x16')](0x1f4,_0x197d15[_0x15fd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 77aff34..1442de2 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 _0xae6e=['emit','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x3bb4b1,_0x304955){var _0x484a33=function(_0xc15388){while(--_0xc15388){_0x3bb4b1['push'](_0x3bb4b1['shift']());}};_0x484a33(++_0x304955);}(_0xae6e,0x10d));var _0xeae6=function(_0x1bdd78,_0x3e6859){_0x1bdd78=_0x1bdd78-0x0;var _0x23799f=_0xae6e[_0x1bdd78];return _0x23799f;};'use strict';var FaxMessageEvents=require(_0xeae6('0x0'));var events=[_0xeae6('0x1'),_0xeae6('0x2'),_0xeae6('0x3')];function createListener(_0x57ad8f,_0x40c80f){return function(_0x6bb3e5){_0x40c80f[_0xeae6('0x4')](_0x57ad8f,_0x6bb3e5);};}function removeListener(_0x3a1f50,_0x3dff80){return function(){FaxMessageEvents['removeListener'](_0x3a1f50,_0x3dff80);};}exports['register']=function(_0x3bc279){for(var _0x55bc40=0x0,_0x35fb1c=events[_0xeae6('0x5')];_0x55bc40<_0x35fb1c;_0x55bc40++){var _0x209cad=events[_0x55bc40];var _0x4fb1c7=createListener(_0xeae6('0x6')+_0x209cad,_0x3bc279);FaxMessageEvents['on'](_0x209cad,_0x4fb1c7);}}; \ No newline at end of file +var _0x6a50=['register','length','faxMessage:','./faxMessage.events','save','update','emit','removeListener'];(function(_0x7afd,_0x5876d6){var _0x43a96c=function(_0x1bd333){while(--_0x1bd333){_0x7afd['push'](_0x7afd['shift']());}};_0x43a96c(++_0x5876d6);}(_0x6a50,0x1d3));var _0x06a5=function(_0x38ed1e,_0x17c77a){_0x38ed1e=_0x38ed1e-0x0;var _0x1e660e=_0x6a50[_0x38ed1e];return _0x1e660e;};'use strict';var FaxMessageEvents=require(_0x06a5('0x0'));var events=[_0x06a5('0x1'),'remove',_0x06a5('0x2')];function createListener(_0x25888b,_0x20d099){return function(_0x4ead22){_0x20d099[_0x06a5('0x3')](_0x25888b,_0x4ead22);};}function removeListener(_0x5302e6,_0x3a1d10){return function(){FaxMessageEvents[_0x06a5('0x4')](_0x5302e6,_0x3a1d10);};}exports[_0x06a5('0x5')]=function(_0xe2d1c3){for(var _0x8e6dd4=0x0,_0x173dc9=events[_0x06a5('0x6')];_0x8e6dd4<_0x173dc9;_0x8e6dd4++){var _0x526bd4=events[_0x8e6dd4];var _0x33ee1a=createListener(_0x06a5('0x7')+_0x526bd4,_0xe2d1c3);FaxMessageEvents['on'](_0x526bd4,_0x33ee1a);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d83af42..e5c0879 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','faxmessage:create','create','put','update','/:id/accept','/:id/reject','delete','destroy','multer','util','path','express','Router'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe706,0xa3));var _0x6e70=function(_0xb4411,_0x5d04ac){_0xb4411=_0xb4411-0x0;var _0x481db4=_0xe706[_0xb4411];return _0x481db4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/',auth[_0x6e70('0xb')](),interaction['tracked']('fax',_0x6e70('0x14')),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')](_0x6e70('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x6e70('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x6e70('0x1a')](_0x6e70('0xf'),auth['isAuthenticated'](),controller[_0x6e70('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xeffd=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','tracked','fax','faxmessage:create','create','/:id','put','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42f6ab,_0x40779a){var _0x25194c=function(_0x50ef8d){while(--_0x50ef8d){_0x42f6ab['push'](_0x42f6ab['shift']());}};_0x25194c(++_0x40779a);}(_0xeffd,0x6b));var _0xdeff=function(_0x2910a7,_0x286dbb){_0x2910a7=_0x2910a7-0x0;var _0x21432a=_0xeffd[_0x2910a7];return _0x21432a;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var fs_extra=require(_0xdeff('0x5'));var auth=require(_0xdeff('0x6'));var interaction=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var controller=require(_0xdeff('0x9'));router[_0xdeff('0xa')]('/',auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xa')](_0xdeff('0xd'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xa')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0xf')]);router[_0xdeff('0xa')]('/:id/download',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);router[_0xdeff('0x11')]('/',auth[_0xdeff('0xb')](),interaction[_0xdeff('0x12')](_0xdeff('0x13'),_0xdeff('0x14')),controller[_0xdeff('0x15')]);router['put'](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller['update']);router[_0xdeff('0x17')]('/:id/accept',auth['isAuthenticated'](),controller[_0xdeff('0x18')]);router[_0xdeff('0x17')](_0xdeff('0x19'),auth[_0xdeff('0xb')](),controller['reject']);router[_0xdeff('0x1a')](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller[_0xdeff('0x1b')]);module[_0xdeff('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 38c294a..7a2ff58 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 _0xd70e=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x13e902,_0x161176){var _0x64f89e=function(_0x206b40){while(--_0x206b40){_0x13e902['push'](_0x13e902['shift']());}};_0x64f89e(++_0x161176);}(_0xd70e,0x157));var _0xed70=function(_0x595151,_0x1f1f72){_0x595151=_0x595151-0x0;var _0x5776df=_0xd70e[_0x595151];return _0x5776df;};'use strict';var Sequelize=require(_0xed70('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xed70('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed70('0x2')]},'timeout':{'type':Sequelize[_0xed70('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed70('0x4')](_0xed70('0x5'),_0xed70('0x6'),_0xed70('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcad5=['rrmemory','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xcad5,0x1cf));var _0x5cad=function(_0x3487a8,_0x388f3a){_0x3487a8=_0x3487a8-0x0;var _0x159edd=_0xcad5[_0x3487a8];return _0x159edd;};'use strict';var Sequelize=require(_0x5cad('0x0'));module[_0x5cad('0x1')]={'name':{'type':Sequelize[_0x5cad('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5cad('0x2')]},'timeout':{'type':Sequelize[_0x5cad('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5cad('0x4')](_0x5cad('0x5'),'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 035a8aa..57a8576 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 _0x1a61=['every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','json','offset','undefined','count','status','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','end','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','show','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','UserFaxQueue','filters','hasOwnProperty','limit','sort','pick','FaxQueueId','filter','User','findAndCountAll','agent','faxPause','createdAt','rows','format','SIP','updatedAt','getTeams','findOne','Team','order','nolimit','ids','flatMap','Agents','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT'];(function(_0x5d8af8,_0x25d888){var _0x531705=function(_0x17a466){while(--_0x17a466){_0x5d8af8['push'](_0x5d8af8['shift']());}};_0x531705(++_0x25d888);}(_0x1a61,0x1e6));var _0x11a6=function(_0x197965,_0x38acbf){_0x197965=_0x197965-0x0;var _0x7222c6=_0x1a61[_0x197965];return _0x7222c6;};'use strict';var BPromise=require(_0x11a6('0x0'));var util=require('util');var _=require(_0x11a6('0x1'));var squel=require('squel');var Redis=require(_0x11a6('0x2'));var qs=require(_0x11a6('0x3'));var logger=require(_0x11a6('0x4'))(_0x11a6('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x11a6('0x6')]=_[_0x11a6('0x7')](config['redis'],{'host':_0x11a6('0x8'),'port':0x18eb});var socket=require(_0x11a6('0x9'))(new Redis(config[_0x11a6('0x6')]));require(_0x11a6('0xa'))[_0x11a6('0xb')](socket);function respondWithStatusCode(_0x33b9b4,_0x2b8dd4){_0x2b8dd4=_0x2b8dd4||0xcc;return function(_0x1dbfcc){if(_0x1dbfcc){return _0x33b9b4[_0x11a6('0xc')](_0x2b8dd4);}return _0x33b9b4['status'](_0x2b8dd4)['end']();};}function respondWithResult(_0x522315,_0xf7f73d){_0xf7f73d=_0xf7f73d||0xc8;return function(_0x3cf410){if(_0x3cf410){return _0x522315['status'](_0xf7f73d)[_0x11a6('0xd')](_0x3cf410);}};}function respondWithFilteredResult(_0x91835f,_0x172908){return function(_0x16486f){if(_0x16486f){var _0x12c976=typeof _0x172908[_0x11a6('0xe')]==='undefined'&&typeof _0x172908['limit']===_0x11a6('0xf');var _0x318253=_0x16486f['count'];var _0x1d3123=_0x12c976?0x0:_0x172908[_0x11a6('0xe')];var _0x5158ea=_0x12c976?_0x16486f[_0x11a6('0x10')]:_0x172908[_0x11a6('0xe')]+_0x172908['limit'];var _0x345c70;if(_0x5158ea>=_0x318253){_0x5158ea=_0x318253;_0x345c70=0xc8;}else{_0x345c70=0xce;}_0x91835f[_0x11a6('0x11')](_0x345c70);return _0x91835f[_0x11a6('0x12')](_0x11a6('0x13'),_0x1d3123+'-'+_0x5158ea+'/'+_0x318253)['json'](_0x16486f);}return null;};}function saveUpdates(_0x3d6457){return function(_0x458af3){if(_0x458af3){return _0x458af3[_0x11a6('0x14')](_0x3d6457)[_0x11a6('0x15')](function(_0x1a9d43){return _0x1a9d43;});}return null;};}function removeEntity(_0x1e3cdd){return function(_0x2449bf){if(_0x2449bf){return _0x2449bf[_0x11a6('0x16')]()[_0x11a6('0x15')](function(){var _0x152160=_0x2449bf[_0x11a6('0x17')]({'plain':!![]});var _0x3681b2=_0x11a6('0x18');return db[_0x11a6('0x19')]['destroy']({'where':{'type':_0x3681b2,'resourceId':_0x152160['id']}})[_0x11a6('0x15')](function(){return _0x2449bf;});})[_0x11a6('0x15')](function(){_0x1e3cdd[_0x11a6('0x11')](0xcc)[_0x11a6('0x1a')]();});}};}function handleEntityNotFound(_0x4e37f8){return function(_0x540516){if(!_0x540516){_0x4e37f8[_0x11a6('0xc')](0x194);}return _0x540516;};}function handleError(_0x521f50,_0x707dd2){_0x707dd2=_0x707dd2||0x1f4;return function(_0x4c42ec){logger['error'](_0x4c42ec['stack']);if(_0x4c42ec['name']){delete _0x4c42ec[_0x11a6('0x1b')];}_0x521f50['status'](_0x707dd2)[_0x11a6('0x1c')](_0x4c42ec);};}exports[_0x11a6('0x1d')]=function(_0x5dbc63,_0x5281d7){var _0x2ffd7f={};var _0x144cc5={'count':0x0,'rows':[]};var _0x34e230=_[_0x11a6('0x1e')](db[_0x11a6('0x1f')][_0x11a6('0x20')],function(_0x40e3b4){return{'name':_0x40e3b4[_0x11a6('0x21')],'type':_0x40e3b4[_0x11a6('0x22')][_0x11a6('0x23')]};});_0x2ffd7f=qs[_0x11a6('0x24')](_0x34e230,_0x5dbc63);var _0x2cdccb={'where':_0x2ffd7f[_0x11a6('0x25')]};return db[_0x11a6('0x1f')][_0x11a6('0x10')](_0x2cdccb)[_0x11a6('0x15')](function(_0x1ddbb2){_0x144cc5[_0x11a6('0x10')]=_0x1ddbb2;_0x2ffd7f[_0x11a6('0x26')]=qs[_0x11a6('0x26')](_0x5dbc63[_0x11a6('0x27')]);return db[_0x11a6('0x1f')][_0x11a6('0x28')](_0x2ffd7f);})[_0x11a6('0x15')](function(_0x3827e3){_0x144cc5['rows']=_0x3827e3;return _0x144cc5;})[_0x11a6('0x15')](respondWithFilteredResult(_0x5281d7,_0x2ffd7f))['catch'](handleError(_0x5281d7,null));};exports[_0x11a6('0x29')]=function(_0x459bde,_0x10f481){var _0x210f2f={'raw':!![],'where':{'id':_0x459bde['params']['id']}},_0x224b62={};_0x224b62[_0x11a6('0x2a')]=_[_0x11a6('0x2b')](db['FaxQueue']['rawAttributes']);_0x224b62['query']=_[_0x11a6('0x2b')](_0x459bde[_0x11a6('0x27')]);_0x224b62['filters']=_[_0x11a6('0x2c')](_0x224b62[_0x11a6('0x2a')],_0x224b62[_0x11a6('0x27')]);_0x210f2f[_0x11a6('0x2d')]=_[_0x11a6('0x2c')](_0x224b62['model'],qs[_0x11a6('0x2e')](_0x459bde[_0x11a6('0x27')][_0x11a6('0x2e')]));_0x210f2f[_0x11a6('0x2d')]=_0x210f2f[_0x11a6('0x2d')][_0x11a6('0x2f')]?_0x210f2f[_0x11a6('0x2d')]:_0x224b62[_0x11a6('0x2a')];if(_0x459bde[_0x11a6('0x27')][_0x11a6('0x30')]){_0x210f2f[_0x11a6('0x26')]=[{'all':!![]}];}_0x210f2f=_[_0x11a6('0x31')]({},_0x210f2f,_0x459bde[_0x11a6('0x32')]);return db['FaxQueue'][_0x11a6('0x33')](_0x210f2f)[_0x11a6('0x15')](handleEntityNotFound(_0x10f481,null))[_0x11a6('0x15')](respondWithResult(_0x10f481,null))[_0x11a6('0x34')](handleError(_0x10f481,null));};exports[_0x11a6('0x35')]=function(_0x461932,_0x3017d4){return db[_0x11a6('0x1f')][_0x11a6('0x35')](_0x461932['body'],{})[_0x11a6('0x15')](function(_0x194b00){var _0x5f38c1=_0x461932[_0x11a6('0x36')][_0x11a6('0x17')]({'plain':!![]});if(!_0x5f38c1)throw new Error(_0x11a6('0x37'));if(_0x5f38c1['role']===_0x11a6('0x36')){var _0x97e288=_0x194b00['get']({'plain':!![]});var _0x5dbdda=_0x11a6('0x18');return db['UserProfileSection'][_0x11a6('0x33')]({'where':{'name':_0x5dbdda,'userProfileId':_0x5f38c1[_0x11a6('0x38')]},'raw':!![]})['then'](function(_0x275aa0){if(_0x275aa0&&_0x275aa0['autoAssociation']===0x0){return db[_0x11a6('0x19')][_0x11a6('0x35')]({'name':_0x97e288['name'],'resourceId':_0x97e288['id'],'type':_0x275aa0[_0x11a6('0x1b')],'sectionId':_0x275aa0['id']},{})[_0x11a6('0x15')](function(){return _0x194b00;});}else{return _0x194b00;}})[_0x11a6('0x34')](function(_0xd769e4){logger[_0x11a6('0x39')](_0x11a6('0x3a'),_0xd769e4);throw _0xd769e4;});}return _0x194b00;})[_0x11a6('0x15')](respondWithResult(_0x3017d4,0xc9))['catch'](handleError(_0x3017d4,null));};exports[_0x11a6('0x14')]=function(_0x382182,_0x5f44c1){if(_0x382182[_0x11a6('0x3b')]['id']){delete _0x382182[_0x11a6('0x3b')]['id'];}return db['FaxQueue'][_0x11a6('0x33')]({'where':{'id':_0x382182[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x5f44c1,null))['then'](saveUpdates(_0x382182['body'],null))['then'](respondWithResult(_0x5f44c1,null))['catch'](handleError(_0x5f44c1,null));};exports[_0x11a6('0x16')]=function(_0x49d793,_0x37f804){return db[_0x11a6('0x1f')]['find']({'where':{'id':_0x49d793['params']['id']}})['then'](handleEntityNotFound(_0x37f804,null))[_0x11a6('0x15')](removeEntity(_0x37f804,null))[_0x11a6('0x34')](handleError(_0x37f804,null));};exports['describe']=function(_0x421f34,_0x523a0b){return db[_0x11a6('0x1f')]['describe']()[_0x11a6('0x15')](respondWithResult(_0x523a0b,null))[_0x11a6('0x34')](handleError(_0x523a0b,null));};exports['getMembers']=function(_0x40043f,_0x47c6a2){var _0xea018f={'raw':!![],'where':{}},_0x199e60={},_0x2a0ebc;return db[_0x11a6('0x1f')]['findOne']({'where':{'id':_0x40043f[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x47c6a2,null))[_0x11a6('0x15')](function(_0x22fe68){if(_0x22fe68){_0x2a0ebc=_0x22fe68[_0x11a6('0x17')]({'plain':!![]});_0x199e60[_0x11a6('0x2a')]=_['keys'](db[_0x11a6('0x3d')][_0x11a6('0x20')]);_0x199e60[_0x11a6('0x27')]=_['keys'](_0x40043f[_0x11a6('0x27')]);_0x199e60[_0x11a6('0x3e')]=_[_0x11a6('0x2c')](_0x199e60[_0x11a6('0x2a')],_0x199e60[_0x11a6('0x27')]);_0xea018f[_0x11a6('0x2d')]=_[_0x11a6('0x2c')](_0x199e60[_0x11a6('0x2a')],qs[_0x11a6('0x2e')](_0x40043f[_0x11a6('0x27')][_0x11a6('0x2e')]));_0xea018f[_0x11a6('0x2d')]=_0xea018f[_0x11a6('0x2d')][_0x11a6('0x2f')]?_0xea018f[_0x11a6('0x2d')]:_0x199e60[_0x11a6('0x2a')];if(!_0x40043f[_0x11a6('0x27')][_0x11a6('0x3f')]('nolimit')){_0xea018f[_0x11a6('0x40')]=qs['limit'](_0x40043f[_0x11a6('0x27')]['limit']);_0xea018f[_0x11a6('0xe')]=qs[_0x11a6('0xe')](_0x40043f[_0x11a6('0x27')][_0x11a6('0xe')]);}_0xea018f['order']=qs[_0x11a6('0x41')](_0x40043f[_0x11a6('0x27')]['sort']);_0xea018f[_0x11a6('0x25')]=qs[_0x11a6('0x3e')](_[_0x11a6('0x42')](_0x40043f[_0x11a6('0x27')],_0x199e60[_0x11a6('0x3e')]));_0xea018f['where'][_0x11a6('0x43')]=_0x22fe68['id'];if(_0x40043f[_0x11a6('0x27')][_0x11a6('0x44')]){_0xea018f[_0x11a6('0x25')]=_[_0x11a6('0x31')](_0xea018f['where'],{'$or':_[_0x11a6('0x1e')](_0xea018f[_0x11a6('0x2d')],function(_0x3ee886){var _0x439705={};_0x439705[_0x3ee886]={'$like':'%'+_0x40043f[_0x11a6('0x27')][_0x11a6('0x44')]+'%'};return _0x439705;})});}_0xea018f=_['merge']({},_0xea018f,_0x40043f[_0x11a6('0x32')]);return db[_0x11a6('0x3d')][_0x11a6('0x28')](_0xea018f);}})[_0x11a6('0x15')](function(_0x11f8a8){if(_0x11f8a8){return db[_0x11a6('0x45')][_0x11a6('0x46')]({'where':{'id':_[_0x11a6('0x1e')](_0x11f8a8,'UserId'),'role':_0x11a6('0x47')},'attributes':['id',_0x11a6('0x1b'),_0x11a6('0x48'),'updatedAt',_0x11a6('0x49')]});}})[_0x11a6('0x15')](function(_0x17852d){if(_0x17852d){return{'count':_0x17852d['count'],'rows':_[_0x11a6('0x1e')](_0x17852d[_0x11a6('0x4a')],function(_0x4535fb){return{'membername':_0x4535fb[_0x11a6('0x1b')],'UserId':_0x4535fb['id'],'queue_name':_0x2a0ebc[_0x11a6('0x1b')],'FaxQueueId':_0x2a0ebc['id'],'interface':util[_0x11a6('0x4b')]('%s/%s',_0x11a6('0x4c'),_0x4535fb[_0x11a6('0x1b')]),'penalty':0x0,'paused':_0x4535fb[_0x11a6('0x48')],'createdAt':_0x4535fb['createdAt'],'updatedAt':_0x4535fb[_0x11a6('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x11a6('0x15')](respondWithFilteredResult(_0x47c6a2,_0xea018f))[_0x11a6('0x34')](handleError(_0x47c6a2,null));};exports[_0x11a6('0x4e')]=function(_0x3caf2a,_0x55b76d){var _0x3cc318={};var _0x128a3d={};var _0x15a09c;var _0x10b050;return db[_0x11a6('0x1f')][_0x11a6('0x4f')]({'where':{'id':_0x3caf2a[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x55b76d,null))[_0x11a6('0x15')](function(_0x546630){if(_0x546630){_0x15a09c=_0x546630;_0x128a3d[_0x11a6('0x2a')]=_[_0x11a6('0x2b')](db[_0x11a6('0x50')][_0x11a6('0x20')]);_0x128a3d[_0x11a6('0x27')]=_[_0x11a6('0x2b')](_0x3caf2a[_0x11a6('0x27')]);_0x128a3d[_0x11a6('0x3e')]=_[_0x11a6('0x2c')](_0x128a3d[_0x11a6('0x2a')],_0x128a3d[_0x11a6('0x27')]);_0x3cc318[_0x11a6('0x2d')]=_['intersection'](_0x128a3d[_0x11a6('0x2a')],qs[_0x11a6('0x2e')](_0x3caf2a[_0x11a6('0x27')]['fields']));_0x3cc318[_0x11a6('0x2d')]=_0x3cc318[_0x11a6('0x2d')]['length']?_0x3cc318['attributes']:_0x128a3d['model'];_0x3cc318[_0x11a6('0x51')]=qs[_0x11a6('0x41')](_0x3caf2a[_0x11a6('0x27')][_0x11a6('0x41')]);_0x3cc318[_0x11a6('0x25')]=qs[_0x11a6('0x3e')](_[_0x11a6('0x42')](_0x3caf2a[_0x11a6('0x27')],_0x128a3d[_0x11a6('0x3e')]));if(_0x3caf2a[_0x11a6('0x27')]['filter']){_0x3cc318[_0x11a6('0x25')]=_[_0x11a6('0x31')](_0x3cc318[_0x11a6('0x25')],{'$or':_['map'](_0x3cc318[_0x11a6('0x2d')],function(_0x8e137f){var _0x2b43f4={};_0x2b43f4[_0x8e137f]={'$like':'%'+_0x3caf2a[_0x11a6('0x27')][_0x11a6('0x44')]+'%'};return _0x2b43f4;})});}_0x3cc318=_[_0x11a6('0x31')]({},_0x3cc318,_0x3caf2a[_0x11a6('0x32')]);return _0x15a09c[_0x11a6('0x4e')](_0x3cc318);}})[_0x11a6('0x15')](function(_0x58a438){if(_0x58a438){_0x10b050=_0x58a438[_0x11a6('0x2f')];if(!_0x3caf2a[_0x11a6('0x27')]['hasOwnProperty'](_0x11a6('0x52'))){_0x3cc318[_0x11a6('0x40')]=qs[_0x11a6('0x40')](_0x3caf2a[_0x11a6('0x27')][_0x11a6('0x40')]);_0x3cc318['offset']=qs[_0x11a6('0xe')](_0x3caf2a[_0x11a6('0x27')][_0x11a6('0xe')]);}return _0x15a09c[_0x11a6('0x4e')](_0x3cc318);}})[_0x11a6('0x15')](function(_0x4a8c4b){if(_0x4a8c4b){return _0x4a8c4b?{'count':_0x10b050,'rows':_0x4a8c4b}:null;}})[_0x11a6('0x15')](respondWithResult(_0x55b76d,null))['catch'](handleError(_0x55b76d,null));};exports['addTeams']=function(_0xbb6665,_0x3aadee){var _0x5c77f2=_0xbb6665[_0x11a6('0x3b')][_0x11a6('0x53')];return db[_0x11a6('0x50')][_0x11a6('0x28')]({'where':{'id':_0x5c77f2},'attributes':['id'],'include':[{'model':db[_0x11a6('0x45')],'as':'Agents','attributes':['id',_0x11a6('0x1b'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x3191f6){if(_0x3191f6){var _0x1eb3a1=_[_0x11a6('0x54')](_0x3191f6,function(_0x1429e2){var _0x3d0b30=_0x1429e2['get']({'plain':!![]});return _0x3d0b30[_0x11a6('0x55')];});return db[_0x11a6('0x1f')]['find']({'where':{'id':_0xbb6665[_0x11a6('0x3c')]['id']}})['then'](function(_0x21ddd5){return db[_0x11a6('0x56')][_0x11a6('0x57')](function(_0x877ff9){return _0x21ddd5['addTeams'](_0x5c77f2,{'transaction':_0x877ff9})[_0x11a6('0x15')](function(){return BPromise['each'](_0x1eb3a1,function(_0x3e6eaf){return db[_0x11a6('0x3d')][_0x11a6('0x58')]({'where':{'UserId':_0x3e6eaf['id'],'FaxQueueId':_0xbb6665[_0x11a6('0x3c')]['id']},'transaction':_0x877ff9});});})[_0x11a6('0x15')](function(){_0x1eb3a1['forEach'](function(_0xa36a6f){socket[_0x11a6('0x59')](_0x11a6('0x5a'),{'UserId':_0xa36a6f['id'],'FaxQueueId':_0x21ddd5['id']});});});});});}})[_0x11a6('0x15')](respondWithStatusCode(_0x3aadee,null))[_0x11a6('0x34')](handleError(_0x3aadee,null));};exports[_0x11a6('0x5b')]=function(_0x370faf,_0xe1990f){return db[_0x11a6('0x50')][_0x11a6('0x28')]({'where':{'id':_0x370faf['query'][_0x11a6('0x53')]},'attributes':['id'],'include':[{'model':db[_0x11a6('0x45')],'as':_0x11a6('0x55'),'attributes':['id'],'raw':!![]}]})[_0x11a6('0x15')](handleEntityNotFound(_0xe1990f,null))['then'](function(_0x32fe09){var _0x425160=_[_0x11a6('0x1e')](_0x32fe09,'id');var _0x5251dc=[];var _0xa187f=[];var _0x39fbfc=squel[_0x11a6('0x5c')]();_0x39fbfc[_0x11a6('0x5d')](_0x11a6('0x5e'))[_0x11a6('0x5f')](_0x11a6('0x60'),'tq')[_0x11a6('0x61')](_0x11a6('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x11a6('0x63'),_0x370faf[_0x11a6('0x3c')]['id']);for(var _0x188bdc=0x0;_0x188bdc<_0x32fe09[_0x11a6('0x2f')];_0x188bdc+=0x1){let _0x2e829a=_0x32fe09[_0x188bdc];for(var _0x20a3f4=0x0;_0x20a3f4<_0x2e829a[_0x11a6('0x55')][_0x11a6('0x2f')];_0x20a3f4+=0x1){let _0x2d2c57=_0x2e829a[_0x11a6('0x55')][_0x20a3f4];var _0x5bacc0=_0x39fbfc[_0x11a6('0x64')]();_0x5bacc0[_0x11a6('0x25')]('ut.UserId\x20=\x20?',_0x2d2c57['id']);_0xa187f[_0x11a6('0x65')](db['sequelize'][_0x11a6('0x27')](_0x5bacc0['toString'](),{'type':db['sequelize'][_0x11a6('0x66')][_0x11a6('0x67')]})[_0x11a6('0x15')](function(_0x4408bd){if(_0x4408bd[_0x11a6('0x2f')]===0x1){return _0x2d2c57['id'];}else{var _0x669583=_[_0x11a6('0x68')](_[_0x11a6('0x1e')](_0x4408bd,_0x11a6('0x69')),function(_0x31faa5){return _['includes'](_0x425160,_0x31faa5);});if(_0x669583){return _0x2d2c57['id'];}}}));}}return BPromise[_0x11a6('0x6a')](_0xa187f)[_0x11a6('0x15')](function(_0x4d01b7){_0x5251dc=_(_0x5251dc)[_0x11a6('0x6b')](_0x4d01b7)[_0x11a6('0x6c')]()[_0x11a6('0x6d')]();return db[_0x11a6('0x1f')][_0x11a6('0x33')]({'where':{'id':_0x370faf[_0x11a6('0x3c')]['id']}})['then'](function(_0x1c71f0){return db[_0x11a6('0x56')]['transaction'](function(_0x3ef395){return _0x1c71f0[_0x11a6('0x5b')](_0x370faf[_0x11a6('0x27')]['ids'],{'transaction':_0x3ef395})[_0x11a6('0x15')](function(){if(!_[_0x11a6('0x6e')](_0x5251dc)){return _0x1c71f0[_0x11a6('0x6f')](_0x5251dc,{'transaction':_0x3ef395});}})[_0x11a6('0x15')](function(){_0x5251dc[_0x11a6('0x70')](function(_0x1ee011){socket[_0x11a6('0x59')](_0x11a6('0x71'),{'UserId':_0x1ee011,'FaxQueueId':_0x1c71f0['id']});});});});});});})['then'](respondWithStatusCode(_0xe1990f,null))['catch'](handleError(_0xe1990f,null));};exports[_0x11a6('0x72')]=function(_0x2fa6d8,_0x21384e){return db[_0x11a6('0x1f')][_0x11a6('0x33')]({'where':{'id':_0x2fa6d8['params']['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x21384e,null))[_0x11a6('0x15')](function(_0x3e2ab0){if(_0x3e2ab0){return _0x3e2ab0[_0x11a6('0x72')](_0x2fa6d8[_0x11a6('0x3b')]['ids'],_[_0x11a6('0x73')](_0x2fa6d8[_0x11a6('0x3b')],[_0x11a6('0x53'),'id'])||{})[_0x11a6('0x74')](function(_0x448248){for(var _0x9d49bb=0x0;_0x9d49bb<_0x2fa6d8[_0x11a6('0x3b')][_0x11a6('0x53')]['length'];_0x9d49bb+=0x1){socket[_0x11a6('0x59')](_0x11a6('0x5a'),{'UserId':Number(_0x2fa6d8[_0x11a6('0x3b')][_0x11a6('0x53')][_0x9d49bb]),'FaxQueueId':Number(_0x2fa6d8['params']['id'])});}return _0x448248;});}})[_0x11a6('0x15')](respondWithResult(_0x21384e,null))[_0x11a6('0x34')](handleError(_0x21384e,null));};exports[_0x11a6('0x6f')]=function(_0x2a20e4,_0x5b19be){return db['FaxQueue'][_0x11a6('0x33')]({'where':{'id':_0x2a20e4[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x5b19be,null))['then'](function(_0x2461e3){if(_0x2461e3){return _0x2461e3['removeAgents'](_0x2a20e4[_0x11a6('0x27')][_0x11a6('0x53')])[_0x11a6('0x15')](function(){if(_['isArray'](_0x2a20e4[_0x11a6('0x27')][_0x11a6('0x53')])){for(var _0x2568fd=0x0;_0x2568fd<_0x2a20e4['query']['ids'][_0x11a6('0x2f')];_0x2568fd+=0x1){socket[_0x11a6('0x59')]('userFaxQueue:remove',{'UserId':Number(_0x2a20e4[_0x11a6('0x27')][_0x11a6('0x53')][_0x2568fd]),'FaxQueueId':Number(_0x2a20e4[_0x11a6('0x3c')]['id'])});}}else{socket[_0x11a6('0x59')](_0x11a6('0x71'),{'UserId':Number(_0x2a20e4['query'][_0x11a6('0x53')]),'FaxQueueId':Number(_0x2a20e4[_0x11a6('0x3c')]['id'])});}});}})[_0x11a6('0x15')](respondWithStatusCode(_0x5b19be,null))[_0x11a6('0x34')](handleError(_0x5b19be,null));};exports[_0x11a6('0x75')]=function(_0x4593cc,_0x1b5e41){var _0x2df6b9={};var _0x4a0255={};var _0x41c118;var _0x4528a8;return db['FaxQueue'][_0x11a6('0x4f')]({'where':{'id':_0x4593cc[_0x11a6('0x3c')]['id']}})[_0x11a6('0x15')](handleEntityNotFound(_0x1b5e41,null))[_0x11a6('0x15')](function(_0x1c3539){if(_0x1c3539){_0x41c118=_0x1c3539;_0x4a0255[_0x11a6('0x2a')]=_[_0x11a6('0x2b')](db['User'][_0x11a6('0x20')]);_0x4a0255['query']=_['keys'](_0x4593cc[_0x11a6('0x27')]);_0x4a0255[_0x11a6('0x3e')]=_[_0x11a6('0x2c')](_0x4a0255[_0x11a6('0x2a')],_0x4a0255[_0x11a6('0x27')]);_0x2df6b9['attributes']=_[_0x11a6('0x2c')](_0x4a0255[_0x11a6('0x2a')],qs[_0x11a6('0x2e')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0x2e')]));_0x2df6b9[_0x11a6('0x2d')]=_0x2df6b9['attributes'][_0x11a6('0x2f')]?_0x2df6b9[_0x11a6('0x2d')]:_0x4a0255['model'];_0x2df6b9[_0x11a6('0x51')]=qs[_0x11a6('0x41')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0x41')]);_0x2df6b9[_0x11a6('0x25')]=qs['filters'](_[_0x11a6('0x42')](_0x4593cc[_0x11a6('0x27')],_0x4a0255[_0x11a6('0x3e')]));if(_0x4593cc[_0x11a6('0x27')][_0x11a6('0x44')]){_0x2df6b9[_0x11a6('0x25')]=_[_0x11a6('0x31')](_0x2df6b9[_0x11a6('0x25')],{'$or':_[_0x11a6('0x1e')](_0x2df6b9[_0x11a6('0x2d')],function(_0x4e3793){var _0x53720a={};_0x53720a[_0x4e3793]={'$like':'%'+_0x4593cc[_0x11a6('0x27')][_0x11a6('0x44')]+'%'};return _0x53720a;})});}_0x2df6b9=_['merge']({},_0x2df6b9,_0x4593cc['options']);return _0x41c118[_0x11a6('0x75')](_0x2df6b9);}})[_0x11a6('0x15')](function(_0x229822){if(_0x229822){_0x4528a8=_0x229822['length'];if(!_0x4593cc[_0x11a6('0x27')][_0x11a6('0x3f')](_0x11a6('0x52'))){_0x2df6b9['limit']=qs[_0x11a6('0x40')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0x40')]);_0x2df6b9[_0x11a6('0xe')]=qs[_0x11a6('0xe')](_0x4593cc[_0x11a6('0x27')][_0x11a6('0xe')]);}return _0x41c118[_0x11a6('0x75')](_0x2df6b9);}})[_0x11a6('0x15')](function(_0x314440){if(_0x314440){return _0x314440?{'count':_0x4528a8,'rows':_0x314440}:null;}})[_0x11a6('0x15')](respondWithResult(_0x1b5e41,null))[_0x11a6('0x34')](handleError(_0x1b5e41,null));}; \ No newline at end of file +var _0x5f6f=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','map','FaxQueue','rawAttributes','type','key','include','rows','show','params','model','keys','query','filters','fields','attributes','length','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserFaxQueue','intersection','hasOwnProperty','order','sort','where','pick','FaxQueueId','filter','merge','options','findAll','UserId','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','addTeams','ids','User','online','transaction','each','findOrCreate','userFaxQueue:save','Agents','team_has_fax_queues'];(function(_0x42b59b,_0x59f31b){var _0x2e56ab=function(_0x3cfff2){while(--_0x3cfff2){_0x42b59b['push'](_0x42b59b['shift']());}};_0x2e56ab(++_0x59f31b);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x5f6f[_0x488ca1];return _0x4dd0a4;};'use strict';var BPromise=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var _=require(_0xf5f6('0x2'));var squel=require(_0xf5f6('0x3'));var Redis=require(_0xf5f6('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xf5f6('0x5'))(_0xf5f6('0x6'));var config=require(_0xf5f6('0x7'));var db=require('../../mysqldb')['db'];config[_0xf5f6('0x8')]=_[_0xf5f6('0x9')](config[_0xf5f6('0x8')],{'host':_0xf5f6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf5f6('0xb'))[_0xf5f6('0xc')](socket);function respondWithStatusCode(_0x22f837,_0x477de9){_0x477de9=_0x477de9||0xcc;return function(_0x27b318){if(_0x27b318){return _0x22f837[_0xf5f6('0xd')](_0x477de9);}return _0x22f837['status'](_0x477de9)['end']();};}function respondWithResult(_0x988c4a,_0x369b18){_0x369b18=_0x369b18||0xc8;return function(_0x491c14){if(_0x491c14){return _0x988c4a[_0xf5f6('0xe')](_0x369b18)[_0xf5f6('0xf')](_0x491c14);}};}function respondWithFilteredResult(_0xeb94fb,_0x243ce4){return function(_0x1e5654){if(_0x1e5654){var _0x5e83d5=typeof _0x243ce4[_0xf5f6('0x10')]==='undefined'&&typeof _0x243ce4[_0xf5f6('0x11')]===_0xf5f6('0x12');var _0x1441ae=_0x1e5654[_0xf5f6('0x13')];var _0x52648d=_0x5e83d5?0x0:_0x243ce4[_0xf5f6('0x10')];var _0x33cc8a=_0x5e83d5?_0x1e5654[_0xf5f6('0x13')]:_0x243ce4[_0xf5f6('0x10')]+_0x243ce4['limit'];var _0x1e3037;if(_0x33cc8a>=_0x1441ae){_0x33cc8a=_0x1441ae;_0x1e3037=0xc8;}else{_0x1e3037=0xce;}_0xeb94fb[_0xf5f6('0xe')](_0x1e3037);return _0xeb94fb[_0xf5f6('0x14')](_0xf5f6('0x15'),_0x52648d+'-'+_0x33cc8a+'/'+_0x1441ae)['json'](_0x1e5654);}return null;};}function saveUpdates(_0x5bc2dc){return function(_0x11d782){if(_0x11d782){return _0x11d782['update'](_0x5bc2dc)[_0xf5f6('0x16')](function(_0x4dd3ae){return _0x4dd3ae;});}return null;};}function removeEntity(_0x33612a){return function(_0x294af2){if(_0x294af2){return _0x294af2[_0xf5f6('0x17')]()[_0xf5f6('0x16')](function(){var _0x20aa6e=_0x294af2[_0xf5f6('0x18')]({'plain':!![]});var _0x55866e=_0xf5f6('0x19');return db[_0xf5f6('0x1a')][_0xf5f6('0x17')]({'where':{'type':_0x55866e,'resourceId':_0x20aa6e['id']}})[_0xf5f6('0x16')](function(){return _0x294af2;});})[_0xf5f6('0x16')](function(){_0x33612a['status'](0xcc)[_0xf5f6('0x1b')]();});}};}function handleEntityNotFound(_0x444856){return function(_0x22e569){if(!_0x22e569){_0x444856['sendStatus'](0x194);}return _0x22e569;};}function handleError(_0x253b42,_0x32f27e){_0x32f27e=_0x32f27e||0x1f4;return function(_0x1a6fc3){logger[_0xf5f6('0x1c')](_0x1a6fc3[_0xf5f6('0x1d')]);if(_0x1a6fc3['name']){delete _0x1a6fc3[_0xf5f6('0x1e')];}_0x253b42[_0xf5f6('0xe')](_0x32f27e)[_0xf5f6('0x1f')](_0x1a6fc3);};}exports['index']=function(_0x31d0fb,_0x3497a0){var _0x9500e5={};var _0x4db805={'count':0x0,'rows':[]};var _0x537a81=_[_0xf5f6('0x20')](db[_0xf5f6('0x21')][_0xf5f6('0x22')],function(_0x265457){return{'name':_0x265457['fieldName'],'type':_0x265457[_0xf5f6('0x23')][_0xf5f6('0x24')]};});_0x9500e5=qs['getOptions'](_0x537a81,_0x31d0fb);var _0x1c171f={'where':_0x9500e5['where']};return db[_0xf5f6('0x21')][_0xf5f6('0x13')](_0x1c171f)['then'](function(_0x3e66b9){_0x4db805[_0xf5f6('0x13')]=_0x3e66b9;_0x9500e5[_0xf5f6('0x25')]=qs[_0xf5f6('0x25')](_0x31d0fb['query']);return db[_0xf5f6('0x21')]['findAll'](_0x9500e5);})[_0xf5f6('0x16')](function(_0x301a59){_0x4db805[_0xf5f6('0x26')]=_0x301a59;return _0x4db805;})[_0xf5f6('0x16')](respondWithFilteredResult(_0x3497a0,_0x9500e5))['catch'](handleError(_0x3497a0,null));};exports[_0xf5f6('0x27')]=function(_0x5166d6,_0x2e532b){var _0x1dd7af={'raw':!![],'where':{'id':_0x5166d6[_0xf5f6('0x28')]['id']}},_0x58f2b9={};_0x58f2b9[_0xf5f6('0x29')]=_[_0xf5f6('0x2a')](db[_0xf5f6('0x21')][_0xf5f6('0x22')]);_0x58f2b9[_0xf5f6('0x2b')]=_[_0xf5f6('0x2a')](_0x5166d6['query']);_0x58f2b9[_0xf5f6('0x2c')]=_['intersection'](_0x58f2b9[_0xf5f6('0x29')],_0x58f2b9[_0xf5f6('0x2b')]);_0x1dd7af['attributes']=_['intersection'](_0x58f2b9[_0xf5f6('0x29')],qs[_0xf5f6('0x2d')](_0x5166d6[_0xf5f6('0x2b')][_0xf5f6('0x2d')]));_0x1dd7af[_0xf5f6('0x2e')]=_0x1dd7af[_0xf5f6('0x2e')][_0xf5f6('0x2f')]?_0x1dd7af[_0xf5f6('0x2e')]:_0x58f2b9['model'];if(_0x5166d6[_0xf5f6('0x2b')][_0xf5f6('0x30')]){_0x1dd7af[_0xf5f6('0x25')]=[{'all':!![]}];}_0x1dd7af=_['merge']({},_0x1dd7af,_0x5166d6['options']);return db[_0xf5f6('0x21')]['find'](_0x1dd7af)['then'](handleEntityNotFound(_0x2e532b,null))[_0xf5f6('0x16')](respondWithResult(_0x2e532b,null))[_0xf5f6('0x31')](handleError(_0x2e532b,null));};exports[_0xf5f6('0x32')]=function(_0x57ffab,_0x28cdbe){return db[_0xf5f6('0x21')]['create'](_0x57ffab[_0xf5f6('0x33')],{})['then'](function(_0x5bab69){var _0x1e1037=_0x57ffab['user']['get']({'plain':!![]});if(!_0x1e1037)throw new Error(_0xf5f6('0x34'));if(_0x1e1037[_0xf5f6('0x35')]===_0xf5f6('0x36')){var _0x5760f6=_0x5bab69['get']({'plain':!![]});var _0x2e7742=_0xf5f6('0x19');return db[_0xf5f6('0x37')]['find']({'where':{'name':_0x2e7742,'userProfileId':_0x1e1037[_0xf5f6('0x38')]},'raw':!![]})[_0xf5f6('0x16')](function(_0x1e138c){if(_0x1e138c&&_0x1e138c[_0xf5f6('0x39')]===0x0){return db[_0xf5f6('0x1a')][_0xf5f6('0x32')]({'name':_0x5760f6[_0xf5f6('0x1e')],'resourceId':_0x5760f6['id'],'type':_0x1e138c[_0xf5f6('0x1e')],'sectionId':_0x1e138c['id']},{})[_0xf5f6('0x16')](function(){return _0x5bab69;});}else{return _0x5bab69;}})['catch'](function(_0xc344b3){logger[_0xf5f6('0x1c')](_0xf5f6('0x3a'),_0xc344b3);throw _0xc344b3;});}return _0x5bab69;})[_0xf5f6('0x16')](respondWithResult(_0x28cdbe,0xc9))[_0xf5f6('0x31')](handleError(_0x28cdbe,null));};exports[_0xf5f6('0x3b')]=function(_0x13ba96,_0x26b6d5){if(_0x13ba96[_0xf5f6('0x33')]['id']){delete _0x13ba96[_0xf5f6('0x33')]['id'];}return db[_0xf5f6('0x21')]['find']({'where':{'id':_0x13ba96[_0xf5f6('0x28')]['id']}})[_0xf5f6('0x16')](handleEntityNotFound(_0x26b6d5,null))[_0xf5f6('0x16')](saveUpdates(_0x13ba96['body'],null))[_0xf5f6('0x16')](respondWithResult(_0x26b6d5,null))[_0xf5f6('0x31')](handleError(_0x26b6d5,null));};exports['destroy']=function(_0x933399,_0x4abbcc){return db['FaxQueue'][_0xf5f6('0x3c')]({'where':{'id':_0x933399[_0xf5f6('0x28')]['id']}})[_0xf5f6('0x16')](handleEntityNotFound(_0x4abbcc,null))['then'](removeEntity(_0x4abbcc,null))[_0xf5f6('0x31')](handleError(_0x4abbcc,null));};exports[_0xf5f6('0x3d')]=function(_0x45f938,_0x518bf4){return db[_0xf5f6('0x21')]['describe']()[_0xf5f6('0x16')](respondWithResult(_0x518bf4,null))['catch'](handleError(_0x518bf4,null));};exports[_0xf5f6('0x3e')]=function(_0x36dc5a,_0x25893b){var _0x1edd4f={'raw':!![],'where':{}},_0x1696c3={},_0x557403;return db['FaxQueue'][_0xf5f6('0x3f')]({'where':{'id':_0x36dc5a['params']['id']}})[_0xf5f6('0x16')](handleEntityNotFound(_0x25893b,null))[_0xf5f6('0x16')](function(_0x2f5d54){if(_0x2f5d54){_0x557403=_0x2f5d54['get']({'plain':!![]});_0x1696c3[_0xf5f6('0x29')]=_[_0xf5f6('0x2a')](db[_0xf5f6('0x40')][_0xf5f6('0x22')]);_0x1696c3[_0xf5f6('0x2b')]=_[_0xf5f6('0x2a')](_0x36dc5a['query']);_0x1696c3[_0xf5f6('0x2c')]=_[_0xf5f6('0x41')](_0x1696c3['model'],_0x1696c3[_0xf5f6('0x2b')]);_0x1edd4f[_0xf5f6('0x2e')]=_[_0xf5f6('0x41')](_0x1696c3[_0xf5f6('0x29')],qs[_0xf5f6('0x2d')](_0x36dc5a[_0xf5f6('0x2b')][_0xf5f6('0x2d')]));_0x1edd4f[_0xf5f6('0x2e')]=_0x1edd4f['attributes'][_0xf5f6('0x2f')]?_0x1edd4f['attributes']:_0x1696c3[_0xf5f6('0x29')];if(!_0x36dc5a[_0xf5f6('0x2b')][_0xf5f6('0x42')]('nolimit')){_0x1edd4f[_0xf5f6('0x11')]=qs[_0xf5f6('0x11')](_0x36dc5a[_0xf5f6('0x2b')]['limit']);_0x1edd4f[_0xf5f6('0x10')]=qs[_0xf5f6('0x10')](_0x36dc5a[_0xf5f6('0x2b')][_0xf5f6('0x10')]);}_0x1edd4f[_0xf5f6('0x43')]=qs[_0xf5f6('0x44')](_0x36dc5a[_0xf5f6('0x2b')]['sort']);_0x1edd4f[_0xf5f6('0x45')]=qs[_0xf5f6('0x2c')](_[_0xf5f6('0x46')](_0x36dc5a['query'],_0x1696c3[_0xf5f6('0x2c')]));_0x1edd4f['where'][_0xf5f6('0x47')]=_0x2f5d54['id'];if(_0x36dc5a[_0xf5f6('0x2b')][_0xf5f6('0x48')]){_0x1edd4f[_0xf5f6('0x45')]=_[_0xf5f6('0x49')](_0x1edd4f[_0xf5f6('0x45')],{'$or':_[_0xf5f6('0x20')](_0x1edd4f[_0xf5f6('0x2e')],function(_0x986e43){var _0x26ab99={};_0x26ab99[_0x986e43]={'$like':'%'+_0x36dc5a[_0xf5f6('0x2b')][_0xf5f6('0x48')]+'%'};return _0x26ab99;})});}_0x1edd4f=_[_0xf5f6('0x49')]({},_0x1edd4f,_0x36dc5a[_0xf5f6('0x4a')]);return db[_0xf5f6('0x40')][_0xf5f6('0x4b')](_0x1edd4f);}})[_0xf5f6('0x16')](function(_0x8ce5c9){if(_0x8ce5c9){return db['User']['findAndCountAll']({'where':{'id':_[_0xf5f6('0x20')](_0x8ce5c9,_0xf5f6('0x4c')),'role':'agent'},'attributes':['id','name',_0xf5f6('0x4d'),_0xf5f6('0x4e'),_0xf5f6('0x4f')]});}})[_0xf5f6('0x16')](function(_0x1c9c67){if(_0x1c9c67){return{'count':_0x1c9c67[_0xf5f6('0x13')],'rows':_[_0xf5f6('0x20')](_0x1c9c67[_0xf5f6('0x26')],function(_0x32bc45){return{'membername':_0x32bc45[_0xf5f6('0x1e')],'UserId':_0x32bc45['id'],'queue_name':_0x557403[_0xf5f6('0x1e')],'FaxQueueId':_0x557403['id'],'interface':util[_0xf5f6('0x50')]('%s/%s',_0xf5f6('0x51'),_0x32bc45[_0xf5f6('0x1e')]),'penalty':0x0,'paused':_0x32bc45[_0xf5f6('0x4d')],'createdAt':_0x32bc45[_0xf5f6('0x4f')],'updatedAt':_0x32bc45[_0xf5f6('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f6('0x16')](respondWithFilteredResult(_0x25893b,_0x1edd4f))[_0xf5f6('0x31')](handleError(_0x25893b,null));};exports[_0xf5f6('0x52')]=function(_0x4f754c,_0x2f6b7d){var _0x595d5c={};var _0x47e005={};var _0x3019ec;var _0x4f92e6;return db[_0xf5f6('0x21')]['findOne']({'where':{'id':_0x4f754c[_0xf5f6('0x28')]['id']}})[_0xf5f6('0x16')](handleEntityNotFound(_0x2f6b7d,null))[_0xf5f6('0x16')](function(_0x1af752){if(_0x1af752){_0x3019ec=_0x1af752;_0x47e005[_0xf5f6('0x29')]=_['keys'](db[_0xf5f6('0x53')][_0xf5f6('0x22')]);_0x47e005[_0xf5f6('0x2b')]=_[_0xf5f6('0x2a')](_0x4f754c[_0xf5f6('0x2b')]);_0x47e005[_0xf5f6('0x2c')]=_[_0xf5f6('0x41')](_0x47e005[_0xf5f6('0x29')],_0x47e005['query']);_0x595d5c[_0xf5f6('0x2e')]=_[_0xf5f6('0x41')](_0x47e005[_0xf5f6('0x29')],qs[_0xf5f6('0x2d')](_0x4f754c[_0xf5f6('0x2b')][_0xf5f6('0x2d')]));_0x595d5c[_0xf5f6('0x2e')]=_0x595d5c[_0xf5f6('0x2e')][_0xf5f6('0x2f')]?_0x595d5c[_0xf5f6('0x2e')]:_0x47e005[_0xf5f6('0x29')];_0x595d5c['order']=qs[_0xf5f6('0x44')](_0x4f754c['query'][_0xf5f6('0x44')]);_0x595d5c[_0xf5f6('0x45')]=qs['filters'](_[_0xf5f6('0x46')](_0x4f754c['query'],_0x47e005[_0xf5f6('0x2c')]));if(_0x4f754c[_0xf5f6('0x2b')]['filter']){_0x595d5c[_0xf5f6('0x45')]=_[_0xf5f6('0x49')](_0x595d5c[_0xf5f6('0x45')],{'$or':_[_0xf5f6('0x20')](_0x595d5c['attributes'],function(_0x298044){var _0x5d80c8={};_0x5d80c8[_0x298044]={'$like':'%'+_0x4f754c['query'][_0xf5f6('0x48')]+'%'};return _0x5d80c8;})});}_0x595d5c=_[_0xf5f6('0x49')]({},_0x595d5c,_0x4f754c[_0xf5f6('0x4a')]);return _0x3019ec['getTeams'](_0x595d5c);}})[_0xf5f6('0x16')](function(_0x2d4b50){if(_0x2d4b50){_0x4f92e6=_0x2d4b50['length'];if(!_0x4f754c['query'][_0xf5f6('0x42')](_0xf5f6('0x54'))){_0x595d5c[_0xf5f6('0x11')]=qs[_0xf5f6('0x11')](_0x4f754c['query']['limit']);_0x595d5c[_0xf5f6('0x10')]=qs[_0xf5f6('0x10')](_0x4f754c['query'][_0xf5f6('0x10')]);}return _0x3019ec[_0xf5f6('0x52')](_0x595d5c);}})[_0xf5f6('0x16')](function(_0x47955f){if(_0x47955f){return _0x47955f?{'count':_0x4f92e6,'rows':_0x47955f}:null;}})['then'](respondWithResult(_0x2f6b7d,null))[_0xf5f6('0x31')](handleError(_0x2f6b7d,null));};exports[_0xf5f6('0x55')]=function(_0x15f696,_0x528938){var _0x16e6a1=_0x15f696['body'][_0xf5f6('0x56')];return db[_0xf5f6('0x53')][_0xf5f6('0x4b')]({'where':{'id':_0x16e6a1},'attributes':['id'],'include':[{'model':db[_0xf5f6('0x57')],'as':'Agents','attributes':['id',_0xf5f6('0x1e'),_0xf5f6('0x58'),'voicePause','interface'],'raw':!![]}]})[_0xf5f6('0x16')](function(_0x459e7f){if(_0x459e7f){var _0x5f3abc=_['flatMap'](_0x459e7f,function(_0x43c429){var _0x29c724=_0x43c429[_0xf5f6('0x18')]({'plain':!![]});return _0x29c724['Agents'];});return db['FaxQueue'][_0xf5f6('0x3c')]({'where':{'id':_0x15f696[_0xf5f6('0x28')]['id']}})[_0xf5f6('0x16')](function(_0x5b57b4){return db['sequelize'][_0xf5f6('0x59')](function(_0x36fa60){return _0x5b57b4[_0xf5f6('0x55')](_0x16e6a1,{'transaction':_0x36fa60})['then'](function(){return BPromise[_0xf5f6('0x5a')](_0x5f3abc,function(_0x3a3d94){return db[_0xf5f6('0x40')][_0xf5f6('0x5b')]({'where':{'UserId':_0x3a3d94['id'],'FaxQueueId':_0x15f696[_0xf5f6('0x28')]['id']},'transaction':_0x36fa60});});})[_0xf5f6('0x16')](function(){_0x5f3abc['forEach'](function(_0x51f475){socket['emit'](_0xf5f6('0x5c'),{'UserId':_0x51f475['id'],'FaxQueueId':_0x5b57b4['id']});});});});});}})[_0xf5f6('0x16')](respondWithStatusCode(_0x528938,null))[_0xf5f6('0x31')](handleError(_0x528938,null));};exports['removeTeams']=function(_0x204cbf,_0x2df866){return db['Team'][_0xf5f6('0x4b')]({'where':{'id':_0x204cbf[_0xf5f6('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf5f6('0x57')],'as':_0xf5f6('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xf5f6('0x16')](handleEntityNotFound(_0x2df866,null))['then'](function(_0x22c82d){var _0x2bafa1=_[_0xf5f6('0x20')](_0x22c82d,'id');var _0x15f1cc=[];var _0x18e397=[];var _0x3cae84=squel['select']();_0x3cae84['field']('tq.TeamId')['from'](_0xf5f6('0x5e'),'tq')[_0xf5f6('0x5f')](_0xf5f6('0x60'),'ut',_0xf5f6('0x61'))['where']('FaxQueueId\x20=\x20?',_0x204cbf['params']['id']);for(var _0x173fab=0x0;_0x173fab<_0x22c82d[_0xf5f6('0x2f')];_0x173fab+=0x1){let _0x42924e=_0x22c82d[_0x173fab];for(var _0x2d640d=0x0;_0x2d640d<_0x42924e[_0xf5f6('0x5d')][_0xf5f6('0x2f')];_0x2d640d+=0x1){let _0x187150=_0x42924e[_0xf5f6('0x5d')][_0x2d640d];var _0x30fc2e=_0x3cae84[_0xf5f6('0x62')]();_0x30fc2e['where']('ut.UserId\x20=\x20?',_0x187150['id']);_0x18e397[_0xf5f6('0x63')](db[_0xf5f6('0x64')]['query'](_0x30fc2e[_0xf5f6('0x65')](),{'type':db[_0xf5f6('0x64')][_0xf5f6('0x66')]['SELECT']})[_0xf5f6('0x16')](function(_0x5dc781){if(_0x5dc781[_0xf5f6('0x2f')]===0x1){return _0x187150['id'];}else{var _0x47eec0=_[_0xf5f6('0x67')](_['map'](_0x5dc781,_0xf5f6('0x68')),function(_0x268bd6){return _[_0xf5f6('0x69')](_0x2bafa1,_0x268bd6);});if(_0x47eec0){return _0x187150['id'];}}}));}}return BPromise[_0xf5f6('0x6a')](_0x18e397)[_0xf5f6('0x16')](function(_0x4c94de){_0x15f1cc=_(_0x15f1cc)['union'](_0x4c94de)[_0xf5f6('0x6b')]()[_0xf5f6('0x6c')]();return db[_0xf5f6('0x21')][_0xf5f6('0x3c')]({'where':{'id':_0x204cbf[_0xf5f6('0x28')]['id']}})[_0xf5f6('0x16')](function(_0x290652){return db[_0xf5f6('0x64')]['transaction'](function(_0x5169bf){return _0x290652[_0xf5f6('0x6d')](_0x204cbf[_0xf5f6('0x2b')]['ids'],{'transaction':_0x5169bf})['then'](function(){if(!_[_0xf5f6('0x6e')](_0x15f1cc)){return _0x290652[_0xf5f6('0x6f')](_0x15f1cc,{'transaction':_0x5169bf});}})[_0xf5f6('0x16')](function(){_0x15f1cc[_0xf5f6('0x70')](function(_0x294a57){socket[_0xf5f6('0x71')](_0xf5f6('0x72'),{'UserId':_0x294a57,'FaxQueueId':_0x290652['id']});});});});});});})['then'](respondWithStatusCode(_0x2df866,null))[_0xf5f6('0x31')](handleError(_0x2df866,null));};exports[_0xf5f6('0x73')]=function(_0x5e539c,_0x356b88){return db[_0xf5f6('0x21')]['find']({'where':{'id':_0x5e539c[_0xf5f6('0x28')]['id']}})[_0xf5f6('0x16')](handleEntityNotFound(_0x356b88,null))[_0xf5f6('0x16')](function(_0x47ba4b){if(_0x47ba4b){return _0x47ba4b[_0xf5f6('0x73')](_0x5e539c[_0xf5f6('0x33')][_0xf5f6('0x56')],_['omit'](_0x5e539c['body'],[_0xf5f6('0x56'),'id'])||{})['spread'](function(_0x269707){for(var _0x59958b=0x0;_0x59958b<_0x5e539c[_0xf5f6('0x33')][_0xf5f6('0x56')][_0xf5f6('0x2f')];_0x59958b+=0x1){socket[_0xf5f6('0x71')](_0xf5f6('0x5c'),{'UserId':Number(_0x5e539c[_0xf5f6('0x33')][_0xf5f6('0x56')][_0x59958b]),'FaxQueueId':Number(_0x5e539c[_0xf5f6('0x28')]['id'])});}return _0x269707;});}})[_0xf5f6('0x16')](respondWithResult(_0x356b88,null))[_0xf5f6('0x31')](handleError(_0x356b88,null));};exports[_0xf5f6('0x6f')]=function(_0x59a0d0,_0x4d76d6){return db[_0xf5f6('0x21')][_0xf5f6('0x3c')]({'where':{'id':_0x59a0d0[_0xf5f6('0x28')]['id']}})[_0xf5f6('0x16')](handleEntityNotFound(_0x4d76d6,null))['then'](function(_0x3a30fa){if(_0x3a30fa){return _0x3a30fa[_0xf5f6('0x6f')](_0x59a0d0[_0xf5f6('0x2b')][_0xf5f6('0x56')])[_0xf5f6('0x16')](function(){if(_[_0xf5f6('0x74')](_0x59a0d0[_0xf5f6('0x2b')]['ids'])){for(var _0x4a0854=0x0;_0x4a0854<_0x59a0d0[_0xf5f6('0x2b')]['ids'][_0xf5f6('0x2f')];_0x4a0854+=0x1){socket[_0xf5f6('0x71')](_0xf5f6('0x72'),{'UserId':Number(_0x59a0d0[_0xf5f6('0x2b')][_0xf5f6('0x56')][_0x4a0854]),'FaxQueueId':Number(_0x59a0d0['params']['id'])});}}else{socket[_0xf5f6('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x59a0d0[_0xf5f6('0x2b')][_0xf5f6('0x56')]),'FaxQueueId':Number(_0x59a0d0[_0xf5f6('0x28')]['id'])});}});}})[_0xf5f6('0x16')](respondWithStatusCode(_0x4d76d6,null))[_0xf5f6('0x31')](handleError(_0x4d76d6,null));};exports[_0xf5f6('0x75')]=function(_0x5ae1e4,_0x24a269){var _0x104e6c={};var _0x5cc42c={};var _0x181f18;var _0x260376;return db[_0xf5f6('0x21')][_0xf5f6('0x3f')]({'where':{'id':_0x5ae1e4[_0xf5f6('0x28')]['id']}})['then'](handleEntityNotFound(_0x24a269,null))[_0xf5f6('0x16')](function(_0x5b6035){if(_0x5b6035){_0x181f18=_0x5b6035;_0x5cc42c[_0xf5f6('0x29')]=_[_0xf5f6('0x2a')](db['User'][_0xf5f6('0x22')]);_0x5cc42c[_0xf5f6('0x2b')]=_[_0xf5f6('0x2a')](_0x5ae1e4[_0xf5f6('0x2b')]);_0x5cc42c['filters']=_[_0xf5f6('0x41')](_0x5cc42c['model'],_0x5cc42c['query']);_0x104e6c['attributes']=_[_0xf5f6('0x41')](_0x5cc42c[_0xf5f6('0x29')],qs[_0xf5f6('0x2d')](_0x5ae1e4[_0xf5f6('0x2b')]['fields']));_0x104e6c[_0xf5f6('0x2e')]=_0x104e6c[_0xf5f6('0x2e')][_0xf5f6('0x2f')]?_0x104e6c['attributes']:_0x5cc42c[_0xf5f6('0x29')];_0x104e6c[_0xf5f6('0x43')]=qs['sort'](_0x5ae1e4['query'][_0xf5f6('0x44')]);_0x104e6c[_0xf5f6('0x45')]=qs['filters'](_['pick'](_0x5ae1e4[_0xf5f6('0x2b')],_0x5cc42c['filters']));if(_0x5ae1e4['query']['filter']){_0x104e6c[_0xf5f6('0x45')]=_[_0xf5f6('0x49')](_0x104e6c['where'],{'$or':_['map'](_0x104e6c['attributes'],function(_0x3ae5b9){var _0x2df20f={};_0x2df20f[_0x3ae5b9]={'$like':'%'+_0x5ae1e4[_0xf5f6('0x2b')][_0xf5f6('0x48')]+'%'};return _0x2df20f;})});}_0x104e6c=_[_0xf5f6('0x49')]({},_0x104e6c,_0x5ae1e4[_0xf5f6('0x4a')]);return _0x181f18[_0xf5f6('0x75')](_0x104e6c);}})['then'](function(_0x394a3e){if(_0x394a3e){_0x260376=_0x394a3e['length'];if(!_0x5ae1e4['query'][_0xf5f6('0x42')](_0xf5f6('0x54'))){_0x104e6c[_0xf5f6('0x11')]=qs[_0xf5f6('0x11')](_0x5ae1e4[_0xf5f6('0x2b')][_0xf5f6('0x11')]);_0x104e6c[_0xf5f6('0x10')]=qs['offset'](_0x5ae1e4[_0xf5f6('0x2b')][_0xf5f6('0x10')]);}return _0x181f18[_0xf5f6('0x75')](_0x104e6c);}})['then'](function(_0x4b528f){if(_0x4b528f){return _0x4b528f?{'count':_0x260376,'rows':_0x4b528f}:null;}})['then'](respondWithResult(_0x24a269,null))[_0xf5f6('0x31')](handleError(_0x24a269,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9042354..2c80681 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 _0xccce=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xccce,0x102));var _0xeccc=function(_0x306245,_0x327741){_0x306245=_0x306245-0x0;var _0x3a57ef=_0xccce[_0x306245];return _0x3a57ef;};'use strict';var EventEmitter=require(_0xeccc('0x0'));var FaxQueue=require(_0xeccc('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xeccc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeccc('0x3')};function emitEvent(_0x21f177){return function(_0x56b3a0,_0x10610a,_0x5c7794){FaxQueueEvents[_0xeccc('0x4')](_0x21f177+':'+_0x56b3a0['id'],_0x56b3a0);FaxQueueEvents[_0xeccc('0x4')](_0x21f177,_0x56b3a0);_0x5c7794(null);};}for(var e in events){if(events[_0xeccc('0x5')](e)){var event=events[e];FaxQueue[_0xeccc('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x0cf4=['save','update','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0cf4,0x1d2));var _0x40cf=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0x0cf4[_0x5814ca];return _0xeb1833;};'use strict';var EventEmitter=require(_0x40cf('0x0'));var FaxQueue=require(_0x40cf('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x40cf('0x2')](0x0);var events={'afterCreate':_0x40cf('0x3'),'afterUpdate':_0x40cf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21b95a){return function(_0x4f6a48,_0x182af6,_0x34f9d9){FaxQueueEvents['emit'](_0x21b95a+':'+_0x4f6a48['id'],_0x4f6a48);FaxQueueEvents['emit'](_0x21b95a,_0x4f6a48);_0x34f9d9(null);};}for(var e in events){if(events[_0x40cf('0x5')](e)){var event=events[e];FaxQueue[_0x40cf('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5591830..7c4cddd 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 _0x4283=['bluebird','request-promise','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api'];(function(_0x37720c,_0xe6ca8e){var _0x44be92=function(_0x1c8583){while(--_0x1c8583){_0x37720c['push'](_0x37720c['shift']());}};_0x44be92(++_0xe6ca8e);}(_0x4283,0xd9));var _0x3428=function(_0x443ff3,_0xd4b12f){_0x443ff3=_0x443ff3-0x0;var _0xb6f175=_0x4283[_0x443ff3];return _0xb6f175;};'use strict';var _=require(_0x3428('0x0'));var util=require(_0x3428('0x1'));var logger=require('../../config/logger')(_0x3428('0x2'));var moment=require('moment');var BPromise=require(_0x3428('0x3'));var rp=require(_0x3428('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3428('0x5'));var attributes=require(_0x3428('0x6'));module[_0x3428('0x7')]=function(_0x343faf,_0x27f13b){return _0x343faf[_0x3428('0x8')](_0x3428('0x9'),attributes,{'tableName':_0x3428('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7de1=['fax_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x1d2541,_0x2ca83b){var _0x49f304=function(_0x1c3675){while(--_0x1c3675){_0x1d2541['push'](_0x1d2541['shift']());}};_0x49f304(++_0x2ca83b);}(_0x7de1,0x1ae));var _0x17de=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x7de1[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0x17de('0x0'));var util=require(_0x17de('0x1'));var logger=require(_0x17de('0x2'))('api');var moment=require(_0x17de('0x3'));var BPromise=require(_0x17de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17de('0x5'));var rimraf=require(_0x17de('0x6'));var config=require(_0x17de('0x7'));var attributes=require(_0x17de('0x8'));module[_0x17de('0x9')]=function(_0x2dbe5a,_0x2ce943){return _0x2dbe5a[_0x17de('0xa')](_0x17de('0xb'),attributes,{'tableName':_0x17de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 4f2c331..2ad743b 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 _0x6947=['socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x1e6017,_0x4ff459){var _0x2cba56=function(_0x5ec96c){while(--_0x5ec96c){_0x1e6017['push'](_0x1e6017['shift']());}};_0x2cba56(++_0x4ff459);}(_0x6947,0x1b1));var _0x7694=function(_0x84efc1,_0x5509f0){_0x84efc1=_0x84efc1-0x0;var _0x34a7d0=_0x6947[_0x84efc1];return _0x34a7d0;};'use strict';var _=require(_0x7694('0x0'));var util=require('util');var moment=require(_0x7694('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7694('0x2'))['db'];var utils=require(_0x7694('0x3'));var logger=require(_0x7694('0x4'))(_0x7694('0x5'));var config=require(_0x7694('0x6'));var jayson=require(_0x7694('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x7694('0x8')]=_[_0x7694('0x9')](config[_0x7694('0x8')],{'host':_0x7694('0xa'),'port':0x18eb});var socket=require(_0x7694('0xb'))(new Redis(config['redis']));require(_0x7694('0xc'))[_0x7694('0xd')](socket);function respondWithRpcPromise(_0x4a7f36,_0x2ccfc4,_0x23996e){return new BPromise(function(_0x4e26f2,_0x4207ce){return client['request'](_0x4a7f36,_0x23996e)[_0x7694('0xe')](function(_0x258028){logger[_0x7694('0xf')]('FaxQueue,\x20%s,\x20%s',_0x2ccfc4,_0x7694('0x10'));logger[_0x7694('0x11')](_0x7694('0x12'),_0x2ccfc4,_0x7694('0x10'),JSON[_0x7694('0x13')](_0x258028));if(_0x258028[_0x7694('0x14')]){if(_0x258028['error']['code']===0x1f4){logger[_0x7694('0x14')](_0x7694('0x15'),_0x2ccfc4,_0x258028[_0x7694('0x14')][_0x7694('0x16')]);return _0x4207ce(_0x258028[_0x7694('0x14')]['message']);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x2ccfc4,_0x258028[_0x7694('0x14')]['message']);return _0x4e26f2(_0x258028[_0x7694('0x14')][_0x7694('0x16')]);}else{logger[_0x7694('0xf')](_0x7694('0x15'),_0x2ccfc4,'request\x20sent');_0x4e26f2(_0x258028[_0x7694('0x17')][_0x7694('0x16')]);}})[_0x7694('0x18')](function(_0x1d2e68){logger[_0x7694('0x14')]('FaxQueue,\x20%s,\x20%s',_0x2ccfc4,_0x1d2e68);_0x4207ce(_0x1d2e68);});});}exports[_0x7694('0x19')]=function(_0x8f962c){var _0x4d7669=this;return new Promise(function(_0x55d425,_0x3865fd){return db[_0x7694('0x1a')][_0x7694('0x1b')]({'raw':_0x8f962c['options']?_0x8f962c['options'][_0x7694('0x1c')]===undefined?!![]:![]:!![],'where':_0x8f962c[_0x7694('0x1d')]?_0x8f962c[_0x7694('0x1d')]['where']||null:null,'attributes':_0x8f962c[_0x7694('0x1d')]?_0x8f962c[_0x7694('0x1d')][_0x7694('0x1e')]||null:null,'limit':_0x8f962c['options']?_0x8f962c[_0x7694('0x1d')][_0x7694('0x1f')]||null:null,'include':_0x8f962c['options']?_0x8f962c['options']['include']?_['map'](_0x8f962c[_0x7694('0x1d')][_0x7694('0x20')],function(_0x176c92){return{'model':db[_0x176c92[_0x7694('0x21')]],'as':_0x176c92['as'],'attributes':_0x176c92[_0x7694('0x1e')],'include':_0x176c92['include']?_[_0x7694('0x22')](_0x176c92['include'],function(_0x497ace){return{'model':db[_0x497ace[_0x7694('0x21')]],'as':_0x497ace['as'],'attributes':_0x497ace[_0x7694('0x1e')],'include':_0x497ace[_0x7694('0x20')]?_[_0x7694('0x22')](_0x497ace[_0x7694('0x20')],function(_0x223c3a){return{'model':db[_0x223c3a['model']],'as':_0x223c3a['as'],'attributes':_0x223c3a[_0x7694('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7694('0xe')](function(_0x5bcbd7){logger['info'](_0x7694('0x19'),_0x8f962c);logger['debug'](_0x7694('0x19'),_0x8f962c,JSON[_0x7694('0x13')](_0x5bcbd7));_0x55d425(_0x5bcbd7);})['catch'](function(_0x3d15ac){logger['error'](_0x7694('0x19'),_0x3d15ac[_0x7694('0x16')],_0x8f962c);_0x3865fd(_0x4d7669[_0x7694('0x14')](0x1f4,_0x3d15ac[_0x7694('0x16')]));});});};exports[_0x7694('0x23')]=function(_0xc8bf35){var _0x32dcba=this;return new Promise(function(_0x38a309,_0x449e2a){return db['FaxQueue'][_0x7694('0x24')]({'raw':_0xc8bf35['options']?_0xc8bf35[_0x7694('0x1d')][_0x7694('0x1c')]===undefined?!![]:![]:!![],'where':_0xc8bf35[_0x7694('0x1d')]?_0xc8bf35[_0x7694('0x1d')]['where']||null:null,'attributes':_0xc8bf35[_0x7694('0x1d')]?_0xc8bf35[_0x7694('0x1d')][_0x7694('0x1e')]||null:null,'include':_0xc8bf35['options']?_0xc8bf35['options'][_0x7694('0x20')]?_[_0x7694('0x22')](_0xc8bf35[_0x7694('0x1d')][_0x7694('0x20')],function(_0xae2331){return{'model':db[_0xae2331[_0x7694('0x21')]],'as':_0xae2331['as'],'attributes':_0xae2331[_0x7694('0x1e')],'include':_0xae2331[_0x7694('0x20')]?_['map'](_0xae2331[_0x7694('0x20')],function(_0x4fbc33){return{'model':db[_0x4fbc33[_0x7694('0x21')]],'as':_0x4fbc33['as'],'attributes':_0x4fbc33[_0x7694('0x1e')],'include':_0x4fbc33[_0x7694('0x20')]?_[_0x7694('0x22')](_0x4fbc33[_0x7694('0x20')],function(_0x23fc4b){return{'model':db[_0x23fc4b[_0x7694('0x21')]],'as':_0x23fc4b['as'],'attributes':_0x23fc4b[_0x7694('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7694('0xe')](function(_0x3832ed){logger[_0x7694('0xf')](_0x7694('0x23'),_0xc8bf35);logger[_0x7694('0x11')](_0x7694('0x23'),_0xc8bf35,JSON[_0x7694('0x13')](_0x3832ed));_0x38a309(_0x3832ed);})[_0x7694('0x18')](function(_0x37747d){logger[_0x7694('0x14')]('ShowFaxQueue',_0x37747d[_0x7694('0x16')],_0xc8bf35);_0x449e2a(_0x32dcba[_0x7694('0x14')](0x1f4,_0x37747d['message']));});});}; \ No newline at end of file +var _0x9efc=['http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxQueue','findAll','options','where','attributes','include','model','map','ShowFaxQueue','FaxQueue','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0x9efc,0x185));var _0xc9ef=function(_0x1c676d,_0x4a62ea){_0x1c676d=_0x1c676d-0x0;var _0x287e93=_0x9efc[_0x1c676d];return _0x287e93;};'use strict';var _=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var moment=require('moment');var BPromise=require(_0xc9ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9ef('0x3'));var db=require(_0xc9ef('0x4'))['db'];var utils=require(_0xc9ef('0x5'));var logger=require(_0xc9ef('0x6'))(_0xc9ef('0x7'));var config=require(_0xc9ef('0x8'));var jayson=require(_0xc9ef('0x9'));var client=jayson[_0xc9ef('0xa')][_0xc9ef('0xb')]({'port':0x232a});config[_0xc9ef('0xc')]=_[_0xc9ef('0xd')](config[_0xc9ef('0xc')],{'host':_0xc9ef('0xe'),'port':0x18eb});var socket=require(_0xc9ef('0xf'))(new Redis(config[_0xc9ef('0xc')]));require(_0xc9ef('0x10'))['register'](socket);function respondWithRpcPromise(_0x192f1c,_0x3dc21d,_0xf77558){return new BPromise(function(_0xfe262d,_0x4125b9){return client[_0xc9ef('0x11')](_0x192f1c,_0xf77558)[_0xc9ef('0x12')](function(_0x3d5088){logger[_0xc9ef('0x13')](_0xc9ef('0x14'),_0x3dc21d,_0xc9ef('0x15'));logger[_0xc9ef('0x16')](_0xc9ef('0x17'),_0x3dc21d,_0xc9ef('0x15'),JSON['stringify'](_0x3d5088));if(_0x3d5088[_0xc9ef('0x18')]){if(_0x3d5088[_0xc9ef('0x18')]['code']===0x1f4){logger[_0xc9ef('0x18')](_0xc9ef('0x14'),_0x3dc21d,_0x3d5088[_0xc9ef('0x18')]['message']);return _0x4125b9(_0x3d5088[_0xc9ef('0x18')]['message']);}logger[_0xc9ef('0x18')](_0xc9ef('0x14'),_0x3dc21d,_0x3d5088[_0xc9ef('0x18')][_0xc9ef('0x19')]);return _0xfe262d(_0x3d5088[_0xc9ef('0x18')][_0xc9ef('0x19')]);}else{logger['info'](_0xc9ef('0x14'),_0x3dc21d,'request\x20sent');_0xfe262d(_0x3d5088[_0xc9ef('0x1a')][_0xc9ef('0x19')]);}})[_0xc9ef('0x1b')](function(_0x5cadc9){logger[_0xc9ef('0x18')]('FaxQueue,\x20%s,\x20%s',_0x3dc21d,_0x5cadc9);_0x4125b9(_0x5cadc9);});});}exports[_0xc9ef('0x1c')]=function(_0x1c3027){var _0x49113f=this;return new Promise(function(_0x540d9c,_0x325adf){return db['FaxQueue'][_0xc9ef('0x1d')]({'raw':_0x1c3027['options']?_0x1c3027[_0xc9ef('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1c3027[_0xc9ef('0x1e')]?_0x1c3027['options'][_0xc9ef('0x1f')]||null:null,'attributes':_0x1c3027[_0xc9ef('0x1e')]?_0x1c3027['options'][_0xc9ef('0x20')]||null:null,'limit':_0x1c3027[_0xc9ef('0x1e')]?_0x1c3027[_0xc9ef('0x1e')]['limit']||null:null,'include':_0x1c3027[_0xc9ef('0x1e')]?_0x1c3027['options'][_0xc9ef('0x21')]?_['map'](_0x1c3027[_0xc9ef('0x1e')][_0xc9ef('0x21')],function(_0x3d3278){return{'model':db[_0x3d3278[_0xc9ef('0x22')]],'as':_0x3d3278['as'],'attributes':_0x3d3278[_0xc9ef('0x20')],'include':_0x3d3278[_0xc9ef('0x21')]?_[_0xc9ef('0x23')](_0x3d3278['include'],function(_0x4cb82a){return{'model':db[_0x4cb82a[_0xc9ef('0x22')]],'as':_0x4cb82a['as'],'attributes':_0x4cb82a[_0xc9ef('0x20')],'include':_0x4cb82a['include']?_[_0xc9ef('0x23')](_0x4cb82a['include'],function(_0x1a8426){return{'model':db[_0x1a8426[_0xc9ef('0x22')]],'as':_0x1a8426['as'],'attributes':_0x1a8426[_0xc9ef('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc9ef('0x12')](function(_0x48691c){logger[_0xc9ef('0x13')](_0xc9ef('0x1c'),_0x1c3027);logger[_0xc9ef('0x16')]('GetFaxQueue',_0x1c3027,JSON['stringify'](_0x48691c));_0x540d9c(_0x48691c);})['catch'](function(_0x15b7eb){logger[_0xc9ef('0x18')](_0xc9ef('0x1c'),_0x15b7eb[_0xc9ef('0x19')],_0x1c3027);_0x325adf(_0x49113f['error'](0x1f4,_0x15b7eb['message']));});});};exports[_0xc9ef('0x24')]=function(_0x3b059b){var _0xca2388=this;return new Promise(function(_0x2407f0,_0x426b5c){return db[_0xc9ef('0x25')]['find']({'raw':_0x3b059b['options']?_0x3b059b['options'][_0xc9ef('0x26')]===undefined?!![]:![]:!![],'where':_0x3b059b[_0xc9ef('0x1e')]?_0x3b059b[_0xc9ef('0x1e')][_0xc9ef('0x1f')]||null:null,'attributes':_0x3b059b[_0xc9ef('0x1e')]?_0x3b059b[_0xc9ef('0x1e')][_0xc9ef('0x20')]||null:null,'include':_0x3b059b[_0xc9ef('0x1e')]?_0x3b059b[_0xc9ef('0x1e')][_0xc9ef('0x21')]?_['map'](_0x3b059b[_0xc9ef('0x1e')][_0xc9ef('0x21')],function(_0x4b3579){return{'model':db[_0x4b3579[_0xc9ef('0x22')]],'as':_0x4b3579['as'],'attributes':_0x4b3579[_0xc9ef('0x20')],'include':_0x4b3579[_0xc9ef('0x21')]?_[_0xc9ef('0x23')](_0x4b3579[_0xc9ef('0x21')],function(_0x5ab77b){return{'model':db[_0x5ab77b['model']],'as':_0x5ab77b['as'],'attributes':_0x5ab77b[_0xc9ef('0x20')],'include':_0x5ab77b[_0xc9ef('0x21')]?_[_0xc9ef('0x23')](_0x5ab77b[_0xc9ef('0x21')],function(_0x1718ea){return{'model':db[_0x1718ea[_0xc9ef('0x22')]],'as':_0x1718ea['as'],'attributes':_0x1718ea['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9ef('0x12')](function(_0x1e08d0){logger[_0xc9ef('0x13')](_0xc9ef('0x24'),_0x3b059b);logger[_0xc9ef('0x16')]('ShowFaxQueue',_0x3b059b,JSON[_0xc9ef('0x27')](_0x1e08d0));_0x2407f0(_0x1e08d0);})['catch'](function(_0x337eff){logger[_0xc9ef('0x18')](_0xc9ef('0x24'),_0x337eff[_0xc9ef('0x19')],_0x3b059b);_0x426b5c(_0xca2388[_0xc9ef('0x18')](0x1f4,_0x337eff[_0xc9ef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 06af386..ac4c0c9 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 _0x6bcd=['save','remove','emit','removeListener','register','length','faxQueue:'];(function(_0x4365be,_0x216cf8){var _0x243a6f=function(_0x1749e5){while(--_0x1749e5){_0x4365be['push'](_0x4365be['shift']());}};_0x243a6f(++_0x216cf8);}(_0x6bcd,0x111));var _0xd6bc=function(_0x1c09db,_0x120059){_0x1c09db=_0x1c09db-0x0;var _0xfa1a2c=_0x6bcd[_0x1c09db];return _0xfa1a2c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xd6bc('0x0'),_0xd6bc('0x1'),'update'];function createListener(_0x2e875d,_0x2d50f1){return function(_0xcc3ae5){_0x2d50f1[_0xd6bc('0x2')](_0x2e875d,_0xcc3ae5);};}function removeListener(_0xbecdfe,_0xf22d4c){return function(){FaxQueueEvents[_0xd6bc('0x3')](_0xbecdfe,_0xf22d4c);};}exports[_0xd6bc('0x4')]=function(_0x1bb6a6){for(var _0x4f4eb1=0x0,_0x24f1ed=events[_0xd6bc('0x5')];_0x4f4eb1<_0x24f1ed;_0x4f4eb1++){var _0x18de97=events[_0x4f4eb1];var _0x1c59ab=createListener(_0xd6bc('0x6')+_0x18de97,_0x1bb6a6);FaxQueueEvents['on'](_0x18de97,_0x1c59ab);}}; \ No newline at end of file +var _0x5ad3=['register','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4d9403,_0x33c5f0){_0x4d9403=_0x4d9403-0x0;var _0x5eef11=_0x5ad3[_0x4d9403];return _0x5eef11;};'use strict';var FaxQueueEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){FaxQueueEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);FaxQueueEvents['on'](_0x292521,_0x3cec3e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 822f828..d2c3d4f 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 _0xde46=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x5cc4bc,_0x38e8d5){var _0x1632eb=function(_0x4cb73a){while(--_0x4cb73a){_0x5cc4bc['push'](_0x5cc4bc['shift']());}};_0x1632eb(++_0x38e8d5);}(_0xde46,0x14e));var _0x6de4=function(_0x104331,_0x36438f){_0x104331=_0x104331-0x0;var _0x15d356=_0xde46[_0x104331];return _0x15d356;};'use strict';var multer=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var path=require(_0x6de4('0x2'));var timeout=require(_0x6de4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6de4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var controller=require(_0x6de4('0x7'));router[_0x6de4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6de4('0x8')]('/describe',auth[_0x6de4('0x9')](),controller[_0x6de4('0xa')]);router['get'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xc')]);router[_0x6de4('0x8')](_0x6de4('0xd'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xe')]);router[_0x6de4('0x8')](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x10')]);router['get'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x12')]);router[_0x6de4('0x13')]('/',auth[_0x6de4('0x9')](),controller[_0x6de4('0x14')]);router[_0x6de4('0x13')](_0x6de4('0xf'),auth['isAuthenticated'](),controller[_0x6de4('0x15')]);router['post'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x16')]);router['put'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x17')]);router[_0x6de4('0x18')]('/:id',auth[_0x6de4('0x9')](),controller['destroy']);router['delete'](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x19')]);router[_0x6de4('0x18')](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x1a')]);module[_0x6de4('0x1b')]=router; \ No newline at end of file +var _0x0af5=['create','addTeams','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0af5,0x158));var _0x50af=function(_0x123a4d,_0x2dc990){_0x123a4d=_0x123a4d-0x0;var _0x9d8069=_0x0af5[_0x123a4d];return _0x9d8069;};'use strict';var multer=require('multer');var util=require(_0x50af('0x0'));var path=require(_0x50af('0x1'));var timeout=require(_0x50af('0x2'));var express=require(_0x50af('0x3'));var router=express[_0x50af('0x4')]();var fs_extra=require(_0x50af('0x5'));var auth=require(_0x50af('0x6'));var interaction=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var controller=require(_0x50af('0x9'));router[_0x50af('0xa')]('/',auth[_0x50af('0xb')](),controller['index']);router['get'](_0x50af('0xc'),auth[_0x50af('0xb')](),controller['describe']);router['get'](_0x50af('0xd'),auth[_0x50af('0xb')](),controller['show']);router['get'](_0x50af('0xe'),auth[_0x50af('0xb')](),controller['getMembers']);router[_0x50af('0xa')](_0x50af('0xf'),auth[_0x50af('0xb')](),controller[_0x50af('0x10')]);router['get'](_0x50af('0x11'),auth[_0x50af('0xb')](),controller[_0x50af('0x12')]);router[_0x50af('0x13')]('/',auth[_0x50af('0xb')](),controller[_0x50af('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x50af('0x15')]);router['post'](_0x50af('0x11'),auth[_0x50af('0xb')](),controller['addAgents']);router['put'](_0x50af('0xd'),auth[_0x50af('0xb')](),controller['update']);router['delete'](_0x50af('0xd'),auth[_0x50af('0xb')](),controller[_0x50af('0x16')]);router[_0x50af('0x17')](_0x50af('0xf'),auth[_0x50af('0xb')](),controller[_0x50af('0x18')]);router[_0x50af('0x17')](_0x50af('0x11'),auth[_0x50af('0xb')](),controller['removeAgents']);module[_0x50af('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 9e41332..b581180 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 _0x0782=['STRING','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0782,0x7e));var _0x2078=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x0782[_0x18afca];return _0x11603f;};'use strict';var moment=require('moment');var Sequelize=require(_0x2078('0x0'));module[_0x2078('0x1')]={'uniqueid':{'type':Sequelize[_0x2078('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2078('0x2')]},'joinAt':{'type':Sequelize[_0x2078('0x3')]},'leaveAt':{'type':Sequelize[_0x2078('0x3')]},'acceptAt':{'type':Sequelize[_0x2078('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2078('0x2')]}}; \ No newline at end of file +var _0xb3a1=['exports','STRING','DATE'];(function(_0xd618f4,_0x4fab36){var _0x3e68b7=function(_0x4d5cd5){while(--_0x4d5cd5){_0xd618f4['push'](_0xd618f4['shift']());}};_0x3e68b7(++_0x4fab36);}(_0xb3a1,0x1bc));var _0x1b3a=function(_0x1e0d60,_0x503460){_0x1e0d60=_0x1e0d60-0x0;var _0x5b9564=_0xb3a1[_0x1e0d60];return _0x5b9564;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1b3a('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1b3a('0x1')]},'joinAt':{'type':Sequelize[_0x1b3a('0x2')]},'leaveAt':{'type':Sequelize[_0x1b3a('0x2')]},'acceptAt':{'type':Sequelize[_0x1b3a('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e8e2c38..670e3ff 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 _0x0eec=['limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','json','apply','reject','update','destroy','then','end','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0xd6fcb5,_0x526523){var _0x278ac7=function(_0x3a9512){while(--_0x3a9512){_0xd6fcb5['push'](_0xd6fcb5['shift']());}};_0x278ac7(++_0x526523);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc0ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc0ee('0x1'));var rp=require(_0xc0ee('0x2'));var moment=require(_0xc0ee('0x3'));var BPromise=require(_0xc0ee('0x4'));var Mustache=require(_0xc0ee('0x5'));var util=require(_0xc0ee('0x6'));var path=require(_0xc0ee('0x7'));var sox=require('sox');var csv=require(_0xc0ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0ee('0x9'));var _=require(_0xc0ee('0xa'));var squel=require(_0xc0ee('0xb'));var crypto=require(_0xc0ee('0xc'));var jsforce=require(_0xc0ee('0xd'));var deskjs=require(_0xc0ee('0xe'));var toCsv=require(_0xc0ee('0x8'));var querystring=require('querystring');var Papa=require(_0xc0ee('0xf'));var Redis=require(_0xc0ee('0x10'));var authService=require(_0xc0ee('0x11'));var qs=require(_0xc0ee('0x12'));var as=require(_0xc0ee('0x13'));var hardwareService=require(_0xc0ee('0x14'));var logger=require(_0xc0ee('0x15'))('api');var utils=require(_0xc0ee('0x16'));var config=require(_0xc0ee('0x17'));var licenseUtil=require(_0xc0ee('0x18'));var db=require(_0xc0ee('0x19'))['db'];function respondWithStatusCode(_0x22d46b,_0x2d4e3c){_0x2d4e3c=_0x2d4e3c||0xcc;return function(_0x454f5d){if(_0x454f5d){return _0x22d46b[_0xc0ee('0x1a')](_0x2d4e3c);}return _0x22d46b[_0xc0ee('0x1b')](_0x2d4e3c)['end']();};}function respondWithResult(_0x51ae2e,_0x1f3ad9){_0x1f3ad9=_0x1f3ad9||0xc8;return function(_0x325193){if(_0x325193){return _0x51ae2e[_0xc0ee('0x1b')](_0x1f3ad9)['json'](_0x325193);}};}function respondWithFilteredResult(_0x170bf9,_0x30c324){return function(_0x448448){if(_0x448448){var _0x58e1f0=typeof _0x30c324['offset']===_0xc0ee('0x1c')&&typeof _0x30c324['limit']===_0xc0ee('0x1c');var _0x20195b=_0x448448[_0xc0ee('0x1d')];var _0x59aad9=_0x58e1f0?0x0:_0x30c324['offset'];var _0x16d050=_0x58e1f0?_0x448448[_0xc0ee('0x1d')]:_0x30c324[_0xc0ee('0x1e')]+_0x30c324['limit'];var _0x390ee4;if(_0x16d050>=_0x20195b){_0x16d050=_0x20195b;_0x390ee4=0xc8;}else{_0x390ee4=0xce;}_0x170bf9[_0xc0ee('0x1b')](_0x390ee4);return _0x170bf9['set']('Content-Range',_0x59aad9+'-'+_0x16d050+'/'+_0x20195b)[_0xc0ee('0x1f')](_0x448448);}return null;};}function patchUpdates(_0x233333){return function(_0x4dd8c9){try{jsonpatch[_0xc0ee('0x20')](_0x4dd8c9,_0x233333,!![]);}catch(_0x30a00c){return BPromise[_0xc0ee('0x21')](_0x30a00c);}return _0x4dd8c9['save']();};}function saveUpdates(_0x49be2a,_0x5af925){return function(_0x7ec74){if(_0x7ec74){return _0x7ec74[_0xc0ee('0x22')](_0x49be2a)['then'](function(_0x2c3d95){return _0x2c3d95;});}return null;};}function removeEntity(_0x453490,_0x20b657){return function(_0x11b6a4){if(_0x11b6a4){return _0x11b6a4[_0xc0ee('0x23')]()[_0xc0ee('0x24')](function(){_0x453490[_0xc0ee('0x1b')](0xcc)[_0xc0ee('0x25')]();});}};}function handleEntityNotFound(_0x38abc9,_0x6d1087){return function(_0x2b0584){if(!_0x2b0584){_0x38abc9[_0xc0ee('0x1a')](0x194);}return _0x2b0584;};}function handleError(_0x168ab5,_0x30582e){_0x30582e=_0x30582e||0x1f4;return function(_0x4288e1){logger['error'](_0x4288e1[_0xc0ee('0x26')]);if(_0x4288e1[_0xc0ee('0x27')]){delete _0x4288e1['name'];}_0x168ab5[_0xc0ee('0x1b')](_0x30582e)['send'](_0x4288e1);};}exports[_0xc0ee('0x28')]=function(_0x410fb2,_0x44b511){var _0x1d3594={},_0x46ca29={},_0x369764={'count':0x0,'rows':[]};var _0x24a67a=_[_0xc0ee('0x29')](db[_0xc0ee('0x2a')][_0xc0ee('0x2b')],function(_0x394777){return{'name':_0x394777[_0xc0ee('0x2c')],'type':_0x394777[_0xc0ee('0x2d')][_0xc0ee('0x2e')]};});_0x46ca29['model']=_['map'](_0x24a67a,_0xc0ee('0x27'));_0x46ca29[_0xc0ee('0x2f')]=_[_0xc0ee('0x30')](_0x410fb2[_0xc0ee('0x2f')]);_0x46ca29[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x46ca29[_0xc0ee('0x33')],_0x46ca29[_0xc0ee('0x2f')]);_0x1d3594[_0xc0ee('0x34')]=_[_0xc0ee('0x32')](_0x46ca29[_0xc0ee('0x33')],qs['fields'](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x35')]));_0x1d3594[_0xc0ee('0x34')]=_0x1d3594[_0xc0ee('0x34')][_0xc0ee('0x36')]?_0x1d3594['attributes']:_0x46ca29[_0xc0ee('0x33')];if(!_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x37')]('nolimit')){_0x1d3594[_0xc0ee('0x38')]=qs[_0xc0ee('0x38')](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x38')]);_0x1d3594['offset']=qs[_0xc0ee('0x1e')](_0x410fb2['query'][_0xc0ee('0x1e')]);}_0x1d3594[_0xc0ee('0x39')]=qs[_0xc0ee('0x3a')](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x3a')]);_0x1d3594[_0xc0ee('0x3b')]=qs[_0xc0ee('0x31')](_[_0xc0ee('0x3c')](_0x410fb2[_0xc0ee('0x2f')],_0x46ca29[_0xc0ee('0x31')]),_0x24a67a);if(_0x410fb2[_0xc0ee('0x2f')]['filter']){_0x1d3594[_0xc0ee('0x3b')]=_[_0xc0ee('0x3d')](_0x1d3594[_0xc0ee('0x3b')],{'$or':_[_0xc0ee('0x29')](_0x24a67a,function(_0x1cb120){if(_0x1cb120[_0xc0ee('0x2d')]!==_0xc0ee('0x3e')){var _0x2d7b9e={};_0x2d7b9e[_0x1cb120['name']]={'$like':'%'+_0x410fb2['query'][_0xc0ee('0x3f')]+'%'};return _0x2d7b9e;}})});}_0x1d3594=_['merge']({},_0x1d3594,_0x410fb2[_0xc0ee('0x40')]);var _0xf46dc5={'where':_0x1d3594['where']};return db[_0xc0ee('0x2a')]['count'](_0xf46dc5)[_0xc0ee('0x24')](function(_0x4f385a){_0x369764['count']=_0x4f385a;if(_0x410fb2['query'][_0xc0ee('0x41')]){_0x1d3594[_0xc0ee('0x42')]=[{'all':!![]}];}return db[_0xc0ee('0x2a')][_0xc0ee('0x43')](_0x1d3594);})['then'](function(_0x3c0c7b){_0x369764[_0xc0ee('0x44')]=_0x3c0c7b;return _0x369764;})[_0xc0ee('0x24')](respondWithFilteredResult(_0x44b511,_0x1d3594))[_0xc0ee('0x45')](handleError(_0x44b511,null));};exports[_0xc0ee('0x46')]=function(_0x5c2111,_0x388c7b){var _0x264a41={'raw':!![],'where':{'id':_0x5c2111[_0xc0ee('0x47')]['id']}},_0x5577aa={};_0x5577aa['model']=_[_0xc0ee('0x30')](db[_0xc0ee('0x2a')]['rawAttributes']);_0x5577aa[_0xc0ee('0x2f')]=_[_0xc0ee('0x30')](_0x5c2111['query']);_0x5577aa[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x5577aa['model'],_0x5577aa[_0xc0ee('0x2f')]);_0x264a41[_0xc0ee('0x34')]=_[_0xc0ee('0x32')](_0x5577aa[_0xc0ee('0x33')],qs[_0xc0ee('0x35')](_0x5c2111['query']['fields']));_0x264a41[_0xc0ee('0x34')]=_0x264a41[_0xc0ee('0x34')][_0xc0ee('0x36')]?_0x264a41[_0xc0ee('0x34')]:_0x5577aa['model'];if(_0x5c2111['query'][_0xc0ee('0x41')]){_0x264a41[_0xc0ee('0x42')]=[{'all':!![]}];}_0x264a41=_[_0xc0ee('0x3d')]({},_0x264a41,_0x5c2111['options']);return db['FaxQueueReport'][_0xc0ee('0x48')](_0x264a41)[_0xc0ee('0x24')](handleEntityNotFound(_0x388c7b,null))[_0xc0ee('0x24')](respondWithResult(_0x388c7b,null))['catch'](handleError(_0x388c7b,null));};exports[_0xc0ee('0x49')]=function(_0x3d6a10,_0x5e5f5e){return db[_0xc0ee('0x2a')][_0xc0ee('0x49')](_0x3d6a10[_0xc0ee('0x4a')],{})[_0xc0ee('0x24')](respondWithResult(_0x5e5f5e,0xc9))['catch'](handleError(_0x5e5f5e,null));};exports['update']=function(_0x22c742,_0x5ca93b){if(_0x22c742['body']['id']){delete _0x22c742['body']['id'];}return db[_0xc0ee('0x2a')]['find']({'where':{'id':_0x22c742[_0xc0ee('0x47')]['id']}})[_0xc0ee('0x24')](handleEntityNotFound(_0x5ca93b,null))[_0xc0ee('0x24')](saveUpdates(_0x22c742['body'],null))[_0xc0ee('0x24')](respondWithResult(_0x5ca93b,null))['catch'](handleError(_0x5ca93b,null));};exports[_0xc0ee('0x23')]=function(_0x4b2fcc,_0x3bb5ae){return db[_0xc0ee('0x2a')][_0xc0ee('0x48')]({'where':{'id':_0x4b2fcc[_0xc0ee('0x47')]['id']}})[_0xc0ee('0x24')](handleEntityNotFound(_0x3bb5ae,null))[_0xc0ee('0x24')](removeEntity(_0x3bb5ae,null))['catch'](handleError(_0x3bb5ae,null));};exports['describe']=function(_0x6e6b2c,_0x497ed9){return db[_0xc0ee('0x2a')][_0xc0ee('0x4b')]()[_0xc0ee('0x24')](respondWithResult(_0x497ed9,null))[_0xc0ee('0x45')](handleError(_0x497ed9,null));}; \ No newline at end of file +var _0x502a=['eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','FaxQueueReport','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','include','rows','catch','show','params','rawAttributes','keys','fields','includeAll','find','create','body','describe'];(function(_0x5ee367,_0x5aff0b){var _0x145dde=function(_0x1a23d0){while(--_0x1a23d0){_0x5ee367['push'](_0x5ee367['shift']());}};_0x145dde(++_0x5aff0b);}(_0x502a,0xd8));var _0xa502=function(_0x30dfc8,_0x9546e4){_0x30dfc8=_0x30dfc8-0x0;var _0x26069d=_0x502a[_0x30dfc8];return _0x26069d;};'use strict';var emlformat=require(_0xa502('0x0'));var rimraf=require(_0xa502('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa502('0x2'));var rp=require(_0xa502('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa502('0x4'));var util=require('util');var path=require(_0xa502('0x5'));var sox=require(_0xa502('0x6'));var csv=require(_0xa502('0x7'));var ejs=require(_0xa502('0x8'));var fs=require('fs');var fs_extra=require(_0xa502('0x9'));var _=require('lodash');var squel=require(_0xa502('0xa'));var crypto=require(_0xa502('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa502('0x7'));var querystring=require(_0xa502('0xc'));var Papa=require('papaparse');var Redis=require(_0xa502('0xd'));var authService=require(_0xa502('0xe'));var qs=require(_0xa502('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa502('0x10'));var logger=require(_0xa502('0x11'))(_0xa502('0x12'));var utils=require('../../config/utils');var config=require(_0xa502('0x13'));var licenseUtil=require(_0xa502('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a18ad,_0x186bda){_0x186bda=_0x186bda||0xcc;return function(_0x5e8a81){if(_0x5e8a81){return _0x3a18ad[_0xa502('0x15')](_0x186bda);}return _0x3a18ad[_0xa502('0x16')](_0x186bda)[_0xa502('0x17')]();};}function respondWithResult(_0x531dca,_0x10a43c){_0x10a43c=_0x10a43c||0xc8;return function(_0x1d1086){if(_0x1d1086){return _0x531dca[_0xa502('0x16')](_0x10a43c)['json'](_0x1d1086);}};}function respondWithFilteredResult(_0x2db786,_0x2b3b13){return function(_0x432922){if(_0x432922){var _0x2dcb5b=typeof _0x2b3b13[_0xa502('0x18')]===_0xa502('0x19')&&typeof _0x2b3b13[_0xa502('0x1a')]===_0xa502('0x19');var _0x2e76b8=_0x432922[_0xa502('0x1b')];var _0x1445ec=_0x2dcb5b?0x0:_0x2b3b13[_0xa502('0x18')];var _0x1d2f3d=_0x2dcb5b?_0x432922[_0xa502('0x1b')]:_0x2b3b13[_0xa502('0x18')]+_0x2b3b13[_0xa502('0x1a')];var _0x35ed38;if(_0x1d2f3d>=_0x2e76b8){_0x1d2f3d=_0x2e76b8;_0x35ed38=0xc8;}else{_0x35ed38=0xce;}_0x2db786[_0xa502('0x16')](_0x35ed38);return _0x2db786['set']('Content-Range',_0x1445ec+'-'+_0x1d2f3d+'/'+_0x2e76b8)[_0xa502('0x1c')](_0x432922);}return null;};}function patchUpdates(_0x331d55){return function(_0xb0d161){try{jsonpatch[_0xa502('0x1d')](_0xb0d161,_0x331d55,!![]);}catch(_0x3cd020){return BPromise[_0xa502('0x1e')](_0x3cd020);}return _0xb0d161[_0xa502('0x1f')]();};}function saveUpdates(_0x75c45c,_0x287f03){return function(_0x2dda13){if(_0x2dda13){return _0x2dda13[_0xa502('0x20')](_0x75c45c)[_0xa502('0x21')](function(_0x565564){return _0x565564;});}return null;};}function removeEntity(_0x3edc73,_0x1e6c5a){return function(_0x28bc20){if(_0x28bc20){return _0x28bc20[_0xa502('0x22')]()[_0xa502('0x21')](function(){_0x3edc73[_0xa502('0x16')](0xcc)[_0xa502('0x17')]();});}};}function handleEntityNotFound(_0x55476d,_0x5dd273){return function(_0x3efbf3){if(!_0x3efbf3){_0x55476d['sendStatus'](0x194);}return _0x3efbf3;};}function handleError(_0xe7bf2,_0x387ab5){_0x387ab5=_0x387ab5||0x1f4;return function(_0x5d04ad){logger[_0xa502('0x23')](_0x5d04ad[_0xa502('0x24')]);if(_0x5d04ad['name']){delete _0x5d04ad[_0xa502('0x25')];}_0xe7bf2[_0xa502('0x16')](_0x387ab5)[_0xa502('0x26')](_0x5d04ad);};}exports['index']=function(_0x522122,_0x4d8a9e){var _0x1fcede={},_0x34f7fa={},_0x5da3c1={'count':0x0,'rows':[]};var _0x595e57=_[_0xa502('0x27')](db[_0xa502('0x28')]['rawAttributes'],function(_0x19e53c){return{'name':_0x19e53c[_0xa502('0x29')],'type':_0x19e53c['type'][_0xa502('0x2a')]};});_0x34f7fa[_0xa502('0x2b')]=_[_0xa502('0x27')](_0x595e57,_0xa502('0x25'));_0x34f7fa['query']=_['keys'](_0x522122[_0xa502('0x2c')]);_0x34f7fa[_0xa502('0x2d')]=_[_0xa502('0x2e')](_0x34f7fa[_0xa502('0x2b')],_0x34f7fa[_0xa502('0x2c')]);_0x1fcede[_0xa502('0x2f')]=_[_0xa502('0x2e')](_0x34f7fa['model'],qs['fields'](_0x522122[_0xa502('0x2c')]['fields']));_0x1fcede[_0xa502('0x2f')]=_0x1fcede[_0xa502('0x2f')][_0xa502('0x30')]?_0x1fcede[_0xa502('0x2f')]:_0x34f7fa['model'];if(!_0x522122[_0xa502('0x2c')][_0xa502('0x31')](_0xa502('0x32'))){_0x1fcede[_0xa502('0x1a')]=qs['limit'](_0x522122['query'][_0xa502('0x1a')]);_0x1fcede[_0xa502('0x18')]=qs[_0xa502('0x18')](_0x522122[_0xa502('0x2c')]['offset']);}_0x1fcede[_0xa502('0x33')]=qs[_0xa502('0x34')](_0x522122['query'][_0xa502('0x34')]);_0x1fcede[_0xa502('0x35')]=qs['filters'](_[_0xa502('0x36')](_0x522122[_0xa502('0x2c')],_0x34f7fa['filters']),_0x595e57);if(_0x522122[_0xa502('0x2c')]['filter']){_0x1fcede['where']=_[_0xa502('0x37')](_0x1fcede[_0xa502('0x35')],{'$or':_[_0xa502('0x27')](_0x595e57,function(_0x3f9f9b){if(_0x3f9f9b[_0xa502('0x38')]!=='VIRTUAL'){var _0x471106={};_0x471106[_0x3f9f9b[_0xa502('0x25')]]={'$like':'%'+_0x522122[_0xa502('0x2c')][_0xa502('0x39')]+'%'};return _0x471106;}})});}_0x1fcede=_['merge']({},_0x1fcede,_0x522122[_0xa502('0x3a')]);var _0x1d715e={'where':_0x1fcede[_0xa502('0x35')]};return db[_0xa502('0x28')]['count'](_0x1d715e)['then'](function(_0x447c5b){_0x5da3c1[_0xa502('0x1b')]=_0x447c5b;if(_0x522122[_0xa502('0x2c')]['includeAll']){_0x1fcede[_0xa502('0x3b')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x1fcede);})[_0xa502('0x21')](function(_0x3c7c73){_0x5da3c1[_0xa502('0x3c')]=_0x3c7c73;return _0x5da3c1;})[_0xa502('0x21')](respondWithFilteredResult(_0x4d8a9e,_0x1fcede))[_0xa502('0x3d')](handleError(_0x4d8a9e,null));};exports[_0xa502('0x3e')]=function(_0x5c203c,_0x4ab4d9){var _0x436526={'raw':!![],'where':{'id':_0x5c203c[_0xa502('0x3f')]['id']}},_0x3f777c={};_0x3f777c['model']=_['keys'](db[_0xa502('0x28')][_0xa502('0x40')]);_0x3f777c[_0xa502('0x2c')]=_[_0xa502('0x41')](_0x5c203c[_0xa502('0x2c')]);_0x3f777c['filters']=_[_0xa502('0x2e')](_0x3f777c['model'],_0x3f777c[_0xa502('0x2c')]);_0x436526['attributes']=_[_0xa502('0x2e')](_0x3f777c[_0xa502('0x2b')],qs[_0xa502('0x42')](_0x5c203c[_0xa502('0x2c')]['fields']));_0x436526['attributes']=_0x436526[_0xa502('0x2f')][_0xa502('0x30')]?_0x436526['attributes']:_0x3f777c['model'];if(_0x5c203c[_0xa502('0x2c')][_0xa502('0x43')]){_0x436526['include']=[{'all':!![]}];}_0x436526=_[_0xa502('0x37')]({},_0x436526,_0x5c203c[_0xa502('0x3a')]);return db['FaxQueueReport'][_0xa502('0x44')](_0x436526)[_0xa502('0x21')](handleEntityNotFound(_0x4ab4d9,null))[_0xa502('0x21')](respondWithResult(_0x4ab4d9,null))[_0xa502('0x3d')](handleError(_0x4ab4d9,null));};exports[_0xa502('0x45')]=function(_0x550334,_0x23c423){return db[_0xa502('0x28')][_0xa502('0x45')](_0x550334['body'],{})['then'](respondWithResult(_0x23c423,0xc9))['catch'](handleError(_0x23c423,null));};exports[_0xa502('0x20')]=function(_0x25ee48,_0x3ba272){if(_0x25ee48[_0xa502('0x46')]['id']){delete _0x25ee48['body']['id'];}return db[_0xa502('0x28')][_0xa502('0x44')]({'where':{'id':_0x25ee48[_0xa502('0x3f')]['id']}})[_0xa502('0x21')](handleEntityNotFound(_0x3ba272,null))[_0xa502('0x21')](saveUpdates(_0x25ee48['body'],null))[_0xa502('0x21')](respondWithResult(_0x3ba272,null))[_0xa502('0x3d')](handleError(_0x3ba272,null));};exports['destroy']=function(_0x1f7ffe,_0x57de8c){return db[_0xa502('0x28')][_0xa502('0x44')]({'where':{'id':_0x1f7ffe[_0xa502('0x3f')]['id']}})[_0xa502('0x21')](handleEntityNotFound(_0x57de8c,null))[_0xa502('0x21')](removeEntity(_0x57de8c,null))[_0xa502('0x3d')](handleError(_0x57de8c,null));};exports[_0xa502('0x47')]=function(_0x297323,_0x11fe17){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x11fe17,null))[_0xa502('0x3d')](handleError(_0x11fe17,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ca30dfd..be1b9c5 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20de28,_0x401cfe){var _0x1d1092=function(_0x49c086){while(--_0x49c086){_0x20de28['push'](_0x20de28['shift']());}};_0x1d1092(++_0x401cfe);}(_0x4975,0x86));var _0x5497=function(_0xb80124,_0x2a857d){_0xb80124=_0xb80124-0x0;var _0x20dc51=_0x4975[_0xb80124];return _0x20dc51;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3cccfb,_0x34d05f){_0x3cccfb=_0x3cccfb-0x0;var _0x533162=_0x1cb9[_0x3cccfb];return _0x533162;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d8efefd..4149eea 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 _0xf3af=['where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update'];(function(_0x319894,_0x2e8abf){var _0x925e0c=function(_0x373349){while(--_0x373349){_0x319894['push'](_0x319894['shift']());}};_0x925e0c(++_0x2e8abf);}(_0xf3af,0x1d1));var _0xff3a=function(_0x14d7df,_0x3fe7aa){_0x14d7df=_0x14d7df-0x0;var _0x91dede=_0xf3af[_0x14d7df];return _0x91dede;};'use strict';var _=require(_0xff3a('0x0'));var util=require(_0xff3a('0x1'));var moment=require('moment');var BPromise=require(_0xff3a('0x2'));var rs=require(_0xff3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff3a('0x4'))['db'];var utils=require(_0xff3a('0x5'));var logger=require('../../config/logger')(_0xff3a('0x6'));var config=require('../../config/environment');var jayson=require(_0xff3a('0x7'));var client=jayson[_0xff3a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd24d92,_0x4d521a,_0x42738f){return new BPromise(function(_0x352aca,_0x2e2f5b){return client[_0xff3a('0x9')](_0xd24d92,_0x42738f)[_0xff3a('0xa')](function(_0x554c62){logger[_0xff3a('0xb')](_0xff3a('0xc'),_0x4d521a,'request\x20sent');logger[_0xff3a('0xd')](_0xff3a('0xe'),_0x4d521a,_0xff3a('0xf'),JSON[_0xff3a('0x10')](_0x554c62));if(_0x554c62[_0xff3a('0x11')]){if(_0x554c62[_0xff3a('0x11')][_0xff3a('0x12')]===0x1f4){logger[_0xff3a('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4d521a,_0x554c62[_0xff3a('0x11')][_0xff3a('0x13')]);return _0x2e2f5b(_0x554c62[_0xff3a('0x11')]['message']);}logger['error'](_0xff3a('0xc'),_0x4d521a,_0x554c62['error']['message']);return _0x352aca(_0x554c62[_0xff3a('0x11')][_0xff3a('0x13')]);}else{logger[_0xff3a('0xb')](_0xff3a('0xc'),_0x4d521a,'request\x20sent');_0x352aca(_0x554c62[_0xff3a('0x14')][_0xff3a('0x13')]);}})['catch'](function(_0x510fc3){logger[_0xff3a('0x11')](_0xff3a('0xc'),_0x4d521a,_0x510fc3);_0x2e2f5b(_0x510fc3);});});}exports['CreateFaxQueueReport']=function(_0x2d61ba){var _0x24d35d=this;return new Promise(function(_0x401c68,_0x43f65a){return db[_0xff3a('0x15')][_0xff3a('0x16')](_0x2d61ba[_0xff3a('0x17')],{'raw':_0x2d61ba[_0xff3a('0x18')]?_0x2d61ba['options'][_0xff3a('0x19')]===undefined?!![]:![]:!![]})[_0xff3a('0xa')](function(_0x50fb2f){logger[_0xff3a('0xb')](_0xff3a('0x1a'),_0x2d61ba);logger[_0xff3a('0xd')]('CreateFaxQueueReport',_0x2d61ba,JSON[_0xff3a('0x10')](_0x50fb2f));_0x401c68(_0x50fb2f);})[_0xff3a('0x1b')](function(_0x3baa6d){logger[_0xff3a('0x11')](_0xff3a('0x1a'),_0x3baa6d[_0xff3a('0x13')],_0x2d61ba);_0x43f65a(_0x24d35d[_0xff3a('0x11')](0x1f4,_0x3baa6d[_0xff3a('0x13')]));});});};exports[_0xff3a('0x1c')]=function(_0x22623a){var _0xee0bf5=this;return new Promise(function(_0x2dbc8c,_0x43ce1c){return db[_0xff3a('0x15')][_0xff3a('0x1d')](_0x22623a[_0xff3a('0x17')],{'raw':_0x22623a[_0xff3a('0x18')]?_0x22623a[_0xff3a('0x18')][_0xff3a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22623a[_0xff3a('0x18')]?_0x22623a['options'][_0xff3a('0x1e')]||null:null,'attributes':_0x22623a[_0xff3a('0x18')]?_0x22623a['options'][_0xff3a('0x1f')]||null:null,'limit':_0x22623a[_0xff3a('0x18')]?_0x22623a[_0xff3a('0x18')][_0xff3a('0x20')]||null:null})[_0xff3a('0xa')](function(_0x372ef5){logger[_0xff3a('0xb')](_0xff3a('0x1c'),_0x22623a);logger[_0xff3a('0xd')](_0xff3a('0x1c'),_0x22623a,JSON[_0xff3a('0x10')](_0x372ef5));_0x2dbc8c(_0x372ef5);})[_0xff3a('0x1b')](function(_0x306f97){logger[_0xff3a('0x11')](_0xff3a('0x1c'),_0x306f97[_0xff3a('0x13')],_0x22623a);_0x43ce1c(_0xee0bf5[_0xff3a('0x11')](0x1f4,_0x306f97['message']));});});}; \ No newline at end of file +var _0x6148=['attributes','limit','then','UpdateFaxQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','raw','update','options','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6148,0x8c));var _0x8614=function(_0xbdaac0,_0x23e004){_0xbdaac0=_0xbdaac0-0x0;var _0x4733ae=_0x6148[_0xbdaac0];return _0x4733ae;};'use strict';var _=require(_0x8614('0x0'));var util=require(_0x8614('0x1'));var moment=require(_0x8614('0x2'));var BPromise=require(_0x8614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8614('0x4'));var db=require(_0x8614('0x5'))['db'];var utils=require(_0x8614('0x6'));var logger=require('../../config/logger')(_0x8614('0x7'));var config=require(_0x8614('0x8'));var jayson=require(_0x8614('0x9'));var client=jayson[_0x8614('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33974f,_0x1ec7e7,_0x256cd8){return new BPromise(function(_0x2233cf,_0x556c19){return client['request'](_0x33974f,_0x256cd8)['then'](function(_0x31c797){logger[_0x8614('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x1ec7e7,'request\x20sent');logger[_0x8614('0xc')](_0x8614('0xd'),_0x1ec7e7,_0x8614('0xe'),JSON[_0x8614('0xf')](_0x31c797));if(_0x31c797['error']){if(_0x31c797['error'][_0x8614('0x10')]===0x1f4){logger[_0x8614('0x11')](_0x8614('0x12'),_0x1ec7e7,_0x31c797['error']['message']);return _0x556c19(_0x31c797[_0x8614('0x11')]['message']);}logger[_0x8614('0x11')](_0x8614('0x12'),_0x1ec7e7,_0x31c797[_0x8614('0x11')][_0x8614('0x13')]);return _0x2233cf(_0x31c797[_0x8614('0x11')][_0x8614('0x13')]);}else{logger[_0x8614('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x1ec7e7,'request\x20sent');_0x2233cf(_0x31c797[_0x8614('0x14')][_0x8614('0x13')]);}})[_0x8614('0x15')](function(_0x137fb0){logger[_0x8614('0x11')](_0x8614('0x12'),_0x1ec7e7,_0x137fb0);_0x556c19(_0x137fb0);});});}exports[_0x8614('0x16')]=function(_0x3823d2){var _0x1ce1e3=this;return new Promise(function(_0x14861a,_0x260dc0){return db[_0x8614('0x17')][_0x8614('0x18')](_0x3823d2[_0x8614('0x19')],{'raw':_0x3823d2['options']?_0x3823d2['options'][_0x8614('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x23e124){logger[_0x8614('0xb')](_0x8614('0x16'),_0x3823d2);logger[_0x8614('0xc')](_0x8614('0x16'),_0x3823d2,JSON[_0x8614('0xf')](_0x23e124));_0x14861a(_0x23e124);})[_0x8614('0x15')](function(_0x43127b){logger[_0x8614('0x11')]('CreateFaxQueueReport',_0x43127b[_0x8614('0x13')],_0x3823d2);_0x260dc0(_0x1ce1e3[_0x8614('0x11')](0x1f4,_0x43127b['message']));});});};exports['UpdateFaxQueueReport']=function(_0x34faf6){var _0x4f678a=this;return new Promise(function(_0x2809e9,_0x87d160){return db['FaxQueueReport'][_0x8614('0x1b')](_0x34faf6['body'],{'raw':_0x34faf6[_0x8614('0x1c')]?_0x34faf6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34faf6[_0x8614('0x1c')]?_0x34faf6[_0x8614('0x1c')][_0x8614('0x1d')]||null:null,'attributes':_0x34faf6[_0x8614('0x1c')]?_0x34faf6['options'][_0x8614('0x1e')]||null:null,'limit':_0x34faf6[_0x8614('0x1c')]?_0x34faf6['options'][_0x8614('0x1f')]||null:null})[_0x8614('0x20')](function(_0x4005cd){logger[_0x8614('0xb')](_0x8614('0x21'),_0x34faf6);logger[_0x8614('0xc')](_0x8614('0x21'),_0x34faf6,JSON[_0x8614('0xf')](_0x4005cd));_0x2809e9(_0x4005cd);})[_0x8614('0x15')](function(_0x59504b){logger['error'](_0x8614('0x21'),_0x59504b['message'],_0x34faf6);_0x87d160(_0x4f678a[_0x8614('0x11')](0x1f4,_0x59504b[_0x8614('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3383f01..2c60d4d 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 _0x5a67=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0x17f548,_0x56c1f0){var _0x52656b=function(_0x37cd6a){while(--_0x37cd6a){_0x17f548['push'](_0x17f548['shift']());}};_0x52656b(++_0x56c1f0);}(_0x5a67,0xd0));var _0x75a6=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x5a67[_0x297eea];return _0x1c42d2;};'use strict';var multer=require(_0x75a6('0x0'));var util=require(_0x75a6('0x1'));var path=require('path');var timeout=require(_0x75a6('0x2'));var express=require(_0x75a6('0x3'));var router=express[_0x75a6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x75a6('0x5'));var interaction=require(_0x75a6('0x6'));var config=require(_0x75a6('0x7'));var controller=require(_0x75a6('0x8'));router[_0x75a6('0x9')]('/',auth[_0x75a6('0xa')](),controller[_0x75a6('0xb')]);router[_0x75a6('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x75a6('0xc')]);router[_0x75a6('0x9')](_0x75a6('0xd'),auth[_0x75a6('0xa')](),controller[_0x75a6('0xe')]);router[_0x75a6('0xf')]('/',auth[_0x75a6('0xa')](),controller[_0x75a6('0x10')]);router[_0x75a6('0x11')](_0x75a6('0xd'),auth['isAuthenticated'](),controller[_0x75a6('0x12')]);router[_0x75a6('0x13')](_0x75a6('0xd'),auth[_0x75a6('0xa')](),controller[_0x75a6('0x14')]);module[_0x75a6('0x15')]=router; \ No newline at end of file +var _0x3180=['isAuthenticated','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3180,0x1f0));var _0x0318=function(_0x536a1b,_0x124563){_0x536a1b=_0x536a1b-0x0;var _0x29df5c=_0x3180[_0x536a1b];return _0x29df5c;};'use strict';var multer=require(_0x0318('0x0'));var util=require(_0x0318('0x1'));var path=require(_0x0318('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0318('0x3')]();var fs_extra=require(_0x0318('0x4'));var auth=require(_0x0318('0x5'));var interaction=require(_0x0318('0x6'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x0318('0x7')]('/',auth[_0x0318('0x8')](),controller['index']);router[_0x0318('0x7')](_0x0318('0x9'),auth[_0x0318('0x8')](),controller[_0x0318('0xa')]);router['get'](_0x0318('0xb'),auth[_0x0318('0x8')](),controller['show']);router[_0x0318('0xc')]('/',auth[_0x0318('0x8')](),controller[_0x0318('0xd')]);router[_0x0318('0xe')](_0x0318('0xb'),auth[_0x0318('0x8')](),controller[_0x0318('0xf')]);router['delete'](_0x0318('0xb'),auth['isAuthenticated'](),controller[_0x0318('0x10')]);module[_0x0318('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 431f922..ab30c71 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x29cdf9,_0xd79358){var _0x4dbd82=function(_0xbeed28){while(--_0xbeed28){_0x29cdf9['push'](_0x29cdf9['shift']());}};_0x4dbd82(++_0xd79358);}(_0x00bb,0x1d8));var _0xb00b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00bb[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1b3f4a,_0x27a7e5){var _0x3522da=function(_0xe27bc2){while(--_0xe27bc2){_0x1b3f4a['push'](_0x1b3f4a['shift']());}};_0x3522da(++_0x27a7e5);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x00bb[_0x1e7b16];return _0x37fadc;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8048d07..e46ec02 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 _0x765d=['length','attributes','hasOwnProperty','order','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields'];(function(_0x17ba4c,_0x21ae82){var _0xca88ae=function(_0xe37d7){while(--_0xe37d7){_0x17ba4c['push'](_0x17ba4c['shift']());}};_0xca88ae(++_0x21ae82);}(_0x765d,0xfb));var _0xd765=function(_0x53fc7a,_0x3cdca7){_0x53fc7a=_0x53fc7a-0x0;var _0x1f1c38=_0x765d[_0x53fc7a];return _0x1f1c38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd765('0x0'));var zipdir=require(_0xd765('0x1'));var jsonpatch=require(_0xd765('0x2'));var rp=require(_0xd765('0x3'));var moment=require(_0xd765('0x4'));var BPromise=require(_0xd765('0x5'));var Mustache=require(_0xd765('0x6'));var util=require('util');var path=require(_0xd765('0x7'));var sox=require(_0xd765('0x8'));var csv=require(_0xd765('0x9'));var ejs=require(_0xd765('0xa'));var fs=require('fs');var fs_extra=require(_0xd765('0xb'));var _=require(_0xd765('0xc'));var squel=require('squel');var crypto=require(_0xd765('0xd'));var jsforce=require(_0xd765('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd765('0x9'));var querystring=require(_0xd765('0xf'));var Papa=require(_0xd765('0x10'));var Redis=require(_0xd765('0x11'));var authService=require(_0xd765('0x12'));var qs=require(_0xd765('0x13'));var as=require(_0xd765('0x14'));var hardwareService=require(_0xd765('0x15'));var logger=require(_0xd765('0x16'))('api');var utils=require(_0xd765('0x17'));var config=require(_0xd765('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f0606,_0x349c04){_0x349c04=_0x349c04||0xcc;return function(_0xc49745){if(_0xc49745){return _0x1f0606[_0xd765('0x19')](_0x349c04);}return _0x1f0606[_0xd765('0x1a')](_0x349c04)['end']();};}function respondWithResult(_0x56b4ee,_0x5ca77a){_0x5ca77a=_0x5ca77a||0xc8;return function(_0x2bd815){if(_0x2bd815){return _0x56b4ee['status'](_0x5ca77a)[_0xd765('0x1b')](_0x2bd815);}};}function respondWithFilteredResult(_0x462c46,_0xbecb45){return function(_0x55a530){if(_0x55a530){var _0x4246ce=typeof _0xbecb45[_0xd765('0x1c')]===_0xd765('0x1d')&&typeof _0xbecb45[_0xd765('0x1e')]==='undefined';var _0x23e0a5=_0x55a530[_0xd765('0x1f')];var _0x276a9b=_0x4246ce?0x0:_0xbecb45['offset'];var _0x5e0fd0=_0x4246ce?_0x55a530[_0xd765('0x1f')]:_0xbecb45[_0xd765('0x1c')]+_0xbecb45[_0xd765('0x1e')];var _0x28b938;if(_0x5e0fd0>=_0x23e0a5){_0x5e0fd0=_0x23e0a5;_0x28b938=0xc8;}else{_0x28b938=0xce;}_0x462c46[_0xd765('0x1a')](_0x28b938);return _0x462c46[_0xd765('0x20')](_0xd765('0x21'),_0x276a9b+'-'+_0x5e0fd0+'/'+_0x23e0a5)[_0xd765('0x1b')](_0x55a530);}return null;};}function patchUpdates(_0x1e5349){return function(_0x33498){try{jsonpatch[_0xd765('0x22')](_0x33498,_0x1e5349,!![]);}catch(_0x1dc6e3){return BPromise[_0xd765('0x23')](_0x1dc6e3);}return _0x33498[_0xd765('0x24')]();};}function saveUpdates(_0x40aa12,_0x36b0e7){return function(_0x8d4d5c){if(_0x8d4d5c){return _0x8d4d5c['update'](_0x40aa12)[_0xd765('0x25')](function(_0x3c41c8){return _0x3c41c8;});}return null;};}function removeEntity(_0x776bb2,_0x6d9836){return function(_0x357c8b){if(_0x357c8b){return _0x357c8b['destroy']()[_0xd765('0x25')](function(){_0x776bb2['status'](0xcc)[_0xd765('0x26')]();});}};}function handleEntityNotFound(_0x2fdb5f,_0x16b4b0){return function(_0x353f90){if(!_0x353f90){_0x2fdb5f['sendStatus'](0x194);}return _0x353f90;};}function handleError(_0x34ea34,_0x55700a){_0x55700a=_0x55700a||0x1f4;return function(_0x35cd5a){logger[_0xd765('0x27')](_0x35cd5a['stack']);if(_0x35cd5a[_0xd765('0x28')]){delete _0x35cd5a[_0xd765('0x28')];}_0x34ea34[_0xd765('0x1a')](_0x55700a)[_0xd765('0x29')](_0x35cd5a);};}exports[_0xd765('0x2a')]=function(_0x598191,_0x2c9ed1){var _0x4763fb={},_0x588b7d={},_0x24fbf8={'count':0x0,'rows':[]};var _0x19d967=_[_0xd765('0x2b')](db[_0xd765('0x2c')][_0xd765('0x2d')],function(_0x2ed608){return{'name':_0x2ed608[_0xd765('0x2e')],'type':_0x2ed608['type'][_0xd765('0x2f')]};});_0x588b7d[_0xd765('0x30')]=_[_0xd765('0x2b')](_0x19d967,'name');_0x588b7d[_0xd765('0x31')]=_[_0xd765('0x32')](_0x598191[_0xd765('0x31')]);_0x588b7d['filters']=_[_0xd765('0x33')](_0x588b7d[_0xd765('0x30')],_0x588b7d[_0xd765('0x31')]);_0x4763fb['attributes']=_['intersection'](_0x588b7d[_0xd765('0x30')],qs['fields'](_0x598191[_0xd765('0x31')][_0xd765('0x34')]));_0x4763fb['attributes']=_0x4763fb['attributes'][_0xd765('0x35')]?_0x4763fb[_0xd765('0x36')]:_0x588b7d['model'];if(!_0x598191[_0xd765('0x31')][_0xd765('0x37')]('nolimit')){_0x4763fb['limit']=qs[_0xd765('0x1e')](_0x598191[_0xd765('0x31')][_0xd765('0x1e')]);_0x4763fb[_0xd765('0x1c')]=qs[_0xd765('0x1c')](_0x598191[_0xd765('0x31')][_0xd765('0x1c')]);}_0x4763fb[_0xd765('0x38')]=qs['sort'](_0x598191[_0xd765('0x31')]['sort']);_0x4763fb[_0xd765('0x39')]=qs[_0xd765('0x3a')](_[_0xd765('0x3b')](_0x598191[_0xd765('0x31')],_0x588b7d['filters']),_0x19d967);if(_0x598191[_0xd765('0x31')]['filter']){_0x4763fb[_0xd765('0x39')]=_['merge'](_0x4763fb[_0xd765('0x39')],{'$or':_[_0xd765('0x2b')](_0x19d967,function(_0x12ccbf){if(_0x12ccbf[_0xd765('0x3c')]!==_0xd765('0x3d')){var _0x24fa28={};_0x24fa28[_0x12ccbf['name']]={'$like':'%'+_0x598191[_0xd765('0x31')][_0xd765('0x3e')]+'%'};return _0x24fa28;}})});}_0x4763fb=_[_0xd765('0x3f')]({},_0x4763fb,_0x598191['options']);var _0x5f306c={'where':_0x4763fb[_0xd765('0x39')]};return db['FaxTransferReport']['count'](_0x5f306c)[_0xd765('0x25')](function(_0x1b8887){_0x24fbf8[_0xd765('0x1f')]=_0x1b8887;if(_0x598191[_0xd765('0x31')][_0xd765('0x40')]){_0x4763fb[_0xd765('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xd765('0x42')](_0x4763fb);})[_0xd765('0x25')](function(_0x1a3bad){_0x24fbf8[_0xd765('0x43')]=_0x1a3bad;return _0x24fbf8;})[_0xd765('0x25')](respondWithFilteredResult(_0x2c9ed1,_0x4763fb))[_0xd765('0x44')](handleError(_0x2c9ed1,null));};exports[_0xd765('0x45')]=function(_0x3319f5,_0x506e0b){var _0x11a9ce={'raw':!![],'where':{'id':_0x3319f5[_0xd765('0x46')]['id']}},_0x44372c={};_0x44372c[_0xd765('0x30')]=_[_0xd765('0x32')](db[_0xd765('0x2c')][_0xd765('0x2d')]);_0x44372c[_0xd765('0x31')]=_[_0xd765('0x32')](_0x3319f5[_0xd765('0x31')]);_0x44372c[_0xd765('0x3a')]=_[_0xd765('0x33')](_0x44372c[_0xd765('0x30')],_0x44372c['query']);_0x11a9ce[_0xd765('0x36')]=_[_0xd765('0x33')](_0x44372c[_0xd765('0x30')],qs[_0xd765('0x34')](_0x3319f5['query'][_0xd765('0x34')]));_0x11a9ce[_0xd765('0x36')]=_0x11a9ce[_0xd765('0x36')][_0xd765('0x35')]?_0x11a9ce[_0xd765('0x36')]:_0x44372c['model'];if(_0x3319f5['query'][_0xd765('0x40')]){_0x11a9ce[_0xd765('0x41')]=[{'all':!![]}];}_0x11a9ce=_[_0xd765('0x3f')]({},_0x11a9ce,_0x3319f5['options']);return db['FaxTransferReport']['find'](_0x11a9ce)[_0xd765('0x25')](handleEntityNotFound(_0x506e0b,null))[_0xd765('0x25')](respondWithResult(_0x506e0b,null))['catch'](handleError(_0x506e0b,null));};exports[_0xd765('0x47')]=function(_0xa977c6,_0xc3a07c){return db[_0xd765('0x2c')][_0xd765('0x47')](_0xa977c6['body'],{})[_0xd765('0x25')](respondWithResult(_0xc3a07c,0xc9))[_0xd765('0x44')](handleError(_0xc3a07c,null));};exports['update']=function(_0x24c078,_0x2737f4){if(_0x24c078[_0xd765('0x48')]['id']){delete _0x24c078[_0xd765('0x48')]['id'];}return db['FaxTransferReport'][_0xd765('0x49')]({'where':{'id':_0x24c078[_0xd765('0x46')]['id']}})[_0xd765('0x25')](handleEntityNotFound(_0x2737f4,null))['then'](saveUpdates(_0x24c078[_0xd765('0x48')],null))[_0xd765('0x25')](respondWithResult(_0x2737f4,null))['catch'](handleError(_0x2737f4,null));};exports[_0xd765('0x4a')]=function(_0x30a669,_0x1637c7){return db['FaxTransferReport'][_0xd765('0x49')]({'where':{'id':_0x30a669[_0xd765('0x46')]['id']}})['then'](handleEntityNotFound(_0x1637c7,null))[_0xd765('0x25')](removeEntity(_0x1637c7,null))['catch'](handleError(_0x1637c7,null));};exports[_0xd765('0x4b')]=function(_0x2d46d9,_0x3248a5){return db[_0xd765('0x2c')][_0xd765('0x4b')]()['then'](respondWithResult(_0x3248a5,null))['catch'](handleError(_0x3248a5,null));}; \ No newline at end of file +var _0x8efd=['body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','create'];(function(_0x13ef4f,_0x268dae){var _0x568fa4=function(_0x166586){while(--_0x166586){_0x13ef4f['push'](_0x13ef4f['shift']());}};_0x568fa4(++_0x268dae);}(_0x8efd,0x1b9));var _0xd8ef=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8efd[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0xd8ef('0x0'));var rimraf=require(_0xd8ef('0x1'));var zipdir=require(_0xd8ef('0x2'));var jsonpatch=require(_0xd8ef('0x3'));var rp=require('request-promise');var moment=require(_0xd8ef('0x4'));var BPromise=require(_0xd8ef('0x5'));var Mustache=require(_0xd8ef('0x6'));var util=require(_0xd8ef('0x7'));var path=require(_0xd8ef('0x8'));var sox=require(_0xd8ef('0x9'));var csv=require(_0xd8ef('0xa'));var ejs=require(_0xd8ef('0xb'));var fs=require('fs');var fs_extra=require(_0xd8ef('0xc'));var _=require(_0xd8ef('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd8ef('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8ef('0xf'));var Redis=require(_0xd8ef('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8ef('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xd8ef('0x12'));var config=require(_0xd8ef('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8ef('0x14'))['db'];function respondWithStatusCode(_0x1372b0,_0x253d60){_0x253d60=_0x253d60||0xcc;return function(_0xfe3a8d){if(_0xfe3a8d){return _0x1372b0[_0xd8ef('0x15')](_0x253d60);}return _0x1372b0[_0xd8ef('0x16')](_0x253d60)[_0xd8ef('0x17')]();};}function respondWithResult(_0x378b8d,_0x4e5c1d){_0x4e5c1d=_0x4e5c1d||0xc8;return function(_0x5322d4){if(_0x5322d4){return _0x378b8d[_0xd8ef('0x16')](_0x4e5c1d)[_0xd8ef('0x18')](_0x5322d4);}};}function respondWithFilteredResult(_0x53a985,_0x4ae828){return function(_0x35c3f2){if(_0x35c3f2){var _0x1f11d5=typeof _0x4ae828['offset']==='undefined'&&typeof _0x4ae828[_0xd8ef('0x19')]==='undefined';var _0x4704dd=_0x35c3f2[_0xd8ef('0x1a')];var _0x414193=_0x1f11d5?0x0:_0x4ae828['offset'];var _0x121400=_0x1f11d5?_0x35c3f2[_0xd8ef('0x1a')]:_0x4ae828[_0xd8ef('0x1b')]+_0x4ae828['limit'];var _0x1734b3;if(_0x121400>=_0x4704dd){_0x121400=_0x4704dd;_0x1734b3=0xc8;}else{_0x1734b3=0xce;}_0x53a985[_0xd8ef('0x16')](_0x1734b3);return _0x53a985[_0xd8ef('0x1c')](_0xd8ef('0x1d'),_0x414193+'-'+_0x121400+'/'+_0x4704dd)[_0xd8ef('0x18')](_0x35c3f2);}return null;};}function patchUpdates(_0x3de39e){return function(_0x49aa80){try{jsonpatch[_0xd8ef('0x1e')](_0x49aa80,_0x3de39e,!![]);}catch(_0x3decdc){return BPromise['reject'](_0x3decdc);}return _0x49aa80[_0xd8ef('0x1f')]();};}function saveUpdates(_0x596afc,_0x12e26e){return function(_0x234f24){if(_0x234f24){return _0x234f24[_0xd8ef('0x20')](_0x596afc)[_0xd8ef('0x21')](function(_0x9032d6){return _0x9032d6;});}return null;};}function removeEntity(_0x285663,_0x26fabe){return function(_0x5aeb5c){if(_0x5aeb5c){return _0x5aeb5c[_0xd8ef('0x22')]()[_0xd8ef('0x21')](function(){_0x285663['status'](0xcc)[_0xd8ef('0x17')]();});}};}function handleEntityNotFound(_0x5c1cc7,_0x5dd045){return function(_0x1784ef){if(!_0x1784ef){_0x5c1cc7['sendStatus'](0x194);}return _0x1784ef;};}function handleError(_0x196013,_0x56f762){_0x56f762=_0x56f762||0x1f4;return function(_0x2456d4){logger[_0xd8ef('0x23')](_0x2456d4[_0xd8ef('0x24')]);if(_0x2456d4[_0xd8ef('0x25')]){delete _0x2456d4[_0xd8ef('0x25')];}_0x196013['status'](_0x56f762)[_0xd8ef('0x26')](_0x2456d4);};}exports[_0xd8ef('0x27')]=function(_0x22843a,_0x168b6d){var _0x3298d2={},_0x3a49ca={},_0x5ef246={'count':0x0,'rows':[]};var _0x15181f=_[_0xd8ef('0x28')](db[_0xd8ef('0x29')]['rawAttributes'],function(_0x1e348a){return{'name':_0x1e348a['fieldName'],'type':_0x1e348a[_0xd8ef('0x2a')][_0xd8ef('0x2b')]};});_0x3a49ca[_0xd8ef('0x2c')]=_[_0xd8ef('0x28')](_0x15181f,_0xd8ef('0x25'));_0x3a49ca[_0xd8ef('0x2d')]=_[_0xd8ef('0x2e')](_0x22843a[_0xd8ef('0x2d')]);_0x3a49ca[_0xd8ef('0x2f')]=_['intersection'](_0x3a49ca[_0xd8ef('0x2c')],_0x3a49ca['query']);_0x3298d2[_0xd8ef('0x30')]=_['intersection'](_0x3a49ca['model'],qs[_0xd8ef('0x31')](_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x31')]));_0x3298d2[_0xd8ef('0x30')]=_0x3298d2[_0xd8ef('0x30')][_0xd8ef('0x32')]?_0x3298d2[_0xd8ef('0x30')]:_0x3a49ca[_0xd8ef('0x2c')];if(!_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x33')](_0xd8ef('0x34'))){_0x3298d2['limit']=qs[_0xd8ef('0x19')](_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x19')]);_0x3298d2[_0xd8ef('0x1b')]=qs['offset'](_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x1b')]);}_0x3298d2[_0xd8ef('0x35')]=qs[_0xd8ef('0x36')](_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x36')]);_0x3298d2[_0xd8ef('0x37')]=qs['filters'](_[_0xd8ef('0x38')](_0x22843a[_0xd8ef('0x2d')],_0x3a49ca[_0xd8ef('0x2f')]),_0x15181f);if(_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x39')]){_0x3298d2[_0xd8ef('0x37')]=_[_0xd8ef('0x3a')](_0x3298d2[_0xd8ef('0x37')],{'$or':_[_0xd8ef('0x28')](_0x15181f,function(_0x5b6463){if(_0x5b6463['type']!==_0xd8ef('0x3b')){var _0x147d2d={};_0x147d2d[_0x5b6463[_0xd8ef('0x25')]]={'$like':'%'+_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x39')]+'%'};return _0x147d2d;}})});}_0x3298d2=_['merge']({},_0x3298d2,_0x22843a[_0xd8ef('0x3c')]);var _0x2f34fc={'where':_0x3298d2['where']};return db[_0xd8ef('0x29')][_0xd8ef('0x1a')](_0x2f34fc)[_0xd8ef('0x21')](function(_0x354b06){_0x5ef246['count']=_0x354b06;if(_0x22843a[_0xd8ef('0x2d')][_0xd8ef('0x3d')]){_0x3298d2['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xd8ef('0x3e')](_0x3298d2);})[_0xd8ef('0x21')](function(_0x1e0594){_0x5ef246[_0xd8ef('0x3f')]=_0x1e0594;return _0x5ef246;})[_0xd8ef('0x21')](respondWithFilteredResult(_0x168b6d,_0x3298d2))[_0xd8ef('0x40')](handleError(_0x168b6d,null));};exports[_0xd8ef('0x41')]=function(_0x6aae1e,_0x5cd0dc){var _0x55155b={'raw':!![],'where':{'id':_0x6aae1e[_0xd8ef('0x42')]['id']}},_0x2ca788={};_0x2ca788[_0xd8ef('0x2c')]=_[_0xd8ef('0x2e')](db[_0xd8ef('0x29')][_0xd8ef('0x43')]);_0x2ca788['query']=_[_0xd8ef('0x2e')](_0x6aae1e[_0xd8ef('0x2d')]);_0x2ca788[_0xd8ef('0x2f')]=_[_0xd8ef('0x44')](_0x2ca788[_0xd8ef('0x2c')],_0x2ca788['query']);_0x55155b[_0xd8ef('0x30')]=_[_0xd8ef('0x44')](_0x2ca788['model'],qs[_0xd8ef('0x31')](_0x6aae1e[_0xd8ef('0x2d')]['fields']));_0x55155b[_0xd8ef('0x30')]=_0x55155b[_0xd8ef('0x30')][_0xd8ef('0x32')]?_0x55155b[_0xd8ef('0x30')]:_0x2ca788[_0xd8ef('0x2c')];if(_0x6aae1e[_0xd8ef('0x2d')][_0xd8ef('0x3d')]){_0x55155b['include']=[{'all':!![]}];}_0x55155b=_['merge']({},_0x55155b,_0x6aae1e[_0xd8ef('0x3c')]);return db['FaxTransferReport']['find'](_0x55155b)[_0xd8ef('0x21')](handleEntityNotFound(_0x5cd0dc,null))['then'](respondWithResult(_0x5cd0dc,null))[_0xd8ef('0x40')](handleError(_0x5cd0dc,null));};exports[_0xd8ef('0x45')]=function(_0x578810,_0x5c83df){return db[_0xd8ef('0x29')][_0xd8ef('0x45')](_0x578810[_0xd8ef('0x46')],{})[_0xd8ef('0x21')](respondWithResult(_0x5c83df,0xc9))[_0xd8ef('0x40')](handleError(_0x5c83df,null));};exports[_0xd8ef('0x20')]=function(_0x501de0,_0x180424){if(_0x501de0[_0xd8ef('0x46')]['id']){delete _0x501de0['body']['id'];}return db[_0xd8ef('0x29')][_0xd8ef('0x47')]({'where':{'id':_0x501de0[_0xd8ef('0x42')]['id']}})[_0xd8ef('0x21')](handleEntityNotFound(_0x180424,null))[_0xd8ef('0x21')](saveUpdates(_0x501de0[_0xd8ef('0x46')],null))[_0xd8ef('0x21')](respondWithResult(_0x180424,null))[_0xd8ef('0x40')](handleError(_0x180424,null));};exports[_0xd8ef('0x22')]=function(_0x39132e,_0x2816c8){return db[_0xd8ef('0x29')][_0xd8ef('0x47')]({'where':{'id':_0x39132e['params']['id']}})[_0xd8ef('0x21')](handleEntityNotFound(_0x2816c8,null))['then'](removeEntity(_0x2816c8,null))[_0xd8ef('0x40')](handleError(_0x2816c8,null));};exports[_0xd8ef('0x48')]=function(_0x53b97a,_0x4b363b){return db[_0xd8ef('0x29')][_0xd8ef('0x48')]()[_0xd8ef('0x21')](respondWithResult(_0x4b363b,null))[_0xd8ef('0x40')](handleError(_0x4b363b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7462c39..46b2c3b 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 _0x5080=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','rimraf','./faxTransferReport.attributes','exports','define'];(function(_0x14a355,_0x33251b){var _0x53f527=function(_0x57380b){while(--_0x57380b){_0x14a355['push'](_0x14a355['shift']());}};_0x53f527(++_0x33251b);}(_0x5080,0x158));var _0x0508=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5080[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x0508('0x0'));var util=require(_0x0508('0x1'));var logger=require(_0x0508('0x2'))('api');var moment=require(_0x0508('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0508('0x4'));var config=require('../../config/environment');var attributes=require(_0x0508('0x5'));module[_0x0508('0x6')]=function(_0xfe62a7,_0x2d1597){return _0xfe62a7[_0x0508('0x7')](_0x0508('0x8'),attributes,{'tableName':_0x0508('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0508('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f74=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','FaxTransferReport'];(function(_0x35a0a2,_0xbfda14){var _0x497ab5=function(_0xb7ee9e){while(--_0xb7ee9e){_0x35a0a2['push'](_0x35a0a2['shift']());}};_0x497ab5(++_0xbfda14);}(_0x3f74,0x121));var _0x43f7=function(_0x33e939,_0x19a4b3){_0x33e939=_0x33e939-0x0;var _0x5112ef=_0x3f74[_0x33e939];return _0x5112ef;};'use strict';var _=require(_0x43f7('0x0'));var util=require(_0x43f7('0x1'));var logger=require(_0x43f7('0x2'))(_0x43f7('0x3'));var moment=require(_0x43f7('0x4'));var BPromise=require(_0x43f7('0x5'));var rp=require(_0x43f7('0x6'));var fs=require('fs');var path=require(_0x43f7('0x7'));var rimraf=require('rimraf');var config=require(_0x43f7('0x8'));var attributes=require(_0x43f7('0x9'));module['exports']=function(_0x4fa0e1,_0x37e991){return _0x4fa0e1['define'](_0x43f7('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x43f7('0xb'),'fields':[_0x43f7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5058074..d143f76 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 _0x25b9=['jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2aaaa7,_0x334d32){var _0x15f57d=function(_0x415dfa){while(--_0x415dfa){_0x2aaaa7['push'](_0x2aaaa7['shift']());}};_0x15f57d(++_0x334d32);}(_0x25b9,0x70));var _0x925b=function(_0x683a2b,_0x6edd4d){_0x683a2b=_0x683a2b-0x0;var _0x4a7e93=_0x25b9[_0x683a2b];return _0x4a7e93;};'use strict';var _=require(_0x925b('0x0'));var util=require(_0x925b('0x1'));var moment=require(_0x925b('0x2'));var BPromise=require(_0x925b('0x3'));var rs=require(_0x925b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x925b('0x5'))['db'];var utils=require(_0x925b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x925b('0x7'));var jayson=require(_0x925b('0x8'));var client=jayson[_0x925b('0x9')][_0x925b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5085,_0x1e937d,_0x1e3751){return new BPromise(function(_0x306d27,_0x4e3b4c){return client[_0x925b('0xb')](_0x4c5085,_0x1e3751)[_0x925b('0xc')](function(_0x1aed20){logger[_0x925b('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x1e937d,_0x925b('0xe'));logger[_0x925b('0xf')](_0x925b('0x10'),_0x1e937d,_0x925b('0xe'),JSON[_0x925b('0x11')](_0x1aed20));if(_0x1aed20['error']){if(_0x1aed20[_0x925b('0x12')][_0x925b('0x13')]===0x1f4){logger[_0x925b('0x12')](_0x925b('0x14'),_0x1e937d,_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);return _0x4e3b4c(_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1e937d,_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);return _0x306d27(_0x1aed20[_0x925b('0x12')][_0x925b('0x15')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x1e937d,'request\x20sent');_0x306d27(_0x1aed20[_0x925b('0x16')][_0x925b('0x15')]);}})[_0x925b('0x17')](function(_0x1def8d){logger[_0x925b('0x12')](_0x925b('0x14'),_0x1e937d,_0x1def8d);_0x4e3b4c(_0x1def8d);});});} \ No newline at end of file +var _0x0d33=['error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0d33,0x1ea));var _0x30d3=function(_0x2be8ef,_0x348624){_0x2be8ef=_0x2be8ef-0x0;var _0x38a9ad=_0x0d33[_0x2be8ef];return _0x38a9ad;};'use strict';var _=require(_0x30d3('0x0'));var util=require(_0x30d3('0x1'));var moment=require(_0x30d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x30d3('0x3'));var fs=require('fs');var Redis=require(_0x30d3('0x4'));var db=require(_0x30d3('0x5'))['db'];var utils=require(_0x30d3('0x6'));var logger=require(_0x30d3('0x7'))(_0x30d3('0x8'));var config=require(_0x30d3('0x9'));var jayson=require(_0x30d3('0xa'));var client=jayson[_0x30d3('0xb')][_0x30d3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ab8c3,_0x34f71a,_0x690b53){return new BPromise(function(_0x1f611c,_0x1c6b8a){return client[_0x30d3('0xd')](_0x2ab8c3,_0x690b53)[_0x30d3('0xe')](function(_0x42855){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x34f71a,_0x30d3('0xf'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x34f71a,'request\x20sent',JSON['stringify'](_0x42855));if(_0x42855[_0x30d3('0x10')]){if(_0x42855['error'][_0x30d3('0x11')]===0x1f4){logger[_0x30d3('0x10')](_0x30d3('0x12'),_0x34f71a,_0x42855[_0x30d3('0x10')][_0x30d3('0x13')]);return _0x1c6b8a(_0x42855[_0x30d3('0x10')][_0x30d3('0x13')]);}logger[_0x30d3('0x10')](_0x30d3('0x12'),_0x34f71a,_0x42855[_0x30d3('0x10')][_0x30d3('0x13')]);return _0x1f611c(_0x42855[_0x30d3('0x10')][_0x30d3('0x13')]);}else{logger['info'](_0x30d3('0x12'),_0x34f71a,_0x30d3('0xf'));_0x1f611c(_0x42855[_0x30d3('0x14')]['message']);}})[_0x30d3('0x15')](function(_0x3464fe){logger[_0x30d3('0x10')](_0x30d3('0x12'),_0x34f71a,_0x3464fe);_0x1c6b8a(_0x3464fe);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 40eafe1..547ca04 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 _0x413b=['create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','/:id','isAuthenticated','show','post'];(function(_0x2fbedc,_0x25d163){var _0x56b33e=function(_0x2bfc82){while(--_0x2bfc82){_0x2fbedc['push'](_0x2fbedc['shift']());}};_0x56b33e(++_0x25d163);}(_0x413b,0x6a));var _0xb413=function(_0x259d6b,_0x2efc49){_0x259d6b=_0x259d6b-0x0;var _0x5e3636=_0x413b[_0x259d6b];return _0x5e3636;};'use strict';var multer=require(_0xb413('0x0'));var util=require('util');var path=require(_0xb413('0x1'));var timeout=require('connect-timeout');var express=require(_0xb413('0x2'));var router=express[_0xb413('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb413('0x4'));var interaction=require(_0xb413('0x5'));var config=require(_0xb413('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb413('0x7')]);router[_0xb413('0x8')](_0xb413('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xb413('0x8')](_0xb413('0xa'),auth[_0xb413('0xb')](),controller[_0xb413('0xc')]);router[_0xb413('0xd')]('/',auth[_0xb413('0xb')](),controller[_0xb413('0xe')]);router[_0xb413('0xf')]('/:id',auth[_0xb413('0xb')](),controller[_0xb413('0x10')]);router[_0xb413('0x11')](_0xb413('0xa'),auth[_0xb413('0xb')](),controller[_0xb413('0x12')]);module[_0xb413('0x13')]=router; \ No newline at end of file +var _0xbc21=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbc21,0x175));var _0x1bc2=function(_0x1c9ddb,_0x29fa2e){_0x1c9ddb=_0x1c9ddb-0x0;var _0x569212=_0xbc21[_0x1c9ddb];return _0x569212;};'use strict';var multer=require(_0x1bc2('0x0'));var util=require('util');var path=require(_0x1bc2('0x1'));var timeout=require(_0x1bc2('0x2'));var express=require(_0x1bc2('0x3'));var router=express[_0x1bc2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc2('0x5'));var interaction=require(_0x1bc2('0x6'));var config=require(_0x1bc2('0x7'));var controller=require(_0x1bc2('0x8'));router[_0x1bc2('0x9')]('/',auth['isAuthenticated'](),controller[_0x1bc2('0xa')]);router[_0x1bc2('0x9')](_0x1bc2('0xb'),auth['isAuthenticated'](),controller[_0x1bc2('0xc')]);router[_0x1bc2('0x9')](_0x1bc2('0xd'),auth[_0x1bc2('0xe')](),controller[_0x1bc2('0xf')]);router[_0x1bc2('0x10')]('/',auth[_0x1bc2('0xe')](),controller[_0x1bc2('0x11')]);router['put'](_0x1bc2('0xd'),auth['isAuthenticated'](),controller[_0x1bc2('0x12')]);router[_0x1bc2('0x13')](_0x1bc2('0xd'),auth[_0x1bc2('0xe')](),controller[_0x1bc2('0x14')]);module[_0x1bc2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7290952..cfb68f5 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 _0x1f93=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x194992,_0x1e6005){var _0x3bc551=function(_0x36001f){while(--_0x36001f){_0x194992['push'](_0x194992['shift']());}};_0x3bc551(++_0x1e6005);}(_0x1f93,0x113));var _0x31f9=function(_0x525dc3,_0x1aa345){_0x525dc3=_0x525dc3-0x0;var _0xd56458=_0x1f93[_0x525dc3];return _0xd56458;};'use strict';var multer=require(_0x31f9('0x0'));var util=require(_0x31f9('0x1'));var path=require(_0x31f9('0x2'));var timeout=require(_0x31f9('0x3'));var express=require(_0x31f9('0x4'));var router=express[_0x31f9('0x5')]();var fs_extra=require(_0x31f9('0x6'));var auth=require(_0x31f9('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x31f9('0x8'));router[_0x31f9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x31f9('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x31f9('0x9')]('/:id/configurations',auth[_0x31f9('0xa')](),controller['getConfigurations']);router['get'](_0x31f9('0xb'),auth[_0x31f9('0xa')](),controller[_0x31f9('0xc')]);router[_0x31f9('0xd')]('/',auth[_0x31f9('0xa')](),controller[_0x31f9('0xe')]);router['post'](_0x31f9('0xf'),auth['isAuthenticated'](),controller[_0x31f9('0x10')]);router[_0x31f9('0x11')](_0x31f9('0x12'),auth[_0x31f9('0xa')](),controller[_0x31f9('0x13')]);router['delete'](_0x31f9('0x12'),auth[_0x31f9('0xa')](),controller[_0x31f9('0x14')]);module[_0x31f9('0x15')]=router; \ No newline at end of file +var _0x70f0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','create','post','addConfiguration','delete','destroy','multer','path'];(function(_0x4635fa,_0x4b3291){var _0xc4d00b=function(_0x6c2edf){while(--_0x6c2edf){_0x4635fa['push'](_0x4635fa['shift']());}};_0xc4d00b(++_0x4b3291);}(_0x70f0,0x11e));var _0x070f=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x70f0[_0x246227];return _0x37bd4a;};'use strict';var multer=require(_0x070f('0x0'));var util=require('util');var path=require(_0x070f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070f('0x2')]();var fs_extra=require(_0x070f('0x3'));var auth=require(_0x070f('0x4'));var interaction=require(_0x070f('0x5'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x070f('0x6')]('/',auth['isAuthenticated'](),controller[_0x070f('0x7')]);router[_0x070f('0x6')](_0x070f('0x8'),auth[_0x070f('0x9')](),controller[_0x070f('0xa')]);router['get'](_0x070f('0xb'),auth[_0x070f('0x9')](),controller['getConfigurations']);router[_0x070f('0x6')](_0x070f('0xc'),auth[_0x070f('0x9')](),controller['getFields']);router['post']('/',auth[_0x070f('0x9')](),controller[_0x070f('0xd')]);router[_0x070f('0xe')](_0x070f('0xb'),auth[_0x070f('0x9')](),controller[_0x070f('0xf')]);router['put']('/:id',auth[_0x070f('0x9')](),controller['update']);router[_0x070f('0x10')](_0x070f('0x8'),auth['isAuthenticated'](),controller[_0x070f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a36d0e6..a759b41 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 _0xa92e=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xa92e,0xbf));var _0xea92=function(_0x10702d,_0x329cf3){_0x10702d=_0x10702d-0x0;var _0x3587d7=_0xa92e[_0x10702d];return _0x3587d7;};'use strict';var Sequelize=require(_0xea92('0x0'));module['exports']={'name':{'type':Sequelize[_0xea92('0x1')]},'description':{'type':Sequelize[_0xea92('0x1')]},'username':{'type':Sequelize[_0xea92('0x1')]},'remoteUri':{'type':Sequelize[_0xea92('0x1')]},'authType':{'type':Sequelize[_0xea92('0x2')]('basic'),'defaultValue':_0xea92('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xea92('0x1')]},'consumerSecret':{'type':Sequelize[_0xea92('0x1')]},'token':{'type':Sequelize[_0xea92('0x1')]},'tokenSecret':{'type':Sequelize[_0xea92('0x1')]},'serverUrl':{'type':Sequelize[_0xea92('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xea92('0x2')](_0xea92('0x4'),_0xea92('0x5')),'defaultValue':_0xea92('0x4')}}; \ No newline at end of file +var _0xb2d9=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x405a11,_0x1f1d08){var _0x5c5923=function(_0x36497b){while(--_0x36497b){_0x405a11['push'](_0x405a11['shift']());}};_0x5c5923(++_0x1f1d08);}(_0xb2d9,0x1e7));var _0x9b2d=function(_0x7af384,_0x22ff96){_0x7af384=_0x7af384-0x0;var _0x2695fc=_0xb2d9[_0x7af384];return _0x2695fc;};'use strict';var Sequelize=require(_0x9b2d('0x0'));module[_0x9b2d('0x1')]={'name':{'type':Sequelize[_0x9b2d('0x2')]},'description':{'type':Sequelize[_0x9b2d('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9b2d('0x2')]},'authType':{'type':Sequelize[_0x9b2d('0x3')](_0x9b2d('0x4')),'defaultValue':_0x9b2d('0x4')},'password':{'type':Sequelize[_0x9b2d('0x2')]},'consumerKey':{'type':Sequelize[_0x9b2d('0x2')]},'consumerSecret':{'type':Sequelize[_0x9b2d('0x2')]},'token':{'type':Sequelize[_0x9b2d('0x2')]},'tokenSecret':{'type':Sequelize[_0x9b2d('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9b2d('0x3')]('integrationTab',_0x9b2d('0x5')),'defaultValue':_0x9b2d('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 2b16e1b..bc9c86c 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 _0x4c32=['GET','format','application/json','basic','Authorization','Basic\x20%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','options','catch','body','find','getConfigurations','order','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','getFields','priority','findOne','authType','username','password','consumerKey','consumerSecret','token','remoteUri','lastIndexOf'];(function(_0x496a16,_0x5c761b){var _0x316c4e=function(_0x952917){while(--_0x952917){_0x496a16['push'](_0x496a16['shift']());}};_0x316c4e(++_0x5c761b);}(_0x4c32,0x161));var _0x24c3=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x4c32[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0x24c3('0x0'));var rimraf=require(_0x24c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24c3('0x2'));var rp=require(_0x24c3('0x3'));var moment=require(_0x24c3('0x4'));var BPromise=require(_0x24c3('0x5'));var Mustache=require(_0x24c3('0x6'));var util=require(_0x24c3('0x7'));var path=require(_0x24c3('0x8'));var sox=require(_0x24c3('0x9'));var csv=require('to-csv');var ejs=require(_0x24c3('0xa'));var fs=require('fs');var fs_extra=require(_0x24c3('0xb'));var _=require(_0x24c3('0xc'));var squel=require('squel');var crypto=require(_0x24c3('0xd'));var jsforce=require(_0x24c3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x24c3('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x24c3('0x10'));var authService=require(_0x24c3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x24c3('0x12'));var hardwareService=require(_0x24c3('0x13'));var logger=require(_0x24c3('0x14'))(_0x24c3('0x15'));var utils=require('../../config/utils');var config=require(_0x24c3('0x16'));var licenseUtil=require(_0x24c3('0x17'));var db=require(_0x24c3('0x18'))['db'];var integrations=require(_0x24c3('0x19'));function respondWithStatusCode(_0x24e34a,_0x2793d2){_0x2793d2=_0x2793d2||0xcc;return function(_0x53763e){if(_0x53763e){return _0x24e34a[_0x24c3('0x1a')](_0x2793d2);}return _0x24e34a['status'](_0x2793d2)[_0x24c3('0x1b')]();};}function respondWithResult(_0x25e727,_0x4f3e53){_0x4f3e53=_0x4f3e53||0xc8;return function(_0xbd7906){if(_0xbd7906){return _0x25e727[_0x24c3('0x1c')](_0x4f3e53)[_0x24c3('0x1d')](_0xbd7906);}};}function respondWithFilteredResult(_0x640fb6,_0x583a54){return function(_0x4be8dc){if(_0x4be8dc){var _0x54ffa6=typeof _0x583a54[_0x24c3('0x1e')]===_0x24c3('0x1f')&&typeof _0x583a54[_0x24c3('0x20')]===_0x24c3('0x1f');var _0x11942c=_0x4be8dc[_0x24c3('0x21')];var _0x58747c=_0x54ffa6?0x0:_0x583a54[_0x24c3('0x1e')];var _0x4ee41b=_0x54ffa6?_0x4be8dc[_0x24c3('0x21')]:_0x583a54[_0x24c3('0x1e')]+_0x583a54[_0x24c3('0x20')];var _0x27123d;if(_0x4ee41b>=_0x11942c){_0x4ee41b=_0x11942c;_0x27123d=0xc8;}else{_0x27123d=0xce;}_0x640fb6['status'](_0x27123d);return _0x640fb6[_0x24c3('0x22')](_0x24c3('0x23'),_0x58747c+'-'+_0x4ee41b+'/'+_0x11942c)['json'](_0x4be8dc);}return null;};}function patchUpdates(_0x4021c6){return function(_0x238858){try{jsonpatch[_0x24c3('0x24')](_0x238858,_0x4021c6,!![]);}catch(_0x11168e){return BPromise[_0x24c3('0x25')](_0x11168e);}return _0x238858[_0x24c3('0x26')]();};}function saveUpdates(_0x22c14b,_0x47a691){return function(_0x329664){if(_0x329664){return _0x329664[_0x24c3('0x27')](_0x22c14b)['then'](function(_0x21c96a){return _0x21c96a;});}return null;};}function removeEntity(_0x286206,_0x38eb01){return function(_0x12b8aa){if(_0x12b8aa){return _0x12b8aa[_0x24c3('0x28')]()[_0x24c3('0x29')](function(){_0x286206[_0x24c3('0x1c')](0xcc)[_0x24c3('0x1b')]();});}};}function handleEntityNotFound(_0x94087f,_0x2024b6){return function(_0x150a64){if(!_0x150a64){_0x94087f['sendStatus'](0x194);}return _0x150a64;};}function handleError(_0x8d37cd,_0x43ded5){_0x43ded5=_0x43ded5||0x1f4;return function(_0x251fba){logger[_0x24c3('0x2a')](_0x251fba[_0x24c3('0x2b')]);if(_0x251fba[_0x24c3('0x2c')]){delete _0x251fba[_0x24c3('0x2c')];}_0x8d37cd[_0x24c3('0x1c')](_0x43ded5)[_0x24c3('0x2d')](_0x251fba);};}exports[_0x24c3('0x2e')]=function(_0x3a3c29,_0x276465){var _0x98f1fd={},_0x1fe7ed={},_0x8529f8={'count':0x0,'rows':[]};var _0xede262=_[_0x24c3('0x2f')](db[_0x24c3('0x30')][_0x24c3('0x31')],function(_0x38f004){return{'name':_0x38f004[_0x24c3('0x32')],'type':_0x38f004[_0x24c3('0x33')][_0x24c3('0x34')]};});_0x1fe7ed[_0x24c3('0x35')]=_[_0x24c3('0x2f')](_0xede262,'name');_0x1fe7ed[_0x24c3('0x36')]=_['keys'](_0x3a3c29[_0x24c3('0x36')]);_0x1fe7ed[_0x24c3('0x37')]=_[_0x24c3('0x38')](_0x1fe7ed[_0x24c3('0x35')],_0x1fe7ed[_0x24c3('0x36')]);_0x98f1fd[_0x24c3('0x39')]=_[_0x24c3('0x38')](_0x1fe7ed[_0x24c3('0x35')],qs['fields'](_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x3a')]));_0x98f1fd['attributes']=_0x98f1fd['attributes'][_0x24c3('0x3b')]?_0x98f1fd[_0x24c3('0x39')]:_0x1fe7ed[_0x24c3('0x35')];if(!_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x3c')]('nolimit')){_0x98f1fd['limit']=qs[_0x24c3('0x20')](_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x20')]);_0x98f1fd[_0x24c3('0x1e')]=qs['offset'](_0x3a3c29[_0x24c3('0x36')]['offset']);}_0x98f1fd['order']=qs[_0x24c3('0x3d')](_0x3a3c29['query']['sort']);_0x98f1fd[_0x24c3('0x3e')]=qs['filters'](_[_0x24c3('0x3f')](_0x3a3c29[_0x24c3('0x36')],_0x1fe7ed[_0x24c3('0x37')]),_0xede262);if(_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x40')]){_0x98f1fd['where']=_[_0x24c3('0x41')](_0x98f1fd[_0x24c3('0x3e')],{'$or':_[_0x24c3('0x2f')](_0xede262,function(_0x42f41c){if(_0x42f41c['type']!==_0x24c3('0x42')){var _0xe5dd5b={};_0xe5dd5b[_0x42f41c[_0x24c3('0x2c')]]={'$like':'%'+_0x3a3c29['query'][_0x24c3('0x40')]+'%'};return _0xe5dd5b;}})});}_0x98f1fd=_[_0x24c3('0x41')]({},_0x98f1fd,_0x3a3c29['options']);var _0x4f5c3a={'where':_0x98f1fd[_0x24c3('0x3e')]};return db[_0x24c3('0x30')][_0x24c3('0x21')](_0x4f5c3a)[_0x24c3('0x29')](function(_0x47f693){_0x8529f8[_0x24c3('0x21')]=_0x47f693;if(_0x3a3c29[_0x24c3('0x36')][_0x24c3('0x43')]){_0x98f1fd['include']=[{'all':!![]}];}return db[_0x24c3('0x30')]['findAll'](_0x98f1fd);})[_0x24c3('0x29')](function(_0x2f90cd){_0x8529f8[_0x24c3('0x44')]=_0x2f90cd;return _0x8529f8;})[_0x24c3('0x29')](respondWithFilteredResult(_0x276465,_0x98f1fd))['catch'](handleError(_0x276465,null));};exports[_0x24c3('0x45')]=function(_0x24080b,_0x5e4339){var _0x4e3c14={'raw':![],'where':{'id':_0x24080b[_0x24c3('0x46')]['id']}},_0x4d592e={};_0x4d592e[_0x24c3('0x35')]=_['keys'](db[_0x24c3('0x30')][_0x24c3('0x31')]);_0x4d592e[_0x24c3('0x36')]=_['keys'](_0x24080b['query']);_0x4d592e[_0x24c3('0x37')]=_[_0x24c3('0x38')](_0x4d592e[_0x24c3('0x35')],_0x4d592e[_0x24c3('0x36')]);_0x4e3c14['attributes']=_[_0x24c3('0x38')](_0x4d592e[_0x24c3('0x35')],qs[_0x24c3('0x3a')](_0x24080b[_0x24c3('0x36')][_0x24c3('0x3a')]));_0x4e3c14['attributes']=_0x4e3c14['attributes']['length']?_0x4e3c14[_0x24c3('0x39')]:_0x4d592e[_0x24c3('0x35')];if(_0x24080b[_0x24c3('0x36')][_0x24c3('0x43')]){_0x4e3c14['include']=[{'all':!![]}];}_0x4e3c14=_[_0x24c3('0x41')]({},_0x4e3c14,_0x24080b[_0x24c3('0x47')]);return db[_0x24c3('0x30')]['find'](_0x4e3c14)[_0x24c3('0x29')](handleEntityNotFound(_0x5e4339,null))['then'](respondWithResult(_0x5e4339,null))[_0x24c3('0x48')](handleError(_0x5e4339,null));};exports['create']=function(_0x1396d4,_0x52479e){return db[_0x24c3('0x30')]['create'](_0x1396d4[_0x24c3('0x49')],{})[_0x24c3('0x29')](respondWithResult(_0x52479e,0xc9))[_0x24c3('0x48')](handleError(_0x52479e,null));};exports['update']=function(_0x31e47c,_0x10467f){if(_0x31e47c[_0x24c3('0x49')]['id']){delete _0x31e47c[_0x24c3('0x49')]['id'];}return db[_0x24c3('0x30')][_0x24c3('0x4a')]({'where':{'id':_0x31e47c[_0x24c3('0x46')]['id']}})['then'](handleEntityNotFound(_0x10467f,null))[_0x24c3('0x29')](saveUpdates(_0x31e47c[_0x24c3('0x49')],null))['then'](respondWithResult(_0x10467f,null))[_0x24c3('0x48')](handleError(_0x10467f,null));};exports[_0x24c3('0x28')]=function(_0x345ee8,_0x3d8d0d){return db[_0x24c3('0x30')][_0x24c3('0x4a')]({'where':{'id':_0x345ee8[_0x24c3('0x46')]['id']}})[_0x24c3('0x29')](handleEntityNotFound(_0x3d8d0d,null))[_0x24c3('0x29')](removeEntity(_0x3d8d0d,null))['catch'](handleError(_0x3d8d0d,null));};exports[_0x24c3('0x4b')]=function(_0x20440e,_0x363e3c,_0x442913){var _0x8ef699={};var _0x1197e2={};var _0x29e407;var _0x3fc3a5;return db[_0x24c3('0x30')]['findOne']({'where':{'id':_0x20440e[_0x24c3('0x46')]['id']}})[_0x24c3('0x29')](handleEntityNotFound(_0x363e3c,null))[_0x24c3('0x29')](function(_0x5d7a90){if(_0x5d7a90){_0x29e407=_0x5d7a90;_0x1197e2[_0x24c3('0x35')]=_['keys'](db['DeskConfiguration'][_0x24c3('0x31')]);_0x1197e2[_0x24c3('0x36')]=_['keys'](_0x20440e['query']);_0x1197e2['filters']=_['intersection'](_0x1197e2[_0x24c3('0x35')],_0x1197e2[_0x24c3('0x36')]);_0x8ef699[_0x24c3('0x39')]=_[_0x24c3('0x38')](_0x1197e2[_0x24c3('0x35')],qs['fields'](_0x20440e[_0x24c3('0x36')][_0x24c3('0x3a')]));_0x8ef699[_0x24c3('0x39')]=_0x8ef699['attributes'][_0x24c3('0x3b')]?_0x8ef699[_0x24c3('0x39')]:_0x1197e2['model'];_0x8ef699[_0x24c3('0x4c')]=qs['sort'](_0x20440e[_0x24c3('0x36')][_0x24c3('0x3d')]);_0x8ef699[_0x24c3('0x3e')]=qs[_0x24c3('0x37')](_[_0x24c3('0x3f')](_0x20440e[_0x24c3('0x36')],_0x1197e2['filters']));if(_0x20440e['query'][_0x24c3('0x40')]){_0x8ef699[_0x24c3('0x3e')]=_[_0x24c3('0x41')](_0x8ef699['where'],{'$or':_[_0x24c3('0x2f')](_0x8ef699[_0x24c3('0x39')],function(_0x4953a1){var _0x29b8af={};_0x29b8af[_0x4953a1]={'$like':'%'+_0x20440e[_0x24c3('0x36')]['filter']+'%'};return _0x29b8af;})});}_0x8ef699=_[_0x24c3('0x41')]({},_0x8ef699,_0x20440e[_0x24c3('0x47')]);return _0x29e407[_0x24c3('0x4b')](_0x8ef699);}})[_0x24c3('0x29')](function(_0x1dbf9f){if(_0x1dbf9f){_0x3fc3a5=_0x1dbf9f[_0x24c3('0x3b')];if(!_0x20440e[_0x24c3('0x36')][_0x24c3('0x3c')](_0x24c3('0x4d'))){_0x8ef699[_0x24c3('0x20')]=qs[_0x24c3('0x20')](_0x20440e[_0x24c3('0x36')][_0x24c3('0x20')]);_0x8ef699[_0x24c3('0x1e')]=qs[_0x24c3('0x1e')](_0x20440e[_0x24c3('0x36')]['offset']);}return _0x29e407['getConfigurations'](_0x8ef699);}})[_0x24c3('0x29')](function(_0x44fb2a){if(_0x44fb2a){return _0x44fb2a?{'count':_0x3fc3a5,'rows':_0x44fb2a}:null;}})[_0x24c3('0x29')](respondWithResult(_0x363e3c,null))[_0x24c3('0x48')](handleError(_0x363e3c,null));};exports['addConfiguration']=function(_0x1799bc,_0x591e4b,_0xeeec33){if(_0x1799bc[_0x24c3('0x49')]['id']){delete _0x1799bc[_0x24c3('0x49')]['id'];}return db[_0x24c3('0x30')]['findOne']({'where':{'id':_0x1799bc['params']['id']}})[_0x24c3('0x29')](handleEntityNotFound(_0x591e4b,null))[_0x24c3('0x29')](function(_0x560f04){if(_0x560f04){_0x1799bc[_0x24c3('0x49')][_0x24c3('0x4e')]=_0x560f04['id'];_0x1799bc['body'][_0x24c3('0x4f')]=integrations[_0x24c3('0x50')](_0x1799bc[_0x24c3('0x49')][_0x24c3('0x51')],_0x1799bc[_0x24c3('0x49')][_0x24c3('0x33')]);_0x1799bc[_0x24c3('0x49')]['Descriptions']=integrations[_0x24c3('0x52')](_0x1799bc[_0x24c3('0x49')][_0x24c3('0x51')],_0x1799bc[_0x24c3('0x49')]['type']);return db['DeskConfiguration']['create'](_0x1799bc[_0x24c3('0x49')],{'include':[{'model':db[_0x24c3('0x53')],'as':_0x24c3('0x4f')},{'model':db[_0x24c3('0x53')],'as':'Descriptions'}]});}return null;})[_0x24c3('0x29')](respondWithResult(_0x591e4b,null))['catch'](handleError(_0x591e4b,null));};exports[_0x24c3('0x54')]=function(_0x39219a,_0x32f9c8,_0x6649d3){var _0x577727=[{'name':_0x24c3('0x55'),'label':_0x24c3('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 _0x353665='';return db[_0x24c3('0x30')][_0x24c3('0x56')]({'where':{'id':_0x39219a[_0x24c3('0x46')]['id']},'attributes':['id','remoteUri',_0x24c3('0x57'),_0x24c3('0x58'),_0x24c3('0x59'),_0x24c3('0x5a'),_0x24c3('0x5b'),_0x24c3('0x5c'),'tokenSecret']})[_0x24c3('0x29')](handleEntityNotFound(_0x32f9c8,null))[_0x24c3('0x29')](function(_0x5596c9){if(_0x5596c9){_0x353665=_0x5596c9[_0x24c3('0x5d')];var _0xccf17d=_0x353665['slice'](-0x1);if(_0xccf17d==='/'){_0x353665=_0x353665['substring'](0x0,_0x353665[_0x24c3('0x5e')](_0xccf17d));}var _0x21bf75={'method':_0x24c3('0x5f'),'uri':util[_0x24c3('0x60')]('%s/custom_fields',_0x353665),'headers':{'Content-Type':_0x24c3('0x61'),'Accept':'application/json'},'json':!![]};if(_0x5596c9[_0x24c3('0x57')]===_0x24c3('0x62')){_0x21bf75['headers'][_0x24c3('0x63')]=util['format'](_0x24c3('0x64'),new Buffer(util[_0x24c3('0x60')]('%s:%s',_0x5596c9['username'],_0x5596c9[_0x24c3('0x59')]))['toString'](_0x24c3('0x65')));}return rp(_0x21bf75)[_0x24c3('0x29')](function(_0x253f05){return _0x577727[_0x24c3('0x66')](_['map'](_0x253f05[_0x24c3('0x67')][_0x24c3('0x68')],function(_0x2b8364){return{'id':_0x2b8364[_0x24c3('0x2c')],'name':_0x2b8364[_0x24c3('0x2c')],'type':_0x2b8364[_0x24c3('0x33')],'active':_0x2b8364[_0x24c3('0x69')],'label':_0x2b8364[_0x24c3('0x6a')],'custom':!![]};}));});}})[_0x24c3('0x29')](function(_0x2fd3e){return{'count':_0x2fd3e[_0x24c3('0x3b')],'rows':_0x2fd3e};})[_0x24c3('0x29')](respondWithResult(_0x32f9c8,null))[_0x24c3('0x48')](function(_0x315a3a){var _0xe5051e=_0x39219a[_0x24c3('0x36')][_0x24c3('0x6b')]?0x1f4:_0x315a3a[_0x24c3('0x6c')]||0x1f4;logger[_0x24c3('0x2a')](_0x24c3('0x6d'),'getFields',_0xe5051e,JSON[_0x24c3('0x6e')](_0x315a3a));delete _0x315a3a[_0x24c3('0x2c')];if(_0xe5051e===0x191){_0xe5051e=0x190;}_0x32f9c8['status'](_0xe5051e)[_0x24c3('0x2d')](_0x39219a['query'][_0x24c3('0x6b')]?{'message':_0x24c3('0x6f'),'statusCode':_0x315a3a[_0x24c3('0x6c')]}:_0x315a3a);});}; \ No newline at end of file +var _0x075c=['sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','length','include','find','create','body','getConfigurations','DeskConfiguration','nolimit','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','lastIndexOf','GET','format','application/json','headers','%s:%s','password','base64','concat','label','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x075c,0x18b));var _0xc075=function(_0x164ece,_0x2e455e){_0x164ece=_0x164ece-0x0;var _0x5853e5=_0x075c[_0x164ece];return _0x5853e5;};'use strict';var emlformat=require(_0xc075('0x0'));var rimraf=require(_0xc075('0x1'));var zipdir=require(_0xc075('0x2'));var jsonpatch=require(_0xc075('0x3'));var rp=require('request-promise');var moment=require(_0xc075('0x4'));var BPromise=require(_0xc075('0x5'));var Mustache=require('mustache');var util=require(_0xc075('0x6'));var path=require(_0xc075('0x7'));var sox=require(_0xc075('0x8'));var csv=require('to-csv');var ejs=require(_0xc075('0x9'));var fs=require('fs');var fs_extra=require(_0xc075('0xa'));var _=require(_0xc075('0xb'));var squel=require(_0xc075('0xc'));var crypto=require(_0xc075('0xd'));var jsforce=require(_0xc075('0xe'));var deskjs=require(_0xc075('0xf'));var toCsv=require(_0xc075('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc075('0x11'));var qs=require(_0xc075('0x12'));var as=require(_0xc075('0x13'));var hardwareService=require(_0xc075('0x14'));var logger=require(_0xc075('0x15'))(_0xc075('0x16'));var utils=require('../../config/utils');var config=require(_0xc075('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc075('0x18'))['db'];var integrations=require(_0xc075('0x19'));function respondWithStatusCode(_0x5a18d1,_0x46cb07){_0x46cb07=_0x46cb07||0xcc;return function(_0xcb3ba2){if(_0xcb3ba2){return _0x5a18d1['sendStatus'](_0x46cb07);}return _0x5a18d1[_0xc075('0x1a')](_0x46cb07)['end']();};}function respondWithResult(_0x5e7830,_0x3093ba){_0x3093ba=_0x3093ba||0xc8;return function(_0x3681b7){if(_0x3681b7){return _0x5e7830[_0xc075('0x1a')](_0x3093ba)[_0xc075('0x1b')](_0x3681b7);}};}function respondWithFilteredResult(_0x49b12a,_0x58dab0){return function(_0x595f3d){if(_0x595f3d){var _0x1654b1=typeof _0x58dab0[_0xc075('0x1c')]==='undefined'&&typeof _0x58dab0[_0xc075('0x1d')]===_0xc075('0x1e');var _0xcf093f=_0x595f3d[_0xc075('0x1f')];var _0x149eaf=_0x1654b1?0x0:_0x58dab0[_0xc075('0x1c')];var _0x3775ba=_0x1654b1?_0x595f3d[_0xc075('0x1f')]:_0x58dab0['offset']+_0x58dab0[_0xc075('0x1d')];var _0x2182b0;if(_0x3775ba>=_0xcf093f){_0x3775ba=_0xcf093f;_0x2182b0=0xc8;}else{_0x2182b0=0xce;}_0x49b12a[_0xc075('0x1a')](_0x2182b0);return _0x49b12a[_0xc075('0x20')](_0xc075('0x21'),_0x149eaf+'-'+_0x3775ba+'/'+_0xcf093f)[_0xc075('0x1b')](_0x595f3d);}return null;};}function patchUpdates(_0x340a78){return function(_0x265c32){try{jsonpatch[_0xc075('0x22')](_0x265c32,_0x340a78,!![]);}catch(_0x3cf3d9){return BPromise[_0xc075('0x23')](_0x3cf3d9);}return _0x265c32[_0xc075('0x24')]();};}function saveUpdates(_0x44fbfb,_0x3dd025){return function(_0x5844ec){if(_0x5844ec){return _0x5844ec[_0xc075('0x25')](_0x44fbfb)['then'](function(_0x7f889a){return _0x7f889a;});}return null;};}function removeEntity(_0x385346,_0x5b33fe){return function(_0x23cd28){if(_0x23cd28){return _0x23cd28[_0xc075('0x26')]()[_0xc075('0x27')](function(){_0x385346[_0xc075('0x1a')](0xcc)[_0xc075('0x28')]();});}};}function handleEntityNotFound(_0x5726f2,_0x48dfdd){return function(_0x12c544){if(!_0x12c544){_0x5726f2[_0xc075('0x29')](0x194);}return _0x12c544;};}function handleError(_0x3e5cd4,_0x22d155){_0x22d155=_0x22d155||0x1f4;return function(_0x17bc4f){logger[_0xc075('0x2a')](_0x17bc4f[_0xc075('0x2b')]);if(_0x17bc4f[_0xc075('0x2c')]){delete _0x17bc4f[_0xc075('0x2c')];}_0x3e5cd4[_0xc075('0x1a')](_0x22d155)[_0xc075('0x2d')](_0x17bc4f);};}exports[_0xc075('0x2e')]=function(_0x5c2e96,_0x2a51f8){var _0x2d07d6={},_0x25f01f={},_0x3710cb={'count':0x0,'rows':[]};var _0x4350d9=_[_0xc075('0x2f')](db[_0xc075('0x30')][_0xc075('0x31')],function(_0x12fda2){return{'name':_0x12fda2[_0xc075('0x32')],'type':_0x12fda2[_0xc075('0x33')]['key']};});_0x25f01f['model']=_[_0xc075('0x2f')](_0x4350d9,_0xc075('0x2c'));_0x25f01f[_0xc075('0x34')]=_[_0xc075('0x35')](_0x5c2e96[_0xc075('0x34')]);_0x25f01f[_0xc075('0x36')]=_[_0xc075('0x37')](_0x25f01f['model'],_0x25f01f[_0xc075('0x34')]);_0x2d07d6[_0xc075('0x38')]=_[_0xc075('0x37')](_0x25f01f[_0xc075('0x39')],qs['fields'](_0x5c2e96[_0xc075('0x34')]['fields']));_0x2d07d6[_0xc075('0x38')]=_0x2d07d6[_0xc075('0x38')]['length']?_0x2d07d6[_0xc075('0x38')]:_0x25f01f['model'];if(!_0x5c2e96[_0xc075('0x34')][_0xc075('0x3a')]('nolimit')){_0x2d07d6[_0xc075('0x1d')]=qs['limit'](_0x5c2e96['query'][_0xc075('0x1d')]);_0x2d07d6['offset']=qs['offset'](_0x5c2e96['query']['offset']);}_0x2d07d6[_0xc075('0x3b')]=qs[_0xc075('0x3c')](_0x5c2e96['query'][_0xc075('0x3c')]);_0x2d07d6[_0xc075('0x3d')]=qs['filters'](_[_0xc075('0x3e')](_0x5c2e96[_0xc075('0x34')],_0x25f01f[_0xc075('0x36')]),_0x4350d9);if(_0x5c2e96[_0xc075('0x34')][_0xc075('0x3f')]){_0x2d07d6['where']=_[_0xc075('0x40')](_0x2d07d6['where'],{'$or':_[_0xc075('0x2f')](_0x4350d9,function(_0x5e00b0){if(_0x5e00b0[_0xc075('0x33')]!==_0xc075('0x41')){var _0x16fc4c={};_0x16fc4c[_0x5e00b0[_0xc075('0x2c')]]={'$like':'%'+_0x5c2e96[_0xc075('0x34')][_0xc075('0x3f')]+'%'};return _0x16fc4c;}})});}_0x2d07d6=_['merge']({},_0x2d07d6,_0x5c2e96[_0xc075('0x42')]);var _0x3d2237={'where':_0x2d07d6['where']};return db[_0xc075('0x30')][_0xc075('0x1f')](_0x3d2237)[_0xc075('0x27')](function(_0x3481e6){_0x3710cb[_0xc075('0x1f')]=_0x3481e6;if(_0x5c2e96['query'][_0xc075('0x43')]){_0x2d07d6['include']=[{'all':!![]}];}return db[_0xc075('0x30')][_0xc075('0x44')](_0x2d07d6);})[_0xc075('0x27')](function(_0x503cb1){_0x3710cb[_0xc075('0x45')]=_0x503cb1;return _0x3710cb;})['then'](respondWithFilteredResult(_0x2a51f8,_0x2d07d6))[_0xc075('0x46')](handleError(_0x2a51f8,null));};exports['show']=function(_0x296e8c,_0x3c05bb){var _0x135043={'raw':![],'where':{'id':_0x296e8c[_0xc075('0x47')]['id']}},_0x14d1e5={};_0x14d1e5[_0xc075('0x39')]=_[_0xc075('0x35')](db['DeskAccount']['rawAttributes']);_0x14d1e5[_0xc075('0x34')]=_['keys'](_0x296e8c[_0xc075('0x34')]);_0x14d1e5['filters']=_[_0xc075('0x37')](_0x14d1e5[_0xc075('0x39')],_0x14d1e5[_0xc075('0x34')]);_0x135043['attributes']=_['intersection'](_0x14d1e5[_0xc075('0x39')],qs['fields'](_0x296e8c[_0xc075('0x34')][_0xc075('0x48')]));_0x135043[_0xc075('0x38')]=_0x135043['attributes'][_0xc075('0x49')]?_0x135043[_0xc075('0x38')]:_0x14d1e5[_0xc075('0x39')];if(_0x296e8c['query'][_0xc075('0x43')]){_0x135043[_0xc075('0x4a')]=[{'all':!![]}];}_0x135043=_[_0xc075('0x40')]({},_0x135043,_0x296e8c[_0xc075('0x42')]);return db[_0xc075('0x30')][_0xc075('0x4b')](_0x135043)[_0xc075('0x27')](handleEntityNotFound(_0x3c05bb,null))[_0xc075('0x27')](respondWithResult(_0x3c05bb,null))[_0xc075('0x46')](handleError(_0x3c05bb,null));};exports[_0xc075('0x4c')]=function(_0x23c5c9,_0x2ccfed){return db[_0xc075('0x30')][_0xc075('0x4c')](_0x23c5c9[_0xc075('0x4d')],{})[_0xc075('0x27')](respondWithResult(_0x2ccfed,0xc9))[_0xc075('0x46')](handleError(_0x2ccfed,null));};exports[_0xc075('0x25')]=function(_0xd84f8a,_0x4a2332){if(_0xd84f8a[_0xc075('0x4d')]['id']){delete _0xd84f8a[_0xc075('0x4d')]['id'];}return db[_0xc075('0x30')][_0xc075('0x4b')]({'where':{'id':_0xd84f8a[_0xc075('0x47')]['id']}})[_0xc075('0x27')](handleEntityNotFound(_0x4a2332,null))['then'](saveUpdates(_0xd84f8a[_0xc075('0x4d')],null))[_0xc075('0x27')](respondWithResult(_0x4a2332,null))[_0xc075('0x46')](handleError(_0x4a2332,null));};exports[_0xc075('0x26')]=function(_0x399513,_0x282985){return db[_0xc075('0x30')]['find']({'where':{'id':_0x399513[_0xc075('0x47')]['id']}})[_0xc075('0x27')](handleEntityNotFound(_0x282985,null))['then'](removeEntity(_0x282985,null))[_0xc075('0x46')](handleError(_0x282985,null));};exports[_0xc075('0x4e')]=function(_0x3224d0,_0x20a8bc,_0x1c98cd){var _0x4018d6={};var _0x35349a={};var _0x1cb424;var _0x4844e5;return db[_0xc075('0x30')]['findOne']({'where':{'id':_0x3224d0['params']['id']}})[_0xc075('0x27')](handleEntityNotFound(_0x20a8bc,null))[_0xc075('0x27')](function(_0x4cf1e5){if(_0x4cf1e5){_0x1cb424=_0x4cf1e5;_0x35349a['model']=_[_0xc075('0x35')](db[_0xc075('0x4f')][_0xc075('0x31')]);_0x35349a[_0xc075('0x34')]=_[_0xc075('0x35')](_0x3224d0['query']);_0x35349a[_0xc075('0x36')]=_[_0xc075('0x37')](_0x35349a[_0xc075('0x39')],_0x35349a[_0xc075('0x34')]);_0x4018d6[_0xc075('0x38')]=_[_0xc075('0x37')](_0x35349a[_0xc075('0x39')],qs['fields'](_0x3224d0[_0xc075('0x34')]['fields']));_0x4018d6['attributes']=_0x4018d6[_0xc075('0x38')][_0xc075('0x49')]?_0x4018d6[_0xc075('0x38')]:_0x35349a['model'];_0x4018d6[_0xc075('0x3b')]=qs[_0xc075('0x3c')](_0x3224d0[_0xc075('0x34')][_0xc075('0x3c')]);_0x4018d6['where']=qs[_0xc075('0x36')](_['pick'](_0x3224d0[_0xc075('0x34')],_0x35349a[_0xc075('0x36')]));if(_0x3224d0['query'][_0xc075('0x3f')]){_0x4018d6[_0xc075('0x3d')]=_['merge'](_0x4018d6[_0xc075('0x3d')],{'$or':_[_0xc075('0x2f')](_0x4018d6[_0xc075('0x38')],function(_0x17e566){var _0x589abd={};_0x589abd[_0x17e566]={'$like':'%'+_0x3224d0[_0xc075('0x34')][_0xc075('0x3f')]+'%'};return _0x589abd;})});}_0x4018d6=_[_0xc075('0x40')]({},_0x4018d6,_0x3224d0['options']);return _0x1cb424[_0xc075('0x4e')](_0x4018d6);}})[_0xc075('0x27')](function(_0x345099){if(_0x345099){_0x4844e5=_0x345099[_0xc075('0x49')];if(!_0x3224d0[_0xc075('0x34')][_0xc075('0x3a')](_0xc075('0x50'))){_0x4018d6['limit']=qs[_0xc075('0x1d')](_0x3224d0[_0xc075('0x34')][_0xc075('0x1d')]);_0x4018d6[_0xc075('0x1c')]=qs['offset'](_0x3224d0['query'][_0xc075('0x1c')]);}return _0x1cb424[_0xc075('0x4e')](_0x4018d6);}})[_0xc075('0x27')](function(_0x386587){if(_0x386587){return _0x386587?{'count':_0x4844e5,'rows':_0x386587}:null;}})[_0xc075('0x27')](respondWithResult(_0x20a8bc,null))['catch'](handleError(_0x20a8bc,null));};exports['addConfiguration']=function(_0x4dc84d,_0x506d8b,_0x22c449){if(_0x4dc84d[_0xc075('0x4d')]['id']){delete _0x4dc84d['body']['id'];}return db[_0xc075('0x30')][_0xc075('0x51')]({'where':{'id':_0x4dc84d['params']['id']}})[_0xc075('0x27')](handleEntityNotFound(_0x506d8b,null))[_0xc075('0x27')](function(_0x13c11d){if(_0x13c11d){_0x4dc84d['body']['AccountId']=_0x13c11d['id'];_0x4dc84d[_0xc075('0x4d')][_0xc075('0x52')]=integrations[_0xc075('0x53')](_0x4dc84d[_0xc075('0x4d')]['channel'],_0x4dc84d[_0xc075('0x4d')][_0xc075('0x33')]);_0x4dc84d[_0xc075('0x4d')][_0xc075('0x54')]=integrations[_0xc075('0x55')](_0x4dc84d['body'][_0xc075('0x56')],_0x4dc84d[_0xc075('0x4d')][_0xc075('0x33')]);return db['DeskConfiguration'][_0xc075('0x4c')](_0x4dc84d['body'],{'include':[{'model':db['DeskField'],'as':_0xc075('0x52')},{'model':db[_0xc075('0x57')],'as':_0xc075('0x54')}]});}return null;})[_0xc075('0x27')](respondWithResult(_0x506d8b,null))['catch'](handleError(_0x506d8b,null));};exports[_0xc075('0x58')]=function(_0x4bbac9,_0x54bb4b,_0x169d2d){var _0x15f0d7=[{'name':_0xc075('0x59'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4f4ddd='';return db[_0xc075('0x30')][_0xc075('0x51')]({'where':{'id':_0x4bbac9[_0xc075('0x47')]['id']},'attributes':['id',_0xc075('0x5a'),_0xc075('0x5b'),_0xc075('0x5c'),'password',_0xc075('0x5d'),_0xc075('0x5e'),_0xc075('0x5f'),_0xc075('0x60')]})[_0xc075('0x27')](handleEntityNotFound(_0x54bb4b,null))['then'](function(_0x656945){if(_0x656945){_0x4f4ddd=_0x656945[_0xc075('0x5a')];var _0x583755=_0x4f4ddd['slice'](-0x1);if(_0x583755==='/'){_0x4f4ddd=_0x4f4ddd['substring'](0x0,_0x4f4ddd[_0xc075('0x61')](_0x583755));}var _0x4f6f0a={'method':_0xc075('0x62'),'uri':util[_0xc075('0x63')]('%s/custom_fields',_0x4f4ddd),'headers':{'Content-Type':_0xc075('0x64'),'Accept':_0xc075('0x64')},'json':!![]};if(_0x656945[_0xc075('0x5b')]==='basic'){_0x4f6f0a[_0xc075('0x65')]['Authorization']=util[_0xc075('0x63')]('Basic\x20%s',new Buffer(util[_0xc075('0x63')](_0xc075('0x66'),_0x656945['username'],_0x656945[_0xc075('0x67')]))['toString'](_0xc075('0x68')));}return rp(_0x4f6f0a)['then'](function(_0x3c11a){return _0x15f0d7[_0xc075('0x69')](_['map'](_0x3c11a['_embedded']['entries'],function(_0xf190ec){return{'id':_0xf190ec[_0xc075('0x2c')],'name':_0xf190ec[_0xc075('0x2c')],'type':_0xf190ec[_0xc075('0x33')],'active':_0xf190ec['active'],'label':_0xf190ec[_0xc075('0x6a')],'custom':!![]};}));});}})[_0xc075('0x27')](function(_0x4e3b32){return{'count':_0x4e3b32['length'],'rows':_0x4e3b32};})[_0xc075('0x27')](respondWithResult(_0x54bb4b,null))[_0xc075('0x46')](function(_0xdf03e8){var _0x56880d=_0x4bbac9[_0xc075('0x34')]['test']?0x1f4:_0xdf03e8[_0xc075('0x6b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x56880d,JSON[_0xc075('0x6c')](_0xdf03e8));delete _0xdf03e8['name'];if(_0x56880d===0x191){_0x56880d=0x190;}_0x54bb4b[_0xc075('0x1a')](_0x56880d)[_0xc075('0x2d')](_0x4bbac9[_0xc075('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xdf03e8[_0xc075('0x6b')]}:_0xdf03e8);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 1483609..9075478 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 _0x10c7=['../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x10c7,0x19c));var _0x710c=function(_0x4ee2be,_0x188b82){_0x4ee2be=_0x4ee2be-0x0;var _0x165535=_0x10c7[_0x4ee2be];return _0x165535;};'use strict';var _=require(_0x710c('0x0'));var util=require('util');var logger=require(_0x710c('0x1'))(_0x710c('0x2'));var moment=require(_0x710c('0x3'));var BPromise=require(_0x710c('0x4'));var rp=require(_0x710c('0x5'));var fs=require('fs');var path=require(_0x710c('0x6'));var rimraf=require('rimraf');var config=require(_0x710c('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x710c('0x8'));module['exports']=function(_0x7b3636,_0x466430){return _0x7b3636[_0x710c('0x9')](_0x710c('0xa'),attributes,{'tableName':_0x710c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ec=['exports','define','DeskAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes'];(function(_0x1db407,_0x21c71a){var _0xab5e5e=function(_0x7e7d1c){while(--_0x7e7d1c){_0x1db407['push'](_0x1db407['shift']());}};_0xab5e5e(++_0x21c71a);}(_0x02ec,0x12f));var _0xc02e=function(_0x8fdf87,_0x13d456){_0x8fdf87=_0x8fdf87-0x0;var _0x1b5f1a=_0x02ec[_0x8fdf87];return _0x1b5f1a;};'use strict';var _=require('lodash');var util=require(_0xc02e('0x0'));var logger=require(_0xc02e('0x1'))(_0xc02e('0x2'));var moment=require(_0xc02e('0x3'));var BPromise=require(_0xc02e('0x4'));var rp=require(_0xc02e('0x5'));var fs=require('fs');var path=require(_0xc02e('0x6'));var rimraf=require(_0xc02e('0x7'));var config=require('../../config/environment');var attributes=require(_0xc02e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc02e('0x9')]=function(_0x4fd43f,_0x271505){return _0x4fd43f[_0xc02e('0xa')](_0xc02e('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index ca73ed4..d1f3b79 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 _0x916c=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetDeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','debug'];(function(_0x1d5a46,_0x4d359f){var _0x33caec=function(_0x26d3fb){while(--_0x26d3fb){_0x1d5a46['push'](_0x1d5a46['shift']());}};_0x33caec(++_0x4d359f);}(_0x916c,0x92));var _0xc916=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x916c[_0xe4bb3d];return _0xd9e51;};'use strict';var _=require(_0xc916('0x0'));var util=require(_0xc916('0x1'));var moment=require(_0xc916('0x2'));var BPromise=require(_0xc916('0x3'));var rs=require(_0xc916('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc916('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc916('0x6'));var jayson=require(_0xc916('0x7'));var client=jayson[_0xc916('0x8')][_0xc916('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d155b,_0xd07211,_0x14917f){return new BPromise(function(_0x48a754,_0x34d4ca){return client['request'](_0x4d155b,_0x14917f)[_0xc916('0xa')](function(_0x1bd4ab){logger[_0xc916('0xb')](_0xc916('0xc'),_0xd07211,'request\x20sent');logger[_0xc916('0xd')](_0xc916('0xe'),_0xd07211,'request\x20sent',JSON[_0xc916('0xf')](_0x1bd4ab));if(_0x1bd4ab['error']){if(_0x1bd4ab[_0xc916('0x10')]['code']===0x1f4){logger['error'](_0xc916('0xc'),_0xd07211,_0x1bd4ab['error']['message']);return _0x34d4ca(_0x1bd4ab[_0xc916('0x10')][_0xc916('0x11')]);}logger[_0xc916('0x10')]('DeskAccount,\x20%s,\x20%s',_0xd07211,_0x1bd4ab[_0xc916('0x10')][_0xc916('0x11')]);return _0x48a754(_0x1bd4ab[_0xc916('0x10')][_0xc916('0x11')]);}else{logger[_0xc916('0xb')](_0xc916('0xc'),_0xd07211,_0xc916('0x12'));_0x48a754(_0x1bd4ab['result'][_0xc916('0x11')]);}})[_0xc916('0x13')](function(_0x5de003){logger[_0xc916('0x10')](_0xc916('0xc'),_0xd07211,_0x5de003);_0x34d4ca(_0x5de003);});});}exports[_0xc916('0x14')]=function(_0x524bf3){var _0x284597=this;return new Promise(function(_0x4ee12f,_0x21a3b0){return db['DeskAccount'][_0xc916('0x15')]({'raw':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x17')]===undefined?!![]:![]:!![],'where':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x18')]||null:null,'attributes':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x19')]||null:null,'limit':_0x524bf3[_0xc916('0x16')]?_0x524bf3['options']['limit']||null:null,'include':_0x524bf3[_0xc916('0x16')]?_0x524bf3[_0xc916('0x16')][_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x524bf3[_0xc916('0x16')][_0xc916('0x1a')],function(_0x11cd92){return{'model':db[_0x11cd92['model']],'as':_0x11cd92['as'],'attributes':_0x11cd92[_0xc916('0x19')],'include':_0x11cd92[_0xc916('0x1a')]?_['map'](_0x11cd92[_0xc916('0x1a')],function(_0x55c9f5){return{'model':db[_0x55c9f5[_0xc916('0x1c')]],'as':_0x55c9f5['as'],'attributes':_0x55c9f5[_0xc916('0x19')],'include':_0x55c9f5[_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x55c9f5['include'],function(_0x5d27e1){return{'model':db[_0x5d27e1['model']],'as':_0x5d27e1['as'],'attributes':_0x5d27e1[_0xc916('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xa')](function(_0x52ceb6){logger['info'](_0xc916('0x14'),_0x524bf3);logger[_0xc916('0xd')]('GetDeskAccount',_0x524bf3,JSON[_0xc916('0xf')](_0x52ceb6));_0x4ee12f(_0x52ceb6);})[_0xc916('0x13')](function(_0x2e6520){logger['error']('GetDeskAccount',_0x2e6520['message'],_0x524bf3);_0x21a3b0(_0x284597['error'](0x1f4,_0x2e6520['message']));});});};exports[_0xc916('0x1d')]=function(_0x2e1da4){var _0x3542e4=this;return new Promise(function(_0x449665,_0x583170){return db[_0xc916('0x1e')][_0xc916('0x1f')]({'raw':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x17')]===undefined?!![]:![]:!![],'where':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x18')]||null:null,'attributes':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x19')]||null:null,'include':_0x2e1da4[_0xc916('0x16')]?_0x2e1da4[_0xc916('0x16')][_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x2e1da4[_0xc916('0x16')][_0xc916('0x1a')],function(_0x19da83){return{'model':db[_0x19da83[_0xc916('0x1c')]],'as':_0x19da83['as'],'attributes':_0x19da83[_0xc916('0x19')],'include':_0x19da83[_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x19da83[_0xc916('0x1a')],function(_0x45fd0e){return{'model':db[_0x45fd0e[_0xc916('0x1c')]],'as':_0x45fd0e['as'],'attributes':_0x45fd0e[_0xc916('0x19')],'include':_0x45fd0e[_0xc916('0x1a')]?_[_0xc916('0x1b')](_0x45fd0e[_0xc916('0x1a')],function(_0xecd9f0){return{'model':db[_0xecd9f0[_0xc916('0x1c')]],'as':_0xecd9f0['as'],'attributes':_0xecd9f0[_0xc916('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xa')](function(_0x48a02f){logger[_0xc916('0xb')](_0xc916('0x1d'),_0x2e1da4);logger[_0xc916('0xd')](_0xc916('0x1d'),_0x2e1da4,JSON[_0xc916('0xf')](_0x48a02f));_0x449665(_0x48a02f);})[_0xc916('0x13')](function(_0x27da9c){logger[_0xc916('0x10')](_0xc916('0x1d'),_0x27da9c[_0xc916('0x11')],_0x2e1da4);_0x583170(_0x3542e4[_0xc916('0x10')](0x1f4,_0x27da9c[_0xc916('0x11')]));});});}; \ No newline at end of file +var _0xddc5=['GetDeskAccount','stringify','catch','ShowDeskAccount','DeskAccount','find','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','findAll','options','raw','where','attributes','limit','map','model','include'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0xddc5,0xcc));var _0x5ddc=function(_0x34fa8e,_0x2d8a80){_0x34fa8e=_0x34fa8e-0x0;var _0x3865c6=_0xddc5[_0x34fa8e];return _0x3865c6;};'use strict';var _=require('lodash');var util=require(_0x5ddc('0x0'));var moment=require('moment');var BPromise=require(_0x5ddc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ddc('0x2'));var db=require(_0x5ddc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ddc('0x4'))(_0x5ddc('0x5'));var config=require(_0x5ddc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5ddc('0x7')][_0x5ddc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c236b,_0x85675b,_0x4e5fdc){return new BPromise(function(_0x29a50e,_0x4705fe){return client[_0x5ddc('0x9')](_0x2c236b,_0x4e5fdc)[_0x5ddc('0xa')](function(_0xffca56){logger[_0x5ddc('0xb')](_0x5ddc('0xc'),_0x85675b,_0x5ddc('0xd'));logger[_0x5ddc('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x85675b,_0x5ddc('0xd'),JSON['stringify'](_0xffca56));if(_0xffca56[_0x5ddc('0xf')]){if(_0xffca56[_0x5ddc('0xf')][_0x5ddc('0x10')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x85675b,_0xffca56['error'][_0x5ddc('0x11')]);return _0x4705fe(_0xffca56[_0x5ddc('0xf')][_0x5ddc('0x11')]);}logger[_0x5ddc('0xf')](_0x5ddc('0xc'),_0x85675b,_0xffca56['error']['message']);return _0x29a50e(_0xffca56['error'][_0x5ddc('0x11')]);}else{logger[_0x5ddc('0xb')](_0x5ddc('0xc'),_0x85675b,_0x5ddc('0xd'));_0x29a50e(_0xffca56['result']['message']);}})['catch'](function(_0x29249f){logger['error'](_0x5ddc('0xc'),_0x85675b,_0x29249f);_0x4705fe(_0x29249f);});});}exports['GetDeskAccount']=function(_0x222dc6){var _0x2c3027=this;return new Promise(function(_0x459340,_0x4b2d77){return db['DeskAccount'][_0x5ddc('0x12')]({'raw':_0x222dc6[_0x5ddc('0x13')]?_0x222dc6['options'][_0x5ddc('0x14')]===undefined?!![]:![]:!![],'where':_0x222dc6[_0x5ddc('0x13')]?_0x222dc6['options'][_0x5ddc('0x15')]||null:null,'attributes':_0x222dc6[_0x5ddc('0x13')]?_0x222dc6['options'][_0x5ddc('0x16')]||null:null,'limit':_0x222dc6[_0x5ddc('0x13')]?_0x222dc6[_0x5ddc('0x13')][_0x5ddc('0x17')]||null:null,'include':_0x222dc6[_0x5ddc('0x13')]?_0x222dc6[_0x5ddc('0x13')]['include']?_[_0x5ddc('0x18')](_0x222dc6[_0x5ddc('0x13')]['include'],function(_0x35cb4c){return{'model':db[_0x35cb4c[_0x5ddc('0x19')]],'as':_0x35cb4c['as'],'attributes':_0x35cb4c[_0x5ddc('0x16')],'include':_0x35cb4c[_0x5ddc('0x1a')]?_['map'](_0x35cb4c[_0x5ddc('0x1a')],function(_0x233b03){return{'model':db[_0x233b03['model']],'as':_0x233b03['as'],'attributes':_0x233b03['attributes'],'include':_0x233b03[_0x5ddc('0x1a')]?_['map'](_0x233b03[_0x5ddc('0x1a')],function(_0x5191f8){return{'model':db[_0x5191f8[_0x5ddc('0x19')]],'as':_0x5191f8['as'],'attributes':_0x5191f8[_0x5ddc('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5ddc('0xa')](function(_0x42213b){logger['info'](_0x5ddc('0x1b'),_0x222dc6);logger[_0x5ddc('0xe')](_0x5ddc('0x1b'),_0x222dc6,JSON[_0x5ddc('0x1c')](_0x42213b));_0x459340(_0x42213b);})[_0x5ddc('0x1d')](function(_0x41283f){logger[_0x5ddc('0xf')](_0x5ddc('0x1b'),_0x41283f['message'],_0x222dc6);_0x4b2d77(_0x2c3027[_0x5ddc('0xf')](0x1f4,_0x41283f[_0x5ddc('0x11')]));});});};exports[_0x5ddc('0x1e')]=function(_0x56fd13){var _0xf44104=this;return new Promise(function(_0x3b1f21,_0xd8b1d){return db[_0x5ddc('0x1f')][_0x5ddc('0x20')]({'raw':_0x56fd13[_0x5ddc('0x13')]?_0x56fd13[_0x5ddc('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x56fd13['options']?_0x56fd13['options'][_0x5ddc('0x15')]||null:null,'attributes':_0x56fd13[_0x5ddc('0x13')]?_0x56fd13['options'][_0x5ddc('0x16')]||null:null,'include':_0x56fd13[_0x5ddc('0x13')]?_0x56fd13[_0x5ddc('0x13')][_0x5ddc('0x1a')]?_[_0x5ddc('0x18')](_0x56fd13[_0x5ddc('0x13')][_0x5ddc('0x1a')],function(_0x48bfe2){return{'model':db[_0x48bfe2['model']],'as':_0x48bfe2['as'],'attributes':_0x48bfe2['attributes'],'include':_0x48bfe2['include']?_[_0x5ddc('0x18')](_0x48bfe2[_0x5ddc('0x1a')],function(_0x35f710){return{'model':db[_0x35f710[_0x5ddc('0x19')]],'as':_0x35f710['as'],'attributes':_0x35f710[_0x5ddc('0x16')],'include':_0x35f710['include']?_[_0x5ddc('0x18')](_0x35f710[_0x5ddc('0x1a')],function(_0x839d4c){return{'model':db[_0x839d4c['model']],'as':_0x839d4c['as'],'attributes':_0x839d4c[_0x5ddc('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3126f8){logger[_0x5ddc('0xb')](_0x5ddc('0x1e'),_0x56fd13);logger[_0x5ddc('0xe')]('ShowDeskAccount',_0x56fd13,JSON['stringify'](_0x3126f8));_0x3b1f21(_0x3126f8);})[_0x5ddc('0x1d')](function(_0x2967c0){logger['error']('ShowDeskAccount',_0x2967c0[_0x5ddc('0x11')],_0x56fd13);_0xd8b1d(_0xf44104['error'](0x1f4,_0x2967c0[_0x5ddc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9198497..dc9ecdc 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x55ca,0x126));var _0xa55c=function(_0x47de9a,_0x40cf23){_0x47de9a=_0x47de9a-0x0;var _0x4b9d6c=_0x55ca[_0x47de9a];return _0x4b9d6c;};'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')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);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['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x416c22,_0x28a905){var _0x1c842=function(_0x3f2b5c){while(--_0x3f2b5c){_0x416c22['push'](_0x416c22['shift']());}};_0x1c842(++_0x28a905);}(_0x3e74,0x175));var _0x43e7=function(_0x12ab76,_0x2c6b3e){_0x12ab76=_0x12ab76-0x0;var _0xe955b0=_0x3e74[_0x12ab76];return _0xe955b0;};'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/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2b36110..474b37a 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 _0x88cd=['exports','STRING'];(function(_0xca986,_0x1ef00f){var _0x46af69=function(_0x18ad13){while(--_0x18ad13){_0xca986['push'](_0xca986['shift']());}};_0x46af69(++_0x1ef00f);}(_0x88cd,0x1a0));var _0xd88c=function(_0x35a811,_0x294db6){_0x35a811=_0x35a811-0x0;var _0x4d445e=_0x88cd[_0x35a811];return _0x4d445e;};'use strict';var Sequelize=require('sequelize');module[_0xd88c('0x0')]={'name':{'type':Sequelize[_0xd88c('0x1')]},'description':{'type':Sequelize[_0xd88c('0x1')]}}; \ No newline at end of file +var _0xd5db=['STRING','sequelize','exports'];(function(_0x2d1f0d,_0x2ca203){var _0x3d776f=function(_0x27b151){while(--_0x27b151){_0x2d1f0d['push'](_0x2d1f0d['shift']());}};_0x3d776f(++_0x2ca203);}(_0xd5db,0x1c9));var _0xbd5d=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xd5db[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0xbd5d('0x0'));module[_0xbd5d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbd5d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 729e372..a70eb9f 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 _0x0aa5=['status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','name','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','include','find','create','body','params','getFields','DeskField','sort','nolimit','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x0aa5,0x1c9));var _0x50aa=function(_0x5d42bb,_0x13ce40){_0x5d42bb=_0x5d42bb-0x0;var _0x57eb5b=_0x0aa5[_0x5d42bb];return _0x57eb5b;};'use strict';var emlformat=require(_0x50aa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50aa('0x1'));var moment=require(_0x50aa('0x2'));var BPromise=require(_0x50aa('0x3'));var Mustache=require(_0x50aa('0x4'));var util=require('util');var path=require('path');var sox=require(_0x50aa('0x5'));var csv=require(_0x50aa('0x6'));var ejs=require(_0x50aa('0x7'));var fs=require('fs');var fs_extra=require(_0x50aa('0x8'));var _=require(_0x50aa('0x9'));var squel=require(_0x50aa('0xa'));var crypto=require(_0x50aa('0xb'));var jsforce=require(_0x50aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x50aa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50aa('0xd'));var authService=require(_0x50aa('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x50aa('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50aa('0x10'))(_0x50aa('0x11'));var utils=require(_0x50aa('0x12'));var config=require(_0x50aa('0x13'));var licenseUtil=require(_0x50aa('0x14'));var db=require(_0x50aa('0x15'))['db'];function respondWithStatusCode(_0x3bab46,_0x28b0eb){_0x28b0eb=_0x28b0eb||0xcc;return function(_0xdf406e){if(_0xdf406e){return _0x3bab46[_0x50aa('0x16')](_0x28b0eb);}return _0x3bab46[_0x50aa('0x17')](_0x28b0eb)[_0x50aa('0x18')]();};}function respondWithResult(_0x3578d1,_0x427656){_0x427656=_0x427656||0xc8;return function(_0x2aac3a){if(_0x2aac3a){return _0x3578d1[_0x50aa('0x17')](_0x427656)[_0x50aa('0x19')](_0x2aac3a);}};}function respondWithFilteredResult(_0x30ce24,_0x4a4447){return function(_0x2db6b9){if(_0x2db6b9){var _0x3ca5a8=typeof _0x4a4447['offset']===_0x50aa('0x1a')&&typeof _0x4a4447[_0x50aa('0x1b')]===_0x50aa('0x1a');var _0x4cb565=_0x2db6b9[_0x50aa('0x1c')];var _0x215648=_0x3ca5a8?0x0:_0x4a4447[_0x50aa('0x1d')];var _0x179777=_0x3ca5a8?_0x2db6b9[_0x50aa('0x1c')]:_0x4a4447[_0x50aa('0x1d')]+_0x4a4447[_0x50aa('0x1b')];var _0x248469;if(_0x179777>=_0x4cb565){_0x179777=_0x4cb565;_0x248469=0xc8;}else{_0x248469=0xce;}_0x30ce24['status'](_0x248469);return _0x30ce24[_0x50aa('0x1e')](_0x50aa('0x1f'),_0x215648+'-'+_0x179777+'/'+_0x4cb565)[_0x50aa('0x19')](_0x2db6b9);}return null;};}function patchUpdates(_0x45c8c7){return function(_0x17fc94){try{jsonpatch['apply'](_0x17fc94,_0x45c8c7,!![]);}catch(_0xd15336){return BPromise[_0x50aa('0x20')](_0xd15336);}return _0x17fc94[_0x50aa('0x21')]();};}function saveUpdates(_0x1a19c1,_0x3254fc){return function(_0x3d366a){if(_0x3d366a){return _0x3d366a['update'](_0x1a19c1)[_0x50aa('0x22')](function(_0x46ddb6){return _0x46ddb6;});}return null;};}function removeEntity(_0x3e8812,_0x41c105){return function(_0x7032ac){if(_0x7032ac){return _0x7032ac[_0x50aa('0x23')]()[_0x50aa('0x22')](function(){_0x3e8812[_0x50aa('0x17')](0xcc)[_0x50aa('0x18')]();});}};}function handleEntityNotFound(_0x50bf12,_0x5211fd){return function(_0x40169a){if(!_0x40169a){_0x50bf12[_0x50aa('0x16')](0x194);}return _0x40169a;};}function handleError(_0x5e24e3,_0x43aaa9){_0x43aaa9=_0x43aaa9||0x1f4;return function(_0x38fc30){logger[_0x50aa('0x24')](_0x38fc30['stack']);if(_0x38fc30['name']){delete _0x38fc30[_0x50aa('0x25')];}_0x5e24e3[_0x50aa('0x17')](_0x43aaa9)['send'](_0x38fc30);};}exports[_0x50aa('0x26')]=function(_0x37787c,_0x587a22){var _0x572c93={},_0x15e734={},_0x3ef739={'count':0x0,'rows':[]};var _0x587eda=_[_0x50aa('0x27')](db[_0x50aa('0x28')][_0x50aa('0x29')],function(_0x111bfc){return{'name':_0x111bfc[_0x50aa('0x2a')],'type':_0x111bfc['type'][_0x50aa('0x2b')]};});_0x15e734[_0x50aa('0x2c')]=_[_0x50aa('0x27')](_0x587eda,_0x50aa('0x25'));_0x15e734[_0x50aa('0x2d')]=_[_0x50aa('0x2e')](_0x37787c[_0x50aa('0x2d')]);_0x15e734[_0x50aa('0x2f')]=_[_0x50aa('0x30')](_0x15e734['model'],_0x15e734['query']);_0x572c93[_0x50aa('0x31')]=_['intersection'](_0x15e734[_0x50aa('0x2c')],qs[_0x50aa('0x32')](_0x37787c[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x572c93['attributes']=_0x572c93[_0x50aa('0x31')][_0x50aa('0x33')]?_0x572c93[_0x50aa('0x31')]:_0x15e734[_0x50aa('0x2c')];if(!_0x37787c[_0x50aa('0x2d')][_0x50aa('0x34')]('nolimit')){_0x572c93[_0x50aa('0x1b')]=qs[_0x50aa('0x1b')](_0x37787c[_0x50aa('0x2d')]['limit']);_0x572c93[_0x50aa('0x1d')]=qs['offset'](_0x37787c[_0x50aa('0x2d')][_0x50aa('0x1d')]);}_0x572c93[_0x50aa('0x35')]=qs['sort'](_0x37787c[_0x50aa('0x2d')]['sort']);_0x572c93[_0x50aa('0x36')]=qs['filters'](_[_0x50aa('0x37')](_0x37787c['query'],_0x15e734['filters']),_0x587eda);if(_0x37787c[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x572c93['where']=_[_0x50aa('0x39')](_0x572c93[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0x587eda,function(_0x52d473){if(_0x52d473[_0x50aa('0x3a')]!==_0x50aa('0x3b')){var _0x45d073={};_0x45d073[_0x52d473[_0x50aa('0x25')]]={'$like':'%'+_0x37787c[_0x50aa('0x2d')][_0x50aa('0x38')]+'%'};return _0x45d073;}})});}_0x572c93=_['merge']({},_0x572c93,_0x37787c[_0x50aa('0x3c')]);var _0x295c89={'where':_0x572c93[_0x50aa('0x36')]};return db['DeskConfiguration'][_0x50aa('0x1c')](_0x295c89)['then'](function(_0x204059){_0x3ef739[_0x50aa('0x1c')]=_0x204059;if(_0x37787c[_0x50aa('0x2d')][_0x50aa('0x3d')]){_0x572c93['include']=[{'all':!![]}];}return db[_0x50aa('0x28')][_0x50aa('0x3e')](_0x572c93);})['then'](function(_0x3d26d8){_0x3ef739['rows']=_0x3d26d8;return _0x3ef739;})['then'](respondWithFilteredResult(_0x587a22,_0x572c93))[_0x50aa('0x3f')](handleError(_0x587a22,null));};exports['show']=function(_0x484633,_0x31bf04){var _0x1ad10d={'raw':![],'where':{'id':_0x484633['params']['id']}},_0x4afd4d={};_0x4afd4d[_0x50aa('0x2c')]=_['keys'](db[_0x50aa('0x28')][_0x50aa('0x29')]);_0x4afd4d[_0x50aa('0x2d')]=_[_0x50aa('0x2e')](_0x484633[_0x50aa('0x2d')]);_0x4afd4d[_0x50aa('0x2f')]=_[_0x50aa('0x30')](_0x4afd4d[_0x50aa('0x2c')],_0x4afd4d[_0x50aa('0x2d')]);_0x1ad10d['attributes']=_['intersection'](_0x4afd4d[_0x50aa('0x2c')],qs['fields'](_0x484633['query']['fields']));_0x1ad10d[_0x50aa('0x31')]=_0x1ad10d[_0x50aa('0x31')][_0x50aa('0x33')]?_0x1ad10d['attributes']:_0x4afd4d['model'];if(_0x484633[_0x50aa('0x2d')][_0x50aa('0x3d')]){_0x1ad10d[_0x50aa('0x40')]=[{'all':!![]}];}_0x1ad10d=_[_0x50aa('0x39')]({},_0x1ad10d,_0x484633[_0x50aa('0x3c')]);return db[_0x50aa('0x28')][_0x50aa('0x41')](_0x1ad10d)[_0x50aa('0x22')](handleEntityNotFound(_0x31bf04,null))[_0x50aa('0x22')](respondWithResult(_0x31bf04,null))[_0x50aa('0x3f')](handleError(_0x31bf04,null));};exports[_0x50aa('0x42')]=function(_0x106927,_0x288d49){return db[_0x50aa('0x28')]['create'](_0x106927[_0x50aa('0x43')],{})['then'](respondWithResult(_0x288d49,0xc9))[_0x50aa('0x3f')](handleError(_0x288d49,null));};exports['update']=function(_0x3cf835,_0x43b9e7){if(_0x3cf835[_0x50aa('0x43')]['id']){delete _0x3cf835['body']['id'];}return db[_0x50aa('0x28')]['find']({'where':{'id':_0x3cf835['params']['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x43b9e7,null))[_0x50aa('0x22')](saveUpdates(_0x3cf835[_0x50aa('0x43')],null))[_0x50aa('0x22')](respondWithResult(_0x43b9e7,null))[_0x50aa('0x3f')](handleError(_0x43b9e7,null));};exports[_0x50aa('0x23')]=function(_0x24e67f,_0x1246e7){return db['DeskConfiguration'][_0x50aa('0x41')]({'where':{'id':_0x24e67f[_0x50aa('0x44')]['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x1246e7,null))[_0x50aa('0x22')](removeEntity(_0x1246e7,null))[_0x50aa('0x3f')](handleError(_0x1246e7,null));};exports[_0x50aa('0x45')]=function(_0x2a7fe5,_0x567c08,_0x21c669){var _0xab91e0={};var _0x1eb498={};var _0x11ddea;var _0x171d3d;return db[_0x50aa('0x28')]['findOne']({'where':{'id':_0x2a7fe5['params']['id']}})['then'](handleEntityNotFound(_0x567c08,null))['then'](function(_0x4e46e3){if(_0x4e46e3){_0x11ddea=_0x4e46e3;_0x1eb498['model']=_[_0x50aa('0x2e')](db[_0x50aa('0x46')]['rawAttributes']);_0x1eb498['query']=_[_0x50aa('0x2e')](_0x2a7fe5[_0x50aa('0x2d')]);_0x1eb498[_0x50aa('0x2f')]=_[_0x50aa('0x30')](_0x1eb498[_0x50aa('0x2c')],_0x1eb498[_0x50aa('0x2d')]);_0xab91e0[_0x50aa('0x31')]=_['intersection'](_0x1eb498[_0x50aa('0x2c')],qs['fields'](_0x2a7fe5[_0x50aa('0x2d')][_0x50aa('0x32')]));_0xab91e0[_0x50aa('0x31')]=_0xab91e0['attributes'][_0x50aa('0x33')]?_0xab91e0[_0x50aa('0x31')]:_0x1eb498['model'];_0xab91e0['order']=qs[_0x50aa('0x47')](_0x2a7fe5['query']['sort']);_0xab91e0[_0x50aa('0x36')]=qs['filters'](_['pick'](_0x2a7fe5[_0x50aa('0x2d')],_0x1eb498['filters']));if(_0x2a7fe5[_0x50aa('0x2d')][_0x50aa('0x38')]){_0xab91e0[_0x50aa('0x36')]=_['merge'](_0xab91e0[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0xab91e0[_0x50aa('0x31')],function(_0x4bff78){var _0x570da2={};_0x570da2[_0x4bff78]={'$like':'%'+_0x2a7fe5['query'][_0x50aa('0x38')]+'%'};return _0x570da2;})});}_0xab91e0=_[_0x50aa('0x39')]({},_0xab91e0,_0x2a7fe5[_0x50aa('0x3c')]);return _0x11ddea['getFields'](_0xab91e0);}})[_0x50aa('0x22')](function(_0xf6194b){if(_0xf6194b){_0x171d3d=_0xf6194b[_0x50aa('0x33')];if(!_0x2a7fe5['query'][_0x50aa('0x34')](_0x50aa('0x48'))){_0xab91e0['limit']=qs[_0x50aa('0x1b')](_0x2a7fe5[_0x50aa('0x2d')]['limit']);_0xab91e0['offset']=qs[_0x50aa('0x1d')](_0x2a7fe5[_0x50aa('0x2d')]['offset']);}return _0x11ddea['getFields'](_0xab91e0);}})['then'](function(_0x1b7af4){if(_0x1b7af4){return _0x1b7af4?{'count':_0x171d3d,'rows':_0x1b7af4}:null;}})[_0x50aa('0x22')](respondWithResult(_0x567c08,null))[_0x50aa('0x3f')](handleError(_0x567c08,null));};exports['getSubjects']=function(_0x3d7c12,_0x5df996,_0x206a69){var _0x3d9b7e={};var _0x1d1b98={};var _0x555db2;var _0x515e5d;return db['DeskConfiguration'][_0x50aa('0x49')]({'where':{'id':_0x3d7c12[_0x50aa('0x44')]['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x5df996,null))[_0x50aa('0x22')](function(_0x1726a6){if(_0x1726a6){_0x555db2=_0x1726a6;_0x1d1b98[_0x50aa('0x2c')]=_[_0x50aa('0x2e')](db[_0x50aa('0x46')][_0x50aa('0x29')]);_0x1d1b98[_0x50aa('0x2d')]=_['keys'](_0x3d7c12[_0x50aa('0x2d')]);_0x1d1b98['filters']=_[_0x50aa('0x30')](_0x1d1b98[_0x50aa('0x2c')],_0x1d1b98[_0x50aa('0x2d')]);_0x3d9b7e[_0x50aa('0x31')]=_[_0x50aa('0x30')](_0x1d1b98[_0x50aa('0x2c')],qs[_0x50aa('0x32')](_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x3d9b7e[_0x50aa('0x31')]=_0x3d9b7e[_0x50aa('0x31')]['length']?_0x3d9b7e[_0x50aa('0x31')]:_0x1d1b98['model'];_0x3d9b7e['order']=qs[_0x50aa('0x47')](_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x47')]);_0x3d9b7e['where']=qs[_0x50aa('0x2f')](_[_0x50aa('0x37')](_0x3d7c12['query'],_0x1d1b98[_0x50aa('0x2f')]));if(_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x3d9b7e['where']=_['merge'](_0x3d9b7e[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0x3d9b7e[_0x50aa('0x31')],function(_0x530b55){var _0x3b72bc={};_0x3b72bc[_0x530b55]={'$like':'%'+_0x3d7c12['query'][_0x50aa('0x38')]+'%'};return _0x3b72bc;})});}_0x3d9b7e=_[_0x50aa('0x39')]({},_0x3d9b7e,_0x3d7c12['options']);return _0x555db2[_0x50aa('0x4a')](_0x3d9b7e);}})['then'](function(_0x4993d2){if(_0x4993d2){_0x515e5d=_0x4993d2[_0x50aa('0x33')];if(!_0x3d7c12[_0x50aa('0x2d')][_0x50aa('0x34')]('nolimit')){_0x3d9b7e[_0x50aa('0x1b')]=qs[_0x50aa('0x1b')](_0x3d7c12[_0x50aa('0x2d')]['limit']);_0x3d9b7e[_0x50aa('0x1d')]=qs[_0x50aa('0x1d')](_0x3d7c12[_0x50aa('0x2d')]['offset']);}return _0x555db2[_0x50aa('0x4a')](_0x3d9b7e);}})['then'](function(_0x224658){if(_0x224658){return _0x224658?{'count':_0x515e5d,'rows':_0x224658}:null;}})['then'](respondWithResult(_0x5df996,null))[_0x50aa('0x3f')](handleError(_0x5df996,null));};exports['getDescriptions']=function(_0x4005b1,_0x4e248f,_0x27dd1c){var _0x3c2169={};var _0x23d5e={};var _0x476b18;var _0x4444ec;return db['DeskConfiguration'][_0x50aa('0x49')]({'where':{'id':_0x4005b1[_0x50aa('0x44')]['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x4e248f,null))[_0x50aa('0x22')](function(_0x5479bb){if(_0x5479bb){_0x476b18=_0x5479bb;_0x23d5e['model']=_[_0x50aa('0x2e')](db[_0x50aa('0x46')]['rawAttributes']);_0x23d5e['query']=_['keys'](_0x4005b1[_0x50aa('0x2d')]);_0x23d5e[_0x50aa('0x2f')]=_['intersection'](_0x23d5e[_0x50aa('0x2c')],_0x23d5e[_0x50aa('0x2d')]);_0x3c2169[_0x50aa('0x31')]=_[_0x50aa('0x30')](_0x23d5e['model'],qs[_0x50aa('0x32')](_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x3c2169[_0x50aa('0x31')]=_0x3c2169[_0x50aa('0x31')]['length']?_0x3c2169['attributes']:_0x23d5e['model'];_0x3c2169['order']=qs[_0x50aa('0x47')](_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x47')]);_0x3c2169[_0x50aa('0x36')]=qs[_0x50aa('0x2f')](_[_0x50aa('0x37')](_0x4005b1['query'],_0x23d5e[_0x50aa('0x2f')]));if(_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x3c2169[_0x50aa('0x36')]=_[_0x50aa('0x39')](_0x3c2169[_0x50aa('0x36')],{'$or':_[_0x50aa('0x27')](_0x3c2169[_0x50aa('0x31')],function(_0x3355c1){var _0x436fe4={};_0x436fe4[_0x3355c1]={'$like':'%'+_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x38')]+'%'};return _0x436fe4;})});}_0x3c2169=_[_0x50aa('0x39')]({},_0x3c2169,_0x4005b1[_0x50aa('0x3c')]);return _0x476b18['getDescriptions'](_0x3c2169);}})['then'](function(_0x58c5b1){if(_0x58c5b1){_0x4444ec=_0x58c5b1[_0x50aa('0x33')];if(!_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x34')](_0x50aa('0x48'))){_0x3c2169[_0x50aa('0x1b')]=qs['limit'](_0x4005b1['query']['limit']);_0x3c2169['offset']=qs[_0x50aa('0x1d')](_0x4005b1[_0x50aa('0x2d')][_0x50aa('0x1d')]);}return _0x476b18[_0x50aa('0x4b')](_0x3c2169);}})[_0x50aa('0x22')](function(_0x23e6a4){if(_0x23e6a4){return _0x23e6a4?{'count':_0x4444ec,'rows':_0x23e6a4}:null;}})[_0x50aa('0x22')](respondWithResult(_0x4e248f,null))['catch'](handleError(_0x4e248f,null));};exports[_0x50aa('0x4c')]=function(_0x275a93,_0x5c5986,_0x3b4cd8){var _0x550d3b={};var _0xe6c8e8={};var _0x5e2eef;var _0x435625;return db['DeskConfiguration'][_0x50aa('0x49')]({'where':{'id':_0x275a93['params']['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x5c5986,null))[_0x50aa('0x22')](function(_0x429a0a){if(_0x429a0a){_0x5e2eef=_0x429a0a;_0xe6c8e8[_0x50aa('0x2c')]=_[_0x50aa('0x2e')](db[_0x50aa('0x4d')]['rawAttributes']);_0xe6c8e8[_0x50aa('0x2d')]=_[_0x50aa('0x2e')](_0x275a93['query']);_0xe6c8e8['filters']=_[_0x50aa('0x30')](_0xe6c8e8[_0x50aa('0x2c')],_0xe6c8e8[_0x50aa('0x2d')]);_0x550d3b['attributes']=_[_0x50aa('0x30')](_0xe6c8e8[_0x50aa('0x2c')],qs[_0x50aa('0x32')](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x32')]));_0x550d3b[_0x50aa('0x31')]=_0x550d3b[_0x50aa('0x31')][_0x50aa('0x33')]?_0x550d3b[_0x50aa('0x31')]:_0xe6c8e8[_0x50aa('0x2c')];_0x550d3b[_0x50aa('0x35')]=qs[_0x50aa('0x47')](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x47')]);_0x550d3b[_0x50aa('0x36')]=qs[_0x50aa('0x2f')](_[_0x50aa('0x37')](_0x275a93[_0x50aa('0x2d')],_0xe6c8e8[_0x50aa('0x2f')]));if(_0x275a93[_0x50aa('0x2d')][_0x50aa('0x38')]){_0x550d3b[_0x50aa('0x36')]=_['merge'](_0x550d3b[_0x50aa('0x36')],{'$or':_['map'](_0x550d3b[_0x50aa('0x31')],function(_0x41040d){var _0x2a43e7={};_0x2a43e7[_0x41040d]={'$like':'%'+_0x275a93[_0x50aa('0x2d')]['filter']+'%'};return _0x2a43e7;})});}_0x550d3b=_[_0x50aa('0x39')]({},_0x550d3b,_0x275a93[_0x50aa('0x3c')]);return _0x5e2eef[_0x50aa('0x4c')](_0x550d3b);}})[_0x50aa('0x22')](function(_0x52125f){if(_0x52125f){_0x435625=_0x52125f['length'];if(!_0x275a93[_0x50aa('0x2d')][_0x50aa('0x34')](_0x50aa('0x48'))){_0x550d3b[_0x50aa('0x1b')]=qs[_0x50aa('0x1b')](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x1b')]);_0x550d3b[_0x50aa('0x1d')]=qs['offset'](_0x275a93[_0x50aa('0x2d')][_0x50aa('0x1d')]);}return _0x5e2eef[_0x50aa('0x4c')](_0x550d3b);}})['then'](function(_0x5e4626){if(_0x5e4626){return _0x5e4626?{'count':_0x435625,'rows':_0x5e4626}:null;}})['then'](respondWithResult(_0x5c5986,null))['catch'](handleError(_0x5c5986,null));};exports[_0x50aa('0x4e')]=function(_0x468ae0,_0x14a494,_0x234a0f){if(_0x468ae0[_0x50aa('0x43')]['id']){delete _0x468ae0[_0x50aa('0x43')]['id'];}return db[_0x50aa('0x28')][_0x50aa('0x49')]({'where':{'id':_0x468ae0['params']['id']}})[_0x50aa('0x22')](handleEntityNotFound(_0x14a494,null))[_0x50aa('0x22')](function(_0x12d317){if(_0x12d317){return _0x12d317[_0x50aa('0x4e')](_0x468ae0[_0x50aa('0x43')][_0x50aa('0x4f')]||[]);}return null;})[_0x50aa('0x22')](respondWithResult(_0x14a494,null))[_0x50aa('0x3f')](handleError(_0x14a494,null));}; \ No newline at end of file +var _0xcc37=['../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','reject','then','error','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','intersection','create','body','find','destroy','getFields','findOne','DeskField','length','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x343a0e,_0x10d50a){var _0x51325a=function(_0x1fad93){while(--_0x1fad93){_0x343a0e['push'](_0x343a0e['shift']());}};_0x51325a(++_0x10d50a);}(_0xcc37,0x1c1));var _0x7cc3=function(_0x270dae,_0x21ee5a){_0x270dae=_0x270dae-0x0;var _0x5b0a62=_0xcc37[_0x270dae];return _0x5b0a62;};'use strict';var emlformat=require(_0x7cc3('0x0'));var rimraf=require(_0x7cc3('0x1'));var zipdir=require(_0x7cc3('0x2'));var jsonpatch=require(_0x7cc3('0x3'));var rp=require(_0x7cc3('0x4'));var moment=require('moment');var BPromise=require(_0x7cc3('0x5'));var Mustache=require(_0x7cc3('0x6'));var util=require(_0x7cc3('0x7'));var path=require('path');var sox=require(_0x7cc3('0x8'));var csv=require(_0x7cc3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cc3('0xa'));var _=require(_0x7cc3('0xb'));var squel=require(_0x7cc3('0xc'));var crypto=require(_0x7cc3('0xd'));var jsforce=require(_0x7cc3('0xe'));var deskjs=require(_0x7cc3('0xf'));var toCsv=require(_0x7cc3('0x9'));var querystring=require(_0x7cc3('0x10'));var Papa=require(_0x7cc3('0x11'));var Redis=require(_0x7cc3('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7cc3('0x13'));var hardwareService=require(_0x7cc3('0x14'));var logger=require(_0x7cc3('0x15'))(_0x7cc3('0x16'));var utils=require(_0x7cc3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7cc3('0x18'));var db=require(_0x7cc3('0x19'))['db'];function respondWithStatusCode(_0x192c57,_0x1c1e29){_0x1c1e29=_0x1c1e29||0xcc;return function(_0x22e0df){if(_0x22e0df){return _0x192c57[_0x7cc3('0x1a')](_0x1c1e29);}return _0x192c57[_0x7cc3('0x1b')](_0x1c1e29)[_0x7cc3('0x1c')]();};}function respondWithResult(_0x20ed8,_0x1a59ba){_0x1a59ba=_0x1a59ba||0xc8;return function(_0x2b4431){if(_0x2b4431){return _0x20ed8[_0x7cc3('0x1b')](_0x1a59ba)['json'](_0x2b4431);}};}function respondWithFilteredResult(_0x3a5dca,_0x17ed8e){return function(_0x5b7386){if(_0x5b7386){var _0x91dbf5=typeof _0x17ed8e[_0x7cc3('0x1d')]==='undefined'&&typeof _0x17ed8e[_0x7cc3('0x1e')]==='undefined';var _0x578132=_0x5b7386[_0x7cc3('0x1f')];var _0x2980da=_0x91dbf5?0x0:_0x17ed8e['offset'];var _0xe21199=_0x91dbf5?_0x5b7386[_0x7cc3('0x1f')]:_0x17ed8e[_0x7cc3('0x1d')]+_0x17ed8e[_0x7cc3('0x1e')];var _0x49731d;if(_0xe21199>=_0x578132){_0xe21199=_0x578132;_0x49731d=0xc8;}else{_0x49731d=0xce;}_0x3a5dca[_0x7cc3('0x1b')](_0x49731d);return _0x3a5dca[_0x7cc3('0x20')]('Content-Range',_0x2980da+'-'+_0xe21199+'/'+_0x578132)[_0x7cc3('0x21')](_0x5b7386);}return null;};}function patchUpdates(_0x2ad954){return function(_0xa2ff5d){try{jsonpatch['apply'](_0xa2ff5d,_0x2ad954,!![]);}catch(_0x5be3f7){return BPromise[_0x7cc3('0x22')](_0x5be3f7);}return _0xa2ff5d['save']();};}function saveUpdates(_0x20ef99,_0x1d20d4){return function(_0x470c70){if(_0x470c70){return _0x470c70['update'](_0x20ef99)[_0x7cc3('0x23')](function(_0x492b68){return _0x492b68;});}return null;};}function removeEntity(_0x5c6d2f,_0xd51348){return function(_0x531d2c){if(_0x531d2c){return _0x531d2c['destroy']()['then'](function(){_0x5c6d2f[_0x7cc3('0x1b')](0xcc)[_0x7cc3('0x1c')]();});}};}function handleEntityNotFound(_0x2ce88b,_0x55fcf2){return function(_0x295a80){if(!_0x295a80){_0x2ce88b[_0x7cc3('0x1a')](0x194);}return _0x295a80;};}function handleError(_0x461175,_0x11fbfd){_0x11fbfd=_0x11fbfd||0x1f4;return function(_0x34050b){logger[_0x7cc3('0x24')](_0x34050b['stack']);if(_0x34050b[_0x7cc3('0x25')]){delete _0x34050b[_0x7cc3('0x25')];}_0x461175[_0x7cc3('0x1b')](_0x11fbfd)['send'](_0x34050b);};}exports[_0x7cc3('0x26')]=function(_0x158a1b,_0x1bff15){var _0x2d4aa2={},_0x4e8016={},_0x2b5d68={'count':0x0,'rows':[]};var _0xc3648e=_[_0x7cc3('0x27')](db[_0x7cc3('0x28')][_0x7cc3('0x29')],function(_0xf70279){return{'name':_0xf70279[_0x7cc3('0x2a')],'type':_0xf70279[_0x7cc3('0x2b')]['key']};});_0x4e8016[_0x7cc3('0x2c')]=_[_0x7cc3('0x27')](_0xc3648e,_0x7cc3('0x25'));_0x4e8016[_0x7cc3('0x2d')]=_[_0x7cc3('0x2e')](_0x158a1b[_0x7cc3('0x2d')]);_0x4e8016[_0x7cc3('0x2f')]=_['intersection'](_0x4e8016[_0x7cc3('0x2c')],_0x4e8016[_0x7cc3('0x2d')]);_0x2d4aa2['attributes']=_['intersection'](_0x4e8016[_0x7cc3('0x2c')],qs[_0x7cc3('0x30')](_0x158a1b[_0x7cc3('0x2d')][_0x7cc3('0x30')]));_0x2d4aa2[_0x7cc3('0x31')]=_0x2d4aa2['attributes']['length']?_0x2d4aa2['attributes']:_0x4e8016[_0x7cc3('0x2c')];if(!_0x158a1b[_0x7cc3('0x2d')][_0x7cc3('0x32')](_0x7cc3('0x33'))){_0x2d4aa2['limit']=qs[_0x7cc3('0x1e')](_0x158a1b[_0x7cc3('0x2d')][_0x7cc3('0x1e')]);_0x2d4aa2['offset']=qs[_0x7cc3('0x1d')](_0x158a1b['query'][_0x7cc3('0x1d')]);}_0x2d4aa2[_0x7cc3('0x34')]=qs[_0x7cc3('0x35')](_0x158a1b[_0x7cc3('0x2d')][_0x7cc3('0x35')]);_0x2d4aa2[_0x7cc3('0x36')]=qs[_0x7cc3('0x2f')](_[_0x7cc3('0x37')](_0x158a1b[_0x7cc3('0x2d')],_0x4e8016[_0x7cc3('0x2f')]),_0xc3648e);if(_0x158a1b[_0x7cc3('0x2d')][_0x7cc3('0x38')]){_0x2d4aa2[_0x7cc3('0x36')]=_[_0x7cc3('0x39')](_0x2d4aa2[_0x7cc3('0x36')],{'$or':_[_0x7cc3('0x27')](_0xc3648e,function(_0x17a4b8){if(_0x17a4b8[_0x7cc3('0x2b')]!=='VIRTUAL'){var _0x2cde7b={};_0x2cde7b[_0x17a4b8[_0x7cc3('0x25')]]={'$like':'%'+_0x158a1b['query'][_0x7cc3('0x38')]+'%'};return _0x2cde7b;}})});}_0x2d4aa2=_[_0x7cc3('0x39')]({},_0x2d4aa2,_0x158a1b[_0x7cc3('0x3a')]);var _0x2ff7ca={'where':_0x2d4aa2[_0x7cc3('0x36')]};return db[_0x7cc3('0x28')][_0x7cc3('0x1f')](_0x2ff7ca)[_0x7cc3('0x23')](function(_0x4e567d){_0x2b5d68[_0x7cc3('0x1f')]=_0x4e567d;if(_0x158a1b['query'][_0x7cc3('0x3b')]){_0x2d4aa2[_0x7cc3('0x3c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7cc3('0x3d')](_0x2d4aa2);})[_0x7cc3('0x23')](function(_0x311acd){_0x2b5d68['rows']=_0x311acd;return _0x2b5d68;})['then'](respondWithFilteredResult(_0x1bff15,_0x2d4aa2))[_0x7cc3('0x3e')](handleError(_0x1bff15,null));};exports[_0x7cc3('0x3f')]=function(_0x74d1c5,_0x54b96e){var _0xdddf62={'raw':![],'where':{'id':_0x74d1c5[_0x7cc3('0x40')]['id']}},_0x2d3d3b={};_0x2d3d3b[_0x7cc3('0x2c')]=_['keys'](db[_0x7cc3('0x28')][_0x7cc3('0x29')]);_0x2d3d3b[_0x7cc3('0x2d')]=_[_0x7cc3('0x2e')](_0x74d1c5['query']);_0x2d3d3b[_0x7cc3('0x2f')]=_['intersection'](_0x2d3d3b[_0x7cc3('0x2c')],_0x2d3d3b[_0x7cc3('0x2d')]);_0xdddf62[_0x7cc3('0x31')]=_[_0x7cc3('0x41')](_0x2d3d3b[_0x7cc3('0x2c')],qs[_0x7cc3('0x30')](_0x74d1c5[_0x7cc3('0x2d')][_0x7cc3('0x30')]));_0xdddf62[_0x7cc3('0x31')]=_0xdddf62[_0x7cc3('0x31')]['length']?_0xdddf62[_0x7cc3('0x31')]:_0x2d3d3b[_0x7cc3('0x2c')];if(_0x74d1c5[_0x7cc3('0x2d')][_0x7cc3('0x3b')]){_0xdddf62[_0x7cc3('0x3c')]=[{'all':!![]}];}_0xdddf62=_[_0x7cc3('0x39')]({},_0xdddf62,_0x74d1c5[_0x7cc3('0x3a')]);return db[_0x7cc3('0x28')]['find'](_0xdddf62)[_0x7cc3('0x23')](handleEntityNotFound(_0x54b96e,null))[_0x7cc3('0x23')](respondWithResult(_0x54b96e,null))['catch'](handleError(_0x54b96e,null));};exports[_0x7cc3('0x42')]=function(_0x3e6717,_0x1e448a){return db['DeskConfiguration'][_0x7cc3('0x42')](_0x3e6717[_0x7cc3('0x43')],{})[_0x7cc3('0x23')](respondWithResult(_0x1e448a,0xc9))[_0x7cc3('0x3e')](handleError(_0x1e448a,null));};exports['update']=function(_0x17f0a5,_0x843cd3){if(_0x17f0a5[_0x7cc3('0x43')]['id']){delete _0x17f0a5[_0x7cc3('0x43')]['id'];}return db[_0x7cc3('0x28')][_0x7cc3('0x44')]({'where':{'id':_0x17f0a5[_0x7cc3('0x40')]['id']}})[_0x7cc3('0x23')](handleEntityNotFound(_0x843cd3,null))[_0x7cc3('0x23')](saveUpdates(_0x17f0a5[_0x7cc3('0x43')],null))['then'](respondWithResult(_0x843cd3,null))[_0x7cc3('0x3e')](handleError(_0x843cd3,null));};exports[_0x7cc3('0x45')]=function(_0x12e588,_0x2c47e8){return db['DeskConfiguration'][_0x7cc3('0x44')]({'where':{'id':_0x12e588[_0x7cc3('0x40')]['id']}})[_0x7cc3('0x23')](handleEntityNotFound(_0x2c47e8,null))['then'](removeEntity(_0x2c47e8,null))['catch'](handleError(_0x2c47e8,null));};exports[_0x7cc3('0x46')]=function(_0x47d48b,_0x26f33e,_0x3a7b9a){var _0x10a595={};var _0x3b3bc5={};var _0x4ccaa8;var _0x14c8d9;return db['DeskConfiguration'][_0x7cc3('0x47')]({'where':{'id':_0x47d48b[_0x7cc3('0x40')]['id']}})[_0x7cc3('0x23')](handleEntityNotFound(_0x26f33e,null))['then'](function(_0x4b0565){if(_0x4b0565){_0x4ccaa8=_0x4b0565;_0x3b3bc5[_0x7cc3('0x2c')]=_[_0x7cc3('0x2e')](db[_0x7cc3('0x48')][_0x7cc3('0x29')]);_0x3b3bc5['query']=_[_0x7cc3('0x2e')](_0x47d48b[_0x7cc3('0x2d')]);_0x3b3bc5['filters']=_[_0x7cc3('0x41')](_0x3b3bc5['model'],_0x3b3bc5[_0x7cc3('0x2d')]);_0x10a595['attributes']=_[_0x7cc3('0x41')](_0x3b3bc5[_0x7cc3('0x2c')],qs[_0x7cc3('0x30')](_0x47d48b[_0x7cc3('0x2d')]['fields']));_0x10a595[_0x7cc3('0x31')]=_0x10a595[_0x7cc3('0x31')]['length']?_0x10a595['attributes']:_0x3b3bc5['model'];_0x10a595[_0x7cc3('0x34')]=qs[_0x7cc3('0x35')](_0x47d48b['query']['sort']);_0x10a595['where']=qs[_0x7cc3('0x2f')](_[_0x7cc3('0x37')](_0x47d48b[_0x7cc3('0x2d')],_0x3b3bc5[_0x7cc3('0x2f')]));if(_0x47d48b['query'][_0x7cc3('0x38')]){_0x10a595[_0x7cc3('0x36')]=_[_0x7cc3('0x39')](_0x10a595[_0x7cc3('0x36')],{'$or':_['map'](_0x10a595[_0x7cc3('0x31')],function(_0x17703c){var _0x498642={};_0x498642[_0x17703c]={'$like':'%'+_0x47d48b[_0x7cc3('0x2d')][_0x7cc3('0x38')]+'%'};return _0x498642;})});}_0x10a595=_[_0x7cc3('0x39')]({},_0x10a595,_0x47d48b[_0x7cc3('0x3a')]);return _0x4ccaa8[_0x7cc3('0x46')](_0x10a595);}})[_0x7cc3('0x23')](function(_0x33f026){if(_0x33f026){_0x14c8d9=_0x33f026[_0x7cc3('0x49')];if(!_0x47d48b[_0x7cc3('0x2d')][_0x7cc3('0x32')]('nolimit')){_0x10a595[_0x7cc3('0x1e')]=qs[_0x7cc3('0x1e')](_0x47d48b[_0x7cc3('0x2d')][_0x7cc3('0x1e')]);_0x10a595['offset']=qs['offset'](_0x47d48b[_0x7cc3('0x2d')][_0x7cc3('0x1d')]);}return _0x4ccaa8['getFields'](_0x10a595);}})['then'](function(_0x2ab434){if(_0x2ab434){return _0x2ab434?{'count':_0x14c8d9,'rows':_0x2ab434}:null;}})['then'](respondWithResult(_0x26f33e,null))[_0x7cc3('0x3e')](handleError(_0x26f33e,null));};exports[_0x7cc3('0x4a')]=function(_0x5e9c8e,_0xe409b8,_0x25444d){var _0xc747d1={};var _0x1dbebc={};var _0x408f84;var _0x54adbf;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5e9c8e['params']['id']}})['then'](handleEntityNotFound(_0xe409b8,null))[_0x7cc3('0x23')](function(_0x4054d4){if(_0x4054d4){_0x408f84=_0x4054d4;_0x1dbebc[_0x7cc3('0x2c')]=_[_0x7cc3('0x2e')](db[_0x7cc3('0x48')]['rawAttributes']);_0x1dbebc[_0x7cc3('0x2d')]=_[_0x7cc3('0x2e')](_0x5e9c8e[_0x7cc3('0x2d')]);_0x1dbebc[_0x7cc3('0x2f')]=_['intersection'](_0x1dbebc['model'],_0x1dbebc[_0x7cc3('0x2d')]);_0xc747d1['attributes']=_[_0x7cc3('0x41')](_0x1dbebc['model'],qs['fields'](_0x5e9c8e[_0x7cc3('0x2d')][_0x7cc3('0x30')]));_0xc747d1[_0x7cc3('0x31')]=_0xc747d1[_0x7cc3('0x31')][_0x7cc3('0x49')]?_0xc747d1[_0x7cc3('0x31')]:_0x1dbebc['model'];_0xc747d1['order']=qs[_0x7cc3('0x35')](_0x5e9c8e[_0x7cc3('0x2d')]['sort']);_0xc747d1[_0x7cc3('0x36')]=qs[_0x7cc3('0x2f')](_['pick'](_0x5e9c8e['query'],_0x1dbebc[_0x7cc3('0x2f')]));if(_0x5e9c8e[_0x7cc3('0x2d')][_0x7cc3('0x38')]){_0xc747d1['where']=_[_0x7cc3('0x39')](_0xc747d1['where'],{'$or':_[_0x7cc3('0x27')](_0xc747d1[_0x7cc3('0x31')],function(_0x370313){var _0x5740f2={};_0x5740f2[_0x370313]={'$like':'%'+_0x5e9c8e['query'][_0x7cc3('0x38')]+'%'};return _0x5740f2;})});}_0xc747d1=_[_0x7cc3('0x39')]({},_0xc747d1,_0x5e9c8e[_0x7cc3('0x3a')]);return _0x408f84[_0x7cc3('0x4a')](_0xc747d1);}})[_0x7cc3('0x23')](function(_0x24342b){if(_0x24342b){_0x54adbf=_0x24342b['length'];if(!_0x5e9c8e[_0x7cc3('0x2d')][_0x7cc3('0x32')](_0x7cc3('0x33'))){_0xc747d1[_0x7cc3('0x1e')]=qs[_0x7cc3('0x1e')](_0x5e9c8e[_0x7cc3('0x2d')][_0x7cc3('0x1e')]);_0xc747d1[_0x7cc3('0x1d')]=qs['offset'](_0x5e9c8e[_0x7cc3('0x2d')][_0x7cc3('0x1d')]);}return _0x408f84[_0x7cc3('0x4a')](_0xc747d1);}})[_0x7cc3('0x23')](function(_0x477b1c){if(_0x477b1c){return _0x477b1c?{'count':_0x54adbf,'rows':_0x477b1c}:null;}})['then'](respondWithResult(_0xe409b8,null))[_0x7cc3('0x3e')](handleError(_0xe409b8,null));};exports[_0x7cc3('0x4b')]=function(_0x43b6fd,_0x4d6093,_0x269b39){var _0x297ece={};var _0x4fe7f5={};var _0xfd530d;var _0x657519;return db[_0x7cc3('0x28')][_0x7cc3('0x47')]({'where':{'id':_0x43b6fd[_0x7cc3('0x40')]['id']}})[_0x7cc3('0x23')](handleEntityNotFound(_0x4d6093,null))[_0x7cc3('0x23')](function(_0x162cff){if(_0x162cff){_0xfd530d=_0x162cff;_0x4fe7f5['model']=_['keys'](db[_0x7cc3('0x48')][_0x7cc3('0x29')]);_0x4fe7f5[_0x7cc3('0x2d')]=_[_0x7cc3('0x2e')](_0x43b6fd[_0x7cc3('0x2d')]);_0x4fe7f5[_0x7cc3('0x2f')]=_['intersection'](_0x4fe7f5[_0x7cc3('0x2c')],_0x4fe7f5[_0x7cc3('0x2d')]);_0x297ece[_0x7cc3('0x31')]=_[_0x7cc3('0x41')](_0x4fe7f5[_0x7cc3('0x2c')],qs['fields'](_0x43b6fd[_0x7cc3('0x2d')]['fields']));_0x297ece['attributes']=_0x297ece[_0x7cc3('0x31')][_0x7cc3('0x49')]?_0x297ece[_0x7cc3('0x31')]:_0x4fe7f5[_0x7cc3('0x2c')];_0x297ece['order']=qs[_0x7cc3('0x35')](_0x43b6fd[_0x7cc3('0x2d')][_0x7cc3('0x35')]);_0x297ece['where']=qs[_0x7cc3('0x2f')](_[_0x7cc3('0x37')](_0x43b6fd[_0x7cc3('0x2d')],_0x4fe7f5['filters']));if(_0x43b6fd['query'][_0x7cc3('0x38')]){_0x297ece[_0x7cc3('0x36')]=_[_0x7cc3('0x39')](_0x297ece[_0x7cc3('0x36')],{'$or':_['map'](_0x297ece['attributes'],function(_0x1cf346){var _0x45b9cf={};_0x45b9cf[_0x1cf346]={'$like':'%'+_0x43b6fd[_0x7cc3('0x2d')][_0x7cc3('0x38')]+'%'};return _0x45b9cf;})});}_0x297ece=_['merge']({},_0x297ece,_0x43b6fd[_0x7cc3('0x3a')]);return _0xfd530d[_0x7cc3('0x4b')](_0x297ece);}})[_0x7cc3('0x23')](function(_0x373af3){if(_0x373af3){_0x657519=_0x373af3[_0x7cc3('0x49')];if(!_0x43b6fd[_0x7cc3('0x2d')][_0x7cc3('0x32')](_0x7cc3('0x33'))){_0x297ece['limit']=qs[_0x7cc3('0x1e')](_0x43b6fd['query']['limit']);_0x297ece[_0x7cc3('0x1d')]=qs[_0x7cc3('0x1d')](_0x43b6fd[_0x7cc3('0x2d')]['offset']);}return _0xfd530d[_0x7cc3('0x4b')](_0x297ece);}})[_0x7cc3('0x23')](function(_0x166f90){if(_0x166f90){return _0x166f90?{'count':_0x657519,'rows':_0x166f90}:null;}})[_0x7cc3('0x23')](respondWithResult(_0x4d6093,null))[_0x7cc3('0x3e')](handleError(_0x4d6093,null));};exports[_0x7cc3('0x4c')]=function(_0x56878c,_0xe1b998,_0x13e66c){var _0x2b0c91={};var _0xefc408={};var _0x4f9e8b;var _0x2774c1;return db['DeskConfiguration'][_0x7cc3('0x47')]({'where':{'id':_0x56878c['params']['id']}})[_0x7cc3('0x23')](handleEntityNotFound(_0xe1b998,null))[_0x7cc3('0x23')](function(_0x556eea){if(_0x556eea){_0x4f9e8b=_0x556eea;_0xefc408['model']=_[_0x7cc3('0x2e')](db['Tag'][_0x7cc3('0x29')]);_0xefc408[_0x7cc3('0x2d')]=_['keys'](_0x56878c[_0x7cc3('0x2d')]);_0xefc408[_0x7cc3('0x2f')]=_[_0x7cc3('0x41')](_0xefc408['model'],_0xefc408[_0x7cc3('0x2d')]);_0x2b0c91[_0x7cc3('0x31')]=_[_0x7cc3('0x41')](_0xefc408[_0x7cc3('0x2c')],qs[_0x7cc3('0x30')](_0x56878c[_0x7cc3('0x2d')][_0x7cc3('0x30')]));_0x2b0c91[_0x7cc3('0x31')]=_0x2b0c91['attributes'][_0x7cc3('0x49')]?_0x2b0c91[_0x7cc3('0x31')]:_0xefc408[_0x7cc3('0x2c')];_0x2b0c91[_0x7cc3('0x34')]=qs[_0x7cc3('0x35')](_0x56878c[_0x7cc3('0x2d')]['sort']);_0x2b0c91['where']=qs[_0x7cc3('0x2f')](_[_0x7cc3('0x37')](_0x56878c[_0x7cc3('0x2d')],_0xefc408['filters']));if(_0x56878c[_0x7cc3('0x2d')][_0x7cc3('0x38')]){_0x2b0c91[_0x7cc3('0x36')]=_[_0x7cc3('0x39')](_0x2b0c91[_0x7cc3('0x36')],{'$or':_['map'](_0x2b0c91[_0x7cc3('0x31')],function(_0x236844){var _0x5e8cf7={};_0x5e8cf7[_0x236844]={'$like':'%'+_0x56878c[_0x7cc3('0x2d')][_0x7cc3('0x38')]+'%'};return _0x5e8cf7;})});}_0x2b0c91=_['merge']({},_0x2b0c91,_0x56878c['options']);return _0x4f9e8b[_0x7cc3('0x4c')](_0x2b0c91);}})[_0x7cc3('0x23')](function(_0xfbd492){if(_0xfbd492){_0x2774c1=_0xfbd492[_0x7cc3('0x49')];if(!_0x56878c[_0x7cc3('0x2d')][_0x7cc3('0x32')](_0x7cc3('0x33'))){_0x2b0c91[_0x7cc3('0x1e')]=qs[_0x7cc3('0x1e')](_0x56878c[_0x7cc3('0x2d')][_0x7cc3('0x1e')]);_0x2b0c91[_0x7cc3('0x1d')]=qs[_0x7cc3('0x1d')](_0x56878c['query'][_0x7cc3('0x1d')]);}return _0x4f9e8b[_0x7cc3('0x4c')](_0x2b0c91);}})['then'](function(_0x5a7cc3){if(_0x5a7cc3){return _0x5a7cc3?{'count':_0x2774c1,'rows':_0x5a7cc3}:null;}})[_0x7cc3('0x23')](respondWithResult(_0xe1b998,null))[_0x7cc3('0x3e')](handleError(_0xe1b998,null));};exports[_0x7cc3('0x4d')]=function(_0x538a39,_0x68ff6e,_0x501742){if(_0x538a39[_0x7cc3('0x43')]['id']){delete _0x538a39[_0x7cc3('0x43')]['id'];}return db[_0x7cc3('0x28')][_0x7cc3('0x47')]({'where':{'id':_0x538a39['params']['id']}})['then'](handleEntityNotFound(_0x68ff6e,null))[_0x7cc3('0x23')](function(_0x4076fc){if(_0x4076fc){return _0x4076fc[_0x7cc3('0x4d')](_0x538a39[_0x7cc3('0x43')][_0x7cc3('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x68ff6e,null))[_0x7cc3('0x3e')](handleError(_0x68ff6e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2c39c49..af08522 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 _0x35d8=['DeskConfiguration','int_desk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','./intDeskConfiguration.attributes','exports','define'];(function(_0x1a91d6,_0x4e3089){var _0x4a0b81=function(_0xdc7b1f){while(--_0xdc7b1f){_0x1a91d6['push'](_0x1a91d6['shift']());}};_0x4a0b81(++_0x4e3089);}(_0x35d8,0xa7));var _0x835d=function(_0x55c013,_0x2bb2de){_0x55c013=_0x55c013-0x0;var _0x1a6176=_0x35d8[_0x55c013];return _0x1a6176;};'use strict';var _=require('lodash');var util=require(_0x835d('0x0'));var logger=require(_0x835d('0x1'))(_0x835d('0x2'));var moment=require(_0x835d('0x3'));var BPromise=require(_0x835d('0x4'));var rp=require(_0x835d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x835d('0x6'));module[_0x835d('0x7')]=function(_0x3f4eef,_0x29095e){return _0x3f4eef[_0x835d('0x8')](_0x835d('0x9'),attributes,{'tableName':_0x835d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ced=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x174268,_0x43b046){var _0x399a41=function(_0x5defbd){while(--_0x5defbd){_0x174268['push'](_0x174268['shift']());}};_0x399a41(++_0x43b046);}(_0x9ced,0x14a));var _0xd9ce=function(_0x1f6193,_0x2de9ff){_0x1f6193=_0x1f6193-0x0;var _0x160297=_0x9ced[_0x1f6193];return _0x160297;};'use strict';var _=require(_0xd9ce('0x0'));var util=require('util');var logger=require(_0xd9ce('0x1'))(_0xd9ce('0x2'));var moment=require(_0xd9ce('0x3'));var BPromise=require(_0xd9ce('0x4'));var rp=require(_0xd9ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9ce('0x6'));var config=require(_0xd9ce('0x7'));var attributes=require(_0xd9ce('0x8'));module[_0xd9ce('0x9')]=function(_0x28060b,_0xf3ef95){return _0x28060b[_0xd9ce('0xa')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','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 71aa099..8c76c85 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 _0xb5c6=['catch','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s'];(function(_0x289682,_0x516aed){var _0x159651=function(_0x2da045){while(--_0x2da045){_0x289682['push'](_0x289682['shift']());}};_0x159651(++_0x516aed);}(_0xb5c6,0xe5));var _0x6b5c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb5c6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x6b5c('0x0'));var moment=require(_0x6b5c('0x1'));var BPromise=require(_0x6b5c('0x2'));var rs=require(_0x6b5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b5c('0x4'));var config=require(_0x6b5c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6b5c('0x6')][_0x6b5c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c93ca,_0x17fed5,_0x45cdf1){return new BPromise(function(_0x2a13d0,_0xa530){return client[_0x6b5c('0x8')](_0x4c93ca,_0x45cdf1)[_0x6b5c('0x9')](function(_0x329f33){logger[_0x6b5c('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));logger['debug'](_0x6b5c('0xc'),_0x17fed5,_0x6b5c('0xb'),JSON[_0x6b5c('0xd')](_0x329f33));if(_0x329f33[_0x6b5c('0xe')]){if(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0xf')]===0x1f4){logger[_0x6b5c('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x329f33['error'][_0x6b5c('0x10')]);return _0xa530(_0x329f33[_0x6b5c('0xe')]['message']);}logger[_0x6b5c('0xe')](_0x6b5c('0x11'),_0x17fed5,_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);return _0x2a13d0(_0x329f33[_0x6b5c('0xe')][_0x6b5c('0x10')]);}else{logger[_0x6b5c('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x6b5c('0xb'));_0x2a13d0(_0x329f33['result'][_0x6b5c('0x10')]);}})[_0x6b5c('0x12')](function(_0x5eefc6){logger[_0x6b5c('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x17fed5,_0x5eefc6);_0xa530(_0x5eefc6);});});} \ No newline at end of file +var _0xb2f3=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s'];(function(_0x368095,_0x346587){var _0x62e549=function(_0x44d000){while(--_0x44d000){_0x368095['push'](_0x368095['shift']());}};_0x62e549(++_0x346587);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb2f3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3b2f('0x0'));var util=require(_0x3b2f('0x1'));var moment=require(_0x3b2f('0x2'));var BPromise=require(_0x3b2f('0x3'));var rs=require(_0x3b2f('0x4'));var fs=require('fs');var Redis=require(_0x3b2f('0x5'));var db=require(_0x3b2f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2f('0x7'))(_0x3b2f('0x8'));var config=require(_0x3b2f('0x9'));var jayson=require(_0x3b2f('0xa'));var client=jayson[_0x3b2f('0xb')][_0x3b2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26719d,_0x4b3632,_0x200ca4){return new BPromise(function(_0x56e425,_0x266ed2){return client[_0x3b2f('0xd')](_0x26719d,_0x200ca4)[_0x3b2f('0xe')](function(_0x25134f){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x4b3632,_0x3b2f('0xf'));logger[_0x3b2f('0x10')](_0x3b2f('0x11'),_0x4b3632,_0x3b2f('0xf'),JSON[_0x3b2f('0x12')](_0x25134f));if(_0x25134f[_0x3b2f('0x13')]){if(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x14')]===0x1f4){logger[_0x3b2f('0x13')](_0x3b2f('0x15'),_0x4b3632,_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);return _0x266ed2(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);}logger[_0x3b2f('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4b3632,_0x25134f[_0x3b2f('0x13')]['message']);return _0x56e425(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);}else{logger['info'](_0x3b2f('0x15'),_0x4b3632,'request\x20sent');_0x56e425(_0x25134f[_0x3b2f('0x17')][_0x3b2f('0x16')]);}})[_0x3b2f('0x18')](function(_0xd2b1e9){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4b3632,_0xd2b1e9);_0x266ed2(_0xd2b1e9);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c245c01..83de293 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 _0xe2e1=['index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated'];(function(_0xaf403a,_0x4b14fa){var _0x2ba10e=function(_0x1db2e1){while(--_0x1db2e1){_0xaf403a['push'](_0xaf403a['shift']());}};_0x2ba10e(++_0x4b14fa);}(_0xe2e1,0x9e));var _0x1e2e=function(_0x1139dd,_0x2251a3){_0x1139dd=_0x1139dd-0x0;var _0x4d831d=_0xe2e1[_0x1139dd];return _0x4d831d;};'use strict';var multer=require(_0x1e2e('0x0'));var util=require(_0x1e2e('0x1'));var path=require(_0x1e2e('0x2'));var timeout=require(_0x1e2e('0x3'));var express=require('express');var router=express[_0x1e2e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1e2e('0x5'));var interaction=require(_0x1e2e('0x6'));var config=require(_0x1e2e('0x7'));var controller=require(_0x1e2e('0x8'));router['get']('/',auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xa')]);router[_0x1e2e('0xb')](_0x1e2e('0xc'),auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xd')]);router[_0x1e2e('0xe')]('/',auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xf')]);router[_0x1e2e('0x10')](_0x1e2e('0xc'),auth['isAuthenticated'](),controller[_0x1e2e('0x11')]);router[_0x1e2e('0x12')](_0x1e2e('0xc'),auth['isAuthenticated'](),controller[_0x1e2e('0x13')]);module[_0x1e2e('0x14')]=router; \ No newline at end of file +var _0x8bec=['create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','/:id','show','post','isAuthenticated'];(function(_0x159396,_0x3c7cbb){var _0x2608a3=function(_0x45d76b){while(--_0x45d76b){_0x159396['push'](_0x159396['shift']());}};_0x2608a3(++_0x3c7cbb);}(_0x8bec,0xdd));var _0xc8be=function(_0x1514a0,_0x2ace9b){_0x1514a0=_0x1514a0-0x0;var _0x46b1c0=_0x8bec[_0x1514a0];return _0x46b1c0;};'use strict';var multer=require('multer');var util=require(_0xc8be('0x0'));var path=require('path');var timeout=require(_0xc8be('0x1'));var express=require(_0xc8be('0x2'));var router=express[_0xc8be('0x3')]();var fs_extra=require(_0xc8be('0x4'));var auth=require(_0xc8be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc8be('0x6'));var controller=require(_0xc8be('0x7'));router[_0xc8be('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc8be('0x8')](_0xc8be('0x9'),auth['isAuthenticated'](),controller[_0xc8be('0xa')]);router[_0xc8be('0xb')]('/',auth[_0xc8be('0xc')](),controller[_0xc8be('0xd')]);router[_0xc8be('0xe')](_0xc8be('0x9'),auth[_0xc8be('0xc')](),controller[_0xc8be('0xf')]);router[_0xc8be('0x10')](_0xc8be('0x9'),auth[_0xc8be('0xc')](),controller[_0xc8be('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 1c14ad2..78fc293 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 _0xf7f8=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x1186ba,_0x421a86){var _0x13a347=function(_0x357acb){while(--_0x357acb){_0x1186ba['push'](_0x1186ba['shift']());}};_0x13a347(++_0x421a86);}(_0xf7f8,0x1c3));var _0x8f7f=function(_0x5e796f,_0x33d559){_0x5e796f=_0x5e796f-0x0;var _0x4c615f=_0xf7f8[_0x5e796f];return _0x4c615f;};'use strict';var Sequelize=require(_0x8f7f('0x0'));module['exports']={'type':{'type':Sequelize[_0x8f7f('0x1')](_0x8f7f('0x2'),_0x8f7f('0x3'),_0x8f7f('0x4'),_0x8f7f('0x5'),'picklist'),'defaultValue':_0x8f7f('0x2')},'content':{'type':Sequelize[_0x8f7f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8f7f('0x1')](_0x8f7f('0x2'),_0x8f7f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x8f7f('0x6')]},'idField':{'type':Sequelize[_0x8f7f('0x6')]},'nameField':{'type':Sequelize[_0x8f7f('0x6')]},'customField':{'type':Sequelize[_0x8f7f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f7f('0x6')]}}; \ No newline at end of file +var _0x33b7=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0x33b7,0x1c6));var _0x733b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x33b7[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x733b('0x0'));module[_0x733b('0x1')]={'type':{'type':Sequelize[_0x733b('0x2')](_0x733b('0x3'),_0x733b('0x4'),'customVariable','keyValue',_0x733b('0x5')),'defaultValue':_0x733b('0x3')},'content':{'type':Sequelize[_0x733b('0x6')]},'key':{'type':Sequelize[_0x733b('0x6')]},'keyType':{'type':Sequelize[_0x733b('0x2')](_0x733b('0x3'),_0x733b('0x4'),_0x733b('0x7'))},'keyContent':{'type':Sequelize[_0x733b('0x6')]},'idField':{'type':Sequelize[_0x733b('0x6')]},'nameField':{'type':Sequelize[_0x733b('0x6')]},'customField':{'type':Sequelize[_0x733b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x733b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6d55db0..001f84c 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 _0x59f2=['limit','count','set','apply','then','destroy','sendStatus','error','name','send','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x59f2,0xb3));var _0x259f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x59f2[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x259f('0x0'));var rp=require('request-promise');var moment=require(_0x259f('0x1'));var BPromise=require(_0x259f('0x2'));var Mustache=require(_0x259f('0x3'));var util=require(_0x259f('0x4'));var path=require('path');var sox=require(_0x259f('0x5'));var csv=require(_0x259f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x259f('0x7'));var squel=require(_0x259f('0x8'));var crypto=require(_0x259f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x259f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x259f('0xb'));var Papa=require(_0x259f('0xc'));var Redis=require(_0x259f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x259f('0xe'));var as=require(_0x259f('0xf'));var hardwareService=require(_0x259f('0x10'));var logger=require('../../config/logger')(_0x259f('0x11'));var utils=require(_0x259f('0x12'));var config=require(_0x259f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314e55,_0x31a57f){_0x31a57f=_0x31a57f||0xcc;return function(_0x4d130f){if(_0x4d130f){return _0x314e55['sendStatus'](_0x31a57f);}return _0x314e55[_0x259f('0x14')](_0x31a57f)[_0x259f('0x15')]();};}function respondWithResult(_0x4007d9,_0xea5fa){_0xea5fa=_0xea5fa||0xc8;return function(_0x12a6ef){if(_0x12a6ef){return _0x4007d9[_0x259f('0x14')](_0xea5fa)[_0x259f('0x16')](_0x12a6ef);}};}function respondWithFilteredResult(_0x421c66,_0x4cb8a3){return function(_0x333c38){if(_0x333c38){var _0x447145=typeof _0x4cb8a3[_0x259f('0x17')]===_0x259f('0x18')&&typeof _0x4cb8a3[_0x259f('0x19')]===_0x259f('0x18');var _0x3303ca=_0x333c38[_0x259f('0x1a')];var _0x6daf07=_0x447145?0x0:_0x4cb8a3[_0x259f('0x17')];var _0x39e4ab=_0x447145?_0x333c38[_0x259f('0x1a')]:_0x4cb8a3['offset']+_0x4cb8a3[_0x259f('0x19')];var _0x4343b5;if(_0x39e4ab>=_0x3303ca){_0x39e4ab=_0x3303ca;_0x4343b5=0xc8;}else{_0x4343b5=0xce;}_0x421c66['status'](_0x4343b5);return _0x421c66[_0x259f('0x1b')]('Content-Range',_0x6daf07+'-'+_0x39e4ab+'/'+_0x3303ca)[_0x259f('0x16')](_0x333c38);}return null;};}function patchUpdates(_0x225d21){return function(_0x4d69c4){try{jsonpatch[_0x259f('0x1c')](_0x4d69c4,_0x225d21,!![]);}catch(_0x395a9e){return BPromise['reject'](_0x395a9e);}return _0x4d69c4['save']();};}function saveUpdates(_0x33b646,_0x3832b0){return function(_0x163d83){if(_0x163d83){return _0x163d83['update'](_0x33b646)[_0x259f('0x1d')](function(_0x55a58e){return _0x55a58e;});}return null;};}function removeEntity(_0xb78775,_0x55a9e0){return function(_0x42b578){if(_0x42b578){return _0x42b578[_0x259f('0x1e')]()[_0x259f('0x1d')](function(){_0xb78775[_0x259f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23079d,_0x4e3413){return function(_0x24de04){if(!_0x24de04){_0x23079d[_0x259f('0x1f')](0x194);}return _0x24de04;};}function handleError(_0x549d37,_0x47bf4b){_0x47bf4b=_0x47bf4b||0x1f4;return function(_0x208698){logger[_0x259f('0x20')](_0x208698['stack']);if(_0x208698[_0x259f('0x21')]){delete _0x208698[_0x259f('0x21')];}_0x549d37[_0x259f('0x14')](_0x47bf4b)[_0x259f('0x22')](_0x208698);};}exports['index']=function(_0x4c339b,_0x341635){var _0x47bf1e={},_0xc32493={},_0x14aef7={'count':0x0,'rows':[]};var _0x535b48=_[_0x259f('0x23')](db[_0x259f('0x24')][_0x259f('0x25')],function(_0x22ef0a){return{'name':_0x22ef0a[_0x259f('0x26')],'type':_0x22ef0a['type'][_0x259f('0x27')]};});_0xc32493[_0x259f('0x28')]=_[_0x259f('0x23')](_0x535b48,_0x259f('0x21'));_0xc32493[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4c339b[_0x259f('0x29')]);_0xc32493[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0xc32493[_0x259f('0x28')],_0xc32493['query']);_0x47bf1e[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0xc32493['model'],qs[_0x259f('0x2e')](_0x4c339b[_0x259f('0x29')][_0x259f('0x2e')]));_0x47bf1e[_0x259f('0x2d')]=_0x47bf1e[_0x259f('0x2d')][_0x259f('0x2f')]?_0x47bf1e[_0x259f('0x2d')]:_0xc32493[_0x259f('0x28')];if(!_0x4c339b[_0x259f('0x29')][_0x259f('0x30')](_0x259f('0x31'))){_0x47bf1e[_0x259f('0x19')]=qs[_0x259f('0x19')](_0x4c339b[_0x259f('0x29')][_0x259f('0x19')]);_0x47bf1e['offset']=qs[_0x259f('0x17')](_0x4c339b[_0x259f('0x29')][_0x259f('0x17')]);}_0x47bf1e[_0x259f('0x32')]=qs['sort'](_0x4c339b[_0x259f('0x29')][_0x259f('0x33')]);_0x47bf1e['where']=qs[_0x259f('0x2b')](_['pick'](_0x4c339b[_0x259f('0x29')],_0xc32493['filters']),_0x535b48);if(_0x4c339b['query']['filter']){_0x47bf1e[_0x259f('0x34')]=_['merge'](_0x47bf1e[_0x259f('0x34')],{'$or':_['map'](_0x535b48,function(_0x2732ea){if(_0x2732ea[_0x259f('0x35')]!==_0x259f('0x36')){var _0x1cd5c5={};_0x1cd5c5[_0x2732ea[_0x259f('0x21')]]={'$like':'%'+_0x4c339b[_0x259f('0x29')][_0x259f('0x37')]+'%'};return _0x1cd5c5;}})});}_0x47bf1e=_[_0x259f('0x38')]({},_0x47bf1e,_0x4c339b[_0x259f('0x39')]);var _0x122026={'where':_0x47bf1e[_0x259f('0x34')]};return db['DeskField']['count'](_0x122026)['then'](function(_0x3d402a){_0x14aef7[_0x259f('0x1a')]=_0x3d402a;if(_0x4c339b[_0x259f('0x29')][_0x259f('0x3a')]){_0x47bf1e[_0x259f('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0x259f('0x3c')](_0x47bf1e);})[_0x259f('0x1d')](function(_0x5542a1){_0x14aef7[_0x259f('0x3d')]=_0x5542a1;return _0x14aef7;})[_0x259f('0x1d')](respondWithFilteredResult(_0x341635,_0x47bf1e))[_0x259f('0x3e')](handleError(_0x341635,null));};exports[_0x259f('0x3f')]=function(_0x4a01a8,_0xdc25a4){var _0x5ea1e3={'raw':!![],'where':{'id':_0x4a01a8['params']['id']}},_0x45774b={};_0x45774b[_0x259f('0x28')]=_['keys'](db[_0x259f('0x24')][_0x259f('0x25')]);_0x45774b[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4a01a8[_0x259f('0x29')]);_0x45774b[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0x45774b['model'],_0x45774b[_0x259f('0x29')]);_0x5ea1e3[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0x45774b[_0x259f('0x28')],qs[_0x259f('0x2e')](_0x4a01a8[_0x259f('0x29')]['fields']));_0x5ea1e3[_0x259f('0x2d')]=_0x5ea1e3[_0x259f('0x2d')][_0x259f('0x2f')]?_0x5ea1e3[_0x259f('0x2d')]:_0x45774b[_0x259f('0x28')];if(_0x4a01a8['query'][_0x259f('0x3a')]){_0x5ea1e3[_0x259f('0x3b')]=[{'all':!![]}];}_0x5ea1e3=_['merge']({},_0x5ea1e3,_0x4a01a8[_0x259f('0x39')]);return db[_0x259f('0x24')][_0x259f('0x40')](_0x5ea1e3)['then'](handleEntityNotFound(_0xdc25a4,null))[_0x259f('0x1d')](respondWithResult(_0xdc25a4,null))['catch'](handleError(_0xdc25a4,null));};exports['create']=function(_0xe4ff,_0x114461){return db[_0x259f('0x24')][_0x259f('0x41')](_0xe4ff[_0x259f('0x42')],{})['then'](respondWithResult(_0x114461,0xc9))[_0x259f('0x3e')](handleError(_0x114461,null));};exports['update']=function(_0x4f8446,_0x12bef4){if(_0x4f8446[_0x259f('0x42')]['id']){delete _0x4f8446[_0x259f('0x42')]['id'];}return db[_0x259f('0x24')][_0x259f('0x40')]({'where':{'id':_0x4f8446[_0x259f('0x43')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x12bef4,null))[_0x259f('0x1d')](saveUpdates(_0x4f8446[_0x259f('0x42')],null))[_0x259f('0x1d')](respondWithResult(_0x12bef4,null))[_0x259f('0x3e')](handleError(_0x12bef4,null));};exports['destroy']=function(_0x111ba5,_0x521a42){return db['DeskField']['find']({'where':{'id':_0x111ba5[_0x259f('0x43')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x521a42,null))[_0x259f('0x1d')](removeEntity(_0x521a42,null))[_0x259f('0x3e')](handleError(_0x521a42,null));}; \ No newline at end of file +var _0xf072=['DeskField','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','name','send','index','map','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length'];(function(_0x493c7d,_0x4cf33a){var _0x29c39e=function(_0x4d691e){while(--_0x4d691e){_0x493c7d['push'](_0x493c7d['shift']());}};_0x29c39e(++_0x4cf33a);}(_0xf072,0x131));var _0x2f07=function(_0x384280,_0x4a4861){_0x384280=_0x384280-0x0;var _0x318a8d=_0xf072[_0x384280];return _0x318a8d;};'use strict';var emlformat=require(_0x2f07('0x0'));var rimraf=require(_0x2f07('0x1'));var zipdir=require(_0x2f07('0x2'));var jsonpatch=require(_0x2f07('0x3'));var rp=require('request-promise');var moment=require(_0x2f07('0x4'));var BPromise=require(_0x2f07('0x5'));var Mustache=require('mustache');var util=require(_0x2f07('0x6'));var path=require(_0x2f07('0x7'));var sox=require('sox');var csv=require(_0x2f07('0x8'));var ejs=require(_0x2f07('0x9'));var fs=require('fs');var fs_extra=require(_0x2f07('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2f07('0xb'));var deskjs=require(_0x2f07('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2f07('0xd'));var Papa=require('papaparse');var Redis=require(_0x2f07('0xe'));var authService=require(_0x2f07('0xf'));var qs=require(_0x2f07('0x10'));var as=require(_0x2f07('0x11'));var hardwareService=require(_0x2f07('0x12'));var logger=require(_0x2f07('0x13'))(_0x2f07('0x14'));var utils=require('../../config/utils');var config=require(_0x2f07('0x15'));var licenseUtil=require(_0x2f07('0x16'));var db=require(_0x2f07('0x17'))['db'];function respondWithStatusCode(_0x4e09aa,_0x267a57){_0x267a57=_0x267a57||0xcc;return function(_0x45e044){if(_0x45e044){return _0x4e09aa['sendStatus'](_0x267a57);}return _0x4e09aa['status'](_0x267a57)['end']();};}function respondWithResult(_0x46a4b7,_0x519ed4){_0x519ed4=_0x519ed4||0xc8;return function(_0x1050b8){if(_0x1050b8){return _0x46a4b7[_0x2f07('0x18')](_0x519ed4)[_0x2f07('0x19')](_0x1050b8);}};}function respondWithFilteredResult(_0x5c44b6,_0x3a7ab7){return function(_0x216f8b){if(_0x216f8b){var _0x3fe8ba=typeof _0x3a7ab7[_0x2f07('0x1a')]===_0x2f07('0x1b')&&typeof _0x3a7ab7[_0x2f07('0x1c')]==='undefined';var _0x59554a=_0x216f8b['count'];var _0x485c60=_0x3fe8ba?0x0:_0x3a7ab7[_0x2f07('0x1a')];var _0x2caded=_0x3fe8ba?_0x216f8b[_0x2f07('0x1d')]:_0x3a7ab7[_0x2f07('0x1a')]+_0x3a7ab7[_0x2f07('0x1c')];var _0x1169b0;if(_0x2caded>=_0x59554a){_0x2caded=_0x59554a;_0x1169b0=0xc8;}else{_0x1169b0=0xce;}_0x5c44b6[_0x2f07('0x18')](_0x1169b0);return _0x5c44b6[_0x2f07('0x1e')](_0x2f07('0x1f'),_0x485c60+'-'+_0x2caded+'/'+_0x59554a)[_0x2f07('0x19')](_0x216f8b);}return null;};}function patchUpdates(_0x41c62f){return function(_0x16b0d5){try{jsonpatch[_0x2f07('0x20')](_0x16b0d5,_0x41c62f,!![]);}catch(_0x2bc0dc){return BPromise[_0x2f07('0x21')](_0x2bc0dc);}return _0x16b0d5[_0x2f07('0x22')]();};}function saveUpdates(_0x4dfb26,_0x52b95c){return function(_0x3048f8){if(_0x3048f8){return _0x3048f8['update'](_0x4dfb26)['then'](function(_0x197647){return _0x197647;});}return null;};}function removeEntity(_0x220c43,_0x3e71fb){return function(_0x15748e){if(_0x15748e){return _0x15748e[_0x2f07('0x23')]()[_0x2f07('0x24')](function(){_0x220c43[_0x2f07('0x18')](0xcc)[_0x2f07('0x25')]();});}};}function handleEntityNotFound(_0x40d8ea,_0x1e78b3){return function(_0xf75c29){if(!_0xf75c29){_0x40d8ea[_0x2f07('0x26')](0x194);}return _0xf75c29;};}function handleError(_0x2452ae,_0x5f0bcb){_0x5f0bcb=_0x5f0bcb||0x1f4;return function(_0x3055d4){logger[_0x2f07('0x27')](_0x3055d4['stack']);if(_0x3055d4['name']){delete _0x3055d4[_0x2f07('0x28')];}_0x2452ae[_0x2f07('0x18')](_0x5f0bcb)[_0x2f07('0x29')](_0x3055d4);};}exports[_0x2f07('0x2a')]=function(_0xef6142,_0x57b5ec){var _0x5af773={},_0x244b06={},_0x3d67f2={'count':0x0,'rows':[]};var _0x3f6525=_[_0x2f07('0x2b')](db['DeskField']['rawAttributes'],function(_0x40e47e){return{'name':_0x40e47e[_0x2f07('0x2c')],'type':_0x40e47e['type'][_0x2f07('0x2d')]};});_0x244b06['model']=_[_0x2f07('0x2b')](_0x3f6525,_0x2f07('0x28'));_0x244b06[_0x2f07('0x2e')]=_['keys'](_0xef6142['query']);_0x244b06[_0x2f07('0x2f')]=_[_0x2f07('0x30')](_0x244b06[_0x2f07('0x31')],_0x244b06['query']);_0x5af773[_0x2f07('0x32')]=_[_0x2f07('0x30')](_0x244b06['model'],qs['fields'](_0xef6142['query'][_0x2f07('0x33')]));_0x5af773[_0x2f07('0x32')]=_0x5af773[_0x2f07('0x32')]['length']?_0x5af773['attributes']:_0x244b06[_0x2f07('0x31')];if(!_0xef6142[_0x2f07('0x2e')][_0x2f07('0x34')](_0x2f07('0x35'))){_0x5af773[_0x2f07('0x1c')]=qs[_0x2f07('0x1c')](_0xef6142[_0x2f07('0x2e')][_0x2f07('0x1c')]);_0x5af773[_0x2f07('0x1a')]=qs['offset'](_0xef6142[_0x2f07('0x2e')][_0x2f07('0x1a')]);}_0x5af773['order']=qs['sort'](_0xef6142[_0x2f07('0x2e')][_0x2f07('0x36')]);_0x5af773['where']=qs[_0x2f07('0x2f')](_[_0x2f07('0x37')](_0xef6142[_0x2f07('0x2e')],_0x244b06[_0x2f07('0x2f')]),_0x3f6525);if(_0xef6142['query']['filter']){_0x5af773['where']=_[_0x2f07('0x38')](_0x5af773[_0x2f07('0x39')],{'$or':_[_0x2f07('0x2b')](_0x3f6525,function(_0x574b40){if(_0x574b40['type']!==_0x2f07('0x3a')){var _0x33254d={};_0x33254d[_0x574b40[_0x2f07('0x28')]]={'$like':'%'+_0xef6142[_0x2f07('0x2e')][_0x2f07('0x3b')]+'%'};return _0x33254d;}})});}_0x5af773=_[_0x2f07('0x38')]({},_0x5af773,_0xef6142[_0x2f07('0x3c')]);var _0x55fa53={'where':_0x5af773[_0x2f07('0x39')]};return db['DeskField'][_0x2f07('0x1d')](_0x55fa53)['then'](function(_0x373d7e){_0x3d67f2[_0x2f07('0x1d')]=_0x373d7e;if(_0xef6142[_0x2f07('0x2e')][_0x2f07('0x3d')]){_0x5af773[_0x2f07('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x2f07('0x3f')](_0x5af773);})[_0x2f07('0x24')](function(_0x50c880){_0x3d67f2[_0x2f07('0x40')]=_0x50c880;return _0x3d67f2;})['then'](respondWithFilteredResult(_0x57b5ec,_0x5af773))[_0x2f07('0x41')](handleError(_0x57b5ec,null));};exports[_0x2f07('0x42')]=function(_0x35ec68,_0x16bc65){var _0x59fb56={'raw':!![],'where':{'id':_0x35ec68['params']['id']}},_0x1f0de5={};_0x1f0de5[_0x2f07('0x31')]=_[_0x2f07('0x43')](db['DeskField'][_0x2f07('0x44')]);_0x1f0de5[_0x2f07('0x2e')]=_['keys'](_0x35ec68[_0x2f07('0x2e')]);_0x1f0de5[_0x2f07('0x2f')]=_[_0x2f07('0x30')](_0x1f0de5[_0x2f07('0x31')],_0x1f0de5['query']);_0x59fb56[_0x2f07('0x32')]=_['intersection'](_0x1f0de5[_0x2f07('0x31')],qs[_0x2f07('0x33')](_0x35ec68[_0x2f07('0x2e')][_0x2f07('0x33')]));_0x59fb56[_0x2f07('0x32')]=_0x59fb56[_0x2f07('0x32')][_0x2f07('0x45')]?_0x59fb56[_0x2f07('0x32')]:_0x1f0de5['model'];if(_0x35ec68[_0x2f07('0x2e')]['includeAll']){_0x59fb56['include']=[{'all':!![]}];}_0x59fb56=_['merge']({},_0x59fb56,_0x35ec68[_0x2f07('0x3c')]);return db[_0x2f07('0x46')]['find'](_0x59fb56)['then'](handleEntityNotFound(_0x16bc65,null))[_0x2f07('0x24')](respondWithResult(_0x16bc65,null))[_0x2f07('0x41')](handleError(_0x16bc65,null));};exports[_0x2f07('0x47')]=function(_0x46bc2f,_0x3f8da0){return db[_0x2f07('0x46')]['create'](_0x46bc2f[_0x2f07('0x48')],{})[_0x2f07('0x24')](respondWithResult(_0x3f8da0,0xc9))[_0x2f07('0x41')](handleError(_0x3f8da0,null));};exports[_0x2f07('0x49')]=function(_0x923741,_0x5cb432){if(_0x923741[_0x2f07('0x48')]['id']){delete _0x923741['body']['id'];}return db[_0x2f07('0x46')][_0x2f07('0x4a')]({'where':{'id':_0x923741['params']['id']}})[_0x2f07('0x24')](handleEntityNotFound(_0x5cb432,null))[_0x2f07('0x24')](saveUpdates(_0x923741[_0x2f07('0x48')],null))[_0x2f07('0x24')](respondWithResult(_0x5cb432,null))['catch'](handleError(_0x5cb432,null));};exports[_0x2f07('0x23')]=function(_0x539983,_0x3b35fc){return db['DeskField']['find']({'where':{'id':_0x539983['params']['id']}})[_0x2f07('0x24')](handleEntityNotFound(_0x3b35fc,null))[_0x2f07('0x24')](removeEntity(_0x3b35fc,null))[_0x2f07('0x41')](handleError(_0x3b35fc,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 05a4d2e..00074ea 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 _0x08c0=['request-promise','rimraf','exports','define','desk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x08c0,0x14b));var _0x008c=function(_0x461a32,_0xbcf717){_0x461a32=_0x461a32-0x0;var _0x54957f=_0x08c0[_0x461a32];return _0x54957f;};'use strict';var _=require(_0x008c('0x0'));var util=require(_0x008c('0x1'));var logger=require('../../config/logger')(_0x008c('0x2'));var moment=require(_0x008c('0x3'));var BPromise=require(_0x008c('0x4'));var rp=require(_0x008c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x008c('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x008c('0x7')]=function(_0x3fbb46,_0x328c9e){return _0x3fbb46[_0x008c('0x8')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x008c('0x9'),'fields':[_0x008c('0xa'),_0x008c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe569=['lodash','util','api','moment','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId'];(function(_0x135a38,_0x38bd33){var _0x47b5d0=function(_0x47dac2){while(--_0x47dac2){_0x135a38['push'](_0x135a38['shift']());}};_0x47b5d0(++_0x38bd33);}(_0xe569,0xf7));var _0x9e56=function(_0x18c6cd,_0x3d50d2){_0x18c6cd=_0x18c6cd-0x0;var _0x450f8b=_0xe569[_0x18c6cd];return _0x450f8b;};'use strict';var _=require(_0x9e56('0x0'));var util=require(_0x9e56('0x1'));var logger=require('../../config/logger')(_0x9e56('0x2'));var moment=require(_0x9e56('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e56('0x4'));var rimraf=require(_0x9e56('0x5'));var config=require(_0x9e56('0x6'));var attributes=require(_0x9e56('0x7'));module[_0x9e56('0x8')]=function(_0x48df5b,_0x42e838){return _0x48df5b[_0x9e56('0x9')]('DeskField',attributes,{'tableName':_0x9e56('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x9e56('0xb'),_0x9e56('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 5903117..5000cc4 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 _0xd6ce=['../../config/environment','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5dcd92,_0x1d29bd){var _0x106c3c=function(_0x2ee4e8){while(--_0x2ee4e8){_0x5dcd92['push'](_0x5dcd92['shift']());}};_0x106c3c(++_0x1d29bd);}(_0xd6ce,0xca));var _0xed6c=function(_0x28b887,_0x48b841){_0x28b887=_0x28b887-0x0;var _0x1e3629=_0xd6ce[_0x28b887];return _0x1e3629;};'use strict';var _=require('lodash');var util=require(_0xed6c('0x0'));var moment=require(_0xed6c('0x1'));var BPromise=require(_0xed6c('0x2'));var rs=require(_0xed6c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed6c('0x4'))['db'];var utils=require(_0xed6c('0x5'));var logger=require(_0xed6c('0x6'))(_0xed6c('0x7'));var config=require(_0xed6c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b87f3,_0x51b922,_0x3ade41){return new BPromise(function(_0x218030,_0x26fea9){return client[_0xed6c('0xa')](_0x5b87f3,_0x3ade41)[_0xed6c('0xb')](function(_0x210419){logger[_0xed6c('0xc')](_0xed6c('0xd'),_0x51b922,'request\x20sent');logger['debug'](_0xed6c('0xe'),_0x51b922,_0xed6c('0xf'),JSON[_0xed6c('0x10')](_0x210419));if(_0x210419['error']){if(_0x210419[_0xed6c('0x11')]['code']===0x1f4){logger[_0xed6c('0x11')](_0xed6c('0xd'),_0x51b922,_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);return _0x26fea9(_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);}logger[_0xed6c('0x11')]('DeskField,\x20%s,\x20%s',_0x51b922,_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);return _0x218030(_0x210419[_0xed6c('0x11')][_0xed6c('0x12')]);}else{logger[_0xed6c('0xc')](_0xed6c('0xd'),_0x51b922,_0xed6c('0xf'));_0x218030(_0x210419[_0xed6c('0x13')]['message']);}})[_0xed6c('0x14')](function(_0x21c568){logger[_0xed6c('0x11')](_0xed6c('0xd'),_0x51b922,_0x21c568);_0x26fea9(_0x21c568);});});} \ No newline at end of file +var _0x7f1e=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x588f2b,_0x1a4cac){var _0x2aaaba=function(_0x31ee7e){while(--_0x31ee7e){_0x588f2b['push'](_0x588f2b['shift']());}};_0x2aaaba(++_0x1a4cac);}(_0x7f1e,0xfe));var _0xe7f1=function(_0x56a45f,_0xa0a0aa){_0x56a45f=_0x56a45f-0x0;var _0x337b59=_0x7f1e[_0x56a45f];return _0x337b59;};'use strict';var _=require('lodash');var util=require(_0xe7f1('0x0'));var moment=require(_0xe7f1('0x1'));var BPromise=require(_0xe7f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7f1('0x3'));var db=require(_0xe7f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7f1('0x5'))(_0xe7f1('0x6'));var config=require('../../config/environment');var jayson=require(_0xe7f1('0x7'));var client=jayson[_0xe7f1('0x8')][_0xe7f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11a20b,_0x5b1123,_0x2d8721){return new BPromise(function(_0x5610b9,_0x4bef94){return client[_0xe7f1('0xa')](_0x11a20b,_0x2d8721)['then'](function(_0xbdba75){logger[_0xe7f1('0xb')](_0xe7f1('0xc'),_0x5b1123,'request\x20sent');logger[_0xe7f1('0xd')](_0xe7f1('0xe'),_0x5b1123,_0xe7f1('0xf'),JSON['stringify'](_0xbdba75));if(_0xbdba75[_0xe7f1('0x10')]){if(_0xbdba75['error'][_0xe7f1('0x11')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x5b1123,_0xbdba75[_0xe7f1('0x10')]['message']);return _0x4bef94(_0xbdba75['error'][_0xe7f1('0x12')]);}logger['error'](_0xe7f1('0xc'),_0x5b1123,_0xbdba75[_0xe7f1('0x10')][_0xe7f1('0x12')]);return _0x5610b9(_0xbdba75[_0xe7f1('0x10')][_0xe7f1('0x12')]);}else{logger[_0xe7f1('0xb')](_0xe7f1('0xc'),_0x5b1123,_0xe7f1('0xf'));_0x5610b9(_0xbdba75[_0xe7f1('0x13')][_0xe7f1('0x12')]);}})[_0xe7f1('0x14')](function(_0xa884f1){logger[_0xe7f1('0x10')](_0xe7f1('0xc'),_0x5b1123,_0xa884f1);_0x4bef94(_0xa884f1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d01c6d8..f2e102a 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 _0x3c6c=['./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3c6c,0x116));var _0xc3c6=function(_0x37d228,_0x47cffa){_0x37d228=_0x37d228-0x0;var _0x9e8635=_0x3c6c[_0x37d228];return _0x9e8635;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require(_0xc3c6('0x1'));var path=require('path');var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc3c6('0x5'));var interaction=require(_0xc3c6('0x6'));var config=require(_0xc3c6('0x7'));var controller=require(_0xc3c6('0x8'));router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xd')]);router['get'](_0xc3c6('0xe'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xf')]);router[_0xc3c6('0x9')](_0xc3c6('0x10'),auth[_0xc3c6('0xc')](),controller['getFields']);router[_0xc3c6('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc3c6('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc3c6('0x12')]);router[_0xc3c6('0x13')](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x14')]);module[_0xc3c6('0x15')]=router; \ No newline at end of file +var _0xfc62=['addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create'];(function(_0x4dba1e,_0x50406b){var _0x19521c=function(_0x21b9a3){while(--_0x21b9a3){_0x4dba1e['push'](_0x4dba1e['shift']());}};_0x19521c(++_0x50406b);}(_0xfc62,0x18b));var _0x2fc6=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xfc62[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x2fc6('0x0'));var util=require(_0x2fc6('0x1'));var path=require(_0x2fc6('0x2'));var timeout=require(_0x2fc6('0x3'));var express=require(_0x2fc6('0x4'));var router=express[_0x2fc6('0x5')]();var fs_extra=require(_0x2fc6('0x6'));var auth=require(_0x2fc6('0x7'));var interaction=require(_0x2fc6('0x8'));var config=require(_0x2fc6('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x2fc6('0xa')](),controller[_0x2fc6('0xb')]);router['get'](_0x2fc6('0xc'),auth[_0x2fc6('0xa')](),controller[_0x2fc6('0xd')]);router['get'](_0x2fc6('0xe'),auth[_0x2fc6('0xa')](),controller[_0x2fc6('0xf')]);router['get']('/:id/fields',auth[_0x2fc6('0xa')](),controller[_0x2fc6('0x10')]);router[_0x2fc6('0x11')]('/',auth['isAuthenticated'](),controller[_0x2fc6('0x12')]);router[_0x2fc6('0x11')](_0x2fc6('0xe'),auth[_0x2fc6('0xa')](),controller[_0x2fc6('0x13')]);router[_0x2fc6('0x14')](_0x2fc6('0xc'),auth[_0x2fc6('0xa')](),controller[_0x2fc6('0x15')]);router[_0x2fc6('0x16')](_0x2fc6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index df4c74e..bea83e5 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 _0xd5da=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5887ce,_0x1bfde4){var _0x453dc1=function(_0xb7c6ce){while(--_0xb7c6ce){_0x5887ce['push'](_0x5887ce['shift']());}};_0x453dc1(++_0x1bfde4);}(_0xd5da,0x9f));var _0xad5d=function(_0x54a392,_0x28d6e2){_0x54a392=_0x54a392-0x0;var _0x4d9ed2=_0xd5da[_0x54a392];return _0x4d9ed2;};'use strict';var Sequelize=require(_0xad5d('0x0'));module[_0xad5d('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xad5d('0x2')]},'password':{'type':Sequelize[_0xad5d('0x2')]},'remoteUri':{'type':Sequelize[_0xad5d('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad5d('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xad5d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xad5d('0x2')]},'modernAuthentication':{'type':Sequelize[_0xad5d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaa5c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x5279fc,_0x5c82e4){_0x5279fc=_0x5279fc-0x0;var _0x277e61=_0xaa5c[_0x5279fc];return _0x277e61;};'use strict';var Sequelize=require(_0xcaa5('0x0'));module[_0xcaa5('0x1')]={'name':{'type':Sequelize[_0xcaa5('0x2')]},'username':{'type':Sequelize[_0xcaa5('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xcaa5('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xcaa5('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 35f8c57..f7025b5 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 _0x5433=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','find','create','catch','update','body','params','findOne','Dynamics365Configuration','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','forEach','@odata.type','substring','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','error','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x5433,0x9f));var _0x3543=function(_0x5ba27d,_0x7cd8be){_0x5ba27d=_0x5ba27d-0x0;var _0x15fca1=_0x5433[_0x5ba27d];return _0x15fca1;};'use strict';var rp=require(_0x3543('0x0'));var util=require(_0x3543('0x1'));var _=require(_0x3543('0x2'));var qs=require(_0x3543('0x3'));var logger=require(_0x3543('0x4'))(_0x3543('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3543('0x6'));function respondWithResult(_0x25b3bc,_0x50e695){_0x50e695=_0x50e695||0xc8;return function(_0x4a111b){if(_0x4a111b){return _0x25b3bc[_0x3543('0x7')](_0x50e695)[_0x3543('0x8')](_0x4a111b);}};}function respondWithFilteredResult(_0x174902,_0x34abfe){return function(_0x5e8b5d){if(_0x5e8b5d){var _0x24794a=typeof _0x34abfe[_0x3543('0x9')]==='undefined'&&typeof _0x34abfe[_0x3543('0xa')]===_0x3543('0xb');var _0x382389=_0x5e8b5d[_0x3543('0xc')];var _0x5316a2=_0x24794a?0x0:_0x34abfe[_0x3543('0x9')];var _0x5b097f=_0x24794a?_0x5e8b5d[_0x3543('0xc')]:_0x34abfe[_0x3543('0x9')]+_0x34abfe[_0x3543('0xa')];var _0x1da35c;if(_0x5b097f>=_0x382389){_0x5b097f=_0x382389;_0x1da35c=0xc8;}else{_0x1da35c=0xce;}_0x174902[_0x3543('0x7')](_0x1da35c);return _0x174902[_0x3543('0xd')](_0x3543('0xe'),_0x5316a2+'-'+_0x5b097f+'/'+_0x382389)['json'](_0x5e8b5d);}return null;};}function saveUpdates(_0x519093){return function(_0x435b1f){if(_0x435b1f){return _0x435b1f['update'](_0x519093)[_0x3543('0xf')](function(_0xfc8986){return _0xfc8986;});}return null;};}function removeEntity(_0x2b981b){return function(_0x589823){if(_0x589823){return _0x589823[_0x3543('0x10')]()['then'](function(){_0x2b981b[_0x3543('0x7')](0xcc)[_0x3543('0x11')]();});}};}function handleEntityNotFound(_0xc9c970){return function(_0x1a1f7d){if(!_0x1a1f7d){_0xc9c970['sendStatus'](0x194);}return _0x1a1f7d;};}function handleError(_0x545e65,_0x39b8f2){_0x39b8f2=_0x39b8f2||0x1f4;return function(_0xb315bb){logger['error'](_0xb315bb[_0x3543('0x12')]);if(_0xb315bb[_0x3543('0x13')]){delete _0xb315bb[_0x3543('0x13')];}_0x545e65[_0x3543('0x7')](_0x39b8f2)['send'](_0xb315bb);};}exports[_0x3543('0x14')]=function(_0x50480b,_0x97a8ba){var _0x12eb8b={},_0x52794d={},_0xbf94f6={'count':0x0,'rows':[]};var _0x325ac6=_[_0x3543('0x15')](db[_0x3543('0x16')][_0x3543('0x17')],function(_0x33f065){return{'name':_0x33f065[_0x3543('0x18')],'type':_0x33f065[_0x3543('0x19')]['key']};});_0x52794d[_0x3543('0x1a')]=_[_0x3543('0x15')](_0x325ac6,'name');_0x52794d[_0x3543('0x1b')]=_[_0x3543('0x1c')](_0x50480b[_0x3543('0x1b')]);_0x52794d[_0x3543('0x1d')]=_[_0x3543('0x1e')](_0x52794d['model'],_0x52794d[_0x3543('0x1b')]);_0x12eb8b[_0x3543('0x1f')]=_[_0x3543('0x1e')](_0x52794d[_0x3543('0x1a')],qs['fields'](_0x50480b[_0x3543('0x1b')][_0x3543('0x20')]));_0x12eb8b[_0x3543('0x1f')]=_0x12eb8b[_0x3543('0x1f')][_0x3543('0x21')]?_0x12eb8b['attributes']:_0x52794d[_0x3543('0x1a')];if(!_0x50480b[_0x3543('0x1b')][_0x3543('0x22')](_0x3543('0x23'))){_0x12eb8b['limit']=qs['limit'](_0x50480b[_0x3543('0x1b')]['limit']);_0x12eb8b[_0x3543('0x9')]=qs['offset'](_0x50480b['query'][_0x3543('0x9')]);}_0x12eb8b[_0x3543('0x24')]=qs[_0x3543('0x25')](_0x50480b['query'][_0x3543('0x25')]);_0x12eb8b[_0x3543('0x26')]=qs[_0x3543('0x1d')](_[_0x3543('0x27')](_0x50480b[_0x3543('0x1b')],_0x52794d[_0x3543('0x1d')]),_0x325ac6);if(_0x50480b[_0x3543('0x1b')][_0x3543('0x28')]){_0x12eb8b[_0x3543('0x26')]=_['merge'](_0x12eb8b['where'],{'$or':_[_0x3543('0x15')](_0x325ac6,function(_0x3a8522){if(_0x3a8522[_0x3543('0x19')]!==_0x3543('0x29')){var _0x282b58={};_0x282b58[_0x3a8522[_0x3543('0x13')]]={'$like':'%'+_0x50480b[_0x3543('0x1b')][_0x3543('0x28')]+'%'};return _0x282b58;}})});}_0x12eb8b=_[_0x3543('0x2a')]({},_0x12eb8b,_0x50480b[_0x3543('0x2b')]);var _0x326395={'where':_0x12eb8b[_0x3543('0x26')]};return db[_0x3543('0x16')][_0x3543('0xc')](_0x326395)[_0x3543('0xf')](function(_0x164ef8){_0xbf94f6[_0x3543('0xc')]=_0x164ef8;if(_0x50480b[_0x3543('0x1b')]['includeAll']){_0x12eb8b[_0x3543('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3543('0x2d')](_0x12eb8b);})[_0x3543('0xf')](function(_0x225bc2){_0xbf94f6[_0x3543('0x2e')]=_0x225bc2;return _0xbf94f6;})[_0x3543('0xf')](respondWithFilteredResult(_0x97a8ba,_0x12eb8b))['catch'](handleError(_0x97a8ba,null));};exports[_0x3543('0x2f')]=function(_0x52a302,_0x4d7c8){var _0x32cbe2={'raw':![],'where':{'id':_0x52a302['params']['id']}},_0x462b45={};_0x462b45[_0x3543('0x1a')]=_[_0x3543('0x1c')](db[_0x3543('0x16')][_0x3543('0x17')]);_0x462b45['query']=_[_0x3543('0x1c')](_0x52a302['query']);_0x462b45[_0x3543('0x1d')]=_['intersection'](_0x462b45['model'],_0x462b45['query']);_0x32cbe2[_0x3543('0x1f')]=_[_0x3543('0x1e')](_0x462b45['model'],qs[_0x3543('0x20')](_0x52a302[_0x3543('0x1b')]['fields']));_0x32cbe2['attributes']=_0x32cbe2['attributes'][_0x3543('0x21')]?_0x32cbe2[_0x3543('0x1f')]:_0x462b45['model'];if(_0x52a302['query'][_0x3543('0x30')]){_0x32cbe2[_0x3543('0x2c')]=[{'all':!![]}];}_0x32cbe2=_['merge']({},_0x32cbe2,_0x52a302['options']);return db[_0x3543('0x16')][_0x3543('0x31')](_0x32cbe2)[_0x3543('0xf')](handleEntityNotFound(_0x4d7c8,null))[_0x3543('0xf')](respondWithResult(_0x4d7c8,null))['catch'](handleError(_0x4d7c8,null));};exports['create']=function(_0x5c47bb,_0x478405){return db[_0x3543('0x16')][_0x3543('0x32')](_0x5c47bb['body'],{})['then'](respondWithResult(_0x478405,0xc9))[_0x3543('0x33')](handleError(_0x478405,null));};exports[_0x3543('0x34')]=function(_0x300fae,_0x76417a){if(_0x300fae[_0x3543('0x35')]['id']){delete _0x300fae[_0x3543('0x35')]['id'];}return db[_0x3543('0x16')][_0x3543('0x31')]({'where':{'id':_0x300fae[_0x3543('0x36')]['id']}})[_0x3543('0xf')](handleEntityNotFound(_0x76417a,null))[_0x3543('0xf')](saveUpdates(_0x300fae['body'],null))[_0x3543('0xf')](respondWithResult(_0x76417a,null))[_0x3543('0x33')](handleError(_0x76417a,null));};exports[_0x3543('0x10')]=function(_0x2b89e4,_0x39afb6){return db[_0x3543('0x16')][_0x3543('0x31')]({'where':{'id':_0x2b89e4[_0x3543('0x36')]['id']}})['then'](handleEntityNotFound(_0x39afb6,null))[_0x3543('0xf')](removeEntity(_0x39afb6,null))[_0x3543('0x33')](handleError(_0x39afb6,null));};exports['getConfigurations']=function(_0x4c7ce6,_0x561141){var _0x2f9b44={};var _0x5b7b83={};var _0x5dc169;var _0x20aa2d;return db[_0x3543('0x16')][_0x3543('0x37')]({'where':{'id':_0x4c7ce6[_0x3543('0x36')]['id']}})[_0x3543('0xf')](handleEntityNotFound(_0x561141,null))['then'](function(_0x50736c){if(_0x50736c){_0x5dc169=_0x50736c;_0x5b7b83['model']=_[_0x3543('0x1c')](db[_0x3543('0x38')][_0x3543('0x17')]);_0x5b7b83[_0x3543('0x1b')]=_[_0x3543('0x1c')](_0x4c7ce6[_0x3543('0x1b')]);_0x5b7b83['filters']=_[_0x3543('0x1e')](_0x5b7b83['model'],_0x5b7b83[_0x3543('0x1b')]);_0x2f9b44['attributes']=_[_0x3543('0x1e')](_0x5b7b83[_0x3543('0x1a')],qs[_0x3543('0x20')](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x20')]));_0x2f9b44[_0x3543('0x1f')]=_0x2f9b44[_0x3543('0x1f')][_0x3543('0x21')]?_0x2f9b44[_0x3543('0x1f')]:_0x5b7b83['model'];_0x2f9b44[_0x3543('0x24')]=qs['sort'](_0x4c7ce6[_0x3543('0x1b')]['sort']);_0x2f9b44['where']=qs['filters'](_[_0x3543('0x27')](_0x4c7ce6[_0x3543('0x1b')],_0x5b7b83[_0x3543('0x1d')]));if(_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x28')]){_0x2f9b44[_0x3543('0x26')]=_[_0x3543('0x2a')](_0x2f9b44[_0x3543('0x26')],{'$or':_[_0x3543('0x15')](_0x2f9b44[_0x3543('0x1f')],function(_0x527427){var _0x33a474={};_0x33a474[_0x527427]={'$like':'%'+_0x4c7ce6['query'][_0x3543('0x28')]+'%'};return _0x33a474;})});}_0x2f9b44=_[_0x3543('0x2a')]({},_0x2f9b44,_0x4c7ce6[_0x3543('0x2b')]);return _0x5dc169[_0x3543('0x39')](_0x2f9b44);}})[_0x3543('0xf')](function(_0x5d67c3){if(_0x5d67c3){_0x20aa2d=_0x5d67c3[_0x3543('0x21')];if(!_0x4c7ce6[_0x3543('0x1b')]['hasOwnProperty'](_0x3543('0x23'))){_0x2f9b44['limit']=qs['limit'](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0xa')]);_0x2f9b44[_0x3543('0x9')]=qs[_0x3543('0x9')](_0x4c7ce6[_0x3543('0x1b')][_0x3543('0x9')]);}return _0x5dc169[_0x3543('0x39')](_0x2f9b44);}})['then'](function(_0x4fc5cc){if(_0x4fc5cc){return _0x4fc5cc?{'count':_0x20aa2d,'rows':_0x4fc5cc}:null;}})[_0x3543('0xf')](respondWithResult(_0x561141,null))[_0x3543('0x33')](handleError(_0x561141,null));};exports['addConfiguration']=function(_0x5738d8,_0x45e291){if(_0x5738d8['body']['id']){delete _0x5738d8['body']['id'];}return db[_0x3543('0x16')][_0x3543('0x37')]({'where':{'id':_0x5738d8['params']['id']}})['then'](handleEntityNotFound(_0x45e291,null))[_0x3543('0xf')](function(_0x20dd04){if(_0x20dd04){_0x5738d8['body'][_0x3543('0x3a')]=_0x20dd04['id'];_0x5738d8[_0x3543('0x35')][_0x3543('0x3b')]=integrations['getSubjects'](_0x5738d8['body'][_0x3543('0x3c')],_0x5738d8[_0x3543('0x35')]['type']);_0x5738d8[_0x3543('0x35')][_0x3543('0x3d')]=integrations[_0x3543('0x3e')](_0x5738d8[_0x3543('0x35')][_0x3543('0x3c')],_0x5738d8['body'][_0x3543('0x19')]);return db['Dynamics365Configuration']['create'](_0x5738d8[_0x3543('0x35')],{'include':[{'model':db[_0x3543('0x3f')],'as':_0x3543('0x3b')},{'model':db[_0x3543('0x3f')],'as':'Descriptions'}]});}return null;})[_0x3543('0xf')](respondWithResult(_0x45e291,null))[_0x3543('0x33')](handleError(_0x45e291,null));};function sanitizeRemoteUri(_0x45ae19){var _0xd70658=_0x45ae19[_0x3543('0x40')](-0x1);if(_0xd70658==='/')return _0x45ae19['substring'](0x0,_0x45ae19[_0x3543('0x41')](_0xd70658));return _0x45ae19;}function getWebApiUrl(_0x150f0f){return util[_0x3543('0x42')](_0x3543('0x43'),_0x150f0f);}exports[_0x3543('0x44')]=function(_0x49755a,_0x4a6e10){var _0x844aea=_0x49755a[_0x3543('0x1b')][_0x3543('0x45')];var _0x2c9602=_0x844aea==='incident'?_0x3543('0x46'):'PhoneCall';var _0x2c6581='';var _0x16e304='';var _0x30f50e='';var _0x626193='';var _0x188d49='';var _0x39a64d='';var _0x3bd391='';var _0x1621ad='';var _0x57f676=[_0x3543('0x47'),_0x3543('0x48'),_0x3543('0x49'),_0x3543('0x4a'),_0x3543('0x4b'),_0x3543('0x4c'),'phonenumber',_0x3543('0x4d'),'directioncode',_0x3543('0x4e')];var _0x33b17a=[_0x3543('0x4f'),_0x3543('0x50'),_0x3543('0x51'),_0x3543('0x52'),_0x3543('0x53'),_0x3543('0x54'),_0x3543('0x55'),_0x3543('0x56'),'createdbyexternalpartyname',_0x3543('0x57'),'createdbyname',_0x3543('0x58'),'createdon',_0x3543('0x59'),_0x3543('0x5a'),_0x3543('0x5b'),'customeridtype',_0x3543('0x5c'),_0x3543('0x5d'),'entitlementidname',_0x3543('0x5e'),_0x3543('0x5f'),_0x3543('0x60'),_0x3543('0x61'),_0x3543('0x62'),_0x3543('0x63'),'importsequencenumber',_0x3543('0x64'),_0x3543('0x65'),'lastonholdtime',_0x3543('0x66'),_0x3543('0x67'),_0x3543('0x68'),_0x3543('0x69'),_0x3543('0x6a'),'modifiedon',_0x3543('0x6b'),_0x3543('0x6c'),_0x3543('0x6d'),_0x3543('0x6e'),'numberofchildincidents',_0x3543('0x6f'),_0x3543('0x70'),_0x3543('0x71'),_0x3543('0x72'),_0x3543('0x73'),'parentcaseidname',_0x3543('0x74'),_0x3543('0x75'),'prioritycodename',_0x3543('0x76'),_0x3543('0x77'),_0x3543('0x78'),_0x3543('0x79'),_0x3543('0x7a'),_0x3543('0x7b'),_0x3543('0x7c'),_0x3543('0x7d'),'slainvokedidname',_0x3543('0x7e'),'socialprofileidname','statecode',_0x3543('0x7f'),_0x3543('0x80'),'ticketnumber',_0x3543('0x81'),'transactioncurrencyidname',_0x3543('0x82'),_0x3543('0x83'),'versionnumber'];var _0x5a3894=_0x57f676['concat'](_0x33b17a);return db['Dynamics365Account'][_0x3543('0x37')]({'where':{'id':_0x49755a['params']['id']},'attributes':['id',_0x3543('0x84'),_0x3543('0x85'),_0x3543('0x86'),_0x3543('0x87'),_0x3543('0x88'),_0x3543('0x89'),'modernAuthentication'],'include':[{'model':db[_0x3543('0x8a')],'as':_0x3543('0x8a'),'attributes':['id',_0x3543('0x8b'),'data7']}]})['then'](handleEntityNotFound(_0x4a6e10,null))[_0x3543('0xf')](function(_0x3d605d){if(_0x3d605d){if(_0x3d605d[_0x3543('0x8c')]){_0x3d605d[_0x3543('0x8d')]=_0x3d605d[_0x3543('0x8a')][_0x3543('0x8b')];_0x1621ad=sanitizeRemoteUri(_0x3d605d['CloudProvider'][_0x3543('0x8e')]);_0x3bd391=getWebApiUrl(_0x1621ad);return _0x3d605d;}_0x1621ad=sanitizeRemoteUri(_0x3d605d[_0x3543('0x86')]);_0x3bd391=getWebApiUrl(_0x1621ad);var _0x305728={'method':_0x3543('0x8f'),'uri':_0x3543('0x90')+_0x3d605d[_0x3543('0x87')]+_0x3543('0x91'),'form':{'client_id':_0x3d605d[_0x3543('0x88')],'resource':_0x1621ad,'username':_0x3d605d[_0x3543('0x84')],'password':_0x3d605d['password'],'grant_type':_0x3543('0x85'),'client_secret':_0x3d605d[_0x3543('0x89')]},'json':!![]};return rp(_0x305728);}})['then'](function(_0x32973b){_0x39a64d=_0x32973b[_0x3543('0x8d')];var _0x5c8958={'method':_0x3543('0x92'),'uri':encodeURI(_0x3bd391+_0x3543('0x93')+_0x2c9602+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x39a64d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c8958);})[_0x3543('0xf')](function(_0x2f76e0){var _0x142c2f=_0x2f76e0[_0x3543('0x94')][0x0];var _0x3dec45=_0x142c2f[_0x3543('0x95')];var _0x2fc627={'method':_0x3543('0x92'),'uri':_0x3bd391+'EntityDefinitions('+_0x3dec45+_0x3543('0x96'),'headers':{'Authorization':'Bearer\x20'+_0x39a64d,'If-None-Match':null,'OData-Version':_0x3543('0x97')},'json':!![]};return rp(_0x2fc627);})[_0x3543('0xf')](function(_0x236b43){_0x2c6581=_0x236b43;_0x16e304=_0x2c6581['Attributes'];_0x16e304=_[_0x3543('0x98')](_0x16e304,function(_0x1bbdd3){return!_0x5a3894['includes'](_0x1bbdd3['LogicalName']);});var _0x5681b1=[];var _0x21e4f9=[];_0x16e304[_0x3543('0x99')](function(_0x41e74b){if(_0x41e74b['@odata.type']){var _0x5ee8cf=_0x41e74b[_0x3543('0x9a')][_0x3543('0x9b')](_0x41e74b['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5ee8cf==='PicklistAttributeMetadata'){_0x5681b1[_0x3543('0x9c')](getSelectList(_0x3bd391,_0x844aea,_0x21e4f9,_0x2c6581[_0x3543('0x95')],_0x41e74b[_0x3543('0x95')],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x5681b1);})['then'](function(_0x13cf42){_0x30f50e=_0x13cf42[0x0];var _0x26cae6=[];var _0x338cb1=[];_0x16e304[_0x3543('0x99')](function(_0x3ad4b4){if(!_['isNil'](_0x3ad4b4['@odata.type'])){var _0x2a4f8f=_0x3ad4b4[_0x3543('0x9a')]['substring'](_0x3ad4b4[_0x3543('0x9a')][_0x3543('0x41')]('.')+0x1);if(_0x2a4f8f===_0x3543('0x9e')){_0x26cae6[_0x3543('0x9c')](getBooleanList(_0x3bd391,_0x844aea,_0x338cb1,_0x2c6581[_0x3543('0x95')],_0x3ad4b4['MetadataId'],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x26cae6);})[_0x3543('0xf')](function(_0x15b6e5){_0x626193=_0x15b6e5[0x0];var _0x272885=[];var _0x1445cc=[];_0x16e304[_0x3543('0x99')](function(_0x28dd46){if(_0x28dd46['@odata.type']){var _0x1e0bb5=_0x28dd46[_0x3543('0x9a')][_0x3543('0x9b')](_0x28dd46[_0x3543('0x9a')][_0x3543('0x41')]('.')+0x1);if(_0x1e0bb5===_0x3543('0x9f')||_0x1e0bb5===_0x3543('0xa0')||_0x1e0bb5===_0x3543('0xa1')||_0x1e0bb5==='IntegerAttributeMetadata'||_0x1e0bb5===_0x3543('0xa2')||_0x1e0bb5===_0x3543('0xa3')||_0x1e0bb5==='StatusAttributeMetadata'||_0x1e0bb5==='EntityNameAttributeMetadata'||_0x1e0bb5===_0x3543('0xa4')||_0x1e0bb5===_0x3543('0xa5')){_0x272885[_0x3543('0x9c')](getInputList(_0x3bd391,_0x844aea,_0x1e0bb5,_0x1445cc,_0x2c6581[_0x3543('0x95')],_0x28dd46[_0x3543('0x95')],_0x39a64d));}}});return Promise[_0x3543('0x9d')](_0x272885);})['then'](function(_0x3fe65c){_0x188d49=_0x3fe65c[0x0];var _0x4f4fcb=_0x30f50e[_0x3543('0xa6')](_0x626193)[_0x3543('0xa6')](_0x188d49);var _0x3881ff={'count':_0x4f4fcb[_0x3543('0x21')],'rows':_0x4f4fcb};return _0x3881ff;})[_0x3543('0xf')](respondWithResult(_0x4a6e10,null))[_0x3543('0x33')](function(_0x2410ff){var _0x4ec0b1=_0x49755a[_0x3543('0x1b')]['test']?0x1f4:_0x2410ff[_0x3543('0xa7')]||0x1f4;logger[_0x3543('0xa8')](_0x2410ff[_0x3543('0x12')]);delete _0x2410ff[_0x3543('0x13')];if(_0x4ec0b1===0x191){_0x4ec0b1=0x190;}_0x4a6e10['status'](_0x4ec0b1)[_0x3543('0xa9')](_0x49755a[_0x3543('0x1b')]['test']?{'message':_0x3543('0xaa'),'statusCode':_0x2410ff['statusCode']}:_0x2410ff);});};function getSelectList(_0x2d94c9,_0x50fc06,_0x4b4578,_0x140808,_0x103c54,_0x254e66){var _0x1c6c97={'method':_0x3543('0x92'),'uri':_0x2d94c9+_0x3543('0xab')+_0x140808+_0x3543('0xac')+_0x103c54+_0x3543('0xad')+_0x3543('0xae'),'headers':{'Authorization':_0x3543('0xaf')+_0x254e66,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c6c97)[_0x3543('0xf')](function(_0x40672c){var _0x2712b6=[];var _0xed25e4=_0x40672c['OptionSet'][_0x3543('0xb0')];_0xed25e4[_0x3543('0x99')](function(_0x1bd640){_0x2712b6['push']({'name':_0x1bd640['Label'][_0x3543('0xb1')][_0x3543('0xb2')],'value':String(_0x1bd640[_0x3543('0xb3')])});});var _0x4cc16d={'id':_0x50fc06+'_'+_0x40672c[_0x3543('0xb4')],'name':_0x40672c[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')],'custom':![],'options':_0x2712b6};_0x4b4578['push'](_0x4cc16d);return _0x4b4578;});}function getBooleanList(_0x390a02,_0x5b32ef,_0x5f285a,_0x54dda1,_0x4f6a52,_0x122858){var _0x46384e={'method':_0x3543('0x92'),'uri':_0x390a02+_0x3543('0xab')+_0x54dda1+')/Attributes('+_0x4f6a52+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x122858,'If-None-Match':null,'OData-Version':_0x3543('0x97')},'json':!![]};return rp(_0x46384e)[_0x3543('0xf')](function(_0x41c441){var _0x3d5467=[];_0x3d5467[_0x3543('0x9c')]({'name':_0x41c441[_0x3543('0xb6')][_0x3543('0xb7')][_0x3543('0xb2')]['UserLocalizedLabel']['Label'],'value':_0x3543('0xb8')},{'name':_0x41c441[_0x3543('0xb6')][_0x3543('0xb9')]['Label'][_0x3543('0xb1')][_0x3543('0xb2')],'value':_0x3543('0xba')});var _0x21a43d={'id':_0x5b32ef+'_'+_0x41c441['LogicalName'],'name':_0x41c441[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')],'custom':![],'options':_0x3d5467};_0x5f285a[_0x3543('0x9c')](_0x21a43d);return _0x5f285a;});}function getInputList(_0x2970f4,_0x2453bc,_0x1e06a5,_0x301330,_0x55ab7b,_0x439ecc,_0x42f181){var _0x502096={'method':_0x3543('0x92'),'uri':_0x2970f4+_0x3543('0xab')+_0x55ab7b+_0x3543('0xac')+_0x439ecc+_0x3543('0xbb')+_0x1e06a5+_0x3543('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x42f181,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x502096)['then'](function(_0x3e0122){var _0x156d03={'id':_0x2453bc+'_'+_0x3e0122[_0x3543('0xb4')],'name':_0x3e0122['DisplayName'][_0x3543('0xb1')]?_0x3e0122[_0x3543('0xb5')][_0x3543('0xb1')][_0x3543('0xb2')]:_0x3e0122['LogicalName'],'custom':![],'options':[]};_0x301330[_0x3543('0x9c')](_0x156d03);return _0x301330;});} \ No newline at end of file +var _0xd9b6=['StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','Dynamics365Account','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','length','map','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata'];(function(_0x89a6d0,_0x11a793){var _0x1bf0e1=function(_0x30dba7){while(--_0x30dba7){_0x89a6d0['push'](_0x89a6d0['shift']());}};_0x1bf0e1(++_0x11a793);}(_0xd9b6,0x17b));var _0x6d9b=function(_0x22a6f6,_0x5d6ea9){_0x22a6f6=_0x22a6f6-0x0;var _0x464440=_0xd9b6[_0x22a6f6];return _0x464440;};'use strict';var rp=require(_0x6d9b('0x0'));var util=require(_0x6d9b('0x1'));var _=require(_0x6d9b('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6d9b('0x3'));var db=require(_0x6d9b('0x4'))['db'];var integrations=require(_0x6d9b('0x5'));function respondWithResult(_0x3d32e8,_0x44efde){_0x44efde=_0x44efde||0xc8;return function(_0xc2f255){if(_0xc2f255){return _0x3d32e8[_0x6d9b('0x6')](_0x44efde)[_0x6d9b('0x7')](_0xc2f255);}};}function respondWithFilteredResult(_0x5525da,_0x2ba696){return function(_0x3b0566){if(_0x3b0566){var _0x4361f4=typeof _0x2ba696[_0x6d9b('0x8')]===_0x6d9b('0x9')&&typeof _0x2ba696[_0x6d9b('0xa')]===_0x6d9b('0x9');var _0x51b1b3=_0x3b0566[_0x6d9b('0xb')];var _0x1d7242=_0x4361f4?0x0:_0x2ba696[_0x6d9b('0x8')];var _0x550efd=_0x4361f4?_0x3b0566[_0x6d9b('0xb')]:_0x2ba696[_0x6d9b('0x8')]+_0x2ba696[_0x6d9b('0xa')];var _0x4e6bab;if(_0x550efd>=_0x51b1b3){_0x550efd=_0x51b1b3;_0x4e6bab=0xc8;}else{_0x4e6bab=0xce;}_0x5525da[_0x6d9b('0x6')](_0x4e6bab);return _0x5525da[_0x6d9b('0xc')](_0x6d9b('0xd'),_0x1d7242+'-'+_0x550efd+'/'+_0x51b1b3)['json'](_0x3b0566);}return null;};}function saveUpdates(_0x382233){return function(_0x46775e){if(_0x46775e){return _0x46775e[_0x6d9b('0xe')](_0x382233)[_0x6d9b('0xf')](function(_0x16b570){return _0x16b570;});}return null;};}function removeEntity(_0x31edf9){return function(_0x2aa202){if(_0x2aa202){return _0x2aa202[_0x6d9b('0x10')]()['then'](function(){_0x31edf9[_0x6d9b('0x6')](0xcc)[_0x6d9b('0x11')]();});}};}function handleEntityNotFound(_0x587d84){return function(_0x544670){if(!_0x544670){_0x587d84['sendStatus'](0x194);}return _0x544670;};}function handleError(_0x34df4c,_0xba3f06){_0xba3f06=_0xba3f06||0x1f4;return function(_0x5f3121){logger[_0x6d9b('0x12')](_0x5f3121[_0x6d9b('0x13')]);if(_0x5f3121[_0x6d9b('0x14')]){delete _0x5f3121[_0x6d9b('0x14')];}_0x34df4c[_0x6d9b('0x6')](_0xba3f06)[_0x6d9b('0x15')](_0x5f3121);};}exports['index']=function(_0x348bbc,_0x2f0877){var _0x5407ae={},_0x4e2fa9={},_0x3a1c92={'count':0x0,'rows':[]};var _0x38706a=_['map'](db[_0x6d9b('0x16')][_0x6d9b('0x17')],function(_0x252270){return{'name':_0x252270[_0x6d9b('0x18')],'type':_0x252270[_0x6d9b('0x19')]['key']};});_0x4e2fa9[_0x6d9b('0x1a')]=_['map'](_0x38706a,_0x6d9b('0x14'));_0x4e2fa9['query']=_[_0x6d9b('0x1b')](_0x348bbc[_0x6d9b('0x1c')]);_0x4e2fa9[_0x6d9b('0x1d')]=_['intersection'](_0x4e2fa9[_0x6d9b('0x1a')],_0x4e2fa9[_0x6d9b('0x1c')]);_0x5407ae['attributes']=_[_0x6d9b('0x1e')](_0x4e2fa9[_0x6d9b('0x1a')],qs[_0x6d9b('0x1f')](_0x348bbc[_0x6d9b('0x1c')][_0x6d9b('0x1f')]));_0x5407ae[_0x6d9b('0x20')]=_0x5407ae[_0x6d9b('0x20')]['length']?_0x5407ae[_0x6d9b('0x20')]:_0x4e2fa9['model'];if(!_0x348bbc[_0x6d9b('0x1c')][_0x6d9b('0x21')]('nolimit')){_0x5407ae[_0x6d9b('0xa')]=qs[_0x6d9b('0xa')](_0x348bbc[_0x6d9b('0x1c')][_0x6d9b('0xa')]);_0x5407ae['offset']=qs[_0x6d9b('0x8')](_0x348bbc[_0x6d9b('0x1c')][_0x6d9b('0x8')]);}_0x5407ae[_0x6d9b('0x22')]=qs[_0x6d9b('0x23')](_0x348bbc[_0x6d9b('0x1c')][_0x6d9b('0x23')]);_0x5407ae[_0x6d9b('0x24')]=qs[_0x6d9b('0x1d')](_['pick'](_0x348bbc[_0x6d9b('0x1c')],_0x4e2fa9[_0x6d9b('0x1d')]),_0x38706a);if(_0x348bbc['query'][_0x6d9b('0x25')]){_0x5407ae[_0x6d9b('0x24')]=_['merge'](_0x5407ae[_0x6d9b('0x24')],{'$or':_['map'](_0x38706a,function(_0x2b4427){if(_0x2b4427[_0x6d9b('0x19')]!=='VIRTUAL'){var _0x5aca82={};_0x5aca82[_0x2b4427[_0x6d9b('0x14')]]={'$like':'%'+_0x348bbc[_0x6d9b('0x1c')][_0x6d9b('0x25')]+'%'};return _0x5aca82;}})});}_0x5407ae=_[_0x6d9b('0x26')]({},_0x5407ae,_0x348bbc['options']);var _0x5c51a9={'where':_0x5407ae['where']};return db['Dynamics365Account']['count'](_0x5c51a9)['then'](function(_0x490edb){_0x3a1c92['count']=_0x490edb;if(_0x348bbc[_0x6d9b('0x1c')]['includeAll']){_0x5407ae[_0x6d9b('0x27')]=[{'all':!![]}];}return db[_0x6d9b('0x16')][_0x6d9b('0x28')](_0x5407ae);})['then'](function(_0x2ead9c){_0x3a1c92[_0x6d9b('0x29')]=_0x2ead9c;return _0x3a1c92;})[_0x6d9b('0xf')](respondWithFilteredResult(_0x2f0877,_0x5407ae))[_0x6d9b('0x2a')](handleError(_0x2f0877,null));};exports[_0x6d9b('0x2b')]=function(_0x10b305,_0x550b24){var _0x52f0e7={'raw':![],'where':{'id':_0x10b305[_0x6d9b('0x2c')]['id']}},_0x55a058={};_0x55a058[_0x6d9b('0x1a')]=_['keys'](db[_0x6d9b('0x16')]['rawAttributes']);_0x55a058[_0x6d9b('0x1c')]=_[_0x6d9b('0x1b')](_0x10b305['query']);_0x55a058['filters']=_[_0x6d9b('0x1e')](_0x55a058[_0x6d9b('0x1a')],_0x55a058[_0x6d9b('0x1c')]);_0x52f0e7[_0x6d9b('0x20')]=_[_0x6d9b('0x1e')](_0x55a058[_0x6d9b('0x1a')],qs['fields'](_0x10b305[_0x6d9b('0x1c')][_0x6d9b('0x1f')]));_0x52f0e7['attributes']=_0x52f0e7[_0x6d9b('0x20')]['length']?_0x52f0e7[_0x6d9b('0x20')]:_0x55a058['model'];if(_0x10b305['query'][_0x6d9b('0x2d')]){_0x52f0e7[_0x6d9b('0x27')]=[{'all':!![]}];}_0x52f0e7=_[_0x6d9b('0x26')]({},_0x52f0e7,_0x10b305['options']);return db[_0x6d9b('0x16')]['find'](_0x52f0e7)['then'](handleEntityNotFound(_0x550b24,null))[_0x6d9b('0xf')](respondWithResult(_0x550b24,null))['catch'](handleError(_0x550b24,null));};exports[_0x6d9b('0x2e')]=function(_0x15fc37,_0x544745){return db['Dynamics365Account'][_0x6d9b('0x2e')](_0x15fc37[_0x6d9b('0x2f')],{})[_0x6d9b('0xf')](respondWithResult(_0x544745,0xc9))['catch'](handleError(_0x544745,null));};exports[_0x6d9b('0xe')]=function(_0x36aabe,_0x6621eb){if(_0x36aabe['body']['id']){delete _0x36aabe[_0x6d9b('0x2f')]['id'];}return db[_0x6d9b('0x16')]['find']({'where':{'id':_0x36aabe[_0x6d9b('0x2c')]['id']}})[_0x6d9b('0xf')](handleEntityNotFound(_0x6621eb,null))['then'](saveUpdates(_0x36aabe[_0x6d9b('0x2f')],null))[_0x6d9b('0xf')](respondWithResult(_0x6621eb,null))[_0x6d9b('0x2a')](handleError(_0x6621eb,null));};exports[_0x6d9b('0x10')]=function(_0x77f302,_0x5f5a55){return db[_0x6d9b('0x16')][_0x6d9b('0x30')]({'where':{'id':_0x77f302[_0x6d9b('0x2c')]['id']}})[_0x6d9b('0xf')](handleEntityNotFound(_0x5f5a55,null))[_0x6d9b('0xf')](removeEntity(_0x5f5a55,null))[_0x6d9b('0x2a')](handleError(_0x5f5a55,null));};exports[_0x6d9b('0x31')]=function(_0x2fc7b6,_0x2a21ff){var _0x2cf529={};var _0x31675e={};var _0x24b248;var _0x58e024;return db['Dynamics365Account'][_0x6d9b('0x32')]({'where':{'id':_0x2fc7b6[_0x6d9b('0x2c')]['id']}})[_0x6d9b('0xf')](handleEntityNotFound(_0x2a21ff,null))['then'](function(_0x5510c6){if(_0x5510c6){_0x24b248=_0x5510c6;_0x31675e['model']=_['keys'](db['Dynamics365Configuration'][_0x6d9b('0x17')]);_0x31675e[_0x6d9b('0x1c')]=_[_0x6d9b('0x1b')](_0x2fc7b6['query']);_0x31675e[_0x6d9b('0x1d')]=_['intersection'](_0x31675e['model'],_0x31675e[_0x6d9b('0x1c')]);_0x2cf529['attributes']=_[_0x6d9b('0x1e')](_0x31675e[_0x6d9b('0x1a')],qs[_0x6d9b('0x1f')](_0x2fc7b6[_0x6d9b('0x1c')][_0x6d9b('0x1f')]));_0x2cf529['attributes']=_0x2cf529[_0x6d9b('0x20')][_0x6d9b('0x33')]?_0x2cf529[_0x6d9b('0x20')]:_0x31675e[_0x6d9b('0x1a')];_0x2cf529[_0x6d9b('0x22')]=qs[_0x6d9b('0x23')](_0x2fc7b6[_0x6d9b('0x1c')][_0x6d9b('0x23')]);_0x2cf529[_0x6d9b('0x24')]=qs[_0x6d9b('0x1d')](_['pick'](_0x2fc7b6[_0x6d9b('0x1c')],_0x31675e['filters']));if(_0x2fc7b6[_0x6d9b('0x1c')]['filter']){_0x2cf529[_0x6d9b('0x24')]=_['merge'](_0x2cf529[_0x6d9b('0x24')],{'$or':_[_0x6d9b('0x34')](_0x2cf529[_0x6d9b('0x20')],function(_0x41d85a){var _0x366b86={};_0x366b86[_0x41d85a]={'$like':'%'+_0x2fc7b6['query'][_0x6d9b('0x25')]+'%'};return _0x366b86;})});}_0x2cf529=_[_0x6d9b('0x26')]({},_0x2cf529,_0x2fc7b6[_0x6d9b('0x35')]);return _0x24b248[_0x6d9b('0x31')](_0x2cf529);}})['then'](function(_0x434102){if(_0x434102){_0x58e024=_0x434102[_0x6d9b('0x33')];if(!_0x2fc7b6[_0x6d9b('0x1c')][_0x6d9b('0x21')]('nolimit')){_0x2cf529['limit']=qs[_0x6d9b('0xa')](_0x2fc7b6['query'][_0x6d9b('0xa')]);_0x2cf529[_0x6d9b('0x8')]=qs[_0x6d9b('0x8')](_0x2fc7b6[_0x6d9b('0x1c')][_0x6d9b('0x8')]);}return _0x24b248['getConfigurations'](_0x2cf529);}})['then'](function(_0x384a6d){if(_0x384a6d){return _0x384a6d?{'count':_0x58e024,'rows':_0x384a6d}:null;}})[_0x6d9b('0xf')](respondWithResult(_0x2a21ff,null))['catch'](handleError(_0x2a21ff,null));};exports[_0x6d9b('0x36')]=function(_0x57ab2d,_0x4f5bd8){if(_0x57ab2d[_0x6d9b('0x2f')]['id']){delete _0x57ab2d['body']['id'];}return db[_0x6d9b('0x16')][_0x6d9b('0x32')]({'where':{'id':_0x57ab2d[_0x6d9b('0x2c')]['id']}})[_0x6d9b('0xf')](handleEntityNotFound(_0x4f5bd8,null))[_0x6d9b('0xf')](function(_0x472b51){if(_0x472b51){_0x57ab2d[_0x6d9b('0x2f')][_0x6d9b('0x37')]=_0x472b51['id'];_0x57ab2d[_0x6d9b('0x2f')][_0x6d9b('0x38')]=integrations[_0x6d9b('0x39')](_0x57ab2d['body'][_0x6d9b('0x3a')],_0x57ab2d['body']['type']);_0x57ab2d['body'][_0x6d9b('0x3b')]=integrations[_0x6d9b('0x3c')](_0x57ab2d[_0x6d9b('0x2f')][_0x6d9b('0x3a')],_0x57ab2d[_0x6d9b('0x2f')][_0x6d9b('0x19')]);return db['Dynamics365Configuration'][_0x6d9b('0x2e')](_0x57ab2d[_0x6d9b('0x2f')],{'include':[{'model':db[_0x6d9b('0x3d')],'as':_0x6d9b('0x38')},{'model':db['Dynamics365Field'],'as':_0x6d9b('0x3b')}]});}return null;})['then'](respondWithResult(_0x4f5bd8,null))[_0x6d9b('0x2a')](handleError(_0x4f5bd8,null));};function sanitizeRemoteUri(_0x1f734d){var _0x299a91=_0x1f734d[_0x6d9b('0x3e')](-0x1);if(_0x299a91==='/')return _0x1f734d[_0x6d9b('0x3f')](0x0,_0x1f734d[_0x6d9b('0x40')](_0x299a91));return _0x1f734d;}function getWebApiUrl(_0x498863){return util[_0x6d9b('0x41')](_0x6d9b('0x42'),_0x498863);}exports[_0x6d9b('0x43')]=function(_0x29ad11,_0x2e6308){var _0x40a3df=_0x29ad11['query'][_0x6d9b('0x44')];var _0x4d12ef=_0x40a3df===_0x6d9b('0x45')?_0x6d9b('0x46'):_0x6d9b('0x47');var _0x2ac664='';var _0x32a08f='';var _0x45fa81='';var _0x52d823='';var _0x51d06f='';var _0x57c3eb='';var _0x913f36='';var _0x2d7025='';var _0x4680c2=[_0x6d9b('0x48'),'description','customerid',_0x6d9b('0x49'),_0x6d9b('0x4a'),_0x6d9b('0x4b'),_0x6d9b('0x4c'),_0x6d9b('0x4d'),'directioncode',_0x6d9b('0x4e')];var _0x87b529=[_0x6d9b('0x4f'),_0x6d9b('0x50'),_0x6d9b('0x51'),_0x6d9b('0x52'),_0x6d9b('0x53'),'contactidyominame',_0x6d9b('0x54'),'contractidname','createdbyexternalpartyname',_0x6d9b('0x55'),_0x6d9b('0x56'),_0x6d9b('0x57'),_0x6d9b('0x58'),_0x6d9b('0x59'),_0x6d9b('0x5a'),_0x6d9b('0x5b'),_0x6d9b('0x5c'),_0x6d9b('0x5d'),_0x6d9b('0x5e'),'entitlementidname',_0x6d9b('0x5f'),_0x6d9b('0x60'),_0x6d9b('0x61'),_0x6d9b('0x62'),_0x6d9b('0x63'),'followupby','importsequencenumber',_0x6d9b('0x64'),_0x6d9b('0x65'),_0x6d9b('0x66'),'masteridname',_0x6d9b('0x67'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x6d9b('0x68'),'modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x6d9b('0x69'),'msdyn_iotalertname',_0x6d9b('0x6a'),_0x6d9b('0x6b'),'overriddencreatedon',_0x6d9b('0x6c'),_0x6d9b('0x6d'),'owneridyominame',_0x6d9b('0x6e'),_0x6d9b('0x6f'),_0x6d9b('0x70'),_0x6d9b('0x71'),_0x6d9b('0x72'),'productserialnumber','resolveby',_0x6d9b('0x73'),_0x6d9b('0x74'),'responsiblecontactidname',_0x6d9b('0x75'),'sentimentvalue',_0x6d9b('0x76'),'slaname','socialprofileidname',_0x6d9b('0x77'),_0x6d9b('0x78'),_0x6d9b('0x79'),_0x6d9b('0x7a'),_0x6d9b('0x7b'),_0x6d9b('0x7c'),_0x6d9b('0x7d'),'utcconversiontimezonecode',_0x6d9b('0x7e')];var _0x57698d=_0x4680c2[_0x6d9b('0x7f')](_0x87b529);return db[_0x6d9b('0x16')][_0x6d9b('0x32')]({'where':{'id':_0x29ad11['params']['id']},'attributes':['id',_0x6d9b('0x80'),_0x6d9b('0x81'),_0x6d9b('0x82'),_0x6d9b('0x83'),'clientId',_0x6d9b('0x84'),_0x6d9b('0x85')],'include':[{'model':db['CloudProvider'],'as':_0x6d9b('0x86'),'attributes':['id',_0x6d9b('0x87'),_0x6d9b('0x88')]}]})[_0x6d9b('0xf')](handleEntityNotFound(_0x2e6308,null))[_0x6d9b('0xf')](function(_0x53292b){if(_0x53292b){if(_0x53292b[_0x6d9b('0x85')]){_0x53292b[_0x6d9b('0x89')]=_0x53292b['CloudProvider']['data5'];_0x2d7025=sanitizeRemoteUri(_0x53292b['CloudProvider'][_0x6d9b('0x88')]);_0x913f36=getWebApiUrl(_0x2d7025);return _0x53292b;}_0x2d7025=sanitizeRemoteUri(_0x53292b[_0x6d9b('0x82')]);_0x913f36=getWebApiUrl(_0x2d7025);var _0x14e4bd={'method':_0x6d9b('0x8a'),'uri':_0x6d9b('0x8b')+_0x53292b[_0x6d9b('0x83')]+_0x6d9b('0x8c'),'form':{'client_id':_0x53292b[_0x6d9b('0x8d')],'resource':_0x2d7025,'username':_0x53292b['username'],'password':_0x53292b[_0x6d9b('0x81')],'grant_type':_0x6d9b('0x81'),'client_secret':_0x53292b['clientSecret']},'json':!![]};return rp(_0x14e4bd);}})[_0x6d9b('0xf')](function(_0x4f454b){_0x57c3eb=_0x4f454b[_0x6d9b('0x89')];var _0x80b1c7={'method':_0x6d9b('0x8e'),'uri':encodeURI(_0x913f36+_0x6d9b('0x8f')+_0x4d12ef+'\x27'),'headers':{'Authorization':_0x6d9b('0x90')+_0x57c3eb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x80b1c7);})[_0x6d9b('0xf')](function(_0x23ada3){var _0x428e5d=_0x23ada3[_0x6d9b('0x91')][0x0];var _0x5a86f2=_0x428e5d[_0x6d9b('0x92')];var _0x45a845={'method':'GET','uri':_0x913f36+_0x6d9b('0x93')+_0x5a86f2+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x6d9b('0x90')+_0x57c3eb,'If-None-Match':null,'OData-Version':_0x6d9b('0x94')},'json':!![]};return rp(_0x45a845);})['then'](function(_0x343915){_0x2ac664=_0x343915;_0x32a08f=_0x2ac664[_0x6d9b('0x95')];_0x32a08f=_['remove'](_0x32a08f,function(_0x370971){return!_0x57698d[_0x6d9b('0x96')](_0x370971[_0x6d9b('0x97')]);});var _0x2e7749=[];var _0x19fa31=[];_0x32a08f[_0x6d9b('0x98')](function(_0x5c0026){if(_0x5c0026[_0x6d9b('0x99')]){var _0x60cd31=_0x5c0026[_0x6d9b('0x99')][_0x6d9b('0x3f')](_0x5c0026['@odata.type'][_0x6d9b('0x40')]('.')+0x1);if(_0x60cd31===_0x6d9b('0x9a')){_0x2e7749[_0x6d9b('0x9b')](getSelectList(_0x913f36,_0x40a3df,_0x19fa31,_0x2ac664[_0x6d9b('0x92')],_0x5c0026[_0x6d9b('0x92')],_0x57c3eb));}}});return Promise[_0x6d9b('0x9c')](_0x2e7749);})[_0x6d9b('0xf')](function(_0x5a3509){_0x45fa81=_0x5a3509[0x0];var _0x4a673e=[];var _0x11d983=[];_0x32a08f['forEach'](function(_0x3b27f5){if(!_['isNil'](_0x3b27f5['@odata.type'])){var _0x4b0af5=_0x3b27f5[_0x6d9b('0x99')][_0x6d9b('0x3f')](_0x3b27f5[_0x6d9b('0x99')][_0x6d9b('0x40')]('.')+0x1);if(_0x4b0af5===_0x6d9b('0x9d')){_0x4a673e['push'](getBooleanList(_0x913f36,_0x40a3df,_0x11d983,_0x2ac664['MetadataId'],_0x3b27f5[_0x6d9b('0x92')],_0x57c3eb));}}});return Promise[_0x6d9b('0x9c')](_0x4a673e);})[_0x6d9b('0xf')](function(_0x575dfe){_0x52d823=_0x575dfe[0x0];var _0x192c8f=[];var _0x50f9dd=[];_0x32a08f[_0x6d9b('0x98')](function(_0x49f8ba){if(_0x49f8ba[_0x6d9b('0x99')]){var _0x499b96=_0x49f8ba[_0x6d9b('0x99')][_0x6d9b('0x3f')](_0x49f8ba[_0x6d9b('0x99')][_0x6d9b('0x40')]('.')+0x1);if(_0x499b96===_0x6d9b('0x9e')||_0x499b96===_0x6d9b('0x9f')||_0x499b96===_0x6d9b('0xa0')||_0x499b96===_0x6d9b('0xa1')||_0x499b96===_0x6d9b('0xa2')||_0x499b96===_0x6d9b('0xa3')||_0x499b96===_0x6d9b('0xa4')||_0x499b96==='EntityNameAttributeMetadata'||_0x499b96===_0x6d9b('0xa5')||_0x499b96===_0x6d9b('0xa6')){_0x192c8f[_0x6d9b('0x9b')](getInputList(_0x913f36,_0x40a3df,_0x499b96,_0x50f9dd,_0x2ac664[_0x6d9b('0x92')],_0x49f8ba[_0x6d9b('0x92')],_0x57c3eb));}}});return Promise[_0x6d9b('0x9c')](_0x192c8f);})['then'](function(_0x2c0dd7){_0x51d06f=_0x2c0dd7[0x0];var _0x5c4b7d=_0x45fa81['concat'](_0x52d823)[_0x6d9b('0x7f')](_0x51d06f);var _0xd5b9fa={'count':_0x5c4b7d[_0x6d9b('0x33')],'rows':_0x5c4b7d};return _0xd5b9fa;})[_0x6d9b('0xf')](respondWithResult(_0x2e6308,null))['catch'](function(_0x3c8a39){var _0x221588=_0x29ad11[_0x6d9b('0x1c')][_0x6d9b('0xa7')]?0x1f4:_0x3c8a39[_0x6d9b('0xa8')]||0x1f4;logger[_0x6d9b('0x12')](_0x3c8a39[_0x6d9b('0x13')]);delete _0x3c8a39[_0x6d9b('0x14')];if(_0x221588===0x191){_0x221588=0x190;}_0x2e6308[_0x6d9b('0x6')](_0x221588)[_0x6d9b('0x15')](_0x29ad11[_0x6d9b('0x1c')][_0x6d9b('0xa7')]?{'message':_0x6d9b('0xa9'),'statusCode':_0x3c8a39[_0x6d9b('0xa8')]}:_0x3c8a39);});};function getSelectList(_0x1df4b5,_0x405553,_0x339318,_0x37ee7e,_0x5d0202,_0x16143b){var _0x20bd59={'method':_0x6d9b('0x8e'),'uri':_0x1df4b5+_0x6d9b('0x93')+_0x37ee7e+_0x6d9b('0xaa')+_0x5d0202+_0x6d9b('0xab')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x16143b,'If-None-Match':null,'OData-Version':_0x6d9b('0x94')},'json':!![]};return rp(_0x20bd59)[_0x6d9b('0xf')](function(_0x2374ef){var _0x562655=[];var _0x4a3b7d=_0x2374ef[_0x6d9b('0xac')]['Options'];_0x4a3b7d[_0x6d9b('0x98')](function(_0x32dc9b){_0x562655[_0x6d9b('0x9b')]({'name':_0x32dc9b[_0x6d9b('0xad')][_0x6d9b('0xae')][_0x6d9b('0xad')],'value':String(_0x32dc9b[_0x6d9b('0xaf')])});});var _0x67ef01={'id':_0x405553+'_'+_0x2374ef[_0x6d9b('0x97')],'name':_0x2374ef['DisplayName'][_0x6d9b('0xae')]['Label'],'custom':![],'options':_0x562655};_0x339318['push'](_0x67ef01);return _0x339318;});}function getBooleanList(_0x22e976,_0x4f1d4d,_0x38a1b0,_0x19e991,_0x3bc503,_0xe4eb00){var _0x738e05={'method':_0x6d9b('0x8e'),'uri':_0x22e976+_0x6d9b('0x93')+_0x19e991+_0x6d9b('0xaa')+_0x3bc503+_0x6d9b('0xb0'),'headers':{'Authorization':_0x6d9b('0x90')+_0xe4eb00,'If-None-Match':null,'OData-Version':_0x6d9b('0x94')},'json':!![]};return rp(_0x738e05)[_0x6d9b('0xf')](function(_0x1aa9cc){var _0x490894=[];_0x490894['push']({'name':_0x1aa9cc[_0x6d9b('0xac')][_0x6d9b('0xb1')][_0x6d9b('0xad')][_0x6d9b('0xae')][_0x6d9b('0xad')],'value':'true'},{'name':_0x1aa9cc[_0x6d9b('0xac')]['FalseOption'][_0x6d9b('0xad')][_0x6d9b('0xae')][_0x6d9b('0xad')],'value':_0x6d9b('0xb2')});var _0x3f4c12={'id':_0x4f1d4d+'_'+_0x1aa9cc[_0x6d9b('0x97')],'name':_0x1aa9cc[_0x6d9b('0xb3')][_0x6d9b('0xae')][_0x6d9b('0xad')],'custom':![],'options':_0x490894};_0x38a1b0[_0x6d9b('0x9b')](_0x3f4c12);return _0x38a1b0;});}function getInputList(_0x3b2493,_0x32a5f7,_0x26ccca,_0x3c82aa,_0x5bf8db,_0x4dd722,_0x5e9299){var _0x5f536b={'method':_0x6d9b('0x8e'),'uri':_0x3b2493+_0x6d9b('0x93')+_0x5bf8db+')/Attributes('+_0x4dd722+_0x6d9b('0xb4')+_0x26ccca+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x6d9b('0x90')+_0x5e9299,'If-None-Match':null,'OData-Version':_0x6d9b('0x94')},'json':!![]};return rp(_0x5f536b)[_0x6d9b('0xf')](function(_0x52422f){var _0xe59e81={'id':_0x32a5f7+'_'+_0x52422f[_0x6d9b('0x97')],'name':_0x52422f[_0x6d9b('0xb3')][_0x6d9b('0xae')]?_0x52422f['DisplayName'][_0x6d9b('0xae')]['Label']:_0x52422f['LogicalName'],'custom':![],'options':[]};_0x3c82aa[_0x6d9b('0x9b')](_0xe59e81);return _0x3c82aa;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index d3c7a12..89f89c1 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x1472ae,_0x3d9c88){var _0x1f723b=function(_0x22ab2a){while(--_0x22ab2a){_0x1472ae['push'](_0x1472ae['shift']());}};_0x1f723b(++_0x3d9c88);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0xcb91[_0x114b7c];return _0x47185f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x1a75a9,_0x8c4511){var _0x3a3d99=function(_0x5f4fce){while(--_0x5f4fce){_0x1a75a9['push'](_0x1a75a9['shift']());}};_0x3a3d99(++_0x8c4511);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0xcb91[_0x351509];return _0x4e9861;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 07c104b..4331043 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 _0xc7e8=['info','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','map','include','attributes','model','ShowDynamics365Account','find','lodash','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s'];(function(_0x67e2e5,_0x146d7e){var _0x30869c=function(_0x373d31){while(--_0x373d31){_0x67e2e5['push'](_0x67e2e5['shift']());}};_0x30869c(++_0x146d7e);}(_0xc7e8,0x10f));var _0x8c7e=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xc7e8[_0x11a220];return _0x20d8fe;};'use strict';var _=require(_0x8c7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c7e('0x1'));var rs=require(_0x8c7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c7e('0x3'))(_0x8c7e('0x4'));var config=require('../../config/environment');var jayson=require(_0x8c7e('0x5'));var client=jayson[_0x8c7e('0x6')][_0x8c7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a212f,_0x2cf442,_0x18e903){return new BPromise(function(_0x2f64ff,_0x4711ec){return client['request'](_0x3a212f,_0x18e903)[_0x8c7e('0x8')](function(_0x162b78){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2cf442,_0x8c7e('0x9'));logger[_0x8c7e('0xa')](_0x8c7e('0xb'),_0x2cf442,_0x8c7e('0x9'),JSON[_0x8c7e('0xc')](_0x162b78));if(_0x162b78[_0x8c7e('0xd')]){if(_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xe')]===0x1f4){logger[_0x8c7e('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2cf442,_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xf')]);return _0x4711ec(_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xf')]);}logger[_0x8c7e('0xd')](_0x8c7e('0x10'),_0x2cf442,_0x162b78['error'][_0x8c7e('0xf')]);return _0x2f64ff(_0x162b78[_0x8c7e('0xd')][_0x8c7e('0xf')]);}else{logger[_0x8c7e('0x11')](_0x8c7e('0x10'),_0x2cf442,'request\x20sent');_0x2f64ff(_0x162b78[_0x8c7e('0x12')]['message']);}})[_0x8c7e('0x13')](function(_0x2dfa71){logger['error'](_0x8c7e('0x10'),_0x2cf442,_0x2dfa71);_0x4711ec(_0x2dfa71);});});}exports[_0x8c7e('0x14')]=function(_0x1c4acf){var _0x2930ba=this;return new Promise(function(_0x234cf2,_0x2a3fb4){return db[_0x8c7e('0x15')]['findAll']({'raw':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x17')]===undefined?!![]:![]:!![],'where':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x18')]||null:null,'attributes':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')]['attributes']||null:null,'limit':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x19')]||null:null,'include':_0x1c4acf[_0x8c7e('0x16')]?_0x1c4acf[_0x8c7e('0x16')]['include']?_[_0x8c7e('0x1a')](_0x1c4acf[_0x8c7e('0x16')][_0x8c7e('0x1b')],function(_0xc8e981){return{'model':db[_0xc8e981['model']],'as':_0xc8e981['as'],'attributes':_0xc8e981[_0x8c7e('0x1c')],'include':_0xc8e981[_0x8c7e('0x1b')]?_[_0x8c7e('0x1a')](_0xc8e981[_0x8c7e('0x1b')],function(_0x352c63){return{'model':db[_0x352c63[_0x8c7e('0x1d')]],'as':_0x352c63['as'],'attributes':_0x352c63[_0x8c7e('0x1c')],'include':_0x352c63['include']?_['map'](_0x352c63[_0x8c7e('0x1b')],function(_0x3653cb){return{'model':db[_0x3653cb[_0x8c7e('0x1d')]],'as':_0x3653cb['as'],'attributes':_0x3653cb[_0x8c7e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c7e('0x8')](function(_0x44769c){logger[_0x8c7e('0x11')]('GetDynamics365Account',_0x1c4acf);logger['debug'](_0x8c7e('0x14'),_0x1c4acf,JSON[_0x8c7e('0xc')](_0x44769c));_0x234cf2(_0x44769c);})[_0x8c7e('0x13')](function(_0x511a45){logger['error'](_0x8c7e('0x14'),_0x511a45[_0x8c7e('0xf')],_0x1c4acf);_0x2a3fb4(_0x2930ba[_0x8c7e('0xd')](0x1f4,_0x511a45['message']));});});};exports[_0x8c7e('0x1e')]=function(_0x1734ff){var _0x1e76fb=this;return new Promise(function(_0x2f48a9,_0x27a2c7){return db['Dynamics365Account'][_0x8c7e('0x1f')]({'raw':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff[_0x8c7e('0x16')][_0x8c7e('0x17')]===undefined?!![]:![]:!![],'where':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff['options'][_0x8c7e('0x18')]||null:null,'attributes':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff['options']['attributes']||null:null,'include':_0x1734ff[_0x8c7e('0x16')]?_0x1734ff[_0x8c7e('0x16')][_0x8c7e('0x1b')]?_[_0x8c7e('0x1a')](_0x1734ff[_0x8c7e('0x16')]['include'],function(_0x20ffb0){return{'model':db[_0x20ffb0[_0x8c7e('0x1d')]],'as':_0x20ffb0['as'],'attributes':_0x20ffb0[_0x8c7e('0x1c')],'include':_0x20ffb0['include']?_[_0x8c7e('0x1a')](_0x20ffb0[_0x8c7e('0x1b')],function(_0x1914b1){return{'model':db[_0x1914b1[_0x8c7e('0x1d')]],'as':_0x1914b1['as'],'attributes':_0x1914b1['attributes'],'include':_0x1914b1[_0x8c7e('0x1b')]?_[_0x8c7e('0x1a')](_0x1914b1[_0x8c7e('0x1b')],function(_0x51dd7e){return{'model':db[_0x51dd7e[_0x8c7e('0x1d')]],'as':_0x51dd7e['as'],'attributes':_0x51dd7e[_0x8c7e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab9e8){logger['info']('ShowDynamics365Account',_0x1734ff);logger['debug'](_0x8c7e('0x1e'),_0x1734ff,JSON[_0x8c7e('0xc')](_0x5ab9e8));_0x2f48a9(_0x5ab9e8);})[_0x8c7e('0x13')](function(_0x17d3f6){logger[_0x8c7e('0xd')](_0x8c7e('0x1e'),_0x17d3f6[_0x8c7e('0xf')],_0x1734ff);_0x27a2c7(_0x1e76fb[_0x8c7e('0xd')](0x1f4,_0x17d3f6[_0x8c7e('0xf')]));});});}; \ No newline at end of file +var _0xf368=['then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','limit','include','map','attributes','model','where','ShowDynamics365Account','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4b7e39,_0x1881fd){var _0x107b5f=function(_0x26ec0a){while(--_0x26ec0a){_0x4b7e39['push'](_0x4b7e39['shift']());}};_0x107b5f(++_0x1881fd);}(_0xf368,0x1d3));var _0x8f36=function(_0x499a4c,_0x43df47){_0x499a4c=_0x499a4c-0x0;var _0x1a6b9c=_0xf368[_0x499a4c];return _0x1a6b9c;};'use strict';var _=require(_0x8f36('0x0'));var util=require(_0x8f36('0x1'));var moment=require('moment');var BPromise=require(_0x8f36('0x2'));var rs=require(_0x8f36('0x3'));var fs=require('fs');var Redis=require(_0x8f36('0x4'));var db=require(_0x8f36('0x5'))['db'];var utils=require(_0x8f36('0x6'));var logger=require(_0x8f36('0x7'))(_0x8f36('0x8'));var config=require(_0x8f36('0x9'));var jayson=require(_0x8f36('0xa'));var client=jayson[_0x8f36('0xb')][_0x8f36('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b4a01,_0x1e3f50,_0x7e556b){return new BPromise(function(_0x4519bf,_0x4e0a96){return client[_0x8f36('0xd')](_0x5b4a01,_0x7e556b)[_0x8f36('0xe')](function(_0x15ffa6){logger[_0x8f36('0xf')](_0x8f36('0x10'),_0x1e3f50,'request\x20sent');logger[_0x8f36('0x11')](_0x8f36('0x12'),_0x1e3f50,_0x8f36('0x13'),JSON[_0x8f36('0x14')](_0x15ffa6));if(_0x15ffa6[_0x8f36('0x15')]){if(_0x15ffa6['error']['code']===0x1f4){logger[_0x8f36('0x15')](_0x8f36('0x10'),_0x1e3f50,_0x15ffa6['error'][_0x8f36('0x16')]);return _0x4e0a96(_0x15ffa6[_0x8f36('0x15')][_0x8f36('0x16')]);}logger[_0x8f36('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x1e3f50,_0x15ffa6['error']['message']);return _0x4519bf(_0x15ffa6[_0x8f36('0x15')][_0x8f36('0x16')]);}else{logger['info'](_0x8f36('0x10'),_0x1e3f50,_0x8f36('0x13'));_0x4519bf(_0x15ffa6[_0x8f36('0x17')][_0x8f36('0x16')]);}})[_0x8f36('0x18')](function(_0xda628a){logger[_0x8f36('0x15')](_0x8f36('0x10'),_0x1e3f50,_0xda628a);_0x4e0a96(_0xda628a);});});}exports[_0x8f36('0x19')]=function(_0x598864){var _0x4d3ef1=this;return new Promise(function(_0x5759ec,_0x3ff729){return db[_0x8f36('0x1a')][_0x8f36('0x1b')]({'raw':_0x598864[_0x8f36('0x1c')]?_0x598864[_0x8f36('0x1c')][_0x8f36('0x1d')]===undefined?!![]:![]:!![],'where':_0x598864[_0x8f36('0x1c')]?_0x598864['options']['where']||null:null,'attributes':_0x598864['options']?_0x598864['options']['attributes']||null:null,'limit':_0x598864[_0x8f36('0x1c')]?_0x598864[_0x8f36('0x1c')][_0x8f36('0x1e')]||null:null,'include':_0x598864[_0x8f36('0x1c')]?_0x598864[_0x8f36('0x1c')][_0x8f36('0x1f')]?_[_0x8f36('0x20')](_0x598864[_0x8f36('0x1c')][_0x8f36('0x1f')],function(_0x3ec80d){return{'model':db[_0x3ec80d['model']],'as':_0x3ec80d['as'],'attributes':_0x3ec80d[_0x8f36('0x21')],'include':_0x3ec80d[_0x8f36('0x1f')]?_[_0x8f36('0x20')](_0x3ec80d['include'],function(_0x26fc72){return{'model':db[_0x26fc72[_0x8f36('0x22')]],'as':_0x26fc72['as'],'attributes':_0x26fc72['attributes'],'include':_0x26fc72['include']?_[_0x8f36('0x20')](_0x26fc72[_0x8f36('0x1f')],function(_0x51a7d5){return{'model':db[_0x51a7d5[_0x8f36('0x22')]],'as':_0x51a7d5['as'],'attributes':_0x51a7d5[_0x8f36('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8f36('0xe')](function(_0xd25e9f){logger[_0x8f36('0xf')](_0x8f36('0x19'),_0x598864);logger[_0x8f36('0x11')](_0x8f36('0x19'),_0x598864,JSON[_0x8f36('0x14')](_0xd25e9f));_0x5759ec(_0xd25e9f);})[_0x8f36('0x18')](function(_0x2107aa){logger[_0x8f36('0x15')]('GetDynamics365Account',_0x2107aa['message'],_0x598864);_0x3ff729(_0x4d3ef1['error'](0x1f4,_0x2107aa[_0x8f36('0x16')]));});});};exports['ShowDynamics365Account']=function(_0x48bbe6){var _0x1da6c1=this;return new Promise(function(_0x989508,_0xfea9c6){return db['Dynamics365Account']['find']({'raw':_0x48bbe6[_0x8f36('0x1c')]?_0x48bbe6[_0x8f36('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x48bbe6[_0x8f36('0x1c')]?_0x48bbe6[_0x8f36('0x1c')][_0x8f36('0x23')]||null:null,'attributes':_0x48bbe6['options']?_0x48bbe6[_0x8f36('0x1c')][_0x8f36('0x21')]||null:null,'include':_0x48bbe6[_0x8f36('0x1c')]?_0x48bbe6['options']['include']?_[_0x8f36('0x20')](_0x48bbe6[_0x8f36('0x1c')][_0x8f36('0x1f')],function(_0x3ca2e6){return{'model':db[_0x3ca2e6[_0x8f36('0x22')]],'as':_0x3ca2e6['as'],'attributes':_0x3ca2e6['attributes'],'include':_0x3ca2e6[_0x8f36('0x1f')]?_[_0x8f36('0x20')](_0x3ca2e6[_0x8f36('0x1f')],function(_0x5b516b){return{'model':db[_0x5b516b['model']],'as':_0x5b516b['as'],'attributes':_0x5b516b[_0x8f36('0x21')],'include':_0x5b516b[_0x8f36('0x1f')]?_[_0x8f36('0x20')](_0x5b516b[_0x8f36('0x1f')],function(_0x493408){return{'model':db[_0x493408[_0x8f36('0x22')]],'as':_0x493408['as'],'attributes':_0x493408['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x344500){logger[_0x8f36('0xf')](_0x8f36('0x24'),_0x48bbe6);logger[_0x8f36('0x11')](_0x8f36('0x24'),_0x48bbe6,JSON[_0x8f36('0x14')](_0x344500));_0x989508(_0x344500);})[_0x8f36('0x18')](function(_0x5d6cd8){logger['error'](_0x8f36('0x24'),_0x5d6cd8[_0x8f36('0x16')],_0x48bbe6);_0xfea9c6(_0x1da6c1[_0x8f36('0x15')](0x1f4,_0x5d6cd8[_0x8f36('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7728b82..dccd315 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 _0x32b6=['put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x5280eb,_0x293fb6){var _0x4da89f=function(_0x243d65){while(--_0x243d65){_0x5280eb['push'](_0x5280eb['shift']());}};_0x4da89f(++_0x293fb6);}(_0x32b6,0x1d1));var _0x632b=function(_0xeb0d8,_0x20a6d3){_0xeb0d8=_0xeb0d8-0x0;var _0x50857d=_0x32b6[_0xeb0d8];return _0x50857d;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x632b('0x4'));var interaction=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var controller=require(_0x632b('0x7'));router[_0x632b('0x8')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0xa')]);router[_0x632b('0x8')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['show']);router[_0x632b('0x8')](_0x632b('0xc'),auth[_0x632b('0x9')](),controller[_0x632b('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x632b('0xe')]);router['get'](_0x632b('0xf'),auth[_0x632b('0x9')](),controller[_0x632b('0x10')]);router[_0x632b('0x11')]('/',auth[_0x632b('0x9')](),controller[_0x632b('0x12')]);router[_0x632b('0x13')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['update']);router[_0x632b('0x14')](_0x632b('0xb'),auth[_0x632b('0x9')](),controller['destroy']);module[_0x632b('0x15')]=router; \ No newline at end of file +var _0x8c2d=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x8c2d,0x1cb));var _0xd8c2=function(_0x3b98c1,_0x3a4ae5){_0x3b98c1=_0x3b98c1-0x0;var _0x26990b=_0x8c2d[_0x3b98c1];return _0x26990b;};'use strict';var multer=require(_0xd8c2('0x0'));var util=require(_0xd8c2('0x1'));var path=require(_0xd8c2('0x2'));var timeout=require(_0xd8c2('0x3'));var express=require(_0xd8c2('0x4'));var router=express[_0xd8c2('0x5')]();var fs_extra=require(_0xd8c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8c2('0x7'));var config=require('../../config/environment');var controller=require(_0xd8c2('0x8'));router['get']('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xa')]);router['get'](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0xc')]);router[_0xd8c2('0xd')]('/:id/fields',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd8c2('0xf')]);router[_0xd8c2('0xd')](_0xd8c2('0x10'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x11')]);router[_0xd8c2('0x12')]('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x13')]);router[_0xd8c2('0x14')](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0x15')]);router[_0xd8c2('0x16')](_0xd8c2('0xb'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f2cbb81..7a64f95 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 _0x1363=['STRING','ENUM','incident','contact','nothing','BOOLEAN','sequelize','exports'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x1363,0x96));var _0x3136=function(_0x91bf9f,_0xb0192f){_0x91bf9f=_0x91bf9f-0x0;var _0x28a889=_0x1363[_0x91bf9f];return _0x28a889;};'use strict';var Sequelize=require(_0x3136('0x0'));module[_0x3136('0x1')]={'name':{'type':Sequelize[_0x3136('0x2')]},'description':{'type':Sequelize[_0x3136('0x2')]},'ticketType':{'type':Sequelize[_0x3136('0x3')](_0x3136('0x4'),'phonecall'),'defaultValue':_0x3136('0x4')},'moduleCreate':{'type':Sequelize[_0x3136('0x3')](_0x3136('0x5'),_0x3136('0x6')),'defaultValue':_0x3136('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x3136('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3136('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc143=['STRING','ENUM','nothing','contact','BOOLEAN','sequelize'];(function(_0x1b6c3d,_0xd9a041){var _0x1688da=function(_0x30fcd4){while(--_0x30fcd4){_0x1b6c3d['push'](_0x1b6c3d['shift']());}};_0x1688da(++_0xd9a041);}(_0xc143,0x1c1));var _0x3c14=function(_0x344b01,_0xe4c5f4){_0x344b01=_0x344b01-0x0;var _0x4a252c=_0xc143[_0x344b01];return _0x4a252c;};'use strict';var Sequelize=require(_0x3c14('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3c14('0x1')]},'ticketType':{'type':Sequelize[_0x3c14('0x2')]('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x3c14('0x2')]('contact',_0x3c14('0x3')),'defaultValue':_0x3c14('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x3c14('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3c14('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a1c5bc4..fe77576 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 _0x4420=['update','destroy','then','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','Dynamics365Configuration','findAll','rows','catch','params','length','options','find','create','body','getFields','findOne','Dynamics365Field','rawAttributes','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','set','json','apply','reject','save'];(function(_0x17c8a9,_0x531ca3){var _0x379aa6=function(_0x5ba780){while(--_0x5ba780){_0x17c8a9['push'](_0x17c8a9['shift']());}};_0x379aa6(++_0x531ca3);}(_0x4420,0x1d2));var _0x0442=function(_0x372c2f,_0xf4ff5c){_0x372c2f=_0x372c2f-0x0;var _0x366796=_0x4420[_0x372c2f];return _0x366796;};'use strict';var emlformat=require(_0x0442('0x0'));var rimraf=require(_0x0442('0x1'));var zipdir=require(_0x0442('0x2'));var jsonpatch=require(_0x0442('0x3'));var rp=require(_0x0442('0x4'));var moment=require(_0x0442('0x5'));var BPromise=require(_0x0442('0x6'));var Mustache=require(_0x0442('0x7'));var util=require('util');var path=require(_0x0442('0x8'));var sox=require(_0x0442('0x9'));var csv=require(_0x0442('0xa'));var ejs=require(_0x0442('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0442('0xc'));var crypto=require(_0x0442('0xd'));var jsforce=require(_0x0442('0xe'));var deskjs=require(_0x0442('0xf'));var toCsv=require(_0x0442('0xa'));var querystring=require(_0x0442('0x10'));var Papa=require(_0x0442('0x11'));var Redis=require(_0x0442('0x12'));var authService=require(_0x0442('0x13'));var qs=require(_0x0442('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0442('0x15'));var logger=require(_0x0442('0x16'))(_0x0442('0x17'));var utils=require(_0x0442('0x18'));var config=require(_0x0442('0x19'));var licenseUtil=require(_0x0442('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa86de3,_0x279ecf){_0x279ecf=_0x279ecf||0xcc;return function(_0x18a879){if(_0x18a879){return _0xa86de3[_0x0442('0x1b')](_0x279ecf);}return _0xa86de3['status'](_0x279ecf)[_0x0442('0x1c')]();};}function respondWithResult(_0x29b4da,_0x3d9b62){_0x3d9b62=_0x3d9b62||0xc8;return function(_0x397d65){if(_0x397d65){return _0x29b4da[_0x0442('0x1d')](_0x3d9b62)['json'](_0x397d65);}};}function respondWithFilteredResult(_0x3a780a,_0x92e27a){return function(_0xc8aa34){if(_0xc8aa34){var _0x16d5ce=typeof _0x92e27a[_0x0442('0x1e')]===_0x0442('0x1f')&&typeof _0x92e27a[_0x0442('0x20')]===_0x0442('0x1f');var _0x5a8d68=_0xc8aa34['count'];var _0x5c0d4e=_0x16d5ce?0x0:_0x92e27a['offset'];var _0x2c7630=_0x16d5ce?_0xc8aa34['count']:_0x92e27a[_0x0442('0x1e')]+_0x92e27a[_0x0442('0x20')];var _0xf69741;if(_0x2c7630>=_0x5a8d68){_0x2c7630=_0x5a8d68;_0xf69741=0xc8;}else{_0xf69741=0xce;}_0x3a780a[_0x0442('0x1d')](_0xf69741);return _0x3a780a[_0x0442('0x21')]('Content-Range',_0x5c0d4e+'-'+_0x2c7630+'/'+_0x5a8d68)[_0x0442('0x22')](_0xc8aa34);}return null;};}function patchUpdates(_0x423233){return function(_0x5a29e3){try{jsonpatch[_0x0442('0x23')](_0x5a29e3,_0x423233,!![]);}catch(_0x19888e){return BPromise[_0x0442('0x24')](_0x19888e);}return _0x5a29e3[_0x0442('0x25')]();};}function saveUpdates(_0xa732e7,_0x5100dd){return function(_0x27d9cf){if(_0x27d9cf){return _0x27d9cf[_0x0442('0x26')](_0xa732e7)['then'](function(_0x322b60){return _0x322b60;});}return null;};}function removeEntity(_0x4dc35,_0x45c1e6){return function(_0x103194){if(_0x103194){return _0x103194[_0x0442('0x27')]()[_0x0442('0x28')](function(){_0x4dc35[_0x0442('0x1d')](0xcc)[_0x0442('0x1c')]();});}};}function handleEntityNotFound(_0x1f1cff,_0x21dca8){return function(_0x534124){if(!_0x534124){_0x1f1cff[_0x0442('0x1b')](0x194);}return _0x534124;};}function handleError(_0x42529d,_0xaeda72){_0xaeda72=_0xaeda72||0x1f4;return function(_0x3e0544){logger[_0x0442('0x29')](_0x3e0544[_0x0442('0x2a')]);if(_0x3e0544[_0x0442('0x2b')]){delete _0x3e0544['name'];}_0x42529d[_0x0442('0x1d')](_0xaeda72)[_0x0442('0x2c')](_0x3e0544);};}exports[_0x0442('0x2d')]=function(_0x5214fe,_0x57f307){var _0x504143={},_0x329c39={},_0x42d137={'count':0x0,'rows':[]};var _0x4244ff=_[_0x0442('0x2e')](db['Dynamics365Configuration']['rawAttributes'],function(_0x4b905a){return{'name':_0x4b905a[_0x0442('0x2f')],'type':_0x4b905a[_0x0442('0x30')][_0x0442('0x31')]};});_0x329c39['model']=_[_0x0442('0x2e')](_0x4244ff,_0x0442('0x2b'));_0x329c39[_0x0442('0x32')]=_[_0x0442('0x33')](_0x5214fe[_0x0442('0x32')]);_0x329c39[_0x0442('0x34')]=_[_0x0442('0x35')](_0x329c39[_0x0442('0x36')],_0x329c39[_0x0442('0x32')]);_0x504143[_0x0442('0x37')]=_[_0x0442('0x35')](_0x329c39[_0x0442('0x36')],qs[_0x0442('0x38')](_0x5214fe[_0x0442('0x32')]['fields']));_0x504143[_0x0442('0x37')]=_0x504143[_0x0442('0x37')]['length']?_0x504143['attributes']:_0x329c39[_0x0442('0x36')];if(!_0x5214fe[_0x0442('0x32')]['hasOwnProperty']('nolimit')){_0x504143[_0x0442('0x20')]=qs['limit'](_0x5214fe[_0x0442('0x32')][_0x0442('0x20')]);_0x504143['offset']=qs['offset'](_0x5214fe[_0x0442('0x32')]['offset']);}_0x504143['order']=qs[_0x0442('0x39')](_0x5214fe[_0x0442('0x32')][_0x0442('0x39')]);_0x504143['where']=qs['filters'](_[_0x0442('0x3a')](_0x5214fe[_0x0442('0x32')],_0x329c39[_0x0442('0x34')]),_0x4244ff);if(_0x5214fe[_0x0442('0x32')][_0x0442('0x3b')]){_0x504143[_0x0442('0x3c')]=_[_0x0442('0x3d')](_0x504143[_0x0442('0x3c')],{'$or':_['map'](_0x4244ff,function(_0x474f14){if(_0x474f14[_0x0442('0x30')]!==_0x0442('0x3e')){var _0x596a85={};_0x596a85[_0x474f14[_0x0442('0x2b')]]={'$like':'%'+_0x5214fe[_0x0442('0x32')][_0x0442('0x3b')]+'%'};return _0x596a85;}})});}_0x504143=_[_0x0442('0x3d')]({},_0x504143,_0x5214fe['options']);var _0xc32a55={'where':_0x504143['where']};return db['Dynamics365Configuration'][_0x0442('0x3f')](_0xc32a55)[_0x0442('0x28')](function(_0x198933){_0x42d137[_0x0442('0x3f')]=_0x198933;if(_0x5214fe[_0x0442('0x32')][_0x0442('0x40')]){_0x504143[_0x0442('0x41')]=[{'all':!![]}];}return db[_0x0442('0x42')][_0x0442('0x43')](_0x504143);})['then'](function(_0x483c82){_0x42d137[_0x0442('0x44')]=_0x483c82;return _0x42d137;})[_0x0442('0x28')](respondWithFilteredResult(_0x57f307,_0x504143))[_0x0442('0x45')](handleError(_0x57f307,null));};exports['show']=function(_0xe58d1e,_0x1fdad7){var _0x272010={'raw':![],'where':{'id':_0xe58d1e[_0x0442('0x46')]['id']}},_0xec9451={};_0xec9451[_0x0442('0x36')]=_[_0x0442('0x33')](db['Dynamics365Configuration']['rawAttributes']);_0xec9451[_0x0442('0x32')]=_[_0x0442('0x33')](_0xe58d1e['query']);_0xec9451[_0x0442('0x34')]=_['intersection'](_0xec9451[_0x0442('0x36')],_0xec9451[_0x0442('0x32')]);_0x272010[_0x0442('0x37')]=_[_0x0442('0x35')](_0xec9451[_0x0442('0x36')],qs[_0x0442('0x38')](_0xe58d1e[_0x0442('0x32')][_0x0442('0x38')]));_0x272010['attributes']=_0x272010[_0x0442('0x37')][_0x0442('0x47')]?_0x272010['attributes']:_0xec9451['model'];if(_0xe58d1e['query'][_0x0442('0x40')]){_0x272010[_0x0442('0x41')]=[{'all':!![]}];}_0x272010=_['merge']({},_0x272010,_0xe58d1e[_0x0442('0x48')]);return db[_0x0442('0x42')][_0x0442('0x49')](_0x272010)[_0x0442('0x28')](handleEntityNotFound(_0x1fdad7,null))[_0x0442('0x28')](respondWithResult(_0x1fdad7,null))[_0x0442('0x45')](handleError(_0x1fdad7,null));};exports[_0x0442('0x4a')]=function(_0x200a91,_0x748bcb){return db[_0x0442('0x42')][_0x0442('0x4a')](_0x200a91[_0x0442('0x4b')],{})[_0x0442('0x28')](respondWithResult(_0x748bcb,0xc9))[_0x0442('0x45')](handleError(_0x748bcb,null));};exports[_0x0442('0x26')]=function(_0x326990,_0x58a9a2){if(_0x326990[_0x0442('0x4b')]['id']){delete _0x326990[_0x0442('0x4b')]['id'];}return db[_0x0442('0x42')][_0x0442('0x49')]({'where':{'id':_0x326990[_0x0442('0x46')]['id']}})[_0x0442('0x28')](handleEntityNotFound(_0x58a9a2,null))['then'](saveUpdates(_0x326990[_0x0442('0x4b')],null))[_0x0442('0x28')](respondWithResult(_0x58a9a2,null))['catch'](handleError(_0x58a9a2,null));};exports[_0x0442('0x27')]=function(_0x58e7e2,_0x1470f3){return db[_0x0442('0x42')][_0x0442('0x49')]({'where':{'id':_0x58e7e2['params']['id']}})['then'](handleEntityNotFound(_0x1470f3,null))['then'](removeEntity(_0x1470f3,null))[_0x0442('0x45')](handleError(_0x1470f3,null));};exports[_0x0442('0x4c')]=function(_0x2d44e2,_0x1de288,_0x3233e3){var _0x5ee440={};var _0x3a3798={};var _0x3f167e;var _0xef89b4;return db[_0x0442('0x42')][_0x0442('0x4d')]({'where':{'id':_0x2d44e2[_0x0442('0x46')]['id']}})['then'](handleEntityNotFound(_0x1de288,null))['then'](function(_0x49c1e2){if(_0x49c1e2){_0x3f167e=_0x49c1e2;_0x3a3798[_0x0442('0x36')]=_[_0x0442('0x33')](db[_0x0442('0x4e')][_0x0442('0x4f')]);_0x3a3798[_0x0442('0x32')]=_[_0x0442('0x33')](_0x2d44e2[_0x0442('0x32')]);_0x3a3798[_0x0442('0x34')]=_['intersection'](_0x3a3798['model'],_0x3a3798[_0x0442('0x32')]);_0x5ee440[_0x0442('0x37')]=_[_0x0442('0x35')](_0x3a3798['model'],qs[_0x0442('0x38')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x38')]));_0x5ee440['attributes']=_0x5ee440[_0x0442('0x37')]['length']?_0x5ee440['attributes']:_0x3a3798['model'];_0x5ee440['order']=qs[_0x0442('0x39')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x39')]);_0x5ee440[_0x0442('0x3c')]=qs[_0x0442('0x34')](_[_0x0442('0x3a')](_0x2d44e2['query'],_0x3a3798[_0x0442('0x34')]));if(_0x2d44e2['query'][_0x0442('0x3b')]){_0x5ee440[_0x0442('0x3c')]=_['merge'](_0x5ee440[_0x0442('0x3c')],{'$or':_[_0x0442('0x2e')](_0x5ee440[_0x0442('0x37')],function(_0x4891b5){var _0x2ba23c={};_0x2ba23c[_0x4891b5]={'$like':'%'+_0x2d44e2['query']['filter']+'%'};return _0x2ba23c;})});}_0x5ee440=_['merge']({},_0x5ee440,_0x2d44e2[_0x0442('0x48')]);return _0x3f167e['getFields'](_0x5ee440);}})[_0x0442('0x28')](function(_0x3fad86){if(_0x3fad86){_0xef89b4=_0x3fad86[_0x0442('0x47')];if(!_0x2d44e2[_0x0442('0x32')][_0x0442('0x50')](_0x0442('0x51'))){_0x5ee440['limit']=qs[_0x0442('0x20')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x20')]);_0x5ee440[_0x0442('0x1e')]=qs[_0x0442('0x1e')](_0x2d44e2[_0x0442('0x32')][_0x0442('0x1e')]);}return _0x3f167e[_0x0442('0x4c')](_0x5ee440);}})[_0x0442('0x28')](function(_0x56025b){if(_0x56025b){return _0x56025b?{'count':_0xef89b4,'rows':_0x56025b}:null;}})[_0x0442('0x28')](respondWithResult(_0x1de288,null))['catch'](handleError(_0x1de288,null));};exports['getSubjects']=function(_0x2f8224,_0x1f89f1,_0xfcf3c4){var _0xa43d6f={};var _0x15a318={};var _0x29fc43;var _0x2db0a2;return db[_0x0442('0x42')][_0x0442('0x4d')]({'where':{'id':_0x2f8224[_0x0442('0x46')]['id']}})[_0x0442('0x28')](handleEntityNotFound(_0x1f89f1,null))['then'](function(_0x573c56){if(_0x573c56){_0x29fc43=_0x573c56;_0x15a318[_0x0442('0x36')]=_['keys'](db[_0x0442('0x4e')][_0x0442('0x4f')]);_0x15a318[_0x0442('0x32')]=_[_0x0442('0x33')](_0x2f8224[_0x0442('0x32')]);_0x15a318[_0x0442('0x34')]=_[_0x0442('0x35')](_0x15a318[_0x0442('0x36')],_0x15a318[_0x0442('0x32')]);_0xa43d6f[_0x0442('0x37')]=_[_0x0442('0x35')](_0x15a318[_0x0442('0x36')],qs[_0x0442('0x38')](_0x2f8224[_0x0442('0x32')][_0x0442('0x38')]));_0xa43d6f[_0x0442('0x37')]=_0xa43d6f[_0x0442('0x37')][_0x0442('0x47')]?_0xa43d6f['attributes']:_0x15a318[_0x0442('0x36')];_0xa43d6f['order']=qs[_0x0442('0x39')](_0x2f8224['query'][_0x0442('0x39')]);_0xa43d6f[_0x0442('0x3c')]=qs[_0x0442('0x34')](_[_0x0442('0x3a')](_0x2f8224['query'],_0x15a318['filters']));if(_0x2f8224[_0x0442('0x32')][_0x0442('0x3b')]){_0xa43d6f[_0x0442('0x3c')]=_['merge'](_0xa43d6f[_0x0442('0x3c')],{'$or':_[_0x0442('0x2e')](_0xa43d6f[_0x0442('0x37')],function(_0x510b8){var _0x4e2a17={};_0x4e2a17[_0x510b8]={'$like':'%'+_0x2f8224[_0x0442('0x32')]['filter']+'%'};return _0x4e2a17;})});}_0xa43d6f=_[_0x0442('0x3d')]({},_0xa43d6f,_0x2f8224['options']);return _0x29fc43['getSubjects'](_0xa43d6f);}})[_0x0442('0x28')](function(_0x24cc7d){if(_0x24cc7d){_0x2db0a2=_0x24cc7d[_0x0442('0x47')];if(!_0x2f8224['query'][_0x0442('0x50')](_0x0442('0x51'))){_0xa43d6f[_0x0442('0x20')]=qs[_0x0442('0x20')](_0x2f8224[_0x0442('0x32')]['limit']);_0xa43d6f['offset']=qs[_0x0442('0x1e')](_0x2f8224['query']['offset']);}return _0x29fc43[_0x0442('0x52')](_0xa43d6f);}})[_0x0442('0x28')](function(_0x2a81da){if(_0x2a81da){return _0x2a81da?{'count':_0x2db0a2,'rows':_0x2a81da}:null;}})[_0x0442('0x28')](respondWithResult(_0x1f89f1,null))['catch'](handleError(_0x1f89f1,null));};exports[_0x0442('0x53')]=function(_0x3439f6,_0x5c3517,_0x112418){var _0x12c859={};var _0x4607cd={};var _0x2996ff;var _0x491950;return db[_0x0442('0x42')][_0x0442('0x4d')]({'where':{'id':_0x3439f6[_0x0442('0x46')]['id']}})[_0x0442('0x28')](handleEntityNotFound(_0x5c3517,null))[_0x0442('0x28')](function(_0x2de64d){if(_0x2de64d){_0x2996ff=_0x2de64d;_0x4607cd[_0x0442('0x36')]=_[_0x0442('0x33')](db[_0x0442('0x4e')][_0x0442('0x4f')]);_0x4607cd[_0x0442('0x32')]=_[_0x0442('0x33')](_0x3439f6[_0x0442('0x32')]);_0x4607cd[_0x0442('0x34')]=_['intersection'](_0x4607cd[_0x0442('0x36')],_0x4607cd['query']);_0x12c859[_0x0442('0x37')]=_[_0x0442('0x35')](_0x4607cd[_0x0442('0x36')],qs['fields'](_0x3439f6[_0x0442('0x32')][_0x0442('0x38')]));_0x12c859[_0x0442('0x37')]=_0x12c859['attributes'][_0x0442('0x47')]?_0x12c859[_0x0442('0x37')]:_0x4607cd['model'];_0x12c859['order']=qs[_0x0442('0x39')](_0x3439f6[_0x0442('0x32')][_0x0442('0x39')]);_0x12c859[_0x0442('0x3c')]=qs[_0x0442('0x34')](_[_0x0442('0x3a')](_0x3439f6['query'],_0x4607cd['filters']));if(_0x3439f6[_0x0442('0x32')]['filter']){_0x12c859[_0x0442('0x3c')]=_[_0x0442('0x3d')](_0x12c859[_0x0442('0x3c')],{'$or':_[_0x0442('0x2e')](_0x12c859[_0x0442('0x37')],function(_0x1d4570){var _0x21ccdb={};_0x21ccdb[_0x1d4570]={'$like':'%'+_0x3439f6['query'][_0x0442('0x3b')]+'%'};return _0x21ccdb;})});}_0x12c859=_['merge']({},_0x12c859,_0x3439f6[_0x0442('0x48')]);return _0x2996ff['getDescriptions'](_0x12c859);}})[_0x0442('0x28')](function(_0x184b2a){if(_0x184b2a){_0x491950=_0x184b2a[_0x0442('0x47')];if(!_0x3439f6[_0x0442('0x32')]['hasOwnProperty'](_0x0442('0x51'))){_0x12c859[_0x0442('0x20')]=qs[_0x0442('0x20')](_0x3439f6[_0x0442('0x32')][_0x0442('0x20')]);_0x12c859['offset']=qs[_0x0442('0x1e')](_0x3439f6[_0x0442('0x32')][_0x0442('0x1e')]);}return _0x2996ff[_0x0442('0x53')](_0x12c859);}})[_0x0442('0x28')](function(_0x16eea3){if(_0x16eea3){return _0x16eea3?{'count':_0x491950,'rows':_0x16eea3}:null;}})['then'](respondWithResult(_0x5c3517,null))[_0x0442('0x45')](handleError(_0x5c3517,null));}; \ No newline at end of file +var _0xa487=['api','../../config/environment','../../config/license/util','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','findOne','getFields','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3da99b,_0x89f38c){var _0x497c48=function(_0x25eee2){while(--_0x25eee2){_0x3da99b['push'](_0x3da99b['shift']());}};_0x497c48(++_0x89f38c);}(_0xa487,0x8f));var _0x7a48=function(_0x3ffa1f,_0x4665aa){_0x3ffa1f=_0x3ffa1f-0x0;var _0x321f40=_0xa487[_0x3ffa1f];return _0x321f40;};'use strict';var emlformat=require(_0x7a48('0x0'));var rimraf=require(_0x7a48('0x1'));var zipdir=require(_0x7a48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a48('0x3'));var moment=require(_0x7a48('0x4'));var BPromise=require(_0x7a48('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7a48('0x6'));var sox=require(_0x7a48('0x7'));var csv=require(_0x7a48('0x8'));var ejs=require(_0x7a48('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7a48('0xa'));var crypto=require(_0x7a48('0xb'));var jsforce=require(_0x7a48('0xc'));var deskjs=require(_0x7a48('0xd'));var toCsv=require(_0x7a48('0x8'));var querystring=require(_0x7a48('0xe'));var Papa=require(_0x7a48('0xf'));var Redis=require('ioredis');var authService=require(_0x7a48('0x10'));var qs=require(_0x7a48('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a48('0x12'));var logger=require('../../config/logger')(_0x7a48('0x13'));var utils=require('../../config/utils');var config=require(_0x7a48('0x14'));var licenseUtil=require(_0x7a48('0x15'));var db=require(_0x7a48('0x16'))['db'];function respondWithStatusCode(_0x1787aa,_0x5c5124){_0x5c5124=_0x5c5124||0xcc;return function(_0x4cbd99){if(_0x4cbd99){return _0x1787aa['sendStatus'](_0x5c5124);}return _0x1787aa['status'](_0x5c5124)['end']();};}function respondWithResult(_0x2eeb51,_0x1b8699){_0x1b8699=_0x1b8699||0xc8;return function(_0x2d811b){if(_0x2d811b){return _0x2eeb51['status'](_0x1b8699)[_0x7a48('0x17')](_0x2d811b);}};}function respondWithFilteredResult(_0x13601a,_0x538c1f){return function(_0x26b2b2){if(_0x26b2b2){var _0x4adc53=typeof _0x538c1f['offset']===_0x7a48('0x18')&&typeof _0x538c1f[_0x7a48('0x19')]===_0x7a48('0x18');var _0x555d00=_0x26b2b2[_0x7a48('0x1a')];var _0x1230fc=_0x4adc53?0x0:_0x538c1f[_0x7a48('0x1b')];var _0xd85a0=_0x4adc53?_0x26b2b2['count']:_0x538c1f[_0x7a48('0x1b')]+_0x538c1f['limit'];var _0x457d56;if(_0xd85a0>=_0x555d00){_0xd85a0=_0x555d00;_0x457d56=0xc8;}else{_0x457d56=0xce;}_0x13601a[_0x7a48('0x1c')](_0x457d56);return _0x13601a[_0x7a48('0x1d')](_0x7a48('0x1e'),_0x1230fc+'-'+_0xd85a0+'/'+_0x555d00)[_0x7a48('0x17')](_0x26b2b2);}return null;};}function patchUpdates(_0x29d6f9){return function(_0x4e8ee4){try{jsonpatch['apply'](_0x4e8ee4,_0x29d6f9,!![]);}catch(_0x221f56){return BPromise[_0x7a48('0x1f')](_0x221f56);}return _0x4e8ee4[_0x7a48('0x20')]();};}function saveUpdates(_0x1bacf8,_0xec0552){return function(_0x40d99b){if(_0x40d99b){return _0x40d99b[_0x7a48('0x21')](_0x1bacf8)[_0x7a48('0x22')](function(_0x1e9507){return _0x1e9507;});}return null;};}function removeEntity(_0x19a34f,_0x3c1613){return function(_0x55b806){if(_0x55b806){return _0x55b806[_0x7a48('0x23')]()[_0x7a48('0x22')](function(){_0x19a34f['status'](0xcc)[_0x7a48('0x24')]();});}};}function handleEntityNotFound(_0x512d3d,_0x27d156){return function(_0x2149bc){if(!_0x2149bc){_0x512d3d[_0x7a48('0x25')](0x194);}return _0x2149bc;};}function handleError(_0x1a1137,_0x13d3cd){_0x13d3cd=_0x13d3cd||0x1f4;return function(_0x26f58f){logger[_0x7a48('0x26')](_0x26f58f[_0x7a48('0x27')]);if(_0x26f58f[_0x7a48('0x28')]){delete _0x26f58f[_0x7a48('0x28')];}_0x1a1137[_0x7a48('0x1c')](_0x13d3cd)[_0x7a48('0x29')](_0x26f58f);};}exports[_0x7a48('0x2a')]=function(_0x176f8e,_0x1bbb5e){var _0xaff792={},_0x47b155={},_0x2b34f7={'count':0x0,'rows':[]};var _0x5a5b07=_[_0x7a48('0x2b')](db[_0x7a48('0x2c')]['rawAttributes'],function(_0xc0375f){return{'name':_0xc0375f[_0x7a48('0x2d')],'type':_0xc0375f[_0x7a48('0x2e')][_0x7a48('0x2f')]};});_0x47b155[_0x7a48('0x30')]=_['map'](_0x5a5b07,_0x7a48('0x28'));_0x47b155[_0x7a48('0x31')]=_[_0x7a48('0x32')](_0x176f8e[_0x7a48('0x31')]);_0x47b155['filters']=_[_0x7a48('0x33')](_0x47b155[_0x7a48('0x30')],_0x47b155['query']);_0xaff792['attributes']=_['intersection'](_0x47b155[_0x7a48('0x30')],qs[_0x7a48('0x34')](_0x176f8e['query'][_0x7a48('0x34')]));_0xaff792[_0x7a48('0x35')]=_0xaff792[_0x7a48('0x35')][_0x7a48('0x36')]?_0xaff792['attributes']:_0x47b155['model'];if(!_0x176f8e['query'][_0x7a48('0x37')](_0x7a48('0x38'))){_0xaff792[_0x7a48('0x19')]=qs[_0x7a48('0x19')](_0x176f8e[_0x7a48('0x31')]['limit']);_0xaff792[_0x7a48('0x1b')]=qs[_0x7a48('0x1b')](_0x176f8e['query'][_0x7a48('0x1b')]);}_0xaff792[_0x7a48('0x39')]=qs[_0x7a48('0x3a')](_0x176f8e['query']['sort']);_0xaff792[_0x7a48('0x3b')]=qs[_0x7a48('0x3c')](_[_0x7a48('0x3d')](_0x176f8e[_0x7a48('0x31')],_0x47b155[_0x7a48('0x3c')]),_0x5a5b07);if(_0x176f8e[_0x7a48('0x31')][_0x7a48('0x3e')]){_0xaff792[_0x7a48('0x3b')]=_['merge'](_0xaff792[_0x7a48('0x3b')],{'$or':_[_0x7a48('0x2b')](_0x5a5b07,function(_0x4002ab){if(_0x4002ab[_0x7a48('0x2e')]!==_0x7a48('0x3f')){var _0xa2a485={};_0xa2a485[_0x4002ab[_0x7a48('0x28')]]={'$like':'%'+_0x176f8e[_0x7a48('0x31')]['filter']+'%'};return _0xa2a485;}})});}_0xaff792=_[_0x7a48('0x40')]({},_0xaff792,_0x176f8e[_0x7a48('0x41')]);var _0x16fc69={'where':_0xaff792[_0x7a48('0x3b')]};return db[_0x7a48('0x2c')]['count'](_0x16fc69)['then'](function(_0xe31cf9){_0x2b34f7[_0x7a48('0x1a')]=_0xe31cf9;if(_0x176f8e[_0x7a48('0x31')][_0x7a48('0x42')]){_0xaff792[_0x7a48('0x43')]=[{'all':!![]}];}return db[_0x7a48('0x2c')]['findAll'](_0xaff792);})[_0x7a48('0x22')](function(_0x209404){_0x2b34f7[_0x7a48('0x44')]=_0x209404;return _0x2b34f7;})[_0x7a48('0x22')](respondWithFilteredResult(_0x1bbb5e,_0xaff792))[_0x7a48('0x45')](handleError(_0x1bbb5e,null));};exports[_0x7a48('0x46')]=function(_0x12eaad,_0x3da2e5){var _0x2c7725={'raw':![],'where':{'id':_0x12eaad[_0x7a48('0x47')]['id']}},_0x5b209f={};_0x5b209f[_0x7a48('0x30')]=_[_0x7a48('0x32')](db[_0x7a48('0x2c')][_0x7a48('0x48')]);_0x5b209f[_0x7a48('0x31')]=_[_0x7a48('0x32')](_0x12eaad[_0x7a48('0x31')]);_0x5b209f[_0x7a48('0x3c')]=_[_0x7a48('0x33')](_0x5b209f[_0x7a48('0x30')],_0x5b209f[_0x7a48('0x31')]);_0x2c7725[_0x7a48('0x35')]=_[_0x7a48('0x33')](_0x5b209f[_0x7a48('0x30')],qs[_0x7a48('0x34')](_0x12eaad['query']['fields']));_0x2c7725[_0x7a48('0x35')]=_0x2c7725[_0x7a48('0x35')][_0x7a48('0x36')]?_0x2c7725[_0x7a48('0x35')]:_0x5b209f[_0x7a48('0x30')];if(_0x12eaad[_0x7a48('0x31')][_0x7a48('0x42')]){_0x2c7725[_0x7a48('0x43')]=[{'all':!![]}];}_0x2c7725=_[_0x7a48('0x40')]({},_0x2c7725,_0x12eaad['options']);return db[_0x7a48('0x2c')][_0x7a48('0x49')](_0x2c7725)[_0x7a48('0x22')](handleEntityNotFound(_0x3da2e5,null))[_0x7a48('0x22')](respondWithResult(_0x3da2e5,null))['catch'](handleError(_0x3da2e5,null));};exports[_0x7a48('0x4a')]=function(_0x419bc8,_0x34cd27){return db['Dynamics365Configuration'][_0x7a48('0x4a')](_0x419bc8[_0x7a48('0x4b')],{})[_0x7a48('0x22')](respondWithResult(_0x34cd27,0xc9))[_0x7a48('0x45')](handleError(_0x34cd27,null));};exports[_0x7a48('0x21')]=function(_0x1981eb,_0x1fbf5f){if(_0x1981eb[_0x7a48('0x4b')]['id']){delete _0x1981eb[_0x7a48('0x4b')]['id'];}return db['Dynamics365Configuration'][_0x7a48('0x49')]({'where':{'id':_0x1981eb[_0x7a48('0x47')]['id']}})[_0x7a48('0x22')](handleEntityNotFound(_0x1fbf5f,null))[_0x7a48('0x22')](saveUpdates(_0x1981eb[_0x7a48('0x4b')],null))[_0x7a48('0x22')](respondWithResult(_0x1fbf5f,null))[_0x7a48('0x45')](handleError(_0x1fbf5f,null));};exports[_0x7a48('0x23')]=function(_0x8357aa,_0x248e02){return db[_0x7a48('0x2c')][_0x7a48('0x49')]({'where':{'id':_0x8357aa[_0x7a48('0x47')]['id']}})[_0x7a48('0x22')](handleEntityNotFound(_0x248e02,null))[_0x7a48('0x22')](removeEntity(_0x248e02,null))[_0x7a48('0x45')](handleError(_0x248e02,null));};exports['getFields']=function(_0x4998ba,_0x57c517,_0x261d8c){var _0x187ca2={};var _0x1e711d={};var _0x238109;var _0x3fb294;return db[_0x7a48('0x2c')][_0x7a48('0x4c')]({'where':{'id':_0x4998ba[_0x7a48('0x47')]['id']}})[_0x7a48('0x22')](handleEntityNotFound(_0x57c517,null))['then'](function(_0x333559){if(_0x333559){_0x238109=_0x333559;_0x1e711d[_0x7a48('0x30')]=_[_0x7a48('0x32')](db['Dynamics365Field'][_0x7a48('0x48')]);_0x1e711d[_0x7a48('0x31')]=_[_0x7a48('0x32')](_0x4998ba[_0x7a48('0x31')]);_0x1e711d[_0x7a48('0x3c')]=_[_0x7a48('0x33')](_0x1e711d[_0x7a48('0x30')],_0x1e711d['query']);_0x187ca2['attributes']=_[_0x7a48('0x33')](_0x1e711d[_0x7a48('0x30')],qs[_0x7a48('0x34')](_0x4998ba[_0x7a48('0x31')][_0x7a48('0x34')]));_0x187ca2[_0x7a48('0x35')]=_0x187ca2[_0x7a48('0x35')]['length']?_0x187ca2[_0x7a48('0x35')]:_0x1e711d[_0x7a48('0x30')];_0x187ca2[_0x7a48('0x39')]=qs[_0x7a48('0x3a')](_0x4998ba[_0x7a48('0x31')][_0x7a48('0x3a')]);_0x187ca2[_0x7a48('0x3b')]=qs['filters'](_['pick'](_0x4998ba[_0x7a48('0x31')],_0x1e711d[_0x7a48('0x3c')]));if(_0x4998ba[_0x7a48('0x31')][_0x7a48('0x3e')]){_0x187ca2['where']=_[_0x7a48('0x40')](_0x187ca2['where'],{'$or':_[_0x7a48('0x2b')](_0x187ca2[_0x7a48('0x35')],function(_0x297889){var _0x439c56={};_0x439c56[_0x297889]={'$like':'%'+_0x4998ba[_0x7a48('0x31')][_0x7a48('0x3e')]+'%'};return _0x439c56;})});}_0x187ca2=_[_0x7a48('0x40')]({},_0x187ca2,_0x4998ba['options']);return _0x238109[_0x7a48('0x4d')](_0x187ca2);}})[_0x7a48('0x22')](function(_0x358b25){if(_0x358b25){_0x3fb294=_0x358b25[_0x7a48('0x36')];if(!_0x4998ba[_0x7a48('0x31')][_0x7a48('0x37')](_0x7a48('0x38'))){_0x187ca2[_0x7a48('0x19')]=qs[_0x7a48('0x19')](_0x4998ba[_0x7a48('0x31')]['limit']);_0x187ca2[_0x7a48('0x1b')]=qs[_0x7a48('0x1b')](_0x4998ba[_0x7a48('0x31')][_0x7a48('0x1b')]);}return _0x238109['getFields'](_0x187ca2);}})['then'](function(_0x1c0745){if(_0x1c0745){return _0x1c0745?{'count':_0x3fb294,'rows':_0x1c0745}:null;}})['then'](respondWithResult(_0x57c517,null))[_0x7a48('0x45')](handleError(_0x57c517,null));};exports[_0x7a48('0x4e')]=function(_0x27590a,_0x313c73,_0x346c0d){var _0x1c90bd={};var _0x58f8a5={};var _0x32df87;var _0x47423d;return db[_0x7a48('0x2c')]['findOne']({'where':{'id':_0x27590a[_0x7a48('0x47')]['id']}})['then'](handleEntityNotFound(_0x313c73,null))[_0x7a48('0x22')](function(_0x377968){if(_0x377968){_0x32df87=_0x377968;_0x58f8a5[_0x7a48('0x30')]=_[_0x7a48('0x32')](db[_0x7a48('0x4f')][_0x7a48('0x48')]);_0x58f8a5[_0x7a48('0x31')]=_[_0x7a48('0x32')](_0x27590a['query']);_0x58f8a5[_0x7a48('0x3c')]=_['intersection'](_0x58f8a5['model'],_0x58f8a5[_0x7a48('0x31')]);_0x1c90bd[_0x7a48('0x35')]=_['intersection'](_0x58f8a5[_0x7a48('0x30')],qs['fields'](_0x27590a[_0x7a48('0x31')][_0x7a48('0x34')]));_0x1c90bd['attributes']=_0x1c90bd[_0x7a48('0x35')]['length']?_0x1c90bd['attributes']:_0x58f8a5[_0x7a48('0x30')];_0x1c90bd[_0x7a48('0x39')]=qs['sort'](_0x27590a['query'][_0x7a48('0x3a')]);_0x1c90bd[_0x7a48('0x3b')]=qs[_0x7a48('0x3c')](_[_0x7a48('0x3d')](_0x27590a[_0x7a48('0x31')],_0x58f8a5['filters']));if(_0x27590a[_0x7a48('0x31')]['filter']){_0x1c90bd['where']=_[_0x7a48('0x40')](_0x1c90bd[_0x7a48('0x3b')],{'$or':_[_0x7a48('0x2b')](_0x1c90bd[_0x7a48('0x35')],function(_0xda447b){var _0xd6ef3b={};_0xd6ef3b[_0xda447b]={'$like':'%'+_0x27590a[_0x7a48('0x31')][_0x7a48('0x3e')]+'%'};return _0xd6ef3b;})});}_0x1c90bd=_['merge']({},_0x1c90bd,_0x27590a['options']);return _0x32df87[_0x7a48('0x4e')](_0x1c90bd);}})[_0x7a48('0x22')](function(_0x1065f6){if(_0x1065f6){_0x47423d=_0x1065f6[_0x7a48('0x36')];if(!_0x27590a['query']['hasOwnProperty'](_0x7a48('0x38'))){_0x1c90bd[_0x7a48('0x19')]=qs['limit'](_0x27590a['query'][_0x7a48('0x19')]);_0x1c90bd[_0x7a48('0x1b')]=qs[_0x7a48('0x1b')](_0x27590a[_0x7a48('0x31')]['offset']);}return _0x32df87['getSubjects'](_0x1c90bd);}})[_0x7a48('0x22')](function(_0xa6c7c3){if(_0xa6c7c3){return _0xa6c7c3?{'count':_0x47423d,'rows':_0xa6c7c3}:null;}})[_0x7a48('0x22')](respondWithResult(_0x313c73,null))[_0x7a48('0x45')](handleError(_0x313c73,null));};exports[_0x7a48('0x50')]=function(_0x49ad05,_0x20c080,_0x4ece42){var _0x216677={};var _0x3d4fa5={};var _0x1c77ba;var _0x46fc0a;return db[_0x7a48('0x2c')][_0x7a48('0x4c')]({'where':{'id':_0x49ad05[_0x7a48('0x47')]['id']}})[_0x7a48('0x22')](handleEntityNotFound(_0x20c080,null))[_0x7a48('0x22')](function(_0x26e891){if(_0x26e891){_0x1c77ba=_0x26e891;_0x3d4fa5[_0x7a48('0x30')]=_[_0x7a48('0x32')](db['Dynamics365Field']['rawAttributes']);_0x3d4fa5[_0x7a48('0x31')]=_[_0x7a48('0x32')](_0x49ad05[_0x7a48('0x31')]);_0x3d4fa5['filters']=_[_0x7a48('0x33')](_0x3d4fa5[_0x7a48('0x30')],_0x3d4fa5[_0x7a48('0x31')]);_0x216677[_0x7a48('0x35')]=_['intersection'](_0x3d4fa5[_0x7a48('0x30')],qs[_0x7a48('0x34')](_0x49ad05[_0x7a48('0x31')][_0x7a48('0x34')]));_0x216677['attributes']=_0x216677[_0x7a48('0x35')][_0x7a48('0x36')]?_0x216677['attributes']:_0x3d4fa5[_0x7a48('0x30')];_0x216677['order']=qs[_0x7a48('0x3a')](_0x49ad05['query'][_0x7a48('0x3a')]);_0x216677[_0x7a48('0x3b')]=qs[_0x7a48('0x3c')](_['pick'](_0x49ad05[_0x7a48('0x31')],_0x3d4fa5[_0x7a48('0x3c')]));if(_0x49ad05[_0x7a48('0x31')][_0x7a48('0x3e')]){_0x216677[_0x7a48('0x3b')]=_[_0x7a48('0x40')](_0x216677[_0x7a48('0x3b')],{'$or':_[_0x7a48('0x2b')](_0x216677['attributes'],function(_0xc06154){var _0x3b1b2c={};_0x3b1b2c[_0xc06154]={'$like':'%'+_0x49ad05[_0x7a48('0x31')][_0x7a48('0x3e')]+'%'};return _0x3b1b2c;})});}_0x216677=_[_0x7a48('0x40')]({},_0x216677,_0x49ad05['options']);return _0x1c77ba[_0x7a48('0x50')](_0x216677);}})[_0x7a48('0x22')](function(_0xe2ca19){if(_0xe2ca19){_0x46fc0a=_0xe2ca19[_0x7a48('0x36')];if(!_0x49ad05[_0x7a48('0x31')]['hasOwnProperty']('nolimit')){_0x216677[_0x7a48('0x19')]=qs[_0x7a48('0x19')](_0x49ad05[_0x7a48('0x31')][_0x7a48('0x19')]);_0x216677[_0x7a48('0x1b')]=qs[_0x7a48('0x1b')](_0x49ad05[_0x7a48('0x31')][_0x7a48('0x1b')]);}return _0x1c77ba[_0x7a48('0x50')](_0x216677);}})[_0x7a48('0x22')](function(_0x9eb2c0){if(_0x9eb2c0){return _0x9eb2c0?{'count':_0x46fc0a,'rows':_0x9eb2c0}:null;}})[_0x7a48('0x22')](respondWithResult(_0x20c080,null))['catch'](handleError(_0x20c080,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index dcc3d29..7e868f8 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x124b99,_0x3b49f9){var _0x5d0bfb=function(_0x9216a4){while(--_0x9216a4){_0x124b99['push'](_0x124b99['shift']());}};_0x5d0bfb(++_0x3b49f9);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xb4e6[_0x40d8d7];return _0x3454cc;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4db3aa,_0x151d32){var _0x2d9f03=function(_0x4b2f23){while(--_0x4b2f23){_0x4db3aa['push'](_0x4db3aa['shift']());}};_0x2d9f03(++_0x151d32);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x230b05,_0x14f244){_0x230b05=_0x230b05-0x0;var _0x1cfc4c=_0xd6d6[_0x230b05];return _0x1cfc4c;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'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 058ef2c..69704dc 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 _0x45cf=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3337ca,_0x4b4423){var _0x202505=function(_0x43a37e){while(--_0x43a37e){_0x3337ca['push'](_0x3337ca['shift']());}};_0x202505(++_0x4b4423);}(_0x45cf,0xbd));var _0xf45c=function(_0x50b4f5,_0x1220a9){_0x50b4f5=_0x50b4f5-0x0;var _0x34e486=_0x45cf[_0x50b4f5];return _0x34e486;};'use strict';var _=require(_0xf45c('0x0'));var util=require(_0xf45c('0x1'));var moment=require(_0xf45c('0x2'));var BPromise=require(_0xf45c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf45c('0x4'));var db=require(_0xf45c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf45c('0x6'))(_0xf45c('0x7'));var config=require(_0xf45c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf45c('0x9')][_0xf45c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51e03c,_0x56e92c,_0x334c38){return new BPromise(function(_0x4cf9a3,_0xa1043b){return client[_0xf45c('0xb')](_0x51e03c,_0x334c38)['then'](function(_0x4469e4){logger[_0xf45c('0xc')](_0xf45c('0xd'),_0x56e92c,_0xf45c('0xe'));logger[_0xf45c('0xf')](_0xf45c('0x10'),_0x56e92c,_0xf45c('0xe'),JSON[_0xf45c('0x11')](_0x4469e4));if(_0x4469e4[_0xf45c('0x12')]){if(_0x4469e4[_0xf45c('0x12')][_0xf45c('0x13')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x56e92c,_0x4469e4[_0xf45c('0x12')][_0xf45c('0x14')]);return _0xa1043b(_0x4469e4['error'][_0xf45c('0x14')]);}logger[_0xf45c('0x12')](_0xf45c('0xd'),_0x56e92c,_0x4469e4[_0xf45c('0x12')][_0xf45c('0x14')]);return _0x4cf9a3(_0x4469e4[_0xf45c('0x12')][_0xf45c('0x14')]);}else{logger[_0xf45c('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x56e92c,_0xf45c('0xe'));_0x4cf9a3(_0x4469e4[_0xf45c('0x15')][_0xf45c('0x14')]);}})[_0xf45c('0x16')](function(_0x56f258){logger[_0xf45c('0x12')](_0xf45c('0xd'),_0x56e92c,_0x56f258);_0xa1043b(_0x56f258);});});} \ No newline at end of file +var _0x3c4c=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug'];(function(_0x36c230,_0x1c7cfd){var _0x321e0e=function(_0xf13413){while(--_0xf13413){_0x36c230['push'](_0x36c230['shift']());}};_0x321e0e(++_0x1c7cfd);}(_0x3c4c,0x68));var _0xc3c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3c4c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc3c4('0x0'));var util=require(_0xc3c4('0x1'));var moment=require(_0xc3c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3c4('0x3'));var fs=require('fs');var Redis=require(_0xc3c4('0x4'));var db=require(_0xc3c4('0x5'))['db'];var utils=require(_0xc3c4('0x6'));var logger=require(_0xc3c4('0x7'))(_0xc3c4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc3c4('0x9'));var client=jayson[_0xc3c4('0xa')][_0xc3c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28a1cb,_0x16e116,_0x4adfa9){return new BPromise(function(_0x346380,_0x2ecf0a){return client['request'](_0x28a1cb,_0x4adfa9)[_0xc3c4('0xc')](function(_0x4f9308){logger[_0xc3c4('0xd')](_0xc3c4('0xe'),_0x16e116,'request\x20sent');logger[_0xc3c4('0xf')](_0xc3c4('0x10'),_0x16e116,_0xc3c4('0x11'),JSON[_0xc3c4('0x12')](_0x4f9308));if(_0x4f9308[_0xc3c4('0x13')]){if(_0x4f9308[_0xc3c4('0x13')][_0xc3c4('0x14')]===0x1f4){logger[_0xc3c4('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x16e116,_0x4f9308['error']['message']);return _0x2ecf0a(_0x4f9308[_0xc3c4('0x13')]['message']);}logger[_0xc3c4('0x13')](_0xc3c4('0xe'),_0x16e116,_0x4f9308[_0xc3c4('0x13')][_0xc3c4('0x15')]);return _0x346380(_0x4f9308['error'][_0xc3c4('0x15')]);}else{logger[_0xc3c4('0xd')](_0xc3c4('0xe'),_0x16e116,_0xc3c4('0x11'));_0x346380(_0x4f9308[_0xc3c4('0x16')][_0xc3c4('0x15')]);}})[_0xc3c4('0x17')](function(_0x520aae){logger[_0xc3c4('0x13')](_0xc3c4('0xe'),_0x16e116,_0x520aae);_0x2ecf0a(_0x520aae);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index db4a15d..bb290c9 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 _0x7435=['put','delete','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x383b2e,_0x30abd6){var _0x56a2b9=function(_0x160239){while(--_0x160239){_0x383b2e['push'](_0x383b2e['shift']());}};_0x56a2b9(++_0x30abd6);}(_0x7435,0x157));var _0x5743=function(_0x59cf5e,_0x36edbf){_0x59cf5e=_0x59cf5e-0x0;var _0x17ef1d=_0x7435[_0x59cf5e];return _0x17ef1d;};'use strict';var multer=require(_0x5743('0x0'));var util=require(_0x5743('0x1'));var path=require(_0x5743('0x2'));var timeout=require('connect-timeout');var express=require(_0x5743('0x3'));var router=express['Router']();var fs_extra=require(_0x5743('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5743('0x5'));var config=require('../../config/environment');var controller=require(_0x5743('0x6'));router[_0x5743('0x7')]('/',auth['isAuthenticated'](),controller[_0x5743('0x8')]);router['get'](_0x5743('0x9'),auth[_0x5743('0xa')](),controller[_0x5743('0xb')]);router[_0x5743('0xc')]('/',auth[_0x5743('0xa')](),controller[_0x5743('0xd')]);router[_0x5743('0xe')](_0x5743('0x9'),auth[_0x5743('0xa')](),controller['update']);router[_0x5743('0xf')](_0x5743('0x9'),auth[_0x5743('0xa')](),controller['destroy']);module[_0x5743('0x10')]=router; \ No newline at end of file +var _0x1ae1=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id'];(function(_0x3b1d3b,_0x172e9c){var _0x262949=function(_0x35d91a){while(--_0x35d91a){_0x3b1d3b['push'](_0x3b1d3b['shift']());}};_0x262949(++_0x172e9c);}(_0x1ae1,0xea));var _0x11ae=function(_0xa498ef,_0x222002){_0xa498ef=_0xa498ef-0x0;var _0x2dc9c6=_0x1ae1[_0xa498ef];return _0x2dc9c6;};'use strict';var multer=require(_0x11ae('0x0'));var util=require(_0x11ae('0x1'));var path=require(_0x11ae('0x2'));var timeout=require(_0x11ae('0x3'));var express=require(_0x11ae('0x4'));var router=express[_0x11ae('0x5')]();var fs_extra=require(_0x11ae('0x6'));var auth=require(_0x11ae('0x7'));var interaction=require(_0x11ae('0x8'));var config=require(_0x11ae('0x9'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x11ae('0xa')](),controller[_0x11ae('0xb')]);router[_0x11ae('0xc')]('/:id',auth[_0x11ae('0xa')](),controller[_0x11ae('0xd')]);router[_0x11ae('0xe')]('/',auth['isAuthenticated'](),controller[_0x11ae('0xf')]);router[_0x11ae('0x10')](_0x11ae('0x11'),auth[_0x11ae('0xa')](),controller[_0x11ae('0x12')]);router[_0x11ae('0x13')]('/:id',auth[_0x11ae('0xa')](),controller[_0x11ae('0x14')]);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 5ae1375..5e3b3f5 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 _0xd6b4=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x3f9b9e,_0x209ec4){var _0x4d4270=function(_0x396fbd){while(--_0x396fbd){_0x3f9b9e['push'](_0x3f9b9e['shift']());}};_0x4d4270(++_0x209ec4);}(_0xd6b4,0x181));var _0x4d6b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd6b4[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x4d6b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x4d6b('0x1'),_0x4d6b('0x2'),_0x4d6b('0x3'),_0x4d6b('0x4'),_0x4d6b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4d6b('0x6')]},'key':{'type':Sequelize[_0x4d6b('0x6')]},'keyType':{'type':Sequelize[_0x4d6b('0x7')](_0x4d6b('0x1'),'variable',_0x4d6b('0x3'))},'keyContent':{'type':Sequelize[_0x4d6b('0x6')]},'idField':{'type':Sequelize[_0x4d6b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4d6b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x579d=['string','customVariable','picklist','STRING','exports','ENUM'];(function(_0xa001e9,_0x5c29c1){var _0xb5307e=function(_0x3426ea){while(--_0x3426ea){_0xa001e9['push'](_0xa001e9['shift']());}};_0xb5307e(++_0x5c29c1);}(_0x579d,0xe2));var _0xd579=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x579d[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');module[_0xd579('0x0')]={'type':{'type':Sequelize[_0xd579('0x1')](_0xd579('0x2'),'variable',_0xd579('0x3'),'keyValue',_0xd579('0x4')),'defaultValue':_0xd579('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd579('0x5')]},'keyType':{'type':Sequelize[_0xd579('0x1')](_0xd579('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xd579('0x5')]},'idField':{'type':Sequelize[_0xd579('0x5')]},'nameField':{'type':Sequelize[_0xd579('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd579('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index fb16779..44fe74e 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 _0xb1cb=['request-promise','moment','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','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','fields','create','body','catch','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb1cb,0x96));var _0xbb1c=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb1cb[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require(_0xbb1c('0x0'));var rimraf=require(_0xbb1c('0x1'));var zipdir=require(_0xbb1c('0x2'));var jsonpatch=require(_0xbb1c('0x3'));var rp=require(_0xbb1c('0x4'));var moment=require(_0xbb1c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb1c('0x6'));var util=require(_0xbb1c('0x7'));var path=require(_0xbb1c('0x8'));var sox=require(_0xbb1c('0x9'));var csv=require(_0xbb1c('0xa'));var ejs=require(_0xbb1c('0xb'));var fs=require('fs');var fs_extra=require(_0xbb1c('0xc'));var _=require('lodash');var squel=require(_0xbb1c('0xd'));var crypto=require(_0xbb1c('0xe'));var jsforce=require(_0xbb1c('0xf'));var deskjs=require(_0xbb1c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbb1c('0x11'));var Papa=require(_0xbb1c('0x12'));var Redis=require(_0xbb1c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbb1c('0x14'));var as=require(_0xbb1c('0x15'));var hardwareService=require(_0xbb1c('0x16'));var logger=require(_0xbb1c('0x17'))(_0xbb1c('0x18'));var utils=require(_0xbb1c('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bbbc8,_0xb0f49e){_0xb0f49e=_0xb0f49e||0xcc;return function(_0x3c9ec9){if(_0x3c9ec9){return _0x3bbbc8[_0xbb1c('0x1a')](_0xb0f49e);}return _0x3bbbc8[_0xbb1c('0x1b')](_0xb0f49e)[_0xbb1c('0x1c')]();};}function respondWithResult(_0x49566e,_0x2b8fc4){_0x2b8fc4=_0x2b8fc4||0xc8;return function(_0x5abe19){if(_0x5abe19){return _0x49566e[_0xbb1c('0x1b')](_0x2b8fc4)[_0xbb1c('0x1d')](_0x5abe19);}};}function respondWithFilteredResult(_0x283364,_0x4e54dc){return function(_0x2fe46d){if(_0x2fe46d){var _0x5a5922=typeof _0x4e54dc['offset']==='undefined'&&typeof _0x4e54dc['limit']===_0xbb1c('0x1e');var _0x4b6b33=_0x2fe46d[_0xbb1c('0x1f')];var _0x36d709=_0x5a5922?0x0:_0x4e54dc[_0xbb1c('0x20')];var _0x163251=_0x5a5922?_0x2fe46d['count']:_0x4e54dc[_0xbb1c('0x20')]+_0x4e54dc[_0xbb1c('0x21')];var _0x1d0c0a;if(_0x163251>=_0x4b6b33){_0x163251=_0x4b6b33;_0x1d0c0a=0xc8;}else{_0x1d0c0a=0xce;}_0x283364[_0xbb1c('0x1b')](_0x1d0c0a);return _0x283364[_0xbb1c('0x22')](_0xbb1c('0x23'),_0x36d709+'-'+_0x163251+'/'+_0x4b6b33)[_0xbb1c('0x1d')](_0x2fe46d);}return null;};}function patchUpdates(_0x1fefd5){return function(_0x135853){try{jsonpatch[_0xbb1c('0x24')](_0x135853,_0x1fefd5,!![]);}catch(_0x37f9fe){return BPromise[_0xbb1c('0x25')](_0x37f9fe);}return _0x135853[_0xbb1c('0x26')]();};}function saveUpdates(_0x4d5bcf,_0x2ebd61){return function(_0x4c8cdc){if(_0x4c8cdc){return _0x4c8cdc[_0xbb1c('0x27')](_0x4d5bcf)['then'](function(_0x18dba6){return _0x18dba6;});}return null;};}function removeEntity(_0x5cf040,_0x1d7f02){return function(_0x2f76f4){if(_0x2f76f4){return _0x2f76f4['destroy']()[_0xbb1c('0x28')](function(){_0x5cf040['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e3f77,_0xd4089d){return function(_0x354b11){if(!_0x354b11){_0x3e3f77[_0xbb1c('0x1a')](0x194);}return _0x354b11;};}function handleError(_0x443dea,_0x43bef9){_0x43bef9=_0x43bef9||0x1f4;return function(_0xa91aeb){logger[_0xbb1c('0x29')](_0xa91aeb['stack']);if(_0xa91aeb[_0xbb1c('0x2a')]){delete _0xa91aeb[_0xbb1c('0x2a')];}_0x443dea[_0xbb1c('0x1b')](_0x43bef9)[_0xbb1c('0x2b')](_0xa91aeb);};}exports[_0xbb1c('0x2c')]=function(_0x2f6338,_0x239800){var _0x46a4bc={},_0x38fdbd={},_0x804a16={'count':0x0,'rows':[]};var _0x25f652=_[_0xbb1c('0x2d')](db[_0xbb1c('0x2e')][_0xbb1c('0x2f')],function(_0x32d8f2){return{'name':_0x32d8f2[_0xbb1c('0x30')],'type':_0x32d8f2[_0xbb1c('0x31')][_0xbb1c('0x32')]};});_0x38fdbd[_0xbb1c('0x33')]=_[_0xbb1c('0x2d')](_0x25f652,_0xbb1c('0x2a'));_0x38fdbd['query']=_[_0xbb1c('0x34')](_0x2f6338['query']);_0x38fdbd[_0xbb1c('0x35')]=_['intersection'](_0x38fdbd[_0xbb1c('0x33')],_0x38fdbd[_0xbb1c('0x36')]);_0x46a4bc[_0xbb1c('0x37')]=_[_0xbb1c('0x38')](_0x38fdbd['model'],qs['fields'](_0x2f6338[_0xbb1c('0x36')]['fields']));_0x46a4bc[_0xbb1c('0x37')]=_0x46a4bc[_0xbb1c('0x37')][_0xbb1c('0x39')]?_0x46a4bc[_0xbb1c('0x37')]:_0x38fdbd[_0xbb1c('0x33')];if(!_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x3a')](_0xbb1c('0x3b'))){_0x46a4bc[_0xbb1c('0x21')]=qs['limit'](_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x21')]);_0x46a4bc[_0xbb1c('0x20')]=qs[_0xbb1c('0x20')](_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x20')]);}_0x46a4bc[_0xbb1c('0x3c')]=qs[_0xbb1c('0x3d')](_0x2f6338['query'][_0xbb1c('0x3d')]);_0x46a4bc[_0xbb1c('0x3e')]=qs['filters'](_[_0xbb1c('0x3f')](_0x2f6338['query'],_0x38fdbd['filters']),_0x25f652);if(_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x40')]){_0x46a4bc[_0xbb1c('0x3e')]=_[_0xbb1c('0x41')](_0x46a4bc['where'],{'$or':_[_0xbb1c('0x2d')](_0x25f652,function(_0x384af0){if(_0x384af0[_0xbb1c('0x31')]!=='VIRTUAL'){var _0x31d998={};_0x31d998[_0x384af0[_0xbb1c('0x2a')]]={'$like':'%'+_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x40')]+'%'};return _0x31d998;}})});}_0x46a4bc=_[_0xbb1c('0x41')]({},_0x46a4bc,_0x2f6338[_0xbb1c('0x42')]);var _0x1331b5={'where':_0x46a4bc[_0xbb1c('0x3e')]};return db[_0xbb1c('0x2e')][_0xbb1c('0x1f')](_0x1331b5)[_0xbb1c('0x28')](function(_0x27b49d){_0x804a16[_0xbb1c('0x1f')]=_0x27b49d;if(_0x2f6338[_0xbb1c('0x36')][_0xbb1c('0x43')]){_0x46a4bc[_0xbb1c('0x44')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x46a4bc);})[_0xbb1c('0x28')](function(_0x449a2e){_0x804a16['rows']=_0x449a2e;return _0x804a16;})[_0xbb1c('0x28')](respondWithFilteredResult(_0x239800,_0x46a4bc))['catch'](handleError(_0x239800,null));};exports[_0xbb1c('0x45')]=function(_0x25c92d,_0x54d226){var _0x55d2df={'raw':!![],'where':{'id':_0x25c92d[_0xbb1c('0x46')]['id']}},_0x296afd={};_0x296afd[_0xbb1c('0x33')]=_[_0xbb1c('0x34')](db[_0xbb1c('0x2e')]['rawAttributes']);_0x296afd[_0xbb1c('0x36')]=_[_0xbb1c('0x34')](_0x25c92d[_0xbb1c('0x36')]);_0x296afd[_0xbb1c('0x35')]=_[_0xbb1c('0x38')](_0x296afd['model'],_0x296afd[_0xbb1c('0x36')]);_0x55d2df[_0xbb1c('0x37')]=_['intersection'](_0x296afd[_0xbb1c('0x33')],qs[_0xbb1c('0x47')](_0x25c92d['query'][_0xbb1c('0x47')]));_0x55d2df['attributes']=_0x55d2df[_0xbb1c('0x37')][_0xbb1c('0x39')]?_0x55d2df[_0xbb1c('0x37')]:_0x296afd[_0xbb1c('0x33')];if(_0x25c92d[_0xbb1c('0x36')][_0xbb1c('0x43')]){_0x55d2df[_0xbb1c('0x44')]=[{'all':!![]}];}_0x55d2df=_['merge']({},_0x55d2df,_0x25c92d[_0xbb1c('0x42')]);return db['Dynamics365Field']['find'](_0x55d2df)['then'](handleEntityNotFound(_0x54d226,null))['then'](respondWithResult(_0x54d226,null))['catch'](handleError(_0x54d226,null));};exports[_0xbb1c('0x48')]=function(_0x15f2e9,_0x570097){return db[_0xbb1c('0x2e')][_0xbb1c('0x48')](_0x15f2e9[_0xbb1c('0x49')],{})[_0xbb1c('0x28')](respondWithResult(_0x570097,0xc9))[_0xbb1c('0x4a')](handleError(_0x570097,null));};exports['update']=function(_0x3c1a65,_0x1f78e1){if(_0x3c1a65['body']['id']){delete _0x3c1a65['body']['id'];}return db[_0xbb1c('0x2e')][_0xbb1c('0x4b')]({'where':{'id':_0x3c1a65[_0xbb1c('0x46')]['id']}})[_0xbb1c('0x28')](handleEntityNotFound(_0x1f78e1,null))[_0xbb1c('0x28')](saveUpdates(_0x3c1a65[_0xbb1c('0x49')],null))['then'](respondWithResult(_0x1f78e1,null))[_0xbb1c('0x4a')](handleError(_0x1f78e1,null));};exports[_0xbb1c('0x4c')]=function(_0x4c9f12,_0x54fc6e){return db[_0xbb1c('0x2e')][_0xbb1c('0x4b')]({'where':{'id':_0x4c9f12[_0xbb1c('0x46')]['id']}})[_0xbb1c('0x28')](handleEntityNotFound(_0x54fc6e,null))['then'](removeEntity(_0x54fc6e,null))[_0xbb1c('0x4a')](handleError(_0x54fc6e,null));}; \ No newline at end of file +var _0x9a44=['lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','body','update','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x2806b8,_0x1d8aa4){var _0x23a6af=function(_0x199ba7){while(--_0x199ba7){_0x2806b8['push'](_0x2806b8['shift']());}};_0x23a6af(++_0x1d8aa4);}(_0x9a44,0x80));var _0x49a4=function(_0x468cd2,_0x2c74ae){_0x468cd2=_0x468cd2-0x0;var _0x4fd6ad=_0x9a44[_0x468cd2];return _0x4fd6ad;};'use strict';var emlformat=require(_0x49a4('0x0'));var rimraf=require(_0x49a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49a4('0x2'));var rp=require('request-promise');var moment=require(_0x49a4('0x3'));var BPromise=require(_0x49a4('0x4'));var Mustache=require('mustache');var util=require(_0x49a4('0x5'));var path=require(_0x49a4('0x6'));var sox=require('sox');var csv=require(_0x49a4('0x7'));var ejs=require(_0x49a4('0x8'));var fs=require('fs');var fs_extra=require(_0x49a4('0x9'));var _=require(_0x49a4('0xa'));var squel=require(_0x49a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x49a4('0xc'));var deskjs=require(_0x49a4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49a4('0xe'));var Redis=require('ioredis');var authService=require(_0x49a4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x49a4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49a4('0x11'))('api');var utils=require(_0x49a4('0x12'));var config=require(_0x49a4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x49a4('0x14'))['db'];function respondWithStatusCode(_0x581a9e,_0x18938d){_0x18938d=_0x18938d||0xcc;return function(_0x4d910d){if(_0x4d910d){return _0x581a9e[_0x49a4('0x15')](_0x18938d);}return _0x581a9e[_0x49a4('0x16')](_0x18938d)['end']();};}function respondWithResult(_0x373235,_0x1ec7eb){_0x1ec7eb=_0x1ec7eb||0xc8;return function(_0x4caeec){if(_0x4caeec){return _0x373235[_0x49a4('0x16')](_0x1ec7eb)[_0x49a4('0x17')](_0x4caeec);}};}function respondWithFilteredResult(_0x2d1c48,_0x596d1c){return function(_0xdf326b){if(_0xdf326b){var _0x416df0=typeof _0x596d1c[_0x49a4('0x18')]===_0x49a4('0x19')&&typeof _0x596d1c[_0x49a4('0x1a')]===_0x49a4('0x19');var _0x68e892=_0xdf326b[_0x49a4('0x1b')];var _0x543cb1=_0x416df0?0x0:_0x596d1c[_0x49a4('0x18')];var _0x30616e=_0x416df0?_0xdf326b[_0x49a4('0x1b')]:_0x596d1c['offset']+_0x596d1c[_0x49a4('0x1a')];var _0x2c1f8e;if(_0x30616e>=_0x68e892){_0x30616e=_0x68e892;_0x2c1f8e=0xc8;}else{_0x2c1f8e=0xce;}_0x2d1c48[_0x49a4('0x16')](_0x2c1f8e);return _0x2d1c48['set'](_0x49a4('0x1c'),_0x543cb1+'-'+_0x30616e+'/'+_0x68e892)[_0x49a4('0x17')](_0xdf326b);}return null;};}function patchUpdates(_0x4f547e){return function(_0x5278f6){try{jsonpatch[_0x49a4('0x1d')](_0x5278f6,_0x4f547e,!![]);}catch(_0x8217a6){return BPromise[_0x49a4('0x1e')](_0x8217a6);}return _0x5278f6['save']();};}function saveUpdates(_0x1d13dd,_0xf25f91){return function(_0x38fb53){if(_0x38fb53){return _0x38fb53['update'](_0x1d13dd)[_0x49a4('0x1f')](function(_0xf9abcd){return _0xf9abcd;});}return null;};}function removeEntity(_0x49ef59,_0x582c71){return function(_0x105a9d){if(_0x105a9d){return _0x105a9d['destroy']()[_0x49a4('0x1f')](function(){_0x49ef59[_0x49a4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1084a1,_0x143a43){return function(_0x1fc2e2){if(!_0x1fc2e2){_0x1084a1[_0x49a4('0x15')](0x194);}return _0x1fc2e2;};}function handleError(_0x1abaa2,_0x5b3325){_0x5b3325=_0x5b3325||0x1f4;return function(_0x15b98e){logger[_0x49a4('0x20')](_0x15b98e[_0x49a4('0x21')]);if(_0x15b98e['name']){delete _0x15b98e[_0x49a4('0x22')];}_0x1abaa2[_0x49a4('0x16')](_0x5b3325)[_0x49a4('0x23')](_0x15b98e);};}exports['index']=function(_0x4bb4d4,_0x18fd58){var _0x134b3e={},_0x2f1a79={},_0x4ddc16={'count':0x0,'rows':[]};var _0x22ac64=_[_0x49a4('0x24')](db[_0x49a4('0x25')][_0x49a4('0x26')],function(_0x2a4755){return{'name':_0x2a4755[_0x49a4('0x27')],'type':_0x2a4755['type'][_0x49a4('0x28')]};});_0x2f1a79[_0x49a4('0x29')]=_[_0x49a4('0x24')](_0x22ac64,_0x49a4('0x22'));_0x2f1a79[_0x49a4('0x2a')]=_[_0x49a4('0x2b')](_0x4bb4d4[_0x49a4('0x2a')]);_0x2f1a79[_0x49a4('0x2c')]=_[_0x49a4('0x2d')](_0x2f1a79[_0x49a4('0x29')],_0x2f1a79[_0x49a4('0x2a')]);_0x134b3e[_0x49a4('0x2e')]=_[_0x49a4('0x2d')](_0x2f1a79['model'],qs[_0x49a4('0x2f')](_0x4bb4d4['query'][_0x49a4('0x2f')]));_0x134b3e[_0x49a4('0x2e')]=_0x134b3e[_0x49a4('0x2e')][_0x49a4('0x30')]?_0x134b3e['attributes']:_0x2f1a79[_0x49a4('0x29')];if(!_0x4bb4d4[_0x49a4('0x2a')]['hasOwnProperty'](_0x49a4('0x31'))){_0x134b3e[_0x49a4('0x1a')]=qs['limit'](_0x4bb4d4[_0x49a4('0x2a')][_0x49a4('0x1a')]);_0x134b3e[_0x49a4('0x18')]=qs['offset'](_0x4bb4d4[_0x49a4('0x2a')][_0x49a4('0x18')]);}_0x134b3e[_0x49a4('0x32')]=qs[_0x49a4('0x33')](_0x4bb4d4['query'][_0x49a4('0x33')]);_0x134b3e[_0x49a4('0x34')]=qs[_0x49a4('0x2c')](_[_0x49a4('0x35')](_0x4bb4d4[_0x49a4('0x2a')],_0x2f1a79['filters']),_0x22ac64);if(_0x4bb4d4[_0x49a4('0x2a')][_0x49a4('0x36')]){_0x134b3e[_0x49a4('0x34')]=_[_0x49a4('0x37')](_0x134b3e[_0x49a4('0x34')],{'$or':_[_0x49a4('0x24')](_0x22ac64,function(_0x55c905){if(_0x55c905[_0x49a4('0x38')]!==_0x49a4('0x39')){var _0x2e00ae={};_0x2e00ae[_0x55c905[_0x49a4('0x22')]]={'$like':'%'+_0x4bb4d4['query']['filter']+'%'};return _0x2e00ae;}})});}_0x134b3e=_[_0x49a4('0x37')]({},_0x134b3e,_0x4bb4d4[_0x49a4('0x3a')]);var _0x336ab9={'where':_0x134b3e[_0x49a4('0x34')]};return db[_0x49a4('0x25')][_0x49a4('0x1b')](_0x336ab9)[_0x49a4('0x1f')](function(_0x1ce195){_0x4ddc16[_0x49a4('0x1b')]=_0x1ce195;if(_0x4bb4d4['query'][_0x49a4('0x3b')]){_0x134b3e[_0x49a4('0x3c')]=[{'all':!![]}];}return db[_0x49a4('0x25')][_0x49a4('0x3d')](_0x134b3e);})[_0x49a4('0x1f')](function(_0xcfbb73){_0x4ddc16[_0x49a4('0x3e')]=_0xcfbb73;return _0x4ddc16;})['then'](respondWithFilteredResult(_0x18fd58,_0x134b3e))['catch'](handleError(_0x18fd58,null));};exports[_0x49a4('0x3f')]=function(_0x52c239,_0x4c59f7){var _0x34cff5={'raw':!![],'where':{'id':_0x52c239['params']['id']}},_0x77109a={};_0x77109a[_0x49a4('0x29')]=_[_0x49a4('0x2b')](db[_0x49a4('0x25')][_0x49a4('0x26')]);_0x77109a[_0x49a4('0x2a')]=_[_0x49a4('0x2b')](_0x52c239[_0x49a4('0x2a')]);_0x77109a[_0x49a4('0x2c')]=_[_0x49a4('0x2d')](_0x77109a[_0x49a4('0x29')],_0x77109a[_0x49a4('0x2a')]);_0x34cff5[_0x49a4('0x2e')]=_[_0x49a4('0x2d')](_0x77109a[_0x49a4('0x29')],qs[_0x49a4('0x2f')](_0x52c239[_0x49a4('0x2a')][_0x49a4('0x2f')]));_0x34cff5[_0x49a4('0x2e')]=_0x34cff5['attributes'][_0x49a4('0x30')]?_0x34cff5[_0x49a4('0x2e')]:_0x77109a[_0x49a4('0x29')];if(_0x52c239[_0x49a4('0x2a')]['includeAll']){_0x34cff5[_0x49a4('0x3c')]=[{'all':!![]}];}_0x34cff5=_['merge']({},_0x34cff5,_0x52c239[_0x49a4('0x3a')]);return db[_0x49a4('0x25')][_0x49a4('0x40')](_0x34cff5)[_0x49a4('0x1f')](handleEntityNotFound(_0x4c59f7,null))['then'](respondWithResult(_0x4c59f7,null))[_0x49a4('0x41')](handleError(_0x4c59f7,null));};exports['create']=function(_0x20a342,_0x478b1a){return db['Dynamics365Field']['create'](_0x20a342[_0x49a4('0x42')],{})[_0x49a4('0x1f')](respondWithResult(_0x478b1a,0xc9))[_0x49a4('0x41')](handleError(_0x478b1a,null));};exports[_0x49a4('0x43')]=function(_0x10dc52,_0x7e562){if(_0x10dc52['body']['id']){delete _0x10dc52[_0x49a4('0x42')]['id'];}return db[_0x49a4('0x25')]['find']({'where':{'id':_0x10dc52[_0x49a4('0x44')]['id']}})[_0x49a4('0x1f')](handleEntityNotFound(_0x7e562,null))[_0x49a4('0x1f')](saveUpdates(_0x10dc52[_0x49a4('0x42')],null))[_0x49a4('0x1f')](respondWithResult(_0x7e562,null))['catch'](handleError(_0x7e562,null));};exports['destroy']=function(_0x30c816,_0x27d2e9){return db[_0x49a4('0x25')][_0x49a4('0x40')]({'where':{'id':_0x30c816[_0x49a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x27d2e9,null))[_0x49a4('0x1f')](removeEntity(_0x27d2e9,null))[_0x49a4('0x41')](handleError(_0x27d2e9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2c87930..0236a9b 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 _0xc049=['bluebird','request-promise','rimraf','../../config/environment','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc049,0x1e9));var _0x9c04=function(_0x14f32c,_0x31e75f){_0x14f32c=_0x14f32c-0x0;var _0x2eb5e2=_0xc049[_0x14f32c];return _0x2eb5e2;};'use strict';var _=require(_0x9c04('0x0'));var util=require('util');var logger=require(_0x9c04('0x1'))('api');var moment=require(_0x9c04('0x2'));var BPromise=require(_0x9c04('0x3'));var rp=require(_0x9c04('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c04('0x5'));var config=require(_0x9c04('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x55a165,_0x895230){return _0x55a165['define'](_0x9c04('0x7'),attributes,{'tableName':_0x9c04('0x8'),'paranoid':![],'indexes':[{'name':_0x9c04('0x9'),'fields':[_0x9c04('0xa'),_0x9c04('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c4b=['path','rimraf','../../config/environment','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x344a43,_0x34bead){var _0x41bfb7=function(_0x2ad561){while(--_0x2ad561){_0x344a43['push'](_0x344a43['shift']());}};_0x41bfb7(++_0x34bead);}(_0x7c4b,0x13d));var _0xb7c4=function(_0x58859d,_0x5124a0){_0x58859d=_0x58859d-0x0;var _0x42004d=_0x7c4b[_0x58859d];return _0x42004d;};'use strict';var _=require(_0xb7c4('0x0'));var util=require(_0xb7c4('0x1'));var logger=require(_0xb7c4('0x2'))(_0xb7c4('0x3'));var moment=require(_0xb7c4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7c4('0x5'));var rimraf=require(_0xb7c4('0x6'));var config=require(_0xb7c4('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0xb7c4('0x8')]=function(_0x56f335,_0x42414c){return _0x56f335[_0xb7c4('0x9')](_0xb7c4('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xb7c4('0xb'),'fields':[_0xb7c4('0xc'),_0xb7c4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 094574a..0664100 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 _0x2fc9=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2fc9,0x7a));var _0x92fc=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0x2fc9[_0x4b2b03];return _0x1bf0ed;};'use strict';var _=require(_0x92fc('0x0'));var util=require(_0x92fc('0x1'));var moment=require('moment');var BPromise=require(_0x92fc('0x2'));var rs=require(_0x92fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92fc('0x4'))['db'];var utils=require(_0x92fc('0x5'));var logger=require(_0x92fc('0x6'))(_0x92fc('0x7'));var config=require(_0x92fc('0x8'));var jayson=require(_0x92fc('0x9'));var client=jayson[_0x92fc('0xa')][_0x92fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a50fc,_0x2822fc,_0x5f566f){return new BPromise(function(_0xcc77e6,_0x5c0d1e){return client[_0x92fc('0xc')](_0x5a50fc,_0x5f566f)[_0x92fc('0xd')](function(_0x3d60cd){logger[_0x92fc('0xe')](_0x92fc('0xf'),_0x2822fc,_0x92fc('0x10'));logger[_0x92fc('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2822fc,_0x92fc('0x10'),JSON[_0x92fc('0x12')](_0x3d60cd));if(_0x3d60cd[_0x92fc('0x13')]){if(_0x3d60cd[_0x92fc('0x13')][_0x92fc('0x14')]===0x1f4){logger[_0x92fc('0x13')](_0x92fc('0xf'),_0x2822fc,_0x3d60cd['error']['message']);return _0x5c0d1e(_0x3d60cd['error'][_0x92fc('0x15')]);}logger[_0x92fc('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x2822fc,_0x3d60cd[_0x92fc('0x13')][_0x92fc('0x15')]);return _0xcc77e6(_0x3d60cd[_0x92fc('0x13')][_0x92fc('0x15')]);}else{logger[_0x92fc('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x2822fc,_0x92fc('0x10'));_0xcc77e6(_0x3d60cd['result']['message']);}})[_0x92fc('0x16')](function(_0x2cecba){logger[_0x92fc('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x2822fc,_0x2cecba);_0x5c0d1e(_0x2cecba);});});} \ No newline at end of file +var _0x6831=['../../config/utils','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3fe520,_0xdc2187){var _0x3ab1c9=function(_0x143880){while(--_0x143880){_0x3fe520['push'](_0x3fe520['shift']());}};_0x3ab1c9(++_0xdc2187);}(_0x6831,0x1f3));var _0x1683=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6831[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x1683('0x0'));var util=require(_0x1683('0x1'));var moment=require(_0x1683('0x2'));var BPromise=require(_0x1683('0x3'));var rs=require(_0x1683('0x4'));var fs=require('fs');var Redis=require(_0x1683('0x5'));var db=require(_0x1683('0x6'))['db'];var utils=require(_0x1683('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1683('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1683('0x9')][_0x1683('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ef471,_0x58dc8a,_0x1a7d9e){return new BPromise(function(_0x26025b,_0x3ff5bd){return client[_0x1683('0xb')](_0x4ef471,_0x1a7d9e)[_0x1683('0xc')](function(_0x48148e){logger[_0x1683('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x58dc8a,'request\x20sent');logger[_0x1683('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x58dc8a,_0x1683('0xf'),JSON[_0x1683('0x10')](_0x48148e));if(_0x48148e[_0x1683('0x11')]){if(_0x48148e[_0x1683('0x11')]['code']===0x1f4){logger['error'](_0x1683('0x12'),_0x58dc8a,_0x48148e[_0x1683('0x11')][_0x1683('0x13')]);return _0x3ff5bd(_0x48148e[_0x1683('0x11')][_0x1683('0x13')]);}logger[_0x1683('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x58dc8a,_0x48148e[_0x1683('0x11')][_0x1683('0x13')]);return _0x26025b(_0x48148e[_0x1683('0x11')][_0x1683('0x13')]);}else{logger[_0x1683('0xd')](_0x1683('0x12'),_0x58dc8a,_0x1683('0xf'));_0x26025b(_0x48148e[_0x1683('0x14')][_0x1683('0x13')]);}})[_0x1683('0x15')](function(_0x6e38f3){logger[_0x1683('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x58dc8a,_0x6e38f3);_0x3ff5bd(_0x6e38f3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b590166..e7bc944 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 _0x32df=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1663de,_0x76af67){var _0x2c2bcf=function(_0x3d054d){while(--_0x3d054d){_0x1663de['push'](_0x1663de['shift']());}};_0x2c2bcf(++_0x76af67);}(_0x32df,0xc5));var _0xf32d=function(_0xb8e162,_0xe166fa){_0xb8e162=_0xb8e162-0x0;var _0x3213e2=_0x32df[_0xb8e162];return _0x3213e2;};'use strict';var multer=require(_0xf32d('0x0'));var util=require(_0xf32d('0x1'));var path=require(_0xf32d('0x2'));var timeout=require(_0xf32d('0x3'));var express=require(_0xf32d('0x4'));var router=express[_0xf32d('0x5')]();var fs_extra=require(_0xf32d('0x6'));var auth=require(_0xf32d('0x7'));var interaction=require(_0xf32d('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xf32d('0x9')]('/',auth[_0xf32d('0xa')](),controller[_0xf32d('0xb')]);router[_0xf32d('0x9')](_0xf32d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf32d('0x9')](_0xf32d('0xd'),auth[_0xf32d('0xa')](),controller[_0xf32d('0xe')]);router['get'](_0xf32d('0xf'),auth[_0xf32d('0xa')](),controller['getFields']);router[_0xf32d('0x10')]('/',auth[_0xf32d('0xa')](),controller[_0xf32d('0x11')]);router[_0xf32d('0x10')](_0xf32d('0xd'),auth[_0xf32d('0xa')](),controller[_0xf32d('0x12')]);router[_0xf32d('0x13')]('/:id',auth[_0xf32d('0xa')](),controller[_0xf32d('0x14')]);router[_0xf32d('0x15')](_0xf32d('0xc'),auth[_0xf32d('0xa')](),controller[_0xf32d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x129e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x22863d,_0x53bc5d){var _0xdf7463=function(_0x11b0ef){while(--_0x11b0ef){_0x22863d['push'](_0x22863d['shift']());}};_0xdf7463(++_0x53bc5d);}(_0x129e,0xce));var _0xe129=function(_0x597d53,_0x4b9ce9){_0x597d53=_0x597d53-0x0;var _0x3daa14=_0x129e[_0x597d53];return _0x3daa14;};'use strict';var multer=require(_0xe129('0x0'));var util=require(_0xe129('0x1'));var path=require(_0xe129('0x2'));var timeout=require(_0xe129('0x3'));var express=require('express');var router=express[_0xe129('0x4')]();var fs_extra=require(_0xe129('0x5'));var auth=require(_0xe129('0x6'));var interaction=require(_0xe129('0x7'));var config=require(_0xe129('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0xe129('0x9')]('/',auth[_0xe129('0xa')](),controller['index']);router[_0xe129('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe129('0xb')]);router[_0xe129('0x9')](_0xe129('0xc'),auth[_0xe129('0xa')](),controller[_0xe129('0xd')]);router[_0xe129('0x9')](_0xe129('0xe'),auth[_0xe129('0xa')](),controller[_0xe129('0xf')]);router[_0xe129('0x10')]('/',auth['isAuthenticated'](),controller[_0xe129('0x11')]);router[_0xe129('0x10')]('/:id/configurations',auth[_0xe129('0xa')](),controller['addConfiguration']);router[_0xe129('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xe129('0x13'),auth['isAuthenticated'](),controller[_0xe129('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d4a7a5b..2222000 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 _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1534ab,_0xf6b341){var _0x5dcccc=function(_0x478b57){while(--_0x478b57){_0x1534ab['push'](_0x1534ab['shift']());}};_0x5dcccc(++_0xf6b341);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2dbc95,_0x32760c){_0x2dbc95=_0x2dbc95-0x0;var _0x43b48f=_0xd7d1[_0x2dbc95];return _0x43b48f;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['remoteUri','sequelize','STRING'];(function(_0x3c6c4d,_0x3b3c92){var _0x3bea7c=function(_0x298c23){while(--_0x298c23){_0x3c6c4d['push'](_0x3c6c4d['shift']());}};_0x3bea7c(++_0x3b3c92);}(_0xb10b,0x12a));var _0xbb10=function(_0x200af4,_0x8416e8){_0x200af4=_0x200af4-0x0;var _0x3831b6=_0xb10b[_0x200af4];return _0x3831b6;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 09a3acc..67d0242 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 _0x8721=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','index','FreshdeskAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','api/v2/ticket_fields','format','toString','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x35e6ca,_0x54939f){var _0x239e43=function(_0x3ea90d){while(--_0x3ea90d){_0x35e6ca['push'](_0x35e6ca['shift']());}};_0x239e43(++_0x54939f);}(_0x8721,0xd9));var _0x1872=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8721[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x1872('0x0'));var rimraf=require(_0x1872('0x1'));var zipdir=require(_0x1872('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1872('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1872('0x4'));var sox=require(_0x1872('0x5'));var csv=require(_0x1872('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1872('0x7'));var squel=require(_0x1872('0x8'));var crypto=require(_0x1872('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1872('0xa'));var toCsv=require(_0x1872('0x6'));var querystring=require(_0x1872('0xb'));var Papa=require(_0x1872('0xc'));var Redis=require(_0x1872('0xd'));var authService=require(_0x1872('0xe'));var qs=require(_0x1872('0xf'));var as=require(_0x1872('0x10'));var hardwareService=require(_0x1872('0x11'));var logger=require(_0x1872('0x12'))(_0x1872('0x13'));var utils=require('../../config/utils');var config=require(_0x1872('0x14'));var licenseUtil=require(_0x1872('0x15'));var db=require(_0x1872('0x16'))['db'];var integrations=require(_0x1872('0x17'));function respondWithStatusCode(_0x5122df,_0x412663){_0x412663=_0x412663||0xcc;return function(_0x1a8e90){if(_0x1a8e90){return _0x5122df[_0x1872('0x18')](_0x412663);}return _0x5122df[_0x1872('0x19')](_0x412663)['end']();};}function respondWithResult(_0x4df475,_0xe47f69){_0xe47f69=_0xe47f69||0xc8;return function(_0x9e92ef){if(_0x9e92ef){return _0x4df475[_0x1872('0x19')](_0xe47f69)[_0x1872('0x1a')](_0x9e92ef);}};}function respondWithFilteredResult(_0x1ffc89,_0x5662e6){return function(_0x4be58a){if(_0x4be58a){var _0x4d5d5d=typeof _0x5662e6[_0x1872('0x1b')]===_0x1872('0x1c')&&typeof _0x5662e6[_0x1872('0x1d')]==='undefined';var _0xd4204d=_0x4be58a['count'];var _0x444306=_0x4d5d5d?0x0:_0x5662e6[_0x1872('0x1b')];var _0x32147c=_0x4d5d5d?_0x4be58a['count']:_0x5662e6[_0x1872('0x1b')]+_0x5662e6['limit'];var _0x82b55e;if(_0x32147c>=_0xd4204d){_0x32147c=_0xd4204d;_0x82b55e=0xc8;}else{_0x82b55e=0xce;}_0x1ffc89[_0x1872('0x19')](_0x82b55e);return _0x1ffc89[_0x1872('0x1e')](_0x1872('0x1f'),_0x444306+'-'+_0x32147c+'/'+_0xd4204d)[_0x1872('0x1a')](_0x4be58a);}return null;};}function patchUpdates(_0x506a44){return function(_0x3e4ee7){try{jsonpatch[_0x1872('0x20')](_0x3e4ee7,_0x506a44,!![]);}catch(_0x1d0e89){return BPromise[_0x1872('0x21')](_0x1d0e89);}return _0x3e4ee7[_0x1872('0x22')]();};}function saveUpdates(_0x3142f8,_0x1fc33f){return function(_0x1acbc2){if(_0x1acbc2){return _0x1acbc2[_0x1872('0x23')](_0x3142f8)['then'](function(_0x54e059){return _0x54e059;});}return null;};}function removeEntity(_0x5f29f5,_0x42e0e4){return function(_0x3a9ca2){if(_0x3a9ca2){return _0x3a9ca2[_0x1872('0x24')]()[_0x1872('0x25')](function(){_0x5f29f5['status'](0xcc)[_0x1872('0x26')]();});}};}function handleEntityNotFound(_0x2ac6b8,_0x126ab4){return function(_0x588fc1){if(!_0x588fc1){_0x2ac6b8[_0x1872('0x18')](0x194);}return _0x588fc1;};}function handleError(_0x576efa,_0x43e178){_0x43e178=_0x43e178||0x1f4;return function(_0x8d964a){logger[_0x1872('0x27')](_0x8d964a['stack']);if(_0x8d964a[_0x1872('0x28')]){delete _0x8d964a[_0x1872('0x28')];}_0x576efa['status'](_0x43e178)['send'](_0x8d964a);};}exports[_0x1872('0x29')]=function(_0x5bab21,_0x5469e7){var _0x333961={},_0x5b1ef0={},_0x3f2779={'count':0x0,'rows':[]};var _0x7c1b35=_['map'](db[_0x1872('0x2a')][_0x1872('0x2b')],function(_0x30ad4f){return{'name':_0x30ad4f['fieldName'],'type':_0x30ad4f[_0x1872('0x2c')][_0x1872('0x2d')]};});_0x5b1ef0[_0x1872('0x2e')]=_[_0x1872('0x2f')](_0x7c1b35,_0x1872('0x28'));_0x5b1ef0['query']=_[_0x1872('0x30')](_0x5bab21[_0x1872('0x31')]);_0x5b1ef0[_0x1872('0x32')]=_[_0x1872('0x33')](_0x5b1ef0[_0x1872('0x2e')],_0x5b1ef0[_0x1872('0x31')]);_0x333961['attributes']=_[_0x1872('0x33')](_0x5b1ef0[_0x1872('0x2e')],qs[_0x1872('0x34')](_0x5bab21[_0x1872('0x31')][_0x1872('0x34')]));_0x333961[_0x1872('0x35')]=_0x333961[_0x1872('0x35')][_0x1872('0x36')]?_0x333961['attributes']:_0x5b1ef0['model'];if(!_0x5bab21[_0x1872('0x31')][_0x1872('0x37')](_0x1872('0x38'))){_0x333961[_0x1872('0x1d')]=qs[_0x1872('0x1d')](_0x5bab21[_0x1872('0x31')]['limit']);_0x333961[_0x1872('0x1b')]=qs[_0x1872('0x1b')](_0x5bab21['query']['offset']);}_0x333961['order']=qs[_0x1872('0x39')](_0x5bab21[_0x1872('0x31')][_0x1872('0x39')]);_0x333961['where']=qs[_0x1872('0x32')](_[_0x1872('0x3a')](_0x5bab21[_0x1872('0x31')],_0x5b1ef0[_0x1872('0x32')]),_0x7c1b35);if(_0x5bab21[_0x1872('0x31')][_0x1872('0x3b')]){_0x333961['where']=_[_0x1872('0x3c')](_0x333961[_0x1872('0x3d')],{'$or':_[_0x1872('0x2f')](_0x7c1b35,function(_0x3bd1da){if(_0x3bd1da[_0x1872('0x2c')]!==_0x1872('0x3e')){var _0x224d46={};_0x224d46[_0x3bd1da[_0x1872('0x28')]]={'$like':'%'+_0x5bab21['query'][_0x1872('0x3b')]+'%'};return _0x224d46;}})});}_0x333961=_[_0x1872('0x3c')]({},_0x333961,_0x5bab21[_0x1872('0x3f')]);var _0x4c3e9e={'where':_0x333961[_0x1872('0x3d')]};return db[_0x1872('0x2a')]['count'](_0x4c3e9e)[_0x1872('0x25')](function(_0x18a711){_0x3f2779[_0x1872('0x40')]=_0x18a711;if(_0x5bab21[_0x1872('0x31')][_0x1872('0x41')]){_0x333961['include']=[{'all':!![]}];}return db[_0x1872('0x2a')][_0x1872('0x42')](_0x333961);})[_0x1872('0x25')](function(_0x4b2dae){_0x3f2779[_0x1872('0x43')]=_0x4b2dae;return _0x3f2779;})[_0x1872('0x25')](respondWithFilteredResult(_0x5469e7,_0x333961))[_0x1872('0x44')](handleError(_0x5469e7,null));};exports[_0x1872('0x45')]=function(_0x38b60e,_0xbd6e46){var _0x857b68={'raw':![],'where':{'id':_0x38b60e[_0x1872('0x46')]['id']}},_0x300806={};_0x300806['model']=_[_0x1872('0x30')](db[_0x1872('0x2a')][_0x1872('0x2b')]);_0x300806[_0x1872('0x31')]=_[_0x1872('0x30')](_0x38b60e[_0x1872('0x31')]);_0x300806[_0x1872('0x32')]=_['intersection'](_0x300806['model'],_0x300806[_0x1872('0x31')]);_0x857b68[_0x1872('0x35')]=_[_0x1872('0x33')](_0x300806[_0x1872('0x2e')],qs['fields'](_0x38b60e['query']['fields']));_0x857b68['attributes']=_0x857b68[_0x1872('0x35')]['length']?_0x857b68[_0x1872('0x35')]:_0x300806[_0x1872('0x2e')];if(_0x38b60e['query'][_0x1872('0x41')]){_0x857b68[_0x1872('0x47')]=[{'all':!![]}];}_0x857b68=_['merge']({},_0x857b68,_0x38b60e[_0x1872('0x3f')]);return db[_0x1872('0x2a')]['find'](_0x857b68)[_0x1872('0x25')](handleEntityNotFound(_0xbd6e46,null))[_0x1872('0x25')](respondWithResult(_0xbd6e46,null))[_0x1872('0x44')](handleError(_0xbd6e46,null));};exports[_0x1872('0x48')]=function(_0x392f26,_0x2a6341){return db[_0x1872('0x2a')][_0x1872('0x48')](_0x392f26['body'],{})['then'](respondWithResult(_0x2a6341,0xc9))[_0x1872('0x44')](handleError(_0x2a6341,null));};exports[_0x1872('0x23')]=function(_0x3e985e,_0x5e70a6){if(_0x3e985e[_0x1872('0x49')]['id']){delete _0x3e985e[_0x1872('0x49')]['id'];}return db[_0x1872('0x2a')][_0x1872('0x4a')]({'where':{'id':_0x3e985e[_0x1872('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e70a6,null))[_0x1872('0x25')](saveUpdates(_0x3e985e[_0x1872('0x49')],null))[_0x1872('0x25')](respondWithResult(_0x5e70a6,null))[_0x1872('0x44')](handleError(_0x5e70a6,null));};exports[_0x1872('0x24')]=function(_0x5b6c04,_0x3a6edb){return db[_0x1872('0x2a')][_0x1872('0x4a')]({'where':{'id':_0x5b6c04[_0x1872('0x46')]['id']}})[_0x1872('0x25')](handleEntityNotFound(_0x3a6edb,null))[_0x1872('0x25')](removeEntity(_0x3a6edb,null))[_0x1872('0x44')](handleError(_0x3a6edb,null));};exports[_0x1872('0x4b')]=function(_0x3528b6,_0x5f4ae9,_0xbdf0c6){var _0x183f7b={};var _0x3d4143={};var _0x17a80b;var _0x340570;return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x3528b6['params']['id']}})['then'](handleEntityNotFound(_0x5f4ae9,null))[_0x1872('0x25')](function(_0x3145b1){if(_0x3145b1){_0x17a80b=_0x3145b1;_0x3d4143[_0x1872('0x2e')]=_['keys'](db[_0x1872('0x4d')][_0x1872('0x2b')]);_0x3d4143[_0x1872('0x31')]=_[_0x1872('0x30')](_0x3528b6[_0x1872('0x31')]);_0x3d4143[_0x1872('0x32')]=_[_0x1872('0x33')](_0x3d4143[_0x1872('0x2e')],_0x3d4143['query']);_0x183f7b[_0x1872('0x35')]=_['intersection'](_0x3d4143[_0x1872('0x2e')],qs[_0x1872('0x34')](_0x3528b6[_0x1872('0x31')]['fields']));_0x183f7b[_0x1872('0x35')]=_0x183f7b['attributes'][_0x1872('0x36')]?_0x183f7b['attributes']:_0x3d4143['model'];_0x183f7b[_0x1872('0x4e')]=qs[_0x1872('0x39')](_0x3528b6[_0x1872('0x31')][_0x1872('0x39')]);_0x183f7b['where']=qs[_0x1872('0x32')](_[_0x1872('0x3a')](_0x3528b6[_0x1872('0x31')],_0x3d4143[_0x1872('0x32')]));if(_0x3528b6[_0x1872('0x31')][_0x1872('0x3b')]){_0x183f7b[_0x1872('0x3d')]=_[_0x1872('0x3c')](_0x183f7b[_0x1872('0x3d')],{'$or':_[_0x1872('0x2f')](_0x183f7b[_0x1872('0x35')],function(_0x101ada){var _0x7d4201={};_0x7d4201[_0x101ada]={'$like':'%'+_0x3528b6[_0x1872('0x31')][_0x1872('0x3b')]+'%'};return _0x7d4201;})});}_0x183f7b=_[_0x1872('0x3c')]({},_0x183f7b,_0x3528b6[_0x1872('0x3f')]);return _0x17a80b[_0x1872('0x4b')](_0x183f7b);}})[_0x1872('0x25')](function(_0x1c3a86){if(_0x1c3a86){_0x340570=_0x1c3a86[_0x1872('0x36')];if(!_0x3528b6[_0x1872('0x31')][_0x1872('0x37')]('nolimit')){_0x183f7b[_0x1872('0x1d')]=qs['limit'](_0x3528b6[_0x1872('0x31')]['limit']);_0x183f7b['offset']=qs[_0x1872('0x1b')](_0x3528b6[_0x1872('0x31')][_0x1872('0x1b')]);}return _0x17a80b[_0x1872('0x4b')](_0x183f7b);}})[_0x1872('0x25')](function(_0x51c0d9){if(_0x51c0d9){return _0x51c0d9?{'count':_0x340570,'rows':_0x51c0d9}:null;}})[_0x1872('0x25')](respondWithResult(_0x5f4ae9,null))[_0x1872('0x44')](handleError(_0x5f4ae9,null));};exports[_0x1872('0x4f')]=function(_0x2cc5fd,_0x30596c,_0x59bd34){if(_0x2cc5fd[_0x1872('0x49')]['id']){delete _0x2cc5fd['body']['id'];}return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x2cc5fd[_0x1872('0x46')]['id']}})[_0x1872('0x25')](handleEntityNotFound(_0x30596c,null))[_0x1872('0x25')](function(_0x36d3ee){if(_0x36d3ee){_0x2cc5fd[_0x1872('0x49')][_0x1872('0x50')]=_0x36d3ee['id'];_0x2cc5fd['body'][_0x1872('0x51')]=integrations[_0x1872('0x52')](_0x2cc5fd['body'][_0x1872('0x53')],_0x2cc5fd['body'][_0x1872('0x2c')]);_0x2cc5fd['body'][_0x1872('0x54')]=integrations[_0x1872('0x55')](_0x2cc5fd[_0x1872('0x49')]['channel'],_0x2cc5fd['body']['type']);return db[_0x1872('0x4d')][_0x1872('0x48')](_0x2cc5fd['body'],{'include':[{'model':db[_0x1872('0x56')],'as':_0x1872('0x51')},{'model':db[_0x1872('0x56')],'as':_0x1872('0x54')}]});}return null;})[_0x1872('0x25')](respondWithResult(_0x30596c,null))[_0x1872('0x44')](handleError(_0x30596c,null));};exports['getFields']=function(_0x1897fe,_0x2af635,_0x454a2f){var _0x2742b9='';return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x1897fe[_0x1872('0x46')]['id']},'attributes':['id',_0x1872('0x57'),_0x1872('0x58')]})[_0x1872('0x25')](handleEntityNotFound(_0x2af635,null))[_0x1872('0x25')](function(_0x311fbc){if(_0x311fbc){_0x2742b9=_0x311fbc[_0x1872('0x57')];var _0xc8c0d3=_0x2742b9[_0x1872('0x59')](-0x1);if(_0xc8c0d3==='/'){_0x2742b9=_0x2742b9[_0x1872('0x5a')](0x0,_0x2742b9[_0x1872('0x5b')](_0xc8c0d3));}return rp({'method':'GET','uri':util['format'](_0x1872('0x5c'),_0x2742b9,_0x1872('0x5d')),'headers':{'Authorization':util[_0x1872('0x5e')]('Basic\x20%s',new Buffer(util[_0x1872('0x5e')]('%s:X',_0x311fbc['apiKey']))[_0x1872('0x5f')]('base64'))},'json':!![]});}})[_0x1872('0x25')](function(_0x5c057e){if(_0x5c057e){var _0x236b66=['requester',_0x1872('0x60'),_0x1872('0x61'),_0x1872('0x62'),_0x1872('0x19'),_0x1872('0x63'),_0x1872('0x64'),_0x1872('0x65'),_0x1872('0x66'),_0x1872('0x64'),'company'];_[_0x1872('0x67')](_0x5c057e,function(_0x9f53bc){return _0x236b66[_0x1872('0x68')](_0x9f53bc[_0x1872('0x28')])||!_0x9f53bc[_0x1872('0x69')]&&_0x9f53bc[_0x1872('0x2c')]!==_0x1872('0x6a')&&_0x9f53bc[_0x1872('0x2c')]!==_0x1872('0x6b');});return{'count':_0x5c057e[_0x1872('0x36')],'rows':_[_0x1872('0x2f')](_0x5c057e,function(_0xa39f0b){return{'id':_0xa39f0b[_0x1872('0x28')],'name':_0xa39f0b[_0x1872('0x6c')],'custom':!_0xa39f0b['default'],'options':_0xa39f0b['choices']?_['map'](_0xa39f0b[_0x1872('0x6d')],function(_0x5d5a72){return{'name':_[_0x1872('0x6e')](_0x5d5a72),'value':_0x5d5a72};}):[]};})};}})[_0x1872('0x25')](respondWithResult(_0x2af635,null))[_0x1872('0x44')](function(_0x57df91){var _0x5f5cae=_0x1897fe[_0x1872('0x31')][_0x1872('0x6f')]?0x1f4:_0x57df91[_0x1872('0x70')]||0x1f4;logger['error'](_0x1872('0x71'),'getFields',_0x5f5cae,JSON[_0x1872('0x72')](_0x57df91));delete _0x57df91[_0x1872('0x28')];if(_0x5f5cae===0x191){_0x5f5cae=0x190;}_0x2af635[_0x1872('0x19')](_0x5f5cae)[_0x1872('0x73')](_0x1897fe['query']['test']?{'message':_0x1872('0x74'),'statusCode':_0x57df91[_0x1872('0x70')]}:_0x57df91);});}; \ No newline at end of file +var _0x3aa2=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','name','send','index','map','FreshdeskAccount','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','params','includeAll','find','create','catch','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','apiKey','remoteUri','slice','substring','GET','format','%s/%s','Basic\x20%s','toString','base64','description','priority','group','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','path'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3aa2,0x13b));var _0x23aa=function(_0x174583,_0x468485){_0x174583=_0x174583-0x0;var _0x14e46f=_0x3aa2[_0x174583];return _0x14e46f;};'use strict';var emlformat=require(_0x23aa('0x0'));var rimraf=require(_0x23aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23aa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x23aa('0x3'));var Mustache=require(_0x23aa('0x4'));var util=require('util');var path=require(_0x23aa('0x5'));var sox=require('sox');var csv=require(_0x23aa('0x6'));var ejs=require(_0x23aa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23aa('0x8'));var squel=require(_0x23aa('0x9'));var crypto=require(_0x23aa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x23aa('0xb'));var toCsv=require(_0x23aa('0x6'));var querystring=require(_0x23aa('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x23aa('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x23aa('0xe'));var hardwareService=require(_0x23aa('0xf'));var logger=require(_0x23aa('0x10'))(_0x23aa('0x11'));var utils=require(_0x23aa('0x12'));var config=require(_0x23aa('0x13'));var licenseUtil=require(_0x23aa('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f9c72,_0x1f71ef){_0x1f71ef=_0x1f71ef||0xcc;return function(_0x1c664b){if(_0x1c664b){return _0x4f9c72[_0x23aa('0x15')](_0x1f71ef);}return _0x4f9c72[_0x23aa('0x16')](_0x1f71ef)[_0x23aa('0x17')]();};}function respondWithResult(_0x284fab,_0x1e2f6e){_0x1e2f6e=_0x1e2f6e||0xc8;return function(_0x12cda0){if(_0x12cda0){return _0x284fab['status'](_0x1e2f6e)[_0x23aa('0x18')](_0x12cda0);}};}function respondWithFilteredResult(_0x4d83ca,_0x5dacbe){return function(_0x3cbbde){if(_0x3cbbde){var _0x409c47=typeof _0x5dacbe[_0x23aa('0x19')]===_0x23aa('0x1a')&&typeof _0x5dacbe[_0x23aa('0x1b')]===_0x23aa('0x1a');var _0x50b4fc=_0x3cbbde[_0x23aa('0x1c')];var _0x3750c0=_0x409c47?0x0:_0x5dacbe['offset'];var _0x4eef91=_0x409c47?_0x3cbbde['count']:_0x5dacbe['offset']+_0x5dacbe[_0x23aa('0x1b')];var _0xa002fb;if(_0x4eef91>=_0x50b4fc){_0x4eef91=_0x50b4fc;_0xa002fb=0xc8;}else{_0xa002fb=0xce;}_0x4d83ca[_0x23aa('0x16')](_0xa002fb);return _0x4d83ca['set'](_0x23aa('0x1d'),_0x3750c0+'-'+_0x4eef91+'/'+_0x50b4fc)[_0x23aa('0x18')](_0x3cbbde);}return null;};}function patchUpdates(_0x550e1c){return function(_0x1c38cd){try{jsonpatch[_0x23aa('0x1e')](_0x1c38cd,_0x550e1c,!![]);}catch(_0x1aec62){return BPromise[_0x23aa('0x1f')](_0x1aec62);}return _0x1c38cd[_0x23aa('0x20')]();};}function saveUpdates(_0x2a272f,_0x474081){return function(_0x39e69d){if(_0x39e69d){return _0x39e69d[_0x23aa('0x21')](_0x2a272f)['then'](function(_0x319277){return _0x319277;});}return null;};}function removeEntity(_0x3c79ce,_0x2c76f4){return function(_0x737b9d){if(_0x737b9d){return _0x737b9d['destroy']()[_0x23aa('0x22')](function(){_0x3c79ce['status'](0xcc)[_0x23aa('0x17')]();});}};}function handleEntityNotFound(_0x3d7cc3,_0x305eff){return function(_0x523504){if(!_0x523504){_0x3d7cc3[_0x23aa('0x15')](0x194);}return _0x523504;};}function handleError(_0x2a2059,_0x3e3adc){_0x3e3adc=_0x3e3adc||0x1f4;return function(_0x8af77e){logger[_0x23aa('0x23')](_0x8af77e['stack']);if(_0x8af77e['name']){delete _0x8af77e[_0x23aa('0x24')];}_0x2a2059[_0x23aa('0x16')](_0x3e3adc)[_0x23aa('0x25')](_0x8af77e);};}exports[_0x23aa('0x26')]=function(_0x16c221,_0x21b167){var _0x3dce89={},_0x2163c0={},_0x5d9910={'count':0x0,'rows':[]};var _0x425836=_[_0x23aa('0x27')](db[_0x23aa('0x28')][_0x23aa('0x29')],function(_0x577e54){return{'name':_0x577e54['fieldName'],'type':_0x577e54['type'][_0x23aa('0x2a')]};});_0x2163c0[_0x23aa('0x2b')]=_[_0x23aa('0x27')](_0x425836,'name');_0x2163c0['query']=_[_0x23aa('0x2c')](_0x16c221[_0x23aa('0x2d')]);_0x2163c0[_0x23aa('0x2e')]=_['intersection'](_0x2163c0[_0x23aa('0x2b')],_0x2163c0[_0x23aa('0x2d')]);_0x3dce89['attributes']=_[_0x23aa('0x2f')](_0x2163c0[_0x23aa('0x2b')],qs['fields'](_0x16c221[_0x23aa('0x2d')][_0x23aa('0x30')]));_0x3dce89['attributes']=_0x3dce89[_0x23aa('0x31')][_0x23aa('0x32')]?_0x3dce89[_0x23aa('0x31')]:_0x2163c0[_0x23aa('0x2b')];if(!_0x16c221[_0x23aa('0x2d')][_0x23aa('0x33')](_0x23aa('0x34'))){_0x3dce89['limit']=qs[_0x23aa('0x1b')](_0x16c221[_0x23aa('0x2d')][_0x23aa('0x1b')]);_0x3dce89['offset']=qs['offset'](_0x16c221[_0x23aa('0x2d')][_0x23aa('0x19')]);}_0x3dce89[_0x23aa('0x35')]=qs['sort'](_0x16c221[_0x23aa('0x2d')][_0x23aa('0x36')]);_0x3dce89[_0x23aa('0x37')]=qs[_0x23aa('0x2e')](_[_0x23aa('0x38')](_0x16c221[_0x23aa('0x2d')],_0x2163c0[_0x23aa('0x2e')]),_0x425836);if(_0x16c221[_0x23aa('0x2d')][_0x23aa('0x39')]){_0x3dce89[_0x23aa('0x37')]=_[_0x23aa('0x3a')](_0x3dce89[_0x23aa('0x37')],{'$or':_['map'](_0x425836,function(_0x49d1b9){if(_0x49d1b9[_0x23aa('0x3b')]!=='VIRTUAL'){var _0x5e7ef7={};_0x5e7ef7[_0x49d1b9[_0x23aa('0x24')]]={'$like':'%'+_0x16c221['query'][_0x23aa('0x39')]+'%'};return _0x5e7ef7;}})});}_0x3dce89=_[_0x23aa('0x3a')]({},_0x3dce89,_0x16c221[_0x23aa('0x3c')]);var _0x5befa2={'where':_0x3dce89[_0x23aa('0x37')]};return db[_0x23aa('0x28')][_0x23aa('0x1c')](_0x5befa2)[_0x23aa('0x22')](function(_0x3d3a96){_0x5d9910[_0x23aa('0x1c')]=_0x3d3a96;if(_0x16c221[_0x23aa('0x2d')]['includeAll']){_0x3dce89[_0x23aa('0x3d')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x23aa('0x3e')](_0x3dce89);})['then'](function(_0x4e0fab){_0x5d9910['rows']=_0x4e0fab;return _0x5d9910;})[_0x23aa('0x22')](respondWithFilteredResult(_0x21b167,_0x3dce89))['catch'](handleError(_0x21b167,null));};exports['show']=function(_0xf0eff7,_0x173007){var _0x373353={'raw':![],'where':{'id':_0xf0eff7[_0x23aa('0x3f')]['id']}},_0x128e1a={};_0x128e1a['model']=_['keys'](db[_0x23aa('0x28')][_0x23aa('0x29')]);_0x128e1a[_0x23aa('0x2d')]=_['keys'](_0xf0eff7[_0x23aa('0x2d')]);_0x128e1a['filters']=_[_0x23aa('0x2f')](_0x128e1a[_0x23aa('0x2b')],_0x128e1a[_0x23aa('0x2d')]);_0x373353['attributes']=_[_0x23aa('0x2f')](_0x128e1a[_0x23aa('0x2b')],qs['fields'](_0xf0eff7[_0x23aa('0x2d')]['fields']));_0x373353[_0x23aa('0x31')]=_0x373353[_0x23aa('0x31')][_0x23aa('0x32')]?_0x373353[_0x23aa('0x31')]:_0x128e1a[_0x23aa('0x2b')];if(_0xf0eff7['query'][_0x23aa('0x40')]){_0x373353[_0x23aa('0x3d')]=[{'all':!![]}];}_0x373353=_['merge']({},_0x373353,_0xf0eff7[_0x23aa('0x3c')]);return db[_0x23aa('0x28')][_0x23aa('0x41')](_0x373353)['then'](handleEntityNotFound(_0x173007,null))[_0x23aa('0x22')](respondWithResult(_0x173007,null))['catch'](handleError(_0x173007,null));};exports[_0x23aa('0x42')]=function(_0xf6c40,_0x959c24){return db[_0x23aa('0x28')][_0x23aa('0x42')](_0xf6c40['body'],{})[_0x23aa('0x22')](respondWithResult(_0x959c24,0xc9))[_0x23aa('0x43')](handleError(_0x959c24,null));};exports['update']=function(_0x7ab87f,_0x257bc){if(_0x7ab87f[_0x23aa('0x44')]['id']){delete _0x7ab87f[_0x23aa('0x44')]['id'];}return db[_0x23aa('0x28')]['find']({'where':{'id':_0x7ab87f[_0x23aa('0x3f')]['id']}})[_0x23aa('0x22')](handleEntityNotFound(_0x257bc,null))[_0x23aa('0x22')](saveUpdates(_0x7ab87f[_0x23aa('0x44')],null))[_0x23aa('0x22')](respondWithResult(_0x257bc,null))[_0x23aa('0x43')](handleError(_0x257bc,null));};exports[_0x23aa('0x45')]=function(_0x2f6ff3,_0x5df566){return db[_0x23aa('0x28')][_0x23aa('0x41')]({'where':{'id':_0x2f6ff3[_0x23aa('0x3f')]['id']}})[_0x23aa('0x22')](handleEntityNotFound(_0x5df566,null))['then'](removeEntity(_0x5df566,null))[_0x23aa('0x43')](handleError(_0x5df566,null));};exports[_0x23aa('0x46')]=function(_0x615c68,_0x3c9fa9,_0x5618c5){var _0x581dc3={};var _0x134f6c={};var _0x677a70;var _0x3a9c00;return db[_0x23aa('0x28')][_0x23aa('0x47')]({'where':{'id':_0x615c68[_0x23aa('0x3f')]['id']}})[_0x23aa('0x22')](handleEntityNotFound(_0x3c9fa9,null))[_0x23aa('0x22')](function(_0x286d31){if(_0x286d31){_0x677a70=_0x286d31;_0x134f6c[_0x23aa('0x2b')]=_[_0x23aa('0x2c')](db[_0x23aa('0x48')][_0x23aa('0x29')]);_0x134f6c[_0x23aa('0x2d')]=_[_0x23aa('0x2c')](_0x615c68['query']);_0x134f6c[_0x23aa('0x2e')]=_[_0x23aa('0x2f')](_0x134f6c[_0x23aa('0x2b')],_0x134f6c[_0x23aa('0x2d')]);_0x581dc3[_0x23aa('0x31')]=_[_0x23aa('0x2f')](_0x134f6c[_0x23aa('0x2b')],qs['fields'](_0x615c68[_0x23aa('0x2d')][_0x23aa('0x30')]));_0x581dc3['attributes']=_0x581dc3[_0x23aa('0x31')][_0x23aa('0x32')]?_0x581dc3[_0x23aa('0x31')]:_0x134f6c[_0x23aa('0x2b')];_0x581dc3[_0x23aa('0x35')]=qs[_0x23aa('0x36')](_0x615c68['query'][_0x23aa('0x36')]);_0x581dc3[_0x23aa('0x37')]=qs[_0x23aa('0x2e')](_[_0x23aa('0x38')](_0x615c68['query'],_0x134f6c[_0x23aa('0x2e')]));if(_0x615c68[_0x23aa('0x2d')][_0x23aa('0x39')]){_0x581dc3[_0x23aa('0x37')]=_[_0x23aa('0x3a')](_0x581dc3[_0x23aa('0x37')],{'$or':_[_0x23aa('0x27')](_0x581dc3[_0x23aa('0x31')],function(_0x421e14){var _0xbce4a2={};_0xbce4a2[_0x421e14]={'$like':'%'+_0x615c68[_0x23aa('0x2d')][_0x23aa('0x39')]+'%'};return _0xbce4a2;})});}_0x581dc3=_['merge']({},_0x581dc3,_0x615c68[_0x23aa('0x3c')]);return _0x677a70[_0x23aa('0x46')](_0x581dc3);}})['then'](function(_0x840948){if(_0x840948){_0x3a9c00=_0x840948['length'];if(!_0x615c68[_0x23aa('0x2d')]['hasOwnProperty'](_0x23aa('0x34'))){_0x581dc3[_0x23aa('0x1b')]=qs[_0x23aa('0x1b')](_0x615c68[_0x23aa('0x2d')][_0x23aa('0x1b')]);_0x581dc3[_0x23aa('0x19')]=qs['offset'](_0x615c68[_0x23aa('0x2d')]['offset']);}return _0x677a70[_0x23aa('0x46')](_0x581dc3);}})[_0x23aa('0x22')](function(_0x4c71f0){if(_0x4c71f0){return _0x4c71f0?{'count':_0x3a9c00,'rows':_0x4c71f0}:null;}})[_0x23aa('0x22')](respondWithResult(_0x3c9fa9,null))[_0x23aa('0x43')](handleError(_0x3c9fa9,null));};exports[_0x23aa('0x49')]=function(_0x121076,_0x574393,_0x11475d){if(_0x121076[_0x23aa('0x44')]['id']){delete _0x121076[_0x23aa('0x44')]['id'];}return db[_0x23aa('0x28')][_0x23aa('0x47')]({'where':{'id':_0x121076['params']['id']}})[_0x23aa('0x22')](handleEntityNotFound(_0x574393,null))['then'](function(_0x3a3ff4){if(_0x3a3ff4){_0x121076[_0x23aa('0x44')]['AccountId']=_0x3a3ff4['id'];_0x121076[_0x23aa('0x44')][_0x23aa('0x4a')]=integrations[_0x23aa('0x4b')](_0x121076[_0x23aa('0x44')][_0x23aa('0x4c')],_0x121076[_0x23aa('0x44')][_0x23aa('0x3b')]);_0x121076['body'][_0x23aa('0x4d')]=integrations[_0x23aa('0x4e')](_0x121076[_0x23aa('0x44')][_0x23aa('0x4c')],_0x121076[_0x23aa('0x44')][_0x23aa('0x3b')]);return db[_0x23aa('0x48')][_0x23aa('0x42')](_0x121076[_0x23aa('0x44')],{'include':[{'model':db[_0x23aa('0x4f')],'as':_0x23aa('0x4a')},{'model':db[_0x23aa('0x4f')],'as':_0x23aa('0x4d')}]});}return null;})[_0x23aa('0x22')](respondWithResult(_0x574393,null))['catch'](handleError(_0x574393,null));};exports['getFields']=function(_0x5d2a66,_0x28bbc3,_0x390501){var _0x3c422e='';return db['FreshdeskAccount'][_0x23aa('0x47')]({'where':{'id':_0x5d2a66[_0x23aa('0x3f')]['id']},'attributes':['id','remoteUri',_0x23aa('0x50')]})[_0x23aa('0x22')](handleEntityNotFound(_0x28bbc3,null))[_0x23aa('0x22')](function(_0x14fc0a){if(_0x14fc0a){_0x3c422e=_0x14fc0a[_0x23aa('0x51')];var _0x19bf5e=_0x3c422e[_0x23aa('0x52')](-0x1);if(_0x19bf5e==='/'){_0x3c422e=_0x3c422e[_0x23aa('0x53')](0x0,_0x3c422e['lastIndexOf'](_0x19bf5e));}return rp({'method':_0x23aa('0x54'),'uri':util[_0x23aa('0x55')](_0x23aa('0x56'),_0x3c422e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x23aa('0x55')](_0x23aa('0x57'),new Buffer(util[_0x23aa('0x55')]('%s:X',_0x14fc0a[_0x23aa('0x50')]))[_0x23aa('0x58')](_0x23aa('0x59')))},'json':!![]});}})[_0x23aa('0x22')](function(_0x544d57){if(_0x544d57){var _0x10ca29=['requester','subject','agent',_0x23aa('0x5a'),_0x23aa('0x16'),_0x23aa('0x5b'),_0x23aa('0x5c'),_0x23aa('0x5d'),'ticket_type','group',_0x23aa('0x5e')];_[_0x23aa('0x5f')](_0x544d57,function(_0x4b9195){return _0x10ca29[_0x23aa('0x60')](_0x4b9195[_0x23aa('0x24')])||!_0x4b9195['default']&&_0x4b9195[_0x23aa('0x3b')]!==_0x23aa('0x61')&&_0x4b9195['type']!==_0x23aa('0x62');});return{'count':_0x544d57[_0x23aa('0x32')],'rows':_[_0x23aa('0x27')](_0x544d57,function(_0x39895a){return{'id':_0x39895a[_0x23aa('0x24')],'name':_0x39895a[_0x23aa('0x63')],'custom':!_0x39895a[_0x23aa('0x64')],'options':_0x39895a[_0x23aa('0x65')]?_[_0x23aa('0x27')](_0x39895a['choices'],function(_0x3e98b9){return{'name':_[_0x23aa('0x66')](_0x3e98b9),'value':_0x3e98b9};}):[]};})};}})[_0x23aa('0x22')](respondWithResult(_0x28bbc3,null))['catch'](function(_0x2cb555){var _0x5ace64=_0x5d2a66[_0x23aa('0x2d')][_0x23aa('0x67')]?0x1f4:_0x2cb555['statusCode']||0x1f4;logger[_0x23aa('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x23aa('0x68'),_0x5ace64,JSON[_0x23aa('0x69')](_0x2cb555));delete _0x2cb555['name'];if(_0x5ace64===0x191){_0x5ace64=0x190;}_0x28bbc3[_0x23aa('0x16')](_0x5ace64)['send'](_0x5d2a66[_0x23aa('0x2d')][_0x23aa('0x67')]?{'message':_0x23aa('0x6a'),'statusCode':_0x2cb555['statusCode']}:_0x2cb555);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2e698f4..4bd263f 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 _0x717b=['FreshdeskAccount','int_freshdesk_accounts','lodash','api','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xab0515,_0x4b8ab2){var _0x443d59=function(_0xfd6c59){while(--_0xfd6c59){_0xab0515['push'](_0xab0515['shift']());}};_0x443d59(++_0x4b8ab2);}(_0x717b,0x199));var _0xb717=function(_0xc318e1,_0x44db20){_0xc318e1=_0xc318e1-0x0;var _0x1b4383=_0x717b[_0xc318e1];return _0x1b4383;};'use strict';var _=require(_0xb717('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb717('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb717('0x2'));var fs=require('fs');var path=require(_0xb717('0x3'));var rimraf=require('rimraf');var config=require(_0xb717('0x4'));var attributes=require(_0xb717('0x5'));var integrations=require(_0xb717('0x6'));module[_0xb717('0x7')]=function(_0x26a017,_0x545a7f){return _0x26a017[_0xb717('0x8')](_0xb717('0x9'),attributes,{'tableName':_0xb717('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8135=['./intFreshdeskAccount.attributes','exports','define','int_freshdesk_accounts','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x27c6eb,_0xc574ab){var _0x5e2e4a=function(_0x1e0a12){while(--_0x1e0a12){_0x27c6eb['push'](_0x27c6eb['shift']());}};_0x5e2e4a(++_0xc574ab);}(_0x8135,0x159));var _0x5813=function(_0x143fea,_0x263f77){_0x143fea=_0x143fea-0x0;var _0x4c6ba3=_0x8135[_0x143fea];return _0x4c6ba3;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var logger=require('../../config/logger')(_0x5813('0x1'));var moment=require(_0x5813('0x2'));var BPromise=require('bluebird');var rp=require(_0x5813('0x3'));var fs=require('fs');var path=require(_0x5813('0x4'));var rimraf=require(_0x5813('0x5'));var config=require(_0x5813('0x6'));var attributes=require(_0x5813('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5813('0x8')]=function(_0x220a45,_0x2b951f){return _0x220a45[_0x5813('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x5813('0xa'),'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 16ce564..723f7fd 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 _0xf6e4=['model','GetFreshdeskAccount','ShowFreshdeskAccount','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map'];(function(_0x58eb56,_0x1e19c6){var _0x1ec600=function(_0x102ff1){while(--_0x102ff1){_0x58eb56['push'](_0x58eb56['shift']());}};_0x1ec600(++_0x1e19c6);}(_0xf6e4,0x16f));var _0x4f6e=function(_0x1f9942,_0x355d1f){_0x1f9942=_0x1f9942-0x0;var _0x2d34c1=_0xf6e4[_0x1f9942];return _0x2d34c1;};'use strict';var _=require('lodash');var util=require(_0x4f6e('0x0'));var moment=require('moment');var BPromise=require(_0x4f6e('0x1'));var rs=require(_0x4f6e('0x2'));var fs=require('fs');var Redis=require(_0x4f6e('0x3'));var db=require(_0x4f6e('0x4'))['db'];var utils=require(_0x4f6e('0x5'));var logger=require('../../config/logger')(_0x4f6e('0x6'));var config=require(_0x4f6e('0x7'));var jayson=require(_0x4f6e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53fd17,_0x377b87,_0x16f4e8){return new BPromise(function(_0x1b22c6,_0xe4e0e9){return client['request'](_0x53fd17,_0x16f4e8)[_0x4f6e('0x9')](function(_0x318e12){logger[_0x4f6e('0xa')](_0x4f6e('0xb'),_0x377b87,'request\x20sent');logger[_0x4f6e('0xc')](_0x4f6e('0xd'),_0x377b87,_0x4f6e('0xe'),JSON[_0x4f6e('0xf')](_0x318e12));if(_0x318e12['error']){if(_0x318e12['error'][_0x4f6e('0x10')]===0x1f4){logger[_0x4f6e('0x11')](_0x4f6e('0xb'),_0x377b87,_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);return _0xe4e0e9(_0x318e12[_0x4f6e('0x11')]['message']);}logger[_0x4f6e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x377b87,_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);return _0x1b22c6(_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);}else{logger[_0x4f6e('0xa')](_0x4f6e('0xb'),_0x377b87,_0x4f6e('0xe'));_0x1b22c6(_0x318e12[_0x4f6e('0x13')][_0x4f6e('0x12')]);}})[_0x4f6e('0x14')](function(_0x5b6558){logger[_0x4f6e('0x11')](_0x4f6e('0xb'),_0x377b87,_0x5b6558);_0xe4e0e9(_0x5b6558);});});}exports['GetFreshdeskAccount']=function(_0xec6403){var _0x38851c=this;return new Promise(function(_0x3e7686,_0x1a17f1){return db[_0x4f6e('0x15')][_0x4f6e('0x16')]({'raw':_0xec6403[_0x4f6e('0x17')]?_0xec6403[_0x4f6e('0x17')][_0x4f6e('0x18')]===undefined?!![]:![]:!![],'where':_0xec6403[_0x4f6e('0x17')]?_0xec6403[_0x4f6e('0x17')]['where']||null:null,'attributes':_0xec6403[_0x4f6e('0x17')]?_0xec6403['options'][_0x4f6e('0x19')]||null:null,'limit':_0xec6403[_0x4f6e('0x17')]?_0xec6403['options'][_0x4f6e('0x1a')]||null:null,'include':_0xec6403['options']?_0xec6403[_0x4f6e('0x17')][_0x4f6e('0x1b')]?_[_0x4f6e('0x1c')](_0xec6403['options'][_0x4f6e('0x1b')],function(_0x3bdc73){return{'model':db[_0x3bdc73['model']],'as':_0x3bdc73['as'],'attributes':_0x3bdc73[_0x4f6e('0x19')],'include':_0x3bdc73[_0x4f6e('0x1b')]?_[_0x4f6e('0x1c')](_0x3bdc73[_0x4f6e('0x1b')],function(_0x25e58e){return{'model':db[_0x25e58e[_0x4f6e('0x1d')]],'as':_0x25e58e['as'],'attributes':_0x25e58e[_0x4f6e('0x19')],'include':_0x25e58e[_0x4f6e('0x1b')]?_['map'](_0x25e58e['include'],function(_0x5ecd7b){return{'model':db[_0x5ecd7b[_0x4f6e('0x1d')]],'as':_0x5ecd7b['as'],'attributes':_0x5ecd7b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ac7d0){logger[_0x4f6e('0xa')]('GetFreshdeskAccount',_0xec6403);logger[_0x4f6e('0xc')](_0x4f6e('0x1e'),_0xec6403,JSON[_0x4f6e('0xf')](_0x3ac7d0));_0x3e7686(_0x3ac7d0);})[_0x4f6e('0x14')](function(_0x33f733){logger[_0x4f6e('0x11')](_0x4f6e('0x1e'),_0x33f733[_0x4f6e('0x12')],_0xec6403);_0x1a17f1(_0x38851c['error'](0x1f4,_0x33f733[_0x4f6e('0x12')]));});});};exports[_0x4f6e('0x1f')]=function(_0x222522){var _0x1f7971=this;return new Promise(function(_0x30855a,_0x278b26){return db['FreshdeskAccount']['find']({'raw':_0x222522['options']?_0x222522['options']['raw']===undefined?!![]:![]:!![],'where':_0x222522[_0x4f6e('0x17')]?_0x222522[_0x4f6e('0x17')][_0x4f6e('0x20')]||null:null,'attributes':_0x222522[_0x4f6e('0x17')]?_0x222522[_0x4f6e('0x17')][_0x4f6e('0x19')]||null:null,'include':_0x222522['options']?_0x222522[_0x4f6e('0x17')]['include']?_['map'](_0x222522['options'][_0x4f6e('0x1b')],function(_0x28b20e){return{'model':db[_0x28b20e[_0x4f6e('0x1d')]],'as':_0x28b20e['as'],'attributes':_0x28b20e[_0x4f6e('0x19')],'include':_0x28b20e['include']?_[_0x4f6e('0x1c')](_0x28b20e[_0x4f6e('0x1b')],function(_0x249800){return{'model':db[_0x249800['model']],'as':_0x249800['as'],'attributes':_0x249800[_0x4f6e('0x19')],'include':_0x249800[_0x4f6e('0x1b')]?_[_0x4f6e('0x1c')](_0x249800[_0x4f6e('0x1b')],function(_0x5731ae){return{'model':db[_0x5731ae[_0x4f6e('0x1d')]],'as':_0x5731ae['as'],'attributes':_0x5731ae[_0x4f6e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f6e('0x9')](function(_0x147325){logger[_0x4f6e('0xa')](_0x4f6e('0x1f'),_0x222522);logger[_0x4f6e('0xc')]('ShowFreshdeskAccount',_0x222522,JSON[_0x4f6e('0xf')](_0x147325));_0x30855a(_0x147325);})[_0x4f6e('0x14')](function(_0x19b3d0){logger[_0x4f6e('0x11')](_0x4f6e('0x1f'),_0x19b3d0['message'],_0x222522);_0x278b26(_0x1f7971[_0x4f6e('0x11')](0x1f4,_0x19b3d0['message']));});});}; \ No newline at end of file +var _0x1ed0=['limit','include','map','model','stringify','ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0x35b145,_0x244191){var _0x59a344=function(_0x565678){while(--_0x565678){_0x35b145['push'](_0x35b145['shift']());}};_0x59a344(++_0x244191);}(_0x1ed0,0x103));var _0x01ed=function(_0x3ad1ab,_0x3c8799){_0x3ad1ab=_0x3ad1ab-0x0;var _0x26d4c9=_0x1ed0[_0x3ad1ab];return _0x26d4c9;};'use strict';var _=require(_0x01ed('0x0'));var util=require(_0x01ed('0x1'));var moment=require(_0x01ed('0x2'));var BPromise=require('bluebird');var rs=require(_0x01ed('0x3'));var fs=require('fs');var Redis=require(_0x01ed('0x4'));var db=require(_0x01ed('0x5'))['db'];var utils=require(_0x01ed('0x6'));var logger=require('../../config/logger')(_0x01ed('0x7'));var config=require(_0x01ed('0x8'));var jayson=require(_0x01ed('0x9'));var client=jayson['client'][_0x01ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12cbe0,_0x3b5450,_0x37672f){return new BPromise(function(_0x41f68c,_0x47dd9b){return client[_0x01ed('0xb')](_0x12cbe0,_0x37672f)[_0x01ed('0xc')](function(_0x35db8c){logger[_0x01ed('0xd')](_0x01ed('0xe'),_0x3b5450,_0x01ed('0xf'));logger[_0x01ed('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3b5450,_0x01ed('0xf'),JSON['stringify'](_0x35db8c));if(_0x35db8c[_0x01ed('0x11')]){if(_0x35db8c[_0x01ed('0x11')][_0x01ed('0x12')]===0x1f4){logger[_0x01ed('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b5450,_0x35db8c[_0x01ed('0x11')]['message']);return _0x47dd9b(_0x35db8c[_0x01ed('0x11')][_0x01ed('0x13')]);}logger[_0x01ed('0x11')](_0x01ed('0xe'),_0x3b5450,_0x35db8c[_0x01ed('0x11')]['message']);return _0x41f68c(_0x35db8c['error'][_0x01ed('0x13')]);}else{logger['info'](_0x01ed('0xe'),_0x3b5450,_0x01ed('0xf'));_0x41f68c(_0x35db8c[_0x01ed('0x14')]['message']);}})[_0x01ed('0x15')](function(_0x2d1c55){logger['error'](_0x01ed('0xe'),_0x3b5450,_0x2d1c55);_0x47dd9b(_0x2d1c55);});});}exports[_0x01ed('0x16')]=function(_0x50397a){var _0x6c23ad=this;return new Promise(function(_0x978ca0,_0x568d7a){return db[_0x01ed('0x17')][_0x01ed('0x18')]({'raw':_0x50397a[_0x01ed('0x19')]?_0x50397a[_0x01ed('0x19')][_0x01ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x50397a[_0x01ed('0x19')]?_0x50397a[_0x01ed('0x19')][_0x01ed('0x1b')]||null:null,'attributes':_0x50397a['options']?_0x50397a[_0x01ed('0x19')][_0x01ed('0x1c')]||null:null,'limit':_0x50397a[_0x01ed('0x19')]?_0x50397a[_0x01ed('0x19')][_0x01ed('0x1d')]||null:null,'include':_0x50397a[_0x01ed('0x19')]?_0x50397a[_0x01ed('0x19')][_0x01ed('0x1e')]?_['map'](_0x50397a['options'][_0x01ed('0x1e')],function(_0x53a857){return{'model':db[_0x53a857['model']],'as':_0x53a857['as'],'attributes':_0x53a857['attributes'],'include':_0x53a857[_0x01ed('0x1e')]?_[_0x01ed('0x1f')](_0x53a857[_0x01ed('0x1e')],function(_0x40d434){return{'model':db[_0x40d434[_0x01ed('0x20')]],'as':_0x40d434['as'],'attributes':_0x40d434[_0x01ed('0x1c')],'include':_0x40d434[_0x01ed('0x1e')]?_[_0x01ed('0x1f')](_0x40d434['include'],function(_0x2066b3){return{'model':db[_0x2066b3[_0x01ed('0x20')]],'as':_0x2066b3['as'],'attributes':_0x2066b3[_0x01ed('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x01ed('0xc')](function(_0x1b28a1){logger[_0x01ed('0xd')](_0x01ed('0x16'),_0x50397a);logger['debug'](_0x01ed('0x16'),_0x50397a,JSON[_0x01ed('0x21')](_0x1b28a1));_0x978ca0(_0x1b28a1);})[_0x01ed('0x15')](function(_0x46667d){logger[_0x01ed('0x11')](_0x01ed('0x16'),_0x46667d[_0x01ed('0x13')],_0x50397a);_0x568d7a(_0x6c23ad[_0x01ed('0x11')](0x1f4,_0x46667d[_0x01ed('0x13')]));});});};exports[_0x01ed('0x22')]=function(_0x3ffc7e){var _0x50148d=this;return new Promise(function(_0x135b1c,_0x4c1e03){return db['FreshdeskAccount'][_0x01ed('0x23')]({'raw':_0x3ffc7e[_0x01ed('0x19')]?_0x3ffc7e[_0x01ed('0x19')][_0x01ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ffc7e[_0x01ed('0x19')]?_0x3ffc7e[_0x01ed('0x19')]['where']||null:null,'attributes':_0x3ffc7e[_0x01ed('0x19')]?_0x3ffc7e[_0x01ed('0x19')][_0x01ed('0x1c')]||null:null,'include':_0x3ffc7e[_0x01ed('0x19')]?_0x3ffc7e['options'][_0x01ed('0x1e')]?_[_0x01ed('0x1f')](_0x3ffc7e['options'][_0x01ed('0x1e')],function(_0x29fb){return{'model':db[_0x29fb[_0x01ed('0x20')]],'as':_0x29fb['as'],'attributes':_0x29fb[_0x01ed('0x1c')],'include':_0x29fb[_0x01ed('0x1e')]?_['map'](_0x29fb[_0x01ed('0x1e')],function(_0x315c3e){return{'model':db[_0x315c3e[_0x01ed('0x20')]],'as':_0x315c3e['as'],'attributes':_0x315c3e[_0x01ed('0x1c')],'include':_0x315c3e[_0x01ed('0x1e')]?_[_0x01ed('0x1f')](_0x315c3e[_0x01ed('0x1e')],function(_0x42743e){return{'model':db[_0x42743e[_0x01ed('0x20')]],'as':_0x42743e['as'],'attributes':_0x42743e[_0x01ed('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2db3ec){logger[_0x01ed('0xd')](_0x01ed('0x22'),_0x3ffc7e);logger[_0x01ed('0x10')](_0x01ed('0x22'),_0x3ffc7e,JSON[_0x01ed('0x21')](_0x2db3ec));_0x135b1c(_0x2db3ec);})[_0x01ed('0x15')](function(_0x2706e7){logger[_0x01ed('0x11')](_0x01ed('0x22'),_0x2706e7['message'],_0x3ffc7e);_0x4c1e03(_0x50148d[_0x01ed('0x11')](0x1f4,_0x2706e7['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4f398f2..c4f5743 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 _0xc47e=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','multer','util','path','connect-timeout'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xc47e,0x1b1));var _0xec47=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0xc47e[_0x22bdd3];return _0x44d9d9;};'use strict';var multer=require(_0xec47('0x0'));var util=require(_0xec47('0x1'));var path=require(_0xec47('0x2'));var timeout=require(_0xec47('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xec47('0x4'));var auth=require(_0xec47('0x5'));var interaction=require(_0xec47('0x6'));var config=require('../../config/environment');var controller=require(_0xec47('0x7'));router[_0xec47('0x8')]('/',auth[_0xec47('0x9')](),controller['index']);router[_0xec47('0x8')](_0xec47('0xa'),auth[_0xec47('0x9')](),controller[_0xec47('0xb')]);router[_0xec47('0x8')]('/:id/fields',auth[_0xec47('0x9')](),controller[_0xec47('0xc')]);router['get'](_0xec47('0xd'),auth['isAuthenticated'](),controller[_0xec47('0xe')]);router[_0xec47('0x8')](_0xec47('0xf'),auth['isAuthenticated'](),controller[_0xec47('0x10')]);router[_0xec47('0x8')](_0xec47('0x11'),auth[_0xec47('0x9')](),controller[_0xec47('0x12')]);router[_0xec47('0x13')]('/',auth[_0xec47('0x9')](),controller[_0xec47('0x14')]);router['post'](_0xec47('0x11'),auth[_0xec47('0x9')](),controller[_0xec47('0x15')]);router[_0xec47('0x16')](_0xec47('0xa'),auth[_0xec47('0x9')](),controller['update']);router['delete'](_0xec47('0xa'),auth[_0xec47('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6187=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','create','post','setTags','put','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x34c011,_0xb36217){var _0x4c8a5e=function(_0x1d1d23){while(--_0x1d1d23){_0x34c011['push'](_0x34c011['shift']());}};_0x4c8a5e(++_0xb36217);}(_0x6187,0x1bd));var _0x7618=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x6187[_0x2f1762];return _0x8ab21;};'use strict';var multer=require(_0x7618('0x0'));var util=require('util');var path=require(_0x7618('0x1'));var timeout=require(_0x7618('0x2'));var express=require(_0x7618('0x3'));var router=express[_0x7618('0x4')]();var fs_extra=require(_0x7618('0x5'));var auth=require(_0x7618('0x6'));var interaction=require(_0x7618('0x7'));var config=require(_0x7618('0x8'));var controller=require(_0x7618('0x9'));router[_0x7618('0xa')]('/',auth[_0x7618('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7618('0xc')]);router[_0x7618('0xa')](_0x7618('0xd'),auth[_0x7618('0xb')](),controller[_0x7618('0xe')]);router[_0x7618('0xa')](_0x7618('0xf'),auth[_0x7618('0xb')](),controller['getSubjects']);router[_0x7618('0xa')](_0x7618('0x10'),auth[_0x7618('0xb')](),controller['getDescriptions']);router[_0x7618('0xa')](_0x7618('0x11'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x7618('0xb')](),controller[_0x7618('0x12')]);router[_0x7618('0x13')]('/:id/tags',auth[_0x7618('0xb')](),controller[_0x7618('0x14')]);router[_0x7618('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7618('0x16'),auth[_0x7618('0xb')](),controller[_0x7618('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ff97470..777a0f0 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 _0xd81b=['exports','STRING','sequelize'];(function(_0x3af693,_0x220857){var _0x385005=function(_0x34e968){while(--_0x34e968){_0x3af693['push'](_0x3af693['shift']());}};_0x385005(++_0x220857);}(_0xd81b,0x1f1));var _0xbd81=function(_0x4df6bf,_0x53fc2e){_0x4df6bf=_0x4df6bf-0x0;var _0x1e0063=_0xd81b[_0x4df6bf];return _0x1e0063;};'use strict';var Sequelize=require(_0xbd81('0x0'));module[_0xbd81('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbd81('0x2')]}}; \ No newline at end of file +var _0x6cc4=['exports','sequelize'];(function(_0x2369af,_0x3048b6){var _0x1bc191=function(_0x14e3e7){while(--_0x14e3e7){_0x2369af['push'](_0x2369af['shift']());}};_0x1bc191(++_0x3048b6);}(_0x6cc4,0x193));var _0x46cc=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6cc4[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x46cc('0x0'));module[_0x46cc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8f03ff4..799ffb4 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 _0xe75a=['find','create','body','params','FreshdeskField','sort','getFields','findOne','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe75a,0x161));var _0xae75=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xe75a[_0x104a84];return _0x4973ff;};'use strict';var emlformat=require(_0xae75('0x0'));var rimraf=require(_0xae75('0x1'));var zipdir=require(_0xae75('0x2'));var jsonpatch=require(_0xae75('0x3'));var rp=require(_0xae75('0x4'));var moment=require(_0xae75('0x5'));var BPromise=require(_0xae75('0x6'));var Mustache=require(_0xae75('0x7'));var util=require(_0xae75('0x8'));var path=require('path');var sox=require(_0xae75('0x9'));var csv=require(_0xae75('0xa'));var ejs=require(_0xae75('0xb'));var fs=require('fs');var fs_extra=require(_0xae75('0xc'));var _=require(_0xae75('0xd'));var squel=require(_0xae75('0xe'));var crypto=require(_0xae75('0xf'));var jsforce=require(_0xae75('0x10'));var deskjs=require(_0xae75('0x11'));var toCsv=require(_0xae75('0xa'));var querystring=require(_0xae75('0x12'));var Papa=require(_0xae75('0x13'));var Redis=require(_0xae75('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xae75('0x15'));var as=require(_0xae75('0x16'));var hardwareService=require(_0xae75('0x17'));var logger=require(_0xae75('0x18'))(_0xae75('0x19'));var utils=require(_0xae75('0x1a'));var config=require(_0xae75('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xae75('0x1c'))['db'];function respondWithStatusCode(_0x215df5,_0x3680e4){_0x3680e4=_0x3680e4||0xcc;return function(_0x47b8fe){if(_0x47b8fe){return _0x215df5[_0xae75('0x1d')](_0x3680e4);}return _0x215df5[_0xae75('0x1e')](_0x3680e4)[_0xae75('0x1f')]();};}function respondWithResult(_0x5d7e63,_0x41a09b){_0x41a09b=_0x41a09b||0xc8;return function(_0x2f2107){if(_0x2f2107){return _0x5d7e63['status'](_0x41a09b)['json'](_0x2f2107);}};}function respondWithFilteredResult(_0x238238,_0x2554bb){return function(_0x34b0b4){if(_0x34b0b4){var _0x2bd786=typeof _0x2554bb['offset']===_0xae75('0x20')&&typeof _0x2554bb[_0xae75('0x21')]===_0xae75('0x20');var _0x53a596=_0x34b0b4['count'];var _0x47ebbf=_0x2bd786?0x0:_0x2554bb[_0xae75('0x22')];var _0x8cd9ce=_0x2bd786?_0x34b0b4[_0xae75('0x23')]:_0x2554bb[_0xae75('0x22')]+_0x2554bb['limit'];var _0x216bf3;if(_0x8cd9ce>=_0x53a596){_0x8cd9ce=_0x53a596;_0x216bf3=0xc8;}else{_0x216bf3=0xce;}_0x238238[_0xae75('0x1e')](_0x216bf3);return _0x238238['set'](_0xae75('0x24'),_0x47ebbf+'-'+_0x8cd9ce+'/'+_0x53a596)[_0xae75('0x25')](_0x34b0b4);}return null;};}function patchUpdates(_0x2cbb12){return function(_0x5cfb4b){try{jsonpatch[_0xae75('0x26')](_0x5cfb4b,_0x2cbb12,!![]);}catch(_0x614de2){return BPromise[_0xae75('0x27')](_0x614de2);}return _0x5cfb4b['save']();};}function saveUpdates(_0x522de8,_0x247319){return function(_0x3d312f){if(_0x3d312f){return _0x3d312f[_0xae75('0x28')](_0x522de8)[_0xae75('0x29')](function(_0x3bbc89){return _0x3bbc89;});}return null;};}function removeEntity(_0x2c1619,_0x23de29){return function(_0x30d070){if(_0x30d070){return _0x30d070[_0xae75('0x2a')]()[_0xae75('0x29')](function(){_0x2c1619[_0xae75('0x1e')](0xcc)[_0xae75('0x1f')]();});}};}function handleEntityNotFound(_0x3c1138,_0x58cb2e){return function(_0x2b6e28){if(!_0x2b6e28){_0x3c1138['sendStatus'](0x194);}return _0x2b6e28;};}function handleError(_0x228c53,_0x113baa){_0x113baa=_0x113baa||0x1f4;return function(_0x3c55ac){logger['error'](_0x3c55ac[_0xae75('0x2b')]);if(_0x3c55ac[_0xae75('0x2c')]){delete _0x3c55ac[_0xae75('0x2c')];}_0x228c53[_0xae75('0x1e')](_0x113baa)[_0xae75('0x2d')](_0x3c55ac);};}exports[_0xae75('0x2e')]=function(_0x2d0aa5,_0x359e4){var _0xdddb93={},_0x44c825={},_0x36c424={'count':0x0,'rows':[]};var _0x197c77=_[_0xae75('0x2f')](db[_0xae75('0x30')][_0xae75('0x31')],function(_0x25b471){return{'name':_0x25b471['fieldName'],'type':_0x25b471['type'][_0xae75('0x32')]};});_0x44c825[_0xae75('0x33')]=_['map'](_0x197c77,_0xae75('0x2c'));_0x44c825[_0xae75('0x34')]=_[_0xae75('0x35')](_0x2d0aa5[_0xae75('0x34')]);_0x44c825[_0xae75('0x36')]=_[_0xae75('0x37')](_0x44c825['model'],_0x44c825[_0xae75('0x34')]);_0xdddb93[_0xae75('0x38')]=_[_0xae75('0x37')](_0x44c825[_0xae75('0x33')],qs[_0xae75('0x39')](_0x2d0aa5[_0xae75('0x34')]['fields']));_0xdddb93[_0xae75('0x38')]=_0xdddb93[_0xae75('0x38')][_0xae75('0x3a')]?_0xdddb93['attributes']:_0x44c825['model'];if(!_0x2d0aa5[_0xae75('0x34')][_0xae75('0x3b')]('nolimit')){_0xdddb93[_0xae75('0x21')]=qs['limit'](_0x2d0aa5[_0xae75('0x34')][_0xae75('0x21')]);_0xdddb93[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x2d0aa5[_0xae75('0x34')]['offset']);}_0xdddb93[_0xae75('0x3c')]=qs['sort'](_0x2d0aa5['query']['sort']);_0xdddb93[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x2d0aa5[_0xae75('0x34')],_0x44c825[_0xae75('0x36')]),_0x197c77);if(_0x2d0aa5[_0xae75('0x34')][_0xae75('0x3f')]){_0xdddb93[_0xae75('0x3d')]=_[_0xae75('0x40')](_0xdddb93[_0xae75('0x3d')],{'$or':_[_0xae75('0x2f')](_0x197c77,function(_0xeba610){if(_0xeba610['type']!==_0xae75('0x41')){var _0x1070b2={};_0x1070b2[_0xeba610[_0xae75('0x2c')]]={'$like':'%'+_0x2d0aa5['query'][_0xae75('0x3f')]+'%'};return _0x1070b2;}})});}_0xdddb93=_[_0xae75('0x40')]({},_0xdddb93,_0x2d0aa5[_0xae75('0x42')]);var _0x1e8d49={'where':_0xdddb93['where']};return db[_0xae75('0x30')][_0xae75('0x23')](_0x1e8d49)[_0xae75('0x29')](function(_0x4503e8){_0x36c424[_0xae75('0x23')]=_0x4503e8;if(_0x2d0aa5[_0xae75('0x34')][_0xae75('0x43')]){_0xdddb93[_0xae75('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0xdddb93);})[_0xae75('0x29')](function(_0xd8954b){_0x36c424[_0xae75('0x45')]=_0xd8954b;return _0x36c424;})[_0xae75('0x29')](respondWithFilteredResult(_0x359e4,_0xdddb93))[_0xae75('0x46')](handleError(_0x359e4,null));};exports[_0xae75('0x47')]=function(_0x1423d4,_0x304181){var _0x1d47eb={'raw':![],'where':{'id':_0x1423d4['params']['id']}},_0x4e344a={};_0x4e344a[_0xae75('0x33')]=_['keys'](db[_0xae75('0x30')][_0xae75('0x31')]);_0x4e344a[_0xae75('0x34')]=_[_0xae75('0x35')](_0x1423d4['query']);_0x4e344a['filters']=_[_0xae75('0x37')](_0x4e344a['model'],_0x4e344a[_0xae75('0x34')]);_0x1d47eb[_0xae75('0x38')]=_[_0xae75('0x37')](_0x4e344a[_0xae75('0x33')],qs[_0xae75('0x39')](_0x1423d4[_0xae75('0x34')]['fields']));_0x1d47eb[_0xae75('0x38')]=_0x1d47eb[_0xae75('0x38')]['length']?_0x1d47eb[_0xae75('0x38')]:_0x4e344a[_0xae75('0x33')];if(_0x1423d4[_0xae75('0x34')][_0xae75('0x43')]){_0x1d47eb[_0xae75('0x44')]=[{'all':!![]}];}_0x1d47eb=_[_0xae75('0x40')]({},_0x1d47eb,_0x1423d4['options']);return db[_0xae75('0x30')][_0xae75('0x48')](_0x1d47eb)['then'](handleEntityNotFound(_0x304181,null))[_0xae75('0x29')](respondWithResult(_0x304181,null))[_0xae75('0x46')](handleError(_0x304181,null));};exports[_0xae75('0x49')]=function(_0xc6b0a4,_0x2b379d){return db[_0xae75('0x30')][_0xae75('0x49')](_0xc6b0a4[_0xae75('0x4a')],{})['then'](respondWithResult(_0x2b379d,0xc9))[_0xae75('0x46')](handleError(_0x2b379d,null));};exports[_0xae75('0x28')]=function(_0x1a64cb,_0x113b70){if(_0x1a64cb[_0xae75('0x4a')]['id']){delete _0x1a64cb[_0xae75('0x4a')]['id'];}return db[_0xae75('0x30')][_0xae75('0x48')]({'where':{'id':_0x1a64cb[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x113b70,null))[_0xae75('0x29')](saveUpdates(_0x1a64cb[_0xae75('0x4a')],null))['then'](respondWithResult(_0x113b70,null))[_0xae75('0x46')](handleError(_0x113b70,null));};exports['destroy']=function(_0x2bbbad,_0x1ccdfd){return db[_0xae75('0x30')][_0xae75('0x48')]({'where':{'id':_0x2bbbad[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x1ccdfd,null))[_0xae75('0x29')](removeEntity(_0x1ccdfd,null))[_0xae75('0x46')](handleError(_0x1ccdfd,null));};exports['getFields']=function(_0x215153,_0x1e1d60,_0x261a8b){var _0x5591fb={};var _0x44cf94={};var _0xd1975b;var _0x889d6a;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x215153[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x1e1d60,null))[_0xae75('0x29')](function(_0x3c58ef){if(_0x3c58ef){_0xd1975b=_0x3c58ef;_0x44cf94[_0xae75('0x33')]=_[_0xae75('0x35')](db[_0xae75('0x4c')][_0xae75('0x31')]);_0x44cf94[_0xae75('0x34')]=_['keys'](_0x215153['query']);_0x44cf94[_0xae75('0x36')]=_['intersection'](_0x44cf94[_0xae75('0x33')],_0x44cf94[_0xae75('0x34')]);_0x5591fb[_0xae75('0x38')]=_[_0xae75('0x37')](_0x44cf94[_0xae75('0x33')],qs['fields'](_0x215153[_0xae75('0x34')][_0xae75('0x39')]));_0x5591fb[_0xae75('0x38')]=_0x5591fb['attributes'][_0xae75('0x3a')]?_0x5591fb[_0xae75('0x38')]:_0x44cf94[_0xae75('0x33')];_0x5591fb['order']=qs[_0xae75('0x4d')](_0x215153['query'][_0xae75('0x4d')]);_0x5591fb[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x215153[_0xae75('0x34')],_0x44cf94[_0xae75('0x36')]));if(_0x215153[_0xae75('0x34')][_0xae75('0x3f')]){_0x5591fb[_0xae75('0x3d')]=_[_0xae75('0x40')](_0x5591fb[_0xae75('0x3d')],{'$or':_[_0xae75('0x2f')](_0x5591fb['attributes'],function(_0x3e7a61){var _0x54e8b3={};_0x54e8b3[_0x3e7a61]={'$like':'%'+_0x215153[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x54e8b3;})});}_0x5591fb=_['merge']({},_0x5591fb,_0x215153[_0xae75('0x42')]);return _0xd1975b[_0xae75('0x4e')](_0x5591fb);}})['then'](function(_0x2cb7a3){if(_0x2cb7a3){_0x889d6a=_0x2cb7a3[_0xae75('0x3a')];if(!_0x215153[_0xae75('0x34')][_0xae75('0x3b')]('nolimit')){_0x5591fb['limit']=qs[_0xae75('0x21')](_0x215153[_0xae75('0x34')][_0xae75('0x21')]);_0x5591fb['offset']=qs['offset'](_0x215153[_0xae75('0x34')][_0xae75('0x22')]);}return _0xd1975b['getFields'](_0x5591fb);}})[_0xae75('0x29')](function(_0xd647bf){if(_0xd647bf){return _0xd647bf?{'count':_0x889d6a,'rows':_0xd647bf}:null;}})[_0xae75('0x29')](respondWithResult(_0x1e1d60,null))[_0xae75('0x46')](handleError(_0x1e1d60,null));};exports['getSubjects']=function(_0x3ccf28,_0x395387,_0x603547){var _0x244a67={};var _0x360b21={};var _0x155250;var _0x300c6d;return db[_0xae75('0x30')][_0xae75('0x4f')]({'where':{'id':_0x3ccf28[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x395387,null))[_0xae75('0x29')](function(_0x2b743d){if(_0x2b743d){_0x155250=_0x2b743d;_0x360b21[_0xae75('0x33')]=_['keys'](db[_0xae75('0x4c')][_0xae75('0x31')]);_0x360b21[_0xae75('0x34')]=_[_0xae75('0x35')](_0x3ccf28[_0xae75('0x34')]);_0x360b21['filters']=_[_0xae75('0x37')](_0x360b21['model'],_0x360b21[_0xae75('0x34')]);_0x244a67[_0xae75('0x38')]=_['intersection'](_0x360b21[_0xae75('0x33')],qs[_0xae75('0x39')](_0x3ccf28[_0xae75('0x34')]['fields']));_0x244a67[_0xae75('0x38')]=_0x244a67[_0xae75('0x38')]['length']?_0x244a67[_0xae75('0x38')]:_0x360b21[_0xae75('0x33')];_0x244a67['order']=qs[_0xae75('0x4d')](_0x3ccf28['query'][_0xae75('0x4d')]);_0x244a67[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x3ccf28['query'],_0x360b21[_0xae75('0x36')]));if(_0x3ccf28[_0xae75('0x34')][_0xae75('0x3f')]){_0x244a67[_0xae75('0x3d')]=_['merge'](_0x244a67[_0xae75('0x3d')],{'$or':_['map'](_0x244a67[_0xae75('0x38')],function(_0x4985bf){var _0x1802e2={};_0x1802e2[_0x4985bf]={'$like':'%'+_0x3ccf28[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x1802e2;})});}_0x244a67=_[_0xae75('0x40')]({},_0x244a67,_0x3ccf28['options']);return _0x155250['getSubjects'](_0x244a67);}})[_0xae75('0x29')](function(_0x5927aa){if(_0x5927aa){_0x300c6d=_0x5927aa[_0xae75('0x3a')];if(!_0x3ccf28[_0xae75('0x34')][_0xae75('0x3b')](_0xae75('0x50'))){_0x244a67[_0xae75('0x21')]=qs[_0xae75('0x21')](_0x3ccf28[_0xae75('0x34')]['limit']);_0x244a67[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x3ccf28[_0xae75('0x34')][_0xae75('0x22')]);}return _0x155250['getSubjects'](_0x244a67);}})[_0xae75('0x29')](function(_0x1a12c8){if(_0x1a12c8){return _0x1a12c8?{'count':_0x300c6d,'rows':_0x1a12c8}:null;}})[_0xae75('0x29')](respondWithResult(_0x395387,null))[_0xae75('0x46')](handleError(_0x395387,null));};exports['getDescriptions']=function(_0x735082,_0x353239,_0xfef92e){var _0x37a8b6={};var _0x4e123f={};var _0x252974;var _0x3f1cf9;return db[_0xae75('0x30')]['findOne']({'where':{'id':_0x735082[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x353239,null))[_0xae75('0x29')](function(_0xd0377e){if(_0xd0377e){_0x252974=_0xd0377e;_0x4e123f[_0xae75('0x33')]=_[_0xae75('0x35')](db[_0xae75('0x4c')][_0xae75('0x31')]);_0x4e123f['query']=_[_0xae75('0x35')](_0x735082[_0xae75('0x34')]);_0x4e123f[_0xae75('0x36')]=_['intersection'](_0x4e123f[_0xae75('0x33')],_0x4e123f[_0xae75('0x34')]);_0x37a8b6['attributes']=_[_0xae75('0x37')](_0x4e123f[_0xae75('0x33')],qs[_0xae75('0x39')](_0x735082[_0xae75('0x34')][_0xae75('0x39')]));_0x37a8b6['attributes']=_0x37a8b6[_0xae75('0x38')][_0xae75('0x3a')]?_0x37a8b6['attributes']:_0x4e123f[_0xae75('0x33')];_0x37a8b6['order']=qs[_0xae75('0x4d')](_0x735082[_0xae75('0x34')]['sort']);_0x37a8b6['where']=qs[_0xae75('0x36')](_['pick'](_0x735082[_0xae75('0x34')],_0x4e123f[_0xae75('0x36')]));if(_0x735082[_0xae75('0x34')][_0xae75('0x3f')]){_0x37a8b6[_0xae75('0x3d')]=_[_0xae75('0x40')](_0x37a8b6['where'],{'$or':_['map'](_0x37a8b6[_0xae75('0x38')],function(_0x13b72f){var _0x210f97={};_0x210f97[_0x13b72f]={'$like':'%'+_0x735082[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x210f97;})});}_0x37a8b6=_['merge']({},_0x37a8b6,_0x735082[_0xae75('0x42')]);return _0x252974[_0xae75('0x51')](_0x37a8b6);}})['then'](function(_0x2e78a2){if(_0x2e78a2){_0x3f1cf9=_0x2e78a2['length'];if(!_0x735082[_0xae75('0x34')][_0xae75('0x3b')](_0xae75('0x50'))){_0x37a8b6[_0xae75('0x21')]=qs[_0xae75('0x21')](_0x735082[_0xae75('0x34')][_0xae75('0x21')]);_0x37a8b6[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x735082[_0xae75('0x34')]['offset']);}return _0x252974[_0xae75('0x51')](_0x37a8b6);}})[_0xae75('0x29')](function(_0x437175){if(_0x437175){return _0x437175?{'count':_0x3f1cf9,'rows':_0x437175}:null;}})[_0xae75('0x29')](respondWithResult(_0x353239,null))['catch'](handleError(_0x353239,null));};exports[_0xae75('0x52')]=function(_0x1566d2,_0x554b09,_0xa11ce8){var _0x3cea74={};var _0x2412c0={};var _0x569508;var _0x3d5732;return db[_0xae75('0x30')][_0xae75('0x4f')]({'where':{'id':_0x1566d2[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x554b09,null))[_0xae75('0x29')](function(_0x3de485){if(_0x3de485){_0x569508=_0x3de485;_0x2412c0[_0xae75('0x33')]=_[_0xae75('0x35')](db['Tag'][_0xae75('0x31')]);_0x2412c0[_0xae75('0x34')]=_[_0xae75('0x35')](_0x1566d2[_0xae75('0x34')]);_0x2412c0[_0xae75('0x36')]=_[_0xae75('0x37')](_0x2412c0[_0xae75('0x33')],_0x2412c0['query']);_0x3cea74[_0xae75('0x38')]=_['intersection'](_0x2412c0[_0xae75('0x33')],qs[_0xae75('0x39')](_0x1566d2[_0xae75('0x34')][_0xae75('0x39')]));_0x3cea74[_0xae75('0x38')]=_0x3cea74[_0xae75('0x38')][_0xae75('0x3a')]?_0x3cea74['attributes']:_0x2412c0[_0xae75('0x33')];_0x3cea74[_0xae75('0x3c')]=qs[_0xae75('0x4d')](_0x1566d2['query']['sort']);_0x3cea74[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x1566d2[_0xae75('0x34')],_0x2412c0['filters']));if(_0x1566d2[_0xae75('0x34')][_0xae75('0x3f')]){_0x3cea74[_0xae75('0x3d')]=_[_0xae75('0x40')](_0x3cea74[_0xae75('0x3d')],{'$or':_['map'](_0x3cea74[_0xae75('0x38')],function(_0x5a217c){var _0x2d67c3={};_0x2d67c3[_0x5a217c]={'$like':'%'+_0x1566d2[_0xae75('0x34')][_0xae75('0x3f')]+'%'};return _0x2d67c3;})});}_0x3cea74=_['merge']({},_0x3cea74,_0x1566d2['options']);return _0x569508[_0xae75('0x52')](_0x3cea74);}})[_0xae75('0x29')](function(_0x8370e7){if(_0x8370e7){_0x3d5732=_0x8370e7[_0xae75('0x3a')];if(!_0x1566d2[_0xae75('0x34')][_0xae75('0x3b')](_0xae75('0x50'))){_0x3cea74[_0xae75('0x21')]=qs['limit'](_0x1566d2[_0xae75('0x34')][_0xae75('0x21')]);_0x3cea74[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x1566d2[_0xae75('0x34')][_0xae75('0x22')]);}return _0x569508[_0xae75('0x52')](_0x3cea74);}})['then'](function(_0x1cc295){if(_0x1cc295){return _0x1cc295?{'count':_0x3d5732,'rows':_0x1cc295}:null;}})[_0xae75('0x29')](respondWithResult(_0x554b09,null))[_0xae75('0x46')](handleError(_0x554b09,null));};exports['setTags']=function(_0x2ac2c0,_0x473989,_0x619677){if(_0x2ac2c0[_0xae75('0x4a')]['id']){delete _0x2ac2c0[_0xae75('0x4a')]['id'];}return db[_0xae75('0x30')][_0xae75('0x4f')]({'where':{'id':_0x2ac2c0[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x473989,null))[_0xae75('0x29')](function(_0x57f308){if(_0x57f308){return _0x57f308[_0xae75('0x53')](_0x2ac2c0[_0xae75('0x4a')][_0xae75('0x54')]||[]);}return null;})[_0xae75('0x29')](respondWithResult(_0x473989,null))[_0xae75('0x46')](handleError(_0x473989,null));}; \ No newline at end of file +var _0xb962=['sendStatus','status','json','limit','undefined','count','offset','Content-Range','reject','then','destroy','end','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','update','FreshdeskField','getFields','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x561946,_0xaf5906){var _0x1e1e88=function(_0x23237b){while(--_0x23237b){_0x561946['push'](_0x561946['shift']());}};_0x1e1e88(++_0xaf5906);}(_0xb962,0x17e));var _0x2b96=function(_0x222791,_0x1407f0){_0x222791=_0x222791-0x0;var _0x1df81b=_0xb962[_0x222791];return _0x1df81b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b96('0x0'));var zipdir=require(_0x2b96('0x1'));var jsonpatch=require(_0x2b96('0x2'));var rp=require(_0x2b96('0x3'));var moment=require(_0x2b96('0x4'));var BPromise=require(_0x2b96('0x5'));var Mustache=require('mustache');var util=require(_0x2b96('0x6'));var path=require(_0x2b96('0x7'));var sox=require(_0x2b96('0x8'));var csv=require(_0x2b96('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b96('0xa'));var squel=require(_0x2b96('0xb'));var crypto=require(_0x2b96('0xc'));var jsforce=require(_0x2b96('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b96('0xe'));var Papa=require('papaparse');var Redis=require(_0x2b96('0xf'));var authService=require(_0x2b96('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2b96('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b96('0x12'))(_0x2b96('0x13'));var utils=require('../../config/utils');var config=require(_0x2b96('0x14'));var licenseUtil=require(_0x2b96('0x15'));var db=require(_0x2b96('0x16'))['db'];function respondWithStatusCode(_0x5be028,_0x4f2e43){_0x4f2e43=_0x4f2e43||0xcc;return function(_0x279c56){if(_0x279c56){return _0x5be028[_0x2b96('0x17')](_0x4f2e43);}return _0x5be028[_0x2b96('0x18')](_0x4f2e43)['end']();};}function respondWithResult(_0x2111da,_0x2da427){_0x2da427=_0x2da427||0xc8;return function(_0x461f07){if(_0x461f07){return _0x2111da[_0x2b96('0x18')](_0x2da427)[_0x2b96('0x19')](_0x461f07);}};}function respondWithFilteredResult(_0x2c7413,_0x4dcc1b){return function(_0x3039a3){if(_0x3039a3){var _0x3d7a9b=typeof _0x4dcc1b['offset']==='undefined'&&typeof _0x4dcc1b[_0x2b96('0x1a')]===_0x2b96('0x1b');var _0x1d8a7f=_0x3039a3[_0x2b96('0x1c')];var _0x38ce69=_0x3d7a9b?0x0:_0x4dcc1b[_0x2b96('0x1d')];var _0x4bea50=_0x3d7a9b?_0x3039a3['count']:_0x4dcc1b[_0x2b96('0x1d')]+_0x4dcc1b['limit'];var _0x416ddd;if(_0x4bea50>=_0x1d8a7f){_0x4bea50=_0x1d8a7f;_0x416ddd=0xc8;}else{_0x416ddd=0xce;}_0x2c7413[_0x2b96('0x18')](_0x416ddd);return _0x2c7413['set'](_0x2b96('0x1e'),_0x38ce69+'-'+_0x4bea50+'/'+_0x1d8a7f)['json'](_0x3039a3);}return null;};}function patchUpdates(_0x552b8a){return function(_0x31b0c2){try{jsonpatch['apply'](_0x31b0c2,_0x552b8a,!![]);}catch(_0x4b166d){return BPromise[_0x2b96('0x1f')](_0x4b166d);}return _0x31b0c2['save']();};}function saveUpdates(_0x366613,_0xc2a38b){return function(_0x394bf6){if(_0x394bf6){return _0x394bf6['update'](_0x366613)[_0x2b96('0x20')](function(_0x4a6b55){return _0x4a6b55;});}return null;};}function removeEntity(_0xe03ff5,_0x154b14){return function(_0x5bf921){if(_0x5bf921){return _0x5bf921[_0x2b96('0x21')]()[_0x2b96('0x20')](function(){_0xe03ff5[_0x2b96('0x18')](0xcc)[_0x2b96('0x22')]();});}};}function handleEntityNotFound(_0x2358ec,_0x2375b8){return function(_0x2479f5){if(!_0x2479f5){_0x2358ec['sendStatus'](0x194);}return _0x2479f5;};}function handleError(_0xec97cc,_0xb3d51c){_0xb3d51c=_0xb3d51c||0x1f4;return function(_0x2bb503){logger[_0x2b96('0x23')](_0x2bb503[_0x2b96('0x24')]);if(_0x2bb503['name']){delete _0x2bb503[_0x2b96('0x25')];}_0xec97cc[_0x2b96('0x18')](_0xb3d51c)[_0x2b96('0x26')](_0x2bb503);};}exports['index']=function(_0x54d728,_0x4f036d){var _0x1d9af0={},_0x5290b1={},_0x215463={'count':0x0,'rows':[]};var _0x5dede6=_[_0x2b96('0x27')](db[_0x2b96('0x28')][_0x2b96('0x29')],function(_0x388d31){return{'name':_0x388d31[_0x2b96('0x2a')],'type':_0x388d31[_0x2b96('0x2b')]['key']};});_0x5290b1['model']=_[_0x2b96('0x27')](_0x5dede6,_0x2b96('0x25'));_0x5290b1[_0x2b96('0x2c')]=_[_0x2b96('0x2d')](_0x54d728[_0x2b96('0x2c')]);_0x5290b1['filters']=_['intersection'](_0x5290b1[_0x2b96('0x2e')],_0x5290b1['query']);_0x1d9af0[_0x2b96('0x2f')]=_[_0x2b96('0x30')](_0x5290b1[_0x2b96('0x2e')],qs['fields'](_0x54d728[_0x2b96('0x2c')][_0x2b96('0x31')]));_0x1d9af0[_0x2b96('0x2f')]=_0x1d9af0[_0x2b96('0x2f')][_0x2b96('0x32')]?_0x1d9af0['attributes']:_0x5290b1[_0x2b96('0x2e')];if(!_0x54d728[_0x2b96('0x2c')][_0x2b96('0x33')]('nolimit')){_0x1d9af0['limit']=qs[_0x2b96('0x1a')](_0x54d728[_0x2b96('0x2c')][_0x2b96('0x1a')]);_0x1d9af0[_0x2b96('0x1d')]=qs[_0x2b96('0x1d')](_0x54d728[_0x2b96('0x2c')][_0x2b96('0x1d')]);}_0x1d9af0[_0x2b96('0x34')]=qs['sort'](_0x54d728[_0x2b96('0x2c')][_0x2b96('0x35')]);_0x1d9af0['where']=qs['filters'](_[_0x2b96('0x36')](_0x54d728[_0x2b96('0x2c')],_0x5290b1['filters']),_0x5dede6);if(_0x54d728['query'][_0x2b96('0x37')]){_0x1d9af0[_0x2b96('0x38')]=_[_0x2b96('0x39')](_0x1d9af0[_0x2b96('0x38')],{'$or':_[_0x2b96('0x27')](_0x5dede6,function(_0x3f8403){if(_0x3f8403['type']!==_0x2b96('0x3a')){var _0x47775d={};_0x47775d[_0x3f8403[_0x2b96('0x25')]]={'$like':'%'+_0x54d728[_0x2b96('0x2c')][_0x2b96('0x37')]+'%'};return _0x47775d;}})});}_0x1d9af0=_[_0x2b96('0x39')]({},_0x1d9af0,_0x54d728[_0x2b96('0x3b')]);var _0xde7c2e={'where':_0x1d9af0[_0x2b96('0x38')]};return db['FreshdeskConfiguration'][_0x2b96('0x1c')](_0xde7c2e)[_0x2b96('0x20')](function(_0x54a168){_0x215463['count']=_0x54a168;if(_0x54d728[_0x2b96('0x2c')][_0x2b96('0x3c')]){_0x1d9af0[_0x2b96('0x3d')]=[{'all':!![]}];}return db[_0x2b96('0x28')][_0x2b96('0x3e')](_0x1d9af0);})[_0x2b96('0x20')](function(_0x3e310a){_0x215463[_0x2b96('0x3f')]=_0x3e310a;return _0x215463;})[_0x2b96('0x20')](respondWithFilteredResult(_0x4f036d,_0x1d9af0))[_0x2b96('0x40')](handleError(_0x4f036d,null));};exports[_0x2b96('0x41')]=function(_0x256099,_0xbdf436){var _0x497555={'raw':![],'where':{'id':_0x256099[_0x2b96('0x42')]['id']}},_0x7045e8={};_0x7045e8[_0x2b96('0x2e')]=_['keys'](db[_0x2b96('0x28')]['rawAttributes']);_0x7045e8[_0x2b96('0x2c')]=_['keys'](_0x256099[_0x2b96('0x2c')]);_0x7045e8[_0x2b96('0x43')]=_[_0x2b96('0x30')](_0x7045e8[_0x2b96('0x2e')],_0x7045e8[_0x2b96('0x2c')]);_0x497555[_0x2b96('0x2f')]=_[_0x2b96('0x30')](_0x7045e8[_0x2b96('0x2e')],qs[_0x2b96('0x31')](_0x256099[_0x2b96('0x2c')][_0x2b96('0x31')]));_0x497555[_0x2b96('0x2f')]=_0x497555['attributes']['length']?_0x497555[_0x2b96('0x2f')]:_0x7045e8[_0x2b96('0x2e')];if(_0x256099[_0x2b96('0x2c')][_0x2b96('0x3c')]){_0x497555[_0x2b96('0x3d')]=[{'all':!![]}];}_0x497555=_[_0x2b96('0x39')]({},_0x497555,_0x256099[_0x2b96('0x3b')]);return db['FreshdeskConfiguration'][_0x2b96('0x44')](_0x497555)['then'](handleEntityNotFound(_0xbdf436,null))['then'](respondWithResult(_0xbdf436,null))[_0x2b96('0x40')](handleError(_0xbdf436,null));};exports[_0x2b96('0x45')]=function(_0x5a7623,_0x336d84){return db[_0x2b96('0x28')][_0x2b96('0x45')](_0x5a7623[_0x2b96('0x46')],{})[_0x2b96('0x20')](respondWithResult(_0x336d84,0xc9))[_0x2b96('0x40')](handleError(_0x336d84,null));};exports[_0x2b96('0x47')]=function(_0x580f6f,_0x19c48c){if(_0x580f6f[_0x2b96('0x46')]['id']){delete _0x580f6f[_0x2b96('0x46')]['id'];}return db[_0x2b96('0x28')]['find']({'where':{'id':_0x580f6f[_0x2b96('0x42')]['id']}})[_0x2b96('0x20')](handleEntityNotFound(_0x19c48c,null))[_0x2b96('0x20')](saveUpdates(_0x580f6f[_0x2b96('0x46')],null))['then'](respondWithResult(_0x19c48c,null))[_0x2b96('0x40')](handleError(_0x19c48c,null));};exports[_0x2b96('0x21')]=function(_0x534cf9,_0x2de8ff){return db[_0x2b96('0x28')][_0x2b96('0x44')]({'where':{'id':_0x534cf9[_0x2b96('0x42')]['id']}})[_0x2b96('0x20')](handleEntityNotFound(_0x2de8ff,null))[_0x2b96('0x20')](removeEntity(_0x2de8ff,null))[_0x2b96('0x40')](handleError(_0x2de8ff,null));};exports['getFields']=function(_0x14ca9f,_0x4d2aaa,_0x20fe9d){var _0x2424cc={};var _0x232f0b={};var _0x5135d0;var _0x3e1512;return db[_0x2b96('0x28')]['findOne']({'where':{'id':_0x14ca9f['params']['id']}})[_0x2b96('0x20')](handleEntityNotFound(_0x4d2aaa,null))[_0x2b96('0x20')](function(_0x120f15){if(_0x120f15){_0x5135d0=_0x120f15;_0x232f0b[_0x2b96('0x2e')]=_[_0x2b96('0x2d')](db[_0x2b96('0x48')][_0x2b96('0x29')]);_0x232f0b[_0x2b96('0x2c')]=_[_0x2b96('0x2d')](_0x14ca9f[_0x2b96('0x2c')]);_0x232f0b[_0x2b96('0x43')]=_[_0x2b96('0x30')](_0x232f0b[_0x2b96('0x2e')],_0x232f0b[_0x2b96('0x2c')]);_0x2424cc[_0x2b96('0x2f')]=_['intersection'](_0x232f0b[_0x2b96('0x2e')],qs['fields'](_0x14ca9f['query'][_0x2b96('0x31')]));_0x2424cc['attributes']=_0x2424cc[_0x2b96('0x2f')]['length']?_0x2424cc[_0x2b96('0x2f')]:_0x232f0b[_0x2b96('0x2e')];_0x2424cc['order']=qs[_0x2b96('0x35')](_0x14ca9f[_0x2b96('0x2c')][_0x2b96('0x35')]);_0x2424cc[_0x2b96('0x38')]=qs['filters'](_[_0x2b96('0x36')](_0x14ca9f[_0x2b96('0x2c')],_0x232f0b[_0x2b96('0x43')]));if(_0x14ca9f[_0x2b96('0x2c')][_0x2b96('0x37')]){_0x2424cc['where']=_['merge'](_0x2424cc[_0x2b96('0x38')],{'$or':_[_0x2b96('0x27')](_0x2424cc[_0x2b96('0x2f')],function(_0x219005){var _0x1b8b56={};_0x1b8b56[_0x219005]={'$like':'%'+_0x14ca9f[_0x2b96('0x2c')]['filter']+'%'};return _0x1b8b56;})});}_0x2424cc=_['merge']({},_0x2424cc,_0x14ca9f[_0x2b96('0x3b')]);return _0x5135d0[_0x2b96('0x49')](_0x2424cc);}})['then'](function(_0x50c071){if(_0x50c071){_0x3e1512=_0x50c071[_0x2b96('0x32')];if(!_0x14ca9f[_0x2b96('0x2c')][_0x2b96('0x33')](_0x2b96('0x4a'))){_0x2424cc[_0x2b96('0x1a')]=qs[_0x2b96('0x1a')](_0x14ca9f[_0x2b96('0x2c')][_0x2b96('0x1a')]);_0x2424cc['offset']=qs[_0x2b96('0x1d')](_0x14ca9f['query'][_0x2b96('0x1d')]);}return _0x5135d0[_0x2b96('0x49')](_0x2424cc);}})['then'](function(_0x571cf4){if(_0x571cf4){return _0x571cf4?{'count':_0x3e1512,'rows':_0x571cf4}:null;}})[_0x2b96('0x20')](respondWithResult(_0x4d2aaa,null))[_0x2b96('0x40')](handleError(_0x4d2aaa,null));};exports[_0x2b96('0x4b')]=function(_0x5e1367,_0xf125a1,_0x74d516){var _0x351453={};var _0x371d83={};var _0x3ed582;var _0x6dca5e;return db['FreshdeskConfiguration'][_0x2b96('0x4c')]({'where':{'id':_0x5e1367['params']['id']}})[_0x2b96('0x20')](handleEntityNotFound(_0xf125a1,null))[_0x2b96('0x20')](function(_0x1c475a){if(_0x1c475a){_0x3ed582=_0x1c475a;_0x371d83['model']=_[_0x2b96('0x2d')](db[_0x2b96('0x48')]['rawAttributes']);_0x371d83['query']=_[_0x2b96('0x2d')](_0x5e1367[_0x2b96('0x2c')]);_0x371d83[_0x2b96('0x43')]=_['intersection'](_0x371d83['model'],_0x371d83[_0x2b96('0x2c')]);_0x351453[_0x2b96('0x2f')]=_[_0x2b96('0x30')](_0x371d83[_0x2b96('0x2e')],qs[_0x2b96('0x31')](_0x5e1367[_0x2b96('0x2c')][_0x2b96('0x31')]));_0x351453['attributes']=_0x351453[_0x2b96('0x2f')][_0x2b96('0x32')]?_0x351453[_0x2b96('0x2f')]:_0x371d83[_0x2b96('0x2e')];_0x351453[_0x2b96('0x34')]=qs[_0x2b96('0x35')](_0x5e1367[_0x2b96('0x2c')][_0x2b96('0x35')]);_0x351453[_0x2b96('0x38')]=qs['filters'](_[_0x2b96('0x36')](_0x5e1367[_0x2b96('0x2c')],_0x371d83[_0x2b96('0x43')]));if(_0x5e1367['query'][_0x2b96('0x37')]){_0x351453['where']=_[_0x2b96('0x39')](_0x351453[_0x2b96('0x38')],{'$or':_[_0x2b96('0x27')](_0x351453['attributes'],function(_0x1ca21b){var _0x421586={};_0x421586[_0x1ca21b]={'$like':'%'+_0x5e1367[_0x2b96('0x2c')][_0x2b96('0x37')]+'%'};return _0x421586;})});}_0x351453=_[_0x2b96('0x39')]({},_0x351453,_0x5e1367[_0x2b96('0x3b')]);return _0x3ed582[_0x2b96('0x4b')](_0x351453);}})[_0x2b96('0x20')](function(_0x2e2680){if(_0x2e2680){_0x6dca5e=_0x2e2680['length'];if(!_0x5e1367[_0x2b96('0x2c')][_0x2b96('0x33')](_0x2b96('0x4a'))){_0x351453[_0x2b96('0x1a')]=qs['limit'](_0x5e1367[_0x2b96('0x2c')][_0x2b96('0x1a')]);_0x351453[_0x2b96('0x1d')]=qs[_0x2b96('0x1d')](_0x5e1367[_0x2b96('0x2c')]['offset']);}return _0x3ed582[_0x2b96('0x4b')](_0x351453);}})[_0x2b96('0x20')](function(_0x1f1a65){if(_0x1f1a65){return _0x1f1a65?{'count':_0x6dca5e,'rows':_0x1f1a65}:null;}})[_0x2b96('0x20')](respondWithResult(_0xf125a1,null))[_0x2b96('0x40')](handleError(_0xf125a1,null));};exports['getDescriptions']=function(_0x4df36f,_0x6af62,_0x1240af){var _0x14994d={};var _0x77a98c={};var _0x36573e;var _0x5a4c1e;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4df36f['params']['id']}})[_0x2b96('0x20')](handleEntityNotFound(_0x6af62,null))[_0x2b96('0x20')](function(_0x2f0be3){if(_0x2f0be3){_0x36573e=_0x2f0be3;_0x77a98c[_0x2b96('0x2e')]=_['keys'](db[_0x2b96('0x48')][_0x2b96('0x29')]);_0x77a98c['query']=_['keys'](_0x4df36f[_0x2b96('0x2c')]);_0x77a98c[_0x2b96('0x43')]=_['intersection'](_0x77a98c['model'],_0x77a98c[_0x2b96('0x2c')]);_0x14994d[_0x2b96('0x2f')]=_[_0x2b96('0x30')](_0x77a98c['model'],qs[_0x2b96('0x31')](_0x4df36f[_0x2b96('0x2c')][_0x2b96('0x31')]));_0x14994d[_0x2b96('0x2f')]=_0x14994d[_0x2b96('0x2f')]['length']?_0x14994d[_0x2b96('0x2f')]:_0x77a98c['model'];_0x14994d[_0x2b96('0x34')]=qs[_0x2b96('0x35')](_0x4df36f[_0x2b96('0x2c')][_0x2b96('0x35')]);_0x14994d[_0x2b96('0x38')]=qs['filters'](_[_0x2b96('0x36')](_0x4df36f['query'],_0x77a98c[_0x2b96('0x43')]));if(_0x4df36f[_0x2b96('0x2c')][_0x2b96('0x37')]){_0x14994d[_0x2b96('0x38')]=_[_0x2b96('0x39')](_0x14994d[_0x2b96('0x38')],{'$or':_['map'](_0x14994d[_0x2b96('0x2f')],function(_0x316b39){var _0x3600d2={};_0x3600d2[_0x316b39]={'$like':'%'+_0x4df36f[_0x2b96('0x2c')][_0x2b96('0x37')]+'%'};return _0x3600d2;})});}_0x14994d=_[_0x2b96('0x39')]({},_0x14994d,_0x4df36f['options']);return _0x36573e['getDescriptions'](_0x14994d);}})[_0x2b96('0x20')](function(_0x49cb47){if(_0x49cb47){_0x5a4c1e=_0x49cb47[_0x2b96('0x32')];if(!_0x4df36f[_0x2b96('0x2c')][_0x2b96('0x33')](_0x2b96('0x4a'))){_0x14994d[_0x2b96('0x1a')]=qs[_0x2b96('0x1a')](_0x4df36f[_0x2b96('0x2c')]['limit']);_0x14994d[_0x2b96('0x1d')]=qs[_0x2b96('0x1d')](_0x4df36f[_0x2b96('0x2c')][_0x2b96('0x1d')]);}return _0x36573e[_0x2b96('0x4d')](_0x14994d);}})['then'](function(_0x42bc44){if(_0x42bc44){return _0x42bc44?{'count':_0x5a4c1e,'rows':_0x42bc44}:null;}})[_0x2b96('0x20')](respondWithResult(_0x6af62,null))[_0x2b96('0x40')](handleError(_0x6af62,null));};exports[_0x2b96('0x4e')]=function(_0x158fc2,_0x4545ac,_0x1d76c8){var _0x38fffd={};var _0x3a0ca8={};var _0x51cf1e;var _0x1241d3;return db[_0x2b96('0x28')][_0x2b96('0x4c')]({'where':{'id':_0x158fc2[_0x2b96('0x42')]['id']}})[_0x2b96('0x20')](handleEntityNotFound(_0x4545ac,null))['then'](function(_0x40417f){if(_0x40417f){_0x51cf1e=_0x40417f;_0x3a0ca8[_0x2b96('0x2e')]=_[_0x2b96('0x2d')](db['Tag'][_0x2b96('0x29')]);_0x3a0ca8[_0x2b96('0x2c')]=_['keys'](_0x158fc2[_0x2b96('0x2c')]);_0x3a0ca8[_0x2b96('0x43')]=_[_0x2b96('0x30')](_0x3a0ca8[_0x2b96('0x2e')],_0x3a0ca8[_0x2b96('0x2c')]);_0x38fffd[_0x2b96('0x2f')]=_[_0x2b96('0x30')](_0x3a0ca8['model'],qs[_0x2b96('0x31')](_0x158fc2[_0x2b96('0x2c')][_0x2b96('0x31')]));_0x38fffd['attributes']=_0x38fffd[_0x2b96('0x2f')][_0x2b96('0x32')]?_0x38fffd[_0x2b96('0x2f')]:_0x3a0ca8[_0x2b96('0x2e')];_0x38fffd[_0x2b96('0x34')]=qs[_0x2b96('0x35')](_0x158fc2['query'][_0x2b96('0x35')]);_0x38fffd['where']=qs[_0x2b96('0x43')](_[_0x2b96('0x36')](_0x158fc2[_0x2b96('0x2c')],_0x3a0ca8[_0x2b96('0x43')]));if(_0x158fc2[_0x2b96('0x2c')][_0x2b96('0x37')]){_0x38fffd[_0x2b96('0x38')]=_['merge'](_0x38fffd[_0x2b96('0x38')],{'$or':_['map'](_0x38fffd['attributes'],function(_0x2cc000){var _0x76da3b={};_0x76da3b[_0x2cc000]={'$like':'%'+_0x158fc2[_0x2b96('0x2c')]['filter']+'%'};return _0x76da3b;})});}_0x38fffd=_[_0x2b96('0x39')]({},_0x38fffd,_0x158fc2[_0x2b96('0x3b')]);return _0x51cf1e[_0x2b96('0x4e')](_0x38fffd);}})['then'](function(_0x1156e7){if(_0x1156e7){_0x1241d3=_0x1156e7[_0x2b96('0x32')];if(!_0x158fc2[_0x2b96('0x2c')]['hasOwnProperty'](_0x2b96('0x4a'))){_0x38fffd[_0x2b96('0x1a')]=qs[_0x2b96('0x1a')](_0x158fc2[_0x2b96('0x2c')][_0x2b96('0x1a')]);_0x38fffd['offset']=qs[_0x2b96('0x1d')](_0x158fc2[_0x2b96('0x2c')][_0x2b96('0x1d')]);}return _0x51cf1e[_0x2b96('0x4e')](_0x38fffd);}})[_0x2b96('0x20')](function(_0x1af871){if(_0x1af871){return _0x1af871?{'count':_0x1241d3,'rows':_0x1af871}:null;}})['then'](respondWithResult(_0x4545ac,null))[_0x2b96('0x40')](handleError(_0x4545ac,null));};exports['setTags']=function(_0x594446,_0x39c522,_0x5d3e8c){if(_0x594446[_0x2b96('0x46')]['id']){delete _0x594446[_0x2b96('0x46')]['id'];}return db[_0x2b96('0x28')][_0x2b96('0x4c')]({'where':{'id':_0x594446[_0x2b96('0x42')]['id']}})[_0x2b96('0x20')](handleEntityNotFound(_0x39c522,null))['then'](function(_0x2387f1){if(_0x2387f1){return _0x2387f1[_0x2b96('0x4f')](_0x594446['body'][_0x2b96('0x50')]||[]);}return null;})[_0x2b96('0x20')](respondWithResult(_0x39c522,null))['catch'](handleError(_0x39c522,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 44ab98a..24b9f6d 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 _0x39c7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskConfiguration','lodash','../../config/logger','api'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x39c7,0xc3));var _0x739c=function(_0xc1fc39,_0x474166){_0xc1fc39=_0xc1fc39-0x0;var _0x29786e=_0x39c7[_0xc1fc39];return _0x29786e;};'use strict';var _=require(_0x739c('0x0'));var util=require('util');var logger=require(_0x739c('0x1'))(_0x739c('0x2'));var moment=require(_0x739c('0x3'));var BPromise=require(_0x739c('0x4'));var rp=require(_0x739c('0x5'));var fs=require('fs');var path=require(_0x739c('0x6'));var rimraf=require(_0x739c('0x7'));var config=require(_0x739c('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x2bf7d4,_0x2aef4d){return _0x2bf7d4[_0x739c('0x9')](_0x739c('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x656e=['int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0x656e,0x83));var _0xe656=function(_0x42cb8c,_0x34cceb){_0x42cb8c=_0x42cb8c-0x0;var _0x3c9bac=_0x656e[_0x42cb8c];return _0x3c9bac;};'use strict';var _=require(_0xe656('0x0'));var util=require('util');var logger=require(_0xe656('0x1'))(_0xe656('0x2'));var moment=require(_0xe656('0x3'));var BPromise=require(_0xe656('0x4'));var rp=require(_0xe656('0x5'));var fs=require('fs');var path=require(_0xe656('0x6'));var rimraf=require('rimraf');var config=require(_0xe656('0x7'));var attributes=require(_0xe656('0x8'));module[_0xe656('0x9')]=function(_0x1ab790,_0x50aafd){return _0x1ab790[_0xe656('0xa')](_0xe656('0xb'),attributes,{'tableName':_0xe656('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 5dba885..9856ba4 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 _0x3796=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3796,0x175));var _0x6379=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3796[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6379('0x0'));var util=require('util');var moment=require(_0x6379('0x1'));var BPromise=require('bluebird');var rs=require(_0x6379('0x2'));var fs=require('fs');var Redis=require(_0x6379('0x3'));var db=require(_0x6379('0x4'))['db'];var utils=require(_0x6379('0x5'));var logger=require(_0x6379('0x6'))(_0x6379('0x7'));var config=require(_0x6379('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6379('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x560455,_0x3275cb,_0x2eabf4){return new BPromise(function(_0x3adf8a,_0x32b19a){return client[_0x6379('0xa')](_0x560455,_0x2eabf4)['then'](function(_0x1a048f){logger['info'](_0x6379('0xb'),_0x3275cb,_0x6379('0xc'));logger[_0x6379('0xd')](_0x6379('0xe'),_0x3275cb,'request\x20sent',JSON[_0x6379('0xf')](_0x1a048f));if(_0x1a048f[_0x6379('0x10')]){if(_0x1a048f['error'][_0x6379('0x11')]===0x1f4){logger[_0x6379('0x10')](_0x6379('0xb'),_0x3275cb,_0x1a048f['error'][_0x6379('0x12')]);return _0x32b19a(_0x1a048f[_0x6379('0x10')]['message']);}logger['error'](_0x6379('0xb'),_0x3275cb,_0x1a048f[_0x6379('0x10')]['message']);return _0x3adf8a(_0x1a048f['error'][_0x6379('0x12')]);}else{logger[_0x6379('0x13')](_0x6379('0xb'),_0x3275cb,_0x6379('0xc'));_0x3adf8a(_0x1a048f[_0x6379('0x14')][_0x6379('0x12')]);}})[_0x6379('0x15')](function(_0x3dc9be){logger[_0x6379('0x10')](_0x6379('0xb'),_0x3275cb,_0x3dc9be);_0x32b19a(_0x3dc9be);});});} \ No newline at end of file +var _0x804d=['info','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x36fbb7,_0x4e9cc4){var _0x7db07c=function(_0x4727fa){while(--_0x4727fa){_0x36fbb7['push'](_0x36fbb7['shift']());}};_0x7db07c(++_0x4e9cc4);}(_0x804d,0x9c));var _0xd804=function(_0x348fec,_0x486f87){_0x348fec=_0x348fec-0x0;var _0x5914c7=_0x804d[_0x348fec];return _0x5914c7;};'use strict';var _=require('lodash');var util=require(_0xd804('0x0'));var moment=require(_0xd804('0x1'));var BPromise=require(_0xd804('0x2'));var rs=require(_0xd804('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd804('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd804('0x5'))(_0xd804('0x6'));var config=require(_0xd804('0x7'));var jayson=require(_0xd804('0x8'));var client=jayson[_0xd804('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x586c25,_0x151f5b,_0xe01ec){return new BPromise(function(_0x301839,_0xe4fe2f){return client[_0xd804('0xa')](_0x586c25,_0xe01ec)[_0xd804('0xb')](function(_0x407d90){logger[_0xd804('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x151f5b,_0xd804('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x151f5b,_0xd804('0xd'),JSON[_0xd804('0xe')](_0x407d90));if(_0x407d90[_0xd804('0xf')]){if(_0x407d90[_0xd804('0xf')][_0xd804('0x10')]===0x1f4){logger['error'](_0xd804('0x11'),_0x151f5b,_0x407d90[_0xd804('0xf')][_0xd804('0x12')]);return _0xe4fe2f(_0x407d90['error'][_0xd804('0x12')]);}logger[_0xd804('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x151f5b,_0x407d90[_0xd804('0xf')][_0xd804('0x12')]);return _0x301839(_0x407d90[_0xd804('0xf')][_0xd804('0x12')]);}else{logger[_0xd804('0xc')](_0xd804('0x11'),_0x151f5b,'request\x20sent');_0x301839(_0x407d90[_0xd804('0x13')][_0xd804('0x12')]);}})[_0xd804('0x14')](function(_0x181ea9){logger['error'](_0xd804('0x11'),_0x151f5b,_0x181ea9);_0xe4fe2f(_0x181ea9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 79181d6..3c61566 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 _0xa0d9=['isAuthenticated','show','create','put','update','delete','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa0d9,0x67));var _0x9a0d=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0xa0d9[_0x1635fe];return _0x3c512a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a0d('0x0'));var timeout=require(_0x9a0d('0x1'));var express=require('express');var router=express[_0x9a0d('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a0d('0x3'));var config=require(_0x9a0d('0x4'));var controller=require(_0x9a0d('0x5'));router[_0x9a0d('0x6')]('/',auth['isAuthenticated'](),controller[_0x9a0d('0x7')]);router[_0x9a0d('0x6')](_0x9a0d('0x8'),auth[_0x9a0d('0x9')](),controller[_0x9a0d('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9a0d('0xb')]);router[_0x9a0d('0xc')]('/:id',auth[_0x9a0d('0x9')](),controller[_0x9a0d('0xd')]);router[_0x9a0d('0xe')]('/:id',auth[_0x9a0d('0x9')](),controller['destroy']);module[_0x9a0d('0xf')]=router; \ No newline at end of file +var _0x5c60=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','path','express','Router'];(function(_0xa65d7c,_0x4809cc){var _0x4f6175=function(_0x2732a9){while(--_0x2732a9){_0xa65d7c['push'](_0xa65d7c['shift']());}};_0x4f6175(++_0x4809cc);}(_0x5c60,0xf3));var _0x05c6=function(_0x380c67,_0x33d8ef){_0x380c67=_0x380c67-0x0;var _0x2a2eb5=_0x5c60[_0x380c67];return _0x2a2eb5;};'use strict';var multer=require(_0x05c6('0x0'));var util=require('util');var path=require(_0x05c6('0x1'));var timeout=require('connect-timeout');var express=require(_0x05c6('0x2'));var router=express[_0x05c6('0x3')]();var fs_extra=require(_0x05c6('0x4'));var auth=require(_0x05c6('0x5'));var interaction=require(_0x05c6('0x6'));var config=require(_0x05c6('0x7'));var controller=require(_0x05c6('0x8'));router[_0x05c6('0x9')]('/',auth[_0x05c6('0xa')](),controller['index']);router[_0x05c6('0x9')]('/:id',auth[_0x05c6('0xa')](),controller[_0x05c6('0xb')]);router[_0x05c6('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c6('0xd')]);router[_0x05c6('0xe')](_0x05c6('0xf'),auth[_0x05c6('0xa')](),controller['update']);router[_0x05c6('0x10')](_0x05c6('0xf'),auth[_0x05c6('0xa')](),controller[_0x05c6('0x11')]);module[_0x05c6('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 895f414..7e896bb 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 _0x9a84=['keyValue','picklist','STRING','customVariable','BOOLEAN','ENUM','string','variable'];(function(_0x1b53e8,_0x34d870){var _0x2f8e79=function(_0x27119f){while(--_0x27119f){_0x1b53e8['push'](_0x1b53e8['shift']());}};_0x2f8e79(++_0x34d870);}(_0x9a84,0x1c5));var _0x49a8=function(_0x14f458,_0x5dd219){_0x14f458=_0x14f458-0x0;var _0x4ff2da=_0x9a84[_0x14f458];return _0x4ff2da;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49a8('0x0')](_0x49a8('0x1'),_0x49a8('0x2'),'customVariable',_0x49a8('0x3'),_0x49a8('0x4')),'defaultValue':_0x49a8('0x1')},'content':{'type':Sequelize[_0x49a8('0x5')]},'key':{'type':Sequelize[_0x49a8('0x5')]},'keyType':{'type':Sequelize[_0x49a8('0x0')](_0x49a8('0x1'),'variable',_0x49a8('0x6'))},'keyContent':{'type':Sequelize[_0x49a8('0x5')]},'idField':{'type':Sequelize[_0x49a8('0x5')]},'nameField':{'type':Sequelize[_0x49a8('0x5')]},'customField':{'type':Sequelize[_0x49a8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf8db=['customVariable','picklist','STRING','string','BOOLEAN','exports','ENUM','variable'];(function(_0x32becd,_0x1ba07b){var _0x3d119d=function(_0x443cec){while(--_0x443cec){_0x32becd['push'](_0x32becd['shift']());}};_0x3d119d(++_0x1ba07b);}(_0xf8db,0x105));var _0xbf8d=function(_0x49e68f,_0x21fa6b){_0x49e68f=_0x49e68f-0x0;var _0x351589=_0xf8db[_0x49e68f];return _0x351589;};'use strict';var Sequelize=require('sequelize');module[_0xbf8d('0x0')]={'type':{'type':Sequelize[_0xbf8d('0x1')]('string',_0xbf8d('0x2'),_0xbf8d('0x3'),'keyValue',_0xbf8d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbf8d('0x5')]},'key':{'type':Sequelize[_0xbf8d('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xbf8d('0x6'),_0xbf8d('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbf8d('0x5')]},'customField':{'type':Sequelize[_0xbf8d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf8d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 096da68..99dc091 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 _0xfc03=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x48ba38,_0x485dac){var _0x23bf1f=function(_0x33765f){while(--_0x33765f){_0x48ba38['push'](_0x48ba38['shift']());}};_0x23bf1f(++_0x485dac);}(_0xfc03,0x16f));var _0x3fc0=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xfc03[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1abe10,_0x784765){return function(_0xba1a23){if(!_0xba1a23){_0x1abe10[_0x3fc0('0x18')](0x194);}return _0xba1a23;};}function handleError(_0xbec5b5,_0x4f5111){_0x4f5111=_0x4f5111||0x1f4;return function(_0x365c8e){logger[_0x3fc0('0x28')](_0x365c8e[_0x3fc0('0x29')]);if(_0x365c8e[_0x3fc0('0x2a')]){delete _0x365c8e['name'];}_0xbec5b5[_0x3fc0('0x1a')](_0x4f5111)[_0x3fc0('0x2b')](_0x365c8e);};}exports[_0x3fc0('0x2c')]=function(_0x2645b4,_0x559fcc){var _0x1e4d99={},_0x1a2261={},_0x1960a4={'count':0x0,'rows':[]};var _0xac736c=_[_0x3fc0('0x2d')](db[_0x3fc0('0x2e')]['rawAttributes'],function(_0xd9ecae){return{'name':_0xd9ecae[_0x3fc0('0x2f')],'type':_0xd9ecae[_0x3fc0('0x30')][_0x3fc0('0x31')]};});_0x1a2261[_0x3fc0('0x32')]=_[_0x3fc0('0x2d')](_0xac736c,_0x3fc0('0x2a'));_0x1a2261[_0x3fc0('0x33')]=_['keys'](_0x2645b4['query']);_0x1a2261[_0x3fc0('0x34')]=_['intersection'](_0x1a2261[_0x3fc0('0x32')],_0x1a2261[_0x3fc0('0x33')]);_0x1e4d99[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x1a2261[_0x3fc0('0x32')],qs['fields'](_0x2645b4['query'][_0x3fc0('0x37')]));_0x1e4d99[_0x3fc0('0x35')]=_0x1e4d99[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x1e4d99[_0x3fc0('0x35')]:_0x1a2261['model'];if(!_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x39')](_0x3fc0('0x3a'))){_0x1e4d99['limit']=qs[_0x3fc0('0x1f')](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1f')]);_0x1e4d99[_0x3fc0('0x1c')]=qs['offset'](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1c')]);}_0x1e4d99['order']=qs[_0x3fc0('0x3b')](_0x2645b4['query'][_0x3fc0('0x3b')]);_0x1e4d99[_0x3fc0('0x3c')]=qs[_0x3fc0('0x34')](_[_0x3fc0('0x3d')](_0x2645b4[_0x3fc0('0x33')],_0x1a2261[_0x3fc0('0x34')]),_0xac736c);if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x3e')]){_0x1e4d99[_0x3fc0('0x3c')]=_[_0x3fc0('0x3f')](_0x1e4d99[_0x3fc0('0x3c')],{'$or':_['map'](_0xac736c,function(_0x6bbe04){if(_0x6bbe04[_0x3fc0('0x30')]!==_0x3fc0('0x40')){var _0x28b4d5={};_0x28b4d5[_0x6bbe04[_0x3fc0('0x2a')]]={'$like':'%'+_0x2645b4[_0x3fc0('0x33')]['filter']+'%'};return _0x28b4d5;}})});}_0x1e4d99=_['merge']({},_0x1e4d99,_0x2645b4[_0x3fc0('0x41')]);var _0x3386d2={'where':_0x1e4d99[_0x3fc0('0x3c')]};return db[_0x3fc0('0x2e')][_0x3fc0('0x1e')](_0x3386d2)['then'](function(_0x53b45e){_0x1960a4['count']=_0x53b45e;if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x42')]){_0x1e4d99[_0x3fc0('0x43')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1e4d99);})[_0x3fc0('0x26')](function(_0x239dc5){_0x1960a4[_0x3fc0('0x44')]=_0x239dc5;return _0x1960a4;})[_0x3fc0('0x26')](respondWithFilteredResult(_0x559fcc,_0x1e4d99))['catch'](handleError(_0x559fcc,null));};exports['show']=function(_0x17510a,_0x2a45dc){var _0x547670={'raw':!![],'where':{'id':_0x17510a['params']['id']}},_0x32768f={};_0x32768f[_0x3fc0('0x32')]=_[_0x3fc0('0x45')](db[_0x3fc0('0x2e')][_0x3fc0('0x46')]);_0x32768f[_0x3fc0('0x33')]=_[_0x3fc0('0x45')](_0x17510a[_0x3fc0('0x33')]);_0x32768f[_0x3fc0('0x34')]=_['intersection'](_0x32768f[_0x3fc0('0x32')],_0x32768f['query']);_0x547670[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x32768f[_0x3fc0('0x32')],qs[_0x3fc0('0x37')](_0x17510a[_0x3fc0('0x33')]['fields']));_0x547670[_0x3fc0('0x35')]=_0x547670[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x547670[_0x3fc0('0x35')]:_0x32768f['model'];if(_0x17510a[_0x3fc0('0x33')]['includeAll']){_0x547670[_0x3fc0('0x43')]=[{'all':!![]}];}_0x547670=_[_0x3fc0('0x3f')]({},_0x547670,_0x17510a[_0x3fc0('0x41')]);return db[_0x3fc0('0x2e')][_0x3fc0('0x47')](_0x547670)['then'](handleEntityNotFound(_0x2a45dc,null))[_0x3fc0('0x26')](respondWithResult(_0x2a45dc,null))[_0x3fc0('0x48')](handleError(_0x2a45dc,null));};exports[_0x3fc0('0x49')]=function(_0x4c4aed,_0x3df404){return db[_0x3fc0('0x2e')]['create'](_0x4c4aed[_0x3fc0('0x4a')],{})[_0x3fc0('0x26')](respondWithResult(_0x3df404,0xc9))[_0x3fc0('0x48')](handleError(_0x3df404,null));};exports['update']=function(_0x5e5c73,_0x3a35ac){if(_0x5e5c73[_0x3fc0('0x4a')]['id']){delete _0x5e5c73[_0x3fc0('0x4a')]['id'];}return db['FreshdeskField'][_0x3fc0('0x47')]({'where':{'id':_0x5e5c73['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3a35ac,null))['then'](saveUpdates(_0x5e5c73['body'],null))['then'](respondWithResult(_0x3a35ac,null))[_0x3fc0('0x48')](handleError(_0x3a35ac,null));};exports[_0x3fc0('0x27')]=function(_0x141b4c,_0x3730f5){return db[_0x3fc0('0x2e')][_0x3fc0('0x47')]({'where':{'id':_0x141b4c['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3730f5,null))[_0x3fc0('0x26')](removeEntity(_0x3730f5,null))['catch'](handleError(_0x3730f5,null));}; \ No newline at end of file +var _0x3495=['status','end','json','undefined','count','offset','limit','Content-Range','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','sort','where','pick','filter','merge','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0x3495,0x1de));var _0x5349=function(_0x20a285,_0x21f62e){_0x20a285=_0x20a285-0x0;var _0x1aac79=_0x3495[_0x20a285];return _0x1aac79;};'use strict';var emlformat=require(_0x5349('0x0'));var rimraf=require(_0x5349('0x1'));var zipdir=require(_0x5349('0x2'));var jsonpatch=require(_0x5349('0x3'));var rp=require(_0x5349('0x4'));var moment=require(_0x5349('0x5'));var BPromise=require(_0x5349('0x6'));var Mustache=require(_0x5349('0x7'));var util=require(_0x5349('0x8'));var path=require('path');var sox=require(_0x5349('0x9'));var csv=require(_0x5349('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5349('0xb'));var _=require('lodash');var squel=require(_0x5349('0xc'));var crypto=require('crypto');var jsforce=require(_0x5349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5349('0xa'));var querystring=require(_0x5349('0xe'));var Papa=require(_0x5349('0xf'));var Redis=require(_0x5349('0x10'));var authService=require(_0x5349('0x11'));var qs=require(_0x5349('0x12'));var as=require(_0x5349('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5349('0x14'))('api');var utils=require(_0x5349('0x15'));var config=require(_0x5349('0x16'));var licenseUtil=require(_0x5349('0x17'));var db=require(_0x5349('0x18'))['db'];function respondWithStatusCode(_0x2f5172,_0x3c592a){_0x3c592a=_0x3c592a||0xcc;return function(_0x642966){if(_0x642966){return _0x2f5172[_0x5349('0x19')](_0x3c592a);}return _0x2f5172[_0x5349('0x1a')](_0x3c592a)[_0x5349('0x1b')]();};}function respondWithResult(_0x534e31,_0x2fde66){_0x2fde66=_0x2fde66||0xc8;return function(_0x367c25){if(_0x367c25){return _0x534e31['status'](_0x2fde66)[_0x5349('0x1c')](_0x367c25);}};}function respondWithFilteredResult(_0x269f7f,_0x2fe611){return function(_0x49bbec){if(_0x49bbec){var _0x5bcb3a=typeof _0x2fe611['offset']===_0x5349('0x1d')&&typeof _0x2fe611['limit']===_0x5349('0x1d');var _0x5f3cfb=_0x49bbec[_0x5349('0x1e')];var _0x2c1f1=_0x5bcb3a?0x0:_0x2fe611[_0x5349('0x1f')];var _0x132639=_0x5bcb3a?_0x49bbec['count']:_0x2fe611[_0x5349('0x1f')]+_0x2fe611[_0x5349('0x20')];var _0x8abbe3;if(_0x132639>=_0x5f3cfb){_0x132639=_0x5f3cfb;_0x8abbe3=0xc8;}else{_0x8abbe3=0xce;}_0x269f7f[_0x5349('0x1a')](_0x8abbe3);return _0x269f7f['set'](_0x5349('0x21'),_0x2c1f1+'-'+_0x132639+'/'+_0x5f3cfb)[_0x5349('0x1c')](_0x49bbec);}return null;};}function patchUpdates(_0x4f2cb6){return function(_0x4c96dc){try{jsonpatch['apply'](_0x4c96dc,_0x4f2cb6,!![]);}catch(_0x423581){return BPromise['reject'](_0x423581);}return _0x4c96dc[_0x5349('0x22')]();};}function saveUpdates(_0x1ff911,_0x164978){return function(_0x6c80cd){if(_0x6c80cd){return _0x6c80cd[_0x5349('0x23')](_0x1ff911)[_0x5349('0x24')](function(_0x303250){return _0x303250;});}return null;};}function removeEntity(_0x43a0c2,_0x2a3258){return function(_0x34353f){if(_0x34353f){return _0x34353f[_0x5349('0x25')]()[_0x5349('0x24')](function(){_0x43a0c2['status'](0xcc)[_0x5349('0x1b')]();});}};}function handleEntityNotFound(_0x187b39,_0x41d67e){return function(_0x49435a){if(!_0x49435a){_0x187b39[_0x5349('0x19')](0x194);}return _0x49435a;};}function handleError(_0x5068fa,_0x1afba7){_0x1afba7=_0x1afba7||0x1f4;return function(_0x203896){logger[_0x5349('0x26')](_0x203896['stack']);if(_0x203896[_0x5349('0x27')]){delete _0x203896[_0x5349('0x27')];}_0x5068fa[_0x5349('0x1a')](_0x1afba7)[_0x5349('0x28')](_0x203896);};}exports[_0x5349('0x29')]=function(_0x16edcb,_0x3b6faa){var _0x463a42={},_0x39b3a9={},_0x5b5d6c={'count':0x0,'rows':[]};var _0x3b3e79=_[_0x5349('0x2a')](db['FreshdeskField'][_0x5349('0x2b')],function(_0x573ee1){return{'name':_0x573ee1[_0x5349('0x2c')],'type':_0x573ee1[_0x5349('0x2d')][_0x5349('0x2e')]};});_0x39b3a9[_0x5349('0x2f')]=_[_0x5349('0x2a')](_0x3b3e79,_0x5349('0x27'));_0x39b3a9['query']=_[_0x5349('0x30')](_0x16edcb[_0x5349('0x31')]);_0x39b3a9[_0x5349('0x32')]=_[_0x5349('0x33')](_0x39b3a9['model'],_0x39b3a9['query']);_0x463a42[_0x5349('0x34')]=_[_0x5349('0x33')](_0x39b3a9[_0x5349('0x2f')],qs['fields'](_0x16edcb[_0x5349('0x31')]['fields']));_0x463a42[_0x5349('0x34')]=_0x463a42[_0x5349('0x34')][_0x5349('0x35')]?_0x463a42[_0x5349('0x34')]:_0x39b3a9[_0x5349('0x2f')];if(!_0x16edcb[_0x5349('0x31')]['hasOwnProperty']('nolimit')){_0x463a42[_0x5349('0x20')]=qs[_0x5349('0x20')](_0x16edcb[_0x5349('0x31')][_0x5349('0x20')]);_0x463a42[_0x5349('0x1f')]=qs[_0x5349('0x1f')](_0x16edcb[_0x5349('0x31')]['offset']);}_0x463a42['order']=qs[_0x5349('0x36')](_0x16edcb['query']['sort']);_0x463a42[_0x5349('0x37')]=qs['filters'](_[_0x5349('0x38')](_0x16edcb[_0x5349('0x31')],_0x39b3a9[_0x5349('0x32')]),_0x3b3e79);if(_0x16edcb['query'][_0x5349('0x39')]){_0x463a42['where']=_[_0x5349('0x3a')](_0x463a42[_0x5349('0x37')],{'$or':_[_0x5349('0x2a')](_0x3b3e79,function(_0x4d6f15){if(_0x4d6f15['type']!=='VIRTUAL'){var _0x84592b={};_0x84592b[_0x4d6f15[_0x5349('0x27')]]={'$like':'%'+_0x16edcb[_0x5349('0x31')][_0x5349('0x39')]+'%'};return _0x84592b;}})});}_0x463a42=_[_0x5349('0x3a')]({},_0x463a42,_0x16edcb[_0x5349('0x3b')]);var _0x50c506={'where':_0x463a42['where']};return db[_0x5349('0x3c')][_0x5349('0x1e')](_0x50c506)[_0x5349('0x24')](function(_0x53f062){_0x5b5d6c[_0x5349('0x1e')]=_0x53f062;if(_0x16edcb[_0x5349('0x31')][_0x5349('0x3d')]){_0x463a42[_0x5349('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0x5349('0x3f')](_0x463a42);})['then'](function(_0x39a154){_0x5b5d6c[_0x5349('0x40')]=_0x39a154;return _0x5b5d6c;})['then'](respondWithFilteredResult(_0x3b6faa,_0x463a42))[_0x5349('0x41')](handleError(_0x3b6faa,null));};exports[_0x5349('0x42')]=function(_0x1a3836,_0x370849){var _0x173904={'raw':!![],'where':{'id':_0x1a3836[_0x5349('0x43')]['id']}},_0xd29178={};_0xd29178['model']=_['keys'](db[_0x5349('0x3c')][_0x5349('0x2b')]);_0xd29178[_0x5349('0x31')]=_[_0x5349('0x30')](_0x1a3836['query']);_0xd29178[_0x5349('0x32')]=_['intersection'](_0xd29178['model'],_0xd29178[_0x5349('0x31')]);_0x173904[_0x5349('0x34')]=_[_0x5349('0x33')](_0xd29178[_0x5349('0x2f')],qs['fields'](_0x1a3836[_0x5349('0x31')][_0x5349('0x44')]));_0x173904[_0x5349('0x34')]=_0x173904[_0x5349('0x34')][_0x5349('0x35')]?_0x173904[_0x5349('0x34')]:_0xd29178[_0x5349('0x2f')];if(_0x1a3836[_0x5349('0x31')][_0x5349('0x3d')]){_0x173904[_0x5349('0x3e')]=[{'all':!![]}];}_0x173904=_[_0x5349('0x3a')]({},_0x173904,_0x1a3836[_0x5349('0x3b')]);return db[_0x5349('0x3c')][_0x5349('0x45')](_0x173904)['then'](handleEntityNotFound(_0x370849,null))['then'](respondWithResult(_0x370849,null))[_0x5349('0x41')](handleError(_0x370849,null));};exports[_0x5349('0x46')]=function(_0x37b370,_0x366634){return db[_0x5349('0x3c')][_0x5349('0x46')](_0x37b370['body'],{})[_0x5349('0x24')](respondWithResult(_0x366634,0xc9))[_0x5349('0x41')](handleError(_0x366634,null));};exports[_0x5349('0x23')]=function(_0x3652dc,_0x26d06a){if(_0x3652dc[_0x5349('0x47')]['id']){delete _0x3652dc['body']['id'];}return db[_0x5349('0x3c')]['find']({'where':{'id':_0x3652dc[_0x5349('0x43')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x26d06a,null))[_0x5349('0x24')](saveUpdates(_0x3652dc[_0x5349('0x47')],null))[_0x5349('0x24')](respondWithResult(_0x26d06a,null))['catch'](handleError(_0x26d06a,null));};exports[_0x5349('0x25')]=function(_0x3fca72,_0x3891af){return db[_0x5349('0x3c')]['find']({'where':{'id':_0x3fca72[_0x5349('0x43')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x3891af,null))[_0x5349('0x24')](removeEntity(_0x3891af,null))[_0x5349('0x41')](handleError(_0x3891af,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d275a93..7127276 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 _0xb81d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x42af45,_0x13cfae){var _0x2ddda6=function(_0x3f747f){while(--_0x3f747f){_0x42af45['push'](_0x42af45['shift']());}};_0x2ddda6(++_0x13cfae);}(_0xb81d,0xb4));var _0xdb81=function(_0x4f9e46,_0x393eff){_0x4f9e46=_0x4f9e46-0x0;var _0x442004=_0xb81d[_0x4f9e46];return _0x442004;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdb81('0x0'))(_0xdb81('0x1'));var moment=require(_0xdb81('0x2'));var BPromise=require('bluebird');var rp=require(_0xdb81('0x3'));var fs=require('fs');var path=require(_0xdb81('0x4'));var rimraf=require(_0xdb81('0x5'));var config=require(_0xdb81('0x6'));var attributes=require(_0xdb81('0x7'));module[_0xdb81('0x8')]=function(_0x10296c,_0x571b41){return _0x10296c[_0xdb81('0x9')](_0xdb81('0xa'),attributes,{'tableName':_0xdb81('0xb'),'paranoid':![],'indexes':[{'name':_0xdb81('0xc'),'fields':[_0xdb81('0xd'),_0xdb81('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x422c=['lodash','util','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x368c62,_0x5e40c9){var _0x38c57a=function(_0x3d451d){while(--_0x3d451d){_0x368c62['push'](_0x368c62['shift']());}};_0x38c57a(++_0x5e40c9);}(_0x422c,0x1ee));var _0xc422=function(_0x5c285b,_0x337003){_0x5c285b=_0x5c285b-0x0;var _0x4a4ada=_0x422c[_0x5c285b];return _0x4a4ada;};'use strict';var _=require(_0xc422('0x0'));var util=require(_0xc422('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc422('0x2'));var rp=require(_0xc422('0x3'));var fs=require('fs');var path=require(_0xc422('0x4'));var rimraf=require('rimraf');var config=require(_0xc422('0x5'));var attributes=require(_0xc422('0x6'));module[_0xc422('0x7')]=function(_0x54ffc3,_0x53757f){return _0x54ffc3['define'](_0xc422('0x8'),attributes,{'tableName':_0xc422('0x9'),'paranoid':![],'indexes':[{'name':_0xc422('0xa'),'fields':[_0xc422('0xb'),_0xc422('0xc')],'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 3f03d46..47950cf 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 _0x1a72=['lodash','util','bluebird','ioredis','rpc','../../config/environment','client','http','request','then','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result','catch'];(function(_0x26ba2c,_0x584851){var _0x272302=function(_0x412134){while(--_0x412134){_0x26ba2c['push'](_0x26ba2c['shift']());}};_0x272302(++_0x584851);}(_0x1a72,0x17c));var _0x21a7=function(_0x241783,_0x30dcc7){_0x241783=_0x241783-0x0;var _0x48afed=_0x1a72[_0x241783];return _0x48afed;};'use strict';var _=require(_0x21a7('0x0'));var util=require(_0x21a7('0x1'));var moment=require('moment');var BPromise=require(_0x21a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x21a7('0x4'));var config=require(_0x21a7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x21a7('0x6')][_0x21a7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x511168,_0x529641,_0x51158a){return new BPromise(function(_0x30feec,_0x5c0065){return client[_0x21a7('0x8')](_0x511168,_0x51158a)[_0x21a7('0x9')](function(_0x16d61a){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x529641,_0x21a7('0xa'));logger['debug'](_0x21a7('0xb'),_0x529641,_0x21a7('0xa'),JSON[_0x21a7('0xc')](_0x16d61a));if(_0x16d61a[_0x21a7('0xd')]){if(_0x16d61a['error'][_0x21a7('0xe')]===0x1f4){logger[_0x21a7('0xd')](_0x21a7('0xf'),_0x529641,_0x16d61a[_0x21a7('0xd')]['message']);return _0x5c0065(_0x16d61a[_0x21a7('0xd')][_0x21a7('0x10')]);}logger[_0x21a7('0xd')](_0x21a7('0xf'),_0x529641,_0x16d61a[_0x21a7('0xd')]['message']);return _0x30feec(_0x16d61a[_0x21a7('0xd')]['message']);}else{logger[_0x21a7('0x11')](_0x21a7('0xf'),_0x529641,_0x21a7('0xa'));_0x30feec(_0x16d61a[_0x21a7('0x12')][_0x21a7('0x10')]);}})[_0x21a7('0x13')](function(_0x3264bf){logger[_0x21a7('0xd')](_0x21a7('0xf'),_0x529641,_0x3264bf);_0x5c0065(_0x3264bf);});});} \ No newline at end of file +var _0x247e=['info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskField,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2c16ed,_0x3a9eeb){var _0x2780a3=function(_0x10cd46){while(--_0x10cd46){_0x2c16ed['push'](_0x2c16ed['shift']());}};_0x2780a3(++_0x3a9eeb);}(_0x247e,0x8d));var _0xe247=function(_0x40de73,_0x495ec9){_0x40de73=_0x40de73-0x0;var _0x3a825c=_0x247e[_0x40de73];return _0x3a825c;};'use strict';var _=require(_0xe247('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe247('0x1'));var rs=require(_0xe247('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe247('0x3'))['db'];var utils=require(_0xe247('0x4'));var logger=require(_0xe247('0x5'))(_0xe247('0x6'));var config=require(_0xe247('0x7'));var jayson=require(_0xe247('0x8'));var client=jayson[_0xe247('0x9')][_0xe247('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x758c3b,_0x15a155,_0x3e887a){return new BPromise(function(_0x588a0b,_0x1a0e6b){return client[_0xe247('0xb')](_0x758c3b,_0x3e887a)[_0xe247('0xc')](function(_0x16a275){logger[_0xe247('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x15a155,_0xe247('0xe'));logger[_0xe247('0xf')](_0xe247('0x10'),_0x15a155,'request\x20sent',JSON['stringify'](_0x16a275));if(_0x16a275[_0xe247('0x11')]){if(_0x16a275[_0xe247('0x11')][_0xe247('0x12')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x15a155,_0x16a275['error']['message']);return _0x1a0e6b(_0x16a275[_0xe247('0x11')][_0xe247('0x13')]);}logger['error'](_0xe247('0x14'),_0x15a155,_0x16a275[_0xe247('0x11')][_0xe247('0x13')]);return _0x588a0b(_0x16a275[_0xe247('0x11')][_0xe247('0x13')]);}else{logger[_0xe247('0xd')](_0xe247('0x14'),_0x15a155,_0xe247('0xe'));_0x588a0b(_0x16a275['result'][_0xe247('0x13')]);}})[_0xe247('0x15')](function(_0x545195){logger[_0xe247('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x15a155,_0x545195);_0x1a0e6b(_0x545195);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 93e133f..9aff882 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 _0xb58b=['Router','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x910793,_0x429cbf){var _0x21c77e=function(_0x45ca35){while(--_0x45ca35){_0x910793['push'](_0x910793['shift']());}};_0x21c77e(++_0x429cbf);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5a6318,_0x216a38){_0x5a6318=_0x5a6318-0x0;var _0x1faa09=_0xb58b[_0x5a6318];return _0x1faa09;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0x7')](_0xbb58('0xd'),auth[_0xbb58('0x8')](),controller['getFields']);router[_0xbb58('0xe')]('/',auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0xe')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['addConfiguration']);router[_0xbb58('0x10')](_0xbb58('0x9'),auth['isAuthenticated'](),controller[_0xbb58('0x11')]);router[_0xbb58('0x12')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0x13')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4719b1,_0x4d3628){var _0x5cc325=function(_0x593a4d){while(--_0x593a4d){_0x4719b1['push'](_0x4719b1['shift']());}};_0x5cc325(++_0x4d3628);}(_0xda3f,0xec));var _0xfda3=function(_0xb6defe,_0x46027f){_0xb6defe=_0xb6defe-0x0;var _0x341735=_0xda3f[_0xb6defe];return _0x341735;};'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('./intFreshsalesAccount.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'](),controller[_0xfda3('0xe')]);router[_0xfda3('0xd')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['put'](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfda3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1f0b678..bba51ae 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 _0x93e9=['sequelize','exports','STRING','username'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x93e9,0xcc));var _0x993e=function(_0x1b591b,_0x6d2e2b){_0x1b591b=_0x1b591b-0x0;var _0x3c24f0=_0x93e9[_0x1b591b];return _0x3c24f0;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'username':{'type':Sequelize[_0x993e('0x2')],'unique':_0x993e('0x3')},'apiKey':{'type':Sequelize[_0x993e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3546a5,_0xddb437){var _0x13d218=function(_0x1df135){while(--_0x1df135){_0x3546a5['push'](_0x3546a5['shift']());}};_0x13d218(++_0xddb437);}(_0x25e7,0x1d6));var _0x725e=function(_0x11a5a2,_0x1411fb){_0x11a5a2=_0x11a5a2-0x0;var _0xaf1ed0=_0x25e7[_0x11a5a2];return _0xaf1ed0;};'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 4e2e685..bf08ecb 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 _0x43ad=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','findOne','FreshsalesConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','/api/selector/owners','apiKey','users','email','test','statusCode','stringify','Wrong\x20credentials','eml-format'];(function(_0x38bac1,_0x240744){var _0x2b5960=function(_0x43293b){while(--_0x43293b){_0x38bac1['push'](_0x38bac1['shift']());}};_0x2b5960(++_0x240744);}(_0x43ad,0xcf));var _0xd43a=function(_0x376df5,_0x3caf6c){_0x376df5=_0x376df5-0x0;var _0x50c52c=_0x43ad[_0x376df5];return _0x50c52c;};'use strict';var emlformat=require(_0xd43a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd43a('0x1'));var jsonpatch=require(_0xd43a('0x2'));var rp=require(_0xd43a('0x3'));var moment=require(_0xd43a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd43a('0x5'));var util=require(_0xd43a('0x6'));var path=require(_0xd43a('0x7'));var sox=require('sox');var csv=require(_0xd43a('0x8'));var ejs=require(_0xd43a('0x9'));var fs=require('fs');var fs_extra=require(_0xd43a('0xa'));var _=require(_0xd43a('0xb'));var squel=require(_0xd43a('0xc'));var crypto=require(_0xd43a('0xd'));var jsforce=require(_0xd43a('0xe'));var deskjs=require(_0xd43a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd43a('0x10'));var Papa=require(_0xd43a('0x11'));var Redis=require(_0xd43a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd43a('0x13'));var hardwareService=require(_0xd43a('0x14'));var logger=require('../../config/logger')(_0xd43a('0x15'));var utils=require(_0xd43a('0x16'));var config=require(_0xd43a('0x17'));var licenseUtil=require(_0xd43a('0x18'));var db=require(_0xd43a('0x19'))['db'];var integrations=require(_0xd43a('0x1a'));function respondWithStatusCode(_0x2a1def,_0x18d749){_0x18d749=_0x18d749||0xcc;return function(_0x2911af){if(_0x2911af){return _0x2a1def[_0xd43a('0x1b')](_0x18d749);}return _0x2a1def[_0xd43a('0x1c')](_0x18d749)[_0xd43a('0x1d')]();};}function respondWithResult(_0x3ab47c,_0x29eb03){_0x29eb03=_0x29eb03||0xc8;return function(_0x417062){if(_0x417062){return _0x3ab47c['status'](_0x29eb03)[_0xd43a('0x1e')](_0x417062);}};}function respondWithFilteredResult(_0x215b42,_0x134f86){return function(_0x324c37){if(_0x324c37){var _0x44fa14=typeof _0x134f86[_0xd43a('0x1f')]===_0xd43a('0x20')&&typeof _0x134f86[_0xd43a('0x21')]===_0xd43a('0x20');var _0x1d2ef8=_0x324c37['count'];var _0xd9fdcf=_0x44fa14?0x0:_0x134f86[_0xd43a('0x1f')];var _0x29d77b=_0x44fa14?_0x324c37[_0xd43a('0x22')]:_0x134f86[_0xd43a('0x1f')]+_0x134f86[_0xd43a('0x21')];var _0x443e86;if(_0x29d77b>=_0x1d2ef8){_0x29d77b=_0x1d2ef8;_0x443e86=0xc8;}else{_0x443e86=0xce;}_0x215b42['status'](_0x443e86);return _0x215b42[_0xd43a('0x23')](_0xd43a('0x24'),_0xd9fdcf+'-'+_0x29d77b+'/'+_0x1d2ef8)['json'](_0x324c37);}return null;};}function patchUpdates(_0x401005){return function(_0xa77ab5){try{jsonpatch[_0xd43a('0x25')](_0xa77ab5,_0x401005,!![]);}catch(_0x33a1ea){return BPromise[_0xd43a('0x26')](_0x33a1ea);}return _0xa77ab5[_0xd43a('0x27')]();};}function saveUpdates(_0x48388f,_0x4c4821){return function(_0x2b5264){if(_0x2b5264){return _0x2b5264[_0xd43a('0x28')](_0x48388f)['then'](function(_0x30389c){return _0x30389c;});}return null;};}function removeEntity(_0x5ef184,_0x2b03c6){return function(_0x106784){if(_0x106784){return _0x106784['destroy']()[_0xd43a('0x29')](function(){_0x5ef184[_0xd43a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6298fd,_0x115387){return function(_0x4e62bb){if(!_0x4e62bb){_0x6298fd['sendStatus'](0x194);}return _0x4e62bb;};}function handleError(_0x8c2bd4,_0x29bbd1){_0x29bbd1=_0x29bbd1||0x1f4;return function(_0x9e5fc1){logger[_0xd43a('0x2a')](_0x9e5fc1['stack']);if(_0x9e5fc1[_0xd43a('0x2b')]){delete _0x9e5fc1[_0xd43a('0x2b')];}_0x8c2bd4[_0xd43a('0x1c')](_0x29bbd1)[_0xd43a('0x2c')](_0x9e5fc1);};}exports[_0xd43a('0x2d')]=function(_0x2c6d25,_0x3d488a){var _0x5f510b={},_0x282ff2={},_0x587bcd={'count':0x0,'rows':[]};var _0x5957bb=_[_0xd43a('0x2e')](db[_0xd43a('0x2f')][_0xd43a('0x30')],function(_0x2ff772){return{'name':_0x2ff772[_0xd43a('0x31')],'type':_0x2ff772[_0xd43a('0x32')][_0xd43a('0x33')]};});_0x282ff2[_0xd43a('0x34')]=_[_0xd43a('0x2e')](_0x5957bb,'name');_0x282ff2['query']=_[_0xd43a('0x35')](_0x2c6d25[_0xd43a('0x36')]);_0x282ff2[_0xd43a('0x37')]=_['intersection'](_0x282ff2[_0xd43a('0x34')],_0x282ff2[_0xd43a('0x36')]);_0x5f510b[_0xd43a('0x38')]=_[_0xd43a('0x39')](_0x282ff2[_0xd43a('0x34')],qs[_0xd43a('0x3a')](_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x3a')]));_0x5f510b[_0xd43a('0x38')]=_0x5f510b[_0xd43a('0x38')][_0xd43a('0x3b')]?_0x5f510b[_0xd43a('0x38')]:_0x282ff2[_0xd43a('0x34')];if(!_0x2c6d25[_0xd43a('0x36')]['hasOwnProperty'](_0xd43a('0x3c'))){_0x5f510b[_0xd43a('0x21')]=qs[_0xd43a('0x21')](_0x2c6d25['query'][_0xd43a('0x21')]);_0x5f510b[_0xd43a('0x1f')]=qs['offset'](_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x1f')]);}_0x5f510b['order']=qs[_0xd43a('0x3d')](_0x2c6d25['query'][_0xd43a('0x3d')]);_0x5f510b[_0xd43a('0x3e')]=qs[_0xd43a('0x37')](_[_0xd43a('0x3f')](_0x2c6d25[_0xd43a('0x36')],_0x282ff2[_0xd43a('0x37')]),_0x5957bb);if(_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x40')]){_0x5f510b['where']=_['merge'](_0x5f510b[_0xd43a('0x3e')],{'$or':_[_0xd43a('0x2e')](_0x5957bb,function(_0x552235){if(_0x552235[_0xd43a('0x32')]!=='VIRTUAL'){var _0x17cb9b={};_0x17cb9b[_0x552235[_0xd43a('0x2b')]]={'$like':'%'+_0x2c6d25[_0xd43a('0x36')]['filter']+'%'};return _0x17cb9b;}})});}_0x5f510b=_[_0xd43a('0x41')]({},_0x5f510b,_0x2c6d25[_0xd43a('0x42')]);var _0x1a973e={'where':_0x5f510b[_0xd43a('0x3e')]};return db[_0xd43a('0x2f')][_0xd43a('0x22')](_0x1a973e)[_0xd43a('0x29')](function(_0x24eeb2){_0x587bcd[_0xd43a('0x22')]=_0x24eeb2;if(_0x2c6d25[_0xd43a('0x36')][_0xd43a('0x43')]){_0x5f510b[_0xd43a('0x44')]=[{'all':!![]}];}return db[_0xd43a('0x2f')][_0xd43a('0x45')](_0x5f510b);})['then'](function(_0x462c18){_0x587bcd[_0xd43a('0x46')]=_0x462c18;return _0x587bcd;})[_0xd43a('0x29')](respondWithFilteredResult(_0x3d488a,_0x5f510b))['catch'](handleError(_0x3d488a,null));};exports[_0xd43a('0x47')]=function(_0x47b96c,_0x2d75ba){var _0x443a07={'raw':![],'where':{'id':_0x47b96c[_0xd43a('0x48')]['id']}},_0x3327df={};_0x3327df[_0xd43a('0x34')]=_[_0xd43a('0x35')](db['FreshsalesAccount'][_0xd43a('0x30')]);_0x3327df['query']=_[_0xd43a('0x35')](_0x47b96c[_0xd43a('0x36')]);_0x3327df['filters']=_[_0xd43a('0x39')](_0x3327df['model'],_0x3327df[_0xd43a('0x36')]);_0x443a07[_0xd43a('0x38')]=_['intersection'](_0x3327df[_0xd43a('0x34')],qs[_0xd43a('0x3a')](_0x47b96c[_0xd43a('0x36')][_0xd43a('0x3a')]));_0x443a07[_0xd43a('0x38')]=_0x443a07[_0xd43a('0x38')][_0xd43a('0x3b')]?_0x443a07[_0xd43a('0x38')]:_0x3327df[_0xd43a('0x34')];if(_0x47b96c[_0xd43a('0x36')][_0xd43a('0x43')]){_0x443a07[_0xd43a('0x44')]=[{'all':!![]}];}_0x443a07=_[_0xd43a('0x41')]({},_0x443a07,_0x47b96c[_0xd43a('0x42')]);return db[_0xd43a('0x2f')][_0xd43a('0x49')](_0x443a07)['then'](handleEntityNotFound(_0x2d75ba,null))[_0xd43a('0x29')](respondWithResult(_0x2d75ba,null))[_0xd43a('0x4a')](handleError(_0x2d75ba,null));};exports[_0xd43a('0x4b')]=function(_0x5ab82c,_0x31fc15){return db[_0xd43a('0x2f')][_0xd43a('0x4b')](_0x5ab82c[_0xd43a('0x4c')],{})[_0xd43a('0x29')](respondWithResult(_0x31fc15,0xc9))[_0xd43a('0x4a')](handleError(_0x31fc15,null));};exports[_0xd43a('0x28')]=function(_0x791236,_0x180c45){if(_0x791236[_0xd43a('0x4c')]['id']){delete _0x791236['body']['id'];}return db[_0xd43a('0x2f')][_0xd43a('0x49')]({'where':{'id':_0x791236[_0xd43a('0x48')]['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x180c45,null))['then'](saveUpdates(_0x791236['body'],null))[_0xd43a('0x29')](respondWithResult(_0x180c45,null))[_0xd43a('0x4a')](handleError(_0x180c45,null));};exports[_0xd43a('0x4d')]=function(_0xb6295,_0x370043){return db[_0xd43a('0x2f')]['find']({'where':{'id':_0xb6295[_0xd43a('0x48')]['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x370043,null))[_0xd43a('0x29')](removeEntity(_0x370043,null))['catch'](handleError(_0x370043,null));};exports['getConfigurations']=function(_0x18d42a,_0x160508,_0x30d593){var _0x2ee036={};var _0x2f8c72={};var _0x1baffd;var _0x406e68;return db['FreshsalesAccount'][_0xd43a('0x4e')]({'where':{'id':_0x18d42a['params']['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x160508,null))[_0xd43a('0x29')](function(_0x3eb69b){if(_0x3eb69b){_0x1baffd=_0x3eb69b;_0x2f8c72[_0xd43a('0x34')]=_[_0xd43a('0x35')](db[_0xd43a('0x4f')][_0xd43a('0x30')]);_0x2f8c72[_0xd43a('0x36')]=_[_0xd43a('0x35')](_0x18d42a[_0xd43a('0x36')]);_0x2f8c72['filters']=_[_0xd43a('0x39')](_0x2f8c72['model'],_0x2f8c72[_0xd43a('0x36')]);_0x2ee036[_0xd43a('0x38')]=_[_0xd43a('0x39')](_0x2f8c72[_0xd43a('0x34')],qs['fields'](_0x18d42a[_0xd43a('0x36')]['fields']));_0x2ee036[_0xd43a('0x38')]=_0x2ee036['attributes'][_0xd43a('0x3b')]?_0x2ee036[_0xd43a('0x38')]:_0x2f8c72[_0xd43a('0x34')];_0x2ee036[_0xd43a('0x50')]=qs['sort'](_0x18d42a['query'][_0xd43a('0x3d')]);_0x2ee036[_0xd43a('0x3e')]=qs[_0xd43a('0x37')](_[_0xd43a('0x3f')](_0x18d42a['query'],_0x2f8c72[_0xd43a('0x37')]));if(_0x18d42a[_0xd43a('0x36')]['filter']){_0x2ee036[_0xd43a('0x3e')]=_[_0xd43a('0x41')](_0x2ee036[_0xd43a('0x3e')],{'$or':_[_0xd43a('0x2e')](_0x2ee036[_0xd43a('0x38')],function(_0x1bff3f){var _0x34bfad={};_0x34bfad[_0x1bff3f]={'$like':'%'+_0x18d42a[_0xd43a('0x36')][_0xd43a('0x40')]+'%'};return _0x34bfad;})});}_0x2ee036=_[_0xd43a('0x41')]({},_0x2ee036,_0x18d42a[_0xd43a('0x42')]);return _0x1baffd['getConfigurations'](_0x2ee036);}})[_0xd43a('0x29')](function(_0x25d61f){if(_0x25d61f){_0x406e68=_0x25d61f[_0xd43a('0x3b')];if(!_0x18d42a[_0xd43a('0x36')]['hasOwnProperty']('nolimit')){_0x2ee036[_0xd43a('0x21')]=qs['limit'](_0x18d42a['query'][_0xd43a('0x21')]);_0x2ee036[_0xd43a('0x1f')]=qs[_0xd43a('0x1f')](_0x18d42a[_0xd43a('0x36')][_0xd43a('0x1f')]);}return _0x1baffd[_0xd43a('0x51')](_0x2ee036);}})[_0xd43a('0x29')](function(_0x1b2785){if(_0x1b2785){return _0x1b2785?{'count':_0x406e68,'rows':_0x1b2785}:null;}})[_0xd43a('0x29')](respondWithResult(_0x160508,null))[_0xd43a('0x4a')](handleError(_0x160508,null));};exports['addConfiguration']=function(_0xd07a37,_0x3b5aee,_0x54ac44){if(_0xd07a37[_0xd43a('0x4c')]['id']){delete _0xd07a37['body']['id'];}return db[_0xd43a('0x2f')][_0xd43a('0x4e')]({'where':{'id':_0xd07a37['params']['id']}})[_0xd43a('0x29')](handleEntityNotFound(_0x3b5aee,null))[_0xd43a('0x29')](function(_0x4d43d7){if(_0x4d43d7){_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x52')]=_0x4d43d7['id'];_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x53')]=integrations[_0xd43a('0x54')](_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x55')],_0xd07a37[_0xd43a('0x4c')]['type']);_0xd07a37[_0xd43a('0x4c')][_0xd43a('0x56')]=integrations[_0xd43a('0x57')](_0xd07a37['body']['channel'],_0xd07a37[_0xd43a('0x4c')]['type']);return db[_0xd43a('0x4f')][_0xd43a('0x4b')](_0xd07a37[_0xd43a('0x4c')],{'include':[{'model':db[_0xd43a('0x58')],'as':_0xd43a('0x53')},{'model':db[_0xd43a('0x58')],'as':'Descriptions'}]});}return null;})[_0xd43a('0x29')](respondWithResult(_0x3b5aee,null))[_0xd43a('0x4a')](handleError(_0x3b5aee,null));};exports[_0xd43a('0x59')]=function(_0x31816e,_0x52eeb8,_0x3a419d){var _0x4276f3='';var _0x42cb7b='';return db[_0xd43a('0x2f')][_0xd43a('0x4e')]({'where':{'id':_0x31816e[_0xd43a('0x48')]['id']},'attributes':['id',_0xd43a('0x5a'),_0xd43a('0x5b'),'apiKey']})[_0xd43a('0x29')](handleEntityNotFound(_0x52eeb8,null))['then'](function(_0x3de30c){if(_0x3de30c){_0x42cb7b=_0x3de30c['username'];_0x4276f3=_0x3de30c[_0xd43a('0x5b')];var _0xcbd693=_0x3de30c[_0xd43a('0x5b')]['slice'](-0x1);if(_0xcbd693==='/'){_0x4276f3=_0x4276f3[_0xd43a('0x5c')](0x0,_0x4276f3[_0xd43a('0x5d')](_0xcbd693));}return rp({'method':_0xd43a('0x5e'),'uri':util[_0xd43a('0x5f')]('%s%s',_0x4276f3,_0xd43a('0x60')),'headers':{'Authorization':'Token\x20token='+_0x3de30c[_0xd43a('0x61')]},'json':!![]});}})[_0xd43a('0x29')](function(_0x3ed5bf){if(_0x3ed5bf){var _0x1afddf=_0x3ed5bf[_0xd43a('0x62')];var _0x2b3efa=![];var _0x104383=null;for(_0x104383=0x0;_0x104383<_0x1afddf[_0xd43a('0x3b')];_0x104383++){if(_0x1afddf[_0x104383][_0xd43a('0x63')]===_0x42cb7b){_0x2b3efa=!![];}}if(_0x2b3efa){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x52eeb8,null))[_0xd43a('0x4a')](function(_0x3b7cd4){var _0x26d101=_0x31816e['query'][_0xd43a('0x64')]?0x1f4:_0x3b7cd4[_0xd43a('0x65')]||0x1f4;logger[_0xd43a('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xd43a('0x59'),_0x26d101,JSON[_0xd43a('0x66')](_0x3b7cd4));delete _0x3b7cd4[_0xd43a('0x2b')];if(_0x26d101===0x191){_0x26d101=0x190;}_0x52eeb8[_0xd43a('0x1c')](_0x26d101)[_0xd43a('0x2c')](_0x31816e['query'][_0xd43a('0x64')]?{'message':_0xd43a('0x67'),'statusCode':_0x3b7cd4['statusCode']}:_0x3b7cd4);});}; \ No newline at end of file +var _0x6e8b=['stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','map','VIRTUAL','options','FreshsalesAccount','include','findAll','rows','catch','show','params','rawAttributes','includeAll','merge','find','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','create','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x4f0e22,_0x54dd91){var _0x22d1cd=function(_0x5ba320){while(--_0x5ba320){_0x4f0e22['push'](_0x4f0e22['shift']());}};_0x22d1cd(++_0x54dd91);}(_0x6e8b,0x70));var _0xb6e8=function(_0x2a24b2,_0x171540){_0x2a24b2=_0x2a24b2-0x0;var _0x2ed7d3=_0x6e8b[_0x2a24b2];return _0x2ed7d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6e8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6e8('0x1'));var rp=require(_0xb6e8('0x2'));var moment=require(_0xb6e8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb6e8('0x4'));var path=require(_0xb6e8('0x5'));var sox=require(_0xb6e8('0x6'));var csv=require(_0xb6e8('0x7'));var ejs=require(_0xb6e8('0x8'));var fs=require('fs');var fs_extra=require(_0xb6e8('0x9'));var _=require(_0xb6e8('0xa'));var squel=require(_0xb6e8('0xb'));var crypto=require(_0xb6e8('0xc'));var jsforce=require(_0xb6e8('0xd'));var deskjs=require(_0xb6e8('0xe'));var toCsv=require(_0xb6e8('0x7'));var querystring=require(_0xb6e8('0xf'));var Papa=require('papaparse');var Redis=require(_0xb6e8('0x10'));var authService=require(_0xb6e8('0x11'));var qs=require(_0xb6e8('0x12'));var as=require(_0xb6e8('0x13'));var hardwareService=require(_0xb6e8('0x14'));var logger=require(_0xb6e8('0x15'))(_0xb6e8('0x16'));var utils=require('../../config/utils');var config=require(_0xb6e8('0x17'));var licenseUtil=require(_0xb6e8('0x18'));var db=require(_0xb6e8('0x19'))['db'];var integrations=require(_0xb6e8('0x1a'));function respondWithStatusCode(_0x5c7875,_0x2b23c6){_0x2b23c6=_0x2b23c6||0xcc;return function(_0x2a9ef4){if(_0x2a9ef4){return _0x5c7875[_0xb6e8('0x1b')](_0x2b23c6);}return _0x5c7875[_0xb6e8('0x1c')](_0x2b23c6)[_0xb6e8('0x1d')]();};}function respondWithResult(_0x4c2463,_0x433622){_0x433622=_0x433622||0xc8;return function(_0x486d97){if(_0x486d97){return _0x4c2463[_0xb6e8('0x1c')](_0x433622)[_0xb6e8('0x1e')](_0x486d97);}};}function respondWithFilteredResult(_0x4b6bed,_0x14489f){return function(_0x41d71a){if(_0x41d71a){var _0x88cae1=typeof _0x14489f[_0xb6e8('0x1f')]===_0xb6e8('0x20')&&typeof _0x14489f[_0xb6e8('0x21')]===_0xb6e8('0x20');var _0x3852cf=_0x41d71a[_0xb6e8('0x22')];var _0x2ce694=_0x88cae1?0x0:_0x14489f[_0xb6e8('0x1f')];var _0x25220a=_0x88cae1?_0x41d71a['count']:_0x14489f[_0xb6e8('0x1f')]+_0x14489f[_0xb6e8('0x21')];var _0x2db21b;if(_0x25220a>=_0x3852cf){_0x25220a=_0x3852cf;_0x2db21b=0xc8;}else{_0x2db21b=0xce;}_0x4b6bed[_0xb6e8('0x1c')](_0x2db21b);return _0x4b6bed[_0xb6e8('0x23')]('Content-Range',_0x2ce694+'-'+_0x25220a+'/'+_0x3852cf)[_0xb6e8('0x1e')](_0x41d71a);}return null;};}function patchUpdates(_0x47d524){return function(_0x7ac720){try{jsonpatch[_0xb6e8('0x24')](_0x7ac720,_0x47d524,!![]);}catch(_0x1cb733){return BPromise['reject'](_0x1cb733);}return _0x7ac720[_0xb6e8('0x25')]();};}function saveUpdates(_0x152e4b,_0x225ec9){return function(_0x309a11){if(_0x309a11){return _0x309a11[_0xb6e8('0x26')](_0x152e4b)[_0xb6e8('0x27')](function(_0xb96df8){return _0xb96df8;});}return null;};}function removeEntity(_0x3cf760,_0x5cf484){return function(_0x42e41f){if(_0x42e41f){return _0x42e41f[_0xb6e8('0x28')]()[_0xb6e8('0x27')](function(){_0x3cf760[_0xb6e8('0x1c')](0xcc)[_0xb6e8('0x1d')]();});}};}function handleEntityNotFound(_0x5b08d1,_0x369fa0){return function(_0xe4b91d){if(!_0xe4b91d){_0x5b08d1['sendStatus'](0x194);}return _0xe4b91d;};}function handleError(_0x430462,_0x15b7ca){_0x15b7ca=_0x15b7ca||0x1f4;return function(_0x6c338a){logger['error'](_0x6c338a[_0xb6e8('0x29')]);if(_0x6c338a[_0xb6e8('0x2a')]){delete _0x6c338a[_0xb6e8('0x2a')];}_0x430462[_0xb6e8('0x1c')](_0x15b7ca)[_0xb6e8('0x2b')](_0x6c338a);};}exports[_0xb6e8('0x2c')]=function(_0x2dcdd9,_0x1f4e17){var _0x2c4de3={},_0x531d65={},_0x51c56a={'count':0x0,'rows':[]};var _0x212ea2=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x16ae10){return{'name':_0x16ae10[_0xb6e8('0x2d')],'type':_0x16ae10['type'][_0xb6e8('0x2e')]};});_0x531d65['model']=_['map'](_0x212ea2,_0xb6e8('0x2a'));_0x531d65[_0xb6e8('0x2f')]=_[_0xb6e8('0x30')](_0x2dcdd9[_0xb6e8('0x2f')]);_0x531d65[_0xb6e8('0x31')]=_[_0xb6e8('0x32')](_0x531d65[_0xb6e8('0x33')],_0x531d65[_0xb6e8('0x2f')]);_0x2c4de3['attributes']=_[_0xb6e8('0x32')](_0x531d65[_0xb6e8('0x33')],qs[_0xb6e8('0x34')](_0x2dcdd9[_0xb6e8('0x2f')][_0xb6e8('0x34')]));_0x2c4de3[_0xb6e8('0x35')]=_0x2c4de3[_0xb6e8('0x35')][_0xb6e8('0x36')]?_0x2c4de3[_0xb6e8('0x35')]:_0x531d65[_0xb6e8('0x33')];if(!_0x2dcdd9[_0xb6e8('0x2f')]['hasOwnProperty'](_0xb6e8('0x37'))){_0x2c4de3['limit']=qs['limit'](_0x2dcdd9[_0xb6e8('0x2f')][_0xb6e8('0x21')]);_0x2c4de3['offset']=qs[_0xb6e8('0x1f')](_0x2dcdd9[_0xb6e8('0x2f')]['offset']);}_0x2c4de3[_0xb6e8('0x38')]=qs[_0xb6e8('0x39')](_0x2dcdd9[_0xb6e8('0x2f')]['sort']);_0x2c4de3['where']=qs[_0xb6e8('0x31')](_[_0xb6e8('0x3a')](_0x2dcdd9[_0xb6e8('0x2f')],_0x531d65[_0xb6e8('0x31')]),_0x212ea2);if(_0x2dcdd9[_0xb6e8('0x2f')][_0xb6e8('0x3b')]){_0x2c4de3[_0xb6e8('0x3c')]=_['merge'](_0x2c4de3[_0xb6e8('0x3c')],{'$or':_[_0xb6e8('0x3d')](_0x212ea2,function(_0x5cae79){if(_0x5cae79['type']!==_0xb6e8('0x3e')){var _0xb37646={};_0xb37646[_0x5cae79['name']]={'$like':'%'+_0x2dcdd9[_0xb6e8('0x2f')][_0xb6e8('0x3b')]+'%'};return _0xb37646;}})});}_0x2c4de3=_['merge']({},_0x2c4de3,_0x2dcdd9[_0xb6e8('0x3f')]);var _0x2ba83e={'where':_0x2c4de3[_0xb6e8('0x3c')]};return db[_0xb6e8('0x40')][_0xb6e8('0x22')](_0x2ba83e)['then'](function(_0x26966c){_0x51c56a[_0xb6e8('0x22')]=_0x26966c;if(_0x2dcdd9[_0xb6e8('0x2f')]['includeAll']){_0x2c4de3[_0xb6e8('0x41')]=[{'all':!![]}];}return db[_0xb6e8('0x40')][_0xb6e8('0x42')](_0x2c4de3);})[_0xb6e8('0x27')](function(_0x5e1195){_0x51c56a[_0xb6e8('0x43')]=_0x5e1195;return _0x51c56a;})[_0xb6e8('0x27')](respondWithFilteredResult(_0x1f4e17,_0x2c4de3))[_0xb6e8('0x44')](handleError(_0x1f4e17,null));};exports[_0xb6e8('0x45')]=function(_0x57908f,_0x479534){var _0x2a2175={'raw':![],'where':{'id':_0x57908f[_0xb6e8('0x46')]['id']}},_0x23246d={};_0x23246d[_0xb6e8('0x33')]=_['keys'](db[_0xb6e8('0x40')][_0xb6e8('0x47')]);_0x23246d['query']=_[_0xb6e8('0x30')](_0x57908f['query']);_0x23246d['filters']=_['intersection'](_0x23246d[_0xb6e8('0x33')],_0x23246d[_0xb6e8('0x2f')]);_0x2a2175[_0xb6e8('0x35')]=_[_0xb6e8('0x32')](_0x23246d['model'],qs['fields'](_0x57908f[_0xb6e8('0x2f')][_0xb6e8('0x34')]));_0x2a2175[_0xb6e8('0x35')]=_0x2a2175[_0xb6e8('0x35')][_0xb6e8('0x36')]?_0x2a2175[_0xb6e8('0x35')]:_0x23246d[_0xb6e8('0x33')];if(_0x57908f['query'][_0xb6e8('0x48')]){_0x2a2175[_0xb6e8('0x41')]=[{'all':!![]}];}_0x2a2175=_[_0xb6e8('0x49')]({},_0x2a2175,_0x57908f[_0xb6e8('0x3f')]);return db[_0xb6e8('0x40')][_0xb6e8('0x4a')](_0x2a2175)[_0xb6e8('0x27')](handleEntityNotFound(_0x479534,null))[_0xb6e8('0x27')](respondWithResult(_0x479534,null))[_0xb6e8('0x44')](handleError(_0x479534,null));};exports['create']=function(_0x4aa843,_0x5a8401){return db['FreshsalesAccount']['create'](_0x4aa843[_0xb6e8('0x4b')],{})[_0xb6e8('0x27')](respondWithResult(_0x5a8401,0xc9))[_0xb6e8('0x44')](handleError(_0x5a8401,null));};exports[_0xb6e8('0x26')]=function(_0x406b6c,_0x2cf5e8){if(_0x406b6c[_0xb6e8('0x4b')]['id']){delete _0x406b6c[_0xb6e8('0x4b')]['id'];}return db[_0xb6e8('0x40')][_0xb6e8('0x4a')]({'where':{'id':_0x406b6c[_0xb6e8('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cf5e8,null))[_0xb6e8('0x27')](saveUpdates(_0x406b6c['body'],null))['then'](respondWithResult(_0x2cf5e8,null))['catch'](handleError(_0x2cf5e8,null));};exports[_0xb6e8('0x28')]=function(_0x3f519e,_0x56152d){return db[_0xb6e8('0x40')]['find']({'where':{'id':_0x3f519e[_0xb6e8('0x46')]['id']}})['then'](handleEntityNotFound(_0x56152d,null))[_0xb6e8('0x27')](removeEntity(_0x56152d,null))[_0xb6e8('0x44')](handleError(_0x56152d,null));};exports[_0xb6e8('0x4c')]=function(_0x33b5fb,_0xd65e72,_0x3ab817){var _0x2aac20={};var _0x36f92c={};var _0x3208e8;var _0x589483;return db[_0xb6e8('0x40')][_0xb6e8('0x4d')]({'where':{'id':_0x33b5fb[_0xb6e8('0x46')]['id']}})[_0xb6e8('0x27')](handleEntityNotFound(_0xd65e72,null))['then'](function(_0x169d91){if(_0x169d91){_0x3208e8=_0x169d91;_0x36f92c[_0xb6e8('0x33')]=_[_0xb6e8('0x30')](db[_0xb6e8('0x4e')][_0xb6e8('0x47')]);_0x36f92c[_0xb6e8('0x2f')]=_[_0xb6e8('0x30')](_0x33b5fb['query']);_0x36f92c[_0xb6e8('0x31')]=_[_0xb6e8('0x32')](_0x36f92c[_0xb6e8('0x33')],_0x36f92c[_0xb6e8('0x2f')]);_0x2aac20[_0xb6e8('0x35')]=_['intersection'](_0x36f92c['model'],qs['fields'](_0x33b5fb[_0xb6e8('0x2f')]['fields']));_0x2aac20[_0xb6e8('0x35')]=_0x2aac20[_0xb6e8('0x35')]['length']?_0x2aac20[_0xb6e8('0x35')]:_0x36f92c['model'];_0x2aac20['order']=qs['sort'](_0x33b5fb[_0xb6e8('0x2f')][_0xb6e8('0x39')]);_0x2aac20['where']=qs[_0xb6e8('0x31')](_[_0xb6e8('0x3a')](_0x33b5fb['query'],_0x36f92c[_0xb6e8('0x31')]));if(_0x33b5fb[_0xb6e8('0x2f')][_0xb6e8('0x3b')]){_0x2aac20['where']=_[_0xb6e8('0x49')](_0x2aac20[_0xb6e8('0x3c')],{'$or':_['map'](_0x2aac20[_0xb6e8('0x35')],function(_0x1941c1){var _0x367b56={};_0x367b56[_0x1941c1]={'$like':'%'+_0x33b5fb[_0xb6e8('0x2f')][_0xb6e8('0x3b')]+'%'};return _0x367b56;})});}_0x2aac20=_[_0xb6e8('0x49')]({},_0x2aac20,_0x33b5fb[_0xb6e8('0x3f')]);return _0x3208e8[_0xb6e8('0x4c')](_0x2aac20);}})['then'](function(_0x35018a){if(_0x35018a){_0x589483=_0x35018a[_0xb6e8('0x36')];if(!_0x33b5fb[_0xb6e8('0x2f')]['hasOwnProperty'](_0xb6e8('0x37'))){_0x2aac20['limit']=qs['limit'](_0x33b5fb[_0xb6e8('0x2f')][_0xb6e8('0x21')]);_0x2aac20['offset']=qs[_0xb6e8('0x1f')](_0x33b5fb[_0xb6e8('0x2f')][_0xb6e8('0x1f')]);}return _0x3208e8[_0xb6e8('0x4c')](_0x2aac20);}})[_0xb6e8('0x27')](function(_0x50c9d9){if(_0x50c9d9){return _0x50c9d9?{'count':_0x589483,'rows':_0x50c9d9}:null;}})[_0xb6e8('0x27')](respondWithResult(_0xd65e72,null))['catch'](handleError(_0xd65e72,null));};exports[_0xb6e8('0x4f')]=function(_0x23fc77,_0x2244c8,_0x4f310c){if(_0x23fc77[_0xb6e8('0x4b')]['id']){delete _0x23fc77['body']['id'];}return db[_0xb6e8('0x40')]['findOne']({'where':{'id':_0x23fc77['params']['id']}})[_0xb6e8('0x27')](handleEntityNotFound(_0x2244c8,null))[_0xb6e8('0x27')](function(_0x195411){if(_0x195411){_0x23fc77[_0xb6e8('0x4b')][_0xb6e8('0x50')]=_0x195411['id'];_0x23fc77['body'][_0xb6e8('0x51')]=integrations[_0xb6e8('0x52')](_0x23fc77[_0xb6e8('0x4b')][_0xb6e8('0x53')],_0x23fc77[_0xb6e8('0x4b')][_0xb6e8('0x54')]);_0x23fc77[_0xb6e8('0x4b')][_0xb6e8('0x55')]=integrations[_0xb6e8('0x56')](_0x23fc77['body'][_0xb6e8('0x53')],_0x23fc77[_0xb6e8('0x4b')][_0xb6e8('0x54')]);return db[_0xb6e8('0x4e')][_0xb6e8('0x57')](_0x23fc77[_0xb6e8('0x4b')],{'include':[{'model':db[_0xb6e8('0x58')],'as':_0xb6e8('0x51')},{'model':db[_0xb6e8('0x58')],'as':_0xb6e8('0x55')}]});}return null;})['then'](respondWithResult(_0x2244c8,null))[_0xb6e8('0x44')](handleError(_0x2244c8,null));};exports[_0xb6e8('0x59')]=function(_0xed3146,_0x30678c,_0x21c49a){var _0x1362a7='';var _0x5b0d59='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0xed3146[_0xb6e8('0x46')]['id']},'attributes':['id',_0xb6e8('0x5a'),_0xb6e8('0x5b'),_0xb6e8('0x5c')]})['then'](handleEntityNotFound(_0x30678c,null))['then'](function(_0x1f65e4){if(_0x1f65e4){_0x5b0d59=_0x1f65e4[_0xb6e8('0x5a')];_0x1362a7=_0x1f65e4[_0xb6e8('0x5b')];var _0x4c51e7=_0x1f65e4[_0xb6e8('0x5b')][_0xb6e8('0x5d')](-0x1);if(_0x4c51e7==='/'){_0x1362a7=_0x1362a7[_0xb6e8('0x5e')](0x0,_0x1362a7[_0xb6e8('0x5f')](_0x4c51e7));}return rp({'method':_0xb6e8('0x60'),'uri':util[_0xb6e8('0x61')](_0xb6e8('0x62'),_0x1362a7,_0xb6e8('0x63')),'headers':{'Authorization':_0xb6e8('0x64')+_0x1f65e4['apiKey']},'json':!![]});}})[_0xb6e8('0x27')](function(_0x56a9fb){if(_0x56a9fb){var _0x399aaf=_0x56a9fb[_0xb6e8('0x65')];var _0x582e51=![];var _0x4849d7=null;for(_0x4849d7=0x0;_0x4849d7<_0x399aaf[_0xb6e8('0x36')];_0x4849d7++){if(_0x399aaf[_0x4849d7][_0xb6e8('0x66')]===_0x5b0d59){_0x582e51=!![];}}if(_0x582e51){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb6e8('0x67')});}}})[_0xb6e8('0x27')](respondWithResult(_0x30678c,null))[_0xb6e8('0x44')](function(_0x1cf386){var _0x47791a=_0xed3146['query'][_0xb6e8('0x68')]?0x1f4:_0x1cf386[_0xb6e8('0x69')]||0x1f4;logger[_0xb6e8('0x6a')](_0xb6e8('0x6b'),_0xb6e8('0x59'),_0x47791a,JSON[_0xb6e8('0x6c')](_0x1cf386));delete _0x1cf386[_0xb6e8('0x2a')];if(_0x47791a===0x191){_0x47791a=0x190;}_0x30678c[_0xb6e8('0x1c')](_0x47791a)[_0xb6e8('0x2b')](_0xed3146[_0xb6e8('0x2f')][_0xb6e8('0x68')]?{'message':_0xb6e8('0x6d'),'statusCode':_0x1cf386[_0xb6e8('0x69')]}:_0x1cf386);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 461db2d..b3dc6ed 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 _0x7ee1=['request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','moment','bluebird'];(function(_0x132886,_0x1b56cb){var _0x333c46=function(_0x28aa59){while(--_0x28aa59){_0x132886['push'](_0x132886['shift']());}};_0x333c46(++_0x1b56cb);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2548c0,_0x5d9575){_0x2548c0=_0x2548c0-0x0;var _0x428bbd=_0x7ee1[_0x2548c0];return _0x428bbd;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));var integrations=require(_0x17ee('0x7'));module['exports']=function(_0x52b1db,_0x29b9eb){return _0x52b1db['define'](_0x17ee('0x8'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x627e=['path','rimraf','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x31c3b4,_0x29ebae){var _0x439577=function(_0x27c68d){while(--_0x27c68d){_0x31c3b4['push'](_0x31c3b4['shift']());}};_0x439577(++_0x29ebae);}(_0x627e,0x14a));var _0xe627=function(_0x347e2d,_0x5b465c){_0x347e2d=_0x347e2d-0x0;var _0x13fc00=_0x627e[_0x347e2d];return _0x13fc00;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe627('0x8')]=function(_0x3f2791,_0x45e49a){return _0x3f2791[_0xe627('0x9')](_0xe627('0xa'),attributes,{'tableName':_0xe627('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 6364088..4490c7d 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 _0xfb11=['catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','debug','ShowFreshsalesAccount','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x16f46f,_0xf9b682){var _0x33c120=function(_0xb6e60f){while(--_0xb6e60f){_0x16f46f['push'](_0x16f46f['shift']());}};_0x33c120(++_0xf9b682);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xfb11[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});}exports[_0x1fb1('0x14')]=function(_0x24d4df){var _0x34076b=this;return new Promise(function(_0x33c6b6,_0x27d71f){return db[_0x1fb1('0x15')][_0x1fb1('0x16')]({'raw':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options'][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x24d4df['options']?_0x24d4df['options'][_0x1fb1('0x19')]||null:null,'attributes':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df[_0x1fb1('0x17')]['attributes']||null:null,'limit':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options']['limit']||null:null,'include':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x53b8af){return{'model':db[_0x53b8af[_0x1fb1('0x1c')]],'as':_0x53b8af['as'],'attributes':_0x53b8af[_0x1fb1('0x1d')],'include':_0x53b8af[_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x53b8af[_0x1fb1('0x1a')],function(_0x1353a4){return{'model':db[_0x1353a4[_0x1fb1('0x1c')]],'as':_0x1353a4['as'],'attributes':_0x1353a4[_0x1fb1('0x1d')],'include':_0x1353a4['include']?_[_0x1fb1('0x1b')](_0x1353a4[_0x1fb1('0x1a')],function(_0x46ff60){return{'model':db[_0x46ff60[_0x1fb1('0x1c')]],'as':_0x46ff60['as'],'attributes':_0x46ff60[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x1a74c4){logger[_0x1fb1('0xb')](_0x1fb1('0x14'),_0x24d4df);logger[_0x1fb1('0x1e')](_0x1fb1('0x14'),_0x24d4df,JSON[_0x1fb1('0xf')](_0x1a74c4));_0x33c6b6(_0x1a74c4);})[_0x1fb1('0x13')](function(_0xe8ec0a){logger[_0x1fb1('0x10')]('GetFreshsalesAccount',_0xe8ec0a[_0x1fb1('0x12')],_0x24d4df);_0x27d71f(_0x34076b[_0x1fb1('0x10')](0x1f4,_0xe8ec0a[_0x1fb1('0x12')]));});});};exports[_0x1fb1('0x1f')]=function(_0x5402e9){var _0x245f84=this;return new Promise(function(_0x30c8eb,_0x5d45a5){return db[_0x1fb1('0x15')]['find']({'raw':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x19')]||null:null,'attributes':_0x5402e9[_0x1fb1('0x17')]?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1d')]||null:null,'include':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x307700){return{'model':db[_0x307700[_0x1fb1('0x1c')]],'as':_0x307700['as'],'attributes':_0x307700[_0x1fb1('0x1d')],'include':_0x307700[_0x1fb1('0x1a')]?_['map'](_0x307700[_0x1fb1('0x1a')],function(_0x4b4271){return{'model':db[_0x4b4271[_0x1fb1('0x1c')]],'as':_0x4b4271['as'],'attributes':_0x4b4271['attributes'],'include':_0x4b4271[_0x1fb1('0x1a')]?_['map'](_0x4b4271['include'],function(_0x25ac36){return{'model':db[_0x25ac36[_0x1fb1('0x1c')]],'as':_0x25ac36['as'],'attributes':_0x25ac36[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x564ed9){logger[_0x1fb1('0xb')](_0x1fb1('0x1f'),_0x5402e9);logger[_0x1fb1('0x1e')]('ShowFreshsalesAccount',_0x5402e9,JSON[_0x1fb1('0xf')](_0x564ed9));_0x30c8eb(_0x564ed9);})[_0x1fb1('0x13')](function(_0x228235){logger[_0x1fb1('0x10')](_0x1fb1('0x1f'),_0x228235[_0x1fb1('0x12')],_0x5402e9);_0x5d45a5(_0x245f84[_0x1fb1('0x10')](0x1f4,_0x228235['message']));});});}; \ No newline at end of file +var _0x47c5=['include','model','attributes','map','GetFreshsalesAccount','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw'];(function(_0x5e389b,_0x983229){var _0x2d5ac6=function(_0x20de84){while(--_0x20de84){_0x5e389b['push'](_0x5e389b['shift']());}};_0x2d5ac6(++_0x983229);}(_0x47c5,0x165));var _0x547c=function(_0x30b145,_0x5b1406){_0x30b145=_0x30b145-0x0;var _0x5acce4=_0x47c5[_0x30b145];return _0x5acce4;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['GetFreshsalesAccount']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')]({'raw':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options'][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options']['where']||null:null,'attributes':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['attributes']||null:null,'limit':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['limit']||null:null,'include':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')]?_['map'](_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')],function(_0x470694){return{'model':db[_0x470694[_0x547c('0x1d')]],'as':_0x470694['as'],'attributes':_0x470694[_0x547c('0x1e')],'include':_0x470694[_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x470694[_0x547c('0x1c')],function(_0x507895){return{'model':db[_0x507895[_0x547c('0x1d')]],'as':_0x507895['as'],'attributes':_0x507895['attributes'],'include':_0x507895['include']?_['map'](_0x507895['include'],function(_0x2c725d){return{'model':db[_0x2c725d['model']],'as':_0x2c725d['as'],'attributes':_0x2c725d[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea493){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x3ea493));_0xeb059e(_0x3ea493);})[_0x547c('0x17')](function(_0x569924){logger['error'](_0x547c('0x20'),_0x569924['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x569924[_0x547c('0x15')]));});});};exports[_0x547c('0x21')]=function(_0x1695be){var _0x4652e7=this;return new Promise(function(_0x51e6e7,_0x342c10){return db['FreshsalesAccount']['find']({'raw':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x22')]||null:null,'attributes':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1e')]||null:null,'include':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x1695be[_0x547c('0x1a')]['include'],function(_0x3afc28){return{'model':db[_0x3afc28['model']],'as':_0x3afc28['as'],'attributes':_0x3afc28['attributes'],'include':_0x3afc28['include']?_[_0x547c('0x1f')](_0x3afc28[_0x547c('0x1c')],function(_0x31c7d3){return{'model':db[_0x31c7d3[_0x547c('0x1d')]],'as':_0x31c7d3['as'],'attributes':_0x31c7d3[_0x547c('0x1e')],'include':_0x31c7d3[_0x547c('0x1c')]?_['map'](_0x31c7d3['include'],function(_0x5ea2c7){return{'model':db[_0x5ea2c7[_0x547c('0x1d')]],'as':_0x5ea2c7['as'],'attributes':_0x5ea2c7[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x547c('0xc')](function(_0x44687e){logger[_0x547c('0xd')](_0x547c('0x21'),_0x1695be);logger['debug'](_0x547c('0x21'),_0x1695be,JSON['stringify'](_0x44687e));_0x51e6e7(_0x44687e);})[_0x547c('0x17')](function(_0x18fcc5){logger['error'](_0x547c('0x21'),_0x18fcc5['message'],_0x1695be);_0x342c10(_0x4652e7['error'](0x1f4,_0x18fcc5[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 520c105..69135ea 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 _0xbb20=['/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x3f064d,_0x399a17){var _0x1ede9e=function(_0xaa4b98){while(--_0xaa4b98){_0x3f064d['push'](_0x3f064d['shift']());}};_0x1ede9e(++_0x399a17);}(_0xbb20,0x108));var _0x0bb2=function(_0x9cef1f,_0x4dcd48){_0x9cef1f=_0x9cef1f-0x0;var _0x48a2b4=_0xbb20[_0x9cef1f];return _0x48a2b4;};'use strict';var multer=require(_0x0bb2('0x0'));var util=require(_0x0bb2('0x1'));var path=require('path');var timeout=require(_0x0bb2('0x2'));var express=require(_0x0bb2('0x3'));var router=express[_0x0bb2('0x4')]();var fs_extra=require(_0x0bb2('0x5'));var auth=require(_0x0bb2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0bb2('0x7'));var controller=require(_0x0bb2('0x8'));router[_0x0bb2('0x9')]('/',auth[_0x0bb2('0xa')](),controller[_0x0bb2('0xb')]);router[_0x0bb2('0x9')](_0x0bb2('0xc'),auth[_0x0bb2('0xa')](),controller[_0x0bb2('0xd')]);router['get'](_0x0bb2('0xe'),auth['isAuthenticated'](),controller[_0x0bb2('0xf')]);router['get']('/:id/descriptions',auth[_0x0bb2('0xa')](),controller[_0x0bb2('0x10')]);router['get'](_0x0bb2('0x11'),auth[_0x0bb2('0xa')](),controller[_0x0bb2('0x12')]);router[_0x0bb2('0x13')]('/',auth[_0x0bb2('0xa')](),controller['create']);router[_0x0bb2('0x14')](_0x0bb2('0xc'),auth[_0x0bb2('0xa')](),controller['update']);router['delete']('/:id',auth[_0x0bb2('0xa')](),controller[_0x0bb2('0x15')]);module[_0x0bb2('0x16')]=router; \ No newline at end of file +var _0x1815=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1815,0x1c1));var _0x5181=function(_0x329421,_0xd2822d){_0x329421=_0x329421-0x0;var _0x499643=_0x1815[_0x329421];return _0x499643;};'use strict';var multer=require(_0x5181('0x0'));var util=require(_0x5181('0x1'));var path=require(_0x5181('0x2'));var timeout=require(_0x5181('0x3'));var express=require('express');var router=express[_0x5181('0x4')]();var fs_extra=require(_0x5181('0x5'));var auth=require(_0x5181('0x6'));var interaction=require(_0x5181('0x7'));var config=require(_0x5181('0x8'));var controller=require(_0x5181('0x9'));router[_0x5181('0xa')]('/',auth[_0x5181('0xb')](),controller[_0x5181('0xc')]);router[_0x5181('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5181('0xd')]);router[_0x5181('0xa')](_0x5181('0xe'),auth[_0x5181('0xb')](),controller['getSubjects']);router[_0x5181('0xa')](_0x5181('0xf'),auth[_0x5181('0xb')](),controller[_0x5181('0x10')]);router[_0x5181('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x5181('0x11')]('/',auth[_0x5181('0xb')](),controller[_0x5181('0x12')]);router[_0x5181('0x13')](_0x5181('0x14'),auth[_0x5181('0xb')](),controller[_0x5181('0x15')]);router['delete'](_0x5181('0x14'),auth[_0x5181('0xb')](),controller[_0x5181('0x16')]);module[_0x5181('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c717b2f..940d09f 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 _0x498e=['sequelize','exports','STRING'];(function(_0x5b1df3,_0x5e2ec1){var _0xdc412e=function(_0x10236b){while(--_0x10236b){_0x5b1df3['push'](_0x5b1df3['shift']());}};_0xdc412e(++_0x5e2ec1);}(_0x498e,0x18f));var _0xe498=function(_0x1fd33f,_0x166ef6){_0x1fd33f=_0x1fd33f-0x0;var _0x29c82f=_0x498e[_0x1fd33f];return _0x29c82f;};'use strict';var Sequelize=require(_0xe498('0x0'));module[_0xe498('0x1')]={'name':{'type':Sequelize[_0xe498('0x2')]},'description':{'type':Sequelize[_0xe498('0x2')]}}; \ No newline at end of file +var _0x1f2b=['STRING','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1f2b,0x172));var _0xb1f2=function(_0x5324c4,_0x2818a1){_0x5324c4=_0x5324c4-0x0;var _0x5b5422=_0x1f2b[_0x5324c4];return _0x5b5422;};'use strict';var Sequelize=require(_0xb1f2('0x0'));module[_0xb1f2('0x1')]={'name':{'type':Sequelize[_0xb1f2('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 232ab2b..382a183 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 _0xa24a=['getSubjects','findOne','FreshsalesField','order','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','FreshsalesConfiguration','catch','show','params','length','include','find','create','body'];(function(_0x8df7da,_0x496482){var _0x48ecb1=function(_0x2b3a58){while(--_0x2b3a58){_0x8df7da['push'](_0x8df7da['shift']());}};_0x48ecb1(++_0x496482);}(_0xa24a,0xfa));var _0xaa24=function(_0x2ae16f,_0x18c9f0){_0x2ae16f=_0x2ae16f-0x0;var _0x21dfb2=_0xa24a[_0x2ae16f];return _0x21dfb2;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require(_0xaa24('0x1'));var zipdir=require(_0xaa24('0x2'));var jsonpatch=require(_0xaa24('0x3'));var rp=require(_0xaa24('0x4'));var moment=require('moment');var BPromise=require(_0xaa24('0x5'));var Mustache=require(_0xaa24('0x6'));var util=require(_0xaa24('0x7'));var path=require(_0xaa24('0x8'));var sox=require('sox');var csv=require(_0xaa24('0x9'));var ejs=require(_0xaa24('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa24('0xb'));var squel=require(_0xaa24('0xc'));var crypto=require(_0xaa24('0xd'));var jsforce=require(_0xaa24('0xe'));var deskjs=require(_0xaa24('0xf'));var toCsv=require(_0xaa24('0x9'));var querystring=require(_0xaa24('0x10'));var Papa=require(_0xaa24('0x11'));var Redis=require(_0xaa24('0x12'));var authService=require(_0xaa24('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa24('0x15'))(_0xaa24('0x16'));var utils=require(_0xaa24('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaa24('0x18'));var db=require(_0xaa24('0x19'))['db'];function respondWithStatusCode(_0x18353f,_0xad2650){_0xad2650=_0xad2650||0xcc;return function(_0x220ee){if(_0x220ee){return _0x18353f[_0xaa24('0x1a')](_0xad2650);}return _0x18353f['status'](_0xad2650)[_0xaa24('0x1b')]();};}function respondWithResult(_0x5b7307,_0x3dd837){_0x3dd837=_0x3dd837||0xc8;return function(_0x344056){if(_0x344056){return _0x5b7307[_0xaa24('0x1c')](_0x3dd837)[_0xaa24('0x1d')](_0x344056);}};}function respondWithFilteredResult(_0x380199,_0x512bb2){return function(_0xc67898){if(_0xc67898){var _0x130b40=typeof _0x512bb2[_0xaa24('0x1e')]===_0xaa24('0x1f')&&typeof _0x512bb2['limit']===_0xaa24('0x1f');var _0x335465=_0xc67898[_0xaa24('0x20')];var _0x51723d=_0x130b40?0x0:_0x512bb2[_0xaa24('0x1e')];var _0x58b917=_0x130b40?_0xc67898[_0xaa24('0x20')]:_0x512bb2[_0xaa24('0x1e')]+_0x512bb2[_0xaa24('0x21')];var _0x2fc385;if(_0x58b917>=_0x335465){_0x58b917=_0x335465;_0x2fc385=0xc8;}else{_0x2fc385=0xce;}_0x380199[_0xaa24('0x1c')](_0x2fc385);return _0x380199[_0xaa24('0x22')](_0xaa24('0x23'),_0x51723d+'-'+_0x58b917+'/'+_0x335465)[_0xaa24('0x1d')](_0xc67898);}return null;};}function patchUpdates(_0x9611bf){return function(_0x11f0e9){try{jsonpatch['apply'](_0x11f0e9,_0x9611bf,!![]);}catch(_0x3e9203){return BPromise[_0xaa24('0x24')](_0x3e9203);}return _0x11f0e9[_0xaa24('0x25')]();};}function saveUpdates(_0x3b7644,_0x13d044){return function(_0x40c395){if(_0x40c395){return _0x40c395[_0xaa24('0x26')](_0x3b7644)[_0xaa24('0x27')](function(_0x1697c0){return _0x1697c0;});}return null;};}function removeEntity(_0x4413e9,_0x3d693c){return function(_0x4cddb0){if(_0x4cddb0){return _0x4cddb0[_0xaa24('0x28')]()[_0xaa24('0x27')](function(){_0x4413e9[_0xaa24('0x1c')](0xcc)[_0xaa24('0x1b')]();});}};}function handleEntityNotFound(_0x31066c,_0xbedff1){return function(_0x405bbf){if(!_0x405bbf){_0x31066c[_0xaa24('0x1a')](0x194);}return _0x405bbf;};}function handleError(_0x270d6b,_0x5c3fb1){_0x5c3fb1=_0x5c3fb1||0x1f4;return function(_0x3a5590){logger[_0xaa24('0x29')](_0x3a5590[_0xaa24('0x2a')]);if(_0x3a5590[_0xaa24('0x2b')]){delete _0x3a5590[_0xaa24('0x2b')];}_0x270d6b[_0xaa24('0x1c')](_0x5c3fb1)[_0xaa24('0x2c')](_0x3a5590);};}exports['index']=function(_0x1a9756,_0xbade17){var _0x1c96cc={},_0x36a225={},_0x1a648c={'count':0x0,'rows':[]};var _0x2b11b6=_[_0xaa24('0x2d')](db['FreshsalesConfiguration'][_0xaa24('0x2e')],function(_0x239168){return{'name':_0x239168['fieldName'],'type':_0x239168[_0xaa24('0x2f')][_0xaa24('0x30')]};});_0x36a225[_0xaa24('0x31')]=_[_0xaa24('0x2d')](_0x2b11b6,'name');_0x36a225[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x1a9756[_0xaa24('0x32')]);_0x36a225[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x36a225['model'],_0x36a225[_0xaa24('0x32')]);_0x1c96cc[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x36a225[_0xaa24('0x31')],qs[_0xaa24('0x37')](_0x1a9756[_0xaa24('0x32')]['fields']));_0x1c96cc[_0xaa24('0x36')]=_0x1c96cc[_0xaa24('0x36')]['length']?_0x1c96cc[_0xaa24('0x36')]:_0x36a225[_0xaa24('0x31')];if(!_0x1a9756['query']['hasOwnProperty'](_0xaa24('0x38'))){_0x1c96cc[_0xaa24('0x21')]=qs['limit'](_0x1a9756['query'][_0xaa24('0x21')]);_0x1c96cc[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x1a9756[_0xaa24('0x32')][_0xaa24('0x1e')]);}_0x1c96cc['order']=qs[_0xaa24('0x39')](_0x1a9756['query'][_0xaa24('0x39')]);_0x1c96cc[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_[_0xaa24('0x3b')](_0x1a9756[_0xaa24('0x32')],_0x36a225[_0xaa24('0x34')]),_0x2b11b6);if(_0x1a9756[_0xaa24('0x32')][_0xaa24('0x3c')]){_0x1c96cc['where']=_[_0xaa24('0x3d')](_0x1c96cc[_0xaa24('0x3a')],{'$or':_[_0xaa24('0x2d')](_0x2b11b6,function(_0x446a31){if(_0x446a31[_0xaa24('0x2f')]!==_0xaa24('0x3e')){var _0x247a26={};_0x247a26[_0x446a31[_0xaa24('0x2b')]]={'$like':'%'+_0x1a9756[_0xaa24('0x32')][_0xaa24('0x3c')]+'%'};return _0x247a26;}})});}_0x1c96cc=_[_0xaa24('0x3d')]({},_0x1c96cc,_0x1a9756[_0xaa24('0x3f')]);var _0xf4d881={'where':_0x1c96cc['where']};return db['FreshsalesConfiguration'][_0xaa24('0x20')](_0xf4d881)[_0xaa24('0x27')](function(_0x27dc8c){_0x1a648c[_0xaa24('0x20')]=_0x27dc8c;if(_0x1a9756['query'][_0xaa24('0x40')]){_0x1c96cc['include']=[{'all':!![]}];}return db[_0xaa24('0x41')]['findAll'](_0x1c96cc);})['then'](function(_0x2c8938){_0x1a648c['rows']=_0x2c8938;return _0x1a648c;})[_0xaa24('0x27')](respondWithFilteredResult(_0xbade17,_0x1c96cc))[_0xaa24('0x42')](handleError(_0xbade17,null));};exports[_0xaa24('0x43')]=function(_0x52ede9,_0x272e64){var _0x5902b6={'raw':![],'where':{'id':_0x52ede9[_0xaa24('0x44')]['id']}},_0x2c407d={};_0x2c407d['model']=_['keys'](db['FreshsalesConfiguration'][_0xaa24('0x2e')]);_0x2c407d[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x52ede9['query']);_0x2c407d[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x2c407d[_0xaa24('0x31')],_0x2c407d['query']);_0x5902b6[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x2c407d[_0xaa24('0x31')],qs['fields'](_0x52ede9[_0xaa24('0x32')][_0xaa24('0x37')]));_0x5902b6[_0xaa24('0x36')]=_0x5902b6['attributes'][_0xaa24('0x45')]?_0x5902b6['attributes']:_0x2c407d[_0xaa24('0x31')];if(_0x52ede9['query'][_0xaa24('0x40')]){_0x5902b6[_0xaa24('0x46')]=[{'all':!![]}];}_0x5902b6=_[_0xaa24('0x3d')]({},_0x5902b6,_0x52ede9[_0xaa24('0x3f')]);return db[_0xaa24('0x41')][_0xaa24('0x47')](_0x5902b6)[_0xaa24('0x27')](handleEntityNotFound(_0x272e64,null))['then'](respondWithResult(_0x272e64,null))[_0xaa24('0x42')](handleError(_0x272e64,null));};exports[_0xaa24('0x48')]=function(_0x40102c,_0x2e817){return db['FreshsalesConfiguration'][_0xaa24('0x48')](_0x40102c[_0xaa24('0x49')],{})['then'](respondWithResult(_0x2e817,0xc9))[_0xaa24('0x42')](handleError(_0x2e817,null));};exports['update']=function(_0x1b834f,_0x1251ff){if(_0x1b834f['body']['id']){delete _0x1b834f[_0xaa24('0x49')]['id'];}return db[_0xaa24('0x41')][_0xaa24('0x47')]({'where':{'id':_0x1b834f[_0xaa24('0x44')]['id']}})['then'](handleEntityNotFound(_0x1251ff,null))[_0xaa24('0x27')](saveUpdates(_0x1b834f[_0xaa24('0x49')],null))[_0xaa24('0x27')](respondWithResult(_0x1251ff,null))[_0xaa24('0x42')](handleError(_0x1251ff,null));};exports[_0xaa24('0x28')]=function(_0x29db71,_0x260007){return db[_0xaa24('0x41')]['find']({'where':{'id':_0x29db71[_0xaa24('0x44')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0x260007,null))[_0xaa24('0x27')](removeEntity(_0x260007,null))['catch'](handleError(_0x260007,null));};exports[_0xaa24('0x4a')]=function(_0x1f8f78,_0x27f71d,_0x1d525b){var _0x3f783c={};var _0x5df00f={};var _0x1dc340;var _0x5dd4f3;return db[_0xaa24('0x41')][_0xaa24('0x4b')]({'where':{'id':_0x1f8f78[_0xaa24('0x44')]['id']}})[_0xaa24('0x27')](handleEntityNotFound(_0x27f71d,null))[_0xaa24('0x27')](function(_0x289334){if(_0x289334){_0x1dc340=_0x289334;_0x5df00f[_0xaa24('0x31')]=_[_0xaa24('0x33')](db[_0xaa24('0x4c')][_0xaa24('0x2e')]);_0x5df00f['query']=_[_0xaa24('0x33')](_0x1f8f78[_0xaa24('0x32')]);_0x5df00f[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x5df00f['model'],_0x5df00f['query']);_0x3f783c[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x5df00f['model'],qs[_0xaa24('0x37')](_0x1f8f78[_0xaa24('0x32')]['fields']));_0x3f783c['attributes']=_0x3f783c[_0xaa24('0x36')][_0xaa24('0x45')]?_0x3f783c[_0xaa24('0x36')]:_0x5df00f['model'];_0x3f783c[_0xaa24('0x4d')]=qs['sort'](_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x39')]);_0x3f783c[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_[_0xaa24('0x3b')](_0x1f8f78[_0xaa24('0x32')],_0x5df00f[_0xaa24('0x34')]));if(_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x3c')]){_0x3f783c[_0xaa24('0x3a')]=_[_0xaa24('0x3d')](_0x3f783c['where'],{'$or':_[_0xaa24('0x2d')](_0x3f783c[_0xaa24('0x36')],function(_0x5698f0){var _0x3e13a3={};_0x3e13a3[_0x5698f0]={'$like':'%'+_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x3c')]+'%'};return _0x3e13a3;})});}_0x3f783c=_[_0xaa24('0x3d')]({},_0x3f783c,_0x1f8f78[_0xaa24('0x3f')]);return _0x1dc340['getSubjects'](_0x3f783c);}})[_0xaa24('0x27')](function(_0x317eaf){if(_0x317eaf){_0x5dd4f3=_0x317eaf[_0xaa24('0x45')];if(!_0x1f8f78['query'][_0xaa24('0x4e')](_0xaa24('0x38'))){_0x3f783c[_0xaa24('0x21')]=qs[_0xaa24('0x21')](_0x1f8f78['query'][_0xaa24('0x21')]);_0x3f783c[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x1f8f78[_0xaa24('0x32')][_0xaa24('0x1e')]);}return _0x1dc340[_0xaa24('0x4a')](_0x3f783c);}})[_0xaa24('0x27')](function(_0x51f764){if(_0x51f764){return _0x51f764?{'count':_0x5dd4f3,'rows':_0x51f764}:null;}})[_0xaa24('0x27')](respondWithResult(_0x27f71d,null))[_0xaa24('0x42')](handleError(_0x27f71d,null));};exports[_0xaa24('0x4f')]=function(_0x17aeac,_0x30f805,_0x1f31df){var _0x175edd={};var _0x1cf3fa={};var _0x435f71;var _0x4617d4;return db[_0xaa24('0x41')]['findOne']({'where':{'id':_0x17aeac['params']['id']}})['then'](handleEntityNotFound(_0x30f805,null))[_0xaa24('0x27')](function(_0x52ab40){if(_0x52ab40){_0x435f71=_0x52ab40;_0x1cf3fa[_0xaa24('0x31')]=_[_0xaa24('0x33')](db[_0xaa24('0x4c')][_0xaa24('0x2e')]);_0x1cf3fa[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x17aeac[_0xaa24('0x32')]);_0x1cf3fa[_0xaa24('0x34')]=_['intersection'](_0x1cf3fa['model'],_0x1cf3fa['query']);_0x175edd[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x1cf3fa[_0xaa24('0x31')],qs[_0xaa24('0x37')](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x37')]));_0x175edd[_0xaa24('0x36')]=_0x175edd[_0xaa24('0x36')][_0xaa24('0x45')]?_0x175edd['attributes']:_0x1cf3fa[_0xaa24('0x31')];_0x175edd[_0xaa24('0x4d')]=qs[_0xaa24('0x39')](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x39')]);_0x175edd[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_[_0xaa24('0x3b')](_0x17aeac[_0xaa24('0x32')],_0x1cf3fa[_0xaa24('0x34')]));if(_0x17aeac['query'][_0xaa24('0x3c')]){_0x175edd['where']=_[_0xaa24('0x3d')](_0x175edd[_0xaa24('0x3a')],{'$or':_[_0xaa24('0x2d')](_0x175edd[_0xaa24('0x36')],function(_0x29ca87){var _0x4ada29={};_0x4ada29[_0x29ca87]={'$like':'%'+_0x17aeac['query'][_0xaa24('0x3c')]+'%'};return _0x4ada29;})});}_0x175edd=_['merge']({},_0x175edd,_0x17aeac[_0xaa24('0x3f')]);return _0x435f71[_0xaa24('0x4f')](_0x175edd);}})['then'](function(_0x465c39){if(_0x465c39){_0x4617d4=_0x465c39[_0xaa24('0x45')];if(!_0x17aeac['query'][_0xaa24('0x4e')](_0xaa24('0x38'))){_0x175edd[_0xaa24('0x21')]=qs[_0xaa24('0x21')](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x21')]);_0x175edd['offset']=qs['offset'](_0x17aeac[_0xaa24('0x32')][_0xaa24('0x1e')]);}return _0x435f71['getDescriptions'](_0x175edd);}})[_0xaa24('0x27')](function(_0x5dd0ac){if(_0x5dd0ac){return _0x5dd0ac?{'count':_0x4617d4,'rows':_0x5dd0ac}:null;}})[_0xaa24('0x27')](respondWithResult(_0x30f805,null))['catch'](handleError(_0x30f805,null));};exports[_0xaa24('0x50')]=function(_0x24f340,_0xa7596f,_0x25c2e9){var _0x33831c={};var _0x4e2481={};var _0xb860b2;var _0x5e8cda;return db[_0xaa24('0x41')][_0xaa24('0x4b')]({'where':{'id':_0x24f340[_0xaa24('0x44')]['id']}})['then'](handleEntityNotFound(_0xa7596f,null))[_0xaa24('0x27')](function(_0x18d0a4){if(_0x18d0a4){_0xb860b2=_0x18d0a4;_0x4e2481[_0xaa24('0x31')]=_[_0xaa24('0x33')](db[_0xaa24('0x4c')]['rawAttributes']);_0x4e2481[_0xaa24('0x32')]=_[_0xaa24('0x33')](_0x24f340[_0xaa24('0x32')]);_0x4e2481[_0xaa24('0x34')]=_[_0xaa24('0x35')](_0x4e2481[_0xaa24('0x31')],_0x4e2481[_0xaa24('0x32')]);_0x33831c[_0xaa24('0x36')]=_[_0xaa24('0x35')](_0x4e2481[_0xaa24('0x31')],qs[_0xaa24('0x37')](_0x24f340[_0xaa24('0x32')][_0xaa24('0x37')]));_0x33831c['attributes']=_0x33831c[_0xaa24('0x36')]['length']?_0x33831c[_0xaa24('0x36')]:_0x4e2481[_0xaa24('0x31')];_0x33831c[_0xaa24('0x4d')]=qs[_0xaa24('0x39')](_0x24f340['query'][_0xaa24('0x39')]);_0x33831c[_0xaa24('0x3a')]=qs[_0xaa24('0x34')](_['pick'](_0x24f340['query'],_0x4e2481[_0xaa24('0x34')]));if(_0x24f340[_0xaa24('0x32')][_0xaa24('0x3c')]){_0x33831c[_0xaa24('0x3a')]=_['merge'](_0x33831c[_0xaa24('0x3a')],{'$or':_[_0xaa24('0x2d')](_0x33831c[_0xaa24('0x36')],function(_0x42fa7a){var _0x1e21c6={};_0x1e21c6[_0x42fa7a]={'$like':'%'+_0x24f340[_0xaa24('0x32')][_0xaa24('0x3c')]+'%'};return _0x1e21c6;})});}_0x33831c=_['merge']({},_0x33831c,_0x24f340['options']);return _0xb860b2['getFields'](_0x33831c);}})[_0xaa24('0x27')](function(_0xfbd2e1){if(_0xfbd2e1){_0x5e8cda=_0xfbd2e1['length'];if(!_0x24f340['query'][_0xaa24('0x4e')](_0xaa24('0x38'))){_0x33831c[_0xaa24('0x21')]=qs[_0xaa24('0x21')](_0x24f340[_0xaa24('0x32')][_0xaa24('0x21')]);_0x33831c[_0xaa24('0x1e')]=qs[_0xaa24('0x1e')](_0x24f340[_0xaa24('0x32')][_0xaa24('0x1e')]);}return _0xb860b2[_0xaa24('0x50')](_0x33831c);}})[_0xaa24('0x27')](function(_0x3621de){if(_0x3621de){return _0x3621de?{'count':_0x5e8cda,'rows':_0x3621de}:null;}})[_0xaa24('0x27')](respondWithResult(_0xa7596f,null))[_0xaa24('0x42')](handleError(_0xa7596f,null));}; \ No newline at end of file +var _0x86ee=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','params','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','eml-format','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','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','set','Content-Range','json','reject','save','update','then','destroy','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x54ce9b,_0x594141){var _0x3c284b=function(_0x346f4b){while(--_0x346f4b){_0x54ce9b['push'](_0x54ce9b['shift']());}};_0x3c284b(++_0x594141);}(_0x86ee,0x154));var _0xe86e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x86ee[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0xe86e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe86e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe86e('0x2'));var moment=require('moment');var BPromise=require(_0xe86e('0x3'));var Mustache=require('mustache');var util=require(_0xe86e('0x4'));var path=require(_0xe86e('0x5'));var sox=require(_0xe86e('0x6'));var csv=require('to-csv');var ejs=require(_0xe86e('0x7'));var fs=require('fs');var fs_extra=require(_0xe86e('0x8'));var _=require(_0xe86e('0x9'));var squel=require(_0xe86e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe86e('0xb'));var toCsv=require(_0xe86e('0xc'));var querystring=require('querystring');var Papa=require(_0xe86e('0xd'));var Redis=require(_0xe86e('0xe'));var authService=require(_0xe86e('0xf'));var qs=require(_0xe86e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe86e('0x11'));var logger=require(_0xe86e('0x12'))(_0xe86e('0x13'));var utils=require(_0xe86e('0x14'));var config=require(_0xe86e('0x15'));var licenseUtil=require(_0xe86e('0x16'));var db=require(_0xe86e('0x17'))['db'];function respondWithStatusCode(_0x2aae54,_0x593d1f){_0x593d1f=_0x593d1f||0xcc;return function(_0x335125){if(_0x335125){return _0x2aae54[_0xe86e('0x18')](_0x593d1f);}return _0x2aae54[_0xe86e('0x19')](_0x593d1f)[_0xe86e('0x1a')]();};}function respondWithResult(_0x5b31b5,_0x56a773){_0x56a773=_0x56a773||0xc8;return function(_0x23e074){if(_0x23e074){return _0x5b31b5[_0xe86e('0x19')](_0x56a773)['json'](_0x23e074);}};}function respondWithFilteredResult(_0x116df4,_0x5d965a){return function(_0x19966f){if(_0x19966f){var _0x171804=typeof _0x5d965a[_0xe86e('0x1b')]===_0xe86e('0x1c')&&typeof _0x5d965a[_0xe86e('0x1d')]===_0xe86e('0x1c');var _0x179249=_0x19966f[_0xe86e('0x1e')];var _0x4b2fc8=_0x171804?0x0:_0x5d965a[_0xe86e('0x1b')];var _0x17db6e=_0x171804?_0x19966f[_0xe86e('0x1e')]:_0x5d965a[_0xe86e('0x1b')]+_0x5d965a[_0xe86e('0x1d')];var _0xcc85;if(_0x17db6e>=_0x179249){_0x17db6e=_0x179249;_0xcc85=0xc8;}else{_0xcc85=0xce;}_0x116df4['status'](_0xcc85);return _0x116df4[_0xe86e('0x1f')](_0xe86e('0x20'),_0x4b2fc8+'-'+_0x17db6e+'/'+_0x179249)[_0xe86e('0x21')](_0x19966f);}return null;};}function patchUpdates(_0x6e3d67){return function(_0x431175){try{jsonpatch['apply'](_0x431175,_0x6e3d67,!![]);}catch(_0x10d30f){return BPromise[_0xe86e('0x22')](_0x10d30f);}return _0x431175[_0xe86e('0x23')]();};}function saveUpdates(_0x373a61,_0x3c49df){return function(_0x49ab88){if(_0x49ab88){return _0x49ab88[_0xe86e('0x24')](_0x373a61)[_0xe86e('0x25')](function(_0x2cac7a){return _0x2cac7a;});}return null;};}function removeEntity(_0xacaec2,_0x44b9fe){return function(_0x190066){if(_0x190066){return _0x190066[_0xe86e('0x26')]()[_0xe86e('0x25')](function(){_0xacaec2[_0xe86e('0x19')](0xcc)[_0xe86e('0x1a')]();});}};}function handleEntityNotFound(_0x2c54ac,_0x449b85){return function(_0x2127e2){if(!_0x2127e2){_0x2c54ac[_0xe86e('0x18')](0x194);}return _0x2127e2;};}function handleError(_0x361c5d,_0x16f543){_0x16f543=_0x16f543||0x1f4;return function(_0xc4123){logger['error'](_0xc4123['stack']);if(_0xc4123[_0xe86e('0x27')]){delete _0xc4123['name'];}_0x361c5d['status'](_0x16f543)[_0xe86e('0x28')](_0xc4123);};}exports['index']=function(_0x32adf8,_0x58d98b){var _0x564202={},_0x257fd7={},_0x50f4ae={'count':0x0,'rows':[]};var _0x55e32d=_[_0xe86e('0x29')](db[_0xe86e('0x2a')][_0xe86e('0x2b')],function(_0x32cff7){return{'name':_0x32cff7[_0xe86e('0x2c')],'type':_0x32cff7[_0xe86e('0x2d')][_0xe86e('0x2e')]};});_0x257fd7[_0xe86e('0x2f')]=_[_0xe86e('0x29')](_0x55e32d,'name');_0x257fd7['query']=_[_0xe86e('0x30')](_0x32adf8[_0xe86e('0x31')]);_0x257fd7[_0xe86e('0x32')]=_[_0xe86e('0x33')](_0x257fd7[_0xe86e('0x2f')],_0x257fd7[_0xe86e('0x31')]);_0x564202[_0xe86e('0x34')]=_[_0xe86e('0x33')](_0x257fd7[_0xe86e('0x2f')],qs[_0xe86e('0x35')](_0x32adf8[_0xe86e('0x31')][_0xe86e('0x35')]));_0x564202[_0xe86e('0x34')]=_0x564202['attributes'][_0xe86e('0x36')]?_0x564202[_0xe86e('0x34')]:_0x257fd7[_0xe86e('0x2f')];if(!_0x32adf8[_0xe86e('0x31')][_0xe86e('0x37')](_0xe86e('0x38'))){_0x564202[_0xe86e('0x1d')]=qs[_0xe86e('0x1d')](_0x32adf8['query']['limit']);_0x564202[_0xe86e('0x1b')]=qs[_0xe86e('0x1b')](_0x32adf8[_0xe86e('0x31')]['offset']);}_0x564202['order']=qs[_0xe86e('0x39')](_0x32adf8[_0xe86e('0x31')][_0xe86e('0x39')]);_0x564202[_0xe86e('0x3a')]=qs[_0xe86e('0x32')](_[_0xe86e('0x3b')](_0x32adf8[_0xe86e('0x31')],_0x257fd7['filters']),_0x55e32d);if(_0x32adf8[_0xe86e('0x31')][_0xe86e('0x3c')]){_0x564202[_0xe86e('0x3a')]=_[_0xe86e('0x3d')](_0x564202[_0xe86e('0x3a')],{'$or':_[_0xe86e('0x29')](_0x55e32d,function(_0x4695a8){if(_0x4695a8[_0xe86e('0x2d')]!==_0xe86e('0x3e')){var _0x349ff3={};_0x349ff3[_0x4695a8[_0xe86e('0x27')]]={'$like':'%'+_0x32adf8[_0xe86e('0x31')]['filter']+'%'};return _0x349ff3;}})});}_0x564202=_[_0xe86e('0x3d')]({},_0x564202,_0x32adf8[_0xe86e('0x3f')]);var _0x4ddd76={'where':_0x564202[_0xe86e('0x3a')]};return db[_0xe86e('0x2a')][_0xe86e('0x1e')](_0x4ddd76)['then'](function(_0xdccd49){_0x50f4ae[_0xe86e('0x1e')]=_0xdccd49;if(_0x32adf8[_0xe86e('0x31')][_0xe86e('0x40')]){_0x564202[_0xe86e('0x41')]=[{'all':!![]}];}return db[_0xe86e('0x2a')]['findAll'](_0x564202);})['then'](function(_0x245a90){_0x50f4ae[_0xe86e('0x42')]=_0x245a90;return _0x50f4ae;})['then'](respondWithFilteredResult(_0x58d98b,_0x564202))[_0xe86e('0x43')](handleError(_0x58d98b,null));};exports['show']=function(_0x369dc0,_0x3c9684){var _0x32f0ff={'raw':![],'where':{'id':_0x369dc0['params']['id']}},_0x11fe7f={};_0x11fe7f[_0xe86e('0x2f')]=_[_0xe86e('0x30')](db[_0xe86e('0x2a')][_0xe86e('0x2b')]);_0x11fe7f[_0xe86e('0x31')]=_[_0xe86e('0x30')](_0x369dc0['query']);_0x11fe7f[_0xe86e('0x32')]=_['intersection'](_0x11fe7f[_0xe86e('0x2f')],_0x11fe7f[_0xe86e('0x31')]);_0x32f0ff['attributes']=_[_0xe86e('0x33')](_0x11fe7f['model'],qs[_0xe86e('0x35')](_0x369dc0[_0xe86e('0x31')][_0xe86e('0x35')]));_0x32f0ff['attributes']=_0x32f0ff['attributes'][_0xe86e('0x36')]?_0x32f0ff[_0xe86e('0x34')]:_0x11fe7f['model'];if(_0x369dc0['query']['includeAll']){_0x32f0ff[_0xe86e('0x41')]=[{'all':!![]}];}_0x32f0ff=_['merge']({},_0x32f0ff,_0x369dc0[_0xe86e('0x3f')]);return db[_0xe86e('0x2a')][_0xe86e('0x44')](_0x32f0ff)['then'](handleEntityNotFound(_0x3c9684,null))[_0xe86e('0x25')](respondWithResult(_0x3c9684,null))[_0xe86e('0x43')](handleError(_0x3c9684,null));};exports[_0xe86e('0x45')]=function(_0x3be67a,_0x45bcb4){return db[_0xe86e('0x2a')][_0xe86e('0x45')](_0x3be67a['body'],{})[_0xe86e('0x25')](respondWithResult(_0x45bcb4,0xc9))[_0xe86e('0x43')](handleError(_0x45bcb4,null));};exports[_0xe86e('0x24')]=function(_0x2d3a96,_0x21bf2a){if(_0x2d3a96[_0xe86e('0x46')]['id']){delete _0x2d3a96[_0xe86e('0x46')]['id'];}return db[_0xe86e('0x2a')]['find']({'where':{'id':_0x2d3a96[_0xe86e('0x47')]['id']}})[_0xe86e('0x25')](handleEntityNotFound(_0x21bf2a,null))[_0xe86e('0x25')](saveUpdates(_0x2d3a96[_0xe86e('0x46')],null))[_0xe86e('0x25')](respondWithResult(_0x21bf2a,null))['catch'](handleError(_0x21bf2a,null));};exports['destroy']=function(_0x589b21,_0x4c2e7f){return db[_0xe86e('0x2a')][_0xe86e('0x44')]({'where':{'id':_0x589b21[_0xe86e('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c2e7f,null))[_0xe86e('0x25')](removeEntity(_0x4c2e7f,null))[_0xe86e('0x43')](handleError(_0x4c2e7f,null));};exports[_0xe86e('0x48')]=function(_0x100ae3,_0x499202,_0x521896){var _0x4b713c={};var _0x3eff40={};var _0x24c0d5;var _0x3463c0;return db[_0xe86e('0x2a')][_0xe86e('0x49')]({'where':{'id':_0x100ae3[_0xe86e('0x47')]['id']}})[_0xe86e('0x25')](handleEntityNotFound(_0x499202,null))[_0xe86e('0x25')](function(_0x343114){if(_0x343114){_0x24c0d5=_0x343114;_0x3eff40[_0xe86e('0x2f')]=_['keys'](db[_0xe86e('0x4a')][_0xe86e('0x2b')]);_0x3eff40['query']=_['keys'](_0x100ae3[_0xe86e('0x31')]);_0x3eff40['filters']=_[_0xe86e('0x33')](_0x3eff40['model'],_0x3eff40[_0xe86e('0x31')]);_0x4b713c[_0xe86e('0x34')]=_['intersection'](_0x3eff40[_0xe86e('0x2f')],qs[_0xe86e('0x35')](_0x100ae3['query'][_0xe86e('0x35')]));_0x4b713c[_0xe86e('0x34')]=_0x4b713c['attributes'][_0xe86e('0x36')]?_0x4b713c[_0xe86e('0x34')]:_0x3eff40[_0xe86e('0x2f')];_0x4b713c[_0xe86e('0x4b')]=qs['sort'](_0x100ae3[_0xe86e('0x31')][_0xe86e('0x39')]);_0x4b713c[_0xe86e('0x3a')]=qs[_0xe86e('0x32')](_[_0xe86e('0x3b')](_0x100ae3[_0xe86e('0x31')],_0x3eff40[_0xe86e('0x32')]));if(_0x100ae3['query'][_0xe86e('0x3c')]){_0x4b713c[_0xe86e('0x3a')]=_[_0xe86e('0x3d')](_0x4b713c[_0xe86e('0x3a')],{'$or':_[_0xe86e('0x29')](_0x4b713c[_0xe86e('0x34')],function(_0x434469){var _0x51a7a7={};_0x51a7a7[_0x434469]={'$like':'%'+_0x100ae3[_0xe86e('0x31')][_0xe86e('0x3c')]+'%'};return _0x51a7a7;})});}_0x4b713c=_[_0xe86e('0x3d')]({},_0x4b713c,_0x100ae3[_0xe86e('0x3f')]);return _0x24c0d5[_0xe86e('0x48')](_0x4b713c);}})[_0xe86e('0x25')](function(_0x3e1f8b){if(_0x3e1f8b){_0x3463c0=_0x3e1f8b[_0xe86e('0x36')];if(!_0x100ae3[_0xe86e('0x31')][_0xe86e('0x37')](_0xe86e('0x38'))){_0x4b713c[_0xe86e('0x1d')]=qs['limit'](_0x100ae3['query'][_0xe86e('0x1d')]);_0x4b713c['offset']=qs[_0xe86e('0x1b')](_0x100ae3['query'][_0xe86e('0x1b')]);}return _0x24c0d5[_0xe86e('0x48')](_0x4b713c);}})['then'](function(_0x2ffdd6){if(_0x2ffdd6){return _0x2ffdd6?{'count':_0x3463c0,'rows':_0x2ffdd6}:null;}})[_0xe86e('0x25')](respondWithResult(_0x499202,null))[_0xe86e('0x43')](handleError(_0x499202,null));};exports['getDescriptions']=function(_0x39e2f2,_0x84b423,_0x3932be){var _0x38f430={};var _0x2d32f2={};var _0x207758;var _0x1550bf;return db[_0xe86e('0x2a')][_0xe86e('0x49')]({'where':{'id':_0x39e2f2[_0xe86e('0x47')]['id']}})['then'](handleEntityNotFound(_0x84b423,null))[_0xe86e('0x25')](function(_0x427486){if(_0x427486){_0x207758=_0x427486;_0x2d32f2['model']=_[_0xe86e('0x30')](db[_0xe86e('0x4a')][_0xe86e('0x2b')]);_0x2d32f2[_0xe86e('0x31')]=_[_0xe86e('0x30')](_0x39e2f2[_0xe86e('0x31')]);_0x2d32f2[_0xe86e('0x32')]=_[_0xe86e('0x33')](_0x2d32f2[_0xe86e('0x2f')],_0x2d32f2[_0xe86e('0x31')]);_0x38f430[_0xe86e('0x34')]=_[_0xe86e('0x33')](_0x2d32f2[_0xe86e('0x2f')],qs[_0xe86e('0x35')](_0x39e2f2['query'][_0xe86e('0x35')]));_0x38f430[_0xe86e('0x34')]=_0x38f430[_0xe86e('0x34')][_0xe86e('0x36')]?_0x38f430[_0xe86e('0x34')]:_0x2d32f2[_0xe86e('0x2f')];_0x38f430[_0xe86e('0x4b')]=qs['sort'](_0x39e2f2[_0xe86e('0x31')][_0xe86e('0x39')]);_0x38f430[_0xe86e('0x3a')]=qs['filters'](_[_0xe86e('0x3b')](_0x39e2f2['query'],_0x2d32f2[_0xe86e('0x32')]));if(_0x39e2f2['query'][_0xe86e('0x3c')]){_0x38f430[_0xe86e('0x3a')]=_[_0xe86e('0x3d')](_0x38f430['where'],{'$or':_[_0xe86e('0x29')](_0x38f430[_0xe86e('0x34')],function(_0x3b6da9){var _0x2bac2a={};_0x2bac2a[_0x3b6da9]={'$like':'%'+_0x39e2f2[_0xe86e('0x31')][_0xe86e('0x3c')]+'%'};return _0x2bac2a;})});}_0x38f430=_[_0xe86e('0x3d')]({},_0x38f430,_0x39e2f2[_0xe86e('0x3f')]);return _0x207758[_0xe86e('0x4c')](_0x38f430);}})[_0xe86e('0x25')](function(_0x29994c){if(_0x29994c){_0x1550bf=_0x29994c[_0xe86e('0x36')];if(!_0x39e2f2[_0xe86e('0x31')][_0xe86e('0x37')](_0xe86e('0x38'))){_0x38f430['limit']=qs[_0xe86e('0x1d')](_0x39e2f2[_0xe86e('0x31')][_0xe86e('0x1d')]);_0x38f430[_0xe86e('0x1b')]=qs['offset'](_0x39e2f2[_0xe86e('0x31')][_0xe86e('0x1b')]);}return _0x207758[_0xe86e('0x4c')](_0x38f430);}})[_0xe86e('0x25')](function(_0x4961e4){if(_0x4961e4){return _0x4961e4?{'count':_0x1550bf,'rows':_0x4961e4}:null;}})['then'](respondWithResult(_0x84b423,null))['catch'](handleError(_0x84b423,null));};exports['getFields']=function(_0x577279,_0x1de6ed,_0x5f0785){var _0x4678ce={};var _0x2ce13a={};var _0xaca984;var _0x205be9;return db[_0xe86e('0x2a')][_0xe86e('0x49')]({'where':{'id':_0x577279[_0xe86e('0x47')]['id']}})[_0xe86e('0x25')](handleEntityNotFound(_0x1de6ed,null))[_0xe86e('0x25')](function(_0x289d5d){if(_0x289d5d){_0xaca984=_0x289d5d;_0x2ce13a[_0xe86e('0x2f')]=_[_0xe86e('0x30')](db[_0xe86e('0x4a')][_0xe86e('0x2b')]);_0x2ce13a[_0xe86e('0x31')]=_['keys'](_0x577279[_0xe86e('0x31')]);_0x2ce13a[_0xe86e('0x32')]=_[_0xe86e('0x33')](_0x2ce13a[_0xe86e('0x2f')],_0x2ce13a[_0xe86e('0x31')]);_0x4678ce[_0xe86e('0x34')]=_['intersection'](_0x2ce13a['model'],qs[_0xe86e('0x35')](_0x577279[_0xe86e('0x31')]['fields']));_0x4678ce['attributes']=_0x4678ce[_0xe86e('0x34')][_0xe86e('0x36')]?_0x4678ce[_0xe86e('0x34')]:_0x2ce13a[_0xe86e('0x2f')];_0x4678ce[_0xe86e('0x4b')]=qs[_0xe86e('0x39')](_0x577279[_0xe86e('0x31')][_0xe86e('0x39')]);_0x4678ce[_0xe86e('0x3a')]=qs['filters'](_[_0xe86e('0x3b')](_0x577279[_0xe86e('0x31')],_0x2ce13a[_0xe86e('0x32')]));if(_0x577279[_0xe86e('0x31')][_0xe86e('0x3c')]){_0x4678ce[_0xe86e('0x3a')]=_[_0xe86e('0x3d')](_0x4678ce['where'],{'$or':_['map'](_0x4678ce[_0xe86e('0x34')],function(_0x85c47){var _0x12cad4={};_0x12cad4[_0x85c47]={'$like':'%'+_0x577279[_0xe86e('0x31')][_0xe86e('0x3c')]+'%'};return _0x12cad4;})});}_0x4678ce=_[_0xe86e('0x3d')]({},_0x4678ce,_0x577279[_0xe86e('0x3f')]);return _0xaca984[_0xe86e('0x4d')](_0x4678ce);}})['then'](function(_0x38a165){if(_0x38a165){_0x205be9=_0x38a165[_0xe86e('0x36')];if(!_0x577279[_0xe86e('0x31')][_0xe86e('0x37')](_0xe86e('0x38'))){_0x4678ce['limit']=qs[_0xe86e('0x1d')](_0x577279[_0xe86e('0x31')]['limit']);_0x4678ce[_0xe86e('0x1b')]=qs[_0xe86e('0x1b')](_0x577279['query'][_0xe86e('0x1b')]);}return _0xaca984[_0xe86e('0x4d')](_0x4678ce);}})['then'](function(_0x5724c2){if(_0x5724c2){return _0x5724c2?{'count':_0x205be9,'rows':_0x5724c2}:null;}})[_0xe86e('0x25')](respondWithResult(_0x1de6ed,null))[_0xe86e('0x43')](handleError(_0x1de6ed,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1e28837..82c6814 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 _0x4639=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','lodash'];(function(_0x3cba84,_0x51f496){var _0x14af6c=function(_0x4956c1){while(--_0x4956c1){_0x3cba84['push'](_0x3cba84['shift']());}};_0x14af6c(++_0x51f496);}(_0x4639,0x149));var _0x9463=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0x4639[_0x11b19b];return _0x1daac1;};'use strict';var _=require(_0x9463('0x0'));var util=require(_0x9463('0x1'));var logger=require(_0x9463('0x2'))(_0x9463('0x3'));var moment=require(_0x9463('0x4'));var BPromise=require('bluebird');var rp=require(_0x9463('0x5'));var fs=require('fs');var path=require(_0x9463('0x6'));var rimraf=require(_0x9463('0x7'));var config=require(_0x9463('0x8'));var attributes=require(_0x9463('0x9'));module['exports']=function(_0x2eb5d9,_0x554147){return _0x2eb5d9['define'](_0x9463('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30c4=['moment','bluebird','request-promise','path','../../config/environment','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api'];(function(_0x199c25,_0x15b0b0){var _0x2eda27=function(_0x4957c5){while(--_0x4957c5){_0x199c25['push'](_0x199c25['shift']());}};_0x2eda27(++_0x15b0b0);}(_0x30c4,0x188));var _0x430c=function(_0x3959e7,_0x47dfc5){_0x3959e7=_0x3959e7-0x0;var _0x379e74=_0x30c4[_0x3959e7];return _0x379e74;};'use strict';var _=require(_0x430c('0x0'));var util=require(_0x430c('0x1'));var logger=require(_0x430c('0x2'))(_0x430c('0x3'));var moment=require(_0x430c('0x4'));var BPromise=require(_0x430c('0x5'));var rp=require(_0x430c('0x6'));var fs=require('fs');var path=require(_0x430c('0x7'));var rimraf=require('rimraf');var config=require(_0x430c('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x35574e,_0x1f3150){return _0x35574e['define'](_0x430c('0x9'),attributes,{'tableName':_0x430c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index a385a23..13a1b44 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 _0xd550=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request'];(function(_0xc4a9b6,_0x225fdf){var _0x2d5a1a=function(_0x1d4b85){while(--_0x1d4b85){_0xc4a9b6['push'](_0xc4a9b6['shift']());}};_0x2d5a1a(++_0x225fdf);}(_0xd550,0x19a));var _0x0d55=function(_0x250aae,_0x121256){_0x250aae=_0x250aae-0x0;var _0x372cfe=_0xd550[_0x250aae];return _0x372cfe;};'use strict';var _=require(_0x0d55('0x0'));var util=require(_0x0d55('0x1'));var moment=require(_0x0d55('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d55('0x3'));var fs=require('fs');var Redis=require(_0x0d55('0x4'));var db=require(_0x0d55('0x5'))['db'];var utils=require(_0x0d55('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0d55('0x7'));var jayson=require(_0x0d55('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14d8e5,_0x1f10e7,_0x251516){return new BPromise(function(_0x5475ae,_0x514ae1){return client[_0x0d55('0x9')](_0x14d8e5,_0x251516)[_0x0d55('0xa')](function(_0xce08c8){logger[_0x0d55('0xb')](_0x0d55('0xc'),_0x1f10e7,'request\x20sent');logger[_0x0d55('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1f10e7,'request\x20sent',JSON[_0x0d55('0xe')](_0xce08c8));if(_0xce08c8[_0x0d55('0xf')]){if(_0xce08c8[_0x0d55('0xf')][_0x0d55('0x10')]===0x1f4){logger[_0x0d55('0xf')](_0x0d55('0xc'),_0x1f10e7,_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);return _0x514ae1(_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);}logger['error'](_0x0d55('0xc'),_0x1f10e7,_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);return _0x5475ae(_0xce08c8[_0x0d55('0xf')][_0x0d55('0x11')]);}else{logger['info'](_0x0d55('0xc'),_0x1f10e7,_0x0d55('0x12'));_0x5475ae(_0xce08c8[_0x0d55('0x13')]['message']);}})[_0x0d55('0x14')](function(_0x33c2cb){logger[_0x0d55('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1f10e7,_0x33c2cb);_0x514ae1(_0x33c2cb);});});} \ No newline at end of file +var _0x900e=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x4fd5ba,_0xec40d4){var _0x32d05f=function(_0x233a91){while(--_0x233a91){_0x4fd5ba['push'](_0x4fd5ba['shift']());}};_0x32d05f(++_0xec40d4);}(_0x900e,0x1be));var _0xe900=function(_0x28a465,_0x558c2c){_0x28a465=_0x28a465-0x0;var _0x258386=_0x900e[_0x28a465];return _0x258386;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe900('0x0'));var BPromise=require(_0xe900('0x1'));var rs=require(_0xe900('0x2'));var fs=require('fs');var Redis=require(_0xe900('0x3'));var db=require(_0xe900('0x4'))['db'];var utils=require(_0xe900('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe900('0x6'));var jayson=require(_0xe900('0x7'));var client=jayson[_0xe900('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5279d,_0x246667,_0x4aca36){return new BPromise(function(_0x364446,_0x20a6b9){return client[_0xe900('0x9')](_0xc5279d,_0x4aca36)[_0xe900('0xa')](function(_0x4baf43){logger[_0xe900('0xb')](_0xe900('0xc'),_0x246667,_0xe900('0xd'));logger['debug'](_0xe900('0xe'),_0x246667,_0xe900('0xd'),JSON[_0xe900('0xf')](_0x4baf43));if(_0x4baf43['error']){if(_0x4baf43[_0xe900('0x10')]['code']===0x1f4){logger[_0xe900('0x10')](_0xe900('0xc'),_0x246667,_0x4baf43[_0xe900('0x10')][_0xe900('0x11')]);return _0x20a6b9(_0x4baf43[_0xe900('0x10')][_0xe900('0x11')]);}logger['error'](_0xe900('0xc'),_0x246667,_0x4baf43[_0xe900('0x10')][_0xe900('0x11')]);return _0x364446(_0x4baf43[_0xe900('0x10')][_0xe900('0x11')]);}else{logger[_0xe900('0xb')](_0xe900('0xc'),_0x246667,'request\x20sent');_0x364446(_0x4baf43['result']['message']);}})[_0xe900('0x12')](function(_0x383a9b){logger[_0xe900('0x10')](_0xe900('0xc'),_0x246667,_0x383a9b);_0x20a6b9(_0x383a9b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d693c76..048f213 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 _0xae7b=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x31d851,_0xe7aa05){var _0x5f1487=function(_0xa2d5e5){while(--_0xa2d5e5){_0x31d851['push'](_0x31d851['shift']());}};_0x5f1487(++_0xe7aa05);}(_0xae7b,0xbe));var _0xbae7=function(_0x35ae71,_0x21b2b6){_0x35ae71=_0x35ae71-0x0;var _0x23aacf=_0xae7b[_0x35ae71];return _0x23aacf;};'use strict';var multer=require(_0xbae7('0x0'));var util=require(_0xbae7('0x1'));var path=require(_0xbae7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbae7('0x3')]();var fs_extra=require(_0xbae7('0x4'));var auth=require(_0xbae7('0x5'));var interaction=require(_0xbae7('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0xbae7('0x7')]('/',auth[_0xbae7('0x8')](),controller[_0xbae7('0x9')]);router['get'](_0xbae7('0xa'),auth['isAuthenticated'](),controller[_0xbae7('0xb')]);router[_0xbae7('0xc')]('/',auth[_0xbae7('0x8')](),controller['create']);router[_0xbae7('0xd')]('/:id',auth[_0xbae7('0x8')](),controller[_0xbae7('0xe')]);router[_0xbae7('0xf')](_0xbae7('0xa'),auth['isAuthenticated'](),controller[_0xbae7('0x10')]);module[_0xbae7('0x11')]=router; \ No newline at end of file +var _0x9990=['get','isAuthenticated','/:id','show','post','create','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller'];(function(_0x5e499e,_0x1cba3e){var _0x2a12e7=function(_0x4b75de){while(--_0x4b75de){_0x5e499e['push'](_0x5e499e['shift']());}};_0x2a12e7(++_0x1cba3e);}(_0x9990,0xf6));var _0x0999=function(_0x462fc9,_0x355e35){_0x462fc9=_0x462fc9-0x0;var _0x240ef1=_0x9990[_0x462fc9];return _0x240ef1;};'use strict';var multer=require('multer');var util=require(_0x0999('0x0'));var path=require(_0x0999('0x1'));var timeout=require(_0x0999('0x2'));var express=require(_0x0999('0x3'));var router=express[_0x0999('0x4')]();var fs_extra=require(_0x0999('0x5'));var auth=require(_0x0999('0x6'));var interaction=require(_0x0999('0x7'));var config=require('../../config/environment');var controller=require(_0x0999('0x8'));router[_0x0999('0x9')]('/',auth[_0x0999('0xa')](),controller['index']);router[_0x0999('0x9')](_0x0999('0xb'),auth[_0x0999('0xa')](),controller[_0x0999('0xc')]);router[_0x0999('0xd')]('/',auth[_0x0999('0xa')](),controller[_0x0999('0xe')]);router['put'](_0x0999('0xb'),auth[_0x0999('0xa')](),controller[_0x0999('0xf')]);router['delete'](_0x0999('0xb'),auth[_0x0999('0xa')](),controller[_0x0999('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index de04749..d5be3cb 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 _0xea18=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x8a80a3,_0x5f4c6a){var _0x3c06fc=function(_0x5d2f60){while(--_0x5d2f60){_0x8a80a3['push'](_0x8a80a3['shift']());}};_0x3c06fc(++_0x5f4c6a);}(_0xea18,0x7b));var _0x8ea1=function(_0x4d2eb4,_0x5defa3){_0x4d2eb4=_0x4d2eb4-0x0;var _0x3c2552=_0xea18[_0x4d2eb4];return _0x3c2552;};'use strict';var Sequelize=require('sequelize');module[_0x8ea1('0x0')]={'type':{'type':Sequelize[_0x8ea1('0x1')](_0x8ea1('0x2'),_0x8ea1('0x3'),'customVariable',_0x8ea1('0x4'),_0x8ea1('0x5')),'defaultValue':_0x8ea1('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8ea1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8ea1('0x2'),_0x8ea1('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8ea1('0x6')]},'customField':{'type':Sequelize[_0x8ea1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ea1('0x6')]}}; \ No newline at end of file +var _0xca97=['string','variable','customVariable','picklist','STRING','sequelize','ENUM'];(function(_0x46baf8,_0x20a7c0){var _0x3373cc=function(_0xa022dd){while(--_0xa022dd){_0x46baf8['push'](_0x46baf8['shift']());}};_0x3373cc(++_0x20a7c0);}(_0xca97,0x7c));var _0x7ca9=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xca97[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x7ca9('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ca9('0x1')](_0x7ca9('0x2'),_0x7ca9('0x3'),_0x7ca9('0x4'),'keyValue',_0x7ca9('0x5')),'defaultValue':_0x7ca9('0x2')},'content':{'type':Sequelize[_0x7ca9('0x6')]},'key':{'type':Sequelize[_0x7ca9('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7ca9('0x3'),_0x7ca9('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7ca9('0x6')]},'nameField':{'type':Sequelize[_0x7ca9('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ca9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ce0bb31..e1af2a9 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 _0xb562=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x9af0ce,_0x2416f9){var _0x540187=function(_0x34c519){while(--_0x34c519){_0x9af0ce['push'](_0x9af0ce['shift']());}};_0x540187(++_0x2416f9);}(_0xb562,0x13e));var _0x2b56=function(_0x2a02e2,_0x1b0aaa){_0x2a02e2=_0x2a02e2-0x0;var _0x348957=_0xb562[_0x2a02e2];return _0x348957;};'use strict';var emlformat=require(_0x2b56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b56('0x1'));var jsonpatch=require(_0x2b56('0x2'));var rp=require('request-promise');var moment=require(_0x2b56('0x3'));var BPromise=require(_0x2b56('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b56('0x5'));var sox=require('sox');var csv=require(_0x2b56('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b56('0x7'));var _=require(_0x2b56('0x8'));var squel=require('squel');var crypto=require(_0x2b56('0x9'));var jsforce=require(_0x2b56('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b56('0x6'));var querystring=require(_0x2b56('0xb'));var Papa=require(_0x2b56('0xc'));var Redis=require(_0x2b56('0xd'));var authService=require(_0x2b56('0xe'));var qs=require(_0x2b56('0xf'));var as=require(_0x2b56('0x10'));var hardwareService=require(_0x2b56('0x11'));var logger=require(_0x2b56('0x12'))(_0x2b56('0x13'));var utils=require('../../config/utils');var config=require(_0x2b56('0x14'));var licenseUtil=require(_0x2b56('0x15'));var db=require(_0x2b56('0x16'))['db'];function respondWithStatusCode(_0x427d5c,_0x2f7678){_0x2f7678=_0x2f7678||0xcc;return function(_0x35f0a4){if(_0x35f0a4){return _0x427d5c[_0x2b56('0x17')](_0x2f7678);}return _0x427d5c[_0x2b56('0x18')](_0x2f7678)[_0x2b56('0x19')]();};}function respondWithResult(_0x51552e,_0x113738){_0x113738=_0x113738||0xc8;return function(_0x2904da){if(_0x2904da){return _0x51552e[_0x2b56('0x18')](_0x113738)['json'](_0x2904da);}};}function respondWithFilteredResult(_0x29ba2c,_0x10a94d){return function(_0x492be7){if(_0x492be7){var _0x14effe=typeof _0x10a94d[_0x2b56('0x1a')]===_0x2b56('0x1b')&&typeof _0x10a94d['limit']===_0x2b56('0x1b');var _0x5e132e=_0x492be7[_0x2b56('0x1c')];var _0x355470=_0x14effe?0x0:_0x10a94d[_0x2b56('0x1a')];var _0x22de25=_0x14effe?_0x492be7['count']:_0x10a94d[_0x2b56('0x1a')]+_0x10a94d['limit'];var _0x1da002;if(_0x22de25>=_0x5e132e){_0x22de25=_0x5e132e;_0x1da002=0xc8;}else{_0x1da002=0xce;}_0x29ba2c[_0x2b56('0x18')](_0x1da002);return _0x29ba2c[_0x2b56('0x1d')](_0x2b56('0x1e'),_0x355470+'-'+_0x22de25+'/'+_0x5e132e)[_0x2b56('0x1f')](_0x492be7);}return null;};}function patchUpdates(_0x319dfb){return function(_0x274b23){try{jsonpatch[_0x2b56('0x20')](_0x274b23,_0x319dfb,!![]);}catch(_0xa26050){return BPromise[_0x2b56('0x21')](_0xa26050);}return _0x274b23[_0x2b56('0x22')]();};}function saveUpdates(_0x73f223,_0x153e29){return function(_0x24e0f9){if(_0x24e0f9){return _0x24e0f9['update'](_0x73f223)[_0x2b56('0x23')](function(_0x203a3f){return _0x203a3f;});}return null;};}function removeEntity(_0x9bfcd6,_0x352d96){return function(_0x58358a){if(_0x58358a){return _0x58358a[_0x2b56('0x24')]()[_0x2b56('0x23')](function(){_0x9bfcd6[_0x2b56('0x18')](0xcc)[_0x2b56('0x19')]();});}};}function handleEntityNotFound(_0xcb061e,_0x2b65a8){return function(_0x1cebf3){if(!_0x1cebf3){_0xcb061e[_0x2b56('0x17')](0x194);}return _0x1cebf3;};}function handleError(_0x2c3fba,_0x190e91){_0x190e91=_0x190e91||0x1f4;return function(_0x90c85f){logger[_0x2b56('0x25')](_0x90c85f[_0x2b56('0x26')]);if(_0x90c85f[_0x2b56('0x27')]){delete _0x90c85f['name'];}_0x2c3fba[_0x2b56('0x18')](_0x190e91)['send'](_0x90c85f);};}exports[_0x2b56('0x28')]=function(_0x2f3eb3,_0x58f5c6){var _0x5e0afe={},_0x1db683={},_0x58993a={'count':0x0,'rows':[]};var _0x5c7662=_[_0x2b56('0x29')](db[_0x2b56('0x2a')][_0x2b56('0x2b')],function(_0x280367){return{'name':_0x280367[_0x2b56('0x2c')],'type':_0x280367['type'][_0x2b56('0x2d')]};});_0x1db683[_0x2b56('0x2e')]=_[_0x2b56('0x29')](_0x5c7662,_0x2b56('0x27'));_0x1db683[_0x2b56('0x2f')]=_[_0x2b56('0x30')](_0x2f3eb3[_0x2b56('0x2f')]);_0x1db683[_0x2b56('0x31')]=_[_0x2b56('0x32')](_0x1db683[_0x2b56('0x2e')],_0x1db683['query']);_0x5e0afe[_0x2b56('0x33')]=_['intersection'](_0x1db683[_0x2b56('0x2e')],qs['fields'](_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x34')]));_0x5e0afe[_0x2b56('0x33')]=_0x5e0afe[_0x2b56('0x33')][_0x2b56('0x35')]?_0x5e0afe['attributes']:_0x1db683[_0x2b56('0x2e')];if(!_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x36')](_0x2b56('0x37'))){_0x5e0afe[_0x2b56('0x38')]=qs['limit'](_0x2f3eb3['query'][_0x2b56('0x38')]);_0x5e0afe['offset']=qs[_0x2b56('0x1a')](_0x2f3eb3['query']['offset']);}_0x5e0afe[_0x2b56('0x39')]=qs[_0x2b56('0x3a')](_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x3a')]);_0x5e0afe[_0x2b56('0x3b')]=qs[_0x2b56('0x31')](_[_0x2b56('0x3c')](_0x2f3eb3[_0x2b56('0x2f')],_0x1db683[_0x2b56('0x31')]),_0x5c7662);if(_0x2f3eb3['query'][_0x2b56('0x3d')]){_0x5e0afe[_0x2b56('0x3b')]=_[_0x2b56('0x3e')](_0x5e0afe[_0x2b56('0x3b')],{'$or':_[_0x2b56('0x29')](_0x5c7662,function(_0x366e85){if(_0x366e85[_0x2b56('0x3f')]!==_0x2b56('0x40')){var _0x552f7c={};_0x552f7c[_0x366e85['name']]={'$like':'%'+_0x2f3eb3['query'][_0x2b56('0x3d')]+'%'};return _0x552f7c;}})});}_0x5e0afe=_['merge']({},_0x5e0afe,_0x2f3eb3['options']);var _0x52dd05={'where':_0x5e0afe['where']};return db[_0x2b56('0x2a')][_0x2b56('0x1c')](_0x52dd05)['then'](function(_0x33be08){_0x58993a[_0x2b56('0x1c')]=_0x33be08;if(_0x2f3eb3[_0x2b56('0x2f')][_0x2b56('0x41')]){_0x5e0afe['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x2b56('0x42')](_0x5e0afe);})[_0x2b56('0x23')](function(_0x16edae){_0x58993a[_0x2b56('0x43')]=_0x16edae;return _0x58993a;})[_0x2b56('0x23')](respondWithFilteredResult(_0x58f5c6,_0x5e0afe))[_0x2b56('0x44')](handleError(_0x58f5c6,null));};exports['show']=function(_0xf0ba63,_0x24bb8c){var _0x44e3dd={'raw':!![],'where':{'id':_0xf0ba63[_0x2b56('0x45')]['id']}},_0x5eff00={};_0x5eff00[_0x2b56('0x2e')]=_[_0x2b56('0x30')](db['FreshsalesField'][_0x2b56('0x2b')]);_0x5eff00[_0x2b56('0x2f')]=_[_0x2b56('0x30')](_0xf0ba63[_0x2b56('0x2f')]);_0x5eff00[_0x2b56('0x31')]=_[_0x2b56('0x32')](_0x5eff00[_0x2b56('0x2e')],_0x5eff00['query']);_0x44e3dd[_0x2b56('0x33')]=_['intersection'](_0x5eff00[_0x2b56('0x2e')],qs[_0x2b56('0x34')](_0xf0ba63[_0x2b56('0x2f')]['fields']));_0x44e3dd['attributes']=_0x44e3dd[_0x2b56('0x33')][_0x2b56('0x35')]?_0x44e3dd[_0x2b56('0x33')]:_0x5eff00[_0x2b56('0x2e')];if(_0xf0ba63[_0x2b56('0x2f')][_0x2b56('0x41')]){_0x44e3dd[_0x2b56('0x46')]=[{'all':!![]}];}_0x44e3dd=_[_0x2b56('0x3e')]({},_0x44e3dd,_0xf0ba63['options']);return db['FreshsalesField'][_0x2b56('0x47')](_0x44e3dd)['then'](handleEntityNotFound(_0x24bb8c,null))[_0x2b56('0x23')](respondWithResult(_0x24bb8c,null))['catch'](handleError(_0x24bb8c,null));};exports[_0x2b56('0x48')]=function(_0x58df8e,_0x3e1433){return db[_0x2b56('0x2a')]['create'](_0x58df8e[_0x2b56('0x49')],{})[_0x2b56('0x23')](respondWithResult(_0x3e1433,0xc9))[_0x2b56('0x44')](handleError(_0x3e1433,null));};exports['update']=function(_0x4974b8,_0x3c6204){if(_0x4974b8[_0x2b56('0x49')]['id']){delete _0x4974b8[_0x2b56('0x49')]['id'];}return db['FreshsalesField'][_0x2b56('0x47')]({'where':{'id':_0x4974b8['params']['id']}})[_0x2b56('0x23')](handleEntityNotFound(_0x3c6204,null))[_0x2b56('0x23')](saveUpdates(_0x4974b8[_0x2b56('0x49')],null))[_0x2b56('0x23')](respondWithResult(_0x3c6204,null))[_0x2b56('0x44')](handleError(_0x3c6204,null));};exports['destroy']=function(_0x30f2bc,_0x781db5){return db[_0x2b56('0x2a')][_0x2b56('0x47')]({'where':{'id':_0x30f2bc[_0x2b56('0x45')]['id']}})[_0x2b56('0x23')](handleEntityNotFound(_0x781db5,null))[_0x2b56('0x23')](removeEntity(_0x781db5,null))[_0x2b56('0x44')](handleError(_0x781db5,null));}; \ No newline at end of file +var _0xc59e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','includeAll','find','catch','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc59e,0x1b1));var _0xec59=function(_0x594075,_0x4f2132){_0x594075=_0x594075-0x0;var _0xb432b0=_0xc59e[_0x594075];return _0xb432b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec59('0x0'));var zipdir=require(_0xec59('0x1'));var jsonpatch=require(_0xec59('0x2'));var rp=require('request-promise');var moment=require(_0xec59('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xec59('0x4'));var util=require(_0xec59('0x5'));var path=require(_0xec59('0x6'));var sox=require(_0xec59('0x7'));var csv=require(_0xec59('0x8'));var ejs=require(_0xec59('0x9'));var fs=require('fs');var fs_extra=require(_0xec59('0xa'));var _=require(_0xec59('0xb'));var squel=require('squel');var crypto=require(_0xec59('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xec59('0xd'));var Papa=require(_0xec59('0xe'));var Redis=require(_0xec59('0xf'));var authService=require(_0xec59('0x10'));var qs=require(_0xec59('0x11'));var as=require(_0xec59('0x12'));var hardwareService=require(_0xec59('0x13'));var logger=require(_0xec59('0x14'))('api');var utils=require(_0xec59('0x15'));var config=require(_0xec59('0x16'));var licenseUtil=require(_0xec59('0x17'));var db=require(_0xec59('0x18'))['db'];function respondWithStatusCode(_0x616e00,_0x37f64a){_0x37f64a=_0x37f64a||0xcc;return function(_0x2d9333){if(_0x2d9333){return _0x616e00['sendStatus'](_0x37f64a);}return _0x616e00[_0xec59('0x19')](_0x37f64a)[_0xec59('0x1a')]();};}function respondWithResult(_0x2ebc68,_0x10a0c2){_0x10a0c2=_0x10a0c2||0xc8;return function(_0x1fcbff){if(_0x1fcbff){return _0x2ebc68[_0xec59('0x19')](_0x10a0c2)['json'](_0x1fcbff);}};}function respondWithFilteredResult(_0x5cd734,_0x574b17){return function(_0x2d0490){if(_0x2d0490){var _0x3babe4=typeof _0x574b17['offset']===_0xec59('0x1b')&&typeof _0x574b17['limit']===_0xec59('0x1b');var _0x2356db=_0x2d0490[_0xec59('0x1c')];var _0x194445=_0x3babe4?0x0:_0x574b17[_0xec59('0x1d')];var _0x771b8d=_0x3babe4?_0x2d0490[_0xec59('0x1c')]:_0x574b17['offset']+_0x574b17[_0xec59('0x1e')];var _0x37f700;if(_0x771b8d>=_0x2356db){_0x771b8d=_0x2356db;_0x37f700=0xc8;}else{_0x37f700=0xce;}_0x5cd734['status'](_0x37f700);return _0x5cd734[_0xec59('0x1f')](_0xec59('0x20'),_0x194445+'-'+_0x771b8d+'/'+_0x2356db)[_0xec59('0x21')](_0x2d0490);}return null;};}function patchUpdates(_0x2ff8de){return function(_0x337408){try{jsonpatch[_0xec59('0x22')](_0x337408,_0x2ff8de,!![]);}catch(_0x513ae6){return BPromise[_0xec59('0x23')](_0x513ae6);}return _0x337408[_0xec59('0x24')]();};}function saveUpdates(_0x34a5ff,_0x52bb75){return function(_0x2d1567){if(_0x2d1567){return _0x2d1567[_0xec59('0x25')](_0x34a5ff)['then'](function(_0x500dc2){return _0x500dc2;});}return null;};}function removeEntity(_0x584d64,_0x440a6a){return function(_0x4f5975){if(_0x4f5975){return _0x4f5975['destroy']()[_0xec59('0x26')](function(){_0x584d64[_0xec59('0x19')](0xcc)[_0xec59('0x1a')]();});}};}function handleEntityNotFound(_0x3128ac,_0x5a406d){return function(_0x1f76e3){if(!_0x1f76e3){_0x3128ac[_0xec59('0x27')](0x194);}return _0x1f76e3;};}function handleError(_0x4ac22,_0x4bc816){_0x4bc816=_0x4bc816||0x1f4;return function(_0x2cb0ad){logger[_0xec59('0x28')](_0x2cb0ad[_0xec59('0x29')]);if(_0x2cb0ad[_0xec59('0x2a')]){delete _0x2cb0ad[_0xec59('0x2a')];}_0x4ac22[_0xec59('0x19')](_0x4bc816)[_0xec59('0x2b')](_0x2cb0ad);};}exports[_0xec59('0x2c')]=function(_0x15a96e,_0x1f3a88){var _0x5a42db={},_0x5e42b6={},_0x55def9={'count':0x0,'rows':[]};var _0x2104cb=_[_0xec59('0x2d')](db[_0xec59('0x2e')][_0xec59('0x2f')],function(_0x5a9a8f){return{'name':_0x5a9a8f['fieldName'],'type':_0x5a9a8f[_0xec59('0x30')][_0xec59('0x31')]};});_0x5e42b6[_0xec59('0x32')]=_[_0xec59('0x2d')](_0x2104cb,_0xec59('0x2a'));_0x5e42b6[_0xec59('0x33')]=_[_0xec59('0x34')](_0x15a96e[_0xec59('0x33')]);_0x5e42b6[_0xec59('0x35')]=_[_0xec59('0x36')](_0x5e42b6[_0xec59('0x32')],_0x5e42b6['query']);_0x5a42db['attributes']=_[_0xec59('0x36')](_0x5e42b6['model'],qs[_0xec59('0x37')](_0x15a96e[_0xec59('0x33')][_0xec59('0x37')]));_0x5a42db['attributes']=_0x5a42db[_0xec59('0x38')][_0xec59('0x39')]?_0x5a42db[_0xec59('0x38')]:_0x5e42b6[_0xec59('0x32')];if(!_0x15a96e[_0xec59('0x33')]['hasOwnProperty']('nolimit')){_0x5a42db[_0xec59('0x1e')]=qs[_0xec59('0x1e')](_0x15a96e[_0xec59('0x33')][_0xec59('0x1e')]);_0x5a42db[_0xec59('0x1d')]=qs[_0xec59('0x1d')](_0x15a96e[_0xec59('0x33')][_0xec59('0x1d')]);}_0x5a42db[_0xec59('0x3a')]=qs[_0xec59('0x3b')](_0x15a96e['query'][_0xec59('0x3b')]);_0x5a42db[_0xec59('0x3c')]=qs[_0xec59('0x35')](_[_0xec59('0x3d')](_0x15a96e['query'],_0x5e42b6[_0xec59('0x35')]),_0x2104cb);if(_0x15a96e['query'][_0xec59('0x3e')]){_0x5a42db[_0xec59('0x3c')]=_['merge'](_0x5a42db[_0xec59('0x3c')],{'$or':_['map'](_0x2104cb,function(_0x1b719e){if(_0x1b719e[_0xec59('0x30')]!==_0xec59('0x3f')){var _0x4d54fb={};_0x4d54fb[_0x1b719e[_0xec59('0x2a')]]={'$like':'%'+_0x15a96e[_0xec59('0x33')][_0xec59('0x3e')]+'%'};return _0x4d54fb;}})});}_0x5a42db=_[_0xec59('0x40')]({},_0x5a42db,_0x15a96e['options']);var _0x572c3d={'where':_0x5a42db['where']};return db['FreshsalesField'][_0xec59('0x1c')](_0x572c3d)[_0xec59('0x26')](function(_0xefd67a){_0x55def9[_0xec59('0x1c')]=_0xefd67a;if(_0x15a96e['query']['includeAll']){_0x5a42db[_0xec59('0x41')]=[{'all':!![]}];}return db[_0xec59('0x2e')][_0xec59('0x42')](_0x5a42db);})['then'](function(_0x41339f){_0x55def9[_0xec59('0x43')]=_0x41339f;return _0x55def9;})[_0xec59('0x26')](respondWithFilteredResult(_0x1f3a88,_0x5a42db))['catch'](handleError(_0x1f3a88,null));};exports['show']=function(_0x3599f9,_0x1fb2b4){var _0x4fde41={'raw':!![],'where':{'id':_0x3599f9['params']['id']}},_0x1cbb74={};_0x1cbb74[_0xec59('0x32')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x1cbb74[_0xec59('0x33')]=_[_0xec59('0x34')](_0x3599f9['query']);_0x1cbb74[_0xec59('0x35')]=_[_0xec59('0x36')](_0x1cbb74[_0xec59('0x32')],_0x1cbb74[_0xec59('0x33')]);_0x4fde41[_0xec59('0x38')]=_[_0xec59('0x36')](_0x1cbb74[_0xec59('0x32')],qs[_0xec59('0x37')](_0x3599f9['query']['fields']));_0x4fde41['attributes']=_0x4fde41['attributes'][_0xec59('0x39')]?_0x4fde41[_0xec59('0x38')]:_0x1cbb74[_0xec59('0x32')];if(_0x3599f9[_0xec59('0x33')][_0xec59('0x44')]){_0x4fde41[_0xec59('0x41')]=[{'all':!![]}];}_0x4fde41=_[_0xec59('0x40')]({},_0x4fde41,_0x3599f9['options']);return db['FreshsalesField'][_0xec59('0x45')](_0x4fde41)['then'](handleEntityNotFound(_0x1fb2b4,null))[_0xec59('0x26')](respondWithResult(_0x1fb2b4,null))[_0xec59('0x46')](handleError(_0x1fb2b4,null));};exports['create']=function(_0x4e0e94,_0x4d8f66){return db['FreshsalesField'][_0xec59('0x47')](_0x4e0e94[_0xec59('0x48')],{})[_0xec59('0x26')](respondWithResult(_0x4d8f66,0xc9))['catch'](handleError(_0x4d8f66,null));};exports[_0xec59('0x25')]=function(_0x5306be,_0x48ed1c){if(_0x5306be[_0xec59('0x48')]['id']){delete _0x5306be[_0xec59('0x48')]['id'];}return db[_0xec59('0x2e')][_0xec59('0x45')]({'where':{'id':_0x5306be[_0xec59('0x49')]['id']}})[_0xec59('0x26')](handleEntityNotFound(_0x48ed1c,null))['then'](saveUpdates(_0x5306be[_0xec59('0x48')],null))['then'](respondWithResult(_0x48ed1c,null))[_0xec59('0x46')](handleError(_0x48ed1c,null));};exports[_0xec59('0x4a')]=function(_0x5c1641,_0x5a6b09){return db[_0xec59('0x2e')][_0xec59('0x45')]({'where':{'id':_0x5c1641[_0xec59('0x49')]['id']}})[_0xec59('0x26')](handleEntityNotFound(_0x5a6b09,null))['then'](removeEntity(_0x5a6b09,null))['catch'](handleError(_0x5a6b09,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7e47469..d8002a5 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 _0xa958=['path','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22fc8c,_0x32ebe3){var _0xeca1d8=function(_0x249bbe){while(--_0x249bbe){_0x22fc8c['push'](_0x22fc8c['shift']());}};_0xeca1d8(++_0x32ebe3);}(_0xa958,0x94));var _0x8a95=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa958[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var logger=require(_0x8a95('0x1'))(_0x8a95('0x2'));var moment=require(_0x8a95('0x3'));var BPromise=require(_0x8a95('0x4'));var rp=require(_0x8a95('0x5'));var fs=require('fs');var path=require(_0x8a95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a95('0x7'));module[_0x8a95('0x8')]=function(_0x403364,_0x141f82){return _0x403364[_0x8a95('0x9')](_0x8a95('0xa'),attributes,{'tableName':_0x8a95('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x8a95('0xc'),_0x8a95('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd9f=['idField','FieldId','api','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields'];(function(_0x4764a7,_0x89b3ea){var _0xfb134e=function(_0x173ee5){while(--_0x173ee5){_0x4764a7['push'](_0x4764a7['shift']());}};_0xfb134e(++_0x89b3ea);}(_0xbd9f,0x98));var _0xfbd9=function(_0x250010,_0x489f87){_0x250010=_0x250010-0x0;var _0x2448f2=_0xbd9f[_0x250010];return _0x2448f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfbd9('0x0'));var moment=require('moment');var BPromise=require(_0xfbd9('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbd9('0x2'));var rimraf=require('rimraf');var config=require(_0xfbd9('0x3'));var attributes=require(_0xfbd9('0x4'));module[_0xfbd9('0x5')]=function(_0x5a9faf,_0x3329ae){return _0x5a9faf['define'](_0xfbd9('0x6'),attributes,{'tableName':_0xfbd9('0x7'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xfbd9('0x8'),_0xfbd9('0x9')],'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 f3fd333..e0a912e 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5df838,_0x13d288){var _0x2d461c=function(_0x2eac55){while(--_0x2eac55){_0x5df838['push'](_0x5df838['shift']());}};_0x2d461c(++_0x13d288);}(_0xda19,0xd5));var _0x9da1=function(_0xa29740,_0x479f33){_0xa29740=_0xa29740-0x0;var _0x377c2f=_0xda19[_0xa29740];return _0x377c2f;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x2bd8=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x34d566,_0x3c30e2){var _0x5ec3f8=function(_0x236ed3){while(--_0x236ed3){_0x34d566['push'](_0x34d566['shift']());}};_0x5ec3f8(++_0x3c30e2);}(_0x2bd8,0x130));var _0x82bd=function(_0x155896,_0x538423){_0x155896=_0x155896-0x0;var _0x5d1ab1=_0x2bd8[_0x155896];return _0x5d1ab1;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0xb')](_0x19dbb1,_0x226f60)['then'](function(_0x4a9b2c){logger['info'](_0x82bd('0xc'),_0x77d7a9,'request\x20sent');logger['debug'](_0x82bd('0xd'),_0x77d7a9,'request\x20sent',JSON['stringify'](_0x4a9b2c));if(_0x4a9b2c[_0x82bd('0xe')]){if(_0x4a9b2c[_0x82bd('0xe')]['code']===0x1f4){logger[_0x82bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x4a9b2c[_0x82bd('0xe')]['message']);return _0x4dc3a6(_0x4a9b2c[_0x82bd('0xe')][_0x82bd('0xf')]);}logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x4a9b2c['error'][_0x82bd('0xf')]);return _0x1f7463(_0x4a9b2c[_0x82bd('0xe')]['message']);}else{logger[_0x82bd('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x82bd('0x11'));_0x1f7463(_0x4a9b2c[_0x82bd('0x12')][_0x82bd('0xf')]);}})[_0x82bd('0x13')](function(_0x209081){logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x209081);_0x4dc3a6(_0x209081);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b7be498..8589b47 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(_0x3f7cf9,_0x29b96e){var _0x39021f=function(_0x272cc3){while(--_0x272cc3){_0x3f7cf9['push'](_0x3f7cf9['shift']());}};_0x39021f(++_0x29b96e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4d4c21,_0x3893d2){var _0x546d27=function(_0x2daa68){while(--_0x2daa68){_0x4d4c21['push'](_0x4d4c21['shift']());}};_0x546d27(++_0x3893d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 52db2f8..b778231 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 _0x5232=['newTab','sequelize','exports','STRING','ENUM','integrationTab'];(function(_0x4a96ef,_0x5c1383){var _0x330714=function(_0x1bc221){while(--_0x1bc221){_0x4a96ef['push'](_0x4a96ef['shift']());}};_0x330714(++_0x5c1383);}(_0x5232,0x1c9));var _0x2523=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0x5232[_0x5400a1];return _0x4006c7;};'use strict';var Sequelize=require(_0x2523('0x0'));module[_0x2523('0x1')]={'name':{'type':Sequelize[_0x2523('0x2')]},'description':{'type':Sequelize[_0x2523('0x2')]},'username':{'type':Sequelize[_0x2523('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2523('0x2')]},'clientId':{'type':Sequelize[_0x2523('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2523('0x2')]},'serverUrl':{'type':Sequelize[_0x2523('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2523('0x3')](_0x2523('0x4'),_0x2523('0x5')),'defaultValue':_0x2523('0x4')}}; \ No newline at end of file +var _0xb235=['integrationTab','STRING','username','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb235,0x10d));var _0x5b23=function(_0x318054,_0x516efd){_0x318054=_0x318054-0x0;var _0x19a6ae=_0xb235[_0x318054];return _0x19a6ae;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5b23('0x0')]},'username':{'type':Sequelize[_0x5b23('0x0')],'unique':_0x5b23('0x1')},'remoteUri':{'type':Sequelize[_0x5b23('0x0')]},'password':{'type':Sequelize[_0x5b23('0x0')]},'clientId':{'type':Sequelize[_0x5b23('0x0')]},'clientSecret':{'type':Sequelize[_0x5b23('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5b23('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x5b23('0x2')](_0x5b23('0x3'),'newTab'),'defaultValue':_0x5b23('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 956bb01..672b469 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 _0x1198=['true','False','false','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceConfiguration','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','lastIndexOf','login','username','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','textarea','phone','includes','label','picklistValues','value','True'];(function(_0x17b620,_0x2b01e3){var _0x425d5c=function(_0x41427f){while(--_0x41427f){_0x17b620['push'](_0x17b620['shift']());}};_0x425d5c(++_0x2b01e3);}(_0x1198,0x81));var _0x8119=function(_0x550531,_0x4a34a0){_0x550531=_0x550531-0x0;var _0x569e0a=_0x1198[_0x550531];return _0x569e0a;};'use strict';var emlformat=require(_0x8119('0x0'));var rimraf=require(_0x8119('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8119('0x2'));var rp=require(_0x8119('0x3'));var moment=require(_0x8119('0x4'));var BPromise=require(_0x8119('0x5'));var Mustache=require(_0x8119('0x6'));var util=require(_0x8119('0x7'));var path=require(_0x8119('0x8'));var sox=require(_0x8119('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8119('0xa'));var crypto=require('crypto');var jsforce=require(_0x8119('0xb'));var deskjs=require(_0x8119('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8119('0xd'));var Papa=require(_0x8119('0xe'));var Redis=require(_0x8119('0xf'));var authService=require(_0x8119('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8119('0x11'));var logger=require(_0x8119('0x12'))('api');var utils=require(_0x8119('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8119('0x14'));var db=require(_0x8119('0x15'))['db'];var integrations=require(_0x8119('0x16'));function respondWithStatusCode(_0x3b81a8,_0x15f3cf){_0x15f3cf=_0x15f3cf||0xcc;return function(_0x418bca){if(_0x418bca){return _0x3b81a8[_0x8119('0x17')](_0x15f3cf);}return _0x3b81a8[_0x8119('0x18')](_0x15f3cf)[_0x8119('0x19')]();};}function respondWithResult(_0xced7b6,_0x20d04e){_0x20d04e=_0x20d04e||0xc8;return function(_0x232c99){if(_0x232c99){return _0xced7b6[_0x8119('0x18')](_0x20d04e)['json'](_0x232c99);}};}function respondWithFilteredResult(_0x299826,_0x4a1cde){return function(_0x285347){if(_0x285347){var _0x31a797=typeof _0x4a1cde[_0x8119('0x1a')]==='undefined'&&typeof _0x4a1cde[_0x8119('0x1b')]===_0x8119('0x1c');var _0x4ded87=_0x285347[_0x8119('0x1d')];var _0x12bf2d=_0x31a797?0x0:_0x4a1cde[_0x8119('0x1a')];var _0x56a628=_0x31a797?_0x285347['count']:_0x4a1cde[_0x8119('0x1a')]+_0x4a1cde['limit'];var _0x447ab3;if(_0x56a628>=_0x4ded87){_0x56a628=_0x4ded87;_0x447ab3=0xc8;}else{_0x447ab3=0xce;}_0x299826[_0x8119('0x18')](_0x447ab3);return _0x299826[_0x8119('0x1e')](_0x8119('0x1f'),_0x12bf2d+'-'+_0x56a628+'/'+_0x4ded87)[_0x8119('0x20')](_0x285347);}return null;};}function patchUpdates(_0x5962bc){return function(_0x570657){try{jsonpatch[_0x8119('0x21')](_0x570657,_0x5962bc,!![]);}catch(_0x1701b1){return BPromise['reject'](_0x1701b1);}return _0x570657[_0x8119('0x22')]();};}function saveUpdates(_0x441f6b,_0x4c7f83){return function(_0x488111){if(_0x488111){return _0x488111['update'](_0x441f6b)[_0x8119('0x23')](function(_0x10a475){return _0x10a475;});}return null;};}function removeEntity(_0x1ce3a2,_0x51b14a){return function(_0x34d934){if(_0x34d934){return _0x34d934[_0x8119('0x24')]()['then'](function(){_0x1ce3a2[_0x8119('0x18')](0xcc)[_0x8119('0x19')]();});}};}function handleEntityNotFound(_0x26386d,_0x2488b0){return function(_0x3c7773){if(!_0x3c7773){_0x26386d[_0x8119('0x17')](0x194);}return _0x3c7773;};}function handleError(_0x5464fc,_0x5a4568){_0x5a4568=_0x5a4568||0x1f4;return function(_0x39732c){logger[_0x8119('0x25')](_0x39732c[_0x8119('0x26')]);if(_0x39732c['name']){delete _0x39732c[_0x8119('0x27')];}_0x5464fc[_0x8119('0x18')](_0x5a4568)[_0x8119('0x28')](_0x39732c);};}exports[_0x8119('0x29')]=function(_0xe055a7,_0x3987d8){var _0x52ae61={},_0x26f75f={},_0x369bb1={'count':0x0,'rows':[]};var _0x3ff533=_[_0x8119('0x2a')](db[_0x8119('0x2b')]['rawAttributes'],function(_0x125545){return{'name':_0x125545[_0x8119('0x2c')],'type':_0x125545['type']['key']};});_0x26f75f[_0x8119('0x2d')]=_[_0x8119('0x2a')](_0x3ff533,_0x8119('0x27'));_0x26f75f[_0x8119('0x2e')]=_[_0x8119('0x2f')](_0xe055a7['query']);_0x26f75f[_0x8119('0x30')]=_[_0x8119('0x31')](_0x26f75f[_0x8119('0x2d')],_0x26f75f['query']);_0x52ae61[_0x8119('0x32')]=_['intersection'](_0x26f75f['model'],qs['fields'](_0xe055a7[_0x8119('0x2e')][_0x8119('0x33')]));_0x52ae61[_0x8119('0x32')]=_0x52ae61['attributes'][_0x8119('0x34')]?_0x52ae61['attributes']:_0x26f75f[_0x8119('0x2d')];if(!_0xe055a7[_0x8119('0x2e')]['hasOwnProperty'](_0x8119('0x35'))){_0x52ae61['limit']=qs['limit'](_0xe055a7[_0x8119('0x2e')][_0x8119('0x1b')]);_0x52ae61[_0x8119('0x1a')]=qs[_0x8119('0x1a')](_0xe055a7[_0x8119('0x2e')][_0x8119('0x1a')]);}_0x52ae61[_0x8119('0x36')]=qs[_0x8119('0x37')](_0xe055a7['query'][_0x8119('0x37')]);_0x52ae61[_0x8119('0x38')]=qs[_0x8119('0x30')](_['pick'](_0xe055a7[_0x8119('0x2e')],_0x26f75f[_0x8119('0x30')]),_0x3ff533);if(_0xe055a7['query'][_0x8119('0x39')]){_0x52ae61[_0x8119('0x38')]=_[_0x8119('0x3a')](_0x52ae61['where'],{'$or':_[_0x8119('0x2a')](_0x3ff533,function(_0x1933b5){if(_0x1933b5[_0x8119('0x3b')]!=='VIRTUAL'){var _0x22dfb1={};_0x22dfb1[_0x1933b5[_0x8119('0x27')]]={'$like':'%'+_0xe055a7[_0x8119('0x2e')]['filter']+'%'};return _0x22dfb1;}})});}_0x52ae61=_[_0x8119('0x3a')]({},_0x52ae61,_0xe055a7['options']);var _0x47ff79={'where':_0x52ae61['where']};return db[_0x8119('0x2b')][_0x8119('0x1d')](_0x47ff79)[_0x8119('0x23')](function(_0x3224ae){_0x369bb1[_0x8119('0x1d')]=_0x3224ae;if(_0xe055a7[_0x8119('0x2e')][_0x8119('0x3c')]){_0x52ae61[_0x8119('0x3d')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x8119('0x3e')](_0x52ae61);})['then'](function(_0x20197d){_0x369bb1[_0x8119('0x3f')]=_0x20197d;return _0x369bb1;})[_0x8119('0x23')](respondWithFilteredResult(_0x3987d8,_0x52ae61))['catch'](handleError(_0x3987d8,null));};exports[_0x8119('0x40')]=function(_0x5d5853,_0x2dd511){var _0x183385={'raw':![],'where':{'id':_0x5d5853['params']['id']}},_0x4d9292={};_0x4d9292[_0x8119('0x2d')]=_[_0x8119('0x2f')](db['SalesforceAccount'][_0x8119('0x41')]);_0x4d9292[_0x8119('0x2e')]=_[_0x8119('0x2f')](_0x5d5853['query']);_0x4d9292[_0x8119('0x30')]=_[_0x8119('0x31')](_0x4d9292[_0x8119('0x2d')],_0x4d9292['query']);_0x183385[_0x8119('0x32')]=_[_0x8119('0x31')](_0x4d9292[_0x8119('0x2d')],qs[_0x8119('0x33')](_0x5d5853[_0x8119('0x2e')][_0x8119('0x33')]));_0x183385[_0x8119('0x32')]=_0x183385['attributes'][_0x8119('0x34')]?_0x183385[_0x8119('0x32')]:_0x4d9292[_0x8119('0x2d')];if(_0x5d5853[_0x8119('0x2e')][_0x8119('0x3c')]){_0x183385['include']=[{'all':!![]}];}_0x183385=_['merge']({},_0x183385,_0x5d5853[_0x8119('0x42')]);return db[_0x8119('0x2b')]['find'](_0x183385)[_0x8119('0x23')](handleEntityNotFound(_0x2dd511,null))['then'](respondWithResult(_0x2dd511,null))[_0x8119('0x43')](handleError(_0x2dd511,null));};exports[_0x8119('0x44')]=function(_0x4eaa9a,_0x495f4b){return db[_0x8119('0x2b')][_0x8119('0x44')](_0x4eaa9a[_0x8119('0x45')],{})['then'](respondWithResult(_0x495f4b,0xc9))[_0x8119('0x43')](handleError(_0x495f4b,null));};exports['update']=function(_0x5d172f,_0x5b402d){if(_0x5d172f[_0x8119('0x45')]['id']){delete _0x5d172f[_0x8119('0x45')]['id'];}return db[_0x8119('0x2b')]['find']({'where':{'id':_0x5d172f[_0x8119('0x46')]['id']}})[_0x8119('0x23')](handleEntityNotFound(_0x5b402d,null))[_0x8119('0x23')](saveUpdates(_0x5d172f[_0x8119('0x45')],null))[_0x8119('0x23')](respondWithResult(_0x5b402d,null))[_0x8119('0x43')](handleError(_0x5b402d,null));};exports['destroy']=function(_0x366679,_0x334cc4){return db[_0x8119('0x2b')]['find']({'where':{'id':_0x366679[_0x8119('0x46')]['id']}})['then'](handleEntityNotFound(_0x334cc4,null))[_0x8119('0x23')](removeEntity(_0x334cc4,null))['catch'](handleError(_0x334cc4,null));};exports[_0x8119('0x47')]=function(_0x5ea30a,_0x573157,_0x3e6de0){var _0x8399ae={};var _0x5cac6a={};var _0x25d68b;var _0x559ad1;return db[_0x8119('0x2b')][_0x8119('0x48')]({'where':{'id':_0x5ea30a[_0x8119('0x46')]['id']}})[_0x8119('0x23')](handleEntityNotFound(_0x573157,null))[_0x8119('0x23')](function(_0x409bf2){if(_0x409bf2){_0x25d68b=_0x409bf2;_0x5cac6a[_0x8119('0x2d')]=_[_0x8119('0x2f')](db['SalesforceConfiguration'][_0x8119('0x41')]);_0x5cac6a[_0x8119('0x2e')]=_[_0x8119('0x2f')](_0x5ea30a[_0x8119('0x2e')]);_0x5cac6a[_0x8119('0x30')]=_[_0x8119('0x31')](_0x5cac6a[_0x8119('0x2d')],_0x5cac6a['query']);_0x8399ae[_0x8119('0x32')]=_[_0x8119('0x31')](_0x5cac6a[_0x8119('0x2d')],qs[_0x8119('0x33')](_0x5ea30a['query'][_0x8119('0x33')]));_0x8399ae[_0x8119('0x32')]=_0x8399ae[_0x8119('0x32')][_0x8119('0x34')]?_0x8399ae[_0x8119('0x32')]:_0x5cac6a['model'];_0x8399ae[_0x8119('0x36')]=qs[_0x8119('0x37')](_0x5ea30a[_0x8119('0x2e')][_0x8119('0x37')]);_0x8399ae[_0x8119('0x38')]=qs[_0x8119('0x30')](_[_0x8119('0x49')](_0x5ea30a[_0x8119('0x2e')],_0x5cac6a[_0x8119('0x30')]));if(_0x5ea30a[_0x8119('0x2e')]['filter']){_0x8399ae[_0x8119('0x38')]=_['merge'](_0x8399ae['where'],{'$or':_['map'](_0x8399ae['attributes'],function(_0x173c03){var _0x598126={};_0x598126[_0x173c03]={'$like':'%'+_0x5ea30a[_0x8119('0x2e')][_0x8119('0x39')]+'%'};return _0x598126;})});}_0x8399ae=_[_0x8119('0x3a')]({},_0x8399ae,_0x5ea30a[_0x8119('0x42')]);return _0x25d68b[_0x8119('0x47')](_0x8399ae);}})['then'](function(_0xa7ee06){if(_0xa7ee06){_0x559ad1=_0xa7ee06[_0x8119('0x34')];if(!_0x5ea30a[_0x8119('0x2e')]['hasOwnProperty'](_0x8119('0x35'))){_0x8399ae[_0x8119('0x1b')]=qs['limit'](_0x5ea30a['query']['limit']);_0x8399ae[_0x8119('0x1a')]=qs[_0x8119('0x1a')](_0x5ea30a[_0x8119('0x2e')][_0x8119('0x1a')]);}return _0x25d68b[_0x8119('0x47')](_0x8399ae);}})[_0x8119('0x23')](function(_0x4c405f){if(_0x4c405f){return _0x4c405f?{'count':_0x559ad1,'rows':_0x4c405f}:null;}})[_0x8119('0x23')](respondWithResult(_0x573157,null))[_0x8119('0x43')](handleError(_0x573157,null));};exports[_0x8119('0x4a')]=function(_0x5ce9fe,_0x286501,_0x431a66){if(_0x5ce9fe[_0x8119('0x45')]['id']){delete _0x5ce9fe[_0x8119('0x45')]['id'];}return db[_0x8119('0x2b')][_0x8119('0x48')]({'where':{'id':_0x5ce9fe[_0x8119('0x46')]['id']}})[_0x8119('0x23')](handleEntityNotFound(_0x286501,null))[_0x8119('0x23')](function(_0x5f2faa){if(_0x5f2faa){_0x5ce9fe['body'][_0x8119('0x4b')]=_0x5f2faa['id'];_0x5ce9fe[_0x8119('0x45')][_0x8119('0x4c')]=integrations[_0x8119('0x4d')](_0x5ce9fe[_0x8119('0x45')]['channel'],_0x5ce9fe[_0x8119('0x45')][_0x8119('0x3b')]);_0x5ce9fe[_0x8119('0x45')]['Descriptions']=integrations[_0x8119('0x4e')](_0x5ce9fe[_0x8119('0x45')][_0x8119('0x4f')],_0x5ce9fe[_0x8119('0x45')][_0x8119('0x3b')]);return db[_0x8119('0x50')][_0x8119('0x44')](_0x5ce9fe[_0x8119('0x45')],{'include':[{'model':db[_0x8119('0x51')],'as':_0x8119('0x4c')},{'model':db[_0x8119('0x51')],'as':_0x8119('0x52')}]});}return null;})[_0x8119('0x23')](respondWithResult(_0x286501,null))[_0x8119('0x43')](handleError(_0x286501,null));};exports[_0x8119('0x53')]=function(_0x101749,_0x493f94,_0x149660){var _0x30ac76;var _0x273b98='';var _0x4af6fe=_0x8119('0x54');return db['SalesforceAccount'][_0x8119('0x48')]({'where':{'id':_0x101749['params']['id']},'attributes':['id',_0x8119('0x55'),_0x8119('0x56'),_0x8119('0x57'),'username',_0x8119('0x58'),_0x8119('0x59')]})[_0x8119('0x23')](handleEntityNotFound(_0x493f94,null))[_0x8119('0x23')](function(_0x15bc5c){if(_0x15bc5c){_0x273b98=_0x15bc5c[_0x8119('0x55')];var _0x3894a5=_0x273b98['slice'](-0x1);if(_0x3894a5==='/'){_0x273b98=_0x273b98[_0x8119('0x5a')](0x0,_0x273b98[_0x8119('0x5b')](_0x3894a5));}_0x30ac76=new jsforce['Connection']({'oauth2':{'loginUrl':_0x273b98,'clientId':_0x15bc5c[_0x8119('0x56')],'clientSecret':_0x15bc5c[_0x8119('0x57')]}});return _0x30ac76[_0x8119('0x5c')](_0x15bc5c[_0x8119('0x5d')],_0x15bc5c[_0x8119('0x58')][_0x8119('0x5e')](_0x15bc5c['securityToken']));}})[_0x8119('0x23')](function(_0x2ac043){if(_0x2ac043){if(!_[_0x8119('0x5f')](_0x101749[_0x8119('0x2e')][_0x8119('0x60')])){_0x4af6fe=_0x101749[_0x8119('0x2e')][_0x8119('0x60')];}return _0x30ac76[_0x8119('0x61')](_0x4af6fe)[_0x8119('0x62')]();}})[_0x8119('0x23')](function(_0x3f9a50){var _0x13a7c8=['OwnerId',_0x8119('0x63'),_0x8119('0x64'),_0x8119('0x65'),_0x8119('0x66'),_0x8119('0x67')];var _0x27266=['string',_0x8119('0x68'),_0x8119('0x69'),_0x8119('0x6a'),_0x8119('0x6b'),_0x8119('0x6c'),_0x8119('0x6d')];if(_0x3f9a50){_['remove'](_0x3f9a50['fields'],function(_0x4fc1cb){return _0x13a7c8[_0x8119('0x6e')](_0x4fc1cb[_0x8119('0x27')])||!_0x27266[_0x8119('0x6e')](_0x4fc1cb[_0x8119('0x3b')]);});return{'count':_0x3f9a50[_0x8119('0x33')][_0x8119('0x34')],'rows':_['map'](_0x3f9a50[_0x8119('0x33')],function(_0x5e98bc){return{'id':_0x5e98bc[_0x8119('0x27')],'name':_0x5e98bc[_0x8119('0x6f')],'custom':_0x5e98bc['custom'],'options':_0x5e98bc[_0x8119('0x70')]['length']>0x0?_['map'](_0x5e98bc[_0x8119('0x70')],function(_0x3b136a){return{'name':_0x3b136a['label'],'value':_0x3b136a[_0x8119('0x71')]};}):_0x5e98bc[_0x8119('0x3b')]==_0x8119('0x6a')?[{'name':_0x8119('0x72'),'value':_0x8119('0x73')},{'name':_0x8119('0x74'),'value':_0x8119('0x75')}]:[]};})};}})['then'](respondWithResult(_0x493f94,null))['catch'](function(_0x13471f){var _0x42ed0a=_0x101749[_0x8119('0x2e')][_0x8119('0x76')]?0x1f4:_0x13471f[_0x8119('0x77')]||0x1f4;logger[_0x8119('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x8119('0x53'),_0x42ed0a,JSON[_0x8119('0x78')](_0x13471f));delete _0x13471f[_0x8119('0x27')];if(_0x42ed0a===0x191){_0x42ed0a=0x190;}_0x493f94['status'](_0x42ed0a)[_0x8119('0x28')](_0x101749[_0x8119('0x2e')][_0x8119('0x76')]?{'message':_0x8119('0x79'),'statusCode':_0x13471f[_0x8119('0x77')]}:_0x13471f);});}; \ No newline at end of file +var _0x5fee=['Description','string','picklist','email','textarea','phone','includes','label','custom','picklistValues','value','boolean','true','False','false','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','SalesforceAccount','rawAttributes','fieldName','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','filters','create','body','find','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SalesforceConfiguration','SalesforceField','Task','clientId','username','password','remoteUri','slice','substring','Connection','clientSecret','login','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence'];(function(_0x2a78d9,_0x271b92){var _0x293145=function(_0x164b12){while(--_0x164b12){_0x2a78d9['push'](_0x2a78d9['shift']());}};_0x293145(++_0x271b92);}(_0x5fee,0x101));var _0xe5fe=function(_0x6eab79,_0x4629a7){_0x6eab79=_0x6eab79-0x0;var _0x1ee791=_0x5fee[_0x6eab79];return _0x1ee791;};'use strict';var emlformat=require(_0xe5fe('0x0'));var rimraf=require(_0xe5fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5fe('0x2'));var rp=require(_0xe5fe('0x3'));var moment=require(_0xe5fe('0x4'));var BPromise=require(_0xe5fe('0x5'));var Mustache=require(_0xe5fe('0x6'));var util=require(_0xe5fe('0x7'));var path=require(_0xe5fe('0x8'));var sox=require(_0xe5fe('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe5fe('0xa'));var jsforce=require(_0xe5fe('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe5fe('0xc'));var Papa=require(_0xe5fe('0xd'));var Redis=require(_0xe5fe('0xe'));var authService=require(_0xe5fe('0xf'));var qs=require(_0xe5fe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe5fe('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe5fe('0x12'))['db'];var integrations=require(_0xe5fe('0x13'));function respondWithStatusCode(_0x3f2353,_0x188a5c){_0x188a5c=_0x188a5c||0xcc;return function(_0x5e24d6){if(_0x5e24d6){return _0x3f2353['sendStatus'](_0x188a5c);}return _0x3f2353[_0xe5fe('0x14')](_0x188a5c)[_0xe5fe('0x15')]();};}function respondWithResult(_0x3145e0,_0x2bdf6f){_0x2bdf6f=_0x2bdf6f||0xc8;return function(_0x189eb3){if(_0x189eb3){return _0x3145e0[_0xe5fe('0x14')](_0x2bdf6f)[_0xe5fe('0x16')](_0x189eb3);}};}function respondWithFilteredResult(_0x14e09e,_0x580abd){return function(_0x345e40){if(_0x345e40){var _0x364533=typeof _0x580abd[_0xe5fe('0x17')]===_0xe5fe('0x18')&&typeof _0x580abd[_0xe5fe('0x19')]===_0xe5fe('0x18');var _0x210ac8=_0x345e40[_0xe5fe('0x1a')];var _0x9c971a=_0x364533?0x0:_0x580abd[_0xe5fe('0x17')];var _0x3053e4=_0x364533?_0x345e40[_0xe5fe('0x1a')]:_0x580abd[_0xe5fe('0x17')]+_0x580abd[_0xe5fe('0x19')];var _0x3bbe47;if(_0x3053e4>=_0x210ac8){_0x3053e4=_0x210ac8;_0x3bbe47=0xc8;}else{_0x3bbe47=0xce;}_0x14e09e[_0xe5fe('0x14')](_0x3bbe47);return _0x14e09e[_0xe5fe('0x1b')](_0xe5fe('0x1c'),_0x9c971a+'-'+_0x3053e4+'/'+_0x210ac8)[_0xe5fe('0x16')](_0x345e40);}return null;};}function patchUpdates(_0x45dd57){return function(_0x4119e8){try{jsonpatch[_0xe5fe('0x1d')](_0x4119e8,_0x45dd57,!![]);}catch(_0x10946f){return BPromise[_0xe5fe('0x1e')](_0x10946f);}return _0x4119e8['save']();};}function saveUpdates(_0xae956b,_0x3913bb){return function(_0xf5c60b){if(_0xf5c60b){return _0xf5c60b[_0xe5fe('0x1f')](_0xae956b)[_0xe5fe('0x20')](function(_0x2fda79){return _0x2fda79;});}return null;};}function removeEntity(_0x457d53,_0x7eb1e){return function(_0x2acb3e){if(_0x2acb3e){return _0x2acb3e[_0xe5fe('0x21')]()[_0xe5fe('0x20')](function(){_0x457d53[_0xe5fe('0x14')](0xcc)[_0xe5fe('0x15')]();});}};}function handleEntityNotFound(_0x57846,_0x39e65c){return function(_0xbe5528){if(!_0xbe5528){_0x57846[_0xe5fe('0x22')](0x194);}return _0xbe5528;};}function handleError(_0x3eca02,_0x2aa201){_0x2aa201=_0x2aa201||0x1f4;return function(_0x5bb04e){logger['error'](_0x5bb04e['stack']);if(_0x5bb04e[_0xe5fe('0x23')]){delete _0x5bb04e[_0xe5fe('0x23')];}_0x3eca02['status'](_0x2aa201)[_0xe5fe('0x24')](_0x5bb04e);};}exports['index']=function(_0x9aff2,_0x512c3e){var _0x3b9af8={},_0x36a4d3={},_0x1594cb={'count':0x0,'rows':[]};var _0x2bfd07=_['map'](db[_0xe5fe('0x25')][_0xe5fe('0x26')],function(_0x56beb5){return{'name':_0x56beb5[_0xe5fe('0x27')],'type':_0x56beb5[_0xe5fe('0x28')]['key']};});_0x36a4d3['model']=_[_0xe5fe('0x29')](_0x2bfd07,_0xe5fe('0x23'));_0x36a4d3[_0xe5fe('0x2a')]=_[_0xe5fe('0x2b')](_0x9aff2[_0xe5fe('0x2a')]);_0x36a4d3['filters']=_[_0xe5fe('0x2c')](_0x36a4d3[_0xe5fe('0x2d')],_0x36a4d3['query']);_0x3b9af8['attributes']=_[_0xe5fe('0x2c')](_0x36a4d3[_0xe5fe('0x2d')],qs['fields'](_0x9aff2['query'][_0xe5fe('0x2e')]));_0x3b9af8[_0xe5fe('0x2f')]=_0x3b9af8['attributes'][_0xe5fe('0x30')]?_0x3b9af8[_0xe5fe('0x2f')]:_0x36a4d3[_0xe5fe('0x2d')];if(!_0x9aff2[_0xe5fe('0x2a')][_0xe5fe('0x31')](_0xe5fe('0x32'))){_0x3b9af8['limit']=qs[_0xe5fe('0x19')](_0x9aff2['query']['limit']);_0x3b9af8[_0xe5fe('0x17')]=qs[_0xe5fe('0x17')](_0x9aff2[_0xe5fe('0x2a')][_0xe5fe('0x17')]);}_0x3b9af8['order']=qs['sort'](_0x9aff2['query'][_0xe5fe('0x33')]);_0x3b9af8[_0xe5fe('0x34')]=qs['filters'](_[_0xe5fe('0x35')](_0x9aff2[_0xe5fe('0x2a')],_0x36a4d3['filters']),_0x2bfd07);if(_0x9aff2[_0xe5fe('0x2a')][_0xe5fe('0x36')]){_0x3b9af8[_0xe5fe('0x34')]=_[_0xe5fe('0x37')](_0x3b9af8[_0xe5fe('0x34')],{'$or':_[_0xe5fe('0x29')](_0x2bfd07,function(_0x1b03ed){if(_0x1b03ed[_0xe5fe('0x28')]!==_0xe5fe('0x38')){var _0x17e644={};_0x17e644[_0x1b03ed['name']]={'$like':'%'+_0x9aff2['query'][_0xe5fe('0x36')]+'%'};return _0x17e644;}})});}_0x3b9af8=_[_0xe5fe('0x37')]({},_0x3b9af8,_0x9aff2[_0xe5fe('0x39')]);var _0x47d300={'where':_0x3b9af8[_0xe5fe('0x34')]};return db['SalesforceAccount'][_0xe5fe('0x1a')](_0x47d300)[_0xe5fe('0x20')](function(_0x58ff51){_0x1594cb[_0xe5fe('0x1a')]=_0x58ff51;if(_0x9aff2[_0xe5fe('0x2a')][_0xe5fe('0x3a')]){_0x3b9af8[_0xe5fe('0x3b')]=[{'all':!![]}];}return db[_0xe5fe('0x25')][_0xe5fe('0x3c')](_0x3b9af8);})[_0xe5fe('0x20')](function(_0x2a8a81){_0x1594cb[_0xe5fe('0x3d')]=_0x2a8a81;return _0x1594cb;})[_0xe5fe('0x20')](respondWithFilteredResult(_0x512c3e,_0x3b9af8))[_0xe5fe('0x3e')](handleError(_0x512c3e,null));};exports[_0xe5fe('0x3f')]=function(_0x407751,_0x31b049){var _0x12cb64={'raw':![],'where':{'id':_0x407751['params']['id']}},_0x27f185={};_0x27f185['model']=_[_0xe5fe('0x2b')](db['SalesforceAccount']['rawAttributes']);_0x27f185[_0xe5fe('0x2a')]=_['keys'](_0x407751[_0xe5fe('0x2a')]);_0x27f185[_0xe5fe('0x40')]=_[_0xe5fe('0x2c')](_0x27f185[_0xe5fe('0x2d')],_0x27f185['query']);_0x12cb64[_0xe5fe('0x2f')]=_[_0xe5fe('0x2c')](_0x27f185[_0xe5fe('0x2d')],qs[_0xe5fe('0x2e')](_0x407751[_0xe5fe('0x2a')][_0xe5fe('0x2e')]));_0x12cb64[_0xe5fe('0x2f')]=_0x12cb64[_0xe5fe('0x2f')]['length']?_0x12cb64[_0xe5fe('0x2f')]:_0x27f185[_0xe5fe('0x2d')];if(_0x407751[_0xe5fe('0x2a')][_0xe5fe('0x3a')]){_0x12cb64[_0xe5fe('0x3b')]=[{'all':!![]}];}_0x12cb64=_['merge']({},_0x12cb64,_0x407751['options']);return db[_0xe5fe('0x25')]['find'](_0x12cb64)[_0xe5fe('0x20')](handleEntityNotFound(_0x31b049,null))[_0xe5fe('0x20')](respondWithResult(_0x31b049,null))['catch'](handleError(_0x31b049,null));};exports[_0xe5fe('0x41')]=function(_0x1ee2b3,_0x268cca){return db[_0xe5fe('0x25')][_0xe5fe('0x41')](_0x1ee2b3['body'],{})[_0xe5fe('0x20')](respondWithResult(_0x268cca,0xc9))[_0xe5fe('0x3e')](handleError(_0x268cca,null));};exports[_0xe5fe('0x1f')]=function(_0x51e070,_0x4c7fb3){if(_0x51e070[_0xe5fe('0x42')]['id']){delete _0x51e070['body']['id'];}return db[_0xe5fe('0x25')][_0xe5fe('0x43')]({'where':{'id':_0x51e070[_0xe5fe('0x44')]['id']}})[_0xe5fe('0x20')](handleEntityNotFound(_0x4c7fb3,null))[_0xe5fe('0x20')](saveUpdates(_0x51e070['body'],null))[_0xe5fe('0x20')](respondWithResult(_0x4c7fb3,null))[_0xe5fe('0x3e')](handleError(_0x4c7fb3,null));};exports[_0xe5fe('0x21')]=function(_0x139d99,_0x29036a){return db[_0xe5fe('0x25')]['find']({'where':{'id':_0x139d99[_0xe5fe('0x44')]['id']}})[_0xe5fe('0x20')](handleEntityNotFound(_0x29036a,null))[_0xe5fe('0x20')](removeEntity(_0x29036a,null))[_0xe5fe('0x3e')](handleError(_0x29036a,null));};exports[_0xe5fe('0x45')]=function(_0x2c8764,_0x184912,_0x412d64){var _0x2437d5={};var _0x55a4cd={};var _0x41f576;var _0x505b27;return db['SalesforceAccount'][_0xe5fe('0x46')]({'where':{'id':_0x2c8764[_0xe5fe('0x44')]['id']}})[_0xe5fe('0x20')](handleEntityNotFound(_0x184912,null))[_0xe5fe('0x20')](function(_0x51dbe2){if(_0x51dbe2){_0x41f576=_0x51dbe2;_0x55a4cd[_0xe5fe('0x2d')]=_[_0xe5fe('0x2b')](db['SalesforceConfiguration']['rawAttributes']);_0x55a4cd[_0xe5fe('0x2a')]=_[_0xe5fe('0x2b')](_0x2c8764[_0xe5fe('0x2a')]);_0x55a4cd['filters']=_['intersection'](_0x55a4cd['model'],_0x55a4cd[_0xe5fe('0x2a')]);_0x2437d5[_0xe5fe('0x2f')]=_[_0xe5fe('0x2c')](_0x55a4cd[_0xe5fe('0x2d')],qs[_0xe5fe('0x2e')](_0x2c8764[_0xe5fe('0x2a')][_0xe5fe('0x2e')]));_0x2437d5['attributes']=_0x2437d5[_0xe5fe('0x2f')][_0xe5fe('0x30')]?_0x2437d5[_0xe5fe('0x2f')]:_0x55a4cd[_0xe5fe('0x2d')];_0x2437d5['order']=qs[_0xe5fe('0x33')](_0x2c8764[_0xe5fe('0x2a')][_0xe5fe('0x33')]);_0x2437d5[_0xe5fe('0x34')]=qs[_0xe5fe('0x40')](_[_0xe5fe('0x35')](_0x2c8764['query'],_0x55a4cd['filters']));if(_0x2c8764[_0xe5fe('0x2a')][_0xe5fe('0x36')]){_0x2437d5[_0xe5fe('0x34')]=_[_0xe5fe('0x37')](_0x2437d5[_0xe5fe('0x34')],{'$or':_['map'](_0x2437d5[_0xe5fe('0x2f')],function(_0x47411d){var _0x4bdd8f={};_0x4bdd8f[_0x47411d]={'$like':'%'+_0x2c8764[_0xe5fe('0x2a')][_0xe5fe('0x36')]+'%'};return _0x4bdd8f;})});}_0x2437d5=_[_0xe5fe('0x37')]({},_0x2437d5,_0x2c8764[_0xe5fe('0x39')]);return _0x41f576[_0xe5fe('0x45')](_0x2437d5);}})[_0xe5fe('0x20')](function(_0x52e6d0){if(_0x52e6d0){_0x505b27=_0x52e6d0[_0xe5fe('0x30')];if(!_0x2c8764[_0xe5fe('0x2a')]['hasOwnProperty'](_0xe5fe('0x32'))){_0x2437d5[_0xe5fe('0x19')]=qs['limit'](_0x2c8764[_0xe5fe('0x2a')][_0xe5fe('0x19')]);_0x2437d5[_0xe5fe('0x17')]=qs[_0xe5fe('0x17')](_0x2c8764['query'][_0xe5fe('0x17')]);}return _0x41f576[_0xe5fe('0x45')](_0x2437d5);}})['then'](function(_0x58a776){if(_0x58a776){return _0x58a776?{'count':_0x505b27,'rows':_0x58a776}:null;}})[_0xe5fe('0x20')](respondWithResult(_0x184912,null))[_0xe5fe('0x3e')](handleError(_0x184912,null));};exports[_0xe5fe('0x47')]=function(_0x12fc98,_0x491d5b,_0x232960){if(_0x12fc98[_0xe5fe('0x42')]['id']){delete _0x12fc98[_0xe5fe('0x42')]['id'];}return db['SalesforceAccount'][_0xe5fe('0x46')]({'where':{'id':_0x12fc98['params']['id']}})[_0xe5fe('0x20')](handleEntityNotFound(_0x491d5b,null))[_0xe5fe('0x20')](function(_0x74a709){if(_0x74a709){_0x12fc98['body'][_0xe5fe('0x48')]=_0x74a709['id'];_0x12fc98['body'][_0xe5fe('0x49')]=integrations[_0xe5fe('0x4a')](_0x12fc98['body']['channel'],_0x12fc98[_0xe5fe('0x42')]['type']);_0x12fc98['body'][_0xe5fe('0x4b')]=integrations['getDescriptions'](_0x12fc98[_0xe5fe('0x42')][_0xe5fe('0x4c')],_0x12fc98['body']['type']);return db[_0xe5fe('0x4d')][_0xe5fe('0x41')](_0x12fc98[_0xe5fe('0x42')],{'include':[{'model':db[_0xe5fe('0x4e')],'as':_0xe5fe('0x49')},{'model':db[_0xe5fe('0x4e')],'as':_0xe5fe('0x4b')}]});}return null;})['then'](respondWithResult(_0x491d5b,null))[_0xe5fe('0x3e')](handleError(_0x491d5b,null));};exports['getFields']=function(_0x3c3e68,_0x39a299,_0x2bb052){var _0x132aef;var _0x256d6e='';var _0xabdfb0=_0xe5fe('0x4f');return db[_0xe5fe('0x25')][_0xe5fe('0x46')]({'where':{'id':_0x3c3e68['params']['id']},'attributes':['id','remoteUri',_0xe5fe('0x50'),'clientSecret',_0xe5fe('0x51'),_0xe5fe('0x52'),'securityToken']})[_0xe5fe('0x20')](handleEntityNotFound(_0x39a299,null))[_0xe5fe('0x20')](function(_0x2d80dd){if(_0x2d80dd){_0x256d6e=_0x2d80dd[_0xe5fe('0x53')];var _0x52d03d=_0x256d6e[_0xe5fe('0x54')](-0x1);if(_0x52d03d==='/'){_0x256d6e=_0x256d6e[_0xe5fe('0x55')](0x0,_0x256d6e['lastIndexOf'](_0x52d03d));}_0x132aef=new jsforce[(_0xe5fe('0x56'))]({'oauth2':{'loginUrl':_0x256d6e,'clientId':_0x2d80dd[_0xe5fe('0x50')],'clientSecret':_0x2d80dd[_0xe5fe('0x57')]}});return _0x132aef[_0xe5fe('0x58')](_0x2d80dd[_0xe5fe('0x51')],_0x2d80dd['password']['concat'](_0x2d80dd[_0xe5fe('0x59')]));}})[_0xe5fe('0x20')](function(_0x364873){if(_0x364873){if(!_[_0xe5fe('0x5a')](_0x3c3e68[_0xe5fe('0x2a')]['ticketType'])){_0xabdfb0=_0x3c3e68['query'][_0xe5fe('0x5b')];}return _0x132aef[_0xe5fe('0x5c')](_0xabdfb0)[_0xe5fe('0x5d')]();}})['then'](function(_0x59d375){var _0x550a14=[_0xe5fe('0x5e'),_0xe5fe('0x5f'),'IsReminderSet',_0xe5fe('0x60'),'Subject',_0xe5fe('0x61')];var _0x26c159=[_0xe5fe('0x62'),'int',_0xe5fe('0x63'),'boolean',_0xe5fe('0x64'),_0xe5fe('0x65'),_0xe5fe('0x66')];if(_0x59d375){_['remove'](_0x59d375[_0xe5fe('0x2e')],function(_0x954461){return _0x550a14[_0xe5fe('0x67')](_0x954461[_0xe5fe('0x23')])||!_0x26c159[_0xe5fe('0x67')](_0x954461['type']);});return{'count':_0x59d375[_0xe5fe('0x2e')][_0xe5fe('0x30')],'rows':_[_0xe5fe('0x29')](_0x59d375[_0xe5fe('0x2e')],function(_0x254887){return{'id':_0x254887[_0xe5fe('0x23')],'name':_0x254887[_0xe5fe('0x68')],'custom':_0x254887[_0xe5fe('0x69')],'options':_0x254887['picklistValues'][_0xe5fe('0x30')]>0x0?_[_0xe5fe('0x29')](_0x254887[_0xe5fe('0x6a')],function(_0x2b6125){return{'name':_0x2b6125[_0xe5fe('0x68')],'value':_0x2b6125[_0xe5fe('0x6b')]};}):_0x254887['type']==_0xe5fe('0x6c')?[{'name':'True','value':_0xe5fe('0x6d')},{'name':_0xe5fe('0x6e'),'value':_0xe5fe('0x6f')}]:[]};})};}})[_0xe5fe('0x20')](respondWithResult(_0x39a299,null))[_0xe5fe('0x3e')](function(_0x59300b){var _0x2cb12e=_0x3c3e68[_0xe5fe('0x2a')]['test']?0x1f4:_0x59300b[_0xe5fe('0x70')]||0x1f4;logger[_0xe5fe('0x71')](_0xe5fe('0x72'),_0xe5fe('0x73'),_0x2cb12e,JSON[_0xe5fe('0x74')](_0x59300b));delete _0x59300b['name'];if(_0x2cb12e===0x191){_0x2cb12e=0x190;}_0x39a299['status'](_0x2cb12e)['send'](_0x3c3e68[_0xe5fe('0x2a')][_0xe5fe('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x59300b[_0xe5fe('0x70')]}:_0x59300b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d26aeaf..578a8b3 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 _0x9b7e=['exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x4240dc,_0x4fd368){var _0xed1b87=function(_0x3f9d24){while(--_0x3f9d24){_0x4240dc['push'](_0x4240dc['shift']());}};_0xed1b87(++_0x4fd368);}(_0x9b7e,0x12e));var _0xe9b7=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0x9b7e[_0x398d85];return _0x33c2bb;};'use strict';var _=require('lodash');var util=require(_0xe9b7('0x0'));var logger=require(_0xe9b7('0x1'))(_0xe9b7('0x2'));var moment=require(_0xe9b7('0x3'));var BPromise=require(_0xe9b7('0x4'));var rp=require(_0xe9b7('0x5'));var fs=require('fs');var path=require(_0xe9b7('0x6'));var rimraf=require(_0xe9b7('0x7'));var config=require(_0xe9b7('0x8'));var attributes=require(_0xe9b7('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xe9b7('0xa')]=function(_0x52cc67,_0x33c476){return _0x52cc67['define'](_0xe9b7('0xb'),attributes,{'tableName':_0xe9b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x130d=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x5a05cc,_0x493a92){var _0x3a9307=function(_0xd51689){while(--_0xd51689){_0x5a05cc['push'](_0x5a05cc['shift']());}};_0x3a9307(++_0x493a92);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));var integrations=require(_0xd130('0x9'));module[_0xd130('0xa')]=function(_0x4689a8,_0x44c215){return _0x4689a8[_0xd130('0xb')](_0xd130('0xc'),attributes,{'tableName':_0xd130('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 7fb44cd..ef8ea42 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 _0x9146=['result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','include','map','model','find','raw','where','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x584d78,_0x33f82f){var _0x23707f=function(_0x355f1a){while(--_0x355f1a){_0x584d78['push'](_0x584d78['shift']());}};_0x23707f(++_0x33f82f);}(_0x9146,0x16e));var _0x6914=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x9146[_0x212bf5];return _0xfcad21;};'use strict';var _=require(_0x6914('0x0'));var util=require(_0x6914('0x1'));var moment=require(_0x6914('0x2'));var BPromise=require(_0x6914('0x3'));var rs=require(_0x6914('0x4'));var fs=require('fs');var Redis=require(_0x6914('0x5'));var db=require(_0x6914('0x6'))['db'];var utils=require(_0x6914('0x7'));var logger=require(_0x6914('0x8'))(_0x6914('0x9'));var config=require(_0x6914('0xa'));var jayson=require(_0x6914('0xb'));var client=jayson[_0x6914('0xc')][_0x6914('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2e275e,_0x1b0be6,_0x21061a){return new BPromise(function(_0x3c493c,_0x31eab0){return client[_0x6914('0xe')](_0x2e275e,_0x21061a)[_0x6914('0xf')](function(_0x5208d2){logger[_0x6914('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x1b0be6,_0x6914('0x11'));logger[_0x6914('0x12')](_0x6914('0x13'),_0x1b0be6,_0x6914('0x11'),JSON[_0x6914('0x14')](_0x5208d2));if(_0x5208d2[_0x6914('0x15')]){if(_0x5208d2[_0x6914('0x15')]['code']===0x1f4){logger[_0x6914('0x15')](_0x6914('0x16'),_0x1b0be6,_0x5208d2['error']['message']);return _0x31eab0(_0x5208d2[_0x6914('0x15')][_0x6914('0x17')]);}logger['error'](_0x6914('0x16'),_0x1b0be6,_0x5208d2[_0x6914('0x15')]['message']);return _0x3c493c(_0x5208d2[_0x6914('0x15')][_0x6914('0x17')]);}else{logger[_0x6914('0x10')](_0x6914('0x16'),_0x1b0be6,_0x6914('0x11'));_0x3c493c(_0x5208d2[_0x6914('0x18')][_0x6914('0x17')]);}})[_0x6914('0x19')](function(_0x2c6f62){logger[_0x6914('0x15')]('SalesforceAccount,\x20%s,\x20%s',_0x1b0be6,_0x2c6f62);_0x31eab0(_0x2c6f62);});});}exports[_0x6914('0x1a')]=function(_0x3f05c2){var _0x546dbf=this;return new Promise(function(_0x33cc11,_0x59e93f){return db[_0x6914('0x1b')][_0x6914('0x1c')]({'raw':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2[_0x6914('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3f05c2['options']?_0x3f05c2['options']['where']||null:null,'attributes':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2[_0x6914('0x1d')][_0x6914('0x1e')]||null:null,'limit':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2['options'][_0x6914('0x1f')]||null:null,'include':_0x3f05c2[_0x6914('0x1d')]?_0x3f05c2[_0x6914('0x1d')][_0x6914('0x20')]?_[_0x6914('0x21')](_0x3f05c2[_0x6914('0x1d')][_0x6914('0x20')],function(_0xe2441e){return{'model':db[_0xe2441e[_0x6914('0x22')]],'as':_0xe2441e['as'],'attributes':_0xe2441e[_0x6914('0x1e')],'include':_0xe2441e[_0x6914('0x20')]?_[_0x6914('0x21')](_0xe2441e['include'],function(_0x44c5f0){return{'model':db[_0x44c5f0[_0x6914('0x22')]],'as':_0x44c5f0['as'],'attributes':_0x44c5f0[_0x6914('0x1e')],'include':_0x44c5f0[_0x6914('0x20')]?_[_0x6914('0x21')](_0x44c5f0[_0x6914('0x20')],function(_0x3ff653){return{'model':db[_0x3ff653[_0x6914('0x22')]],'as':_0x3ff653['as'],'attributes':_0x3ff653['attributes']};}):[]};}):[]};}):[]:[]})[_0x6914('0xf')](function(_0x354691){logger[_0x6914('0x10')]('GetSalesforceAccount',_0x3f05c2);logger[_0x6914('0x12')](_0x6914('0x1a'),_0x3f05c2,JSON[_0x6914('0x14')](_0x354691));_0x33cc11(_0x354691);})[_0x6914('0x19')](function(_0xb955cb){logger[_0x6914('0x15')](_0x6914('0x1a'),_0xb955cb[_0x6914('0x17')],_0x3f05c2);_0x59e93f(_0x546dbf[_0x6914('0x15')](0x1f4,_0xb955cb[_0x6914('0x17')]));});});};exports['ShowSalesforceAccount']=function(_0x28b820){var _0xddc405=this;return new Promise(function(_0x793483,_0x10533f){return db[_0x6914('0x1b')][_0x6914('0x23')]({'raw':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')][_0x6914('0x24')]===undefined?!![]:![]:!![],'where':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')][_0x6914('0x25')]||null:null,'attributes':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')][_0x6914('0x1e')]||null:null,'include':_0x28b820[_0x6914('0x1d')]?_0x28b820[_0x6914('0x1d')]['include']?_['map'](_0x28b820['options']['include'],function(_0x392a0a){return{'model':db[_0x392a0a[_0x6914('0x22')]],'as':_0x392a0a['as'],'attributes':_0x392a0a[_0x6914('0x1e')],'include':_0x392a0a[_0x6914('0x20')]?_[_0x6914('0x21')](_0x392a0a[_0x6914('0x20')],function(_0x86da22){return{'model':db[_0x86da22[_0x6914('0x22')]],'as':_0x86da22['as'],'attributes':_0x86da22[_0x6914('0x1e')],'include':_0x86da22[_0x6914('0x20')]?_[_0x6914('0x21')](_0x86da22[_0x6914('0x20')],function(_0x23b1b0){return{'model':db[_0x23b1b0[_0x6914('0x22')]],'as':_0x23b1b0['as'],'attributes':_0x23b1b0[_0x6914('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6914('0xf')](function(_0x572924){logger['info'](_0x6914('0x26'),_0x28b820);logger[_0x6914('0x12')](_0x6914('0x26'),_0x28b820,JSON[_0x6914('0x14')](_0x572924));_0x793483(_0x572924);})[_0x6914('0x19')](function(_0x233e72){logger[_0x6914('0x15')](_0x6914('0x26'),_0x233e72[_0x6914('0x17')],_0x28b820);_0x10533f(_0xddc405[_0x6914('0x15')](0x1f4,_0x233e72[_0x6914('0x17')]));});});}; \ No newline at end of file +var _0xfcf0=['request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','SalesforceAccount','find','ShowSalesforceAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x871700,_0x1a652c){var _0x149101=function(_0x367087){while(--_0x367087){_0x871700['push'](_0x871700['shift']());}};_0x149101(++_0x1a652c);}(_0xfcf0,0x138));var _0x0fcf=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0xfcf0[_0x233716];return _0x302298;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['SalesforceAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowSalesforceAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowSalesforceAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0452ee8..8c55881 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4af1bd,_0x28720b){var _0xdff0fd=function(_0x351e40){while(--_0x351e40){_0x4af1bd['push'](_0x4af1bd['shift']());}};_0xdff0fd(++_0x28720b);}(_0xadb5,0xad));var _0x5adb=function(_0x1bfa0a,_0x44ea12){_0x1bfa0a=_0x1bfa0a-0x0;var _0x8adf32=_0xadb5[_0x1bfa0a];return _0x8adf32;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _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(_0x32415d,_0x5f1db1){var _0xe66e27=function(_0x9c9860){while(--_0x9c9860){_0x32415d['push'](_0x32415d['shift']());}};_0xe66e27(++_0x5f1db1);}(_0x7a54,0x106));var _0x47a5=function(_0x42f4ab,_0x231222){_0x42f4ab=_0x42f4ab-0x0;var _0x70d9c=_0x7a54[_0x42f4ab];return _0x70d9c;};'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 b823125..518a43a 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 _0x30aa=['account','sequelize','exports','STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead'];(function(_0x4fbd6e,_0x297e2c){var _0x4ccaae=function(_0x1c3c02){while(--_0x1c3c02){_0x4fbd6e['push'](_0x4fbd6e['shift']());}};_0x4ccaae(++_0x297e2c);}(_0x30aa,0x141));var _0xa30a=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x30aa[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xa30a('0x0'));module[_0xa30a('0x1')]={'name':{'type':Sequelize[_0xa30a('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa30a('0x3')](_0xa30a('0x4'),'Case'),'defaultValue':_0xa30a('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xa30a('0x5'),_0xa30a('0x6'),_0xa30a('0x7'),_0xa30a('0x8'),'account'),'defaultValue':_0xa30a('0x5')},'moduleCreate':{'type':Sequelize[_0xa30a('0x3')]('nothing',_0xa30a('0x6'),_0xa30a('0x7'),_0xa30a('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa30a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa30a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xa30a('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c2c=['Task','ENUM','lead','account','contact_lead','nothing','contact','STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc9c2('0x0'));module[_0xc9c2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xc9c2('0x2'),'Case'),'defaultValue':_0xc9c2('0x2')},'moduleSearch':{'type':Sequelize[_0xc9c2('0x3')]('contact_lead','contact',_0xc9c2('0x4'),'account_contact_lead',_0xc9c2('0x5')),'defaultValue':_0xc9c2('0x6')},'moduleCreate':{'type':Sequelize[_0xc9c2('0x3')](_0xc9c2('0x7'),_0xc9c2('0x8'),_0xc9c2('0x4'),_0xc9c2('0x5')),'defaultValue':_0xc9c2('0x4')},'leadId':{'type':Sequelize[_0xc9c2('0x9')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xc9c2('0x9')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 87e5f07..cae73d6 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 _0xf5ed=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1604db,_0x2766ea){var _0x5e52f0=function(_0x36c317){while(--_0x36c317){_0x1604db['push'](_0x1604db['shift']());}};_0x5e52f0(++_0x2766ea);}(_0xf5ed,0x154));var _0xdf5e=function(_0x2aa81e,_0x3c234f){_0x2aa81e=_0x2aa81e-0x0;var _0x3520ff=_0xf5ed[_0x2aa81e];return _0x3520ff;};'use strict';var emlformat=require(_0xdf5e('0x0'));var rimraf=require(_0xdf5e('0x1'));var zipdir=require(_0xdf5e('0x2'));var jsonpatch=require(_0xdf5e('0x3'));var rp=require('request-promise');var moment=require(_0xdf5e('0x4'));var BPromise=require(_0xdf5e('0x5'));var Mustache=require(_0xdf5e('0x6'));var util=require(_0xdf5e('0x7'));var path=require(_0xdf5e('0x8'));var sox=require(_0xdf5e('0x9'));var csv=require(_0xdf5e('0xa'));var ejs=require(_0xdf5e('0xb'));var fs=require('fs');var fs_extra=require(_0xdf5e('0xc'));var _=require(_0xdf5e('0xd'));var squel=require(_0xdf5e('0xe'));var crypto=require('crypto');var jsforce=require(_0xdf5e('0xf'));var deskjs=require(_0xdf5e('0x10'));var toCsv=require(_0xdf5e('0xa'));var querystring=require(_0xdf5e('0x11'));var Papa=require(_0xdf5e('0x12'));var Redis=require(_0xdf5e('0x13'));var authService=require(_0xdf5e('0x14'));var qs=require(_0xdf5e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf5e('0x16'));var logger=require(_0xdf5e('0x17'))(_0xdf5e('0x18'));var utils=require('../../config/utils');var config=require(_0xdf5e('0x19'));var licenseUtil=require(_0xdf5e('0x1a'));var db=require(_0xdf5e('0x1b'))['db'];function respondWithStatusCode(_0x1572ad,_0x12ce51){_0x12ce51=_0x12ce51||0xcc;return function(_0x59ac78){if(_0x59ac78){return _0x1572ad[_0xdf5e('0x1c')](_0x12ce51);}return _0x1572ad[_0xdf5e('0x1d')](_0x12ce51)[_0xdf5e('0x1e')]();};}function respondWithResult(_0x5b90c3,_0x18b30c){_0x18b30c=_0x18b30c||0xc8;return function(_0x506355){if(_0x506355){return _0x5b90c3['status'](_0x18b30c)[_0xdf5e('0x1f')](_0x506355);}};}function respondWithFilteredResult(_0x3018df,_0x175ac1){return function(_0x142509){if(_0x142509){var _0x4511b3=typeof _0x175ac1[_0xdf5e('0x20')]===_0xdf5e('0x21')&&typeof _0x175ac1[_0xdf5e('0x22')]===_0xdf5e('0x21');var _0x4acb8b=_0x142509['count'];var _0x3204b4=_0x4511b3?0x0:_0x175ac1[_0xdf5e('0x20')];var _0x31978f=_0x4511b3?_0x142509[_0xdf5e('0x23')]:_0x175ac1[_0xdf5e('0x20')]+_0x175ac1['limit'];var _0x1d81b0;if(_0x31978f>=_0x4acb8b){_0x31978f=_0x4acb8b;_0x1d81b0=0xc8;}else{_0x1d81b0=0xce;}_0x3018df[_0xdf5e('0x1d')](_0x1d81b0);return _0x3018df[_0xdf5e('0x24')](_0xdf5e('0x25'),_0x3204b4+'-'+_0x31978f+'/'+_0x4acb8b)[_0xdf5e('0x1f')](_0x142509);}return null;};}function patchUpdates(_0x56db18){return function(_0x160a86){try{jsonpatch[_0xdf5e('0x26')](_0x160a86,_0x56db18,!![]);}catch(_0x28ad89){return BPromise[_0xdf5e('0x27')](_0x28ad89);}return _0x160a86[_0xdf5e('0x28')]();};}function saveUpdates(_0x1e7c83,_0x1f46c4){return function(_0x5f28db){if(_0x5f28db){return _0x5f28db[_0xdf5e('0x29')](_0x1e7c83)[_0xdf5e('0x2a')](function(_0xd17eeb){return _0xd17eeb;});}return null;};}function removeEntity(_0x220475,_0x1c4c70){return function(_0x2bb5e7){if(_0x2bb5e7){return _0x2bb5e7[_0xdf5e('0x2b')]()[_0xdf5e('0x2a')](function(){_0x220475['status'](0xcc)[_0xdf5e('0x1e')]();});}};}function handleEntityNotFound(_0x23aae7,_0x3750df){return function(_0x2ee8f6){if(!_0x2ee8f6){_0x23aae7[_0xdf5e('0x1c')](0x194);}return _0x2ee8f6;};}function handleError(_0x7dcb24,_0x2b6428){_0x2b6428=_0x2b6428||0x1f4;return function(_0x3b1406){logger[_0xdf5e('0x2c')](_0x3b1406[_0xdf5e('0x2d')]);if(_0x3b1406[_0xdf5e('0x2e')]){delete _0x3b1406[_0xdf5e('0x2e')];}_0x7dcb24[_0xdf5e('0x1d')](_0x2b6428)[_0xdf5e('0x2f')](_0x3b1406);};}exports[_0xdf5e('0x30')]=function(_0x93ff8,_0x5cf967){var _0x673ec6={},_0x4f4163={},_0x15d100={'count':0x0,'rows':[]};var _0x7d972=_[_0xdf5e('0x31')](db[_0xdf5e('0x32')][_0xdf5e('0x33')],function(_0x4997df){return{'name':_0x4997df[_0xdf5e('0x34')],'type':_0x4997df['type'][_0xdf5e('0x35')]};});_0x4f4163['model']=_[_0xdf5e('0x31')](_0x7d972,_0xdf5e('0x2e'));_0x4f4163[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x93ff8[_0xdf5e('0x36')]);_0x4f4163['filters']=_[_0xdf5e('0x38')](_0x4f4163[_0xdf5e('0x39')],_0x4f4163[_0xdf5e('0x36')]);_0x673ec6[_0xdf5e('0x3a')]=_[_0xdf5e('0x38')](_0x4f4163[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0x93ff8['query']['fields']));_0x673ec6[_0xdf5e('0x3a')]=_0x673ec6[_0xdf5e('0x3a')][_0xdf5e('0x3c')]?_0x673ec6[_0xdf5e('0x3a')]:_0x4f4163[_0xdf5e('0x39')];if(!_0x93ff8['query']['hasOwnProperty'](_0xdf5e('0x3d'))){_0x673ec6[_0xdf5e('0x22')]=qs[_0xdf5e('0x22')](_0x93ff8['query'][_0xdf5e('0x22')]);_0x673ec6[_0xdf5e('0x20')]=qs[_0xdf5e('0x20')](_0x93ff8[_0xdf5e('0x36')]['offset']);}_0x673ec6[_0xdf5e('0x3e')]=qs[_0xdf5e('0x3f')](_0x93ff8[_0xdf5e('0x36')]['sort']);_0x673ec6[_0xdf5e('0x40')]=qs[_0xdf5e('0x41')](_[_0xdf5e('0x42')](_0x93ff8[_0xdf5e('0x36')],_0x4f4163[_0xdf5e('0x41')]),_0x7d972);if(_0x93ff8[_0xdf5e('0x36')][_0xdf5e('0x43')]){_0x673ec6[_0xdf5e('0x40')]=_[_0xdf5e('0x44')](_0x673ec6['where'],{'$or':_[_0xdf5e('0x31')](_0x7d972,function(_0xa51e41){if(_0xa51e41[_0xdf5e('0x45')]!=='VIRTUAL'){var _0x297771={};_0x297771[_0xa51e41[_0xdf5e('0x2e')]]={'$like':'%'+_0x93ff8['query'][_0xdf5e('0x43')]+'%'};return _0x297771;}})});}_0x673ec6=_[_0xdf5e('0x44')]({},_0x673ec6,_0x93ff8[_0xdf5e('0x46')]);var _0x234fbb={'where':_0x673ec6['where']};return db[_0xdf5e('0x32')][_0xdf5e('0x23')](_0x234fbb)['then'](function(_0x3c23ab){_0x15d100[_0xdf5e('0x23')]=_0x3c23ab;if(_0x93ff8[_0xdf5e('0x36')][_0xdf5e('0x47')]){_0x673ec6[_0xdf5e('0x48')]=[{'all':!![]}];}return db[_0xdf5e('0x32')][_0xdf5e('0x49')](_0x673ec6);})[_0xdf5e('0x2a')](function(_0x4c95dd){_0x15d100[_0xdf5e('0x4a')]=_0x4c95dd;return _0x15d100;})['then'](respondWithFilteredResult(_0x5cf967,_0x673ec6))[_0xdf5e('0x4b')](handleError(_0x5cf967,null));};exports[_0xdf5e('0x4c')]=function(_0xee5e0c,_0x23ca59){var _0x502d15={'raw':![],'where':{'id':_0xee5e0c[_0xdf5e('0x4d')]['id']}},_0x459932={};_0x459932['model']=_[_0xdf5e('0x37')](db['SalesforceConfiguration']['rawAttributes']);_0x459932[_0xdf5e('0x36')]=_['keys'](_0xee5e0c[_0xdf5e('0x36')]);_0x459932['filters']=_[_0xdf5e('0x38')](_0x459932[_0xdf5e('0x39')],_0x459932[_0xdf5e('0x36')]);_0x502d15[_0xdf5e('0x3a')]=_[_0xdf5e('0x38')](_0x459932[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0xee5e0c[_0xdf5e('0x36')][_0xdf5e('0x3b')]));_0x502d15[_0xdf5e('0x3a')]=_0x502d15[_0xdf5e('0x3a')]['length']?_0x502d15[_0xdf5e('0x3a')]:_0x459932[_0xdf5e('0x39')];if(_0xee5e0c[_0xdf5e('0x36')]['includeAll']){_0x502d15[_0xdf5e('0x48')]=[{'all':!![]}];}_0x502d15=_['merge']({},_0x502d15,_0xee5e0c['options']);return db[_0xdf5e('0x32')][_0xdf5e('0x4e')](_0x502d15)[_0xdf5e('0x2a')](handleEntityNotFound(_0x23ca59,null))[_0xdf5e('0x2a')](respondWithResult(_0x23ca59,null))[_0xdf5e('0x4b')](handleError(_0x23ca59,null));};exports['create']=function(_0x4266cf,_0x5cdc91){return db[_0xdf5e('0x32')][_0xdf5e('0x4f')](_0x4266cf[_0xdf5e('0x50')],{})[_0xdf5e('0x2a')](respondWithResult(_0x5cdc91,0xc9))[_0xdf5e('0x4b')](handleError(_0x5cdc91,null));};exports[_0xdf5e('0x29')]=function(_0x248e1c,_0x494280){if(_0x248e1c[_0xdf5e('0x50')]['id']){delete _0x248e1c[_0xdf5e('0x50')]['id'];}return db[_0xdf5e('0x32')][_0xdf5e('0x4e')]({'where':{'id':_0x248e1c[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x494280,null))[_0xdf5e('0x2a')](saveUpdates(_0x248e1c[_0xdf5e('0x50')],null))[_0xdf5e('0x2a')](respondWithResult(_0x494280,null))[_0xdf5e('0x4b')](handleError(_0x494280,null));};exports[_0xdf5e('0x2b')]=function(_0x4b1580,_0x50b77a){return db[_0xdf5e('0x32')]['find']({'where':{'id':_0x4b1580[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x50b77a,null))[_0xdf5e('0x2a')](removeEntity(_0x50b77a,null))[_0xdf5e('0x4b')](handleError(_0x50b77a,null));};exports[_0xdf5e('0x51')]=function(_0x3c3df3,_0x427c0d,_0x49666f){var _0x1d9f23={};var _0x2a781e={};var _0x4e9d3e;var _0x390a85;return db[_0xdf5e('0x32')][_0xdf5e('0x52')]({'where':{'id':_0x3c3df3[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x427c0d,null))[_0xdf5e('0x2a')](function(_0x40285c){if(_0x40285c){_0x4e9d3e=_0x40285c;_0x2a781e['model']=_[_0xdf5e('0x37')](db['SalesforceField'][_0xdf5e('0x33')]);_0x2a781e[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x3c3df3[_0xdf5e('0x36')]);_0x2a781e[_0xdf5e('0x41')]=_[_0xdf5e('0x38')](_0x2a781e['model'],_0x2a781e['query']);_0x1d9f23['attributes']=_[_0xdf5e('0x38')](_0x2a781e['model'],qs[_0xdf5e('0x3b')](_0x3c3df3['query'][_0xdf5e('0x3b')]));_0x1d9f23['attributes']=_0x1d9f23[_0xdf5e('0x3a')][_0xdf5e('0x3c')]?_0x1d9f23[_0xdf5e('0x3a')]:_0x2a781e['model'];_0x1d9f23['order']=qs[_0xdf5e('0x3f')](_0x3c3df3[_0xdf5e('0x36')][_0xdf5e('0x3f')]);_0x1d9f23['where']=qs[_0xdf5e('0x41')](_[_0xdf5e('0x42')](_0x3c3df3['query'],_0x2a781e[_0xdf5e('0x41')]));if(_0x3c3df3[_0xdf5e('0x36')][_0xdf5e('0x43')]){_0x1d9f23['where']=_[_0xdf5e('0x44')](_0x1d9f23[_0xdf5e('0x40')],{'$or':_[_0xdf5e('0x31')](_0x1d9f23[_0xdf5e('0x3a')],function(_0x44d06b){var _0x34f7a8={};_0x34f7a8[_0x44d06b]={'$like':'%'+_0x3c3df3[_0xdf5e('0x36')]['filter']+'%'};return _0x34f7a8;})});}_0x1d9f23=_['merge']({},_0x1d9f23,_0x3c3df3[_0xdf5e('0x46')]);return _0x4e9d3e[_0xdf5e('0x51')](_0x1d9f23);}})['then'](function(_0x5e4551){if(_0x5e4551){_0x390a85=_0x5e4551['length'];if(!_0x3c3df3['query'][_0xdf5e('0x53')](_0xdf5e('0x3d'))){_0x1d9f23[_0xdf5e('0x22')]=qs[_0xdf5e('0x22')](_0x3c3df3[_0xdf5e('0x36')][_0xdf5e('0x22')]);_0x1d9f23[_0xdf5e('0x20')]=qs['offset'](_0x3c3df3[_0xdf5e('0x36')]['offset']);}return _0x4e9d3e['getFields'](_0x1d9f23);}})['then'](function(_0x57eb2f){if(_0x57eb2f){return _0x57eb2f?{'count':_0x390a85,'rows':_0x57eb2f}:null;}})[_0xdf5e('0x2a')](respondWithResult(_0x427c0d,null))['catch'](handleError(_0x427c0d,null));};exports[_0xdf5e('0x54')]=function(_0x3f42e4,_0x58abae,_0x2cdfa3){var _0xab0ee2={};var _0x14e8d8={};var _0x5ad561;var _0x4574cc;return db['SalesforceConfiguration'][_0xdf5e('0x52')]({'where':{'id':_0x3f42e4['params']['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x58abae,null))[_0xdf5e('0x2a')](function(_0x4ae041){if(_0x4ae041){_0x5ad561=_0x4ae041;_0x14e8d8['model']=_['keys'](db[_0xdf5e('0x55')][_0xdf5e('0x33')]);_0x14e8d8[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x3f42e4['query']);_0x14e8d8['filters']=_[_0xdf5e('0x38')](_0x14e8d8[_0xdf5e('0x39')],_0x14e8d8['query']);_0xab0ee2[_0xdf5e('0x3a')]=_[_0xdf5e('0x38')](_0x14e8d8[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x3b')]));_0xab0ee2['attributes']=_0xab0ee2['attributes']['length']?_0xab0ee2[_0xdf5e('0x3a')]:_0x14e8d8['model'];_0xab0ee2[_0xdf5e('0x3e')]=qs[_0xdf5e('0x3f')](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x3f')]);_0xab0ee2[_0xdf5e('0x40')]=qs['filters'](_[_0xdf5e('0x42')](_0x3f42e4[_0xdf5e('0x36')],_0x14e8d8[_0xdf5e('0x41')]));if(_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x43')]){_0xab0ee2[_0xdf5e('0x40')]=_[_0xdf5e('0x44')](_0xab0ee2[_0xdf5e('0x40')],{'$or':_[_0xdf5e('0x31')](_0xab0ee2[_0xdf5e('0x3a')],function(_0x392494){var _0x2f5115={};_0x2f5115[_0x392494]={'$like':'%'+_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x43')]+'%'};return _0x2f5115;})});}_0xab0ee2=_[_0xdf5e('0x44')]({},_0xab0ee2,_0x3f42e4[_0xdf5e('0x46')]);return _0x5ad561[_0xdf5e('0x54')](_0xab0ee2);}})[_0xdf5e('0x2a')](function(_0x480219){if(_0x480219){_0x4574cc=_0x480219[_0xdf5e('0x3c')];if(!_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x53')](_0xdf5e('0x3d'))){_0xab0ee2[_0xdf5e('0x22')]=qs[_0xdf5e('0x22')](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x22')]);_0xab0ee2[_0xdf5e('0x20')]=qs['offset'](_0x3f42e4[_0xdf5e('0x36')][_0xdf5e('0x20')]);}return _0x5ad561[_0xdf5e('0x54')](_0xab0ee2);}})['then'](function(_0x49aa32){if(_0x49aa32){return _0x49aa32?{'count':_0x4574cc,'rows':_0x49aa32}:null;}})[_0xdf5e('0x2a')](respondWithResult(_0x58abae,null))[_0xdf5e('0x4b')](handleError(_0x58abae,null));};exports['getDescriptions']=function(_0x163936,_0x5790f1,_0x489a7d){var _0x557039={};var _0x5a65e4={};var _0xb462ac;var _0x353d9f;return db[_0xdf5e('0x32')]['findOne']({'where':{'id':_0x163936[_0xdf5e('0x4d')]['id']}})[_0xdf5e('0x2a')](handleEntityNotFound(_0x5790f1,null))['then'](function(_0x4b20c5){if(_0x4b20c5){_0xb462ac=_0x4b20c5;_0x5a65e4[_0xdf5e('0x39')]=_[_0xdf5e('0x37')](db[_0xdf5e('0x55')][_0xdf5e('0x33')]);_0x5a65e4[_0xdf5e('0x36')]=_[_0xdf5e('0x37')](_0x163936['query']);_0x5a65e4[_0xdf5e('0x41')]=_[_0xdf5e('0x38')](_0x5a65e4['model'],_0x5a65e4[_0xdf5e('0x36')]);_0x557039['attributes']=_[_0xdf5e('0x38')](_0x5a65e4[_0xdf5e('0x39')],qs[_0xdf5e('0x3b')](_0x163936[_0xdf5e('0x36')][_0xdf5e('0x3b')]));_0x557039[_0xdf5e('0x3a')]=_0x557039['attributes']['length']?_0x557039[_0xdf5e('0x3a')]:_0x5a65e4[_0xdf5e('0x39')];_0x557039['order']=qs[_0xdf5e('0x3f')](_0x163936[_0xdf5e('0x36')]['sort']);_0x557039[_0xdf5e('0x40')]=qs['filters'](_[_0xdf5e('0x42')](_0x163936[_0xdf5e('0x36')],_0x5a65e4[_0xdf5e('0x41')]));if(_0x163936['query']['filter']){_0x557039[_0xdf5e('0x40')]=_[_0xdf5e('0x44')](_0x557039['where'],{'$or':_['map'](_0x557039[_0xdf5e('0x3a')],function(_0x30e692){var _0xea5706={};_0xea5706[_0x30e692]={'$like':'%'+_0x163936[_0xdf5e('0x36')][_0xdf5e('0x43')]+'%'};return _0xea5706;})});}_0x557039=_[_0xdf5e('0x44')]({},_0x557039,_0x163936['options']);return _0xb462ac[_0xdf5e('0x56')](_0x557039);}})['then'](function(_0x358815){if(_0x358815){_0x353d9f=_0x358815['length'];if(!_0x163936[_0xdf5e('0x36')]['hasOwnProperty'](_0xdf5e('0x3d'))){_0x557039[_0xdf5e('0x22')]=qs['limit'](_0x163936[_0xdf5e('0x36')]['limit']);_0x557039[_0xdf5e('0x20')]=qs[_0xdf5e('0x20')](_0x163936[_0xdf5e('0x36')][_0xdf5e('0x20')]);}return _0xb462ac[_0xdf5e('0x56')](_0x557039);}})[_0xdf5e('0x2a')](function(_0x29d7c8){if(_0x29d7c8){return _0x29d7c8?{'count':_0x353d9f,'rows':_0x29d7c8}:null;}})['then'](respondWithResult(_0x5790f1,null))[_0xdf5e('0x4b')](handleError(_0x5790f1,null));}; \ No newline at end of file +var _0x6e1e=['ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x47c700,_0x25f2c8){var _0x26c26c=function(_0x4a69c4){while(--_0x4a69c4){_0x47c700['push'](_0x47c700['shift']());}};_0x26c26c(++_0x25f2c8);}(_0x6e1e,0x91));var _0xe6e1=function(_0xff838f,_0x5b348c){_0xff838f=_0xff838f-0x0;var _0x35b18e=_0x6e1e[_0xff838f];return _0x35b18e;};'use strict';var emlformat=require(_0xe6e1('0x0'));var rimraf=require(_0xe6e1('0x1'));var zipdir=require(_0xe6e1('0x2'));var jsonpatch=require(_0xe6e1('0x3'));var rp=require(_0xe6e1('0x4'));var moment=require(_0xe6e1('0x5'));var BPromise=require(_0xe6e1('0x6'));var Mustache=require('mustache');var util=require(_0xe6e1('0x7'));var path=require(_0xe6e1('0x8'));var sox=require(_0xe6e1('0x9'));var csv=require(_0xe6e1('0xa'));var ejs=require(_0xe6e1('0xb'));var fs=require('fs');var fs_extra=require(_0xe6e1('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe6e1('0xd'));var jsforce=require(_0xe6e1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe6e1('0xa'));var querystring=require(_0xe6e1('0xf'));var Papa=require(_0xe6e1('0x10'));var Redis=require(_0xe6e1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe6e1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe6e1('0x13'));var config=require(_0xe6e1('0x14'));var licenseUtil=require(_0xe6e1('0x15'));var db=require(_0xe6e1('0x16'))['db'];function respondWithStatusCode(_0x776764,_0x7b4a14){_0x7b4a14=_0x7b4a14||0xcc;return function(_0x281fe1){if(_0x281fe1){return _0x776764['sendStatus'](_0x7b4a14);}return _0x776764[_0xe6e1('0x17')](_0x7b4a14)[_0xe6e1('0x18')]();};}function respondWithResult(_0x172668,_0x3b03cd){_0x3b03cd=_0x3b03cd||0xc8;return function(_0x18d2ee){if(_0x18d2ee){return _0x172668['status'](_0x3b03cd)[_0xe6e1('0x19')](_0x18d2ee);}};}function respondWithFilteredResult(_0x8e5057,_0x9712e2){return function(_0x418b6a){if(_0x418b6a){var _0x45bbd7=typeof _0x9712e2[_0xe6e1('0x1a')]===_0xe6e1('0x1b')&&typeof _0x9712e2[_0xe6e1('0x1c')]===_0xe6e1('0x1b');var _0x3445ee=_0x418b6a[_0xe6e1('0x1d')];var _0x1bbabb=_0x45bbd7?0x0:_0x9712e2[_0xe6e1('0x1a')];var _0x2650a0=_0x45bbd7?_0x418b6a[_0xe6e1('0x1d')]:_0x9712e2[_0xe6e1('0x1a')]+_0x9712e2[_0xe6e1('0x1c')];var _0x3c7502;if(_0x2650a0>=_0x3445ee){_0x2650a0=_0x3445ee;_0x3c7502=0xc8;}else{_0x3c7502=0xce;}_0x8e5057[_0xe6e1('0x17')](_0x3c7502);return _0x8e5057['set'](_0xe6e1('0x1e'),_0x1bbabb+'-'+_0x2650a0+'/'+_0x3445ee)[_0xe6e1('0x19')](_0x418b6a);}return null;};}function patchUpdates(_0x50d4f3){return function(_0x53f89d){try{jsonpatch['apply'](_0x53f89d,_0x50d4f3,!![]);}catch(_0x4b2f39){return BPromise['reject'](_0x4b2f39);}return _0x53f89d[_0xe6e1('0x1f')]();};}function saveUpdates(_0x5d961b,_0x254c98){return function(_0x17aa4b){if(_0x17aa4b){return _0x17aa4b[_0xe6e1('0x20')](_0x5d961b)[_0xe6e1('0x21')](function(_0x3421a1){return _0x3421a1;});}return null;};}function removeEntity(_0x4f1b4a,_0x554d84){return function(_0x471608){if(_0x471608){return _0x471608[_0xe6e1('0x22')]()[_0xe6e1('0x21')](function(){_0x4f1b4a[_0xe6e1('0x17')](0xcc)[_0xe6e1('0x18')]();});}};}function handleEntityNotFound(_0x434d53,_0x57a8b1){return function(_0x5c334e){if(!_0x5c334e){_0x434d53[_0xe6e1('0x23')](0x194);}return _0x5c334e;};}function handleError(_0x1d4cd3,_0x5ab50c){_0x5ab50c=_0x5ab50c||0x1f4;return function(_0x1a8d41){logger[_0xe6e1('0x24')](_0x1a8d41[_0xe6e1('0x25')]);if(_0x1a8d41[_0xe6e1('0x26')]){delete _0x1a8d41[_0xe6e1('0x26')];}_0x1d4cd3['status'](_0x5ab50c)['send'](_0x1a8d41);};}exports[_0xe6e1('0x27')]=function(_0x509bfb,_0x463922){var _0x5b5120={},_0x16a9c6={},_0x86dd96={'count':0x0,'rows':[]};var _0xc309ba=_[_0xe6e1('0x28')](db[_0xe6e1('0x29')][_0xe6e1('0x2a')],function(_0x33c651){return{'name':_0x33c651[_0xe6e1('0x2b')],'type':_0x33c651[_0xe6e1('0x2c')]['key']};});_0x16a9c6[_0xe6e1('0x2d')]=_[_0xe6e1('0x28')](_0xc309ba,_0xe6e1('0x26'));_0x16a9c6[_0xe6e1('0x2e')]=_[_0xe6e1('0x2f')](_0x509bfb[_0xe6e1('0x2e')]);_0x16a9c6[_0xe6e1('0x30')]=_[_0xe6e1('0x31')](_0x16a9c6[_0xe6e1('0x2d')],_0x16a9c6[_0xe6e1('0x2e')]);_0x5b5120[_0xe6e1('0x32')]=_[_0xe6e1('0x31')](_0x16a9c6[_0xe6e1('0x2d')],qs['fields'](_0x509bfb[_0xe6e1('0x2e')][_0xe6e1('0x33')]));_0x5b5120['attributes']=_0x5b5120[_0xe6e1('0x32')][_0xe6e1('0x34')]?_0x5b5120[_0xe6e1('0x32')]:_0x16a9c6[_0xe6e1('0x2d')];if(!_0x509bfb[_0xe6e1('0x2e')][_0xe6e1('0x35')](_0xe6e1('0x36'))){_0x5b5120[_0xe6e1('0x1c')]=qs['limit'](_0x509bfb[_0xe6e1('0x2e')]['limit']);_0x5b5120[_0xe6e1('0x1a')]=qs[_0xe6e1('0x1a')](_0x509bfb[_0xe6e1('0x2e')][_0xe6e1('0x1a')]);}_0x5b5120['order']=qs[_0xe6e1('0x37')](_0x509bfb[_0xe6e1('0x2e')][_0xe6e1('0x37')]);_0x5b5120[_0xe6e1('0x38')]=qs[_0xe6e1('0x30')](_[_0xe6e1('0x39')](_0x509bfb[_0xe6e1('0x2e')],_0x16a9c6[_0xe6e1('0x30')]),_0xc309ba);if(_0x509bfb[_0xe6e1('0x2e')][_0xe6e1('0x3a')]){_0x5b5120[_0xe6e1('0x38')]=_[_0xe6e1('0x3b')](_0x5b5120[_0xe6e1('0x38')],{'$or':_[_0xe6e1('0x28')](_0xc309ba,function(_0x4af8b0){if(_0x4af8b0[_0xe6e1('0x2c')]!==_0xe6e1('0x3c')){var _0x21ad4d={};_0x21ad4d[_0x4af8b0[_0xe6e1('0x26')]]={'$like':'%'+_0x509bfb[_0xe6e1('0x2e')]['filter']+'%'};return _0x21ad4d;}})});}_0x5b5120=_[_0xe6e1('0x3b')]({},_0x5b5120,_0x509bfb['options']);var _0xb5d180={'where':_0x5b5120[_0xe6e1('0x38')]};return db[_0xe6e1('0x29')][_0xe6e1('0x1d')](_0xb5d180)['then'](function(_0x47803f){_0x86dd96[_0xe6e1('0x1d')]=_0x47803f;if(_0x509bfb[_0xe6e1('0x2e')][_0xe6e1('0x3d')]){_0x5b5120[_0xe6e1('0x3e')]=[{'all':!![]}];}return db[_0xe6e1('0x29')][_0xe6e1('0x3f')](_0x5b5120);})['then'](function(_0x4e9a8e){_0x86dd96[_0xe6e1('0x40')]=_0x4e9a8e;return _0x86dd96;})[_0xe6e1('0x21')](respondWithFilteredResult(_0x463922,_0x5b5120))[_0xe6e1('0x41')](handleError(_0x463922,null));};exports[_0xe6e1('0x42')]=function(_0x72167a,_0xf58510){var _0x725197={'raw':![],'where':{'id':_0x72167a[_0xe6e1('0x43')]['id']}},_0x336f68={};_0x336f68[_0xe6e1('0x2d')]=_[_0xe6e1('0x2f')](db['SalesforceConfiguration']['rawAttributes']);_0x336f68[_0xe6e1('0x2e')]=_[_0xe6e1('0x2f')](_0x72167a[_0xe6e1('0x2e')]);_0x336f68[_0xe6e1('0x30')]=_['intersection'](_0x336f68[_0xe6e1('0x2d')],_0x336f68[_0xe6e1('0x2e')]);_0x725197[_0xe6e1('0x32')]=_[_0xe6e1('0x31')](_0x336f68[_0xe6e1('0x2d')],qs[_0xe6e1('0x33')](_0x72167a[_0xe6e1('0x2e')][_0xe6e1('0x33')]));_0x725197[_0xe6e1('0x32')]=_0x725197[_0xe6e1('0x32')][_0xe6e1('0x34')]?_0x725197[_0xe6e1('0x32')]:_0x336f68['model'];if(_0x72167a['query'][_0xe6e1('0x3d')]){_0x725197[_0xe6e1('0x3e')]=[{'all':!![]}];}_0x725197=_[_0xe6e1('0x3b')]({},_0x725197,_0x72167a[_0xe6e1('0x44')]);return db[_0xe6e1('0x29')][_0xe6e1('0x45')](_0x725197)['then'](handleEntityNotFound(_0xf58510,null))[_0xe6e1('0x21')](respondWithResult(_0xf58510,null))[_0xe6e1('0x41')](handleError(_0xf58510,null));};exports[_0xe6e1('0x46')]=function(_0x3a00f0,_0x3ceffb){return db[_0xe6e1('0x29')][_0xe6e1('0x46')](_0x3a00f0[_0xe6e1('0x47')],{})['then'](respondWithResult(_0x3ceffb,0xc9))[_0xe6e1('0x41')](handleError(_0x3ceffb,null));};exports[_0xe6e1('0x20')]=function(_0x2f1053,_0x530c02){if(_0x2f1053['body']['id']){delete _0x2f1053['body']['id'];}return db[_0xe6e1('0x29')]['find']({'where':{'id':_0x2f1053[_0xe6e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x530c02,null))[_0xe6e1('0x21')](saveUpdates(_0x2f1053['body'],null))['then'](respondWithResult(_0x530c02,null))['catch'](handleError(_0x530c02,null));};exports[_0xe6e1('0x22')]=function(_0x152ba7,_0x259e5d){return db[_0xe6e1('0x29')][_0xe6e1('0x45')]({'where':{'id':_0x152ba7[_0xe6e1('0x43')]['id']}})[_0xe6e1('0x21')](handleEntityNotFound(_0x259e5d,null))[_0xe6e1('0x21')](removeEntity(_0x259e5d,null))[_0xe6e1('0x41')](handleError(_0x259e5d,null));};exports[_0xe6e1('0x48')]=function(_0x3cb26b,_0x5779d1,_0x17db16){var _0x145e34={};var _0x322602={};var _0x286d93;var _0x1c10c8;return db[_0xe6e1('0x29')][_0xe6e1('0x49')]({'where':{'id':_0x3cb26b[_0xe6e1('0x43')]['id']}})[_0xe6e1('0x21')](handleEntityNotFound(_0x5779d1,null))[_0xe6e1('0x21')](function(_0x36b26f){if(_0x36b26f){_0x286d93=_0x36b26f;_0x322602[_0xe6e1('0x2d')]=_[_0xe6e1('0x2f')](db[_0xe6e1('0x4a')][_0xe6e1('0x2a')]);_0x322602['query']=_[_0xe6e1('0x2f')](_0x3cb26b[_0xe6e1('0x2e')]);_0x322602[_0xe6e1('0x30')]=_[_0xe6e1('0x31')](_0x322602[_0xe6e1('0x2d')],_0x322602[_0xe6e1('0x2e')]);_0x145e34[_0xe6e1('0x32')]=_[_0xe6e1('0x31')](_0x322602[_0xe6e1('0x2d')],qs[_0xe6e1('0x33')](_0x3cb26b[_0xe6e1('0x2e')][_0xe6e1('0x33')]));_0x145e34['attributes']=_0x145e34[_0xe6e1('0x32')]['length']?_0x145e34[_0xe6e1('0x32')]:_0x322602['model'];_0x145e34[_0xe6e1('0x4b')]=qs[_0xe6e1('0x37')](_0x3cb26b[_0xe6e1('0x2e')]['sort']);_0x145e34[_0xe6e1('0x38')]=qs[_0xe6e1('0x30')](_[_0xe6e1('0x39')](_0x3cb26b[_0xe6e1('0x2e')],_0x322602[_0xe6e1('0x30')]));if(_0x3cb26b[_0xe6e1('0x2e')]['filter']){_0x145e34[_0xe6e1('0x38')]=_[_0xe6e1('0x3b')](_0x145e34[_0xe6e1('0x38')],{'$or':_[_0xe6e1('0x28')](_0x145e34['attributes'],function(_0x43788d){var _0x4f4abf={};_0x4f4abf[_0x43788d]={'$like':'%'+_0x3cb26b[_0xe6e1('0x2e')]['filter']+'%'};return _0x4f4abf;})});}_0x145e34=_[_0xe6e1('0x3b')]({},_0x145e34,_0x3cb26b[_0xe6e1('0x44')]);return _0x286d93[_0xe6e1('0x48')](_0x145e34);}})['then'](function(_0x1fae2d){if(_0x1fae2d){_0x1c10c8=_0x1fae2d[_0xe6e1('0x34')];if(!_0x3cb26b['query'][_0xe6e1('0x35')](_0xe6e1('0x36'))){_0x145e34[_0xe6e1('0x1c')]=qs[_0xe6e1('0x1c')](_0x3cb26b[_0xe6e1('0x2e')][_0xe6e1('0x1c')]);_0x145e34['offset']=qs[_0xe6e1('0x1a')](_0x3cb26b[_0xe6e1('0x2e')]['offset']);}return _0x286d93[_0xe6e1('0x48')](_0x145e34);}})['then'](function(_0x43d7cc){if(_0x43d7cc){return _0x43d7cc?{'count':_0x1c10c8,'rows':_0x43d7cc}:null;}})[_0xe6e1('0x21')](respondWithResult(_0x5779d1,null))[_0xe6e1('0x41')](handleError(_0x5779d1,null));};exports[_0xe6e1('0x4c')]=function(_0x2d4a69,_0x4531a9,_0x1e3344){var _0x237f46={};var _0x7f3996={};var _0x389ef3;var _0x40cf13;return db[_0xe6e1('0x29')][_0xe6e1('0x49')]({'where':{'id':_0x2d4a69[_0xe6e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x4531a9,null))[_0xe6e1('0x21')](function(_0x1a9136){if(_0x1a9136){_0x389ef3=_0x1a9136;_0x7f3996[_0xe6e1('0x2d')]=_[_0xe6e1('0x2f')](db['SalesforceField']['rawAttributes']);_0x7f3996[_0xe6e1('0x2e')]=_[_0xe6e1('0x2f')](_0x2d4a69[_0xe6e1('0x2e')]);_0x7f3996[_0xe6e1('0x30')]=_['intersection'](_0x7f3996[_0xe6e1('0x2d')],_0x7f3996[_0xe6e1('0x2e')]);_0x237f46[_0xe6e1('0x32')]=_[_0xe6e1('0x31')](_0x7f3996['model'],qs[_0xe6e1('0x33')](_0x2d4a69[_0xe6e1('0x2e')]['fields']));_0x237f46[_0xe6e1('0x32')]=_0x237f46[_0xe6e1('0x32')][_0xe6e1('0x34')]?_0x237f46[_0xe6e1('0x32')]:_0x7f3996['model'];_0x237f46[_0xe6e1('0x4b')]=qs[_0xe6e1('0x37')](_0x2d4a69[_0xe6e1('0x2e')][_0xe6e1('0x37')]);_0x237f46[_0xe6e1('0x38')]=qs[_0xe6e1('0x30')](_[_0xe6e1('0x39')](_0x2d4a69['query'],_0x7f3996[_0xe6e1('0x30')]));if(_0x2d4a69[_0xe6e1('0x2e')][_0xe6e1('0x3a')]){_0x237f46[_0xe6e1('0x38')]=_['merge'](_0x237f46['where'],{'$or':_['map'](_0x237f46['attributes'],function(_0x3d66e){var _0x154cad={};_0x154cad[_0x3d66e]={'$like':'%'+_0x2d4a69['query'][_0xe6e1('0x3a')]+'%'};return _0x154cad;})});}_0x237f46=_['merge']({},_0x237f46,_0x2d4a69[_0xe6e1('0x44')]);return _0x389ef3[_0xe6e1('0x4c')](_0x237f46);}})[_0xe6e1('0x21')](function(_0x354f09){if(_0x354f09){_0x40cf13=_0x354f09[_0xe6e1('0x34')];if(!_0x2d4a69['query']['hasOwnProperty'](_0xe6e1('0x36'))){_0x237f46[_0xe6e1('0x1c')]=qs[_0xe6e1('0x1c')](_0x2d4a69['query'][_0xe6e1('0x1c')]);_0x237f46[_0xe6e1('0x1a')]=qs[_0xe6e1('0x1a')](_0x2d4a69[_0xe6e1('0x2e')][_0xe6e1('0x1a')]);}return _0x389ef3[_0xe6e1('0x4c')](_0x237f46);}})[_0xe6e1('0x21')](function(_0x46cc7a){if(_0x46cc7a){return _0x46cc7a?{'count':_0x40cf13,'rows':_0x46cc7a}:null;}})['then'](respondWithResult(_0x4531a9,null))[_0xe6e1('0x41')](handleError(_0x4531a9,null));};exports[_0xe6e1('0x4d')]=function(_0x1a10f0,_0x47d81e,_0x476ce4){var _0x15a219={};var _0x262a75={};var _0x43289e;var _0x161369;return db[_0xe6e1('0x29')]['findOne']({'where':{'id':_0x1a10f0[_0xe6e1('0x43')]['id']}})[_0xe6e1('0x21')](handleEntityNotFound(_0x47d81e,null))[_0xe6e1('0x21')](function(_0x4587c7){if(_0x4587c7){_0x43289e=_0x4587c7;_0x262a75[_0xe6e1('0x2d')]=_['keys'](db[_0xe6e1('0x4a')][_0xe6e1('0x2a')]);_0x262a75[_0xe6e1('0x2e')]=_[_0xe6e1('0x2f')](_0x1a10f0[_0xe6e1('0x2e')]);_0x262a75[_0xe6e1('0x30')]=_['intersection'](_0x262a75[_0xe6e1('0x2d')],_0x262a75[_0xe6e1('0x2e')]);_0x15a219[_0xe6e1('0x32')]=_['intersection'](_0x262a75[_0xe6e1('0x2d')],qs[_0xe6e1('0x33')](_0x1a10f0[_0xe6e1('0x2e')][_0xe6e1('0x33')]));_0x15a219[_0xe6e1('0x32')]=_0x15a219[_0xe6e1('0x32')][_0xe6e1('0x34')]?_0x15a219[_0xe6e1('0x32')]:_0x262a75[_0xe6e1('0x2d')];_0x15a219[_0xe6e1('0x4b')]=qs[_0xe6e1('0x37')](_0x1a10f0[_0xe6e1('0x2e')][_0xe6e1('0x37')]);_0x15a219[_0xe6e1('0x38')]=qs[_0xe6e1('0x30')](_[_0xe6e1('0x39')](_0x1a10f0['query'],_0x262a75[_0xe6e1('0x30')]));if(_0x1a10f0['query'][_0xe6e1('0x3a')]){_0x15a219['where']=_[_0xe6e1('0x3b')](_0x15a219[_0xe6e1('0x38')],{'$or':_[_0xe6e1('0x28')](_0x15a219[_0xe6e1('0x32')],function(_0x12b7b0){var _0x46d53a={};_0x46d53a[_0x12b7b0]={'$like':'%'+_0x1a10f0['query']['filter']+'%'};return _0x46d53a;})});}_0x15a219=_[_0xe6e1('0x3b')]({},_0x15a219,_0x1a10f0[_0xe6e1('0x44')]);return _0x43289e[_0xe6e1('0x4d')](_0x15a219);}})[_0xe6e1('0x21')](function(_0x133aaf){if(_0x133aaf){_0x161369=_0x133aaf[_0xe6e1('0x34')];if(!_0x1a10f0[_0xe6e1('0x2e')]['hasOwnProperty'](_0xe6e1('0x36'))){_0x15a219[_0xe6e1('0x1c')]=qs[_0xe6e1('0x1c')](_0x1a10f0[_0xe6e1('0x2e')][_0xe6e1('0x1c')]);_0x15a219[_0xe6e1('0x1a')]=qs[_0xe6e1('0x1a')](_0x1a10f0[_0xe6e1('0x2e')][_0xe6e1('0x1a')]);}return _0x43289e[_0xe6e1('0x4d')](_0x15a219);}})[_0xe6e1('0x21')](function(_0x197fb9){if(_0x197fb9){return _0x197fb9?{'count':_0x161369,'rows':_0x197fb9}:null;}})[_0xe6e1('0x21')](respondWithResult(_0x47d81e,null))[_0xe6e1('0x41')](handleError(_0x47d81e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 41e7cb2..1cc28b4 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 _0xf4ca=['moment','bluebird','request-promise','path','rimraf','../../config/environment','lodash','util'];(function(_0x469f15,_0x2e2e98){var _0x212f33=function(_0x3147e3){while(--_0x3147e3){_0x469f15['push'](_0x469f15['shift']());}};_0x212f33(++_0x2e2e98);}(_0xf4ca,0x10e));var _0xaf4c=function(_0x3a668b,_0x4dbecd){_0x3a668b=_0x3a668b-0x0;var _0x331700=_0xf4ca[_0x3a668b];return _0x331700;};'use strict';var _=require(_0xaf4c('0x0'));var util=require(_0xaf4c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaf4c('0x2'));var BPromise=require(_0xaf4c('0x3'));var rp=require(_0xaf4c('0x4'));var fs=require('fs');var path=require(_0xaf4c('0x5'));var rimraf=require(_0xaf4c('0x6'));var config=require(_0xaf4c('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x2391c2,_0x3ba0a2){return _0x2391c2['define']('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7273=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e1b5c,_0x4f3f76){var _0x3f7cd9=function(_0x4fec9c){while(--_0x4fec9c){_0x2e1b5c['push'](_0x2e1b5c['shift']());}};_0x3f7cd9(++_0x4f3f76);}(_0x7273,0x16d));var _0x3727=function(_0x52d0b1,_0x44bb16){_0x52d0b1=_0x52d0b1-0x0;var _0x4eeb47=_0x7273[_0x52d0b1];return _0x4eeb47;};'use strict';var _=require(_0x3727('0x0'));var util=require(_0x3727('0x1'));var logger=require(_0x3727('0x2'))(_0x3727('0x3'));var moment=require(_0x3727('0x4'));var BPromise=require(_0x3727('0x5'));var rp=require(_0x3727('0x6'));var fs=require('fs');var path=require(_0x3727('0x7'));var rimraf=require(_0x3727('0x8'));var config=require(_0x3727('0x9'));var attributes=require(_0x3727('0xa'));module[_0x3727('0xb')]=function(_0x316a18,_0x582a54){return _0x316a18[_0x3727('0xc')](_0x3727('0xd'),attributes,{'tableName':_0x3727('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 83f54cb..8cc619e 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 _0x5fd2=['client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x5fd2,0xbd));var _0x25fd=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5fd2[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x25fd('0x0'));var util=require(_0x25fd('0x1'));var moment=require('moment');var BPromise=require(_0x25fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25fd('0x3'));var db=require(_0x25fd('0x4'))['db'];var utils=require(_0x25fd('0x5'));var logger=require('../../config/logger')(_0x25fd('0x6'));var config=require(_0x25fd('0x7'));var jayson=require(_0x25fd('0x8'));var client=jayson[_0x25fd('0x9')][_0x25fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92ad48,_0x2a74b6,_0x24f14f){return new BPromise(function(_0x3df6bd,_0x1e47f7){return client[_0x25fd('0xb')](_0x92ad48,_0x24f14f)[_0x25fd('0xc')](function(_0x49568a){logger[_0x25fd('0xd')](_0x25fd('0xe'),_0x2a74b6,_0x25fd('0xf'));logger['debug'](_0x25fd('0x10'),_0x2a74b6,_0x25fd('0xf'),JSON[_0x25fd('0x11')](_0x49568a));if(_0x49568a['error']){if(_0x49568a[_0x25fd('0x12')]['code']===0x1f4){logger['error'](_0x25fd('0xe'),_0x2a74b6,_0x49568a[_0x25fd('0x12')]['message']);return _0x1e47f7(_0x49568a[_0x25fd('0x12')][_0x25fd('0x13')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2a74b6,_0x49568a['error']['message']);return _0x3df6bd(_0x49568a['error'][_0x25fd('0x13')]);}else{logger[_0x25fd('0xd')](_0x25fd('0xe'),_0x2a74b6,_0x25fd('0xf'));_0x3df6bd(_0x49568a[_0x25fd('0x14')]['message']);}})[_0x25fd('0x15')](function(_0x34e4d2){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2a74b6,_0x34e4d2);_0x1e47f7(_0x34e4d2);});});} \ No newline at end of file +var _0x0c7a=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c7a,0x1c0));var _0xa0c7=function(_0x38ece6,_0x45159d){_0x38ece6=_0x38ece6-0x0;var _0x2f8206=_0x0c7a[_0x38ece6];return _0x2f8206;};'use strict';var _=require(_0xa0c7('0x0'));var util=require('util');var moment=require(_0xa0c7('0x1'));var BPromise=require(_0xa0c7('0x2'));var rs=require(_0xa0c7('0x3'));var fs=require('fs');var Redis=require(_0xa0c7('0x4'));var db=require(_0xa0c7('0x5'))['db'];var utils=require(_0xa0c7('0x6'));var logger=require(_0xa0c7('0x7'))(_0xa0c7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa0c7('0x9')][_0xa0c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x545f7d,_0x33925e,_0x109da5){return new BPromise(function(_0xe3f2cb,_0x82c194){return client['request'](_0x545f7d,_0x109da5)[_0xa0c7('0xb')](function(_0x299c10){logger[_0xa0c7('0xc')](_0xa0c7('0xd'),_0x33925e,_0xa0c7('0xe'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x33925e,_0xa0c7('0xe'),JSON[_0xa0c7('0xf')](_0x299c10));if(_0x299c10[_0xa0c7('0x10')]){if(_0x299c10['error'][_0xa0c7('0x11')]===0x1f4){logger[_0xa0c7('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x33925e,_0x299c10[_0xa0c7('0x10')][_0xa0c7('0x12')]);return _0x82c194(_0x299c10[_0xa0c7('0x10')][_0xa0c7('0x12')]);}logger[_0xa0c7('0x10')](_0xa0c7('0xd'),_0x33925e,_0x299c10[_0xa0c7('0x10')][_0xa0c7('0x12')]);return _0xe3f2cb(_0x299c10[_0xa0c7('0x10')][_0xa0c7('0x12')]);}else{logger['info'](_0xa0c7('0xd'),_0x33925e,'request\x20sent');_0xe3f2cb(_0x299c10[_0xa0c7('0x13')]['message']);}})[_0xa0c7('0x14')](function(_0x379252){logger['error'](_0xa0c7('0xd'),_0x33925e,_0x379252);_0x82c194(_0x379252);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4c32818..472f875 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 _0x2a01=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x30d92f,_0x56b4d1){var _0x5cd9b9=function(_0x3e3593){while(--_0x3e3593){_0x30d92f['push'](_0x30d92f['shift']());}};_0x5cd9b9(++_0x56b4d1);}(_0x2a01,0xa5));var _0x12a0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x2a01[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x12a0('0x0'));var timeout=require(_0x12a0('0x1'));var express=require(_0x12a0('0x2'));var router=express[_0x12a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x12a0('0x4'));var interaction=require(_0x12a0('0x5'));var config=require(_0x12a0('0x6'));var controller=require(_0x12a0('0x7'));router[_0x12a0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x12a0('0x8')](_0x12a0('0x9'),auth[_0x12a0('0xa')](),controller['show']);router[_0x12a0('0xb')]('/',auth[_0x12a0('0xa')](),controller[_0x12a0('0xc')]);router['put'](_0x12a0('0x9'),auth['isAuthenticated'](),controller[_0x12a0('0xd')]);router[_0x12a0('0xe')](_0x12a0('0x9'),auth['isAuthenticated'](),controller[_0x12a0('0xf')]);module[_0x12a0('0x10')]=router; \ No newline at end of file +var _0x6b43=['put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x30a18c,_0x3b623f){var _0x5c9eb1=function(_0x4172d2){while(--_0x4172d2){_0x30a18c['push'](_0x30a18c['shift']());}};_0x5c9eb1(++_0x3b623f);}(_0x6b43,0x17a));var _0x36b4=function(_0x34b198,_0x271ea5){_0x34b198=_0x34b198-0x0;var _0x440daf=_0x6b43[_0x34b198];return _0x440daf;};'use strict';var multer=require(_0x36b4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x36b4('0x1'));var express=require(_0x36b4('0x2'));var router=express[_0x36b4('0x3')]();var fs_extra=require(_0x36b4('0x4'));var auth=require(_0x36b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x36b4('0x6'));var controller=require(_0x36b4('0x7'));router[_0x36b4('0x8')]('/',auth['isAuthenticated'](),controller[_0x36b4('0x9')]);router[_0x36b4('0x8')](_0x36b4('0xa'),auth[_0x36b4('0xb')](),controller[_0x36b4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x36b4('0xd')](_0x36b4('0xa'),auth['isAuthenticated'](),controller[_0x36b4('0xe')]);router['delete'](_0x36b4('0xa'),auth[_0x36b4('0xb')](),controller[_0x36b4('0xf')]);module[_0x36b4('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 62f3e10..32e3d06 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 _0xaf00=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x51e062,_0x49bc1e){var _0x2573a5=function(_0x472154){while(--_0x472154){_0x51e062['push'](_0x51e062['shift']());}};_0x2573a5(++_0x49bc1e);}(_0xaf00,0x165));var _0x0af0=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xaf00[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x0af0('0x0'));module[_0x0af0('0x1')]={'type':{'type':Sequelize[_0x0af0('0x2')](_0x0af0('0x3'),_0x0af0('0x4'),_0x0af0('0x5'),_0x0af0('0x6'),_0x0af0('0x7')),'defaultValue':_0x0af0('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0af0('0x8')]},'keyType':{'type':Sequelize[_0x0af0('0x2')](_0x0af0('0x3'),'variable',_0x0af0('0x5'))},'keyContent':{'type':Sequelize[_0x0af0('0x8')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x29ab=['sequelize','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0x29ab,0x178));var _0xb29a=function(_0xbdde9f,_0x58001d){_0xbdde9f=_0xbdde9f-0x0;var _0xb76631=_0x29ab[_0xbdde9f];return _0xb76631;};'use strict';var Sequelize=require(_0xb29a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb29a('0x1'),_0xb29a('0x2'),_0xb29a('0x3'),_0xb29a('0x4'),_0xb29a('0x5')),'defaultValue':_0xb29a('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb29a('0x6')]},'keyType':{'type':Sequelize[_0xb29a('0x7')]('string',_0xb29a('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xb29a('0x6')]},'idField':{'type':Sequelize[_0xb29a('0x6')]},'variableName':{'type':Sequelize[_0xb29a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f8e6d2b..2e922e4 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 _0xa3f9=['filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','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/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','SalesforceField','rawAttributes','fieldName','key','model','map','query'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xa3f9,0x19e));var _0x9a3f=function(_0x4c4958,_0x120ed1){_0x4c4958=_0x4c4958-0x0;var _0xb8271b=_0xa3f9[_0x4c4958];return _0xb8271b;};'use strict';var emlformat=require(_0x9a3f('0x0'));var rimraf=require(_0x9a3f('0x1'));var zipdir=require(_0x9a3f('0x2'));var jsonpatch=require(_0x9a3f('0x3'));var rp=require(_0x9a3f('0x4'));var moment=require('moment');var BPromise=require(_0x9a3f('0x5'));var Mustache=require(_0x9a3f('0x6'));var util=require(_0x9a3f('0x7'));var path=require(_0x9a3f('0x8'));var sox=require(_0x9a3f('0x9'));var csv=require(_0x9a3f('0xa'));var ejs=require(_0x9a3f('0xb'));var fs=require('fs');var fs_extra=require(_0x9a3f('0xc'));var _=require(_0x9a3f('0xd'));var squel=require(_0x9a3f('0xe'));var crypto=require(_0x9a3f('0xf'));var jsforce=require(_0x9a3f('0x10'));var deskjs=require(_0x9a3f('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9a3f('0x12'));var Papa=require(_0x9a3f('0x13'));var Redis=require(_0x9a3f('0x14'));var authService=require(_0x9a3f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x9a3f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a3f('0x17'))(_0x9a3f('0x18'));var utils=require(_0x9a3f('0x19'));var config=require(_0x9a3f('0x1a'));var licenseUtil=require(_0x9a3f('0x1b'));var db=require(_0x9a3f('0x1c'))['db'];function respondWithStatusCode(_0x352e17,_0x406d31){_0x406d31=_0x406d31||0xcc;return function(_0x2af319){if(_0x2af319){return _0x352e17[_0x9a3f('0x1d')](_0x406d31);}return _0x352e17['status'](_0x406d31)['end']();};}function respondWithResult(_0xb1c8b4,_0x5566e){_0x5566e=_0x5566e||0xc8;return function(_0x19ea2f){if(_0x19ea2f){return _0xb1c8b4[_0x9a3f('0x1e')](_0x5566e)[_0x9a3f('0x1f')](_0x19ea2f);}};}function respondWithFilteredResult(_0x350c34,_0x2e2335){return function(_0x5452aa){if(_0x5452aa){var _0x5293fc=typeof _0x2e2335[_0x9a3f('0x20')]===_0x9a3f('0x21')&&typeof _0x2e2335[_0x9a3f('0x22')]==='undefined';var _0x417726=_0x5452aa[_0x9a3f('0x23')];var _0x352c74=_0x5293fc?0x0:_0x2e2335[_0x9a3f('0x20')];var _0x13eccb=_0x5293fc?_0x5452aa['count']:_0x2e2335['offset']+_0x2e2335['limit'];var _0x119c4b;if(_0x13eccb>=_0x417726){_0x13eccb=_0x417726;_0x119c4b=0xc8;}else{_0x119c4b=0xce;}_0x350c34[_0x9a3f('0x1e')](_0x119c4b);return _0x350c34[_0x9a3f('0x24')]('Content-Range',_0x352c74+'-'+_0x13eccb+'/'+_0x417726)[_0x9a3f('0x1f')](_0x5452aa);}return null;};}function patchUpdates(_0x2b1682){return function(_0x4a5e6b){try{jsonpatch[_0x9a3f('0x25')](_0x4a5e6b,_0x2b1682,!![]);}catch(_0x420b5d){return BPromise[_0x9a3f('0x26')](_0x420b5d);}return _0x4a5e6b[_0x9a3f('0x27')]();};}function saveUpdates(_0x26696a,_0x31ac49){return function(_0x38c9ff){if(_0x38c9ff){return _0x38c9ff[_0x9a3f('0x28')](_0x26696a)['then'](function(_0x1d218c){return _0x1d218c;});}return null;};}function removeEntity(_0x15982a,_0xce18fa){return function(_0xdc7a32){if(_0xdc7a32){return _0xdc7a32['destroy']()[_0x9a3f('0x29')](function(){_0x15982a['status'](0xcc)[_0x9a3f('0x2a')]();});}};}function handleEntityNotFound(_0x227f77,_0x4bb14e){return function(_0x2e928c){if(!_0x2e928c){_0x227f77['sendStatus'](0x194);}return _0x2e928c;};}function handleError(_0x112bf5,_0xe5cb4f){_0xe5cb4f=_0xe5cb4f||0x1f4;return function(_0x2d70c4){logger[_0x9a3f('0x2b')](_0x2d70c4[_0x9a3f('0x2c')]);if(_0x2d70c4['name']){delete _0x2d70c4[_0x9a3f('0x2d')];}_0x112bf5[_0x9a3f('0x1e')](_0xe5cb4f)[_0x9a3f('0x2e')](_0x2d70c4);};}exports['index']=function(_0x4bd3a5,_0x2e41f7){var _0x4bd580={},_0x71eb66={},_0x27d4e2={'count':0x0,'rows':[]};var _0x52a594=_['map'](db[_0x9a3f('0x2f')][_0x9a3f('0x30')],function(_0x450217){return{'name':_0x450217[_0x9a3f('0x31')],'type':_0x450217['type'][_0x9a3f('0x32')]};});_0x71eb66[_0x9a3f('0x33')]=_[_0x9a3f('0x34')](_0x52a594,_0x9a3f('0x2d'));_0x71eb66[_0x9a3f('0x35')]=_['keys'](_0x4bd3a5[_0x9a3f('0x35')]);_0x71eb66[_0x9a3f('0x36')]=_[_0x9a3f('0x37')](_0x71eb66[_0x9a3f('0x33')],_0x71eb66[_0x9a3f('0x35')]);_0x4bd580['attributes']=_['intersection'](_0x71eb66[_0x9a3f('0x33')],qs[_0x9a3f('0x38')](_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x38')]));_0x4bd580['attributes']=_0x4bd580[_0x9a3f('0x39')][_0x9a3f('0x3a')]?_0x4bd580['attributes']:_0x71eb66[_0x9a3f('0x33')];if(!_0x4bd3a5[_0x9a3f('0x35')]['hasOwnProperty'](_0x9a3f('0x3b'))){_0x4bd580[_0x9a3f('0x22')]=qs[_0x9a3f('0x22')](_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x22')]);_0x4bd580[_0x9a3f('0x20')]=qs[_0x9a3f('0x20')](_0x4bd3a5['query']['offset']);}_0x4bd580[_0x9a3f('0x3c')]=qs[_0x9a3f('0x3d')](_0x4bd3a5[_0x9a3f('0x35')]['sort']);_0x4bd580[_0x9a3f('0x3e')]=qs[_0x9a3f('0x36')](_['pick'](_0x4bd3a5['query'],_0x71eb66[_0x9a3f('0x36')]),_0x52a594);if(_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x3f')]){_0x4bd580[_0x9a3f('0x3e')]=_[_0x9a3f('0x40')](_0x4bd580['where'],{'$or':_['map'](_0x52a594,function(_0x197f39){if(_0x197f39[_0x9a3f('0x41')]!==_0x9a3f('0x42')){var _0x2cf6da={};_0x2cf6da[_0x197f39['name']]={'$like':'%'+_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x3f')]+'%'};return _0x2cf6da;}})});}_0x4bd580=_[_0x9a3f('0x40')]({},_0x4bd580,_0x4bd3a5['options']);var _0x84fce1={'where':_0x4bd580[_0x9a3f('0x3e')]};return db[_0x9a3f('0x2f')][_0x9a3f('0x23')](_0x84fce1)[_0x9a3f('0x29')](function(_0x57ebd4){_0x27d4e2[_0x9a3f('0x23')]=_0x57ebd4;if(_0x4bd3a5[_0x9a3f('0x35')][_0x9a3f('0x43')]){_0x4bd580[_0x9a3f('0x44')]=[{'all':!![]}];}return db[_0x9a3f('0x2f')][_0x9a3f('0x45')](_0x4bd580);})[_0x9a3f('0x29')](function(_0x4243b6){_0x27d4e2[_0x9a3f('0x46')]=_0x4243b6;return _0x27d4e2;})[_0x9a3f('0x29')](respondWithFilteredResult(_0x2e41f7,_0x4bd580))[_0x9a3f('0x47')](handleError(_0x2e41f7,null));};exports[_0x9a3f('0x48')]=function(_0x215c29,_0x5b54d6){var _0x304d06={'raw':!![],'where':{'id':_0x215c29[_0x9a3f('0x49')]['id']}},_0x3a79b6={};_0x3a79b6[_0x9a3f('0x33')]=_[_0x9a3f('0x4a')](db[_0x9a3f('0x2f')][_0x9a3f('0x30')]);_0x3a79b6[_0x9a3f('0x35')]=_[_0x9a3f('0x4a')](_0x215c29['query']);_0x3a79b6[_0x9a3f('0x36')]=_[_0x9a3f('0x37')](_0x3a79b6[_0x9a3f('0x33')],_0x3a79b6[_0x9a3f('0x35')]);_0x304d06[_0x9a3f('0x39')]=_[_0x9a3f('0x37')](_0x3a79b6[_0x9a3f('0x33')],qs[_0x9a3f('0x38')](_0x215c29[_0x9a3f('0x35')][_0x9a3f('0x38')]));_0x304d06[_0x9a3f('0x39')]=_0x304d06[_0x9a3f('0x39')][_0x9a3f('0x3a')]?_0x304d06[_0x9a3f('0x39')]:_0x3a79b6[_0x9a3f('0x33')];if(_0x215c29[_0x9a3f('0x35')][_0x9a3f('0x43')]){_0x304d06['include']=[{'all':!![]}];}_0x304d06=_[_0x9a3f('0x40')]({},_0x304d06,_0x215c29['options']);return db[_0x9a3f('0x2f')]['find'](_0x304d06)[_0x9a3f('0x29')](handleEntityNotFound(_0x5b54d6,null))[_0x9a3f('0x29')](respondWithResult(_0x5b54d6,null))[_0x9a3f('0x47')](handleError(_0x5b54d6,null));};exports[_0x9a3f('0x4b')]=function(_0x3622e4,_0x1c68e9){return db[_0x9a3f('0x2f')]['create'](_0x3622e4['body'],{})[_0x9a3f('0x29')](respondWithResult(_0x1c68e9,0xc9))[_0x9a3f('0x47')](handleError(_0x1c68e9,null));};exports[_0x9a3f('0x28')]=function(_0x4401b5,_0x399537){if(_0x4401b5[_0x9a3f('0x4c')]['id']){delete _0x4401b5[_0x9a3f('0x4c')]['id'];}return db[_0x9a3f('0x2f')][_0x9a3f('0x4d')]({'where':{'id':_0x4401b5[_0x9a3f('0x49')]['id']}})['then'](handleEntityNotFound(_0x399537,null))[_0x9a3f('0x29')](saveUpdates(_0x4401b5[_0x9a3f('0x4c')],null))[_0x9a3f('0x29')](respondWithResult(_0x399537,null))[_0x9a3f('0x47')](handleError(_0x399537,null));};exports['destroy']=function(_0x2cfeaf,_0x49ea22){return db[_0x9a3f('0x2f')][_0x9a3f('0x4d')]({'where':{'id':_0x2cfeaf[_0x9a3f('0x49')]['id']}})[_0x9a3f('0x29')](handleEntityNotFound(_0x49ea22,null))[_0x9a3f('0x29')](removeEntity(_0x49ea22,null))[_0x9a3f('0x47')](handleError(_0x49ea22,null));}; \ No newline at end of file +var _0xfb16=['update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','SalesforceField','findAll','rows','show','params','includeAll','options','find','create','body','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x4e9f1e,_0x1174e4){var _0x32070b=function(_0x3b7af6){while(--_0x3b7af6){_0x4e9f1e['push'](_0x4e9f1e['shift']());}};_0x32070b(++_0x1174e4);}(_0xfb16,0x118));var _0x6fb1=function(_0x5c97ba,_0x2222e4){_0x5c97ba=_0x5c97ba-0x0;var _0x5e8430=_0xfb16[_0x5c97ba];return _0x5e8430;};'use strict';var emlformat=require(_0x6fb1('0x0'));var rimraf=require(_0x6fb1('0x1'));var zipdir=require(_0x6fb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fb1('0x3'));var BPromise=require(_0x6fb1('0x4'));var Mustache=require(_0x6fb1('0x5'));var util=require(_0x6fb1('0x6'));var path=require(_0x6fb1('0x7'));var sox=require(_0x6fb1('0x8'));var csv=require(_0x6fb1('0x9'));var ejs=require(_0x6fb1('0xa'));var fs=require('fs');var fs_extra=require(_0x6fb1('0xb'));var _=require(_0x6fb1('0xc'));var squel=require(_0x6fb1('0xd'));var crypto=require(_0x6fb1('0xe'));var jsforce=require(_0x6fb1('0xf'));var deskjs=require(_0x6fb1('0x10'));var toCsv=require(_0x6fb1('0x9'));var querystring=require(_0x6fb1('0x11'));var Papa=require(_0x6fb1('0x12'));var Redis=require(_0x6fb1('0x13'));var authService=require(_0x6fb1('0x14'));var qs=require(_0x6fb1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fb1('0x16'));var logger=require(_0x6fb1('0x17'))(_0x6fb1('0x18'));var utils=require('../../config/utils');var config=require(_0x6fb1('0x19'));var licenseUtil=require(_0x6fb1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb42529,_0x313dab){_0x313dab=_0x313dab||0xcc;return function(_0x27cefa){if(_0x27cefa){return _0xb42529[_0x6fb1('0x1b')](_0x313dab);}return _0xb42529[_0x6fb1('0x1c')](_0x313dab)[_0x6fb1('0x1d')]();};}function respondWithResult(_0x4a416d,_0x58d6c8){_0x58d6c8=_0x58d6c8||0xc8;return function(_0x375787){if(_0x375787){return _0x4a416d[_0x6fb1('0x1c')](_0x58d6c8)[_0x6fb1('0x1e')](_0x375787);}};}function respondWithFilteredResult(_0x2faaaa,_0x2e8165){return function(_0x35a40a){if(_0x35a40a){var _0x24b40=typeof _0x2e8165[_0x6fb1('0x1f')]===_0x6fb1('0x20')&&typeof _0x2e8165[_0x6fb1('0x21')]===_0x6fb1('0x20');var _0x2c4693=_0x35a40a[_0x6fb1('0x22')];var _0x4a12a3=_0x24b40?0x0:_0x2e8165['offset'];var _0x3476b3=_0x24b40?_0x35a40a[_0x6fb1('0x22')]:_0x2e8165['offset']+_0x2e8165[_0x6fb1('0x21')];var _0x442b18;if(_0x3476b3>=_0x2c4693){_0x3476b3=_0x2c4693;_0x442b18=0xc8;}else{_0x442b18=0xce;}_0x2faaaa['status'](_0x442b18);return _0x2faaaa[_0x6fb1('0x23')](_0x6fb1('0x24'),_0x4a12a3+'-'+_0x3476b3+'/'+_0x2c4693)[_0x6fb1('0x1e')](_0x35a40a);}return null;};}function patchUpdates(_0x9c5f26){return function(_0x5a6c7c){try{jsonpatch[_0x6fb1('0x25')](_0x5a6c7c,_0x9c5f26,!![]);}catch(_0x401609){return BPromise[_0x6fb1('0x26')](_0x401609);}return _0x5a6c7c[_0x6fb1('0x27')]();};}function saveUpdates(_0x56fc6f,_0x4bf527){return function(_0x455cc9){if(_0x455cc9){return _0x455cc9[_0x6fb1('0x28')](_0x56fc6f)[_0x6fb1('0x29')](function(_0x255f19){return _0x255f19;});}return null;};}function removeEntity(_0x40c9a9,_0x2ec445){return function(_0x8afa1c){if(_0x8afa1c){return _0x8afa1c[_0x6fb1('0x2a')]()[_0x6fb1('0x29')](function(){_0x40c9a9[_0x6fb1('0x1c')](0xcc)[_0x6fb1('0x1d')]();});}};}function handleEntityNotFound(_0x24083f,_0x42307a){return function(_0x5c5b25){if(!_0x5c5b25){_0x24083f[_0x6fb1('0x1b')](0x194);}return _0x5c5b25;};}function handleError(_0x52f1fd,_0x40fd09){_0x40fd09=_0x40fd09||0x1f4;return function(_0x4170dd){logger[_0x6fb1('0x2b')](_0x4170dd[_0x6fb1('0x2c')]);if(_0x4170dd[_0x6fb1('0x2d')]){delete _0x4170dd['name'];}_0x52f1fd['status'](_0x40fd09)[_0x6fb1('0x2e')](_0x4170dd);};}exports[_0x6fb1('0x2f')]=function(_0x4006d2,_0x266daf){var _0x17702b={},_0x53adb3={},_0x24ccb3={'count':0x0,'rows':[]};var _0x24af12=_['map'](db['SalesforceField'][_0x6fb1('0x30')],function(_0x3095ff){return{'name':_0x3095ff[_0x6fb1('0x31')],'type':_0x3095ff[_0x6fb1('0x32')][_0x6fb1('0x33')]};});_0x53adb3[_0x6fb1('0x34')]=_[_0x6fb1('0x35')](_0x24af12,_0x6fb1('0x2d'));_0x53adb3[_0x6fb1('0x36')]=_[_0x6fb1('0x37')](_0x4006d2[_0x6fb1('0x36')]);_0x53adb3['filters']=_[_0x6fb1('0x38')](_0x53adb3[_0x6fb1('0x34')],_0x53adb3['query']);_0x17702b[_0x6fb1('0x39')]=_[_0x6fb1('0x38')](_0x53adb3[_0x6fb1('0x34')],qs[_0x6fb1('0x3a')](_0x4006d2[_0x6fb1('0x36')][_0x6fb1('0x3a')]));_0x17702b['attributes']=_0x17702b[_0x6fb1('0x39')][_0x6fb1('0x3b')]?_0x17702b[_0x6fb1('0x39')]:_0x53adb3[_0x6fb1('0x34')];if(!_0x4006d2[_0x6fb1('0x36')][_0x6fb1('0x3c')](_0x6fb1('0x3d'))){_0x17702b[_0x6fb1('0x21')]=qs[_0x6fb1('0x21')](_0x4006d2[_0x6fb1('0x36')]['limit']);_0x17702b['offset']=qs[_0x6fb1('0x1f')](_0x4006d2[_0x6fb1('0x36')]['offset']);}_0x17702b[_0x6fb1('0x3e')]=qs['sort'](_0x4006d2[_0x6fb1('0x36')][_0x6fb1('0x3f')]);_0x17702b[_0x6fb1('0x40')]=qs['filters'](_['pick'](_0x4006d2[_0x6fb1('0x36')],_0x53adb3[_0x6fb1('0x41')]),_0x24af12);if(_0x4006d2[_0x6fb1('0x36')][_0x6fb1('0x42')]){_0x17702b[_0x6fb1('0x40')]=_['merge'](_0x17702b['where'],{'$or':_['map'](_0x24af12,function(_0x558f3d){if(_0x558f3d[_0x6fb1('0x32')]!==_0x6fb1('0x43')){var _0x44fd79={};_0x44fd79[_0x558f3d['name']]={'$like':'%'+_0x4006d2[_0x6fb1('0x36')]['filter']+'%'};return _0x44fd79;}})});}_0x17702b=_[_0x6fb1('0x44')]({},_0x17702b,_0x4006d2['options']);var _0x403792={'where':_0x17702b[_0x6fb1('0x40')]};return db[_0x6fb1('0x45')][_0x6fb1('0x22')](_0x403792)[_0x6fb1('0x29')](function(_0xa3cdf5){_0x24ccb3[_0x6fb1('0x22')]=_0xa3cdf5;if(_0x4006d2['query']['includeAll']){_0x17702b['include']=[{'all':!![]}];}return db[_0x6fb1('0x45')][_0x6fb1('0x46')](_0x17702b);})['then'](function(_0x430e15){_0x24ccb3[_0x6fb1('0x47')]=_0x430e15;return _0x24ccb3;})['then'](respondWithFilteredResult(_0x266daf,_0x17702b))['catch'](handleError(_0x266daf,null));};exports[_0x6fb1('0x48')]=function(_0x283c2f,_0x36a7ac){var _0x4f4fe1={'raw':!![],'where':{'id':_0x283c2f[_0x6fb1('0x49')]['id']}},_0x5e69c3={};_0x5e69c3[_0x6fb1('0x34')]=_[_0x6fb1('0x37')](db['SalesforceField'][_0x6fb1('0x30')]);_0x5e69c3[_0x6fb1('0x36')]=_['keys'](_0x283c2f['query']);_0x5e69c3['filters']=_[_0x6fb1('0x38')](_0x5e69c3[_0x6fb1('0x34')],_0x5e69c3[_0x6fb1('0x36')]);_0x4f4fe1[_0x6fb1('0x39')]=_[_0x6fb1('0x38')](_0x5e69c3['model'],qs['fields'](_0x283c2f[_0x6fb1('0x36')]['fields']));_0x4f4fe1['attributes']=_0x4f4fe1[_0x6fb1('0x39')][_0x6fb1('0x3b')]?_0x4f4fe1[_0x6fb1('0x39')]:_0x5e69c3[_0x6fb1('0x34')];if(_0x283c2f[_0x6fb1('0x36')][_0x6fb1('0x4a')]){_0x4f4fe1['include']=[{'all':!![]}];}_0x4f4fe1=_[_0x6fb1('0x44')]({},_0x4f4fe1,_0x283c2f[_0x6fb1('0x4b')]);return db['SalesforceField'][_0x6fb1('0x4c')](_0x4f4fe1)[_0x6fb1('0x29')](handleEntityNotFound(_0x36a7ac,null))['then'](respondWithResult(_0x36a7ac,null))['catch'](handleError(_0x36a7ac,null));};exports[_0x6fb1('0x4d')]=function(_0x4610ed,_0x2f34a8){return db[_0x6fb1('0x45')][_0x6fb1('0x4d')](_0x4610ed[_0x6fb1('0x4e')],{})[_0x6fb1('0x29')](respondWithResult(_0x2f34a8,0xc9))[_0x6fb1('0x4f')](handleError(_0x2f34a8,null));};exports['update']=function(_0x7d681b,_0xa6ab91){if(_0x7d681b[_0x6fb1('0x4e')]['id']){delete _0x7d681b[_0x6fb1('0x4e')]['id'];}return db[_0x6fb1('0x45')][_0x6fb1('0x4c')]({'where':{'id':_0x7d681b['params']['id']}})[_0x6fb1('0x29')](handleEntityNotFound(_0xa6ab91,null))['then'](saveUpdates(_0x7d681b[_0x6fb1('0x4e')],null))[_0x6fb1('0x29')](respondWithResult(_0xa6ab91,null))['catch'](handleError(_0xa6ab91,null));};exports['destroy']=function(_0x3e5f06,_0x4ec2ba){return db[_0x6fb1('0x45')][_0x6fb1('0x4c')]({'where':{'id':_0x3e5f06['params']['id']}})[_0x6fb1('0x29')](handleEntityNotFound(_0x4ec2ba,null))[_0x6fb1('0x29')](removeEntity(_0x4ec2ba,null))['catch'](handleError(_0x4ec2ba,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0d2c54c..130da0f 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 _0x0b6f=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId'];(function(_0x1ce464,_0x5e3f41){var _0x3381d8=function(_0x2c742c){while(--_0x2c742c){_0x1ce464['push'](_0x1ce464['shift']());}};_0x3381d8(++_0x5e3f41);}(_0x0b6f,0xd2));var _0xf0b6=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x0b6f[_0x408e38];return _0x426b0e;};'use strict';var _=require(_0xf0b6('0x0'));var util=require('util');var logger=require(_0xf0b6('0x1'))(_0xf0b6('0x2'));var moment=require('moment');var BPromise=require(_0xf0b6('0x3'));var rp=require(_0xf0b6('0x4'));var fs=require('fs');var path=require(_0xf0b6('0x5'));var rimraf=require(_0xf0b6('0x6'));var config=require('../../config/environment');var attributes=require(_0xf0b6('0x7'));module[_0xf0b6('0x8')]=function(_0x43c657,_0x110468){return _0x43c657[_0xf0b6('0x9')](_0xf0b6('0xa'),attributes,{'tableName':_0xf0b6('0xb'),'paranoid':![],'indexes':[{'name':_0xf0b6('0xc'),'fields':['idField',_0xf0b6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ef=['SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define'];(function(_0x341e09,_0x452ea1){var _0x939ab=function(_0x36a4f7){while(--_0x36a4f7){_0x341e09['push'](_0x341e09['shift']());}};_0x939ab(++_0x452ea1);}(_0xe9ef,0xa5));var _0xfe9e=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0xe9ef[_0x31cc0e];return _0x144862;};'use strict';var _=require('lodash');var util=require(_0xfe9e('0x0'));var logger=require(_0xfe9e('0x1'))(_0xfe9e('0x2'));var moment=require(_0xfe9e('0x3'));var BPromise=require(_0xfe9e('0x4'));var rp=require(_0xfe9e('0x5'));var fs=require('fs');var path=require(_0xfe9e('0x6'));var rimraf=require(_0xfe9e('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe9e('0x8'));module[_0xfe9e('0x9')]=function(_0x45c424,_0x4a3478){return _0x45c424[_0xfe9e('0xa')](_0xfe9e('0xb'),attributes,{'tableName':_0xfe9e('0xc'),'paranoid':![],'indexes':[{'name':_0xfe9e('0xd'),'fields':[_0xfe9e('0xe'),_0xfe9e('0xf')],'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 16055a7..45ecdfb 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 _0xccb5=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x2b6985,_0x48aaaa){var _0x696bc1=function(_0x4e2702){while(--_0x4e2702){_0x2b6985['push'](_0x2b6985['shift']());}};_0x696bc1(++_0x48aaaa);}(_0xccb5,0x1ea));var _0x5ccb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xccb5[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5ccb('0x0'));var util=require(_0x5ccb('0x1'));var moment=require(_0x5ccb('0x2'));var BPromise=require(_0x5ccb('0x3'));var rs=require(_0x5ccb('0x4'));var fs=require('fs');var Redis=require(_0x5ccb('0x5'));var db=require(_0x5ccb('0x6'))['db'];var utils=require(_0x5ccb('0x7'));var logger=require(_0x5ccb('0x8'))(_0x5ccb('0x9'));var config=require(_0x5ccb('0xa'));var jayson=require(_0x5ccb('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8515,_0x128a5f,_0x2a4cb8){return new BPromise(function(_0x413924,_0x3b7bc2){return client['request'](_0x1f8515,_0x2a4cb8)[_0x5ccb('0xc')](function(_0x3014f0){logger['info'](_0x5ccb('0xd'),_0x128a5f,_0x5ccb('0xe'));logger['debug'](_0x5ccb('0xf'),_0x128a5f,_0x5ccb('0xe'),JSON[_0x5ccb('0x10')](_0x3014f0));if(_0x3014f0[_0x5ccb('0x11')]){if(_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x12')]===0x1f4){logger[_0x5ccb('0x11')](_0x5ccb('0xd'),_0x128a5f,_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x13')]);return _0x3b7bc2(_0x3014f0[_0x5ccb('0x11')]['message']);}logger[_0x5ccb('0x11')](_0x5ccb('0xd'),_0x128a5f,_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x13')]);return _0x413924(_0x3014f0[_0x5ccb('0x11')][_0x5ccb('0x13')]);}else{logger[_0x5ccb('0x14')]('SalesforceField,\x20%s,\x20%s',_0x128a5f,'request\x20sent');_0x413924(_0x3014f0[_0x5ccb('0x15')]['message']);}})[_0x5ccb('0x16')](function(_0xc94b39){logger[_0x5ccb('0x11')](_0x5ccb('0xd'),_0x128a5f,_0xc94b39);_0x3b7bc2(_0xc94b39);});});} \ No newline at end of file +var _0x0d7f=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xe67e22,_0x547e07){var _0x39ff12=function(_0x4496d2){while(--_0x4496d2){_0xe67e22['push'](_0xe67e22['shift']());}};_0x39ff12(++_0x547e07);}(_0x0d7f,0x125));var _0xf0d7=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x0d7f[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0xf0d7('0x0'));var util=require(_0xf0d7('0x1'));var moment=require(_0xf0d7('0x2'));var BPromise=require(_0xf0d7('0x3'));var rs=require(_0xf0d7('0x4'));var fs=require('fs');var Redis=require(_0xf0d7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0d7('0x6'));var logger=require(_0xf0d7('0x7'))('rpc');var config=require(_0xf0d7('0x8'));var jayson=require(_0xf0d7('0x9'));var client=jayson['client'][_0xf0d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bddbb,_0x9d9cf6,_0x54c891){return new BPromise(function(_0x562cc3,_0x3ef35d){return client[_0xf0d7('0xb')](_0x2bddbb,_0x54c891)[_0xf0d7('0xc')](function(_0x1681d3){logger[_0xf0d7('0xd')](_0xf0d7('0xe'),_0x9d9cf6,'request\x20sent');logger[_0xf0d7('0xf')](_0xf0d7('0x10'),_0x9d9cf6,_0xf0d7('0x11'),JSON[_0xf0d7('0x12')](_0x1681d3));if(_0x1681d3['error']){if(_0x1681d3[_0xf0d7('0x13')][_0xf0d7('0x14')]===0x1f4){logger[_0xf0d7('0x13')](_0xf0d7('0xe'),_0x9d9cf6,_0x1681d3['error'][_0xf0d7('0x15')]);return _0x3ef35d(_0x1681d3[_0xf0d7('0x13')]['message']);}logger[_0xf0d7('0x13')](_0xf0d7('0xe'),_0x9d9cf6,_0x1681d3[_0xf0d7('0x13')][_0xf0d7('0x15')]);return _0x562cc3(_0x1681d3[_0xf0d7('0x13')][_0xf0d7('0x15')]);}else{logger['info'](_0xf0d7('0xe'),_0x9d9cf6,'request\x20sent');_0x562cc3(_0x1681d3[_0xf0d7('0x16')][_0xf0d7('0x15')]);}})[_0xf0d7('0x17')](function(_0x3f71da){logger[_0xf0d7('0x13')](_0xf0d7('0xe'),_0x9d9cf6,_0x3f71da);_0x3ef35d(_0x3f71da);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 11e8324..249f0e8 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 _0xf0db=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','/:id/configurations','get','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x447c93,_0x52f6ad){var _0x3cf531=function(_0x2f1462){while(--_0x2f1462){_0x447c93['push'](_0x447c93['shift']());}};_0x3cf531(++_0x52f6ad);}(_0xf0db,0x160));var _0xbf0d=function(_0x23c1e0,_0x2b78f3){_0x23c1e0=_0x23c1e0-0x0;var _0x14b5d3=_0xf0db[_0x23c1e0];return _0x14b5d3;};'use strict';var multer=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var path=require(_0xbf0d('0x2'));var timeout=require(_0xbf0d('0x3'));var express=require(_0xbf0d('0x4'));var router=express[_0xbf0d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbf0d('0x6'));var interaction=require(_0xbf0d('0x7'));var config=require(_0xbf0d('0x8'));var controller=require(_0xbf0d('0x9'));router['get']('/',auth[_0xbf0d('0xa')](),controller[_0xbf0d('0xb')]);router['get'](_0xbf0d('0xc'),auth['isAuthenticated'](),controller[_0xbf0d('0xd')]);router['get'](_0xbf0d('0xe'),auth[_0xbf0d('0xa')](),controller['getConfigurations']);router[_0xbf0d('0xf')](_0xbf0d('0x10'),auth['isAuthenticated'](),controller[_0xbf0d('0x11')]);router[_0xbf0d('0x12')]('/',auth[_0xbf0d('0xa')](),controller[_0xbf0d('0x13')]);router['post'](_0xbf0d('0xe'),auth[_0xbf0d('0xa')](),controller[_0xbf0d('0x14')]);router[_0xbf0d('0x15')](_0xbf0d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbf0d('0x16')](_0xbf0d('0xc'),auth[_0xbf0d('0xa')](),controller[_0xbf0d('0x17')]);module[_0xbf0d('0x18')]=router; \ No newline at end of file +var _0x2e76=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2e76,0x199));var _0x62e7=function(_0x577701,_0x357a88){_0x577701=_0x577701-0x0;var _0x2ad08d=_0x2e76[_0x577701];return _0x2ad08d;};'use strict';var multer=require(_0x62e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62e7('0x1'));var express=require('express');var router=express[_0x62e7('0x2')]();var fs_extra=require(_0x62e7('0x3'));var auth=require(_0x62e7('0x4'));var interaction=require(_0x62e7('0x5'));var config=require(_0x62e7('0x6'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x62e7('0x7')](),controller['index']);router['get'](_0x62e7('0x8'),auth[_0x62e7('0x7')](),controller['show']);router['get'](_0x62e7('0x9'),auth['isAuthenticated'](),controller[_0x62e7('0xa')]);router['get'](_0x62e7('0xb'),auth[_0x62e7('0x7')](),controller[_0x62e7('0xc')]);router[_0x62e7('0xd')]('/',auth[_0x62e7('0x7')](),controller[_0x62e7('0xe')]);router[_0x62e7('0xd')](_0x62e7('0x9'),auth[_0x62e7('0x7')](),controller[_0x62e7('0xf')]);router[_0x62e7('0x10')]('/:id',auth[_0x62e7('0x7')](),controller[_0x62e7('0x11')]);router['delete'](_0x62e7('0x8'),auth[_0x62e7('0x7')](),controller[_0x62e7('0x12')]);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 d26a48f..e49806c 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 _0x88c1=['STRING','username'];(function(_0xeedc37,_0x471981){var _0x3a4bcd=function(_0x43984e){while(--_0x43984e){_0xeedc37['push'](_0xeedc37['shift']());}};_0x3a4bcd(++_0x471981);}(_0x88c1,0x98));var _0x188c=function(_0xf9b6da,_0x25eb5d){_0xf9b6da=_0xf9b6da-0x0;var _0x3d6658=_0x88c1[_0xf9b6da];return _0x3d6658;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x188c('0x0')]},'description':{'type':Sequelize[_0x188c('0x0')]},'username':{'type':Sequelize[_0x188c('0x0')],'unique':_0x188c('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x188c('0x0')]},'remoteUri':{'type':Sequelize[_0x188c('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x188c('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x7a16=['remoteUri','sequelize','STRING','username'];(function(_0x580fa9,_0x49d09f){var _0x418ea2=function(_0x1b0485){while(--_0x1b0485){_0x580fa9['push'](_0x580fa9['shift']());}};_0x418ea2(++_0x49d09f);}(_0x7a16,0x115));var _0x67a1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7a16[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x67a1('0x0'));module['exports']={'name':{'type':Sequelize[_0x67a1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x67a1('0x2')},'password':{'type':Sequelize[_0x67a1('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x67a1('0x1')],'unique':_0x67a1('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 8deb073..8f84bbf 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 _0x6a7d=['sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','include','findAll','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','ServiceNow\x20error:\x20','Wrong\x20credentials','statusCode','boolean','true','false','inactive','value','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x5be8a1,_0x292a52){var _0x5f4587=function(_0x44874b){while(--_0x44874b){_0x5be8a1['push'](_0x5be8a1['shift']());}};_0x5f4587(++_0x292a52);}(_0x6a7d,0x77));var _0xd6a7=function(_0x33c638,_0x462bff){_0x33c638=_0x33c638-0x0;var _0x18a079=_0x6a7d[_0x33c638];return _0x18a079;};'use strict';var emlformat=require(_0xd6a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6a7('0x2'));var moment=require('moment');var BPromise=require(_0xd6a7('0x3'));var Mustache=require(_0xd6a7('0x4'));var util=require('util');var path=require(_0xd6a7('0x5'));var sox=require(_0xd6a7('0x6'));var csv=require(_0xd6a7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6a7('0x8'));var _=require(_0xd6a7('0x9'));var squel=require(_0xd6a7('0xa'));var crypto=require(_0xd6a7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd6a7('0x7'));var querystring=require(_0xd6a7('0xc'));var Papa=require('papaparse');var Redis=require(_0xd6a7('0xd'));var authService=require(_0xd6a7('0xe'));var qs=require(_0xd6a7('0xf'));var as=require(_0xd6a7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6a7('0x11'));var utils=require(_0xd6a7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd6a7('0x13'));var db=require(_0xd6a7('0x14'))['db'];var integrations=require(_0xd6a7('0x15'));function respondWithStatusCode(_0xffc26a,_0x2d2766){_0x2d2766=_0x2d2766||0xcc;return function(_0x366e04){if(_0x366e04){return _0xffc26a[_0xd6a7('0x16')](_0x2d2766);}return _0xffc26a[_0xd6a7('0x17')](_0x2d2766)['end']();};}function respondWithResult(_0x357264,_0x56f492){_0x56f492=_0x56f492||0xc8;return function(_0x31edd7){if(_0x31edd7){return _0x357264['status'](_0x56f492)[_0xd6a7('0x18')](_0x31edd7);}};}function respondWithFilteredResult(_0x43d1cb,_0x58ea45){return function(_0x277542){if(_0x277542){var _0x4499f8=typeof _0x58ea45['offset']==='undefined'&&typeof _0x58ea45[_0xd6a7('0x19')]===_0xd6a7('0x1a');var _0x25c735=_0x277542[_0xd6a7('0x1b')];var _0x265059=_0x4499f8?0x0:_0x58ea45['offset'];var _0x4ba056=_0x4499f8?_0x277542[_0xd6a7('0x1b')]:_0x58ea45[_0xd6a7('0x1c')]+_0x58ea45['limit'];var _0x554f31;if(_0x4ba056>=_0x25c735){_0x4ba056=_0x25c735;_0x554f31=0xc8;}else{_0x554f31=0xce;}_0x43d1cb[_0xd6a7('0x17')](_0x554f31);return _0x43d1cb[_0xd6a7('0x1d')]('Content-Range',_0x265059+'-'+_0x4ba056+'/'+_0x25c735)[_0xd6a7('0x18')](_0x277542);}return null;};}function patchUpdates(_0x50fd0a){return function(_0x1dab50){try{jsonpatch[_0xd6a7('0x1e')](_0x1dab50,_0x50fd0a,!![]);}catch(_0x22b3d5){return BPromise[_0xd6a7('0x1f')](_0x22b3d5);}return _0x1dab50[_0xd6a7('0x20')]();};}function saveUpdates(_0x57a796,_0x5dcb04){return function(_0x41b1ca){if(_0x41b1ca){return _0x41b1ca[_0xd6a7('0x21')](_0x57a796)[_0xd6a7('0x22')](function(_0x525bbb){return _0x525bbb;});}return null;};}function removeEntity(_0x1d807d,_0x182459){return function(_0x2d3a60){if(_0x2d3a60){return _0x2d3a60[_0xd6a7('0x23')]()[_0xd6a7('0x22')](function(){_0x1d807d[_0xd6a7('0x17')](0xcc)[_0xd6a7('0x24')]();});}};}function handleEntityNotFound(_0x4b78de,_0x1e94bc){return function(_0x297d9c){if(!_0x297d9c){_0x4b78de[_0xd6a7('0x16')](0x194);}return _0x297d9c;};}function handleError(_0x5b5a7a,_0x18eb66){_0x18eb66=_0x18eb66||0x1f4;return function(_0x48d7ad){logger[_0xd6a7('0x25')](_0x48d7ad[_0xd6a7('0x26')]);if(_0x48d7ad['name']){delete _0x48d7ad[_0xd6a7('0x27')];}_0x5b5a7a['status'](_0x18eb66)[_0xd6a7('0x28')](_0x48d7ad);};}exports[_0xd6a7('0x29')]=function(_0x9ea300,_0x535c56){var _0x30451c={},_0x5a53ea={},_0x4954d6={'count':0x0,'rows':[]};var _0x2ff72a=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0xccf3bf){return{'name':_0xccf3bf['fieldName'],'type':_0xccf3bf[_0xd6a7('0x2a')][_0xd6a7('0x2b')]};});_0x5a53ea[_0xd6a7('0x2c')]=_[_0xd6a7('0x2d')](_0x2ff72a,_0xd6a7('0x27'));_0x5a53ea[_0xd6a7('0x2e')]=_[_0xd6a7('0x2f')](_0x9ea300['query']);_0x5a53ea[_0xd6a7('0x30')]=_[_0xd6a7('0x31')](_0x5a53ea[_0xd6a7('0x2c')],_0x5a53ea['query']);_0x30451c[_0xd6a7('0x32')]=_['intersection'](_0x5a53ea[_0xd6a7('0x2c')],qs[_0xd6a7('0x33')](_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x33')]));_0x30451c[_0xd6a7('0x32')]=_0x30451c['attributes'][_0xd6a7('0x34')]?_0x30451c['attributes']:_0x5a53ea[_0xd6a7('0x2c')];if(!_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x35')]('nolimit')){_0x30451c[_0xd6a7('0x19')]=qs[_0xd6a7('0x19')](_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x19')]);_0x30451c[_0xd6a7('0x1c')]=qs['offset'](_0x9ea300[_0xd6a7('0x2e')]['offset']);}_0x30451c[_0xd6a7('0x36')]=qs[_0xd6a7('0x37')](_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x37')]);_0x30451c[_0xd6a7('0x38')]=qs[_0xd6a7('0x30')](_[_0xd6a7('0x39')](_0x9ea300[_0xd6a7('0x2e')],_0x5a53ea[_0xd6a7('0x30')]),_0x2ff72a);if(_0x9ea300[_0xd6a7('0x2e')][_0xd6a7('0x3a')]){_0x30451c[_0xd6a7('0x38')]=_[_0xd6a7('0x3b')](_0x30451c[_0xd6a7('0x38')],{'$or':_[_0xd6a7('0x2d')](_0x2ff72a,function(_0xcebbc7){if(_0xcebbc7['type']!==_0xd6a7('0x3c')){var _0x5e4062={};_0x5e4062[_0xcebbc7[_0xd6a7('0x27')]]={'$like':'%'+_0x9ea300[_0xd6a7('0x2e')]['filter']+'%'};return _0x5e4062;}})});}_0x30451c=_[_0xd6a7('0x3b')]({},_0x30451c,_0x9ea300[_0xd6a7('0x3d')]);var _0x4096de={'where':_0x30451c['where']};return db[_0xd6a7('0x3e')][_0xd6a7('0x1b')](_0x4096de)['then'](function(_0x3ef298){_0x4954d6[_0xd6a7('0x1b')]=_0x3ef298;if(_0x9ea300[_0xd6a7('0x2e')]['includeAll']){_0x30451c[_0xd6a7('0x3f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xd6a7('0x40')](_0x30451c);})[_0xd6a7('0x22')](function(_0x23f0c7){_0x4954d6['rows']=_0x23f0c7;return _0x4954d6;})[_0xd6a7('0x22')](respondWithFilteredResult(_0x535c56,_0x30451c))[_0xd6a7('0x41')](handleError(_0x535c56,null));};exports[_0xd6a7('0x42')]=function(_0x411a13,_0x25fdbc){var _0x55419b={'raw':![],'where':{'id':_0x411a13[_0xd6a7('0x43')]['id']}},_0x32bf2a={};_0x32bf2a[_0xd6a7('0x2c')]=_[_0xd6a7('0x2f')](db[_0xd6a7('0x3e')][_0xd6a7('0x44')]);_0x32bf2a['query']=_[_0xd6a7('0x2f')](_0x411a13[_0xd6a7('0x2e')]);_0x32bf2a[_0xd6a7('0x30')]=_['intersection'](_0x32bf2a[_0xd6a7('0x2c')],_0x32bf2a['query']);_0x55419b[_0xd6a7('0x32')]=_['intersection'](_0x32bf2a[_0xd6a7('0x2c')],qs[_0xd6a7('0x33')](_0x411a13['query'][_0xd6a7('0x33')]));_0x55419b[_0xd6a7('0x32')]=_0x55419b['attributes']['length']?_0x55419b['attributes']:_0x32bf2a[_0xd6a7('0x2c')];if(_0x411a13[_0xd6a7('0x2e')][_0xd6a7('0x45')]){_0x55419b[_0xd6a7('0x3f')]=[{'all':!![]}];}_0x55419b=_[_0xd6a7('0x3b')]({},_0x55419b,_0x411a13[_0xd6a7('0x3d')]);return db[_0xd6a7('0x3e')]['find'](_0x55419b)[_0xd6a7('0x22')](handleEntityNotFound(_0x25fdbc,null))[_0xd6a7('0x22')](respondWithResult(_0x25fdbc,null))['catch'](handleError(_0x25fdbc,null));};exports[_0xd6a7('0x46')]=function(_0x465bd8,_0x3af22a){return db[_0xd6a7('0x3e')]['create'](_0x465bd8[_0xd6a7('0x47')],{})[_0xd6a7('0x22')](respondWithResult(_0x3af22a,0xc9))[_0xd6a7('0x41')](handleError(_0x3af22a,null));};exports['update']=function(_0x345022,_0x1e2a3b){if(_0x345022['body']['id']){delete _0x345022['body']['id'];}return db[_0xd6a7('0x3e')][_0xd6a7('0x48')]({'where':{'id':_0x345022[_0xd6a7('0x43')]['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x1e2a3b,null))['then'](saveUpdates(_0x345022[_0xd6a7('0x47')],null))[_0xd6a7('0x22')](respondWithResult(_0x1e2a3b,null))[_0xd6a7('0x41')](handleError(_0x1e2a3b,null));};exports[_0xd6a7('0x23')]=function(_0x1e2564,_0x1c12d6){return db[_0xd6a7('0x3e')][_0xd6a7('0x48')]({'where':{'id':_0x1e2564[_0xd6a7('0x43')]['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x1c12d6,null))[_0xd6a7('0x22')](removeEntity(_0x1c12d6,null))[_0xd6a7('0x41')](handleError(_0x1c12d6,null));};exports['getConfigurations']=function(_0x419175,_0x343d41,_0x47e654){var _0x413161={};var _0x444606={};var _0x16d07c;var _0x4d2cdb;return db[_0xd6a7('0x3e')]['findOne']({'where':{'id':_0x419175['params']['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x343d41,null))['then'](function(_0x30280b){if(_0x30280b){_0x16d07c=_0x30280b;_0x444606[_0xd6a7('0x2c')]=_[_0xd6a7('0x2f')](db['ServicenowConfiguration'][_0xd6a7('0x44')]);_0x444606[_0xd6a7('0x2e')]=_[_0xd6a7('0x2f')](_0x419175['query']);_0x444606[_0xd6a7('0x30')]=_[_0xd6a7('0x31')](_0x444606[_0xd6a7('0x2c')],_0x444606[_0xd6a7('0x2e')]);_0x413161[_0xd6a7('0x32')]=_[_0xd6a7('0x31')](_0x444606[_0xd6a7('0x2c')],qs[_0xd6a7('0x33')](_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x33')]));_0x413161['attributes']=_0x413161[_0xd6a7('0x32')][_0xd6a7('0x34')]?_0x413161[_0xd6a7('0x32')]:_0x444606[_0xd6a7('0x2c')];_0x413161[_0xd6a7('0x36')]=qs[_0xd6a7('0x37')](_0x419175['query'][_0xd6a7('0x37')]);_0x413161['where']=qs[_0xd6a7('0x30')](_[_0xd6a7('0x39')](_0x419175[_0xd6a7('0x2e')],_0x444606[_0xd6a7('0x30')]));if(_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x3a')]){_0x413161[_0xd6a7('0x38')]=_[_0xd6a7('0x3b')](_0x413161['where'],{'$or':_[_0xd6a7('0x2d')](_0x413161[_0xd6a7('0x32')],function(_0x698cb1){var _0x344f79={};_0x344f79[_0x698cb1]={'$like':'%'+_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x3a')]+'%'};return _0x344f79;})});}_0x413161=_[_0xd6a7('0x3b')]({},_0x413161,_0x419175[_0xd6a7('0x3d')]);return _0x16d07c[_0xd6a7('0x49')](_0x413161);}})[_0xd6a7('0x22')](function(_0x48f68a){if(_0x48f68a){_0x4d2cdb=_0x48f68a[_0xd6a7('0x34')];if(!_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x35')]('nolimit')){_0x413161[_0xd6a7('0x19')]=qs[_0xd6a7('0x19')](_0x419175[_0xd6a7('0x2e')][_0xd6a7('0x19')]);_0x413161[_0xd6a7('0x1c')]=qs[_0xd6a7('0x1c')](_0x419175['query'][_0xd6a7('0x1c')]);}return _0x16d07c[_0xd6a7('0x49')](_0x413161);}})[_0xd6a7('0x22')](function(_0x50cecb){if(_0x50cecb){return _0x50cecb?{'count':_0x4d2cdb,'rows':_0x50cecb}:null;}})['then'](respondWithResult(_0x343d41,null))[_0xd6a7('0x41')](handleError(_0x343d41,null));};exports[_0xd6a7('0x4a')]=function(_0xa8b114,_0x255c51,_0x5c5d0f){if(_0xa8b114[_0xd6a7('0x47')]['id']){delete _0xa8b114['body']['id'];}return db[_0xd6a7('0x3e')][_0xd6a7('0x4b')]({'where':{'id':_0xa8b114[_0xd6a7('0x43')]['id']}})[_0xd6a7('0x22')](handleEntityNotFound(_0x255c51,null))['then'](function(_0x2d3455){if(_0x2d3455){_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x4c')]=_0x2d3455['id'];_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x4d')]=integrations[_0xd6a7('0x4e')](_0xa8b114[_0xd6a7('0x47')]['channel'],_0xa8b114[_0xd6a7('0x47')]['type']);_0xa8b114['body']['Descriptions']=integrations[_0xd6a7('0x4f')](_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x50')],_0xa8b114[_0xd6a7('0x47')][_0xd6a7('0x2a')]);return db[_0xd6a7('0x51')]['create'](_0xa8b114[_0xd6a7('0x47')],{'include':[{'model':db[_0xd6a7('0x52')],'as':_0xd6a7('0x4d')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x255c51,null))['catch'](handleError(_0x255c51,null));};exports[_0xd6a7('0x53')]=function(_0x2d07fa,_0x5cd7ad,_0x355de5){var _0x1fceba=[_0xd6a7('0x54'),_0xd6a7('0x55'),'knowledge',_0xd6a7('0x56'),_0xd6a7('0x57'),'notify','incident_state',_0xd6a7('0x58'),_0xd6a7('0x59')];var _0x20a4fe=['parent',_0xd6a7('0x54'),_0xd6a7('0x5a'),_0xd6a7('0x5b'),_0xd6a7('0x5c'),_0xd6a7('0x5d'),'child_incidents',_0xd6a7('0x55'),_0xd6a7('0x5e'),_0xd6a7('0x5f'),'resolved_by','sys_updated_by',_0xd6a7('0x60'),_0xd6a7('0x61'),_0xd6a7('0x62'),_0xd6a7('0x63'),'state',_0xd6a7('0x64'),_0xd6a7('0x65'),_0xd6a7('0x36'),_0xd6a7('0x66'),_0xd6a7('0x67'),_0xd6a7('0x68'),_0xd6a7('0x69'),'impact','active',_0xd6a7('0x6a'),_0xd6a7('0x6b'),_0xd6a7('0x6c'),_0xd6a7('0x6d'),_0xd6a7('0x6e'),_0xd6a7('0x6f'),'expected_start',_0xd6a7('0x70'),'business_duration','group_list',_0xd6a7('0x71'),_0xd6a7('0x72'),_0xd6a7('0x73'),'caller_id',_0xd6a7('0x74'),_0xd6a7('0x56'),_0xd6a7('0x75'),_0xd6a7('0x76'),_0xd6a7('0x57'),_0xd6a7('0x77'),_0xd6a7('0x78'),'work_start','assignment_group',_0xd6a7('0x79'),'additional_assignee_list','description',_0xd6a7('0x7a'),_0xd6a7('0x7b'),_0xd6a7('0x7c'),_0xd6a7('0x7d'),_0xd6a7('0x7e'),_0xd6a7('0x7f'),_0xd6a7('0x80'),'sys_id','contact_type','reopened_by','incident_state',_0xd6a7('0x81'),_0xd6a7('0x82'),_0xd6a7('0x83'),'reassignment_count',_0xd6a7('0x84'),_0xd6a7('0x85'),'severity',_0xd6a7('0x86'),_0xd6a7('0x87'),_0xd6a7('0x88'),_0xd6a7('0x89'),_0xd6a7('0x8a'),_0xd6a7('0x8b'),_0xd6a7('0x8c'),'sys_tags',_0xd6a7('0x8d'),_0xd6a7('0x8e'),'correlation_id',_0xd6a7('0x8f'),_0xd6a7('0x59')];var _0x442f1a='';var _0x44e1a4='';var _0xa9c4e0=[];var _0x4ce848='';var _0x3e3622='';var _0x1c39b0=[];var _0x1cb856='';var _0x545c73='';var _0x5c8d1c={};var _0x19ba1a='';return db[_0xd6a7('0x3e')][_0xd6a7('0x4b')]({'where':{'id':_0x2d07fa[_0xd6a7('0x43')]['id']},'attributes':['id',_0xd6a7('0x90'),'password',_0xd6a7('0x91'),_0xd6a7('0x92'),_0xd6a7('0x93')]})[_0xd6a7('0x22')](handleEntityNotFound(_0x5cd7ad,null))['then'](function(_0x14b67c){if(_0x14b67c){_0x19ba1a=_0x14b67c[_0xd6a7('0x92')];var _0xc49f99=_0x19ba1a[_0xd6a7('0x94')](-0x1);if(_0xc49f99==='/'){_0x19ba1a=_0x19ba1a[_0xd6a7('0x95')](0x0,_0x19ba1a[_0xd6a7('0x96')](_0xc49f99));}_0x545c73=util['format'](_0xd6a7('0x97'),_0x19ba1a);_0x1cb856=util['format']('%s/api/now/table/',_0x19ba1a);_0x5c8d1c={'user':_0x14b67c[_0xd6a7('0x90')],'pass':_0x14b67c['password']};var _0xccea5e={'method':_0xd6a7('0x98'),'uri':_0x545c73+_0xd6a7('0x99'),'auth':_0x5c8d1c,'json':!![]};return rp(_0xccea5e);}})[_0xd6a7('0x22')](function(_0x29e7ab){if(_0x29e7ab[_0xd6a7('0x9a')][_0xd6a7('0x34')]>0x0){_0x442f1a=_0x29e7ab[_0xd6a7('0x9a')];}console[_0xd6a7('0x9b')](_0xd6a7('0x9c'),_0x442f1a);_0x1c39b0=[];_0x44e1a4=Object[_0xd6a7('0x9d')]([],_0x442f1a);_[_0xd6a7('0x9e')](_0x44e1a4,function(_0x17c075){return!_0x1fceba[_0xd6a7('0x9f')](_0x17c075[_0xd6a7('0x27')]);});_0x44e1a4['forEach'](function(_0x1b91b2){var _0x43db38=createFieldObject(_0x1cb856,_0x5c8d1c,_0x1b91b2[_0xd6a7('0xa0')],_0x1b91b2[_0xd6a7('0x27')],_0x1b91b2[_0xd6a7('0xa1')],![]);_0x1c39b0[_0xd6a7('0xa2')](_0x43db38);});return Promise['all'](_0x1c39b0);})['then'](function(_0xc09471){_0xa9c4e0=_0xc09471;_0x4ce848=Object[_0xd6a7('0x9d')]([],_0x442f1a);console[_0xd6a7('0x9b')](_0xd6a7('0xa3'),_0x442f1a);_[_0xd6a7('0x9e')](_0x4ce848,function(_0x42fae7){return _0x20a4fe['includes'](_0x42fae7[_0xd6a7('0x27')]);});console[_0xd6a7('0x9b')](_0xd6a7('0xa4'),_0x4ce848);_0x1c39b0=[];_0x4ce848[_0xd6a7('0xa5')](function(_0x259c8b){var _0x2faec6=createFieldObject(_0x1cb856,_0x5c8d1c,_0x259c8b['internalType'],_0x259c8b[_0xd6a7('0x27')],_0x259c8b['label'],!![]);_0x1c39b0['push'](_0x2faec6);});return Promise['all'](_0x1c39b0);})[_0xd6a7('0x22')](function(_0x39f68c){_0x3e3622=_0x39f68c;var _0x378518=_0xa9c4e0['concat'](_0x3e3622);return{'count':_0x378518['length'],'rows':_0x378518};})[_0xd6a7('0x22')](respondWithResult(_0x5cd7ad,null))[_0xd6a7('0x41')](function(_0x14c91a){console[_0xd6a7('0x9b')](_0xd6a7('0xa6')+_0x14c91a);var _0x375ee3=_0x2d07fa['query']['test']?0x1f4:_0x14c91a['statusCode']||0x1f4;logger[_0xd6a7('0x25')](_0x14c91a[_0xd6a7('0x26')]);delete _0x14c91a[_0xd6a7('0x27')];if(_0x375ee3===0x191){_0x375ee3=0x190;}_0x5cd7ad[_0xd6a7('0x17')](_0x375ee3)['send'](_0x2d07fa[_0xd6a7('0x2e')]['test']?{'message':_0xd6a7('0xa7'),'statusCode':_0x14c91a[_0xd6a7('0xa8')]}:_0x14c91a);});};function createFieldObject(_0x26594a,_0x343ef6,_0x14fc99,_0x12d977,_0xe280a4,_0x516da7){return new Promise(function(_0xd6d96d,_0x330856){var _0x4383cf={'id':_0x12d977,'name':_0xe280a4,'custom':_0x516da7};if(_0x14fc99===_0xd6a7('0xa9')){_0x4383cf['options']=[{'name':'True','value':_0xd6a7('0xaa')},{'name':'False','value':_0xd6a7('0xab')}];_0xd6d96d(_0x4383cf);}else{var _0x5927ab={'method':_0xd6a7('0x98'),'uri':_0x26594a+'sys_choice?sysparm_query=name=incident^element='+_0x12d977,'auth':_0x343ef6,'json':!![]};return rp(_0x5927ab)[_0xd6a7('0x22')](function(_0x40a6e0){var _0x39eae1=[];if(_0x40a6e0['result'][_0xd6a7('0x34')]>0x0){_0x40a6e0[_0xd6a7('0x9a')][_0xd6a7('0xa5')](function(_0x472a4a){if(_0x472a4a[_0xd6a7('0xac')]==='false'){var _0x317283={'name':_0x472a4a[_0xd6a7('0xa1')],'value':_0x472a4a[_0xd6a7('0xad')]};_0x39eae1[_0xd6a7('0xa2')](_0x317283);}});}_0x4383cf[_0xd6a7('0x3d')]=_0x39eae1;if(_0x4383cf['options']['length']>0x0){_0xd6d96d(_0x4383cf);}else{if(_0x516da7==![]){_0xd6d96d();}else{_0xd6d96d(_0x4383cf);}}});}});} \ No newline at end of file +var _0xf1fa=['made_sla','caused_by','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','cmdb_ci','impact','work_notes_list','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent'];(function(_0x5ec945,_0x48d653){var _0x2325ef=function(_0x18cc50){while(--_0x18cc50){_0x5ec945['push'](_0x5ec945['shift']());}};_0x2325ef(++_0x48d653);}(_0xf1fa,0x1d2));var _0xaf1f=function(_0x26fb19,_0x4299bf){_0x26fb19=_0x26fb19-0x0;var _0x3b92a2=_0xf1fa[_0x26fb19];return _0x3b92a2;};'use strict';var emlformat=require(_0xaf1f('0x0'));var rimraf=require(_0xaf1f('0x1'));var zipdir=require(_0xaf1f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf1f('0x3'));var moment=require(_0xaf1f('0x4'));var BPromise=require(_0xaf1f('0x5'));var Mustache=require(_0xaf1f('0x6'));var util=require(_0xaf1f('0x7'));var path=require(_0xaf1f('0x8'));var sox=require('sox');var csv=require(_0xaf1f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf1f('0xa'));var squel=require(_0xaf1f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf1f('0xc'));var toCsv=require(_0xaf1f('0x9'));var querystring=require(_0xaf1f('0xd'));var Papa=require(_0xaf1f('0xe'));var Redis=require(_0xaf1f('0xf'));var authService=require(_0xaf1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaf1f('0x11'));var hardwareService=require(_0xaf1f('0x12'));var logger=require(_0xaf1f('0x13'))('api');var utils=require(_0xaf1f('0x14'));var config=require(_0xaf1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf1f('0x16'))['db'];var integrations=require(_0xaf1f('0x17'));function respondWithStatusCode(_0x28aaa1,_0x5f03ab){_0x5f03ab=_0x5f03ab||0xcc;return function(_0x30dbfa){if(_0x30dbfa){return _0x28aaa1[_0xaf1f('0x18')](_0x5f03ab);}return _0x28aaa1[_0xaf1f('0x19')](_0x5f03ab)[_0xaf1f('0x1a')]();};}function respondWithResult(_0x4d7080,_0x42c7f5){_0x42c7f5=_0x42c7f5||0xc8;return function(_0x4952af){if(_0x4952af){return _0x4d7080[_0xaf1f('0x19')](_0x42c7f5)['json'](_0x4952af);}};}function respondWithFilteredResult(_0x25d3bc,_0x1012f2){return function(_0x5b0aed){if(_0x5b0aed){var _0x5a6a77=typeof _0x1012f2[_0xaf1f('0x1b')]===_0xaf1f('0x1c')&&typeof _0x1012f2[_0xaf1f('0x1d')]===_0xaf1f('0x1c');var _0x343e0a=_0x5b0aed[_0xaf1f('0x1e')];var _0x7e0c32=_0x5a6a77?0x0:_0x1012f2['offset'];var _0x166f6a=_0x5a6a77?_0x5b0aed[_0xaf1f('0x1e')]:_0x1012f2[_0xaf1f('0x1b')]+_0x1012f2[_0xaf1f('0x1d')];var _0x4973fc;if(_0x166f6a>=_0x343e0a){_0x166f6a=_0x343e0a;_0x4973fc=0xc8;}else{_0x4973fc=0xce;}_0x25d3bc[_0xaf1f('0x19')](_0x4973fc);return _0x25d3bc[_0xaf1f('0x1f')](_0xaf1f('0x20'),_0x7e0c32+'-'+_0x166f6a+'/'+_0x343e0a)[_0xaf1f('0x21')](_0x5b0aed);}return null;};}function patchUpdates(_0x5ed583){return function(_0x54a2fb){try{jsonpatch[_0xaf1f('0x22')](_0x54a2fb,_0x5ed583,!![]);}catch(_0x2a5dc1){return BPromise[_0xaf1f('0x23')](_0x2a5dc1);}return _0x54a2fb[_0xaf1f('0x24')]();};}function saveUpdates(_0x192720,_0x3ec0bd){return function(_0x5e1437){if(_0x5e1437){return _0x5e1437[_0xaf1f('0x25')](_0x192720)[_0xaf1f('0x26')](function(_0x21a963){return _0x21a963;});}return null;};}function removeEntity(_0x24e0b2,_0x2d0358){return function(_0x52146c){if(_0x52146c){return _0x52146c['destroy']()[_0xaf1f('0x26')](function(){_0x24e0b2['status'](0xcc)[_0xaf1f('0x1a')]();});}};}function handleEntityNotFound(_0x46f154,_0x56ec1c){return function(_0x3083cd){if(!_0x3083cd){_0x46f154[_0xaf1f('0x18')](0x194);}return _0x3083cd;};}function handleError(_0x4d8d55,_0x20f4d1){_0x20f4d1=_0x20f4d1||0x1f4;return function(_0xac44d1){logger[_0xaf1f('0x27')](_0xac44d1[_0xaf1f('0x28')]);if(_0xac44d1[_0xaf1f('0x29')]){delete _0xac44d1[_0xaf1f('0x29')];}_0x4d8d55[_0xaf1f('0x19')](_0x20f4d1)['send'](_0xac44d1);};}exports[_0xaf1f('0x2a')]=function(_0x103b6e,_0x542b7b){var _0x6bf46={},_0x2303d0={},_0x1ce718={'count':0x0,'rows':[]};var _0x23053b=_[_0xaf1f('0x2b')](db[_0xaf1f('0x2c')][_0xaf1f('0x2d')],function(_0x518867){return{'name':_0x518867[_0xaf1f('0x2e')],'type':_0x518867[_0xaf1f('0x2f')][_0xaf1f('0x30')]};});_0x2303d0['model']=_[_0xaf1f('0x2b')](_0x23053b,_0xaf1f('0x29'));_0x2303d0[_0xaf1f('0x31')]=_[_0xaf1f('0x32')](_0x103b6e[_0xaf1f('0x31')]);_0x2303d0[_0xaf1f('0x33')]=_['intersection'](_0x2303d0[_0xaf1f('0x34')],_0x2303d0[_0xaf1f('0x31')]);_0x6bf46[_0xaf1f('0x35')]=_[_0xaf1f('0x36')](_0x2303d0[_0xaf1f('0x34')],qs[_0xaf1f('0x37')](_0x103b6e['query'][_0xaf1f('0x37')]));_0x6bf46[_0xaf1f('0x35')]=_0x6bf46[_0xaf1f('0x35')][_0xaf1f('0x38')]?_0x6bf46[_0xaf1f('0x35')]:_0x2303d0[_0xaf1f('0x34')];if(!_0x103b6e['query'][_0xaf1f('0x39')](_0xaf1f('0x3a'))){_0x6bf46[_0xaf1f('0x1d')]=qs[_0xaf1f('0x1d')](_0x103b6e[_0xaf1f('0x31')]['limit']);_0x6bf46[_0xaf1f('0x1b')]=qs[_0xaf1f('0x1b')](_0x103b6e[_0xaf1f('0x31')][_0xaf1f('0x1b')]);}_0x6bf46[_0xaf1f('0x3b')]=qs[_0xaf1f('0x3c')](_0x103b6e[_0xaf1f('0x31')]['sort']);_0x6bf46[_0xaf1f('0x3d')]=qs[_0xaf1f('0x33')](_[_0xaf1f('0x3e')](_0x103b6e[_0xaf1f('0x31')],_0x2303d0['filters']),_0x23053b);if(_0x103b6e[_0xaf1f('0x31')][_0xaf1f('0x3f')]){_0x6bf46[_0xaf1f('0x3d')]=_[_0xaf1f('0x40')](_0x6bf46[_0xaf1f('0x3d')],{'$or':_[_0xaf1f('0x2b')](_0x23053b,function(_0xe55c5c){if(_0xe55c5c[_0xaf1f('0x2f')]!==_0xaf1f('0x41')){var _0x39e59f={};_0x39e59f[_0xe55c5c['name']]={'$like':'%'+_0x103b6e[_0xaf1f('0x31')]['filter']+'%'};return _0x39e59f;}})});}_0x6bf46=_[_0xaf1f('0x40')]({},_0x6bf46,_0x103b6e[_0xaf1f('0x42')]);var _0x465cc6={'where':_0x6bf46[_0xaf1f('0x3d')]};return db[_0xaf1f('0x2c')][_0xaf1f('0x1e')](_0x465cc6)[_0xaf1f('0x26')](function(_0x911fe0){_0x1ce718[_0xaf1f('0x1e')]=_0x911fe0;if(_0x103b6e[_0xaf1f('0x31')][_0xaf1f('0x43')]){_0x6bf46['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xaf1f('0x44')](_0x6bf46);})[_0xaf1f('0x26')](function(_0x2b96ca){_0x1ce718[_0xaf1f('0x45')]=_0x2b96ca;return _0x1ce718;})[_0xaf1f('0x26')](respondWithFilteredResult(_0x542b7b,_0x6bf46))[_0xaf1f('0x46')](handleError(_0x542b7b,null));};exports[_0xaf1f('0x47')]=function(_0x5225fa,_0x4f87d1){var _0x51d2b4={'raw':![],'where':{'id':_0x5225fa[_0xaf1f('0x48')]['id']}},_0x54cc60={};_0x54cc60['model']=_[_0xaf1f('0x32')](db[_0xaf1f('0x2c')][_0xaf1f('0x2d')]);_0x54cc60[_0xaf1f('0x31')]=_[_0xaf1f('0x32')](_0x5225fa[_0xaf1f('0x31')]);_0x54cc60[_0xaf1f('0x33')]=_[_0xaf1f('0x36')](_0x54cc60[_0xaf1f('0x34')],_0x54cc60[_0xaf1f('0x31')]);_0x51d2b4['attributes']=_[_0xaf1f('0x36')](_0x54cc60[_0xaf1f('0x34')],qs[_0xaf1f('0x37')](_0x5225fa[_0xaf1f('0x31')][_0xaf1f('0x37')]));_0x51d2b4[_0xaf1f('0x35')]=_0x51d2b4[_0xaf1f('0x35')][_0xaf1f('0x38')]?_0x51d2b4[_0xaf1f('0x35')]:_0x54cc60[_0xaf1f('0x34')];if(_0x5225fa[_0xaf1f('0x31')][_0xaf1f('0x43')]){_0x51d2b4[_0xaf1f('0x49')]=[{'all':!![]}];}_0x51d2b4=_[_0xaf1f('0x40')]({},_0x51d2b4,_0x5225fa[_0xaf1f('0x42')]);return db[_0xaf1f('0x2c')][_0xaf1f('0x4a')](_0x51d2b4)['then'](handleEntityNotFound(_0x4f87d1,null))[_0xaf1f('0x26')](respondWithResult(_0x4f87d1,null))['catch'](handleError(_0x4f87d1,null));};exports[_0xaf1f('0x4b')]=function(_0x53e5cb,_0xdd131c){return db[_0xaf1f('0x2c')][_0xaf1f('0x4b')](_0x53e5cb[_0xaf1f('0x4c')],{})['then'](respondWithResult(_0xdd131c,0xc9))[_0xaf1f('0x46')](handleError(_0xdd131c,null));};exports[_0xaf1f('0x25')]=function(_0x2b9f20,_0x509f1){if(_0x2b9f20['body']['id']){delete _0x2b9f20[_0xaf1f('0x4c')]['id'];}return db[_0xaf1f('0x2c')][_0xaf1f('0x4a')]({'where':{'id':_0x2b9f20['params']['id']}})[_0xaf1f('0x26')](handleEntityNotFound(_0x509f1,null))['then'](saveUpdates(_0x2b9f20[_0xaf1f('0x4c')],null))['then'](respondWithResult(_0x509f1,null))[_0xaf1f('0x46')](handleError(_0x509f1,null));};exports[_0xaf1f('0x4d')]=function(_0x12e53c,_0xa3e18){return db[_0xaf1f('0x2c')]['find']({'where':{'id':_0x12e53c[_0xaf1f('0x48')]['id']}})['then'](handleEntityNotFound(_0xa3e18,null))['then'](removeEntity(_0xa3e18,null))[_0xaf1f('0x46')](handleError(_0xa3e18,null));};exports['getConfigurations']=function(_0x5bb362,_0x358cef,_0xa8c846){var _0x2ff5b8={};var _0x1af56d={};var _0x409a39;var _0x4d4b51;return db[_0xaf1f('0x2c')]['findOne']({'where':{'id':_0x5bb362[_0xaf1f('0x48')]['id']}})[_0xaf1f('0x26')](handleEntityNotFound(_0x358cef,null))['then'](function(_0x5ebbe0){if(_0x5ebbe0){_0x409a39=_0x5ebbe0;_0x1af56d[_0xaf1f('0x34')]=_['keys'](db['ServicenowConfiguration'][_0xaf1f('0x2d')]);_0x1af56d[_0xaf1f('0x31')]=_[_0xaf1f('0x32')](_0x5bb362['query']);_0x1af56d[_0xaf1f('0x33')]=_[_0xaf1f('0x36')](_0x1af56d[_0xaf1f('0x34')],_0x1af56d[_0xaf1f('0x31')]);_0x2ff5b8[_0xaf1f('0x35')]=_[_0xaf1f('0x36')](_0x1af56d['model'],qs[_0xaf1f('0x37')](_0x5bb362[_0xaf1f('0x31')][_0xaf1f('0x37')]));_0x2ff5b8['attributes']=_0x2ff5b8[_0xaf1f('0x35')][_0xaf1f('0x38')]?_0x2ff5b8[_0xaf1f('0x35')]:_0x1af56d['model'];_0x2ff5b8[_0xaf1f('0x3b')]=qs['sort'](_0x5bb362['query']['sort']);_0x2ff5b8['where']=qs['filters'](_[_0xaf1f('0x3e')](_0x5bb362['query'],_0x1af56d[_0xaf1f('0x33')]));if(_0x5bb362[_0xaf1f('0x31')][_0xaf1f('0x3f')]){_0x2ff5b8[_0xaf1f('0x3d')]=_[_0xaf1f('0x40')](_0x2ff5b8['where'],{'$or':_[_0xaf1f('0x2b')](_0x2ff5b8[_0xaf1f('0x35')],function(_0x14c9c6){var _0x48826b={};_0x48826b[_0x14c9c6]={'$like':'%'+_0x5bb362[_0xaf1f('0x31')]['filter']+'%'};return _0x48826b;})});}_0x2ff5b8=_[_0xaf1f('0x40')]({},_0x2ff5b8,_0x5bb362['options']);return _0x409a39[_0xaf1f('0x4e')](_0x2ff5b8);}})['then'](function(_0x2cc2b2){if(_0x2cc2b2){_0x4d4b51=_0x2cc2b2['length'];if(!_0x5bb362[_0xaf1f('0x31')]['hasOwnProperty']('nolimit')){_0x2ff5b8[_0xaf1f('0x1d')]=qs[_0xaf1f('0x1d')](_0x5bb362[_0xaf1f('0x31')][_0xaf1f('0x1d')]);_0x2ff5b8[_0xaf1f('0x1b')]=qs[_0xaf1f('0x1b')](_0x5bb362[_0xaf1f('0x31')]['offset']);}return _0x409a39[_0xaf1f('0x4e')](_0x2ff5b8);}})['then'](function(_0x1ce411){if(_0x1ce411){return _0x1ce411?{'count':_0x4d4b51,'rows':_0x1ce411}:null;}})['then'](respondWithResult(_0x358cef,null))[_0xaf1f('0x46')](handleError(_0x358cef,null));};exports[_0xaf1f('0x4f')]=function(_0x5e1c71,_0x4e0adb,_0x1675dd){if(_0x5e1c71[_0xaf1f('0x4c')]['id']){delete _0x5e1c71[_0xaf1f('0x4c')]['id'];}return db[_0xaf1f('0x2c')][_0xaf1f('0x50')]({'where':{'id':_0x5e1c71['params']['id']}})[_0xaf1f('0x26')](handleEntityNotFound(_0x4e0adb,null))[_0xaf1f('0x26')](function(_0x1d0cc0){if(_0x1d0cc0){_0x5e1c71['body'][_0xaf1f('0x51')]=_0x1d0cc0['id'];_0x5e1c71['body'][_0xaf1f('0x52')]=integrations[_0xaf1f('0x53')](_0x5e1c71['body'][_0xaf1f('0x54')],_0x5e1c71['body']['type']);_0x5e1c71[_0xaf1f('0x4c')][_0xaf1f('0x55')]=integrations['getDescriptions'](_0x5e1c71[_0xaf1f('0x4c')]['channel'],_0x5e1c71[_0xaf1f('0x4c')][_0xaf1f('0x2f')]);return db[_0xaf1f('0x56')][_0xaf1f('0x4b')](_0x5e1c71[_0xaf1f('0x4c')],{'include':[{'model':db[_0xaf1f('0x57')],'as':_0xaf1f('0x52')},{'model':db[_0xaf1f('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4e0adb,null))[_0xaf1f('0x46')](handleError(_0x4e0adb,null));};exports[_0xaf1f('0x58')]=function(_0x371b37,_0x5f2179,_0x6750a5){var _0x56fef3=['made_sla',_0xaf1f('0x59'),_0xaf1f('0x5a'),_0xaf1f('0x5b'),_0xaf1f('0x5c'),_0xaf1f('0x5d'),_0xaf1f('0x5e'),_0xaf1f('0x5f'),_0xaf1f('0x60')];var _0x5b9cca=[_0xaf1f('0x61'),_0xaf1f('0x62'),_0xaf1f('0x63'),_0xaf1f('0x64'),'upon_reject',_0xaf1f('0x65'),_0xaf1f('0x66'),'hold_reason','approval_history',_0xaf1f('0x67'),_0xaf1f('0x68'),_0xaf1f('0x69'),_0xaf1f('0x6a'),_0xaf1f('0x6b'),_0xaf1f('0x6c'),_0xaf1f('0x6d'),'state',_0xaf1f('0x6e'),_0xaf1f('0x5a'),_0xaf1f('0x3b'),'calendar_stc','closed_at',_0xaf1f('0x6f'),'delivery_plan',_0xaf1f('0x70'),'active',_0xaf1f('0x71'),'business_service',_0xaf1f('0x72'),_0xaf1f('0x73'),'rfc',_0xaf1f('0x74'),_0xaf1f('0x75'),_0xaf1f('0x76'),_0xaf1f('0x77'),_0xaf1f('0x78'),_0xaf1f('0x79'),_0xaf1f('0x7a'),'resolved_at',_0xaf1f('0x7b'),_0xaf1f('0x7c'),'subcategory',_0xaf1f('0x7d'),'short_description','close_code',_0xaf1f('0x7e'),_0xaf1f('0x7f'),_0xaf1f('0x80'),_0xaf1f('0x81'),_0xaf1f('0x82'),_0xaf1f('0x83'),_0xaf1f('0x84'),'calendar_duration',_0xaf1f('0x5d'),_0xaf1f('0x85'),_0xaf1f('0x86'),'closed_by',_0xaf1f('0x87'),'parent_incident',_0xaf1f('0x88'),_0xaf1f('0x89'),_0xaf1f('0x8a'),_0xaf1f('0x5e'),_0xaf1f('0x8b'),_0xaf1f('0x8c'),_0xaf1f('0x8d'),_0xaf1f('0x8e'),_0xaf1f('0x8f'),'assigned_to',_0xaf1f('0x5f'),_0xaf1f('0x90'),_0xaf1f('0x91'),_0xaf1f('0x92'),'comments_and_work_notes','due_date','sys_mod_count',_0xaf1f('0x93'),_0xaf1f('0x94'),_0xaf1f('0x95'),_0xaf1f('0x96'),_0xaf1f('0x97'),_0xaf1f('0x98'),'category'];var _0x3a5035='';var _0x14489a='';var _0x480a4e=[];var _0x3e2af6='';var _0x520f9e='';var _0x13633f=[];var _0x2f4028='';var _0x540453='';var _0x5065ce={};var _0x4e2e18='';return db[_0xaf1f('0x2c')][_0xaf1f('0x50')]({'where':{'id':_0x371b37[_0xaf1f('0x48')]['id']},'attributes':['id','username',_0xaf1f('0x99'),_0xaf1f('0x9a'),_0xaf1f('0x9b'),_0xaf1f('0x9c')]})[_0xaf1f('0x26')](handleEntityNotFound(_0x5f2179,null))[_0xaf1f('0x26')](function(_0x3c7ac3){if(_0x3c7ac3){_0x4e2e18=_0x3c7ac3[_0xaf1f('0x9b')];var _0x2d9432=_0x4e2e18[_0xaf1f('0x9d')](-0x1);if(_0x2d9432==='/'){_0x4e2e18=_0x4e2e18[_0xaf1f('0x9e')](0x0,_0x4e2e18[_0xaf1f('0x9f')](_0x2d9432));}_0x540453=util[_0xaf1f('0xa0')](_0xaf1f('0xa1'),_0x4e2e18);_0x2f4028=util[_0xaf1f('0xa0')](_0xaf1f('0xa2'),_0x4e2e18);_0x5065ce={'user':_0x3c7ac3['username'],'pass':_0x3c7ac3[_0xaf1f('0x99')]};var _0x409a1c={'method':_0xaf1f('0xa3'),'uri':_0x540453+'incident?sysparm_display_value=all','auth':_0x5065ce,'json':!![]};return rp(_0x409a1c);}})['then'](function(_0xa45859){if(_0xa45859[_0xaf1f('0xa4')][_0xaf1f('0x38')]>0x0){_0x3a5035=_0xa45859[_0xaf1f('0xa4')];}console[_0xaf1f('0xa5')](_0xaf1f('0xa6'),_0x3a5035);_0x13633f=[];_0x14489a=Object[_0xaf1f('0xa7')]([],_0x3a5035);_[_0xaf1f('0xa8')](_0x14489a,function(_0xcb1228){return!_0x56fef3[_0xaf1f('0xa9')](_0xcb1228[_0xaf1f('0x29')]);});_0x14489a[_0xaf1f('0xaa')](function(_0x206e60){var _0x1285b3=createFieldObject(_0x2f4028,_0x5065ce,_0x206e60[_0xaf1f('0xab')],_0x206e60[_0xaf1f('0x29')],_0x206e60[_0xaf1f('0xac')],![]);_0x13633f['push'](_0x1285b3);});return Promise[_0xaf1f('0xad')](_0x13633f);})[_0xaf1f('0x26')](function(_0x33077b){_0x480a4e=_0x33077b;_0x3e2af6=Object[_0xaf1f('0xa7')]([],_0x3a5035);console[_0xaf1f('0xa5')](_0xaf1f('0xae'),_0x3a5035);_[_0xaf1f('0xa8')](_0x3e2af6,function(_0x21e362){return _0x5b9cca[_0xaf1f('0xa9')](_0x21e362['name']);});console[_0xaf1f('0xa5')](_0xaf1f('0xaf'),_0x3e2af6);_0x13633f=[];_0x3e2af6['forEach'](function(_0x32a63a){var _0x1e546a=createFieldObject(_0x2f4028,_0x5065ce,_0x32a63a[_0xaf1f('0xab')],_0x32a63a['name'],_0x32a63a['label'],!![]);_0x13633f['push'](_0x1e546a);});return Promise[_0xaf1f('0xad')](_0x13633f);})['then'](function(_0xbe39e7){_0x520f9e=_0xbe39e7;var _0x362a3a=_0x480a4e['concat'](_0x520f9e);return{'count':_0x362a3a['length'],'rows':_0x362a3a};})['then'](respondWithResult(_0x5f2179,null))[_0xaf1f('0x46')](function(_0x498133){console[_0xaf1f('0xa5')](_0xaf1f('0xb0')+_0x498133);var _0x312ade=_0x371b37['query'][_0xaf1f('0xb1')]?0x1f4:_0x498133[_0xaf1f('0xb2')]||0x1f4;logger[_0xaf1f('0x27')](_0x498133[_0xaf1f('0x28')]);delete _0x498133[_0xaf1f('0x29')];if(_0x312ade===0x191){_0x312ade=0x190;}_0x5f2179[_0xaf1f('0x19')](_0x312ade)['send'](_0x371b37[_0xaf1f('0x31')][_0xaf1f('0xb1')]?{'message':_0xaf1f('0xb3'),'statusCode':_0x498133[_0xaf1f('0xb2')]}:_0x498133);});};function createFieldObject(_0xdf5dd1,_0x433935,_0x16fc82,_0x2dacb0,_0x5dd3a6,_0x19d507){return new Promise(function(_0x7eccf,_0x3eeaed){var _0x5a369d={'id':_0x2dacb0,'name':_0x5dd3a6,'custom':_0x19d507};if(_0x16fc82===_0xaf1f('0xb4')){_0x5a369d[_0xaf1f('0x42')]=[{'name':_0xaf1f('0xb5'),'value':'true'},{'name':_0xaf1f('0xb6'),'value':_0xaf1f('0xb7')}];_0x7eccf(_0x5a369d);}else{var _0x4ae2c2={'method':'GET','uri':_0xdf5dd1+_0xaf1f('0xb8')+_0x2dacb0,'auth':_0x433935,'json':!![]};return rp(_0x4ae2c2)[_0xaf1f('0x26')](function(_0x211567){var _0x42a431=[];if(_0x211567[_0xaf1f('0xa4')]['length']>0x0){_0x211567[_0xaf1f('0xa4')]['forEach'](function(_0x4e9eeb){if(_0x4e9eeb[_0xaf1f('0xb9')]===_0xaf1f('0xb7')){var _0x476b68={'name':_0x4e9eeb[_0xaf1f('0xac')],'value':_0x4e9eeb[_0xaf1f('0xba')]};_0x42a431[_0xaf1f('0xbb')](_0x476b68);}});}_0x5a369d[_0xaf1f('0x42')]=_0x42a431;if(_0x5a369d[_0xaf1f('0x42')][_0xaf1f('0x38')]>0x0){_0x7eccf(_0x5a369d);}else{if(_0x19d507==![]){_0x7eccf();}else{_0x7eccf(_0x5a369d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 64a42fa..0baeedf 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 _0xeda8=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1e3651,_0x19a1be){var _0x5c53fa=function(_0x48bf5a){while(--_0x48bf5a){_0x1e3651['push'](_0x1e3651['shift']());}};_0x5c53fa(++_0x19a1be);}(_0xeda8,0x104));var _0x8eda=function(_0x56ecda,_0x5b98c9){_0x56ecda=_0x56ecda-0x0;var _0x56ffae=_0xeda8[_0x56ecda];return _0x56ffae;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));var integrations=require(_0x8eda('0xa'));module[_0x8eda('0xb')]=function(_0x349361,_0x32abe8){return _0x349361['define'](_0x8eda('0xc'),attributes,{'tableName':_0x8eda('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['exports','define','ServicenowAccount','lodash','util','../../config/logger','api','bluebird','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x34da17,_0x4ed96a){var _0x1ec4a6=function(_0x2f79eb){while(--_0x2f79eb){_0x34da17['push'](_0x34da17['shift']());}};_0x1ec4a6(++_0x4ed96a);}(_0x4c60,0xc1));var _0x04c6=function(_0x4e88a5,_0x21e1ea){_0x4e88a5=_0x4e88a5-0x0;var _0x42fae2=_0x4c60[_0x4e88a5];return _0x42fae2;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),attributes,{'tableName':'int_servicenow_accounts','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 1f67e3b..0a0fef2 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 _0xf550=['GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','model','attributes','map','stringify','catch','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x4adeb1,_0x3e7856){var _0x4fd1d6=function(_0x16bf5b){while(--_0x16bf5b){_0x4adeb1['push'](_0x4adeb1['shift']());}};_0x4fd1d6(++_0x3e7856);}(_0xf550,0x1a5));var _0x0f55=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0xf550[_0x5517c0];return _0x33803b;};'use strict';var _=require(_0x0f55('0x0'));var util=require(_0x0f55('0x1'));var moment=require(_0x0f55('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f55('0x3'));var fs=require('fs');var Redis=require(_0x0f55('0x4'));var db=require(_0x0f55('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0f55('0x6'));var config=require(_0x0f55('0x7'));var jayson=require(_0x0f55('0x8'));var client=jayson[_0x0f55('0x9')][_0x0f55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d26ed,_0x819be0,_0x414873){return new BPromise(function(_0x19056b,_0x30e7cd){return client[_0x0f55('0xb')](_0x1d26ed,_0x414873)[_0x0f55('0xc')](function(_0x175847){logger['info'](_0x0f55('0xd'),_0x819be0,_0x0f55('0xe'));logger[_0x0f55('0xf')](_0x0f55('0x10'),_0x819be0,'request\x20sent',JSON['stringify'](_0x175847));if(_0x175847[_0x0f55('0x11')]){if(_0x175847[_0x0f55('0x11')][_0x0f55('0x12')]===0x1f4){logger[_0x0f55('0x11')](_0x0f55('0xd'),_0x819be0,_0x175847[_0x0f55('0x11')][_0x0f55('0x13')]);return _0x30e7cd(_0x175847['error'][_0x0f55('0x13')]);}logger[_0x0f55('0x11')](_0x0f55('0xd'),_0x819be0,_0x175847['error'][_0x0f55('0x13')]);return _0x19056b(_0x175847[_0x0f55('0x11')][_0x0f55('0x13')]);}else{logger[_0x0f55('0x14')](_0x0f55('0xd'),_0x819be0,_0x0f55('0xe'));_0x19056b(_0x175847['result'][_0x0f55('0x13')]);}})['catch'](function(_0x299180){logger[_0x0f55('0x11')](_0x0f55('0xd'),_0x819be0,_0x299180);_0x30e7cd(_0x299180);});});}exports[_0x0f55('0x15')]=function(_0x59a844){var _0x30c17e=this;return new Promise(function(_0x191e4e,_0x132d04){return db[_0x0f55('0x16')][_0x0f55('0x17')]({'raw':_0x59a844[_0x0f55('0x18')]?_0x59a844[_0x0f55('0x18')][_0x0f55('0x19')]===undefined?!![]:![]:!![],'where':_0x59a844[_0x0f55('0x18')]?_0x59a844[_0x0f55('0x18')]['where']||null:null,'attributes':_0x59a844['options']?_0x59a844['options']['attributes']||null:null,'limit':_0x59a844[_0x0f55('0x18')]?_0x59a844[_0x0f55('0x18')][_0x0f55('0x1a')]||null:null,'include':_0x59a844['options']?_0x59a844[_0x0f55('0x18')][_0x0f55('0x1b')]?_['map'](_0x59a844['options'][_0x0f55('0x1b')],function(_0x4e7a8c){return{'model':db[_0x4e7a8c[_0x0f55('0x1c')]],'as':_0x4e7a8c['as'],'attributes':_0x4e7a8c[_0x0f55('0x1d')],'include':_0x4e7a8c['include']?_[_0x0f55('0x1e')](_0x4e7a8c[_0x0f55('0x1b')],function(_0x147770){return{'model':db[_0x147770[_0x0f55('0x1c')]],'as':_0x147770['as'],'attributes':_0x147770[_0x0f55('0x1d')],'include':_0x147770['include']?_['map'](_0x147770[_0x0f55('0x1b')],function(_0x551f2d){return{'model':db[_0x551f2d['model']],'as':_0x551f2d['as'],'attributes':_0x551f2d[_0x0f55('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x425b16){logger['info']('GetServicenowAccount',_0x59a844);logger[_0x0f55('0xf')](_0x0f55('0x15'),_0x59a844,JSON[_0x0f55('0x1f')](_0x425b16));_0x191e4e(_0x425b16);})[_0x0f55('0x20')](function(_0x4ff65d){logger[_0x0f55('0x11')](_0x0f55('0x15'),_0x4ff65d['message'],_0x59a844);_0x132d04(_0x30c17e['error'](0x1f4,_0x4ff65d[_0x0f55('0x13')]));});});};exports[_0x0f55('0x21')]=function(_0x488eea){var _0x351ce0=this;return new Promise(function(_0x1566ee,_0x10c5a5){return db['ServicenowAccount']['find']({'raw':_0x488eea[_0x0f55('0x18')]?_0x488eea['options'][_0x0f55('0x19')]===undefined?!![]:![]:!![],'where':_0x488eea[_0x0f55('0x18')]?_0x488eea['options']['where']||null:null,'attributes':_0x488eea[_0x0f55('0x18')]?_0x488eea[_0x0f55('0x18')]['attributes']||null:null,'include':_0x488eea['options']?_0x488eea['options'][_0x0f55('0x1b')]?_['map'](_0x488eea[_0x0f55('0x18')][_0x0f55('0x1b')],function(_0xcfc86b){return{'model':db[_0xcfc86b[_0x0f55('0x1c')]],'as':_0xcfc86b['as'],'attributes':_0xcfc86b['attributes'],'include':_0xcfc86b[_0x0f55('0x1b')]?_[_0x0f55('0x1e')](_0xcfc86b['include'],function(_0x1b9b80){return{'model':db[_0x1b9b80[_0x0f55('0x1c')]],'as':_0x1b9b80['as'],'attributes':_0x1b9b80['attributes'],'include':_0x1b9b80[_0x0f55('0x1b')]?_[_0x0f55('0x1e')](_0x1b9b80['include'],function(_0x5cb258){return{'model':db[_0x5cb258[_0x0f55('0x1c')]],'as':_0x5cb258['as'],'attributes':_0x5cb258[_0x0f55('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0f55('0xc')](function(_0xce85d6){logger[_0x0f55('0x14')]('ShowServicenowAccount',_0x488eea);logger['debug'](_0x0f55('0x21'),_0x488eea,JSON[_0x0f55('0x1f')](_0xce85d6));_0x1566ee(_0xce85d6);})[_0x0f55('0x20')](function(_0x14e902){logger[_0x0f55('0x11')]('ShowServicenowAccount',_0x14e902['message'],_0x488eea);_0x10c5a5(_0x351ce0[_0x0f55('0x11')](0x1f4,_0x14e902[_0x0f55('0x13')]));});});}; \ No newline at end of file +var _0x77c3=['info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','include','attributes','map','model','ShowServicenowAccount','lodash','util','moment','bluebird','../../config/utils','rpc','client','then'];(function(_0x419cfe,_0x4d39dd){var _0x3324e4=function(_0x49fb0a){while(--_0x49fb0a){_0x419cfe['push'](_0x419cfe['shift']());}};_0x3324e4(++_0x4d39dd);}(_0x77c3,0xa6));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x377c('0x0'));var util=require(_0x377c('0x1'));var moment=require(_0x377c('0x2'));var BPromise=require(_0x377c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x377c('0x4'));var logger=require('../../config/logger')(_0x377c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x377c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3872be,_0x2b50c8,_0x19d9b5){return new BPromise(function(_0x139461,_0x4d057f){return client['request'](_0x3872be,_0x19d9b5)[_0x377c('0x7')](function(_0x3a352d){logger[_0x377c('0x8')]('ServicenowAccount,\x20%s,\x20%s',_0x2b50c8,_0x377c('0x9'));logger[_0x377c('0xa')](_0x377c('0xb'),_0x2b50c8,'request\x20sent',JSON[_0x377c('0xc')](_0x3a352d));if(_0x3a352d[_0x377c('0xd')]){if(_0x3a352d[_0x377c('0xd')][_0x377c('0xe')]===0x1f4){logger[_0x377c('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x2b50c8,_0x3a352d[_0x377c('0xd')][_0x377c('0xf')]);return _0x4d057f(_0x3a352d[_0x377c('0xd')][_0x377c('0xf')]);}logger['error'](_0x377c('0x10'),_0x2b50c8,_0x3a352d[_0x377c('0xd')][_0x377c('0xf')]);return _0x139461(_0x3a352d['error'][_0x377c('0xf')]);}else{logger[_0x377c('0x8')](_0x377c('0x10'),_0x2b50c8,_0x377c('0x9'));_0x139461(_0x3a352d[_0x377c('0x11')]['message']);}})[_0x377c('0x12')](function(_0x1e19ff){logger[_0x377c('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x2b50c8,_0x1e19ff);_0x4d057f(_0x1e19ff);});});}exports[_0x377c('0x13')]=function(_0xeea336){var _0x1c4904=this;return new Promise(function(_0xab45,_0xd5c5ac){return db[_0x377c('0x14')][_0x377c('0x15')]({'raw':_0xeea336['options']?_0xeea336[_0x377c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xeea336['options']?_0xeea336[_0x377c('0x16')][_0x377c('0x17')]||null:null,'attributes':_0xeea336['options']?_0xeea336[_0x377c('0x16')]['attributes']||null:null,'limit':_0xeea336['options']?_0xeea336[_0x377c('0x16')]['limit']||null:null,'include':_0xeea336['options']?_0xeea336['options'][_0x377c('0x18')]?_['map'](_0xeea336['options']['include'],function(_0x4405db){return{'model':db[_0x4405db['model']],'as':_0x4405db['as'],'attributes':_0x4405db[_0x377c('0x19')],'include':_0x4405db['include']?_[_0x377c('0x1a')](_0x4405db[_0x377c('0x18')],function(_0x388b52){return{'model':db[_0x388b52[_0x377c('0x1b')]],'as':_0x388b52['as'],'attributes':_0x388b52[_0x377c('0x19')],'include':_0x388b52[_0x377c('0x18')]?_[_0x377c('0x1a')](_0x388b52[_0x377c('0x18')],function(_0xd08704){return{'model':db[_0xd08704[_0x377c('0x1b')]],'as':_0xd08704['as'],'attributes':_0xd08704[_0x377c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x377c('0x7')](function(_0xeac82c){logger['info'](_0x377c('0x13'),_0xeea336);logger[_0x377c('0xa')]('GetServicenowAccount',_0xeea336,JSON['stringify'](_0xeac82c));_0xab45(_0xeac82c);})[_0x377c('0x12')](function(_0x220226){logger[_0x377c('0xd')](_0x377c('0x13'),_0x220226[_0x377c('0xf')],_0xeea336);_0xd5c5ac(_0x1c4904[_0x377c('0xd')](0x1f4,_0x220226[_0x377c('0xf')]));});});};exports[_0x377c('0x1c')]=function(_0xfb8f5c){var _0x43d214=this;return new Promise(function(_0x31ee66,_0x5998e2){return db[_0x377c('0x14')]['find']({'raw':_0xfb8f5c[_0x377c('0x16')]?_0xfb8f5c[_0x377c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xfb8f5c[_0x377c('0x16')]?_0xfb8f5c[_0x377c('0x16')]['where']||null:null,'attributes':_0xfb8f5c['options']?_0xfb8f5c['options']['attributes']||null:null,'include':_0xfb8f5c[_0x377c('0x16')]?_0xfb8f5c[_0x377c('0x16')][_0x377c('0x18')]?_[_0x377c('0x1a')](_0xfb8f5c[_0x377c('0x16')][_0x377c('0x18')],function(_0x483986){return{'model':db[_0x483986[_0x377c('0x1b')]],'as':_0x483986['as'],'attributes':_0x483986[_0x377c('0x19')],'include':_0x483986[_0x377c('0x18')]?_[_0x377c('0x1a')](_0x483986['include'],function(_0x4b6f68){return{'model':db[_0x4b6f68['model']],'as':_0x4b6f68['as'],'attributes':_0x4b6f68[_0x377c('0x19')],'include':_0x4b6f68[_0x377c('0x18')]?_[_0x377c('0x1a')](_0x4b6f68[_0x377c('0x18')],function(_0x45e42a){return{'model':db[_0x45e42a['model']],'as':_0x45e42a['as'],'attributes':_0x45e42a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17d4ea){logger[_0x377c('0x8')](_0x377c('0x1c'),_0xfb8f5c);logger[_0x377c('0xa')]('ShowServicenowAccount',_0xfb8f5c,JSON[_0x377c('0xc')](_0x17d4ea));_0x31ee66(_0x17d4ea);})['catch'](function(_0x67bdc1){logger[_0x377c('0xd')](_0x377c('0x1c'),_0x67bdc1[_0x377c('0xf')],_0xfb8f5c);_0x5998e2(_0x43d214[_0x377c('0xd')](0x1f4,_0x67bdc1[_0x377c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b270d99..35c5be7 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 _0x8f5b=['/:id/descriptions','post','create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects'];(function(_0x5aecfe,_0x5e4e3c){var _0x26e98e=function(_0x1e4ac3){while(--_0x1e4ac3){_0x5aecfe['push'](_0x5aecfe['shift']());}};_0x26e98e(++_0x5e4e3c);}(_0x8f5b,0x13b));var _0xb8f5=function(_0x185559,_0x3271fd){_0x185559=_0x185559-0x0;var _0x33a706=_0x8f5b[_0x185559];return _0x33a706;};'use strict';var multer=require(_0xb8f5('0x0'));var util=require(_0xb8f5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb8f5('0x2'));var router=express[_0xb8f5('0x3')]();var fs_extra=require(_0xb8f5('0x4'));var auth=require(_0xb8f5('0x5'));var interaction=require(_0xb8f5('0x6'));var config=require(_0xb8f5('0x7'));var controller=require(_0xb8f5('0x8'));router[_0xb8f5('0x9')]('/',auth[_0xb8f5('0xa')](),controller[_0xb8f5('0xb')]);router[_0xb8f5('0x9')](_0xb8f5('0xc'),auth[_0xb8f5('0xa')](),controller[_0xb8f5('0xd')]);router[_0xb8f5('0x9')]('/:id/fields',auth[_0xb8f5('0xa')](),controller['getFields']);router[_0xb8f5('0x9')]('/:id/subjects',auth[_0xb8f5('0xa')](),controller[_0xb8f5('0xe')]);router[_0xb8f5('0x9')](_0xb8f5('0xf'),auth[_0xb8f5('0xa')](),controller['getDescriptions']);router[_0xb8f5('0x10')]('/',auth[_0xb8f5('0xa')](),controller[_0xb8f5('0x11')]);router['put'](_0xb8f5('0xc'),auth[_0xb8f5('0xa')](),controller[_0xb8f5('0x12')]);router[_0xb8f5('0x13')](_0xb8f5('0xc'),auth['isAuthenticated'](),controller[_0xb8f5('0x14')]);module[_0xb8f5('0x15')]=router; \ No newline at end of file +var _0x879f=['get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x1804bb,_0x100c9c){var _0x153b36=function(_0x2c5b7c){while(--_0x2c5b7c){_0x1804bb['push'](_0x1804bb['shift']());}};_0x153b36(++_0x100c9c);}(_0x879f,0x1d2));var _0xf879=function(_0x59262a,_0x568d56){_0x59262a=_0x59262a-0x0;var _0x492d92=_0x879f[_0x59262a];return _0x492d92;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf879('0x0'));var timeout=require(_0xf879('0x1'));var express=require(_0xf879('0x2'));var router=express[_0xf879('0x3')]();var fs_extra=require(_0xf879('0x4'));var auth=require(_0xf879('0x5'));var interaction=require(_0xf879('0x6'));var config=require(_0xf879('0x7'));var controller=require(_0xf879('0x8'));router[_0xf879('0x9')]('/',auth['isAuthenticated'](),controller[_0xf879('0xa')]);router[_0xf879('0x9')](_0xf879('0xb'),auth[_0xf879('0xc')](),controller[_0xf879('0xd')]);router[_0xf879('0x9')](_0xf879('0xe'),auth[_0xf879('0xc')](),controller[_0xf879('0xf')]);router['get'](_0xf879('0x10'),auth[_0xf879('0xc')](),controller['getSubjects']);router['get'](_0xf879('0x11'),auth[_0xf879('0xc')](),controller[_0xf879('0x12')]);router[_0xf879('0x13')]('/',auth[_0xf879('0xc')](),controller[_0xf879('0x14')]);router[_0xf879('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf879('0x16')]);router[_0xf879('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xf879('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 565b919..44f54f8 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 _0xce61=['STRING','sequelize','exports'];(function(_0x244452,_0x1c5845){var _0x21a959=function(_0x10556c){while(--_0x10556c){_0x244452['push'](_0x244452['shift']());}};_0x21a959(++_0x1c5845);}(_0xce61,0x136));var _0x1ce6=function(_0x2f93a4,_0xa01d44){_0x2f93a4=_0x2f93a4-0x0;var _0x46a0d5=_0xce61[_0x2f93a4];return _0x46a0d5;};'use strict';var Sequelize=require(_0x1ce6('0x0'));module[_0x1ce6('0x1')]={'name':{'type':Sequelize[_0x1ce6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x330b=['sequelize','STRING'];(function(_0x2f0e59,_0x2c507d){var _0x538ee4=function(_0x3703b6){while(--_0x3703b6){_0x2f0e59['push'](_0x2f0e59['shift']());}};_0x538ee4(++_0x2c507d);}(_0x330b,0x1f0));var _0xb330=function(_0x5e46d7,_0xd36bbb){_0x5e46d7=_0x5e46d7-0x0;var _0xce1f6d=_0x330b[_0x5e46d7];return _0xce1f6d;};'use strict';var Sequelize=require(_0xb330('0x0'));module['exports']={'name':{'type':Sequelize[_0xb330('0x1')]},'description':{'type':Sequelize[_0xb330('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 673efc1..4216707 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 _0x7464=['send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','update','getFields','ServicenowField','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name'];(function(_0x514c21,_0x5b9f67){var _0xd85d62=function(_0x3ade6e){while(--_0x3ade6e){_0x514c21['push'](_0x514c21['shift']());}};_0xd85d62(++_0x5b9f67);}(_0x7464,0x7e));var _0x4746=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7464[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4746('0x0'));var rimraf=require(_0x4746('0x1'));var zipdir=require(_0x4746('0x2'));var jsonpatch=require(_0x4746('0x3'));var rp=require('request-promise');var moment=require(_0x4746('0x4'));var BPromise=require(_0x4746('0x5'));var Mustache=require(_0x4746('0x6'));var util=require('util');var path=require(_0x4746('0x7'));var sox=require('sox');var csv=require(_0x4746('0x8'));var ejs=require(_0x4746('0x9'));var fs=require('fs');var fs_extra=require(_0x4746('0xa'));var _=require(_0x4746('0xb'));var squel=require(_0x4746('0xc'));var crypto=require('crypto');var jsforce=require(_0x4746('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4746('0x8'));var querystring=require(_0x4746('0xe'));var Papa=require(_0x4746('0xf'));var Redis=require(_0x4746('0x10'));var authService=require(_0x4746('0x11'));var qs=require(_0x4746('0x12'));var as=require(_0x4746('0x13'));var hardwareService=require(_0x4746('0x14'));var logger=require(_0x4746('0x15'))(_0x4746('0x16'));var utils=require(_0x4746('0x17'));var config=require(_0x4746('0x18'));var licenseUtil=require(_0x4746('0x19'));var db=require(_0x4746('0x1a'))['db'];function respondWithStatusCode(_0x369513,_0x3acb2e){_0x3acb2e=_0x3acb2e||0xcc;return function(_0x961c1f){if(_0x961c1f){return _0x369513[_0x4746('0x1b')](_0x3acb2e);}return _0x369513[_0x4746('0x1c')](_0x3acb2e)[_0x4746('0x1d')]();};}function respondWithResult(_0x1857a9,_0x4f33c0){_0x4f33c0=_0x4f33c0||0xc8;return function(_0x419d96){if(_0x419d96){return _0x1857a9[_0x4746('0x1c')](_0x4f33c0)[_0x4746('0x1e')](_0x419d96);}};}function respondWithFilteredResult(_0x103583,_0x2b9a06){return function(_0x1182f2){if(_0x1182f2){var _0x3a68e1=typeof _0x2b9a06[_0x4746('0x1f')]===_0x4746('0x20')&&typeof _0x2b9a06[_0x4746('0x21')]===_0x4746('0x20');var _0x1dc68e=_0x1182f2[_0x4746('0x22')];var _0x2c45c2=_0x3a68e1?0x0:_0x2b9a06['offset'];var _0x3e7ad0=_0x3a68e1?_0x1182f2[_0x4746('0x22')]:_0x2b9a06[_0x4746('0x1f')]+_0x2b9a06[_0x4746('0x21')];var _0x82dd7;if(_0x3e7ad0>=_0x1dc68e){_0x3e7ad0=_0x1dc68e;_0x82dd7=0xc8;}else{_0x82dd7=0xce;}_0x103583[_0x4746('0x1c')](_0x82dd7);return _0x103583[_0x4746('0x23')](_0x4746('0x24'),_0x2c45c2+'-'+_0x3e7ad0+'/'+_0x1dc68e)['json'](_0x1182f2);}return null;};}function patchUpdates(_0x203238){return function(_0x1a7131){try{jsonpatch[_0x4746('0x25')](_0x1a7131,_0x203238,!![]);}catch(_0x570842){return BPromise[_0x4746('0x26')](_0x570842);}return _0x1a7131[_0x4746('0x27')]();};}function saveUpdates(_0x3070d4,_0x42f872){return function(_0x20db07){if(_0x20db07){return _0x20db07['update'](_0x3070d4)[_0x4746('0x28')](function(_0x881973){return _0x881973;});}return null;};}function removeEntity(_0x47a34c,_0x532fb5){return function(_0x460491){if(_0x460491){return _0x460491[_0x4746('0x29')]()[_0x4746('0x28')](function(){_0x47a34c[_0x4746('0x1c')](0xcc)[_0x4746('0x1d')]();});}};}function handleEntityNotFound(_0x52d197,_0x50044a){return function(_0x5a81cd){if(!_0x5a81cd){_0x52d197[_0x4746('0x1b')](0x194);}return _0x5a81cd;};}function handleError(_0x188d3f,_0x172b22){_0x172b22=_0x172b22||0x1f4;return function(_0x7c5f6f){logger['error'](_0x7c5f6f[_0x4746('0x2a')]);if(_0x7c5f6f['name']){delete _0x7c5f6f[_0x4746('0x2b')];}_0x188d3f[_0x4746('0x1c')](_0x172b22)[_0x4746('0x2c')](_0x7c5f6f);};}exports[_0x4746('0x2d')]=function(_0x14edbc,_0x3c235e){var _0x305d92={},_0x1205d7={},_0x192bc4={'count':0x0,'rows':[]};var _0x4e8187=_[_0x4746('0x2e')](db[_0x4746('0x2f')][_0x4746('0x30')],function(_0x155918){return{'name':_0x155918['fieldName'],'type':_0x155918[_0x4746('0x31')][_0x4746('0x32')]};});_0x1205d7[_0x4746('0x33')]=_[_0x4746('0x2e')](_0x4e8187,_0x4746('0x2b'));_0x1205d7[_0x4746('0x34')]=_[_0x4746('0x35')](_0x14edbc[_0x4746('0x34')]);_0x1205d7[_0x4746('0x36')]=_['intersection'](_0x1205d7['model'],_0x1205d7[_0x4746('0x34')]);_0x305d92['attributes']=_[_0x4746('0x37')](_0x1205d7[_0x4746('0x33')],qs['fields'](_0x14edbc[_0x4746('0x34')][_0x4746('0x38')]));_0x305d92[_0x4746('0x39')]=_0x305d92[_0x4746('0x39')][_0x4746('0x3a')]?_0x305d92[_0x4746('0x39')]:_0x1205d7[_0x4746('0x33')];if(!_0x14edbc[_0x4746('0x34')][_0x4746('0x3b')](_0x4746('0x3c'))){_0x305d92[_0x4746('0x21')]=qs[_0x4746('0x21')](_0x14edbc[_0x4746('0x34')][_0x4746('0x21')]);_0x305d92[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x14edbc[_0x4746('0x34')][_0x4746('0x1f')]);}_0x305d92[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x14edbc[_0x4746('0x34')][_0x4746('0x3e')]);_0x305d92['where']=qs[_0x4746('0x36')](_[_0x4746('0x3f')](_0x14edbc[_0x4746('0x34')],_0x1205d7[_0x4746('0x36')]),_0x4e8187);if(_0x14edbc[_0x4746('0x34')][_0x4746('0x40')]){_0x305d92['where']=_[_0x4746('0x41')](_0x305d92[_0x4746('0x42')],{'$or':_[_0x4746('0x2e')](_0x4e8187,function(_0x197a32){if(_0x197a32['type']!==_0x4746('0x43')){var _0x456f48={};_0x456f48[_0x197a32['name']]={'$like':'%'+_0x14edbc[_0x4746('0x34')][_0x4746('0x40')]+'%'};return _0x456f48;}})});}_0x305d92=_[_0x4746('0x41')]({},_0x305d92,_0x14edbc['options']);var _0xa502a4={'where':_0x305d92['where']};return db[_0x4746('0x2f')][_0x4746('0x22')](_0xa502a4)[_0x4746('0x28')](function(_0x44da34){_0x192bc4[_0x4746('0x22')]=_0x44da34;if(_0x14edbc[_0x4746('0x34')][_0x4746('0x44')]){_0x305d92['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x4746('0x45')](_0x305d92);})[_0x4746('0x28')](function(_0x5b2c94){_0x192bc4[_0x4746('0x46')]=_0x5b2c94;return _0x192bc4;})[_0x4746('0x28')](respondWithFilteredResult(_0x3c235e,_0x305d92))['catch'](handleError(_0x3c235e,null));};exports[_0x4746('0x47')]=function(_0x27f67d,_0x3cc99d){var _0x2e2e62={'raw':![],'where':{'id':_0x27f67d[_0x4746('0x48')]['id']}},_0x2a3e63={};_0x2a3e63[_0x4746('0x33')]=_[_0x4746('0x35')](db[_0x4746('0x2f')][_0x4746('0x30')]);_0x2a3e63[_0x4746('0x34')]=_['keys'](_0x27f67d[_0x4746('0x34')]);_0x2a3e63[_0x4746('0x36')]=_[_0x4746('0x37')](_0x2a3e63['model'],_0x2a3e63[_0x4746('0x34')]);_0x2e2e62[_0x4746('0x39')]=_[_0x4746('0x37')](_0x2a3e63[_0x4746('0x33')],qs[_0x4746('0x38')](_0x27f67d['query'][_0x4746('0x38')]));_0x2e2e62['attributes']=_0x2e2e62[_0x4746('0x39')][_0x4746('0x3a')]?_0x2e2e62['attributes']:_0x2a3e63[_0x4746('0x33')];if(_0x27f67d[_0x4746('0x34')][_0x4746('0x44')]){_0x2e2e62[_0x4746('0x49')]=[{'all':!![]}];}_0x2e2e62=_[_0x4746('0x41')]({},_0x2e2e62,_0x27f67d[_0x4746('0x4a')]);return db[_0x4746('0x2f')][_0x4746('0x4b')](_0x2e2e62)[_0x4746('0x28')](handleEntityNotFound(_0x3cc99d,null))[_0x4746('0x28')](respondWithResult(_0x3cc99d,null))[_0x4746('0x4c')](handleError(_0x3cc99d,null));};exports[_0x4746('0x4d')]=function(_0x5f467c,_0x169247){return db['ServicenowConfiguration'][_0x4746('0x4d')](_0x5f467c[_0x4746('0x4e')],{})['then'](respondWithResult(_0x169247,0xc9))[_0x4746('0x4c')](handleError(_0x169247,null));};exports[_0x4746('0x4f')]=function(_0x167807,_0x282532){if(_0x167807[_0x4746('0x4e')]['id']){delete _0x167807['body']['id'];}return db[_0x4746('0x2f')][_0x4746('0x4b')]({'where':{'id':_0x167807['params']['id']}})[_0x4746('0x28')](handleEntityNotFound(_0x282532,null))[_0x4746('0x28')](saveUpdates(_0x167807[_0x4746('0x4e')],null))['then'](respondWithResult(_0x282532,null))['catch'](handleError(_0x282532,null));};exports['destroy']=function(_0x4047e3,_0x5d00df){return db[_0x4746('0x2f')][_0x4746('0x4b')]({'where':{'id':_0x4047e3[_0x4746('0x48')]['id']}})[_0x4746('0x28')](handleEntityNotFound(_0x5d00df,null))[_0x4746('0x28')](removeEntity(_0x5d00df,null))[_0x4746('0x4c')](handleError(_0x5d00df,null));};exports[_0x4746('0x50')]=function(_0x20056d,_0x4334da,_0x397389){var _0x2b5033={};var _0x54b834={};var _0x3814c9;var _0x367b93;return db[_0x4746('0x2f')]['findOne']({'where':{'id':_0x20056d[_0x4746('0x48')]['id']}})[_0x4746('0x28')](handleEntityNotFound(_0x4334da,null))['then'](function(_0x20438b){if(_0x20438b){_0x3814c9=_0x20438b;_0x54b834[_0x4746('0x33')]=_[_0x4746('0x35')](db[_0x4746('0x51')][_0x4746('0x30')]);_0x54b834['query']=_['keys'](_0x20056d['query']);_0x54b834['filters']=_[_0x4746('0x37')](_0x54b834['model'],_0x54b834[_0x4746('0x34')]);_0x2b5033[_0x4746('0x39')]=_['intersection'](_0x54b834['model'],qs[_0x4746('0x38')](_0x20056d[_0x4746('0x34')]['fields']));_0x2b5033[_0x4746('0x39')]=_0x2b5033[_0x4746('0x39')][_0x4746('0x3a')]?_0x2b5033['attributes']:_0x54b834[_0x4746('0x33')];_0x2b5033[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x20056d[_0x4746('0x34')][_0x4746('0x3e')]);_0x2b5033[_0x4746('0x42')]=qs[_0x4746('0x36')](_[_0x4746('0x3f')](_0x20056d[_0x4746('0x34')],_0x54b834['filters']));if(_0x20056d[_0x4746('0x34')]['filter']){_0x2b5033[_0x4746('0x42')]=_[_0x4746('0x41')](_0x2b5033[_0x4746('0x42')],{'$or':_[_0x4746('0x2e')](_0x2b5033[_0x4746('0x39')],function(_0x51576b){var _0x1d36a2={};_0x1d36a2[_0x51576b]={'$like':'%'+_0x20056d[_0x4746('0x34')]['filter']+'%'};return _0x1d36a2;})});}_0x2b5033=_[_0x4746('0x41')]({},_0x2b5033,_0x20056d['options']);return _0x3814c9[_0x4746('0x50')](_0x2b5033);}})['then'](function(_0xaa1bc2){if(_0xaa1bc2){_0x367b93=_0xaa1bc2[_0x4746('0x3a')];if(!_0x20056d[_0x4746('0x34')][_0x4746('0x3b')](_0x4746('0x3c'))){_0x2b5033[_0x4746('0x21')]=qs[_0x4746('0x21')](_0x20056d[_0x4746('0x34')]['limit']);_0x2b5033[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x20056d[_0x4746('0x34')][_0x4746('0x1f')]);}return _0x3814c9[_0x4746('0x50')](_0x2b5033);}})[_0x4746('0x28')](function(_0x5069cb){if(_0x5069cb){return _0x5069cb?{'count':_0x367b93,'rows':_0x5069cb}:null;}})['then'](respondWithResult(_0x4334da,null))[_0x4746('0x4c')](handleError(_0x4334da,null));};exports['getSubjects']=function(_0x3dabbf,_0x3ae6e8,_0x13f0e5){var _0x186ac={};var _0xcfc4a9={};var _0x2974b9;var _0x18b45b;return db[_0x4746('0x2f')][_0x4746('0x52')]({'where':{'id':_0x3dabbf[_0x4746('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ae6e8,null))[_0x4746('0x28')](function(_0x3c2a01){if(_0x3c2a01){_0x2974b9=_0x3c2a01;_0xcfc4a9[_0x4746('0x33')]=_[_0x4746('0x35')](db['ServicenowField']['rawAttributes']);_0xcfc4a9[_0x4746('0x34')]=_[_0x4746('0x35')](_0x3dabbf[_0x4746('0x34')]);_0xcfc4a9[_0x4746('0x36')]=_[_0x4746('0x37')](_0xcfc4a9[_0x4746('0x33')],_0xcfc4a9[_0x4746('0x34')]);_0x186ac[_0x4746('0x39')]=_[_0x4746('0x37')](_0xcfc4a9['model'],qs['fields'](_0x3dabbf[_0x4746('0x34')][_0x4746('0x38')]));_0x186ac[_0x4746('0x39')]=_0x186ac[_0x4746('0x39')][_0x4746('0x3a')]?_0x186ac[_0x4746('0x39')]:_0xcfc4a9[_0x4746('0x33')];_0x186ac[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x3dabbf['query'][_0x4746('0x3e')]);_0x186ac[_0x4746('0x42')]=qs[_0x4746('0x36')](_[_0x4746('0x3f')](_0x3dabbf[_0x4746('0x34')],_0xcfc4a9[_0x4746('0x36')]));if(_0x3dabbf[_0x4746('0x34')]['filter']){_0x186ac[_0x4746('0x42')]=_['merge'](_0x186ac[_0x4746('0x42')],{'$or':_[_0x4746('0x2e')](_0x186ac[_0x4746('0x39')],function(_0x5e06de){var _0xca30bf={};_0xca30bf[_0x5e06de]={'$like':'%'+_0x3dabbf[_0x4746('0x34')][_0x4746('0x40')]+'%'};return _0xca30bf;})});}_0x186ac=_['merge']({},_0x186ac,_0x3dabbf[_0x4746('0x4a')]);return _0x2974b9['getSubjects'](_0x186ac);}})[_0x4746('0x28')](function(_0x2cf491){if(_0x2cf491){_0x18b45b=_0x2cf491[_0x4746('0x3a')];if(!_0x3dabbf[_0x4746('0x34')][_0x4746('0x3b')]('nolimit')){_0x186ac[_0x4746('0x21')]=qs[_0x4746('0x21')](_0x3dabbf[_0x4746('0x34')]['limit']);_0x186ac[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x3dabbf[_0x4746('0x34')]['offset']);}return _0x2974b9[_0x4746('0x53')](_0x186ac);}})[_0x4746('0x28')](function(_0x55237e){if(_0x55237e){return _0x55237e?{'count':_0x18b45b,'rows':_0x55237e}:null;}})[_0x4746('0x28')](respondWithResult(_0x3ae6e8,null))[_0x4746('0x4c')](handleError(_0x3ae6e8,null));};exports['getDescriptions']=function(_0x5c14a0,_0xfdef85,_0x180e36){var _0x5a92e4={};var _0x4621aa={};var _0x534857;var _0x24ba84;return db['ServicenowConfiguration'][_0x4746('0x52')]({'where':{'id':_0x5c14a0[_0x4746('0x48')]['id']}})['then'](handleEntityNotFound(_0xfdef85,null))[_0x4746('0x28')](function(_0x4a0198){if(_0x4a0198){_0x534857=_0x4a0198;_0x4621aa[_0x4746('0x33')]=_[_0x4746('0x35')](db[_0x4746('0x51')]['rawAttributes']);_0x4621aa['query']=_[_0x4746('0x35')](_0x5c14a0[_0x4746('0x34')]);_0x4621aa['filters']=_[_0x4746('0x37')](_0x4621aa['model'],_0x4621aa['query']);_0x5a92e4[_0x4746('0x39')]=_[_0x4746('0x37')](_0x4621aa['model'],qs[_0x4746('0x38')](_0x5c14a0['query']['fields']));_0x5a92e4['attributes']=_0x5a92e4[_0x4746('0x39')][_0x4746('0x3a')]?_0x5a92e4[_0x4746('0x39')]:_0x4621aa[_0x4746('0x33')];_0x5a92e4[_0x4746('0x3d')]=qs[_0x4746('0x3e')](_0x5c14a0[_0x4746('0x34')][_0x4746('0x3e')]);_0x5a92e4[_0x4746('0x42')]=qs[_0x4746('0x36')](_['pick'](_0x5c14a0[_0x4746('0x34')],_0x4621aa[_0x4746('0x36')]));if(_0x5c14a0[_0x4746('0x34')]['filter']){_0x5a92e4['where']=_[_0x4746('0x41')](_0x5a92e4['where'],{'$or':_[_0x4746('0x2e')](_0x5a92e4[_0x4746('0x39')],function(_0xe26ffe){var _0x11bace={};_0x11bace[_0xe26ffe]={'$like':'%'+_0x5c14a0[_0x4746('0x34')][_0x4746('0x40')]+'%'};return _0x11bace;})});}_0x5a92e4=_[_0x4746('0x41')]({},_0x5a92e4,_0x5c14a0[_0x4746('0x4a')]);return _0x534857[_0x4746('0x54')](_0x5a92e4);}})[_0x4746('0x28')](function(_0x5d78e9){if(_0x5d78e9){_0x24ba84=_0x5d78e9[_0x4746('0x3a')];if(!_0x5c14a0[_0x4746('0x34')][_0x4746('0x3b')](_0x4746('0x3c'))){_0x5a92e4['limit']=qs[_0x4746('0x21')](_0x5c14a0[_0x4746('0x34')][_0x4746('0x21')]);_0x5a92e4[_0x4746('0x1f')]=qs[_0x4746('0x1f')](_0x5c14a0[_0x4746('0x34')][_0x4746('0x1f')]);}return _0x534857[_0x4746('0x54')](_0x5a92e4);}})['then'](function(_0x23148f){if(_0x23148f){return _0x23148f?{'count':_0x24ba84,'rows':_0x23148f}:null;}})[_0x4746('0x28')](respondWithResult(_0xfdef85,null))['catch'](handleError(_0xfdef85,null));}; \ No newline at end of file +var _0x2f51=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','include','rows','catch','params','includeAll','options','find','create','body','getFields','findOne','ServicenowField','sort','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x205143,_0x2c9521){var _0x5d3860=function(_0x1c88a6){while(--_0x1c88a6){_0x205143['push'](_0x205143['shift']());}};_0x5d3860(++_0x2c9521);}(_0x2f51,0x1c4));var _0x12f5=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x2f51[_0x255c48];return _0xaebda3;};'use strict';var emlformat=require(_0x12f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12f5('0x1'));var jsonpatch=require(_0x12f5('0x2'));var rp=require(_0x12f5('0x3'));var moment=require(_0x12f5('0x4'));var BPromise=require(_0x12f5('0x5'));var Mustache=require(_0x12f5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x12f5('0x7'));var csv=require(_0x12f5('0x8'));var ejs=require(_0x12f5('0x9'));var fs=require('fs');var fs_extra=require(_0x12f5('0xa'));var _=require('lodash');var squel=require(_0x12f5('0xb'));var crypto=require('crypto');var jsforce=require(_0x12f5('0xc'));var deskjs=require(_0x12f5('0xd'));var toCsv=require(_0x12f5('0x8'));var querystring=require(_0x12f5('0xe'));var Papa=require(_0x12f5('0xf'));var Redis=require(_0x12f5('0x10'));var authService=require(_0x12f5('0x11'));var qs=require(_0x12f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12f5('0x13'));var logger=require('../../config/logger')(_0x12f5('0x14'));var utils=require('../../config/utils');var config=require(_0x12f5('0x15'));var licenseUtil=require(_0x12f5('0x16'));var db=require(_0x12f5('0x17'))['db'];function respondWithStatusCode(_0x5544ab,_0x18ce5c){_0x18ce5c=_0x18ce5c||0xcc;return function(_0x287e9c){if(_0x287e9c){return _0x5544ab[_0x12f5('0x18')](_0x18ce5c);}return _0x5544ab[_0x12f5('0x19')](_0x18ce5c)['end']();};}function respondWithResult(_0x421c16,_0x28f53c){_0x28f53c=_0x28f53c||0xc8;return function(_0x3bf394){if(_0x3bf394){return _0x421c16[_0x12f5('0x19')](_0x28f53c)[_0x12f5('0x1a')](_0x3bf394);}};}function respondWithFilteredResult(_0x53ed5f,_0x362b46){return function(_0x2d64ec){if(_0x2d64ec){var _0x156ca6=typeof _0x362b46[_0x12f5('0x1b')]===_0x12f5('0x1c')&&typeof _0x362b46[_0x12f5('0x1d')]===_0x12f5('0x1c');var _0xcc2e5d=_0x2d64ec[_0x12f5('0x1e')];var _0x353d6c=_0x156ca6?0x0:_0x362b46['offset'];var _0x573d6d=_0x156ca6?_0x2d64ec[_0x12f5('0x1e')]:_0x362b46[_0x12f5('0x1b')]+_0x362b46[_0x12f5('0x1d')];var _0x92b0c6;if(_0x573d6d>=_0xcc2e5d){_0x573d6d=_0xcc2e5d;_0x92b0c6=0xc8;}else{_0x92b0c6=0xce;}_0x53ed5f[_0x12f5('0x19')](_0x92b0c6);return _0x53ed5f['set'](_0x12f5('0x1f'),_0x353d6c+'-'+_0x573d6d+'/'+_0xcc2e5d)[_0x12f5('0x1a')](_0x2d64ec);}return null;};}function patchUpdates(_0x3c0545){return function(_0x460924){try{jsonpatch['apply'](_0x460924,_0x3c0545,!![]);}catch(_0x434841){return BPromise[_0x12f5('0x20')](_0x434841);}return _0x460924[_0x12f5('0x21')]();};}function saveUpdates(_0x18ae40,_0x5ae145){return function(_0xfd7f62){if(_0xfd7f62){return _0xfd7f62[_0x12f5('0x22')](_0x18ae40)['then'](function(_0x3cee85){return _0x3cee85;});}return null;};}function removeEntity(_0x32024a,_0x1f2e96){return function(_0xcda362){if(_0xcda362){return _0xcda362['destroy']()[_0x12f5('0x23')](function(){_0x32024a[_0x12f5('0x19')](0xcc)[_0x12f5('0x24')]();});}};}function handleEntityNotFound(_0x15314b,_0x8253eb){return function(_0x59afb7){if(!_0x59afb7){_0x15314b[_0x12f5('0x18')](0x194);}return _0x59afb7;};}function handleError(_0x13a896,_0x3ca86a){_0x3ca86a=_0x3ca86a||0x1f4;return function(_0x2a4525){logger[_0x12f5('0x25')](_0x2a4525[_0x12f5('0x26')]);if(_0x2a4525[_0x12f5('0x27')]){delete _0x2a4525[_0x12f5('0x27')];}_0x13a896[_0x12f5('0x19')](_0x3ca86a)[_0x12f5('0x28')](_0x2a4525);};}exports[_0x12f5('0x29')]=function(_0x37b2c4,_0x202783){var _0x2e144d={},_0x2a5e9b={},_0x24cc51={'count':0x0,'rows':[]};var _0x5aeca6=_[_0x12f5('0x2a')](db[_0x12f5('0x2b')][_0x12f5('0x2c')],function(_0x1205b4){return{'name':_0x1205b4[_0x12f5('0x2d')],'type':_0x1205b4[_0x12f5('0x2e')]['key']};});_0x2a5e9b['model']=_['map'](_0x5aeca6,'name');_0x2a5e9b['query']=_[_0x12f5('0x2f')](_0x37b2c4[_0x12f5('0x30')]);_0x2a5e9b[_0x12f5('0x31')]=_[_0x12f5('0x32')](_0x2a5e9b['model'],_0x2a5e9b[_0x12f5('0x30')]);_0x2e144d['attributes']=_[_0x12f5('0x32')](_0x2a5e9b['model'],qs['fields'](_0x37b2c4[_0x12f5('0x30')][_0x12f5('0x33')]));_0x2e144d[_0x12f5('0x34')]=_0x2e144d[_0x12f5('0x34')][_0x12f5('0x35')]?_0x2e144d[_0x12f5('0x34')]:_0x2a5e9b[_0x12f5('0x36')];if(!_0x37b2c4[_0x12f5('0x30')][_0x12f5('0x37')]('nolimit')){_0x2e144d[_0x12f5('0x1d')]=qs[_0x12f5('0x1d')](_0x37b2c4[_0x12f5('0x30')][_0x12f5('0x1d')]);_0x2e144d[_0x12f5('0x1b')]=qs[_0x12f5('0x1b')](_0x37b2c4[_0x12f5('0x30')]['offset']);}_0x2e144d[_0x12f5('0x38')]=qs['sort'](_0x37b2c4[_0x12f5('0x30')]['sort']);_0x2e144d[_0x12f5('0x39')]=qs[_0x12f5('0x31')](_[_0x12f5('0x3a')](_0x37b2c4['query'],_0x2a5e9b[_0x12f5('0x31')]),_0x5aeca6);if(_0x37b2c4['query'][_0x12f5('0x3b')]){_0x2e144d[_0x12f5('0x39')]=_['merge'](_0x2e144d[_0x12f5('0x39')],{'$or':_[_0x12f5('0x2a')](_0x5aeca6,function(_0x381709){if(_0x381709[_0x12f5('0x2e')]!==_0x12f5('0x3c')){var _0x10f789={};_0x10f789[_0x381709['name']]={'$like':'%'+_0x37b2c4[_0x12f5('0x30')][_0x12f5('0x3b')]+'%'};return _0x10f789;}})});}_0x2e144d=_[_0x12f5('0x3d')]({},_0x2e144d,_0x37b2c4['options']);var _0x24bb35={'where':_0x2e144d[_0x12f5('0x39')]};return db[_0x12f5('0x2b')]['count'](_0x24bb35)[_0x12f5('0x23')](function(_0x53934a){_0x24cc51[_0x12f5('0x1e')]=_0x53934a;if(_0x37b2c4[_0x12f5('0x30')]['includeAll']){_0x2e144d[_0x12f5('0x3e')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x2e144d);})[_0x12f5('0x23')](function(_0x3bc1fd){_0x24cc51[_0x12f5('0x3f')]=_0x3bc1fd;return _0x24cc51;})[_0x12f5('0x23')](respondWithFilteredResult(_0x202783,_0x2e144d))[_0x12f5('0x40')](handleError(_0x202783,null));};exports['show']=function(_0x4664fd,_0x3826d7){var _0x5db63b={'raw':![],'where':{'id':_0x4664fd[_0x12f5('0x41')]['id']}},_0x1ea8e8={};_0x1ea8e8[_0x12f5('0x36')]=_[_0x12f5('0x2f')](db['ServicenowConfiguration'][_0x12f5('0x2c')]);_0x1ea8e8[_0x12f5('0x30')]=_[_0x12f5('0x2f')](_0x4664fd[_0x12f5('0x30')]);_0x1ea8e8[_0x12f5('0x31')]=_[_0x12f5('0x32')](_0x1ea8e8[_0x12f5('0x36')],_0x1ea8e8['query']);_0x5db63b['attributes']=_[_0x12f5('0x32')](_0x1ea8e8[_0x12f5('0x36')],qs[_0x12f5('0x33')](_0x4664fd[_0x12f5('0x30')][_0x12f5('0x33')]));_0x5db63b[_0x12f5('0x34')]=_0x5db63b[_0x12f5('0x34')]['length']?_0x5db63b[_0x12f5('0x34')]:_0x1ea8e8['model'];if(_0x4664fd[_0x12f5('0x30')][_0x12f5('0x42')]){_0x5db63b[_0x12f5('0x3e')]=[{'all':!![]}];}_0x5db63b=_[_0x12f5('0x3d')]({},_0x5db63b,_0x4664fd[_0x12f5('0x43')]);return db[_0x12f5('0x2b')][_0x12f5('0x44')](_0x5db63b)[_0x12f5('0x23')](handleEntityNotFound(_0x3826d7,null))[_0x12f5('0x23')](respondWithResult(_0x3826d7,null))[_0x12f5('0x40')](handleError(_0x3826d7,null));};exports[_0x12f5('0x45')]=function(_0xe095e3,_0xa9209d){return db['ServicenowConfiguration']['create'](_0xe095e3[_0x12f5('0x46')],{})[_0x12f5('0x23')](respondWithResult(_0xa9209d,0xc9))[_0x12f5('0x40')](handleError(_0xa9209d,null));};exports[_0x12f5('0x22')]=function(_0x1a3f15,_0x550380){if(_0x1a3f15[_0x12f5('0x46')]['id']){delete _0x1a3f15[_0x12f5('0x46')]['id'];}return db['ServicenowConfiguration'][_0x12f5('0x44')]({'where':{'id':_0x1a3f15[_0x12f5('0x41')]['id']}})[_0x12f5('0x23')](handleEntityNotFound(_0x550380,null))[_0x12f5('0x23')](saveUpdates(_0x1a3f15[_0x12f5('0x46')],null))[_0x12f5('0x23')](respondWithResult(_0x550380,null))[_0x12f5('0x40')](handleError(_0x550380,null));};exports['destroy']=function(_0x588f50,_0x251326){return db['ServicenowConfiguration'][_0x12f5('0x44')]({'where':{'id':_0x588f50[_0x12f5('0x41')]['id']}})['then'](handleEntityNotFound(_0x251326,null))[_0x12f5('0x23')](removeEntity(_0x251326,null))[_0x12f5('0x40')](handleError(_0x251326,null));};exports[_0x12f5('0x47')]=function(_0x47d107,_0x14a755,_0x4bffca){var _0x2cdbe0={};var _0xf7d4db={};var _0x4cf546;var _0x1e3734;return db[_0x12f5('0x2b')][_0x12f5('0x48')]({'where':{'id':_0x47d107[_0x12f5('0x41')]['id']}})['then'](handleEntityNotFound(_0x14a755,null))[_0x12f5('0x23')](function(_0x121f86){if(_0x121f86){_0x4cf546=_0x121f86;_0xf7d4db[_0x12f5('0x36')]=_['keys'](db[_0x12f5('0x49')][_0x12f5('0x2c')]);_0xf7d4db[_0x12f5('0x30')]=_[_0x12f5('0x2f')](_0x47d107[_0x12f5('0x30')]);_0xf7d4db[_0x12f5('0x31')]=_[_0x12f5('0x32')](_0xf7d4db[_0x12f5('0x36')],_0xf7d4db[_0x12f5('0x30')]);_0x2cdbe0[_0x12f5('0x34')]=_[_0x12f5('0x32')](_0xf7d4db[_0x12f5('0x36')],qs[_0x12f5('0x33')](_0x47d107[_0x12f5('0x30')][_0x12f5('0x33')]));_0x2cdbe0[_0x12f5('0x34')]=_0x2cdbe0['attributes'][_0x12f5('0x35')]?_0x2cdbe0[_0x12f5('0x34')]:_0xf7d4db[_0x12f5('0x36')];_0x2cdbe0[_0x12f5('0x38')]=qs[_0x12f5('0x4a')](_0x47d107[_0x12f5('0x30')]['sort']);_0x2cdbe0[_0x12f5('0x39')]=qs[_0x12f5('0x31')](_[_0x12f5('0x3a')](_0x47d107[_0x12f5('0x30')],_0xf7d4db[_0x12f5('0x31')]));if(_0x47d107[_0x12f5('0x30')][_0x12f5('0x3b')]){_0x2cdbe0[_0x12f5('0x39')]=_[_0x12f5('0x3d')](_0x2cdbe0['where'],{'$or':_[_0x12f5('0x2a')](_0x2cdbe0[_0x12f5('0x34')],function(_0x5c41e2){var _0x3db9e8={};_0x3db9e8[_0x5c41e2]={'$like':'%'+_0x47d107['query'][_0x12f5('0x3b')]+'%'};return _0x3db9e8;})});}_0x2cdbe0=_[_0x12f5('0x3d')]({},_0x2cdbe0,_0x47d107[_0x12f5('0x43')]);return _0x4cf546['getFields'](_0x2cdbe0);}})[_0x12f5('0x23')](function(_0x53af0a){if(_0x53af0a){_0x1e3734=_0x53af0a[_0x12f5('0x35')];if(!_0x47d107[_0x12f5('0x30')][_0x12f5('0x37')](_0x12f5('0x4b'))){_0x2cdbe0[_0x12f5('0x1d')]=qs[_0x12f5('0x1d')](_0x47d107['query'][_0x12f5('0x1d')]);_0x2cdbe0[_0x12f5('0x1b')]=qs[_0x12f5('0x1b')](_0x47d107['query'][_0x12f5('0x1b')]);}return _0x4cf546['getFields'](_0x2cdbe0);}})[_0x12f5('0x23')](function(_0xfbb3c3){if(_0xfbb3c3){return _0xfbb3c3?{'count':_0x1e3734,'rows':_0xfbb3c3}:null;}})[_0x12f5('0x23')](respondWithResult(_0x14a755,null))[_0x12f5('0x40')](handleError(_0x14a755,null));};exports[_0x12f5('0x4c')]=function(_0x2ec356,_0x22238d,_0x229fa5){var _0x547318={};var _0x510fbe={};var _0x574f2d;var _0x5256db;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2ec356[_0x12f5('0x41')]['id']}})[_0x12f5('0x23')](handleEntityNotFound(_0x22238d,null))[_0x12f5('0x23')](function(_0x4ac022){if(_0x4ac022){_0x574f2d=_0x4ac022;_0x510fbe[_0x12f5('0x36')]=_['keys'](db[_0x12f5('0x49')][_0x12f5('0x2c')]);_0x510fbe[_0x12f5('0x30')]=_[_0x12f5('0x2f')](_0x2ec356['query']);_0x510fbe['filters']=_[_0x12f5('0x32')](_0x510fbe[_0x12f5('0x36')],_0x510fbe['query']);_0x547318[_0x12f5('0x34')]=_['intersection'](_0x510fbe[_0x12f5('0x36')],qs[_0x12f5('0x33')](_0x2ec356['query'][_0x12f5('0x33')]));_0x547318[_0x12f5('0x34')]=_0x547318[_0x12f5('0x34')][_0x12f5('0x35')]?_0x547318['attributes']:_0x510fbe[_0x12f5('0x36')];_0x547318[_0x12f5('0x38')]=qs['sort'](_0x2ec356[_0x12f5('0x30')][_0x12f5('0x4a')]);_0x547318[_0x12f5('0x39')]=qs[_0x12f5('0x31')](_[_0x12f5('0x3a')](_0x2ec356['query'],_0x510fbe[_0x12f5('0x31')]));if(_0x2ec356[_0x12f5('0x30')][_0x12f5('0x3b')]){_0x547318[_0x12f5('0x39')]=_[_0x12f5('0x3d')](_0x547318[_0x12f5('0x39')],{'$or':_[_0x12f5('0x2a')](_0x547318[_0x12f5('0x34')],function(_0x3e10e6){var _0x4b73f1={};_0x4b73f1[_0x3e10e6]={'$like':'%'+_0x2ec356[_0x12f5('0x30')][_0x12f5('0x3b')]+'%'};return _0x4b73f1;})});}_0x547318=_[_0x12f5('0x3d')]({},_0x547318,_0x2ec356[_0x12f5('0x43')]);return _0x574f2d['getSubjects'](_0x547318);}})[_0x12f5('0x23')](function(_0x5badfe){if(_0x5badfe){_0x5256db=_0x5badfe['length'];if(!_0x2ec356[_0x12f5('0x30')]['hasOwnProperty'](_0x12f5('0x4b'))){_0x547318[_0x12f5('0x1d')]=qs[_0x12f5('0x1d')](_0x2ec356[_0x12f5('0x30')]['limit']);_0x547318[_0x12f5('0x1b')]=qs[_0x12f5('0x1b')](_0x2ec356[_0x12f5('0x30')][_0x12f5('0x1b')]);}return _0x574f2d['getSubjects'](_0x547318);}})[_0x12f5('0x23')](function(_0x358ac2){if(_0x358ac2){return _0x358ac2?{'count':_0x5256db,'rows':_0x358ac2}:null;}})[_0x12f5('0x23')](respondWithResult(_0x22238d,null))['catch'](handleError(_0x22238d,null));};exports[_0x12f5('0x4d')]=function(_0x169004,_0x99b95f,_0x2218e9){var _0x38e3aa={};var _0x242fa0={};var _0xdefa9a;var _0x46d580;return db[_0x12f5('0x2b')][_0x12f5('0x48')]({'where':{'id':_0x169004[_0x12f5('0x41')]['id']}})['then'](handleEntityNotFound(_0x99b95f,null))['then'](function(_0x5ef3b2){if(_0x5ef3b2){_0xdefa9a=_0x5ef3b2;_0x242fa0[_0x12f5('0x36')]=_[_0x12f5('0x2f')](db[_0x12f5('0x49')][_0x12f5('0x2c')]);_0x242fa0[_0x12f5('0x30')]=_[_0x12f5('0x2f')](_0x169004[_0x12f5('0x30')]);_0x242fa0[_0x12f5('0x31')]=_['intersection'](_0x242fa0[_0x12f5('0x36')],_0x242fa0[_0x12f5('0x30')]);_0x38e3aa[_0x12f5('0x34')]=_[_0x12f5('0x32')](_0x242fa0['model'],qs[_0x12f5('0x33')](_0x169004[_0x12f5('0x30')][_0x12f5('0x33')]));_0x38e3aa[_0x12f5('0x34')]=_0x38e3aa[_0x12f5('0x34')][_0x12f5('0x35')]?_0x38e3aa['attributes']:_0x242fa0['model'];_0x38e3aa['order']=qs['sort'](_0x169004[_0x12f5('0x30')][_0x12f5('0x4a')]);_0x38e3aa[_0x12f5('0x39')]=qs[_0x12f5('0x31')](_[_0x12f5('0x3a')](_0x169004[_0x12f5('0x30')],_0x242fa0['filters']));if(_0x169004[_0x12f5('0x30')][_0x12f5('0x3b')]){_0x38e3aa['where']=_['merge'](_0x38e3aa[_0x12f5('0x39')],{'$or':_['map'](_0x38e3aa[_0x12f5('0x34')],function(_0x577fcc){var _0x1658e5={};_0x1658e5[_0x577fcc]={'$like':'%'+_0x169004[_0x12f5('0x30')]['filter']+'%'};return _0x1658e5;})});}_0x38e3aa=_[_0x12f5('0x3d')]({},_0x38e3aa,_0x169004[_0x12f5('0x43')]);return _0xdefa9a['getDescriptions'](_0x38e3aa);}})['then'](function(_0x276bbb){if(_0x276bbb){_0x46d580=_0x276bbb[_0x12f5('0x35')];if(!_0x169004[_0x12f5('0x30')][_0x12f5('0x37')]('nolimit')){_0x38e3aa['limit']=qs['limit'](_0x169004[_0x12f5('0x30')][_0x12f5('0x1d')]);_0x38e3aa[_0x12f5('0x1b')]=qs[_0x12f5('0x1b')](_0x169004[_0x12f5('0x30')]['offset']);}return _0xdefa9a[_0x12f5('0x4d')](_0x38e3aa);}})[_0x12f5('0x23')](function(_0x3db751){if(_0x3db751){return _0x3db751?{'count':_0x46d580,'rows':_0x3db751}:null;}})[_0x12f5('0x23')](respondWithResult(_0x99b95f,null))[_0x12f5('0x40')](handleError(_0x99b95f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d4fa939..383b031 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 _0xbc87=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x1bde63,_0x324a2f){var _0x59eade=function(_0x438d51){while(--_0x438d51){_0x1bde63['push'](_0x1bde63['shift']());}};_0x59eade(++_0x324a2f);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x15a00f,_0x3f0213){_0x15a00f=_0x15a00f-0x0;var _0x3d55cf=_0xbc87[_0x15a00f];return _0x3d55cf;};'use strict';var _=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var logger=require('../../config/logger')(_0x7bc8('0x2'));var moment=require(_0x7bc8('0x3'));var BPromise=require(_0x7bc8('0x4'));var rp=require(_0x7bc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bc8('0x6'));var config=require(_0x7bc8('0x7'));var attributes=require(_0x7bc8('0x8'));module[_0x7bc8('0x9')]=function(_0x3db27b,_0x4f291a){return _0x3db27b['define'](_0x7bc8('0xa'),attributes,{'tableName':_0x7bc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6df9=['rimraf','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','request-promise'];(function(_0x363254,_0x560a4e){var _0x2b05b7=function(_0x1fd340){while(--_0x1fd340){_0x363254['push'](_0x363254['shift']());}};_0x2b05b7(++_0x560a4e);}(_0x6df9,0x84));var _0x96df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6df9[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x96df('0x0'));var util=require(_0x96df('0x1'));var logger=require('../../config/logger')(_0x96df('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x96df('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96df('0x4'));var config=require('../../config/environment');var attributes=require(_0x96df('0x5'));module['exports']=function(_0x23e387,_0x3951b3){return _0x23e387['define'](_0x96df('0x6'),attributes,{'tableName':_0x96df('0x7'),'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 3539a08..12b7598 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 _0x4f29=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x38a6ed,_0x5a4380){var _0x3eb276=function(_0x580e59){while(--_0x580e59){_0x38a6ed['push'](_0x38a6ed['shift']());}};_0x3eb276(++_0x5a4380);}(_0x4f29,0x1e0));var _0x94f2=function(_0x14d188,_0x654c7d){_0x14d188=_0x14d188-0x0;var _0x5bdc1c=_0x4f29[_0x14d188];return _0x5bdc1c;};'use strict';var _=require(_0x94f2('0x0'));var util=require(_0x94f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94f2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94f2('0x3'))['db'];var utils=require(_0x94f2('0x4'));var logger=require(_0x94f2('0x5'))(_0x94f2('0x6'));var config=require(_0x94f2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x94f2('0x8')][_0x94f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43eb5c,_0x277d1a,_0x477049){return new BPromise(function(_0x14ffce,_0x1ea88f){return client[_0x94f2('0xa')](_0x43eb5c,_0x477049)['then'](function(_0x2d9c17){logger[_0x94f2('0xb')](_0x94f2('0xc'),_0x277d1a,_0x94f2('0xd'));logger['debug'](_0x94f2('0xe'),_0x277d1a,'request\x20sent',JSON['stringify'](_0x2d9c17));if(_0x2d9c17['error']){if(_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x10')]===0x1f4){logger[_0x94f2('0xf')](_0x94f2('0xc'),_0x277d1a,_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x11')]);return _0x1ea88f(_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x11')]);}logger[_0x94f2('0xf')](_0x94f2('0xc'),_0x277d1a,_0x2d9c17[_0x94f2('0xf')]['message']);return _0x14ffce(_0x2d9c17[_0x94f2('0xf')][_0x94f2('0x11')]);}else{logger['info'](_0x94f2('0xc'),_0x277d1a,'request\x20sent');_0x14ffce(_0x2d9c17[_0x94f2('0x12')][_0x94f2('0x11')]);}})[_0x94f2('0x13')](function(_0x2a629f){logger['error'](_0x94f2('0xc'),_0x277d1a,_0x2a629f);_0x1ea88f(_0x2a629f);});});} \ No newline at end of file +var _0x15ae=['jayson/promise','http','then','request\x20sent','debug','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x15ae,0x6b));var _0xe15a=function(_0x48ee60,_0xc875fa){_0x48ee60=_0x48ee60-0x0;var _0x5234a8=_0x15ae[_0x48ee60];return _0x5234a8;};'use strict';var _=require(_0xe15a('0x0'));var util=require(_0xe15a('0x1'));var moment=require(_0xe15a('0x2'));var BPromise=require(_0xe15a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe15a('0x4'));var db=require(_0xe15a('0x5'))['db'];var utils=require(_0xe15a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe15a('0x7'));var client=jayson['client'][_0xe15a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3faf70,_0x57ec8d,_0x4c79ee){return new BPromise(function(_0x4ff8dc,_0x51d3ce){return client['request'](_0x3faf70,_0x4c79ee)[_0xe15a('0x9')](function(_0x3a3672){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x57ec8d,_0xe15a('0xa'));logger[_0xe15a('0xb')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x57ec8d,_0xe15a('0xa'),JSON[_0xe15a('0xc')](_0x3a3672));if(_0x3a3672[_0xe15a('0xd')]){if(_0x3a3672[_0xe15a('0xd')]['code']===0x1f4){logger[_0xe15a('0xd')](_0xe15a('0xe'),_0x57ec8d,_0x3a3672[_0xe15a('0xd')]['message']);return _0x51d3ce(_0x3a3672['error'][_0xe15a('0xf')]);}logger['error'](_0xe15a('0xe'),_0x57ec8d,_0x3a3672[_0xe15a('0xd')][_0xe15a('0xf')]);return _0x4ff8dc(_0x3a3672[_0xe15a('0xd')][_0xe15a('0xf')]);}else{logger[_0xe15a('0x10')](_0xe15a('0xe'),_0x57ec8d,_0xe15a('0xa'));_0x4ff8dc(_0x3a3672[_0xe15a('0x11')]['message']);}})[_0xe15a('0x12')](function(_0x4a5253){logger[_0xe15a('0xd')](_0xe15a('0xe'),_0x57ec8d,_0x4a5253);_0x51d3ce(_0x4a5253);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 80038d3..9e1770b 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 _0x4e20=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4e20,0x125));var _0x04e2=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x4e20[_0x418549];return _0x288826;};'use strict';var multer=require(_0x04e2('0x0'));var util=require(_0x04e2('0x1'));var path=require(_0x04e2('0x2'));var timeout=require(_0x04e2('0x3'));var express=require(_0x04e2('0x4'));var router=express[_0x04e2('0x5')]();var fs_extra=require(_0x04e2('0x6'));var auth=require(_0x04e2('0x7'));var interaction=require(_0x04e2('0x8'));var config=require(_0x04e2('0x9'));var controller=require('./intServicenowField.controller');router[_0x04e2('0xa')]('/',auth[_0x04e2('0xb')](),controller[_0x04e2('0xc')]);router[_0x04e2('0xa')](_0x04e2('0xd'),auth[_0x04e2('0xb')](),controller[_0x04e2('0xe')]);router[_0x04e2('0xf')]('/',auth[_0x04e2('0xb')](),controller['create']);router[_0x04e2('0x10')](_0x04e2('0xd'),auth[_0x04e2('0xb')](),controller[_0x04e2('0x11')]);router[_0x04e2('0x12')](_0x04e2('0xd'),auth[_0x04e2('0xb')](),controller[_0x04e2('0x13')]);module[_0x04e2('0x14')]=router; \ No newline at end of file +var _0xc692=['isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x16a6b2,_0xc7f037){var _0x3823de=function(_0x4b73b0){while(--_0x4b73b0){_0x16a6b2['push'](_0x16a6b2['shift']());}};_0x3823de(++_0xc7f037);}(_0xc692,0x98));var _0x2c69=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xc692[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var path=require(_0x2c69('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c69('0x3'));var router=express[_0x2c69('0x4')]();var fs_extra=require(_0x2c69('0x5'));var auth=require(_0x2c69('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2c69('0x7'));var controller=require(_0x2c69('0x8'));router[_0x2c69('0x9')]('/',auth[_0x2c69('0xa')](),controller['index']);router['get'](_0x2c69('0xb'),auth[_0x2c69('0xa')](),controller[_0x2c69('0xc')]);router[_0x2c69('0xd')]('/',auth[_0x2c69('0xa')](),controller[_0x2c69('0xe')]);router[_0x2c69('0xf')](_0x2c69('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2c69('0xb'),auth[_0x2c69('0xa')](),controller[_0x2c69('0x10')]);module[_0x2c69('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 fbf8e89..df6b97a 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 _0x5b42=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4145ed,_0x1965e3){var _0x2294a6=function(_0x21c3bb){while(--_0x21c3bb){_0x4145ed['push'](_0x4145ed['shift']());}};_0x2294a6(++_0x1965e3);}(_0x5b42,0x1a9));var _0x25b4=function(_0x28112e,_0x507134){_0x28112e=_0x28112e-0x0;var _0x133881=_0x5b42[_0x28112e];return _0x133881;};'use strict';var Sequelize=require(_0x25b4('0x0'));module[_0x25b4('0x1')]={'type':{'type':Sequelize[_0x25b4('0x2')](_0x25b4('0x3'),_0x25b4('0x4'),'customVariable',_0x25b4('0x5'),_0x25b4('0x6')),'defaultValue':_0x25b4('0x3')},'content':{'type':Sequelize[_0x25b4('0x7')]},'key':{'type':Sequelize[_0x25b4('0x7')]},'keyType':{'type':Sequelize[_0x25b4('0x2')]('string','variable',_0x25b4('0x8'))},'keyContent':{'type':Sequelize[_0x25b4('0x7')]},'idField':{'type':Sequelize[_0x25b4('0x7')]},'nameField':{'type':Sequelize[_0x25b4('0x7')]},'customField':{'type':Sequelize[_0x25b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x31e6=['ENUM','string','variable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x31e6,0x19e));var _0x631e=function(_0xe34d95,_0x497958){_0xe34d95=_0xe34d95-0x0;var _0x558b4d=_0x31e6[_0xe34d95];return _0x558b4d;};'use strict';var Sequelize=require(_0x631e('0x0'));module[_0x631e('0x1')]={'type':{'type':Sequelize[_0x631e('0x2')](_0x631e('0x3'),_0x631e('0x4'),'customVariable',_0x631e('0x5'),'picklist'),'defaultValue':_0x631e('0x3')},'content':{'type':Sequelize[_0x631e('0x6')]},'key':{'type':Sequelize[_0x631e('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x631e('0x3'),_0x631e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x631e('0x6')]},'idField':{'type':Sequelize[_0x631e('0x6')]},'nameField':{'type':Sequelize[_0x631e('0x6')]},'customField':{'type':Sequelize[_0x631e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x631e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index fbdaac7..5a41a71 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 _0x58d0=['query','filters','attributes','fields','length','order','sort','pick','filter','where','merge','map','VIRTUAL','options','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','ServicenowField','rawAttributes','fieldName','type','model','keys'];(function(_0x54129c,_0x4be058){var _0x250fff=function(_0x2ef882){while(--_0x2ef882){_0x54129c['push'](_0x54129c['shift']());}};_0x250fff(++_0x4be058);}(_0x58d0,0xa4));var _0x058d=function(_0x471755,_0x49b2d4){_0x471755=_0x471755-0x0;var _0x577fc2=_0x58d0[_0x471755];return _0x577fc2;};'use strict';var emlformat=require(_0x058d('0x0'));var rimraf=require(_0x058d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x058d('0x2'));var rp=require('request-promise');var moment=require(_0x058d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x058d('0x4'));var util=require(_0x058d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x058d('0x6'));var ejs=require(_0x058d('0x7'));var fs=require('fs');var fs_extra=require(_0x058d('0x8'));var _=require(_0x058d('0x9'));var squel=require(_0x058d('0xa'));var crypto=require(_0x058d('0xb'));var jsforce=require(_0x058d('0xc'));var deskjs=require(_0x058d('0xd'));var toCsv=require(_0x058d('0x6'));var querystring=require(_0x058d('0xe'));var Papa=require(_0x058d('0xf'));var Redis=require('ioredis');var authService=require(_0x058d('0x10'));var qs=require(_0x058d('0x11'));var as=require(_0x058d('0x12'));var hardwareService=require(_0x058d('0x13'));var logger=require('../../config/logger')(_0x058d('0x14'));var utils=require(_0x058d('0x15'));var config=require(_0x058d('0x16'));var licenseUtil=require(_0x058d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d14f0,_0x471f0f){_0x471f0f=_0x471f0f||0xcc;return function(_0x38f9b2){if(_0x38f9b2){return _0x4d14f0[_0x058d('0x18')](_0x471f0f);}return _0x4d14f0[_0x058d('0x19')](_0x471f0f)['end']();};}function respondWithResult(_0x37c7b9,_0x4eb356){_0x4eb356=_0x4eb356||0xc8;return function(_0x2726c2){if(_0x2726c2){return _0x37c7b9[_0x058d('0x19')](_0x4eb356)[_0x058d('0x1a')](_0x2726c2);}};}function respondWithFilteredResult(_0x4f33fe,_0x9c372d){return function(_0x1528f7){if(_0x1528f7){var _0x587683=typeof _0x9c372d['offset']===_0x058d('0x1b')&&typeof _0x9c372d[_0x058d('0x1c')]===_0x058d('0x1b');var _0x3177d7=_0x1528f7[_0x058d('0x1d')];var _0x24cc34=_0x587683?0x0:_0x9c372d[_0x058d('0x1e')];var _0x237bab=_0x587683?_0x1528f7[_0x058d('0x1d')]:_0x9c372d[_0x058d('0x1e')]+_0x9c372d[_0x058d('0x1c')];var _0x5b6a9e;if(_0x237bab>=_0x3177d7){_0x237bab=_0x3177d7;_0x5b6a9e=0xc8;}else{_0x5b6a9e=0xce;}_0x4f33fe[_0x058d('0x19')](_0x5b6a9e);return _0x4f33fe['set'](_0x058d('0x1f'),_0x24cc34+'-'+_0x237bab+'/'+_0x3177d7)[_0x058d('0x1a')](_0x1528f7);}return null;};}function patchUpdates(_0x3252c7){return function(_0x270245){try{jsonpatch[_0x058d('0x20')](_0x270245,_0x3252c7,!![]);}catch(_0x15b447){return BPromise[_0x058d('0x21')](_0x15b447);}return _0x270245[_0x058d('0x22')]();};}function saveUpdates(_0x1c0a32,_0x58d948){return function(_0x322cd1){if(_0x322cd1){return _0x322cd1[_0x058d('0x23')](_0x1c0a32)[_0x058d('0x24')](function(_0x142998){return _0x142998;});}return null;};}function removeEntity(_0x4919b5,_0x23346d){return function(_0x5e9417){if(_0x5e9417){return _0x5e9417[_0x058d('0x25')]()['then'](function(){_0x4919b5[_0x058d('0x19')](0xcc)[_0x058d('0x26')]();});}};}function handleEntityNotFound(_0x3c43eb,_0x541238){return function(_0x19c072){if(!_0x19c072){_0x3c43eb[_0x058d('0x18')](0x194);}return _0x19c072;};}function handleError(_0x14b42a,_0x35e88e){_0x35e88e=_0x35e88e||0x1f4;return function(_0x2fa059){logger[_0x058d('0x27')](_0x2fa059['stack']);if(_0x2fa059[_0x058d('0x28')]){delete _0x2fa059[_0x058d('0x28')];}_0x14b42a[_0x058d('0x19')](_0x35e88e)[_0x058d('0x29')](_0x2fa059);};}exports[_0x058d('0x2a')]=function(_0x4805ef,_0x58c577){var _0x20e613={},_0x5bd135={},_0x19343b={'count':0x0,'rows':[]};var _0x41069f=_['map'](db[_0x058d('0x2b')][_0x058d('0x2c')],function(_0x1e8b11){return{'name':_0x1e8b11[_0x058d('0x2d')],'type':_0x1e8b11[_0x058d('0x2e')]['key']};});_0x5bd135[_0x058d('0x2f')]=_['map'](_0x41069f,'name');_0x5bd135['query']=_[_0x058d('0x30')](_0x4805ef[_0x058d('0x31')]);_0x5bd135[_0x058d('0x32')]=_['intersection'](_0x5bd135[_0x058d('0x2f')],_0x5bd135[_0x058d('0x31')]);_0x20e613[_0x058d('0x33')]=_['intersection'](_0x5bd135[_0x058d('0x2f')],qs['fields'](_0x4805ef[_0x058d('0x31')][_0x058d('0x34')]));_0x20e613[_0x058d('0x33')]=_0x20e613[_0x058d('0x33')][_0x058d('0x35')]?_0x20e613[_0x058d('0x33')]:_0x5bd135[_0x058d('0x2f')];if(!_0x4805ef[_0x058d('0x31')]['hasOwnProperty']('nolimit')){_0x20e613[_0x058d('0x1c')]=qs[_0x058d('0x1c')](_0x4805ef['query'][_0x058d('0x1c')]);_0x20e613[_0x058d('0x1e')]=qs[_0x058d('0x1e')](_0x4805ef['query'][_0x058d('0x1e')]);}_0x20e613[_0x058d('0x36')]=qs['sort'](_0x4805ef[_0x058d('0x31')][_0x058d('0x37')]);_0x20e613['where']=qs[_0x058d('0x32')](_[_0x058d('0x38')](_0x4805ef[_0x058d('0x31')],_0x5bd135['filters']),_0x41069f);if(_0x4805ef['query'][_0x058d('0x39')]){_0x20e613[_0x058d('0x3a')]=_[_0x058d('0x3b')](_0x20e613['where'],{'$or':_[_0x058d('0x3c')](_0x41069f,function(_0xa0da10){if(_0xa0da10[_0x058d('0x2e')]!==_0x058d('0x3d')){var _0x46b6d3={};_0x46b6d3[_0xa0da10[_0x058d('0x28')]]={'$like':'%'+_0x4805ef[_0x058d('0x31')][_0x058d('0x39')]+'%'};return _0x46b6d3;}})});}_0x20e613=_[_0x058d('0x3b')]({},_0x20e613,_0x4805ef[_0x058d('0x3e')]);var _0x1ffdab={'where':_0x20e613['where']};return db[_0x058d('0x2b')][_0x058d('0x1d')](_0x1ffdab)[_0x058d('0x24')](function(_0x1e064a){_0x19343b[_0x058d('0x1d')]=_0x1e064a;if(_0x4805ef[_0x058d('0x31')]['includeAll']){_0x20e613['include']=[{'all':!![]}];}return db[_0x058d('0x2b')][_0x058d('0x3f')](_0x20e613);})[_0x058d('0x24')](function(_0x138981){_0x19343b[_0x058d('0x40')]=_0x138981;return _0x19343b;})[_0x058d('0x24')](respondWithFilteredResult(_0x58c577,_0x20e613))[_0x058d('0x41')](handleError(_0x58c577,null));};exports['show']=function(_0x147053,_0x560fcc){var _0x52f4df={'raw':!![],'where':{'id':_0x147053[_0x058d('0x42')]['id']}},_0x35f8c6={};_0x35f8c6[_0x058d('0x2f')]=_[_0x058d('0x30')](db['ServicenowField'][_0x058d('0x2c')]);_0x35f8c6[_0x058d('0x31')]=_['keys'](_0x147053[_0x058d('0x31')]);_0x35f8c6['filters']=_['intersection'](_0x35f8c6[_0x058d('0x2f')],_0x35f8c6[_0x058d('0x31')]);_0x52f4df[_0x058d('0x33')]=_['intersection'](_0x35f8c6[_0x058d('0x2f')],qs[_0x058d('0x34')](_0x147053['query'][_0x058d('0x34')]));_0x52f4df[_0x058d('0x33')]=_0x52f4df[_0x058d('0x33')]['length']?_0x52f4df[_0x058d('0x33')]:_0x35f8c6[_0x058d('0x2f')];if(_0x147053['query'][_0x058d('0x43')]){_0x52f4df['include']=[{'all':!![]}];}_0x52f4df=_[_0x058d('0x3b')]({},_0x52f4df,_0x147053['options']);return db[_0x058d('0x2b')][_0x058d('0x44')](_0x52f4df)[_0x058d('0x24')](handleEntityNotFound(_0x560fcc,null))[_0x058d('0x24')](respondWithResult(_0x560fcc,null))[_0x058d('0x41')](handleError(_0x560fcc,null));};exports[_0x058d('0x45')]=function(_0x2a5116,_0x18e1f5){return db[_0x058d('0x2b')][_0x058d('0x45')](_0x2a5116[_0x058d('0x46')],{})[_0x058d('0x24')](respondWithResult(_0x18e1f5,0xc9))[_0x058d('0x41')](handleError(_0x18e1f5,null));};exports['update']=function(_0x3b4df8,_0x6681d3){if(_0x3b4df8[_0x058d('0x46')]['id']){delete _0x3b4df8[_0x058d('0x46')]['id'];}return db[_0x058d('0x2b')][_0x058d('0x44')]({'where':{'id':_0x3b4df8['params']['id']}})[_0x058d('0x24')](handleEntityNotFound(_0x6681d3,null))[_0x058d('0x24')](saveUpdates(_0x3b4df8[_0x058d('0x46')],null))[_0x058d('0x24')](respondWithResult(_0x6681d3,null))[_0x058d('0x41')](handleError(_0x6681d3,null));};exports['destroy']=function(_0x4c9b5a,_0x1c81bf){return db[_0x058d('0x2b')]['find']({'where':{'id':_0x4c9b5a['params']['id']}})[_0x058d('0x24')](handleEntityNotFound(_0x1c81bf,null))[_0x058d('0x24')](removeEntity(_0x1c81bf,null))['catch'](handleError(_0x1c81bf,null));}; \ No newline at end of file +var _0x9960=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','ServicenowField','rows','show','params','fields','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x57312d,_0x2a3c09){var _0x3fb53a=function(_0x581982){while(--_0x581982){_0x57312d['push'](_0x57312d['shift']());}};_0x3fb53a(++_0x2a3c09);}(_0x9960,0xc9));var _0x0996=function(_0xf7bf19,_0x4852b6){_0xf7bf19=_0xf7bf19-0x0;var _0x41fe0d=_0x9960[_0xf7bf19];return _0x41fe0d;};'use strict';var emlformat=require(_0x0996('0x0'));var rimraf=require(_0x0996('0x1'));var zipdir=require(_0x0996('0x2'));var jsonpatch=require(_0x0996('0x3'));var rp=require(_0x0996('0x4'));var moment=require(_0x0996('0x5'));var BPromise=require(_0x0996('0x6'));var Mustache=require(_0x0996('0x7'));var util=require(_0x0996('0x8'));var path=require(_0x0996('0x9'));var sox=require('sox');var csv=require(_0x0996('0xa'));var ejs=require(_0x0996('0xb'));var fs=require('fs');var fs_extra=require(_0x0996('0xc'));var _=require(_0x0996('0xd'));var squel=require(_0x0996('0xe'));var crypto=require(_0x0996('0xf'));var jsforce=require(_0x0996('0x10'));var deskjs=require(_0x0996('0x11'));var toCsv=require(_0x0996('0xa'));var querystring=require(_0x0996('0x12'));var Papa=require(_0x0996('0x13'));var Redis=require(_0x0996('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0996('0x15'));var as=require(_0x0996('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0996('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0996('0x18'))['db'];function respondWithStatusCode(_0x366923,_0x5ade12){_0x5ade12=_0x5ade12||0xcc;return function(_0x352c1a){if(_0x352c1a){return _0x366923[_0x0996('0x19')](_0x5ade12);}return _0x366923['status'](_0x5ade12)[_0x0996('0x1a')]();};}function respondWithResult(_0x4686e3,_0x5f0349){_0x5f0349=_0x5f0349||0xc8;return function(_0x5ad347){if(_0x5ad347){return _0x4686e3['status'](_0x5f0349)[_0x0996('0x1b')](_0x5ad347);}};}function respondWithFilteredResult(_0x5ac150,_0x13d9f4){return function(_0x55c560){if(_0x55c560){var _0x223f82=typeof _0x13d9f4['offset']===_0x0996('0x1c')&&typeof _0x13d9f4['limit']==='undefined';var _0x511c19=_0x55c560[_0x0996('0x1d')];var _0x3b8421=_0x223f82?0x0:_0x13d9f4[_0x0996('0x1e')];var _0x318a33=_0x223f82?_0x55c560[_0x0996('0x1d')]:_0x13d9f4[_0x0996('0x1e')]+_0x13d9f4[_0x0996('0x1f')];var _0x51dec8;if(_0x318a33>=_0x511c19){_0x318a33=_0x511c19;_0x51dec8=0xc8;}else{_0x51dec8=0xce;}_0x5ac150[_0x0996('0x20')](_0x51dec8);return _0x5ac150[_0x0996('0x21')]('Content-Range',_0x3b8421+'-'+_0x318a33+'/'+_0x511c19)[_0x0996('0x1b')](_0x55c560);}return null;};}function patchUpdates(_0x3f09b6){return function(_0x53d027){try{jsonpatch[_0x0996('0x22')](_0x53d027,_0x3f09b6,!![]);}catch(_0x3ebee2){return BPromise['reject'](_0x3ebee2);}return _0x53d027[_0x0996('0x23')]();};}function saveUpdates(_0x5cb265,_0x5e68af){return function(_0x4a9034){if(_0x4a9034){return _0x4a9034[_0x0996('0x24')](_0x5cb265)[_0x0996('0x25')](function(_0x2ea8ec){return _0x2ea8ec;});}return null;};}function removeEntity(_0x4df63f,_0x84caad){return function(_0x3c64d4){if(_0x3c64d4){return _0x3c64d4[_0x0996('0x26')]()[_0x0996('0x25')](function(){_0x4df63f[_0x0996('0x20')](0xcc)[_0x0996('0x1a')]();});}};}function handleEntityNotFound(_0x399ae5,_0x2cfec5){return function(_0x3e2363){if(!_0x3e2363){_0x399ae5['sendStatus'](0x194);}return _0x3e2363;};}function handleError(_0x2affab,_0x25aacf){_0x25aacf=_0x25aacf||0x1f4;return function(_0x51e7a7){logger[_0x0996('0x27')](_0x51e7a7['stack']);if(_0x51e7a7[_0x0996('0x28')]){delete _0x51e7a7[_0x0996('0x28')];}_0x2affab[_0x0996('0x20')](_0x25aacf)[_0x0996('0x29')](_0x51e7a7);};}exports[_0x0996('0x2a')]=function(_0x466d04,_0x48965f){var _0xc85a30={},_0x40f26d={},_0xf6aafa={'count':0x0,'rows':[]};var _0x529648=_[_0x0996('0x2b')](db['ServicenowField'][_0x0996('0x2c')],function(_0x57eb5c){return{'name':_0x57eb5c['fieldName'],'type':_0x57eb5c[_0x0996('0x2d')]['key']};});_0x40f26d[_0x0996('0x2e')]=_[_0x0996('0x2b')](_0x529648,'name');_0x40f26d[_0x0996('0x2f')]=_[_0x0996('0x30')](_0x466d04[_0x0996('0x2f')]);_0x40f26d['filters']=_[_0x0996('0x31')](_0x40f26d[_0x0996('0x2e')],_0x40f26d[_0x0996('0x2f')]);_0xc85a30[_0x0996('0x32')]=_[_0x0996('0x31')](_0x40f26d[_0x0996('0x2e')],qs['fields'](_0x466d04['query']['fields']));_0xc85a30[_0x0996('0x32')]=_0xc85a30['attributes']['length']?_0xc85a30[_0x0996('0x32')]:_0x40f26d[_0x0996('0x2e')];if(!_0x466d04['query']['hasOwnProperty'](_0x0996('0x33'))){_0xc85a30['limit']=qs[_0x0996('0x1f')](_0x466d04['query']['limit']);_0xc85a30[_0x0996('0x1e')]=qs[_0x0996('0x1e')](_0x466d04[_0x0996('0x2f')]['offset']);}_0xc85a30[_0x0996('0x34')]=qs['sort'](_0x466d04[_0x0996('0x2f')][_0x0996('0x35')]);_0xc85a30[_0x0996('0x36')]=qs['filters'](_[_0x0996('0x37')](_0x466d04[_0x0996('0x2f')],_0x40f26d[_0x0996('0x38')]),_0x529648);if(_0x466d04[_0x0996('0x2f')]['filter']){_0xc85a30[_0x0996('0x36')]=_[_0x0996('0x39')](_0xc85a30['where'],{'$or':_[_0x0996('0x2b')](_0x529648,function(_0x301726){if(_0x301726['type']!==_0x0996('0x3a')){var _0xb0c342={};_0xb0c342[_0x301726['name']]={'$like':'%'+_0x466d04['query'][_0x0996('0x3b')]+'%'};return _0xb0c342;}})});}_0xc85a30=_[_0x0996('0x39')]({},_0xc85a30,_0x466d04[_0x0996('0x3c')]);var _0x3ce4f6={'where':_0xc85a30['where']};return db['ServicenowField'][_0x0996('0x1d')](_0x3ce4f6)[_0x0996('0x25')](function(_0x51326a){_0xf6aafa[_0x0996('0x1d')]=_0x51326a;if(_0x466d04[_0x0996('0x2f')][_0x0996('0x3d')]){_0xc85a30[_0x0996('0x3e')]=[{'all':!![]}];}return db[_0x0996('0x3f')]['findAll'](_0xc85a30);})['then'](function(_0x1c49da){_0xf6aafa[_0x0996('0x40')]=_0x1c49da;return _0xf6aafa;})[_0x0996('0x25')](respondWithFilteredResult(_0x48965f,_0xc85a30))['catch'](handleError(_0x48965f,null));};exports[_0x0996('0x41')]=function(_0x53eaaf,_0x35a10b){var _0x109697={'raw':!![],'where':{'id':_0x53eaaf[_0x0996('0x42')]['id']}},_0x597c6a={};_0x597c6a['model']=_[_0x0996('0x30')](db[_0x0996('0x3f')][_0x0996('0x2c')]);_0x597c6a[_0x0996('0x2f')]=_['keys'](_0x53eaaf['query']);_0x597c6a[_0x0996('0x38')]=_[_0x0996('0x31')](_0x597c6a[_0x0996('0x2e')],_0x597c6a[_0x0996('0x2f')]);_0x109697['attributes']=_[_0x0996('0x31')](_0x597c6a['model'],qs[_0x0996('0x43')](_0x53eaaf[_0x0996('0x2f')][_0x0996('0x43')]));_0x109697[_0x0996('0x32')]=_0x109697[_0x0996('0x32')][_0x0996('0x44')]?_0x109697[_0x0996('0x32')]:_0x597c6a[_0x0996('0x2e')];if(_0x53eaaf[_0x0996('0x2f')][_0x0996('0x3d')]){_0x109697[_0x0996('0x3e')]=[{'all':!![]}];}_0x109697=_['merge']({},_0x109697,_0x53eaaf[_0x0996('0x3c')]);return db['ServicenowField']['find'](_0x109697)[_0x0996('0x25')](handleEntityNotFound(_0x35a10b,null))[_0x0996('0x25')](respondWithResult(_0x35a10b,null))[_0x0996('0x45')](handleError(_0x35a10b,null));};exports[_0x0996('0x46')]=function(_0x142181,_0x3558b7){return db[_0x0996('0x3f')][_0x0996('0x46')](_0x142181['body'],{})[_0x0996('0x25')](respondWithResult(_0x3558b7,0xc9))[_0x0996('0x45')](handleError(_0x3558b7,null));};exports[_0x0996('0x24')]=function(_0x2bbc40,_0x6adf3a){if(_0x2bbc40[_0x0996('0x47')]['id']){delete _0x2bbc40[_0x0996('0x47')]['id'];}return db[_0x0996('0x3f')]['find']({'where':{'id':_0x2bbc40[_0x0996('0x42')]['id']}})[_0x0996('0x25')](handleEntityNotFound(_0x6adf3a,null))[_0x0996('0x25')](saveUpdates(_0x2bbc40[_0x0996('0x47')],null))[_0x0996('0x25')](respondWithResult(_0x6adf3a,null))['catch'](handleError(_0x6adf3a,null));};exports[_0x0996('0x26')]=function(_0x47bcf5,_0x32a220){return db[_0x0996('0x3f')][_0x0996('0x48')]({'where':{'id':_0x47bcf5['params']['id']}})[_0x0996('0x25')](handleEntityNotFound(_0x32a220,null))[_0x0996('0x25')](removeEntity(_0x32a220,null))['catch'](handleError(_0x32a220,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 18f98c2..7dddaf3 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 _0xeb9a=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','api','moment'];(function(_0x147078,_0x4e509c){var _0x2d2f5c=function(_0x231582){while(--_0x231582){_0x147078['push'](_0x147078['shift']());}};_0x2d2f5c(++_0x4e509c);}(_0xeb9a,0xce));var _0xaeb9=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xeb9a[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xaeb9('0x0'));var util=require(_0xaeb9('0x1'));var logger=require('../../config/logger')(_0xaeb9('0x2'));var moment=require(_0xaeb9('0x3'));var BPromise=require(_0xaeb9('0x4'));var rp=require(_0xaeb9('0x5'));var fs=require('fs');var path=require(_0xaeb9('0x6'));var rimraf=require(_0xaeb9('0x7'));var config=require(_0xaeb9('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xaeb9('0x9')]=function(_0x9ebf47,_0x2c43a8){return _0x9ebf47['define'](_0xaeb9('0xa'),attributes,{'tableName':_0xaeb9('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xaeb9('0xc'),_0xaeb9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7196=['rimraf','../../config/environment','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x18caab,_0x16872c){var _0x3d7165=function(_0x1c34dd){while(--_0x1c34dd){_0x18caab['push'](_0x18caab['shift']());}};_0x3d7165(++_0x16872c);}(_0x7196,0x165));var _0x6719=function(_0x286d62,_0x4f48a9){_0x286d62=_0x286d62-0x0;var _0x14ac5b=_0x7196[_0x286d62];return _0x14ac5b;};'use strict';var _=require(_0x6719('0x0'));var util=require(_0x6719('0x1'));var logger=require(_0x6719('0x2'))(_0x6719('0x3'));var moment=require(_0x6719('0x4'));var BPromise=require(_0x6719('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6719('0x6'));var rimraf=require(_0x6719('0x7'));var config=require(_0x6719('0x8'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x314e0f,_0xdc43e2){return _0x314e0f[_0x6719('0x9')](_0x6719('0xa'),attributes,{'tableName':_0x6719('0xb'),'paranoid':![],'indexes':[{'name':_0x6719('0xc'),'fields':['idField',_0x6719('0xd')],'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 ba260a6..2bd8c47 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0xda3f,0xec));var _0xfda3=function(_0x41a28a,_0x3e07c6){_0x41a28a=_0x41a28a-0x0;var _0x10f439=_0xda3f[_0x41a28a];return _0x10f439;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _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(_0x817596,_0x2f9f13){var _0x3e76ea=function(_0x1e7d42){while(--_0x1e7d42){_0x817596['push'](_0x817596['shift']());}};_0x3e76ea(++_0x2f9f13);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 32e7855..37a77ef 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(_0x1cc25d,_0x561ead){var _0x478120=function(_0x57a7b1){while(--_0x57a7b1){_0x1cc25d['push'](_0x1cc25d['shift']());}};_0x478120(++_0x561ead);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',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(_0x21be56,_0x58490b){var _0x6f6f20=function(_0x12aa6e){while(--_0x12aa6e){_0x21be56['push'](_0x21be56['shift']());}};_0x6f6f20(++_0x58490b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 d41ac5e..86101bd 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(_0x174e72,_0x565e88){var _0x35f570=function(_0x422147){while(--_0x422147){_0x174e72['push'](_0x174e72['shift']());}};_0x35f570(++_0x565e88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'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(_0x2312a0,_0x36b29b){var _0x2ef2a=function(_0x2442d6){while(--_0x2442d6){_0x2312a0['push'](_0x2312a0['shift']());}};_0x2ef2a(++_0x36b29b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 87d5da7..16a49bd 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 _0x0348=['params','keys','rawAttributes','options','find','create','body','SugarcrmConfiguration','hasOwnProperty','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','description','duration_hours','duration_minutes','parent_name','username','password','slice','substring','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','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','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','SugarcrmAccount','includeAll','include','findAll','rows','catch','show'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0348,0x18b));var _0x8034=function(_0x3e32b1,_0x487a75){_0x3e32b1=_0x3e32b1-0x0;var _0x419327=_0x0348[_0x3e32b1];return _0x419327;};'use strict';var emlformat=require(_0x8034('0x0'));var rimraf=require(_0x8034('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8034('0x2'));var rp=require(_0x8034('0x3'));var moment=require(_0x8034('0x4'));var BPromise=require(_0x8034('0x5'));var Mustache=require(_0x8034('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8034('0x7'));var csv=require(_0x8034('0x8'));var ejs=require(_0x8034('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8034('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8034('0xb'));var toCsv=require(_0x8034('0x8'));var querystring=require(_0x8034('0xc'));var Papa=require(_0x8034('0xd'));var Redis=require(_0x8034('0xe'));var authService=require(_0x8034('0xf'));var qs=require(_0x8034('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8034('0x11'));var logger=require(_0x8034('0x12'))(_0x8034('0x13'));var utils=require(_0x8034('0x14'));var config=require(_0x8034('0x15'));var licenseUtil=require(_0x8034('0x16'));var db=require(_0x8034('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b142d,_0x523010){_0x523010=_0x523010||0xcc;return function(_0x2ce8e1){if(_0x2ce8e1){return _0x5b142d[_0x8034('0x18')](_0x523010);}return _0x5b142d[_0x8034('0x19')](_0x523010)[_0x8034('0x1a')]();};}function respondWithResult(_0x2a25ac,_0x9cfa09){_0x9cfa09=_0x9cfa09||0xc8;return function(_0xbc7220){if(_0xbc7220){return _0x2a25ac[_0x8034('0x19')](_0x9cfa09)[_0x8034('0x1b')](_0xbc7220);}};}function respondWithFilteredResult(_0x520a33,_0x4486a2){return function(_0x396fbf){if(_0x396fbf){var _0x195abe=typeof _0x4486a2[_0x8034('0x1c')]===_0x8034('0x1d')&&typeof _0x4486a2[_0x8034('0x1e')]===_0x8034('0x1d');var _0x184398=_0x396fbf[_0x8034('0x1f')];var _0x116817=_0x195abe?0x0:_0x4486a2[_0x8034('0x1c')];var _0x1b7bc5=_0x195abe?_0x396fbf[_0x8034('0x1f')]:_0x4486a2[_0x8034('0x1c')]+_0x4486a2['limit'];var _0x5e4140;if(_0x1b7bc5>=_0x184398){_0x1b7bc5=_0x184398;_0x5e4140=0xc8;}else{_0x5e4140=0xce;}_0x520a33[_0x8034('0x19')](_0x5e4140);return _0x520a33[_0x8034('0x20')]('Content-Range',_0x116817+'-'+_0x1b7bc5+'/'+_0x184398)[_0x8034('0x1b')](_0x396fbf);}return null;};}function patchUpdates(_0x3217d1){return function(_0x5ef4f0){try{jsonpatch[_0x8034('0x21')](_0x5ef4f0,_0x3217d1,!![]);}catch(_0x52c547){return BPromise[_0x8034('0x22')](_0x52c547);}return _0x5ef4f0[_0x8034('0x23')]();};}function saveUpdates(_0x2d2cf8,_0x559505){return function(_0x195fa2){if(_0x195fa2){return _0x195fa2[_0x8034('0x24')](_0x2d2cf8)[_0x8034('0x25')](function(_0x1d6905){return _0x1d6905;});}return null;};}function removeEntity(_0x50c2d7,_0x54b776){return function(_0x5f3f35){if(_0x5f3f35){return _0x5f3f35[_0x8034('0x26')]()[_0x8034('0x25')](function(){_0x50c2d7['status'](0xcc)[_0x8034('0x1a')]();});}};}function handleEntityNotFound(_0x3c15c2,_0x1f0b35){return function(_0x162152){if(!_0x162152){_0x3c15c2[_0x8034('0x18')](0x194);}return _0x162152;};}function handleError(_0x5c2448,_0x287b46){_0x287b46=_0x287b46||0x1f4;return function(_0x36e511){logger[_0x8034('0x27')](_0x36e511[_0x8034('0x28')]);if(_0x36e511[_0x8034('0x29')]){delete _0x36e511[_0x8034('0x29')];}_0x5c2448[_0x8034('0x19')](_0x287b46)[_0x8034('0x2a')](_0x36e511);};}exports[_0x8034('0x2b')]=function(_0x29a7c1,_0x1cc717){var _0x49bd92={},_0xaa4260={},_0x30eec5={'count':0x0,'rows':[]};var _0x7c1f7f=_[_0x8034('0x2c')](db['SugarcrmAccount']['rawAttributes'],function(_0x5a6f50){return{'name':_0x5a6f50[_0x8034('0x2d')],'type':_0x5a6f50['type'][_0x8034('0x2e')]};});_0xaa4260[_0x8034('0x2f')]=_[_0x8034('0x2c')](_0x7c1f7f,_0x8034('0x29'));_0xaa4260['query']=_['keys'](_0x29a7c1[_0x8034('0x30')]);_0xaa4260[_0x8034('0x31')]=_['intersection'](_0xaa4260[_0x8034('0x2f')],_0xaa4260['query']);_0x49bd92[_0x8034('0x32')]=_[_0x8034('0x33')](_0xaa4260['model'],qs[_0x8034('0x34')](_0x29a7c1['query'][_0x8034('0x34')]));_0x49bd92[_0x8034('0x32')]=_0x49bd92[_0x8034('0x32')][_0x8034('0x35')]?_0x49bd92['attributes']:_0xaa4260[_0x8034('0x2f')];if(!_0x29a7c1['query']['hasOwnProperty'](_0x8034('0x36'))){_0x49bd92[_0x8034('0x1e')]=qs[_0x8034('0x1e')](_0x29a7c1[_0x8034('0x30')][_0x8034('0x1e')]);_0x49bd92[_0x8034('0x1c')]=qs['offset'](_0x29a7c1['query'][_0x8034('0x1c')]);}_0x49bd92[_0x8034('0x37')]=qs[_0x8034('0x38')](_0x29a7c1[_0x8034('0x30')][_0x8034('0x38')]);_0x49bd92['where']=qs[_0x8034('0x31')](_[_0x8034('0x39')](_0x29a7c1[_0x8034('0x30')],_0xaa4260['filters']),_0x7c1f7f);if(_0x29a7c1['query'][_0x8034('0x3a')]){_0x49bd92[_0x8034('0x3b')]=_[_0x8034('0x3c')](_0x49bd92[_0x8034('0x3b')],{'$or':_['map'](_0x7c1f7f,function(_0x207edc){if(_0x207edc[_0x8034('0x3d')]!=='VIRTUAL'){var _0xf7d5a6={};_0xf7d5a6[_0x207edc[_0x8034('0x29')]]={'$like':'%'+_0x29a7c1[_0x8034('0x30')][_0x8034('0x3a')]+'%'};return _0xf7d5a6;}})});}_0x49bd92=_['merge']({},_0x49bd92,_0x29a7c1['options']);var _0x1abd7b={'where':_0x49bd92[_0x8034('0x3b')]};return db[_0x8034('0x3e')][_0x8034('0x1f')](_0x1abd7b)[_0x8034('0x25')](function(_0x4ce0e2){_0x30eec5[_0x8034('0x1f')]=_0x4ce0e2;if(_0x29a7c1[_0x8034('0x30')][_0x8034('0x3f')]){_0x49bd92[_0x8034('0x40')]=[{'all':!![]}];}return db[_0x8034('0x3e')][_0x8034('0x41')](_0x49bd92);})[_0x8034('0x25')](function(_0x541bc9){_0x30eec5[_0x8034('0x42')]=_0x541bc9;return _0x30eec5;})[_0x8034('0x25')](respondWithFilteredResult(_0x1cc717,_0x49bd92))[_0x8034('0x43')](handleError(_0x1cc717,null));};exports[_0x8034('0x44')]=function(_0xac3627,_0x1e5a6a){var _0x347993={'raw':![],'where':{'id':_0xac3627[_0x8034('0x45')]['id']}},_0x50ccde={};_0x50ccde['model']=_[_0x8034('0x46')](db[_0x8034('0x3e')][_0x8034('0x47')]);_0x50ccde[_0x8034('0x30')]=_['keys'](_0xac3627[_0x8034('0x30')]);_0x50ccde[_0x8034('0x31')]=_[_0x8034('0x33')](_0x50ccde[_0x8034('0x2f')],_0x50ccde[_0x8034('0x30')]);_0x347993['attributes']=_[_0x8034('0x33')](_0x50ccde['model'],qs[_0x8034('0x34')](_0xac3627[_0x8034('0x30')][_0x8034('0x34')]));_0x347993[_0x8034('0x32')]=_0x347993[_0x8034('0x32')]['length']?_0x347993[_0x8034('0x32')]:_0x50ccde[_0x8034('0x2f')];if(_0xac3627['query'][_0x8034('0x3f')]){_0x347993['include']=[{'all':!![]}];}_0x347993=_[_0x8034('0x3c')]({},_0x347993,_0xac3627[_0x8034('0x48')]);return db[_0x8034('0x3e')][_0x8034('0x49')](_0x347993)['then'](handleEntityNotFound(_0x1e5a6a,null))['then'](respondWithResult(_0x1e5a6a,null))['catch'](handleError(_0x1e5a6a,null));};exports[_0x8034('0x4a')]=function(_0x1b6ab0,_0x1e6191){return db[_0x8034('0x3e')][_0x8034('0x4a')](_0x1b6ab0[_0x8034('0x4b')],{})['then'](respondWithResult(_0x1e6191,0xc9))[_0x8034('0x43')](handleError(_0x1e6191,null));};exports[_0x8034('0x24')]=function(_0x2fc182,_0x14ec3b){if(_0x2fc182[_0x8034('0x4b')]['id']){delete _0x2fc182['body']['id'];}return db[_0x8034('0x3e')][_0x8034('0x49')]({'where':{'id':_0x2fc182['params']['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x14ec3b,null))[_0x8034('0x25')](saveUpdates(_0x2fc182['body'],null))[_0x8034('0x25')](respondWithResult(_0x14ec3b,null))[_0x8034('0x43')](handleError(_0x14ec3b,null));};exports[_0x8034('0x26')]=function(_0xdb4da1,_0x1cb274){return db['SugarcrmAccount'][_0x8034('0x49')]({'where':{'id':_0xdb4da1[_0x8034('0x45')]['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x1cb274,null))[_0x8034('0x25')](removeEntity(_0x1cb274,null))[_0x8034('0x43')](handleError(_0x1cb274,null));};exports['getConfigurations']=function(_0x13322d,_0x43b94d,_0x162e3c){var _0x972f23={};var _0x4ba986={};var _0x42fd81;var _0x17343a;return db[_0x8034('0x3e')]['findOne']({'where':{'id':_0x13322d[_0x8034('0x45')]['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x43b94d,null))[_0x8034('0x25')](function(_0x59245c){if(_0x59245c){_0x42fd81=_0x59245c;_0x4ba986['model']=_[_0x8034('0x46')](db[_0x8034('0x4c')]['rawAttributes']);_0x4ba986[_0x8034('0x30')]=_[_0x8034('0x46')](_0x13322d[_0x8034('0x30')]);_0x4ba986[_0x8034('0x31')]=_[_0x8034('0x33')](_0x4ba986[_0x8034('0x2f')],_0x4ba986[_0x8034('0x30')]);_0x972f23[_0x8034('0x32')]=_[_0x8034('0x33')](_0x4ba986[_0x8034('0x2f')],qs[_0x8034('0x34')](_0x13322d['query']['fields']));_0x972f23[_0x8034('0x32')]=_0x972f23[_0x8034('0x32')][_0x8034('0x35')]?_0x972f23[_0x8034('0x32')]:_0x4ba986['model'];_0x972f23[_0x8034('0x37')]=qs[_0x8034('0x38')](_0x13322d['query'][_0x8034('0x38')]);_0x972f23[_0x8034('0x3b')]=qs[_0x8034('0x31')](_[_0x8034('0x39')](_0x13322d[_0x8034('0x30')],_0x4ba986[_0x8034('0x31')]));if(_0x13322d[_0x8034('0x30')][_0x8034('0x3a')]){_0x972f23[_0x8034('0x3b')]=_[_0x8034('0x3c')](_0x972f23[_0x8034('0x3b')],{'$or':_['map'](_0x972f23[_0x8034('0x32')],function(_0x31ff18){var _0x40457f={};_0x40457f[_0x31ff18]={'$like':'%'+_0x13322d[_0x8034('0x30')][_0x8034('0x3a')]+'%'};return _0x40457f;})});}_0x972f23=_[_0x8034('0x3c')]({},_0x972f23,_0x13322d[_0x8034('0x48')]);return _0x42fd81['getConfigurations'](_0x972f23);}})[_0x8034('0x25')](function(_0x4b3795){if(_0x4b3795){_0x17343a=_0x4b3795[_0x8034('0x35')];if(!_0x13322d['query'][_0x8034('0x4d')](_0x8034('0x36'))){_0x972f23[_0x8034('0x1e')]=qs[_0x8034('0x1e')](_0x13322d['query'][_0x8034('0x1e')]);_0x972f23[_0x8034('0x1c')]=qs[_0x8034('0x1c')](_0x13322d[_0x8034('0x30')][_0x8034('0x1c')]);}return _0x42fd81[_0x8034('0x4e')](_0x972f23);}})[_0x8034('0x25')](function(_0xcf02c3){if(_0xcf02c3){return _0xcf02c3?{'count':_0x17343a,'rows':_0xcf02c3}:null;}})[_0x8034('0x25')](respondWithResult(_0x43b94d,null))[_0x8034('0x43')](handleError(_0x43b94d,null));};exports[_0x8034('0x4f')]=function(_0x54b6b6,_0x3c71f1,_0x32eab8){if(_0x54b6b6[_0x8034('0x4b')]['id']){delete _0x54b6b6[_0x8034('0x4b')]['id'];}return db[_0x8034('0x3e')][_0x8034('0x50')]({'where':{'id':_0x54b6b6[_0x8034('0x45')]['id']}})[_0x8034('0x25')](handleEntityNotFound(_0x3c71f1,null))[_0x8034('0x25')](function(_0x52bfe6){if(_0x52bfe6){_0x54b6b6[_0x8034('0x4b')]['AccountId']=_0x52bfe6['id'];_0x54b6b6[_0x8034('0x4b')][_0x8034('0x51')]=integrations[_0x8034('0x52')](_0x54b6b6[_0x8034('0x4b')][_0x8034('0x53')],_0x54b6b6[_0x8034('0x4b')]['type']);_0x54b6b6[_0x8034('0x4b')][_0x8034('0x54')]=integrations[_0x8034('0x55')](_0x54b6b6[_0x8034('0x4b')]['channel'],_0x54b6b6[_0x8034('0x4b')]['type']);return db[_0x8034('0x4c')][_0x8034('0x4a')](_0x54b6b6[_0x8034('0x4b')],{'include':[{'model':db[_0x8034('0x56')],'as':_0x8034('0x51')},{'model':db[_0x8034('0x56')],'as':_0x8034('0x54')}]});}return null;})[_0x8034('0x25')](respondWithResult(_0x3c71f1,null))['catch'](handleError(_0x3c71f1,null));};exports[_0x8034('0x57')]=function(_0x406b46,_0x3d2210,_0x16ed4f){var _0x47522b='';var _0xa5ba17=['id',_0x8034('0x29'),'assigned_user_id','created_by',_0x8034('0x58'),'date_start',_0x8034('0x59'),_0x8034('0x5a'),'parent_id','parent_type',_0x8034('0x5b'),'direction'];return db[_0x8034('0x3e')][_0x8034('0x50')]({'where':{'id':_0x406b46['params']['id']},'attributes':['id',_0x8034('0x5c'),_0x8034('0x5d'),'remoteUri']})[_0x8034('0x25')](handleEntityNotFound(_0x3d2210,null))[_0x8034('0x25')](function(_0x14a532){if(_0x14a532){_0x47522b=_0x14a532['remoteUri'];var _0x4330c7=_0x47522b[_0x8034('0x5e')](-0x1);if(_0x4330c7==='/'){_0x47522b=_0x47522b[_0x8034('0x5f')](0x0,_0x47522b['lastIndexOf'](_0x4330c7));}return rp({'method':_0x8034('0x60'),'uri':util[_0x8034('0x61')]('%s%s',_0x47522b,_0x8034('0x62')),'json':!![],'form':{'method':_0x8034('0x63'),'input_type':_0x8034('0x64'),'response_type':_0x8034('0x64'),'rest_data':JSON[_0x8034('0x65')]({'user_auth':{'user_name':_0x14a532[_0x8034('0x5c')],'password':_0x14a532['password'],'encryption':_0x8034('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x8034('0x25')](function(_0xd825ed){if(_0xd825ed&&_0xd825ed['name']!==_0x8034('0x67')&&_0xd825ed[_0x8034('0x29')]!==_0x8034('0x68')){return rp({'method':_0x8034('0x60'),'uri':util[_0x8034('0x61')]('%s%s',_0x47522b,_0x8034('0x62')),'json':!![],'form':{'method':_0x8034('0x69'),'input_type':_0x8034('0x64'),'response_type':_0x8034('0x64'),'rest_data':JSON[_0x8034('0x65')]({'session':_0xd825ed['id'],'module_name':_0x8034('0x6a')})}})[_0x8034('0x25')](function(_0x1c1b70){if(_0x1c1b70){var _0x59ce1b=_[_0x8034('0x6b')](_0x1c1b70[_0x8034('0x6c')]);_[_0x8034('0x6d')](_0x59ce1b,function(_0x3c0481){return _0xa5ba17['includes'](_0x3c0481['name']);});return{'count':_0x59ce1b['length'],'rows':_['map'](_0x59ce1b,function(_0x1b82d1){return{'id':_0x1b82d1[_0x8034('0x29')],'name':_0x1b82d1['label'],'custom':_[_0x8034('0x6e')](_0x1b82d1[_0x8034('0x29')],'_c')?!![]:![],'options':_0x1b82d1['options']?_['map'](_[_0x8034('0x6b')](_0x1b82d1[_0x8034('0x48')]),function(_0x3af001){return{'name':_0x3af001[_0x8034('0x6f')],'value':_0x3af001['name']};}):[]};})};}})[_0x8034('0x25')](respondWithResult(_0x3d2210,null))[_0x8034('0x43')](function(_0x4ed4c4){var _0xc249fc=_0x406b46['query'][_0x8034('0x70')]?0x1f4:_0x4ed4c4['statusCode']||0x1f4;logger['error'](_0x8034('0x71'),_0x8034('0x57'),_0xc249fc,JSON[_0x8034('0x65')](_0x4ed4c4));delete _0x4ed4c4['name'];if(_0xc249fc===0x191){_0xc249fc=0x190;}_0x3d2210[_0x8034('0x19')](_0xc249fc)['send'](_0x406b46[_0x8034('0x30')]['test']?{'message':_0x8034('0x72'),'statusCode':_0x4ed4c4[_0x8034('0x73')]}:_0x4ed4c4);});}else{var _0x14273b=0x1f4;_0x3d2210[_0x8034('0x19')](_0x14273b)[_0x8034('0x2a')]({'message':_0x8034('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x4f99=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','created_by','date_start','duration_hours','parent_type','parent_name','username','password','remoteUri','slice','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','Calls','values','module_fields','remove','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox'];(function(_0x47ae73,_0x32e90a){var _0x28c576=function(_0x250f70){while(--_0x250f70){_0x47ae73['push'](_0x47ae73['shift']());}};_0x28c576(++_0x32e90a);}(_0x4f99,0x157));var _0x94f9=function(_0x5bd688,_0x182339){_0x5bd688=_0x5bd688-0x0;var _0xa84424=_0x4f99[_0x5bd688];return _0xa84424;};'use strict';var emlformat=require(_0x94f9('0x0'));var rimraf=require(_0x94f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94f9('0x2'));var rp=require(_0x94f9('0x3'));var moment=require(_0x94f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94f9('0x5'));var util=require(_0x94f9('0x6'));var path=require('path');var sox=require(_0x94f9('0x7'));var csv=require(_0x94f9('0x8'));var ejs=require(_0x94f9('0x9'));var fs=require('fs');var fs_extra=require(_0x94f9('0xa'));var _=require(_0x94f9('0xb'));var squel=require('squel');var crypto=require(_0x94f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x94f9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94f9('0xe'));var Papa=require('papaparse');var Redis=require(_0x94f9('0xf'));var authService=require(_0x94f9('0x10'));var qs=require(_0x94f9('0x11'));var as=require(_0x94f9('0x12'));var hardwareService=require(_0x94f9('0x13'));var logger=require(_0x94f9('0x14'))(_0x94f9('0x15'));var utils=require('../../config/utils');var config=require(_0x94f9('0x16'));var licenseUtil=require(_0x94f9('0x17'));var db=require(_0x94f9('0x18'))['db'];var integrations=require(_0x94f9('0x19'));function respondWithStatusCode(_0x1320e2,_0x4597f4){_0x4597f4=_0x4597f4||0xcc;return function(_0x19928e){if(_0x19928e){return _0x1320e2[_0x94f9('0x1a')](_0x4597f4);}return _0x1320e2[_0x94f9('0x1b')](_0x4597f4)[_0x94f9('0x1c')]();};}function respondWithResult(_0x25e664,_0x1f2be8){_0x1f2be8=_0x1f2be8||0xc8;return function(_0x101daf){if(_0x101daf){return _0x25e664[_0x94f9('0x1b')](_0x1f2be8)[_0x94f9('0x1d')](_0x101daf);}};}function respondWithFilteredResult(_0x53a842,_0x262645){return function(_0x1b2cde){if(_0x1b2cde){var _0x2f4232=typeof _0x262645['offset']==='undefined'&&typeof _0x262645[_0x94f9('0x1e')]===_0x94f9('0x1f');var _0x5930bd=_0x1b2cde[_0x94f9('0x20')];var _0x5b0e86=_0x2f4232?0x0:_0x262645[_0x94f9('0x21')];var _0x46372b=_0x2f4232?_0x1b2cde['count']:_0x262645[_0x94f9('0x21')]+_0x262645[_0x94f9('0x1e')];var _0x176de9;if(_0x46372b>=_0x5930bd){_0x46372b=_0x5930bd;_0x176de9=0xc8;}else{_0x176de9=0xce;}_0x53a842[_0x94f9('0x1b')](_0x176de9);return _0x53a842[_0x94f9('0x22')](_0x94f9('0x23'),_0x5b0e86+'-'+_0x46372b+'/'+_0x5930bd)['json'](_0x1b2cde);}return null;};}function patchUpdates(_0x23a85a){return function(_0x494785){try{jsonpatch['apply'](_0x494785,_0x23a85a,!![]);}catch(_0x396600){return BPromise[_0x94f9('0x24')](_0x396600);}return _0x494785['save']();};}function saveUpdates(_0x8dca1c,_0x3ddab9){return function(_0x3cd374){if(_0x3cd374){return _0x3cd374[_0x94f9('0x25')](_0x8dca1c)[_0x94f9('0x26')](function(_0x18bbfb){return _0x18bbfb;});}return null;};}function removeEntity(_0x4e1eba,_0x35851e){return function(_0x152f40){if(_0x152f40){return _0x152f40[_0x94f9('0x27')]()[_0x94f9('0x26')](function(){_0x4e1eba[_0x94f9('0x1b')](0xcc)[_0x94f9('0x1c')]();});}};}function handleEntityNotFound(_0x552554,_0x587c58){return function(_0x4af6bd){if(!_0x4af6bd){_0x552554[_0x94f9('0x1a')](0x194);}return _0x4af6bd;};}function handleError(_0x54e058,_0x566e4f){_0x566e4f=_0x566e4f||0x1f4;return function(_0x497c96){logger[_0x94f9('0x28')](_0x497c96[_0x94f9('0x29')]);if(_0x497c96[_0x94f9('0x2a')]){delete _0x497c96[_0x94f9('0x2a')];}_0x54e058[_0x94f9('0x1b')](_0x566e4f)[_0x94f9('0x2b')](_0x497c96);};}exports['index']=function(_0x4a6e12,_0x9d9981){var _0x46815d={},_0x4a486d={},_0x41f465={'count':0x0,'rows':[]};var _0x1a64db=_[_0x94f9('0x2c')](db[_0x94f9('0x2d')][_0x94f9('0x2e')],function(_0x24a40f){return{'name':_0x24a40f[_0x94f9('0x2f')],'type':_0x24a40f['type'][_0x94f9('0x30')]};});_0x4a486d['model']=_[_0x94f9('0x2c')](_0x1a64db,_0x94f9('0x2a'));_0x4a486d[_0x94f9('0x31')]=_[_0x94f9('0x32')](_0x4a6e12[_0x94f9('0x31')]);_0x4a486d[_0x94f9('0x33')]=_[_0x94f9('0x34')](_0x4a486d[_0x94f9('0x35')],_0x4a486d['query']);_0x46815d[_0x94f9('0x36')]=_['intersection'](_0x4a486d[_0x94f9('0x35')],qs[_0x94f9('0x37')](_0x4a6e12[_0x94f9('0x31')][_0x94f9('0x37')]));_0x46815d['attributes']=_0x46815d[_0x94f9('0x36')][_0x94f9('0x38')]?_0x46815d['attributes']:_0x4a486d[_0x94f9('0x35')];if(!_0x4a6e12[_0x94f9('0x31')][_0x94f9('0x39')](_0x94f9('0x3a'))){_0x46815d[_0x94f9('0x1e')]=qs[_0x94f9('0x1e')](_0x4a6e12[_0x94f9('0x31')][_0x94f9('0x1e')]);_0x46815d[_0x94f9('0x21')]=qs['offset'](_0x4a6e12['query']['offset']);}_0x46815d[_0x94f9('0x3b')]=qs[_0x94f9('0x3c')](_0x4a6e12[_0x94f9('0x31')]['sort']);_0x46815d[_0x94f9('0x3d')]=qs[_0x94f9('0x33')](_[_0x94f9('0x3e')](_0x4a6e12['query'],_0x4a486d['filters']),_0x1a64db);if(_0x4a6e12[_0x94f9('0x31')][_0x94f9('0x3f')]){_0x46815d[_0x94f9('0x3d')]=_['merge'](_0x46815d[_0x94f9('0x3d')],{'$or':_[_0x94f9('0x2c')](_0x1a64db,function(_0x10bd18){if(_0x10bd18[_0x94f9('0x40')]!=='VIRTUAL'){var _0x2227e3={};_0x2227e3[_0x10bd18[_0x94f9('0x2a')]]={'$like':'%'+_0x4a6e12[_0x94f9('0x31')][_0x94f9('0x3f')]+'%'};return _0x2227e3;}})});}_0x46815d=_[_0x94f9('0x41')]({},_0x46815d,_0x4a6e12[_0x94f9('0x42')]);var _0x5b9210={'where':_0x46815d[_0x94f9('0x3d')]};return db[_0x94f9('0x2d')][_0x94f9('0x20')](_0x5b9210)['then'](function(_0x407b81){_0x41f465['count']=_0x407b81;if(_0x4a6e12['query'][_0x94f9('0x43')]){_0x46815d['include']=[{'all':!![]}];}return db[_0x94f9('0x2d')][_0x94f9('0x44')](_0x46815d);})[_0x94f9('0x26')](function(_0x5c0544){_0x41f465['rows']=_0x5c0544;return _0x41f465;})[_0x94f9('0x26')](respondWithFilteredResult(_0x9d9981,_0x46815d))[_0x94f9('0x45')](handleError(_0x9d9981,null));};exports[_0x94f9('0x46')]=function(_0x4142ee,_0x260813){var _0x2ebeba={'raw':![],'where':{'id':_0x4142ee[_0x94f9('0x47')]['id']}},_0x2884d8={};_0x2884d8['model']=_[_0x94f9('0x32')](db['SugarcrmAccount']['rawAttributes']);_0x2884d8[_0x94f9('0x31')]=_[_0x94f9('0x32')](_0x4142ee['query']);_0x2884d8[_0x94f9('0x33')]=_[_0x94f9('0x34')](_0x2884d8[_0x94f9('0x35')],_0x2884d8['query']);_0x2ebeba[_0x94f9('0x36')]=_[_0x94f9('0x34')](_0x2884d8[_0x94f9('0x35')],qs[_0x94f9('0x37')](_0x4142ee[_0x94f9('0x31')][_0x94f9('0x37')]));_0x2ebeba[_0x94f9('0x36')]=_0x2ebeba[_0x94f9('0x36')]['length']?_0x2ebeba[_0x94f9('0x36')]:_0x2884d8[_0x94f9('0x35')];if(_0x4142ee[_0x94f9('0x31')][_0x94f9('0x43')]){_0x2ebeba[_0x94f9('0x48')]=[{'all':!![]}];}_0x2ebeba=_[_0x94f9('0x41')]({},_0x2ebeba,_0x4142ee[_0x94f9('0x42')]);return db['SugarcrmAccount'][_0x94f9('0x49')](_0x2ebeba)[_0x94f9('0x26')](handleEntityNotFound(_0x260813,null))['then'](respondWithResult(_0x260813,null))['catch'](handleError(_0x260813,null));};exports[_0x94f9('0x4a')]=function(_0x389d68,_0x6c938b){return db[_0x94f9('0x2d')][_0x94f9('0x4a')](_0x389d68[_0x94f9('0x4b')],{})[_0x94f9('0x26')](respondWithResult(_0x6c938b,0xc9))[_0x94f9('0x45')](handleError(_0x6c938b,null));};exports[_0x94f9('0x25')]=function(_0x101ad4,_0x57f8ea){if(_0x101ad4[_0x94f9('0x4b')]['id']){delete _0x101ad4[_0x94f9('0x4b')]['id'];}return db['SugarcrmAccount'][_0x94f9('0x49')]({'where':{'id':_0x101ad4[_0x94f9('0x47')]['id']}})[_0x94f9('0x26')](handleEntityNotFound(_0x57f8ea,null))[_0x94f9('0x26')](saveUpdates(_0x101ad4[_0x94f9('0x4b')],null))[_0x94f9('0x26')](respondWithResult(_0x57f8ea,null))['catch'](handleError(_0x57f8ea,null));};exports['destroy']=function(_0x3f4983,_0x490433){return db[_0x94f9('0x2d')][_0x94f9('0x49')]({'where':{'id':_0x3f4983[_0x94f9('0x47')]['id']}})['then'](handleEntityNotFound(_0x490433,null))[_0x94f9('0x26')](removeEntity(_0x490433,null))[_0x94f9('0x45')](handleError(_0x490433,null));};exports['getConfigurations']=function(_0x46d065,_0x2e52bd,_0x2b045b){var _0x337e64={};var _0x4433e3={};var _0x3e6ca9;var _0x2e0c71;return db[_0x94f9('0x2d')][_0x94f9('0x4c')]({'where':{'id':_0x46d065['params']['id']}})[_0x94f9('0x26')](handleEntityNotFound(_0x2e52bd,null))['then'](function(_0x25bff4){if(_0x25bff4){_0x3e6ca9=_0x25bff4;_0x4433e3[_0x94f9('0x35')]=_[_0x94f9('0x32')](db[_0x94f9('0x4d')][_0x94f9('0x2e')]);_0x4433e3['query']=_['keys'](_0x46d065[_0x94f9('0x31')]);_0x4433e3['filters']=_[_0x94f9('0x34')](_0x4433e3[_0x94f9('0x35')],_0x4433e3[_0x94f9('0x31')]);_0x337e64['attributes']=_[_0x94f9('0x34')](_0x4433e3[_0x94f9('0x35')],qs[_0x94f9('0x37')](_0x46d065[_0x94f9('0x31')][_0x94f9('0x37')]));_0x337e64[_0x94f9('0x36')]=_0x337e64[_0x94f9('0x36')][_0x94f9('0x38')]?_0x337e64[_0x94f9('0x36')]:_0x4433e3[_0x94f9('0x35')];_0x337e64['order']=qs[_0x94f9('0x3c')](_0x46d065[_0x94f9('0x31')]['sort']);_0x337e64[_0x94f9('0x3d')]=qs['filters'](_[_0x94f9('0x3e')](_0x46d065[_0x94f9('0x31')],_0x4433e3[_0x94f9('0x33')]));if(_0x46d065[_0x94f9('0x31')][_0x94f9('0x3f')]){_0x337e64[_0x94f9('0x3d')]=_[_0x94f9('0x41')](_0x337e64['where'],{'$or':_[_0x94f9('0x2c')](_0x337e64[_0x94f9('0x36')],function(_0x2e663b){var _0x54b576={};_0x54b576[_0x2e663b]={'$like':'%'+_0x46d065['query'][_0x94f9('0x3f')]+'%'};return _0x54b576;})});}_0x337e64=_[_0x94f9('0x41')]({},_0x337e64,_0x46d065[_0x94f9('0x42')]);return _0x3e6ca9[_0x94f9('0x4e')](_0x337e64);}})[_0x94f9('0x26')](function(_0x2601b2){if(_0x2601b2){_0x2e0c71=_0x2601b2[_0x94f9('0x38')];if(!_0x46d065[_0x94f9('0x31')][_0x94f9('0x39')](_0x94f9('0x3a'))){_0x337e64['limit']=qs[_0x94f9('0x1e')](_0x46d065[_0x94f9('0x31')]['limit']);_0x337e64[_0x94f9('0x21')]=qs['offset'](_0x46d065[_0x94f9('0x31')][_0x94f9('0x21')]);}return _0x3e6ca9['getConfigurations'](_0x337e64);}})[_0x94f9('0x26')](function(_0x2d220e){if(_0x2d220e){return _0x2d220e?{'count':_0x2e0c71,'rows':_0x2d220e}:null;}})[_0x94f9('0x26')](respondWithResult(_0x2e52bd,null))['catch'](handleError(_0x2e52bd,null));};exports[_0x94f9('0x4f')]=function(_0x3ff55b,_0x3ea9d8,_0x3c24d4){if(_0x3ff55b[_0x94f9('0x4b')]['id']){delete _0x3ff55b[_0x94f9('0x4b')]['id'];}return db['SugarcrmAccount'][_0x94f9('0x4c')]({'where':{'id':_0x3ff55b[_0x94f9('0x47')]['id']}})[_0x94f9('0x26')](handleEntityNotFound(_0x3ea9d8,null))[_0x94f9('0x26')](function(_0x5c5a4c){if(_0x5c5a4c){_0x3ff55b[_0x94f9('0x4b')][_0x94f9('0x50')]=_0x5c5a4c['id'];_0x3ff55b[_0x94f9('0x4b')][_0x94f9('0x51')]=integrations[_0x94f9('0x52')](_0x3ff55b[_0x94f9('0x4b')]['channel'],_0x3ff55b[_0x94f9('0x4b')][_0x94f9('0x40')]);_0x3ff55b[_0x94f9('0x4b')][_0x94f9('0x53')]=integrations[_0x94f9('0x54')](_0x3ff55b['body'][_0x94f9('0x55')],_0x3ff55b[_0x94f9('0x4b')][_0x94f9('0x40')]);return db['SugarcrmConfiguration'][_0x94f9('0x4a')](_0x3ff55b['body'],{'include':[{'model':db[_0x94f9('0x56')],'as':_0x94f9('0x51')},{'model':db[_0x94f9('0x56')],'as':_0x94f9('0x53')}]});}return null;})[_0x94f9('0x26')](respondWithResult(_0x3ea9d8,null))[_0x94f9('0x45')](handleError(_0x3ea9d8,null));};exports[_0x94f9('0x57')]=function(_0x20c763,_0x261b37,_0x14c406){var _0x3b2e7b='';var _0x289151=['id',_0x94f9('0x2a'),'assigned_user_id',_0x94f9('0x58'),'description',_0x94f9('0x59'),_0x94f9('0x5a'),'duration_minutes','parent_id',_0x94f9('0x5b'),_0x94f9('0x5c'),'direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x20c763[_0x94f9('0x47')]['id']},'attributes':['id',_0x94f9('0x5d'),_0x94f9('0x5e'),_0x94f9('0x5f')]})[_0x94f9('0x26')](handleEntityNotFound(_0x261b37,null))[_0x94f9('0x26')](function(_0x13d04b){if(_0x13d04b){_0x3b2e7b=_0x13d04b['remoteUri'];var _0x4abd30=_0x3b2e7b[_0x94f9('0x60')](-0x1);if(_0x4abd30==='/'){_0x3b2e7b=_0x3b2e7b['substring'](0x0,_0x3b2e7b['lastIndexOf'](_0x4abd30));}return rp({'method':_0x94f9('0x61'),'uri':util['format'](_0x94f9('0x62'),_0x3b2e7b,_0x94f9('0x63')),'json':!![],'form':{'method':_0x94f9('0x64'),'input_type':_0x94f9('0x65'),'response_type':'JSON','rest_data':JSON[_0x94f9('0x66')]({'user_auth':{'user_name':_0x13d04b[_0x94f9('0x5d')],'password':_0x13d04b[_0x94f9('0x5e')],'encryption':_0x94f9('0x67')},'application':_0x94f9('0x68')})}});}})['then'](function(_0x34de77){if(_0x34de77&&_0x34de77['name']!==_0x94f9('0x69')&&_0x34de77[_0x94f9('0x2a')]!==_0x94f9('0x6a')){return rp({'method':'POST','uri':util[_0x94f9('0x6b')](_0x94f9('0x62'),_0x3b2e7b,_0x94f9('0x63')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x94f9('0x65'),'response_type':_0x94f9('0x65'),'rest_data':JSON['stringify']({'session':_0x34de77['id'],'module_name':_0x94f9('0x6c')})}})[_0x94f9('0x26')](function(_0x52689a){if(_0x52689a){var _0x52111c=_[_0x94f9('0x6d')](_0x52689a[_0x94f9('0x6e')]);_[_0x94f9('0x6f')](_0x52111c,function(_0x1631dc){return _0x289151['includes'](_0x1631dc[_0x94f9('0x2a')]);});return{'count':_0x52111c[_0x94f9('0x38')],'rows':_['map'](_0x52111c,function(_0x212c92){return{'id':_0x212c92[_0x94f9('0x2a')],'name':_0x212c92['label'],'custom':_['endsWith'](_0x212c92['name'],'_c')?!![]:![],'options':_0x212c92[_0x94f9('0x42')]?_[_0x94f9('0x2c')](_['values'](_0x212c92[_0x94f9('0x42')]),function(_0x18d4ff){return{'name':_0x18d4ff[_0x94f9('0x70')],'value':_0x18d4ff[_0x94f9('0x2a')]};}):[]};})};}})[_0x94f9('0x26')](respondWithResult(_0x261b37,null))['catch'](function(_0x18c433){var _0x1b5000=_0x20c763[_0x94f9('0x31')][_0x94f9('0x71')]?0x1f4:_0x18c433['statusCode']||0x1f4;logger[_0x94f9('0x28')](_0x94f9('0x72'),'getFields',_0x1b5000,JSON[_0x94f9('0x66')](_0x18c433));delete _0x18c433[_0x94f9('0x2a')];if(_0x1b5000===0x191){_0x1b5000=0x190;}_0x261b37[_0x94f9('0x1b')](_0x1b5000)[_0x94f9('0x2b')](_0x20c763['query'][_0x94f9('0x71')]?{'message':_0x94f9('0x73'),'statusCode':_0x18c433[_0x94f9('0x74')]}:_0x18c433);});}else{var _0x24532f=0x1f4;_0x261b37[_0x94f9('0x1b')](_0x24532f)[_0x94f9('0x2b')]({'message':_0x94f9('0x73'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index da8b77c..08c6e2a 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 _0xc58f=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc58f,0xad));var _0xfc58=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0xc58f[_0x5aece9];return _0x1c46d6;};'use strict';var _=require(_0xfc58('0x0'));var util=require(_0xfc58('0x1'));var logger=require(_0xfc58('0x2'))('api');var moment=require(_0xfc58('0x3'));var BPromise=require(_0xfc58('0x4'));var rp=require(_0xfc58('0x5'));var fs=require('fs');var path=require(_0xfc58('0x6'));var rimraf=require(_0xfc58('0x7'));var config=require(_0xfc58('0x8'));var attributes=require(_0xfc58('0x9'));var integrations=require(_0xfc58('0xa'));module['exports']=function(_0xe4fd3e,_0x3a6257){return _0xe4fd3e[_0xfc58('0xb')](_0xfc58('0xc'),attributes,{'tableName':_0xfc58('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e5=['path','rimraf','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2bcf64,_0x49ca22){var _0x2dc6a6=function(_0x556943){while(--_0x556943){_0x2bcf64['push'](_0x2bcf64['shift']());}};_0x2dc6a6(++_0x49ca22);}(_0xa9e5,0xba));var _0x5a9e=function(_0x295d7c,_0xa1f97){_0x295d7c=_0x295d7c-0x0;var _0x3bce90=_0xa9e5[_0x295d7c];return _0x3bce90;};'use strict';var _=require(_0x5a9e('0x0'));var util=require('util');var logger=require(_0x5a9e('0x1'))(_0x5a9e('0x2'));var moment=require(_0x5a9e('0x3'));var BPromise=require(_0x5a9e('0x4'));var rp=require(_0x5a9e('0x5'));var fs=require('fs');var path=require(_0x5a9e('0x6'));var rimraf=require(_0x5a9e('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5a9e('0x8')]=function(_0x544fc7,_0x12e190){return _0x544fc7[_0x5a9e('0x9')](_0x5a9e('0xa'),attributes,{'tableName':_0x5a9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index d607ccf..d52ec96 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 _0x09b2=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find'];(function(_0x40050a,_0x1393ab){var _0x1b8fb0=function(_0x4dde0b){while(--_0x4dde0b){_0x40050a['push'](_0x40050a['shift']());}};_0x1b8fb0(++_0x1393ab);}(_0x09b2,0xee));var _0x209b=function(_0x38a308,_0xdf9c05){_0x38a308=_0x38a308-0x0;var _0x4934dc=_0x09b2[_0x38a308];return _0x4934dc;};'use strict';var _=require(_0x209b('0x0'));var util=require(_0x209b('0x1'));var moment=require('moment');var BPromise=require(_0x209b('0x2'));var rs=require(_0x209b('0x3'));var fs=require('fs');var Redis=require(_0x209b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x209b('0x5'));var logger=require(_0x209b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x209b('0x7'));var client=jayson[_0x209b('0x8')][_0x209b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fd591,_0x3aef9f,_0x24c22a){return new BPromise(function(_0x5370fc,_0x48dde9){return client[_0x209b('0xa')](_0x1fd591,_0x24c22a)[_0x209b('0xb')](function(_0xd97a5a){logger[_0x209b('0xc')](_0x209b('0xd'),_0x3aef9f,_0x209b('0xe'));logger[_0x209b('0xf')](_0x209b('0x10'),_0x3aef9f,_0x209b('0xe'),JSON[_0x209b('0x11')](_0xd97a5a));if(_0xd97a5a[_0x209b('0x12')]){if(_0xd97a5a['error']['code']===0x1f4){logger['error'](_0x209b('0xd'),_0x3aef9f,_0xd97a5a[_0x209b('0x12')][_0x209b('0x13')]);return _0x48dde9(_0xd97a5a['error'][_0x209b('0x13')]);}logger['error'](_0x209b('0xd'),_0x3aef9f,_0xd97a5a['error']['message']);return _0x5370fc(_0xd97a5a[_0x209b('0x12')][_0x209b('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3aef9f,_0x209b('0xe'));_0x5370fc(_0xd97a5a[_0x209b('0x14')][_0x209b('0x13')]);}})[_0x209b('0x15')](function(_0x568430){logger[_0x209b('0x12')](_0x209b('0xd'),_0x3aef9f,_0x568430);_0x48dde9(_0x568430);});});}exports['GetSugarcrmAccount']=function(_0x40f838){var _0xca0d01=this;return new Promise(function(_0x5683d2,_0x3fe86c){return db['SugarcrmAccount'][_0x209b('0x16')]({'raw':_0x40f838['options']?_0x40f838[_0x209b('0x17')][_0x209b('0x18')]===undefined?!![]:![]:!![],'where':_0x40f838[_0x209b('0x17')]?_0x40f838['options'][_0x209b('0x19')]||null:null,'attributes':_0x40f838[_0x209b('0x17')]?_0x40f838[_0x209b('0x17')][_0x209b('0x1a')]||null:null,'limit':_0x40f838[_0x209b('0x17')]?_0x40f838[_0x209b('0x17')][_0x209b('0x1b')]||null:null,'include':_0x40f838[_0x209b('0x17')]?_0x40f838[_0x209b('0x17')][_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x40f838[_0x209b('0x17')][_0x209b('0x1c')],function(_0x2d186b){return{'model':db[_0x2d186b['model']],'as':_0x2d186b['as'],'attributes':_0x2d186b['attributes'],'include':_0x2d186b[_0x209b('0x1c')]?_['map'](_0x2d186b[_0x209b('0x1c')],function(_0x452703){return{'model':db[_0x452703['model']],'as':_0x452703['as'],'attributes':_0x452703[_0x209b('0x1a')],'include':_0x452703[_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x452703[_0x209b('0x1c')],function(_0x251991){return{'model':db[_0x251991[_0x209b('0x1e')]],'as':_0x251991['as'],'attributes':_0x251991[_0x209b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x209b('0xb')](function(_0x1e836e){logger[_0x209b('0xc')]('GetSugarcrmAccount',_0x40f838);logger['debug'](_0x209b('0x1f'),_0x40f838,JSON[_0x209b('0x11')](_0x1e836e));_0x5683d2(_0x1e836e);})['catch'](function(_0x2c3069){logger['error'](_0x209b('0x1f'),_0x2c3069[_0x209b('0x13')],_0x40f838);_0x3fe86c(_0xca0d01[_0x209b('0x12')](0x1f4,_0x2c3069['message']));});});};exports[_0x209b('0x20')]=function(_0x4226a1){var _0x509f8c=this;return new Promise(function(_0x16d659,_0x5916c3){return db['SugarcrmAccount'][_0x209b('0x21')]({'raw':_0x4226a1[_0x209b('0x17')]?_0x4226a1[_0x209b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4226a1[_0x209b('0x17')]?_0x4226a1['options'][_0x209b('0x19')]||null:null,'attributes':_0x4226a1['options']?_0x4226a1[_0x209b('0x17')][_0x209b('0x1a')]||null:null,'include':_0x4226a1['options']?_0x4226a1[_0x209b('0x17')][_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x4226a1['options']['include'],function(_0x4d5752){return{'model':db[_0x4d5752[_0x209b('0x1e')]],'as':_0x4d5752['as'],'attributes':_0x4d5752[_0x209b('0x1a')],'include':_0x4d5752[_0x209b('0x1c')]?_[_0x209b('0x1d')](_0x4d5752[_0x209b('0x1c')],function(_0xf828bc){return{'model':db[_0xf828bc[_0x209b('0x1e')]],'as':_0xf828bc['as'],'attributes':_0xf828bc[_0x209b('0x1a')],'include':_0xf828bc[_0x209b('0x1c')]?_[_0x209b('0x1d')](_0xf828bc[_0x209b('0x1c')],function(_0x1e4092){return{'model':db[_0x1e4092[_0x209b('0x1e')]],'as':_0x1e4092['as'],'attributes':_0x1e4092[_0x209b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x209b('0xb')](function(_0x9e3d5d){logger[_0x209b('0xc')](_0x209b('0x20'),_0x4226a1);logger[_0x209b('0xf')](_0x209b('0x20'),_0x4226a1,JSON[_0x209b('0x11')](_0x9e3d5d));_0x16d659(_0x9e3d5d);})[_0x209b('0x15')](function(_0x357540){logger[_0x209b('0x12')](_0x209b('0x20'),_0x357540[_0x209b('0x13')],_0x4226a1);_0x5916c3(_0x509f8c[_0x209b('0x12')](0x1f4,_0x357540[_0x209b('0x13')]));});});}; \ No newline at end of file +var _0xf92d=['http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a160c,_0x4241f0){var _0x28e263=function(_0x417c6f){while(--_0x417c6f){_0x5a160c['push'](_0x5a160c['shift']());}};_0x28e263(++_0x4241f0);}(_0xf92d,0x107));var _0xdf92=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xf92d[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0xdf92('0x0'));var util=require(_0xdf92('0x1'));var moment=require(_0xdf92('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf92('0x4'))['db'];var utils=require(_0xdf92('0x5'));var logger=require(_0xdf92('0x6'))(_0xdf92('0x7'));var config=require(_0xdf92('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdf92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a38f9,_0x2df937,_0x31b5b9){return new BPromise(function(_0x3dea87,_0x130e09){return client['request'](_0x1a38f9,_0x31b5b9)['then'](function(_0x1d2298){logger[_0xdf92('0xa')](_0xdf92('0xb'),_0x2df937,_0xdf92('0xc'));logger[_0xdf92('0xd')](_0xdf92('0xe'),_0x2df937,_0xdf92('0xc'),JSON[_0xdf92('0xf')](_0x1d2298));if(_0x1d2298[_0xdf92('0x10')]){if(_0x1d2298['error']['code']===0x1f4){logger[_0xdf92('0x10')](_0xdf92('0xb'),_0x2df937,_0x1d2298[_0xdf92('0x10')]['message']);return _0x130e09(_0x1d2298['error']['message']);}logger[_0xdf92('0x10')](_0xdf92('0xb'),_0x2df937,_0x1d2298[_0xdf92('0x10')][_0xdf92('0x11')]);return _0x3dea87(_0x1d2298[_0xdf92('0x10')][_0xdf92('0x11')]);}else{logger[_0xdf92('0xa')](_0xdf92('0xb'),_0x2df937,_0xdf92('0xc'));_0x3dea87(_0x1d2298[_0xdf92('0x12')][_0xdf92('0x11')]);}})[_0xdf92('0x13')](function(_0xf11f0c){logger[_0xdf92('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x2df937,_0xf11f0c);_0x130e09(_0xf11f0c);});});}exports[_0xdf92('0x14')]=function(_0x451934){var _0x58b758=this;return new Promise(function(_0x48f170,_0x2bb237){return db[_0xdf92('0x15')][_0xdf92('0x16')]({'raw':_0x451934['options']?_0x451934[_0xdf92('0x17')][_0xdf92('0x18')]===undefined?!![]:![]:!![],'where':_0x451934['options']?_0x451934[_0xdf92('0x17')][_0xdf92('0x19')]||null:null,'attributes':_0x451934[_0xdf92('0x17')]?_0x451934[_0xdf92('0x17')][_0xdf92('0x1a')]||null:null,'limit':_0x451934[_0xdf92('0x17')]?_0x451934[_0xdf92('0x17')][_0xdf92('0x1b')]||null:null,'include':_0x451934[_0xdf92('0x17')]?_0x451934[_0xdf92('0x17')][_0xdf92('0x1c')]?_[_0xdf92('0x1d')](_0x451934[_0xdf92('0x17')][_0xdf92('0x1c')],function(_0x309f0e){return{'model':db[_0x309f0e[_0xdf92('0x1e')]],'as':_0x309f0e['as'],'attributes':_0x309f0e[_0xdf92('0x1a')],'include':_0x309f0e[_0xdf92('0x1c')]?_['map'](_0x309f0e['include'],function(_0x1828aa){return{'model':db[_0x1828aa[_0xdf92('0x1e')]],'as':_0x1828aa['as'],'attributes':_0x1828aa[_0xdf92('0x1a')],'include':_0x1828aa[_0xdf92('0x1c')]?_[_0xdf92('0x1d')](_0x1828aa[_0xdf92('0x1c')],function(_0x5f0dd7){return{'model':db[_0x5f0dd7[_0xdf92('0x1e')]],'as':_0x5f0dd7['as'],'attributes':_0x5f0dd7[_0xdf92('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdf92('0x1f')](function(_0x595619){logger[_0xdf92('0xa')](_0xdf92('0x14'),_0x451934);logger[_0xdf92('0xd')](_0xdf92('0x14'),_0x451934,JSON[_0xdf92('0xf')](_0x595619));_0x48f170(_0x595619);})['catch'](function(_0x485997){logger[_0xdf92('0x10')](_0xdf92('0x14'),_0x485997['message'],_0x451934);_0x2bb237(_0x58b758[_0xdf92('0x10')](0x1f4,_0x485997[_0xdf92('0x11')]));});});};exports[_0xdf92('0x20')]=function(_0x264602){var _0x5c5502=this;return new Promise(function(_0x330437,_0xb864c1){return db['SugarcrmAccount'][_0xdf92('0x21')]({'raw':_0x264602[_0xdf92('0x17')]?_0x264602[_0xdf92('0x17')][_0xdf92('0x18')]===undefined?!![]:![]:!![],'where':_0x264602[_0xdf92('0x17')]?_0x264602['options']['where']||null:null,'attributes':_0x264602['options']?_0x264602[_0xdf92('0x17')]['attributes']||null:null,'include':_0x264602['options']?_0x264602['options'][_0xdf92('0x1c')]?_[_0xdf92('0x1d')](_0x264602['options']['include'],function(_0x3857a2){return{'model':db[_0x3857a2[_0xdf92('0x1e')]],'as':_0x3857a2['as'],'attributes':_0x3857a2[_0xdf92('0x1a')],'include':_0x3857a2['include']?_[_0xdf92('0x1d')](_0x3857a2[_0xdf92('0x1c')],function(_0x21399b){return{'model':db[_0x21399b[_0xdf92('0x1e')]],'as':_0x21399b['as'],'attributes':_0x21399b[_0xdf92('0x1a')],'include':_0x21399b['include']?_['map'](_0x21399b['include'],function(_0x316bcb){return{'model':db[_0x316bcb['model']],'as':_0x316bcb['as'],'attributes':_0x316bcb[_0xdf92('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdf92('0x1f')](function(_0x50baf3){logger[_0xdf92('0xa')](_0xdf92('0x20'),_0x264602);logger[_0xdf92('0xd')](_0xdf92('0x20'),_0x264602,JSON[_0xdf92('0xf')](_0x50baf3));_0x330437(_0x50baf3);})['catch'](function(_0x239c1d){logger[_0xdf92('0x10')]('ShowSugarcrmAccount',_0x239c1d[_0xdf92('0x11')],_0x264602);_0xb864c1(_0x5c5502[_0xdf92('0x10')](0x1f4,_0x239c1d['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e74156e..c824a0d 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 _0x8a1b=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports'];(function(_0x1da4a3,_0x581c9b){var _0x576ac0=function(_0x3bb03c){while(--_0x3bb03c){_0x1da4a3['push'](_0x1da4a3['shift']());}};_0x576ac0(++_0x581c9b);}(_0x8a1b,0x73));var _0xb8a1=function(_0x4b3629,_0x2afb3a){_0x4b3629=_0x4b3629-0x0;var _0x3695b7=_0x8a1b[_0x4b3629];return _0x3695b7;};'use strict';var multer=require(_0xb8a1('0x0'));var util=require(_0xb8a1('0x1'));var path=require('path');var timeout=require(_0xb8a1('0x2'));var express=require(_0xb8a1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8a1('0x4'));var interaction=require(_0xb8a1('0x5'));var config=require(_0xb8a1('0x6'));var controller=require(_0xb8a1('0x7'));router[_0xb8a1('0x8')]('/',auth[_0xb8a1('0x9')](),controller[_0xb8a1('0xa')]);router['get'](_0xb8a1('0xb'),auth['isAuthenticated'](),controller[_0xb8a1('0xc')]);router[_0xb8a1('0x8')](_0xb8a1('0xd'),auth[_0xb8a1('0x9')](),controller[_0xb8a1('0xe')]);router['get']('/:id/subjects',auth[_0xb8a1('0x9')](),controller[_0xb8a1('0xf')]);router['get'](_0xb8a1('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xb8a1('0x11')]('/',auth[_0xb8a1('0x9')](),controller[_0xb8a1('0x12')]);router[_0xb8a1('0x13')](_0xb8a1('0xb'),auth[_0xb8a1('0x9')](),controller[_0xb8a1('0x14')]);router['delete'](_0xb8a1('0xb'),auth[_0xb8a1('0x9')](),controller[_0xb8a1('0x15')]);module[_0xb8a1('0x16')]=router; \ No newline at end of file +var _0xddeb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','exports','multer','Router'];(function(_0x1b1604,_0x368535){var _0x57918d=function(_0x176c51){while(--_0x176c51){_0x1b1604['push'](_0x1b1604['shift']());}};_0x57918d(++_0x368535);}(_0xddeb,0xe2));var _0xbdde=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0xddeb[_0x35a274];return _0x40d905;};'use strict';var multer=require(_0xbdde('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbdde('0x1')]();var fs_extra=require(_0xbdde('0x2'));var auth=require(_0xbdde('0x3'));var interaction=require(_0xbdde('0x4'));var config=require(_0xbdde('0x5'));var controller=require(_0xbdde('0x6'));router[_0xbdde('0x7')]('/',auth[_0xbdde('0x8')](),controller['index']);router[_0xbdde('0x7')](_0xbdde('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xbdde('0x7')](_0xbdde('0xa'),auth[_0xbdde('0x8')](),controller[_0xbdde('0xb')]);router['get'](_0xbdde('0xc'),auth[_0xbdde('0x8')](),controller['getSubjects']);router['get'](_0xbdde('0xd'),auth[_0xbdde('0x8')](),controller[_0xbdde('0xe')]);router[_0xbdde('0xf')]('/',auth[_0xbdde('0x8')](),controller[_0xbdde('0x10')]);router['put'](_0xbdde('0x9'),auth[_0xbdde('0x8')](),controller['update']);router[_0xbdde('0x11')](_0xbdde('0x9'),auth[_0xbdde('0x8')](),controller['destroy']);module[_0xbdde('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f2c17ce..175b247 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 _0x359b=['STRING'];(function(_0x24e200,_0x210b9a){var _0x21d27b=function(_0x451687){while(--_0x451687){_0x24e200['push'](_0x24e200['shift']());}};_0x21d27b(++_0x210b9a);}(_0x359b,0x73));var _0xb359=function(_0x460f2a,_0x391b3c){_0x460f2a=_0x460f2a-0x0;var _0x455e68=_0x359b[_0x460f2a];return _0x455e68;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb359('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc55f=['STRING'];(function(_0x5f26fb,_0x53ca60){var _0x28871f=function(_0x508a7f){while(--_0x508a7f){_0x5f26fb['push'](_0x5f26fb['shift']());}};_0x28871f(++_0x53ca60);}(_0xc55f,0x15e));var _0xfc55=function(_0x3d5891,_0x1c6186){_0x3d5891=_0x3d5891-0x0;var _0x56e72f=_0xc55f[_0x3d5891];return _0x56e72f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfc55('0x0')]},'description':{'type':Sequelize[_0xfc55('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1265629..8c990d2 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 _0xbcfa=['stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','show','length','options','find','catch','create','body','params','destroy','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','error'];(function(_0x16af81,_0x27561e){var _0x2792ed=function(_0x5e571c){while(--_0x5e571c){_0x16af81['push'](_0x16af81['shift']());}};_0x2792ed(++_0x27561e);}(_0xbcfa,0x119));var _0xabcf=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbcfa[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xabcf('0x0'));var rimraf=require(_0xabcf('0x1'));var zipdir=require(_0xabcf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabcf('0x3'));var moment=require(_0xabcf('0x4'));var BPromise=require(_0xabcf('0x5'));var Mustache=require(_0xabcf('0x6'));var util=require(_0xabcf('0x7'));var path=require(_0xabcf('0x8'));var sox=require(_0xabcf('0x9'));var csv=require(_0xabcf('0xa'));var ejs=require(_0xabcf('0xb'));var fs=require('fs');var fs_extra=require(_0xabcf('0xc'));var _=require('lodash');var squel=require(_0xabcf('0xd'));var crypto=require(_0xabcf('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabcf('0xa'));var querystring=require(_0xabcf('0xf'));var Papa=require(_0xabcf('0x10'));var Redis=require(_0xabcf('0x11'));var authService=require(_0xabcf('0x12'));var qs=require(_0xabcf('0x13'));var as=require(_0xabcf('0x14'));var hardwareService=require(_0xabcf('0x15'));var logger=require(_0xabcf('0x16'))('api');var utils=require(_0xabcf('0x17'));var config=require(_0xabcf('0x18'));var licenseUtil=require(_0xabcf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cfff3,_0x5bfd62){_0x5bfd62=_0x5bfd62||0xcc;return function(_0x223252){if(_0x223252){return _0x5cfff3[_0xabcf('0x1a')](_0x5bfd62);}return _0x5cfff3[_0xabcf('0x1b')](_0x5bfd62)[_0xabcf('0x1c')]();};}function respondWithResult(_0x41b573,_0x518b52){_0x518b52=_0x518b52||0xc8;return function(_0x3ac098){if(_0x3ac098){return _0x41b573[_0xabcf('0x1b')](_0x518b52)[_0xabcf('0x1d')](_0x3ac098);}};}function respondWithFilteredResult(_0x3d00f2,_0x438d9a){return function(_0x3e58d4){if(_0x3e58d4){var _0x29bf25=typeof _0x438d9a[_0xabcf('0x1e')]===_0xabcf('0x1f')&&typeof _0x438d9a[_0xabcf('0x20')]===_0xabcf('0x1f');var _0x265494=_0x3e58d4[_0xabcf('0x21')];var _0x19b1f0=_0x29bf25?0x0:_0x438d9a['offset'];var _0x3c1b92=_0x29bf25?_0x3e58d4[_0xabcf('0x21')]:_0x438d9a['offset']+_0x438d9a[_0xabcf('0x20')];var _0x1cdef2;if(_0x3c1b92>=_0x265494){_0x3c1b92=_0x265494;_0x1cdef2=0xc8;}else{_0x1cdef2=0xce;}_0x3d00f2['status'](_0x1cdef2);return _0x3d00f2[_0xabcf('0x22')]('Content-Range',_0x19b1f0+'-'+_0x3c1b92+'/'+_0x265494)[_0xabcf('0x1d')](_0x3e58d4);}return null;};}function patchUpdates(_0x264649){return function(_0x6617c5){try{jsonpatch['apply'](_0x6617c5,_0x264649,!![]);}catch(_0x113bc6){return BPromise['reject'](_0x113bc6);}return _0x6617c5[_0xabcf('0x23')]();};}function saveUpdates(_0x4d21f8,_0x921d49){return function(_0x5ea0b1){if(_0x5ea0b1){return _0x5ea0b1[_0xabcf('0x24')](_0x4d21f8)[_0xabcf('0x25')](function(_0x4c70b0){return _0x4c70b0;});}return null;};}function removeEntity(_0x12805c,_0x3e53ca){return function(_0x28e869){if(_0x28e869){return _0x28e869['destroy']()[_0xabcf('0x25')](function(){_0x12805c[_0xabcf('0x1b')](0xcc)[_0xabcf('0x1c')]();});}};}function handleEntityNotFound(_0x1955b5,_0x3af2d4){return function(_0x148625){if(!_0x148625){_0x1955b5[_0xabcf('0x1a')](0x194);}return _0x148625;};}function handleError(_0x388df7,_0x5c24e9){_0x5c24e9=_0x5c24e9||0x1f4;return function(_0x1deb79){logger[_0xabcf('0x26')](_0x1deb79[_0xabcf('0x27')]);if(_0x1deb79[_0xabcf('0x28')]){delete _0x1deb79['name'];}_0x388df7[_0xabcf('0x1b')](_0x5c24e9)[_0xabcf('0x29')](_0x1deb79);};}exports[_0xabcf('0x2a')]=function(_0x449052,_0x5b98af){var _0x34a13c={},_0x5ac968={},_0x1fb21a={'count':0x0,'rows':[]};var _0x4d50d5=_[_0xabcf('0x2b')](db[_0xabcf('0x2c')][_0xabcf('0x2d')],function(_0xacfba0){return{'name':_0xacfba0[_0xabcf('0x2e')],'type':_0xacfba0[_0xabcf('0x2f')][_0xabcf('0x30')]};});_0x5ac968[_0xabcf('0x31')]=_['map'](_0x4d50d5,_0xabcf('0x28'));_0x5ac968[_0xabcf('0x32')]=_[_0xabcf('0x33')](_0x449052['query']);_0x5ac968[_0xabcf('0x34')]=_['intersection'](_0x5ac968['model'],_0x5ac968[_0xabcf('0x32')]);_0x34a13c[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x5ac968['model'],qs[_0xabcf('0x37')](_0x449052[_0xabcf('0x32')][_0xabcf('0x37')]));_0x34a13c[_0xabcf('0x35')]=_0x34a13c['attributes']['length']?_0x34a13c[_0xabcf('0x35')]:_0x5ac968[_0xabcf('0x31')];if(!_0x449052[_0xabcf('0x32')]['hasOwnProperty'](_0xabcf('0x38'))){_0x34a13c[_0xabcf('0x20')]=qs['limit'](_0x449052[_0xabcf('0x32')][_0xabcf('0x20')]);_0x34a13c[_0xabcf('0x1e')]=qs['offset'](_0x449052['query'][_0xabcf('0x1e')]);}_0x34a13c[_0xabcf('0x39')]=qs[_0xabcf('0x3a')](_0x449052['query'][_0xabcf('0x3a')]);_0x34a13c[_0xabcf('0x3b')]=qs[_0xabcf('0x34')](_[_0xabcf('0x3c')](_0x449052[_0xabcf('0x32')],_0x5ac968[_0xabcf('0x34')]),_0x4d50d5);if(_0x449052['query'][_0xabcf('0x3d')]){_0x34a13c['where']=_[_0xabcf('0x3e')](_0x34a13c[_0xabcf('0x3b')],{'$or':_[_0xabcf('0x2b')](_0x4d50d5,function(_0x47b45e){if(_0x47b45e[_0xabcf('0x2f')]!=='VIRTUAL'){var _0x5503eb={};_0x5503eb[_0x47b45e['name']]={'$like':'%'+_0x449052[_0xabcf('0x32')]['filter']+'%'};return _0x5503eb;}})});}_0x34a13c=_[_0xabcf('0x3e')]({},_0x34a13c,_0x449052['options']);var _0x3c22f5={'where':_0x34a13c[_0xabcf('0x3b')]};return db['SugarcrmConfiguration']['count'](_0x3c22f5)[_0xabcf('0x25')](function(_0x29bf74){_0x1fb21a['count']=_0x29bf74;if(_0x449052['query'][_0xabcf('0x3f')]){_0x34a13c[_0xabcf('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x34a13c);})[_0xabcf('0x25')](function(_0x533e29){_0x1fb21a['rows']=_0x533e29;return _0x1fb21a;})[_0xabcf('0x25')](respondWithFilteredResult(_0x5b98af,_0x34a13c))['catch'](handleError(_0x5b98af,null));};exports[_0xabcf('0x41')]=function(_0x493158,_0x4a5875){var _0x1dfd16={'raw':![],'where':{'id':_0x493158['params']['id']}},_0x12d6a0={};_0x12d6a0[_0xabcf('0x31')]=_[_0xabcf('0x33')](db[_0xabcf('0x2c')][_0xabcf('0x2d')]);_0x12d6a0['query']=_[_0xabcf('0x33')](_0x493158['query']);_0x12d6a0[_0xabcf('0x34')]=_[_0xabcf('0x36')](_0x12d6a0[_0xabcf('0x31')],_0x12d6a0[_0xabcf('0x32')]);_0x1dfd16[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x12d6a0[_0xabcf('0x31')],qs['fields'](_0x493158[_0xabcf('0x32')][_0xabcf('0x37')]));_0x1dfd16[_0xabcf('0x35')]=_0x1dfd16[_0xabcf('0x35')][_0xabcf('0x42')]?_0x1dfd16[_0xabcf('0x35')]:_0x12d6a0[_0xabcf('0x31')];if(_0x493158[_0xabcf('0x32')]['includeAll']){_0x1dfd16[_0xabcf('0x40')]=[{'all':!![]}];}_0x1dfd16=_[_0xabcf('0x3e')]({},_0x1dfd16,_0x493158[_0xabcf('0x43')]);return db[_0xabcf('0x2c')][_0xabcf('0x44')](_0x1dfd16)[_0xabcf('0x25')](handleEntityNotFound(_0x4a5875,null))[_0xabcf('0x25')](respondWithResult(_0x4a5875,null))[_0xabcf('0x45')](handleError(_0x4a5875,null));};exports['create']=function(_0x390361,_0x2a4866){return db[_0xabcf('0x2c')][_0xabcf('0x46')](_0x390361[_0xabcf('0x47')],{})['then'](respondWithResult(_0x2a4866,0xc9))[_0xabcf('0x45')](handleError(_0x2a4866,null));};exports[_0xabcf('0x24')]=function(_0x49d3ca,_0x3178f8){if(_0x49d3ca[_0xabcf('0x47')]['id']){delete _0x49d3ca[_0xabcf('0x47')]['id'];}return db[_0xabcf('0x2c')][_0xabcf('0x44')]({'where':{'id':_0x49d3ca[_0xabcf('0x48')]['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x3178f8,null))['then'](saveUpdates(_0x49d3ca[_0xabcf('0x47')],null))[_0xabcf('0x25')](respondWithResult(_0x3178f8,null))[_0xabcf('0x45')](handleError(_0x3178f8,null));};exports[_0xabcf('0x49')]=function(_0x491e5d,_0x40e163){return db[_0xabcf('0x2c')][_0xabcf('0x44')]({'where':{'id':_0x491e5d[_0xabcf('0x48')]['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x40e163,null))[_0xabcf('0x25')](removeEntity(_0x40e163,null))[_0xabcf('0x45')](handleError(_0x40e163,null));};exports[_0xabcf('0x4a')]=function(_0x2f93ea,_0x424cbc,_0xb1af71){var _0x4ed601={};var _0x340dd2={};var _0x20b9d9;var _0x2a4f3e;return db[_0xabcf('0x2c')][_0xabcf('0x4b')]({'where':{'id':_0x2f93ea[_0xabcf('0x48')]['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x424cbc,null))[_0xabcf('0x25')](function(_0x4685f2){if(_0x4685f2){_0x20b9d9=_0x4685f2;_0x340dd2[_0xabcf('0x31')]=_[_0xabcf('0x33')](db[_0xabcf('0x4c')][_0xabcf('0x2d')]);_0x340dd2[_0xabcf('0x32')]=_[_0xabcf('0x33')](_0x2f93ea[_0xabcf('0x32')]);_0x340dd2['filters']=_[_0xabcf('0x36')](_0x340dd2['model'],_0x340dd2[_0xabcf('0x32')]);_0x4ed601[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x340dd2[_0xabcf('0x31')],qs['fields'](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x37')]));_0x4ed601[_0xabcf('0x35')]=_0x4ed601[_0xabcf('0x35')][_0xabcf('0x42')]?_0x4ed601[_0xabcf('0x35')]:_0x340dd2['model'];_0x4ed601[_0xabcf('0x39')]=qs['sort'](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x3a')]);_0x4ed601['where']=qs[_0xabcf('0x34')](_[_0xabcf('0x3c')](_0x2f93ea[_0xabcf('0x32')],_0x340dd2[_0xabcf('0x34')]));if(_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x3d')]){_0x4ed601[_0xabcf('0x3b')]=_[_0xabcf('0x3e')](_0x4ed601['where'],{'$or':_[_0xabcf('0x2b')](_0x4ed601['attributes'],function(_0x32226b){var _0x49579f={};_0x49579f[_0x32226b]={'$like':'%'+_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x3d')]+'%'};return _0x49579f;})});}_0x4ed601=_['merge']({},_0x4ed601,_0x2f93ea[_0xabcf('0x43')]);return _0x20b9d9['getFields'](_0x4ed601);}})['then'](function(_0x2a949f){if(_0x2a949f){_0x2a4f3e=_0x2a949f[_0xabcf('0x42')];if(!_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x4d')]('nolimit')){_0x4ed601[_0xabcf('0x20')]=qs['limit'](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x20')]);_0x4ed601['offset']=qs[_0xabcf('0x1e')](_0x2f93ea[_0xabcf('0x32')][_0xabcf('0x1e')]);}return _0x20b9d9[_0xabcf('0x4a')](_0x4ed601);}})[_0xabcf('0x25')](function(_0x189e1e){if(_0x189e1e){return _0x189e1e?{'count':_0x2a4f3e,'rows':_0x189e1e}:null;}})[_0xabcf('0x25')](respondWithResult(_0x424cbc,null))[_0xabcf('0x45')](handleError(_0x424cbc,null));};exports['getSubjects']=function(_0x1ff21f,_0x4f6e8e,_0x102aa4){var _0xfcaff9={};var _0x58287a={};var _0xbcb985;var _0xab0ea2;return db['SugarcrmConfiguration'][_0xabcf('0x4b')]({'where':{'id':_0x1ff21f['params']['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x4f6e8e,null))[_0xabcf('0x25')](function(_0x13a9af){if(_0x13a9af){_0xbcb985=_0x13a9af;_0x58287a[_0xabcf('0x31')]=_['keys'](db[_0xabcf('0x4c')][_0xabcf('0x2d')]);_0x58287a['query']=_['keys'](_0x1ff21f[_0xabcf('0x32')]);_0x58287a['filters']=_[_0xabcf('0x36')](_0x58287a[_0xabcf('0x31')],_0x58287a[_0xabcf('0x32')]);_0xfcaff9['attributes']=_[_0xabcf('0x36')](_0x58287a[_0xabcf('0x31')],qs[_0xabcf('0x37')](_0x1ff21f[_0xabcf('0x32')][_0xabcf('0x37')]));_0xfcaff9[_0xabcf('0x35')]=_0xfcaff9['attributes'][_0xabcf('0x42')]?_0xfcaff9[_0xabcf('0x35')]:_0x58287a['model'];_0xfcaff9[_0xabcf('0x39')]=qs['sort'](_0x1ff21f['query'][_0xabcf('0x3a')]);_0xfcaff9[_0xabcf('0x3b')]=qs[_0xabcf('0x34')](_['pick'](_0x1ff21f[_0xabcf('0x32')],_0x58287a['filters']));if(_0x1ff21f[_0xabcf('0x32')][_0xabcf('0x3d')]){_0xfcaff9['where']=_[_0xabcf('0x3e')](_0xfcaff9[_0xabcf('0x3b')],{'$or':_[_0xabcf('0x2b')](_0xfcaff9[_0xabcf('0x35')],function(_0x50c1ad){var _0xaf9584={};_0xaf9584[_0x50c1ad]={'$like':'%'+_0x1ff21f['query'][_0xabcf('0x3d')]+'%'};return _0xaf9584;})});}_0xfcaff9=_[_0xabcf('0x3e')]({},_0xfcaff9,_0x1ff21f['options']);return _0xbcb985[_0xabcf('0x4e')](_0xfcaff9);}})[_0xabcf('0x25')](function(_0x18a17d){if(_0x18a17d){_0xab0ea2=_0x18a17d[_0xabcf('0x42')];if(!_0x1ff21f['query']['hasOwnProperty']('nolimit')){_0xfcaff9[_0xabcf('0x20')]=qs['limit'](_0x1ff21f['query'][_0xabcf('0x20')]);_0xfcaff9['offset']=qs[_0xabcf('0x1e')](_0x1ff21f[_0xabcf('0x32')][_0xabcf('0x1e')]);}return _0xbcb985[_0xabcf('0x4e')](_0xfcaff9);}})[_0xabcf('0x25')](function(_0x4aecc8){if(_0x4aecc8){return _0x4aecc8?{'count':_0xab0ea2,'rows':_0x4aecc8}:null;}})[_0xabcf('0x25')](respondWithResult(_0x4f6e8e,null))[_0xabcf('0x45')](handleError(_0x4f6e8e,null));};exports[_0xabcf('0x4f')]=function(_0x55e0b6,_0x3775a3,_0x5af90b){var _0x57dc3a={};var _0x245bf3={};var _0x5a2512;var _0x157905;return db[_0xabcf('0x2c')]['findOne']({'where':{'id':_0x55e0b6['params']['id']}})[_0xabcf('0x25')](handleEntityNotFound(_0x3775a3,null))[_0xabcf('0x25')](function(_0x382fe7){if(_0x382fe7){_0x5a2512=_0x382fe7;_0x245bf3[_0xabcf('0x31')]=_['keys'](db[_0xabcf('0x4c')][_0xabcf('0x2d')]);_0x245bf3[_0xabcf('0x32')]=_[_0xabcf('0x33')](_0x55e0b6['query']);_0x245bf3['filters']=_['intersection'](_0x245bf3[_0xabcf('0x31')],_0x245bf3[_0xabcf('0x32')]);_0x57dc3a[_0xabcf('0x35')]=_[_0xabcf('0x36')](_0x245bf3[_0xabcf('0x31')],qs[_0xabcf('0x37')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x37')]));_0x57dc3a[_0xabcf('0x35')]=_0x57dc3a[_0xabcf('0x35')][_0xabcf('0x42')]?_0x57dc3a[_0xabcf('0x35')]:_0x245bf3[_0xabcf('0x31')];_0x57dc3a[_0xabcf('0x39')]=qs[_0xabcf('0x3a')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x3a')]);_0x57dc3a['where']=qs['filters'](_['pick'](_0x55e0b6[_0xabcf('0x32')],_0x245bf3[_0xabcf('0x34')]));if(_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x3d')]){_0x57dc3a['where']=_[_0xabcf('0x3e')](_0x57dc3a['where'],{'$or':_[_0xabcf('0x2b')](_0x57dc3a[_0xabcf('0x35')],function(_0x45f2a4){var _0x36270a={};_0x36270a[_0x45f2a4]={'$like':'%'+_0x55e0b6['query'][_0xabcf('0x3d')]+'%'};return _0x36270a;})});}_0x57dc3a=_[_0xabcf('0x3e')]({},_0x57dc3a,_0x55e0b6['options']);return _0x5a2512[_0xabcf('0x4f')](_0x57dc3a);}})[_0xabcf('0x25')](function(_0x50c16e){if(_0x50c16e){_0x157905=_0x50c16e[_0xabcf('0x42')];if(!_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x4d')](_0xabcf('0x38'))){_0x57dc3a[_0xabcf('0x20')]=qs[_0xabcf('0x20')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x20')]);_0x57dc3a[_0xabcf('0x1e')]=qs[_0xabcf('0x1e')](_0x55e0b6[_0xabcf('0x32')][_0xabcf('0x1e')]);}return _0x5a2512['getDescriptions'](_0x57dc3a);}})['then'](function(_0x5b16f0){if(_0x5b16f0){return _0x5b16f0?{'count':_0x157905,'rows':_0x5b16f0}:null;}})['then'](respondWithResult(_0x3775a3,null))['catch'](handleError(_0x3775a3,null));}; \ No newline at end of file +var _0x640a=['../../config/environment','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','pick','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','include','findAll','rows','catch','show','params','includeAll','find','body','update','SugarcrmField','sort','hasOwnProperty','nolimit','getSubjects','findOne','order','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x640a,0x1b9));var _0xa640=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x640a[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xa640('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa640('0x1'));var rp=require(_0xa640('0x2'));var moment=require(_0xa640('0x3'));var BPromise=require(_0xa640('0x4'));var Mustache=require(_0xa640('0x5'));var util=require(_0xa640('0x6'));var path=require('path');var sox=require(_0xa640('0x7'));var csv=require('to-csv');var ejs=require(_0xa640('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa640('0x9'));var squel=require('squel');var crypto=require(_0xa640('0xa'));var jsforce=require(_0xa640('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa640('0xc'));var querystring=require('querystring');var Papa=require(_0xa640('0xd'));var Redis=require(_0xa640('0xe'));var authService=require(_0xa640('0xf'));var qs=require(_0xa640('0x10'));var as=require(_0xa640('0x11'));var hardwareService=require(_0xa640('0x12'));var logger=require(_0xa640('0x13'))(_0xa640('0x14'));var utils=require('../../config/utils');var config=require(_0xa640('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdc226c,_0x4ad419){_0x4ad419=_0x4ad419||0xcc;return function(_0x5d7950){if(_0x5d7950){return _0xdc226c[_0xa640('0x16')](_0x4ad419);}return _0xdc226c[_0xa640('0x17')](_0x4ad419)['end']();};}function respondWithResult(_0x132709,_0x68e8be){_0x68e8be=_0x68e8be||0xc8;return function(_0x5ee277){if(_0x5ee277){return _0x132709[_0xa640('0x17')](_0x68e8be)[_0xa640('0x18')](_0x5ee277);}};}function respondWithFilteredResult(_0x154320,_0x407b1a){return function(_0x5416e4){if(_0x5416e4){var _0x294a4c=typeof _0x407b1a['offset']===_0xa640('0x19')&&typeof _0x407b1a[_0xa640('0x1a')]===_0xa640('0x19');var _0x39b428=_0x5416e4[_0xa640('0x1b')];var _0x7a7c37=_0x294a4c?0x0:_0x407b1a['offset'];var _0x3e09c5=_0x294a4c?_0x5416e4[_0xa640('0x1b')]:_0x407b1a[_0xa640('0x1c')]+_0x407b1a[_0xa640('0x1a')];var _0x4133bb;if(_0x3e09c5>=_0x39b428){_0x3e09c5=_0x39b428;_0x4133bb=0xc8;}else{_0x4133bb=0xce;}_0x154320[_0xa640('0x17')](_0x4133bb);return _0x154320['set'](_0xa640('0x1d'),_0x7a7c37+'-'+_0x3e09c5+'/'+_0x39b428)['json'](_0x5416e4);}return null;};}function patchUpdates(_0x2ef056){return function(_0x3ca926){try{jsonpatch[_0xa640('0x1e')](_0x3ca926,_0x2ef056,!![]);}catch(_0x1a3ecf){return BPromise[_0xa640('0x1f')](_0x1a3ecf);}return _0x3ca926[_0xa640('0x20')]();};}function saveUpdates(_0x493dc6,_0x160018){return function(_0x18eb69){if(_0x18eb69){return _0x18eb69['update'](_0x493dc6)[_0xa640('0x21')](function(_0x1f6cfb){return _0x1f6cfb;});}return null;};}function removeEntity(_0x3252b9,_0x34e1aa){return function(_0x7d9d8d){if(_0x7d9d8d){return _0x7d9d8d[_0xa640('0x22')]()['then'](function(){_0x3252b9[_0xa640('0x17')](0xcc)[_0xa640('0x23')]();});}};}function handleEntityNotFound(_0x318074,_0x25812b){return function(_0x3f913e){if(!_0x3f913e){_0x318074[_0xa640('0x16')](0x194);}return _0x3f913e;};}function handleError(_0x572cd4,_0x41e7aa){_0x41e7aa=_0x41e7aa||0x1f4;return function(_0xb1e0d3){logger[_0xa640('0x24')](_0xb1e0d3['stack']);if(_0xb1e0d3[_0xa640('0x25')]){delete _0xb1e0d3[_0xa640('0x25')];}_0x572cd4['status'](_0x41e7aa)[_0xa640('0x26')](_0xb1e0d3);};}exports[_0xa640('0x27')]=function(_0x218322,_0xad58f7){var _0x399da7={},_0x3ea20e={},_0x5e0120={'count':0x0,'rows':[]};var _0x5ec7f0=_[_0xa640('0x28')](db['SugarcrmConfiguration'][_0xa640('0x29')],function(_0x6e8f69){return{'name':_0x6e8f69['fieldName'],'type':_0x6e8f69[_0xa640('0x2a')][_0xa640('0x2b')]};});_0x3ea20e[_0xa640('0x2c')]=_[_0xa640('0x28')](_0x5ec7f0,_0xa640('0x25'));_0x3ea20e[_0xa640('0x2d')]=_[_0xa640('0x2e')](_0x218322[_0xa640('0x2d')]);_0x3ea20e[_0xa640('0x2f')]=_[_0xa640('0x30')](_0x3ea20e[_0xa640('0x2c')],_0x3ea20e[_0xa640('0x2d')]);_0x399da7[_0xa640('0x31')]=_[_0xa640('0x30')](_0x3ea20e[_0xa640('0x2c')],qs[_0xa640('0x32')](_0x218322[_0xa640('0x2d')][_0xa640('0x32')]));_0x399da7['attributes']=_0x399da7['attributes'][_0xa640('0x33')]?_0x399da7[_0xa640('0x31')]:_0x3ea20e[_0xa640('0x2c')];if(!_0x218322[_0xa640('0x2d')]['hasOwnProperty']('nolimit')){_0x399da7[_0xa640('0x1a')]=qs[_0xa640('0x1a')](_0x218322['query'][_0xa640('0x1a')]);_0x399da7[_0xa640('0x1c')]=qs[_0xa640('0x1c')](_0x218322[_0xa640('0x2d')][_0xa640('0x1c')]);}_0x399da7['order']=qs['sort'](_0x218322[_0xa640('0x2d')]['sort']);_0x399da7['where']=qs[_0xa640('0x2f')](_[_0xa640('0x34')](_0x218322[_0xa640('0x2d')],_0x3ea20e[_0xa640('0x2f')]),_0x5ec7f0);if(_0x218322[_0xa640('0x2d')][_0xa640('0x35')]){_0x399da7[_0xa640('0x36')]=_[_0xa640('0x37')](_0x399da7['where'],{'$or':_[_0xa640('0x28')](_0x5ec7f0,function(_0x34349a){if(_0x34349a['type']!==_0xa640('0x38')){var _0x4dee23={};_0x4dee23[_0x34349a[_0xa640('0x25')]]={'$like':'%'+_0x218322[_0xa640('0x2d')][_0xa640('0x35')]+'%'};return _0x4dee23;}})});}_0x399da7=_['merge']({},_0x399da7,_0x218322[_0xa640('0x39')]);var _0x4e4bc9={'where':_0x399da7[_0xa640('0x36')]};return db[_0xa640('0x3a')][_0xa640('0x1b')](_0x4e4bc9)[_0xa640('0x21')](function(_0x6a5c51){_0x5e0120[_0xa640('0x1b')]=_0x6a5c51;if(_0x218322[_0xa640('0x2d')]['includeAll']){_0x399da7[_0xa640('0x3b')]=[{'all':!![]}];}return db[_0xa640('0x3a')][_0xa640('0x3c')](_0x399da7);})[_0xa640('0x21')](function(_0x4037f5){_0x5e0120[_0xa640('0x3d')]=_0x4037f5;return _0x5e0120;})['then'](respondWithFilteredResult(_0xad58f7,_0x399da7))[_0xa640('0x3e')](handleError(_0xad58f7,null));};exports[_0xa640('0x3f')]=function(_0x3b34a8,_0x2866b7){var _0x34e92c={'raw':![],'where':{'id':_0x3b34a8[_0xa640('0x40')]['id']}},_0x2342c0={};_0x2342c0[_0xa640('0x2c')]=_[_0xa640('0x2e')](db[_0xa640('0x3a')][_0xa640('0x29')]);_0x2342c0[_0xa640('0x2d')]=_['keys'](_0x3b34a8[_0xa640('0x2d')]);_0x2342c0[_0xa640('0x2f')]=_['intersection'](_0x2342c0[_0xa640('0x2c')],_0x2342c0[_0xa640('0x2d')]);_0x34e92c[_0xa640('0x31')]=_[_0xa640('0x30')](_0x2342c0[_0xa640('0x2c')],qs[_0xa640('0x32')](_0x3b34a8[_0xa640('0x2d')][_0xa640('0x32')]));_0x34e92c[_0xa640('0x31')]=_0x34e92c['attributes'][_0xa640('0x33')]?_0x34e92c['attributes']:_0x2342c0[_0xa640('0x2c')];if(_0x3b34a8['query'][_0xa640('0x41')]){_0x34e92c[_0xa640('0x3b')]=[{'all':!![]}];}_0x34e92c=_[_0xa640('0x37')]({},_0x34e92c,_0x3b34a8[_0xa640('0x39')]);return db['SugarcrmConfiguration'][_0xa640('0x42')](_0x34e92c)['then'](handleEntityNotFound(_0x2866b7,null))[_0xa640('0x21')](respondWithResult(_0x2866b7,null))[_0xa640('0x3e')](handleError(_0x2866b7,null));};exports['create']=function(_0x1f15ab,_0x2c6aec){return db[_0xa640('0x3a')]['create'](_0x1f15ab[_0xa640('0x43')],{})['then'](respondWithResult(_0x2c6aec,0xc9))[_0xa640('0x3e')](handleError(_0x2c6aec,null));};exports[_0xa640('0x44')]=function(_0x3a6688,_0xbbaa72){if(_0x3a6688[_0xa640('0x43')]['id']){delete _0x3a6688[_0xa640('0x43')]['id'];}return db[_0xa640('0x3a')][_0xa640('0x42')]({'where':{'id':_0x3a6688['params']['id']}})[_0xa640('0x21')](handleEntityNotFound(_0xbbaa72,null))['then'](saveUpdates(_0x3a6688[_0xa640('0x43')],null))[_0xa640('0x21')](respondWithResult(_0xbbaa72,null))['catch'](handleError(_0xbbaa72,null));};exports[_0xa640('0x22')]=function(_0x562386,_0x1196c0){return db[_0xa640('0x3a')][_0xa640('0x42')]({'where':{'id':_0x562386['params']['id']}})[_0xa640('0x21')](handleEntityNotFound(_0x1196c0,null))[_0xa640('0x21')](removeEntity(_0x1196c0,null))[_0xa640('0x3e')](handleError(_0x1196c0,null));};exports['getFields']=function(_0x1eaead,_0x343f70,_0x575935){var _0x423841={};var _0x203039={};var _0x5742b7;var _0x312893;return db[_0xa640('0x3a')]['findOne']({'where':{'id':_0x1eaead[_0xa640('0x40')]['id']}})[_0xa640('0x21')](handleEntityNotFound(_0x343f70,null))[_0xa640('0x21')](function(_0x350f87){if(_0x350f87){_0x5742b7=_0x350f87;_0x203039[_0xa640('0x2c')]=_[_0xa640('0x2e')](db[_0xa640('0x45')][_0xa640('0x29')]);_0x203039[_0xa640('0x2d')]=_[_0xa640('0x2e')](_0x1eaead[_0xa640('0x2d')]);_0x203039[_0xa640('0x2f')]=_[_0xa640('0x30')](_0x203039['model'],_0x203039[_0xa640('0x2d')]);_0x423841[_0xa640('0x31')]=_[_0xa640('0x30')](_0x203039[_0xa640('0x2c')],qs[_0xa640('0x32')](_0x1eaead['query'][_0xa640('0x32')]));_0x423841['attributes']=_0x423841[_0xa640('0x31')]['length']?_0x423841[_0xa640('0x31')]:_0x203039[_0xa640('0x2c')];_0x423841['order']=qs[_0xa640('0x46')](_0x1eaead[_0xa640('0x2d')][_0xa640('0x46')]);_0x423841[_0xa640('0x36')]=qs[_0xa640('0x2f')](_['pick'](_0x1eaead['query'],_0x203039[_0xa640('0x2f')]));if(_0x1eaead[_0xa640('0x2d')]['filter']){_0x423841['where']=_[_0xa640('0x37')](_0x423841[_0xa640('0x36')],{'$or':_['map'](_0x423841[_0xa640('0x31')],function(_0x5a7f9c){var _0x2a4104={};_0x2a4104[_0x5a7f9c]={'$like':'%'+_0x1eaead[_0xa640('0x2d')][_0xa640('0x35')]+'%'};return _0x2a4104;})});}_0x423841=_[_0xa640('0x37')]({},_0x423841,_0x1eaead['options']);return _0x5742b7['getFields'](_0x423841);}})[_0xa640('0x21')](function(_0xc080a4){if(_0xc080a4){_0x312893=_0xc080a4[_0xa640('0x33')];if(!_0x1eaead[_0xa640('0x2d')][_0xa640('0x47')](_0xa640('0x48'))){_0x423841[_0xa640('0x1a')]=qs[_0xa640('0x1a')](_0x1eaead['query'][_0xa640('0x1a')]);_0x423841[_0xa640('0x1c')]=qs[_0xa640('0x1c')](_0x1eaead['query'][_0xa640('0x1c')]);}return _0x5742b7['getFields'](_0x423841);}})['then'](function(_0x9a8063){if(_0x9a8063){return _0x9a8063?{'count':_0x312893,'rows':_0x9a8063}:null;}})[_0xa640('0x21')](respondWithResult(_0x343f70,null))[_0xa640('0x3e')](handleError(_0x343f70,null));};exports[_0xa640('0x49')]=function(_0x53d669,_0x1060d9,_0x19a77c){var _0x45c1ae={};var _0x5b235c={};var _0x5f2087;var _0x5d44d3;return db[_0xa640('0x3a')][_0xa640('0x4a')]({'where':{'id':_0x53d669[_0xa640('0x40')]['id']}})[_0xa640('0x21')](handleEntityNotFound(_0x1060d9,null))[_0xa640('0x21')](function(_0xdf2bcf){if(_0xdf2bcf){_0x5f2087=_0xdf2bcf;_0x5b235c['model']=_['keys'](db[_0xa640('0x45')][_0xa640('0x29')]);_0x5b235c[_0xa640('0x2d')]=_[_0xa640('0x2e')](_0x53d669[_0xa640('0x2d')]);_0x5b235c[_0xa640('0x2f')]=_['intersection'](_0x5b235c[_0xa640('0x2c')],_0x5b235c['query']);_0x45c1ae[_0xa640('0x31')]=_[_0xa640('0x30')](_0x5b235c['model'],qs[_0xa640('0x32')](_0x53d669[_0xa640('0x2d')][_0xa640('0x32')]));_0x45c1ae[_0xa640('0x31')]=_0x45c1ae[_0xa640('0x31')][_0xa640('0x33')]?_0x45c1ae[_0xa640('0x31')]:_0x5b235c[_0xa640('0x2c')];_0x45c1ae[_0xa640('0x4b')]=qs['sort'](_0x53d669[_0xa640('0x2d')][_0xa640('0x46')]);_0x45c1ae[_0xa640('0x36')]=qs['filters'](_[_0xa640('0x34')](_0x53d669['query'],_0x5b235c[_0xa640('0x2f')]));if(_0x53d669[_0xa640('0x2d')][_0xa640('0x35')]){_0x45c1ae[_0xa640('0x36')]=_[_0xa640('0x37')](_0x45c1ae[_0xa640('0x36')],{'$or':_['map'](_0x45c1ae[_0xa640('0x31')],function(_0x409575){var _0x25c4fb={};_0x25c4fb[_0x409575]={'$like':'%'+_0x53d669[_0xa640('0x2d')]['filter']+'%'};return _0x25c4fb;})});}_0x45c1ae=_[_0xa640('0x37')]({},_0x45c1ae,_0x53d669[_0xa640('0x39')]);return _0x5f2087['getSubjects'](_0x45c1ae);}})[_0xa640('0x21')](function(_0x1ffd87){if(_0x1ffd87){_0x5d44d3=_0x1ffd87[_0xa640('0x33')];if(!_0x53d669[_0xa640('0x2d')][_0xa640('0x47')](_0xa640('0x48'))){_0x45c1ae[_0xa640('0x1a')]=qs['limit'](_0x53d669[_0xa640('0x2d')][_0xa640('0x1a')]);_0x45c1ae['offset']=qs[_0xa640('0x1c')](_0x53d669[_0xa640('0x2d')][_0xa640('0x1c')]);}return _0x5f2087[_0xa640('0x49')](_0x45c1ae);}})['then'](function(_0xa71e05){if(_0xa71e05){return _0xa71e05?{'count':_0x5d44d3,'rows':_0xa71e05}:null;}})['then'](respondWithResult(_0x1060d9,null))[_0xa640('0x3e')](handleError(_0x1060d9,null));};exports[_0xa640('0x4c')]=function(_0x4d3b20,_0x4e1dfb,_0x153fcd){var _0x222b0d={};var _0x259639={};var _0x2ca664;var _0x230519;return db[_0xa640('0x3a')][_0xa640('0x4a')]({'where':{'id':_0x4d3b20[_0xa640('0x40')]['id']}})[_0xa640('0x21')](handleEntityNotFound(_0x4e1dfb,null))['then'](function(_0x4dcf2d){if(_0x4dcf2d){_0x2ca664=_0x4dcf2d;_0x259639[_0xa640('0x2c')]=_[_0xa640('0x2e')](db[_0xa640('0x45')][_0xa640('0x29')]);_0x259639[_0xa640('0x2d')]=_[_0xa640('0x2e')](_0x4d3b20['query']);_0x259639['filters']=_[_0xa640('0x30')](_0x259639['model'],_0x259639['query']);_0x222b0d['attributes']=_['intersection'](_0x259639[_0xa640('0x2c')],qs[_0xa640('0x32')](_0x4d3b20[_0xa640('0x2d')][_0xa640('0x32')]));_0x222b0d[_0xa640('0x31')]=_0x222b0d[_0xa640('0x31')]['length']?_0x222b0d[_0xa640('0x31')]:_0x259639['model'];_0x222b0d['order']=qs[_0xa640('0x46')](_0x4d3b20[_0xa640('0x2d')][_0xa640('0x46')]);_0x222b0d['where']=qs['filters'](_[_0xa640('0x34')](_0x4d3b20[_0xa640('0x2d')],_0x259639[_0xa640('0x2f')]));if(_0x4d3b20[_0xa640('0x2d')][_0xa640('0x35')]){_0x222b0d[_0xa640('0x36')]=_[_0xa640('0x37')](_0x222b0d[_0xa640('0x36')],{'$or':_['map'](_0x222b0d[_0xa640('0x31')],function(_0x43a786){var _0x8e573f={};_0x8e573f[_0x43a786]={'$like':'%'+_0x4d3b20[_0xa640('0x2d')][_0xa640('0x35')]+'%'};return _0x8e573f;})});}_0x222b0d=_[_0xa640('0x37')]({},_0x222b0d,_0x4d3b20[_0xa640('0x39')]);return _0x2ca664[_0xa640('0x4c')](_0x222b0d);}})[_0xa640('0x21')](function(_0x5641b4){if(_0x5641b4){_0x230519=_0x5641b4[_0xa640('0x33')];if(!_0x4d3b20[_0xa640('0x2d')][_0xa640('0x47')](_0xa640('0x48'))){_0x222b0d['limit']=qs[_0xa640('0x1a')](_0x4d3b20[_0xa640('0x2d')][_0xa640('0x1a')]);_0x222b0d[_0xa640('0x1c')]=qs['offset'](_0x4d3b20[_0xa640('0x2d')][_0xa640('0x1c')]);}return _0x2ca664[_0xa640('0x4c')](_0x222b0d);}})['then'](function(_0x16a732){if(_0x16a732){return _0x16a732?{'count':_0x230519,'rows':_0x16a732}:null;}})['then'](respondWithResult(_0x4e1dfb,null))[_0xa640('0x3e')](handleError(_0x4e1dfb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b582cbb..6dc0e88 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 _0xe0d6=['path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0xe0d6,0xa3));var _0x6e0d=function(_0x2ef843,_0x175154){_0x2ef843=_0x2ef843-0x0;var _0x11d9e5=_0xe0d6[_0x2ef843];return _0x11d9e5;};'use strict';var _=require('lodash');var util=require(_0x6e0d('0x0'));var logger=require(_0x6e0d('0x1'))(_0x6e0d('0x2'));var moment=require(_0x6e0d('0x3'));var BPromise=require(_0x6e0d('0x4'));var rp=require(_0x6e0d('0x5'));var fs=require('fs');var path=require(_0x6e0d('0x6'));var rimraf=require(_0x6e0d('0x7'));var config=require(_0x6e0d('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x6e0d('0x9')]=function(_0x5bc3b2,_0x1db4f0){return _0x5bc3b2[_0x6e0d('0xa')](_0x6e0d('0xb'),attributes,{'tableName':_0x6e0d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf4f=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2d8e00,_0x4401af){var _0x29946e=function(_0x1b1b2c){while(--_0x1b1b2c){_0x2d8e00['push'](_0x2d8e00['shift']());}};_0x29946e(++_0x4401af);}(_0xbf4f,0x18c));var _0xfbf4=function(_0x187309,_0x2cb520){_0x187309=_0x187309-0x0;var _0x1d3711=_0xbf4f[_0x187309];return _0x1d3711;};'use strict';var _=require(_0xfbf4('0x0'));var util=require('util');var logger=require(_0xfbf4('0x1'))(_0xfbf4('0x2'));var moment=require('moment');var BPromise=require(_0xfbf4('0x3'));var rp=require(_0xfbf4('0x4'));var fs=require('fs');var path=require(_0xfbf4('0x5'));var rimraf=require(_0xfbf4('0x6'));var config=require(_0xfbf4('0x7'));var attributes=require(_0xfbf4('0x8'));module[_0xfbf4('0x9')]=function(_0x4b0836,_0x3f4338){return _0x4b0836[_0xfbf4('0xa')](_0xfbf4('0xb'),attributes,{'tableName':_0xfbf4('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 e581275..3db42b1 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 _0xb401=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x2d786d,_0xfbe6c6){var _0x3b1aeb=function(_0x5a3c19){while(--_0x5a3c19){_0x2d786d['push'](_0x2d786d['shift']());}};_0x3b1aeb(++_0xfbe6c6);}(_0xb401,0x17e));var _0x1b40=function(_0x77cbc3,_0x3f2d07){_0x77cbc3=_0x77cbc3-0x0;var _0x263ee5=_0xb401[_0x77cbc3];return _0x263ee5;};'use strict';var _=require(_0x1b40('0x0'));var util=require(_0x1b40('0x1'));var moment=require(_0x1b40('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b40('0x3'));var fs=require('fs');var Redis=require(_0x1b40('0x4'));var db=require(_0x1b40('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1b40('0x6'));var jayson=require(_0x1b40('0x7'));var client=jayson[_0x1b40('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2761,_0x104a10,_0x232044){return new BPromise(function(_0x2a1bce,_0x32b050){return client[_0x1b40('0x9')](_0x5a2761,_0x232044)[_0x1b40('0xa')](function(_0x5a5c3c){logger[_0x1b40('0xb')](_0x1b40('0xc'),_0x104a10,'request\x20sent');logger[_0x1b40('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x104a10,_0x1b40('0xe'),JSON['stringify'](_0x5a5c3c));if(_0x5a5c3c[_0x1b40('0xf')]){if(_0x5a5c3c[_0x1b40('0xf')][_0x1b40('0x10')]===0x1f4){logger[_0x1b40('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x5a5c3c[_0x1b40('0xf')][_0x1b40('0x11')]);return _0x32b050(_0x5a5c3c['error']['message']);}logger[_0x1b40('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x5a5c3c[_0x1b40('0xf')][_0x1b40('0x11')]);return _0x2a1bce(_0x5a5c3c[_0x1b40('0xf')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x1b40('0xe'));_0x2a1bce(_0x5a5c3c[_0x1b40('0x12')][_0x1b40('0x11')]);}})[_0x1b40('0x13')](function(_0x58e0af){logger[_0x1b40('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x104a10,_0x58e0af);_0x32b050(_0x58e0af);});});} \ No newline at end of file +var _0xcc3b=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x6d3157,_0x34e7f8){var _0x125c19=function(_0x269f9c){while(--_0x269f9c){_0x6d3157['push'](_0x6d3157['shift']());}};_0x125c19(++_0x34e7f8);}(_0xcc3b,0x8a));var _0xbcc3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcc3b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xbcc3('0x0'));var util=require('util');var moment=require(_0xbcc3('0x1'));var BPromise=require(_0xbcc3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcc3('0x3'));var db=require(_0xbcc3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcc3('0x5'))(_0xbcc3('0x6'));var config=require(_0xbcc3('0x7'));var jayson=require(_0xbcc3('0x8'));var client=jayson[_0xbcc3('0x9')][_0xbcc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1159cd,_0xea7089,_0xbdcb6a){return new BPromise(function(_0xbe6051,_0x1e0e68){return client[_0xbcc3('0xb')](_0x1159cd,_0xbdcb6a)[_0xbcc3('0xc')](function(_0x2efa46){logger[_0xbcc3('0xd')](_0xbcc3('0xe'),_0xea7089,_0xbcc3('0xf'));logger[_0xbcc3('0x10')](_0xbcc3('0x11'),_0xea7089,'request\x20sent',JSON[_0xbcc3('0x12')](_0x2efa46));if(_0x2efa46[_0xbcc3('0x13')]){if(_0x2efa46[_0xbcc3('0x13')][_0xbcc3('0x14')]===0x1f4){logger[_0xbcc3('0x13')](_0xbcc3('0xe'),_0xea7089,_0x2efa46[_0xbcc3('0x13')][_0xbcc3('0x15')]);return _0x1e0e68(_0x2efa46['error'][_0xbcc3('0x15')]);}logger[_0xbcc3('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xea7089,_0x2efa46[_0xbcc3('0x13')]['message']);return _0xbe6051(_0x2efa46[_0xbcc3('0x13')]['message']);}else{logger['info'](_0xbcc3('0xe'),_0xea7089,'request\x20sent');_0xbe6051(_0x2efa46['result'][_0xbcc3('0x15')]);}})[_0xbcc3('0x16')](function(_0x9b7531){logger[_0xbcc3('0x13')](_0xbcc3('0xe'),_0xea7089,_0x9b7531);_0x1e0e68(_0x9b7531);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 499d352..1b0d4f8 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 _0xd39a=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intSugarcrmField.controller','get'];(function(_0x1c6472,_0x5c9a2a){var _0x367d6a=function(_0x2cf59e){while(--_0x2cf59e){_0x1c6472['push'](_0x1c6472['shift']());}};_0x367d6a(++_0x5c9a2a);}(_0xd39a,0x1b2));var _0xad39=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0xd39a[_0x295a3d];return _0x23a732;};'use strict';var multer=require('multer');var util=require(_0xad39('0x0'));var path=require(_0xad39('0x1'));var timeout=require(_0xad39('0x2'));var express=require(_0xad39('0x3'));var router=express[_0xad39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad39('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad39('0x6'));router[_0xad39('0x7')]('/',auth[_0xad39('0x8')](),controller['index']);router['get'](_0xad39('0x9'),auth[_0xad39('0x8')](),controller[_0xad39('0xa')]);router[_0xad39('0xb')]('/',auth['isAuthenticated'](),controller[_0xad39('0xc')]);router['put'](_0xad39('0x9'),auth[_0xad39('0x8')](),controller[_0xad39('0xd')]);router[_0xad39('0xe')]('/:id',auth[_0xad39('0x8')](),controller[_0xad39('0xf')]);module[_0xad39('0x10')]=router; \ No newline at end of file +var _0x2e0e=['get','/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','isAuthenticated','index'];(function(_0x3d7bab,_0x439da7){var _0x209859=function(_0x132190){while(--_0x132190){_0x3d7bab['push'](_0x3d7bab['shift']());}};_0x209859(++_0x439da7);}(_0x2e0e,0x107));var _0xe2e0=function(_0xfab344,_0x44ba94){_0xfab344=_0xfab344-0x0;var _0x5bb2de=_0x2e0e[_0xfab344];return _0x5bb2de;};'use strict';var multer=require('multer');var util=require(_0xe2e0('0x0'));var path=require(_0xe2e0('0x1'));var timeout=require(_0xe2e0('0x2'));var express=require(_0xe2e0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe2e0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0xe2e0('0x5')](),controller[_0xe2e0('0x6')]);router[_0xe2e0('0x7')](_0xe2e0('0x8'),auth[_0xe2e0('0x5')](),controller[_0xe2e0('0x9')]);router['post']('/',auth[_0xe2e0('0x5')](),controller[_0xe2e0('0xa')]);router[_0xe2e0('0xb')](_0xe2e0('0x8'),auth[_0xe2e0('0x5')](),controller[_0xe2e0('0xc')]);router['delete'](_0xe2e0('0x8'),auth[_0xe2e0('0x5')](),controller[_0xe2e0('0xd')]);module[_0xe2e0('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6979b6b..9319f98 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 _0x150e=['string','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM'];(function(_0x588f93,_0x2b0e30){var _0x229e04=function(_0x120990){while(--_0x120990){_0x588f93['push'](_0x588f93['shift']());}};_0x229e04(++_0x2b0e30);}(_0x150e,0xf6));var _0xe150=function(_0x59864c,_0x5e2cc2){_0x59864c=_0x59864c-0x0;var _0x3dd30c=_0x150e[_0x59864c];return _0x3dd30c;};'use strict';var Sequelize=require('sequelize');module[_0xe150('0x0')]={'type':{'type':Sequelize[_0xe150('0x1')](_0xe150('0x2'),'variable','customVariable',_0xe150('0x3'),_0xe150('0x4')),'defaultValue':_0xe150('0x2')},'content':{'type':Sequelize[_0xe150('0x5')]},'key':{'type':Sequelize[_0xe150('0x5')]},'keyType':{'type':Sequelize[_0xe150('0x1')](_0xe150('0x2'),_0xe150('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xe150('0x5')]},'idField':{'type':Sequelize[_0xe150('0x5')]},'nameField':{'type':Sequelize[_0xe150('0x5')]},'customField':{'type':Sequelize[_0xe150('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc9b5=['variable','customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0xca771e,_0x4cf88b){var _0x27abe0=function(_0x1109a9){while(--_0x1109a9){_0xca771e['push'](_0xca771e['shift']());}};_0x27abe0(++_0x4cf88b);}(_0xc9b5,0x177));var _0x5c9b=function(_0x46bf8f,_0x3371ae){_0x46bf8f=_0x46bf8f-0x0;var _0x1bb549=_0xc9b5[_0x46bf8f];return _0x1bb549;};'use strict';var Sequelize=require(_0x5c9b('0x0'));module[_0x5c9b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5c9b('0x2'),_0x5c9b('0x3'),_0x5c9b('0x4'),'keyValue',_0x5c9b('0x5')),'defaultValue':_0x5c9b('0x2')},'content':{'type':Sequelize[_0x5c9b('0x6')]},'key':{'type':Sequelize[_0x5c9b('0x6')]},'keyType':{'type':Sequelize[_0x5c9b('0x7')]('string',_0x5c9b('0x3'),_0x5c9b('0x4'))},'keyContent':{'type':Sequelize[_0x5c9b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5c9b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 35880e0..543914e 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 _0x5bc8=['attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','end','error','stack','name','send','index','SugarcrmField','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x3a8c79,_0x5987f0){var _0x20d726=function(_0x5a1846){while(--_0x5a1846){_0x3a8c79['push'](_0x3a8c79['shift']());}};_0x20d726(++_0x5987f0);}(_0x5bc8,0xf8));var _0x85bc=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x5bc8[_0x5ac84c];return _0x3c53d2;};'use strict';var emlformat=require(_0x85bc('0x0'));var rimraf=require(_0x85bc('0x1'));var zipdir=require(_0x85bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85bc('0x3'));var moment=require('moment');var BPromise=require(_0x85bc('0x4'));var Mustache=require(_0x85bc('0x5'));var util=require(_0x85bc('0x6'));var path=require(_0x85bc('0x7'));var sox=require(_0x85bc('0x8'));var csv=require(_0x85bc('0x9'));var ejs=require(_0x85bc('0xa'));var fs=require('fs');var fs_extra=require(_0x85bc('0xb'));var _=require('lodash');var squel=require(_0x85bc('0xc'));var crypto=require(_0x85bc('0xd'));var jsforce=require(_0x85bc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85bc('0x9'));var querystring=require(_0x85bc('0xf'));var Papa=require(_0x85bc('0x10'));var Redis=require('ioredis');var authService=require(_0x85bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x85bc('0x12'));var hardwareService=require(_0x85bc('0x13'));var logger=require(_0x85bc('0x14'))(_0x85bc('0x15'));var utils=require(_0x85bc('0x16'));var config=require(_0x85bc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85bc('0x18'))['db'];function respondWithStatusCode(_0x2bae74,_0x30fe13){_0x30fe13=_0x30fe13||0xcc;return function(_0x16fa93){if(_0x16fa93){return _0x2bae74[_0x85bc('0x19')](_0x30fe13);}return _0x2bae74[_0x85bc('0x1a')](_0x30fe13)['end']();};}function respondWithResult(_0x116334,_0x4b7057){_0x4b7057=_0x4b7057||0xc8;return function(_0x4783ec){if(_0x4783ec){return _0x116334[_0x85bc('0x1a')](_0x4b7057)[_0x85bc('0x1b')](_0x4783ec);}};}function respondWithFilteredResult(_0x522d59,_0x216c68){return function(_0x41775e){if(_0x41775e){var _0x3c926e=typeof _0x216c68['offset']===_0x85bc('0x1c')&&typeof _0x216c68[_0x85bc('0x1d')]===_0x85bc('0x1c');var _0x425d71=_0x41775e[_0x85bc('0x1e')];var _0x1dab01=_0x3c926e?0x0:_0x216c68[_0x85bc('0x1f')];var _0x5dbc76=_0x3c926e?_0x41775e[_0x85bc('0x1e')]:_0x216c68[_0x85bc('0x1f')]+_0x216c68[_0x85bc('0x1d')];var _0x318649;if(_0x5dbc76>=_0x425d71){_0x5dbc76=_0x425d71;_0x318649=0xc8;}else{_0x318649=0xce;}_0x522d59['status'](_0x318649);return _0x522d59[_0x85bc('0x20')](_0x85bc('0x21'),_0x1dab01+'-'+_0x5dbc76+'/'+_0x425d71)[_0x85bc('0x1b')](_0x41775e);}return null;};}function patchUpdates(_0x5aa137){return function(_0x320960){try{jsonpatch['apply'](_0x320960,_0x5aa137,!![]);}catch(_0x36d74b){return BPromise[_0x85bc('0x22')](_0x36d74b);}return _0x320960['save']();};}function saveUpdates(_0x21524d,_0x25b8d3){return function(_0x4fe1f2){if(_0x4fe1f2){return _0x4fe1f2[_0x85bc('0x23')](_0x21524d)['then'](function(_0x215f44){return _0x215f44;});}return null;};}function removeEntity(_0xb9ac81,_0x1dfe6f){return function(_0x1c4894){if(_0x1c4894){return _0x1c4894['destroy']()[_0x85bc('0x24')](function(){_0xb9ac81[_0x85bc('0x1a')](0xcc)[_0x85bc('0x25')]();});}};}function handleEntityNotFound(_0x2cb254,_0x24ca9b){return function(_0x26db38){if(!_0x26db38){_0x2cb254[_0x85bc('0x19')](0x194);}return _0x26db38;};}function handleError(_0x3fa065,_0x510281){_0x510281=_0x510281||0x1f4;return function(_0x112946){logger[_0x85bc('0x26')](_0x112946[_0x85bc('0x27')]);if(_0x112946['name']){delete _0x112946[_0x85bc('0x28')];}_0x3fa065['status'](_0x510281)[_0x85bc('0x29')](_0x112946);};}exports[_0x85bc('0x2a')]=function(_0x5bc74c,_0x257a7b){var _0x1c58de={},_0x5b55e3={},_0x977582={'count':0x0,'rows':[]};var _0x3bb8fd=_['map'](db[_0x85bc('0x2b')]['rawAttributes'],function(_0x5bfedb){return{'name':_0x5bfedb[_0x85bc('0x2c')],'type':_0x5bfedb['type'][_0x85bc('0x2d')]};});_0x5b55e3[_0x85bc('0x2e')]=_[_0x85bc('0x2f')](_0x3bb8fd,_0x85bc('0x28'));_0x5b55e3[_0x85bc('0x30')]=_[_0x85bc('0x31')](_0x5bc74c[_0x85bc('0x30')]);_0x5b55e3[_0x85bc('0x32')]=_[_0x85bc('0x33')](_0x5b55e3[_0x85bc('0x2e')],_0x5b55e3['query']);_0x1c58de[_0x85bc('0x34')]=_['intersection'](_0x5b55e3[_0x85bc('0x2e')],qs[_0x85bc('0x35')](_0x5bc74c[_0x85bc('0x30')]['fields']));_0x1c58de[_0x85bc('0x34')]=_0x1c58de['attributes'][_0x85bc('0x36')]?_0x1c58de[_0x85bc('0x34')]:_0x5b55e3[_0x85bc('0x2e')];if(!_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x37')]('nolimit')){_0x1c58de[_0x85bc('0x1d')]=qs['limit'](_0x5bc74c['query'][_0x85bc('0x1d')]);_0x1c58de[_0x85bc('0x1f')]=qs['offset'](_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x1f')]);}_0x1c58de[_0x85bc('0x38')]=qs[_0x85bc('0x39')](_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x39')]);_0x1c58de['where']=qs[_0x85bc('0x32')](_['pick'](_0x5bc74c[_0x85bc('0x30')],_0x5b55e3['filters']),_0x3bb8fd);if(_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x3a')]){_0x1c58de[_0x85bc('0x3b')]=_[_0x85bc('0x3c')](_0x1c58de[_0x85bc('0x3b')],{'$or':_[_0x85bc('0x2f')](_0x3bb8fd,function(_0x16a7d8){if(_0x16a7d8[_0x85bc('0x3d')]!==_0x85bc('0x3e')){var _0x276c60={};_0x276c60[_0x16a7d8[_0x85bc('0x28')]]={'$like':'%'+_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x3a')]+'%'};return _0x276c60;}})});}_0x1c58de=_[_0x85bc('0x3c')]({},_0x1c58de,_0x5bc74c[_0x85bc('0x3f')]);var _0x25bfd1={'where':_0x1c58de[_0x85bc('0x3b')]};return db[_0x85bc('0x2b')][_0x85bc('0x1e')](_0x25bfd1)[_0x85bc('0x24')](function(_0x1a3167){_0x977582[_0x85bc('0x1e')]=_0x1a3167;if(_0x5bc74c[_0x85bc('0x30')][_0x85bc('0x40')]){_0x1c58de[_0x85bc('0x41')]=[{'all':!![]}];}return db[_0x85bc('0x2b')]['findAll'](_0x1c58de);})[_0x85bc('0x24')](function(_0x2a4ed0){_0x977582[_0x85bc('0x42')]=_0x2a4ed0;return _0x977582;})['then'](respondWithFilteredResult(_0x257a7b,_0x1c58de))[_0x85bc('0x43')](handleError(_0x257a7b,null));};exports[_0x85bc('0x44')]=function(_0x5ac838,_0x2f6c42){var _0x9cde31={'raw':!![],'where':{'id':_0x5ac838[_0x85bc('0x45')]['id']}},_0x598743={};_0x598743['model']=_[_0x85bc('0x31')](db['SugarcrmField'][_0x85bc('0x46')]);_0x598743[_0x85bc('0x30')]=_[_0x85bc('0x31')](_0x5ac838[_0x85bc('0x30')]);_0x598743[_0x85bc('0x32')]=_['intersection'](_0x598743[_0x85bc('0x2e')],_0x598743[_0x85bc('0x30')]);_0x9cde31[_0x85bc('0x34')]=_[_0x85bc('0x33')](_0x598743[_0x85bc('0x2e')],qs[_0x85bc('0x35')](_0x5ac838[_0x85bc('0x30')][_0x85bc('0x35')]));_0x9cde31['attributes']=_0x9cde31[_0x85bc('0x34')][_0x85bc('0x36')]?_0x9cde31['attributes']:_0x598743['model'];if(_0x5ac838[_0x85bc('0x30')][_0x85bc('0x40')]){_0x9cde31[_0x85bc('0x41')]=[{'all':!![]}];}_0x9cde31=_['merge']({},_0x9cde31,_0x5ac838[_0x85bc('0x3f')]);return db[_0x85bc('0x2b')][_0x85bc('0x47')](_0x9cde31)[_0x85bc('0x24')](handleEntityNotFound(_0x2f6c42,null))[_0x85bc('0x24')](respondWithResult(_0x2f6c42,null))[_0x85bc('0x43')](handleError(_0x2f6c42,null));};exports['create']=function(_0xd0765,_0x3bbfea){return db[_0x85bc('0x2b')][_0x85bc('0x48')](_0xd0765[_0x85bc('0x49')],{})[_0x85bc('0x24')](respondWithResult(_0x3bbfea,0xc9))[_0x85bc('0x43')](handleError(_0x3bbfea,null));};exports[_0x85bc('0x23')]=function(_0x601adc,_0x509f25){if(_0x601adc['body']['id']){delete _0x601adc[_0x85bc('0x49')]['id'];}return db[_0x85bc('0x2b')]['find']({'where':{'id':_0x601adc['params']['id']}})[_0x85bc('0x24')](handleEntityNotFound(_0x509f25,null))[_0x85bc('0x24')](saveUpdates(_0x601adc['body'],null))['then'](respondWithResult(_0x509f25,null))[_0x85bc('0x43')](handleError(_0x509f25,null));};exports[_0x85bc('0x4a')]=function(_0x146a94,_0x206136){return db['SugarcrmField'][_0x85bc('0x47')]({'where':{'id':_0x146a94[_0x85bc('0x45')]['id']}})[_0x85bc('0x24')](handleEntityNotFound(_0x206136,null))[_0x85bc('0x24')](removeEntity(_0x206136,null))[_0x85bc('0x43')](handleError(_0x206136,null));}; \ No newline at end of file +var _0x778b=['pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','options','find','create','body','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x778b,0xa2));var _0xb778=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x778b[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xb778('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb778('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb778('0x2'));var moment=require('moment');var BPromise=require(_0xb778('0x3'));var Mustache=require(_0xb778('0x4'));var util=require(_0xb778('0x5'));var path=require(_0xb778('0x6'));var sox=require(_0xb778('0x7'));var csv=require(_0xb778('0x8'));var ejs=require(_0xb778('0x9'));var fs=require('fs');var fs_extra=require(_0xb778('0xa'));var _=require(_0xb778('0xb'));var squel=require(_0xb778('0xc'));var crypto=require('crypto');var jsforce=require(_0xb778('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb778('0xe'));var Redis=require(_0xb778('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb778('0x10'));var hardwareService=require(_0xb778('0x11'));var logger=require(_0xb778('0x12'))(_0xb778('0x13'));var utils=require(_0xb778('0x14'));var config=require(_0xb778('0x15'));var licenseUtil=require(_0xb778('0x16'));var db=require(_0xb778('0x17'))['db'];function respondWithStatusCode(_0x4ca66d,_0x48fe92){_0x48fe92=_0x48fe92||0xcc;return function(_0x1e7621){if(_0x1e7621){return _0x4ca66d[_0xb778('0x18')](_0x48fe92);}return _0x4ca66d[_0xb778('0x19')](_0x48fe92)[_0xb778('0x1a')]();};}function respondWithResult(_0x5435b0,_0x301d80){_0x301d80=_0x301d80||0xc8;return function(_0x276f86){if(_0x276f86){return _0x5435b0['status'](_0x301d80)[_0xb778('0x1b')](_0x276f86);}};}function respondWithFilteredResult(_0xf3258f,_0xdef2f6){return function(_0x4d4139){if(_0x4d4139){var _0xf799b9=typeof _0xdef2f6[_0xb778('0x1c')]===_0xb778('0x1d')&&typeof _0xdef2f6[_0xb778('0x1e')]===_0xb778('0x1d');var _0x25dcfc=_0x4d4139[_0xb778('0x1f')];var _0x25d56f=_0xf799b9?0x0:_0xdef2f6[_0xb778('0x1c')];var _0x54af03=_0xf799b9?_0x4d4139[_0xb778('0x1f')]:_0xdef2f6[_0xb778('0x1c')]+_0xdef2f6[_0xb778('0x1e')];var _0x2e0cf8;if(_0x54af03>=_0x25dcfc){_0x54af03=_0x25dcfc;_0x2e0cf8=0xc8;}else{_0x2e0cf8=0xce;}_0xf3258f[_0xb778('0x19')](_0x2e0cf8);return _0xf3258f[_0xb778('0x20')](_0xb778('0x21'),_0x25d56f+'-'+_0x54af03+'/'+_0x25dcfc)[_0xb778('0x1b')](_0x4d4139);}return null;};}function patchUpdates(_0x3aa490){return function(_0x3ed435){try{jsonpatch[_0xb778('0x22')](_0x3ed435,_0x3aa490,!![]);}catch(_0x4c28ff){return BPromise[_0xb778('0x23')](_0x4c28ff);}return _0x3ed435['save']();};}function saveUpdates(_0x32c837,_0x3e3585){return function(_0x1ea137){if(_0x1ea137){return _0x1ea137[_0xb778('0x24')](_0x32c837)[_0xb778('0x25')](function(_0x57960d){return _0x57960d;});}return null;};}function removeEntity(_0x2dedd0,_0x5e83ca){return function(_0x168bc9){if(_0x168bc9){return _0x168bc9[_0xb778('0x26')]()[_0xb778('0x25')](function(){_0x2dedd0[_0xb778('0x19')](0xcc)[_0xb778('0x1a')]();});}};}function handleEntityNotFound(_0x2cd763,_0x43b324){return function(_0x3a85d4){if(!_0x3a85d4){_0x2cd763[_0xb778('0x18')](0x194);}return _0x3a85d4;};}function handleError(_0x57a60e,_0x4a306a){_0x4a306a=_0x4a306a||0x1f4;return function(_0x393983){logger[_0xb778('0x27')](_0x393983[_0xb778('0x28')]);if(_0x393983[_0xb778('0x29')]){delete _0x393983[_0xb778('0x29')];}_0x57a60e[_0xb778('0x19')](_0x4a306a)['send'](_0x393983);};}exports[_0xb778('0x2a')]=function(_0x37614f,_0x5a54fe){var _0x5c3e7d={},_0x1b4581={},_0x4ac6d5={'count':0x0,'rows':[]};var _0x188b1f=_[_0xb778('0x2b')](db[_0xb778('0x2c')][_0xb778('0x2d')],function(_0x47054c){return{'name':_0x47054c[_0xb778('0x2e')],'type':_0x47054c[_0xb778('0x2f')][_0xb778('0x30')]};});_0x1b4581['model']=_[_0xb778('0x2b')](_0x188b1f,_0xb778('0x29'));_0x1b4581[_0xb778('0x31')]=_[_0xb778('0x32')](_0x37614f[_0xb778('0x31')]);_0x1b4581[_0xb778('0x33')]=_[_0xb778('0x34')](_0x1b4581[_0xb778('0x35')],_0x1b4581[_0xb778('0x31')]);_0x5c3e7d[_0xb778('0x36')]=_['intersection'](_0x1b4581[_0xb778('0x35')],qs['fields'](_0x37614f[_0xb778('0x31')][_0xb778('0x37')]));_0x5c3e7d[_0xb778('0x36')]=_0x5c3e7d[_0xb778('0x36')][_0xb778('0x38')]?_0x5c3e7d[_0xb778('0x36')]:_0x1b4581[_0xb778('0x35')];if(!_0x37614f[_0xb778('0x31')][_0xb778('0x39')]('nolimit')){_0x5c3e7d[_0xb778('0x1e')]=qs['limit'](_0x37614f['query'][_0xb778('0x1e')]);_0x5c3e7d[_0xb778('0x1c')]=qs[_0xb778('0x1c')](_0x37614f[_0xb778('0x31')][_0xb778('0x1c')]);}_0x5c3e7d['order']=qs[_0xb778('0x3a')](_0x37614f[_0xb778('0x31')][_0xb778('0x3a')]);_0x5c3e7d[_0xb778('0x3b')]=qs['filters'](_[_0xb778('0x3c')](_0x37614f[_0xb778('0x31')],_0x1b4581[_0xb778('0x33')]),_0x188b1f);if(_0x37614f[_0xb778('0x31')][_0xb778('0x3d')]){_0x5c3e7d[_0xb778('0x3b')]=_['merge'](_0x5c3e7d[_0xb778('0x3b')],{'$or':_[_0xb778('0x2b')](_0x188b1f,function(_0xdf851c){if(_0xdf851c['type']!==_0xb778('0x3e')){var _0x1181a9={};_0x1181a9[_0xdf851c['name']]={'$like':'%'+_0x37614f['query']['filter']+'%'};return _0x1181a9;}})});}_0x5c3e7d=_[_0xb778('0x3f')]({},_0x5c3e7d,_0x37614f['options']);var _0x57bff3={'where':_0x5c3e7d[_0xb778('0x3b')]};return db[_0xb778('0x2c')]['count'](_0x57bff3)[_0xb778('0x25')](function(_0x21292e){_0x4ac6d5[_0xb778('0x1f')]=_0x21292e;if(_0x37614f[_0xb778('0x31')][_0xb778('0x40')]){_0x5c3e7d[_0xb778('0x41')]=[{'all':!![]}];}return db['SugarcrmField'][_0xb778('0x42')](_0x5c3e7d);})[_0xb778('0x25')](function(_0x583216){_0x4ac6d5[_0xb778('0x43')]=_0x583216;return _0x4ac6d5;})[_0xb778('0x25')](respondWithFilteredResult(_0x5a54fe,_0x5c3e7d))[_0xb778('0x44')](handleError(_0x5a54fe,null));};exports['show']=function(_0x5e8ff9,_0x392237){var _0x2fc856={'raw':!![],'where':{'id':_0x5e8ff9['params']['id']}},_0x2d39de={};_0x2d39de[_0xb778('0x35')]=_[_0xb778('0x32')](db['SugarcrmField'][_0xb778('0x2d')]);_0x2d39de[_0xb778('0x31')]=_['keys'](_0x5e8ff9[_0xb778('0x31')]);_0x2d39de['filters']=_[_0xb778('0x34')](_0x2d39de[_0xb778('0x35')],_0x2d39de[_0xb778('0x31')]);_0x2fc856['attributes']=_[_0xb778('0x34')](_0x2d39de[_0xb778('0x35')],qs[_0xb778('0x37')](_0x5e8ff9[_0xb778('0x31')][_0xb778('0x37')]));_0x2fc856[_0xb778('0x36')]=_0x2fc856[_0xb778('0x36')][_0xb778('0x38')]?_0x2fc856[_0xb778('0x36')]:_0x2d39de['model'];if(_0x5e8ff9[_0xb778('0x31')]['includeAll']){_0x2fc856[_0xb778('0x41')]=[{'all':!![]}];}_0x2fc856=_[_0xb778('0x3f')]({},_0x2fc856,_0x5e8ff9[_0xb778('0x45')]);return db[_0xb778('0x2c')][_0xb778('0x46')](_0x2fc856)['then'](handleEntityNotFound(_0x392237,null))[_0xb778('0x25')](respondWithResult(_0x392237,null))[_0xb778('0x44')](handleError(_0x392237,null));};exports[_0xb778('0x47')]=function(_0x1bd918,_0x1e8244){return db[_0xb778('0x2c')][_0xb778('0x47')](_0x1bd918[_0xb778('0x48')],{})['then'](respondWithResult(_0x1e8244,0xc9))[_0xb778('0x44')](handleError(_0x1e8244,null));};exports[_0xb778('0x24')]=function(_0x58e15a,_0x22ea95){if(_0x58e15a[_0xb778('0x48')]['id']){delete _0x58e15a['body']['id'];}return db[_0xb778('0x2c')][_0xb778('0x46')]({'where':{'id':_0x58e15a[_0xb778('0x49')]['id']}})['then'](handleEntityNotFound(_0x22ea95,null))[_0xb778('0x25')](saveUpdates(_0x58e15a[_0xb778('0x48')],null))[_0xb778('0x25')](respondWithResult(_0x22ea95,null))[_0xb778('0x44')](handleError(_0x22ea95,null));};exports[_0xb778('0x26')]=function(_0x21d94b,_0x22115e){return db[_0xb778('0x2c')][_0xb778('0x46')]({'where':{'id':_0x21d94b[_0xb778('0x49')]['id']}})[_0xb778('0x25')](handleEntityNotFound(_0x22115e,null))[_0xb778('0x25')](removeEntity(_0x22115e,null))['catch'](handleError(_0x22115e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 41d55b4..fec762c 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 _0x2b12=['api','request-promise','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger'];(function(_0x26c4cc,_0x336db6){var _0xd7be80=function(_0x137595){while(--_0x137595){_0x26c4cc['push'](_0x26c4cc['shift']());}};_0xd7be80(++_0x336db6);}(_0x2b12,0xd9));var _0x22b1=function(_0x2c463f,_0x2383c8){_0x2c463f=_0x2c463f-0x0;var _0x2988d4=_0x2b12[_0x2c463f];return _0x2988d4;};'use strict';var _=require(_0x22b1('0x0'));var util=require(_0x22b1('0x1'));var logger=require(_0x22b1('0x2'))(_0x22b1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x22b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x22b1('0x5')]=function(_0x26da4b,_0x1bc06d){return _0x26da4b[_0x22b1('0x6')](_0x22b1('0x7'),attributes,{'tableName':_0x22b1('0x8'),'paranoid':![],'indexes':[{'name':_0x22b1('0x9'),'fields':[_0x22b1('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2812=['bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','exports','define','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x2812,0x10c));var _0x2281=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x2812[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x2281('0x0'));var util=require(_0x2281('0x1'));var logger=require(_0x2281('0x2'))(_0x2281('0x3'));var moment=require(_0x2281('0x4'));var BPromise=require(_0x2281('0x5'));var rp=require(_0x2281('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2281('0x7'));var attributes=require(_0x2281('0x8'));module[_0x2281('0x9')]=function(_0x1e4c13,_0x3aa04d){return _0x1e4c13[_0x2281('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x2281('0xb'),_0x2281('0xc')],'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 fd520a1..20e6fb1 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 _0xc4c1=['SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc4c1,0x1eb));var _0x1c4c=function(_0x51e4d7,_0xa1584c){_0x51e4d7=_0x51e4d7-0x0;var _0x9e4467=_0xc4c1[_0x51e4d7];return _0x9e4467;};'use strict';var _=require(_0x1c4c('0x0'));var util=require(_0x1c4c('0x1'));var moment=require(_0x1c4c('0x2'));var BPromise=require(_0x1c4c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c4c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c4c('0x5'));var logger=require(_0x1c4c('0x6'))(_0x1c4c('0x7'));var config=require('../../config/environment');var jayson=require(_0x1c4c('0x8'));var client=jayson[_0x1c4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c97d9,_0x7e7bb5,_0x25607d){return new BPromise(function(_0x412592,_0x5430b2){return client[_0x1c4c('0xa')](_0x5c97d9,_0x25607d)[_0x1c4c('0xb')](function(_0x6df3f8){logger[_0x1c4c('0xc')](_0x1c4c('0xd'),_0x7e7bb5,'request\x20sent');logger[_0x1c4c('0xe')](_0x1c4c('0xf'),_0x7e7bb5,'request\x20sent',JSON[_0x1c4c('0x10')](_0x6df3f8));if(_0x6df3f8[_0x1c4c('0x11')]){if(_0x6df3f8['error']['code']===0x1f4){logger[_0x1c4c('0x11')](_0x1c4c('0xd'),_0x7e7bb5,_0x6df3f8[_0x1c4c('0x11')][_0x1c4c('0x12')]);return _0x5430b2(_0x6df3f8[_0x1c4c('0x11')][_0x1c4c('0x12')]);}logger['error'](_0x1c4c('0xd'),_0x7e7bb5,_0x6df3f8['error'][_0x1c4c('0x12')]);return _0x412592(_0x6df3f8[_0x1c4c('0x11')]['message']);}else{logger['info'](_0x1c4c('0xd'),_0x7e7bb5,_0x1c4c('0x13'));_0x412592(_0x6df3f8['result']['message']);}})[_0x1c4c('0x14')](function(_0x1dd9ee){logger[_0x1c4c('0x11')](_0x1c4c('0xd'),_0x7e7bb5,_0x1dd9ee);_0x5430b2(_0x1dd9ee);});});} \ No newline at end of file +var _0x3359=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x176610,_0x41e9d7){var _0x432a10=function(_0x4ec6ae){while(--_0x4ec6ae){_0x176610['push'](_0x176610['shift']());}};_0x432a10(++_0x41e9d7);}(_0x3359,0xdf));var _0x9335=function(_0x20a354,_0x1b7a3f){_0x20a354=_0x20a354-0x0;var _0x588c73=_0x3359[_0x20a354];return _0x588c73;};'use strict';var _=require(_0x9335('0x0'));var util=require(_0x9335('0x1'));var moment=require('moment');var BPromise=require(_0x9335('0x2'));var rs=require(_0x9335('0x3'));var fs=require('fs');var Redis=require(_0x9335('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9335('0x5'));var logger=require(_0x9335('0x6'))('rpc');var config=require(_0x9335('0x7'));var jayson=require(_0x9335('0x8'));var client=jayson[_0x9335('0x9')][_0x9335('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e2fb1,_0x5e367b,_0x3b4555){return new BPromise(function(_0x288534,_0x5f20f0){return client['request'](_0x5e2fb1,_0x3b4555)[_0x9335('0xb')](function(_0x46e323){logger[_0x9335('0xc')](_0x9335('0xd'),_0x5e367b,_0x9335('0xe'));logger[_0x9335('0xf')](_0x9335('0x10'),_0x5e367b,'request\x20sent',JSON['stringify'](_0x46e323));if(_0x46e323[_0x9335('0x11')]){if(_0x46e323[_0x9335('0x11')][_0x9335('0x12')]===0x1f4){logger[_0x9335('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5e367b,_0x46e323[_0x9335('0x11')][_0x9335('0x13')]);return _0x5f20f0(_0x46e323[_0x9335('0x11')][_0x9335('0x13')]);}logger[_0x9335('0x11')](_0x9335('0xd'),_0x5e367b,_0x46e323[_0x9335('0x11')][_0x9335('0x13')]);return _0x288534(_0x46e323[_0x9335('0x11')][_0x9335('0x13')]);}else{logger[_0x9335('0xc')](_0x9335('0xd'),_0x5e367b,'request\x20sent');_0x288534(_0x46e323[_0x9335('0x14')]['message']);}})[_0x9335('0x15')](function(_0x2ab6b6){logger['error'](_0x9335('0xd'),_0x5e367b,_0x2ab6b6);_0x5f20f0(_0x2ab6b6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 73374fb..ad7ddc3 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 _0x567c=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x12849b,_0x686435){var _0x16f709=function(_0x865a17){while(--_0x865a17){_0x12849b['push'](_0x12849b['shift']());}};_0x16f709(++_0x686435);}(_0x567c,0x8d));var _0xc567=function(_0x24eb5a,_0x371fdf){_0x24eb5a=_0x24eb5a-0x0;var _0x5d3141=_0x567c[_0x24eb5a];return _0x5d3141;};'use strict';var multer=require(_0xc567('0x0'));var util=require(_0xc567('0x1'));var path=require(_0xc567('0x2'));var timeout=require(_0xc567('0x3'));var express=require(_0xc567('0x4'));var router=express[_0xc567('0x5')]();var fs_extra=require(_0xc567('0x6'));var auth=require(_0xc567('0x7'));var interaction=require(_0xc567('0x8'));var config=require(_0xc567('0x9'));var controller=require(_0xc567('0xa'));router[_0xc567('0xb')]('/',auth[_0xc567('0xc')](),controller[_0xc567('0xd')]);router[_0xc567('0xb')](_0xc567('0xe'),auth[_0xc567('0xc')](),controller[_0xc567('0xf')]);router[_0xc567('0xb')](_0xc567('0x10'),auth[_0xc567('0xc')](),controller[_0xc567('0x11')]);router['get'](_0xc567('0x12'),auth['isAuthenticated'](),controller[_0xc567('0x13')]);router[_0xc567('0x14')]('/',auth[_0xc567('0xc')](),controller['create']);router[_0xc567('0x14')]('/:id/configurations',auth[_0xc567('0xc')](),controller[_0xc567('0x15')]);router[_0xc567('0x16')](_0xc567('0xe'),auth['isAuthenticated'](),controller[_0xc567('0x17')]);router[_0xc567('0x18')](_0xc567('0xe'),auth['isAuthenticated'](),controller[_0xc567('0x19')]);module[_0xc567('0x1a')]=router; \ No newline at end of file +var _0xcb06=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','destroy','exports','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xcb06,0x127));var _0x6cb0=function(_0x19c64f,_0x2ae7d2){_0x19c64f=_0x19c64f-0x0;var _0x47bac7=_0xcb06[_0x19c64f];return _0x47bac7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6cb0('0x0'));var express=require('express');var router=express[_0x6cb0('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6cb0('0x3'));var controller=require('./intVtigerAccount.controller');router[_0x6cb0('0x4')]('/',auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x6')]);router[_0x6cb0('0x4')](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x8')]);router['get'](_0x6cb0('0x9'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xa')]);router[_0x6cb0('0x4')](_0x6cb0('0xb'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xc')]);router[_0x6cb0('0xd')]('/',auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xe')]);router[_0x6cb0('0xd')](_0x6cb0('0x9'),auth[_0x6cb0('0x5')](),controller['addConfiguration']);router[_0x6cb0('0xf')](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x10')]);router['delete'](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x11')]);module[_0x6cb0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 132beb2..e42068e 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 _0x04e4=['sequelize','STRING','HelpDesk'];(function(_0x5a4088,_0x42c282){var _0x19baac=function(_0x5f37e7){while(--_0x5f37e7){_0x5a4088['push'](_0x5a4088['shift']());}};_0x19baac(++_0x42c282);}(_0x04e4,0xed));var _0x404e=function(_0x4a2f27,_0x5e29cc){_0x4a2f27=_0x4a2f27-0x0;var _0x51a04b=_0x04e4[_0x4a2f27];return _0x51a04b;};'use strict';var Sequelize=require(_0x404e('0x0'));module['exports']={'name':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x404e('0x1')]},'username':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x404e('0x1')],'allowNull':![],'defaultValue':_0x404e('0x2')},'remoteUri':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x231c=['exports','STRING','HelpDesk','sequelize'];(function(_0x509507,_0x366e47){var _0x3110d8=function(_0x4a7eb4){while(--_0x4a7eb4){_0x509507['push'](_0x509507['shift']());}};_0x3110d8(++_0x366e47);}(_0x231c,0x1cf));var _0xc231=function(_0x4bd975,_0x3a2e35){_0x4bd975=_0x4bd975-0x0;var _0x5470bc=_0x231c[_0x4bd975];return _0x5470bc;};'use strict';var Sequelize=require(_0xc231('0x0'));module[_0xc231('0x1')]={'name':{'type':Sequelize[_0xc231('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc231('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc231('0x3')},'remoteUri':{'type':Sequelize[_0xc231('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc231('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc231('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 26f1ba0..d484955 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 _0x032f=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','VtigerAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','create','VtigerField','md5','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','format','%s/webservice.php','getchallenge','success','POST','login','result','token','sessionName','autogenerated','owner','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x032f,0x7b));var _0xf032=function(_0x971aaa,_0x5b02c0){_0x971aaa=_0x971aaa-0x0;var _0x2a0776=_0x032f[_0x971aaa];return _0x2a0776;};'use strict';var emlformat=require(_0xf032('0x0'));var rimraf=require(_0xf032('0x1'));var zipdir=require(_0xf032('0x2'));var jsonpatch=require(_0xf032('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf032('0x4'));var util=require(_0xf032('0x5'));var path=require(_0xf032('0x6'));var sox=require(_0xf032('0x7'));var csv=require(_0xf032('0x8'));var ejs=require(_0xf032('0x9'));var fs=require('fs');var fs_extra=require(_0xf032('0xa'));var _=require(_0xf032('0xb'));var squel=require(_0xf032('0xc'));var crypto=require(_0xf032('0xd'));var jsforce=require(_0xf032('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf032('0x8'));var querystring=require(_0xf032('0xf'));var Papa=require(_0xf032('0x10'));var Redis=require(_0xf032('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf032('0x12'));var as=require(_0xf032('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf032('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf032('0x15'))['db'];var integrations=require(_0xf032('0x16'));function respondWithStatusCode(_0x25ae7e,_0x21ea31){_0x21ea31=_0x21ea31||0xcc;return function(_0x21d32d){if(_0x21d32d){return _0x25ae7e['sendStatus'](_0x21ea31);}return _0x25ae7e['status'](_0x21ea31)[_0xf032('0x17')]();};}function respondWithResult(_0x3231d0,_0x17c4ab){_0x17c4ab=_0x17c4ab||0xc8;return function(_0x271b20){if(_0x271b20){return _0x3231d0['status'](_0x17c4ab)[_0xf032('0x18')](_0x271b20);}};}function respondWithFilteredResult(_0x3ce02f,_0x3eab9d){return function(_0x20ec95){if(_0x20ec95){var _0x3d896b=typeof _0x3eab9d[_0xf032('0x19')]===_0xf032('0x1a')&&typeof _0x3eab9d[_0xf032('0x1b')]===_0xf032('0x1a');var _0x4b1482=_0x20ec95['count'];var _0x17a86f=_0x3d896b?0x0:_0x3eab9d['offset'];var _0x26edfe=_0x3d896b?_0x20ec95[_0xf032('0x1c')]:_0x3eab9d[_0xf032('0x19')]+_0x3eab9d[_0xf032('0x1b')];var _0x3c663f;if(_0x26edfe>=_0x4b1482){_0x26edfe=_0x4b1482;_0x3c663f=0xc8;}else{_0x3c663f=0xce;}_0x3ce02f[_0xf032('0x1d')](_0x3c663f);return _0x3ce02f[_0xf032('0x1e')]('Content-Range',_0x17a86f+'-'+_0x26edfe+'/'+_0x4b1482)[_0xf032('0x18')](_0x20ec95);}return null;};}function patchUpdates(_0x3a7bd1){return function(_0x452a4b){try{jsonpatch[_0xf032('0x1f')](_0x452a4b,_0x3a7bd1,!![]);}catch(_0x4f2f99){return BPromise[_0xf032('0x20')](_0x4f2f99);}return _0x452a4b['save']();};}function saveUpdates(_0xe129d2,_0x2264dc){return function(_0x1e37e5){if(_0x1e37e5){return _0x1e37e5[_0xf032('0x21')](_0xe129d2)[_0xf032('0x22')](function(_0xda000b){return _0xda000b;});}return null;};}function removeEntity(_0x40273a,_0x3fe17f){return function(_0x2e0142){if(_0x2e0142){return _0x2e0142[_0xf032('0x23')]()['then'](function(){_0x40273a['status'](0xcc)[_0xf032('0x17')]();});}};}function handleEntityNotFound(_0xd84588,_0x19ec26){return function(_0x156f9f){if(!_0x156f9f){_0xd84588[_0xf032('0x24')](0x194);}return _0x156f9f;};}function handleError(_0x3905b9,_0x258f1f){_0x258f1f=_0x258f1f||0x1f4;return function(_0x5e3124){logger['error'](_0x5e3124[_0xf032('0x25')]);if(_0x5e3124[_0xf032('0x26')]){delete _0x5e3124['name'];}_0x3905b9[_0xf032('0x1d')](_0x258f1f)[_0xf032('0x27')](_0x5e3124);};}exports[_0xf032('0x28')]=function(_0x513d46,_0x40e7ef){var _0x33281e={},_0x24ff6d={},_0x5c4b5a={'count':0x0,'rows':[]};var _0x1684cd=_[_0xf032('0x29')](db[_0xf032('0x2a')]['rawAttributes'],function(_0x2a1ff3){return{'name':_0x2a1ff3[_0xf032('0x2b')],'type':_0x2a1ff3[_0xf032('0x2c')][_0xf032('0x2d')]};});_0x24ff6d['model']=_['map'](_0x1684cd,_0xf032('0x26'));_0x24ff6d[_0xf032('0x2e')]=_[_0xf032('0x2f')](_0x513d46[_0xf032('0x2e')]);_0x24ff6d[_0xf032('0x30')]=_[_0xf032('0x31')](_0x24ff6d[_0xf032('0x32')],_0x24ff6d[_0xf032('0x2e')]);_0x33281e[_0xf032('0x33')]=_[_0xf032('0x31')](_0x24ff6d['model'],qs[_0xf032('0x34')](_0x513d46[_0xf032('0x2e')][_0xf032('0x34')]));_0x33281e[_0xf032('0x33')]=_0x33281e['attributes'][_0xf032('0x35')]?_0x33281e[_0xf032('0x33')]:_0x24ff6d[_0xf032('0x32')];if(!_0x513d46['query'][_0xf032('0x36')](_0xf032('0x37'))){_0x33281e[_0xf032('0x1b')]=qs['limit'](_0x513d46[_0xf032('0x2e')][_0xf032('0x1b')]);_0x33281e[_0xf032('0x19')]=qs[_0xf032('0x19')](_0x513d46[_0xf032('0x2e')]['offset']);}_0x33281e[_0xf032('0x38')]=qs[_0xf032('0x39')](_0x513d46[_0xf032('0x2e')][_0xf032('0x39')]);_0x33281e[_0xf032('0x3a')]=qs[_0xf032('0x30')](_[_0xf032('0x3b')](_0x513d46[_0xf032('0x2e')],_0x24ff6d[_0xf032('0x30')]),_0x1684cd);if(_0x513d46[_0xf032('0x2e')][_0xf032('0x3c')]){_0x33281e[_0xf032('0x3a')]=_['merge'](_0x33281e['where'],{'$or':_['map'](_0x1684cd,function(_0x39e177){if(_0x39e177['type']!==_0xf032('0x3d')){var _0x35bdff={};_0x35bdff[_0x39e177['name']]={'$like':'%'+_0x513d46[_0xf032('0x2e')][_0xf032('0x3c')]+'%'};return _0x35bdff;}})});}_0x33281e=_[_0xf032('0x3e')]({},_0x33281e,_0x513d46[_0xf032('0x3f')]);var _0x39d484={'where':_0x33281e['where']};return db[_0xf032('0x2a')][_0xf032('0x1c')](_0x39d484)[_0xf032('0x22')](function(_0x1fdcd7){_0x5c4b5a[_0xf032('0x1c')]=_0x1fdcd7;if(_0x513d46['query'][_0xf032('0x40')]){_0x33281e[_0xf032('0x41')]=[{'all':!![]}];}return db[_0xf032('0x2a')][_0xf032('0x42')](_0x33281e);})[_0xf032('0x22')](function(_0x285d45){_0x5c4b5a['rows']=_0x285d45;return _0x5c4b5a;})['then'](respondWithFilteredResult(_0x40e7ef,_0x33281e))[_0xf032('0x43')](handleError(_0x40e7ef,null));};exports[_0xf032('0x44')]=function(_0x5c07d1,_0x250581){var _0x2e5a54={'raw':![],'where':{'id':_0x5c07d1[_0xf032('0x45')]['id']}},_0x166097={};_0x166097[_0xf032('0x32')]=_[_0xf032('0x2f')](db[_0xf032('0x2a')][_0xf032('0x46')]);_0x166097[_0xf032('0x2e')]=_['keys'](_0x5c07d1[_0xf032('0x2e')]);_0x166097[_0xf032('0x30')]=_['intersection'](_0x166097['model'],_0x166097[_0xf032('0x2e')]);_0x2e5a54[_0xf032('0x33')]=_['intersection'](_0x166097['model'],qs['fields'](_0x5c07d1[_0xf032('0x2e')][_0xf032('0x34')]));_0x2e5a54[_0xf032('0x33')]=_0x2e5a54[_0xf032('0x33')][_0xf032('0x35')]?_0x2e5a54['attributes']:_0x166097[_0xf032('0x32')];if(_0x5c07d1[_0xf032('0x2e')][_0xf032('0x40')]){_0x2e5a54[_0xf032('0x41')]=[{'all':!![]}];}_0x2e5a54=_['merge']({},_0x2e5a54,_0x5c07d1[_0xf032('0x3f')]);return db[_0xf032('0x2a')][_0xf032('0x47')](_0x2e5a54)[_0xf032('0x22')](handleEntityNotFound(_0x250581,null))[_0xf032('0x22')](respondWithResult(_0x250581,null))['catch'](handleError(_0x250581,null));};exports['create']=function(_0x552705,_0x39ae4c){return db[_0xf032('0x2a')]['create'](_0x552705[_0xf032('0x48')],{})[_0xf032('0x22')](respondWithResult(_0x39ae4c,0xc9))[_0xf032('0x43')](handleError(_0x39ae4c,null));};exports[_0xf032('0x21')]=function(_0x5501b6,_0x145429){if(_0x5501b6['body']['id']){delete _0x5501b6['body']['id'];}return db[_0xf032('0x2a')][_0xf032('0x47')]({'where':{'id':_0x5501b6[_0xf032('0x45')]['id']}})[_0xf032('0x22')](handleEntityNotFound(_0x145429,null))[_0xf032('0x22')](saveUpdates(_0x5501b6[_0xf032('0x48')],null))[_0xf032('0x22')](respondWithResult(_0x145429,null))[_0xf032('0x43')](handleError(_0x145429,null));};exports[_0xf032('0x23')]=function(_0x1dcf39,_0x91de0e){return db['VtigerAccount'][_0xf032('0x47')]({'where':{'id':_0x1dcf39[_0xf032('0x45')]['id']}})['then'](handleEntityNotFound(_0x91de0e,null))[_0xf032('0x22')](removeEntity(_0x91de0e,null))['catch'](handleError(_0x91de0e,null));};exports[_0xf032('0x49')]=function(_0x4fd33e,_0x20a4e4,_0x5bbb5f){var _0xc8df79={};var _0x47da60={};var _0x1a2c84;var _0xa716c9;return db[_0xf032('0x2a')][_0xf032('0x4a')]({'where':{'id':_0x4fd33e['params']['id']}})[_0xf032('0x22')](handleEntityNotFound(_0x20a4e4,null))[_0xf032('0x22')](function(_0x5a8bdd){if(_0x5a8bdd){_0x1a2c84=_0x5a8bdd;_0x47da60['model']=_[_0xf032('0x2f')](db['VtigerConfiguration'][_0xf032('0x46')]);_0x47da60['query']=_[_0xf032('0x2f')](_0x4fd33e[_0xf032('0x2e')]);_0x47da60[_0xf032('0x30')]=_['intersection'](_0x47da60[_0xf032('0x32')],_0x47da60['query']);_0xc8df79[_0xf032('0x33')]=_['intersection'](_0x47da60[_0xf032('0x32')],qs['fields'](_0x4fd33e[_0xf032('0x2e')][_0xf032('0x34')]));_0xc8df79[_0xf032('0x33')]=_0xc8df79[_0xf032('0x33')][_0xf032('0x35')]?_0xc8df79[_0xf032('0x33')]:_0x47da60[_0xf032('0x32')];_0xc8df79[_0xf032('0x38')]=qs[_0xf032('0x39')](_0x4fd33e[_0xf032('0x2e')][_0xf032('0x39')]);_0xc8df79['where']=qs[_0xf032('0x30')](_[_0xf032('0x3b')](_0x4fd33e['query'],_0x47da60[_0xf032('0x30')]));if(_0x4fd33e[_0xf032('0x2e')][_0xf032('0x3c')]){_0xc8df79[_0xf032('0x3a')]=_[_0xf032('0x3e')](_0xc8df79[_0xf032('0x3a')],{'$or':_[_0xf032('0x29')](_0xc8df79['attributes'],function(_0xeda642){var _0x17a8dc={};_0x17a8dc[_0xeda642]={'$like':'%'+_0x4fd33e[_0xf032('0x2e')]['filter']+'%'};return _0x17a8dc;})});}_0xc8df79=_[_0xf032('0x3e')]({},_0xc8df79,_0x4fd33e[_0xf032('0x3f')]);return _0x1a2c84[_0xf032('0x49')](_0xc8df79);}})[_0xf032('0x22')](function(_0x14f7d1){if(_0x14f7d1){_0xa716c9=_0x14f7d1['length'];if(!_0x4fd33e['query'][_0xf032('0x36')](_0xf032('0x37'))){_0xc8df79['limit']=qs['limit'](_0x4fd33e[_0xf032('0x2e')]['limit']);_0xc8df79['offset']=qs[_0xf032('0x19')](_0x4fd33e['query'][_0xf032('0x19')]);}return _0x1a2c84['getConfigurations'](_0xc8df79);}})[_0xf032('0x22')](function(_0x7ed354){if(_0x7ed354){return _0x7ed354?{'count':_0xa716c9,'rows':_0x7ed354}:null;}})[_0xf032('0x22')](respondWithResult(_0x20a4e4,null))[_0xf032('0x43')](handleError(_0x20a4e4,null));};exports[_0xf032('0x4b')]=function(_0x20f929,_0x9a8d9,_0x131614){if(_0x20f929[_0xf032('0x48')]['id']){delete _0x20f929[_0xf032('0x48')]['id'];}return db[_0xf032('0x2a')]['findOne']({'where':{'id':_0x20f929[_0xf032('0x45')]['id']}})[_0xf032('0x22')](handleEntityNotFound(_0x9a8d9,null))[_0xf032('0x22')](function(_0x2cb47e){if(_0x2cb47e){_0x20f929[_0xf032('0x48')]['AccountId']=_0x2cb47e['id'];_0x20f929[_0xf032('0x48')][_0xf032('0x4c')]=integrations['getSubjects'](_0x20f929[_0xf032('0x48')][_0xf032('0x4d')],_0x20f929[_0xf032('0x48')][_0xf032('0x2c')]);_0x20f929[_0xf032('0x48')][_0xf032('0x4e')]=integrations[_0xf032('0x4f')](_0x20f929[_0xf032('0x48')][_0xf032('0x4d')],_0x20f929[_0xf032('0x48')][_0xf032('0x2c')]);return db[_0xf032('0x50')][_0xf032('0x51')](_0x20f929[_0xf032('0x48')],{'include':[{'model':db[_0xf032('0x52')],'as':_0xf032('0x4c')},{'model':db[_0xf032('0x52')],'as':_0xf032('0x4e')}]});}return null;})['then'](respondWithResult(_0x9a8d9,null))[_0xf032('0x43')](handleError(_0x9a8d9,null));};var md5=require(_0xf032('0x53'));exports['getFields']=function(_0x4a2e3c,_0x3cd73c,_0x107421){var _0x274eb9=null;var _0x1f3195=null;var _0x6f1f94=null;var _0x5d0dff=null;var _0x2e83cc='';return db[_0xf032('0x2a')][_0xf032('0x4a')]({'where':{'id':_0x4a2e3c[_0xf032('0x45')]['id']},'attributes':['id',_0xf032('0x26'),_0xf032('0x54'),_0xf032('0x55'),_0xf032('0x56'),'remoteUri',_0xf032('0x57'),_0xf032('0x58')]})['then'](handleEntityNotFound(_0x3cd73c,null))['then'](function(_0x520e9d){if(_0x520e9d){_0x274eb9=_0x520e9d[_0xf032('0x54')];_0x1f3195=_0x520e9d[_0xf032('0x58')];_0x6f1f94=_0x520e9d[_0xf032('0x56')];_0x2e83cc=_0x520e9d[_0xf032('0x59')];var _0x5e4663=_0x2e83cc[_0xf032('0x5a')](-0x1);if(_0x5e4663==='/'){_0x2e83cc=_0x2e83cc[_0xf032('0x5b')](0x0,_0x2e83cc['lastIndexOf'](_0x5e4663));}_0x5d0dff=util[_0xf032('0x5c')](_0xf032('0x5d'),_0x2e83cc);var _0x5cafde={'method':'GET','uri':_0x5d0dff,'qs':{'operation':_0xf032('0x5e'),'username':_0x520e9d['username']},'json':!![]};return rp(_0x5cafde);}})[_0xf032('0x22')](function(_0x417907){if(_0x417907[_0xf032('0x5f')]){var _0x2bda3f={'method':_0xf032('0x60'),'uri':_0x5d0dff,'form':{'operation':_0xf032('0x61'),'username':_0x274eb9,'accessKey':md5(_0x417907[_0xf032('0x62')][_0xf032('0x63')]+_0x1f3195)},'json':!![]};return rp(_0x2bda3f);}})[_0xf032('0x22')](function(_0x408400){if(_0x408400['success']){var _0x5f2813={'method':'GET','uri':_0x5d0dff,'qs':{'operation':'describe','username':_0x274eb9,'sessionName':_0x408400[_0xf032('0x62')][_0xf032('0x64')],'elementType':_0x6f1f94},'json':!![]};return rp(_0x5f2813);}})[_0xf032('0x22')](function(_0x423076){if(_0x423076['success']){var _0x31be8a=[_0xf032('0x65'),'reference',_0xf032('0x66')];_['remove'](_0x423076[_0xf032('0x62')][_0xf032('0x34')],function(_0x4cfee7){return _0x31be8a[_0xf032('0x67')](_0x4cfee7[_0xf032('0x2c')][_0xf032('0x26')]);});_['remove'](_0x423076['result'][_0xf032('0x34')],function(_0x109fd0){return _0x109fd0[_0xf032('0x68')]===_0xf032('0x69');});return{'count':_0x423076[_0xf032('0x62')]['fields']['length'],'rows':_[_0xf032('0x29')](_0x423076[_0xf032('0x62')][_0xf032('0x34')],function(_0x108010){return{'id':_0x108010[_0xf032('0x26')],'name':_0x108010[_0xf032('0x6a')],'custom':_[_0xf032('0x6b')](_0x108010[_0xf032('0x26')],'cf_')?!![]:![],'options':_0x108010[_0xf032('0x2c')]['name']===_0xf032('0x6c')&&_0x108010[_0xf032('0x2c')][_0xf032('0x6d')]['length']>0x0?_[_0xf032('0x29')](_0x108010[_0xf032('0x2c')][_0xf032('0x6d')],function(_0x19bd0a){return{'name':_0x19bd0a[_0xf032('0x6a')],'value':_0x19bd0a[_0xf032('0x6e')]};}):[]};})};}})[_0xf032('0x22')](respondWithResult(_0x3cd73c,null))[_0xf032('0x43')](function(_0x21de09){console[_0xf032('0x6f')](_0xf032('0x70')+_0x21de09);var _0x238a7f=_0x4a2e3c[_0xf032('0x2e')][_0xf032('0x71')]?0x1f4:_0x21de09[_0xf032('0x72')]||0x1f4;logger['error'](_0xf032('0x73'),'getFields',_0x238a7f,JSON[_0xf032('0x74')](_0x21de09));delete _0x21de09['name'];if(_0x238a7f===0x191){_0x238a7f=0x190;}_0x3cd73c[_0xf032('0x1d')](_0x238a7f)['send'](_0x4a2e3c[_0xf032('0x2e')][_0xf032('0x71')]?{'message':_0xf032('0x75'),'statusCode':_0x21de09[_0xf032('0x72')]}:_0x21de09);});}; \ No newline at end of file +var _0xa6aa=['catch','create','body','getConfigurations','findOne','VtigerConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','GET','getchallenge','success','POST','login','result','token','describe','autogenerated','remove','type','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find'];(function(_0x3a8abd,_0x49f9e5){var _0x36343f=function(_0x109bce){while(--_0x109bce){_0x3a8abd['push'](_0x3a8abd['shift']());}};_0x36343f(++_0x49f9e5);}(_0xa6aa,0x120));var _0xaa6a=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xa6aa[_0x2a56ad];return _0x425175;};'use strict';var emlformat=require(_0xaa6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa6a('0x1'));var jsonpatch=require(_0xaa6a('0x2'));var rp=require(_0xaa6a('0x3'));var moment=require(_0xaa6a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa6a('0x5'));var util=require('util');var path=require(_0xaa6a('0x6'));var sox=require(_0xaa6a('0x7'));var csv=require(_0xaa6a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa6a('0x9'));var _=require(_0xaa6a('0xa'));var squel=require(_0xaa6a('0xb'));var crypto=require('crypto');var jsforce=require(_0xaa6a('0xc'));var deskjs=require(_0xaa6a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaa6a('0xe'));var Papa=require(_0xaa6a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaa6a('0x10'));var as=require(_0xaa6a('0x11'));var hardwareService=require(_0xaa6a('0x12'));var logger=require('../../config/logger')(_0xaa6a('0x13'));var utils=require('../../config/utils');var config=require(_0xaa6a('0x14'));var licenseUtil=require(_0xaa6a('0x15'));var db=require(_0xaa6a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3c9c55,_0x473b33){_0x473b33=_0x473b33||0xcc;return function(_0x3237af){if(_0x3237af){return _0x3c9c55['sendStatus'](_0x473b33);}return _0x3c9c55[_0xaa6a('0x17')](_0x473b33)['end']();};}function respondWithResult(_0x2de1c4,_0x1ec296){_0x1ec296=_0x1ec296||0xc8;return function(_0x148c61){if(_0x148c61){return _0x2de1c4[_0xaa6a('0x17')](_0x1ec296)[_0xaa6a('0x18')](_0x148c61);}};}function respondWithFilteredResult(_0x2b9c3a,_0x46bfe4){return function(_0x39ecba){if(_0x39ecba){var _0x553326=typeof _0x46bfe4[_0xaa6a('0x19')]===_0xaa6a('0x1a')&&typeof _0x46bfe4[_0xaa6a('0x1b')]===_0xaa6a('0x1a');var _0x4bf336=_0x39ecba[_0xaa6a('0x1c')];var _0x148035=_0x553326?0x0:_0x46bfe4[_0xaa6a('0x19')];var _0x5e31f1=_0x553326?_0x39ecba['count']:_0x46bfe4[_0xaa6a('0x19')]+_0x46bfe4[_0xaa6a('0x1b')];var _0x46b948;if(_0x5e31f1>=_0x4bf336){_0x5e31f1=_0x4bf336;_0x46b948=0xc8;}else{_0x46b948=0xce;}_0x2b9c3a['status'](_0x46b948);return _0x2b9c3a[_0xaa6a('0x1d')](_0xaa6a('0x1e'),_0x148035+'-'+_0x5e31f1+'/'+_0x4bf336)[_0xaa6a('0x18')](_0x39ecba);}return null;};}function patchUpdates(_0x3fa47c){return function(_0x4d00ed){try{jsonpatch['apply'](_0x4d00ed,_0x3fa47c,!![]);}catch(_0x11c0de){return BPromise[_0xaa6a('0x1f')](_0x11c0de);}return _0x4d00ed['save']();};}function saveUpdates(_0x30f53a,_0x34bcf5){return function(_0x174826){if(_0x174826){return _0x174826[_0xaa6a('0x20')](_0x30f53a)[_0xaa6a('0x21')](function(_0x498974){return _0x498974;});}return null;};}function removeEntity(_0x32ea37,_0x1ad301){return function(_0x704d8a){if(_0x704d8a){return _0x704d8a[_0xaa6a('0x22')]()['then'](function(){_0x32ea37[_0xaa6a('0x17')](0xcc)[_0xaa6a('0x23')]();});}};}function handleEntityNotFound(_0x1a7342,_0x124c9b){return function(_0x58f58c){if(!_0x58f58c){_0x1a7342[_0xaa6a('0x24')](0x194);}return _0x58f58c;};}function handleError(_0x418979,_0x1b4ed0){_0x1b4ed0=_0x1b4ed0||0x1f4;return function(_0x3d0d2d){logger[_0xaa6a('0x25')](_0x3d0d2d[_0xaa6a('0x26')]);if(_0x3d0d2d[_0xaa6a('0x27')]){delete _0x3d0d2d[_0xaa6a('0x27')];}_0x418979[_0xaa6a('0x17')](_0x1b4ed0)[_0xaa6a('0x28')](_0x3d0d2d);};}exports[_0xaa6a('0x29')]=function(_0x366433,_0x599819){var _0x1cae29={},_0x3dfdcb={},_0x36d6bf={'count':0x0,'rows':[]};var _0x1cdef6=_['map'](db[_0xaa6a('0x2a')][_0xaa6a('0x2b')],function(_0x57b39d){return{'name':_0x57b39d[_0xaa6a('0x2c')],'type':_0x57b39d['type']['key']};});_0x3dfdcb[_0xaa6a('0x2d')]=_[_0xaa6a('0x2e')](_0x1cdef6,_0xaa6a('0x27'));_0x3dfdcb[_0xaa6a('0x2f')]=_['keys'](_0x366433[_0xaa6a('0x2f')]);_0x3dfdcb[_0xaa6a('0x30')]=_[_0xaa6a('0x31')](_0x3dfdcb[_0xaa6a('0x2d')],_0x3dfdcb[_0xaa6a('0x2f')]);_0x1cae29[_0xaa6a('0x32')]=_[_0xaa6a('0x31')](_0x3dfdcb[_0xaa6a('0x2d')],qs[_0xaa6a('0x33')](_0x366433[_0xaa6a('0x2f')][_0xaa6a('0x33')]));_0x1cae29[_0xaa6a('0x32')]=_0x1cae29['attributes'][_0xaa6a('0x34')]?_0x1cae29['attributes']:_0x3dfdcb[_0xaa6a('0x2d')];if(!_0x366433[_0xaa6a('0x2f')][_0xaa6a('0x35')]('nolimit')){_0x1cae29['limit']=qs[_0xaa6a('0x1b')](_0x366433[_0xaa6a('0x2f')][_0xaa6a('0x1b')]);_0x1cae29[_0xaa6a('0x19')]=qs[_0xaa6a('0x19')](_0x366433[_0xaa6a('0x2f')][_0xaa6a('0x19')]);}_0x1cae29['order']=qs[_0xaa6a('0x36')](_0x366433['query'][_0xaa6a('0x36')]);_0x1cae29[_0xaa6a('0x37')]=qs[_0xaa6a('0x30')](_[_0xaa6a('0x38')](_0x366433[_0xaa6a('0x2f')],_0x3dfdcb['filters']),_0x1cdef6);if(_0x366433[_0xaa6a('0x2f')][_0xaa6a('0x39')]){_0x1cae29[_0xaa6a('0x37')]=_[_0xaa6a('0x3a')](_0x1cae29[_0xaa6a('0x37')],{'$or':_[_0xaa6a('0x2e')](_0x1cdef6,function(_0xcdc8a){if(_0xcdc8a['type']!==_0xaa6a('0x3b')){var _0x1ce43d={};_0x1ce43d[_0xcdc8a['name']]={'$like':'%'+_0x366433['query'][_0xaa6a('0x39')]+'%'};return _0x1ce43d;}})});}_0x1cae29=_[_0xaa6a('0x3a')]({},_0x1cae29,_0x366433[_0xaa6a('0x3c')]);var _0x25b25e={'where':_0x1cae29[_0xaa6a('0x37')]};return db[_0xaa6a('0x2a')][_0xaa6a('0x1c')](_0x25b25e)[_0xaa6a('0x21')](function(_0x54f801){_0x36d6bf['count']=_0x54f801;if(_0x366433[_0xaa6a('0x2f')][_0xaa6a('0x3d')]){_0x1cae29[_0xaa6a('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0xaa6a('0x3f')](_0x1cae29);})[_0xaa6a('0x21')](function(_0x284318){_0x36d6bf[_0xaa6a('0x40')]=_0x284318;return _0x36d6bf;})['then'](respondWithFilteredResult(_0x599819,_0x1cae29))['catch'](handleError(_0x599819,null));};exports[_0xaa6a('0x41')]=function(_0xb23e2,_0x18807d){var _0x25dc29={'raw':![],'where':{'id':_0xb23e2[_0xaa6a('0x42')]['id']}},_0x5f1e93={};_0x5f1e93[_0xaa6a('0x2d')]=_['keys'](db[_0xaa6a('0x2a')][_0xaa6a('0x2b')]);_0x5f1e93['query']=_[_0xaa6a('0x43')](_0xb23e2[_0xaa6a('0x2f')]);_0x5f1e93[_0xaa6a('0x30')]=_[_0xaa6a('0x31')](_0x5f1e93[_0xaa6a('0x2d')],_0x5f1e93['query']);_0x25dc29[_0xaa6a('0x32')]=_[_0xaa6a('0x31')](_0x5f1e93[_0xaa6a('0x2d')],qs['fields'](_0xb23e2['query'][_0xaa6a('0x33')]));_0x25dc29[_0xaa6a('0x32')]=_0x25dc29[_0xaa6a('0x32')]['length']?_0x25dc29[_0xaa6a('0x32')]:_0x5f1e93['model'];if(_0xb23e2['query']['includeAll']){_0x25dc29[_0xaa6a('0x3e')]=[{'all':!![]}];}_0x25dc29=_[_0xaa6a('0x3a')]({},_0x25dc29,_0xb23e2[_0xaa6a('0x3c')]);return db[_0xaa6a('0x2a')][_0xaa6a('0x44')](_0x25dc29)[_0xaa6a('0x21')](handleEntityNotFound(_0x18807d,null))['then'](respondWithResult(_0x18807d,null))[_0xaa6a('0x45')](handleError(_0x18807d,null));};exports[_0xaa6a('0x46')]=function(_0x387d37,_0x158334){return db['VtigerAccount'][_0xaa6a('0x46')](_0x387d37['body'],{})[_0xaa6a('0x21')](respondWithResult(_0x158334,0xc9))[_0xaa6a('0x45')](handleError(_0x158334,null));};exports[_0xaa6a('0x20')]=function(_0x3f110c,_0x57adce){if(_0x3f110c[_0xaa6a('0x47')]['id']){delete _0x3f110c['body']['id'];}return db[_0xaa6a('0x2a')][_0xaa6a('0x44')]({'where':{'id':_0x3f110c[_0xaa6a('0x42')]['id']}})[_0xaa6a('0x21')](handleEntityNotFound(_0x57adce,null))[_0xaa6a('0x21')](saveUpdates(_0x3f110c[_0xaa6a('0x47')],null))[_0xaa6a('0x21')](respondWithResult(_0x57adce,null))['catch'](handleError(_0x57adce,null));};exports['destroy']=function(_0xb2bd1a,_0x24f17e){return db[_0xaa6a('0x2a')]['find']({'where':{'id':_0xb2bd1a[_0xaa6a('0x42')]['id']}})['then'](handleEntityNotFound(_0x24f17e,null))['then'](removeEntity(_0x24f17e,null))[_0xaa6a('0x45')](handleError(_0x24f17e,null));};exports[_0xaa6a('0x48')]=function(_0x180006,_0x261f97,_0x2f86d8){var _0x52f961={};var _0x42be5e={};var _0x44a084;var _0x4403ac;return db['VtigerAccount'][_0xaa6a('0x49')]({'where':{'id':_0x180006[_0xaa6a('0x42')]['id']}})[_0xaa6a('0x21')](handleEntityNotFound(_0x261f97,null))[_0xaa6a('0x21')](function(_0x397d9d){if(_0x397d9d){_0x44a084=_0x397d9d;_0x42be5e['model']=_[_0xaa6a('0x43')](db[_0xaa6a('0x4a')][_0xaa6a('0x2b')]);_0x42be5e['query']=_[_0xaa6a('0x43')](_0x180006[_0xaa6a('0x2f')]);_0x42be5e[_0xaa6a('0x30')]=_[_0xaa6a('0x31')](_0x42be5e['model'],_0x42be5e['query']);_0x52f961[_0xaa6a('0x32')]=_[_0xaa6a('0x31')](_0x42be5e[_0xaa6a('0x2d')],qs[_0xaa6a('0x33')](_0x180006['query'][_0xaa6a('0x33')]));_0x52f961[_0xaa6a('0x32')]=_0x52f961[_0xaa6a('0x32')]['length']?_0x52f961['attributes']:_0x42be5e[_0xaa6a('0x2d')];_0x52f961[_0xaa6a('0x4b')]=qs['sort'](_0x180006[_0xaa6a('0x2f')]['sort']);_0x52f961[_0xaa6a('0x37')]=qs[_0xaa6a('0x30')](_[_0xaa6a('0x38')](_0x180006[_0xaa6a('0x2f')],_0x42be5e[_0xaa6a('0x30')]));if(_0x180006[_0xaa6a('0x2f')][_0xaa6a('0x39')]){_0x52f961[_0xaa6a('0x37')]=_[_0xaa6a('0x3a')](_0x52f961['where'],{'$or':_[_0xaa6a('0x2e')](_0x52f961['attributes'],function(_0x54fb7a){var _0x3791f9={};_0x3791f9[_0x54fb7a]={'$like':'%'+_0x180006[_0xaa6a('0x2f')][_0xaa6a('0x39')]+'%'};return _0x3791f9;})});}_0x52f961=_['merge']({},_0x52f961,_0x180006[_0xaa6a('0x3c')]);return _0x44a084[_0xaa6a('0x48')](_0x52f961);}})['then'](function(_0x50a864){if(_0x50a864){_0x4403ac=_0x50a864[_0xaa6a('0x34')];if(!_0x180006[_0xaa6a('0x2f')][_0xaa6a('0x35')](_0xaa6a('0x4c'))){_0x52f961[_0xaa6a('0x1b')]=qs['limit'](_0x180006['query']['limit']);_0x52f961[_0xaa6a('0x19')]=qs[_0xaa6a('0x19')](_0x180006[_0xaa6a('0x2f')]['offset']);}return _0x44a084[_0xaa6a('0x48')](_0x52f961);}})['then'](function(_0x3f3b7c){if(_0x3f3b7c){return _0x3f3b7c?{'count':_0x4403ac,'rows':_0x3f3b7c}:null;}})[_0xaa6a('0x21')](respondWithResult(_0x261f97,null))[_0xaa6a('0x45')](handleError(_0x261f97,null));};exports[_0xaa6a('0x4d')]=function(_0x32054e,_0x5010e5,_0x2a59f7){if(_0x32054e[_0xaa6a('0x47')]['id']){delete _0x32054e[_0xaa6a('0x47')]['id'];}return db[_0xaa6a('0x2a')]['findOne']({'where':{'id':_0x32054e[_0xaa6a('0x42')]['id']}})[_0xaa6a('0x21')](handleEntityNotFound(_0x5010e5,null))[_0xaa6a('0x21')](function(_0x38610f){if(_0x38610f){_0x32054e['body'][_0xaa6a('0x4e')]=_0x38610f['id'];_0x32054e[_0xaa6a('0x47')][_0xaa6a('0x4f')]=integrations[_0xaa6a('0x50')](_0x32054e[_0xaa6a('0x47')][_0xaa6a('0x51')],_0x32054e[_0xaa6a('0x47')]['type']);_0x32054e['body'][_0xaa6a('0x52')]=integrations['getDescriptions'](_0x32054e[_0xaa6a('0x47')][_0xaa6a('0x51')],_0x32054e['body']['type']);return db[_0xaa6a('0x4a')]['create'](_0x32054e[_0xaa6a('0x47')],{'include':[{'model':db['VtigerField'],'as':_0xaa6a('0x4f')},{'model':db[_0xaa6a('0x53')],'as':_0xaa6a('0x52')}]});}return null;})[_0xaa6a('0x21')](respondWithResult(_0x5010e5,null))[_0xaa6a('0x45')](handleError(_0x5010e5,null));};var md5=require(_0xaa6a('0x54'));exports['getFields']=function(_0x551f37,_0x200ccf,_0x4b333f){var _0x5545c2=null;var _0x29994e=null;var _0x5d680f=null;var _0x131afb=null;var _0x438e0d='';return db['VtigerAccount'][_0xaa6a('0x49')]({'where':{'id':_0x551f37[_0xaa6a('0x42')]['id']},'attributes':['id',_0xaa6a('0x27'),'username',_0xaa6a('0x55'),_0xaa6a('0x56'),_0xaa6a('0x57'),_0xaa6a('0x58'),_0xaa6a('0x59')]})[_0xaa6a('0x21')](handleEntityNotFound(_0x200ccf,null))[_0xaa6a('0x21')](function(_0x104c20){if(_0x104c20){_0x5545c2=_0x104c20[_0xaa6a('0x5a')];_0x29994e=_0x104c20[_0xaa6a('0x59')];_0x5d680f=_0x104c20[_0xaa6a('0x56')];_0x438e0d=_0x104c20[_0xaa6a('0x57')];var _0x498964=_0x438e0d[_0xaa6a('0x5b')](-0x1);if(_0x498964==='/'){_0x438e0d=_0x438e0d[_0xaa6a('0x5c')](0x0,_0x438e0d[_0xaa6a('0x5d')](_0x498964));}_0x131afb=util[_0xaa6a('0x5e')]('%s/webservice.php',_0x438e0d);var _0x3558a1={'method':_0xaa6a('0x5f'),'uri':_0x131afb,'qs':{'operation':_0xaa6a('0x60'),'username':_0x104c20[_0xaa6a('0x5a')]},'json':!![]};return rp(_0x3558a1);}})['then'](function(_0x412c69){if(_0x412c69[_0xaa6a('0x61')]){var _0x3978e7={'method':_0xaa6a('0x62'),'uri':_0x131afb,'form':{'operation':_0xaa6a('0x63'),'username':_0x5545c2,'accessKey':md5(_0x412c69[_0xaa6a('0x64')][_0xaa6a('0x65')]+_0x29994e)},'json':!![]};return rp(_0x3978e7);}})[_0xaa6a('0x21')](function(_0x30038f){if(_0x30038f['success']){var _0x220229={'method':_0xaa6a('0x5f'),'uri':_0x131afb,'qs':{'operation':_0xaa6a('0x66'),'username':_0x5545c2,'sessionName':_0x30038f[_0xaa6a('0x64')]['sessionName'],'elementType':_0x5d680f},'json':!![]};return rp(_0x220229);}})[_0xaa6a('0x21')](function(_0x2830dd){if(_0x2830dd[_0xaa6a('0x61')]){var _0x4d28fa=[_0xaa6a('0x67'),'reference','owner'];_[_0xaa6a('0x68')](_0x2830dd[_0xaa6a('0x64')][_0xaa6a('0x33')],function(_0x345051){return _0x4d28fa['includes'](_0x345051[_0xaa6a('0x69')][_0xaa6a('0x27')]);});_[_0xaa6a('0x68')](_0x2830dd[_0xaa6a('0x64')][_0xaa6a('0x33')],function(_0x68e2d3){return _0x68e2d3['editable']===_0xaa6a('0x6a');});return{'count':_0x2830dd[_0xaa6a('0x64')][_0xaa6a('0x33')][_0xaa6a('0x34')],'rows':_['map'](_0x2830dd[_0xaa6a('0x64')][_0xaa6a('0x33')],function(_0x527229){return{'id':_0x527229['name'],'name':_0x527229[_0xaa6a('0x6b')],'custom':_[_0xaa6a('0x6c')](_0x527229[_0xaa6a('0x27')],_0xaa6a('0x6d'))?!![]:![],'options':_0x527229['type'][_0xaa6a('0x27')]==='picklist'&&_0x527229[_0xaa6a('0x69')][_0xaa6a('0x6e')][_0xaa6a('0x34')]>0x0?_[_0xaa6a('0x2e')](_0x527229[_0xaa6a('0x69')][_0xaa6a('0x6e')],function(_0x1ee6ab){return{'name':_0x1ee6ab[_0xaa6a('0x6b')],'value':_0x1ee6ab[_0xaa6a('0x6f')]};}):[]};})};}})[_0xaa6a('0x21')](respondWithResult(_0x200ccf,null))[_0xaa6a('0x45')](function(_0x167054){console[_0xaa6a('0x70')](_0xaa6a('0x71')+_0x167054);var _0x1fba34=_0x551f37[_0xaa6a('0x2f')][_0xaa6a('0x72')]?0x1f4:_0x167054[_0xaa6a('0x73')]||0x1f4;logger['error'](_0xaa6a('0x74'),_0xaa6a('0x75'),_0x1fba34,JSON['stringify'](_0x167054));delete _0x167054[_0xaa6a('0x27')];if(_0x1fba34===0x191){_0x1fba34=0x190;}_0x200ccf['status'](_0x1fba34)[_0xaa6a('0x28')](_0x551f37[_0xaa6a('0x2f')][_0xaa6a('0x72')]?{'message':_0xaa6a('0x76'),'statusCode':_0x167054[_0xaa6a('0x73')]}:_0x167054);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7f84c86..bea7750 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 _0x739b=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x3294be,_0x24aa1c){var _0x106bce=function(_0x5a565b){while(--_0x5a565b){_0x3294be['push'](_0x3294be['shift']());}};_0x106bce(++_0x24aa1c);}(_0x739b,0x96));var _0xb739=function(_0x10c2de,_0x700f2d){_0x10c2de=_0x10c2de-0x0;var _0x2429a9=_0x739b[_0x10c2de];return _0x2429a9;};'use strict';var _=require(_0xb739('0x0'));var util=require('util');var logger=require(_0xb739('0x1'))(_0xb739('0x2'));var moment=require(_0xb739('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb739('0x4'));var rimraf=require(_0xb739('0x5'));var config=require(_0xb739('0x6'));var attributes=require(_0xb739('0x7'));var integrations=require(_0xb739('0x8'));module[_0xb739('0x9')]=function(_0x39dbdc,_0x2b76e5){return _0x39dbdc[_0xb739('0xa')](_0xb739('0xb'),attributes,{'tableName':_0xb739('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7cb=['VtigerAccount','int_vtiger_accounts','util','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x1b5afb,_0x1fb627){var _0x3cd5a3=function(_0x3fa7f7){while(--_0x3fa7f7){_0x1b5afb['push'](_0x1b5afb['shift']());}};_0x3cd5a3(++_0x1fb627);}(_0xd7cb,0x1df));var _0xbd7c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd7cb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xbd7c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbd7c('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd7c('0x2'));var rimraf=require(_0xbd7c('0x3'));var config=require(_0xbd7c('0x4'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xbd7c('0x5'));module['exports']=function(_0x4fdb9b,_0x5c65b8){return _0x4fdb9b[_0xbd7c('0x6')](_0xbd7c('0x7'),attributes,{'tableName':_0xbd7c('0x8'),'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 91407ed..b3c603f 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 _0x750a=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','where'];(function(_0x81926a,_0x56b99d){var _0x833fb1=function(_0xd73a44){while(--_0xd73a44){_0x81926a['push'](_0x81926a['shift']());}};_0x833fb1(++_0x56b99d);}(_0x750a,0x140));var _0xa750=function(_0x15da16,_0x279689){_0x15da16=_0x15da16-0x0;var _0x498922=_0x750a[_0x15da16];return _0x498922;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetVtigerAccount']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['VtigerAccount']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});};exports[_0xa750('0x1d')]=function(_0x59ab33){var _0x46cc11=this;return new Promise(function(_0x4c2c9e,_0x2d0e93){return db[_0xa750('0x1e')]['find']({'raw':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x1f')]||null:null,'attributes':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')]['attributes']||null:null,'include':_0x59ab33[_0xa750('0x15')]?_0x59ab33['options'][_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x59ab33[_0xa750('0x15')][_0xa750('0x1a')],function(_0x556fde){return{'model':db[_0x556fde[_0xa750('0x19')]],'as':_0x556fde['as'],'attributes':_0x556fde[_0xa750('0x17')],'include':_0x556fde['include']?_[_0xa750('0x1b')](_0x556fde[_0xa750('0x1a')],function(_0x280b87){return{'model':db[_0x280b87[_0xa750('0x19')]],'as':_0x280b87['as'],'attributes':_0x280b87['attributes'],'include':_0x280b87[_0xa750('0x1a')]?_['map'](_0x280b87['include'],function(_0x4e59f3){return{'model':db[_0x4e59f3[_0xa750('0x19')]],'as':_0x4e59f3['as'],'attributes':_0x4e59f3[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x470089){logger[_0xa750('0xc')](_0xa750('0x1d'),_0x59ab33);logger['debug'](_0xa750('0x1d'),_0x59ab33,JSON[_0xa750('0xf')](_0x470089));_0x4c2c9e(_0x470089);})[_0xa750('0x14')](function(_0x5d402a){logger[_0xa750('0x10')](_0xa750('0x1d'),_0x5d402a[_0xa750('0x13')],_0x59ab33);_0x2d0e93(_0x46cc11['error'](0x1f4,_0x5d402a[_0xa750('0x13')]));});});}; \ No newline at end of file +var _0x91a7=['VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','VtigerAccount','find','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x692282,_0x279660){var _0x172aa8=function(_0x5bd982){while(--_0x5bd982){_0x692282['push'](_0x692282['shift']());}};_0x172aa8(++_0x279660);}(_0x91a7,0xe7));var _0x791a=function(_0x1c1d1a,_0x438846){_0x1c1d1a=_0x1c1d1a-0x0;var _0x22374b=_0x91a7[_0x1c1d1a];return _0x22374b;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});}exports[_0x791a('0x13')]=function(_0x52941d){var _0x4a84ee=this;return new Promise(function(_0x588d00,_0x40f0d3){return db['VtigerAccount']['findAll']({'raw':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x15')]===undefined?!![]:![]:!![],'where':_0x52941d[_0x791a('0x14')]?_0x52941d['options'][_0x791a('0x16')]||null:null,'attributes':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x17')]||null:null,'limit':_0x52941d['options']?_0x52941d[_0x791a('0x14')][_0x791a('0x18')]||null:null,'include':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x52941d[_0x791a('0x14')][_0x791a('0x19')],function(_0x323c6a){return{'model':db[_0x323c6a[_0x791a('0x1b')]],'as':_0x323c6a['as'],'attributes':_0x323c6a[_0x791a('0x17')],'include':_0x323c6a['include']?_[_0x791a('0x1a')](_0x323c6a[_0x791a('0x19')],function(_0x380329){return{'model':db[_0x380329[_0x791a('0x1b')]],'as':_0x380329['as'],'attributes':_0x380329['attributes'],'include':_0x380329[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x380329['include'],function(_0xdfa84f){return{'model':db[_0xdfa84f[_0x791a('0x1b')]],'as':_0xdfa84f['as'],'attributes':_0xdfa84f[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29194d){logger[_0x791a('0xa')](_0x791a('0x13'),_0x52941d);logger[_0x791a('0xc')](_0x791a('0x13'),_0x52941d,JSON[_0x791a('0xd')](_0x29194d));_0x588d00(_0x29194d);})[_0x791a('0x12')](function(_0x889534){logger['error'](_0x791a('0x13'),_0x889534[_0x791a('0x10')],_0x52941d);_0x40f0d3(_0x4a84ee[_0x791a('0xe')](0x1f4,_0x889534['message']));});});};exports[_0x791a('0x1c')]=function(_0x5df656){var _0xc59f5e=this;return new Promise(function(_0x2e4ec8,_0xcde862){return db[_0x791a('0x1d')][_0x791a('0x1e')]({'raw':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x16')]||null:null,'attributes':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['attributes']||null:null,'include':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x5df656[_0x791a('0x14')]['include'],function(_0x305836){return{'model':db[_0x305836[_0x791a('0x1b')]],'as':_0x305836['as'],'attributes':_0x305836[_0x791a('0x17')],'include':_0x305836[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x305836['include'],function(_0xd5609){return{'model':db[_0xd5609['model']],'as':_0xd5609['as'],'attributes':_0xd5609[_0x791a('0x17')],'include':_0xd5609['include']?_['map'](_0xd5609[_0x791a('0x19')],function(_0x404530){return{'model':db[_0x404530[_0x791a('0x1b')]],'as':_0x404530['as'],'attributes':_0x404530[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x791a('0x9')](function(_0x3f46be){logger[_0x791a('0xa')]('ShowVtigerAccount',_0x5df656);logger[_0x791a('0xc')]('ShowVtigerAccount',_0x5df656,JSON[_0x791a('0xd')](_0x3f46be));_0x2e4ec8(_0x3f46be);})['catch'](function(_0x25e8cc){logger[_0x791a('0xe')]('ShowVtigerAccount',_0x25e8cc[_0x791a('0x10')],_0x5df656);_0xcde862(_0xc59f5e[_0x791a('0xe')](0x1f4,_0x25e8cc['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3e9e46d..3149e16 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 _0xa7d0=['/:id/subjects','/:id/descriptions','getDescriptions','create','/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields'];(function(_0x2c3064,_0x3f4f72){var _0xba5392=function(_0x18387a){while(--_0x18387a){_0x2c3064['push'](_0x2c3064['shift']());}};_0xba5392(++_0x3f4f72);}(_0xa7d0,0x111));var _0x0a7d=function(_0x2a4bec,_0x20a306){_0x2a4bec=_0x2a4bec-0x0;var _0x16c939=_0xa7d0[_0x2a4bec];return _0x16c939;};'use strict';var multer=require(_0x0a7d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a7d('0x1'));var router=express[_0x0a7d('0x2')]();var fs_extra=require(_0x0a7d('0x3'));var auth=require(_0x0a7d('0x4'));var interaction=require(_0x0a7d('0x5'));var config=require(_0x0a7d('0x6'));var controller=require(_0x0a7d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0a7d('0x8')]('/:id',auth[_0x0a7d('0x9')](),controller[_0x0a7d('0xa')]);router[_0x0a7d('0x8')](_0x0a7d('0xb'),auth['isAuthenticated'](),controller[_0x0a7d('0xc')]);router['get'](_0x0a7d('0xd'),auth[_0x0a7d('0x9')](),controller['getSubjects']);router[_0x0a7d('0x8')](_0x0a7d('0xe'),auth[_0x0a7d('0x9')](),controller[_0x0a7d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a7d('0x10')]);router['put'](_0x0a7d('0x11'),auth[_0x0a7d('0x9')](),controller[_0x0a7d('0x12')]);router[_0x0a7d('0x13')]('/:id',auth[_0x0a7d('0x9')](),controller[_0x0a7d('0x14')]);module[_0x0a7d('0x15')]=router; \ No newline at end of file +var _0x2ff6=['util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id/fields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ff6,0x1cd));var _0x62ff=function(_0x15a2ce,_0x38e62e){_0x15a2ce=_0x15a2ce-0x0;var _0x229dc8=_0x2ff6[_0x15a2ce];return _0x229dc8;};'use strict';var multer=require(_0x62ff('0x0'));var util=require(_0x62ff('0x1'));var path=require(_0x62ff('0x2'));var timeout=require(_0x62ff('0x3'));var express=require(_0x62ff('0x4'));var router=express[_0x62ff('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x62ff('0x6'));var controller=require(_0x62ff('0x7'));router[_0x62ff('0x8')]('/',auth['isAuthenticated'](),controller[_0x62ff('0x9')]);router[_0x62ff('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x62ff('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x62ff('0x8')](_0x62ff('0xb'),auth[_0x62ff('0xc')](),controller[_0x62ff('0xd')]);router['get'](_0x62ff('0xe'),auth[_0x62ff('0xc')](),controller[_0x62ff('0xf')]);router[_0x62ff('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x62ff('0x11')](_0x62ff('0x12'),auth[_0x62ff('0xc')](),controller['update']);router[_0x62ff('0x13')](_0x62ff('0x12'),auth[_0x62ff('0xc')](),controller[_0x62ff('0x14')]);module[_0x62ff('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 5081a70..2d8976e 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 _0x429f=['sequelize','exports','STRING'];(function(_0xeadc11,_0x27e378){var _0x4257b6=function(_0x38bb40){while(--_0x38bb40){_0xeadc11['push'](_0xeadc11['shift']());}};_0x4257b6(++_0x27e378);}(_0x429f,0x156));var _0xf429=function(_0x200045,_0x4e5da1){_0x200045=_0x200045-0x0;var _0x566a8d=_0x429f[_0x200045];return _0x566a8d;};'use strict';var Sequelize=require(_0xf429('0x0'));module[_0xf429('0x1')]={'name':{'type':Sequelize[_0xf429('0x2')]},'description':{'type':Sequelize[_0xf429('0x2')]}}; \ No newline at end of file +var _0x6c1d=['exports','STRING'];(function(_0x58a1ee,_0x1f538c){var _0x27826d=function(_0x46b2eb){while(--_0x46b2eb){_0x58a1ee['push'](_0x58a1ee['shift']());}};_0x27826d(++_0x1f538c);}(_0x6c1d,0xde));var _0xd6c1=function(_0xf786ad,_0x86c842){_0xf786ad=_0xf786ad-0x0;var _0x3474fe=_0x6c1d[_0xf786ad];return _0x3474fe;};'use strict';var Sequelize=require('sequelize');module[_0xd6c1('0x0')]={'name':{'type':Sequelize[_0xd6c1('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index cf55328..1d40246 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 _0xa3d8=['send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','getFields','findOne','order','getSubjects','VtigerField','nolimit','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error'];(function(_0x2438bd,_0x2c3604){var _0xab3dbc=function(_0x11d57d){while(--_0x11d57d){_0x2438bd['push'](_0x2438bd['shift']());}};_0xab3dbc(++_0x2c3604);}(_0xa3d8,0x17a));var _0x8a3d=function(_0x42af54,_0x5439a2){_0x42af54=_0x42af54-0x0;var _0x31add8=_0xa3d8[_0x42af54];return _0x31add8;};'use strict';var emlformat=require(_0x8a3d('0x0'));var rimraf=require(_0x8a3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8a3d('0x2'));var moment=require(_0x8a3d('0x3'));var BPromise=require(_0x8a3d('0x4'));var Mustache=require(_0x8a3d('0x5'));var util=require(_0x8a3d('0x6'));var path=require(_0x8a3d('0x7'));var sox=require(_0x8a3d('0x8'));var csv=require(_0x8a3d('0x9'));var ejs=require(_0x8a3d('0xa'));var fs=require('fs');var fs_extra=require(_0x8a3d('0xb'));var _=require(_0x8a3d('0xc'));var squel=require('squel');var crypto=require(_0x8a3d('0xd'));var jsforce=require(_0x8a3d('0xe'));var deskjs=require(_0x8a3d('0xf'));var toCsv=require(_0x8a3d('0x9'));var querystring=require(_0x8a3d('0x10'));var Papa=require('papaparse');var Redis=require(_0x8a3d('0x11'));var authService=require(_0x8a3d('0x12'));var qs=require(_0x8a3d('0x13'));var as=require(_0x8a3d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a3d('0x15'))(_0x8a3d('0x16'));var utils=require(_0x8a3d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8a3d('0x18'));var db=require(_0x8a3d('0x19'))['db'];function respondWithStatusCode(_0x570cee,_0x2a8412){_0x2a8412=_0x2a8412||0xcc;return function(_0x2b3f40){if(_0x2b3f40){return _0x570cee[_0x8a3d('0x1a')](_0x2a8412);}return _0x570cee[_0x8a3d('0x1b')](_0x2a8412)[_0x8a3d('0x1c')]();};}function respondWithResult(_0xbb494a,_0x5a9318){_0x5a9318=_0x5a9318||0xc8;return function(_0x5985b9){if(_0x5985b9){return _0xbb494a[_0x8a3d('0x1b')](_0x5a9318)[_0x8a3d('0x1d')](_0x5985b9);}};}function respondWithFilteredResult(_0x4dbc49,_0x299f8a){return function(_0x51a54c){if(_0x51a54c){var _0x4224be=typeof _0x299f8a[_0x8a3d('0x1e')]==='undefined'&&typeof _0x299f8a[_0x8a3d('0x1f')]===_0x8a3d('0x20');var _0x4fccc2=_0x51a54c[_0x8a3d('0x21')];var _0x17f7d6=_0x4224be?0x0:_0x299f8a['offset'];var _0x4be53c=_0x4224be?_0x51a54c['count']:_0x299f8a[_0x8a3d('0x1e')]+_0x299f8a[_0x8a3d('0x1f')];var _0x4b8a40;if(_0x4be53c>=_0x4fccc2){_0x4be53c=_0x4fccc2;_0x4b8a40=0xc8;}else{_0x4b8a40=0xce;}_0x4dbc49[_0x8a3d('0x1b')](_0x4b8a40);return _0x4dbc49[_0x8a3d('0x22')](_0x8a3d('0x23'),_0x17f7d6+'-'+_0x4be53c+'/'+_0x4fccc2)[_0x8a3d('0x1d')](_0x51a54c);}return null;};}function patchUpdates(_0x48b146){return function(_0x1a1a33){try{jsonpatch[_0x8a3d('0x24')](_0x1a1a33,_0x48b146,!![]);}catch(_0x57c677){return BPromise['reject'](_0x57c677);}return _0x1a1a33[_0x8a3d('0x25')]();};}function saveUpdates(_0xa3f4c8,_0x4544d1){return function(_0x52f0bb){if(_0x52f0bb){return _0x52f0bb[_0x8a3d('0x26')](_0xa3f4c8)['then'](function(_0x300681){return _0x300681;});}return null;};}function removeEntity(_0x10ddde,_0x1a1b95){return function(_0x21077d){if(_0x21077d){return _0x21077d[_0x8a3d('0x27')]()[_0x8a3d('0x28')](function(){_0x10ddde[_0x8a3d('0x1b')](0xcc)[_0x8a3d('0x1c')]();});}};}function handleEntityNotFound(_0x3335fc,_0x2e1690){return function(_0x95379a){if(!_0x95379a){_0x3335fc[_0x8a3d('0x1a')](0x194);}return _0x95379a;};}function handleError(_0x27139e,_0x2d39eb){_0x2d39eb=_0x2d39eb||0x1f4;return function(_0x590513){logger[_0x8a3d('0x29')](_0x590513['stack']);if(_0x590513['name']){delete _0x590513['name'];}_0x27139e['status'](_0x2d39eb)[_0x8a3d('0x2a')](_0x590513);};}exports[_0x8a3d('0x2b')]=function(_0x470ee9,_0x28d18a){var _0x591f6e={},_0x3261d8={},_0x210cff={'count':0x0,'rows':[]};var _0x35c10b=_[_0x8a3d('0x2c')](db[_0x8a3d('0x2d')][_0x8a3d('0x2e')],function(_0x5cb30c){return{'name':_0x5cb30c[_0x8a3d('0x2f')],'type':_0x5cb30c[_0x8a3d('0x30')][_0x8a3d('0x31')]};});_0x3261d8[_0x8a3d('0x32')]=_['map'](_0x35c10b,'name');_0x3261d8[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x470ee9['query']);_0x3261d8[_0x8a3d('0x35')]=_['intersection'](_0x3261d8['model'],_0x3261d8[_0x8a3d('0x33')]);_0x591f6e['attributes']=_[_0x8a3d('0x36')](_0x3261d8[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x591f6e['attributes']=_0x591f6e[_0x8a3d('0x38')]['length']?_0x591f6e['attributes']:_0x3261d8['model'];if(!_0x470ee9['query'][_0x8a3d('0x39')]('nolimit')){_0x591f6e[_0x8a3d('0x1f')]=qs[_0x8a3d('0x1f')](_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x1f')]);_0x591f6e[_0x8a3d('0x1e')]=qs[_0x8a3d('0x1e')](_0x470ee9[_0x8a3d('0x33')]['offset']);}_0x591f6e['order']=qs[_0x8a3d('0x3a')](_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x3a')]);_0x591f6e[_0x8a3d('0x3b')]=qs[_0x8a3d('0x35')](_[_0x8a3d('0x3c')](_0x470ee9[_0x8a3d('0x33')],_0x3261d8[_0x8a3d('0x35')]),_0x35c10b);if(_0x470ee9['query'][_0x8a3d('0x3d')]){_0x591f6e['where']=_[_0x8a3d('0x3e')](_0x591f6e[_0x8a3d('0x3b')],{'$or':_[_0x8a3d('0x2c')](_0x35c10b,function(_0x5d9003){if(_0x5d9003[_0x8a3d('0x30')]!==_0x8a3d('0x3f')){var _0x2539e5={};_0x2539e5[_0x5d9003[_0x8a3d('0x40')]]={'$like':'%'+_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x3d')]+'%'};return _0x2539e5;}})});}_0x591f6e=_[_0x8a3d('0x3e')]({},_0x591f6e,_0x470ee9['options']);var _0x3ecead={'where':_0x591f6e[_0x8a3d('0x3b')]};return db[_0x8a3d('0x2d')][_0x8a3d('0x21')](_0x3ecead)[_0x8a3d('0x28')](function(_0x4eff7){_0x210cff[_0x8a3d('0x21')]=_0x4eff7;if(_0x470ee9[_0x8a3d('0x33')][_0x8a3d('0x41')]){_0x591f6e[_0x8a3d('0x42')]=[{'all':!![]}];}return db[_0x8a3d('0x2d')][_0x8a3d('0x43')](_0x591f6e);})['then'](function(_0xebd3ba){_0x210cff[_0x8a3d('0x44')]=_0xebd3ba;return _0x210cff;})['then'](respondWithFilteredResult(_0x28d18a,_0x591f6e))[_0x8a3d('0x45')](handleError(_0x28d18a,null));};exports[_0x8a3d('0x46')]=function(_0x152b01,_0x5d0f00){var _0x3a5941={'raw':![],'where':{'id':_0x152b01[_0x8a3d('0x47')]['id']}},_0x5cbf98={};_0x5cbf98[_0x8a3d('0x32')]=_[_0x8a3d('0x34')](db[_0x8a3d('0x2d')][_0x8a3d('0x2e')]);_0x5cbf98[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x152b01['query']);_0x5cbf98[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x5cbf98[_0x8a3d('0x32')],_0x5cbf98['query']);_0x3a5941[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x5cbf98[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x152b01[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x3a5941['attributes']=_0x3a5941[_0x8a3d('0x38')][_0x8a3d('0x48')]?_0x3a5941[_0x8a3d('0x38')]:_0x5cbf98[_0x8a3d('0x32')];if(_0x152b01[_0x8a3d('0x33')][_0x8a3d('0x41')]){_0x3a5941[_0x8a3d('0x42')]=[{'all':!![]}];}_0x3a5941=_['merge']({},_0x3a5941,_0x152b01[_0x8a3d('0x49')]);return db[_0x8a3d('0x2d')]['find'](_0x3a5941)['then'](handleEntityNotFound(_0x5d0f00,null))[_0x8a3d('0x28')](respondWithResult(_0x5d0f00,null))[_0x8a3d('0x45')](handleError(_0x5d0f00,null));};exports[_0x8a3d('0x4a')]=function(_0x17da66,_0xa87880){return db[_0x8a3d('0x2d')][_0x8a3d('0x4a')](_0x17da66[_0x8a3d('0x4b')],{})['then'](respondWithResult(_0xa87880,0xc9))['catch'](handleError(_0xa87880,null));};exports[_0x8a3d('0x26')]=function(_0x39b653,_0x569977){if(_0x39b653['body']['id']){delete _0x39b653[_0x8a3d('0x4b')]['id'];}return db['VtigerConfiguration'][_0x8a3d('0x4c')]({'where':{'id':_0x39b653[_0x8a3d('0x47')]['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x569977,null))['then'](saveUpdates(_0x39b653[_0x8a3d('0x4b')],null))[_0x8a3d('0x28')](respondWithResult(_0x569977,null))[_0x8a3d('0x45')](handleError(_0x569977,null));};exports[_0x8a3d('0x27')]=function(_0x3858cd,_0x4196e8){return db[_0x8a3d('0x2d')]['find']({'where':{'id':_0x3858cd['params']['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x4196e8,null))['then'](removeEntity(_0x4196e8,null))['catch'](handleError(_0x4196e8,null));};exports[_0x8a3d('0x4d')]=function(_0x31e739,_0x4f04cd,_0x3cdeae){var _0x18d5b8={};var _0x2df1f5={};var _0x106198;var _0x1571bd;return db[_0x8a3d('0x2d')][_0x8a3d('0x4e')]({'where':{'id':_0x31e739[_0x8a3d('0x47')]['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x4f04cd,null))['then'](function(_0x2e2f49){if(_0x2e2f49){_0x106198=_0x2e2f49;_0x2df1f5['model']=_['keys'](db['VtigerField'][_0x8a3d('0x2e')]);_0x2df1f5[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x31e739[_0x8a3d('0x33')]);_0x2df1f5[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x2df1f5[_0x8a3d('0x32')],_0x2df1f5[_0x8a3d('0x33')]);_0x18d5b8[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x2df1f5[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x31e739[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x18d5b8[_0x8a3d('0x38')]=_0x18d5b8['attributes'][_0x8a3d('0x48')]?_0x18d5b8[_0x8a3d('0x38')]:_0x2df1f5[_0x8a3d('0x32')];_0x18d5b8[_0x8a3d('0x4f')]=qs[_0x8a3d('0x3a')](_0x31e739[_0x8a3d('0x33')][_0x8a3d('0x3a')]);_0x18d5b8[_0x8a3d('0x3b')]=qs[_0x8a3d('0x35')](_['pick'](_0x31e739[_0x8a3d('0x33')],_0x2df1f5[_0x8a3d('0x35')]));if(_0x31e739['query'][_0x8a3d('0x3d')]){_0x18d5b8['where']=_[_0x8a3d('0x3e')](_0x18d5b8['where'],{'$or':_[_0x8a3d('0x2c')](_0x18d5b8[_0x8a3d('0x38')],function(_0x40537b){var _0x5e643a={};_0x5e643a[_0x40537b]={'$like':'%'+_0x31e739['query']['filter']+'%'};return _0x5e643a;})});}_0x18d5b8=_['merge']({},_0x18d5b8,_0x31e739[_0x8a3d('0x49')]);return _0x106198['getFields'](_0x18d5b8);}})[_0x8a3d('0x28')](function(_0x5334b8){if(_0x5334b8){_0x1571bd=_0x5334b8[_0x8a3d('0x48')];if(!_0x31e739[_0x8a3d('0x33')][_0x8a3d('0x39')]('nolimit')){_0x18d5b8['limit']=qs[_0x8a3d('0x1f')](_0x31e739[_0x8a3d('0x33')]['limit']);_0x18d5b8['offset']=qs['offset'](_0x31e739['query']['offset']);}return _0x106198['getFields'](_0x18d5b8);}})[_0x8a3d('0x28')](function(_0x156df6){if(_0x156df6){return _0x156df6?{'count':_0x1571bd,'rows':_0x156df6}:null;}})['then'](respondWithResult(_0x4f04cd,null))[_0x8a3d('0x45')](handleError(_0x4f04cd,null));};exports[_0x8a3d('0x50')]=function(_0x204d01,_0x245736,_0x2fc447){var _0x22f520={};var _0x3cfec0={};var _0x285ec5;var _0x47b150;return db[_0x8a3d('0x2d')]['findOne']({'where':{'id':_0x204d01[_0x8a3d('0x47')]['id']}})[_0x8a3d('0x28')](handleEntityNotFound(_0x245736,null))[_0x8a3d('0x28')](function(_0x49b54b){if(_0x49b54b){_0x285ec5=_0x49b54b;_0x3cfec0[_0x8a3d('0x32')]=_[_0x8a3d('0x34')](db[_0x8a3d('0x51')]['rawAttributes']);_0x3cfec0[_0x8a3d('0x33')]=_[_0x8a3d('0x34')](_0x204d01['query']);_0x3cfec0[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x3cfec0[_0x8a3d('0x32')],_0x3cfec0[_0x8a3d('0x33')]);_0x22f520[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x3cfec0[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x204d01[_0x8a3d('0x33')][_0x8a3d('0x37')]));_0x22f520['attributes']=_0x22f520['attributes'][_0x8a3d('0x48')]?_0x22f520[_0x8a3d('0x38')]:_0x3cfec0['model'];_0x22f520['order']=qs[_0x8a3d('0x3a')](_0x204d01['query'][_0x8a3d('0x3a')]);_0x22f520[_0x8a3d('0x3b')]=qs[_0x8a3d('0x35')](_[_0x8a3d('0x3c')](_0x204d01[_0x8a3d('0x33')],_0x3cfec0[_0x8a3d('0x35')]));if(_0x204d01['query'][_0x8a3d('0x3d')]){_0x22f520['where']=_['merge'](_0x22f520[_0x8a3d('0x3b')],{'$or':_[_0x8a3d('0x2c')](_0x22f520[_0x8a3d('0x38')],function(_0x5229c1){var _0x4cf9f5={};_0x4cf9f5[_0x5229c1]={'$like':'%'+_0x204d01['query'][_0x8a3d('0x3d')]+'%'};return _0x4cf9f5;})});}_0x22f520=_[_0x8a3d('0x3e')]({},_0x22f520,_0x204d01[_0x8a3d('0x49')]);return _0x285ec5[_0x8a3d('0x50')](_0x22f520);}})[_0x8a3d('0x28')](function(_0x5a4d3b){if(_0x5a4d3b){_0x47b150=_0x5a4d3b[_0x8a3d('0x48')];if(!_0x204d01['query'][_0x8a3d('0x39')](_0x8a3d('0x52'))){_0x22f520['limit']=qs[_0x8a3d('0x1f')](_0x204d01[_0x8a3d('0x33')][_0x8a3d('0x1f')]);_0x22f520['offset']=qs['offset'](_0x204d01[_0x8a3d('0x33')][_0x8a3d('0x1e')]);}return _0x285ec5[_0x8a3d('0x50')](_0x22f520);}})['then'](function(_0x37084b){if(_0x37084b){return _0x37084b?{'count':_0x47b150,'rows':_0x37084b}:null;}})[_0x8a3d('0x28')](respondWithResult(_0x245736,null))['catch'](handleError(_0x245736,null));};exports[_0x8a3d('0x53')]=function(_0x4c4a6d,_0x30850c,_0x294ad6){var _0x2f2670={};var _0x2786c5={};var _0x3ccc71;var _0x1329e8;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x4c4a6d[_0x8a3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x30850c,null))[_0x8a3d('0x28')](function(_0x387363){if(_0x387363){_0x3ccc71=_0x387363;_0x2786c5[_0x8a3d('0x32')]=_[_0x8a3d('0x34')](db[_0x8a3d('0x51')][_0x8a3d('0x2e')]);_0x2786c5[_0x8a3d('0x33')]=_['keys'](_0x4c4a6d[_0x8a3d('0x33')]);_0x2786c5[_0x8a3d('0x35')]=_[_0x8a3d('0x36')](_0x2786c5[_0x8a3d('0x32')],_0x2786c5[_0x8a3d('0x33')]);_0x2f2670[_0x8a3d('0x38')]=_[_0x8a3d('0x36')](_0x2786c5[_0x8a3d('0x32')],qs[_0x8a3d('0x37')](_0x4c4a6d['query'][_0x8a3d('0x37')]));_0x2f2670[_0x8a3d('0x38')]=_0x2f2670[_0x8a3d('0x38')][_0x8a3d('0x48')]?_0x2f2670[_0x8a3d('0x38')]:_0x2786c5[_0x8a3d('0x32')];_0x2f2670[_0x8a3d('0x4f')]=qs[_0x8a3d('0x3a')](_0x4c4a6d['query'][_0x8a3d('0x3a')]);_0x2f2670[_0x8a3d('0x3b')]=qs['filters'](_[_0x8a3d('0x3c')](_0x4c4a6d[_0x8a3d('0x33')],_0x2786c5[_0x8a3d('0x35')]));if(_0x4c4a6d[_0x8a3d('0x33')]['filter']){_0x2f2670[_0x8a3d('0x3b')]=_[_0x8a3d('0x3e')](_0x2f2670[_0x8a3d('0x3b')],{'$or':_[_0x8a3d('0x2c')](_0x2f2670[_0x8a3d('0x38')],function(_0x2f9fe7){var _0x3aef8d={};_0x3aef8d[_0x2f9fe7]={'$like':'%'+_0x4c4a6d[_0x8a3d('0x33')][_0x8a3d('0x3d')]+'%'};return _0x3aef8d;})});}_0x2f2670=_[_0x8a3d('0x3e')]({},_0x2f2670,_0x4c4a6d[_0x8a3d('0x49')]);return _0x3ccc71[_0x8a3d('0x53')](_0x2f2670);}})[_0x8a3d('0x28')](function(_0x34f387){if(_0x34f387){_0x1329e8=_0x34f387[_0x8a3d('0x48')];if(!_0x4c4a6d['query'][_0x8a3d('0x39')]('nolimit')){_0x2f2670[_0x8a3d('0x1f')]=qs['limit'](_0x4c4a6d[_0x8a3d('0x33')][_0x8a3d('0x1f')]);_0x2f2670[_0x8a3d('0x1e')]=qs['offset'](_0x4c4a6d[_0x8a3d('0x33')][_0x8a3d('0x1e')]);}return _0x3ccc71[_0x8a3d('0x53')](_0x2f2670);}})[_0x8a3d('0x28')](function(_0x5e5a8b){if(_0x5e5a8b){return _0x5e5a8b?{'count':_0x1329e8,'rows':_0x5e5a8b}:null;}})[_0x8a3d('0x28')](respondWithResult(_0x30850c,null))[_0x8a3d('0x45')](handleError(_0x30850c,null));}; \ No newline at end of file +var _0xd3ef=['sort','where','filter','merge','type','options','VtigerConfiguration','includeAll','include','catch','find','create','body','params','findOne','VtigerField','order','pick','getFields','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x1c85e8,_0x3b207c){var _0x5e656b=function(_0x51b2a4){while(--_0x51b2a4){_0x1c85e8['push'](_0x1c85e8['shift']());}};_0x5e656b(++_0x3b207c);}(_0xd3ef,0xaa));var _0xfd3e=function(_0x1eeb3f,_0x5b362c){_0x1eeb3f=_0x1eeb3f-0x0;var _0x5552f8=_0xd3ef[_0x1eeb3f];return _0x5552f8;};'use strict';var emlformat=require(_0xfd3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd3e('0x1'));var jsonpatch=require(_0xfd3e('0x2'));var rp=require('request-promise');var moment=require(_0xfd3e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfd3e('0x4'));var util=require(_0xfd3e('0x5'));var path=require(_0xfd3e('0x6'));var sox=require(_0xfd3e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd3e('0x8'));var squel=require('squel');var crypto=require(_0xfd3e('0x9'));var jsforce=require(_0xfd3e('0xa'));var deskjs=require(_0xfd3e('0xb'));var toCsv=require(_0xfd3e('0xc'));var querystring=require(_0xfd3e('0xd'));var Papa=require('papaparse');var Redis=require(_0xfd3e('0xe'));var authService=require(_0xfd3e('0xf'));var qs=require(_0xfd3e('0x10'));var as=require(_0xfd3e('0x11'));var hardwareService=require(_0xfd3e('0x12'));var logger=require(_0xfd3e('0x13'))('api');var utils=require(_0xfd3e('0x14'));var config=require(_0xfd3e('0x15'));var licenseUtil=require(_0xfd3e('0x16'));var db=require(_0xfd3e('0x17'))['db'];function respondWithStatusCode(_0x459206,_0x4cc96f){_0x4cc96f=_0x4cc96f||0xcc;return function(_0x22f722){if(_0x22f722){return _0x459206[_0xfd3e('0x18')](_0x4cc96f);}return _0x459206[_0xfd3e('0x19')](_0x4cc96f)[_0xfd3e('0x1a')]();};}function respondWithResult(_0x1c8334,_0x2ce0aa){_0x2ce0aa=_0x2ce0aa||0xc8;return function(_0x4f852e){if(_0x4f852e){return _0x1c8334[_0xfd3e('0x19')](_0x2ce0aa)[_0xfd3e('0x1b')](_0x4f852e);}};}function respondWithFilteredResult(_0x599500,_0x46a55b){return function(_0x21fd49){if(_0x21fd49){var _0xff259b=typeof _0x46a55b[_0xfd3e('0x1c')]===_0xfd3e('0x1d')&&typeof _0x46a55b[_0xfd3e('0x1e')]===_0xfd3e('0x1d');var _0x41820d=_0x21fd49[_0xfd3e('0x1f')];var _0x558a60=_0xff259b?0x0:_0x46a55b[_0xfd3e('0x1c')];var _0xc689f2=_0xff259b?_0x21fd49[_0xfd3e('0x1f')]:_0x46a55b[_0xfd3e('0x1c')]+_0x46a55b[_0xfd3e('0x1e')];var _0x51567c;if(_0xc689f2>=_0x41820d){_0xc689f2=_0x41820d;_0x51567c=0xc8;}else{_0x51567c=0xce;}_0x599500[_0xfd3e('0x19')](_0x51567c);return _0x599500['set']('Content-Range',_0x558a60+'-'+_0xc689f2+'/'+_0x41820d)['json'](_0x21fd49);}return null;};}function patchUpdates(_0x333090){return function(_0x43f260){try{jsonpatch['apply'](_0x43f260,_0x333090,!![]);}catch(_0x1ea9e9){return BPromise[_0xfd3e('0x20')](_0x1ea9e9);}return _0x43f260[_0xfd3e('0x21')]();};}function saveUpdates(_0x42b64b,_0x4ca965){return function(_0xbd277e){if(_0xbd277e){return _0xbd277e[_0xfd3e('0x22')](_0x42b64b)['then'](function(_0x1539d4){return _0x1539d4;});}return null;};}function removeEntity(_0x45d5b0,_0x92305c){return function(_0x55b8cb){if(_0x55b8cb){return _0x55b8cb['destroy']()[_0xfd3e('0x23')](function(){_0x45d5b0[_0xfd3e('0x19')](0xcc)[_0xfd3e('0x1a')]();});}};}function handleEntityNotFound(_0x15f02b,_0x5a0d4d){return function(_0x429d08){if(!_0x429d08){_0x15f02b['sendStatus'](0x194);}return _0x429d08;};}function handleError(_0x4874ce,_0x2bc229){_0x2bc229=_0x2bc229||0x1f4;return function(_0x4403de){logger['error'](_0x4403de['stack']);if(_0x4403de[_0xfd3e('0x24')]){delete _0x4403de['name'];}_0x4874ce[_0xfd3e('0x19')](_0x2bc229)[_0xfd3e('0x25')](_0x4403de);};}exports[_0xfd3e('0x26')]=function(_0xea490,_0x2af503){var _0x45c8d5={},_0x4ee1d6={},_0x22db44={'count':0x0,'rows':[]};var _0x548a16=_[_0xfd3e('0x27')](db['VtigerConfiguration'][_0xfd3e('0x28')],function(_0x475f0d){return{'name':_0x475f0d[_0xfd3e('0x29')],'type':_0x475f0d['type'][_0xfd3e('0x2a')]};});_0x4ee1d6[_0xfd3e('0x2b')]=_[_0xfd3e('0x27')](_0x548a16,_0xfd3e('0x24'));_0x4ee1d6[_0xfd3e('0x2c')]=_[_0xfd3e('0x2d')](_0xea490[_0xfd3e('0x2c')]);_0x4ee1d6[_0xfd3e('0x2e')]=_[_0xfd3e('0x2f')](_0x4ee1d6[_0xfd3e('0x2b')],_0x4ee1d6[_0xfd3e('0x2c')]);_0x45c8d5['attributes']=_[_0xfd3e('0x2f')](_0x4ee1d6[_0xfd3e('0x2b')],qs[_0xfd3e('0x30')](_0xea490[_0xfd3e('0x2c')]['fields']));_0x45c8d5[_0xfd3e('0x31')]=_0x45c8d5[_0xfd3e('0x31')][_0xfd3e('0x32')]?_0x45c8d5[_0xfd3e('0x31')]:_0x4ee1d6[_0xfd3e('0x2b')];if(!_0xea490[_0xfd3e('0x2c')][_0xfd3e('0x33')]('nolimit')){_0x45c8d5[_0xfd3e('0x1e')]=qs['limit'](_0xea490['query'][_0xfd3e('0x1e')]);_0x45c8d5[_0xfd3e('0x1c')]=qs['offset'](_0xea490[_0xfd3e('0x2c')][_0xfd3e('0x1c')]);}_0x45c8d5['order']=qs[_0xfd3e('0x34')](_0xea490[_0xfd3e('0x2c')][_0xfd3e('0x34')]);_0x45c8d5[_0xfd3e('0x35')]=qs[_0xfd3e('0x2e')](_['pick'](_0xea490['query'],_0x4ee1d6['filters']),_0x548a16);if(_0xea490[_0xfd3e('0x2c')][_0xfd3e('0x36')]){_0x45c8d5['where']=_[_0xfd3e('0x37')](_0x45c8d5[_0xfd3e('0x35')],{'$or':_['map'](_0x548a16,function(_0x3c19ce){if(_0x3c19ce[_0xfd3e('0x38')]!=='VIRTUAL'){var _0x36a7af={};_0x36a7af[_0x3c19ce[_0xfd3e('0x24')]]={'$like':'%'+_0xea490[_0xfd3e('0x2c')][_0xfd3e('0x36')]+'%'};return _0x36a7af;}})});}_0x45c8d5=_[_0xfd3e('0x37')]({},_0x45c8d5,_0xea490[_0xfd3e('0x39')]);var _0x363d6b={'where':_0x45c8d5[_0xfd3e('0x35')]};return db[_0xfd3e('0x3a')][_0xfd3e('0x1f')](_0x363d6b)['then'](function(_0x28d876){_0x22db44[_0xfd3e('0x1f')]=_0x28d876;if(_0xea490[_0xfd3e('0x2c')][_0xfd3e('0x3b')]){_0x45c8d5[_0xfd3e('0x3c')]=[{'all':!![]}];}return db[_0xfd3e('0x3a')]['findAll'](_0x45c8d5);})[_0xfd3e('0x23')](function(_0x229074){_0x22db44['rows']=_0x229074;return _0x22db44;})[_0xfd3e('0x23')](respondWithFilteredResult(_0x2af503,_0x45c8d5))[_0xfd3e('0x3d')](handleError(_0x2af503,null));};exports['show']=function(_0x2fd125,_0x399f90){var _0x1a5ca1={'raw':![],'where':{'id':_0x2fd125['params']['id']}},_0x154fbe={};_0x154fbe['model']=_[_0xfd3e('0x2d')](db[_0xfd3e('0x3a')][_0xfd3e('0x28')]);_0x154fbe['query']=_['keys'](_0x2fd125[_0xfd3e('0x2c')]);_0x154fbe[_0xfd3e('0x2e')]=_[_0xfd3e('0x2f')](_0x154fbe[_0xfd3e('0x2b')],_0x154fbe[_0xfd3e('0x2c')]);_0x1a5ca1[_0xfd3e('0x31')]=_['intersection'](_0x154fbe[_0xfd3e('0x2b')],qs[_0xfd3e('0x30')](_0x2fd125['query']['fields']));_0x1a5ca1[_0xfd3e('0x31')]=_0x1a5ca1[_0xfd3e('0x31')][_0xfd3e('0x32')]?_0x1a5ca1['attributes']:_0x154fbe[_0xfd3e('0x2b')];if(_0x2fd125[_0xfd3e('0x2c')][_0xfd3e('0x3b')]){_0x1a5ca1[_0xfd3e('0x3c')]=[{'all':!![]}];}_0x1a5ca1=_[_0xfd3e('0x37')]({},_0x1a5ca1,_0x2fd125[_0xfd3e('0x39')]);return db[_0xfd3e('0x3a')][_0xfd3e('0x3e')](_0x1a5ca1)['then'](handleEntityNotFound(_0x399f90,null))['then'](respondWithResult(_0x399f90,null))[_0xfd3e('0x3d')](handleError(_0x399f90,null));};exports[_0xfd3e('0x3f')]=function(_0x39db9b,_0x20c32a){return db['VtigerConfiguration'][_0xfd3e('0x3f')](_0x39db9b[_0xfd3e('0x40')],{})[_0xfd3e('0x23')](respondWithResult(_0x20c32a,0xc9))[_0xfd3e('0x3d')](handleError(_0x20c32a,null));};exports[_0xfd3e('0x22')]=function(_0x460b2c,_0x64e360){if(_0x460b2c['body']['id']){delete _0x460b2c[_0xfd3e('0x40')]['id'];}return db[_0xfd3e('0x3a')]['find']({'where':{'id':_0x460b2c[_0xfd3e('0x41')]['id']}})['then'](handleEntityNotFound(_0x64e360,null))['then'](saveUpdates(_0x460b2c[_0xfd3e('0x40')],null))[_0xfd3e('0x23')](respondWithResult(_0x64e360,null))[_0xfd3e('0x3d')](handleError(_0x64e360,null));};exports['destroy']=function(_0x2a7606,_0x43eb7c){return db['VtigerConfiguration'][_0xfd3e('0x3e')]({'where':{'id':_0x2a7606[_0xfd3e('0x41')]['id']}})[_0xfd3e('0x23')](handleEntityNotFound(_0x43eb7c,null))[_0xfd3e('0x23')](removeEntity(_0x43eb7c,null))[_0xfd3e('0x3d')](handleError(_0x43eb7c,null));};exports['getFields']=function(_0x3825c2,_0x2b96b3,_0x4fd540){var _0x1a62a9={};var _0x444313={};var _0x921b9e;var _0x5b84ef;return db[_0xfd3e('0x3a')][_0xfd3e('0x42')]({'where':{'id':_0x3825c2['params']['id']}})['then'](handleEntityNotFound(_0x2b96b3,null))[_0xfd3e('0x23')](function(_0x35f963){if(_0x35f963){_0x921b9e=_0x35f963;_0x444313[_0xfd3e('0x2b')]=_['keys'](db[_0xfd3e('0x43')]['rawAttributes']);_0x444313[_0xfd3e('0x2c')]=_[_0xfd3e('0x2d')](_0x3825c2[_0xfd3e('0x2c')]);_0x444313[_0xfd3e('0x2e')]=_[_0xfd3e('0x2f')](_0x444313[_0xfd3e('0x2b')],_0x444313[_0xfd3e('0x2c')]);_0x1a62a9[_0xfd3e('0x31')]=_[_0xfd3e('0x2f')](_0x444313['model'],qs[_0xfd3e('0x30')](_0x3825c2[_0xfd3e('0x2c')][_0xfd3e('0x30')]));_0x1a62a9[_0xfd3e('0x31')]=_0x1a62a9[_0xfd3e('0x31')]['length']?_0x1a62a9[_0xfd3e('0x31')]:_0x444313[_0xfd3e('0x2b')];_0x1a62a9[_0xfd3e('0x44')]=qs['sort'](_0x3825c2[_0xfd3e('0x2c')][_0xfd3e('0x34')]);_0x1a62a9['where']=qs[_0xfd3e('0x2e')](_[_0xfd3e('0x45')](_0x3825c2[_0xfd3e('0x2c')],_0x444313[_0xfd3e('0x2e')]));if(_0x3825c2[_0xfd3e('0x2c')]['filter']){_0x1a62a9[_0xfd3e('0x35')]=_[_0xfd3e('0x37')](_0x1a62a9[_0xfd3e('0x35')],{'$or':_[_0xfd3e('0x27')](_0x1a62a9[_0xfd3e('0x31')],function(_0x55b734){var _0x47c9bd={};_0x47c9bd[_0x55b734]={'$like':'%'+_0x3825c2['query'][_0xfd3e('0x36')]+'%'};return _0x47c9bd;})});}_0x1a62a9=_[_0xfd3e('0x37')]({},_0x1a62a9,_0x3825c2[_0xfd3e('0x39')]);return _0x921b9e[_0xfd3e('0x46')](_0x1a62a9);}})[_0xfd3e('0x23')](function(_0x5b9f86){if(_0x5b9f86){_0x5b84ef=_0x5b9f86['length'];if(!_0x3825c2['query']['hasOwnProperty'](_0xfd3e('0x47'))){_0x1a62a9[_0xfd3e('0x1e')]=qs[_0xfd3e('0x1e')](_0x3825c2[_0xfd3e('0x2c')][_0xfd3e('0x1e')]);_0x1a62a9['offset']=qs[_0xfd3e('0x1c')](_0x3825c2['query'][_0xfd3e('0x1c')]);}return _0x921b9e[_0xfd3e('0x46')](_0x1a62a9);}})[_0xfd3e('0x23')](function(_0x2453fa){if(_0x2453fa){return _0x2453fa?{'count':_0x5b84ef,'rows':_0x2453fa}:null;}})[_0xfd3e('0x23')](respondWithResult(_0x2b96b3,null))['catch'](handleError(_0x2b96b3,null));};exports[_0xfd3e('0x48')]=function(_0x546528,_0x5d842e,_0x4751ec){var _0x456cef={};var _0x2a9e92={};var _0x9aafc5;var _0x344324;return db[_0xfd3e('0x3a')][_0xfd3e('0x42')]({'where':{'id':_0x546528[_0xfd3e('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d842e,null))[_0xfd3e('0x23')](function(_0x3b6ad1){if(_0x3b6ad1){_0x9aafc5=_0x3b6ad1;_0x2a9e92[_0xfd3e('0x2b')]=_['keys'](db[_0xfd3e('0x43')]['rawAttributes']);_0x2a9e92[_0xfd3e('0x2c')]=_[_0xfd3e('0x2d')](_0x546528['query']);_0x2a9e92['filters']=_[_0xfd3e('0x2f')](_0x2a9e92[_0xfd3e('0x2b')],_0x2a9e92[_0xfd3e('0x2c')]);_0x456cef[_0xfd3e('0x31')]=_[_0xfd3e('0x2f')](_0x2a9e92[_0xfd3e('0x2b')],qs[_0xfd3e('0x30')](_0x546528['query'][_0xfd3e('0x30')]));_0x456cef['attributes']=_0x456cef['attributes'][_0xfd3e('0x32')]?_0x456cef[_0xfd3e('0x31')]:_0x2a9e92[_0xfd3e('0x2b')];_0x456cef[_0xfd3e('0x44')]=qs['sort'](_0x546528[_0xfd3e('0x2c')]['sort']);_0x456cef['where']=qs[_0xfd3e('0x2e')](_[_0xfd3e('0x45')](_0x546528['query'],_0x2a9e92['filters']));if(_0x546528[_0xfd3e('0x2c')][_0xfd3e('0x36')]){_0x456cef['where']=_[_0xfd3e('0x37')](_0x456cef[_0xfd3e('0x35')],{'$or':_['map'](_0x456cef['attributes'],function(_0x2fe589){var _0x42c177={};_0x42c177[_0x2fe589]={'$like':'%'+_0x546528[_0xfd3e('0x2c')][_0xfd3e('0x36')]+'%'};return _0x42c177;})});}_0x456cef=_['merge']({},_0x456cef,_0x546528[_0xfd3e('0x39')]);return _0x9aafc5[_0xfd3e('0x48')](_0x456cef);}})[_0xfd3e('0x23')](function(_0x195e4e){if(_0x195e4e){_0x344324=_0x195e4e[_0xfd3e('0x32')];if(!_0x546528[_0xfd3e('0x2c')]['hasOwnProperty'](_0xfd3e('0x47'))){_0x456cef[_0xfd3e('0x1e')]=qs[_0xfd3e('0x1e')](_0x546528['query'][_0xfd3e('0x1e')]);_0x456cef[_0xfd3e('0x1c')]=qs[_0xfd3e('0x1c')](_0x546528[_0xfd3e('0x2c')][_0xfd3e('0x1c')]);}return _0x9aafc5[_0xfd3e('0x48')](_0x456cef);}})[_0xfd3e('0x23')](function(_0x27e7c5){if(_0x27e7c5){return _0x27e7c5?{'count':_0x344324,'rows':_0x27e7c5}:null;}})[_0xfd3e('0x23')](respondWithResult(_0x5d842e,null))['catch'](handleError(_0x5d842e,null));};exports['getDescriptions']=function(_0xf63633,_0x4008cc,_0x2ed2e2){var _0x56e61a={};var _0x3d75b8={};var _0x107c82;var _0xaa546f;return db[_0xfd3e('0x3a')][_0xfd3e('0x42')]({'where':{'id':_0xf63633[_0xfd3e('0x41')]['id']}})[_0xfd3e('0x23')](handleEntityNotFound(_0x4008cc,null))['then'](function(_0x3d1de6){if(_0x3d1de6){_0x107c82=_0x3d1de6;_0x3d75b8[_0xfd3e('0x2b')]=_[_0xfd3e('0x2d')](db[_0xfd3e('0x43')][_0xfd3e('0x28')]);_0x3d75b8['query']=_[_0xfd3e('0x2d')](_0xf63633[_0xfd3e('0x2c')]);_0x3d75b8['filters']=_[_0xfd3e('0x2f')](_0x3d75b8[_0xfd3e('0x2b')],_0x3d75b8['query']);_0x56e61a[_0xfd3e('0x31')]=_[_0xfd3e('0x2f')](_0x3d75b8[_0xfd3e('0x2b')],qs[_0xfd3e('0x30')](_0xf63633[_0xfd3e('0x2c')][_0xfd3e('0x30')]));_0x56e61a['attributes']=_0x56e61a[_0xfd3e('0x31')][_0xfd3e('0x32')]?_0x56e61a[_0xfd3e('0x31')]:_0x3d75b8['model'];_0x56e61a[_0xfd3e('0x44')]=qs['sort'](_0xf63633[_0xfd3e('0x2c')][_0xfd3e('0x34')]);_0x56e61a[_0xfd3e('0x35')]=qs['filters'](_[_0xfd3e('0x45')](_0xf63633[_0xfd3e('0x2c')],_0x3d75b8[_0xfd3e('0x2e')]));if(_0xf63633[_0xfd3e('0x2c')][_0xfd3e('0x36')]){_0x56e61a['where']=_[_0xfd3e('0x37')](_0x56e61a[_0xfd3e('0x35')],{'$or':_[_0xfd3e('0x27')](_0x56e61a[_0xfd3e('0x31')],function(_0x5dfe5c){var _0x5c7d36={};_0x5c7d36[_0x5dfe5c]={'$like':'%'+_0xf63633[_0xfd3e('0x2c')]['filter']+'%'};return _0x5c7d36;})});}_0x56e61a=_[_0xfd3e('0x37')]({},_0x56e61a,_0xf63633[_0xfd3e('0x39')]);return _0x107c82[_0xfd3e('0x49')](_0x56e61a);}})[_0xfd3e('0x23')](function(_0x21fa3d){if(_0x21fa3d){_0xaa546f=_0x21fa3d[_0xfd3e('0x32')];if(!_0xf63633[_0xfd3e('0x2c')][_0xfd3e('0x33')]('nolimit')){_0x56e61a[_0xfd3e('0x1e')]=qs[_0xfd3e('0x1e')](_0xf63633[_0xfd3e('0x2c')][_0xfd3e('0x1e')]);_0x56e61a[_0xfd3e('0x1c')]=qs[_0xfd3e('0x1c')](_0xf63633['query'][_0xfd3e('0x1c')]);}return _0x107c82[_0xfd3e('0x49')](_0x56e61a);}})['then'](function(_0x428b82){if(_0x428b82){return _0x428b82?{'count':_0xaa546f,'rows':_0x428b82}:null;}})['then'](respondWithResult(_0x4008cc,null))[_0xfd3e('0x3d')](handleError(_0x4008cc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 408bee1..2db1a56 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 _0xdaf9=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x128ed0,_0x4cd3b8){var _0xe375dd=function(_0x151138){while(--_0x151138){_0x128ed0['push'](_0x128ed0['shift']());}};_0xe375dd(++_0x4cd3b8);}(_0xdaf9,0x130));var _0x9daf=function(_0x4c935e,_0x4d2929){_0x4c935e=_0x4c935e-0x0;var _0x548cc2=_0xdaf9[_0x4c935e];return _0x548cc2;};'use strict';var _=require(_0x9daf('0x0'));var util=require(_0x9daf('0x1'));var logger=require(_0x9daf('0x2'))(_0x9daf('0x3'));var moment=require(_0x9daf('0x4'));var BPromise=require(_0x9daf('0x5'));var rp=require(_0x9daf('0x6'));var fs=require('fs');var path=require(_0x9daf('0x7'));var rimraf=require(_0x9daf('0x8'));var config=require(_0x9daf('0x9'));var attributes=require(_0x9daf('0xa'));module[_0x9daf('0xb')]=function(_0x739a11,_0x3e7706){return _0x739a11[_0x9daf('0xc')](_0x9daf('0xd'),attributes,{'tableName':_0x9daf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29fa=['api','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x1acfcb,_0x38f9b3){var _0x205aa2=function(_0x545e94){while(--_0x545e94){_0x1acfcb['push'](_0x1acfcb['shift']());}};_0x205aa2(++_0x38f9b3);}(_0x29fa,0x1e9));var _0xa29f=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x29fa[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xa29f('0x0'));var util=require(_0xa29f('0x1'));var logger=require(_0xa29f('0x2'))(_0xa29f('0x3'));var moment=require(_0xa29f('0x4'));var BPromise=require(_0xa29f('0x5'));var rp=require(_0xa29f('0x6'));var fs=require('fs');var path=require(_0xa29f('0x7'));var rimraf=require(_0xa29f('0x8'));var config=require('../../config/environment');var attributes=require(_0xa29f('0x9'));module['exports']=function(_0x2034d5,_0x212344){return _0x2034d5['define'](_0xa29f('0xa'),attributes,{'tableName':_0xa29f('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 3e22817..f7b520b 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 _0x264c=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x264c,0x12d));var _0xc264=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0x264c[_0x113e32];return _0x4ff939;};'use strict';var _=require('lodash');var util=require(_0xc264('0x0'));var moment=require(_0xc264('0x1'));var BPromise=require(_0xc264('0x2'));var rs=require(_0xc264('0x3'));var fs=require('fs');var Redis=require(_0xc264('0x4'));var db=require(_0xc264('0x5'))['db'];var utils=require(_0xc264('0x6'));var logger=require(_0xc264('0x7'))('rpc');var config=require(_0xc264('0x8'));var jayson=require(_0xc264('0x9'));var client=jayson[_0xc264('0xa')][_0xc264('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5756b0,_0x267cdd,_0x485023){return new BPromise(function(_0xc1c92f,_0x1fc2c0){return client[_0xc264('0xc')](_0x5756b0,_0x485023)[_0xc264('0xd')](function(_0x54a76b){logger[_0xc264('0xe')](_0xc264('0xf'),_0x267cdd,_0xc264('0x10'));logger[_0xc264('0x11')](_0xc264('0x12'),_0x267cdd,_0xc264('0x10'),JSON[_0xc264('0x13')](_0x54a76b));if(_0x54a76b['error']){if(_0x54a76b[_0xc264('0x14')][_0xc264('0x15')]===0x1f4){logger['error'](_0xc264('0xf'),_0x267cdd,_0x54a76b[_0xc264('0x14')]['message']);return _0x1fc2c0(_0x54a76b[_0xc264('0x14')][_0xc264('0x16')]);}logger[_0xc264('0x14')](_0xc264('0xf'),_0x267cdd,_0x54a76b[_0xc264('0x14')][_0xc264('0x16')]);return _0xc1c92f(_0x54a76b[_0xc264('0x14')][_0xc264('0x16')]);}else{logger[_0xc264('0xe')](_0xc264('0xf'),_0x267cdd,_0xc264('0x10'));_0xc1c92f(_0x54a76b[_0xc264('0x17')]['message']);}})[_0xc264('0x18')](function(_0x580617){logger[_0xc264('0x14')](_0xc264('0xf'),_0x267cdd,_0x580617);_0x1fc2c0(_0x580617);});});} \ No newline at end of file +var _0xff6e=['stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff6e,0x196));var _0xeff6=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0xff6e[_0x3ad7ad];return _0x225a60;};'use strict';var _=require(_0xeff6('0x0'));var util=require(_0xeff6('0x1'));var moment=require(_0xeff6('0x2'));var BPromise=require('bluebird');var rs=require(_0xeff6('0x3'));var fs=require('fs');var Redis=require(_0xeff6('0x4'));var db=require(_0xeff6('0x5'))['db'];var utils=require(_0xeff6('0x6'));var logger=require('../../config/logger')(_0xeff6('0x7'));var config=require(_0xeff6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeff6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xba9a17,_0x48f38e,_0x16156c){return new BPromise(function(_0x7c8076,_0x41af0f){return client[_0xeff6('0xa')](_0xba9a17,_0x16156c)['then'](function(_0xcf9995){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x48f38e,_0xeff6('0xb'));logger[_0xeff6('0xc')](_0xeff6('0xd'),_0x48f38e,_0xeff6('0xb'),JSON[_0xeff6('0xe')](_0xcf9995));if(_0xcf9995['error']){if(_0xcf9995[_0xeff6('0xf')][_0xeff6('0x10')]===0x1f4){logger['error'](_0xeff6('0x11'),_0x48f38e,_0xcf9995[_0xeff6('0xf')][_0xeff6('0x12')]);return _0x41af0f(_0xcf9995[_0xeff6('0xf')][_0xeff6('0x12')]);}logger[_0xeff6('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x48f38e,_0xcf9995[_0xeff6('0xf')]['message']);return _0x7c8076(_0xcf9995[_0xeff6('0xf')][_0xeff6('0x12')]);}else{logger['info'](_0xeff6('0x11'),_0x48f38e,_0xeff6('0xb'));_0x7c8076(_0xcf9995[_0xeff6('0x13')][_0xeff6('0x12')]);}})[_0xeff6('0x14')](function(_0x3e10e2){logger[_0xeff6('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x48f38e,_0x3e10e2);_0x41af0f(_0x3e10e2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index bddd6a2..bf3f622 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 _0xf5b9=['util','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','create','put','update','delete','exports','multer'];(function(_0x54109d,_0x32cdbe){var _0x1de552=function(_0x5d4ee9){while(--_0x5d4ee9){_0x54109d['push'](_0x54109d['shift']());}};_0x1de552(++_0x32cdbe);}(_0xf5b9,0xc3));var _0x9f5b=function(_0x10c6ed,_0x4e8325){_0x10c6ed=_0x10c6ed-0x0;var _0x5a4779=_0xf5b9[_0x10c6ed];return _0x5a4779;};'use strict';var multer=require(_0x9f5b('0x0'));var util=require(_0x9f5b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9f5b('0x2'));var router=express[_0x9f5b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f5b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9f5b('0x5'));var controller=require(_0x9f5b('0x6'));router[_0x9f5b('0x7')]('/',auth[_0x9f5b('0x8')](),controller['index']);router[_0x9f5b('0x7')]('/:id',auth[_0x9f5b('0x8')](),controller['show']);router['post']('/',auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x9')]);router[_0x9f5b('0xa')]('/:id',auth[_0x9f5b('0x8')](),controller[_0x9f5b('0xb')]);router[_0x9f5b('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f5b('0xd')]=router; \ No newline at end of file +var _0x0d1e=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x97db75,_0x3abdb8){var _0x259a53=function(_0x4af802){while(--_0x4af802){_0x97db75['push'](_0x97db75['shift']());}};_0x259a53(++_0x3abdb8);}(_0x0d1e,0x139));var _0xe0d1=function(_0x25334d,_0x3c9762){_0x25334d=_0x25334d-0x0;var _0x17f153=_0x0d1e[_0x25334d];return _0x17f153;};'use strict';var multer=require(_0xe0d1('0x0'));var util=require(_0xe0d1('0x1'));var path=require(_0xe0d1('0x2'));var timeout=require(_0xe0d1('0x3'));var express=require('express');var router=express[_0xe0d1('0x4')]();var fs_extra=require(_0xe0d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe0d1('0x6'));var config=require(_0xe0d1('0x7'));var controller=require(_0xe0d1('0x8'));router[_0xe0d1('0x9')]('/',auth[_0xe0d1('0xa')](),controller[_0xe0d1('0xb')]);router['get'](_0xe0d1('0xc'),auth[_0xe0d1('0xa')](),controller[_0xe0d1('0xd')]);router['post']('/',auth[_0xe0d1('0xa')](),controller[_0xe0d1('0xe')]);router[_0xe0d1('0xf')](_0xe0d1('0xc'),auth[_0xe0d1('0xa')](),controller[_0xe0d1('0x10')]);router[_0xe0d1('0x11')]('/:id',auth[_0xe0d1('0xa')](),controller[_0xe0d1('0x12')]);module[_0xe0d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 2301fbc..2b6becc 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 _0xbafb=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbafb,0xa1));var _0xbbaf=function(_0xd0829d,_0x184418){_0xd0829d=_0xd0829d-0x0;var _0x3f13f5=_0xbafb[_0xd0829d];return _0x3f13f5;};'use strict';var Sequelize=require(_0xbbaf('0x0'));module[_0xbbaf('0x1')]={'type':{'type':Sequelize[_0xbbaf('0x2')](_0xbbaf('0x3'),'variable',_0xbbaf('0x4'),_0xbbaf('0x5'),_0xbbaf('0x6')),'defaultValue':_0xbbaf('0x3')},'content':{'type':Sequelize[_0xbbaf('0x7')]},'key':{'type':Sequelize[_0xbbaf('0x7')]},'keyType':{'type':Sequelize[_0xbbaf('0x2')]('string',_0xbbaf('0x8'),_0xbbaf('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbbaf('0x7')]},'nameField':{'type':Sequelize[_0xbbaf('0x7')]},'customField':{'type':Sequelize[_0xbbaf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbbaf('0x7')]}}; \ No newline at end of file +var _0xab5d=['customVariable','keyValue','STRING','ENUM','BOOLEAN','string','variable'];(function(_0x560ed6,_0x94d645){var _0x606682=function(_0x15e350){while(--_0x15e350){_0x560ed6['push'](_0x560ed6['shift']());}};_0x606682(++_0x94d645);}(_0xab5d,0x12b));var _0xdab5=function(_0xdc62af,_0x50ddd5){_0xdc62af=_0xdc62af-0x0;var _0x4806db=_0xab5d[_0xdc62af];return _0x4806db;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xdab5('0x0'),_0xdab5('0x1'),_0xdab5('0x2'),_0xdab5('0x3'),'picklist'),'defaultValue':_0xdab5('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdab5('0x4')]},'keyType':{'type':Sequelize[_0xdab5('0x5')](_0xdab5('0x0'),_0xdab5('0x1'),_0xdab5('0x2'))},'keyContent':{'type':Sequelize[_0xdab5('0x4')]},'idField':{'type':Sequelize[_0xdab5('0x4')]},'nameField':{'type':Sequelize[_0xdab5('0x4')]},'customField':{'type':Sequelize[_0xdab5('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdab5('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d9df80f..9cab307 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 _0x8139=['length','sort','where','filters','filter','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','show','merge','body','find','params','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','keys','query','intersection','model','fields','attributes'];(function(_0x77a1ff,_0xab2cbd){var _0x51c44f=function(_0xe97f7a){while(--_0xe97f7a){_0x77a1ff['push'](_0x77a1ff['shift']());}};_0x51c44f(++_0xab2cbd);}(_0x8139,0xa7));var _0x9813=function(_0x1ad57c,_0x57f1fd){_0x1ad57c=_0x1ad57c-0x0;var _0xe15dc7=_0x8139[_0x1ad57c];return _0xe15dc7;};'use strict';var emlformat=require(_0x9813('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9813('0x1'));var jsonpatch=require(_0x9813('0x2'));var rp=require('request-promise');var moment=require(_0x9813('0x3'));var BPromise=require(_0x9813('0x4'));var Mustache=require(_0x9813('0x5'));var util=require('util');var path=require(_0x9813('0x6'));var sox=require('sox');var csv=require(_0x9813('0x7'));var ejs=require(_0x9813('0x8'));var fs=require('fs');var fs_extra=require(_0x9813('0x9'));var _=require(_0x9813('0xa'));var squel=require(_0x9813('0xb'));var crypto=require('crypto');var jsforce=require(_0x9813('0xc'));var deskjs=require(_0x9813('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9813('0xe'));var Papa=require(_0x9813('0xf'));var Redis=require(_0x9813('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9813('0x11'));var as=require(_0x9813('0x12'));var hardwareService=require(_0x9813('0x13'));var logger=require(_0x9813('0x14'))(_0x9813('0x15'));var utils=require(_0x9813('0x16'));var config=require(_0x9813('0x17'));var licenseUtil=require(_0x9813('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a610f,_0x3d5cb6){_0x3d5cb6=_0x3d5cb6||0xcc;return function(_0x456490){if(_0x456490){return _0x1a610f['sendStatus'](_0x3d5cb6);}return _0x1a610f[_0x9813('0x19')](_0x3d5cb6)['end']();};}function respondWithResult(_0x1007b9,_0xb7584f){_0xb7584f=_0xb7584f||0xc8;return function(_0x572179){if(_0x572179){return _0x1007b9['status'](_0xb7584f)['json'](_0x572179);}};}function respondWithFilteredResult(_0x5377fa,_0x1ec8b7){return function(_0x3ea077){if(_0x3ea077){var _0x297020=typeof _0x1ec8b7[_0x9813('0x1a')]===_0x9813('0x1b')&&typeof _0x1ec8b7[_0x9813('0x1c')]==='undefined';var _0x5f330d=_0x3ea077[_0x9813('0x1d')];var _0xe660aa=_0x297020?0x0:_0x1ec8b7[_0x9813('0x1a')];var _0x3b60b4=_0x297020?_0x3ea077[_0x9813('0x1d')]:_0x1ec8b7['offset']+_0x1ec8b7['limit'];var _0x3ed642;if(_0x3b60b4>=_0x5f330d){_0x3b60b4=_0x5f330d;_0x3ed642=0xc8;}else{_0x3ed642=0xce;}_0x5377fa[_0x9813('0x19')](_0x3ed642);return _0x5377fa[_0x9813('0x1e')](_0x9813('0x1f'),_0xe660aa+'-'+_0x3b60b4+'/'+_0x5f330d)[_0x9813('0x20')](_0x3ea077);}return null;};}function patchUpdates(_0x68a2c5){return function(_0x481a0e){try{jsonpatch[_0x9813('0x21')](_0x481a0e,_0x68a2c5,!![]);}catch(_0x22bb00){return BPromise[_0x9813('0x22')](_0x22bb00);}return _0x481a0e[_0x9813('0x23')]();};}function saveUpdates(_0x43cdcc,_0x4b7d34){return function(_0x1211f4){if(_0x1211f4){return _0x1211f4[_0x9813('0x24')](_0x43cdcc)['then'](function(_0x1e7497){return _0x1e7497;});}return null;};}function removeEntity(_0xdeedd3,_0x22e65f){return function(_0x982f5c){if(_0x982f5c){return _0x982f5c['destroy']()[_0x9813('0x25')](function(){_0xdeedd3[_0x9813('0x19')](0xcc)[_0x9813('0x26')]();});}};}function handleEntityNotFound(_0x1d4c89,_0x5f2ab9){return function(_0x3f83ee){if(!_0x3f83ee){_0x1d4c89[_0x9813('0x27')](0x194);}return _0x3f83ee;};}function handleError(_0x11654e,_0x25750e){_0x25750e=_0x25750e||0x1f4;return function(_0x2e63b4){logger[_0x9813('0x28')](_0x2e63b4[_0x9813('0x29')]);if(_0x2e63b4[_0x9813('0x2a')]){delete _0x2e63b4[_0x9813('0x2a')];}_0x11654e[_0x9813('0x19')](_0x25750e)[_0x9813('0x2b')](_0x2e63b4);};}exports[_0x9813('0x2c')]=function(_0x2356ed,_0x556c27){var _0x3297df={},_0x269062={},_0x260881={'count':0x0,'rows':[]};var _0x1c72c2=_['map'](db['VtigerField'][_0x9813('0x2d')],function(_0xbff545){return{'name':_0xbff545[_0x9813('0x2e')],'type':_0xbff545['type'][_0x9813('0x2f')]};});_0x269062['model']=_[_0x9813('0x30')](_0x1c72c2,_0x9813('0x2a'));_0x269062['query']=_[_0x9813('0x31')](_0x2356ed[_0x9813('0x32')]);_0x269062['filters']=_[_0x9813('0x33')](_0x269062[_0x9813('0x34')],_0x269062[_0x9813('0x32')]);_0x3297df['attributes']=_[_0x9813('0x33')](_0x269062[_0x9813('0x34')],qs[_0x9813('0x35')](_0x2356ed[_0x9813('0x32')]['fields']));_0x3297df[_0x9813('0x36')]=_0x3297df[_0x9813('0x36')][_0x9813('0x37')]?_0x3297df[_0x9813('0x36')]:_0x269062['model'];if(!_0x2356ed[_0x9813('0x32')]['hasOwnProperty']('nolimit')){_0x3297df[_0x9813('0x1c')]=qs['limit'](_0x2356ed[_0x9813('0x32')][_0x9813('0x1c')]);_0x3297df[_0x9813('0x1a')]=qs[_0x9813('0x1a')](_0x2356ed[_0x9813('0x32')]['offset']);}_0x3297df['order']=qs[_0x9813('0x38')](_0x2356ed['query'][_0x9813('0x38')]);_0x3297df[_0x9813('0x39')]=qs[_0x9813('0x3a')](_['pick'](_0x2356ed[_0x9813('0x32')],_0x269062[_0x9813('0x3a')]),_0x1c72c2);if(_0x2356ed[_0x9813('0x32')][_0x9813('0x3b')]){_0x3297df['where']=_['merge'](_0x3297df['where'],{'$or':_[_0x9813('0x30')](_0x1c72c2,function(_0x107292){if(_0x107292['type']!==_0x9813('0x3c')){var _0x1188e8={};_0x1188e8[_0x107292[_0x9813('0x2a')]]={'$like':'%'+_0x2356ed[_0x9813('0x32')][_0x9813('0x3b')]+'%'};return _0x1188e8;}})});}_0x3297df=_['merge']({},_0x3297df,_0x2356ed[_0x9813('0x3d')]);var _0x35b133={'where':_0x3297df[_0x9813('0x39')]};return db[_0x9813('0x3e')]['count'](_0x35b133)[_0x9813('0x25')](function(_0x36b76c){_0x260881['count']=_0x36b76c;if(_0x2356ed[_0x9813('0x32')][_0x9813('0x3f')]){_0x3297df[_0x9813('0x40')]=[{'all':!![]}];}return db[_0x9813('0x3e')][_0x9813('0x41')](_0x3297df);})[_0x9813('0x25')](function(_0x2f0094){_0x260881[_0x9813('0x42')]=_0x2f0094;return _0x260881;})[_0x9813('0x25')](respondWithFilteredResult(_0x556c27,_0x3297df))[_0x9813('0x43')](handleError(_0x556c27,null));};exports[_0x9813('0x44')]=function(_0x1b3307,_0x34eb94){var _0x1a7f0d={'raw':!![],'where':{'id':_0x1b3307['params']['id']}},_0x3e97c1={};_0x3e97c1[_0x9813('0x34')]=_['keys'](db[_0x9813('0x3e')][_0x9813('0x2d')]);_0x3e97c1[_0x9813('0x32')]=_['keys'](_0x1b3307['query']);_0x3e97c1[_0x9813('0x3a')]=_[_0x9813('0x33')](_0x3e97c1[_0x9813('0x34')],_0x3e97c1[_0x9813('0x32')]);_0x1a7f0d[_0x9813('0x36')]=_[_0x9813('0x33')](_0x3e97c1[_0x9813('0x34')],qs[_0x9813('0x35')](_0x1b3307[_0x9813('0x32')][_0x9813('0x35')]));_0x1a7f0d[_0x9813('0x36')]=_0x1a7f0d['attributes'][_0x9813('0x37')]?_0x1a7f0d[_0x9813('0x36')]:_0x3e97c1[_0x9813('0x34')];if(_0x1b3307[_0x9813('0x32')][_0x9813('0x3f')]){_0x1a7f0d['include']=[{'all':!![]}];}_0x1a7f0d=_[_0x9813('0x45')]({},_0x1a7f0d,_0x1b3307[_0x9813('0x3d')]);return db[_0x9813('0x3e')]['find'](_0x1a7f0d)[_0x9813('0x25')](handleEntityNotFound(_0x34eb94,null))[_0x9813('0x25')](respondWithResult(_0x34eb94,null))[_0x9813('0x43')](handleError(_0x34eb94,null));};exports['create']=function(_0x484c87,_0x402ddc){return db[_0x9813('0x3e')]['create'](_0x484c87['body'],{})[_0x9813('0x25')](respondWithResult(_0x402ddc,0xc9))[_0x9813('0x43')](handleError(_0x402ddc,null));};exports[_0x9813('0x24')]=function(_0x32473c,_0x2b6347){if(_0x32473c[_0x9813('0x46')]['id']){delete _0x32473c[_0x9813('0x46')]['id'];}return db[_0x9813('0x3e')][_0x9813('0x47')]({'where':{'id':_0x32473c[_0x9813('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b6347,null))['then'](saveUpdates(_0x32473c[_0x9813('0x46')],null))[_0x9813('0x25')](respondWithResult(_0x2b6347,null))[_0x9813('0x43')](handleError(_0x2b6347,null));};exports[_0x9813('0x49')]=function(_0x20d146,_0x4d0116){return db[_0x9813('0x3e')][_0x9813('0x47')]({'where':{'id':_0x20d146[_0x9813('0x48')]['id']}})[_0x9813('0x25')](handleEntityNotFound(_0x4d0116,null))['then'](removeEntity(_0x4d0116,null))[_0x9813('0x43')](handleError(_0x4d0116,null));}; \ No newline at end of file +var _0x6404=['intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','fieldName','type','key','model','query'];(function(_0x987bd5,_0x338b08){var _0xc675dc=function(_0x34d249){while(--_0x34d249){_0x987bd5['push'](_0x987bd5['shift']());}};_0xc675dc(++_0x338b08);}(_0x6404,0x1c6));var _0x4640=function(_0x2df034,_0x36cc17){_0x2df034=_0x2df034-0x0;var _0x3922c2=_0x6404[_0x2df034];return _0x3922c2;};'use strict';var emlformat=require(_0x4640('0x0'));var rimraf=require(_0x4640('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4640('0x2'));var rp=require(_0x4640('0x3'));var moment=require(_0x4640('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4640('0x5'));var path=require('path');var sox=require(_0x4640('0x6'));var csv=require(_0x4640('0x7'));var ejs=require(_0x4640('0x8'));var fs=require('fs');var fs_extra=require(_0x4640('0x9'));var _=require(_0x4640('0xa'));var squel=require(_0x4640('0xb'));var crypto=require(_0x4640('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4640('0xd'));var toCsv=require(_0x4640('0x7'));var querystring=require('querystring');var Papa=require(_0x4640('0xe'));var Redis=require(_0x4640('0xf'));var authService=require(_0x4640('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4640('0x11'));var hardwareService=require(_0x4640('0x12'));var logger=require(_0x4640('0x13'))(_0x4640('0x14'));var utils=require(_0x4640('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4640('0x16'));var db=require(_0x4640('0x17'))['db'];function respondWithStatusCode(_0x2cfb77,_0x3bd97b){_0x3bd97b=_0x3bd97b||0xcc;return function(_0x2808d){if(_0x2808d){return _0x2cfb77[_0x4640('0x18')](_0x3bd97b);}return _0x2cfb77[_0x4640('0x19')](_0x3bd97b)[_0x4640('0x1a')]();};}function respondWithResult(_0x486821,_0x3e6e57){_0x3e6e57=_0x3e6e57||0xc8;return function(_0x295e07){if(_0x295e07){return _0x486821['status'](_0x3e6e57)[_0x4640('0x1b')](_0x295e07);}};}function respondWithFilteredResult(_0x3a45a7,_0x3a1d41){return function(_0x391c15){if(_0x391c15){var _0xbbd1c6=typeof _0x3a1d41[_0x4640('0x1c')]===_0x4640('0x1d')&&typeof _0x3a1d41[_0x4640('0x1e')]===_0x4640('0x1d');var _0x59a101=_0x391c15[_0x4640('0x1f')];var _0x5c7200=_0xbbd1c6?0x0:_0x3a1d41['offset'];var _0xe90c2f=_0xbbd1c6?_0x391c15['count']:_0x3a1d41[_0x4640('0x1c')]+_0x3a1d41['limit'];var _0x414f5f;if(_0xe90c2f>=_0x59a101){_0xe90c2f=_0x59a101;_0x414f5f=0xc8;}else{_0x414f5f=0xce;}_0x3a45a7[_0x4640('0x19')](_0x414f5f);return _0x3a45a7['set']('Content-Range',_0x5c7200+'-'+_0xe90c2f+'/'+_0x59a101)['json'](_0x391c15);}return null;};}function patchUpdates(_0xbe98bc){return function(_0x2578c6){try{jsonpatch[_0x4640('0x20')](_0x2578c6,_0xbe98bc,!![]);}catch(_0x292a05){return BPromise[_0x4640('0x21')](_0x292a05);}return _0x2578c6[_0x4640('0x22')]();};}function saveUpdates(_0x438abe,_0x39dbca){return function(_0x46c7bf){if(_0x46c7bf){return _0x46c7bf[_0x4640('0x23')](_0x438abe)[_0x4640('0x24')](function(_0x5a01c6){return _0x5a01c6;});}return null;};}function removeEntity(_0x1e4ddc,_0x5b03b3){return function(_0x178490){if(_0x178490){return _0x178490[_0x4640('0x25')]()[_0x4640('0x24')](function(){_0x1e4ddc[_0x4640('0x19')](0xcc)[_0x4640('0x1a')]();});}};}function handleEntityNotFound(_0xb7a654,_0x5ae9f1){return function(_0x90de0a){if(!_0x90de0a){_0xb7a654['sendStatus'](0x194);}return _0x90de0a;};}function handleError(_0x13c823,_0x27b60a){_0x27b60a=_0x27b60a||0x1f4;return function(_0x3bebfd){logger[_0x4640('0x26')](_0x3bebfd[_0x4640('0x27')]);if(_0x3bebfd[_0x4640('0x28')]){delete _0x3bebfd[_0x4640('0x28')];}_0x13c823[_0x4640('0x19')](_0x27b60a)[_0x4640('0x29')](_0x3bebfd);};}exports[_0x4640('0x2a')]=function(_0x137bde,_0x6bc563){var _0x225634={},_0x1e20a5={},_0x17253a={'count':0x0,'rows':[]};var _0x15e507=_[_0x4640('0x2b')](db[_0x4640('0x2c')]['rawAttributes'],function(_0x5c2d8e){return{'name':_0x5c2d8e[_0x4640('0x2d')],'type':_0x5c2d8e[_0x4640('0x2e')][_0x4640('0x2f')]};});_0x1e20a5[_0x4640('0x30')]=_[_0x4640('0x2b')](_0x15e507,_0x4640('0x28'));_0x1e20a5[_0x4640('0x31')]=_['keys'](_0x137bde[_0x4640('0x31')]);_0x1e20a5['filters']=_[_0x4640('0x32')](_0x1e20a5[_0x4640('0x30')],_0x1e20a5['query']);_0x225634[_0x4640('0x33')]=_[_0x4640('0x32')](_0x1e20a5['model'],qs[_0x4640('0x34')](_0x137bde[_0x4640('0x31')][_0x4640('0x34')]));_0x225634[_0x4640('0x33')]=_0x225634[_0x4640('0x33')][_0x4640('0x35')]?_0x225634[_0x4640('0x33')]:_0x1e20a5[_0x4640('0x30')];if(!_0x137bde[_0x4640('0x31')]['hasOwnProperty']('nolimit')){_0x225634['limit']=qs['limit'](_0x137bde[_0x4640('0x31')]['limit']);_0x225634[_0x4640('0x1c')]=qs[_0x4640('0x1c')](_0x137bde[_0x4640('0x31')][_0x4640('0x1c')]);}_0x225634[_0x4640('0x36')]=qs[_0x4640('0x37')](_0x137bde[_0x4640('0x31')][_0x4640('0x37')]);_0x225634[_0x4640('0x38')]=qs[_0x4640('0x39')](_[_0x4640('0x3a')](_0x137bde['query'],_0x1e20a5[_0x4640('0x39')]),_0x15e507);if(_0x137bde[_0x4640('0x31')][_0x4640('0x3b')]){_0x225634[_0x4640('0x38')]=_[_0x4640('0x3c')](_0x225634[_0x4640('0x38')],{'$or':_[_0x4640('0x2b')](_0x15e507,function(_0x19a8cb){if(_0x19a8cb[_0x4640('0x2e')]!=='VIRTUAL'){var _0x5c3e18={};_0x5c3e18[_0x19a8cb[_0x4640('0x28')]]={'$like':'%'+_0x137bde['query']['filter']+'%'};return _0x5c3e18;}})});}_0x225634=_[_0x4640('0x3c')]({},_0x225634,_0x137bde[_0x4640('0x3d')]);var _0xe24c9c={'where':_0x225634[_0x4640('0x38')]};return db[_0x4640('0x2c')][_0x4640('0x1f')](_0xe24c9c)['then'](function(_0x8546d3){_0x17253a[_0x4640('0x1f')]=_0x8546d3;if(_0x137bde[_0x4640('0x31')][_0x4640('0x3e')]){_0x225634[_0x4640('0x3f')]=[{'all':!![]}];}return db[_0x4640('0x2c')]['findAll'](_0x225634);})[_0x4640('0x24')](function(_0x535e4f){_0x17253a[_0x4640('0x40')]=_0x535e4f;return _0x17253a;})['then'](respondWithFilteredResult(_0x6bc563,_0x225634))[_0x4640('0x41')](handleError(_0x6bc563,null));};exports['show']=function(_0x290ab1,_0x27495b){var _0x2d5da0={'raw':!![],'where':{'id':_0x290ab1[_0x4640('0x42')]['id']}},_0x21fc4e={};_0x21fc4e[_0x4640('0x30')]=_[_0x4640('0x43')](db[_0x4640('0x2c')][_0x4640('0x44')]);_0x21fc4e[_0x4640('0x31')]=_[_0x4640('0x43')](_0x290ab1['query']);_0x21fc4e['filters']=_[_0x4640('0x32')](_0x21fc4e[_0x4640('0x30')],_0x21fc4e[_0x4640('0x31')]);_0x2d5da0[_0x4640('0x33')]=_['intersection'](_0x21fc4e['model'],qs['fields'](_0x290ab1[_0x4640('0x31')][_0x4640('0x34')]));_0x2d5da0[_0x4640('0x33')]=_0x2d5da0['attributes'][_0x4640('0x35')]?_0x2d5da0['attributes']:_0x21fc4e[_0x4640('0x30')];if(_0x290ab1[_0x4640('0x31')][_0x4640('0x3e')]){_0x2d5da0['include']=[{'all':!![]}];}_0x2d5da0=_[_0x4640('0x3c')]({},_0x2d5da0,_0x290ab1[_0x4640('0x3d')]);return db['VtigerField'][_0x4640('0x45')](_0x2d5da0)[_0x4640('0x24')](handleEntityNotFound(_0x27495b,null))[_0x4640('0x24')](respondWithResult(_0x27495b,null))[_0x4640('0x41')](handleError(_0x27495b,null));};exports[_0x4640('0x46')]=function(_0x82689d,_0x2be789){return db['VtigerField']['create'](_0x82689d[_0x4640('0x47')],{})[_0x4640('0x24')](respondWithResult(_0x2be789,0xc9))[_0x4640('0x41')](handleError(_0x2be789,null));};exports[_0x4640('0x23')]=function(_0x1dcce5,_0x146872){if(_0x1dcce5[_0x4640('0x47')]['id']){delete _0x1dcce5[_0x4640('0x47')]['id'];}return db[_0x4640('0x2c')][_0x4640('0x45')]({'where':{'id':_0x1dcce5[_0x4640('0x42')]['id']}})[_0x4640('0x24')](handleEntityNotFound(_0x146872,null))[_0x4640('0x24')](saveUpdates(_0x1dcce5[_0x4640('0x47')],null))[_0x4640('0x24')](respondWithResult(_0x146872,null))['catch'](handleError(_0x146872,null));};exports[_0x4640('0x25')]=function(_0x4722ae,_0x239a4d){return db[_0x4640('0x2c')]['find']({'where':{'id':_0x4722ae[_0x4640('0x42')]['id']}})[_0x4640('0x24')](handleEntityNotFound(_0x239a4d,null))[_0x4640('0x24')](removeEntity(_0x239a4d,null))[_0x4640('0x41')](handleError(_0x239a4d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 019e6a7..7cce819 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 _0xcc8a=['moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xcc8a,0x178));var _0xacc8=function(_0x252938,_0x2461a6){_0x252938=_0x252938-0x0;var _0x95f9e6=_0xcc8a[_0x252938];return _0x95f9e6;};'use strict';var _=require(_0xacc8('0x0'));var util=require(_0xacc8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xacc8('0x2'));var BPromise=require(_0xacc8('0x3'));var rp=require(_0xacc8('0x4'));var fs=require('fs');var path=require(_0xacc8('0x5'));var rimraf=require(_0xacc8('0x6'));var config=require('../../config/environment');var attributes=require(_0xacc8('0x7'));module[_0xacc8('0x8')]=function(_0x59799d,_0x1b501c){return _0x59799d[_0xacc8('0x9')](_0xacc8('0xa'),attributes,{'tableName':_0xacc8('0xb'),'paranoid':![],'indexes':[{'name':_0xacc8('0xc'),'fields':['idField',_0xacc8('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95a2=['../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x145a26,_0x272dbe){var _0x2314d3=function(_0x482e17){while(--_0x482e17){_0x145a26['push'](_0x145a26['shift']());}};_0x2314d3(++_0x272dbe);}(_0x95a2,0x1d5));var _0x295a=function(_0x57d45b,_0x4651d5){_0x57d45b=_0x57d45b-0x0;var _0x4ceefb=_0x95a2[_0x57d45b];return _0x4ceefb;};'use strict';var _=require(_0x295a('0x0'));var util=require(_0x295a('0x1'));var logger=require('../../config/logger')(_0x295a('0x2'));var moment=require(_0x295a('0x3'));var BPromise=require(_0x295a('0x4'));var rp=require(_0x295a('0x5'));var fs=require('fs');var path=require(_0x295a('0x6'));var rimraf=require('rimraf');var config=require(_0x295a('0x7'));var attributes=require(_0x295a('0x8'));module['exports']=function(_0x769b05,_0x3d5744){return _0x769b05[_0x295a('0x9')](_0x295a('0xa'),attributes,{'tableName':_0x295a('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x295a('0xc'),_0x295a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 022517d..8ea4b1c 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 _0x6b19=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b19,0xe8));var _0x96b1=function(_0x25c3b8,_0x13a873){_0x25c3b8=_0x25c3b8-0x0;var _0x3454b3=_0x6b19[_0x25c3b8];return _0x3454b3;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require('moment');var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require(_0x96b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e1a,_0x572fde,_0x57a23a){return new BPromise(function(_0x307e65,_0x535cc9){return client[_0x96b1('0x9')](_0x3e3e1a,_0x57a23a)['then'](function(_0x36ea50){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x572fde,_0x96b1('0xc'),JSON['stringify'](_0x36ea50));if(_0x36ea50['error']){if(_0x36ea50[_0x96b1('0xf')]['code']===0x1f4){logger['error'](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x535cc9(_0x36ea50['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x307e65(_0x36ea50['error'][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));_0x307e65(_0x36ea50[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x2d5a32){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x2d5a32);_0x535cc9(_0x2d5a32);});});} \ No newline at end of file +var _0xfa9d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','moment','bluebird','randomstring'];(function(_0x149816,_0x51b4ff){var _0x3ddaa0=function(_0x55ff79){while(--_0x55ff79){_0x149816['push'](_0x149816['shift']());}};_0x3ddaa0(++_0x51b4ff);}(_0xfa9d,0x1c9));var _0xdfa9=function(_0x541566,_0x34445d){_0x541566=_0x541566-0x0;var _0x5b2cbb=_0xfa9d[_0x541566];return _0x5b2cbb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdfa9('0x0'));var BPromise=require(_0xdfa9('0x1'));var rs=require(_0xdfa9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfa9('0x3'))['db'];var utils=require(_0xdfa9('0x4'));var logger=require(_0xdfa9('0x5'))(_0xdfa9('0x6'));var config=require(_0xdfa9('0x7'));var jayson=require(_0xdfa9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f89cb,_0xa9322e,_0x5aa32f){return new BPromise(function(_0x4bd3ad,_0x12a54e){return client[_0xdfa9('0x9')](_0x3f89cb,_0x5aa32f)[_0xdfa9('0xa')](function(_0x933f01){logger['info'](_0xdfa9('0xb'),_0xa9322e,_0xdfa9('0xc'));logger[_0xdfa9('0xd')](_0xdfa9('0xe'),_0xa9322e,_0xdfa9('0xc'),JSON[_0xdfa9('0xf')](_0x933f01));if(_0x933f01['error']){if(_0x933f01['error']['code']===0x1f4){logger[_0xdfa9('0x10')]('VtigerField,\x20%s,\x20%s',_0xa9322e,_0x933f01['error'][_0xdfa9('0x11')]);return _0x12a54e(_0x933f01['error'][_0xdfa9('0x11')]);}logger['error'](_0xdfa9('0xb'),_0xa9322e,_0x933f01['error'][_0xdfa9('0x11')]);return _0x4bd3ad(_0x933f01[_0xdfa9('0x10')][_0xdfa9('0x11')]);}else{logger[_0xdfa9('0x12')](_0xdfa9('0xb'),_0xa9322e,_0xdfa9('0xc'));_0x4bd3ad(_0x933f01[_0xdfa9('0x13')][_0xdfa9('0x11')]);}})['catch'](function(_0x4db4c0){logger[_0xdfa9('0x10')]('VtigerField,\x20%s,\x20%s',_0xa9322e,_0x4db4c0);_0x12a54e(_0x4db4c0);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index b0d68da..0df1073 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 _0xba46=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba46,0x141));var _0x6ba4=function(_0x2eab40,_0x44f6e5){_0x2eab40=_0x2eab40-0x0;var _0x1570cf=_0xba46[_0x2eab40];return _0x1570cf;};'use strict';var multer=require(_0x6ba4('0x0'));var util=require(_0x6ba4('0x1'));var path=require(_0x6ba4('0x2'));var timeout=require(_0x6ba4('0x3'));var express=require(_0x6ba4('0x4'));var router=express[_0x6ba4('0x5')]();var fs_extra=require(_0x6ba4('0x6'));var auth=require(_0x6ba4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6ba4('0x8'));var controller=require(_0x6ba4('0x9'));router[_0x6ba4('0xa')]('/',auth[_0x6ba4('0xb')](),controller[_0x6ba4('0xc')]);router[_0x6ba4('0xa')](_0x6ba4('0xd'),auth[_0x6ba4('0xb')](),controller['show']);router[_0x6ba4('0xa')](_0x6ba4('0xe'),auth[_0x6ba4('0xb')](),controller['getConfigurations']);router[_0x6ba4('0xa')](_0x6ba4('0xf'),auth[_0x6ba4('0xb')](),controller['getFields']);router[_0x6ba4('0x10')]('/',auth[_0x6ba4('0xb')](),controller[_0x6ba4('0x11')]);router[_0x6ba4('0x10')](_0x6ba4('0xe'),auth['isAuthenticated'](),controller[_0x6ba4('0x12')]);router[_0x6ba4('0x13')]('/:id',auth[_0x6ba4('0xb')](),controller[_0x6ba4('0x14')]);router[_0x6ba4('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6ba4('0x16')]=router; \ No newline at end of file +var _0x2645=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra'];(function(_0x1c288b,_0x377b72){var _0x5d9225=function(_0x3c1a9e){while(--_0x3c1a9e){_0x1c288b['push'](_0x1c288b['shift']());}};_0x5d9225(++_0x377b72);}(_0x2645,0x6e));var _0x5264=function(_0x5d9db3,_0x59fe3d){_0x5d9db3=_0x5d9db3-0x0;var _0x4f1b9f=_0x2645[_0x5d9db3];return _0x4f1b9f;};'use strict';var multer=require(_0x5264('0x0'));var util=require(_0x5264('0x1'));var path=require('path');var timeout=require(_0x5264('0x2'));var express=require('express');var router=express[_0x5264('0x3')]();var fs_extra=require(_0x5264('0x4'));var auth=require(_0x5264('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5264('0x6'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x5264('0x7')](),controller[_0x5264('0x8')]);router[_0x5264('0x9')](_0x5264('0xa'),auth[_0x5264('0x7')](),controller[_0x5264('0xb')]);router['get'](_0x5264('0xc'),auth[_0x5264('0x7')](),controller[_0x5264('0xd')]);router[_0x5264('0x9')](_0x5264('0xe'),auth[_0x5264('0x7')](),controller[_0x5264('0xf')]);router[_0x5264('0x10')]('/',auth['isAuthenticated'](),controller[_0x5264('0x11')]);router[_0x5264('0x10')](_0x5264('0xc'),auth[_0x5264('0x7')](),controller[_0x5264('0x12')]);router[_0x5264('0x13')](_0x5264('0xa'),auth[_0x5264('0x7')](),controller[_0x5264('0x14')]);router[_0x5264('0x15')](_0x5264('0xa'),auth['isAuthenticated'](),controller[_0x5264('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 2a3231f..add37c9 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 _0xf03a=['exports','STRING','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xf03a,0x1a0));var _0xaf03=function(_0x10b92f,_0x58e0a8){_0x10b92f=_0x10b92f-0x0;var _0x5bfd2e=_0xf03a[_0x10b92f];return _0x5bfd2e;};'use strict';var Sequelize=require('sequelize');module[_0xaf03('0x0')]={'name':{'type':Sequelize[_0xaf03('0x1')]},'description':{'type':Sequelize[_0xaf03('0x1')]},'username':{'type':Sequelize[_0xaf03('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xaf03('0x1')]},'token':{'type':Sequelize[_0xaf03('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xaf03('0x2')},'authType':{'type':Sequelize[_0xaf03('0x3')](_0xaf03('0x4'),_0xaf03('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xaf03('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaf03('0x6'),_0xaf03('0x7')),'defaultValue':_0xaf03('0x6')}}; \ No newline at end of file +var _0x27fb=['password','integrationTab','sequelize','exports','STRING','ENUM','token'];(function(_0x3b0c1d,_0xb0ddb0){var _0x574a3c=function(_0x234854){while(--_0x234854){_0x3b0c1d['push'](_0x3b0c1d['shift']());}};_0x574a3c(++_0xb0ddb0);}(_0x27fb,0x1de));var _0xb27f=function(_0x4228a9,_0x40d3a3){_0x4228a9=_0x4228a9-0x0;var _0xdbce4a=_0x27fb[_0x4228a9];return _0xdbce4a;};'use strict';var Sequelize=require(_0xb27f('0x0'));module[_0xb27f('0x1')]={'name':{'type':Sequelize[_0xb27f('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb27f('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb27f('0x2')]},'token':{'type':Sequelize[_0xb27f('0x2')]},'remoteUri':{'type':Sequelize[_0xb27f('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xb27f('0x3')]('password',_0xb27f('0x4')),'defaultValue':_0xb27f('0x5')},'serverUrl':{'type':Sequelize[_0xb27f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb27f('0x3')](_0xb27f('0x6'),'newTab'),'defaultValue':_0xb27f('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8defd69..e7310a6 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 _0x63a5=['username','password','token','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','rows','params','length','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields'];(function(_0x3dd441,_0x4d25b4){var _0x1f5833=function(_0x305ca6){while(--_0x305ca6){_0x3dd441['push'](_0x3dd441['shift']());}};_0x1f5833(++_0x4d25b4);}(_0x63a5,0x18e));var _0x563a=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x63a5[_0x2261ce];return _0x524640;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x563a('0x19'));function respondWithStatusCode(_0x214f42,_0x10de2e){_0x10de2e=_0x10de2e||0xcc;return function(_0x27034c){if(_0x27034c){return _0x214f42[_0x563a('0x1a')](_0x10de2e);}return _0x214f42[_0x563a('0x1b')](_0x10de2e)['end']();};}function respondWithResult(_0x2cf052,_0x3045ac){_0x3045ac=_0x3045ac||0xc8;return function(_0x8c3727){if(_0x8c3727){return _0x2cf052[_0x563a('0x1b')](_0x3045ac)['json'](_0x8c3727);}};}function respondWithFilteredResult(_0x504cb7,_0x414535){return function(_0x2ad667){if(_0x2ad667){var _0x5b291f=typeof _0x414535[_0x563a('0x1c')]===_0x563a('0x1d')&&typeof _0x414535[_0x563a('0x1e')]===_0x563a('0x1d');var _0x4f947d=_0x2ad667['count'];var _0xe3d2bd=_0x5b291f?0x0:_0x414535[_0x563a('0x1c')];var _0x54a3b4=_0x5b291f?_0x2ad667['count']:_0x414535['offset']+_0x414535['limit'];var _0x4c15c1;if(_0x54a3b4>=_0x4f947d){_0x54a3b4=_0x4f947d;_0x4c15c1=0xc8;}else{_0x4c15c1=0xce;}_0x504cb7[_0x563a('0x1b')](_0x4c15c1);return _0x504cb7[_0x563a('0x1f')](_0x563a('0x20'),_0xe3d2bd+'-'+_0x54a3b4+'/'+_0x4f947d)[_0x563a('0x21')](_0x2ad667);}return null;};}function patchUpdates(_0x562fce){return function(_0x4e3b67){try{jsonpatch[_0x563a('0x22')](_0x4e3b67,_0x562fce,!![]);}catch(_0x9f8b29){return BPromise[_0x563a('0x23')](_0x9f8b29);}return _0x4e3b67[_0x563a('0x24')]();};}function saveUpdates(_0x1bf502,_0x2dc7e2){return function(_0x44b460){if(_0x44b460){return _0x44b460[_0x563a('0x25')](_0x1bf502)['then'](function(_0xd59ba8){return _0xd59ba8;});}return null;};}function removeEntity(_0x5422f6,_0x44e2c1){return function(_0xd3e0ae){if(_0xd3e0ae){return _0xd3e0ae[_0x563a('0x26')]()[_0x563a('0x27')](function(){_0x5422f6[_0x563a('0x1b')](0xcc)[_0x563a('0x28')]();});}};}function handleEntityNotFound(_0x3642b3,_0x173990){return function(_0x4de4c3){if(!_0x4de4c3){_0x3642b3[_0x563a('0x1a')](0x194);}return _0x4de4c3;};}function handleError(_0x2b688e,_0x2311f2){_0x2311f2=_0x2311f2||0x1f4;return function(_0x3d79ac){logger[_0x563a('0x29')](_0x3d79ac[_0x563a('0x2a')]);if(_0x3d79ac[_0x563a('0x2b')]){delete _0x3d79ac[_0x563a('0x2b')];}_0x2b688e[_0x563a('0x1b')](_0x2311f2)[_0x563a('0x2c')](_0x3d79ac);};}exports[_0x563a('0x2d')]=function(_0x24d1a8,_0x1bdfb0){var _0x7696c2={},_0x579cb5={},_0x43379c={'count':0x0,'rows':[]};var _0x3c16d0=_[_0x563a('0x2e')](db['ZendeskAccount'][_0x563a('0x2f')],function(_0x2e5c4b){return{'name':_0x2e5c4b[_0x563a('0x30')],'type':_0x2e5c4b[_0x563a('0x31')][_0x563a('0x32')]};});_0x579cb5[_0x563a('0x33')]=_[_0x563a('0x2e')](_0x3c16d0,'name');_0x579cb5[_0x563a('0x34')]=_[_0x563a('0x35')](_0x24d1a8[_0x563a('0x34')]);_0x579cb5[_0x563a('0x36')]=_[_0x563a('0x37')](_0x579cb5['model'],_0x579cb5['query']);_0x7696c2['attributes']=_['intersection'](_0x579cb5[_0x563a('0x33')],qs[_0x563a('0x38')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x38')]));_0x7696c2[_0x563a('0x39')]=_0x7696c2[_0x563a('0x39')]['length']?_0x7696c2['attributes']:_0x579cb5[_0x563a('0x33')];if(!_0x24d1a8[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x7696c2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1e')]);_0x7696c2[_0x563a('0x1c')]=qs[_0x563a('0x1c')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1c')]);}_0x7696c2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x3d')]);_0x7696c2['where']=qs[_0x563a('0x36')](_[_0x563a('0x3e')](_0x24d1a8[_0x563a('0x34')],_0x579cb5['filters']),_0x3c16d0);if(_0x24d1a8[_0x563a('0x34')]['filter']){_0x7696c2[_0x563a('0x3f')]=_[_0x563a('0x40')](_0x7696c2['where'],{'$or':_['map'](_0x3c16d0,function(_0x1b48f1){if(_0x1b48f1['type']!==_0x563a('0x41')){var _0x92bd6={};_0x92bd6[_0x1b48f1[_0x563a('0x2b')]]={'$like':'%'+_0x24d1a8[_0x563a('0x34')]['filter']+'%'};return _0x92bd6;}})});}_0x7696c2=_['merge']({},_0x7696c2,_0x24d1a8[_0x563a('0x42')]);var _0x598ee3={'where':_0x7696c2[_0x563a('0x3f')]};return db[_0x563a('0x43')][_0x563a('0x44')](_0x598ee3)[_0x563a('0x27')](function(_0x3a2eb0){_0x43379c[_0x563a('0x44')]=_0x3a2eb0;if(_0x24d1a8[_0x563a('0x34')][_0x563a('0x45')]){_0x7696c2['include']=[{'all':!![]}];}return db[_0x563a('0x43')]['findAll'](_0x7696c2);})[_0x563a('0x27')](function(_0x3de697){_0x43379c[_0x563a('0x46')]=_0x3de697;return _0x43379c;})[_0x563a('0x27')](respondWithFilteredResult(_0x1bdfb0,_0x7696c2))['catch'](handleError(_0x1bdfb0,null));};exports['show']=function(_0x54ac1e,_0x2221d4){var _0x1255da={'raw':![],'where':{'id':_0x54ac1e[_0x563a('0x47')]['id']}},_0x19b18f={};_0x19b18f[_0x563a('0x33')]=_[_0x563a('0x35')](db[_0x563a('0x43')][_0x563a('0x2f')]);_0x19b18f[_0x563a('0x34')]=_[_0x563a('0x35')](_0x54ac1e[_0x563a('0x34')]);_0x19b18f[_0x563a('0x36')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],_0x19b18f[_0x563a('0x34')]);_0x1255da[_0x563a('0x39')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],qs[_0x563a('0x38')](_0x54ac1e['query']['fields']));_0x1255da[_0x563a('0x39')]=_0x1255da[_0x563a('0x39')][_0x563a('0x48')]?_0x1255da[_0x563a('0x39')]:_0x19b18f[_0x563a('0x33')];if(_0x54ac1e[_0x563a('0x34')][_0x563a('0x45')]){_0x1255da[_0x563a('0x49')]=[{'all':!![]}];}_0x1255da=_['merge']({},_0x1255da,_0x54ac1e['options']);return db[_0x563a('0x43')][_0x563a('0x4a')](_0x1255da)[_0x563a('0x27')](handleEntityNotFound(_0x2221d4,null))[_0x563a('0x27')](respondWithResult(_0x2221d4,null))[_0x563a('0x4b')](handleError(_0x2221d4,null));};exports[_0x563a('0x4c')]=function(_0x2689b5,_0x276642){return db['ZendeskAccount'][_0x563a('0x4c')](_0x2689b5[_0x563a('0x4d')],{})['then'](respondWithResult(_0x276642,0xc9))[_0x563a('0x4b')](handleError(_0x276642,null));};exports['update']=function(_0x3ea787,_0xab7b16){if(_0x3ea787[_0x563a('0x4d')]['id']){delete _0x3ea787['body']['id'];}return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x3ea787[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0xab7b16,null))[_0x563a('0x27')](saveUpdates(_0x3ea787[_0x563a('0x4d')],null))[_0x563a('0x27')](respondWithResult(_0xab7b16,null))[_0x563a('0x4b')](handleError(_0xab7b16,null));};exports[_0x563a('0x26')]=function(_0x2008d4,_0x3c98d5){return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x2008d4['params']['id']}})['then'](handleEntityNotFound(_0x3c98d5,null))[_0x563a('0x27')](removeEntity(_0x3c98d5,null))[_0x563a('0x4b')](handleError(_0x3c98d5,null));};exports[_0x563a('0x4e')]=function(_0x4a807f,_0x5ae08f,_0x13530f){var _0x1fc4d2={};var _0x50ebde={};var _0x4b6ba9;var _0x51e142;return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x4a807f[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0x5ae08f,null))[_0x563a('0x27')](function(_0x2805eb){if(_0x2805eb){_0x4b6ba9=_0x2805eb;_0x50ebde['model']=_['keys'](db[_0x563a('0x50')]['rawAttributes']);_0x50ebde[_0x563a('0x34')]=_[_0x563a('0x35')](_0x4a807f[_0x563a('0x34')]);_0x50ebde[_0x563a('0x36')]=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],_0x50ebde[_0x563a('0x34')]);_0x1fc4d2['attributes']=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],qs['fields'](_0x4a807f[_0x563a('0x34')][_0x563a('0x38')]));_0x1fc4d2[_0x563a('0x39')]=_0x1fc4d2[_0x563a('0x39')][_0x563a('0x48')]?_0x1fc4d2[_0x563a('0x39')]:_0x50ebde[_0x563a('0x33')];_0x1fc4d2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x4a807f[_0x563a('0x34')]['sort']);_0x1fc4d2[_0x563a('0x3f')]=qs[_0x563a('0x36')](_['pick'](_0x4a807f['query'],_0x50ebde[_0x563a('0x36')]));if(_0x4a807f[_0x563a('0x34')]['filter']){_0x1fc4d2[_0x563a('0x3f')]=_['merge'](_0x1fc4d2[_0x563a('0x3f')],{'$or':_[_0x563a('0x2e')](_0x1fc4d2[_0x563a('0x39')],function(_0xbe9fff){var _0x7fa423={};_0x7fa423[_0xbe9fff]={'$like':'%'+_0x4a807f['query']['filter']+'%'};return _0x7fa423;})});}_0x1fc4d2=_['merge']({},_0x1fc4d2,_0x4a807f['options']);return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})['then'](function(_0x111444){if(_0x111444){_0x51e142=_0x111444['length'];if(!_0x4a807f[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1fc4d2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4a807f['query'][_0x563a('0x1e')]);_0x1fc4d2['offset']=qs['offset'](_0x4a807f[_0x563a('0x34')][_0x563a('0x1c')]);}return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})[_0x563a('0x27')](function(_0x1c8ad7){if(_0x1c8ad7){return _0x1c8ad7?{'count':_0x51e142,'rows':_0x1c8ad7}:null;}})['then'](respondWithResult(_0x5ae08f,null))[_0x563a('0x4b')](handleError(_0x5ae08f,null));};exports[_0x563a('0x51')]=function(_0x20bd36,_0x3bbe7c,_0x36d40c){if(_0x20bd36['body']['id']){delete _0x20bd36[_0x563a('0x4d')]['id'];}return db['ZendeskAccount'][_0x563a('0x4f')]({'where':{'id':_0x20bd36[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bbe7c,null))[_0x563a('0x27')](function(_0x30bf2b){if(_0x30bf2b){_0x20bd36[_0x563a('0x4d')][_0x563a('0x52')]=_0x30bf2b['id'];_0x20bd36[_0x563a('0x4d')][_0x563a('0x53')]=integrations[_0x563a('0x54')](_0x20bd36[_0x563a('0x4d')]['channel'],_0x20bd36[_0x563a('0x4d')][_0x563a('0x31')]);_0x20bd36[_0x563a('0x4d')][_0x563a('0x55')]=integrations[_0x563a('0x56')](_0x20bd36[_0x563a('0x4d')][_0x563a('0x57')],_0x20bd36['body'][_0x563a('0x31')]);return db['ZendeskConfiguration']['create'](_0x20bd36['body'],{'include':[{'model':db[_0x563a('0x58')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x563a('0x55')}]});}return null;})[_0x563a('0x27')](respondWithResult(_0x3bbe7c,null))[_0x563a('0x4b')](handleError(_0x3bbe7c,null));};exports[_0x563a('0x59')]=function(_0x2e442f,_0x51220c,_0x4814b3){var _0x4c9ad7='';return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x2e442f[_0x563a('0x47')]['id']},'attributes':['id',_0x563a('0x5a'),_0x563a('0x5b'),_0x563a('0x5c'),'authType',_0x563a('0x5d')]})[_0x563a('0x27')](handleEntityNotFound(_0x51220c,null))['then'](function(_0x1983e5){if(_0x1983e5){_0x4c9ad7=_0x1983e5[_0x563a('0x5d')];var _0x15e9ce=_0x4c9ad7['slice'](-0x1);if(_0x15e9ce==='/'){_0x4c9ad7=_0x4c9ad7[_0x563a('0x5e')](0x0,_0x4c9ad7[_0x563a('0x5f')](_0x15e9ce));}var _0x332428={'method':_0x563a('0x60'),'uri':util['format'](_0x563a('0x61'),_0x4c9ad7,_0x563a('0x62')),'json':!![]};switch(_0x1983e5[_0x563a('0x63')]){case _0x563a('0x5b'):_0x332428[_0x563a('0x64')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x563a('0x65')]('%s:%s',_0x1983e5[_0x563a('0x5a')],_0x1983e5[_0x563a('0x5b')]))[_0x563a('0x66')](_0x563a('0x67')))};break;case _0x563a('0x5c'):_0x332428[_0x563a('0x64')]={'Authorization':util[_0x563a('0x65')](_0x563a('0x68'),new Buffer(util[_0x563a('0x65')](_0x563a('0x69'),_0x1983e5['username'],_0x1983e5[_0x563a('0x5c')]))['toString'](_0x563a('0x67')))};break;default:throw new db[(_0x563a('0x6a'))]['ValidationError'](_0x563a('0x6b'));}return rp(_0x332428);}})['then'](function(_0x41f530){if(_0x41f530){var _0x42c448=['subject',_0x563a('0x6c'),_0x563a('0x6d'),_0x563a('0x6e')];_[_0x563a('0x6f')](_0x41f530['ticket_fields'],function(_0x418646){return _0x42c448[_0x563a('0x70')](_0x418646[_0x563a('0x31')]);});return{'count':_0x41f530[_0x563a('0x62')][_0x563a('0x48')],'rows':_[_0x563a('0x2e')](_0x41f530[_0x563a('0x62')],function(_0x137d52){return{'id':_0x137d52['id'],'name':_0x137d52[_0x563a('0x71')]>0x7?_0x137d52[_0x563a('0x72')]:_0x137d52['type'],'custom':_0x137d52[_0x563a('0x71')]>0x7?!![]:![],'options':_0x137d52[_0x563a('0x73')]?_0x137d52[_0x563a('0x73')]:_0x137d52['custom_field_options']?_0x137d52[_0x563a('0x74')]:[]};})};}})[_0x563a('0x27')](respondWithResult(_0x51220c,null))[_0x563a('0x4b')](function(_0xe27e02){var _0x2cca62=_0x2e442f[_0x563a('0x34')][_0x563a('0x75')]?0x1f4:_0xe27e02[_0x563a('0x76')]||0x1f4;logger[_0x563a('0x29')](_0x563a('0x77'),_0x563a('0x59'),_0x2cca62,JSON[_0x563a('0x78')](_0xe27e02));delete _0xe27e02[_0x563a('0x2b')];if(_0x2cca62===0x191){_0x2cca62=0x190;}_0x51220c['status'](_0x2cca62)[_0x563a('0x2c')](_0x2e442f[_0x563a('0x34')]['test']?{'message':_0x563a('0x79'),'statusCode':_0xe27e02[_0x563a('0x76')]}:_0xe27e02);});}; \ No newline at end of file +var _0xeffd=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','json','offset','undefined','count','limit','status','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','send','index','map','ZendeskAccount','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','create','body','find','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','Descriptions','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','username','toString','%s/token:%s','base64','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee','remove','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','name','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x454c0f,_0x19a492){var _0x586d92=function(_0x172eeb){while(--_0x172eeb){_0x454c0f['push'](_0x454c0f['shift']());}};_0x586d92(++_0x19a492);}(_0xeffd,0x6b));var _0xdeff=function(_0x1cf003,_0x9e46bf){_0x1cf003=_0x1cf003-0x0;var _0x58d403=_0xeffd[_0x1cf003];return _0x58d403;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdeff('0x1d'));function respondWithStatusCode(_0x116bf9,_0x4952f2){_0x4952f2=_0x4952f2||0xcc;return function(_0x2e614c){if(_0x2e614c){return _0x116bf9['sendStatus'](_0x4952f2);}return _0x116bf9['status'](_0x4952f2)[_0xdeff('0x1e')]();};}function respondWithResult(_0x47410f,_0x1585e8){_0x1585e8=_0x1585e8||0xc8;return function(_0xb4bc82){if(_0xb4bc82){return _0x47410f['status'](_0x1585e8)[_0xdeff('0x1f')](_0xb4bc82);}};}function respondWithFilteredResult(_0x314ded,_0xea6c4){return function(_0x391633){if(_0x391633){var _0x3dbba1=typeof _0xea6c4[_0xdeff('0x20')]==='undefined'&&typeof _0xea6c4['limit']===_0xdeff('0x21');var _0x4cf724=_0x391633['count'];var _0x35635f=_0x3dbba1?0x0:_0xea6c4[_0xdeff('0x20')];var _0x4b14b6=_0x3dbba1?_0x391633[_0xdeff('0x22')]:_0xea6c4[_0xdeff('0x20')]+_0xea6c4[_0xdeff('0x23')];var _0x3a677a;if(_0x4b14b6>=_0x4cf724){_0x4b14b6=_0x4cf724;_0x3a677a=0xc8;}else{_0x3a677a=0xce;}_0x314ded[_0xdeff('0x24')](_0x3a677a);return _0x314ded[_0xdeff('0x25')](_0xdeff('0x26'),_0x35635f+'-'+_0x4b14b6+'/'+_0x4cf724)[_0xdeff('0x1f')](_0x391633);}return null;};}function patchUpdates(_0x488faa){return function(_0x5591fa){try{jsonpatch['apply'](_0x5591fa,_0x488faa,!![]);}catch(_0x2f3fd6){return BPromise['reject'](_0x2f3fd6);}return _0x5591fa[_0xdeff('0x27')]();};}function saveUpdates(_0x91c0b4,_0x543653){return function(_0x18338c){if(_0x18338c){return _0x18338c[_0xdeff('0x28')](_0x91c0b4)['then'](function(_0x5dbe96){return _0x5dbe96;});}return null;};}function removeEntity(_0x3b2554,_0x15c425){return function(_0x253eed){if(_0x253eed){return _0x253eed[_0xdeff('0x29')]()[_0xdeff('0x2a')](function(){_0x3b2554['status'](0xcc)[_0xdeff('0x1e')]();});}};}function handleEntityNotFound(_0x412db3,_0x3741fb){return function(_0x393659){if(!_0x393659){_0x412db3[_0xdeff('0x2b')](0x194);}return _0x393659;};}function handleError(_0x35823c,_0x3d0111){_0x3d0111=_0x3d0111||0x1f4;return function(_0x52ea5d){logger[_0xdeff('0x2c')](_0x52ea5d[_0xdeff('0x2d')]);if(_0x52ea5d['name']){delete _0x52ea5d['name'];}_0x35823c[_0xdeff('0x24')](_0x3d0111)[_0xdeff('0x2e')](_0x52ea5d);};}exports[_0xdeff('0x2f')]=function(_0xcb819c,_0x533069){var _0xf9b278={},_0xbc75ee={},_0x4e0ff2={'count':0x0,'rows':[]};var _0x331ddc=_[_0xdeff('0x30')](db[_0xdeff('0x31')]['rawAttributes'],function(_0x59f7a0){return{'name':_0x59f7a0[_0xdeff('0x32')],'type':_0x59f7a0['type'][_0xdeff('0x33')]};});_0xbc75ee[_0xdeff('0x34')]=_[_0xdeff('0x30')](_0x331ddc,'name');_0xbc75ee[_0xdeff('0x35')]=_['keys'](_0xcb819c['query']);_0xbc75ee[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0xbc75ee[_0xdeff('0x34')],_0xbc75ee[_0xdeff('0x35')]);_0xf9b278['attributes']=_[_0xdeff('0x37')](_0xbc75ee[_0xdeff('0x34')],qs[_0xdeff('0x38')](_0xcb819c[_0xdeff('0x35')][_0xdeff('0x38')]));_0xf9b278[_0xdeff('0x39')]=_0xf9b278[_0xdeff('0x39')]['length']?_0xf9b278[_0xdeff('0x39')]:_0xbc75ee['model'];if(!_0xcb819c[_0xdeff('0x35')][_0xdeff('0x3a')](_0xdeff('0x3b'))){_0xf9b278[_0xdeff('0x23')]=qs[_0xdeff('0x23')](_0xcb819c[_0xdeff('0x35')]['limit']);_0xf9b278[_0xdeff('0x20')]=qs[_0xdeff('0x20')](_0xcb819c['query'][_0xdeff('0x20')]);}_0xf9b278[_0xdeff('0x3c')]=qs[_0xdeff('0x3d')](_0xcb819c[_0xdeff('0x35')][_0xdeff('0x3d')]);_0xf9b278[_0xdeff('0x3e')]=qs[_0xdeff('0x36')](_[_0xdeff('0x3f')](_0xcb819c['query'],_0xbc75ee[_0xdeff('0x36')]),_0x331ddc);if(_0xcb819c['query'][_0xdeff('0x40')]){_0xf9b278[_0xdeff('0x3e')]=_[_0xdeff('0x41')](_0xf9b278['where'],{'$or':_[_0xdeff('0x30')](_0x331ddc,function(_0x280a86){if(_0x280a86[_0xdeff('0x42')]!==_0xdeff('0x43')){var _0x226028={};_0x226028[_0x280a86['name']]={'$like':'%'+_0xcb819c[_0xdeff('0x35')]['filter']+'%'};return _0x226028;}})});}_0xf9b278=_[_0xdeff('0x41')]({},_0xf9b278,_0xcb819c[_0xdeff('0x44')]);var _0x518280={'where':_0xf9b278[_0xdeff('0x3e')]};return db[_0xdeff('0x31')][_0xdeff('0x22')](_0x518280)[_0xdeff('0x2a')](function(_0x3e2be3){_0x4e0ff2['count']=_0x3e2be3;if(_0xcb819c[_0xdeff('0x35')][_0xdeff('0x45')]){_0xf9b278[_0xdeff('0x46')]=[{'all':!![]}];}return db[_0xdeff('0x31')][_0xdeff('0x47')](_0xf9b278);})['then'](function(_0x5f1110){_0x4e0ff2[_0xdeff('0x48')]=_0x5f1110;return _0x4e0ff2;})[_0xdeff('0x2a')](respondWithFilteredResult(_0x533069,_0xf9b278))[_0xdeff('0x49')](handleError(_0x533069,null));};exports[_0xdeff('0x4a')]=function(_0x3c4fd2,_0x289f70){var _0x2cd68a={'raw':![],'where':{'id':_0x3c4fd2[_0xdeff('0x4b')]['id']}},_0x4f02f5={};_0x4f02f5[_0xdeff('0x34')]=_[_0xdeff('0x4c')](db['ZendeskAccount'][_0xdeff('0x4d')]);_0x4f02f5[_0xdeff('0x35')]=_[_0xdeff('0x4c')](_0x3c4fd2[_0xdeff('0x35')]);_0x4f02f5['filters']=_[_0xdeff('0x37')](_0x4f02f5[_0xdeff('0x34')],_0x4f02f5[_0xdeff('0x35')]);_0x2cd68a[_0xdeff('0x39')]=_[_0xdeff('0x37')](_0x4f02f5[_0xdeff('0x34')],qs[_0xdeff('0x38')](_0x3c4fd2[_0xdeff('0x35')]['fields']));_0x2cd68a[_0xdeff('0x39')]=_0x2cd68a[_0xdeff('0x39')][_0xdeff('0x4e')]?_0x2cd68a[_0xdeff('0x39')]:_0x4f02f5[_0xdeff('0x34')];if(_0x3c4fd2['query'][_0xdeff('0x45')]){_0x2cd68a[_0xdeff('0x46')]=[{'all':!![]}];}_0x2cd68a=_[_0xdeff('0x41')]({},_0x2cd68a,_0x3c4fd2[_0xdeff('0x44')]);return db[_0xdeff('0x31')]['find'](_0x2cd68a)[_0xdeff('0x2a')](handleEntityNotFound(_0x289f70,null))['then'](respondWithResult(_0x289f70,null))[_0xdeff('0x49')](handleError(_0x289f70,null));};exports[_0xdeff('0x4f')]=function(_0x1bf17c,_0x46c428){return db[_0xdeff('0x31')][_0xdeff('0x4f')](_0x1bf17c['body'],{})['then'](respondWithResult(_0x46c428,0xc9))[_0xdeff('0x49')](handleError(_0x46c428,null));};exports[_0xdeff('0x28')]=function(_0x3dc206,_0x49de92){if(_0x3dc206['body']['id']){delete _0x3dc206[_0xdeff('0x50')]['id'];}return db[_0xdeff('0x31')]['find']({'where':{'id':_0x3dc206[_0xdeff('0x4b')]['id']}})[_0xdeff('0x2a')](handleEntityNotFound(_0x49de92,null))[_0xdeff('0x2a')](saveUpdates(_0x3dc206['body'],null))[_0xdeff('0x2a')](respondWithResult(_0x49de92,null))[_0xdeff('0x49')](handleError(_0x49de92,null));};exports[_0xdeff('0x29')]=function(_0x59ae32,_0xce8379){return db[_0xdeff('0x31')][_0xdeff('0x51')]({'where':{'id':_0x59ae32[_0xdeff('0x4b')]['id']}})[_0xdeff('0x2a')](handleEntityNotFound(_0xce8379,null))[_0xdeff('0x2a')](removeEntity(_0xce8379,null))[_0xdeff('0x49')](handleError(_0xce8379,null));};exports['getConfigurations']=function(_0x4517d1,_0x1b90a9,_0x5e0c60){var _0xe5a773={};var _0x1b676b={};var _0x2967b4;var _0x33482b;return db[_0xdeff('0x31')][_0xdeff('0x52')]({'where':{'id':_0x4517d1[_0xdeff('0x4b')]['id']}})[_0xdeff('0x2a')](handleEntityNotFound(_0x1b90a9,null))['then'](function(_0x1b7eb3){if(_0x1b7eb3){_0x2967b4=_0x1b7eb3;_0x1b676b[_0xdeff('0x34')]=_[_0xdeff('0x4c')](db['ZendeskConfiguration']['rawAttributes']);_0x1b676b[_0xdeff('0x35')]=_[_0xdeff('0x4c')](_0x4517d1[_0xdeff('0x35')]);_0x1b676b[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0x1b676b[_0xdeff('0x34')],_0x1b676b['query']);_0xe5a773['attributes']=_[_0xdeff('0x37')](_0x1b676b[_0xdeff('0x34')],qs['fields'](_0x4517d1['query'][_0xdeff('0x38')]));_0xe5a773[_0xdeff('0x39')]=_0xe5a773['attributes'][_0xdeff('0x4e')]?_0xe5a773[_0xdeff('0x39')]:_0x1b676b['model'];_0xe5a773[_0xdeff('0x3c')]=qs[_0xdeff('0x3d')](_0x4517d1['query'][_0xdeff('0x3d')]);_0xe5a773[_0xdeff('0x3e')]=qs['filters'](_[_0xdeff('0x3f')](_0x4517d1[_0xdeff('0x35')],_0x1b676b[_0xdeff('0x36')]));if(_0x4517d1['query']['filter']){_0xe5a773[_0xdeff('0x3e')]=_['merge'](_0xe5a773[_0xdeff('0x3e')],{'$or':_[_0xdeff('0x30')](_0xe5a773[_0xdeff('0x39')],function(_0x34d033){var _0x300955={};_0x300955[_0x34d033]={'$like':'%'+_0x4517d1['query']['filter']+'%'};return _0x300955;})});}_0xe5a773=_[_0xdeff('0x41')]({},_0xe5a773,_0x4517d1[_0xdeff('0x44')]);return _0x2967b4[_0xdeff('0x53')](_0xe5a773);}})[_0xdeff('0x2a')](function(_0x106976){if(_0x106976){_0x33482b=_0x106976[_0xdeff('0x4e')];if(!_0x4517d1['query'][_0xdeff('0x3a')]('nolimit')){_0xe5a773[_0xdeff('0x23')]=qs[_0xdeff('0x23')](_0x4517d1[_0xdeff('0x35')][_0xdeff('0x23')]);_0xe5a773[_0xdeff('0x20')]=qs[_0xdeff('0x20')](_0x4517d1[_0xdeff('0x35')][_0xdeff('0x20')]);}return _0x2967b4[_0xdeff('0x53')](_0xe5a773);}})['then'](function(_0x43f74){if(_0x43f74){return _0x43f74?{'count':_0x33482b,'rows':_0x43f74}:null;}})['then'](respondWithResult(_0x1b90a9,null))[_0xdeff('0x49')](handleError(_0x1b90a9,null));};exports[_0xdeff('0x54')]=function(_0x5a51d4,_0x286e4d,_0x492372){if(_0x5a51d4[_0xdeff('0x50')]['id']){delete _0x5a51d4['body']['id'];}return db['ZendeskAccount'][_0xdeff('0x52')]({'where':{'id':_0x5a51d4[_0xdeff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x286e4d,null))[_0xdeff('0x2a')](function(_0x196e90){if(_0x196e90){_0x5a51d4[_0xdeff('0x50')][_0xdeff('0x55')]=_0x196e90['id'];_0x5a51d4[_0xdeff('0x50')][_0xdeff('0x56')]=integrations[_0xdeff('0x57')](_0x5a51d4[_0xdeff('0x50')][_0xdeff('0x58')],_0x5a51d4['body'][_0xdeff('0x42')]);_0x5a51d4[_0xdeff('0x50')]['Descriptions']=integrations['getDescriptions'](_0x5a51d4[_0xdeff('0x50')][_0xdeff('0x58')],_0x5a51d4['body'][_0xdeff('0x42')]);return db[_0xdeff('0x59')][_0xdeff('0x4f')](_0x5a51d4[_0xdeff('0x50')],{'include':[{'model':db[_0xdeff('0x5a')],'as':_0xdeff('0x56')},{'model':db[_0xdeff('0x5a')],'as':_0xdeff('0x5b')}]});}return null;})[_0xdeff('0x2a')](respondWithResult(_0x286e4d,null))[_0xdeff('0x49')](handleError(_0x286e4d,null));};exports['getFields']=function(_0x221af0,_0x169145,_0x190191){var _0x44bad3='';return db[_0xdeff('0x31')]['findOne']({'where':{'id':_0x221af0['params']['id']},'attributes':['id','username',_0xdeff('0x5c'),_0xdeff('0x5d'),_0xdeff('0x5e'),_0xdeff('0x5f')]})['then'](handleEntityNotFound(_0x169145,null))['then'](function(_0x19de80){if(_0x19de80){_0x44bad3=_0x19de80[_0xdeff('0x5f')];var _0x46e1d5=_0x44bad3[_0xdeff('0x60')](-0x1);if(_0x46e1d5==='/'){_0x44bad3=_0x44bad3[_0xdeff('0x61')](0x0,_0x44bad3[_0xdeff('0x62')](_0x46e1d5));}var _0x1eb1a3={'method':_0xdeff('0x63'),'uri':util['format'](_0xdeff('0x64'),_0x44bad3,_0xdeff('0x65')),'json':!![]};switch(_0x19de80[_0xdeff('0x5e')]){case _0xdeff('0x5c'):_0x1eb1a3[_0xdeff('0x66')]={'Authorization':util[_0xdeff('0x67')](_0xdeff('0x68'),new Buffer(util[_0xdeff('0x67')](_0xdeff('0x69'),_0x19de80[_0xdeff('0x6a')],_0x19de80[_0xdeff('0x5c')]))[_0xdeff('0x6b')]('base64'))};break;case _0xdeff('0x5d'):_0x1eb1a3[_0xdeff('0x66')]={'Authorization':util[_0xdeff('0x67')]('Basic\x20%s',new Buffer(util[_0xdeff('0x67')](_0xdeff('0x6c'),_0x19de80[_0xdeff('0x6a')],_0x19de80[_0xdeff('0x5d')]))['toString'](_0xdeff('0x6d')))};break;default:throw new db[(_0xdeff('0x6e'))]['ValidationError'](_0xdeff('0x6f'));}return rp(_0x1eb1a3);}})[_0xdeff('0x2a')](function(_0x1430e8){if(_0x1430e8){var _0x1cc1d3=[_0xdeff('0x70'),'description',_0xdeff('0x71'),_0xdeff('0x72')];_[_0xdeff('0x73')](_0x1430e8[_0xdeff('0x65')],function(_0xe85561){return _0x1cc1d3['includes'](_0xe85561[_0xdeff('0x42')]);});return{'count':_0x1430e8[_0xdeff('0x65')]['length'],'rows':_[_0xdeff('0x30')](_0x1430e8[_0xdeff('0x65')],function(_0x1fe603){return{'id':_0x1fe603['id'],'name':_0x1fe603['position']>0x7?_0x1fe603[_0xdeff('0x74')]:_0x1fe603[_0xdeff('0x42')],'custom':_0x1fe603['position']>0x7?!![]:![],'options':_0x1fe603[_0xdeff('0x75')]?_0x1fe603[_0xdeff('0x75')]:_0x1fe603[_0xdeff('0x76')]?_0x1fe603[_0xdeff('0x76')]:[]};})};}})['then'](respondWithResult(_0x169145,null))[_0xdeff('0x49')](function(_0x3b8f20){var _0x14a77f=_0x221af0[_0xdeff('0x35')][_0xdeff('0x77')]?0x1f4:_0x3b8f20[_0xdeff('0x78')]||0x1f4;logger[_0xdeff('0x2c')](_0xdeff('0x79'),_0xdeff('0x7a'),_0x14a77f,JSON['stringify'](_0x3b8f20));delete _0x3b8f20[_0xdeff('0x7b')];if(_0x14a77f===0x191){_0x14a77f=0x190;}_0x169145['status'](_0x14a77f)[_0xdeff('0x2e')](_0x221af0['query']['test']?{'message':_0xdeff('0x7c'),'statusCode':_0x3b8f20[_0xdeff('0x78')]}:_0x3b8f20);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c34b3c3..ea20a32 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 _0xef05=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util'];(function(_0x471724,_0x24bd2d){var _0x5eee21=function(_0x143ad6){while(--_0x143ad6){_0x471724['push'](_0x471724['shift']());}};_0x5eee21(++_0x24bd2d);}(_0xef05,0xa7));var _0x5ef0=function(_0x4f8977,_0x3cc58a){_0x4f8977=_0x4f8977-0x0;var _0x2f44d1=_0xef05[_0x4f8977];return _0x2f44d1;};'use strict';var _=require('lodash');var util=require(_0x5ef0('0x0'));var logger=require(_0x5ef0('0x1'))('api');var moment=require(_0x5ef0('0x2'));var BPromise=require(_0x5ef0('0x3'));var rp=require(_0x5ef0('0x4'));var fs=require('fs');var path=require(_0x5ef0('0x5'));var rimraf=require(_0x5ef0('0x6'));var config=require(_0x5ef0('0x7'));var attributes=require(_0x5ef0('0x8'));var integrations=require(_0x5ef0('0x9'));module[_0x5ef0('0xa')]=function(_0x450f04,_0x36e755){return _0x450f04[_0x5ef0('0xb')](_0x5ef0('0xc'),attributes,{'tableName':_0x5ef0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ee=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0xe7ee,0x1e6));var _0xee7e=function(_0x334670,_0x4617a9){_0x334670=_0x334670-0x0;var _0x353cb4=_0xe7ee[_0x334670];return _0x353cb4;};'use strict';var _=require(_0xee7e('0x0'));var util=require(_0xee7e('0x1'));var logger=require('../../config/logger')(_0xee7e('0x2'));var moment=require(_0xee7e('0x3'));var BPromise=require(_0xee7e('0x4'));var rp=require(_0xee7e('0x5'));var fs=require('fs');var path=require(_0xee7e('0x6'));var rimraf=require(_0xee7e('0x7'));var config=require(_0xee7e('0x8'));var attributes=require(_0xee7e('0x9'));var integrations=require(_0xee7e('0xa'));module[_0xee7e('0xb')]=function(_0x24ca2f,_0x18eedb){return _0x24ca2f[_0xee7e('0xc')](_0xee7e('0xd'),attributes,{'tableName':_0xee7e('0xe'),'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 8de8f6c..40850f5 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 _0x27e9=['client','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','catch','ShowZendeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x27e9,0x116));var _0x927e=function(_0x1aaf46,_0x422b70){_0x1aaf46=_0x1aaf46-0x0;var _0x433cf7=_0x27e9[_0x1aaf46];return _0x433cf7;};'use strict';var _=require(_0x927e('0x0'));var util=require(_0x927e('0x1'));var moment=require('moment');var BPromise=require(_0x927e('0x2'));var rs=require(_0x927e('0x3'));var fs=require('fs');var Redis=require(_0x927e('0x4'));var db=require(_0x927e('0x5'))['db'];var utils=require(_0x927e('0x6'));var logger=require(_0x927e('0x7'))('rpc');var config=require(_0x927e('0x8'));var jayson=require(_0x927e('0x9'));var client=jayson[_0x927e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44aa7e,_0x1a71e3,_0xe48c9e){return new BPromise(function(_0x173c6a,_0x2738e8){return client[_0x927e('0xb')](_0x44aa7e,_0xe48c9e)['then'](function(_0x25633b){logger[_0x927e('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x1a71e3,_0x927e('0xd'));logger[_0x927e('0xe')](_0x927e('0xf'),_0x1a71e3,_0x927e('0xd'),JSON[_0x927e('0x10')](_0x25633b));if(_0x25633b[_0x927e('0x11')]){if(_0x25633b[_0x927e('0x11')][_0x927e('0x12')]===0x1f4){logger[_0x927e('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x1a71e3,_0x25633b[_0x927e('0x11')][_0x927e('0x13')]);return _0x2738e8(_0x25633b[_0x927e('0x11')][_0x927e('0x13')]);}logger['error'](_0x927e('0x14'),_0x1a71e3,_0x25633b['error'][_0x927e('0x13')]);return _0x173c6a(_0x25633b['error'][_0x927e('0x13')]);}else{logger['info'](_0x927e('0x14'),_0x1a71e3,_0x927e('0xd'));_0x173c6a(_0x25633b[_0x927e('0x15')][_0x927e('0x13')]);}})['catch'](function(_0x41733a){logger[_0x927e('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x1a71e3,_0x41733a);_0x2738e8(_0x41733a);});});}exports[_0x927e('0x16')]=function(_0x198711){var _0x236660=this;return new Promise(function(_0x323784,_0x89c929){return db[_0x927e('0x17')][_0x927e('0x18')]({'raw':_0x198711[_0x927e('0x19')]?_0x198711[_0x927e('0x19')][_0x927e('0x1a')]===undefined?!![]:![]:!![],'where':_0x198711[_0x927e('0x19')]?_0x198711['options'][_0x927e('0x1b')]||null:null,'attributes':_0x198711[_0x927e('0x19')]?_0x198711[_0x927e('0x19')][_0x927e('0x1c')]||null:null,'limit':_0x198711[_0x927e('0x19')]?_0x198711[_0x927e('0x19')][_0x927e('0x1d')]||null:null,'include':_0x198711['options']?_0x198711[_0x927e('0x19')][_0x927e('0x1e')]?_['map'](_0x198711['options'][_0x927e('0x1e')],function(_0x5aff88){return{'model':db[_0x5aff88[_0x927e('0x1f')]],'as':_0x5aff88['as'],'attributes':_0x5aff88['attributes'],'include':_0x5aff88[_0x927e('0x1e')]?_[_0x927e('0x20')](_0x5aff88[_0x927e('0x1e')],function(_0x26dd84){return{'model':db[_0x26dd84[_0x927e('0x1f')]],'as':_0x26dd84['as'],'attributes':_0x26dd84['attributes'],'include':_0x26dd84['include']?_[_0x927e('0x20')](_0x26dd84['include'],function(_0x36d1e2){return{'model':db[_0x36d1e2['model']],'as':_0x36d1e2['as'],'attributes':_0x36d1e2[_0x927e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x927e('0x21')](function(_0x421d34){logger['info'](_0x927e('0x16'),_0x198711);logger[_0x927e('0xe')]('GetZendeskAccount',_0x198711,JSON[_0x927e('0x10')](_0x421d34));_0x323784(_0x421d34);})[_0x927e('0x22')](function(_0x59031f){logger[_0x927e('0x11')]('GetZendeskAccount',_0x59031f[_0x927e('0x13')],_0x198711);_0x89c929(_0x236660[_0x927e('0x11')](0x1f4,_0x59031f['message']));});});};exports['ShowZendeskAccount']=function(_0x4c1181){var _0x414785=this;return new Promise(function(_0x139d14,_0x37dc32){return db[_0x927e('0x17')]['find']({'raw':_0x4c1181[_0x927e('0x19')]?_0x4c1181[_0x927e('0x19')][_0x927e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1181['options']?_0x4c1181[_0x927e('0x19')]['where']||null:null,'attributes':_0x4c1181[_0x927e('0x19')]?_0x4c1181['options'][_0x927e('0x1c')]||null:null,'include':_0x4c1181[_0x927e('0x19')]?_0x4c1181[_0x927e('0x19')][_0x927e('0x1e')]?_[_0x927e('0x20')](_0x4c1181[_0x927e('0x19')][_0x927e('0x1e')],function(_0x258fe8){return{'model':db[_0x258fe8[_0x927e('0x1f')]],'as':_0x258fe8['as'],'attributes':_0x258fe8[_0x927e('0x1c')],'include':_0x258fe8[_0x927e('0x1e')]?_['map'](_0x258fe8[_0x927e('0x1e')],function(_0x18b5fa){return{'model':db[_0x18b5fa[_0x927e('0x1f')]],'as':_0x18b5fa['as'],'attributes':_0x18b5fa[_0x927e('0x1c')],'include':_0x18b5fa['include']?_[_0x927e('0x20')](_0x18b5fa['include'],function(_0x404bbb){return{'model':db[_0x404bbb[_0x927e('0x1f')]],'as':_0x404bbb['as'],'attributes':_0x404bbb[_0x927e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x927e('0x21')](function(_0x59eede){logger[_0x927e('0xc')]('ShowZendeskAccount',_0x4c1181);logger[_0x927e('0xe')](_0x927e('0x23'),_0x4c1181,JSON[_0x927e('0x10')](_0x59eede));_0x139d14(_0x59eede);})['catch'](function(_0xe3c046){logger[_0x927e('0x11')](_0x927e('0x23'),_0xe3c046[_0x927e('0x13')],_0x4c1181);_0x37dc32(_0x414785[_0x927e('0x11')](0x1f4,_0xe3c046[_0x927e('0x13')]));});});}; \ No newline at end of file +var _0x01e7=['client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','include','map','model','attributes','catch','ShowZendeskAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11fe42,_0x55a5af){var _0x3e0c10=function(_0x1e8432){while(--_0x1e8432){_0x11fe42['push'](_0x11fe42['shift']());}};_0x3e0c10(++_0x55a5af);}(_0x01e7,0x125));var _0x701e=function(_0x4aba7e,_0x1d8751){_0x4aba7e=_0x4aba7e-0x0;var _0x32e5f4=_0x01e7[_0x4aba7e];return _0x32e5f4;};'use strict';var _=require(_0x701e('0x0'));var util=require(_0x701e('0x1'));var moment=require(_0x701e('0x2'));var BPromise=require(_0x701e('0x3'));var rs=require(_0x701e('0x4'));var fs=require('fs');var Redis=require(_0x701e('0x5'));var db=require(_0x701e('0x6'))['db'];var utils=require(_0x701e('0x7'));var logger=require(_0x701e('0x8'))(_0x701e('0x9'));var config=require(_0x701e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x701e('0xb')][_0x701e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9ab603,_0x4cf450,_0x5984de){return new BPromise(function(_0x3dc407,_0xe9b695){return client[_0x701e('0xd')](_0x9ab603,_0x5984de)[_0x701e('0xe')](function(_0x3aea34){logger[_0x701e('0xf')](_0x701e('0x10'),_0x4cf450,'request\x20sent');logger[_0x701e('0x11')](_0x701e('0x12'),_0x4cf450,_0x701e('0x13'),JSON['stringify'](_0x3aea34));if(_0x3aea34['error']){if(_0x3aea34[_0x701e('0x14')][_0x701e('0x15')]===0x1f4){logger[_0x701e('0x14')](_0x701e('0x10'),_0x4cf450,_0x3aea34[_0x701e('0x14')]['message']);return _0xe9b695(_0x3aea34[_0x701e('0x14')][_0x701e('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x4cf450,_0x3aea34['error'][_0x701e('0x16')]);return _0x3dc407(_0x3aea34[_0x701e('0x14')][_0x701e('0x16')]);}else{logger['info'](_0x701e('0x10'),_0x4cf450,'request\x20sent');_0x3dc407(_0x3aea34[_0x701e('0x17')][_0x701e('0x16')]);}})['catch'](function(_0x40b85b){logger['error'](_0x701e('0x10'),_0x4cf450,_0x40b85b);_0xe9b695(_0x40b85b);});});}exports[_0x701e('0x18')]=function(_0x3d8a39){var _0xbe878=this;return new Promise(function(_0x43a1d3,_0x3cbe65){return db[_0x701e('0x19')][_0x701e('0x1a')]({'raw':_0x3d8a39[_0x701e('0x1b')]?_0x3d8a39[_0x701e('0x1b')][_0x701e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d8a39['options']?_0x3d8a39[_0x701e('0x1b')]['where']||null:null,'attributes':_0x3d8a39[_0x701e('0x1b')]?_0x3d8a39[_0x701e('0x1b')]['attributes']||null:null,'limit':_0x3d8a39['options']?_0x3d8a39[_0x701e('0x1b')][_0x701e('0x1d')]||null:null,'include':_0x3d8a39['options']?_0x3d8a39['options'][_0x701e('0x1e')]?_[_0x701e('0x1f')](_0x3d8a39[_0x701e('0x1b')][_0x701e('0x1e')],function(_0x35df7a){return{'model':db[_0x35df7a[_0x701e('0x20')]],'as':_0x35df7a['as'],'attributes':_0x35df7a['attributes'],'include':_0x35df7a[_0x701e('0x1e')]?_[_0x701e('0x1f')](_0x35df7a[_0x701e('0x1e')],function(_0x23655d){return{'model':db[_0x23655d['model']],'as':_0x23655d['as'],'attributes':_0x23655d[_0x701e('0x21')],'include':_0x23655d[_0x701e('0x1e')]?_[_0x701e('0x1f')](_0x23655d[_0x701e('0x1e')],function(_0x4d1cd7){return{'model':db[_0x4d1cd7['model']],'as':_0x4d1cd7['as'],'attributes':_0x4d1cd7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c6141){logger[_0x701e('0xf')](_0x701e('0x18'),_0x3d8a39);logger[_0x701e('0x11')](_0x701e('0x18'),_0x3d8a39,JSON['stringify'](_0x2c6141));_0x43a1d3(_0x2c6141);})[_0x701e('0x22')](function(_0x30a129){logger[_0x701e('0x14')](_0x701e('0x18'),_0x30a129[_0x701e('0x16')],_0x3d8a39);_0x3cbe65(_0xbe878[_0x701e('0x14')](0x1f4,_0x30a129[_0x701e('0x16')]));});});};exports[_0x701e('0x23')]=function(_0x3dde2d){var _0x3514de=this;return new Promise(function(_0x448979,_0x574fb9){return db[_0x701e('0x19')][_0x701e('0x24')]({'raw':_0x3dde2d['options']?_0x3dde2d[_0x701e('0x1b')][_0x701e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3dde2d[_0x701e('0x1b')]?_0x3dde2d['options']['where']||null:null,'attributes':_0x3dde2d[_0x701e('0x1b')]?_0x3dde2d[_0x701e('0x1b')][_0x701e('0x21')]||null:null,'include':_0x3dde2d[_0x701e('0x1b')]?_0x3dde2d[_0x701e('0x1b')][_0x701e('0x1e')]?_[_0x701e('0x1f')](_0x3dde2d[_0x701e('0x1b')][_0x701e('0x1e')],function(_0x5dc283){return{'model':db[_0x5dc283['model']],'as':_0x5dc283['as'],'attributes':_0x5dc283['attributes'],'include':_0x5dc283['include']?_[_0x701e('0x1f')](_0x5dc283[_0x701e('0x1e')],function(_0x4d4d24){return{'model':db[_0x4d4d24[_0x701e('0x20')]],'as':_0x4d4d24['as'],'attributes':_0x4d4d24[_0x701e('0x21')],'include':_0x4d4d24['include']?_[_0x701e('0x1f')](_0x4d4d24[_0x701e('0x1e')],function(_0x3fb9d7){return{'model':db[_0x3fb9d7[_0x701e('0x20')]],'as':_0x3fb9d7['as'],'attributes':_0x3fb9d7[_0x701e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x701e('0xe')](function(_0x13c0a8){logger[_0x701e('0xf')](_0x701e('0x23'),_0x3dde2d);logger['debug'](_0x701e('0x23'),_0x3dde2d,JSON[_0x701e('0x25')](_0x13c0a8));_0x448979(_0x13c0a8);})[_0x701e('0x22')](function(_0x56a99d){logger[_0x701e('0x14')](_0x701e('0x23'),_0x56a99d[_0x701e('0x16')],_0x3dde2d);_0x574fb9(_0x3514de['error'](0x1f4,_0x56a99d[_0x701e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7d60070..7052f30 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 _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xb7e7,0x121));var _0x7b7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xb7e7[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file +var _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb7e7[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6401e11..66001e7 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 _0x42b5=['STRING'];(function(_0x57b366,_0x2ddbac){var _0x5a4d89=function(_0x746399){while(--_0x746399){_0x57b366['push'](_0x57b366['shift']());}};_0x5a4d89(++_0x2ddbac);}(_0x42b5,0x103));var _0x542b=function(_0x3d1c2a,_0x4643ce){_0x3d1c2a=_0x3d1c2a-0x0;var _0x494989=_0x42b5[_0x3d1c2a];return _0x494989;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x542b('0x0')]},'description':{'type':Sequelize[_0x542b('0x0')]}}; \ No newline at end of file +var _0x7c8f=['sequelize','exports','STRING'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7c8f,0x17d));var _0xf7c8=function(_0x39d6ce,_0xf91868){_0x39d6ce=_0x39d6ce-0x0;var _0x541de1=_0x7c8f[_0x39d6ce];return _0x541de1;};'use strict';var Sequelize=require(_0xf7c8('0x0'));module[_0xf7c8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf7c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index fd5e2c0..d9c4e88 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 _0x0920=['offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','update','catch','getFields','findOne','pick','nolimit','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x0920,0x133));var _0x0092=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x0920[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0x0092('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0092('0x1'));var moment=require(_0x0092('0x2'));var BPromise=require(_0x0092('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0092('0x4'));var sox=require(_0x0092('0x5'));var csv=require(_0x0092('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0092('0x7'));var _=require('lodash');var squel=require(_0x0092('0x8'));var crypto=require(_0x0092('0x9'));var jsforce=require(_0x0092('0xa'));var deskjs=require(_0x0092('0xb'));var toCsv=require(_0x0092('0x6'));var querystring=require(_0x0092('0xc'));var Papa=require('papaparse');var Redis=require(_0x0092('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0092('0xe'));var as=require(_0x0092('0xf'));var hardwareService=require(_0x0092('0x10'));var logger=require(_0x0092('0x11'))(_0x0092('0x12'));var utils=require(_0x0092('0x13'));var config=require(_0x0092('0x14'));var licenseUtil=require(_0x0092('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305a16,_0x3d80b1){_0x3d80b1=_0x3d80b1||0xcc;return function(_0x542488){if(_0x542488){return _0x305a16[_0x0092('0x16')](_0x3d80b1);}return _0x305a16[_0x0092('0x17')](_0x3d80b1)[_0x0092('0x18')]();};}function respondWithResult(_0x31699b,_0x5b65b1){_0x5b65b1=_0x5b65b1||0xc8;return function(_0x321783){if(_0x321783){return _0x31699b['status'](_0x5b65b1)['json'](_0x321783);}};}function respondWithFilteredResult(_0x3c01f1,_0x4879a9){return function(_0x33a5a2){if(_0x33a5a2){var _0x10f41b=typeof _0x4879a9[_0x0092('0x19')]==='undefined'&&typeof _0x4879a9[_0x0092('0x1a')]===_0x0092('0x1b');var _0x36a204=_0x33a5a2[_0x0092('0x1c')];var _0x275ebe=_0x10f41b?0x0:_0x4879a9['offset'];var _0x4c88df=_0x10f41b?_0x33a5a2[_0x0092('0x1c')]:_0x4879a9[_0x0092('0x19')]+_0x4879a9[_0x0092('0x1a')];var _0x39b0a5;if(_0x4c88df>=_0x36a204){_0x4c88df=_0x36a204;_0x39b0a5=0xc8;}else{_0x39b0a5=0xce;}_0x3c01f1['status'](_0x39b0a5);return _0x3c01f1[_0x0092('0x1d')](_0x0092('0x1e'),_0x275ebe+'-'+_0x4c88df+'/'+_0x36a204)['json'](_0x33a5a2);}return null;};}function patchUpdates(_0xb0e25a){return function(_0x3c1f01){try{jsonpatch[_0x0092('0x1f')](_0x3c1f01,_0xb0e25a,!![]);}catch(_0x31fcbc){return BPromise['reject'](_0x31fcbc);}return _0x3c1f01[_0x0092('0x20')]();};}function saveUpdates(_0x3a0814,_0x3eb0fc){return function(_0x523dc6){if(_0x523dc6){return _0x523dc6['update'](_0x3a0814)[_0x0092('0x21')](function(_0x59e849){return _0x59e849;});}return null;};}function removeEntity(_0x23d95c,_0x307fe3){return function(_0x48286e){if(_0x48286e){return _0x48286e[_0x0092('0x22')]()[_0x0092('0x21')](function(){_0x23d95c[_0x0092('0x17')](0xcc)[_0x0092('0x18')]();});}};}function handleEntityNotFound(_0x139ce5,_0x4360fd){return function(_0x3085c7){if(!_0x3085c7){_0x139ce5[_0x0092('0x16')](0x194);}return _0x3085c7;};}function handleError(_0x5323db,_0x51760a){_0x51760a=_0x51760a||0x1f4;return function(_0x100d4a){logger[_0x0092('0x23')](_0x100d4a[_0x0092('0x24')]);if(_0x100d4a[_0x0092('0x25')]){delete _0x100d4a[_0x0092('0x25')];}_0x5323db[_0x0092('0x17')](_0x51760a)[_0x0092('0x26')](_0x100d4a);};}exports[_0x0092('0x27')]=function(_0x492773,_0x523dde){var _0x5e2e2b={},_0x11a0ca={},_0x10b396={'count':0x0,'rows':[]};var _0x5a3eaf=_[_0x0092('0x28')](db[_0x0092('0x29')][_0x0092('0x2a')],function(_0x177aa3){return{'name':_0x177aa3['fieldName'],'type':_0x177aa3['type'][_0x0092('0x2b')]};});_0x11a0ca[_0x0092('0x2c')]=_[_0x0092('0x28')](_0x5a3eaf,'name');_0x11a0ca['query']=_[_0x0092('0x2d')](_0x492773[_0x0092('0x2e')]);_0x11a0ca[_0x0092('0x2f')]=_['intersection'](_0x11a0ca['model'],_0x11a0ca[_0x0092('0x2e')]);_0x5e2e2b[_0x0092('0x30')]=_[_0x0092('0x31')](_0x11a0ca[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x492773['query'][_0x0092('0x32')]));_0x5e2e2b[_0x0092('0x30')]=_0x5e2e2b[_0x0092('0x30')][_0x0092('0x33')]?_0x5e2e2b['attributes']:_0x11a0ca[_0x0092('0x2c')];if(!_0x492773['query'][_0x0092('0x34')]('nolimit')){_0x5e2e2b['limit']=qs[_0x0092('0x1a')](_0x492773['query'][_0x0092('0x1a')]);_0x5e2e2b[_0x0092('0x19')]=qs[_0x0092('0x19')](_0x492773['query']['offset']);}_0x5e2e2b[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x492773[_0x0092('0x2e')][_0x0092('0x36')]);_0x5e2e2b[_0x0092('0x37')]=qs[_0x0092('0x2f')](_['pick'](_0x492773[_0x0092('0x2e')],_0x11a0ca[_0x0092('0x2f')]),_0x5a3eaf);if(_0x492773[_0x0092('0x2e')]['filter']){_0x5e2e2b['where']=_[_0x0092('0x38')](_0x5e2e2b['where'],{'$or':_[_0x0092('0x28')](_0x5a3eaf,function(_0x3b65ba){if(_0x3b65ba[_0x0092('0x39')]!==_0x0092('0x3a')){var _0x143154={};_0x143154[_0x3b65ba[_0x0092('0x25')]]={'$like':'%'+_0x492773[_0x0092('0x2e')][_0x0092('0x3b')]+'%'};return _0x143154;}})});}_0x5e2e2b=_['merge']({},_0x5e2e2b,_0x492773[_0x0092('0x3c')]);var _0x53ffe4={'where':_0x5e2e2b['where']};return db[_0x0092('0x29')][_0x0092('0x1c')](_0x53ffe4)[_0x0092('0x21')](function(_0x30b4f2){_0x10b396['count']=_0x30b4f2;if(_0x492773[_0x0092('0x2e')]['includeAll']){_0x5e2e2b[_0x0092('0x3d')]=[{'all':!![]}];}return db[_0x0092('0x29')][_0x0092('0x3e')](_0x5e2e2b);})[_0x0092('0x21')](function(_0x3c7995){_0x10b396[_0x0092('0x3f')]=_0x3c7995;return _0x10b396;})['then'](respondWithFilteredResult(_0x523dde,_0x5e2e2b))['catch'](handleError(_0x523dde,null));};exports[_0x0092('0x40')]=function(_0xee515f,_0x3aac91){var _0x154b57={'raw':![],'where':{'id':_0xee515f[_0x0092('0x41')]['id']}},_0x5bd010={};_0x5bd010[_0x0092('0x2c')]=_['keys'](db[_0x0092('0x29')][_0x0092('0x2a')]);_0x5bd010[_0x0092('0x2e')]=_[_0x0092('0x2d')](_0xee515f[_0x0092('0x2e')]);_0x5bd010[_0x0092('0x2f')]=_[_0x0092('0x31')](_0x5bd010[_0x0092('0x2c')],_0x5bd010[_0x0092('0x2e')]);_0x154b57[_0x0092('0x30')]=_[_0x0092('0x31')](_0x5bd010[_0x0092('0x2c')],qs[_0x0092('0x32')](_0xee515f[_0x0092('0x2e')][_0x0092('0x32')]));_0x154b57['attributes']=_0x154b57[_0x0092('0x30')]['length']?_0x154b57[_0x0092('0x30')]:_0x5bd010[_0x0092('0x2c')];if(_0xee515f['query'][_0x0092('0x42')]){_0x154b57['include']=[{'all':!![]}];}_0x154b57=_[_0x0092('0x38')]({},_0x154b57,_0xee515f['options']);return db[_0x0092('0x29')][_0x0092('0x43')](_0x154b57)[_0x0092('0x21')](handleEntityNotFound(_0x3aac91,null))[_0x0092('0x21')](respondWithResult(_0x3aac91,null))['catch'](handleError(_0x3aac91,null));};exports[_0x0092('0x44')]=function(_0x538a98,_0x5849c5){return db['ZendeskConfiguration']['create'](_0x538a98[_0x0092('0x45')],{})[_0x0092('0x21')](respondWithResult(_0x5849c5,0xc9))['catch'](handleError(_0x5849c5,null));};exports[_0x0092('0x46')]=function(_0x1aa14a,_0x4d9048){if(_0x1aa14a[_0x0092('0x45')]['id']){delete _0x1aa14a[_0x0092('0x45')]['id'];}return db['ZendeskConfiguration'][_0x0092('0x43')]({'where':{'id':_0x1aa14a[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x4d9048,null))[_0x0092('0x21')](saveUpdates(_0x1aa14a[_0x0092('0x45')],null))[_0x0092('0x21')](respondWithResult(_0x4d9048,null))[_0x0092('0x47')](handleError(_0x4d9048,null));};exports[_0x0092('0x22')]=function(_0x336f0c,_0x1a0b06){return db[_0x0092('0x29')][_0x0092('0x43')]({'where':{'id':_0x336f0c[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x1a0b06,null))[_0x0092('0x21')](removeEntity(_0x1a0b06,null))['catch'](handleError(_0x1a0b06,null));};exports[_0x0092('0x48')]=function(_0x416644,_0x68b729,_0x5a42a6){var _0x1ff89c={};var _0x23eac2={};var _0x521900;var _0x1bc378;return db[_0x0092('0x29')][_0x0092('0x49')]({'where':{'id':_0x416644[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x68b729,null))['then'](function(_0x15ed0b){if(_0x15ed0b){_0x521900=_0x15ed0b;_0x23eac2[_0x0092('0x2c')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x23eac2['query']=_[_0x0092('0x2d')](_0x416644['query']);_0x23eac2['filters']=_['intersection'](_0x23eac2[_0x0092('0x2c')],_0x23eac2[_0x0092('0x2e')]);_0x1ff89c[_0x0092('0x30')]=_[_0x0092('0x31')](_0x23eac2[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x416644[_0x0092('0x2e')][_0x0092('0x32')]));_0x1ff89c[_0x0092('0x30')]=_0x1ff89c[_0x0092('0x30')][_0x0092('0x33')]?_0x1ff89c[_0x0092('0x30')]:_0x23eac2['model'];_0x1ff89c[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x416644[_0x0092('0x2e')][_0x0092('0x36')]);_0x1ff89c['where']=qs[_0x0092('0x2f')](_[_0x0092('0x4a')](_0x416644['query'],_0x23eac2['filters']));if(_0x416644[_0x0092('0x2e')][_0x0092('0x3b')]){_0x1ff89c[_0x0092('0x37')]=_[_0x0092('0x38')](_0x1ff89c['where'],{'$or':_[_0x0092('0x28')](_0x1ff89c[_0x0092('0x30')],function(_0x51303c){var _0x132fbb={};_0x132fbb[_0x51303c]={'$like':'%'+_0x416644[_0x0092('0x2e')]['filter']+'%'};return _0x132fbb;})});}_0x1ff89c=_[_0x0092('0x38')]({},_0x1ff89c,_0x416644['options']);return _0x521900[_0x0092('0x48')](_0x1ff89c);}})['then'](function(_0x550739){if(_0x550739){_0x1bc378=_0x550739['length'];if(!_0x416644[_0x0092('0x2e')][_0x0092('0x34')](_0x0092('0x4b'))){_0x1ff89c[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x416644[_0x0092('0x2e')][_0x0092('0x1a')]);_0x1ff89c['offset']=qs['offset'](_0x416644['query']['offset']);}return _0x521900[_0x0092('0x48')](_0x1ff89c);}})[_0x0092('0x21')](function(_0x13f14e){if(_0x13f14e){return _0x13f14e?{'count':_0x1bc378,'rows':_0x13f14e}:null;}})[_0x0092('0x21')](respondWithResult(_0x68b729,null))[_0x0092('0x47')](handleError(_0x68b729,null));};exports[_0x0092('0x4c')]=function(_0x41059d,_0x3b81c4,_0x543cef){var _0x1fee8a={};var _0x38e2f2={};var _0x19df1a;var _0xe8f41b;return db[_0x0092('0x29')][_0x0092('0x49')]({'where':{'id':_0x41059d[_0x0092('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b81c4,null))[_0x0092('0x21')](function(_0x5d6d03){if(_0x5d6d03){_0x19df1a=_0x5d6d03;_0x38e2f2['model']=_[_0x0092('0x2d')](db[_0x0092('0x4d')]['rawAttributes']);_0x38e2f2['query']=_[_0x0092('0x2d')](_0x41059d[_0x0092('0x2e')]);_0x38e2f2[_0x0092('0x2f')]=_['intersection'](_0x38e2f2[_0x0092('0x2c')],_0x38e2f2[_0x0092('0x2e')]);_0x1fee8a[_0x0092('0x30')]=_[_0x0092('0x31')](_0x38e2f2[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x41059d[_0x0092('0x2e')]['fields']));_0x1fee8a[_0x0092('0x30')]=_0x1fee8a[_0x0092('0x30')][_0x0092('0x33')]?_0x1fee8a[_0x0092('0x30')]:_0x38e2f2[_0x0092('0x2c')];_0x1fee8a['order']=qs[_0x0092('0x36')](_0x41059d[_0x0092('0x2e')][_0x0092('0x36')]);_0x1fee8a['where']=qs[_0x0092('0x2f')](_['pick'](_0x41059d[_0x0092('0x2e')],_0x38e2f2[_0x0092('0x2f')]));if(_0x41059d[_0x0092('0x2e')][_0x0092('0x3b')]){_0x1fee8a[_0x0092('0x37')]=_[_0x0092('0x38')](_0x1fee8a[_0x0092('0x37')],{'$or':_[_0x0092('0x28')](_0x1fee8a[_0x0092('0x30')],function(_0x1a1fd3){var _0x35cd28={};_0x35cd28[_0x1a1fd3]={'$like':'%'+_0x41059d[_0x0092('0x2e')]['filter']+'%'};return _0x35cd28;})});}_0x1fee8a=_[_0x0092('0x38')]({},_0x1fee8a,_0x41059d[_0x0092('0x3c')]);return _0x19df1a[_0x0092('0x4c')](_0x1fee8a);}})['then'](function(_0x108895){if(_0x108895){_0xe8f41b=_0x108895[_0x0092('0x33')];if(!_0x41059d['query']['hasOwnProperty'](_0x0092('0x4b'))){_0x1fee8a[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x41059d['query']['limit']);_0x1fee8a[_0x0092('0x19')]=qs[_0x0092('0x19')](_0x41059d[_0x0092('0x2e')][_0x0092('0x19')]);}return _0x19df1a[_0x0092('0x4c')](_0x1fee8a);}})[_0x0092('0x21')](function(_0x560d86){if(_0x560d86){return _0x560d86?{'count':_0xe8f41b,'rows':_0x560d86}:null;}})['then'](respondWithResult(_0x3b81c4,null))[_0x0092('0x47')](handleError(_0x3b81c4,null));};exports[_0x0092('0x4e')]=function(_0x240560,_0xc2149b,_0x3ee44f){var _0x4a2b86={};var _0x595a21={};var _0x98e25;var _0x2d8c55;return db['ZendeskConfiguration'][_0x0092('0x49')]({'where':{'id':_0x240560[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0xc2149b,null))[_0x0092('0x21')](function(_0x286380){if(_0x286380){_0x98e25=_0x286380;_0x595a21[_0x0092('0x2c')]=_[_0x0092('0x2d')](db[_0x0092('0x4d')][_0x0092('0x2a')]);_0x595a21[_0x0092('0x2e')]=_[_0x0092('0x2d')](_0x240560[_0x0092('0x2e')]);_0x595a21[_0x0092('0x2f')]=_['intersection'](_0x595a21[_0x0092('0x2c')],_0x595a21['query']);_0x4a2b86['attributes']=_[_0x0092('0x31')](_0x595a21['model'],qs[_0x0092('0x32')](_0x240560['query'][_0x0092('0x32')]));_0x4a2b86[_0x0092('0x30')]=_0x4a2b86['attributes'][_0x0092('0x33')]?_0x4a2b86[_0x0092('0x30')]:_0x595a21[_0x0092('0x2c')];_0x4a2b86[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x240560['query'][_0x0092('0x36')]);_0x4a2b86[_0x0092('0x37')]=qs[_0x0092('0x2f')](_[_0x0092('0x4a')](_0x240560[_0x0092('0x2e')],_0x595a21[_0x0092('0x2f')]));if(_0x240560[_0x0092('0x2e')]['filter']){_0x4a2b86[_0x0092('0x37')]=_[_0x0092('0x38')](_0x4a2b86['where'],{'$or':_[_0x0092('0x28')](_0x4a2b86[_0x0092('0x30')],function(_0x2571e8){var _0x2a0d02={};_0x2a0d02[_0x2571e8]={'$like':'%'+_0x240560['query'][_0x0092('0x3b')]+'%'};return _0x2a0d02;})});}_0x4a2b86=_[_0x0092('0x38')]({},_0x4a2b86,_0x240560[_0x0092('0x3c')]);return _0x98e25['getDescriptions'](_0x4a2b86);}})['then'](function(_0x233eea){if(_0x233eea){_0x2d8c55=_0x233eea[_0x0092('0x33')];if(!_0x240560[_0x0092('0x2e')][_0x0092('0x34')]('nolimit')){_0x4a2b86[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x240560[_0x0092('0x2e')][_0x0092('0x1a')]);_0x4a2b86[_0x0092('0x19')]=qs[_0x0092('0x19')](_0x240560[_0x0092('0x2e')][_0x0092('0x19')]);}return _0x98e25['getDescriptions'](_0x4a2b86);}})[_0x0092('0x21')](function(_0x131244){if(_0x131244){return _0x131244?{'count':_0x2d8c55,'rows':_0x131244}:null;}})['then'](respondWithResult(_0xc2149b,null))[_0x0092('0x47')](handleError(_0xc2149b,null));};exports[_0x0092('0x4f')]=function(_0x3bf5ba,_0x14ca97,_0x5d36b3){var _0x3525e3={};var _0x4d1d89={};var _0x2186eb;var _0x5d9015;return db[_0x0092('0x29')]['findOne']({'where':{'id':_0x3bf5ba[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x14ca97,null))['then'](function(_0x3fe7a9){if(_0x3fe7a9){_0x2186eb=_0x3fe7a9;_0x4d1d89[_0x0092('0x2c')]=_[_0x0092('0x2d')](db[_0x0092('0x50')]['rawAttributes']);_0x4d1d89[_0x0092('0x2e')]=_[_0x0092('0x2d')](_0x3bf5ba[_0x0092('0x2e')]);_0x4d1d89[_0x0092('0x2f')]=_[_0x0092('0x31')](_0x4d1d89['model'],_0x4d1d89[_0x0092('0x2e')]);_0x3525e3[_0x0092('0x30')]=_[_0x0092('0x31')](_0x4d1d89[_0x0092('0x2c')],qs[_0x0092('0x32')](_0x3bf5ba[_0x0092('0x2e')]['fields']));_0x3525e3[_0x0092('0x30')]=_0x3525e3[_0x0092('0x30')][_0x0092('0x33')]?_0x3525e3['attributes']:_0x4d1d89['model'];_0x3525e3[_0x0092('0x35')]=qs[_0x0092('0x36')](_0x3bf5ba['query']['sort']);_0x3525e3[_0x0092('0x37')]=qs[_0x0092('0x2f')](_[_0x0092('0x4a')](_0x3bf5ba[_0x0092('0x2e')],_0x4d1d89[_0x0092('0x2f')]));if(_0x3bf5ba[_0x0092('0x2e')]['filter']){_0x3525e3[_0x0092('0x37')]=_['merge'](_0x3525e3[_0x0092('0x37')],{'$or':_[_0x0092('0x28')](_0x3525e3[_0x0092('0x30')],function(_0x26a546){var _0x57539a={};_0x57539a[_0x26a546]={'$like':'%'+_0x3bf5ba[_0x0092('0x2e')]['filter']+'%'};return _0x57539a;})});}_0x3525e3=_[_0x0092('0x38')]({},_0x3525e3,_0x3bf5ba['options']);return _0x2186eb[_0x0092('0x4f')](_0x3525e3);}})['then'](function(_0xe0acd1){if(_0xe0acd1){_0x5d9015=_0xe0acd1[_0x0092('0x33')];if(!_0x3bf5ba[_0x0092('0x2e')][_0x0092('0x34')](_0x0092('0x4b'))){_0x3525e3[_0x0092('0x1a')]=qs[_0x0092('0x1a')](_0x3bf5ba[_0x0092('0x2e')]['limit']);_0x3525e3[_0x0092('0x19')]=qs['offset'](_0x3bf5ba[_0x0092('0x2e')][_0x0092('0x19')]);}return _0x2186eb[_0x0092('0x4f')](_0x3525e3);}})[_0x0092('0x21')](function(_0x39dc4e){if(_0x39dc4e){return _0x39dc4e?{'count':_0x5d9015,'rows':_0x39dc4e}:null;}})[_0x0092('0x21')](respondWithResult(_0x14ca97,null))[_0x0092('0x47')](handleError(_0x14ca97,null));};exports['setTags']=function(_0x422d65,_0x4e453c,_0x2c03a3){if(_0x422d65[_0x0092('0x45')]['id']){delete _0x422d65[_0x0092('0x45')]['id'];}return db[_0x0092('0x29')][_0x0092('0x49')]({'where':{'id':_0x422d65[_0x0092('0x41')]['id']}})[_0x0092('0x21')](handleEntityNotFound(_0x4e453c,null))[_0x0092('0x21')](function(_0x5e8ca0){if(_0x5e8ca0){return _0x5e8ca0[_0x0092('0x51')](_0x422d65[_0x0092('0x45')][_0x0092('0x52')]||[]);}return null;})[_0x0092('0x21')](respondWithResult(_0x4e453c,null))[_0x0092('0x47')](handleError(_0x4e453c,null));}; \ No newline at end of file +var _0x46b4=['pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','keys','ZendeskConfiguration','includeAll','options','find','create','body','getFields','findOne','ZendeskField','rawAttributes','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x22548b,_0x551c8){var _0x589df8=function(_0x297085){while(--_0x297085){_0x22548b['push'](_0x22548b['shift']());}};_0x589df8(++_0x551c8);}(_0x46b4,0x1ca));var _0x446b=function(_0x3e020e,_0x2d1e48){_0x3e020e=_0x3e020e-0x0;var _0x2e1800=_0x46b4[_0x3e020e];return _0x2e1800;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x446b('0x0'));var zipdir=require(_0x446b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x446b('0x2'));var BPromise=require(_0x446b('0x3'));var Mustache=require(_0x446b('0x4'));var util=require('util');var path=require('path');var sox=require(_0x446b('0x5'));var csv=require(_0x446b('0x6'));var ejs=require(_0x446b('0x7'));var fs=require('fs');var fs_extra=require(_0x446b('0x8'));var _=require(_0x446b('0x9'));var squel=require(_0x446b('0xa'));var crypto=require('crypto');var jsforce=require(_0x446b('0xb'));var deskjs=require(_0x446b('0xc'));var toCsv=require(_0x446b('0x6'));var querystring=require(_0x446b('0xd'));var Papa=require('papaparse');var Redis=require(_0x446b('0xe'));var authService=require(_0x446b('0xf'));var qs=require(_0x446b('0x10'));var as=require(_0x446b('0x11'));var hardwareService=require(_0x446b('0x12'));var logger=require('../../config/logger')(_0x446b('0x13'));var utils=require('../../config/utils');var config=require(_0x446b('0x14'));var licenseUtil=require(_0x446b('0x15'));var db=require(_0x446b('0x16'))['db'];function respondWithStatusCode(_0xd88eca,_0x3ad077){_0x3ad077=_0x3ad077||0xcc;return function(_0x3c161f){if(_0x3c161f){return _0xd88eca[_0x446b('0x17')](_0x3ad077);}return _0xd88eca[_0x446b('0x18')](_0x3ad077)[_0x446b('0x19')]();};}function respondWithResult(_0x562c19,_0x38e34c){_0x38e34c=_0x38e34c||0xc8;return function(_0x14c26f){if(_0x14c26f){return _0x562c19[_0x446b('0x18')](_0x38e34c)[_0x446b('0x1a')](_0x14c26f);}};}function respondWithFilteredResult(_0x162c92,_0x5677f5){return function(_0x37c600){if(_0x37c600){var _0x2a0d3d=typeof _0x5677f5[_0x446b('0x1b')]===_0x446b('0x1c')&&typeof _0x5677f5['limit']===_0x446b('0x1c');var _0x179aa4=_0x37c600['count'];var _0x4bfc22=_0x2a0d3d?0x0:_0x5677f5['offset'];var _0x4dcf0f=_0x2a0d3d?_0x37c600[_0x446b('0x1d')]:_0x5677f5[_0x446b('0x1b')]+_0x5677f5[_0x446b('0x1e')];var _0x383783;if(_0x4dcf0f>=_0x179aa4){_0x4dcf0f=_0x179aa4;_0x383783=0xc8;}else{_0x383783=0xce;}_0x162c92[_0x446b('0x18')](_0x383783);return _0x162c92[_0x446b('0x1f')](_0x446b('0x20'),_0x4bfc22+'-'+_0x4dcf0f+'/'+_0x179aa4)[_0x446b('0x1a')](_0x37c600);}return null;};}function patchUpdates(_0x4ca2a8){return function(_0x97676c){try{jsonpatch[_0x446b('0x21')](_0x97676c,_0x4ca2a8,!![]);}catch(_0x56539b){return BPromise[_0x446b('0x22')](_0x56539b);}return _0x97676c[_0x446b('0x23')]();};}function saveUpdates(_0x270d8b,_0x591b60){return function(_0x469137){if(_0x469137){return _0x469137[_0x446b('0x24')](_0x270d8b)[_0x446b('0x25')](function(_0x5ebda2){return _0x5ebda2;});}return null;};}function removeEntity(_0x3cac5a,_0x9e0ade){return function(_0x4d4315){if(_0x4d4315){return _0x4d4315[_0x446b('0x26')]()[_0x446b('0x25')](function(){_0x3cac5a[_0x446b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12bbca,_0x5d35b7){return function(_0x376856){if(!_0x376856){_0x12bbca[_0x446b('0x17')](0x194);}return _0x376856;};}function handleError(_0xcb1698,_0x14ab59){_0x14ab59=_0x14ab59||0x1f4;return function(_0x263ec4){logger[_0x446b('0x27')](_0x263ec4[_0x446b('0x28')]);if(_0x263ec4['name']){delete _0x263ec4[_0x446b('0x29')];}_0xcb1698[_0x446b('0x18')](_0x14ab59)[_0x446b('0x2a')](_0x263ec4);};}exports[_0x446b('0x2b')]=function(_0x33f0e7,_0x482ac0){var _0x19a732={},_0x36d6ae={},_0x275fc6={'count':0x0,'rows':[]};var _0xaf396e=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x384424){return{'name':_0x384424['fieldName'],'type':_0x384424[_0x446b('0x2c')][_0x446b('0x2d')]};});_0x36d6ae[_0x446b('0x2e')]=_['map'](_0xaf396e,_0x446b('0x29'));_0x36d6ae[_0x446b('0x2f')]=_['keys'](_0x33f0e7[_0x446b('0x2f')]);_0x36d6ae[_0x446b('0x30')]=_['intersection'](_0x36d6ae['model'],_0x36d6ae[_0x446b('0x2f')]);_0x19a732[_0x446b('0x31')]=_[_0x446b('0x32')](_0x36d6ae['model'],qs[_0x446b('0x33')](_0x33f0e7[_0x446b('0x2f')][_0x446b('0x33')]));_0x19a732[_0x446b('0x31')]=_0x19a732[_0x446b('0x31')][_0x446b('0x34')]?_0x19a732[_0x446b('0x31')]:_0x36d6ae[_0x446b('0x2e')];if(!_0x33f0e7[_0x446b('0x2f')][_0x446b('0x35')](_0x446b('0x36'))){_0x19a732[_0x446b('0x1e')]=qs[_0x446b('0x1e')](_0x33f0e7[_0x446b('0x2f')][_0x446b('0x1e')]);_0x19a732[_0x446b('0x1b')]=qs[_0x446b('0x1b')](_0x33f0e7[_0x446b('0x2f')][_0x446b('0x1b')]);}_0x19a732[_0x446b('0x37')]=qs[_0x446b('0x38')](_0x33f0e7[_0x446b('0x2f')][_0x446b('0x38')]);_0x19a732[_0x446b('0x39')]=qs['filters'](_[_0x446b('0x3a')](_0x33f0e7['query'],_0x36d6ae[_0x446b('0x30')]),_0xaf396e);if(_0x33f0e7['query'][_0x446b('0x3b')]){_0x19a732['where']=_[_0x446b('0x3c')](_0x19a732[_0x446b('0x39')],{'$or':_[_0x446b('0x3d')](_0xaf396e,function(_0x231c27){if(_0x231c27['type']!==_0x446b('0x3e')){var _0x33cb14={};_0x33cb14[_0x231c27['name']]={'$like':'%'+_0x33f0e7['query'][_0x446b('0x3b')]+'%'};return _0x33cb14;}})});}_0x19a732=_[_0x446b('0x3c')]({},_0x19a732,_0x33f0e7['options']);var _0x44511e={'where':_0x19a732[_0x446b('0x39')]};return db['ZendeskConfiguration']['count'](_0x44511e)['then'](function(_0x423bba){_0x275fc6[_0x446b('0x1d')]=_0x423bba;if(_0x33f0e7[_0x446b('0x2f')]['includeAll']){_0x19a732[_0x446b('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x446b('0x40')](_0x19a732);})['then'](function(_0x2176b8){_0x275fc6[_0x446b('0x41')]=_0x2176b8;return _0x275fc6;})[_0x446b('0x25')](respondWithFilteredResult(_0x482ac0,_0x19a732))[_0x446b('0x42')](handleError(_0x482ac0,null));};exports[_0x446b('0x43')]=function(_0x4a1640,_0x563aed){var _0x40a930={'raw':![],'where':{'id':_0x4a1640[_0x446b('0x44')]['id']}},_0xeb0016={};_0xeb0016[_0x446b('0x2e')]=_[_0x446b('0x45')](db[_0x446b('0x46')]['rawAttributes']);_0xeb0016['query']=_[_0x446b('0x45')](_0x4a1640['query']);_0xeb0016[_0x446b('0x30')]=_[_0x446b('0x32')](_0xeb0016['model'],_0xeb0016[_0x446b('0x2f')]);_0x40a930[_0x446b('0x31')]=_['intersection'](_0xeb0016['model'],qs[_0x446b('0x33')](_0x4a1640[_0x446b('0x2f')]['fields']));_0x40a930[_0x446b('0x31')]=_0x40a930[_0x446b('0x31')][_0x446b('0x34')]?_0x40a930[_0x446b('0x31')]:_0xeb0016[_0x446b('0x2e')];if(_0x4a1640['query'][_0x446b('0x47')]){_0x40a930[_0x446b('0x3f')]=[{'all':!![]}];}_0x40a930=_[_0x446b('0x3c')]({},_0x40a930,_0x4a1640[_0x446b('0x48')]);return db[_0x446b('0x46')][_0x446b('0x49')](_0x40a930)[_0x446b('0x25')](handleEntityNotFound(_0x563aed,null))[_0x446b('0x25')](respondWithResult(_0x563aed,null))['catch'](handleError(_0x563aed,null));};exports['create']=function(_0x462799,_0x599ea5){return db[_0x446b('0x46')][_0x446b('0x4a')](_0x462799['body'],{})[_0x446b('0x25')](respondWithResult(_0x599ea5,0xc9))[_0x446b('0x42')](handleError(_0x599ea5,null));};exports[_0x446b('0x24')]=function(_0x21276c,_0x1a52fb){if(_0x21276c[_0x446b('0x4b')]['id']){delete _0x21276c[_0x446b('0x4b')]['id'];}return db[_0x446b('0x46')][_0x446b('0x49')]({'where':{'id':_0x21276c[_0x446b('0x44')]['id']}})[_0x446b('0x25')](handleEntityNotFound(_0x1a52fb,null))['then'](saveUpdates(_0x21276c[_0x446b('0x4b')],null))[_0x446b('0x25')](respondWithResult(_0x1a52fb,null))[_0x446b('0x42')](handleError(_0x1a52fb,null));};exports['destroy']=function(_0x170727,_0x26b5f6){return db['ZendeskConfiguration']['find']({'where':{'id':_0x170727[_0x446b('0x44')]['id']}})[_0x446b('0x25')](handleEntityNotFound(_0x26b5f6,null))[_0x446b('0x25')](removeEntity(_0x26b5f6,null))['catch'](handleError(_0x26b5f6,null));};exports[_0x446b('0x4c')]=function(_0x50b9d9,_0x2b93d5,_0x3a144c){var _0x4c4d64={};var _0x30ddb2={};var _0x142458;var _0x2ea21f;return db[_0x446b('0x46')][_0x446b('0x4d')]({'where':{'id':_0x50b9d9[_0x446b('0x44')]['id']}})[_0x446b('0x25')](handleEntityNotFound(_0x2b93d5,null))['then'](function(_0x4b48d7){if(_0x4b48d7){_0x142458=_0x4b48d7;_0x30ddb2['model']=_[_0x446b('0x45')](db[_0x446b('0x4e')][_0x446b('0x4f')]);_0x30ddb2[_0x446b('0x2f')]=_[_0x446b('0x45')](_0x50b9d9[_0x446b('0x2f')]);_0x30ddb2['filters']=_[_0x446b('0x32')](_0x30ddb2[_0x446b('0x2e')],_0x30ddb2[_0x446b('0x2f')]);_0x4c4d64['attributes']=_[_0x446b('0x32')](_0x30ddb2['model'],qs[_0x446b('0x33')](_0x50b9d9[_0x446b('0x2f')][_0x446b('0x33')]));_0x4c4d64[_0x446b('0x31')]=_0x4c4d64[_0x446b('0x31')][_0x446b('0x34')]?_0x4c4d64['attributes']:_0x30ddb2[_0x446b('0x2e')];_0x4c4d64[_0x446b('0x37')]=qs[_0x446b('0x38')](_0x50b9d9[_0x446b('0x2f')]['sort']);_0x4c4d64['where']=qs['filters'](_[_0x446b('0x3a')](_0x50b9d9[_0x446b('0x2f')],_0x30ddb2[_0x446b('0x30')]));if(_0x50b9d9[_0x446b('0x2f')][_0x446b('0x3b')]){_0x4c4d64['where']=_[_0x446b('0x3c')](_0x4c4d64['where'],{'$or':_[_0x446b('0x3d')](_0x4c4d64['attributes'],function(_0x470419){var _0x13c397={};_0x13c397[_0x470419]={'$like':'%'+_0x50b9d9[_0x446b('0x2f')][_0x446b('0x3b')]+'%'};return _0x13c397;})});}_0x4c4d64=_[_0x446b('0x3c')]({},_0x4c4d64,_0x50b9d9[_0x446b('0x48')]);return _0x142458['getFields'](_0x4c4d64);}})[_0x446b('0x25')](function(_0x5b8c89){if(_0x5b8c89){_0x2ea21f=_0x5b8c89[_0x446b('0x34')];if(!_0x50b9d9[_0x446b('0x2f')][_0x446b('0x35')](_0x446b('0x36'))){_0x4c4d64[_0x446b('0x1e')]=qs['limit'](_0x50b9d9[_0x446b('0x2f')][_0x446b('0x1e')]);_0x4c4d64[_0x446b('0x1b')]=qs[_0x446b('0x1b')](_0x50b9d9[_0x446b('0x2f')]['offset']);}return _0x142458[_0x446b('0x4c')](_0x4c4d64);}})[_0x446b('0x25')](function(_0x158b5c){if(_0x158b5c){return _0x158b5c?{'count':_0x2ea21f,'rows':_0x158b5c}:null;}})['then'](respondWithResult(_0x2b93d5,null))['catch'](handleError(_0x2b93d5,null));};exports[_0x446b('0x50')]=function(_0x23c0d9,_0x56499d,_0x15d44c){var _0x30a4be={};var _0x44979c={};var _0x425328;var _0x4855b8;return db[_0x446b('0x46')][_0x446b('0x4d')]({'where':{'id':_0x23c0d9[_0x446b('0x44')]['id']}})[_0x446b('0x25')](handleEntityNotFound(_0x56499d,null))[_0x446b('0x25')](function(_0x43264c){if(_0x43264c){_0x425328=_0x43264c;_0x44979c[_0x446b('0x2e')]=_['keys'](db[_0x446b('0x4e')][_0x446b('0x4f')]);_0x44979c[_0x446b('0x2f')]=_[_0x446b('0x45')](_0x23c0d9['query']);_0x44979c[_0x446b('0x30')]=_[_0x446b('0x32')](_0x44979c[_0x446b('0x2e')],_0x44979c[_0x446b('0x2f')]);_0x30a4be[_0x446b('0x31')]=_[_0x446b('0x32')](_0x44979c[_0x446b('0x2e')],qs[_0x446b('0x33')](_0x23c0d9[_0x446b('0x2f')]['fields']));_0x30a4be['attributes']=_0x30a4be[_0x446b('0x31')][_0x446b('0x34')]?_0x30a4be[_0x446b('0x31')]:_0x44979c['model'];_0x30a4be[_0x446b('0x37')]=qs[_0x446b('0x38')](_0x23c0d9['query'][_0x446b('0x38')]);_0x30a4be['where']=qs[_0x446b('0x30')](_[_0x446b('0x3a')](_0x23c0d9[_0x446b('0x2f')],_0x44979c[_0x446b('0x30')]));if(_0x23c0d9[_0x446b('0x2f')][_0x446b('0x3b')]){_0x30a4be[_0x446b('0x39')]=_['merge'](_0x30a4be[_0x446b('0x39')],{'$or':_[_0x446b('0x3d')](_0x30a4be[_0x446b('0x31')],function(_0x2b6a0a){var _0x8ac38={};_0x8ac38[_0x2b6a0a]={'$like':'%'+_0x23c0d9[_0x446b('0x2f')][_0x446b('0x3b')]+'%'};return _0x8ac38;})});}_0x30a4be=_[_0x446b('0x3c')]({},_0x30a4be,_0x23c0d9[_0x446b('0x48')]);return _0x425328[_0x446b('0x50')](_0x30a4be);}})[_0x446b('0x25')](function(_0x154fa3){if(_0x154fa3){_0x4855b8=_0x154fa3[_0x446b('0x34')];if(!_0x23c0d9[_0x446b('0x2f')][_0x446b('0x35')]('nolimit')){_0x30a4be['limit']=qs[_0x446b('0x1e')](_0x23c0d9[_0x446b('0x2f')][_0x446b('0x1e')]);_0x30a4be[_0x446b('0x1b')]=qs['offset'](_0x23c0d9[_0x446b('0x2f')][_0x446b('0x1b')]);}return _0x425328[_0x446b('0x50')](_0x30a4be);}})[_0x446b('0x25')](function(_0x271ff4){if(_0x271ff4){return _0x271ff4?{'count':_0x4855b8,'rows':_0x271ff4}:null;}})[_0x446b('0x25')](respondWithResult(_0x56499d,null))[_0x446b('0x42')](handleError(_0x56499d,null));};exports['getDescriptions']=function(_0x370555,_0x2f1a67,_0x1bde73){var _0x4029da={};var _0x233388={};var _0x545d74;var _0x23ed6f;return db[_0x446b('0x46')]['findOne']({'where':{'id':_0x370555[_0x446b('0x44')]['id']}})[_0x446b('0x25')](handleEntityNotFound(_0x2f1a67,null))['then'](function(_0x37fe94){if(_0x37fe94){_0x545d74=_0x37fe94;_0x233388[_0x446b('0x2e')]=_[_0x446b('0x45')](db['ZendeskField'][_0x446b('0x4f')]);_0x233388[_0x446b('0x2f')]=_[_0x446b('0x45')](_0x370555[_0x446b('0x2f')]);_0x233388[_0x446b('0x30')]=_[_0x446b('0x32')](_0x233388[_0x446b('0x2e')],_0x233388[_0x446b('0x2f')]);_0x4029da[_0x446b('0x31')]=_[_0x446b('0x32')](_0x233388['model'],qs[_0x446b('0x33')](_0x370555[_0x446b('0x2f')]['fields']));_0x4029da[_0x446b('0x31')]=_0x4029da['attributes']['length']?_0x4029da[_0x446b('0x31')]:_0x233388[_0x446b('0x2e')];_0x4029da[_0x446b('0x37')]=qs[_0x446b('0x38')](_0x370555[_0x446b('0x2f')][_0x446b('0x38')]);_0x4029da[_0x446b('0x39')]=qs[_0x446b('0x30')](_[_0x446b('0x3a')](_0x370555['query'],_0x233388['filters']));if(_0x370555[_0x446b('0x2f')]['filter']){_0x4029da[_0x446b('0x39')]=_['merge'](_0x4029da['where'],{'$or':_[_0x446b('0x3d')](_0x4029da[_0x446b('0x31')],function(_0x1f4225){var _0x47babf={};_0x47babf[_0x1f4225]={'$like':'%'+_0x370555[_0x446b('0x2f')][_0x446b('0x3b')]+'%'};return _0x47babf;})});}_0x4029da=_[_0x446b('0x3c')]({},_0x4029da,_0x370555['options']);return _0x545d74['getDescriptions'](_0x4029da);}})[_0x446b('0x25')](function(_0xe6ddc9){if(_0xe6ddc9){_0x23ed6f=_0xe6ddc9[_0x446b('0x34')];if(!_0x370555['query'][_0x446b('0x35')]('nolimit')){_0x4029da['limit']=qs[_0x446b('0x1e')](_0x370555[_0x446b('0x2f')][_0x446b('0x1e')]);_0x4029da[_0x446b('0x1b')]=qs['offset'](_0x370555['query'][_0x446b('0x1b')]);}return _0x545d74[_0x446b('0x51')](_0x4029da);}})['then'](function(_0x5baf27){if(_0x5baf27){return _0x5baf27?{'count':_0x23ed6f,'rows':_0x5baf27}:null;}})[_0x446b('0x25')](respondWithResult(_0x2f1a67,null))[_0x446b('0x42')](handleError(_0x2f1a67,null));};exports['getTags']=function(_0x594767,_0x3e1ed2,_0x3a496e){var _0x592383={};var _0x681bcd={};var _0x3ebe3a;var _0x1c3bb2;return db[_0x446b('0x46')]['findOne']({'where':{'id':_0x594767[_0x446b('0x44')]['id']}})[_0x446b('0x25')](handleEntityNotFound(_0x3e1ed2,null))['then'](function(_0x48bf83){if(_0x48bf83){_0x3ebe3a=_0x48bf83;_0x681bcd[_0x446b('0x2e')]=_[_0x446b('0x45')](db[_0x446b('0x52')][_0x446b('0x4f')]);_0x681bcd[_0x446b('0x2f')]=_['keys'](_0x594767[_0x446b('0x2f')]);_0x681bcd[_0x446b('0x30')]=_['intersection'](_0x681bcd['model'],_0x681bcd[_0x446b('0x2f')]);_0x592383[_0x446b('0x31')]=_[_0x446b('0x32')](_0x681bcd[_0x446b('0x2e')],qs[_0x446b('0x33')](_0x594767[_0x446b('0x2f')][_0x446b('0x33')]));_0x592383['attributes']=_0x592383[_0x446b('0x31')]['length']?_0x592383['attributes']:_0x681bcd['model'];_0x592383[_0x446b('0x37')]=qs[_0x446b('0x38')](_0x594767[_0x446b('0x2f')][_0x446b('0x38')]);_0x592383[_0x446b('0x39')]=qs[_0x446b('0x30')](_[_0x446b('0x3a')](_0x594767[_0x446b('0x2f')],_0x681bcd[_0x446b('0x30')]));if(_0x594767[_0x446b('0x2f')][_0x446b('0x3b')]){_0x592383[_0x446b('0x39')]=_['merge'](_0x592383[_0x446b('0x39')],{'$or':_[_0x446b('0x3d')](_0x592383[_0x446b('0x31')],function(_0x2536d3){var _0x341641={};_0x341641[_0x2536d3]={'$like':'%'+_0x594767[_0x446b('0x2f')][_0x446b('0x3b')]+'%'};return _0x341641;})});}_0x592383=_['merge']({},_0x592383,_0x594767[_0x446b('0x48')]);return _0x3ebe3a[_0x446b('0x53')](_0x592383);}})[_0x446b('0x25')](function(_0x21c476){if(_0x21c476){_0x1c3bb2=_0x21c476[_0x446b('0x34')];if(!_0x594767[_0x446b('0x2f')][_0x446b('0x35')](_0x446b('0x36'))){_0x592383['limit']=qs[_0x446b('0x1e')](_0x594767[_0x446b('0x2f')]['limit']);_0x592383[_0x446b('0x1b')]=qs['offset'](_0x594767['query']['offset']);}return _0x3ebe3a['getTags'](_0x592383);}})[_0x446b('0x25')](function(_0x25d18b){if(_0x25d18b){return _0x25d18b?{'count':_0x1c3bb2,'rows':_0x25d18b}:null;}})[_0x446b('0x25')](respondWithResult(_0x3e1ed2,null))[_0x446b('0x42')](handleError(_0x3e1ed2,null));};exports['setTags']=function(_0x624349,_0x4509ee,_0x5c6d78){if(_0x624349[_0x446b('0x4b')]['id']){delete _0x624349['body']['id'];}return db['ZendeskConfiguration'][_0x446b('0x4d')]({'where':{'id':_0x624349['params']['id']}})[_0x446b('0x25')](handleEntityNotFound(_0x4509ee,null))[_0x446b('0x25')](function(_0x10df93){if(_0x10df93){return _0x10df93[_0x446b('0x54')](_0x624349[_0x446b('0x4b')][_0x446b('0x55')]||[]);}return null;})['then'](respondWithResult(_0x4509ee,null))['catch'](handleError(_0x4509ee,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 679295e..be861af 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 _0x6b20=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x547594,_0x512536){var _0x587c5d=function(_0x5eba60){while(--_0x5eba60){_0x547594['push'](_0x547594['shift']());}};_0x587c5d(++_0x512536);}(_0x6b20,0xd1));var _0x06b2=function(_0x50e266,_0x1e221d){_0x50e266=_0x50e266-0x0;var _0x97bdb8=_0x6b20[_0x50e266];return _0x97bdb8;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var logger=require('../../config/logger')(_0x06b2('0x2'));var moment=require('moment');var BPromise=require(_0x06b2('0x3'));var rp=require(_0x06b2('0x4'));var fs=require('fs');var path=require(_0x06b2('0x5'));var rimraf=require('rimraf');var config=require(_0x06b2('0x6'));var attributes=require(_0x06b2('0x7'));module[_0x06b2('0x8')]=function(_0x30d39c,_0x3b792b){return _0x30d39c[_0x06b2('0x9')](_0x06b2('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','ZendeskConfiguration','lodash','util'];(function(_0x4335bc,_0x480e11){var _0x4f804c=function(_0x155976){while(--_0x155976){_0x4335bc['push'](_0x4335bc['shift']());}};_0x4f804c(++_0x480e11);}(_0x63a5,0x18e));var _0x563a=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x63a5[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var logger=require(_0x563a('0x2'))('api');var moment=require(_0x563a('0x3'));var BPromise=require('bluebird');var rp=require(_0x563a('0x4'));var fs=require('fs');var path=require(_0x563a('0x5'));var rimraf=require(_0x563a('0x6'));var config=require(_0x563a('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x1fdcb0,_0x5a6458){return _0x1fdcb0[_0x563a('0x8')](_0x563a('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index f8d2280..a09de1b 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 _0xcc8a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xcc8a,0x1e0));var _0xacc8=function(_0xd83abd,_0x442167){_0xd83abd=_0xd83abd-0x0;var _0x35ba97=_0xcc8a[_0xd83abd];return _0x35ba97;};'use strict';var _=require(_0xacc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xacc8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacc8('0x2'));var db=require(_0xacc8('0x3'))['db'];var utils=require(_0xacc8('0x4'));var logger=require(_0xacc8('0x5'))(_0xacc8('0x6'));var config=require(_0xacc8('0x7'));var jayson=require(_0xacc8('0x8'));var client=jayson[_0xacc8('0x9')][_0xacc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41f341,_0x3f2c37,_0x3057ea){return new BPromise(function(_0x15931c,_0x225991){return client['request'](_0x41f341,_0x3057ea)['then'](function(_0x36cf76){logger[_0xacc8('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3f2c37,_0xacc8('0xc'));logger[_0xacc8('0xd')](_0xacc8('0xe'),_0x3f2c37,_0xacc8('0xc'),JSON[_0xacc8('0xf')](_0x36cf76));if(_0x36cf76['error']){if(_0x36cf76[_0xacc8('0x10')][_0xacc8('0x11')]===0x1f4){logger[_0xacc8('0x10')](_0xacc8('0x12'),_0x3f2c37,_0x36cf76[_0xacc8('0x10')][_0xacc8('0x13')]);return _0x225991(_0x36cf76[_0xacc8('0x10')][_0xacc8('0x13')]);}logger[_0xacc8('0x10')](_0xacc8('0x12'),_0x3f2c37,_0x36cf76['error'][_0xacc8('0x13')]);return _0x15931c(_0x36cf76[_0xacc8('0x10')]['message']);}else{logger[_0xacc8('0xb')](_0xacc8('0x12'),_0x3f2c37,_0xacc8('0xc'));_0x15931c(_0x36cf76['result']['message']);}})[_0xacc8('0x14')](function(_0x378ea7){logger[_0xacc8('0x10')](_0xacc8('0x12'),_0x3f2c37,_0x378ea7);_0x225991(_0x378ea7);});});} \ No newline at end of file +var _0x6c03=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x95242e,_0x4c0484){var _0x26112e=function(_0x589217){while(--_0x589217){_0x95242e['push'](_0x95242e['shift']());}};_0x26112e(++_0x4c0484);}(_0x6c03,0x1ab));var _0x36c0=function(_0xde0bcc,_0x178547){_0xde0bcc=_0xde0bcc-0x0;var _0x3e4452=_0x6c03[_0xde0bcc];return _0x3e4452;};'use strict';var _=require('lodash');var util=require(_0x36c0('0x0'));var moment=require(_0x36c0('0x1'));var BPromise=require(_0x36c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36c0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x36c0('0x4'))(_0x36c0('0x5'));var config=require(_0x36c0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x36c0('0x7')][_0x36c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x538488,_0x4053dd,_0x2aa3f4){return new BPromise(function(_0x4f4297,_0x55893c){return client[_0x36c0('0x9')](_0x538488,_0x2aa3f4)[_0x36c0('0xa')](function(_0x1a4db3){logger[_0x36c0('0xb')](_0x36c0('0xc'),_0x4053dd,_0x36c0('0xd'));logger[_0x36c0('0xe')](_0x36c0('0xf'),_0x4053dd,_0x36c0('0xd'),JSON[_0x36c0('0x10')](_0x1a4db3));if(_0x1a4db3[_0x36c0('0x11')]){if(_0x1a4db3[_0x36c0('0x11')][_0x36c0('0x12')]===0x1f4){logger['error'](_0x36c0('0xc'),_0x4053dd,_0x1a4db3[_0x36c0('0x11')][_0x36c0('0x13')]);return _0x55893c(_0x1a4db3[_0x36c0('0x11')][_0x36c0('0x13')]);}logger['error'](_0x36c0('0xc'),_0x4053dd,_0x1a4db3[_0x36c0('0x11')]['message']);return _0x4f4297(_0x1a4db3[_0x36c0('0x11')]['message']);}else{logger[_0x36c0('0xb')](_0x36c0('0xc'),_0x4053dd,_0x36c0('0xd'));_0x4f4297(_0x1a4db3[_0x36c0('0x14')][_0x36c0('0x13')]);}})[_0x36c0('0x15')](function(_0x2564c8){logger[_0x36c0('0x11')](_0x36c0('0xc'),_0x4053dd,_0x2564c8);_0x55893c(_0x2564c8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f8ad99a..10a1b2a 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 _0x2d13=['get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','index'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x2d13,0x1c2));var _0x32d1=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0x2d13[_0x52a6e3];return _0x8910d0;};'use strict';var multer=require(_0x32d1('0x0'));var util=require('util');var path=require(_0x32d1('0x1'));var timeout=require(_0x32d1('0x2'));var express=require(_0x32d1('0x3'));var router=express[_0x32d1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x32d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x32d1('0x6'));var controller=require(_0x32d1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x32d1('0x8')]);router[_0x32d1('0x9')](_0x32d1('0xa'),auth[_0x32d1('0xb')](),controller[_0x32d1('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x32d1('0xd')](_0x32d1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x32d1('0xe')](_0x32d1('0xa'),auth[_0x32d1('0xb')](),controller[_0x32d1('0xf')]);module[_0x32d1('0x10')]=router; \ No newline at end of file +var _0x8b89=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x421040,_0x42091c){var _0x3d737e=function(_0x32ff81){while(--_0x32ff81){_0x421040['push'](_0x421040['shift']());}};_0x3d737e(++_0x42091c);}(_0x8b89,0x16c));var _0x98b8=function(_0x977321,_0x2bec72){_0x977321=_0x977321-0x0;var _0x51a3f4=_0x8b89[_0x977321];return _0x51a3f4;};'use strict';var multer=require(_0x98b8('0x0'));var util=require(_0x98b8('0x1'));var path=require(_0x98b8('0x2'));var timeout=require(_0x98b8('0x3'));var express=require('express');var router=express[_0x98b8('0x4')]();var fs_extra=require(_0x98b8('0x5'));var auth=require(_0x98b8('0x6'));var interaction=require(_0x98b8('0x7'));var config=require(_0x98b8('0x8'));var controller=require(_0x98b8('0x9'));router[_0x98b8('0xa')]('/',auth[_0x98b8('0xb')](),controller['index']);router[_0x98b8('0xa')](_0x98b8('0xc'),auth['isAuthenticated'](),controller[_0x98b8('0xd')]);router[_0x98b8('0xe')]('/',auth['isAuthenticated'](),controller[_0x98b8('0xf')]);router['put'](_0x98b8('0xc'),auth[_0x98b8('0xb')](),controller[_0x98b8('0x10')]);router[_0x98b8('0x11')](_0x98b8('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x98b8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c0d5991..7ac3397 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 _0x6386=['exports','ENUM','keyValue','string','STRING','customVariable'];(function(_0x3bbbd2,_0x506692){var _0x18ad2e=function(_0x3f1d2f){while(--_0x3f1d2f){_0x3bbbd2['push'](_0x3bbbd2['shift']());}};_0x18ad2e(++_0x506692);}(_0x6386,0x1bc));var _0x6638=function(_0x40e7e5,_0x33af13){_0x40e7e5=_0x40e7e5-0x0;var _0x40f3c6=_0x6386[_0x40e7e5];return _0x40f3c6;};'use strict';var Sequelize=require('sequelize');module[_0x6638('0x0')]={'type':{'type':Sequelize[_0x6638('0x1')]('string','variable','customVariable',_0x6638('0x2'),'picklist'),'defaultValue':_0x6638('0x3')},'content':{'type':Sequelize[_0x6638('0x4')]},'key':{'type':Sequelize[_0x6638('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x6638('0x3'),'variable',_0x6638('0x5'))},'keyContent':{'type':Sequelize[_0x6638('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6638('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6638('0x4')]}}; \ No newline at end of file +var _0xb0a8=['string','variable','customVariable','picklist','STRING','sequelize'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xb0a8,0x95));var _0x8b0a=function(_0x5ca142,_0x33f34b){_0x5ca142=_0x5ca142-0x0;var _0x4cfcb2=_0xb0a8[_0x5ca142];return _0x4cfcb2;};'use strict';var Sequelize=require(_0x8b0a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x8b0a('0x1'),_0x8b0a('0x2'),_0x8b0a('0x3'),'keyValue',_0x8b0a('0x4')),'defaultValue':_0x8b0a('0x1')},'content':{'type':Sequelize[_0x8b0a('0x5')]},'key':{'type':Sequelize[_0x8b0a('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x8b0a('0x3'))},'keyContent':{'type':Sequelize[_0x8b0a('0x5')]},'idField':{'type':Sequelize[_0x8b0a('0x5')]},'nameField':{'type':Sequelize[_0x8b0a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b0a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 906e1a2..8c59da4 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 _0x726e=['includeAll','include','findAll','length','options','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x726e,0x186));var _0xe726=function(_0x3d3b75,_0x4e5961){_0x3d3b75=_0x3d3b75-0x0;var _0x4bb4ab=_0x726e[_0x3d3b75];return _0x4bb4ab;};'use strict';var emlformat=require(_0xe726('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe726('0x1'));var jsonpatch=require(_0xe726('0x2'));var rp=require(_0xe726('0x3'));var moment=require(_0xe726('0x4'));var BPromise=require(_0xe726('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe726('0x6'));var sox=require(_0xe726('0x7'));var csv=require('to-csv');var ejs=require(_0xe726('0x8'));var fs=require('fs');var fs_extra=require(_0xe726('0x9'));var _=require(_0xe726('0xa'));var squel=require(_0xe726('0xb'));var crypto=require(_0xe726('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe726('0xd'));var toCsv=require(_0xe726('0xe'));var querystring=require(_0xe726('0xf'));var Papa=require(_0xe726('0x10'));var Redis=require(_0xe726('0x11'));var authService=require(_0xe726('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe726('0x13'))(_0xe726('0x14'));var utils=require(_0xe726('0x15'));var config=require(_0xe726('0x16'));var licenseUtil=require(_0xe726('0x17'));var db=require(_0xe726('0x18'))['db'];function respondWithStatusCode(_0x2da712,_0x418b11){_0x418b11=_0x418b11||0xcc;return function(_0x4b096e){if(_0x4b096e){return _0x2da712[_0xe726('0x19')](_0x418b11);}return _0x2da712[_0xe726('0x1a')](_0x418b11)[_0xe726('0x1b')]();};}function respondWithResult(_0x1bfcce,_0x4ce692){_0x4ce692=_0x4ce692||0xc8;return function(_0x74d7df){if(_0x74d7df){return _0x1bfcce[_0xe726('0x1a')](_0x4ce692)[_0xe726('0x1c')](_0x74d7df);}};}function respondWithFilteredResult(_0x2dc9dc,_0x1a54a3){return function(_0x1644d1){if(_0x1644d1){var _0x39af50=typeof _0x1a54a3['offset']===_0xe726('0x1d')&&typeof _0x1a54a3[_0xe726('0x1e')]===_0xe726('0x1d');var _0x3c5be0=_0x1644d1[_0xe726('0x1f')];var _0x5bff0d=_0x39af50?0x0:_0x1a54a3[_0xe726('0x20')];var _0x1202a2=_0x39af50?_0x1644d1[_0xe726('0x1f')]:_0x1a54a3[_0xe726('0x20')]+_0x1a54a3[_0xe726('0x1e')];var _0x20742d;if(_0x1202a2>=_0x3c5be0){_0x1202a2=_0x3c5be0;_0x20742d=0xc8;}else{_0x20742d=0xce;}_0x2dc9dc['status'](_0x20742d);return _0x2dc9dc[_0xe726('0x21')](_0xe726('0x22'),_0x5bff0d+'-'+_0x1202a2+'/'+_0x3c5be0)[_0xe726('0x1c')](_0x1644d1);}return null;};}function patchUpdates(_0x1fce4c){return function(_0xe4e7b3){try{jsonpatch[_0xe726('0x23')](_0xe4e7b3,_0x1fce4c,!![]);}catch(_0x29a2a6){return BPromise[_0xe726('0x24')](_0x29a2a6);}return _0xe4e7b3[_0xe726('0x25')]();};}function saveUpdates(_0x314531,_0x55cf32){return function(_0x304b16){if(_0x304b16){return _0x304b16[_0xe726('0x26')](_0x314531)[_0xe726('0x27')](function(_0x5a67d3){return _0x5a67d3;});}return null;};}function removeEntity(_0x3f2e4a,_0x5e5314){return function(_0x222337){if(_0x222337){return _0x222337[_0xe726('0x28')]()[_0xe726('0x27')](function(){_0x3f2e4a[_0xe726('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6aad,_0x444e7d){return function(_0x2ac054){if(!_0x2ac054){_0x1e6aad[_0xe726('0x19')](0x194);}return _0x2ac054;};}function handleError(_0x31e2b5,_0x50b395){_0x50b395=_0x50b395||0x1f4;return function(_0x1ddeb4){logger[_0xe726('0x29')](_0x1ddeb4[_0xe726('0x2a')]);if(_0x1ddeb4[_0xe726('0x2b')]){delete _0x1ddeb4['name'];}_0x31e2b5[_0xe726('0x1a')](_0x50b395)['send'](_0x1ddeb4);};}exports[_0xe726('0x2c')]=function(_0x46f287,_0x5a7934){var _0x161dd5={},_0x35e0ed={},_0x2781b6={'count':0x0,'rows':[]};var _0x34c03a=_[_0xe726('0x2d')](db[_0xe726('0x2e')][_0xe726('0x2f')],function(_0x246f61){return{'name':_0x246f61[_0xe726('0x30')],'type':_0x246f61[_0xe726('0x31')][_0xe726('0x32')]};});_0x35e0ed[_0xe726('0x33')]=_[_0xe726('0x2d')](_0x34c03a,_0xe726('0x2b'));_0x35e0ed[_0xe726('0x34')]=_[_0xe726('0x35')](_0x46f287[_0xe726('0x34')]);_0x35e0ed[_0xe726('0x36')]=_[_0xe726('0x37')](_0x35e0ed['model'],_0x35e0ed[_0xe726('0x34')]);_0x161dd5[_0xe726('0x38')]=_['intersection'](_0x35e0ed[_0xe726('0x33')],qs[_0xe726('0x39')](_0x46f287[_0xe726('0x34')][_0xe726('0x39')]));_0x161dd5[_0xe726('0x38')]=_0x161dd5[_0xe726('0x38')]['length']?_0x161dd5[_0xe726('0x38')]:_0x35e0ed[_0xe726('0x33')];if(!_0x46f287[_0xe726('0x34')][_0xe726('0x3a')](_0xe726('0x3b'))){_0x161dd5[_0xe726('0x1e')]=qs[_0xe726('0x1e')](_0x46f287[_0xe726('0x34')][_0xe726('0x1e')]);_0x161dd5[_0xe726('0x20')]=qs['offset'](_0x46f287[_0xe726('0x34')][_0xe726('0x20')]);}_0x161dd5[_0xe726('0x3c')]=qs[_0xe726('0x3d')](_0x46f287[_0xe726('0x34')][_0xe726('0x3d')]);_0x161dd5[_0xe726('0x3e')]=qs['filters'](_['pick'](_0x46f287[_0xe726('0x34')],_0x35e0ed[_0xe726('0x36')]),_0x34c03a);if(_0x46f287[_0xe726('0x34')]['filter']){_0x161dd5[_0xe726('0x3e')]=_[_0xe726('0x3f')](_0x161dd5[_0xe726('0x3e')],{'$or':_[_0xe726('0x2d')](_0x34c03a,function(_0x41cd5e){if(_0x41cd5e[_0xe726('0x31')]!==_0xe726('0x40')){var _0x470143={};_0x470143[_0x41cd5e['name']]={'$like':'%'+_0x46f287['query'][_0xe726('0x41')]+'%'};return _0x470143;}})});}_0x161dd5=_['merge']({},_0x161dd5,_0x46f287['options']);var _0xdea4b5={'where':_0x161dd5[_0xe726('0x3e')]};return db['ZendeskField'][_0xe726('0x1f')](_0xdea4b5)[_0xe726('0x27')](function(_0x35348e){_0x2781b6[_0xe726('0x1f')]=_0x35348e;if(_0x46f287['query'][_0xe726('0x42')]){_0x161dd5[_0xe726('0x43')]=[{'all':!![]}];}return db[_0xe726('0x2e')][_0xe726('0x44')](_0x161dd5);})[_0xe726('0x27')](function(_0xa3fae7){_0x2781b6['rows']=_0xa3fae7;return _0x2781b6;})['then'](respondWithFilteredResult(_0x5a7934,_0x161dd5))['catch'](handleError(_0x5a7934,null));};exports['show']=function(_0x56d5c9,_0x44f2c2){var _0x47f8de={'raw':!![],'where':{'id':_0x56d5c9['params']['id']}},_0x2a1d32={};_0x2a1d32['model']=_['keys'](db[_0xe726('0x2e')][_0xe726('0x2f')]);_0x2a1d32[_0xe726('0x34')]=_[_0xe726('0x35')](_0x56d5c9[_0xe726('0x34')]);_0x2a1d32['filters']=_[_0xe726('0x37')](_0x2a1d32[_0xe726('0x33')],_0x2a1d32[_0xe726('0x34')]);_0x47f8de[_0xe726('0x38')]=_['intersection'](_0x2a1d32[_0xe726('0x33')],qs['fields'](_0x56d5c9[_0xe726('0x34')][_0xe726('0x39')]));_0x47f8de['attributes']=_0x47f8de[_0xe726('0x38')][_0xe726('0x45')]?_0x47f8de[_0xe726('0x38')]:_0x2a1d32[_0xe726('0x33')];if(_0x56d5c9[_0xe726('0x34')][_0xe726('0x42')]){_0x47f8de[_0xe726('0x43')]=[{'all':!![]}];}_0x47f8de=_['merge']({},_0x47f8de,_0x56d5c9[_0xe726('0x46')]);return db[_0xe726('0x2e')][_0xe726('0x47')](_0x47f8de)['then'](handleEntityNotFound(_0x44f2c2,null))[_0xe726('0x27')](respondWithResult(_0x44f2c2,null))['catch'](handleError(_0x44f2c2,null));};exports[_0xe726('0x48')]=function(_0x29bac4,_0xf57734){return db[_0xe726('0x2e')]['create'](_0x29bac4[_0xe726('0x49')],{})['then'](respondWithResult(_0xf57734,0xc9))[_0xe726('0x4a')](handleError(_0xf57734,null));};exports[_0xe726('0x26')]=function(_0x4f7ea4,_0x4bcb7e){if(_0x4f7ea4[_0xe726('0x49')]['id']){delete _0x4f7ea4['body']['id'];}return db['ZendeskField'][_0xe726('0x47')]({'where':{'id':_0x4f7ea4['params']['id']}})[_0xe726('0x27')](handleEntityNotFound(_0x4bcb7e,null))['then'](saveUpdates(_0x4f7ea4[_0xe726('0x49')],null))['then'](respondWithResult(_0x4bcb7e,null))[_0xe726('0x4a')](handleError(_0x4bcb7e,null));};exports[_0xe726('0x28')]=function(_0x5dac19,_0x5289f2){return db[_0xe726('0x2e')][_0xe726('0x47')]({'where':{'id':_0x5dac19[_0xe726('0x4b')]['id']}})[_0xe726('0x27')](handleEntityNotFound(_0x5289f2,null))[_0xe726('0x27')](removeEntity(_0x5289f2,null))[_0xe726('0x4a')](handleError(_0x5289f2,null));}; \ No newline at end of file +var _0x89c7=['params','include','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','sendStatus','error','stack','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show'];(function(_0x126f01,_0x401cc1){var _0x32c1e3=function(_0x167801){while(--_0x167801){_0x126f01['push'](_0x126f01['shift']());}};_0x32c1e3(++_0x401cc1);}(_0x89c7,0xd8));var _0x789c=function(_0x3d5d40,_0x143d30){_0x3d5d40=_0x3d5d40-0x0;var _0x5ddfa8=_0x89c7[_0x3d5d40];return _0x5ddfa8;};'use strict';var emlformat=require(_0x789c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x789c('0x1'));var jsonpatch=require(_0x789c('0x2'));var rp=require(_0x789c('0x3'));var moment=require(_0x789c('0x4'));var BPromise=require(_0x789c('0x5'));var Mustache=require(_0x789c('0x6'));var util=require('util');var path=require(_0x789c('0x7'));var sox=require(_0x789c('0x8'));var csv=require(_0x789c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x789c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x789c('0xb'));var deskjs=require(_0x789c('0xc'));var toCsv=require(_0x789c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x789c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x789c('0xe'))(_0x789c('0xf'));var utils=require(_0x789c('0x10'));var config=require(_0x789c('0x11'));var licenseUtil=require(_0x789c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26aae2,_0x4e703a){_0x4e703a=_0x4e703a||0xcc;return function(_0x7f380d){if(_0x7f380d){return _0x26aae2['sendStatus'](_0x4e703a);}return _0x26aae2[_0x789c('0x13')](_0x4e703a)['end']();};}function respondWithResult(_0x244be3,_0x3bbdf4){_0x3bbdf4=_0x3bbdf4||0xc8;return function(_0x34fe6a){if(_0x34fe6a){return _0x244be3[_0x789c('0x13')](_0x3bbdf4)[_0x789c('0x14')](_0x34fe6a);}};}function respondWithFilteredResult(_0xe813c4,_0x2889ad){return function(_0x141216){if(_0x141216){var _0x15e72d=typeof _0x2889ad[_0x789c('0x15')]===_0x789c('0x16')&&typeof _0x2889ad[_0x789c('0x17')]===_0x789c('0x16');var _0x2cf2b4=_0x141216[_0x789c('0x18')];var _0xd956ac=_0x15e72d?0x0:_0x2889ad[_0x789c('0x15')];var _0x28e250=_0x15e72d?_0x141216['count']:_0x2889ad['offset']+_0x2889ad[_0x789c('0x17')];var _0x28aea4;if(_0x28e250>=_0x2cf2b4){_0x28e250=_0x2cf2b4;_0x28aea4=0xc8;}else{_0x28aea4=0xce;}_0xe813c4['status'](_0x28aea4);return _0xe813c4[_0x789c('0x19')]('Content-Range',_0xd956ac+'-'+_0x28e250+'/'+_0x2cf2b4)[_0x789c('0x14')](_0x141216);}return null;};}function patchUpdates(_0x3b7078){return function(_0x448cb9){try{jsonpatch[_0x789c('0x1a')](_0x448cb9,_0x3b7078,!![]);}catch(_0x20eb31){return BPromise[_0x789c('0x1b')](_0x20eb31);}return _0x448cb9[_0x789c('0x1c')]();};}function saveUpdates(_0x5a462a,_0x1984a3){return function(_0x329d2c){if(_0x329d2c){return _0x329d2c[_0x789c('0x1d')](_0x5a462a)[_0x789c('0x1e')](function(_0x168ed5){return _0x168ed5;});}return null;};}function removeEntity(_0x320745,_0x459c7e){return function(_0x2af4b4){if(_0x2af4b4){return _0x2af4b4['destroy']()[_0x789c('0x1e')](function(){_0x320745[_0x789c('0x13')](0xcc)[_0x789c('0x1f')]();});}};}function handleEntityNotFound(_0x3d79ba,_0x55f28b){return function(_0x113f20){if(!_0x113f20){_0x3d79ba[_0x789c('0x20')](0x194);}return _0x113f20;};}function handleError(_0x2201c8,_0x55e992){_0x55e992=_0x55e992||0x1f4;return function(_0x4ef4c4){logger[_0x789c('0x21')](_0x4ef4c4[_0x789c('0x22')]);if(_0x4ef4c4['name']){delete _0x4ef4c4['name'];}_0x2201c8[_0x789c('0x13')](_0x55e992)[_0x789c('0x23')](_0x4ef4c4);};}exports[_0x789c('0x24')]=function(_0x3eb1c2,_0x555842){var _0x156c48={},_0x437f4d={},_0x5e71f5={'count':0x0,'rows':[]};var _0x1dc4e7=_[_0x789c('0x25')](db[_0x789c('0x26')][_0x789c('0x27')],function(_0x32275){return{'name':_0x32275[_0x789c('0x28')],'type':_0x32275[_0x789c('0x29')][_0x789c('0x2a')]};});_0x437f4d['model']=_['map'](_0x1dc4e7,_0x789c('0x2b'));_0x437f4d[_0x789c('0x2c')]=_[_0x789c('0x2d')](_0x3eb1c2['query']);_0x437f4d[_0x789c('0x2e')]=_[_0x789c('0x2f')](_0x437f4d[_0x789c('0x30')],_0x437f4d[_0x789c('0x2c')]);_0x156c48['attributes']=_[_0x789c('0x2f')](_0x437f4d[_0x789c('0x30')],qs[_0x789c('0x31')](_0x3eb1c2[_0x789c('0x2c')]['fields']));_0x156c48[_0x789c('0x32')]=_0x156c48['attributes'][_0x789c('0x33')]?_0x156c48[_0x789c('0x32')]:_0x437f4d[_0x789c('0x30')];if(!_0x3eb1c2['query']['hasOwnProperty'](_0x789c('0x34'))){_0x156c48[_0x789c('0x17')]=qs['limit'](_0x3eb1c2[_0x789c('0x2c')][_0x789c('0x17')]);_0x156c48[_0x789c('0x15')]=qs['offset'](_0x3eb1c2[_0x789c('0x2c')][_0x789c('0x15')]);}_0x156c48['order']=qs[_0x789c('0x35')](_0x3eb1c2[_0x789c('0x2c')]['sort']);_0x156c48[_0x789c('0x36')]=qs[_0x789c('0x2e')](_[_0x789c('0x37')](_0x3eb1c2['query'],_0x437f4d[_0x789c('0x2e')]),_0x1dc4e7);if(_0x3eb1c2[_0x789c('0x2c')]['filter']){_0x156c48[_0x789c('0x36')]=_[_0x789c('0x38')](_0x156c48[_0x789c('0x36')],{'$or':_[_0x789c('0x25')](_0x1dc4e7,function(_0x36d95e){if(_0x36d95e[_0x789c('0x29')]!==_0x789c('0x39')){var _0x9ca1aa={};_0x9ca1aa[_0x36d95e[_0x789c('0x2b')]]={'$like':'%'+_0x3eb1c2[_0x789c('0x2c')][_0x789c('0x3a')]+'%'};return _0x9ca1aa;}})});}_0x156c48=_[_0x789c('0x38')]({},_0x156c48,_0x3eb1c2['options']);var _0x466644={'where':_0x156c48['where']};return db['ZendeskField'][_0x789c('0x18')](_0x466644)[_0x789c('0x1e')](function(_0x3cf767){_0x5e71f5[_0x789c('0x18')]=_0x3cf767;if(_0x3eb1c2[_0x789c('0x2c')][_0x789c('0x3b')]){_0x156c48['include']=[{'all':!![]}];}return db[_0x789c('0x26')][_0x789c('0x3c')](_0x156c48);})[_0x789c('0x1e')](function(_0x1378e4){_0x5e71f5[_0x789c('0x3d')]=_0x1378e4;return _0x5e71f5;})[_0x789c('0x1e')](respondWithFilteredResult(_0x555842,_0x156c48))[_0x789c('0x3e')](handleError(_0x555842,null));};exports[_0x789c('0x3f')]=function(_0x33dc7b,_0x32f7c8){var _0x3a9d91={'raw':!![],'where':{'id':_0x33dc7b[_0x789c('0x40')]['id']}},_0x357d44={};_0x357d44[_0x789c('0x30')]=_[_0x789c('0x2d')](db[_0x789c('0x26')][_0x789c('0x27')]);_0x357d44[_0x789c('0x2c')]=_['keys'](_0x33dc7b[_0x789c('0x2c')]);_0x357d44[_0x789c('0x2e')]=_['intersection'](_0x357d44[_0x789c('0x30')],_0x357d44[_0x789c('0x2c')]);_0x3a9d91['attributes']=_['intersection'](_0x357d44[_0x789c('0x30')],qs[_0x789c('0x31')](_0x33dc7b[_0x789c('0x2c')]['fields']));_0x3a9d91[_0x789c('0x32')]=_0x3a9d91[_0x789c('0x32')][_0x789c('0x33')]?_0x3a9d91[_0x789c('0x32')]:_0x357d44[_0x789c('0x30')];if(_0x33dc7b[_0x789c('0x2c')]['includeAll']){_0x3a9d91[_0x789c('0x41')]=[{'all':!![]}];}_0x3a9d91=_['merge']({},_0x3a9d91,_0x33dc7b['options']);return db['ZendeskField']['find'](_0x3a9d91)['then'](handleEntityNotFound(_0x32f7c8,null))[_0x789c('0x1e')](respondWithResult(_0x32f7c8,null))[_0x789c('0x3e')](handleError(_0x32f7c8,null));};exports['create']=function(_0x2811bd,_0x55d3af){return db[_0x789c('0x26')][_0x789c('0x42')](_0x2811bd['body'],{})[_0x789c('0x1e')](respondWithResult(_0x55d3af,0xc9))[_0x789c('0x3e')](handleError(_0x55d3af,null));};exports['update']=function(_0xf079bb,_0x3c00f0){if(_0xf079bb[_0x789c('0x43')]['id']){delete _0xf079bb[_0x789c('0x43')]['id'];}return db[_0x789c('0x26')][_0x789c('0x44')]({'where':{'id':_0xf079bb['params']['id']}})[_0x789c('0x1e')](handleEntityNotFound(_0x3c00f0,null))[_0x789c('0x1e')](saveUpdates(_0xf079bb['body'],null))['then'](respondWithResult(_0x3c00f0,null))['catch'](handleError(_0x3c00f0,null));};exports[_0x789c('0x45')]=function(_0x494e85,_0x2ba7a4){return db[_0x789c('0x26')]['find']({'where':{'id':_0x494e85[_0x789c('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ba7a4,null))[_0x789c('0x1e')](removeEntity(_0x2ba7a4,null))[_0x789c('0x3e')](handleError(_0x2ba7a4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5ff1f05..5a43284 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 _0xc57a=['util','api','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash'];(function(_0x3b5e9f,_0x29601e){var _0x1e9a49=function(_0x31cf02){while(--_0x31cf02){_0x3b5e9f['push'](_0x3b5e9f['shift']());}};_0x1e9a49(++_0x29601e);}(_0xc57a,0x81));var _0xac57=function(_0x251895,_0x414adb){_0x251895=_0x251895-0x0;var _0x70b2dd=_0xc57a[_0x251895];return _0x70b2dd;};'use strict';var _=require(_0xac57('0x0'));var util=require(_0xac57('0x1'));var logger=require('../../config/logger')(_0xac57('0x2'));var moment=require(_0xac57('0x3'));var BPromise=require(_0xac57('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac57('0x5'));var config=require(_0xac57('0x6'));var attributes=require(_0xac57('0x7'));module['exports']=function(_0x327ed6,_0x306934){return _0x327ed6[_0xac57('0x8')](_0xac57('0x9'),attributes,{'tableName':_0xac57('0xa'),'paranoid':![],'indexes':[{'name':_0xac57('0xb'),'fields':[_0xac57('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41a3=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0xfb65aa,_0x1651a6){var _0x2aee31=function(_0x492245){while(--_0x492245){_0xfb65aa['push'](_0xfb65aa['shift']());}};_0x2aee31(++_0x1651a6);}(_0x41a3,0x111));var _0x341a=function(_0x5c4642,_0x175a08){_0x5c4642=_0x5c4642-0x0;var _0x4090fe=_0x41a3[_0x5c4642];return _0x4090fe;};'use strict';var _=require(_0x341a('0x0'));var util=require(_0x341a('0x1'));var logger=require(_0x341a('0x2'))(_0x341a('0x3'));var moment=require('moment');var BPromise=require(_0x341a('0x4'));var rp=require(_0x341a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x341a('0x6'));var config=require(_0x341a('0x7'));var attributes=require(_0x341a('0x8'));module[_0x341a('0x9')]=function(_0x361876,_0x4a4b6b){return _0x361876[_0x341a('0xa')](_0x341a('0xb'),attributes,{'tableName':_0x341a('0xc'),'paranoid':![],'indexes':[{'name':_0x341a('0xd'),'fields':[_0x341a('0xe'),_0x341a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 332e617..242d4ec 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 _0x4ed1=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x3a7a1d,_0xf0a687){var _0x2b5fe0=function(_0x47ba52){while(--_0x47ba52){_0x3a7a1d['push'](_0x3a7a1d['shift']());}};_0x2b5fe0(++_0xf0a687);}(_0x4ed1,0x16f));var _0x14ed=function(_0x40b6ea,_0xe65162){_0x40b6ea=_0x40b6ea-0x0;var _0x40a588=_0x4ed1[_0x40b6ea];return _0x40a588;};'use strict';var _=require('lodash');var util=require(_0x14ed('0x0'));var moment=require(_0x14ed('0x1'));var BPromise=require(_0x14ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14ed('0x3'))['db'];var utils=require(_0x14ed('0x4'));var logger=require(_0x14ed('0x5'))(_0x14ed('0x6'));var config=require(_0x14ed('0x7'));var jayson=require(_0x14ed('0x8'));var client=jayson[_0x14ed('0x9')][_0x14ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x167a0f,_0x3b6d7c,_0x1569b6){return new BPromise(function(_0x4302d6,_0x2e35dc){return client[_0x14ed('0xb')](_0x167a0f,_0x1569b6)['then'](function(_0x468a31){logger[_0x14ed('0xc')](_0x14ed('0xd'),_0x3b6d7c,_0x14ed('0xe'));logger[_0x14ed('0xf')](_0x14ed('0x10'),_0x3b6d7c,_0x14ed('0xe'),JSON[_0x14ed('0x11')](_0x468a31));if(_0x468a31[_0x14ed('0x12')]){if(_0x468a31[_0x14ed('0x12')][_0x14ed('0x13')]===0x1f4){logger[_0x14ed('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3b6d7c,_0x468a31[_0x14ed('0x12')][_0x14ed('0x14')]);return _0x2e35dc(_0x468a31[_0x14ed('0x12')][_0x14ed('0x14')]);}logger[_0x14ed('0x12')](_0x14ed('0xd'),_0x3b6d7c,_0x468a31[_0x14ed('0x12')]['message']);return _0x4302d6(_0x468a31[_0x14ed('0x12')][_0x14ed('0x14')]);}else{logger[_0x14ed('0xc')](_0x14ed('0xd'),_0x3b6d7c,'request\x20sent');_0x4302d6(_0x468a31[_0x14ed('0x15')][_0x14ed('0x14')]);}})[_0x14ed('0x16')](function(_0x4f4b16){logger[_0x14ed('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3b6d7c,_0x4f4b16);_0x2e35dc(_0x4f4b16);});});} \ No newline at end of file +var _0x0d2e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0d2e,0x90));var _0xe0d2=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x0d2e[_0x3c6ae2];return _0x4edda;};'use strict';var _=require(_0xe0d2('0x0'));var util=require(_0xe0d2('0x1'));var moment=require(_0xe0d2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0d2('0x3'));var db=require(_0xe0d2('0x4'))['db'];var utils=require(_0xe0d2('0x5'));var logger=require(_0xe0d2('0x6'))(_0xe0d2('0x7'));var config=require(_0xe0d2('0x8'));var jayson=require(_0xe0d2('0x9'));var client=jayson[_0xe0d2('0xa')][_0xe0d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341daa,_0x4ef94d,_0x44adf1){return new BPromise(function(_0x35f685,_0x493e10){return client[_0xe0d2('0xc')](_0x341daa,_0x44adf1)[_0xe0d2('0xd')](function(_0x2cacfc){logger[_0xe0d2('0xe')](_0xe0d2('0xf'),_0x4ef94d,'request\x20sent');logger[_0xe0d2('0x10')](_0xe0d2('0x11'),_0x4ef94d,_0xe0d2('0x12'),JSON[_0xe0d2('0x13')](_0x2cacfc));if(_0x2cacfc[_0xe0d2('0x14')]){if(_0x2cacfc[_0xe0d2('0x14')][_0xe0d2('0x15')]===0x1f4){logger[_0xe0d2('0x14')]('ZendeskField,\x20%s,\x20%s',_0x4ef94d,_0x2cacfc['error'][_0xe0d2('0x16')]);return _0x493e10(_0x2cacfc['error'][_0xe0d2('0x16')]);}logger[_0xe0d2('0x14')](_0xe0d2('0xf'),_0x4ef94d,_0x2cacfc['error'][_0xe0d2('0x16')]);return _0x35f685(_0x2cacfc[_0xe0d2('0x14')]['message']);}else{logger[_0xe0d2('0xe')](_0xe0d2('0xf'),_0x4ef94d,_0xe0d2('0x12'));_0x35f685(_0x2cacfc[_0xe0d2('0x17')][_0xe0d2('0x16')]);}})[_0xe0d2('0x18')](function(_0x238ae5){logger[_0xe0d2('0x14')]('ZendeskField,\x20%s,\x20%s',_0x4ef94d,_0x238ae5);_0x493e10(_0x238ae5);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ec43242..ecac5e1 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 _0x9004=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9004,0x6a));var _0x4900=function(_0x4bba05,_0x4e8e67){_0x4bba05=_0x4bba05-0x0;var _0x100b05=_0x9004[_0x4bba05];return _0x100b05;};'use strict';var multer=require(_0x4900('0x0'));var util=require(_0x4900('0x1'));var path=require('path');var timeout=require(_0x4900('0x2'));var express=require(_0x4900('0x3'));var router=express[_0x4900('0x4')]();var fs_extra=require(_0x4900('0x5'));var auth=require(_0x4900('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4900('0x7'));var controller=require(_0x4900('0x8'));router['get']('/',auth[_0x4900('0x9')](),controller[_0x4900('0xa')]);router[_0x4900('0xb')]('/:id',auth[_0x4900('0x9')](),controller[_0x4900('0xc')]);router[_0x4900('0xb')](_0x4900('0xd'),auth[_0x4900('0x9')](),controller[_0x4900('0xe')]);router[_0x4900('0xb')](_0x4900('0xf'),auth[_0x4900('0x9')](),controller[_0x4900('0x10')]);router[_0x4900('0x11')]('/',auth[_0x4900('0x9')](),controller[_0x4900('0x12')]);router[_0x4900('0x11')](_0x4900('0xd'),auth[_0x4900('0x9')](),controller[_0x4900('0x13')]);router['put'](_0x4900('0x14'),auth[_0x4900('0x9')](),controller['update']);router[_0x4900('0x15')](_0x4900('0x14'),auth['isAuthenticated'](),controller[_0x4900('0x16')]);module[_0x4900('0x17')]=router; \ No newline at end of file +var _0xeb7a=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0xeb7a,0xf1));var _0xaeb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb7a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xaeb7('0x0'));var util=require(_0xaeb7('0x1'));var path=require(_0xaeb7('0x2'));var timeout=require(_0xaeb7('0x3'));var express=require('express');var router=express[_0xaeb7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaeb7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaeb7('0x6')](_0xaeb7('0x7'),auth[_0xaeb7('0x8')](),controller[_0xaeb7('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xaeb7('0xa')]);router[_0xaeb7('0x6')](_0xaeb7('0xb'),auth[_0xaeb7('0x8')](),controller['getFields']);router[_0xaeb7('0xc')]('/',auth['isAuthenticated'](),controller[_0xaeb7('0xd')]);router[_0xaeb7('0xc')](_0xaeb7('0xe'),auth[_0xaeb7('0x8')](),controller[_0xaeb7('0xf')]);router[_0xaeb7('0x10')](_0xaeb7('0x7'),auth['isAuthenticated'](),controller[_0xaeb7('0x11')]);router[_0xaeb7('0x12')](_0xaeb7('0x7'),auth[_0xaeb7('0x8')](),controller[_0xaeb7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b04193a..a0432fc 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['STRING','exports'];(function(_0x442f5b,_0x39d79d){var _0x19fd96=function(_0x419b3f){while(--_0x419b3f){_0x442f5b['push'](_0x442f5b['shift']());}};_0x19fd96(++_0x39d79d);}(_0x91a7,0xe7));var _0x791a=function(_0x32f145,_0xf6a2ae){_0x32f145=_0x32f145-0x0;var _0xe274ba=_0x91a7[_0x32f145];return _0xe274ba;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x791a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x791a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file +var _0x9c44=['STRING'];(function(_0x580a59,_0x21266c){var _0x19da51=function(_0x772ac8){while(--_0x772ac8){_0x580a59['push'](_0x580a59['shift']());}};_0x19da51(++_0x21266c);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')]},'description':{'type':Sequelize[_0x49c4('0x0')]},'host':{'type':Sequelize[_0x49c4('0x0')]},'zone':{'type':Sequelize[_0x49c4('0x0')]},'clientId':{'type':Sequelize[_0x49c4('0x0')]},'clientSecret':{'type':Sequelize[_0x49c4('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x49c4('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 35537f1..28da81d 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 _0x342e=['Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','filter','where','VIRTUAL','merge','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','nolimit','addConfiguration','findOne','getSubjects','getDescriptions','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientId','clientSecret','serverUrl','code','host','zoho.eu','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message'];(function(_0x40215a,_0x4b0876){var _0x5eb303=function(_0xa1fce0){while(--_0xa1fce0){_0x40215a['push'](_0x40215a['shift']());}};_0x5eb303(++_0x4b0876);}(_0x342e,0x8d));var _0xe342=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0x342e[_0x80d733];return _0x435868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe342('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe342('0x1'));var rp=require(_0xe342('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe342('0x3'));var util=require('util');var path=require(_0xe342('0x4'));var sox=require('sox');var csv=require(_0xe342('0x5'));var ejs=require(_0xe342('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe342('0x7'));var squel=require(_0xe342('0x8'));var crypto=require(_0xe342('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe342('0x5'));var querystring=require(_0xe342('0xa'));var Papa=require(_0xe342('0xb'));var Redis=require(_0xe342('0xc'));var authService=require(_0xe342('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe342('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe342('0xf'));var utils=require(_0xe342('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe342('0x11'));var db=require(_0xe342('0x12'))['db'];var integrations=require(_0xe342('0x13'));function respondWithStatusCode(_0xf80e6a,_0x3fc3d5){_0x3fc3d5=_0x3fc3d5||0xcc;return function(_0x125089){if(_0x125089){return _0xf80e6a[_0xe342('0x14')](_0x3fc3d5);}return _0xf80e6a[_0xe342('0x15')](_0x3fc3d5)[_0xe342('0x16')]();};}function respondWithResult(_0x4b3b2d,_0x3d1c77){_0x3d1c77=_0x3d1c77||0xc8;return function(_0x165a01){if(_0x165a01){return _0x4b3b2d[_0xe342('0x15')](_0x3d1c77)[_0xe342('0x17')](_0x165a01);}};}function respondWithFilteredResult(_0x3d960c,_0x456718){return function(_0x2af9f0){if(_0x2af9f0){var _0x4aada5=typeof _0x456718[_0xe342('0x18')]===_0xe342('0x19')&&typeof _0x456718['limit']==='undefined';var _0x28da83=_0x2af9f0['count'];var _0x4b14f1=_0x4aada5?0x0:_0x456718[_0xe342('0x18')];var _0x280805=_0x4aada5?_0x2af9f0[_0xe342('0x1a')]:_0x456718['offset']+_0x456718['limit'];var _0x492897;if(_0x280805>=_0x28da83){_0x280805=_0x28da83;_0x492897=0xc8;}else{_0x492897=0xce;}_0x3d960c['status'](_0x492897);return _0x3d960c[_0xe342('0x1b')](_0xe342('0x1c'),_0x4b14f1+'-'+_0x280805+'/'+_0x28da83)['json'](_0x2af9f0);}return null;};}function patchUpdates(_0x54c5d8){return function(_0x2574cc){try{jsonpatch['apply'](_0x2574cc,_0x54c5d8,!![]);}catch(_0x16b4e6){return BPromise[_0xe342('0x1d')](_0x16b4e6);}return _0x2574cc['save']();};}function saveUpdates(_0x32d47b,_0x5e34ab){return function(_0x14ef34){if(_0x14ef34){return _0x14ef34[_0xe342('0x1e')](_0x32d47b)[_0xe342('0x1f')](function(_0x27ae70){return _0x27ae70;});}return null;};}function removeEntity(_0x186a72,_0x2c72cf){return function(_0x2d7bc3){if(_0x2d7bc3){return _0x2d7bc3[_0xe342('0x20')]()[_0xe342('0x1f')](function(){_0x186a72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f762f,_0x2d7cc8){return function(_0x55fde1){if(!_0x55fde1){_0x3f762f['sendStatus'](0x194);}return _0x55fde1;};}function handleError(_0x523bfc,_0x90debb){_0x90debb=_0x90debb||0x1f4;return function(_0x19945d){logger[_0xe342('0x21')](_0x19945d[_0xe342('0x22')]);if(_0x19945d[_0xe342('0x23')]){delete _0x19945d['name'];}_0x523bfc[_0xe342('0x15')](_0x90debb)['send'](_0x19945d);};}exports[_0xe342('0x24')]=function(_0x199c2b,_0x2ae55c){var _0x57f00a={},_0x17f87b={},_0x4306f2={'count':0x0,'rows':[]};var _0x3284a2=_[_0xe342('0x25')](db['ZohoAccount'][_0xe342('0x26')],function(_0x57038b){return{'name':_0x57038b['fieldName'],'type':_0x57038b[_0xe342('0x27')][_0xe342('0x28')]};});_0x17f87b['model']=_[_0xe342('0x25')](_0x3284a2,_0xe342('0x23'));_0x17f87b[_0xe342('0x29')]=_[_0xe342('0x2a')](_0x199c2b[_0xe342('0x29')]);_0x17f87b[_0xe342('0x2b')]=_[_0xe342('0x2c')](_0x17f87b[_0xe342('0x2d')],_0x17f87b[_0xe342('0x29')]);_0x57f00a[_0xe342('0x2e')]=_[_0xe342('0x2c')](_0x17f87b['model'],qs['fields'](_0x199c2b[_0xe342('0x29')][_0xe342('0x2f')]));_0x57f00a[_0xe342('0x2e')]=_0x57f00a[_0xe342('0x2e')]['length']?_0x57f00a['attributes']:_0x17f87b['model'];if(!_0x199c2b['query'][_0xe342('0x30')]('nolimit')){_0x57f00a[_0xe342('0x31')]=qs[_0xe342('0x31')](_0x199c2b[_0xe342('0x29')][_0xe342('0x31')]);_0x57f00a[_0xe342('0x18')]=qs[_0xe342('0x18')](_0x199c2b[_0xe342('0x29')][_0xe342('0x18')]);}_0x57f00a[_0xe342('0x32')]=qs[_0xe342('0x33')](_0x199c2b[_0xe342('0x29')][_0xe342('0x33')]);_0x57f00a['where']=qs[_0xe342('0x2b')](_['pick'](_0x199c2b['query'],_0x17f87b[_0xe342('0x2b')]),_0x3284a2);if(_0x199c2b[_0xe342('0x29')][_0xe342('0x34')]){_0x57f00a[_0xe342('0x35')]=_['merge'](_0x57f00a[_0xe342('0x35')],{'$or':_[_0xe342('0x25')](_0x3284a2,function(_0x10dea6){if(_0x10dea6[_0xe342('0x27')]!==_0xe342('0x36')){var _0x5b9843={};_0x5b9843[_0x10dea6[_0xe342('0x23')]]={'$like':'%'+_0x199c2b[_0xe342('0x29')][_0xe342('0x34')]+'%'};return _0x5b9843;}})});}_0x57f00a=_[_0xe342('0x37')]({},_0x57f00a,_0x199c2b[_0xe342('0x38')]);var _0x4122f6={'where':_0x57f00a[_0xe342('0x35')]};return db[_0xe342('0x39')][_0xe342('0x1a')](_0x4122f6)[_0xe342('0x1f')](function(_0x7fd486){_0x4306f2[_0xe342('0x1a')]=_0x7fd486;if(_0x199c2b[_0xe342('0x29')][_0xe342('0x3a')]){_0x57f00a[_0xe342('0x3b')]=[{'all':!![]}];}return db[_0xe342('0x39')][_0xe342('0x3c')](_0x57f00a);})[_0xe342('0x1f')](function(_0x401087){_0x4306f2[_0xe342('0x3d')]=_0x401087;return _0x4306f2;})['then'](respondWithFilteredResult(_0x2ae55c,_0x57f00a))[_0xe342('0x3e')](handleError(_0x2ae55c,null));};exports[_0xe342('0x3f')]=function(_0x51068a,_0x1abdd0){var _0x2e47b2={'raw':![],'where':{'id':_0x51068a[_0xe342('0x40')]['id']}},_0x3629e8={};_0x3629e8[_0xe342('0x2d')]=_[_0xe342('0x2a')](db[_0xe342('0x39')][_0xe342('0x26')]);_0x3629e8[_0xe342('0x29')]=_[_0xe342('0x2a')](_0x51068a[_0xe342('0x29')]);_0x3629e8[_0xe342('0x2b')]=_[_0xe342('0x2c')](_0x3629e8[_0xe342('0x2d')],_0x3629e8[_0xe342('0x29')]);_0x2e47b2['attributes']=_[_0xe342('0x2c')](_0x3629e8['model'],qs['fields'](_0x51068a[_0xe342('0x29')]['fields']));_0x2e47b2[_0xe342('0x2e')]=_0x2e47b2['attributes'][_0xe342('0x41')]?_0x2e47b2['attributes']:_0x3629e8[_0xe342('0x2d')];if(_0x51068a[_0xe342('0x29')][_0xe342('0x3a')]){_0x2e47b2[_0xe342('0x3b')]=[{'all':!![]}];}_0x2e47b2=_['merge']({},_0x2e47b2,_0x51068a[_0xe342('0x38')]);return db[_0xe342('0x39')][_0xe342('0x42')](_0x2e47b2)['then'](handleEntityNotFound(_0x1abdd0,null))[_0xe342('0x1f')](respondWithResult(_0x1abdd0,null))[_0xe342('0x3e')](handleError(_0x1abdd0,null));};exports[_0xe342('0x43')]=function(_0x2190ca,_0x4a6ce6){return db[_0xe342('0x39')][_0xe342('0x43')](_0x2190ca['body'],{})[_0xe342('0x1f')](respondWithResult(_0x4a6ce6,0xc9))[_0xe342('0x3e')](handleError(_0x4a6ce6,null));};exports[_0xe342('0x1e')]=function(_0x154cc4,_0xb0ac81){if(_0x154cc4[_0xe342('0x44')]['id']){delete _0x154cc4[_0xe342('0x44')]['id'];}return db[_0xe342('0x39')][_0xe342('0x42')]({'where':{'id':_0x154cc4[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0xb0ac81,null))['then'](saveUpdates(_0x154cc4[_0xe342('0x44')],null))[_0xe342('0x1f')](respondWithResult(_0xb0ac81,null))[_0xe342('0x3e')](handleError(_0xb0ac81,null));};exports[_0xe342('0x20')]=function(_0x5aa285,_0x4c3e70){return db['ZohoAccount']['find']({'where':{'id':_0x5aa285[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0x4c3e70,null))[_0xe342('0x1f')](removeEntity(_0x4c3e70,null))[_0xe342('0x3e')](handleError(_0x4c3e70,null));};exports[_0xe342('0x45')]=function(_0x406238,_0xc4203d,_0xa77d95){var _0x1a79cd={};var _0x51c665={};var _0x109b72;var _0xc214b0;return db['ZohoAccount']['findOne']({'where':{'id':_0x406238[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0xc4203d,null))['then'](function(_0x1cf852){if(_0x1cf852){_0x109b72=_0x1cf852;_0x51c665[_0xe342('0x2d')]=_[_0xe342('0x2a')](db['ZohoConfiguration']['rawAttributes']);_0x51c665[_0xe342('0x29')]=_['keys'](_0x406238[_0xe342('0x29')]);_0x51c665[_0xe342('0x2b')]=_['intersection'](_0x51c665[_0xe342('0x2d')],_0x51c665[_0xe342('0x29')]);_0x1a79cd[_0xe342('0x2e')]=_[_0xe342('0x2c')](_0x51c665[_0xe342('0x2d')],qs[_0xe342('0x2f')](_0x406238[_0xe342('0x29')][_0xe342('0x2f')]));_0x1a79cd[_0xe342('0x2e')]=_0x1a79cd[_0xe342('0x2e')]['length']?_0x1a79cd['attributes']:_0x51c665['model'];_0x1a79cd[_0xe342('0x32')]=qs[_0xe342('0x33')](_0x406238[_0xe342('0x29')][_0xe342('0x33')]);_0x1a79cd['where']=qs['filters'](_['pick'](_0x406238[_0xe342('0x29')],_0x51c665[_0xe342('0x2b')]));if(_0x406238[_0xe342('0x29')]['filter']){_0x1a79cd[_0xe342('0x35')]=_['merge'](_0x1a79cd[_0xe342('0x35')],{'$or':_['map'](_0x1a79cd[_0xe342('0x2e')],function(_0xf5e032){var _0x537273={};_0x537273[_0xf5e032]={'$like':'%'+_0x406238[_0xe342('0x29')]['filter']+'%'};return _0x537273;})});}_0x1a79cd=_['merge']({},_0x1a79cd,_0x406238[_0xe342('0x38')]);return _0x109b72[_0xe342('0x45')](_0x1a79cd);}})[_0xe342('0x1f')](function(_0xb72eb5){if(_0xb72eb5){_0xc214b0=_0xb72eb5[_0xe342('0x41')];if(!_0x406238[_0xe342('0x29')]['hasOwnProperty'](_0xe342('0x46'))){_0x1a79cd[_0xe342('0x31')]=qs[_0xe342('0x31')](_0x406238[_0xe342('0x29')][_0xe342('0x31')]);_0x1a79cd[_0xe342('0x18')]=qs['offset'](_0x406238[_0xe342('0x29')][_0xe342('0x18')]);}return _0x109b72[_0xe342('0x45')](_0x1a79cd);}})[_0xe342('0x1f')](function(_0x59de14){if(_0x59de14){return _0x59de14?{'count':_0xc214b0,'rows':_0x59de14}:null;}})[_0xe342('0x1f')](respondWithResult(_0xc4203d,null))[_0xe342('0x3e')](handleError(_0xc4203d,null));};exports[_0xe342('0x47')]=function(_0x198f3a,_0x1257a7,_0x1227d6){if(_0x198f3a[_0xe342('0x44')]['id']){delete _0x198f3a[_0xe342('0x44')]['id'];}return db['ZohoAccount'][_0xe342('0x48')]({'where':{'id':_0x198f3a[_0xe342('0x40')]['id']}})[_0xe342('0x1f')](handleEntityNotFound(_0x1257a7,null))[_0xe342('0x1f')](function(_0x2f38e0){if(_0x2f38e0){_0x198f3a[_0xe342('0x44')]['AccountId']=_0x2f38e0['id'];_0x198f3a[_0xe342('0x44')]['Subjects']=integrations[_0xe342('0x49')](_0x198f3a['body']['channel'],_0x198f3a['body'][_0xe342('0x27')]);_0x198f3a['body']['Descriptions']=integrations[_0xe342('0x4a')](_0x198f3a[_0xe342('0x44')]['channel'],_0x198f3a[_0xe342('0x44')]['type']);return db['ZohoConfiguration'][_0xe342('0x43')](_0x198f3a[_0xe342('0x44')],{'include':[{'model':db[_0xe342('0x4b')],'as':_0xe342('0x4c')},{'model':db[_0xe342('0x4b')],'as':_0xe342('0x4d')}]});}return null;})[_0xe342('0x1f')](respondWithResult(_0x1257a7,null))[_0xe342('0x3e')](handleError(_0x1257a7,null));};function getAccessToken(_0x17a679){return new Promise(function(_0x3dd0e5,_0x41df21){var _0x1cc9d0;switch(_0x17a679[_0xe342('0x4e')]){case'US':_0x1cc9d0=_0xe342('0x4f');break;case'AU':_0x1cc9d0=_0xe342('0x50');break;case'EU':_0x1cc9d0=_0xe342('0x51');break;case'IN':_0x1cc9d0=_0xe342('0x52');break;case'CN':_0x1cc9d0=_0xe342('0x53');break;default:_0x1cc9d0='https://accounts.zoho.eu';break;}var _0x3d114d={'method':_0xe342('0x54'),'uri':_0x1cc9d0+_0xe342('0x55'),'qs':{'refresh_token':_0x17a679[_0xe342('0x56')],'client_id':_0x17a679['clientId'],'client_secret':_0x17a679['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3d114d)[_0xe342('0x1f')](function(_0x91cfea){if(_0x91cfea[_0xe342('0x57')]){_0x3dd0e5(_0x91cfea[_0xe342('0x57')]);}else{_0x41df21(_0xe342('0x58'));}})[_0xe342('0x3e')](function(_0x59b7e5){_0x41df21(_0x59b7e5);});});}exports['getFields']=function(_0x5ac8d3,_0x19a254,_0x2419b2){var _0x379258,_0x5ec4a0,_0x24fc93,_0x2d24a7,_0x5f0d37;return db[_0xe342('0x39')][_0xe342('0x48')]({'where':{'id':_0x5ac8d3[_0xe342('0x40')]['id']},'attributes':['id','host','zone',_0xe342('0x59'),_0xe342('0x5a'),_0xe342('0x5b'),_0xe342('0x5c'),_0xe342('0x56')]})['then'](handleEntityNotFound(_0x19a254,null))[_0xe342('0x1f')](function(_0x292372){_0x5f0d37=_0x292372;_0x379258=_0x5f0d37[_0xe342('0x5d')];_0x5ec4a0=_0x379258===_0xe342('0x5e')?'eu':'com';_0x24fc93=_0x5f0d37['serverUrl'];var _0x25f059=_0x24fc93[_0xe342('0x5f')](-0x1);if(_0x25f059==='/'||_0x25f059==='\x5c'||_0x25f059===':'){_0x24fc93=_0x24fc93['substring'](0x0,_0x24fc93['lastIndexOf'](_0x25f059));}if(!_0x5f0d37[_0xe342('0x56')]){throw new Error(_0xe342('0x60'));}return getAccessToken(_0x5f0d37);})[_0xe342('0x1f')](function(_0x2fa489){if(_0x2fa489){return rp({'method':_0xe342('0x61'),'uri':util['format'](_0xe342('0x62'),_0x5ec4a0),'qs':{'module':_0xe342('0x63')},'headers':{'Authorization':_0xe342('0x64')+_0x2fa489},'json':!![]});}})[_0xe342('0x1f')](function(_0x5e39a1){if(_0x5e39a1){if(_0x5e39a1[_0xe342('0x65')]&&_0x5e39a1[_0xe342('0x65')][_0xe342('0x21')]){throw new Error(_0x5e39a1[_0xe342('0x65')][_0xe342('0x21')][_0xe342('0x66')]);}var _0x24ccce=[];var _0x3bc8a6=[];var _0x460791=[_0xe342('0x67'),_0xe342('0x68'),_0xe342('0x69'),_0xe342('0x6a'),_0xe342('0x6b'),_0xe342('0x6c'),'Call_Start_Time',_0xe342('0x6d')];_0x3bc8a6=_[_0xe342('0x6e')](_0x5e39a1['fields'],function(_0x48a5b8){return _0x460791['includes'](_0x48a5b8['api_name']);});for(var _0x1fe3b8=0x0;_0x1fe3b8<_0x3bc8a6[_0xe342('0x41')];_0x1fe3b8++){if(_0x3bc8a6[_0x1fe3b8]['system_mandatory']===![]){_0x24ccce[_0xe342('0x6f')]({'id':_0x3bc8a6[_0x1fe3b8]['id'],'name':_0x3bc8a6[_0x1fe3b8]['display_label'],'custom':_0x3bc8a6[_0x1fe3b8][_0xe342('0x70')],'options':_0x3bc8a6[_0x1fe3b8][_0xe342('0x71')]===_0xe342('0x72')&&_0x3bc8a6[_0x1fe3b8][_0xe342('0x73')][_0xe342('0x41')]>-0x1?_[_0xe342('0x25')](_0x3bc8a6[_0x1fe3b8][_0xe342('0x73')],function(_0x31996f){return{'name':_0x31996f,'value':_0x31996f};}):[]});}}return{'count':_0x24ccce['length'],'rows':_0x24ccce};}else{return{'count':0x0,'rows':[]};}})[_0xe342('0x1f')](respondWithResult(_0x19a254,null))[_0xe342('0x3e')](function(_0x8536ed){var _0x480c85=_0x5ac8d3[_0xe342('0x29')][_0xe342('0x74')]?0x1f4:_0x8536ed[_0xe342('0x75')]||0x1f4;logger[_0xe342('0x21')](_0xe342('0x76'),'getFields',_0x480c85,JSON[_0xe342('0x77')](_0x8536ed));delete _0x8536ed[_0xe342('0x23')];if(_0x480c85===0x191){_0x480c85=0x190;}_0x19a254[_0xe342('0x15')](_0x480c85)[_0xe342('0x78')](_0x5ac8d3[_0xe342('0x29')][_0xe342('0x74')]?{'message':_0xe342('0x79'),'statusCode':_0x8536ed[_0xe342('0x75')]}:_0x8536ed);});}; \ No newline at end of file +var _0x014c=['getSubjects','channel','Descriptions','getDescriptions','ZohoField','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','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','code','zoho.eu','com','serverUrl','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','WhoId','Call_Duration','Call_Start_Time','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','AccountId'];(function(_0x125378,_0x243ad2){var _0x243ebc=function(_0x2dbfb4){while(--_0x2dbfb4){_0x125378['push'](_0x125378['shift']());}};_0x243ebc(++_0x243ad2);}(_0x014c,0x136));var _0xc014=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x014c[_0x44cb92];return _0x56b9e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc014('0x0'));var zipdir=require(_0xc014('0x1'));var jsonpatch=require(_0xc014('0x2'));var rp=require(_0xc014('0x3'));var moment=require(_0xc014('0x4'));var BPromise=require(_0xc014('0x5'));var Mustache=require('mustache');var util=require(_0xc014('0x6'));var path=require(_0xc014('0x7'));var sox=require(_0xc014('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc014('0x9'));var _=require('lodash');var squel=require(_0xc014('0xa'));var crypto=require(_0xc014('0xb'));var jsforce=require(_0xc014('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc014('0xd'));var querystring=require(_0xc014('0xe'));var Papa=require(_0xc014('0xf'));var Redis=require(_0xc014('0x10'));var authService=require(_0xc014('0x11'));var qs=require(_0xc014('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc014('0x13'));var logger=require(_0xc014('0x14'))(_0xc014('0x15'));var utils=require(_0xc014('0x16'));var config=require(_0xc014('0x17'));var licenseUtil=require(_0xc014('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc014('0x19'));function respondWithStatusCode(_0x42cd33,_0x236299){_0x236299=_0x236299||0xcc;return function(_0x2b9d8d){if(_0x2b9d8d){return _0x42cd33[_0xc014('0x1a')](_0x236299);}return _0x42cd33[_0xc014('0x1b')](_0x236299)[_0xc014('0x1c')]();};}function respondWithResult(_0x381945,_0x3e6275){_0x3e6275=_0x3e6275||0xc8;return function(_0x236497){if(_0x236497){return _0x381945['status'](_0x3e6275)[_0xc014('0x1d')](_0x236497);}};}function respondWithFilteredResult(_0x35b186,_0x182424){return function(_0x14beb3){if(_0x14beb3){var _0x7d3cdd=typeof _0x182424[_0xc014('0x1e')]==='undefined'&&typeof _0x182424[_0xc014('0x1f')]===_0xc014('0x20');var _0x55ae0d=_0x14beb3[_0xc014('0x21')];var _0x388c7b=_0x7d3cdd?0x0:_0x182424[_0xc014('0x1e')];var _0x4eae0a=_0x7d3cdd?_0x14beb3[_0xc014('0x21')]:_0x182424[_0xc014('0x1e')]+_0x182424[_0xc014('0x1f')];var _0x406157;if(_0x4eae0a>=_0x55ae0d){_0x4eae0a=_0x55ae0d;_0x406157=0xc8;}else{_0x406157=0xce;}_0x35b186[_0xc014('0x1b')](_0x406157);return _0x35b186[_0xc014('0x22')](_0xc014('0x23'),_0x388c7b+'-'+_0x4eae0a+'/'+_0x55ae0d)[_0xc014('0x1d')](_0x14beb3);}return null;};}function patchUpdates(_0x2f8280){return function(_0x455f1e){try{jsonpatch[_0xc014('0x24')](_0x455f1e,_0x2f8280,!![]);}catch(_0x4a1065){return BPromise[_0xc014('0x25')](_0x4a1065);}return _0x455f1e[_0xc014('0x26')]();};}function saveUpdates(_0x18b67a,_0x184924){return function(_0x646269){if(_0x646269){return _0x646269[_0xc014('0x27')](_0x18b67a)[_0xc014('0x28')](function(_0x4a897f){return _0x4a897f;});}return null;};}function removeEntity(_0x46e0d6,_0x27026b){return function(_0x4ac618){if(_0x4ac618){return _0x4ac618[_0xc014('0x29')]()['then'](function(){_0x46e0d6[_0xc014('0x1b')](0xcc)[_0xc014('0x1c')]();});}};}function handleEntityNotFound(_0x4b3ece,_0x95badc){return function(_0x23c608){if(!_0x23c608){_0x4b3ece['sendStatus'](0x194);}return _0x23c608;};}function handleError(_0x67373,_0x418da6){_0x418da6=_0x418da6||0x1f4;return function(_0x15bb26){logger[_0xc014('0x2a')](_0x15bb26[_0xc014('0x2b')]);if(_0x15bb26['name']){delete _0x15bb26[_0xc014('0x2c')];}_0x67373[_0xc014('0x1b')](_0x418da6)[_0xc014('0x2d')](_0x15bb26);};}exports['index']=function(_0x5c55c1,_0x3ad3ed){var _0x4d8ce4={},_0x312130={},_0x5037b8={'count':0x0,'rows':[]};var _0x2644a7=_[_0xc014('0x2e')](db[_0xc014('0x2f')][_0xc014('0x30')],function(_0x4fb749){return{'name':_0x4fb749[_0xc014('0x31')],'type':_0x4fb749[_0xc014('0x32')]['key']};});_0x312130[_0xc014('0x33')]=_['map'](_0x2644a7,_0xc014('0x2c'));_0x312130[_0xc014('0x34')]=_[_0xc014('0x35')](_0x5c55c1[_0xc014('0x34')]);_0x312130['filters']=_[_0xc014('0x36')](_0x312130['model'],_0x312130[_0xc014('0x34')]);_0x4d8ce4[_0xc014('0x37')]=_[_0xc014('0x36')](_0x312130[_0xc014('0x33')],qs[_0xc014('0x38')](_0x5c55c1[_0xc014('0x34')][_0xc014('0x38')]));_0x4d8ce4[_0xc014('0x37')]=_0x4d8ce4[_0xc014('0x37')][_0xc014('0x39')]?_0x4d8ce4['attributes']:_0x312130[_0xc014('0x33')];if(!_0x5c55c1[_0xc014('0x34')][_0xc014('0x3a')](_0xc014('0x3b'))){_0x4d8ce4[_0xc014('0x1f')]=qs[_0xc014('0x1f')](_0x5c55c1[_0xc014('0x34')][_0xc014('0x1f')]);_0x4d8ce4[_0xc014('0x1e')]=qs['offset'](_0x5c55c1[_0xc014('0x34')][_0xc014('0x1e')]);}_0x4d8ce4['order']=qs[_0xc014('0x3c')](_0x5c55c1[_0xc014('0x34')][_0xc014('0x3c')]);_0x4d8ce4[_0xc014('0x3d')]=qs[_0xc014('0x3e')](_[_0xc014('0x3f')](_0x5c55c1[_0xc014('0x34')],_0x312130[_0xc014('0x3e')]),_0x2644a7);if(_0x5c55c1['query'][_0xc014('0x40')]){_0x4d8ce4[_0xc014('0x3d')]=_[_0xc014('0x41')](_0x4d8ce4[_0xc014('0x3d')],{'$or':_['map'](_0x2644a7,function(_0x1a1889){if(_0x1a1889[_0xc014('0x32')]!==_0xc014('0x42')){var _0x1d37a8={};_0x1d37a8[_0x1a1889[_0xc014('0x2c')]]={'$like':'%'+_0x5c55c1['query']['filter']+'%'};return _0x1d37a8;}})});}_0x4d8ce4=_[_0xc014('0x41')]({},_0x4d8ce4,_0x5c55c1['options']);var _0x46a9c8={'where':_0x4d8ce4[_0xc014('0x3d')]};return db[_0xc014('0x2f')]['count'](_0x46a9c8)['then'](function(_0x6dd6fd){_0x5037b8[_0xc014('0x21')]=_0x6dd6fd;if(_0x5c55c1[_0xc014('0x34')][_0xc014('0x43')]){_0x4d8ce4[_0xc014('0x44')]=[{'all':!![]}];}return db[_0xc014('0x2f')][_0xc014('0x45')](_0x4d8ce4);})[_0xc014('0x28')](function(_0x26a199){_0x5037b8['rows']=_0x26a199;return _0x5037b8;})[_0xc014('0x28')](respondWithFilteredResult(_0x3ad3ed,_0x4d8ce4))[_0xc014('0x46')](handleError(_0x3ad3ed,null));};exports[_0xc014('0x47')]=function(_0x4317cf,_0x2de67e){var _0x38b287={'raw':![],'where':{'id':_0x4317cf[_0xc014('0x48')]['id']}},_0x85ff49={};_0x85ff49[_0xc014('0x33')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x85ff49[_0xc014('0x34')]=_[_0xc014('0x35')](_0x4317cf['query']);_0x85ff49[_0xc014('0x3e')]=_[_0xc014('0x36')](_0x85ff49[_0xc014('0x33')],_0x85ff49['query']);_0x38b287[_0xc014('0x37')]=_[_0xc014('0x36')](_0x85ff49[_0xc014('0x33')],qs[_0xc014('0x38')](_0x4317cf['query']['fields']));_0x38b287[_0xc014('0x37')]=_0x38b287[_0xc014('0x37')]['length']?_0x38b287[_0xc014('0x37')]:_0x85ff49[_0xc014('0x33')];if(_0x4317cf[_0xc014('0x34')]['includeAll']){_0x38b287['include']=[{'all':!![]}];}_0x38b287=_[_0xc014('0x41')]({},_0x38b287,_0x4317cf[_0xc014('0x49')]);return db[_0xc014('0x2f')][_0xc014('0x4a')](_0x38b287)[_0xc014('0x28')](handleEntityNotFound(_0x2de67e,null))[_0xc014('0x28')](respondWithResult(_0x2de67e,null))['catch'](handleError(_0x2de67e,null));};exports['create']=function(_0x2b0382,_0x524c28){return db[_0xc014('0x2f')][_0xc014('0x4b')](_0x2b0382[_0xc014('0x4c')],{})[_0xc014('0x28')](respondWithResult(_0x524c28,0xc9))[_0xc014('0x46')](handleError(_0x524c28,null));};exports[_0xc014('0x27')]=function(_0xc5d4b5,_0x2a826f){if(_0xc5d4b5[_0xc014('0x4c')]['id']){delete _0xc5d4b5[_0xc014('0x4c')]['id'];}return db[_0xc014('0x2f')][_0xc014('0x4a')]({'where':{'id':_0xc5d4b5['params']['id']}})['then'](handleEntityNotFound(_0x2a826f,null))['then'](saveUpdates(_0xc5d4b5['body'],null))[_0xc014('0x28')](respondWithResult(_0x2a826f,null))[_0xc014('0x46')](handleError(_0x2a826f,null));};exports[_0xc014('0x29')]=function(_0x40de71,_0xa6ce79){return db[_0xc014('0x2f')][_0xc014('0x4a')]({'where':{'id':_0x40de71[_0xc014('0x48')]['id']}})[_0xc014('0x28')](handleEntityNotFound(_0xa6ce79,null))[_0xc014('0x28')](removeEntity(_0xa6ce79,null))['catch'](handleError(_0xa6ce79,null));};exports[_0xc014('0x4d')]=function(_0x283cc9,_0x1a9ba7,_0x48c98d){var _0x18c4d2={};var _0x180580={};var _0xcdcbbb;var _0xeb35ea;return db[_0xc014('0x2f')][_0xc014('0x4e')]({'where':{'id':_0x283cc9[_0xc014('0x48')]['id']}})[_0xc014('0x28')](handleEntityNotFound(_0x1a9ba7,null))[_0xc014('0x28')](function(_0x67cbfb){if(_0x67cbfb){_0xcdcbbb=_0x67cbfb;_0x180580[_0xc014('0x33')]=_[_0xc014('0x35')](db[_0xc014('0x4f')][_0xc014('0x30')]);_0x180580[_0xc014('0x34')]=_['keys'](_0x283cc9['query']);_0x180580['filters']=_['intersection'](_0x180580['model'],_0x180580[_0xc014('0x34')]);_0x18c4d2[_0xc014('0x37')]=_[_0xc014('0x36')](_0x180580[_0xc014('0x33')],qs[_0xc014('0x38')](_0x283cc9[_0xc014('0x34')][_0xc014('0x38')]));_0x18c4d2[_0xc014('0x37')]=_0x18c4d2[_0xc014('0x37')][_0xc014('0x39')]?_0x18c4d2[_0xc014('0x37')]:_0x180580[_0xc014('0x33')];_0x18c4d2[_0xc014('0x50')]=qs[_0xc014('0x3c')](_0x283cc9[_0xc014('0x34')][_0xc014('0x3c')]);_0x18c4d2['where']=qs[_0xc014('0x3e')](_[_0xc014('0x3f')](_0x283cc9[_0xc014('0x34')],_0x180580['filters']));if(_0x283cc9[_0xc014('0x34')]['filter']){_0x18c4d2[_0xc014('0x3d')]=_[_0xc014('0x41')](_0x18c4d2[_0xc014('0x3d')],{'$or':_[_0xc014('0x2e')](_0x18c4d2[_0xc014('0x37')],function(_0x28a13e){var _0x4f6de0={};_0x4f6de0[_0x28a13e]={'$like':'%'+_0x283cc9[_0xc014('0x34')]['filter']+'%'};return _0x4f6de0;})});}_0x18c4d2=_[_0xc014('0x41')]({},_0x18c4d2,_0x283cc9['options']);return _0xcdcbbb[_0xc014('0x4d')](_0x18c4d2);}})[_0xc014('0x28')](function(_0xc87aa0){if(_0xc87aa0){_0xeb35ea=_0xc87aa0['length'];if(!_0x283cc9[_0xc014('0x34')][_0xc014('0x3a')]('nolimit')){_0x18c4d2[_0xc014('0x1f')]=qs[_0xc014('0x1f')](_0x283cc9[_0xc014('0x34')][_0xc014('0x1f')]);_0x18c4d2[_0xc014('0x1e')]=qs[_0xc014('0x1e')](_0x283cc9[_0xc014('0x34')][_0xc014('0x1e')]);}return _0xcdcbbb[_0xc014('0x4d')](_0x18c4d2);}})[_0xc014('0x28')](function(_0x38417d){if(_0x38417d){return _0x38417d?{'count':_0xeb35ea,'rows':_0x38417d}:null;}})[_0xc014('0x28')](respondWithResult(_0x1a9ba7,null))[_0xc014('0x46')](handleError(_0x1a9ba7,null));};exports[_0xc014('0x51')]=function(_0x46dd7e,_0x528856,_0x527c53){if(_0x46dd7e[_0xc014('0x4c')]['id']){delete _0x46dd7e[_0xc014('0x4c')]['id'];}return db[_0xc014('0x2f')][_0xc014('0x4e')]({'where':{'id':_0x46dd7e['params']['id']}})[_0xc014('0x28')](handleEntityNotFound(_0x528856,null))[_0xc014('0x28')](function(_0x1b2a4e){if(_0x1b2a4e){_0x46dd7e[_0xc014('0x4c')][_0xc014('0x52')]=_0x1b2a4e['id'];_0x46dd7e[_0xc014('0x4c')]['Subjects']=integrations[_0xc014('0x53')](_0x46dd7e[_0xc014('0x4c')][_0xc014('0x54')],_0x46dd7e[_0xc014('0x4c')][_0xc014('0x32')]);_0x46dd7e[_0xc014('0x4c')][_0xc014('0x55')]=integrations[_0xc014('0x56')](_0x46dd7e[_0xc014('0x4c')][_0xc014('0x54')],_0x46dd7e[_0xc014('0x4c')]['type']);return db['ZohoConfiguration'][_0xc014('0x4b')](_0x46dd7e['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xc014('0x57')],'as':_0xc014('0x55')}]});}return null;})[_0xc014('0x28')](respondWithResult(_0x528856,null))[_0xc014('0x46')](handleError(_0x528856,null));};function getAccessToken(_0xfc319){return new Promise(function(_0x509b7f,_0x1daf29){var _0x2a5603;switch(_0xfc319['zone']){case'US':_0x2a5603=_0xc014('0x58');break;case'AU':_0x2a5603=_0xc014('0x59');break;case'EU':_0x2a5603=_0xc014('0x5a');break;case'IN':_0x2a5603=_0xc014('0x5b');break;case'CN':_0x2a5603=_0xc014('0x5c');break;default:_0x2a5603='https://accounts.zoho.eu';break;}var _0x4771cc={'method':_0xc014('0x5d'),'uri':_0x2a5603+'/oauth/v2/token','qs':{'refresh_token':_0xfc319[_0xc014('0x5e')],'client_id':_0xfc319['clientId'],'client_secret':_0xfc319[_0xc014('0x5f')],'grant_type':_0xc014('0x60')},'json':!![]};return rp(_0x4771cc)[_0xc014('0x28')](function(_0x4b68a0){if(_0x4b68a0[_0xc014('0x61')]){_0x509b7f(_0x4b68a0[_0xc014('0x61')]);}else{_0x1daf29(_0xc014('0x62'));}})[_0xc014('0x46')](function(_0x14bab7){_0x1daf29(_0x14bab7);});});}exports[_0xc014('0x63')]=function(_0x3ee2cc,_0x322d8b,_0x58b42e){var _0x598d75,_0x359b22,_0xecc724,_0x4f7a39,_0x4c7162;return db[_0xc014('0x2f')]['findOne']({'where':{'id':_0x3ee2cc[_0xc014('0x48')]['id']},'attributes':['id',_0xc014('0x64'),'zone',_0xc014('0x65'),_0xc014('0x5f'),'serverUrl',_0xc014('0x66'),_0xc014('0x5e')]})[_0xc014('0x28')](handleEntityNotFound(_0x322d8b,null))[_0xc014('0x28')](function(_0x71482b){_0x4c7162=_0x71482b;_0x598d75=_0x4c7162['host'];_0x359b22=_0x598d75===_0xc014('0x67')?'eu':_0xc014('0x68');_0xecc724=_0x4c7162[_0xc014('0x69')];var _0xcce066=_0xecc724['slice'](-0x1);if(_0xcce066==='/'||_0xcce066==='\x5c'||_0xcce066===':'){_0xecc724=_0xecc724[_0xc014('0x6a')](0x0,_0xecc724[_0xc014('0x6b')](_0xcce066));}if(!_0x4c7162[_0xc014('0x5e')]){throw new Error(_0xc014('0x6c'));}return getAccessToken(_0x4c7162);})[_0xc014('0x28')](function(_0xcc62e8){if(_0xcc62e8){return rp({'method':_0xc014('0x6d'),'uri':util[_0xc014('0x6e')](_0xc014('0x6f'),_0x359b22),'qs':{'module':_0xc014('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xcc62e8},'json':!![]});}})[_0xc014('0x28')](function(_0x8f6dc5){if(_0x8f6dc5){if(_0x8f6dc5[_0xc014('0x71')]&&_0x8f6dc5[_0xc014('0x71')][_0xc014('0x2a')]){throw new Error(_0x8f6dc5[_0xc014('0x71')][_0xc014('0x2a')]['message']);}var _0x902f5f=[];var _0x3cc408=[];var _0x45f181=[_0xc014('0x72'),_0xc014('0x73'),'Description',_0xc014('0x74'),_0xc014('0x75'),'Call_Result',_0xc014('0x76'),'Call_Type'];_0x3cc408=_['remove'](_0x8f6dc5[_0xc014('0x38')],function(_0x705a3d){return _0x45f181[_0xc014('0x77')](_0x705a3d[_0xc014('0x78')]);});for(var _0x303fcc=0x0;_0x303fcc<_0x3cc408[_0xc014('0x39')];_0x303fcc++){if(_0x3cc408[_0x303fcc][_0xc014('0x79')]===![]){_0x902f5f[_0xc014('0x7a')]({'id':_0x3cc408[_0x303fcc]['id'],'name':_0x3cc408[_0x303fcc][_0xc014('0x7b')],'custom':_0x3cc408[_0x303fcc]['custom_field'],'options':_0x3cc408[_0x303fcc][_0xc014('0x7c')]===_0xc014('0x7d')&&_0x3cc408[_0x303fcc][_0xc014('0x7e')][_0xc014('0x39')]>-0x1?_['map'](_0x3cc408[_0x303fcc]['pick_list_values'],function(_0x105218){return{'name':_0x105218,'value':_0x105218};}):[]});}}return{'count':_0x902f5f[_0xc014('0x39')],'rows':_0x902f5f};}else{return{'count':0x0,'rows':[]};}})[_0xc014('0x28')](respondWithResult(_0x322d8b,null))['catch'](function(_0x5233e2){var _0x206c07=_0x3ee2cc[_0xc014('0x34')][_0xc014('0x7f')]?0x1f4:_0x5233e2['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xc014('0x63'),_0x206c07,JSON[_0xc014('0x80')](_0x5233e2));delete _0x5233e2[_0xc014('0x2c')];if(_0x206c07===0x191){_0x206c07=0x190;}_0x322d8b[_0xc014('0x1b')](_0x206c07)[_0xc014('0x2d')](_0x3ee2cc[_0xc014('0x34')][_0xc014('0x7f')]?{'message':_0xc014('0x81'),'statusCode':_0x5233e2[_0xc014('0x82')]}:_0x5233e2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8354a4c..4e81c37 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 _0x7400=['https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','format','/oauth/v2/token','application/x-www-form-urlencoded','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','api','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x7400,0x108));var _0x0740=function(_0x2f06e0,_0x2e1c2a){_0x2f06e0=_0x2f06e0-0x0;var _0xf2711b=_0x7400[_0x2f06e0];return _0xf2711b;};'use strict';var _=require(_0x0740('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0740('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0740('0x2'));var fs=require('fs');var path=require(_0x0740('0x3'));var rimraf=require(_0x0740('0x4'));var config=require('../../config/environment');var attributes=require(_0x0740('0x5'));var integrations=require(_0x0740('0x6'));module[_0x0740('0x7')]=function(_0x3e69d4,_0x7c2164){return _0x3e69d4[_0x0740('0x8')](_0x0740('0x9'),attributes,{'tableName':_0x0740('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x57ba02,_0x56bdbd,_0x595041){if(_0x57ba02[_0x0740('0xb')](_0x0740('0xc'))||_0x57ba02[_0x0740('0xb')](_0x0740('0xd'))||_0x57ba02[_0x0740('0xb')](_0x0740('0xe'))||_0x57ba02['changed'](_0x0740('0xf'))||_0x57ba02[_0x0740('0xb')](_0x0740('0x10'))||_0x57ba02[_0x0740('0xb')](_0x0740('0x11'))){var _0x43b986,_0xd74f7b;_0x43b986=_0x57ba02['serverUrl'];var _0x5607ef=_0x43b986[_0x0740('0x12')](-0x1);if(_0x5607ef==='/'||_0x5607ef==='\x5c'||_0x5607ef===':'){_0x43b986=_0x43b986[_0x0740('0x13')](0x0,_0x43b986[_0x0740('0x14')](_0x5607ef));}switch(_0x57ba02['zone']){case'US':_0xd74f7b=_0x0740('0x15');break;case'AU':_0xd74f7b=_0x0740('0x16');break;case'IN':_0xd74f7b=_0x0740('0x17');break;case'CN':_0xd74f7b=_0x0740('0x18');break;default:_0xd74f7b=_0x0740('0x19');break;}var _0x3b4537={'method':_0x0740('0x1a'),'uri':_0xd74f7b+'/oauth/v2/token','form':{'grant_type':_0x0740('0x1b'),'client_id':_0x57ba02['clientId'],'client_secret':_0x57ba02['clientSecret'],'redirect_uri':_0x57ba02['serverUrl'],'code':_0x57ba02[_0x0740('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3b4537)['then'](function(_0x140f6a){var _0x45605e=JSON[_0x0740('0x1c')](_0x140f6a);if(_0x45605e[_0x0740('0x1d')]){_0x57ba02[_0x0740('0x1e')]=_0x45605e[_0x0740('0x1d')];logger[_0x0740('0x1f')](util['format'](_0x0740('0x20'),_0x57ba02[_0x0740('0x21')],_0x57ba02['id']));}else{logger[_0x0740('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x57ba02['name'],_0x57ba02['id']),util[_0x0740('0x23')](_0x45605e,{'showHidden':![],'depth':null}));}return _0x595041(null,_0x56bdbd);})[_0x0740('0x24')](function(_0x414381){logger['error'](util[_0x0740('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x57ba02[_0x0740('0x21')],_0x57ba02['id']),util[_0x0740('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x595041(_0x414381);});}else{return _0x595041(null,_0x56bdbd);}},'beforeUpdate':function(_0x2c84be,_0x3a8235,_0x38316e){if(_0x2c84be['changed'](_0x0740('0xc'))||_0x2c84be['changed'](_0x0740('0xd'))||_0x2c84be[_0x0740('0xb')](_0x0740('0xe'))||_0x2c84be[_0x0740('0xb')](_0x0740('0xf'))||_0x2c84be[_0x0740('0xb')]('code')||_0x2c84be[_0x0740('0xb')](_0x0740('0x11'))){var _0x1541c8,_0x29303a;_0x1541c8=_0x2c84be[_0x0740('0xd')];var _0x2ba83e=_0x1541c8[_0x0740('0x12')](-0x1);if(_0x2ba83e==='/'||_0x2ba83e==='\x5c'||_0x2ba83e===':'){_0x1541c8=_0x1541c8[_0x0740('0x13')](0x0,_0x1541c8[_0x0740('0x14')](_0x2ba83e));}switch(_0x2c84be[_0x0740('0xc')]){case'US':_0x29303a=_0x0740('0x15');break;case'AU':_0x29303a=_0x0740('0x16');break;case'IN':_0x29303a='https://accounts.zoho.in';break;case'CN':_0x29303a=_0x0740('0x18');break;default:_0x29303a=_0x0740('0x19');break;}var _0x93e241={'method':_0x0740('0x1a'),'uri':_0x29303a+_0x0740('0x26'),'form':{'grant_type':_0x0740('0x1b'),'client_id':_0x2c84be[_0x0740('0xe')],'client_secret':_0x2c84be[_0x0740('0xf')],'redirect_uri':_0x2c84be['serverUrl'],'code':_0x2c84be[_0x0740('0x10')]},'headers':{'Content-Type':_0x0740('0x27')}};return rp(_0x93e241)['then'](function(_0x3ba13c){var _0x434a06=JSON[_0x0740('0x1c')](_0x3ba13c);if(_0x434a06['refresh_token']){_0x2c84be[_0x0740('0x1e')]=_0x434a06[_0x0740('0x1d')];logger[_0x0740('0x1f')](util[_0x0740('0x25')](_0x0740('0x20'),_0x2c84be['name'],_0x2c84be['id']));}else{logger[_0x0740('0x22')](util[_0x0740('0x25')](_0x0740('0x28'),_0x2c84be[_0x0740('0x21')],_0x2c84be['id']),util[_0x0740('0x23')](_0x434a06,{'showHidden':![],'depth':null}));}return _0x38316e(null,_0x3a8235);})['catch'](function(_0x417bd8){logger[_0x0740('0x22')](util[_0x0740('0x25')](_0x0740('0x28'),_0x2c84be[_0x0740('0x21')],_0x2c84be['id']),util[_0x0740('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x38316e(_0x417bd8);});}else{return _0x38316e(null,_0x3a8235);}}}});}; \ No newline at end of file +var _0x7b2c=['substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','clientId','clientSecret','host','https://accounts.zoho.com.cn','application/x-www-form-urlencoded','then','error','catch','lodash','util','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','slice'];(function(_0xcbbc7d,_0x49e121){var _0x2c7d27=function(_0x801ba7){while(--_0x801ba7){_0xcbbc7d['push'](_0xcbbc7d['shift']());}};_0x2c7d27(++_0x49e121);}(_0x7b2c,0xbf));var _0xc7b2=function(_0x3bd1e6,_0x5ad2e1){_0x3bd1e6=_0x3bd1e6-0x0;var _0x24379e=_0x7b2c[_0x3bd1e6];return _0x24379e;};'use strict';var _=require(_0xc7b2('0x0'));var util=require(_0xc7b2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc7b2('0x2'));var rp=require(_0xc7b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc7b2('0x4'));var attributes=require(_0xc7b2('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xc7b2('0x6')]=function(_0x3783e3,_0x3bebb0){return _0x3783e3[_0xc7b2('0x7')](_0xc7b2('0x8'),attributes,{'tableName':_0xc7b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b0a44,_0x37dc59,_0x419b6c){if(_0x1b0a44['changed'](_0xc7b2('0xa'))||_0x1b0a44[_0xc7b2('0xb')](_0xc7b2('0xc'))||_0x1b0a44[_0xc7b2('0xb')]('clientId')||_0x1b0a44['changed']('clientSecret')||_0x1b0a44[_0xc7b2('0xb')]('code')||_0x1b0a44[_0xc7b2('0xb')]('host')){var _0x4c8f1b,_0x12ca51;_0x4c8f1b=_0x1b0a44[_0xc7b2('0xc')];var _0x1d1f95=_0x4c8f1b[_0xc7b2('0xd')](-0x1);if(_0x1d1f95==='/'||_0x1d1f95==='\x5c'||_0x1d1f95===':'){_0x4c8f1b=_0x4c8f1b[_0xc7b2('0xe')](0x0,_0x4c8f1b[_0xc7b2('0xf')](_0x1d1f95));}switch(_0x1b0a44['zone']){case'US':_0x12ca51=_0xc7b2('0x10');break;case'AU':_0x12ca51=_0xc7b2('0x11');break;case'IN':_0x12ca51=_0xc7b2('0x12');break;case'CN':_0x12ca51='https://accounts.zoho.com.cn';break;default:_0x12ca51=_0xc7b2('0x13');break;}var _0x45a904={'method':_0xc7b2('0x14'),'uri':_0x12ca51+_0xc7b2('0x15'),'form':{'grant_type':_0xc7b2('0x16'),'client_id':_0x1b0a44['clientId'],'client_secret':_0x1b0a44['clientSecret'],'redirect_uri':_0x1b0a44[_0xc7b2('0xc')],'code':_0x1b0a44[_0xc7b2('0x17')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x45a904)['then'](function(_0x3d0cd1){var _0x5b312e=JSON[_0xc7b2('0x18')](_0x3d0cd1);if(_0x5b312e[_0xc7b2('0x19')]){_0x1b0a44[_0xc7b2('0x1a')]=_0x5b312e[_0xc7b2('0x19')];logger[_0xc7b2('0x1b')](util[_0xc7b2('0x1c')](_0xc7b2('0x1d'),_0x1b0a44[_0xc7b2('0x1e')],_0x1b0a44['id']));}else{logger['error'](util[_0xc7b2('0x1c')](_0xc7b2('0x1f'),_0x1b0a44[_0xc7b2('0x1e')],_0x1b0a44['id']),util['inspect'](_0x5b312e,{'showHidden':![],'depth':null}));}return _0x419b6c(null,_0x37dc59);})['catch'](function(_0x5bd45){logger['error'](util[_0xc7b2('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b0a44['name'],_0x1b0a44['id']),util[_0xc7b2('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x419b6c(_0x5bd45);});}else{return _0x419b6c(null,_0x37dc59);}},'beforeUpdate':function(_0x2a9fbf,_0x5aec53,_0x6fe89d){if(_0x2a9fbf[_0xc7b2('0xb')](_0xc7b2('0xa'))||_0x2a9fbf['changed'](_0xc7b2('0xc'))||_0x2a9fbf[_0xc7b2('0xb')](_0xc7b2('0x21'))||_0x2a9fbf['changed'](_0xc7b2('0x22'))||_0x2a9fbf['changed'](_0xc7b2('0x17'))||_0x2a9fbf['changed'](_0xc7b2('0x23'))){var _0x35fbe9,_0x3d0848;_0x35fbe9=_0x2a9fbf['serverUrl'];var _0xf3499c=_0x35fbe9['slice'](-0x1);if(_0xf3499c==='/'||_0xf3499c==='\x5c'||_0xf3499c===':'){_0x35fbe9=_0x35fbe9[_0xc7b2('0xe')](0x0,_0x35fbe9[_0xc7b2('0xf')](_0xf3499c));}switch(_0x2a9fbf[_0xc7b2('0xa')]){case'US':_0x3d0848=_0xc7b2('0x10');break;case'AU':_0x3d0848='https://accounts.zoho.com.au';break;case'IN':_0x3d0848='https://accounts.zoho.in';break;case'CN':_0x3d0848=_0xc7b2('0x24');break;default:_0x3d0848=_0xc7b2('0x13');break;}var _0x2ab394={'method':_0xc7b2('0x14'),'uri':_0x3d0848+_0xc7b2('0x15'),'form':{'grant_type':_0xc7b2('0x16'),'client_id':_0x2a9fbf[_0xc7b2('0x21')],'client_secret':_0x2a9fbf['clientSecret'],'redirect_uri':_0x2a9fbf[_0xc7b2('0xc')],'code':_0x2a9fbf[_0xc7b2('0x17')]},'headers':{'Content-Type':_0xc7b2('0x25')}};return rp(_0x2ab394)[_0xc7b2('0x26')](function(_0x46ea93){var _0x35f087=JSON[_0xc7b2('0x18')](_0x46ea93);if(_0x35f087[_0xc7b2('0x19')]){_0x2a9fbf[_0xc7b2('0x1a')]=_0x35f087['refresh_token'];logger['info'](util['format'](_0xc7b2('0x1d'),_0x2a9fbf[_0xc7b2('0x1e')],_0x2a9fbf['id']));}else{logger[_0xc7b2('0x27')](util['format'](_0xc7b2('0x1f'),_0x2a9fbf[_0xc7b2('0x1e')],_0x2a9fbf['id']),util[_0xc7b2('0x20')](_0x35f087,{'showHidden':![],'depth':null}));}return _0x6fe89d(null,_0x5aec53);})[_0xc7b2('0x28')](function(_0x354aee){logger[_0xc7b2('0x27')](util[_0xc7b2('0x1c')](_0xc7b2('0x1f'),_0x2a9fbf[_0xc7b2('0x1e')],_0x2a9fbf['id']),util[_0xc7b2('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x6fe89d(_0x354aee);});}else{return _0x6fe89d(null,_0x5aec53);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4358678..4c98dca 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 _0xb0ee=['attributes','find','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','map','model','include'];(function(_0x147925,_0x51e81b){var _0x596381=function(_0x5bbfd5){while(--_0x5bbfd5){_0x147925['push'](_0x147925['shift']());}};_0x596381(++_0x51e81b);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xb0ee[_0x1a72f3];return _0x57ef47;};'use strict';var _=require('lodash');var util=require(_0xeb0e('0x0'));var moment=require(_0xeb0e('0x1'));var BPromise=require(_0xeb0e('0x2'));var rs=require(_0xeb0e('0x3'));var fs=require('fs');var Redis=require(_0xeb0e('0x4'));var db=require(_0xeb0e('0x5'))['db'];var utils=require(_0xeb0e('0x6'));var logger=require(_0xeb0e('0x7'))(_0xeb0e('0x8'));var config=require(_0xeb0e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb0e('0xa')][_0xeb0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423095,_0x3e7872,_0x572ee1){return new BPromise(function(_0x3b3c6e,_0x1dcf56){return client[_0xeb0e('0xc')](_0x423095,_0x572ee1)[_0xeb0e('0xd')](function(_0x2b90ba){logger[_0xeb0e('0xe')](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));logger[_0xeb0e('0x11')](_0xeb0e('0x12'),_0x3e7872,_0xeb0e('0x10'),JSON[_0xeb0e('0x13')](_0x2b90ba));if(_0x2b90ba[_0xeb0e('0x14')]){if(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x15')]===0x1f4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0x2b90ba[_0xeb0e('0x14')]['message']);return _0x1dcf56(_0x2b90ba['error'][_0xeb0e('0x16')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3e7872,_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);return _0x3b3c6e(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);}else{logger['info'](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));_0x3b3c6e(_0x2b90ba['result'][_0xeb0e('0x16')]);}})[_0xeb0e('0x17')](function(_0xa9a9c4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0xa9a9c4);_0x1dcf56(_0xa9a9c4);});});}exports[_0xeb0e('0x18')]=function(_0x2c78aa){var _0x51f14d=this;return new Promise(function(_0x1396a4,_0x972b84){return db[_0xeb0e('0x19')][_0xeb0e('0x1a')]({'raw':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa[_0xeb0e('0x1b')][_0xeb0e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa['options'][_0xeb0e('0x1d')]||null:null,'attributes':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa['options']['attributes']||null:null,'limit':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa[_0xeb0e('0x1b')]['limit']||null:null,'include':_0x2c78aa[_0xeb0e('0x1b')]?_0x2c78aa[_0xeb0e('0x1b')]['include']?_[_0xeb0e('0x1e')](_0x2c78aa['options']['include'],function(_0x582a90){return{'model':db[_0x582a90[_0xeb0e('0x1f')]],'as':_0x582a90['as'],'attributes':_0x582a90['attributes'],'include':_0x582a90[_0xeb0e('0x20')]?_[_0xeb0e('0x1e')](_0x582a90[_0xeb0e('0x20')],function(_0x1849d5){return{'model':db[_0x1849d5[_0xeb0e('0x1f')]],'as':_0x1849d5['as'],'attributes':_0x1849d5[_0xeb0e('0x21')],'include':_0x1849d5[_0xeb0e('0x20')]?_['map'](_0x1849d5['include'],function(_0x27267d){return{'model':db[_0x27267d[_0xeb0e('0x1f')]],'as':_0x27267d['as'],'attributes':_0x27267d['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb0e('0xd')](function(_0x2d9135){logger[_0xeb0e('0xe')](_0xeb0e('0x18'),_0x2c78aa);logger[_0xeb0e('0x11')](_0xeb0e('0x18'),_0x2c78aa,JSON[_0xeb0e('0x13')](_0x2d9135));_0x1396a4(_0x2d9135);})[_0xeb0e('0x17')](function(_0x4d23a3){logger[_0xeb0e('0x14')](_0xeb0e('0x18'),_0x4d23a3[_0xeb0e('0x16')],_0x2c78aa);_0x972b84(_0x51f14d[_0xeb0e('0x14')](0x1f4,_0x4d23a3['message']));});});};exports['ShowZohoAccount']=function(_0x2c4b4e){var _0x5d14f4=this;return new Promise(function(_0x1ad8ed,_0x35862d){return db[_0xeb0e('0x19')][_0xeb0e('0x22')]({'raw':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e[_0xeb0e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e['options'][_0xeb0e('0x1d')]||null:null,'attributes':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e['options']['attributes']||null:null,'include':_0x2c4b4e[_0xeb0e('0x1b')]?_0x2c4b4e[_0xeb0e('0x1b')][_0xeb0e('0x20')]?_['map'](_0x2c4b4e[_0xeb0e('0x1b')][_0xeb0e('0x20')],function(_0x1c3625){return{'model':db[_0x1c3625[_0xeb0e('0x1f')]],'as':_0x1c3625['as'],'attributes':_0x1c3625['attributes'],'include':_0x1c3625[_0xeb0e('0x20')]?_[_0xeb0e('0x1e')](_0x1c3625[_0xeb0e('0x20')],function(_0x23e3f3){return{'model':db[_0x23e3f3[_0xeb0e('0x1f')]],'as':_0x23e3f3['as'],'attributes':_0x23e3f3[_0xeb0e('0x21')],'include':_0x23e3f3[_0xeb0e('0x20')]?_[_0xeb0e('0x1e')](_0x23e3f3['include'],function(_0x52b017){return{'model':db[_0x52b017[_0xeb0e('0x1f')]],'as':_0x52b017['as'],'attributes':_0x52b017['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb0e('0xd')](function(_0x266337){logger['info'](_0xeb0e('0x23'),_0x2c4b4e);logger[_0xeb0e('0x11')]('ShowZohoAccount',_0x2c4b4e,JSON['stringify'](_0x266337));_0x1ad8ed(_0x266337);})[_0xeb0e('0x17')](function(_0x3bb158){logger[_0xeb0e('0x14')](_0xeb0e('0x23'),_0x3bb158['message'],_0x2c4b4e);_0x35862d(_0x5d14f4[_0xeb0e('0x14')](0x1f4,_0x3bb158['message']));});});}; \ No newline at end of file +var _0x6faf=['model','ShowZohoAccount','ZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6faf,0xf9));var _0xf6fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var moment=require(_0xf6fa('0x1'));var BPromise=require(_0xf6fa('0x2'));var rs=require(_0xf6fa('0x3'));var fs=require('fs');var Redis=require(_0xf6fa('0x4'));var db=require(_0xf6fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6fa('0x6'))('rpc');var config=require(_0xf6fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6fa('0x8')][_0xf6fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f93f1,_0x1ac55e,_0x2de713){return new BPromise(function(_0x4e1b3c,_0x3f4d3f){return client[_0xf6fa('0xa')](_0x1f93f1,_0x2de713)[_0xf6fa('0xb')](function(_0x585633){logger['info'](_0xf6fa('0xc'),_0x1ac55e,'request\x20sent');logger[_0xf6fa('0xd')](_0xf6fa('0xe'),_0x1ac55e,'request\x20sent',JSON[_0xf6fa('0xf')](_0x585633));if(_0x585633['error']){if(_0x585633[_0xf6fa('0x10')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1ac55e,_0x585633[_0xf6fa('0x10')][_0xf6fa('0x11')]);return _0x3f4d3f(_0x585633[_0xf6fa('0x10')][_0xf6fa('0x11')]);}logger[_0xf6fa('0x10')](_0xf6fa('0xc'),_0x1ac55e,_0x585633[_0xf6fa('0x10')][_0xf6fa('0x11')]);return _0x4e1b3c(_0x585633[_0xf6fa('0x10')][_0xf6fa('0x11')]);}else{logger[_0xf6fa('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x1ac55e,_0xf6fa('0x13'));_0x4e1b3c(_0x585633[_0xf6fa('0x14')]['message']);}})[_0xf6fa('0x15')](function(_0x476eeb){logger[_0xf6fa('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x1ac55e,_0x476eeb);_0x3f4d3f(_0x476eeb);});});}exports[_0xf6fa('0x16')]=function(_0x98737b){var _0x8dd910=this;return new Promise(function(_0x18b839,_0x3cb498){return db['ZohoAccount'][_0xf6fa('0x17')]({'raw':_0x98737b['options']?_0x98737b[_0xf6fa('0x18')][_0xf6fa('0x19')]===undefined?!![]:![]:!![],'where':_0x98737b[_0xf6fa('0x18')]?_0x98737b['options'][_0xf6fa('0x1a')]||null:null,'attributes':_0x98737b[_0xf6fa('0x18')]?_0x98737b[_0xf6fa('0x18')][_0xf6fa('0x1b')]||null:null,'limit':_0x98737b[_0xf6fa('0x18')]?_0x98737b[_0xf6fa('0x18')][_0xf6fa('0x1c')]||null:null,'include':_0x98737b[_0xf6fa('0x18')]?_0x98737b['options']['include']?_[_0xf6fa('0x1d')](_0x98737b['options'][_0xf6fa('0x1e')],function(_0x4c7b29){return{'model':db[_0x4c7b29['model']],'as':_0x4c7b29['as'],'attributes':_0x4c7b29['attributes'],'include':_0x4c7b29['include']?_['map'](_0x4c7b29[_0xf6fa('0x1e')],function(_0x1eb180){return{'model':db[_0x1eb180[_0xf6fa('0x1f')]],'as':_0x1eb180['as'],'attributes':_0x1eb180[_0xf6fa('0x1b')],'include':_0x1eb180[_0xf6fa('0x1e')]?_[_0xf6fa('0x1d')](_0x1eb180[_0xf6fa('0x1e')],function(_0x488601){return{'model':db[_0x488601[_0xf6fa('0x1f')]],'as':_0x488601['as'],'attributes':_0x488601[_0xf6fa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf6fa('0xb')](function(_0x4f7e0a){logger[_0xf6fa('0x12')](_0xf6fa('0x16'),_0x98737b);logger[_0xf6fa('0xd')](_0xf6fa('0x16'),_0x98737b,JSON[_0xf6fa('0xf')](_0x4f7e0a));_0x18b839(_0x4f7e0a);})[_0xf6fa('0x15')](function(_0x1034b0){logger['error'](_0xf6fa('0x16'),_0x1034b0[_0xf6fa('0x11')],_0x98737b);_0x3cb498(_0x8dd910[_0xf6fa('0x10')](0x1f4,_0x1034b0['message']));});});};exports[_0xf6fa('0x20')]=function(_0x2bb9d5){var _0x759ee7=this;return new Promise(function(_0x49a566,_0x3a9ec2){return db[_0xf6fa('0x21')][_0xf6fa('0x22')]({'raw':_0x2bb9d5['options']?_0x2bb9d5['options'][_0xf6fa('0x19')]===undefined?!![]:![]:!![],'where':_0x2bb9d5[_0xf6fa('0x18')]?_0x2bb9d5[_0xf6fa('0x18')][_0xf6fa('0x1a')]||null:null,'attributes':_0x2bb9d5[_0xf6fa('0x18')]?_0x2bb9d5[_0xf6fa('0x18')][_0xf6fa('0x1b')]||null:null,'include':_0x2bb9d5[_0xf6fa('0x18')]?_0x2bb9d5[_0xf6fa('0x18')]['include']?_[_0xf6fa('0x1d')](_0x2bb9d5[_0xf6fa('0x18')][_0xf6fa('0x1e')],function(_0x5c81ac){return{'model':db[_0x5c81ac[_0xf6fa('0x1f')]],'as':_0x5c81ac['as'],'attributes':_0x5c81ac[_0xf6fa('0x1b')],'include':_0x5c81ac['include']?_[_0xf6fa('0x1d')](_0x5c81ac[_0xf6fa('0x1e')],function(_0x3437b3){return{'model':db[_0x3437b3[_0xf6fa('0x1f')]],'as':_0x3437b3['as'],'attributes':_0x3437b3[_0xf6fa('0x1b')],'include':_0x3437b3[_0xf6fa('0x1e')]?_[_0xf6fa('0x1d')](_0x3437b3['include'],function(_0x21e788){return{'model':db[_0x21e788[_0xf6fa('0x1f')]],'as':_0x21e788['as'],'attributes':_0x21e788[_0xf6fa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf6fa('0xb')](function(_0xebab8d){logger[_0xf6fa('0x12')](_0xf6fa('0x20'),_0x2bb9d5);logger[_0xf6fa('0xd')](_0xf6fa('0x20'),_0x2bb9d5,JSON[_0xf6fa('0xf')](_0xebab8d));_0x49a566(_0xebab8d);})[_0xf6fa('0x15')](function(_0x6eb965){logger[_0xf6fa('0x10')]('ShowZohoAccount',_0x6eb965['message'],_0x2bb9d5);_0x3a9ec2(_0x759ee7[_0xf6fa('0x10')](0x1f4,_0x6eb965['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0abaa03..06bca69 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 _0x5779=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x5779,0x84));var _0x9577=function(_0x300a7b,_0x1b5602){_0x300a7b=_0x300a7b-0x0;var _0x3dd394=_0x5779[_0x300a7b];return _0x3dd394;};'use strict';var multer=require(_0x9577('0x0'));var util=require(_0x9577('0x1'));var path=require('path');var timeout=require(_0x9577('0x2'));var express=require('express');var router=express[_0x9577('0x3')]();var fs_extra=require(_0x9577('0x4'));var auth=require(_0x9577('0x5'));var interaction=require(_0x9577('0x6'));var config=require(_0x9577('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x9577('0x8')]('/',auth[_0x9577('0x9')](),controller[_0x9577('0xa')]);router[_0x9577('0x8')](_0x9577('0xb'),auth[_0x9577('0x9')](),controller[_0x9577('0xc')]);router[_0x9577('0x8')](_0x9577('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x9577('0x8')](_0x9577('0xe'),auth[_0x9577('0x9')](),controller['getSubjects']);router[_0x9577('0x8')](_0x9577('0xf'),auth['isAuthenticated'](),controller[_0x9577('0x10')]);router[_0x9577('0x11')]('/',auth['isAuthenticated'](),controller[_0x9577('0x12')]);router['put'](_0x9577('0xb'),auth[_0x9577('0x9')](),controller['update']);router[_0x9577('0x13')](_0x9577('0xb'),auth[_0x9577('0x9')](),controller[_0x9577('0x14')]);module[_0x9577('0x15')]=router; \ No newline at end of file +var _0x9e58=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9e58,0x66));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x89e5('0x0'));var util=require(_0x89e5('0x1'));var path=require(_0x89e5('0x2'));var timeout=require(_0x89e5('0x3'));var express=require(_0x89e5('0x4'));var router=express['Router']();var fs_extra=require(_0x89e5('0x5'));var auth=require(_0x89e5('0x6'));var interaction=require(_0x89e5('0x7'));var config=require(_0x89e5('0x8'));var controller=require(_0x89e5('0x9'));router[_0x89e5('0xa')]('/',auth[_0x89e5('0xb')](),controller[_0x89e5('0xc')]);router[_0x89e5('0xa')](_0x89e5('0xd'),auth[_0x89e5('0xb')](),controller[_0x89e5('0xe')]);router[_0x89e5('0xa')](_0x89e5('0xf'),auth[_0x89e5('0xb')](),controller['getFields']);router[_0x89e5('0xa')]('/:id/subjects',auth[_0x89e5('0xb')](),controller[_0x89e5('0x10')]);router[_0x89e5('0xa')](_0x89e5('0x11'),auth[_0x89e5('0xb')](),controller[_0x89e5('0x12')]);router[_0x89e5('0x13')]('/',auth[_0x89e5('0xb')](),controller[_0x89e5('0x14')]);router['put'](_0x89e5('0xd'),auth['isAuthenticated'](),controller[_0x89e5('0x15')]);router[_0x89e5('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x89e5('0x17')]);module[_0x89e5('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 1e7b804..dbe087e 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 _0x96f6=['sequelize','exports','ENUM','contact','nothing','lead','contact_lead'];(function(_0x46ce9d,_0xa564b0){var _0x1639c4=function(_0x1f59a2){while(--_0x1f59a2){_0x46ce9d['push'](_0x46ce9d['shift']());}};_0x1639c4(++_0xa564b0);}(_0x96f6,0x181));var _0x696f=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x96f6[_0x1460f6];return _0x46ce94;};'use strict';var Sequelize=require(_0x696f('0x0'));module[_0x696f('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x696f('0x2')]('lead',_0x696f('0x3'),_0x696f('0x4')),'defaultValue':_0x696f('0x5')},'moduleSearch':{'type':Sequelize[_0x696f('0x2')](_0x696f('0x6'),'contact',_0x696f('0x5')),'defaultValue':_0x696f('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3663=['contact_lead','sequelize','exports','STRING','lead','contact','ENUM'];(function(_0x15f71b,_0x156c53){var _0x54f41f=function(_0xded8a){while(--_0xded8a){_0x15f71b['push'](_0x15f71b['shift']());}};_0x54f41f(++_0x156c53);}(_0x3663,0x1cf));var _0x3366=function(_0x1b892b,_0x4efe48){_0x1b892b=_0x1b892b-0x0;var _0xa99e57=_0x3663[_0x1b892b];return _0xa99e57;};'use strict';var Sequelize=require(_0x3366('0x0'));module[_0x3366('0x1')]={'name':{'type':Sequelize[_0x3366('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x3366('0x3'),_0x3366('0x4'),'nothing'),'defaultValue':_0x3366('0x3')},'moduleSearch':{'type':Sequelize[_0x3366('0x5')](_0x3366('0x6'),_0x3366('0x4'),_0x3366('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x3366('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 248c280..753533f 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 _0x66da=['destroy','error','send','ZohoConfiguration','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','catch','include','find','create','body','params','getFields','hasOwnProperty','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x1e1ff5,_0x4ff315){var _0x391865=function(_0x76c323){while(--_0x76c323){_0x1e1ff5['push'](_0x1e1ff5['shift']());}};_0x391865(++_0x4ff315);}(_0x66da,0xc9));var _0xa66d=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x66da[_0x8e9386];return _0x4abf26;};'use strict';var emlformat=require(_0xa66d('0x0'));var rimraf=require(_0xa66d('0x1'));var zipdir=require(_0xa66d('0x2'));var jsonpatch=require(_0xa66d('0x3'));var rp=require(_0xa66d('0x4'));var moment=require('moment');var BPromise=require(_0xa66d('0x5'));var Mustache=require(_0xa66d('0x6'));var util=require(_0xa66d('0x7'));var path=require('path');var sox=require(_0xa66d('0x8'));var csv=require(_0xa66d('0x9'));var ejs=require(_0xa66d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa66d('0xb'));var squel=require(_0xa66d('0xc'));var crypto=require(_0xa66d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa66d('0x9'));var querystring=require(_0xa66d('0xe'));var Papa=require(_0xa66d('0xf'));var Redis=require(_0xa66d('0x10'));var authService=require(_0xa66d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66d('0x12'));var logger=require(_0xa66d('0x13'))(_0xa66d('0x14'));var utils=require(_0xa66d('0x15'));var config=require(_0xa66d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66d('0x17'))['db'];function respondWithStatusCode(_0x375269,_0x10dd8e){_0x10dd8e=_0x10dd8e||0xcc;return function(_0x3fb23f){if(_0x3fb23f){return _0x375269[_0xa66d('0x18')](_0x10dd8e);}return _0x375269['status'](_0x10dd8e)[_0xa66d('0x19')]();};}function respondWithResult(_0x2170fc,_0x5f407a){_0x5f407a=_0x5f407a||0xc8;return function(_0x2a006b){if(_0x2a006b){return _0x2170fc[_0xa66d('0x1a')](_0x5f407a)['json'](_0x2a006b);}};}function respondWithFilteredResult(_0x5d8f66,_0x624042){return function(_0xa471e6){if(_0xa471e6){var _0x48a2ac=typeof _0x624042['offset']===_0xa66d('0x1b')&&typeof _0x624042['limit']===_0xa66d('0x1b');var _0x2f97b8=_0xa471e6['count'];var _0x50ab42=_0x48a2ac?0x0:_0x624042[_0xa66d('0x1c')];var _0x463811=_0x48a2ac?_0xa471e6[_0xa66d('0x1d')]:_0x624042[_0xa66d('0x1c')]+_0x624042[_0xa66d('0x1e')];var _0x2713e2;if(_0x463811>=_0x2f97b8){_0x463811=_0x2f97b8;_0x2713e2=0xc8;}else{_0x2713e2=0xce;}_0x5d8f66['status'](_0x2713e2);return _0x5d8f66[_0xa66d('0x1f')](_0xa66d('0x20'),_0x50ab42+'-'+_0x463811+'/'+_0x2f97b8)[_0xa66d('0x21')](_0xa471e6);}return null;};}function patchUpdates(_0x5561c3){return function(_0x1a3f70){try{jsonpatch[_0xa66d('0x22')](_0x1a3f70,_0x5561c3,!![]);}catch(_0x59c096){return BPromise[_0xa66d('0x23')](_0x59c096);}return _0x1a3f70[_0xa66d('0x24')]();};}function saveUpdates(_0x3936ac,_0x123122){return function(_0x5ae2c7){if(_0x5ae2c7){return _0x5ae2c7[_0xa66d('0x25')](_0x3936ac)[_0xa66d('0x26')](function(_0x4bf278){return _0x4bf278;});}return null;};}function removeEntity(_0x2d651c,_0x10b973){return function(_0x59cd0c){if(_0x59cd0c){return _0x59cd0c[_0xa66d('0x27')]()[_0xa66d('0x26')](function(){_0x2d651c['status'](0xcc)[_0xa66d('0x19')]();});}};}function handleEntityNotFound(_0x2e0849,_0x324f7c){return function(_0x3e425d){if(!_0x3e425d){_0x2e0849[_0xa66d('0x18')](0x194);}return _0x3e425d;};}function handleError(_0x2effe5,_0x24d55e){_0x24d55e=_0x24d55e||0x1f4;return function(_0x321ce1){logger[_0xa66d('0x28')](_0x321ce1['stack']);if(_0x321ce1['name']){delete _0x321ce1['name'];}_0x2effe5['status'](_0x24d55e)[_0xa66d('0x29')](_0x321ce1);};}exports['index']=function(_0x3f74c5,_0x5678fa){var _0x38e4ed={},_0x461172={},_0x35e4ec={'count':0x0,'rows':[]};var _0x48ace3=_['map'](db[_0xa66d('0x2a')][_0xa66d('0x2b')],function(_0x2c7d44){return{'name':_0x2c7d44[_0xa66d('0x2c')],'type':_0x2c7d44['type'][_0xa66d('0x2d')]};});_0x461172[_0xa66d('0x2e')]=_[_0xa66d('0x2f')](_0x48ace3,_0xa66d('0x30'));_0x461172[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x3f74c5['query']);_0x461172[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x461172[_0xa66d('0x2e')],_0x461172[_0xa66d('0x31')]);_0x38e4ed[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x461172[_0xa66d('0x2e')],qs[_0xa66d('0x36')](_0x3f74c5[_0xa66d('0x31')]['fields']));_0x38e4ed[_0xa66d('0x35')]=_0x38e4ed[_0xa66d('0x35')][_0xa66d('0x37')]?_0x38e4ed['attributes']:_0x461172[_0xa66d('0x2e')];if(!_0x3f74c5[_0xa66d('0x31')]['hasOwnProperty'](_0xa66d('0x38'))){_0x38e4ed[_0xa66d('0x1e')]=qs['limit'](_0x3f74c5['query']['limit']);_0x38e4ed[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x1c')]);}_0x38e4ed[_0xa66d('0x39')]=qs[_0xa66d('0x3a')](_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x3a')]);_0x38e4ed[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_[_0xa66d('0x3c')](_0x3f74c5[_0xa66d('0x31')],_0x461172[_0xa66d('0x33')]),_0x48ace3);if(_0x3f74c5[_0xa66d('0x31')]['filter']){_0x38e4ed[_0xa66d('0x3b')]=_['merge'](_0x38e4ed[_0xa66d('0x3b')],{'$or':_[_0xa66d('0x2f')](_0x48ace3,function(_0x404489){if(_0x404489[_0xa66d('0x3d')]!==_0xa66d('0x3e')){var _0x1a76a0={};_0x1a76a0[_0x404489[_0xa66d('0x30')]]={'$like':'%'+_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x3f')]+'%'};return _0x1a76a0;}})});}_0x38e4ed=_[_0xa66d('0x40')]({},_0x38e4ed,_0x3f74c5[_0xa66d('0x41')]);var _0x1f7e99={'where':_0x38e4ed['where']};return db[_0xa66d('0x2a')]['count'](_0x1f7e99)[_0xa66d('0x26')](function(_0x656d88){_0x35e4ec[_0xa66d('0x1d')]=_0x656d88;if(_0x3f74c5[_0xa66d('0x31')][_0xa66d('0x42')]){_0x38e4ed['include']=[{'all':!![]}];}return db[_0xa66d('0x2a')][_0xa66d('0x43')](_0x38e4ed);})[_0xa66d('0x26')](function(_0x43b4d9){_0x35e4ec['rows']=_0x43b4d9;return _0x35e4ec;})[_0xa66d('0x26')](respondWithFilteredResult(_0x5678fa,_0x38e4ed))[_0xa66d('0x44')](handleError(_0x5678fa,null));};exports['show']=function(_0x460810,_0x106793){var _0x46f546={'raw':![],'where':{'id':_0x460810['params']['id']}},_0x1268ee={};_0x1268ee[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db[_0xa66d('0x2a')]['rawAttributes']);_0x1268ee[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x460810[_0xa66d('0x31')]);_0x1268ee[_0xa66d('0x33')]=_['intersection'](_0x1268ee['model'],_0x1268ee['query']);_0x46f546['attributes']=_['intersection'](_0x1268ee['model'],qs[_0xa66d('0x36')](_0x460810[_0xa66d('0x31')]['fields']));_0x46f546['attributes']=_0x46f546[_0xa66d('0x35')][_0xa66d('0x37')]?_0x46f546[_0xa66d('0x35')]:_0x1268ee[_0xa66d('0x2e')];if(_0x460810[_0xa66d('0x31')]['includeAll']){_0x46f546[_0xa66d('0x45')]=[{'all':!![]}];}_0x46f546=_[_0xa66d('0x40')]({},_0x46f546,_0x460810[_0xa66d('0x41')]);return db['ZohoConfiguration'][_0xa66d('0x46')](_0x46f546)[_0xa66d('0x26')](handleEntityNotFound(_0x106793,null))['then'](respondWithResult(_0x106793,null))[_0xa66d('0x44')](handleError(_0x106793,null));};exports[_0xa66d('0x47')]=function(_0x2c40a5,_0x60c41f){return db['ZohoConfiguration'][_0xa66d('0x47')](_0x2c40a5[_0xa66d('0x48')],{})[_0xa66d('0x26')](respondWithResult(_0x60c41f,0xc9))['catch'](handleError(_0x60c41f,null));};exports[_0xa66d('0x25')]=function(_0x506e36,_0x327eb0){if(_0x506e36[_0xa66d('0x48')]['id']){delete _0x506e36[_0xa66d('0x48')]['id'];}return db[_0xa66d('0x2a')][_0xa66d('0x46')]({'where':{'id':_0x506e36[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x327eb0,null))[_0xa66d('0x26')](saveUpdates(_0x506e36[_0xa66d('0x48')],null))['then'](respondWithResult(_0x327eb0,null))[_0xa66d('0x44')](handleError(_0x327eb0,null));};exports[_0xa66d('0x27')]=function(_0x1e4399,_0x1f7b48){return db['ZohoConfiguration'][_0xa66d('0x46')]({'where':{'id':_0x1e4399[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x1f7b48,null))[_0xa66d('0x26')](removeEntity(_0x1f7b48,null))[_0xa66d('0x44')](handleError(_0x1f7b48,null));};exports[_0xa66d('0x4a')]=function(_0x42800f,_0x38eb8a,_0x1dcb39){var _0x5def6f={};var _0x2f64a1={};var _0x312984;var _0x244d0d;return db[_0xa66d('0x2a')]['findOne']({'where':{'id':_0x42800f[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x38eb8a,null))[_0xa66d('0x26')](function(_0x97a172){if(_0x97a172){_0x312984=_0x97a172;_0x2f64a1[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db['ZohoField']['rawAttributes']);_0x2f64a1[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x42800f[_0xa66d('0x31')]);_0x2f64a1[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x2f64a1[_0xa66d('0x2e')],_0x2f64a1[_0xa66d('0x31')]);_0x5def6f[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x2f64a1[_0xa66d('0x2e')],qs['fields'](_0x42800f['query'][_0xa66d('0x36')]));_0x5def6f[_0xa66d('0x35')]=_0x5def6f[_0xa66d('0x35')][_0xa66d('0x37')]?_0x5def6f[_0xa66d('0x35')]:_0x2f64a1['model'];_0x5def6f[_0xa66d('0x39')]=qs[_0xa66d('0x3a')](_0x42800f[_0xa66d('0x31')]['sort']);_0x5def6f[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_[_0xa66d('0x3c')](_0x42800f[_0xa66d('0x31')],_0x2f64a1['filters']));if(_0x42800f[_0xa66d('0x31')][_0xa66d('0x3f')]){_0x5def6f[_0xa66d('0x3b')]=_[_0xa66d('0x40')](_0x5def6f[_0xa66d('0x3b')],{'$or':_[_0xa66d('0x2f')](_0x5def6f['attributes'],function(_0x27614c){var _0xe94e5e={};_0xe94e5e[_0x27614c]={'$like':'%'+_0x42800f[_0xa66d('0x31')][_0xa66d('0x3f')]+'%'};return _0xe94e5e;})});}_0x5def6f=_[_0xa66d('0x40')]({},_0x5def6f,_0x42800f['options']);return _0x312984[_0xa66d('0x4a')](_0x5def6f);}})[_0xa66d('0x26')](function(_0x11be7b){if(_0x11be7b){_0x244d0d=_0x11be7b[_0xa66d('0x37')];if(!_0x42800f[_0xa66d('0x31')][_0xa66d('0x4b')](_0xa66d('0x38'))){_0x5def6f['limit']=qs[_0xa66d('0x1e')](_0x42800f['query']['limit']);_0x5def6f[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x42800f[_0xa66d('0x31')][_0xa66d('0x1c')]);}return _0x312984['getFields'](_0x5def6f);}})[_0xa66d('0x26')](function(_0x5bcbd0){if(_0x5bcbd0){return _0x5bcbd0?{'count':_0x244d0d,'rows':_0x5bcbd0}:null;}})[_0xa66d('0x26')](respondWithResult(_0x38eb8a,null))[_0xa66d('0x44')](handleError(_0x38eb8a,null));};exports['getSubjects']=function(_0x212fff,_0xf82e82,_0x4dfde5){var _0x586628={};var _0x2111b3={};var _0x337f50;var _0x4ecd0b;return db[_0xa66d('0x2a')][_0xa66d('0x4c')]({'where':{'id':_0x212fff[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0xf82e82,null))[_0xa66d('0x26')](function(_0x1ad85f){if(_0x1ad85f){_0x337f50=_0x1ad85f;_0x2111b3[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db[_0xa66d('0x4d')][_0xa66d('0x2b')]);_0x2111b3['query']=_['keys'](_0x212fff['query']);_0x2111b3[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x2111b3[_0xa66d('0x2e')],_0x2111b3[_0xa66d('0x31')]);_0x586628[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x2111b3[_0xa66d('0x2e')],qs[_0xa66d('0x36')](_0x212fff[_0xa66d('0x31')]['fields']));_0x586628[_0xa66d('0x35')]=_0x586628[_0xa66d('0x35')]['length']?_0x586628[_0xa66d('0x35')]:_0x2111b3['model'];_0x586628[_0xa66d('0x39')]=qs[_0xa66d('0x3a')](_0x212fff[_0xa66d('0x31')]['sort']);_0x586628[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_[_0xa66d('0x3c')](_0x212fff['query'],_0x2111b3[_0xa66d('0x33')]));if(_0x212fff[_0xa66d('0x31')][_0xa66d('0x3f')]){_0x586628[_0xa66d('0x3b')]=_[_0xa66d('0x40')](_0x586628['where'],{'$or':_['map'](_0x586628['attributes'],function(_0xc8c477){var _0x3d20a5={};_0x3d20a5[_0xc8c477]={'$like':'%'+_0x212fff['query'][_0xa66d('0x3f')]+'%'};return _0x3d20a5;})});}_0x586628=_[_0xa66d('0x40')]({},_0x586628,_0x212fff[_0xa66d('0x41')]);return _0x337f50[_0xa66d('0x4e')](_0x586628);}})[_0xa66d('0x26')](function(_0xafbb83){if(_0xafbb83){_0x4ecd0b=_0xafbb83[_0xa66d('0x37')];if(!_0x212fff[_0xa66d('0x31')][_0xa66d('0x4b')](_0xa66d('0x38'))){_0x586628[_0xa66d('0x1e')]=qs[_0xa66d('0x1e')](_0x212fff[_0xa66d('0x31')][_0xa66d('0x1e')]);_0x586628[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x212fff[_0xa66d('0x31')][_0xa66d('0x1c')]);}return _0x337f50[_0xa66d('0x4e')](_0x586628);}})['then'](function(_0x5cff9a){if(_0x5cff9a){return _0x5cff9a?{'count':_0x4ecd0b,'rows':_0x5cff9a}:null;}})['then'](respondWithResult(_0xf82e82,null))[_0xa66d('0x44')](handleError(_0xf82e82,null));};exports[_0xa66d('0x4f')]=function(_0x246718,_0x372726,_0x5f4fe5){var _0x430924={};var _0x23acbf={};var _0x2c8d5f;var _0x3f57d3;return db[_0xa66d('0x2a')]['findOne']({'where':{'id':_0x246718[_0xa66d('0x49')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x372726,null))[_0xa66d('0x26')](function(_0x6d1569){if(_0x6d1569){_0x2c8d5f=_0x6d1569;_0x23acbf[_0xa66d('0x2e')]=_[_0xa66d('0x32')](db['ZohoField'][_0xa66d('0x2b')]);_0x23acbf[_0xa66d('0x31')]=_[_0xa66d('0x32')](_0x246718[_0xa66d('0x31')]);_0x23acbf[_0xa66d('0x33')]=_[_0xa66d('0x34')](_0x23acbf['model'],_0x23acbf['query']);_0x430924[_0xa66d('0x35')]=_[_0xa66d('0x34')](_0x23acbf[_0xa66d('0x2e')],qs[_0xa66d('0x36')](_0x246718['query'][_0xa66d('0x36')]));_0x430924[_0xa66d('0x35')]=_0x430924[_0xa66d('0x35')][_0xa66d('0x37')]?_0x430924['attributes']:_0x23acbf[_0xa66d('0x2e')];_0x430924[_0xa66d('0x39')]=qs['sort'](_0x246718[_0xa66d('0x31')][_0xa66d('0x3a')]);_0x430924[_0xa66d('0x3b')]=qs[_0xa66d('0x33')](_['pick'](_0x246718['query'],_0x23acbf['filters']));if(_0x246718[_0xa66d('0x31')][_0xa66d('0x3f')]){_0x430924[_0xa66d('0x3b')]=_[_0xa66d('0x40')](_0x430924[_0xa66d('0x3b')],{'$or':_[_0xa66d('0x2f')](_0x430924[_0xa66d('0x35')],function(_0x40e838){var _0xbcbed6={};_0xbcbed6[_0x40e838]={'$like':'%'+_0x246718[_0xa66d('0x31')][_0xa66d('0x3f')]+'%'};return _0xbcbed6;})});}_0x430924=_[_0xa66d('0x40')]({},_0x430924,_0x246718['options']);return _0x2c8d5f[_0xa66d('0x4f')](_0x430924);}})[_0xa66d('0x26')](function(_0x1bd41a){if(_0x1bd41a){_0x3f57d3=_0x1bd41a[_0xa66d('0x37')];if(!_0x246718[_0xa66d('0x31')][_0xa66d('0x4b')](_0xa66d('0x38'))){_0x430924[_0xa66d('0x1e')]=qs['limit'](_0x246718[_0xa66d('0x31')]['limit']);_0x430924[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x246718['query'][_0xa66d('0x1c')]);}return _0x2c8d5f[_0xa66d('0x4f')](_0x430924);}})[_0xa66d('0x26')](function(_0x1f82ff){if(_0x1f82ff){return _0x1f82ff?{'count':_0x3f57d3,'rows':_0x1f82ff}:null;}})['then'](respondWithResult(_0x372726,null))['catch'](handleError(_0x372726,null));}; \ No newline at end of file +var _0x1044=['include','catch','show','params','includeAll','create','body','find','getFields','findOne','ZohoField','pick','getSubjects','nolimit','getDescriptions','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','error','stack','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','ZohoConfiguration'];(function(_0x347c82,_0x4293ef){var _0x5f198e=function(_0x33cc9b){while(--_0x33cc9b){_0x347c82['push'](_0x347c82['shift']());}};_0x5f198e(++_0x4293ef);}(_0x1044,0x147));var _0x4104=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x1044[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4104('0x0'));var jsonpatch=require(_0x4104('0x1'));var rp=require('request-promise');var moment=require(_0x4104('0x2'));var BPromise=require(_0x4104('0x3'));var Mustache=require(_0x4104('0x4'));var util=require(_0x4104('0x5'));var path=require(_0x4104('0x6'));var sox=require(_0x4104('0x7'));var csv=require('to-csv');var ejs=require(_0x4104('0x8'));var fs=require('fs');var fs_extra=require(_0x4104('0x9'));var _=require(_0x4104('0xa'));var squel=require(_0x4104('0xb'));var crypto=require(_0x4104('0xc'));var jsforce=require(_0x4104('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4104('0xe'));var querystring=require('querystring');var Papa=require(_0x4104('0xf'));var Redis=require('ioredis');var authService=require(_0x4104('0x10'));var qs=require(_0x4104('0x11'));var as=require(_0x4104('0x12'));var hardwareService=require(_0x4104('0x13'));var logger=require('../../config/logger')(_0x4104('0x14'));var utils=require(_0x4104('0x15'));var config=require(_0x4104('0x16'));var licenseUtil=require(_0x4104('0x17'));var db=require(_0x4104('0x18'))['db'];function respondWithStatusCode(_0x3f892e,_0x1941e1){_0x1941e1=_0x1941e1||0xcc;return function(_0x83f035){if(_0x83f035){return _0x3f892e['sendStatus'](_0x1941e1);}return _0x3f892e[_0x4104('0x19')](_0x1941e1)[_0x4104('0x1a')]();};}function respondWithResult(_0x3ed59e,_0x54384e){_0x54384e=_0x54384e||0xc8;return function(_0x5d9bba){if(_0x5d9bba){return _0x3ed59e[_0x4104('0x19')](_0x54384e)[_0x4104('0x1b')](_0x5d9bba);}};}function respondWithFilteredResult(_0x436fd0,_0x4b6102){return function(_0x261a72){if(_0x261a72){var _0x50a86d=typeof _0x4b6102[_0x4104('0x1c')]===_0x4104('0x1d')&&typeof _0x4b6102[_0x4104('0x1e')]==='undefined';var _0x56ab24=_0x261a72['count'];var _0x406e71=_0x50a86d?0x0:_0x4b6102[_0x4104('0x1c')];var _0x385db4=_0x50a86d?_0x261a72[_0x4104('0x1f')]:_0x4b6102[_0x4104('0x1c')]+_0x4b6102[_0x4104('0x1e')];var _0x1610b7;if(_0x385db4>=_0x56ab24){_0x385db4=_0x56ab24;_0x1610b7=0xc8;}else{_0x1610b7=0xce;}_0x436fd0['status'](_0x1610b7);return _0x436fd0[_0x4104('0x20')](_0x4104('0x21'),_0x406e71+'-'+_0x385db4+'/'+_0x56ab24)[_0x4104('0x1b')](_0x261a72);}return null;};}function patchUpdates(_0x204e06){return function(_0x49abc2){try{jsonpatch['apply'](_0x49abc2,_0x204e06,!![]);}catch(_0x10f0a3){return BPromise[_0x4104('0x22')](_0x10f0a3);}return _0x49abc2['save']();};}function saveUpdates(_0x5cc42d,_0x4f5285){return function(_0x2e518f){if(_0x2e518f){return _0x2e518f[_0x4104('0x23')](_0x5cc42d)[_0x4104('0x24')](function(_0x1bd06d){return _0x1bd06d;});}return null;};}function removeEntity(_0x5008a1,_0x12217a){return function(_0x51d72e){if(_0x51d72e){return _0x51d72e['destroy']()['then'](function(){_0x5008a1[_0x4104('0x19')](0xcc)[_0x4104('0x1a')]();});}};}function handleEntityNotFound(_0x1eaade,_0x86e4b2){return function(_0xcc8cd6){if(!_0xcc8cd6){_0x1eaade[_0x4104('0x25')](0x194);}return _0xcc8cd6;};}function handleError(_0x2382db,_0x4d2be4){_0x4d2be4=_0x4d2be4||0x1f4;return function(_0x22eb87){logger[_0x4104('0x26')](_0x22eb87[_0x4104('0x27')]);if(_0x22eb87['name']){delete _0x22eb87['name'];}_0x2382db[_0x4104('0x19')](_0x4d2be4)['send'](_0x22eb87);};}exports[_0x4104('0x28')]=function(_0x3562b0,_0x2e39ad){var _0x513209={},_0x2c25ff={},_0x333e03={'count':0x0,'rows':[]};var _0x1367f9=_[_0x4104('0x29')](db['ZohoConfiguration'][_0x4104('0x2a')],function(_0x281653){return{'name':_0x281653['fieldName'],'type':_0x281653[_0x4104('0x2b')][_0x4104('0x2c')]};});_0x2c25ff[_0x4104('0x2d')]=_[_0x4104('0x29')](_0x1367f9,_0x4104('0x2e'));_0x2c25ff[_0x4104('0x2f')]=_[_0x4104('0x30')](_0x3562b0['query']);_0x2c25ff[_0x4104('0x31')]=_[_0x4104('0x32')](_0x2c25ff['model'],_0x2c25ff[_0x4104('0x2f')]);_0x513209[_0x4104('0x33')]=_[_0x4104('0x32')](_0x2c25ff[_0x4104('0x2d')],qs[_0x4104('0x34')](_0x3562b0[_0x4104('0x2f')]['fields']));_0x513209[_0x4104('0x33')]=_0x513209[_0x4104('0x33')][_0x4104('0x35')]?_0x513209['attributes']:_0x2c25ff[_0x4104('0x2d')];if(!_0x3562b0['query'][_0x4104('0x36')]('nolimit')){_0x513209['limit']=qs['limit'](_0x3562b0['query'][_0x4104('0x1e')]);_0x513209[_0x4104('0x1c')]=qs[_0x4104('0x1c')](_0x3562b0[_0x4104('0x2f')][_0x4104('0x1c')]);}_0x513209[_0x4104('0x37')]=qs[_0x4104('0x38')](_0x3562b0[_0x4104('0x2f')][_0x4104('0x38')]);_0x513209[_0x4104('0x39')]=qs[_0x4104('0x31')](_['pick'](_0x3562b0[_0x4104('0x2f')],_0x2c25ff['filters']),_0x1367f9);if(_0x3562b0[_0x4104('0x2f')][_0x4104('0x3a')]){_0x513209[_0x4104('0x39')]=_[_0x4104('0x3b')](_0x513209[_0x4104('0x39')],{'$or':_[_0x4104('0x29')](_0x1367f9,function(_0x172fef){if(_0x172fef['type']!==_0x4104('0x3c')){var _0x514401={};_0x514401[_0x172fef[_0x4104('0x2e')]]={'$like':'%'+_0x3562b0['query'][_0x4104('0x3a')]+'%'};return _0x514401;}})});}_0x513209=_['merge']({},_0x513209,_0x3562b0[_0x4104('0x3d')]);var _0x2e307a={'where':_0x513209['where']};return db[_0x4104('0x3e')]['count'](_0x2e307a)[_0x4104('0x24')](function(_0x312ca8){_0x333e03[_0x4104('0x1f')]=_0x312ca8;if(_0x3562b0[_0x4104('0x2f')]['includeAll']){_0x513209[_0x4104('0x3f')]=[{'all':!![]}];}return db[_0x4104('0x3e')]['findAll'](_0x513209);})[_0x4104('0x24')](function(_0x11c768){_0x333e03['rows']=_0x11c768;return _0x333e03;})[_0x4104('0x24')](respondWithFilteredResult(_0x2e39ad,_0x513209))[_0x4104('0x40')](handleError(_0x2e39ad,null));};exports[_0x4104('0x41')]=function(_0x3be292,_0x572873){var _0x6b8769={'raw':![],'where':{'id':_0x3be292[_0x4104('0x42')]['id']}},_0x584528={};_0x584528[_0x4104('0x2d')]=_['keys'](db['ZohoConfiguration'][_0x4104('0x2a')]);_0x584528['query']=_['keys'](_0x3be292[_0x4104('0x2f')]);_0x584528[_0x4104('0x31')]=_[_0x4104('0x32')](_0x584528[_0x4104('0x2d')],_0x584528[_0x4104('0x2f')]);_0x6b8769[_0x4104('0x33')]=_[_0x4104('0x32')](_0x584528[_0x4104('0x2d')],qs[_0x4104('0x34')](_0x3be292[_0x4104('0x2f')]['fields']));_0x6b8769[_0x4104('0x33')]=_0x6b8769[_0x4104('0x33')]['length']?_0x6b8769[_0x4104('0x33')]:_0x584528[_0x4104('0x2d')];if(_0x3be292[_0x4104('0x2f')][_0x4104('0x43')]){_0x6b8769['include']=[{'all':!![]}];}_0x6b8769=_['merge']({},_0x6b8769,_0x3be292['options']);return db[_0x4104('0x3e')]['find'](_0x6b8769)[_0x4104('0x24')](handleEntityNotFound(_0x572873,null))[_0x4104('0x24')](respondWithResult(_0x572873,null))[_0x4104('0x40')](handleError(_0x572873,null));};exports['create']=function(_0x14cfb4,_0xbe6f8c){return db[_0x4104('0x3e')][_0x4104('0x44')](_0x14cfb4['body'],{})['then'](respondWithResult(_0xbe6f8c,0xc9))[_0x4104('0x40')](handleError(_0xbe6f8c,null));};exports[_0x4104('0x23')]=function(_0x9218dd,_0x94fed0){if(_0x9218dd[_0x4104('0x45')]['id']){delete _0x9218dd['body']['id'];}return db[_0x4104('0x3e')][_0x4104('0x46')]({'where':{'id':_0x9218dd[_0x4104('0x42')]['id']}})[_0x4104('0x24')](handleEntityNotFound(_0x94fed0,null))[_0x4104('0x24')](saveUpdates(_0x9218dd[_0x4104('0x45')],null))[_0x4104('0x24')](respondWithResult(_0x94fed0,null))[_0x4104('0x40')](handleError(_0x94fed0,null));};exports['destroy']=function(_0x13bcf8,_0x43399a){return db[_0x4104('0x3e')][_0x4104('0x46')]({'where':{'id':_0x13bcf8[_0x4104('0x42')]['id']}})[_0x4104('0x24')](handleEntityNotFound(_0x43399a,null))[_0x4104('0x24')](removeEntity(_0x43399a,null))[_0x4104('0x40')](handleError(_0x43399a,null));};exports[_0x4104('0x47')]=function(_0x1a85a4,_0x1d6a02,_0x504281){var _0x188551={};var _0x4d751c={};var _0x157d42;var _0x4f58a1;return db[_0x4104('0x3e')][_0x4104('0x48')]({'where':{'id':_0x1a85a4[_0x4104('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d6a02,null))[_0x4104('0x24')](function(_0xfd6a31){if(_0xfd6a31){_0x157d42=_0xfd6a31;_0x4d751c[_0x4104('0x2d')]=_[_0x4104('0x30')](db[_0x4104('0x49')]['rawAttributes']);_0x4d751c[_0x4104('0x2f')]=_[_0x4104('0x30')](_0x1a85a4[_0x4104('0x2f')]);_0x4d751c[_0x4104('0x31')]=_['intersection'](_0x4d751c[_0x4104('0x2d')],_0x4d751c['query']);_0x188551[_0x4104('0x33')]=_[_0x4104('0x32')](_0x4d751c['model'],qs[_0x4104('0x34')](_0x1a85a4[_0x4104('0x2f')][_0x4104('0x34')]));_0x188551[_0x4104('0x33')]=_0x188551['attributes'][_0x4104('0x35')]?_0x188551[_0x4104('0x33')]:_0x4d751c[_0x4104('0x2d')];_0x188551[_0x4104('0x37')]=qs[_0x4104('0x38')](_0x1a85a4[_0x4104('0x2f')][_0x4104('0x38')]);_0x188551[_0x4104('0x39')]=qs[_0x4104('0x31')](_['pick'](_0x1a85a4[_0x4104('0x2f')],_0x4d751c[_0x4104('0x31')]));if(_0x1a85a4[_0x4104('0x2f')][_0x4104('0x3a')]){_0x188551[_0x4104('0x39')]=_[_0x4104('0x3b')](_0x188551['where'],{'$or':_[_0x4104('0x29')](_0x188551[_0x4104('0x33')],function(_0x5611b3){var _0x2fbf1c={};_0x2fbf1c[_0x5611b3]={'$like':'%'+_0x1a85a4[_0x4104('0x2f')]['filter']+'%'};return _0x2fbf1c;})});}_0x188551=_[_0x4104('0x3b')]({},_0x188551,_0x1a85a4[_0x4104('0x3d')]);return _0x157d42['getFields'](_0x188551);}})[_0x4104('0x24')](function(_0x2ff8d5){if(_0x2ff8d5){_0x4f58a1=_0x2ff8d5[_0x4104('0x35')];if(!_0x1a85a4['query']['hasOwnProperty']('nolimit')){_0x188551[_0x4104('0x1e')]=qs[_0x4104('0x1e')](_0x1a85a4['query']['limit']);_0x188551[_0x4104('0x1c')]=qs['offset'](_0x1a85a4[_0x4104('0x2f')]['offset']);}return _0x157d42['getFields'](_0x188551);}})[_0x4104('0x24')](function(_0x440b49){if(_0x440b49){return _0x440b49?{'count':_0x4f58a1,'rows':_0x440b49}:null;}})['then'](respondWithResult(_0x1d6a02,null))[_0x4104('0x40')](handleError(_0x1d6a02,null));};exports['getSubjects']=function(_0x23151b,_0x20e70e,_0x40c47e){var _0x3405dd={};var _0x56a876={};var _0x40b019;var _0x5229fc;return db['ZohoConfiguration'][_0x4104('0x48')]({'where':{'id':_0x23151b['params']['id']}})[_0x4104('0x24')](handleEntityNotFound(_0x20e70e,null))['then'](function(_0x1f2099){if(_0x1f2099){_0x40b019=_0x1f2099;_0x56a876['model']=_['keys'](db['ZohoField'][_0x4104('0x2a')]);_0x56a876[_0x4104('0x2f')]=_['keys'](_0x23151b[_0x4104('0x2f')]);_0x56a876[_0x4104('0x31')]=_[_0x4104('0x32')](_0x56a876['model'],_0x56a876[_0x4104('0x2f')]);_0x3405dd[_0x4104('0x33')]=_[_0x4104('0x32')](_0x56a876[_0x4104('0x2d')],qs['fields'](_0x23151b['query'][_0x4104('0x34')]));_0x3405dd['attributes']=_0x3405dd[_0x4104('0x33')]['length']?_0x3405dd[_0x4104('0x33')]:_0x56a876[_0x4104('0x2d')];_0x3405dd[_0x4104('0x37')]=qs['sort'](_0x23151b[_0x4104('0x2f')]['sort']);_0x3405dd['where']=qs[_0x4104('0x31')](_[_0x4104('0x4a')](_0x23151b[_0x4104('0x2f')],_0x56a876[_0x4104('0x31')]));if(_0x23151b[_0x4104('0x2f')][_0x4104('0x3a')]){_0x3405dd['where']=_[_0x4104('0x3b')](_0x3405dd[_0x4104('0x39')],{'$or':_[_0x4104('0x29')](_0x3405dd[_0x4104('0x33')],function(_0x520446){var _0x2a83cc={};_0x2a83cc[_0x520446]={'$like':'%'+_0x23151b['query'][_0x4104('0x3a')]+'%'};return _0x2a83cc;})});}_0x3405dd=_[_0x4104('0x3b')]({},_0x3405dd,_0x23151b['options']);return _0x40b019[_0x4104('0x4b')](_0x3405dd);}})[_0x4104('0x24')](function(_0x1c8b0a){if(_0x1c8b0a){_0x5229fc=_0x1c8b0a[_0x4104('0x35')];if(!_0x23151b[_0x4104('0x2f')][_0x4104('0x36')](_0x4104('0x4c'))){_0x3405dd[_0x4104('0x1e')]=qs[_0x4104('0x1e')](_0x23151b[_0x4104('0x2f')][_0x4104('0x1e')]);_0x3405dd['offset']=qs[_0x4104('0x1c')](_0x23151b[_0x4104('0x2f')][_0x4104('0x1c')]);}return _0x40b019['getSubjects'](_0x3405dd);}})['then'](function(_0x286723){if(_0x286723){return _0x286723?{'count':_0x5229fc,'rows':_0x286723}:null;}})['then'](respondWithResult(_0x20e70e,null))[_0x4104('0x40')](handleError(_0x20e70e,null));};exports[_0x4104('0x4d')]=function(_0x363ff3,_0x263295,_0x943e1d){var _0x4330f3={};var _0x32daff={};var _0x468d14;var _0x313e29;return db[_0x4104('0x3e')][_0x4104('0x48')]({'where':{'id':_0x363ff3[_0x4104('0x42')]['id']}})[_0x4104('0x24')](handleEntityNotFound(_0x263295,null))['then'](function(_0x3e244f){if(_0x3e244f){_0x468d14=_0x3e244f;_0x32daff['model']=_['keys'](db[_0x4104('0x49')][_0x4104('0x2a')]);_0x32daff[_0x4104('0x2f')]=_[_0x4104('0x30')](_0x363ff3[_0x4104('0x2f')]);_0x32daff[_0x4104('0x31')]=_[_0x4104('0x32')](_0x32daff[_0x4104('0x2d')],_0x32daff['query']);_0x4330f3[_0x4104('0x33')]=_['intersection'](_0x32daff[_0x4104('0x2d')],qs[_0x4104('0x34')](_0x363ff3['query'][_0x4104('0x34')]));_0x4330f3[_0x4104('0x33')]=_0x4330f3[_0x4104('0x33')][_0x4104('0x35')]?_0x4330f3[_0x4104('0x33')]:_0x32daff['model'];_0x4330f3[_0x4104('0x37')]=qs[_0x4104('0x38')](_0x363ff3[_0x4104('0x2f')]['sort']);_0x4330f3['where']=qs['filters'](_['pick'](_0x363ff3['query'],_0x32daff[_0x4104('0x31')]));if(_0x363ff3[_0x4104('0x2f')][_0x4104('0x3a')]){_0x4330f3[_0x4104('0x39')]=_['merge'](_0x4330f3['where'],{'$or':_[_0x4104('0x29')](_0x4330f3['attributes'],function(_0x25138a){var _0x4ae3b5={};_0x4ae3b5[_0x25138a]={'$like':'%'+_0x363ff3[_0x4104('0x2f')][_0x4104('0x3a')]+'%'};return _0x4ae3b5;})});}_0x4330f3=_[_0x4104('0x3b')]({},_0x4330f3,_0x363ff3['options']);return _0x468d14[_0x4104('0x4d')](_0x4330f3);}})[_0x4104('0x24')](function(_0xfb8d21){if(_0xfb8d21){_0x313e29=_0xfb8d21[_0x4104('0x35')];if(!_0x363ff3[_0x4104('0x2f')][_0x4104('0x36')](_0x4104('0x4c'))){_0x4330f3[_0x4104('0x1e')]=qs['limit'](_0x363ff3['query'][_0x4104('0x1e')]);_0x4330f3['offset']=qs[_0x4104('0x1c')](_0x363ff3[_0x4104('0x2f')][_0x4104('0x1c')]);}return _0x468d14[_0x4104('0x4d')](_0x4330f3);}})['then'](function(_0x2c700b){if(_0x2c700b){return _0x2c700b?{'count':_0x313e29,'rows':_0x2c700b}:null;}})[_0x4104('0x24')](respondWithResult(_0x263295,null))[_0x4104('0x40')](handleError(_0x263295,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 05fa923..9d4933a 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 _0x17ec=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoConfiguration','lodash'];(function(_0x305016,_0x4937f3){var _0x46a0a3=function(_0x545942){while(--_0x545942){_0x305016['push'](_0x305016['shift']());}};_0x46a0a3(++_0x4937f3);}(_0x17ec,0x1a3));var _0xc17e=function(_0x430d92,_0x468681){_0x430d92=_0x430d92-0x0;var _0x4df196=_0x17ec[_0x430d92];return _0x4df196;};'use strict';var _=require(_0xc17e('0x0'));var util=require(_0xc17e('0x1'));var logger=require(_0xc17e('0x2'))(_0xc17e('0x3'));var moment=require(_0xc17e('0x4'));var BPromise=require(_0xc17e('0x5'));var rp=require(_0xc17e('0x6'));var fs=require('fs');var path=require(_0xc17e('0x7'));var rimraf=require('rimraf');var config=require(_0xc17e('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc17e('0x9')]=function(_0xcc1d19,_0x368436){return _0xcc1d19[_0xc17e('0xa')](_0xc17e('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabc3=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2632e2,_0x4e3a6a){var _0x4b6ddf=function(_0x309c6b){while(--_0x309c6b){_0x2632e2['push'](_0x2632e2['shift']());}};_0x4b6ddf(++_0x4e3a6a);}(_0xabc3,0x149));var _0x3abc=function(_0x41c32f,_0x47e8db){_0x41c32f=_0x41c32f-0x0;var _0x273c8b=_0xabc3[_0x41c32f];return _0x273c8b;};'use strict';var _=require(_0x3abc('0x0'));var util=require('util');var logger=require(_0x3abc('0x1'))(_0x3abc('0x2'));var moment=require('moment');var BPromise=require(_0x3abc('0x3'));var rp=require(_0x3abc('0x4'));var fs=require('fs');var path=require(_0x3abc('0x5'));var rimraf=require(_0x3abc('0x6'));var config=require(_0x3abc('0x7'));var attributes=require(_0x3abc('0x8'));module[_0x3abc('0x9')]=function(_0x4234f8,_0x8c3377){return _0x4234f8[_0x3abc('0xa')](_0x3abc('0xb'),attributes,{'tableName':'int_zoho_configurations','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 9bc9b1d..823eec3 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 _0xf549=['ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x29b948,_0xd1e59b){var _0x32fb00=function(_0x5dcbd6){while(--_0x5dcbd6){_0x29b948['push'](_0x29b948['shift']());}};_0x32fb00(++_0xd1e59b);}(_0xf549,0x178));var _0x9f54=function(_0xada38c,_0x550eb8){_0xada38c=_0xada38c-0x0;var _0x26545b=_0xf549[_0xada38c];return _0x26545b;};'use strict';var _=require(_0x9f54('0x0'));var util=require(_0x9f54('0x1'));var moment=require(_0x9f54('0x2'));var BPromise=require(_0x9f54('0x3'));var rs=require(_0x9f54('0x4'));var fs=require('fs');var Redis=require(_0x9f54('0x5'));var db=require(_0x9f54('0x6'))['db'];var utils=require(_0x9f54('0x7'));var logger=require(_0x9f54('0x8'))(_0x9f54('0x9'));var config=require(_0x9f54('0xa'));var jayson=require(_0x9f54('0xb'));var client=jayson[_0x9f54('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2441ff,_0x539676,_0x21d953){return new BPromise(function(_0x1d8de5,_0x3fc5ad){return client[_0x9f54('0xd')](_0x2441ff,_0x21d953)['then'](function(_0x12f907){logger[_0x9f54('0xe')](_0x9f54('0xf'),_0x539676,'request\x20sent');logger[_0x9f54('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x539676,_0x9f54('0x11'),JSON[_0x9f54('0x12')](_0x12f907));if(_0x12f907[_0x9f54('0x13')]){if(_0x12f907['error'][_0x9f54('0x14')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x539676,_0x12f907['error'][_0x9f54('0x15')]);return _0x3fc5ad(_0x12f907['error']['message']);}logger[_0x9f54('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x539676,_0x12f907[_0x9f54('0x13')][_0x9f54('0x15')]);return _0x1d8de5(_0x12f907[_0x9f54('0x13')][_0x9f54('0x15')]);}else{logger[_0x9f54('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x539676,_0x9f54('0x11'));_0x1d8de5(_0x12f907[_0x9f54('0x16')][_0x9f54('0x15')]);}})['catch'](function(_0x22047c){logger[_0x9f54('0x13')](_0x9f54('0xf'),_0x539676,_0x22047c);_0x3fc5ad(_0x22047c);});});} \ No newline at end of file +var _0x19d7=['jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1b4194,_0x4691bc){var _0x26b27e=function(_0x4af8b1){while(--_0x4af8b1){_0x1b4194['push'](_0x1b4194['shift']());}};_0x26b27e(++_0x4691bc);}(_0x19d7,0x81));var _0x719d=function(_0x2a32b4,_0x312f83){_0x2a32b4=_0x2a32b4-0x0;var _0x16e66f=_0x19d7[_0x2a32b4];return _0x16e66f;};'use strict';var _=require(_0x719d('0x0'));var util=require('util');var moment=require(_0x719d('0x1'));var BPromise=require(_0x719d('0x2'));var rs=require(_0x719d('0x3'));var fs=require('fs');var Redis=require(_0x719d('0x4'));var db=require(_0x719d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x719d('0x6'))(_0x719d('0x7'));var config=require(_0x719d('0x8'));var jayson=require(_0x719d('0x9'));var client=jayson[_0x719d('0xa')][_0x719d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x653b64,_0x5b8e5e,_0x4c4fe3){return new BPromise(function(_0x52c06d,_0x345660){return client['request'](_0x653b64,_0x4c4fe3)[_0x719d('0xc')](function(_0x484a79){logger[_0x719d('0xd')](_0x719d('0xe'),_0x5b8e5e,'request\x20sent');logger[_0x719d('0xf')](_0x719d('0x10'),_0x5b8e5e,_0x719d('0x11'),JSON[_0x719d('0x12')](_0x484a79));if(_0x484a79[_0x719d('0x13')]){if(_0x484a79[_0x719d('0x13')]['code']===0x1f4){logger[_0x719d('0x13')](_0x719d('0xe'),_0x5b8e5e,_0x484a79[_0x719d('0x13')][_0x719d('0x14')]);return _0x345660(_0x484a79[_0x719d('0x13')][_0x719d('0x14')]);}logger[_0x719d('0x13')](_0x719d('0xe'),_0x5b8e5e,_0x484a79[_0x719d('0x13')][_0x719d('0x14')]);return _0x52c06d(_0x484a79['error'][_0x719d('0x14')]);}else{logger['info'](_0x719d('0xe'),_0x5b8e5e,_0x719d('0x11'));_0x52c06d(_0x484a79[_0x719d('0x15')]['message']);}})[_0x719d('0x16')](function(_0x1e602b){logger[_0x719d('0x13')](_0x719d('0xe'),_0x5b8e5e,_0x1e602b);_0x345660(_0x1e602b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e71e8de..115d10f 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 _0xbca2=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get'];(function(_0x20012f,_0x53c28e){var _0x74e7ce=function(_0x39297f){while(--_0x39297f){_0x20012f['push'](_0x20012f['shift']());}};_0x74e7ce(++_0x53c28e);}(_0xbca2,0x9c));var _0x2bca=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xbca2[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0x2bca('0x0'));var util=require(_0x2bca('0x1'));var path=require(_0x2bca('0x2'));var timeout=require('connect-timeout');var express=require(_0x2bca('0x3'));var router=express[_0x2bca('0x4')]();var fs_extra=require(_0x2bca('0x5'));var auth=require(_0x2bca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2bca('0x7'));var controller=require(_0x2bca('0x8'));router['get']('/',auth[_0x2bca('0x9')](),controller[_0x2bca('0xa')]);router[_0x2bca('0xb')](_0x2bca('0xc'),auth['isAuthenticated'](),controller[_0x2bca('0xd')]);router[_0x2bca('0xe')]('/',auth[_0x2bca('0x9')](),controller[_0x2bca('0xf')]);router[_0x2bca('0x10')](_0x2bca('0xc'),auth[_0x2bca('0x9')](),controller[_0x2bca('0x11')]);router[_0x2bca('0x12')](_0x2bca('0xc'),auth[_0x2bca('0x9')](),controller[_0x2bca('0x13')]);module[_0x2bca('0x14')]=router; \ No newline at end of file +var _0xdb46=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdb46,0x1c5));var _0x6db4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdb46[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6db4('0x0'));var util=require('util');var path=require(_0x6db4('0x1'));var timeout=require(_0x6db4('0x2'));var express=require(_0x6db4('0x3'));var router=express[_0x6db4('0x4')]();var fs_extra=require(_0x6db4('0x5'));var auth=require(_0x6db4('0x6'));var interaction=require(_0x6db4('0x7'));var config=require(_0x6db4('0x8'));var controller=require(_0x6db4('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6db4('0xa')](_0x6db4('0xb'),auth[_0x6db4('0xc')](),controller[_0x6db4('0xd')]);router[_0x6db4('0xe')]('/',auth[_0x6db4('0xc')](),controller[_0x6db4('0xf')]);router[_0x6db4('0x10')](_0x6db4('0xb'),auth[_0x6db4('0xc')](),controller[_0x6db4('0x11')]);router[_0x6db4('0x12')](_0x6db4('0xb'),auth[_0x6db4('0xc')](),controller['destroy']);module[_0x6db4('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a5ec402..1d76dca 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 _0x50eb=['STRING','ENUM','BOOLEAN','string','customVariable','keyValue'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x50eb,0x6f));var _0xb50e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x50eb[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xb50e('0x0'),'variable',_0xb50e('0x1'),_0xb50e('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb50e('0x3')]},'keyType':{'type':Sequelize[_0xb50e('0x4')]('string','variable',_0xb50e('0x1'))},'keyContent':{'type':Sequelize[_0xb50e('0x3')]},'idField':{'type':Sequelize[_0xb50e('0x3')]},'nameField':{'type':Sequelize[_0xb50e('0x3')]},'customField':{'type':Sequelize[_0xb50e('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb50e('0x3')]}}; \ No newline at end of file +var _0x355b=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x456acd,_0x364a1a){var _0x549643=function(_0x4999d7){while(--_0x4999d7){_0x456acd['push'](_0x456acd['shift']());}};_0x549643(++_0x364a1a);}(_0x355b,0x199));var _0xb355=function(_0x39f111,_0x3e024d){_0x39f111=_0x39f111-0x0;var _0x4c81a3=_0x355b[_0x39f111];return _0x4c81a3;};'use strict';var Sequelize=require(_0xb355('0x0'));module[_0xb355('0x1')]={'type':{'type':Sequelize[_0xb355('0x2')](_0xb355('0x3'),'variable',_0xb355('0x4'),_0xb355('0x5'),_0xb355('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb355('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb355('0x3'),_0xb355('0x8'),_0xb355('0x4'))},'keyContent':{'type':Sequelize[_0xb355('0x7')]},'idField':{'type':Sequelize[_0xb355('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb355('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb355('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 93e55ca..8a9db97 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 _0xf401=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','includeAll','find','body','update','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query'];(function(_0x523315,_0x11b8f5){var _0x2715ac=function(_0x38dc0e){while(--_0x38dc0e){_0x523315['push'](_0x523315['shift']());}};_0x2715ac(++_0x11b8f5);}(_0xf401,0x1b7));var _0x1f40=function(_0x5bb2d2,_0x299b87){_0x5bb2d2=_0x5bb2d2-0x0;var _0x7d4026=_0xf401[_0x5bb2d2];return _0x7d4026;};'use strict';var emlformat=require(_0x1f40('0x0'));var rimraf=require(_0x1f40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f40('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f40('0x3'));var Mustache=require(_0x1f40('0x4'));var util=require(_0x1f40('0x5'));var path=require(_0x1f40('0x6'));var sox=require(_0x1f40('0x7'));var csv=require(_0x1f40('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f40('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f40('0xa'));var toCsv=require(_0x1f40('0x8'));var querystring=require(_0x1f40('0xb'));var Papa=require(_0x1f40('0xc'));var Redis=require(_0x1f40('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1f40('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f40('0xf'));var logger=require(_0x1f40('0x10'))(_0x1f40('0x11'));var utils=require(_0x1f40('0x12'));var config=require(_0x1f40('0x13'));var licenseUtil=require(_0x1f40('0x14'));var db=require(_0x1f40('0x15'))['db'];function respondWithStatusCode(_0x15164b,_0x490bdc){_0x490bdc=_0x490bdc||0xcc;return function(_0x540f78){if(_0x540f78){return _0x15164b[_0x1f40('0x16')](_0x490bdc);}return _0x15164b[_0x1f40('0x17')](_0x490bdc)[_0x1f40('0x18')]();};}function respondWithResult(_0x30887e,_0x2e853c){_0x2e853c=_0x2e853c||0xc8;return function(_0x5e0d44){if(_0x5e0d44){return _0x30887e[_0x1f40('0x17')](_0x2e853c)[_0x1f40('0x19')](_0x5e0d44);}};}function respondWithFilteredResult(_0x1ecc06,_0x36bda5){return function(_0x27b2d0){if(_0x27b2d0){var _0x35934f=typeof _0x36bda5[_0x1f40('0x1a')]==='undefined'&&typeof _0x36bda5[_0x1f40('0x1b')]===_0x1f40('0x1c');var _0x9e2b33=_0x27b2d0[_0x1f40('0x1d')];var _0x104e6d=_0x35934f?0x0:_0x36bda5['offset'];var _0x51f3d5=_0x35934f?_0x27b2d0[_0x1f40('0x1d')]:_0x36bda5[_0x1f40('0x1a')]+_0x36bda5[_0x1f40('0x1b')];var _0x59f474;if(_0x51f3d5>=_0x9e2b33){_0x51f3d5=_0x9e2b33;_0x59f474=0xc8;}else{_0x59f474=0xce;}_0x1ecc06[_0x1f40('0x17')](_0x59f474);return _0x1ecc06[_0x1f40('0x1e')](_0x1f40('0x1f'),_0x104e6d+'-'+_0x51f3d5+'/'+_0x9e2b33)[_0x1f40('0x19')](_0x27b2d0);}return null;};}function patchUpdates(_0x2ffd2b){return function(_0x14598d){try{jsonpatch['apply'](_0x14598d,_0x2ffd2b,!![]);}catch(_0x41acd0){return BPromise['reject'](_0x41acd0);}return _0x14598d['save']();};}function saveUpdates(_0xc41e9e,_0x144989){return function(_0x2c15d8){if(_0x2c15d8){return _0x2c15d8['update'](_0xc41e9e)[_0x1f40('0x20')](function(_0x222a3a){return _0x222a3a;});}return null;};}function removeEntity(_0x183d81,_0x4bad59){return function(_0x33f2d6){if(_0x33f2d6){return _0x33f2d6[_0x1f40('0x21')]()[_0x1f40('0x20')](function(){_0x183d81[_0x1f40('0x17')](0xcc)[_0x1f40('0x18')]();});}};}function handleEntityNotFound(_0x1507e2,_0x5be590){return function(_0x1b612b){if(!_0x1b612b){_0x1507e2[_0x1f40('0x16')](0x194);}return _0x1b612b;};}function handleError(_0x12ffb2,_0x2e88e7){_0x2e88e7=_0x2e88e7||0x1f4;return function(_0x41665a){logger['error'](_0x41665a['stack']);if(_0x41665a[_0x1f40('0x22')]){delete _0x41665a[_0x1f40('0x22')];}_0x12ffb2[_0x1f40('0x17')](_0x2e88e7)['send'](_0x41665a);};}exports[_0x1f40('0x23')]=function(_0x48a093,_0x323e08){var _0x1a3e9a={},_0x9d070={},_0x13a216={'count':0x0,'rows':[]};var _0x1e25bb=_[_0x1f40('0x24')](db[_0x1f40('0x25')][_0x1f40('0x26')],function(_0xca2d39){return{'name':_0xca2d39[_0x1f40('0x27')],'type':_0xca2d39[_0x1f40('0x28')][_0x1f40('0x29')]};});_0x9d070[_0x1f40('0x2a')]=_[_0x1f40('0x24')](_0x1e25bb,_0x1f40('0x22'));_0x9d070[_0x1f40('0x2b')]=_[_0x1f40('0x2c')](_0x48a093[_0x1f40('0x2b')]);_0x9d070[_0x1f40('0x2d')]=_[_0x1f40('0x2e')](_0x9d070[_0x1f40('0x2a')],_0x9d070[_0x1f40('0x2b')]);_0x1a3e9a['attributes']=_[_0x1f40('0x2e')](_0x9d070['model'],qs['fields'](_0x48a093[_0x1f40('0x2b')][_0x1f40('0x2f')]));_0x1a3e9a[_0x1f40('0x30')]=_0x1a3e9a[_0x1f40('0x30')]['length']?_0x1a3e9a[_0x1f40('0x30')]:_0x9d070['model'];if(!_0x48a093[_0x1f40('0x2b')][_0x1f40('0x31')](_0x1f40('0x32'))){_0x1a3e9a['limit']=qs[_0x1f40('0x1b')](_0x48a093[_0x1f40('0x2b')][_0x1f40('0x1b')]);_0x1a3e9a[_0x1f40('0x1a')]=qs[_0x1f40('0x1a')](_0x48a093[_0x1f40('0x2b')]['offset']);}_0x1a3e9a[_0x1f40('0x33')]=qs[_0x1f40('0x34')](_0x48a093[_0x1f40('0x2b')]['sort']);_0x1a3e9a[_0x1f40('0x35')]=qs[_0x1f40('0x2d')](_[_0x1f40('0x36')](_0x48a093[_0x1f40('0x2b')],_0x9d070['filters']),_0x1e25bb);if(_0x48a093[_0x1f40('0x2b')][_0x1f40('0x37')]){_0x1a3e9a[_0x1f40('0x35')]=_['merge'](_0x1a3e9a[_0x1f40('0x35')],{'$or':_[_0x1f40('0x24')](_0x1e25bb,function(_0x2215b6){if(_0x2215b6[_0x1f40('0x28')]!==_0x1f40('0x38')){var _0x55563a={};_0x55563a[_0x2215b6[_0x1f40('0x22')]]={'$like':'%'+_0x48a093[_0x1f40('0x2b')][_0x1f40('0x37')]+'%'};return _0x55563a;}})});}_0x1a3e9a=_[_0x1f40('0x39')]({},_0x1a3e9a,_0x48a093['options']);var _0x39a9c7={'where':_0x1a3e9a['where']};return db[_0x1f40('0x25')][_0x1f40('0x1d')](_0x39a9c7)['then'](function(_0x47a765){_0x13a216[_0x1f40('0x1d')]=_0x47a765;if(_0x48a093['query']['includeAll']){_0x1a3e9a[_0x1f40('0x3a')]=[{'all':!![]}];}return db[_0x1f40('0x25')][_0x1f40('0x3b')](_0x1a3e9a);})['then'](function(_0x185c02){_0x13a216[_0x1f40('0x3c')]=_0x185c02;return _0x13a216;})[_0x1f40('0x20')](respondWithFilteredResult(_0x323e08,_0x1a3e9a))[_0x1f40('0x3d')](handleError(_0x323e08,null));};exports[_0x1f40('0x3e')]=function(_0x54bfcd,_0x523424){var _0x46f522={'raw':!![],'where':{'id':_0x54bfcd[_0x1f40('0x3f')]['id']}},_0x3858ce={};_0x3858ce[_0x1f40('0x2a')]=_['keys'](db['ZohoField'][_0x1f40('0x26')]);_0x3858ce['query']=_[_0x1f40('0x2c')](_0x54bfcd['query']);_0x3858ce[_0x1f40('0x2d')]=_[_0x1f40('0x2e')](_0x3858ce['model'],_0x3858ce['query']);_0x46f522[_0x1f40('0x30')]=_[_0x1f40('0x2e')](_0x3858ce['model'],qs[_0x1f40('0x2f')](_0x54bfcd['query']['fields']));_0x46f522['attributes']=_0x46f522['attributes'][_0x1f40('0x40')]?_0x46f522[_0x1f40('0x30')]:_0x3858ce[_0x1f40('0x2a')];if(_0x54bfcd[_0x1f40('0x2b')][_0x1f40('0x41')]){_0x46f522[_0x1f40('0x3a')]=[{'all':!![]}];}_0x46f522=_['merge']({},_0x46f522,_0x54bfcd['options']);return db['ZohoField'][_0x1f40('0x42')](_0x46f522)[_0x1f40('0x20')](handleEntityNotFound(_0x523424,null))[_0x1f40('0x20')](respondWithResult(_0x523424,null))[_0x1f40('0x3d')](handleError(_0x523424,null));};exports['create']=function(_0x1777f5,_0x5788a4){return db[_0x1f40('0x25')]['create'](_0x1777f5[_0x1f40('0x43')],{})[_0x1f40('0x20')](respondWithResult(_0x5788a4,0xc9))[_0x1f40('0x3d')](handleError(_0x5788a4,null));};exports[_0x1f40('0x44')]=function(_0x2485f3,_0x33a70d){if(_0x2485f3[_0x1f40('0x43')]['id']){delete _0x2485f3[_0x1f40('0x43')]['id'];}return db['ZohoField'][_0x1f40('0x42')]({'where':{'id':_0x2485f3[_0x1f40('0x3f')]['id']}})[_0x1f40('0x20')](handleEntityNotFound(_0x33a70d,null))[_0x1f40('0x20')](saveUpdates(_0x2485f3[_0x1f40('0x43')],null))['then'](respondWithResult(_0x33a70d,null))['catch'](handleError(_0x33a70d,null));};exports[_0x1f40('0x21')]=function(_0xe70b0e,_0xf705fc){return db[_0x1f40('0x25')][_0x1f40('0x42')]({'where':{'id':_0xe70b0e[_0x1f40('0x3f')]['id']}})[_0x1f40('0x20')](handleEntityNotFound(_0xf705fc,null))['then'](removeEntity(_0xf705fc,null))[_0x1f40('0x3d')](handleError(_0xf705fc,null));}; \ No newline at end of file +var _0x13d3=['keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','fieldName','type','key'];(function(_0x1dd653,_0x1e6a20){var _0x3c21b0=function(_0x996348){while(--_0x996348){_0x1dd653['push'](_0x1dd653['shift']());}};_0x3c21b0(++_0x1e6a20);}(_0x13d3,0x1e7));var _0x313d=function(_0x30af26,_0x432d58){_0x30af26=_0x30af26-0x0;var _0x556308=_0x13d3[_0x30af26];return _0x556308;};'use strict';var emlformat=require(_0x313d('0x0'));var rimraf=require(_0x313d('0x1'));var zipdir=require(_0x313d('0x2'));var jsonpatch=require(_0x313d('0x3'));var rp=require(_0x313d('0x4'));var moment=require(_0x313d('0x5'));var BPromise=require(_0x313d('0x6'));var Mustache=require(_0x313d('0x7'));var util=require(_0x313d('0x8'));var path=require(_0x313d('0x9'));var sox=require(_0x313d('0xa'));var csv=require('to-csv');var ejs=require(_0x313d('0xb'));var fs=require('fs');var fs_extra=require(_0x313d('0xc'));var _=require(_0x313d('0xd'));var squel=require(_0x313d('0xe'));var crypto=require(_0x313d('0xf'));var jsforce=require(_0x313d('0x10'));var deskjs=require(_0x313d('0x11'));var toCsv=require(_0x313d('0x12'));var querystring=require(_0x313d('0x13'));var Papa=require(_0x313d('0x14'));var Redis=require('ioredis');var authService=require(_0x313d('0x15'));var qs=require(_0x313d('0x16'));var as=require(_0x313d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x313d('0x18'));var utils=require('../../config/utils');var config=require(_0x313d('0x19'));var licenseUtil=require(_0x313d('0x1a'));var db=require(_0x313d('0x1b'))['db'];function respondWithStatusCode(_0x1540df,_0x2a9e3f){_0x2a9e3f=_0x2a9e3f||0xcc;return function(_0x50bc9a){if(_0x50bc9a){return _0x1540df[_0x313d('0x1c')](_0x2a9e3f);}return _0x1540df[_0x313d('0x1d')](_0x2a9e3f)[_0x313d('0x1e')]();};}function respondWithResult(_0x484ea9,_0x14167f){_0x14167f=_0x14167f||0xc8;return function(_0x2e45a1){if(_0x2e45a1){return _0x484ea9[_0x313d('0x1d')](_0x14167f)[_0x313d('0x1f')](_0x2e45a1);}};}function respondWithFilteredResult(_0x1848ea,_0x1acbee){return function(_0x16e1af){if(_0x16e1af){var _0x758c08=typeof _0x1acbee[_0x313d('0x20')]==='undefined'&&typeof _0x1acbee[_0x313d('0x21')]==='undefined';var _0x4385c4=_0x16e1af[_0x313d('0x22')];var _0xe5dbbf=_0x758c08?0x0:_0x1acbee[_0x313d('0x20')];var _0x2a7e2d=_0x758c08?_0x16e1af['count']:_0x1acbee[_0x313d('0x20')]+_0x1acbee[_0x313d('0x21')];var _0x3655ad;if(_0x2a7e2d>=_0x4385c4){_0x2a7e2d=_0x4385c4;_0x3655ad=0xc8;}else{_0x3655ad=0xce;}_0x1848ea[_0x313d('0x1d')](_0x3655ad);return _0x1848ea[_0x313d('0x23')](_0x313d('0x24'),_0xe5dbbf+'-'+_0x2a7e2d+'/'+_0x4385c4)[_0x313d('0x1f')](_0x16e1af);}return null;};}function patchUpdates(_0xe94f73){return function(_0x299cb6){try{jsonpatch['apply'](_0x299cb6,_0xe94f73,!![]);}catch(_0x57ae73){return BPromise[_0x313d('0x25')](_0x57ae73);}return _0x299cb6[_0x313d('0x26')]();};}function saveUpdates(_0x3ab1ec,_0x230652){return function(_0x50d33d){if(_0x50d33d){return _0x50d33d[_0x313d('0x27')](_0x3ab1ec)[_0x313d('0x28')](function(_0x39a360){return _0x39a360;});}return null;};}function removeEntity(_0x2c2ba7,_0x5ee50f){return function(_0x3ff486){if(_0x3ff486){return _0x3ff486[_0x313d('0x29')]()[_0x313d('0x28')](function(){_0x2c2ba7[_0x313d('0x1d')](0xcc)[_0x313d('0x1e')]();});}};}function handleEntityNotFound(_0x4b063e,_0x236eed){return function(_0x3c6ac4){if(!_0x3c6ac4){_0x4b063e[_0x313d('0x1c')](0x194);}return _0x3c6ac4;};}function handleError(_0x1cbf87,_0x233570){_0x233570=_0x233570||0x1f4;return function(_0x1bb30d){logger[_0x313d('0x2a')](_0x1bb30d[_0x313d('0x2b')]);if(_0x1bb30d[_0x313d('0x2c')]){delete _0x1bb30d[_0x313d('0x2c')];}_0x1cbf87[_0x313d('0x1d')](_0x233570)[_0x313d('0x2d')](_0x1bb30d);};}exports[_0x313d('0x2e')]=function(_0x4470a2,_0x1f356){var _0x3483c9={},_0x344630={},_0x148762={'count':0x0,'rows':[]};var _0x2869b2=_[_0x313d('0x2f')](db[_0x313d('0x30')]['rawAttributes'],function(_0x1ab27d){return{'name':_0x1ab27d[_0x313d('0x31')],'type':_0x1ab27d[_0x313d('0x32')][_0x313d('0x33')]};});_0x344630['model']=_[_0x313d('0x2f')](_0x2869b2,_0x313d('0x2c'));_0x344630['query']=_[_0x313d('0x34')](_0x4470a2[_0x313d('0x35')]);_0x344630[_0x313d('0x36')]=_[_0x313d('0x37')](_0x344630[_0x313d('0x38')],_0x344630[_0x313d('0x35')]);_0x3483c9[_0x313d('0x39')]=_[_0x313d('0x37')](_0x344630['model'],qs[_0x313d('0x3a')](_0x4470a2['query'][_0x313d('0x3a')]));_0x3483c9[_0x313d('0x39')]=_0x3483c9[_0x313d('0x39')]['length']?_0x3483c9[_0x313d('0x39')]:_0x344630[_0x313d('0x38')];if(!_0x4470a2[_0x313d('0x35')][_0x313d('0x3b')]('nolimit')){_0x3483c9[_0x313d('0x21')]=qs[_0x313d('0x21')](_0x4470a2[_0x313d('0x35')][_0x313d('0x21')]);_0x3483c9['offset']=qs['offset'](_0x4470a2[_0x313d('0x35')][_0x313d('0x20')]);}_0x3483c9[_0x313d('0x3c')]=qs[_0x313d('0x3d')](_0x4470a2[_0x313d('0x35')][_0x313d('0x3d')]);_0x3483c9['where']=qs[_0x313d('0x36')](_[_0x313d('0x3e')](_0x4470a2[_0x313d('0x35')],_0x344630['filters']),_0x2869b2);if(_0x4470a2['query']['filter']){_0x3483c9[_0x313d('0x3f')]=_[_0x313d('0x40')](_0x3483c9[_0x313d('0x3f')],{'$or':_[_0x313d('0x2f')](_0x2869b2,function(_0x5618a1){if(_0x5618a1[_0x313d('0x32')]!=='VIRTUAL'){var _0x62f580={};_0x62f580[_0x5618a1[_0x313d('0x2c')]]={'$like':'%'+_0x4470a2[_0x313d('0x35')][_0x313d('0x41')]+'%'};return _0x62f580;}})});}_0x3483c9=_[_0x313d('0x40')]({},_0x3483c9,_0x4470a2[_0x313d('0x42')]);var _0x58da4e={'where':_0x3483c9[_0x313d('0x3f')]};return db['ZohoField']['count'](_0x58da4e)[_0x313d('0x28')](function(_0x2cea2d){_0x148762['count']=_0x2cea2d;if(_0x4470a2['query'][_0x313d('0x43')]){_0x3483c9['include']=[{'all':!![]}];}return db['ZohoField'][_0x313d('0x44')](_0x3483c9);})[_0x313d('0x28')](function(_0x357b1e){_0x148762['rows']=_0x357b1e;return _0x148762;})[_0x313d('0x28')](respondWithFilteredResult(_0x1f356,_0x3483c9))[_0x313d('0x45')](handleError(_0x1f356,null));};exports[_0x313d('0x46')]=function(_0x2b7b2c,_0x429510){var _0x5ab541={'raw':!![],'where':{'id':_0x2b7b2c['params']['id']}},_0x2f482a={};_0x2f482a[_0x313d('0x38')]=_[_0x313d('0x34')](db[_0x313d('0x30')][_0x313d('0x47')]);_0x2f482a['query']=_[_0x313d('0x34')](_0x2b7b2c[_0x313d('0x35')]);_0x2f482a['filters']=_[_0x313d('0x37')](_0x2f482a[_0x313d('0x38')],_0x2f482a[_0x313d('0x35')]);_0x5ab541[_0x313d('0x39')]=_[_0x313d('0x37')](_0x2f482a[_0x313d('0x38')],qs[_0x313d('0x3a')](_0x2b7b2c[_0x313d('0x35')][_0x313d('0x3a')]));_0x5ab541[_0x313d('0x39')]=_0x5ab541[_0x313d('0x39')]['length']?_0x5ab541[_0x313d('0x39')]:_0x2f482a[_0x313d('0x38')];if(_0x2b7b2c[_0x313d('0x35')][_0x313d('0x43')]){_0x5ab541[_0x313d('0x48')]=[{'all':!![]}];}_0x5ab541=_[_0x313d('0x40')]({},_0x5ab541,_0x2b7b2c[_0x313d('0x42')]);return db[_0x313d('0x30')][_0x313d('0x49')](_0x5ab541)[_0x313d('0x28')](handleEntityNotFound(_0x429510,null))[_0x313d('0x28')](respondWithResult(_0x429510,null))[_0x313d('0x45')](handleError(_0x429510,null));};exports[_0x313d('0x4a')]=function(_0x4e548c,_0x5e09ed){return db[_0x313d('0x30')][_0x313d('0x4a')](_0x4e548c['body'],{})[_0x313d('0x28')](respondWithResult(_0x5e09ed,0xc9))['catch'](handleError(_0x5e09ed,null));};exports[_0x313d('0x27')]=function(_0x2357a0,_0x2deb2e){if(_0x2357a0[_0x313d('0x4b')]['id']){delete _0x2357a0[_0x313d('0x4b')]['id'];}return db[_0x313d('0x30')]['find']({'where':{'id':_0x2357a0[_0x313d('0x4c')]['id']}})[_0x313d('0x28')](handleEntityNotFound(_0x2deb2e,null))[_0x313d('0x28')](saveUpdates(_0x2357a0[_0x313d('0x4b')],null))[_0x313d('0x28')](respondWithResult(_0x2deb2e,null))['catch'](handleError(_0x2deb2e,null));};exports[_0x313d('0x29')]=function(_0x3e49d5,_0x243f0c){return db[_0x313d('0x30')]['find']({'where':{'id':_0x3e49d5['params']['id']}})[_0x313d('0x28')](handleEntityNotFound(_0x243f0c,null))['then'](removeEntity(_0x243f0c,null))[_0x313d('0x45')](handleError(_0x243f0c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a70eca5..6b048a2 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 _0x4bd3=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4bd3,0x174));var _0x34bd=function(_0x3d5ad8,_0x338d1c){_0x3d5ad8=_0x3d5ad8-0x0;var _0x40bf6a=_0x4bd3[_0x3d5ad8];return _0x40bf6a;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intZohoField.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0xa'),_0x34bd('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','int_zoho_fields','zoho_unique_index','idField'];(function(_0x2df2a2,_0x17c8f8){var _0x547fe8=function(_0x52f3fe){while(--_0x52f3fe){_0x2df2a2['push'](_0x2df2a2['shift']());}};_0x547fe8(++_0x17c8f8);}(_0xafb9,0x68));var _0x9afb=function(_0x42c7af,_0x520258){_0x42c7af=_0x42c7af-0x0;var _0x4cb3a3=_0xafb9[_0x42c7af];return _0x4cb3a3;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require(_0x9afb('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x9afb('0x9')]=function(_0x56a139,_0x1ccf93){return _0x56a139['define']('ZohoField',attributes,{'tableName':_0x9afb('0xa'),'paranoid':![],'indexes':[{'name':_0x9afb('0xb'),'fields':[_0x9afb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 000ee05..db14362 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 _0x50db=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x5e206c,_0x366173){var _0xc5a89e=function(_0x1634e1){while(--_0x1634e1){_0x5e206c['push'](_0x5e206c['shift']());}};_0xc5a89e(++_0x366173);}(_0x50db,0x11c));var _0xb50d=function(_0x2f5137,_0x5367d3){_0x2f5137=_0x2f5137-0x0;var _0x26bdb5=_0x50db[_0x2f5137];return _0x26bdb5;};'use strict';var _=require(_0xb50d('0x0'));var util=require('util');var moment=require(_0xb50d('0x1'));var BPromise=require(_0xb50d('0x2'));var rs=require(_0xb50d('0x3'));var fs=require('fs');var Redis=require(_0xb50d('0x4'));var db=require(_0xb50d('0x5'))['db'];var utils=require(_0xb50d('0x6'));var logger=require('../../config/logger')(_0xb50d('0x7'));var config=require('../../config/environment');var jayson=require(_0xb50d('0x8'));var client=jayson[_0xb50d('0x9')][_0xb50d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc805a,_0x112bef,_0x4bcffe){return new BPromise(function(_0x469ac1,_0x11a94f){return client[_0xb50d('0xb')](_0xbc805a,_0x4bcffe)[_0xb50d('0xc')](function(_0xe68561){logger[_0xb50d('0xd')](_0xb50d('0xe'),_0x112bef,_0xb50d('0xf'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x112bef,_0xb50d('0xf'),JSON['stringify'](_0xe68561));if(_0xe68561[_0xb50d('0x10')]){if(_0xe68561[_0xb50d('0x10')][_0xb50d('0x11')]===0x1f4){logger[_0xb50d('0x10')](_0xb50d('0xe'),_0x112bef,_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);return _0x11a94f(_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);}logger[_0xb50d('0x10')](_0xb50d('0xe'),_0x112bef,_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);return _0x469ac1(_0xe68561[_0xb50d('0x10')][_0xb50d('0x12')]);}else{logger[_0xb50d('0xd')](_0xb50d('0xe'),_0x112bef,_0xb50d('0xf'));_0x469ac1(_0xe68561[_0xb50d('0x13')]['message']);}})['catch'](function(_0x203aa2){logger[_0xb50d('0x10')](_0xb50d('0xe'),_0x112bef,_0x203aa2);_0x11a94f(_0x203aa2);});});} \ No newline at end of file +var _0xde5a=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xde5a,0x16b));var _0xade5=function(_0x2b3a10,_0x3e0c14){_0x2b3a10=_0x2b3a10-0x0;var _0x10ff46=_0xde5a[_0x2b3a10];return _0x10ff46;};'use strict';var _=require(_0xade5('0x0'));var util=require(_0xade5('0x1'));var moment=require(_0xade5('0x2'));var BPromise=require(_0xade5('0x3'));var rs=require(_0xade5('0x4'));var fs=require('fs');var Redis=require(_0xade5('0x5'));var db=require(_0xade5('0x6'))['db'];var utils=require(_0xade5('0x7'));var logger=require('../../config/logger')(_0xade5('0x8'));var config=require(_0xade5('0x9'));var jayson=require(_0xade5('0xa'));var client=jayson[_0xade5('0xb')][_0xade5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21647f,_0x55af44,_0x4602b5){return new BPromise(function(_0x35110e,_0x5391af){return client[_0xade5('0xd')](_0x21647f,_0x4602b5)['then'](function(_0x5ab4e2){logger['info'](_0xade5('0xe'),_0x55af44,'request\x20sent');logger[_0xade5('0xf')](_0xade5('0x10'),_0x55af44,_0xade5('0x11'),JSON[_0xade5('0x12')](_0x5ab4e2));if(_0x5ab4e2[_0xade5('0x13')]){if(_0x5ab4e2['error'][_0xade5('0x14')]===0x1f4){logger[_0xade5('0x13')]('ZohoField,\x20%s,\x20%s',_0x55af44,_0x5ab4e2[_0xade5('0x13')]['message']);return _0x5391af(_0x5ab4e2[_0xade5('0x13')]['message']);}logger[_0xade5('0x13')](_0xade5('0xe'),_0x55af44,_0x5ab4e2[_0xade5('0x13')][_0xade5('0x15')]);return _0x35110e(_0x5ab4e2[_0xade5('0x13')][_0xade5('0x15')]);}else{logger['info'](_0xade5('0xe'),_0x55af44,_0xade5('0x11'));_0x35110e(_0x5ab4e2[_0xade5('0x16')]['message']);}})['catch'](function(_0x5f00ab){logger[_0xade5('0x13')]('ZohoField,\x20%s,\x20%s',_0x55af44,_0x5f00ab);_0x5391af(_0x5f00ab);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 01e8a15..c38e20a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x19d146,_0x42e8b1){var _0x302b61=function(_0x189555){while(--_0x189555){_0x19d146['push'](_0x19d146['shift']());}};_0x302b61(++_0x42e8b1);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 52547f0..34a9b93 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 _0x72f8=['exports','STRING','unique_name_and_version','INTEGER','state','sequelize'];(function(_0x2dd078,_0x337a46){var _0x50a2b8=function(_0x3d0341){while(--_0x3d0341){_0x2dd078['push'](_0x2dd078['shift']());}};_0x50a2b8(++_0x337a46);}(_0x72f8,0xa7));var _0x872f=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x72f8[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x872f('0x0'));module[_0x872f('0x1')]={'name':{'type':Sequelize[_0x872f('0x2')],'allowNull':![],'unique':_0x872f('0x3')},'version':{'type':Sequelize[_0x872f('0x2')],'allowNull':![],'unique':_0x872f('0x3')},'main':{'type':Sequelize[_0x872f('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x872f('0x2')]},'path':{'type':Sequelize[_0x872f('0x2')]},'type':{'type':Sequelize[_0x872f('0x2')]},'size':{'type':Sequelize[_0x872f('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x872f('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x872f('0x5')},'description':{'type':Sequelize[_0x872f('0x2')]},'title':{'type':Sequelize[_0x872f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x872f('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa207=['app.js','exports','STRING','unique_name_and_version'];(function(_0x20e9fb,_0x3980d5){var _0x12ccf2=function(_0xf767c7){while(--_0xf767c7){_0x20e9fb['push'](_0x20e9fb['shift']());}};_0x12ccf2(++_0x3980d5);}(_0xa207,0x69));var _0x7a20=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa207[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module[_0x7a20('0x0')]={'name':{'type':Sequelize[_0x7a20('0x1')],'allowNull':![],'unique':_0x7a20('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x7a20('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x7a20('0x1')]},'type':{'type':Sequelize[_0x7a20('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x7a20('0x1')]},'logo':{'type':Sequelize[_0x7a20('0x1')]},'state':{'type':Sequelize[_0x7a20('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7a20('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 065b9ce..26e8a7e 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 _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x66fa,0x117));var _0xa66f=function(_0x23ae96,_0x3cbf59){_0x23ae96=_0x23ae96-0x0;var _0x3b7efa=_0x66fa[_0x23ae96];return _0x3b7efa;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Integration','includeAll','rows','catch','show'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x0295,0x1f0));var _0x5029=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0x0295[_0x221a6f];return _0x3db53d;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['Integration'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['Integration'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0ef7712..2653c09 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 _0xa048=['lodash','moment','request-promise','path','./integration.attributes','exports','define','Integration'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa048,0x1d0));var _0x8a04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa048[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8a04('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8a04('0x1'));var BPromise=require('bluebird');var rp=require(_0x8a04('0x2'));var fs=require('fs');var path=require(_0x8a04('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a04('0x4'));module[_0x8a04('0x5')]=function(_0x12f2b8,_0x11067e){return _0x12f2b8[_0x8a04('0x6')](_0x8a04('0x7'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe40c=['moment','bluebird','./integration.attributes','exports','define','Integration','lodash','../../config/logger','api'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xe40c,0x180));var _0xce40=function(_0x43a251,_0x2ca1b8){_0x43a251=_0x43a251-0x0;var _0x15f782=_0xe40c[_0x43a251];return _0x15f782;};'use strict';var _=require(_0xce40('0x0'));var util=require('util');var logger=require(_0xce40('0x1'))(_0xce40('0x2'));var moment=require(_0xce40('0x3'));var BPromise=require(_0xce40('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(_0xce40('0x5'));module[_0xce40('0x6')]=function(_0x5bd55d,_0x8b14c1){return _0x5bd55d[_0xce40('0x7')](_0xce40('0x8'),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 25fc1ae..97061c9 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x4137,0xf8));var _0x7413=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4137[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0xd158dc,_0x128608){var _0x12d25f=function(_0x2e9d2b){while(--_0x2e9d2b){_0xd158dc['push'](_0xd158dc['shift']());}};_0x12d25f(++_0x128608);}(_0x524e,0x15e));var _0xe524=function(_0x48edeb,_0x4f7ad5){_0x48edeb=_0x48edeb-0x0;var _0x721733=_0x524e[_0x48edeb];return _0x721733;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 88649b8..ede17ef 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x4bad42,_0x2c5e2e){var _0x3487bc=function(_0x205662){while(--_0x205662){_0x4bad42['push'](_0x4bad42['shift']());}};_0x3487bc(++_0x2c5e2e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x244a12,_0x40c8ed){_0x244a12=_0x244a12-0x0;var _0x7656fd=_0x9f0e[_0x244a12];return _0x7656fd;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x42701f,_0x3d2f90){var _0x36aafb=function(_0x1bb284){while(--_0x1bb284){_0x42701f['push'](_0x42701f['shift']());}};_0x36aafb(++_0x3d2f90);}(_0x66fa,0x117));var _0xa66f=function(_0xdc1950,_0x2283c9){_0xdc1950=_0xdc1950-0x0;var _0x2b3af1=_0x66fa[_0xdc1950];return _0x2b3af1;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 0294d14..870acfe 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 _0x847e=['exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x5da084,_0x193510){var _0x4c7bb6=function(_0x31c5ef){while(--_0x31c5ef){_0x5da084['push'](_0x5da084['shift']());}};_0x4c7bb6(++_0x193510);}(_0x847e,0x78));var _0xe847=function(_0x2185c7,_0x482bc7){_0x2185c7=_0x2185c7-0x0;var _0x58aa31=_0x847e[_0x2185c7];return _0x58aa31;};'use strict';var Sequelize=require(_0xe847('0x0'));module[_0xe847('0x1')]={'integration':{'type':Sequelize[_0xe847('0x2')]},'eventChannel':{'type':Sequelize[_0xe847('0x2')]},'exitStatus':{'type':Sequelize[_0xe847('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xe847('0x2')]},'uniqueid':{'type':Sequelize[_0xe847('0x2')]},'calleridnum':{'type':Sequelize[_0xe847('0x2')]},'calleridname':{'type':Sequelize[_0xe847('0x2')]},'queue':{'type':Sequelize[_0xe847('0x2')]},'interface':{'type':Sequelize[_0xe847('0x2')]},'membername':{'type':Sequelize[_0xe847('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xe847('0x3')]},'holdtime':{'type':Sequelize[_0xe847('0x4')]},'agentcomplete':{'type':Sequelize[_0xe847('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe847('0x3')]},'talktime':{'type':Sequelize[_0xe847('0x4')]},'agentacw':{'type':Sequelize[_0xe847('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe847('0x4')]},'reason':{'type':Sequelize[_0xe847('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe847('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe847('0x2')]},'channel':{'type':Sequelize[_0xe847('0x2')]},'channelstate':{'type':Sequelize[_0xe847('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe847('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe847('0x2')]},'connectedlinename':{'type':Sequelize[_0xe847('0x2')]},'language':{'type':Sequelize[_0xe847('0x2')]},'accountcode':{'type':Sequelize[_0xe847('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe847('0x2')]},'priority':{'type':Sequelize[_0xe847('0x2')]},'destchannel':{'type':Sequelize[_0xe847('0x2')]},'destchannelstate':{'type':Sequelize[_0xe847('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xe847('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe847('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe847('0x2')]},'destaccountcode':{'type':Sequelize[_0xe847('0x2')]},'destcontext':{'type':Sequelize[_0xe847('0x2')]},'destexten':{'type':Sequelize[_0xe847('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe847('0x2')]},'messageId':{'type':Sequelize[_0xe847('0x2')]},'inReplyTo':{'type':Sequelize[_0xe847('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xe847('0x2')]},'to':{'type':Sequelize[_0xe847('0x2')]},'cc':{'type':Sequelize[_0xe847('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xe847('0x6')]},'text':{'type':Sequelize[_0xe847('0x6')]},'status':{'type':Sequelize[_0xe847('0x7')]('SENT',_0xe847('0x8'),_0xe847('0x9'),_0xe847('0xa'))},'url':{'type':Sequelize[_0xe847('0x2')]},'app':{'type':Sequelize[_0xe847('0x2')]},'appdata':{'type':Sequelize[_0xe847('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa49d=['TEXT','SENT','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x2dd752,_0x59b4fc){var _0x297823=function(_0x44a37f){while(--_0x44a37f){_0x2dd752['push'](_0x2dd752['shift']());}};_0x297823(++_0x59b4fc);}(_0xa49d,0x17e));var _0xda49=function(_0x58c8f5,_0xaf3d2e){_0x58c8f5=_0x58c8f5-0x0;var _0x41823f=_0xa49d[_0x58c8f5];return _0x41823f;};'use strict';var Sequelize=require('sequelize');module[_0xda49('0x0')]={'integration':{'type':Sequelize[_0xda49('0x1')]},'eventChannel':{'type':Sequelize[_0xda49('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xda49('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xda49('0x1')]},'calleridnum':{'type':Sequelize[_0xda49('0x1')]},'calleridname':{'type':Sequelize[_0xda49('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xda49('0x1')]},'membername':{'type':Sequelize[_0xda49('0x1')]},'agentcalledAt':{'type':Sequelize[_0xda49('0x3')]},'agentconnectAt':{'type':Sequelize[_0xda49('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xda49('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xda49('0x2')]},'reason':{'type':Sequelize[_0xda49('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xda49('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xda49('0x3')]},'agentdump':{'type':Sequelize[_0xda49('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xda49('0x3')]},'lastevent':{'type':Sequelize[_0xda49('0x1')]},'channel':{'type':Sequelize[_0xda49('0x1')]},'channelstate':{'type':Sequelize[_0xda49('0x2')]},'channelstatedesc':{'type':Sequelize[_0xda49('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xda49('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xda49('0x1')]},'context':{'type':Sequelize[_0xda49('0x1')]},'exten':{'type':Sequelize[_0xda49('0x1')]},'priority':{'type':Sequelize[_0xda49('0x1')]},'destchannel':{'type':Sequelize[_0xda49('0x1')]},'destchannelstate':{'type':Sequelize[_0xda49('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xda49('0x1')]},'destcalleridnum':{'type':Sequelize[_0xda49('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xda49('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xda49('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xda49('0x1')]},'destexten':{'type':Sequelize[_0xda49('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xda49('0x1')]},'messageId':{'type':Sequelize[_0xda49('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xda49('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xda49('0x1')]},'cc':{'type':Sequelize[_0xda49('0x1')]},'attachment':{'type':Sequelize[_0xda49('0x5')]},'html':{'type':Sequelize[_0xda49('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0xda49('0x6'),'SENDING',_0xda49('0x7'),_0xda49('0x8'))},'url':{'type':Sequelize[_0xda49('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xda49('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ceb5433..3c9def8 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 _0xdb14=['VIRTUAL','options','IntegrationReport','includeAll','include','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x413a25,_0x273aa9){var _0x43d03a=function(_0x51bfbb){while(--_0x51bfbb){_0x413a25['push'](_0x413a25['shift']());}};_0x43d03a(++_0x273aa9);}(_0xdb14,0x192));var _0x4db1=function(_0x2f30f0,_0x56aa74){_0x2f30f0=_0x2f30f0-0x0;var _0x56a36a=_0xdb14[_0x2f30f0];return _0x56a36a;};'use strict';var emlformat=require(_0x4db1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4db1('0x1'));var jsonpatch=require(_0x4db1('0x2'));var rp=require(_0x4db1('0x3'));var moment=require(_0x4db1('0x4'));var BPromise=require(_0x4db1('0x5'));var Mustache=require(_0x4db1('0x6'));var util=require(_0x4db1('0x7'));var path=require(_0x4db1('0x8'));var sox=require(_0x4db1('0x9'));var csv=require(_0x4db1('0xa'));var ejs=require(_0x4db1('0xb'));var fs=require('fs');var fs_extra=require(_0x4db1('0xc'));var _=require(_0x4db1('0xd'));var squel=require('squel');var crypto=require(_0x4db1('0xe'));var jsforce=require(_0x4db1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4db1('0xa'));var querystring=require('querystring');var Papa=require(_0x4db1('0x10'));var Redis=require(_0x4db1('0x11'));var authService=require(_0x4db1('0x12'));var qs=require(_0x4db1('0x13'));var as=require(_0x4db1('0x14'));var hardwareService=require(_0x4db1('0x15'));var logger=require('../../config/logger')(_0x4db1('0x16'));var utils=require(_0x4db1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4db1('0x18'));var db=require(_0x4db1('0x19'))['db'];function respondWithStatusCode(_0x31dcd2,_0x38f6f0){_0x38f6f0=_0x38f6f0||0xcc;return function(_0x5a5c33){if(_0x5a5c33){return _0x31dcd2[_0x4db1('0x1a')](_0x38f6f0);}return _0x31dcd2[_0x4db1('0x1b')](_0x38f6f0)[_0x4db1('0x1c')]();};}function respondWithResult(_0x4af8ff,_0x553175){_0x553175=_0x553175||0xc8;return function(_0x9a7542){if(_0x9a7542){return _0x4af8ff['status'](_0x553175)[_0x4db1('0x1d')](_0x9a7542);}};}function respondWithFilteredResult(_0x2f56cb,_0x47abb8){return function(_0x1644a5){if(_0x1644a5){var _0x5e0474=typeof _0x47abb8['offset']===_0x4db1('0x1e')&&typeof _0x47abb8[_0x4db1('0x1f')]===_0x4db1('0x1e');var _0x292462=_0x1644a5[_0x4db1('0x20')];var _0x566410=_0x5e0474?0x0:_0x47abb8['offset'];var _0x6cfb59=_0x5e0474?_0x1644a5[_0x4db1('0x20')]:_0x47abb8[_0x4db1('0x21')]+_0x47abb8['limit'];var _0x289cb2;if(_0x6cfb59>=_0x292462){_0x6cfb59=_0x292462;_0x289cb2=0xc8;}else{_0x289cb2=0xce;}_0x2f56cb[_0x4db1('0x1b')](_0x289cb2);return _0x2f56cb[_0x4db1('0x22')](_0x4db1('0x23'),_0x566410+'-'+_0x6cfb59+'/'+_0x292462)[_0x4db1('0x1d')](_0x1644a5);}return null;};}function patchUpdates(_0x292e59){return function(_0x7a682f){try{jsonpatch[_0x4db1('0x24')](_0x7a682f,_0x292e59,!![]);}catch(_0x19c3da){return BPromise[_0x4db1('0x25')](_0x19c3da);}return _0x7a682f[_0x4db1('0x26')]();};}function saveUpdates(_0x38bf80,_0x1d8ea3){return function(_0x251fa8){if(_0x251fa8){return _0x251fa8[_0x4db1('0x27')](_0x38bf80)[_0x4db1('0x28')](function(_0xe223f4){return _0xe223f4;});}return null;};}function removeEntity(_0x2ee233,_0x2927e6){return function(_0x3d2562){if(_0x3d2562){return _0x3d2562[_0x4db1('0x29')]()[_0x4db1('0x28')](function(){_0x2ee233[_0x4db1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2083d1,_0x27ee38){return function(_0x15481a){if(!_0x15481a){_0x2083d1['sendStatus'](0x194);}return _0x15481a;};}function handleError(_0x4e6d53,_0x40b0a4){_0x40b0a4=_0x40b0a4||0x1f4;return function(_0x3ef7bd){logger[_0x4db1('0x2a')](_0x3ef7bd[_0x4db1('0x2b')]);if(_0x3ef7bd[_0x4db1('0x2c')]){delete _0x3ef7bd[_0x4db1('0x2c')];}_0x4e6d53[_0x4db1('0x1b')](_0x40b0a4)['send'](_0x3ef7bd);};}exports['index']=function(_0x39221d,_0x5825da){var _0x41e1b4={},_0x4d6a31={},_0x4c0a68={'count':0x0,'rows':[]};var _0x3438ff=_[_0x4db1('0x2d')](db['IntegrationReport'][_0x4db1('0x2e')],function(_0x354675){return{'name':_0x354675[_0x4db1('0x2f')],'type':_0x354675[_0x4db1('0x30')][_0x4db1('0x31')]};});_0x4d6a31[_0x4db1('0x32')]=_[_0x4db1('0x2d')](_0x3438ff,_0x4db1('0x2c'));_0x4d6a31[_0x4db1('0x33')]=_[_0x4db1('0x34')](_0x39221d['query']);_0x4d6a31['filters']=_[_0x4db1('0x35')](_0x4d6a31[_0x4db1('0x32')],_0x4d6a31['query']);_0x41e1b4['attributes']=_[_0x4db1('0x35')](_0x4d6a31[_0x4db1('0x32')],qs[_0x4db1('0x36')](_0x39221d[_0x4db1('0x33')][_0x4db1('0x36')]));_0x41e1b4['attributes']=_0x41e1b4[_0x4db1('0x37')][_0x4db1('0x38')]?_0x41e1b4[_0x4db1('0x37')]:_0x4d6a31[_0x4db1('0x32')];if(!_0x39221d['query'][_0x4db1('0x39')](_0x4db1('0x3a'))){_0x41e1b4[_0x4db1('0x1f')]=qs['limit'](_0x39221d['query'][_0x4db1('0x1f')]);_0x41e1b4['offset']=qs[_0x4db1('0x21')](_0x39221d[_0x4db1('0x33')][_0x4db1('0x21')]);}_0x41e1b4[_0x4db1('0x3b')]=qs['sort'](_0x39221d[_0x4db1('0x33')][_0x4db1('0x3c')]);_0x41e1b4[_0x4db1('0x3d')]=qs[_0x4db1('0x3e')](_[_0x4db1('0x3f')](_0x39221d[_0x4db1('0x33')],_0x4d6a31[_0x4db1('0x3e')]),_0x3438ff);if(_0x39221d[_0x4db1('0x33')][_0x4db1('0x40')]){_0x41e1b4[_0x4db1('0x3d')]=_[_0x4db1('0x41')](_0x41e1b4[_0x4db1('0x3d')],{'$or':_[_0x4db1('0x2d')](_0x3438ff,function(_0x5d77d0){if(_0x5d77d0[_0x4db1('0x30')]!==_0x4db1('0x42')){var _0x2051ce={};_0x2051ce[_0x5d77d0[_0x4db1('0x2c')]]={'$like':'%'+_0x39221d[_0x4db1('0x33')][_0x4db1('0x40')]+'%'};return _0x2051ce;}})});}_0x41e1b4=_[_0x4db1('0x41')]({},_0x41e1b4,_0x39221d[_0x4db1('0x43')]);var _0xdd6dfb={'where':_0x41e1b4[_0x4db1('0x3d')]};return db[_0x4db1('0x44')][_0x4db1('0x20')](_0xdd6dfb)[_0x4db1('0x28')](function(_0x1b1270){_0x4c0a68['count']=_0x1b1270;if(_0x39221d[_0x4db1('0x33')][_0x4db1('0x45')]){_0x41e1b4[_0x4db1('0x46')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x41e1b4);})[_0x4db1('0x28')](function(_0x3d70d6){_0x4c0a68[_0x4db1('0x47')]=_0x3d70d6;return _0x4c0a68;})[_0x4db1('0x28')](respondWithFilteredResult(_0x5825da,_0x41e1b4))[_0x4db1('0x48')](handleError(_0x5825da,null));};exports['show']=function(_0x30261b,_0x1b4d31){var _0x4e8615={'raw':![],'where':{'id':_0x30261b['params']['id']}},_0x6f588b={};_0x6f588b[_0x4db1('0x32')]=_[_0x4db1('0x34')](db[_0x4db1('0x44')][_0x4db1('0x2e')]);_0x6f588b[_0x4db1('0x33')]=_[_0x4db1('0x34')](_0x30261b[_0x4db1('0x33')]);_0x6f588b[_0x4db1('0x3e')]=_['intersection'](_0x6f588b['model'],_0x6f588b[_0x4db1('0x33')]);_0x4e8615[_0x4db1('0x37')]=_[_0x4db1('0x35')](_0x6f588b[_0x4db1('0x32')],qs[_0x4db1('0x36')](_0x30261b[_0x4db1('0x33')][_0x4db1('0x36')]));_0x4e8615[_0x4db1('0x37')]=_0x4e8615[_0x4db1('0x37')]['length']?_0x4e8615['attributes']:_0x6f588b[_0x4db1('0x32')];if(_0x30261b[_0x4db1('0x33')]['includeAll']){_0x4e8615[_0x4db1('0x46')]=[{'all':!![]}];}_0x4e8615=_['merge']({},_0x4e8615,_0x30261b[_0x4db1('0x43')]);return db[_0x4db1('0x44')][_0x4db1('0x49')](_0x4e8615)[_0x4db1('0x28')](handleEntityNotFound(_0x1b4d31,null))[_0x4db1('0x28')](respondWithResult(_0x1b4d31,null))[_0x4db1('0x48')](handleError(_0x1b4d31,null));};exports[_0x4db1('0x4a')]=function(_0x165b08,_0x2c5707){return db[_0x4db1('0x44')]['create'](_0x165b08[_0x4db1('0x4b')],{})[_0x4db1('0x28')](respondWithResult(_0x2c5707,0xc9))[_0x4db1('0x48')](handleError(_0x2c5707,null));};exports['update']=function(_0x181039,_0x55b545){if(_0x181039[_0x4db1('0x4b')]['id']){delete _0x181039['body']['id'];}return db[_0x4db1('0x44')][_0x4db1('0x49')]({'where':{'id':_0x181039[_0x4db1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x55b545,null))[_0x4db1('0x28')](saveUpdates(_0x181039[_0x4db1('0x4b')],null))[_0x4db1('0x28')](respondWithResult(_0x55b545,null))[_0x4db1('0x48')](handleError(_0x55b545,null));};exports[_0x4db1('0x29')]=function(_0x1084b2,_0x3caaa9){return db[_0x4db1('0x44')][_0x4db1('0x49')]({'where':{'id':_0x1084b2['params']['id']}})['then'](handleEntityNotFound(_0x3caaa9,null))['then'](removeEntity(_0x3caaa9,null))[_0x4db1('0x48')](handleError(_0x3caaa9,null));};exports[_0x4db1('0x4d')]=function(_0xf703f7,_0x826dc3){return db['IntegrationReport'][_0x4db1('0x4d')]()[_0x4db1('0x28')](respondWithResult(_0x826dc3,null))[_0x4db1('0x48')](handleError(_0x826dc3,null));}; \ No newline at end of file +var _0x8d8d=['params','keys','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','filter','options','IntegrationReport','includeAll','include','findAll','rows','catch','show'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0x8d8d,0x12a));var _0xd8d8=function(_0x3d78bc,_0x3105c6){_0x3d78bc=_0x3d78bc-0x0;var _0x294a76=_0x8d8d[_0x3d78bc];return _0x294a76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8d8('0x0'));var zipdir=require(_0xd8d8('0x1'));var jsonpatch=require(_0xd8d8('0x2'));var rp=require(_0xd8d8('0x3'));var moment=require(_0xd8d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd8d8('0x5'));var util=require(_0xd8d8('0x6'));var path=require(_0xd8d8('0x7'));var sox=require(_0xd8d8('0x8'));var csv=require('to-csv');var ejs=require(_0xd8d8('0x9'));var fs=require('fs');var fs_extra=require(_0xd8d8('0xa'));var _=require(_0xd8d8('0xb'));var squel=require(_0xd8d8('0xc'));var crypto=require('crypto');var jsforce=require(_0xd8d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd8d8('0xe'));var querystring=require('querystring');var Papa=require(_0xd8d8('0xf'));var Redis=require('ioredis');var authService=require(_0xd8d8('0x10'));var qs=require(_0xd8d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8d8('0x12'));var logger=require(_0xd8d8('0x13'))(_0xd8d8('0x14'));var utils=require('../../config/utils');var config=require(_0xd8d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8d8('0x16'))['db'];function respondWithStatusCode(_0x56a69d,_0x5d3609){_0x5d3609=_0x5d3609||0xcc;return function(_0x176990){if(_0x176990){return _0x56a69d[_0xd8d8('0x17')](_0x5d3609);}return _0x56a69d[_0xd8d8('0x18')](_0x5d3609)[_0xd8d8('0x19')]();};}function respondWithResult(_0x27f053,_0x516d58){_0x516d58=_0x516d58||0xc8;return function(_0x2d2eae){if(_0x2d2eae){return _0x27f053[_0xd8d8('0x18')](_0x516d58)[_0xd8d8('0x1a')](_0x2d2eae);}};}function respondWithFilteredResult(_0x1c3647,_0x5a69fb){return function(_0x3e868c){if(_0x3e868c){var _0x2c96cb=typeof _0x5a69fb[_0xd8d8('0x1b')]==='undefined'&&typeof _0x5a69fb[_0xd8d8('0x1c')]==='undefined';var _0x5e3e84=_0x3e868c[_0xd8d8('0x1d')];var _0x1fc23e=_0x2c96cb?0x0:_0x5a69fb['offset'];var _0x1873d3=_0x2c96cb?_0x3e868c[_0xd8d8('0x1d')]:_0x5a69fb['offset']+_0x5a69fb[_0xd8d8('0x1c')];var _0x573f17;if(_0x1873d3>=_0x5e3e84){_0x1873d3=_0x5e3e84;_0x573f17=0xc8;}else{_0x573f17=0xce;}_0x1c3647[_0xd8d8('0x18')](_0x573f17);return _0x1c3647[_0xd8d8('0x1e')](_0xd8d8('0x1f'),_0x1fc23e+'-'+_0x1873d3+'/'+_0x5e3e84)['json'](_0x3e868c);}return null;};}function patchUpdates(_0x485aa3){return function(_0x4db667){try{jsonpatch[_0xd8d8('0x20')](_0x4db667,_0x485aa3,!![]);}catch(_0x342f66){return BPromise[_0xd8d8('0x21')](_0x342f66);}return _0x4db667[_0xd8d8('0x22')]();};}function saveUpdates(_0xe5012c,_0x317a80){return function(_0x781987){if(_0x781987){return _0x781987[_0xd8d8('0x23')](_0xe5012c)[_0xd8d8('0x24')](function(_0x4c5d45){return _0x4c5d45;});}return null;};}function removeEntity(_0x25e98e,_0x4c00b1){return function(_0x29924b){if(_0x29924b){return _0x29924b[_0xd8d8('0x25')]()[_0xd8d8('0x24')](function(){_0x25e98e[_0xd8d8('0x18')](0xcc)[_0xd8d8('0x19')]();});}};}function handleEntityNotFound(_0x577ba4,_0x2694cf){return function(_0x1e9abe){if(!_0x1e9abe){_0x577ba4[_0xd8d8('0x17')](0x194);}return _0x1e9abe;};}function handleError(_0x3554ef,_0x2d96b0){_0x2d96b0=_0x2d96b0||0x1f4;return function(_0x2c7230){logger[_0xd8d8('0x26')](_0x2c7230[_0xd8d8('0x27')]);if(_0x2c7230[_0xd8d8('0x28')]){delete _0x2c7230['name'];}_0x3554ef[_0xd8d8('0x18')](_0x2d96b0)['send'](_0x2c7230);};}exports[_0xd8d8('0x29')]=function(_0x45d46d,_0x5d2c0d){var _0x203c70={},_0x8eb66e={},_0x461d5d={'count':0x0,'rows':[]};var _0x2e4585=_[_0xd8d8('0x2a')](db['IntegrationReport'][_0xd8d8('0x2b')],function(_0x50bde0){return{'name':_0x50bde0['fieldName'],'type':_0x50bde0[_0xd8d8('0x2c')][_0xd8d8('0x2d')]};});_0x8eb66e[_0xd8d8('0x2e')]=_[_0xd8d8('0x2a')](_0x2e4585,_0xd8d8('0x28'));_0x8eb66e[_0xd8d8('0x2f')]=_['keys'](_0x45d46d[_0xd8d8('0x2f')]);_0x8eb66e['filters']=_[_0xd8d8('0x30')](_0x8eb66e[_0xd8d8('0x2e')],_0x8eb66e[_0xd8d8('0x2f')]);_0x203c70[_0xd8d8('0x31')]=_[_0xd8d8('0x30')](_0x8eb66e[_0xd8d8('0x2e')],qs[_0xd8d8('0x32')](_0x45d46d[_0xd8d8('0x2f')][_0xd8d8('0x32')]));_0x203c70[_0xd8d8('0x31')]=_0x203c70[_0xd8d8('0x31')]['length']?_0x203c70['attributes']:_0x8eb66e[_0xd8d8('0x2e')];if(!_0x45d46d['query']['hasOwnProperty'](_0xd8d8('0x33'))){_0x203c70[_0xd8d8('0x1c')]=qs[_0xd8d8('0x1c')](_0x45d46d['query'][_0xd8d8('0x1c')]);_0x203c70['offset']=qs[_0xd8d8('0x1b')](_0x45d46d['query']['offset']);}_0x203c70[_0xd8d8('0x34')]=qs[_0xd8d8('0x35')](_0x45d46d[_0xd8d8('0x2f')]['sort']);_0x203c70[_0xd8d8('0x36')]=qs[_0xd8d8('0x37')](_[_0xd8d8('0x38')](_0x45d46d['query'],_0x8eb66e[_0xd8d8('0x37')]),_0x2e4585);if(_0x45d46d[_0xd8d8('0x2f')]['filter']){_0x203c70['where']=_[_0xd8d8('0x39')](_0x203c70['where'],{'$or':_[_0xd8d8('0x2a')](_0x2e4585,function(_0x54cfe0){if(_0x54cfe0[_0xd8d8('0x2c')]!=='VIRTUAL'){var _0x13be3e={};_0x13be3e[_0x54cfe0['name']]={'$like':'%'+_0x45d46d['query'][_0xd8d8('0x3a')]+'%'};return _0x13be3e;}})});}_0x203c70=_['merge']({},_0x203c70,_0x45d46d[_0xd8d8('0x3b')]);var _0x2d6564={'where':_0x203c70[_0xd8d8('0x36')]};return db[_0xd8d8('0x3c')][_0xd8d8('0x1d')](_0x2d6564)['then'](function(_0x80a84d){_0x461d5d[_0xd8d8('0x1d')]=_0x80a84d;if(_0x45d46d['query'][_0xd8d8('0x3d')]){_0x203c70[_0xd8d8('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0xd8d8('0x3f')](_0x203c70);})[_0xd8d8('0x24')](function(_0x682720){_0x461d5d[_0xd8d8('0x40')]=_0x682720;return _0x461d5d;})[_0xd8d8('0x24')](respondWithFilteredResult(_0x5d2c0d,_0x203c70))[_0xd8d8('0x41')](handleError(_0x5d2c0d,null));};exports[_0xd8d8('0x42')]=function(_0x13fdf5,_0x597398){var _0x2c850a={'raw':![],'where':{'id':_0x13fdf5[_0xd8d8('0x43')]['id']}},_0x32ed80={};_0x32ed80[_0xd8d8('0x2e')]=_[_0xd8d8('0x44')](db['IntegrationReport'][_0xd8d8('0x2b')]);_0x32ed80[_0xd8d8('0x2f')]=_[_0xd8d8('0x44')](_0x13fdf5[_0xd8d8('0x2f')]);_0x32ed80[_0xd8d8('0x37')]=_[_0xd8d8('0x30')](_0x32ed80[_0xd8d8('0x2e')],_0x32ed80[_0xd8d8('0x2f')]);_0x2c850a[_0xd8d8('0x31')]=_['intersection'](_0x32ed80[_0xd8d8('0x2e')],qs[_0xd8d8('0x32')](_0x13fdf5[_0xd8d8('0x2f')][_0xd8d8('0x32')]));_0x2c850a[_0xd8d8('0x31')]=_0x2c850a[_0xd8d8('0x31')][_0xd8d8('0x45')]?_0x2c850a['attributes']:_0x32ed80[_0xd8d8('0x2e')];if(_0x13fdf5[_0xd8d8('0x2f')][_0xd8d8('0x3d')]){_0x2c850a['include']=[{'all':!![]}];}_0x2c850a=_[_0xd8d8('0x39')]({},_0x2c850a,_0x13fdf5[_0xd8d8('0x3b')]);return db[_0xd8d8('0x3c')][_0xd8d8('0x46')](_0x2c850a)['then'](handleEntityNotFound(_0x597398,null))['then'](respondWithResult(_0x597398,null))[_0xd8d8('0x41')](handleError(_0x597398,null));};exports[_0xd8d8('0x47')]=function(_0x3e9ccd,_0x25710d){return db[_0xd8d8('0x3c')][_0xd8d8('0x47')](_0x3e9ccd[_0xd8d8('0x48')],{})['then'](respondWithResult(_0x25710d,0xc9))[_0xd8d8('0x41')](handleError(_0x25710d,null));};exports[_0xd8d8('0x23')]=function(_0x495486,_0x2fcdd3){if(_0x495486[_0xd8d8('0x48')]['id']){delete _0x495486['body']['id'];}return db[_0xd8d8('0x3c')][_0xd8d8('0x46')]({'where':{'id':_0x495486[_0xd8d8('0x43')]['id']}})[_0xd8d8('0x24')](handleEntityNotFound(_0x2fcdd3,null))[_0xd8d8('0x24')](saveUpdates(_0x495486[_0xd8d8('0x48')],null))[_0xd8d8('0x24')](respondWithResult(_0x2fcdd3,null))[_0xd8d8('0x41')](handleError(_0x2fcdd3,null));};exports[_0xd8d8('0x25')]=function(_0x258132,_0x55d609){return db['IntegrationReport'][_0xd8d8('0x46')]({'where':{'id':_0x258132[_0xd8d8('0x43')]['id']}})[_0xd8d8('0x24')](handleEntityNotFound(_0x55d609,null))[_0xd8d8('0x24')](removeEntity(_0x55d609,null))['catch'](handleError(_0x55d609,null));};exports['describe']=function(_0x478673,_0x3aa597){return db['IntegrationReport']['describe']()[_0xd8d8('0x24')](respondWithResult(_0x3aa597,null))[_0xd8d8('0x41')](handleError(_0x3aa597,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d0585df..d81552e 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 _0xfb67=['util','../../config/logger','api','path','../../config/environment','./integrationReport.attributes','exports','lodash'];(function(_0x3ac79e,_0x5a1242){var _0x2b52f7=function(_0x3996fb){while(--_0x3996fb){_0x3ac79e['push'](_0x3ac79e['shift']());}};_0x2b52f7(++_0x5a1242);}(_0xfb67,0x167));var _0x7fb6=function(_0x476d66,_0x219d00){_0x476d66=_0x476d66-0x0;var _0x4f676b=_0xfb67[_0x476d66];return _0x4f676b;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var logger=require(_0x7fb6('0x2'))(_0x7fb6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fb6('0x4'));var rimraf=require('rimraf');var config=require(_0x7fb6('0x5'));var attributes=require(_0x7fb6('0x6'));module[_0x7fb6('0x7')]=function(_0x56c065,_0x5c6f58){return _0x56c065['define']('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcae3=['bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','moment'];(function(_0xad2c28,_0x25ffe3){var _0x4da897=function(_0x4c8224){while(--_0x4c8224){_0xad2c28['push'](_0xad2c28['shift']());}};_0x4da897(++_0x25ffe3);}(_0xcae3,0x81));var _0x3cae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcae3[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3cae('0x0'));var util=require(_0x3cae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3cae('0x2'));var BPromise=require(_0x3cae('0x3'));var rp=require(_0x3cae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cae('0x5'));var config=require(_0x3cae('0x6'));var attributes=require(_0x3cae('0x7'));module[_0x3cae('0x8')]=function(_0x15e724,_0x397a37){return _0x15e724[_0x3cae('0x9')](_0x3cae('0xa'),attributes,{'tableName':_0x3cae('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 276ae1c..68768d6 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x38eb9e,_0x440324){var _0x12b3b4=function(_0x1a5c71){while(--_0x1a5c71){_0x38eb9e['push'](_0x38eb9e['shift']());}};_0x12b3b4(++_0x440324);}(_0x57ca,0x108));var _0xa57c=function(_0x40092f,_0x55a6a5){_0x40092f=_0x40092f-0x0;var _0x283923=_0x57ca[_0x40092f];return _0x283923;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1728d1,_0x1994e3){var _0x3ca811=function(_0x5dd015){while(--_0x5dd015){_0x1728d1['push'](_0x1728d1['shift']());}};_0x3ca811(++_0x1994e3);}(_0xadb5,0xad));var _0x5adb=function(_0x562fca,_0x4de0f4){_0x562fca=_0x562fca-0x0;var _0x41cf50=_0xadb5[_0x562fca];return _0x41cf50;};'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']('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d21ddf5..258b37d 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 _0xabce=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','getIntervals','post','create'];(function(_0x5153df,_0x67bc3){var _0x55884e=function(_0x5d2eb1){while(--_0x5d2eb1){_0x5153df['push'](_0x5153df['shift']());}};_0x55884e(++_0x67bc3);}(_0xabce,0x103));var _0xeabc=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xabce[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./interval.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/sub_intervals',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xc')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0xc')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x12')](_0xeabc('0x13'),auth[_0xeabc('0x8')](),controller['update']);router[_0xeabc('0x14')](_0xeabc('0x13'),auth[_0xeabc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9ca0=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','index','get','/:id','isAuthenticated','show','getIntervals','create','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many'];(function(_0x129434,_0x578e13){var _0xead7a=function(_0x3f16f7){while(--_0x3f16f7){_0x129434['push'](_0x129434['shift']());}};_0xead7a(++_0x578e13);}(_0x9ca0,0x65));var _0x09ca=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x9ca0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x09ca('0x0'));var util=require(_0x09ca('0x1'));var path=require(_0x09ca('0x2'));var timeout=require('connect-timeout');var express=require(_0x09ca('0x3'));var router=express[_0x09ca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x09ca('0x5'));var interaction=require(_0x09ca('0x6'));var config=require('../../config/environment');var controller=require(_0x09ca('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x09ca('0x8')]);router[_0x09ca('0x9')](_0x09ca('0xa'),auth[_0x09ca('0xb')](),controller[_0x09ca('0xc')]);router['get']('/:id/sub_intervals',auth[_0x09ca('0xb')](),controller[_0x09ca('0xd')]);router['post']('/',auth[_0x09ca('0xb')](),controller[_0x09ca('0xe')]);router[_0x09ca('0xf')](_0x09ca('0x10'),auth[_0x09ca('0xb')](),controller[_0x09ca('0x11')]);router['post'](_0x09ca('0x12'),auth[_0x09ca('0xb')](),controller['addIntervals']);router[_0x09ca('0x13')]('/:id',auth[_0x09ca('0xb')](),controller[_0x09ca('0x14')]);router[_0x09ca('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x09ca('0x16')]);module[_0x09ca('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d2885c4..11335e7 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 _0x9f96=['sequelize','exports','STRING'];(function(_0x269f02,_0x224371){var _0x2c8ebf=function(_0x243f81){while(--_0x243f81){_0x269f02['push'](_0x269f02['shift']());}};_0x2c8ebf(++_0x224371);}(_0x9f96,0x156));var _0x69f9=function(_0x57e79d,_0x51aefb){_0x57e79d=_0x57e79d-0x0;var _0x366916=_0x9f96[_0x57e79d];return _0x366916;};'use strict';var Sequelize=require(_0x69f9('0x0'));module[_0x69f9('0x1')]={'name':{'type':Sequelize[_0x69f9('0x2')]},'description':{'type':Sequelize[_0x69f9('0x2')]},'interval':{'type':Sequelize[_0x69f9('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7e8d=['STRING','sequelize'];(function(_0x598c1a,_0x3f3748){var _0x4cce55=function(_0x11220d){while(--_0x11220d){_0x598c1a['push'](_0x598c1a['shift']());}};_0x4cce55(++_0x3f3748);}(_0x7e8d,0x131));var _0xd7e8=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x7e8d[_0x383356];return _0x32ee5a;};'use strict';var Sequelize=require(_0xd7e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7e8('0x1')]},'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 c6cd74c..9a60dd7 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 _0x8dc9=['sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','IntervalId','getIntervals','findOne','filter','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Intervals','UserProfileResource','error','stack','name','send','Interval','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x8dc9,0x74));var _0x98dc=function(_0x4a171f,_0x2fc4c4){_0x4a171f=_0x4a171f-0x0;var _0x36777e=_0x8dc9[_0x4a171f];return _0x36777e;};'use strict';var emlformat=require(_0x98dc('0x0'));var rimraf=require(_0x98dc('0x1'));var zipdir=require(_0x98dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98dc('0x3'));var moment=require(_0x98dc('0x4'));var BPromise=require(_0x98dc('0x5'));var Mustache=require(_0x98dc('0x6'));var util=require(_0x98dc('0x7'));var path=require(_0x98dc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98dc('0x9'));var fs=require('fs');var fs_extra=require(_0x98dc('0xa'));var _=require('lodash');var squel=require(_0x98dc('0xb'));var crypto=require('crypto');var jsforce=require(_0x98dc('0xc'));var deskjs=require(_0x98dc('0xd'));var toCsv=require(_0x98dc('0xe'));var querystring=require(_0x98dc('0xf'));var Papa=require(_0x98dc('0x10'));var Redis=require(_0x98dc('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x98dc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98dc('0x13'));var utils=require(_0x98dc('0x14'));var config=require(_0x98dc('0x15'));var licenseUtil=require(_0x98dc('0x16'));var db=require(_0x98dc('0x17'))['db'];var extensions=require(_0x98dc('0x18'));function respondWithStatusCode(_0x1342dc,_0x30eede){_0x30eede=_0x30eede||0xcc;return function(_0xd6ab1a){if(_0xd6ab1a){return _0x1342dc[_0x98dc('0x19')](_0x30eede);}return _0x1342dc[_0x98dc('0x1a')](_0x30eede)[_0x98dc('0x1b')]();};}function respondWithResult(_0x2cf262,_0xffbeb0){_0xffbeb0=_0xffbeb0||0xc8;return function(_0x3cf624){if(_0x3cf624){return _0x2cf262['status'](_0xffbeb0)[_0x98dc('0x1c')](_0x3cf624);}};}function respondWithFilteredResult(_0x13faa8,_0x57a94d){return function(_0x34b8c4){if(_0x34b8c4){var _0x15aebf=typeof _0x57a94d[_0x98dc('0x1d')]===_0x98dc('0x1e')&&typeof _0x57a94d[_0x98dc('0x1f')]===_0x98dc('0x1e');var _0x26f5f5=_0x34b8c4[_0x98dc('0x20')];var _0x458018=_0x15aebf?0x0:_0x57a94d[_0x98dc('0x1d')];var _0x1a3a19=_0x15aebf?_0x34b8c4[_0x98dc('0x20')]:_0x57a94d[_0x98dc('0x1d')]+_0x57a94d[_0x98dc('0x1f')];var _0xc3127b;if(_0x1a3a19>=_0x26f5f5){_0x1a3a19=_0x26f5f5;_0xc3127b=0xc8;}else{_0xc3127b=0xce;}_0x13faa8[_0x98dc('0x1a')](_0xc3127b);return _0x13faa8[_0x98dc('0x21')](_0x98dc('0x22'),_0x458018+'-'+_0x1a3a19+'/'+_0x26f5f5)[_0x98dc('0x1c')](_0x34b8c4);}return null;};}function patchUpdates(_0x15f2c2){return function(_0x1c8dcc){try{jsonpatch[_0x98dc('0x23')](_0x1c8dcc,_0x15f2c2,!![]);}catch(_0x561335){return BPromise['reject'](_0x561335);}return _0x1c8dcc['save']();};}function saveUpdates(_0x53db78,_0x174216){return function(_0x4d733d){if(_0x4d733d){return _0x4d733d['update'](_0x53db78)[_0x98dc('0x24')](function(_0x4360d1){return _0x4360d1;});}return null;};}function removeEntity(_0x9b6f57,_0x4f27c2){return function(_0x3cb4fe){if(_0x3cb4fe){return _0x3cb4fe['destroy']()[_0x98dc('0x24')](function(){var _0x5a2a83=_0x3cb4fe[_0x98dc('0x25')]({'plain':!![]});var _0x2aa28f=_0x98dc('0x26');return db[_0x98dc('0x27')]['destroy']({'where':{'type':_0x2aa28f,'resourceId':_0x5a2a83['id']}})[_0x98dc('0x24')](function(){return _0x3cb4fe;});})[_0x98dc('0x24')](function(){_0x9b6f57[_0x98dc('0x1a')](0xcc)[_0x98dc('0x1b')]();});}};}function handleEntityNotFound(_0x512480,_0x42d6b2){return function(_0x26b580){if(!_0x26b580){_0x512480['sendStatus'](0x194);}return _0x26b580;};}function handleError(_0x2ffb48,_0x3e35c0){_0x3e35c0=_0x3e35c0||0x1f4;return function(_0x183251){logger[_0x98dc('0x28')](_0x183251[_0x98dc('0x29')]);if(_0x183251[_0x98dc('0x2a')]){delete _0x183251[_0x98dc('0x2a')];}_0x2ffb48['status'](_0x3e35c0)[_0x98dc('0x2b')](_0x183251);};}exports['index']=function(_0x1635ed,_0x1f265c){var _0x129004={},_0x188aef={},_0x3c618e={'count':0x0,'rows':[]};var _0x4b0193=_['map'](db[_0x98dc('0x2c')][_0x98dc('0x2d')],function(_0x328a6c){return{'name':_0x328a6c['fieldName'],'type':_0x328a6c[_0x98dc('0x2e')][_0x98dc('0x2f')]};});_0x188aef['model']=_[_0x98dc('0x30')](_0x4b0193,_0x98dc('0x2a'));_0x188aef[_0x98dc('0x31')]=_[_0x98dc('0x32')](_0x1635ed[_0x98dc('0x31')]);_0x188aef[_0x98dc('0x33')]=_[_0x98dc('0x34')](_0x188aef['model'],_0x188aef[_0x98dc('0x31')]);_0x129004['attributes']=_[_0x98dc('0x34')](_0x188aef[_0x98dc('0x35')],qs[_0x98dc('0x36')](_0x1635ed['query'][_0x98dc('0x36')]));_0x129004[_0x98dc('0x37')]=_0x129004[_0x98dc('0x37')][_0x98dc('0x38')]?_0x129004['attributes']:_0x188aef[_0x98dc('0x35')];if(!_0x1635ed[_0x98dc('0x31')][_0x98dc('0x39')](_0x98dc('0x3a'))){_0x129004[_0x98dc('0x1f')]=qs['limit'](_0x1635ed[_0x98dc('0x31')][_0x98dc('0x1f')]);_0x129004[_0x98dc('0x1d')]=qs[_0x98dc('0x1d')](_0x1635ed[_0x98dc('0x31')][_0x98dc('0x1d')]);}_0x129004[_0x98dc('0x3b')]=qs[_0x98dc('0x3c')](_0x1635ed[_0x98dc('0x31')][_0x98dc('0x3c')]);_0x129004[_0x98dc('0x3d')]=qs['filters'](_[_0x98dc('0x3e')](_0x1635ed['query'],_0x188aef[_0x98dc('0x33')]),_0x4b0193);if(_0x1635ed[_0x98dc('0x31')]['filter']){_0x129004[_0x98dc('0x3d')]=_[_0x98dc('0x3f')](_0x129004['where'],{'$or':_['map'](_0x4b0193,function(_0x515062){if(_0x515062['type']!==_0x98dc('0x40')){var _0x5c6096={};_0x5c6096[_0x515062[_0x98dc('0x2a')]]={'$like':'%'+_0x1635ed[_0x98dc('0x31')]['filter']+'%'};return _0x5c6096;}})});}_0x129004=_['merge']({},_0x129004,_0x1635ed[_0x98dc('0x41')]);var _0x3e1ee8={'where':_0x129004[_0x98dc('0x3d')]};return db['Interval'][_0x98dc('0x20')](_0x3e1ee8)[_0x98dc('0x24')](function(_0x265816){_0x3c618e['count']=_0x265816;if(_0x1635ed['query'][_0x98dc('0x42')]){_0x129004[_0x98dc('0x43')]=[{'all':!![]}];}return db[_0x98dc('0x2c')][_0x98dc('0x44')](_0x129004);})[_0x98dc('0x24')](function(_0x26b1d4){_0x3c618e['rows']=_0x26b1d4;return _0x3c618e;})['then'](respondWithFilteredResult(_0x1f265c,_0x129004))['catch'](handleError(_0x1f265c,null));};exports[_0x98dc('0x45')]=function(_0x3d61bf,_0x50c0df){var _0x4d985d={'raw':!![],'where':{'id':_0x3d61bf[_0x98dc('0x46')]['id']}},_0x59fa38={};_0x59fa38['model']=_['keys'](db[_0x98dc('0x2c')][_0x98dc('0x2d')]);_0x59fa38[_0x98dc('0x31')]=_[_0x98dc('0x32')](_0x3d61bf[_0x98dc('0x31')]);_0x59fa38[_0x98dc('0x33')]=_[_0x98dc('0x34')](_0x59fa38[_0x98dc('0x35')],_0x59fa38['query']);_0x4d985d['attributes']=_[_0x98dc('0x34')](_0x59fa38[_0x98dc('0x35')],qs[_0x98dc('0x36')](_0x3d61bf[_0x98dc('0x31')][_0x98dc('0x36')]));_0x4d985d[_0x98dc('0x37')]=_0x4d985d['attributes']['length']?_0x4d985d[_0x98dc('0x37')]:_0x59fa38[_0x98dc('0x35')];if(_0x3d61bf['query'][_0x98dc('0x42')]){_0x4d985d[_0x98dc('0x43')]=[{'all':!![]}];}_0x4d985d=_[_0x98dc('0x3f')]({},_0x4d985d,_0x3d61bf[_0x98dc('0x41')]);return db[_0x98dc('0x2c')][_0x98dc('0x47')](_0x4d985d)['then'](handleEntityNotFound(_0x50c0df,null))[_0x98dc('0x24')](respondWithResult(_0x50c0df,null))['catch'](handleError(_0x50c0df,null));};exports['create']=function(_0x5f34f5,_0x296733){return db['Interval'][_0x98dc('0x48')](_0x5f34f5[_0x98dc('0x49')],{})['then'](function(_0x373f46){var _0x59f44e=_0x5f34f5[_0x98dc('0x4a')]['get']({'plain':!![]});if(!_0x59f44e)throw new Error(_0x98dc('0x4b'));if(_0x59f44e['role']===_0x98dc('0x4a')){var _0x3fe8ff=_0x373f46[_0x98dc('0x25')]({'plain':!![]});var _0xd68bb9=_0x98dc('0x26');return db[_0x98dc('0x4c')][_0x98dc('0x47')]({'where':{'name':_0xd68bb9,'userProfileId':_0x59f44e['userProfileId']},'raw':!![]})['then'](function(_0x952cf3){if(_0x952cf3&&_0x952cf3[_0x98dc('0x4d')]===0x0){return db[_0x98dc('0x27')][_0x98dc('0x48')]({'name':_0x3fe8ff[_0x98dc('0x2a')],'resourceId':_0x3fe8ff['id'],'type':_0x952cf3['name'],'sectionId':_0x952cf3['id']},{})['then'](function(){return _0x373f46;});}else{return _0x373f46;}})[_0x98dc('0x4e')](function(_0x54e46b){logger['error'](_0x98dc('0x4f'),_0x54e46b);throw _0x54e46b;});}return _0x373f46;})[_0x98dc('0x24')](respondWithResult(_0x296733,0xc9))[_0x98dc('0x4e')](handleError(_0x296733,null));};exports['update']=function(_0x4e5dac,_0x1985e9){if(_0x4e5dac['body']['id']){delete _0x4e5dac[_0x98dc('0x49')]['id'];}return db[_0x98dc('0x2c')][_0x98dc('0x47')]({'where':{'id':_0x4e5dac[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x1985e9,null))['then'](saveUpdates(_0x4e5dac['body'],null))[_0x98dc('0x24')](respondWithResult(_0x1985e9,null))[_0x98dc('0x4e')](handleError(_0x1985e9,null));};exports[_0x98dc('0x50')]=function(_0x3d1e82,_0x526191){return db[_0x98dc('0x2c')][_0x98dc('0x47')]({'where':{'id':_0x3d1e82[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x526191,null))[_0x98dc('0x24')](removeEntity(_0x526191,null))[_0x98dc('0x4e')](handleError(_0x526191,null));};exports['addInterval']=function(_0x5067f0,_0x46221b,_0x34c849){if(_0x5067f0[_0x98dc('0x49')]['id']){delete _0x5067f0[_0x98dc('0x49')]['id'];}return db[_0x98dc('0x2c')][_0x98dc('0x47')]({'where':{'id':_0x5067f0[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x46221b,null))['then'](function(_0x220b88){if(_0x220b88){_0x5067f0[_0x98dc('0x49')][_0x98dc('0x51')]=_0x220b88['id'];return db['Interval'][_0x98dc('0x48')](_0x5067f0['body']);}})[_0x98dc('0x24')](respondWithResult(_0x46221b,null))[_0x98dc('0x4e')](handleError(_0x46221b,null));};exports[_0x98dc('0x52')]=function(_0x4c23b3,_0x440055,_0x382c74){var _0x375c2f={};var _0x1deaf6={};var _0x3c82e2;var _0xfb160f;return db[_0x98dc('0x2c')][_0x98dc('0x53')]({'where':{'id':_0x4c23b3[_0x98dc('0x46')]['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x440055,null))[_0x98dc('0x24')](function(_0xc28a4){if(_0xc28a4){_0x3c82e2=_0xc28a4;_0x1deaf6['model']=_[_0x98dc('0x32')](db[_0x98dc('0x2c')][_0x98dc('0x2d')]);_0x1deaf6[_0x98dc('0x31')]=_[_0x98dc('0x32')](_0x4c23b3['query']);_0x1deaf6[_0x98dc('0x33')]=_[_0x98dc('0x34')](_0x1deaf6['model'],_0x1deaf6[_0x98dc('0x31')]);_0x375c2f[_0x98dc('0x37')]=_['intersection'](_0x1deaf6['model'],qs['fields'](_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x36')]));_0x375c2f[_0x98dc('0x37')]=_0x375c2f['attributes'][_0x98dc('0x38')]?_0x375c2f[_0x98dc('0x37')]:_0x1deaf6[_0x98dc('0x35')];_0x375c2f[_0x98dc('0x3b')]=qs[_0x98dc('0x3c')](_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x3c')]);_0x375c2f[_0x98dc('0x3d')]=qs[_0x98dc('0x33')](_[_0x98dc('0x3e')](_0x4c23b3[_0x98dc('0x31')],_0x1deaf6['filters']));if(_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x54')]){_0x375c2f[_0x98dc('0x3d')]=_['merge'](_0x375c2f[_0x98dc('0x3d')],{'$or':_[_0x98dc('0x30')](_0x375c2f[_0x98dc('0x37')],function(_0x4ef1ef){var _0x1fdc5a={};_0x1fdc5a[_0x4ef1ef]={'$like':'%'+_0x4c23b3['query'][_0x98dc('0x54')]+'%'};return _0x1fdc5a;})});}_0x375c2f=_[_0x98dc('0x3f')]({},_0x375c2f,_0x4c23b3[_0x98dc('0x41')]);return _0x3c82e2[_0x98dc('0x52')](_0x375c2f);}})[_0x98dc('0x24')](function(_0x241fd2){if(_0x241fd2){_0xfb160f=_0x241fd2[_0x98dc('0x38')];if(!_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x39')](_0x98dc('0x3a'))){_0x375c2f['limit']=qs[_0x98dc('0x1f')](_0x4c23b3[_0x98dc('0x31')]['limit']);_0x375c2f[_0x98dc('0x1d')]=qs[_0x98dc('0x1d')](_0x4c23b3[_0x98dc('0x31')][_0x98dc('0x1d')]);}return _0x3c82e2['getIntervals'](_0x375c2f);}})[_0x98dc('0x24')](function(_0x15dd1c){if(_0x15dd1c){return _0x15dd1c?{'count':_0xfb160f,'rows':_0x15dd1c}:null;}})[_0x98dc('0x24')](respondWithResult(_0x440055,null))['catch'](handleError(_0x440055,null));};exports[_0x98dc('0x55')]=function(_0x234666,_0x5349a2,_0x252924){return db['Interval']['findOne']({'where':{'id':_0x234666['params']['id']}})[_0x98dc('0x24')](handleEntityNotFound(_0x5349a2,null))[_0x98dc('0x24')](function(_0x323c75){if(_0x323c75){return db['sequelize'][_0x98dc('0x56')](function(_0x5c3f37){return db[_0x98dc('0x2c')][_0x98dc('0x50')]({'where':{'IntervalId':_0x234666['params']['id']},'transaction':_0x5c3f37})[_0x98dc('0x24')](function(_0x5ecafb){var _0x5e0be7=_[_0x98dc('0x30')](_0x234666[_0x98dc('0x49')],function(_0x142f8f){delete _0x142f8f['id'];_0x142f8f[_0x98dc('0x51')]=_0x234666[_0x98dc('0x46')]['id'];return _0x142f8f;});return db[_0x98dc('0x2c')][_0x98dc('0x57')](_0x5e0be7,{'transaction':_0x5c3f37});});})[_0x98dc('0x24')](function(){return db[_0x98dc('0x2c')][_0x98dc('0x44')]({'where':{'IntervalId':_0x234666[_0x98dc('0x46')]['id']}});});}})[_0x98dc('0x24')](respondWithResult(_0x5349a2,null))[_0x98dc('0x4e')](handleError(_0x5349a2,null));}; \ No newline at end of file +var _0x6f1e=['send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','intersection','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','sort','addIntervals','sequelize','transaction','bulkCreate','eml-format','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','get','Intervals','sendStatus','stack','name'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x6f1e,0x1ed));var _0xe6f1=function(_0x2ac78e,_0xf78a1b){_0x2ac78e=_0x2ac78e-0x0;var _0x436c2b=_0x6f1e[_0x2ac78e];return _0x436c2b;};'use strict';var emlformat=require(_0xe6f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6f1('0x1'));var BPromise=require(_0xe6f1('0x2'));var Mustache=require(_0xe6f1('0x3'));var util=require('util');var path=require(_0xe6f1('0x4'));var sox=require('sox');var csv=require(_0xe6f1('0x5'));var ejs=require(_0xe6f1('0x6'));var fs=require('fs');var fs_extra=require(_0xe6f1('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe6f1('0x8'));var jsforce=require(_0xe6f1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe6f1('0x5'));var querystring=require(_0xe6f1('0xa'));var Papa=require('papaparse');var Redis=require(_0xe6f1('0xb'));var authService=require(_0xe6f1('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe6f1('0xd'));var hardwareService=require(_0xe6f1('0xe'));var logger=require(_0xe6f1('0xf'))(_0xe6f1('0x10'));var utils=require(_0xe6f1('0x11'));var config=require(_0xe6f1('0x12'));var licenseUtil=require(_0xe6f1('0x13'));var db=require(_0xe6f1('0x14'))['db'];var extensions=require(_0xe6f1('0x15'));function respondWithStatusCode(_0x3f503e,_0x56da8e){_0x56da8e=_0x56da8e||0xcc;return function(_0x4a7d8f){if(_0x4a7d8f){return _0x3f503e['sendStatus'](_0x56da8e);}return _0x3f503e[_0xe6f1('0x16')](_0x56da8e)[_0xe6f1('0x17')]();};}function respondWithResult(_0x22ca91,_0x24dcd7){_0x24dcd7=_0x24dcd7||0xc8;return function(_0xc58538){if(_0xc58538){return _0x22ca91[_0xe6f1('0x16')](_0x24dcd7)['json'](_0xc58538);}};}function respondWithFilteredResult(_0x44f961,_0x2f70c4){return function(_0x4573eb){if(_0x4573eb){var _0x202a8f=typeof _0x2f70c4[_0xe6f1('0x18')]===_0xe6f1('0x19')&&typeof _0x2f70c4[_0xe6f1('0x1a')]===_0xe6f1('0x19');var _0x2ed954=_0x4573eb[_0xe6f1('0x1b')];var _0x488e5c=_0x202a8f?0x0:_0x2f70c4['offset'];var _0x3bb7ce=_0x202a8f?_0x4573eb['count']:_0x2f70c4[_0xe6f1('0x18')]+_0x2f70c4['limit'];var _0x355645;if(_0x3bb7ce>=_0x2ed954){_0x3bb7ce=_0x2ed954;_0x355645=0xc8;}else{_0x355645=0xce;}_0x44f961[_0xe6f1('0x16')](_0x355645);return _0x44f961[_0xe6f1('0x1c')]('Content-Range',_0x488e5c+'-'+_0x3bb7ce+'/'+_0x2ed954)[_0xe6f1('0x1d')](_0x4573eb);}return null;};}function patchUpdates(_0x731f8a){return function(_0x344f11){try{jsonpatch[_0xe6f1('0x1e')](_0x344f11,_0x731f8a,!![]);}catch(_0x46e3a4){return BPromise[_0xe6f1('0x1f')](_0x46e3a4);}return _0x344f11[_0xe6f1('0x20')]();};}function saveUpdates(_0x2087ce,_0xda5894){return function(_0x470190){if(_0x470190){return _0x470190[_0xe6f1('0x21')](_0x2087ce)['then'](function(_0x4ca89a){return _0x4ca89a;});}return null;};}function removeEntity(_0x12cd4a,_0x3ca46a){return function(_0x5176ea){if(_0x5176ea){return _0x5176ea[_0xe6f1('0x22')]()[_0xe6f1('0x23')](function(){var _0x548bff=_0x5176ea[_0xe6f1('0x24')]({'plain':!![]});var _0x104e24=_0xe6f1('0x25');return db['UserProfileResource'][_0xe6f1('0x22')]({'where':{'type':_0x104e24,'resourceId':_0x548bff['id']}})['then'](function(){return _0x5176ea;});})[_0xe6f1('0x23')](function(){_0x12cd4a[_0xe6f1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8499,_0x2b66b3){return function(_0x1e400c){if(!_0x1e400c){_0x4e8499[_0xe6f1('0x26')](0x194);}return _0x1e400c;};}function handleError(_0xe14449,_0x3f8fc8){_0x3f8fc8=_0x3f8fc8||0x1f4;return function(_0x5e925c){logger['error'](_0x5e925c[_0xe6f1('0x27')]);if(_0x5e925c[_0xe6f1('0x28')]){delete _0x5e925c[_0xe6f1('0x28')];}_0xe14449['status'](_0x3f8fc8)[_0xe6f1('0x29')](_0x5e925c);};}exports[_0xe6f1('0x2a')]=function(_0xd857ac,_0x35f099){var _0xe1aa1e={},_0x3425c2={},_0x270e95={'count':0x0,'rows':[]};var _0x107fed=_[_0xe6f1('0x2b')](db[_0xe6f1('0x2c')][_0xe6f1('0x2d')],function(_0x13fe84){return{'name':_0x13fe84[_0xe6f1('0x2e')],'type':_0x13fe84[_0xe6f1('0x2f')][_0xe6f1('0x30')]};});_0x3425c2[_0xe6f1('0x31')]=_['map'](_0x107fed,_0xe6f1('0x28'));_0x3425c2[_0xe6f1('0x32')]=_[_0xe6f1('0x33')](_0xd857ac[_0xe6f1('0x32')]);_0x3425c2[_0xe6f1('0x34')]=_['intersection'](_0x3425c2[_0xe6f1('0x31')],_0x3425c2[_0xe6f1('0x32')]);_0xe1aa1e['attributes']=_['intersection'](_0x3425c2['model'],qs[_0xe6f1('0x35')](_0xd857ac[_0xe6f1('0x32')][_0xe6f1('0x35')]));_0xe1aa1e[_0xe6f1('0x36')]=_0xe1aa1e[_0xe6f1('0x36')][_0xe6f1('0x37')]?_0xe1aa1e['attributes']:_0x3425c2[_0xe6f1('0x31')];if(!_0xd857ac[_0xe6f1('0x32')][_0xe6f1('0x38')](_0xe6f1('0x39'))){_0xe1aa1e[_0xe6f1('0x1a')]=qs[_0xe6f1('0x1a')](_0xd857ac['query']['limit']);_0xe1aa1e[_0xe6f1('0x18')]=qs[_0xe6f1('0x18')](_0xd857ac[_0xe6f1('0x32')][_0xe6f1('0x18')]);}_0xe1aa1e[_0xe6f1('0x3a')]=qs['sort'](_0xd857ac[_0xe6f1('0x32')]['sort']);_0xe1aa1e[_0xe6f1('0x3b')]=qs['filters'](_[_0xe6f1('0x3c')](_0xd857ac[_0xe6f1('0x32')],_0x3425c2['filters']),_0x107fed);if(_0xd857ac[_0xe6f1('0x32')][_0xe6f1('0x3d')]){_0xe1aa1e[_0xe6f1('0x3b')]=_[_0xe6f1('0x3e')](_0xe1aa1e[_0xe6f1('0x3b')],{'$or':_['map'](_0x107fed,function(_0x142fb6){if(_0x142fb6[_0xe6f1('0x2f')]!==_0xe6f1('0x3f')){var _0x306102={};_0x306102[_0x142fb6[_0xe6f1('0x28')]]={'$like':'%'+_0xd857ac[_0xe6f1('0x32')]['filter']+'%'};return _0x306102;}})});}_0xe1aa1e=_['merge']({},_0xe1aa1e,_0xd857ac[_0xe6f1('0x40')]);var _0x3b3fc7={'where':_0xe1aa1e[_0xe6f1('0x3b')]};return db['Interval'][_0xe6f1('0x1b')](_0x3b3fc7)[_0xe6f1('0x23')](function(_0x2ae51c){_0x270e95[_0xe6f1('0x1b')]=_0x2ae51c;if(_0xd857ac[_0xe6f1('0x32')]['includeAll']){_0xe1aa1e[_0xe6f1('0x41')]=[{'all':!![]}];}return db[_0xe6f1('0x2c')][_0xe6f1('0x42')](_0xe1aa1e);})[_0xe6f1('0x23')](function(_0x105b5e){_0x270e95['rows']=_0x105b5e;return _0x270e95;})[_0xe6f1('0x23')](respondWithFilteredResult(_0x35f099,_0xe1aa1e))[_0xe6f1('0x43')](handleError(_0x35f099,null));};exports[_0xe6f1('0x44')]=function(_0x29a368,_0x634eca){var _0x14336f={'raw':!![],'where':{'id':_0x29a368['params']['id']}},_0x46aa47={};_0x46aa47[_0xe6f1('0x31')]=_['keys'](db[_0xe6f1('0x2c')]['rawAttributes']);_0x46aa47[_0xe6f1('0x32')]=_[_0xe6f1('0x33')](_0x29a368[_0xe6f1('0x32')]);_0x46aa47[_0xe6f1('0x34')]=_[_0xe6f1('0x45')](_0x46aa47[_0xe6f1('0x31')],_0x46aa47[_0xe6f1('0x32')]);_0x14336f[_0xe6f1('0x36')]=_['intersection'](_0x46aa47['model'],qs[_0xe6f1('0x35')](_0x29a368[_0xe6f1('0x32')][_0xe6f1('0x35')]));_0x14336f[_0xe6f1('0x36')]=_0x14336f[_0xe6f1('0x36')][_0xe6f1('0x37')]?_0x14336f[_0xe6f1('0x36')]:_0x46aa47[_0xe6f1('0x31')];if(_0x29a368[_0xe6f1('0x32')][_0xe6f1('0x46')]){_0x14336f[_0xe6f1('0x41')]=[{'all':!![]}];}_0x14336f=_[_0xe6f1('0x3e')]({},_0x14336f,_0x29a368[_0xe6f1('0x40')]);return db[_0xe6f1('0x2c')][_0xe6f1('0x47')](_0x14336f)[_0xe6f1('0x23')](handleEntityNotFound(_0x634eca,null))[_0xe6f1('0x23')](respondWithResult(_0x634eca,null))['catch'](handleError(_0x634eca,null));};exports[_0xe6f1('0x48')]=function(_0x468729,_0x29b748){return db['Interval'][_0xe6f1('0x48')](_0x468729[_0xe6f1('0x49')],{})[_0xe6f1('0x23')](function(_0x34b088){var _0x3d51ba=_0x468729[_0xe6f1('0x4a')][_0xe6f1('0x24')]({'plain':!![]});if(!_0x3d51ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d51ba[_0xe6f1('0x4b')]===_0xe6f1('0x4a')){var _0x2dcce7=_0x34b088['get']({'plain':!![]});var _0xdcdaa4=_0xe6f1('0x25');return db[_0xe6f1('0x4c')][_0xe6f1('0x47')]({'where':{'name':_0xdcdaa4,'userProfileId':_0x3d51ba[_0xe6f1('0x4d')]},'raw':!![]})[_0xe6f1('0x23')](function(_0x131e51){if(_0x131e51&&_0x131e51['autoAssociation']===0x0){return db[_0xe6f1('0x4e')][_0xe6f1('0x48')]({'name':_0x2dcce7[_0xe6f1('0x28')],'resourceId':_0x2dcce7['id'],'type':_0x131e51[_0xe6f1('0x28')],'sectionId':_0x131e51['id']},{})[_0xe6f1('0x23')](function(){return _0x34b088;});}else{return _0x34b088;}})[_0xe6f1('0x43')](function(_0x1bdab1){logger[_0xe6f1('0x4f')](_0xe6f1('0x50'),_0x1bdab1);throw _0x1bdab1;});}return _0x34b088;})[_0xe6f1('0x23')](respondWithResult(_0x29b748,0xc9))['catch'](handleError(_0x29b748,null));};exports['update']=function(_0x57ee8c,_0x40dfe6){if(_0x57ee8c[_0xe6f1('0x49')]['id']){delete _0x57ee8c[_0xe6f1('0x49')]['id'];}return db[_0xe6f1('0x2c')][_0xe6f1('0x47')]({'where':{'id':_0x57ee8c[_0xe6f1('0x51')]['id']}})[_0xe6f1('0x23')](handleEntityNotFound(_0x40dfe6,null))[_0xe6f1('0x23')](saveUpdates(_0x57ee8c[_0xe6f1('0x49')],null))[_0xe6f1('0x23')](respondWithResult(_0x40dfe6,null))[_0xe6f1('0x43')](handleError(_0x40dfe6,null));};exports['destroy']=function(_0x323931,_0x32efbd){return db[_0xe6f1('0x2c')][_0xe6f1('0x47')]({'where':{'id':_0x323931[_0xe6f1('0x51')]['id']}})[_0xe6f1('0x23')](handleEntityNotFound(_0x32efbd,null))['then'](removeEntity(_0x32efbd,null))[_0xe6f1('0x43')](handleError(_0x32efbd,null));};exports['addInterval']=function(_0x2e022a,_0x329a3d,_0x29543a){if(_0x2e022a[_0xe6f1('0x49')]['id']){delete _0x2e022a[_0xe6f1('0x49')]['id'];}return db[_0xe6f1('0x2c')][_0xe6f1('0x47')]({'where':{'id':_0x2e022a[_0xe6f1('0x51')]['id']}})['then'](handleEntityNotFound(_0x329a3d,null))['then'](function(_0x18fab7){if(_0x18fab7){_0x2e022a[_0xe6f1('0x49')][_0xe6f1('0x52')]=_0x18fab7['id'];return db['Interval'][_0xe6f1('0x48')](_0x2e022a[_0xe6f1('0x49')]);}})['then'](respondWithResult(_0x329a3d,null))[_0xe6f1('0x43')](handleError(_0x329a3d,null));};exports[_0xe6f1('0x53')]=function(_0x24a4d2,_0x299b1f,_0x44f500){var _0x1400e9={};var _0x36eb62={};var _0x22d223;var _0x15d6e4;return db['Interval']['findOne']({'where':{'id':_0x24a4d2['params']['id']}})[_0xe6f1('0x23')](handleEntityNotFound(_0x299b1f,null))[_0xe6f1('0x23')](function(_0x53cfe6){if(_0x53cfe6){_0x22d223=_0x53cfe6;_0x36eb62[_0xe6f1('0x31')]=_[_0xe6f1('0x33')](db[_0xe6f1('0x2c')][_0xe6f1('0x2d')]);_0x36eb62[_0xe6f1('0x32')]=_['keys'](_0x24a4d2[_0xe6f1('0x32')]);_0x36eb62['filters']=_['intersection'](_0x36eb62[_0xe6f1('0x31')],_0x36eb62[_0xe6f1('0x32')]);_0x1400e9[_0xe6f1('0x36')]=_[_0xe6f1('0x45')](_0x36eb62[_0xe6f1('0x31')],qs['fields'](_0x24a4d2[_0xe6f1('0x32')][_0xe6f1('0x35')]));_0x1400e9[_0xe6f1('0x36')]=_0x1400e9[_0xe6f1('0x36')][_0xe6f1('0x37')]?_0x1400e9[_0xe6f1('0x36')]:_0x36eb62[_0xe6f1('0x31')];_0x1400e9['order']=qs[_0xe6f1('0x54')](_0x24a4d2[_0xe6f1('0x32')][_0xe6f1('0x54')]);_0x1400e9[_0xe6f1('0x3b')]=qs['filters'](_[_0xe6f1('0x3c')](_0x24a4d2[_0xe6f1('0x32')],_0x36eb62[_0xe6f1('0x34')]));if(_0x24a4d2[_0xe6f1('0x32')][_0xe6f1('0x3d')]){_0x1400e9[_0xe6f1('0x3b')]=_['merge'](_0x1400e9[_0xe6f1('0x3b')],{'$or':_['map'](_0x1400e9[_0xe6f1('0x36')],function(_0x39e73c){var _0xca996d={};_0xca996d[_0x39e73c]={'$like':'%'+_0x24a4d2[_0xe6f1('0x32')][_0xe6f1('0x3d')]+'%'};return _0xca996d;})});}_0x1400e9=_[_0xe6f1('0x3e')]({},_0x1400e9,_0x24a4d2[_0xe6f1('0x40')]);return _0x22d223['getIntervals'](_0x1400e9);}})[_0xe6f1('0x23')](function(_0x1f7b7f){if(_0x1f7b7f){_0x15d6e4=_0x1f7b7f[_0xe6f1('0x37')];if(!_0x24a4d2[_0xe6f1('0x32')][_0xe6f1('0x38')](_0xe6f1('0x39'))){_0x1400e9[_0xe6f1('0x1a')]=qs[_0xe6f1('0x1a')](_0x24a4d2[_0xe6f1('0x32')]['limit']);_0x1400e9[_0xe6f1('0x18')]=qs[_0xe6f1('0x18')](_0x24a4d2[_0xe6f1('0x32')]['offset']);}return _0x22d223[_0xe6f1('0x53')](_0x1400e9);}})['then'](function(_0x1a1121){if(_0x1a1121){return _0x1a1121?{'count':_0x15d6e4,'rows':_0x1a1121}:null;}})[_0xe6f1('0x23')](respondWithResult(_0x299b1f,null))[_0xe6f1('0x43')](handleError(_0x299b1f,null));};exports[_0xe6f1('0x55')]=function(_0x145958,_0x41a317,_0x58a981){return db[_0xe6f1('0x2c')]['findOne']({'where':{'id':_0x145958[_0xe6f1('0x51')]['id']}})[_0xe6f1('0x23')](handleEntityNotFound(_0x41a317,null))[_0xe6f1('0x23')](function(_0x3e187e){if(_0x3e187e){return db[_0xe6f1('0x56')][_0xe6f1('0x57')](function(_0x4696e0){return db[_0xe6f1('0x2c')][_0xe6f1('0x22')]({'where':{'IntervalId':_0x145958[_0xe6f1('0x51')]['id']},'transaction':_0x4696e0})[_0xe6f1('0x23')](function(_0x45f3d9){var _0x430c29=_[_0xe6f1('0x2b')](_0x145958['body'],function(_0x442010){delete _0x442010['id'];_0x442010[_0xe6f1('0x52')]=_0x145958['params']['id'];return _0x442010;});return db[_0xe6f1('0x2c')][_0xe6f1('0x58')](_0x430c29,{'transaction':_0x4696e0});});})[_0xe6f1('0x23')](function(){return db[_0xe6f1('0x2c')][_0xe6f1('0x42')]({'where':{'IntervalId':_0x145958['params']['id']}});});}})['then'](respondWithResult(_0x41a317,null))['catch'](handleError(_0x41a317,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b9713e3..38bb313 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 _0xdb97=['ifTime','reduce','./interval.attributes','../../utils/iftime','exports','define','tools_intervals','rewrite','interval','string','then','all','map'];(function(_0x1beda4,_0x458db6){var _0x36912b=function(_0x3bba7d){while(--_0x3bba7d){_0x1beda4['push'](_0x1beda4['shift']());}};_0x36912b(++_0x458db6);}(_0xdb97,0x161));var _0x7db9=function(_0x163da0,_0x1215a6){_0x163da0=_0x163da0-0x0;var _0x6baea9=_0xdb97[_0x163da0];return _0x6baea9;};'use strict';var attributes=require(_0x7db9('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x7db9('0x1'))['iftime'];module[_0x7db9('0x2')]=function(_0x2fe5df){return _0x2fe5df[_0x7db9('0x3')]('Interval',attributes,{'tableName':_0x7db9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf2ca5c){extensions[_0x7db9('0x5')](_0x2fe5df,_0xf2ca5c);},'afterBulkCreate':function(_0x18dd89,_0x404f20,_0x413f9c){_0x413f9c();extensions[_0x7db9('0x5')](_0x2fe5df,_0x18dd89[0x0]);},'afterUpdate':function(_0x14fe34){extensions[_0x7db9('0x5')](_0x2fe5df,_0x14fe34);},'afterDestroy':function(_0x1cd43d){extensions[_0x7db9('0x5')](_0x2fe5df,_0x1cd43d);}},'instanceMethods':{'ifTime':function(_0x2d8d90=undefined,_0x4eb0b3=new Date()){if(typeof this[_0x7db9('0x6')]===_0x7db9('0x7')){return iftime(this['interval'],_0x2d8d90,_0x4eb0b3);}else{return this['getIntervals']()[_0x7db9('0x8')](function(_0x57b8ac){return Promise[_0x7db9('0x9')](_0x57b8ac[_0x7db9('0xa')](function(_0x2b4980){return _0x2b4980[_0x7db9('0xb')](_0x2d8d90,_0x4eb0b3);}));})[_0x7db9('0x8')](function(_0x37edee){return _0x37edee[_0x7db9('0xc')](function(_0xb92cfb,_0xe5b41e){return _0xb92cfb||_0xe5b41e;},![]);});}}}});}; \ No newline at end of file +var _0xddd9=['./interval.attributes','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','string','interval','getIntervals','then','all','map','ifTime','reduce'];(function(_0x283e61,_0x41d7b0){var _0x408da3=function(_0x2c7b93){while(--_0x2c7b93){_0x283e61['push'](_0x283e61['shift']());}};_0x408da3(++_0x41d7b0);}(_0xddd9,0x90));var _0x9ddd=function(_0x247f4a,_0x20627f){_0x247f4a=_0x247f4a-0x0;var _0x143124=_0xddd9[_0x247f4a];return _0x143124;};'use strict';var attributes=require(_0x9ddd('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x9ddd('0x1'))[_0x9ddd('0x2')];module[_0x9ddd('0x3')]=function(_0x37bade){return _0x37bade[_0x9ddd('0x4')](_0x9ddd('0x5'),attributes,{'tableName':_0x9ddd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x14860f){extensions[_0x9ddd('0x7')](_0x37bade,_0x14860f);},'afterBulkCreate':function(_0x44f7d8,_0x2effff,_0x578efd){_0x578efd();extensions[_0x9ddd('0x7')](_0x37bade,_0x44f7d8[0x0]);},'afterUpdate':function(_0x1024dd){extensions[_0x9ddd('0x7')](_0x37bade,_0x1024dd);},'afterDestroy':function(_0x1fdfd2){extensions[_0x9ddd('0x7')](_0x37bade,_0x1fdfd2);}},'instanceMethods':{'ifTime':function(_0xd5c326=undefined,_0x3b0c36=new Date()){if(typeof this['interval']===_0x9ddd('0x8')){return iftime(this[_0x9ddd('0x9')],_0xd5c326,_0x3b0c36);}else{return this[_0x9ddd('0xa')]()[_0x9ddd('0xb')](function(_0x507692){return Promise[_0x9ddd('0xc')](_0x507692[_0x9ddd('0xd')](function(_0xed3181){return _0xed3181[_0x9ddd('0xe')](_0xd5c326,_0x3b0c36);}));})[_0x9ddd('0xb')](function(_0x1349ec){return _0x1349ec[_0x9ddd('0xf')](function(_0x34e195,_0x40ee2d){return _0x34e195||_0x40ee2d;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 63a6263..726bb8b 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 _0x8315=['model','then','debug','stringify','error','message','ShowInterval','find','catch','findAll','ifTime','reduce','info','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime','resolve','lodash','../../utils/iftime','iftime','rpc','GetInterval','Interval','options','raw','where','attributes','limit','include','map'];(function(_0x3b37c1,_0x2644f6){var _0x5518c4=function(_0x358b96){while(--_0x358b96){_0x3b37c1['push'](_0x3b37c1['shift']());}};_0x5518c4(++_0x2644f6);}(_0x8315,0x1df));var _0x5831=function(_0x447d79,_0x11804f){_0x447d79=_0x447d79-0x0;var _0x41e536=_0x8315[_0x447d79];return _0x41e536;};'use strict';var _=require(_0x5831('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0x5831('0x1'))[_0x5831('0x2')];var logger=require('../../config/logger')(_0x5831('0x3'));exports[_0x5831('0x4')]=function(_0x2bdf59){var _0x4d1461=this;return new Promise(function(_0x353efd,_0x5d6bd3){return db[_0x5831('0x5')]['findAll']({'raw':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0x7')]===undefined?!![]:![]:!![],'where':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0x8')]||null:null,'attributes':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59['options'][_0x5831('0x9')]||null:null,'limit':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0xa')]||null:null,'include':_0x2bdf59[_0x5831('0x6')]?_0x2bdf59[_0x5831('0x6')][_0x5831('0xb')]?_[_0x5831('0xc')](_0x2bdf59[_0x5831('0x6')][_0x5831('0xb')],function(_0x426910){return{'model':db[_0x426910[_0x5831('0xd')]],'as':_0x426910['as'],'attributes':_0x426910[_0x5831('0x9')],'include':_0x426910[_0x5831('0xb')]?_[_0x5831('0xc')](_0x426910['include'],function(_0x5018ed){return{'model':db[_0x5018ed['model']],'as':_0x5018ed['as'],'attributes':_0x5018ed['attributes'],'include':_0x5018ed[_0x5831('0xb')]?_['map'](_0x5018ed[_0x5831('0xb')],function(_0x421d37){return{'model':db[_0x421d37['model']],'as':_0x421d37['as'],'attributes':_0x421d37[_0x5831('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5831('0xe')](function(_0x352d47){logger['info']('GetInterval',_0x2bdf59);logger[_0x5831('0xf')](_0x5831('0x4'),_0x2bdf59,JSON[_0x5831('0x10')](_0x352d47));_0x353efd(_0x352d47);})['catch'](function(_0x434626){logger[_0x5831('0x11')](_0x5831('0x4'),_0x434626[_0x5831('0x12')],_0x2bdf59);_0x5d6bd3(_0x4d1461[_0x5831('0x11')](0x1f4,_0x434626[_0x5831('0x12')]));});});};exports[_0x5831('0x13')]=function(_0x1d54cf){var _0x31ff6b=this;return new Promise(function(_0x2023c7,_0x2e4ba8){return db[_0x5831('0x5')][_0x5831('0x14')]({'raw':_0x1d54cf[_0x5831('0x6')]?_0x1d54cf[_0x5831('0x6')][_0x5831('0x7')]===undefined?!![]:![]:!![],'where':_0x1d54cf[_0x5831('0x6')]?_0x1d54cf[_0x5831('0x6')]['where']||null:null,'attributes':_0x1d54cf['options']?_0x1d54cf[_0x5831('0x6')][_0x5831('0x9')]||null:null,'include':_0x1d54cf[_0x5831('0x6')]?_0x1d54cf[_0x5831('0x6')][_0x5831('0xb')]?_[_0x5831('0xc')](_0x1d54cf[_0x5831('0x6')][_0x5831('0xb')],function(_0x15d8e2){return{'model':db[_0x15d8e2[_0x5831('0xd')]],'as':_0x15d8e2['as'],'attributes':_0x15d8e2[_0x5831('0x9')],'include':_0x15d8e2[_0x5831('0xb')]?_[_0x5831('0xc')](_0x15d8e2[_0x5831('0xb')],function(_0x51ab0f){return{'model':db[_0x51ab0f['model']],'as':_0x51ab0f['as'],'attributes':_0x51ab0f[_0x5831('0x9')],'include':_0x51ab0f[_0x5831('0xb')]?_[_0x5831('0xc')](_0x51ab0f[_0x5831('0xb')],function(_0x5dca0c){return{'model':db[_0x5dca0c[_0x5831('0xd')]],'as':_0x5dca0c['as'],'attributes':_0x5dca0c[_0x5831('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5831('0xe')](function(_0x4fdadf){logger['info']('ShowInterval',_0x1d54cf);logger[_0x5831('0xf')](_0x5831('0x13'),_0x1d54cf,JSON[_0x5831('0x10')](_0x4fdadf));_0x2023c7(_0x4fdadf);})[_0x5831('0x15')](function(_0x6ee4e7){logger[_0x5831('0x11')]('ShowInterval',_0x6ee4e7[_0x5831('0x12')],_0x1d54cf);_0x2e4ba8(_0x31ff6b['error'](0x1f4,_0x6ee4e7[_0x5831('0x12')]));});});};function checkArrayOfIntervals(_0x2b65a5,_0x4d3862){var _0x4aee11=[];return db[_0x5831('0x5')][_0x5831('0x16')]({'where':{'id':_0x2b65a5}})[_0x5831('0xe')](function(_0x18c280){_0x4aee11=_0x18c280;return Promise['all'](_0x4aee11[_0x5831('0xc')](function(_0x55f89b){return _0x55f89b[_0x5831('0x17')](_0x4d3862);}));})['then'](function(_0x143937){var _0x432c95=_0x143937[_0x5831('0x18')](function(_0x5b1304,_0x3861f9){return _0x5b1304||_0x3861f9;},![]);logger[_0x5831('0x19')](util[_0x5831('0x1a')](_0x5831('0x1b'),_0x4aee11[_0x5831('0xc')](function(_0x113ddc){return _0x113ddc[_0x5831('0x1c')];})[_0x5831('0x1d')](',\x20'),_0x4aee11[_0x5831('0xc')](function(_0x22189d){return _0x22189d['id'];})[_0x5831('0x1d')](',\x20')));return _0x432c95;});}function checkSingleInterval(_0x7d885b,_0x4f4216){return db[_0x5831('0x5')][_0x5831('0x1e')](_0x7d885b)[_0x5831('0xe')](function(_0x10a4e9){if(_0x10a4e9){logger[_0x5831('0x19')](util['format'](_0x5831('0x1f'),_0x10a4e9['name'],_0x10a4e9['id']));return _0x10a4e9[_0x5831('0x17')](_0x4f4216);}});}exports['IntervalIftime']=function(_0x55c982){var _0x59910a=_0x55c982[_0x5831('0x20')];var _0x37acae=Array[_0x5831('0x21')](_0x55c982['intervals'])?_0x55c982[_0x5831('0x22')]:typeof _0x55c982[_0x5831('0x22')]===_0x5831('0x23')?[_0x55c982[_0x5831('0x22')]]:[];var _0x38af97=_0x55c982[_0x5831('0x24')]||undefined;var _0x578c2b=![];if(_0x37acae['length']){logger[_0x5831('0x19')](util[_0x5831('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x37acae[_0x5831('0x1d')](';\x20')));}if(_0x38af97){logger[_0x5831('0x19')](util[_0x5831('0x1a')](_0x5831('0x25'),_0x38af97));}logger[_0x5831('0xf')]('Iftime',_0x578c2b);logger[_0x5831('0x26')](_0x5831('0x27'),_0x55c982);return Promise[_0x5831('0x28')]()[_0x5831('0xe')](function(){if(Array[_0x5831('0x21')](_0x59910a)){return checkArrayOfIntervals(_0x59910a,_0x38af97);}else if(_0x59910a){return checkSingleInterval(_0x59910a,_0x38af97);}})['then'](function(_0x38267d){var _0x5067c3=_0x37acae['reduce'](function(_0x2213cb,_0x47ef06){return _0x2213cb||iftime(_0x47ef06,_0x38af97);},![]);_0x578c2b=_0x38267d||_0x5067c3;return _0x578c2b;})['catch'](function(_0x3fedce){logger['error'](_0x5831('0x27'),_0x55c982,_0x3fedce);throw this[_0x5831('0x11')](0x1f4,_0x3fedce['message']);});}; \ No newline at end of file +var _0x4e49=['options','raw','attributes','limit','include','map','model','then','stringify','error','message','ShowInterval','find','where','info','catch','all','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','name','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','debug','Iftime','silly','IntervalIftime','resolve','reduce','lodash','../../mysqldb','../../utils/iftime','../../config/logger','GetInterval','Interval','findAll'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0x4e49,0x1f1));var _0x94e4=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0x4e49[_0x441eab];return _0xe6ff41;};'use strict';var _=require(_0x94e4('0x0'));var util=require('util');var db=require(_0x94e4('0x1'))['db'];var iftime=require(_0x94e4('0x2'))['iftime'];var logger=require(_0x94e4('0x3'))('rpc');exports[_0x94e4('0x4')]=function(_0x2fd5f8){var _0xb65b5d=this;return new Promise(function(_0x3169fd,_0x54a29c){return db[_0x94e4('0x5')][_0x94e4('0x6')]({'raw':_0x2fd5f8['options']?_0x2fd5f8[_0x94e4('0x7')][_0x94e4('0x8')]===undefined?!![]:![]:!![],'where':_0x2fd5f8['options']?_0x2fd5f8[_0x94e4('0x7')]['where']||null:null,'attributes':_0x2fd5f8[_0x94e4('0x7')]?_0x2fd5f8[_0x94e4('0x7')][_0x94e4('0x9')]||null:null,'limit':_0x2fd5f8[_0x94e4('0x7')]?_0x2fd5f8[_0x94e4('0x7')][_0x94e4('0xa')]||null:null,'include':_0x2fd5f8[_0x94e4('0x7')]?_0x2fd5f8[_0x94e4('0x7')][_0x94e4('0xb')]?_[_0x94e4('0xc')](_0x2fd5f8['options'][_0x94e4('0xb')],function(_0x33de66){return{'model':db[_0x33de66[_0x94e4('0xd')]],'as':_0x33de66['as'],'attributes':_0x33de66[_0x94e4('0x9')],'include':_0x33de66[_0x94e4('0xb')]?_['map'](_0x33de66[_0x94e4('0xb')],function(_0xcff159){return{'model':db[_0xcff159[_0x94e4('0xd')]],'as':_0xcff159['as'],'attributes':_0xcff159['attributes'],'include':_0xcff159[_0x94e4('0xb')]?_['map'](_0xcff159[_0x94e4('0xb')],function(_0x171692){return{'model':db[_0x171692[_0x94e4('0xd')]],'as':_0x171692['as'],'attributes':_0x171692[_0x94e4('0x9')]};}):[]};}):[]};}):[]:[]})[_0x94e4('0xe')](function(_0x4dac15){logger['info'](_0x94e4('0x4'),_0x2fd5f8);logger['debug']('GetInterval',_0x2fd5f8,JSON[_0x94e4('0xf')](_0x4dac15));_0x3169fd(_0x4dac15);})['catch'](function(_0x1660f7){logger[_0x94e4('0x10')]('GetInterval',_0x1660f7[_0x94e4('0x11')],_0x2fd5f8);_0x54a29c(_0xb65b5d['error'](0x1f4,_0x1660f7[_0x94e4('0x11')]));});});};exports[_0x94e4('0x12')]=function(_0x36a703){var _0x827109=this;return new Promise(function(_0x204723,_0x204776){return db['Interval'][_0x94e4('0x13')]({'raw':_0x36a703[_0x94e4('0x7')]?_0x36a703[_0x94e4('0x7')][_0x94e4('0x8')]===undefined?!![]:![]:!![],'where':_0x36a703[_0x94e4('0x7')]?_0x36a703[_0x94e4('0x7')][_0x94e4('0x14')]||null:null,'attributes':_0x36a703[_0x94e4('0x7')]?_0x36a703[_0x94e4('0x7')][_0x94e4('0x9')]||null:null,'include':_0x36a703[_0x94e4('0x7')]?_0x36a703[_0x94e4('0x7')][_0x94e4('0xb')]?_[_0x94e4('0xc')](_0x36a703[_0x94e4('0x7')][_0x94e4('0xb')],function(_0x57d759){return{'model':db[_0x57d759['model']],'as':_0x57d759['as'],'attributes':_0x57d759[_0x94e4('0x9')],'include':_0x57d759[_0x94e4('0xb')]?_[_0x94e4('0xc')](_0x57d759[_0x94e4('0xb')],function(_0x4de04a){return{'model':db[_0x4de04a[_0x94e4('0xd')]],'as':_0x4de04a['as'],'attributes':_0x4de04a[_0x94e4('0x9')],'include':_0x4de04a[_0x94e4('0xb')]?_[_0x94e4('0xc')](_0x4de04a[_0x94e4('0xb')],function(_0x195312){return{'model':db[_0x195312[_0x94e4('0xd')]],'as':_0x195312['as'],'attributes':_0x195312[_0x94e4('0x9')]};}):[]};}):[]};}):[]:[]})[_0x94e4('0xe')](function(_0x55098e){logger[_0x94e4('0x15')]('ShowInterval',_0x36a703);logger['debug']('ShowInterval',_0x36a703,JSON['stringify'](_0x55098e));_0x204723(_0x55098e);})[_0x94e4('0x16')](function(_0x35a0c0){logger[_0x94e4('0x10')](_0x94e4('0x12'),_0x35a0c0[_0x94e4('0x11')],_0x36a703);_0x204776(_0x827109[_0x94e4('0x10')](0x1f4,_0x35a0c0[_0x94e4('0x11')]));});});};function checkArrayOfIntervals(_0x50f661,_0x49d6d1){var _0x37a386=[];return db[_0x94e4('0x5')][_0x94e4('0x6')]({'where':{'id':_0x50f661}})[_0x94e4('0xe')](function(_0x4ef706){_0x37a386=_0x4ef706;return Promise[_0x94e4('0x17')](_0x37a386['map'](function(_0x337700){return _0x337700[_0x94e4('0x18')](_0x49d6d1);}));})[_0x94e4('0xe')](function(_0xa0ba2){var _0x16104f=_0xa0ba2['reduce'](function(_0xb28a42,_0x3f51d4){return _0xb28a42||_0x3f51d4;},![]);logger[_0x94e4('0x15')](util['format'](_0x94e4('0x19'),_0x37a386[_0x94e4('0xc')](function(_0x1cd795){return _0x1cd795['name'];})[_0x94e4('0x1a')](',\x20'),_0x37a386['map'](function(_0x427006){return _0x427006['id'];})[_0x94e4('0x1a')](',\x20')));return _0x16104f;});}function checkSingleInterval(_0x2814ca,_0xc0fe1){return db[_0x94e4('0x5')][_0x94e4('0x1b')](_0x2814ca)[_0x94e4('0xe')](function(_0x48c637){if(_0x48c637){logger[_0x94e4('0x15')](util[_0x94e4('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x48c637[_0x94e4('0x1d')],_0x48c637['id']));return _0x48c637['ifTime'](_0xc0fe1);}});}exports['IntervalIftime']=function(_0x4bfa51){var _0x177091=_0x4bfa51[_0x94e4('0x1e')];var _0x1eeed9=Array[_0x94e4('0x1f')](_0x4bfa51['intervals'])?_0x4bfa51[_0x94e4('0x20')]:typeof _0x4bfa51[_0x94e4('0x20')]==='string'?[_0x4bfa51['intervals']]:[];var _0x3b4fcf=_0x4bfa51[_0x94e4('0x21')]||undefined;var _0x227181=![];if(_0x1eeed9[_0x94e4('0x22')]){logger[_0x94e4('0x15')](util[_0x94e4('0x1c')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x1eeed9['join'](';\x20')));}if(_0x3b4fcf){logger[_0x94e4('0x15')](util[_0x94e4('0x1c')](_0x94e4('0x23'),_0x3b4fcf));}logger[_0x94e4('0x24')](_0x94e4('0x25'),_0x227181);logger[_0x94e4('0x26')](_0x94e4('0x27'),_0x4bfa51);return Promise[_0x94e4('0x28')]()[_0x94e4('0xe')](function(){if(Array[_0x94e4('0x1f')](_0x177091)){return checkArrayOfIntervals(_0x177091,_0x3b4fcf);}else if(_0x177091){return checkSingleInterval(_0x177091,_0x3b4fcf);}})[_0x94e4('0xe')](function(_0x414508){var _0x588624=_0x1eeed9[_0x94e4('0x29')](function(_0x27d8cd,_0x301f26){return _0x27d8cd||iftime(_0x301f26,_0x3b4fcf);},![]);_0x227181=_0x414508||_0x588624;return _0x227181;})[_0x94e4('0x16')](function(_0x48c917){logger[_0x94e4('0x10')](_0x94e4('0x27'),_0x4bfa51,_0x48c917);throw this[_0x94e4('0x10')](0x1f4,_0x48c917[_0x94e4('0x11')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3d2a6b5..cab2ecf 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x42cf89,_0x2bd0dd){var _0x5a918f=function(_0x27591a){while(--_0x27591a){_0x42cf89['push'](_0x42cf89['shift']());}};_0x5a918f(++_0x2bd0dd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44202a,_0x3ef5fb){_0x44202a=_0x44202a-0x0;var _0x880c5a=_0x5f2f[_0x44202a];return _0x880c5a;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x0b0e,0x187));var _0xe0b0=function(_0x108db1,_0x89896d){_0x108db1=_0x108db1-0x0;var _0x16848d=_0x0b0e[_0x108db1];return _0x16848d;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a109f6a..21c744e 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 _0x92d5=['x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','parse','api.jira','openIssue','send','headers'];(function(_0x1ce794,_0xe7f9bc){var _0x5abb47=function(_0x1160ed){while(--_0x1160ed){_0x1ce794['push'](_0x1ce794['shift']());}};_0x5abb47(++_0xe7f9bc);}(_0x92d5,0x80));var _0x592d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x92d5[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x592d('0x0'));var https=require(_0x592d('0x1'));var logger=require(_0x592d('0x2'))(_0x592d('0x3'));var USERNAME='support';var PASSWORD=_0x592d('0x4');function openIssue(_0x297a48,_0x179ca9){var _0x226731={'fields':{'project':{'key':_0x297a48['key']||_0x592d('0x5')},'summary':(_0x297a48[_0x592d('0x6')]||_0x592d('0x7'))+_0x592d('0x8')+_0x297a48['ip'],'description':_0x297a48['description']||JSON[_0x592d('0x9')](_0x297a48),'issuetype':{'name':_0x297a48[_0x592d('0xa')]||_0x592d('0xb')}}};_0x226731[_0x592d('0xc')][_0x592d('0xd')]=_0x297a48[_0x592d('0xe')];_0x226731['fields'][_0x592d('0xf')]=_0x297a48['oldToken'];_0x226731[_0x592d('0xc')][_0x592d('0x10')]=_0x297a48[_0x592d('0x11')];_0x226731['fields']['customfield_11503']=_0x297a48[_0x592d('0x12')];_0x226731[_0x592d('0xc')]['customfield_11504']=_0x297a48[_0x592d('0x13')];_0x226731[_0x592d('0xc')][_0x592d('0x14')]=_0x297a48['ip'];var _0x43aae={'host':_0x592d('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x592d('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x592d('0x17'),'Authorization':_0x592d('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x592d('0x19'))}};var _0x3c6dcc=JSON[_0x592d('0x9')](_0x226731);var _0xd5f57c=https[_0x592d('0x1a')](_0x43aae,function(_0x52c4e5){_0x52c4e5[_0x592d('0x1b')](_0x592d('0x1c'));var _0x5052b6='';_0x52c4e5['on'](_0x592d('0x1d'),function(_0x46ddda){_0x5052b6+=_0x46ddda;});_0x52c4e5['on'](_0x592d('0x1e'),function(){if(_0x179ca9){return _0x179ca9['status'](_0x52c4e5['statusCode'])['json'](JSON[_0x592d('0x1f')](_0x5052b6));}});});_0xd5f57c['on']('error',function(_0x49c62e){if(_0x179ca9){return _0x179ca9['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x592d('0x20')}]});}});_0xd5f57c['write'](_0x3c6dcc);_0xd5f57c[_0x592d('0x1e')]();}exports[_0x592d('0x21')]=openIssue;exports[_0x592d('0x22')]=function(_0x995f9,_0x260c75){_0x995f9['body']['ip']=_0x995f9[_0x592d('0x23')][_0x592d('0x24')]||_0x995f9[_0x592d('0x25')][_0x592d('0x26')]||_0x995f9[_0x592d('0x27')][_0x592d('0x26')]||_0x995f9[_0x592d('0x25')][_0x592d('0x27')][_0x592d('0x26')];return openIssue(_0x995f9[_0x592d('0x28')],_0x260c75);}; \ No newline at end of file +var _0xa588=['api','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','toString','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa588,0x1ca));var _0x8a58=function(_0x30381e,_0x2a1f30){_0x30381e=_0x30381e-0x0;var _0x9fb2f3=_0xa588[_0x30381e];return _0x9fb2f3;};'use strict';var BPromise=require('bluebird');var https=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var USERNAME=_0x8a58('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x397856,_0x2ae3b4){var _0x4cf808={'fields':{'project':{'key':_0x397856[_0x8a58('0x4')]||_0x8a58('0x5')},'summary':(_0x397856[_0x8a58('0x6')]||_0x8a58('0x7'))+_0x8a58('0x8')+_0x397856['ip'],'description':_0x397856[_0x8a58('0x9')]||JSON[_0x8a58('0xa')](_0x397856),'issuetype':{'name':_0x397856[_0x8a58('0xb')]||_0x8a58('0xc')}}};_0x4cf808[_0x8a58('0xd')][_0x8a58('0xe')]=_0x397856['email'];_0x4cf808[_0x8a58('0xd')][_0x8a58('0xf')]=_0x397856[_0x8a58('0x10')];_0x4cf808[_0x8a58('0xd')][_0x8a58('0x11')]=_0x397856['newToken'];_0x4cf808[_0x8a58('0xd')]['customfield_11503']=_0x397856[_0x8a58('0x12')];_0x4cf808[_0x8a58('0xd')][_0x8a58('0x13')]=_0x397856[_0x8a58('0x14')];_0x4cf808[_0x8a58('0xd')][_0x8a58('0x15')]=_0x397856['ip'];var _0x28af72={'host':_0x8a58('0x16'),'port':0x1bb,'path':_0x8a58('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x8a58('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x8a58('0x19')](_0x8a58('0x1a'))}};var _0x4a96a7=JSON[_0x8a58('0xa')](_0x4cf808);var _0x24105c=https['request'](_0x28af72,function(_0x268d90){_0x268d90[_0x8a58('0x1b')](_0x8a58('0x1c'));var _0xaf3991='';_0x268d90['on'](_0x8a58('0x1d'),function(_0x481e92){_0xaf3991+=_0x481e92;});_0x268d90['on'](_0x8a58('0x1e'),function(){if(_0x2ae3b4){return _0x2ae3b4[_0x8a58('0x1f')](_0x268d90[_0x8a58('0x20')])[_0x8a58('0x21')](JSON[_0x8a58('0x22')](_0xaf3991));}});});_0x24105c['on'](_0x8a58('0x23'),function(_0x3e67fe){if(_0x2ae3b4){return _0x2ae3b4[_0x8a58('0x1f')](0x1f4)[_0x8a58('0x21')]({'errors':[{'message':_0x8a58('0x24'),'type':'api.jira'}]});}});_0x24105c[_0x8a58('0x25')](_0x4a96a7);_0x24105c[_0x8a58('0x1e')]();}exports[_0x8a58('0x26')]=openIssue;exports[_0x8a58('0x27')]=function(_0x331a4e,_0x4be57c){_0x331a4e[_0x8a58('0x28')]['ip']=_0x331a4e[_0x8a58('0x29')][_0x8a58('0x2a')]||_0x331a4e[_0x8a58('0x2b')][_0x8a58('0x2c')]||_0x331a4e['socket']['remoteAddress']||_0x331a4e['connection'][_0x8a58('0x2d')][_0x8a58('0x2c')];return openIssue(_0x331a4e[_0x8a58('0x28')],_0x4be57c);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e0ba4d1..16102de 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 _0x878f=['./jscriptyAnswerReport.controller','get','/describe','/:id','post','isAuthenticated','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x878f,0x173));var _0xf878=function(_0x2f93a8,_0xe57f85){_0x2f93a8=_0x2f93a8-0x0;var _0x3c99c1=_0x878f[_0x2f93a8];return _0x3c99c1;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),controller[_0xf878('0xf')]);router['put'](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['update']);router[_0xf878('0x10')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x11')]);module[_0xf878('0x12')]=router; \ No newline at end of file +var _0x750a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','util','express','Router'];(function(_0x1d218c,_0x340d0f){var _0x3b12ab=function(_0x4bd8e5){while(--_0x4bd8e5){_0x1d218c['push'](_0x1d218c['shift']());}};_0x3b12ab(++_0x340d0f);}(_0x750a,0x140));var _0xa750=function(_0xc0b290,_0x231570){_0xc0b290=_0xc0b290-0x0;var _0x2f1c56=_0x750a[_0xc0b290];return _0x2f1c56;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['describe']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0xe')]('/',auth['isAuthenticated'](),controller[_0xa750('0xf')]);router[_0xa750('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa750('0x11')]);router['delete'](_0xa750('0xc'),auth[_0xa750('0x9')](),controller['destroy']);module[_0xa750('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index bc9d483..512b9c5 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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x348ac0,_0x25f496){_0x348ac0=_0x348ac0-0x0;var _0x14febe=_0x7a54[_0x348ac0];return _0x14febe;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x3d8a6c,_0x1138a7){_0x3d8a6c=_0x3d8a6c-0x0;var _0x2371ed=_0x7a54[_0x3d8a6c];return _0x2371ed;};'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 bb89a25..53e72a1 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 _0x5b20=['json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x488cf4,_0x3bbbe7){var _0x3c724e=function(_0x89fd22){while(--_0x89fd22){_0x488cf4['push'](_0x488cf4['shift']());}};_0x3c724e(++_0x3bbbe7);}(_0x5b20,0x86));var _0x05b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5b20[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x05b2('0x0'));var rimraf=require(_0x05b2('0x1'));var zipdir=require(_0x05b2('0x2'));var jsonpatch=require(_0x05b2('0x3'));var rp=require(_0x05b2('0x4'));var moment=require(_0x05b2('0x5'));var BPromise=require(_0x05b2('0x6'));var Mustache=require(_0x05b2('0x7'));var util=require(_0x05b2('0x8'));var path=require(_0x05b2('0x9'));var sox=require(_0x05b2('0xa'));var csv=require('to-csv');var ejs=require(_0x05b2('0xb'));var fs=require('fs');var fs_extra=require(_0x05b2('0xc'));var _=require('lodash');var squel=require(_0x05b2('0xd'));var crypto=require(_0x05b2('0xe'));var jsforce=require(_0x05b2('0xf'));var deskjs=require(_0x05b2('0x10'));var toCsv=require(_0x05b2('0x11'));var querystring=require(_0x05b2('0x12'));var Papa=require(_0x05b2('0x13'));var Redis=require(_0x05b2('0x14'));var authService=require(_0x05b2('0x15'));var qs=require(_0x05b2('0x16'));var as=require(_0x05b2('0x17'));var hardwareService=require(_0x05b2('0x18'));var logger=require(_0x05b2('0x19'))(_0x05b2('0x1a'));var utils=require(_0x05b2('0x1b'));var config=require(_0x05b2('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x05b2('0x1d'))['db'];function respondWithStatusCode(_0x12ca67,_0x30eb0a){_0x30eb0a=_0x30eb0a||0xcc;return function(_0x40b8b8){if(_0x40b8b8){return _0x12ca67['sendStatus'](_0x30eb0a);}return _0x12ca67[_0x05b2('0x1e')](_0x30eb0a)[_0x05b2('0x1f')]();};}function respondWithResult(_0x33d532,_0x5a12d4){_0x5a12d4=_0x5a12d4||0xc8;return function(_0x4e5c5d){if(_0x4e5c5d){return _0x33d532[_0x05b2('0x1e')](_0x5a12d4)[_0x05b2('0x20')](_0x4e5c5d);}};}function respondWithFilteredResult(_0x4d6d7e,_0x4c2ee4){return function(_0x3d3664){if(_0x3d3664){var _0x3fe466=typeof _0x4c2ee4[_0x05b2('0x21')]===_0x05b2('0x22')&&typeof _0x4c2ee4[_0x05b2('0x23')]===_0x05b2('0x22');var _0x290cce=_0x3d3664[_0x05b2('0x24')];var _0x468f42=_0x3fe466?0x0:_0x4c2ee4[_0x05b2('0x21')];var _0x8c390d=_0x3fe466?_0x3d3664[_0x05b2('0x24')]:_0x4c2ee4[_0x05b2('0x21')]+_0x4c2ee4[_0x05b2('0x23')];var _0xb3e12e;if(_0x8c390d>=_0x290cce){_0x8c390d=_0x290cce;_0xb3e12e=0xc8;}else{_0xb3e12e=0xce;}_0x4d6d7e[_0x05b2('0x1e')](_0xb3e12e);return _0x4d6d7e['set'](_0x05b2('0x25'),_0x468f42+'-'+_0x8c390d+'/'+_0x290cce)[_0x05b2('0x20')](_0x3d3664);}return null;};}function patchUpdates(_0xd1a576){return function(_0x41bea5){try{jsonpatch[_0x05b2('0x26')](_0x41bea5,_0xd1a576,!![]);}catch(_0x113b6c){return BPromise[_0x05b2('0x27')](_0x113b6c);}return _0x41bea5['save']();};}function saveUpdates(_0x1e76f1,_0x4b14ec){return function(_0x2874e8){if(_0x2874e8){return _0x2874e8[_0x05b2('0x28')](_0x1e76f1)['then'](function(_0x2cccea){return _0x2cccea;});}return null;};}function removeEntity(_0x1a7d84,_0x3bc5a3){return function(_0x4221f5){if(_0x4221f5){return _0x4221f5[_0x05b2('0x29')]()[_0x05b2('0x2a')](function(){_0x1a7d84[_0x05b2('0x1e')](0xcc)[_0x05b2('0x1f')]();});}};}function handleEntityNotFound(_0x4f1e20,_0x4a2d66){return function(_0x5434bd){if(!_0x5434bd){_0x4f1e20[_0x05b2('0x2b')](0x194);}return _0x5434bd;};}function handleError(_0x4f0b2b,_0x5d79a2){_0x5d79a2=_0x5d79a2||0x1f4;return function(_0x35b6ba){logger[_0x05b2('0x2c')](_0x35b6ba[_0x05b2('0x2d')]);if(_0x35b6ba[_0x05b2('0x2e')]){delete _0x35b6ba[_0x05b2('0x2e')];}_0x4f0b2b[_0x05b2('0x1e')](_0x5d79a2)[_0x05b2('0x2f')](_0x35b6ba);};}exports['index']=function(_0x14ebf8,_0x1c7e8a){var _0x717140={},_0x121ada={},_0x50fffd={'count':0x0,'rows':[]};var _0x1d2ea1=_['map'](db[_0x05b2('0x30')][_0x05b2('0x31')],function(_0x3a4ea9){return{'name':_0x3a4ea9[_0x05b2('0x32')],'type':_0x3a4ea9['type'][_0x05b2('0x33')]};});_0x121ada['model']=_[_0x05b2('0x34')](_0x1d2ea1,'name');_0x121ada[_0x05b2('0x35')]=_[_0x05b2('0x36')](_0x14ebf8[_0x05b2('0x35')]);_0x121ada['filters']=_['intersection'](_0x121ada[_0x05b2('0x37')],_0x121ada[_0x05b2('0x35')]);_0x717140[_0x05b2('0x38')]=_[_0x05b2('0x39')](_0x121ada['model'],qs[_0x05b2('0x3a')](_0x14ebf8['query'][_0x05b2('0x3a')]));_0x717140[_0x05b2('0x38')]=_0x717140['attributes'][_0x05b2('0x3b')]?_0x717140[_0x05b2('0x38')]:_0x121ada['model'];if(!_0x14ebf8['query'][_0x05b2('0x3c')](_0x05b2('0x3d'))){_0x717140['limit']=qs[_0x05b2('0x23')](_0x14ebf8[_0x05b2('0x35')][_0x05b2('0x23')]);_0x717140[_0x05b2('0x21')]=qs['offset'](_0x14ebf8['query']['offset']);}_0x717140[_0x05b2('0x3e')]=qs[_0x05b2('0x3f')](_0x14ebf8['query'][_0x05b2('0x3f')]);_0x717140[_0x05b2('0x40')]=qs[_0x05b2('0x41')](_[_0x05b2('0x42')](_0x14ebf8[_0x05b2('0x35')],_0x121ada[_0x05b2('0x41')]),_0x1d2ea1);if(_0x14ebf8[_0x05b2('0x35')]['filter']){_0x717140[_0x05b2('0x40')]=_[_0x05b2('0x43')](_0x717140[_0x05b2('0x40')],{'$or':_[_0x05b2('0x34')](_0x1d2ea1,function(_0x486990){if(_0x486990[_0x05b2('0x44')]!==_0x05b2('0x45')){var _0x5b6ad7={};_0x5b6ad7[_0x486990['name']]={'$like':'%'+_0x14ebf8[_0x05b2('0x35')][_0x05b2('0x46')]+'%'};return _0x5b6ad7;}})});}_0x717140=_[_0x05b2('0x43')]({},_0x717140,_0x14ebf8[_0x05b2('0x47')]);var _0xbf443={'where':_0x717140[_0x05b2('0x40')]};return db[_0x05b2('0x30')][_0x05b2('0x24')](_0xbf443)['then'](function(_0x524964){_0x50fffd[_0x05b2('0x24')]=_0x524964;if(_0x14ebf8[_0x05b2('0x35')]['includeAll']){_0x717140[_0x05b2('0x48')]=[{'all':!![]}];}return db[_0x05b2('0x30')][_0x05b2('0x49')](_0x717140);})[_0x05b2('0x2a')](function(_0x3c526c){_0x50fffd[_0x05b2('0x4a')]=_0x3c526c;return _0x50fffd;})[_0x05b2('0x2a')](respondWithFilteredResult(_0x1c7e8a,_0x717140))['catch'](handleError(_0x1c7e8a,null));};exports[_0x05b2('0x4b')]=function(_0x48bf3b,_0x1e955b){var _0x89a455={'raw':!![],'where':{'id':_0x48bf3b[_0x05b2('0x4c')]['id']}},_0x4a8c3d={};_0x4a8c3d[_0x05b2('0x37')]=_['keys'](db[_0x05b2('0x30')][_0x05b2('0x31')]);_0x4a8c3d[_0x05b2('0x35')]=_[_0x05b2('0x36')](_0x48bf3b[_0x05b2('0x35')]);_0x4a8c3d[_0x05b2('0x41')]=_[_0x05b2('0x39')](_0x4a8c3d[_0x05b2('0x37')],_0x4a8c3d['query']);_0x89a455['attributes']=_[_0x05b2('0x39')](_0x4a8c3d[_0x05b2('0x37')],qs['fields'](_0x48bf3b['query']['fields']));_0x89a455[_0x05b2('0x38')]=_0x89a455['attributes'][_0x05b2('0x3b')]?_0x89a455['attributes']:_0x4a8c3d[_0x05b2('0x37')];if(_0x48bf3b[_0x05b2('0x35')][_0x05b2('0x4d')]){_0x89a455[_0x05b2('0x48')]=[{'all':!![]}];}_0x89a455=_[_0x05b2('0x43')]({},_0x89a455,_0x48bf3b[_0x05b2('0x47')]);return db[_0x05b2('0x30')][_0x05b2('0x4e')](_0x89a455)[_0x05b2('0x2a')](handleEntityNotFound(_0x1e955b,null))['then'](respondWithResult(_0x1e955b,null))[_0x05b2('0x4f')](handleError(_0x1e955b,null));};exports[_0x05b2('0x50')]=function(_0x174c17,_0x4870){return db[_0x05b2('0x30')]['create'](_0x174c17['body'],{})[_0x05b2('0x2a')](respondWithResult(_0x4870,0xc9))[_0x05b2('0x4f')](handleError(_0x4870,null));};exports[_0x05b2('0x28')]=function(_0x1b6973,_0xb7ab8e){if(_0x1b6973[_0x05b2('0x51')]['id']){delete _0x1b6973['body']['id'];}return db[_0x05b2('0x30')][_0x05b2('0x4e')]({'where':{'id':_0x1b6973[_0x05b2('0x4c')]['id']}})[_0x05b2('0x2a')](handleEntityNotFound(_0xb7ab8e,null))[_0x05b2('0x2a')](saveUpdates(_0x1b6973[_0x05b2('0x51')],null))['then'](respondWithResult(_0xb7ab8e,null))[_0x05b2('0x4f')](handleError(_0xb7ab8e,null));};exports[_0x05b2('0x29')]=function(_0x1ef89c,_0x1c3169){return db[_0x05b2('0x30')][_0x05b2('0x4e')]({'where':{'id':_0x1ef89c[_0x05b2('0x4c')]['id']}})[_0x05b2('0x2a')](handleEntityNotFound(_0x1c3169,null))[_0x05b2('0x2a')](removeEntity(_0x1c3169,null))['catch'](handleError(_0x1c3169,null));};exports[_0x05b2('0x52')]=function(_0x35f2bb,_0x2be4e2){return db[_0x05b2('0x30')][_0x05b2('0x52')]()[_0x05b2('0x2a')](respondWithResult(_0x2be4e2,null))[_0x05b2('0x4f')](handleError(_0x2be4e2,null));}; \ No newline at end of file +var _0x9f7a=['end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','name','send','map','JscriptyAnswerReport','type','key','query','intersection','model','attributes','fields','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3fa98d,_0x2d1095){var _0x3d8940=function(_0x15f101){while(--_0x15f101){_0x3fa98d['push'](_0x3fa98d['shift']());}};_0x3d8940(++_0x2d1095);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x9f7a[_0x4b2863];return _0x567d67;};'use strict';var emlformat=require(_0xa9f7('0x0'));var rimraf=require(_0xa9f7('0x1'));var zipdir=require(_0xa9f7('0x2'));var jsonpatch=require(_0xa9f7('0x3'));var rp=require('request-promise');var moment=require(_0xa9f7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa9f7('0x5'));var sox=require(_0xa9f7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9f7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9f7('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xa9f7('0x9'));var querystring=require(_0xa9f7('0xa'));var Papa=require(_0xa9f7('0xb'));var Redis=require('ioredis');var authService=require(_0xa9f7('0xc'));var qs=require(_0xa9f7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9f7('0xe'));var logger=require(_0xa9f7('0xf'))(_0xa9f7('0x10'));var utils=require(_0xa9f7('0x11'));var config=require(_0xa9f7('0x12'));var licenseUtil=require(_0xa9f7('0x13'));var db=require(_0xa9f7('0x14'))['db'];function respondWithStatusCode(_0x52e4d4,_0x532485){_0x532485=_0x532485||0xcc;return function(_0x5462c6){if(_0x5462c6){return _0x52e4d4[_0xa9f7('0x15')](_0x532485);}return _0x52e4d4[_0xa9f7('0x16')](_0x532485)[_0xa9f7('0x17')]();};}function respondWithResult(_0x4fb93c,_0x5f097c){_0x5f097c=_0x5f097c||0xc8;return function(_0xe56a20){if(_0xe56a20){return _0x4fb93c['status'](_0x5f097c)['json'](_0xe56a20);}};}function respondWithFilteredResult(_0x188f8a,_0x3987a5){return function(_0x30b935){if(_0x30b935){var _0x4cc9f3=typeof _0x3987a5[_0xa9f7('0x18')]===_0xa9f7('0x19')&&typeof _0x3987a5[_0xa9f7('0x1a')]==='undefined';var _0x310009=_0x30b935[_0xa9f7('0x1b')];var _0x230904=_0x4cc9f3?0x0:_0x3987a5[_0xa9f7('0x18')];var _0x8da225=_0x4cc9f3?_0x30b935[_0xa9f7('0x1b')]:_0x3987a5[_0xa9f7('0x18')]+_0x3987a5[_0xa9f7('0x1a')];var _0x2d0a7b;if(_0x8da225>=_0x310009){_0x8da225=_0x310009;_0x2d0a7b=0xc8;}else{_0x2d0a7b=0xce;}_0x188f8a['status'](_0x2d0a7b);return _0x188f8a[_0xa9f7('0x1c')](_0xa9f7('0x1d'),_0x230904+'-'+_0x8da225+'/'+_0x310009)[_0xa9f7('0x1e')](_0x30b935);}return null;};}function patchUpdates(_0x28590b){return function(_0x402c6d){try{jsonpatch['apply'](_0x402c6d,_0x28590b,!![]);}catch(_0x4a27de){return BPromise['reject'](_0x4a27de);}return _0x402c6d['save']();};}function saveUpdates(_0x4edaf9,_0x4b7202){return function(_0x5c9e4f){if(_0x5c9e4f){return _0x5c9e4f[_0xa9f7('0x1f')](_0x4edaf9)['then'](function(_0x5a62ba){return _0x5a62ba;});}return null;};}function removeEntity(_0x3fa542,_0x530992){return function(_0x502562){if(_0x502562){return _0x502562['destroy']()[_0xa9f7('0x20')](function(){_0x3fa542[_0xa9f7('0x16')](0xcc)[_0xa9f7('0x17')]();});}};}function handleEntityNotFound(_0x537d55,_0x131872){return function(_0x112446){if(!_0x112446){_0x537d55[_0xa9f7('0x15')](0x194);}return _0x112446;};}function handleError(_0x5555f6,_0x44a86d){_0x44a86d=_0x44a86d||0x1f4;return function(_0x52bb0a){logger[_0xa9f7('0x21')](_0x52bb0a['stack']);if(_0x52bb0a[_0xa9f7('0x22')]){delete _0x52bb0a[_0xa9f7('0x22')];}_0x5555f6[_0xa9f7('0x16')](_0x44a86d)[_0xa9f7('0x23')](_0x52bb0a);};}exports['index']=function(_0x41530a,_0x249604){var _0x16437e={},_0x312084={},_0xc9684a={'count':0x0,'rows':[]};var _0x471c3c=_[_0xa9f7('0x24')](db[_0xa9f7('0x25')]['rawAttributes'],function(_0x540f78){return{'name':_0x540f78['fieldName'],'type':_0x540f78[_0xa9f7('0x26')][_0xa9f7('0x27')]};});_0x312084['model']=_[_0xa9f7('0x24')](_0x471c3c,'name');_0x312084['query']=_['keys'](_0x41530a[_0xa9f7('0x28')]);_0x312084['filters']=_[_0xa9f7('0x29')](_0x312084[_0xa9f7('0x2a')],_0x312084[_0xa9f7('0x28')]);_0x16437e[_0xa9f7('0x2b')]=_[_0xa9f7('0x29')](_0x312084['model'],qs[_0xa9f7('0x2c')](_0x41530a[_0xa9f7('0x28')]['fields']));_0x16437e[_0xa9f7('0x2b')]=_0x16437e[_0xa9f7('0x2b')]['length']?_0x16437e[_0xa9f7('0x2b')]:_0x312084[_0xa9f7('0x2a')];if(!_0x41530a[_0xa9f7('0x28')]['hasOwnProperty']('nolimit')){_0x16437e[_0xa9f7('0x1a')]=qs[_0xa9f7('0x1a')](_0x41530a[_0xa9f7('0x28')][_0xa9f7('0x1a')]);_0x16437e[_0xa9f7('0x18')]=qs['offset'](_0x41530a[_0xa9f7('0x28')][_0xa9f7('0x18')]);}_0x16437e[_0xa9f7('0x2d')]=qs['sort'](_0x41530a['query'][_0xa9f7('0x2e')]);_0x16437e['where']=qs[_0xa9f7('0x2f')](_[_0xa9f7('0x30')](_0x41530a[_0xa9f7('0x28')],_0x312084[_0xa9f7('0x2f')]),_0x471c3c);if(_0x41530a['query'][_0xa9f7('0x31')]){_0x16437e[_0xa9f7('0x32')]=_[_0xa9f7('0x33')](_0x16437e[_0xa9f7('0x32')],{'$or':_[_0xa9f7('0x24')](_0x471c3c,function(_0x318f96){if(_0x318f96[_0xa9f7('0x26')]!=='VIRTUAL'){var _0xe6d3e3={};_0xe6d3e3[_0x318f96[_0xa9f7('0x22')]]={'$like':'%'+_0x41530a['query'][_0xa9f7('0x31')]+'%'};return _0xe6d3e3;}})});}_0x16437e=_[_0xa9f7('0x33')]({},_0x16437e,_0x41530a[_0xa9f7('0x34')]);var _0x419433={'where':_0x16437e[_0xa9f7('0x32')]};return db[_0xa9f7('0x25')][_0xa9f7('0x1b')](_0x419433)['then'](function(_0x402808){_0xc9684a[_0xa9f7('0x1b')]=_0x402808;if(_0x41530a[_0xa9f7('0x28')]['includeAll']){_0x16437e[_0xa9f7('0x35')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa9f7('0x36')](_0x16437e);})[_0xa9f7('0x20')](function(_0x5eb5d2){_0xc9684a[_0xa9f7('0x37')]=_0x5eb5d2;return _0xc9684a;})[_0xa9f7('0x20')](respondWithFilteredResult(_0x249604,_0x16437e))[_0xa9f7('0x38')](handleError(_0x249604,null));};exports[_0xa9f7('0x39')]=function(_0xd56610,_0x492d3f){var _0x3fb0d6={'raw':!![],'where':{'id':_0xd56610[_0xa9f7('0x3a')]['id']}},_0x2d9e79={};_0x2d9e79[_0xa9f7('0x2a')]=_[_0xa9f7('0x3b')](db[_0xa9f7('0x25')][_0xa9f7('0x3c')]);_0x2d9e79[_0xa9f7('0x28')]=_[_0xa9f7('0x3b')](_0xd56610[_0xa9f7('0x28')]);_0x2d9e79[_0xa9f7('0x2f')]=_[_0xa9f7('0x29')](_0x2d9e79['model'],_0x2d9e79['query']);_0x3fb0d6[_0xa9f7('0x2b')]=_[_0xa9f7('0x29')](_0x2d9e79[_0xa9f7('0x2a')],qs[_0xa9f7('0x2c')](_0xd56610[_0xa9f7('0x28')][_0xa9f7('0x2c')]));_0x3fb0d6[_0xa9f7('0x2b')]=_0x3fb0d6[_0xa9f7('0x2b')]['length']?_0x3fb0d6[_0xa9f7('0x2b')]:_0x2d9e79[_0xa9f7('0x2a')];if(_0xd56610[_0xa9f7('0x28')]['includeAll']){_0x3fb0d6['include']=[{'all':!![]}];}_0x3fb0d6=_[_0xa9f7('0x33')]({},_0x3fb0d6,_0xd56610['options']);return db[_0xa9f7('0x25')][_0xa9f7('0x3d')](_0x3fb0d6)[_0xa9f7('0x20')](handleEntityNotFound(_0x492d3f,null))[_0xa9f7('0x20')](respondWithResult(_0x492d3f,null))['catch'](handleError(_0x492d3f,null));};exports[_0xa9f7('0x3e')]=function(_0x4d9cd2,_0x30e7b2){return db[_0xa9f7('0x25')][_0xa9f7('0x3e')](_0x4d9cd2[_0xa9f7('0x3f')],{})[_0xa9f7('0x20')](respondWithResult(_0x30e7b2,0xc9))[_0xa9f7('0x38')](handleError(_0x30e7b2,null));};exports[_0xa9f7('0x1f')]=function(_0x232371,_0x11e37d){if(_0x232371['body']['id']){delete _0x232371[_0xa9f7('0x3f')]['id'];}return db[_0xa9f7('0x25')][_0xa9f7('0x3d')]({'where':{'id':_0x232371['params']['id']}})[_0xa9f7('0x20')](handleEntityNotFound(_0x11e37d,null))[_0xa9f7('0x20')](saveUpdates(_0x232371[_0xa9f7('0x3f')],null))[_0xa9f7('0x20')](respondWithResult(_0x11e37d,null))[_0xa9f7('0x38')](handleError(_0x11e37d,null));};exports[_0xa9f7('0x40')]=function(_0xcb22ff,_0x2afcf5){return db[_0xa9f7('0x25')][_0xa9f7('0x3d')]({'where':{'id':_0xcb22ff[_0xa9f7('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2afcf5,null))[_0xa9f7('0x20')](removeEntity(_0x2afcf5,null))[_0xa9f7('0x38')](handleError(_0x2afcf5,null));};exports[_0xa9f7('0x41')]=function(_0x56b86e,_0x121394){return db[_0xa9f7('0x25')][_0xa9f7('0x41')]()[_0xa9f7('0x20')](respondWithResult(_0x121394,null))[_0xa9f7('0x38')](handleError(_0x121394,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 791c116..b4ded45 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 _0x0d02=['moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','../../config/logger','api'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x0d02,0xee));var _0x20d0=function(_0xc2da68,_0x294f09){_0xc2da68=_0xc2da68-0x0;var _0x69c69e=_0x0d02[_0xc2da68];return _0x69c69e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20d0('0x0'))(_0x20d0('0x1'));var moment=require(_0x20d0('0x2'));var BPromise=require(_0x20d0('0x3'));var rp=require(_0x20d0('0x4'));var fs=require('fs');var path=require(_0x20d0('0x5'));var rimraf=require('rimraf');var config=require(_0x20d0('0x6'));var attributes=require(_0x20d0('0x7'));module[_0x20d0('0x8')]=function(_0x7dda6d,_0x38b984){return _0x7dda6d[_0x20d0('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63ec=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyAnswerReport','lodash','util'];(function(_0x1a0a45,_0x4a4269){var _0x5a12f7=function(_0x31e1ba){while(--_0x31e1ba){_0x1a0a45['push'](_0x1a0a45['shift']());}};_0x5a12f7(++_0x4a4269);}(_0x63ec,0xb2));var _0xc63e=function(_0x6c8591,_0x1418be){_0x6c8591=_0x6c8591-0x0;var _0x2bc113=_0x63ec[_0x6c8591];return _0x2bc113;};'use strict';var _=require(_0xc63e('0x0'));var util=require(_0xc63e('0x1'));var logger=require(_0xc63e('0x2'))(_0xc63e('0x3'));var moment=require(_0xc63e('0x4'));var BPromise=require(_0xc63e('0x5'));var rp=require(_0xc63e('0x6'));var fs=require('fs');var path=require(_0xc63e('0x7'));var rimraf=require(_0xc63e('0x8'));var config=require(_0xc63e('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x419271,_0xa30ce1){return _0x419271[_0xc63e('0xa')](_0xc63e('0xb'),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 093bc51..9072970 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 _0x07e0=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','catch'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x07e0,0xf7));var _0x007e=function(_0x111164,_0x48487f){_0x111164=_0x111164-0x0;var _0x532f6e=_0x07e0[_0x111164];return _0x532f6e;};'use strict';var _=require('lodash');var util=require(_0x007e('0x0'));var moment=require(_0x007e('0x1'));var BPromise=require(_0x007e('0x2'));var rs=require(_0x007e('0x3'));var fs=require('fs');var Redis=require(_0x007e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x007e('0x5'));var logger=require(_0x007e('0x6'))(_0x007e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x007e('0x8')][_0x007e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a5b9,_0x3cbf6e,_0x18d8f8){return new BPromise(function(_0xbaa161,_0x3ce026){return client['request'](_0x24a5b9,_0x18d8f8)['then'](function(_0x5761a1){logger[_0x007e('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cbf6e,_0x007e('0xb'));logger[_0x007e('0xc')](_0x007e('0xd'),_0x3cbf6e,'request\x20sent',JSON[_0x007e('0xe')](_0x5761a1));if(_0x5761a1[_0x007e('0xf')]){if(_0x5761a1['error']['code']===0x1f4){logger[_0x007e('0xf')](_0x007e('0x10'),_0x3cbf6e,_0x5761a1[_0x007e('0xf')]['message']);return _0x3ce026(_0x5761a1[_0x007e('0xf')]['message']);}logger[_0x007e('0xf')](_0x007e('0x10'),_0x3cbf6e,_0x5761a1[_0x007e('0xf')]['message']);return _0xbaa161(_0x5761a1[_0x007e('0xf')][_0x007e('0x11')]);}else{logger[_0x007e('0xa')](_0x007e('0x10'),_0x3cbf6e,'request\x20sent');_0xbaa161(_0x5761a1['result'][_0x007e('0x11')]);}})[_0x007e('0x12')](function(_0x3d86d4){logger[_0x007e('0xf')](_0x007e('0x10'),_0x3cbf6e,_0x3d86d4);_0x3ce026(_0x3d86d4);});});} \ No newline at end of file +var _0x44ab=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','JscriptyAnswerReport,\x20%s,\x20%s','lodash','util'];(function(_0x202e72,_0x45b994){var _0x55154c=function(_0xf41097){while(--_0xf41097){_0x202e72['push'](_0x202e72['shift']());}};_0x55154c(++_0x45b994);}(_0x44ab,0x12a));var _0xb44a=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x44ab[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0xb44a('0x0'));var util=require(_0xb44a('0x1'));var moment=require(_0xb44a('0x2'));var BPromise=require(_0xb44a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb44a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb44a('0x5'));var logger=require(_0xb44a('0x6'))(_0xb44a('0x7'));var config=require('../../config/environment');var jayson=require(_0xb44a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45d1ab,_0x545071,_0x13d9ab){return new BPromise(function(_0x1ed749,_0x5582f2){return client[_0xb44a('0x9')](_0x45d1ab,_0x13d9ab)[_0xb44a('0xa')](function(_0x1b9361){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x545071,'request\x20sent');logger['debug'](_0xb44a('0xb'),_0x545071,_0xb44a('0xc'),JSON[_0xb44a('0xd')](_0x1b9361));if(_0x1b9361[_0xb44a('0xe')]){if(_0x1b9361['error'][_0xb44a('0xf')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x545071,_0x1b9361['error'][_0xb44a('0x10')]);return _0x5582f2(_0x1b9361[_0xb44a('0xe')][_0xb44a('0x10')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x545071,_0x1b9361[_0xb44a('0xe')]['message']);return _0x1ed749(_0x1b9361['error'][_0xb44a('0x10')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x545071,_0xb44a('0xc'));_0x1ed749(_0x1b9361[_0xb44a('0x11')][_0xb44a('0x10')]);}})[_0xb44a('0x12')](function(_0x18c13f){logger[_0xb44a('0xe')](_0xb44a('0x13'),_0x545071,_0x18c13f);_0x5582f2(_0x18c13f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index bf04b46..afaa8f4 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 _0x435c=['/:id/sessions','getSessions','/:id/answers','/:id/summary','post','create','clone','put','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x26dd36,_0x231f1a){var _0x9d7b3f=function(_0x5e440e){while(--_0x5e440e){_0x26dd36['push'](_0x26dd36['shift']());}};_0x9d7b3f(++_0x231f1a);}(_0x435c,0x145));var _0xc435=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x435c[_0x1a89a1];return _0x3d5b46;};'use strict';var multer=require(_0xc435('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc435('0x1'));var express=require(_0xc435('0x2'));var router=express['Router']();var fs_extra=require(_0xc435('0x3'));var auth=require(_0xc435('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc435('0x5'));router[_0xc435('0x6')]('/',auth[_0xc435('0x7')](),controller[_0xc435('0x8')]);router[_0xc435('0x6')](_0xc435('0x9'),auth[_0xc435('0x7')](),controller[_0xc435('0xa')]);router['get'](_0xc435('0xb'),auth['isAuthenticated'](),controller[_0xc435('0xc')]);router['get'](_0xc435('0xd'),auth[_0xc435('0x7')](),controller['getAnswers']);router[_0xc435('0x6')](_0xc435('0xe'),auth[_0xc435('0x7')](),timeout('30s'),controller['getSummary']);router[_0xc435('0xf')]('/',auth['isAuthenticated'](),controller[_0xc435('0x10')]);router[_0xc435('0xf')]('/:id/clone',auth[_0xc435('0x7')](),controller[_0xc435('0x11')]);router[_0xc435('0x12')](_0xc435('0x9'),auth[_0xc435('0x7')](),controller['update']);router['delete'](_0xc435('0x9'),auth['isAuthenticated'](),controller[_0xc435('0x13')]);module[_0xc435('0x14')]=router; \ No newline at end of file +var _0x0846=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','clone','update','delete','destroy','exports','util'];(function(_0x42938d,_0x6c4e79){var _0x435ef0=function(_0x57605b){while(--_0x57605b){_0x42938d['push'](_0x42938d['shift']());}};_0x435ef0(++_0x6c4e79);}(_0x0846,0x6b));var _0x6084=function(_0xe5d56d,_0x397098){_0xe5d56d=_0xe5d56d-0x0;var _0x1a2420=_0x0846[_0xe5d56d];return _0x1a2420;};'use strict';var multer=require('multer');var util=require(_0x6084('0x0'));var path=require(_0x6084('0x1'));var timeout=require(_0x6084('0x2'));var express=require(_0x6084('0x3'));var router=express[_0x6084('0x4')]();var fs_extra=require(_0x6084('0x5'));var auth=require(_0x6084('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6084('0x7'));var controller=require(_0x6084('0x8'));router[_0x6084('0x9')]('/',auth[_0x6084('0xa')](),controller[_0x6084('0xb')]);router['get'](_0x6084('0xc'),auth[_0x6084('0xa')](),controller[_0x6084('0xd')]);router[_0x6084('0x9')](_0x6084('0xe'),auth['isAuthenticated'](),controller[_0x6084('0xf')]);router[_0x6084('0x9')](_0x6084('0x10'),auth[_0x6084('0xa')](),controller[_0x6084('0x11')]);router['get'](_0x6084('0x12'),auth[_0x6084('0xa')](),timeout(_0x6084('0x13')),controller['getSummary']);router[_0x6084('0x14')]('/',auth[_0x6084('0xa')](),controller[_0x6084('0x15')]);router[_0x6084('0x14')]('/:id/clone',auth[_0x6084('0xa')](),controller[_0x6084('0x16')]);router['put']('/:id',auth[_0x6084('0xa')](),controller[_0x6084('0x17')]);router[_0x6084('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6084('0x19')]);module[_0x6084('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 18cac5f..fcc3ff1 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 _0xcfd7=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','STRING','TEXT','long','setDataValue','stringify','formData','format'];(function(_0x271ce8,_0x4062eb){var _0x69abd5=function(_0x57dd27){while(--_0x57dd27){_0x271ce8['push'](_0x271ce8['shift']());}};_0x69abd5(++_0x4062eb);}(_0xcfd7,0xc7));var _0x7cfd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7cfd('0x0'));var util=require(_0x7cfd('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x7cfd('0x2')]},'formData':{'type':Sequelize[_0x7cfd('0x3')](_0x7cfd('0x4')),'set':function(_0x2e2036){if(_['isObjectLike'](_0x2e2036)){this[_0x7cfd('0x5')]('formData',JSON[_0x7cfd('0x6')](_0x2e2036));}else if(_['isString'](_0x2e2036)){this[_0x7cfd('0x5')](_0x7cfd('0x7'),_0x2e2036);}else{this[_0x7cfd('0x5')]('formData',util[_0x7cfd('0x8')](_0x7cfd('0x9'),this[_0x7cfd('0xa')]('name')||'',this[_0x7cfd('0xa')](_0x7cfd('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7cfd('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x8fdc=['BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','isString','format','getDataValue'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x8fdc,0x151));var _0xc8fd=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x8fdc[_0x450689];return _0x46ffb0;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc8fd('0x0'));var util=require(_0xc8fd('0x1'));module[_0xc8fd('0x2')]={'name':{'type':Sequelize[_0xc8fd('0x3')],'unique':_0xc8fd('0x4')},'description':{'type':Sequelize[_0xc8fd('0x3')]},'formData':{'type':Sequelize[_0xc8fd('0x5')](_0xc8fd('0x6')),'set':function(_0x14853b){if(_[_0xc8fd('0x7')](_0x14853b)){this[_0xc8fd('0x8')](_0xc8fd('0x9'),JSON['stringify'](_0x14853b));}else if(_[_0xc8fd('0xa')](_0x14853b)){this['setDataValue'](_0xc8fd('0x9'),_0x14853b);}else{this['setDataValue'](_0xc8fd('0x9'),util[_0xc8fd('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xc8fd('0xc')](_0xc8fd('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc8fd('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 86aed52..cf2c5b9 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 _0x5b1c=['Content-Range','reject','save','update','then','get','Projects','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','JscriptyProject','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','where','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','clone','omit','updatedAt','createdAt','getSessions','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x5b1c,0x1b9));var _0xc5b1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5b1c[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xc5b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5b1('0x1'));var jsonpatch=require(_0xc5b1('0x2'));var rp=require(_0xc5b1('0x3'));var moment=require(_0xc5b1('0x4'));var BPromise=require(_0xc5b1('0x5'));var Mustache=require(_0xc5b1('0x6'));var util=require(_0xc5b1('0x7'));var path=require(_0xc5b1('0x8'));var sox=require(_0xc5b1('0x9'));var csv=require(_0xc5b1('0xa'));var ejs=require(_0xc5b1('0xb'));var fs=require('fs');var fs_extra=require(_0xc5b1('0xc'));var _=require(_0xc5b1('0xd'));var squel=require(_0xc5b1('0xe'));var crypto=require(_0xc5b1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc5b1('0x10'));var toCsv=require(_0xc5b1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5b1('0x11'));var authService=require(_0xc5b1('0x12'));var qs=require(_0xc5b1('0x13'));var as=require(_0xc5b1('0x14'));var hardwareService=require(_0xc5b1('0x15'));var logger=require(_0xc5b1('0x16'))(_0xc5b1('0x17'));var utils=require(_0xc5b1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc5b1('0x19'));var db=require(_0xc5b1('0x1a'))['db'];function respondWithStatusCode(_0x445ea2,_0x8aff8f){_0x8aff8f=_0x8aff8f||0xcc;return function(_0x495ece){if(_0x495ece){return _0x445ea2['sendStatus'](_0x8aff8f);}return _0x445ea2[_0xc5b1('0x1b')](_0x8aff8f)[_0xc5b1('0x1c')]();};}function respondWithResult(_0x10537b,_0x2f3a80){_0x2f3a80=_0x2f3a80||0xc8;return function(_0x406c65){if(_0x406c65){return _0x10537b[_0xc5b1('0x1b')](_0x2f3a80)[_0xc5b1('0x1d')](_0x406c65);}};}function respondWithFilteredResult(_0x1abae8,_0x31431c){return function(_0x5a61fa){if(_0x5a61fa){var _0x4880d1=typeof _0x31431c[_0xc5b1('0x1e')]==='undefined'&&typeof _0x31431c[_0xc5b1('0x1f')]===_0xc5b1('0x20');var _0x3bc11b=_0x5a61fa[_0xc5b1('0x21')];var _0x5a6213=_0x4880d1?0x0:_0x31431c[_0xc5b1('0x1e')];var _0x31190f=_0x4880d1?_0x5a61fa[_0xc5b1('0x21')]:_0x31431c[_0xc5b1('0x1e')]+_0x31431c[_0xc5b1('0x1f')];var _0x4a9527;if(_0x31190f>=_0x3bc11b){_0x31190f=_0x3bc11b;_0x4a9527=0xc8;}else{_0x4a9527=0xce;}_0x1abae8['status'](_0x4a9527);return _0x1abae8[_0xc5b1('0x22')](_0xc5b1('0x23'),_0x5a6213+'-'+_0x31190f+'/'+_0x3bc11b)[_0xc5b1('0x1d')](_0x5a61fa);}return null;};}function patchUpdates(_0x5961b4){return function(_0x3aecec){try{jsonpatch['apply'](_0x3aecec,_0x5961b4,!![]);}catch(_0xa58289){return BPromise[_0xc5b1('0x24')](_0xa58289);}return _0x3aecec[_0xc5b1('0x25')]();};}function saveUpdates(_0x3891f4,_0x24335f){return function(_0x13cdab){if(_0x13cdab){return _0x13cdab[_0xc5b1('0x26')](_0x3891f4)[_0xc5b1('0x27')](function(_0xe7acf3){return _0xe7acf3;});}return null;};}function removeEntity(_0x48f28d,_0x51b37b){return function(_0x119af5){if(_0x119af5){return _0x119af5['destroy']()['then'](function(){var _0xb4bd4c=_0x119af5[_0xc5b1('0x28')]({'plain':!![]});var _0x53e9f9=_0xc5b1('0x29');return db[_0xc5b1('0x2a')][_0xc5b1('0x2b')]({'where':{'type':_0x53e9f9,'resourceId':_0xb4bd4c['id']}})['then'](function(){return _0x119af5;});})[_0xc5b1('0x27')](function(){_0x48f28d[_0xc5b1('0x1b')](0xcc)[_0xc5b1('0x1c')]();});}};}function handleEntityNotFound(_0x1632c3,_0xa0b9bc){return function(_0x441e48){if(!_0x441e48){_0x1632c3[_0xc5b1('0x2c')](0x194);}return _0x441e48;};}function handleError(_0x188753,_0x3b510a){_0x3b510a=_0x3b510a||0x1f4;return function(_0x37fca1){logger[_0xc5b1('0x2d')](_0x37fca1[_0xc5b1('0x2e')]);if(_0x37fca1[_0xc5b1('0x2f')]){delete _0x37fca1[_0xc5b1('0x2f')];}_0x188753[_0xc5b1('0x1b')](_0x3b510a)[_0xc5b1('0x30')](_0x37fca1);};}exports[_0xc5b1('0x31')]=function(_0x125075,_0x3f4ae0){var _0x6ba578={},_0x2fe48d={},_0x1fc834={'count':0x0,'rows':[]};var _0x1c19d2=_['map'](db[_0xc5b1('0x32')]['rawAttributes'],function(_0x42930f){return{'name':_0x42930f[_0xc5b1('0x33')],'type':_0x42930f[_0xc5b1('0x34')][_0xc5b1('0x35')]};});_0x2fe48d[_0xc5b1('0x36')]=_[_0xc5b1('0x37')](_0x1c19d2,_0xc5b1('0x2f'));_0x2fe48d[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x125075[_0xc5b1('0x38')]);_0x2fe48d[_0xc5b1('0x3a')]=_[_0xc5b1('0x3b')](_0x2fe48d[_0xc5b1('0x36')],_0x2fe48d[_0xc5b1('0x38')]);_0x6ba578[_0xc5b1('0x3c')]=_['intersection'](_0x2fe48d[_0xc5b1('0x36')],qs[_0xc5b1('0x3d')](_0x125075['query'][_0xc5b1('0x3d')]));_0x6ba578[_0xc5b1('0x3c')]=_0x6ba578[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x6ba578[_0xc5b1('0x3c')]:_0x2fe48d[_0xc5b1('0x36')];if(!_0x125075[_0xc5b1('0x38')][_0xc5b1('0x3f')](_0xc5b1('0x40'))){_0x6ba578[_0xc5b1('0x1f')]=qs[_0xc5b1('0x1f')](_0x125075[_0xc5b1('0x38')]['limit']);_0x6ba578[_0xc5b1('0x1e')]=qs[_0xc5b1('0x1e')](_0x125075[_0xc5b1('0x38')][_0xc5b1('0x1e')]);}_0x6ba578[_0xc5b1('0x41')]=qs[_0xc5b1('0x42')](_0x125075[_0xc5b1('0x38')][_0xc5b1('0x42')]);_0x6ba578['where']=qs[_0xc5b1('0x3a')](_['pick'](_0x125075[_0xc5b1('0x38')],_0x2fe48d['filters']),_0x1c19d2);if(_0x125075['query'][_0xc5b1('0x43')]){_0x6ba578['where']=_[_0xc5b1('0x44')](_0x6ba578['where'],{'$or':_[_0xc5b1('0x37')](_0x1c19d2,function(_0x12a5be){if(_0x12a5be[_0xc5b1('0x34')]!==_0xc5b1('0x45')){var _0x241660={};_0x241660[_0x12a5be[_0xc5b1('0x2f')]]={'$like':'%'+_0x125075[_0xc5b1('0x38')]['filter']+'%'};return _0x241660;}})});}_0x6ba578=_[_0xc5b1('0x44')]({},_0x6ba578,_0x125075['options']);var _0x2db05f={'where':_0x6ba578[_0xc5b1('0x46')]};return db['JscriptyProject'][_0xc5b1('0x21')](_0x2db05f)[_0xc5b1('0x27')](function(_0x3e3b0a){_0x1fc834[_0xc5b1('0x21')]=_0x3e3b0a;if(_0x125075[_0xc5b1('0x38')][_0xc5b1('0x47')]){_0x6ba578[_0xc5b1('0x48')]=[{'all':!![]}];}return db[_0xc5b1('0x32')][_0xc5b1('0x49')](_0x6ba578);})[_0xc5b1('0x27')](function(_0x41dfd8){_0x1fc834['rows']=_0x41dfd8;return _0x1fc834;})['then'](respondWithFilteredResult(_0x3f4ae0,_0x6ba578))[_0xc5b1('0x4a')](handleError(_0x3f4ae0,null));};exports[_0xc5b1('0x4b')]=function(_0x29c517,_0x35ec2c){var _0x58bd13={'raw':![],'where':{'id':_0x29c517[_0xc5b1('0x4c')]['id']}},_0x431ba8={};_0x431ba8[_0xc5b1('0x36')]=_[_0xc5b1('0x39')](db['JscriptyProject'][_0xc5b1('0x4d')]);_0x431ba8[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x29c517[_0xc5b1('0x38')]);_0x431ba8[_0xc5b1('0x3a')]=_[_0xc5b1('0x3b')](_0x431ba8[_0xc5b1('0x36')],_0x431ba8[_0xc5b1('0x38')]);_0x58bd13[_0xc5b1('0x3c')]=_[_0xc5b1('0x3b')](_0x431ba8[_0xc5b1('0x36')],qs[_0xc5b1('0x3d')](_0x29c517[_0xc5b1('0x38')][_0xc5b1('0x3d')]));_0x58bd13[_0xc5b1('0x3c')]=_0x58bd13[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x58bd13[_0xc5b1('0x3c')]:_0x431ba8[_0xc5b1('0x36')];if(_0x29c517[_0xc5b1('0x38')]['includeAll']){_0x58bd13[_0xc5b1('0x48')]=[{'all':!![]}];}_0x58bd13=_[_0xc5b1('0x44')]({},_0x58bd13,_0x29c517[_0xc5b1('0x4e')]);return db['JscriptyProject']['find'](_0x58bd13)[_0xc5b1('0x27')](handleEntityNotFound(_0x35ec2c,null))['then'](respondWithResult(_0x35ec2c,null))[_0xc5b1('0x4a')](handleError(_0x35ec2c,null));};exports[_0xc5b1('0x4f')]=function(_0x5d748d,_0x3c6f42){return db[_0xc5b1('0x32')]['create'](_0x5d748d[_0xc5b1('0x50')],{})['then'](function(_0x14ce4b){var _0x19a358=_0x5d748d[_0xc5b1('0x51')][_0xc5b1('0x28')]({'plain':!![]});if(!_0x19a358)throw new Error(_0xc5b1('0x52'));if(_0x19a358[_0xc5b1('0x53')]===_0xc5b1('0x51')){var _0x542e89=_0x14ce4b[_0xc5b1('0x28')]({'plain':!![]});var _0x26efe4=_0xc5b1('0x29');return db['UserProfileSection'][_0xc5b1('0x54')]({'where':{'name':_0x26efe4,'userProfileId':_0x19a358['userProfileId']},'raw':!![]})['then'](function(_0x325760){if(_0x325760&&_0x325760[_0xc5b1('0x55')]===0x0){return db[_0xc5b1('0x2a')][_0xc5b1('0x4f')]({'name':_0x542e89[_0xc5b1('0x2f')],'resourceId':_0x542e89['id'],'type':_0x325760[_0xc5b1('0x2f')],'sectionId':_0x325760['id']},{})[_0xc5b1('0x27')](function(){return _0x14ce4b;});}else{return _0x14ce4b;}})['catch'](function(_0x3d4a05){logger[_0xc5b1('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d4a05);throw _0x3d4a05;});}return _0x14ce4b;})[_0xc5b1('0x27')](respondWithResult(_0x3c6f42,0xc9))[_0xc5b1('0x4a')](handleError(_0x3c6f42,null));};exports[_0xc5b1('0x56')]=function(_0x5c6d77,_0x1154af){var _0x5f06a7={'where':{'id':_0x5c6d77[_0xc5b1('0x4c')]['id']}},_0x3151ec={};_0x3151ec[_0xc5b1('0x36')]=_['keys'](db[_0xc5b1('0x32')]['rawAttributes']);_0x5f06a7[_0xc5b1('0x3c')]=_['intersection'](_0x3151ec['model'],qs[_0xc5b1('0x3d')](_0x5c6d77['query'][_0xc5b1('0x3d')]));_0x5f06a7['attributes']=_0x5f06a7[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x5f06a7[_0xc5b1('0x3c')]:_0x3151ec[_0xc5b1('0x36')];if(_0x5c6d77[_0xc5b1('0x38')][_0xc5b1('0x47')]){_0x5f06a7[_0xc5b1('0x48')]=[{'all':!![]}];}_0x5f06a7=_[_0xc5b1('0x44')]({},_0x5f06a7,_0x5c6d77[_0xc5b1('0x4e')]);return db[_0xc5b1('0x32')][_0xc5b1('0x54')](_0x5f06a7)[_0xc5b1('0x27')](handleEntityNotFound(_0x1154af,null))[_0xc5b1('0x27')](function(_0x5bc73a){if(_0x5bc73a){var _0x5ffd1e=_0x5bc73a['get']({'plain':!![]});_0x5ffd1e=qs[_0xc5b1('0x57')](_0x5ffd1e,['id','createdAt',_0xc5b1('0x58')]);_0x5c6d77[_0xc5b1('0x50')]=_[_0xc5b1('0x57')](_0x5c6d77['body'],['id',_0xc5b1('0x59'),'updatedAt']);return db[_0xc5b1('0x32')][_0xc5b1('0x4f')](_[_0xc5b1('0x44')](_0x5ffd1e,_0x5c6d77['body']),{'include':_0x5c6d77[_0xc5b1('0x38')][_0xc5b1('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x34d070){var _0x4655f2=_0x5c6d77[_0xc5b1('0x51')][_0xc5b1('0x28')]({'plain':!![]});if(!_0x4655f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4655f2[_0xc5b1('0x53')]===_0xc5b1('0x51')){var _0x3721ce=_0x34d070[_0xc5b1('0x28')]({'plain':!![]});var _0x45a206=_0xc5b1('0x29');return db['UserProfileSection'][_0xc5b1('0x54')]({'where':{'name':_0x45a206,'userProfileId':_0x4655f2['userProfileId']},'raw':!![]})['then'](function(_0x38c925){if(_0x38c925&&_0x38c925[_0xc5b1('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x3721ce[_0xc5b1('0x2f')],'resourceId':_0x3721ce['id'],'type':_0x38c925[_0xc5b1('0x2f')],'sectionId':_0x38c925['id']},{})[_0xc5b1('0x27')](function(){return _0x34d070;});}else{return _0x34d070;}})[_0xc5b1('0x4a')](function(_0x349c6b){logger[_0xc5b1('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x349c6b);throw _0x349c6b;});}return _0x34d070;});}})[_0xc5b1('0x27')](respondWithResult(_0x1154af,0xc9))['catch'](handleError(_0x1154af,null));};exports[_0xc5b1('0x26')]=function(_0x19f99e,_0x3a5a72){if(_0x19f99e[_0xc5b1('0x50')]['id']){delete _0x19f99e[_0xc5b1('0x50')]['id'];}return db['JscriptyProject'][_0xc5b1('0x54')]({'where':{'id':_0x19f99e[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x3a5a72,null))['then'](saveUpdates(_0x19f99e[_0xc5b1('0x50')],null))[_0xc5b1('0x27')](respondWithResult(_0x3a5a72,null))[_0xc5b1('0x4a')](handleError(_0x3a5a72,null));};exports[_0xc5b1('0x2b')]=function(_0x4b0fa6,_0x2c6ebc){return db[_0xc5b1('0x32')][_0xc5b1('0x54')]({'where':{'id':_0x4b0fa6[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x2c6ebc,null))['then'](removeEntity(_0x2c6ebc,null))[_0xc5b1('0x4a')](handleError(_0x2c6ebc,null));};exports[_0xc5b1('0x5a')]=function(_0x5675f5,_0x31b74a,_0x568700){var _0x16b75c={'raw':!![],'where':{}};var _0x3e4ae9={};var _0x27a99c={'count':0x0,'rows':[]};return db[_0xc5b1('0x32')]['findOne']({'where':{'id':_0x5675f5[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x31b74a,null))[_0xc5b1('0x27')](function(_0x3d460b){if(_0x3d460b){_0x3e4ae9[_0xc5b1('0x36')]=_[_0xc5b1('0x39')](db[_0xc5b1('0x5b')][_0xc5b1('0x4d')]);_0x3e4ae9[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x5675f5[_0xc5b1('0x38')]);_0x3e4ae9[_0xc5b1('0x3a')]=_['intersection'](_0x3e4ae9['model'],_0x3e4ae9[_0xc5b1('0x38')]);_0x16b75c['attributes']=_[_0xc5b1('0x3b')](_0x3e4ae9[_0xc5b1('0x36')],qs['fields'](_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x3d')]));_0x16b75c[_0xc5b1('0x3c')]=_0x16b75c[_0xc5b1('0x3c')][_0xc5b1('0x3e')]?_0x16b75c[_0xc5b1('0x3c')]:_0x3e4ae9[_0xc5b1('0x36')];if(!_0x5675f5[_0xc5b1('0x38')]['hasOwnProperty'](_0xc5b1('0x40'))){_0x16b75c[_0xc5b1('0x1f')]=qs[_0xc5b1('0x1f')](_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x1f')]);_0x16b75c[_0xc5b1('0x1e')]=qs[_0xc5b1('0x1e')](_0x5675f5[_0xc5b1('0x38')]['offset']);}_0x16b75c[_0xc5b1('0x41')]=qs['sort'](_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x42')]);_0x16b75c[_0xc5b1('0x46')]=qs['filters'](_[_0xc5b1('0x5c')](_0x5675f5[_0xc5b1('0x38')],_0x3e4ae9[_0xc5b1('0x3a')]));_0x16b75c[_0xc5b1('0x46')][_0xc5b1('0x5d')]=_0x3d460b['id'];if(_0x5675f5['query']['filter']){_0x16b75c[_0xc5b1('0x46')]=_[_0xc5b1('0x44')](_0x16b75c['where'],{'$or':_[_0xc5b1('0x37')](_0x16b75c[_0xc5b1('0x3c')],function(_0x145a79){var _0x5eaab0={};_0x5eaab0[_0x145a79]={'$like':'%'+_0x5675f5[_0xc5b1('0x38')][_0xc5b1('0x43')]+'%'};return _0x5eaab0;})});}_0x16b75c=_[_0xc5b1('0x44')]({},_0x16b75c,_0x5675f5[_0xc5b1('0x4e')]);return db[_0xc5b1('0x5b')][_0xc5b1('0x21')]({'where':_0x16b75c['where']})['then'](function(_0x254c88){_0x27a99c[_0xc5b1('0x21')]=_0x254c88;if(_0x5675f5['query'][_0xc5b1('0x47')]){_0x16b75c[_0xc5b1('0x48')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc5b1('0x49')](_0x16b75c);})[_0xc5b1('0x27')](function(_0x430292){_0x27a99c[_0xc5b1('0x5e')]=_0x430292;return _0x27a99c;});}})[_0xc5b1('0x27')](respondWithFilteredResult(_0x31b74a,_0x16b75c))['catch'](handleError(_0x31b74a,null));};exports[_0xc5b1('0x5f')]=function(_0x585192,_0x57480b,_0x54b42a){var _0x34aabc={'raw':!![],'where':{}};var _0x2f86b8={};var _0x533b9b={'count':0x0,'rows':[]};return db[_0xc5b1('0x32')]['findOne']({'where':{'id':_0x585192[_0xc5b1('0x4c')]['id']}})[_0xc5b1('0x27')](handleEntityNotFound(_0x57480b,null))['then'](function(_0x20c89d){if(_0x20c89d){_0x2f86b8[_0xc5b1('0x36')]=_[_0xc5b1('0x39')](db[_0xc5b1('0x60')][_0xc5b1('0x4d')]);_0x2f86b8[_0xc5b1('0x38')]=_[_0xc5b1('0x39')](_0x585192[_0xc5b1('0x38')]);_0x2f86b8[_0xc5b1('0x3a')]=_['intersection'](_0x2f86b8[_0xc5b1('0x36')],_0x2f86b8[_0xc5b1('0x38')]);_0x34aabc['attributes']=_[_0xc5b1('0x3b')](_0x2f86b8[_0xc5b1('0x36')],qs['fields'](_0x585192['query'][_0xc5b1('0x3d')]));_0x34aabc[_0xc5b1('0x3c')]=_0x34aabc['attributes']['length']?_0x34aabc[_0xc5b1('0x3c')]:_0x2f86b8['model'];if(!_0x585192[_0xc5b1('0x38')][_0xc5b1('0x3f')](_0xc5b1('0x40'))){_0x34aabc[_0xc5b1('0x1f')]=qs[_0xc5b1('0x1f')](_0x585192[_0xc5b1('0x38')]['limit']);_0x34aabc[_0xc5b1('0x1e')]=qs['offset'](_0x585192[_0xc5b1('0x38')]['offset']);}_0x34aabc[_0xc5b1('0x41')]=qs[_0xc5b1('0x42')](_0x585192[_0xc5b1('0x38')][_0xc5b1('0x42')]);_0x34aabc['where']=qs['filters'](_[_0xc5b1('0x5c')](_0x585192['query'],_0x2f86b8[_0xc5b1('0x3a')]));_0x34aabc[_0xc5b1('0x46')]['ProjectId']=_0x20c89d['id'];if(_0x585192[_0xc5b1('0x38')][_0xc5b1('0x43')]){_0x34aabc['where']=_[_0xc5b1('0x44')](_0x34aabc[_0xc5b1('0x46')],{'$or':_[_0xc5b1('0x37')](_0x34aabc['attributes'],function(_0x3eb209){var _0x3fb675={};_0x3fb675[_0x3eb209]={'$like':'%'+_0x585192['query'][_0xc5b1('0x43')]+'%'};return _0x3fb675;})});}_0x34aabc=_[_0xc5b1('0x44')]({},_0x34aabc,_0x585192[_0xc5b1('0x4e')]);return db[_0xc5b1('0x60')]['count']({'where':_0x34aabc[_0xc5b1('0x46')]})[_0xc5b1('0x27')](function(_0x239133){_0x533b9b[_0xc5b1('0x21')]=_0x239133;if(_0x585192['query']['includeAll']){_0x34aabc[_0xc5b1('0x48')]=[{'all':!![]}];}return db[_0xc5b1('0x60')][_0xc5b1('0x49')](_0x34aabc);})[_0xc5b1('0x27')](function(_0x2a3692){_0x533b9b[_0xc5b1('0x5e')]=_0x2a3692;return _0x533b9b;});}})[_0xc5b1('0x27')](respondWithFilteredResult(_0x57480b,_0x34aabc))[_0xc5b1('0x4a')](handleError(_0x57480b,null));};function char(_0x81091f){return'number'===typeof _0x81091f?String[_0xc5b1('0x61')][_0xc5b1('0x62')](null,arguments):_0x81091f;}function needsEncapsulation(_0x38fbd7){return!!_0x38fbd7&&(_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0xd))>=0x0||_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0xa))>=0x0||_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0x2c))>=0x0||_0x38fbd7[_0xc5b1('0x63')]()[_0xc5b1('0x64')](char(0x22))>=0x0);}function encapsulate(_0x6fe0d7){var _0x41b185=char(0x22),_0x356b2c='\x5c'+char(0x22),_0x2cf570=_0x6fe0d7[_0xc5b1('0x63')]()[_0xc5b1('0x65')](new RegExp(_0x41b185,'g'),_0x356b2c);return _0x41b185+_0x2cf570+_0x41b185;}exports[_0xc5b1('0x66')]=function(_0x543a45,_0x5d562e,_0x3a9360){var _0x1955a1,_0x2352f2;var _0x4cd79a={'where':{'ProjectId':_0x543a45[_0xc5b1('0x4c')]['id']}};if(_0x543a45[_0xc5b1('0x38')][_0xc5b1('0x67')]){_0x4cd79a[_0xc5b1('0x46')][_0xc5b1('0x68')]=JSON['parse'](_0x543a45[_0xc5b1('0x38')]['startTime']);}return db[_0xc5b1('0x5b')][_0xc5b1('0x49')](_0x4cd79a)[_0xc5b1('0x27')](handleEntityNotFound(_0x5d562e,null))[_0xc5b1('0x27')](function(_0x1c6902){if(_0x1c6902){_0x1955a1=_0x1c6902;return db[_0xc5b1('0x69')][_0xc5b1('0x49')]({'where':{'SessionId':{'$in':_['map'](_0x1955a1,'id')},'ProjectId':_0x543a45[_0xc5b1('0x4c')]['id']},'order':'-createdAt'});}})[_0xc5b1('0x27')](handleEntityNotFound(_0x5d562e,null))[_0xc5b1('0x27')](function(_0x288dec){if(_0x288dec){_0x2352f2=_0x288dec;var _0x2f8d5f={};for(var _0x6631a9=0x0,_0x26d0ff=_0x2352f2[_0xc5b1('0x3e')];_0x6631a9<_0x26d0ff;_0x6631a9++){if(!_0x2f8d5f[_0xc5b1('0x3f')](_0x2352f2[_0x6631a9][_0xc5b1('0x6a')])){_0x2f8d5f[_0x2352f2[_0x6631a9][_0xc5b1('0x6a')]]=needsEncapsulation(_0x2352f2[_0x6631a9][_0xc5b1('0x6b')])?encapsulate(_0x2352f2[_0x6631a9]['question']):_0x2352f2[_0x6631a9][_0xc5b1('0x6b')];}}var _0xa8e8e0=[],_0x42aa68={};for(var _0x570af4=0x0,_0x377e90=_0x1955a1['length'];_0x570af4<_0x377e90;_0x570af4++){_0x42aa68={'ProjectId':_0x543a45[_0xc5b1('0x4c')]['id'],'SessionId':_0x1955a1[_0x570af4]['id'],'StartTime':moment(_0x1955a1[_0x570af4][_0xc5b1('0x68')])['format'](_0xc5b1('0x6c'))};for(var _0x2f3dd7=0x0,_0x181436=_0x2352f2[_0xc5b1('0x3e')];_0x2f3dd7<_0x181436;_0x2f3dd7++){if(_0x2352f2[_0x2f3dd7][_0xc5b1('0x6d')]==_0x1955a1[_0x570af4]['id']&&_0x2f8d5f[_0xc5b1('0x3f')](_0x2352f2[_0x2f3dd7][_0xc5b1('0x6a')])){_0x42aa68[_0x2f8d5f[_0x2352f2[_0x2f3dd7][_0xc5b1('0x6a')]]]=_0x2352f2[_0x2f3dd7][_0xc5b1('0x6e')];}}for(var _0x5e46f4 in _0x2f8d5f){if(!_0x42aa68[_0xc5b1('0x3f')](_0x2f8d5f[_0x5e46f4])){_0x42aa68[_0x2f8d5f[_0x5e46f4]]=null;}}_0xa8e8e0[_0xc5b1('0x6f')](_0x42aa68);}return _0xa8e8e0;}})[_0xc5b1('0x27')](function(_0x1f9136){if(!_[_0xc5b1('0x70')](_0x1f9136)){var _0x55e041=toCsv(_0x1f9136);var _0x21fe4e=Date['now']();fs['writeFileSync'](util[_0xc5b1('0x71')](_0xc5b1('0x72'),_0x543a45[_0xc5b1('0x4c')]['id'],_0x21fe4e),_0x55e041);_0x5d562e[_0xc5b1('0x73')](_0xc5b1('0x74'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x543a45[_0xc5b1('0x4c')]['id'],_0x21fe4e));_0x5d562e[_0xc5b1('0x73')](_0xc5b1('0x75'),'text/csv');return _0x5d562e[_0xc5b1('0x76')](util[_0xc5b1('0x71')](_0xc5b1('0x72'),_0x543a45[_0xc5b1('0x4c')]['id'],_0x21fe4e));}else{return _0x5d562e[_0xc5b1('0x2c')](0xcc);}})[_0xc5b1('0x4a')](handleError(_0x5d562e,null));}; \ No newline at end of file +var _0x37e9=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Projects','error','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x37e9,0x1e7));var _0x937e=function(_0x19f947,_0x2d5cd1){_0x19f947=_0x19f947-0x0;var _0x18d826=_0x37e9[_0x19f947];return _0x18d826;};'use strict';var emlformat=require(_0x937e('0x0'));var rimraf=require(_0x937e('0x1'));var zipdir=require(_0x937e('0x2'));var jsonpatch=require(_0x937e('0x3'));var rp=require(_0x937e('0x4'));var moment=require(_0x937e('0x5'));var BPromise=require(_0x937e('0x6'));var Mustache=require('mustache');var util=require(_0x937e('0x7'));var path=require(_0x937e('0x8'));var sox=require(_0x937e('0x9'));var csv=require(_0x937e('0xa'));var ejs=require(_0x937e('0xb'));var fs=require('fs');var fs_extra=require(_0x937e('0xc'));var _=require('lodash');var squel=require(_0x937e('0xd'));var crypto=require(_0x937e('0xe'));var jsforce=require(_0x937e('0xf'));var deskjs=require(_0x937e('0x10'));var toCsv=require(_0x937e('0xa'));var querystring=require(_0x937e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x937e('0x12'));var qs=require(_0x937e('0x13'));var as=require(_0x937e('0x14'));var hardwareService=require(_0x937e('0x15'));var logger=require(_0x937e('0x16'))(_0x937e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x937e('0x18'))['db'];function respondWithStatusCode(_0x284f27,_0x49a1b6){_0x49a1b6=_0x49a1b6||0xcc;return function(_0x216c24){if(_0x216c24){return _0x284f27[_0x937e('0x19')](_0x49a1b6);}return _0x284f27[_0x937e('0x1a')](_0x49a1b6)[_0x937e('0x1b')]();};}function respondWithResult(_0x4f4f21,_0x369119){_0x369119=_0x369119||0xc8;return function(_0x1ea9e2){if(_0x1ea9e2){return _0x4f4f21[_0x937e('0x1a')](_0x369119)[_0x937e('0x1c')](_0x1ea9e2);}};}function respondWithFilteredResult(_0x5ab042,_0x2ebfdd){return function(_0x3b09ff){if(_0x3b09ff){var _0x4499a2=typeof _0x2ebfdd[_0x937e('0x1d')]===_0x937e('0x1e')&&typeof _0x2ebfdd[_0x937e('0x1f')]===_0x937e('0x1e');var _0x16682c=_0x3b09ff['count'];var _0x5a1542=_0x4499a2?0x0:_0x2ebfdd[_0x937e('0x1d')];var _0x13683f=_0x4499a2?_0x3b09ff[_0x937e('0x20')]:_0x2ebfdd[_0x937e('0x1d')]+_0x2ebfdd[_0x937e('0x1f')];var _0x1d740e;if(_0x13683f>=_0x16682c){_0x13683f=_0x16682c;_0x1d740e=0xc8;}else{_0x1d740e=0xce;}_0x5ab042[_0x937e('0x1a')](_0x1d740e);return _0x5ab042[_0x937e('0x21')](_0x937e('0x22'),_0x5a1542+'-'+_0x13683f+'/'+_0x16682c)['json'](_0x3b09ff);}return null;};}function patchUpdates(_0x25c1e3){return function(_0x155f36){try{jsonpatch['apply'](_0x155f36,_0x25c1e3,!![]);}catch(_0x58e262){return BPromise[_0x937e('0x23')](_0x58e262);}return _0x155f36[_0x937e('0x24')]();};}function saveUpdates(_0x5706b1,_0x3de0f2){return function(_0x5ae493){if(_0x5ae493){return _0x5ae493[_0x937e('0x25')](_0x5706b1)[_0x937e('0x26')](function(_0x218ddc){return _0x218ddc;});}return null;};}function removeEntity(_0xdf7ea8,_0x132ece){return function(_0x58d3dc){if(_0x58d3dc){return _0x58d3dc[_0x937e('0x27')]()[_0x937e('0x26')](function(){var _0x35d24a=_0x58d3dc[_0x937e('0x28')]({'plain':!![]});var _0x41ab49=_0x937e('0x29');return db['UserProfileResource'][_0x937e('0x27')]({'where':{'type':_0x41ab49,'resourceId':_0x35d24a['id']}})[_0x937e('0x26')](function(){return _0x58d3dc;});})[_0x937e('0x26')](function(){_0xdf7ea8[_0x937e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x181759,_0x2a27ec){return function(_0x8d77d9){if(!_0x8d77d9){_0x181759[_0x937e('0x19')](0x194);}return _0x8d77d9;};}function handleError(_0x303776,_0x4a3cd2){_0x4a3cd2=_0x4a3cd2||0x1f4;return function(_0x222078){logger[_0x937e('0x2a')](_0x222078['stack']);if(_0x222078[_0x937e('0x2b')]){delete _0x222078[_0x937e('0x2b')];}_0x303776[_0x937e('0x1a')](_0x4a3cd2)['send'](_0x222078);};}exports[_0x937e('0x2c')]=function(_0x3f8ac7,_0xe294d6){var _0x2564c3={},_0x1a90e7={},_0x1ee0a4={'count':0x0,'rows':[]};var _0x26d930=_[_0x937e('0x2d')](db[_0x937e('0x2e')][_0x937e('0x2f')],function(_0xdf7235){return{'name':_0xdf7235[_0x937e('0x30')],'type':_0xdf7235[_0x937e('0x31')][_0x937e('0x32')]};});_0x1a90e7[_0x937e('0x33')]=_[_0x937e('0x2d')](_0x26d930,_0x937e('0x2b'));_0x1a90e7[_0x937e('0x34')]=_[_0x937e('0x35')](_0x3f8ac7['query']);_0x1a90e7['filters']=_[_0x937e('0x36')](_0x1a90e7[_0x937e('0x33')],_0x1a90e7['query']);_0x2564c3['attributes']=_[_0x937e('0x36')](_0x1a90e7[_0x937e('0x33')],qs[_0x937e('0x37')](_0x3f8ac7[_0x937e('0x34')][_0x937e('0x37')]));_0x2564c3[_0x937e('0x38')]=_0x2564c3['attributes'][_0x937e('0x39')]?_0x2564c3[_0x937e('0x38')]:_0x1a90e7['model'];if(!_0x3f8ac7[_0x937e('0x34')][_0x937e('0x3a')](_0x937e('0x3b'))){_0x2564c3[_0x937e('0x1f')]=qs[_0x937e('0x1f')](_0x3f8ac7[_0x937e('0x34')]['limit']);_0x2564c3[_0x937e('0x1d')]=qs[_0x937e('0x1d')](_0x3f8ac7['query'][_0x937e('0x1d')]);}_0x2564c3[_0x937e('0x3c')]=qs[_0x937e('0x3d')](_0x3f8ac7[_0x937e('0x34')][_0x937e('0x3d')]);_0x2564c3[_0x937e('0x3e')]=qs[_0x937e('0x3f')](_['pick'](_0x3f8ac7[_0x937e('0x34')],_0x1a90e7[_0x937e('0x3f')]),_0x26d930);if(_0x3f8ac7[_0x937e('0x34')][_0x937e('0x40')]){_0x2564c3[_0x937e('0x3e')]=_[_0x937e('0x41')](_0x2564c3['where'],{'$or':_[_0x937e('0x2d')](_0x26d930,function(_0x34ba81){if(_0x34ba81['type']!==_0x937e('0x42')){var _0x5700cb={};_0x5700cb[_0x34ba81[_0x937e('0x2b')]]={'$like':'%'+_0x3f8ac7[_0x937e('0x34')]['filter']+'%'};return _0x5700cb;}})});}_0x2564c3=_[_0x937e('0x41')]({},_0x2564c3,_0x3f8ac7[_0x937e('0x43')]);var _0x49a452={'where':_0x2564c3['where']};return db[_0x937e('0x2e')][_0x937e('0x20')](_0x49a452)[_0x937e('0x26')](function(_0x5b7e5d){_0x1ee0a4[_0x937e('0x20')]=_0x5b7e5d;if(_0x3f8ac7[_0x937e('0x34')][_0x937e('0x44')]){_0x2564c3[_0x937e('0x45')]=[{'all':!![]}];}return db[_0x937e('0x2e')][_0x937e('0x46')](_0x2564c3);})[_0x937e('0x26')](function(_0x34a258){_0x1ee0a4['rows']=_0x34a258;return _0x1ee0a4;})[_0x937e('0x26')](respondWithFilteredResult(_0xe294d6,_0x2564c3))[_0x937e('0x47')](handleError(_0xe294d6,null));};exports[_0x937e('0x48')]=function(_0x387e35,_0x34397e){var _0x1135f0={'raw':![],'where':{'id':_0x387e35[_0x937e('0x49')]['id']}},_0x5016bd={};_0x5016bd[_0x937e('0x33')]=_['keys'](db[_0x937e('0x2e')][_0x937e('0x2f')]);_0x5016bd[_0x937e('0x34')]=_[_0x937e('0x35')](_0x387e35['query']);_0x5016bd[_0x937e('0x3f')]=_[_0x937e('0x36')](_0x5016bd[_0x937e('0x33')],_0x5016bd['query']);_0x1135f0[_0x937e('0x38')]=_['intersection'](_0x5016bd[_0x937e('0x33')],qs[_0x937e('0x37')](_0x387e35['query'][_0x937e('0x37')]));_0x1135f0[_0x937e('0x38')]=_0x1135f0[_0x937e('0x38')][_0x937e('0x39')]?_0x1135f0['attributes']:_0x5016bd['model'];if(_0x387e35['query']['includeAll']){_0x1135f0[_0x937e('0x45')]=[{'all':!![]}];}_0x1135f0=_[_0x937e('0x41')]({},_0x1135f0,_0x387e35[_0x937e('0x43')]);return db[_0x937e('0x2e')]['find'](_0x1135f0)[_0x937e('0x26')](handleEntityNotFound(_0x34397e,null))[_0x937e('0x26')](respondWithResult(_0x34397e,null))[_0x937e('0x47')](handleError(_0x34397e,null));};exports[_0x937e('0x4a')]=function(_0x7d43eb,_0x1a1e23){return db[_0x937e('0x2e')][_0x937e('0x4a')](_0x7d43eb[_0x937e('0x4b')],{})[_0x937e('0x26')](function(_0x545f23){var _0x1c22aa=_0x7d43eb['user'][_0x937e('0x28')]({'plain':!![]});if(!_0x1c22aa)throw new Error(_0x937e('0x4c'));if(_0x1c22aa[_0x937e('0x4d')]===_0x937e('0x4e')){var _0x516500=_0x545f23['get']({'plain':!![]});var _0x5ef295=_0x937e('0x29');return db[_0x937e('0x4f')][_0x937e('0x50')]({'where':{'name':_0x5ef295,'userProfileId':_0x1c22aa[_0x937e('0x51')]},'raw':!![]})[_0x937e('0x26')](function(_0x331511){if(_0x331511&&_0x331511[_0x937e('0x52')]===0x0){return db[_0x937e('0x53')][_0x937e('0x4a')]({'name':_0x516500[_0x937e('0x2b')],'resourceId':_0x516500['id'],'type':_0x331511[_0x937e('0x2b')],'sectionId':_0x331511['id']},{})[_0x937e('0x26')](function(){return _0x545f23;});}else{return _0x545f23;}})['catch'](function(_0x5183ee){logger[_0x937e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5183ee);throw _0x5183ee;});}return _0x545f23;})[_0x937e('0x26')](respondWithResult(_0x1a1e23,0xc9))[_0x937e('0x47')](handleError(_0x1a1e23,null));};exports[_0x937e('0x54')]=function(_0x4f71b2,_0x380514){var _0x4837a4={'where':{'id':_0x4f71b2[_0x937e('0x49')]['id']}},_0x16cdcd={};_0x16cdcd['model']=_[_0x937e('0x35')](db[_0x937e('0x2e')][_0x937e('0x2f')]);_0x4837a4[_0x937e('0x38')]=_[_0x937e('0x36')](_0x16cdcd[_0x937e('0x33')],qs['fields'](_0x4f71b2[_0x937e('0x34')]['fields']));_0x4837a4[_0x937e('0x38')]=_0x4837a4[_0x937e('0x38')][_0x937e('0x39')]?_0x4837a4[_0x937e('0x38')]:_0x16cdcd[_0x937e('0x33')];if(_0x4f71b2[_0x937e('0x34')][_0x937e('0x44')]){_0x4837a4[_0x937e('0x45')]=[{'all':!![]}];}_0x4837a4=_[_0x937e('0x41')]({},_0x4837a4,_0x4f71b2['options']);return db[_0x937e('0x2e')][_0x937e('0x50')](_0x4837a4)[_0x937e('0x26')](handleEntityNotFound(_0x380514,null))['then'](function(_0x8296e0){if(_0x8296e0){var _0x176ce2=_0x8296e0[_0x937e('0x28')]({'plain':!![]});_0x176ce2=qs[_0x937e('0x55')](_0x176ce2,['id',_0x937e('0x56'),_0x937e('0x57')]);_0x4f71b2[_0x937e('0x4b')]=_[_0x937e('0x55')](_0x4f71b2[_0x937e('0x4b')],['id',_0x937e('0x56'),_0x937e('0x57')]);return db[_0x937e('0x2e')][_0x937e('0x4a')](_['merge'](_0x176ce2,_0x4f71b2[_0x937e('0x4b')]),{'include':_0x4f71b2[_0x937e('0x34')][_0x937e('0x44')]?[{'all':!![]}]:undefined})[_0x937e('0x26')](function(_0x45b64f){var _0x42e070=_0x4f71b2[_0x937e('0x4e')]['get']({'plain':!![]});if(!_0x42e070)throw new Error(_0x937e('0x4c'));if(_0x42e070[_0x937e('0x4d')]===_0x937e('0x4e')){var _0x2e0640=_0x45b64f['get']({'plain':!![]});var _0x5adf91=_0x937e('0x29');return db[_0x937e('0x4f')][_0x937e('0x50')]({'where':{'name':_0x5adf91,'userProfileId':_0x42e070['userProfileId']},'raw':!![]})[_0x937e('0x26')](function(_0x14054e){if(_0x14054e&&_0x14054e[_0x937e('0x52')]===0x0){return db['UserProfileResource'][_0x937e('0x4a')]({'name':_0x2e0640['name'],'resourceId':_0x2e0640['id'],'type':_0x14054e[_0x937e('0x2b')],'sectionId':_0x14054e['id']},{})[_0x937e('0x26')](function(){return _0x45b64f;});}else{return _0x45b64f;}})[_0x937e('0x47')](function(_0x269124){logger['error'](_0x937e('0x58'),_0x269124);throw _0x269124;});}return _0x45b64f;});}})[_0x937e('0x26')](respondWithResult(_0x380514,0xc9))[_0x937e('0x47')](handleError(_0x380514,null));};exports[_0x937e('0x25')]=function(_0x5252e3,_0x2c5415){if(_0x5252e3[_0x937e('0x4b')]['id']){delete _0x5252e3[_0x937e('0x4b')]['id'];}return db[_0x937e('0x2e')][_0x937e('0x50')]({'where':{'id':_0x5252e3[_0x937e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c5415,null))[_0x937e('0x26')](saveUpdates(_0x5252e3['body'],null))[_0x937e('0x26')](respondWithResult(_0x2c5415,null))[_0x937e('0x47')](handleError(_0x2c5415,null));};exports['destroy']=function(_0xf957fe,_0x215aab){return db['JscriptyProject'][_0x937e('0x50')]({'where':{'id':_0xf957fe[_0x937e('0x49')]['id']}})['then'](handleEntityNotFound(_0x215aab,null))[_0x937e('0x26')](removeEntity(_0x215aab,null))[_0x937e('0x47')](handleError(_0x215aab,null));};exports[_0x937e('0x59')]=function(_0x38710d,_0x244c0b,_0x39aeac){var _0x2fa44b={'raw':!![],'where':{}};var _0x4aca9b={};var _0x525391={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x937e('0x5a')]({'where':{'id':_0x38710d[_0x937e('0x49')]['id']}})[_0x937e('0x26')](handleEntityNotFound(_0x244c0b,null))[_0x937e('0x26')](function(_0x58722b){if(_0x58722b){_0x4aca9b['model']=_[_0x937e('0x35')](db[_0x937e('0x5b')][_0x937e('0x2f')]);_0x4aca9b[_0x937e('0x34')]=_['keys'](_0x38710d['query']);_0x4aca9b['filters']=_[_0x937e('0x36')](_0x4aca9b[_0x937e('0x33')],_0x4aca9b[_0x937e('0x34')]);_0x2fa44b[_0x937e('0x38')]=_['intersection'](_0x4aca9b[_0x937e('0x33')],qs[_0x937e('0x37')](_0x38710d[_0x937e('0x34')][_0x937e('0x37')]));_0x2fa44b[_0x937e('0x38')]=_0x2fa44b[_0x937e('0x38')][_0x937e('0x39')]?_0x2fa44b[_0x937e('0x38')]:_0x4aca9b['model'];if(!_0x38710d['query'][_0x937e('0x3a')](_0x937e('0x3b'))){_0x2fa44b[_0x937e('0x1f')]=qs[_0x937e('0x1f')](_0x38710d[_0x937e('0x34')][_0x937e('0x1f')]);_0x2fa44b[_0x937e('0x1d')]=qs[_0x937e('0x1d')](_0x38710d[_0x937e('0x34')][_0x937e('0x1d')]);}_0x2fa44b['order']=qs['sort'](_0x38710d['query'][_0x937e('0x3d')]);_0x2fa44b['where']=qs[_0x937e('0x3f')](_[_0x937e('0x5c')](_0x38710d['query'],_0x4aca9b['filters']));_0x2fa44b[_0x937e('0x3e')][_0x937e('0x5d')]=_0x58722b['id'];if(_0x38710d[_0x937e('0x34')][_0x937e('0x40')]){_0x2fa44b[_0x937e('0x3e')]=_[_0x937e('0x41')](_0x2fa44b[_0x937e('0x3e')],{'$or':_[_0x937e('0x2d')](_0x2fa44b[_0x937e('0x38')],function(_0x147cec){var _0x276abc={};_0x276abc[_0x147cec]={'$like':'%'+_0x38710d[_0x937e('0x34')]['filter']+'%'};return _0x276abc;})});}_0x2fa44b=_['merge']({},_0x2fa44b,_0x38710d[_0x937e('0x43')]);return db[_0x937e('0x5b')]['count']({'where':_0x2fa44b['where']})[_0x937e('0x26')](function(_0x492104){_0x525391[_0x937e('0x20')]=_0x492104;if(_0x38710d[_0x937e('0x34')][_0x937e('0x44')]){_0x2fa44b['include']=[{'all':!![]}];}return db[_0x937e('0x5b')][_0x937e('0x46')](_0x2fa44b);})[_0x937e('0x26')](function(_0x47f594){_0x525391[_0x937e('0x5e')]=_0x47f594;return _0x525391;});}})[_0x937e('0x26')](respondWithFilteredResult(_0x244c0b,_0x2fa44b))[_0x937e('0x47')](handleError(_0x244c0b,null));};exports[_0x937e('0x5f')]=function(_0x1d133c,_0x1f59bf,_0x4ca3fc){var _0x14d876={'raw':!![],'where':{}};var _0x5532a4={};var _0xb714b0={'count':0x0,'rows':[]};return db[_0x937e('0x2e')][_0x937e('0x5a')]({'where':{'id':_0x1d133c[_0x937e('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f59bf,null))[_0x937e('0x26')](function(_0x41b3a4){if(_0x41b3a4){_0x5532a4[_0x937e('0x33')]=_[_0x937e('0x35')](db[_0x937e('0x60')][_0x937e('0x2f')]);_0x5532a4[_0x937e('0x34')]=_[_0x937e('0x35')](_0x1d133c[_0x937e('0x34')]);_0x5532a4[_0x937e('0x3f')]=_['intersection'](_0x5532a4[_0x937e('0x33')],_0x5532a4['query']);_0x14d876[_0x937e('0x38')]=_[_0x937e('0x36')](_0x5532a4[_0x937e('0x33')],qs[_0x937e('0x37')](_0x1d133c['query'][_0x937e('0x37')]));_0x14d876[_0x937e('0x38')]=_0x14d876[_0x937e('0x38')][_0x937e('0x39')]?_0x14d876['attributes']:_0x5532a4[_0x937e('0x33')];if(!_0x1d133c[_0x937e('0x34')][_0x937e('0x3a')]('nolimit')){_0x14d876[_0x937e('0x1f')]=qs[_0x937e('0x1f')](_0x1d133c[_0x937e('0x34')]['limit']);_0x14d876[_0x937e('0x1d')]=qs[_0x937e('0x1d')](_0x1d133c[_0x937e('0x34')][_0x937e('0x1d')]);}_0x14d876[_0x937e('0x3c')]=qs['sort'](_0x1d133c[_0x937e('0x34')][_0x937e('0x3d')]);_0x14d876[_0x937e('0x3e')]=qs['filters'](_[_0x937e('0x5c')](_0x1d133c[_0x937e('0x34')],_0x5532a4[_0x937e('0x3f')]));_0x14d876[_0x937e('0x3e')]['ProjectId']=_0x41b3a4['id'];if(_0x1d133c[_0x937e('0x34')][_0x937e('0x40')]){_0x14d876['where']=_[_0x937e('0x41')](_0x14d876['where'],{'$or':_['map'](_0x14d876[_0x937e('0x38')],function(_0x9da817){var _0x5f349e={};_0x5f349e[_0x9da817]={'$like':'%'+_0x1d133c[_0x937e('0x34')][_0x937e('0x40')]+'%'};return _0x5f349e;})});}_0x14d876=_[_0x937e('0x41')]({},_0x14d876,_0x1d133c[_0x937e('0x43')]);return db[_0x937e('0x60')][_0x937e('0x20')]({'where':_0x14d876['where']})[_0x937e('0x26')](function(_0x556d2d){_0xb714b0['count']=_0x556d2d;if(_0x1d133c[_0x937e('0x34')][_0x937e('0x44')]){_0x14d876[_0x937e('0x45')]=[{'all':!![]}];}return db[_0x937e('0x60')][_0x937e('0x46')](_0x14d876);})['then'](function(_0x9e797b){_0xb714b0[_0x937e('0x5e')]=_0x9e797b;return _0xb714b0;});}})[_0x937e('0x26')](respondWithFilteredResult(_0x1f59bf,_0x14d876))[_0x937e('0x47')](handleError(_0x1f59bf,null));};function char(_0x513965){return _0x937e('0x61')===typeof _0x513965?String[_0x937e('0x62')][_0x937e('0x63')](null,arguments):_0x513965;}function needsEncapsulation(_0x293820){return!!_0x293820&&(_0x293820[_0x937e('0x64')]()['indexOf'](char(0xd))>=0x0||_0x293820['toString']()[_0x937e('0x65')](char(0xa))>=0x0||_0x293820[_0x937e('0x64')]()['indexOf'](char(0x2c))>=0x0||_0x293820[_0x937e('0x64')]()[_0x937e('0x65')](char(0x22))>=0x0);}function encapsulate(_0x2c51c8){var _0x1cd0d5=char(0x22),_0x1f80a3='\x5c'+char(0x22),_0x3d8a30=_0x2c51c8[_0x937e('0x64')]()[_0x937e('0x66')](new RegExp(_0x1cd0d5,'g'),_0x1f80a3);return _0x1cd0d5+_0x3d8a30+_0x1cd0d5;}exports[_0x937e('0x67')]=function(_0x41f1e6,_0x36698d,_0x2a281b){var _0x20dd43,_0x43c280;var _0x34e540={'where':{'ProjectId':_0x41f1e6[_0x937e('0x49')]['id']}};if(_0x41f1e6['query'][_0x937e('0x68')]){_0x34e540[_0x937e('0x3e')][_0x937e('0x69')]=JSON['parse'](_0x41f1e6[_0x937e('0x34')][_0x937e('0x68')]);}return db[_0x937e('0x5b')][_0x937e('0x46')](_0x34e540)[_0x937e('0x26')](handleEntityNotFound(_0x36698d,null))[_0x937e('0x26')](function(_0x39199b){if(_0x39199b){_0x20dd43=_0x39199b;return db[_0x937e('0x6a')][_0x937e('0x46')]({'where':{'SessionId':{'$in':_[_0x937e('0x2d')](_0x20dd43,'id')},'ProjectId':_0x41f1e6[_0x937e('0x49')]['id']},'order':_0x937e('0x6b')});}})[_0x937e('0x26')](handleEntityNotFound(_0x36698d,null))['then'](function(_0x28f94a){if(_0x28f94a){_0x43c280=_0x28f94a;var _0x1423fa={};for(var _0x1ff298=0x0,_0xc9f8b1=_0x43c280[_0x937e('0x39')];_0x1ff298<_0xc9f8b1;_0x1ff298++){if(!_0x1423fa[_0x937e('0x3a')](_0x43c280[_0x1ff298][_0x937e('0x6c')])){_0x1423fa[_0x43c280[_0x1ff298]['questionId']]=needsEncapsulation(_0x43c280[_0x1ff298][_0x937e('0x6d')])?encapsulate(_0x43c280[_0x1ff298][_0x937e('0x6d')]):_0x43c280[_0x1ff298]['question'];}}var _0x43d65f=[],_0x4bfc25={};for(var _0x2c4b29=0x0,_0x124c7b=_0x20dd43['length'];_0x2c4b29<_0x124c7b;_0x2c4b29++){_0x4bfc25={'ProjectId':_0x41f1e6[_0x937e('0x49')]['id'],'SessionId':_0x20dd43[_0x2c4b29]['id'],'StartTime':moment(_0x20dd43[_0x2c4b29][_0x937e('0x69')])[_0x937e('0x6e')](_0x937e('0x6f'))};for(var _0x363f1e=0x0,_0x52c683=_0x43c280['length'];_0x363f1e<_0x52c683;_0x363f1e++){if(_0x43c280[_0x363f1e][_0x937e('0x70')]==_0x20dd43[_0x2c4b29]['id']&&_0x1423fa[_0x937e('0x3a')](_0x43c280[_0x363f1e][_0x937e('0x6c')])){_0x4bfc25[_0x1423fa[_0x43c280[_0x363f1e][_0x937e('0x6c')]]]=_0x43c280[_0x363f1e][_0x937e('0x71')];}}for(var _0x3adda9 in _0x1423fa){if(!_0x4bfc25[_0x937e('0x3a')](_0x1423fa[_0x3adda9])){_0x4bfc25[_0x1423fa[_0x3adda9]]=null;}}_0x43d65f[_0x937e('0x72')](_0x4bfc25);}return _0x43d65f;}})['then'](function(_0x37a684){if(!_['isEmpty'](_0x37a684)){var _0x3f3774=toCsv(_0x37a684);var _0x4a83f4=Date[_0x937e('0x73')]();fs[_0x937e('0x74')](util['format'](_0x937e('0x75'),_0x41f1e6['params']['id'],_0x4a83f4),_0x3f3774);_0x36698d[_0x937e('0x76')]('Content-disposition',_0x937e('0x77')+util[_0x937e('0x6e')]('Jscripty_Project_%d_Summary_%s.csv',_0x41f1e6[_0x937e('0x49')]['id'],_0x4a83f4));_0x36698d[_0x937e('0x76')](_0x937e('0x78'),_0x937e('0x79'));return _0x36698d[_0x937e('0x7a')](util[_0x937e('0x6e')](_0x937e('0x75'),_0x41f1e6['params']['id'],_0x4a83f4));}else{return _0x36698d[_0x937e('0x19')](0xcc);}})[_0x937e('0x47')](handleError(_0x36698d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9fba9fb..6e3adf3 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 _0x1666=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects'];(function(_0x58cafd,_0x28b94c){var _0x184499=function(_0x2ea06e){while(--_0x2ea06e){_0x58cafd['push'](_0x58cafd['shift']());}};_0x184499(++_0x28b94c);}(_0x1666,0x75));var _0x6166=function(_0x1d2f74,_0x26de72){_0x1d2f74=_0x1d2f74-0x0;var _0x2f35f4=_0x1666[_0x1d2f74];return _0x2f35f4;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var logger=require('../../config/logger')(_0x6166('0x2'));var moment=require(_0x6166('0x3'));var BPromise=require(_0x6166('0x4'));var rp=require(_0x6166('0x5'));var fs=require('fs');var path=require(_0x6166('0x6'));var rimraf=require(_0x6166('0x7'));var config=require(_0x6166('0x8'));var attributes=require(_0x6166('0x9'));module['exports']=function(_0x2ee359,_0x1d4f2a){return _0x2ee359[_0x6166('0xa')](_0x6166('0xb'),attributes,{'tableName':_0x6166('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f63=['JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x509dc7,_0xd0104d){var _0x26b02c=function(_0x392866){while(--_0x392866){_0x509dc7['push'](_0x509dc7['shift']());}};_0x26b02c(++_0xd0104d);}(_0x1f63,0x7a));var _0x31f6=function(_0x28040e,_0x48d18e){_0x28040e=_0x28040e-0x0;var _0x414bba=_0x1f63[_0x28040e];return _0x414bba;};'use strict';var _=require(_0x31f6('0x0'));var util=require(_0x31f6('0x1'));var logger=require('../../config/logger')(_0x31f6('0x2'));var moment=require(_0x31f6('0x3'));var BPromise=require(_0x31f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31f6('0x5'));var rimraf=require(_0x31f6('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x31f6('0x7')]=function(_0x11250b,_0xe8437e){return _0x11250b['define'](_0x31f6('0x8'),attributes,{'tableName':_0x31f6('0x9'),'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 affd838..6310c10 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5d77fb,_0x2616e8){var _0x270181=function(_0x3ab093){while(--_0x3ab093){_0x5d77fb['push'](_0x5d77fb['shift']());}};_0x270181(++_0x2616e8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3030f5,_0x101cf4){_0x3030f5=_0x3030f5-0x0;var _0x146346=_0xf4eb[_0x3030f5];return _0x146346;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ 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(_0x5eb2bf,_0x35affe){var _0x50c498=function(_0x6bd9fe){while(--_0x6bd9fe){_0x5eb2bf['push'](_0x5eb2bf['shift']());}};_0x50c498(++_0x35affe);}(_0xe706,0xa3));var _0x6e70=function(_0x3c7152,_0x302b29){_0x3c7152=_0x3c7152-0x0;var _0x43aea5=_0xe706[_0x3c7152];return _0x43aea5;};'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 415b3b3..0250113 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 _0x3967=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x3967,0x1d0));var _0x7396=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x3967[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require('multer');var util=require(_0x7396('0x0'));var path=require(_0x7396('0x1'));var timeout=require(_0x7396('0x2'));var express=require(_0x7396('0x3'));var router=express[_0x7396('0x4')]();var fs_extra=require(_0x7396('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7396('0x6'));router[_0x7396('0x7')]('/',auth[_0x7396('0x8')](),controller[_0x7396('0x9')]);router[_0x7396('0x7')](_0x7396('0xa'),auth[_0x7396('0x8')](),controller[_0x7396('0xb')]);router[_0x7396('0x7')](_0x7396('0xc'),auth[_0x7396('0x8')](),controller['show']);router[_0x7396('0xd')]('/',auth['isAuthenticated'](),controller[_0x7396('0xe')]);router[_0x7396('0xf')](_0x7396('0xc'),auth[_0x7396('0x8')](),controller[_0x7396('0x10')]);router[_0x7396('0x11')](_0x7396('0xc'),auth[_0x7396('0x8')](),controller[_0x7396('0x12')]);module[_0x7396('0x13')]=router; \ No newline at end of file +var _0x47cd=['./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','show','post','create','update','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x354ee4,_0x3eb35f){var _0x22916d=function(_0x5225ca){while(--_0x5225ca){_0x354ee4['push'](_0x354ee4['shift']());}};_0x22916d(++_0x3eb35f);}(_0x47cd,0x98));var _0xd47c=function(_0x452557,_0x1f5371){_0x452557=_0x452557-0x0;var _0x195825=_0x47cd[_0x452557];return _0x195825;};'use strict';var multer=require(_0xd47c('0x0'));var util=require(_0xd47c('0x1'));var path=require(_0xd47c('0x2'));var timeout=require('connect-timeout');var express=require(_0xd47c('0x3'));var router=express['Router']();var fs_extra=require(_0xd47c('0x4'));var auth=require(_0xd47c('0x5'));var interaction=require(_0xd47c('0x6'));var config=require(_0xd47c('0x7'));var controller=require(_0xd47c('0x8'));router[_0xd47c('0x9')]('/',auth['isAuthenticated'](),controller[_0xd47c('0xa')]);router[_0xd47c('0x9')](_0xd47c('0xb'),auth[_0xd47c('0xc')](),controller['describe']);router[_0xd47c('0x9')]('/:id',auth[_0xd47c('0xc')](),controller[_0xd47c('0xd')]);router[_0xd47c('0xe')]('/',auth[_0xd47c('0xc')](),controller[_0xd47c('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd47c('0x10')]);router['delete'](_0xd47c('0x11'),auth[_0xd47c('0xc')](),controller[_0xd47c('0x12')]);module[_0xd47c('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 7f82ddb..b856d55 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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x21f7e7,_0x556d3d){_0x21f7e7=_0x21f7e7-0x0;var _0x7cd45d=_0x7a54[_0x21f7e7];return _0x7cd45d;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x194bf8,_0x1dc7e5){_0x194bf8=_0x194bf8-0x0;var _0x579501=_0x7a54[_0x194bf8];return _0x579501;};'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 1b24b77..bb77b25 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 _0xdeae=['hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','sendStatus','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x12bab,_0x152135){var _0x3d966c=function(_0x5abf8d){while(--_0x5abf8d){_0x12bab['push'](_0x12bab['shift']());}};_0x3d966c(++_0x152135);}(_0xdeae,0xa0));var _0xedea=function(_0x3cd451,_0x26e81a){_0x3cd451=_0x3cd451-0x0;var _0x571ce6=_0xdeae[_0x3cd451];return _0x571ce6;};'use strict';var emlformat=require(_0xedea('0x0'));var rimraf=require(_0xedea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedea('0x2'));var rp=require(_0xedea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xedea('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xedea('0x5'));var ejs=require(_0xedea('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedea('0x7'));var squel=require(_0xedea('0x8'));var crypto=require(_0xedea('0x9'));var jsforce=require(_0xedea('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xedea('0xb'));var Papa=require(_0xedea('0xc'));var Redis=require('ioredis');var authService=require(_0xedea('0xd'));var qs=require(_0xedea('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedea('0xf'));var logger=require('../../config/logger')(_0xedea('0x10'));var utils=require(_0xedea('0x11'));var config=require(_0xedea('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xedea('0x13'))['db'];function respondWithStatusCode(_0x3d4d7c,_0xf8e727){_0xf8e727=_0xf8e727||0xcc;return function(_0x5b2e6c){if(_0x5b2e6c){return _0x3d4d7c['sendStatus'](_0xf8e727);}return _0x3d4d7c['status'](_0xf8e727)[_0xedea('0x14')]();};}function respondWithResult(_0x5546ed,_0x5c2a20){_0x5c2a20=_0x5c2a20||0xc8;return function(_0x15148c){if(_0x15148c){return _0x5546ed[_0xedea('0x15')](_0x5c2a20)['json'](_0x15148c);}};}function respondWithFilteredResult(_0xccabe7,_0x2241c1){return function(_0x1d5d44){if(_0x1d5d44){var _0x5b8081=typeof _0x2241c1[_0xedea('0x16')]===_0xedea('0x17')&&typeof _0x2241c1[_0xedea('0x18')]===_0xedea('0x17');var _0x7ab753=_0x1d5d44['count'];var _0x4de7f3=_0x5b8081?0x0:_0x2241c1[_0xedea('0x16')];var _0x5311b0=_0x5b8081?_0x1d5d44[_0xedea('0x19')]:_0x2241c1[_0xedea('0x16')]+_0x2241c1[_0xedea('0x18')];var _0x5042e7;if(_0x5311b0>=_0x7ab753){_0x5311b0=_0x7ab753;_0x5042e7=0xc8;}else{_0x5042e7=0xce;}_0xccabe7[_0xedea('0x15')](_0x5042e7);return _0xccabe7[_0xedea('0x1a')]('Content-Range',_0x4de7f3+'-'+_0x5311b0+'/'+_0x7ab753)[_0xedea('0x1b')](_0x1d5d44);}return null;};}function patchUpdates(_0x225943){return function(_0xbe8845){try{jsonpatch[_0xedea('0x1c')](_0xbe8845,_0x225943,!![]);}catch(_0x4e24a5){return BPromise['reject'](_0x4e24a5);}return _0xbe8845[_0xedea('0x1d')]();};}function saveUpdates(_0x45e7bd,_0x34394d){return function(_0x3ec4f4){if(_0x3ec4f4){return _0x3ec4f4[_0xedea('0x1e')](_0x45e7bd)[_0xedea('0x1f')](function(_0x493d55){return _0x493d55;});}return null;};}function removeEntity(_0x17b48f,_0x196df3){return function(_0x38c239){if(_0x38c239){return _0x38c239[_0xedea('0x20')]()['then'](function(){_0x17b48f[_0xedea('0x15')](0xcc)[_0xedea('0x14')]();});}};}function handleEntityNotFound(_0x5d0696,_0x480b9f){return function(_0x5ac8fd){if(!_0x5ac8fd){_0x5d0696[_0xedea('0x21')](0x194);}return _0x5ac8fd;};}function handleError(_0xd110f4,_0x38c4d9){_0x38c4d9=_0x38c4d9||0x1f4;return function(_0x22b2d5){logger['error'](_0x22b2d5[_0xedea('0x22')]);if(_0x22b2d5[_0xedea('0x23')]){delete _0x22b2d5[_0xedea('0x23')];}_0xd110f4['status'](_0x38c4d9)['send'](_0x22b2d5);};}exports[_0xedea('0x24')]=function(_0x49e2bd,_0x574a7e){var _0x44333b={},_0x28a8c0={},_0x49a074={'count':0x0,'rows':[]};var _0x203742=_[_0xedea('0x25')](db[_0xedea('0x26')][_0xedea('0x27')],function(_0x38041d){return{'name':_0x38041d[_0xedea('0x28')],'type':_0x38041d[_0xedea('0x29')][_0xedea('0x2a')]};});_0x28a8c0[_0xedea('0x2b')]=_[_0xedea('0x25')](_0x203742,_0xedea('0x23'));_0x28a8c0[_0xedea('0x2c')]=_[_0xedea('0x2d')](_0x49e2bd[_0xedea('0x2c')]);_0x28a8c0[_0xedea('0x2e')]=_[_0xedea('0x2f')](_0x28a8c0[_0xedea('0x2b')],_0x28a8c0[_0xedea('0x2c')]);_0x44333b['attributes']=_['intersection'](_0x28a8c0[_0xedea('0x2b')],qs[_0xedea('0x30')](_0x49e2bd['query']['fields']));_0x44333b[_0xedea('0x31')]=_0x44333b[_0xedea('0x31')]['length']?_0x44333b['attributes']:_0x28a8c0[_0xedea('0x2b')];if(!_0x49e2bd[_0xedea('0x2c')][_0xedea('0x32')]('nolimit')){_0x44333b[_0xedea('0x18')]=qs[_0xedea('0x18')](_0x49e2bd[_0xedea('0x2c')][_0xedea('0x18')]);_0x44333b[_0xedea('0x16')]=qs[_0xedea('0x16')](_0x49e2bd[_0xedea('0x2c')][_0xedea('0x16')]);}_0x44333b[_0xedea('0x33')]=qs['sort'](_0x49e2bd[_0xedea('0x2c')][_0xedea('0x34')]);_0x44333b['where']=qs[_0xedea('0x2e')](_[_0xedea('0x35')](_0x49e2bd['query'],_0x28a8c0[_0xedea('0x2e')]),_0x203742);if(_0x49e2bd[_0xedea('0x2c')]['filter']){_0x44333b[_0xedea('0x36')]=_[_0xedea('0x37')](_0x44333b[_0xedea('0x36')],{'$or':_['map'](_0x203742,function(_0x45b0ce){if(_0x45b0ce[_0xedea('0x29')]!==_0xedea('0x38')){var _0x404438={};_0x404438[_0x45b0ce['name']]={'$like':'%'+_0x49e2bd['query'][_0xedea('0x39')]+'%'};return _0x404438;}})});}_0x44333b=_[_0xedea('0x37')]({},_0x44333b,_0x49e2bd[_0xedea('0x3a')]);var _0x422c09={'where':_0x44333b[_0xedea('0x36')]};return db[_0xedea('0x26')][_0xedea('0x19')](_0x422c09)['then'](function(_0x4f157d){_0x49a074['count']=_0x4f157d;if(_0x49e2bd[_0xedea('0x2c')][_0xedea('0x3b')]){_0x44333b['include']=[{'all':!![]}];}return db[_0xedea('0x26')][_0xedea('0x3c')](_0x44333b);})['then'](function(_0x3d7ed1){_0x49a074[_0xedea('0x3d')]=_0x3d7ed1;return _0x49a074;})['then'](respondWithFilteredResult(_0x574a7e,_0x44333b))[_0xedea('0x3e')](handleError(_0x574a7e,null));};exports[_0xedea('0x3f')]=function(_0x57b009,_0x29662e){var _0x349812={'raw':!![],'where':{'id':_0x57b009[_0xedea('0x40')]['id']}},_0x5167cd={};_0x5167cd[_0xedea('0x2b')]=_[_0xedea('0x2d')](db[_0xedea('0x26')][_0xedea('0x27')]);_0x5167cd[_0xedea('0x2c')]=_[_0xedea('0x2d')](_0x57b009[_0xedea('0x2c')]);_0x5167cd[_0xedea('0x2e')]=_[_0xedea('0x2f')](_0x5167cd['model'],_0x5167cd[_0xedea('0x2c')]);_0x349812['attributes']=_[_0xedea('0x2f')](_0x5167cd[_0xedea('0x2b')],qs[_0xedea('0x30')](_0x57b009[_0xedea('0x2c')][_0xedea('0x30')]));_0x349812[_0xedea('0x31')]=_0x349812[_0xedea('0x31')][_0xedea('0x41')]?_0x349812['attributes']:_0x5167cd[_0xedea('0x2b')];if(_0x57b009[_0xedea('0x2c')][_0xedea('0x3b')]){_0x349812['include']=[{'all':!![]}];}_0x349812=_[_0xedea('0x37')]({},_0x349812,_0x57b009[_0xedea('0x3a')]);return db[_0xedea('0x26')][_0xedea('0x42')](_0x349812)['then'](handleEntityNotFound(_0x29662e,null))[_0xedea('0x1f')](respondWithResult(_0x29662e,null))['catch'](handleError(_0x29662e,null));};exports[_0xedea('0x43')]=function(_0x227ae0,_0x29a249){return db[_0xedea('0x26')][_0xedea('0x43')](_0x227ae0[_0xedea('0x44')],{})[_0xedea('0x1f')](respondWithResult(_0x29a249,0xc9))['catch'](handleError(_0x29a249,null));};exports[_0xedea('0x1e')]=function(_0x5dea80,_0x47f149){if(_0x5dea80[_0xedea('0x44')]['id']){delete _0x5dea80[_0xedea('0x44')]['id'];}return db[_0xedea('0x26')]['find']({'where':{'id':_0x5dea80[_0xedea('0x40')]['id']}})['then'](handleEntityNotFound(_0x47f149,null))[_0xedea('0x1f')](saveUpdates(_0x5dea80[_0xedea('0x44')],null))[_0xedea('0x1f')](respondWithResult(_0x47f149,null))[_0xedea('0x3e')](handleError(_0x47f149,null));};exports[_0xedea('0x20')]=function(_0x54a80d,_0x11edb8){return db[_0xedea('0x26')][_0xedea('0x42')]({'where':{'id':_0x54a80d['params']['id']}})[_0xedea('0x1f')](handleEntityNotFound(_0x11edb8,null))['then'](removeEntity(_0x11edb8,null))[_0xedea('0x3e')](handleError(_0x11edb8,null));};exports[_0xedea('0x45')]=function(_0x1279dc,_0x2cd90f){return db[_0xedea('0x26')]['describe']()['then'](respondWithResult(_0x2cd90f,null))[_0xedea('0x3e')](handleError(_0x2cd90f,null));}; \ No newline at end of file +var _0x5f01=['status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3f0de6,_0x18a041){var _0x5c7b8a=function(_0x5d5fac){while(--_0x5d5fac){_0x3f0de6['push'](_0x3f0de6['shift']());}};_0x5c7b8a(++_0x18a041);}(_0x5f01,0x7a));var _0x15f0=function(_0x231476,_0x2fd2e3){_0x231476=_0x231476-0x0;var _0x505a8f=_0x5f01[_0x231476];return _0x505a8f;};'use strict';var emlformat=require(_0x15f0('0x0'));var rimraf=require(_0x15f0('0x1'));var zipdir=require(_0x15f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15f0('0x3'));var moment=require('moment');var BPromise=require(_0x15f0('0x4'));var Mustache=require(_0x15f0('0x5'));var util=require(_0x15f0('0x6'));var path=require(_0x15f0('0x7'));var sox=require('sox');var csv=require(_0x15f0('0x8'));var ejs=require(_0x15f0('0x9'));var fs=require('fs');var fs_extra=require(_0x15f0('0xa'));var _=require('lodash');var squel=require(_0x15f0('0xb'));var crypto=require(_0x15f0('0xc'));var jsforce=require(_0x15f0('0xd'));var deskjs=require(_0x15f0('0xe'));var toCsv=require(_0x15f0('0x8'));var querystring=require(_0x15f0('0xf'));var Papa=require('papaparse');var Redis=require(_0x15f0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x15f0('0x11'));var as=require(_0x15f0('0x12'));var hardwareService=require(_0x15f0('0x13'));var logger=require(_0x15f0('0x14'))(_0x15f0('0x15'));var utils=require(_0x15f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x15f0('0x17'));var db=require(_0x15f0('0x18'))['db'];function respondWithStatusCode(_0x3402c6,_0x4d6369){_0x4d6369=_0x4d6369||0xcc;return function(_0x19fbf7){if(_0x19fbf7){return _0x3402c6[_0x15f0('0x19')](_0x4d6369);}return _0x3402c6[_0x15f0('0x1a')](_0x4d6369)[_0x15f0('0x1b')]();};}function respondWithResult(_0x1559cb,_0x4870ec){_0x4870ec=_0x4870ec||0xc8;return function(_0x2c7a4b){if(_0x2c7a4b){return _0x1559cb[_0x15f0('0x1a')](_0x4870ec)[_0x15f0('0x1c')](_0x2c7a4b);}};}function respondWithFilteredResult(_0x1fd2c2,_0x3fa96c){return function(_0xf3a518){if(_0xf3a518){var _0x2577c9=typeof _0x3fa96c[_0x15f0('0x1d')]==='undefined'&&typeof _0x3fa96c[_0x15f0('0x1e')]==='undefined';var _0x4ceccd=_0xf3a518[_0x15f0('0x1f')];var _0x4f8d7e=_0x2577c9?0x0:_0x3fa96c['offset'];var _0x1a4bc4=_0x2577c9?_0xf3a518[_0x15f0('0x1f')]:_0x3fa96c[_0x15f0('0x1d')]+_0x3fa96c[_0x15f0('0x1e')];var _0x4db0b5;if(_0x1a4bc4>=_0x4ceccd){_0x1a4bc4=_0x4ceccd;_0x4db0b5=0xc8;}else{_0x4db0b5=0xce;}_0x1fd2c2[_0x15f0('0x1a')](_0x4db0b5);return _0x1fd2c2[_0x15f0('0x20')](_0x15f0('0x21'),_0x4f8d7e+'-'+_0x1a4bc4+'/'+_0x4ceccd)['json'](_0xf3a518);}return null;};}function patchUpdates(_0x85ca92){return function(_0x10a186){try{jsonpatch[_0x15f0('0x22')](_0x10a186,_0x85ca92,!![]);}catch(_0x1ab898){return BPromise['reject'](_0x1ab898);}return _0x10a186[_0x15f0('0x23')]();};}function saveUpdates(_0x4cdfe7,_0x10a829){return function(_0x4b95a0){if(_0x4b95a0){return _0x4b95a0[_0x15f0('0x24')](_0x4cdfe7)[_0x15f0('0x25')](function(_0x3275f9){return _0x3275f9;});}return null;};}function removeEntity(_0x55f939,_0x10a804){return function(_0x3207c8){if(_0x3207c8){return _0x3207c8[_0x15f0('0x26')]()['then'](function(){_0x55f939[_0x15f0('0x1a')](0xcc)[_0x15f0('0x1b')]();});}};}function handleEntityNotFound(_0x413909,_0x4aa0bc){return function(_0x46ceb4){if(!_0x46ceb4){_0x413909[_0x15f0('0x19')](0x194);}return _0x46ceb4;};}function handleError(_0x3a3372,_0x3c9ea6){_0x3c9ea6=_0x3c9ea6||0x1f4;return function(_0x506eba){logger[_0x15f0('0x27')](_0x506eba['stack']);if(_0x506eba['name']){delete _0x506eba[_0x15f0('0x28')];}_0x3a3372[_0x15f0('0x1a')](_0x3c9ea6)[_0x15f0('0x29')](_0x506eba);};}exports[_0x15f0('0x2a')]=function(_0x31f696,_0x220d2f){var _0x4b4acf={},_0x7995cf={},_0x4ecf44={'count':0x0,'rows':[]};var _0x51ca93=_[_0x15f0('0x2b')](db[_0x15f0('0x2c')][_0x15f0('0x2d')],function(_0x48fe55){return{'name':_0x48fe55[_0x15f0('0x2e')],'type':_0x48fe55['type'][_0x15f0('0x2f')]};});_0x7995cf['model']=_[_0x15f0('0x2b')](_0x51ca93,_0x15f0('0x28'));_0x7995cf[_0x15f0('0x30')]=_[_0x15f0('0x31')](_0x31f696[_0x15f0('0x30')]);_0x7995cf[_0x15f0('0x32')]=_[_0x15f0('0x33')](_0x7995cf[_0x15f0('0x34')],_0x7995cf['query']);_0x4b4acf[_0x15f0('0x35')]=_[_0x15f0('0x33')](_0x7995cf['model'],qs[_0x15f0('0x36')](_0x31f696[_0x15f0('0x30')][_0x15f0('0x36')]));_0x4b4acf[_0x15f0('0x35')]=_0x4b4acf[_0x15f0('0x35')]['length']?_0x4b4acf[_0x15f0('0x35')]:_0x7995cf[_0x15f0('0x34')];if(!_0x31f696[_0x15f0('0x30')][_0x15f0('0x37')](_0x15f0('0x38'))){_0x4b4acf['limit']=qs['limit'](_0x31f696['query'][_0x15f0('0x1e')]);_0x4b4acf[_0x15f0('0x1d')]=qs[_0x15f0('0x1d')](_0x31f696[_0x15f0('0x30')][_0x15f0('0x1d')]);}_0x4b4acf['order']=qs[_0x15f0('0x39')](_0x31f696['query'][_0x15f0('0x39')]);_0x4b4acf[_0x15f0('0x3a')]=qs[_0x15f0('0x32')](_[_0x15f0('0x3b')](_0x31f696[_0x15f0('0x30')],_0x7995cf['filters']),_0x51ca93);if(_0x31f696[_0x15f0('0x30')]['filter']){_0x4b4acf[_0x15f0('0x3a')]=_['merge'](_0x4b4acf[_0x15f0('0x3a')],{'$or':_[_0x15f0('0x2b')](_0x51ca93,function(_0x5ba86e){if(_0x5ba86e['type']!==_0x15f0('0x3c')){var _0x466638={};_0x466638[_0x5ba86e['name']]={'$like':'%'+_0x31f696[_0x15f0('0x30')][_0x15f0('0x3d')]+'%'};return _0x466638;}})});}_0x4b4acf=_[_0x15f0('0x3e')]({},_0x4b4acf,_0x31f696[_0x15f0('0x3f')]);var _0x1223b9={'where':_0x4b4acf[_0x15f0('0x3a')]};return db[_0x15f0('0x2c')][_0x15f0('0x1f')](_0x1223b9)[_0x15f0('0x25')](function(_0x297e2c){_0x4ecf44[_0x15f0('0x1f')]=_0x297e2c;if(_0x31f696[_0x15f0('0x30')][_0x15f0('0x40')]){_0x4b4acf[_0x15f0('0x41')]=[{'all':!![]}];}return db[_0x15f0('0x2c')]['findAll'](_0x4b4acf);})[_0x15f0('0x25')](function(_0x55d690){_0x4ecf44['rows']=_0x55d690;return _0x4ecf44;})[_0x15f0('0x25')](respondWithFilteredResult(_0x220d2f,_0x4b4acf))[_0x15f0('0x42')](handleError(_0x220d2f,null));};exports[_0x15f0('0x43')]=function(_0x249745,_0x151008){var _0x524631={'raw':!![],'where':{'id':_0x249745[_0x15f0('0x44')]['id']}},_0x117615={};_0x117615[_0x15f0('0x34')]=_[_0x15f0('0x31')](db[_0x15f0('0x2c')][_0x15f0('0x2d')]);_0x117615[_0x15f0('0x30')]=_[_0x15f0('0x31')](_0x249745[_0x15f0('0x30')]);_0x117615[_0x15f0('0x32')]=_[_0x15f0('0x33')](_0x117615['model'],_0x117615[_0x15f0('0x30')]);_0x524631[_0x15f0('0x35')]=_[_0x15f0('0x33')](_0x117615[_0x15f0('0x34')],qs[_0x15f0('0x36')](_0x249745['query'][_0x15f0('0x36')]));_0x524631[_0x15f0('0x35')]=_0x524631[_0x15f0('0x35')][_0x15f0('0x45')]?_0x524631['attributes']:_0x117615[_0x15f0('0x34')];if(_0x249745[_0x15f0('0x30')][_0x15f0('0x40')]){_0x524631['include']=[{'all':!![]}];}_0x524631=_[_0x15f0('0x3e')]({},_0x524631,_0x249745[_0x15f0('0x3f')]);return db[_0x15f0('0x2c')][_0x15f0('0x46')](_0x524631)['then'](handleEntityNotFound(_0x151008,null))[_0x15f0('0x25')](respondWithResult(_0x151008,null))[_0x15f0('0x42')](handleError(_0x151008,null));};exports[_0x15f0('0x47')]=function(_0x4082e2,_0x24ae27){return db[_0x15f0('0x2c')][_0x15f0('0x47')](_0x4082e2[_0x15f0('0x48')],{})[_0x15f0('0x25')](respondWithResult(_0x24ae27,0xc9))[_0x15f0('0x42')](handleError(_0x24ae27,null));};exports[_0x15f0('0x24')]=function(_0x39bb66,_0xa10e90){if(_0x39bb66[_0x15f0('0x48')]['id']){delete _0x39bb66[_0x15f0('0x48')]['id'];}return db['JscriptyQuestionReport'][_0x15f0('0x46')]({'where':{'id':_0x39bb66[_0x15f0('0x44')]['id']}})[_0x15f0('0x25')](handleEntityNotFound(_0xa10e90,null))[_0x15f0('0x25')](saveUpdates(_0x39bb66[_0x15f0('0x48')],null))[_0x15f0('0x25')](respondWithResult(_0xa10e90,null))[_0x15f0('0x42')](handleError(_0xa10e90,null));};exports[_0x15f0('0x26')]=function(_0x1078b1,_0x46663d){return db[_0x15f0('0x2c')][_0x15f0('0x46')]({'where':{'id':_0x1078b1[_0x15f0('0x44')]['id']}})[_0x15f0('0x25')](handleEntityNotFound(_0x46663d,null))[_0x15f0('0x25')](removeEntity(_0x46663d,null))[_0x15f0('0x42')](handleError(_0x46663d,null));};exports['describe']=function(_0x4f3529,_0x35994f){return db['JscriptyQuestionReport'][_0x15f0('0x49')]()[_0x15f0('0x25')](respondWithResult(_0x35994f,null))[_0x15f0('0x42')](handleError(_0x35994f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d4628c6..6d96239 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 _0x3dd6=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport'];(function(_0x11096c,_0x4aab24){var _0x3ba1c5=function(_0x4b55fb){while(--_0x4b55fb){_0x11096c['push'](_0x11096c['shift']());}};_0x3ba1c5(++_0x4aab24);}(_0x3dd6,0x1c1));var _0x63dd=function(_0x4a6e77,_0x4a677c){_0x4a6e77=_0x4a6e77-0x0;var _0x1c137e=_0x3dd6[_0x4a6e77];return _0x1c137e;};'use strict';var _=require(_0x63dd('0x0'));var util=require(_0x63dd('0x1'));var logger=require(_0x63dd('0x2'))(_0x63dd('0x3'));var moment=require(_0x63dd('0x4'));var BPromise=require(_0x63dd('0x5'));var rp=require(_0x63dd('0x6'));var fs=require('fs');var path=require(_0x63dd('0x7'));var rimraf=require(_0x63dd('0x8'));var config=require(_0x63dd('0x9'));var attributes=require(_0x63dd('0xa'));module['exports']=function(_0x1b5b38,_0x2e210b){return _0x1b5b38[_0x63dd('0xb')](_0x63dd('0xc'),attributes,{'tableName':_0x63dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc517=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0xc517,0xd9));var _0x7c51=function(_0x2912bf,_0x4586d7){_0x2912bf=_0x2912bf-0x0;var _0x1789f0=_0xc517[_0x2912bf];return _0x1789f0;};'use strict';var _=require(_0x7c51('0x0'));var util=require(_0x7c51('0x1'));var logger=require(_0x7c51('0x2'))(_0x7c51('0x3'));var moment=require(_0x7c51('0x4'));var BPromise=require(_0x7c51('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c51('0x6'));var config=require(_0x7c51('0x7'));var attributes=require(_0x7c51('0x8'));module[_0x7c51('0x9')]=function(_0x385729,_0x4e4e9e){return _0x385729[_0x7c51('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x7c51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 8b97e65..e05e789 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 _0x9611=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d237d,_0x50af61){var _0x5459d4=function(_0x18809b){while(--_0x18809b){_0x3d237d['push'](_0x3d237d['shift']());}};_0x5459d4(++_0x50af61);}(_0x9611,0xdb));var _0x1961=function(_0x48b17a,_0x264fd9){_0x48b17a=_0x48b17a-0x0;var _0x4197ba=_0x9611[_0x48b17a];return _0x4197ba;};'use strict';var _=require(_0x1961('0x0'));var util=require(_0x1961('0x1'));var moment=require(_0x1961('0x2'));var BPromise=require(_0x1961('0x3'));var rs=require(_0x1961('0x4'));var fs=require('fs');var Redis=require(_0x1961('0x5'));var db=require(_0x1961('0x6'))['db'];var utils=require(_0x1961('0x7'));var logger=require(_0x1961('0x8'))(_0x1961('0x9'));var config=require(_0x1961('0xa'));var jayson=require(_0x1961('0xb'));var client=jayson['client'][_0x1961('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x572384,_0x52b524,_0x9f55f9){return new BPromise(function(_0x587cc3,_0x22bfa9){return client[_0x1961('0xd')](_0x572384,_0x9f55f9)[_0x1961('0xe')](function(_0xb48f1f){logger['info'](_0x1961('0xf'),_0x52b524,_0x1961('0x10'));logger[_0x1961('0x11')](_0x1961('0x12'),_0x52b524,_0x1961('0x10'),JSON[_0x1961('0x13')](_0xb48f1f));if(_0xb48f1f[_0x1961('0x14')]){if(_0xb48f1f[_0x1961('0x14')][_0x1961('0x15')]===0x1f4){logger[_0x1961('0x14')](_0x1961('0xf'),_0x52b524,_0xb48f1f['error'][_0x1961('0x16')]);return _0x22bfa9(_0xb48f1f['error'][_0x1961('0x16')]);}logger[_0x1961('0x14')](_0x1961('0xf'),_0x52b524,_0xb48f1f[_0x1961('0x14')][_0x1961('0x16')]);return _0x587cc3(_0xb48f1f['error'][_0x1961('0x16')]);}else{logger['info'](_0x1961('0xf'),_0x52b524,_0x1961('0x10'));_0x587cc3(_0xb48f1f[_0x1961('0x17')]['message']);}})[_0x1961('0x18')](function(_0x14c3c6){logger[_0x1961('0x14')](_0x1961('0xf'),_0x52b524,_0x14c3c6);_0x22bfa9(_0x14c3c6);});});} \ No newline at end of file +var _0x7685=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis'];(function(_0x5add8e,_0x4372f6){var _0x285479=function(_0x78274){while(--_0x78274){_0x5add8e['push'](_0x5add8e['shift']());}};_0x285479(++_0x4372f6);}(_0x7685,0x11c));var _0x5768=function(_0x266c71,_0x29dec2){_0x266c71=_0x266c71-0x0;var _0x578b41=_0x7685[_0x266c71];return _0x578b41;};'use strict';var _=require(_0x5768('0x0'));var util=require(_0x5768('0x1'));var moment=require(_0x5768('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5768('0x3'));var db=require(_0x5768('0x4'))['db'];var utils=require(_0x5768('0x5'));var logger=require(_0x5768('0x6'))('rpc');var config=require(_0x5768('0x7'));var jayson=require(_0x5768('0x8'));var client=jayson[_0x5768('0x9')][_0x5768('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e0bf8,_0x2d99bd,_0x4eddd7){return new BPromise(function(_0x1145d9,_0x37d2db){return client[_0x5768('0xb')](_0x3e0bf8,_0x4eddd7)[_0x5768('0xc')](function(_0x28693c){logger[_0x5768('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2d99bd,_0x5768('0xe'));logger[_0x5768('0xf')](_0x5768('0x10'),_0x2d99bd,'request\x20sent',JSON[_0x5768('0x11')](_0x28693c));if(_0x28693c[_0x5768('0x12')]){if(_0x28693c[_0x5768('0x12')][_0x5768('0x13')]===0x1f4){logger['error'](_0x5768('0x14'),_0x2d99bd,_0x28693c['error'][_0x5768('0x15')]);return _0x37d2db(_0x28693c[_0x5768('0x12')][_0x5768('0x15')]);}logger[_0x5768('0x12')](_0x5768('0x14'),_0x2d99bd,_0x28693c['error']['message']);return _0x1145d9(_0x28693c[_0x5768('0x12')][_0x5768('0x15')]);}else{logger['info'](_0x5768('0x14'),_0x2d99bd,_0x5768('0xe'));_0x1145d9(_0x28693c[_0x5768('0x16')][_0x5768('0x15')]);}})[_0x5768('0x17')](function(_0x136008){logger['error'](_0x5768('0x14'),_0x2d99bd,_0x136008);_0x37d2db(_0x136008);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 93357f8..2b5c1a3 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 _0x618b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','getQuestions','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xce4eed,_0x3c8fd8){var _0x1a10cc=function(_0x1d39bd){while(--_0x1d39bd){_0xce4eed['push'](_0xce4eed['shift']());}};_0x1a10cc(++_0x3c8fd8);}(_0x618b,0xf6));var _0xb618=function(_0x2441cc,_0x450696){_0x2441cc=_0x2441cc-0x0;var _0x199774=_0x618b[_0x2441cc];return _0x199774;};'use strict';var multer=require(_0xb618('0x0'));var util=require(_0xb618('0x1'));var path=require('path');var timeout=require(_0xb618('0x2'));var express=require(_0xb618('0x3'));var router=express[_0xb618('0x4')]();var fs_extra=require(_0xb618('0x5'));var auth=require(_0xb618('0x6'));var interaction=require(_0xb618('0x7'));var config=require(_0xb618('0x8'));var controller=require(_0xb618('0x9'));router[_0xb618('0xa')]('/',auth[_0xb618('0xb')](),controller['index']);router[_0xb618('0xa')](_0xb618('0xc'),auth[_0xb618('0xb')](),controller[_0xb618('0xd')]);router[_0xb618('0xa')]('/:id',auth[_0xb618('0xb')](),controller['show']);router[_0xb618('0xa')]('/:id/questions',auth[_0xb618('0xb')](),controller[_0xb618('0xe')]);router['post']('/',auth[_0xb618('0xb')](),controller['create']);router[_0xb618('0xf')](_0xb618('0x10'),auth[_0xb618('0xb')](),controller[_0xb618('0x11')]);router[_0xb618('0x12')](_0xb618('0x10'),auth[_0xb618('0xb')](),controller[_0xb618('0x13')]);module[_0xb618('0x14')]=router; \ No newline at end of file +var _0xf22f=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf22f,0xd7));var _0xff22=function(_0x1efd51,_0x541cd7){_0x1efd51=_0x1efd51-0x0;var _0x56f58e=_0xf22f[_0x1efd51];return _0x56f58e;};'use strict';var multer=require(_0xff22('0x0'));var util=require('util');var path=require(_0xff22('0x1'));var timeout=require(_0xff22('0x2'));var express=require(_0xff22('0x3'));var router=express[_0xff22('0x4')]();var fs_extra=require(_0xff22('0x5'));var auth=require(_0xff22('0x6'));var interaction=require(_0xff22('0x7'));var config=require('../../config/environment');var controller=require(_0xff22('0x8'));router[_0xff22('0x9')]('/',auth[_0xff22('0xa')](),controller['index']);router[_0xff22('0x9')]('/describe',auth[_0xff22('0xa')](),controller[_0xff22('0xb')]);router[_0xff22('0x9')](_0xff22('0xc'),auth['isAuthenticated'](),controller[_0xff22('0xd')]);router['get'](_0xff22('0xe'),auth[_0xff22('0xa')](),controller[_0xff22('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff22('0x10')]);router[_0xff22('0x11')](_0xff22('0xc'),auth[_0xff22('0xa')](),controller[_0xff22('0x12')]);router[_0xff22('0x13')](_0xff22('0xc'),auth[_0xff22('0xa')](),controller[_0xff22('0x14')]);module[_0xff22('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c2e52cf..0b6bf63 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 _0x9311=['setDataValue','format','STRING','BOOLEAN','moment','sequelize'];(function(_0x89e0e3,_0x2008a0){var _0x1a8213=function(_0x574448){while(--_0x574448){_0x89e0e3['push'](_0x89e0e3['shift']());}};_0x1a8213(++_0x2008a0);}(_0x9311,0x1e4));var _0x1931=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9311[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x1931('0x0'));var Sequelize=require(_0x1931('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1c255b){this[_0x1931('0x2')]('starttime',_0x1c255b);this['setDataValue']('endtime',moment()[_0x1931('0x3')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x1931('0x4')]},'projectname':{'type':Sequelize[_0x1931('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1931('0x4')]},'calleridname':{'type':Sequelize[_0x1931('0x4')]},'calleridnum':{'type':Sequelize[_0x1931('0x4')]},'completed':{'type':Sequelize[_0x1931('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x4415=['sequelize','setDataValue','endtime','format','DATE','STRING','BOOLEAN'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4415,0x69));var _0x5441=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x4415[_0x166d93];return _0xba708;};'use strict';var moment=require('moment');var Sequelize=require(_0x5441('0x0'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1fb43a){this[_0x5441('0x1')]('starttime',_0x1fb43a);this[_0x5441('0x1')](_0x5441('0x2'),moment()[_0x5441('0x3')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x5441('0x4')]},'membername':{'type':Sequelize[_0x5441('0x5')]},'projectname':{'type':Sequelize[_0x5441('0x5')]},'queue':{'type':Sequelize[_0x5441('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5441('0x5')]},'calleridnum':{'type':Sequelize[_0x5441('0x5')]},'completed':{'type':Sequelize[_0x5441('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ba789f5..78d2724 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 _0x6b71=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','JscriptySessionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','merge','includeAll','findAll','catch','include','options','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','order','pick','SessionId','rows','rimraf','zip-dir','fast-json-patch','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count'];(function(_0x3895bc,_0x47d35d){var _0xc4ba5b=function(_0x5aa16a){while(--_0x5aa16a){_0x3895bc['push'](_0x3895bc['shift']());}};_0xc4ba5b(++_0x47d35d);}(_0x6b71,0xc7));var _0x16b7=function(_0x1ade10,_0x1c8f0d){_0x1ade10=_0x1ade10-0x0;var _0x432d4d=_0x6b71[_0x1ade10];return _0x432d4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16b7('0x0'));var zipdir=require(_0x16b7('0x1'));var jsonpatch=require(_0x16b7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x16b7('0x3'));var sox=require('sox');var csv=require(_0x16b7('0x4'));var ejs=require(_0x16b7('0x5'));var fs=require('fs');var fs_extra=require(_0x16b7('0x6'));var _=require(_0x16b7('0x7'));var squel=require(_0x16b7('0x8'));var crypto=require('crypto');var jsforce=require(_0x16b7('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x16b7('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x16b7('0xa'));var authService=require(_0x16b7('0xb'));var qs=require(_0x16b7('0xc'));var as=require(_0x16b7('0xd'));var hardwareService=require(_0x16b7('0xe'));var logger=require('../../config/logger')(_0x16b7('0xf'));var utils=require('../../config/utils');var config=require(_0x16b7('0x10'));var licenseUtil=require(_0x16b7('0x11'));var db=require(_0x16b7('0x12'))['db'];function respondWithStatusCode(_0x1364b7,_0x481fc8){_0x481fc8=_0x481fc8||0xcc;return function(_0x508d3c){if(_0x508d3c){return _0x1364b7['sendStatus'](_0x481fc8);}return _0x1364b7[_0x16b7('0x13')](_0x481fc8)[_0x16b7('0x14')]();};}function respondWithResult(_0x163490,_0x1aa099){_0x1aa099=_0x1aa099||0xc8;return function(_0xccd895){if(_0xccd895){return _0x163490[_0x16b7('0x13')](_0x1aa099)[_0x16b7('0x15')](_0xccd895);}};}function respondWithFilteredResult(_0xb2d431,_0x36ac03){return function(_0x2874e2){if(_0x2874e2){var _0x30d24e=typeof _0x36ac03['offset']===_0x16b7('0x16')&&typeof _0x36ac03[_0x16b7('0x17')]===_0x16b7('0x16');var _0x303f0d=_0x2874e2['count'];var _0x58ea30=_0x30d24e?0x0:_0x36ac03[_0x16b7('0x18')];var _0x320bc8=_0x30d24e?_0x2874e2[_0x16b7('0x19')]:_0x36ac03[_0x16b7('0x18')]+_0x36ac03[_0x16b7('0x17')];var _0x3e2dfd;if(_0x320bc8>=_0x303f0d){_0x320bc8=_0x303f0d;_0x3e2dfd=0xc8;}else{_0x3e2dfd=0xce;}_0xb2d431[_0x16b7('0x13')](_0x3e2dfd);return _0xb2d431[_0x16b7('0x1a')](_0x16b7('0x1b'),_0x58ea30+'-'+_0x320bc8+'/'+_0x303f0d)['json'](_0x2874e2);}return null;};}function patchUpdates(_0x5c8ef6){return function(_0x5cb581){try{jsonpatch[_0x16b7('0x1c')](_0x5cb581,_0x5c8ef6,!![]);}catch(_0x5637fe){return BPromise[_0x16b7('0x1d')](_0x5637fe);}return _0x5cb581[_0x16b7('0x1e')]();};}function saveUpdates(_0x12c398,_0x305b97){return function(_0x4f1278){if(_0x4f1278){return _0x4f1278[_0x16b7('0x1f')](_0x12c398)[_0x16b7('0x20')](function(_0x55454c){return _0x55454c;});}return null;};}function removeEntity(_0x3c1046,_0x57236e){return function(_0x490ab9){if(_0x490ab9){return _0x490ab9[_0x16b7('0x21')]()[_0x16b7('0x20')](function(){_0x3c1046[_0x16b7('0x13')](0xcc)[_0x16b7('0x14')]();});}};}function handleEntityNotFound(_0xccb4e0,_0x30ff36){return function(_0x5aefd6){if(!_0x5aefd6){_0xccb4e0['sendStatus'](0x194);}return _0x5aefd6;};}function handleError(_0x8021e9,_0x17f27e){_0x17f27e=_0x17f27e||0x1f4;return function(_0x4e5b2f){logger[_0x16b7('0x22')](_0x4e5b2f['stack']);if(_0x4e5b2f[_0x16b7('0x23')]){delete _0x4e5b2f[_0x16b7('0x23')];}_0x8021e9[_0x16b7('0x13')](_0x17f27e)[_0x16b7('0x24')](_0x4e5b2f);};}exports[_0x16b7('0x25')]=function(_0x12d806,_0x560935){var _0x3046a2={},_0x23afc0={},_0x4f30f2={'count':0x0,'rows':[]};var _0x579e10=_['map'](db[_0x16b7('0x26')][_0x16b7('0x27')],function(_0x28cbc7){return{'name':_0x28cbc7[_0x16b7('0x28')],'type':_0x28cbc7['type'][_0x16b7('0x29')]};});_0x23afc0[_0x16b7('0x2a')]=_[_0x16b7('0x2b')](_0x579e10,'name');_0x23afc0[_0x16b7('0x2c')]=_[_0x16b7('0x2d')](_0x12d806[_0x16b7('0x2c')]);_0x23afc0[_0x16b7('0x2e')]=_['intersection'](_0x23afc0[_0x16b7('0x2a')],_0x23afc0[_0x16b7('0x2c')]);_0x3046a2[_0x16b7('0x2f')]=_[_0x16b7('0x30')](_0x23afc0[_0x16b7('0x2a')],qs['fields'](_0x12d806['query'][_0x16b7('0x31')]));_0x3046a2['attributes']=_0x3046a2[_0x16b7('0x2f')][_0x16b7('0x32')]?_0x3046a2[_0x16b7('0x2f')]:_0x23afc0[_0x16b7('0x2a')];if(!_0x12d806[_0x16b7('0x2c')][_0x16b7('0x33')](_0x16b7('0x34'))){_0x3046a2[_0x16b7('0x17')]=qs[_0x16b7('0x17')](_0x12d806[_0x16b7('0x2c')][_0x16b7('0x17')]);_0x3046a2['offset']=qs[_0x16b7('0x18')](_0x12d806[_0x16b7('0x2c')][_0x16b7('0x18')]);}_0x3046a2['order']=qs[_0x16b7('0x35')](_0x12d806['query'][_0x16b7('0x35')]);_0x3046a2[_0x16b7('0x36')]=qs[_0x16b7('0x2e')](_['pick'](_0x12d806[_0x16b7('0x2c')],_0x23afc0['filters']),_0x579e10);if(_0x12d806['query'][_0x16b7('0x37')]){_0x3046a2[_0x16b7('0x36')]=_['merge'](_0x3046a2[_0x16b7('0x36')],{'$or':_[_0x16b7('0x2b')](_0x579e10,function(_0x489b84){if(_0x489b84[_0x16b7('0x38')]!=='VIRTUAL'){var _0x2cd7ae={};_0x2cd7ae[_0x489b84[_0x16b7('0x23')]]={'$like':'%'+_0x12d806[_0x16b7('0x2c')][_0x16b7('0x37')]+'%'};return _0x2cd7ae;}})});}_0x3046a2=_[_0x16b7('0x39')]({},_0x3046a2,_0x12d806['options']);var _0x208668={'where':_0x3046a2[_0x16b7('0x36')]};return db[_0x16b7('0x26')][_0x16b7('0x19')](_0x208668)[_0x16b7('0x20')](function(_0x3f38dd){_0x4f30f2[_0x16b7('0x19')]=_0x3f38dd;if(_0x12d806['query'][_0x16b7('0x3a')]){_0x3046a2['include']=[{'all':!![]}];}return db[_0x16b7('0x26')][_0x16b7('0x3b')](_0x3046a2);})['then'](function(_0x5d6dfa){_0x4f30f2['rows']=_0x5d6dfa;return _0x4f30f2;})[_0x16b7('0x20')](respondWithFilteredResult(_0x560935,_0x3046a2))[_0x16b7('0x3c')](handleError(_0x560935,null));};exports['show']=function(_0x1cdb5d,_0x1d5310){var _0xa03a31={'raw':!![],'where':{'id':_0x1cdb5d['params']['id']}},_0xeba1dd={};_0xeba1dd[_0x16b7('0x2a')]=_[_0x16b7('0x2d')](db[_0x16b7('0x26')][_0x16b7('0x27')]);_0xeba1dd[_0x16b7('0x2c')]=_[_0x16b7('0x2d')](_0x1cdb5d[_0x16b7('0x2c')]);_0xeba1dd[_0x16b7('0x2e')]=_['intersection'](_0xeba1dd[_0x16b7('0x2a')],_0xeba1dd[_0x16b7('0x2c')]);_0xa03a31[_0x16b7('0x2f')]=_['intersection'](_0xeba1dd[_0x16b7('0x2a')],qs['fields'](_0x1cdb5d[_0x16b7('0x2c')][_0x16b7('0x31')]));_0xa03a31['attributes']=_0xa03a31[_0x16b7('0x2f')][_0x16b7('0x32')]?_0xa03a31['attributes']:_0xeba1dd[_0x16b7('0x2a')];if(_0x1cdb5d['query'][_0x16b7('0x3a')]){_0xa03a31[_0x16b7('0x3d')]=[{'all':!![]}];}_0xa03a31=_[_0x16b7('0x39')]({},_0xa03a31,_0x1cdb5d[_0x16b7('0x3e')]);return db[_0x16b7('0x26')][_0x16b7('0x3f')](_0xa03a31)[_0x16b7('0x20')](handleEntityNotFound(_0x1d5310,null))['then'](respondWithResult(_0x1d5310,null))[_0x16b7('0x3c')](handleError(_0x1d5310,null));};exports['create']=function(_0x502be5,_0x35d82a){return db[_0x16b7('0x26')][_0x16b7('0x40')](_0x502be5[_0x16b7('0x41')],{})[_0x16b7('0x20')](respondWithResult(_0x35d82a,0xc9))[_0x16b7('0x3c')](handleError(_0x35d82a,null));};exports[_0x16b7('0x1f')]=function(_0x34599f,_0x1b83ee){if(_0x34599f['body']['id']){delete _0x34599f[_0x16b7('0x41')]['id'];}return db[_0x16b7('0x26')][_0x16b7('0x3f')]({'where':{'id':_0x34599f[_0x16b7('0x42')]['id']}})[_0x16b7('0x20')](handleEntityNotFound(_0x1b83ee,null))[_0x16b7('0x20')](saveUpdates(_0x34599f[_0x16b7('0x41')],null))[_0x16b7('0x20')](respondWithResult(_0x1b83ee,null))[_0x16b7('0x3c')](handleError(_0x1b83ee,null));};exports[_0x16b7('0x21')]=function(_0x5b6295,_0x4a6e67){return db[_0x16b7('0x26')][_0x16b7('0x3f')]({'where':{'id':_0x5b6295[_0x16b7('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a6e67,null))[_0x16b7('0x20')](removeEntity(_0x4a6e67,null))[_0x16b7('0x3c')](handleError(_0x4a6e67,null));};exports[_0x16b7('0x43')]=function(_0x480173,_0x4d9da9){return db['JscriptySessionReport'][_0x16b7('0x43')]()[_0x16b7('0x20')](respondWithResult(_0x4d9da9,null))[_0x16b7('0x3c')](handleError(_0x4d9da9,null));};exports[_0x16b7('0x44')]=function(_0x4d9d29,_0x199260,_0x4181be){var _0x2a4bb2={'raw':!![],'where':{}};var _0x4aac19={};var _0x12ddc7={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x16b7('0x45')]({'where':{'id':_0x4d9d29[_0x16b7('0x42')]['id']}})[_0x16b7('0x20')](handleEntityNotFound(_0x199260,null))['then'](function(_0xc32754){if(_0xc32754){_0x4aac19[_0x16b7('0x2a')]=_['keys'](db[_0x16b7('0x46')]['rawAttributes']);_0x4aac19[_0x16b7('0x2c')]=_[_0x16b7('0x2d')](_0x4d9d29[_0x16b7('0x2c')]);_0x4aac19[_0x16b7('0x2e')]=_[_0x16b7('0x30')](_0x4aac19[_0x16b7('0x2a')],_0x4aac19[_0x16b7('0x2c')]);_0x2a4bb2['attributes']=_[_0x16b7('0x30')](_0x4aac19['model'],qs[_0x16b7('0x31')](_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x31')]));_0x2a4bb2[_0x16b7('0x2f')]=_0x2a4bb2[_0x16b7('0x2f')]['length']?_0x2a4bb2[_0x16b7('0x2f')]:_0x4aac19[_0x16b7('0x2a')];if(!_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x33')]('nolimit')){_0x2a4bb2[_0x16b7('0x17')]=qs[_0x16b7('0x17')](_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x17')]);_0x2a4bb2[_0x16b7('0x18')]=qs['offset'](_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x18')]);}_0x2a4bb2[_0x16b7('0x47')]=qs[_0x16b7('0x35')](_0x4d9d29[_0x16b7('0x2c')]['sort']);_0x2a4bb2[_0x16b7('0x36')]=qs[_0x16b7('0x2e')](_[_0x16b7('0x48')](_0x4d9d29[_0x16b7('0x2c')],_0x4aac19[_0x16b7('0x2e')]));_0x2a4bb2[_0x16b7('0x36')][_0x16b7('0x49')]=_0xc32754['id'];if(_0x4d9d29[_0x16b7('0x2c')]['filter']){_0x2a4bb2[_0x16b7('0x36')]=_[_0x16b7('0x39')](_0x2a4bb2['where'],{'$or':_['map'](_0x2a4bb2['attributes'],function(_0x27e898){var _0x4797f6={};_0x4797f6[_0x27e898]={'$like':'%'+_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x37')]+'%'};return _0x4797f6;})});}_0x2a4bb2=_['merge']({},_0x2a4bb2,_0x4d9d29['options']);return db['JscriptyQuestionReport'][_0x16b7('0x19')]({'where':_0x2a4bb2[_0x16b7('0x36')]})['then'](function(_0x5db62d){_0x12ddc7[_0x16b7('0x19')]=_0x5db62d;if(_0x4d9d29[_0x16b7('0x2c')][_0x16b7('0x3a')]){_0x2a4bb2[_0x16b7('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x16b7('0x3b')](_0x2a4bb2);})[_0x16b7('0x20')](function(_0x40f03a){_0x12ddc7[_0x16b7('0x4a')]=_0x40f03a;return _0x12ddc7;});}})[_0x16b7('0x20')](respondWithFilteredResult(_0x199260,_0x2a4bb2))['catch'](handleError(_0x199260,null));}; \ No newline at end of file +var _0x6e19=['stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','options','JscriptySessionReport','findAll','catch','show','find','create','body','params','describe','pick','SessionId','JscriptyQuestionReport','include','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','save','update','destroy','then','end','error'];(function(_0x564bc7,_0x14e85d){var _0x5e460c=function(_0xad0275){while(--_0xad0275){_0x564bc7['push'](_0x564bc7['shift']());}};_0x5e460c(++_0x14e85d);}(_0x6e19,0x191));var _0x96e1=function(_0xdccb1a,_0x22e024){_0xdccb1a=_0xdccb1a-0x0;var _0x312479=_0x6e19[_0xdccb1a];return _0x312479;};'use strict';var emlformat=require(_0x96e1('0x0'));var rimraf=require(_0x96e1('0x1'));var zipdir=require(_0x96e1('0x2'));var jsonpatch=require(_0x96e1('0x3'));var rp=require(_0x96e1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x96e1('0x5'));var util=require('util');var path=require(_0x96e1('0x6'));var sox=require('sox');var csv=require(_0x96e1('0x7'));var ejs=require(_0x96e1('0x8'));var fs=require('fs');var fs_extra=require(_0x96e1('0x9'));var _=require(_0x96e1('0xa'));var squel=require(_0x96e1('0xb'));var crypto=require('crypto');var jsforce=require(_0x96e1('0xc'));var deskjs=require(_0x96e1('0xd'));var toCsv=require(_0x96e1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x96e1('0xe'));var authService=require(_0x96e1('0xf'));var qs=require(_0x96e1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x96e1('0x11'))(_0x96e1('0x12'));var utils=require(_0x96e1('0x13'));var config=require(_0x96e1('0x14'));var licenseUtil=require(_0x96e1('0x15'));var db=require(_0x96e1('0x16'))['db'];function respondWithStatusCode(_0x364835,_0x331c29){_0x331c29=_0x331c29||0xcc;return function(_0x13e3a4){if(_0x13e3a4){return _0x364835[_0x96e1('0x17')](_0x331c29);}return _0x364835[_0x96e1('0x18')](_0x331c29)['end']();};}function respondWithResult(_0x5092dd,_0x2d5660){_0x2d5660=_0x2d5660||0xc8;return function(_0x4a85c7){if(_0x4a85c7){return _0x5092dd['status'](_0x2d5660)[_0x96e1('0x19')](_0x4a85c7);}};}function respondWithFilteredResult(_0x378e08,_0x35f938){return function(_0x47ebcd){if(_0x47ebcd){var _0x5efe3c=typeof _0x35f938['offset']==='undefined'&&typeof _0x35f938[_0x96e1('0x1a')]===_0x96e1('0x1b');var _0x254981=_0x47ebcd[_0x96e1('0x1c')];var _0x3685dc=_0x5efe3c?0x0:_0x35f938[_0x96e1('0x1d')];var _0x4e4dc2=_0x5efe3c?_0x47ebcd[_0x96e1('0x1c')]:_0x35f938[_0x96e1('0x1d')]+_0x35f938['limit'];var _0x5733ae;if(_0x4e4dc2>=_0x254981){_0x4e4dc2=_0x254981;_0x5733ae=0xc8;}else{_0x5733ae=0xce;}_0x378e08['status'](_0x5733ae);return _0x378e08[_0x96e1('0x1e')]('Content-Range',_0x3685dc+'-'+_0x4e4dc2+'/'+_0x254981)[_0x96e1('0x19')](_0x47ebcd);}return null;};}function patchUpdates(_0x1d7360){return function(_0x4b6397){try{jsonpatch['apply'](_0x4b6397,_0x1d7360,!![]);}catch(_0x567323){return BPromise['reject'](_0x567323);}return _0x4b6397[_0x96e1('0x1f')]();};}function saveUpdates(_0x21d64e,_0x285b15){return function(_0x17cfdf){if(_0x17cfdf){return _0x17cfdf[_0x96e1('0x20')](_0x21d64e)['then'](function(_0x41667f){return _0x41667f;});}return null;};}function removeEntity(_0x56b5bf,_0xf1b753){return function(_0x36af75){if(_0x36af75){return _0x36af75[_0x96e1('0x21')]()[_0x96e1('0x22')](function(){_0x56b5bf['status'](0xcc)[_0x96e1('0x23')]();});}};}function handleEntityNotFound(_0x55f2c7,_0x4bed6b){return function(_0xcdcea1){if(!_0xcdcea1){_0x55f2c7[_0x96e1('0x17')](0x194);}return _0xcdcea1;};}function handleError(_0xb67707,_0x31c147){_0x31c147=_0x31c147||0x1f4;return function(_0x225e32){logger[_0x96e1('0x24')](_0x225e32[_0x96e1('0x25')]);if(_0x225e32[_0x96e1('0x26')]){delete _0x225e32[_0x96e1('0x26')];}_0xb67707['status'](_0x31c147)['send'](_0x225e32);};}exports[_0x96e1('0x27')]=function(_0xee8dba,_0x2f8f7e){var _0x4a6c9f={},_0x49c05c={},_0x5ba685={'count':0x0,'rows':[]};var _0x3f003a=_[_0x96e1('0x28')](db['JscriptySessionReport'][_0x96e1('0x29')],function(_0x3b80fe){return{'name':_0x3b80fe[_0x96e1('0x2a')],'type':_0x3b80fe[_0x96e1('0x2b')][_0x96e1('0x2c')]};});_0x49c05c[_0x96e1('0x2d')]=_[_0x96e1('0x28')](_0x3f003a,_0x96e1('0x26'));_0x49c05c[_0x96e1('0x2e')]=_[_0x96e1('0x2f')](_0xee8dba['query']);_0x49c05c[_0x96e1('0x30')]=_[_0x96e1('0x31')](_0x49c05c[_0x96e1('0x2d')],_0x49c05c['query']);_0x4a6c9f[_0x96e1('0x32')]=_[_0x96e1('0x31')](_0x49c05c[_0x96e1('0x2d')],qs[_0x96e1('0x33')](_0xee8dba['query'][_0x96e1('0x33')]));_0x4a6c9f['attributes']=_0x4a6c9f['attributes'][_0x96e1('0x34')]?_0x4a6c9f['attributes']:_0x49c05c[_0x96e1('0x2d')];if(!_0xee8dba[_0x96e1('0x2e')]['hasOwnProperty'](_0x96e1('0x35'))){_0x4a6c9f[_0x96e1('0x1a')]=qs[_0x96e1('0x1a')](_0xee8dba[_0x96e1('0x2e')]['limit']);_0x4a6c9f['offset']=qs[_0x96e1('0x1d')](_0xee8dba[_0x96e1('0x2e')][_0x96e1('0x1d')]);}_0x4a6c9f[_0x96e1('0x36')]=qs[_0x96e1('0x37')](_0xee8dba[_0x96e1('0x2e')][_0x96e1('0x37')]);_0x4a6c9f['where']=qs[_0x96e1('0x30')](_['pick'](_0xee8dba[_0x96e1('0x2e')],_0x49c05c[_0x96e1('0x30')]),_0x3f003a);if(_0xee8dba[_0x96e1('0x2e')][_0x96e1('0x38')]){_0x4a6c9f[_0x96e1('0x39')]=_['merge'](_0x4a6c9f['where'],{'$or':_[_0x96e1('0x28')](_0x3f003a,function(_0x215317){if(_0x215317[_0x96e1('0x2b')]!=='VIRTUAL'){var _0x488361={};_0x488361[_0x215317[_0x96e1('0x26')]]={'$like':'%'+_0xee8dba[_0x96e1('0x2e')][_0x96e1('0x38')]+'%'};return _0x488361;}})});}_0x4a6c9f=_[_0x96e1('0x3a')]({},_0x4a6c9f,_0xee8dba[_0x96e1('0x3b')]);var _0xac8612={'where':_0x4a6c9f['where']};return db['JscriptySessionReport']['count'](_0xac8612)[_0x96e1('0x22')](function(_0x62a659){_0x5ba685[_0x96e1('0x1c')]=_0x62a659;if(_0xee8dba[_0x96e1('0x2e')]['includeAll']){_0x4a6c9f['include']=[{'all':!![]}];}return db[_0x96e1('0x3c')][_0x96e1('0x3d')](_0x4a6c9f);})[_0x96e1('0x22')](function(_0x4223bd){_0x5ba685['rows']=_0x4223bd;return _0x5ba685;})[_0x96e1('0x22')](respondWithFilteredResult(_0x2f8f7e,_0x4a6c9f))[_0x96e1('0x3e')](handleError(_0x2f8f7e,null));};exports[_0x96e1('0x3f')]=function(_0x23dff9,_0x260bd7){var _0x1c5190={'raw':!![],'where':{'id':_0x23dff9['params']['id']}},_0x3a6d84={};_0x3a6d84['model']=_[_0x96e1('0x2f')](db[_0x96e1('0x3c')][_0x96e1('0x29')]);_0x3a6d84[_0x96e1('0x2e')]=_['keys'](_0x23dff9['query']);_0x3a6d84[_0x96e1('0x30')]=_[_0x96e1('0x31')](_0x3a6d84[_0x96e1('0x2d')],_0x3a6d84[_0x96e1('0x2e')]);_0x1c5190[_0x96e1('0x32')]=_[_0x96e1('0x31')](_0x3a6d84[_0x96e1('0x2d')],qs[_0x96e1('0x33')](_0x23dff9[_0x96e1('0x2e')]['fields']));_0x1c5190[_0x96e1('0x32')]=_0x1c5190[_0x96e1('0x32')][_0x96e1('0x34')]?_0x1c5190[_0x96e1('0x32')]:_0x3a6d84[_0x96e1('0x2d')];if(_0x23dff9[_0x96e1('0x2e')]['includeAll']){_0x1c5190['include']=[{'all':!![]}];}_0x1c5190=_[_0x96e1('0x3a')]({},_0x1c5190,_0x23dff9[_0x96e1('0x3b')]);return db[_0x96e1('0x3c')][_0x96e1('0x40')](_0x1c5190)[_0x96e1('0x22')](handleEntityNotFound(_0x260bd7,null))[_0x96e1('0x22')](respondWithResult(_0x260bd7,null))[_0x96e1('0x3e')](handleError(_0x260bd7,null));};exports[_0x96e1('0x41')]=function(_0x505bd4,_0x66e38d){return db['JscriptySessionReport']['create'](_0x505bd4[_0x96e1('0x42')],{})[_0x96e1('0x22')](respondWithResult(_0x66e38d,0xc9))[_0x96e1('0x3e')](handleError(_0x66e38d,null));};exports[_0x96e1('0x20')]=function(_0xe658d9,_0x57b879){if(_0xe658d9[_0x96e1('0x42')]['id']){delete _0xe658d9['body']['id'];}return db['JscriptySessionReport'][_0x96e1('0x40')]({'where':{'id':_0xe658d9[_0x96e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x57b879,null))['then'](saveUpdates(_0xe658d9[_0x96e1('0x42')],null))[_0x96e1('0x22')](respondWithResult(_0x57b879,null))['catch'](handleError(_0x57b879,null));};exports[_0x96e1('0x21')]=function(_0x4797dc,_0x3feba0){return db[_0x96e1('0x3c')][_0x96e1('0x40')]({'where':{'id':_0x4797dc[_0x96e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x3feba0,null))[_0x96e1('0x22')](removeEntity(_0x3feba0,null))[_0x96e1('0x3e')](handleError(_0x3feba0,null));};exports[_0x96e1('0x44')]=function(_0x49e9bb,_0x56da5c){return db[_0x96e1('0x3c')][_0x96e1('0x44')]()[_0x96e1('0x22')](respondWithResult(_0x56da5c,null))['catch'](handleError(_0x56da5c,null));};exports['getQuestions']=function(_0x30f9ba,_0x5e9501,_0x19d161){var _0x710cf8={'raw':!![],'where':{}};var _0x5c226a={};var _0x558b41={'count':0x0,'rows':[]};return db[_0x96e1('0x3c')]['findOne']({'where':{'id':_0x30f9ba[_0x96e1('0x43')]['id']}})[_0x96e1('0x22')](handleEntityNotFound(_0x5e9501,null))[_0x96e1('0x22')](function(_0x427f8d){if(_0x427f8d){_0x5c226a['model']=_[_0x96e1('0x2f')](db['JscriptyQuestionReport'][_0x96e1('0x29')]);_0x5c226a[_0x96e1('0x2e')]=_[_0x96e1('0x2f')](_0x30f9ba['query']);_0x5c226a[_0x96e1('0x30')]=_['intersection'](_0x5c226a['model'],_0x5c226a[_0x96e1('0x2e')]);_0x710cf8[_0x96e1('0x32')]=_[_0x96e1('0x31')](_0x5c226a[_0x96e1('0x2d')],qs['fields'](_0x30f9ba[_0x96e1('0x2e')][_0x96e1('0x33')]));_0x710cf8[_0x96e1('0x32')]=_0x710cf8[_0x96e1('0x32')][_0x96e1('0x34')]?_0x710cf8[_0x96e1('0x32')]:_0x5c226a[_0x96e1('0x2d')];if(!_0x30f9ba[_0x96e1('0x2e')]['hasOwnProperty'](_0x96e1('0x35'))){_0x710cf8['limit']=qs[_0x96e1('0x1a')](_0x30f9ba[_0x96e1('0x2e')]['limit']);_0x710cf8[_0x96e1('0x1d')]=qs[_0x96e1('0x1d')](_0x30f9ba['query']['offset']);}_0x710cf8[_0x96e1('0x36')]=qs[_0x96e1('0x37')](_0x30f9ba[_0x96e1('0x2e')][_0x96e1('0x37')]);_0x710cf8[_0x96e1('0x39')]=qs[_0x96e1('0x30')](_[_0x96e1('0x45')](_0x30f9ba[_0x96e1('0x2e')],_0x5c226a[_0x96e1('0x30')]));_0x710cf8[_0x96e1('0x39')][_0x96e1('0x46')]=_0x427f8d['id'];if(_0x30f9ba[_0x96e1('0x2e')][_0x96e1('0x38')]){_0x710cf8[_0x96e1('0x39')]=_[_0x96e1('0x3a')](_0x710cf8[_0x96e1('0x39')],{'$or':_[_0x96e1('0x28')](_0x710cf8[_0x96e1('0x32')],function(_0x267457){var _0x5b7862={};_0x5b7862[_0x267457]={'$like':'%'+_0x30f9ba[_0x96e1('0x2e')][_0x96e1('0x38')]+'%'};return _0x5b7862;})});}_0x710cf8=_['merge']({},_0x710cf8,_0x30f9ba[_0x96e1('0x3b')]);return db[_0x96e1('0x47')][_0x96e1('0x1c')]({'where':_0x710cf8['where']})['then'](function(_0x5a70a8){_0x558b41['count']=_0x5a70a8;if(_0x30f9ba[_0x96e1('0x2e')]['includeAll']){_0x710cf8[_0x96e1('0x48')]=[{'all':!![]}];}return db[_0x96e1('0x47')][_0x96e1('0x3d')](_0x710cf8);})[_0x96e1('0x22')](function(_0x298b05){_0x558b41['rows']=_0x298b05;return _0x558b41;});}})[_0x96e1('0x22')](respondWithFilteredResult(_0x5e9501,_0x710cf8))[_0x96e1('0x3e')](handleError(_0x5e9501,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2975f79..5a09d6f 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 _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x472173,_0x140ece){var _0x5abc10=function(_0x248388){while(--_0x248388){_0x472173['push'](_0x472173['shift']());}};_0x5abc10(++_0x140ece);}(_0xfcf0,0x138));var _0x0fcf=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0xfcf0[_0x155c64];return _0x1f154a;};'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':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84e7=['./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x84e7,0x122));var _0x784e=function(_0x18f76b,_0x56704e){_0x18f76b=_0x18f76b-0x0;var _0x2900dd=_0x84e7[_0x18f76b];return _0x2900dd;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x784e('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 cbd3060..c3811d5 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 _0x57ca=['client','http','request','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x54dcc,_0x1abab9){var _0x4fd3c7=function(_0x1bbfa6){while(--_0x1bbfa6){_0x54dcc['push'](_0x54dcc['shift']());}};_0x4fd3c7(++_0x1abab9);}(_0x57ca,0x108));var _0xa57c=function(_0xda90c,_0x1b67e0){_0xda90c=_0xda90c-0x0;var _0xedbd19=_0x57ca[_0xda90c];return _0xedbd19;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30b479,_0x315936){var _0x5b446a=function(_0x183274){while(--_0x183274){_0x30b479['push'](_0x30b479['shift']());}};_0x5b446a(++_0x315936);}(_0x68b3,0x1d8));var _0x368b=function(_0x47bc17,_0x3cfcfb){_0x47bc17=_0x47bc17-0x0;var _0x46b4e0=_0x68b3[_0x47bc17];return _0x46b4e0;};'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')]('JscriptySessionReport,\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')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\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);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ea52118..1063413 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 _0x3b18=['/download_log_file','downloadLogFile','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update'];(function(_0x17e9aa,_0x43c7ce){var _0x57e010=function(_0x1a8937){while(--_0x1a8937){_0x17e9aa['push'](_0x17e9aa['shift']());}};_0x57e010(++_0x43c7ce);}(_0x3b18,0xe4));var _0x83b1=function(_0xe74ea6,_0x461881){_0xe74ea6=_0xe74ea6-0x0;var _0x133ecd=_0x3b18[_0xe74ea6];return _0x133ecd;};'use strict';var multer=require('multer');var util=require(_0x83b1('0x0'));var path=require('path');var timeout=require(_0x83b1('0x1'));var express=require(_0x83b1('0x2'));var router=express[_0x83b1('0x3')]();var fs_extra=require(_0x83b1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x83b1('0x5'));var controller=require(_0x83b1('0x6'));router[_0x83b1('0x7')]('/',controller[_0x83b1('0x8')]);router['put'](_0x83b1('0x9'),auth[_0x83b1('0xa')](),controller[_0x83b1('0xb')]);router[_0x83b1('0x7')](_0x83b1('0xc'),auth['isAuthenticated'](),controller[_0x83b1('0xd')]);module[_0x83b1('0xe')]=router; \ No newline at end of file +var _0x5b45=['/:id','isAuthenticated','/download_log_file','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put'];(function(_0x7c4ef0,_0x2d0611){var _0x5dc24f=function(_0x1c9f73){while(--_0x1c9f73){_0x7c4ef0['push'](_0x7c4ef0['shift']());}};_0x5dc24f(++_0x2d0611);}(_0x5b45,0xc7));var _0x55b4=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0x5b45[_0x11f226];return _0x30be77;};'use strict';var multer=require('multer');var util=require(_0x55b4('0x0'));var path=require(_0x55b4('0x1'));var timeout=require(_0x55b4('0x2'));var express=require('express');var router=express[_0x55b4('0x3')]();var fs_extra=require(_0x55b4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x55b4('0x5'));var config=require(_0x55b4('0x6'));var controller=require(_0x55b4('0x7'));router[_0x55b4('0x8')]('/',controller[_0x55b4('0x9')]);router[_0x55b4('0xa')](_0x55b4('0xb'),auth[_0x55b4('0xc')](),controller['update']);router['get'](_0x55b4('0xd'),auth[_0x55b4('0xc')](),controller['downloadLogFile']);module[_0x55b4('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 57ac3bd..5e96653 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 _0x2470=['TEXT','STRING','INTEGER','sequelize'];(function(_0x2036b0,_0x4da04a){var _0x1a5fae=function(_0x3ea671){while(--_0x3ea671){_0x2036b0['push'](_0x2036b0['shift']());}};_0x1a5fae(++_0x4da04a);}(_0x2470,0x1e3));var _0x0247=function(_0xe161be,_0x5acf0c){_0xe161be=_0xe161be-0x0;var _0x470ecd=_0x2470[_0xe161be];return _0x470ecd;};'use strict';var Sequelize=require(_0x0247('0x0'));module['exports']={'license':{'type':Sequelize[_0x0247('0x1')]},'data1':{'type':Sequelize[_0x0247('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x0247('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3637=['STRING','INTEGER','sequelize'];(function(_0x323db6,_0x5bf580){var _0x292880=function(_0x1e73ce){while(--_0x1e73ce){_0x323db6['push'](_0x323db6['shift']());}};_0x292880(++_0x5bf580);}(_0x3637,0x17c));var _0x7363=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x3637[_0x34eb31];return _0x254994;};'use strict';var Sequelize=require(_0x7363('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7363('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x7363('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 8cf195f..a182316 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 _0x55b5=['error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','catch','body','find','checkLicense','key','demo','license-info.log','/var','log','xcally','Content-disposition','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end'];(function(_0x1b24a3,_0xf93b88){var _0xa81e40=function(_0x4a1c20){while(--_0x4a1c20){_0x1b24a3['push'](_0x1b24a3['shift']());}};_0xa81e40(++_0xf93b88);}(_0x55b5,0x186));var _0x555b=function(_0x295770,_0x50a408){_0x295770=_0x295770-0x0;var _0x4b7f0a=_0x55b5[_0x295770];return _0x4b7f0a;};'use strict';var emlformat=require(_0x555b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x555b('0x1'));var jsonpatch=require(_0x555b('0x2'));var rp=require(_0x555b('0x3'));var moment=require(_0x555b('0x4'));var BPromise=require(_0x555b('0x5'));var Mustache=require(_0x555b('0x6'));var util=require(_0x555b('0x7'));var path=require(_0x555b('0x8'));var sox=require(_0x555b('0x9'));var csv=require(_0x555b('0xa'));var ejs=require(_0x555b('0xb'));var fs=require('fs');var fs_extra=require(_0x555b('0xc'));var _=require(_0x555b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x555b('0xe'));var deskjs=require(_0x555b('0xf'));var toCsv=require(_0x555b('0xa'));var querystring=require(_0x555b('0x10'));var Papa=require(_0x555b('0x11'));var Redis=require(_0x555b('0x12'));var authService=require(_0x555b('0x13'));var qs=require(_0x555b('0x14'));var as=require(_0x555b('0x15'));var hardwareService=require(_0x555b('0x16'));var logger=require(_0x555b('0x17'))(_0x555b('0x18'));var utils=require(_0x555b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x555b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x405868,_0x57b29f){_0x57b29f=_0x57b29f||0xcc;return function(_0x34a6cc){if(_0x34a6cc){return _0x405868[_0x555b('0x1b')](_0x57b29f);}return _0x405868[_0x555b('0x1c')](_0x57b29f)['end']();};}function respondWithResult(_0x1b2dfa,_0x142eda){_0x142eda=_0x142eda||0xc8;return function(_0x3e6a48){if(_0x3e6a48){return _0x1b2dfa[_0x555b('0x1c')](_0x142eda)[_0x555b('0x1d')](_0x3e6a48);}};}function respondWithFilteredResult(_0x4a32,_0x514e74){return function(_0x44d09a){if(_0x44d09a){var _0x7461e0=typeof _0x514e74[_0x555b('0x1e')]===_0x555b('0x1f')&&typeof _0x514e74[_0x555b('0x20')]===_0x555b('0x1f');var _0x2e3727=_0x44d09a[_0x555b('0x21')];var _0x52951d=_0x7461e0?0x0:_0x514e74[_0x555b('0x1e')];var _0x13ba42=_0x7461e0?_0x44d09a[_0x555b('0x21')]:_0x514e74[_0x555b('0x1e')]+_0x514e74[_0x555b('0x20')];var _0xe19706;if(_0x13ba42>=_0x2e3727){_0x13ba42=_0x2e3727;_0xe19706=0xc8;}else{_0xe19706=0xce;}_0x4a32[_0x555b('0x1c')](_0xe19706);return _0x4a32[_0x555b('0x22')](_0x555b('0x23'),_0x52951d+'-'+_0x13ba42+'/'+_0x2e3727)[_0x555b('0x1d')](_0x44d09a);}return null;};}function patchUpdates(_0x541ab6){return function(_0x1bbae8){try{jsonpatch[_0x555b('0x24')](_0x1bbae8,_0x541ab6,!![]);}catch(_0x1fb5df){return BPromise[_0x555b('0x25')](_0x1fb5df);}return _0x1bbae8[_0x555b('0x26')]();};}function saveUpdates(_0x204bc1,_0x39c961){return function(_0x45ba93){if(_0x45ba93){return _0x45ba93[_0x555b('0x27')](_0x204bc1)[_0x555b('0x28')](function(_0x3503d4){return _0x3503d4;});}return null;};}function removeEntity(_0xf036c5,_0x1a4ceb){return function(_0x363502){if(_0x363502){return _0x363502['destroy']()[_0x555b('0x28')](function(){_0xf036c5[_0x555b('0x1c')](0xcc)[_0x555b('0x29')]();});}};}function handleEntityNotFound(_0x3dbb29,_0x970f87){return function(_0x3e5257){if(!_0x3e5257){_0x3dbb29['sendStatus'](0x194);}return _0x3e5257;};}function handleError(_0x405bd5,_0x386b6b){_0x386b6b=_0x386b6b||0x1f4;return function(_0x4b37b7){logger[_0x555b('0x2a')](_0x4b37b7[_0x555b('0x2b')]);if(_0x4b37b7[_0x555b('0x2c')]){delete _0x4b37b7[_0x555b('0x2c')];}_0x405bd5[_0x555b('0x1c')](_0x386b6b)[_0x555b('0x2d')](_0x4b37b7);};}var utilLicense=require(_0x555b('0x1a'));exports[_0x555b('0x2e')]=function(_0x3e6371,_0x1f4116){var _0x262a56={'raw':!![],'where':{'id':0x1}},_0x2a1b9b={};_0x2a1b9b[_0x555b('0x2f')]=_[_0x555b('0x30')](db[_0x555b('0x31')][_0x555b('0x32')]);_0x2a1b9b[_0x555b('0x33')]=_[_0x555b('0x30')](_0x3e6371[_0x555b('0x33')]);_0x2a1b9b[_0x555b('0x34')]=_[_0x555b('0x35')](_0x2a1b9b[_0x555b('0x2f')],_0x2a1b9b[_0x555b('0x33')]);_0x262a56[_0x555b('0x36')]=_['intersection'](_0x2a1b9b['model'],qs['fields'](_0x3e6371['query'][_0x555b('0x37')]));_0x262a56[_0x555b('0x36')]=_0x262a56[_0x555b('0x36')][_0x555b('0x38')]?_0x262a56[_0x555b('0x36')]:_0x2a1b9b[_0x555b('0x2f')];_0x262a56=_['merge']({},_0x262a56,_0x3e6371[_0x555b('0x39')]);return utilLicense['getLicense'](_0x262a56)[_0x555b('0x28')](respondWithResult(_0x1f4116,null))[_0x555b('0x3a')](handleError(_0x1f4116,null));};exports[_0x555b('0x27')]=function(_0x50dc61,_0x4c3d3e){if(_0x50dc61[_0x555b('0x3b')]['id']){delete _0x50dc61[_0x555b('0x3b')]['id'];}return db['License'][_0x555b('0x3c')]({'where':{'id':_0x50dc61['params']['id']}})[_0x555b('0x28')](handleEntityNotFound(_0x4c3d3e,null))[_0x555b('0x28')](function(_0x58fb94){var _0x441927=_0x58fb94['get']({'plain':!![]});return utilLicense[_0x555b('0x3d')](_0x441927,_0x50dc61['body'][_0x555b('0x3e')]);})[_0x555b('0x28')](function(_0x441047){if(!_0x441047[_0x555b('0x3f')]){return saveUpdates(_0x50dc61[_0x555b('0x3b')],null);}return _0x441047;})['then'](respondWithResult(_0x4c3d3e,null))[_0x555b('0x3a')](handleError(_0x4c3d3e,null));};exports['downloadLogFile']=function(_0x575d4e,_0x178ab1){var _0x1505a2=_0x555b('0x40');var _0x167bf8=path['join'](_0x555b('0x41'),_0x555b('0x42'),_0x555b('0x43'),_0x1505a2);_0x178ab1['setHeader'](_0x555b('0x44'),'attachment;\x20filename='+_0x1505a2);_0x178ab1[_0x555b('0x22')](_0x555b('0x45'),_0x555b('0x46'));_0x178ab1[_0x555b('0x47')](_0x167bf8);}; \ No newline at end of file +var _0xdc2a=['rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','update','body','find','get','checkLicense','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','keys','License'];(function(_0x12ac87,_0xd7c597){var _0x2c5e2c=function(_0x54ca16){while(--_0x54ca16){_0x12ac87['push'](_0x12ac87['shift']());}};_0x2c5e2c(++_0xd7c597);}(_0xdc2a,0x1ce));var _0xadc2=function(_0x464350,_0x53c0dc){_0x464350=_0x464350-0x0;var _0x3a7bde=_0xdc2a[_0x464350];return _0x3a7bde;};'use strict';var emlformat=require(_0xadc2('0x0'));var rimraf=require(_0xadc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xadc2('0x2'));var rp=require(_0xadc2('0x3'));var moment=require('moment');var BPromise=require(_0xadc2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xadc2('0x5'));var sox=require(_0xadc2('0x6'));var csv=require(_0xadc2('0x7'));var ejs=require(_0xadc2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xadc2('0x9'));var deskjs=require(_0xadc2('0xa'));var toCsv=require(_0xadc2('0x7'));var querystring=require(_0xadc2('0xb'));var Papa=require(_0xadc2('0xc'));var Redis=require('ioredis');var authService=require(_0xadc2('0xd'));var qs=require(_0xadc2('0xe'));var as=require(_0xadc2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadc2('0x10'))(_0xadc2('0x11'));var utils=require(_0xadc2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xadc2('0x13'));var db=require(_0xadc2('0x14'))['db'];function respondWithStatusCode(_0x12a062,_0xec34b){_0xec34b=_0xec34b||0xcc;return function(_0x1a63fb){if(_0x1a63fb){return _0x12a062[_0xadc2('0x15')](_0xec34b);}return _0x12a062[_0xadc2('0x16')](_0xec34b)[_0xadc2('0x17')]();};}function respondWithResult(_0x1a0710,_0x1cfe6d){_0x1cfe6d=_0x1cfe6d||0xc8;return function(_0x3ef6f3){if(_0x3ef6f3){return _0x1a0710[_0xadc2('0x16')](_0x1cfe6d)[_0xadc2('0x18')](_0x3ef6f3);}};}function respondWithFilteredResult(_0x74dcf4,_0x562688){return function(_0x27aa80){if(_0x27aa80){var _0xe7927a=typeof _0x562688[_0xadc2('0x19')]===_0xadc2('0x1a')&&typeof _0x562688['limit']===_0xadc2('0x1a');var _0x22437f=_0x27aa80[_0xadc2('0x1b')];var _0x18da64=_0xe7927a?0x0:_0x562688[_0xadc2('0x19')];var _0x5dd70f=_0xe7927a?_0x27aa80[_0xadc2('0x1b')]:_0x562688[_0xadc2('0x19')]+_0x562688[_0xadc2('0x1c')];var _0x1331af;if(_0x5dd70f>=_0x22437f){_0x5dd70f=_0x22437f;_0x1331af=0xc8;}else{_0x1331af=0xce;}_0x74dcf4[_0xadc2('0x16')](_0x1331af);return _0x74dcf4[_0xadc2('0x1d')](_0xadc2('0x1e'),_0x18da64+'-'+_0x5dd70f+'/'+_0x22437f)[_0xadc2('0x18')](_0x27aa80);}return null;};}function patchUpdates(_0x4ff30a){return function(_0x28d65d){try{jsonpatch[_0xadc2('0x1f')](_0x28d65d,_0x4ff30a,!![]);}catch(_0xea57fa){return BPromise[_0xadc2('0x20')](_0xea57fa);}return _0x28d65d[_0xadc2('0x21')]();};}function saveUpdates(_0x37cd76,_0x437907){return function(_0x3b1781){if(_0x3b1781){return _0x3b1781['update'](_0x37cd76)[_0xadc2('0x22')](function(_0x363672){return _0x363672;});}return null;};}function removeEntity(_0x331fa0,_0x18bb49){return function(_0x415fc7){if(_0x415fc7){return _0x415fc7['destroy']()[_0xadc2('0x22')](function(){_0x331fa0[_0xadc2('0x16')](0xcc)[_0xadc2('0x17')]();});}};}function handleEntityNotFound(_0x51abd4,_0x46f74f){return function(_0x32356b){if(!_0x32356b){_0x51abd4['sendStatus'](0x194);}return _0x32356b;};}function handleError(_0x1c7350,_0x1d7ae3){_0x1d7ae3=_0x1d7ae3||0x1f4;return function(_0x18801d){logger[_0xadc2('0x23')](_0x18801d[_0xadc2('0x24')]);if(_0x18801d[_0xadc2('0x25')]){delete _0x18801d[_0xadc2('0x25')];}_0x1c7350[_0xadc2('0x16')](_0x1d7ae3)[_0xadc2('0x26')](_0x18801d);};}var utilLicense=require(_0xadc2('0x13'));exports[_0xadc2('0x27')]=function(_0x44ceb3,_0x17ab13){var _0x8bdf3f={'raw':!![],'where':{'id':0x1}},_0x4de15b={};_0x4de15b['model']=_[_0xadc2('0x28')](db[_0xadc2('0x29')][_0xadc2('0x2a')]);_0x4de15b['query']=_['keys'](_0x44ceb3[_0xadc2('0x2b')]);_0x4de15b[_0xadc2('0x2c')]=_[_0xadc2('0x2d')](_0x4de15b[_0xadc2('0x2e')],_0x4de15b[_0xadc2('0x2b')]);_0x8bdf3f[_0xadc2('0x2f')]=_[_0xadc2('0x2d')](_0x4de15b[_0xadc2('0x2e')],qs[_0xadc2('0x30')](_0x44ceb3[_0xadc2('0x2b')][_0xadc2('0x30')]));_0x8bdf3f[_0xadc2('0x2f')]=_0x8bdf3f[_0xadc2('0x2f')][_0xadc2('0x31')]?_0x8bdf3f[_0xadc2('0x2f')]:_0x4de15b[_0xadc2('0x2e')];_0x8bdf3f=_[_0xadc2('0x32')]({},_0x8bdf3f,_0x44ceb3[_0xadc2('0x33')]);return utilLicense[_0xadc2('0x34')](_0x8bdf3f)[_0xadc2('0x22')](respondWithResult(_0x17ab13,null))[_0xadc2('0x35')](handleError(_0x17ab13,null));};exports[_0xadc2('0x36')]=function(_0x4a3d14,_0x5c86a8){if(_0x4a3d14[_0xadc2('0x37')]['id']){delete _0x4a3d14[_0xadc2('0x37')]['id'];}return db[_0xadc2('0x29')][_0xadc2('0x38')]({'where':{'id':_0x4a3d14['params']['id']}})[_0xadc2('0x22')](handleEntityNotFound(_0x5c86a8,null))['then'](function(_0x5e9a49){var _0x1a68d6=_0x5e9a49[_0xadc2('0x39')]({'plain':!![]});return utilLicense[_0xadc2('0x3a')](_0x1a68d6,_0x4a3d14['body'][_0xadc2('0x3b')]);})['then'](function(_0x53c85d){if(!_0x53c85d[_0xadc2('0x3c')]){return saveUpdates(_0x4a3d14[_0xadc2('0x37')],null);}return _0x53c85d;})[_0xadc2('0x22')](respondWithResult(_0x5c86a8,null))[_0xadc2('0x35')](handleError(_0x5c86a8,null));};exports['downloadLogFile']=function(_0x2f9a15,_0x233ee4){var _0x401751=_0xadc2('0x3d');var _0x475b10=path[_0xadc2('0x3e')](_0xadc2('0x3f'),_0xadc2('0x40'),_0xadc2('0x41'),_0x401751);_0x233ee4[_0xadc2('0x42')](_0xadc2('0x43'),_0xadc2('0x44')+_0x401751);_0x233ee4[_0xadc2('0x1d')](_0xadc2('0x45'),_0xadc2('0x46'));_0x233ee4[_0xadc2('0x47')](_0x475b10);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 67496cd..eb31260 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 _0x8ec0=['request-promise','path','rimraf','./license.attributes','exports','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc7ea29,_0xf9ec02){var _0xe4771b=function(_0x1a72b2){while(--_0x1a72b2){_0xc7ea29['push'](_0xc7ea29['shift']());}};_0xe4771b(++_0xf9ec02);}(_0x8ec0,0x19e));var _0x08ec=function(_0x283ca5,_0x49fae5){_0x283ca5=_0x283ca5-0x0;var _0x368f5b=_0x8ec0[_0x283ca5];return _0x368f5b;};'use strict';var _=require(_0x08ec('0x0'));var util=require(_0x08ec('0x1'));var logger=require(_0x08ec('0x2'))(_0x08ec('0x3'));var moment=require(_0x08ec('0x4'));var BPromise=require(_0x08ec('0x5'));var rp=require(_0x08ec('0x6'));var fs=require('fs');var path=require(_0x08ec('0x7'));var rimraf=require(_0x08ec('0x8'));var config=require('../../config/environment');var attributes=require(_0x08ec('0x9'));module[_0x08ec('0xa')]=function(_0x1a6619,_0x158f96){return _0x1a6619['define']('License',attributes,{'tableName':_0x08ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb298=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','License','license','lodash'];(function(_0x3d3aab,_0x4c06c8){var _0x5c8679=function(_0x941b06){while(--_0x941b06){_0x3d3aab['push'](_0x3d3aab['shift']());}};_0x5c8679(++_0x4c06c8);}(_0xb298,0xd7));var _0x8b29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb298[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b29('0x0'));var util=require('util');var logger=require(_0x8b29('0x1'))(_0x8b29('0x2'));var moment=require(_0x8b29('0x3'));var BPromise=require(_0x8b29('0x4'));var rp=require(_0x8b29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b29('0x6'));var config=require(_0x8b29('0x7'));var attributes=require(_0x8b29('0x8'));module[_0x8b29('0x9')]=function(_0xfc381c,_0x125d67){return _0xfc381c['define'](_0x8b29('0xa'),attributes,{'tableName':_0x8b29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 92b64b6..b37cc9e 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 _0x88a3=['result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x11878f,_0x36c76b){var _0x5cac43=function(_0x5131bb){while(--_0x5131bb){_0x11878f['push'](_0x11878f['shift']());}};_0x5cac43(++_0x36c76b);}(_0x88a3,0x1a5));var _0x388a=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x88a3[_0x189305];return _0xea3406;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x388a('0x0'));var BPromise=require('bluebird');var rs=require(_0x388a('0x1'));var fs=require('fs');var Redis=require(_0x388a('0x2'));var db=require(_0x388a('0x3'))['db'];var utils=require(_0x388a('0x4'));var logger=require(_0x388a('0x5'))(_0x388a('0x6'));var config=require(_0x388a('0x7'));var jayson=require(_0x388a('0x8'));var client=jayson[_0x388a('0x9')][_0x388a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28491a,_0x4ed2a2,_0x13afd5){return new BPromise(function(_0x318881,_0x4eb9fd){return client[_0x388a('0xb')](_0x28491a,_0x13afd5)[_0x388a('0xc')](function(_0x331825){logger['info'](_0x388a('0xd'),_0x4ed2a2,'request\x20sent');logger['debug'](_0x388a('0xe'),_0x4ed2a2,'request\x20sent',JSON['stringify'](_0x331825));if(_0x331825[_0x388a('0xf')]){if(_0x331825['error'][_0x388a('0x10')]===0x1f4){logger[_0x388a('0xf')]('License,\x20%s,\x20%s',_0x4ed2a2,_0x331825[_0x388a('0xf')]['message']);return _0x4eb9fd(_0x331825[_0x388a('0xf')][_0x388a('0x11')]);}logger[_0x388a('0xf')](_0x388a('0xd'),_0x4ed2a2,_0x331825['error']['message']);return _0x318881(_0x331825[_0x388a('0xf')]['message']);}else{logger[_0x388a('0x12')](_0x388a('0xd'),_0x4ed2a2,'request\x20sent');_0x318881(_0x331825[_0x388a('0x13')][_0x388a('0x11')]);}})['catch'](function(_0x43d7d1){logger[_0x388a('0xf')](_0x388a('0xd'),_0x4ed2a2,_0x43d7d1);_0x4eb9fd(_0x43d7d1);});});} \ No newline at end of file +var _0x1162=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x1162,0x13d));var _0x2116=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1162[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x2116('0x0'));var util=require(_0x2116('0x1'));var moment=require(_0x2116('0x2'));var BPromise=require(_0x2116('0x3'));var rs=require(_0x2116('0x4'));var fs=require('fs');var Redis=require(_0x2116('0x5'));var db=require(_0x2116('0x6'))['db'];var utils=require(_0x2116('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2116('0x8'));var jayson=require(_0x2116('0x9'));var client=jayson[_0x2116('0xa')][_0x2116('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3451ad,_0x4d302c,_0x5c7e00){return new BPromise(function(_0x151e22,_0x2c164a){return client[_0x2116('0xc')](_0x3451ad,_0x5c7e00)['then'](function(_0x2b68a9){logger[_0x2116('0xd')](_0x2116('0xe'),_0x4d302c,_0x2116('0xf'));logger[_0x2116('0x10')](_0x2116('0x11'),_0x4d302c,_0x2116('0xf'),JSON['stringify'](_0x2b68a9));if(_0x2b68a9[_0x2116('0x12')]){if(_0x2b68a9[_0x2116('0x12')][_0x2116('0x13')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x4d302c,_0x2b68a9[_0x2116('0x12')][_0x2116('0x14')]);return _0x2c164a(_0x2b68a9['error'][_0x2116('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x4d302c,_0x2b68a9[_0x2116('0x12')][_0x2116('0x14')]);return _0x151e22(_0x2b68a9[_0x2116('0x12')][_0x2116('0x14')]);}else{logger[_0x2116('0xd')](_0x2116('0xe'),_0x4d302c,_0x2116('0xf'));_0x151e22(_0x2b68a9[_0x2116('0x15')]['message']);}})[_0x2116('0x16')](function(_0x40db24){logger[_0x2116('0x12')](_0x2116('0xe'),_0x4d302c,_0x40db24);_0x2c164a(_0x40db24);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index eccf09e..0adfb00 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 _0x5356=['Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','update','removeDispositions','delete','removeAnswers','/:id/in_servers','removeImap','removeSmtp','removeAgents','exports','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5356,0x181));var _0x6535=function(_0x1724d7,_0x45fca2){_0x1724d7=_0x1724d7-0x0;var _0x190ed4=_0x5356[_0x1724d7];return _0x190ed4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6535('0x0'));var timeout=require(_0x6535('0x1'));var express=require('express');var router=express[_0x6535('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6535('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6535('0x4'));var controller=require(_0x6535('0x5'));router[_0x6535('0x6')]('/',auth[_0x6535('0x7')](),controller[_0x6535('0x8')]);router[_0x6535('0x6')](_0x6535('0x9'),auth[_0x6535('0x7')](),controller[_0x6535('0xa')]);router[_0x6535('0x6')](_0x6535('0xb'),auth[_0x6535('0x7')](),controller['show']);router[_0x6535('0x6')](_0x6535('0xc'),auth[_0x6535('0x7')](),controller[_0x6535('0xd')]);router[_0x6535('0x6')](_0x6535('0xe'),auth[_0x6535('0x7')](),controller[_0x6535('0xf')]);router['get']('/:id/in_servers',auth[_0x6535('0x7')](),controller[_0x6535('0x10')]);router[_0x6535('0x6')](_0x6535('0x11'),auth[_0x6535('0x7')](),controller[_0x6535('0x12')]);router['get'](_0x6535('0x13'),auth[_0x6535('0x7')](),controller[_0x6535('0x14')]);router[_0x6535('0x6')](_0x6535('0x15'),auth['isAuthenticated'](),controller[_0x6535('0x16')]);router['get'](_0x6535('0x17'),auth['isAuthenticated'](),controller[_0x6535('0x18')]);router[_0x6535('0x6')]('/:id/verify',auth[_0x6535('0x7')](),controller['verifySmtp']);router[_0x6535('0x6')](_0x6535('0x19'),auth[_0x6535('0x7')](),controller[_0x6535('0x1a')]);router[_0x6535('0x1b')](_0x6535('0xc'),auth[_0x6535('0x7')](),controller['addDisposition']);router[_0x6535('0x1b')]('/:id/canned_answers',auth[_0x6535('0x7')](),controller['addAnswer']);router['post']('/',auth[_0x6535('0x7')](),controller['create']);router[_0x6535('0x1b')]('/:id/in_servers',auth[_0x6535('0x7')](),controller[_0x6535('0x1c')]);router[_0x6535('0x1b')](_0x6535('0x11'),auth['isAuthenticated'](),controller[_0x6535('0x1d')]);router[_0x6535('0x1b')](_0x6535('0x13'),auth[_0x6535('0x7')](),controller[_0x6535('0x1e')]);router[_0x6535('0x1b')](_0x6535('0x15'),auth[_0x6535('0x7')](),controller[_0x6535('0x1f')]);router[_0x6535('0x1b')](_0x6535('0x20'),auth[_0x6535('0x7')](),controller['send']);router['post'](_0x6535('0x19'),auth[_0x6535('0x7')](),controller[_0x6535('0x21')]);router['put'](_0x6535('0xb'),auth[_0x6535('0x7')](),controller[_0x6535('0x22')]);router['delete'](_0x6535('0xc'),auth['isAuthenticated'](),controller[_0x6535('0x23')]);router[_0x6535('0x24')](_0x6535('0xe'),auth[_0x6535('0x7')](),controller[_0x6535('0x25')]);router[_0x6535('0x24')](_0x6535('0x26'),auth[_0x6535('0x7')](),controller[_0x6535('0x27')]);router['delete']('/:id/out_servers',auth[_0x6535('0x7')](),controller[_0x6535('0x28')]);router[_0x6535('0x24')]('/:id',auth[_0x6535('0x7')](),controller['destroy']);router[_0x6535('0x24')](_0x6535('0x19'),auth['isAuthenticated'](),controller[_0x6535('0x29')]);module[_0x6535('0x2a')]=router; \ No newline at end of file +var _0x6f3b=['post','create','/:id/in_servers','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','/:id','delete','removeDispositions','destroy','removeAgents','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0x6f3b,0x67));var _0xb6f3=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x6f3b[_0x2d4661];return _0x42ed1e;};'use strict';var multer=require('multer');var util=require(_0xb6f3('0x0'));var path=require('path');var timeout=require(_0xb6f3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb6f3('0x2'));var auth=require(_0xb6f3('0x3'));var interaction=require(_0xb6f3('0x4'));var config=require(_0xb6f3('0x5'));var controller=require('./mailAccount.controller');router[_0xb6f3('0x6')]('/',auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x8')]);router['get'](_0xb6f3('0x9'),auth[_0xb6f3('0x7')](),controller['describe']);router[_0xb6f3('0x6')]('/:id',auth[_0xb6f3('0x7')](),controller[_0xb6f3('0xa')]);router[_0xb6f3('0x6')](_0xb6f3('0xb'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0xc')]);router[_0xb6f3('0x6')](_0xb6f3('0xd'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0xe')]);router[_0xb6f3('0x6')]('/:id/in_servers',auth[_0xb6f3('0x7')](),controller['getImap']);router[_0xb6f3('0x6')]('/:id/out_servers',auth[_0xb6f3('0x7')](),controller[_0xb6f3('0xf')]);router['get'](_0xb6f3('0x10'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x11')]);router[_0xb6f3('0x6')](_0xb6f3('0x12'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x13')]);router[_0xb6f3('0x6')](_0xb6f3('0x14'),auth['isAuthenticated'](),controller[_0xb6f3('0x15')]);router[_0xb6f3('0x6')]('/:id/verify',auth[_0xb6f3('0x7')](),controller['verifySmtp']);router[_0xb6f3('0x6')]('/:id/users',auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x16')]);router['post'](_0xb6f3('0xb'),auth[_0xb6f3('0x7')](),controller['addDisposition']);router[_0xb6f3('0x17')](_0xb6f3('0xd'),auth[_0xb6f3('0x7')](),controller['addAnswer']);router[_0xb6f3('0x17')]('/',auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x18')]);router[_0xb6f3('0x17')](_0xb6f3('0x19'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x1a')]);router[_0xb6f3('0x17')](_0xb6f3('0x1b'),auth['isAuthenticated'](),controller[_0xb6f3('0x1c')]);router['post'](_0xb6f3('0x10'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x1d')]);router[_0xb6f3('0x17')](_0xb6f3('0x12'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x1e')]);router['post'](_0xb6f3('0x1f'),auth['isAuthenticated'](),controller[_0xb6f3('0x20')]);router[_0xb6f3('0x17')](_0xb6f3('0x21'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x22')]);router[_0xb6f3('0x23')](_0xb6f3('0x24'),auth[_0xb6f3('0x7')](),controller['update']);router[_0xb6f3('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb6f3('0x26')]);router[_0xb6f3('0x25')](_0xb6f3('0xd'),auth[_0xb6f3('0x7')](),controller['removeAnswers']);router[_0xb6f3('0x25')](_0xb6f3('0x19'),auth[_0xb6f3('0x7')](),controller['removeImap']);router[_0xb6f3('0x25')]('/:id/out_servers',auth[_0xb6f3('0x7')](),controller['removeSmtp']);router[_0xb6f3('0x25')](_0xb6f3('0x24'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x27')]);router[_0xb6f3('0x25')](_0xb6f3('0x21'),auth[_0xb6f3('0x7')](),controller[_0xb6f3('0x28')]);module[_0xb6f3('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 989876e..dc1838c 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 _0xc144=['exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0x88fa63,_0x441eed){var _0x2d8616=function(_0x44f561){while(--_0x44f561){_0x88fa63['push'](_0x88fa63['shift']());}};_0x2d8616(++_0x441eed);}(_0xc144,0x1a3));var _0x4c14=function(_0x11f1ff,_0x3ae51b){_0x11f1ff=_0x11f1ff-0x0;var _0x1a1eed=_0xc144[_0x11f1ff];return _0x1a1eed;};'use strict';var Sequelize=require(_0x4c14('0x0'));module[_0x4c14('0x1')]={'description':{'type':Sequelize[_0x4c14('0x2')]},'name':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![],'defaultValue':_0x4c14('0x4')},'fontSize':{'type':Sequelize[_0x4c14('0x5')](0x2)[_0x4c14('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4c14('0x7')],'defaultValue':function(){return _0x4c14('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c14('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4c14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c14('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4c14('0x9'),'set':function(_0x5e4507){if(!_0x5e4507)this[_0x4c14('0xa')](_0x4c14('0xb'),null);this[_0x4c14('0xa')]('mandatoryDisposition',_0x5e4507);}},'provider':{'type':Sequelize[_0x4c14('0xc')](_0x4c14('0xd'),_0x4c14('0xe'),_0x4c14('0xf'),_0x4c14('0x10')),'defaultValue':null,'get':function(){if(!this[_0x4c14('0x11')](_0x4c14('0x12')))return _0x4c14('0x13');return this[_0x4c14('0x11')](_0x4c14('0x12'));},'set':function(_0x58c51d){if(_0x58c51d===_0x4c14('0x13'))_0x58c51d=null;return this[_0x4c14('0xa')](_0x4c14('0x12'),_0x58c51d);}}}; \ No newline at end of file +var _0x4829=['gmail','hotmail','outlook365','provider','getDataValue','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x2059a5,_0x52f75e){var _0x121e5a=function(_0xb02439){while(--_0xb02439){_0x2059a5['push'](_0x2059a5['shift']());}};_0x121e5a(++_0x52f75e);}(_0x4829,0x1e9));var _0x9482=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x4829[_0x1afabf];return _0x497ff1;};'use strict';var Sequelize=require(_0x9482('0x0'));module[_0x9482('0x1')]={'description':{'type':Sequelize[_0x9482('0x2')]},'name':{'type':Sequelize[_0x9482('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9482('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9482('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9482('0x4')]},'markAsUnread':{'type':Sequelize[_0x9482('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9482('0x5')},'fontSize':{'type':Sequelize[_0x9482('0x6')](0x2)[_0x9482('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9482('0x4')],'defaultValue':function(){return _0x9482('0x8');}},'notificationSound':{'type':Sequelize[_0x9482('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9482('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9482('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9482('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9482('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9482('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9482('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x9482('0x3')],'defaultValue':![],'comment':_0x9482('0xa'),'set':function(_0x4ab914){if(!_0x4ab914)this[_0x9482('0xb')](_0x9482('0xc'),null);this['setDataValue'](_0x9482('0xd'),_0x4ab914);}},'provider':{'type':Sequelize[_0x9482('0xe')](_0x9482('0xf'),_0x9482('0x10'),'yahoo',_0x9482('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x9482('0x12')))return'custom';return this[_0x9482('0x13')](_0x9482('0x12'));},'set':function(_0x4e87d3){if(_0x4e87d3===_0x9482('0x14'))_0x4e87d3=null;return this[_0x9482('0xb')](_0x9482('0x12'),_0x4e87d3);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 96b983d..1bf9c02 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 _0xd571=['Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','CmContact','Contacts','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','path','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','user','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','merge','where','includeAll','include','findAll','show','params','length','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','custom','ListId','active','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','removeImap','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User'];(function(_0xeff563,_0x5eae5b){var _0x1d25e2=function(_0x2de1c8){while(--_0x2de1c8){_0xeff563['push'](_0xeff563['shift']());}};_0x1d25e2(++_0x5eae5b);}(_0xd571,0x1cb));var _0x1d57=function(_0x2ba5dd,_0x381f44){_0x2ba5dd=_0x2ba5dd-0x0;var _0x2605f6=_0xd571[_0x2ba5dd];return _0x2605f6;};'use strict';var moment=require('moment');var BPromise=require(_0x1d57('0x0'));var util=require(_0x1d57('0x1'));var path=require(_0x1d57('0x2'));var _=require('lodash');var juice=require(_0x1d57('0x3'));var Redis=require(_0x1d57('0x4'));var qs=require(_0x1d57('0x5'));var logger=require('../../config/logger')(_0x1d57('0x6'));var config=require(_0x1d57('0x7'));var db=require(_0x1d57('0x8'))['db'];config[_0x1d57('0x9')]=_[_0x1d57('0xa')](config[_0x1d57('0x9')],{'host':_0x1d57('0xb'),'port':0x18eb});var socket=require(_0x1d57('0xc'))(new Redis(config['redis']));require(_0x1d57('0xd'))[_0x1d57('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1d57('0xf')][_0x1d57('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x26c307,_0x58ddf4,_0x2e0e0a,_0x166a7c){return new BPromise(function(_0x18a97e,_0x5c00ed){var _0x3bb25a=_0x166a7c||client;return _0x3bb25a[_0x1d57('0x11')](_0x26c307,_0x2e0e0a)[_0x1d57('0x12')](function(_0x3fe2aa){logger[_0x1d57('0x13')](_0x1d57('0x14'),_0x58ddf4,_0x1d57('0x15'));logger['debug'](_0x1d57('0x16'),_0x58ddf4,_0x1d57('0x15'),JSON[_0x1d57('0x17')](_0x3fe2aa));if(_0x3fe2aa['error']){if(_0x3fe2aa[_0x1d57('0x18')]['code']===0x1f4){logger[_0x1d57('0x18')](_0x1d57('0x14'),_0x58ddf4,_0x3fe2aa[_0x1d57('0x18')]['message']);return _0x5c00ed(_0x3fe2aa[_0x1d57('0x18')][_0x1d57('0x19')]);}logger[_0x1d57('0x18')]('MailAccount,\x20%s,\x20%s',_0x58ddf4,_0x3fe2aa[_0x1d57('0x18')][_0x1d57('0x19')]);return _0x18a97e(_0x3fe2aa[_0x1d57('0x18')]['message']);}else{logger['info'](_0x1d57('0x14'),_0x58ddf4,_0x1d57('0x15'));_0x18a97e(_0x3fe2aa[_0x1d57('0x1a')]['message']);}})[_0x1d57('0x1b')](function(_0x575422){logger[_0x1d57('0x18')](_0x1d57('0x14'),_0x58ddf4,_0x575422);_0x5c00ed(_0x575422);});});}function respondWithStatusCode(_0x377e51,_0x4c2a9b){_0x4c2a9b=_0x4c2a9b||0xcc;return function(_0x43e8b5){if(_0x43e8b5){return _0x377e51[_0x1d57('0x1c')](_0x4c2a9b);}return _0x377e51[_0x1d57('0x1d')](_0x4c2a9b)[_0x1d57('0x1e')]();};}function respondWithResult(_0x12f12b,_0x15ebb9){_0x15ebb9=_0x15ebb9||0xc8;return function(_0x3be3df){if(_0x3be3df){return _0x12f12b[_0x1d57('0x1d')](_0x15ebb9)[_0x1d57('0x1f')](_0x3be3df);}};}function respondWithFilteredResult(_0x3213cb,_0x5bc5ea){return function(_0x561a64){if(_0x561a64){var _0x4f719a=typeof _0x5bc5ea[_0x1d57('0x20')]===_0x1d57('0x21')&&typeof _0x5bc5ea[_0x1d57('0x22')]==='undefined';var _0x435308=_0x561a64[_0x1d57('0x23')];var _0x531db6=_0x4f719a?0x0:_0x5bc5ea[_0x1d57('0x20')];var _0x2721c5=_0x4f719a?_0x561a64[_0x1d57('0x23')]:_0x5bc5ea[_0x1d57('0x20')]+_0x5bc5ea['limit'];var _0x470e2e;if(_0x2721c5>=_0x435308){_0x2721c5=_0x435308;_0x470e2e=0xc8;}else{_0x470e2e=0xce;}_0x3213cb['status'](_0x470e2e);return _0x3213cb[_0x1d57('0x24')](_0x1d57('0x25'),_0x531db6+'-'+_0x2721c5+'/'+_0x435308)[_0x1d57('0x1f')](_0x561a64);}return null;};}function saveUpdates(_0x22349a){return function(_0x174da7){if(_0x174da7){return _0x174da7[_0x1d57('0x26')](_0x22349a)[_0x1d57('0x12')](function(_0x1a312c){return _0x1a312c;});}return null;};}function removeEntity(_0x144ebd){return function(_0x426ebb){if(_0x426ebb){return _0x426ebb[_0x1d57('0x27')]()[_0x1d57('0x12')](function(){var _0x3dd791=_0x426ebb[_0x1d57('0x28')]({'plain':!![]});var _0x5e552b=_0x1d57('0x29');return db[_0x1d57('0x2a')][_0x1d57('0x27')]({'where':{'type':_0x5e552b,'resourceId':_0x3dd791['id']}})['then'](function(){return _0x426ebb;});})[_0x1d57('0x12')](function(){_0x144ebd[_0x1d57('0x1d')](0xcc)[_0x1d57('0x1e')]();});}};}function handleEntityNotFound(_0x59e6ab){return function(_0x1263c7){if(!_0x1263c7){_0x59e6ab[_0x1d57('0x1c')](0x194);}return _0x1263c7;};}function handleError(_0x170b5a,_0x39cc58){_0x39cc58=_0x39cc58||0x1f4;return function(_0x5b1e40){logger['error'](_0x5b1e40[_0x1d57('0x2b')]);if(_0x5b1e40[_0x1d57('0x2c')]){delete _0x5b1e40['name'];}_0x170b5a[_0x1d57('0x1d')](_0x39cc58)[_0x1d57('0x2d')](_0x5b1e40);};}function getImapHost(_0x3c0033){switch(_0x3c0033){case _0x1d57('0x2e'):return _0x1d57('0x2f');case _0x1d57('0x30'):return _0x1d57('0x31');case _0x1d57('0x32'):return'imap-mail.outlook.com';case _0x1d57('0x33'):return'outlook.office365.com';}throw new Error(_0x1d57('0x34'),_0x3c0033);}function getSmtpHost(_0x264be3){switch(_0x264be3){case _0x1d57('0x2e'):return _0x1d57('0x35');case _0x1d57('0x30'):return _0x1d57('0x36');case _0x1d57('0x32'):return _0x1d57('0x37');case _0x1d57('0x33'):return _0x1d57('0x38');}throw new Error('Unknown\x20email\x20service\x20provider',_0x264be3);}function getAuthenticationOptions(_0x1f0502,_0x5681a9){var _0x22a4a3={};var _0x17c486={};if(_0x1f0502){_0x22a4a3['user']=_0x17c486['user']=_0x5681a9[_0x1d57('0x39')];_0x22a4a3[_0x1d57('0x3a')]=_0x17c486[_0x1d57('0x3b')]=_0x5681a9[_0x1d57('0x3a')];if(_0x5681a9[_0x1d57('0x3c')]){_0x22a4a3[_0x1d57('0x3c')]=_0x17c486['modernAuthentication']=!![];_0x22a4a3['CloudProviderId']=_0x17c486[_0x1d57('0x3d')]=_0x5681a9[_0x1d57('0x3d')];_0x22a4a3[_0x1d57('0x3a')]=_0x17c486[_0x1d57('0x3b')]=null;}else{_0x22a4a3['CloudProviderId']=_0x17c486[_0x1d57('0x3d')]=null;}_0x22a4a3[_0x1d57('0x3e')]=getImapHost(_0x1f0502);_0x22a4a3[_0x1d57('0x3f')]=0x3e1;_0x17c486[_0x1d57('0x3e')]=getSmtpHost(_0x1f0502);_0x17c486[_0x1d57('0x3f')]=0x24b;_0x17c486[_0x1d57('0x40')]=![];_0x22a4a3[_0x1d57('0x41')]=_0x17c486[_0x1d57('0x41')]=null;}else{if(_0x5681a9[_0x1d57('0x42')]){_0x22a4a3['user']=_0x17c486['user']=_0x5681a9[_0x1d57('0x39')];_0x22a4a3['password']=_0x17c486['pass']=_0x5681a9['password'];}else{_0x22a4a3[_0x1d57('0x42')]=_0x17c486[_0x1d57('0x42')]=![];_0x22a4a3[_0x1d57('0x43')]=_0x17c486['user']=null;_0x22a4a3['password']=_0x17c486['pass']=null;}_0x22a4a3[_0x1d57('0x3e')]=_0x5681a9['Imap']['host'];_0x22a4a3[_0x1d57('0x3f')]=_0x5681a9[_0x1d57('0x44')][_0x1d57('0x3f')];_0x17c486['host']=_0x5681a9[_0x1d57('0x45')]['host'];_0x17c486[_0x1d57('0x3f')]=_0x5681a9[_0x1d57('0x45')][_0x1d57('0x3f')];}return{'Imap':_0x22a4a3,'Smtp':_0x17c486};}exports[_0x1d57('0x46')]=function(_0x691c4e,_0x281d15){var _0x5bb7cb={'include':[{'model':db[_0x1d57('0x47')],'as':_0x1d57('0x44')},{'model':db[_0x1d57('0x48')],'as':_0x1d57('0x45')},{'model':db[_0x1d57('0x49')],'as':_0x1d57('0x4a')}]},_0x2bb55c={},_0x24eb8b={'count':0x0,'rows':[]};var _0x58bc59=_[_0x1d57('0x4b')](db[_0x1d57('0x4c')][_0x1d57('0x4d')],function(_0x21421c){return{'name':_0x21421c[_0x1d57('0x4e')],'type':_0x21421c['type'][_0x1d57('0x4f')]};});_0x2bb55c['model']=_['map'](_0x58bc59,_0x1d57('0x2c'));_0x2bb55c[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x691c4e[_0x1d57('0x50')]);_0x2bb55c[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x2bb55c[_0x1d57('0x54')],_0x2bb55c[_0x1d57('0x50')]);_0x5bb7cb[_0x1d57('0x55')]=_[_0x1d57('0x53')](_0x2bb55c[_0x1d57('0x54')],qs['fields'](_0x691c4e[_0x1d57('0x50')][_0x1d57('0x56')]));_0x5bb7cb[_0x1d57('0x55')]=_0x5bb7cb[_0x1d57('0x55')]['length']?_0x5bb7cb[_0x1d57('0x55')]:_0x2bb55c[_0x1d57('0x54')];if(!_0x691c4e[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x5bb7cb['limit']=qs['limit'](_0x691c4e[_0x1d57('0x50')]['limit']);_0x5bb7cb[_0x1d57('0x20')]=qs['offset'](_0x691c4e[_0x1d57('0x50')][_0x1d57('0x20')]);}_0x5bb7cb[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x691c4e[_0x1d57('0x50')]['sort']);_0x5bb7cb['where']=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x691c4e[_0x1d57('0x50')],_0x2bb55c['filters']),_0x58bc59);if(_0x691c4e[_0x1d57('0x50')]['filter']){_0x5bb7cb['where']=_['merge'](_0x5bb7cb['where'],{'$or':_['map'](_0x58bc59,function(_0x21915a){if(_0x21915a['type']!==_0x1d57('0x5c')){var _0x496cde={};_0x496cde[_0x21915a['name']]={'$like':'%'+_0x691c4e[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x496cde;}})});}_0x5bb7cb=_[_0x1d57('0x5e')]({},_0x5bb7cb,_0x691c4e['options']);var _0x1f62af={'where':_0x5bb7cb[_0x1d57('0x5f')]};return db[_0x1d57('0x4c')][_0x1d57('0x23')](_0x1f62af)['then'](function(_0x8b1405){_0x24eb8b[_0x1d57('0x23')]=_0x8b1405;if(_0x691c4e[_0x1d57('0x50')][_0x1d57('0x60')]){_0x5bb7cb[_0x1d57('0x61')]=[{'all':!![]}];}return db['MailAccount'][_0x1d57('0x62')](_0x5bb7cb);})[_0x1d57('0x12')](function(_0x53219f){_0x24eb8b['rows']=_0x53219f;return _0x24eb8b;})[_0x1d57('0x12')](respondWithFilteredResult(_0x281d15,_0x5bb7cb))['catch'](handleError(_0x281d15,null));};exports[_0x1d57('0x63')]=function(_0x23eed8,_0x1fd4f9){var _0x50a737={'raw':![],'where':{'id':_0x23eed8[_0x1d57('0x64')]['id']},'include':[{'model':db[_0x1d57('0x47')],'as':_0x1d57('0x44')},{'model':db['MailServerOut'],'as':_0x1d57('0x45')},{'model':db[_0x1d57('0x49')],'as':_0x1d57('0x4a')}]},_0x555596={};_0x555596['model']=_[_0x1d57('0x51')](db[_0x1d57('0x4c')][_0x1d57('0x4d')]);_0x555596[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x23eed8[_0x1d57('0x50')]);_0x555596[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x555596[_0x1d57('0x54')],_0x555596[_0x1d57('0x50')]);_0x50a737[_0x1d57('0x55')]=_['intersection'](_0x555596[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x23eed8[_0x1d57('0x50')]['fields']));_0x50a737[_0x1d57('0x55')]=_0x50a737[_0x1d57('0x55')][_0x1d57('0x65')]?_0x50a737[_0x1d57('0x55')]:_0x555596[_0x1d57('0x54')];if(_0x23eed8[_0x1d57('0x50')][_0x1d57('0x60')]){_0x50a737[_0x1d57('0x61')]=[{'all':!![]}];}_0x50a737=_[_0x1d57('0x5e')]({},_0x50a737,_0x23eed8[_0x1d57('0x66')]);return db[_0x1d57('0x4c')][_0x1d57('0x67')](_0x50a737)[_0x1d57('0x12')](handleEntityNotFound(_0x1fd4f9,null))['then'](respondWithResult(_0x1fd4f9,null))[_0x1d57('0x1b')](handleError(_0x1fd4f9,null));};exports[_0x1d57('0x26')]=function(_0x137a45,_0xb79298){if(_0x137a45[_0x1d57('0x68')]['id']){delete _0x137a45[_0x1d57('0x68')]['id'];}var _0x397a97=_0x137a45[_0x1d57('0x68')][_0x1d57('0x69')]==='custom'?null:_0x137a45[_0x1d57('0x68')][_0x1d57('0x69')];var _0x1df522=_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')]||{};var _0x46f529=_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')]||{};if(_0x397a97){_0x1df522[_0x1d57('0x3e')]=getImapHost(_0x397a97);_0x1df522['port']=0x3e1;_0x46f529[_0x1d57('0x3e')]=getSmtpHost(_0x397a97);_0x46f529[_0x1d57('0x3f')]=0x24b;_0x46f529[_0x1d57('0x40')]=![];}if(_0x46f529[_0x1d57('0x3c')]){_0x46f529[_0x1d57('0x40')]=![];}else{_0x46f529[_0x1d57('0x3d')]=null;}if(!_0x1df522[_0x1d57('0x3c')])_0x1df522[_0x1d57('0x3d')]=null;_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')]=_0x1df522;_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')]=_0x46f529;return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x137a45['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x1d57('0x48')],'as':'Smtp'},{'model':db[_0x1d57('0x49')],'as':_0x1d57('0x4a')}]})[_0x1d57('0x12')](handleEntityNotFound(_0xb79298,null))[_0x1d57('0x12')](function(_0x5b23fc){if(!_0x5b23fc)throw new Error(_0x1d57('0x6a'));if(_0x5b23fc[_0x1d57('0x41')])delete _0x137a45['body']['Imap'];return _0x5b23fc;})['then'](saveUpdates(_0x137a45[_0x1d57('0x68')],null))[_0x1d57('0x12')](function(_0x264f0){if(!_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')])return _0x264f0;return db[_0x1d57('0x47')]['update'](_0x137a45[_0x1d57('0x68')][_0x1d57('0x44')],{'where':{'MailAccountId':_0x264f0['id']}})[_0x1d57('0x12')](function(){return _0x264f0;});})[_0x1d57('0x12')](function(_0x324f9c){if(!_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')])return _0x324f9c;return db[_0x1d57('0x48')]['update'](_0x137a45[_0x1d57('0x68')][_0x1d57('0x45')],{'where':{'MailAccountId':_0x324f9c['id']}})['then'](function(){return _0x324f9c;});})[_0x1d57('0x12')](respondWithResult(_0xb79298,null))[_0x1d57('0x1b')](handleError(_0xb79298,null));};exports[_0x1d57('0x6b')]=function(_0x2d85b2,_0x343a0a){return db[_0x1d57('0x4c')]['describe']()[_0x1d57('0x12')](respondWithResult(_0x343a0a,null))[_0x1d57('0x1b')](handleError(_0x343a0a,null));};exports[_0x1d57('0x6c')]=function(_0x21a9c7,_0x26968f){if(_0x21a9c7[_0x1d57('0x68')]['id']){delete _0x21a9c7[_0x1d57('0x68')]['id'];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x21a9c7[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x26968f,null))[_0x1d57('0x12')](function(_0x4bc034){if(_0x4bc034){_0x21a9c7[_0x1d57('0x68')][_0x1d57('0x6d')]=_0x4bc034['id'];return db[_0x1d57('0x6e')][_0x1d57('0x6f')](_0x21a9c7[_0x1d57('0x68')]);}})[_0x1d57('0x12')](respondWithResult(_0x26968f,null))['catch'](handleError(_0x26968f,null));};exports[_0x1d57('0x70')]=function(_0xfb1ee0,_0x37bb39){var _0x502b08={'raw':![],'where':{}};var _0x105efe={};var _0x56d7e7={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')]['findOne']({'where':{'id':_0xfb1ee0[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x37bb39,null))[_0x1d57('0x12')](function(_0x2dc40e){if(_0x2dc40e){_0x105efe['model']=_[_0x1d57('0x51')](db[_0x1d57('0x6e')][_0x1d57('0x4d')]);_0x105efe[_0x1d57('0x50')]=_['keys'](_0xfb1ee0[_0x1d57('0x50')]);_0x105efe[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x105efe['model'],_0x105efe[_0x1d57('0x50')]);_0x502b08['attributes']=_[_0x1d57('0x53')](_0x105efe['model'],qs[_0x1d57('0x56')](_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x56')]));_0x502b08[_0x1d57('0x55')]=_0x502b08[_0x1d57('0x55')]['length']?_0x502b08[_0x1d57('0x55')]:_0x105efe[_0x1d57('0x54')];if(!_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x502b08['limit']=qs[_0x1d57('0x22')](_0xfb1ee0['query'][_0x1d57('0x22')]);_0x502b08[_0x1d57('0x20')]=qs['offset'](_0xfb1ee0[_0x1d57('0x50')]['offset']);}_0x502b08[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x502b08[_0x1d57('0x5f')]=qs['filters'](_[_0x1d57('0x5b')](_0xfb1ee0[_0x1d57('0x50')],_0x105efe[_0x1d57('0x52')]));_0x502b08['where'][_0x1d57('0x6d')]=_0x2dc40e['id'];if(_0xfb1ee0[_0x1d57('0x50')]['filter']){_0x502b08[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x502b08[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x502b08[_0x1d57('0x55')],function(_0x505de6){var _0x38bebd={};_0x38bebd[_0x505de6]={'$like':'%'+_0xfb1ee0[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x38bebd;})});}_0x502b08=_[_0x1d57('0x5e')]({},_0x502b08,_0xfb1ee0[_0x1d57('0x66')]);return db[_0x1d57('0x6e')][_0x1d57('0x23')]({'where':_0x502b08[_0x1d57('0x5f')]})['then'](function(_0x303649){_0x56d7e7[_0x1d57('0x23')]=_0x303649;if(_0xfb1ee0[_0x1d57('0x50')]['includeAll']){_0x502b08[_0x1d57('0x61')]=[{'all':!![]}];}return db[_0x1d57('0x6e')][_0x1d57('0x62')](_0x502b08);})[_0x1d57('0x12')](function(_0x4a6d20){_0x56d7e7[_0x1d57('0x71')]=_0x4a6d20;return _0x56d7e7;});}})[_0x1d57('0x12')](respondWithFilteredResult(_0x37bb39,_0x502b08))[_0x1d57('0x1b')](handleError(_0x37bb39,null));};exports[_0x1d57('0x72')]=function(_0x2aae5a,_0x3a55b5){return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x2aae5a[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x3a55b5,null))[_0x1d57('0x12')](function(_0x256316){if(_0x256316){return _0x256316[_0x1d57('0x72')](_0x2aae5a[_0x1d57('0x50')][_0x1d57('0x73')]);}})['then'](respondWithStatusCode(_0x3a55b5,null))[_0x1d57('0x1b')](handleError(_0x3a55b5,null));};exports[_0x1d57('0x74')]=function(_0x38b2ca,_0xde6210){if(_0x38b2ca[_0x1d57('0x68')]['id']){delete _0x38b2ca['body']['id'];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x38b2ca['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0xde6210,null))[_0x1d57('0x12')](function(_0x58a38e){if(_0x58a38e){_0x38b2ca[_0x1d57('0x68')]['MailAccountId']=_0x58a38e['id'];return db[_0x1d57('0x75')][_0x1d57('0x6f')](_0x38b2ca[_0x1d57('0x68')]);}})[_0x1d57('0x12')](respondWithResult(_0xde6210,null))['catch'](handleError(_0xde6210,null));};exports[_0x1d57('0x76')]=function(_0x5b3eec,_0x92eaf1){var _0x20d754={'raw':![],'where':{}};var _0x4015fa={};var _0x30dbd3={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')]['findOne']({'where':{'id':_0x5b3eec[_0x1d57('0x64')]['id']}})['then'](handleEntityNotFound(_0x92eaf1,null))[_0x1d57('0x12')](function(_0x13dc0f){if(_0x13dc0f){_0x4015fa[_0x1d57('0x54')]=_[_0x1d57('0x51')](db['CannedAnswer'][_0x1d57('0x4d')]);_0x4015fa['query']=_[_0x1d57('0x51')](_0x5b3eec[_0x1d57('0x50')]);_0x4015fa[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x4015fa['model'],_0x4015fa[_0x1d57('0x50')]);_0x20d754['attributes']=_['intersection'](_0x4015fa[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x5b3eec['query'][_0x1d57('0x56')]));_0x20d754['attributes']=_0x20d754[_0x1d57('0x55')][_0x1d57('0x65')]?_0x20d754[_0x1d57('0x55')]:_0x4015fa[_0x1d57('0x54')];if(!_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x20d754[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x22')]);_0x20d754[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x5b3eec['query'][_0x1d57('0x20')]);}_0x20d754[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x20d754[_0x1d57('0x5f')]=qs['filters'](_[_0x1d57('0x5b')](_0x5b3eec[_0x1d57('0x50')],_0x4015fa[_0x1d57('0x52')]));_0x20d754[_0x1d57('0x5f')]['MailAccountId']=_0x13dc0f['id'];if(_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x20d754[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x20d754[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x20d754[_0x1d57('0x55')],function(_0x3ee4c6){var _0x45868f={};_0x45868f[_0x3ee4c6]={'$like':'%'+_0x5b3eec[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x45868f;})});}_0x20d754=_[_0x1d57('0x5e')]({},_0x20d754,_0x5b3eec[_0x1d57('0x66')]);return db['CannedAnswer']['count']({'where':_0x20d754[_0x1d57('0x5f')]})[_0x1d57('0x12')](function(_0x477f24){_0x30dbd3[_0x1d57('0x23')]=_0x477f24;if(_0x5b3eec[_0x1d57('0x50')]['includeAll']){_0x20d754['include']=[{'all':!![]}];}return db[_0x1d57('0x75')][_0x1d57('0x62')](_0x20d754);})['then'](function(_0x313e5b){_0x30dbd3[_0x1d57('0x71')]=_0x313e5b;return _0x30dbd3;});}})['then'](respondWithFilteredResult(_0x92eaf1,_0x20d754))['catch'](handleError(_0x92eaf1,null));};exports[_0x1d57('0x77')]=function(_0x477536,_0x479edc){return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x477536['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x479edc,null))[_0x1d57('0x12')](function(_0x2bd350){if(_0x2bd350){return _0x2bd350['removeAnswers'](_0x477536[_0x1d57('0x50')][_0x1d57('0x73')]);}})[_0x1d57('0x12')](respondWithStatusCode(_0x479edc,null))['catch'](handleError(_0x479edc,null));};exports[_0x1d57('0x6f')]=function(_0x5c5e00,_0x138ab2){var _0x3dd8b4={'name':_0x5c5e00[_0x1d57('0x68')]['name'],'key':_0x5c5e00[_0x1d57('0x68')]['key'],'provider':_0x5c5e00['body'][_0x1d57('0x69')]===_0x1d57('0x78')?null:_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x69')],'email':_0x5c5e00['body']['email'],'ListId':_0x5c5e00['body'][_0x1d57('0x79')],'active':!_['isNil'](_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x7a')])?_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x7a')]:!![],'description':_0x5c5e00[_0x1d57('0x68')][_0x1d57('0x7b')]||null};var _0x24385b=getAuthenticationOptions(_0x3dd8b4[_0x1d57('0x69')],_0x5c5e00[_0x1d57('0x68')]);_0x3dd8b4[_0x1d57('0x44')]=_0x24385b[_0x1d57('0x44')];_0x3dd8b4[_0x1d57('0x45')]=_0x24385b[_0x1d57('0x45')];return db['MailAccount'][_0x1d57('0x6f')](_0x3dd8b4,{'include':[{'model':db[_0x1d57('0x48')],'as':'Smtp'},{'model':db[_0x1d57('0x47')],'as':_0x1d57('0x44')}]})[_0x1d57('0x12')](function(_0x2ba35f){var _0x56a81a=_0x5c5e00[_0x1d57('0x43')][_0x1d57('0x28')]({'plain':!![]});if(!_0x56a81a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56a81a[_0x1d57('0x7c')]===_0x1d57('0x43')){var _0x17b0c8=_0x2ba35f[_0x1d57('0x28')]({'plain':!![]});return db[_0x1d57('0x7d')][_0x1d57('0x67')]({'where':{'name':_0x1d57('0x29'),'userProfileId':_0x56a81a[_0x1d57('0x7e')]},'raw':!![]})['then'](function(_0x28a055){if(_0x28a055&&_0x28a055[_0x1d57('0x7f')]===0x0){return db[_0x1d57('0x2a')][_0x1d57('0x6f')]({'name':_0x17b0c8[_0x1d57('0x2c')],'resourceId':_0x17b0c8['id'],'type':_0x28a055[_0x1d57('0x2c')],'sectionId':_0x28a055['id']},{})[_0x1d57('0x12')](function(){return _0x2ba35f;});}else{return _0x2ba35f;}})[_0x1d57('0x1b')](function(_0x142f49){logger['error'](_0x1d57('0x80'),_0x142f49);throw _0x142f49;});}return _0x2ba35f;})[_0x1d57('0x12')](respondWithResult(_0x138ab2,0xc9))[_0x1d57('0x1b')](handleError(_0x138ab2,null));};exports[_0x1d57('0x81')]=function(_0x4cb1b2,_0x421fe5){return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x4cb1b2['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x421fe5,null))['then'](function(_0x49df57){if(_0x49df57){return _0x49df57[_0x1d57('0x81')]();}return null;})[_0x1d57('0x12')](respondWithResult(_0x421fe5,null))[_0x1d57('0x1b')](handleError(_0x421fe5,null));};exports[_0x1d57('0x83')]=function(_0x59b5cf,_0x33d9cf){if(_0x59b5cf['body']['id']){delete _0x59b5cf[_0x1d57('0x68')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x59b5cf[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x33d9cf,null))[_0x1d57('0x12')](function(_0x307181){if(_0x307181){_0x59b5cf[_0x1d57('0x68')]['MailAccountId']=_0x307181['id'];return db['MailServerIn']['create'](_0x59b5cf['body']);}})[_0x1d57('0x12')](respondWithResult(_0x33d9cf,null))[_0x1d57('0x1b')](handleError(_0x33d9cf,null));};exports[_0x1d57('0x84')]=function(_0x1cfab1,_0x443825){return db['MailAccount'][_0x1d57('0x82')]({'where':{'id':_0x1cfab1[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x443825,null))[_0x1d57('0x12')](function(_0x5ef37f){if(_0x5ef37f){return _0x5ef37f['setImap'](null);}return null;})[_0x1d57('0x12')](respondWithStatusCode(_0x443825,null))[_0x1d57('0x1b')](handleError(_0x443825,null));};exports['getSmtp']=function(_0x535248,_0x539fc3){return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x535248[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x539fc3,null))[_0x1d57('0x12')](function(_0x4e3d6a){if(_0x4e3d6a){return _0x4e3d6a['getSmtp']();}return null;})[_0x1d57('0x12')](respondWithResult(_0x539fc3,null))[_0x1d57('0x1b')](handleError(_0x539fc3,null));};exports['addSmtp']=function(_0x34655c,_0x1f1ea3){if(_0x34655c['body']['id']){delete _0x34655c[_0x1d57('0x68')]['id'];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x34655c['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x1f1ea3,null))[_0x1d57('0x12')](function(_0x368226){if(_0x368226){_0x34655c['body'][_0x1d57('0x6d')]=_0x368226['id'];return db[_0x1d57('0x48')][_0x1d57('0x6f')](_0x34655c[_0x1d57('0x68')]);}})[_0x1d57('0x12')](respondWithResult(_0x1f1ea3,null))[_0x1d57('0x1b')](handleError(_0x1f1ea3,null));};exports[_0x1d57('0x85')]=function(_0x4ecbb8,_0x1aab86){return db['MailAccount']['findOne']({'where':{'id':_0x4ecbb8['params']['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x1aab86,null))[_0x1d57('0x12')](function(_0x5ce7f8){if(_0x5ce7f8){return _0x5ce7f8[_0x1d57('0x86')](null);}return null;})[_0x1d57('0x12')](respondWithStatusCode(_0x1aab86,null))[_0x1d57('0x1b')](handleError(_0x1aab86,null));};exports[_0x1d57('0x87')]=function(_0x24f75a,_0x5c3176){return db[_0x1d57('0x88')][_0x1d57('0x67')]({'where':{'id':_0x24f75a[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x5c3176,null))[_0x1d57('0x12')](function(_0x41d561){if(_0x41d561){return _0x41d561[_0x1d57('0x87')](_0x24f75a[_0x1d57('0x68')][_0x1d57('0x73')],_[_0x1d57('0x89')](_0x24f75a['body'],[_0x1d57('0x73'),'id'])||{});}})[_0x1d57('0x12')](respondWithResult(_0x5c3176,null))[_0x1d57('0x1b')](handleError(_0x5c3176,null));};exports[_0x1d57('0x8a')]=function(_0x16e439,_0x577b3a){var _0x4dc2b8={'raw':![],'where':{}};var _0x1159b9={};var _0x59b4e6={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x16e439[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x577b3a,null))[_0x1d57('0x12')](function(_0xc68bd5){if(_0xc68bd5){_0x1159b9['model']=_['keys'](db[_0x1d57('0x88')][_0x1d57('0x4d')]);_0x1159b9[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x16e439['query']);_0x1159b9[_0x1d57('0x52')]=_['intersection'](_0x1159b9['model'],_0x1159b9['query']);_0x4dc2b8[_0x1d57('0x55')]=_[_0x1d57('0x53')](_0x1159b9[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x16e439[_0x1d57('0x50')][_0x1d57('0x56')]));_0x4dc2b8[_0x1d57('0x55')]=_0x4dc2b8[_0x1d57('0x55')]['length']?_0x4dc2b8['attributes']:_0x1159b9[_0x1d57('0x54')];if(!_0x16e439[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x4dc2b8[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x16e439['query'][_0x1d57('0x22')]);_0x4dc2b8[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x16e439[_0x1d57('0x50')][_0x1d57('0x20')]);}_0x4dc2b8[_0x1d57('0x59')]=qs['sort'](_0x16e439[_0x1d57('0x50')]['sort']);_0x4dc2b8[_0x1d57('0x5f')]=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x16e439['query'],_0x1159b9['filters']));_0x4dc2b8['where'][_0x1d57('0x6d')]=_0xc68bd5['id'];if(_0x16e439[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x4dc2b8['where']=_[_0x1d57('0x5e')](_0x4dc2b8[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x4dc2b8[_0x1d57('0x55')],function(_0x5d8868){var _0x8d8481={};_0x8d8481[_0x5d8868]={'$like':'%'+_0x16e439[_0x1d57('0x50')][_0x1d57('0x5d')]+'%'};return _0x8d8481;})});}_0x4dc2b8=_['merge']({},_0x4dc2b8,_0x16e439[_0x1d57('0x66')]);return db['MailInteraction'][_0x1d57('0x23')]({'where':_0x4dc2b8['where']})[_0x1d57('0x12')](function(_0xcf9893){_0x59b4e6[_0x1d57('0x23')]=_0xcf9893;if(_0x16e439['query'][_0x1d57('0x60')]){_0x4dc2b8[_0x1d57('0x61')]=[{'model':db['CmContact'],'as':_0x1d57('0x8b'),'required':![]},{'model':db[_0x1d57('0x8c')],'as':_0x1d57('0x8d'),'attributes':['name',_0x1d57('0x8e'),_0x1d57('0x8f')],'required':![]},{'model':db['Tag'],'as':_0x1d57('0x90'),'attributes':['id',_0x1d57('0x2c'),_0x1d57('0x91')],'where':_0x16e439['query'][_0x1d57('0x92')]?{'id':_0x16e439[_0x1d57('0x50')][_0x1d57('0x92')]}:undefined,'required':_0x16e439['query'][_0x1d57('0x92')]?!![]:![]}];}return db['MailInteraction'][_0x1d57('0x62')](_0x4dc2b8);})[_0x1d57('0x12')](function(_0x30edc2){_0x59b4e6[_0x1d57('0x71')]=_0x30edc2;return _0x59b4e6;});}})[_0x1d57('0x12')](respondWithFilteredResult(_0x577b3a,_0x4dc2b8))['catch'](handleError(_0x577b3a,null));};exports[_0x1d57('0x93')]=function addApplications(_0x153920,_0x1a9bec){var _0x2dcb97=_0x153920[_0x1d57('0x64')]['id'];var _0x2d23f3=_0x153920[_0x1d57('0x68')];var _0x198b35=0xc8;var _0x8c096=null;return db[_0x1d57('0x94')]['transaction']({'isolationLevel':db[_0x1d57('0x94')][_0x1d57('0x95')][_0x1d57('0x96')][_0x1d57('0x97')]},function(_0x543e56){return db['MailAccount'][_0x1d57('0x82')]({'where':{'id':_0x2dcb97},'transaction':_0x543e56})[_0x1d57('0x12')](function(_0x483275){if(_0x483275){return db['MailApplication'][_0x1d57('0x27')]({'where':{'MailAccountId':_0x2dcb97},'transaction':_0x543e56})['then'](function(){var _0xa1e868=_[_0x1d57('0x4b')](_0x2d23f3,function(_0x2c5be2){_0x2c5be2[_0x1d57('0x6d')]=_0x2dcb97;return _0x2c5be2;});return db['MailApplication']['bulkCreate'](_0xa1e868,{'transaction':_0x543e56});});}else{_0x198b35=0x194;_0x8c096=[];}});})[_0x1d57('0x12')](function(){if(_0x198b35!==0x194){return db[_0x1d57('0x98')][_0x1d57('0x99')]({'where':{'MailAccountId':_0x2dcb97},'order':_0x1d57('0x9a')})['then'](function(_0x2677c9){_0x8c096=_0x2677c9;});}})['catch'](function(_0x209f51){_0x198b35=0x1f4;logger[_0x1d57('0x18')](_0x209f51['stack']);if(_0x209f51[_0x1d57('0x2c')]){delete _0x209f51['name'];}_0x8c096=_0x209f51;})[_0x1d57('0x9b')](function(){if(_0x8c096===null){_0x1a9bec['sendStatus'](_0x198b35);}else{if(_0x198b35===0x1f4){_0x1a9bec[_0x1d57('0x1d')](_0x198b35)[_0x1d57('0x2d')](_0x8c096);}else{_0x1a9bec[_0x1d57('0x1d')](_0x198b35)['json'](_0x8c096);}}});};exports[_0x1d57('0x9c')]=function(_0x1c66f4,_0xd79643){var _0x2eebde={};var _0x5c83e7={};var _0x77c31;var _0x2449a1;return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x1c66f4[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0xd79643,null))[_0x1d57('0x12')](function(_0x4846b5){if(_0x4846b5){_0x77c31=_0x4846b5;_0x5c83e7[_0x1d57('0x54')]=_['keys'](db[_0x1d57('0x98')][_0x1d57('0x4d')]);_0x5c83e7['query']=_['keys'](_0x1c66f4[_0x1d57('0x50')]);_0x5c83e7[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x5c83e7[_0x1d57('0x54')],_0x5c83e7[_0x1d57('0x50')]);_0x2eebde['attributes']=_[_0x1d57('0x53')](_0x5c83e7['model'],qs[_0x1d57('0x56')](_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x56')]));_0x2eebde[_0x1d57('0x55')]=_0x2eebde[_0x1d57('0x55')]['length']?_0x2eebde[_0x1d57('0x55')]:_0x5c83e7['model'];_0x2eebde[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x2eebde[_0x1d57('0x5f')]=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x1c66f4[_0x1d57('0x50')],_0x5c83e7[_0x1d57('0x52')]));if(_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x2eebde['where']=_[_0x1d57('0x5e')](_0x2eebde[_0x1d57('0x5f')],{'$or':_[_0x1d57('0x4b')](_0x2eebde[_0x1d57('0x55')],function(_0x496470){var _0x41304b={};_0x41304b[_0x496470]={'$like':'%'+_0x1c66f4[_0x1d57('0x50')]['filter']+'%'};return _0x41304b;})});}_0x2eebde=_[_0x1d57('0x5e')]({},_0x2eebde,_0x1c66f4[_0x1d57('0x66')]);return _0x77c31[_0x1d57('0x9c')](_0x2eebde);}})[_0x1d57('0x12')](function(_0x160fbb){if(_0x160fbb){_0x2449a1=_0x160fbb[_0x1d57('0x65')];if(!_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x2eebde[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x1c66f4[_0x1d57('0x50')][_0x1d57('0x22')]);_0x2eebde[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x1c66f4['query'][_0x1d57('0x20')]);}return _0x77c31[_0x1d57('0x9c')](_0x2eebde);}})[_0x1d57('0x12')](function(_0x497a00){if(_0x497a00){return _0x497a00?{'count':_0x2449a1,'rows':_0x497a00}:null;}})[_0x1d57('0x12')](respondWithResult(_0xd79643,null))[_0x1d57('0x1b')](handleError(_0xd79643,null));};exports[_0x1d57('0x9d')]=function(_0x1446af,_0x150f00){var _0x225a72={'raw':!![],'where':{}};var _0x143fd5={};var _0xe969ae={'count':0x0,'rows':[]};return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x1446af[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x150f00,null))[_0x1d57('0x12')](function(_0x5ebf84){if(_0x5ebf84){_0x143fd5[_0x1d57('0x54')]=_[_0x1d57('0x51')](db[_0x1d57('0x9e')][_0x1d57('0x4d')]);_0x143fd5['query']=_[_0x1d57('0x51')](_0x1446af[_0x1d57('0x50')]);_0x143fd5['filters']=_[_0x1d57('0x53')](_0x143fd5['model'],_0x143fd5['query']);_0x225a72[_0x1d57('0x55')]=_['intersection'](_0x143fd5[_0x1d57('0x54')],qs[_0x1d57('0x56')](_0x1446af['query'][_0x1d57('0x56')]));_0x225a72[_0x1d57('0x55')]=_0x225a72[_0x1d57('0x55')]['length']?_0x225a72['attributes']:_0x143fd5[_0x1d57('0x54')];if(!_0x1446af[_0x1d57('0x50')][_0x1d57('0x57')](_0x1d57('0x58'))){_0x225a72[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x1446af[_0x1d57('0x50')][_0x1d57('0x22')]);_0x225a72['offset']=qs[_0x1d57('0x20')](_0x1446af['query'][_0x1d57('0x20')]);}_0x225a72[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x1446af[_0x1d57('0x50')][_0x1d57('0x5a')]);_0x225a72['where']=qs[_0x1d57('0x52')](_[_0x1d57('0x5b')](_0x1446af[_0x1d57('0x50')],_0x143fd5['filters']));_0x225a72['where'][_0x1d57('0x6d')]=_0x5ebf84['id'];if(_0x1446af[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x225a72[_0x1d57('0x5f')]=_['merge'](_0x225a72[_0x1d57('0x5f')],{'$or':_['map'](_0x225a72['attributes'],function(_0x1da8d4){var _0x5da1be={};_0x5da1be[_0x1da8d4]={'$like':'%'+_0x1446af['query']['filter']+'%'};return _0x5da1be;})});}if(_0x1446af['query']['$gte']){var _0x43f909=_0x1446af[_0x1d57('0x50')][_0x1d57('0x9f')]['split'](',');var _0x151015={};_0x151015[_0x43f909[0x0]]={'$gte':moment(_0x43f909[0x1])[_0x1d57('0xa0')](_0x1d57('0xa1'))};_0x225a72[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x225a72[_0x1d57('0x5f')],_0x151015);}_0x225a72=_[_0x1d57('0x5e')]({},_0x225a72,_0x1446af[_0x1d57('0x66')]);return db['MailMessage'][_0x1d57('0x23')]({'where':_0x225a72[_0x1d57('0x5f')]})[_0x1d57('0x12')](function(_0x4844db){_0xe969ae[_0x1d57('0x23')]=_0x4844db;if(_0x1446af['query'][_0x1d57('0x60')]){_0x225a72[_0x1d57('0x61')]=[{'all':!![]}];}return db[_0x1d57('0x9e')][_0x1d57('0x62')](_0x225a72);})[_0x1d57('0x12')](function(_0x15b650){if(_0x1446af[_0x1d57('0x50')][_0x1d57('0xa2')]===_0x1d57('0xa3')){for(var _0x1cb8d6=0x0;_0x1cb8d6<_0x15b650['length'];_0x1cb8d6++){_0x15b650[_0x1cb8d6][_0x1d57('0x68')]=juice(_0x15b650[_0x1cb8d6][_0x1d57('0x68')]);}}_0xe969ae['rows']=_0x15b650;return _0xe969ae;});}})['then'](respondWithFilteredResult(_0x150f00,_0x225a72))[_0x1d57('0x1b')](handleError(_0x150f00,null));};exports[_0x1d57('0x2d')]=function(_0x565fb5,_0x119e80){var _0x564b0a,_0x244db0={},_0x134a67;if(_0x565fb5[_0x1d57('0x68')]['to']){_0x134a67=_0x565fb5[_0x1d57('0x68')]['to'][_0x1d57('0xa4')](',')[0x0];}return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x565fb5['params']['id']},'include':[{'model':db[_0x1d57('0xa5')],'as':_0x1d57('0xa6'),'include':[{'model':db[_0x1d57('0xa7')],'as':_0x1d57('0xa8'),'where':{'email':_0x134a67},'limit':0x1,'order':[['updatedAt',_0x1d57('0xa9')]]}]},{'model':db[_0x1d57('0x48')],'as':_0x1d57('0x45'),'raw':!![],'include':[{'model':db[_0x1d57('0xaa')],'as':_0x1d57('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x119e80,null))[_0x1d57('0x12')](function(_0x222c7c){if(!_0x222c7c)return;_0x564b0a=_0x222c7c;if(!_0x222c7c[_0x1d57('0x45')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x565fb5['body'][_0x1d57('0xab')])){_0x565fb5[_0x1d57('0x68')][_0x1d57('0xab')]=util[_0x1d57('0xa0')](_0x1d57('0xac'),_0x222c7c[_0x1d57('0x2c')],_0x222c7c[_0x1d57('0xad')]||_0x222c7c['Smtp']['user']);}if(_0x565fb5['body'][_0x1d57('0xae')]&&_0x565fb5[_0x1d57('0x68')][_0x1d57('0xae')][_0x1d57('0x65')]){for(var _0x3731af=0x0;_0x3731af<_0x565fb5[_0x1d57('0x68')][_0x1d57('0xae')][_0x1d57('0x65')];_0x3731af+=0x1){_0x565fb5[_0x1d57('0x68')][_0x1d57('0xae')][_0x3731af]={'filename':_0x565fb5[_0x1d57('0x68')]['attachments'][_0x3731af][_0x1d57('0x2c')],'path':path[_0x1d57('0xaf')](config[_0x1d57('0xb0')],_0x1d57('0xb1'),_0x565fb5[_0x1d57('0x68')]['attachments'][_0x3731af][_0x1d57('0xb2')])};}}var _0x102940=_0x222c7c[_0x1d57('0xb3')]();return respondWithRpcPromise(_0x1d57('0xb4'),_0x1d57('0xb5'),{'account':_0x102940,'message':_0x565fb5[_0x1d57('0x68')]});})[_0x1d57('0x12')](function(_0x209fa8){if(!_0x209fa8)return;_0x244db0=_0x209fa8;if(!_0x564b0a[_0x1d57('0xa6')])throw new Error('List\x20not\x20found');if(_0x564b0a[_0x1d57('0xa6')]['Contacts'][_0x1d57('0x65')])return _0x564b0a[_0x1d57('0xa6')][_0x1d57('0xa8')][0x0];return db[_0x1d57('0xa7')][_0x1d57('0x6f')](_[_0x1d57('0xa')](_0x565fb5[_0x1d57('0x68')],{'firstName':_0x565fb5['body']['to'],'email':_0x565fb5['body']['to'],'phone':_0x565fb5[_0x1d57('0x68')]['to'],'ListId':_0x564b0a[_0x1d57('0x79')]}));})[_0x1d57('0x12')](function(_0x36495d){if(!_0x36495d)return;var _0xf4711d={'UserId':_0x565fb5['user']['id'],'ContactId':_0x36495d['id'],'MailAccountId':_0x564b0a['id'],'inReplyTo':_0x244db0['messageId'],'to':_0x565fb5[_0x1d57('0x68')]['from'],'cc':_0x565fb5[_0x1d57('0x68')]['cc'],'subject':_0x565fb5[_0x1d57('0x68')][_0x1d57('0xb6')],'attach':_0x565fb5['body'][_0x1d57('0xb7')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x1d57('0xa0')](_0x1d57('0xa1')),'lastMsgDirection':_0x1d57('0xb8'),'Messages':[_[_0x1d57('0x5e')](_0x565fb5[_0x1d57('0x68')],{'messageId':_0x244db0['messageId'],'sentAt':moment()[_0x1d57('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x564b0a['id'],'UserId':_0x565fb5[_0x1d57('0x43')]['id'],'ContactId':_0x36495d['id']})]};if(_0x565fb5[_0x1d57('0x68')]['Interaction']){_0xf4711d=_[_0x1d57('0x5e')](_0xf4711d,_0x565fb5['body'][_0x1d57('0xb9')]);}return db[_0x1d57('0x88')]['create'](_0xf4711d,{'include':[{'model':db['MailMessage'],'as':_0x1d57('0xba')}]});})['then'](respondWithResult(_0x119e80,null))[_0x1d57('0x1b')](handleError(_0x119e80,null));};exports[_0x1d57('0xbb')]=function(_0x20806f,_0x45b10f){return db['MailAccount'][_0x1d57('0x67')]({'where':{'id':_0x20806f[_0x1d57('0x64')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x1d57('0x45'),'raw':!![],'include':[{'model':db[_0x1d57('0xaa')],'as':'CloudProvider','raw':!![]}]}]})[_0x1d57('0x12')](handleEntityNotFound(_0x45b10f,null))['then'](function(_0x4ba8aa){if(!_0x4ba8aa[_0x1d57('0x45')])return;var _0x21408f=_0x4ba8aa[_0x1d57('0xb3')]();return respondWithRpcPromise(_0x1d57('0xbc'),_0x1d57('0xbb'),{'account':_0x21408f});})[_0x1d57('0x12')](respondWithResult(_0x45b10f,null))[_0x1d57('0x1b')](handleError(_0x45b10f,null));};exports[_0x1d57('0x27')]=function(_0x41fb5e,_0x6e70a2){return db['MailAccount'][_0x1d57('0x67')]({'where':{'id':_0x41fb5e[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x6e70a2,null))[_0x1d57('0x12')](function(_0x2f5ef8){if(_0x2f5ef8&&_0x2f5ef8[_0x1d57('0x41')]){throw new db[(_0x1d57('0xbd'))][(_0x1d57('0xbe'))](_0x1d57('0xbf'));}return _0x2f5ef8;})[_0x1d57('0x12')](removeEntity(_0x6e70a2,null))[_0x1d57('0x1b')](handleError(_0x6e70a2,null));};exports[_0x1d57('0xc0')]=function(_0x7b5d86,_0xb0c642){return db[_0x1d57('0x4c')][_0x1d57('0x67')]({'where':{'id':_0x7b5d86[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0xb0c642,null))[_0x1d57('0x12')](function(_0x1cbc90){if(_0x1cbc90){return _0x1cbc90['addAgents'](_0x7b5d86[_0x1d57('0x68')]['ids'],_[_0x1d57('0x89')](_0x7b5d86[_0x1d57('0x68')],[_0x1d57('0x73'),'id'])||{})[_0x1d57('0xc1')](function(_0x1fb486){for(var _0x7e0b2=0x0;_0x7e0b2<_0x7b5d86[_0x1d57('0x68')][_0x1d57('0x73')]['length'];_0x7e0b2+=0x1){socket['emit'](_0x1d57('0xc2'),{'UserId':Number(_0x7b5d86[_0x1d57('0x68')]['ids'][_0x7e0b2]),'MailAccountId':Number(_0x7b5d86[_0x1d57('0x64')]['id'])});}return _0x1fb486;});}})[_0x1d57('0x12')](respondWithResult(_0xb0c642,null))[_0x1d57('0x1b')](handleError(_0xb0c642,null));};exports[_0x1d57('0xc3')]=function(_0x246548,_0x7b5747){return db[_0x1d57('0x4c')]['find']({'where':{'id':_0x246548[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x7b5747,null))[_0x1d57('0x12')](function(_0x10c9f){if(_0x10c9f){return _0x10c9f[_0x1d57('0xc3')](_0x246548[_0x1d57('0x50')]['ids'])[_0x1d57('0x12')](function(){if(_[_0x1d57('0xc4')](_0x246548[_0x1d57('0x50')][_0x1d57('0x73')])){for(var _0x2df811=0x0;_0x2df811<_0x246548[_0x1d57('0x50')][_0x1d57('0x73')][_0x1d57('0x65')];_0x2df811+=0x1){socket[_0x1d57('0xc5')]('userMailAccount:remove',{'UserId':Number(_0x246548[_0x1d57('0x50')][_0x1d57('0x73')][_0x2df811]),'MailAccountId':Number(_0x246548[_0x1d57('0x64')]['id'])});}}else{socket['emit'](_0x1d57('0xc6'),{'UserId':Number(_0x246548[_0x1d57('0x50')][_0x1d57('0x73')]),'MailAccountId':Number(_0x246548[_0x1d57('0x64')]['id'])});}});}})[_0x1d57('0x12')](respondWithStatusCode(_0x7b5747,null))[_0x1d57('0x1b')](handleError(_0x7b5747,null));};exports[_0x1d57('0xc7')]=function(_0x1155e8,_0x5ab049){var _0x23928c={};var _0x2a6285={};var _0x28df82;var _0x3df7c3;return db[_0x1d57('0x4c')][_0x1d57('0x82')]({'where':{'id':_0x1155e8[_0x1d57('0x64')]['id']}})[_0x1d57('0x12')](handleEntityNotFound(_0x5ab049,null))[_0x1d57('0x12')](function(_0x92d1ea){if(_0x92d1ea){_0x28df82=_0x92d1ea;_0x2a6285[_0x1d57('0x54')]=_['keys'](db[_0x1d57('0x8c')]['rawAttributes']);_0x2a6285[_0x1d57('0x50')]=_[_0x1d57('0x51')](_0x1155e8[_0x1d57('0x50')]);_0x2a6285[_0x1d57('0x52')]=_[_0x1d57('0x53')](_0x2a6285[_0x1d57('0x54')],_0x2a6285[_0x1d57('0x50')]);_0x23928c[_0x1d57('0x55')]=_['intersection'](_0x2a6285[_0x1d57('0x54')],qs['fields'](_0x1155e8[_0x1d57('0x50')][_0x1d57('0x56')]));_0x23928c[_0x1d57('0x55')]=_0x23928c['attributes'][_0x1d57('0x65')]?_0x23928c['attributes']:_0x2a6285[_0x1d57('0x54')];_0x23928c[_0x1d57('0x59')]=qs[_0x1d57('0x5a')](_0x1155e8[_0x1d57('0x50')]['sort']);_0x23928c[_0x1d57('0x5f')]=qs['filters'](_['pick'](_0x1155e8['query'],_0x2a6285['filters']));if(_0x1155e8[_0x1d57('0x50')][_0x1d57('0x5d')]){_0x23928c[_0x1d57('0x5f')]=_[_0x1d57('0x5e')](_0x23928c['where'],{'$or':_['map'](_0x23928c['attributes'],function(_0x1947e9){var _0x4fdb2f={};_0x4fdb2f[_0x1947e9]={'$like':'%'+_0x1155e8['query'][_0x1d57('0x5d')]+'%'};return _0x4fdb2f;})});}_0x23928c=_[_0x1d57('0x5e')]({},_0x23928c,_0x1155e8[_0x1d57('0x66')]);return _0x28df82[_0x1d57('0xc7')](_0x23928c);}})[_0x1d57('0x12')](function(_0x3af890){if(_0x3af890){_0x3df7c3=_0x3af890[_0x1d57('0x65')];if(!_0x1155e8[_0x1d57('0x50')]['hasOwnProperty'](_0x1d57('0x58'))){_0x23928c[_0x1d57('0x22')]=qs[_0x1d57('0x22')](_0x1155e8[_0x1d57('0x50')]['limit']);_0x23928c[_0x1d57('0x20')]=qs[_0x1d57('0x20')](_0x1155e8['query']['offset']);}return _0x28df82[_0x1d57('0xc7')](_0x23928c);}})[_0x1d57('0x12')](function(_0x491deb){if(_0x491deb){return _0x491deb?{'count':_0x3df7c3,'rows':_0x491deb}:null;}})[_0x1d57('0x12')](respondWithResult(_0x5ab049,null))[_0x1d57('0x1b')](handleError(_0x5ab049,null));}; \ No newline at end of file +var _0xbef5=['removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','service','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','register','client','http','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','UserProfileResource','sendStatus','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','hotmail','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','authentication','Imap','Smtp','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','Pause','find','body','provider','custom','MailServerIn','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','params','hasOwnProperty','rows'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbef5,0x1d8));var _0x5bef=function(_0x4b0f7d,_0x80d6b7){_0x4b0f7d=_0x4b0f7d-0x0;var _0x234fb2=_0xbef5[_0x4b0f7d];return _0x234fb2;};'use strict';var moment=require(_0x5bef('0x0'));var BPromise=require(_0x5bef('0x1'));var util=require(_0x5bef('0x2'));var path=require(_0x5bef('0x3'));var _=require(_0x5bef('0x4'));var juice=require(_0x5bef('0x5'));var Redis=require('ioredis');var qs=require(_0x5bef('0x6'));var logger=require(_0x5bef('0x7'))(_0x5bef('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5bef('0x9')](config[_0x5bef('0xa')],{'host':_0x5bef('0xb'),'port':0x18eb});var socket=require(_0x5bef('0xc'))(new Redis(config[_0x5bef('0xa')]));require('./mailAccount.socket')[_0x5bef('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5bef('0xe')][_0x5bef('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x34ad8e,_0x4b648a,_0x1c6eb4,_0x255449){return new BPromise(function(_0xc3950e,_0x16965e){var _0x4ec9b6=_0x255449||client;return _0x4ec9b6['request'](_0x34ad8e,_0x1c6eb4)[_0x5bef('0x10')](function(_0x6a616e){logger[_0x5bef('0x11')](_0x5bef('0x12'),_0x4b648a,'request\x20sent');logger[_0x5bef('0x13')](_0x5bef('0x14'),_0x4b648a,_0x5bef('0x15'),JSON['stringify'](_0x6a616e));if(_0x6a616e[_0x5bef('0x16')]){if(_0x6a616e[_0x5bef('0x16')]['code']===0x1f4){logger[_0x5bef('0x16')]('MailAccount,\x20%s,\x20%s',_0x4b648a,_0x6a616e['error']['message']);return _0x16965e(_0x6a616e[_0x5bef('0x16')][_0x5bef('0x17')]);}logger[_0x5bef('0x16')](_0x5bef('0x12'),_0x4b648a,_0x6a616e['error'][_0x5bef('0x17')]);return _0xc3950e(_0x6a616e[_0x5bef('0x16')]['message']);}else{logger[_0x5bef('0x11')](_0x5bef('0x12'),_0x4b648a,_0x5bef('0x15'));_0xc3950e(_0x6a616e['result'][_0x5bef('0x17')]);}})[_0x5bef('0x18')](function(_0xae14b0){logger['error']('MailAccount,\x20%s,\x20%s',_0x4b648a,_0xae14b0);_0x16965e(_0xae14b0);});});}function respondWithStatusCode(_0xcb30bf,_0x3c7efd){_0x3c7efd=_0x3c7efd||0xcc;return function(_0x10baba){if(_0x10baba){return _0xcb30bf['sendStatus'](_0x3c7efd);}return _0xcb30bf[_0x5bef('0x19')](_0x3c7efd)[_0x5bef('0x1a')]();};}function respondWithResult(_0x9bdf53,_0x2f71b2){_0x2f71b2=_0x2f71b2||0xc8;return function(_0x5098fa){if(_0x5098fa){return _0x9bdf53['status'](_0x2f71b2)[_0x5bef('0x1b')](_0x5098fa);}};}function respondWithFilteredResult(_0x239010,_0x4034ea){return function(_0x4c9258){if(_0x4c9258){var _0x39fddf=typeof _0x4034ea[_0x5bef('0x1c')]===_0x5bef('0x1d')&&typeof _0x4034ea['limit']===_0x5bef('0x1d');var _0x47f3d8=_0x4c9258[_0x5bef('0x1e')];var _0x544571=_0x39fddf?0x0:_0x4034ea['offset'];var _0x2c4800=_0x39fddf?_0x4c9258[_0x5bef('0x1e')]:_0x4034ea[_0x5bef('0x1c')]+_0x4034ea[_0x5bef('0x1f')];var _0x177419;if(_0x2c4800>=_0x47f3d8){_0x2c4800=_0x47f3d8;_0x177419=0xc8;}else{_0x177419=0xce;}_0x239010['status'](_0x177419);return _0x239010[_0x5bef('0x20')](_0x5bef('0x21'),_0x544571+'-'+_0x2c4800+'/'+_0x47f3d8)[_0x5bef('0x1b')](_0x4c9258);}return null;};}function saveUpdates(_0x70b248){return function(_0x5bd3ea){if(_0x5bd3ea){return _0x5bd3ea[_0x5bef('0x22')](_0x70b248)[_0x5bef('0x10')](function(_0x3df167){return _0x3df167;});}return null;};}function removeEntity(_0x40313a){return function(_0xcdc26b){if(_0xcdc26b){return _0xcdc26b[_0x5bef('0x23')]()['then'](function(){var _0x4d6d47=_0xcdc26b[_0x5bef('0x24')]({'plain':!![]});var _0x3d1217='MailAccounts';return db[_0x5bef('0x25')][_0x5bef('0x23')]({'where':{'type':_0x3d1217,'resourceId':_0x4d6d47['id']}})[_0x5bef('0x10')](function(){return _0xcdc26b;});})[_0x5bef('0x10')](function(){_0x40313a[_0x5bef('0x19')](0xcc)[_0x5bef('0x1a')]();});}};}function handleEntityNotFound(_0x1a73d4){return function(_0x5e8f66){if(!_0x5e8f66){_0x1a73d4[_0x5bef('0x26')](0x194);}return _0x5e8f66;};}function handleError(_0x551fcc,_0x34ccec){_0x34ccec=_0x34ccec||0x1f4;return function(_0x2bbfbc){logger[_0x5bef('0x16')](_0x2bbfbc['stack']);if(_0x2bbfbc[_0x5bef('0x27')]){delete _0x2bbfbc[_0x5bef('0x27')];}_0x551fcc['status'](_0x34ccec)['send'](_0x2bbfbc);};}function getImapHost(_0x404bb4){switch(_0x404bb4){case _0x5bef('0x28'):return _0x5bef('0x29');case _0x5bef('0x2a'):return _0x5bef('0x2b');case'hotmail':return _0x5bef('0x2c');case _0x5bef('0x2d'):return _0x5bef('0x2e');}throw new Error(_0x5bef('0x2f'),_0x404bb4);}function getSmtpHost(_0x36565){switch(_0x36565){case _0x5bef('0x28'):return'smtp.gmail.com';case _0x5bef('0x2a'):return _0x5bef('0x30');case _0x5bef('0x31'):return'smtp-mail.outlook.com';case _0x5bef('0x2d'):return'smtp.office365.com';}throw new Error(_0x5bef('0x2f'),_0x36565);}function getAuthenticationOptions(_0x4b36cf,_0x3aedd8){var _0x48f0da={};var _0x32081b={};if(_0x4b36cf){_0x48f0da[_0x5bef('0x32')]=_0x32081b[_0x5bef('0x32')]=_0x3aedd8[_0x5bef('0x33')];_0x48f0da[_0x5bef('0x34')]=_0x32081b[_0x5bef('0x35')]=_0x3aedd8[_0x5bef('0x34')];if(_0x3aedd8[_0x5bef('0x36')]){_0x48f0da[_0x5bef('0x36')]=_0x32081b['modernAuthentication']=!![];_0x48f0da[_0x5bef('0x37')]=_0x32081b[_0x5bef('0x37')]=_0x3aedd8[_0x5bef('0x37')];_0x48f0da[_0x5bef('0x34')]=_0x32081b[_0x5bef('0x35')]=null;}else{_0x48f0da[_0x5bef('0x37')]=_0x32081b[_0x5bef('0x37')]=null;}_0x48f0da[_0x5bef('0x38')]=getImapHost(_0x4b36cf);_0x48f0da[_0x5bef('0x39')]=0x3e1;_0x32081b['host']=getSmtpHost(_0x4b36cf);_0x32081b[_0x5bef('0x39')]=0x24b;_0x32081b[_0x5bef('0x3a')]=![];_0x48f0da['service']=_0x32081b['service']=null;}else{if(_0x3aedd8[_0x5bef('0x3b')]){_0x48f0da['user']=_0x32081b[_0x5bef('0x32')]=_0x3aedd8[_0x5bef('0x33')];_0x48f0da[_0x5bef('0x34')]=_0x32081b[_0x5bef('0x35')]=_0x3aedd8[_0x5bef('0x34')];}else{_0x48f0da[_0x5bef('0x3b')]=_0x32081b['authentication']=![];_0x48f0da['user']=_0x32081b[_0x5bef('0x32')]=null;_0x48f0da[_0x5bef('0x34')]=_0x32081b['pass']=null;}_0x48f0da[_0x5bef('0x38')]=_0x3aedd8[_0x5bef('0x3c')][_0x5bef('0x38')];_0x48f0da[_0x5bef('0x39')]=_0x3aedd8[_0x5bef('0x3c')][_0x5bef('0x39')];_0x32081b[_0x5bef('0x38')]=_0x3aedd8[_0x5bef('0x3d')][_0x5bef('0x38')];_0x32081b[_0x5bef('0x39')]=_0x3aedd8['Smtp'][_0x5bef('0x39')];}return{'Imap':_0x48f0da,'Smtp':_0x32081b};}exports['index']=function(_0x514179,_0x4c1792){var _0x288d0b={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x5bef('0x3e')],'as':_0x5bef('0x3d')},{'model':db['Pause'],'as':_0x5bef('0x3f')}]},_0x5bd687={},_0x46b136={'count':0x0,'rows':[]};var _0xb942a1=_[_0x5bef('0x40')](db[_0x5bef('0x41')][_0x5bef('0x42')],function(_0x435c46){return{'name':_0x435c46[_0x5bef('0x43')],'type':_0x435c46[_0x5bef('0x44')]['key']};});_0x5bd687[_0x5bef('0x45')]=_[_0x5bef('0x40')](_0xb942a1,_0x5bef('0x27'));_0x5bd687['query']=_[_0x5bef('0x46')](_0x514179[_0x5bef('0x47')]);_0x5bd687[_0x5bef('0x48')]=_[_0x5bef('0x49')](_0x5bd687[_0x5bef('0x45')],_0x5bd687[_0x5bef('0x47')]);_0x288d0b[_0x5bef('0x4a')]=_[_0x5bef('0x49')](_0x5bd687[_0x5bef('0x45')],qs[_0x5bef('0x4b')](_0x514179[_0x5bef('0x47')][_0x5bef('0x4b')]));_0x288d0b[_0x5bef('0x4a')]=_0x288d0b['attributes'][_0x5bef('0x4c')]?_0x288d0b['attributes']:_0x5bd687[_0x5bef('0x45')];if(!_0x514179[_0x5bef('0x47')]['hasOwnProperty'](_0x5bef('0x4d'))){_0x288d0b[_0x5bef('0x1f')]=qs[_0x5bef('0x1f')](_0x514179[_0x5bef('0x47')][_0x5bef('0x1f')]);_0x288d0b['offset']=qs['offset'](_0x514179[_0x5bef('0x47')][_0x5bef('0x1c')]);}_0x288d0b[_0x5bef('0x4e')]=qs[_0x5bef('0x4f')](_0x514179['query']['sort']);_0x288d0b['where']=qs[_0x5bef('0x48')](_[_0x5bef('0x50')](_0x514179[_0x5bef('0x47')],_0x5bd687['filters']),_0xb942a1);if(_0x514179[_0x5bef('0x47')][_0x5bef('0x51')]){_0x288d0b['where']=_[_0x5bef('0x52')](_0x288d0b[_0x5bef('0x53')],{'$or':_['map'](_0xb942a1,function(_0x9877e5){if(_0x9877e5['type']!==_0x5bef('0x54')){var _0x3d0a1b={};_0x3d0a1b[_0x9877e5[_0x5bef('0x27')]]={'$like':'%'+_0x514179['query'][_0x5bef('0x51')]+'%'};return _0x3d0a1b;}})});}_0x288d0b=_['merge']({},_0x288d0b,_0x514179[_0x5bef('0x55')]);var _0x1dcf3b={'where':_0x288d0b['where']};return db['MailAccount'][_0x5bef('0x1e')](_0x1dcf3b)[_0x5bef('0x10')](function(_0x1620dd){_0x46b136[_0x5bef('0x1e')]=_0x1620dd;if(_0x514179[_0x5bef('0x47')][_0x5bef('0x56')]){_0x288d0b[_0x5bef('0x57')]=[{'all':!![]}];}return db[_0x5bef('0x41')][_0x5bef('0x58')](_0x288d0b);})['then'](function(_0xde46fb){_0x46b136['rows']=_0xde46fb;return _0x46b136;})['then'](respondWithFilteredResult(_0x4c1792,_0x288d0b))[_0x5bef('0x18')](handleError(_0x4c1792,null));};exports['show']=function(_0x4612da,_0x264f61){var _0x58f71f={'raw':![],'where':{'id':_0x4612da['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x5bef('0x3c')},{'model':db[_0x5bef('0x3e')],'as':_0x5bef('0x3d')},{'model':db[_0x5bef('0x59')],'as':_0x5bef('0x3f')}]},_0x31a866={};_0x31a866[_0x5bef('0x45')]=_[_0x5bef('0x46')](db['MailAccount'][_0x5bef('0x42')]);_0x31a866[_0x5bef('0x47')]=_[_0x5bef('0x46')](_0x4612da[_0x5bef('0x47')]);_0x31a866['filters']=_[_0x5bef('0x49')](_0x31a866[_0x5bef('0x45')],_0x31a866['query']);_0x58f71f[_0x5bef('0x4a')]=_['intersection'](_0x31a866[_0x5bef('0x45')],qs[_0x5bef('0x4b')](_0x4612da[_0x5bef('0x47')][_0x5bef('0x4b')]));_0x58f71f[_0x5bef('0x4a')]=_0x58f71f[_0x5bef('0x4a')][_0x5bef('0x4c')]?_0x58f71f[_0x5bef('0x4a')]:_0x31a866[_0x5bef('0x45')];if(_0x4612da[_0x5bef('0x47')]['includeAll']){_0x58f71f[_0x5bef('0x57')]=[{'all':!![]}];}_0x58f71f=_[_0x5bef('0x52')]({},_0x58f71f,_0x4612da[_0x5bef('0x55')]);return db['MailAccount'][_0x5bef('0x5a')](_0x58f71f)[_0x5bef('0x10')](handleEntityNotFound(_0x264f61,null))[_0x5bef('0x10')](respondWithResult(_0x264f61,null))['catch'](handleError(_0x264f61,null));};exports['update']=function(_0x413f8c,_0x9acc15){if(_0x413f8c[_0x5bef('0x5b')]['id']){delete _0x413f8c['body']['id'];}var _0x209bda=_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x5c')]===_0x5bef('0x5d')?null:_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x5c')];var _0x4160c9=_0x413f8c[_0x5bef('0x5b')]['Imap']||{};var _0x3d5556=_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x3d')]||{};if(_0x209bda){_0x4160c9[_0x5bef('0x38')]=getImapHost(_0x209bda);_0x4160c9[_0x5bef('0x39')]=0x3e1;_0x3d5556['host']=getSmtpHost(_0x209bda);_0x3d5556['port']=0x24b;_0x3d5556[_0x5bef('0x3a')]=![];}if(_0x3d5556[_0x5bef('0x36')]){_0x3d5556[_0x5bef('0x3a')]=![];}else{_0x3d5556[_0x5bef('0x37')]=null;}if(!_0x4160c9[_0x5bef('0x36')])_0x4160c9[_0x5bef('0x37')]=null;_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x3c')]=_0x4160c9;_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x3d')]=_0x3d5556;return db[_0x5bef('0x41')][_0x5bef('0x5a')]({'where':{'id':_0x413f8c['params']['id']},'include':[{'model':db[_0x5bef('0x5e')],'as':_0x5bef('0x3c')},{'model':db[_0x5bef('0x3e')],'as':'Smtp'},{'model':db[_0x5bef('0x59')],'as':_0x5bef('0x3f')}]})[_0x5bef('0x10')](handleEntityNotFound(_0x9acc15,null))['then'](function(_0x1d7d6b){if(!_0x1d7d6b)throw new Error('Mail\x20Account\x20not\x20found');if(_0x1d7d6b['service'])delete _0x413f8c[_0x5bef('0x5b')][_0x5bef('0x3c')];return _0x1d7d6b;})[_0x5bef('0x10')](saveUpdates(_0x413f8c[_0x5bef('0x5b')],null))[_0x5bef('0x10')](function(_0x2baf53){if(!_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x3c')])return _0x2baf53;return db[_0x5bef('0x5e')][_0x5bef('0x22')](_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x3c')],{'where':{'MailAccountId':_0x2baf53['id']}})['then'](function(){return _0x2baf53;});})[_0x5bef('0x10')](function(_0x5880ee){if(!_0x413f8c['body'][_0x5bef('0x3d')])return _0x5880ee;return db[_0x5bef('0x3e')]['update'](_0x413f8c[_0x5bef('0x5b')][_0x5bef('0x3d')],{'where':{'MailAccountId':_0x5880ee['id']}})['then'](function(){return _0x5880ee;});})[_0x5bef('0x10')](respondWithResult(_0x9acc15,null))[_0x5bef('0x18')](handleError(_0x9acc15,null));};exports[_0x5bef('0x5f')]=function(_0x3c897b,_0x3865dd){return db[_0x5bef('0x41')][_0x5bef('0x5f')]()[_0x5bef('0x10')](respondWithResult(_0x3865dd,null))[_0x5bef('0x18')](handleError(_0x3865dd,null));};exports[_0x5bef('0x60')]=function(_0x5d2622,_0x2f3ed3){if(_0x5d2622[_0x5bef('0x5b')]['id']){delete _0x5d2622[_0x5bef('0x5b')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5d2622['params']['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x2f3ed3,null))[_0x5bef('0x10')](function(_0x22b75e){if(_0x22b75e){_0x5d2622['body'][_0x5bef('0x61')]=_0x22b75e['id'];return db[_0x5bef('0x62')]['create'](_0x5d2622[_0x5bef('0x5b')]);}})[_0x5bef('0x10')](respondWithResult(_0x2f3ed3,null))[_0x5bef('0x18')](handleError(_0x2f3ed3,null));};exports[_0x5bef('0x63')]=function(_0x53b64e,_0x52dcfc){var _0x37d614={'raw':![],'where':{}};var _0x53cefc={};var _0x307641={'count':0x0,'rows':[]};return db[_0x5bef('0x41')][_0x5bef('0x64')]({'where':{'id':_0x53b64e[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x52dcfc,null))['then'](function(_0x478968){if(_0x478968){_0x53cefc[_0x5bef('0x45')]=_['keys'](db[_0x5bef('0x62')]['rawAttributes']);_0x53cefc[_0x5bef('0x47')]=_[_0x5bef('0x46')](_0x53b64e['query']);_0x53cefc['filters']=_['intersection'](_0x53cefc['model'],_0x53cefc['query']);_0x37d614[_0x5bef('0x4a')]=_['intersection'](_0x53cefc['model'],qs[_0x5bef('0x4b')](_0x53b64e[_0x5bef('0x47')]['fields']));_0x37d614['attributes']=_0x37d614[_0x5bef('0x4a')][_0x5bef('0x4c')]?_0x37d614[_0x5bef('0x4a')]:_0x53cefc['model'];if(!_0x53b64e[_0x5bef('0x47')][_0x5bef('0x66')](_0x5bef('0x4d'))){_0x37d614['limit']=qs[_0x5bef('0x1f')](_0x53b64e[_0x5bef('0x47')][_0x5bef('0x1f')]);_0x37d614[_0x5bef('0x1c')]=qs['offset'](_0x53b64e['query'][_0x5bef('0x1c')]);}_0x37d614[_0x5bef('0x4e')]=qs[_0x5bef('0x4f')](_0x53b64e[_0x5bef('0x47')][_0x5bef('0x4f')]);_0x37d614[_0x5bef('0x53')]=qs[_0x5bef('0x48')](_[_0x5bef('0x50')](_0x53b64e[_0x5bef('0x47')],_0x53cefc[_0x5bef('0x48')]));_0x37d614[_0x5bef('0x53')][_0x5bef('0x61')]=_0x478968['id'];if(_0x53b64e[_0x5bef('0x47')][_0x5bef('0x51')]){_0x37d614[_0x5bef('0x53')]=_[_0x5bef('0x52')](_0x37d614[_0x5bef('0x53')],{'$or':_[_0x5bef('0x40')](_0x37d614[_0x5bef('0x4a')],function(_0x143029){var _0x2d8f01={};_0x2d8f01[_0x143029]={'$like':'%'+_0x53b64e[_0x5bef('0x47')][_0x5bef('0x51')]+'%'};return _0x2d8f01;})});}_0x37d614=_[_0x5bef('0x52')]({},_0x37d614,_0x53b64e[_0x5bef('0x55')]);return db[_0x5bef('0x62')]['count']({'where':_0x37d614[_0x5bef('0x53')]})[_0x5bef('0x10')](function(_0x81dcaa){_0x307641[_0x5bef('0x1e')]=_0x81dcaa;if(_0x53b64e[_0x5bef('0x47')]['includeAll']){_0x37d614['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x37d614);})[_0x5bef('0x10')](function(_0x5161a6){_0x307641[_0x5bef('0x67')]=_0x5161a6;return _0x307641;});}})[_0x5bef('0x10')](respondWithFilteredResult(_0x52dcfc,_0x37d614))['catch'](handleError(_0x52dcfc,null));};exports['removeDispositions']=function(_0xc2913f,_0x5d782a){return db[_0x5bef('0x41')][_0x5bef('0x5a')]({'where':{'id':_0xc2913f[_0x5bef('0x65')]['id']}})['then'](handleEntityNotFound(_0x5d782a,null))[_0x5bef('0x10')](function(_0xd6d282){if(_0xd6d282){return _0xd6d282[_0x5bef('0x68')](_0xc2913f[_0x5bef('0x47')][_0x5bef('0x69')]);}})['then'](respondWithStatusCode(_0x5d782a,null))[_0x5bef('0x18')](handleError(_0x5d782a,null));};exports[_0x5bef('0x6a')]=function(_0x1b7535,_0x4d37d0){if(_0x1b7535['body']['id']){delete _0x1b7535[_0x5bef('0x5b')]['id'];}return db['MailAccount'][_0x5bef('0x5a')]({'where':{'id':_0x1b7535['params']['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x4d37d0,null))[_0x5bef('0x10')](function(_0x510dcb){if(_0x510dcb){_0x1b7535['body'][_0x5bef('0x61')]=_0x510dcb['id'];return db['CannedAnswer'][_0x5bef('0x6b')](_0x1b7535['body']);}})['then'](respondWithResult(_0x4d37d0,null))['catch'](handleError(_0x4d37d0,null));};exports[_0x5bef('0x6c')]=function(_0x2688e9,_0x1a4b76){var _0x23a7dc={'raw':![],'where':{}};var _0x1c2022={};var _0x58b9c6={'count':0x0,'rows':[]};return db['MailAccount'][_0x5bef('0x64')]({'where':{'id':_0x2688e9['params']['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x1a4b76,null))[_0x5bef('0x10')](function(_0x2edf9d){if(_0x2edf9d){_0x1c2022['model']=_[_0x5bef('0x46')](db[_0x5bef('0x6d')][_0x5bef('0x42')]);_0x1c2022[_0x5bef('0x47')]=_['keys'](_0x2688e9[_0x5bef('0x47')]);_0x1c2022['filters']=_[_0x5bef('0x49')](_0x1c2022['model'],_0x1c2022['query']);_0x23a7dc[_0x5bef('0x4a')]=_[_0x5bef('0x49')](_0x1c2022['model'],qs[_0x5bef('0x4b')](_0x2688e9[_0x5bef('0x47')][_0x5bef('0x4b')]));_0x23a7dc[_0x5bef('0x4a')]=_0x23a7dc[_0x5bef('0x4a')][_0x5bef('0x4c')]?_0x23a7dc[_0x5bef('0x4a')]:_0x1c2022[_0x5bef('0x45')];if(!_0x2688e9['query']['hasOwnProperty']('nolimit')){_0x23a7dc[_0x5bef('0x1f')]=qs[_0x5bef('0x1f')](_0x2688e9[_0x5bef('0x47')][_0x5bef('0x1f')]);_0x23a7dc[_0x5bef('0x1c')]=qs[_0x5bef('0x1c')](_0x2688e9[_0x5bef('0x47')][_0x5bef('0x1c')]);}_0x23a7dc['order']=qs[_0x5bef('0x4f')](_0x2688e9[_0x5bef('0x47')]['sort']);_0x23a7dc[_0x5bef('0x53')]=qs[_0x5bef('0x48')](_['pick'](_0x2688e9[_0x5bef('0x47')],_0x1c2022['filters']));_0x23a7dc[_0x5bef('0x53')][_0x5bef('0x61')]=_0x2edf9d['id'];if(_0x2688e9[_0x5bef('0x47')][_0x5bef('0x51')]){_0x23a7dc[_0x5bef('0x53')]=_[_0x5bef('0x52')](_0x23a7dc[_0x5bef('0x53')],{'$or':_['map'](_0x23a7dc[_0x5bef('0x4a')],function(_0x5f126b){var _0x3cc0c0={};_0x3cc0c0[_0x5f126b]={'$like':'%'+_0x2688e9['query'][_0x5bef('0x51')]+'%'};return _0x3cc0c0;})});}_0x23a7dc=_[_0x5bef('0x52')]({},_0x23a7dc,_0x2688e9['options']);return db[_0x5bef('0x6d')][_0x5bef('0x1e')]({'where':_0x23a7dc[_0x5bef('0x53')]})[_0x5bef('0x10')](function(_0x20af63){_0x58b9c6['count']=_0x20af63;if(_0x2688e9[_0x5bef('0x47')][_0x5bef('0x56')]){_0x23a7dc[_0x5bef('0x57')]=[{'all':!![]}];}return db[_0x5bef('0x6d')][_0x5bef('0x58')](_0x23a7dc);})[_0x5bef('0x10')](function(_0x5bd67a){_0x58b9c6[_0x5bef('0x67')]=_0x5bd67a;return _0x58b9c6;});}})[_0x5bef('0x10')](respondWithFilteredResult(_0x1a4b76,_0x23a7dc))['catch'](handleError(_0x1a4b76,null));};exports[_0x5bef('0x6e')]=function(_0x44cdd6,_0xfceb98){return db[_0x5bef('0x41')][_0x5bef('0x5a')]({'where':{'id':_0x44cdd6[_0x5bef('0x65')]['id']}})['then'](handleEntityNotFound(_0xfceb98,null))[_0x5bef('0x10')](function(_0x14c75d){if(_0x14c75d){return _0x14c75d[_0x5bef('0x6e')](_0x44cdd6[_0x5bef('0x47')][_0x5bef('0x69')]);}})[_0x5bef('0x10')](respondWithStatusCode(_0xfceb98,null))['catch'](handleError(_0xfceb98,null));};exports['create']=function(_0x3f0660,_0x367f74){var _0x57e020={'name':_0x3f0660[_0x5bef('0x5b')][_0x5bef('0x27')],'key':_0x3f0660[_0x5bef('0x5b')]['key'],'provider':_0x3f0660['body'][_0x5bef('0x5c')]==='custom'?null:_0x3f0660[_0x5bef('0x5b')][_0x5bef('0x5c')],'email':_0x3f0660[_0x5bef('0x5b')]['email'],'ListId':_0x3f0660[_0x5bef('0x5b')][_0x5bef('0x6f')],'active':!_['isNil'](_0x3f0660[_0x5bef('0x5b')][_0x5bef('0x70')])?_0x3f0660[_0x5bef('0x5b')][_0x5bef('0x70')]:!![],'description':_0x3f0660[_0x5bef('0x5b')][_0x5bef('0x71')]||null};var _0x4abbdc=getAuthenticationOptions(_0x57e020['provider'],_0x3f0660[_0x5bef('0x5b')]);_0x57e020[_0x5bef('0x3c')]=_0x4abbdc[_0x5bef('0x3c')];_0x57e020['Smtp']=_0x4abbdc[_0x5bef('0x3d')];return db[_0x5bef('0x41')][_0x5bef('0x6b')](_0x57e020,{'include':[{'model':db[_0x5bef('0x3e')],'as':_0x5bef('0x3d')},{'model':db[_0x5bef('0x5e')],'as':_0x5bef('0x3c')}]})[_0x5bef('0x10')](function(_0x52f2f9){var _0x4715d3=_0x3f0660[_0x5bef('0x32')]['get']({'plain':!![]});if(!_0x4715d3)throw new Error(_0x5bef('0x72'));if(_0x4715d3[_0x5bef('0x73')]===_0x5bef('0x32')){var _0xa8b0cf=_0x52f2f9[_0x5bef('0x24')]({'plain':!![]});return db[_0x5bef('0x74')]['find']({'where':{'name':_0x5bef('0x75'),'userProfileId':_0x4715d3['userProfileId']},'raw':!![]})[_0x5bef('0x10')](function(_0x566b22){if(_0x566b22&&_0x566b22['autoAssociation']===0x0){return db['UserProfileResource'][_0x5bef('0x6b')]({'name':_0xa8b0cf[_0x5bef('0x27')],'resourceId':_0xa8b0cf['id'],'type':_0x566b22[_0x5bef('0x27')],'sectionId':_0x566b22['id']},{})[_0x5bef('0x10')](function(){return _0x52f2f9;});}else{return _0x52f2f9;}})[_0x5bef('0x18')](function(_0x582b64){logger[_0x5bef('0x16')](_0x5bef('0x76'),_0x582b64);throw _0x582b64;});}return _0x52f2f9;})['then'](respondWithResult(_0x367f74,0xc9))['catch'](handleError(_0x367f74,null));};exports['getImap']=function(_0x112635,_0x28c1fe){return db['MailAccount'][_0x5bef('0x64')]({'where':{'id':_0x112635[_0x5bef('0x65')]['id']}})['then'](handleEntityNotFound(_0x28c1fe,null))[_0x5bef('0x10')](function(_0x1cae22){if(_0x1cae22){return _0x1cae22[_0x5bef('0x77')]();}return null;})[_0x5bef('0x10')](respondWithResult(_0x28c1fe,null))[_0x5bef('0x18')](handleError(_0x28c1fe,null));};exports[_0x5bef('0x78')]=function(_0x297483,_0x345180){if(_0x297483[_0x5bef('0x5b')]['id']){delete _0x297483[_0x5bef('0x5b')]['id'];}return db['MailAccount'][_0x5bef('0x5a')]({'where':{'id':_0x297483['params']['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x345180,null))[_0x5bef('0x10')](function(_0x105a6a){if(_0x105a6a){_0x297483[_0x5bef('0x5b')][_0x5bef('0x61')]=_0x105a6a['id'];return db['MailServerIn'][_0x5bef('0x6b')](_0x297483[_0x5bef('0x5b')]);}})[_0x5bef('0x10')](respondWithResult(_0x345180,null))[_0x5bef('0x18')](handleError(_0x345180,null));};exports[_0x5bef('0x79')]=function(_0xac11a0,_0x221020){return db[_0x5bef('0x41')]['findOne']({'where':{'id':_0xac11a0['params']['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x221020,null))['then'](function(_0x5477b9){if(_0x5477b9){return _0x5477b9[_0x5bef('0x7a')](null);}return null;})['then'](respondWithStatusCode(_0x221020,null))['catch'](handleError(_0x221020,null));};exports[_0x5bef('0x7b')]=function(_0x53af42,_0x526331){return db['MailAccount'][_0x5bef('0x64')]({'where':{'id':_0x53af42[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x526331,null))[_0x5bef('0x10')](function(_0xb2e1bc){if(_0xb2e1bc){return _0xb2e1bc[_0x5bef('0x7b')]();}return null;})[_0x5bef('0x10')](respondWithResult(_0x526331,null))[_0x5bef('0x18')](handleError(_0x526331,null));};exports[_0x5bef('0x7c')]=function(_0x4bf626,_0x107695){if(_0x4bf626[_0x5bef('0x5b')]['id']){delete _0x4bf626[_0x5bef('0x5b')]['id'];}return db[_0x5bef('0x41')][_0x5bef('0x5a')]({'where':{'id':_0x4bf626[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x107695,null))[_0x5bef('0x10')](function(_0x5e8340){if(_0x5e8340){_0x4bf626[_0x5bef('0x5b')]['MailAccountId']=_0x5e8340['id'];return db['MailServerOut']['create'](_0x4bf626[_0x5bef('0x5b')]);}})['then'](respondWithResult(_0x107695,null))[_0x5bef('0x18')](handleError(_0x107695,null));};exports[_0x5bef('0x7d')]=function(_0x35dc88,_0xed434){return db['MailAccount'][_0x5bef('0x64')]({'where':{'id':_0x35dc88['params']['id']}})['then'](handleEntityNotFound(_0xed434,null))[_0x5bef('0x10')](function(_0xd0a56c){if(_0xd0a56c){return _0xd0a56c[_0x5bef('0x7e')](null);}return null;})[_0x5bef('0x10')](respondWithStatusCode(_0xed434,null))[_0x5bef('0x18')](handleError(_0xed434,null));};exports['addInteraction']=function(_0x5cb1f4,_0x21aca3){return db[_0x5bef('0x7f')][_0x5bef('0x5a')]({'where':{'id':_0x5cb1f4[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x21aca3,null))['then'](function(_0x875bce){if(_0x875bce){return _0x875bce[_0x5bef('0x80')](_0x5cb1f4[_0x5bef('0x5b')]['ids'],_[_0x5bef('0x81')](_0x5cb1f4['body'],['ids','id'])||{});}})[_0x5bef('0x10')](respondWithResult(_0x21aca3,null))[_0x5bef('0x18')](handleError(_0x21aca3,null));};exports['getInteractions']=function(_0x55e4ff,_0x5eafbc){var _0x3fb4d9={'raw':![],'where':{}};var _0x4e9172={};var _0x217a31={'count':0x0,'rows':[]};return db[_0x5bef('0x41')][_0x5bef('0x64')]({'where':{'id':_0x55e4ff['params']['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x5eafbc,null))[_0x5bef('0x10')](function(_0x3aa23e){if(_0x3aa23e){_0x4e9172[_0x5bef('0x45')]=_['keys'](db[_0x5bef('0x7f')][_0x5bef('0x42')]);_0x4e9172['query']=_['keys'](_0x55e4ff['query']);_0x4e9172['filters']=_[_0x5bef('0x49')](_0x4e9172[_0x5bef('0x45')],_0x4e9172['query']);_0x3fb4d9['attributes']=_[_0x5bef('0x49')](_0x4e9172[_0x5bef('0x45')],qs[_0x5bef('0x4b')](_0x55e4ff['query'][_0x5bef('0x4b')]));_0x3fb4d9['attributes']=_0x3fb4d9['attributes'][_0x5bef('0x4c')]?_0x3fb4d9['attributes']:_0x4e9172[_0x5bef('0x45')];if(!_0x55e4ff[_0x5bef('0x47')][_0x5bef('0x66')](_0x5bef('0x4d'))){_0x3fb4d9[_0x5bef('0x1f')]=qs[_0x5bef('0x1f')](_0x55e4ff['query']['limit']);_0x3fb4d9['offset']=qs[_0x5bef('0x1c')](_0x55e4ff[_0x5bef('0x47')][_0x5bef('0x1c')]);}_0x3fb4d9[_0x5bef('0x4e')]=qs[_0x5bef('0x4f')](_0x55e4ff[_0x5bef('0x47')][_0x5bef('0x4f')]);_0x3fb4d9[_0x5bef('0x53')]=qs[_0x5bef('0x48')](_[_0x5bef('0x50')](_0x55e4ff[_0x5bef('0x47')],_0x4e9172[_0x5bef('0x48')]));_0x3fb4d9[_0x5bef('0x53')][_0x5bef('0x61')]=_0x3aa23e['id'];if(_0x55e4ff['query'][_0x5bef('0x51')]){_0x3fb4d9[_0x5bef('0x53')]=_[_0x5bef('0x52')](_0x3fb4d9['where'],{'$or':_[_0x5bef('0x40')](_0x3fb4d9['attributes'],function(_0x5ad8da){var _0x2c3c32={};_0x2c3c32[_0x5ad8da]={'$like':'%'+_0x55e4ff['query'][_0x5bef('0x51')]+'%'};return _0x2c3c32;})});}_0x3fb4d9=_['merge']({},_0x3fb4d9,_0x55e4ff[_0x5bef('0x55')]);return db[_0x5bef('0x7f')][_0x5bef('0x1e')]({'where':_0x3fb4d9[_0x5bef('0x53')]})[_0x5bef('0x10')](function(_0x4dddee){_0x217a31[_0x5bef('0x1e')]=_0x4dddee;if(_0x55e4ff['query']['includeAll']){_0x3fb4d9[_0x5bef('0x57')]=[{'model':db[_0x5bef('0x82')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x5bef('0x83'),'attributes':[_0x5bef('0x27'),_0x5bef('0x84'),_0x5bef('0x85')],'required':![]},{'model':db[_0x5bef('0x86')],'as':_0x5bef('0x87'),'attributes':['id',_0x5bef('0x27'),_0x5bef('0x88')],'where':_0x55e4ff[_0x5bef('0x47')]['tag']?{'id':_0x55e4ff[_0x5bef('0x47')][_0x5bef('0x89')]}:undefined,'required':_0x55e4ff[_0x5bef('0x47')]['tag']?!![]:![]}];}return db[_0x5bef('0x7f')][_0x5bef('0x58')](_0x3fb4d9);})[_0x5bef('0x10')](function(_0x1f7561){_0x217a31[_0x5bef('0x67')]=_0x1f7561;return _0x217a31;});}})['then'](respondWithFilteredResult(_0x5eafbc,_0x3fb4d9))[_0x5bef('0x18')](handleError(_0x5eafbc,null));};exports['addApplications']=function addApplications(_0x4569bd,_0x4782d8){var _0x138c24=_0x4569bd[_0x5bef('0x65')]['id'];var _0x2bfcd0=_0x4569bd[_0x5bef('0x5b')];var _0x215414=0xc8;var _0x9b8273=null;return db['sequelize'][_0x5bef('0x8a')]({'isolationLevel':db[_0x5bef('0x8b')][_0x5bef('0x8c')][_0x5bef('0x8d')]['READ_COMMITTED']},function(_0x390a21){return db[_0x5bef('0x41')]['findOne']({'where':{'id':_0x138c24},'transaction':_0x390a21})[_0x5bef('0x10')](function(_0x391b2){if(_0x391b2){return db[_0x5bef('0x8e')]['destroy']({'where':{'MailAccountId':_0x138c24},'transaction':_0x390a21})[_0x5bef('0x10')](function(){var _0x25a09d=_['map'](_0x2bfcd0,function(_0x3a0dbb){_0x3a0dbb['MailAccountId']=_0x138c24;return _0x3a0dbb;});return db[_0x5bef('0x8e')]['bulkCreate'](_0x25a09d,{'transaction':_0x390a21});});}else{_0x215414=0x194;_0x9b8273=[];}});})[_0x5bef('0x10')](function(){if(_0x215414!==0x194){return db[_0x5bef('0x8e')][_0x5bef('0x8f')]({'where':{'MailAccountId':_0x138c24},'order':'priority'})[_0x5bef('0x10')](function(_0x29deb1){_0x9b8273=_0x29deb1;});}})[_0x5bef('0x18')](function(_0x347a71){_0x215414=0x1f4;logger['error'](_0x347a71['stack']);if(_0x347a71['name']){delete _0x347a71[_0x5bef('0x27')];}_0x9b8273=_0x347a71;})[_0x5bef('0x90')](function(){if(_0x9b8273===null){_0x4782d8[_0x5bef('0x26')](_0x215414);}else{if(_0x215414===0x1f4){_0x4782d8[_0x5bef('0x19')](_0x215414)[_0x5bef('0x91')](_0x9b8273);}else{_0x4782d8['status'](_0x215414)[_0x5bef('0x1b')](_0x9b8273);}}});};exports['getApplications']=function(_0x42e464,_0x524134){var _0x1d7ac5={};var _0x358f8c={};var _0x4031f6;var _0xe209d2;return db[_0x5bef('0x41')][_0x5bef('0x64')]({'where':{'id':_0x42e464['params']['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x524134,null))[_0x5bef('0x10')](function(_0x251b1b){if(_0x251b1b){_0x4031f6=_0x251b1b;_0x358f8c[_0x5bef('0x45')]=_[_0x5bef('0x46')](db['MailApplication'][_0x5bef('0x42')]);_0x358f8c[_0x5bef('0x47')]=_[_0x5bef('0x46')](_0x42e464[_0x5bef('0x47')]);_0x358f8c['filters']=_[_0x5bef('0x49')](_0x358f8c[_0x5bef('0x45')],_0x358f8c[_0x5bef('0x47')]);_0x1d7ac5[_0x5bef('0x4a')]=_[_0x5bef('0x49')](_0x358f8c[_0x5bef('0x45')],qs[_0x5bef('0x4b')](_0x42e464['query'][_0x5bef('0x4b')]));_0x1d7ac5[_0x5bef('0x4a')]=_0x1d7ac5[_0x5bef('0x4a')][_0x5bef('0x4c')]?_0x1d7ac5[_0x5bef('0x4a')]:_0x358f8c[_0x5bef('0x45')];_0x1d7ac5[_0x5bef('0x4e')]=qs[_0x5bef('0x4f')](_0x42e464[_0x5bef('0x47')]['sort']);_0x1d7ac5[_0x5bef('0x53')]=qs['filters'](_[_0x5bef('0x50')](_0x42e464[_0x5bef('0x47')],_0x358f8c[_0x5bef('0x48')]));if(_0x42e464['query'][_0x5bef('0x51')]){_0x1d7ac5['where']=_['merge'](_0x1d7ac5[_0x5bef('0x53')],{'$or':_[_0x5bef('0x40')](_0x1d7ac5[_0x5bef('0x4a')],function(_0x3b9832){var _0x1cb860={};_0x1cb860[_0x3b9832]={'$like':'%'+_0x42e464[_0x5bef('0x47')][_0x5bef('0x51')]+'%'};return _0x1cb860;})});}_0x1d7ac5=_[_0x5bef('0x52')]({},_0x1d7ac5,_0x42e464['options']);return _0x4031f6[_0x5bef('0x92')](_0x1d7ac5);}})[_0x5bef('0x10')](function(_0x4d3bf3){if(_0x4d3bf3){_0xe209d2=_0x4d3bf3[_0x5bef('0x4c')];if(!_0x42e464[_0x5bef('0x47')][_0x5bef('0x66')](_0x5bef('0x4d'))){_0x1d7ac5['limit']=qs['limit'](_0x42e464[_0x5bef('0x47')]['limit']);_0x1d7ac5[_0x5bef('0x1c')]=qs['offset'](_0x42e464[_0x5bef('0x47')][_0x5bef('0x1c')]);}return _0x4031f6[_0x5bef('0x92')](_0x1d7ac5);}})['then'](function(_0x1211dd){if(_0x1211dd){return _0x1211dd?{'count':_0xe209d2,'rows':_0x1211dd}:null;}})[_0x5bef('0x10')](respondWithResult(_0x524134,null))[_0x5bef('0x18')](handleError(_0x524134,null));};exports[_0x5bef('0x93')]=function(_0x1f4916,_0x5609be){var _0x187420={'raw':!![],'where':{}};var _0x1f75c5={};var _0x184da3={'count':0x0,'rows':[]};return db[_0x5bef('0x41')][_0x5bef('0x64')]({'where':{'id':_0x1f4916[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0x5609be,null))['then'](function(_0x1aeb12){if(_0x1aeb12){_0x1f75c5[_0x5bef('0x45')]=_[_0x5bef('0x46')](db[_0x5bef('0x94')][_0x5bef('0x42')]);_0x1f75c5[_0x5bef('0x47')]=_[_0x5bef('0x46')](_0x1f4916[_0x5bef('0x47')]);_0x1f75c5[_0x5bef('0x48')]=_[_0x5bef('0x49')](_0x1f75c5[_0x5bef('0x45')],_0x1f75c5[_0x5bef('0x47')]);_0x187420[_0x5bef('0x4a')]=_['intersection'](_0x1f75c5[_0x5bef('0x45')],qs[_0x5bef('0x4b')](_0x1f4916[_0x5bef('0x47')][_0x5bef('0x4b')]));_0x187420['attributes']=_0x187420[_0x5bef('0x4a')][_0x5bef('0x4c')]?_0x187420[_0x5bef('0x4a')]:_0x1f75c5[_0x5bef('0x45')];if(!_0x1f4916[_0x5bef('0x47')][_0x5bef('0x66')]('nolimit')){_0x187420[_0x5bef('0x1f')]=qs['limit'](_0x1f4916[_0x5bef('0x47')]['limit']);_0x187420[_0x5bef('0x1c')]=qs[_0x5bef('0x1c')](_0x1f4916[_0x5bef('0x47')][_0x5bef('0x1c')]);}_0x187420[_0x5bef('0x4e')]=qs[_0x5bef('0x4f')](_0x1f4916[_0x5bef('0x47')][_0x5bef('0x4f')]);_0x187420[_0x5bef('0x53')]=qs[_0x5bef('0x48')](_[_0x5bef('0x50')](_0x1f4916[_0x5bef('0x47')],_0x1f75c5[_0x5bef('0x48')]));_0x187420['where'][_0x5bef('0x61')]=_0x1aeb12['id'];if(_0x1f4916[_0x5bef('0x47')]['filter']){_0x187420[_0x5bef('0x53')]=_[_0x5bef('0x52')](_0x187420['where'],{'$or':_[_0x5bef('0x40')](_0x187420[_0x5bef('0x4a')],function(_0x1800f6){var _0x59efa8={};_0x59efa8[_0x1800f6]={'$like':'%'+_0x1f4916['query'][_0x5bef('0x51')]+'%'};return _0x59efa8;})});}if(_0x1f4916[_0x5bef('0x47')][_0x5bef('0x95')]){var _0x48110b=_0x1f4916['query'][_0x5bef('0x95')][_0x5bef('0x96')](',');var _0x4201c3={};_0x4201c3[_0x48110b[0x0]]={'$gte':moment(_0x48110b[0x1])[_0x5bef('0x97')]('YYYY-MM-DD\x20HH:mm:ss')};_0x187420[_0x5bef('0x53')]=_[_0x5bef('0x52')](_0x187420[_0x5bef('0x53')],_0x4201c3);}_0x187420=_['merge']({},_0x187420,_0x1f4916['options']);return db[_0x5bef('0x94')][_0x5bef('0x1e')]({'where':_0x187420[_0x5bef('0x53')]})[_0x5bef('0x10')](function(_0x11bab4){_0x184da3[_0x5bef('0x1e')]=_0x11bab4;if(_0x1f4916[_0x5bef('0x47')][_0x5bef('0x56')]){_0x187420[_0x5bef('0x57')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x187420);})[_0x5bef('0x10')](function(_0x5dc447){if(_0x1f4916['query']['inlineCss']===_0x5bef('0x98')){for(var _0x2179e1=0x0;_0x2179e1<_0x5dc447['length'];_0x2179e1++){_0x5dc447[_0x2179e1][_0x5bef('0x5b')]=juice(_0x5dc447[_0x2179e1][_0x5bef('0x5b')]);}}_0x184da3[_0x5bef('0x67')]=_0x5dc447;return _0x184da3;});}})[_0x5bef('0x10')](respondWithFilteredResult(_0x5609be,_0x187420))[_0x5bef('0x18')](handleError(_0x5609be,null));};exports[_0x5bef('0x91')]=function(_0x40e835,_0x43912c){var _0x21186e,_0x11daf0={},_0x5d9aad;if(_0x40e835[_0x5bef('0x5b')]['to']){_0x5d9aad=_0x40e835['body']['to'][_0x5bef('0x96')](',')[0x0];}return db[_0x5bef('0x41')][_0x5bef('0x5a')]({'where':{'id':_0x40e835[_0x5bef('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x5bef('0x99'),'include':[{'model':db[_0x5bef('0x82')],'as':_0x5bef('0x9a'),'where':{'email':_0x5d9aad},'limit':0x1,'order':[[_0x5bef('0x9b'),_0x5bef('0x9c')]]}]},{'model':db['MailServerOut'],'as':_0x5bef('0x3d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5bef('0x9d'),'raw':!![]}]}]})[_0x5bef('0x10')](handleEntityNotFound(_0x43912c,null))[_0x5bef('0x10')](function(_0x351be9){if(!_0x351be9)return;_0x21186e=_0x351be9;if(!_0x351be9[_0x5bef('0x3d')])throw new Error(_0x5bef('0x9e'));if(_[_0x5bef('0x9f')](_0x40e835['body'][_0x5bef('0xa0')])){_0x40e835[_0x5bef('0x5b')]['from']=util['format'](_0x5bef('0xa1'),_0x351be9['name'],_0x351be9['email']||_0x351be9[_0x5bef('0x3d')][_0x5bef('0x32')]);}if(_0x40e835[_0x5bef('0x5b')][_0x5bef('0xa2')]&&_0x40e835['body']['attachments']['length']){for(var _0x3b859b=0x0;_0x3b859b<_0x40e835[_0x5bef('0x5b')][_0x5bef('0xa2')][_0x5bef('0x4c')];_0x3b859b+=0x1){_0x40e835[_0x5bef('0x5b')][_0x5bef('0xa2')][_0x3b859b]={'filename':_0x40e835[_0x5bef('0x5b')][_0x5bef('0xa2')][_0x3b859b][_0x5bef('0x27')],'path':path[_0x5bef('0xa3')](config[_0x5bef('0xa4')],_0x5bef('0xa5'),_0x40e835['body'][_0x5bef('0xa2')][_0x3b859b][_0x5bef('0xa6')])};}}var _0x4e9732=_0x351be9[_0x5bef('0xa7')]();return respondWithRpcPromise('SendMail',_0x5bef('0xa8'),{'account':_0x4e9732,'message':_0x40e835[_0x5bef('0x5b')]});})[_0x5bef('0x10')](function(_0x255665){if(!_0x255665)return;_0x11daf0=_0x255665;if(!_0x21186e[_0x5bef('0x99')])throw new Error(_0x5bef('0xa9'));if(_0x21186e[_0x5bef('0x99')][_0x5bef('0x9a')][_0x5bef('0x4c')])return _0x21186e[_0x5bef('0x99')]['Contacts'][0x0];return db[_0x5bef('0x82')]['create'](_[_0x5bef('0x9')](_0x40e835['body'],{'firstName':_0x40e835[_0x5bef('0x5b')]['to'],'email':_0x40e835[_0x5bef('0x5b')]['to'],'phone':_0x40e835[_0x5bef('0x5b')]['to'],'ListId':_0x21186e[_0x5bef('0x6f')]}));})[_0x5bef('0x10')](function(_0x344d68){if(!_0x344d68)return;var _0x430bf2={'UserId':_0x40e835[_0x5bef('0x32')]['id'],'ContactId':_0x344d68['id'],'MailAccountId':_0x21186e['id'],'inReplyTo':_0x11daf0[_0x5bef('0xaa')],'to':_0x40e835['body']['from'],'cc':_0x40e835[_0x5bef('0x5b')]['cc'],'subject':_0x40e835[_0x5bef('0x5b')][_0x5bef('0xab')],'attach':_0x40e835[_0x5bef('0x5b')][_0x5bef('0xac')],'firstMsgDirection':_0x5bef('0xad'),'lastMsgAt':moment()[_0x5bef('0x97')](_0x5bef('0xae')),'lastMsgDirection':'out','Messages':[_[_0x5bef('0x52')](_0x40e835[_0x5bef('0x5b')],{'messageId':_0x11daf0[_0x5bef('0xaa')],'sentAt':moment()[_0x5bef('0x97')](_0x5bef('0xae')),'read':!![],'MailAccountId':_0x21186e['id'],'UserId':_0x40e835['user']['id'],'ContactId':_0x344d68['id']})]};if(_0x40e835[_0x5bef('0x5b')]['Interaction']){_0x430bf2=_['merge'](_0x430bf2,_0x40e835['body'][_0x5bef('0xaf')]);}return db[_0x5bef('0x7f')][_0x5bef('0x6b')](_0x430bf2,{'include':[{'model':db['MailMessage'],'as':_0x5bef('0xb0')}]});})[_0x5bef('0x10')](respondWithResult(_0x43912c,null))[_0x5bef('0x18')](handleError(_0x43912c,null));};exports[_0x5bef('0xb1')]=function(_0xfb1c2d,_0x22b02e){return db[_0x5bef('0x41')][_0x5bef('0x5a')]({'where':{'id':_0xfb1c2d[_0x5bef('0x65')]['id']},'include':[{'model':db[_0x5bef('0x3e')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5bef('0x9d')],'as':_0x5bef('0x9d'),'raw':!![]}]}]})[_0x5bef('0x10')](handleEntityNotFound(_0x22b02e,null))[_0x5bef('0x10')](function(_0x164fa3){if(!_0x164fa3[_0x5bef('0x3d')])return;var _0x5aa6ea=_0x164fa3[_0x5bef('0xa7')]();return respondWithRpcPromise(_0x5bef('0xb2'),_0x5bef('0xb1'),{'account':_0x5aa6ea});})[_0x5bef('0x10')](respondWithResult(_0x22b02e,null))[_0x5bef('0x18')](handleError(_0x22b02e,null));};exports[_0x5bef('0x23')]=function(_0x1fda32,_0xb6eb53){return db[_0x5bef('0x41')]['find']({'where':{'id':_0x1fda32[_0x5bef('0x65')]['id']}})['then'](handleEntityNotFound(_0xb6eb53,null))[_0x5bef('0x10')](function(_0x1c0cfa){if(_0x1c0cfa&&_0x1c0cfa[_0x5bef('0xb3')]){throw new db[(_0x5bef('0xb4'))][(_0x5bef('0xb5'))](_0x5bef('0xb6'));}return _0x1c0cfa;})[_0x5bef('0x10')](removeEntity(_0xb6eb53,null))[_0x5bef('0x18')](handleError(_0xb6eb53,null));};exports[_0x5bef('0xb7')]=function(_0x505b68,_0xb0b51b){return db[_0x5bef('0x41')][_0x5bef('0x5a')]({'where':{'id':_0x505b68[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0xb0b51b,null))[_0x5bef('0x10')](function(_0x213df9){if(_0x213df9){return _0x213df9['addAgents'](_0x505b68['body'][_0x5bef('0x69')],_[_0x5bef('0x81')](_0x505b68[_0x5bef('0x5b')],['ids','id'])||{})[_0x5bef('0xb8')](function(_0x3096fe){for(var _0x52d4a8=0x0;_0x52d4a8<_0x505b68['body'][_0x5bef('0x69')][_0x5bef('0x4c')];_0x52d4a8+=0x1){socket[_0x5bef('0xb9')](_0x5bef('0xba'),{'UserId':Number(_0x505b68['body'][_0x5bef('0x69')][_0x52d4a8]),'MailAccountId':Number(_0x505b68[_0x5bef('0x65')]['id'])});}return _0x3096fe;});}})[_0x5bef('0x10')](respondWithResult(_0xb0b51b,null))['catch'](handleError(_0xb0b51b,null));};exports[_0x5bef('0xbb')]=function(_0x2f8a42,_0xf6c94e){return db['MailAccount'][_0x5bef('0x5a')]({'where':{'id':_0x2f8a42[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0xf6c94e,null))['then'](function(_0x111695){if(_0x111695){return _0x111695[_0x5bef('0xbb')](_0x2f8a42['query'][_0x5bef('0x69')])[_0x5bef('0x10')](function(){if(_[_0x5bef('0xbc')](_0x2f8a42['query'][_0x5bef('0x69')])){for(var _0x15b75a=0x0;_0x15b75a<_0x2f8a42[_0x5bef('0x47')][_0x5bef('0x69')]['length'];_0x15b75a+=0x1){socket[_0x5bef('0xb9')](_0x5bef('0xbd'),{'UserId':Number(_0x2f8a42['query'][_0x5bef('0x69')][_0x15b75a]),'MailAccountId':Number(_0x2f8a42[_0x5bef('0x65')]['id'])});}}else{socket['emit'](_0x5bef('0xbd'),{'UserId':Number(_0x2f8a42[_0x5bef('0x47')][_0x5bef('0x69')]),'MailAccountId':Number(_0x2f8a42[_0x5bef('0x65')]['id'])});}});}})[_0x5bef('0x10')](respondWithStatusCode(_0xf6c94e,null))[_0x5bef('0x18')](handleError(_0xf6c94e,null));};exports[_0x5bef('0xbe')]=function(_0xacf7d6,_0xbc93b3){var _0xc77c59={};var _0x2f4405={};var _0x44e4d4;var _0x20f435;return db[_0x5bef('0x41')]['findOne']({'where':{'id':_0xacf7d6[_0x5bef('0x65')]['id']}})[_0x5bef('0x10')](handleEntityNotFound(_0xbc93b3,null))['then'](function(_0x24021b){if(_0x24021b){_0x44e4d4=_0x24021b;_0x2f4405[_0x5bef('0x45')]=_['keys'](db[_0x5bef('0xbf')][_0x5bef('0x42')]);_0x2f4405[_0x5bef('0x47')]=_['keys'](_0xacf7d6[_0x5bef('0x47')]);_0x2f4405[_0x5bef('0x48')]=_[_0x5bef('0x49')](_0x2f4405[_0x5bef('0x45')],_0x2f4405['query']);_0xc77c59['attributes']=_['intersection'](_0x2f4405['model'],qs[_0x5bef('0x4b')](_0xacf7d6[_0x5bef('0x47')][_0x5bef('0x4b')]));_0xc77c59[_0x5bef('0x4a')]=_0xc77c59['attributes'][_0x5bef('0x4c')]?_0xc77c59['attributes']:_0x2f4405[_0x5bef('0x45')];_0xc77c59[_0x5bef('0x4e')]=qs[_0x5bef('0x4f')](_0xacf7d6[_0x5bef('0x47')]['sort']);_0xc77c59['where']=qs[_0x5bef('0x48')](_['pick'](_0xacf7d6[_0x5bef('0x47')],_0x2f4405['filters']));if(_0xacf7d6['query'][_0x5bef('0x51')]){_0xc77c59[_0x5bef('0x53')]=_['merge'](_0xc77c59[_0x5bef('0x53')],{'$or':_['map'](_0xc77c59[_0x5bef('0x4a')],function(_0x1152f4){var _0x58ec72={};_0x58ec72[_0x1152f4]={'$like':'%'+_0xacf7d6[_0x5bef('0x47')]['filter']+'%'};return _0x58ec72;})});}_0xc77c59=_['merge']({},_0xc77c59,_0xacf7d6[_0x5bef('0x55')]);return _0x44e4d4[_0x5bef('0xbe')](_0xc77c59);}})[_0x5bef('0x10')](function(_0x39bc78){if(_0x39bc78){_0x20f435=_0x39bc78[_0x5bef('0x4c')];if(!_0xacf7d6[_0x5bef('0x47')][_0x5bef('0x66')](_0x5bef('0x4d'))){_0xc77c59[_0x5bef('0x1f')]=qs[_0x5bef('0x1f')](_0xacf7d6[_0x5bef('0x47')][_0x5bef('0x1f')]);_0xc77c59['offset']=qs[_0x5bef('0x1c')](_0xacf7d6[_0x5bef('0x47')]['offset']);}return _0x44e4d4['getAgents'](_0xc77c59);}})[_0x5bef('0x10')](function(_0x256be3){if(_0x256be3){return _0x256be3?{'count':_0x20f435,'rows':_0x256be3}:null;}})[_0x5bef('0x10')](respondWithResult(_0xbc93b3,null))[_0x5bef('0x18')](handleError(_0xbc93b3,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index db53fe7..a4b562a 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 _0xbff5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x27e558,_0x42155b){var _0x190d65=function(_0x10eb3a){while(--_0x10eb3a){_0x27e558['push'](_0x27e558['shift']());}};_0x190d65(++_0x42155b);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2dbae3,_0x4df3b2){_0x2dbae3=_0x2dbae3-0x0;var _0x4a5471=_0xbff5[_0x2dbae3];return _0x4a5471;};'use strict';var EventEmitter=require(_0x5bff('0x0'));var MailAccount=require(_0x5bff('0x1'))['db'][_0x5bff('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5bff('0x3')](0x0);var events={'afterCreate':_0x5bff('0x4'),'afterUpdate':_0x5bff('0x5'),'afterDestroy':_0x5bff('0x6')};function emitEvent(_0x4dccf3){return function(_0x3868ae,_0x486083,_0x4c567d){MailAccountEvents[_0x5bff('0x7')](_0x4dccf3+':'+_0x3868ae['id'],_0x3868ae);MailAccountEvents[_0x5bff('0x7')](_0x4dccf3,_0x3868ae);_0x4c567d(null);};}for(var e in events){if(events[_0x5bff('0x8')](e)){var event=events[e];MailAccount[_0x5bff('0x9')](e,emitEvent(event));}}module[_0x5bff('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x4d4e=['remove','emit','events','MailAccount','setMaxListeners','update'];(function(_0x581c34,_0x2acdeb){var _0x278088=function(_0x20ee50){while(--_0x20ee50){_0x581c34['push'](_0x581c34['shift']());}};_0x278088(++_0x2acdeb);}(_0x4d4e,0xa4));var _0xe4d4=function(_0x5e3af6,_0x3c97dd){_0x5e3af6=_0x5e3af6-0x0;var _0x215aa8=_0x4d4e[_0x5e3af6];return _0x215aa8;};'use strict';var EventEmitter=require(_0xe4d4('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xe4d4('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe4d4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4d4('0x3'),'afterDestroy':_0xe4d4('0x4')};function emitEvent(_0x1fc0de){return function(_0x3ef1fe,_0x49cb69,_0x5e7f97){MailAccountEvents['emit'](_0x1fc0de+':'+_0x3ef1fe['id'],_0x3ef1fe);MailAccountEvents[_0xe4d4('0x5')](_0x1fc0de,_0x3ef1fe);_0x5e7f97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](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 12f8aee..96592da 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 _0xcf7a=['exports','MailAccount','custom','service','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass'];(function(_0xbb103c,_0x4b570a){var _0x3c75c0=function(_0x4285d9){while(--_0x4285d9){_0xbb103c['push'](_0xbb103c['shift']());}};_0x3c75c0(++_0x4b570a);}(_0xcf7a,0x132));var _0xacf7=function(_0x594801,_0x610323){_0x594801=_0x594801-0x0;var _0x5ce1db=_0xcf7a[_0x594801];return _0x5ce1db;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xacf7('0x0')]=function(_0x5111f4){return _0x5111f4['define'](_0xacf7('0x1'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x32ef1f=this;var _0xe33b2f={'id':_0x32ef1f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x32ef1f['provider']!==_0xacf7('0x2')){_0xe33b2f[_0xacf7('0x3')]=_0x32ef1f[_0xacf7('0x4')];}else{_0xe33b2f[_0xacf7('0x5')]=_0x32ef1f[_0xacf7('0x6')]['host'];_0xe33b2f['port']=_0x32ef1f[_0xacf7('0x6')][_0xacf7('0x7')];_0xe33b2f[_0xacf7('0x8')]=_0x32ef1f[_0xacf7('0x6')][_0xacf7('0x8')];}if(_0x32ef1f['Smtp'][_0xacf7('0x9')]){if(_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xa')]){if(!_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xb')])throw new Error(_0xacf7('0xc'));_0xe33b2f['auth']={'type':_0xacf7('0xd'),'user':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xe')],'accessToken':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xb')][_0xacf7('0xf')]};}else{_0xe33b2f[_0xacf7('0x10')]={'user':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0xe')],'pass':_0x32ef1f[_0xacf7('0x6')][_0xacf7('0x11')]};}}return _0xe33b2f;}}});}; \ No newline at end of file +var _0x24b2=['Smtp','port','authentication','modernAuthentication','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','provider','service','host'];(function(_0x282ed6,_0x1244f6){var _0x1f85ca=function(_0x2083b6){while(--_0x2083b6){_0x282ed6['push'](_0x282ed6['shift']());}};_0x1f85ca(++_0x1244f6);}(_0x24b2,0xea));var _0x224b=function(_0x1283a7,_0x40903a){_0x1283a7=_0x1283a7-0x0;var _0x3ff9a7=_0x24b2[_0x1283a7];return _0x3ff9a7;};'use strict';var attributes=require(_0x224b('0x0'));module[_0x224b('0x1')]=function(_0x5a43bd){return _0x5a43bd[_0x224b('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4719ed=this;var _0x38d88b={'id':_0x4719ed['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4719ed[_0x224b('0x3')]!=='custom'){_0x38d88b[_0x224b('0x4')]=_0x4719ed[_0x224b('0x3')];}else{_0x38d88b[_0x224b('0x5')]=_0x4719ed[_0x224b('0x6')][_0x224b('0x5')];_0x38d88b[_0x224b('0x7')]=_0x4719ed[_0x224b('0x6')]['port'];_0x38d88b['secure']=_0x4719ed[_0x224b('0x6')]['secure'];}if(_0x4719ed[_0x224b('0x6')][_0x224b('0x8')]){if(_0x4719ed[_0x224b('0x6')][_0x224b('0x9')]){if(!_0x4719ed['Smtp']['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x38d88b[_0x224b('0xa')]={'type':_0x224b('0xb'),'user':_0x4719ed[_0x224b('0x6')][_0x224b('0xc')],'accessToken':_0x4719ed[_0x224b('0x6')][_0x224b('0xd')][_0x224b('0xe')]};}else{_0x38d88b['auth']={'user':_0x4719ed[_0x224b('0x6')][_0x224b('0xc')],'pass':_0x4719ed[_0x224b('0x6')][_0x224b('0xf')]};}}return _0x38d88b;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f63702a..e6531b3 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 _0x5d17=['list','applications','orderBy','priority','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','interaction','get','created','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','agent','name','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','limit','include','model','map','stringify','ShowMailAccount','find','raw','where','attributes','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','MailApplication','Applications','CloudProvider','account','omit'];(function(_0x54575b,_0x1e4356){var _0x2aa5be=function(_0x318996){while(--_0x318996){_0x54575b['push'](_0x54575b['shift']());}};_0x2aa5be(++_0x1e4356);}(_0x5d17,0x114));var _0x75d1=function(_0x5f4abc,_0x1692ac){_0x5f4abc=_0x5f4abc-0x0;var _0x3c29a6=_0x5d17[_0x5f4abc];return _0x3c29a6;};'use strict';var _=require(_0x75d1('0x0'));var moment=require(_0x75d1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x75d1('0x2'));var db=require(_0x75d1('0x3'))['db'];var logger=require(_0x75d1('0x4'))('rpc');var config=require(_0x75d1('0x5'));var jayson=require(_0x75d1('0x6'));var client=jayson[_0x75d1('0x7')][_0x75d1('0x8')]({'port':0x232c});config['redis']=_[_0x75d1('0x9')](config[_0x75d1('0xa')],{'host':_0x75d1('0xb'),'port':0x18eb});var socket=require(_0x75d1('0xc'))(new Redis(config[_0x75d1('0xa')]));require(_0x75d1('0xd'))[_0x75d1('0xe')](socket);function respondWithRpcPromise(_0x5acfa0,_0x4cf632,_0x40df40){return new BPromise(function(_0x4a3bb3,_0x57be31){return client[_0x75d1('0xf')](_0x5acfa0,_0x40df40)[_0x75d1('0x10')](function(_0x4d4aa1){logger[_0x75d1('0x11')](_0x75d1('0x12'),_0x4cf632,_0x75d1('0x13'));logger[_0x75d1('0x14')](_0x75d1('0x15'),_0x4cf632,_0x75d1('0x13'),JSON['stringify'](_0x4d4aa1));if(_0x4d4aa1[_0x75d1('0x16')]){if(_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x17')]===0x1f4){logger[_0x75d1('0x16')]('MailAccount,\x20%s,\x20%s',_0x4cf632,_0x4d4aa1['error']['message']);return _0x57be31(_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x18')]);}logger[_0x75d1('0x16')]('MailAccount,\x20%s,\x20%s',_0x4cf632,_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x18')]);return _0x4a3bb3(_0x4d4aa1[_0x75d1('0x16')][_0x75d1('0x18')]);}else{logger[_0x75d1('0x11')](_0x75d1('0x12'),_0x4cf632,_0x75d1('0x13'));_0x4a3bb3(_0x4d4aa1[_0x75d1('0x19')][_0x75d1('0x18')]);}})[_0x75d1('0x1a')](function(_0x2c2a6d){logger['error']('MailAccount,\x20%s,\x20%s',_0x4cf632,_0x2c2a6d);_0x57be31(_0x2c2a6d);});});}exports[_0x75d1('0x1b')]=function(_0x42b7ac){var _0x56730d=this;return new Promise(function(_0x31eb88,_0x406143){return db[_0x75d1('0x1c')][_0x75d1('0x1d')]({'raw':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['where']||null:null,'attributes':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['attributes']||null:null,'limit':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac['options'][_0x75d1('0x1f')]||null:null,'include':_0x42b7ac[_0x75d1('0x1e')]?_0x42b7ac[_0x75d1('0x1e')]['include']?_['map'](_0x42b7ac[_0x75d1('0x1e')][_0x75d1('0x20')],function(_0x315ce5){return{'model':db[_0x315ce5[_0x75d1('0x21')]],'as':_0x315ce5['as'],'attributes':_0x315ce5['attributes'],'include':_0x315ce5[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x315ce5[_0x75d1('0x20')],function(_0x51138e){return{'model':db[_0x51138e['model']],'as':_0x51138e['as'],'attributes':_0x51138e['attributes'],'include':_0x51138e[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x51138e[_0x75d1('0x20')],function(_0x468bf0){return{'model':db[_0x468bf0[_0x75d1('0x21')]],'as':_0x468bf0['as'],'attributes':_0x468bf0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x410e16){logger[_0x75d1('0x11')]('GetMailAccount',_0x42b7ac);logger[_0x75d1('0x14')]('GetMailAccount',_0x42b7ac,JSON[_0x75d1('0x23')](_0x410e16));_0x31eb88(_0x410e16);})[_0x75d1('0x1a')](function(_0x91e7c9){logger[_0x75d1('0x16')](_0x75d1('0x1b'),_0x91e7c9['message'],_0x42b7ac);_0x406143(_0x56730d[_0x75d1('0x16')](0x1f4,_0x91e7c9[_0x75d1('0x18')]));});});};exports[_0x75d1('0x24')]=function(_0x84d9ae){var _0x4dde94=this;return new Promise(function(_0x75b18a,_0x551824){return db[_0x75d1('0x1c')][_0x75d1('0x25')]({'raw':_0x84d9ae['options']?_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x26')]===undefined?!![]:![]:!![],'where':_0x84d9ae[_0x75d1('0x1e')]?_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x27')]||null:null,'attributes':_0x84d9ae['options']?_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x28')]||null:null,'include':_0x84d9ae[_0x75d1('0x1e')]?_0x84d9ae[_0x75d1('0x1e')]['include']?_['map'](_0x84d9ae['options'][_0x75d1('0x20')],function(_0x29ad6b){return{'model':db[_0x29ad6b[_0x75d1('0x21')]],'as':_0x29ad6b['as'],'attributes':_0x29ad6b[_0x75d1('0x28')],'include':_0x29ad6b[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x29ad6b[_0x75d1('0x20')],function(_0x2dce68){return{'model':db[_0x2dce68[_0x75d1('0x21')]],'as':_0x2dce68['as'],'attributes':_0x2dce68['attributes'],'include':_0x2dce68[_0x75d1('0x20')]?_[_0x75d1('0x22')](_0x2dce68[_0x75d1('0x20')],function(_0x62b37e){return{'model':db[_0x62b37e[_0x75d1('0x21')]],'as':_0x62b37e['as'],'attributes':_0x62b37e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x487431){if(_0x84d9ae[_0x75d1('0x1e')][_0x75d1('0x29')]===!![])_0x487431[_0x75d1('0x2a')](_0x75d1('0x2b'),_0x487431[_0x75d1('0x2c')]());logger[_0x75d1('0x11')]('ShowMailAccount',_0x84d9ae);logger['debug']('ShowMailAccount',_0x84d9ae,JSON[_0x75d1('0x23')](_0x487431));_0x75b18a(_0x487431);})['catch'](function(_0x53a1af){logger[_0x75d1('0x16')](_0x75d1('0x24'),_0x53a1af[_0x75d1('0x18')],_0x84d9ae);_0x551824(_0x4dde94[_0x75d1('0x16')](0x1f4,_0x53a1af['message']));});});};exports[_0x75d1('0x2d')]=function(_0x2acdc8){var _0x38bf47=this;return new Promise(function(_0x3d4137,_0x33bbe7){var _0xbc6473={'body':_0x2acdc8[_0x75d1('0x2e')],'channel':_0x75d1('0x2f')};var _0x2c88f2=_[_0x75d1('0x30')](_[_0x75d1('0x31')](db[_0x75d1('0x32')][_0x75d1('0x33')]),[_0x75d1('0x34'),_0x75d1('0x35'),_0x75d1('0x36'),_0x75d1('0x37')]);var _0x2ad3ef=![];if(_0x2acdc8[_0x75d1('0x2e')]['id']){delete _0x2acdc8[_0x75d1('0x2e')]['id'];}if(_[_0x75d1('0x38')](_0x2acdc8[_0x75d1('0x2e')]['from'])){return _0x33bbe7(_0x38bf47['error'](0x1f4,_0x75d1('0x39')));}if(_[_0x75d1('0x38')](_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x2e')])||_0x2acdc8['body'][_0x75d1('0x2e')]===''){return _0x33bbe7(_0x38bf47[_0x75d1('0x16')](0x1f4,_0x75d1('0x3a')));}if(_[_0x75d1('0x38')](_0x2acdc8['body'][_0x75d1('0x3b')])){return _0x33bbe7(_0x38bf47[_0x75d1('0x16')](0x1f4,_0x75d1('0x3c')+_0x2c88f2));}if(!_[_0x75d1('0x3d')](_0x2c88f2,_0x2acdc8['body'][_0x75d1('0x3b')])){return _0x33bbe7(_0x38bf47['error'](0x1f4,_0x75d1('0x3e')+_0x2c88f2));}var _0x1d063d={};_0x1d063d[_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x3b')]]=_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x3f')];return db['MailAccount'][_0x75d1('0x25')]({'where':{'id':_0x2acdc8['account']['id']},'include':[{'model':db['CmList'],'as':_0x75d1('0x40'),'include':[{'model':db[_0x75d1('0x32')],'as':_0x75d1('0x41'),'where':_0x1d063d,'limit':0x1,'order':[[_0x75d1('0x35'),_0x75d1('0x42')]]}]},{'model':db[_0x75d1('0x43')],'as':_0x75d1('0x44')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x75d1('0x45')],'as':_0x75d1('0x45')}]}]})['then'](function(_0x2d380d){if(_0x2d380d&&_0x2d380d[_0x75d1('0x40')]){var _0x2066c8=_0x2d380d['get']({'plain':!![]});_0xbc6473[_0x75d1('0x46')]=_[_0x75d1('0x47')](_0x2066c8,[_0x75d1('0x44'),_0x75d1('0x40')]);_0xbc6473[_0x75d1('0x46')][_0x75d1('0x2b')]=_0x2d380d[_0x75d1('0x2c')]();_0xbc6473['applications']=_0x2066c8[_0x75d1('0x44')];_0xbc6473[_0x75d1('0x48')]=_0x2066c8[_0x75d1('0x40')];_0xbc6473[_0x75d1('0x49')]=_[_0x75d1('0x4a')](_0xbc6473[_0x75d1('0x49')],[_0x75d1('0x4b')],['asc']);if(_0xbc6473[_0x75d1('0x46')]&&_0xbc6473[_0x75d1('0x46')][_0x75d1('0x4c')]){_0xbc6473['applications'][_0x75d1('0x4d')]({'id':0x0,'priority':_0xbc6473[_0x75d1('0x49')][_0x75d1('0x4e')]+0x1,'app':_0x75d1('0x4f'),'appdata':_0x75d1('0x4c'),'interval':_0x75d1('0x50')});}if(_0xbc6473['account'][_0x75d1('0x44')]){delete _0xbc6473[_0x75d1('0x46')][_0x75d1('0x44')];}if(_0xbc6473[_0x75d1('0x46')][_0x75d1('0x40')]){delete _0xbc6473[_0x75d1('0x46')][_0x75d1('0x40')];}if(_0x2066c8[_0x75d1('0x40')][_0x75d1('0x41')][_0x75d1('0x4e')]){return _0x2066c8[_0x75d1('0x40')][_0x75d1('0x41')][0x0];}var _0x5ceb42=_['defaults'](_0x2acdc8[_0x75d1('0x2e')],{'firstName':_0x2acdc8['body'][_0x75d1('0x3f')],'ListId':_0x2066c8[_0x75d1('0x37')]});_0x5ceb42[_0x2acdc8['body'][_0x75d1('0x3b')]]=_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x3f')];return db[_0x75d1('0x32')][_0x75d1('0x51')](_0x5ceb42);}else{throw new Error(_0x75d1('0x52'));}})[_0x75d1('0x10')](function(_0x5048ef){_0xbc6473[_0x75d1('0x53')]=_0x5048ef;if(_0x5048ef){if(!_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x54')]){_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x54')]=rs[_0x75d1('0x55')]()+'\x20'+_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['from'];}var _0x4e8e50={'ContactId':_0x5048ef['id'],'MailAccountId':_0x2acdc8[_0x75d1('0x46')]['id'],'inReplyTo':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['messageId'],'to':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x3f')],'cc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['cc'],'subject':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x56')],'attach':_0x2acdc8['body']['message'][_0x75d1('0x57')],'lastMsgAt':moment()[_0x75d1('0x58')](_0x75d1('0x59')),'lastMsgDirection':'in'};return db[_0x75d1('0x5a')]['find']({'where':{'closed':![],'MailAccountId':_0x2acdc8['account']['id']},'include':[{'model':db[_0x75d1('0x5b')],'as':_0x75d1('0x5c'),'attributes':[_0x75d1('0x54')],'where':{'messageId':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['inReplyTo']}}]})[_0x75d1('0x10')](function(_0x44173c){if(_0x44173c){return[_0x44173c,![]];}return db[_0x75d1('0x5a')][_0x75d1('0x51')](_0x4e8e50)[_0x75d1('0x10')](function(_0x32d022){return[_0x32d022,!![]];});});}else{throw new Error(_0x75d1('0x5d'));}})[_0x75d1('0x5e')](function(_0x40f50b,_0x9e30a5){if(_0x40f50b){_0x2ad3ef=_0x9e30a5;if(!_0x9e30a5){return _0x40f50b[_0x75d1('0x5f')]({'inReplyTo':_0x2acdc8['body'][_0x75d1('0x18')][_0x75d1('0x54')],'to':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x3f')],'cc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['cc'],'subject':_0x2acdc8['body']['message'][_0x75d1('0x56')],'attach':_0x40f50b[_0x75d1('0x57')]?_0x40f50b[_0x75d1('0x57')]:_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x75d1('0x59')),'lastMsgAt':moment()[_0x75d1('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x40f50b;}}})[_0x75d1('0x10')](function(_0x29b1f4){_0xbc6473[_0x75d1('0x60')]=_0x29b1f4[_0x75d1('0x61')]({'plain':!![]});_0xbc6473[_0x75d1('0x60')][_0x75d1('0x62')]=_0x2ad3ef;return db['MailMessage']['create']({'body':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x2e')],'MailAccountId':_0x2acdc8['account']['id'],'MailInteractionId':_0x29b1f4['id'],'direction':'in','ContactId':_0xbc6473[_0x75d1('0x53')]['id'],'messageId':_0x2acdc8['body'][_0x75d1('0x18')][_0x75d1('0x54')],'from':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x3f')],'to':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['to'],'cc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['cc'],'subject':_0x2acdc8['body']['message'][_0x75d1('0x56')],'attach':_0x2acdc8['body'][_0x75d1('0x18')][_0x75d1('0x57')],'Attachments':_0x2acdc8[_0x75d1('0x2e')]['message']['attachments'],'originTo':_0x2acdc8[_0x75d1('0x2e')]['message'][_0x75d1('0x63')],'originCc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')]['originCc'],'bcc':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x64')],'ChatWebsiteId':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x65')]||null,'originChannel':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x66')]||_0x75d1('0x67'),'ChatOfflineMessageId':_0x2acdc8[_0x75d1('0x2e')][_0x75d1('0x18')][_0x75d1('0x68')]||null},{'include':[{'model':db[_0x75d1('0x69')],'as':'Attachments'}]});})['then'](function(_0x410fa1){_0xbc6473[_0x75d1('0x18')]=_0x410fa1;if(!_0xbc6473['interaction'][_0x75d1('0x6a')]){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0xbc6473[_0x75d1('0x60')][_0x75d1('0x6a')]}});})[_0x75d1('0x10')](function(_0xcb6eba){if(_0xcb6eba){_0xbc6473[_0x75d1('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':_0x75d1('0x6b'),'appdata':_0xcb6eba[_0x75d1('0x6c')]+','+(_0xbc6473[_0x75d1('0x46')][_0x75d1('0x6d')]||0xa),'interval':_0x75d1('0x50')});}if(!_0xbc6473['interaction'][_0x75d1('0x6e')]){return;}return db['MailQueue'][_0x75d1('0x25')]({'attributes':['id',_0x75d1('0x6c')],'where':{'id':_0xbc6473[_0x75d1('0x60')]['queueId']}});})['then'](function(_0x4e88e9){if(_0x4e88e9){_0xbc6473[_0x75d1('0x49')][_0x75d1('0x6f')]({'id':0x0,'priority':0x1,'app':_0x75d1('0x70'),'appdata':_0x4e88e9[_0x75d1('0x6c')]+','+(_0xbc6473[_0x75d1('0x46')][_0x75d1('0x71')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x75d1('0x72'),_0x75d1('0x73'),_0xbc6473);})['then'](function(_0x4eda90){_0x3d4137(_0x4eda90);})['catch'](function(_0x5331f7){_0x33bbe7(_0x38bf47['error'](0x1f4,_0x5331f7[_0x75d1('0x18')]));});});}; \ No newline at end of file +var _0x31c2=['Applications','MailServerOut','CloudProvider','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','create','contact','messageId','generate','attach','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','debug','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication'];(function(_0x546c92,_0x165c9f){var _0x55ca41=function(_0x23f5b5){while(--_0x23f5b5){_0x546c92['push'](_0x546c92['shift']());}};_0x55ca41(++_0x165c9f);}(_0x31c2,0x1e1));var _0x231c=function(_0x1d5bb0,_0x605491){_0x1d5bb0=_0x1d5bb0-0x0;var _0x3b01e3=_0x31c2[_0x1d5bb0];return _0x3b01e3;};'use strict';var _=require(_0x231c('0x0'));var moment=require(_0x231c('0x1'));var BPromise=require(_0x231c('0x2'));var rs=require(_0x231c('0x3'));var Redis=require(_0x231c('0x4'));var db=require(_0x231c('0x5'))['db'];var logger=require(_0x231c('0x6'))(_0x231c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x231c('0x8')][_0x231c('0x9')]({'port':0x232c});config[_0x231c('0xa')]=_[_0x231c('0xb')](config['redis'],{'host':_0x231c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x231c('0xa')]));require(_0x231c('0xd'))[_0x231c('0xe')](socket);function respondWithRpcPromise(_0x55fa3a,_0x2524bf,_0x3cffb0){return new BPromise(function(_0x1e390f,_0x23841c){return client[_0x231c('0xf')](_0x55fa3a,_0x3cffb0)[_0x231c('0x10')](function(_0x10b80f){logger['info'](_0x231c('0x11'),_0x2524bf,_0x231c('0x12'));logger['debug'](_0x231c('0x13'),_0x2524bf,_0x231c('0x12'),JSON[_0x231c('0x14')](_0x10b80f));if(_0x10b80f[_0x231c('0x15')]){if(_0x10b80f[_0x231c('0x15')][_0x231c('0x16')]===0x1f4){logger[_0x231c('0x15')](_0x231c('0x11'),_0x2524bf,_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);return _0x23841c(_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);}logger[_0x231c('0x15')](_0x231c('0x11'),_0x2524bf,_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);return _0x1e390f(_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);}else{logger[_0x231c('0x18')](_0x231c('0x11'),_0x2524bf,'request\x20sent');_0x1e390f(_0x10b80f[_0x231c('0x19')][_0x231c('0x17')]);}})[_0x231c('0x1a')](function(_0xadea80){logger[_0x231c('0x15')](_0x231c('0x11'),_0x2524bf,_0xadea80);_0x23841c(_0xadea80);});});}exports[_0x231c('0x1b')]=function(_0x172d50){var _0x2890e3=this;return new Promise(function(_0x1c9c85,_0x5f045f){return db[_0x231c('0x1c')]['findAll']({'raw':_0x172d50[_0x231c('0x1d')]?_0x172d50['options'][_0x231c('0x1e')]===undefined?!![]:![]:!![],'where':_0x172d50[_0x231c('0x1d')]?_0x172d50[_0x231c('0x1d')][_0x231c('0x1f')]||null:null,'attributes':_0x172d50[_0x231c('0x1d')]?_0x172d50[_0x231c('0x1d')][_0x231c('0x20')]||null:null,'limit':_0x172d50[_0x231c('0x1d')]?_0x172d50['options'][_0x231c('0x21')]||null:null,'include':_0x172d50[_0x231c('0x1d')]?_0x172d50['options'][_0x231c('0x22')]?_[_0x231c('0x23')](_0x172d50['options'][_0x231c('0x22')],function(_0x564939){return{'model':db[_0x564939[_0x231c('0x24')]],'as':_0x564939['as'],'attributes':_0x564939[_0x231c('0x20')],'include':_0x564939[_0x231c('0x22')]?_[_0x231c('0x23')](_0x564939[_0x231c('0x22')],function(_0x131cfd){return{'model':db[_0x131cfd[_0x231c('0x24')]],'as':_0x131cfd['as'],'attributes':_0x131cfd['attributes'],'include':_0x131cfd[_0x231c('0x22')]?_[_0x231c('0x23')](_0x131cfd['include'],function(_0x3a0ca4){return{'model':db[_0x3a0ca4[_0x231c('0x24')]],'as':_0x3a0ca4['as'],'attributes':_0x3a0ca4[_0x231c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x231c('0x10')](function(_0x271635){logger[_0x231c('0x18')](_0x231c('0x1b'),_0x172d50);logger['debug'](_0x231c('0x1b'),_0x172d50,JSON[_0x231c('0x14')](_0x271635));_0x1c9c85(_0x271635);})['catch'](function(_0x4be2e2){logger['error'](_0x231c('0x1b'),_0x4be2e2['message'],_0x172d50);_0x5f045f(_0x2890e3[_0x231c('0x15')](0x1f4,_0x4be2e2['message']));});});};exports[_0x231c('0x25')]=function(_0x35a956){var _0x6fb073=this;return new Promise(function(_0x5380e0,_0x534cfe){return db[_0x231c('0x1c')][_0x231c('0x26')]({'raw':_0x35a956[_0x231c('0x1d')]?_0x35a956[_0x231c('0x1d')][_0x231c('0x1e')]===undefined?!![]:![]:!![],'where':_0x35a956[_0x231c('0x1d')]?_0x35a956[_0x231c('0x1d')][_0x231c('0x1f')]||null:null,'attributes':_0x35a956['options']?_0x35a956['options'][_0x231c('0x20')]||null:null,'include':_0x35a956[_0x231c('0x1d')]?_0x35a956[_0x231c('0x1d')][_0x231c('0x22')]?_[_0x231c('0x23')](_0x35a956[_0x231c('0x1d')]['include'],function(_0x382c12){return{'model':db[_0x382c12[_0x231c('0x24')]],'as':_0x382c12['as'],'attributes':_0x382c12['attributes'],'include':_0x382c12['include']?_[_0x231c('0x23')](_0x382c12['include'],function(_0x1fe30b){return{'model':db[_0x1fe30b['model']],'as':_0x1fe30b['as'],'attributes':_0x1fe30b[_0x231c('0x20')],'include':_0x1fe30b[_0x231c('0x22')]?_['map'](_0x1fe30b[_0x231c('0x22')],function(_0x433952){return{'model':db[_0x433952[_0x231c('0x24')]],'as':_0x433952['as'],'attributes':_0x433952['attributes']};}):[]};}):[]};}):[]:[]})[_0x231c('0x10')](function(_0xf413f9){if(_0x35a956[_0x231c('0x1d')][_0x231c('0x27')]===!![])_0xf413f9[_0x231c('0x28')](_0x231c('0x29'),_0xf413f9[_0x231c('0x2a')]());logger[_0x231c('0x18')](_0x231c('0x25'),_0x35a956);logger[_0x231c('0x2b')](_0x231c('0x25'),_0x35a956,JSON[_0x231c('0x14')](_0xf413f9));_0x5380e0(_0xf413f9);})[_0x231c('0x1a')](function(_0x486cab){logger[_0x231c('0x15')](_0x231c('0x25'),_0x486cab[_0x231c('0x17')],_0x35a956);_0x534cfe(_0x6fb073[_0x231c('0x15')](0x1f4,_0x486cab[_0x231c('0x17')]));});});};exports['NotifyMailAccount']=function(_0x41ce86){var _0x3b62bc=this;return new Promise(function(_0x229953,_0x52b9dc){var _0x1e8521={'body':_0x41ce86[_0x231c('0x2c')],'channel':_0x231c('0x2d')};var _0x37f0f6=_[_0x231c('0x2e')](_[_0x231c('0x2f')](db['CmContact'][_0x231c('0x30')]),[_0x231c('0x31'),_0x231c('0x32'),_0x231c('0x33'),'ListId']);var _0x33396b=![];if(_0x41ce86['body']['id']){delete _0x41ce86[_0x231c('0x2c')]['id'];}if(_['isNil'](_0x41ce86[_0x231c('0x2c')][_0x231c('0x34')])){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,_0x231c('0x35')));}if(_[_0x231c('0x36')](_0x41ce86[_0x231c('0x2c')]['body'])||_0x41ce86[_0x231c('0x2c')][_0x231c('0x2c')]===''){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x231c('0x36')](_0x41ce86[_0x231c('0x2c')][_0x231c('0x37')])){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37f0f6));}if(!_[_0x231c('0x38')](_0x37f0f6,_0x41ce86['body'][_0x231c('0x37')])){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,_0x231c('0x39')+_0x37f0f6));}var _0x436907={};_0x436907[_0x41ce86[_0x231c('0x2c')][_0x231c('0x37')]]=_0x41ce86[_0x231c('0x2c')][_0x231c('0x34')];return db[_0x231c('0x1c')][_0x231c('0x26')]({'where':{'id':_0x41ce86[_0x231c('0x3a')]['id']},'include':[{'model':db[_0x231c('0x3b')],'as':_0x231c('0x3c'),'include':[{'model':db[_0x231c('0x3d')],'as':'Contacts','where':_0x436907,'limit':0x1,'order':[[_0x231c('0x32'),_0x231c('0x3e')]]}]},{'model':db[_0x231c('0x3f')],'as':_0x231c('0x40')},{'model':db[_0x231c('0x41')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x231c('0x42')}]}]})['then'](function(_0x419f63){if(_0x419f63&&_0x419f63[_0x231c('0x3c')]){var _0x1ef2e7=_0x419f63['get']({'plain':!![]});_0x1e8521[_0x231c('0x3a')]=_['omit'](_0x1ef2e7,[_0x231c('0x40'),_0x231c('0x3c')]);_0x1e8521['account'][_0x231c('0x29')]=_0x419f63[_0x231c('0x2a')]();_0x1e8521[_0x231c('0x43')]=_0x1ef2e7['Applications'];_0x1e8521['list']=_0x1ef2e7['List'];_0x1e8521[_0x231c('0x43')]=_[_0x231c('0x44')](_0x1e8521[_0x231c('0x43')],['priority'],[_0x231c('0x45')]);if(_0x1e8521[_0x231c('0x3a')]&&_0x1e8521[_0x231c('0x3a')][_0x231c('0x46')]){_0x1e8521[_0x231c('0x43')][_0x231c('0x47')]({'id':0x0,'priority':_0x1e8521[_0x231c('0x43')][_0x231c('0x48')]+0x1,'app':_0x231c('0x49'),'appdata':_0x231c('0x46'),'interval':_0x231c('0x4a')});}if(_0x1e8521['account'][_0x231c('0x40')]){delete _0x1e8521[_0x231c('0x3a')]['Applications'];}if(_0x1e8521[_0x231c('0x3a')]['List']){delete _0x1e8521[_0x231c('0x3a')][_0x231c('0x3c')];}if(_0x1ef2e7[_0x231c('0x3c')][_0x231c('0x4b')][_0x231c('0x48')]){return _0x1ef2e7[_0x231c('0x3c')][_0x231c('0x4b')][0x0];}var _0x12fdcd=_[_0x231c('0xb')](_0x41ce86[_0x231c('0x2c')],{'firstName':_0x41ce86['body'][_0x231c('0x34')],'ListId':_0x1ef2e7[_0x231c('0x4c')]});_0x12fdcd[_0x41ce86[_0x231c('0x2c')]['mapKey']]=_0x41ce86[_0x231c('0x2c')][_0x231c('0x34')];return db['CmContact'][_0x231c('0x4d')](_0x12fdcd);}else{throw new Error('List\x20not\x20found');}})[_0x231c('0x10')](function(_0x1f119c){_0x1e8521[_0x231c('0x4e')]=_0x1f119c;if(_0x1f119c){if(!_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['messageId']){_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x4f')]=rs[_0x231c('0x50')]()+'\x20'+_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x34')];}var _0x4eddb2={'ContactId':_0x1f119c['id'],'MailAccountId':_0x41ce86['account']['id'],'inReplyTo':_0x41ce86['body'][_0x231c('0x17')][_0x231c('0x4f')],'to':_0x41ce86['body'][_0x231c('0x17')]['from'],'cc':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['cc'],'subject':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['subject'],'attach':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x51')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x231c('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x41ce86[_0x231c('0x3a')]['id']},'include':[{'model':db[_0x231c('0x53')],'as':'Messages','attributes':[_0x231c('0x4f')],'where':{'messageId':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x54')]}}]})[_0x231c('0x10')](function(_0x334dac){if(_0x334dac){return[_0x334dac,![]];}return db['MailInteraction']['create'](_0x4eddb2)['then'](function(_0x111b8d){return[_0x111b8d,!![]];});});}else{throw new Error(_0x231c('0x55'));}})[_0x231c('0x56')](function(_0x1e77ca,_0xb72644){if(_0x1e77ca){_0x33396b=_0xb72644;if(!_0xb72644){return _0x1e77ca['update']({'inReplyTo':_0x41ce86['body'][_0x231c('0x17')][_0x231c('0x4f')],'to':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x34')],'cc':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['cc'],'subject':_0x41ce86[_0x231c('0x2c')]['message']['subject'],'attach':_0x1e77ca['attach']?_0x1e77ca[_0x231c('0x51')]:_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x51')],'substatus':null,'substatusAt':moment()[_0x231c('0x57')](_0x231c('0x58')),'lastMsgAt':moment()[_0x231c('0x57')](_0x231c('0x58')),'lastMsgDirection':'in'});}else{return _0x1e77ca;}}})[_0x231c('0x10')](function(_0x4d20fc){_0x1e8521[_0x231c('0x59')]=_0x4d20fc[_0x231c('0x5a')]({'plain':!![]});_0x1e8521[_0x231c('0x59')]['created']=_0x33396b;return db[_0x231c('0x53')][_0x231c('0x4d')]({'body':_0x41ce86[_0x231c('0x2c')]['body'],'MailAccountId':_0x41ce86[_0x231c('0x3a')]['id'],'MailInteractionId':_0x4d20fc['id'],'direction':'in','ContactId':_0x1e8521[_0x231c('0x4e')]['id'],'messageId':_0x41ce86['body']['message'][_0x231c('0x4f')],'from':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x34')],'to':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['to'],'cc':_0x41ce86[_0x231c('0x2c')]['message']['cc'],'subject':_0x41ce86['body'][_0x231c('0x17')]['subject'],'attach':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['attach'],'Attachments':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['attachments'],'originTo':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x5b')],'originCc':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x5c')],'bcc':_0x41ce86['body'][_0x231c('0x17')][_0x231c('0x5d')],'ChatWebsiteId':_0x41ce86['body'][_0x231c('0x17')]['ChatWebsiteId']||null,'originChannel':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x5e')]||_0x231c('0x5f'),'ChatOfflineMessageId':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x60')]||null},{'include':[{'model':db[_0x231c('0x61')],'as':_0x231c('0x62')}]});})[_0x231c('0x10')](function(_0x1a60c7){_0x1e8521[_0x231c('0x17')]=_0x1a60c7;if(!_0x1e8521[_0x231c('0x59')][_0x231c('0x63')]){return;}return db[_0x231c('0x64')][_0x231c('0x26')]({'attributes':['id',_0x231c('0x65')],'where':{'id':_0x1e8521[_0x231c('0x59')][_0x231c('0x63')]}});})[_0x231c('0x10')](function(_0x14ec8f){if(_0x14ec8f){_0x1e8521[_0x231c('0x43')][_0x231c('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x14ec8f[_0x231c('0x65')]+','+(_0x1e8521['account'][_0x231c('0x67')]||0xa),'interval':_0x231c('0x4a')});}if(!_0x1e8521[_0x231c('0x59')][_0x231c('0x68')]){return;}return db['MailQueue']['find']({'attributes':['id','name'],'where':{'id':_0x1e8521[_0x231c('0x59')][_0x231c('0x68')]}});})['then'](function(_0x430f7a){if(_0x430f7a){_0x1e8521[_0x231c('0x43')]['unshift']({'id':0x0,'priority':0x1,'app':_0x231c('0x69'),'appdata':_0x430f7a['name']+','+(_0x1e8521[_0x231c('0x3a')][_0x231c('0x6a')]||0x12c),'interval':_0x231c('0x4a')});}return respondWithRpcPromise(_0x231c('0x6b'),_0x231c('0x6c'),_0x1e8521);})['then'](function(_0x4f8f3b){_0x229953(_0x4f8f3b);})[_0x231c('0x1a')](function(_0x1bad18){_0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,_0x1bad18['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 95800fa..0e6a5c9 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 _0xafcd=['mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafcd,0x157));var _0xdafc=function(_0x34233f,_0x18f1b1){_0x34233f=_0x34233f-0x0;var _0x2199a4=_0xafcd[_0x34233f];return _0x2199a4;};'use strict';var MailAccountEvents=require(_0xdafc('0x0'));var events=[_0xdafc('0x1'),_0xdafc('0x2'),_0xdafc('0x3')];function createListener(_0x27ad41,_0x34b3d1){return function(_0x665fc){_0x34b3d1['emit'](_0x27ad41,_0x665fc);};}function removeListener(_0x145095,_0x54a63b){return function(){MailAccountEvents[_0xdafc('0x4')](_0x145095,_0x54a63b);};}exports['register']=function(_0x3b4373){for(var _0x2aa781=0x0,_0x33adc9=events['length'];_0x2aa781<_0x33adc9;_0x2aa781++){var _0x24f2e7=events[_0x2aa781];var _0x255125=createListener(_0xdafc('0x5')+_0x24f2e7,_0x3b4373);MailAccountEvents['on'](_0x24f2e7,_0x255125);}}; \ No newline at end of file +var _0xa1b4=['register','length','mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa1b4,0x83));var _0x4a1b=function(_0x5cab28,_0x307622){_0x5cab28=_0x5cab28-0x0;var _0xa3554d=_0xa1b4[_0x5cab28];return _0xa3554d;};'use strict';var MailAccountEvents=require(_0x4a1b('0x0'));var events=[_0x4a1b('0x1'),_0x4a1b('0x2'),_0x4a1b('0x3')];function createListener(_0x12ce57,_0x3e0371){return function(_0x4b44b0){_0x3e0371['emit'](_0x12ce57,_0x4b44b0);};}function removeListener(_0x1a6b52,_0xf9f868){return function(){MailAccountEvents[_0x4a1b('0x4')](_0x1a6b52,_0xf9f868);};}exports[_0x4a1b('0x5')]=function(_0x244d54){for(var _0x509ec1=0x0,_0x30581a=events[_0x4a1b('0x6')];_0x509ec1<_0x30581a;_0x509ec1++){var _0x5a7388=events[_0x509ec1];var _0x44e31f=createListener(_0x4a1b('0x7')+_0x5a7388,_0x244d54);MailAccountEvents['on'](_0x5a7388,_0x44e31f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 544f25f..cf033dd 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 _0xa5dc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util'];(function(_0x3ee986,_0x358289){var _0x133ea2=function(_0x41a157){while(--_0x41a157){_0x3ee986['push'](_0x3ee986['shift']());}};_0x133ea2(++_0x358289);}(_0xa5dc,0x7e));var _0xca5d=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0xa5dc[_0xcfcbaa];return _0x157ed0;};'use strict';var multer=require(_0xca5d('0x0'));var util=require(_0xca5d('0x1'));var path=require('path');var timeout=require(_0xca5d('0x2'));var express=require(_0xca5d('0x3'));var router=express[_0xca5d('0x4')]();var fs_extra=require(_0xca5d('0x5'));var auth=require(_0xca5d('0x6'));var interaction=require(_0xca5d('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xca5d('0x8')](_0xca5d('0x9'),auth[_0xca5d('0xa')](),controller['show']);router[_0xca5d('0xb')](_0xca5d('0x9'),auth[_0xca5d('0xa')](),controller[_0xca5d('0xc')]);router[_0xca5d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xca5d('0xe')]);module[_0xca5d('0xf')]=router; \ No newline at end of file +var _0xd735=['Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','express'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xd735,0xc0));var _0x5d73=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd735[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x5d73('0x0'));var util=require(_0x5d73('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5d73('0x2'));var router=express[_0x5d73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5d73('0x4'));var interaction=require(_0x5d73('0x5'));var config=require('../../config/environment');var controller=require(_0x5d73('0x6'));router[_0x5d73('0x7')](_0x5d73('0x8'),auth['isAuthenticated'](),controller[_0x5d73('0x9')]);router[_0x5d73('0xa')](_0x5d73('0x8'),auth[_0x5d73('0xb')](),controller[_0x5d73('0xc')]);router['delete'](_0x5d73('0x8'),auth[_0x5d73('0xb')](),controller[_0x5d73('0xd')]);module[_0x5d73('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 4add15a..5dae733 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 _0x2e28=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x44f0a1,_0x457d11){var _0x4af42e=function(_0x15fcbf){while(--_0x15fcbf){_0x44f0a1['push'](_0x44f0a1['shift']());}};_0x4af42e(++_0x457d11);}(_0x2e28,0x6f));var _0x82e2=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0x2e28[_0x543429];return _0x112a46;};'use strict';var Sequelize=require(_0x82e2('0x0'));module[_0x82e2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x82e2('0x2')],'allowNull':![],'defaultValue':_0x82e2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x82e2('0x2')]},'interval':{'type':Sequelize[_0x82e2('0x2')],'defaultValue':_0x82e2('0x4')}}; \ No newline at end of file +var _0x2df8=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5359df,_0x5e9992){var _0x15d95a=function(_0x4d9bcc){while(--_0x4d9bcc){_0x5359df['push'](_0x5359df['shift']());}};_0x15d95a(++_0x5e9992);}(_0x2df8,0x144));var _0x82df=function(_0x5ce8dd,_0x59557e){_0x5ce8dd=_0x5ce8dd-0x0;var _0x1cfb86=_0x2df8[_0x5ce8dd];return _0x1cfb86;};'use strict';var Sequelize=require(_0x82df('0x0'));module[_0x82df('0x1')]={'priority':{'type':Sequelize[_0x82df('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x82df('0x3')],'allowNull':![],'defaultValue':_0x82df('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x82df('0x3')],'defaultValue':_0x82df('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 50731ad..1fafb28 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0x70e0,0x17b));var _0x070e=function(_0x562175,_0x5677be){_0x562175=_0x562175-0x0;var _0x3b8956=_0x70e0[_0x562175];return _0x3b8956;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x42bf5a,_0x45c92e){var _0x38ee73=function(_0x4e9af1){while(--_0x4e9af1){_0x42bf5a['push'](_0x42bf5a['shift']());}};_0x38ee73(++_0x45c92e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x32e852,_0x474045){_0x32e852=_0x32e852-0x0;var _0x5b7868=_0xf4eb[_0x32e852];return _0x5b7868;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9cb5ee6..4963ce0 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 _0x3750=['util','api','moment','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x41226f,_0x17f84d){var _0x33a8d6=function(_0x3e9c2f){while(--_0x3e9c2f){_0x41226f['push'](_0x41226f['shift']());}};_0x33a8d6(++_0x17f84d);}(_0x3750,0x15f));var _0x0375=function(_0xc1ede1,_0x27c567){_0xc1ede1=_0xc1ede1-0x0;var _0x36f293=_0x3750[_0xc1ede1];return _0x36f293;};'use strict';var _=require(_0x0375('0x0'));var util=require(_0x0375('0x1'));var logger=require('../../config/logger')(_0x0375('0x2'));var moment=require(_0x0375('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(_0x0375('0x4'));var attributes=require(_0x0375('0x5'));module[_0x0375('0x6')]=function(_0x168eed,_0x5ac6b5){return _0x168eed[_0x0375('0x7')](_0x0375('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0375('0x9'),'collate':_0x0375('0xa')});}; \ No newline at end of file +var _0xc1bb=['request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird'];(function(_0x14ac21,_0x11b137){var _0x3279d3=function(_0x27b1ef){while(--_0x27b1ef){_0x14ac21['push'](_0x14ac21['shift']());}};_0x3279d3(++_0x11b137);}(_0xc1bb,0x131));var _0xbc1b=function(_0x37a580,_0x3135a6){_0x37a580=_0x37a580-0x0;var _0x77d8d1=_0xc1bb[_0x37a580];return _0x77d8d1;};'use strict';var _=require('lodash');var util=require(_0xbc1b('0x0'));var logger=require(_0xbc1b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbc1b('0x2'));var rp=require(_0xbc1b('0x3'));var fs=require('fs');var path=require(_0xbc1b('0x4'));var rimraf=require(_0xbc1b('0x5'));var config=require(_0xbc1b('0x6'));var attributes=require(_0xbc1b('0x7'));module[_0xbc1b('0x8')]=function(_0x106ba2,_0x4a7380){return _0x106ba2[_0xbc1b('0x9')](_0xbc1b('0xa'),attributes,{'tableName':_0xbc1b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc1b('0xc'),'collate':_0xbc1b('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 399e05d..49a64f6 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 _0xff6e=['code','message','info','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cede3,_0x468270){var _0x48e29c=function(_0x3e4193){while(--_0x3e4193){_0x3cede3['push'](_0x3cede3['shift']());}};_0x48e29c(++_0x468270);}(_0xff6e,0x179));var _0xeff6=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xff6e[_0x41ee16];return _0x1f60de;};'use strict';var _=require(_0xeff6('0x0'));var util=require(_0xeff6('0x1'));var moment=require(_0xeff6('0x2'));var BPromise=require(_0xeff6('0x3'));var rs=require(_0xeff6('0x4'));var fs=require('fs');var Redis=require(_0xeff6('0x5'));var db=require(_0xeff6('0x6'))['db'];var utils=require(_0xeff6('0x7'));var logger=require(_0xeff6('0x8'))(_0xeff6('0x9'));var config=require(_0xeff6('0xa'));var jayson=require(_0xeff6('0xb'));var client=jayson['client'][_0xeff6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ca8e7,_0x528941,_0x2b657a){return new BPromise(function(_0x27a43a,_0x3ab97c){return client['request'](_0x3ca8e7,_0x2b657a)[_0xeff6('0xd')](function(_0x3ee628){logger['info'](_0xeff6('0xe'),_0x528941,_0xeff6('0xf'));logger['debug'](_0xeff6('0x10'),_0x528941,'request\x20sent',JSON[_0xeff6('0x11')](_0x3ee628));if(_0x3ee628[_0xeff6('0x12')]){if(_0x3ee628[_0xeff6('0x12')][_0xeff6('0x13')]===0x1f4){logger[_0xeff6('0x12')](_0xeff6('0xe'),_0x528941,_0x3ee628[_0xeff6('0x12')][_0xeff6('0x14')]);return _0x3ab97c(_0x3ee628[_0xeff6('0x12')]['message']);}logger[_0xeff6('0x12')]('MailApplication,\x20%s,\x20%s',_0x528941,_0x3ee628['error'][_0xeff6('0x14')]);return _0x27a43a(_0x3ee628['error']['message']);}else{logger[_0xeff6('0x15')](_0xeff6('0xe'),_0x528941,_0xeff6('0xf'));_0x27a43a(_0x3ee628['result'][_0xeff6('0x14')]);}})[_0xeff6('0x16')](function(_0x591a5b){logger[_0xeff6('0x12')](_0xeff6('0xe'),_0x528941,_0x591a5b);_0x3ab97c(_0x591a5b);});});}exports['UpdateMailApplication']=function(_0x6f0b32){var _0x22e1f1=this;return new Promise(function(_0x218d97,_0x1e06a0){return db[_0xeff6('0x17')][_0xeff6('0x18')](_0x6f0b32[_0xeff6('0x19')],{'raw':_0x6f0b32['options']?_0x6f0b32[_0xeff6('0x1a')][_0xeff6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f0b32[_0xeff6('0x1a')]?_0x6f0b32['options'][_0xeff6('0x1c')]||null:null,'attributes':_0x6f0b32[_0xeff6('0x1a')]?_0x6f0b32[_0xeff6('0x1a')][_0xeff6('0x1d')]||null:null,'limit':_0x6f0b32[_0xeff6('0x1a')]?_0x6f0b32['options'][_0xeff6('0x1e')]||null:null})[_0xeff6('0xd')](function(_0x4275eb){logger['info'](_0xeff6('0x1f'),_0x6f0b32);logger[_0xeff6('0x20')](_0xeff6('0x1f'),_0x6f0b32,JSON[_0xeff6('0x11')](_0x4275eb));_0x218d97(_0x4275eb);})[_0xeff6('0x16')](function(_0x185cca){logger[_0xeff6('0x12')]('UpdateMailApplication',_0x185cca['message'],_0x6f0b32);_0x1e06a0(_0x22e1f1[_0xeff6('0x12')](0x1f4,_0x185cca[_0xeff6('0x14')]));});});}; \ No newline at end of file +var _0x5606=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','stringify','lodash','util'];(function(_0x33a4f2,_0x28f197){var _0x373ae2=function(_0x4236df){while(--_0x4236df){_0x33a4f2['push'](_0x33a4f2['shift']());}};_0x373ae2(++_0x28f197);}(_0x5606,0x19e));var _0x6560=function(_0x3c1721,_0x29c5b4){_0x3c1721=_0x3c1721-0x0;var _0x5d6a30=_0x5606[_0x3c1721];return _0x5d6a30;};'use strict';var _=require(_0x6560('0x0'));var util=require(_0x6560('0x1'));var moment=require(_0x6560('0x2'));var BPromise=require(_0x6560('0x3'));var rs=require(_0x6560('0x4'));var fs=require('fs');var Redis=require(_0x6560('0x5'));var db=require(_0x6560('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6560('0x7'))(_0x6560('0x8'));var config=require(_0x6560('0x9'));var jayson=require(_0x6560('0xa'));var client=jayson[_0x6560('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x138d6d,_0x47db6d,_0x5a3283){return new BPromise(function(_0x25bb5c,_0x4b57c6){return client[_0x6560('0xc')](_0x138d6d,_0x5a3283)[_0x6560('0xd')](function(_0xc8a15b){logger[_0x6560('0xe')](_0x6560('0xf'),_0x47db6d,_0x6560('0x10'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x47db6d,_0x6560('0x10'),JSON['stringify'](_0xc8a15b));if(_0xc8a15b[_0x6560('0x11')]){if(_0xc8a15b[_0x6560('0x11')][_0x6560('0x12')]===0x1f4){logger[_0x6560('0x11')](_0x6560('0xf'),_0x47db6d,_0xc8a15b[_0x6560('0x11')][_0x6560('0x13')]);return _0x4b57c6(_0xc8a15b[_0x6560('0x11')]['message']);}logger[_0x6560('0x11')](_0x6560('0xf'),_0x47db6d,_0xc8a15b[_0x6560('0x11')]['message']);return _0x25bb5c(_0xc8a15b[_0x6560('0x11')][_0x6560('0x13')]);}else{logger['info'](_0x6560('0xf'),_0x47db6d,_0x6560('0x10'));_0x25bb5c(_0xc8a15b[_0x6560('0x14')][_0x6560('0x13')]);}})['catch'](function(_0x42c05c){logger[_0x6560('0x11')](_0x6560('0xf'),_0x47db6d,_0x42c05c);_0x4b57c6(_0x42c05c);});});}exports['UpdateMailApplication']=function(_0x4540bf){var _0x14e438=this;return new Promise(function(_0x172f77,_0x45e71e){return db[_0x6560('0x15')][_0x6560('0x16')](_0x4540bf[_0x6560('0x17')],{'raw':_0x4540bf[_0x6560('0x18')]?_0x4540bf[_0x6560('0x18')][_0x6560('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4540bf[_0x6560('0x18')]?_0x4540bf[_0x6560('0x18')][_0x6560('0x1a')]||null:null,'attributes':_0x4540bf[_0x6560('0x18')]?_0x4540bf[_0x6560('0x18')][_0x6560('0x1b')]||null:null,'limit':_0x4540bf[_0x6560('0x18')]?_0x4540bf['options'][_0x6560('0x1c')]||null:null})['then'](function(_0x5efff4){logger[_0x6560('0xe')](_0x6560('0x1d'),_0x4540bf);logger[_0x6560('0x1e')](_0x6560('0x1d'),_0x4540bf,JSON[_0x6560('0x1f')](_0x5efff4));_0x172f77(_0x5efff4);})['catch'](function(_0x3ee4a1){logger[_0x6560('0x11')]('UpdateMailApplication',_0x3ee4a1[_0x6560('0x13')],_0x4540bf);_0x45e71e(_0x14e438[_0x6560('0x11')](0x1f4,_0x3ee4a1[_0x6560('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 81ac09b..9e013c4 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 _0xe280=['/:id/messages','/:id/download','download','post','create','mailinteraction:addtags','addTags','put','tracked','update','delete','mail','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x219213,_0xf446a6){var _0xec6fde=function(_0x1f281d){while(--_0x1f281d){_0x219213['push'](_0x219213['shift']());}};_0xec6fde(++_0xf446a6);}(_0xe280,0xe0));var _0x0e28=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xe280[_0x166d93];return _0xba708;};'use strict';var express=require(_0x0e28('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0e28('0x1'));var controller=require(_0x0e28('0x2'));router[_0x0e28('0x3')]('/',auth['isAuthenticated'](),controller[_0x0e28('0x4')]);router[_0x0e28('0x3')](_0x0e28('0x5'),auth['isAuthenticated'](),controller[_0x0e28('0x6')]);router[_0x0e28('0x3')](_0x0e28('0x7'),auth[_0x0e28('0x8')](),controller[_0x0e28('0x9')]);router[_0x0e28('0x3')](_0x0e28('0xa'),auth[_0x0e28('0x8')](),controller['getMessages']);router['get'](_0x0e28('0xb'),auth['isAuthenticated'](),controller[_0x0e28('0xc')]);router[_0x0e28('0xd')]('/',auth['isAuthenticated'](),controller[_0x0e28('0xe')]);router['post'](_0x0e28('0xa'),auth[_0x0e28('0x8')](),controller['addMessage']);router[_0x0e28('0xd')]('/:id/tags',auth[_0x0e28('0x8')](),interaction['tracked']('mail',_0x0e28('0xf')),controller[_0x0e28('0x10')]);router[_0x0e28('0x11')](_0x0e28('0x7'),auth['isAuthenticated'](),interaction[_0x0e28('0x12')]('mail','mailinteraction:update'),controller[_0x0e28('0x13')]);router[_0x0e28('0x14')](_0x0e28('0x7'),auth[_0x0e28('0x8')](),interaction[_0x0e28('0x12')](_0x0e28('0x15'),_0x0e28('0x16')),controller[_0x0e28('0x17')]);router[_0x0e28('0x14')]('/:id/tags',auth[_0x0e28('0x8')](),controller[_0x0e28('0x18')]);module[_0x0e28('0x19')]=router; \ No newline at end of file +var _0xd7cc=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','tracked','mail','mailinteraction:addtags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/auth/service'];(function(_0x16cb03,_0x43ea58){var _0x10944e=function(_0x27ebaa){while(--_0x27ebaa){_0x16cb03['push'](_0x16cb03['shift']());}};_0x10944e(++_0x43ea58);}(_0xd7cc,0x1c6));var _0xcd7c=function(_0x5eb25e,_0x53622d){_0x5eb25e=_0x5eb25e-0x0;var _0x375206=_0xd7cc[_0x5eb25e];return _0x375206;};'use strict';var express=require('express');var router=express[_0xcd7c('0x0')]();var auth=require(_0xcd7c('0x1'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0xcd7c('0x2')]('/',auth[_0xcd7c('0x3')](),controller[_0xcd7c('0x4')]);router[_0xcd7c('0x2')](_0xcd7c('0x5'),auth['isAuthenticated'](),controller[_0xcd7c('0x6')]);router[_0xcd7c('0x2')](_0xcd7c('0x7'),auth[_0xcd7c('0x3')](),controller[_0xcd7c('0x8')]);router[_0xcd7c('0x2')](_0xcd7c('0x9'),auth[_0xcd7c('0x3')](),controller[_0xcd7c('0xa')]);router[_0xcd7c('0x2')]('/:id/download',auth['isAuthenticated'](),controller[_0xcd7c('0xb')]);router['post']('/',auth[_0xcd7c('0x3')](),controller[_0xcd7c('0xc')]);router[_0xcd7c('0xd')](_0xcd7c('0x9'),auth[_0xcd7c('0x3')](),controller['addMessage']);router[_0xcd7c('0xd')]('/:id/tags',auth[_0xcd7c('0x3')](),interaction[_0xcd7c('0xe')](_0xcd7c('0xf'),_0xcd7c('0x10')),controller['addTags']);router[_0xcd7c('0x11')]('/:id',auth[_0xcd7c('0x3')](),interaction[_0xcd7c('0xe')]('mail','mailinteraction:update'),controller[_0xcd7c('0x12')]);router[_0xcd7c('0x13')](_0xcd7c('0x7'),auth[_0xcd7c('0x3')](),interaction[_0xcd7c('0xe')](_0xcd7c('0xf'),_0xcd7c('0x14')),controller[_0xcd7c('0x15')]);router[_0xcd7c('0x13')]('/:id/tags',auth['isAuthenticated'](),controller[_0xcd7c('0x16')]);module[_0xcd7c('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index a63f9fb..ac076b1 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 _0x24e9=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x24e9,0x14d));var _0x924e=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x24e9[_0x4d82ea];return _0x257f4a;};'use strict';var Sequelize=require(_0x924e('0x0'));var iconv=require('iconv');module[_0x924e('0x1')]={'closed':{'type':Sequelize[_0x924e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x924e('0x3')]},'disposition':{'type':Sequelize[_0x924e('0x4')]},'secondDisposition':{'type':Sequelize[_0x924e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x924e('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x924e('0x4')](0x1fe)},'to':{'type':Sequelize[_0x924e('0x4')]},'cc':{'type':Sequelize[_0x924e('0x5')](_0x924e('0x6'))},'subject':{'type':Sequelize[_0x924e('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x924e('0x3')]},'substatus':{'type':Sequelize[_0x924e('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x924e('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x924e('0x7')]('in',_0x924e('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x924e('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x924e('0x9')]}}; \ No newline at end of file +var _0x3607=['exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','INTEGER','sequelize','iconv'];(function(_0x30af47,_0x536916){var _0x56624a=function(_0x122331){while(--_0x122331){_0x30af47['push'](_0x30af47['shift']());}};_0x56624a(++_0x536916);}(_0x3607,0x1ca));var _0x7360=function(_0x7cf4c,_0x1c6123){_0x7cf4c=_0x7cf4c-0x0;var _0x24f6d2=_0x3607[_0x7cf4c];return _0x24f6d2;};'use strict';var Sequelize=require(_0x7360('0x0'));var iconv=require(_0x7360('0x1'));module[_0x7360('0x2')]={'closed':{'type':Sequelize[_0x7360('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7360('0x4')]},'disposition':{'type':Sequelize[_0x7360('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7360('0x5')]},'inReplyTo':{'type':Sequelize[_0x7360('0x5')](0x1fe)},'to':{'type':Sequelize[_0x7360('0x5')]},'cc':{'type':Sequelize[_0x7360('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x7360('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7360('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x7360('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7360('0x7')]('in',_0x7360('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7360('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7360('0x7')]('in',_0x7360('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7360('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7360('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 763e6ff..adfef76 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 _0x9dff=['toString','join','root','files','tmp','server','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','sendStatus','stack','name','send','index','map','MailInteraction','type','key','findAll','mail','query','user','catch','show','params','keys','rawAttributes','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','update','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','filters','pick','where','MailInteractionId','filter','$gte','format','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix'];(function(_0x54a5cb,_0x4e5f16){var _0x168e1c=function(_0x3c97a9){while(--_0x3c97a9){_0x54a5cb['push'](_0x54a5cb['shift']());}};_0x168e1c(++_0x4e5f16);}(_0x9dff,0x1d4));var _0xf9df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9dff[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xf9df('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xf9df('0x1'));var BPromise=require(_0xf9df('0x2'));var util=require(_0xf9df('0x3'));var path=require(_0xf9df('0x4'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0xf9df('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xf9df('0x6'));var logger=require(_0xf9df('0x7'))(_0xf9df('0x8'));var config=require(_0xf9df('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xf9df('0xa'));config['redis']=_[_0xf9df('0xb')](config[_0xf9df('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9df('0xd'))(new Redis(config['redis']));require(_0xf9df('0xe'))[_0xf9df('0xf')](socket);function respondWithStatusCode(_0x5d4ed6,_0x1412c3){_0x1412c3=_0x1412c3||0xcc;return function(_0x1b1fa9){if(_0x1b1fa9){return _0x5d4ed6['sendStatus'](_0x1412c3);}return _0x5d4ed6[_0xf9df('0x10')](_0x1412c3)[_0xf9df('0x11')]();};}function respondWithResult(_0x4c5640,_0x50665d){_0x50665d=_0x50665d||0xc8;return function(_0x4928da){if(_0x4928da){return _0x4c5640[_0xf9df('0x10')](_0x50665d)[_0xf9df('0x12')](_0x4928da);}};}function respondWithFilteredResult(_0x403601,_0x5cebdc){return function(_0x569bc8){if(_0x569bc8){var _0x4cc588=typeof _0x5cebdc[_0xf9df('0x13')]===_0xf9df('0x14')&&typeof _0x5cebdc[_0xf9df('0x15')]===_0xf9df('0x14');var _0x3bcda5=_0x569bc8[_0xf9df('0x16')];var _0x4f19a9=_0x4cc588?0x0:_0x5cebdc[_0xf9df('0x13')];var _0x482363=_0x4cc588?_0x569bc8[_0xf9df('0x16')]:_0x5cebdc[_0xf9df('0x13')]+_0x5cebdc[_0xf9df('0x15')];var _0x145389;if(_0x482363>=_0x3bcda5){_0x482363=_0x3bcda5;_0x145389=0xc8;}else{_0x145389=0xce;}_0x403601[_0xf9df('0x10')](_0x145389);return _0x403601[_0xf9df('0x17')](_0xf9df('0x18'),_0x4f19a9+'-'+_0x482363+'/'+_0x3bcda5)[_0xf9df('0x12')](_0x569bc8);}return null;};}function saveUpdates(_0x2892e1){return function(_0x27b6ca){if(_0x27b6ca){return _0x27b6ca['update'](_0x2892e1)[_0xf9df('0x19')](function(_0x455de1){return _0x455de1;});}return null;};}function removeEntity(_0x3e2a7c){return function(_0x52133f){if(_0x52133f){return _0x52133f[_0xf9df('0x1a')]()[_0xf9df('0x19')](function(){_0x3e2a7c['status'](0xcc)[_0xf9df('0x11')]();});}};}function handleEntityNotFound(_0x23f1cd){return function(_0x56b311){if(!_0x56b311){_0x23f1cd[_0xf9df('0x1b')](0x194);}return _0x56b311;};}function handleError(_0xa166bb,_0x1d25ac){_0x1d25ac=_0x1d25ac||0x1f4;return function(_0xee2d4e){logger['error'](_0xee2d4e[_0xf9df('0x1c')]);if(_0xee2d4e[_0xf9df('0x1d')]){delete _0xee2d4e[_0xf9df('0x1d')];}_0xa166bb[_0xf9df('0x10')](_0x1d25ac)[_0xf9df('0x1e')](_0xee2d4e);};}exports[_0xf9df('0x1f')]=function(_0x5501f0,_0x408673){var _0x3262c5={};var _0x5cf595=_[_0xf9df('0x20')](db[_0xf9df('0x21')]['rawAttributes'],function(_0x4fe0f1){return{'name':_0x4fe0f1['fieldName'],'type':_0x4fe0f1[_0xf9df('0x22')][_0xf9df('0x23')]};});_0x3262c5=qs['getOptions'](_0x5cf595,_0x5501f0);return interaction[_0xf9df('0x24')](_0xf9df('0x25'),_0x5501f0[_0xf9df('0x26')],_0x5501f0[_0xf9df('0x27')],_0x3262c5,_0x5cf595)[_0xf9df('0x19')](respondWithFilteredResult(_0x408673,_0x3262c5))[_0xf9df('0x28')](handleError(_0x408673,null));};exports[_0xf9df('0x29')]=function(_0x44ea11,_0x491531){var _0x9a0942={'raw':![],'where':{'id':_0x44ea11[_0xf9df('0x2a')]['id']}},_0x149fd9={};_0x149fd9['model']=_[_0xf9df('0x2b')](db[_0xf9df('0x21')][_0xf9df('0x2c')]);_0x149fd9[_0xf9df('0x26')]=_['keys'](_0x44ea11['query']);_0x149fd9['filters']=_[_0xf9df('0x2d')](_0x149fd9[_0xf9df('0x2e')],_0x149fd9[_0xf9df('0x26')]);_0x9a0942[_0xf9df('0x2f')]=_[_0xf9df('0x2d')](_0x149fd9[_0xf9df('0x2e')],qs[_0xf9df('0x30')](_0x44ea11[_0xf9df('0x26')][_0xf9df('0x30')]));_0x9a0942[_0xf9df('0x2f')]=_0x9a0942[_0xf9df('0x2f')][_0xf9df('0x31')]?_0x9a0942[_0xf9df('0x2f')]:_0x149fd9[_0xf9df('0x2e')];if(_0x44ea11[_0xf9df('0x26')][_0xf9df('0x32')]){_0x9a0942['include']=[{'all':!![]}];}_0x9a0942=_[_0xf9df('0x33')]({},_0x9a0942,_0x44ea11[_0xf9df('0x34')]);return db[_0xf9df('0x21')][_0xf9df('0x35')](_0x9a0942)[_0xf9df('0x19')](handleEntityNotFound(_0x491531,null))['then'](respondWithResult(_0x491531,null))[_0xf9df('0x28')](handleError(_0x491531,null));};exports[_0xf9df('0x36')]=function(_0x56234e,_0x4054d7){return db[_0xf9df('0x21')][_0xf9df('0x36')](_0x56234e['body'],{})[_0xf9df('0x19')](respondWithResult(_0x4054d7,0xc9))[_0xf9df('0x28')](handleError(_0x4054d7,null));};exports[_0xf9df('0x37')]=function(_0x450786,_0xc00f3f){if(_0x450786[_0xf9df('0x38')]['id']){delete _0x450786['body']['id'];}return db[_0xf9df('0x21')]['find']({'where':{'id':_0x450786[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0xc00f3f,null))[_0xf9df('0x19')](saveUpdates(_0x450786[_0xf9df('0x38')],null))[_0xf9df('0x19')](respondWithResult(_0xc00f3f,null))[_0xf9df('0x28')](handleError(_0xc00f3f,null));};exports[_0xf9df('0x1a')]=function(_0x298cb5,_0x46495a){return db[_0xf9df('0x21')][_0xf9df('0x35')]({'where':{'id':_0x298cb5[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x46495a,null))[_0xf9df('0x19')](removeEntity(_0x46495a,null))['catch'](handleError(_0x46495a,null));};exports[_0xf9df('0x39')]=function(_0x21e378,_0xf6bb60){return db[_0xf9df('0x21')]['describe']()[_0xf9df('0x19')](respondWithResult(_0xf6bb60,null))['catch'](handleError(_0xf6bb60,null));};exports['addMessage']=function(_0x4ddee4,_0x5779a5){return db['MailMessage'][_0xf9df('0x35')]({'where':{'id':_0x4ddee4[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x5779a5,null))[_0xf9df('0x19')](function(_0x300245){if(_0x300245){return _0x300245[_0xf9df('0x3a')](_0x4ddee4[_0xf9df('0x38')][_0xf9df('0x3b')],_[_0xf9df('0x3c')](_0x4ddee4[_0xf9df('0x38')],[_0xf9df('0x3b'),'id'])||{});}})[_0xf9df('0x19')](respondWithResult(_0x5779a5,null))[_0xf9df('0x28')](handleError(_0x5779a5,null));};exports[_0xf9df('0x3d')]=function(_0x2c71a9,_0x5828cd){var _0x5a8e9c={'raw':![],'where':{}};var _0x2fbdae={};var _0x4eaee4={'count':0x0,'rows':[]};return db[_0xf9df('0x21')][_0xf9df('0x3e')]({'where':{'id':_0x2c71a9[_0xf9df('0x2a')]['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x5828cd,null))[_0xf9df('0x19')](function(_0x32c191){if(_0x32c191){_0x2fbdae[_0xf9df('0x2e')]=_[_0xf9df('0x2b')](db[_0xf9df('0x3f')][_0xf9df('0x2c')]);_0x2fbdae[_0xf9df('0x26')]=_[_0xf9df('0x2b')](_0x2c71a9['query']);_0x2fbdae['filters']=_[_0xf9df('0x2d')](_0x2fbdae[_0xf9df('0x2e')],_0x2fbdae[_0xf9df('0x26')]);_0x5a8e9c['attributes']=_[_0xf9df('0x2d')](_0x2fbdae['model'],qs[_0xf9df('0x30')](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x30')]));_0x5a8e9c[_0xf9df('0x2f')]=_0x5a8e9c[_0xf9df('0x2f')][_0xf9df('0x31')]?_0x5a8e9c[_0xf9df('0x2f')]:_0x2fbdae[_0xf9df('0x2e')];if(!_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x40')](_0xf9df('0x41'))){_0x5a8e9c[_0xf9df('0x15')]=qs[_0xf9df('0x15')](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x15')]);_0x5a8e9c[_0xf9df('0x13')]=qs[_0xf9df('0x13')](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x13')]);}_0x5a8e9c[_0xf9df('0x42')]=qs['sort'](_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x43')]);_0x5a8e9c['where']=qs[_0xf9df('0x44')](_[_0xf9df('0x45')](_0x2c71a9[_0xf9df('0x26')],_0x2fbdae[_0xf9df('0x44')]));_0x5a8e9c[_0xf9df('0x46')][_0xf9df('0x47')]=_0x32c191['id'];if(_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x48')]){_0x5a8e9c[_0xf9df('0x46')]=_[_0xf9df('0x33')](_0x5a8e9c[_0xf9df('0x46')],{'$or':_[_0xf9df('0x20')](_0x5a8e9c[_0xf9df('0x2f')],function(_0x22880c){var _0x5ee907={};_0x5ee907[_0x22880c]={'$like':'%'+_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x48')]+'%'};return _0x5ee907;})});}if(_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x49')]){var _0x35eae6=_0x2c71a9[_0xf9df('0x26')]['$gte']['split'](',');var _0x48d761={};_0x48d761[_0x35eae6[0x0]]={'$gte':moment(_0x35eae6[0x1])[_0xf9df('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a8e9c[_0xf9df('0x46')]=_['merge'](_0x5a8e9c['where'],_0x48d761);}_0x5a8e9c=_[_0xf9df('0x33')]({},_0x5a8e9c,_0x2c71a9[_0xf9df('0x34')]);return db[_0xf9df('0x3f')][_0xf9df('0x16')]({'where':_0x5a8e9c[_0xf9df('0x46')]})[_0xf9df('0x19')](function(_0x682dd5){_0x4eaee4[_0xf9df('0x16')]=_0x682dd5;if(_0x2c71a9['query'][_0xf9df('0x32')]){_0x5a8e9c['include']=[{'all':!![]}];}return db['MailMessage'][_0xf9df('0x24')](_0x5a8e9c);})[_0xf9df('0x19')](function(_0x312e14){if(_0x2c71a9[_0xf9df('0x26')][_0xf9df('0x4b')]===_0xf9df('0x4c')){for(var _0x29170b=0x0;_0x29170b<_0x312e14[_0xf9df('0x31')];_0x29170b++){_0x312e14[_0x29170b][_0xf9df('0x38')]=juice(_0x312e14[_0x29170b][_0xf9df('0x38')]);}}_0x4eaee4[_0xf9df('0x4d')]=_0x312e14;return _0x4eaee4;});}})[_0xf9df('0x19')](respondWithFilteredResult(_0x5828cd,_0x5a8e9c))[_0xf9df('0x28')](handleError(_0x5828cd,null));};exports[_0xf9df('0x4e')]=function(_0x301df0,_0x2c7379){return db[_0xf9df('0x21')][_0xf9df('0x35')]({'where':{'id':_0x301df0[_0xf9df('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2c7379,null))[_0xf9df('0x19')](function(_0x186eba){if(_0x186eba){return _0x186eba[_0xf9df('0x4f')](_0x301df0['body']['ids'],_['omit'](_0x301df0[_0xf9df('0x38')],['ids','id'])||{})[_0xf9df('0x50')](function(){return db[_0xf9df('0x51')]['findAll']({'attributes':['id',_0xf9df('0x1d'),_0xf9df('0x52')],'where':{'id':_0x301df0[_0xf9df('0x38')]['ids']}});})['then'](function(_0x430ae1){socket[_0xf9df('0x53')](_0xf9df('0x54'),{'id':Number(_0x301df0[_0xf9df('0x2a')]['id']),'tags':_0x430ae1||[]});return{'id':Number(_0x301df0[_0xf9df('0x2a')]['id']),'tags':_0x430ae1||[]};});}})[_0xf9df('0x19')](respondWithResult(_0x2c7379,null))['catch'](handleError(_0x2c7379,null));};exports[_0xf9df('0x55')]=function(_0x1f37c9,_0x298257){return db[_0xf9df('0x21')]['find']({'where':{'id':_0x1f37c9['params']['id']}})[_0xf9df('0x19')](handleEntityNotFound(_0x298257,null))['then'](function(_0x3b9d36){if(_0x3b9d36){return _0x3b9d36[_0xf9df('0x55')](_0x1f37c9[_0xf9df('0x26')][_0xf9df('0x3b')]);}})[_0xf9df('0x19')](respondWithStatusCode(_0x298257,null))[_0xf9df('0x28')](handleError(_0x298257,null));};exports['download']=function(_0x294cab,_0x5d3943){var _0x20cb22=moment()[_0xf9df('0x56')]()[_0xf9df('0x57')]();var _0x3d9aa0=path[_0xf9df('0x58')](config[_0xf9df('0x59')],'server',_0xf9df('0x5a'),_0xf9df('0x5b'));var _0x2dac98=path[_0xf9df('0x58')](config[_0xf9df('0x59')],_0xf9df('0x5c'),_0xf9df('0x5a'),'attachments');var _0x1945ad=path[_0xf9df('0x58')](_0x3d9aa0,_0x20cb22);var _0x45ab69=util[_0xf9df('0x4a')](_0xf9df('0x5d'),_0x294cab[_0xf9df('0x2a')]['id'],_0x20cb22);var _0x36e08b=path['join'](_0x3d9aa0,_0x45ab69);var _0x19df28=[];if(_0x294cab[_0xf9df('0x26')][_0xf9df('0x5e')]){_0x19df28['push']({'model':db[_0xf9df('0x5f')],'as':_0xf9df('0x60'),'raw':!![]});}var _0xabe3b2=[{'model':db[_0xf9df('0x3f')],'as':_0xf9df('0x61'),'attributes':['id',_0xf9df('0x38'),_0xf9df('0x62'),'to','cc',_0xf9df('0x63'),_0xf9df('0x64'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x19df28}];return db[_0xf9df('0x21')]['find']({'where':{'id':_0x294cab[_0xf9df('0x2a')]['id']},'include':_0xabe3b2})['then'](handleEntityNotFound(_0x5d3943,null))[_0xf9df('0x19')](function(_0x4e5717){if(_0x4e5717&&_0x4e5717[_0xf9df('0x61')]){var _0x28c977=_0x4e5717[_0xf9df('0x65')]({'plain':!![]});fs[_0xf9df('0x66')](_0x1945ad);return BPromise[_0xf9df('0x67')](_0x28c977['Messages'],function(_0x318e24,_0x2c593d){var _0x203e8f={'from':_0x318e24[_0xf9df('0x62')],'to':_0x318e24['to']||'missing.recipient@your.company.com','subject':_0x318e24[_0xf9df('0x64')],'html':htmlEntities['decode'](_0x318e24[_0xf9df('0x38')]),'headers':{'Date':moment(_0x318e24[_0xf9df('0x68')])['format'](_0xf9df('0x69'))},'attachments':[]};if(_0x318e24['cc']){_0x203e8f[_0xf9df('0x6a')]['Cc']=_0x318e24['cc'];}if(_0x318e24[_0xf9df('0x63')]){_0x203e8f[_0xf9df('0x6a')][_0xf9df('0x6b')]=_0x318e24[_0xf9df('0x63')];}return new BPromise(function(_0x76e3ab,_0x1be857){if(_0x318e24[_0xf9df('0x60')]){for(var _0x2e7e58=0x0;_0x2e7e58<_0x318e24['Attachments'][_0xf9df('0x31')];_0x2e7e58++){var _0x483e3f=_0x318e24[_0xf9df('0x60')][_0x2e7e58];var _0x411265=path[_0xf9df('0x58')](_0x2dac98,_0x483e3f[_0xf9df('0x6c')]);if(fs['existsSync'](_0x411265)){_0x203e8f[_0xf9df('0x5e')]['push']({'name':_0x483e3f['name'],'contentType':_0x483e3f[_0xf9df('0x22')],'data':fs['readFileSync'](_0x411265)});}}}emlformat['build'](_0x203e8f,function(_0x4dd673,_0x52c80d){if(_0x4dd673)return _0x1be857(_0x4dd673);fs[_0xf9df('0x6d')](path[_0xf9df('0x58')](_0x1945ad,util['format']('message%d.eml',_0x2c593d)),_0x52c80d);return _0x76e3ab(_0x52c80d);});});})[_0xf9df('0x19')](function(){return new BPromise(function(_0x43de6f,_0x318901){zipdir(_0x1945ad,{'saveTo':_0x36e08b},function(_0x11b5d1,_0x3b9093){if(_0x11b5d1)return _0x318901(_0x11b5d1);return _0x43de6f(_0x3b9093);});})[_0xf9df('0x19')](function(){return new BPromise(function(_0x252172,_0x5d0bb3){rimraf(_0x1945ad,function(_0x12efe4){if(_0x12efe4)_0x5d0bb3(_0x12efe4);return _0x252172();});});})['then'](function(){return _0x5d3943['download'](_0x36e08b,_0x45ab69,function(_0x586b73){if(!_0x586b73)fs[_0xf9df('0x6e')](_0x36e08b);});});});}else{return _0x5d3943['sendStatus'](0xc8);}})[_0xf9df('0x28')](handleError(_0x5d3943,null));}; \ No newline at end of file +var _0x8c9b=['getMessages','hasOwnProperty','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','download','toString','join','root','files','tmp','server','transcript-%d-%s.zip','attachments','push','Messages','bcc','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','readFileSync','build','writeFileSync','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','update','then','stack','name','send','map','MailInteraction','rawAttributes','type','getOptions','findAll','mail','query','user','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','catch','body','destroy','describe','addMessage','MailMessage','ids'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8c9b,0x10a));var _0xb8c9=function(_0x34bc5e,_0x538eb4){_0x34bc5e=_0x34bc5e-0x0;var _0x3e6969=_0x8c9b[_0x34bc5e];return _0x3e6969;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8c9('0x0'));var zipdir=require(_0xb8c9('0x1'));var moment=require(_0xb8c9('0x2'));var BPromise=require(_0xb8c9('0x3'));var util=require(_0xb8c9('0x4'));var path=require(_0xb8c9('0x5'));var fs=require('fs');var _=require(_0xb8c9('0x6'));var juice=require(_0xb8c9('0x7'));var Redis=require(_0xb8c9('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xb8c9('0x9'));var logger=require(_0xb8c9('0xa'))(_0xb8c9('0xb'));var config=require(_0xb8c9('0xc'));var db=require(_0xb8c9('0xd'))['db'];var htmlEntities=require(_0xb8c9('0xe'));config[_0xb8c9('0xf')]=_[_0xb8c9('0x10')](config[_0xb8c9('0xf')],{'host':_0xb8c9('0x11'),'port':0x18eb});var socket=require(_0xb8c9('0x12'))(new Redis(config['redis']));require(_0xb8c9('0x13'))[_0xb8c9('0x14')](socket);function respondWithStatusCode(_0x45d98a,_0x1f3ec7){_0x1f3ec7=_0x1f3ec7||0xcc;return function(_0x7fc821){if(_0x7fc821){return _0x45d98a[_0xb8c9('0x15')](_0x1f3ec7);}return _0x45d98a[_0xb8c9('0x16')](_0x1f3ec7)['end']();};}function respondWithResult(_0x2ae581,_0x15793a){_0x15793a=_0x15793a||0xc8;return function(_0x4b1604){if(_0x4b1604){return _0x2ae581[_0xb8c9('0x16')](_0x15793a)[_0xb8c9('0x17')](_0x4b1604);}};}function respondWithFilteredResult(_0xcceaef,_0x289131){return function(_0x10f36f){if(_0x10f36f){var _0x3d8e13=typeof _0x289131['offset']==='undefined'&&typeof _0x289131['limit']===_0xb8c9('0x18');var _0xc5587e=_0x10f36f[_0xb8c9('0x19')];var _0xdf724b=_0x3d8e13?0x0:_0x289131['offset'];var _0x36e4d6=_0x3d8e13?_0x10f36f[_0xb8c9('0x19')]:_0x289131[_0xb8c9('0x1a')]+_0x289131[_0xb8c9('0x1b')];var _0x2bc8a0;if(_0x36e4d6>=_0xc5587e){_0x36e4d6=_0xc5587e;_0x2bc8a0=0xc8;}else{_0x2bc8a0=0xce;}_0xcceaef[_0xb8c9('0x16')](_0x2bc8a0);return _0xcceaef[_0xb8c9('0x1c')]('Content-Range',_0xdf724b+'-'+_0x36e4d6+'/'+_0xc5587e)['json'](_0x10f36f);}return null;};}function saveUpdates(_0x8f5344){return function(_0x508399){if(_0x508399){return _0x508399[_0xb8c9('0x1d')](_0x8f5344)[_0xb8c9('0x1e')](function(_0x4af6f8){return _0x4af6f8;});}return null;};}function removeEntity(_0x33de68){return function(_0x529786){if(_0x529786){return _0x529786['destroy']()[_0xb8c9('0x1e')](function(){_0x33de68[_0xb8c9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1128ee){return function(_0x1ee169){if(!_0x1ee169){_0x1128ee['sendStatus'](0x194);}return _0x1ee169;};}function handleError(_0xf06f2e,_0x1fe6ba){_0x1fe6ba=_0x1fe6ba||0x1f4;return function(_0x2d4492){logger['error'](_0x2d4492[_0xb8c9('0x1f')]);if(_0x2d4492[_0xb8c9('0x20')]){delete _0x2d4492[_0xb8c9('0x20')];}_0xf06f2e['status'](_0x1fe6ba)[_0xb8c9('0x21')](_0x2d4492);};}exports['index']=function(_0x427f9c,_0x3f4acb){var _0x412527={};var _0x4b378b=_[_0xb8c9('0x22')](db[_0xb8c9('0x23')][_0xb8c9('0x24')],function(_0x4abdf1){return{'name':_0x4abdf1['fieldName'],'type':_0x4abdf1[_0xb8c9('0x25')]['key']};});_0x412527=qs[_0xb8c9('0x26')](_0x4b378b,_0x427f9c);return interaction[_0xb8c9('0x27')](_0xb8c9('0x28'),_0x427f9c[_0xb8c9('0x29')],_0x427f9c[_0xb8c9('0x2a')],_0x412527,_0x4b378b)[_0xb8c9('0x1e')](respondWithFilteredResult(_0x3f4acb,_0x412527))['catch'](handleError(_0x3f4acb,null));};exports['show']=function(_0x506f26,_0x1fb383){var _0x356032={'raw':![],'where':{'id':_0x506f26[_0xb8c9('0x2b')]['id']}},_0x700f21={};_0x700f21['model']=_['keys'](db[_0xb8c9('0x23')][_0xb8c9('0x24')]);_0x700f21[_0xb8c9('0x29')]=_[_0xb8c9('0x2c')](_0x506f26['query']);_0x700f21[_0xb8c9('0x2d')]=_[_0xb8c9('0x2e')](_0x700f21[_0xb8c9('0x2f')],_0x700f21[_0xb8c9('0x29')]);_0x356032[_0xb8c9('0x30')]=_['intersection'](_0x700f21[_0xb8c9('0x2f')],qs[_0xb8c9('0x31')](_0x506f26[_0xb8c9('0x29')][_0xb8c9('0x31')]));_0x356032[_0xb8c9('0x30')]=_0x356032['attributes'][_0xb8c9('0x32')]?_0x356032[_0xb8c9('0x30')]:_0x700f21[_0xb8c9('0x2f')];if(_0x506f26[_0xb8c9('0x29')][_0xb8c9('0x33')]){_0x356032[_0xb8c9('0x34')]=[{'all':!![]}];}_0x356032=_[_0xb8c9('0x35')]({},_0x356032,_0x506f26[_0xb8c9('0x36')]);return db[_0xb8c9('0x23')][_0xb8c9('0x37')](_0x356032)[_0xb8c9('0x1e')](handleEntityNotFound(_0x1fb383,null))[_0xb8c9('0x1e')](respondWithResult(_0x1fb383,null))['catch'](handleError(_0x1fb383,null));};exports[_0xb8c9('0x38')]=function(_0x3a274e,_0x626789){return db[_0xb8c9('0x23')][_0xb8c9('0x38')](_0x3a274e['body'],{})['then'](respondWithResult(_0x626789,0xc9))[_0xb8c9('0x39')](handleError(_0x626789,null));};exports['update']=function(_0x12e939,_0x938845){if(_0x12e939[_0xb8c9('0x3a')]['id']){delete _0x12e939[_0xb8c9('0x3a')]['id'];}return db['MailInteraction'][_0xb8c9('0x37')]({'where':{'id':_0x12e939[_0xb8c9('0x2b')]['id']}})[_0xb8c9('0x1e')](handleEntityNotFound(_0x938845,null))[_0xb8c9('0x1e')](saveUpdates(_0x12e939[_0xb8c9('0x3a')],null))[_0xb8c9('0x1e')](respondWithResult(_0x938845,null))[_0xb8c9('0x39')](handleError(_0x938845,null));};exports[_0xb8c9('0x3b')]=function(_0x26ee65,_0x290457){return db[_0xb8c9('0x23')][_0xb8c9('0x37')]({'where':{'id':_0x26ee65['params']['id']}})['then'](handleEntityNotFound(_0x290457,null))[_0xb8c9('0x1e')](removeEntity(_0x290457,null))['catch'](handleError(_0x290457,null));};exports[_0xb8c9('0x3c')]=function(_0x5cd81d,_0x18c90a){return db['MailInteraction'][_0xb8c9('0x3c')]()[_0xb8c9('0x1e')](respondWithResult(_0x18c90a,null))[_0xb8c9('0x39')](handleError(_0x18c90a,null));};exports[_0xb8c9('0x3d')]=function(_0x1f6b6d,_0x4a4c71){return db[_0xb8c9('0x3e')]['find']({'where':{'id':_0x1f6b6d[_0xb8c9('0x2b')]['id']}})[_0xb8c9('0x1e')](handleEntityNotFound(_0x4a4c71,null))[_0xb8c9('0x1e')](function(_0x184b32){if(_0x184b32){return _0x184b32[_0xb8c9('0x3d')](_0x1f6b6d[_0xb8c9('0x3a')][_0xb8c9('0x3f')],_['omit'](_0x1f6b6d['body'],[_0xb8c9('0x3f'),'id'])||{});}})[_0xb8c9('0x1e')](respondWithResult(_0x4a4c71,null))[_0xb8c9('0x39')](handleError(_0x4a4c71,null));};exports[_0xb8c9('0x40')]=function(_0x5a212f,_0x25b4c3){var _0x166742={'raw':![],'where':{}};var _0x2e3cbe={};var _0x3b138a={'count':0x0,'rows':[]};return db[_0xb8c9('0x23')]['findOne']({'where':{'id':_0x5a212f[_0xb8c9('0x2b')]['id']}})[_0xb8c9('0x1e')](handleEntityNotFound(_0x25b4c3,null))[_0xb8c9('0x1e')](function(_0x122027){if(_0x122027){_0x2e3cbe['model']=_[_0xb8c9('0x2c')](db['MailMessage'][_0xb8c9('0x24')]);_0x2e3cbe[_0xb8c9('0x29')]=_[_0xb8c9('0x2c')](_0x5a212f[_0xb8c9('0x29')]);_0x2e3cbe[_0xb8c9('0x2d')]=_[_0xb8c9('0x2e')](_0x2e3cbe[_0xb8c9('0x2f')],_0x2e3cbe[_0xb8c9('0x29')]);_0x166742[_0xb8c9('0x30')]=_[_0xb8c9('0x2e')](_0x2e3cbe[_0xb8c9('0x2f')],qs[_0xb8c9('0x31')](_0x5a212f[_0xb8c9('0x29')]['fields']));_0x166742[_0xb8c9('0x30')]=_0x166742[_0xb8c9('0x30')][_0xb8c9('0x32')]?_0x166742[_0xb8c9('0x30')]:_0x2e3cbe['model'];if(!_0x5a212f[_0xb8c9('0x29')][_0xb8c9('0x41')]('nolimit')){_0x166742[_0xb8c9('0x1b')]=qs[_0xb8c9('0x1b')](_0x5a212f['query'][_0xb8c9('0x1b')]);_0x166742[_0xb8c9('0x1a')]=qs[_0xb8c9('0x1a')](_0x5a212f[_0xb8c9('0x29')][_0xb8c9('0x1a')]);}_0x166742[_0xb8c9('0x42')]=qs[_0xb8c9('0x43')](_0x5a212f[_0xb8c9('0x29')][_0xb8c9('0x43')]);_0x166742[_0xb8c9('0x44')]=qs[_0xb8c9('0x2d')](_[_0xb8c9('0x45')](_0x5a212f[_0xb8c9('0x29')],_0x2e3cbe[_0xb8c9('0x2d')]));_0x166742[_0xb8c9('0x44')]['MailInteractionId']=_0x122027['id'];if(_0x5a212f[_0xb8c9('0x29')][_0xb8c9('0x46')]){_0x166742[_0xb8c9('0x44')]=_[_0xb8c9('0x35')](_0x166742[_0xb8c9('0x44')],{'$or':_[_0xb8c9('0x22')](_0x166742[_0xb8c9('0x30')],function(_0x584856){var _0x5dfadd={};_0x5dfadd[_0x584856]={'$like':'%'+_0x5a212f[_0xb8c9('0x29')][_0xb8c9('0x46')]+'%'};return _0x5dfadd;})});}if(_0x5a212f[_0xb8c9('0x29')]['$gte']){var _0x4f201b=_0x5a212f[_0xb8c9('0x29')][_0xb8c9('0x47')][_0xb8c9('0x48')](',');var _0x1df660={};_0x1df660[_0x4f201b[0x0]]={'$gte':moment(_0x4f201b[0x1])[_0xb8c9('0x49')](_0xb8c9('0x4a'))};_0x166742[_0xb8c9('0x44')]=_[_0xb8c9('0x35')](_0x166742[_0xb8c9('0x44')],_0x1df660);}_0x166742=_['merge']({},_0x166742,_0x5a212f[_0xb8c9('0x36')]);return db['MailMessage'][_0xb8c9('0x19')]({'where':_0x166742[_0xb8c9('0x44')]})[_0xb8c9('0x1e')](function(_0x345175){_0x3b138a['count']=_0x345175;if(_0x5a212f['query'][_0xb8c9('0x33')]){_0x166742[_0xb8c9('0x34')]=[{'all':!![]}];}return db[_0xb8c9('0x3e')][_0xb8c9('0x27')](_0x166742);})[_0xb8c9('0x1e')](function(_0x5d1dee){if(_0x5a212f[_0xb8c9('0x29')][_0xb8c9('0x4b')]===_0xb8c9('0x4c')){for(var _0x325bd8=0x0;_0x325bd8<_0x5d1dee[_0xb8c9('0x32')];_0x325bd8++){_0x5d1dee[_0x325bd8][_0xb8c9('0x3a')]=juice(_0x5d1dee[_0x325bd8]['body']);}}_0x3b138a['rows']=_0x5d1dee;return _0x3b138a;});}})[_0xb8c9('0x1e')](respondWithFilteredResult(_0x25b4c3,_0x166742))['catch'](handleError(_0x25b4c3,null));};exports[_0xb8c9('0x4d')]=function(_0x138ba5,_0x1c9676){return db['MailInteraction'][_0xb8c9('0x37')]({'where':{'id':_0x138ba5['params']['id']}})[_0xb8c9('0x1e')](handleEntityNotFound(_0x1c9676,null))[_0xb8c9('0x1e')](function(_0x56e0f3){if(_0x56e0f3){return _0x56e0f3['setTags'](_0x138ba5[_0xb8c9('0x3a')][_0xb8c9('0x3f')],_[_0xb8c9('0x4e')](_0x138ba5[_0xb8c9('0x3a')],[_0xb8c9('0x3f'),'id'])||{})[_0xb8c9('0x4f')](function(){return db[_0xb8c9('0x50')]['findAll']({'attributes':['id',_0xb8c9('0x20'),'color'],'where':{'id':_0x138ba5[_0xb8c9('0x3a')][_0xb8c9('0x3f')]}});})[_0xb8c9('0x1e')](function(_0x1fe198){socket[_0xb8c9('0x51')](_0xb8c9('0x52'),{'id':Number(_0x138ba5['params']['id']),'tags':_0x1fe198||[]});return{'id':Number(_0x138ba5[_0xb8c9('0x2b')]['id']),'tags':_0x1fe198||[]};});}})[_0xb8c9('0x1e')](respondWithResult(_0x1c9676,null))[_0xb8c9('0x39')](handleError(_0x1c9676,null));};exports['removeTags']=function(_0x20428a,_0x51cbf7){return db[_0xb8c9('0x23')][_0xb8c9('0x37')]({'where':{'id':_0x20428a[_0xb8c9('0x2b')]['id']}})[_0xb8c9('0x1e')](handleEntityNotFound(_0x51cbf7,null))[_0xb8c9('0x1e')](function(_0x59438f){if(_0x59438f){return _0x59438f[_0xb8c9('0x53')](_0x20428a['query'][_0xb8c9('0x3f')]);}})['then'](respondWithStatusCode(_0x51cbf7,null))[_0xb8c9('0x39')](handleError(_0x51cbf7,null));};exports[_0xb8c9('0x54')]=function(_0x30b840,_0x3dbb77){var _0x2ff6c1=moment()['unix']()[_0xb8c9('0x55')]();var _0x55c9a4=path[_0xb8c9('0x56')](config[_0xb8c9('0x57')],'server',_0xb8c9('0x58'),_0xb8c9('0x59'));var _0xf11ae7=path[_0xb8c9('0x56')](config[_0xb8c9('0x57')],_0xb8c9('0x5a'),'files','attachments');var _0x5b053a=path['join'](_0x55c9a4,_0x2ff6c1);var _0x5e527b=util[_0xb8c9('0x49')](_0xb8c9('0x5b'),_0x30b840[_0xb8c9('0x2b')]['id'],_0x2ff6c1);var _0xf3d08b=path['join'](_0x55c9a4,_0x5e527b);var _0x13e17e=[];if(_0x30b840[_0xb8c9('0x29')][_0xb8c9('0x5c')]){_0x13e17e[_0xb8c9('0x5d')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x17f2fb=[{'model':db['MailMessage'],'as':_0xb8c9('0x5e'),'attributes':['id','body','from','to','cc',_0xb8c9('0x5f'),_0xb8c9('0x60'),_0xb8c9('0x61')],'where':{'secret':![]},'order':qs[_0xb8c9('0x43')]('id'),'include':_0x13e17e}];return db[_0xb8c9('0x23')][_0xb8c9('0x37')]({'where':{'id':_0x30b840[_0xb8c9('0x2b')]['id']},'include':_0x17f2fb})[_0xb8c9('0x1e')](handleEntityNotFound(_0x3dbb77,null))[_0xb8c9('0x1e')](function(_0xbe2ee3){if(_0xbe2ee3&&_0xbe2ee3[_0xb8c9('0x5e')]){var _0x43187f=_0xbe2ee3['get']({'plain':!![]});fs[_0xb8c9('0x62')](_0x5b053a);return BPromise[_0xb8c9('0x63')](_0x43187f[_0xb8c9('0x5e')],function(_0x208101,_0x453349){var _0x1c12c6={'from':_0x208101['from'],'to':_0x208101['to']||_0xb8c9('0x64'),'subject':_0x208101[_0xb8c9('0x60')],'html':htmlEntities[_0xb8c9('0x65')](_0x208101['body']),'headers':{'Date':moment(_0x208101[_0xb8c9('0x61')])[_0xb8c9('0x49')](_0xb8c9('0x66'))},'attachments':[]};if(_0x208101['cc']){_0x1c12c6[_0xb8c9('0x67')]['Cc']=_0x208101['cc'];}if(_0x208101[_0xb8c9('0x5f')]){_0x1c12c6[_0xb8c9('0x67')]['Bcc']=_0x208101['bcc'];}return new BPromise(function(_0x2c61b4,_0x4ff801){if(_0x208101['Attachments']){for(var _0x8ee00=0x0;_0x8ee00<_0x208101[_0xb8c9('0x68')]['length'];_0x8ee00++){var _0x367cb5=_0x208101[_0xb8c9('0x68')][_0x8ee00];var _0x51f7db=path[_0xb8c9('0x56')](_0xf11ae7,_0x367cb5['basename']);if(fs[_0xb8c9('0x69')](_0x51f7db)){_0x1c12c6['attachments']['push']({'name':_0x367cb5[_0xb8c9('0x20')],'contentType':_0x367cb5[_0xb8c9('0x25')],'data':fs[_0xb8c9('0x6a')](_0x51f7db)});}}}emlformat[_0xb8c9('0x6b')](_0x1c12c6,function(_0x18a5c1,_0x38f3d8){if(_0x18a5c1)return _0x4ff801(_0x18a5c1);fs[_0xb8c9('0x6c')](path[_0xb8c9('0x56')](_0x5b053a,util[_0xb8c9('0x49')]('message%d.eml',_0x453349)),_0x38f3d8);return _0x2c61b4(_0x38f3d8);});});})[_0xb8c9('0x1e')](function(){return new BPromise(function(_0x341dec,_0x4a70f8){zipdir(_0x5b053a,{'saveTo':_0xf3d08b},function(_0x38cb8b,_0x52d8d0){if(_0x38cb8b)return _0x4a70f8(_0x38cb8b);return _0x341dec(_0x52d8d0);});})[_0xb8c9('0x1e')](function(){return new BPromise(function(_0x5d0735,_0x152d0a){rimraf(_0x5b053a,function(_0x3d883b){if(_0x3d883b)_0x152d0a(_0x3d883b);return _0x5d0735();});});})[_0xb8c9('0x1e')](function(){return _0x3dbb77[_0xb8c9('0x54')](_0xf3d08b,_0x5e527b,function(_0x62cf02){if(!_0x62cf02)fs[_0xb8c9('0x6d')](_0xf3d08b);});});});}else{return _0x3dbb77[_0xb8c9('0x15')](0xc8);}})[_0xb8c9('0x39')](handleError(_0x3dbb77,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e7b96c7..930270f 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 _0x3a75=['MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5d74a3,_0x13fcbc){var _0xc7c572=function(_0x52232f){while(--_0x52232f){_0x5d74a3['push'](_0x5d74a3['shift']());}};_0xc7c572(++_0x13fcbc);}(_0x3a75,0x1b3));var _0x53a7=function(_0x565813,_0x2378b0){_0x565813=_0x565813-0x0;var _0x31d9ca=_0x3a75[_0x565813];return _0x31d9ca;};'use strict';var EventEmitter=require(_0x53a7('0x0'));var MailInteraction=require(_0x53a7('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x53a7('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x53a7('0x3')](0x0);var events={'afterCreate':_0x53a7('0x4'),'afterUpdate':_0x53a7('0x5'),'afterDestroy':'remove'};function emitEvent(_0xcd6d2e){return function(_0x6a060d,_0x5824c3,_0x50ecd8){_0x6a060d[_0x53a7('0x6')]({'attributes':['id'],'raw':!![]})[_0x53a7('0x7')](function(_0xe18408){_0x6a060d[_0x53a7('0x8')](_0x53a7('0x9'),_0xe18408[_0x53a7('0xa')](function(_0x17c138){return{'id':_0x17c138['id']};}));return MailMessage[_0x53a7('0xb')]({'where':{'MailInteractionId':_0x6a060d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53a7('0x7')](function(_0x2a70d3){_0x6a060d['setDataValue'](_0x53a7('0xc'),_0x2a70d3[_0x53a7('0xd')]);MailInteractionEvents[_0x53a7('0xe')](_0xcd6d2e+':'+_0x6a060d['id'],_0x6a060d);MailInteractionEvents['emit'](_0xcd6d2e,_0x6a060d);_0x50ecd8(null);})[_0x53a7('0xf')](_0x50ecd8(null));};}for(var e in events){if(events[_0x53a7('0x10')](e)){var event=events[e];MailInteraction[_0x53a7('0x11')](e,emitEvent(event));}}module[_0x53a7('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x0afd=['setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','emit','hook','exports','events','../../mysqldb','MailInteraction','MailMessage'];(function(_0x1f2e32,_0x35a52f){var _0x3e28fe=function(_0xf78d9b){while(--_0xf78d9b){_0x1f2e32['push'](_0x1f2e32['shift']());}};_0x3e28fe(++_0x35a52f);}(_0x0afd,0x1a5));var _0xd0af=function(_0x547205,_0x2513f8){_0x547205=_0x547205-0x0;var _0x217590=_0x0afd[_0x547205];return _0x217590;};'use strict';var EventEmitter=require(_0xd0af('0x0'));var MailInteraction=require(_0xd0af('0x1'))['db'][_0xd0af('0x2')];var MailMessage=require(_0xd0af('0x1'))['db'][_0xd0af('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd0af('0x4')](0x0);var events={'afterCreate':_0xd0af('0x5'),'afterUpdate':_0xd0af('0x6'),'afterDestroy':_0xd0af('0x7')};function emitEvent(_0x68000d){return function(_0x416126,_0x5474b4,_0xf6fae4){_0x416126['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x14407d){_0x416126[_0xd0af('0x8')](_0xd0af('0x9'),_0x14407d[_0xd0af('0xa')](function(_0x4a40f1){return{'id':_0x4a40f1['id']};}));return MailMessage[_0xd0af('0xb')]({'where':{'MailInteractionId':_0x416126['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd0af('0xc')](function(_0x198b29){_0x416126[_0xd0af('0x8')](_0xd0af('0xd'),_0x198b29['length']);MailInteractionEvents[_0xd0af('0xe')](_0x68000d+':'+_0x416126['id'],_0x416126);MailInteractionEvents['emit'](_0x68000d,_0x416126);_0xf6fae4(null);})['catch'](_0xf6fae4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd0af('0xf')](e,emitEvent(event));}}module[_0xd0af('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a0eabbd..be306a9 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 _0x8efd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatus','substatusAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5de818,_0x7c4485){var _0x345670=function(_0x5e268d){while(--_0x5e268d){_0x5de818['push'](_0x5de818['shift']());}};_0x345670(++_0x7c4485);}(_0x8efd,0x1cf));var _0xd8ef=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8efd[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd8ef('0x0'));var util=require(_0xd8ef('0x1'));var logger=require(_0xd8ef('0x2'))(_0xd8ef('0x3'));var moment=require(_0xd8ef('0x4'));var BPromise=require(_0xd8ef('0x5'));var rp=require(_0xd8ef('0x6'));var fs=require('fs');var path=require(_0xd8ef('0x7'));var rimraf=require(_0xd8ef('0x8'));var config=require(_0xd8ef('0x9'));var attributes=require(_0xd8ef('0xa'));module['exports']=function(_0x11d5a1,_0x218fd4){return _0x11d5a1[_0xd8ef('0xb')](_0xd8ef('0xc'),attributes,{'tableName':_0xd8ef('0xd'),'paranoid':![],'indexes':[{'name':_0xd8ef('0xe'),'fields':['subject','to'],'type':_0xd8ef('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50244d,_0x20f756,_0x52dfa3){if(_0x50244d['substatus']){_0x50244d['substatusAt']=moment()['format'](_0xd8ef('0x10'));}if(_0x50244d[_0xd8ef('0x11')]){_0x50244d[_0xd8ef('0x12')]=moment()[_0xd8ef('0x13')](_0xd8ef('0x10'));}_0x52dfa3(null,_0x20f756);},'beforeUpdate':function(_0x26cc9f,_0x4e8ec6,_0x1276a9){if(_0x26cc9f[_0xd8ef('0x14')](_0xd8ef('0x15'))){_0x26cc9f[_0xd8ef('0x16')]=_0x26cc9f[_0xd8ef('0x15')]?moment()[_0xd8ef('0x13')](_0xd8ef('0x10')):null;}if(_0x26cc9f[_0xd8ef('0x14')](_0xd8ef('0x11'))){_0x26cc9f['closedAt']=moment()[_0xd8ef('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x26cc9f[_0xd8ef('0x15')]=null;_0x26cc9f['substatusAt']=null;}_0x1276a9(null,_0x26cc9f);},'afterUpdate':function(_0x34217d,_0x2e573c,_0x3d10bc){var _0xd1d20b=_0x11d5a1[_0xd8ef('0x17')];var _0x9cb2f9=_0x34217d[_0xd8ef('0x18')]({'plain':!![]});if(_0x9cb2f9[_0xd8ef('0x11')]){return _0xd1d20b[_0xd8ef('0x19')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x9cb2f9['id']}})[_0xd8ef('0x1a')](function(){_0x3d10bc();})['catch'](function(_0x2460f7){_0x3d10bc(_0x2460f7);});}else{_0x3d10bc();}}},'charset':_0xd8ef('0x1b'),'collate':_0xd8ef('0x1c')});}; \ No newline at end of file +var _0x726a=['subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x726a,0x1b6));var _0xa726=function(_0x2efefb,_0x420acb){_0x2efefb=_0x2efefb-0x0;var _0xc4b7f9=_0x726a[_0x2efefb];return _0xc4b7f9;};'use strict';var _=require(_0xa726('0x0'));var util=require(_0xa726('0x1'));var logger=require(_0xa726('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa726('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa726('0x4'));var rimraf=require(_0xa726('0x5'));var config=require(_0xa726('0x6'));var attributes=require(_0xa726('0x7'));module[_0xa726('0x8')]=function(_0x5d9e65,_0x28a312){return _0x5d9e65[_0xa726('0x9')]('MailInteraction',attributes,{'tableName':_0xa726('0xa'),'paranoid':![],'indexes':[{'name':_0xa726('0xb'),'fields':[_0xa726('0xc'),'to'],'type':_0xa726('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47659c,_0x279078,_0xdd877f){if(_0x47659c[_0xa726('0xe')]){_0x47659c[_0xa726('0xf')]=moment()[_0xa726('0x10')](_0xa726('0x11'));}if(_0x47659c[_0xa726('0x12')]){_0x47659c[_0xa726('0x13')]=moment()[_0xa726('0x10')](_0xa726('0x11'));}_0xdd877f(null,_0x279078);},'beforeUpdate':function(_0x4c1c71,_0x1ac0d2,_0x2bc29b){if(_0x4c1c71['changed']('substatus')){_0x4c1c71[_0xa726('0xf')]=_0x4c1c71[_0xa726('0xe')]?moment()[_0xa726('0x10')](_0xa726('0x11')):null;}if(_0x4c1c71[_0xa726('0x14')](_0xa726('0x12'))){_0x4c1c71[_0xa726('0x13')]=moment()[_0xa726('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c1c71[_0xa726('0xe')]=null;_0x4c1c71[_0xa726('0xf')]=null;}_0x2bc29b(null,_0x4c1c71);},'afterUpdate':function(_0x1a5c53,_0x28c48a,_0x50a423){var _0xc19fec=_0x5d9e65['models'];var _0x54e13e=_0x1a5c53['get']({'plain':!![]});if(_0x54e13e['closed']){return _0xc19fec[_0xa726('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x54e13e['id']}})[_0xa726('0x16')](function(){_0x50a423();})['catch'](function(_0x12a45e){_0x50a423(_0x12a45e);});}else{_0x50a423();}}},'charset':_0xa726('0x17'),'collate':_0xa726('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 84cf7b4..ac66704 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 _0x2b67=['http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','body','options','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','ids','omit','AddTags','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x179f5b,_0x56fee9){var _0x34a4ed=function(_0x1a3e44){while(--_0x1a3e44){_0x179f5b['push'](_0x179f5b['shift']());}};_0x34a4ed(++_0x56fee9);}(_0x2b67,0x67));var _0x72b6=function(_0x20e458,_0x265875){_0x20e458=_0x20e458-0x0;var _0x5c4296=_0x2b67[_0x20e458];return _0x5c4296;};'use strict';var _=require(_0x72b6('0x0'));var util=require('util');var moment=require(_0x72b6('0x1'));var BPromise=require(_0x72b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x72b6('0x4'))(_0x72b6('0x5'));var config=require(_0x72b6('0x6'));var jayson=require(_0x72b6('0x7'));var client=jayson['client'][_0x72b6('0x8')]({'port':0x232a});config[_0x72b6('0x9')]=_[_0x72b6('0xa')](config[_0x72b6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x72b6('0xb'))(new Redis(config[_0x72b6('0x9')]));require(_0x72b6('0xc'))[_0x72b6('0xd')](socket);function respondWithRpcPromise(_0x319c13,_0x392a3a,_0x5a5253){return new BPromise(function(_0x1a7a0f,_0x5e8376){return client[_0x72b6('0xe')](_0x319c13,_0x5a5253)[_0x72b6('0xf')](function(_0x6774f2){logger[_0x72b6('0x10')]('MailInteraction,\x20%s,\x20%s',_0x392a3a,'request\x20sent');logger[_0x72b6('0x11')](_0x72b6('0x12'),_0x392a3a,_0x72b6('0x13'),JSON[_0x72b6('0x14')](_0x6774f2));if(_0x6774f2[_0x72b6('0x15')]){if(_0x6774f2[_0x72b6('0x15')]['code']===0x1f4){logger[_0x72b6('0x15')](_0x72b6('0x16'),_0x392a3a,_0x6774f2[_0x72b6('0x15')][_0x72b6('0x17')]);return _0x5e8376(_0x6774f2[_0x72b6('0x15')]['message']);}logger[_0x72b6('0x15')](_0x72b6('0x16'),_0x392a3a,_0x6774f2[_0x72b6('0x15')]['message']);return _0x1a7a0f(_0x6774f2[_0x72b6('0x15')][_0x72b6('0x17')]);}else{logger[_0x72b6('0x10')](_0x72b6('0x16'),_0x392a3a,_0x72b6('0x13'));_0x1a7a0f(_0x6774f2[_0x72b6('0x18')][_0x72b6('0x17')]);}})[_0x72b6('0x19')](function(_0x152966){logger['error'](_0x72b6('0x16'),_0x392a3a,_0x152966);_0x5e8376(_0x152966);});});}exports['UpdateMailInteraction']=function(_0x141fe2){var _0x3c8d3e=this;return new Promise(function(_0x1735cd,_0x55367f){return db[_0x72b6('0x1a')]['update'](_0x141fe2[_0x72b6('0x1b')],{'raw':_0x141fe2[_0x72b6('0x1c')]?_0x141fe2[_0x72b6('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141fe2[_0x72b6('0x1c')]?_0x141fe2[_0x72b6('0x1c')][_0x72b6('0x1d')]||null:null,'attributes':_0x141fe2['options']?_0x141fe2['options'][_0x72b6('0x1e')]||null:null,'limit':_0x141fe2['options']?_0x141fe2[_0x72b6('0x1c')][_0x72b6('0x1f')]||null:null})[_0x72b6('0xf')](function(_0x44ee5b){logger['info'](_0x72b6('0x20'),_0x141fe2);logger[_0x72b6('0x11')]('UpdateMailInteraction',_0x141fe2,JSON[_0x72b6('0x14')](_0x44ee5b));_0x1735cd(_0x44ee5b);})[_0x72b6('0x19')](function(_0x590a97){logger['error']('UpdateMailInteraction',_0x590a97[_0x72b6('0x17')],_0x141fe2);_0x55367f(_0x3c8d3e['error'](0x1f4,_0x590a97[_0x72b6('0x17')]));});});};exports[_0x72b6('0x21')]=function(_0x58afe5){return new Promise(function(_0x22a3d3,_0x5a8cc4){return db[_0x72b6('0x1a')]['find']({'where':_0x58afe5[_0x72b6('0x1c')]?_0x58afe5['options']['where']||null:null})[_0x72b6('0xf')](function(_0x452ba9){if(_0x452ba9){return _0x452ba9['addTags'](_0x58afe5['body'][_0x72b6('0x22')],_[_0x72b6('0x23')](_0x58afe5[_0x72b6('0x1b')],[_0x72b6('0x22'),'id'])||{});}})['spread'](function(_0x7a0d5){logger[_0x72b6('0x10')](_0x72b6('0x24'),_0x58afe5);logger[_0x72b6('0x11')]('AddTags',_0x58afe5,JSON[_0x72b6('0x14')](_0x7a0d5));_0x22a3d3(_0x7a0d5);})[_0x72b6('0x19')](function(_0x57af31){logger[_0x72b6('0x15')]('AddTags',_0x57af31[_0x72b6('0x17')],_0x58afe5);_0x5a8cc4(_this[_0x72b6('0x15')](0x1f4,_0x57af31[_0x72b6('0x17')]));});});}; \ No newline at end of file +var _0xd9f4=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x35d331,_0x4178f6){var _0x609115=function(_0x152043){while(--_0x152043){_0x35d331['push'](_0x35d331['shift']());}};_0x609115(++_0x4178f6);}(_0xd9f4,0x7b));var _0x4d9f=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xd9f4[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0x4d9f('0x0'));var util=require(_0x4d9f('0x1'));var moment=require(_0x4d9f('0x2'));var BPromise=require(_0x4d9f('0x3'));var rs=require(_0x4d9f('0x4'));var fs=require('fs');var Redis=require(_0x4d9f('0x5'));var db=require(_0x4d9f('0x6'))['db'];var utils=require(_0x4d9f('0x7'));var logger=require(_0x4d9f('0x8'))(_0x4d9f('0x9'));var config=require(_0x4d9f('0xa'));var jayson=require(_0x4d9f('0xb'));var client=jayson[_0x4d9f('0xc')][_0x4d9f('0xd')]({'port':0x232a});config[_0x4d9f('0xe')]=_[_0x4d9f('0xf')](config[_0x4d9f('0xe')],{'host':_0x4d9f('0x10'),'port':0x18eb});var socket=require(_0x4d9f('0x11'))(new Redis(config[_0x4d9f('0xe')]));require('./mailInteraction.socket')[_0x4d9f('0x12')](socket);function respondWithRpcPromise(_0x39dc5b,_0x1aba6b,_0x5d5ad1){return new BPromise(function(_0xb1659c,_0x5687ff){return client[_0x4d9f('0x13')](_0x39dc5b,_0x5d5ad1)[_0x4d9f('0x14')](function(_0x1deeee){logger[_0x4d9f('0x15')]('MailInteraction,\x20%s,\x20%s',_0x1aba6b,_0x4d9f('0x16'));logger[_0x4d9f('0x17')](_0x4d9f('0x18'),_0x1aba6b,_0x4d9f('0x16'),JSON[_0x4d9f('0x19')](_0x1deeee));if(_0x1deeee[_0x4d9f('0x1a')]){if(_0x1deeee['error']['code']===0x1f4){logger[_0x4d9f('0x1a')](_0x4d9f('0x1b'),_0x1aba6b,_0x1deeee['error']['message']);return _0x5687ff(_0x1deeee[_0x4d9f('0x1a')][_0x4d9f('0x1c')]);}logger[_0x4d9f('0x1a')](_0x4d9f('0x1b'),_0x1aba6b,_0x1deeee[_0x4d9f('0x1a')][_0x4d9f('0x1c')]);return _0xb1659c(_0x1deeee[_0x4d9f('0x1a')][_0x4d9f('0x1c')]);}else{logger['info'](_0x4d9f('0x1b'),_0x1aba6b,_0x4d9f('0x16'));_0xb1659c(_0x1deeee[_0x4d9f('0x1d')][_0x4d9f('0x1c')]);}})[_0x4d9f('0x1e')](function(_0x297b30){logger[_0x4d9f('0x1a')](_0x4d9f('0x1b'),_0x1aba6b,_0x297b30);_0x5687ff(_0x297b30);});});}exports['UpdateMailInteraction']=function(_0x41811e){var _0x2eab4f=this;return new Promise(function(_0x2c7843,_0x2af0ab){return db[_0x4d9f('0x1f')][_0x4d9f('0x20')](_0x41811e[_0x4d9f('0x21')],{'raw':_0x41811e[_0x4d9f('0x22')]?_0x41811e[_0x4d9f('0x22')][_0x4d9f('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41811e[_0x4d9f('0x22')]?_0x41811e[_0x4d9f('0x22')][_0x4d9f('0x24')]||null:null,'attributes':_0x41811e[_0x4d9f('0x22')]?_0x41811e[_0x4d9f('0x22')][_0x4d9f('0x25')]||null:null,'limit':_0x41811e[_0x4d9f('0x22')]?_0x41811e[_0x4d9f('0x22')][_0x4d9f('0x26')]||null:null})['then'](function(_0x17f3e8){logger['info'](_0x4d9f('0x27'),_0x41811e);logger[_0x4d9f('0x17')](_0x4d9f('0x27'),_0x41811e,JSON['stringify'](_0x17f3e8));_0x2c7843(_0x17f3e8);})[_0x4d9f('0x1e')](function(_0x56f989){logger[_0x4d9f('0x1a')](_0x4d9f('0x27'),_0x56f989[_0x4d9f('0x1c')],_0x41811e);_0x2af0ab(_0x2eab4f[_0x4d9f('0x1a')](0x1f4,_0x56f989[_0x4d9f('0x1c')]));});});};exports[_0x4d9f('0x28')]=function(_0x4be6b9){return new Promise(function(_0x50b09b,_0x191e3b){return db[_0x4d9f('0x1f')]['find']({'where':_0x4be6b9[_0x4d9f('0x22')]?_0x4be6b9[_0x4d9f('0x22')][_0x4d9f('0x24')]||null:null})['then'](function(_0x1e0f9c){if(_0x1e0f9c){return _0x1e0f9c[_0x4d9f('0x29')](_0x4be6b9[_0x4d9f('0x21')][_0x4d9f('0x2a')],_['omit'](_0x4be6b9[_0x4d9f('0x21')],[_0x4d9f('0x2a'),'id'])||{});}})[_0x4d9f('0x2b')](function(_0x51fcaf){logger['info'](_0x4d9f('0x2c'),_0x4be6b9);logger[_0x4d9f('0x17')](_0x4d9f('0x2c'),_0x4be6b9,JSON[_0x4d9f('0x19')](_0x51fcaf));_0x50b09b(_0x51fcaf);})[_0x4d9f('0x1e')](function(_0x3bd4c0){logger[_0x4d9f('0x1a')](_0x4d9f('0x2c'),_0x3bd4c0['message'],_0x4be6b9);_0x191e3b(_this[_0x4d9f('0x1a')](0x1f4,_0x3bd4c0[_0x4d9f('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 63ec87e..1867d5b 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 _0xa305=['./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x30994d,_0x2cc269){var _0x4554df=function(_0x125125){while(--_0x125125){_0x30994d['push'](_0x30994d['shift']());}};_0x4554df(++_0x2cc269);}(_0xa305,0xc0));var _0x5a30=function(_0x1bc111,_0x366640){_0x1bc111=_0x1bc111-0x0;var _0x10b114=_0xa305[_0x1bc111];return _0x10b114;};'use strict';var MailInteractionEvents=require(_0x5a30('0x0'));var events=[_0x5a30('0x1'),_0x5a30('0x2'),_0x5a30('0x3')];function createListener(_0x51bf57,_0x2b729e){return function(_0x2523c1){_0x2b729e[_0x5a30('0x4')](_0x51bf57,_0x2523c1);};}function removeListener(_0x1e0d3d,_0x3508eb){return function(){MailInteractionEvents[_0x5a30('0x5')](_0x1e0d3d,_0x3508eb);};}exports['register']=function(_0x590790){for(var _0x4d3862=0x0,_0x3d9407=events['length'];_0x4d3862<_0x3d9407;_0x4d3862++){var _0x21da17=events[_0x4d3862];var _0x13bfcb=createListener('mailInteraction:'+_0x21da17,_0x590790);MailInteractionEvents['on'](_0x21da17,_0x13bfcb);}}; \ No newline at end of file +var _0xce08=['remove','update','register','length','mailInteraction:'];(function(_0x29271a,_0x232277){var _0x10dc39=function(_0x473a6d){while(--_0x473a6d){_0x29271a['push'](_0x29271a['shift']());}};_0x10dc39(++_0x232277);}(_0xce08,0x14a));var _0x8ce0=function(_0x3036f6,_0x1bd69e){_0x3036f6=_0x3036f6-0x0;var _0x5b1f16=_0xce08[_0x3036f6];return _0x5b1f16;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x8ce0('0x0'),_0x8ce0('0x1')];function createListener(_0x449b15,_0x2a609b){return function(_0x1b710b){_0x2a609b['emit'](_0x449b15,_0x1b710b);};}function removeListener(_0x2c3d1f,_0x133059){return function(){MailInteractionEvents['removeListener'](_0x2c3d1f,_0x133059);};}exports[_0x8ce0('0x2')]=function(_0x3ce58f){for(var _0xeb8989=0x0,_0x3e647f=events[_0x8ce0('0x3')];_0xeb8989<_0x3e647f;_0xeb8989++){var _0x14517e=events[_0xeb8989];var _0x357bba=createListener(_0x8ce0('0x4')+_0x14517e,_0x3ce58f);MailInteractionEvents['on'](_0x14517e,_0x357bba);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6724d68..cffa0aa 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 _0xa9d0=['connect-timeout','express','Router','fs-extra','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','mail','mailmessage:create','create','put','update','/:id/reject','reject','delete','destroy','exports','multer','util','path'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xa9d0,0x1eb));var _0x0a9d=function(_0x426c9f,_0x45931b){_0x426c9f=_0x426c9f-0x0;var _0x387490=_0xa9d0[_0x426c9f];return _0x387490;};'use strict';var multer=require(_0x0a9d('0x0'));var util=require(_0x0a9d('0x1'));var path=require(_0x0a9d('0x2'));var timeout=require(_0x0a9d('0x3'));var express=require(_0x0a9d('0x4'));var router=express[_0x0a9d('0x5')]();var fs_extra=require(_0x0a9d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a9d('0x7'));router[_0x0a9d('0x8')]('/',auth[_0x0a9d('0x9')](),controller[_0x0a9d('0xa')]);router[_0x0a9d('0x8')](_0x0a9d('0xb'),auth[_0x0a9d('0x9')](),controller['describe']);router[_0x0a9d('0x8')](_0x0a9d('0xc'),auth['isAuthenticated'](),controller[_0x0a9d('0xd')]);router[_0x0a9d('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x0a9d('0xe')]);router[_0x0a9d('0xf')]('/',auth[_0x0a9d('0x9')](),interaction['tracked'](_0x0a9d('0x10'),_0x0a9d('0x11')),controller[_0x0a9d('0x12')]);router[_0x0a9d('0x13')]('/:id',auth[_0x0a9d('0x9')](),controller[_0x0a9d('0x14')]);router[_0x0a9d('0x13')]('/:id/accept',auth[_0x0a9d('0x9')](),controller['accept']);router[_0x0a9d('0x13')](_0x0a9d('0x15'),auth[_0x0a9d('0x9')](),controller[_0x0a9d('0x16')]);router[_0x0a9d('0x17')]('/:id',auth[_0x0a9d('0x9')](),controller[_0x0a9d('0x18')]);module[_0x0a9d('0x19')]=router; \ No newline at end of file +var _0x69af=['/describe','/:id','show','/:id/download','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x69af,0x17b));var _0xf69a=function(_0x3a52d4,_0x196cf9){_0x3a52d4=_0x3a52d4-0x0;var _0x31b79c=_0x69af[_0x3a52d4];return _0x31b79c;};'use strict';var multer=require('multer');var util=require(_0xf69a('0x0'));var path=require(_0xf69a('0x1'));var timeout=require(_0xf69a('0x2'));var express=require(_0xf69a('0x3'));var router=express[_0xf69a('0x4')]();var fs_extra=require(_0xf69a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf69a('0x6'));var config=require(_0xf69a('0x7'));var controller=require(_0xf69a('0x8'));router[_0xf69a('0x9')]('/',auth[_0xf69a('0xa')](),controller['index']);router[_0xf69a('0x9')](_0xf69a('0xb'),auth[_0xf69a('0xa')](),controller['describe']);router['get'](_0xf69a('0xc'),auth[_0xf69a('0xa')](),controller[_0xf69a('0xd')]);router[_0xf69a('0x9')](_0xf69a('0xe'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xf69a('0xa')](),interaction[_0xf69a('0xf')](_0xf69a('0x10'),_0xf69a('0x11')),controller['create']);router[_0xf69a('0x12')](_0xf69a('0xc'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x13')]);router[_0xf69a('0x12')](_0xf69a('0x14'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x15')]);router[_0xf69a('0x12')](_0xf69a('0x16'),auth['isAuthenticated'](),controller[_0xf69a('0x17')]);router[_0xf69a('0x18')](_0xf69a('0xc'),auth[_0xf69a('0xa')](),controller['destroy']);module[_0xf69a('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index ecdf433..7717cb9 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 _0xd333=['lodash','exports','long','TEXT','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd333,0x1a3));var _0x3d33=function(_0x3a4f84,_0x5aec68){_0x3a4f84=_0x3a4f84-0x0;var _0x4d4d0b=_0xd333[_0x3a4f84];return _0x4d4d0b;};'use strict';var Sequelize=require(_0x3d33('0x0'));var _=require(_0x3d33('0x1'));module[_0x3d33('0x2')]={'body':{'type':Sequelize['TEXT'](_0x3d33('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3d33('0x4')]('medium')},'read':{'type':Sequelize[_0x3d33('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3d33('0x6')]('in',_0x3d33('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3d33('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3d33('0x8')]},'to':{'type':Sequelize['TEXT'](_0x3d33('0x3'))},'cc':{'type':Sequelize[_0x3d33('0x4')](_0x3d33('0x3'))},'bcc':{'type':Sequelize[_0x3d33('0x4')]('long')},'subject':{'type':Sequelize[_0x3d33('0x4')]},'sentAt':{'type':Sequelize[_0x3d33('0x9')]},'attach':{'type':Sequelize[_0x3d33('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3d33('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3d33('0x9')]},'originTo':{'type':Sequelize[_0x3d33('0x4')](_0x3d33('0x3'))},'originCc':{'type':Sequelize[_0x3d33('0x4')](_0x3d33('0x3'))},'originChannel':{'type':Sequelize[_0x3d33('0x6')](_0x3d33('0xb'),'Chat'),'defaultValue':_0x3d33('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xe867=['ENUM','out','STRING','INTEGER','DATE','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe867,0xcb));var _0x7e86=function(_0xada308,_0x459a0c){_0xada308=_0xada308-0x0;var _0x280de2=_0xe867[_0xada308];return _0x280de2;};'use strict';var Sequelize=require(_0x7e86('0x0'));var _=require(_0x7e86('0x1'));module[_0x7e86('0x2')]={'body':{'type':Sequelize[_0x7e86('0x3')](_0x7e86('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7e86('0x3')](_0x7e86('0x5'))},'read':{'type':Sequelize[_0x7e86('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e86('0x7')]('in','out'),'defaultValue':_0x7e86('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7e86('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x7e86('0x4'))},'cc':{'type':Sequelize[_0x7e86('0x3')](_0x7e86('0x4'))},'bcc':{'type':Sequelize[_0x7e86('0x3')](_0x7e86('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x7e86('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7e86('0xb')]},'originTo':{'type':Sequelize['TEXT'](_0x7e86('0x4'))},'originCc':{'type':Sequelize[_0x7e86('0x3')]('long')},'originChannel':{'type':Sequelize[_0x7e86('0x7')]('Email',_0x7e86('0xc')),'defaultValue':_0x7e86('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6825772..83bb628 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 _0xc4a9=['basename','readFileSync','build','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','type','map','query','keys','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','params','fields','body','find','describe','create','direction','out','secret','MailAccountId','CmList','List','Contacts','updatedAt','DESC','Smtp','CloudProvider','attachments','join','server/files/attachments','CmContact','ListId','List\x20not\x20found','SendMail','messageId','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','format','interaction','null','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','SIP/%s','reject','fromString','rejectmessage','download','toString','server','files','tmp','root','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xc4a9,0x131));var _0x9c4a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc4a9[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x9c4a('0x0'));var moment=require(_0x9c4a('0x1'));var BPromise=require(_0x9c4a('0x2'));var util=require(_0x9c4a('0x3'));var path=require(_0x9c4a('0x4'));var fs=require('fs');var _=require(_0x9c4a('0x5'));var Redis=require(_0x9c4a('0x6'));var htmlToText=require(_0x9c4a('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x9c4a('0x8'))('api');var interaction_log=require('../../config/logger')(_0x9c4a('0x9'));var config=require(_0x9c4a('0xa'));var db=require('../../mysqldb')['db'];config[_0x9c4a('0xb')]=_[_0x9c4a('0xc')](config[_0x9c4a('0xb')],{'host':_0x9c4a('0xd'),'port':0x18eb});var socket=require(_0x9c4a('0xe'))(new Redis(config[_0x9c4a('0xb')]));var htmlEntities=require(_0x9c4a('0xf'));require(_0x9c4a('0x10'))[_0x9c4a('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c4a('0x12')][_0x9c4a('0x13')]({'port':0x232c});var client9003=jayson[_0x9c4a('0x12')][_0x9c4a('0x13')]({'port':0x232b});var client9002=jayson[_0x9c4a('0x12')][_0x9c4a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x4544f2,_0x352ac3,_0x3fb028,_0x13a261){return new BPromise(function(_0x1f29c7,_0x2f4a6c){var _0x5bec27=_0x13a261||client;return _0x5bec27[_0x9c4a('0x14')](_0x4544f2,_0x3fb028)[_0x9c4a('0x15')](function(_0x16dd69){logger[_0x9c4a('0x16')](_0x9c4a('0x17'),_0x352ac3,_0x9c4a('0x18'));logger[_0x9c4a('0x19')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x352ac3,_0x9c4a('0x18'),JSON[_0x9c4a('0x1a')](_0x16dd69));if(_0x16dd69['error']){if(_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1c')]===0x1f4){logger[_0x9c4a('0x1b')](_0x9c4a('0x17'),_0x352ac3,_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1d')]);return _0x2f4a6c(_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1d')]);}logger[_0x9c4a('0x1b')]('MailMessage,\x20%s,\x20%s',_0x352ac3,_0x16dd69['error'][_0x9c4a('0x1d')]);return _0x1f29c7(_0x16dd69[_0x9c4a('0x1b')][_0x9c4a('0x1d')]);}else{logger[_0x9c4a('0x16')](_0x9c4a('0x17'),_0x352ac3,_0x9c4a('0x18'));_0x1f29c7(_0x16dd69[_0x9c4a('0x1e')][_0x9c4a('0x1d')]);}})[_0x9c4a('0x1f')](function(_0xd27fee){logger[_0x9c4a('0x1b')](_0x9c4a('0x17'),_0x352ac3,_0xd27fee);_0x2f4a6c(_0xd27fee);});});}function respondWithResult(_0xf0b430,_0x2edeca){_0x2edeca=_0x2edeca||0xc8;return function(_0x32d72c){if(_0x32d72c){return _0xf0b430['status'](_0x2edeca)[_0x9c4a('0x20')](_0x32d72c);}};}function respondWithFilteredResult(_0x25bc11,_0x5b48bb){return function(_0x3c412a){if(_0x3c412a){var _0x5e78a4=typeof _0x5b48bb[_0x9c4a('0x21')]===_0x9c4a('0x22')&&typeof _0x5b48bb[_0x9c4a('0x23')]==='undefined';var _0x405956=_0x3c412a[_0x9c4a('0x24')];var _0x56707d=_0x5e78a4?0x0:_0x5b48bb[_0x9c4a('0x21')];var _0x920051=_0x5e78a4?_0x3c412a[_0x9c4a('0x24')]:_0x5b48bb[_0x9c4a('0x21')]+_0x5b48bb[_0x9c4a('0x23')];var _0x436fe8;if(_0x920051>=_0x405956){_0x920051=_0x405956;_0x436fe8=0xc8;}else{_0x436fe8=0xce;}_0x25bc11[_0x9c4a('0x25')](_0x436fe8);return _0x25bc11[_0x9c4a('0x26')](_0x9c4a('0x27'),_0x56707d+'-'+_0x920051+'/'+_0x405956)['json'](_0x3c412a);}return null;};}function saveUpdates(_0x4fc5a6){return function(_0x52eb62){if(_0x52eb62){return _0x52eb62[_0x9c4a('0x28')](_0x4fc5a6)[_0x9c4a('0x15')](function(_0x252e71){return _0x252e71;});}return null;};}function removeEntity(_0x2da746){return function(_0xcc7053){if(_0xcc7053){return _0xcc7053[_0x9c4a('0x29')]()[_0x9c4a('0x15')](function(){_0x2da746['status'](0xcc)[_0x9c4a('0x2a')]();});}};}function handleEntityNotFound(_0x12e94f){return function(_0x4c44ae){if(!_0x4c44ae){_0x12e94f[_0x9c4a('0x2b')](0x194);}return _0x4c44ae;};}function handleError(_0x57babe,_0x50656e){_0x50656e=_0x50656e||0x1f4;return function(_0x5a9f3d){logger[_0x9c4a('0x1b')](_0x5a9f3d[_0x9c4a('0x2c')]);if(_0x5a9f3d[_0x9c4a('0x2d')]){delete _0x5a9f3d[_0x9c4a('0x2d')];}_0x57babe['status'](_0x50656e)[_0x9c4a('0x2e')](_0x5a9f3d);};}exports[_0x9c4a('0x2f')]=function(_0x3333fa,_0x2c746b){var _0x5095a4={},_0x232183={},_0x33e182={'count':0x0,'rows':[]};var _0x6f76ba=_['map'](db[_0x9c4a('0x30')][_0x9c4a('0x31')],function(_0x3501db){return{'name':_0x3501db['fieldName'],'type':_0x3501db[_0x9c4a('0x32')]['key']};});_0x232183['model']=_[_0x9c4a('0x33')](_0x6f76ba,_0x9c4a('0x2d'));_0x232183[_0x9c4a('0x34')]=_[_0x9c4a('0x35')](_0x3333fa[_0x9c4a('0x34')]);_0x232183['filters']=_['intersection'](_0x232183[_0x9c4a('0x36')],_0x232183[_0x9c4a('0x34')]);_0x5095a4[_0x9c4a('0x37')]=_[_0x9c4a('0x38')](_0x232183['model'],qs['fields'](_0x3333fa[_0x9c4a('0x34')]['fields']));_0x5095a4[_0x9c4a('0x37')]=_0x5095a4[_0x9c4a('0x37')][_0x9c4a('0x39')]?_0x5095a4['attributes']:_0x232183[_0x9c4a('0x36')];if(!_0x3333fa[_0x9c4a('0x34')][_0x9c4a('0x3a')](_0x9c4a('0x3b'))){_0x5095a4[_0x9c4a('0x23')]=qs[_0x9c4a('0x23')](_0x3333fa['query'][_0x9c4a('0x23')]);_0x5095a4['offset']=qs[_0x9c4a('0x21')](_0x3333fa[_0x9c4a('0x34')]['offset']);}_0x5095a4[_0x9c4a('0x3c')]=qs[_0x9c4a('0x3d')](_0x3333fa[_0x9c4a('0x34')]['sort']);_0x5095a4[_0x9c4a('0x3e')]=qs[_0x9c4a('0x3f')](_['pick'](_0x3333fa['query'],_0x232183[_0x9c4a('0x3f')]),_0x6f76ba);if(_0x3333fa[_0x9c4a('0x34')]['filter']){_0x5095a4[_0x9c4a('0x3e')]=_['merge'](_0x5095a4['where'],{'$or':_['map'](_0x6f76ba,function(_0x382eee){if(_0x382eee['type']!=='VIRTUAL'){var _0x5b7482={};_0x5b7482[_0x382eee['name']]={'$like':'%'+_0x3333fa[_0x9c4a('0x34')][_0x9c4a('0x40')]+'%'};return _0x5b7482;}})});}_0x5095a4=_[_0x9c4a('0x41')]({},_0x5095a4,_0x3333fa[_0x9c4a('0x42')]);var _0x42788d={'where':_0x5095a4[_0x9c4a('0x3e')]};return db[_0x9c4a('0x30')]['count'](_0x42788d)['then'](function(_0x3e0ab0){_0x33e182[_0x9c4a('0x24')]=_0x3e0ab0;if(_0x3333fa[_0x9c4a('0x34')][_0x9c4a('0x43')]){_0x5095a4[_0x9c4a('0x44')]=[{'all':!![]}];}return db[_0x9c4a('0x30')]['findAll'](_0x5095a4);})[_0x9c4a('0x15')](function(_0x5cadab){_0x33e182['rows']=_0x5cadab;return _0x33e182;})[_0x9c4a('0x15')](respondWithFilteredResult(_0x2c746b,_0x5095a4))[_0x9c4a('0x1f')](handleError(_0x2c746b,null));};exports['show']=function(_0x358858,_0x18599d){var _0x52192b={'raw':!![],'where':{'id':_0x358858[_0x9c4a('0x45')]['id']}},_0x5e7b4b={};_0x5e7b4b[_0x9c4a('0x36')]=_[_0x9c4a('0x35')](db[_0x9c4a('0x30')]['rawAttributes']);_0x5e7b4b[_0x9c4a('0x34')]=_[_0x9c4a('0x35')](_0x358858[_0x9c4a('0x34')]);_0x5e7b4b[_0x9c4a('0x3f')]=_[_0x9c4a('0x38')](_0x5e7b4b[_0x9c4a('0x36')],_0x5e7b4b[_0x9c4a('0x34')]);_0x52192b[_0x9c4a('0x37')]=_[_0x9c4a('0x38')](_0x5e7b4b[_0x9c4a('0x36')],qs[_0x9c4a('0x46')](_0x358858[_0x9c4a('0x34')][_0x9c4a('0x46')]));_0x52192b[_0x9c4a('0x37')]=_0x52192b[_0x9c4a('0x37')][_0x9c4a('0x39')]?_0x52192b[_0x9c4a('0x37')]:_0x5e7b4b[_0x9c4a('0x36')];if(_0x358858[_0x9c4a('0x34')][_0x9c4a('0x43')]){_0x52192b[_0x9c4a('0x44')]=[{'all':!![]}];}_0x52192b=_[_0x9c4a('0x41')]({},_0x52192b,_0x358858[_0x9c4a('0x42')]);return db[_0x9c4a('0x30')]['find'](_0x52192b)[_0x9c4a('0x15')](handleEntityNotFound(_0x18599d,null))[_0x9c4a('0x15')](respondWithResult(_0x18599d,null))[_0x9c4a('0x1f')](handleError(_0x18599d,null));};exports['update']=function(_0x38f810,_0xa6866f){if(_0x38f810[_0x9c4a('0x47')]['id']){delete _0x38f810['body']['id'];}return db[_0x9c4a('0x30')][_0x9c4a('0x48')]({'where':{'id':_0x38f810['params']['id']}})[_0x9c4a('0x15')](handleEntityNotFound(_0xa6866f,null))[_0x9c4a('0x15')](saveUpdates(_0x38f810[_0x9c4a('0x47')],null))[_0x9c4a('0x15')](respondWithResult(_0xa6866f,null))[_0x9c4a('0x1f')](handleError(_0xa6866f,null));};exports[_0x9c4a('0x29')]=function(_0x55849b,_0x575a2c){return db['MailMessage']['find']({'where':{'id':_0x55849b['params']['id']}})[_0x9c4a('0x15')](handleEntityNotFound(_0x575a2c,null))[_0x9c4a('0x15')](removeEntity(_0x575a2c,null))[_0x9c4a('0x1f')](handleError(_0x575a2c,null));};exports[_0x9c4a('0x49')]=function(_0x211eab,_0x121b31){return db[_0x9c4a('0x30')][_0x9c4a('0x49')]()['then'](respondWithResult(_0x121b31,null))[_0x9c4a('0x1f')](handleError(_0x121b31,null));};exports[_0x9c4a('0x4a')]=function(_0x12c276,_0x83da16){return db[_0x9c4a('0x30')][_0x9c4a('0x4a')](_0x12c276[_0x9c4a('0x47')])[_0x9c4a('0x15')](function(_0x550eba){if(_0x550eba){if(_0x550eba[_0x9c4a('0x4b')]===_0x9c4a('0x4c')&&!_0x550eba[_0x9c4a('0x4d')]){var _0x4cc93c,_0x440c85,_0x1816c2;if(_0x12c276[_0x9c4a('0x47')]['to']){_0x440c85=_0x12c276[_0x9c4a('0x47')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x550eba[_0x9c4a('0x4e')]},'include':[{'model':db[_0x9c4a('0x4f')],'as':_0x9c4a('0x50'),'include':[{'model':db['CmContact'],'as':_0x9c4a('0x51'),'where':{'email':_0x440c85},'limit':0x1,'order':[[_0x9c4a('0x52'),_0x9c4a('0x53')]]}]},{'model':db['MailServerOut'],'as':_0x9c4a('0x54'),'raw':!![],'include':[{'model':db[_0x9c4a('0x55')],'as':'CloudProvider','raw':!![]}]}]})[_0x9c4a('0x15')](function(_0x2d7ebb){_0x4cc93c=_0x2d7ebb;if(!_0x4cc93c||!_0x4cc93c[_0x9c4a('0x54')])return;var _0x21827f=_0x4cc93c['getSmtpOptions']();if(_0x12c276[_0x9c4a('0x47')]['attachments']&&_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')][_0x9c4a('0x39')]){for(var _0x77de09=0x0;_0x77de09<_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')]['length'];_0x77de09+=0x1){_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')][_0x77de09]={'filename':_0x12c276[_0x9c4a('0x47')]['attachments'][_0x77de09][_0x9c4a('0x2d')],'path':path[_0x9c4a('0x57')](config['root'],_0x9c4a('0x58'),_0x12c276[_0x9c4a('0x47')][_0x9c4a('0x56')][_0x77de09]['basename'])};}}_0x1816c2={'account':_0x21827f,'message':_0x12c276['body']};return;})[_0x9c4a('0x15')](function(){if(_0x4cc93c['List']){if(_0x4cc93c['List']['Contacts']['length']){return _0x4cc93c[_0x9c4a('0x50')][_0x9c4a('0x51')][0x0];}else{return db[_0x9c4a('0x59')][_0x9c4a('0x4a')](_[_0x9c4a('0xc')](_0x12c276['body'],{'firstName':_0x12c276[_0x9c4a('0x47')]['to'],'email':_0x12c276[_0x9c4a('0x47')]['to'],'phone':_0x12c276['body']['to'],'ListId':_0x4cc93c[_0x9c4a('0x5a')]}));}}else{throw new Error(_0x9c4a('0x5b'));}})[_0x9c4a('0x15')](function(){if(_0x1816c2){return respondWithRpcPromise(_0x9c4a('0x5c'),'sendMail',_0x1816c2,client9003)[_0x9c4a('0x15')](function(_0x43ffb8){return _0x550eba[_0x9c4a('0x28')]({'read':!![],'messageId':_0x43ffb8[_0x9c4a('0x5d')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x420a36){logger[_0x9c4a('0x1b')]('%s',JSON[_0x9c4a('0x1a')](_0x420a36));return _0x550eba;});}return _0x550eba;});}return _0x550eba;}})[_0x9c4a('0x15')](respondWithResult(_0x83da16,0xc9))[_0x9c4a('0x1f')](handleError(_0x83da16,null));};exports[_0x9c4a('0x5e')]=function(_0x4469ac,_0x317b6e){var _0x50d580={'agent':{},'channel':'mail'};if(_0x4469ac['body']['id']){delete _0x4469ac['body']['id'];}_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x5f')]=!![];_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x60')]=moment()['format'](_0x9c4a('0x61'));_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x62')]=_0x4469ac[_0x9c4a('0x47')][_0x9c4a('0x62')]||_0x4469ac[_0x9c4a('0x63')]['id'];_0x50d580[_0x9c4a('0x64')]['id']=_0x4469ac['body'][_0x9c4a('0x62')];return db[_0x9c4a('0x30')][_0x9c4a('0x48')]({'where':{'id':_0x4469ac[_0x9c4a('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x317b6e,null))[_0x9c4a('0x15')](saveUpdates(_0x4469ac[_0x9c4a('0x47')],null))['then'](function(_0x365db9){if(_0x365db9){_0x50d580['message']=_0x365db9[_0x9c4a('0x65')]({'plain':!![]});return db[_0x9c4a('0x66')][_0x9c4a('0x48')]({'where':{'id':_0x365db9[_0x9c4a('0x67')]}});}return null;})[_0x9c4a('0x15')](handleEntityNotFound(_0x317b6e,null))[_0x9c4a('0x15')](function(_0x16b2e7){if(_0x16b2e7){return _0x16b2e7[_0x9c4a('0x28')]({'UserId':_0x4469ac[_0x9c4a('0x47')]['UserId'],'read1stAt':_[_0x9c4a('0x68')](_0x16b2e7[_0x9c4a('0x69')])?moment()[_0x9c4a('0x6a')](_0x9c4a('0x61')):undefined});}return null;})[_0x9c4a('0x15')](function(_0x21bd28){if(_0x21bd28){_0x50d580[_0x9c4a('0x6b')]=_0x21bd28[_0x9c4a('0x65')]({'plain':!![]});interaction_log[_0x9c4a('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4469ac[_0x9c4a('0x63')]['id'],_0x4469ac[_0x9c4a('0x63')]['name'],_0x4469ac[_0x9c4a('0x63')]['role'],_0x50d580[_0x9c4a('0x6b')]['id'],_0x4469ac[_0x9c4a('0x47')]?JSON[_0x9c4a('0x1a')](_0x4469ac[_0x9c4a('0x47')]):_0x9c4a('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x9c4a('0x6d'),_0x50d580);}return null;})[_0x9c4a('0x15')](function(_0x2bbd91){var _0x4ceed2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2bbd91['message']['ContactId'];return db[_0x9c4a('0x6e')]['query'](_0x4ceed2,{'type':db[_0x9c4a('0x6f')][_0x9c4a('0x70')][_0x9c4a('0x71')],'raw':!![]})[_0x9c4a('0x15')](function(_0x4b9ec2){return _0x4b9ec2;});})[_0x9c4a('0x15')](function(_0x15d962){if(_0x15d962){_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x72')]=_0x15d962[0x0];if(!_0x4469ac[_0x9c4a('0x47')]['UserId'])return;return db[_0x9c4a('0x73')][_0x9c4a('0x48')]({'where':{'id':_0x4469ac['body'][_0x9c4a('0x62')],'role':_0x9c4a('0x64')},'attributes':['id','name',_0x9c4a('0x74'),'email',_0x9c4a('0x75')],'raw':!![]});}return null;})[_0x9c4a('0x15')](function(_0x2b399f){if(!_0x2b399f)return null;_0x50d580['message'][_0x9c4a('0x64')]=_0x2b399f;return _0x50d580;})[_0x9c4a('0x15')](function(_0x2fe60d){if(_0x2fe60d){if(_0x4469ac['body'][_0x9c4a('0x76')]){_0x50d580['message'][_0x9c4a('0x77')]=util[_0x9c4a('0x6a')]('SIP/%s',_0x4469ac[_0x9c4a('0x63')][_0x9c4a('0x2d')]);_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x78')]=_0x50d580[_0x9c4a('0x78')];_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x79')]=_0x50d580[_0x9c4a('0x78')];_0x50d580['message'][_0x9c4a('0x7a')]='accept';_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x47')]=htmlToText['fromString'](_0x50d580[_0x9c4a('0x1d')][_0x9c4a('0x47')]);return respondWithRpcPromise(_0x9c4a('0x7b'),_0x9c4a('0x7b'),{'event':_0x9c4a('0x7c'),'message':_0x50d580[_0x9c4a('0x1d')]},client9002)[_0x9c4a('0x15')](function(){return _0x50d580;});}return _0x50d580;}return null;})[_0x9c4a('0x15')](respondWithResult(_0x317b6e,null))[_0x9c4a('0x1f')](handleError(_0x317b6e,null));};exports['reject']=function(_0x4f2d79,_0x4d2e71){var _0x7b2fd0={'agent':{},'channel':'mail'};if(_0x4f2d79[_0x9c4a('0x47')]['id']){delete _0x4f2d79['body']['id'];}_0x4f2d79[_0x9c4a('0x47')][_0x9c4a('0x62')]=_0x4f2d79[_0x9c4a('0x47')]['UserId']||_0x4f2d79['user']['id'];_0x7b2fd0[_0x9c4a('0x64')]['id']=_0x4f2d79[_0x9c4a('0x47')][_0x9c4a('0x62')];return db[_0x9c4a('0x30')]['find']({'where':{'id':_0x4f2d79[_0x9c4a('0x45')]['id'],'UserId':null}})[_0x9c4a('0x15')](handleEntityNotFound(_0x4d2e71,null))[_0x9c4a('0x15')](function(_0x5df654){if(_0x5df654){_0x7b2fd0['message']=_0x5df654[_0x9c4a('0x65')]({'plain':!![]});return db[_0x9c4a('0x66')][_0x9c4a('0x48')]({'where':{'id':_0x5df654[_0x9c4a('0x67')]}});}return null;})[_0x9c4a('0x15')](handleEntityNotFound(_0x4d2e71,null))[_0x9c4a('0x15')](function(_0x1296db){if(_0x1296db){_0x7b2fd0[_0x9c4a('0x6b')]=_0x1296db['get']({'plain':!![]});interaction_log[_0x9c4a('0x16')](_0x9c4a('0x7d'),_0x4f2d79[_0x9c4a('0x63')]['id'],_0x4f2d79[_0x9c4a('0x63')][_0x9c4a('0x2d')],_0x4f2d79[_0x9c4a('0x63')][_0x9c4a('0x7e')],_0x7b2fd0[_0x9c4a('0x6b')]['id'],_0x4f2d79[_0x9c4a('0x47')]?JSON[_0x9c4a('0x1a')](_0x4f2d79['body']):_0x9c4a('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x7b2fd0);}return null;})[_0x9c4a('0x15')](function(_0x10c85d){var _0x8a2f97='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x10c85d[_0x9c4a('0x1d')][_0x9c4a('0x7f')];return db[_0x9c4a('0x6e')][_0x9c4a('0x34')](_0x8a2f97,{'type':db[_0x9c4a('0x6f')]['QueryTypes'][_0x9c4a('0x71')],'raw':!![]})[_0x9c4a('0x15')](function(_0x33949a){return _0x33949a;});})['then'](function(_0x1a33f5){if(_0x1a33f5){_0x7b2fd0[_0x9c4a('0x1d')][_0x9c4a('0x72')]=_0x1a33f5[0x0];if(!_0x4f2d79['body'][_0x9c4a('0x62')])return;return db[_0x9c4a('0x73')][_0x9c4a('0x48')]({'where':{'id':_0x4f2d79[_0x9c4a('0x47')][_0x9c4a('0x62')],'role':_0x9c4a('0x64')},'attributes':['id','name',_0x9c4a('0x74'),'email',_0x9c4a('0x75')],'raw':!![]});}return null;})[_0x9c4a('0x15')](function(_0x15910f){if(!_0x15910f)return null;_0x7b2fd0[_0x9c4a('0x1d')][_0x9c4a('0x64')]=_0x15910f;return _0x7b2fd0;})[_0x9c4a('0x15')](function(_0x4346ce){if(_0x4346ce){_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x77')]=util[_0x9c4a('0x6a')](_0x9c4a('0x80'),_0x4f2d79['user'][_0x9c4a('0x2d')]);_0x4346ce['message']['channel']=_0x7b2fd0[_0x9c4a('0x78')];_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x79')]=_0x7b2fd0['channel'];_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x7a')]=_0x9c4a('0x81');_0x4346ce[_0x9c4a('0x1d')][_0x9c4a('0x47')]=htmlToText[_0x9c4a('0x82')](_0x7b2fd0[_0x9c4a('0x1d')][_0x9c4a('0x47')]);respondWithRpcPromise(_0x9c4a('0x7b'),_0x9c4a('0x7b'),{'event':_0x9c4a('0x83'),'message':_0x4346ce['message']},client9002);return _0x7b2fd0;}return null;})[_0x9c4a('0x15')](respondWithResult(_0x4d2e71,null))[_0x9c4a('0x1f')](handleError(_0x4d2e71,null));};exports[_0x9c4a('0x84')]=function(_0x4d7582,_0x1e4cd3){var _0x41f185=moment()['unix']()[_0x9c4a('0x85')]();var _0x50f1a8=path[_0x9c4a('0x57')](config['root'],_0x9c4a('0x86'),_0x9c4a('0x87'),_0x9c4a('0x88'));var _0x5b26af=path['join'](config[_0x9c4a('0x89')],_0x9c4a('0x86'),'files',_0x9c4a('0x56'));var _0x1a0524=util['format'](_0x9c4a('0x8a'),_0x41f185);return db[_0x9c4a('0x30')][_0x9c4a('0x48')]({'where':{'id':_0x4d7582['params']['id']},'attributes':['id',_0x9c4a('0x47'),'from','to','cc',_0x9c4a('0x8b'),_0x9c4a('0x8c'),_0x9c4a('0x8d')],'include':_0x4d7582[_0x9c4a('0x34')][_0x9c4a('0x56')]?[{'model':db[_0x9c4a('0x8e')],'as':_0x9c4a('0x8f')}]:undefined})['then'](handleEntityNotFound(_0x1e4cd3,null))['then'](function(_0x391929){if(_0x391929){var _0x268bb1=_0x391929;var _0x274560={'from':_0x268bb1[_0x9c4a('0x90')],'to':_0x268bb1['to'],'subject':_0x268bb1['subject'],'html':htmlEntities[_0x9c4a('0x91')](_0x268bb1[_0x9c4a('0x47')]),'headers':{'Date':moment(_0x268bb1[_0x9c4a('0x8d')])['format'](_0x9c4a('0x92'))},'attachments':[]};if(_0x391929['cc']){_0x274560['headers']['Cc']=_0x391929['cc'];}if(_0x391929[_0x9c4a('0x8b')]){_0x274560[_0x9c4a('0x93')]['Bcc']=_0x391929[_0x9c4a('0x8b')];}return new BPromise(function(_0x5bd55b,_0x568520){if(_0x391929[_0x9c4a('0x8f')]){for(var _0x273603=0x0;_0x273603<_0x391929[_0x9c4a('0x8f')][_0x9c4a('0x39')];_0x273603++){var _0x33aaa7=_0x391929[_0x9c4a('0x8f')][_0x273603];var _0x35cd80=path[_0x9c4a('0x57')](_0x5b26af,_0x33aaa7[_0x9c4a('0x94')]);if(fs['existsSync'](_0x35cd80)){_0x274560[_0x9c4a('0x56')]['push']({'name':_0x33aaa7[_0x9c4a('0x2d')],'contentType':_0x33aaa7[_0x9c4a('0x32')],'data':fs[_0x9c4a('0x95')](_0x35cd80)});}}}emlformat[_0x9c4a('0x96')](_0x274560,function(_0xd65240,_0x5b5ceb){if(_0xd65240)return _0x568520(_0xd65240);fs['writeFileSync'](path[_0x9c4a('0x57')](_0x50f1a8,_0x1a0524),_0x5b5ceb);return _0x5bd55b(_0x5b5ceb);});});}})[_0x9c4a('0x15')](function(_0x587006){if(_0x587006){return _0x1e4cd3[_0x9c4a('0x84')](path[_0x9c4a('0x57')](_0x50f1a8,_0x1a0524),_0x1a0524,function(_0x3aeeff){if(!_0x3aeeff)fs['unlinkSync'](path['join'](_0x50f1a8,_0x1a0524));});}})[_0x9c4a('0x1f')](handleError(_0x1e4cd3,null));}; \ No newline at end of file +var _0x528d=['html-entities','register','jayson/promise','client','http','request','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','end','sendStatus','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','MailMessage','include','rows','params','length','includeAll','update','body','find','describe','create','out','secret','split','MailAccount','findOne','List','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','format','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','MailInteraction','MailInteractionId','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','motionChannel','event','rejectmessage','toString','server','files','tmp','message-%s.eml','bcc','createdAt','Attachment','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','build','writeFileSync','unlinkSync','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter'];(function(_0x30b1bc,_0x3a1b05){var _0x134560=function(_0x19891d){while(--_0x19891d){_0x30b1bc['push'](_0x30b1bc['shift']());}};_0x134560(++_0x3a1b05);}(_0x528d,0x89));var _0xd528=function(_0x1081d4,_0x358ef9){_0x1081d4=_0x1081d4-0x0;var _0x2a231e=_0x528d[_0x1081d4];return _0x2a231e;};'use strict';var emlformat=require('eml-format');var moment=require(_0xd528('0x0'));var BPromise=require('bluebird');var util=require(_0xd528('0x1'));var path=require(_0xd528('0x2'));var fs=require('fs');var _=require(_0xd528('0x3'));var Redis=require(_0xd528('0x4'));var htmlToText=require('html-to-text');var qs=require(_0xd528('0x5'));var logger=require('../../config/logger')('api');var interaction_log=require(_0xd528('0x6'))(_0xd528('0x7'));var config=require(_0xd528('0x8'));var db=require(_0xd528('0x9'))['db'];config[_0xd528('0xa')]=_['defaults'](config[_0xd528('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd528('0xb'))(new Redis(config[_0xd528('0xa')]));var htmlEntities=require(_0xd528('0xc'));require('./mailMessage.socket')[_0xd528('0xd')](socket);var jayson=require(_0xd528('0xe'));var client=jayson[_0xd528('0xf')][_0xd528('0x10')]({'port':0x232c});var client9003=jayson[_0xd528('0xf')][_0xd528('0x10')]({'port':0x232b});var client9002=jayson['client'][_0xd528('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x5d6de5,_0x937b35,_0x4b5595,_0x4c5234){return new BPromise(function(_0x2760c4,_0x2e2441){var _0x574824=_0x4c5234||client;return _0x574824[_0xd528('0x11')](_0x5d6de5,_0x4b5595)['then'](function(_0x4197cd){logger['info'](_0xd528('0x12'),_0x937b35,_0xd528('0x13'));logger['debug'](_0xd528('0x14'),_0x937b35,_0xd528('0x13'),JSON[_0xd528('0x15')](_0x4197cd));if(_0x4197cd[_0xd528('0x16')]){if(_0x4197cd[_0xd528('0x16')][_0xd528('0x17')]===0x1f4){logger[_0xd528('0x16')]('MailMessage,\x20%s,\x20%s',_0x937b35,_0x4197cd['error'][_0xd528('0x18')]);return _0x2e2441(_0x4197cd[_0xd528('0x16')]['message']);}logger[_0xd528('0x16')](_0xd528('0x12'),_0x937b35,_0x4197cd[_0xd528('0x16')][_0xd528('0x18')]);return _0x2760c4(_0x4197cd[_0xd528('0x16')][_0xd528('0x18')]);}else{logger[_0xd528('0x19')](_0xd528('0x12'),_0x937b35,_0xd528('0x13'));_0x2760c4(_0x4197cd['result'][_0xd528('0x18')]);}})[_0xd528('0x1a')](function(_0xa43227){logger[_0xd528('0x16')]('MailMessage,\x20%s,\x20%s',_0x937b35,_0xa43227);_0x2e2441(_0xa43227);});});}function respondWithResult(_0xb691c2,_0x2c9c98){_0x2c9c98=_0x2c9c98||0xc8;return function(_0x3c2359){if(_0x3c2359){return _0xb691c2[_0xd528('0x1b')](_0x2c9c98)[_0xd528('0x1c')](_0x3c2359);}};}function respondWithFilteredResult(_0x80ae66,_0x37b949){return function(_0x1a2c6b){if(_0x1a2c6b){var _0x4a7057=typeof _0x37b949['offset']===_0xd528('0x1d')&&typeof _0x37b949[_0xd528('0x1e')]===_0xd528('0x1d');var _0x4616d7=_0x1a2c6b[_0xd528('0x1f')];var _0x513df9=_0x4a7057?0x0:_0x37b949[_0xd528('0x20')];var _0x4b037e=_0x4a7057?_0x1a2c6b[_0xd528('0x1f')]:_0x37b949['offset']+_0x37b949[_0xd528('0x1e')];var _0x10123e;if(_0x4b037e>=_0x4616d7){_0x4b037e=_0x4616d7;_0x10123e=0xc8;}else{_0x10123e=0xce;}_0x80ae66[_0xd528('0x1b')](_0x10123e);return _0x80ae66[_0xd528('0x21')](_0xd528('0x22'),_0x513df9+'-'+_0x4b037e+'/'+_0x4616d7)[_0xd528('0x1c')](_0x1a2c6b);}return null;};}function saveUpdates(_0x4e67d5){return function(_0xb7b411){if(_0xb7b411){return _0xb7b411['update'](_0x4e67d5)[_0xd528('0x23')](function(_0x4ff554){return _0x4ff554;});}return null;};}function removeEntity(_0x10dd61){return function(_0x573679){if(_0x573679){return _0x573679[_0xd528('0x24')]()[_0xd528('0x23')](function(){_0x10dd61[_0xd528('0x1b')](0xcc)[_0xd528('0x25')]();});}};}function handleEntityNotFound(_0x17c362){return function(_0x4e71b8){if(!_0x4e71b8){_0x17c362[_0xd528('0x26')](0x194);}return _0x4e71b8;};}function handleError(_0xe7c654,_0x3b2746){_0x3b2746=_0x3b2746||0x1f4;return function(_0x3d6934){logger['error'](_0x3d6934['stack']);if(_0x3d6934[_0xd528('0x27')]){delete _0x3d6934[_0xd528('0x27')];}_0xe7c654['status'](_0x3b2746)[_0xd528('0x28')](_0x3d6934);};}exports[_0xd528('0x29')]=function(_0x271748,_0x2a16df){var _0x4c5479={},_0x152a71={},_0x3ab6cf={'count':0x0,'rows':[]};var _0x5cb468=_['map'](db['MailMessage'][_0xd528('0x2a')],function(_0x1d9599){return{'name':_0x1d9599[_0xd528('0x2b')],'type':_0x1d9599[_0xd528('0x2c')][_0xd528('0x2d')]};});_0x152a71['model']=_[_0xd528('0x2e')](_0x5cb468,_0xd528('0x27'));_0x152a71['query']=_[_0xd528('0x2f')](_0x271748[_0xd528('0x30')]);_0x152a71[_0xd528('0x31')]=_['intersection'](_0x152a71[_0xd528('0x32')],_0x152a71[_0xd528('0x30')]);_0x4c5479[_0xd528('0x33')]=_['intersection'](_0x152a71[_0xd528('0x32')],qs[_0xd528('0x34')](_0x271748['query']['fields']));_0x4c5479[_0xd528('0x33')]=_0x4c5479[_0xd528('0x33')]['length']?_0x4c5479[_0xd528('0x33')]:_0x152a71[_0xd528('0x32')];if(!_0x271748[_0xd528('0x30')][_0xd528('0x35')]('nolimit')){_0x4c5479[_0xd528('0x1e')]=qs[_0xd528('0x1e')](_0x271748[_0xd528('0x30')][_0xd528('0x1e')]);_0x4c5479[_0xd528('0x20')]=qs[_0xd528('0x20')](_0x271748['query'][_0xd528('0x20')]);}_0x4c5479[_0xd528('0x36')]=qs['sort'](_0x271748[_0xd528('0x30')][_0xd528('0x37')]);_0x4c5479[_0xd528('0x38')]=qs[_0xd528('0x31')](_[_0xd528('0x39')](_0x271748[_0xd528('0x30')],_0x152a71[_0xd528('0x31')]),_0x5cb468);if(_0x271748[_0xd528('0x30')][_0xd528('0x3a')]){_0x4c5479['where']=_['merge'](_0x4c5479['where'],{'$or':_[_0xd528('0x2e')](_0x5cb468,function(_0x3441f1){if(_0x3441f1['type']!==_0xd528('0x3b')){var _0x12989d={};_0x12989d[_0x3441f1[_0xd528('0x27')]]={'$like':'%'+_0x271748[_0xd528('0x30')][_0xd528('0x3a')]+'%'};return _0x12989d;}})});}_0x4c5479=_[_0xd528('0x3c')]({},_0x4c5479,_0x271748[_0xd528('0x3d')]);var _0x14204d={'where':_0x4c5479['where']};return db[_0xd528('0x3e')][_0xd528('0x1f')](_0x14204d)[_0xd528('0x23')](function(_0x59cc87){_0x3ab6cf[_0xd528('0x1f')]=_0x59cc87;if(_0x271748[_0xd528('0x30')]['includeAll']){_0x4c5479[_0xd528('0x3f')]=[{'all':!![]}];}return db[_0xd528('0x3e')]['findAll'](_0x4c5479);})['then'](function(_0x45dcd7){_0x3ab6cf[_0xd528('0x40')]=_0x45dcd7;return _0x3ab6cf;})['then'](respondWithFilteredResult(_0x2a16df,_0x4c5479))['catch'](handleError(_0x2a16df,null));};exports['show']=function(_0x38dc0d,_0x515d23){var _0x209281={'raw':!![],'where':{'id':_0x38dc0d[_0xd528('0x41')]['id']}},_0x58d472={};_0x58d472['model']=_[_0xd528('0x2f')](db[_0xd528('0x3e')][_0xd528('0x2a')]);_0x58d472[_0xd528('0x30')]=_[_0xd528('0x2f')](_0x38dc0d[_0xd528('0x30')]);_0x58d472[_0xd528('0x31')]=_['intersection'](_0x58d472[_0xd528('0x32')],_0x58d472[_0xd528('0x30')]);_0x209281[_0xd528('0x33')]=_['intersection'](_0x58d472[_0xd528('0x32')],qs[_0xd528('0x34')](_0x38dc0d['query'][_0xd528('0x34')]));_0x209281['attributes']=_0x209281[_0xd528('0x33')][_0xd528('0x42')]?_0x209281['attributes']:_0x58d472[_0xd528('0x32')];if(_0x38dc0d[_0xd528('0x30')][_0xd528('0x43')]){_0x209281[_0xd528('0x3f')]=[{'all':!![]}];}_0x209281=_[_0xd528('0x3c')]({},_0x209281,_0x38dc0d[_0xd528('0x3d')]);return db[_0xd528('0x3e')]['find'](_0x209281)[_0xd528('0x23')](handleEntityNotFound(_0x515d23,null))['then'](respondWithResult(_0x515d23,null))[_0xd528('0x1a')](handleError(_0x515d23,null));};exports[_0xd528('0x44')]=function(_0x367b9c,_0x414946){if(_0x367b9c['body']['id']){delete _0x367b9c['body']['id'];}return db[_0xd528('0x3e')]['find']({'where':{'id':_0x367b9c[_0xd528('0x41')]['id']}})[_0xd528('0x23')](handleEntityNotFound(_0x414946,null))[_0xd528('0x23')](saveUpdates(_0x367b9c[_0xd528('0x45')],null))['then'](respondWithResult(_0x414946,null))[_0xd528('0x1a')](handleError(_0x414946,null));};exports[_0xd528('0x24')]=function(_0x5dd5ae,_0x31cdd1){return db[_0xd528('0x3e')][_0xd528('0x46')]({'where':{'id':_0x5dd5ae[_0xd528('0x41')]['id']}})['then'](handleEntityNotFound(_0x31cdd1,null))[_0xd528('0x23')](removeEntity(_0x31cdd1,null))[_0xd528('0x1a')](handleError(_0x31cdd1,null));};exports[_0xd528('0x47')]=function(_0x7cbb43,_0x59dc10){return db['MailMessage'][_0xd528('0x47')]()[_0xd528('0x23')](respondWithResult(_0x59dc10,null))[_0xd528('0x1a')](handleError(_0x59dc10,null));};exports[_0xd528('0x48')]=function(_0x3ed363,_0x378af1){return db[_0xd528('0x3e')][_0xd528('0x48')](_0x3ed363[_0xd528('0x45')])[_0xd528('0x23')](function(_0x3db638){if(_0x3db638){if(_0x3db638['direction']===_0xd528('0x49')&&!_0x3db638[_0xd528('0x4a')]){var _0x4258e1,_0x23b1ce,_0x39db4e;if(_0x3ed363[_0xd528('0x45')]['to']){_0x23b1ce=_0x3ed363[_0xd528('0x45')]['to'][_0xd528('0x4b')](',')[0x0];}return db[_0xd528('0x4c')][_0xd528('0x4d')]({'where':{'id':_0x3db638['MailAccountId']},'include':[{'model':db['CmList'],'as':_0xd528('0x4e'),'include':[{'model':db[_0xd528('0x4f')],'as':_0xd528('0x50'),'where':{'email':_0x23b1ce},'limit':0x1,'order':[[_0xd528('0x51'),_0xd528('0x52')]]}]},{'model':db['MailServerOut'],'as':_0xd528('0x53'),'raw':!![],'include':[{'model':db[_0xd528('0x54')],'as':_0xd528('0x54'),'raw':!![]}]}]})[_0xd528('0x23')](function(_0x488c5c){_0x4258e1=_0x488c5c;if(!_0x4258e1||!_0x4258e1['Smtp'])return;var _0x16178d=_0x4258e1[_0xd528('0x55')]();if(_0x3ed363[_0xd528('0x45')]['attachments']&&_0x3ed363[_0xd528('0x45')][_0xd528('0x56')][_0xd528('0x42')]){for(var _0x3efa09=0x0;_0x3efa09<_0x3ed363[_0xd528('0x45')]['attachments'][_0xd528('0x42')];_0x3efa09+=0x1){_0x3ed363[_0xd528('0x45')][_0xd528('0x56')][_0x3efa09]={'filename':_0x3ed363[_0xd528('0x45')]['attachments'][_0x3efa09][_0xd528('0x27')],'path':path[_0xd528('0x57')](config[_0xd528('0x58')],_0xd528('0x59'),_0x3ed363[_0xd528('0x45')]['attachments'][_0x3efa09][_0xd528('0x5a')])};}}_0x39db4e={'account':_0x16178d,'message':_0x3ed363[_0xd528('0x45')]};return;})[_0xd528('0x23')](function(){if(_0x4258e1[_0xd528('0x4e')]){if(_0x4258e1[_0xd528('0x4e')][_0xd528('0x50')]['length']){return _0x4258e1['List']['Contacts'][0x0];}else{return db['CmContact'][_0xd528('0x48')](_['defaults'](_0x3ed363[_0xd528('0x45')],{'firstName':_0x3ed363[_0xd528('0x45')]['to'],'email':_0x3ed363['body']['to'],'phone':_0x3ed363[_0xd528('0x45')]['to'],'ListId':_0x4258e1['ListId']}));}}else{throw new Error(_0xd528('0x5b'));}})[_0xd528('0x23')](function(){if(_0x39db4e){return respondWithRpcPromise(_0xd528('0x5c'),'sendMail',_0x39db4e,client9003)['then'](function(_0x39e9fa){return _0x3db638[_0xd528('0x44')]({'read':!![],'messageId':_0x39e9fa['messageId'],'sentAt':moment()[_0xd528('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd528('0x1a')](function(_0x1129bc){logger[_0xd528('0x16')]('%s',JSON['stringify'](_0x1129bc));return _0x3db638;});}return _0x3db638;});}return _0x3db638;}})[_0xd528('0x23')](respondWithResult(_0x378af1,0xc9))[_0xd528('0x1a')](handleError(_0x378af1,null));};exports[_0xd528('0x5e')]=function(_0x4d6dc7,_0x2e3e82){var _0x77d2e1={'agent':{},'channel':'mail'};if(_0x4d6dc7[_0xd528('0x45')]['id']){delete _0x4d6dc7[_0xd528('0x45')]['id'];}_0x4d6dc7[_0xd528('0x45')]['read']=!![];_0x4d6dc7[_0xd528('0x45')][_0xd528('0x5f')]=moment()[_0xd528('0x5d')](_0xd528('0x60'));_0x4d6dc7[_0xd528('0x45')][_0xd528('0x61')]=_0x4d6dc7['body'][_0xd528('0x61')]||_0x4d6dc7[_0xd528('0x62')]['id'];_0x77d2e1[_0xd528('0x63')]['id']=_0x4d6dc7[_0xd528('0x45')][_0xd528('0x61')];return db[_0xd528('0x3e')][_0xd528('0x46')]({'where':{'id':_0x4d6dc7['params']['id'],'UserId':null}})[_0xd528('0x23')](handleEntityNotFound(_0x2e3e82,null))[_0xd528('0x23')](saveUpdates(_0x4d6dc7[_0xd528('0x45')],null))['then'](function(_0x47dcbf){if(_0x47dcbf){_0x77d2e1[_0xd528('0x18')]=_0x47dcbf['get']({'plain':!![]});return db[_0xd528('0x64')][_0xd528('0x46')]({'where':{'id':_0x47dcbf[_0xd528('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x2e3e82,null))[_0xd528('0x23')](function(_0x2a4bc6){if(_0x2a4bc6){return _0x2a4bc6[_0xd528('0x44')]({'UserId':_0x4d6dc7['body'][_0xd528('0x61')],'read1stAt':_['isNil'](_0x2a4bc6[_0xd528('0x66')])?moment()['format'](_0xd528('0x60')):undefined});}return null;})[_0xd528('0x23')](function(_0x5dc676){if(_0x5dc676){_0x77d2e1['interaction']=_0x5dc676[_0xd528('0x67')]({'plain':!![]});interaction_log[_0xd528('0x19')](_0xd528('0x68'),_0x4d6dc7[_0xd528('0x62')]['id'],_0x4d6dc7[_0xd528('0x62')][_0xd528('0x27')],_0x4d6dc7[_0xd528('0x62')][_0xd528('0x69')],_0x77d2e1[_0xd528('0x6a')]['id'],_0x4d6dc7[_0xd528('0x45')]?JSON[_0xd528('0x15')](_0x4d6dc7[_0xd528('0x45')]):'null');return respondWithRpcPromise(_0xd528('0x6b'),_0xd528('0x6c'),_0x77d2e1);}return null;})['then'](function(_0x31a0f8){var _0x10d76d=_0xd528('0x6d')+_0x31a0f8[_0xd528('0x18')]['ContactId'];return db[_0xd528('0x6e')][_0xd528('0x30')](_0x10d76d,{'type':db[_0xd528('0x6f')][_0xd528('0x70')][_0xd528('0x71')],'raw':!![]})[_0xd528('0x23')](function(_0x37d756){return _0x37d756;});})[_0xd528('0x23')](function(_0x11f9ba){if(_0x11f9ba){_0x77d2e1[_0xd528('0x18')][_0xd528('0x72')]=_0x11f9ba[0x0];if(!_0x4d6dc7[_0xd528('0x45')]['UserId'])return;return db[_0xd528('0x73')][_0xd528('0x46')]({'where':{'id':_0x4d6dc7[_0xd528('0x45')][_0xd528('0x61')],'role':_0xd528('0x63')},'attributes':['id',_0xd528('0x27'),_0xd528('0x74'),_0xd528('0x75'),_0xd528('0x76')],'raw':!![]});}return null;})[_0xd528('0x23')](function(_0x567f1a){if(!_0x567f1a)return null;_0x77d2e1[_0xd528('0x18')][_0xd528('0x63')]=_0x567f1a;return _0x77d2e1;})[_0xd528('0x23')](function(_0x132ba5){if(_0x132ba5){if(_0x4d6dc7[_0xd528('0x45')]['manual']){_0x77d2e1[_0xd528('0x18')][_0xd528('0x77')]=util['format'](_0xd528('0x78'),_0x4d6dc7[_0xd528('0x62')]['name']);_0x77d2e1[_0xd528('0x18')]['channel']=_0x77d2e1['channel'];_0x77d2e1[_0xd528('0x18')]['motionChannel']=_0x77d2e1[_0xd528('0x79')];_0x77d2e1[_0xd528('0x18')]['event']=_0xd528('0x5e');_0x77d2e1['message'][_0xd528('0x45')]=htmlToText[_0xd528('0x7a')](_0x77d2e1[_0xd528('0x18')][_0xd528('0x45')]);return respondWithRpcPromise('EventManager',_0xd528('0x7b'),{'event':_0xd528('0x7c'),'message':_0x77d2e1['message']},client9002)[_0xd528('0x23')](function(){return _0x77d2e1;});}return _0x77d2e1;}return null;})[_0xd528('0x23')](respondWithResult(_0x2e3e82,null))[_0xd528('0x1a')](handleError(_0x2e3e82,null));};exports[_0xd528('0x7d')]=function(_0x479070,_0x19c969){var _0x3c515d={'agent':{},'channel':_0xd528('0x7e')};if(_0x479070['body']['id']){delete _0x479070['body']['id'];}_0x479070[_0xd528('0x45')][_0xd528('0x61')]=_0x479070[_0xd528('0x45')][_0xd528('0x61')]||_0x479070[_0xd528('0x62')]['id'];_0x3c515d[_0xd528('0x63')]['id']=_0x479070[_0xd528('0x45')][_0xd528('0x61')];return db['MailMessage'][_0xd528('0x46')]({'where':{'id':_0x479070[_0xd528('0x41')]['id'],'UserId':null}})[_0xd528('0x23')](handleEntityNotFound(_0x19c969,null))[_0xd528('0x23')](function(_0x2ef7b5){if(_0x2ef7b5){_0x3c515d['message']=_0x2ef7b5[_0xd528('0x67')]({'plain':!![]});return db[_0xd528('0x64')][_0xd528('0x46')]({'where':{'id':_0x2ef7b5[_0xd528('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x19c969,null))['then'](function(_0x556d7b){if(_0x556d7b){_0x3c515d[_0xd528('0x6a')]=_0x556d7b[_0xd528('0x67')]({'plain':!![]});interaction_log[_0xd528('0x19')](_0xd528('0x7f'),_0x479070['user']['id'],_0x479070['user'][_0xd528('0x27')],_0x479070[_0xd528('0x62')][_0xd528('0x69')],_0x3c515d[_0xd528('0x6a')]['id'],_0x479070['body']?JSON[_0xd528('0x15')](_0x479070['body']):'null');return respondWithRpcPromise('RejectMessage',_0xd528('0x80'),_0x3c515d);}return null;})[_0xd528('0x23')](function(_0x2172d5){var _0x1f01ef=_0xd528('0x6d')+_0x2172d5[_0xd528('0x18')]['ContactId'];return db[_0xd528('0x6e')]['query'](_0x1f01ef,{'type':db['Sequelize'][_0xd528('0x70')][_0xd528('0x71')],'raw':!![]})[_0xd528('0x23')](function(_0x19212b){return _0x19212b;});})[_0xd528('0x23')](function(_0x43bfea){if(_0x43bfea){_0x3c515d['message'][_0xd528('0x72')]=_0x43bfea[0x0];if(!_0x479070[_0xd528('0x45')]['UserId'])return;return db[_0xd528('0x73')]['find']({'where':{'id':_0x479070['body'][_0xd528('0x61')],'role':_0xd528('0x63')},'attributes':['id',_0xd528('0x27'),_0xd528('0x74'),'email','internal'],'raw':!![]});}return null;})[_0xd528('0x23')](function(_0xd6e182){if(!_0xd6e182)return null;_0x3c515d[_0xd528('0x18')][_0xd528('0x63')]=_0xd6e182;return _0x3c515d;})['then'](function(_0x38b409){if(_0x38b409){_0x38b409[_0xd528('0x18')][_0xd528('0x77')]=util[_0xd528('0x5d')]('SIP/%s',_0x479070['user']['name']);_0x38b409[_0xd528('0x18')][_0xd528('0x79')]=_0x3c515d[_0xd528('0x79')];_0x38b409[_0xd528('0x18')][_0xd528('0x81')]=_0x3c515d['channel'];_0x38b409[_0xd528('0x18')][_0xd528('0x82')]=_0xd528('0x7d');_0x38b409[_0xd528('0x18')]['body']=htmlToText['fromString'](_0x3c515d['message'][_0xd528('0x45')]);respondWithRpcPromise(_0xd528('0x7b'),_0xd528('0x7b'),{'event':_0xd528('0x83'),'message':_0x38b409[_0xd528('0x18')]},client9002);return _0x3c515d;}return null;})[_0xd528('0x23')](respondWithResult(_0x19c969,null))[_0xd528('0x1a')](handleError(_0x19c969,null));};exports['download']=function(_0x523978,_0x48b301){var _0x4288d3=moment()['unix']()[_0xd528('0x84')]();var _0xae746d=path['join'](config[_0xd528('0x58')],_0xd528('0x85'),_0xd528('0x86'),_0xd528('0x87'));var _0xcb6416=path['join'](config[_0xd528('0x58')],_0xd528('0x85'),'files','attachments');var _0x5bb999=util[_0xd528('0x5d')](_0xd528('0x88'),_0x4288d3);return db['MailMessage'][_0xd528('0x46')]({'where':{'id':_0x523978[_0xd528('0x41')]['id']},'attributes':['id','body','from','to','cc',_0xd528('0x89'),'subject',_0xd528('0x8a')],'include':_0x523978[_0xd528('0x30')][_0xd528('0x56')]?[{'model':db[_0xd528('0x8b')],'as':'Attachments'}]:undefined})[_0xd528('0x23')](handleEntityNotFound(_0x48b301,null))['then'](function(_0x56ddef){if(_0x56ddef){var _0x1f623d=_0x56ddef;var _0x5b3bed={'from':_0x1f623d[_0xd528('0x8c')],'to':_0x1f623d['to'],'subject':_0x1f623d['subject'],'html':htmlEntities[_0xd528('0x8d')](_0x1f623d['body']),'headers':{'Date':moment(_0x1f623d[_0xd528('0x8a')])[_0xd528('0x5d')](_0xd528('0x8e'))},'attachments':[]};if(_0x56ddef['cc']){_0x5b3bed[_0xd528('0x8f')]['Cc']=_0x56ddef['cc'];}if(_0x56ddef[_0xd528('0x89')]){_0x5b3bed[_0xd528('0x8f')][_0xd528('0x90')]=_0x56ddef['bcc'];}return new BPromise(function(_0x371df4,_0x239f3d){if(_0x56ddef['Attachments']){for(var _0x993f93=0x0;_0x993f93<_0x56ddef['Attachments'][_0xd528('0x42')];_0x993f93++){var _0x2049b1=_0x56ddef[_0xd528('0x91')][_0x993f93];var _0x1870d1=path[_0xd528('0x57')](_0xcb6416,_0x2049b1[_0xd528('0x5a')]);if(fs['existsSync'](_0x1870d1)){_0x5b3bed[_0xd528('0x56')]['push']({'name':_0x2049b1[_0xd528('0x27')],'contentType':_0x2049b1[_0xd528('0x2c')],'data':fs['readFileSync'](_0x1870d1)});}}}emlformat[_0xd528('0x92')](_0x5b3bed,function(_0x1e856b,_0x10b6b7){if(_0x1e856b)return _0x239f3d(_0x1e856b);fs[_0xd528('0x93')](path[_0xd528('0x57')](_0xae746d,_0x5bb999),_0x10b6b7);return _0x371df4(_0x10b6b7);});});}})[_0xd528('0x23')](function(_0x1eac10){if(_0x1eac10){return _0x48b301['download'](path[_0xd528('0x57')](_0xae746d,_0x5bb999),_0x5bb999,function(_0x25dd38){if(!_0x25dd38)fs[_0xd528('0x94')](path[_0xd528('0x57')](_0xae746d,_0x5bb999));});}})[_0xd528('0x1a')](handleError(_0x48b301,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d4c5560..740e9f0 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 _0x5079=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x5079,0xf3));var _0x9507=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x5079[_0x2a2166];return _0x3bcf50;};'use strict';var EventEmitter=require(_0x9507('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9507('0x1')](0x0);var events={'afterCreate':_0x9507('0x2'),'afterUpdate':_0x9507('0x3'),'afterDestroy':_0x9507('0x4')};function emitEvent(_0x5d67b4){return function(_0x138492,_0x59da3d,_0x499936){MailMessageEvents[_0x9507('0x5')](_0x5d67b4+':'+_0x138492['id'],_0x138492);MailMessageEvents[_0x9507('0x5')](_0x5d67b4,_0x138492);_0x499936(null);};}for(var e in events){if(events[_0x9507('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x9507('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xd59f=['exports','events','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x397f29,_0x491da8){var _0x2fe4d5=function(_0x4143d9){while(--_0x4143d9){_0x397f29['push'](_0x397f29['shift']());}};_0x2fe4d5(++_0x491da8);}(_0xd59f,0x6d));var _0xfd59=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0xd59f[_0x23ec06];return _0x2831d4;};'use strict';var EventEmitter=require(_0xfd59('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xfd59('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xfd59('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd59('0x3'),'afterDestroy':_0xfd59('0x4')};function emitEvent(_0x2a63a1){return function(_0x2f0738,_0x11b76f,_0x29203a){MailMessageEvents[_0xfd59('0x5')](_0x2a63a1+':'+_0x2f0738['id'],_0x2f0738);MailMessageEvents[_0xfd59('0x5')](_0x2a63a1,_0x2f0738);_0x29203a(null);};}for(var e in events){if(events[_0xfd59('0x6')](e)){var event=events[e];MailMessage[_0xfd59('0x7')](e,emitEvent(event));}}module[_0xfd59('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c8df3ac..b7f20d6 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 _0x2498=['moment','bluebird','html-to-text','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0x2498,0x13c));var _0x8249=function(_0x5ca104,_0x2b333b){_0x5ca104=_0x5ca104-0x0;var _0x1718b1=_0x2498[_0x5ca104];return _0x1718b1;};'use strict';var _=require(_0x8249('0x0'));var util=require(_0x8249('0x1'));var logger=require(_0x8249('0x2'))(_0x8249('0x3'));var moment=require(_0x8249('0x4'));var BPromise=require(_0x8249('0x5'));var rp=require('request-promise');var htmlToText=require(_0x8249('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8249('0x7'));var config=require('../../config/environment');var attributes=require(_0x8249('0x8'));module['exports']=function(_0x1fd645,_0x57761a){return _0x1fd645[_0x8249('0x9')](_0x8249('0xa'),attributes,{'tableName':_0x8249('0xb'),'paranoid':![],'indexes':[{'name':_0x8249('0xc'),'fields':[_0x8249('0xc')]},{'name':'fti_mail_messages','fields':[_0x8249('0xd'),_0x8249('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x40cbde,_0x19db5d,_0x1cdf4a){if(_0x40cbde[_0x8249('0xf')]){_0x40cbde[_0x8249('0xd')]=htmlToText[_0x8249('0x10')](_0x40cbde[_0x8249('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1cdf4a(null,_0x19db5d);},'afterCreate':function(_0x205e1a,_0x27f837,_0x3eb564){var _0x2aebb8=_0x1fd645[_0x8249('0x11')];var _0x55959a=_0x205e1a[_0x8249('0x12')]({'plain':!![]});if(_0x55959a[_0x8249('0x13')]['toLowerCase']()==='in'||_0x55959a['direction'][_0x8249('0x14')]()==='out'&&!_0x55959a[_0x8249('0x15')]&&!_['isNil'](_0x55959a[_0x8249('0x16')])){_0x2aebb8[_0x8249('0x17')][_0x8249('0x18')]({'where':{'id':_0x55959a['MailInteractionId']}})[_0x8249('0x19')](function(_0x629d9d){if(_0x629d9d){_0x629d9d[_0x8249('0x1a')]({'lastMsgAt':_0x55959a[_0x8249('0x1b')],'lastMsgDirection':_0x55959a[_0x8249('0x13')]['toLowerCase']()});}})[_0x8249('0x1c')](function(_0x29538f){console[_0x8249('0x1d')](_0x29538f);});}_0x3eb564();}},'charset':_0x8249('0x1e'),'collate':_0x8249('0x1f')});}; \ No newline at end of file +var _0x38e3=['html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise'];(function(_0x3bdcd6,_0x2131df){var _0x37d627=function(_0x31e523){while(--_0x31e523){_0x3bdcd6['push'](_0x3bdcd6['shift']());}};_0x37d627(++_0x2131df);}(_0x38e3,0x145));var _0x338e=function(_0x20bbaa,_0x2d39be){_0x20bbaa=_0x20bbaa-0x0;var _0x33e6c5=_0x38e3[_0x20bbaa];return _0x33e6c5;};'use strict';var _=require(_0x338e('0x0'));var util=require(_0x338e('0x1'));var logger=require(_0x338e('0x2'))(_0x338e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x338e('0x4'));var htmlToText=require(_0x338e('0x5'));var fs=require('fs');var path=require(_0x338e('0x6'));var rimraf=require(_0x338e('0x7'));var config=require(_0x338e('0x8'));var attributes=require(_0x338e('0x9'));module[_0x338e('0xa')]=function(_0x14dafb,_0x2377ba){return _0x14dafb['define'](_0x338e('0xb'),attributes,{'tableName':_0x338e('0xc'),'paranoid':![],'indexes':[{'name':_0x338e('0xd'),'fields':[_0x338e('0xd')]},{'name':_0x338e('0xe'),'fields':[_0x338e('0xf'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3eb584,_0x2006da,_0x156e3c){if(_0x3eb584[_0x338e('0x10')]){_0x3eb584[_0x338e('0xf')]=htmlToText[_0x338e('0x11')](_0x3eb584[_0x338e('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x156e3c(null,_0x2006da);},'afterCreate':function(_0x51468f,_0x28455d,_0x1a774f){var _0x592543=_0x14dafb[_0x338e('0x12')];var _0x1a1082=_0x51468f[_0x338e('0x13')]({'plain':!![]});if(_0x1a1082[_0x338e('0x14')][_0x338e('0x15')]()==='in'||_0x1a1082['direction'][_0x338e('0x15')]()===_0x338e('0x16')&&!_0x1a1082[_0x338e('0x17')]&&!_[_0x338e('0x18')](_0x1a1082['UserId'])){_0x592543[_0x338e('0x19')][_0x338e('0x1a')]({'where':{'id':_0x1a1082[_0x338e('0x1b')]}})[_0x338e('0x1c')](function(_0x276f4f){if(_0x276f4f){_0x276f4f[_0x338e('0x1d')]({'lastMsgAt':_0x1a1082[_0x338e('0x1e')],'lastMsgDirection':_0x1a1082[_0x338e('0x14')][_0x338e('0x15')]()});}})[_0x338e('0x1f')](function(_0x13ca99){console['error'](_0x13ca99);});}_0x1a774f();}},'charset':'utf8mb4','collate':_0x338e('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1eb6809..d0b320b 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 _0x36ee=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateMailMessage','MailMessage','create','body','options','debug'];(function(_0x5a0a64,_0x5c418d){var _0x35d769=function(_0x9bec5e){while(--_0x9bec5e){_0x5a0a64['push'](_0x5a0a64['shift']());}};_0x35d769(++_0x5c418d);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});config[_0xe36e('0xb')]=_[_0xe36e('0xc')](config['redis'],{'host':_0xe36e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe36e('0xb')]));require(_0xe36e('0xe'))[_0xe36e('0xf')](socket);function respondWithRpcPromise(_0x47ce3a,_0xf119e4,_0x48981b){return new BPromise(function(_0x2e968d,_0x2133cf){return client[_0xe36e('0x10')](_0x47ce3a,_0x48981b)[_0xe36e('0x11')](function(_0xce0110){logger[_0xe36e('0x12')](_0xe36e('0x13'),_0xf119e4,_0xe36e('0x14'));logger['debug'](_0xe36e('0x15'),_0xf119e4,_0xe36e('0x14'),JSON[_0xe36e('0x16')](_0xce0110));if(_0xce0110[_0xe36e('0x17')]){if(_0xce0110['error'][_0xe36e('0x18')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xf119e4,_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);return _0x2133cf(_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);}logger[_0xe36e('0x17')](_0xe36e('0x13'),_0xf119e4,_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);return _0x2e968d(_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);}else{logger['info'](_0xe36e('0x13'),_0xf119e4,_0xe36e('0x14'));_0x2e968d(_0xce0110['result'][_0xe36e('0x19')]);}})['catch'](function(_0x471400){logger[_0xe36e('0x17')]('MailMessage,\x20%s,\x20%s',_0xf119e4,_0x471400);_0x2133cf(_0x471400);});});}exports[_0xe36e('0x1a')]=function(_0x6aa186){var _0x21efe7=this;return new Promise(function(_0x597331,_0x21e95e){return db[_0xe36e('0x1b')][_0xe36e('0x1c')](_0x6aa186[_0xe36e('0x1d')],{'raw':_0x6aa186[_0xe36e('0x1e')]?_0x6aa186[_0xe36e('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xe36e('0x11')](function(_0x4f214a){logger[_0xe36e('0x12')](_0xe36e('0x1a'),_0x6aa186);logger[_0xe36e('0x1f')]('CreateMailMessage',_0x6aa186,JSON['stringify'](_0x4f214a));_0x597331(_0x4f214a);})[_0xe36e('0x20')](function(_0x10818d){logger[_0xe36e('0x17')](_0xe36e('0x1a'),_0x10818d[_0xe36e('0x19')],_0x6aa186);_0x21e95e(_0x21efe7[_0xe36e('0x17')](0x1f4,_0x10818d[_0xe36e('0x19')]));});});}; \ No newline at end of file +var _0x0120=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0120,0x6f));var _0x0012=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0120[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0012('0xc')](config[_0x0012('0xd')],{'host':_0x0012('0xe'),'port':0x18eb});var socket=require(_0x0012('0xf'))(new Redis(config[_0x0012('0xd')]));require('./mailMessage.socket')[_0x0012('0x10')](socket);function respondWithRpcPromise(_0x2d484c,_0x1dc1b2,_0x323282){return new BPromise(function(_0x520171,_0x2d4674){return client['request'](_0x2d484c,_0x323282)[_0x0012('0x11')](function(_0x1d1c02){logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));logger['debug'](_0x0012('0x15'),_0x1dc1b2,'request\x20sent',JSON['stringify'](_0x1d1c02));if(_0x1d1c02['error']){if(_0x1d1c02['error'][_0x0012('0x16')]===0x1f4){logger['error'](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02[_0x0012('0x17')]['message']);return _0x2d4674(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02['error']['message']);return _0x520171(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}else{logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));_0x520171(_0x1d1c02[_0x0012('0x19')][_0x0012('0x18')]);}})[_0x0012('0x1a')](function(_0x5b236f){logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x5b236f);_0x2d4674(_0x5b236f);});});}exports['CreateMailMessage']=function(_0x45d00b){var _0x1f54fc=this;return new Promise(function(_0xa2e623,_0x2c837e){return db['MailMessage']['create'](_0x45d00b[_0x0012('0x1b')],{'raw':_0x45d00b[_0x0012('0x1c')]?_0x45d00b[_0x0012('0x1c')][_0x0012('0x1d')]===undefined?!![]:![]:!![]})[_0x0012('0x11')](function(_0x2e6a2c){logger[_0x0012('0x12')](_0x0012('0x1e'),_0x45d00b);logger['debug'](_0x0012('0x1e'),_0x45d00b,JSON[_0x0012('0x1f')](_0x2e6a2c));_0xa2e623(_0x2e6a2c);})['catch'](function(_0x36cf42){logger[_0x0012('0x17')](_0x0012('0x1e'),_0x36cf42[_0x0012('0x18')],_0x45d00b);_0x2c837e(_0x1f54fc[_0x0012('0x17')](0x1f4,_0x36cf42['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7b85905..59e2257 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 _0x5379=['mailMessage:','./mailMessage.events','emit','removeListener','register','length'];(function(_0x1681f0,_0x1d3c06){var _0x492ab4=function(_0x4740ba){while(--_0x4740ba){_0x1681f0['push'](_0x1681f0['shift']());}};_0x492ab4(++_0x1d3c06);}(_0x5379,0x85));var _0x9537=function(_0x11cc9a,_0x37226f){_0x11cc9a=_0x11cc9a-0x0;var _0x27ffeb=_0x5379[_0x11cc9a];return _0x27ffeb;};'use strict';var MailMessageEvents=require(_0x9537('0x0'));var events=['save','remove','update'];function createListener(_0x149bd5,_0x2aa8b4){return function(_0x2e8041){_0x2aa8b4[_0x9537('0x1')](_0x149bd5,_0x2e8041);};}function removeListener(_0xd1ac66,_0x37090e){return function(){MailMessageEvents[_0x9537('0x2')](_0xd1ac66,_0x37090e);};}exports[_0x9537('0x3')]=function(_0x7a3337){for(var _0x24fc44=0x0,_0x323b3a=events[_0x9537('0x4')];_0x24fc44<_0x323b3a;_0x24fc44++){var _0x1d7e40=events[_0x24fc44];var _0x5a27b3=createListener(_0x9537('0x5')+_0x1d7e40,_0x7a3337);MailMessageEvents['on'](_0x1d7e40,_0x5a27b3);}}; \ No newline at end of file +var _0x7399=['./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x2aa91d,_0x1b4ef5){var _0x204079=function(_0x1b6e86){while(--_0x1b6e86){_0x2aa91d['push'](_0x2aa91d['shift']());}};_0x204079(++_0x1b4ef5);}(_0x7399,0x13e));var _0x9739=function(_0x5e8935,_0x3d1365){_0x5e8935=_0x5e8935-0x0;var _0x417bc8=_0x7399[_0x5e8935];return _0x417bc8;};'use strict';var MailMessageEvents=require(_0x9739('0x0'));var events=[_0x9739('0x1'),_0x9739('0x2'),_0x9739('0x3')];function createListener(_0x1f5f1d,_0x14164e){return function(_0x25ead4){_0x14164e[_0x9739('0x4')](_0x1f5f1d,_0x25ead4);};}function removeListener(_0x1fdd94,_0x22b083){return function(){MailMessageEvents[_0x9739('0x5')](_0x1fdd94,_0x22b083);};}exports['register']=function(_0x5f4e38){for(var _0x4eb9a2=0x0,_0x352b32=events['length'];_0x4eb9a2<_0x352b32;_0x4eb9a2++){var _0x31ed10=events[_0x4eb9a2];var _0x5b3564=createListener('mailMessage:'+_0x31ed10,_0x5f4e38);MailMessageEvents['on'](_0x31ed10,_0x5b3564);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 22ec9c4..7c9c561 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 _0x466c=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeAgents','exports','multer'];(function(_0x5a8608,_0x318f93){var _0x25ddc9=function(_0x962504){while(--_0x962504){_0x5a8608['push'](_0x5a8608['shift']());}};_0x25ddc9(++_0x318f93);}(_0x466c,0xe7));var _0xc466=function(_0x4fb34f,_0x1a95cf){_0x4fb34f=_0x4fb34f-0x0;var _0x1d4726=_0x466c[_0x4fb34f];return _0x1d4726;};'use strict';var multer=require(_0xc466('0x0'));var util=require(_0xc466('0x1'));var path=require(_0xc466('0x2'));var timeout=require('connect-timeout');var express=require(_0xc466('0x3'));var router=express[_0xc466('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc466('0x5'));var interaction=require(_0xc466('0x6'));var config=require(_0xc466('0x7'));var controller=require(_0xc466('0x8'));router['get']('/',auth[_0xc466('0x9')](),controller[_0xc466('0xa')]);router[_0xc466('0xb')]('/describe',auth[_0xc466('0x9')](),controller[_0xc466('0xc')]);router[_0xc466('0xb')](_0xc466('0xd'),auth[_0xc466('0x9')](),controller[_0xc466('0xe')]);router[_0xc466('0xb')](_0xc466('0xf'),auth[_0xc466('0x9')](),controller['getMembers']);router[_0xc466('0xb')](_0xc466('0x10'),auth[_0xc466('0x9')](),controller[_0xc466('0x11')]);router[_0xc466('0xb')](_0xc466('0x12'),auth[_0xc466('0x9')](),controller[_0xc466('0x13')]);router[_0xc466('0x14')]('/',auth[_0xc466('0x9')](),controller[_0xc466('0x15')]);router[_0xc466('0x14')](_0xc466('0x10'),auth[_0xc466('0x9')](),controller[_0xc466('0x16')]);router['post'](_0xc466('0x12'),auth[_0xc466('0x9')](),controller[_0xc466('0x17')]);router[_0xc466('0x18')](_0xc466('0xd'),auth[_0xc466('0x9')](),controller[_0xc466('0x19')]);router[_0xc466('0x1a')]('/:id',auth[_0xc466('0x9')](),controller['destroy']);router[_0xc466('0x1a')]('/:id/teams',auth[_0xc466('0x9')](),controller['removeTeams']);router[_0xc466('0x1a')]('/:id/users',auth[_0xc466('0x9')](),controller[_0xc466('0x1b')]);module[_0xc466('0x1c')]=router; \ No newline at end of file +var _0xe9e3=['update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','show','getMembers','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','put','/:id'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0xe9e3,0xcf));var _0x3e9e=function(_0x2f7ae3,_0x223602){_0x2f7ae3=_0x2f7ae3-0x0;var _0x3fcce6=_0xe9e3[_0x2f7ae3];return _0x3fcce6;};'use strict';var multer=require(_0x3e9e('0x0'));var util=require(_0x3e9e('0x1'));var path=require(_0x3e9e('0x2'));var timeout=require(_0x3e9e('0x3'));var express=require(_0x3e9e('0x4'));var router=express['Router']();var fs_extra=require(_0x3e9e('0x5'));var auth=require(_0x3e9e('0x6'));var interaction=require(_0x3e9e('0x7'));var config=require(_0x3e9e('0x8'));var controller=require(_0x3e9e('0x9'));router['get']('/',auth[_0x3e9e('0xa')](),controller[_0x3e9e('0xb')]);router[_0x3e9e('0xc')]('/describe',auth[_0x3e9e('0xa')](),controller[_0x3e9e('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3e9e('0xe')]);router[_0x3e9e('0xc')]('/:id/members',auth['isAuthenticated'](),controller[_0x3e9e('0xf')]);router[_0x3e9e('0xc')](_0x3e9e('0x10'),auth[_0x3e9e('0xa')](),controller[_0x3e9e('0x11')]);router[_0x3e9e('0xc')]('/:id/users',auth[_0x3e9e('0xa')](),controller[_0x3e9e('0x12')]);router['post']('/',auth[_0x3e9e('0xa')](),controller[_0x3e9e('0x13')]);router['post'](_0x3e9e('0x10'),auth[_0x3e9e('0xa')](),controller[_0x3e9e('0x14')]);router[_0x3e9e('0x15')]('/:id/users',auth[_0x3e9e('0xa')](),controller[_0x3e9e('0x16')]);router[_0x3e9e('0x17')](_0x3e9e('0x18'),auth[_0x3e9e('0xa')](),controller[_0x3e9e('0x19')]);router[_0x3e9e('0x1a')](_0x3e9e('0x18'),auth[_0x3e9e('0xa')](),controller['destroy']);router[_0x3e9e('0x1a')](_0x3e9e('0x10'),auth['isAuthenticated'](),controller[_0x3e9e('0x1b')]);router['delete']('/:id/users',auth[_0x3e9e('0xa')](),controller[_0x3e9e('0x1c')]);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 6f14069..b107ebd 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 _0x92c4=['roundrobin','sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x92c4,0x1c8));var _0x492c=function(_0x3f38e5,_0x5b6733){_0x3f38e5=_0x3f38e5-0x0;var _0x4724ab=_0x92c4[_0x3f38e5];return _0x4724ab;};'use strict';var Sequelize=require(_0x492c('0x0'));module[_0x492c('0x1')]={'name':{'type':Sequelize[_0x492c('0x2')],'unique':_0x492c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x492c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x492c('0x4'),_0x492c('0x5'),_0x492c('0x6'))}}; \ No newline at end of file +var _0xb090=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x312318,_0x5276ea){var _0x2c5bdf=function(_0x164d2a){while(--_0x164d2a){_0x312318['push'](_0x312318['shift']());}};_0x2c5bdf(++_0x5276ea);}(_0xb090,0x65));var _0x0b09=function(_0x3fa7b8,_0x1a3a33){_0x3fa7b8=_0x3fa7b8-0x0;var _0x2d63c9=_0xb090[_0x3fa7b8];return _0x2d63c9;};'use strict';var Sequelize=require('sequelize');module[_0x0b09('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0b09('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b09('0x2')](_0x0b09('0x3'),_0x0b09('0x4'),_0x0b09('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 68f18a5..3083215 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 _0xa89a=['forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','squel','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','MailQueues','destroy','error','stack','name','index','map','rawAttributes','type','key','where','include','query','findAll','rows','catch','show','keys','MailQueue','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','params','describe','getMembers','nolimit','sort','pick','MailQueueId','filter','merge','User','findAndCountAll','UserId','mailPause','updatedAt','format','createdAt','getTeams','findOne','Team','order','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','UserMailQueue','emit','userMailQueue:save','removeTeams','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents'];(function(_0x28150d,_0x276ffa){var _0x52fd33=function(_0x295559){while(--_0x295559){_0x28150d['push'](_0x28150d['shift']());}};_0x52fd33(++_0x276ffa);}(_0xa89a,0x16c));var _0xaa89=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa89a[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xaa89('0x0'));var util=require('util');var _=require(_0xaa89('0x1'));var squel=require(_0xaa89('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xaa89('0x3'));var config=require(_0xaa89('0x4'));var db=require(_0xaa89('0x5'))['db'];config[_0xaa89('0x6')]=_[_0xaa89('0x7')](config[_0xaa89('0x6')],{'host':_0xaa89('0x8'),'port':0x18eb});var socket=require(_0xaa89('0x9'))(new Redis(config[_0xaa89('0x6')]));require('./mailQueue.socket')[_0xaa89('0xa')](socket);function respondWithStatusCode(_0x2a3f73,_0x1f1daa){_0x1f1daa=_0x1f1daa||0xcc;return function(_0x1df311){if(_0x1df311){return _0x2a3f73[_0xaa89('0xb')](_0x1f1daa);}return _0x2a3f73['status'](_0x1f1daa)[_0xaa89('0xc')]();};}function respondWithResult(_0x11d11c,_0x3b44e2){_0x3b44e2=_0x3b44e2||0xc8;return function(_0x19003e){if(_0x19003e){return _0x11d11c['status'](_0x3b44e2)[_0xaa89('0xd')](_0x19003e);}};}function respondWithFilteredResult(_0x4f0f28,_0x5ef75a){return function(_0x3a3c4b){if(_0x3a3c4b){var _0x3bdf7d=typeof _0x5ef75a[_0xaa89('0xe')]===_0xaa89('0xf')&&typeof _0x5ef75a[_0xaa89('0x10')]==='undefined';var _0x28e014=_0x3a3c4b[_0xaa89('0x11')];var _0x581416=_0x3bdf7d?0x0:_0x5ef75a[_0xaa89('0xe')];var _0x1f11db=_0x3bdf7d?_0x3a3c4b[_0xaa89('0x11')]:_0x5ef75a[_0xaa89('0xe')]+_0x5ef75a[_0xaa89('0x10')];var _0x5eb844;if(_0x1f11db>=_0x28e014){_0x1f11db=_0x28e014;_0x5eb844=0xc8;}else{_0x5eb844=0xce;}_0x4f0f28[_0xaa89('0x12')](_0x5eb844);return _0x4f0f28[_0xaa89('0x13')](_0xaa89('0x14'),_0x581416+'-'+_0x1f11db+'/'+_0x28e014)[_0xaa89('0xd')](_0x3a3c4b);}return null;};}function saveUpdates(_0x14b01b){return function(_0x41d699){if(_0x41d699){return _0x41d699[_0xaa89('0x15')](_0x14b01b)['then'](function(_0x5d5325){return _0x5d5325;});}return null;};}function removeEntity(_0x43d9a2){return function(_0x591b37){if(_0x591b37){return _0x591b37['destroy']()[_0xaa89('0x16')](function(){var _0x55b7ea=_0x591b37['get']({'plain':!![]});var _0x28fdbf=_0xaa89('0x17');return db['UserProfileResource'][_0xaa89('0x18')]({'where':{'type':_0x28fdbf,'resourceId':_0x55b7ea['id']}})[_0xaa89('0x16')](function(){return _0x591b37;});})[_0xaa89('0x16')](function(){_0x43d9a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e78e){return function(_0x3cc510){if(!_0x3cc510){_0x23e78e[_0xaa89('0xb')](0x194);}return _0x3cc510;};}function handleError(_0x2c3ccf,_0x5e9fe5){_0x5e9fe5=_0x5e9fe5||0x1f4;return function(_0x15406e){logger[_0xaa89('0x19')](_0x15406e[_0xaa89('0x1a')]);if(_0x15406e[_0xaa89('0x1b')]){delete _0x15406e['name'];}_0x2c3ccf[_0xaa89('0x12')](_0x5e9fe5)['send'](_0x15406e);};}exports[_0xaa89('0x1c')]=function(_0x15ff67,_0x5cfa9d){var _0x4b523c={};var _0x143da6={'count':0x0,'rows':[]};var _0x5a31cc=_[_0xaa89('0x1d')](db['MailQueue'][_0xaa89('0x1e')],function(_0x2ea689){return{'name':_0x2ea689['fieldName'],'type':_0x2ea689[_0xaa89('0x1f')][_0xaa89('0x20')]};});_0x4b523c=qs['getOptions'](_0x5a31cc,_0x15ff67);var _0x340388={'where':_0x4b523c[_0xaa89('0x21')]};return db['MailQueue'][_0xaa89('0x11')](_0x340388)[_0xaa89('0x16')](function(_0x4a2d48){_0x143da6[_0xaa89('0x11')]=_0x4a2d48;_0x4b523c[_0xaa89('0x22')]=qs[_0xaa89('0x22')](_0x15ff67[_0xaa89('0x23')]);return db['MailQueue'][_0xaa89('0x24')](_0x4b523c);})[_0xaa89('0x16')](function(_0xe9189d){_0x143da6[_0xaa89('0x25')]=_0xe9189d;return _0x143da6;})[_0xaa89('0x16')](respondWithFilteredResult(_0x5cfa9d,_0x4b523c))[_0xaa89('0x26')](handleError(_0x5cfa9d,null));};exports[_0xaa89('0x27')]=function(_0x54ec8a,_0x16c1ca){var _0x31b126={'raw':!![],'where':{'id':_0x54ec8a['params']['id']}},_0x28cbb7={};_0x28cbb7['model']=_[_0xaa89('0x28')](db[_0xaa89('0x29')][_0xaa89('0x1e')]);_0x28cbb7[_0xaa89('0x23')]=_[_0xaa89('0x28')](_0x54ec8a[_0xaa89('0x23')]);_0x28cbb7[_0xaa89('0x2a')]=_[_0xaa89('0x2b')](_0x28cbb7[_0xaa89('0x2c')],_0x28cbb7[_0xaa89('0x23')]);_0x31b126[_0xaa89('0x2d')]=_[_0xaa89('0x2b')](_0x28cbb7['model'],qs[_0xaa89('0x2e')](_0x54ec8a['query'][_0xaa89('0x2e')]));_0x31b126['attributes']=_0x31b126[_0xaa89('0x2d')][_0xaa89('0x2f')]?_0x31b126[_0xaa89('0x2d')]:_0x28cbb7[_0xaa89('0x2c')];if(_0x54ec8a[_0xaa89('0x23')][_0xaa89('0x30')]){_0x31b126[_0xaa89('0x22')]=[{'all':!![]}];}_0x31b126=_['merge']({},_0x31b126,_0x54ec8a[_0xaa89('0x31')]);return db[_0xaa89('0x29')][_0xaa89('0x32')](_0x31b126)[_0xaa89('0x16')](handleEntityNotFound(_0x16c1ca,null))['then'](respondWithResult(_0x16c1ca,null))['catch'](handleError(_0x16c1ca,null));};exports[_0xaa89('0x33')]=function(_0x4c8ae4,_0x5d3c6d){return db[_0xaa89('0x29')][_0xaa89('0x33')](_0x4c8ae4[_0xaa89('0x34')],{})[_0xaa89('0x16')](function(_0x4dd9ea){var _0xc30ae0=_0x4c8ae4['user'][_0xaa89('0x35')]({'plain':!![]});if(!_0xc30ae0)throw new Error(_0xaa89('0x36'));if(_0xc30ae0[_0xaa89('0x37')]===_0xaa89('0x38')){var _0x576473=_0x4dd9ea[_0xaa89('0x35')]({'plain':!![]});var _0x4ace54=_0xaa89('0x17');return db['UserProfileSection'][_0xaa89('0x32')]({'where':{'name':_0x4ace54,'userProfileId':_0xc30ae0[_0xaa89('0x39')]},'raw':!![]})['then'](function(_0x20d082){if(_0x20d082&&_0x20d082[_0xaa89('0x3a')]===0x0){return db[_0xaa89('0x3b')][_0xaa89('0x33')]({'name':_0x576473[_0xaa89('0x1b')],'resourceId':_0x576473['id'],'type':_0x20d082[_0xaa89('0x1b')],'sectionId':_0x20d082['id']},{})[_0xaa89('0x16')](function(){return _0x4dd9ea;});}else{return _0x4dd9ea;}})[_0xaa89('0x26')](function(_0x5e383c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e383c);throw _0x5e383c;});}return _0x4dd9ea;})[_0xaa89('0x16')](respondWithResult(_0x5d3c6d,0xc9))[_0xaa89('0x26')](handleError(_0x5d3c6d,null));};exports['update']=function(_0x37b830,_0x2d489e){if(_0x37b830[_0xaa89('0x34')]['id']){delete _0x37b830[_0xaa89('0x34')]['id'];}return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x37b830[_0xaa89('0x3c')]['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x2d489e,null))['then'](saveUpdates(_0x37b830[_0xaa89('0x34')],null))[_0xaa89('0x16')](respondWithResult(_0x2d489e,null))[_0xaa89('0x26')](handleError(_0x2d489e,null));};exports[_0xaa89('0x18')]=function(_0x383b26,_0x2f2705){return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x383b26['params']['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x2f2705,null))[_0xaa89('0x16')](removeEntity(_0x2f2705,null))[_0xaa89('0x26')](handleError(_0x2f2705,null));};exports[_0xaa89('0x3d')]=function(_0x5bbd28,_0xebb77a){return db[_0xaa89('0x29')][_0xaa89('0x3d')]()[_0xaa89('0x16')](respondWithResult(_0xebb77a,null))[_0xaa89('0x26')](handleError(_0xebb77a,null));};exports[_0xaa89('0x3e')]=function(_0x2fe876,_0x3ebde4){var _0x1e7836={'raw':!![],'where':{}},_0x4f4670={},_0xa305e6;return db[_0xaa89('0x29')]['findOne']({'where':{'id':_0x2fe876['params']['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x3ebde4,null))[_0xaa89('0x16')](function(_0x1085fd){if(_0x1085fd){_0xa305e6=_0x1085fd[_0xaa89('0x35')]({'plain':!![]});_0x4f4670[_0xaa89('0x2c')]=_[_0xaa89('0x28')](db['UserMailQueue'][_0xaa89('0x1e')]);_0x4f4670[_0xaa89('0x23')]=_['keys'](_0x2fe876['query']);_0x4f4670['filters']=_[_0xaa89('0x2b')](_0x4f4670[_0xaa89('0x2c')],_0x4f4670[_0xaa89('0x23')]);_0x1e7836[_0xaa89('0x2d')]=_[_0xaa89('0x2b')](_0x4f4670[_0xaa89('0x2c')],qs[_0xaa89('0x2e')](_0x2fe876[_0xaa89('0x23')]['fields']));_0x1e7836[_0xaa89('0x2d')]=_0x1e7836[_0xaa89('0x2d')]['length']?_0x1e7836[_0xaa89('0x2d')]:_0x4f4670[_0xaa89('0x2c')];if(!_0x2fe876['query']['hasOwnProperty'](_0xaa89('0x3f'))){_0x1e7836[_0xaa89('0x10')]=qs[_0xaa89('0x10')](_0x2fe876['query'][_0xaa89('0x10')]);_0x1e7836[_0xaa89('0xe')]=qs['offset'](_0x2fe876[_0xaa89('0x23')][_0xaa89('0xe')]);}_0x1e7836['order']=qs[_0xaa89('0x40')](_0x2fe876[_0xaa89('0x23')][_0xaa89('0x40')]);_0x1e7836[_0xaa89('0x21')]=qs[_0xaa89('0x2a')](_[_0xaa89('0x41')](_0x2fe876['query'],_0x4f4670[_0xaa89('0x2a')]));_0x1e7836['where'][_0xaa89('0x42')]=_0x1085fd['id'];if(_0x2fe876[_0xaa89('0x23')][_0xaa89('0x43')]){_0x1e7836[_0xaa89('0x21')]=_[_0xaa89('0x44')](_0x1e7836[_0xaa89('0x21')],{'$or':_[_0xaa89('0x1d')](_0x1e7836[_0xaa89('0x2d')],function(_0x1c3a74){var _0x788deb={};_0x788deb[_0x1c3a74]={'$like':'%'+_0x2fe876[_0xaa89('0x23')][_0xaa89('0x43')]+'%'};return _0x788deb;})});}_0x1e7836=_[_0xaa89('0x44')]({},_0x1e7836,_0x2fe876[_0xaa89('0x31')]);return db['UserMailQueue']['findAll'](_0x1e7836);}})['then'](function(_0x4dcc7b){if(_0x4dcc7b){return db[_0xaa89('0x45')][_0xaa89('0x46')]({'where':{'id':_[_0xaa89('0x1d')](_0x4dcc7b,_0xaa89('0x47')),'role':'agent'},'attributes':['id','name',_0xaa89('0x48'),_0xaa89('0x49'),'createdAt']});}})['then'](function(_0x34ee4e){if(_0x34ee4e){return{'count':_0x34ee4e[_0xaa89('0x11')],'rows':_[_0xaa89('0x1d')](_0x34ee4e[_0xaa89('0x25')],function(_0x1a1cd0){return{'membername':_0x1a1cd0[_0xaa89('0x1b')],'UserId':_0x1a1cd0['id'],'queue_name':_0xa305e6[_0xaa89('0x1b')],'MailQueueId':_0xa305e6['id'],'interface':util[_0xaa89('0x4a')]('%s/%s','SIP',_0x1a1cd0[_0xaa89('0x1b')]),'penalty':0x0,'paused':_0x1a1cd0[_0xaa89('0x48')],'createdAt':_0x1a1cd0[_0xaa89('0x4b')],'updatedAt':_0x1a1cd0[_0xaa89('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa89('0x16')](respondWithFilteredResult(_0x3ebde4,_0x1e7836))[_0xaa89('0x26')](handleError(_0x3ebde4,null));};exports[_0xaa89('0x4c')]=function(_0x1d94b0,_0x322723){var _0x4fd6c8={};var _0x4a624f={};var _0x4e076d;var _0x18aae4;return db[_0xaa89('0x29')][_0xaa89('0x4d')]({'where':{'id':_0x1d94b0['params']['id']}})['then'](handleEntityNotFound(_0x322723,null))['then'](function(_0x42343c){if(_0x42343c){_0x4e076d=_0x42343c;_0x4a624f[_0xaa89('0x2c')]=_['keys'](db[_0xaa89('0x4e')][_0xaa89('0x1e')]);_0x4a624f['query']=_[_0xaa89('0x28')](_0x1d94b0['query']);_0x4a624f[_0xaa89('0x2a')]=_['intersection'](_0x4a624f[_0xaa89('0x2c')],_0x4a624f[_0xaa89('0x23')]);_0x4fd6c8[_0xaa89('0x2d')]=_['intersection'](_0x4a624f['model'],qs[_0xaa89('0x2e')](_0x1d94b0[_0xaa89('0x23')][_0xaa89('0x2e')]));_0x4fd6c8[_0xaa89('0x2d')]=_0x4fd6c8[_0xaa89('0x2d')][_0xaa89('0x2f')]?_0x4fd6c8['attributes']:_0x4a624f[_0xaa89('0x2c')];_0x4fd6c8[_0xaa89('0x4f')]=qs[_0xaa89('0x40')](_0x1d94b0['query'][_0xaa89('0x40')]);_0x4fd6c8[_0xaa89('0x21')]=qs[_0xaa89('0x2a')](_[_0xaa89('0x41')](_0x1d94b0[_0xaa89('0x23')],_0x4a624f[_0xaa89('0x2a')]));if(_0x1d94b0[_0xaa89('0x23')]['filter']){_0x4fd6c8[_0xaa89('0x21')]=_[_0xaa89('0x44')](_0x4fd6c8['where'],{'$or':_[_0xaa89('0x1d')](_0x4fd6c8[_0xaa89('0x2d')],function(_0x2830bd){var _0x1ba8af={};_0x1ba8af[_0x2830bd]={'$like':'%'+_0x1d94b0[_0xaa89('0x23')][_0xaa89('0x43')]+'%'};return _0x1ba8af;})});}_0x4fd6c8=_['merge']({},_0x4fd6c8,_0x1d94b0[_0xaa89('0x31')]);return _0x4e076d[_0xaa89('0x4c')](_0x4fd6c8);}})[_0xaa89('0x16')](function(_0x365362){if(_0x365362){_0x18aae4=_0x365362[_0xaa89('0x2f')];if(!_0x1d94b0[_0xaa89('0x23')][_0xaa89('0x50')](_0xaa89('0x3f'))){_0x4fd6c8[_0xaa89('0x10')]=qs[_0xaa89('0x10')](_0x1d94b0[_0xaa89('0x23')]['limit']);_0x4fd6c8['offset']=qs[_0xaa89('0xe')](_0x1d94b0[_0xaa89('0x23')][_0xaa89('0xe')]);}return _0x4e076d[_0xaa89('0x4c')](_0x4fd6c8);}})['then'](function(_0x2806b9){if(_0x2806b9){return _0x2806b9?{'count':_0x18aae4,'rows':_0x2806b9}:null;}})[_0xaa89('0x16')](respondWithResult(_0x322723,null))[_0xaa89('0x26')](handleError(_0x322723,null));};exports[_0xaa89('0x51')]=function(_0x5a1e71,_0x464279){var _0x582783=_0x5a1e71[_0xaa89('0x34')][_0xaa89('0x52')];return db[_0xaa89('0x4e')][_0xaa89('0x24')]({'where':{'id':_0x582783},'attributes':['id'],'include':[{'model':db[_0xaa89('0x45')],'as':_0xaa89('0x53'),'attributes':['id',_0xaa89('0x1b'),'online',_0xaa89('0x54'),_0xaa89('0x55')],'raw':!![]}]})['then'](function(_0x327da9){if(_0x327da9){var _0xf15997=_[_0xaa89('0x56')](_0x327da9,function(_0x2ddf0c){var _0x6d9a32=_0x2ddf0c[_0xaa89('0x35')]({'plain':!![]});return _0x6d9a32[_0xaa89('0x53')];});return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x5a1e71[_0xaa89('0x3c')]['id']}})['then'](function(_0x7e2c97){return db['sequelize'][_0xaa89('0x57')](function(_0x7bf24a){return _0x7e2c97[_0xaa89('0x51')](_0x582783,{'transaction':_0x7bf24a})[_0xaa89('0x16')](function(){return BPromise['each'](_0xf15997,function(_0x2ee6a6){return db[_0xaa89('0x58')]['findOrCreate']({'where':{'UserId':_0x2ee6a6['id'],'MailQueueId':_0x5a1e71['params']['id']},'transaction':_0x7bf24a});});})[_0xaa89('0x16')](function(){_0xf15997['forEach'](function(_0x56a696){socket[_0xaa89('0x59')](_0xaa89('0x5a'),{'UserId':_0x56a696['id'],'MailQueueId':_0x7e2c97['id']});});});});});}})[_0xaa89('0x16')](respondWithStatusCode(_0x464279,null))[_0xaa89('0x26')](handleError(_0x464279,null));};exports[_0xaa89('0x5b')]=function(_0x560462,_0x1e9400){return db[_0xaa89('0x4e')][_0xaa89('0x24')]({'where':{'id':_0x560462[_0xaa89('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0xaa89('0x45')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e9400,null))['then'](function(_0xd0b4c9){var _0xcd6148=_[_0xaa89('0x1d')](_0xd0b4c9,'id');var _0x22f6a0=[];var _0x194f52=[];var _0x4ccbf9=squel['select']();_0x4ccbf9[_0xaa89('0x5c')]('tq.TeamId')[_0xaa89('0x5d')](_0xaa89('0x5e'),'tq')[_0xaa89('0x5f')](_0xaa89('0x60'),'ut',_0xaa89('0x61'))[_0xaa89('0x21')](_0xaa89('0x62'),_0x560462[_0xaa89('0x3c')]['id']);for(var _0x116ef8=0x0;_0x116ef8<_0xd0b4c9[_0xaa89('0x2f')];_0x116ef8+=0x1){let _0x275aed=_0xd0b4c9[_0x116ef8];for(var _0x3281fd=0x0;_0x3281fd<_0x275aed[_0xaa89('0x53')][_0xaa89('0x2f')];_0x3281fd+=0x1){let _0x18f04d=_0x275aed[_0xaa89('0x53')][_0x3281fd];var _0x1d17b3=_0x4ccbf9['clone']();_0x1d17b3[_0xaa89('0x21')](_0xaa89('0x63'),_0x18f04d['id']);_0x194f52[_0xaa89('0x64')](db[_0xaa89('0x65')][_0xaa89('0x23')](_0x1d17b3[_0xaa89('0x66')](),{'type':db[_0xaa89('0x65')][_0xaa89('0x67')]['SELECT']})['then'](function(_0x4295d6){if(_0x4295d6['length']===0x1){return _0x18f04d['id'];}else{var _0x1e4077=_[_0xaa89('0x68')](_[_0xaa89('0x1d')](_0x4295d6,_0xaa89('0x69')),function(_0x3891bf){return _[_0xaa89('0x6a')](_0xcd6148,_0x3891bf);});if(_0x1e4077){return _0x18f04d['id'];}}}));}}return BPromise[_0xaa89('0x6b')](_0x194f52)[_0xaa89('0x16')](function(_0x5e225c){_0x22f6a0=_(_0x22f6a0)['union'](_0x5e225c)[_0xaa89('0x6c')]()[_0xaa89('0x6d')]();return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x560462[_0xaa89('0x3c')]['id']}})['then'](function(_0x1f0abb){return db['sequelize']['transaction'](function(_0x3fc623){return _0x1f0abb[_0xaa89('0x5b')](_0x560462[_0xaa89('0x23')][_0xaa89('0x52')],{'transaction':_0x3fc623})[_0xaa89('0x16')](function(){if(!_[_0xaa89('0x6e')](_0x22f6a0)){return _0x1f0abb[_0xaa89('0x6f')](_0x22f6a0,{'transaction':_0x3fc623});}})[_0xaa89('0x16')](function(){_0x22f6a0[_0xaa89('0x70')](function(_0x4cd596){socket[_0xaa89('0x59')](_0xaa89('0x71'),{'UserId':_0x4cd596,'MailQueueId':_0x1f0abb['id']});});});});});});})[_0xaa89('0x16')](respondWithStatusCode(_0x1e9400,null))[_0xaa89('0x26')](handleError(_0x1e9400,null));};exports[_0xaa89('0x72')]=function(_0x3b1504,_0x5532d7){return db[_0xaa89('0x29')]['find']({'where':{'id':_0x3b1504[_0xaa89('0x3c')]['id']}})[_0xaa89('0x16')](handleEntityNotFound(_0x5532d7,null))[_0xaa89('0x16')](function(_0x25c41e){if(_0x25c41e){return _0x25c41e['addAgents'](_0x3b1504[_0xaa89('0x34')][_0xaa89('0x52')],_[_0xaa89('0x73')](_0x3b1504[_0xaa89('0x34')],['ids','id'])||{})[_0xaa89('0x74')](function(_0x341f77){for(var _0x3106ca=0x0;_0x3106ca<_0x3b1504[_0xaa89('0x34')][_0xaa89('0x52')][_0xaa89('0x2f')];_0x3106ca+=0x1){socket[_0xaa89('0x59')](_0xaa89('0x5a'),{'UserId':Number(_0x3b1504['body'][_0xaa89('0x52')][_0x3106ca]),'MailQueueId':Number(_0x3b1504[_0xaa89('0x3c')]['id'])});}return _0x341f77;});}})[_0xaa89('0x16')](respondWithResult(_0x5532d7,null))[_0xaa89('0x26')](handleError(_0x5532d7,null));};exports[_0xaa89('0x6f')]=function(_0x42ba85,_0x569a9e){return db[_0xaa89('0x29')][_0xaa89('0x32')]({'where':{'id':_0x42ba85['params']['id']}})['then'](handleEntityNotFound(_0x569a9e,null))[_0xaa89('0x16')](function(_0x2be3c0){if(_0x2be3c0){return _0x2be3c0[_0xaa89('0x6f')](_0x42ba85[_0xaa89('0x23')]['ids'])['then'](function(){if(_[_0xaa89('0x75')](_0x42ba85[_0xaa89('0x23')][_0xaa89('0x52')])){for(var _0x3ab177=0x0;_0x3ab177<_0x42ba85[_0xaa89('0x23')]['ids'][_0xaa89('0x2f')];_0x3ab177+=0x1){socket[_0xaa89('0x59')](_0xaa89('0x71'),{'UserId':Number(_0x42ba85[_0xaa89('0x23')][_0xaa89('0x52')][_0x3ab177]),'MailQueueId':Number(_0x42ba85['params']['id'])});}}else{socket[_0xaa89('0x59')](_0xaa89('0x71'),{'UserId':Number(_0x42ba85[_0xaa89('0x23')]['ids']),'MailQueueId':Number(_0x42ba85[_0xaa89('0x3c')]['id'])});}});}})[_0xaa89('0x16')](respondWithStatusCode(_0x569a9e,null))[_0xaa89('0x26')](handleError(_0x569a9e,null));};exports[_0xaa89('0x76')]=function(_0x3e8887,_0x335bd){var _0x3ca345={};var _0x3ff062={};var _0x495179;var _0x4006ce;return db[_0xaa89('0x29')][_0xaa89('0x4d')]({'where':{'id':_0x3e8887['params']['id']}})['then'](handleEntityNotFound(_0x335bd,null))[_0xaa89('0x16')](function(_0x3214fe){if(_0x3214fe){_0x495179=_0x3214fe;_0x3ff062[_0xaa89('0x2c')]=_['keys'](db[_0xaa89('0x45')][_0xaa89('0x1e')]);_0x3ff062[_0xaa89('0x23')]=_[_0xaa89('0x28')](_0x3e8887['query']);_0x3ff062[_0xaa89('0x2a')]=_[_0xaa89('0x2b')](_0x3ff062['model'],_0x3ff062[_0xaa89('0x23')]);_0x3ca345['attributes']=_[_0xaa89('0x2b')](_0x3ff062['model'],qs[_0xaa89('0x2e')](_0x3e8887[_0xaa89('0x23')][_0xaa89('0x2e')]));_0x3ca345[_0xaa89('0x2d')]=_0x3ca345[_0xaa89('0x2d')]['length']?_0x3ca345['attributes']:_0x3ff062[_0xaa89('0x2c')];_0x3ca345[_0xaa89('0x4f')]=qs[_0xaa89('0x40')](_0x3e8887[_0xaa89('0x23')][_0xaa89('0x40')]);_0x3ca345[_0xaa89('0x21')]=qs[_0xaa89('0x2a')](_[_0xaa89('0x41')](_0x3e8887[_0xaa89('0x23')],_0x3ff062[_0xaa89('0x2a')]));if(_0x3e8887[_0xaa89('0x23')][_0xaa89('0x43')]){_0x3ca345[_0xaa89('0x21')]=_['merge'](_0x3ca345['where'],{'$or':_['map'](_0x3ca345[_0xaa89('0x2d')],function(_0x410b15){var _0x24fd38={};_0x24fd38[_0x410b15]={'$like':'%'+_0x3e8887[_0xaa89('0x23')][_0xaa89('0x43')]+'%'};return _0x24fd38;})});}_0x3ca345=_[_0xaa89('0x44')]({},_0x3ca345,_0x3e8887[_0xaa89('0x31')]);return _0x495179[_0xaa89('0x76')](_0x3ca345);}})[_0xaa89('0x16')](function(_0x39892f){if(_0x39892f){_0x4006ce=_0x39892f[_0xaa89('0x2f')];if(!_0x3e8887[_0xaa89('0x23')][_0xaa89('0x50')](_0xaa89('0x3f'))){_0x3ca345[_0xaa89('0x10')]=qs[_0xaa89('0x10')](_0x3e8887[_0xaa89('0x23')]['limit']);_0x3ca345[_0xaa89('0xe')]=qs['offset'](_0x3e8887[_0xaa89('0x23')][_0xaa89('0xe')]);}return _0x495179['getAgents'](_0x3ca345);}})[_0xaa89('0x16')](function(_0x2c2b42){if(_0x2c2b42){return _0x2c2b42?{'count':_0x4006ce,'rows':_0x2c2b42}:null;}})[_0xaa89('0x16')](respondWithResult(_0x335bd,null))['catch'](handleError(_0x335bd,null));}; \ No newline at end of file +var _0xd630=['lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','MailQueue','rawAttributes','fieldName','type','getOptions','where','count','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','MailQueueId','filter','options','User','findAndCountAll','map','UserId','agent','format','%s/%s','SIP','mailPause','updatedAt','getTeams','Team','nolimit','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','forEach','emit','userMailQueue:save','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','pick','bluebird'];(function(_0x318736,_0x12f8f3){var _0x4b3111=function(_0xa664e6){while(--_0xa664e6){_0x318736['push'](_0x318736['shift']());}};_0x4b3111(++_0x12f8f3);}(_0xd630,0xf5));var _0x0d63=function(_0x4329a5,_0x5b9738){_0x4329a5=_0x4329a5-0x0;var _0x36b884=_0xd630[_0x4329a5];return _0x36b884;};'use strict';var BPromise=require(_0x0d63('0x0'));var util=require('util');var _=require(_0x0d63('0x1'));var squel=require(_0x0d63('0x2'));var Redis=require(_0x0d63('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x0d63('0x4'))('api');var config=require(_0x0d63('0x5'));var db=require(_0x0d63('0x6'))['db'];config['redis']=_[_0x0d63('0x7')](config['redis'],{'host':_0x0d63('0x8'),'port':0x18eb});var socket=require(_0x0d63('0x9'))(new Redis(config[_0x0d63('0xa')]));require(_0x0d63('0xb'))['register'](socket);function respondWithStatusCode(_0x348036,_0x2f0e34){_0x2f0e34=_0x2f0e34||0xcc;return function(_0x7a8b5d){if(_0x7a8b5d){return _0x348036[_0x0d63('0xc')](_0x2f0e34);}return _0x348036[_0x0d63('0xd')](_0x2f0e34)[_0x0d63('0xe')]();};}function respondWithResult(_0x228429,_0x4f2c72){_0x4f2c72=_0x4f2c72||0xc8;return function(_0xc93490){if(_0xc93490){return _0x228429[_0x0d63('0xd')](_0x4f2c72)[_0x0d63('0xf')](_0xc93490);}};}function respondWithFilteredResult(_0x2122f7,_0x27fa6c){return function(_0x157321){if(_0x157321){var _0x17f5d3=typeof _0x27fa6c[_0x0d63('0x10')]===_0x0d63('0x11')&&typeof _0x27fa6c[_0x0d63('0x12')]==='undefined';var _0x3ef44d=_0x157321['count'];var _0x33c88d=_0x17f5d3?0x0:_0x27fa6c[_0x0d63('0x10')];var _0x3e352b=_0x17f5d3?_0x157321['count']:_0x27fa6c['offset']+_0x27fa6c[_0x0d63('0x12')];var _0x4695ae;if(_0x3e352b>=_0x3ef44d){_0x3e352b=_0x3ef44d;_0x4695ae=0xc8;}else{_0x4695ae=0xce;}_0x2122f7[_0x0d63('0xd')](_0x4695ae);return _0x2122f7[_0x0d63('0x13')](_0x0d63('0x14'),_0x33c88d+'-'+_0x3e352b+'/'+_0x3ef44d)['json'](_0x157321);}return null;};}function saveUpdates(_0x7fc1af){return function(_0x59c3b7){if(_0x59c3b7){return _0x59c3b7['update'](_0x7fc1af)[_0x0d63('0x15')](function(_0x441375){return _0x441375;});}return null;};}function removeEntity(_0x15208b){return function(_0x400d0c){if(_0x400d0c){return _0x400d0c[_0x0d63('0x16')]()['then'](function(){var _0x4e4ba6=_0x400d0c[_0x0d63('0x17')]({'plain':!![]});var _0x16a985=_0x0d63('0x18');return db[_0x0d63('0x19')][_0x0d63('0x16')]({'where':{'type':_0x16a985,'resourceId':_0x4e4ba6['id']}})[_0x0d63('0x15')](function(){return _0x400d0c;});})[_0x0d63('0x15')](function(){_0x15208b[_0x0d63('0xd')](0xcc)[_0x0d63('0xe')]();});}};}function handleEntityNotFound(_0x18187b){return function(_0x179e43){if(!_0x179e43){_0x18187b[_0x0d63('0xc')](0x194);}return _0x179e43;};}function handleError(_0x46b3f4,_0x52cb4d){_0x52cb4d=_0x52cb4d||0x1f4;return function(_0x46d69b){logger[_0x0d63('0x1a')](_0x46d69b[_0x0d63('0x1b')]);if(_0x46d69b[_0x0d63('0x1c')]){delete _0x46d69b['name'];}_0x46b3f4[_0x0d63('0xd')](_0x52cb4d)[_0x0d63('0x1d')](_0x46d69b);};}exports['index']=function(_0x3ada54,_0x60fb7c){var _0xc54e0={};var _0x597fd3={'count':0x0,'rows':[]};var _0x5a0710=_['map'](db[_0x0d63('0x1e')][_0x0d63('0x1f')],function(_0x1c0267){return{'name':_0x1c0267[_0x0d63('0x20')],'type':_0x1c0267[_0x0d63('0x21')]['key']};});_0xc54e0=qs[_0x0d63('0x22')](_0x5a0710,_0x3ada54);var _0x1697a6={'where':_0xc54e0[_0x0d63('0x23')]};return db[_0x0d63('0x1e')][_0x0d63('0x24')](_0x1697a6)[_0x0d63('0x15')](function(_0x405b7e){_0x597fd3[_0x0d63('0x24')]=_0x405b7e;_0xc54e0[_0x0d63('0x25')]=qs[_0x0d63('0x25')](_0x3ada54['query']);return db['MailQueue'][_0x0d63('0x26')](_0xc54e0);})[_0x0d63('0x15')](function(_0x71165c){_0x597fd3[_0x0d63('0x27')]=_0x71165c;return _0x597fd3;})[_0x0d63('0x15')](respondWithFilteredResult(_0x60fb7c,_0xc54e0))[_0x0d63('0x28')](handleError(_0x60fb7c,null));};exports[_0x0d63('0x29')]=function(_0x545151,_0x2a1a67){var _0x5c46a8={'raw':!![],'where':{'id':_0x545151[_0x0d63('0x2a')]['id']}},_0x41358e={};_0x41358e[_0x0d63('0x2b')]=_[_0x0d63('0x2c')](db[_0x0d63('0x1e')][_0x0d63('0x1f')]);_0x41358e['query']=_[_0x0d63('0x2c')](_0x545151[_0x0d63('0x2d')]);_0x41358e[_0x0d63('0x2e')]=_[_0x0d63('0x2f')](_0x41358e['model'],_0x41358e[_0x0d63('0x2d')]);_0x5c46a8[_0x0d63('0x30')]=_[_0x0d63('0x2f')](_0x41358e['model'],qs[_0x0d63('0x31')](_0x545151[_0x0d63('0x2d')]['fields']));_0x5c46a8[_0x0d63('0x30')]=_0x5c46a8[_0x0d63('0x30')][_0x0d63('0x32')]?_0x5c46a8[_0x0d63('0x30')]:_0x41358e[_0x0d63('0x2b')];if(_0x545151[_0x0d63('0x2d')][_0x0d63('0x33')]){_0x5c46a8[_0x0d63('0x25')]=[{'all':!![]}];}_0x5c46a8=_[_0x0d63('0x34')]({},_0x5c46a8,_0x545151['options']);return db[_0x0d63('0x1e')][_0x0d63('0x35')](_0x5c46a8)[_0x0d63('0x15')](handleEntityNotFound(_0x2a1a67,null))[_0x0d63('0x15')](respondWithResult(_0x2a1a67,null))[_0x0d63('0x28')](handleError(_0x2a1a67,null));};exports['create']=function(_0x3c6a0c,_0x56bcc7){return db[_0x0d63('0x1e')][_0x0d63('0x36')](_0x3c6a0c[_0x0d63('0x37')],{})['then'](function(_0x558c6c){var _0x48b782=_0x3c6a0c[_0x0d63('0x38')][_0x0d63('0x17')]({'plain':!![]});if(!_0x48b782)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48b782[_0x0d63('0x39')]===_0x0d63('0x38')){var _0x2a481b=_0x558c6c['get']({'plain':!![]});var _0x2d3c61='MailQueues';return db[_0x0d63('0x3a')]['find']({'where':{'name':_0x2d3c61,'userProfileId':_0x48b782[_0x0d63('0x3b')]},'raw':!![]})['then'](function(_0x586ca0){if(_0x586ca0&&_0x586ca0[_0x0d63('0x3c')]===0x0){return db[_0x0d63('0x19')][_0x0d63('0x36')]({'name':_0x2a481b[_0x0d63('0x1c')],'resourceId':_0x2a481b['id'],'type':_0x586ca0['name'],'sectionId':_0x586ca0['id']},{})[_0x0d63('0x15')](function(){return _0x558c6c;});}else{return _0x558c6c;}})[_0x0d63('0x28')](function(_0x55c0e4){logger[_0x0d63('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55c0e4);throw _0x55c0e4;});}return _0x558c6c;})[_0x0d63('0x15')](respondWithResult(_0x56bcc7,0xc9))[_0x0d63('0x28')](handleError(_0x56bcc7,null));};exports['update']=function(_0x32ecc5,_0x232d9e){if(_0x32ecc5['body']['id']){delete _0x32ecc5[_0x0d63('0x37')]['id'];}return db[_0x0d63('0x1e')]['find']({'where':{'id':_0x32ecc5[_0x0d63('0x2a')]['id']}})['then'](handleEntityNotFound(_0x232d9e,null))['then'](saveUpdates(_0x32ecc5[_0x0d63('0x37')],null))[_0x0d63('0x15')](respondWithResult(_0x232d9e,null))[_0x0d63('0x28')](handleError(_0x232d9e,null));};exports['destroy']=function(_0x25834a,_0x243700){return db['MailQueue']['find']({'where':{'id':_0x25834a['params']['id']}})[_0x0d63('0x15')](handleEntityNotFound(_0x243700,null))['then'](removeEntity(_0x243700,null))[_0x0d63('0x28')](handleError(_0x243700,null));};exports['describe']=function(_0x1e71c9,_0x1ffc20){return db[_0x0d63('0x1e')]['describe']()[_0x0d63('0x15')](respondWithResult(_0x1ffc20,null))[_0x0d63('0x28')](handleError(_0x1ffc20,null));};exports[_0x0d63('0x3d')]=function(_0x57f332,_0x27d2ec){var _0x8dc240={'raw':!![],'where':{}},_0x13a24d={},_0x1d7094;return db['MailQueue'][_0x0d63('0x3e')]({'where':{'id':_0x57f332[_0x0d63('0x2a')]['id']}})[_0x0d63('0x15')](handleEntityNotFound(_0x27d2ec,null))['then'](function(_0x5b6a25){if(_0x5b6a25){_0x1d7094=_0x5b6a25['get']({'plain':!![]});_0x13a24d[_0x0d63('0x2b')]=_[_0x0d63('0x2c')](db[_0x0d63('0x3f')][_0x0d63('0x1f')]);_0x13a24d[_0x0d63('0x2d')]=_[_0x0d63('0x2c')](_0x57f332['query']);_0x13a24d[_0x0d63('0x2e')]=_[_0x0d63('0x2f')](_0x13a24d[_0x0d63('0x2b')],_0x13a24d[_0x0d63('0x2d')]);_0x8dc240[_0x0d63('0x30')]=_[_0x0d63('0x2f')](_0x13a24d[_0x0d63('0x2b')],qs['fields'](_0x57f332[_0x0d63('0x2d')]['fields']));_0x8dc240[_0x0d63('0x30')]=_0x8dc240[_0x0d63('0x30')][_0x0d63('0x32')]?_0x8dc240[_0x0d63('0x30')]:_0x13a24d[_0x0d63('0x2b')];if(!_0x57f332[_0x0d63('0x2d')][_0x0d63('0x40')]('nolimit')){_0x8dc240[_0x0d63('0x12')]=qs[_0x0d63('0x12')](_0x57f332[_0x0d63('0x2d')][_0x0d63('0x12')]);_0x8dc240['offset']=qs[_0x0d63('0x10')](_0x57f332[_0x0d63('0x2d')]['offset']);}_0x8dc240[_0x0d63('0x41')]=qs[_0x0d63('0x42')](_0x57f332['query'][_0x0d63('0x42')]);_0x8dc240[_0x0d63('0x23')]=qs[_0x0d63('0x2e')](_['pick'](_0x57f332[_0x0d63('0x2d')],_0x13a24d['filters']));_0x8dc240[_0x0d63('0x23')][_0x0d63('0x43')]=_0x5b6a25['id'];if(_0x57f332[_0x0d63('0x2d')][_0x0d63('0x44')]){_0x8dc240['where']=_[_0x0d63('0x34')](_0x8dc240[_0x0d63('0x23')],{'$or':_['map'](_0x8dc240[_0x0d63('0x30')],function(_0x55cab7){var _0x3a8251={};_0x3a8251[_0x55cab7]={'$like':'%'+_0x57f332[_0x0d63('0x2d')][_0x0d63('0x44')]+'%'};return _0x3a8251;})});}_0x8dc240=_[_0x0d63('0x34')]({},_0x8dc240,_0x57f332[_0x0d63('0x45')]);return db[_0x0d63('0x3f')]['findAll'](_0x8dc240);}})[_0x0d63('0x15')](function(_0x5ac2c8){if(_0x5ac2c8){return db[_0x0d63('0x46')][_0x0d63('0x47')]({'where':{'id':_[_0x0d63('0x48')](_0x5ac2c8,_0x0d63('0x49')),'role':_0x0d63('0x4a')},'attributes':['id',_0x0d63('0x1c'),'mailPause','updatedAt','createdAt']});}})[_0x0d63('0x15')](function(_0xc1a2e7){if(_0xc1a2e7){return{'count':_0xc1a2e7[_0x0d63('0x24')],'rows':_['map'](_0xc1a2e7['rows'],function(_0x295d5d){return{'membername':_0x295d5d[_0x0d63('0x1c')],'UserId':_0x295d5d['id'],'queue_name':_0x1d7094[_0x0d63('0x1c')],'MailQueueId':_0x1d7094['id'],'interface':util[_0x0d63('0x4b')](_0x0d63('0x4c'),_0x0d63('0x4d'),_0x295d5d[_0x0d63('0x1c')]),'penalty':0x0,'paused':_0x295d5d[_0x0d63('0x4e')],'createdAt':_0x295d5d['createdAt'],'updatedAt':_0x295d5d[_0x0d63('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d63('0x15')](respondWithFilteredResult(_0x27d2ec,_0x8dc240))[_0x0d63('0x28')](handleError(_0x27d2ec,null));};exports[_0x0d63('0x50')]=function(_0xeedb31,_0x480e93){var _0x1ef631={};var _0x24c89d={};var _0x1456ca;var _0x10de11;return db[_0x0d63('0x1e')]['findOne']({'where':{'id':_0xeedb31[_0x0d63('0x2a')]['id']}})[_0x0d63('0x15')](handleEntityNotFound(_0x480e93,null))[_0x0d63('0x15')](function(_0x341b05){if(_0x341b05){_0x1456ca=_0x341b05;_0x24c89d[_0x0d63('0x2b')]=_[_0x0d63('0x2c')](db[_0x0d63('0x51')][_0x0d63('0x1f')]);_0x24c89d['query']=_[_0x0d63('0x2c')](_0xeedb31[_0x0d63('0x2d')]);_0x24c89d[_0x0d63('0x2e')]=_['intersection'](_0x24c89d[_0x0d63('0x2b')],_0x24c89d[_0x0d63('0x2d')]);_0x1ef631[_0x0d63('0x30')]=_[_0x0d63('0x2f')](_0x24c89d[_0x0d63('0x2b')],qs[_0x0d63('0x31')](_0xeedb31[_0x0d63('0x2d')][_0x0d63('0x31')]));_0x1ef631[_0x0d63('0x30')]=_0x1ef631['attributes']['length']?_0x1ef631['attributes']:_0x24c89d['model'];_0x1ef631[_0x0d63('0x41')]=qs[_0x0d63('0x42')](_0xeedb31[_0x0d63('0x2d')][_0x0d63('0x42')]);_0x1ef631[_0x0d63('0x23')]=qs['filters'](_['pick'](_0xeedb31[_0x0d63('0x2d')],_0x24c89d[_0x0d63('0x2e')]));if(_0xeedb31['query'][_0x0d63('0x44')]){_0x1ef631['where']=_[_0x0d63('0x34')](_0x1ef631[_0x0d63('0x23')],{'$or':_[_0x0d63('0x48')](_0x1ef631[_0x0d63('0x30')],function(_0x9a68b9){var _0x4304a2={};_0x4304a2[_0x9a68b9]={'$like':'%'+_0xeedb31[_0x0d63('0x2d')][_0x0d63('0x44')]+'%'};return _0x4304a2;})});}_0x1ef631=_[_0x0d63('0x34')]({},_0x1ef631,_0xeedb31[_0x0d63('0x45')]);return _0x1456ca[_0x0d63('0x50')](_0x1ef631);}})[_0x0d63('0x15')](function(_0x516501){if(_0x516501){_0x10de11=_0x516501[_0x0d63('0x32')];if(!_0xeedb31[_0x0d63('0x2d')][_0x0d63('0x40')](_0x0d63('0x52'))){_0x1ef631[_0x0d63('0x12')]=qs['limit'](_0xeedb31[_0x0d63('0x2d')][_0x0d63('0x12')]);_0x1ef631[_0x0d63('0x10')]=qs[_0x0d63('0x10')](_0xeedb31[_0x0d63('0x2d')][_0x0d63('0x10')]);}return _0x1456ca['getTeams'](_0x1ef631);}})['then'](function(_0x3ff471){if(_0x3ff471){return _0x3ff471?{'count':_0x10de11,'rows':_0x3ff471}:null;}})[_0x0d63('0x15')](respondWithResult(_0x480e93,null))[_0x0d63('0x28')](handleError(_0x480e93,null));};exports['addTeams']=function(_0x524a26,_0x435cec){var _0x9d0fcd=_0x524a26[_0x0d63('0x37')][_0x0d63('0x53')];return db[_0x0d63('0x51')][_0x0d63('0x26')]({'where':{'id':_0x9d0fcd},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0d63('0x54'),'attributes':['id',_0x0d63('0x1c'),_0x0d63('0x55'),_0x0d63('0x56'),'interface'],'raw':!![]}]})[_0x0d63('0x15')](function(_0x5dd991){if(_0x5dd991){var _0x361e36=_[_0x0d63('0x57')](_0x5dd991,function(_0x11074b){var _0x11eea2=_0x11074b[_0x0d63('0x17')]({'plain':!![]});return _0x11eea2['Agents'];});return db[_0x0d63('0x1e')][_0x0d63('0x35')]({'where':{'id':_0x524a26['params']['id']}})['then'](function(_0x8cc1e1){return db[_0x0d63('0x58')][_0x0d63('0x59')](function(_0x194079){return _0x8cc1e1[_0x0d63('0x5a')](_0x9d0fcd,{'transaction':_0x194079})['then'](function(){return BPromise[_0x0d63('0x5b')](_0x361e36,function(_0x13afdb){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x13afdb['id'],'MailQueueId':_0x524a26[_0x0d63('0x2a')]['id']},'transaction':_0x194079});});})[_0x0d63('0x15')](function(){_0x361e36[_0x0d63('0x5c')](function(_0xa9eae8){socket[_0x0d63('0x5d')](_0x0d63('0x5e'),{'UserId':_0xa9eae8['id'],'MailQueueId':_0x8cc1e1['id']});});});});});}})[_0x0d63('0x15')](respondWithStatusCode(_0x435cec,null))['catch'](handleError(_0x435cec,null));};exports['removeTeams']=function(_0x2d5185,_0x5a29e5){return db[_0x0d63('0x51')][_0x0d63('0x26')]({'where':{'id':_0x2d5185[_0x0d63('0x2d')][_0x0d63('0x53')]},'attributes':['id'],'include':[{'model':db[_0x0d63('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0d63('0x15')](handleEntityNotFound(_0x5a29e5,null))['then'](function(_0x3fad11){var _0x19d321=_[_0x0d63('0x48')](_0x3fad11,'id');var _0x4f9788=[];var _0x120add=[];var _0x804e5d=squel[_0x0d63('0x5f')]();_0x804e5d['field'](_0x0d63('0x60'))[_0x0d63('0x61')](_0x0d63('0x62'),'tq')['join'](_0x0d63('0x63'),'ut',_0x0d63('0x64'))['where'](_0x0d63('0x65'),_0x2d5185[_0x0d63('0x2a')]['id']);for(var _0x3a8b7e=0x0;_0x3a8b7e<_0x3fad11[_0x0d63('0x32')];_0x3a8b7e+=0x1){let _0x37ae21=_0x3fad11[_0x3a8b7e];for(var _0x1fc620=0x0;_0x1fc620<_0x37ae21[_0x0d63('0x54')][_0x0d63('0x32')];_0x1fc620+=0x1){let _0x217c41=_0x37ae21[_0x0d63('0x54')][_0x1fc620];var _0x4f96b8=_0x804e5d[_0x0d63('0x66')]();_0x4f96b8[_0x0d63('0x23')](_0x0d63('0x67'),_0x217c41['id']);_0x120add[_0x0d63('0x68')](db[_0x0d63('0x58')][_0x0d63('0x2d')](_0x4f96b8['toString'](),{'type':db[_0x0d63('0x58')][_0x0d63('0x69')][_0x0d63('0x6a')]})[_0x0d63('0x15')](function(_0xeec626){if(_0xeec626[_0x0d63('0x32')]===0x1){return _0x217c41['id'];}else{var _0x2d7668=_[_0x0d63('0x6b')](_[_0x0d63('0x48')](_0xeec626,_0x0d63('0x6c')),function(_0x56aa62){return _[_0x0d63('0x6d')](_0x19d321,_0x56aa62);});if(_0x2d7668){return _0x217c41['id'];}}}));}}return BPromise[_0x0d63('0x6e')](_0x120add)[_0x0d63('0x15')](function(_0x5b7204){_0x4f9788=_(_0x4f9788)[_0x0d63('0x6f')](_0x5b7204)[_0x0d63('0x70')]()[_0x0d63('0x71')]();return db[_0x0d63('0x1e')][_0x0d63('0x35')]({'where':{'id':_0x2d5185[_0x0d63('0x2a')]['id']}})[_0x0d63('0x15')](function(_0x40e9dc){return db[_0x0d63('0x58')]['transaction'](function(_0x557143){return _0x40e9dc['removeTeams'](_0x2d5185[_0x0d63('0x2d')]['ids'],{'transaction':_0x557143})['then'](function(){if(!_[_0x0d63('0x72')](_0x4f9788)){return _0x40e9dc['removeAgents'](_0x4f9788,{'transaction':_0x557143});}})['then'](function(){_0x4f9788['forEach'](function(_0x526338){socket[_0x0d63('0x5d')](_0x0d63('0x73'),{'UserId':_0x526338,'MailQueueId':_0x40e9dc['id']});});});});});});})[_0x0d63('0x15')](respondWithStatusCode(_0x5a29e5,null))['catch'](handleError(_0x5a29e5,null));};exports[_0x0d63('0x74')]=function(_0x12f19c,_0x296eb8){return db[_0x0d63('0x1e')][_0x0d63('0x35')]({'where':{'id':_0x12f19c[_0x0d63('0x2a')]['id']}})[_0x0d63('0x15')](handleEntityNotFound(_0x296eb8,null))[_0x0d63('0x15')](function(_0x45fa3a){if(_0x45fa3a){return _0x45fa3a[_0x0d63('0x74')](_0x12f19c['body']['ids'],_[_0x0d63('0x75')](_0x12f19c[_0x0d63('0x37')],[_0x0d63('0x53'),'id'])||{})[_0x0d63('0x76')](function(_0x594fae){for(var _0x3dd8f9=0x0;_0x3dd8f9<_0x12f19c[_0x0d63('0x37')][_0x0d63('0x53')][_0x0d63('0x32')];_0x3dd8f9+=0x1){socket['emit'](_0x0d63('0x5e'),{'UserId':Number(_0x12f19c['body']['ids'][_0x3dd8f9]),'MailQueueId':Number(_0x12f19c[_0x0d63('0x2a')]['id'])});}return _0x594fae;});}})[_0x0d63('0x15')](respondWithResult(_0x296eb8,null))['catch'](handleError(_0x296eb8,null));};exports['removeAgents']=function(_0x555262,_0x1eb5f9){return db[_0x0d63('0x1e')][_0x0d63('0x35')]({'where':{'id':_0x555262[_0x0d63('0x2a')]['id']}})[_0x0d63('0x15')](handleEntityNotFound(_0x1eb5f9,null))[_0x0d63('0x15')](function(_0x578617){if(_0x578617){return _0x578617[_0x0d63('0x77')](_0x555262[_0x0d63('0x2d')][_0x0d63('0x53')])[_0x0d63('0x15')](function(){if(_[_0x0d63('0x78')](_0x555262[_0x0d63('0x2d')][_0x0d63('0x53')])){for(var _0x4cc8bf=0x0;_0x4cc8bf<_0x555262[_0x0d63('0x2d')]['ids'][_0x0d63('0x32')];_0x4cc8bf+=0x1){socket[_0x0d63('0x5d')](_0x0d63('0x73'),{'UserId':Number(_0x555262[_0x0d63('0x2d')]['ids'][_0x4cc8bf]),'MailQueueId':Number(_0x555262[_0x0d63('0x2a')]['id'])});}}else{socket[_0x0d63('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x555262['query'][_0x0d63('0x53')]),'MailQueueId':Number(_0x555262[_0x0d63('0x2a')]['id'])});}});}})[_0x0d63('0x15')](respondWithStatusCode(_0x1eb5f9,null))['catch'](handleError(_0x1eb5f9,null));};exports[_0x0d63('0x79')]=function(_0x3ef1a2,_0x107054){var _0x43f2bc={};var _0x699929={};var _0x26ddc7;var _0x658109;return db['MailQueue'][_0x0d63('0x3e')]({'where':{'id':_0x3ef1a2['params']['id']}})[_0x0d63('0x15')](handleEntityNotFound(_0x107054,null))[_0x0d63('0x15')](function(_0x5e5960){if(_0x5e5960){_0x26ddc7=_0x5e5960;_0x699929[_0x0d63('0x2b')]=_[_0x0d63('0x2c')](db[_0x0d63('0x46')]['rawAttributes']);_0x699929[_0x0d63('0x2d')]=_[_0x0d63('0x2c')](_0x3ef1a2[_0x0d63('0x2d')]);_0x699929['filters']=_['intersection'](_0x699929[_0x0d63('0x2b')],_0x699929['query']);_0x43f2bc[_0x0d63('0x30')]=_[_0x0d63('0x2f')](_0x699929[_0x0d63('0x2b')],qs['fields'](_0x3ef1a2['query']['fields']));_0x43f2bc['attributes']=_0x43f2bc['attributes'][_0x0d63('0x32')]?_0x43f2bc['attributes']:_0x699929[_0x0d63('0x2b')];_0x43f2bc['order']=qs[_0x0d63('0x42')](_0x3ef1a2[_0x0d63('0x2d')][_0x0d63('0x42')]);_0x43f2bc[_0x0d63('0x23')]=qs[_0x0d63('0x2e')](_[_0x0d63('0x7a')](_0x3ef1a2[_0x0d63('0x2d')],_0x699929['filters']));if(_0x3ef1a2[_0x0d63('0x2d')][_0x0d63('0x44')]){_0x43f2bc[_0x0d63('0x23')]=_[_0x0d63('0x34')](_0x43f2bc[_0x0d63('0x23')],{'$or':_[_0x0d63('0x48')](_0x43f2bc[_0x0d63('0x30')],function(_0x3e116d){var _0x265d42={};_0x265d42[_0x3e116d]={'$like':'%'+_0x3ef1a2[_0x0d63('0x2d')][_0x0d63('0x44')]+'%'};return _0x265d42;})});}_0x43f2bc=_['merge']({},_0x43f2bc,_0x3ef1a2[_0x0d63('0x45')]);return _0x26ddc7['getAgents'](_0x43f2bc);}})[_0x0d63('0x15')](function(_0x349562){if(_0x349562){_0x658109=_0x349562[_0x0d63('0x32')];if(!_0x3ef1a2[_0x0d63('0x2d')][_0x0d63('0x40')](_0x0d63('0x52'))){_0x43f2bc[_0x0d63('0x12')]=qs[_0x0d63('0x12')](_0x3ef1a2['query'][_0x0d63('0x12')]);_0x43f2bc['offset']=qs[_0x0d63('0x10')](_0x3ef1a2[_0x0d63('0x2d')]['offset']);}return _0x26ddc7[_0x0d63('0x79')](_0x43f2bc);}})['then'](function(_0x1ea5e2){if(_0x1ea5e2){return _0x1ea5e2?{'count':_0x658109,'rows':_0x1ea5e2}:null;}})[_0x0d63('0x15')](respondWithResult(_0x107054,null))['catch'](handleError(_0x107054,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f6fda3a..3143692 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 _0x95ba=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove'];(function(_0x5e1f08,_0x4c6848){var _0x372d91=function(_0x213fec){while(--_0x213fec){_0x5e1f08['push'](_0x5e1f08['shift']());}};_0x372d91(++_0x4c6848);}(_0x95ba,0x9a));var _0xa95b=function(_0x5670e7,_0xd759ea){_0x5670e7=_0x5670e7-0x0;var _0x3050b2=_0x95ba[_0x5670e7];return _0x3050b2;};'use strict';var EventEmitter=require(_0xa95b('0x0'));var MailQueue=require(_0xa95b('0x1'))['db'][_0xa95b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa95b('0x3')](0x0);var events={'afterCreate':_0xa95b('0x4'),'afterUpdate':'update','afterDestroy':_0xa95b('0x5')};function emitEvent(_0x536c43){return function(_0x537de1,_0x42b1e4,_0x3e417a){MailQueueEvents[_0xa95b('0x6')](_0x536c43+':'+_0x537de1['id'],_0x537de1);MailQueueEvents[_0xa95b('0x6')](_0x536c43,_0x537de1);_0x3e417a(null);};}for(var e in events){if(events[_0xa95b('0x7')](e)){var event=events[e];MailQueue[_0xa95b('0x8')](e,emitEvent(event));}}module[_0xa95b('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x2011=['emit','hasOwnProperty','hook','../../mysqldb','MailQueue','setMaxListeners','save','update','remove'];(function(_0x5b7afb,_0x3a5626){var _0x322d5f=function(_0x88440e){while(--_0x88440e){_0x5b7afb['push'](_0x5b7afb['shift']());}};_0x322d5f(++_0x3a5626);}(_0x2011,0x81));var _0x1201=function(_0x5476fc,_0x29edea){_0x5476fc=_0x5476fc-0x0;var _0x506895=_0x2011[_0x5476fc];return _0x506895;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x1201('0x0'))['db'][_0x1201('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1201('0x2')](0x0);var events={'afterCreate':_0x1201('0x3'),'afterUpdate':_0x1201('0x4'),'afterDestroy':_0x1201('0x5')};function emitEvent(_0x3c5f1b){return function(_0x3ea7cf,_0x546a99,_0x30f2e2){MailQueueEvents['emit'](_0x3c5f1b+':'+_0x3ea7cf['id'],_0x3ea7cf);MailQueueEvents[_0x1201('0x6')](_0x3c5f1b,_0x3ea7cf);_0x30f2e2(null);};}for(var e in events){if(events[_0x1201('0x7')](e)){var event=events[e];MailQueue[_0x1201('0x8')](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 54569cd..a149971 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 _0xab58=['mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x4edb25,_0x20880c){var _0x5dade1=function(_0x359b75){while(--_0x359b75){_0x4edb25['push'](_0x4edb25['shift']());}};_0x5dade1(++_0x20880c);}(_0xab58,0x17a));var _0x8ab5=function(_0x558f7f,_0x2652bc){_0x558f7f=_0x558f7f-0x0;var _0x357551=_0xab58[_0x558f7f];return _0x357551;};'use strict';var _=require('lodash');var util=require(_0x8ab5('0x0'));var logger=require(_0x8ab5('0x1'))(_0x8ab5('0x2'));var moment=require(_0x8ab5('0x3'));var BPromise=require(_0x8ab5('0x4'));var rp=require(_0x8ab5('0x5'));var fs=require('fs');var path=require(_0x8ab5('0x6'));var rimraf=require(_0x8ab5('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ab5('0x8'));module[_0x8ab5('0x9')]=function(_0x343046,_0xa79b2f){return _0x343046[_0x8ab5('0xa')](_0x8ab5('0xb'),attributes,{'tableName':_0x8ab5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a7d=['define','MailQueue','mail_queues','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x267d27,_0x58aa75){var _0x9bceff=function(_0x5c7a15){while(--_0x5c7a15){_0x267d27['push'](_0x267d27['shift']());}};_0x9bceff(++_0x58aa75);}(_0x5a7d,0x1d7));var _0xd5a7=function(_0x87d3ec,_0x387888){_0x87d3ec=_0x87d3ec-0x0;var _0x5f3f6f=_0x5a7d[_0x87d3ec];return _0x5f3f6f;};'use strict';var _=require(_0xd5a7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd5a7('0x1'));var moment=require(_0xd5a7('0x2'));var BPromise=require(_0xd5a7('0x3'));var rp=require(_0xd5a7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5a7('0x5'));var config=require(_0xd5a7('0x6'));var attributes=require(_0xd5a7('0x7'));module[_0xd5a7('0x8')]=function(_0x6d09e8,_0x25a14a){return _0x6d09e8[_0xd5a7('0x9')](_0xd5a7('0xa'),attributes,{'tableName':_0xd5a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index ff71614..9ade2ef 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 _0x6002=['../../config/utils','../../config/logger','client','http','redis','./mailQueue.socket','register','request','then','info','request\x20sent','stringify','error','message','MailQueue,\x20%s,\x20%s','GetMailQueue','MailQueue','options','raw','where','attributes','map','include','model','ShowMailQueue','find','debug','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x35ab0a,_0x148476){var _0x15c29b=function(_0x460736){while(--_0x460736){_0x35ab0a['push'](_0x35ab0a['shift']());}};_0x15c29b(++_0x148476);}(_0x6002,0x103));var _0x2600=function(_0x14e379,_0x25e449){_0x14e379=_0x14e379-0x0;var _0x125a12=_0x6002[_0x14e379];return _0x125a12;};'use strict';var _=require(_0x2600('0x0'));var util=require(_0x2600('0x1'));var moment=require('moment');var BPromise=require(_0x2600('0x2'));var rs=require(_0x2600('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2600('0x4'))['db'];var utils=require(_0x2600('0x5'));var logger=require(_0x2600('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2600('0x7')][_0x2600('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2600('0x9')]));require(_0x2600('0xa'))[_0x2600('0xb')](socket);function respondWithRpcPromise(_0x5ffacf,_0xf66a15,_0x271ea4){return new BPromise(function(_0x495031,_0x1ec1bc){return client[_0x2600('0xc')](_0x5ffacf,_0x271ea4)[_0x2600('0xd')](function(_0x1e8d3c){logger[_0x2600('0xe')]('MailQueue,\x20%s,\x20%s',_0xf66a15,_0x2600('0xf'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0xf66a15,_0x2600('0xf'),JSON[_0x2600('0x10')](_0x1e8d3c));if(_0x1e8d3c[_0x2600('0x11')]){if(_0x1e8d3c[_0x2600('0x11')]['code']===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0xf66a15,_0x1e8d3c[_0x2600('0x11')][_0x2600('0x12')]);return _0x1ec1bc(_0x1e8d3c['error'][_0x2600('0x12')]);}logger[_0x2600('0x11')]('MailQueue,\x20%s,\x20%s',_0xf66a15,_0x1e8d3c[_0x2600('0x11')][_0x2600('0x12')]);return _0x495031(_0x1e8d3c[_0x2600('0x11')]['message']);}else{logger[_0x2600('0xe')](_0x2600('0x13'),_0xf66a15,_0x2600('0xf'));_0x495031(_0x1e8d3c['result']['message']);}})['catch'](function(_0x3e3769){logger[_0x2600('0x11')](_0x2600('0x13'),_0xf66a15,_0x3e3769);_0x1ec1bc(_0x3e3769);});});}exports[_0x2600('0x14')]=function(_0x18bb11){var _0x584ccf=this;return new Promise(function(_0x3e8774,_0x1c3386){return db[_0x2600('0x15')]['findAll']({'raw':_0x18bb11['options']?_0x18bb11[_0x2600('0x16')][_0x2600('0x17')]===undefined?!![]:![]:!![],'where':_0x18bb11['options']?_0x18bb11[_0x2600('0x16')][_0x2600('0x18')]||null:null,'attributes':_0x18bb11[_0x2600('0x16')]?_0x18bb11[_0x2600('0x16')][_0x2600('0x19')]||null:null,'limit':_0x18bb11[_0x2600('0x16')]?_0x18bb11[_0x2600('0x16')]['limit']||null:null,'include':_0x18bb11[_0x2600('0x16')]?_0x18bb11['options']['include']?_[_0x2600('0x1a')](_0x18bb11['options'][_0x2600('0x1b')],function(_0x9f4e35){return{'model':db[_0x9f4e35[_0x2600('0x1c')]],'as':_0x9f4e35['as'],'attributes':_0x9f4e35[_0x2600('0x19')],'include':_0x9f4e35[_0x2600('0x1b')]?_['map'](_0x9f4e35[_0x2600('0x1b')],function(_0x13cf91){return{'model':db[_0x13cf91[_0x2600('0x1c')]],'as':_0x13cf91['as'],'attributes':_0x13cf91[_0x2600('0x19')],'include':_0x13cf91['include']?_[_0x2600('0x1a')](_0x13cf91['include'],function(_0x1e3c22){return{'model':db[_0x1e3c22[_0x2600('0x1c')]],'as':_0x1e3c22['as'],'attributes':_0x1e3c22[_0x2600('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2600('0xd')](function(_0x487b80){logger[_0x2600('0xe')](_0x2600('0x14'),_0x18bb11);logger['debug']('GetMailQueue',_0x18bb11,JSON[_0x2600('0x10')](_0x487b80));_0x3e8774(_0x487b80);})['catch'](function(_0x5711af){logger[_0x2600('0x11')](_0x2600('0x14'),_0x5711af[_0x2600('0x12')],_0x18bb11);_0x1c3386(_0x584ccf[_0x2600('0x11')](0x1f4,_0x5711af['message']));});});};exports[_0x2600('0x1d')]=function(_0x16b0fe){var _0x1f545d=this;return new Promise(function(_0x3b9e4a,_0x3d2bf8){return db['MailQueue'][_0x2600('0x1e')]({'raw':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe[_0x2600('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe[_0x2600('0x16')]['where']||null:null,'attributes':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe['options'][_0x2600('0x19')]||null:null,'include':_0x16b0fe[_0x2600('0x16')]?_0x16b0fe[_0x2600('0x16')][_0x2600('0x1b')]?_[_0x2600('0x1a')](_0x16b0fe[_0x2600('0x16')][_0x2600('0x1b')],function(_0x3ddacb){return{'model':db[_0x3ddacb[_0x2600('0x1c')]],'as':_0x3ddacb['as'],'attributes':_0x3ddacb[_0x2600('0x19')],'include':_0x3ddacb[_0x2600('0x1b')]?_[_0x2600('0x1a')](_0x3ddacb['include'],function(_0x4d64f3){return{'model':db[_0x4d64f3[_0x2600('0x1c')]],'as':_0x4d64f3['as'],'attributes':_0x4d64f3['attributes'],'include':_0x4d64f3['include']?_[_0x2600('0x1a')](_0x4d64f3[_0x2600('0x1b')],function(_0x546553){return{'model':db[_0x546553['model']],'as':_0x546553['as'],'attributes':_0x546553['attributes']};}):[]};}):[]};}):[]:[]})[_0x2600('0xd')](function(_0x4cf888){logger[_0x2600('0xe')]('ShowMailQueue',_0x16b0fe);logger[_0x2600('0x1f')](_0x2600('0x1d'),_0x16b0fe,JSON[_0x2600('0x10')](_0x4cf888));_0x3b9e4a(_0x4cf888);})[_0x2600('0x20')](function(_0x59e9a2){logger[_0x2600('0x11')]('ShowMailQueue',_0x59e9a2[_0x2600('0x12')],_0x16b0fe);_0x3d2bf8(_0x1f545d[_0x2600('0x11')](0x1f4,_0x59e9a2[_0x2600('0x12')]));});});}; \ No newline at end of file +var _0x6cc0=['stringify','error','code','message','catch','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue','ShowMailQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x432c04,_0x54943c){var _0x1f74e4=function(_0x1c2739){while(--_0x1c2739){_0x432c04['push'](_0x432c04['shift']());}};_0x1f74e4(++_0x54943c);}(_0x6cc0,0x1d5));var _0x06cc=function(_0x314d82,_0x52f61c){_0x314d82=_0x314d82-0x0;var _0x2f01bc=_0x6cc0[_0x314d82];return _0x2f01bc;};'use strict';var _=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var moment=require(_0x06cc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06cc('0x3'));var fs=require('fs');var Redis=require(_0x06cc('0x4'));var db=require(_0x06cc('0x5'))['db'];var utils=require(_0x06cc('0x6'));var logger=require('../../config/logger')(_0x06cc('0x7'));var config=require(_0x06cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06cc('0x9')][_0x06cc('0xa')]({'port':0x232a});config[_0x06cc('0xb')]=_[_0x06cc('0xc')](config['redis'],{'host':_0x06cc('0xd'),'port':0x18eb});var socket=require(_0x06cc('0xe'))(new Redis(config[_0x06cc('0xb')]));require(_0x06cc('0xf'))[_0x06cc('0x10')](socket);function respondWithRpcPromise(_0xcdeba8,_0x2a3a7c,_0x752e4f){return new BPromise(function(_0x5c18f7,_0x3a8741){return client[_0x06cc('0x11')](_0xcdeba8,_0x752e4f)[_0x06cc('0x12')](function(_0x57a206){logger[_0x06cc('0x13')](_0x06cc('0x14'),_0x2a3a7c,_0x06cc('0x15'));logger[_0x06cc('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2a3a7c,_0x06cc('0x15'),JSON[_0x06cc('0x17')](_0x57a206));if(_0x57a206[_0x06cc('0x18')]){if(_0x57a206[_0x06cc('0x18')][_0x06cc('0x19')]===0x1f4){logger[_0x06cc('0x18')](_0x06cc('0x14'),_0x2a3a7c,_0x57a206[_0x06cc('0x18')][_0x06cc('0x1a')]);return _0x3a8741(_0x57a206['error'][_0x06cc('0x1a')]);}logger[_0x06cc('0x18')](_0x06cc('0x14'),_0x2a3a7c,_0x57a206['error'][_0x06cc('0x1a')]);return _0x5c18f7(_0x57a206[_0x06cc('0x18')][_0x06cc('0x1a')]);}else{logger[_0x06cc('0x13')](_0x06cc('0x14'),_0x2a3a7c,_0x06cc('0x15'));_0x5c18f7(_0x57a206['result'][_0x06cc('0x1a')]);}})[_0x06cc('0x1b')](function(_0x366d37){logger['error'](_0x06cc('0x14'),_0x2a3a7c,_0x366d37);_0x3a8741(_0x366d37);});});}exports['GetMailQueue']=function(_0x93d7ae){var _0x1b1be2=this;return new Promise(function(_0x3602c5,_0x8e3e3d){return db[_0x06cc('0x1c')][_0x06cc('0x1d')]({'raw':_0x93d7ae['options']?_0x93d7ae[_0x06cc('0x1e')][_0x06cc('0x1f')]===undefined?!![]:![]:!![],'where':_0x93d7ae['options']?_0x93d7ae[_0x06cc('0x1e')][_0x06cc('0x20')]||null:null,'attributes':_0x93d7ae[_0x06cc('0x1e')]?_0x93d7ae[_0x06cc('0x1e')][_0x06cc('0x21')]||null:null,'limit':_0x93d7ae[_0x06cc('0x1e')]?_0x93d7ae['options'][_0x06cc('0x22')]||null:null,'include':_0x93d7ae['options']?_0x93d7ae[_0x06cc('0x1e')]['include']?_[_0x06cc('0x23')](_0x93d7ae['options'][_0x06cc('0x24')],function(_0x4123ef){return{'model':db[_0x4123ef[_0x06cc('0x25')]],'as':_0x4123ef['as'],'attributes':_0x4123ef[_0x06cc('0x21')],'include':_0x4123ef[_0x06cc('0x24')]?_[_0x06cc('0x23')](_0x4123ef[_0x06cc('0x24')],function(_0x5862f7){return{'model':db[_0x5862f7[_0x06cc('0x25')]],'as':_0x5862f7['as'],'attributes':_0x5862f7[_0x06cc('0x21')],'include':_0x5862f7['include']?_[_0x06cc('0x23')](_0x5862f7[_0x06cc('0x24')],function(_0x24366f){return{'model':db[_0x24366f['model']],'as':_0x24366f['as'],'attributes':_0x24366f[_0x06cc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x06cc('0x12')](function(_0x4dad2f){logger[_0x06cc('0x13')](_0x06cc('0x26'),_0x93d7ae);logger[_0x06cc('0x16')]('GetMailQueue',_0x93d7ae,JSON[_0x06cc('0x17')](_0x4dad2f));_0x3602c5(_0x4dad2f);})[_0x06cc('0x1b')](function(_0x16ea38){logger[_0x06cc('0x18')](_0x06cc('0x26'),_0x16ea38['message'],_0x93d7ae);_0x8e3e3d(_0x1b1be2[_0x06cc('0x18')](0x1f4,_0x16ea38[_0x06cc('0x1a')]));});});};exports[_0x06cc('0x27')]=function(_0x17092a){var _0x2f4318=this;return new Promise(function(_0x14b35f,_0x1cbbdf){return db[_0x06cc('0x1c')][_0x06cc('0x28')]({'raw':_0x17092a[_0x06cc('0x1e')]?_0x17092a[_0x06cc('0x1e')][_0x06cc('0x1f')]===undefined?!![]:![]:!![],'where':_0x17092a[_0x06cc('0x1e')]?_0x17092a['options']['where']||null:null,'attributes':_0x17092a[_0x06cc('0x1e')]?_0x17092a[_0x06cc('0x1e')][_0x06cc('0x21')]||null:null,'include':_0x17092a['options']?_0x17092a['options']['include']?_[_0x06cc('0x23')](_0x17092a[_0x06cc('0x1e')][_0x06cc('0x24')],function(_0x407021){return{'model':db[_0x407021['model']],'as':_0x407021['as'],'attributes':_0x407021[_0x06cc('0x21')],'include':_0x407021[_0x06cc('0x24')]?_[_0x06cc('0x23')](_0x407021[_0x06cc('0x24')],function(_0x55e7c8){return{'model':db[_0x55e7c8['model']],'as':_0x55e7c8['as'],'attributes':_0x55e7c8['attributes'],'include':_0x55e7c8[_0x06cc('0x24')]?_[_0x06cc('0x23')](_0x55e7c8['include'],function(_0x1ca6a2){return{'model':db[_0x1ca6a2[_0x06cc('0x25')]],'as':_0x1ca6a2['as'],'attributes':_0x1ca6a2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x404bc2){logger[_0x06cc('0x13')](_0x06cc('0x27'),_0x17092a);logger[_0x06cc('0x16')]('ShowMailQueue',_0x17092a,JSON[_0x06cc('0x17')](_0x404bc2));_0x14b35f(_0x404bc2);})[_0x06cc('0x1b')](function(_0x4a5335){logger[_0x06cc('0x18')](_0x06cc('0x27'),_0x4a5335[_0x06cc('0x1a')],_0x17092a);_0x1cbbdf(_0x2f4318[_0x06cc('0x18')](0x1f4,_0x4a5335[_0x06cc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index a740258..0f2dd0f 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 _0x5862=['update','emit','register','length','mailQueue:','./mailQueue.events'];(function(_0x12b667,_0x1686d2){var _0x52e605=function(_0x493f65){while(--_0x493f65){_0x12b667['push'](_0x12b667['shift']());}};_0x52e605(++_0x1686d2);}(_0x5862,0x137));var _0x2586=function(_0x2c781a,_0x58476e){_0x2c781a=_0x2c781a-0x0;var _0xb0e167=_0x5862[_0x2c781a];return _0xb0e167;};'use strict';var MailQueueEvents=require(_0x2586('0x0'));var events=['save','remove',_0x2586('0x1')];function createListener(_0x43e869,_0x488914){return function(_0x47ad9b){_0x488914[_0x2586('0x2')](_0x43e869,_0x47ad9b);};}function removeListener(_0x645fb4,_0x198c27){return function(){MailQueueEvents['removeListener'](_0x645fb4,_0x198c27);};}exports[_0x2586('0x3')]=function(_0x4ed0ec){for(var _0x10e111=0x0,_0x4fba35=events[_0x2586('0x4')];_0x10e111<_0x4fba35;_0x10e111++){var _0x546b7d=events[_0x10e111];var _0x3ca5b7=createListener(_0x2586('0x5')+_0x546b7d,_0x4ed0ec);MailQueueEvents['on'](_0x546b7d,_0x3ca5b7);}}; \ No newline at end of file +var _0x57df=['length','mailQueue:','./mailQueue.events','remove','emit','removeListener','register'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x57df,0xd4));var _0xf57d=function(_0x57299a,_0x2f055e){_0x57299a=_0x57299a-0x0;var _0x339370=_0x57df[_0x57299a];return _0x339370;};'use strict';var MailQueueEvents=require(_0xf57d('0x0'));var events=['save',_0xf57d('0x1'),'update'];function createListener(_0x96e416,_0x2b12f3){return function(_0x4171d4){_0x2b12f3[_0xf57d('0x2')](_0x96e416,_0x4171d4);};}function removeListener(_0x5f0b71,_0x5161a0){return function(){MailQueueEvents[_0xf57d('0x3')](_0x5f0b71,_0x5161a0);};}exports[_0xf57d('0x4')]=function(_0x42eaa2){for(var _0xeef9f1=0x0,_0x2c5f7b=events[_0xf57d('0x5')];_0xeef9f1<_0x2c5f7b;_0xeef9f1++){var _0x12cf71=events[_0xeef9f1];var _0x59979e=createListener(_0xf57d('0x6')+_0x12cf71,_0x42eaa2);MailQueueEvents['on'](_0x12cf71,_0x59979e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 5f1d04d..c1759a0 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 _0x6b1e=['/:id','isAuthenticated','show','put','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','/describe','describe'];(function(_0x23a4bc,_0x37a04b){var _0x6047a9=function(_0x52f82c){while(--_0x52f82c){_0x23a4bc['push'](_0x23a4bc['shift']());}};_0x6047a9(++_0x37a04b);}(_0x6b1e,0x128));var _0xe6b1=function(_0x5032b6,_0x48ad96){_0x5032b6=_0x5032b6-0x0;var _0x25dcba=_0x6b1e[_0x5032b6];return _0x25dcba;};'use strict';var multer=require('multer');var util=require(_0xe6b1('0x0'));var path=require(_0xe6b1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe6b1('0x2')]();var fs_extra=require(_0xe6b1('0x3'));var auth=require(_0xe6b1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe6b1('0x5'));var controller=require(_0xe6b1('0x6'));router[_0xe6b1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe6b1('0x7')](_0xe6b1('0x8'),auth['isAuthenticated'](),controller[_0xe6b1('0x9')]);router[_0xe6b1('0x7')](_0xe6b1('0xa'),auth[_0xe6b1('0xb')](),controller[_0xe6b1('0xc')]);router['post']('/',auth[_0xe6b1('0xb')](),controller['create']);router[_0xe6b1('0xd')]('/:id',auth[_0xe6b1('0xb')](),controller[_0xe6b1('0xe')]);router[_0xe6b1('0xf')]('/:id',auth[_0xe6b1('0xb')](),controller[_0xe6b1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8a66=['show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1e1f34,_0x13f9ba){var _0x36a3f4=function(_0x4aa134){while(--_0x4aa134){_0x1e1f34['push'](_0x1e1f34['shift']());}};_0x36a3f4(++_0x13f9ba);}(_0x8a66,0x1d5));var _0x68a6=function(_0xf852,_0x4ddd76){_0xf852=_0xf852-0x0;var _0x5b2550=_0x8a66[_0xf852];return _0x5b2550;};'use strict';var multer=require(_0x68a6('0x0'));var util=require(_0x68a6('0x1'));var path=require(_0x68a6('0x2'));var timeout=require(_0x68a6('0x3'));var express=require('express');var router=express[_0x68a6('0x4')]();var fs_extra=require(_0x68a6('0x5'));var auth=require(_0x68a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68a6('0x7'));var controller=require(_0x68a6('0x8'));router[_0x68a6('0x9')]('/',auth[_0x68a6('0xa')](),controller[_0x68a6('0xb')]);router[_0x68a6('0x9')](_0x68a6('0xc'),auth['isAuthenticated'](),controller[_0x68a6('0xd')]);router[_0x68a6('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x68a6('0xe')]);router[_0x68a6('0xf')]('/',auth[_0x68a6('0xa')](),controller[_0x68a6('0x10')]);router['put'](_0x68a6('0x11'),auth[_0x68a6('0xa')](),controller[_0x68a6('0x12')]);router[_0x68a6('0x13')](_0x68a6('0x11'),auth[_0x68a6('0xa')](),controller[_0x68a6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a25be6d..9598f5b 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 _0xf1bc=['exports','STRING','DATE','sequelize'];(function(_0x3dc14a,_0x4dabd6){var _0x3959fb=function(_0x2a9ce7){while(--_0x2a9ce7){_0x3dc14a['push'](_0x3dc14a['shift']());}};_0x3959fb(++_0x4dabd6);}(_0xf1bc,0x117));var _0xcf1b=function(_0x688f5a,_0x150ef3){_0x688f5a=_0x688f5a-0x0;var _0x8d8b3f=_0xf1bc[_0x688f5a];return _0x8d8b3f;};'use strict';var moment=require('moment');var Sequelize=require(_0xcf1b('0x0'));module[_0xcf1b('0x1')]={'uniqueid':{'type':Sequelize[_0xcf1b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcf1b('0x2')]},'joinAt':{'type':Sequelize[_0xcf1b('0x3')]},'leaveAt':{'type':Sequelize[_0xcf1b('0x3')]},'acceptAt':{'type':Sequelize[_0xcf1b('0x3')]},'exitAt':{'type':Sequelize[_0xcf1b('0x3')]},'reason':{'type':Sequelize[_0xcf1b('0x2')]}}; \ No newline at end of file +var _0xdb72=['STRING','DATE','moment','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb72,0x14c));var _0x2db7=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xdb72[_0x496333];return _0x44256e;};'use strict';var moment=require(_0x2db7('0x0'));var Sequelize=require(_0x2db7('0x1'));module[_0x2db7('0x2')]={'uniqueid':{'type':Sequelize[_0x2db7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2db7('0x3')]},'joinAt':{'type':Sequelize[_0x2db7('0x4')]},'leaveAt':{'type':Sequelize[_0x2db7('0x4')]},'acceptAt':{'type':Sequelize[_0x2db7('0x4')]},'exitAt':{'type':Sequelize[_0x2db7('0x4')]},'reason':{'type':Sequelize[_0x2db7('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5662cc3..05eaa5c 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 _0xaebd=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','MailQueueReport','options','create','body','find','describe','eml-format'];(function(_0x8b40fc,_0x13a66e){var _0x5a2b2b=function(_0x3c8509){while(--_0x3c8509){_0x8b40fc['push'](_0x8b40fc['shift']());}};_0x5a2b2b(++_0x13a66e);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3a9cfa,_0x59a479){_0x3a9cfa=_0x3a9cfa-0x0;var _0x8c1be=_0xaebd[_0x3a9cfa];return _0x8c1be;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){_0x39dfae[_0xdaeb('0x16')](0xcc)[_0xdaeb('0x17')]();});}};}function handleEntityNotFound(_0x3b0770,_0x32c2c1){return function(_0x4fc3e2){if(!_0x4fc3e2){_0x3b0770[_0xdaeb('0x15')](0x194);}return _0x4fc3e2;};}function handleError(_0x34fa21,_0x338687){_0x338687=_0x338687||0x1f4;return function(_0x4eb719){logger['error'](_0x4eb719[_0xdaeb('0x24')]);if(_0x4eb719['name']){delete _0x4eb719['name'];}_0x34fa21[_0xdaeb('0x16')](_0x338687)[_0xdaeb('0x25')](_0x4eb719);};}exports[_0xdaeb('0x26')]=function(_0x5eb7b5,_0x5e6f97){var _0x32966f={},_0x440022={},_0x37f468={'count':0x0,'rows':[]};var _0x596c19=_[_0xdaeb('0x27')](db['MailQueueReport']['rawAttributes'],function(_0x28812c){return{'name':_0x28812c[_0xdaeb('0x28')],'type':_0x28812c[_0xdaeb('0x29')][_0xdaeb('0x2a')]};});_0x440022[_0xdaeb('0x2b')]=_[_0xdaeb('0x27')](_0x596c19,_0xdaeb('0x2c'));_0x440022['query']=_[_0xdaeb('0x2d')](_0x5eb7b5[_0xdaeb('0x2e')]);_0x440022[_0xdaeb('0x2f')]=_[_0xdaeb('0x30')](_0x440022[_0xdaeb('0x2b')],_0x440022['query']);_0x32966f[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x440022['model'],qs[_0xdaeb('0x32')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x32966f[_0xdaeb('0x31')]=_0x32966f[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x32966f[_0xdaeb('0x31')]:_0x440022[_0xdaeb('0x2b')];if(!_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x34')]('nolimit')){_0x32966f['limit']=qs[_0xdaeb('0x1c')](_0x5eb7b5['query'][_0xdaeb('0x1c')]);_0x32966f[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x1b')]);}_0x32966f[_0xdaeb('0x35')]=qs['sort'](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x36')]);_0x32966f[_0xdaeb('0x37')]=qs['filters'](_[_0xdaeb('0x38')](_0x5eb7b5[_0xdaeb('0x2e')],_0x440022[_0xdaeb('0x2f')]),_0x596c19);if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x39')]){_0x32966f[_0xdaeb('0x37')]=_[_0xdaeb('0x3a')](_0x32966f['where'],{'$or':_[_0xdaeb('0x27')](_0x596c19,function(_0x170009){if(_0x170009['type']!=='VIRTUAL'){var _0x2ef310={};_0x2ef310[_0x170009[_0xdaeb('0x2c')]]={'$like':'%'+_0x5eb7b5['query'][_0xdaeb('0x39')]+'%'};return _0x2ef310;}})});}_0x32966f=_[_0xdaeb('0x3a')]({},_0x32966f,_0x5eb7b5['options']);var _0x151cc4={'where':_0x32966f[_0xdaeb('0x37')]};return db['MailQueueReport']['count'](_0x151cc4)[_0xdaeb('0x23')](function(_0x11dce7){_0x37f468[_0xdaeb('0x1a')]=_0x11dce7;if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x3b')]){_0x32966f[_0xdaeb('0x3c')]=[{'all':!![]}];}return db['MailQueueReport'][_0xdaeb('0x3d')](_0x32966f);})['then'](function(_0x46aa44){_0x37f468['rows']=_0x46aa44;return _0x37f468;})['then'](respondWithFilteredResult(_0x5e6f97,_0x32966f))[_0xdaeb('0x3e')](handleError(_0x5e6f97,null));};exports['show']=function(_0x5a42a6,_0x4efd96){var _0x45c3fc={'raw':!![],'where':{'id':_0x5a42a6[_0xdaeb('0x3f')]['id']}},_0x244369={};_0x244369[_0xdaeb('0x2b')]=_['keys'](db[_0xdaeb('0x40')]['rawAttributes']);_0x244369[_0xdaeb('0x2e')]=_[_0xdaeb('0x2d')](_0x5a42a6[_0xdaeb('0x2e')]);_0x244369['filters']=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],_0x244369[_0xdaeb('0x2e')]);_0x45c3fc[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],qs[_0xdaeb('0x32')](_0x5a42a6[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x45c3fc[_0xdaeb('0x31')]=_0x45c3fc[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x45c3fc['attributes']:_0x244369[_0xdaeb('0x2b')];if(_0x5a42a6[_0xdaeb('0x2e')]['includeAll']){_0x45c3fc['include']=[{'all':!![]}];}_0x45c3fc=_[_0xdaeb('0x3a')]({},_0x45c3fc,_0x5a42a6[_0xdaeb('0x41')]);return db[_0xdaeb('0x40')]['find'](_0x45c3fc)[_0xdaeb('0x23')](handleEntityNotFound(_0x4efd96,null))[_0xdaeb('0x23')](respondWithResult(_0x4efd96,null))[_0xdaeb('0x3e')](handleError(_0x4efd96,null));};exports[_0xdaeb('0x42')]=function(_0x266d6b,_0x45344b){return db[_0xdaeb('0x40')][_0xdaeb('0x42')](_0x266d6b['body'],{})[_0xdaeb('0x23')](respondWithResult(_0x45344b,0xc9))[_0xdaeb('0x3e')](handleError(_0x45344b,null));};exports['update']=function(_0x38d2ee,_0x4dd70c){if(_0x38d2ee[_0xdaeb('0x43')]['id']){delete _0x38d2ee[_0xdaeb('0x43')]['id'];}return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x38d2ee[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x4dd70c,null))[_0xdaeb('0x23')](saveUpdates(_0x38d2ee[_0xdaeb('0x43')],null))[_0xdaeb('0x23')](respondWithResult(_0x4dd70c,null))['catch'](handleError(_0x4dd70c,null));};exports['destroy']=function(_0x1403c8,_0x3112d2){return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x1403c8[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x3112d2,null))['then'](removeEntity(_0x3112d2,null))[_0xdaeb('0x3e')](handleError(_0x3112d2,null));};exports[_0xdaeb('0x45')]=function(_0x3f6a88,_0x589442){return db[_0xdaeb('0x40')]['describe']()[_0xdaeb('0x23')](respondWithResult(_0x589442,null))[_0xdaeb('0x3e')](handleError(_0x589442,null));}; \ No newline at end of file +var _0x9536=['rawAttributes','intersection','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','MailQueueReport','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9536,0x179));var _0x6953=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0x9536[_0x2c69a1];return _0x24bb91;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));};exports[_0x6953('0x49')]=function(_0x50b962,_0x5f15b0){return db['MailQueueReport']['describe']()[_0x6953('0x3c')](respondWithResult(_0x5f15b0,null))[_0x6953('0x41')](handleError(_0x5f15b0,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1fb1fc2..0d4848d 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 _0x4f61=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x26508c,_0x322993){var _0x116195=function(_0x4c37de){while(--_0x4c37de){_0x26508c['push'](_0x26508c['shift']());}};_0x116195(++_0x322993);}(_0x4f61,0x149));var _0x14f6=function(_0x388e51,_0x5e4a4d){_0x388e51=_0x388e51-0x0;var _0x5b6137=_0x4f61[_0x388e51];return _0x5b6137;};'use strict';var _=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var logger=require(_0x14f6('0x2'))('api');var moment=require(_0x14f6('0x3'));var BPromise=require(_0x14f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x14f6('0x5'));var rimraf=require(_0x14f6('0x6'));var config=require(_0x14f6('0x7'));var attributes=require(_0x14f6('0x8'));module[_0x14f6('0x9')]=function(_0x1fbf17,_0x4f4291){return _0x1fbf17[_0x14f6('0xa')](_0x14f6('0xb'),attributes,{'tableName':_0x14f6('0xc'),'paranoid':![],'indexes':[{'name':_0x14f6('0xd'),'fields':[_0x14f6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a62=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x5f5bab,_0x4ded32){var _0x48d842=function(_0xf83a6e){while(--_0xf83a6e){_0x5f5bab['push'](_0x5f5bab['shift']());}};_0x48d842(++_0x4ded32);}(_0x0a62,0xa4));var _0x20a6=function(_0x9fc5a2,_0x46c38f){_0x9fc5a2=_0x9fc5a2-0x0;var _0x10a4a8=_0x0a62[_0x9fc5a2];return _0x10a4a8;};'use strict';var _=require(_0x20a6('0x0'));var util=require('util');var logger=require(_0x20a6('0x1'))(_0x20a6('0x2'));var moment=require(_0x20a6('0x3'));var BPromise=require(_0x20a6('0x4'));var rp=require(_0x20a6('0x5'));var fs=require('fs');var path=require(_0x20a6('0x6'));var rimraf=require(_0x20a6('0x7'));var config=require(_0x20a6('0x8'));var attributes=require(_0x20a6('0x9'));module[_0x20a6('0xa')]=function(_0x2b354d,_0x43d0af){return _0x2b354d['define'](_0x20a6('0xb'),attributes,{'tableName':_0x20a6('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x20a6('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 b166935..13d49ef 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1bd662,_0x6f3911){var _0x2c1bb6=function(_0x24663f){while(--_0x24663f){_0x1bd662['push'](_0x1bd662['shift']());}};_0x2c1bb6(++_0x6f3911);}(_0xadb5,0xad));var _0x5adb=function(_0xef7fe4,_0x521aaa){_0xef7fe4=_0xef7fe4-0x0;var _0x3e1c2f=_0xadb5[_0xef7fe4];return _0x3e1c2f;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x52ce8e,_0x4dacf5){var _0x489cf9=function(_0x374ab2){while(--_0x374ab2){_0x52ce8e['push'](_0x52ce8e['shift']());}};_0x489cf9(++_0x4dacf5);}(_0xdb28,0x106));var _0x8db2=function(_0x194edb,_0x5025d9){_0x194edb=_0x194edb-0x0;var _0x1b2973=_0xdb28[_0x194edb];return _0x1b2973;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c12ca5e..1c46d71 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(_0x59bd35,_0x586897){var _0x203e8a=function(_0x2aecf6){while(--_0x2aecf6){_0x59bd35['push'](_0x59bd35['shift']());}};_0x203e8a(++_0x586897);}(_0xe706,0xa3));var _0x6e70=function(_0x400f2a,_0x52a559){_0x400f2a=_0x400f2a-0x0;var _0x3dd8d1=_0xe706[_0x400f2a];return _0x3dd8d1;};'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(_0x3a11a2,_0x567c5d){var _0x2173c3=function(_0x37df4d){while(--_0x37df4d){_0x3a11a2['push'](_0x3a11a2['shift']());}};_0x2173c3(++_0x567c5d);}(_0x70e0,0x17b));var _0x070e=function(_0x9a5c4d,_0x57bbf2){_0x9a5c4d=_0x9a5c4d-0x0;var _0x123f7c=_0x70e0[_0x9a5c4d];return _0x123f7c;};'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 1e3f1f9..d7a0d0d 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 _0x00f7=['INTEGER','INBOX','BOOLEAN','exports','STRING'];(function(_0x1a0b6d,_0x2fc879){var _0x3236c2=function(_0x35275a){while(--_0x35275a){_0x1a0b6d['push'](_0x1a0b6d['shift']());}};_0x3236c2(++_0x2fc879);}(_0x00f7,0x12a));var _0x700f=function(_0xf78c27,_0x55e306){_0xf78c27=_0xf78c27-0x0;var _0x1c7570=_0x00f7[_0xf78c27];return _0x1c7570;};'use strict';var Sequelize=require('sequelize');module[_0x700f('0x0')]={'description':{'type':Sequelize[_0x700f('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x700f('0x1')]},'port':{'type':Sequelize[_0x700f('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x700f('0x1')],'defaultValue':_0x700f('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x700f('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x700f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xaf52=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x568fd6,_0x266183){var _0x3e871c=function(_0x5878d1){while(--_0x5878d1){_0x568fd6['push'](_0x568fd6['shift']());}};_0x3e871c(++_0x266183);}(_0xaf52,0x88));var _0x2af5=function(_0x4093cd,_0x253b9c){_0x4093cd=_0x4093cd-0x0;var _0x2aa9af=_0xaf52[_0x4093cd];return _0x2aa9af;};'use strict';var Sequelize=require(_0x2af5('0x0'));module['exports']={'description':{'type':Sequelize[_0x2af5('0x1')]},'host':{'type':Sequelize[_0x2af5('0x1')]},'authentication':{'type':Sequelize[_0x2af5('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2af5('0x1')]},'port':{'type':Sequelize[_0x2af5('0x3')]},'tls':{'type':Sequelize[_0x2af5('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x2af5('0x4')},'connTimeout':{'type':Sequelize[_0x2af5('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x2af5('0x1')]},'modernAuthentication':{'type':Sequelize[_0x2af5('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 b2b8593..1cc3dff 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 _0x40d5=['rimraf','../../config/environment','exports','define','mail_servers_in','lodash','../../config/logger','moment','request-promise','path'];(function(_0x458779,_0x2526ba){var _0x570faa=function(_0x4555e8){while(--_0x4555e8){_0x458779['push'](_0x458779['shift']());}};_0x570faa(++_0x2526ba);}(_0x40d5,0x73));var _0x540d=function(_0x383875,_0x45b02b){_0x383875=_0x383875-0x0;var _0x128fc2=_0x40d5[_0x383875];return _0x128fc2;};'use strict';var _=require(_0x540d('0x0'));var util=require('util');var logger=require(_0x540d('0x1'))('api');var moment=require(_0x540d('0x2'));var BPromise=require('bluebird');var rp=require(_0x540d('0x3'));var fs=require('fs');var path=require(_0x540d('0x4'));var rimraf=require(_0x540d('0x5'));var config=require(_0x540d('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x540d('0x7')]=function(_0x47905a,_0x102d79){return _0x47905a[_0x540d('0x8')]('MailServerIn',attributes,{'tableName':_0x540d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a96=['mail_servers_in','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x8a96,0x9b));var _0x68a9=function(_0xe7c3f1,_0x12326f){_0xe7c3f1=_0xe7c3f1-0x0;var _0x1a0934=_0x8a96[_0xe7c3f1];return _0x1a0934;};'use strict';var _=require(_0x68a9('0x0'));var util=require('util');var logger=require(_0x68a9('0x1'))('api');var moment=require(_0x68a9('0x2'));var BPromise=require(_0x68a9('0x3'));var rp=require(_0x68a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68a9('0x5'));var config=require('../../config/environment');var attributes=require(_0x68a9('0x6'));module[_0x68a9('0x7')]=function(_0x27c86d,_0x150957){return _0x27c86d[_0x68a9('0x8')](_0x68a9('0x9'),attributes,{'tableName':_0x68a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index b9f9556..7becf19 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 _0xd810=['findAll','options','raw','where','include','map','model','attributes','then','debug','stringify','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','info','result','GetMailServerIn','MailServerIn'];(function(_0x5e42fb,_0x4a808a){var _0x3a54f5=function(_0x1201b8){while(--_0x1201b8){_0x5e42fb['push'](_0x5e42fb['shift']());}};_0x3a54f5(++_0x4a808a);}(_0xd810,0x1dd));var _0x0d81=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xd810[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x0d81('0x0'));var util=require(_0x0d81('0x1'));var moment=require('moment');var BPromise=require(_0x0d81('0x2'));var rs=require(_0x0d81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d81('0x4'));var logger=require('../../config/logger')(_0x0d81('0x5'));var config=require('../../config/environment');var jayson=require(_0x0d81('0x6'));var client=jayson[_0x0d81('0x7')][_0x0d81('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53697e,_0x2a9f6a,_0x11fd91){return new BPromise(function(_0x1a5356,_0x43aee0){return client[_0x0d81('0x9')](_0x53697e,_0x11fd91)['then'](function(_0x2417a5){logger['info'](_0x0d81('0xa'),_0x2a9f6a,_0x0d81('0xb'));logger['debug'](_0x0d81('0xc'),_0x2a9f6a,_0x0d81('0xb'),JSON['stringify'](_0x2417a5));if(_0x2417a5['error']){if(_0x2417a5[_0x0d81('0xd')]['code']===0x1f4){logger['error'](_0x0d81('0xa'),_0x2a9f6a,_0x2417a5['error'][_0x0d81('0xe')]);return _0x43aee0(_0x2417a5[_0x0d81('0xd')][_0x0d81('0xe')]);}logger['error'](_0x0d81('0xa'),_0x2a9f6a,_0x2417a5[_0x0d81('0xd')][_0x0d81('0xe')]);return _0x1a5356(_0x2417a5['error'][_0x0d81('0xe')]);}else{logger[_0x0d81('0xf')](_0x0d81('0xa'),_0x2a9f6a,_0x0d81('0xb'));_0x1a5356(_0x2417a5[_0x0d81('0x10')][_0x0d81('0xe')]);}})['catch'](function(_0x3a550a){logger[_0x0d81('0xd')](_0x0d81('0xa'),_0x2a9f6a,_0x3a550a);_0x43aee0(_0x3a550a);});});}exports[_0x0d81('0x11')]=function(_0x58d9c7){var _0x1b095d=this;return new Promise(function(_0x4ae939,_0x37d06b){return db[_0x0d81('0x12')][_0x0d81('0x13')]({'raw':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x15')]===undefined?!![]:![]:!![],'where':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x16')]||null:null,'attributes':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')]['attributes']||null:null,'limit':_0x58d9c7[_0x0d81('0x14')]?_0x58d9c7[_0x0d81('0x14')]['limit']||null:null,'include':_0x58d9c7['options']?_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x17')]?_[_0x0d81('0x18')](_0x58d9c7[_0x0d81('0x14')][_0x0d81('0x17')],function(_0x204e81){return{'model':db[_0x204e81[_0x0d81('0x19')]],'as':_0x204e81['as'],'attributes':_0x204e81[_0x0d81('0x1a')],'include':_0x204e81['include']?_['map'](_0x204e81[_0x0d81('0x17')],function(_0x235353){return{'model':db[_0x235353['model']],'as':_0x235353['as'],'attributes':_0x235353[_0x0d81('0x1a')],'include':_0x235353[_0x0d81('0x17')]?_['map'](_0x235353[_0x0d81('0x17')],function(_0x20bbeb){return{'model':db[_0x20bbeb['model']],'as':_0x20bbeb['as'],'attributes':_0x20bbeb[_0x0d81('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0d81('0x1b')](function(_0x32a77c){logger[_0x0d81('0xf')](_0x0d81('0x11'),_0x58d9c7);logger[_0x0d81('0x1c')](_0x0d81('0x11'),_0x58d9c7,JSON[_0x0d81('0x1d')](_0x32a77c));_0x4ae939(_0x32a77c);})[_0x0d81('0x1e')](function(_0x238da2){logger['error'](_0x0d81('0x11'),_0x238da2['message'],_0x58d9c7);_0x37d06b(_0x1b095d[_0x0d81('0xd')](0x1f4,_0x238da2['message']));});});}; \ No newline at end of file +var _0xe1a8=['where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','raw','options'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xe1a8,0x6f));var _0x8e1a=function(_0x1f15d4,_0x547ee1){_0x1f15d4=_0x1f15d4-0x0;var _0x407670=_0xe1a8[_0x1f15d4];return _0x407670;};'use strict';var _=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var moment=require(_0x8e1a('0x2'));var BPromise=require(_0x8e1a('0x3'));var rs=require(_0x8e1a('0x4'));var fs=require('fs');var Redis=require(_0x8e1a('0x5'));var db=require(_0x8e1a('0x6'))['db'];var utils=require(_0x8e1a('0x7'));var logger=require('../../config/logger')(_0x8e1a('0x8'));var config=require('../../config/environment');var jayson=require(_0x8e1a('0x9'));var client=jayson['client'][_0x8e1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad0b6,_0x28dc98,_0x1848ce){return new BPromise(function(_0x2c83ed,_0x264bfb){return client[_0x8e1a('0xb')](_0x5ad0b6,_0x1848ce)[_0x8e1a('0xc')](function(_0x484f24){logger[_0x8e1a('0xd')](_0x8e1a('0xe'),_0x28dc98,_0x8e1a('0xf'));logger[_0x8e1a('0x10')](_0x8e1a('0x11'),_0x28dc98,'request\x20sent',JSON[_0x8e1a('0x12')](_0x484f24));if(_0x484f24[_0x8e1a('0x13')]){if(_0x484f24[_0x8e1a('0x13')][_0x8e1a('0x14')]===0x1f4){logger['error'](_0x8e1a('0xe'),_0x28dc98,_0x484f24[_0x8e1a('0x13')]['message']);return _0x264bfb(_0x484f24['error'][_0x8e1a('0x15')]);}logger[_0x8e1a('0x13')](_0x8e1a('0xe'),_0x28dc98,_0x484f24[_0x8e1a('0x13')][_0x8e1a('0x15')]);return _0x2c83ed(_0x484f24[_0x8e1a('0x13')][_0x8e1a('0x15')]);}else{logger[_0x8e1a('0xd')](_0x8e1a('0xe'),_0x28dc98,'request\x20sent');_0x2c83ed(_0x484f24[_0x8e1a('0x16')][_0x8e1a('0x15')]);}})[_0x8e1a('0x17')](function(_0x34c777){logger[_0x8e1a('0x13')]('MailServerIn,\x20%s,\x20%s',_0x28dc98,_0x34c777);_0x264bfb(_0x34c777);});});}exports[_0x8e1a('0x18')]=function(_0x2147b6){var _0x52e183=this;return new Promise(function(_0x2a5eb9,_0x1f9a5b){return db[_0x8e1a('0x19')][_0x8e1a('0x1a')]({'raw':_0x2147b6['options']?_0x2147b6['options'][_0x8e1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x2147b6[_0x8e1a('0x1c')]?_0x2147b6['options'][_0x8e1a('0x1d')]||null:null,'attributes':_0x2147b6[_0x8e1a('0x1c')]?_0x2147b6[_0x8e1a('0x1c')][_0x8e1a('0x1e')]||null:null,'limit':_0x2147b6['options']?_0x2147b6[_0x8e1a('0x1c')][_0x8e1a('0x1f')]||null:null,'include':_0x2147b6[_0x8e1a('0x1c')]?_0x2147b6['options'][_0x8e1a('0x20')]?_[_0x8e1a('0x21')](_0x2147b6[_0x8e1a('0x1c')][_0x8e1a('0x20')],function(_0x4fa301){return{'model':db[_0x4fa301[_0x8e1a('0x22')]],'as':_0x4fa301['as'],'attributes':_0x4fa301[_0x8e1a('0x1e')],'include':_0x4fa301['include']?_['map'](_0x4fa301[_0x8e1a('0x20')],function(_0x3c6fe8){return{'model':db[_0x3c6fe8[_0x8e1a('0x22')]],'as':_0x3c6fe8['as'],'attributes':_0x3c6fe8['attributes'],'include':_0x3c6fe8[_0x8e1a('0x20')]?_[_0x8e1a('0x21')](_0x3c6fe8[_0x8e1a('0x20')],function(_0x1af515){return{'model':db[_0x1af515[_0x8e1a('0x22')]],'as':_0x1af515['as'],'attributes':_0x1af515[_0x8e1a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x301d7d){logger[_0x8e1a('0xd')](_0x8e1a('0x18'),_0x2147b6);logger['debug'](_0x8e1a('0x18'),_0x2147b6,JSON['stringify'](_0x301d7d));_0x2a5eb9(_0x301d7d);})[_0x8e1a('0x17')](function(_0x376641){logger[_0x8e1a('0x13')](_0x8e1a('0x18'),_0x376641[_0x8e1a('0x15')],_0x2147b6);_0x1f9a5b(_0x52e183[_0x8e1a('0x13')](0x1f4,_0x376641[_0x8e1a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index bf61e80..8f43beb 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(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _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(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 11e9882..49ba381 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 _0xa5fa=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x3c6a9b,_0x36818a){var _0x57999e=function(_0x4c6f57){while(--_0x4c6f57){_0x3c6a9b['push'](_0x3c6a9b['shift']());}};_0x57999e(++_0x36818a);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x4c7d23,_0x1eed42){_0x4c7d23=_0x4c7d23-0x0;var _0x4bd04c=_0xa5fa[_0x4c7d23];return _0x4bd04c;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'description':{'type':Sequelize[_0xaa5f('0x1')]},'host':{'type':Sequelize[_0xaa5f('0x1')]},'user':{'type':Sequelize[_0xaa5f('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa5f('0x2')]},'secure':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1339=['BOOLEAN','STRING','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1339,0x1ed));var _0x9133=function(_0x5d2a4e,_0x126a98){_0x5d2a4e=_0x5d2a4e-0x0;var _0x3694c7=_0x1339[_0x5d2a4e];return _0x3694c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x9133('0x0')]},'host':{'type':Sequelize[_0x9133('0x0')]},'user':{'type':Sequelize[_0x9133('0x0')]},'pass':{'type':Sequelize[_0x9133('0x0')]},'port':{'type':Sequelize[_0x9133('0x1')]},'secure':{'type':Sequelize[_0x9133('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x9133('0x0')]},'authentication':{'type':Sequelize[_0x9133('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8754569..a22325a 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 _0x602f=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','rimraf','fast-json-patch','bluebird'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x602f,0x96));var _0xf602=function(_0x14d059,_0x37191c){_0x14d059=_0x14d059-0x0;var _0x53fe88=_0x602f[_0x14d059];return _0x53fe88;};'use strict';var emlformat=require(_0xf602('0x0'));var rimraf=require(_0xf602('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf602('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf602('0x3'));var Mustache=require(_0xf602('0x4'));var util=require(_0xf602('0x5'));var path=require(_0xf602('0x6'));var sox=require(_0xf602('0x7'));var csv=require(_0xf602('0x8'));var ejs=require(_0xf602('0x9'));var fs=require('fs');var fs_extra=require(_0xf602('0xa'));var _=require('lodash');var squel=require(_0xf602('0xb'));var crypto=require(_0xf602('0xc'));var jsforce=require(_0xf602('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf602('0xe'));var authService=require(_0xf602('0xf'));var qs=require(_0xf602('0x10'));var as=require(_0xf602('0x11'));var hardwareService=require(_0xf602('0x12'));var logger=require(_0xf602('0x13'))(_0xf602('0x14'));var utils=require(_0xf602('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf602('0x16'));var db=require(_0xf602('0x17'))['db'];function respondWithStatusCode(_0x4ca917,_0x5839f1){_0x5839f1=_0x5839f1||0xcc;return function(_0x4ee978){if(_0x4ee978){return _0x4ca917[_0xf602('0x18')](_0x5839f1);}return _0x4ca917[_0xf602('0x19')](_0x5839f1)['end']();};}function respondWithResult(_0x597bf4,_0x1fdcb9){_0x1fdcb9=_0x1fdcb9||0xc8;return function(_0x1ca9c4){if(_0x1ca9c4){return _0x597bf4[_0xf602('0x19')](_0x1fdcb9)[_0xf602('0x1a')](_0x1ca9c4);}};}function respondWithFilteredResult(_0x711b08,_0x15244f){return function(_0x12e7f6){if(_0x12e7f6){var _0x39a526=typeof _0x15244f[_0xf602('0x1b')]===_0xf602('0x1c')&&typeof _0x15244f[_0xf602('0x1d')]===_0xf602('0x1c');var _0x8c7ad4=_0x12e7f6[_0xf602('0x1e')];var _0x13542a=_0x39a526?0x0:_0x15244f[_0xf602('0x1b')];var _0x503ba8=_0x39a526?_0x12e7f6[_0xf602('0x1e')]:_0x15244f[_0xf602('0x1b')]+_0x15244f[_0xf602('0x1d')];var _0xc5dfa5;if(_0x503ba8>=_0x8c7ad4){_0x503ba8=_0x8c7ad4;_0xc5dfa5=0xc8;}else{_0xc5dfa5=0xce;}_0x711b08['status'](_0xc5dfa5);return _0x711b08[_0xf602('0x1f')](_0xf602('0x20'),_0x13542a+'-'+_0x503ba8+'/'+_0x8c7ad4)[_0xf602('0x1a')](_0x12e7f6);}return null;};}function patchUpdates(_0x1b4783){return function(_0x5dc204){try{jsonpatch[_0xf602('0x21')](_0x5dc204,_0x1b4783,!![]);}catch(_0x341e6a){return BPromise[_0xf602('0x22')](_0x341e6a);}return _0x5dc204[_0xf602('0x23')]();};}function saveUpdates(_0x5c4b12,_0x16b724){return function(_0x316720){if(_0x316720){return _0x316720['update'](_0x5c4b12)['then'](function(_0x1b546a){return _0x1b546a;});}return null;};}function removeEntity(_0x153fb0,_0x5253cf){return function(_0x35f8a2){if(_0x35f8a2){return _0x35f8a2['destroy']()[_0xf602('0x24')](function(){_0x153fb0[_0xf602('0x19')](0xcc)[_0xf602('0x25')]();});}};}function handleEntityNotFound(_0x475f4b,_0x1641b7){return function(_0x50b836){if(!_0x50b836){_0x475f4b[_0xf602('0x18')](0x194);}return _0x50b836;};}function handleError(_0x15cf7f,_0xc728dc){_0xc728dc=_0xc728dc||0x1f4;return function(_0x25c403){logger[_0xf602('0x26')](_0x25c403['stack']);if(_0x25c403['name']){delete _0x25c403[_0xf602('0x27')];}_0x15cf7f['status'](_0xc728dc)[_0xf602('0x28')](_0x25c403);};}exports[_0xf602('0x29')]=function(_0x5a03d7,_0x1967c2){var _0x5f552f={},_0x161d02={},_0x53f50b={'count':0x0,'rows':[]};var _0x42607d=_[_0xf602('0x2a')](db[_0xf602('0x2b')][_0xf602('0x2c')],function(_0x5046c5){return{'name':_0x5046c5[_0xf602('0x2d')],'type':_0x5046c5['type'][_0xf602('0x2e')]};});_0x161d02['model']=_[_0xf602('0x2a')](_0x42607d,_0xf602('0x27'));_0x161d02[_0xf602('0x2f')]=_[_0xf602('0x30')](_0x5a03d7['query']);_0x161d02['filters']=_[_0xf602('0x31')](_0x161d02[_0xf602('0x32')],_0x161d02[_0xf602('0x2f')]);_0x5f552f['attributes']=_[_0xf602('0x31')](_0x161d02[_0xf602('0x32')],qs[_0xf602('0x33')](_0x5a03d7[_0xf602('0x2f')][_0xf602('0x33')]));_0x5f552f[_0xf602('0x34')]=_0x5f552f[_0xf602('0x34')][_0xf602('0x35')]?_0x5f552f[_0xf602('0x34')]:_0x161d02[_0xf602('0x32')];if(!_0x5a03d7[_0xf602('0x2f')][_0xf602('0x36')](_0xf602('0x37'))){_0x5f552f[_0xf602('0x1d')]=qs['limit'](_0x5a03d7[_0xf602('0x2f')][_0xf602('0x1d')]);_0x5f552f[_0xf602('0x1b')]=qs['offset'](_0x5a03d7[_0xf602('0x2f')][_0xf602('0x1b')]);}_0x5f552f[_0xf602('0x38')]=qs[_0xf602('0x39')](_0x5a03d7[_0xf602('0x2f')]['sort']);_0x5f552f[_0xf602('0x3a')]=qs[_0xf602('0x3b')](_[_0xf602('0x3c')](_0x5a03d7[_0xf602('0x2f')],_0x161d02[_0xf602('0x3b')]),_0x42607d);if(_0x5a03d7[_0xf602('0x2f')]['filter']){_0x5f552f[_0xf602('0x3a')]=_[_0xf602('0x3d')](_0x5f552f[_0xf602('0x3a')],{'$or':_[_0xf602('0x2a')](_0x42607d,function(_0x2492cf){if(_0x2492cf['type']!==_0xf602('0x3e')){var _0xc70ab5={};_0xc70ab5[_0x2492cf[_0xf602('0x27')]]={'$like':'%'+_0x5a03d7[_0xf602('0x2f')][_0xf602('0x3f')]+'%'};return _0xc70ab5;}})});}_0x5f552f=_[_0xf602('0x3d')]({},_0x5f552f,_0x5a03d7[_0xf602('0x40')]);var _0x237717={'where':_0x5f552f[_0xf602('0x3a')]};return db['MailServerOut']['count'](_0x237717)[_0xf602('0x24')](function(_0xcb98f3){_0x53f50b['count']=_0xcb98f3;if(_0x5a03d7[_0xf602('0x2f')][_0xf602('0x41')]){_0x5f552f[_0xf602('0x42')]=[{'all':!![]}];}return db[_0xf602('0x2b')][_0xf602('0x43')](_0x5f552f);})['then'](function(_0x7f9430){_0x53f50b[_0xf602('0x44')]=_0x7f9430;return _0x53f50b;})[_0xf602('0x24')](respondWithFilteredResult(_0x1967c2,_0x5f552f))[_0xf602('0x45')](handleError(_0x1967c2,null));};exports[_0xf602('0x46')]=function(_0xee8e55,_0x2a902b){var _0x558351={'raw':!![],'where':{'id':_0xee8e55[_0xf602('0x47')]['id']}},_0x5278b9={};_0x5278b9[_0xf602('0x32')]=_[_0xf602('0x30')](db[_0xf602('0x2b')][_0xf602('0x2c')]);_0x5278b9['query']=_[_0xf602('0x30')](_0xee8e55[_0xf602('0x2f')]);_0x5278b9['filters']=_['intersection'](_0x5278b9['model'],_0x5278b9[_0xf602('0x2f')]);_0x558351[_0xf602('0x34')]=_[_0xf602('0x31')](_0x5278b9['model'],qs['fields'](_0xee8e55[_0xf602('0x2f')]['fields']));_0x558351[_0xf602('0x34')]=_0x558351[_0xf602('0x34')][_0xf602('0x35')]?_0x558351[_0xf602('0x34')]:_0x5278b9[_0xf602('0x32')];if(_0xee8e55['query']['includeAll']){_0x558351['include']=[{'all':!![]}];}_0x558351=_[_0xf602('0x3d')]({},_0x558351,_0xee8e55['options']);return db[_0xf602('0x2b')][_0xf602('0x48')](_0x558351)[_0xf602('0x24')](handleEntityNotFound(_0x2a902b,null))[_0xf602('0x24')](respondWithResult(_0x2a902b,null))['catch'](handleError(_0x2a902b,null));};exports['create']=function(_0x49f9c0,_0x1b6f05){return db[_0xf602('0x2b')][_0xf602('0x49')](_0x49f9c0[_0xf602('0x4a')],{})[_0xf602('0x24')](respondWithResult(_0x1b6f05,0xc9))['catch'](handleError(_0x1b6f05,null));};exports[_0xf602('0x4b')]=function(_0x189227,_0x399caa){if(_0x189227[_0xf602('0x4a')]['id']){delete _0x189227[_0xf602('0x4a')]['id'];}return db['MailServerOut'][_0xf602('0x48')]({'where':{'id':_0x189227[_0xf602('0x47')]['id']}})[_0xf602('0x24')](handleEntityNotFound(_0x399caa,null))['then'](saveUpdates(_0x189227[_0xf602('0x4a')],null))[_0xf602('0x24')](respondWithResult(_0x399caa,null))['catch'](handleError(_0x399caa,null));};exports[_0xf602('0x4c')]=function(_0x13b0dc,_0x1926cd){return db['MailServerOut']['find']({'where':{'id':_0x13b0dc[_0xf602('0x47')]['id']}})[_0xf602('0x24')](handleEntityNotFound(_0x1926cd,null))['then'](removeEntity(_0x1926cd,null))['catch'](handleError(_0x1926cd,null));}; \ No newline at end of file +var _0x1f44=['../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailServerOut','count','includeAll','findAll','rows','params','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x336e34,_0x1d4200){var _0x23acfb=function(_0x63d51b){while(--_0x63d51b){_0x336e34['push'](_0x336e34['shift']());}};_0x23acfb(++_0x1d4200);}(_0x1f44,0x1ee));var _0x41f4=function(_0x187d2b,_0x54bc0d){_0x187d2b=_0x187d2b-0x0;var _0x3f8023=_0x1f44[_0x187d2b];return _0x3f8023;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41f4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41f4('0x1'));var rp=require(_0x41f4('0x2'));var moment=require(_0x41f4('0x3'));var BPromise=require(_0x41f4('0x4'));var Mustache=require(_0x41f4('0x5'));var util=require('util');var path=require(_0x41f4('0x6'));var sox=require(_0x41f4('0x7'));var csv=require('to-csv');var ejs=require(_0x41f4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41f4('0x9'));var squel=require(_0x41f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x41f4('0xb'));var deskjs=require(_0x41f4('0xc'));var toCsv=require(_0x41f4('0xd'));var querystring=require(_0x41f4('0xe'));var Papa=require(_0x41f4('0xf'));var Redis=require(_0x41f4('0x10'));var authService=require(_0x41f4('0x11'));var qs=require(_0x41f4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41f4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x41f4('0x14'));var licenseUtil=require(_0x41f4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a6ff6,_0x87ccc5){_0x87ccc5=_0x87ccc5||0xcc;return function(_0xb31960){if(_0xb31960){return _0x3a6ff6[_0x41f4('0x16')](_0x87ccc5);}return _0x3a6ff6[_0x41f4('0x17')](_0x87ccc5)[_0x41f4('0x18')]();};}function respondWithResult(_0x19a00d,_0x5e62b2){_0x5e62b2=_0x5e62b2||0xc8;return function(_0xd05366){if(_0xd05366){return _0x19a00d[_0x41f4('0x17')](_0x5e62b2)[_0x41f4('0x19')](_0xd05366);}};}function respondWithFilteredResult(_0x4f2faa,_0x3b28bf){return function(_0x4fdecd){if(_0x4fdecd){var _0x23c02f=typeof _0x3b28bf[_0x41f4('0x1a')]==='undefined'&&typeof _0x3b28bf[_0x41f4('0x1b')]===_0x41f4('0x1c');var _0x41a5b0=_0x4fdecd['count'];var _0x5aaf1b=_0x23c02f?0x0:_0x3b28bf['offset'];var _0x56f208=_0x23c02f?_0x4fdecd['count']:_0x3b28bf[_0x41f4('0x1a')]+_0x3b28bf[_0x41f4('0x1b')];var _0x5c8b78;if(_0x56f208>=_0x41a5b0){_0x56f208=_0x41a5b0;_0x5c8b78=0xc8;}else{_0x5c8b78=0xce;}_0x4f2faa[_0x41f4('0x17')](_0x5c8b78);return _0x4f2faa[_0x41f4('0x1d')](_0x41f4('0x1e'),_0x5aaf1b+'-'+_0x56f208+'/'+_0x41a5b0)[_0x41f4('0x19')](_0x4fdecd);}return null;};}function patchUpdates(_0xb65062){return function(_0x219f82){try{jsonpatch[_0x41f4('0x1f')](_0x219f82,_0xb65062,!![]);}catch(_0x581ab9){return BPromise[_0x41f4('0x20')](_0x581ab9);}return _0x219f82[_0x41f4('0x21')]();};}function saveUpdates(_0x41e493,_0x447477){return function(_0x3b6153){if(_0x3b6153){return _0x3b6153[_0x41f4('0x22')](_0x41e493)[_0x41f4('0x23')](function(_0x25bbc9){return _0x25bbc9;});}return null;};}function removeEntity(_0x3543e5,_0x375b07){return function(_0x360509){if(_0x360509){return _0x360509[_0x41f4('0x24')]()['then'](function(){_0x3543e5[_0x41f4('0x17')](0xcc)[_0x41f4('0x18')]();});}};}function handleEntityNotFound(_0x50d676,_0x50c609){return function(_0x433789){if(!_0x433789){_0x50d676[_0x41f4('0x16')](0x194);}return _0x433789;};}function handleError(_0x8a8ff0,_0x42b255){_0x42b255=_0x42b255||0x1f4;return function(_0x4f8221){logger[_0x41f4('0x25')](_0x4f8221[_0x41f4('0x26')]);if(_0x4f8221['name']){delete _0x4f8221[_0x41f4('0x27')];}_0x8a8ff0[_0x41f4('0x17')](_0x42b255)[_0x41f4('0x28')](_0x4f8221);};}exports[_0x41f4('0x29')]=function(_0x52a95e,_0x553a43){var _0xd03f55={},_0x5bef64={},_0x18818d={'count':0x0,'rows':[]};var _0x28df89=_[_0x41f4('0x2a')](db['MailServerOut'][_0x41f4('0x2b')],function(_0x1c43e8){return{'name':_0x1c43e8['fieldName'],'type':_0x1c43e8[_0x41f4('0x2c')][_0x41f4('0x2d')]};});_0x5bef64[_0x41f4('0x2e')]=_[_0x41f4('0x2a')](_0x28df89,_0x41f4('0x27'));_0x5bef64[_0x41f4('0x2f')]=_[_0x41f4('0x30')](_0x52a95e[_0x41f4('0x2f')]);_0x5bef64[_0x41f4('0x31')]=_['intersection'](_0x5bef64['model'],_0x5bef64[_0x41f4('0x2f')]);_0xd03f55[_0x41f4('0x32')]=_[_0x41f4('0x33')](_0x5bef64[_0x41f4('0x2e')],qs[_0x41f4('0x34')](_0x52a95e[_0x41f4('0x2f')][_0x41f4('0x34')]));_0xd03f55[_0x41f4('0x32')]=_0xd03f55[_0x41f4('0x32')]['length']?_0xd03f55[_0x41f4('0x32')]:_0x5bef64[_0x41f4('0x2e')];if(!_0x52a95e[_0x41f4('0x2f')][_0x41f4('0x35')](_0x41f4('0x36'))){_0xd03f55[_0x41f4('0x1b')]=qs[_0x41f4('0x1b')](_0x52a95e[_0x41f4('0x2f')][_0x41f4('0x1b')]);_0xd03f55[_0x41f4('0x1a')]=qs[_0x41f4('0x1a')](_0x52a95e[_0x41f4('0x2f')][_0x41f4('0x1a')]);}_0xd03f55[_0x41f4('0x37')]=qs[_0x41f4('0x38')](_0x52a95e[_0x41f4('0x2f')][_0x41f4('0x38')]);_0xd03f55['where']=qs[_0x41f4('0x31')](_[_0x41f4('0x39')](_0x52a95e[_0x41f4('0x2f')],_0x5bef64[_0x41f4('0x31')]),_0x28df89);if(_0x52a95e[_0x41f4('0x2f')][_0x41f4('0x3a')]){_0xd03f55[_0x41f4('0x3b')]=_[_0x41f4('0x3c')](_0xd03f55['where'],{'$or':_[_0x41f4('0x2a')](_0x28df89,function(_0x4608c7){if(_0x4608c7['type']!==_0x41f4('0x3d')){var _0x5edcd2={};_0x5edcd2[_0x4608c7[_0x41f4('0x27')]]={'$like':'%'+_0x52a95e['query'][_0x41f4('0x3a')]+'%'};return _0x5edcd2;}})});}_0xd03f55=_[_0x41f4('0x3c')]({},_0xd03f55,_0x52a95e[_0x41f4('0x3e')]);var _0xb3c75f={'where':_0xd03f55[_0x41f4('0x3b')]};return db[_0x41f4('0x3f')][_0x41f4('0x40')](_0xb3c75f)[_0x41f4('0x23')](function(_0x312ea1){_0x18818d[_0x41f4('0x40')]=_0x312ea1;if(_0x52a95e['query'][_0x41f4('0x41')]){_0xd03f55['include']=[{'all':!![]}];}return db[_0x41f4('0x3f')][_0x41f4('0x42')](_0xd03f55);})['then'](function(_0x4fe4ef){_0x18818d[_0x41f4('0x43')]=_0x4fe4ef;return _0x18818d;})[_0x41f4('0x23')](respondWithFilteredResult(_0x553a43,_0xd03f55))['catch'](handleError(_0x553a43,null));};exports['show']=function(_0x522b85,_0x2fdc75){var _0x578b28={'raw':!![],'where':{'id':_0x522b85[_0x41f4('0x44')]['id']}},_0x5403ca={};_0x5403ca['model']=_[_0x41f4('0x30')](db[_0x41f4('0x3f')][_0x41f4('0x2b')]);_0x5403ca[_0x41f4('0x2f')]=_[_0x41f4('0x30')](_0x522b85[_0x41f4('0x2f')]);_0x5403ca[_0x41f4('0x31')]=_[_0x41f4('0x33')](_0x5403ca[_0x41f4('0x2e')],_0x5403ca[_0x41f4('0x2f')]);_0x578b28[_0x41f4('0x32')]=_[_0x41f4('0x33')](_0x5403ca[_0x41f4('0x2e')],qs[_0x41f4('0x34')](_0x522b85['query']['fields']));_0x578b28[_0x41f4('0x32')]=_0x578b28[_0x41f4('0x32')]['length']?_0x578b28[_0x41f4('0x32')]:_0x5403ca['model'];if(_0x522b85[_0x41f4('0x2f')][_0x41f4('0x41')]){_0x578b28['include']=[{'all':!![]}];}_0x578b28=_[_0x41f4('0x3c')]({},_0x578b28,_0x522b85['options']);return db[_0x41f4('0x3f')][_0x41f4('0x45')](_0x578b28)[_0x41f4('0x23')](handleEntityNotFound(_0x2fdc75,null))[_0x41f4('0x23')](respondWithResult(_0x2fdc75,null))[_0x41f4('0x46')](handleError(_0x2fdc75,null));};exports[_0x41f4('0x47')]=function(_0x357481,_0x5aaf64){return db[_0x41f4('0x3f')][_0x41f4('0x47')](_0x357481[_0x41f4('0x48')],{})[_0x41f4('0x23')](respondWithResult(_0x5aaf64,0xc9))['catch'](handleError(_0x5aaf64,null));};exports[_0x41f4('0x22')]=function(_0x31a199,_0x4faa24){if(_0x31a199[_0x41f4('0x48')]['id']){delete _0x31a199[_0x41f4('0x48')]['id'];}return db[_0x41f4('0x3f')][_0x41f4('0x45')]({'where':{'id':_0x31a199[_0x41f4('0x44')]['id']}})[_0x41f4('0x23')](handleEntityNotFound(_0x4faa24,null))[_0x41f4('0x23')](saveUpdates(_0x31a199['body'],null))[_0x41f4('0x23')](respondWithResult(_0x4faa24,null))['catch'](handleError(_0x4faa24,null));};exports[_0x41f4('0x24')]=function(_0x2034ae,_0x33ce36){return db['MailServerOut']['find']({'where':{'id':_0x2034ae['params']['id']}})['then'](handleEntityNotFound(_0x33ce36,null))[_0x41f4('0x23')](removeEntity(_0x33ce36,null))[_0x41f4('0x46')](handleError(_0x33ce36,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a5faea1..456e5d1 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 _0xa5a7=['bluebird','path','rimraf','./mailServerOut.attributes','define','lodash','../../config/logger','api'];(function(_0x1a8330,_0xeae015){var _0x113759=function(_0x4dbb11){while(--_0x4dbb11){_0x1a8330['push'](_0x1a8330['shift']());}};_0x113759(++_0xeae015);}(_0xa5a7,0xed));var _0x7a5a=function(_0x3b4513,_0x4f7372){_0x3b4513=_0x3b4513-0x0;var _0x42e222=_0xa5a7[_0x3b4513];return _0x42e222;};'use strict';var _=require(_0x7a5a('0x0'));var util=require('util');var logger=require(_0x7a5a('0x1'))(_0x7a5a('0x2'));var moment=require('moment');var BPromise=require(_0x7a5a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5a('0x4'));var rimraf=require(_0x7a5a('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a5a('0x6'));module['exports']=function(_0x4618e5,_0x573d4b){return _0x4618e5[_0x7a5a('0x7')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb46d=['../../config/logger','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util'];(function(_0x11fb9a,_0x35ae00){var _0x2776a8=function(_0x476429){while(--_0x476429){_0x11fb9a['push'](_0x11fb9a['shift']());}};_0x2776a8(++_0x35ae00);}(_0xb46d,0x166));var _0xdb46=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0xb46d[_0x542da8];return _0x533d7e;};'use strict';var _=require(_0xdb46('0x0'));var util=require(_0xdb46('0x1'));var logger=require(_0xdb46('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdb46('0x3'));var rp=require(_0xdb46('0x4'));var fs=require('fs');var path=require(_0xdb46('0x5'));var rimraf=require(_0xdb46('0x6'));var config=require('../../config/environment');var attributes=require(_0xdb46('0x7'));module[_0xdb46('0x8')]=function(_0x576277,_0x172c56){return _0x576277[_0xdb46('0x9')](_0xdb46('0xa'),attributes,{'tableName':_0xdb46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index ed01ab1..de0a6d9 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 _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(_0x1a9d4b,_0x3a5d59){var _0x51a2d9=function(_0xd4cfef){while(--_0xd4cfef){_0x1a9d4b['push'](_0x1a9d4b['shift']());}};_0x51a2d9(++_0x3a5d59);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a998b,_0x5a3c95){_0x5a998b=_0x5a998b-0x0;var _0x402fcc=_0x5f2f[_0x5a998b];return _0x402fcc;};'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 +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x274610,_0x36f5c4){_0x274610=_0x274610-0x0;var _0x4da8c1=_0x7a54[_0x274610];return _0x4da8c1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ed27d46..ae70957 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 _0x1827=['/describe','describe','/:id','post','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xfb56ff,_0xe8be82){var _0x5079ac=function(_0x57f00c){while(--_0x57f00c){_0xfb56ff['push'](_0xfb56ff['shift']());}};_0x5079ac(++_0xe8be82);}(_0x1827,0xd9));var _0x7182=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x1827[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require(_0x7182('0x0'));var util=require(_0x7182('0x1'));var path=require(_0x7182('0x2'));var timeout=require('connect-timeout');var express=require(_0x7182('0x3'));var router=express['Router']();var fs_extra=require(_0x7182('0x4'));var auth=require(_0x7182('0x5'));var interaction=require(_0x7182('0x6'));var config=require(_0x7182('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x7182('0x8')](),controller[_0x7182('0x9')]);router[_0x7182('0xa')](_0x7182('0xb'),auth['isAuthenticated'](),controller[_0x7182('0xc')]);router[_0x7182('0xa')](_0x7182('0xd'),auth[_0x7182('0x8')](),controller['show']);router[_0x7182('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7182('0xf')]('/:id',auth[_0x7182('0x8')](),controller[_0x7182('0x10')]);router[_0x7182('0x11')]('/:id',auth[_0x7182('0x8')](),controller['destroy']);module[_0x7182('0x12')]=router; \ No newline at end of file +var _0x7d0f=['post','create','put','update','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x404735,_0x373ef2){var _0x5af211=function(_0x44c81f){while(--_0x44c81f){_0x404735['push'](_0x404735['shift']());}};_0x5af211(++_0x373ef2);}(_0x7d0f,0x175));var _0xf7d0=function(_0x507bc4,_0x2d30df){_0x507bc4=_0x507bc4-0x0;var _0x516569=_0x7d0f[_0x507bc4];return _0x516569;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf7d0('0x0'));var express=require('express');var router=express[_0xf7d0('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xf7d0('0x2'));var interaction=require(_0xf7d0('0x3'));var config=require(_0xf7d0('0x4'));var controller=require(_0xf7d0('0x5'));router[_0xf7d0('0x6')]('/',auth[_0xf7d0('0x7')](),controller[_0xf7d0('0x8')]);router['get'](_0xf7d0('0x9'),auth[_0xf7d0('0x7')](),controller['describe']);router[_0xf7d0('0x6')](_0xf7d0('0xa'),auth[_0xf7d0('0x7')](),controller['show']);router[_0xf7d0('0xb')]('/',auth[_0xf7d0('0x7')](),controller[_0xf7d0('0xc')]);router[_0xf7d0('0xd')]('/:id',auth[_0xf7d0('0x7')](),controller[_0xf7d0('0xe')]);router['delete']('/:id',auth[_0xf7d0('0x7')](),controller['destroy']);module[_0xf7d0('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 279958d..249e0e0 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 _0x814b=['STRING','name','sequelize','exports'];(function(_0x436b04,_0x20d0d3){var _0x4bada6=function(_0x10d007){while(--_0x10d007){_0x436b04['push'](_0x436b04['shift']());}};_0x4bada6(++_0x20d0d3);}(_0x814b,0x1a2));var _0xb814=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x814b[_0x3fb030];return _0xd6899b;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb814('0x2')]}}; \ No newline at end of file +var _0x4074=['sequelize','exports','STRING'];(function(_0x216559,_0x2ff327){var _0x1b30f5=function(_0x3414e8){while(--_0x3414e8){_0x216559['push'](_0x216559['shift']());}};_0x1b30f5(++_0x2ff327);}(_0x4074,0xf0));var _0x4407=function(_0x2b088f,_0x38b6ea){_0x2b088f=_0x2b088f-0x0;var _0x5aefec=_0x4074[_0x2b088f];return _0x5aefec;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4407('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index bcfcc0d..6db7f0c 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 _0xe90e=['end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','status'];(function(_0x27f933,_0x2004f6){var _0x3c0ae8=function(_0x566c6){while(--_0x566c6){_0x27f933['push'](_0x27f933['shift']());}};_0x3c0ae8(++_0x2004f6);}(_0xe90e,0x157));var _0xee90=function(_0xf85c54,_0x5b7cc2){_0xf85c54=_0xf85c54-0x0;var _0x5a0829=_0xe90e[_0xf85c54];return _0x5a0829;};'use strict';var emlformat=require(_0xee90('0x0'));var rimraf=require(_0xee90('0x1'));var zipdir=require(_0xee90('0x2'));var jsonpatch=require(_0xee90('0x3'));var rp=require('request-promise');var moment=require(_0xee90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee90('0x5'));var util=require('util');var path=require(_0xee90('0x6'));var sox=require(_0xee90('0x7'));var csv=require(_0xee90('0x8'));var ejs=require(_0xee90('0x9'));var fs=require('fs');var fs_extra=require(_0xee90('0xa'));var _=require('lodash');var squel=require(_0xee90('0xb'));var crypto=require(_0xee90('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee90('0xd'));var toCsv=require(_0xee90('0x8'));var querystring=require('querystring');var Papa=require(_0xee90('0xe'));var Redis=require(_0xee90('0xf'));var authService=require(_0xee90('0x10'));var qs=require(_0xee90('0x11'));var as=require(_0xee90('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee90('0x13'))('api');var utils=require(_0xee90('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5beaf7,_0x5ce1e2){_0x5ce1e2=_0x5ce1e2||0xcc;return function(_0x5183ab){if(_0x5183ab){return _0x5beaf7['sendStatus'](_0x5ce1e2);}return _0x5beaf7[_0xee90('0x15')](_0x5ce1e2)[_0xee90('0x16')]();};}function respondWithResult(_0x5cceca,_0x2ca7b3){_0x2ca7b3=_0x2ca7b3||0xc8;return function(_0xcc603c){if(_0xcc603c){return _0x5cceca['status'](_0x2ca7b3)['json'](_0xcc603c);}};}function respondWithFilteredResult(_0xe7f147,_0x5d29b9){return function(_0x4844a7){if(_0x4844a7){var _0x3e9b88=typeof _0x5d29b9[_0xee90('0x17')]===_0xee90('0x18')&&typeof _0x5d29b9[_0xee90('0x19')]===_0xee90('0x18');var _0x25026b=_0x4844a7['count'];var _0x3dd82c=_0x3e9b88?0x0:_0x5d29b9['offset'];var _0x1d275c=_0x3e9b88?_0x4844a7[_0xee90('0x1a')]:_0x5d29b9[_0xee90('0x17')]+_0x5d29b9['limit'];var _0x102112;if(_0x1d275c>=_0x25026b){_0x1d275c=_0x25026b;_0x102112=0xc8;}else{_0x102112=0xce;}_0xe7f147['status'](_0x102112);return _0xe7f147[_0xee90('0x1b')](_0xee90('0x1c'),_0x3dd82c+'-'+_0x1d275c+'/'+_0x25026b)[_0xee90('0x1d')](_0x4844a7);}return null;};}function patchUpdates(_0xc021e8){return function(_0x9023e7){try{jsonpatch[_0xee90('0x1e')](_0x9023e7,_0xc021e8,!![]);}catch(_0x2abd03){return BPromise[_0xee90('0x1f')](_0x2abd03);}return _0x9023e7['save']();};}function saveUpdates(_0x1b7879,_0x35ce58){return function(_0x56eeb0){if(_0x56eeb0){return _0x56eeb0[_0xee90('0x20')](_0x1b7879)[_0xee90('0x21')](function(_0x161463){return _0x161463;});}return null;};}function removeEntity(_0x114f44,_0x42406a){return function(_0x3564cb){if(_0x3564cb){return _0x3564cb['destroy']()[_0xee90('0x21')](function(){_0x114f44[_0xee90('0x15')](0xcc)[_0xee90('0x16')]();});}};}function handleEntityNotFound(_0x405c2b,_0x1002f3){return function(_0x2b9fc7){if(!_0x2b9fc7){_0x405c2b[_0xee90('0x22')](0x194);}return _0x2b9fc7;};}function handleError(_0x557b51,_0x2a4a17){_0x2a4a17=_0x2a4a17||0x1f4;return function(_0x29b541){logger[_0xee90('0x23')](_0x29b541[_0xee90('0x24')]);if(_0x29b541[_0xee90('0x25')]){delete _0x29b541[_0xee90('0x25')];}_0x557b51['status'](_0x2a4a17)['send'](_0x29b541);};}exports[_0xee90('0x26')]=function(_0x312837,_0x15f351){var _0x1916a3={},_0x404b33={},_0x2c92de={'count':0x0,'rows':[]};var _0x179a03=_[_0xee90('0x27')](db[_0xee90('0x28')][_0xee90('0x29')],function(_0x3e2dcd){return{'name':_0x3e2dcd[_0xee90('0x2a')],'type':_0x3e2dcd[_0xee90('0x2b')][_0xee90('0x2c')]};});_0x404b33['model']=_[_0xee90('0x27')](_0x179a03,_0xee90('0x25'));_0x404b33['query']=_['keys'](_0x312837[_0xee90('0x2d')]);_0x404b33[_0xee90('0x2e')]=_[_0xee90('0x2f')](_0x404b33[_0xee90('0x30')],_0x404b33[_0xee90('0x2d')]);_0x1916a3[_0xee90('0x31')]=_[_0xee90('0x2f')](_0x404b33[_0xee90('0x30')],qs[_0xee90('0x32')](_0x312837[_0xee90('0x2d')]['fields']));_0x1916a3[_0xee90('0x31')]=_0x1916a3[_0xee90('0x31')][_0xee90('0x33')]?_0x1916a3[_0xee90('0x31')]:_0x404b33[_0xee90('0x30')];if(!_0x312837[_0xee90('0x2d')][_0xee90('0x34')](_0xee90('0x35'))){_0x1916a3[_0xee90('0x19')]=qs[_0xee90('0x19')](_0x312837[_0xee90('0x2d')][_0xee90('0x19')]);_0x1916a3[_0xee90('0x17')]=qs[_0xee90('0x17')](_0x312837[_0xee90('0x2d')]['offset']);}_0x1916a3[_0xee90('0x36')]=qs[_0xee90('0x37')](_0x312837[_0xee90('0x2d')]['sort']);_0x1916a3[_0xee90('0x38')]=qs[_0xee90('0x2e')](_[_0xee90('0x39')](_0x312837[_0xee90('0x2d')],_0x404b33['filters']),_0x179a03);if(_0x312837[_0xee90('0x2d')]['filter']){_0x1916a3[_0xee90('0x38')]=_[_0xee90('0x3a')](_0x1916a3[_0xee90('0x38')],{'$or':_[_0xee90('0x27')](_0x179a03,function(_0x1f490b){if(_0x1f490b[_0xee90('0x2b')]!==_0xee90('0x3b')){var _0x37f48c={};_0x37f48c[_0x1f490b[_0xee90('0x25')]]={'$like':'%'+_0x312837['query']['filter']+'%'};return _0x37f48c;}})});}_0x1916a3=_[_0xee90('0x3a')]({},_0x1916a3,_0x312837[_0xee90('0x3c')]);var _0x212ec2={'where':_0x1916a3['where']};return db[_0xee90('0x28')][_0xee90('0x1a')](_0x212ec2)[_0xee90('0x21')](function(_0x2a2ba3){_0x2c92de['count']=_0x2a2ba3;if(_0x312837[_0xee90('0x2d')][_0xee90('0x3d')]){_0x1916a3['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xee90('0x3e')](_0x1916a3);})['then'](function(_0x4f754e){_0x2c92de[_0xee90('0x3f')]=_0x4f754e;return _0x2c92de;})[_0xee90('0x21')](respondWithFilteredResult(_0x15f351,_0x1916a3))[_0xee90('0x40')](handleError(_0x15f351,null));};exports[_0xee90('0x41')]=function(_0x140936,_0x4b9836){var _0x2ddbad={'raw':!![],'where':{'id':_0x140936['params']['id']}},_0x15ade8={};_0x15ade8[_0xee90('0x30')]=_['keys'](db[_0xee90('0x28')][_0xee90('0x29')]);_0x15ade8[_0xee90('0x2d')]=_[_0xee90('0x42')](_0x140936['query']);_0x15ade8['filters']=_[_0xee90('0x2f')](_0x15ade8[_0xee90('0x30')],_0x15ade8[_0xee90('0x2d')]);_0x2ddbad['attributes']=_['intersection'](_0x15ade8[_0xee90('0x30')],qs[_0xee90('0x32')](_0x140936[_0xee90('0x2d')]['fields']));_0x2ddbad['attributes']=_0x2ddbad[_0xee90('0x31')]['length']?_0x2ddbad['attributes']:_0x15ade8[_0xee90('0x30')];if(_0x140936[_0xee90('0x2d')]['includeAll']){_0x2ddbad['include']=[{'all':!![]}];}_0x2ddbad=_[_0xee90('0x3a')]({},_0x2ddbad,_0x140936[_0xee90('0x3c')]);return db['MailSubstatus'][_0xee90('0x43')](_0x2ddbad)[_0xee90('0x21')](handleEntityNotFound(_0x4b9836,null))[_0xee90('0x21')](respondWithResult(_0x4b9836,null))[_0xee90('0x40')](handleError(_0x4b9836,null));};exports[_0xee90('0x44')]=function(_0x21f5c8,_0x4ef0fe){return db[_0xee90('0x28')][_0xee90('0x44')](_0x21f5c8[_0xee90('0x45')],{})[_0xee90('0x21')](respondWithResult(_0x4ef0fe,0xc9))[_0xee90('0x40')](handleError(_0x4ef0fe,null));};exports[_0xee90('0x20')]=function(_0x1bd2f3,_0xbd66a5){if(_0x1bd2f3[_0xee90('0x45')]['id']){delete _0x1bd2f3['body']['id'];}return db[_0xee90('0x28')]['find']({'where':{'id':_0x1bd2f3[_0xee90('0x46')]['id']}})[_0xee90('0x21')](handleEntityNotFound(_0xbd66a5,null))['then'](saveUpdates(_0x1bd2f3[_0xee90('0x45')],null))['then'](respondWithResult(_0xbd66a5,null))['catch'](handleError(_0xbd66a5,null));};exports[_0xee90('0x47')]=function(_0x32a89e,_0x291c65){return db[_0xee90('0x28')][_0xee90('0x43')]({'where':{'id':_0x32a89e[_0xee90('0x46')]['id']}})[_0xee90('0x21')](handleEntityNotFound(_0x291c65,null))[_0xee90('0x21')](removeEntity(_0x291c65,null))[_0xee90('0x40')](handleError(_0x291c65,null));};exports['describe']=function(_0x548cf9,_0x2772a3){return db['MailSubstatus'][_0xee90('0x48')]()['then'](respondWithResult(_0x2772a3,null))[_0xee90('0x40')](handleError(_0x2772a3,null));}; \ No newline at end of file +var _0xafa6=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','update','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','catch','create','body','find','params','destroy','describe','eml-format','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xafa6,0x11e));var _0x6afa=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xafa6[_0x4ed520];return _0x4415a6;};'use strict';var emlformat=require(_0x6afa('0x0'));var rimraf=require(_0x6afa('0x1'));var zipdir=require(_0x6afa('0x2'));var jsonpatch=require(_0x6afa('0x3'));var rp=require('request-promise');var moment=require(_0x6afa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6afa('0x5'));var util=require(_0x6afa('0x6'));var path=require(_0x6afa('0x7'));var sox=require(_0x6afa('0x8'));var csv=require(_0x6afa('0x9'));var ejs=require(_0x6afa('0xa'));var fs=require('fs');var fs_extra=require(_0x6afa('0xb'));var _=require(_0x6afa('0xc'));var squel=require(_0x6afa('0xd'));var crypto=require('crypto');var jsforce=require(_0x6afa('0xe'));var deskjs=require(_0x6afa('0xf'));var toCsv=require(_0x6afa('0x9'));var querystring=require(_0x6afa('0x10'));var Papa=require(_0x6afa('0x11'));var Redis=require('ioredis');var authService=require(_0x6afa('0x12'));var qs=require(_0x6afa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6afa('0x14'));var logger=require(_0x6afa('0x15'))(_0x6afa('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6afa('0x17'));var db=require(_0x6afa('0x18'))['db'];function respondWithStatusCode(_0x5ea0f1,_0x8a70b3){_0x8a70b3=_0x8a70b3||0xcc;return function(_0x17f658){if(_0x17f658){return _0x5ea0f1['sendStatus'](_0x8a70b3);}return _0x5ea0f1['status'](_0x8a70b3)[_0x6afa('0x19')]();};}function respondWithResult(_0x37a596,_0x2fbd3f){_0x2fbd3f=_0x2fbd3f||0xc8;return function(_0x59b5fe){if(_0x59b5fe){return _0x37a596['status'](_0x2fbd3f)[_0x6afa('0x1a')](_0x59b5fe);}};}function respondWithFilteredResult(_0x1ff34f,_0x569bdc){return function(_0x5a156e){if(_0x5a156e){var _0xc90bd1=typeof _0x569bdc[_0x6afa('0x1b')]===_0x6afa('0x1c')&&typeof _0x569bdc[_0x6afa('0x1d')]===_0x6afa('0x1c');var _0x5746f1=_0x5a156e[_0x6afa('0x1e')];var _0x19aaca=_0xc90bd1?0x0:_0x569bdc[_0x6afa('0x1b')];var _0x1e9f20=_0xc90bd1?_0x5a156e['count']:_0x569bdc['offset']+_0x569bdc['limit'];var _0x236ab7;if(_0x1e9f20>=_0x5746f1){_0x1e9f20=_0x5746f1;_0x236ab7=0xc8;}else{_0x236ab7=0xce;}_0x1ff34f[_0x6afa('0x1f')](_0x236ab7);return _0x1ff34f['set'](_0x6afa('0x20'),_0x19aaca+'-'+_0x1e9f20+'/'+_0x5746f1)['json'](_0x5a156e);}return null;};}function patchUpdates(_0x59f2c4){return function(_0x256304){try{jsonpatch[_0x6afa('0x21')](_0x256304,_0x59f2c4,!![]);}catch(_0x38d3c0){return BPromise['reject'](_0x38d3c0);}return _0x256304['save']();};}function saveUpdates(_0x274704,_0x31935d){return function(_0x880ae1){if(_0x880ae1){return _0x880ae1[_0x6afa('0x22')](_0x274704)[_0x6afa('0x23')](function(_0x318d5c){return _0x318d5c;});}return null;};}function removeEntity(_0x50f50b,_0x3b54cf){return function(_0x2a8397){if(_0x2a8397){return _0x2a8397['destroy']()[_0x6afa('0x23')](function(){_0x50f50b['status'](0xcc)[_0x6afa('0x19')]();});}};}function handleEntityNotFound(_0x1baa81,_0x35bf50){return function(_0xd2a0c0){if(!_0xd2a0c0){_0x1baa81[_0x6afa('0x24')](0x194);}return _0xd2a0c0;};}function handleError(_0x56a842,_0xa5ff2e){_0xa5ff2e=_0xa5ff2e||0x1f4;return function(_0x1d99c0){logger['error'](_0x1d99c0[_0x6afa('0x25')]);if(_0x1d99c0['name']){delete _0x1d99c0[_0x6afa('0x26')];}_0x56a842['status'](_0xa5ff2e)[_0x6afa('0x27')](_0x1d99c0);};}exports[_0x6afa('0x28')]=function(_0x5784ab,_0x119a5b){var _0xa041c2={},_0x2c270b={},_0x10d673={'count':0x0,'rows':[]};var _0x3c644f=_['map'](db['MailSubstatus'][_0x6afa('0x29')],function(_0x462813){return{'name':_0x462813[_0x6afa('0x2a')],'type':_0x462813[_0x6afa('0x2b')][_0x6afa('0x2c')]};});_0x2c270b[_0x6afa('0x2d')]=_[_0x6afa('0x2e')](_0x3c644f,'name');_0x2c270b[_0x6afa('0x2f')]=_[_0x6afa('0x30')](_0x5784ab['query']);_0x2c270b[_0x6afa('0x31')]=_['intersection'](_0x2c270b[_0x6afa('0x2d')],_0x2c270b['query']);_0xa041c2[_0x6afa('0x32')]=_[_0x6afa('0x33')](_0x2c270b[_0x6afa('0x2d')],qs[_0x6afa('0x34')](_0x5784ab['query'][_0x6afa('0x34')]));_0xa041c2[_0x6afa('0x32')]=_0xa041c2[_0x6afa('0x32')]['length']?_0xa041c2[_0x6afa('0x32')]:_0x2c270b[_0x6afa('0x2d')];if(!_0x5784ab[_0x6afa('0x2f')]['hasOwnProperty'](_0x6afa('0x35'))){_0xa041c2[_0x6afa('0x1d')]=qs[_0x6afa('0x1d')](_0x5784ab['query'][_0x6afa('0x1d')]);_0xa041c2[_0x6afa('0x1b')]=qs['offset'](_0x5784ab[_0x6afa('0x2f')][_0x6afa('0x1b')]);}_0xa041c2[_0x6afa('0x36')]=qs[_0x6afa('0x37')](_0x5784ab[_0x6afa('0x2f')][_0x6afa('0x37')]);_0xa041c2[_0x6afa('0x38')]=qs[_0x6afa('0x31')](_['pick'](_0x5784ab[_0x6afa('0x2f')],_0x2c270b['filters']),_0x3c644f);if(_0x5784ab[_0x6afa('0x2f')]['filter']){_0xa041c2[_0x6afa('0x38')]=_[_0x6afa('0x39')](_0xa041c2[_0x6afa('0x38')],{'$or':_['map'](_0x3c644f,function(_0x811e70){if(_0x811e70['type']!==_0x6afa('0x3a')){var _0x371e9f={};_0x371e9f[_0x811e70['name']]={'$like':'%'+_0x5784ab[_0x6afa('0x2f')]['filter']+'%'};return _0x371e9f;}})});}_0xa041c2=_[_0x6afa('0x39')]({},_0xa041c2,_0x5784ab[_0x6afa('0x3b')]);var _0x443438={'where':_0xa041c2['where']};return db[_0x6afa('0x3c')]['count'](_0x443438)['then'](function(_0x45cab1){_0x10d673[_0x6afa('0x1e')]=_0x45cab1;if(_0x5784ab[_0x6afa('0x2f')][_0x6afa('0x3d')]){_0xa041c2[_0x6afa('0x3e')]=[{'all':!![]}];}return db[_0x6afa('0x3c')][_0x6afa('0x3f')](_0xa041c2);})[_0x6afa('0x23')](function(_0x234952){_0x10d673[_0x6afa('0x40')]=_0x234952;return _0x10d673;})[_0x6afa('0x23')](respondWithFilteredResult(_0x119a5b,_0xa041c2))[_0x6afa('0x41')](handleError(_0x119a5b,null));};exports['show']=function(_0x4d1315,_0x1117f7){var _0x1448bf={'raw':!![],'where':{'id':_0x4d1315['params']['id']}},_0x4ae581={};_0x4ae581[_0x6afa('0x2d')]=_[_0x6afa('0x30')](db[_0x6afa('0x3c')][_0x6afa('0x29')]);_0x4ae581[_0x6afa('0x2f')]=_[_0x6afa('0x30')](_0x4d1315[_0x6afa('0x2f')]);_0x4ae581[_0x6afa('0x31')]=_['intersection'](_0x4ae581[_0x6afa('0x2d')],_0x4ae581[_0x6afa('0x2f')]);_0x1448bf['attributes']=_[_0x6afa('0x33')](_0x4ae581[_0x6afa('0x2d')],qs[_0x6afa('0x34')](_0x4d1315['query']['fields']));_0x1448bf['attributes']=_0x1448bf[_0x6afa('0x32')]['length']?_0x1448bf[_0x6afa('0x32')]:_0x4ae581[_0x6afa('0x2d')];if(_0x4d1315[_0x6afa('0x2f')][_0x6afa('0x3d')]){_0x1448bf[_0x6afa('0x3e')]=[{'all':!![]}];}_0x1448bf=_[_0x6afa('0x39')]({},_0x1448bf,_0x4d1315[_0x6afa('0x3b')]);return db[_0x6afa('0x3c')]['find'](_0x1448bf)['then'](handleEntityNotFound(_0x1117f7,null))[_0x6afa('0x23')](respondWithResult(_0x1117f7,null))[_0x6afa('0x41')](handleError(_0x1117f7,null));};exports[_0x6afa('0x42')]=function(_0x10755d,_0x136e24){return db[_0x6afa('0x3c')]['create'](_0x10755d['body'],{})[_0x6afa('0x23')](respondWithResult(_0x136e24,0xc9))[_0x6afa('0x41')](handleError(_0x136e24,null));};exports[_0x6afa('0x22')]=function(_0x170082,_0x5e5328){if(_0x170082[_0x6afa('0x43')]['id']){delete _0x170082['body']['id'];}return db[_0x6afa('0x3c')][_0x6afa('0x44')]({'where':{'id':_0x170082[_0x6afa('0x45')]['id']}})[_0x6afa('0x23')](handleEntityNotFound(_0x5e5328,null))[_0x6afa('0x23')](saveUpdates(_0x170082[_0x6afa('0x43')],null))[_0x6afa('0x23')](respondWithResult(_0x5e5328,null))['catch'](handleError(_0x5e5328,null));};exports[_0x6afa('0x46')]=function(_0x24177f,_0x3a8296){return db[_0x6afa('0x3c')][_0x6afa('0x44')]({'where':{'id':_0x24177f[_0x6afa('0x45')]['id']}})[_0x6afa('0x23')](handleEntityNotFound(_0x3a8296,null))[_0x6afa('0x23')](removeEntity(_0x3a8296,null))[_0x6afa('0x41')](handleError(_0x3a8296,null));};exports[_0x6afa('0x47')]=function(_0x14f94f,_0x4dd840){return db[_0x6afa('0x3c')][_0x6afa('0x47')]()[_0x6afa('0x23')](respondWithResult(_0x4dd840,null))[_0x6afa('0x41')](handleError(_0x4dd840,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ac7b66f..1683e4e 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 _0x87b4=['MailSubstatus','setMaxListeners','update','emit','exports','events','../../mysqldb'];(function(_0xa57e3a,_0x174b68){var _0x41214d=function(_0x136b31){while(--_0x136b31){_0xa57e3a['push'](_0xa57e3a['shift']());}};_0x41214d(++_0x174b68);}(_0x87b4,0x1cc));var _0x487b=function(_0xfc170c,_0x258b27){_0xfc170c=_0xfc170c-0x0;var _0x295e5e=_0x87b4[_0xfc170c];return _0x295e5e;};'use strict';var EventEmitter=require(_0x487b('0x0'));var MailSubstatus=require(_0x487b('0x1'))['db'][_0x487b('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x487b('0x3')](0x0);var events={'afterUpdate':_0x487b('0x4')};function emitEvent(_0xbe0981){return function(_0x4daa2c,_0x434f9c,_0x4a1bfb){MailSubstatusEvents['emit'](_0xbe0981+':'+_0x4daa2c['id'],_0x4daa2c);MailSubstatusEvents[_0x487b('0x5')](_0xbe0981,_0x4daa2c);_0x4a1bfb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x487b('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x4057=['update','hasOwnProperty','exports','events','MailSubstatus','setMaxListeners'];(function(_0x2599f5,_0x466366){var _0x52199d=function(_0x5280ac){while(--_0x5280ac){_0x2599f5['push'](_0x2599f5['shift']());}};_0x52199d(++_0x466366);}(_0x4057,0xff));var _0x7405=function(_0x342c5d,_0x55cc5f){_0x342c5d=_0x342c5d-0x0;var _0x2e0a6b=_0x4057[_0x342c5d];return _0x2e0a6b;};'use strict';var EventEmitter=require(_0x7405('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x7405('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7405('0x2')](0x0);var events={'afterUpdate':_0x7405('0x3')};function emitEvent(_0x115e38){return function(_0x368398,_0xf6827b,_0x17d8b3){MailSubstatusEvents['emit'](_0x115e38+':'+_0x368398['id'],_0x368398);MailSubstatusEvents['emit'](_0x115e38,_0x368398);_0x17d8b3(null);};}for(var e in events){if(events[_0x7405('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x7405('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c912c83..7bb5070 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 _0xda23=['_previousDataValues','then','catch','exports','models','define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xda23,0x1d1));var _0x3da2=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0xda23[_0x456b57];return _0x18f49f;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x3da2('0x0')]=function(_0x4797e5){var _0x358e65=_0x4797e5[_0x3da2('0x1')];return _0x4797e5[_0x3da2('0x2')](_0x3da2('0x3'),attributes,{'tableName':_0x3da2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5f46f7,_0x65c451,_0x4d7621){return _0x358e65[_0x3da2('0x5')]['update']({'value':_0x5f46f7[_0x3da2('0x6')]},{'where':{'field':_0x3da2('0x7'),'value':_0x5f46f7[_0x3da2('0x8')]['name']}})[_0x3da2('0x9')](function(){_0x4d7621();})[_0x3da2('0xa')](function(_0xfa0bbf){_0x4d7621(_0xfa0bbf);});}}});}; \ No newline at end of file +var _0xf65a=['update','mailSubstatus','then','models','MailSubstatus','mail_substatuses'];(function(_0x4d1290,_0x195241){var _0x5c51b6=function(_0x558717){while(--_0x558717){_0x4d1290['push'](_0x4d1290['shift']());}};_0x5c51b6(++_0x195241);}(_0xf65a,0x1e3));var _0xaf65=function(_0x42c34f,_0x4baf76){_0x42c34f=_0x42c34f-0x0;var _0x1a64a7=_0xf65a[_0x42c34f];return _0x1a64a7;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x26e98f){var _0x3a78d8=_0x26e98f[_0xaf65('0x0')];return _0x26e98f['define'](_0xaf65('0x1'),attributes,{'tableName':_0xaf65('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x26ed4f,_0x23c6f4,_0x146cd1){return _0x3a78d8['Condition'][_0xaf65('0x3')]({'value':_0x26ed4f['name']},{'where':{'field':_0xaf65('0x4'),'value':_0x26ed4f['_previousDataValues']['name']}})[_0xaf65('0x5')](function(){_0x146cd1();})['catch'](function(_0x310bb3){_0x146cd1(_0x310bb3);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d1cd32c..48a7b68 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 _0x08e6=['../../config/logger','rpc','../../config/environment','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x08e6,0x1b1));var _0x608e=function(_0x54a70,_0xac82ee){_0x54a70=_0x54a70-0x0;var _0x422d1d=_0x08e6[_0x54a70];return _0x422d1d;};'use strict';var _=require('lodash');var util=require(_0x608e('0x0'));var moment=require(_0x608e('0x1'));var BPromise=require(_0x608e('0x2'));var rs=require(_0x608e('0x3'));var fs=require('fs');var Redis=require(_0x608e('0x4'));var db=require(_0x608e('0x5'))['db'];var utils=require(_0x608e('0x6'));var logger=require(_0x608e('0x7'))(_0x608e('0x8'));var config=require(_0x608e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x608e('0xa')][_0x608e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x588f56,_0x375677,_0x4357cf){return new BPromise(function(_0xe3900b,_0x13d465){return client[_0x608e('0xc')](_0x588f56,_0x4357cf)[_0x608e('0xd')](function(_0x53c107){logger['info'](_0x608e('0xe'),_0x375677,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x375677,_0x608e('0xf'),JSON[_0x608e('0x10')](_0x53c107));if(_0x53c107['error']){if(_0x53c107[_0x608e('0x11')][_0x608e('0x12')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x375677,_0x53c107[_0x608e('0x11')][_0x608e('0x13')]);return _0x13d465(_0x53c107[_0x608e('0x11')][_0x608e('0x13')]);}logger[_0x608e('0x11')](_0x608e('0xe'),_0x375677,_0x53c107[_0x608e('0x11')][_0x608e('0x13')]);return _0xe3900b(_0x53c107['error']['message']);}else{logger['info'](_0x608e('0xe'),_0x375677,_0x608e('0xf'));_0xe3900b(_0x53c107[_0x608e('0x14')][_0x608e('0x13')]);}})[_0x608e('0x15')](function(_0x207b0f){logger[_0x608e('0x11')](_0x608e('0xe'),_0x375677,_0x207b0f);_0x13d465(_0x207b0f);});});} \ No newline at end of file +var _0xa85d=['jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x333139,_0x333560){var _0x2492f1=function(_0xc2d309){while(--_0xc2d309){_0x333139['push'](_0x333139['shift']());}};_0x2492f1(++_0x333560);}(_0xa85d,0x77));var _0xda85=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0xa85d[_0x5b013d];return _0x2b6eef;};'use strict';var _=require(_0xda85('0x0'));var util=require(_0xda85('0x1'));var moment=require(_0xda85('0x2'));var BPromise=require(_0xda85('0x3'));var rs=require(_0xda85('0x4'));var fs=require('fs');var Redis=require(_0xda85('0x5'));var db=require(_0xda85('0x6'))['db'];var utils=require(_0xda85('0x7'));var logger=require(_0xda85('0x8'))(_0xda85('0x9'));var config=require(_0xda85('0xa'));var jayson=require(_0xda85('0xb'));var client=jayson[_0xda85('0xc')][_0xda85('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5cc54c,_0x56b94b,_0x16d8d5){return new BPromise(function(_0x4d1f40,_0x1c1dc3){return client['request'](_0x5cc54c,_0x16d8d5)[_0xda85('0xe')](function(_0x557a08){logger[_0xda85('0xf')](_0xda85('0x10'),_0x56b94b,_0xda85('0x11'));logger[_0xda85('0x12')](_0xda85('0x13'),_0x56b94b,_0xda85('0x11'),JSON[_0xda85('0x14')](_0x557a08));if(_0x557a08[_0xda85('0x15')]){if(_0x557a08['error'][_0xda85('0x16')]===0x1f4){logger[_0xda85('0x15')](_0xda85('0x10'),_0x56b94b,_0x557a08[_0xda85('0x15')]['message']);return _0x1c1dc3(_0x557a08[_0xda85('0x15')][_0xda85('0x17')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x56b94b,_0x557a08[_0xda85('0x15')][_0xda85('0x17')]);return _0x4d1f40(_0x557a08[_0xda85('0x15')][_0xda85('0x17')]);}else{logger['info'](_0xda85('0x10'),_0x56b94b,_0xda85('0x11'));_0x4d1f40(_0x557a08[_0xda85('0x18')][_0xda85('0x17')]);}})[_0xda85('0x19')](function(_0x2cfd74){logger[_0xda85('0x15')](_0xda85('0x10'),_0x56b94b,_0x2cfd74);_0x1c1dc3(_0x2cfd74);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0f1c903..0ed5adb 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 _0x9096=['./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x402f03,_0x49bc02){var _0x29a404=function(_0x2d3fe8){while(--_0x2d3fe8){_0x402f03['push'](_0x402f03['shift']());}};_0x29a404(++_0x49bc02);}(_0x9096,0x1b2));var _0x6909=function(_0x218e6b,_0xbca2e6){_0x218e6b=_0x218e6b-0x0;var _0x1487cc=_0x9096[_0x218e6b];return _0x1487cc;};'use strict';var multer=require(_0x6909('0x0'));var util=require('util');var path=require(_0x6909('0x1'));var timeout=require(_0x6909('0x2'));var express=require(_0x6909('0x3'));var router=express[_0x6909('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6909('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6909('0x6'));var controller=require(_0x6909('0x7'));router[_0x6909('0x8')]('/',auth['isAuthenticated'](),controller[_0x6909('0x9')]);router[_0x6909('0x8')](_0x6909('0xa'),auth[_0x6909('0xb')](),controller[_0x6909('0xc')]);router[_0x6909('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6909('0xd')]);router[_0x6909('0xe')]('/',auth[_0x6909('0xb')](),controller[_0x6909('0xf')]);router[_0x6909('0x10')]('/:id',auth[_0x6909('0xb')](),controller[_0x6909('0x11')]);router[_0x6909('0x12')](_0x6909('0x13'),auth['isAuthenticated'](),controller[_0x6909('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc19a=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd1d157,_0x1fd464){var _0x4ce957=function(_0xc9bf35){while(--_0xc9bf35){_0xd1d157['push'](_0xd1d157['shift']());}};_0x4ce957(++_0x1fd464);}(_0xc19a,0x1c7));var _0xac19=function(_0x4e56d1,_0x3bd1c7){_0x4e56d1=_0x4e56d1-0x0;var _0x319416=_0xc19a[_0x4e56d1];return _0x319416;};'use strict';var multer=require(_0xac19('0x0'));var util=require(_0xac19('0x1'));var path=require(_0xac19('0x2'));var timeout=require('connect-timeout');var express=require(_0xac19('0x3'));var router=express[_0xac19('0x4')]();var fs_extra=require(_0xac19('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xac19('0x6'));var config=require(_0xac19('0x7'));var controller=require(_0xac19('0x8'));router[_0xac19('0x9')]('/',auth[_0xac19('0xa')](),controller[_0xac19('0xb')]);router[_0xac19('0x9')](_0xac19('0xc'),auth[_0xac19('0xa')](),controller[_0xac19('0xd')]);router[_0xac19('0x9')](_0xac19('0xe'),auth[_0xac19('0xa')](),controller[_0xac19('0xf')]);router[_0xac19('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xac19('0x11')]('/:id',auth[_0xac19('0xa')](),controller[_0xac19('0x12')]);router[_0xac19('0x13')](_0xac19('0xe'),auth[_0xac19('0xa')](),controller[_0xac19('0x14')]);module[_0xac19('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5c33a3e..74423ac 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4b0f75,_0x4df71f){_0x4b0f75=_0x4b0f75-0x0;var _0x577679=_0xb43b[_0x4b0f75];return _0x577679;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x20ba61,_0x1336f2){var _0x1319d2=function(_0x1f15be){while(--_0x1f15be){_0x20ba61['push'](_0x20ba61['shift']());}};_0x1319d2(++_0x1336f2);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f9416,_0x43b66c){_0x3f9416=_0x3f9416-0x0;var _0x473b1c=_0xedd9[_0x3f9416];return _0x473b1c;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 768a4ba..259a353 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 _0xd4eb=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x2e7529,_0x2d828b){var _0x4930f2=function(_0x56445a){while(--_0x56445a){_0x2e7529['push'](_0x2e7529['shift']());}};_0x4930f2(++_0x2d828b);}(_0xd4eb,0xf3));var _0xbd4e=function(_0x143be8,_0x58da73){_0x143be8=_0x143be8-0x0;var _0x3ba966=_0xd4eb[_0x143be8];return _0x3ba966;};'use strict';var emlformat=require(_0xbd4e('0x0'));var rimraf=require(_0xbd4e('0x1'));var zipdir=require(_0xbd4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd4e('0x3'));var moment=require(_0xbd4e('0x4'));var BPromise=require(_0xbd4e('0x5'));var Mustache=require('mustache');var util=require(_0xbd4e('0x6'));var path=require(_0xbd4e('0x7'));var sox=require(_0xbd4e('0x8'));var csv=require(_0xbd4e('0x9'));var ejs=require(_0xbd4e('0xa'));var fs=require('fs');var fs_extra=require(_0xbd4e('0xb'));var _=require(_0xbd4e('0xc'));var squel=require(_0xbd4e('0xd'));var crypto=require(_0xbd4e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbd4e('0xf'));var toCsv=require(_0xbd4e('0x9'));var querystring=require(_0xbd4e('0x10'));var Papa=require(_0xbd4e('0x11'));var Redis=require('ioredis');var authService=require(_0xbd4e('0x12'));var qs=require(_0xbd4e('0x13'));var as=require(_0xbd4e('0x14'));var hardwareService=require(_0xbd4e('0x15'));var logger=require(_0xbd4e('0x16'))(_0xbd4e('0x17'));var utils=require(_0xbd4e('0x18'));var config=require(_0xbd4e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd4e('0x1a'))['db'];function respondWithStatusCode(_0x6db90d,_0x122ef5){_0x122ef5=_0x122ef5||0xcc;return function(_0x545f66){if(_0x545f66){return _0x6db90d['sendStatus'](_0x122ef5);}return _0x6db90d[_0xbd4e('0x1b')](_0x122ef5)[_0xbd4e('0x1c')]();};}function respondWithResult(_0x29338d,_0x1103c2){_0x1103c2=_0x1103c2||0xc8;return function(_0x41886e){if(_0x41886e){return _0x29338d[_0xbd4e('0x1b')](_0x1103c2)[_0xbd4e('0x1d')](_0x41886e);}};}function respondWithFilteredResult(_0x1b089d,_0xc37161){return function(_0x20900f){if(_0x20900f){var _0x3eb95e=typeof _0xc37161[_0xbd4e('0x1e')]==='undefined'&&typeof _0xc37161[_0xbd4e('0x1f')]===_0xbd4e('0x20');var _0x2111aa=_0x20900f[_0xbd4e('0x21')];var _0x1dea6f=_0x3eb95e?0x0:_0xc37161[_0xbd4e('0x1e')];var _0x20def8=_0x3eb95e?_0x20900f['count']:_0xc37161[_0xbd4e('0x1e')]+_0xc37161['limit'];var _0x2d8d18;if(_0x20def8>=_0x2111aa){_0x20def8=_0x2111aa;_0x2d8d18=0xc8;}else{_0x2d8d18=0xce;}_0x1b089d['status'](_0x2d8d18);return _0x1b089d[_0xbd4e('0x22')](_0xbd4e('0x23'),_0x1dea6f+'-'+_0x20def8+'/'+_0x2111aa)[_0xbd4e('0x1d')](_0x20900f);}return null;};}function patchUpdates(_0x25055a){return function(_0x5c36bc){try{jsonpatch[_0xbd4e('0x24')](_0x5c36bc,_0x25055a,!![]);}catch(_0x2c0be2){return BPromise[_0xbd4e('0x25')](_0x2c0be2);}return _0x5c36bc[_0xbd4e('0x26')]();};}function saveUpdates(_0x1a3236,_0xc2522d){return function(_0x3b4e87){if(_0x3b4e87){return _0x3b4e87[_0xbd4e('0x27')](_0x1a3236)[_0xbd4e('0x28')](function(_0xe2726c){return _0xe2726c;});}return null;};}function removeEntity(_0x10bdfd,_0x312abd){return function(_0x41ca9f){if(_0x41ca9f){return _0x41ca9f[_0xbd4e('0x29')]()[_0xbd4e('0x28')](function(){_0x10bdfd[_0xbd4e('0x1b')](0xcc)[_0xbd4e('0x1c')]();});}};}function handleEntityNotFound(_0x36f1ef,_0x580dbc){return function(_0x42aed4){if(!_0x42aed4){_0x36f1ef[_0xbd4e('0x2a')](0x194);}return _0x42aed4;};}function handleError(_0x3fe15a,_0x25ca5f){_0x25ca5f=_0x25ca5f||0x1f4;return function(_0x24a233){logger['error'](_0x24a233[_0xbd4e('0x2b')]);if(_0x24a233[_0xbd4e('0x2c')]){delete _0x24a233['name'];}_0x3fe15a['status'](_0x25ca5f)[_0xbd4e('0x2d')](_0x24a233);};}exports[_0xbd4e('0x2e')]=function(_0xda7d5f,_0x20715d){var _0x371772={},_0x15ff30={},_0x3c43cc={'count':0x0,'rows':[]};var _0x573858=_[_0xbd4e('0x2f')](db[_0xbd4e('0x30')][_0xbd4e('0x31')],function(_0x107e49){return{'name':_0x107e49[_0xbd4e('0x32')],'type':_0x107e49[_0xbd4e('0x33')][_0xbd4e('0x34')]};});_0x15ff30[_0xbd4e('0x35')]=_[_0xbd4e('0x2f')](_0x573858,_0xbd4e('0x2c'));_0x15ff30['query']=_[_0xbd4e('0x36')](_0xda7d5f[_0xbd4e('0x37')]);_0x15ff30[_0xbd4e('0x38')]=_[_0xbd4e('0x39')](_0x15ff30[_0xbd4e('0x35')],_0x15ff30[_0xbd4e('0x37')]);_0x371772[_0xbd4e('0x3a')]=_[_0xbd4e('0x39')](_0x15ff30['model'],qs[_0xbd4e('0x3b')](_0xda7d5f['query']['fields']));_0x371772['attributes']=_0x371772[_0xbd4e('0x3a')][_0xbd4e('0x3c')]?_0x371772['attributes']:_0x15ff30[_0xbd4e('0x35')];if(!_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x3d')](_0xbd4e('0x3e'))){_0x371772[_0xbd4e('0x1f')]=qs[_0xbd4e('0x1f')](_0xda7d5f[_0xbd4e('0x37')]['limit']);_0x371772[_0xbd4e('0x1e')]=qs[_0xbd4e('0x1e')](_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x1e')]);}_0x371772[_0xbd4e('0x3f')]=qs[_0xbd4e('0x40')](_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x40')]);_0x371772['where']=qs[_0xbd4e('0x38')](_[_0xbd4e('0x41')](_0xda7d5f[_0xbd4e('0x37')],_0x15ff30[_0xbd4e('0x38')]),_0x573858);if(_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x42')]){_0x371772[_0xbd4e('0x43')]=_[_0xbd4e('0x44')](_0x371772[_0xbd4e('0x43')],{'$or':_['map'](_0x573858,function(_0xa64c4c){if(_0xa64c4c['type']!==_0xbd4e('0x45')){var _0x27b278={};_0x27b278[_0xa64c4c['name']]={'$like':'%'+_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x42')]+'%'};return _0x27b278;}})});}_0x371772=_[_0xbd4e('0x44')]({},_0x371772,_0xda7d5f[_0xbd4e('0x46')]);var _0x3105e6={'where':_0x371772[_0xbd4e('0x43')]};return db[_0xbd4e('0x30')]['count'](_0x3105e6)['then'](function(_0x5d4947){_0x3c43cc[_0xbd4e('0x21')]=_0x5d4947;if(_0xda7d5f[_0xbd4e('0x37')][_0xbd4e('0x47')]){_0x371772[_0xbd4e('0x48')]=[{'all':!![]}];}return db[_0xbd4e('0x30')][_0xbd4e('0x49')](_0x371772);})['then'](function(_0x4a5371){_0x3c43cc[_0xbd4e('0x4a')]=_0x4a5371;return _0x3c43cc;})['then'](respondWithFilteredResult(_0x20715d,_0x371772))[_0xbd4e('0x4b')](handleError(_0x20715d,null));};exports[_0xbd4e('0x4c')]=function(_0x5d7a39,_0x371a4b){var _0x150d86={'raw':!![],'where':{'id':_0x5d7a39[_0xbd4e('0x4d')]['id']}},_0x18eca4={};_0x18eca4['model']=_['keys'](db['MailTransferReport'][_0xbd4e('0x31')]);_0x18eca4[_0xbd4e('0x37')]=_[_0xbd4e('0x36')](_0x5d7a39[_0xbd4e('0x37')]);_0x18eca4[_0xbd4e('0x38')]=_[_0xbd4e('0x39')](_0x18eca4[_0xbd4e('0x35')],_0x18eca4[_0xbd4e('0x37')]);_0x150d86[_0xbd4e('0x3a')]=_[_0xbd4e('0x39')](_0x18eca4[_0xbd4e('0x35')],qs[_0xbd4e('0x3b')](_0x5d7a39['query'][_0xbd4e('0x3b')]));_0x150d86['attributes']=_0x150d86['attributes']['length']?_0x150d86[_0xbd4e('0x3a')]:_0x18eca4['model'];if(_0x5d7a39[_0xbd4e('0x37')][_0xbd4e('0x47')]){_0x150d86['include']=[{'all':!![]}];}_0x150d86=_[_0xbd4e('0x44')]({},_0x150d86,_0x5d7a39[_0xbd4e('0x46')]);return db[_0xbd4e('0x30')][_0xbd4e('0x4e')](_0x150d86)[_0xbd4e('0x28')](handleEntityNotFound(_0x371a4b,null))[_0xbd4e('0x28')](respondWithResult(_0x371a4b,null))['catch'](handleError(_0x371a4b,null));};exports[_0xbd4e('0x4f')]=function(_0xd064d,_0x4e99f5){return db[_0xbd4e('0x30')]['create'](_0xd064d[_0xbd4e('0x50')],{})[_0xbd4e('0x28')](respondWithResult(_0x4e99f5,0xc9))['catch'](handleError(_0x4e99f5,null));};exports[_0xbd4e('0x27')]=function(_0x4fe0e6,_0x3c28ca){if(_0x4fe0e6[_0xbd4e('0x50')]['id']){delete _0x4fe0e6[_0xbd4e('0x50')]['id'];}return db[_0xbd4e('0x30')][_0xbd4e('0x4e')]({'where':{'id':_0x4fe0e6[_0xbd4e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c28ca,null))[_0xbd4e('0x28')](saveUpdates(_0x4fe0e6[_0xbd4e('0x50')],null))[_0xbd4e('0x28')](respondWithResult(_0x3c28ca,null))[_0xbd4e('0x4b')](handleError(_0x3c28ca,null));};exports[_0xbd4e('0x29')]=function(_0x1dd59d,_0x5c1ab1){return db[_0xbd4e('0x30')][_0xbd4e('0x4e')]({'where':{'id':_0x1dd59d[_0xbd4e('0x4d')]['id']}})[_0xbd4e('0x28')](handleEntityNotFound(_0x5c1ab1,null))[_0xbd4e('0x28')](removeEntity(_0x5c1ab1,null))[_0xbd4e('0x4b')](handleError(_0x5c1ab1,null));};exports['describe']=function(_0x447f56,_0x56bb8f){return db[_0xbd4e('0x30')]['describe']()[_0xbd4e('0x28')](respondWithResult(_0x56bb8f,null))['catch'](handleError(_0x56bb8f,null));}; \ No newline at end of file +var _0x5a52=['../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','MailTransferReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3917fa,_0x4a3d19){var _0x1b64d9=function(_0x27c41e){while(--_0x27c41e){_0x3917fa['push'](_0x3917fa['shift']());}};_0x1b64d9(++_0x4a3d19);}(_0x5a52,0xcb));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x25a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x25a5('0x1'));var rp=require(_0x25a5('0x2'));var moment=require('moment');var BPromise=require(_0x25a5('0x3'));var Mustache=require(_0x25a5('0x4'));var util=require(_0x25a5('0x5'));var path=require(_0x25a5('0x6'));var sox=require(_0x25a5('0x7'));var csv=require(_0x25a5('0x8'));var ejs=require(_0x25a5('0x9'));var fs=require('fs');var fs_extra=require(_0x25a5('0xa'));var _=require(_0x25a5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x25a5('0x8'));var querystring=require(_0x25a5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x25a5('0xe'));var qs=require(_0x25a5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25a5('0x10'));var logger=require(_0x25a5('0x11'))('api');var utils=require(_0x25a5('0x12'));var config=require(_0x25a5('0x13'));var licenseUtil=require(_0x25a5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x476084,_0x21900c){_0x21900c=_0x21900c||0xcc;return function(_0x234378){if(_0x234378){return _0x476084[_0x25a5('0x15')](_0x21900c);}return _0x476084['status'](_0x21900c)['end']();};}function respondWithResult(_0x21d51b,_0x5a29bf){_0x5a29bf=_0x5a29bf||0xc8;return function(_0xa1dbf1){if(_0xa1dbf1){return _0x21d51b[_0x25a5('0x16')](_0x5a29bf)[_0x25a5('0x17')](_0xa1dbf1);}};}function respondWithFilteredResult(_0x147459,_0xd888b4){return function(_0x42c7a7){if(_0x42c7a7){var _0x422c22=typeof _0xd888b4['offset']===_0x25a5('0x18')&&typeof _0xd888b4[_0x25a5('0x19')]===_0x25a5('0x18');var _0x423f08=_0x42c7a7['count'];var _0x446b4c=_0x422c22?0x0:_0xd888b4['offset'];var _0x1424bb=_0x422c22?_0x42c7a7[_0x25a5('0x1a')]:_0xd888b4[_0x25a5('0x1b')]+_0xd888b4[_0x25a5('0x19')];var _0x46b977;if(_0x1424bb>=_0x423f08){_0x1424bb=_0x423f08;_0x46b977=0xc8;}else{_0x46b977=0xce;}_0x147459['status'](_0x46b977);return _0x147459['set']('Content-Range',_0x446b4c+'-'+_0x1424bb+'/'+_0x423f08)['json'](_0x42c7a7);}return null;};}function patchUpdates(_0x1417e4){return function(_0x82ca7b){try{jsonpatch[_0x25a5('0x1c')](_0x82ca7b,_0x1417e4,!![]);}catch(_0x579234){return BPromise[_0x25a5('0x1d')](_0x579234);}return _0x82ca7b[_0x25a5('0x1e')]();};}function saveUpdates(_0x2b1308,_0x4a2193){return function(_0x5e4853){if(_0x5e4853){return _0x5e4853['update'](_0x2b1308)['then'](function(_0x2172f4){return _0x2172f4;});}return null;};}function removeEntity(_0x5c5807,_0x23d5ac){return function(_0x2505ff){if(_0x2505ff){return _0x2505ff[_0x25a5('0x1f')]()[_0x25a5('0x20')](function(){_0x5c5807[_0x25a5('0x16')](0xcc)[_0x25a5('0x21')]();});}};}function handleEntityNotFound(_0x456525,_0x5cce00){return function(_0x3abae7){if(!_0x3abae7){_0x456525[_0x25a5('0x15')](0x194);}return _0x3abae7;};}function handleError(_0x5a1795,_0x25b24c){_0x25b24c=_0x25b24c||0x1f4;return function(_0x55c7a1){logger[_0x25a5('0x22')](_0x55c7a1[_0x25a5('0x23')]);if(_0x55c7a1['name']){delete _0x55c7a1[_0x25a5('0x24')];}_0x5a1795['status'](_0x25b24c)[_0x25a5('0x25')](_0x55c7a1);};}exports[_0x25a5('0x26')]=function(_0x56c4f6,_0x3f4595){var _0x2eec64={},_0x4c1c3d={},_0x349f89={'count':0x0,'rows':[]};var _0x4f420b=_[_0x25a5('0x27')](db['MailTransferReport'][_0x25a5('0x28')],function(_0x8d3b15){return{'name':_0x8d3b15[_0x25a5('0x29')],'type':_0x8d3b15[_0x25a5('0x2a')][_0x25a5('0x2b')]};});_0x4c1c3d[_0x25a5('0x2c')]=_[_0x25a5('0x27')](_0x4f420b,_0x25a5('0x24'));_0x4c1c3d[_0x25a5('0x2d')]=_[_0x25a5('0x2e')](_0x56c4f6[_0x25a5('0x2d')]);_0x4c1c3d[_0x25a5('0x2f')]=_[_0x25a5('0x30')](_0x4c1c3d['model'],_0x4c1c3d[_0x25a5('0x2d')]);_0x2eec64[_0x25a5('0x31')]=_['intersection'](_0x4c1c3d['model'],qs['fields'](_0x56c4f6[_0x25a5('0x2d')][_0x25a5('0x32')]));_0x2eec64['attributes']=_0x2eec64[_0x25a5('0x31')][_0x25a5('0x33')]?_0x2eec64[_0x25a5('0x31')]:_0x4c1c3d[_0x25a5('0x2c')];if(!_0x56c4f6[_0x25a5('0x2d')]['hasOwnProperty'](_0x25a5('0x34'))){_0x2eec64[_0x25a5('0x19')]=qs[_0x25a5('0x19')](_0x56c4f6[_0x25a5('0x2d')]['limit']);_0x2eec64[_0x25a5('0x1b')]=qs[_0x25a5('0x1b')](_0x56c4f6[_0x25a5('0x2d')][_0x25a5('0x1b')]);}_0x2eec64[_0x25a5('0x35')]=qs[_0x25a5('0x36')](_0x56c4f6[_0x25a5('0x2d')]['sort']);_0x2eec64['where']=qs[_0x25a5('0x2f')](_[_0x25a5('0x37')](_0x56c4f6[_0x25a5('0x2d')],_0x4c1c3d[_0x25a5('0x2f')]),_0x4f420b);if(_0x56c4f6[_0x25a5('0x2d')][_0x25a5('0x38')]){_0x2eec64['where']=_['merge'](_0x2eec64[_0x25a5('0x39')],{'$or':_[_0x25a5('0x27')](_0x4f420b,function(_0x1621c6){if(_0x1621c6['type']!==_0x25a5('0x3a')){var _0x25e858={};_0x25e858[_0x1621c6[_0x25a5('0x24')]]={'$like':'%'+_0x56c4f6['query'][_0x25a5('0x38')]+'%'};return _0x25e858;}})});}_0x2eec64=_[_0x25a5('0x3b')]({},_0x2eec64,_0x56c4f6[_0x25a5('0x3c')]);var _0x40eba7={'where':_0x2eec64[_0x25a5('0x39')]};return db[_0x25a5('0x3d')][_0x25a5('0x1a')](_0x40eba7)[_0x25a5('0x20')](function(_0x2e33e2){_0x349f89['count']=_0x2e33e2;if(_0x56c4f6[_0x25a5('0x2d')][_0x25a5('0x3e')]){_0x2eec64[_0x25a5('0x3f')]=[{'all':!![]}];}return db[_0x25a5('0x3d')][_0x25a5('0x40')](_0x2eec64);})[_0x25a5('0x20')](function(_0x30b6f5){_0x349f89[_0x25a5('0x41')]=_0x30b6f5;return _0x349f89;})[_0x25a5('0x20')](respondWithFilteredResult(_0x3f4595,_0x2eec64))['catch'](handleError(_0x3f4595,null));};exports[_0x25a5('0x42')]=function(_0xd819fb,_0x122673){var _0x40d1be={'raw':!![],'where':{'id':_0xd819fb[_0x25a5('0x43')]['id']}},_0x48c473={};_0x48c473[_0x25a5('0x2c')]=_[_0x25a5('0x2e')](db[_0x25a5('0x3d')][_0x25a5('0x28')]);_0x48c473[_0x25a5('0x2d')]=_[_0x25a5('0x2e')](_0xd819fb[_0x25a5('0x2d')]);_0x48c473[_0x25a5('0x2f')]=_['intersection'](_0x48c473[_0x25a5('0x2c')],_0x48c473[_0x25a5('0x2d')]);_0x40d1be[_0x25a5('0x31')]=_[_0x25a5('0x30')](_0x48c473[_0x25a5('0x2c')],qs[_0x25a5('0x32')](_0xd819fb[_0x25a5('0x2d')][_0x25a5('0x32')]));_0x40d1be['attributes']=_0x40d1be['attributes'][_0x25a5('0x33')]?_0x40d1be['attributes']:_0x48c473[_0x25a5('0x2c')];if(_0xd819fb[_0x25a5('0x2d')][_0x25a5('0x3e')]){_0x40d1be[_0x25a5('0x3f')]=[{'all':!![]}];}_0x40d1be=_[_0x25a5('0x3b')]({},_0x40d1be,_0xd819fb[_0x25a5('0x3c')]);return db[_0x25a5('0x3d')][_0x25a5('0x44')](_0x40d1be)[_0x25a5('0x20')](handleEntityNotFound(_0x122673,null))[_0x25a5('0x20')](respondWithResult(_0x122673,null))[_0x25a5('0x45')](handleError(_0x122673,null));};exports[_0x25a5('0x46')]=function(_0x104b7b,_0x50cc22){return db[_0x25a5('0x3d')][_0x25a5('0x46')](_0x104b7b[_0x25a5('0x47')],{})[_0x25a5('0x20')](respondWithResult(_0x50cc22,0xc9))[_0x25a5('0x45')](handleError(_0x50cc22,null));};exports[_0x25a5('0x48')]=function(_0x3faee1,_0x12217e){if(_0x3faee1[_0x25a5('0x47')]['id']){delete _0x3faee1['body']['id'];}return db[_0x25a5('0x3d')][_0x25a5('0x44')]({'where':{'id':_0x3faee1[_0x25a5('0x43')]['id']}})[_0x25a5('0x20')](handleEntityNotFound(_0x12217e,null))[_0x25a5('0x20')](saveUpdates(_0x3faee1[_0x25a5('0x47')],null))['then'](respondWithResult(_0x12217e,null))[_0x25a5('0x45')](handleError(_0x12217e,null));};exports[_0x25a5('0x1f')]=function(_0x22bf73,_0x1e0b61){return db[_0x25a5('0x3d')]['find']({'where':{'id':_0x22bf73[_0x25a5('0x43')]['id']}})[_0x25a5('0x20')](handleEntityNotFound(_0x1e0b61,null))[_0x25a5('0x20')](removeEntity(_0x1e0b61,null))[_0x25a5('0x45')](handleError(_0x1e0b61,null));};exports['describe']=function(_0x509fc3,_0x1d6b80){return db['MailTransferReport'][_0x25a5('0x49')]()['then'](respondWithResult(_0x1d6b80,null))['catch'](handleError(_0x1d6b80,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index aecaa68..24ce4f2 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 _0xc57c=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x41679e,_0x56e202){var _0x2668d0=function(_0x1d0709){while(--_0x1d0709){_0x41679e['push'](_0x41679e['shift']());}};_0x2668d0(++_0x56e202);}(_0xc57c,0x9f));var _0xcc57=function(_0xc76cef,_0x194abb){_0xc76cef=_0xc76cef-0x0;var _0x515c04=_0xc57c[_0xc76cef];return _0x515c04;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var logger=require(_0xcc57('0x1'))(_0xcc57('0x2'));var moment=require(_0xcc57('0x3'));var BPromise=require(_0xcc57('0x4'));var rp=require(_0xcc57('0x5'));var fs=require('fs');var path=require(_0xcc57('0x6'));var rimraf=require(_0xcc57('0x7'));var config=require(_0xcc57('0x8'));var attributes=require(_0xcc57('0x9'));module['exports']=function(_0x1d77dd,_0x243766){return _0x1d77dd['define'](_0xcc57('0xa'),attributes,{'tableName':_0xcc57('0xb'),'paranoid':![],'indexes':[{'name':_0xcc57('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8734=['api','moment','bluebird','path','../../config/environment','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash','../../config/logger'];(function(_0x218091,_0x2bdbe5){var _0x105aa1=function(_0x4ce6e1){while(--_0x4ce6e1){_0x218091['push'](_0x218091['shift']());}};_0x105aa1(++_0x2bdbe5);}(_0x8734,0x134));var _0x4873=function(_0x12916b,_0x3ba82d){_0x12916b=_0x12916b-0x0;var _0x58d533=_0x8734[_0x12916b];return _0x58d533;};'use strict';var _=require(_0x4873('0x0'));var util=require('util');var logger=require(_0x4873('0x1'))(_0x4873('0x2'));var moment=require(_0x4873('0x3'));var BPromise=require(_0x4873('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4873('0x5'));var rimraf=require('rimraf');var config=require(_0x4873('0x6'));var attributes=require(_0x4873('0x7'));module['exports']=function(_0xb44024,_0x4b5d88){return _0xb44024['define']('MailTransferReport',attributes,{'tableName':_0x4873('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4873('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 5a81800..6cf4bae 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 _0x4193=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3779eb,_0xc19002){var _0x50423a=function(_0x16e841){while(--_0x16e841){_0x3779eb['push'](_0x3779eb['shift']());}};_0x50423a(++_0xc19002);}(_0x4193,0x17b));var _0x3419=function(_0x501081,_0x4e3e26){_0x501081=_0x501081-0x0;var _0x58af6e=_0x4193[_0x501081];return _0x58af6e;};'use strict';var _=require(_0x3419('0x0'));var util=require('util');var moment=require(_0x3419('0x1'));var BPromise=require(_0x3419('0x2'));var rs=require(_0x3419('0x3'));var fs=require('fs');var Redis=require(_0x3419('0x4'));var db=require(_0x3419('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3419('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3419('0x7'));var client=jayson['client'][_0x3419('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19ea09,_0x13caa9,_0x164149){return new BPromise(function(_0x5e702d,_0x1450ef){return client[_0x3419('0x9')](_0x19ea09,_0x164149)[_0x3419('0xa')](function(_0x308a84){logger[_0x3419('0xb')](_0x3419('0xc'),_0x13caa9,_0x3419('0xd'));logger['debug'](_0x3419('0xe'),_0x13caa9,_0x3419('0xd'),JSON[_0x3419('0xf')](_0x308a84));if(_0x308a84[_0x3419('0x10')]){if(_0x308a84[_0x3419('0x10')][_0x3419('0x11')]===0x1f4){logger[_0x3419('0x10')](_0x3419('0xc'),_0x13caa9,_0x308a84[_0x3419('0x10')]['message']);return _0x1450ef(_0x308a84[_0x3419('0x10')][_0x3419('0x12')]);}logger[_0x3419('0x10')](_0x3419('0xc'),_0x13caa9,_0x308a84[_0x3419('0x10')][_0x3419('0x12')]);return _0x5e702d(_0x308a84['error'][_0x3419('0x12')]);}else{logger[_0x3419('0xb')](_0x3419('0xc'),_0x13caa9,_0x3419('0xd'));_0x5e702d(_0x308a84[_0x3419('0x13')][_0x3419('0x12')]);}})['catch'](function(_0x5be1f){logger[_0x3419('0x10')](_0x3419('0xc'),_0x13caa9,_0x5be1f);_0x1450ef(_0x5be1f);});});} \ No newline at end of file +var _0x8f0f=['result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8f0f,0x167));var _0xf8f0=function(_0xd9ff6,_0x4efb51){_0xd9ff6=_0xd9ff6-0x0;var _0x51a250=_0x8f0f[_0xd9ff6];return _0x51a250;};'use strict';var _=require('lodash');var util=require(_0xf8f0('0x0'));var moment=require(_0xf8f0('0x1'));var BPromise=require('bluebird');var rs=require(_0xf8f0('0x2'));var fs=require('fs');var Redis=require(_0xf8f0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8f0('0x4'));var logger=require(_0xf8f0('0x5'))(_0xf8f0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf8f0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26397d,_0xe5b768,_0x46dae6){return new BPromise(function(_0x305c09,_0xbc23be){return client[_0xf8f0('0x8')](_0x26397d,_0x46dae6)[_0xf8f0('0x9')](function(_0x110bf2){logger[_0xf8f0('0xa')](_0xf8f0('0xb'),_0xe5b768,_0xf8f0('0xc'));logger[_0xf8f0('0xd')](_0xf8f0('0xe'),_0xe5b768,'request\x20sent',JSON[_0xf8f0('0xf')](_0x110bf2));if(_0x110bf2['error']){if(_0x110bf2[_0xf8f0('0x10')][_0xf8f0('0x11')]===0x1f4){logger[_0xf8f0('0x10')](_0xf8f0('0xb'),_0xe5b768,_0x110bf2['error'][_0xf8f0('0x12')]);return _0xbc23be(_0x110bf2[_0xf8f0('0x10')][_0xf8f0('0x12')]);}logger[_0xf8f0('0x10')](_0xf8f0('0xb'),_0xe5b768,_0x110bf2[_0xf8f0('0x10')][_0xf8f0('0x12')]);return _0x305c09(_0x110bf2[_0xf8f0('0x10')][_0xf8f0('0x12')]);}else{logger[_0xf8f0('0xa')]('MailTransferReport,\x20%s,\x20%s',_0xe5b768,_0xf8f0('0xc'));_0x305c09(_0x110bf2[_0xf8f0('0x13')][_0xf8f0('0x12')]);}})[_0xf8f0('0x14')](function(_0x3a9385){logger[_0xf8f0('0x10')](_0xf8f0('0xb'),_0xe5b768,_0x3a9385);_0xbc23be(_0x3a9385);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 39c58ac..3d7a81b 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 _0x70b5=['/describe','describe','show','create','put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70b5,0xf1));var _0x570b=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x70b5[_0x4521e3];return _0x46a272;};'use strict';var multer=require('multer');var util=require(_0x570b('0x0'));var path=require(_0x570b('0x1'));var timeout=require('connect-timeout');var express=require(_0x570b('0x2'));var router=express[_0x570b('0x3')]();var fs_extra=require(_0x570b('0x4'));var auth=require(_0x570b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x570b('0x6'));var controller=require(_0x570b('0x7'));router[_0x570b('0x8')]('/',auth[_0x570b('0x9')](),controller[_0x570b('0xa')]);router[_0x570b('0x8')](_0x570b('0xb'),auth[_0x570b('0x9')](),controller[_0x570b('0xc')]);router[_0x570b('0x8')]('/:id',auth[_0x570b('0x9')](),controller[_0x570b('0xd')]);router['post']('/',auth[_0x570b('0x9')](),controller[_0x570b('0xe')]);router[_0x570b('0xf')]('/:id',auth[_0x570b('0x9')](),controller['update']);router[_0x570b('0x10')]('/:id',auth[_0x570b('0x9')](),controller['destroy']);module[_0x570b('0x11')]=router; \ No newline at end of file +var _0xb17c=['../../config/environment','get','index','/describe','describe','isAuthenticated','show','post','put','/:id','delete','exports','util','path','express','Router','fs-extra'];(function(_0x416622,_0x51873e){var _0x124877=function(_0x3645f8){while(--_0x3645f8){_0x416622['push'](_0x416622['shift']());}};_0x124877(++_0x51873e);}(_0xb17c,0xd8));var _0xcb17=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb17c[_0x1cb18a];return _0x22442e;};'use strict';var multer=require('multer');var util=require(_0xcb17('0x0'));var path=require(_0xcb17('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb17('0x2'));var router=express[_0xcb17('0x3')]();var fs_extra=require(_0xcb17('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcb17('0x5'));var controller=require('./memberReport.controller');router[_0xcb17('0x6')]('/',auth['isAuthenticated'](),controller[_0xcb17('0x7')]);router[_0xcb17('0x6')](_0xcb17('0x8'),auth['isAuthenticated'](),controller[_0xcb17('0x9')]);router['get']('/:id',auth[_0xcb17('0xa')](),controller[_0xcb17('0xb')]);router[_0xcb17('0xc')]('/',auth[_0xcb17('0xa')](),controller['create']);router[_0xcb17('0xd')](_0xcb17('0xe'),auth[_0xcb17('0xa')](),controller['update']);router[_0xcb17('0xf')]('/:id',auth[_0xcb17('0xa')](),controller['destroy']);module[_0xcb17('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 545db81..316affe 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 _0xc1bf=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x12729b,_0x55dd9f){var _0x44eb1f=function(_0x5fe157){while(--_0x5fe157){_0x12729b['push'](_0x12729b['shift']());}};_0x44eb1f(++_0x55dd9f);}(_0xc1bf,0xdb));var _0xfc1b=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xc1bf[_0x209fcd];return _0x501d5e;};'use strict';var Sequelize=require(_0xfc1b('0x0'));var moment=require(_0xfc1b('0x1'));module[_0xfc1b('0x2')]={'channel':{'type':Sequelize[_0xfc1b('0x3')]},'membername':{'type':Sequelize[_0xfc1b('0x3')]},'interface':{'type':Sequelize[_0xfc1b('0x3')]},'type':{'type':Sequelize[_0xfc1b('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xfc1b('0x4')},'duration':{'type':Sequelize[_0xfc1b('0x5')]},'enterAt':{'type':Sequelize[_0xfc1b('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4d8773){var _0x273502=moment(_0x4d8773);var _0x444462=moment(this[_0xfc1b('0x7')](_0xfc1b('0x8')));var _0x975921=_0x273502[_0xfc1b('0x9')](_0x444462,_0xfc1b('0xa'));this[_0xfc1b('0xb')](_0xfc1b('0xc'),_0x4d8773);this[_0xfc1b('0xb')](_0xfc1b('0xd'),_0x975921>=0x0?_0x975921:null);}},'data1':{'type':Sequelize[_0xfc1b('0x3')],'comment':_0xfc1b('0xe')},'data2':{'type':Sequelize[_0xfc1b('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xfc1b('0xf')},'data4':{'type':Sequelize[_0xfc1b('0x3')],'comment':_0xfc1b('0x10')},'data5':{'type':Sequelize[_0xfc1b('0x3')],'comment':_0xfc1b('0x11')},'role':{'type':Sequelize[_0xfc1b('0x3')]},'internal':{'type':Sequelize[_0xfc1b('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x846f=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING'];(function(_0x190b95,_0xfbfcc9){var _0x4d5c92=function(_0x3a00ea){while(--_0x3a00ea){_0x190b95['push'](_0x190b95['shift']());}};_0x4d5c92(++_0xfbfcc9);}(_0x846f,0x93));var _0xf846=function(_0x73de4b,_0x44365d){_0x73de4b=_0x73de4b-0x0;var _0x2bf03c=_0x846f[_0x73de4b];return _0x2bf03c;};'use strict';var Sequelize=require(_0xf846('0x0'));var moment=require('moment');module[_0xf846('0x1')]={'channel':{'type':Sequelize[_0xf846('0x2')]},'membername':{'type':Sequelize[_0xf846('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf846('0x2')],'defaultValue':_0xf846('0x3'),'comment':_0xf846('0x4')},'duration':{'type':Sequelize[_0xf846('0x5')]},'enterAt':{'type':Sequelize[_0xf846('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x168f79){var _0x1ff3e4=moment(_0x168f79);var _0xb8f529=moment(this[_0xf846('0x7')](_0xf846('0x8')));var _0x56317e=_0x1ff3e4['diff'](_0xb8f529,_0xf846('0x9'));this[_0xf846('0xa')]('exitAt',_0x168f79);this['setDataValue']('duration',_0x56317e>=0x0?_0x56317e:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xf846('0xb')},'data2':{'type':Sequelize[_0xf846('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xf846('0x2')],'comment':_0xf846('0xc')},'data4':{'type':Sequelize[_0xf846('0x2')],'comment':_0xf846('0xd')},'data5':{'type':Sequelize[_0xf846('0x2')],'comment':_0xf846('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf846('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index dffe983..01cce85 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x3315a7,_0x51d249){var _0x3eeb28=function(_0x5ef230){while(--_0x5ef230){_0x3315a7['push'](_0x3315a7['shift']());}};_0x3eeb28(++_0x51d249);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xedd9,0xfc));var _0x9edd=function(_0x4eed04,_0x310fe4){_0x4eed04=_0x4eed04-0x0;var _0x473c4f=_0xedd9[_0x4eed04];return _0x473c4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index cb30e67..3b7944d 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 _0x21ff=['report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x21ff,0x8c));var _0xf21f=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x21ff[_0x3f6565];return _0x4abd23;};'use strict';var _=require(_0xf21f('0x0'));var util=require(_0xf21f('0x1'));var logger=require(_0xf21f('0x2'))(_0xf21f('0x3'));var moment=require(_0xf21f('0x4'));var BPromise=require(_0xf21f('0x5'));var rp=require(_0xf21f('0x6'));var fs=require('fs');var path=require(_0xf21f('0x7'));var rimraf=require(_0xf21f('0x8'));var config=require(_0xf21f('0x9'));var attributes=require(_0xf21f('0xa'));module[_0xf21f('0xb')]=function(_0x272269,_0x3a2956){return _0x272269['define'](_0xf21f('0xc'),attributes,{'tableName':_0xf21f('0xd'),'paranoid':![],'indexes':[{'name':_0xf21f('0xe'),'fields':[_0xf21f('0xf'),_0xf21f('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa55=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','membername_interface','interface'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa55,0x9c));var _0x5aa5=function(_0x33251b,_0x47e427){_0x33251b=_0x33251b-0x0;var _0x139252=_0xaa55[_0x33251b];return _0x139252;};'use strict';var _=require(_0x5aa5('0x0'));var util=require(_0x5aa5('0x1'));var logger=require(_0x5aa5('0x2'))('api');var moment=require(_0x5aa5('0x3'));var BPromise=require(_0x5aa5('0x4'));var rp=require(_0x5aa5('0x5'));var fs=require('fs');var path=require(_0x5aa5('0x6'));var rimraf=require('rimraf');var config=require(_0x5aa5('0x7'));var attributes=require(_0x5aa5('0x8'));module[_0x5aa5('0x9')]=function(_0x3055ca,_0x4a03b9){return _0x3055ca[_0x5aa5('0xa')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x5aa5('0xb'),'fields':['membername',_0x5aa5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 08071af..f4a42db 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 _0x5031=['options','attributes','limit','include','map','model','CreateMemberReport','raw','update','body','where','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5031,0x144));var _0x1503=function(_0x52786f,_0x24fa18){_0x52786f=_0x52786f-0x0;var _0x517f5a=_0x5031[_0x52786f];return _0x517f5a;};'use strict';var _=require(_0x1503('0x0'));var util=require(_0x1503('0x1'));var moment=require(_0x1503('0x2'));var BPromise=require(_0x1503('0x3'));var rs=require(_0x1503('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1503('0x5'));var logger=require(_0x1503('0x6'))(_0x1503('0x7'));var config=require(_0x1503('0x8'));var jayson=require(_0x1503('0x9'));var client=jayson[_0x1503('0xa')][_0x1503('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114bec,_0x2db96e,_0x4c93e7){return new BPromise(function(_0x2007d0,_0x2dddb6){return client['request'](_0x114bec,_0x4c93e7)[_0x1503('0xc')](function(_0x466900){logger[_0x1503('0xd')](_0x1503('0xe'),_0x2db96e,_0x1503('0xf'));logger[_0x1503('0x10')](_0x1503('0x11'),_0x2db96e,_0x1503('0xf'),JSON[_0x1503('0x12')](_0x466900));if(_0x466900[_0x1503('0x13')]){if(_0x466900['error'][_0x1503('0x14')]===0x1f4){logger[_0x1503('0x13')](_0x1503('0xe'),_0x2db96e,_0x466900[_0x1503('0x13')][_0x1503('0x15')]);return _0x2dddb6(_0x466900['error'][_0x1503('0x15')]);}logger[_0x1503('0x13')](_0x1503('0xe'),_0x2db96e,_0x466900[_0x1503('0x13')][_0x1503('0x15')]);return _0x2007d0(_0x466900[_0x1503('0x13')][_0x1503('0x15')]);}else{logger[_0x1503('0xd')](_0x1503('0xe'),_0x2db96e,_0x1503('0xf'));_0x2007d0(_0x466900[_0x1503('0x16')][_0x1503('0x15')]);}})[_0x1503('0x17')](function(_0x33dae9){logger[_0x1503('0x13')](_0x1503('0xe'),_0x2db96e,_0x33dae9);_0x2dddb6(_0x33dae9);});});}exports[_0x1503('0x18')]=function(_0x3dc3c5){var _0x401b1b=this;return new Promise(function(_0x4c7390,_0x3f8c15){return db[_0x1503('0x19')][_0x1503('0x1a')]({'raw':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5[_0x1503('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3dc3c5['options']?_0x3dc3c5['options']['where']||null:null,'attributes':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5[_0x1503('0x1b')][_0x1503('0x1c')]||null:null,'limit':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5['options'][_0x1503('0x1d')]||null:null,'include':_0x3dc3c5[_0x1503('0x1b')]?_0x3dc3c5[_0x1503('0x1b')][_0x1503('0x1e')]?_[_0x1503('0x1f')](_0x3dc3c5[_0x1503('0x1b')][_0x1503('0x1e')],function(_0xde9620){return{'model':db[_0xde9620[_0x1503('0x20')]],'as':_0xde9620['as'],'attributes':_0xde9620['attributes'],'include':_0xde9620[_0x1503('0x1e')]?_['map'](_0xde9620[_0x1503('0x1e')],function(_0x2e8ee1){return{'model':db[_0x2e8ee1[_0x1503('0x20')]],'as':_0x2e8ee1['as'],'attributes':_0x2e8ee1[_0x1503('0x1c')],'include':_0x2e8ee1['include']?_[_0x1503('0x1f')](_0x2e8ee1[_0x1503('0x1e')],function(_0x1116b0){return{'model':db[_0x1116b0[_0x1503('0x20')]],'as':_0x1116b0['as'],'attributes':_0x1116b0[_0x1503('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1503('0xc')](function(_0x4cab3a){logger[_0x1503('0xd')](_0x1503('0x18'),_0x3dc3c5);logger[_0x1503('0x10')](_0x1503('0x18'),_0x3dc3c5,JSON[_0x1503('0x12')](_0x4cab3a));_0x4c7390(_0x4cab3a);})[_0x1503('0x17')](function(_0x3e7b2b){logger[_0x1503('0x13')](_0x1503('0x18'),_0x3e7b2b[_0x1503('0x15')],_0x3dc3c5);_0x3f8c15(_0x401b1b['error'](0x1f4,_0x3e7b2b[_0x1503('0x15')]));});});};exports[_0x1503('0x21')]=function(_0x131c4f){var _0x53acd7=this;return new Promise(function(_0x58b2fc,_0x52ecd2){return db[_0x1503('0x19')]['create'](_0x131c4f['body'],{'raw':_0x131c4f[_0x1503('0x1b')]?_0x131c4f[_0x1503('0x1b')][_0x1503('0x22')]===undefined?!![]:![]:!![]})[_0x1503('0xc')](function(_0x5d170e){logger[_0x1503('0xd')]('CreateMemberReport',_0x131c4f);logger[_0x1503('0x10')](_0x1503('0x21'),_0x131c4f,JSON[_0x1503('0x12')](_0x5d170e));_0x58b2fc(_0x5d170e);})[_0x1503('0x17')](function(_0x4d87a7){logger[_0x1503('0x13')](_0x1503('0x21'),_0x4d87a7['message'],_0x131c4f);_0x52ecd2(_0x53acd7[_0x1503('0x13')](0x1f4,_0x4d87a7[_0x1503('0x15')]));});});};exports['UpdateMemberReport']=function(_0x201b5b){var _0x2d9beb=this;return new Promise(function(_0x2989b3,_0x204ec4){return db['MemberReport'][_0x1503('0x23')](_0x201b5b[_0x1503('0x24')],{'raw':_0x201b5b[_0x1503('0x1b')]?_0x201b5b[_0x1503('0x1b')][_0x1503('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x201b5b['options']?_0x201b5b[_0x1503('0x1b')][_0x1503('0x25')]||null:null,'attributes':_0x201b5b['options']?_0x201b5b[_0x1503('0x1b')][_0x1503('0x1c')]||null:null,'limit':_0x201b5b[_0x1503('0x1b')]?_0x201b5b[_0x1503('0x1b')]['limit']||null:null})['then'](function(_0x1e4fc6){logger[_0x1503('0xd')](_0x1503('0x26'),_0x201b5b);logger[_0x1503('0x10')](_0x1503('0x26'),_0x201b5b,JSON[_0x1503('0x12')](_0x1e4fc6));_0x2989b3(_0x1e4fc6);})[_0x1503('0x17')](function(_0xbf77a5){logger[_0x1503('0x13')](_0x1503('0x26'),_0xbf77a5[_0x1503('0x15')],_0x201b5b);_0x204ec4(_0x2d9beb[_0x1503('0x13')](0x1f4,_0xbf77a5[_0x1503('0x15')]));});});}; \ No newline at end of file +var _0x0b3d=['result','GetMemberReport','MemberReport','options','raw','where','attributes','limit','map','include','model','then','CreateMemberReport','create','body','catch','UpdateMemberReport','update','debug','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0b3d,0x76));var _0xd0b3=function(_0x3d131a,_0x2ee691){_0x3d131a=_0x3d131a-0x0;var _0x44c22d=_0x0b3d[_0x3d131a];return _0x44c22d;};'use strict';var _=require(_0xd0b3('0x0'));var util=require('util');var moment=require(_0xd0b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0b3('0x4'))('rpc');var config=require(_0xd0b3('0x5'));var jayson=require(_0xd0b3('0x6'));var client=jayson['client'][_0xd0b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bc883,_0x872957,_0x5f3196){return new BPromise(function(_0x5ab5b2,_0x2f79f7){return client['request'](_0x5bc883,_0x5f3196)['then'](function(_0x7b8b92){logger['info'](_0xd0b3('0x8'),_0x872957,_0xd0b3('0x9'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x872957,_0xd0b3('0x9'),JSON[_0xd0b3('0xa')](_0x7b8b92));if(_0x7b8b92[_0xd0b3('0xb')]){if(_0x7b8b92[_0xd0b3('0xb')]['code']===0x1f4){logger['error'](_0xd0b3('0x8'),_0x872957,_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);return _0x2f79f7(_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);}logger[_0xd0b3('0xb')](_0xd0b3('0x8'),_0x872957,_0x7b8b92['error'][_0xd0b3('0xc')]);return _0x5ab5b2(_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);}else{logger[_0xd0b3('0xd')]('MemberReport,\x20%s,\x20%s',_0x872957,_0xd0b3('0x9'));_0x5ab5b2(_0x7b8b92[_0xd0b3('0xe')][_0xd0b3('0xc')]);}})['catch'](function(_0x537e76){logger[_0xd0b3('0xb')]('MemberReport,\x20%s,\x20%s',_0x872957,_0x537e76);_0x2f79f7(_0x537e76);});});}exports[_0xd0b3('0xf')]=function(_0x232e6a){var _0x5045b4=this;return new Promise(function(_0x4ed917,_0x3fc7be){return db[_0xd0b3('0x10')]['findAll']({'raw':_0x232e6a[_0xd0b3('0x11')]?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x12')]===undefined?!![]:![]:!![],'where':_0x232e6a['options']?_0x232e6a['options'][_0xd0b3('0x13')]||null:null,'attributes':_0x232e6a['options']?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x14')]||null:null,'limit':_0x232e6a[_0xd0b3('0x11')]?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x15')]||null:null,'include':_0x232e6a['options']?_0x232e6a['options']['include']?_[_0xd0b3('0x16')](_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x17')],function(_0x1bfe7b){return{'model':db[_0x1bfe7b[_0xd0b3('0x18')]],'as':_0x1bfe7b['as'],'attributes':_0x1bfe7b['attributes'],'include':_0x1bfe7b[_0xd0b3('0x17')]?_[_0xd0b3('0x16')](_0x1bfe7b[_0xd0b3('0x17')],function(_0x2e0dcc){return{'model':db[_0x2e0dcc['model']],'as':_0x2e0dcc['as'],'attributes':_0x2e0dcc[_0xd0b3('0x14')],'include':_0x2e0dcc[_0xd0b3('0x17')]?_[_0xd0b3('0x16')](_0x2e0dcc['include'],function(_0x48fb43){return{'model':db[_0x48fb43[_0xd0b3('0x18')]],'as':_0x48fb43['as'],'attributes':_0x48fb43[_0xd0b3('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd0b3('0x19')](function(_0x4d42b4){logger[_0xd0b3('0xd')](_0xd0b3('0xf'),_0x232e6a);logger['debug'](_0xd0b3('0xf'),_0x232e6a,JSON[_0xd0b3('0xa')](_0x4d42b4));_0x4ed917(_0x4d42b4);})['catch'](function(_0x2b2d05){logger['error'](_0xd0b3('0xf'),_0x2b2d05['message'],_0x232e6a);_0x3fc7be(_0x5045b4[_0xd0b3('0xb')](0x1f4,_0x2b2d05[_0xd0b3('0xc')]));});});};exports[_0xd0b3('0x1a')]=function(_0x366931){var _0x23609e=this;return new Promise(function(_0x2f79cd,_0x44e5ad){return db['MemberReport'][_0xd0b3('0x1b')](_0x366931[_0xd0b3('0x1c')],{'raw':_0x366931[_0xd0b3('0x11')]?_0x366931[_0xd0b3('0x11')]['raw']===undefined?!![]:![]:!![]})[_0xd0b3('0x19')](function(_0x246bee){logger[_0xd0b3('0xd')](_0xd0b3('0x1a'),_0x366931);logger['debug'](_0xd0b3('0x1a'),_0x366931,JSON[_0xd0b3('0xa')](_0x246bee));_0x2f79cd(_0x246bee);})[_0xd0b3('0x1d')](function(_0x2f2e00){logger[_0xd0b3('0xb')](_0xd0b3('0x1a'),_0x2f2e00[_0xd0b3('0xc')],_0x366931);_0x44e5ad(_0x23609e[_0xd0b3('0xb')](0x1f4,_0x2f2e00[_0xd0b3('0xc')]));});});};exports[_0xd0b3('0x1e')]=function(_0x22de39){var _0xa53787=this;return new Promise(function(_0x1926ca,_0x1f587f){return db['MemberReport'][_0xd0b3('0x1f')](_0x22de39[_0xd0b3('0x1c')],{'raw':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22de39['options']?_0x22de39['options'][_0xd0b3('0x13')]||null:null,'attributes':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')][_0xd0b3('0x14')]||null:null,'limit':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')]['limit']||null:null})[_0xd0b3('0x19')](function(_0x4504e5){logger[_0xd0b3('0xd')](_0xd0b3('0x1e'),_0x22de39);logger[_0xd0b3('0x20')](_0xd0b3('0x1e'),_0x22de39,JSON[_0xd0b3('0xa')](_0x4504e5));_0x1926ca(_0x4504e5);})[_0xd0b3('0x1d')](function(_0x3be7ee){logger[_0xd0b3('0xb')](_0xd0b3('0x1e'),_0x3be7ee['message'],_0x22de39);_0x1f587f(_0xa53787['error'](0x1f4,_0x3be7ee[_0xd0b3('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5ac930b..234e0cf 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 _0x3657=['express','Router','../../config/environment','./migration.controller','get','index','exports','util','path'];(function(_0x1cc855,_0x4ed46a){var _0x7f3f44=function(_0x2a95e6){while(--_0x2a95e6){_0x1cc855['push'](_0x1cc855['shift']());}};_0x7f3f44(++_0x4ed46a);}(_0x3657,0xcd));var _0x7365=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x3657[_0x5f3905];return _0x2923b1;};'use strict';var multer=require('multer');var util=require(_0x7365('0x0'));var path=require(_0x7365('0x1'));var timeout=require('connect-timeout');var express=require(_0x7365('0x2'));var router=express[_0x7365('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7365('0x4'));var controller=require(_0x7365('0x5'));router[_0x7365('0x6')]('/',controller[_0x7365('0x7')]);module[_0x7365('0x8')]=router; \ No newline at end of file +var _0xfe6a=['./migration.controller','get','index','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe6a,0x16c));var _0xafe6=function(_0xb529e1,_0x1da53f){_0xb529e1=_0xb529e1-0x0;var _0x3e9a4=_0xfe6a[_0xb529e1];return _0x3e9a4;};'use strict';var multer=require(_0xafe6('0x0'));var util=require(_0xafe6('0x1'));var path=require(_0xafe6('0x2'));var timeout=require('connect-timeout');var express=require(_0xafe6('0x3'));var router=express[_0xafe6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xafe6('0x5'));var interaction=require(_0xafe6('0x6'));var config=require(_0xafe6('0x7'));var controller=require(_0xafe6('0x8'));router[_0xafe6('0x9')]('/',controller[_0xafe6('0xa')]);module[_0xafe6('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3b7bac1..ed31fae 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 _0xb07b=['STRING','version','sequelize','exports'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0xb07b,0x96));var _0xbb07=function(_0x3d0293,_0x3d3c80){_0x3d0293=_0x3d0293-0x0;var _0x5aa8d3=_0xb07b[_0x3d0293];return _0x5aa8d3;};'use strict';var Sequelize=require(_0xbb07('0x0'));module[_0xbb07('0x1')]={'version':{'type':Sequelize[_0xbb07('0x2')],'unique':_0xbb07('0x3')}}; \ No newline at end of file +var _0xcb91=['sequelize','exports','version'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcb91,0x1a7));var _0x1cb9=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0xcb91[_0x258919];return _0xfbd68b;};'use strict';var Sequelize=require(_0x1cb9('0x0'));module[_0x1cb9('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x1cb9('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c7abfe5..3e3d21c 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 _0x74d8=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Migration','include','findAll','catch','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x74d8,0xd8));var _0x874d=function(_0x2dbf10,_0xdaa708){_0x2dbf10=_0x2dbf10-0x0;var _0x2d7bd2=_0x74d8[_0x2dbf10];return _0x2d7bd2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x874d('0x0'));var jsonpatch=require(_0x874d('0x1'));var rp=require(_0x874d('0x2'));var moment=require('moment');var BPromise=require(_0x874d('0x3'));var Mustache=require(_0x874d('0x4'));var util=require('util');var path=require(_0x874d('0x5'));var sox=require(_0x874d('0x6'));var csv=require(_0x874d('0x7'));var ejs=require(_0x874d('0x8'));var fs=require('fs');var fs_extra=require(_0x874d('0x9'));var _=require(_0x874d('0xa'));var squel=require('squel');var crypto=require(_0x874d('0xb'));var jsforce=require(_0x874d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x874d('0xd'));var Papa=require('papaparse');var Redis=require(_0x874d('0xe'));var authService=require(_0x874d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x874d('0x10'));var hardwareService=require(_0x874d('0x11'));var logger=require(_0x874d('0x12'))(_0x874d('0x13'));var utils=require('../../config/utils');var config=require(_0x874d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x874d('0x15'))['db'];function respondWithStatusCode(_0x124ca3,_0xb0b12a){_0xb0b12a=_0xb0b12a||0xcc;return function(_0x3ecd0d){if(_0x3ecd0d){return _0x124ca3[_0x874d('0x16')](_0xb0b12a);}return _0x124ca3[_0x874d('0x17')](_0xb0b12a)[_0x874d('0x18')]();};}function respondWithResult(_0x454b3f,_0x229510){_0x229510=_0x229510||0xc8;return function(_0x1010cb){if(_0x1010cb){return _0x454b3f[_0x874d('0x17')](_0x229510)[_0x874d('0x19')](_0x1010cb);}};}function respondWithFilteredResult(_0x1cd4a8,_0x5a43b9){return function(_0x36b090){if(_0x36b090){var _0x2c21ca=typeof _0x5a43b9[_0x874d('0x1a')]==='undefined'&&typeof _0x5a43b9[_0x874d('0x1b')]===_0x874d('0x1c');var _0x583e8b=_0x36b090[_0x874d('0x1d')];var _0x82f9d8=_0x2c21ca?0x0:_0x5a43b9[_0x874d('0x1a')];var _0x505d29=_0x2c21ca?_0x36b090['count']:_0x5a43b9[_0x874d('0x1a')]+_0x5a43b9[_0x874d('0x1b')];var _0x3048eb;if(_0x505d29>=_0x583e8b){_0x505d29=_0x583e8b;_0x3048eb=0xc8;}else{_0x3048eb=0xce;}_0x1cd4a8[_0x874d('0x17')](_0x3048eb);return _0x1cd4a8['set'](_0x874d('0x1e'),_0x82f9d8+'-'+_0x505d29+'/'+_0x583e8b)['json'](_0x36b090);}return null;};}function patchUpdates(_0x24224e){return function(_0x20658b){try{jsonpatch[_0x874d('0x1f')](_0x20658b,_0x24224e,!![]);}catch(_0x2ffff4){return BPromise[_0x874d('0x20')](_0x2ffff4);}return _0x20658b[_0x874d('0x21')]();};}function saveUpdates(_0x4cd8bf,_0x4e1cf1){return function(_0x1b0917){if(_0x1b0917){return _0x1b0917[_0x874d('0x22')](_0x4cd8bf)[_0x874d('0x23')](function(_0x52e371){return _0x52e371;});}return null;};}function removeEntity(_0x588451,_0x54f21c){return function(_0x1f8102){if(_0x1f8102){return _0x1f8102['destroy']()[_0x874d('0x23')](function(){_0x588451['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45034f,_0x291af3){return function(_0x2c8ab9){if(!_0x2c8ab9){_0x45034f[_0x874d('0x16')](0x194);}return _0x2c8ab9;};}function handleError(_0xb7ad9e,_0x2d5b4d){_0x2d5b4d=_0x2d5b4d||0x1f4;return function(_0x488805){logger[_0x874d('0x24')](_0x488805['stack']);if(_0x488805[_0x874d('0x25')]){delete _0x488805[_0x874d('0x25')];}_0xb7ad9e['status'](_0x2d5b4d)[_0x874d('0x26')](_0x488805);};}exports[_0x874d('0x27')]=function(_0x86db18,_0x43d872){var _0x15785d={},_0xe947df={},_0x16f63b={'count':0x0,'rows':[]};var _0x55533b=_[_0x874d('0x28')](db['Migration'][_0x874d('0x29')],function(_0xba20cc){return{'name':_0xba20cc[_0x874d('0x2a')],'type':_0xba20cc[_0x874d('0x2b')][_0x874d('0x2c')]};});_0xe947df[_0x874d('0x2d')]=_[_0x874d('0x28')](_0x55533b,_0x874d('0x25'));_0xe947df[_0x874d('0x2e')]=_[_0x874d('0x2f')](_0x86db18[_0x874d('0x2e')]);_0xe947df[_0x874d('0x30')]=_['intersection'](_0xe947df['model'],_0xe947df[_0x874d('0x2e')]);_0x15785d['attributes']=_[_0x874d('0x31')](_0xe947df[_0x874d('0x2d')],qs[_0x874d('0x32')](_0x86db18[_0x874d('0x2e')][_0x874d('0x32')]));_0x15785d[_0x874d('0x33')]=_0x15785d[_0x874d('0x33')][_0x874d('0x34')]?_0x15785d[_0x874d('0x33')]:_0xe947df[_0x874d('0x2d')];if(!_0x86db18[_0x874d('0x2e')][_0x874d('0x35')](_0x874d('0x36'))){_0x15785d['limit']=qs[_0x874d('0x1b')](_0x86db18[_0x874d('0x2e')]['limit']);_0x15785d['offset']=qs[_0x874d('0x1a')](_0x86db18['query'][_0x874d('0x1a')]);}_0x15785d['order']=qs[_0x874d('0x37')](_0x86db18[_0x874d('0x2e')][_0x874d('0x37')]);_0x15785d[_0x874d('0x38')]=qs[_0x874d('0x30')](_[_0x874d('0x39')](_0x86db18[_0x874d('0x2e')],_0xe947df[_0x874d('0x30')]),_0x55533b);if(_0x86db18[_0x874d('0x2e')][_0x874d('0x3a')]){_0x15785d[_0x874d('0x38')]=_['merge'](_0x15785d[_0x874d('0x38')],{'$or':_['map'](_0x55533b,function(_0x49fb2f){if(_0x49fb2f[_0x874d('0x2b')]!=='VIRTUAL'){var _0x29eb75={};_0x29eb75[_0x49fb2f[_0x874d('0x25')]]={'$like':'%'+_0x86db18[_0x874d('0x2e')][_0x874d('0x3a')]+'%'};return _0x29eb75;}})});}_0x15785d=_[_0x874d('0x3b')]({},_0x15785d,_0x86db18[_0x874d('0x3c')]);var _0x3adc19={'where':_0x15785d[_0x874d('0x38')]};return db[_0x874d('0x3d')][_0x874d('0x1d')](_0x3adc19)['then'](function(_0x4caa02){_0x16f63b[_0x874d('0x1d')]=_0x4caa02;if(_0x86db18[_0x874d('0x2e')]['includeAll']){_0x15785d[_0x874d('0x3e')]=[{'all':!![]}];}return db[_0x874d('0x3d')][_0x874d('0x3f')](_0x15785d);})['then'](function(_0x3f5a1f){_0x16f63b['rows']=_0x3f5a1f;return _0x16f63b;})['then'](respondWithFilteredResult(_0x43d872,_0x15785d))[_0x874d('0x40')](handleError(_0x43d872,null));}; \ No newline at end of file +var _0x9297=['reject','save','update','then','end','error','stack','name','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x45fe8e,_0x128147){var _0x171468=function(_0x27af2){while(--_0x27af2){_0x45fe8e['push'](_0x45fe8e['shift']());}};_0x171468(++_0x128147);}(_0x9297,0x6c));var _0x7929=function(_0x129e00,_0x4ae627){_0x129e00=_0x129e00-0x0;var _0x4de6f7=_0x9297[_0x129e00];return _0x4de6f7;};'use strict';var emlformat=require(_0x7929('0x0'));var rimraf=require(_0x7929('0x1'));var zipdir=require(_0x7929('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7929('0x3'));var moment=require('moment');var BPromise=require(_0x7929('0x4'));var Mustache=require(_0x7929('0x5'));var util=require(_0x7929('0x6'));var path=require(_0x7929('0x7'));var sox=require(_0x7929('0x8'));var csv=require('to-csv');var ejs=require(_0x7929('0x9'));var fs=require('fs');var fs_extra=require(_0x7929('0xa'));var _=require(_0x7929('0xb'));var squel=require('squel');var crypto=require(_0x7929('0xc'));var jsforce=require(_0x7929('0xd'));var deskjs=require(_0x7929('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7929('0xf'));var Papa=require(_0x7929('0x10'));var Redis=require(_0x7929('0x11'));var authService=require(_0x7929('0x12'));var qs=require(_0x7929('0x13'));var as=require(_0x7929('0x14'));var hardwareService=require(_0x7929('0x15'));var logger=require(_0x7929('0x16'))(_0x7929('0x17'));var utils=require(_0x7929('0x18'));var config=require(_0x7929('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7929('0x1a'))['db'];function respondWithStatusCode(_0x196093,_0x5a9d99){_0x5a9d99=_0x5a9d99||0xcc;return function(_0x10e973){if(_0x10e973){return _0x196093[_0x7929('0x1b')](_0x5a9d99);}return _0x196093[_0x7929('0x1c')](_0x5a9d99)['end']();};}function respondWithResult(_0x32b2e8,_0x2f7bb2){_0x2f7bb2=_0x2f7bb2||0xc8;return function(_0x364f3d){if(_0x364f3d){return _0x32b2e8[_0x7929('0x1c')](_0x2f7bb2)['json'](_0x364f3d);}};}function respondWithFilteredResult(_0x100bfb,_0x92e09e){return function(_0x4e61b8){if(_0x4e61b8){var _0x4edfef=typeof _0x92e09e[_0x7929('0x1d')]===_0x7929('0x1e')&&typeof _0x92e09e[_0x7929('0x1f')]===_0x7929('0x1e');var _0x5a5603=_0x4e61b8['count'];var _0x405e2a=_0x4edfef?0x0:_0x92e09e[_0x7929('0x1d')];var _0x5c1a15=_0x4edfef?_0x4e61b8[_0x7929('0x20')]:_0x92e09e[_0x7929('0x1d')]+_0x92e09e[_0x7929('0x1f')];var _0x512174;if(_0x5c1a15>=_0x5a5603){_0x5c1a15=_0x5a5603;_0x512174=0xc8;}else{_0x512174=0xce;}_0x100bfb['status'](_0x512174);return _0x100bfb[_0x7929('0x21')](_0x7929('0x22'),_0x405e2a+'-'+_0x5c1a15+'/'+_0x5a5603)[_0x7929('0x23')](_0x4e61b8);}return null;};}function patchUpdates(_0x58a4a3){return function(_0x1925d6){try{jsonpatch['apply'](_0x1925d6,_0x58a4a3,!![]);}catch(_0x5de2f1){return BPromise[_0x7929('0x24')](_0x5de2f1);}return _0x1925d6[_0x7929('0x25')]();};}function saveUpdates(_0x4406a3,_0x10e9cf){return function(_0xd6cd0c){if(_0xd6cd0c){return _0xd6cd0c[_0x7929('0x26')](_0x4406a3)[_0x7929('0x27')](function(_0x222fba){return _0x222fba;});}return null;};}function removeEntity(_0x5b925b,_0x1b9026){return function(_0x50b9a4){if(_0x50b9a4){return _0x50b9a4['destroy']()[_0x7929('0x27')](function(){_0x5b925b[_0x7929('0x1c')](0xcc)[_0x7929('0x28')]();});}};}function handleEntityNotFound(_0x32a01c,_0xd2bfc1){return function(_0x2a3593){if(!_0x2a3593){_0x32a01c[_0x7929('0x1b')](0x194);}return _0x2a3593;};}function handleError(_0x35b952,_0x1b9b23){_0x1b9b23=_0x1b9b23||0x1f4;return function(_0x2841a5){logger[_0x7929('0x29')](_0x2841a5[_0x7929('0x2a')]);if(_0x2841a5['name']){delete _0x2841a5[_0x7929('0x2b')];}_0x35b952[_0x7929('0x1c')](_0x1b9b23)['send'](_0x2841a5);};}exports['index']=function(_0x73e47b,_0x4c3084){var _0xb9acb7={},_0x520f32={},_0x47ec71={'count':0x0,'rows':[]};var _0x272c3c=_[_0x7929('0x2c')](db[_0x7929('0x2d')][_0x7929('0x2e')],function(_0xe489d2){return{'name':_0xe489d2[_0x7929('0x2f')],'type':_0xe489d2[_0x7929('0x30')][_0x7929('0x31')]};});_0x520f32[_0x7929('0x32')]=_[_0x7929('0x2c')](_0x272c3c,_0x7929('0x2b'));_0x520f32[_0x7929('0x33')]=_[_0x7929('0x34')](_0x73e47b[_0x7929('0x33')]);_0x520f32[_0x7929('0x35')]=_[_0x7929('0x36')](_0x520f32[_0x7929('0x32')],_0x520f32[_0x7929('0x33')]);_0xb9acb7[_0x7929('0x37')]=_['intersection'](_0x520f32[_0x7929('0x32')],qs['fields'](_0x73e47b[_0x7929('0x33')][_0x7929('0x38')]));_0xb9acb7[_0x7929('0x37')]=_0xb9acb7['attributes'][_0x7929('0x39')]?_0xb9acb7['attributes']:_0x520f32[_0x7929('0x32')];if(!_0x73e47b[_0x7929('0x33')][_0x7929('0x3a')](_0x7929('0x3b'))){_0xb9acb7[_0x7929('0x1f')]=qs['limit'](_0x73e47b[_0x7929('0x33')][_0x7929('0x1f')]);_0xb9acb7['offset']=qs[_0x7929('0x1d')](_0x73e47b[_0x7929('0x33')][_0x7929('0x1d')]);}_0xb9acb7[_0x7929('0x3c')]=qs[_0x7929('0x3d')](_0x73e47b[_0x7929('0x33')][_0x7929('0x3d')]);_0xb9acb7['where']=qs['filters'](_[_0x7929('0x3e')](_0x73e47b[_0x7929('0x33')],_0x520f32[_0x7929('0x35')]),_0x272c3c);if(_0x73e47b[_0x7929('0x33')]['filter']){_0xb9acb7[_0x7929('0x3f')]=_['merge'](_0xb9acb7['where'],{'$or':_[_0x7929('0x2c')](_0x272c3c,function(_0x324896){if(_0x324896[_0x7929('0x30')]!==_0x7929('0x40')){var _0x1089f9={};_0x1089f9[_0x324896['name']]={'$like':'%'+_0x73e47b[_0x7929('0x33')][_0x7929('0x41')]+'%'};return _0x1089f9;}})});}_0xb9acb7=_[_0x7929('0x42')]({},_0xb9acb7,_0x73e47b['options']);var _0x30fb85={'where':_0xb9acb7[_0x7929('0x3f')]};return db[_0x7929('0x2d')]['count'](_0x30fb85)['then'](function(_0x44435b){_0x47ec71['count']=_0x44435b;if(_0x73e47b[_0x7929('0x33')][_0x7929('0x43')]){_0xb9acb7[_0x7929('0x44')]=[{'all':!![]}];}return db['Migration'][_0x7929('0x45')](_0xb9acb7);})['then'](function(_0x14ae1d){_0x47ec71[_0x7929('0x46')]=_0x14ae1d;return _0x47ec71;})[_0x7929('0x27')](respondWithFilteredResult(_0x4c3084,_0xb9acb7))[_0x7929('0x47')](handleError(_0x4c3084,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 0d96b30..a062bb1 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 _0x8eca=['path','../../config/environment','./migration.attributes','define','Migration','migrations','util','../../config/logger','api','moment','request-promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8eca,0xcc));var _0xa8ec=function(_0xd7e064,_0x117354){_0xd7e064=_0xd7e064-0x0;var _0x15f386=_0x8eca[_0xd7e064];return _0x15f386;};'use strict';var _=require('lodash');var util=require(_0xa8ec('0x0'));var logger=require(_0xa8ec('0x1'))(_0xa8ec('0x2'));var moment=require(_0xa8ec('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8ec('0x4'));var fs=require('fs');var path=require(_0xa8ec('0x5'));var rimraf=require('rimraf');var config=require(_0xa8ec('0x6'));var attributes=require(_0xa8ec('0x7'));module['exports']=function(_0x16b6a4,_0x51eee4){return _0x16b6a4[_0xa8ec('0x8')](_0xa8ec('0x9'),attributes,{'tableName':_0xa8ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c0f=['define','Migration','migrations','lodash','api','moment','bluebird','request-promise','../../config/environment','./migration.attributes','exports'];(function(_0x379d7d,_0x1532e5){var _0x119854=function(_0x2bf4e4){while(--_0x2bf4e4){_0x379d7d['push'](_0x379d7d['shift']());}};_0x119854(++_0x1532e5);}(_0x5c0f,0x16e));var _0xf5c0=function(_0x418305,_0xcf9d75){_0x418305=_0x418305-0x0;var _0x39a433=_0x5c0f[_0x418305];return _0x39a433;};'use strict';var _=require(_0xf5c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf5c0('0x1'));var moment=require(_0xf5c0('0x2'));var BPromise=require(_0xf5c0('0x3'));var rp=require(_0xf5c0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf5c0('0x5'));var attributes=require(_0xf5c0('0x6'));module[_0xf5c0('0x7')]=function(_0x4934ae,_0x201e0c){return _0x4934ae[_0xf5c0('0x8')](_0xf5c0('0x9'),attributes,{'tableName':_0xf5c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index af6cb18..0d2e0d1 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 _0xc788=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','message','Migration,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xc788,0xc4));var _0x8c78=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0xc788[_0x31b9cf];return _0x357b8a;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('Migration,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('Migration,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('Migration,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});} \ No newline at end of file +var _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2b9e84,_0x25ffcb){var _0x2e12d7=function(_0x4ceedf){while(--_0x4ceedf){_0x2b9e84['push'](_0x2b9e84['shift']());}};_0x2e12d7(++_0x25ffcb);}(_0x878f,0x173));var _0xf878=function(_0x40e438,_0x3a1dca){_0x40e438=_0x40e438-0x0;var _0x281b65=_0x878f[_0x40e438];return _0x281b65;};'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});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0c4b08d..835115f 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 _0x9666=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x9b2b50,_0x38787e){var _0x4698ea=function(_0xa817af){while(--_0xa817af){_0x9b2b50['push'](_0x9b2b50['shift']());}};_0x4698ea(++_0x38787e);}(_0x9666,0x17a));var _0x6966=function(_0x31e925,_0x32cdfb){_0x31e925=_0x31e925-0x0;var _0x1a20bf=_0x9666[_0x31e925];return _0x1a20bf;};'use strict';var multer=require(_0x6966('0x0'));var util=require(_0x6966('0x1'));var path=require(_0x6966('0x2'));var timeout=require(_0x6966('0x3'));var express=require('express');var router=express[_0x6966('0x4')]();var fs_extra=require(_0x6966('0x5'));var auth=require(_0x6966('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6966('0x7'));router[_0x6966('0x8')]('/',auth[_0x6966('0x9')](),controller[_0x6966('0xa')]);router[_0x6966('0x8')](_0x6966('0xb'),auth['isAuthenticated'](),controller[_0x6966('0xc')]);router[_0x6966('0xd')]('/',auth[_0x6966('0x9')](),controller['create']);router[_0x6966('0xe')](_0x6966('0xb'),auth[_0x6966('0x9')](),controller[_0x6966('0xf')]);router[_0x6966('0x10')](_0x6966('0xb'),auth[_0x6966('0x9')](),controller[_0x6966('0x11')]);module[_0x6966('0x12')]=router; \ No newline at end of file +var _0xf23c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xf23c,0x77));var _0xcf23=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0xf23c[_0x4d7a61];return _0x186f73;};'use strict';var multer=require(_0xcf23('0x0'));var util=require(_0xcf23('0x1'));var path=require(_0xcf23('0x2'));var timeout=require(_0xcf23('0x3'));var express=require(_0xcf23('0x4'));var router=express[_0xcf23('0x5')]();var fs_extra=require(_0xcf23('0x6'));var auth=require(_0xcf23('0x7'));var interaction=require(_0xcf23('0x8'));var config=require(_0xcf23('0x9'));var controller=require(_0xcf23('0xa'));router[_0xcf23('0xb')]('/',auth[_0xcf23('0xc')](),controller[_0xcf23('0xd')]);router['get']('/:id',auth[_0xcf23('0xc')](),controller[_0xcf23('0xe')]);router[_0xcf23('0xf')]('/',auth[_0xcf23('0xc')](),controller[_0xcf23('0x10')]);router[_0xcf23('0x11')](_0xcf23('0x12'),auth[_0xcf23('0xc')](),controller['update']);router[_0xcf23('0x13')](_0xcf23('0x12'),auth[_0xcf23('0xc')](),controller[_0xcf23('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a3e5a2a..2f7130e 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 _0x4f0c=['localnet','externip','turn','STRING'];(function(_0x1679c8,_0x5eff59){var _0x3b1766=function(_0x5ada5c){while(--_0x5ada5c){_0x1679c8['push'](_0x1679c8['shift']());}};_0x3b1766(++_0x5eff59);}(_0x4f0c,0x13c));var _0xc4f0=function(_0x196a11,_0x12e1e5){_0x196a11=_0x196a11-0x0;var _0x284139=_0x4f0c[_0x196a11];return _0x284139;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xc4f0('0x0'),_0xc4f0('0x1'),'stun',_0xc4f0('0x2'))},'value':{'type':Sequelize[_0xc4f0('0x3')]},'username':{'type':Sequelize[_0xc4f0('0x3')]},'password':{'type':Sequelize[_0xc4f0('0x3')]}}; \ No newline at end of file +var _0x70d4=['localnet','externip','stun','turn','STRING','sequelize','ENUM'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x70d4,0x1be));var _0x470d=function(_0xd02def,_0x144f25){_0xd02def=_0xd02def-0x0;var _0x2e8374=_0x70d4[_0xd02def];return _0x2e8374;};'use strict';var Sequelize=require(_0x470d('0x0'));module['exports']={'type':{'type':Sequelize[_0x470d('0x1')](_0x470d('0x2'),_0x470d('0x3'),_0x470d('0x4'),_0x470d('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x470d('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 53cf759..ea4df03 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 _0xe86e=['findAll','show','params','keys','find','create','body','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','chan_sip.so','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','STUN','destroy','util','ejs','lodash','jayson/promise','http','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe86e,0x10b));var _0xee86=function(_0x58ebd2,_0xefcf97){_0x58ebd2=_0x58ebd2-0x0;var _0x3b074e=_0xe86e[_0x58ebd2];return _0x3b074e;};'use strict';var util=require(_0xee86('0x0'));var path=require('path');var ejs=require(_0xee86('0x1'));var fs=require('fs');var _=require(_0xee86('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xee86('0x3'));var client=jayson['client'][_0xee86('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x3032f0,_0x145be5,_0x3a10ba,_0x26066e){return new Promise(function(_0x20d054,_0x475898){var _0x1ab2ca=_0x26066e||client;return _0x1ab2ca['request'](_0x3032f0,_0x3a10ba)[_0xee86('0x5')](function(_0x34b119){logger['info'](_0xee86('0x6'),_0x145be5,'request\x20sent');logger[_0xee86('0x7')](_0xee86('0x8'),_0x145be5,_0xee86('0x9'),JSON[_0xee86('0xa')](_0x34b119));if(_0x34b119[_0xee86('0xb')]){if(_0x34b119['error']['code']===0x1f4){logger['error'](_0xee86('0x6'),_0x145be5,_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);return _0x475898(_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);}logger[_0xee86('0xb')]('Network,\x20%s,\x20%s',_0x145be5,_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);return _0x20d054(_0x34b119[_0xee86('0xb')][_0xee86('0xc')]);}else{logger[_0xee86('0xd')](_0xee86('0x6'),_0x145be5,_0xee86('0x9'));_0x20d054(_0x34b119[_0xee86('0xe')][_0xee86('0xc')]);}})[_0xee86('0xf')](function(_0x23c2ff){logger[_0xee86('0xb')](_0xee86('0x6'),_0x145be5,_0x23c2ff);_0x475898(_0x23c2ff);});});}function respondWithResult(_0x339a1b,_0x15fd08){_0x15fd08=_0x15fd08||0xc8;return function(_0x222fd9){if(_0x222fd9){return _0x339a1b[_0xee86('0x10')](_0x15fd08)[_0xee86('0x11')](_0x222fd9);}};}function respondWithFilteredResult(_0x5d4611,_0x23b96b){return function(_0x2de099){if(_0x2de099){var _0x2c2242=typeof _0x23b96b[_0xee86('0x12')]===_0xee86('0x13')&&typeof _0x23b96b[_0xee86('0x14')]==='undefined';var _0x25c3ec=_0x2de099['count'];var _0x5135ad=_0x2c2242?0x0:_0x23b96b[_0xee86('0x12')];var _0x853da5=_0x2c2242?_0x2de099[_0xee86('0x15')]:_0x23b96b[_0xee86('0x12')]+_0x23b96b['limit'];var _0x3c7ff7;if(_0x853da5>=_0x25c3ec){_0x853da5=_0x25c3ec;_0x3c7ff7=0xc8;}else{_0x3c7ff7=0xce;}_0x5d4611[_0xee86('0x10')](_0x3c7ff7);return _0x5d4611['set'](_0xee86('0x16'),_0x5135ad+'-'+_0x853da5+'/'+_0x25c3ec)[_0xee86('0x11')](_0x2de099);}return null;};}function saveUpdates(_0x41526e){return function(_0x2a1784){if(_0x2a1784){return _0x2a1784[_0xee86('0x17')](_0x41526e)[_0xee86('0x5')](function(_0x233564){return _0x233564;});}return null;};}function removeEntity(_0x54614e){return function(_0x59a628){if(_0x59a628){return _0x59a628['destroy']()['then'](function(){_0x54614e['status'](0xcc)[_0xee86('0x18')]();});}};}function handleEntityNotFound(_0x368d29){return function(_0x515e64){if(!_0x515e64){_0x368d29[_0xee86('0x19')](0x194);}return _0x515e64;};}function handleError(_0x384d83,_0x14b63f){_0x14b63f=_0x14b63f||0x1f4;return function(_0x16272c){logger[_0xee86('0xb')](_0x16272c[_0xee86('0x1a')]);if(_0x16272c[_0xee86('0x1b')]){delete _0x16272c[_0xee86('0x1b')];}_0x384d83[_0xee86('0x10')](_0x14b63f)[_0xee86('0x1c')](_0x16272c);};}exports[_0xee86('0x1d')]=function(_0x3f72f4,_0x33e7f8){var _0x317a50={},_0x15042e={},_0x31d7bd={'count':0x0,'rows':[]};var _0x50049a=_[_0xee86('0x1e')](db[_0xee86('0x1f')][_0xee86('0x20')],function(_0x557665){return{'name':_0x557665['fieldName'],'type':_0x557665[_0xee86('0x21')]['key']};});_0x15042e['model']=_['map'](_0x50049a,'name');_0x15042e[_0xee86('0x22')]=_['keys'](_0x3f72f4[_0xee86('0x22')]);_0x15042e[_0xee86('0x23')]=_['intersection'](_0x15042e[_0xee86('0x24')],_0x15042e['query']);_0x317a50[_0xee86('0x25')]=_[_0xee86('0x26')](_0x15042e['model'],qs[_0xee86('0x27')](_0x3f72f4[_0xee86('0x22')][_0xee86('0x27')]));_0x317a50[_0xee86('0x25')]=_0x317a50[_0xee86('0x25')][_0xee86('0x28')]?_0x317a50[_0xee86('0x25')]:_0x15042e[_0xee86('0x24')];if(!_0x3f72f4[_0xee86('0x22')][_0xee86('0x29')](_0xee86('0x2a'))){_0x317a50[_0xee86('0x14')]=qs[_0xee86('0x14')](_0x3f72f4[_0xee86('0x22')][_0xee86('0x14')]);_0x317a50[_0xee86('0x12')]=qs[_0xee86('0x12')](_0x3f72f4[_0xee86('0x22')]['offset']);}_0x317a50[_0xee86('0x2b')]=qs[_0xee86('0x2c')](_0x3f72f4[_0xee86('0x22')][_0xee86('0x2c')]);_0x317a50[_0xee86('0x2d')]=qs[_0xee86('0x23')](_[_0xee86('0x2e')](_0x3f72f4[_0xee86('0x22')],_0x15042e[_0xee86('0x23')]),_0x50049a);if(_0x3f72f4['query']['filter']){_0x317a50[_0xee86('0x2d')]=_[_0xee86('0x2f')](_0x317a50[_0xee86('0x2d')],{'$or':_[_0xee86('0x1e')](_0x50049a,function(_0x3ee7fe){if(_0x3ee7fe[_0xee86('0x21')]!==_0xee86('0x30')){var _0x88ea2={};_0x88ea2[_0x3ee7fe[_0xee86('0x1b')]]={'$like':'%'+_0x3f72f4[_0xee86('0x22')][_0xee86('0x31')]+'%'};return _0x88ea2;}})});}_0x317a50=_['merge']({},_0x317a50,_0x3f72f4[_0xee86('0x32')]);var _0x1ee23d={'where':_0x317a50['where']};return db['Network'][_0xee86('0x15')](_0x1ee23d)[_0xee86('0x5')](function(_0x3d1128){_0x31d7bd[_0xee86('0x15')]=_0x3d1128;if(_0x3f72f4[_0xee86('0x22')][_0xee86('0x33')]){_0x317a50[_0xee86('0x34')]=[{'all':!![]}];}return db[_0xee86('0x1f')][_0xee86('0x35')](_0x317a50);})['then'](function(_0xd93676){_0x31d7bd['rows']=_0xd93676;return _0x31d7bd;})['then'](respondWithFilteredResult(_0x33e7f8,_0x317a50))[_0xee86('0xf')](handleError(_0x33e7f8,null));};exports[_0xee86('0x36')]=function(_0xbd133b,_0x2ffb99){var _0x385abd={'raw':!![],'where':{'id':_0xbd133b[_0xee86('0x37')]['id']}},_0xe0cfe={};_0xe0cfe['model']=_[_0xee86('0x38')](db[_0xee86('0x1f')][_0xee86('0x20')]);_0xe0cfe['query']=_[_0xee86('0x38')](_0xbd133b['query']);_0xe0cfe['filters']=_[_0xee86('0x26')](_0xe0cfe['model'],_0xe0cfe[_0xee86('0x22')]);_0x385abd[_0xee86('0x25')]=_[_0xee86('0x26')](_0xe0cfe[_0xee86('0x24')],qs[_0xee86('0x27')](_0xbd133b[_0xee86('0x22')]['fields']));_0x385abd[_0xee86('0x25')]=_0x385abd[_0xee86('0x25')]['length']?_0x385abd['attributes']:_0xe0cfe[_0xee86('0x24')];if(_0xbd133b['query'][_0xee86('0x33')]){_0x385abd[_0xee86('0x34')]=[{'all':!![]}];}_0x385abd=_[_0xee86('0x2f')]({},_0x385abd,_0xbd133b['options']);return db[_0xee86('0x1f')][_0xee86('0x39')](_0x385abd)[_0xee86('0x5')](handleEntityNotFound(_0x2ffb99,null))[_0xee86('0x5')](respondWithResult(_0x2ffb99,null))['catch'](handleError(_0x2ffb99,null));};exports[_0xee86('0x3a')]=function(_0x3b1cd5,_0x26a060){var _0x274094;return db[_0xee86('0x1f')][_0xee86('0x3a')](_0x3b1cd5[_0xee86('0x3b')],{'raw':!![]})[_0xee86('0x5')](function(_0x1f4084){_0x274094=_0x1f4084;return db[_0xee86('0x1f')][_0xee86('0x35')]({'where':{'type':_0x3b1cd5[_0xee86('0x3b')][_0xee86('0x21')]},'raw':!![]});})[_0xee86('0x5')](function(_0x37ee7b){if(_0x274094[_0xee86('0x21')]['toUpperCase']()=='STUN'){var _0xf7a00d=fs[_0xee86('0x3c')](path[_0xee86('0x3d')](config['root'],_0xee86('0x3e')),_0xee86('0x3f'));var _0x2cf29c=ejs['render'](_0xf7a00d,{'networks':_0x37ee7b||[]});fs[_0xee86('0x40')](_0xee86('0x41'),_0x2cf29c);return respondWithRpcPromise('Reload',_0xee86('0x3a'),{'module':'res_stun_monitor.so'});}else if(_0x274094[_0xee86('0x21')][_0xee86('0x42')]()==_0xee86('0x43')){var _0x4bdfcb=fs[_0xee86('0x3c')](path[_0xee86('0x3d')](config[_0xee86('0x44')],_0xee86('0x45')),_0xee86('0x3f'));var _0x51c8c0=ejs[_0xee86('0x46')](_0x4bdfcb,{'networks':_0x37ee7b||[]});fs[_0xee86('0x40')](_0xee86('0x47'),_0x51c8c0);return respondWithRpcPromise(_0xee86('0x48'),'create',{'module':'res_stun_monitor.so'});}else{var _0x244af8=fs['readFileSync'](path['join'](config[_0xee86('0x44')],_0xee86('0x49')),_0xee86('0x3f'));var _0x3c8b44=ejs[_0xee86('0x46')](_0x244af8,{'networks':_0x37ee7b||[]});fs['writeFileSync'](util[_0xee86('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x3b1cd5['body']['type']['toLowerCase']()),_0x3c8b44);return respondWithRpcPromise(_0xee86('0x48'),'create',{'module':_0xee86('0x4b')});}})[_0xee86('0x5')](function(){return _0x274094;})['then'](respondWithResult(_0x26a060,0xc9))[_0xee86('0xf')](handleError(_0x26a060,null));};exports[_0xee86('0x17')]=function(_0x533d8b,_0x3d6639){var _0x255c97;return db['Network'][_0xee86('0x39')]({'where':{'id':_0x533d8b[_0xee86('0x37')]['id']}})[_0xee86('0x5')](handleEntityNotFound(_0x3d6639,null))[_0xee86('0x5')](saveUpdates(_0x533d8b[_0xee86('0x3b')],null))['then'](function(_0x313af2){if(_0x313af2){_0x255c97=_0x313af2;return db[_0xee86('0x1f')][_0xee86('0x35')]({'where':{'type':_0x255c97[_0xee86('0x21')]},'raw':!![]});}return null;})[_0xee86('0x5')](function(_0x8ffb79){if(_0x255c97[_0xee86('0x21')][_0xee86('0x42')]()=='STUN'){var _0x2feb58=fs['readFileSync'](path[_0xee86('0x3d')](config[_0xee86('0x44')],_0xee86('0x3e')),_0xee86('0x3f'));var _0xac510b=ejs[_0xee86('0x46')](_0x2feb58,{'networks':_0x8ffb79||[]});fs[_0xee86('0x40')](_0xee86('0x41'),_0xac510b);return respondWithRpcPromise('Reload',_0xee86('0x17'),{'module':_0xee86('0x4c')});}else if(_0x255c97[_0xee86('0x21')][_0xee86('0x42')]()==_0xee86('0x43')){var _0x5cf156=fs['readFileSync'](path['join'](config[_0xee86('0x44')],_0xee86('0x45')),_0xee86('0x3f'));var _0x5ee565=ejs[_0xee86('0x46')](_0x5cf156,{'networks':_0x8ffb79||[]});fs[_0xee86('0x40')](_0xee86('0x47'),_0x5ee565);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x17'),{'module':_0xee86('0x4c')});}else{var _0x32cbfe=fs[_0xee86('0x3c')](path[_0xee86('0x3d')](config[_0xee86('0x44')],_0xee86('0x49')),_0xee86('0x3f'));var _0x5a34ef=ejs[_0xee86('0x46')](_0x32cbfe,{'networks':_0x8ffb79||[]});fs['writeFileSync'](util[_0xee86('0x4a')](_0xee86('0x4d'),_0x533d8b['body'][_0xee86('0x21')]['toLowerCase']()),_0x5a34ef);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x17'),{'module':_0xee86('0x4b')});}})[_0xee86('0x5')](function(_0x1b3dfd){if(_0x1b3dfd){return _0x255c97;}return null;})['then'](respondWithResult(_0x3d6639,null))[_0xee86('0xf')](handleError(_0x3d6639,null));};exports['destroy']=function(_0x5b8e01,_0x38ad3b){var _0x1491d5;return db['Network'][_0xee86('0x39')]({'where':{'id':_0x5b8e01[_0xee86('0x37')]['id']}})[_0xee86('0x5')](function(_0x4cb8f2){_0x1491d5=_0x4cb8f2;return _0x4cb8f2;})[_0xee86('0x5')](handleEntityNotFound(_0x38ad3b,null))[_0xee86('0x5')](removeEntity(_0x38ad3b,null))['then'](function(){if(_0x1491d5){return db[_0xee86('0x1f')][_0xee86('0x35')]({'where':{'type':_0x1491d5[_0xee86('0x21')]},'raw':!![]});}})[_0xee86('0x5')](function(_0x3a99ad){if(_0x1491d5[_0xee86('0x21')][_0xee86('0x42')]()==_0xee86('0x4e')){var _0x298569=fs['readFileSync'](path[_0xee86('0x3d')](config['root'],_0xee86('0x3e')),_0xee86('0x3f'));var _0x1ece66=ejs[_0xee86('0x46')](_0x298569,{'networks':_0x3a99ad||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1ece66);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x4f'),{'module':_0xee86('0x4c')});}else if(_0x1491d5[_0xee86('0x21')][_0xee86('0x42')]()=='TURN'){var _0x22627b=fs[_0xee86('0x3c')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0xee86('0x3f'));var _0x395657=ejs['render'](_0x22627b,{'networks':_0x3a99ad||[]});fs[_0xee86('0x40')]('/etc/asterisk/turn_xcally.conf',_0x395657);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x4f'),{'module':'res_stun_monitor.so'});}else{var _0x37bf0f=fs['readFileSync'](path[_0xee86('0x3d')](config['root'],_0xee86('0x49')),_0xee86('0x3f'));var _0x5ce68c=ejs[_0xee86('0x46')](_0x37bf0f,{'networks':_0x3a99ad||[]});fs[_0xee86('0x40')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1491d5[_0xee86('0x21')]['toLowerCase']()),_0x5ce68c);return respondWithRpcPromise(_0xee86('0x48'),_0xee86('0x4f'),{'module':_0xee86('0x4b')});}})[_0xee86('0xf')](handleError(_0x38ad3b,null));}; \ No newline at end of file +var _0x8e6b=['root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','readFileSync','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','format','toLowerCase','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','/etc/asterisk/sip_xcally_%s.conf','destroy','chan_sip.so','path','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','toUpperCase','STUN'];(function(_0x48504d,_0x485ae2){var _0x11ea39=function(_0x180e3d){while(--_0x180e3d){_0x48504d['push'](_0x48504d['shift']());}};_0x11ea39(++_0x485ae2);}(_0x8e6b,0x1cb));var _0xb8e6=function(_0x2e808d,_0x5022e6){_0x2e808d=_0x2e808d-0x0;var _0x2eaaa7=_0x8e6b[_0x2e808d];return _0x2eaaa7;};'use strict';var util=require('util');var path=require(_0xb8e6('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0xb8e6('0x1'));var logger=require(_0xb8e6('0x2'))(_0xb8e6('0x3'));var config=require(_0xb8e6('0x4'));var db=require(_0xb8e6('0x5'))['db'];var jayson=require(_0xb8e6('0x6'));var client=jayson[_0xb8e6('0x7')][_0xb8e6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42c787,_0x103469,_0x5818b1,_0x291a0e){return new Promise(function(_0x45395f,_0x1ba02c){var _0x2d5304=_0x291a0e||client;return _0x2d5304[_0xb8e6('0x9')](_0x42c787,_0x5818b1)['then'](function(_0x5d80fd){logger[_0xb8e6('0xa')](_0xb8e6('0xb'),_0x103469,_0xb8e6('0xc'));logger[_0xb8e6('0xd')](_0xb8e6('0xe'),_0x103469,_0xb8e6('0xc'),JSON[_0xb8e6('0xf')](_0x5d80fd));if(_0x5d80fd['error']){if(_0x5d80fd[_0xb8e6('0x10')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x103469,_0x5d80fd[_0xb8e6('0x10')]['message']);return _0x1ba02c(_0x5d80fd[_0xb8e6('0x10')]['message']);}logger[_0xb8e6('0x10')]('Network,\x20%s,\x20%s',_0x103469,_0x5d80fd[_0xb8e6('0x10')][_0xb8e6('0x11')]);return _0x45395f(_0x5d80fd[_0xb8e6('0x10')]['message']);}else{logger[_0xb8e6('0xa')](_0xb8e6('0xb'),_0x103469,'request\x20sent');_0x45395f(_0x5d80fd[_0xb8e6('0x12')][_0xb8e6('0x11')]);}})['catch'](function(_0xe8b5a7){logger[_0xb8e6('0x10')]('Network,\x20%s,\x20%s',_0x103469,_0xe8b5a7);_0x1ba02c(_0xe8b5a7);});});}function respondWithResult(_0x1d454a,_0x474290){_0x474290=_0x474290||0xc8;return function(_0x39cae7){if(_0x39cae7){return _0x1d454a[_0xb8e6('0x13')](_0x474290)[_0xb8e6('0x14')](_0x39cae7);}};}function respondWithFilteredResult(_0x28e902,_0x5a8a36){return function(_0x2141d6){if(_0x2141d6){var _0x3c19e7=typeof _0x5a8a36[_0xb8e6('0x15')]===_0xb8e6('0x16')&&typeof _0x5a8a36[_0xb8e6('0x17')]===_0xb8e6('0x16');var _0x48f18e=_0x2141d6[_0xb8e6('0x18')];var _0x2b8c53=_0x3c19e7?0x0:_0x5a8a36['offset'];var _0x339103=_0x3c19e7?_0x2141d6['count']:_0x5a8a36['offset']+_0x5a8a36[_0xb8e6('0x17')];var _0x1fb446;if(_0x339103>=_0x48f18e){_0x339103=_0x48f18e;_0x1fb446=0xc8;}else{_0x1fb446=0xce;}_0x28e902[_0xb8e6('0x13')](_0x1fb446);return _0x28e902[_0xb8e6('0x19')](_0xb8e6('0x1a'),_0x2b8c53+'-'+_0x339103+'/'+_0x48f18e)[_0xb8e6('0x14')](_0x2141d6);}return null;};}function saveUpdates(_0x4d9a65){return function(_0x48ab8c){if(_0x48ab8c){return _0x48ab8c[_0xb8e6('0x1b')](_0x4d9a65)[_0xb8e6('0x1c')](function(_0x2077a2){return _0x2077a2;});}return null;};}function removeEntity(_0x13a2a6){return function(_0x5dd84d){if(_0x5dd84d){return _0x5dd84d['destroy']()['then'](function(){_0x13a2a6[_0xb8e6('0x13')](0xcc)[_0xb8e6('0x1d')]();});}};}function handleEntityNotFound(_0x288ce0){return function(_0x2df7cc){if(!_0x2df7cc){_0x288ce0[_0xb8e6('0x1e')](0x194);}return _0x2df7cc;};}function handleError(_0x2aaac8,_0x5ccc6e){_0x5ccc6e=_0x5ccc6e||0x1f4;return function(_0x10f343){logger[_0xb8e6('0x10')](_0x10f343[_0xb8e6('0x1f')]);if(_0x10f343[_0xb8e6('0x20')]){delete _0x10f343[_0xb8e6('0x20')];}_0x2aaac8['status'](_0x5ccc6e)[_0xb8e6('0x21')](_0x10f343);};}exports[_0xb8e6('0x22')]=function(_0x305ccb,_0x4e724a){var _0xe71b00={},_0x3d7a41={},_0x37b70d={'count':0x0,'rows':[]};var _0x231795=_[_0xb8e6('0x23')](db[_0xb8e6('0x24')][_0xb8e6('0x25')],function(_0x165b7c){return{'name':_0x165b7c[_0xb8e6('0x26')],'type':_0x165b7c['type'][_0xb8e6('0x27')]};});_0x3d7a41[_0xb8e6('0x28')]=_[_0xb8e6('0x23')](_0x231795,_0xb8e6('0x20'));_0x3d7a41[_0xb8e6('0x29')]=_['keys'](_0x305ccb['query']);_0x3d7a41[_0xb8e6('0x2a')]=_[_0xb8e6('0x2b')](_0x3d7a41[_0xb8e6('0x28')],_0x3d7a41[_0xb8e6('0x29')]);_0xe71b00[_0xb8e6('0x2c')]=_[_0xb8e6('0x2b')](_0x3d7a41[_0xb8e6('0x28')],qs[_0xb8e6('0x2d')](_0x305ccb[_0xb8e6('0x29')][_0xb8e6('0x2d')]));_0xe71b00[_0xb8e6('0x2c')]=_0xe71b00[_0xb8e6('0x2c')][_0xb8e6('0x2e')]?_0xe71b00[_0xb8e6('0x2c')]:_0x3d7a41[_0xb8e6('0x28')];if(!_0x305ccb[_0xb8e6('0x29')]['hasOwnProperty'](_0xb8e6('0x2f'))){_0xe71b00[_0xb8e6('0x17')]=qs[_0xb8e6('0x17')](_0x305ccb[_0xb8e6('0x29')][_0xb8e6('0x17')]);_0xe71b00[_0xb8e6('0x15')]=qs[_0xb8e6('0x15')](_0x305ccb[_0xb8e6('0x29')]['offset']);}_0xe71b00[_0xb8e6('0x30')]=qs[_0xb8e6('0x31')](_0x305ccb['query']['sort']);_0xe71b00[_0xb8e6('0x32')]=qs[_0xb8e6('0x2a')](_[_0xb8e6('0x33')](_0x305ccb[_0xb8e6('0x29')],_0x3d7a41[_0xb8e6('0x2a')]),_0x231795);if(_0x305ccb[_0xb8e6('0x29')][_0xb8e6('0x34')]){_0xe71b00[_0xb8e6('0x32')]=_[_0xb8e6('0x35')](_0xe71b00[_0xb8e6('0x32')],{'$or':_[_0xb8e6('0x23')](_0x231795,function(_0x5f0f1e){if(_0x5f0f1e[_0xb8e6('0x36')]!==_0xb8e6('0x37')){var _0x648630={};_0x648630[_0x5f0f1e[_0xb8e6('0x20')]]={'$like':'%'+_0x305ccb['query'][_0xb8e6('0x34')]+'%'};return _0x648630;}})});}_0xe71b00=_['merge']({},_0xe71b00,_0x305ccb['options']);var _0x81b932={'where':_0xe71b00[_0xb8e6('0x32')]};return db[_0xb8e6('0x24')]['count'](_0x81b932)[_0xb8e6('0x1c')](function(_0xb28e94){_0x37b70d[_0xb8e6('0x18')]=_0xb28e94;if(_0x305ccb[_0xb8e6('0x29')][_0xb8e6('0x38')]){_0xe71b00[_0xb8e6('0x39')]=[{'all':!![]}];}return db['Network'][_0xb8e6('0x3a')](_0xe71b00);})[_0xb8e6('0x1c')](function(_0x4b6d80){_0x37b70d[_0xb8e6('0x3b')]=_0x4b6d80;return _0x37b70d;})['then'](respondWithFilteredResult(_0x4e724a,_0xe71b00))[_0xb8e6('0x3c')](handleError(_0x4e724a,null));};exports['show']=function(_0x13e77e,_0x2d9919){var _0x3b935d={'raw':!![],'where':{'id':_0x13e77e[_0xb8e6('0x3d')]['id']}},_0x5975e9={};_0x5975e9[_0xb8e6('0x28')]=_[_0xb8e6('0x3e')](db[_0xb8e6('0x24')][_0xb8e6('0x25')]);_0x5975e9[_0xb8e6('0x29')]=_['keys'](_0x13e77e[_0xb8e6('0x29')]);_0x5975e9['filters']=_['intersection'](_0x5975e9[_0xb8e6('0x28')],_0x5975e9[_0xb8e6('0x29')]);_0x3b935d[_0xb8e6('0x2c')]=_[_0xb8e6('0x2b')](_0x5975e9[_0xb8e6('0x28')],qs['fields'](_0x13e77e[_0xb8e6('0x29')]['fields']));_0x3b935d[_0xb8e6('0x2c')]=_0x3b935d['attributes'][_0xb8e6('0x2e')]?_0x3b935d['attributes']:_0x5975e9[_0xb8e6('0x28')];if(_0x13e77e[_0xb8e6('0x29')][_0xb8e6('0x38')]){_0x3b935d[_0xb8e6('0x39')]=[{'all':!![]}];}_0x3b935d=_[_0xb8e6('0x35')]({},_0x3b935d,_0x13e77e[_0xb8e6('0x3f')]);return db[_0xb8e6('0x24')][_0xb8e6('0x40')](_0x3b935d)[_0xb8e6('0x1c')](handleEntityNotFound(_0x2d9919,null))[_0xb8e6('0x1c')](respondWithResult(_0x2d9919,null))[_0xb8e6('0x3c')](handleError(_0x2d9919,null));};exports[_0xb8e6('0x41')]=function(_0x16f9c3,_0x30bce3){var _0x5e7a06;return db[_0xb8e6('0x24')][_0xb8e6('0x41')](_0x16f9c3[_0xb8e6('0x42')],{'raw':!![]})[_0xb8e6('0x1c')](function(_0x2da64f){_0x5e7a06=_0x2da64f;return db[_0xb8e6('0x24')][_0xb8e6('0x3a')]({'where':{'type':_0x16f9c3[_0xb8e6('0x42')][_0xb8e6('0x36')]},'raw':!![]});})[_0xb8e6('0x1c')](function(_0x5229b9){if(_0x5e7a06[_0xb8e6('0x36')][_0xb8e6('0x43')]()==_0xb8e6('0x44')){var _0x2149d2=fs['readFileSync'](path['join'](config[_0xb8e6('0x45')],_0xb8e6('0x46')),_0xb8e6('0x47'));var _0x4daa00=ejs[_0xb8e6('0x48')](_0x2149d2,{'networks':_0x5229b9||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4daa00);return respondWithRpcPromise(_0xb8e6('0x49'),'create',{'module':'res_stun_monitor.so'});}else if(_0x5e7a06[_0xb8e6('0x36')]['toUpperCase']()=='TURN'){var _0x23fcd4=fs[_0xb8e6('0x4a')](path[_0xb8e6('0x4b')](config['root'],_0xb8e6('0x4c')),'utf8');var _0x301f5d=ejs[_0xb8e6('0x48')](_0x23fcd4,{'networks':_0x5229b9||[]});fs['writeFileSync'](_0xb8e6('0x4d'),_0x301f5d);return respondWithRpcPromise(_0xb8e6('0x49'),_0xb8e6('0x41'),{'module':'res_stun_monitor.so'});}else{var _0x38d3fb=fs[_0xb8e6('0x4a')](path[_0xb8e6('0x4b')](config[_0xb8e6('0x45')],_0xb8e6('0x4e')),_0xb8e6('0x47'));var _0x416c49=ejs[_0xb8e6('0x48')](_0x38d3fb,{'networks':_0x5229b9||[]});fs[_0xb8e6('0x4f')](util[_0xb8e6('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x16f9c3['body'][_0xb8e6('0x36')][_0xb8e6('0x51')]()),_0x416c49);return respondWithRpcPromise(_0xb8e6('0x49'),'create',{'module':'chan_sip.so'});}})['then'](function(){return _0x5e7a06;})[_0xb8e6('0x1c')](respondWithResult(_0x30bce3,0xc9))[_0xb8e6('0x3c')](handleError(_0x30bce3,null));};exports['update']=function(_0x3ddadb,_0x4214c3){var _0x499705;return db[_0xb8e6('0x24')][_0xb8e6('0x40')]({'where':{'id':_0x3ddadb[_0xb8e6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4214c3,null))[_0xb8e6('0x1c')](saveUpdates(_0x3ddadb[_0xb8e6('0x42')],null))[_0xb8e6('0x1c')](function(_0x4f3655){if(_0x4f3655){_0x499705=_0x4f3655;return db[_0xb8e6('0x24')][_0xb8e6('0x3a')]({'where':{'type':_0x499705[_0xb8e6('0x36')]},'raw':!![]});}return null;})['then'](function(_0x1b7b73){if(_0x499705[_0xb8e6('0x36')]['toUpperCase']()=='STUN'){var _0x2e7521=fs['readFileSync'](path[_0xb8e6('0x4b')](config[_0xb8e6('0x45')],_0xb8e6('0x46')),'utf8');var _0x12061c=ejs['render'](_0x2e7521,{'networks':_0x1b7b73||[]});fs['writeFileSync'](_0xb8e6('0x52'),_0x12061c);return respondWithRpcPromise(_0xb8e6('0x49'),'update',{'module':_0xb8e6('0x53')});}else if(_0x499705['type'][_0xb8e6('0x43')]()==_0xb8e6('0x54')){var _0x4a659e=fs[_0xb8e6('0x4a')](path[_0xb8e6('0x4b')](config[_0xb8e6('0x45')],_0xb8e6('0x4c')),_0xb8e6('0x47'));var _0x39f543=ejs['render'](_0x4a659e,{'networks':_0x1b7b73||[]});fs['writeFileSync'](_0xb8e6('0x4d'),_0x39f543);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else{var _0x4d9a3c=fs[_0xb8e6('0x4a')](path[_0xb8e6('0x4b')](config['root'],_0xb8e6('0x4e')),'utf8');var _0x3b3634=ejs['render'](_0x4d9a3c,{'networks':_0x1b7b73||[]});fs['writeFileSync'](util['format'](_0xb8e6('0x55'),_0x3ddadb['body']['type'][_0xb8e6('0x51')]()),_0x3b3634);return respondWithRpcPromise(_0xb8e6('0x49'),'update',{'module':'chan_sip.so'});}})[_0xb8e6('0x1c')](function(_0xeb6f91){if(_0xeb6f91){return _0x499705;}return null;})['then'](respondWithResult(_0x4214c3,null))[_0xb8e6('0x3c')](handleError(_0x4214c3,null));};exports[_0xb8e6('0x56')]=function(_0x316ff8,_0x4fa84f){var _0x5ba4cd;return db[_0xb8e6('0x24')]['find']({'where':{'id':_0x316ff8[_0xb8e6('0x3d')]['id']}})[_0xb8e6('0x1c')](function(_0x1650bf){_0x5ba4cd=_0x1650bf;return _0x1650bf;})['then'](handleEntityNotFound(_0x4fa84f,null))['then'](removeEntity(_0x4fa84f,null))[_0xb8e6('0x1c')](function(){if(_0x5ba4cd){return db[_0xb8e6('0x24')][_0xb8e6('0x3a')]({'where':{'type':_0x5ba4cd['type']},'raw':!![]});}})[_0xb8e6('0x1c')](function(_0x38c2e3){if(_0x5ba4cd['type'][_0xb8e6('0x43')]()==_0xb8e6('0x44')){var _0x45a1ad=fs['readFileSync'](path[_0xb8e6('0x4b')](config['root'],_0xb8e6('0x46')),_0xb8e6('0x47'));var _0x325621=ejs['render'](_0x45a1ad,{'networks':_0x38c2e3||[]});fs[_0xb8e6('0x4f')](_0xb8e6('0x52'),_0x325621);return respondWithRpcPromise('Reload',_0xb8e6('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x5ba4cd[_0xb8e6('0x36')][_0xb8e6('0x43')]()==_0xb8e6('0x54')){var _0x3ad2b=fs[_0xb8e6('0x4a')](path[_0xb8e6('0x4b')](config[_0xb8e6('0x45')],_0xb8e6('0x4c')),'utf8');var _0x4ba58c=ejs[_0xb8e6('0x48')](_0x3ad2b,{'networks':_0x38c2e3||[]});fs[_0xb8e6('0x4f')]('/etc/asterisk/turn_xcally.conf',_0x4ba58c);return respondWithRpcPromise(_0xb8e6('0x49'),_0xb8e6('0x56'),{'module':_0xb8e6('0x53')});}else{var _0x291580=fs['readFileSync'](path[_0xb8e6('0x4b')](config['root'],_0xb8e6('0x4e')),_0xb8e6('0x47'));var _0x2c7792=ejs['render'](_0x291580,{'networks':_0x38c2e3||[]});fs['writeFileSync'](util[_0xb8e6('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x5ba4cd['type']['toLowerCase']()),_0x2c7792);return respondWithRpcPromise(_0xb8e6('0x49'),_0xb8e6('0x56'),{'module':_0xb8e6('0x57')});}})[_0xb8e6('0x3c')](handleError(_0x4fa84f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 89b65ce..727a107 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 _0x37f8=['Network','network','util','../../config/logger','api','moment','request-promise','define'];(function(_0x10e5ec,_0x3568bb){var _0x19b8ce=function(_0xe6660c){while(--_0xe6660c){_0x10e5ec['push'](_0x10e5ec['shift']());}};_0x19b8ce(++_0x3568bb);}(_0x37f8,0xd2));var _0x837f=function(_0x415c7a,_0x95e6c7){_0x415c7a=_0x415c7a-0x0;var _0x207b3f=_0x37f8[_0x415c7a];return _0x207b3f;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var logger=require(_0x837f('0x1'))(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require('bluebird');var rp=require(_0x837f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x19c939,_0x42986f){return _0x19c939[_0x837f('0x5')](_0x837f('0x6'),attributes,{'tableName':_0x837f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b02=['define','Network','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x599270,_0xecf175){var _0x2ebc60=function(_0x31bac3){while(--_0x31bac3){_0x599270['push'](_0x599270['shift']());}};_0x2ebc60(++_0xecf175);}(_0x5b02,0xe9));var _0x25b0=function(_0x104217,_0x59ce75){_0x104217=_0x104217-0x0;var _0x2efa40=_0x5b02[_0x104217];return _0x2efa40;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),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 5de8c54..ff1be6e 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37ce9a,_0x2051f3){var _0x41c7cc=function(_0x3ddf45){while(--_0x3ddf45){_0x37ce9a['push'](_0x37ce9a['shift']());}};_0x41c7cc(++_0x2051f3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x374220,_0x5c6b2d){_0x374220=_0x374220-0x0;var _0x4eca8a=_0x7a54[_0x374220];return _0x4eca8a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 42c4ad6..f6bcb61 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 _0x4460=['../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/users','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x4460,0x19e));var _0x0446=function(_0x49f35f,_0x5add21){_0x49f35f=_0x49f35f-0x0;var _0x317e9c=_0x4460[_0x49f35f];return _0x317e9c;};'use strict';var multer=require(_0x0446('0x0'));var util=require(_0x0446('0x1'));var path=require(_0x0446('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0446('0x3')]();var fs_extra=require(_0x0446('0x4'));var auth=require(_0x0446('0x5'));var interaction=require(_0x0446('0x6'));var config=require(_0x0446('0x7'));var controller=require(_0x0446('0x8'));router[_0x0446('0x9')]('/',auth[_0x0446('0xa')](),controller[_0x0446('0xb')]);router[_0x0446('0x9')](_0x0446('0xc'),auth[_0x0446('0xa')](),controller[_0x0446('0xd')]);router[_0x0446('0x9')](_0x0446('0xe'),auth[_0x0446('0xa')](),controller[_0x0446('0xf')]);router[_0x0446('0x9')](_0x0446('0x10'),auth[_0x0446('0xa')](),controller['getDispositions']);router[_0x0446('0x9')](_0x0446('0x11'),auth[_0x0446('0xa')](),controller[_0x0446('0x12')]);router[_0x0446('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0446('0x13')]);router[_0x0446('0x9')](_0x0446('0x14'),auth[_0x0446('0xa')](),controller[_0x0446('0x15')]);router[_0x0446('0x9')]('/:id/users',auth[_0x0446('0xa')](),controller[_0x0446('0x16')]);router[_0x0446('0x17')]('/',auth[_0x0446('0xa')](),controller[_0x0446('0x18')]);router[_0x0446('0x17')](_0x0446('0x10'),auth['isAuthenticated'](),controller[_0x0446('0x19')]);router['post']('/:id/canned_answers',auth[_0x0446('0xa')](),controller[_0x0446('0x1a')]);router['post'](_0x0446('0x1b'),controller[_0x0446('0x1c')]);router[_0x0446('0x17')](_0x0446('0x1d'),auth['isAuthenticated'](),controller[_0x0446('0x1e')]);router[_0x0446('0x17')](_0x0446('0x1f'),auth[_0x0446('0xa')](),controller[_0x0446('0x20')]);router['post']('/:id/send',auth[_0x0446('0xa')](),controller[_0x0446('0x21')]);router[_0x0446('0x22')](_0x0446('0xe'),auth[_0x0446('0xa')](),controller[_0x0446('0x23')]);router[_0x0446('0x24')](_0x0446('0xe'),auth[_0x0446('0xa')](),controller[_0x0446('0x25')]);router[_0x0446('0x24')]('/:id/dispositions',auth[_0x0446('0xa')](),controller[_0x0446('0x26')]);router['delete'](_0x0446('0x11'),auth[_0x0446('0xa')](),controller[_0x0446('0x27')]);router[_0x0446('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0x0446('0x28')]);module[_0x0446('0x29')]=router; \ No newline at end of file +var _0x1b6c=['/:id/interactions','getInteractions','post','create','addDisposition','addApplications','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x42ce5c,_0x4f7399){var _0x242302=function(_0x5a8ae8){while(--_0x5a8ae8){_0x42ce5c['push'](_0x42ce5c['shift']());}};_0x242302(++_0x4f7399);}(_0x1b6c,0x1c0));var _0xc1b6=function(_0x359e4d,_0xf04805){_0x359e4d=_0x359e4d-0x0;var _0x2b5f45=_0x1b6c[_0x359e4d];return _0x2b5f45;};'use strict';var multer=require('multer');var util=require(_0xc1b6('0x0'));var path=require(_0xc1b6('0x1'));var timeout=require(_0xc1b6('0x2'));var express=require(_0xc1b6('0x3'));var router=express[_0xc1b6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1b6('0x5'));var interaction=require(_0xc1b6('0x6'));var config=require('../../config/environment');var controller=require(_0xc1b6('0x7'));router[_0xc1b6('0x8')]('/',auth[_0xc1b6('0x9')](),controller[_0xc1b6('0xa')]);router[_0xc1b6('0x8')](_0xc1b6('0xb'),auth['isAuthenticated'](),controller[_0xc1b6('0xc')]);router[_0xc1b6('0x8')](_0xc1b6('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xc1b6('0x8')](_0xc1b6('0xe'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0xf')]);router[_0xc1b6('0x8')](_0xc1b6('0x10'),auth['isAuthenticated'](),controller[_0xc1b6('0x11')]);router[_0xc1b6('0x8')](_0xc1b6('0x12'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x13')]);router['get'](_0xc1b6('0x14'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x15')]);router[_0xc1b6('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xc1b6('0x16')]('/',auth['isAuthenticated'](),controller[_0xc1b6('0x17')]);router[_0xc1b6('0x16')](_0xc1b6('0xe'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x18')]);router['post']('/:id/canned_answers',auth[_0xc1b6('0x9')](),controller['addAnswer']);router[_0xc1b6('0x16')]('/:id/notify',controller['notify']);router[_0xc1b6('0x16')]('/:id/applications',auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x19')]);router['post'](_0xc1b6('0x1a'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x1b')]);router[_0xc1b6('0x16')]('/:id/send',auth[_0xc1b6('0x9')](),controller['send']);router[_0xc1b6('0x1c')]('/:id',auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x1d')]);router[_0xc1b6('0x1e')](_0xc1b6('0xd'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x1f')]);router[_0xc1b6('0x1e')](_0xc1b6('0xe'),auth['isAuthenticated'](),controller[_0xc1b6('0x20')]);router[_0xc1b6('0x1e')](_0xc1b6('0x10'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x21')]);router[_0xc1b6('0x1e')](_0xc1b6('0x1a'),auth[_0xc1b6('0x9')](),controller[_0xc1b6('0x22')]);module[_0xc1b6('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index bcb0a9f..d27c660 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 _0x53c1=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x3bda9b,_0x4fbd5b){var _0x114de4=function(_0x539c88){while(--_0x539c88){_0x3bda9b['push'](_0x3bda9b['shift']());}};_0x114de4(++_0x4fbd5b);}(_0x53c1,0x1d9));var _0x153c=function(_0x5e37ef,_0x5f4ef3){_0x5e37ef=_0x5e37ef-0x0;var _0x47196c=_0x53c1[_0x5e37ef];return _0x47196c;};'use strict';var Sequelize=require(_0x153c('0x0'));var rs=require(_0x153c('0x1'));module['exports']={'name':{'type':Sequelize[_0x153c('0x2')],'unique':_0x153c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x153c('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x153c('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x153c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x153c('0x4')],'defaultValue':function(){return _0x153c('0x5');}},'notificationSound':{'type':Sequelize[_0x153c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x153c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x153c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x153c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x153c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x153c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x153c('0x6')],'defaultValue':![],'comment':_0x153c('0x9'),'set':function(_0x2d8fea){if(!_0x2d8fea)this['setDataValue'](_0x153c('0xa'),null);this[_0x153c('0xb')](_0x153c('0xc'),_0x2d8fea);}}}; \ No newline at end of file +var _0xe35a=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','STRING','name','generate'];(function(_0x40e83f,_0x4f467a){var _0x17207f=function(_0xbeb1f0){while(--_0xbeb1f0){_0x40e83f['push'](_0x40e83f['shift']());}};_0x17207f(++_0x4f467a);}(_0xe35a,0x15d));var _0xae35=function(_0x4bd64d,_0x3c2b8a){_0x4bd64d=_0x4bd64d-0x0;var _0x37db2d=_0xe35a[_0x4bd64d];return _0x37db2d;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xae35('0x0')],'unique':_0xae35('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xae35('0x0')]},'token':{'type':Sequelize[_0xae35('0x0')],'defaultValue':function(){return rs[_0xae35('0x2')]();}},'replyUri':{'type':Sequelize[_0xae35('0x0')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xae35('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xae35('0x3')],'defaultValue':function(){return _0xae35('0x4');}},'notificationSound':{'type':Sequelize[_0xae35('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xae35('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae35('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xae35('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae35('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae35('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae35('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xae35('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xae35('0x5')],'defaultValue':![],'comment':_0xae35('0x8'),'set':function(_0x43f8d1){if(!_0x43f8d1)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xae35('0x9')](_0xae35('0xa'),_0x43f8d1);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0e7e433..af2eba9 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 _0xb091=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','end','stack','name','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','OpenchannelAccount','includeAll','include','findAll','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','ListId','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','autoclose','close','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash'];(function(_0x183e8c,_0x342e9e){var _0x25af6b=function(_0x330fe4){while(--_0x330fe4){_0x183e8c['push'](_0x183e8c['shift']());}};_0x25af6b(++_0x342e9e);}(_0xb091,0x16e));var _0x1b09=function(_0x26a9f1,_0x409447){_0x26a9f1=_0x26a9f1-0x0;var _0x44c4b7=_0xb091[_0x26a9f1];return _0x44c4b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b09('0x0'));var zipdir=require(_0x1b09('0x1'));var jsonpatch=require(_0x1b09('0x2'));var rp=require(_0x1b09('0x3'));var moment=require('moment');var BPromise=require(_0x1b09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b09('0x5'));var sox=require(_0x1b09('0x6'));var csv=require('to-csv');var ejs=require(_0x1b09('0x7'));var fs=require('fs');var fs_extra=require(_0x1b09('0x8'));var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0xd'));var querystring=require(_0x1b09('0xe'));var Papa=require(_0x1b09('0xf'));var Redis=require(_0x1b09('0x10'));var authService=require(_0x1b09('0x11'));var qs=require(_0x1b09('0x12'));var as=require(_0x1b09('0x13'));var hardwareService=require(_0x1b09('0x14'));var logger=require('../../config/logger')(_0x1b09('0x15'));var utils=require(_0x1b09('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x17'))['db'];config[_0x1b09('0x18')]=_[_0x1b09('0x19')](config[_0x1b09('0x18')],{'host':_0x1b09('0x1a'),'port':0x18eb});var socket=require(_0x1b09('0x1b'))(new Redis(config[_0x1b09('0x18')]));require('./openchannelAccount.socket')[_0x1b09('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1b09('0x1d')][_0x1b09('0x1e')]({'port':0x232c});var client9002=jayson[_0x1b09('0x1d')][_0x1b09('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x10b7eb,_0x1dc96b,_0x64689a,_0x33129b){return new BPromise(function(_0x1196b2,_0x32244e){var _0x311158=_0x33129b||client;return _0x311158[_0x1b09('0x1f')](_0x10b7eb,_0x64689a)[_0x1b09('0x20')](function(_0x4c64e1){logger[_0x1b09('0x21')](_0x1b09('0x22'),_0x1dc96b,'request\x20sent');logger['debug'](_0x1b09('0x23'),_0x1dc96b,'request\x20sent',JSON[_0x1b09('0x24')](_0x4c64e1));if(_0x4c64e1['error']){if(_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x26')]===0x1f4){logger[_0x1b09('0x25')](_0x1b09('0x22'),_0x1dc96b,_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x27')]);return _0x32244e(_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x27')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1dc96b,_0x4c64e1[_0x1b09('0x25')][_0x1b09('0x27')]);return _0x1196b2(_0x4c64e1['error'][_0x1b09('0x27')]);}else{logger[_0x1b09('0x21')](_0x1b09('0x22'),_0x1dc96b,_0x1b09('0x28'));_0x1196b2(_0x4c64e1['result'][_0x1b09('0x27')]);}})[_0x1b09('0x29')](function(_0x4936d0){logger[_0x1b09('0x25')](_0x1b09('0x22'),_0x1dc96b,_0x4936d0);_0x32244e(_0x4936d0);});});}function respondWithStatusCode(_0x4dd3e5,_0x13c89c){_0x13c89c=_0x13c89c||0xcc;return function(_0x108d80){if(_0x108d80){return _0x4dd3e5[_0x1b09('0x2a')](_0x13c89c);}return _0x4dd3e5[_0x1b09('0x2b')](_0x13c89c)['end']();};}function respondWithResult(_0xb3cf07,_0x3cdbc5){_0x3cdbc5=_0x3cdbc5||0xc8;return function(_0x532589){if(_0x532589){return _0xb3cf07[_0x1b09('0x2b')](_0x3cdbc5)[_0x1b09('0x2c')](_0x532589);}};}function respondWithFilteredResult(_0x26befb,_0x1cbbd5){return function(_0x11098e){if(_0x11098e){var _0x1aa179=typeof _0x1cbbd5[_0x1b09('0x2d')]==='undefined'&&typeof _0x1cbbd5[_0x1b09('0x2e')]===_0x1b09('0x2f');var _0x4bf0ad=_0x11098e[_0x1b09('0x30')];var _0x1a6130=_0x1aa179?0x0:_0x1cbbd5[_0x1b09('0x2d')];var _0x122b1c=_0x1aa179?_0x11098e[_0x1b09('0x30')]:_0x1cbbd5['offset']+_0x1cbbd5[_0x1b09('0x2e')];var _0x54bf30;if(_0x122b1c>=_0x4bf0ad){_0x122b1c=_0x4bf0ad;_0x54bf30=0xc8;}else{_0x54bf30=0xce;}_0x26befb[_0x1b09('0x2b')](_0x54bf30);return _0x26befb['set'](_0x1b09('0x31'),_0x1a6130+'-'+_0x122b1c+'/'+_0x4bf0ad)[_0x1b09('0x2c')](_0x11098e);}return null;};}function patchUpdates(_0x381e76){return function(_0x2cf3cb){try{jsonpatch[_0x1b09('0x32')](_0x2cf3cb,_0x381e76,!![]);}catch(_0x8d76b9){return BPromise[_0x1b09('0x33')](_0x8d76b9);}return _0x2cf3cb[_0x1b09('0x34')]();};}function saveUpdates(_0x2db0e0,_0x33bca2){return function(_0x5003f8){if(_0x5003f8){return _0x5003f8[_0x1b09('0x35')](_0x2db0e0)[_0x1b09('0x20')](function(_0x23b8d9){return _0x23b8d9;});}return null;};}function removeEntity(_0x54c0a2,_0x4b9ada){return function(_0x339b66){if(_0x339b66){return _0x339b66[_0x1b09('0x36')]()[_0x1b09('0x20')](function(){var _0x12a720=_0x339b66[_0x1b09('0x37')]({'plain':!![]});var _0x31eb3f=_0x1b09('0x38');return db['UserProfileResource'][_0x1b09('0x36')]({'where':{'type':_0x31eb3f,'resourceId':_0x12a720['id']}})['then'](function(){return _0x339b66;});})[_0x1b09('0x20')](function(){_0x54c0a2['status'](0xcc)[_0x1b09('0x39')]();});}};}function handleEntityNotFound(_0x278aa8,_0x46e202){return function(_0x2ba156){if(!_0x2ba156){_0x278aa8[_0x1b09('0x2a')](0x194);}return _0x2ba156;};}function handleError(_0x37f240,_0x659067){_0x659067=_0x659067||0x1f4;return function(_0x466502){logger[_0x1b09('0x25')](_0x466502[_0x1b09('0x3a')]);if(_0x466502[_0x1b09('0x3b')]){delete _0x466502[_0x1b09('0x3b')];}_0x37f240[_0x1b09('0x2b')](_0x659067)['send'](_0x466502);};}exports['index']=function(_0x23ce9a,_0xb2ef05){var _0x27a78c={'include':[{'model':db[_0x1b09('0x3c')],'as':_0x1b09('0x3d')}]},_0x2470a0={},_0x147c2b={'count':0x0,'rows':[]};var _0x33d697=_['map'](db['OpenchannelAccount'][_0x1b09('0x3e')],function(_0x51d5eb){return{'name':_0x51d5eb[_0x1b09('0x3f')],'type':_0x51d5eb[_0x1b09('0x40')][_0x1b09('0x41')]};});_0x2470a0['model']=_[_0x1b09('0x42')](_0x33d697,_0x1b09('0x3b'));_0x2470a0[_0x1b09('0x43')]=_['keys'](_0x23ce9a[_0x1b09('0x43')]);_0x2470a0[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x2470a0[_0x1b09('0x46')],_0x2470a0['query']);_0x27a78c[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x2470a0['model'],qs[_0x1b09('0x48')](_0x23ce9a[_0x1b09('0x43')]['fields']));_0x27a78c['attributes']=_0x27a78c['attributes']['length']?_0x27a78c[_0x1b09('0x47')]:_0x2470a0[_0x1b09('0x46')];if(!_0x23ce9a[_0x1b09('0x43')]['hasOwnProperty'](_0x1b09('0x49'))){_0x27a78c[_0x1b09('0x2e')]=qs['limit'](_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x27a78c[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x2d')]);}_0x27a78c[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x27a78c['where']=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x23ce9a[_0x1b09('0x43')],_0x2470a0['filters']),_0x33d697);if(_0x23ce9a[_0x1b09('0x43')]['filter']){_0x27a78c[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x27a78c['where'],{'$or':_[_0x1b09('0x42')](_0x33d697,function(_0x9be1a){if(_0x9be1a[_0x1b09('0x40')]!==_0x1b09('0x4f')){var _0x13294c={};_0x13294c[_0x9be1a[_0x1b09('0x3b')]]={'$like':'%'+_0x23ce9a['query'][_0x1b09('0x50')]+'%'};return _0x13294c;}})});}_0x27a78c=_['merge']({},_0x27a78c,_0x23ce9a[_0x1b09('0x51')]);var _0x58a158={'where':_0x27a78c['where']};return db[_0x1b09('0x52')][_0x1b09('0x30')](_0x58a158)[_0x1b09('0x20')](function(_0xa2b80f){_0x147c2b[_0x1b09('0x30')]=_0xa2b80f;if(_0x23ce9a[_0x1b09('0x43')][_0x1b09('0x53')]){_0x27a78c[_0x1b09('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1b09('0x55')](_0x27a78c);})[_0x1b09('0x20')](function(_0x21b4c2){_0x147c2b['rows']=_0x21b4c2;return _0x147c2b;})['then'](respondWithFilteredResult(_0xb2ef05,_0x27a78c))[_0x1b09('0x29')](handleError(_0xb2ef05,null));};exports['show']=function(_0x2abc94,_0x3e3dc2){var _0x49b051={'raw':![],'where':{'id':_0x2abc94[_0x1b09('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x1b09('0x3d')}]},_0x17378b={};_0x17378b[_0x1b09('0x46')]=_[_0x1b09('0x57')](db[_0x1b09('0x52')][_0x1b09('0x3e')]);_0x17378b['query']=_[_0x1b09('0x57')](_0x2abc94[_0x1b09('0x43')]);_0x17378b[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x17378b[_0x1b09('0x46')],_0x17378b[_0x1b09('0x43')]);_0x49b051[_0x1b09('0x47')]=_['intersection'](_0x17378b['model'],qs[_0x1b09('0x48')](_0x2abc94[_0x1b09('0x43')][_0x1b09('0x48')]));_0x49b051['attributes']=_0x49b051[_0x1b09('0x47')][_0x1b09('0x58')]?_0x49b051[_0x1b09('0x47')]:_0x17378b['model'];if(_0x2abc94[_0x1b09('0x43')][_0x1b09('0x53')]){_0x49b051[_0x1b09('0x54')]=[{'all':!![]}];}_0x49b051=_[_0x1b09('0x4e')]({},_0x49b051,_0x2abc94[_0x1b09('0x51')]);return db[_0x1b09('0x52')][_0x1b09('0x59')](_0x49b051)[_0x1b09('0x20')](handleEntityNotFound(_0x3e3dc2,null))[_0x1b09('0x20')](respondWithResult(_0x3e3dc2,null))[_0x1b09('0x29')](handleError(_0x3e3dc2,null));};exports[_0x1b09('0x5a')]=function(_0x114ac3,_0x1950ab){return db[_0x1b09('0x52')][_0x1b09('0x5a')](_0x114ac3['body'],{})['then'](function(_0x2cc31e){var _0x54efba=_0x114ac3[_0x1b09('0x5b')][_0x1b09('0x37')]({'plain':!![]});if(!_0x54efba)throw new Error(_0x1b09('0x5c'));if(_0x54efba['role']==='user'){var _0x2cb7ba=_0x2cc31e[_0x1b09('0x37')]({'plain':!![]});var _0x5ad730=_0x1b09('0x38');return db[_0x1b09('0x5d')][_0x1b09('0x59')]({'where':{'name':_0x5ad730,'userProfileId':_0x54efba[_0x1b09('0x5e')]},'raw':!![]})[_0x1b09('0x20')](function(_0x1f8f1c){if(_0x1f8f1c&&_0x1f8f1c[_0x1b09('0x5f')]===0x0){return db['UserProfileResource'][_0x1b09('0x5a')]({'name':_0x2cb7ba['name'],'resourceId':_0x2cb7ba['id'],'type':_0x1f8f1c[_0x1b09('0x3b')],'sectionId':_0x1f8f1c['id']},{})[_0x1b09('0x20')](function(){return _0x2cc31e;});}else{return _0x2cc31e;}})[_0x1b09('0x29')](function(_0x3aa271){logger[_0x1b09('0x25')](_0x1b09('0x60'),_0x3aa271);throw _0x3aa271;});}return _0x2cc31e;})[_0x1b09('0x20')](respondWithResult(_0x1950ab,0xc9))[_0x1b09('0x29')](handleError(_0x1950ab,null));};exports[_0x1b09('0x35')]=function(_0x3e1dba,_0x391790){if(_0x3e1dba[_0x1b09('0x61')]['id']){delete _0x3e1dba['body']['id'];}return db['OpenchannelAccount'][_0x1b09('0x59')]({'where':{'id':_0x3e1dba[_0x1b09('0x56')]['id']},'include':[{'model':db[_0x1b09('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x1b09('0x20')](handleEntityNotFound(_0x391790,null))[_0x1b09('0x20')](saveUpdates(_0x3e1dba[_0x1b09('0x61')],null))['then'](respondWithResult(_0x391790,null))[_0x1b09('0x29')](handleError(_0x391790,null));};exports[_0x1b09('0x36')]=function(_0x187a11,_0x49b7b6){return db[_0x1b09('0x52')]['find']({'where':{'id':_0x187a11['params']['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x49b7b6,null))[_0x1b09('0x20')](removeEntity(_0x49b7b6,null))[_0x1b09('0x29')](handleError(_0x49b7b6,null));};exports['describe']=function(_0x345b99,_0x49ec3f){return db[_0x1b09('0x52')][_0x1b09('0x62')]()['then'](respondWithResult(_0x49ec3f,null))[_0x1b09('0x29')](handleError(_0x49ec3f,null));};exports['addDisposition']=function(_0x2bd18b,_0x2a537d,_0x52b5cf){if(_0x2bd18b[_0x1b09('0x61')]['id']){delete _0x2bd18b[_0x1b09('0x61')]['id'];}return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0x2bd18b[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x2a537d,null))[_0x1b09('0x20')](function(_0x576060){if(_0x576060){_0x2bd18b[_0x1b09('0x61')][_0x1b09('0x63')]=_0x576060['id'];return db[_0x1b09('0x64')]['create'](_0x2bd18b[_0x1b09('0x61')]);}})[_0x1b09('0x20')](respondWithResult(_0x2a537d,null))[_0x1b09('0x29')](handleError(_0x2a537d,null));};exports[_0x1b09('0x65')]=function(_0x25fca8,_0x5051dc,_0x130fdf){var _0x598302={'raw':![],'where':{}};var _0x3261bc={};var _0x417875={'count':0x0,'rows':[]};return db[_0x1b09('0x52')][_0x1b09('0x66')]({'where':{'id':_0x25fca8[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x5051dc,null))[_0x1b09('0x20')](function(_0x3db691){if(_0x3db691){_0x3261bc['model']=_[_0x1b09('0x57')](db[_0x1b09('0x64')]['rawAttributes']);_0x3261bc[_0x1b09('0x43')]=_[_0x1b09('0x57')](_0x25fca8[_0x1b09('0x43')]);_0x3261bc[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x3261bc[_0x1b09('0x46')],_0x3261bc[_0x1b09('0x43')]);_0x598302[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x3261bc['model'],qs[_0x1b09('0x48')](_0x25fca8[_0x1b09('0x43')][_0x1b09('0x48')]));_0x598302[_0x1b09('0x47')]=_0x598302[_0x1b09('0x47')]['length']?_0x598302[_0x1b09('0x47')]:_0x3261bc[_0x1b09('0x46')];if(!_0x25fca8['query'][_0x1b09('0x67')]('nolimit')){_0x598302[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x25fca8[_0x1b09('0x43')]['limit']);_0x598302['offset']=qs['offset'](_0x25fca8[_0x1b09('0x43')][_0x1b09('0x2d')]);}_0x598302[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x25fca8[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x598302[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x25fca8[_0x1b09('0x43')],_0x3261bc[_0x1b09('0x44')]));_0x598302[_0x1b09('0x4d')]['OpenchannelAccountId']=_0x3db691['id'];if(_0x25fca8['query'][_0x1b09('0x50')]){_0x598302[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x598302[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x598302[_0x1b09('0x47')],function(_0x162de1){var _0x52f219={};_0x52f219[_0x162de1]={'$like':'%'+_0x25fca8[_0x1b09('0x43')][_0x1b09('0x50')]+'%'};return _0x52f219;})});}_0x598302=_[_0x1b09('0x4e')]({},_0x598302,_0x25fca8['options']);return db[_0x1b09('0x64')][_0x1b09('0x30')]({'where':_0x598302[_0x1b09('0x4d')]})[_0x1b09('0x20')](function(_0x2d95b1){_0x417875['count']=_0x2d95b1;if(_0x25fca8['query'][_0x1b09('0x53')]){_0x598302[_0x1b09('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x1b09('0x55')](_0x598302);})['then'](function(_0x3b66fc){_0x417875[_0x1b09('0x68')]=_0x3b66fc;return _0x417875;});}})[_0x1b09('0x20')](respondWithFilteredResult(_0x5051dc,_0x598302))['catch'](handleError(_0x5051dc,null));};exports[_0x1b09('0x69')]=function(_0x4c504d,_0x4c4b37,_0xaabf59){return db['OpenchannelAccount']['find']({'where':{'id':_0x4c504d['params']['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x4c4b37,null))[_0x1b09('0x20')](function(_0x24efd0){if(_0x24efd0){return _0x24efd0[_0x1b09('0x69')](_0x4c504d['query'][_0x1b09('0x6a')]);}})[_0x1b09('0x20')](respondWithStatusCode(_0x4c4b37,null))[_0x1b09('0x29')](handleError(_0x4c4b37,null));};exports[_0x1b09('0x6b')]=function(_0x388bf5,_0x4e1562,_0x3dd3ea){if(_0x388bf5[_0x1b09('0x61')]['id']){delete _0x388bf5[_0x1b09('0x61')]['id'];}return db[_0x1b09('0x52')]['find']({'where':{'id':_0x388bf5['params']['id']}})['then'](handleEntityNotFound(_0x4e1562,null))[_0x1b09('0x20')](function(_0x419add){if(_0x419add){_0x388bf5[_0x1b09('0x61')][_0x1b09('0x63')]=_0x419add['id'];return db[_0x1b09('0x6c')][_0x1b09('0x5a')](_0x388bf5['body']);}})[_0x1b09('0x20')](respondWithResult(_0x4e1562,null))[_0x1b09('0x29')](handleError(_0x4e1562,null));};exports['getAnswers']=function(_0x56be94,_0x356d3a,_0xde20b0){var _0x145a82={'raw':![],'where':{}};var _0x49a600={};var _0x5c0c7a={'count':0x0,'rows':[]};return db[_0x1b09('0x52')]['findOne']({'where':{'id':_0x56be94[_0x1b09('0x56')]['id']}})['then'](handleEntityNotFound(_0x356d3a,null))['then'](function(_0x24a450){if(_0x24a450){_0x49a600[_0x1b09('0x46')]=_[_0x1b09('0x57')](db['CannedAnswer'][_0x1b09('0x3e')]);_0x49a600[_0x1b09('0x43')]=_[_0x1b09('0x57')](_0x56be94[_0x1b09('0x43')]);_0x49a600[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x49a600[_0x1b09('0x46')],_0x49a600['query']);_0x145a82[_0x1b09('0x47')]=_['intersection'](_0x49a600[_0x1b09('0x46')],qs[_0x1b09('0x48')](_0x56be94['query'][_0x1b09('0x48')]));_0x145a82[_0x1b09('0x47')]=_0x145a82['attributes']['length']?_0x145a82[_0x1b09('0x47')]:_0x49a600[_0x1b09('0x46')];if(!_0x56be94[_0x1b09('0x43')][_0x1b09('0x67')](_0x1b09('0x49'))){_0x145a82[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x56be94[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x145a82[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x56be94[_0x1b09('0x43')][_0x1b09('0x2d')]);}_0x145a82['order']=qs[_0x1b09('0x4b')](_0x56be94[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x145a82[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x56be94[_0x1b09('0x43')],_0x49a600[_0x1b09('0x44')]));_0x145a82[_0x1b09('0x4d')][_0x1b09('0x63')]=_0x24a450['id'];if(_0x56be94[_0x1b09('0x43')][_0x1b09('0x50')]){_0x145a82[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x145a82[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x145a82['attributes'],function(_0x4ec415){var _0x47f7d2={};_0x47f7d2[_0x4ec415]={'$like':'%'+_0x56be94['query']['filter']+'%'};return _0x47f7d2;})});}_0x145a82=_[_0x1b09('0x4e')]({},_0x145a82,_0x56be94[_0x1b09('0x51')]);return db['CannedAnswer']['count']({'where':_0x145a82[_0x1b09('0x4d')]})[_0x1b09('0x20')](function(_0x36bee8){_0x5c0c7a[_0x1b09('0x30')]=_0x36bee8;if(_0x56be94[_0x1b09('0x43')][_0x1b09('0x53')]){_0x145a82[_0x1b09('0x54')]=[{'all':!![]}];}return db[_0x1b09('0x6c')][_0x1b09('0x55')](_0x145a82);})['then'](function(_0x1c1f2f){_0x5c0c7a[_0x1b09('0x68')]=_0x1c1f2f;return _0x5c0c7a;});}})[_0x1b09('0x20')](respondWithFilteredResult(_0x356d3a,_0x145a82))['catch'](handleError(_0x356d3a,null));};exports[_0x1b09('0x6d')]=function(_0xc65c0e,_0x41ec2b,_0x294866){return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0xc65c0e[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x41ec2b,null))['then'](function(_0x57571b){if(_0x57571b){return _0x57571b[_0x1b09('0x6d')](_0xc65c0e['query']['ids']);}})[_0x1b09('0x20')](respondWithStatusCode(_0x41ec2b,null))[_0x1b09('0x29')](handleError(_0x41ec2b,null));};exports[_0x1b09('0x6e')]=function(_0x166415,_0x913569,_0x46f967){var _0x565223={'body':_0x166415[_0x1b09('0x61')],'channel':'openchannel'};var _0x33991c=[];var _0x3d9adc=[];var _0xcd385a={};var _0x1263d0=![];return db[_0x1b09('0x6f')]['describe']()[_0x1b09('0x20')](function(_0x5e237d){if(!_0x5e237d){throw new db[(_0x1b09('0x70'))][(_0x1b09('0x71'))]('no\x20available\x20attributes');}_0x33991c=_['difference'](_[_0x1b09('0x57')](_0x5e237d),['createdAt',_0x1b09('0x72')]);_0x3d9adc=_[_0x1b09('0x73')](_['keys'](_0x5e237d),[_0x1b09('0x74'),_0x1b09('0x72'),_0x1b09('0x75'),'ListId']);if(_0x166415[_0x1b09('0x61')]['id']){delete _0x166415[_0x1b09('0x61')]['id'];}if(_['isNil'](_0x166415[_0x1b09('0x61')][_0x1b09('0x76')])){throw new db['Sequelize'][(_0x1b09('0x71'))](_0x1b09('0x77'));}if(_[_0x1b09('0x78')](_0x166415[_0x1b09('0x61')]['body'])||_0x166415['body'][_0x1b09('0x61')]===''){throw new db[(_0x1b09('0x70'))]['ValidationError'](_0x1b09('0x79'));}if(_[_0x1b09('0x78')](_0x166415[_0x1b09('0x61')][_0x1b09('0x7a')])){throw new db[(_0x1b09('0x70'))]['ValidationError'](_0x1b09('0x7b')+_0x3d9adc);}if(!_[_0x1b09('0x7c')](_0x3d9adc,_0x166415[_0x1b09('0x61')]['mapKey'])){throw new db[(_0x1b09('0x70'))][(_0x1b09('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d9adc);}_0xcd385a[_0x166415[_0x1b09('0x61')][_0x1b09('0x7a')]]=_0x166415[_0x1b09('0x61')][_0x1b09('0x76')];})[_0x1b09('0x20')](function(){return db[_0x1b09('0x52')]['find']({'where':{'id':_0x166415['params']['id']},'include':[{'model':db[_0x1b09('0x7d')],'as':_0x1b09('0x7e'),'include':[{'model':db[_0x1b09('0x6f')],'as':_0x1b09('0x7f'),'where':_0xcd385a,'limit':0x1,'order':[['updatedAt',_0x1b09('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x1b09('0x81')}]});})['then'](handleEntityNotFound(_0x913569,null))[_0x1b09('0x20')](function(_0x3e14ca){if(_0x3e14ca&&_0x3e14ca[_0x1b09('0x7e')]){_0x565223[_0x1b09('0x82')]=_0x3e14ca;_0x565223[_0x1b09('0x83')]=_0x3e14ca['Applications'];_0x565223[_0x1b09('0x84')]=_0x3e14ca[_0x1b09('0x7e')];_0x565223['applications']=_[_0x1b09('0x85')](_0x565223['applications'],['priority'],['asc']);if(_0x565223[_0x1b09('0x82')]['Applications']){delete _0x565223[_0x1b09('0x82')][_0x1b09('0x81')];}if(_0x565223[_0x1b09('0x82')][_0x1b09('0x7e')]&&_0x565223[_0x1b09('0x82')][_0x1b09('0x7e')][_0x1b09('0x7f')][_0x1b09('0x58')]){return _0x565223[_0x1b09('0x82')][_0x1b09('0x7e')][_0x1b09('0x7f')][0x0];}var _0x44552d=_['defaults'](_0x166415[_0x1b09('0x61')],{'firstName':_0x166415[_0x1b09('0x61')][_0x1b09('0x76')],'ListId':_0x3e14ca[_0x1b09('0x86')]});_0x44552d[_0x166415[_0x1b09('0x61')][_0x1b09('0x7a')]]=_0x166415['body'][_0x1b09('0x76')];return db[_0x1b09('0x6f')][_0x1b09('0x5a')](_0x44552d,{'fields':_0x33991c,'raw':!![]});}})[_0x1b09('0x20')](handleEntityNotFound(_0x913569,null))[_0x1b09('0x20')](function(_0x5d93d7){_0x565223[_0x1b09('0x87')]=_0x5d93d7;if(_0x5d93d7){var _0x37591a={'ContactId':_0x5d93d7['id'],'OpenchannelAccountId':_0x166415[_0x1b09('0x56')]['id'],'from':(_0x5d93d7['firstName']||'')+'\x20'+(_0x5d93d7['lastName']||'')};var _0xf1b0aa={'OpenchannelAccountId':_0x166415[_0x1b09('0x56')]['id'],'closed':![]};if(_0x166415['body']['threadId']){_0xf1b0aa[_0x1b09('0x88')]=_0x166415[_0x1b09('0x61')][_0x1b09('0x88')];return db[_0x1b09('0x89')][_0x1b09('0x59')]({'where':_0xf1b0aa})['then'](function(_0x3bb02e){if(_0x3bb02e){return[_0x3bb02e,![]];}_0x37591a[_0x1b09('0x88')]=_0x166415[_0x1b09('0x61')]['threadId'];_0x37591a['externalUrl']=_0x166415[_0x1b09('0x61')][_0x1b09('0x8a')];return db[_0x1b09('0x89')][_0x1b09('0x5a')](_0x37591a)[_0x1b09('0x20')](function(_0x42af18){return[_0x42af18,!![]];});});}else{_0xf1b0aa[_0x1b09('0x88')]=null;}_0xf1b0aa[_0x1b09('0x8b')]=_0x5d93d7['id'];return db['OpenchannelInteraction'][_0x1b09('0x59')]({'where':_0xf1b0aa})[_0x1b09('0x20')](function(_0x12e8e7){if(_0x12e8e7){return[_0x12e8e7,![]];}return db[_0x1b09('0x89')][_0x1b09('0x5a')](_0x37591a)[_0x1b09('0x20')](function(_0x13115f){return[_0x13115f,!![]];});});}})['spread'](function(_0x3218dd,_0x3f632a){if(_0x3218dd){_0x1263d0=_0x3f632a;if(!_0x3f632a){var _0x32639f={'from':(_0x565223[_0x1b09('0x87')][_0x1b09('0x8c')]||'')+'\x20'+(_0x565223[_0x1b09('0x87')]['lastName']||'')};if(_0x166415[_0x1b09('0x61')]['threadId']&&_0x166415['body'][_0x1b09('0x8d')]&&_0x166415[_0x1b09('0x61')]['threadId']!=_0x166415[_0x1b09('0x61')][_0x1b09('0x8d')]){_0x32639f[_0x1b09('0x88')]=_0x166415[_0x1b09('0x61')][_0x1b09('0x8d')];}return _0x3218dd[_0x1b09('0x35')](_0x32639f);}else{return _0x3218dd;}}})['then'](function(_0x94dbd5){_0x565223[_0x1b09('0x8e')]=_0x94dbd5['get']({'plain':!![]});_0x565223[_0x1b09('0x8e')][_0x1b09('0x8f')]=_0x1263d0;if(_0x565223[_0x1b09('0x8e')][_0x1b09('0x8f')]){if(_0x565223[_0x1b09('0x82')][_0x1b09('0x90')]){_0x565223[_0x1b09('0x83')]['push']({'id':0x0,'priority':_0x565223[_0x1b09('0x83')][_0x1b09('0x58')]+0x1,'app':_0x1b09('0x91'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x1b09('0x92')]['create']({'body':_0x166415[_0x1b09('0x61')][_0x1b09('0x61')],'OpenchannelAccountId':_0x166415[_0x1b09('0x56')]['id'],'OpenchannelInteractionId':_0x94dbd5['id'],'direction':'in','ContactId':_0x565223['contact']['id'],'AttachmentId':_0x166415[_0x1b09('0x61')]['AttachmentId']});})[_0x1b09('0x20')](function(_0x40876a){_0x565223['message']=_0x40876a;if(!_0x565223[_0x1b09('0x8e')][_0x1b09('0x93')])return;return db[_0x1b09('0x94')][_0x1b09('0x59')]({'attributes':['id',_0x1b09('0x3b')],'where':{'id':_0x565223[_0x1b09('0x8e')][_0x1b09('0x93')]}});})['then'](function(_0x32bd9e){if(_0x32bd9e){_0x565223[_0x1b09('0x83')][_0x1b09('0x95')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x32bd9e['name']+','+(_0x565223[_0x1b09('0x82')][_0x1b09('0x96')]||0xa),'interval':_0x1b09('0x97')});}if(!_0x565223[_0x1b09('0x8e')][_0x1b09('0x98')])return;return db[_0x1b09('0x99')][_0x1b09('0x59')]({'attributes':['id',_0x1b09('0x3b')],'where':{'id':_0x565223['interaction']['queueId']}});})[_0x1b09('0x20')](function(_0x1d3d7a){if(_0x1d3d7a){_0x565223[_0x1b09('0x83')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1d3d7a[_0x1b09('0x3b')]+','+(_0x565223[_0x1b09('0x82')][_0x1b09('0x9a')]||0x12c),'interval':_0x1b09('0x97')});}return respondWithRpcPromise('Start',_0x1b09('0x9b'),_0x565223);})['then'](function(_0x21440a){respondWithRpcPromise('EventManager',_0x1b09('0x9c'),{'event':_0x1b09('0x6e'),'message':_0x21440a},client9002);return _0x21440a;})[_0x1b09('0x20')](respondWithResult(_0x913569,null))[_0x1b09('0x29')](handleError(_0x913569,null));};exports[_0x1b09('0x9d')]=function(_0x45966e,_0x5449a3){var _0x48beeb=_0x45966e[_0x1b09('0x56')]['id'];var _0x4b5c23=_0x45966e[_0x1b09('0x61')];var _0x346237=0xc8;var _0x187853=null;return db['sequelize'][_0x1b09('0x9e')]({'isolationLevel':db[_0x1b09('0x9f')][_0x1b09('0xa0')][_0x1b09('0xa1')]['READ_COMMITTED']},function(_0x1d89c9){return db[_0x1b09('0x52')]['findOne']({'where':{'id':_0x48beeb},'transaction':_0x1d89c9})[_0x1b09('0x20')](function(_0x55ce19){if(_0x55ce19){return db[_0x1b09('0xa2')][_0x1b09('0x36')]({'where':{'OpenchannelAccountId':_0x48beeb},'transaction':_0x1d89c9})[_0x1b09('0x20')](function(){var _0x4c5109=_[_0x1b09('0x42')](_0x4b5c23,function(_0x3100fe){_0x3100fe['OpenchannelAccountId']=_0x48beeb;return _0x3100fe;});return db['OpenchannelApplication'][_0x1b09('0xa3')](_0x4c5109,{'transaction':_0x1d89c9});});}else{_0x346237=0x194;_0x187853=[];}});})[_0x1b09('0x20')](function(){if(_0x346237!==0x194){return db[_0x1b09('0xa2')][_0x1b09('0xa4')]({'where':{'OpenchannelAccountId':_0x48beeb},'order':_0x1b09('0xa5')})[_0x1b09('0x20')](function(_0x25f65b){_0x187853=_0x25f65b;});}})[_0x1b09('0x29')](function(_0x102e47){_0x346237=0x1f4;logger['error'](_0x102e47[_0x1b09('0x3a')]);if(_0x102e47['name']){delete _0x102e47[_0x1b09('0x3b')];}_0x187853=_0x102e47;})[_0x1b09('0xa6')](function(){if(_0x187853===null){_0x5449a3[_0x1b09('0x2a')](_0x346237);}else{if(_0x346237===0x1f4){_0x5449a3[_0x1b09('0x2b')](_0x346237)[_0x1b09('0xa7')](_0x187853);}else{_0x5449a3[_0x1b09('0x2b')](_0x346237)[_0x1b09('0x2c')](_0x187853);}}});};exports[_0x1b09('0xa8')]=function(_0x1894aa,_0x3ae55e,_0x5be3cd){var _0x2502e1={};var _0x47e424={};var _0x4f86c4;var _0x379628;return db[_0x1b09('0x52')]['findOne']({'where':{'id':_0x1894aa[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x3ae55e,null))[_0x1b09('0x20')](function(_0x276056){if(_0x276056){_0x4f86c4=_0x276056;_0x47e424[_0x1b09('0x46')]=_[_0x1b09('0x57')](db[_0x1b09('0xa2')][_0x1b09('0x3e')]);_0x47e424['query']=_[_0x1b09('0x57')](_0x1894aa['query']);_0x47e424[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x47e424[_0x1b09('0x46')],_0x47e424['query']);_0x2502e1[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x47e424[_0x1b09('0x46')],qs['fields'](_0x1894aa[_0x1b09('0x43')][_0x1b09('0x48')]));_0x2502e1[_0x1b09('0x47')]=_0x2502e1['attributes'][_0x1b09('0x58')]?_0x2502e1['attributes']:_0x47e424['model'];_0x2502e1[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x1894aa[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x2502e1['where']=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x1894aa[_0x1b09('0x43')],_0x47e424[_0x1b09('0x44')]));if(_0x1894aa[_0x1b09('0x43')][_0x1b09('0x50')]){_0x2502e1[_0x1b09('0x4d')]=_['merge'](_0x2502e1[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x2502e1[_0x1b09('0x47')],function(_0x32ba7a){var _0x451a67={};_0x451a67[_0x32ba7a]={'$like':'%'+_0x1894aa[_0x1b09('0x43')]['filter']+'%'};return _0x451a67;})});}_0x2502e1=_[_0x1b09('0x4e')]({},_0x2502e1,_0x1894aa['options']);return _0x4f86c4[_0x1b09('0xa8')](_0x2502e1);}})['then'](function(_0x127c31){if(_0x127c31){_0x379628=_0x127c31['length'];if(!_0x1894aa[_0x1b09('0x43')][_0x1b09('0x67')](_0x1b09('0x49'))){_0x2502e1[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x1894aa['query'][_0x1b09('0x2e')]);_0x2502e1[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x1894aa[_0x1b09('0x43')][_0x1b09('0x2d')]);}return _0x4f86c4[_0x1b09('0xa8')](_0x2502e1);}})[_0x1b09('0x20')](function(_0x5c37e5){if(_0x5c37e5){return _0x5c37e5?{'count':_0x379628,'rows':_0x5c37e5}:null;}})[_0x1b09('0x20')](respondWithResult(_0x3ae55e,null))[_0x1b09('0x29')](handleError(_0x3ae55e,null));};exports[_0x1b09('0xa9')]=function(_0x178a84,_0x395b13,_0x322ab0){var _0x7b0026={'raw':![],'where':{}};var _0x589fd1={};var _0x372881={'count':0x0,'rows':[]};return db[_0x1b09('0x52')][_0x1b09('0x66')]({'where':{'id':_0x178a84[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x395b13,null))[_0x1b09('0x20')](function(_0x5a3b3c){if(_0x5a3b3c){_0x589fd1[_0x1b09('0x46')]=_['keys'](db[_0x1b09('0x89')][_0x1b09('0x3e')]);_0x589fd1[_0x1b09('0x43')]=_['keys'](_0x178a84[_0x1b09('0x43')]);_0x589fd1[_0x1b09('0x44')]=_['intersection'](_0x589fd1[_0x1b09('0x46')],_0x589fd1[_0x1b09('0x43')]);_0x7b0026[_0x1b09('0x47')]=_[_0x1b09('0x45')](_0x589fd1[_0x1b09('0x46')],qs[_0x1b09('0x48')](_0x178a84['query'][_0x1b09('0x48')]));_0x7b0026[_0x1b09('0x47')]=_0x7b0026[_0x1b09('0x47')]['length']?_0x7b0026[_0x1b09('0x47')]:_0x589fd1[_0x1b09('0x46')];if(!_0x178a84[_0x1b09('0x43')][_0x1b09('0x67')]('nolimit')){_0x7b0026[_0x1b09('0x2e')]=qs[_0x1b09('0x2e')](_0x178a84[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x7b0026['offset']=qs[_0x1b09('0x2d')](_0x178a84['query'][_0x1b09('0x2d')]);}_0x7b0026[_0x1b09('0x4a')]=qs['sort'](_0x178a84[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x7b0026[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_[_0x1b09('0x4c')](_0x178a84[_0x1b09('0x43')],_0x589fd1[_0x1b09('0x44')]));_0x7b0026[_0x1b09('0x4d')][_0x1b09('0x63')]=_0x5a3b3c['id'];if(_0x178a84[_0x1b09('0x43')][_0x1b09('0x50')]){_0x7b0026[_0x1b09('0x4d')]=_['merge'](_0x7b0026['where'],{'$or':_[_0x1b09('0x42')](_0x7b0026['attributes'],function(_0x27c4ac){var _0xfd81aa={};_0xfd81aa[_0x27c4ac]={'$like':'%'+_0x178a84[_0x1b09('0x43')][_0x1b09('0x50')]+'%'};return _0xfd81aa;})});}_0x7b0026=_[_0x1b09('0x4e')]({},_0x7b0026,_0x178a84[_0x1b09('0x51')]);return db[_0x1b09('0x89')]['count']({'where':_0x7b0026[_0x1b09('0x4d')]})[_0x1b09('0x20')](function(_0x3c9223){_0x372881[_0x1b09('0x30')]=_0x3c9223;if(_0x178a84[_0x1b09('0x43')][_0x1b09('0x53')]){_0x7b0026[_0x1b09('0x54')]=[{'model':db[_0x1b09('0x6f')],'as':_0x1b09('0xaa'),'required':![]},{'model':db['User'],'as':_0x1b09('0xab'),'attributes':['name',_0x1b09('0xac'),_0x1b09('0xad')],'required':![]},{'model':db[_0x1b09('0xae')],'as':_0x1b09('0xaf'),'attributes':['id',_0x1b09('0x3b'),_0x1b09('0xb0')],'where':_0x178a84[_0x1b09('0x43')][_0x1b09('0xb1')]?{'id':_0x178a84[_0x1b09('0x43')]['tag']}:undefined,'required':_0x178a84['query'][_0x1b09('0xb1')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x1b09('0x55')](_0x7b0026);})[_0x1b09('0x20')](function(_0xc2f345){_0x372881[_0x1b09('0x68')]=_0xc2f345;return _0x372881;});}})[_0x1b09('0x20')](respondWithFilteredResult(_0x395b13,_0x7b0026))['catch'](handleError(_0x395b13,null));};exports['addAgents']=function(_0xee8f59,_0x568853,_0x586cd8){return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0xee8f59[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x568853,null))['then'](function(_0x1e55ba){if(_0x1e55ba){return _0x1e55ba[_0x1b09('0xb2')](_0xee8f59[_0x1b09('0x61')][_0x1b09('0x6a')],_[_0x1b09('0xb3')](_0xee8f59[_0x1b09('0x61')],[_0x1b09('0x6a'),'id'])||{})[_0x1b09('0xb4')](function(_0x522453){for(var _0x2e4447=0x0;_0x2e4447<_0xee8f59[_0x1b09('0x61')][_0x1b09('0x6a')]['length'];_0x2e4447+=0x1){socket[_0x1b09('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0xee8f59[_0x1b09('0x61')]['ids'][_0x2e4447]),'OpenchannelAccountId':Number(_0xee8f59[_0x1b09('0x56')]['id'])});}return _0x522453;});}})['then'](respondWithResult(_0x568853,null))[_0x1b09('0x29')](handleError(_0x568853,null));};exports['removeAgents']=function(_0x24b132,_0x5c7bf6,_0x1158da){return db[_0x1b09('0x52')][_0x1b09('0x59')]({'where':{'id':_0x24b132[_0x1b09('0x56')]['id']}})['then'](handleEntityNotFound(_0x5c7bf6,null))[_0x1b09('0x20')](function(_0x51646b){if(_0x51646b){return _0x51646b['removeAgents'](_0x24b132[_0x1b09('0x43')][_0x1b09('0x6a')])['then'](function(){if(_[_0x1b09('0xb6')](_0x24b132[_0x1b09('0x43')][_0x1b09('0x6a')])){for(var _0x18e614=0x0;_0x18e614<_0x24b132[_0x1b09('0x43')]['ids'][_0x1b09('0x58')];_0x18e614+=0x1){socket[_0x1b09('0xb5')](_0x1b09('0xb7'),{'UserId':Number(_0x24b132[_0x1b09('0x43')][_0x1b09('0x6a')][_0x18e614]),'OpenchannelAccountId':Number(_0x24b132['params']['id'])});}}else{socket[_0x1b09('0xb5')](_0x1b09('0xb7'),{'UserId':Number(_0x24b132[_0x1b09('0x43')]['ids']),'OpenchannelAccountId':Number(_0x24b132[_0x1b09('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c7bf6,null))[_0x1b09('0x29')](handleError(_0x5c7bf6,null));};exports[_0x1b09('0xb8')]=function(_0x515fdd,_0x290b4e,_0x28af93){var _0x1bdc44={};var _0x4fe7e4={};var _0x84597d;var _0x10cee7;return db['OpenchannelAccount'][_0x1b09('0x66')]({'where':{'id':_0x515fdd['params']['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x290b4e,null))[_0x1b09('0x20')](function(_0x55f50d){if(_0x55f50d){_0x84597d=_0x55f50d;_0x4fe7e4[_0x1b09('0x46')]=_['keys'](db[_0x1b09('0x94')]['rawAttributes']);_0x4fe7e4[_0x1b09('0x43')]=_['keys'](_0x515fdd[_0x1b09('0x43')]);_0x4fe7e4[_0x1b09('0x44')]=_[_0x1b09('0x45')](_0x4fe7e4[_0x1b09('0x46')],_0x4fe7e4[_0x1b09('0x43')]);_0x1bdc44[_0x1b09('0x47')]=_['intersection'](_0x4fe7e4[_0x1b09('0x46')],qs[_0x1b09('0x48')](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x48')]));_0x1bdc44[_0x1b09('0x47')]=_0x1bdc44[_0x1b09('0x47')][_0x1b09('0x58')]?_0x1bdc44[_0x1b09('0x47')]:_0x4fe7e4[_0x1b09('0x46')];_0x1bdc44[_0x1b09('0x4a')]=qs[_0x1b09('0x4b')](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x4b')]);_0x1bdc44[_0x1b09('0x4d')]=qs[_0x1b09('0x44')](_['pick'](_0x515fdd['query'],_0x4fe7e4['filters']));if(_0x515fdd[_0x1b09('0x43')][_0x1b09('0x50')]){_0x1bdc44[_0x1b09('0x4d')]=_[_0x1b09('0x4e')](_0x1bdc44[_0x1b09('0x4d')],{'$or':_[_0x1b09('0x42')](_0x1bdc44['attributes'],function(_0x76ef7f){var _0x2bc53c={};_0x2bc53c[_0x76ef7f]={'$like':'%'+_0x515fdd['query'][_0x1b09('0x50')]+'%'};return _0x2bc53c;})});}_0x1bdc44=_[_0x1b09('0x4e')]({},_0x1bdc44,_0x515fdd[_0x1b09('0x51')]);return _0x84597d[_0x1b09('0xb8')](_0x1bdc44);}})[_0x1b09('0x20')](function(_0x16e32a){if(_0x16e32a){_0x10cee7=_0x16e32a['length'];if(!_0x515fdd[_0x1b09('0x43')]['hasOwnProperty'](_0x1b09('0x49'))){_0x1bdc44['limit']=qs['limit'](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x2e')]);_0x1bdc44[_0x1b09('0x2d')]=qs[_0x1b09('0x2d')](_0x515fdd[_0x1b09('0x43')][_0x1b09('0x2d')]);}return _0x84597d[_0x1b09('0xb8')](_0x1bdc44);}})[_0x1b09('0x20')](function(_0x9a729b){if(_0x9a729b){return _0x9a729b?{'count':_0x10cee7,'rows':_0x9a729b}:null;}})['then'](respondWithResult(_0x290b4e,null))['catch'](handleError(_0x290b4e,null));};exports[_0x1b09('0xa7')]=function(_0x2fe8ad,_0x31e606,_0x3860ce){var _0x1c2d87,_0x2974a2,_0x43eef;if(_[_0x1b09('0x78')](_0x2fe8ad[_0x1b09('0x61')]['body'])||_0x2fe8ad[_0x1b09('0x61')][_0x1b09('0x61')]===''){throw new db[(_0x1b09('0x70'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1b09('0x78')](_0x2fe8ad[_0x1b09('0x61')]['to'])){}_0x1c2d87=_0x2fe8ad[_0x1b09('0x61')]['to'];return db[_0x1b09('0x52')][_0x1b09('0x66')]({'where':{'id':_0x2fe8ad[_0x1b09('0x56')]['id']}})[_0x1b09('0x20')](handleEntityNotFound(_0x31e606,null))[_0x1b09('0x20')](function(_0xfa18af){if(_0xfa18af){return db['OpenchannelAccount'][_0x1b09('0x59')]({'where':{'id':_0xfa18af['id']},'include':[{'model':db[_0x1b09('0x7d')],'as':'List','include':[{'model':db[_0x1b09('0x6f')],'as':_0x1b09('0x7f'),'where':{[_0xfa18af[_0x1b09('0x7a')]]:_0x1c2d87},'limit':0x1,'order':[[_0x1b09('0x72'),_0x1b09('0x80')]]}]}]})['then'](handleEntityNotFound(_0x31e606,null))[_0x1b09('0x20')](function(_0x4311ef){if(_0x4311ef&&_0x4311ef[_0x1b09('0x7e')]){_0x2974a2=_0x4311ef[_0x1b09('0x37')]({'plain':!![]});if(_0x2974a2[_0x1b09('0x7e')]&&_0x2974a2[_0x1b09('0x7e')][_0x1b09('0x7f')][_0x1b09('0x58')]){return _0x2974a2['List'][_0x1b09('0x7f')][0x0];}return db[_0x1b09('0x6f')][_0x1b09('0x5a')](_[_0x1b09('0x19')](_0x2fe8ad[_0x1b09('0x61')],{'firstName':_0x1c2d87,[_0x4311ef['mapKey']]:_0x1c2d87,'phone':_0x1c2d87,'ListId':_0x2974a2[_0x1b09('0x86')]}));}})[_0x1b09('0x20')](handleEntityNotFound(_0x31e606,null))[_0x1b09('0x20')](function(_0x216b75){if(_0x216b75){_0x43eef=_0x216b75;return db[_0x1b09('0x89')]['find']({'where':{'ContactId':_0x43eef['id'],'closed':![],'OpenchannelAccountId':_0x2974a2['id']}})[_0x1b09('0x20')](function(_0x33ab1f){if(_0x33ab1f){return[_0x33ab1f,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x2fe8ad[_0x1b09('0x5b')]['id'],'ContactId':_0x43eef['id'],'OpenchannelAccountId':_0x2974a2['id'],'lastMsgDirection':_0x1b09('0xb9'),'firstMsgDirection':'out','Messages':[_['merge'](_0x2fe8ad[_0x1b09('0x61')],{'read':![],'body':_0x2fe8ad[_0x1b09('0x61')][_0x1b09('0x61')],'OpenchannelAccountId':_0x2974a2['id'],'UserId':_0x2fe8ad[_0x1b09('0x5b')]['id'],'ContactId':_0x43eef['id']})]},{'include':[{'model':db[_0x1b09('0x92')],'as':_0x1b09('0xba')}]})['then'](function(_0x32d515){return[_0x32d515,!![]];});});}})[_0x1b09('0xb4')](function(_0x3aa637,_0x266c5d){if(_0x266c5d){return _0x3aa637;}return db[_0x1b09('0x92')][_0x1b09('0x5a')](_[_0x1b09('0x4e')](_0x2fe8ad[_0x1b09('0x61')],{'read':![],'body':_0x2fe8ad[_0x1b09('0x61')][_0x1b09('0x61')],'OpenchannelAccountId':_0x2974a2['id'],'OpenchannelInteractionId':_0x3aa637['id'],'UserId':_0x2fe8ad[_0x1b09('0x5b')]['id'],'ContactId':_0x43eef['id']}))['then'](function(_0x3104b7){_0x3aa637[_0x1b09('0xbb')][_0x1b09('0xba')]=[];_0x3aa637[_0x1b09('0xbb')][_0x1b09('0xba')]['push'](_0x3104b7[_0x1b09('0xbb')]);return _0x3aa637;});});}})[_0x1b09('0x20')](respondWithResult(_0x31e606,null))[_0x1b09('0x29')](handleError(_0x31e606,null));}; \ No newline at end of file +var _0x3989=['options','includeAll','include','findAll','catch','show','params','Pause','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','pick','rows','removeDispositions','CannedAnswer','findOne','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','Applications','account','list','applications','orderBy','asc','Contacts','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','OpenchannelApplication','findAndCountAll','priority','stack','finally','send','getApplications','getInteractions','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','user','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','get','UserProfileResource','end','sendStatus','name','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x363725,_0x1eee67){var _0x6af43b=function(_0x3c2a3e){while(--_0x3c2a3e){_0x363725['push'](_0x363725['shift']());}};_0x6af43b(++_0x1eee67);}(_0x3989,0x12f));var _0x9398=function(_0xf9b652,_0x3e0f48){_0xf9b652=_0xf9b652-0x0;var _0x34a782=_0x3989[_0xf9b652];return _0x34a782;};'use strict';var emlformat=require(_0x9398('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9398('0x1'));var jsonpatch=require(_0x9398('0x2'));var rp=require(_0x9398('0x3'));var moment=require(_0x9398('0x4'));var BPromise=require(_0x9398('0x5'));var Mustache=require(_0x9398('0x6'));var util=require(_0x9398('0x7'));var path=require(_0x9398('0x8'));var sox=require(_0x9398('0x9'));var csv=require(_0x9398('0xa'));var ejs=require(_0x9398('0xb'));var fs=require('fs');var fs_extra=require(_0x9398('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9398('0xd'));var jsforce=require(_0x9398('0xe'));var deskjs=require(_0x9398('0xf'));var toCsv=require(_0x9398('0xa'));var querystring=require(_0x9398('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9398('0x11'));var qs=require(_0x9398('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9398('0x13'));var logger=require(_0x9398('0x14'))(_0x9398('0x15'));var utils=require(_0x9398('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9398('0x17'));var db=require(_0x9398('0x18'))['db'];config[_0x9398('0x19')]=_[_0x9398('0x1a')](config[_0x9398('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9398('0x1b'))(new Redis(config['redis']));require(_0x9398('0x1c'))[_0x9398('0x1d')](socket);var jayson=require(_0x9398('0x1e'));var client=jayson[_0x9398('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x9398('0x1f')][_0x9398('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x40164d,_0x44708b,_0x1a3674,_0x171a28){return new BPromise(function(_0x1df40c,_0x5a7c86){var _0x2099e1=_0x171a28||client;return _0x2099e1['request'](_0x40164d,_0x1a3674)[_0x9398('0x21')](function(_0x3d85b7){logger[_0x9398('0x22')](_0x9398('0x23'),_0x44708b,'request\x20sent');logger[_0x9398('0x24')](_0x9398('0x25'),_0x44708b,_0x9398('0x26'),JSON[_0x9398('0x27')](_0x3d85b7));if(_0x3d85b7[_0x9398('0x28')]){if(_0x3d85b7[_0x9398('0x28')][_0x9398('0x29')]===0x1f4){logger['error'](_0x9398('0x23'),_0x44708b,_0x3d85b7[_0x9398('0x28')][_0x9398('0x2a')]);return _0x5a7c86(_0x3d85b7[_0x9398('0x28')][_0x9398('0x2a')]);}logger[_0x9398('0x28')](_0x9398('0x23'),_0x44708b,_0x3d85b7[_0x9398('0x28')][_0x9398('0x2a')]);return _0x1df40c(_0x3d85b7[_0x9398('0x28')][_0x9398('0x2a')]);}else{logger[_0x9398('0x22')](_0x9398('0x23'),_0x44708b,'request\x20sent');_0x1df40c(_0x3d85b7[_0x9398('0x2b')]['message']);}})['catch'](function(_0x576e37){logger[_0x9398('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x44708b,_0x576e37);_0x5a7c86(_0x576e37);});});}function respondWithStatusCode(_0x56f90c,_0x9a3ba2){_0x9a3ba2=_0x9a3ba2||0xcc;return function(_0x2c30a8){if(_0x2c30a8){return _0x56f90c['sendStatus'](_0x9a3ba2);}return _0x56f90c[_0x9398('0x2c')](_0x9a3ba2)['end']();};}function respondWithResult(_0x57a488,_0x1fef9f){_0x1fef9f=_0x1fef9f||0xc8;return function(_0x27e324){if(_0x27e324){return _0x57a488[_0x9398('0x2c')](_0x1fef9f)['json'](_0x27e324);}};}function respondWithFilteredResult(_0x4c7b88,_0x16eb83){return function(_0x28ab61){if(_0x28ab61){var _0x4657ed=typeof _0x16eb83[_0x9398('0x2d')]==='undefined'&&typeof _0x16eb83[_0x9398('0x2e')]===_0x9398('0x2f');var _0xf99410=_0x28ab61[_0x9398('0x30')];var _0x5986d3=_0x4657ed?0x0:_0x16eb83[_0x9398('0x2d')];var _0x248efb=_0x4657ed?_0x28ab61['count']:_0x16eb83[_0x9398('0x2d')]+_0x16eb83['limit'];var _0x4db56d;if(_0x248efb>=_0xf99410){_0x248efb=_0xf99410;_0x4db56d=0xc8;}else{_0x4db56d=0xce;}_0x4c7b88[_0x9398('0x2c')](_0x4db56d);return _0x4c7b88[_0x9398('0x31')](_0x9398('0x32'),_0x5986d3+'-'+_0x248efb+'/'+_0xf99410)[_0x9398('0x33')](_0x28ab61);}return null;};}function patchUpdates(_0x549790){return function(_0x37208c){try{jsonpatch[_0x9398('0x34')](_0x37208c,_0x549790,!![]);}catch(_0x602b8c){return BPromise[_0x9398('0x35')](_0x602b8c);}return _0x37208c[_0x9398('0x36')]();};}function saveUpdates(_0x33916a,_0x28db73){return function(_0x2c1dd3){if(_0x2c1dd3){return _0x2c1dd3[_0x9398('0x37')](_0x33916a)[_0x9398('0x21')](function(_0x4790be){return _0x4790be;});}return null;};}function removeEntity(_0x1f1204,_0x173e6a){return function(_0x5c984e){if(_0x5c984e){return _0x5c984e['destroy']()[_0x9398('0x21')](function(){var _0x470c1e=_0x5c984e[_0x9398('0x38')]({'plain':!![]});var _0x345381='OpenchannelAccounts';return db[_0x9398('0x39')]['destroy']({'where':{'type':_0x345381,'resourceId':_0x470c1e['id']}})['then'](function(){return _0x5c984e;});})[_0x9398('0x21')](function(){_0x1f1204[_0x9398('0x2c')](0xcc)[_0x9398('0x3a')]();});}};}function handleEntityNotFound(_0x28f0a6,_0x1a42f8){return function(_0x4a6f97){if(!_0x4a6f97){_0x28f0a6[_0x9398('0x3b')](0x194);}return _0x4a6f97;};}function handleError(_0x36d3b9,_0x57e4f3){_0x57e4f3=_0x57e4f3||0x1f4;return function(_0x46e43b){logger[_0x9398('0x28')](_0x46e43b['stack']);if(_0x46e43b[_0x9398('0x3c')]){delete _0x46e43b[_0x9398('0x3c')];}_0x36d3b9[_0x9398('0x2c')](_0x57e4f3)['send'](_0x46e43b);};}exports[_0x9398('0x3d')]=function(_0x28e9fa,_0x3e063c){var _0x1f48b2={'include':[{'model':db['Pause'],'as':_0x9398('0x3e')}]},_0x9c5976={},_0x53aa62={'count':0x0,'rows':[]};var _0xdba718=_['map'](db[_0x9398('0x3f')][_0x9398('0x40')],function(_0x357f8d){return{'name':_0x357f8d[_0x9398('0x41')],'type':_0x357f8d[_0x9398('0x42')][_0x9398('0x43')]};});_0x9c5976[_0x9398('0x44')]=_[_0x9398('0x45')](_0xdba718,_0x9398('0x3c'));_0x9c5976['query']=_[_0x9398('0x46')](_0x28e9fa['query']);_0x9c5976[_0x9398('0x47')]=_['intersection'](_0x9c5976[_0x9398('0x44')],_0x9c5976['query']);_0x1f48b2[_0x9398('0x48')]=_['intersection'](_0x9c5976['model'],qs[_0x9398('0x49')](_0x28e9fa['query'][_0x9398('0x49')]));_0x1f48b2[_0x9398('0x48')]=_0x1f48b2[_0x9398('0x48')][_0x9398('0x4a')]?_0x1f48b2[_0x9398('0x48')]:_0x9c5976[_0x9398('0x44')];if(!_0x28e9fa[_0x9398('0x4b')][_0x9398('0x4c')](_0x9398('0x4d'))){_0x1f48b2[_0x9398('0x2e')]=qs[_0x9398('0x2e')](_0x28e9fa[_0x9398('0x4b')][_0x9398('0x2e')]);_0x1f48b2[_0x9398('0x2d')]=qs[_0x9398('0x2d')](_0x28e9fa[_0x9398('0x4b')][_0x9398('0x2d')]);}_0x1f48b2[_0x9398('0x4e')]=qs[_0x9398('0x4f')](_0x28e9fa[_0x9398('0x4b')][_0x9398('0x4f')]);_0x1f48b2[_0x9398('0x50')]=qs[_0x9398('0x47')](_['pick'](_0x28e9fa['query'],_0x9c5976[_0x9398('0x47')]),_0xdba718);if(_0x28e9fa['query'][_0x9398('0x51')]){_0x1f48b2['where']=_[_0x9398('0x52')](_0x1f48b2[_0x9398('0x50')],{'$or':_[_0x9398('0x45')](_0xdba718,function(_0x5a549d){if(_0x5a549d[_0x9398('0x42')]!=='VIRTUAL'){var _0x205727={};_0x205727[_0x5a549d[_0x9398('0x3c')]]={'$like':'%'+_0x28e9fa['query'][_0x9398('0x51')]+'%'};return _0x205727;}})});}_0x1f48b2=_[_0x9398('0x52')]({},_0x1f48b2,_0x28e9fa[_0x9398('0x53')]);var _0x28bcad={'where':_0x1f48b2['where']};return db[_0x9398('0x3f')][_0x9398('0x30')](_0x28bcad)[_0x9398('0x21')](function(_0x437363){_0x53aa62['count']=_0x437363;if(_0x28e9fa[_0x9398('0x4b')][_0x9398('0x54')]){_0x1f48b2[_0x9398('0x55')]=[{'all':!![]}];}return db[_0x9398('0x3f')][_0x9398('0x56')](_0x1f48b2);})[_0x9398('0x21')](function(_0x52147c){_0x53aa62['rows']=_0x52147c;return _0x53aa62;})['then'](respondWithFilteredResult(_0x3e063c,_0x1f48b2))[_0x9398('0x57')](handleError(_0x3e063c,null));};exports[_0x9398('0x58')]=function(_0xfc1706,_0x127f65){var _0x3693d9={'raw':![],'where':{'id':_0xfc1706[_0x9398('0x59')]['id']},'include':[{'model':db[_0x9398('0x5a')],'as':'mandatoryDispositionPause'}]},_0x54aad6={};_0x54aad6['model']=_[_0x9398('0x46')](db[_0x9398('0x3f')][_0x9398('0x40')]);_0x54aad6[_0x9398('0x4b')]=_[_0x9398('0x46')](_0xfc1706[_0x9398('0x4b')]);_0x54aad6[_0x9398('0x47')]=_['intersection'](_0x54aad6[_0x9398('0x44')],_0x54aad6[_0x9398('0x4b')]);_0x3693d9['attributes']=_[_0x9398('0x5b')](_0x54aad6[_0x9398('0x44')],qs[_0x9398('0x49')](_0xfc1706[_0x9398('0x4b')][_0x9398('0x49')]));_0x3693d9[_0x9398('0x48')]=_0x3693d9[_0x9398('0x48')][_0x9398('0x4a')]?_0x3693d9['attributes']:_0x54aad6[_0x9398('0x44')];if(_0xfc1706[_0x9398('0x4b')][_0x9398('0x54')]){_0x3693d9[_0x9398('0x55')]=[{'all':!![]}];}_0x3693d9=_[_0x9398('0x52')]({},_0x3693d9,_0xfc1706[_0x9398('0x53')]);return db[_0x9398('0x3f')]['find'](_0x3693d9)['then'](handleEntityNotFound(_0x127f65,null))[_0x9398('0x21')](respondWithResult(_0x127f65,null))[_0x9398('0x57')](handleError(_0x127f65,null));};exports[_0x9398('0x5c')]=function(_0x3a6c27,_0x571173){return db[_0x9398('0x3f')][_0x9398('0x5c')](_0x3a6c27[_0x9398('0x5d')],{})[_0x9398('0x21')](function(_0x3eb9e2){var _0xf4b145=_0x3a6c27['user'][_0x9398('0x38')]({'plain':!![]});if(!_0xf4b145)throw new Error(_0x9398('0x5e'));if(_0xf4b145[_0x9398('0x5f')]==='user'){var _0x4de5ef=_0x3eb9e2['get']({'plain':!![]});var _0x10ae55='OpenchannelAccounts';return db['UserProfileSection'][_0x9398('0x60')]({'where':{'name':_0x10ae55,'userProfileId':_0xf4b145['userProfileId']},'raw':!![]})[_0x9398('0x21')](function(_0x4c0f0d){if(_0x4c0f0d&&_0x4c0f0d[_0x9398('0x61')]===0x0){return db[_0x9398('0x39')][_0x9398('0x5c')]({'name':_0x4de5ef[_0x9398('0x3c')],'resourceId':_0x4de5ef['id'],'type':_0x4c0f0d['name'],'sectionId':_0x4c0f0d['id']},{})[_0x9398('0x21')](function(){return _0x3eb9e2;});}else{return _0x3eb9e2;}})[_0x9398('0x57')](function(_0x39cb7f){logger[_0x9398('0x28')](_0x9398('0x62'),_0x39cb7f);throw _0x39cb7f;});}return _0x3eb9e2;})[_0x9398('0x21')](respondWithResult(_0x571173,0xc9))[_0x9398('0x57')](handleError(_0x571173,null));};exports['update']=function(_0x32d1d1,_0x417239){if(_0x32d1d1[_0x9398('0x5d')]['id']){delete _0x32d1d1[_0x9398('0x5d')]['id'];}return db[_0x9398('0x3f')][_0x9398('0x60')]({'where':{'id':_0x32d1d1[_0x9398('0x59')]['id']},'include':[{'model':db[_0x9398('0x5a')],'as':_0x9398('0x3e')}]})['then'](handleEntityNotFound(_0x417239,null))['then'](saveUpdates(_0x32d1d1[_0x9398('0x5d')],null))[_0x9398('0x21')](respondWithResult(_0x417239,null))['catch'](handleError(_0x417239,null));};exports['destroy']=function(_0x51c514,_0x7b341c){return db[_0x9398('0x3f')][_0x9398('0x60')]({'where':{'id':_0x51c514['params']['id']}})['then'](handleEntityNotFound(_0x7b341c,null))[_0x9398('0x21')](removeEntity(_0x7b341c,null))[_0x9398('0x57')](handleError(_0x7b341c,null));};exports[_0x9398('0x63')]=function(_0x3fa108,_0x26e555){return db[_0x9398('0x3f')][_0x9398('0x63')]()['then'](respondWithResult(_0x26e555,null))[_0x9398('0x57')](handleError(_0x26e555,null));};exports['addDisposition']=function(_0x1ed233,_0x560934,_0x27b6d9){if(_0x1ed233[_0x9398('0x5d')]['id']){delete _0x1ed233[_0x9398('0x5d')]['id'];}return db[_0x9398('0x3f')][_0x9398('0x60')]({'where':{'id':_0x1ed233['params']['id']}})[_0x9398('0x21')](handleEntityNotFound(_0x560934,null))[_0x9398('0x21')](function(_0x5010a4){if(_0x5010a4){_0x1ed233[_0x9398('0x5d')][_0x9398('0x64')]=_0x5010a4['id'];return db[_0x9398('0x65')][_0x9398('0x5c')](_0x1ed233['body']);}})[_0x9398('0x21')](respondWithResult(_0x560934,null))[_0x9398('0x57')](handleError(_0x560934,null));};exports['getDispositions']=function(_0x2aab5b,_0x5db4e1,_0x448404){var _0x1d1890={'raw':![],'where':{}};var _0x370021={};var _0x1793b2={'count':0x0,'rows':[]};return db[_0x9398('0x3f')]['findOne']({'where':{'id':_0x2aab5b[_0x9398('0x59')]['id']}})[_0x9398('0x21')](handleEntityNotFound(_0x5db4e1,null))['then'](function(_0x52d769){if(_0x52d769){_0x370021[_0x9398('0x44')]=_[_0x9398('0x46')](db[_0x9398('0x65')][_0x9398('0x40')]);_0x370021['query']=_[_0x9398('0x46')](_0x2aab5b[_0x9398('0x4b')]);_0x370021[_0x9398('0x47')]=_['intersection'](_0x370021['model'],_0x370021[_0x9398('0x4b')]);_0x1d1890[_0x9398('0x48')]=_[_0x9398('0x5b')](_0x370021[_0x9398('0x44')],qs['fields'](_0x2aab5b[_0x9398('0x4b')][_0x9398('0x49')]));_0x1d1890[_0x9398('0x48')]=_0x1d1890[_0x9398('0x48')][_0x9398('0x4a')]?_0x1d1890[_0x9398('0x48')]:_0x370021[_0x9398('0x44')];if(!_0x2aab5b[_0x9398('0x4b')][_0x9398('0x4c')](_0x9398('0x4d'))){_0x1d1890['limit']=qs['limit'](_0x2aab5b['query'][_0x9398('0x2e')]);_0x1d1890[_0x9398('0x2d')]=qs['offset'](_0x2aab5b['query'][_0x9398('0x2d')]);}_0x1d1890[_0x9398('0x4e')]=qs[_0x9398('0x4f')](_0x2aab5b[_0x9398('0x4b')][_0x9398('0x4f')]);_0x1d1890[_0x9398('0x50')]=qs[_0x9398('0x47')](_[_0x9398('0x66')](_0x2aab5b[_0x9398('0x4b')],_0x370021[_0x9398('0x47')]));_0x1d1890[_0x9398('0x50')][_0x9398('0x64')]=_0x52d769['id'];if(_0x2aab5b[_0x9398('0x4b')][_0x9398('0x51')]){_0x1d1890['where']=_['merge'](_0x1d1890[_0x9398('0x50')],{'$or':_['map'](_0x1d1890[_0x9398('0x48')],function(_0x370412){var _0x2165ff={};_0x2165ff[_0x370412]={'$like':'%'+_0x2aab5b[_0x9398('0x4b')]['filter']+'%'};return _0x2165ff;})});}_0x1d1890=_[_0x9398('0x52')]({},_0x1d1890,_0x2aab5b['options']);return db[_0x9398('0x65')]['count']({'where':_0x1d1890[_0x9398('0x50')]})[_0x9398('0x21')](function(_0xb7a5c7){_0x1793b2[_0x9398('0x30')]=_0xb7a5c7;if(_0x2aab5b[_0x9398('0x4b')][_0x9398('0x54')]){_0x1d1890[_0x9398('0x55')]=[{'all':!![]}];}return db[_0x9398('0x65')]['findAll'](_0x1d1890);})[_0x9398('0x21')](function(_0x4a178b){_0x1793b2[_0x9398('0x67')]=_0x4a178b;return _0x1793b2;});}})[_0x9398('0x21')](respondWithFilteredResult(_0x5db4e1,_0x1d1890))[_0x9398('0x57')](handleError(_0x5db4e1,null));};exports[_0x9398('0x68')]=function(_0x1be362,_0x4b2bac,_0x58cc4c){return db[_0x9398('0x3f')]['find']({'where':{'id':_0x1be362[_0x9398('0x59')]['id']}})[_0x9398('0x21')](handleEntityNotFound(_0x4b2bac,null))[_0x9398('0x21')](function(_0x490601){if(_0x490601){return _0x490601[_0x9398('0x68')](_0x1be362[_0x9398('0x4b')]['ids']);}})[_0x9398('0x21')](respondWithStatusCode(_0x4b2bac,null))[_0x9398('0x57')](handleError(_0x4b2bac,null));};exports['addAnswer']=function(_0x34c09a,_0x128baa,_0x24f594){if(_0x34c09a['body']['id']){delete _0x34c09a[_0x9398('0x5d')]['id'];}return db[_0x9398('0x3f')][_0x9398('0x60')]({'where':{'id':_0x34c09a['params']['id']}})['then'](handleEntityNotFound(_0x128baa,null))[_0x9398('0x21')](function(_0x27499f){if(_0x27499f){_0x34c09a[_0x9398('0x5d')][_0x9398('0x64')]=_0x27499f['id'];return db[_0x9398('0x69')][_0x9398('0x5c')](_0x34c09a['body']);}})['then'](respondWithResult(_0x128baa,null))[_0x9398('0x57')](handleError(_0x128baa,null));};exports['getAnswers']=function(_0x5da8ff,_0xd58483,_0x50ca7b){var _0x2a5019={'raw':![],'where':{}};var _0x5285c8={};var _0x22927b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9398('0x6a')]({'where':{'id':_0x5da8ff[_0x9398('0x59')]['id']}})[_0x9398('0x21')](handleEntityNotFound(_0xd58483,null))['then'](function(_0xea72){if(_0xea72){_0x5285c8['model']=_[_0x9398('0x46')](db[_0x9398('0x69')][_0x9398('0x40')]);_0x5285c8[_0x9398('0x4b')]=_[_0x9398('0x46')](_0x5da8ff[_0x9398('0x4b')]);_0x5285c8[_0x9398('0x47')]=_[_0x9398('0x5b')](_0x5285c8[_0x9398('0x44')],_0x5285c8[_0x9398('0x4b')]);_0x2a5019[_0x9398('0x48')]=_['intersection'](_0x5285c8['model'],qs[_0x9398('0x49')](_0x5da8ff[_0x9398('0x4b')][_0x9398('0x49')]));_0x2a5019[_0x9398('0x48')]=_0x2a5019[_0x9398('0x48')]['length']?_0x2a5019['attributes']:_0x5285c8['model'];if(!_0x5da8ff[_0x9398('0x4b')]['hasOwnProperty'](_0x9398('0x4d'))){_0x2a5019[_0x9398('0x2e')]=qs[_0x9398('0x2e')](_0x5da8ff[_0x9398('0x4b')][_0x9398('0x2e')]);_0x2a5019[_0x9398('0x2d')]=qs[_0x9398('0x2d')](_0x5da8ff[_0x9398('0x4b')][_0x9398('0x2d')]);}_0x2a5019['order']=qs['sort'](_0x5da8ff[_0x9398('0x4b')][_0x9398('0x4f')]);_0x2a5019['where']=qs[_0x9398('0x47')](_['pick'](_0x5da8ff[_0x9398('0x4b')],_0x5285c8[_0x9398('0x47')]));_0x2a5019[_0x9398('0x50')][_0x9398('0x64')]=_0xea72['id'];if(_0x5da8ff[_0x9398('0x4b')][_0x9398('0x51')]){_0x2a5019['where']=_[_0x9398('0x52')](_0x2a5019['where'],{'$or':_[_0x9398('0x45')](_0x2a5019[_0x9398('0x48')],function(_0x3f9740){var _0x374338={};_0x374338[_0x3f9740]={'$like':'%'+_0x5da8ff[_0x9398('0x4b')][_0x9398('0x51')]+'%'};return _0x374338;})});}_0x2a5019=_[_0x9398('0x52')]({},_0x2a5019,_0x5da8ff[_0x9398('0x53')]);return db[_0x9398('0x69')][_0x9398('0x30')]({'where':_0x2a5019[_0x9398('0x50')]})[_0x9398('0x21')](function(_0x37274f){_0x22927b[_0x9398('0x30')]=_0x37274f;if(_0x5da8ff[_0x9398('0x4b')][_0x9398('0x54')]){_0x2a5019[_0x9398('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2a5019);})['then'](function(_0x3333a2){_0x22927b[_0x9398('0x67')]=_0x3333a2;return _0x22927b;});}})[_0x9398('0x21')](respondWithFilteredResult(_0xd58483,_0x2a5019))[_0x9398('0x57')](handleError(_0xd58483,null));};exports[_0x9398('0x6b')]=function(_0x1058d8,_0x110817,_0x1871d3){return db[_0x9398('0x3f')][_0x9398('0x60')]({'where':{'id':_0x1058d8[_0x9398('0x59')]['id']}})['then'](handleEntityNotFound(_0x110817,null))['then'](function(_0x372dc8){if(_0x372dc8){return _0x372dc8[_0x9398('0x6b')](_0x1058d8['query'][_0x9398('0x6c')]);}})[_0x9398('0x21')](respondWithStatusCode(_0x110817,null))['catch'](handleError(_0x110817,null));};exports[_0x9398('0x6d')]=function(_0x14a369,_0x25f099,_0x2db6a7){var _0x367557={'body':_0x14a369['body'],'channel':_0x9398('0x6e')};var _0x3a85e5=[];var _0x35d83c=[];var _0x4df985={};var _0x161f85=![];return db[_0x9398('0x6f')][_0x9398('0x63')]()['then'](function(_0x2ffef8){if(!_0x2ffef8){throw new db['Sequelize'][(_0x9398('0x70'))]('no\x20available\x20attributes');}_0x3a85e5=_[_0x9398('0x71')](_[_0x9398('0x46')](_0x2ffef8),[_0x9398('0x72'),'updatedAt']);_0x35d83c=_[_0x9398('0x71')](_[_0x9398('0x46')](_0x2ffef8),[_0x9398('0x72'),_0x9398('0x73'),_0x9398('0x74'),_0x9398('0x75')]);if(_0x14a369[_0x9398('0x5d')]['id']){delete _0x14a369[_0x9398('0x5d')]['id'];}if(_['isNil'](_0x14a369[_0x9398('0x5d')]['from'])){throw new db[(_0x9398('0x76'))][(_0x9398('0x70'))](_0x9398('0x77'));}if(_[_0x9398('0x78')](_0x14a369[_0x9398('0x5d')][_0x9398('0x5d')])||_0x14a369[_0x9398('0x5d')][_0x9398('0x5d')]===''){throw new db[(_0x9398('0x76'))][(_0x9398('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x14a369[_0x9398('0x5d')][_0x9398('0x79')])){throw new db[(_0x9398('0x76'))]['ValidationError'](_0x9398('0x7a')+_0x35d83c);}if(!_['includes'](_0x35d83c,_0x14a369[_0x9398('0x5d')][_0x9398('0x79')])){throw new db[(_0x9398('0x76'))][(_0x9398('0x70'))](_0x9398('0x7b')+_0x35d83c);}_0x4df985[_0x14a369[_0x9398('0x5d')][_0x9398('0x79')]]=_0x14a369[_0x9398('0x5d')][_0x9398('0x7c')];})[_0x9398('0x21')](function(){return db[_0x9398('0x3f')]['find']({'where':{'id':_0x14a369[_0x9398('0x59')]['id']},'include':[{'model':db[_0x9398('0x7d')],'as':_0x9398('0x7e'),'include':[{'model':db[_0x9398('0x6f')],'as':'Contacts','where':_0x4df985,'limit':0x1,'order':[[_0x9398('0x73'),_0x9398('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0x9398('0x80')}]});})[_0x9398('0x21')](handleEntityNotFound(_0x25f099,null))[_0x9398('0x21')](function(_0x3cca43){if(_0x3cca43&&_0x3cca43[_0x9398('0x7e')]){_0x367557[_0x9398('0x81')]=_0x3cca43;_0x367557['applications']=_0x3cca43[_0x9398('0x80')];_0x367557[_0x9398('0x82')]=_0x3cca43[_0x9398('0x7e')];_0x367557[_0x9398('0x83')]=_[_0x9398('0x84')](_0x367557[_0x9398('0x83')],['priority'],[_0x9398('0x85')]);if(_0x367557['account']['Applications']){delete _0x367557['account'][_0x9398('0x80')];}if(_0x367557[_0x9398('0x81')][_0x9398('0x7e')]&&_0x367557['account'][_0x9398('0x7e')][_0x9398('0x86')][_0x9398('0x4a')]){return _0x367557[_0x9398('0x81')][_0x9398('0x7e')][_0x9398('0x86')][0x0];}var _0x2a8200=_[_0x9398('0x1a')](_0x14a369[_0x9398('0x5d')],{'firstName':_0x14a369[_0x9398('0x5d')]['from'],'ListId':_0x3cca43[_0x9398('0x75')]});_0x2a8200[_0x14a369[_0x9398('0x5d')]['mapKey']]=_0x14a369[_0x9398('0x5d')][_0x9398('0x7c')];return db[_0x9398('0x6f')][_0x9398('0x5c')](_0x2a8200,{'fields':_0x3a85e5,'raw':!![]});}})['then'](handleEntityNotFound(_0x25f099,null))[_0x9398('0x21')](function(_0x42b38){_0x367557[_0x9398('0x87')]=_0x42b38;if(_0x42b38){var _0x3fd19f={'ContactId':_0x42b38['id'],'OpenchannelAccountId':_0x14a369['params']['id'],'from':(_0x42b38[_0x9398('0x88')]||'')+'\x20'+(_0x42b38[_0x9398('0x89')]||'')};var _0x1276e3={'OpenchannelAccountId':_0x14a369['params']['id'],'closed':![]};if(_0x14a369[_0x9398('0x5d')][_0x9398('0x8a')]){_0x1276e3[_0x9398('0x8a')]=_0x14a369['body'][_0x9398('0x8a')];return db['OpenchannelInteraction'][_0x9398('0x60')]({'where':_0x1276e3})[_0x9398('0x21')](function(_0x244abf){if(_0x244abf){return[_0x244abf,![]];}_0x3fd19f['threadId']=_0x14a369['body'][_0x9398('0x8a')];_0x3fd19f[_0x9398('0x8b')]=_0x14a369['body'][_0x9398('0x8b')];return db[_0x9398('0x8c')][_0x9398('0x5c')](_0x3fd19f)[_0x9398('0x21')](function(_0x1bda84){return[_0x1bda84,!![]];});});}else{_0x1276e3[_0x9398('0x8a')]=null;}_0x1276e3[_0x9398('0x8d')]=_0x42b38['id'];return db[_0x9398('0x8c')][_0x9398('0x60')]({'where':_0x1276e3})[_0x9398('0x21')](function(_0x3d46e9){if(_0x3d46e9){return[_0x3d46e9,![]];}return db[_0x9398('0x8c')]['create'](_0x3fd19f)[_0x9398('0x21')](function(_0x2052e8){return[_0x2052e8,!![]];});});}})[_0x9398('0x8e')](function(_0x62cb5,_0xdd4477){if(_0x62cb5){_0x161f85=_0xdd4477;if(!_0xdd4477){var _0x4fd29b={'from':(_0x367557[_0x9398('0x87')][_0x9398('0x88')]||'')+'\x20'+(_0x367557[_0x9398('0x87')]['lastName']||'')};if(_0x14a369[_0x9398('0x5d')]['threadId']&&_0x14a369[_0x9398('0x5d')][_0x9398('0x8f')]&&_0x14a369[_0x9398('0x5d')][_0x9398('0x8a')]!=_0x14a369[_0x9398('0x5d')][_0x9398('0x8f')]){_0x4fd29b['threadId']=_0x14a369[_0x9398('0x5d')][_0x9398('0x8f')];}return _0x62cb5[_0x9398('0x37')](_0x4fd29b);}else{return _0x62cb5;}}})[_0x9398('0x21')](function(_0x291201){_0x367557['interaction']=_0x291201['get']({'plain':!![]});_0x367557[_0x9398('0x90')][_0x9398('0x91')]=_0x161f85;if(_0x367557[_0x9398('0x90')]['created']){if(_0x367557[_0x9398('0x81')][_0x9398('0x92')]){_0x367557[_0x9398('0x83')][_0x9398('0x93')]({'id':0x0,'priority':_0x367557[_0x9398('0x83')]['length']+0x1,'app':'close','appdata':_0x9398('0x94'),'interval':_0x9398('0x95')});}}return db[_0x9398('0x96')]['create']({'body':_0x14a369[_0x9398('0x5d')]['body'],'OpenchannelAccountId':_0x14a369['params']['id'],'OpenchannelInteractionId':_0x291201['id'],'direction':'in','ContactId':_0x367557[_0x9398('0x87')]['id'],'AttachmentId':_0x14a369[_0x9398('0x5d')][_0x9398('0x97')]});})[_0x9398('0x21')](function(_0x5add42){_0x367557[_0x9398('0x2a')]=_0x5add42;if(!_0x367557[_0x9398('0x90')][_0x9398('0x98')])return;return db[_0x9398('0x99')][_0x9398('0x60')]({'attributes':['id',_0x9398('0x3c')],'where':{'id':_0x367557['interaction']['UserId']}});})[_0x9398('0x21')](function(_0x406f6d){if(_0x406f6d){_0x367557[_0x9398('0x83')][_0x9398('0x9a')]({'id':0x0,'priority':0x0,'app':_0x9398('0x9b'),'appdata':_0x406f6d[_0x9398('0x3c')]+','+(_0x367557['account'][_0x9398('0x9c')]||0xa),'interval':'*,*,*,*'});}if(!_0x367557[_0x9398('0x90')]['queueId'])return;return db[_0x9398('0x9d')][_0x9398('0x60')]({'attributes':['id',_0x9398('0x3c')],'where':{'id':_0x367557['interaction'][_0x9398('0x9e')]}});})[_0x9398('0x21')](function(_0x54bfbe){if(_0x54bfbe){_0x367557[_0x9398('0x83')][_0x9398('0x9a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x54bfbe[_0x9398('0x3c')]+','+(_0x367557[_0x9398('0x81')][_0x9398('0x9f')]||0x12c),'interval':_0x9398('0x95')});}return respondWithRpcPromise(_0x9398('0xa0'),_0x9398('0xa1'),_0x367557);})[_0x9398('0x21')](function(_0x4b2584){respondWithRpcPromise(_0x9398('0xa2'),_0x9398('0xa2'),{'event':_0x9398('0x6d'),'message':_0x4b2584},client9002);return _0x4b2584;})['then'](respondWithResult(_0x25f099,null))['catch'](handleError(_0x25f099,null));};exports[_0x9398('0xa3')]=function(_0x15cbff,_0x2d9e73){var _0x9da8ed=_0x15cbff[_0x9398('0x59')]['id'];var _0x455bc1=_0x15cbff['body'];var _0x3c314e=0xc8;var _0x2f756a=null;return db[_0x9398('0xa4')][_0x9398('0xa5')]({'isolationLevel':db[_0x9398('0xa4')][_0x9398('0xa6')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x308e5b){return db[_0x9398('0x3f')]['findOne']({'where':{'id':_0x9da8ed},'transaction':_0x308e5b})[_0x9398('0x21')](function(_0xe71d21){if(_0xe71d21){return db[_0x9398('0xa7')]['destroy']({'where':{'OpenchannelAccountId':_0x9da8ed},'transaction':_0x308e5b})[_0x9398('0x21')](function(){var _0x613edd=_[_0x9398('0x45')](_0x455bc1,function(_0x51f159){_0x51f159['OpenchannelAccountId']=_0x9da8ed;return _0x51f159;});return db[_0x9398('0xa7')]['bulkCreate'](_0x613edd,{'transaction':_0x308e5b});});}else{_0x3c314e=0x194;_0x2f756a=[];}});})['then'](function(){if(_0x3c314e!==0x194){return db[_0x9398('0xa7')][_0x9398('0xa8')]({'where':{'OpenchannelAccountId':_0x9da8ed},'order':_0x9398('0xa9')})['then'](function(_0x21c717){_0x2f756a=_0x21c717;});}})[_0x9398('0x57')](function(_0x55083e){_0x3c314e=0x1f4;logger[_0x9398('0x28')](_0x55083e[_0x9398('0xaa')]);if(_0x55083e['name']){delete _0x55083e[_0x9398('0x3c')];}_0x2f756a=_0x55083e;})[_0x9398('0xab')](function(){if(_0x2f756a===null){_0x2d9e73[_0x9398('0x3b')](_0x3c314e);}else{if(_0x3c314e===0x1f4){_0x2d9e73[_0x9398('0x2c')](_0x3c314e)[_0x9398('0xac')](_0x2f756a);}else{_0x2d9e73['status'](_0x3c314e)[_0x9398('0x33')](_0x2f756a);}}});};exports['getApplications']=function(_0x2ec24c,_0x381522,_0x31a73e){var _0x593640={};var _0x527897={};var _0xcc61d0;var _0x20e350;return db[_0x9398('0x3f')][_0x9398('0x6a')]({'where':{'id':_0x2ec24c[_0x9398('0x59')]['id']}})[_0x9398('0x21')](handleEntityNotFound(_0x381522,null))['then'](function(_0x221401){if(_0x221401){_0xcc61d0=_0x221401;_0x527897[_0x9398('0x44')]=_[_0x9398('0x46')](db['OpenchannelApplication'][_0x9398('0x40')]);_0x527897['query']=_[_0x9398('0x46')](_0x2ec24c[_0x9398('0x4b')]);_0x527897[_0x9398('0x47')]=_[_0x9398('0x5b')](_0x527897['model'],_0x527897[_0x9398('0x4b')]);_0x593640[_0x9398('0x48')]=_['intersection'](_0x527897[_0x9398('0x44')],qs[_0x9398('0x49')](_0x2ec24c[_0x9398('0x4b')][_0x9398('0x49')]));_0x593640[_0x9398('0x48')]=_0x593640[_0x9398('0x48')][_0x9398('0x4a')]?_0x593640['attributes']:_0x527897[_0x9398('0x44')];_0x593640['order']=qs[_0x9398('0x4f')](_0x2ec24c[_0x9398('0x4b')][_0x9398('0x4f')]);_0x593640['where']=qs[_0x9398('0x47')](_['pick'](_0x2ec24c[_0x9398('0x4b')],_0x527897[_0x9398('0x47')]));if(_0x2ec24c[_0x9398('0x4b')][_0x9398('0x51')]){_0x593640[_0x9398('0x50')]=_[_0x9398('0x52')](_0x593640['where'],{'$or':_[_0x9398('0x45')](_0x593640[_0x9398('0x48')],function(_0x43aff5){var _0x14847b={};_0x14847b[_0x43aff5]={'$like':'%'+_0x2ec24c[_0x9398('0x4b')][_0x9398('0x51')]+'%'};return _0x14847b;})});}_0x593640=_['merge']({},_0x593640,_0x2ec24c['options']);return _0xcc61d0[_0x9398('0xad')](_0x593640);}})[_0x9398('0x21')](function(_0x13b63c){if(_0x13b63c){_0x20e350=_0x13b63c[_0x9398('0x4a')];if(!_0x2ec24c['query']['hasOwnProperty'](_0x9398('0x4d'))){_0x593640[_0x9398('0x2e')]=qs[_0x9398('0x2e')](_0x2ec24c[_0x9398('0x4b')][_0x9398('0x2e')]);_0x593640[_0x9398('0x2d')]=qs[_0x9398('0x2d')](_0x2ec24c[_0x9398('0x4b')][_0x9398('0x2d')]);}return _0xcc61d0['getApplications'](_0x593640);}})['then'](function(_0x124acf){if(_0x124acf){return _0x124acf?{'count':_0x20e350,'rows':_0x124acf}:null;}})[_0x9398('0x21')](respondWithResult(_0x381522,null))[_0x9398('0x57')](handleError(_0x381522,null));};exports[_0x9398('0xae')]=function(_0x39a799,_0x446813,_0x4a43ed){var _0x16f276={'raw':![],'where':{}};var _0x58c9ac={};var _0x146857={'count':0x0,'rows':[]};return db[_0x9398('0x3f')][_0x9398('0x6a')]({'where':{'id':_0x39a799[_0x9398('0x59')]['id']}})[_0x9398('0x21')](handleEntityNotFound(_0x446813,null))['then'](function(_0x57f828){if(_0x57f828){_0x58c9ac[_0x9398('0x44')]=_['keys'](db[_0x9398('0x8c')][_0x9398('0x40')]);_0x58c9ac[_0x9398('0x4b')]=_[_0x9398('0x46')](_0x39a799[_0x9398('0x4b')]);_0x58c9ac[_0x9398('0x47')]=_['intersection'](_0x58c9ac[_0x9398('0x44')],_0x58c9ac['query']);_0x16f276[_0x9398('0x48')]=_[_0x9398('0x5b')](_0x58c9ac[_0x9398('0x44')],qs[_0x9398('0x49')](_0x39a799[_0x9398('0x4b')][_0x9398('0x49')]));_0x16f276[_0x9398('0x48')]=_0x16f276[_0x9398('0x48')]['length']?_0x16f276['attributes']:_0x58c9ac[_0x9398('0x44')];if(!_0x39a799['query'][_0x9398('0x4c')](_0x9398('0x4d'))){_0x16f276['limit']=qs[_0x9398('0x2e')](_0x39a799[_0x9398('0x4b')][_0x9398('0x2e')]);_0x16f276['offset']=qs[_0x9398('0x2d')](_0x39a799[_0x9398('0x4b')]['offset']);}_0x16f276[_0x9398('0x4e')]=qs[_0x9398('0x4f')](_0x39a799['query'][_0x9398('0x4f')]);_0x16f276[_0x9398('0x50')]=qs[_0x9398('0x47')](_[_0x9398('0x66')](_0x39a799[_0x9398('0x4b')],_0x58c9ac[_0x9398('0x47')]));_0x16f276[_0x9398('0x50')][_0x9398('0x64')]=_0x57f828['id'];if(_0x39a799[_0x9398('0x4b')]['filter']){_0x16f276[_0x9398('0x50')]=_['merge'](_0x16f276[_0x9398('0x50')],{'$or':_[_0x9398('0x45')](_0x16f276[_0x9398('0x48')],function(_0x31b210){var _0x49a2bf={};_0x49a2bf[_0x31b210]={'$like':'%'+_0x39a799[_0x9398('0x4b')][_0x9398('0x51')]+'%'};return _0x49a2bf;})});}_0x16f276=_[_0x9398('0x52')]({},_0x16f276,_0x39a799[_0x9398('0x53')]);return db[_0x9398('0x8c')][_0x9398('0x30')]({'where':_0x16f276[_0x9398('0x50')]})[_0x9398('0x21')](function(_0x4a14f1){_0x146857[_0x9398('0x30')]=_0x4a14f1;if(_0x39a799[_0x9398('0x4b')][_0x9398('0x54')]){_0x16f276['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x9398('0x99')],'as':'Owner','attributes':['name',_0x9398('0xaf'),'internal'],'required':![]},{'model':db[_0x9398('0xb0')],'as':_0x9398('0xb1'),'attributes':['id',_0x9398('0x3c'),_0x9398('0xb2')],'where':_0x39a799[_0x9398('0x4b')][_0x9398('0xb3')]?{'id':_0x39a799[_0x9398('0x4b')][_0x9398('0xb3')]}:undefined,'required':_0x39a799['query'][_0x9398('0xb3')]?!![]:![]}];}return db[_0x9398('0x8c')][_0x9398('0x56')](_0x16f276);})['then'](function(_0x3d1afd){_0x146857[_0x9398('0x67')]=_0x3d1afd;return _0x146857;});}})['then'](respondWithFilteredResult(_0x446813,_0x16f276))[_0x9398('0x57')](handleError(_0x446813,null));};exports[_0x9398('0xb4')]=function(_0x3f16a8,_0x162882,_0x35c422){return db['OpenchannelAccount'][_0x9398('0x60')]({'where':{'id':_0x3f16a8['params']['id']}})[_0x9398('0x21')](handleEntityNotFound(_0x162882,null))[_0x9398('0x21')](function(_0x5915bc){if(_0x5915bc){return _0x5915bc['addAgents'](_0x3f16a8['body'][_0x9398('0x6c')],_[_0x9398('0xb5')](_0x3f16a8[_0x9398('0x5d')],['ids','id'])||{})[_0x9398('0x8e')](function(_0x414981){for(var _0x4f60b5=0x0;_0x4f60b5<_0x3f16a8[_0x9398('0x5d')][_0x9398('0x6c')]['length'];_0x4f60b5+=0x1){socket[_0x9398('0xb6')](_0x9398('0xb7'),{'UserId':Number(_0x3f16a8[_0x9398('0x5d')][_0x9398('0x6c')][_0x4f60b5]),'OpenchannelAccountId':Number(_0x3f16a8['params']['id'])});}return _0x414981;});}})['then'](respondWithResult(_0x162882,null))[_0x9398('0x57')](handleError(_0x162882,null));};exports[_0x9398('0xb8')]=function(_0x542fc3,_0x1516a5,_0x18a91b){return db[_0x9398('0x3f')][_0x9398('0x60')]({'where':{'id':_0x542fc3[_0x9398('0x59')]['id']}})['then'](handleEntityNotFound(_0x1516a5,null))['then'](function(_0x1afab4){if(_0x1afab4){return _0x1afab4[_0x9398('0xb8')](_0x542fc3[_0x9398('0x4b')][_0x9398('0x6c')])[_0x9398('0x21')](function(){if(_[_0x9398('0xb9')](_0x542fc3[_0x9398('0x4b')][_0x9398('0x6c')])){for(var _0x4e6c5a=0x0;_0x4e6c5a<_0x542fc3[_0x9398('0x4b')][_0x9398('0x6c')][_0x9398('0x4a')];_0x4e6c5a+=0x1){socket['emit'](_0x9398('0xba'),{'UserId':Number(_0x542fc3['query'][_0x9398('0x6c')][_0x4e6c5a]),'OpenchannelAccountId':Number(_0x542fc3[_0x9398('0x59')]['id'])});}}else{socket['emit'](_0x9398('0xba'),{'UserId':Number(_0x542fc3['query'][_0x9398('0x6c')]),'OpenchannelAccountId':Number(_0x542fc3['params']['id'])});}});}})[_0x9398('0x21')](respondWithStatusCode(_0x1516a5,null))[_0x9398('0x57')](handleError(_0x1516a5,null));};exports[_0x9398('0xbb')]=function(_0x4e9fae,_0xf883cf,_0x129acf){var _0x1a4c79={};var _0xcb5ef4={};var _0x216662;var _0x57be48;return db[_0x9398('0x3f')][_0x9398('0x6a')]({'where':{'id':_0x4e9fae[_0x9398('0x59')]['id']}})['then'](handleEntityNotFound(_0xf883cf,null))[_0x9398('0x21')](function(_0x28a111){if(_0x28a111){_0x216662=_0x28a111;_0xcb5ef4[_0x9398('0x44')]=_[_0x9398('0x46')](db[_0x9398('0x99')]['rawAttributes']);_0xcb5ef4[_0x9398('0x4b')]=_[_0x9398('0x46')](_0x4e9fae[_0x9398('0x4b')]);_0xcb5ef4['filters']=_['intersection'](_0xcb5ef4[_0x9398('0x44')],_0xcb5ef4['query']);_0x1a4c79[_0x9398('0x48')]=_['intersection'](_0xcb5ef4[_0x9398('0x44')],qs[_0x9398('0x49')](_0x4e9fae[_0x9398('0x4b')][_0x9398('0x49')]));_0x1a4c79[_0x9398('0x48')]=_0x1a4c79['attributes'][_0x9398('0x4a')]?_0x1a4c79[_0x9398('0x48')]:_0xcb5ef4[_0x9398('0x44')];_0x1a4c79[_0x9398('0x4e')]=qs['sort'](_0x4e9fae[_0x9398('0x4b')][_0x9398('0x4f')]);_0x1a4c79[_0x9398('0x50')]=qs[_0x9398('0x47')](_[_0x9398('0x66')](_0x4e9fae[_0x9398('0x4b')],_0xcb5ef4[_0x9398('0x47')]));if(_0x4e9fae['query'][_0x9398('0x51')]){_0x1a4c79[_0x9398('0x50')]=_['merge'](_0x1a4c79[_0x9398('0x50')],{'$or':_[_0x9398('0x45')](_0x1a4c79['attributes'],function(_0x5e2acf){var _0x347777={};_0x347777[_0x5e2acf]={'$like':'%'+_0x4e9fae['query'][_0x9398('0x51')]+'%'};return _0x347777;})});}_0x1a4c79=_['merge']({},_0x1a4c79,_0x4e9fae[_0x9398('0x53')]);return _0x216662[_0x9398('0xbb')](_0x1a4c79);}})['then'](function(_0x5116f0){if(_0x5116f0){_0x57be48=_0x5116f0[_0x9398('0x4a')];if(!_0x4e9fae[_0x9398('0x4b')][_0x9398('0x4c')](_0x9398('0x4d'))){_0x1a4c79['limit']=qs[_0x9398('0x2e')](_0x4e9fae[_0x9398('0x4b')][_0x9398('0x2e')]);_0x1a4c79[_0x9398('0x2d')]=qs['offset'](_0x4e9fae[_0x9398('0x4b')][_0x9398('0x2d')]);}return _0x216662[_0x9398('0xbb')](_0x1a4c79);}})[_0x9398('0x21')](function(_0x37ebf6){if(_0x37ebf6){return _0x37ebf6?{'count':_0x57be48,'rows':_0x37ebf6}:null;}})[_0x9398('0x21')](respondWithResult(_0xf883cf,null))[_0x9398('0x57')](handleError(_0xf883cf,null));};exports[_0x9398('0xac')]=function(_0x193e28,_0x236e9b,_0x4911c1){var _0x43127f,_0x1fed9a,_0x2b746f;if(_[_0x9398('0x78')](_0x193e28[_0x9398('0x5d')][_0x9398('0x5d')])||_0x193e28[_0x9398('0x5d')][_0x9398('0x5d')]===''){throw new db[(_0x9398('0x76'))][(_0x9398('0x70'))](_0x9398('0xbc'));}if(_[_0x9398('0x78')](_0x193e28[_0x9398('0x5d')]['to'])){}_0x43127f=_0x193e28[_0x9398('0x5d')]['to'];return db[_0x9398('0x3f')]['findOne']({'where':{'id':_0x193e28[_0x9398('0x59')]['id']}})['then'](handleEntityNotFound(_0x236e9b,null))[_0x9398('0x21')](function(_0x17f045){if(_0x17f045){return db[_0x9398('0x3f')][_0x9398('0x60')]({'where':{'id':_0x17f045['id']},'include':[{'model':db[_0x9398('0x7d')],'as':'List','include':[{'model':db[_0x9398('0x6f')],'as':'Contacts','where':{[_0x17f045[_0x9398('0x79')]]:_0x43127f},'limit':0x1,'order':[[_0x9398('0x73'),_0x9398('0x7f')]]}]}]})[_0x9398('0x21')](handleEntityNotFound(_0x236e9b,null))[_0x9398('0x21')](function(_0x93fea4){if(_0x93fea4&&_0x93fea4[_0x9398('0x7e')]){_0x1fed9a=_0x93fea4['get']({'plain':!![]});if(_0x1fed9a[_0x9398('0x7e')]&&_0x1fed9a[_0x9398('0x7e')][_0x9398('0x86')][_0x9398('0x4a')]){return _0x1fed9a[_0x9398('0x7e')][_0x9398('0x86')][0x0];}return db[_0x9398('0x6f')]['create'](_[_0x9398('0x1a')](_0x193e28[_0x9398('0x5d')],{'firstName':_0x43127f,[_0x93fea4[_0x9398('0x79')]]:_0x43127f,'phone':_0x43127f,'ListId':_0x1fed9a[_0x9398('0x75')]}));}})[_0x9398('0x21')](handleEntityNotFound(_0x236e9b,null))[_0x9398('0x21')](function(_0x47eb71){if(_0x47eb71){_0x2b746f=_0x47eb71;return db[_0x9398('0x8c')][_0x9398('0x60')]({'where':{'ContactId':_0x2b746f['id'],'closed':![],'OpenchannelAccountId':_0x1fed9a['id']}})[_0x9398('0x21')](function(_0x1a0fda){if(_0x1a0fda){return[_0x1a0fda,![]];}return db[_0x9398('0x8c')]['create']({'UserId':_0x193e28[_0x9398('0xbd')]['id'],'ContactId':_0x2b746f['id'],'OpenchannelAccountId':_0x1fed9a['id'],'lastMsgDirection':_0x9398('0xbe'),'firstMsgDirection':_0x9398('0xbe'),'Messages':[_['merge'](_0x193e28[_0x9398('0x5d')],{'read':![],'body':_0x193e28[_0x9398('0x5d')][_0x9398('0x5d')],'OpenchannelAccountId':_0x1fed9a['id'],'UserId':_0x193e28[_0x9398('0xbd')]['id'],'ContactId':_0x2b746f['id']})]},{'include':[{'model':db[_0x9398('0x96')],'as':_0x9398('0xbf')}]})[_0x9398('0x21')](function(_0x34ca5d){return[_0x34ca5d,!![]];});});}})[_0x9398('0x8e')](function(_0x57cc75,_0x24dc58){if(_0x24dc58){return _0x57cc75;}return db[_0x9398('0x96')][_0x9398('0x5c')](_['merge'](_0x193e28[_0x9398('0x5d')],{'read':![],'body':_0x193e28[_0x9398('0x5d')][_0x9398('0x5d')],'OpenchannelAccountId':_0x1fed9a['id'],'OpenchannelInteractionId':_0x57cc75['id'],'UserId':_0x193e28[_0x9398('0xbd')]['id'],'ContactId':_0x2b746f['id']}))[_0x9398('0x21')](function(_0x16be5c){_0x57cc75['dataValues'][_0x9398('0xbf')]=[];_0x57cc75['dataValues']['Messages'][_0x9398('0x93')](_0x16be5c[_0x9398('0xc0')]);return _0x57cc75;});});}})['then'](respondWithResult(_0x236e9b,null))[_0x9398('0x57')](handleError(_0x236e9b,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 85a0ce2..fc85c39 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 _0xec56=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0xec56,0x1bd));var _0x6ec5=function(_0x534c77,_0x43a1f7){_0x534c77=_0x534c77-0x0;var _0x37a241=_0xec56[_0x534c77];return _0x37a241;};'use strict';var EventEmitter=require(_0x6ec5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6ec5('0x1')](0x0);var events={'afterCreate':_0x6ec5('0x2'),'afterUpdate':_0x6ec5('0x3'),'afterDestroy':_0x6ec5('0x4')};function emitEvent(_0x43c2cd){return function(_0x399441,_0x469679,_0x173aeb){OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd+':'+_0x399441['id'],_0x399441);OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd,_0x399441);_0x173aeb(null);};}for(var e in events){if(events[_0x6ec5('0x6')](e)){var event=events[e];OpenchannelAccount[_0x6ec5('0x7')](e,emitEvent(event));}}module[_0x6ec5('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xdace=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0xbbcb36,_0x586383){var _0x4278ff=function(_0x35c9da){while(--_0x35c9da){_0xbbcb36['push'](_0xbbcb36['shift']());}};_0x4278ff(++_0x586383);}(_0xdace,0xc5));var _0xedac=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0xdace[_0x34eb31];return _0x254994;};'use strict';var EventEmitter=require(_0xedac('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xedac('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':'update','afterDestroy':_0xedac('0x4')};function emitEvent(_0x36bcd2){return function(_0x15d3bd,_0xefb142,_0x5a97c0){OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2+':'+_0x15d3bd['id'],_0x15d3bd);OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2,_0x15d3bd);_0x5a97c0(null);};}for(var e in events){if(events[_0xedac('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xedac('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 f02d4b4..597758c 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(_0xeb1914,_0x53e264){var _0x15f7f3=function(_0x5dc097){while(--_0x5dc097){_0xeb1914['push'](_0xeb1914['shift']());}};_0x15f7f3(++_0x53e264);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x96f9cd,_0x19f823){var _0x1409ba=function(_0x267e3c){while(--_0x267e3c){_0x96f9cd['push'](_0x96f9cd['shift']());}};_0x1409ba(++_0x19f823);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 7609bb7..46b457f 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 _0xbc9d=['moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x144492,_0x18dd3b){var _0x55995e=function(_0x420906){while(--_0x420906){_0x144492['push'](_0x144492['shift']());}};_0x55995e(++_0x18dd3b);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x18ff0c,_0x129418){_0x18ff0c=_0x18ff0c-0x0;var _0x53dcbf=_0xbc9d[_0x18ff0c];return _0x53dcbf;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var moment=require(_0xdbc9('0x2'));var BPromise=require(_0xdbc9('0x3'));var rs=require(_0xdbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var jayson=require(_0xdbc9('0x8'));var client=jayson[_0xdbc9('0x9')][_0xdbc9('0xa')]({'port':0x232a});config[_0xdbc9('0xb')]=_['defaults'](config[_0xdbc9('0xb')],{'host':_0xdbc9('0xc'),'port':0x18eb});var socket=require(_0xdbc9('0xd'))(new Redis(config['redis']));require(_0xdbc9('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b5de2,_0x11b448,_0xe9bbde){return new BPromise(function(_0x19be1d,_0x2f5e6d){return client['request'](_0x5b5de2,_0xe9bbde)[_0xdbc9('0xf')](function(_0x187149){logger[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x11b448,_0xdbc9('0x12'));logger[_0xdbc9('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11b448,'request\x20sent',JSON[_0xdbc9('0x14')](_0x187149));if(_0x187149[_0xdbc9('0x15')]){if(_0x187149[_0xdbc9('0x15')][_0xdbc9('0x16')]===0x1f4){logger[_0xdbc9('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x11b448,_0x187149[_0xdbc9('0x15')][_0xdbc9('0x17')]);return _0x2f5e6d(_0x187149[_0xdbc9('0x15')]['message']);}logger[_0xdbc9('0x15')](_0xdbc9('0x11'),_0x11b448,_0x187149['error'][_0xdbc9('0x17')]);return _0x19be1d(_0x187149[_0xdbc9('0x15')][_0xdbc9('0x17')]);}else{logger[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x11b448,_0xdbc9('0x12'));_0x19be1d(_0x187149[_0xdbc9('0x18')][_0xdbc9('0x17')]);}})[_0xdbc9('0x19')](function(_0x981fc0){logger['error'](_0xdbc9('0x11'),_0x11b448,_0x981fc0);_0x2f5e6d(_0x981fc0);});});} \ No newline at end of file +var _0x4ded=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x39e740,_0x3a3084){var _0x49d5fc=function(_0x344959){while(--_0x344959){_0x39e740['push'](_0x39e740['shift']());}};_0x49d5fc(++_0x3a3084);}(_0x4ded,0x116));var _0xd4de=function(_0x515290,_0x486247){_0x515290=_0x515290-0x0;var _0x3bd489=_0x4ded[_0x515290];return _0x3bd489;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});config[_0xd4de('0xd')]=_[_0xd4de('0xe')](config[_0xd4de('0xd')],{'host':_0xd4de('0xf'),'port':0x18eb});var socket=require(_0xd4de('0x10'))(new Redis(config['redis']));require(_0xd4de('0x11'))['register'](socket);function respondWithRpcPromise(_0x4ab822,_0x4b0876,_0x176b31){return new BPromise(function(_0x459a46,_0x4e5b10){return client['request'](_0x4ab822,_0x176b31)['then'](function(_0x29e265){logger['info'](_0xd4de('0x12'),_0x4b0876,_0xd4de('0x13'));logger[_0xd4de('0x14')](_0xd4de('0x15'),_0x4b0876,_0xd4de('0x13'),JSON[_0xd4de('0x16')](_0x29e265));if(_0x29e265[_0xd4de('0x17')]){if(_0x29e265[_0xd4de('0x17')][_0xd4de('0x18')]===0x1f4){logger[_0xd4de('0x17')](_0xd4de('0x12'),_0x4b0876,_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);return _0x4e5b10(_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);}logger[_0xd4de('0x17')](_0xd4de('0x12'),_0x4b0876,_0x29e265['error']['message']);return _0x459a46(_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);}else{logger[_0xd4de('0x1a')](_0xd4de('0x12'),_0x4b0876,'request\x20sent');_0x459a46(_0x29e265['result'][_0xd4de('0x19')]);}})['catch'](function(_0xeaaefa){logger[_0xd4de('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b0876,_0xeaaefa);_0x4e5b10(_0xeaaefa);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 10b193f..efe7b15 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 _0x0531=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0531,0xde));var _0x1053=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x0531[_0x49c057];return _0xd8f0e6;};'use strict';var OpenchannelAccountEvents=require(_0x1053('0x0'));var events=[_0x1053('0x1'),'remove','update'];function createListener(_0x450b81,_0x48bca0){return function(_0x5ced96){_0x48bca0[_0x1053('0x2')](_0x450b81,_0x5ced96);};}function removeListener(_0x117b5a,_0x12d7ea){return function(){OpenchannelAccountEvents[_0x1053('0x3')](_0x117b5a,_0x12d7ea);};}exports[_0x1053('0x4')]=function(_0x5d8ce2){for(var _0x29e7cd=0x0,_0x3350a0=events[_0x1053('0x5')];_0x29e7cd<_0x3350a0;_0x29e7cd++){var _0x3d052e=events[_0x29e7cd];var _0x4f1877=createListener(_0x1053('0x6')+_0x3d052e,_0x5d8ce2);OpenchannelAccountEvents['on'](_0x3d052e,_0x4f1877);}}; \ No newline at end of file +var _0x0884=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','removeListener'];(function(_0x302325,_0x51c70c){var _0x3d0e32=function(_0x5deadb){while(--_0x5deadb){_0x302325['push'](_0x302325['shift']());}};_0x3d0e32(++_0x51c70c);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x4088('0x0'));var events=[_0x4088('0x1'),_0x4088('0x2'),_0x4088('0x3')];function createListener(_0x39e7de,_0x1e9e1d){return function(_0x300c58){_0x1e9e1d['emit'](_0x39e7de,_0x300c58);};}function removeListener(_0x3c15b9,_0x634f6f){return function(){OpenchannelAccountEvents[_0x4088('0x4')](_0x3c15b9,_0x634f6f);};}exports[_0x4088('0x5')]=function(_0x3b1d74){for(var _0x4da2f7=0x0,_0x4d68aa=events[_0x4088('0x6')];_0x4da2f7<_0x4d68aa;_0x4da2f7++){var _0x52baff=events[_0x4da2f7];var _0x680227=createListener(_0x4088('0x7')+_0x52baff,_0x3b1d74);OpenchannelAccountEvents['on'](_0x52baff,_0x680227);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6d9ed9d..1d0d901 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 _0x9907=['show','post','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x571d97,_0x37b351){var _0x1d916a=function(_0x5dcb54){while(--_0x5dcb54){_0x571d97['push'](_0x571d97['shift']());}};_0x1d916a(++_0x37b351);}(_0x9907,0x1c7));var _0x7990=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x9907[_0x5ad0d7];return _0xd83bd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7990('0x0'));var express=require(_0x7990('0x1'));var router=express[_0x7990('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7990('0x3'));var interaction=require(_0x7990('0x4'));var config=require(_0x7990('0x5'));var controller=require('./openchannelApplication.controller');router[_0x7990('0x6')]('/',auth[_0x7990('0x7')](),controller[_0x7990('0x8')]);router['get'](_0x7990('0x9'),auth[_0x7990('0x7')](),controller[_0x7990('0xa')]);router[_0x7990('0xb')]('/',auth[_0x7990('0x7')](),controller['create']);router['put'](_0x7990('0x9'),auth[_0x7990('0x7')](),controller[_0x7990('0xc')]);router['delete'](_0x7990('0x9'),auth[_0x7990('0x7')](),controller[_0x7990('0xd')]);module[_0x7990('0xe')]=router; \ No newline at end of file +var _0x16fd=['get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x143f27,_0x391bc4){var _0x10c00a=function(_0x3ec306){while(--_0x3ec306){_0x143f27['push'](_0x143f27['shift']());}};_0x10c00a(++_0x391bc4);}(_0x16fd,0x1d8));var _0xd16f=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x16fd[_0x3598bb];return _0x13c837;};'use strict';var multer=require(_0xd16f('0x0'));var util=require(_0xd16f('0x1'));var path=require(_0xd16f('0x2'));var timeout=require(_0xd16f('0x3'));var express=require(_0xd16f('0x4'));var router=express[_0xd16f('0x5')]();var fs_extra=require(_0xd16f('0x6'));var auth=require(_0xd16f('0x7'));var interaction=require(_0xd16f('0x8'));var config=require(_0xd16f('0x9'));var controller=require(_0xd16f('0xa'));router[_0xd16f('0xb')]('/',auth['isAuthenticated'](),controller[_0xd16f('0xc')]);router[_0xd16f('0xb')](_0xd16f('0xd'),auth[_0xd16f('0xe')](),controller['show']);router[_0xd16f('0xf')]('/',auth[_0xd16f('0xe')](),controller[_0xd16f('0x10')]);router[_0xd16f('0x11')](_0xd16f('0xd'),auth[_0xd16f('0xe')](),controller[_0xd16f('0x12')]);router[_0xd16f('0x13')](_0xd16f('0xd'),auth[_0xd16f('0xe')](),controller[_0xd16f('0x14')]);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 cfe0b20..b333bfb 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 _0x882a=['STRING','TEXT','*,*,*,*','sequelize'];(function(_0x99ea58,_0x137c1a){var _0x319e3b=function(_0x13489f){while(--_0x13489f){_0x99ea58['push'](_0x99ea58['shift']());}};_0x319e3b(++_0x137c1a);}(_0x882a,0x1e7));var _0xa882=function(_0x100bbe,_0x1f1a15){_0x100bbe=_0x100bbe-0x0;var _0x14ddab=_0x882a[_0x100bbe];return _0x14ddab;};'use strict';var Sequelize=require(_0xa882('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa882('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa882('0x2')]()},'description':{'type':Sequelize[_0xa882('0x1')]},'interval':{'type':Sequelize[_0xa882('0x1')],'defaultValue':_0xa882('0x3')}}; \ No newline at end of file +var _0xb2a0=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x22b2be,_0x4b164c){var _0x213c31=function(_0x475528){while(--_0x475528){_0x22b2be['push'](_0x22b2be['shift']());}};_0x213c31(++_0x4b164c);}(_0xb2a0,0x8b));var _0x0b2a=function(_0x51092b,_0x54f9b5){_0x51092b=_0x51092b-0x0;var _0x41f803=_0xb2a0[_0x51092b];return _0x41f803;};'use strict';var Sequelize=require('sequelize');module[_0x0b2a('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0b2a('0x1')],'allowNull':![],'defaultValue':_0x0b2a('0x2')},'appdata':{'type':Sequelize[_0x0b2a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0b2a('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b2d48d0..0be07da 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 _0x2b87=['moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','name','send','index','OpenchannelApplication','rawAttributes','type','key','map','keys','query','model','intersection','fields','attributes','length','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','params','catch','create','body','update','find','zip-dir','fast-json-patch','request-promise'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x2b87,0x111));var _0x72b8=function(_0x348df0,_0x50076b){_0x348df0=_0x348df0-0x0;var _0x53f21a=_0x2b87[_0x348df0];return _0x53f21a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x72b8('0x0'));var jsonpatch=require(_0x72b8('0x1'));var rp=require(_0x72b8('0x2'));var moment=require(_0x72b8('0x3'));var BPromise=require(_0x72b8('0x4'));var Mustache=require(_0x72b8('0x5'));var util=require(_0x72b8('0x6'));var path=require(_0x72b8('0x7'));var sox=require(_0x72b8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72b8('0x9'));var _=require(_0x72b8('0xa'));var squel=require(_0x72b8('0xb'));var crypto=require(_0x72b8('0xc'));var jsforce=require(_0x72b8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72b8('0xe'));var Papa=require(_0x72b8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x72b8('0x10'));var hardwareService=require(_0x72b8('0x11'));var logger=require(_0x72b8('0x12'))(_0x72b8('0x13'));var utils=require(_0x72b8('0x14'));var config=require(_0x72b8('0x15'));var licenseUtil=require(_0x72b8('0x16'));var db=require(_0x72b8('0x17'))['db'];function respondWithStatusCode(_0x2772ee,_0x164606){_0x164606=_0x164606||0xcc;return function(_0x575669){if(_0x575669){return _0x2772ee[_0x72b8('0x18')](_0x164606);}return _0x2772ee[_0x72b8('0x19')](_0x164606)[_0x72b8('0x1a')]();};}function respondWithResult(_0x45944c,_0x4b581b){_0x4b581b=_0x4b581b||0xc8;return function(_0x2d4698){if(_0x2d4698){return _0x45944c[_0x72b8('0x19')](_0x4b581b)[_0x72b8('0x1b')](_0x2d4698);}};}function respondWithFilteredResult(_0x4aafe2,_0x292e3d){return function(_0x108af2){if(_0x108af2){var _0x2bc098=typeof _0x292e3d[_0x72b8('0x1c')]===_0x72b8('0x1d')&&typeof _0x292e3d['limit']==='undefined';var _0xb5c7d4=_0x108af2[_0x72b8('0x1e')];var _0x1e83ea=_0x2bc098?0x0:_0x292e3d[_0x72b8('0x1c')];var _0x2b8d14=_0x2bc098?_0x108af2[_0x72b8('0x1e')]:_0x292e3d[_0x72b8('0x1c')]+_0x292e3d[_0x72b8('0x1f')];var _0x26e188;if(_0x2b8d14>=_0xb5c7d4){_0x2b8d14=_0xb5c7d4;_0x26e188=0xc8;}else{_0x26e188=0xce;}_0x4aafe2['status'](_0x26e188);return _0x4aafe2['set'](_0x72b8('0x20'),_0x1e83ea+'-'+_0x2b8d14+'/'+_0xb5c7d4)[_0x72b8('0x1b')](_0x108af2);}return null;};}function patchUpdates(_0x1331af){return function(_0x517f8b){try{jsonpatch[_0x72b8('0x21')](_0x517f8b,_0x1331af,!![]);}catch(_0x1e89d0){return BPromise['reject'](_0x1e89d0);}return _0x517f8b[_0x72b8('0x22')]();};}function saveUpdates(_0xd951b8,_0x1524b9){return function(_0x198d95){if(_0x198d95){return _0x198d95['update'](_0xd951b8)[_0x72b8('0x23')](function(_0x536895){return _0x536895;});}return null;};}function removeEntity(_0x52812d,_0x459545){return function(_0x4ba753){if(_0x4ba753){return _0x4ba753[_0x72b8('0x24')]()[_0x72b8('0x23')](function(){_0x52812d[_0x72b8('0x19')](0xcc)[_0x72b8('0x1a')]();});}};}function handleEntityNotFound(_0x1a0838,_0x522d22){return function(_0x504c76){if(!_0x504c76){_0x1a0838[_0x72b8('0x18')](0x194);}return _0x504c76;};}function handleError(_0x5b2b7c,_0x39069b){_0x39069b=_0x39069b||0x1f4;return function(_0x4d634d){logger[_0x72b8('0x25')](_0x4d634d['stack']);if(_0x4d634d[_0x72b8('0x26')]){delete _0x4d634d[_0x72b8('0x26')];}_0x5b2b7c[_0x72b8('0x19')](_0x39069b)[_0x72b8('0x27')](_0x4d634d);};}exports[_0x72b8('0x28')]=function(_0x2749ec,_0xf22b3b){var _0x175735={},_0x49109c={},_0x1dc686={'count':0x0,'rows':[]};var _0x1981aa=_['map'](db[_0x72b8('0x29')][_0x72b8('0x2a')],function(_0x320a32){return{'name':_0x320a32['fieldName'],'type':_0x320a32[_0x72b8('0x2b')][_0x72b8('0x2c')]};});_0x49109c['model']=_[_0x72b8('0x2d')](_0x1981aa,_0x72b8('0x26'));_0x49109c['query']=_[_0x72b8('0x2e')](_0x2749ec[_0x72b8('0x2f')]);_0x49109c['filters']=_['intersection'](_0x49109c[_0x72b8('0x30')],_0x49109c['query']);_0x175735['attributes']=_[_0x72b8('0x31')](_0x49109c[_0x72b8('0x30')],qs[_0x72b8('0x32')](_0x2749ec[_0x72b8('0x2f')]['fields']));_0x175735[_0x72b8('0x33')]=_0x175735[_0x72b8('0x33')][_0x72b8('0x34')]?_0x175735[_0x72b8('0x33')]:_0x49109c['model'];if(!_0x2749ec[_0x72b8('0x2f')]['hasOwnProperty']('nolimit')){_0x175735['limit']=qs['limit'](_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x1f')]);_0x175735[_0x72b8('0x1c')]=qs['offset'](_0x2749ec['query'][_0x72b8('0x1c')]);}_0x175735['order']=qs['sort'](_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x35')]);_0x175735[_0x72b8('0x36')]=qs['filters'](_[_0x72b8('0x37')](_0x2749ec[_0x72b8('0x2f')],_0x49109c[_0x72b8('0x38')]),_0x1981aa);if(_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x39')]){_0x175735[_0x72b8('0x36')]=_[_0x72b8('0x3a')](_0x175735['where'],{'$or':_['map'](_0x1981aa,function(_0x3f1d17){if(_0x3f1d17[_0x72b8('0x2b')]!=='VIRTUAL'){var _0x4dfd93={};_0x4dfd93[_0x3f1d17[_0x72b8('0x26')]]={'$like':'%'+_0x2749ec[_0x72b8('0x2f')]['filter']+'%'};return _0x4dfd93;}})});}_0x175735=_[_0x72b8('0x3a')]({},_0x175735,_0x2749ec[_0x72b8('0x3b')]);var _0x5aa261={'where':_0x175735['where']};return db[_0x72b8('0x29')]['count'](_0x5aa261)['then'](function(_0x4cb90d){_0x1dc686[_0x72b8('0x1e')]=_0x4cb90d;if(_0x2749ec[_0x72b8('0x2f')][_0x72b8('0x3c')]){_0x175735[_0x72b8('0x3d')]=[{'all':!![]}];}return db[_0x72b8('0x29')]['findAll'](_0x175735);})['then'](function(_0x2c5e89){_0x1dc686[_0x72b8('0x3e')]=_0x2c5e89;return _0x1dc686;})[_0x72b8('0x23')](respondWithFilteredResult(_0xf22b3b,_0x175735))['catch'](handleError(_0xf22b3b,null));};exports['show']=function(_0x415471,_0x43a2de){var _0x441e16={'raw':!![],'where':{'id':_0x415471[_0x72b8('0x3f')]['id']}},_0x304c3e={};_0x304c3e[_0x72b8('0x30')]=_[_0x72b8('0x2e')](db[_0x72b8('0x29')][_0x72b8('0x2a')]);_0x304c3e['query']=_[_0x72b8('0x2e')](_0x415471[_0x72b8('0x2f')]);_0x304c3e[_0x72b8('0x38')]=_[_0x72b8('0x31')](_0x304c3e[_0x72b8('0x30')],_0x304c3e[_0x72b8('0x2f')]);_0x441e16[_0x72b8('0x33')]=_[_0x72b8('0x31')](_0x304c3e[_0x72b8('0x30')],qs['fields'](_0x415471[_0x72b8('0x2f')][_0x72b8('0x32')]));_0x441e16[_0x72b8('0x33')]=_0x441e16[_0x72b8('0x33')][_0x72b8('0x34')]?_0x441e16[_0x72b8('0x33')]:_0x304c3e[_0x72b8('0x30')];if(_0x415471[_0x72b8('0x2f')][_0x72b8('0x3c')]){_0x441e16['include']=[{'all':!![]}];}_0x441e16=_['merge']({},_0x441e16,_0x415471[_0x72b8('0x3b')]);return db[_0x72b8('0x29')]['find'](_0x441e16)['then'](handleEntityNotFound(_0x43a2de,null))['then'](respondWithResult(_0x43a2de,null))[_0x72b8('0x40')](handleError(_0x43a2de,null));};exports['create']=function(_0x4193f9,_0x4ec301){return db[_0x72b8('0x29')][_0x72b8('0x41')](_0x4193f9[_0x72b8('0x42')],{})[_0x72b8('0x23')](respondWithResult(_0x4ec301,0xc9))[_0x72b8('0x40')](handleError(_0x4ec301,null));};exports[_0x72b8('0x43')]=function(_0x397f24,_0x3236df){if(_0x397f24[_0x72b8('0x42')]['id']){delete _0x397f24[_0x72b8('0x42')]['id'];}return db[_0x72b8('0x29')]['find']({'where':{'id':_0x397f24[_0x72b8('0x3f')]['id']}})[_0x72b8('0x23')](handleEntityNotFound(_0x3236df,null))[_0x72b8('0x23')](saveUpdates(_0x397f24[_0x72b8('0x42')],null))[_0x72b8('0x23')](respondWithResult(_0x3236df,null))['catch'](handleError(_0x3236df,null));};exports[_0x72b8('0x24')]=function(_0x239544,_0x34de9e){return db[_0x72b8('0x29')][_0x72b8('0x44')]({'where':{'id':_0x239544['params']['id']}})[_0x72b8('0x23')](handleEntityNotFound(_0x34de9e,null))[_0x72b8('0x23')](removeEntity(_0x34de9e,null))[_0x72b8('0x40')](handleError(_0x34de9e,null));}; \ No newline at end of file +var _0x60a8=['papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x60a8,0x1d6));var _0x860a=function(_0x1612b9,_0x2552a8){_0x1612b9=_0x1612b9-0x0;var _0x301f1b=_0x60a8[_0x1612b9];return _0x301f1b;};'use strict';var emlformat=require(_0x860a('0x0'));var rimraf=require(_0x860a('0x1'));var zipdir=require(_0x860a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x860a('0x3'));var moment=require(_0x860a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x860a('0x5'));var util=require(_0x860a('0x6'));var path=require(_0x860a('0x7'));var sox=require(_0x860a('0x8'));var csv=require(_0x860a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x860a('0xa'));var crypto=require(_0x860a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x860a('0xc'));var toCsv=require(_0x860a('0x9'));var querystring=require('querystring');var Papa=require(_0x860a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x860a('0xe'));var hardwareService=require(_0x860a('0xf'));var logger=require(_0x860a('0x10'))('api');var utils=require(_0x860a('0x11'));var config=require(_0x860a('0x12'));var licenseUtil=require(_0x860a('0x13'));var db=require(_0x860a('0x14'))['db'];function respondWithStatusCode(_0x585f76,_0x5835a2){_0x5835a2=_0x5835a2||0xcc;return function(_0xcb97b9){if(_0xcb97b9){return _0x585f76['sendStatus'](_0x5835a2);}return _0x585f76['status'](_0x5835a2)[_0x860a('0x15')]();};}function respondWithResult(_0x43ea9,_0x1dd110){_0x1dd110=_0x1dd110||0xc8;return function(_0x23a17c){if(_0x23a17c){return _0x43ea9[_0x860a('0x16')](_0x1dd110)[_0x860a('0x17')](_0x23a17c);}};}function respondWithFilteredResult(_0x233e67,_0x546454){return function(_0x2507f9){if(_0x2507f9){var _0x14dfd6=typeof _0x546454[_0x860a('0x18')]===_0x860a('0x19')&&typeof _0x546454[_0x860a('0x1a')]===_0x860a('0x19');var _0x4d3791=_0x2507f9[_0x860a('0x1b')];var _0x3da498=_0x14dfd6?0x0:_0x546454[_0x860a('0x18')];var _0x11e0bd=_0x14dfd6?_0x2507f9[_0x860a('0x1b')]:_0x546454[_0x860a('0x18')]+_0x546454['limit'];var _0x3b99ad;if(_0x11e0bd>=_0x4d3791){_0x11e0bd=_0x4d3791;_0x3b99ad=0xc8;}else{_0x3b99ad=0xce;}_0x233e67[_0x860a('0x16')](_0x3b99ad);return _0x233e67[_0x860a('0x1c')]('Content-Range',_0x3da498+'-'+_0x11e0bd+'/'+_0x4d3791)[_0x860a('0x17')](_0x2507f9);}return null;};}function patchUpdates(_0x15f6da){return function(_0x133433){try{jsonpatch[_0x860a('0x1d')](_0x133433,_0x15f6da,!![]);}catch(_0x2d8171){return BPromise[_0x860a('0x1e')](_0x2d8171);}return _0x133433[_0x860a('0x1f')]();};}function saveUpdates(_0x51a1ff,_0x179d07){return function(_0xfac8da){if(_0xfac8da){return _0xfac8da[_0x860a('0x20')](_0x51a1ff)[_0x860a('0x21')](function(_0xaf92e3){return _0xaf92e3;});}return null;};}function removeEntity(_0x33b53c,_0x176161){return function(_0x1b8aea){if(_0x1b8aea){return _0x1b8aea['destroy']()[_0x860a('0x21')](function(){_0x33b53c['status'](0xcc)[_0x860a('0x15')]();});}};}function handleEntityNotFound(_0x21c2be,_0x313250){return function(_0x39498e){if(!_0x39498e){_0x21c2be[_0x860a('0x22')](0x194);}return _0x39498e;};}function handleError(_0x109eb7,_0x3aca65){_0x3aca65=_0x3aca65||0x1f4;return function(_0xae925d){logger[_0x860a('0x23')](_0xae925d['stack']);if(_0xae925d[_0x860a('0x24')]){delete _0xae925d[_0x860a('0x24')];}_0x109eb7[_0x860a('0x16')](_0x3aca65)[_0x860a('0x25')](_0xae925d);};}exports[_0x860a('0x26')]=function(_0x407d41,_0x1ac0b9){var _0x292612={},_0x1da0c7={},_0x150798={'count':0x0,'rows':[]};var _0x9e39fa=_[_0x860a('0x27')](db[_0x860a('0x28')][_0x860a('0x29')],function(_0x59bc27){return{'name':_0x59bc27[_0x860a('0x2a')],'type':_0x59bc27[_0x860a('0x2b')][_0x860a('0x2c')]};});_0x1da0c7[_0x860a('0x2d')]=_[_0x860a('0x27')](_0x9e39fa,_0x860a('0x24'));_0x1da0c7[_0x860a('0x2e')]=_[_0x860a('0x2f')](_0x407d41[_0x860a('0x2e')]);_0x1da0c7[_0x860a('0x30')]=_[_0x860a('0x31')](_0x1da0c7[_0x860a('0x2d')],_0x1da0c7[_0x860a('0x2e')]);_0x292612[_0x860a('0x32')]=_[_0x860a('0x31')](_0x1da0c7[_0x860a('0x2d')],qs['fields'](_0x407d41[_0x860a('0x2e')]['fields']));_0x292612[_0x860a('0x32')]=_0x292612['attributes'][_0x860a('0x33')]?_0x292612[_0x860a('0x32')]:_0x1da0c7['model'];if(!_0x407d41[_0x860a('0x2e')]['hasOwnProperty'](_0x860a('0x34'))){_0x292612['limit']=qs[_0x860a('0x1a')](_0x407d41[_0x860a('0x2e')][_0x860a('0x1a')]);_0x292612[_0x860a('0x18')]=qs[_0x860a('0x18')](_0x407d41[_0x860a('0x2e')]['offset']);}_0x292612['order']=qs[_0x860a('0x35')](_0x407d41[_0x860a('0x2e')][_0x860a('0x35')]);_0x292612[_0x860a('0x36')]=qs[_0x860a('0x30')](_[_0x860a('0x37')](_0x407d41[_0x860a('0x2e')],_0x1da0c7['filters']),_0x9e39fa);if(_0x407d41['query'][_0x860a('0x38')]){_0x292612['where']=_[_0x860a('0x39')](_0x292612[_0x860a('0x36')],{'$or':_['map'](_0x9e39fa,function(_0x2aa4c8){if(_0x2aa4c8[_0x860a('0x2b')]!=='VIRTUAL'){var _0x1cdaf2={};_0x1cdaf2[_0x2aa4c8[_0x860a('0x24')]]={'$like':'%'+_0x407d41['query'][_0x860a('0x38')]+'%'};return _0x1cdaf2;}})});}_0x292612=_[_0x860a('0x39')]({},_0x292612,_0x407d41[_0x860a('0x3a')]);var _0x1dc8c8={'where':_0x292612[_0x860a('0x36')]};return db[_0x860a('0x28')][_0x860a('0x1b')](_0x1dc8c8)[_0x860a('0x21')](function(_0x14e06c){_0x150798[_0x860a('0x1b')]=_0x14e06c;if(_0x407d41[_0x860a('0x2e')][_0x860a('0x3b')]){_0x292612[_0x860a('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x860a('0x3d')](_0x292612);})[_0x860a('0x21')](function(_0x5c2eb0){_0x150798[_0x860a('0x3e')]=_0x5c2eb0;return _0x150798;})['then'](respondWithFilteredResult(_0x1ac0b9,_0x292612))[_0x860a('0x3f')](handleError(_0x1ac0b9,null));};exports['show']=function(_0x5e07a0,_0x5e4340){var _0x4d3de9={'raw':!![],'where':{'id':_0x5e07a0[_0x860a('0x40')]['id']}},_0x318008={};_0x318008[_0x860a('0x2d')]=_['keys'](db[_0x860a('0x28')]['rawAttributes']);_0x318008[_0x860a('0x2e')]=_[_0x860a('0x2f')](_0x5e07a0[_0x860a('0x2e')]);_0x318008[_0x860a('0x30')]=_[_0x860a('0x31')](_0x318008[_0x860a('0x2d')],_0x318008[_0x860a('0x2e')]);_0x4d3de9['attributes']=_['intersection'](_0x318008[_0x860a('0x2d')],qs[_0x860a('0x41')](_0x5e07a0[_0x860a('0x2e')][_0x860a('0x41')]));_0x4d3de9['attributes']=_0x4d3de9[_0x860a('0x32')][_0x860a('0x33')]?_0x4d3de9['attributes']:_0x318008[_0x860a('0x2d')];if(_0x5e07a0[_0x860a('0x2e')]['includeAll']){_0x4d3de9[_0x860a('0x3c')]=[{'all':!![]}];}_0x4d3de9=_[_0x860a('0x39')]({},_0x4d3de9,_0x5e07a0['options']);return db[_0x860a('0x28')][_0x860a('0x42')](_0x4d3de9)[_0x860a('0x21')](handleEntityNotFound(_0x5e4340,null))[_0x860a('0x21')](respondWithResult(_0x5e4340,null))['catch'](handleError(_0x5e4340,null));};exports[_0x860a('0x43')]=function(_0x205f63,_0x19e8b5){return db[_0x860a('0x28')][_0x860a('0x43')](_0x205f63[_0x860a('0x44')],{})[_0x860a('0x21')](respondWithResult(_0x19e8b5,0xc9))[_0x860a('0x3f')](handleError(_0x19e8b5,null));};exports[_0x860a('0x20')]=function(_0x5d5a16,_0x1deef6){if(_0x5d5a16[_0x860a('0x44')]['id']){delete _0x5d5a16[_0x860a('0x44')]['id'];}return db[_0x860a('0x28')][_0x860a('0x42')]({'where':{'id':_0x5d5a16['params']['id']}})[_0x860a('0x21')](handleEntityNotFound(_0x1deef6,null))[_0x860a('0x21')](saveUpdates(_0x5d5a16['body'],null))[_0x860a('0x21')](respondWithResult(_0x1deef6,null))[_0x860a('0x3f')](handleError(_0x1deef6,null));};exports['destroy']=function(_0x8e69b6,_0x561eb3){return db[_0x860a('0x28')]['find']({'where':{'id':_0x8e69b6[_0x860a('0x40')]['id']}})['then'](handleEntityNotFound(_0x561eb3,null))[_0x860a('0x21')](removeEntity(_0x561eb3,null))[_0x860a('0x3f')](handleError(_0x561eb3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4fd73d4..428e01d 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 _0x3578=['moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x3578,0x185));var _0x8357=function(_0x3b2be3,_0x3e602d){_0x3b2be3=_0x3b2be3-0x0;var _0x511b35=_0x3578[_0x3b2be3];return _0x511b35;};'use strict';var _=require('lodash');var util=require(_0x8357('0x0'));var logger=require(_0x8357('0x1'))(_0x8357('0x2'));var moment=require(_0x8357('0x3'));var BPromise=require(_0x8357('0x4'));var rp=require(_0x8357('0x5'));var fs=require('fs');var path=require(_0x8357('0x6'));var rimraf=require('rimraf');var config=require(_0x8357('0x7'));var attributes=require(_0x8357('0x8'));module[_0x8357('0x9')]=function(_0x787a4e,_0x453a0b){return _0x787a4e[_0x8357('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x8357('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8357('0xc'),'collate':_0x8357('0xd')});}; \ No newline at end of file +var _0x7450=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define'];(function(_0x27ca33,_0x3bad8c){var _0x2aa0f2=function(_0x269ee6){while(--_0x269ee6){_0x27ca33['push'](_0x27ca33['shift']());}};_0x2aa0f2(++_0x3bad8c);}(_0x7450,0xad));var _0x0745=function(_0x2e44e9,_0x3eba43){_0x2e44e9=_0x2e44e9-0x0;var _0x3d5105=_0x7450[_0x2e44e9];return _0x3d5105;};'use strict';var _=require(_0x0745('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0745('0x1'));var BPromise=require(_0x0745('0x2'));var rp=require(_0x0745('0x3'));var fs=require('fs');var path=require(_0x0745('0x4'));var rimraf=require(_0x0745('0x5'));var config=require('../../config/environment');var attributes=require(_0x0745('0x6'));module[_0x0745('0x7')]=function(_0x46ea1d,_0x4fe1f0){return _0x46ea1d[_0x0745('0x8')](_0x0745('0x9'),attributes,{'tableName':_0x0745('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0745('0xb'),'collate':_0x0745('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 71d559c..54d2131 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 _0x99df=['where','attributes','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw'];(function(_0x4b002b,_0x2bc1f0){var _0x41b40a=function(_0x370a73){while(--_0x370a73){_0x4b002b['push'](_0x4b002b['shift']());}};_0x41b40a(++_0x2bc1f0);}(_0x99df,0x1a8));var _0xf99d=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x99df[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xf99d('0x0'));var moment=require(_0xf99d('0x1'));var BPromise=require(_0xf99d('0x2'));var rs=require(_0xf99d('0x3'));var fs=require('fs');var Redis=require(_0xf99d('0x4'));var db=require(_0xf99d('0x5'))['db'];var utils=require(_0xf99d('0x6'));var logger=require(_0xf99d('0x7'))(_0xf99d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf99d('0x9'));var client=jayson['client'][_0xf99d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28fe30,_0x146655,_0x495fca){return new BPromise(function(_0x1c114e,_0x36ab19){return client['request'](_0x28fe30,_0x495fca)[_0xf99d('0xb')](function(_0x5194cd){logger[_0xf99d('0xc')](_0xf99d('0xd'),_0x146655,'request\x20sent');logger['debug'](_0xf99d('0xe'),_0x146655,_0xf99d('0xf'),JSON[_0xf99d('0x10')](_0x5194cd));if(_0x5194cd[_0xf99d('0x11')]){if(_0x5194cd[_0xf99d('0x11')][_0xf99d('0x12')]===0x1f4){logger[_0xf99d('0x11')](_0xf99d('0xd'),_0x146655,_0x5194cd[_0xf99d('0x11')][_0xf99d('0x13')]);return _0x36ab19(_0x5194cd[_0xf99d('0x11')]['message']);}logger[_0xf99d('0x11')](_0xf99d('0xd'),_0x146655,_0x5194cd[_0xf99d('0x11')][_0xf99d('0x13')]);return _0x1c114e(_0x5194cd[_0xf99d('0x11')]['message']);}else{logger[_0xf99d('0xc')](_0xf99d('0xd'),_0x146655,_0xf99d('0xf'));_0x1c114e(_0x5194cd[_0xf99d('0x14')][_0xf99d('0x13')]);}})['catch'](function(_0x46da75){logger[_0xf99d('0x11')](_0xf99d('0xd'),_0x146655,_0x46da75);_0x36ab19(_0x46da75);});});}exports[_0xf99d('0x15')]=function(_0x2d0a8c){var _0x5e319a=this;return new Promise(function(_0x4558b9,_0x1bdc39){return db[_0xf99d('0x16')][_0xf99d('0x17')](_0x2d0a8c['body'],{'raw':_0x2d0a8c[_0xf99d('0x18')]?_0x2d0a8c['options'][_0xf99d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0a8c[_0xf99d('0x18')]?_0x2d0a8c['options'][_0xf99d('0x1a')]||null:null,'attributes':_0x2d0a8c[_0xf99d('0x18')]?_0x2d0a8c[_0xf99d('0x18')][_0xf99d('0x1b')]||null:null,'limit':_0x2d0a8c['options']?_0x2d0a8c[_0xf99d('0x18')]['limit']||null:null})[_0xf99d('0xb')](function(_0x2cc0af){logger['info'](_0xf99d('0x15'),_0x2d0a8c);logger[_0xf99d('0x1c')](_0xf99d('0x15'),_0x2d0a8c,JSON[_0xf99d('0x10')](_0x2cc0af));_0x4558b9(_0x2cc0af);})[_0xf99d('0x1d')](function(_0x26a335){logger[_0xf99d('0x11')]('UpdateOpenchannelApplication',_0x26a335[_0xf99d('0x13')],_0x2d0a8c);_0x1bdc39(_0x5e319a[_0xf99d('0x11')](0x1f4,_0x26a335[_0xf99d('0x13')]));});});}; \ No newline at end of file +var _0xafbf=['stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','limit','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x38d779,_0x52c383){var _0x249701=function(_0x23291d){while(--_0x23291d){_0x38d779['push'](_0x38d779['shift']());}};_0x249701(++_0x52c383);}(_0xafbf,0xbb));var _0xfafb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xafbf[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfafb('0x0'));var BPromise=require(_0xfafb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfafb('0x2'));var logger=require(_0xfafb('0x3'))(_0xfafb('0x4'));var config=require(_0xfafb('0x5'));var jayson=require(_0xfafb('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18e107,_0x498fb8,_0x4653c8){return new BPromise(function(_0x4f4b9b,_0x427932){return client[_0xfafb('0x7')](_0x18e107,_0x4653c8)[_0xfafb('0x8')](function(_0x3c5b87){logger[_0xfafb('0x9')](_0xfafb('0xa'),_0x498fb8,_0xfafb('0xb'));logger['debug'](_0xfafb('0xc'),_0x498fb8,_0xfafb('0xb'),JSON[_0xfafb('0xd')](_0x3c5b87));if(_0x3c5b87[_0xfafb('0xe')]){if(_0x3c5b87[_0xfafb('0xe')][_0xfafb('0xf')]===0x1f4){logger[_0xfafb('0xe')](_0xfafb('0xa'),_0x498fb8,_0x3c5b87[_0xfafb('0xe')][_0xfafb('0x10')]);return _0x427932(_0x3c5b87[_0xfafb('0xe')][_0xfafb('0x10')]);}logger[_0xfafb('0xe')](_0xfafb('0xa'),_0x498fb8,_0x3c5b87[_0xfafb('0xe')][_0xfafb('0x10')]);return _0x4f4b9b(_0x3c5b87['error'][_0xfafb('0x10')]);}else{logger[_0xfafb('0x9')](_0xfafb('0xa'),_0x498fb8,_0xfafb('0xb'));_0x4f4b9b(_0x3c5b87[_0xfafb('0x11')]['message']);}})[_0xfafb('0x12')](function(_0x2f2d26){logger[_0xfafb('0xe')](_0xfafb('0xa'),_0x498fb8,_0x2f2d26);_0x427932(_0x2f2d26);});});}exports[_0xfafb('0x13')]=function(_0x3d71b4){var _0x201cbf=this;return new Promise(function(_0x2c2de6,_0x7def0d){return db[_0xfafb('0x14')]['update'](_0x3d71b4['body'],{'raw':_0x3d71b4[_0xfafb('0x15')]?_0x3d71b4['options'][_0xfafb('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d71b4[_0xfafb('0x15')]?_0x3d71b4['options'][_0xfafb('0x17')]||null:null,'attributes':_0x3d71b4['options']?_0x3d71b4[_0xfafb('0x15')]['attributes']||null:null,'limit':_0x3d71b4['options']?_0x3d71b4[_0xfafb('0x15')][_0xfafb('0x18')]||null:null})['then'](function(_0x200178){logger[_0xfafb('0x9')](_0xfafb('0x13'),_0x3d71b4);logger['debug'](_0xfafb('0x13'),_0x3d71b4,JSON['stringify'](_0x200178));_0x2c2de6(_0x200178);})['catch'](function(_0x4eaa2d){logger[_0xfafb('0xe')]('UpdateOpenchannelApplication',_0x4eaa2d[_0xfafb('0x10')],_0x3d71b4);_0x7def0d(_0x201cbf['error'](0x1f4,_0x4eaa2d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9ce74e4..4d91773 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 _0x5426=['index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','tracked','openchannel','addTags','put','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x5426,0xd5));var _0x6542=function(_0x1891f3,_0x33726e){_0x1891f3=_0x1891f3-0x0;var _0x289be3=_0x5426[_0x1891f3];return _0x289be3;};'use strict';var multer=require(_0x6542('0x0'));var util=require(_0x6542('0x1'));var path=require(_0x6542('0x2'));var timeout=require(_0x6542('0x3'));var express=require(_0x6542('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6542('0x5'));var interaction=require(_0x6542('0x6'));var config=require(_0x6542('0x7'));var controller=require(_0x6542('0x8'));router[_0x6542('0x9')]('/',auth[_0x6542('0xa')](),controller[_0x6542('0xb')]);router['get'](_0x6542('0xc'),auth[_0x6542('0xa')](),controller[_0x6542('0xd')]);router[_0x6542('0x9')](_0x6542('0xe'),auth[_0x6542('0xa')](),controller['show']);router[_0x6542('0x9')](_0x6542('0xf'),auth[_0x6542('0xa')](),controller[_0x6542('0x10')]);router[_0x6542('0x9')]('/:id/download',auth[_0x6542('0xa')](),controller[_0x6542('0x11')]);router[_0x6542('0x12')]('/',auth[_0x6542('0xa')](),controller[_0x6542('0x13')]);router[_0x6542('0x12')](_0x6542('0xf'),auth[_0x6542('0xa')](),controller[_0x6542('0x14')]);router[_0x6542('0x12')]('/:id/tags',auth[_0x6542('0xa')](),interaction[_0x6542('0x15')](_0x6542('0x16'),'openchannelinteraction:addtags'),controller[_0x6542('0x17')]);router[_0x6542('0x18')](_0x6542('0xe'),auth[_0x6542('0xa')](),interaction[_0x6542('0x15')]('openchannel','openchannelinteraction:update'),controller[_0x6542('0x19')]);router[_0x6542('0x1a')](_0x6542('0xe'),auth['isAuthenticated'](),interaction[_0x6542('0x15')](_0x6542('0x16'),_0x6542('0x1b')),controller[_0x6542('0x1c')]);router['delete'](_0x6542('0x1d'),auth[_0x6542('0xa')](),controller[_0x6542('0x1e')]);module[_0x6542('0x1f')]=router; \ No newline at end of file +var _0x21f4=['multer','util','path','express','Router','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','post','tracked','openchannel','addTags','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports'];(function(_0x2da71d,_0x34f66b){var _0x16c334=function(_0x4fd1cf){while(--_0x4fd1cf){_0x2da71d['push'](_0x2da71d['shift']());}};_0x16c334(++_0x34f66b);}(_0x21f4,0x70));var _0x421f=function(_0xeaf3e2,_0xa6bd78){_0xeaf3e2=_0xeaf3e2-0x0;var _0x1b2230=_0x21f4[_0xeaf3e2];return _0x1b2230;};'use strict';var multer=require(_0x421f('0x0'));var util=require(_0x421f('0x1'));var path=require(_0x421f('0x2'));var timeout=require('connect-timeout');var express=require(_0x421f('0x3'));var router=express[_0x421f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x421f('0x5'));var config=require('../../config/environment');var controller=require(_0x421f('0x6'));router[_0x421f('0x7')]('/',auth[_0x421f('0x8')](),controller[_0x421f('0x9')]);router['get'](_0x421f('0xa'),auth[_0x421f('0x8')](),controller[_0x421f('0xb')]);router[_0x421f('0x7')]('/:id',auth[_0x421f('0x8')](),controller[_0x421f('0xc')]);router[_0x421f('0x7')](_0x421f('0xd'),auth[_0x421f('0x8')](),controller['getMessages']);router[_0x421f('0x7')](_0x421f('0xe'),auth[_0x421f('0x8')](),controller['download']);router[_0x421f('0xf')]('/',auth[_0x421f('0x8')](),controller['create']);router['post']('/:id/messages',auth[_0x421f('0x8')](),controller['addMessage']);router[_0x421f('0xf')]('/:id/tags',auth[_0x421f('0x8')](),interaction[_0x421f('0x10')](_0x421f('0x11'),'openchannelinteraction:addtags'),controller[_0x421f('0x12')]);router['put'](_0x421f('0x13'),auth[_0x421f('0x8')](),interaction[_0x421f('0x10')](_0x421f('0x11'),_0x421f('0x14')),controller[_0x421f('0x15')]);router[_0x421f('0x16')](_0x421f('0x13'),auth[_0x421f('0x8')](),interaction['tracked'](_0x421f('0x11'),_0x421f('0x17')),controller[_0x421f('0x18')]);router[_0x421f('0x16')](_0x421f('0x19'),auth[_0x421f('0x8')](),controller[_0x421f('0x1a')]);module[_0x421f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5f4b7e0..e38a6a3 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 _0xedb4=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','exports'];(function(_0x27a2cc,_0x42b44a){var _0x2240ba=function(_0x493e3f){while(--_0x493e3f){_0x27a2cc['push'](_0x27a2cc['shift']());}};_0x2240ba(++_0x42b44a);}(_0xedb4,0x156));var _0x4edb=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xedb4[_0xb68772];return _0x4189bb;};'use strict';var Sequelize=require('sequelize');module[_0x4edb('0x0')]={'closed':{'type':Sequelize[_0x4edb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4edb('0x2')]},'disposition':{'type':Sequelize[_0x4edb('0x3')]},'secondDisposition':{'type':Sequelize[_0x4edb('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4edb('0x3')]},'note':{'type':Sequelize[_0x4edb('0x3')]},'read1stAt':{'type':Sequelize[_0x4edb('0x2')]},'threadId':{'type':Sequelize[_0x4edb('0x3')]},'externalUrl':{'type':Sequelize[_0x4edb('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4edb('0x4')]('in',_0x4edb('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4edb('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4edb('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4edb('0x6')]}}; \ No newline at end of file +var _0x8ce3=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x288b01,_0x1328cb){var _0x3e1409=function(_0x3c146e){while(--_0x3c146e){_0x288b01['push'](_0x288b01['shift']());}};_0x3e1409(++_0x1328cb);}(_0x8ce3,0x1b9));var _0x38ce=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x8ce3[_0x223461];return _0x4dbe0a;};'use strict';var Sequelize=require('sequelize');module[_0x38ce('0x0')]={'closed':{'type':Sequelize[_0x38ce('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x38ce('0x2')]},'disposition':{'type':Sequelize[_0x38ce('0x3')]},'secondDisposition':{'type':Sequelize[_0x38ce('0x3')]},'thirdDisposition':{'type':Sequelize[_0x38ce('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x38ce('0x2')]},'threadId':{'type':Sequelize[_0x38ce('0x3')]},'externalUrl':{'type':Sequelize[_0x38ce('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x38ce('0x4')]('in',_0x38ce('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x38ce('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x38ce('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6c34f6f..d05bb59 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 _0x80d0=['secret','read','OpenchannelAccount','Account','fullname','Owner','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','direction','System','firstName','out','value','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','limit','undefined','count','offset','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','Messages','createdAt'];(function(_0x3c6198,_0x3f3d3c){var _0x5643fb=function(_0x24b264){while(--_0x24b264){_0x3c6198['push'](_0x3c6198['shift']());}};_0x5643fb(++_0x3f3d3c);}(_0x80d0,0x126));var _0x080d=function(_0x6f70f5,_0x25f1f7){_0x6f70f5=_0x6f70f5-0x0;var _0x22ed7d=_0x80d0[_0x6f70f5];return _0x22ed7d;};'use strict';var rimraf=require(_0x080d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x080d('0x1'));var util=require(_0x080d('0x2'));var path=require(_0x080d('0x3'));var ejs=require(_0x080d('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x080d('0x5'));var qs=require(_0x080d('0x6'));var pdf=require(_0x080d('0x7'));var logger=require(_0x080d('0x8'))(_0x080d('0x9'));var config=require(_0x080d('0xa'));var db=require(_0x080d('0xb'))['db'];config[_0x080d('0xc')]=_[_0x080d('0xd')](config[_0x080d('0xc')],{'host':_0x080d('0xe'),'port':0x18eb});var socket=require(_0x080d('0xf'))(new Redis(config['redis']));require(_0x080d('0x10'))[_0x080d('0x11')](socket);function respondWithStatusCode(_0xefce0c,_0x43ac40){_0x43ac40=_0x43ac40||0xcc;return function(_0x1055c2){if(_0x1055c2){return _0xefce0c['sendStatus'](_0x43ac40);}return _0xefce0c[_0x080d('0x12')](_0x43ac40)[_0x080d('0x13')]();};}function respondWithResult(_0x486050,_0x4d3662){_0x4d3662=_0x4d3662||0xc8;return function(_0x174bf6){if(_0x174bf6){return _0x486050[_0x080d('0x12')](_0x4d3662)[_0x080d('0x14')](_0x174bf6);}};}function respondWithFilteredResult(_0x3fd440,_0x292cea){return function(_0x2a78d4){if(_0x2a78d4){var _0x49c89b=typeof _0x292cea['offset']==='undefined'&&typeof _0x292cea[_0x080d('0x15')]===_0x080d('0x16');var _0x5def84=_0x2a78d4[_0x080d('0x17')];var _0x47611a=_0x49c89b?0x0:_0x292cea['offset'];var _0x596b59=_0x49c89b?_0x2a78d4[_0x080d('0x17')]:_0x292cea[_0x080d('0x18')]+_0x292cea[_0x080d('0x15')];var _0x11f8f0;if(_0x596b59>=_0x5def84){_0x596b59=_0x5def84;_0x11f8f0=0xc8;}else{_0x11f8f0=0xce;}_0x3fd440[_0x080d('0x12')](_0x11f8f0);return _0x3fd440['set'](_0x080d('0x19'),_0x47611a+'-'+_0x596b59+'/'+_0x5def84)[_0x080d('0x14')](_0x2a78d4);}return null;};}function saveUpdates(_0x271105){return function(_0x4babf3){if(_0x4babf3){return _0x4babf3[_0x080d('0x1a')](_0x271105)['then'](function(_0x11b7ae){return _0x11b7ae;});}return null;};}function removeEntity(_0x1a9975){return function(_0x59d979){if(_0x59d979){return _0x59d979[_0x080d('0x1b')]()[_0x080d('0x1c')](function(){_0x1a9975['status'](0xcc)[_0x080d('0x13')]();});}};}function handleEntityNotFound(_0x2dda3d){return function(_0x4ae827){if(!_0x4ae827){_0x2dda3d[_0x080d('0x1d')](0x194);}return _0x4ae827;};}function handleError(_0x57187e,_0x13afc1){_0x13afc1=_0x13afc1||0x1f4;return function(_0xe37101){logger[_0x080d('0x1e')](_0xe37101[_0x080d('0x1f')]);if(_0xe37101['name']){delete _0xe37101[_0x080d('0x20')];}_0x57187e[_0x080d('0x12')](_0x13afc1)[_0x080d('0x21')](_0xe37101);};}exports[_0x080d('0x22')]=function(_0x408fe3,_0x33037c){var _0x20d45f={};var _0x484070=_['map'](db[_0x080d('0x23')][_0x080d('0x24')],function(_0x1337b5){return{'name':_0x1337b5[_0x080d('0x25')],'type':_0x1337b5[_0x080d('0x26')][_0x080d('0x27')]};});_0x20d45f=qs[_0x080d('0x28')](_0x484070,_0x408fe3);return interaction[_0x080d('0x29')](_0x080d('0x2a'),_0x408fe3[_0x080d('0x2b')],_0x408fe3[_0x080d('0x2c')],_0x20d45f,_0x484070)[_0x080d('0x1c')](respondWithFilteredResult(_0x33037c,_0x20d45f))[_0x080d('0x2d')](handleError(_0x33037c,null));};exports[_0x080d('0x2e')]=function(_0x3e2cf2,_0x333a58){var _0x1f566a={};if(_0x3e2cf2[_0x080d('0x2b')][_0x080d('0x26')]&&_0x3e2cf2[_0x080d('0x2b')][_0x080d('0x26')]==='from'){_0x1f566a[_0x080d('0x2f')]=_0x3e2cf2[_0x080d('0x30')]['id'];}else{_0x1f566a['id']=_0x3e2cf2['params']['id'];}var _0x392085={'raw':![],'where':_0x1f566a},_0x1d360b={};_0x1d360b[_0x080d('0x31')]=_[_0x080d('0x32')](db[_0x080d('0x23')][_0x080d('0x24')]);_0x1d360b[_0x080d('0x2b')]=_[_0x080d('0x32')](_0x3e2cf2[_0x080d('0x2b')]);_0x1d360b[_0x080d('0x33')]=_['intersection'](_0x1d360b[_0x080d('0x31')],_0x1d360b[_0x080d('0x2b')]);_0x392085[_0x080d('0x34')]=_[_0x080d('0x35')](_0x1d360b[_0x080d('0x31')],qs[_0x080d('0x36')](_0x3e2cf2['query']['fields']));_0x392085[_0x080d('0x34')]=_0x392085[_0x080d('0x34')][_0x080d('0x37')]?_0x392085['attributes']:_0x1d360b['model'];if(_0x3e2cf2['query'][_0x080d('0x38')]){_0x392085[_0x080d('0x39')]=[{'all':!![]}];}_0x392085=_[_0x080d('0x3a')]({},_0x392085,_0x3e2cf2[_0x080d('0x3b')]);return db[_0x080d('0x23')][_0x080d('0x3c')](_0x392085)['then'](handleEntityNotFound(_0x333a58,null))[_0x080d('0x1c')](respondWithResult(_0x333a58,null))['catch'](handleError(_0x333a58,null));};exports[_0x080d('0x3d')]=function(_0xee4349,_0x4afaea){return db[_0x080d('0x23')][_0x080d('0x3d')](_0xee4349['body'],{})['then'](respondWithResult(_0x4afaea,0xc9))['catch'](handleError(_0x4afaea,null));};exports[_0x080d('0x1a')]=function(_0x30046e,_0x223e7b){if(_0x30046e[_0x080d('0x3e')]['id']){delete _0x30046e[_0x080d('0x3e')]['id'];}return db['OpenchannelInteraction'][_0x080d('0x3c')]({'where':{'id':_0x30046e[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x223e7b,null))[_0x080d('0x1c')](saveUpdates(_0x30046e[_0x080d('0x3e')],null))[_0x080d('0x1c')](respondWithResult(_0x223e7b,null))[_0x080d('0x2d')](handleError(_0x223e7b,null));};exports[_0x080d('0x1b')]=function(_0x3bab29,_0x3ee8b6){return db[_0x080d('0x23')][_0x080d('0x3c')]({'where':{'id':_0x3bab29[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x3ee8b6,null))[_0x080d('0x1c')](removeEntity(_0x3ee8b6,null))[_0x080d('0x2d')](handleError(_0x3ee8b6,null));};exports[_0x080d('0x3f')]=function(_0xb92488,_0x2d334b){return db[_0x080d('0x23')][_0x080d('0x3f')]()['then'](respondWithResult(_0x2d334b,null))[_0x080d('0x2d')](handleError(_0x2d334b,null));};exports[_0x080d('0x40')]=function(_0x453a26,_0x371827){return db[_0x080d('0x41')]['find']({'where':{'id':_0x453a26['params']['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x371827,null))[_0x080d('0x1c')](function(_0x208348){if(_0x208348){return _0x208348[_0x080d('0x40')](_0x453a26['body'][_0x080d('0x42')],_[_0x080d('0x43')](_0x453a26[_0x080d('0x3e')],[_0x080d('0x42'),'id'])||{});}})[_0x080d('0x1c')](respondWithResult(_0x371827,null))[_0x080d('0x2d')](handleError(_0x371827,null));};exports['getMessages']=function(_0x584ee5,_0x16dbf5){var _0x313080={'raw':![],'where':{}};var _0x333607={};var _0x200ddc={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x080d('0x44')]({'where':{'id':_0x584ee5[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x16dbf5,null))['then'](function(_0x3c7f34){if(_0x3c7f34){_0x333607[_0x080d('0x31')]=_[_0x080d('0x32')](db['OpenchannelMessage']['rawAttributes']);_0x333607['query']=_[_0x080d('0x32')](_0x584ee5[_0x080d('0x2b')]);_0x333607[_0x080d('0x33')]=_[_0x080d('0x35')](_0x333607[_0x080d('0x31')],_0x333607[_0x080d('0x2b')]);_0x313080[_0x080d('0x34')]=_['intersection'](_0x333607[_0x080d('0x31')],qs[_0x080d('0x36')](_0x584ee5['query']['fields']));_0x313080[_0x080d('0x34')]=_0x313080[_0x080d('0x34')][_0x080d('0x37')]?_0x313080[_0x080d('0x34')]:_0x333607[_0x080d('0x31')];if(!_0x584ee5['query'][_0x080d('0x45')](_0x080d('0x46'))){_0x313080['limit']=qs['limit'](_0x584ee5[_0x080d('0x2b')][_0x080d('0x15')]);_0x313080['offset']=qs[_0x080d('0x18')](_0x584ee5['query'][_0x080d('0x18')]);}_0x313080[_0x080d('0x47')]=qs[_0x080d('0x48')](_0x584ee5[_0x080d('0x2b')][_0x080d('0x48')]);_0x313080[_0x080d('0x49')]=qs['filters'](_[_0x080d('0x4a')](_0x584ee5[_0x080d('0x2b')],_0x333607['filters']));_0x313080[_0x080d('0x49')]['OpenchannelInteractionId']=_0x3c7f34['id'];if(_0x584ee5[_0x080d('0x2b')][_0x080d('0x4b')]){_0x313080['where']=_[_0x080d('0x3a')](_0x313080['where'],{'$or':_[_0x080d('0x4c')](_0x313080['attributes'],function(_0x353d10){var _0x2fb5e5={};_0x2fb5e5[_0x353d10]={'$like':'%'+_0x584ee5[_0x080d('0x2b')][_0x080d('0x4b')]+'%'};return _0x2fb5e5;})});}if(_0x584ee5[_0x080d('0x2b')][_0x080d('0x4d')]){var _0x3979d4=_0x584ee5[_0x080d('0x2b')][_0x080d('0x4d')]['split'](',');var _0x52c786={};_0x52c786[_0x3979d4[0x0]]={'$gte':moment(_0x3979d4[0x1])[_0x080d('0x4e')](_0x080d('0x4f'))};_0x313080[_0x080d('0x49')]=_[_0x080d('0x3a')](_0x313080[_0x080d('0x49')],_0x52c786);}_0x313080=_[_0x080d('0x3a')]({},_0x313080,_0x584ee5['options']);return db[_0x080d('0x41')][_0x080d('0x17')]({'where':_0x313080[_0x080d('0x49')]})[_0x080d('0x1c')](function(_0x4a868c){_0x200ddc['count']=_0x4a868c;if(_0x584ee5[_0x080d('0x2b')][_0x080d('0x38')]){_0x313080[_0x080d('0x39')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x080d('0x29')](_0x313080);})[_0x080d('0x1c')](function(_0x2f57ac){_0x200ddc[_0x080d('0x50')]=_0x2f57ac;return _0x200ddc;});}})[_0x080d('0x1c')](respondWithFilteredResult(_0x16dbf5,_0x313080))[_0x080d('0x2d')](handleError(_0x16dbf5,null));};exports[_0x080d('0x51')]=function(_0x21d966,_0x2da7a8){return db['OpenchannelInteraction']['find']({'where':{'id':_0x21d966[_0x080d('0x30')]['id']}})['then'](handleEntityNotFound(_0x2da7a8,null))[_0x080d('0x1c')](function(_0x1bed0c){if(_0x1bed0c){return _0x1bed0c[_0x080d('0x52')](_0x21d966[_0x080d('0x3e')][_0x080d('0x42')],_[_0x080d('0x43')](_0x21d966[_0x080d('0x3e')],[_0x080d('0x42'),'id'])||{})['spread'](function(){return db[_0x080d('0x53')][_0x080d('0x29')]({'attributes':['id','name','color'],'where':{'id':_0x21d966[_0x080d('0x3e')]['ids']}});})[_0x080d('0x1c')](function(_0x4bc74b){socket[_0x080d('0x54')](_0x080d('0x55'),{'id':Number(_0x21d966[_0x080d('0x30')]['id']),'tags':_0x4bc74b||[]});return{'id':Number(_0x21d966[_0x080d('0x30')]['id']),'tags':_0x4bc74b||[]};});}})[_0x080d('0x1c')](respondWithResult(_0x2da7a8,null))[_0x080d('0x2d')](handleError(_0x2da7a8,null));};exports[_0x080d('0x56')]=function(_0x519d6b,_0x295fbf){return db[_0x080d('0x23')][_0x080d('0x3c')]({'where':{'id':_0x519d6b[_0x080d('0x30')]['id']}})[_0x080d('0x1c')](handleEntityNotFound(_0x295fbf,null))[_0x080d('0x1c')](function(_0x5ab604){if(_0x5ab604){return _0x5ab604[_0x080d('0x56')](_0x519d6b[_0x080d('0x2b')]['ids']);}})[_0x080d('0x1c')](respondWithStatusCode(_0x295fbf,null))[_0x080d('0x2d')](handleError(_0x295fbf,null));};exports[_0x080d('0x57')]=function(_0x1f6e99,_0x401139){var _0x1b3a06=moment()[_0x080d('0x58')]()[_0x080d('0x59')]();var _0x10d81e=path[_0x080d('0x5a')](config[_0x080d('0x5b')],_0x080d('0x5c'),_0x080d('0x5d'),_0x080d('0x5e'));var _0x591e5d=path[_0x080d('0x5a')](config[_0x080d('0x5b')],_0x080d('0x5c'),_0x080d('0x5d'),_0x080d('0x5f'));var _0x56e45a=path[_0x080d('0x5a')](_0x10d81e,_0x1b3a06);var _0x53d828=util['format'](_0x080d('0x60'),_0x1f6e99[_0x080d('0x30')]['id'],_0x1b3a06);var _0x36c14e=path[_0x080d('0x5a')](_0x10d81e,_0x53d828);var _0x3bca2f=[];_0x3bca2f[_0x080d('0x61')]({'model':db[_0x080d('0x62')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3bca2f[_0x080d('0x61')]({'model':db[_0x080d('0x63')],'as':_0x080d('0x64'),'attributes':['id','firstName',_0x080d('0x65')],'raw':!![]});if(_0x1f6e99[_0x080d('0x2b')][_0x080d('0x5f')]){_0x3bca2f[_0x080d('0x61')]({'model':db['Attachment'],'as':_0x080d('0x66'),'raw':!![]});}var _0x439917=[{'model':db[_0x080d('0x41')],'as':_0x080d('0x67'),'attributes':['id','body',_0x080d('0x68'),'direction',_0x080d('0x69'),_0x080d('0x6a')],'include':_0x3bca2f}];_0x439917['push']({'model':db[_0x080d('0x6b')],'as':_0x080d('0x6c'),'attributes':['id',_0x080d('0x20')]});_0x439917[_0x080d('0x61')]({'model':db[_0x080d('0x62')],'as':'Owner','attributes':['id',_0x080d('0x6d')]});return db[_0x080d('0x23')][_0x080d('0x3c')]({'where':{'id':_0x1f6e99[_0x080d('0x30')]['id']},'include':_0x439917})[_0x080d('0x1c')](handleEntityNotFound(_0x401139,null))[_0x080d('0x1c')](function(_0x575457){if(_0x575457){var _0x4c7767=_0x575457['get']({'plain':!![]});fs['mkdirSync'](_0x56e45a);var _0x444a83={'channel':'Openchannel','account':_0x4c7767[_0x080d('0x6c')][_0x080d('0x20')],'agent':_0x4c7767['Owner']?_0x4c7767[_0x080d('0x6e')][_0x080d('0x6d')]:_0x080d('0x6f'),'createdAt':moment(_0x4c7767['createdAt'])[_0x080d('0x4e')](_0x080d('0x4f'))[_0x080d('0x59')](),'closedAt':_0x4c7767[_0x080d('0x70')]?moment(_0x4c7767[_0x080d('0x71')])[_0x080d('0x4e')](_0x080d('0x4f'))[_0x080d('0x59')]():'','disposition':_0x4c7767[_0x080d('0x72')],'visibility':_0x4c7767['threadId']?_0x080d('0x73'):_0x080d('0x74'),'messages':_(_0x4c7767[_0x080d('0x67')])[_0x080d('0x4b')]({'secret':![]})[_0x080d('0x4c')](function(_0xf6ec76){if(_0xf6ec76[_0x080d('0x66')]){var _0x18584f=path[_0x080d('0x5a')](_0x591e5d,_0xf6ec76[_0x080d('0x66')][_0x080d('0x75')]);if(fs[_0x080d('0x76')](_0x18584f)){fs[_0x080d('0x77')](_0x18584f)[_0x080d('0x78')](fs['createWriteStream'](path[_0x080d('0x5a')](_0x56e45a,_0xf6ec76[_0x080d('0x66')][_0x080d('0x75')])));}}return{'date':moment(_0xf6ec76[_0x080d('0x68')])[_0x080d('0x4e')](_0x080d('0x4f'))[_0x080d('0x59')](),'sender':_0xf6ec76[_0x080d('0x79')]==='out'?_0xf6ec76[_0x080d('0x62')]?_0xf6ec76['User'][_0x080d('0x6d')]:_0x080d('0x7a'):_0xf6ec76[_0x080d('0x64')][_0x080d('0x7b')]+(_0xf6ec76[_0x080d('0x64')]['lastName']?'\x20'+_0xf6ec76[_0x080d('0x64')][_0x080d('0x65')]:''),'body':_0xf6ec76[_0x080d('0x66')]?_0xf6ec76['Attachment'][_0x080d('0x75')]:_0xf6ec76[_0x080d('0x3e')],'direction':_0xf6ec76[_0x080d('0x79')]===_0x080d('0x7c')?'A':'C','secret':_0xf6ec76[_0x080d('0x69')],'read':_0xf6ec76[_0x080d('0x6a')],'attachment':_0xf6ec76[_0x080d('0x66')]};})[_0x080d('0x7d')]()};return ejs['renderFile'](path[_0x080d('0x5a')](config[_0x080d('0x5b')],_0x080d('0x5c'),_0x080d('0x7e'),_0x080d('0x7f')),{'interaction':_0x444a83})[_0x080d('0x1c')](function(_0x3356a3){var _0x2fc3e0=path[_0x080d('0x5a')](_0x56e45a,_0x080d('0x80')+_0x4c7767['id']+'-'+_0x1b3a06+_0x080d('0x81'));var _0x238780={'path':_0x2fc3e0,'channel':_0x080d('0x82'),'interactionId':_0x4c7767['id']};return pdf[_0x080d('0x83')](_0x3356a3,_0x238780);})[_0x080d('0x1c')](function(){return new Promise(function(_0x3f0075,_0x50dc69){zipdir(_0x56e45a,{'saveTo':_0x36c14e},function(_0x47c9d,_0x1f299c){if(_0x47c9d)return _0x50dc69(_0x47c9d);return _0x3f0075(_0x1f299c);});})[_0x080d('0x1c')](function(){return new Promise(function(_0x60fbce,_0x5999c2){rimraf(_0x56e45a,function(_0x59cbb9){if(_0x59cbb9)_0x5999c2(_0x59cbb9);return _0x60fbce();});});})['then'](function(){return _0x401139[_0x080d('0x57')](_0x36c14e,_0x53d828,function(_0x54e402){if(_0x54e402){logger['error'](_0x080d('0x84'),_0x54e402);}else{fs['unlinkSync'](_0x36c14e);}});});});}else{return _0x401139[_0x080d('0x1d')](0xc8);}})['catch'](handleError(_0x401139,null));}; \ No newline at end of file +var _0x3cb3=['server','files','tmp','attachments','User','fullname','push','CmContact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','toString','closed','Private','map','basename','createReadStream','createWriteStream','out','Contact','firstName','value','renderFile','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','from','params','keys','intersection','model','attributes','fields','length','merge','create','body','find','describe','OpenchannelMessage','omit','ids','getMessages','findOne','nolimit','sort','filters','OpenchannelInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root'];(function(_0x235fc3,_0x28ac52){var _0x3caaeb=function(_0x55a068){while(--_0x55a068){_0x235fc3['push'](_0x235fc3['shift']());}};_0x3caaeb(++_0x28ac52);}(_0x3cb3,0x191));var _0x33cb=function(_0x57046b,_0x1038b5){_0x57046b=_0x57046b-0x0;var _0x3ad70d=_0x3cb3[_0x57046b];return _0x3ad70d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x33cb('0x0'));var moment=require('moment');var util=require(_0x33cb('0x1'));var path=require(_0x33cb('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x33cb('0x3'));var Redis=require(_0x33cb('0x4'));var interaction=require(_0x33cb('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x33cb('0x6'));var logger=require('../../config/logger')(_0x33cb('0x7'));var config=require(_0x33cb('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x33cb('0x9')](config['redis'],{'host':_0x33cb('0xa'),'port':0x18eb});var socket=require(_0x33cb('0xb'))(new Redis(config[_0x33cb('0xc')]));require(_0x33cb('0xd'))[_0x33cb('0xe')](socket);function respondWithStatusCode(_0x137859,_0x9afba7){_0x9afba7=_0x9afba7||0xcc;return function(_0xb3cef2){if(_0xb3cef2){return _0x137859[_0x33cb('0xf')](_0x9afba7);}return _0x137859[_0x33cb('0x10')](_0x9afba7)[_0x33cb('0x11')]();};}function respondWithResult(_0xdd2fc0,_0x521fe4){_0x521fe4=_0x521fe4||0xc8;return function(_0x208858){if(_0x208858){return _0xdd2fc0[_0x33cb('0x10')](_0x521fe4)[_0x33cb('0x12')](_0x208858);}};}function respondWithFilteredResult(_0x261e62,_0x22fc9b){return function(_0x1afe9f){if(_0x1afe9f){var _0x1fb422=typeof _0x22fc9b[_0x33cb('0x13')]===_0x33cb('0x14')&&typeof _0x22fc9b[_0x33cb('0x15')]==='undefined';var _0x3d100b=_0x1afe9f[_0x33cb('0x16')];var _0x58c6e2=_0x1fb422?0x0:_0x22fc9b[_0x33cb('0x13')];var _0x24dedf=_0x1fb422?_0x1afe9f[_0x33cb('0x16')]:_0x22fc9b[_0x33cb('0x13')]+_0x22fc9b['limit'];var _0xb69fe8;if(_0x24dedf>=_0x3d100b){_0x24dedf=_0x3d100b;_0xb69fe8=0xc8;}else{_0xb69fe8=0xce;}_0x261e62[_0x33cb('0x10')](_0xb69fe8);return _0x261e62[_0x33cb('0x17')]('Content-Range',_0x58c6e2+'-'+_0x24dedf+'/'+_0x3d100b)['json'](_0x1afe9f);}return null;};}function saveUpdates(_0x3897ac){return function(_0x1a693a){if(_0x1a693a){return _0x1a693a[_0x33cb('0x18')](_0x3897ac)[_0x33cb('0x19')](function(_0x9b8374){return _0x9b8374;});}return null;};}function removeEntity(_0x278b06){return function(_0x12d9b4){if(_0x12d9b4){return _0x12d9b4[_0x33cb('0x1a')]()[_0x33cb('0x19')](function(){_0x278b06[_0x33cb('0x10')](0xcc)[_0x33cb('0x11')]();});}};}function handleEntityNotFound(_0x2f2cbc){return function(_0x6cc66f){if(!_0x6cc66f){_0x2f2cbc[_0x33cb('0xf')](0x194);}return _0x6cc66f;};}function handleError(_0x129f34,_0x1c150d){_0x1c150d=_0x1c150d||0x1f4;return function(_0x11ae1e){logger[_0x33cb('0x1b')](_0x11ae1e[_0x33cb('0x1c')]);if(_0x11ae1e[_0x33cb('0x1d')]){delete _0x11ae1e['name'];}_0x129f34['status'](_0x1c150d)[_0x33cb('0x1e')](_0x11ae1e);};}exports[_0x33cb('0x1f')]=function(_0x25ef45,_0x203f8c){var _0x38083d={};var _0x550967=_['map'](db[_0x33cb('0x20')][_0x33cb('0x21')],function(_0x5a7edd){return{'name':_0x5a7edd[_0x33cb('0x22')],'type':_0x5a7edd[_0x33cb('0x23')][_0x33cb('0x24')]};});_0x38083d=qs[_0x33cb('0x25')](_0x550967,_0x25ef45);return interaction[_0x33cb('0x26')]('openchannel',_0x25ef45[_0x33cb('0x27')],_0x25ef45[_0x33cb('0x28')],_0x38083d,_0x550967)[_0x33cb('0x19')](respondWithFilteredResult(_0x203f8c,_0x38083d))[_0x33cb('0x29')](handleError(_0x203f8c,null));};exports['show']=function(_0x350510,_0x59da02){var _0x1b525c={};if(_0x350510['query'][_0x33cb('0x23')]&&_0x350510[_0x33cb('0x27')][_0x33cb('0x23')]===_0x33cb('0x2a')){_0x1b525c[_0x33cb('0x2a')]=_0x350510['params']['id'];}else{_0x1b525c['id']=_0x350510[_0x33cb('0x2b')]['id'];}var _0x3f03a0={'raw':![],'where':_0x1b525c},_0x182c4b={};_0x182c4b['model']=_[_0x33cb('0x2c')](db[_0x33cb('0x20')][_0x33cb('0x21')]);_0x182c4b['query']=_[_0x33cb('0x2c')](_0x350510['query']);_0x182c4b['filters']=_[_0x33cb('0x2d')](_0x182c4b[_0x33cb('0x2e')],_0x182c4b['query']);_0x3f03a0[_0x33cb('0x2f')]=_['intersection'](_0x182c4b[_0x33cb('0x2e')],qs[_0x33cb('0x30')](_0x350510[_0x33cb('0x27')][_0x33cb('0x30')]));_0x3f03a0['attributes']=_0x3f03a0[_0x33cb('0x2f')][_0x33cb('0x31')]?_0x3f03a0[_0x33cb('0x2f')]:_0x182c4b[_0x33cb('0x2e')];if(_0x350510[_0x33cb('0x27')]['includeAll']){_0x3f03a0['include']=[{'all':!![]}];}_0x3f03a0=_[_0x33cb('0x32')]({},_0x3f03a0,_0x350510['options']);return db[_0x33cb('0x20')]['find'](_0x3f03a0)[_0x33cb('0x19')](handleEntityNotFound(_0x59da02,null))[_0x33cb('0x19')](respondWithResult(_0x59da02,null))[_0x33cb('0x29')](handleError(_0x59da02,null));};exports[_0x33cb('0x33')]=function(_0x1325d1,_0x4cf826){return db[_0x33cb('0x20')][_0x33cb('0x33')](_0x1325d1[_0x33cb('0x34')],{})[_0x33cb('0x19')](respondWithResult(_0x4cf826,0xc9))[_0x33cb('0x29')](handleError(_0x4cf826,null));};exports[_0x33cb('0x18')]=function(_0x11f5ed,_0x34142f){if(_0x11f5ed[_0x33cb('0x34')]['id']){delete _0x11f5ed[_0x33cb('0x34')]['id'];}return db[_0x33cb('0x20')][_0x33cb('0x35')]({'where':{'id':_0x11f5ed['params']['id']}})[_0x33cb('0x19')](handleEntityNotFound(_0x34142f,null))[_0x33cb('0x19')](saveUpdates(_0x11f5ed['body'],null))['then'](respondWithResult(_0x34142f,null))[_0x33cb('0x29')](handleError(_0x34142f,null));};exports[_0x33cb('0x1a')]=function(_0x204557,_0x371a2b){return db['OpenchannelInteraction'][_0x33cb('0x35')]({'where':{'id':_0x204557['params']['id']}})[_0x33cb('0x19')](handleEntityNotFound(_0x371a2b,null))['then'](removeEntity(_0x371a2b,null))['catch'](handleError(_0x371a2b,null));};exports[_0x33cb('0x36')]=function(_0x271c74,_0x38f352){return db[_0x33cb('0x20')][_0x33cb('0x36')]()[_0x33cb('0x19')](respondWithResult(_0x38f352,null))['catch'](handleError(_0x38f352,null));};exports['addMessage']=function(_0x34da65,_0x23ea48){return db[_0x33cb('0x37')]['find']({'where':{'id':_0x34da65[_0x33cb('0x2b')]['id']}})[_0x33cb('0x19')](handleEntityNotFound(_0x23ea48,null))[_0x33cb('0x19')](function(_0x4267db){if(_0x4267db){return _0x4267db['addMessage'](_0x34da65[_0x33cb('0x34')]['ids'],_[_0x33cb('0x38')](_0x34da65[_0x33cb('0x34')],[_0x33cb('0x39'),'id'])||{});}})[_0x33cb('0x19')](respondWithResult(_0x23ea48,null))[_0x33cb('0x29')](handleError(_0x23ea48,null));};exports[_0x33cb('0x3a')]=function(_0x510202,_0x50949a){var _0x5f25bd={'raw':![],'where':{}};var _0x5e2527={};var _0x1e2e79={'count':0x0,'rows':[]};return db[_0x33cb('0x20')][_0x33cb('0x3b')]({'where':{'id':_0x510202[_0x33cb('0x2b')]['id']}})[_0x33cb('0x19')](handleEntityNotFound(_0x50949a,null))[_0x33cb('0x19')](function(_0x5f0542){if(_0x5f0542){_0x5e2527[_0x33cb('0x2e')]=_[_0x33cb('0x2c')](db['OpenchannelMessage']['rawAttributes']);_0x5e2527[_0x33cb('0x27')]=_[_0x33cb('0x2c')](_0x510202['query']);_0x5e2527['filters']=_['intersection'](_0x5e2527[_0x33cb('0x2e')],_0x5e2527[_0x33cb('0x27')]);_0x5f25bd[_0x33cb('0x2f')]=_[_0x33cb('0x2d')](_0x5e2527[_0x33cb('0x2e')],qs[_0x33cb('0x30')](_0x510202[_0x33cb('0x27')][_0x33cb('0x30')]));_0x5f25bd[_0x33cb('0x2f')]=_0x5f25bd[_0x33cb('0x2f')][_0x33cb('0x31')]?_0x5f25bd[_0x33cb('0x2f')]:_0x5e2527[_0x33cb('0x2e')];if(!_0x510202[_0x33cb('0x27')]['hasOwnProperty'](_0x33cb('0x3c'))){_0x5f25bd[_0x33cb('0x15')]=qs[_0x33cb('0x15')](_0x510202[_0x33cb('0x27')][_0x33cb('0x15')]);_0x5f25bd[_0x33cb('0x13')]=qs[_0x33cb('0x13')](_0x510202[_0x33cb('0x27')]['offset']);}_0x5f25bd['order']=qs[_0x33cb('0x3d')](_0x510202[_0x33cb('0x27')][_0x33cb('0x3d')]);_0x5f25bd['where']=qs[_0x33cb('0x3e')](_['pick'](_0x510202[_0x33cb('0x27')],_0x5e2527['filters']));_0x5f25bd['where'][_0x33cb('0x3f')]=_0x5f0542['id'];if(_0x510202[_0x33cb('0x27')][_0x33cb('0x40')]){_0x5f25bd[_0x33cb('0x41')]=_[_0x33cb('0x32')](_0x5f25bd[_0x33cb('0x41')],{'$or':_['map'](_0x5f25bd[_0x33cb('0x2f')],function(_0x28afec){var _0x464934={};_0x464934[_0x28afec]={'$like':'%'+_0x510202['query'][_0x33cb('0x40')]+'%'};return _0x464934;})});}if(_0x510202['query']['$gte']){var _0x5cc018=_0x510202['query'][_0x33cb('0x42')][_0x33cb('0x43')](',');var _0x3ca859={};_0x3ca859[_0x5cc018[0x0]]={'$gte':moment(_0x5cc018[0x1])[_0x33cb('0x44')](_0x33cb('0x45'))};_0x5f25bd[_0x33cb('0x41')]=_['merge'](_0x5f25bd[_0x33cb('0x41')],_0x3ca859);}_0x5f25bd=_['merge']({},_0x5f25bd,_0x510202[_0x33cb('0x46')]);return db[_0x33cb('0x37')][_0x33cb('0x16')]({'where':_0x5f25bd[_0x33cb('0x41')]})['then'](function(_0x3bc8ba){_0x1e2e79['count']=_0x3bc8ba;if(_0x510202['query'][_0x33cb('0x47')]){_0x5f25bd['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x33cb('0x26')](_0x5f25bd);})[_0x33cb('0x19')](function(_0x11fc09){_0x1e2e79[_0x33cb('0x48')]=_0x11fc09;return _0x1e2e79;});}})[_0x33cb('0x19')](respondWithFilteredResult(_0x50949a,_0x5f25bd))[_0x33cb('0x29')](handleError(_0x50949a,null));};exports[_0x33cb('0x49')]=function(_0x366b04,_0x4ba364){return db['OpenchannelInteraction']['find']({'where':{'id':_0x366b04['params']['id']}})[_0x33cb('0x19')](handleEntityNotFound(_0x4ba364,null))[_0x33cb('0x19')](function(_0x39eadb){if(_0x39eadb){return _0x39eadb[_0x33cb('0x4a')](_0x366b04[_0x33cb('0x34')]['ids'],_[_0x33cb('0x38')](_0x366b04[_0x33cb('0x34')],[_0x33cb('0x39'),'id'])||{})[_0x33cb('0x4b')](function(){return db['Tag']['findAll']({'attributes':['id',_0x33cb('0x1d'),'color'],'where':{'id':_0x366b04['body'][_0x33cb('0x39')]}});})[_0x33cb('0x19')](function(_0x2c4d57){socket[_0x33cb('0x4c')](_0x33cb('0x4d'),{'id':Number(_0x366b04['params']['id']),'tags':_0x2c4d57||[]});return{'id':Number(_0x366b04['params']['id']),'tags':_0x2c4d57||[]};});}})[_0x33cb('0x19')](respondWithResult(_0x4ba364,null))['catch'](handleError(_0x4ba364,null));};exports[_0x33cb('0x4e')]=function(_0x56fbde,_0x4b4602){return db[_0x33cb('0x20')]['find']({'where':{'id':_0x56fbde[_0x33cb('0x2b')]['id']}})[_0x33cb('0x19')](handleEntityNotFound(_0x4b4602,null))[_0x33cb('0x19')](function(_0x588862){if(_0x588862){return _0x588862['removeTags'](_0x56fbde[_0x33cb('0x27')]['ids']);}})['then'](respondWithStatusCode(_0x4b4602,null))[_0x33cb('0x29')](handleError(_0x4b4602,null));};exports[_0x33cb('0x4f')]=function(_0x17ba01,_0x2778e7){var _0x3b91dc=moment()[_0x33cb('0x50')]()['toString']();var _0x8e73f8=path[_0x33cb('0x51')](config[_0x33cb('0x52')],_0x33cb('0x53'),_0x33cb('0x54'),_0x33cb('0x55'));var _0x2cd7fb=path[_0x33cb('0x51')](config[_0x33cb('0x52')],_0x33cb('0x53'),_0x33cb('0x54'),_0x33cb('0x56'));var _0x484272=path[_0x33cb('0x51')](_0x8e73f8,_0x3b91dc);var _0x17f9eb=util[_0x33cb('0x44')]('transcript-%d-%s.zip',_0x17ba01[_0x33cb('0x2b')]['id'],_0x3b91dc);var _0x51ff01=path[_0x33cb('0x51')](_0x8e73f8,_0x17f9eb);var _0x89b093=[];_0x89b093['push']({'model':db[_0x33cb('0x57')],'as':_0x33cb('0x57'),'attributes':['id',_0x33cb('0x58')],'raw':!![]});_0x89b093[_0x33cb('0x59')]({'model':db[_0x33cb('0x5a')],'as':'Contact','attributes':['id','firstName',_0x33cb('0x5b')],'raw':!![]});if(_0x17ba01[_0x33cb('0x27')][_0x33cb('0x56')]){_0x89b093[_0x33cb('0x59')]({'model':db['Attachment'],'as':_0x33cb('0x5c'),'raw':!![]});}var _0x1e8f4b=[{'model':db[_0x33cb('0x37')],'as':_0x33cb('0x5d'),'attributes':['id',_0x33cb('0x34'),_0x33cb('0x5e'),_0x33cb('0x5f'),_0x33cb('0x60'),_0x33cb('0x61')],'include':_0x89b093}];_0x1e8f4b[_0x33cb('0x59')]({'model':db[_0x33cb('0x62')],'as':_0x33cb('0x63'),'attributes':['id',_0x33cb('0x1d')]});_0x1e8f4b[_0x33cb('0x59')]({'model':db[_0x33cb('0x57')],'as':_0x33cb('0x64'),'attributes':['id',_0x33cb('0x58')]});return db['OpenchannelInteraction'][_0x33cb('0x35')]({'where':{'id':_0x17ba01[_0x33cb('0x2b')]['id']},'include':_0x1e8f4b})[_0x33cb('0x19')](handleEntityNotFound(_0x2778e7,null))[_0x33cb('0x19')](function(_0x18fb8a){if(_0x18fb8a){var _0xe885e5=_0x18fb8a[_0x33cb('0x65')]({'plain':!![]});fs[_0x33cb('0x66')](_0x484272);var _0x14b940={'channel':_0x33cb('0x67'),'account':_0xe885e5[_0x33cb('0x63')][_0x33cb('0x1d')],'agent':_0xe885e5[_0x33cb('0x64')]?_0xe885e5[_0x33cb('0x64')][_0x33cb('0x58')]:'N.A.','createdAt':moment(_0xe885e5[_0x33cb('0x5e')])[_0x33cb('0x44')](_0x33cb('0x45'))[_0x33cb('0x68')](),'closedAt':_0xe885e5[_0x33cb('0x69')]?moment(_0xe885e5['closedAt'])[_0x33cb('0x44')](_0x33cb('0x45'))[_0x33cb('0x68')]():'','disposition':_0xe885e5['disposition'],'visibility':_0xe885e5['threadId']?'Public':_0x33cb('0x6a'),'messages':_(_0xe885e5[_0x33cb('0x5d')])[_0x33cb('0x40')]({'secret':![]})[_0x33cb('0x6b')](function(_0x3f9c8f){if(_0x3f9c8f['Attachment']){var _0x5b91b1=path['join'](_0x2cd7fb,_0x3f9c8f[_0x33cb('0x5c')][_0x33cb('0x6c')]);if(fs['existsSync'](_0x5b91b1)){fs[_0x33cb('0x6d')](_0x5b91b1)['pipe'](fs[_0x33cb('0x6e')](path['join'](_0x484272,_0x3f9c8f[_0x33cb('0x5c')][_0x33cb('0x6c')])));}}return{'date':moment(_0x3f9c8f['createdAt'])[_0x33cb('0x44')]('YYYY-MM-DD\x20HH:mm:ss')[_0x33cb('0x68')](),'sender':_0x3f9c8f[_0x33cb('0x5f')]===_0x33cb('0x6f')?_0x3f9c8f['User']?_0x3f9c8f['User'][_0x33cb('0x58')]:'System':_0x3f9c8f[_0x33cb('0x70')][_0x33cb('0x71')]+(_0x3f9c8f[_0x33cb('0x70')][_0x33cb('0x5b')]?'\x20'+_0x3f9c8f['Contact'][_0x33cb('0x5b')]:''),'body':_0x3f9c8f[_0x33cb('0x5c')]?_0x3f9c8f[_0x33cb('0x5c')]['basename']:_0x3f9c8f[_0x33cb('0x34')],'direction':_0x3f9c8f[_0x33cb('0x5f')]==='out'?'A':'C','secret':_0x3f9c8f[_0x33cb('0x60')],'read':_0x3f9c8f[_0x33cb('0x61')],'attachment':_0x3f9c8f[_0x33cb('0x5c')]};})[_0x33cb('0x72')]()};return ejs[_0x33cb('0x73')](path[_0x33cb('0x51')](config[_0x33cb('0x52')],_0x33cb('0x53'),'views','downloadInteraction.ejs'),{'interaction':_0x14b940})[_0x33cb('0x19')](function(_0x2c8aca){var _0x3b3c9f=path[_0x33cb('0x51')](_0x484272,_0x33cb('0x74')+_0xe885e5['id']+'-'+_0x3b91dc+_0x33cb('0x75'));var _0x501346={'path':_0x3b3c9f,'channel':_0x33cb('0x67'),'interactionId':_0xe885e5['id']};return pdf[_0x33cb('0x76')](_0x2c8aca,_0x501346);})['then'](function(){return new Promise(function(_0x18a67d,_0x1cc783){zipdir(_0x484272,{'saveTo':_0x51ff01},function(_0xd9d860,_0x4279ef){if(_0xd9d860)return _0x1cc783(_0xd9d860);return _0x18a67d(_0x4279ef);});})[_0x33cb('0x19')](function(){return new Promise(function(_0x17e506,_0xe220aa){rimraf(_0x484272,function(_0x568b7e){if(_0x568b7e)_0xe220aa(_0x568b7e);return _0x17e506();});});})[_0x33cb('0x19')](function(){return _0x2778e7[_0x33cb('0x4f')](_0x51ff01,_0x17f9eb,function(_0x97865b){if(_0x97865b){logger['error'](_0x33cb('0x77'),_0x97865b);}else{fs[_0x33cb('0x78')](_0x51ff01);}});});});}else{return _0x2778e7['sendStatus'](0xc8);}})['catch'](handleError(_0x2778e7,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index af8fa44..b70f374 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 _0x1d3f=['remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x42e248,_0x14d672){var _0x2746a3=function(_0x274fba){while(--_0x274fba){_0x42e248['push'](_0x42e248['shift']());}};_0x2746a3(++_0x14d672);}(_0x1d3f,0x139));var _0xf1d3=function(_0x49aa99,_0x4ef618){_0x49aa99=_0x49aa99-0x0;var _0x1786d7=_0x1d3f[_0x49aa99];return _0x1786d7;};'use strict';var EventEmitter=require(_0xf1d3('0x0'));var OpenchannelInteraction=require(_0xf1d3('0x1'))['db'][_0xf1d3('0x2')];var OpenchannelMessage=require(_0xf1d3('0x1'))['db'][_0xf1d3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf1d3('0x4')](0x0);var events={'afterCreate':_0xf1d3('0x5'),'afterUpdate':_0xf1d3('0x6'),'afterDestroy':_0xf1d3('0x7')};function emitEvent(_0x5b562b){return function(_0xe0e938,_0x415f5c,_0x37d442){_0xe0e938[_0xf1d3('0x8')]({'attributes':['id'],'raw':!![]})[_0xf1d3('0x9')](function(_0x112501){_0xe0e938[_0xf1d3('0xa')](_0xf1d3('0xb'),_0x112501[_0xf1d3('0xc')](function(_0x38261d){return{'id':_0x38261d['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xe0e938['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf1d3('0x9')](function(_0x55df69){_0xe0e938[_0xf1d3('0xa')](_0xf1d3('0xd'),_0x55df69[_0xf1d3('0xe')]);OpenchannelInteractionEvents[_0xf1d3('0xf')](_0x5b562b+':'+_0xe0e938['id'],_0xe0e938);OpenchannelInteractionEvents[_0xf1d3('0xf')](_0x5b562b,_0xe0e938);_0x37d442(null);})[_0xf1d3('0x10')](_0x37d442(null));};}for(var e in events){if(events[_0xf1d3('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xf1d3('0x12')](e,emitEvent(event));}}module[_0xf1d3('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3692=['remove','then','Users','map','setDataValue','length','emit','catch','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save'];(function(_0x41304b,_0x4d519e){var _0x263049=function(_0x5ec6ff){while(--_0x5ec6ff){_0x41304b['push'](_0x41304b['shift']());}};_0x263049(++_0x4d519e);}(_0x3692,0xf4));var _0x2369=function(_0x76d2ec,_0x45ea7c){_0x76d2ec=_0x76d2ec-0x0;var _0x540bdc=_0x3692[_0x76d2ec];return _0x540bdc;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x2369('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x2369('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2369('0x1')](0x0);var events={'afterCreate':_0x2369('0x2'),'afterUpdate':'update','afterDestroy':_0x2369('0x3')};function emitEvent(_0x568b26){return function(_0x186c47,_0x21fe28,_0x4ece35){_0x186c47['getUsers']({'attributes':['id'],'raw':!![]})[_0x2369('0x4')](function(_0x2d5aff){_0x186c47['setDataValue'](_0x2369('0x5'),_0x2d5aff[_0x2369('0x6')](function(_0x2b03b0){return{'id':_0x2b03b0['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x186c47['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2369('0x4')](function(_0x3e9d1b){_0x186c47[_0x2369('0x7')]('unreadMessages',_0x3e9d1b[_0x2369('0x8')]);OpenchannelInteractionEvents['emit'](_0x568b26+':'+_0x186c47['id'],_0x186c47);OpenchannelInteractionEvents[_0x2369('0x9')](_0x568b26,_0x186c47);_0x4ece35(null);})[_0x2369('0xa')](_0x4ece35(null));};}for(var e in events){if(events[_0x2369('0xb')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x2369('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index d6798ac..3e478cf 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 _0xf4f5=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a0d89,_0x22132c){var _0x1329a0=function(_0x5c8582){while(--_0x5c8582){_0x4a0d89['push'](_0x4a0d89['shift']());}};_0x1329a0(++_0x22132c);}(_0xf4f5,0x1dc));var _0x5f4f=function(_0x367c24,_0x4993a4){_0x367c24=_0x367c24-0x0;var _0x46a215=_0xf4f5[_0x367c24];return _0x46a215;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5f4f('0x0'));var moment=require(_0x5f4f('0x1'));var BPromise=require(_0x5f4f('0x2'));var rp=require(_0x5f4f('0x3'));var fs=require('fs');var path=require(_0x5f4f('0x4'));var rimraf=require('rimraf');var config=require(_0x5f4f('0x5'));var attributes=require(_0x5f4f('0x6'));module[_0x5f4f('0x7')]=function(_0x21a321,_0x5721c1){return _0x21a321[_0x5f4f('0x8')](_0x5f4f('0x9'),attributes,{'tableName':_0x5f4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f4f('0xb'),'collate':_0x5f4f('0xc'),'hooks':{'beforeUpdate':function(_0x53e034,_0x332267,_0x4e1ff4){if(_0x53e034[_0x5f4f('0xd')](_0x5f4f('0xe'))){_0x53e034[_0x5f4f('0xf')]=moment()['format'](_0x5f4f('0x10'));}_0x4e1ff4(null,_0x53e034);}}});}; \ No newline at end of file +var _0x3f3c=['utf8mb4_unicode_ci','changed','closedAt','format','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','OpenchannelInteraction'];(function(_0x112c5a,_0x5026f2){var _0xd78ca8=function(_0x39b176){while(--_0x39b176){_0x112c5a['push'](_0x112c5a['shift']());}};_0xd78ca8(++_0x5026f2);}(_0x3f3c,0x1e0));var _0xc3f3=function(_0x13854f,_0x13aa3c){_0x13854f=_0x13854f-0x0;var _0x8232f8=_0x3f3c[_0x13854f];return _0x8232f8;};'use strict';var _=require('lodash');var util=require(_0xc3f3('0x0'));var logger=require(_0xc3f3('0x1'))('api');var moment=require(_0xc3f3('0x2'));var BPromise=require(_0xc3f3('0x3'));var rp=require(_0xc3f3('0x4'));var fs=require('fs');var path=require(_0xc3f3('0x5'));var rimraf=require(_0xc3f3('0x6'));var config=require('../../config/environment');var attributes=require(_0xc3f3('0x7'));module[_0xc3f3('0x8')]=function(_0x15ce14,_0x4a553b){return _0x15ce14['define'](_0xc3f3('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc3f3('0xa'),'hooks':{'beforeUpdate':function(_0x18e5f7,_0x41d6aa,_0x587943){if(_0x18e5f7[_0xc3f3('0xb')]('closed')){_0x18e5f7[_0xc3f3('0xc')]=moment()[_0xc3f3('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x587943(null,_0x18e5f7);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 22c043c..cfc8de2 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 _0x5b4e=['catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','stringify','AddTagsToOpenchannelInteraction','where','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x52fa1e,_0x39a40f){var _0x26849d=function(_0x4e52c3){while(--_0x4e52c3){_0x52fa1e['push'](_0x52fa1e['shift']());}};_0x26849d(++_0x39a40f);}(_0x5b4e,0x1b1));var _0xe5b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b4e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe5b4('0x0'));var moment=require(_0xe5b4('0x1'));var BPromise=require(_0xe5b4('0x2'));var rs=require(_0xe5b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5b4('0x5'))('rpc');var config=require(_0xe5b4('0x6'));var jayson=require(_0xe5b4('0x7'));var client=jayson[_0xe5b4('0x8')][_0xe5b4('0x9')]({'port':0x232a});config['redis']=_[_0xe5b4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe5b4('0xb'))[_0xe5b4('0xc')](socket);function respondWithRpcPromise(_0x143eac,_0x126a78,_0x42309c){return new BPromise(function(_0x92137b,_0x5e7688){return client[_0xe5b4('0xd')](_0x143eac,_0x42309c)[_0xe5b4('0xe')](function(_0x4151e7){logger[_0xe5b4('0xf')](_0xe5b4('0x10'),_0x126a78,_0xe5b4('0x11'));logger[_0xe5b4('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x126a78,_0xe5b4('0x11'),JSON['stringify'](_0x4151e7));if(_0x4151e7[_0xe5b4('0x13')]){if(_0x4151e7['error'][_0xe5b4('0x14')]===0x1f4){logger[_0xe5b4('0x13')](_0xe5b4('0x10'),_0x126a78,_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);return _0x5e7688(_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);}logger[_0xe5b4('0x13')](_0xe5b4('0x10'),_0x126a78,_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);return _0x92137b(_0x4151e7[_0xe5b4('0x13')][_0xe5b4('0x15')]);}else{logger['info'](_0xe5b4('0x10'),_0x126a78,_0xe5b4('0x11'));_0x92137b(_0x4151e7[_0xe5b4('0x16')][_0xe5b4('0x15')]);}})[_0xe5b4('0x17')](function(_0x24171f){logger[_0xe5b4('0x13')](_0xe5b4('0x10'),_0x126a78,_0x24171f);_0x5e7688(_0x24171f);});});}exports[_0xe5b4('0x18')]=function(_0x141658){var _0x18a6b0=this;return new Promise(function(_0x490fa9,_0x51563d){return db[_0xe5b4('0x19')]['update'](_0x141658[_0xe5b4('0x1a')],{'raw':_0x141658[_0xe5b4('0x1b')]?_0x141658['options'][_0xe5b4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141658[_0xe5b4('0x1b')]?_0x141658['options']['where']||null:null,'attributes':_0x141658[_0xe5b4('0x1b')]?_0x141658[_0xe5b4('0x1b')][_0xe5b4('0x1d')]||null:null,'limit':_0x141658['options']?_0x141658[_0xe5b4('0x1b')][_0xe5b4('0x1e')]||null:null})[_0xe5b4('0xe')](function(_0x17e6c6){logger[_0xe5b4('0xf')](_0xe5b4('0x18'),_0x141658);logger[_0xe5b4('0x12')]('UpdateOpenchannelInteraction',_0x141658,JSON[_0xe5b4('0x1f')](_0x17e6c6));_0x490fa9(_0x17e6c6);})['catch'](function(_0x1c94b2){logger[_0xe5b4('0x13')](_0xe5b4('0x18'),_0x1c94b2['message'],_0x141658);_0x51563d(_0x18a6b0['error'](0x1f4,_0x1c94b2['message']));});});};exports[_0xe5b4('0x20')]=function(_0x1176fc){return new Promise(function(_0x2f4dbe,_0x559cee){return db[_0xe5b4('0x19')]['find']({'where':_0x1176fc['options']?_0x1176fc[_0xe5b4('0x1b')][_0xe5b4('0x21')]||null:null})['then'](function(_0x4167c5){if(_0x4167c5){return _0x4167c5['addTags'](_0x1176fc[_0xe5b4('0x1a')][_0xe5b4('0x22')],_[_0xe5b4('0x23')](_0x1176fc['body'],[_0xe5b4('0x22'),'id'])||{});}})[_0xe5b4('0x24')](function(_0x3256da){logger[_0xe5b4('0xf')](_0xe5b4('0x25'),_0x1176fc);logger[_0xe5b4('0x12')](_0xe5b4('0x25'),_0x1176fc,JSON[_0xe5b4('0x1f')](_0x3256da));_0x2f4dbe(_0x3256da);})[_0xe5b4('0x17')](function(_0x1749c6){logger['error'](_0xe5b4('0x25'),_0x1749c6['message'],_0x1176fc);_0x559cee(_this[_0xe5b4('0x13')](0x1f4,_0x1749c6[_0xe5b4('0x15')]));});});}; \ No newline at end of file +var _0xec33=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelInteraction','update','options','limit','info','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util'];(function(_0x400d28,_0x368388){var _0x44808a=function(_0x52b747){while(--_0x52b747){_0x400d28['push'](_0x400d28['shift']());}};_0x44808a(++_0x368388);}(_0xec33,0x166));var _0x3ec3=function(_0x8ad61a,_0x83d4fa){_0x8ad61a=_0x8ad61a-0x0;var _0x130853=_0xec33[_0x8ad61a];return _0x130853;};'use strict';var _=require(_0x3ec3('0x0'));var util=require(_0x3ec3('0x1'));var moment=require(_0x3ec3('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ec3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ec3('0x4'))['db'];var utils=require(_0x3ec3('0x5'));var logger=require(_0x3ec3('0x6'))(_0x3ec3('0x7'));var config=require(_0x3ec3('0x8'));var jayson=require(_0x3ec3('0x9'));var client=jayson[_0x3ec3('0xa')][_0x3ec3('0xb')]({'port':0x232a});config[_0x3ec3('0xc')]=_[_0x3ec3('0xd')](config[_0x3ec3('0xc')],{'host':_0x3ec3('0xe'),'port':0x18eb});var socket=require(_0x3ec3('0xf'))(new Redis(config[_0x3ec3('0xc')]));require('./openchannelInteraction.socket')[_0x3ec3('0x10')](socket);function respondWithRpcPromise(_0xf1c88f,_0x33c4de,_0xc38d87){return new BPromise(function(_0x390d20,_0x2cd188){return client['request'](_0xf1c88f,_0xc38d87)[_0x3ec3('0x11')](function(_0x49fb99){logger['info'](_0x3ec3('0x12'),_0x33c4de,_0x3ec3('0x13'));logger[_0x3ec3('0x14')](_0x3ec3('0x15'),_0x33c4de,_0x3ec3('0x13'),JSON[_0x3ec3('0x16')](_0x49fb99));if(_0x49fb99['error']){if(_0x49fb99[_0x3ec3('0x17')][_0x3ec3('0x18')]===0x1f4){logger[_0x3ec3('0x17')](_0x3ec3('0x12'),_0x33c4de,_0x49fb99[_0x3ec3('0x17')]['message']);return _0x2cd188(_0x49fb99['error']['message']);}logger[_0x3ec3('0x17')](_0x3ec3('0x12'),_0x33c4de,_0x49fb99[_0x3ec3('0x17')]['message']);return _0x390d20(_0x49fb99['error'][_0x3ec3('0x19')]);}else{logger['info'](_0x3ec3('0x12'),_0x33c4de,'request\x20sent');_0x390d20(_0x49fb99[_0x3ec3('0x1a')][_0x3ec3('0x19')]);}})['catch'](function(_0x399172){logger[_0x3ec3('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x33c4de,_0x399172);_0x2cd188(_0x399172);});});}exports['UpdateOpenchannelInteraction']=function(_0x27cb63){var _0x18a5ec=this;return new Promise(function(_0x347019,_0x3798db){return db[_0x3ec3('0x1b')][_0x3ec3('0x1c')](_0x27cb63['body'],{'raw':_0x27cb63[_0x3ec3('0x1d')]?_0x27cb63['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27cb63[_0x3ec3('0x1d')]?_0x27cb63[_0x3ec3('0x1d')]['where']||null:null,'attributes':_0x27cb63[_0x3ec3('0x1d')]?_0x27cb63[_0x3ec3('0x1d')]['attributes']||null:null,'limit':_0x27cb63[_0x3ec3('0x1d')]?_0x27cb63[_0x3ec3('0x1d')][_0x3ec3('0x1e')]||null:null})[_0x3ec3('0x11')](function(_0x158a00){logger[_0x3ec3('0x1f')]('UpdateOpenchannelInteraction',_0x27cb63);logger[_0x3ec3('0x14')](_0x3ec3('0x20'),_0x27cb63,JSON[_0x3ec3('0x16')](_0x158a00));_0x347019(_0x158a00);})['catch'](function(_0x3c4fa3){logger[_0x3ec3('0x17')](_0x3ec3('0x20'),_0x3c4fa3['message'],_0x27cb63);_0x3798db(_0x18a5ec[_0x3ec3('0x17')](0x1f4,_0x3c4fa3['message']));});});};exports[_0x3ec3('0x21')]=function(_0x4c09b2){return new Promise(function(_0x508216,_0x1d5642){return db[_0x3ec3('0x1b')]['find']({'where':_0x4c09b2['options']?_0x4c09b2[_0x3ec3('0x1d')]['where']||null:null})[_0x3ec3('0x11')](function(_0x47ee9b){if(_0x47ee9b){return _0x47ee9b[_0x3ec3('0x22')](_0x4c09b2[_0x3ec3('0x23')][_0x3ec3('0x24')],_[_0x3ec3('0x25')](_0x4c09b2['body'],[_0x3ec3('0x24'),'id'])||{});}})[_0x3ec3('0x26')](function(_0x55f20e){logger['info'](_0x3ec3('0x27'),_0x4c09b2);logger[_0x3ec3('0x14')]('AddTags',_0x4c09b2,JSON['stringify'](_0x55f20e));_0x508216(_0x55f20e);})['catch'](function(_0xb90474){logger[_0x3ec3('0x17')](_0x3ec3('0x27'),_0xb90474[_0x3ec3('0x19')],_0x4c09b2);_0x1d5642(_this['error'](0x1f4,_0xb90474[_0x3ec3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 84ded6b..3ef7046 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 _0xc920=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc920,0x1c9));var _0x0c92=function(_0x255caf,_0x2f893b){_0x255caf=_0x255caf-0x0;var _0x25e862=_0xc920[_0x255caf];return _0x25e862;};'use strict';var OpenchannelInteractionEvents=require(_0x0c92('0x0'));var events=[_0x0c92('0x1'),_0x0c92('0x2'),_0x0c92('0x3')];function createListener(_0x1c2c71,_0x3c0814){return function(_0x112e44){_0x3c0814[_0x0c92('0x4')](_0x1c2c71,_0x112e44);};}function removeListener(_0x54fc71,_0x7ec041){return function(){OpenchannelInteractionEvents[_0x0c92('0x5')](_0x54fc71,_0x7ec041);};}exports[_0x0c92('0x6')]=function(_0x140c07){for(var _0x16383b=0x0,_0x530c31=events[_0x0c92('0x7')];_0x16383b<_0x530c31;_0x16383b++){var _0x5c3825=events[_0x16383b];var _0x39d9d8=createListener(_0x0c92('0x8')+_0x5c3825,_0x140c07);OpenchannelInteractionEvents['on'](_0x5c3825,_0x39d9d8);}}; \ No newline at end of file +var _0x95cc=['remove','update','emit','register','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x95cc,0x7c));var _0xc95c=function(_0x5889d8,_0x166ae2){_0x5889d8=_0x5889d8-0x0;var _0x3e59ef=_0x95cc[_0x5889d8];return _0x3e59ef;};'use strict';var OpenchannelInteractionEvents=require(_0xc95c('0x0'));var events=[_0xc95c('0x1'),_0xc95c('0x2'),_0xc95c('0x3')];function createListener(_0x72d799,_0x334a7a){return function(_0x326698){_0x334a7a[_0xc95c('0x4')](_0x72d799,_0x326698);};}function removeListener(_0x3edc6a,_0x5c70b5){return function(){OpenchannelInteractionEvents['removeListener'](_0x3edc6a,_0x5c70b5);};}exports[_0xc95c('0x5')]=function(_0x118464){for(var _0x518d15=0x0,_0x39e282=events['length'];_0x518d15<_0x39e282;_0x518d15++){var _0x4502b5=events[_0x518d15];var _0x3c5cfc=createListener(_0xc95c('0x6')+_0x4502b5,_0x118464);OpenchannelInteractionEvents['on'](_0x4502b5,_0x3c5cfc);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 63b59bf..660ff19 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(_0x120564,_0x3c18cf){var _0x579980=function(_0x108c13){while(--_0x108c13){_0x120564['push'](_0x120564['shift']());}};_0x579980(++_0x3c18cf);}(_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('./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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x1b80e7,_0x43b510){var _0x396d08=function(_0x493e5a){while(--_0x493e5a){_0x1b80e7['push'](_0x1b80e7['shift']());}};_0x396d08(++_0x43b510);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3e57fcd..1f04962 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 _0xd4dc=['ENUM','out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0xbae489,_0x59368c){var _0x1b2b2c=function(_0x3fb66b){while(--_0x3fb66b){_0xbae489['push'](_0xbae489['shift']());}};_0x1b2b2c(++_0x59368c);}(_0xd4dc,0xff));var _0xcd4d=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xd4dc[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0xcd4d('0x0'));module['exports']={'body':{'type':Sequelize[_0xcd4d('0x1')](_0xcd4d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd4d('0x4')]('in',_0xcd4d('0x5')),'defaultValue':_0xcd4d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xcd4d('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4e5c=['TEXT','BOOLEAN','ENUM','STRING','sequelize'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0x4e5c,0x149));var _0xc4e5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x4e5c[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0xc4e5('0x0'));module['exports']={'body':{'type':Sequelize[_0xc4e5('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc4e5('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc4e5('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc4e5('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc4e5('0x4')]},'providerResponse':{'type':Sequelize[_0xc4e5('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0eb5f33..67bfc41 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 _0x72d6=['model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelMessage','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','describe','openchannel-interactions','accept','read','readAt','format','UserId','user','agent','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteraction','OpenchannelInteractionId','role','RejectMessage','rejectMessage','internal','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','name','index','map','rawAttributes','type','key'];(function(_0x2b3d5d,_0xbb26ad){var _0x86cf07=function(_0x2f1b07){while(--_0x2f1b07){_0x2b3d5d['push'](_0x2b3d5d['shift']());}};_0x86cf07(++_0xbb26ad);}(_0x72d6,0x1bf));var _0x672d=function(_0x4d8c7b,_0x20b79b){_0x4d8c7b=_0x4d8c7b-0x0;var _0x5d4b8c=_0x72d6[_0x4d8c7b];return _0x5d4b8c;};'use strict';var emlformat=require(_0x672d('0x0'));var rimraf=require(_0x672d('0x1'));var zipdir=require(_0x672d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x672d('0x3'));var moment=require(_0x672d('0x4'));var BPromise=require(_0x672d('0x5'));var Mustache=require('mustache');var util=require(_0x672d('0x6'));var path=require(_0x672d('0x7'));var sox=require(_0x672d('0x8'));var csv=require('to-csv');var ejs=require(_0x672d('0x9'));var fs=require('fs');var fs_extra=require(_0x672d('0xa'));var _=require(_0x672d('0xb'));var squel=require(_0x672d('0xc'));var crypto=require(_0x672d('0xd'));var jsforce=require(_0x672d('0xe'));var deskjs=require(_0x672d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x672d('0x10'));var Papa=require('papaparse');var Redis=require(_0x672d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x672d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x672d('0x13'));var logger=require(_0x672d('0x14'))(_0x672d('0x15'));var utils=require(_0x672d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x672d('0x17'));var db=require(_0x672d('0x18'))['db'];config[_0x672d('0x19')]=_['defaults'](config[_0x672d('0x19')],{'host':_0x672d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x672d('0x19')]));require(_0x672d('0x1b'))[_0x672d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x672d('0x1d')]({'port':0x232c});var client9002=jayson[_0x672d('0x1e')][_0x672d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x258e4b,_0x32ce02,_0x398e82,_0x44e4cb){return new BPromise(function(_0x316ffb,_0x2bd503){var _0x5175a8=_0x44e4cb||client;return _0x5175a8['request'](_0x258e4b,_0x398e82)[_0x672d('0x1f')](function(_0x41e635){logger[_0x672d('0x20')](_0x672d('0x21'),_0x32ce02,_0x672d('0x22'));logger[_0x672d('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x32ce02,'request\x20sent',JSON[_0x672d('0x24')](_0x41e635));if(_0x41e635[_0x672d('0x25')]){if(_0x41e635['error']['code']===0x1f4){logger[_0x672d('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x32ce02,_0x41e635[_0x672d('0x25')][_0x672d('0x26')]);return _0x2bd503(_0x41e635[_0x672d('0x25')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x32ce02,_0x41e635[_0x672d('0x25')][_0x672d('0x26')]);return _0x316ffb(_0x41e635['error'][_0x672d('0x26')]);}else{logger['info'](_0x672d('0x21'),_0x32ce02,_0x672d('0x22'));_0x316ffb(_0x41e635['result']['message']);}})['catch'](function(_0x1aa0b8){logger[_0x672d('0x25')](_0x672d('0x21'),_0x32ce02,_0x1aa0b8);_0x2bd503(_0x1aa0b8);});});}function respondWithStatusCode(_0x14fcf6,_0x557739){_0x557739=_0x557739||0xcc;return function(_0x164b74){if(_0x164b74){return _0x14fcf6[_0x672d('0x27')](_0x557739);}return _0x14fcf6[_0x672d('0x28')](_0x557739)[_0x672d('0x29')]();};}function respondWithResult(_0x4f1374,_0x3a92ce){_0x3a92ce=_0x3a92ce||0xc8;return function(_0x111533){if(_0x111533){return _0x4f1374[_0x672d('0x28')](_0x3a92ce)[_0x672d('0x2a')](_0x111533);}};}function respondWithFilteredResult(_0x1fb1d2,_0x3233f2){return function(_0x2696d8){if(_0x2696d8){var _0x5a156f=typeof _0x3233f2[_0x672d('0x2b')]===_0x672d('0x2c')&&typeof _0x3233f2[_0x672d('0x2d')]==='undefined';var _0x1c459d=_0x2696d8[_0x672d('0x2e')];var _0x28acee=_0x5a156f?0x0:_0x3233f2[_0x672d('0x2b')];var _0x594f36=_0x5a156f?_0x2696d8[_0x672d('0x2e')]:_0x3233f2[_0x672d('0x2b')]+_0x3233f2[_0x672d('0x2d')];var _0x5b8695;if(_0x594f36>=_0x1c459d){_0x594f36=_0x1c459d;_0x5b8695=0xc8;}else{_0x5b8695=0xce;}_0x1fb1d2[_0x672d('0x28')](_0x5b8695);return _0x1fb1d2['set'](_0x672d('0x2f'),_0x28acee+'-'+_0x594f36+'/'+_0x1c459d)[_0x672d('0x2a')](_0x2696d8);}return null;};}function patchUpdates(_0x2b59c3){return function(_0x37d228){try{jsonpatch[_0x672d('0x30')](_0x37d228,_0x2b59c3,!![]);}catch(_0x56ce9a){return BPromise[_0x672d('0x31')](_0x56ce9a);}return _0x37d228['save']();};}function saveUpdates(_0x1301db,_0x50895b){return function(_0x596b8d){if(_0x596b8d){return _0x596b8d['update'](_0x1301db)['then'](function(_0x593e6){return _0x593e6;});}return null;};}function removeEntity(_0x5787d0,_0x3d1f7c){return function(_0x171f3d){if(_0x171f3d){return _0x171f3d[_0x672d('0x32')]()['then'](function(){_0x5787d0[_0x672d('0x28')](0xcc)[_0x672d('0x29')]();});}};}function handleEntityNotFound(_0x138537,_0x296c87){return function(_0x3e4cfa){if(!_0x3e4cfa){_0x138537['sendStatus'](0x194);}return _0x3e4cfa;};}function handleError(_0x5599f7,_0x378ab0){_0x378ab0=_0x378ab0||0x1f4;return function(_0x3ea1dd){logger[_0x672d('0x25')](_0x3ea1dd['stack']);if(_0x3ea1dd[_0x672d('0x33')]){delete _0x3ea1dd[_0x672d('0x33')];}_0x5599f7[_0x672d('0x28')](_0x378ab0)['send'](_0x3ea1dd);};}exports[_0x672d('0x34')]=function(_0x472313,_0x4753af){var _0x5719d2={},_0x53c3f7={},_0x399745={'count':0x0,'rows':[]};var _0x2a8887=_[_0x672d('0x35')](db['OpenchannelMessage'][_0x672d('0x36')],function(_0x585c51){return{'name':_0x585c51['fieldName'],'type':_0x585c51[_0x672d('0x37')][_0x672d('0x38')]};});_0x53c3f7[_0x672d('0x39')]=_['map'](_0x2a8887,_0x672d('0x33'));_0x53c3f7[_0x672d('0x3a')]=_[_0x672d('0x3b')](_0x472313[_0x672d('0x3a')]);_0x53c3f7[_0x672d('0x3c')]=_['intersection'](_0x53c3f7[_0x672d('0x39')],_0x53c3f7[_0x672d('0x3a')]);_0x5719d2[_0x672d('0x3d')]=_['intersection'](_0x53c3f7[_0x672d('0x39')],qs['fields'](_0x472313[_0x672d('0x3a')][_0x672d('0x3e')]));_0x5719d2[_0x672d('0x3d')]=_0x5719d2[_0x672d('0x3d')][_0x672d('0x3f')]?_0x5719d2[_0x672d('0x3d')]:_0x53c3f7[_0x672d('0x39')];if(!_0x472313[_0x672d('0x3a')]['hasOwnProperty'](_0x672d('0x40'))){_0x5719d2['limit']=qs[_0x672d('0x2d')](_0x472313[_0x672d('0x3a')][_0x672d('0x2d')]);_0x5719d2['offset']=qs[_0x672d('0x2b')](_0x472313['query']['offset']);}_0x5719d2[_0x672d('0x41')]=qs[_0x672d('0x42')](_0x472313[_0x672d('0x3a')][_0x672d('0x42')]);_0x5719d2[_0x672d('0x43')]=qs[_0x672d('0x3c')](_[_0x672d('0x44')](_0x472313[_0x672d('0x3a')],_0x53c3f7[_0x672d('0x3c')]),_0x2a8887);if(_0x472313['query']['filter']){_0x5719d2[_0x672d('0x43')]=_['merge'](_0x5719d2['where'],{'$or':_[_0x672d('0x35')](_0x2a8887,function(_0x47532d){if(_0x47532d[_0x672d('0x37')]!=='VIRTUAL'){var _0x577255={};_0x577255[_0x47532d[_0x672d('0x33')]]={'$like':'%'+_0x472313['query'][_0x672d('0x45')]+'%'};return _0x577255;}})});}_0x5719d2=_[_0x672d('0x46')]({},_0x5719d2,_0x472313[_0x672d('0x47')]);var _0x244594={'where':_0x5719d2[_0x672d('0x43')]};return db[_0x672d('0x48')]['count'](_0x244594)['then'](function(_0x405e1b){_0x399745['count']=_0x405e1b;if(_0x472313[_0x672d('0x3a')][_0x672d('0x49')]){_0x5719d2['include']=[{'all':!![]}];}return db[_0x672d('0x48')][_0x672d('0x4a')](_0x5719d2);})[_0x672d('0x1f')](function(_0x31b13c){_0x399745[_0x672d('0x4b')]=_0x31b13c;return _0x399745;})['then'](respondWithFilteredResult(_0x4753af,_0x5719d2))[_0x672d('0x4c')](handleError(_0x4753af,null));};exports[_0x672d('0x4d')]=function(_0x599927,_0x136c96){var _0x154fae={'raw':!![],'where':{'id':_0x599927[_0x672d('0x4e')]['id']}},_0x13b56a={};_0x13b56a['model']=_[_0x672d('0x3b')](db[_0x672d('0x48')][_0x672d('0x36')]);_0x13b56a[_0x672d('0x3a')]=_[_0x672d('0x3b')](_0x599927[_0x672d('0x3a')]);_0x13b56a['filters']=_[_0x672d('0x4f')](_0x13b56a['model'],_0x13b56a[_0x672d('0x3a')]);_0x154fae[_0x672d('0x3d')]=_['intersection'](_0x13b56a[_0x672d('0x39')],qs['fields'](_0x599927[_0x672d('0x3a')]['fields']));_0x154fae['attributes']=_0x154fae[_0x672d('0x3d')][_0x672d('0x3f')]?_0x154fae[_0x672d('0x3d')]:_0x13b56a[_0x672d('0x39')];if(_0x599927['query']['includeAll']){_0x154fae[_0x672d('0x50')]=[{'all':!![]}];}_0x154fae=_[_0x672d('0x46')]({},_0x154fae,_0x599927[_0x672d('0x47')]);return db[_0x672d('0x48')][_0x672d('0x51')](_0x154fae)[_0x672d('0x1f')](handleEntityNotFound(_0x136c96,null))['then'](respondWithResult(_0x136c96,null))[_0x672d('0x4c')](handleError(_0x136c96,null));};exports[_0x672d('0x52')]=function(_0x311e2a,_0x168f32){return db[_0x672d('0x48')][_0x672d('0x52')](_0x311e2a[_0x672d('0x53')],{})[_0x672d('0x1f')](respondWithResult(_0x168f32,0xc9))['catch'](handleError(_0x168f32,null));};exports['update']=function(_0x37220a,_0x35daca){if(_0x37220a[_0x672d('0x53')]['id']){delete _0x37220a[_0x672d('0x53')]['id'];}return db['OpenchannelMessage'][_0x672d('0x51')]({'where':{'id':_0x37220a['params']['id']}})[_0x672d('0x1f')](handleEntityNotFound(_0x35daca,null))[_0x672d('0x1f')](saveUpdates(_0x37220a[_0x672d('0x53')],null))[_0x672d('0x1f')](respondWithResult(_0x35daca,null))[_0x672d('0x4c')](handleError(_0x35daca,null));};exports[_0x672d('0x32')]=function(_0x2ab61c,_0x3dcfa7){return db['OpenchannelMessage'][_0x672d('0x51')]({'where':{'id':_0x2ab61c[_0x672d('0x4e')]['id']}})[_0x672d('0x1f')](handleEntityNotFound(_0x3dcfa7,null))[_0x672d('0x1f')](removeEntity(_0x3dcfa7,null))['catch'](handleError(_0x3dcfa7,null));};exports['describe']=function(_0x74fbbd,_0x3041dc){return db[_0x672d('0x48')][_0x672d('0x54')]()[_0x672d('0x1f')](respondWithResult(_0x3041dc,null))[_0x672d('0x4c')](handleError(_0x3041dc,null));};var interaction_log=require(_0x672d('0x14'))(_0x672d('0x55'));exports[_0x672d('0x56')]=function(_0x50deeb,_0x32afdc,_0x1670dc){var _0x1f1b16={'agent':{},'channel':'openchannel'};if(_0x50deeb[_0x672d('0x53')]['id']){delete _0x50deeb[_0x672d('0x53')]['id'];}_0x50deeb[_0x672d('0x53')][_0x672d('0x57')]=!![];_0x50deeb[_0x672d('0x53')][_0x672d('0x58')]=moment()[_0x672d('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')]=_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')]||_0x50deeb[_0x672d('0x5b')]['id'];_0x1f1b16[_0x672d('0x5c')]['id']=_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')];return db['OpenchannelMessage']['find']({'where':{'id':_0x50deeb[_0x672d('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32afdc,null))[_0x672d('0x1f')](saveUpdates(_0x50deeb['body'],null))['then'](function(_0x53e484){if(_0x53e484){_0x1f1b16[_0x672d('0x26')]=_0x53e484['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x672d('0x51')]({'where':{'id':_0x53e484['OpenchannelInteractionId']}});}return null;})[_0x672d('0x1f')](handleEntityNotFound(_0x32afdc,null))[_0x672d('0x1f')](function(_0x4a6870){if(_0x4a6870){return _0x4a6870[_0x672d('0x5d')]({'UserId':_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')],'read1stAt':_[_0x672d('0x5e')](_0x4a6870[_0x672d('0x5f')])?moment()[_0x672d('0x59')](_0x672d('0x60')):undefined});}return null;})[_0x672d('0x1f')](function(_0x34b734){if(_0x34b734){_0x1f1b16[_0x672d('0x61')]=_0x34b734[_0x672d('0x62')]({'plain':!![]});interaction_log[_0x672d('0x20')](_0x672d('0x63'),_0x50deeb[_0x672d('0x5b')]['id'],_0x50deeb[_0x672d('0x5b')][_0x672d('0x33')],_0x50deeb[_0x672d('0x5b')]['role'],_0x1f1b16[_0x672d('0x61')]['id'],_0x50deeb['body']?JSON[_0x672d('0x24')](_0x50deeb['body']):_0x672d('0x64'));return respondWithRpcPromise('AcceptMessage',_0x672d('0x65'),_0x1f1b16);}return null;})[_0x672d('0x1f')](function(_0xcee374){var _0x6860af=_0x672d('0x66')+_0xcee374[_0x672d('0x26')][_0x672d('0x67')];return db[_0x672d('0x68')][_0x672d('0x3a')](_0x6860af,{'type':db[_0x672d('0x69')][_0x672d('0x6a')][_0x672d('0x6b')],'raw':!![]})[_0x672d('0x1f')](function(_0x24ac17){return _0x24ac17;});})['then'](function(_0x415c52){if(_0x415c52){_0x1f1b16[_0x672d('0x26')][_0x672d('0x6c')]=_0x415c52[0x0];if(!_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')])return;return db[_0x672d('0x6d')][_0x672d('0x51')]({'where':{'id':_0x50deeb[_0x672d('0x53')][_0x672d('0x5a')],'role':_0x672d('0x5c')},'attributes':['id',_0x672d('0x33'),_0x672d('0x6e'),_0x672d('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3a267f){if(!_0x3a267f)return null;_0x1f1b16[_0x672d('0x26')]['agent']=_0x3a267f;return _0x1f1b16;})[_0x672d('0x1f')](function(_0x36d729){if(_0x36d729){if(_0x50deeb['body']['manual']){_0x1f1b16[_0x672d('0x26')][_0x672d('0x70')]=util[_0x672d('0x59')](_0x672d('0x71'),_0x50deeb[_0x672d('0x5b')][_0x672d('0x33')]);_0x1f1b16[_0x672d('0x26')][_0x672d('0x72')]=_0x1f1b16[_0x672d('0x72')];_0x1f1b16['message'][_0x672d('0x73')]=_0x1f1b16['channel'];_0x1f1b16['message'][_0x672d('0x74')]='accept';return respondWithRpcPromise('EventManager',_0x672d('0x75'),{'event':_0x672d('0x76'),'message':_0x1f1b16[_0x672d('0x26')]},client9002)[_0x672d('0x1f')](function(){return _0x1f1b16;});}return _0x1f1b16;}return null;})[_0x672d('0x1f')](respondWithResult(_0x32afdc,null))[_0x672d('0x4c')](handleError(_0x32afdc,null));};var interaction_log=require(_0x672d('0x14'))(_0x672d('0x55'));exports[_0x672d('0x31')]=function(_0x3db057,_0x4080c6,_0x16c720){var _0x283256={'agent':{},'channel':_0x672d('0x77')};if(_0x3db057[_0x672d('0x53')]['id']){delete _0x3db057['body']['id'];}_0x3db057[_0x672d('0x53')][_0x672d('0x5a')]=_0x3db057[_0x672d('0x53')][_0x672d('0x5a')]||_0x3db057[_0x672d('0x5b')]['id'];_0x283256[_0x672d('0x5c')]['id']=_0x3db057[_0x672d('0x53')][_0x672d('0x5a')];return db[_0x672d('0x48')][_0x672d('0x51')]({'where':{'id':_0x3db057['params']['id'],'UserId':null}})[_0x672d('0x1f')](handleEntityNotFound(_0x4080c6,null))[_0x672d('0x1f')](function(_0x1fc7b5){if(_0x1fc7b5){_0x283256[_0x672d('0x26')]=_0x1fc7b5[_0x672d('0x62')]({'plain':!![]});return db[_0x672d('0x78')][_0x672d('0x51')]({'where':{'id':_0x1fc7b5[_0x672d('0x79')]}});}return null;})['then'](handleEntityNotFound(_0x4080c6,null))[_0x672d('0x1f')](function(_0x3aab7d){if(_0x3aab7d){_0x283256[_0x672d('0x61')]=_0x3aab7d['get']({'plain':!![]});interaction_log[_0x672d('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3db057[_0x672d('0x5b')]['id'],_0x3db057[_0x672d('0x5b')]['name'],_0x3db057[_0x672d('0x5b')][_0x672d('0x7a')],_0x283256[_0x672d('0x61')]['id'],_0x3db057[_0x672d('0x53')]?JSON['stringify'](_0x3db057[_0x672d('0x53')]):'null');return respondWithRpcPromise(_0x672d('0x7b'),_0x672d('0x7c'),_0x283256);}return null;})['then'](function(_0x350cb8){var _0x3e209f=_0x672d('0x66')+_0x350cb8[_0x672d('0x26')][_0x672d('0x67')];return db['sequelize']['query'](_0x3e209f,{'type':db[_0x672d('0x69')]['QueryTypes'][_0x672d('0x6b')],'raw':!![]})[_0x672d('0x1f')](function(_0x57e4a4){return _0x57e4a4;});})[_0x672d('0x1f')](function(_0x348305){if(_0x348305){_0x283256[_0x672d('0x26')][_0x672d('0x6c')]=_0x348305[0x0];if(!_0x3db057['body']['UserId'])return;return db[_0x672d('0x6d')]['find']({'where':{'id':_0x3db057[_0x672d('0x53')][_0x672d('0x5a')],'role':_0x672d('0x5c')},'attributes':['id','name',_0x672d('0x6e'),_0x672d('0x6f'),_0x672d('0x7d')],'raw':!![]});}return null;})[_0x672d('0x1f')](function(_0x2a7b17){if(!_0x2a7b17)return null;_0x283256[_0x672d('0x26')][_0x672d('0x5c')]=_0x2a7b17;return _0x283256;})[_0x672d('0x1f')](function(_0x137b7a){if(_0x137b7a){_0x137b7a['message'][_0x672d('0x70')]=util['format'](_0x672d('0x71'),_0x3db057['user'][_0x672d('0x33')]);_0x137b7a['message'][_0x672d('0x72')]=_0x283256['channel'];_0x137b7a[_0x672d('0x26')][_0x672d('0x73')]=_0x283256['channel'];_0x137b7a[_0x672d('0x26')][_0x672d('0x74')]='reject';respondWithRpcPromise(_0x672d('0x75'),_0x672d('0x75'),{'event':'rejectmessage','message':_0x137b7a[_0x672d('0x26')]},client9002);return _0x283256;}return null;})[_0x672d('0x1f')](respondWithResult(_0x4080c6,null))['catch'](handleError(_0x4080c6,null));}; \ No newline at end of file +var _0x980e=['agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','format','interaction','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','EventManager','openchannel-interactions','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','email','interface','event','eml-format','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','length','options','create','body','update','find','params','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x426c1e,_0x1090fa){var _0x3e589f=function(_0x38a7a6){while(--_0x38a7a6){_0x426c1e['push'](_0x426c1e['shift']());}};_0x3e589f(++_0x1090fa);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe980('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe980('0x1'));var rp=require('request-promise');var moment=require(_0xe980('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe980('0x3'));var util=require(_0xe980('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xe980('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe980('0x6'));var squel=require(_0xe980('0x7'));var crypto=require(_0xe980('0x8'));var jsforce=require(_0xe980('0x9'));var deskjs=require(_0xe980('0xa'));var toCsv=require(_0xe980('0x5'));var querystring=require('querystring');var Papa=require(_0xe980('0xb'));var Redis=require(_0xe980('0xc'));var authService=require(_0xe980('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe980('0xe'));var hardwareService=require(_0xe980('0xf'));var logger=require(_0xe980('0x10'))(_0xe980('0x11'));var utils=require(_0xe980('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe980('0x13')]=_[_0xe980('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe980('0x15'))(new Redis(config[_0xe980('0x13')]));require(_0xe980('0x16'))[_0xe980('0x17')](socket);var jayson=require(_0xe980('0x18'));var client=jayson[_0xe980('0x19')][_0xe980('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49771e,_0x594116,_0xd9fff2,_0x1e6760){return new BPromise(function(_0x406418,_0x29593c){var _0x551a2c=_0x1e6760||client;return _0x551a2c[_0xe980('0x1b')](_0x49771e,_0xd9fff2)[_0xe980('0x1c')](function(_0x1ddb12){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x594116,_0xe980('0x1d'));logger[_0xe980('0x1e')](_0xe980('0x1f'),_0x594116,_0xe980('0x1d'),JSON[_0xe980('0x20')](_0x1ddb12));if(_0x1ddb12[_0xe980('0x21')]){if(_0x1ddb12[_0xe980('0x21')][_0xe980('0x22')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x594116,_0x1ddb12[_0xe980('0x21')][_0xe980('0x23')]);return _0x29593c(_0x1ddb12[_0xe980('0x21')]['message']);}logger[_0xe980('0x21')](_0xe980('0x24'),_0x594116,_0x1ddb12['error'][_0xe980('0x23')]);return _0x406418(_0x1ddb12[_0xe980('0x21')][_0xe980('0x23')]);}else{logger['info'](_0xe980('0x24'),_0x594116,'request\x20sent');_0x406418(_0x1ddb12[_0xe980('0x25')][_0xe980('0x23')]);}})[_0xe980('0x26')](function(_0x40a34e){logger['error'](_0xe980('0x24'),_0x594116,_0x40a34e);_0x29593c(_0x40a34e);});});}function respondWithStatusCode(_0x392bd1,_0xdc9ad7){_0xdc9ad7=_0xdc9ad7||0xcc;return function(_0x4ac608){if(_0x4ac608){return _0x392bd1['sendStatus'](_0xdc9ad7);}return _0x392bd1[_0xe980('0x27')](_0xdc9ad7)[_0xe980('0x28')]();};}function respondWithResult(_0x5ec906,_0x16f2fe){_0x16f2fe=_0x16f2fe||0xc8;return function(_0x565424){if(_0x565424){return _0x5ec906[_0xe980('0x27')](_0x16f2fe)[_0xe980('0x29')](_0x565424);}};}function respondWithFilteredResult(_0x10f084,_0x3ef831){return function(_0x2a6e8a){if(_0x2a6e8a){var _0x43a7c2=typeof _0x3ef831['offset']===_0xe980('0x2a')&&typeof _0x3ef831['limit']===_0xe980('0x2a');var _0x24a29e=_0x2a6e8a[_0xe980('0x2b')];var _0x38ab6d=_0x43a7c2?0x0:_0x3ef831[_0xe980('0x2c')];var _0x56fbf7=_0x43a7c2?_0x2a6e8a['count']:_0x3ef831[_0xe980('0x2c')]+_0x3ef831[_0xe980('0x2d')];var _0x1b6d07;if(_0x56fbf7>=_0x24a29e){_0x56fbf7=_0x24a29e;_0x1b6d07=0xc8;}else{_0x1b6d07=0xce;}_0x10f084[_0xe980('0x27')](_0x1b6d07);return _0x10f084[_0xe980('0x2e')](_0xe980('0x2f'),_0x38ab6d+'-'+_0x56fbf7+'/'+_0x24a29e)[_0xe980('0x29')](_0x2a6e8a);}return null;};}function patchUpdates(_0x369c3a){return function(_0x15a5d1){try{jsonpatch[_0xe980('0x30')](_0x15a5d1,_0x369c3a,!![]);}catch(_0x371136){return BPromise['reject'](_0x371136);}return _0x15a5d1['save']();};}function saveUpdates(_0x9a6819,_0x4702e0){return function(_0x46c931){if(_0x46c931){return _0x46c931['update'](_0x9a6819)[_0xe980('0x1c')](function(_0x4b9586){return _0x4b9586;});}return null;};}function removeEntity(_0x2b481c,_0x3d5393){return function(_0x163db9){if(_0x163db9){return _0x163db9[_0xe980('0x31')]()[_0xe980('0x1c')](function(){_0x2b481c[_0xe980('0x27')](0xcc)[_0xe980('0x28')]();});}};}function handleEntityNotFound(_0x9e301c,_0x47a000){return function(_0x5a4d44){if(!_0x5a4d44){_0x9e301c[_0xe980('0x32')](0x194);}return _0x5a4d44;};}function handleError(_0x2625cf,_0x514793){_0x514793=_0x514793||0x1f4;return function(_0x2dec28){logger['error'](_0x2dec28[_0xe980('0x33')]);if(_0x2dec28[_0xe980('0x34')]){delete _0x2dec28[_0xe980('0x34')];}_0x2625cf[_0xe980('0x27')](_0x514793)[_0xe980('0x35')](_0x2dec28);};}exports[_0xe980('0x36')]=function(_0x502223,_0x11fb5b){var _0x1f16c7={},_0x310c54={},_0x2778b2={'count':0x0,'rows':[]};var _0x315627=_['map'](db[_0xe980('0x37')][_0xe980('0x38')],function(_0x1faffe){return{'name':_0x1faffe['fieldName'],'type':_0x1faffe[_0xe980('0x39')]['key']};});_0x310c54[_0xe980('0x3a')]=_[_0xe980('0x3b')](_0x315627,'name');_0x310c54['query']=_[_0xe980('0x3c')](_0x502223[_0xe980('0x3d')]);_0x310c54[_0xe980('0x3e')]=_[_0xe980('0x3f')](_0x310c54[_0xe980('0x3a')],_0x310c54[_0xe980('0x3d')]);_0x1f16c7['attributes']=_[_0xe980('0x3f')](_0x310c54[_0xe980('0x3a')],qs[_0xe980('0x40')](_0x502223['query'][_0xe980('0x40')]));_0x1f16c7[_0xe980('0x41')]=_0x1f16c7[_0xe980('0x41')]['length']?_0x1f16c7[_0xe980('0x41')]:_0x310c54[_0xe980('0x3a')];if(!_0x502223['query'][_0xe980('0x42')](_0xe980('0x43'))){_0x1f16c7[_0xe980('0x2d')]=qs[_0xe980('0x2d')](_0x502223[_0xe980('0x3d')][_0xe980('0x2d')]);_0x1f16c7['offset']=qs[_0xe980('0x2c')](_0x502223[_0xe980('0x3d')][_0xe980('0x2c')]);}_0x1f16c7[_0xe980('0x44')]=qs['sort'](_0x502223[_0xe980('0x3d')][_0xe980('0x45')]);_0x1f16c7[_0xe980('0x46')]=qs[_0xe980('0x3e')](_[_0xe980('0x47')](_0x502223[_0xe980('0x3d')],_0x310c54['filters']),_0x315627);if(_0x502223[_0xe980('0x3d')][_0xe980('0x48')]){_0x1f16c7[_0xe980('0x46')]=_[_0xe980('0x49')](_0x1f16c7[_0xe980('0x46')],{'$or':_[_0xe980('0x3b')](_0x315627,function(_0x45a918){if(_0x45a918[_0xe980('0x39')]!==_0xe980('0x4a')){var _0xa1606d={};_0xa1606d[_0x45a918[_0xe980('0x34')]]={'$like':'%'+_0x502223[_0xe980('0x3d')][_0xe980('0x48')]+'%'};return _0xa1606d;}})});}_0x1f16c7=_[_0xe980('0x49')]({},_0x1f16c7,_0x502223['options']);var _0x581c7f={'where':_0x1f16c7[_0xe980('0x46')]};return db[_0xe980('0x37')][_0xe980('0x2b')](_0x581c7f)['then'](function(_0x23662d){_0x2778b2[_0xe980('0x2b')]=_0x23662d;if(_0x502223[_0xe980('0x3d')][_0xe980('0x4b')]){_0x1f16c7[_0xe980('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xe980('0x4d')](_0x1f16c7);})[_0xe980('0x1c')](function(_0x1c64ac){_0x2778b2['rows']=_0x1c64ac;return _0x2778b2;})['then'](respondWithFilteredResult(_0x11fb5b,_0x1f16c7))[_0xe980('0x26')](handleError(_0x11fb5b,null));};exports[_0xe980('0x4e')]=function(_0x5f45db,_0x3b3cc3){var _0x4f257b={'raw':!![],'where':{'id':_0x5f45db['params']['id']}},_0x3ae094={};_0x3ae094['model']=_[_0xe980('0x3c')](db[_0xe980('0x37')][_0xe980('0x38')]);_0x3ae094[_0xe980('0x3d')]=_[_0xe980('0x3c')](_0x5f45db[_0xe980('0x3d')]);_0x3ae094['filters']=_[_0xe980('0x3f')](_0x3ae094[_0xe980('0x3a')],_0x3ae094[_0xe980('0x3d')]);_0x4f257b[_0xe980('0x41')]=_[_0xe980('0x3f')](_0x3ae094['model'],qs[_0xe980('0x40')](_0x5f45db[_0xe980('0x3d')][_0xe980('0x40')]));_0x4f257b[_0xe980('0x41')]=_0x4f257b[_0xe980('0x41')][_0xe980('0x4f')]?_0x4f257b[_0xe980('0x41')]:_0x3ae094['model'];if(_0x5f45db[_0xe980('0x3d')][_0xe980('0x4b')]){_0x4f257b[_0xe980('0x4c')]=[{'all':!![]}];}_0x4f257b=_[_0xe980('0x49')]({},_0x4f257b,_0x5f45db[_0xe980('0x50')]);return db['OpenchannelMessage']['find'](_0x4f257b)[_0xe980('0x1c')](handleEntityNotFound(_0x3b3cc3,null))[_0xe980('0x1c')](respondWithResult(_0x3b3cc3,null))[_0xe980('0x26')](handleError(_0x3b3cc3,null));};exports[_0xe980('0x51')]=function(_0x25c2bf,_0x820485){return db['OpenchannelMessage'][_0xe980('0x51')](_0x25c2bf[_0xe980('0x52')],{})[_0xe980('0x1c')](respondWithResult(_0x820485,0xc9))[_0xe980('0x26')](handleError(_0x820485,null));};exports[_0xe980('0x53')]=function(_0x2d5271,_0x13ca1b){if(_0x2d5271['body']['id']){delete _0x2d5271[_0xe980('0x52')]['id'];}return db[_0xe980('0x37')][_0xe980('0x54')]({'where':{'id':_0x2d5271[_0xe980('0x55')]['id']}})['then'](handleEntityNotFound(_0x13ca1b,null))[_0xe980('0x1c')](saveUpdates(_0x2d5271[_0xe980('0x52')],null))[_0xe980('0x1c')](respondWithResult(_0x13ca1b,null))['catch'](handleError(_0x13ca1b,null));};exports[_0xe980('0x31')]=function(_0x26ab27,_0xfd75c3){return db[_0xe980('0x37')][_0xe980('0x54')]({'where':{'id':_0x26ab27[_0xe980('0x55')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0xfd75c3,null))[_0xe980('0x1c')](removeEntity(_0xfd75c3,null))[_0xe980('0x26')](handleError(_0xfd75c3,null));};exports[_0xe980('0x56')]=function(_0x2b00d6,_0x18c35e){return db[_0xe980('0x37')][_0xe980('0x56')]()[_0xe980('0x1c')](respondWithResult(_0x18c35e,null))[_0xe980('0x26')](handleError(_0x18c35e,null));};var interaction_log=require(_0xe980('0x10'))('openchannel-interactions');exports[_0xe980('0x57')]=function(_0x2a49ee,_0x3bd4f9,_0x5b3f71){var _0x324d5c={'agent':{},'channel':_0xe980('0x58')};if(_0x2a49ee[_0xe980('0x52')]['id']){delete _0x2a49ee['body']['id'];}_0x2a49ee[_0xe980('0x52')][_0xe980('0x59')]=!![];_0x2a49ee[_0xe980('0x52')][_0xe980('0x5a')]=moment()['format'](_0xe980('0x5b'));_0x2a49ee[_0xe980('0x52')][_0xe980('0x5c')]=_0x2a49ee['body'][_0xe980('0x5c')]||_0x2a49ee[_0xe980('0x5d')]['id'];_0x324d5c[_0xe980('0x5e')]['id']=_0x2a49ee[_0xe980('0x52')][_0xe980('0x5c')];return db[_0xe980('0x37')]['find']({'where':{'id':_0x2a49ee[_0xe980('0x55')]['id'],'UserId':null}})[_0xe980('0x1c')](handleEntityNotFound(_0x3bd4f9,null))[_0xe980('0x1c')](saveUpdates(_0x2a49ee[_0xe980('0x52')],null))[_0xe980('0x1c')](function(_0x1d6394){if(_0x1d6394){_0x324d5c[_0xe980('0x23')]=_0x1d6394[_0xe980('0x5f')]({'plain':!![]});return db[_0xe980('0x60')]['find']({'where':{'id':_0x1d6394[_0xe980('0x61')]}});}return null;})[_0xe980('0x1c')](handleEntityNotFound(_0x3bd4f9,null))['then'](function(_0x85d6fb){if(_0x85d6fb){return _0x85d6fb[_0xe980('0x53')]({'UserId':_0x2a49ee[_0xe980('0x52')][_0xe980('0x5c')],'read1stAt':_[_0xe980('0x62')](_0x85d6fb['read1stAt'])?moment()[_0xe980('0x63')](_0xe980('0x5b')):undefined});}return null;})[_0xe980('0x1c')](function(_0x42f0e5){if(_0x42f0e5){_0x324d5c[_0xe980('0x64')]=_0x42f0e5[_0xe980('0x5f')]({'plain':!![]});interaction_log[_0xe980('0x65')](_0xe980('0x66'),_0x2a49ee[_0xe980('0x5d')]['id'],_0x2a49ee[_0xe980('0x5d')]['name'],_0x2a49ee[_0xe980('0x5d')][_0xe980('0x67')],_0x324d5c[_0xe980('0x64')]['id'],_0x2a49ee['body']?JSON['stringify'](_0x2a49ee['body']):_0xe980('0x68'));return respondWithRpcPromise('AcceptMessage',_0xe980('0x69'),_0x324d5c);}return null;})[_0xe980('0x1c')](function(_0x2597b4){var _0x1ed498=_0xe980('0x6a')+_0x2597b4[_0xe980('0x23')][_0xe980('0x6b')];return db['sequelize'][_0xe980('0x3d')](_0x1ed498,{'type':db[_0xe980('0x6c')][_0xe980('0x6d')][_0xe980('0x6e')],'raw':!![]})[_0xe980('0x1c')](function(_0x472386){return _0x472386;});})[_0xe980('0x1c')](function(_0x454d52){if(_0x454d52){_0x324d5c[_0xe980('0x23')][_0xe980('0x6f')]=_0x454d52[0x0];if(!_0x2a49ee['body'][_0xe980('0x5c')])return;return db[_0xe980('0x70')][_0xe980('0x54')]({'where':{'id':_0x2a49ee[_0xe980('0x52')][_0xe980('0x5c')],'role':'agent'},'attributes':['id',_0xe980('0x34'),_0xe980('0x71'),'email',_0xe980('0x72')],'raw':!![]});}return null;})[_0xe980('0x1c')](function(_0x409994){if(!_0x409994)return null;_0x324d5c[_0xe980('0x23')][_0xe980('0x5e')]=_0x409994;return _0x324d5c;})[_0xe980('0x1c')](function(_0x2ca6a7){if(_0x2ca6a7){if(_0x2a49ee['body'][_0xe980('0x73')]){_0x324d5c[_0xe980('0x23')]['interface']=util['format'](_0xe980('0x74'),_0x2a49ee[_0xe980('0x5d')][_0xe980('0x34')]);_0x324d5c['message'][_0xe980('0x75')]=_0x324d5c[_0xe980('0x75')];_0x324d5c['message'][_0xe980('0x76')]=_0x324d5c['channel'];_0x324d5c[_0xe980('0x23')]['event']=_0xe980('0x57');return respondWithRpcPromise(_0xe980('0x77'),'EventManager',{'event':'acceptmessage','message':_0x324d5c[_0xe980('0x23')]},client9002)[_0xe980('0x1c')](function(){return _0x324d5c;});}return _0x324d5c;}return null;})[_0xe980('0x1c')](respondWithResult(_0x3bd4f9,null))[_0xe980('0x26')](handleError(_0x3bd4f9,null));};var interaction_log=require(_0xe980('0x10'))(_0xe980('0x78'));exports[_0xe980('0x79')]=function(_0x11c375,_0xd61ae0,_0x21c120){var _0x14f1e9={'agent':{},'channel':_0xe980('0x58')};if(_0x11c375[_0xe980('0x52')]['id']){delete _0x11c375[_0xe980('0x52')]['id'];}_0x11c375['body'][_0xe980('0x5c')]=_0x11c375['body'][_0xe980('0x5c')]||_0x11c375['user']['id'];_0x14f1e9[_0xe980('0x5e')]['id']=_0x11c375[_0xe980('0x52')]['UserId'];return db['OpenchannelMessage'][_0xe980('0x54')]({'where':{'id':_0x11c375['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd61ae0,null))[_0xe980('0x1c')](function(_0x492a4){if(_0x492a4){_0x14f1e9[_0xe980('0x23')]=_0x492a4['get']({'plain':!![]});return db[_0xe980('0x60')][_0xe980('0x54')]({'where':{'id':_0x492a4[_0xe980('0x61')]}});}return null;})[_0xe980('0x1c')](handleEntityNotFound(_0xd61ae0,null))[_0xe980('0x1c')](function(_0x116772){if(_0x116772){_0x14f1e9[_0xe980('0x64')]=_0x116772['get']({'plain':!![]});interaction_log[_0xe980('0x65')](_0xe980('0x7a'),_0x11c375['user']['id'],_0x11c375[_0xe980('0x5d')][_0xe980('0x34')],_0x11c375[_0xe980('0x5d')]['role'],_0x14f1e9[_0xe980('0x64')]['id'],_0x11c375['body']?JSON[_0xe980('0x20')](_0x11c375[_0xe980('0x52')]):_0xe980('0x68'));return respondWithRpcPromise(_0xe980('0x7b'),_0xe980('0x7c'),_0x14f1e9);}return null;})[_0xe980('0x1c')](function(_0x268536){var _0x5ae9eb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x268536[_0xe980('0x23')][_0xe980('0x6b')];return db[_0xe980('0x7d')]['query'](_0x5ae9eb,{'type':db[_0xe980('0x6c')]['QueryTypes'][_0xe980('0x6e')],'raw':!![]})['then'](function(_0x4ec8a1){return _0x4ec8a1;});})['then'](function(_0x3bccde){if(_0x3bccde){_0x14f1e9['message'][_0xe980('0x6f')]=_0x3bccde[0x0];if(!_0x11c375['body'][_0xe980('0x5c')])return;return db['User'][_0xe980('0x54')]({'where':{'id':_0x11c375[_0xe980('0x52')][_0xe980('0x5c')],'role':_0xe980('0x5e')},'attributes':['id',_0xe980('0x34'),_0xe980('0x71'),_0xe980('0x7e'),'internal'],'raw':!![]});}return null;})[_0xe980('0x1c')](function(_0x3239c2){if(!_0x3239c2)return null;_0x14f1e9[_0xe980('0x23')][_0xe980('0x5e')]=_0x3239c2;return _0x14f1e9;})[_0xe980('0x1c')](function(_0x63e8c3){if(_0x63e8c3){_0x63e8c3[_0xe980('0x23')][_0xe980('0x7f')]=util['format']('SIP/%s',_0x11c375[_0xe980('0x5d')][_0xe980('0x34')]);_0x63e8c3['message'][_0xe980('0x75')]=_0x14f1e9[_0xe980('0x75')];_0x63e8c3[_0xe980('0x23')][_0xe980('0x76')]=_0x14f1e9['channel'];_0x63e8c3[_0xe980('0x23')][_0xe980('0x80')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x63e8c3['message']},client9002);return _0x14f1e9;}return null;})['then'](respondWithResult(_0xd61ae0,null))['catch'](handleError(_0xd61ae0,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9ad7df3..2e75655 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 _0x717d=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0xcad01d,_0xef9abc){var _0x76a4a6=function(_0x15b2a4){while(--_0x15b2a4){_0xcad01d['push'](_0xcad01d['shift']());}};_0x76a4a6(++_0xef9abc);}(_0x717d,0xdf));var _0xd717=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x717d[_0x3fb030];return _0xd6899b;};'use strict';var EventEmitter=require(_0xd717('0x0'));var OpenchannelMessage=require(_0xd717('0x1'))['db'][_0xd717('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd717('0x3')](0x0);var events={'afterCreate':_0xd717('0x4'),'afterUpdate':_0xd717('0x5'),'afterDestroy':_0xd717('0x6')};function emitEvent(_0x490158){return function(_0x35b238,_0x416c77,_0x2dbf62){OpenchannelMessageEvents[_0xd717('0x7')](_0x490158+':'+_0x35b238['id'],_0x35b238);OpenchannelMessageEvents[_0xd717('0x7')](_0x490158,_0x35b238);_0x2dbf62(null);};}for(var e in events){if(events[_0xd717('0x8')](e)){var event=events[e];OpenchannelMessage[_0xd717('0x9')](e,emitEvent(event));}}module[_0xd717('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xbcec=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x24f7a0,_0x4c6163){var _0x40f620=function(_0x462427){while(--_0x462427){_0x24f7a0['push'](_0x24f7a0['shift']());}};_0x40f620(++_0x4c6163);}(_0xbcec,0x1c1));var _0xcbce=function(_0xf17533,_0x52702e){_0xf17533=_0xf17533-0x0;var _0x4130c9=_0xbcec[_0xf17533];return _0x4130c9;};'use strict';var EventEmitter=require(_0xcbce('0x0'));var OpenchannelMessage=require(_0xcbce('0x1'))['db'][_0xcbce('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcbce('0x3')](0x0);var events={'afterCreate':_0xcbce('0x4'),'afterUpdate':'update','afterDestroy':_0xcbce('0x5')};function emitEvent(_0x545266){return function(_0x214a6e,_0x25300c,_0x2ea6fc){OpenchannelMessageEvents[_0xcbce('0x6')](_0x545266+':'+_0x214a6e['id'],_0x214a6e);OpenchannelMessageEvents['emit'](_0x545266,_0x214a6e);_0x2ea6fc(null);};}for(var e in events){if(events[_0xcbce('0x7')](e)){var event=events[e];OpenchannelMessage[_0xcbce('0x8')](e,emitEvent(event));}}module[_0xcbce('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c9cdcfd..b494273 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 _0x64ff=['fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','inspect','finally','lodash','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0xe5bfa4,_0x5839d1){var _0x43efc8=function(_0x8f8ccd){while(--_0x8f8ccd){_0xe5bfa4['push'](_0xe5bfa4['shift']());}};_0x43efc8(++_0x5839d1);}(_0x64ff,0x178));var _0xf64f=function(_0x199b04,_0x4816ec){_0x199b04=_0x199b04-0x0;var _0x50e2cc=_0x64ff[_0x199b04];return _0x50e2cc;};'use strict';var _=require(_0xf64f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf64f('0x1'));var moment=require(_0xf64f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf64f('0x3'));var fs=require('fs');var path=require(_0xf64f('0x4'));var rimraf=require(_0xf64f('0x5'));var config=require(_0xf64f('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x3cbed9,_0x3240f){return _0x3cbed9[_0xf64f('0x7')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xf64f('0x8'),'fields':[_0xf64f('0x9')],'type':_0xf64f('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x925067,_0x4c1d42,_0x2cd108){var _0x11628f=_0x3cbed9[_0xf64f('0xb')];var _0xb86889=_0x925067[_0xf64f('0xc')]({'plain':!![]});if(_0xb86889[_0xf64f('0xd')][_0xf64f('0xe')]()==='in'||_0xb86889[_0xf64f('0xd')]['toLowerCase']()===_0xf64f('0xf')&&!_0xb86889[_0xf64f('0x10')]&&!_[_0xf64f('0x11')](_0xb86889[_0xf64f('0x12')])){_0x11628f[_0xf64f('0x13')]['findOne']({'where':{'id':_0xb86889['OpenchannelInteractionId']}})[_0xf64f('0x14')](function(_0x1d6e16){if(_0x1d6e16){_0x1d6e16[_0xf64f('0x15')]({'lastMsgAt':_0xb86889[_0xf64f('0x16')],'lastMsgDirection':_0xb86889[_0xf64f('0xd')][_0xf64f('0xe')]()});}})['catch'](function(_0x9a3a5f){console['error'](_0x9a3a5f);});}if(_0xb86889[_0xf64f('0xd')]==='out'&&!_0xb86889[_0xf64f('0x10')]){var _0x5d6ae2;_0x11628f[_0xf64f('0x17')][_0xf64f('0x18')]()[_0xf64f('0x14')](function(_0x6b5509){return _0x11628f[_0xf64f('0x19')][_0xf64f('0x1a')]({'where':{'id':_0xb86889[_0xf64f('0x1b')]},'include':[{'model':_0x11628f[_0xf64f('0x13')],'as':_0xf64f('0x1c'),'where':{'id':_0xb86889[_0xf64f('0x1d')]},'limit':0x1,'include':[{'model':_0x11628f[_0xf64f('0x17')],'as':_0xf64f('0x1e'),'attributes':_[_0xf64f('0x1f')](_0x6b5509)}]}]});})[_0xf64f('0x14')](function(_0x2884ae){_0x5d6ae2=_0x2884ae['get']({'plain':!![]});if(_0x5d6ae2&&_0x5d6ae2[_0xf64f('0x20')]){logger['info'](_0xf64f('0x21'),_0xf64f('0x22'),util[_0xf64f('0x23')](_0xf64f('0x24'),_0xb86889['id'],_0x5d6ae2[_0xf64f('0x20')]));if(_0x5d6ae2[_0xf64f('0x1c')]&&_0x5d6ae2[_0xf64f('0x1c')][_0xf64f('0x25')]){_0xb86889[_0xf64f('0x26')]=_['omit'](_0x5d6ae2[_0xf64f('0x1c')][0x0],_0xf64f('0x1e'));_0xb86889['Contact']=_0x5d6ae2[_0xf64f('0x1c')][0x0][_0xf64f('0x1e')];}var _0x4c1d42={'method':_0xf64f('0x27'),'uri':encodeURI(_0x5d6ae2[_0xf64f('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4c1d42[_0xf64f('0x28')]){case'GET':_0x4c1d42['qs']=_0xb86889;break;case _0xf64f('0x27'):_0x4c1d42[_0xf64f('0x9')]=_0xb86889;break;}return rp(_0x4c1d42)['then'](function(_0x1d5c6a){logger[_0xf64f('0x29')](_0xf64f('0x21'),_0xf64f('0x22'),util[_0xf64f('0x23')](_0xf64f('0x2a'),_0xb86889['id'],_0x5d6ae2[_0xf64f('0x20')]));if(_0x1d5c6a[_0xf64f('0x9')]['threadId']&&_0x1d5c6a[_0xf64f('0x9')][_0xf64f('0x2b')]!=_0xb86889[_0xf64f('0x26')][_0xf64f('0x2b')]){return _0x11628f[_0xf64f('0x13')][_0xf64f('0x15')]({'threadId':_0x1d5c6a[_0xf64f('0x9')]['threadId']},{'where':{'id':_0xb86889[_0xf64f('0x26')]['id']}});}else{return;}})[_0xf64f('0x14')](function(){return _0x925067[_0xf64f('0x15')]({'read':!![]});})[_0xf64f('0x2c')](function(_0x41f10d){logger[_0xf64f('0x2d')](_0xf64f('0x21'),'afterCreate',util[_0xf64f('0x2e')](_0x41f10d,{'showHidden':![],'depth':null}));_0x2cd108();});}else{_0x2cd108();}})[_0xf64f('0x2f')](function(){_0x2cd108();});}else{_0x2cd108();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x597d=['error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Contact','keys','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','POST','method','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x597d,0x1d2));var _0xd597=function(_0x3e1782,_0x172eb6){_0x3e1782=_0x3e1782-0x0;var _0x133798=_0x597d[_0x3e1782];return _0x133798;};'use strict';var _=require('lodash');var util=require(_0xd597('0x0'));var logger=require(_0xd597('0x1'))(_0xd597('0x2'));var moment=require(_0xd597('0x3'));var BPromise=require(_0xd597('0x4'));var rp=require(_0xd597('0x5'));var fs=require('fs');var path=require(_0xd597('0x6'));var rimraf=require(_0xd597('0x7'));var config=require(_0xd597('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0xd597('0x9')]=function(_0x8e23e2,_0x1a0e89){return _0x8e23e2[_0xd597('0xa')](_0xd597('0xb'),attributes,{'tableName':_0xd597('0xc'),'paranoid':![],'indexes':[{'name':_0xd597('0xd'),'fields':[_0xd597('0xe')],'type':_0xd597('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25be66,_0x577b3b,_0x3bf186){var _0x2fa531=_0x8e23e2[_0xd597('0x10')];var _0x309cda=_0x25be66[_0xd597('0x11')]({'plain':!![]});if(_0x309cda['direction'][_0xd597('0x12')]()==='in'||_0x309cda[_0xd597('0x13')][_0xd597('0x12')]()===_0xd597('0x14')&&!_0x309cda[_0xd597('0x15')]&&!_['isNil'](_0x309cda[_0xd597('0x16')])){_0x2fa531['OpenchannelInteraction'][_0xd597('0x17')]({'where':{'id':_0x309cda[_0xd597('0x18')]}})[_0xd597('0x19')](function(_0x168bca){if(_0x168bca){_0x168bca[_0xd597('0x1a')]({'lastMsgAt':_0x309cda[_0xd597('0x1b')],'lastMsgDirection':_0x309cda[_0xd597('0x13')][_0xd597('0x12')]()});}})[_0xd597('0x1c')](function(_0x52989e){console[_0xd597('0x1d')](_0x52989e);});}if(_0x309cda[_0xd597('0x13')]===_0xd597('0x14')&&!_0x309cda[_0xd597('0x15')]){var _0x2c90fc;_0x2fa531[_0xd597('0x1e')][_0xd597('0x1f')]()[_0xd597('0x19')](function(_0x8622c4){return _0x2fa531[_0xd597('0x20')]['find']({'where':{'id':_0x309cda[_0xd597('0x21')]},'include':[{'model':_0x2fa531[_0xd597('0x22')],'as':'Interactions','where':{'id':_0x309cda[_0xd597('0x18')]},'limit':0x1,'include':[{'model':_0x2fa531[_0xd597('0x1e')],'as':_0xd597('0x23'),'attributes':_[_0xd597('0x24')](_0x8622c4)}]}]});})['then'](function(_0x348a27){_0x2c90fc=_0x348a27['get']({'plain':!![]});if(_0x2c90fc&&_0x2c90fc[_0xd597('0x25')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xd597('0x26'),util[_0xd597('0x27')](_0xd597('0x28'),_0x309cda['id'],_0x2c90fc[_0xd597('0x25')]));if(_0x2c90fc[_0xd597('0x29')]&&_0x2c90fc[_0xd597('0x29')]['length']){_0x309cda[_0xd597('0x2a')]=_[_0xd597('0x2b')](_0x2c90fc[_0xd597('0x29')][0x0],_0xd597('0x23'));_0x309cda[_0xd597('0x23')]=_0x2c90fc['Interactions'][0x0][_0xd597('0x23')];}var _0x577b3b={'method':_0xd597('0x2c'),'uri':encodeURI(_0x2c90fc[_0xd597('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x577b3b[_0xd597('0x2d')]){case _0xd597('0x2e'):_0x577b3b['qs']=_0x309cda;break;case _0xd597('0x2c'):_0x577b3b[_0xd597('0xe')]=_0x309cda;break;}return rp(_0x577b3b)['then'](function(_0x528857){logger[_0xd597('0x2f')](_0xd597('0x30'),_0xd597('0x26'),util['format'](_0xd597('0x31'),_0x309cda['id'],_0x2c90fc[_0xd597('0x25')]));if(_0x528857['body']['threadId']&&_0x528857[_0xd597('0xe')]['threadId']!=_0x309cda[_0xd597('0x2a')][_0xd597('0x32')]){return _0x2fa531[_0xd597('0x22')][_0xd597('0x1a')]({'threadId':_0x528857[_0xd597('0xe')][_0xd597('0x32')]},{'where':{'id':_0x309cda[_0xd597('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x25be66[_0xd597('0x1a')]({'read':!![]});})[_0xd597('0x1c')](function(_0x145198){logger[_0xd597('0x1d')](_0xd597('0x30'),_0xd597('0x26'),util[_0xd597('0x33')](_0x145198,{'showHidden':![],'depth':null}));_0x3bf186();});}else{_0x3bf186();}})[_0xd597('0x34')](function(){_0x3bf186();});}else{_0x3bf186();}}},'charset':_0xd597('0x35'),'collate':_0xd597('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9a6cc69..6f8708e 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x56a313,_0x13d3c0){var _0x357bb7=function(_0xdd9619){while(--_0xdd9619){_0x56a313['push'](_0x56a313['shift']());}};_0x357bb7(++_0x13d3c0);}(_0x7a54,0x106));var _0x47a5=function(_0x35973e,_0x5ecdb7){_0x35973e=_0x35973e-0x0;var _0x5ce28c=_0x7a54[_0x35973e];return _0x5ce28c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x5ba2c8,_0x5826ef){var _0x6c177f=function(_0x15ee42){while(--_0x15ee42){_0x5ba2c8['push'](_0x5ba2c8['shift']());}};_0x6c177f(++_0x5826ef);}(_0xdb28,0x106));var _0x8db2=function(_0x66a92c,_0x433695){_0x66a92c=_0x66a92c-0x0;var _0x53411b=_0xdb28[_0x66a92c];return _0x53411b;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0d764ad..b904ded 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 _0x52a8=['length','update','emit','removeListener','register'];(function(_0x336cac,_0x138b35){var _0x36d63a=function(_0x13f0d7){while(--_0x13f0d7){_0x336cac['push'](_0x336cac['shift']());}};_0x36d63a(++_0x138b35);}(_0x52a8,0x141));var _0x852a=function(_0x1b55f7,_0x2aa4cb){_0x1b55f7=_0x1b55f7-0x0;var _0xc9fab9=_0x52a8[_0x1b55f7];return _0xc9fab9;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save','remove',_0x852a('0x0')];function createListener(_0x54cdc8,_0x2662ef){return function(_0x1a71fc){_0x2662ef[_0x852a('0x1')](_0x54cdc8,_0x1a71fc);};}function removeListener(_0x466ffd,_0x1846eb){return function(){OpenchannelMessageEvents[_0x852a('0x2')](_0x466ffd,_0x1846eb);};}exports[_0x852a('0x3')]=function(_0x2c5580){for(var _0x36d165=0x0,_0x36cbaf=events[_0x852a('0x4')];_0x36d165<_0x36cbaf;_0x36d165++){var _0x1f9fe0=events[_0x36d165];var _0x5611ac=createListener('openchannelMessage:'+_0x1f9fe0,_0x2c5580);OpenchannelMessageEvents['on'](_0x1f9fe0,_0x5611ac);}}; \ No newline at end of file +var _0x63d4=['emit','length','openchannelMessage:','remove','update'];(function(_0x590caa,_0x19e924){var _0x508f6f=function(_0x3062d5){while(--_0x3062d5){_0x590caa['push'](_0x590caa['shift']());}};_0x508f6f(++_0x19e924);}(_0x63d4,0x8f));var _0x463d=function(_0x4f86d3,_0x3cc1f6){_0x4f86d3=_0x4f86d3-0x0;var _0x2fd5d4=_0x63d4[_0x4f86d3];return _0x2fd5d4;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x463d('0x0'),_0x463d('0x1')];function createListener(_0x57218b,_0x307901){return function(_0x1a6569){_0x307901[_0x463d('0x2')](_0x57218b,_0x1a6569);};}function removeListener(_0x39e38b,_0x1dc4f9){return function(){OpenchannelMessageEvents['removeListener'](_0x39e38b,_0x1dc4f9);};}exports['register']=function(_0x1714ef){for(var _0x53296e=0x0,_0xffcd10=events[_0x463d('0x3')];_0x53296e<_0xffcd10;_0x53296e++){var _0x26c513=events[_0x53296e];var _0xcf9e5a=createListener(_0x463d('0x4')+_0x26c513,_0x1714ef);OpenchannelMessageEvents['on'](_0x26c513,_0xcf9e5a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 440c42c..ee151f2 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 _0x5cc4=['index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x287cf0,_0x2f90cf){var _0x1ce6c5=function(_0x6e532a){while(--_0x6e532a){_0x287cf0['push'](_0x287cf0['shift']());}};_0x1ce6c5(++_0x2f90cf);}(_0x5cc4,0xb4));var _0x45cc=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x5cc4[_0x46efd7];return _0x5637e4;};'use strict';var multer=require(_0x45cc('0x0'));var util=require(_0x45cc('0x1'));var path=require(_0x45cc('0x2'));var timeout=require(_0x45cc('0x3'));var express=require(_0x45cc('0x4'));var router=express['Router']();var fs_extra=require(_0x45cc('0x5'));var auth=require(_0x45cc('0x6'));var interaction=require(_0x45cc('0x7'));var config=require(_0x45cc('0x8'));var controller=require(_0x45cc('0x9'));router[_0x45cc('0xa')]('/',auth[_0x45cc('0xb')](),controller[_0x45cc('0xc')]);router['get'](_0x45cc('0xd'),auth[_0x45cc('0xb')](),controller[_0x45cc('0xe')]);router[_0x45cc('0xa')](_0x45cc('0xf'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x10')]);router[_0x45cc('0xa')](_0x45cc('0x11'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x12')]);router[_0x45cc('0xa')](_0x45cc('0x13'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x14')]);router['get'](_0x45cc('0x15'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x16')]);router[_0x45cc('0x17')]('/',auth[_0x45cc('0xb')](),controller[_0x45cc('0x18')]);router[_0x45cc('0x17')](_0x45cc('0x13'),auth[_0x45cc('0xb')](),controller['addTeams']);router[_0x45cc('0x17')](_0x45cc('0x15'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x19')]);router[_0x45cc('0x1a')](_0x45cc('0xf'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x1b')]);router[_0x45cc('0x1c')](_0x45cc('0xf'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x1d')]);router[_0x45cc('0x1c')](_0x45cc('0x13'),auth[_0x45cc('0xb')](),controller['removeTeams']);router[_0x45cc('0x1c')](_0x45cc('0x15'),auth[_0x45cc('0xb')](),controller[_0x45cc('0x1e')]);module[_0x45cc('0x1f')]=router; \ No newline at end of file +var _0x43f0=['update','delete','/:id/teams','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x43f0,0x9c));var _0x043f=function(_0x17c6cd,_0x58e7ef){_0x17c6cd=_0x17c6cd-0x0;var _0x144e54=_0x43f0[_0x17c6cd];return _0x144e54;};'use strict';var multer=require(_0x043f('0x0'));var util=require(_0x043f('0x1'));var path=require('path');var timeout=require(_0x043f('0x2'));var express=require(_0x043f('0x3'));var router=express[_0x043f('0x4')]();var fs_extra=require(_0x043f('0x5'));var auth=require(_0x043f('0x6'));var interaction=require(_0x043f('0x7'));var config=require(_0x043f('0x8'));var controller=require(_0x043f('0x9'));router[_0x043f('0xa')]('/',auth[_0x043f('0xb')](),controller['index']);router[_0x043f('0xa')](_0x043f('0xc'),auth[_0x043f('0xb')](),controller['describe']);router[_0x043f('0xa')](_0x043f('0xd'),auth[_0x043f('0xb')](),controller[_0x043f('0xe')]);router[_0x043f('0xa')](_0x043f('0xf'),auth[_0x043f('0xb')](),controller[_0x043f('0x10')]);router[_0x043f('0xa')]('/:id/teams',auth[_0x043f('0xb')](),controller[_0x043f('0x11')]);router['get'](_0x043f('0x12'),auth[_0x043f('0xb')](),controller[_0x043f('0x13')]);router[_0x043f('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x043f('0x14')]('/:id/teams',auth[_0x043f('0xb')](),controller[_0x043f('0x15')]);router['post'](_0x043f('0x12'),auth[_0x043f('0xb')](),controller[_0x043f('0x16')]);router[_0x043f('0x17')](_0x043f('0xd'),auth[_0x043f('0xb')](),controller[_0x043f('0x18')]);router[_0x043f('0x19')](_0x043f('0xd'),auth[_0x043f('0xb')](),controller['destroy']);router[_0x043f('0x19')](_0x043f('0x1a'),auth[_0x043f('0xb')](),controller[_0x043f('0x1b')]);router[_0x043f('0x19')](_0x043f('0x12'),auth[_0x043f('0xb')](),controller[_0x043f('0x1c')]);module[_0x043f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7106fd3..b6173dd 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 _0x418d=['ENUM','rrmemory','beepall','exports','name','INTEGER'];(function(_0x595d06,_0x39fbe6){var _0x134572=function(_0x1e82da){while(--_0x1e82da){_0x595d06['push'](_0x595d06['shift']());}};_0x134572(++_0x39fbe6);}(_0x418d,0x15f));var _0xd418=function(_0x460438,_0x4ba826){_0x460438=_0x460438-0x0;var _0x481317=_0x418d[_0x460438];return _0x481317;};'use strict';var Sequelize=require('sequelize');module[_0xd418('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd418('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd418('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd418('0x3')](_0xd418('0x4'),_0xd418('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xfd5e=['ENUM','rrmemory','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x420447,_0x30410f){var _0x314e2b=function(_0x2838df){while(--_0x2838df){_0x420447['push'](_0x420447['shift']());}};_0x314e2b(++_0x30410f);}(_0xfd5e,0x176));var _0xefd5=function(_0x39ce29,_0x541ad5){_0x39ce29=_0x39ce29-0x0;var _0x312214=_0xfd5e[_0x39ce29];return _0x312214;};'use strict';var Sequelize=require(_0xefd5('0x0'));module['exports']={'name':{'type':Sequelize[_0xefd5('0x1')],'unique':_0xefd5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xefd5('0x1')]},'timeout':{'type':Sequelize[_0xefd5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xefd5('0x4')](_0xefd5('0x5'),'beepall',_0xefd5('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8c51f65..4b60755 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 _0xd367=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','merge','findAll','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','openchannelPause','updatedAt','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','create','user','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x46eb0e,_0x296d16){var _0x523297=function(_0x1e0dbb){while(--_0x1e0dbb){_0x46eb0e['push'](_0x46eb0e['shift']());}};_0x523297(++_0x296d16);}(_0xd367,0x1a4));var _0x7d36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd367[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x7d36('0x0'));var util=require(_0x7d36('0x1'));var _=require(_0x7d36('0x2'));var squel=require(_0x7d36('0x3'));var Redis=require('ioredis');var qs=require(_0x7d36('0x4'));var logger=require('../../config/logger')(_0x7d36('0x5'));var config=require(_0x7d36('0x6'));var db=require('../../mysqldb')['db'];config[_0x7d36('0x7')]=_[_0x7d36('0x8')](config[_0x7d36('0x7')],{'host':_0x7d36('0x9'),'port':0x18eb});var socket=require(_0x7d36('0xa'))(new Redis(config[_0x7d36('0x7')]));require(_0x7d36('0xb'))[_0x7d36('0xc')](socket);function respondWithStatusCode(_0x134fd2,_0x1adc6e){_0x1adc6e=_0x1adc6e||0xcc;return function(_0x2a1b1b){if(_0x2a1b1b){return _0x134fd2[_0x7d36('0xd')](_0x1adc6e);}return _0x134fd2[_0x7d36('0xe')](_0x1adc6e)[_0x7d36('0xf')]();};}function respondWithResult(_0x45dd3d,_0x4fbe8e){_0x4fbe8e=_0x4fbe8e||0xc8;return function(_0x5bf6c2){if(_0x5bf6c2){return _0x45dd3d[_0x7d36('0xe')](_0x4fbe8e)['json'](_0x5bf6c2);}};}function respondWithFilteredResult(_0x3081c8,_0x11bcc1){return function(_0x33faf9){if(_0x33faf9){var _0x3fd2b4=typeof _0x11bcc1[_0x7d36('0x10')]===_0x7d36('0x11')&&typeof _0x11bcc1[_0x7d36('0x12')]===_0x7d36('0x11');var _0x4ec2a4=_0x33faf9[_0x7d36('0x13')];var _0xb54c97=_0x3fd2b4?0x0:_0x11bcc1[_0x7d36('0x10')];var _0xbb50b0=_0x3fd2b4?_0x33faf9[_0x7d36('0x13')]:_0x11bcc1[_0x7d36('0x10')]+_0x11bcc1[_0x7d36('0x12')];var _0x41c84c;if(_0xbb50b0>=_0x4ec2a4){_0xbb50b0=_0x4ec2a4;_0x41c84c=0xc8;}else{_0x41c84c=0xce;}_0x3081c8[_0x7d36('0xe')](_0x41c84c);return _0x3081c8['set'](_0x7d36('0x14'),_0xb54c97+'-'+_0xbb50b0+'/'+_0x4ec2a4)[_0x7d36('0x15')](_0x33faf9);}return null;};}function saveUpdates(_0x46bd09){return function(_0x4f2563){if(_0x4f2563){return _0x4f2563[_0x7d36('0x16')](_0x46bd09)[_0x7d36('0x17')](function(_0x37cdfe){return _0x37cdfe;});}return null;};}function removeEntity(_0x2d3074){return function(_0x3a9f00){if(_0x3a9f00){return _0x3a9f00[_0x7d36('0x18')]()[_0x7d36('0x17')](function(){var _0x9fefaf=_0x3a9f00[_0x7d36('0x19')]({'plain':!![]});var _0x4c5b18=_0x7d36('0x1a');return db[_0x7d36('0x1b')]['destroy']({'where':{'type':_0x4c5b18,'resourceId':_0x9fefaf['id']}})[_0x7d36('0x17')](function(){return _0x3a9f00;});})[_0x7d36('0x17')](function(){_0x2d3074[_0x7d36('0xe')](0xcc)[_0x7d36('0xf')]();});}};}function handleEntityNotFound(_0x5ee30a){return function(_0x5111bb){if(!_0x5111bb){_0x5ee30a[_0x7d36('0xd')](0x194);}return _0x5111bb;};}function handleError(_0x1b3a41,_0x4e4a09){_0x4e4a09=_0x4e4a09||0x1f4;return function(_0x8001b1){logger[_0x7d36('0x1c')](_0x8001b1['stack']);if(_0x8001b1[_0x7d36('0x1d')]){delete _0x8001b1[_0x7d36('0x1d')];}_0x1b3a41[_0x7d36('0xe')](_0x4e4a09)['send'](_0x8001b1);};}exports[_0x7d36('0x1e')]=function(_0x272c5a,_0x56273f){var _0x297279={};var _0x445a2c={'count':0x0,'rows':[]};var _0x49b2bd=_[_0x7d36('0x1f')](db[_0x7d36('0x20')][_0x7d36('0x21')],function(_0x238338){return{'name':_0x238338[_0x7d36('0x22')],'type':_0x238338[_0x7d36('0x23')][_0x7d36('0x24')]};});_0x297279=qs[_0x7d36('0x25')](_0x49b2bd,_0x272c5a);var _0x44ba44={'where':_0x297279[_0x7d36('0x26')]};return db[_0x7d36('0x20')][_0x7d36('0x13')](_0x44ba44)[_0x7d36('0x17')](function(_0x51b715){_0x445a2c[_0x7d36('0x13')]=_0x51b715;_0x297279[_0x7d36('0x27')]=qs['include'](_0x272c5a[_0x7d36('0x28')]);return db['OpenchannelQueue']['findAll'](_0x297279);})[_0x7d36('0x17')](function(_0x94da02){_0x445a2c[_0x7d36('0x29')]=_0x94da02;return _0x445a2c;})['then'](respondWithFilteredResult(_0x56273f,_0x297279))[_0x7d36('0x2a')](handleError(_0x56273f,null));};exports[_0x7d36('0x2b')]=function(_0x174b7b,_0x334ad8){var _0x1a1547={'raw':!![],'where':{'id':_0x174b7b[_0x7d36('0x2c')]['id']}},_0x59a92a={};_0x59a92a[_0x7d36('0x2d')]=_[_0x7d36('0x2e')](db[_0x7d36('0x20')][_0x7d36('0x21')]);_0x59a92a['query']=_[_0x7d36('0x2e')](_0x174b7b[_0x7d36('0x28')]);_0x59a92a[_0x7d36('0x2f')]=_[_0x7d36('0x30')](_0x59a92a[_0x7d36('0x2d')],_0x59a92a[_0x7d36('0x28')]);_0x1a1547[_0x7d36('0x31')]=_['intersection'](_0x59a92a[_0x7d36('0x2d')],qs[_0x7d36('0x32')](_0x174b7b['query']['fields']));_0x1a1547[_0x7d36('0x31')]=_0x1a1547[_0x7d36('0x31')][_0x7d36('0x33')]?_0x1a1547['attributes']:_0x59a92a[_0x7d36('0x2d')];if(_0x174b7b['query'][_0x7d36('0x34')]){_0x1a1547[_0x7d36('0x27')]=[{'all':!![]}];}_0x1a1547=_['merge']({},_0x1a1547,_0x174b7b[_0x7d36('0x35')]);return db['OpenchannelQueue']['find'](_0x1a1547)[_0x7d36('0x17')](handleEntityNotFound(_0x334ad8,null))[_0x7d36('0x17')](respondWithResult(_0x334ad8,null))[_0x7d36('0x2a')](handleError(_0x334ad8,null));};exports[_0x7d36('0x36')]=function(_0x5a185c,_0x54c02b){return db[_0x7d36('0x20')][_0x7d36('0x36')](_0x5a185c['body'],{})[_0x7d36('0x17')](function(_0x35cf1f){var _0x17c1d7=_0x5a185c[_0x7d36('0x37')][_0x7d36('0x19')]({'plain':!![]});if(!_0x17c1d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17c1d7['role']==='user'){var _0x174adc=_0x35cf1f[_0x7d36('0x19')]({'plain':!![]});var _0x24d48f='OpenchannelQueues';return db[_0x7d36('0x38')][_0x7d36('0x39')]({'where':{'name':_0x24d48f,'userProfileId':_0x17c1d7[_0x7d36('0x3a')]},'raw':!![]})[_0x7d36('0x17')](function(_0x3f619b){if(_0x3f619b&&_0x3f619b[_0x7d36('0x3b')]===0x0){return db[_0x7d36('0x1b')][_0x7d36('0x36')]({'name':_0x174adc[_0x7d36('0x1d')],'resourceId':_0x174adc['id'],'type':_0x3f619b['name'],'sectionId':_0x3f619b['id']},{})[_0x7d36('0x17')](function(){return _0x35cf1f;});}else{return _0x35cf1f;}})[_0x7d36('0x2a')](function(_0x2016c3){logger['error'](_0x7d36('0x3c'),_0x2016c3);throw _0x2016c3;});}return _0x35cf1f;})['then'](respondWithResult(_0x54c02b,0xc9))[_0x7d36('0x2a')](handleError(_0x54c02b,null));};exports['update']=function(_0x457099,_0x5e7ce1){if(_0x457099['body']['id']){delete _0x457099[_0x7d36('0x3d')]['id'];}return db['OpenchannelQueue'][_0x7d36('0x39')]({'where':{'id':_0x457099[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x5e7ce1,null))[_0x7d36('0x17')](saveUpdates(_0x457099[_0x7d36('0x3d')],null))[_0x7d36('0x17')](respondWithResult(_0x5e7ce1,null))[_0x7d36('0x2a')](handleError(_0x5e7ce1,null));};exports[_0x7d36('0x18')]=function(_0x4ffbfe,_0x5eea99){return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x4ffbfe[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x5eea99,null))['then'](removeEntity(_0x5eea99,null))[_0x7d36('0x2a')](handleError(_0x5eea99,null));};exports[_0x7d36('0x3e')]=function(_0x5a6bab,_0x1dd7a4){return db['OpenchannelQueue']['describe']()[_0x7d36('0x17')](respondWithResult(_0x1dd7a4,null))[_0x7d36('0x2a')](handleError(_0x1dd7a4,null));};exports['getMembers']=function(_0xc77855,_0xdd98fb){var _0x4b2a3e={'raw':!![],'where':{}},_0x5af8f1={},_0x542095;return db[_0x7d36('0x20')][_0x7d36('0x3f')]({'where':{'id':_0xc77855[_0x7d36('0x2c')]['id']}})['then'](handleEntityNotFound(_0xdd98fb,null))[_0x7d36('0x17')](function(_0x4e5394){if(_0x4e5394){_0x542095=_0x4e5394[_0x7d36('0x19')]({'plain':!![]});_0x5af8f1['model']=_['keys'](db[_0x7d36('0x40')]['rawAttributes']);_0x5af8f1[_0x7d36('0x28')]=_[_0x7d36('0x2e')](_0xc77855[_0x7d36('0x28')]);_0x5af8f1['filters']=_[_0x7d36('0x30')](_0x5af8f1['model'],_0x5af8f1[_0x7d36('0x28')]);_0x4b2a3e[_0x7d36('0x31')]=_[_0x7d36('0x30')](_0x5af8f1[_0x7d36('0x2d')],qs['fields'](_0xc77855[_0x7d36('0x28')][_0x7d36('0x32')]));_0x4b2a3e[_0x7d36('0x31')]=_0x4b2a3e[_0x7d36('0x31')][_0x7d36('0x33')]?_0x4b2a3e[_0x7d36('0x31')]:_0x5af8f1[_0x7d36('0x2d')];if(!_0xc77855[_0x7d36('0x28')][_0x7d36('0x41')](_0x7d36('0x42'))){_0x4b2a3e['limit']=qs[_0x7d36('0x12')](_0xc77855[_0x7d36('0x28')][_0x7d36('0x12')]);_0x4b2a3e[_0x7d36('0x10')]=qs[_0x7d36('0x10')](_0xc77855[_0x7d36('0x28')][_0x7d36('0x10')]);}_0x4b2a3e[_0x7d36('0x43')]=qs[_0x7d36('0x44')](_0xc77855['query'][_0x7d36('0x44')]);_0x4b2a3e[_0x7d36('0x26')]=qs[_0x7d36('0x2f')](_[_0x7d36('0x45')](_0xc77855[_0x7d36('0x28')],_0x5af8f1[_0x7d36('0x2f')]));_0x4b2a3e[_0x7d36('0x26')][_0x7d36('0x46')]=_0x4e5394['id'];if(_0xc77855['query'][_0x7d36('0x47')]){_0x4b2a3e[_0x7d36('0x26')]=_[_0x7d36('0x48')](_0x4b2a3e[_0x7d36('0x26')],{'$or':_[_0x7d36('0x1f')](_0x4b2a3e[_0x7d36('0x31')],function(_0x415011){var _0x218802={};_0x218802[_0x415011]={'$like':'%'+_0xc77855[_0x7d36('0x28')][_0x7d36('0x47')]+'%'};return _0x218802;})});}_0x4b2a3e=_[_0x7d36('0x48')]({},_0x4b2a3e,_0xc77855[_0x7d36('0x35')]);return db['UserOpenchannelQueue'][_0x7d36('0x49')](_0x4b2a3e);}})[_0x7d36('0x17')](function(_0x2bb21b){if(_0x2bb21b){return db[_0x7d36('0x4a')][_0x7d36('0x4b')]({'where':{'id':_[_0x7d36('0x1f')](_0x2bb21b,_0x7d36('0x4c')),'role':_0x7d36('0x4d')},'attributes':['id',_0x7d36('0x1d'),'openchannelPause','updatedAt',_0x7d36('0x4e')]});}})['then'](function(_0x3d5fbd){if(_0x3d5fbd){return{'count':_0x3d5fbd['count'],'rows':_['map'](_0x3d5fbd[_0x7d36('0x29')],function(_0x55e2dd){return{'membername':_0x55e2dd['name'],'UserId':_0x55e2dd['id'],'queue_name':_0x542095['name'],'OpenchannelQueueId':_0x542095['id'],'interface':util[_0x7d36('0x4f')](_0x7d36('0x50'),_0x7d36('0x51'),_0x55e2dd[_0x7d36('0x1d')]),'penalty':0x0,'paused':_0x55e2dd[_0x7d36('0x52')],'createdAt':_0x55e2dd['createdAt'],'updatedAt':_0x55e2dd[_0x7d36('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7d36('0x17')](respondWithFilteredResult(_0xdd98fb,_0x4b2a3e))[_0x7d36('0x2a')](handleError(_0xdd98fb,null));};exports[_0x7d36('0x54')]=function(_0x247939,_0x125b6d){var _0x5d4791={};var _0x36c0cc={};var _0x44c8b1;var _0x309410;return db[_0x7d36('0x20')][_0x7d36('0x3f')]({'where':{'id':_0x247939[_0x7d36('0x2c')]['id']}})['then'](handleEntityNotFound(_0x125b6d,null))['then'](function(_0x3c31ad){if(_0x3c31ad){_0x44c8b1=_0x3c31ad;_0x36c0cc[_0x7d36('0x2d')]=_[_0x7d36('0x2e')](db[_0x7d36('0x55')][_0x7d36('0x21')]);_0x36c0cc['query']=_[_0x7d36('0x2e')](_0x247939[_0x7d36('0x28')]);_0x36c0cc[_0x7d36('0x2f')]=_['intersection'](_0x36c0cc['model'],_0x36c0cc['query']);_0x5d4791[_0x7d36('0x31')]=_[_0x7d36('0x30')](_0x36c0cc[_0x7d36('0x2d')],qs[_0x7d36('0x32')](_0x247939[_0x7d36('0x28')][_0x7d36('0x32')]));_0x5d4791[_0x7d36('0x31')]=_0x5d4791['attributes'][_0x7d36('0x33')]?_0x5d4791[_0x7d36('0x31')]:_0x36c0cc[_0x7d36('0x2d')];_0x5d4791[_0x7d36('0x43')]=qs['sort'](_0x247939['query'][_0x7d36('0x44')]);_0x5d4791[_0x7d36('0x26')]=qs[_0x7d36('0x2f')](_[_0x7d36('0x45')](_0x247939['query'],_0x36c0cc[_0x7d36('0x2f')]));if(_0x247939[_0x7d36('0x28')][_0x7d36('0x47')]){_0x5d4791[_0x7d36('0x26')]=_['merge'](_0x5d4791[_0x7d36('0x26')],{'$or':_[_0x7d36('0x1f')](_0x5d4791['attributes'],function(_0x5a7c0a){var _0x51ecf0={};_0x51ecf0[_0x5a7c0a]={'$like':'%'+_0x247939[_0x7d36('0x28')]['filter']+'%'};return _0x51ecf0;})});}_0x5d4791=_[_0x7d36('0x48')]({},_0x5d4791,_0x247939[_0x7d36('0x35')]);return _0x44c8b1[_0x7d36('0x54')](_0x5d4791);}})['then'](function(_0x4cc808){if(_0x4cc808){_0x309410=_0x4cc808[_0x7d36('0x33')];if(!_0x247939['query']['hasOwnProperty']('nolimit')){_0x5d4791[_0x7d36('0x12')]=qs['limit'](_0x247939[_0x7d36('0x28')][_0x7d36('0x12')]);_0x5d4791[_0x7d36('0x10')]=qs[_0x7d36('0x10')](_0x247939[_0x7d36('0x28')][_0x7d36('0x10')]);}return _0x44c8b1[_0x7d36('0x54')](_0x5d4791);}})[_0x7d36('0x17')](function(_0x9ffa03){if(_0x9ffa03){return _0x9ffa03?{'count':_0x309410,'rows':_0x9ffa03}:null;}})[_0x7d36('0x17')](respondWithResult(_0x125b6d,null))[_0x7d36('0x2a')](handleError(_0x125b6d,null));};exports[_0x7d36('0x56')]=function(_0x3d722c,_0x7e5f9){var _0x27aec9=_0x3d722c[_0x7d36('0x3d')][_0x7d36('0x57')];return db['Team'][_0x7d36('0x49')]({'where':{'id':_0x27aec9},'attributes':['id'],'include':[{'model':db[_0x7d36('0x4a')],'as':_0x7d36('0x58'),'attributes':['id',_0x7d36('0x1d'),_0x7d36('0x59'),'voicePause','interface'],'raw':!![]}]})[_0x7d36('0x17')](function(_0x10c521){if(_0x10c521){var _0x55ac97=_[_0x7d36('0x5a')](_0x10c521,function(_0x43758d){var _0xe083c1=_0x43758d[_0x7d36('0x19')]({'plain':!![]});return _0xe083c1[_0x7d36('0x58')];});return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x3d722c[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](function(_0x6a5605){return db[_0x7d36('0x5b')]['transaction'](function(_0x2134e7){return _0x6a5605[_0x7d36('0x56')](_0x27aec9,{'transaction':_0x2134e7})[_0x7d36('0x17')](function(){return BPromise[_0x7d36('0x5c')](_0x55ac97,function(_0xcfe575){return db[_0x7d36('0x40')][_0x7d36('0x5d')]({'where':{'UserId':_0xcfe575['id'],'OpenchannelQueueId':_0x3d722c[_0x7d36('0x2c')]['id']},'transaction':_0x2134e7});});})[_0x7d36('0x17')](function(){_0x55ac97['forEach'](function(_0x5ba2a5){socket[_0x7d36('0x5e')](_0x7d36('0x5f'),{'UserId':_0x5ba2a5['id'],'OpenchannelQueueId':_0x6a5605['id']});});});});});}})[_0x7d36('0x17')](respondWithStatusCode(_0x7e5f9,null))[_0x7d36('0x2a')](handleError(_0x7e5f9,null));};exports[_0x7d36('0x60')]=function(_0xb1153f,_0x4bbbbe){return db[_0x7d36('0x55')][_0x7d36('0x49')]({'where':{'id':_0xb1153f[_0x7d36('0x28')][_0x7d36('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d36('0x58'),'attributes':['id'],'raw':!![]}]})[_0x7d36('0x17')](handleEntityNotFound(_0x4bbbbe,null))[_0x7d36('0x17')](function(_0x1dab45){var _0x451e0b=_[_0x7d36('0x1f')](_0x1dab45,'id');var _0x422009=[];var _0x2fcbfa=[];var _0x4febf1=squel['select']();_0x4febf1['field'](_0x7d36('0x61'))[_0x7d36('0x62')]('team_has_openchannel_queues','tq')['join'](_0x7d36('0x63'),'ut',_0x7d36('0x64'))[_0x7d36('0x26')](_0x7d36('0x65'),_0xb1153f['params']['id']);for(var _0x2cb5ab=0x0;_0x2cb5ab<_0x1dab45[_0x7d36('0x33')];_0x2cb5ab+=0x1){let _0x4ec313=_0x1dab45[_0x2cb5ab];for(var _0x51f106=0x0;_0x51f106<_0x4ec313[_0x7d36('0x58')][_0x7d36('0x33')];_0x51f106+=0x1){let _0x577c8b=_0x4ec313['Agents'][_0x51f106];var _0x328997=_0x4febf1[_0x7d36('0x66')]();_0x328997['where'](_0x7d36('0x67'),_0x577c8b['id']);_0x2fcbfa[_0x7d36('0x68')](db[_0x7d36('0x5b')][_0x7d36('0x28')](_0x328997[_0x7d36('0x69')](),{'type':db[_0x7d36('0x5b')][_0x7d36('0x6a')][_0x7d36('0x6b')]})['then'](function(_0x1fa0e8){if(_0x1fa0e8['length']===0x1){return _0x577c8b['id'];}else{var _0x6b09e7=_['every'](_['map'](_0x1fa0e8,_0x7d36('0x6c')),function(_0x28ee0a){return _[_0x7d36('0x6d')](_0x451e0b,_0x28ee0a);});if(_0x6b09e7){return _0x577c8b['id'];}}}));}}return BPromise[_0x7d36('0x6e')](_0x2fcbfa)[_0x7d36('0x17')](function(_0x1f65c9){_0x422009=_(_0x422009)[_0x7d36('0x6f')](_0x1f65c9)['compact']()['value']();return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0xb1153f[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](function(_0x5e59f3){return db['sequelize']['transaction'](function(_0x31acc3){return _0x5e59f3[_0x7d36('0x60')](_0xb1153f[_0x7d36('0x28')][_0x7d36('0x57')],{'transaction':_0x31acc3})[_0x7d36('0x17')](function(){if(!_[_0x7d36('0x70')](_0x422009)){return _0x5e59f3['removeAgents'](_0x422009,{'transaction':_0x31acc3});}})[_0x7d36('0x17')](function(){_0x422009['forEach'](function(_0x5a9dde){socket[_0x7d36('0x5e')](_0x7d36('0x71'),{'UserId':_0x5a9dde,'OpenchannelQueueId':_0x5e59f3['id']});});});});});});})[_0x7d36('0x17')](respondWithStatusCode(_0x4bbbbe,null))[_0x7d36('0x2a')](handleError(_0x4bbbbe,null));};exports[_0x7d36('0x72')]=function(_0x5bd608,_0x2984b2){return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x5bd608[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x2984b2,null))['then'](function(_0x477a97){if(_0x477a97){return _0x477a97[_0x7d36('0x72')](_0x5bd608[_0x7d36('0x3d')][_0x7d36('0x57')],_[_0x7d36('0x73')](_0x5bd608[_0x7d36('0x3d')],[_0x7d36('0x57'),'id'])||{})[_0x7d36('0x74')](function(_0x24733c){for(var _0x39f3d4=0x0;_0x39f3d4<_0x5bd608[_0x7d36('0x3d')][_0x7d36('0x57')][_0x7d36('0x33')];_0x39f3d4+=0x1){socket[_0x7d36('0x5e')](_0x7d36('0x5f'),{'UserId':Number(_0x5bd608[_0x7d36('0x3d')][_0x7d36('0x57')][_0x39f3d4]),'OpenchannelQueueId':Number(_0x5bd608[_0x7d36('0x2c')]['id'])});}return _0x24733c;});}})[_0x7d36('0x17')](respondWithResult(_0x2984b2,null))[_0x7d36('0x2a')](handleError(_0x2984b2,null));};exports[_0x7d36('0x75')]=function(_0x3ee10e,_0x351994){return db[_0x7d36('0x20')][_0x7d36('0x39')]({'where':{'id':_0x3ee10e[_0x7d36('0x2c')]['id']}})[_0x7d36('0x17')](handleEntityNotFound(_0x351994,null))[_0x7d36('0x17')](function(_0x3c805b){if(_0x3c805b){return _0x3c805b['removeAgents'](_0x3ee10e[_0x7d36('0x28')]['ids'])[_0x7d36('0x17')](function(){if(_[_0x7d36('0x76')](_0x3ee10e[_0x7d36('0x28')][_0x7d36('0x57')])){for(var _0x325d00=0x0;_0x325d00<_0x3ee10e['query'][_0x7d36('0x57')][_0x7d36('0x33')];_0x325d00+=0x1){socket[_0x7d36('0x5e')](_0x7d36('0x71'),{'UserId':Number(_0x3ee10e[_0x7d36('0x28')]['ids'][_0x325d00]),'OpenchannelQueueId':Number(_0x3ee10e[_0x7d36('0x2c')]['id'])});}}else{socket[_0x7d36('0x5e')](_0x7d36('0x71'),{'UserId':Number(_0x3ee10e['query'][_0x7d36('0x57')]),'OpenchannelQueueId':Number(_0x3ee10e[_0x7d36('0x2c')]['id'])});}});}})[_0x7d36('0x17')](respondWithStatusCode(_0x351994,null))[_0x7d36('0x2a')](handleError(_0x351994,null));};exports[_0x7d36('0x77')]=function(_0x5153c8,_0x4dcb90){var _0x1e7089={};var _0x25e31f={};var _0x231e1b;var _0x2c262d;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5153c8['params']['id']}})['then'](handleEntityNotFound(_0x4dcb90,null))[_0x7d36('0x17')](function(_0x3f0709){if(_0x3f0709){_0x231e1b=_0x3f0709;_0x25e31f['model']=_[_0x7d36('0x2e')](db[_0x7d36('0x4a')][_0x7d36('0x21')]);_0x25e31f[_0x7d36('0x28')]=_[_0x7d36('0x2e')](_0x5153c8[_0x7d36('0x28')]);_0x25e31f[_0x7d36('0x2f')]=_[_0x7d36('0x30')](_0x25e31f['model'],_0x25e31f[_0x7d36('0x28')]);_0x1e7089[_0x7d36('0x31')]=_['intersection'](_0x25e31f[_0x7d36('0x2d')],qs[_0x7d36('0x32')](_0x5153c8['query'][_0x7d36('0x32')]));_0x1e7089[_0x7d36('0x31')]=_0x1e7089[_0x7d36('0x31')][_0x7d36('0x33')]?_0x1e7089[_0x7d36('0x31')]:_0x25e31f[_0x7d36('0x2d')];_0x1e7089['order']=qs[_0x7d36('0x44')](_0x5153c8[_0x7d36('0x28')][_0x7d36('0x44')]);_0x1e7089[_0x7d36('0x26')]=qs[_0x7d36('0x2f')](_[_0x7d36('0x45')](_0x5153c8['query'],_0x25e31f[_0x7d36('0x2f')]));if(_0x5153c8[_0x7d36('0x28')]['filter']){_0x1e7089[_0x7d36('0x26')]=_[_0x7d36('0x48')](_0x1e7089[_0x7d36('0x26')],{'$or':_['map'](_0x1e7089[_0x7d36('0x31')],function(_0x5dc2de){var _0xd0624b={};_0xd0624b[_0x5dc2de]={'$like':'%'+_0x5153c8[_0x7d36('0x28')]['filter']+'%'};return _0xd0624b;})});}_0x1e7089=_['merge']({},_0x1e7089,_0x5153c8[_0x7d36('0x35')]);return _0x231e1b[_0x7d36('0x77')](_0x1e7089);}})[_0x7d36('0x17')](function(_0xc2f49f){if(_0xc2f49f){_0x2c262d=_0xc2f49f[_0x7d36('0x33')];if(!_0x5153c8[_0x7d36('0x28')][_0x7d36('0x41')](_0x7d36('0x42'))){_0x1e7089['limit']=qs['limit'](_0x5153c8[_0x7d36('0x28')][_0x7d36('0x12')]);_0x1e7089['offset']=qs[_0x7d36('0x10')](_0x5153c8[_0x7d36('0x28')]['offset']);}return _0x231e1b[_0x7d36('0x77')](_0x1e7089);}})[_0x7d36('0x17')](function(_0x3af795){if(_0x3af795){return _0x3af795?{'count':_0x2c262d,'rows':_0x3af795}:null;}})[_0x7d36('0x17')](respondWithResult(_0x4dcb90,null))['catch'](handleError(_0x4dcb90,null));}; \ No newline at end of file +var _0xbae9=['user','OpenchannelQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','SIP','openchannelPause','findOne','Team','getTeams','ids','Agents','voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','union','value','isEmpty','addAgents','omit','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','bluebird','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','count','limit','set','Content-Range','then','get','UserProfileResource','end','sendStatus','name','map','OpenchannelQueue','fieldName','type','key','getOptions','where','include','query','findAll','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body'];(function(_0x5640ff,_0x398f96){var _0x3e6b92=function(_0x318e50){while(--_0x318e50){_0x5640ff['push'](_0x5640ff['shift']());}};_0x3e6b92(++_0x398f96);}(_0xbae9,0x126));var _0x9bae=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0xbae9[_0x43a37c];return _0x5d1d40;};'use strict';var BPromise=require(_0x9bae('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x9bae('0x1'));var Redis=require(_0x9bae('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x9bae('0x3'))(_0x9bae('0x4'));var config=require(_0x9bae('0x5'));var db=require(_0x9bae('0x6'))['db'];config[_0x9bae('0x7')]=_[_0x9bae('0x8')](config['redis'],{'host':_0x9bae('0x9'),'port':0x18eb});var socket=require(_0x9bae('0xa'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x2ecca2,_0x3a0abd){_0x3a0abd=_0x3a0abd||0xcc;return function(_0x32b1fc){if(_0x32b1fc){return _0x2ecca2['sendStatus'](_0x3a0abd);}return _0x2ecca2[_0x9bae('0xb')](_0x3a0abd)['end']();};}function respondWithResult(_0x87c075,_0x10668f){_0x10668f=_0x10668f||0xc8;return function(_0x54f30f){if(_0x54f30f){return _0x87c075[_0x9bae('0xb')](_0x10668f)[_0x9bae('0xc')](_0x54f30f);}};}function respondWithFilteredResult(_0x2098e9,_0x19ab17){return function(_0x33782a){if(_0x33782a){var _0x1e6914=typeof _0x19ab17[_0x9bae('0xd')]===_0x9bae('0xe')&&typeof _0x19ab17['limit']==='undefined';var _0x43dbdd=_0x33782a[_0x9bae('0xf')];var _0x357df2=_0x1e6914?0x0:_0x19ab17[_0x9bae('0xd')];var _0x529c96=_0x1e6914?_0x33782a[_0x9bae('0xf')]:_0x19ab17[_0x9bae('0xd')]+_0x19ab17[_0x9bae('0x10')];var _0x294422;if(_0x529c96>=_0x43dbdd){_0x529c96=_0x43dbdd;_0x294422=0xc8;}else{_0x294422=0xce;}_0x2098e9[_0x9bae('0xb')](_0x294422);return _0x2098e9[_0x9bae('0x11')](_0x9bae('0x12'),_0x357df2+'-'+_0x529c96+'/'+_0x43dbdd)['json'](_0x33782a);}return null;};}function saveUpdates(_0x3b0b57){return function(_0x4bff52){if(_0x4bff52){return _0x4bff52['update'](_0x3b0b57)[_0x9bae('0x13')](function(_0x36f033){return _0x36f033;});}return null;};}function removeEntity(_0x5760d8){return function(_0x32d367){if(_0x32d367){return _0x32d367['destroy']()[_0x9bae('0x13')](function(){var _0x5d0e0e=_0x32d367[_0x9bae('0x14')]({'plain':!![]});var _0xbc0bdf='OpenchannelQueues';return db[_0x9bae('0x15')]['destroy']({'where':{'type':_0xbc0bdf,'resourceId':_0x5d0e0e['id']}})['then'](function(){return _0x32d367;});})[_0x9bae('0x13')](function(){_0x5760d8[_0x9bae('0xb')](0xcc)[_0x9bae('0x16')]();});}};}function handleEntityNotFound(_0x271efc){return function(_0x2ea851){if(!_0x2ea851){_0x271efc[_0x9bae('0x17')](0x194);}return _0x2ea851;};}function handleError(_0x5efd2d,_0x3c5ffc){_0x3c5ffc=_0x3c5ffc||0x1f4;return function(_0x2faec2){logger['error'](_0x2faec2['stack']);if(_0x2faec2[_0x9bae('0x18')]){delete _0x2faec2['name'];}_0x5efd2d[_0x9bae('0xb')](_0x3c5ffc)['send'](_0x2faec2);};}exports['index']=function(_0x588b55,_0xc188be){var _0x25a153={};var _0xe0d336={'count':0x0,'rows':[]};var _0x5c103d=_[_0x9bae('0x19')](db[_0x9bae('0x1a')]['rawAttributes'],function(_0x1c4d9c){return{'name':_0x1c4d9c[_0x9bae('0x1b')],'type':_0x1c4d9c[_0x9bae('0x1c')][_0x9bae('0x1d')]};});_0x25a153=qs[_0x9bae('0x1e')](_0x5c103d,_0x588b55);var _0x3f6dd5={'where':_0x25a153[_0x9bae('0x1f')]};return db['OpenchannelQueue'][_0x9bae('0xf')](_0x3f6dd5)[_0x9bae('0x13')](function(_0x21d424){_0xe0d336[_0x9bae('0xf')]=_0x21d424;_0x25a153[_0x9bae('0x20')]=qs[_0x9bae('0x20')](_0x588b55[_0x9bae('0x21')]);return db[_0x9bae('0x1a')][_0x9bae('0x22')](_0x25a153);})[_0x9bae('0x13')](function(_0x26c707){_0xe0d336['rows']=_0x26c707;return _0xe0d336;})[_0x9bae('0x13')](respondWithFilteredResult(_0xc188be,_0x25a153))['catch'](handleError(_0xc188be,null));};exports['show']=function(_0x2f0188,_0x387d93){var _0x53473b={'raw':!![],'where':{'id':_0x2f0188[_0x9bae('0x23')]['id']}},_0x413383={};_0x413383[_0x9bae('0x24')]=_[_0x9bae('0x25')](db[_0x9bae('0x1a')][_0x9bae('0x26')]);_0x413383['query']=_[_0x9bae('0x25')](_0x2f0188[_0x9bae('0x21')]);_0x413383[_0x9bae('0x27')]=_[_0x9bae('0x28')](_0x413383[_0x9bae('0x24')],_0x413383[_0x9bae('0x21')]);_0x53473b[_0x9bae('0x29')]=_[_0x9bae('0x28')](_0x413383[_0x9bae('0x24')],qs[_0x9bae('0x2a')](_0x2f0188[_0x9bae('0x21')]['fields']));_0x53473b[_0x9bae('0x29')]=_0x53473b[_0x9bae('0x29')][_0x9bae('0x2b')]?_0x53473b['attributes']:_0x413383[_0x9bae('0x24')];if(_0x2f0188[_0x9bae('0x21')][_0x9bae('0x2c')]){_0x53473b[_0x9bae('0x20')]=[{'all':!![]}];}_0x53473b=_[_0x9bae('0x2d')]({},_0x53473b,_0x2f0188[_0x9bae('0x2e')]);return db[_0x9bae('0x1a')][_0x9bae('0x2f')](_0x53473b)['then'](handleEntityNotFound(_0x387d93,null))[_0x9bae('0x13')](respondWithResult(_0x387d93,null))[_0x9bae('0x30')](handleError(_0x387d93,null));};exports[_0x9bae('0x31')]=function(_0x7ec66e,_0x1ee29c){return db[_0x9bae('0x1a')][_0x9bae('0x31')](_0x7ec66e[_0x9bae('0x32')],{})[_0x9bae('0x13')](function(_0x2785cf){var _0x164f2b=_0x7ec66e[_0x9bae('0x33')][_0x9bae('0x14')]({'plain':!![]});if(!_0x164f2b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x164f2b['role']===_0x9bae('0x33')){var _0x504f10=_0x2785cf[_0x9bae('0x14')]({'plain':!![]});var _0x292ebb=_0x9bae('0x34');return db['UserProfileSection'][_0x9bae('0x2f')]({'where':{'name':_0x292ebb,'userProfileId':_0x164f2b[_0x9bae('0x35')]},'raw':!![]})['then'](function(_0x58fa98){if(_0x58fa98&&_0x58fa98[_0x9bae('0x36')]===0x0){return db[_0x9bae('0x15')][_0x9bae('0x31')]({'name':_0x504f10[_0x9bae('0x18')],'resourceId':_0x504f10['id'],'type':_0x58fa98[_0x9bae('0x18')],'sectionId':_0x58fa98['id']},{})[_0x9bae('0x13')](function(){return _0x2785cf;});}else{return _0x2785cf;}})[_0x9bae('0x30')](function(_0x3c6552){logger[_0x9bae('0x37')](_0x9bae('0x38'),_0x3c6552);throw _0x3c6552;});}return _0x2785cf;})[_0x9bae('0x13')](respondWithResult(_0x1ee29c,0xc9))['catch'](handleError(_0x1ee29c,null));};exports[_0x9bae('0x39')]=function(_0x56a5fb,_0x3f5a41){if(_0x56a5fb[_0x9bae('0x32')]['id']){delete _0x56a5fb[_0x9bae('0x32')]['id'];}return db['OpenchannelQueue'][_0x9bae('0x2f')]({'where':{'id':_0x56a5fb['params']['id']}})[_0x9bae('0x13')](handleEntityNotFound(_0x3f5a41,null))[_0x9bae('0x13')](saveUpdates(_0x56a5fb[_0x9bae('0x32')],null))[_0x9bae('0x13')](respondWithResult(_0x3f5a41,null))[_0x9bae('0x30')](handleError(_0x3f5a41,null));};exports[_0x9bae('0x3a')]=function(_0xd61bff,_0x34b1eb){return db[_0x9bae('0x1a')][_0x9bae('0x2f')]({'where':{'id':_0xd61bff[_0x9bae('0x23')]['id']}})[_0x9bae('0x13')](handleEntityNotFound(_0x34b1eb,null))[_0x9bae('0x13')](removeEntity(_0x34b1eb,null))[_0x9bae('0x30')](handleError(_0x34b1eb,null));};exports['describe']=function(_0x2f3a17,_0xbd2bfc){return db[_0x9bae('0x1a')][_0x9bae('0x3b')]()['then'](respondWithResult(_0xbd2bfc,null))[_0x9bae('0x30')](handleError(_0xbd2bfc,null));};exports[_0x9bae('0x3c')]=function(_0x2776a1,_0x56ea70){var _0x495d9f={'raw':!![],'where':{}},_0x289c1d={},_0x43b672;return db[_0x9bae('0x1a')]['findOne']({'where':{'id':_0x2776a1['params']['id']}})['then'](handleEntityNotFound(_0x56ea70,null))['then'](function(_0x4a7525){if(_0x4a7525){_0x43b672=_0x4a7525['get']({'plain':!![]});_0x289c1d[_0x9bae('0x24')]=_[_0x9bae('0x25')](db['UserOpenchannelQueue'][_0x9bae('0x26')]);_0x289c1d[_0x9bae('0x21')]=_[_0x9bae('0x25')](_0x2776a1[_0x9bae('0x21')]);_0x289c1d[_0x9bae('0x27')]=_[_0x9bae('0x28')](_0x289c1d['model'],_0x289c1d[_0x9bae('0x21')]);_0x495d9f[_0x9bae('0x29')]=_['intersection'](_0x289c1d[_0x9bae('0x24')],qs['fields'](_0x2776a1[_0x9bae('0x21')][_0x9bae('0x2a')]));_0x495d9f[_0x9bae('0x29')]=_0x495d9f[_0x9bae('0x29')][_0x9bae('0x2b')]?_0x495d9f['attributes']:_0x289c1d[_0x9bae('0x24')];if(!_0x2776a1[_0x9bae('0x21')][_0x9bae('0x3d')](_0x9bae('0x3e'))){_0x495d9f[_0x9bae('0x10')]=qs['limit'](_0x2776a1['query'][_0x9bae('0x10')]);_0x495d9f['offset']=qs[_0x9bae('0xd')](_0x2776a1[_0x9bae('0x21')][_0x9bae('0xd')]);}_0x495d9f[_0x9bae('0x3f')]=qs[_0x9bae('0x40')](_0x2776a1[_0x9bae('0x21')][_0x9bae('0x40')]);_0x495d9f[_0x9bae('0x1f')]=qs['filters'](_[_0x9bae('0x41')](_0x2776a1[_0x9bae('0x21')],_0x289c1d[_0x9bae('0x27')]));_0x495d9f[_0x9bae('0x1f')][_0x9bae('0x42')]=_0x4a7525['id'];if(_0x2776a1[_0x9bae('0x21')]['filter']){_0x495d9f[_0x9bae('0x1f')]=_[_0x9bae('0x2d')](_0x495d9f[_0x9bae('0x1f')],{'$or':_[_0x9bae('0x19')](_0x495d9f['attributes'],function(_0x117733){var _0x5192a4={};_0x5192a4[_0x117733]={'$like':'%'+_0x2776a1[_0x9bae('0x21')][_0x9bae('0x43')]+'%'};return _0x5192a4;})});}_0x495d9f=_['merge']({},_0x495d9f,_0x2776a1[_0x9bae('0x2e')]);return db[_0x9bae('0x44')][_0x9bae('0x22')](_0x495d9f);}})[_0x9bae('0x13')](function(_0x701bcf){if(_0x701bcf){return db[_0x9bae('0x45')][_0x9bae('0x46')]({'where':{'id':_[_0x9bae('0x19')](_0x701bcf,_0x9bae('0x47')),'role':'agent'},'attributes':['id',_0x9bae('0x18'),'openchannelPause',_0x9bae('0x48'),_0x9bae('0x49')]});}})[_0x9bae('0x13')](function(_0x2ec734){if(_0x2ec734){return{'count':_0x2ec734[_0x9bae('0xf')],'rows':_['map'](_0x2ec734['rows'],function(_0x1e756e){return{'membername':_0x1e756e[_0x9bae('0x18')],'UserId':_0x1e756e['id'],'queue_name':_0x43b672[_0x9bae('0x18')],'OpenchannelQueueId':_0x43b672['id'],'interface':util[_0x9bae('0x4a')]('%s/%s',_0x9bae('0x4b'),_0x1e756e['name']),'penalty':0x0,'paused':_0x1e756e[_0x9bae('0x4c')],'createdAt':_0x1e756e[_0x9bae('0x49')],'updatedAt':_0x1e756e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9bae('0x13')](respondWithFilteredResult(_0x56ea70,_0x495d9f))[_0x9bae('0x30')](handleError(_0x56ea70,null));};exports['getTeams']=function(_0x402f94,_0x1a7f76){var _0x731c2={};var _0x35b6f8={};var _0x4583b8;var _0x14a10a;return db['OpenchannelQueue'][_0x9bae('0x4d')]({'where':{'id':_0x402f94[_0x9bae('0x23')]['id']}})[_0x9bae('0x13')](handleEntityNotFound(_0x1a7f76,null))[_0x9bae('0x13')](function(_0x4fb977){if(_0x4fb977){_0x4583b8=_0x4fb977;_0x35b6f8[_0x9bae('0x24')]=_[_0x9bae('0x25')](db[_0x9bae('0x4e')][_0x9bae('0x26')]);_0x35b6f8[_0x9bae('0x21')]=_[_0x9bae('0x25')](_0x402f94[_0x9bae('0x21')]);_0x35b6f8[_0x9bae('0x27')]=_[_0x9bae('0x28')](_0x35b6f8[_0x9bae('0x24')],_0x35b6f8[_0x9bae('0x21')]);_0x731c2['attributes']=_[_0x9bae('0x28')](_0x35b6f8[_0x9bae('0x24')],qs['fields'](_0x402f94[_0x9bae('0x21')]['fields']));_0x731c2[_0x9bae('0x29')]=_0x731c2['attributes'][_0x9bae('0x2b')]?_0x731c2[_0x9bae('0x29')]:_0x35b6f8['model'];_0x731c2[_0x9bae('0x3f')]=qs[_0x9bae('0x40')](_0x402f94[_0x9bae('0x21')][_0x9bae('0x40')]);_0x731c2['where']=qs[_0x9bae('0x27')](_[_0x9bae('0x41')](_0x402f94[_0x9bae('0x21')],_0x35b6f8[_0x9bae('0x27')]));if(_0x402f94[_0x9bae('0x21')][_0x9bae('0x43')]){_0x731c2[_0x9bae('0x1f')]=_[_0x9bae('0x2d')](_0x731c2[_0x9bae('0x1f')],{'$or':_[_0x9bae('0x19')](_0x731c2[_0x9bae('0x29')],function(_0x136316){var _0x15a4bd={};_0x15a4bd[_0x136316]={'$like':'%'+_0x402f94[_0x9bae('0x21')]['filter']+'%'};return _0x15a4bd;})});}_0x731c2=_['merge']({},_0x731c2,_0x402f94[_0x9bae('0x2e')]);return _0x4583b8[_0x9bae('0x4f')](_0x731c2);}})[_0x9bae('0x13')](function(_0xabc41c){if(_0xabc41c){_0x14a10a=_0xabc41c[_0x9bae('0x2b')];if(!_0x402f94['query'][_0x9bae('0x3d')](_0x9bae('0x3e'))){_0x731c2[_0x9bae('0x10')]=qs['limit'](_0x402f94[_0x9bae('0x21')][_0x9bae('0x10')]);_0x731c2['offset']=qs[_0x9bae('0xd')](_0x402f94[_0x9bae('0x21')][_0x9bae('0xd')]);}return _0x4583b8['getTeams'](_0x731c2);}})['then'](function(_0x14d221){if(_0x14d221){return _0x14d221?{'count':_0x14a10a,'rows':_0x14d221}:null;}})[_0x9bae('0x13')](respondWithResult(_0x1a7f76,null))[_0x9bae('0x30')](handleError(_0x1a7f76,null));};exports['addTeams']=function(_0x4c40b7,_0x36f96e){var _0x4b2924=_0x4c40b7['body'][_0x9bae('0x50')];return db[_0x9bae('0x4e')][_0x9bae('0x22')]({'where':{'id':_0x4b2924},'attributes':['id'],'include':[{'model':db[_0x9bae('0x45')],'as':_0x9bae('0x51'),'attributes':['id',_0x9bae('0x18'),'online',_0x9bae('0x52'),_0x9bae('0x53')],'raw':!![]}]})[_0x9bae('0x13')](function(_0x352c4e){if(_0x352c4e){var _0x4bf19d=_[_0x9bae('0x54')](_0x352c4e,function(_0x55ac7e){var _0x5d43d4=_0x55ac7e[_0x9bae('0x14')]({'plain':!![]});return _0x5d43d4[_0x9bae('0x51')];});return db[_0x9bae('0x1a')][_0x9bae('0x2f')]({'where':{'id':_0x4c40b7[_0x9bae('0x23')]['id']}})[_0x9bae('0x13')](function(_0x44a04d){return db['sequelize'][_0x9bae('0x55')](function(_0x11cdb6){return _0x44a04d[_0x9bae('0x56')](_0x4b2924,{'transaction':_0x11cdb6})['then'](function(){return BPromise['each'](_0x4bf19d,function(_0xf9b71){return db[_0x9bae('0x44')][_0x9bae('0x57')]({'where':{'UserId':_0xf9b71['id'],'OpenchannelQueueId':_0x4c40b7[_0x9bae('0x23')]['id']},'transaction':_0x11cdb6});});})[_0x9bae('0x13')](function(){_0x4bf19d[_0x9bae('0x58')](function(_0x4aeffd){socket[_0x9bae('0x59')](_0x9bae('0x5a'),{'UserId':_0x4aeffd['id'],'OpenchannelQueueId':_0x44a04d['id']});});});});});}})[_0x9bae('0x13')](respondWithStatusCode(_0x36f96e,null))['catch'](handleError(_0x36f96e,null));};exports[_0x9bae('0x5b')]=function(_0x51d621,_0x3ee9bf){return db['Team'][_0x9bae('0x22')]({'where':{'id':_0x51d621[_0x9bae('0x21')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9bae('0x45')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9bae('0x13')](handleEntityNotFound(_0x3ee9bf,null))[_0x9bae('0x13')](function(_0x4948d2){var _0x3afeb4=_['map'](_0x4948d2,'id');var _0x36a687=[];var _0x305de3=[];var _0x5e24e0=squel[_0x9bae('0x5c')]();_0x5e24e0[_0x9bae('0x5d')]('tq.TeamId')['from'](_0x9bae('0x5e'),'tq')['join'](_0x9bae('0x5f'),'ut',_0x9bae('0x60'))['where'](_0x9bae('0x61'),_0x51d621[_0x9bae('0x23')]['id']);for(var _0x504369=0x0;_0x504369<_0x4948d2['length'];_0x504369+=0x1){let _0x32aa95=_0x4948d2[_0x504369];for(var _0x32dfa1=0x0;_0x32dfa1<_0x32aa95['Agents'][_0x9bae('0x2b')];_0x32dfa1+=0x1){let _0x58b2=_0x32aa95[_0x9bae('0x51')][_0x32dfa1];var _0x29d5ff=_0x5e24e0[_0x9bae('0x62')]();_0x29d5ff[_0x9bae('0x1f')](_0x9bae('0x63'),_0x58b2['id']);_0x305de3['push'](db[_0x9bae('0x64')][_0x9bae('0x21')](_0x29d5ff[_0x9bae('0x65')](),{'type':db[_0x9bae('0x64')]['QueryTypes'][_0x9bae('0x66')]})[_0x9bae('0x13')](function(_0x90903){if(_0x90903[_0x9bae('0x2b')]===0x1){return _0x58b2['id'];}else{var _0x2d0912=_[_0x9bae('0x67')](_['map'](_0x90903,_0x9bae('0x68')),function(_0x4df4d6){return _[_0x9bae('0x69')](_0x3afeb4,_0x4df4d6);});if(_0x2d0912){return _0x58b2['id'];}}}));}}return BPromise['all'](_0x305de3)[_0x9bae('0x13')](function(_0x46c49f){_0x36a687=_(_0x36a687)[_0x9bae('0x6a')](_0x46c49f)['compact']()[_0x9bae('0x6b')]();return db[_0x9bae('0x1a')][_0x9bae('0x2f')]({'where':{'id':_0x51d621[_0x9bae('0x23')]['id']}})[_0x9bae('0x13')](function(_0x4a9b79){return db[_0x9bae('0x64')][_0x9bae('0x55')](function(_0x177ac2){return _0x4a9b79[_0x9bae('0x5b')](_0x51d621[_0x9bae('0x21')]['ids'],{'transaction':_0x177ac2})['then'](function(){if(!_[_0x9bae('0x6c')](_0x36a687)){return _0x4a9b79['removeAgents'](_0x36a687,{'transaction':_0x177ac2});}})[_0x9bae('0x13')](function(){_0x36a687['forEach'](function(_0x2f2e7c){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x2f2e7c,'OpenchannelQueueId':_0x4a9b79['id']});});});});});});})[_0x9bae('0x13')](respondWithStatusCode(_0x3ee9bf,null))[_0x9bae('0x30')](handleError(_0x3ee9bf,null));};exports[_0x9bae('0x6d')]=function(_0x2ce0ff,_0x16c65c){return db[_0x9bae('0x1a')][_0x9bae('0x2f')]({'where':{'id':_0x2ce0ff[_0x9bae('0x23')]['id']}})[_0x9bae('0x13')](handleEntityNotFound(_0x16c65c,null))[_0x9bae('0x13')](function(_0x1485db){if(_0x1485db){return _0x1485db[_0x9bae('0x6d')](_0x2ce0ff[_0x9bae('0x32')][_0x9bae('0x50')],_[_0x9bae('0x6e')](_0x2ce0ff[_0x9bae('0x32')],[_0x9bae('0x50'),'id'])||{})['spread'](function(_0x2fe4c6){for(var _0x4f9e0a=0x0;_0x4f9e0a<_0x2ce0ff['body']['ids'][_0x9bae('0x2b')];_0x4f9e0a+=0x1){socket['emit'](_0x9bae('0x5a'),{'UserId':Number(_0x2ce0ff['body'][_0x9bae('0x50')][_0x4f9e0a]),'OpenchannelQueueId':Number(_0x2ce0ff[_0x9bae('0x23')]['id'])});}return _0x2fe4c6;});}})['then'](respondWithResult(_0x16c65c,null))[_0x9bae('0x30')](handleError(_0x16c65c,null));};exports[_0x9bae('0x6f')]=function(_0xb6b82,_0x4cfc15){return db[_0x9bae('0x1a')][_0x9bae('0x2f')]({'where':{'id':_0xb6b82[_0x9bae('0x23')]['id']}})[_0x9bae('0x13')](handleEntityNotFound(_0x4cfc15,null))['then'](function(_0x387cbf){if(_0x387cbf){return _0x387cbf[_0x9bae('0x6f')](_0xb6b82['query']['ids'])[_0x9bae('0x13')](function(){if(_[_0x9bae('0x70')](_0xb6b82[_0x9bae('0x21')][_0x9bae('0x50')])){for(var _0x89f4db=0x0;_0x89f4db<_0xb6b82[_0x9bae('0x21')][_0x9bae('0x50')][_0x9bae('0x2b')];_0x89f4db+=0x1){socket[_0x9bae('0x59')](_0x9bae('0x71'),{'UserId':Number(_0xb6b82[_0x9bae('0x21')][_0x9bae('0x50')][_0x89f4db]),'OpenchannelQueueId':Number(_0xb6b82[_0x9bae('0x23')]['id'])});}}else{socket[_0x9bae('0x59')](_0x9bae('0x71'),{'UserId':Number(_0xb6b82[_0x9bae('0x21')][_0x9bae('0x50')]),'OpenchannelQueueId':Number(_0xb6b82['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4cfc15,null))[_0x9bae('0x30')](handleError(_0x4cfc15,null));};exports['getAgents']=function(_0x5d356,_0x20c322){var _0x20d88b={};var _0x1d5ec5={};var _0x5992c0;var _0x5d9d32;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5d356[_0x9bae('0x23')]['id']}})[_0x9bae('0x13')](handleEntityNotFound(_0x20c322,null))['then'](function(_0x75b1d6){if(_0x75b1d6){_0x5992c0=_0x75b1d6;_0x1d5ec5[_0x9bae('0x24')]=_[_0x9bae('0x25')](db['User'][_0x9bae('0x26')]);_0x1d5ec5[_0x9bae('0x21')]=_[_0x9bae('0x25')](_0x5d356[_0x9bae('0x21')]);_0x1d5ec5[_0x9bae('0x27')]=_[_0x9bae('0x28')](_0x1d5ec5[_0x9bae('0x24')],_0x1d5ec5['query']);_0x20d88b[_0x9bae('0x29')]=_[_0x9bae('0x28')](_0x1d5ec5['model'],qs[_0x9bae('0x2a')](_0x5d356[_0x9bae('0x21')][_0x9bae('0x2a')]));_0x20d88b[_0x9bae('0x29')]=_0x20d88b['attributes']['length']?_0x20d88b[_0x9bae('0x29')]:_0x1d5ec5[_0x9bae('0x24')];_0x20d88b[_0x9bae('0x3f')]=qs['sort'](_0x5d356[_0x9bae('0x21')][_0x9bae('0x40')]);_0x20d88b[_0x9bae('0x1f')]=qs['filters'](_[_0x9bae('0x41')](_0x5d356[_0x9bae('0x21')],_0x1d5ec5['filters']));if(_0x5d356[_0x9bae('0x21')]['filter']){_0x20d88b[_0x9bae('0x1f')]=_[_0x9bae('0x2d')](_0x20d88b[_0x9bae('0x1f')],{'$or':_[_0x9bae('0x19')](_0x20d88b[_0x9bae('0x29')],function(_0xd79411){var _0x5362e6={};_0x5362e6[_0xd79411]={'$like':'%'+_0x5d356[_0x9bae('0x21')][_0x9bae('0x43')]+'%'};return _0x5362e6;})});}_0x20d88b=_[_0x9bae('0x2d')]({},_0x20d88b,_0x5d356[_0x9bae('0x2e')]);return _0x5992c0[_0x9bae('0x72')](_0x20d88b);}})['then'](function(_0x51db0f){if(_0x51db0f){_0x5d9d32=_0x51db0f['length'];if(!_0x5d356['query']['hasOwnProperty'](_0x9bae('0x3e'))){_0x20d88b[_0x9bae('0x10')]=qs[_0x9bae('0x10')](_0x5d356[_0x9bae('0x21')]['limit']);_0x20d88b[_0x9bae('0xd')]=qs[_0x9bae('0xd')](_0x5d356[_0x9bae('0x21')]['offset']);}return _0x5992c0[_0x9bae('0x72')](_0x20d88b);}})['then'](function(_0x1251b3){if(_0x1251b3){return _0x1251b3?{'count':_0x5d9d32,'rows':_0x1251b3}:null;}})['then'](respondWithResult(_0x20c322,null))['catch'](handleError(_0x20c322,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index cb412f0..b65fd3e 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 _0xd1a5=['hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xd1a5,0xf4));var _0x5d1a=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xd1a5[_0x26462c];return _0x509a42;};'use strict';var EventEmitter=require(_0x5d1a('0x0'));var OpenchannelQueue=require(_0x5d1a('0x1'))['db'][_0x5d1a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5d1a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d1a('0x4'),'afterDestroy':_0x5d1a('0x5')};function emitEvent(_0x447665){return function(_0x1b9ae9,_0x5252ef,_0x31850f){OpenchannelQueueEvents['emit'](_0x447665+':'+_0x1b9ae9['id'],_0x1b9ae9);OpenchannelQueueEvents[_0x5d1a('0x6')](_0x447665,_0x1b9ae9);_0x31850f(null);};}for(var e in events){if(events[_0x5d1a('0x7')](e)){var event=events[e];OpenchannelQueue[_0x5d1a('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xe88b=['events','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x55d679,_0x1af0ea){var _0x3819f4=function(_0x56f3f5){while(--_0x56f3f5){_0x55d679['push'](_0x55d679['shift']());}};_0x3819f4(++_0x1af0ea);}(_0xe88b,0xb4));var _0xbe88=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xe88b[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0xbe88('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xbe88('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xbe88('0x2')](0x0);var events={'afterCreate':_0xbe88('0x3'),'afterUpdate':'update','afterDestroy':_0xbe88('0x4')};function emitEvent(_0x38c6fe){return function(_0x414abc,_0x3ba287,_0x1d44df){OpenchannelQueueEvents[_0xbe88('0x5')](_0x38c6fe+':'+_0x414abc['id'],_0x414abc);OpenchannelQueueEvents[_0xbe88('0x5')](_0x38c6fe,_0x414abc);_0x1d44df(null);};}for(var e in events){if(events[_0xbe88('0x6')](e)){var event=events[e];OpenchannelQueue[_0xbe88('0x7')](e,emitEvent(event));}}module[_0xbe88('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9f2f1d5..0f2cf18 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 _0x546d=['define','openchannel_queues','lodash','../../config/logger','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x7d26e5,_0x30970a){var _0x4cf5d7=function(_0x28854b){while(--_0x28854b){_0x7d26e5['push'](_0x7d26e5['shift']());}};_0x4cf5d7(++_0x30970a);}(_0x546d,0xda));var _0xd546=function(_0x166b8e,_0xd78e16){_0x166b8e=_0x166b8e-0x0;var _0x4fc88f=_0x546d[_0x166b8e];return _0x4fc88f;};'use strict';var _=require(_0xd546('0x0'));var util=require('util');var logger=require(_0xd546('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd546('0x2'));var fs=require('fs');var path=require(_0xd546('0x3'));var rimraf=require('rimraf');var config=require(_0xd546('0x4'));var attributes=require(_0xd546('0x5'));module[_0xd546('0x6')]=function(_0x456c52,_0x2f372f){return _0x456c52[_0xd546('0x7')]('OpenchannelQueue',attributes,{'tableName':_0xd546('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a3=['define','OpenchannelQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes'];(function(_0x1bbb96,_0x4f0143){var _0x189a68=function(_0x4a8b3b){while(--_0x4a8b3b){_0x1bbb96['push'](_0x1bbb96['shift']());}};_0x189a68(++_0x4f0143);}(_0x68a3,0xa7));var _0x368a=function(_0x13c13b,_0x481c0e){_0x13c13b=_0x13c13b-0x0;var _0x4fb356=_0x68a3[_0x13c13b];return _0x4fb356;};'use strict';var _=require(_0x368a('0x0'));var util=require('util');var logger=require(_0x368a('0x1'))(_0x368a('0x2'));var moment=require(_0x368a('0x3'));var BPromise=require(_0x368a('0x4'));var rp=require(_0x368a('0x5'));var fs=require('fs');var path=require(_0x368a('0x6'));var rimraf=require(_0x368a('0x7'));var config=require('../../config/environment');var attributes=require(_0x368a('0x8'));module['exports']=function(_0x5dfc79,_0x129ae4){return _0x5dfc79[_0x368a('0x9')](_0x368a('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 173673d..542826b 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 _0xdeec=['OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','ShowOpenchannelQueue','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdeec,0xd7));var _0xcdee=function(_0x5a7c7d,_0x1628e9){_0x5a7c7d=_0x5a7c7d-0x0;var _0x11461f=_0xdeec[_0x5a7c7d];return _0x11461f;};'use strict';var _=require(_0xcdee('0x0'));var util=require(_0xcdee('0x1'));var moment=require(_0xcdee('0x2'));var BPromise=require(_0xcdee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdee('0x4'));var db=require(_0xcdee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdee('0x6'))(_0xcdee('0x7'));var config=require('../../config/environment');var jayson=require(_0xcdee('0x8'));var client=jayson[_0xcdee('0x9')][_0xcdee('0xa')]({'port':0x232a});config[_0xcdee('0xb')]=_[_0xcdee('0xc')](config[_0xcdee('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdee('0xd'))(new Redis(config[_0xcdee('0xb')]));require(_0xcdee('0xe'))[_0xcdee('0xf')](socket);function respondWithRpcPromise(_0x34861d,_0xde3bc9,_0x4e8159){return new BPromise(function(_0x4bc767,_0x3f00b3){return client[_0xcdee('0x10')](_0x34861d,_0x4e8159)[_0xcdee('0x11')](function(_0xa2407c){logger[_0xcdee('0x12')](_0xcdee('0x13'),_0xde3bc9,_0xcdee('0x14'));logger[_0xcdee('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xde3bc9,_0xcdee('0x14'),JSON[_0xcdee('0x16')](_0xa2407c));if(_0xa2407c['error']){if(_0xa2407c['error'][_0xcdee('0x17')]===0x1f4){logger[_0xcdee('0x18')](_0xcdee('0x13'),_0xde3bc9,_0xa2407c[_0xcdee('0x18')]['message']);return _0x3f00b3(_0xa2407c[_0xcdee('0x18')][_0xcdee('0x19')]);}logger['error'](_0xcdee('0x13'),_0xde3bc9,_0xa2407c['error'][_0xcdee('0x19')]);return _0x4bc767(_0xa2407c[_0xcdee('0x18')][_0xcdee('0x19')]);}else{logger[_0xcdee('0x12')](_0xcdee('0x13'),_0xde3bc9,_0xcdee('0x14'));_0x4bc767(_0xa2407c[_0xcdee('0x1a')][_0xcdee('0x19')]);}})[_0xcdee('0x1b')](function(_0x3203e8){logger[_0xcdee('0x18')](_0xcdee('0x13'),_0xde3bc9,_0x3203e8);_0x3f00b3(_0x3203e8);});});}exports[_0xcdee('0x1c')]=function(_0x59b663){var _0x5de563=this;return new Promise(function(_0x5cedbe,_0x47dea2){return db[_0xcdee('0x1d')][_0xcdee('0x1e')]({'raw':_0x59b663[_0xcdee('0x1f')]?_0x59b663['options'][_0xcdee('0x20')]===undefined?!![]:![]:!![],'where':_0x59b663['options']?_0x59b663[_0xcdee('0x1f')]['where']||null:null,'attributes':_0x59b663['options']?_0x59b663[_0xcdee('0x1f')][_0xcdee('0x21')]||null:null,'limit':_0x59b663[_0xcdee('0x1f')]?_0x59b663['options']['limit']||null:null,'include':_0x59b663[_0xcdee('0x1f')]?_0x59b663[_0xcdee('0x1f')][_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x59b663['options']['include'],function(_0x432251){return{'model':db[_0x432251[_0xcdee('0x24')]],'as':_0x432251['as'],'attributes':_0x432251[_0xcdee('0x21')],'include':_0x432251[_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x432251[_0xcdee('0x22')],function(_0x4f1da2){return{'model':db[_0x4f1da2[_0xcdee('0x24')]],'as':_0x4f1da2['as'],'attributes':_0x4f1da2[_0xcdee('0x21')],'include':_0x4f1da2[_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x4f1da2[_0xcdee('0x22')],function(_0xb0984b){return{'model':db[_0xb0984b[_0xcdee('0x24')]],'as':_0xb0984b['as'],'attributes':_0xb0984b[_0xcdee('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcdee('0x11')](function(_0x49f6c0){logger[_0xcdee('0x12')](_0xcdee('0x1c'),_0x59b663);logger[_0xcdee('0x15')](_0xcdee('0x1c'),_0x59b663,JSON[_0xcdee('0x16')](_0x49f6c0));_0x5cedbe(_0x49f6c0);})[_0xcdee('0x1b')](function(_0x5becbb){logger[_0xcdee('0x18')](_0xcdee('0x1c'),_0x5becbb['message'],_0x59b663);_0x47dea2(_0x5de563[_0xcdee('0x18')](0x1f4,_0x5becbb[_0xcdee('0x19')]));});});};exports[_0xcdee('0x25')]=function(_0x22072b){var _0x789443=this;return new Promise(function(_0x4a9390,_0x542796){return db['OpenchannelQueue']['find']({'raw':_0x22072b[_0xcdee('0x1f')]?_0x22072b[_0xcdee('0x1f')][_0xcdee('0x20')]===undefined?!![]:![]:!![],'where':_0x22072b[_0xcdee('0x1f')]?_0x22072b[_0xcdee('0x1f')][_0xcdee('0x26')]||null:null,'attributes':_0x22072b[_0xcdee('0x1f')]?_0x22072b[_0xcdee('0x1f')][_0xcdee('0x21')]||null:null,'include':_0x22072b['options']?_0x22072b['options'][_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x22072b[_0xcdee('0x1f')]['include'],function(_0x553b9e){return{'model':db[_0x553b9e[_0xcdee('0x24')]],'as':_0x553b9e['as'],'attributes':_0x553b9e['attributes'],'include':_0x553b9e[_0xcdee('0x22')]?_[_0xcdee('0x23')](_0x553b9e[_0xcdee('0x22')],function(_0x320dfb){return{'model':db[_0x320dfb[_0xcdee('0x24')]],'as':_0x320dfb['as'],'attributes':_0x320dfb['attributes'],'include':_0x320dfb[_0xcdee('0x22')]?_['map'](_0x320dfb[_0xcdee('0x22')],function(_0x529937){return{'model':db[_0x529937['model']],'as':_0x529937['as'],'attributes':_0x529937[_0xcdee('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e0c32){logger[_0xcdee('0x12')](_0xcdee('0x25'),_0x22072b);logger[_0xcdee('0x15')](_0xcdee('0x25'),_0x22072b,JSON[_0xcdee('0x16')](_0x1e0c32));_0x4a9390(_0x1e0c32);})[_0xcdee('0x1b')](function(_0x515428){logger[_0xcdee('0x18')](_0xcdee('0x25'),_0x515428[_0xcdee('0x19')],_0x22072b);_0x542796(_0x789443[_0xcdee('0x18')](0x1f4,_0x515428[_0xcdee('0x19')]));});});}; \ No newline at end of file +var _0x914e=['http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2d248c,_0x42a3df){var _0xf3820=function(_0x229f26){while(--_0x229f26){_0x2d248c['push'](_0x2d248c['shift']());}};_0xf3820(++_0x42a3df);}(_0x914e,0xb9));var _0xe914=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x914e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe914('0x0'));var util=require(_0xe914('0x1'));var moment=require(_0xe914('0x2'));var BPromise=require(_0xe914('0x3'));var rs=require(_0xe914('0x4'));var fs=require('fs');var Redis=require(_0xe914('0x5'));var db=require(_0xe914('0x6'))['db'];var utils=require(_0xe914('0x7'));var logger=require(_0xe914('0x8'))('rpc');var config=require(_0xe914('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe914('0xa')]({'port':0x232a});config[_0xe914('0xb')]=_['defaults'](config[_0xe914('0xb')],{'host':_0xe914('0xc'),'port':0x18eb});var socket=require(_0xe914('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xe914('0xe')](socket);function respondWithRpcPromise(_0x50108a,_0x5897ae,_0x329a35){return new BPromise(function(_0x50e8fc,_0x3ff81d){return client[_0xe914('0xf')](_0x50108a,_0x329a35)[_0xe914('0x10')](function(_0x16285c){logger[_0xe914('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x5897ae,_0xe914('0x12'));logger['debug'](_0xe914('0x13'),_0x5897ae,_0xe914('0x12'),JSON[_0xe914('0x14')](_0x16285c));if(_0x16285c[_0xe914('0x15')]){if(_0x16285c[_0xe914('0x15')][_0xe914('0x16')]===0x1f4){logger['error'](_0xe914('0x17'),_0x5897ae,_0x16285c[_0xe914('0x15')]['message']);return _0x3ff81d(_0x16285c[_0xe914('0x15')][_0xe914('0x18')]);}logger[_0xe914('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5897ae,_0x16285c[_0xe914('0x15')][_0xe914('0x18')]);return _0x50e8fc(_0x16285c[_0xe914('0x15')][_0xe914('0x18')]);}else{logger[_0xe914('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x5897ae,'request\x20sent');_0x50e8fc(_0x16285c[_0xe914('0x19')][_0xe914('0x18')]);}})[_0xe914('0x1a')](function(_0x455155){logger[_0xe914('0x15')](_0xe914('0x17'),_0x5897ae,_0x455155);_0x3ff81d(_0x455155);});});}exports[_0xe914('0x1b')]=function(_0x1ad3d6){var _0x7eadf=this;return new Promise(function(_0x5a868a,_0xcf02a9){return db[_0xe914('0x1c')][_0xe914('0x1d')]({'raw':_0x1ad3d6[_0xe914('0x1e')]?_0x1ad3d6['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ad3d6['options']?_0x1ad3d6[_0xe914('0x1e')][_0xe914('0x1f')]||null:null,'attributes':_0x1ad3d6[_0xe914('0x1e')]?_0x1ad3d6[_0xe914('0x1e')][_0xe914('0x20')]||null:null,'limit':_0x1ad3d6[_0xe914('0x1e')]?_0x1ad3d6[_0xe914('0x1e')][_0xe914('0x21')]||null:null,'include':_0x1ad3d6['options']?_0x1ad3d6[_0xe914('0x1e')][_0xe914('0x22')]?_[_0xe914('0x23')](_0x1ad3d6['options'][_0xe914('0x22')],function(_0x13e547){return{'model':db[_0x13e547['model']],'as':_0x13e547['as'],'attributes':_0x13e547[_0xe914('0x20')],'include':_0x13e547[_0xe914('0x22')]?_['map'](_0x13e547[_0xe914('0x22')],function(_0x48ef15){return{'model':db[_0x48ef15[_0xe914('0x24')]],'as':_0x48ef15['as'],'attributes':_0x48ef15[_0xe914('0x20')],'include':_0x48ef15[_0xe914('0x22')]?_[_0xe914('0x23')](_0x48ef15[_0xe914('0x22')],function(_0x4b6899){return{'model':db[_0x4b6899[_0xe914('0x24')]],'as':_0x4b6899['as'],'attributes':_0x4b6899[_0xe914('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe914('0x10')](function(_0x27737c){logger[_0xe914('0x11')](_0xe914('0x1b'),_0x1ad3d6);logger['debug'](_0xe914('0x1b'),_0x1ad3d6,JSON[_0xe914('0x14')](_0x27737c));_0x5a868a(_0x27737c);})[_0xe914('0x1a')](function(_0x3759c8){logger['error']('GetOpenchannelQueue',_0x3759c8['message'],_0x1ad3d6);_0xcf02a9(_0x7eadf[_0xe914('0x15')](0x1f4,_0x3759c8[_0xe914('0x18')]));});});};exports[_0xe914('0x25')]=function(_0x278c31){var _0x388e78=this;return new Promise(function(_0x48eda6,_0x4c3f34){return db['OpenchannelQueue']['find']({'raw':_0x278c31['options']?_0x278c31[_0xe914('0x1e')][_0xe914('0x26')]===undefined?!![]:![]:!![],'where':_0x278c31['options']?_0x278c31[_0xe914('0x1e')][_0xe914('0x1f')]||null:null,'attributes':_0x278c31[_0xe914('0x1e')]?_0x278c31[_0xe914('0x1e')][_0xe914('0x20')]||null:null,'include':_0x278c31[_0xe914('0x1e')]?_0x278c31[_0xe914('0x1e')]['include']?_[_0xe914('0x23')](_0x278c31[_0xe914('0x1e')][_0xe914('0x22')],function(_0xb9f27e){return{'model':db[_0xb9f27e[_0xe914('0x24')]],'as':_0xb9f27e['as'],'attributes':_0xb9f27e['attributes'],'include':_0xb9f27e[_0xe914('0x22')]?_['map'](_0xb9f27e['include'],function(_0x1a526b){return{'model':db[_0x1a526b[_0xe914('0x24')]],'as':_0x1a526b['as'],'attributes':_0x1a526b[_0xe914('0x20')],'include':_0x1a526b[_0xe914('0x22')]?_[_0xe914('0x23')](_0x1a526b['include'],function(_0x41f1ae){return{'model':db[_0x41f1ae['model']],'as':_0x41f1ae['as'],'attributes':_0x41f1ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xe914('0x10')](function(_0x560020){logger[_0xe914('0x11')](_0xe914('0x25'),_0x278c31);logger['debug'](_0xe914('0x25'),_0x278c31,JSON[_0xe914('0x14')](_0x560020));_0x48eda6(_0x560020);})[_0xe914('0x1a')](function(_0x5e04e4){logger[_0xe914('0x15')](_0xe914('0x25'),_0x5e04e4[_0xe914('0x18')],_0x278c31);_0x4c3f34(_0x388e78['error'](0x1f4,_0x5e04e4['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 54ccfac..c93855e 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 _0x5215=['register','openchannelQueue:','emit'];(function(_0x5db349,_0x4e57cb){var _0x5a4d42=function(_0x3a93f7){while(--_0x3a93f7){_0x5db349['push'](_0x5db349['shift']());}};_0x5a4d42(++_0x4e57cb);}(_0x5215,0x1c7));var _0x5521=function(_0x4cbd79,_0x231cd9){_0x4cbd79=_0x4cbd79-0x0;var _0x57eb7d=_0x5215[_0x4cbd79];return _0x57eb7d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove','update'];function createListener(_0x27660c,_0x30be9f){return function(_0x48e76f){_0x30be9f[_0x5521('0x0')](_0x27660c,_0x48e76f);};}function removeListener(_0x453038,_0x35be9f){return function(){OpenchannelQueueEvents['removeListener'](_0x453038,_0x35be9f);};}exports[_0x5521('0x1')]=function(_0x45809e){for(var _0x5b59ab=0x0,_0x53b02b=events['length'];_0x5b59ab<_0x53b02b;_0x5b59ab++){var _0x2d1bb6=events[_0x5b59ab];var _0x542e97=createListener(_0x5521('0x2')+_0x2d1bb6,_0x45809e);OpenchannelQueueEvents['on'](_0x2d1bb6,_0x542e97);}}; \ No newline at end of file +var _0xd125=['removeListener','length','save','remove','update','emit'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0xd125,0x92));var _0x5d12=function(_0xcc8978,_0xf3f600){_0xcc8978=_0xcc8978-0x0;var _0x243e18=_0xd125[_0xcc8978];return _0x243e18;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x5d12('0x0'),_0x5d12('0x1'),_0x5d12('0x2')];function createListener(_0xd171cb,_0x11b38f){return function(_0x589227){_0x11b38f[_0x5d12('0x3')](_0xd171cb,_0x589227);};}function removeListener(_0x2a1291,_0x549b72){return function(){OpenchannelQueueEvents[_0x5d12('0x4')](_0x2a1291,_0x549b72);};}exports['register']=function(_0x41bae4){for(var _0xe9bee9=0x0,_0x22f260=events[_0x5d12('0x5')];_0xe9bee9<_0x22f260;_0xe9bee9++){var _0x17b1d6=events[_0xe9bee9];var _0x2d71f2=createListener('openchannelQueue:'+_0x17b1d6,_0x41bae4);OpenchannelQueueEvents['on'](_0x17b1d6,_0x2d71f2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1a68fd0..14aa11a 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 _0x6a97=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x18e24e,_0x12c97f){var _0x4442d9=function(_0x1f47a6){while(--_0x1f47a6){_0x18e24e['push'](_0x18e24e['shift']());}};_0x4442d9(++_0x12c97f);}(_0x6a97,0x13d));var _0x76a9=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x6a97[_0x1fc18b];return _0x16a351;};'use strict';var multer=require(_0x76a9('0x0'));var util=require(_0x76a9('0x1'));var path=require(_0x76a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x76a9('0x3'));var router=express[_0x76a9('0x4')]();var fs_extra=require(_0x76a9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x76a9('0x6'));var config=require(_0x76a9('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x76a9('0x8')]('/',auth[_0x76a9('0x9')](),controller['index']);router[_0x76a9('0x8')](_0x76a9('0xa'),auth[_0x76a9('0x9')](),controller[_0x76a9('0xb')]);router[_0x76a9('0x8')](_0x76a9('0xc'),auth[_0x76a9('0x9')](),controller[_0x76a9('0xd')]);router[_0x76a9('0xe')]('/',auth[_0x76a9('0x9')](),controller[_0x76a9('0xf')]);router[_0x76a9('0x10')](_0x76a9('0xc'),auth[_0x76a9('0x9')](),controller['update']);router['delete'](_0x76a9('0xc'),auth[_0x76a9('0x9')](),controller['destroy']);module[_0x76a9('0x11')]=router; \ No newline at end of file +var _0x29e3=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get'];(function(_0x37e8c2,_0x2bf400){var _0x4a1fa4=function(_0x2b6286){while(--_0x2b6286){_0x37e8c2['push'](_0x37e8c2['shift']());}};_0x4a1fa4(++_0x2bf400);}(_0x29e3,0xee));var _0x329e=function(_0x74fdd8,_0x1b98c7){_0x74fdd8=_0x74fdd8-0x0;var _0x581ede=_0x29e3[_0x74fdd8];return _0x581ede;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x329e('0x0'));var timeout=require(_0x329e('0x1'));var express=require(_0x329e('0x2'));var router=express[_0x329e('0x3')]();var fs_extra=require(_0x329e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x329e('0x5'));var config=require(_0x329e('0x6'));var controller=require(_0x329e('0x7'));router[_0x329e('0x8')]('/',auth[_0x329e('0x9')](),controller[_0x329e('0xa')]);router['get']('/describe',auth[_0x329e('0x9')](),controller['describe']);router[_0x329e('0x8')](_0x329e('0xb'),auth[_0x329e('0x9')](),controller[_0x329e('0xc')]);router[_0x329e('0xd')]('/',auth[_0x329e('0x9')](),controller[_0x329e('0xe')]);router[_0x329e('0xf')](_0x329e('0xb'),auth[_0x329e('0x9')](),controller[_0x329e('0x10')]);router['delete'](_0x329e('0xb'),auth[_0x329e('0x9')](),controller[_0x329e('0x11')]);module[_0x329e('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0382980..f4d93e0 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 _0xbe25=['sequelize','exports','STRING','moment'];(function(_0x2f430a,_0x46d370){var _0x10def3=function(_0x347eaa){while(--_0x347eaa){_0x2f430a['push'](_0x2f430a['shift']());}};_0x10def3(++_0x46d370);}(_0xbe25,0x1ab));var _0x5be2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbe25[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x5be2('0x0'));var Sequelize=require(_0x5be2('0x1'));module[_0x5be2('0x2')]={'uniqueid':{'type':Sequelize[_0x5be2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5be2('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5be2('0x3')]}}; \ No newline at end of file +var _0x40a3=['DATE','moment','sequelize','exports','STRING'];(function(_0x5174a7,_0x5cbada){var _0x39a78b=function(_0x57cba5){while(--_0x57cba5){_0x5174a7['push'](_0x5174a7['shift']());}};_0x39a78b(++_0x5cbada);}(_0x40a3,0x1c3));var _0x340a=function(_0x56b8ae,_0x3fba15){_0x56b8ae=_0x56b8ae-0x0;var _0x1dfd53=_0x40a3[_0x56b8ae];return _0x1dfd53;};'use strict';var moment=require(_0x340a('0x0'));var Sequelize=require(_0x340a('0x1'));module[_0x340a('0x2')]={'uniqueid':{'type':Sequelize[_0x340a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x340a('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x340a('0x4')]},'acceptAt':{'type':Sequelize[_0x340a('0x4')]},'exitAt':{'type':Sequelize[_0x340a('0x4')]},'reason':{'type':Sequelize[_0x340a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7e3f8d1..0972f53 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 _0xb38f=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs'];(function(_0x4f267a,_0x4d3149){var _0x3eafdf=function(_0x36ed16){while(--_0x36ed16){_0x4f267a['push'](_0x4f267a['shift']());}};_0x3eafdf(++_0x4d3149);}(_0xb38f,0x13e));var _0xfb38=function(_0x1ec8f9,_0x22f5e7){_0x1ec8f9=_0x1ec8f9-0x0;var _0x17cd3d=_0xb38f[_0x1ec8f9];return _0x17cd3d;};'use strict';var emlformat=require(_0xfb38('0x0'));var rimraf=require(_0xfb38('0x1'));var zipdir=require(_0xfb38('0x2'));var jsonpatch=require(_0xfb38('0x3'));var rp=require('request-promise');var moment=require(_0xfb38('0x4'));var BPromise=require(_0xfb38('0x5'));var Mustache=require('mustache');var util=require(_0xfb38('0x6'));var path=require(_0xfb38('0x7'));var sox=require(_0xfb38('0x8'));var csv=require('to-csv');var ejs=require(_0xfb38('0x9'));var fs=require('fs');var fs_extra=require(_0xfb38('0xa'));var _=require(_0xfb38('0xb'));var squel=require(_0xfb38('0xc'));var crypto=require(_0xfb38('0xd'));var jsforce=require(_0xfb38('0xe'));var deskjs=require(_0xfb38('0xf'));var toCsv=require(_0xfb38('0x10'));var querystring=require(_0xfb38('0x11'));var Papa=require(_0xfb38('0x12'));var Redis=require(_0xfb38('0x13'));var authService=require(_0xfb38('0x14'));var qs=require(_0xfb38('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb38('0x16'));var logger=require(_0xfb38('0x17'))(_0xfb38('0x18'));var utils=require(_0xfb38('0x19'));var config=require(_0xfb38('0x1a'));var licenseUtil=require(_0xfb38('0x1b'));var db=require(_0xfb38('0x1c'))['db'];function respondWithStatusCode(_0x3582a4,_0x5521e3){_0x5521e3=_0x5521e3||0xcc;return function(_0x5eb666){if(_0x5eb666){return _0x3582a4[_0xfb38('0x1d')](_0x5521e3);}return _0x3582a4[_0xfb38('0x1e')](_0x5521e3)[_0xfb38('0x1f')]();};}function respondWithResult(_0x56934b,_0x2b3096){_0x2b3096=_0x2b3096||0xc8;return function(_0x30e674){if(_0x30e674){return _0x56934b[_0xfb38('0x1e')](_0x2b3096)[_0xfb38('0x20')](_0x30e674);}};}function respondWithFilteredResult(_0x5465bc,_0x96a36c){return function(_0x3f9d86){if(_0x3f9d86){var _0x3e7275=typeof _0x96a36c[_0xfb38('0x21')]===_0xfb38('0x22')&&typeof _0x96a36c['limit']==='undefined';var _0x56ae35=_0x3f9d86[_0xfb38('0x23')];var _0x4de4f7=_0x3e7275?0x0:_0x96a36c[_0xfb38('0x21')];var _0x32e0a4=_0x3e7275?_0x3f9d86['count']:_0x96a36c[_0xfb38('0x21')]+_0x96a36c[_0xfb38('0x24')];var _0x55ab92;if(_0x32e0a4>=_0x56ae35){_0x32e0a4=_0x56ae35;_0x55ab92=0xc8;}else{_0x55ab92=0xce;}_0x5465bc[_0xfb38('0x1e')](_0x55ab92);return _0x5465bc[_0xfb38('0x25')](_0xfb38('0x26'),_0x4de4f7+'-'+_0x32e0a4+'/'+_0x56ae35)[_0xfb38('0x20')](_0x3f9d86);}return null;};}function patchUpdates(_0x128367){return function(_0x4cb304){try{jsonpatch[_0xfb38('0x27')](_0x4cb304,_0x128367,!![]);}catch(_0x6b026c){return BPromise[_0xfb38('0x28')](_0x6b026c);}return _0x4cb304['save']();};}function saveUpdates(_0x278dfa,_0x439ee5){return function(_0x90528e){if(_0x90528e){return _0x90528e[_0xfb38('0x29')](_0x278dfa)[_0xfb38('0x2a')](function(_0x50147c){return _0x50147c;});}return null;};}function removeEntity(_0x6dffa8,_0x40aaa9){return function(_0x1f13e4){if(_0x1f13e4){return _0x1f13e4['destroy']()[_0xfb38('0x2a')](function(){_0x6dffa8[_0xfb38('0x1e')](0xcc)[_0xfb38('0x1f')]();});}};}function handleEntityNotFound(_0x3162b6,_0x300d98){return function(_0x2aa394){if(!_0x2aa394){_0x3162b6[_0xfb38('0x1d')](0x194);}return _0x2aa394;};}function handleError(_0x180301,_0x20dd36){_0x20dd36=_0x20dd36||0x1f4;return function(_0x16d6e7){logger[_0xfb38('0x2b')](_0x16d6e7[_0xfb38('0x2c')]);if(_0x16d6e7['name']){delete _0x16d6e7[_0xfb38('0x2d')];}_0x180301[_0xfb38('0x1e')](_0x20dd36)[_0xfb38('0x2e')](_0x16d6e7);};}exports['index']=function(_0x414be2,_0x2054ff){var _0x2a7128={},_0x32780f={},_0x6e1274={'count':0x0,'rows':[]};var _0x14b882=_[_0xfb38('0x2f')](db[_0xfb38('0x30')][_0xfb38('0x31')],function(_0x31585b){return{'name':_0x31585b['fieldName'],'type':_0x31585b['type'][_0xfb38('0x32')]};});_0x32780f[_0xfb38('0x33')]=_[_0xfb38('0x2f')](_0x14b882,'name');_0x32780f[_0xfb38('0x34')]=_[_0xfb38('0x35')](_0x414be2[_0xfb38('0x34')]);_0x32780f['filters']=_[_0xfb38('0x36')](_0x32780f[_0xfb38('0x33')],_0x32780f[_0xfb38('0x34')]);_0x2a7128['attributes']=_[_0xfb38('0x36')](_0x32780f[_0xfb38('0x33')],qs[_0xfb38('0x37')](_0x414be2[_0xfb38('0x34')][_0xfb38('0x37')]));_0x2a7128[_0xfb38('0x38')]=_0x2a7128[_0xfb38('0x38')][_0xfb38('0x39')]?_0x2a7128[_0xfb38('0x38')]:_0x32780f[_0xfb38('0x33')];if(!_0x414be2['query'][_0xfb38('0x3a')](_0xfb38('0x3b'))){_0x2a7128['limit']=qs[_0xfb38('0x24')](_0x414be2['query'][_0xfb38('0x24')]);_0x2a7128['offset']=qs[_0xfb38('0x21')](_0x414be2[_0xfb38('0x34')]['offset']);}_0x2a7128[_0xfb38('0x3c')]=qs[_0xfb38('0x3d')](_0x414be2[_0xfb38('0x34')][_0xfb38('0x3d')]);_0x2a7128[_0xfb38('0x3e')]=qs['filters'](_[_0xfb38('0x3f')](_0x414be2[_0xfb38('0x34')],_0x32780f[_0xfb38('0x40')]),_0x14b882);if(_0x414be2[_0xfb38('0x34')][_0xfb38('0x41')]){_0x2a7128[_0xfb38('0x3e')]=_[_0xfb38('0x42')](_0x2a7128[_0xfb38('0x3e')],{'$or':_[_0xfb38('0x2f')](_0x14b882,function(_0x151525){if(_0x151525[_0xfb38('0x43')]!==_0xfb38('0x44')){var _0x1794fb={};_0x1794fb[_0x151525[_0xfb38('0x2d')]]={'$like':'%'+_0x414be2[_0xfb38('0x34')]['filter']+'%'};return _0x1794fb;}})});}_0x2a7128=_['merge']({},_0x2a7128,_0x414be2[_0xfb38('0x45')]);var _0x1483b9={'where':_0x2a7128[_0xfb38('0x3e')]};return db[_0xfb38('0x30')][_0xfb38('0x23')](_0x1483b9)[_0xfb38('0x2a')](function(_0x5e0ac8){_0x6e1274[_0xfb38('0x23')]=_0x5e0ac8;if(_0x414be2[_0xfb38('0x34')][_0xfb38('0x46')]){_0x2a7128[_0xfb38('0x47')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xfb38('0x48')](_0x2a7128);})['then'](function(_0x253f4a){_0x6e1274[_0xfb38('0x49')]=_0x253f4a;return _0x6e1274;})[_0xfb38('0x2a')](respondWithFilteredResult(_0x2054ff,_0x2a7128))[_0xfb38('0x4a')](handleError(_0x2054ff,null));};exports[_0xfb38('0x4b')]=function(_0x4ef79c,_0x533e46){var _0x1b1940={'raw':!![],'where':{'id':_0x4ef79c[_0xfb38('0x4c')]['id']}},_0x39af4a={};_0x39af4a[_0xfb38('0x33')]=_[_0xfb38('0x35')](db[_0xfb38('0x30')][_0xfb38('0x31')]);_0x39af4a['query']=_['keys'](_0x4ef79c['query']);_0x39af4a[_0xfb38('0x40')]=_['intersection'](_0x39af4a[_0xfb38('0x33')],_0x39af4a['query']);_0x1b1940[_0xfb38('0x38')]=_[_0xfb38('0x36')](_0x39af4a[_0xfb38('0x33')],qs['fields'](_0x4ef79c[_0xfb38('0x34')][_0xfb38('0x37')]));_0x1b1940[_0xfb38('0x38')]=_0x1b1940['attributes'][_0xfb38('0x39')]?_0x1b1940[_0xfb38('0x38')]:_0x39af4a['model'];if(_0x4ef79c['query']['includeAll']){_0x1b1940[_0xfb38('0x47')]=[{'all':!![]}];}_0x1b1940=_[_0xfb38('0x42')]({},_0x1b1940,_0x4ef79c['options']);return db['OpenchannelQueueReport'][_0xfb38('0x4d')](_0x1b1940)[_0xfb38('0x2a')](handleEntityNotFound(_0x533e46,null))['then'](respondWithResult(_0x533e46,null))['catch'](handleError(_0x533e46,null));};exports[_0xfb38('0x4e')]=function(_0x4360da,_0x1a6dc4){return db[_0xfb38('0x30')][_0xfb38('0x4e')](_0x4360da[_0xfb38('0x4f')],{})[_0xfb38('0x2a')](respondWithResult(_0x1a6dc4,0xc9))[_0xfb38('0x4a')](handleError(_0x1a6dc4,null));};exports[_0xfb38('0x29')]=function(_0x1e9f00,_0x502ebc){if(_0x1e9f00[_0xfb38('0x4f')]['id']){delete _0x1e9f00[_0xfb38('0x4f')]['id'];}return db['OpenchannelQueueReport'][_0xfb38('0x4d')]({'where':{'id':_0x1e9f00[_0xfb38('0x4c')]['id']}})[_0xfb38('0x2a')](handleEntityNotFound(_0x502ebc,null))[_0xfb38('0x2a')](saveUpdates(_0x1e9f00[_0xfb38('0x4f')],null))[_0xfb38('0x2a')](respondWithResult(_0x502ebc,null))[_0xfb38('0x4a')](handleError(_0x502ebc,null));};exports[_0xfb38('0x50')]=function(_0x37cb06,_0x4034ad){return db['OpenchannelQueueReport'][_0xfb38('0x4d')]({'where':{'id':_0x37cb06[_0xfb38('0x4c')]['id']}})[_0xfb38('0x2a')](handleEntityNotFound(_0x4034ad,null))[_0xfb38('0x2a')](removeEntity(_0x4034ad,null))[_0xfb38('0x4a')](handleError(_0x4034ad,null));};exports[_0xfb38('0x51')]=function(_0x76e8a2,_0x430c5c){return db[_0xfb38('0x30')][_0xfb38('0x51')]()[_0xfb38('0x2a')](respondWithResult(_0x430c5c,null))['catch'](handleError(_0x430c5c,null));}; \ No newline at end of file +var _0xecf9=['options','OpenchannelQueueReport','then','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','error','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL'];(function(_0x3656f5,_0x583257){var _0x54727b=function(_0x284dd3){while(--_0x284dd3){_0x3656f5['push'](_0x3656f5['shift']());}};_0x54727b(++_0x583257);}(_0xecf9,0x141));var _0x9ecf=function(_0x4ceeb4,_0x294436){_0x4ceeb4=_0x4ceeb4-0x0;var _0x39cb73=_0xecf9[_0x4ceeb4];return _0x39cb73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ecf('0x0'));var zipdir=require(_0x9ecf('0x1'));var jsonpatch=require(_0x9ecf('0x2'));var rp=require('request-promise');var moment=require(_0x9ecf('0x3'));var BPromise=require(_0x9ecf('0x4'));var Mustache=require(_0x9ecf('0x5'));var util=require(_0x9ecf('0x6'));var path=require(_0x9ecf('0x7'));var sox=require(_0x9ecf('0x8'));var csv=require('to-csv');var ejs=require(_0x9ecf('0x9'));var fs=require('fs');var fs_extra=require(_0x9ecf('0xa'));var _=require(_0x9ecf('0xb'));var squel=require(_0x9ecf('0xc'));var crypto=require(_0x9ecf('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9ecf('0xe'));var querystring=require(_0x9ecf('0xf'));var Papa=require(_0x9ecf('0x10'));var Redis=require(_0x9ecf('0x11'));var authService=require(_0x9ecf('0x12'));var qs=require(_0x9ecf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ecf('0x14'))(_0x9ecf('0x15'));var utils=require('../../config/utils');var config=require(_0x9ecf('0x16'));var licenseUtil=require(_0x9ecf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x130c6b,_0x5095d5){_0x5095d5=_0x5095d5||0xcc;return function(_0x1b8a27){if(_0x1b8a27){return _0x130c6b[_0x9ecf('0x18')](_0x5095d5);}return _0x130c6b[_0x9ecf('0x19')](_0x5095d5)[_0x9ecf('0x1a')]();};}function respondWithResult(_0x36a45c,_0x2d5cdd){_0x2d5cdd=_0x2d5cdd||0xc8;return function(_0x2c819b){if(_0x2c819b){return _0x36a45c[_0x9ecf('0x19')](_0x2d5cdd)['json'](_0x2c819b);}};}function respondWithFilteredResult(_0x42e511,_0x255b30){return function(_0x40c679){if(_0x40c679){var _0x3dcad8=typeof _0x255b30['offset']===_0x9ecf('0x1b')&&typeof _0x255b30['limit']==='undefined';var _0x4ae579=_0x40c679['count'];var _0x3b1135=_0x3dcad8?0x0:_0x255b30['offset'];var _0x60a7eb=_0x3dcad8?_0x40c679[_0x9ecf('0x1c')]:_0x255b30[_0x9ecf('0x1d')]+_0x255b30[_0x9ecf('0x1e')];var _0x5c2b15;if(_0x60a7eb>=_0x4ae579){_0x60a7eb=_0x4ae579;_0x5c2b15=0xc8;}else{_0x5c2b15=0xce;}_0x42e511[_0x9ecf('0x19')](_0x5c2b15);return _0x42e511[_0x9ecf('0x1f')](_0x9ecf('0x20'),_0x3b1135+'-'+_0x60a7eb+'/'+_0x4ae579)[_0x9ecf('0x21')](_0x40c679);}return null;};}function patchUpdates(_0x4c744a){return function(_0x11cb52){try{jsonpatch[_0x9ecf('0x22')](_0x11cb52,_0x4c744a,!![]);}catch(_0x36ed38){return BPromise[_0x9ecf('0x23')](_0x36ed38);}return _0x11cb52[_0x9ecf('0x24')]();};}function saveUpdates(_0x2dc333,_0x25a966){return function(_0xbaf6d1){if(_0xbaf6d1){return _0xbaf6d1['update'](_0x2dc333)['then'](function(_0x570fa7){return _0x570fa7;});}return null;};}function removeEntity(_0x2a3354,_0x27f33e){return function(_0x34e31a){if(_0x34e31a){return _0x34e31a['destroy']()['then'](function(){_0x2a3354[_0x9ecf('0x19')](0xcc)[_0x9ecf('0x1a')]();});}};}function handleEntityNotFound(_0x2d2dc5,_0x1beb07){return function(_0xfaa26e){if(!_0xfaa26e){_0x2d2dc5['sendStatus'](0x194);}return _0xfaa26e;};}function handleError(_0x182f41,_0x8630df){_0x8630df=_0x8630df||0x1f4;return function(_0x327b90){logger[_0x9ecf('0x25')](_0x327b90['stack']);if(_0x327b90[_0x9ecf('0x26')]){delete _0x327b90[_0x9ecf('0x26')];}_0x182f41['status'](_0x8630df)[_0x9ecf('0x27')](_0x327b90);};}exports[_0x9ecf('0x28')]=function(_0x1aa13e,_0x142978){var _0x5ecf51={},_0x5cded1={},_0x5ee8e2={'count':0x0,'rows':[]};var _0x444aab=_['map'](db['OpenchannelQueueReport'][_0x9ecf('0x29')],function(_0x4e753d){return{'name':_0x4e753d[_0x9ecf('0x2a')],'type':_0x4e753d[_0x9ecf('0x2b')][_0x9ecf('0x2c')]};});_0x5cded1[_0x9ecf('0x2d')]=_['map'](_0x444aab,'name');_0x5cded1[_0x9ecf('0x2e')]=_['keys'](_0x1aa13e['query']);_0x5cded1[_0x9ecf('0x2f')]=_['intersection'](_0x5cded1[_0x9ecf('0x2d')],_0x5cded1[_0x9ecf('0x2e')]);_0x5ecf51['attributes']=_['intersection'](_0x5cded1[_0x9ecf('0x2d')],qs[_0x9ecf('0x30')](_0x1aa13e[_0x9ecf('0x2e')][_0x9ecf('0x30')]));_0x5ecf51[_0x9ecf('0x31')]=_0x5ecf51[_0x9ecf('0x31')][_0x9ecf('0x32')]?_0x5ecf51['attributes']:_0x5cded1[_0x9ecf('0x2d')];if(!_0x1aa13e[_0x9ecf('0x2e')]['hasOwnProperty'](_0x9ecf('0x33'))){_0x5ecf51[_0x9ecf('0x1e')]=qs['limit'](_0x1aa13e[_0x9ecf('0x2e')][_0x9ecf('0x1e')]);_0x5ecf51[_0x9ecf('0x1d')]=qs[_0x9ecf('0x1d')](_0x1aa13e['query'][_0x9ecf('0x1d')]);}_0x5ecf51[_0x9ecf('0x34')]=qs[_0x9ecf('0x35')](_0x1aa13e[_0x9ecf('0x2e')][_0x9ecf('0x35')]);_0x5ecf51[_0x9ecf('0x36')]=qs[_0x9ecf('0x2f')](_['pick'](_0x1aa13e[_0x9ecf('0x2e')],_0x5cded1[_0x9ecf('0x2f')]),_0x444aab);if(_0x1aa13e['query'][_0x9ecf('0x37')]){_0x5ecf51['where']=_[_0x9ecf('0x38')](_0x5ecf51['where'],{'$or':_[_0x9ecf('0x39')](_0x444aab,function(_0x31dfd9){if(_0x31dfd9[_0x9ecf('0x2b')]!==_0x9ecf('0x3a')){var _0x2b5cb4={};_0x2b5cb4[_0x31dfd9[_0x9ecf('0x26')]]={'$like':'%'+_0x1aa13e['query'][_0x9ecf('0x37')]+'%'};return _0x2b5cb4;}})});}_0x5ecf51=_[_0x9ecf('0x38')]({},_0x5ecf51,_0x1aa13e[_0x9ecf('0x3b')]);var _0x2fae28={'where':_0x5ecf51[_0x9ecf('0x36')]};return db[_0x9ecf('0x3c')][_0x9ecf('0x1c')](_0x2fae28)[_0x9ecf('0x3d')](function(_0x2eecfa){_0x5ee8e2[_0x9ecf('0x1c')]=_0x2eecfa;if(_0x1aa13e['query'][_0x9ecf('0x3e')]){_0x5ecf51[_0x9ecf('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x9ecf('0x40')](_0x5ecf51);})[_0x9ecf('0x3d')](function(_0x40525c){_0x5ee8e2[_0x9ecf('0x41')]=_0x40525c;return _0x5ee8e2;})[_0x9ecf('0x3d')](respondWithFilteredResult(_0x142978,_0x5ecf51))[_0x9ecf('0x42')](handleError(_0x142978,null));};exports[_0x9ecf('0x43')]=function(_0x56d702,_0x54762b){var _0x312643={'raw':!![],'where':{'id':_0x56d702[_0x9ecf('0x44')]['id']}},_0x362e6f={};_0x362e6f['model']=_['keys'](db[_0x9ecf('0x3c')][_0x9ecf('0x29')]);_0x362e6f[_0x9ecf('0x2e')]=_[_0x9ecf('0x45')](_0x56d702['query']);_0x362e6f[_0x9ecf('0x2f')]=_['intersection'](_0x362e6f[_0x9ecf('0x2d')],_0x362e6f[_0x9ecf('0x2e')]);_0x312643[_0x9ecf('0x31')]=_[_0x9ecf('0x46')](_0x362e6f['model'],qs[_0x9ecf('0x30')](_0x56d702[_0x9ecf('0x2e')][_0x9ecf('0x30')]));_0x312643[_0x9ecf('0x31')]=_0x312643[_0x9ecf('0x31')][_0x9ecf('0x32')]?_0x312643[_0x9ecf('0x31')]:_0x362e6f[_0x9ecf('0x2d')];if(_0x56d702[_0x9ecf('0x2e')]['includeAll']){_0x312643[_0x9ecf('0x3f')]=[{'all':!![]}];}_0x312643=_['merge']({},_0x312643,_0x56d702[_0x9ecf('0x3b')]);return db[_0x9ecf('0x3c')][_0x9ecf('0x47')](_0x312643)[_0x9ecf('0x3d')](handleEntityNotFound(_0x54762b,null))['then'](respondWithResult(_0x54762b,null))[_0x9ecf('0x42')](handleError(_0x54762b,null));};exports['create']=function(_0x54d5ca,_0x5e94a3){return db[_0x9ecf('0x3c')]['create'](_0x54d5ca[_0x9ecf('0x48')],{})[_0x9ecf('0x3d')](respondWithResult(_0x5e94a3,0xc9))[_0x9ecf('0x42')](handleError(_0x5e94a3,null));};exports[_0x9ecf('0x49')]=function(_0x36dcac,_0x28be4e){if(_0x36dcac['body']['id']){delete _0x36dcac[_0x9ecf('0x48')]['id'];}return db[_0x9ecf('0x3c')]['find']({'where':{'id':_0x36dcac['params']['id']}})['then'](handleEntityNotFound(_0x28be4e,null))[_0x9ecf('0x3d')](saveUpdates(_0x36dcac['body'],null))['then'](respondWithResult(_0x28be4e,null))[_0x9ecf('0x42')](handleError(_0x28be4e,null));};exports[_0x9ecf('0x4a')]=function(_0x21d087,_0x4ac0e3){return db['OpenchannelQueueReport'][_0x9ecf('0x47')]({'where':{'id':_0x21d087['params']['id']}})[_0x9ecf('0x3d')](handleEntityNotFound(_0x4ac0e3,null))[_0x9ecf('0x3d')](removeEntity(_0x4ac0e3,null))['catch'](handleError(_0x4ac0e3,null));};exports[_0x9ecf('0x4b')]=function(_0x155bd8,_0x4fae0f){return db[_0x9ecf('0x3c')][_0x9ecf('0x4b')]()[_0x9ecf('0x3d')](respondWithResult(_0x4fae0f,null))[_0x9ecf('0x42')](handleError(_0x4fae0f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b589266..8cf9178 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x47e99d,_0x469344){var _0x449051=function(_0x2e8fbe){while(--_0x2e8fbe){_0x47e99d['push'](_0x47e99d['shift']());}};_0x449051(++_0x469344);}(_0x326f,0xd1));var _0xf326=function(_0x1b73de,_0x482ff3){_0x1b73de=_0x1b73de-0x0;var _0x14befb=_0x326f[_0x1b73de];return _0x14befb;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x101317,_0x162be8){var _0x481e49=function(_0x22148d){while(--_0x22148d){_0x101317['push'](_0x101317['shift']());}};_0x481e49(++_0x162be8);}(_0xe14b,0x93));var _0xbe14=function(_0x64f84,_0x20890b){_0x64f84=_0x64f84-0x0;var _0x292daa=_0xe14b[_0x64f84];return _0x292daa;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 4bc56cc..3a9219d 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 _0xd070=['catch','create','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x54b82a,_0xa88a0b){var _0x20a5f2=function(_0x30d121){while(--_0x30d121){_0x54b82a['push'](_0x54b82a['shift']());}};_0x20a5f2(++_0xa88a0b);}(_0xd070,0x8e));var _0x0d07=function(_0x4480a0,_0x34513f){_0x4480a0=_0x4480a0-0x0;var _0x30de73=_0xd070[_0x4480a0];return _0x30de73;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var moment=require(_0x0d07('0x1'));var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require(_0x0d07('0x7'))(_0x0d07('0x8'));var config=require(_0x0d07('0x9'));var jayson=require(_0x0d07('0xa'));var client=jayson[_0x0d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d75a,_0x5a4366,_0x20fd56){return new BPromise(function(_0x8c16d8,_0x1f989e){return client[_0x0d07('0xc')](_0x13d75a,_0x20fd56)[_0x0d07('0xd')](function(_0xc5b04d){logger[_0x0d07('0xe')](_0x0d07('0xf'),_0x5a4366,_0x0d07('0x10'));logger[_0x0d07('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5a4366,'request\x20sent',JSON[_0x0d07('0x12')](_0xc5b04d));if(_0xc5b04d[_0x0d07('0x13')]){if(_0xc5b04d['error'][_0x0d07('0x14')]===0x1f4){logger['error'](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')]['message']);return _0x1f989e(_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);}logger[_0x0d07('0x13')](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);return _0x8c16d8(_0xc5b04d['error'][_0x0d07('0x15')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a4366,_0x0d07('0x10'));_0x8c16d8(_0xc5b04d[_0x0d07('0x16')][_0x0d07('0x15')]);}})[_0x0d07('0x17')](function(_0x220203){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a4366,_0x220203);_0x1f989e(_0x220203);});});}exports['CreateOpenchannelQueueReport']=function(_0x187df2){var _0x312015=this;return new Promise(function(_0x52cb4b,_0x410ad2){return db['OpenchannelQueueReport'][_0x0d07('0x18')](_0x187df2['body'],{'raw':_0x187df2['options']?_0x187df2[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0d07('0xd')](function(_0x54790f){logger[_0x0d07('0xe')]('CreateOpenchannelQueueReport',_0x187df2);logger['debug'](_0x0d07('0x1a'),_0x187df2,JSON[_0x0d07('0x12')](_0x54790f));_0x52cb4b(_0x54790f);})[_0x0d07('0x17')](function(_0x57e997){logger[_0x0d07('0x13')]('CreateOpenchannelQueueReport',_0x57e997['message'],_0x187df2);_0x410ad2(_0x312015[_0x0d07('0x13')](0x1f4,_0x57e997[_0x0d07('0x15')]));});});};exports[_0x0d07('0x1b')]=function(_0x19f82f){var _0x4e0c97=this;return new Promise(function(_0x5898db,_0x9d9bfd){return db['OpenchannelQueueReport'][_0x0d07('0x1c')](_0x19f82f[_0x0d07('0x1d')],{'raw':_0x19f82f['options']?_0x19f82f[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19f82f['options']?_0x19f82f['options'][_0x0d07('0x1e')]||null:null,'attributes':_0x19f82f[_0x0d07('0x19')]?_0x19f82f[_0x0d07('0x19')][_0x0d07('0x1f')]||null:null,'limit':_0x19f82f[_0x0d07('0x19')]?_0x19f82f[_0x0d07('0x19')][_0x0d07('0x20')]||null:null})[_0x0d07('0xd')](function(_0x4c68d7){logger['info'](_0x0d07('0x1b'),_0x19f82f);logger[_0x0d07('0x11')](_0x0d07('0x1b'),_0x19f82f,JSON[_0x0d07('0x12')](_0x4c68d7));_0x5898db(_0x4c68d7);})[_0x0d07('0x17')](function(_0xb7d4d){logger[_0x0d07('0x13')](_0x0d07('0x1b'),_0xb7d4d[_0x0d07('0x15')],_0x19f82f);_0x9d9bfd(_0x4e0c97[_0x0d07('0x13')](0x1f4,_0xb7d4d[_0x0d07('0x15')]));});});}; \ No newline at end of file +var _0x087b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','create','body','options','CreateOpenchannelQueueReport','catch','UpdateOpenchannelQueueReport','raw','where','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27348e,_0x3905ce){var _0x4588b1=function(_0x476a88){while(--_0x476a88){_0x27348e['push'](_0x27348e['shift']());}};_0x4588b1(++_0x3905ce);}(_0x087b,0x11a));var _0xb087=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x087b[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['CreateOpenchannelQueueReport']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['OpenchannelQueueReport'][_0xb087('0x16')](_0x330005[_0xb087('0x17')],{'raw':_0x330005[_0xb087('0x18')]?_0x330005[_0xb087('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ea3dc){logger['info'](_0xb087('0x19'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x19'),_0x330005,JSON[_0xb087('0x11')](_0x5ea3dc));_0x17200d(_0x5ea3dc);})[_0xb087('0x1a')](function(_0x258b4c){logger[_0xb087('0x12')]('CreateOpenchannelQueueReport',_0x258b4c[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x258b4c[_0xb087('0x14')]));});});};exports[_0xb087('0x1b')]=function(_0x3ad74e){var _0x4d9028=this;return new Promise(function(_0x183eab,_0xdd4216){return db['OpenchannelQueueReport']['update'](_0x3ad74e['body'],{'raw':_0x3ad74e['options']?_0x3ad74e['options'][_0xb087('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1d')]||null:null,'attributes':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1e')]||null:null,'limit':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1f')]||null:null})[_0xb087('0xc')](function(_0x31e3e6){logger[_0xb087('0xd')](_0xb087('0x1b'),_0x3ad74e);logger['debug'](_0xb087('0x1b'),_0x3ad74e,JSON[_0xb087('0x11')](_0x31e3e6));_0x183eab(_0x31e3e6);})[_0xb087('0x1a')](function(_0x15c9ac){logger[_0xb087('0x12')](_0xb087('0x1b'),_0x15c9ac[_0xb087('0x14')],_0x3ad74e);_0xdd4216(_0x4d9028[_0xb087('0x12')](0x1f4,_0x15c9ac['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7d85d47..e3d478d 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 _0x2c65=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','multer'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x2c65,0x11c));var _0x52c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c65[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x52c6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x52c6('0x1'));var express=require('express');var router=express[_0x52c6('0x2')]();var fs_extra=require(_0x52c6('0x3'));var auth=require(_0x52c6('0x4'));var interaction=require(_0x52c6('0x5'));var config=require(_0x52c6('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0x52c6('0x7')]('/',auth[_0x52c6('0x8')](),controller[_0x52c6('0x9')]);router[_0x52c6('0x7')](_0x52c6('0xa'),auth['isAuthenticated'](),controller[_0x52c6('0xb')]);router['get']('/:id',auth[_0x52c6('0x8')](),controller[_0x52c6('0xc')]);router[_0x52c6('0xd')]('/',auth[_0x52c6('0x8')](),controller[_0x52c6('0xe')]);router[_0x52c6('0xf')]('/:id',auth[_0x52c6('0x8')](),controller[_0x52c6('0x10')]);router[_0x52c6('0x11')](_0x52c6('0x12'),auth[_0x52c6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb86d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0xbb11d0,_0x5c7ddd){var _0x59a429=function(_0x2eb09a){while(--_0x2eb09a){_0xbb11d0['push'](_0xbb11d0['shift']());}};_0x59a429(++_0x5c7ddd);}(_0xb86d,0x17a));var _0xdb86=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb86d[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xdb86('0x0'));var util=require(_0xdb86('0x1'));var path=require(_0xdb86('0x2'));var timeout=require(_0xdb86('0x3'));var express=require(_0xdb86('0x4'));var router=express['Router']();var fs_extra=require(_0xdb86('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdb86('0x6'));var controller=require(_0xdb86('0x7'));router[_0xdb86('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb86('0x9')]);router['get'](_0xdb86('0xa'),auth[_0xdb86('0xb')](),controller[_0xdb86('0xc')]);router[_0xdb86('0x8')](_0xdb86('0xd'),auth[_0xdb86('0xb')](),controller[_0xdb86('0xe')]);router[_0xdb86('0xf')]('/',auth[_0xdb86('0xb')](),controller[_0xdb86('0x10')]);router[_0xdb86('0x11')](_0xdb86('0xd'),auth[_0xdb86('0xb')](),controller[_0xdb86('0x12')]);router[_0xdb86('0x13')]('/:id',auth[_0xdb86('0xb')](),controller[_0xdb86('0x14')]);module[_0xdb86('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 244460a..7bc45d3 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x47aaae,_0x44b14c){var _0x3a087b=function(_0x3914be){while(--_0x3914be){_0x47aaae['push'](_0x47aaae['shift']());}};_0x3a087b(++_0x44b14c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xcb91[_0x946518];return _0x909b69;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x487706,_0x5c9fbe){var _0x49f24d=function(_0x3a30bc){while(--_0x3a30bc){_0x487706['push'](_0x487706['shift']());}};_0x49f24d(++_0x5c9fbe);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1f8c22,_0x446231){_0x1f8c22=_0x1f8c22-0x0;var _0x379b3a=_0xf4eb[_0x1f8c22];return _0x379b3a;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 1cdd216..09d2b85 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 _0xfda4=['type','VIRTUAL','options','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfda4,0x174));var _0x4fda=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xfda4[_0x163691];return _0x543ae5;};'use strict';var emlformat=require(_0x4fda('0x0'));var rimraf=require(_0x4fda('0x1'));var zipdir=require(_0x4fda('0x2'));var jsonpatch=require(_0x4fda('0x3'));var rp=require(_0x4fda('0x4'));var moment=require(_0x4fda('0x5'));var BPromise=require(_0x4fda('0x6'));var Mustache=require(_0x4fda('0x7'));var util=require('util');var path=require(_0x4fda('0x8'));var sox=require('sox');var csv=require(_0x4fda('0x9'));var ejs=require(_0x4fda('0xa'));var fs=require('fs');var fs_extra=require(_0x4fda('0xb'));var _=require('lodash');var squel=require(_0x4fda('0xc'));var crypto=require('crypto');var jsforce=require(_0x4fda('0xd'));var deskjs=require(_0x4fda('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4fda('0xf'));var Papa=require(_0x4fda('0x10'));var Redis=require(_0x4fda('0x11'));var authService=require(_0x4fda('0x12'));var qs=require(_0x4fda('0x13'));var as=require(_0x4fda('0x14'));var hardwareService=require(_0x4fda('0x15'));var logger=require(_0x4fda('0x16'))(_0x4fda('0x17'));var utils=require('../../config/utils');var config=require(_0x4fda('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fda('0x19'))['db'];function respondWithStatusCode(_0x8e5418,_0x414de0){_0x414de0=_0x414de0||0xcc;return function(_0x10044){if(_0x10044){return _0x8e5418[_0x4fda('0x1a')](_0x414de0);}return _0x8e5418[_0x4fda('0x1b')](_0x414de0)[_0x4fda('0x1c')]();};}function respondWithResult(_0x5ecb2a,_0xfa1a46){_0xfa1a46=_0xfa1a46||0xc8;return function(_0x4ec02a){if(_0x4ec02a){return _0x5ecb2a[_0x4fda('0x1b')](_0xfa1a46)[_0x4fda('0x1d')](_0x4ec02a);}};}function respondWithFilteredResult(_0x4733d6,_0x59cfdf){return function(_0xc6f850){if(_0xc6f850){var _0x44777e=typeof _0x59cfdf[_0x4fda('0x1e')]===_0x4fda('0x1f')&&typeof _0x59cfdf[_0x4fda('0x20')]===_0x4fda('0x1f');var _0x2aee8b=_0xc6f850['count'];var _0x5ac3ff=_0x44777e?0x0:_0x59cfdf['offset'];var _0x47837e=_0x44777e?_0xc6f850[_0x4fda('0x21')]:_0x59cfdf[_0x4fda('0x1e')]+_0x59cfdf['limit'];var _0x5dc600;if(_0x47837e>=_0x2aee8b){_0x47837e=_0x2aee8b;_0x5dc600=0xc8;}else{_0x5dc600=0xce;}_0x4733d6[_0x4fda('0x1b')](_0x5dc600);return _0x4733d6[_0x4fda('0x22')]('Content-Range',_0x5ac3ff+'-'+_0x47837e+'/'+_0x2aee8b)[_0x4fda('0x1d')](_0xc6f850);}return null;};}function patchUpdates(_0x37795d){return function(_0x273a60){try{jsonpatch[_0x4fda('0x23')](_0x273a60,_0x37795d,!![]);}catch(_0x523197){return BPromise['reject'](_0x523197);}return _0x273a60[_0x4fda('0x24')]();};}function saveUpdates(_0x4c7416,_0x4249ce){return function(_0x12de79){if(_0x12de79){return _0x12de79[_0x4fda('0x25')](_0x4c7416)[_0x4fda('0x26')](function(_0x409730){return _0x409730;});}return null;};}function removeEntity(_0x105dad,_0x1a4ec7){return function(_0x4c0168){if(_0x4c0168){return _0x4c0168[_0x4fda('0x27')]()[_0x4fda('0x26')](function(){_0x105dad[_0x4fda('0x1b')](0xcc)[_0x4fda('0x1c')]();});}};}function handleEntityNotFound(_0x23ddff,_0x20d556){return function(_0x2ea5f0){if(!_0x2ea5f0){_0x23ddff['sendStatus'](0x194);}return _0x2ea5f0;};}function handleError(_0x474ab3,_0x2acccd){_0x2acccd=_0x2acccd||0x1f4;return function(_0x4701ce){logger['error'](_0x4701ce[_0x4fda('0x28')]);if(_0x4701ce[_0x4fda('0x29')]){delete _0x4701ce[_0x4fda('0x29')];}_0x474ab3[_0x4fda('0x1b')](_0x2acccd)['send'](_0x4701ce);};}exports[_0x4fda('0x2a')]=function(_0x403ad7,_0xa4b325){var _0x122b9b={},_0x446063={},_0x2890d9={'count':0x0,'rows':[]};var _0x29ffb3=_[_0x4fda('0x2b')](db[_0x4fda('0x2c')][_0x4fda('0x2d')],function(_0x531666){return{'name':_0x531666['fieldName'],'type':_0x531666['type'][_0x4fda('0x2e')]};});_0x446063[_0x4fda('0x2f')]=_[_0x4fda('0x2b')](_0x29ffb3,_0x4fda('0x29'));_0x446063[_0x4fda('0x30')]=_[_0x4fda('0x31')](_0x403ad7[_0x4fda('0x30')]);_0x446063['filters']=_[_0x4fda('0x32')](_0x446063[_0x4fda('0x2f')],_0x446063[_0x4fda('0x30')]);_0x122b9b[_0x4fda('0x33')]=_[_0x4fda('0x32')](_0x446063[_0x4fda('0x2f')],qs[_0x4fda('0x34')](_0x403ad7[_0x4fda('0x30')][_0x4fda('0x34')]));_0x122b9b[_0x4fda('0x33')]=_0x122b9b['attributes']['length']?_0x122b9b[_0x4fda('0x33')]:_0x446063[_0x4fda('0x2f')];if(!_0x403ad7[_0x4fda('0x30')][_0x4fda('0x35')]('nolimit')){_0x122b9b['limit']=qs['limit'](_0x403ad7[_0x4fda('0x30')]['limit']);_0x122b9b['offset']=qs[_0x4fda('0x1e')](_0x403ad7[_0x4fda('0x30')][_0x4fda('0x1e')]);}_0x122b9b[_0x4fda('0x36')]=qs[_0x4fda('0x37')](_0x403ad7[_0x4fda('0x30')][_0x4fda('0x37')]);_0x122b9b['where']=qs[_0x4fda('0x38')](_[_0x4fda('0x39')](_0x403ad7[_0x4fda('0x30')],_0x446063[_0x4fda('0x38')]),_0x29ffb3);if(_0x403ad7[_0x4fda('0x30')]['filter']){_0x122b9b[_0x4fda('0x3a')]=_[_0x4fda('0x3b')](_0x122b9b[_0x4fda('0x3a')],{'$or':_[_0x4fda('0x2b')](_0x29ffb3,function(_0x55931a){if(_0x55931a[_0x4fda('0x3c')]!==_0x4fda('0x3d')){var _0x2f32f2={};_0x2f32f2[_0x55931a['name']]={'$like':'%'+_0x403ad7['query']['filter']+'%'};return _0x2f32f2;}})});}_0x122b9b=_['merge']({},_0x122b9b,_0x403ad7[_0x4fda('0x3e')]);var _0x4f7d90={'where':_0x122b9b[_0x4fda('0x3a')]};return db[_0x4fda('0x2c')][_0x4fda('0x21')](_0x4f7d90)[_0x4fda('0x26')](function(_0x3ee265){_0x2890d9[_0x4fda('0x21')]=_0x3ee265;if(_0x403ad7[_0x4fda('0x30')]['includeAll']){_0x122b9b['include']=[{'all':!![]}];}return db[_0x4fda('0x2c')][_0x4fda('0x3f')](_0x122b9b);})[_0x4fda('0x26')](function(_0x2172e8){_0x2890d9['rows']=_0x2172e8;return _0x2890d9;})[_0x4fda('0x26')](respondWithFilteredResult(_0xa4b325,_0x122b9b))[_0x4fda('0x40')](handleError(_0xa4b325,null));};exports[_0x4fda('0x41')]=function(_0x494e39,_0x3eaf06){var _0x1ca1cf={'raw':!![],'where':{'id':_0x494e39['params']['id']}},_0x517e7f={};_0x517e7f['model']=_[_0x4fda('0x31')](db[_0x4fda('0x2c')][_0x4fda('0x2d')]);_0x517e7f['query']=_[_0x4fda('0x31')](_0x494e39[_0x4fda('0x30')]);_0x517e7f[_0x4fda('0x38')]=_[_0x4fda('0x32')](_0x517e7f[_0x4fda('0x2f')],_0x517e7f[_0x4fda('0x30')]);_0x1ca1cf[_0x4fda('0x33')]=_[_0x4fda('0x32')](_0x517e7f['model'],qs['fields'](_0x494e39[_0x4fda('0x30')][_0x4fda('0x34')]));_0x1ca1cf[_0x4fda('0x33')]=_0x1ca1cf[_0x4fda('0x33')]['length']?_0x1ca1cf[_0x4fda('0x33')]:_0x517e7f[_0x4fda('0x2f')];if(_0x494e39[_0x4fda('0x30')][_0x4fda('0x42')]){_0x1ca1cf['include']=[{'all':!![]}];}_0x1ca1cf=_['merge']({},_0x1ca1cf,_0x494e39[_0x4fda('0x3e')]);return db[_0x4fda('0x2c')][_0x4fda('0x43')](_0x1ca1cf)[_0x4fda('0x26')](handleEntityNotFound(_0x3eaf06,null))[_0x4fda('0x26')](respondWithResult(_0x3eaf06,null))[_0x4fda('0x40')](handleError(_0x3eaf06,null));};exports[_0x4fda('0x44')]=function(_0x390d86,_0x1f0854){return db[_0x4fda('0x2c')]['create'](_0x390d86[_0x4fda('0x45')],{})['then'](respondWithResult(_0x1f0854,0xc9))[_0x4fda('0x40')](handleError(_0x1f0854,null));};exports[_0x4fda('0x25')]=function(_0x2d1115,_0x1f3def){if(_0x2d1115[_0x4fda('0x45')]['id']){delete _0x2d1115['body']['id'];}return db[_0x4fda('0x2c')][_0x4fda('0x43')]({'where':{'id':_0x2d1115[_0x4fda('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f3def,null))[_0x4fda('0x26')](saveUpdates(_0x2d1115[_0x4fda('0x45')],null))[_0x4fda('0x26')](respondWithResult(_0x1f3def,null))[_0x4fda('0x40')](handleError(_0x1f3def,null));};exports[_0x4fda('0x27')]=function(_0xd6c60b,_0xd5e704){return db[_0x4fda('0x2c')][_0x4fda('0x43')]({'where':{'id':_0xd6c60b['params']['id']}})[_0x4fda('0x26')](handleEntityNotFound(_0xd5e704,null))['then'](removeEntity(_0xd5e704,null))[_0x4fda('0x40')](handleError(_0xd5e704,null));};exports[_0x4fda('0x47')]=function(_0x43d068,_0xf91266){return db[_0x4fda('0x2c')][_0x4fda('0x47')]()[_0x4fda('0x26')](respondWithResult(_0xf91266,null))[_0x4fda('0x40')](handleError(_0xf91266,null));}; \ No newline at end of file +var _0x621f=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x243bba,_0x1ea69f){var _0x12e696=function(_0x5d3ab5){while(--_0x5d3ab5){_0x243bba['push'](_0x243bba['shift']());}};_0x12e696(++_0x1ea69f);}(_0x621f,0x128));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf621('0x0'));var rimraf=require(_0xf621('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf621('0x2'));var rp=require(_0xf621('0x3'));var moment=require(_0xf621('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf621('0x5'));var util=require(_0xf621('0x6'));var path=require(_0xf621('0x7'));var sox=require(_0xf621('0x8'));var csv=require(_0xf621('0x9'));var ejs=require(_0xf621('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf621('0xb'));var squel=require('squel');var crypto=require(_0xf621('0xc'));var jsforce=require(_0xf621('0xd'));var deskjs=require(_0xf621('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf621('0xf'));var Papa=require(_0xf621('0x10'));var Redis=require(_0xf621('0x11'));var authService=require(_0xf621('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf621('0x13'));var hardwareService=require(_0xf621('0x14'));var logger=require(_0xf621('0x15'))(_0xf621('0x16'));var utils=require('../../config/utils');var config=require(_0xf621('0x17'));var licenseUtil=require(_0xf621('0x18'));var db=require(_0xf621('0x19'))['db'];function respondWithStatusCode(_0x2c93d2,_0x5ec2a0){_0x5ec2a0=_0x5ec2a0||0xcc;return function(_0x5297b0){if(_0x5297b0){return _0x2c93d2[_0xf621('0x1a')](_0x5ec2a0);}return _0x2c93d2[_0xf621('0x1b')](_0x5ec2a0)[_0xf621('0x1c')]();};}function respondWithResult(_0x264844,_0x3e66f0){_0x3e66f0=_0x3e66f0||0xc8;return function(_0x5c357b){if(_0x5c357b){return _0x264844[_0xf621('0x1b')](_0x3e66f0)['json'](_0x5c357b);}};}function respondWithFilteredResult(_0x1fef00,_0x542588){return function(_0x573914){if(_0x573914){var _0x33f743=typeof _0x542588[_0xf621('0x1d')]===_0xf621('0x1e')&&typeof _0x542588[_0xf621('0x1f')]===_0xf621('0x1e');var _0xdd131a=_0x573914['count'];var _0x3961f7=_0x33f743?0x0:_0x542588[_0xf621('0x1d')];var _0x125820=_0x33f743?_0x573914[_0xf621('0x20')]:_0x542588[_0xf621('0x1d')]+_0x542588[_0xf621('0x1f')];var _0xaf0c39;if(_0x125820>=_0xdd131a){_0x125820=_0xdd131a;_0xaf0c39=0xc8;}else{_0xaf0c39=0xce;}_0x1fef00[_0xf621('0x1b')](_0xaf0c39);return _0x1fef00[_0xf621('0x21')](_0xf621('0x22'),_0x3961f7+'-'+_0x125820+'/'+_0xdd131a)[_0xf621('0x23')](_0x573914);}return null;};}function patchUpdates(_0x15f919){return function(_0x479760){try{jsonpatch['apply'](_0x479760,_0x15f919,!![]);}catch(_0x4aca68){return BPromise[_0xf621('0x24')](_0x4aca68);}return _0x479760[_0xf621('0x25')]();};}function saveUpdates(_0x432e65,_0x1d275b){return function(_0x52e45e){if(_0x52e45e){return _0x52e45e['update'](_0x432e65)['then'](function(_0x28c906){return _0x28c906;});}return null;};}function removeEntity(_0xd77b9d,_0x535d9e){return function(_0x159ae1){if(_0x159ae1){return _0x159ae1[_0xf621('0x26')]()[_0xf621('0x27')](function(){_0xd77b9d[_0xf621('0x1b')](0xcc)[_0xf621('0x1c')]();});}};}function handleEntityNotFound(_0x189d95,_0x1af238){return function(_0x1bbb72){if(!_0x1bbb72){_0x189d95[_0xf621('0x1a')](0x194);}return _0x1bbb72;};}function handleError(_0x2a4e43,_0x5f05cd){_0x5f05cd=_0x5f05cd||0x1f4;return function(_0x25e334){logger[_0xf621('0x28')](_0x25e334[_0xf621('0x29')]);if(_0x25e334[_0xf621('0x2a')]){delete _0x25e334['name'];}_0x2a4e43[_0xf621('0x1b')](_0x5f05cd)[_0xf621('0x2b')](_0x25e334);};}exports[_0xf621('0x2c')]=function(_0x2200b9,_0xd05380){var _0x193c19={},_0x599ac9={},_0x4b76fc={'count':0x0,'rows':[]};var _0x1e93d4=_[_0xf621('0x2d')](db[_0xf621('0x2e')][_0xf621('0x2f')],function(_0x343a24){return{'name':_0x343a24[_0xf621('0x30')],'type':_0x343a24[_0xf621('0x31')][_0xf621('0x32')]};});_0x599ac9[_0xf621('0x33')]=_[_0xf621('0x2d')](_0x1e93d4,_0xf621('0x2a'));_0x599ac9['query']=_['keys'](_0x2200b9[_0xf621('0x34')]);_0x599ac9['filters']=_[_0xf621('0x35')](_0x599ac9[_0xf621('0x33')],_0x599ac9[_0xf621('0x34')]);_0x193c19['attributes']=_['intersection'](_0x599ac9['model'],qs['fields'](_0x2200b9[_0xf621('0x34')][_0xf621('0x36')]));_0x193c19[_0xf621('0x37')]=_0x193c19[_0xf621('0x37')][_0xf621('0x38')]?_0x193c19[_0xf621('0x37')]:_0x599ac9[_0xf621('0x33')];if(!_0x2200b9['query']['hasOwnProperty']('nolimit')){_0x193c19[_0xf621('0x1f')]=qs[_0xf621('0x1f')](_0x2200b9[_0xf621('0x34')][_0xf621('0x1f')]);_0x193c19[_0xf621('0x1d')]=qs[_0xf621('0x1d')](_0x2200b9[_0xf621('0x34')][_0xf621('0x1d')]);}_0x193c19[_0xf621('0x39')]=qs[_0xf621('0x3a')](_0x2200b9['query'][_0xf621('0x3a')]);_0x193c19['where']=qs[_0xf621('0x3b')](_['pick'](_0x2200b9[_0xf621('0x34')],_0x599ac9[_0xf621('0x3b')]),_0x1e93d4);if(_0x2200b9['query'][_0xf621('0x3c')]){_0x193c19['where']=_[_0xf621('0x3d')](_0x193c19[_0xf621('0x3e')],{'$or':_[_0xf621('0x2d')](_0x1e93d4,function(_0x56f2c1){if(_0x56f2c1[_0xf621('0x31')]!==_0xf621('0x3f')){var _0x1b5ee0={};_0x1b5ee0[_0x56f2c1[_0xf621('0x2a')]]={'$like':'%'+_0x2200b9[_0xf621('0x34')][_0xf621('0x3c')]+'%'};return _0x1b5ee0;}})});}_0x193c19=_[_0xf621('0x3d')]({},_0x193c19,_0x2200b9[_0xf621('0x40')]);var _0xc3bc34={'where':_0x193c19[_0xf621('0x3e')]};return db[_0xf621('0x2e')][_0xf621('0x20')](_0xc3bc34)[_0xf621('0x27')](function(_0x25d94a){_0x4b76fc[_0xf621('0x20')]=_0x25d94a;if(_0x2200b9[_0xf621('0x34')][_0xf621('0x41')]){_0x193c19[_0xf621('0x42')]=[{'all':!![]}];}return db[_0xf621('0x2e')][_0xf621('0x43')](_0x193c19);})[_0xf621('0x27')](function(_0x192bf9){_0x4b76fc[_0xf621('0x44')]=_0x192bf9;return _0x4b76fc;})[_0xf621('0x27')](respondWithFilteredResult(_0xd05380,_0x193c19))[_0xf621('0x45')](handleError(_0xd05380,null));};exports['show']=function(_0x40c98b,_0x45f82e){var _0x160e3f={'raw':!![],'where':{'id':_0x40c98b[_0xf621('0x46')]['id']}},_0x3566ad={};_0x3566ad[_0xf621('0x33')]=_[_0xf621('0x47')](db['OpenchannelTransferReport'][_0xf621('0x2f')]);_0x3566ad['query']=_['keys'](_0x40c98b['query']);_0x3566ad[_0xf621('0x3b')]=_[_0xf621('0x35')](_0x3566ad[_0xf621('0x33')],_0x3566ad[_0xf621('0x34')]);_0x160e3f['attributes']=_[_0xf621('0x35')](_0x3566ad['model'],qs['fields'](_0x40c98b[_0xf621('0x34')][_0xf621('0x36')]));_0x160e3f['attributes']=_0x160e3f[_0xf621('0x37')][_0xf621('0x38')]?_0x160e3f[_0xf621('0x37')]:_0x3566ad[_0xf621('0x33')];if(_0x40c98b[_0xf621('0x34')][_0xf621('0x41')]){_0x160e3f['include']=[{'all':!![]}];}_0x160e3f=_[_0xf621('0x3d')]({},_0x160e3f,_0x40c98b['options']);return db[_0xf621('0x2e')][_0xf621('0x48')](_0x160e3f)[_0xf621('0x27')](handleEntityNotFound(_0x45f82e,null))[_0xf621('0x27')](respondWithResult(_0x45f82e,null))[_0xf621('0x45')](handleError(_0x45f82e,null));};exports[_0xf621('0x49')]=function(_0x56fa2e,_0x4f7e5c){return db['OpenchannelTransferReport'][_0xf621('0x49')](_0x56fa2e[_0xf621('0x4a')],{})[_0xf621('0x27')](respondWithResult(_0x4f7e5c,0xc9))[_0xf621('0x45')](handleError(_0x4f7e5c,null));};exports[_0xf621('0x4b')]=function(_0x384122,_0x4b917d){if(_0x384122[_0xf621('0x4a')]['id']){delete _0x384122[_0xf621('0x4a')]['id'];}return db[_0xf621('0x2e')][_0xf621('0x48')]({'where':{'id':_0x384122[_0xf621('0x46')]['id']}})[_0xf621('0x27')](handleEntityNotFound(_0x4b917d,null))[_0xf621('0x27')](saveUpdates(_0x384122[_0xf621('0x4a')],null))[_0xf621('0x27')](respondWithResult(_0x4b917d,null))[_0xf621('0x45')](handleError(_0x4b917d,null));};exports[_0xf621('0x26')]=function(_0x597b99,_0xb0df28){return db[_0xf621('0x2e')][_0xf621('0x48')]({'where':{'id':_0x597b99[_0xf621('0x46')]['id']}})[_0xf621('0x27')](handleEntityNotFound(_0xb0df28,null))[_0xf621('0x27')](removeEntity(_0xb0df28,null))['catch'](handleError(_0xb0df28,null));};exports['describe']=function(_0x4b8878,_0x6c76f3){return db['OpenchannelTransferReport'][_0xf621('0x4c')]()['then'](respondWithResult(_0x6c76f3,null))[_0xf621('0x45')](handleError(_0x6c76f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1d58be6..f486cc5 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 _0xe5b6=['uniqueid','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x370c99,_0x266246){var _0x4f0d90=function(_0x156daa){while(--_0x156daa){_0x370c99['push'](_0x370c99['shift']());}};_0x4f0d90(++_0x266246);}(_0xe5b6,0x12a));var _0x6e5b=function(_0x13d959,_0x3ec938){_0x13d959=_0x13d959-0x0;var _0x4296cb=_0xe5b6[_0x13d959];return _0x4296cb;};'use strict';var _=require(_0x6e5b('0x0'));var util=require('util');var logger=require(_0x6e5b('0x1'))(_0x6e5b('0x2'));var moment=require(_0x6e5b('0x3'));var BPromise=require(_0x6e5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e5b('0x5'));var rimraf=require('rimraf');var config=require(_0x6e5b('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6e5b('0x7')]=function(_0x51e30b,_0x5854c2){return _0x51e30b['define'](_0x6e5b('0x8'),attributes,{'tableName':_0x6e5b('0x9'),'paranoid':![],'indexes':[{'name':_0x6e5b('0xa'),'fields':[_0x6e5b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0e4=['../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash'];(function(_0xeedde5,_0x2ef5b4){var _0x5b4b0a=function(_0x5ee87c){while(--_0x5ee87c){_0xeedde5['push'](_0xeedde5['shift']());}};_0x5b4b0a(++_0x2ef5b4);}(_0xc0e4,0xe3));var _0x4c0e=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xc0e4[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0x4c0e('0x0'));var util=require('util');var logger=require(_0x4c0e('0x1'))(_0x4c0e('0x2'));var moment=require(_0x4c0e('0x3'));var BPromise=require(_0x4c0e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c0e('0x5'));var rimraf=require('rimraf');var config=require(_0x4c0e('0x6'));var attributes=require(_0x4c0e('0x7'));module[_0x4c0e('0x8')]=function(_0x3a8c0e,_0x2b25cb){return _0x3a8c0e[_0x4c0e('0x9')](_0x4c0e('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4c0e('0xb'),'fields':[_0x4c0e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 81e80b4..0f966de 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 _0x0bde=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf7cf9b,_0x1dc1d2){var _0x350a5d=function(_0x37a74e){while(--_0x37a74e){_0xf7cf9b['push'](_0xf7cf9b['shift']());}};_0x350a5d(++_0x1dc1d2);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe0bd('0x0'));var moment=require('moment');var BPromise=require(_0xe0bd('0x1'));var rs=require(_0xe0bd('0x2'));var fs=require('fs');var Redis=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];var utils=require(_0xe0bd('0x5'));var logger=require('../../config/logger')(_0xe0bd('0x6'));var config=require(_0xe0bd('0x7'));var jayson=require(_0xe0bd('0x8'));var client=jayson[_0xe0bd('0x9')][_0xe0bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26393f,_0x217145,_0x491dc7){return new BPromise(function(_0x40b36a,_0x44cb0b){return client[_0xe0bd('0xb')](_0x26393f,_0x491dc7)[_0xe0bd('0xc')](function(_0x393379){logger[_0xe0bd('0xd')](_0xe0bd('0xe'),_0x217145,_0xe0bd('0xf'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x217145,'request\x20sent',JSON[_0xe0bd('0x10')](_0x393379));if(_0x393379['error']){if(_0x393379['error'][_0xe0bd('0x11')]===0x1f4){logger[_0xe0bd('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,_0x393379[_0xe0bd('0x12')]['message']);return _0x44cb0b(_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);}logger[_0xe0bd('0x12')](_0xe0bd('0xe'),_0x217145,_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);return _0x40b36a(_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,'request\x20sent');_0x40b36a(_0x393379[_0xe0bd('0x14')][_0xe0bd('0x13')]);}})[_0xe0bd('0x15')](function(_0x379ea2){logger[_0xe0bd('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,_0x379ea2);_0x44cb0b(_0x379ea2);});});} \ No newline at end of file +var _0x6726=['request\x20sent','debug','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x40e102,_0x560ec6){var _0x16fe02=function(_0x7e6047){while(--_0x7e6047){_0x40e102['push'](_0x40e102['shift']());}};_0x16fe02(++_0x560ec6);}(_0x6726,0xdb));var _0x6672=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x6726[_0x13b7fd];return _0x32a74a;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var moment=require(_0x6672('0x1'));var BPromise=require('bluebird');var rs=require(_0x6672('0x2'));var fs=require('fs');var Redis=require(_0x6672('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6672('0x4'));var logger=require('../../config/logger')(_0x6672('0x5'));var config=require(_0x6672('0x6'));var jayson=require(_0x6672('0x7'));var client=jayson[_0x6672('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa1d3b7,_0x303146,_0x263321){return new BPromise(function(_0x379b90,_0xc53855){return client[_0x6672('0x9')](_0xa1d3b7,_0x263321)[_0x6672('0xa')](function(_0x3c093b){logger[_0x6672('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x303146,_0x6672('0xc'));logger[_0x6672('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x303146,_0x6672('0xc'),JSON[_0x6672('0xe')](_0x3c093b));if(_0x3c093b[_0x6672('0xf')]){if(_0x3c093b[_0x6672('0xf')][_0x6672('0x10')]===0x1f4){logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);return _0xc53855(_0x3c093b['error'][_0x6672('0x12')]);}logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);return _0x379b90(_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);}else{logger['info'](_0x6672('0x11'),_0x303146,_0x6672('0xc'));_0x379b90(_0x3c093b[_0x6672('0x13')][_0x6672('0x12')]);}})[_0x6672('0x14')](function(_0x6884f){logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x6884f);_0xc53855(_0x6884f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 086c513..9c8ed87 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 _0x81df=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer'];(function(_0x4ba44d,_0x408d9f){var _0x3637eb=function(_0xa01a7c){while(--_0xa01a7c){_0x4ba44d['push'](_0x4ba44d['shift']());}};_0x3637eb(++_0x408d9f);}(_0x81df,0xb3));var _0xf81d=function(_0x3b4932,_0x1daf07){_0x3b4932=_0x3b4932-0x0;var _0x1fac48=_0x81df[_0x3b4932];return _0x1fac48;};'use strict';var multer=require(_0xf81d('0x0'));var util=require(_0xf81d('0x1'));var path=require(_0xf81d('0x2'));var timeout=require(_0xf81d('0x3'));var express=require(_0xf81d('0x4'));var router=express[_0xf81d('0x5')]();var fs_extra=require(_0xf81d('0x6'));var auth=require(_0xf81d('0x7'));var interaction=require(_0xf81d('0x8'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0xf81d('0x9')]('/',auth[_0xf81d('0xa')](),controller[_0xf81d('0xb')]);router['get'](_0xf81d('0xc'),auth[_0xf81d('0xa')](),controller['show']);router[_0xf81d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf81d('0xe')](_0xf81d('0xc'),auth[_0xf81d('0xa')](),controller[_0xf81d('0xf')]);router[_0xf81d('0x10')]('/:id',auth[_0xf81d('0xa')](),controller['destroy']);module[_0xf81d('0x11')]=router; \ No newline at end of file +var _0x0cf3=['../../components/auth/service','../../components/interaction/service','./pause.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer','express','Router','fs-extra'];(function(_0x2a9a77,_0x431033){var _0x2d8525=function(_0x59170a){while(--_0x59170a){_0x2a9a77['push'](_0x2a9a77['shift']());}};_0x2d8525(++_0x431033);}(_0x0cf3,0x95));var _0x30cf=function(_0x54fdbb,_0x46eab4){_0x54fdbb=_0x54fdbb-0x0;var _0x3492c3=_0x0cf3[_0x54fdbb];return _0x3492c3;};'use strict';var multer=require(_0x30cf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30cf('0x1'));var router=express[_0x30cf('0x2')]();var fs_extra=require(_0x30cf('0x3'));var auth=require(_0x30cf('0x4'));var interaction=require(_0x30cf('0x5'));var config=require('../../config/environment');var controller=require(_0x30cf('0x6'));router[_0x30cf('0x7')]('/',auth['isAuthenticated'](),controller[_0x30cf('0x8')]);router['get'](_0x30cf('0x9'),auth[_0x30cf('0xa')](),controller[_0x30cf('0xb')]);router[_0x30cf('0xc')]('/',auth[_0x30cf('0xa')](),controller['create']);router['put']('/:id',auth[_0x30cf('0xa')](),controller[_0x30cf('0xd')]);router[_0x30cf('0xe')](_0x30cf('0x9'),auth[_0x30cf('0xa')](),controller[_0x30cf('0xf')]);module[_0x30cf('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2526a72..b52e261 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 _0x5caa=['STRING'];(function(_0x32b1c0,_0x2396f){var _0x50bd24=function(_0x2717da){while(--_0x2717da){_0x32b1c0['push'](_0x32b1c0['shift']());}};_0x50bd24(++_0x2396f);}(_0x5caa,0x1e3));var _0xa5ca=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0x5caa[_0x4f9d26];return _0x57debc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa5ca('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa5ca('0x0')]}}; \ No newline at end of file +var _0x36e0=['exports','STRING','name','sequelize'];(function(_0x38f34e,_0xfc706c){var _0x5d85ef=function(_0x19c2ac){while(--_0x19c2ac){_0x38f34e['push'](_0x38f34e['shift']());}};_0x5d85ef(++_0xfc706c);}(_0x36e0,0x107));var _0x036e=function(_0xc14c6c,_0x552a87){_0xc14c6c=_0xc14c6c-0x0;var _0x15a1cc=_0x36e0[_0xc14c6c];return _0x15a1cc;};'use strict';var Sequelize=require(_0x036e('0x0'));module[_0x036e('0x1')]={'name':{'type':Sequelize[_0x036e('0x2')],'unique':_0x036e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x036e('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 349b709..6309ebd 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 _0xc42a=['catch','show','params','rawAttributes','length','includeAll','find','create','body','user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','limit','count','set','json','save','update','then','destroy','Pauses','UserProfileResource','sendStatus','error','name','map','Pause','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','include','rows'];(function(_0x5e6216,_0x38308b){var _0x3c7246=function(_0x3b94c2){while(--_0x3b94c2){_0x5e6216['push'](_0x5e6216['shift']());}};_0x3c7246(++_0x38308b);}(_0xc42a,0x98));var _0xac42=function(_0xf00413,_0x19bf28){_0xf00413=_0xf00413-0x0;var _0x128efc=_0xc42a[_0xf00413];return _0x128efc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac42('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac42('0x1'));var rp=require(_0xac42('0x2'));var moment=require(_0xac42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac42('0x4'));var util=require('util');var path=require(_0xac42('0x5'));var sox=require('sox');var csv=require(_0xac42('0x6'));var ejs=require(_0xac42('0x7'));var fs=require('fs');var fs_extra=require(_0xac42('0x8'));var _=require(_0xac42('0x9'));var squel=require(_0xac42('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac42('0xb'));var toCsv=require(_0xac42('0x6'));var querystring=require(_0xac42('0xc'));var Papa=require(_0xac42('0xd'));var Redis=require('ioredis');var authService=require(_0xac42('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xac42('0xf'));var hardwareService=require(_0xac42('0x10'));var logger=require(_0xac42('0x11'))(_0xac42('0x12'));var utils=require(_0xac42('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac42('0x14'))['db'];function respondWithStatusCode(_0x5811bb,_0x37a601){_0x37a601=_0x37a601||0xcc;return function(_0x5ed251){if(_0x5ed251){return _0x5811bb['sendStatus'](_0x37a601);}return _0x5811bb[_0xac42('0x15')](_0x37a601)[_0xac42('0x16')]();};}function respondWithResult(_0xdafd75,_0x54ea20){_0x54ea20=_0x54ea20||0xc8;return function(_0x4f2011){if(_0x4f2011){return _0xdafd75[_0xac42('0x15')](_0x54ea20)['json'](_0x4f2011);}};}function respondWithFilteredResult(_0x33f25f,_0x210e9f){return function(_0x288d8b){if(_0x288d8b){var _0x8bb3a9=typeof _0x210e9f[_0xac42('0x17')]==='undefined'&&typeof _0x210e9f[_0xac42('0x18')]==='undefined';var _0x2dd2dd=_0x288d8b[_0xac42('0x19')];var _0x4de32a=_0x8bb3a9?0x0:_0x210e9f['offset'];var _0x1893e6=_0x8bb3a9?_0x288d8b[_0xac42('0x19')]:_0x210e9f[_0xac42('0x17')]+_0x210e9f[_0xac42('0x18')];var _0x2f43e6;if(_0x1893e6>=_0x2dd2dd){_0x1893e6=_0x2dd2dd;_0x2f43e6=0xc8;}else{_0x2f43e6=0xce;}_0x33f25f[_0xac42('0x15')](_0x2f43e6);return _0x33f25f[_0xac42('0x1a')]('Content-Range',_0x4de32a+'-'+_0x1893e6+'/'+_0x2dd2dd)[_0xac42('0x1b')](_0x288d8b);}return null;};}function patchUpdates(_0x37cf31){return function(_0x57aaef){try{jsonpatch['apply'](_0x57aaef,_0x37cf31,!![]);}catch(_0x439739){return BPromise['reject'](_0x439739);}return _0x57aaef[_0xac42('0x1c')]();};}function saveUpdates(_0x501619,_0x47bf99){return function(_0x1c94f9){if(_0x1c94f9){return _0x1c94f9[_0xac42('0x1d')](_0x501619)[_0xac42('0x1e')](function(_0x211a55){return _0x211a55;});}return null;};}function removeEntity(_0x475825,_0x5e36df){return function(_0xe6b008){if(_0xe6b008){return _0xe6b008[_0xac42('0x1f')]()[_0xac42('0x1e')](function(){var _0x21b2ff=_0xe6b008['get']({'plain':!![]});var _0x3c15bc=_0xac42('0x20');return db[_0xac42('0x21')][_0xac42('0x1f')]({'where':{'type':_0x3c15bc,'resourceId':_0x21b2ff['id']}})[_0xac42('0x1e')](function(){return _0xe6b008;});})[_0xac42('0x1e')](function(){_0x475825[_0xac42('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca9b3,_0x2db441){return function(_0x3145de){if(!_0x3145de){_0x3ca9b3[_0xac42('0x22')](0x194);}return _0x3145de;};}function handleError(_0x156b82,_0x6722c3){_0x6722c3=_0x6722c3||0x1f4;return function(_0x57d811){logger[_0xac42('0x23')](_0x57d811['stack']);if(_0x57d811['name']){delete _0x57d811[_0xac42('0x24')];}_0x156b82[_0xac42('0x15')](_0x6722c3)['send'](_0x57d811);};}exports['index']=function(_0x440dad,_0x2b0443){var _0x5b967b={},_0x1e36d6={},_0x4109f9={'count':0x0,'rows':[]};var _0x5914e0=_[_0xac42('0x25')](db[_0xac42('0x26')]['rawAttributes'],function(_0x4556be){return{'name':_0x4556be['fieldName'],'type':_0x4556be[_0xac42('0x27')][_0xac42('0x28')]};});_0x1e36d6[_0xac42('0x29')]=_[_0xac42('0x25')](_0x5914e0,_0xac42('0x24'));_0x1e36d6[_0xac42('0x2a')]=_['keys'](_0x440dad['query']);_0x1e36d6[_0xac42('0x2b')]=_['intersection'](_0x1e36d6[_0xac42('0x29')],_0x1e36d6[_0xac42('0x2a')]);_0x5b967b[_0xac42('0x2c')]=_[_0xac42('0x2d')](_0x1e36d6[_0xac42('0x29')],qs[_0xac42('0x2e')](_0x440dad[_0xac42('0x2a')][_0xac42('0x2e')]));_0x5b967b[_0xac42('0x2c')]=_0x5b967b[_0xac42('0x2c')]['length']?_0x5b967b[_0xac42('0x2c')]:_0x1e36d6[_0xac42('0x29')];if(!_0x440dad['query']['hasOwnProperty'](_0xac42('0x2f'))){_0x5b967b[_0xac42('0x18')]=qs[_0xac42('0x18')](_0x440dad[_0xac42('0x2a')][_0xac42('0x18')]);_0x5b967b[_0xac42('0x17')]=qs[_0xac42('0x17')](_0x440dad['query'][_0xac42('0x17')]);}_0x5b967b[_0xac42('0x30')]=qs[_0xac42('0x31')](_0x440dad[_0xac42('0x2a')][_0xac42('0x31')]);_0x5b967b[_0xac42('0x32')]=qs['filters'](_['pick'](_0x440dad[_0xac42('0x2a')],_0x1e36d6[_0xac42('0x2b')]),_0x5914e0);if(_0x440dad[_0xac42('0x2a')][_0xac42('0x33')]){_0x5b967b[_0xac42('0x32')]=_[_0xac42('0x34')](_0x5b967b[_0xac42('0x32')],{'$or':_['map'](_0x5914e0,function(_0x437882){if(_0x437882[_0xac42('0x27')]!=='VIRTUAL'){var _0x17796f={};_0x17796f[_0x437882['name']]={'$like':'%'+_0x440dad[_0xac42('0x2a')][_0xac42('0x33')]+'%'};return _0x17796f;}})});}_0x5b967b=_['merge']({},_0x5b967b,_0x440dad['options']);var _0x25688f={'where':_0x5b967b[_0xac42('0x32')]};return db[_0xac42('0x26')]['count'](_0x25688f)[_0xac42('0x1e')](function(_0x20282c){_0x4109f9[_0xac42('0x19')]=_0x20282c;if(_0x440dad[_0xac42('0x2a')]['includeAll']){_0x5b967b[_0xac42('0x35')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x5b967b);})['then'](function(_0x1fa9b0){_0x4109f9[_0xac42('0x36')]=_0x1fa9b0;return _0x4109f9;})[_0xac42('0x1e')](respondWithFilteredResult(_0x2b0443,_0x5b967b))[_0xac42('0x37')](handleError(_0x2b0443,null));};exports[_0xac42('0x38')]=function(_0x54b766,_0x1924d0){var _0x369686={'raw':!![],'where':{'id':_0x54b766[_0xac42('0x39')]['id']}},_0x5b987c={};_0x5b987c[_0xac42('0x29')]=_['keys'](db['Pause'][_0xac42('0x3a')]);_0x5b987c['query']=_['keys'](_0x54b766[_0xac42('0x2a')]);_0x5b987c[_0xac42('0x2b')]=_[_0xac42('0x2d')](_0x5b987c[_0xac42('0x29')],_0x5b987c[_0xac42('0x2a')]);_0x369686[_0xac42('0x2c')]=_[_0xac42('0x2d')](_0x5b987c[_0xac42('0x29')],qs[_0xac42('0x2e')](_0x54b766[_0xac42('0x2a')][_0xac42('0x2e')]));_0x369686['attributes']=_0x369686[_0xac42('0x2c')][_0xac42('0x3b')]?_0x369686[_0xac42('0x2c')]:_0x5b987c[_0xac42('0x29')];if(_0x54b766[_0xac42('0x2a')][_0xac42('0x3c')]){_0x369686[_0xac42('0x35')]=[{'all':!![]}];}_0x369686=_[_0xac42('0x34')]({},_0x369686,_0x54b766['options']);return db[_0xac42('0x26')][_0xac42('0x3d')](_0x369686)[_0xac42('0x1e')](handleEntityNotFound(_0x1924d0,null))[_0xac42('0x1e')](respondWithResult(_0x1924d0,null))['catch'](handleError(_0x1924d0,null));};exports[_0xac42('0x3e')]=function(_0x359cf7,_0x55d7dc){return db[_0xac42('0x26')]['create'](_0x359cf7[_0xac42('0x3f')],{})[_0xac42('0x1e')](function(_0x1d2437){var _0x54ad96=_0x359cf7[_0xac42('0x40')]['get']({'plain':!![]});if(!_0x54ad96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54ad96[_0xac42('0x41')]===_0xac42('0x40')){var _0x117b36=_0x1d2437[_0xac42('0x42')]({'plain':!![]});var _0x1a1349=_0xac42('0x20');return db['UserProfileSection'][_0xac42('0x3d')]({'where':{'name':_0x1a1349,'userProfileId':_0x54ad96['userProfileId']},'raw':!![]})[_0xac42('0x1e')](function(_0x54d5a3){if(_0x54d5a3&&_0x54d5a3[_0xac42('0x43')]===0x0){return db['UserProfileResource']['create']({'name':_0x117b36[_0xac42('0x24')],'resourceId':_0x117b36['id'],'type':_0x54d5a3[_0xac42('0x24')],'sectionId':_0x54d5a3['id']},{})[_0xac42('0x1e')](function(){return _0x1d2437;});}else{return _0x1d2437;}})['catch'](function(_0x442db6){logger[_0xac42('0x23')](_0xac42('0x44'),_0x442db6);throw _0x442db6;});}return _0x1d2437;})[_0xac42('0x1e')](respondWithResult(_0x55d7dc,0xc9))[_0xac42('0x37')](handleError(_0x55d7dc,null));};exports['update']=function(_0x231cbf,_0x467faa){if(_0x231cbf[_0xac42('0x3f')]['id']){delete _0x231cbf[_0xac42('0x3f')]['id'];}return db[_0xac42('0x26')]['find']({'where':{'id':_0x231cbf[_0xac42('0x39')]['id']}})['then'](handleEntityNotFound(_0x467faa,null))['then'](saveUpdates(_0x231cbf[_0xac42('0x3f')],null))['then'](respondWithResult(_0x467faa,null))[_0xac42('0x37')](handleError(_0x467faa,null));};exports[_0xac42('0x1f')]=function(_0x32e5d7,_0x1fe871){return db[_0xac42('0x26')][_0xac42('0x3d')]({'where':{'id':_0x32e5d7[_0xac42('0x39')]['id']}})[_0xac42('0x1e')](handleEntityNotFound(_0x1fe871,null))[_0xac42('0x1e')](removeEntity(_0x1fe871,null))[_0xac42('0x37')](handleError(_0x1fe871,null));}; \ No newline at end of file +var _0x613d=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Pauses','end','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','findAll','rows','catch','show','params','keys','fields','includeAll','include','options'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x613d,0x1aa));var _0xd613=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x613d[_0x516927];return _0x30749b;};'use strict';var emlformat=require(_0xd613('0x0'));var rimraf=require(_0xd613('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd613('0x2'));var rp=require('request-promise');var moment=require(_0xd613('0x3'));var BPromise=require(_0xd613('0x4'));var Mustache=require('mustache');var util=require(_0xd613('0x5'));var path=require('path');var sox=require(_0xd613('0x6'));var csv=require(_0xd613('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd613('0x8'));var _=require(_0xd613('0x9'));var squel=require(_0xd613('0xa'));var crypto=require(_0xd613('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd613('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd613('0xd'));var Redis=require(_0xd613('0xe'));var authService=require(_0xd613('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd613('0x10'));var hardwareService=require(_0xd613('0x11'));var logger=require(_0xd613('0x12'))(_0xd613('0x13'));var utils=require(_0xd613('0x14'));var config=require(_0xd613('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd613('0x16'))['db'];function respondWithStatusCode(_0x43e2a7,_0x9a7e4a){_0x9a7e4a=_0x9a7e4a||0xcc;return function(_0x5f305e){if(_0x5f305e){return _0x43e2a7[_0xd613('0x17')](_0x9a7e4a);}return _0x43e2a7[_0xd613('0x18')](_0x9a7e4a)['end']();};}function respondWithResult(_0x3f8ab0,_0x3138b2){_0x3138b2=_0x3138b2||0xc8;return function(_0x55246c){if(_0x55246c){return _0x3f8ab0['status'](_0x3138b2)[_0xd613('0x19')](_0x55246c);}};}function respondWithFilteredResult(_0x574564,_0x423ca3){return function(_0x12da21){if(_0x12da21){var _0x4e7a1f=typeof _0x423ca3[_0xd613('0x1a')]===_0xd613('0x1b')&&typeof _0x423ca3[_0xd613('0x1c')]==='undefined';var _0x420a4f=_0x12da21['count'];var _0x4937d9=_0x4e7a1f?0x0:_0x423ca3['offset'];var _0x291c8c=_0x4e7a1f?_0x12da21[_0xd613('0x1d')]:_0x423ca3[_0xd613('0x1a')]+_0x423ca3[_0xd613('0x1c')];var _0x3b4570;if(_0x291c8c>=_0x420a4f){_0x291c8c=_0x420a4f;_0x3b4570=0xc8;}else{_0x3b4570=0xce;}_0x574564[_0xd613('0x18')](_0x3b4570);return _0x574564['set'](_0xd613('0x1e'),_0x4937d9+'-'+_0x291c8c+'/'+_0x420a4f)[_0xd613('0x19')](_0x12da21);}return null;};}function patchUpdates(_0x52af67){return function(_0x387e06){try{jsonpatch['apply'](_0x387e06,_0x52af67,!![]);}catch(_0x4ea70a){return BPromise[_0xd613('0x1f')](_0x4ea70a);}return _0x387e06[_0xd613('0x20')]();};}function saveUpdates(_0x26ca0f,_0x22fe84){return function(_0x170448){if(_0x170448){return _0x170448[_0xd613('0x21')](_0x26ca0f)[_0xd613('0x22')](function(_0x1b1d71){return _0x1b1d71;});}return null;};}function removeEntity(_0x30d985,_0x167d5e){return function(_0xe4a28f){if(_0xe4a28f){return _0xe4a28f[_0xd613('0x23')]()[_0xd613('0x22')](function(){var _0x4f6368=_0xe4a28f[_0xd613('0x24')]({'plain':!![]});var _0x344004=_0xd613('0x25');return db['UserProfileResource'][_0xd613('0x23')]({'where':{'type':_0x344004,'resourceId':_0x4f6368['id']}})[_0xd613('0x22')](function(){return _0xe4a28f;});})[_0xd613('0x22')](function(){_0x30d985[_0xd613('0x18')](0xcc)[_0xd613('0x26')]();});}};}function handleEntityNotFound(_0x2047d5,_0x5e0b64){return function(_0x2febf6){if(!_0x2febf6){_0x2047d5[_0xd613('0x17')](0x194);}return _0x2febf6;};}function handleError(_0x135d39,_0x58e4c5){_0x58e4c5=_0x58e4c5||0x1f4;return function(_0x4acba5){logger['error'](_0x4acba5[_0xd613('0x27')]);if(_0x4acba5[_0xd613('0x28')]){delete _0x4acba5[_0xd613('0x28')];}_0x135d39['status'](_0x58e4c5)[_0xd613('0x29')](_0x4acba5);};}exports[_0xd613('0x2a')]=function(_0x59205e,_0x56b44b){var _0x1224a9={},_0x44faf0={},_0x2151f9={'count':0x0,'rows':[]};var _0x45df1e=_[_0xd613('0x2b')](db[_0xd613('0x2c')][_0xd613('0x2d')],function(_0x33c944){return{'name':_0x33c944['fieldName'],'type':_0x33c944[_0xd613('0x2e')][_0xd613('0x2f')]};});_0x44faf0[_0xd613('0x30')]=_['map'](_0x45df1e,_0xd613('0x28'));_0x44faf0[_0xd613('0x31')]=_['keys'](_0x59205e[_0xd613('0x31')]);_0x44faf0[_0xd613('0x32')]=_['intersection'](_0x44faf0[_0xd613('0x30')],_0x44faf0[_0xd613('0x31')]);_0x1224a9[_0xd613('0x33')]=_[_0xd613('0x34')](_0x44faf0[_0xd613('0x30')],qs['fields'](_0x59205e['query']['fields']));_0x1224a9[_0xd613('0x33')]=_0x1224a9['attributes'][_0xd613('0x35')]?_0x1224a9[_0xd613('0x33')]:_0x44faf0[_0xd613('0x30')];if(!_0x59205e[_0xd613('0x31')][_0xd613('0x36')]('nolimit')){_0x1224a9[_0xd613('0x1c')]=qs[_0xd613('0x1c')](_0x59205e[_0xd613('0x31')][_0xd613('0x1c')]);_0x1224a9[_0xd613('0x1a')]=qs[_0xd613('0x1a')](_0x59205e[_0xd613('0x31')][_0xd613('0x1a')]);}_0x1224a9[_0xd613('0x37')]=qs[_0xd613('0x38')](_0x59205e[_0xd613('0x31')][_0xd613('0x38')]);_0x1224a9['where']=qs[_0xd613('0x32')](_[_0xd613('0x39')](_0x59205e[_0xd613('0x31')],_0x44faf0['filters']),_0x45df1e);if(_0x59205e[_0xd613('0x31')][_0xd613('0x3a')]){_0x1224a9['where']=_[_0xd613('0x3b')](_0x1224a9[_0xd613('0x3c')],{'$or':_[_0xd613('0x2b')](_0x45df1e,function(_0x393568){if(_0x393568['type']!==_0xd613('0x3d')){var _0x22d403={};_0x22d403[_0x393568[_0xd613('0x28')]]={'$like':'%'+_0x59205e[_0xd613('0x31')][_0xd613('0x3a')]+'%'};return _0x22d403;}})});}_0x1224a9=_['merge']({},_0x1224a9,_0x59205e['options']);var _0x28d964={'where':_0x1224a9['where']};return db[_0xd613('0x2c')][_0xd613('0x1d')](_0x28d964)[_0xd613('0x22')](function(_0x42909e){_0x2151f9[_0xd613('0x1d')]=_0x42909e;if(_0x59205e['query']['includeAll']){_0x1224a9['include']=[{'all':!![]}];}return db[_0xd613('0x2c')][_0xd613('0x3e')](_0x1224a9);})['then'](function(_0x4fc1c0){_0x2151f9[_0xd613('0x3f')]=_0x4fc1c0;return _0x2151f9;})['then'](respondWithFilteredResult(_0x56b44b,_0x1224a9))[_0xd613('0x40')](handleError(_0x56b44b,null));};exports[_0xd613('0x41')]=function(_0x522414,_0x20fa24){var _0x57dd9a={'raw':!![],'where':{'id':_0x522414[_0xd613('0x42')]['id']}},_0x41e7b3={};_0x41e7b3[_0xd613('0x30')]=_[_0xd613('0x43')](db['Pause'][_0xd613('0x2d')]);_0x41e7b3[_0xd613('0x31')]=_['keys'](_0x522414[_0xd613('0x31')]);_0x41e7b3[_0xd613('0x32')]=_[_0xd613('0x34')](_0x41e7b3['model'],_0x41e7b3[_0xd613('0x31')]);_0x57dd9a[_0xd613('0x33')]=_[_0xd613('0x34')](_0x41e7b3[_0xd613('0x30')],qs[_0xd613('0x44')](_0x522414[_0xd613('0x31')][_0xd613('0x44')]));_0x57dd9a[_0xd613('0x33')]=_0x57dd9a[_0xd613('0x33')][_0xd613('0x35')]?_0x57dd9a[_0xd613('0x33')]:_0x41e7b3[_0xd613('0x30')];if(_0x522414[_0xd613('0x31')][_0xd613('0x45')]){_0x57dd9a[_0xd613('0x46')]=[{'all':!![]}];}_0x57dd9a=_[_0xd613('0x3b')]({},_0x57dd9a,_0x522414[_0xd613('0x47')]);return db[_0xd613('0x2c')][_0xd613('0x48')](_0x57dd9a)[_0xd613('0x22')](handleEntityNotFound(_0x20fa24,null))[_0xd613('0x22')](respondWithResult(_0x20fa24,null))[_0xd613('0x40')](handleError(_0x20fa24,null));};exports['create']=function(_0x109f4f,_0x6419ea){return db[_0xd613('0x2c')][_0xd613('0x49')](_0x109f4f[_0xd613('0x4a')],{})[_0xd613('0x22')](function(_0x29ace4){var _0x517a95=_0x109f4f['user'][_0xd613('0x24')]({'plain':!![]});if(!_0x517a95)throw new Error(_0xd613('0x4b'));if(_0x517a95[_0xd613('0x4c')]===_0xd613('0x4d')){var _0x305daa=_0x29ace4[_0xd613('0x24')]({'plain':!![]});var _0x50df3c=_0xd613('0x25');return db[_0xd613('0x4e')][_0xd613('0x48')]({'where':{'name':_0x50df3c,'userProfileId':_0x517a95[_0xd613('0x4f')]},'raw':!![]})[_0xd613('0x22')](function(_0x2ded1e){if(_0x2ded1e&&_0x2ded1e[_0xd613('0x50')]===0x0){return db[_0xd613('0x51')][_0xd613('0x49')]({'name':_0x305daa['name'],'resourceId':_0x305daa['id'],'type':_0x2ded1e['name'],'sectionId':_0x2ded1e['id']},{})[_0xd613('0x22')](function(){return _0x29ace4;});}else{return _0x29ace4;}})[_0xd613('0x40')](function(_0x5e277f){logger[_0xd613('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e277f);throw _0x5e277f;});}return _0x29ace4;})['then'](respondWithResult(_0x6419ea,0xc9))[_0xd613('0x40')](handleError(_0x6419ea,null));};exports[_0xd613('0x21')]=function(_0x210201,_0x3e6220){if(_0x210201[_0xd613('0x4a')]['id']){delete _0x210201['body']['id'];}return db[_0xd613('0x2c')]['find']({'where':{'id':_0x210201[_0xd613('0x42')]['id']}})[_0xd613('0x22')](handleEntityNotFound(_0x3e6220,null))[_0xd613('0x22')](saveUpdates(_0x210201['body'],null))['then'](respondWithResult(_0x3e6220,null))[_0xd613('0x40')](handleError(_0x3e6220,null));};exports[_0xd613('0x23')]=function(_0x271902,_0x1afbab){return db[_0xd613('0x2c')]['find']({'where':{'id':_0x271902['params']['id']}})['then'](handleEntityNotFound(_0x1afbab,null))[_0xd613('0x22')](removeEntity(_0x1afbab,null))['catch'](handleError(_0x1afbab,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ccaf408..9573abd 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x320917,_0x4f569a){var _0x3e98cc=function(_0x5e6f09){while(--_0x5e6f09){_0x320917['push'](_0x320917['shift']());}};_0x3e98cc(++_0x4f569a);}(_0xe14b,0x93));var _0xbe14=function(_0x5c376c,_0x31cf41){_0x5c376c=_0x5c376c-0x0;var _0x578699=_0xe14b[_0x5c376c];return _0x578699;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x93f9f1,_0x282d69){var _0x5abfec=function(_0xdf880e){while(--_0xdf880e){_0x93f9f1['push'](_0x93f9f1['shift']());}};_0x5abfec(++_0x282d69);}(_0xf494,0x1c6));var _0x4f49=function(_0x30a549,_0x3f99f1){_0x30a549=_0x30a549-0x0;var _0x23c1a7=_0xf494[_0x30a549];return _0x23c1a7;};'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'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index bf8c30e..ebf84b6 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x42341c,_0x37bc1a){var _0x1d045=function(_0x4beb64){while(--_0x4beb64){_0x42341c['push'](_0x42341c['shift']());}};_0x1d045(++_0x37bc1a);}(_0x7a54,0x106));var _0x47a5=function(_0x4a8eae,_0x3357d4){_0x4a8eae=_0x4a8eae-0x0;var _0x536dd3=_0x7a54[_0x4a8eae];return _0x536dd3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5e21af,_0x239b49){var _0x1daa4f=function(_0x4d226e){while(--_0x4d226e){_0x5e21af['push'](_0x5e21af['shift']());}};_0x1daa4f(++_0x239b49);}(_0x7a54,0x106));var _0x47a5=function(_0x4bea44,_0xc196bb){_0x4bea44=_0x4bea44-0x0;var _0x5e3b0c=_0x7a54[_0x4bea44];return _0x5e3b0c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 273f8bd..776b5fd 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x2bde55,_0x3bf01a){var _0x313885=function(_0x3e3ae2){while(--_0x3e3ae2){_0x2bde55['push'](_0x2bde55['shift']());}};_0x313885(++_0x3bf01a);}(_0xdace,0xc5));var _0xedac=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xdace[_0x414655];return _0x237884;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./plugin.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),controller[_0xedac('0xc')]);router[_0xedac('0x8')]('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0xd')]);router[_0xedac('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xedac('0xe')]);var upload=multer({'storage':multer[_0xedac('0xf')]({'destination':function(_0x57e1bf,_0x4d6a29,_0x4db2ad){_0x4db2ad(null,path[_0xedac('0x10')](config['root'],_0xedac('0x11')));},'filename':function(_0x4fa1ac,_0x21c6ae,_0x1b0503){_0x21c6ae[_0xedac('0x12')]=_0x21c6ae[_0xedac('0x12')][_0xedac('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b0503(null,util[_0xedac('0x14')](_0xedac('0x15'),path[_0xedac('0x16')](_0x21c6ae['originalname'],path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])),Date[_0xedac('0x18')](),path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])));}})});router['post']('/',upload[_0xedac('0x19')]('file'),controller[_0xedac('0x1a')]);router[_0xedac('0x1b')](_0xedac('0xb'),controller[_0xedac('0x1c')]);router['put']('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0x1d')]);router[_0xedac('0x1e')](_0xedac('0x1f'),auth['isAuthenticated'](),controller['delete']);module[_0xedac('0x20')]=router; \ No newline at end of file +var _0x008c=['/:id','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','single','file','upload','post','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet'];(function(_0x23562c,_0x396ba1){var _0x3eb363=function(_0x19e475){while(--_0x19e475){_0x23562c['push'](_0x23562c['shift']());}};_0x3eb363(++_0x396ba1);}(_0x008c,0x188));var _0xc008=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0x008c[_0x47f4c2];return _0x22c63e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/webhook',controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xa')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eacfa,_0xc881aa,_0x5b2004){_0x5b2004(null,path[_0xc008('0x10')](config[_0xc008('0x11')],_0xc008('0x12')));},'filename':function(_0x2a5b4e,_0x9ffa93,_0x1819c6){_0x9ffa93[_0xc008('0x13')]=_0x9ffa93['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1819c6(null,util[_0xc008('0x14')]('%s-%s%s',path[_0xc008('0x15')](_0x9ffa93[_0xc008('0x13')],path[_0xc008('0x16')](_0x9ffa93[_0xc008('0x13')])),Date[_0xc008('0x17')](),path['extname'](_0x9ffa93['originalname'])));}})});router['post']('/',upload[_0xc008('0x18')](_0xc008('0x19')),controller[_0xc008('0x1a')]);router[_0xc008('0x1b')]('/webhook',controller['webhookPost']);router['put']('/:id',auth[_0xc008('0xb')](),controller[_0xc008('0x1c')]);router['delete'](_0xc008('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5111ef6..178e818 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 _0xe462=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly','agentOnly','always','never'];(function(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0xe462,0xef));var _0x2e46=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0xe462[_0x191c44];return _0x1086cd;};'use strict';var Sequelize=require(_0x2e46('0x0'));module[_0x2e46('0x1')]={'name':{'type':Sequelize[_0x2e46('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2e46('0x3'),_0x2e46('0x4'))},'description':{'type':Sequelize[_0x2e46('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x2e46('0x2')],'comment':_0x2e46('0x6')},'active':{'type':Sequelize[_0x2e46('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2e46('0x8')](_0x2e46('0x9'),_0x2e46('0xa'),_0x2e46('0xb'),_0x2e46('0xc')),'defaultValue':'always','comment':_0x2e46('0xd')},'icon':{'type':Sequelize[_0x2e46('0x2')]},'adminUrl':{'type':Sequelize[_0x2e46('0x2')]},'agentUrl':{'type':Sequelize[_0x2e46('0x2')]},'scriptName':{'type':Sequelize[_0x2e46('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbcd8=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x5989a3,_0x23ebf4){var _0x318bbd=function(_0x371c3e){while(--_0x371c3e){_0x5989a3['push'](_0x5989a3['shift']());}};_0x318bbd(++_0x23ebf4);}(_0xbcd8,0xb8));var _0x8bcd=function(_0x517f75,_0x47fe52){_0x517f75=_0x517f75-0x0;var _0x20694a=_0xbcd8[_0x517f75];return _0x20694a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8bcd('0x0')]('html',_0x8bcd('0x1'))},'description':{'type':Sequelize[_0x8bcd('0x2')]},'version':{'type':Sequelize[_0x8bcd('0x2')]},'path':{'type':Sequelize[_0x8bcd('0x3')],'comment':_0x8bcd('0x4')},'active':{'type':Sequelize[_0x8bcd('0x5')],'defaultValue':0x0,'comment':_0x8bcd('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x8bcd('0x7'),_0x8bcd('0x8'),'always','never'),'defaultValue':_0x8bcd('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x8bcd('0x3')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x8bcd('0x3')]},'scriptName':{'type':Sequelize[_0x8bcd('0x3')]},'scriptPath':{'type':Sequelize[_0x8bcd('0x3')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5019430..e48c3ed 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 _0x09a8=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','download','find','join','format','basename','createWriteStream','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','path','node_modules/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','root','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','send','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','extract-zip','rimraf','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','then','get','Plugins','UserProfileResource','stack','name','index','map','Plugin','fieldName','key','query'];(function(_0x4e24e2,_0x4bf3cc){var _0x17975b=function(_0x11968a){while(--_0x11968a){_0x4e24e2['push'](_0x4e24e2['shift']());}};_0x17975b(++_0x4bf3cc);}(_0x09a8,0x12a));var _0x809a=function(_0x19c751,_0x1b9a64){_0x19c751=_0x19c751-0x0;var _0x217755=_0x09a8[_0x19c751];return _0x217755;};'use strict';var emlformat=require(_0x809a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x809a('0x1'));var rp=require(_0x809a('0x2'));var moment=require(_0x809a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x809a('0x4'));var util=require(_0x809a('0x5'));var path=require('path');var sox=require(_0x809a('0x6'));var csv=require(_0x809a('0x7'));var ejs=require(_0x809a('0x8'));var fs=require('fs');var fs_extra=require(_0x809a('0x9'));var _=require(_0x809a('0xa'));var squel=require(_0x809a('0xb'));var crypto=require(_0x809a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x809a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x809a('0xe'));var extract=require(_0x809a('0xf'));var rimraf=require(_0x809a('0x10'));var archiver=require(_0x809a('0x11'));var Redis=require('ioredis');var authService=require(_0x809a('0x12'));var qs=require(_0x809a('0x13'));var as=require(_0x809a('0x14'));var hardwareService=require(_0x809a('0x15'));var logger=require(_0x809a('0x16'))(_0x809a('0x17'));var utils=require(_0x809a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x809a('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x809a('0x1a')],{'host':_0x809a('0x1b'),'port':0x18eb});var socket=require(_0x809a('0x1c'))(new Redis(config[_0x809a('0x1a')]));require(_0x809a('0x1d'))[_0x809a('0x1e')](socket);function respondWithStatusCode(_0x5b1b7a,_0x53c595){_0x53c595=_0x53c595||0xcc;return function(_0xd40807){if(_0xd40807){return _0x5b1b7a[_0x809a('0x1f')](_0x53c595);}return _0x5b1b7a[_0x809a('0x20')](_0x53c595)[_0x809a('0x21')]();};}function respondWithResult(_0x4bc31b,_0x57ef60){_0x57ef60=_0x57ef60||0xc8;return function(_0x1e898d){if(_0x1e898d){return _0x4bc31b[_0x809a('0x20')](_0x57ef60)[_0x809a('0x22')](_0x1e898d);}};}function respondWithFilteredResult(_0x28d9df,_0x5a71be){return function(_0x12b011){if(_0x12b011){var _0x354dd8=typeof _0x5a71be['offset']===_0x809a('0x23')&&typeof _0x5a71be[_0x809a('0x24')]===_0x809a('0x23');var _0x2d4e9f=_0x12b011['count'];var _0x4818df=_0x354dd8?0x0:_0x5a71be[_0x809a('0x25')];var _0x4a6e5a=_0x354dd8?_0x12b011['count']:_0x5a71be[_0x809a('0x25')]+_0x5a71be[_0x809a('0x24')];var _0x6feba3;if(_0x4a6e5a>=_0x2d4e9f){_0x4a6e5a=_0x2d4e9f;_0x6feba3=0xc8;}else{_0x6feba3=0xce;}_0x28d9df['status'](_0x6feba3);return _0x28d9df['set'](_0x809a('0x26'),_0x4818df+'-'+_0x4a6e5a+'/'+_0x2d4e9f)['json'](_0x12b011);}return null;};}function patchUpdates(_0x302832){return function(_0x3f182f){try{jsonpatch[_0x809a('0x27')](_0x3f182f,_0x302832,!![]);}catch(_0x49b956){return BPromise[_0x809a('0x28')](_0x49b956);}return _0x3f182f[_0x809a('0x29')]();};}function saveUpdates(_0xafad7b,_0x2f2232){return function(_0x5499ee){if(_0x5499ee){return _0x5499ee['update'](_0xafad7b)[_0x809a('0x2a')](function(_0x401390){return _0x401390;});}return null;};}function removeEntity(_0x1d2b03,_0x4f554c){return function(_0xd2e252){if(_0xd2e252){return _0xd2e252['destroy']()[_0x809a('0x2a')](function(){var _0x5f2b2d=_0xd2e252[_0x809a('0x2b')]({'plain':!![]});var _0x368611=_0x809a('0x2c');return db[_0x809a('0x2d')]['destroy']({'where':{'type':_0x368611,'resourceId':_0x5f2b2d['id']}})[_0x809a('0x2a')](function(){return _0xd2e252;});})[_0x809a('0x2a')](function(){_0x1d2b03['status'](0xcc)[_0x809a('0x21')]();});}};}function handleEntityNotFound(_0x2bc9eb,_0x552633){return function(_0x5780df){if(!_0x5780df){_0x2bc9eb['sendStatus'](0x194);}return _0x5780df;};}function handleError(_0x1b82b2,_0x1f2a41){_0x1f2a41=_0x1f2a41||0x1f4;return function(_0x346f7e){logger['error'](_0x346f7e[_0x809a('0x2e')]);if(_0x346f7e[_0x809a('0x2f')]){delete _0x346f7e[_0x809a('0x2f')];}_0x1b82b2[_0x809a('0x20')](_0x1f2a41)['send'](_0x346f7e);};}exports[_0x809a('0x30')]=function(_0x3dc043,_0x37b6a9){var _0x1adc5d={},_0x48be1e={},_0x3b477a={'count':0x0,'rows':[]};var _0x5ee5fb=_[_0x809a('0x31')](db[_0x809a('0x32')]['rawAttributes'],function(_0x5b0379){return{'name':_0x5b0379[_0x809a('0x33')],'type':_0x5b0379['type'][_0x809a('0x34')]};});_0x48be1e['model']=_[_0x809a('0x31')](_0x5ee5fb,_0x809a('0x2f'));_0x48be1e[_0x809a('0x35')]=_['keys'](_0x3dc043['query']);_0x48be1e[_0x809a('0x36')]=_[_0x809a('0x37')](_0x48be1e[_0x809a('0x38')],_0x48be1e[_0x809a('0x35')]);_0x1adc5d['attributes']=_[_0x809a('0x37')](_0x48be1e['model'],qs['fields'](_0x3dc043[_0x809a('0x35')][_0x809a('0x39')]));_0x1adc5d[_0x809a('0x3a')]=_0x1adc5d[_0x809a('0x3a')][_0x809a('0x3b')]?_0x1adc5d[_0x809a('0x3a')]:_0x48be1e['model'];if(!_0x3dc043[_0x809a('0x35')][_0x809a('0x3c')](_0x809a('0x3d'))){_0x1adc5d[_0x809a('0x24')]=qs[_0x809a('0x24')](_0x3dc043[_0x809a('0x35')][_0x809a('0x24')]);_0x1adc5d[_0x809a('0x25')]=qs[_0x809a('0x25')](_0x3dc043[_0x809a('0x35')][_0x809a('0x25')]);}_0x1adc5d[_0x809a('0x3e')]=qs[_0x809a('0x3f')](_0x3dc043['query'][_0x809a('0x3f')]);_0x1adc5d[_0x809a('0x40')]=qs[_0x809a('0x36')](_[_0x809a('0x41')](_0x3dc043['query'],_0x48be1e[_0x809a('0x36')]),_0x5ee5fb);if(_0x3dc043[_0x809a('0x35')][_0x809a('0x42')]){_0x1adc5d[_0x809a('0x40')]=_[_0x809a('0x43')](_0x1adc5d[_0x809a('0x40')],{'$or':_['map'](_0x5ee5fb,function(_0x2ef916){if(_0x2ef916[_0x809a('0x44')]!==_0x809a('0x45')){var _0x443b63={};_0x443b63[_0x2ef916[_0x809a('0x2f')]]={'$like':'%'+_0x3dc043[_0x809a('0x35')][_0x809a('0x42')]+'%'};return _0x443b63;}})});}_0x1adc5d=_['merge']({},_0x1adc5d,_0x3dc043[_0x809a('0x46')]);var _0x28f0d2={'where':_0x1adc5d[_0x809a('0x40')]};return db[_0x809a('0x32')]['count'](_0x28f0d2)['then'](function(_0x472efa){_0x3b477a[_0x809a('0x47')]=_0x472efa;if(_0x3dc043[_0x809a('0x35')][_0x809a('0x48')]){_0x1adc5d[_0x809a('0x49')]=[{'all':!![]}];}return db[_0x809a('0x32')]['findAll'](_0x1adc5d);})['then'](function(_0x416b65){_0x3b477a[_0x809a('0x4a')]=_0x416b65;return _0x3b477a;})[_0x809a('0x2a')](respondWithFilteredResult(_0x37b6a9,_0x1adc5d))[_0x809a('0x4b')](handleError(_0x37b6a9,null));};exports[_0x809a('0x4c')]=function(_0x4e3c44,_0x195a78){var _0x1888ca={'raw':!![],'where':{'id':_0x4e3c44[_0x809a('0x4d')]['id']}},_0x1587cf={};_0x1587cf[_0x809a('0x38')]=_['keys'](db[_0x809a('0x32')][_0x809a('0x4e')]);_0x1587cf[_0x809a('0x35')]=_['keys'](_0x4e3c44[_0x809a('0x35')]);_0x1587cf[_0x809a('0x36')]=_['intersection'](_0x1587cf[_0x809a('0x38')],_0x1587cf[_0x809a('0x35')]);_0x1888ca[_0x809a('0x3a')]=_[_0x809a('0x37')](_0x1587cf[_0x809a('0x38')],qs[_0x809a('0x39')](_0x4e3c44[_0x809a('0x35')][_0x809a('0x39')]));_0x1888ca[_0x809a('0x3a')]=_0x1888ca['attributes']['length']?_0x1888ca[_0x809a('0x3a')]:_0x1587cf[_0x809a('0x38')];if(_0x4e3c44['query'][_0x809a('0x48')]){_0x1888ca[_0x809a('0x49')]=[{'all':!![]}];}_0x1888ca=_[_0x809a('0x43')]({},_0x1888ca,_0x4e3c44[_0x809a('0x46')]);return db['Plugin']['find'](_0x1888ca)['then'](handleEntityNotFound(_0x195a78,null))[_0x809a('0x2a')](respondWithResult(_0x195a78,null))['catch'](handleError(_0x195a78,null));};exports[_0x809a('0x4f')]=function(_0xd9667a,_0x558c1e,_0x2dc185){return db['Plugin'][_0x809a('0x50')]({'where':{'id':_0xd9667a[_0x809a('0x4d')]['id']},'attributes':['name','path'],'raw':!![]})[_0x809a('0x2a')](handleEntityNotFound(_0x558c1e,null))['then'](function(_0x31b363){if(_0x31b363){var _0x46ca9d=path[_0x809a('0x51')](config['root'],'server/files/plugins',util[_0x809a('0x52')]('%s.zip',path[_0x809a('0x53')](_0x31b363['path'])));var _0x15820a=fs[_0x809a('0x54')](_0x46ca9d);var _0x1bd7a8=archiver(_0x809a('0x55'),{'zlib':{'level':0x9}});_0x1bd7a8['on'](_0x809a('0x56'),function(_0xb808ba){if(_0xb808ba[_0x809a('0x57')]==='ENOENT'){logger[_0x809a('0x58')](_0xb808ba);}else{throw new db[(_0x809a('0x59'))][(_0x809a('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1bd7a8['on'](_0x809a('0x58'),function(_0x283ad8){throw new db['Sequelize'][(_0x809a('0x5a'))](_0x809a('0x5b'));});_0x1bd7a8[_0x809a('0x5c')](_0x15820a);_0x1bd7a8[_0x809a('0x5d')](_0x809a('0x5e'),{'cwd':path[_0x809a('0x51')](config['root'],_0x809a('0x5f'),path[_0x809a('0x60')](_0x31b363[_0x809a('0x61')])),'ignore':[path['join'](path[_0x809a('0x53')](_0x31b363[_0x809a('0x61')]),_0x809a('0x62')),path['join'](path[_0x809a('0x53')](_0x31b363[_0x809a('0x61')]),'attachments/**/*')],'nodir':!![]})[_0x809a('0x63')]();_0x15820a['on'](_0x809a('0x64'),function(){if(!fs['existsSync'](_0x46ca9d)){throw new db[(_0x809a('0x59'))][(_0x809a('0x5a'))]('Plugin\x20not\x20found');}return _0x558c1e[_0x809a('0x4f')](_0x46ca9d,util[_0x809a('0x52')]('%s.zip',path[_0x809a('0x53')](_0x31b363[_0x809a('0x61')])),function(_0x538279){if(_0x538279){throw new db['Sequelize'][(_0x809a('0x5a'))](_0x809a('0x65'));}fs['unlinkSync'](_0x46ca9d);logger['info'](_0x809a('0x66'));logger[_0x809a('0x67')](_0x809a('0x68'));});});}return null;})[_0x809a('0x4b')](handleError(_0x558c1e,null));};exports[_0x809a('0x69')]=function(_0x204142,_0x204f03,_0x24b4f8){var _0x37e7fc=path[_0x809a('0x53')](_0x204142[_0x809a('0x6a')][_0x809a('0x6b')],path[_0x809a('0x6c')](_0x204142[_0x809a('0x6a')]['filename']));var _0x4a8477=path['join'](config[_0x809a('0x6d')],_0x809a('0x5f'),_0x204142[_0x809a('0x6a')][_0x809a('0x6b')]);var _0x1f165b=path[_0x809a('0x51')](config[_0x809a('0x6d')],'server/files/plugins',_0x37e7fc);logger[_0x809a('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x4a8477);logger[_0x809a('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x1f165b);try{fs[_0x809a('0x6e')](_0x4a8477,parseInt(_0x809a('0x6f'),0x8));extract(_0x4a8477,{'dir':_0x1f165b},function(_0x473442){if(_0x473442){logger[_0x809a('0x58')](_0x473442);handleError(_0x473442,!![]);};var _0xcdbe49=fs[_0x809a('0x70')](_0x1f165b);if(_0xcdbe49[_0x809a('0x3b')]>0x1){removeReferences(_0x4a8477,_0x1f165b);logger[_0x809a('0x58')](_0x809a('0x71'));return _0x24b4f8(new Error(_0x809a('0x71')));}var _0x486c53=fs[_0x809a('0x72')](path[_0x809a('0x51')](_0x1f165b,_0xcdbe49[0x0]));if(_0x486c53[_0x809a('0x73')]()){removeReferences(_0x4a8477,_0x1f165b);logger[_0x809a('0x58')](_0x809a('0x71'));return _0x24b4f8(new Error(_0x809a('0x71')));}if(_0x486c53[_0x809a('0x74')]()){var _0x6286b5=fs[_0x809a('0x70')](path[_0x809a('0x51')](_0x1f165b,_0xcdbe49[0x0]));if(_0x6286b5['length']===0x0){removeReferences(_0x4a8477,_0x1f165b);logger[_0x809a('0x58')]('Invalid\x20plugin\x20structure');return _0x24b4f8(new Error(_0x809a('0x71')));}var _0x43d26d=_0x6286b5[_0x809a('0x75')](function(_0x2bea87){return _0x2bea87==='manifest.json';});if(!_0x43d26d){return _0x24b4f8(new Error(_0x809a('0x76')));}var _0x162be2=fs[_0x809a('0x77')](path['join'](_0x1f165b,_0xcdbe49[0x0],_0x809a('0x78')));var _0x376e71=JSON[_0x809a('0x79')](_0x162be2);if(_0x809a('0x23')==typeof _0x376e71['name']){return _0x24b4f8(new Error(_0x809a('0x7a')));}if(_0x809a('0x23')==typeof _0x376e71[_0x809a('0x44')]){return _0x24b4f8(new Error(_0x809a('0x7b')));}if('undefined'==typeof _0x376e71['version']){return _0x24b4f8(new Error(_0x809a('0x7c')));}if(_0x809a('0x23')==typeof _0x376e71[_0x809a('0x7d')]){return _0x24b4f8(new Error(_0x809a('0x7e')));}if(_0x376e71[_0x809a('0x44')]===_0x809a('0x7f')){if(_0x809a('0x23')==typeof _0x376e71[_0x809a('0x7d')]['views']){return _0x24b4f8(new Error(_0x809a('0x80')));}if(_0x809a('0x23')==typeof _0x376e71['parameters']['views']['admin']&&_0x809a('0x23')==typeof _0x376e71[_0x809a('0x7d')][_0x809a('0x81')][_0x809a('0x82')]){return _0x24b4f8(new Error(_0x809a('0x83')));}}else if(_0x376e71[_0x809a('0x44')]===_0x809a('0x84')){if(_0x809a('0x23')==typeof _0x376e71['parameters']['scriptName']){return _0x24b4f8(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x376e71['parameters'][_0x809a('0x85')]){return _0x24b4f8(new Error(_0x809a('0x86')));}}else{return _0x24b4f8(new Error(_0x809a('0x87')));}var _0x3d52a5=_0x376e71[_0x809a('0x2f')];var _0x421185=_0x376e71[_0x809a('0x88')];var _0x4efaa8=_0x376e71[_0x809a('0x44')];var _0x362f72=_0x376e71[_0x809a('0x89')]?_0x376e71['sidebar']:'always';var _0x26732f=_0x376e71['icon']?_0x376e71[_0x809a('0x8a')]:_0x809a('0x8b');var _0x1ba2cc='';var _0x5c8c7c='';var _0x5f4909='';var _0x37c4e6='';var _0x661aa9=_0x376e71[_0x809a('0x8c')];if(_0x4efaa8===_0x809a('0x7f')){if('undefined'!=typeof _0x376e71[_0x809a('0x7d')][_0x809a('0x81')]['admin']){var _0x50e8d0=_0x376e71[_0x809a('0x7d')][_0x809a('0x81')][_0x809a('0x8d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x50e8d0)){_0x1ba2cc=path['join'](_0x809a('0x8e'),_0x37e7fc,_0xcdbe49[0x0],_0x50e8d0);}else{_0x1ba2cc=_0x50e8d0;}}else{logger[_0x809a('0x67')](_0x809a('0x8f'));}if(_0x809a('0x23')!=typeof _0x376e71[_0x809a('0x7d')][_0x809a('0x81')]['agent']){var _0x59544f=_0x376e71[_0x809a('0x7d')][_0x809a('0x81')][_0x809a('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x59544f)){_0x5c8c7c=path[_0x809a('0x51')]('plugins',_0x37e7fc,_0xcdbe49[0x0],_0x59544f);}else{_0x5c8c7c=_0x59544f;}}else{logger[_0x809a('0x67')](_0x809a('0x90'));}}else if(_0x4efaa8==='script'){_0x5f4909=_0x376e71[_0x809a('0x7d')]['scriptName'];_0x37c4e6=_0x376e71['parameters']['scriptPath'];if(_0x809a('0x23')!=typeof _0x376e71[_0x809a('0x7d')]['views']){if(_0x809a('0x23')!=typeof _0x376e71['parameters']['views'][_0x809a('0x8d')]){var _0x50e8d0=_0x376e71['parameters'][_0x809a('0x81')][_0x809a('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x809a('0x91')](_0x50e8d0)){_0x1ba2cc=path[_0x809a('0x51')](_0x809a('0x8e'),_0x37e7fc,_0xcdbe49[0x0],_0x50e8d0);}else{_0x1ba2cc=_0x50e8d0;}}if(_0x809a('0x23')!=typeof _0x376e71[_0x809a('0x7d')]['views']['agent']){var _0x59544f=_0x376e71['parameters']['views'][_0x809a('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x809a('0x91')](_0x59544f)){_0x5c8c7c=path[_0x809a('0x51')]('plugins',_0x37e7fc,_0xcdbe49[0x0],_0x59544f);}else{_0x5c8c7c=_0x59544f;}}}}var _0x5a93d8={'name':_0x3d52a5,'description':_0x421185,'path':path[_0x809a('0x51')](_0x37e7fc,_0xcdbe49[0x0]),'type':_0x4efaa8,'sidebar':_0x362f72,'icon':_0x26732f,'adminUrl':_0x1ba2cc,'agentUrl':_0x5c8c7c,'scriptName':_0x5f4909,'scriptPath':_0x37c4e6,'version':_0x661aa9};removeReferences(_0x4a8477,null);return db[_0x809a('0x32')][_0x809a('0x92')](_0x5a93d8)[_0x809a('0x2a')](function(_0x4ed8f3){var _0x5ddd1d={'role':_0x204142[_0x809a('0x93')][_0x809a('0x94')],'userProfileId':_0x204142[_0x809a('0x93')][_0x809a('0x95')]};if(!_0x5ddd1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ddd1d['role']===_0x809a('0x96')){var _0xc80baa=_0x4ed8f3[_0x809a('0x2b')]({'plain':!![]});return db[_0x809a('0x97')][_0x809a('0x50')]({'where':{'name':'Plugins','userProfileId':_0x5ddd1d[_0x809a('0x95')]},'raw':!![]})[_0x809a('0x2a')](function(_0x4c404c){if(_0x4c404c&&_0x4c404c[_0x809a('0x98')]===0x0){return db[_0x809a('0x2d')]['create']({'name':_0xc80baa[_0x809a('0x2f')],'resourceId':_0xc80baa['id'],'type':_0x4c404c[_0x809a('0x2f')],'sectionId':_0x4c404c['id']},{})[_0x809a('0x2a')](function(){return _0x4ed8f3;});}else{return _0x4ed8f3;}})[_0x809a('0x4b')](function(_0x5c0d1f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c0d1f);throw _0x5c0d1f;});}return _0x4ed8f3;})[_0x809a('0x2a')](respondWithResult(_0x204f03,null))['catch'](handleError(_0x204f03,null));}});}catch(_0x6d2dba){_0x204f03['status'](0x1f4)['send'](_0x6d2dba);}};function removeReferences(_0x9a4b2e,_0x120828){try{if(_0x9a4b2e){fs[_0x809a('0x99')](_0x9a4b2e);logger[_0x809a('0x67')](_0x809a('0x9a'));}if(_0x120828){rimraf(_0x120828,function(){});logger[_0x809a('0x67')](_0x809a('0x9b'));}}catch(_0x39aa8f){logger[_0x809a('0x58')](_0x39aa8f);}}exports[_0x809a('0x9c')]=function(_0x2bf04b,_0x3ba3a1,_0x4d7e33){return db[_0x809a('0x32')][_0x809a('0x50')]({'where':{'id':_0x2bf04b[_0x809a('0x4d')]['id']}})[_0x809a('0x2a')](handleEntityNotFound(_0x3ba3a1,null))[_0x809a('0x2a')](saveUpdates(_0x2bf04b[_0x809a('0x93')],null))[_0x809a('0x2a')](respondWithResult(_0x3ba3a1,null))[_0x809a('0x4b')](handleError(_0x3ba3a1,null));};exports[_0x809a('0x9d')]=function(_0x2d14e7,_0x3884c3,_0x928304){return db[_0x809a('0x32')]['find']({'where':{'id':_0x2d14e7[_0x809a('0x4d')]['id']}})['then'](function(_0x533d17){if(_0x533d17){return _0x533d17['destroy']();}})[_0x809a('0x2a')](function(_0x526362){rimraf(path[_0x809a('0x51')](config[_0x809a('0x6d')],_0x809a('0x5f'),path['dirname'](_0x526362[_0x809a('0x61')])),function(){});return _0x526362;})['then'](handleEntityNotFound(_0x3884c3,null))[_0x809a('0x2a')](respondWithStatusCode(_0x3884c3,null))[_0x809a('0x4b')](handleError(_0x3884c3,null));};exports[_0x809a('0x9e')]=function(_0x4011ea,_0x48aeb6,_0x4b538e){return BPromise[_0x809a('0x9f')]()[_0x809a('0x2a')](function(){if(!_0x4011ea['query'][_0x809a('0x61')]){throw new Error(_0x809a('0xa0'));}if(!_0x4011ea[_0x809a('0x35')][_0x809a('0xa1')]){throw new Error(_0x809a('0xa2'));}var _0xfd0601=_0x4011ea['query'][_0x809a('0xa3')]?_0x4011ea[_0x809a('0x35')][_0x809a('0xa3')]+':'+_0x4011ea['query'][_0x809a('0xa1')]:_0x809a('0xa4')+_0x4011ea[_0x809a('0x35')]['port'];var _0x1c089b=_0x4011ea[_0x809a('0x35')][_0x809a('0x22')]?_0x4011ea[_0x809a('0x35')][_0x809a('0x22')]:!![];var _0x10fac4=_0x4011ea[_0x809a('0x35')]['encoding']?_0x4011ea['query'][_0x809a('0xa5')]:null;var _0x21579d={'method':_0x4011ea[_0x809a('0xa6')],'uri':util[_0x809a('0x52')](_0x809a('0xa7'),_0xfd0601,_0x4011ea[_0x809a('0x35')][_0x809a('0x61')]),'json':_0x1c089b,'resolveWithFullResponse':!![],'encoding':_0x10fac4,'qs':_0x4011ea['query']};if(_0x4011ea[_0x809a('0xa8')]){_0x21579d['headers']=_0x4011ea['headers'];if(_0x21579d[_0x809a('0xa8')][_0x809a('0xa9')]){delete _0x21579d[_0x809a('0xa8')]['content-length'];}}if(_0x21579d['headers'][_0x809a('0xaa')]){delete _0x21579d[_0x809a('0xa8')]['content-type'];}return rp(_0x21579d);})[_0x809a('0x2a')](function(_0x2eeda6){if(_0x2eeda6){_0x48aeb6[_0x809a('0xab')](_0x2eeda6[_0x809a('0xa8')]);logger[_0x809a('0x67')](_0x2eeda6[_0x809a('0x93')]);if(_[_0x809a('0xac')](_0x4011ea['query'][_0x809a('0x61')],_0x809a('0x4f'))&&_0x2eeda6[_0x809a('0xad')]==0x1f4){return _0x48aeb6[_0x809a('0x1f')](_0x2eeda6[_0x809a('0xad')]);}else{return _0x48aeb6[_0x809a('0x20')](_0x2eeda6[_0x809a('0xad')])['send'](_0x2eeda6[_0x809a('0x93')]);}}else{return _0x48aeb6[_0x809a('0x1f')](0xc8);}})[_0x809a('0x4b')](handleError(_0x48aeb6,null));};exports[_0x809a('0xae')]=function(_0x4f88bb,_0x1f587a,_0xd27197){return BPromise['resolve']()['then'](function(){if(!_0x4f88bb[_0x809a('0x35')][_0x809a('0x61')]){throw new Error(_0x809a('0xa0'));}if(!_0x4f88bb[_0x809a('0x35')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5a692c=_0x4f88bb['query'][_0x809a('0xa3')]?_0x4f88bb[_0x809a('0x35')][_0x809a('0xa3')]+':'+_0x4f88bb[_0x809a('0x35')][_0x809a('0xa1')]:_0x809a('0xa4')+_0x4f88bb[_0x809a('0x35')]['port'];var _0x54d4d2=_0x4f88bb[_0x809a('0x35')][_0x809a('0x22')]?_0x4f88bb[_0x809a('0x35')][_0x809a('0x22')]:!![];var _0x2b4f81=_0x4f88bb[_0x809a('0x35')]['encoding']?_0x4f88bb['query'][_0x809a('0xa5')]:null;var _0x22a770={'method':_0x4f88bb[_0x809a('0xa6')],'uri':util['format'](_0x809a('0xa7'),_0x5a692c,_0x4f88bb['query'][_0x809a('0x61')]),'json':_0x54d4d2,'resolveWithFullResponse':!![],'encoding':_0x2b4f81,'body':_0x4f88bb[_0x809a('0x93')]};if(_0x4f88bb[_0x809a('0xa8')]){_0x22a770[_0x809a('0xa8')]=_0x4f88bb[_0x809a('0xa8')];if(_0x22a770[_0x809a('0xa8')]['content-length']){delete _0x22a770[_0x809a('0xa8')][_0x809a('0xa9')];}}if(_0x22a770[_0x809a('0xa8')]['content-type']){delete _0x22a770[_0x809a('0xa8')]['content-type'];}return rp(_0x22a770);})[_0x809a('0x2a')](function(_0x206b4f){if(_0x206b4f){_0x1f587a[_0x809a('0xab')](_0x206b4f[_0x809a('0xa8')]);logger[_0x809a('0x67')](_0x206b4f['body']);return _0x1f587a[_0x809a('0x20')](_0x206b4f['statusCode'])[_0x809a('0xaf')](_0x206b4f[_0x809a('0x93')]);}else{return _0x1f587a[_0x809a('0x1f')](0xc8);}})[_0x809a('0x4b')](handleError(_0x1f587a,null));}; \ No newline at end of file +var _0xc1f8=['statusCode','webhookPost','rimraf','zip-dir','moment','bluebird','mustache','path','sox','lodash','squel','jsforce','to-csv','papaparse','extract-zip','archiver','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','./plugin.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','name','send','index','Plugin','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','download','find','root','format','%s.zip','basename','createWriteStream','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','glob','**/*','server/files/plugins','dirname','join','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','parameters','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','body','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith'];(function(_0x2f7c4c,_0x3ff976){var _0x5d1a1b=function(_0x54ce76){while(--_0x54ce76){_0x2f7c4c['push'](_0x2f7c4c['shift']());}};_0x5d1a1b(++_0x3ff976);}(_0xc1f8,0x1ee));var _0x8c1f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc1f8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c1f('0x0'));var zipdir=require(_0x8c1f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c1f('0x2'));var BPromise=require(_0x8c1f('0x3'));var Mustache=require(_0x8c1f('0x4'));var util=require('util');var path=require(_0x8c1f('0x5'));var sox=require(_0x8c1f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c1f('0x7'));var squel=require(_0x8c1f('0x8'));var crypto=require('crypto');var jsforce=require(_0x8c1f('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8c1f('0xa'));var querystring=require('querystring');var Papa=require(_0x8c1f('0xb'));var extract=require(_0x8c1f('0xc'));var rimraf=require(_0x8c1f('0x0'));var archiver=require(_0x8c1f('0xd'));var Redis=require(_0x8c1f('0xe'));var authService=require(_0x8c1f('0xf'));var qs=require(_0x8c1f('0x10'));var as=require(_0x8c1f('0x11'));var hardwareService=require(_0x8c1f('0x12'));var logger=require(_0x8c1f('0x13'))(_0x8c1f('0x14'));var utils=require(_0x8c1f('0x15'));var config=require(_0x8c1f('0x16'));var licenseUtil=require(_0x8c1f('0x17'));var db=require(_0x8c1f('0x18'))['db'];config[_0x8c1f('0x19')]=_['defaults'](config[_0x8c1f('0x19')],{'host':_0x8c1f('0x1a'),'port':0x18eb});var socket=require(_0x8c1f('0x1b'))(new Redis(config[_0x8c1f('0x19')]));require(_0x8c1f('0x1c'))['register'](socket);function respondWithStatusCode(_0xef6b8d,_0x26541d){_0x26541d=_0x26541d||0xcc;return function(_0x5dd78c){if(_0x5dd78c){return _0xef6b8d[_0x8c1f('0x1d')](_0x26541d);}return _0xef6b8d[_0x8c1f('0x1e')](_0x26541d)[_0x8c1f('0x1f')]();};}function respondWithResult(_0x1ea4d2,_0x12aaba){_0x12aaba=_0x12aaba||0xc8;return function(_0x1441cd){if(_0x1441cd){return _0x1ea4d2[_0x8c1f('0x1e')](_0x12aaba)[_0x8c1f('0x20')](_0x1441cd);}};}function respondWithFilteredResult(_0x3a2304,_0x368eeb){return function(_0x1c6b27){if(_0x1c6b27){var _0x28a6f1=typeof _0x368eeb[_0x8c1f('0x21')]===_0x8c1f('0x22')&&typeof _0x368eeb[_0x8c1f('0x23')]===_0x8c1f('0x22');var _0x2f3366=_0x1c6b27[_0x8c1f('0x24')];var _0x4003c9=_0x28a6f1?0x0:_0x368eeb['offset'];var _0x224e9e=_0x28a6f1?_0x1c6b27[_0x8c1f('0x24')]:_0x368eeb[_0x8c1f('0x21')]+_0x368eeb[_0x8c1f('0x23')];var _0x4ad357;if(_0x224e9e>=_0x2f3366){_0x224e9e=_0x2f3366;_0x4ad357=0xc8;}else{_0x4ad357=0xce;}_0x3a2304['status'](_0x4ad357);return _0x3a2304[_0x8c1f('0x25')](_0x8c1f('0x26'),_0x4003c9+'-'+_0x224e9e+'/'+_0x2f3366)['json'](_0x1c6b27);}return null;};}function patchUpdates(_0xe5fc5){return function(_0x3d7453){try{jsonpatch[_0x8c1f('0x27')](_0x3d7453,_0xe5fc5,!![]);}catch(_0x2aaf2c){return BPromise[_0x8c1f('0x28')](_0x2aaf2c);}return _0x3d7453[_0x8c1f('0x29')]();};}function saveUpdates(_0xf47660,_0x5f4c54){return function(_0x180059){if(_0x180059){return _0x180059[_0x8c1f('0x2a')](_0xf47660)[_0x8c1f('0x2b')](function(_0x17cdf0){return _0x17cdf0;});}return null;};}function removeEntity(_0x3a35c8,_0xe82be3){return function(_0x35f2b6){if(_0x35f2b6){return _0x35f2b6[_0x8c1f('0x2c')]()[_0x8c1f('0x2b')](function(){var _0x490cb7=_0x35f2b6[_0x8c1f('0x2d')]({'plain':!![]});var _0x2346b7=_0x8c1f('0x2e');return db[_0x8c1f('0x2f')][_0x8c1f('0x2c')]({'where':{'type':_0x2346b7,'resourceId':_0x490cb7['id']}})[_0x8c1f('0x2b')](function(){return _0x35f2b6;});})['then'](function(){_0x3a35c8[_0x8c1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1191db,_0x13400a){return function(_0x28b514){if(!_0x28b514){_0x1191db[_0x8c1f('0x1d')](0x194);}return _0x28b514;};}function handleError(_0x538eda,_0x3a7391){_0x3a7391=_0x3a7391||0x1f4;return function(_0x462723){logger['error'](_0x462723['stack']);if(_0x462723[_0x8c1f('0x30')]){delete _0x462723[_0x8c1f('0x30')];}_0x538eda[_0x8c1f('0x1e')](_0x3a7391)[_0x8c1f('0x31')](_0x462723);};}exports[_0x8c1f('0x32')]=function(_0x4d3b44,_0x509fc1){var _0x2679aa={},_0x35012f={},_0x59eb44={'count':0x0,'rows':[]};var _0x2fce94=_['map'](db[_0x8c1f('0x33')][_0x8c1f('0x34')],function(_0x356f42){return{'name':_0x356f42[_0x8c1f('0x35')],'type':_0x356f42['type'][_0x8c1f('0x36')]};});_0x35012f[_0x8c1f('0x37')]=_[_0x8c1f('0x38')](_0x2fce94,_0x8c1f('0x30'));_0x35012f[_0x8c1f('0x39')]=_[_0x8c1f('0x3a')](_0x4d3b44[_0x8c1f('0x39')]);_0x35012f[_0x8c1f('0x3b')]=_[_0x8c1f('0x3c')](_0x35012f['model'],_0x35012f['query']);_0x2679aa[_0x8c1f('0x3d')]=_[_0x8c1f('0x3c')](_0x35012f['model'],qs[_0x8c1f('0x3e')](_0x4d3b44[_0x8c1f('0x39')]['fields']));_0x2679aa['attributes']=_0x2679aa[_0x8c1f('0x3d')][_0x8c1f('0x3f')]?_0x2679aa[_0x8c1f('0x3d')]:_0x35012f[_0x8c1f('0x37')];if(!_0x4d3b44[_0x8c1f('0x39')]['hasOwnProperty'](_0x8c1f('0x40'))){_0x2679aa['limit']=qs['limit'](_0x4d3b44[_0x8c1f('0x39')][_0x8c1f('0x23')]);_0x2679aa[_0x8c1f('0x21')]=qs[_0x8c1f('0x21')](_0x4d3b44['query']['offset']);}_0x2679aa[_0x8c1f('0x41')]=qs[_0x8c1f('0x42')](_0x4d3b44[_0x8c1f('0x39')][_0x8c1f('0x42')]);_0x2679aa[_0x8c1f('0x43')]=qs['filters'](_[_0x8c1f('0x44')](_0x4d3b44[_0x8c1f('0x39')],_0x35012f[_0x8c1f('0x3b')]),_0x2fce94);if(_0x4d3b44[_0x8c1f('0x39')][_0x8c1f('0x45')]){_0x2679aa[_0x8c1f('0x43')]=_[_0x8c1f('0x46')](_0x2679aa[_0x8c1f('0x43')],{'$or':_[_0x8c1f('0x38')](_0x2fce94,function(_0x3abce9){if(_0x3abce9[_0x8c1f('0x47')]!=='VIRTUAL'){var _0x30a767={};_0x30a767[_0x3abce9[_0x8c1f('0x30')]]={'$like':'%'+_0x4d3b44['query']['filter']+'%'};return _0x30a767;}})});}_0x2679aa=_[_0x8c1f('0x46')]({},_0x2679aa,_0x4d3b44[_0x8c1f('0x48')]);var _0xc4741d={'where':_0x2679aa[_0x8c1f('0x43')]};return db['Plugin'][_0x8c1f('0x24')](_0xc4741d)[_0x8c1f('0x2b')](function(_0x52889f){_0x59eb44[_0x8c1f('0x24')]=_0x52889f;if(_0x4d3b44[_0x8c1f('0x39')][_0x8c1f('0x49')]){_0x2679aa[_0x8c1f('0x4a')]=[{'all':!![]}];}return db[_0x8c1f('0x33')][_0x8c1f('0x4b')](_0x2679aa);})[_0x8c1f('0x2b')](function(_0x593ed5){_0x59eb44['rows']=_0x593ed5;return _0x59eb44;})[_0x8c1f('0x2b')](respondWithFilteredResult(_0x509fc1,_0x2679aa))[_0x8c1f('0x4c')](handleError(_0x509fc1,null));};exports['show']=function(_0x11b796,_0xda22fb){var _0x2f283e={'raw':!![],'where':{'id':_0x11b796['params']['id']}},_0x1075b4={};_0x1075b4['model']=_[_0x8c1f('0x3a')](db['Plugin'][_0x8c1f('0x34')]);_0x1075b4[_0x8c1f('0x39')]=_['keys'](_0x11b796[_0x8c1f('0x39')]);_0x1075b4['filters']=_[_0x8c1f('0x3c')](_0x1075b4['model'],_0x1075b4[_0x8c1f('0x39')]);_0x2f283e['attributes']=_['intersection'](_0x1075b4['model'],qs[_0x8c1f('0x3e')](_0x11b796['query']['fields']));_0x2f283e[_0x8c1f('0x3d')]=_0x2f283e['attributes'][_0x8c1f('0x3f')]?_0x2f283e[_0x8c1f('0x3d')]:_0x1075b4[_0x8c1f('0x37')];if(_0x11b796[_0x8c1f('0x39')][_0x8c1f('0x49')]){_0x2f283e['include']=[{'all':!![]}];}_0x2f283e=_['merge']({},_0x2f283e,_0x11b796['options']);return db[_0x8c1f('0x33')]['find'](_0x2f283e)[_0x8c1f('0x2b')](handleEntityNotFound(_0xda22fb,null))[_0x8c1f('0x2b')](respondWithResult(_0xda22fb,null))[_0x8c1f('0x4c')](handleError(_0xda22fb,null));};exports[_0x8c1f('0x4d')]=function(_0x1cbc37,_0x4c73fd,_0x24f06d){return db['Plugin'][_0x8c1f('0x4e')]({'where':{'id':_0x1cbc37['params']['id']},'attributes':[_0x8c1f('0x30'),_0x8c1f('0x5')],'raw':!![]})[_0x8c1f('0x2b')](handleEntityNotFound(_0x4c73fd,null))[_0x8c1f('0x2b')](function(_0x533f94){if(_0x533f94){var _0x49f3d7=path['join'](config[_0x8c1f('0x4f')],'server/files/plugins',util[_0x8c1f('0x50')](_0x8c1f('0x51'),path[_0x8c1f('0x52')](_0x533f94['path'])));var _0x4b55c6=fs[_0x8c1f('0x53')](_0x49f3d7);var _0x2ee783=archiver('zip',{'zlib':{'level':0x9}});_0x2ee783['on'](_0x8c1f('0x54'),function(_0x52b6f5){if(_0x52b6f5[_0x8c1f('0x55')]==='ENOENT'){logger['error'](_0x52b6f5);}else{throw new db['Sequelize'][(_0x8c1f('0x56'))](_0x8c1f('0x57'));}});_0x2ee783['on'](_0x8c1f('0x58'),function(_0x1a1dac){throw new db['Sequelize'][(_0x8c1f('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2ee783[_0x8c1f('0x59')](_0x4b55c6);_0x2ee783[_0x8c1f('0x5a')](_0x8c1f('0x5b'),{'cwd':path['join'](config[_0x8c1f('0x4f')],_0x8c1f('0x5c'),path[_0x8c1f('0x5d')](_0x533f94[_0x8c1f('0x5')])),'ignore':[path[_0x8c1f('0x5e')](path['basename'](_0x533f94[_0x8c1f('0x5')]),_0x8c1f('0x5f')),path[_0x8c1f('0x5e')](path[_0x8c1f('0x52')](_0x533f94[_0x8c1f('0x5')]),_0x8c1f('0x60'))],'nodir':!![]})['finalize']();_0x4b55c6['on'](_0x8c1f('0x61'),function(){if(!fs[_0x8c1f('0x62')](_0x49f3d7)){throw new db['Sequelize'][(_0x8c1f('0x56'))](_0x8c1f('0x63'));}return _0x4c73fd[_0x8c1f('0x4d')](_0x49f3d7,util['format'](_0x8c1f('0x51'),path[_0x8c1f('0x52')](_0x533f94[_0x8c1f('0x5')])),function(_0x1500a6){if(_0x1500a6){throw new db[(_0x8c1f('0x64'))][(_0x8c1f('0x56'))](_0x8c1f('0x65'));}fs['unlinkSync'](_0x49f3d7);logger[_0x8c1f('0x66')](_0x8c1f('0x67'));logger[_0x8c1f('0x66')](_0x8c1f('0x68'));});});}return null;})[_0x8c1f('0x4c')](handleError(_0x4c73fd,null));};exports[_0x8c1f('0x69')]=function(_0x17327a,_0x1b24ec,_0x40da47){var _0x385014=path['basename'](_0x17327a[_0x8c1f('0x6a')][_0x8c1f('0x6b')],path[_0x8c1f('0x6c')](_0x17327a[_0x8c1f('0x6a')]['filename']));var _0x14b101=path[_0x8c1f('0x5e')](config[_0x8c1f('0x4f')],_0x8c1f('0x5c'),_0x17327a[_0x8c1f('0x6a')]['filename']);var _0x121ca5=path['join'](config[_0x8c1f('0x4f')],_0x8c1f('0x5c'),_0x385014);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x14b101);logger[_0x8c1f('0x66')](_0x8c1f('0x6d'),_0x121ca5);try{fs['chmodSync'](_0x14b101,parseInt(_0x8c1f('0x6e'),0x8));extract(_0x14b101,{'dir':_0x121ca5},function(_0xee8b36){if(_0xee8b36){logger[_0x8c1f('0x58')](_0xee8b36);handleError(_0xee8b36,!![]);};var _0x47c814=fs[_0x8c1f('0x6f')](_0x121ca5);if(_0x47c814['length']>0x1){removeReferences(_0x14b101,_0x121ca5);logger[_0x8c1f('0x58')]('Invalid\x20plugin\x20structure');return _0x40da47(new Error(_0x8c1f('0x70')));}var _0x1056ac=fs['lstatSync'](path[_0x8c1f('0x5e')](_0x121ca5,_0x47c814[0x0]));if(_0x1056ac['isFile']()){removeReferences(_0x14b101,_0x121ca5);logger[_0x8c1f('0x58')](_0x8c1f('0x70'));return _0x40da47(new Error(_0x8c1f('0x70')));}if(_0x1056ac['isDirectory']()){var _0x214487=fs[_0x8c1f('0x6f')](path[_0x8c1f('0x5e')](_0x121ca5,_0x47c814[0x0]));if(_0x214487['length']===0x0){removeReferences(_0x14b101,_0x121ca5);logger[_0x8c1f('0x58')](_0x8c1f('0x70'));return _0x40da47(new Error(_0x8c1f('0x70')));}var _0x415e87=_0x214487[_0x8c1f('0x71')](function(_0x1b5ecd){return _0x1b5ecd===_0x8c1f('0x72');});if(!_0x415e87){return _0x40da47(new Error(_0x8c1f('0x73')));}var _0x43bb8e=fs[_0x8c1f('0x74')](path[_0x8c1f('0x5e')](_0x121ca5,_0x47c814[0x0],_0x8c1f('0x72')));var _0x67a1eb=JSON['parse'](_0x43bb8e);if(_0x8c1f('0x22')==typeof _0x67a1eb[_0x8c1f('0x30')]){return _0x40da47(new Error(_0x8c1f('0x75')));}if('undefined'==typeof _0x67a1eb[_0x8c1f('0x47')]){return _0x40da47(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8c1f('0x22')==typeof _0x67a1eb[_0x8c1f('0x76')]){return _0x40da47(new Error(_0x8c1f('0x77')));}if(_0x8c1f('0x22')==typeof _0x67a1eb['parameters']){return _0x40da47(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x67a1eb[_0x8c1f('0x47')]===_0x8c1f('0x78')){if(_0x8c1f('0x22')==typeof _0x67a1eb['parameters'][_0x8c1f('0x79')]){return _0x40da47(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x67a1eb[_0x8c1f('0x7a')]['views'][_0x8c1f('0x7b')]&&_0x8c1f('0x22')==typeof _0x67a1eb['parameters'][_0x8c1f('0x79')]['agent']){return _0x40da47(new Error(_0x8c1f('0x7c')));}}else if(_0x67a1eb[_0x8c1f('0x47')]===_0x8c1f('0x7d')){if(_0x8c1f('0x22')==typeof _0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x7e')]){return _0x40da47(new Error(_0x8c1f('0x7f')));}if('undefined'==typeof _0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x80')]){return _0x40da47(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x40da47(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5deb7c=_0x67a1eb['name'];var _0x18a262=_0x67a1eb[_0x8c1f('0x81')];var _0x3176e5=_0x67a1eb[_0x8c1f('0x47')];var _0x35beb0=_0x67a1eb[_0x8c1f('0x82')]?_0x67a1eb[_0x8c1f('0x82')]:_0x8c1f('0x83');var _0x57fb14=_0x67a1eb[_0x8c1f('0x84')]?_0x67a1eb[_0x8c1f('0x84')]:_0x8c1f('0x85');var _0x289135='';var _0x1e10cc='';var _0x17531f='';var _0x627c15='';var _0x135350=_0x67a1eb[_0x8c1f('0x76')];if(_0x3176e5===_0x8c1f('0x78')){if('undefined'!=typeof _0x67a1eb[_0x8c1f('0x7a')]['views'][_0x8c1f('0x7b')]){var _0x1b7199=_0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x79')][_0x8c1f('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x8c1f('0x86')](_0x1b7199)){_0x289135=path[_0x8c1f('0x5e')](_0x8c1f('0x87'),_0x385014,_0x47c814[0x0],_0x1b7199);}else{_0x289135=_0x1b7199;}}else{logger['info'](_0x8c1f('0x88'));}if(_0x8c1f('0x22')!=typeof _0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x79')]['agent']){var _0xee03f=_0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x79')][_0x8c1f('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x8c1f('0x86')](_0xee03f)){_0x1e10cc=path[_0x8c1f('0x5e')]('plugins',_0x385014,_0x47c814[0x0],_0xee03f);}else{_0x1e10cc=_0xee03f;}}else{logger['info'](_0x8c1f('0x8a'));}}else if(_0x3176e5===_0x8c1f('0x7d')){_0x17531f=_0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x7e')];_0x627c15=_0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x80')];if(_0x8c1f('0x22')!=typeof _0x67a1eb['parameters'][_0x8c1f('0x79')]){if(_0x8c1f('0x22')!=typeof _0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x79')][_0x8c1f('0x7b')]){var _0x1b7199=_0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x79')][_0x8c1f('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x8c1f('0x86')](_0x1b7199)){_0x289135=path[_0x8c1f('0x5e')]('plugins',_0x385014,_0x47c814[0x0],_0x1b7199);}else{_0x289135=_0x1b7199;}}if(_0x8c1f('0x22')!=typeof _0x67a1eb[_0x8c1f('0x7a')][_0x8c1f('0x79')][_0x8c1f('0x89')]){var _0xee03f=_0x67a1eb['parameters'][_0x8c1f('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x8c1f('0x86')](_0xee03f)){_0x1e10cc=path[_0x8c1f('0x5e')]('plugins',_0x385014,_0x47c814[0x0],_0xee03f);}else{_0x1e10cc=_0xee03f;}}}}var _0x2e7787={'name':_0x5deb7c,'description':_0x18a262,'path':path[_0x8c1f('0x5e')](_0x385014,_0x47c814[0x0]),'type':_0x3176e5,'sidebar':_0x35beb0,'icon':_0x57fb14,'adminUrl':_0x289135,'agentUrl':_0x1e10cc,'scriptName':_0x17531f,'scriptPath':_0x627c15,'version':_0x135350};removeReferences(_0x14b101,null);return db[_0x8c1f('0x33')]['create'](_0x2e7787)[_0x8c1f('0x2b')](function(_0x3f6360){var _0x5930fe={'role':_0x17327a['body']['role'],'userProfileId':_0x17327a[_0x8c1f('0x8b')]['userProfileId']};if(!_0x5930fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5930fe[_0x8c1f('0x8c')]==='user'){var _0x2b11d2=_0x3f6360[_0x8c1f('0x2d')]({'plain':!![]});return db[_0x8c1f('0x8d')]['find']({'where':{'name':_0x8c1f('0x2e'),'userProfileId':_0x5930fe['userProfileId']},'raw':!![]})[_0x8c1f('0x2b')](function(_0x48aec0){if(_0x48aec0&&_0x48aec0[_0x8c1f('0x8e')]===0x0){return db[_0x8c1f('0x2f')][_0x8c1f('0x8f')]({'name':_0x2b11d2['name'],'resourceId':_0x2b11d2['id'],'type':_0x48aec0[_0x8c1f('0x30')],'sectionId':_0x48aec0['id']},{})[_0x8c1f('0x2b')](function(){return _0x3f6360;});}else{return _0x3f6360;}})[_0x8c1f('0x4c')](function(_0x1f23b6){logger[_0x8c1f('0x58')](_0x8c1f('0x90'),_0x1f23b6);throw _0x1f23b6;});}return _0x3f6360;})[_0x8c1f('0x2b')](respondWithResult(_0x1b24ec,null))[_0x8c1f('0x4c')](handleError(_0x1b24ec,null));}});}catch(_0x1049ff){_0x1b24ec[_0x8c1f('0x1e')](0x1f4)['send'](_0x1049ff);}};function removeReferences(_0x4e04a6,_0x2bd4ee){try{if(_0x4e04a6){fs[_0x8c1f('0x91')](_0x4e04a6);logger[_0x8c1f('0x66')](_0x8c1f('0x92'));}if(_0x2bd4ee){rimraf(_0x2bd4ee,function(){});logger[_0x8c1f('0x66')](_0x8c1f('0x93'));}}catch(_0x1ec672){logger[_0x8c1f('0x58')](_0x1ec672);}}exports[_0x8c1f('0x2a')]=function(_0x3158d5,_0x5c44d5,_0x57ac61){return db[_0x8c1f('0x33')]['find']({'where':{'id':_0x3158d5['params']['id']}})[_0x8c1f('0x2b')](handleEntityNotFound(_0x5c44d5,null))['then'](saveUpdates(_0x3158d5[_0x8c1f('0x8b')],null))['then'](respondWithResult(_0x5c44d5,null))[_0x8c1f('0x4c')](handleError(_0x5c44d5,null));};exports['delete']=function(_0x1c61c6,_0x2dca26,_0x4c2683){return db[_0x8c1f('0x33')][_0x8c1f('0x4e')]({'where':{'id':_0x1c61c6[_0x8c1f('0x94')]['id']}})['then'](function(_0x16c8e4){if(_0x16c8e4){return _0x16c8e4['destroy']();}})['then'](function(_0x3256b5){rimraf(path[_0x8c1f('0x5e')](config[_0x8c1f('0x4f')],_0x8c1f('0x5c'),path[_0x8c1f('0x5d')](_0x3256b5['path'])),function(){});return _0x3256b5;})[_0x8c1f('0x2b')](handleEntityNotFound(_0x2dca26,null))[_0x8c1f('0x2b')](respondWithStatusCode(_0x2dca26,null))[_0x8c1f('0x4c')](handleError(_0x2dca26,null));};exports[_0x8c1f('0x95')]=function(_0x33f5b6,_0x25df74,_0x399814){return BPromise[_0x8c1f('0x96')]()[_0x8c1f('0x2b')](function(){if(!_0x33f5b6[_0x8c1f('0x39')][_0x8c1f('0x5')]){throw new Error(_0x8c1f('0x97'));}if(!_0x33f5b6[_0x8c1f('0x39')][_0x8c1f('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1cd31d=_0x33f5b6[_0x8c1f('0x39')][_0x8c1f('0x99')]?_0x33f5b6[_0x8c1f('0x39')][_0x8c1f('0x99')]+':'+_0x33f5b6[_0x8c1f('0x39')]['port']:_0x8c1f('0x9a')+_0x33f5b6[_0x8c1f('0x39')]['port'];var _0x93c3e2=_0x33f5b6[_0x8c1f('0x39')][_0x8c1f('0x20')]?_0x33f5b6['query']['json']:!![];var _0xa9b293=_0x33f5b6[_0x8c1f('0x39')][_0x8c1f('0x9b')]?_0x33f5b6['query'][_0x8c1f('0x9b')]:null;var _0xd648e5={'method':_0x33f5b6[_0x8c1f('0x9c')],'uri':util[_0x8c1f('0x50')](_0x8c1f('0x9d'),_0x1cd31d,_0x33f5b6[_0x8c1f('0x39')][_0x8c1f('0x5')]),'json':_0x93c3e2,'resolveWithFullResponse':!![],'encoding':_0xa9b293,'qs':_0x33f5b6[_0x8c1f('0x39')]};if(_0x33f5b6[_0x8c1f('0x9e')]){_0xd648e5[_0x8c1f('0x9e')]=_0x33f5b6[_0x8c1f('0x9e')];if(_0xd648e5['headers'][_0x8c1f('0x9f')]){delete _0xd648e5['headers'][_0x8c1f('0x9f')];}}if(_0xd648e5[_0x8c1f('0x9e')][_0x8c1f('0xa0')]){delete _0xd648e5[_0x8c1f('0x9e')]['content-type'];}return rp(_0xd648e5);})[_0x8c1f('0x2b')](function(_0x24a88b){if(_0x24a88b){_0x25df74['set'](_0x24a88b[_0x8c1f('0x9e')]);logger[_0x8c1f('0x66')](_0x24a88b[_0x8c1f('0x8b')]);if(_[_0x8c1f('0xa1')](_0x33f5b6['query']['path'],_0x8c1f('0x4d'))&&_0x24a88b[_0x8c1f('0xa2')]==0x1f4){return _0x25df74[_0x8c1f('0x1d')](_0x24a88b[_0x8c1f('0xa2')]);}else{return _0x25df74['status'](_0x24a88b['statusCode'])[_0x8c1f('0x31')](_0x24a88b['body']);}}else{return _0x25df74['sendStatus'](0xc8);}})[_0x8c1f('0x4c')](handleError(_0x25df74,null));};exports[_0x8c1f('0xa3')]=function(_0x4f6974,_0xac0d32,_0x2e56c7){return BPromise[_0x8c1f('0x96')]()[_0x8c1f('0x2b')](function(){if(!_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x5')]){throw new Error(_0x8c1f('0x97'));}if(!_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5d4729=_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x99')]?_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x99')]+':'+_0x4f6974['query'][_0x8c1f('0x98')]:'http://localhost:'+_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x98')];var _0xe6f5ef=_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x20')]?_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x20')]:!![];var _0x51da53=_0x4f6974['query']['encoding']?_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x9b')]:null;var _0x15649f={'method':_0x4f6974[_0x8c1f('0x9c')],'uri':util[_0x8c1f('0x50')](_0x8c1f('0x9d'),_0x5d4729,_0x4f6974[_0x8c1f('0x39')][_0x8c1f('0x5')]),'json':_0xe6f5ef,'resolveWithFullResponse':!![],'encoding':_0x51da53,'body':_0x4f6974[_0x8c1f('0x8b')]};if(_0x4f6974[_0x8c1f('0x9e')]){_0x15649f[_0x8c1f('0x9e')]=_0x4f6974['headers'];if(_0x15649f[_0x8c1f('0x9e')][_0x8c1f('0x9f')]){delete _0x15649f[_0x8c1f('0x9e')][_0x8c1f('0x9f')];}}if(_0x15649f[_0x8c1f('0x9e')][_0x8c1f('0xa0')]){delete _0x15649f[_0x8c1f('0x9e')]['content-type'];}return rp(_0x15649f);})[_0x8c1f('0x2b')](function(_0x14d4e6){if(_0x14d4e6){_0xac0d32[_0x8c1f('0x25')](_0x14d4e6[_0x8c1f('0x9e')]);logger['info'](_0x14d4e6[_0x8c1f('0x8b')]);return _0xac0d32[_0x8c1f('0x1e')](_0x14d4e6[_0x8c1f('0xa2')])[_0x8c1f('0x31')](_0x14d4e6[_0x8c1f('0x8b')]);}else{return _0xac0d32[_0x8c1f('0x1d')](0xc8);}})['catch'](handleError(_0xac0d32,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b0bb9a8..88d6a4a 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 _0x5d58=['hook','update','remove','emit','hasOwnProperty'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5d58,0x187));var _0x85d5=function(_0x36f5d5,_0xdbc597){_0x36f5d5=_0x36f5d5-0x0;var _0x54fb2e=_0x5d58[_0x36f5d5];return _0x54fb2e;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x85d5('0x0'),'afterDestroy':_0x85d5('0x1')};function emitEvent(_0x53ca58){return function(_0x1469fc,_0x30bfe8,_0x54207b){PluginEvents[_0x85d5('0x2')](_0x53ca58+':'+_0x1469fc['id'],_0x1469fc);PluginEvents[_0x85d5('0x2')](_0x53ca58,_0x1469fc);_0x54207b(null);};}for(var e in events){if(events[_0x85d5('0x3')](e)){var event=events[e];Plugin[_0x85d5('0x4')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xafc4=['update','remove','emit','hasOwnProperty','hook','exports','events','Plugin','save'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xafc4,0x69));var _0x4afc=function(_0xcf697f,_0x2f55f6){_0xcf697f=_0xcf697f-0x0;var _0x513813=_0xafc4[_0xcf697f];return _0x513813;};'use strict';var EventEmitter=require(_0x4afc('0x0'));var Plugin=require('../../mysqldb')['db'][_0x4afc('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4afc('0x2'),'afterUpdate':_0x4afc('0x3'),'afterDestroy':_0x4afc('0x4')};function emitEvent(_0x237ea0){return function(_0x4d9dbd,_0x49f417,_0x5378e5){PluginEvents[_0x4afc('0x5')](_0x237ea0+':'+_0x4d9dbd['id'],_0x4d9dbd);PluginEvents[_0x4afc('0x5')](_0x237ea0,_0x4d9dbd);_0x5378e5(null);};}for(var e in events){if(events[_0x4afc('0x6')](e)){var event=events[e];Plugin[_0x4afc('0x7')](e,emitEvent(event));}}module[_0x4afc('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0af947d..2afe109 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 _0x8347=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x8347,0xa9));var _0x7834=function(_0x5bc084,_0x2ef6ed){_0x5bc084=_0x5bc084-0x0;var _0x2a70de=_0x8347[_0x5bc084];return _0x2a70de;};'use strict';var _=require(_0x7834('0x0'));var util=require(_0x7834('0x1'));var logger=require('../../config/logger')(_0x7834('0x2'));var moment=require(_0x7834('0x3'));var BPromise=require(_0x7834('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7834('0x5'));var rimraf=require(_0x7834('0x6'));var config=require(_0x7834('0x7'));var attributes=require(_0x7834('0x8'));module[_0x7834('0x9')]=function(_0x4d061d,_0x5cc457){return _0x4d061d[_0x7834('0xa')](_0x7834('0xb'),attributes,{'tableName':_0x7834('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5da0=['path','rimraf','exports','Plugin','plugins','lodash','../../config/logger','api','request-promise'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x5da0,0x1be));var _0x05da=function(_0x4f172e,_0x7205c3){_0x4f172e=_0x4f172e-0x0;var _0x49671e=_0x5da0[_0x4f172e];return _0x49671e;};'use strict';var _=require(_0x05da('0x0'));var util=require('util');var logger=require(_0x05da('0x1'))(_0x05da('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x05da('0x3'));var fs=require('fs');var path=require(_0x05da('0x4'));var rimraf=require(_0x05da('0x5'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x05da('0x6')]=function(_0x46cd82,_0x250d94){return _0x46cd82['define'](_0x05da('0x7'),attributes,{'tableName':_0x05da('0x8'),'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 38cff18..5fb58e1 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 _0xba6e=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreatePlugin','Plugin','create','body','options','raw','catch','lodash','util','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xba6e,0xb0));var _0xeba6=function(_0x16012d,_0x59eede){_0x16012d=_0x16012d-0x0;var _0x550b0c=_0xba6e[_0x16012d];return _0x550b0c;};'use strict';var _=require(_0xeba6('0x0'));var util=require(_0xeba6('0x1'));var moment=require(_0xeba6('0x2'));var BPromise=require(_0xeba6('0x3'));var rs=require(_0xeba6('0x4'));var fs=require('fs');var Redis=require(_0xeba6('0x5'));var db=require(_0xeba6('0x6'))['db'];var utils=require(_0xeba6('0x7'));var logger=require('../../config/logger')(_0xeba6('0x8'));var config=require(_0xeba6('0x9'));var jayson=require(_0xeba6('0xa'));var client=jayson[_0xeba6('0xb')][_0xeba6('0xc')]({'port':0x232a});config[_0xeba6('0xd')]=_[_0xeba6('0xe')](config[_0xeba6('0xd')],{'host':_0xeba6('0xf'),'port':0x18eb});var socket=require(_0xeba6('0x10'))(new Redis(config[_0xeba6('0xd')]));require(_0xeba6('0x11'))[_0xeba6('0x12')](socket);function respondWithRpcPromise(_0x122e89,_0x5b740b,_0x4c4cf8){return new BPromise(function(_0x5a00b6,_0x489c6f){return client['request'](_0x122e89,_0x4c4cf8)[_0xeba6('0x13')](function(_0x4438b9){logger['info'](_0xeba6('0x14'),_0x5b740b,_0xeba6('0x15'));logger['debug'](_0xeba6('0x16'),_0x5b740b,_0xeba6('0x15'),JSON[_0xeba6('0x17')](_0x4438b9));if(_0x4438b9[_0xeba6('0x18')]){if(_0x4438b9[_0xeba6('0x18')][_0xeba6('0x19')]===0x1f4){logger[_0xeba6('0x18')](_0xeba6('0x14'),_0x5b740b,_0x4438b9[_0xeba6('0x18')][_0xeba6('0x1a')]);return _0x489c6f(_0x4438b9[_0xeba6('0x18')][_0xeba6('0x1a')]);}logger['error'](_0xeba6('0x14'),_0x5b740b,_0x4438b9['error'][_0xeba6('0x1a')]);return _0x5a00b6(_0x4438b9['error'][_0xeba6('0x1a')]);}else{logger[_0xeba6('0x1b')]('Plugin,\x20%s,\x20%s',_0x5b740b,_0xeba6('0x15'));_0x5a00b6(_0x4438b9[_0xeba6('0x1c')]['message']);}})['catch'](function(_0x3eeadb){logger[_0xeba6('0x18')](_0xeba6('0x14'),_0x5b740b,_0x3eeadb);_0x489c6f(_0x3eeadb);});});}exports[_0xeba6('0x1d')]=function(_0xb186ad){var _0xc96129=this;return new Promise(function(_0xcfb763,_0xa85a2d){return db[_0xeba6('0x1e')][_0xeba6('0x1f')](_0xb186ad[_0xeba6('0x20')],{'raw':_0xb186ad[_0xeba6('0x21')]?_0xb186ad[_0xeba6('0x21')][_0xeba6('0x22')]===undefined?!![]:![]:!![]})[_0xeba6('0x13')](function(_0x1f7d7d){logger[_0xeba6('0x1b')](_0xeba6('0x1d'),_0xb186ad);logger['debug'](_0xeba6('0x1d'),_0xb186ad,JSON[_0xeba6('0x17')](_0x1f7d7d));_0xcfb763(_0x1f7d7d);})[_0xeba6('0x23')](function(_0x530eb3){logger[_0xeba6('0x18')](_0xeba6('0x1d'),_0x530eb3[_0xeba6('0x1a')],_0xb186ad);_0xa85a2d(_0xc96129['error'](0x1f4,_0x530eb3[_0xeba6('0x1a')]));});});}; \ No newline at end of file +var _0x80e3=['debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreatePlugin','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./plugin.socket','then','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x2e83c2,_0x4fdaff){var _0x5dad29=function(_0x9d5998){while(--_0x9d5998){_0x2e83c2['push'](_0x2e83c2['shift']());}};_0x5dad29(++_0x4fdaff);}(_0x80e3,0x14b));var _0x380e=function(_0x4410ab,_0x1f440e){_0x4410ab=_0x4410ab-0x0;var _0x523db0=_0x80e3[_0x4410ab];return _0x523db0;};'use strict';var _=require(_0x380e('0x0'));var util=require(_0x380e('0x1'));var moment=require(_0x380e('0x2'));var BPromise=require(_0x380e('0x3'));var rs=require(_0x380e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x380e('0x5'))['db'];var utils=require(_0x380e('0x6'));var logger=require('../../config/logger')(_0x380e('0x7'));var config=require(_0x380e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x380e('0x9')]=_[_0x380e('0xa')](config[_0x380e('0x9')],{'host':_0x380e('0xb'),'port':0x18eb});var socket=require(_0x380e('0xc'))(new Redis(config[_0x380e('0x9')]));require(_0x380e('0xd'))['register'](socket);function respondWithRpcPromise(_0x239967,_0x382cf6,_0x1d6d22){return new BPromise(function(_0x1f8883,_0x24e4c2){return client['request'](_0x239967,_0x1d6d22)[_0x380e('0xe')](function(_0x2ad2fb){logger['info'](_0x380e('0xf'),_0x382cf6,_0x380e('0x10'));logger[_0x380e('0x11')](_0x380e('0x12'),_0x382cf6,_0x380e('0x10'),JSON[_0x380e('0x13')](_0x2ad2fb));if(_0x2ad2fb[_0x380e('0x14')]){if(_0x2ad2fb[_0x380e('0x14')][_0x380e('0x15')]===0x1f4){logger[_0x380e('0x14')](_0x380e('0xf'),_0x382cf6,_0x2ad2fb[_0x380e('0x14')][_0x380e('0x16')]);return _0x24e4c2(_0x2ad2fb[_0x380e('0x14')][_0x380e('0x16')]);}logger[_0x380e('0x14')]('Plugin,\x20%s,\x20%s',_0x382cf6,_0x2ad2fb[_0x380e('0x14')]['message']);return _0x1f8883(_0x2ad2fb[_0x380e('0x14')]['message']);}else{logger[_0x380e('0x17')]('Plugin,\x20%s,\x20%s',_0x382cf6,_0x380e('0x10'));_0x1f8883(_0x2ad2fb['result']['message']);}})[_0x380e('0x18')](function(_0x52603c){logger[_0x380e('0x14')](_0x380e('0xf'),_0x382cf6,_0x52603c);_0x24e4c2(_0x52603c);});});}exports[_0x380e('0x19')]=function(_0x46fb1a){var _0x24d71d=this;return new Promise(function(_0x3b646e,_0xbc8d5e){return db['Plugin'][_0x380e('0x1a')](_0x46fb1a[_0x380e('0x1b')],{'raw':_0x46fb1a[_0x380e('0x1c')]?_0x46fb1a[_0x380e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x380e('0xe')](function(_0x46f24a){logger[_0x380e('0x17')](_0x380e('0x19'),_0x46fb1a);logger[_0x380e('0x11')](_0x380e('0x19'),_0x46fb1a,JSON['stringify'](_0x46f24a));_0x3b646e(_0x46f24a);})[_0x380e('0x18')](function(_0x14839d){logger[_0x380e('0x14')]('CreatePlugin',_0x14839d[_0x380e('0x16')],_0x46fb1a);_0xbc8d5e(_0x24d71d[_0x380e('0x14')](0x1f4,_0x14839d[_0x380e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 536060a..6b7d739 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 _0x3a7d=['remove','update','emit','removeListener','./plugin.events','save'];(function(_0x212635,_0x44f918){var _0x1ece89=function(_0x2f35b1){while(--_0x2f35b1){_0x212635['push'](_0x212635['shift']());}};_0x1ece89(++_0x44f918);}(_0x3a7d,0x136));var _0xd3a7=function(_0x5455b0,_0x5bd460){_0x5455b0=_0x5455b0-0x0;var _0x2d5aec=_0x3a7d[_0x5455b0];return _0x2d5aec;};'use strict';var PluginEvents=require(_0xd3a7('0x0'));var events=[_0xd3a7('0x1'),_0xd3a7('0x2'),_0xd3a7('0x3')];function createListener(_0x392908,_0x552192){return function(_0x3fa112){_0x552192[_0xd3a7('0x4')](_0x392908,_0x3fa112);};}function removeListener(_0x973d2e,_0x28f493){return function(){PluginEvents[_0xd3a7('0x5')](_0x973d2e,_0x28f493);};}exports['register']=function(_0x2120b4){for(var _0x985cbc=0x0,_0x279851=events['length'];_0x985cbc<_0x279851;_0x985cbc++){var _0x53b0d1=events[_0x985cbc];var _0x338b3b=createListener('plugin:'+_0x53b0d1,_0x2120b4);PluginEvents['on'](_0x53b0d1,_0x338b3b);}}; \ No newline at end of file +var _0xbaf5=['plugin:','./plugin.events','save','update','emit','removeListener','length'];(function(_0x4b6658,_0x3dc38c){var _0x5006fb=function(_0x23044d){while(--_0x23044d){_0x4b6658['push'](_0x4b6658['shift']());}};_0x5006fb(++_0x3dc38c);}(_0xbaf5,0x12e));var _0x5baf=function(_0x45c574,_0x497848){_0x45c574=_0x45c574-0x0;var _0x2fa16a=_0xbaf5[_0x45c574];return _0x2fa16a;};'use strict';var PluginEvents=require(_0x5baf('0x0'));var events=[_0x5baf('0x1'),'remove',_0x5baf('0x2')];function createListener(_0x5cef52,_0xa2d30f){return function(_0x203d1c){_0xa2d30f[_0x5baf('0x3')](_0x5cef52,_0x203d1c);};}function removeListener(_0x1e5634,_0x4bf11e){return function(){PluginEvents[_0x5baf('0x4')](_0x1e5634,_0x4bf11e);};}exports['register']=function(_0x3f541a){for(var _0x510ee0=0x0,_0xe457fa=events[_0x5baf('0x5')];_0x510ee0<_0xe457fa;_0x510ee0++){var _0x1c86ea=events[_0x510ee0];var _0x4b2a58=createListener(_0x5baf('0x6')+_0x1c86ea,_0x3f541a);PluginEvents['on'](_0x1c86ea,_0x4b2a58);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index edeabd1..880691a 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(_0x41bf2,_0x3ea33b){var _0x3b8429=function(_0x437979){while(--_0x437979){_0x41bf2['push'](_0x41bf2['shift']());}};_0x3b8429(++_0x3ea33b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x2306df,_0x168598){var _0x5c433a=function(_0x43cd4d){while(--_0x43cd4d){_0x2306df['push'](_0x2306df['shift']());}};_0x5c433a(++_0x168598);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 6842cb6..a4bb0e9 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 _0xf72b=['hasOwnProperty','Unknown\x20status','destroy','params','delete','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','index','then','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf72b,0x1d9));var _0xbf72=function(_0x5230b2,_0x39207f){_0x5230b2=_0x5230b2-0x0;var _0xb890e2=_0xf72b[_0x5230b2];return _0xb890e2;};'use strict';var _=require(_0xbf72('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbf72('0x1'))('api');var path=require(_0xbf72('0x2'));var exec=require(_0xbf72('0x3'))['exec'];var BPromise=require(_0xbf72('0x4'));function handleEntityNotFound(_0x550a9e,_0x37afc8){return function(_0x3d3a6f){if(!_0x3d3a6f){_0x550a9e[_0xbf72('0x5')](0x194);;}return _0x3d3a6f;};}function respondWithResult(_0x2b8440,_0x5ee060){_0x5ee060=_0x5ee060||0xc8;return function(_0x41c11d){if(_0x41c11d){return _0x2b8440[_0xbf72('0x6')](_0x5ee060)[_0xbf72('0x7')](_0x41c11d);}return null;};}function handleError(_0xd0402c,_0xdd6177){_0xdd6177=_0xdd6177||0x1f4;return function(_0x1b6d38){logger['error'](_0x1b6d38[_0xbf72('0x8')]);if(_0x1b6d38['name']){delete _0x1b6d38[_0xbf72('0x9')];}_0xd0402c[_0xbf72('0x6')](_0xdd6177)['send'](_0x1b6d38);};}function execChildProcess(){return new BPromise(function(_0xaec095,_0x1c3453){exec(_0xbf72('0xa'),function(_0x145acb,_0x2957c5,_0x44ce73){logger[_0xbf72('0xb')](_0x2957c5);logger[_0xbf72('0xb')](_0x44ce73);if(_0x145acb){logger['error'](_0x145acb);return _0x1c3453(_0x145acb);}return _0xaec095(_0x2957c5);});});}exports[_0xbf72('0xc')]=function(_0x227a35,_0x57cccf){return pm2['list']()[_0xbf72('0xd')](function(_0x4f4fa5){if(_0x4f4fa5){var _0x5625b3=_['reject'](_0x4f4fa5,function(_0x32a0a5){return _0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xe')||_0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xf');});return{'rows':_0x5625b3,'count':_0x5625b3[_0xbf72('0x10')]};}return null;})['then'](respondWithResult(_0x57cccf,null))[_0xbf72('0x11')](handleError(_0x57cccf,null));};exports[_0xbf72('0x12')]=function(_0x2a8609,_0x3d4dea){return pm2[_0xbf72('0x13')](_0x2a8609['params']['id'])['then'](respondWithResult(_0x3d4dea,null))[_0xbf72('0xd')](handleEntityNotFound(_0x3d4dea,null))[_0xbf72('0x11')](handleError(_0x3d4dea,null));};exports[_0xbf72('0x14')]=function(_0x2584d9,_0x27e58e){if(_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')]&&_0x2584d9['body'][_0xbf72('0x16')]){var _0x42a193=path[_0xbf72('0x17')](__dirname,_0xbf72('0x18'),_0x2584d9[_0xbf72('0x15')]['script']);var _0x3cd181=process[_0xbf72('0x19')]();process['chdir'](path[_0xbf72('0x1a')](_0x42a193));return execChildProcess()[_0xbf72('0xd')](function(_0x267c41){process['chdir'](_0x3cd181);return pm2[_0xbf72('0x1b')]({'name':_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')],'script':_0x42a193});})[_0xbf72('0xd')](function(_0x4f4dc0){pm2[_0xbf72('0x1c')]();return _0x4f4dc0[0x0];})[_0xbf72('0xd')](respondWithResult(_0x27e58e,0xc9))[_0xbf72('0x11')](handleError(_0x27e58e,null));}else{return _0x27e58e['status'](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x1e')});}};exports[_0xbf72('0x1f')]=function(_0x1a2f55,_0x15d60d){if(_0x1a2f55[_0xbf72('0x15')]['id']){delete _0x1a2f55[_0xbf72('0x15')]['id'];}var _0x25ecdf={'online':_0xbf72('0x20'),'stopped':_0xbf72('0x21')};if(_0x25ecdf[_0xbf72('0x22')](_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')])){return pm2[_0x25ecdf[_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')]]](_0x1a2f55['params']['id'])[_0xbf72('0xd')](respondWithResult(_0x15d60d,0xc8))[_0xbf72('0x11')](handleError(_0x15d60d,null));}else{return _0x15d60d[_0xbf72('0x6')](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x23')});}};exports[_0xbf72('0x24')]=function(_0x35ecdc,_0x209b2b){if(_0x35ecdc[_0xbf72('0x15')]['id']){delete _0x35ecdc[_0xbf72('0x15')]['id'];}if(_0x35ecdc[_0xbf72('0x25')]['id']){return pm2[_0xbf72('0x26')](_0x35ecdc[_0xbf72('0x25')]['id'])[_0xbf72('0xd')](function(_0x4e2472){pm2[_0xbf72('0x1c')]();return _0x4e2472[0x0];})[_0xbf72('0xd')](respondWithResult(_0x209b2b,null))[_0xbf72('0x11')](handleError(_0x209b2b,null));}else{return _0x209b2b['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x0fd9=['error','index','list','reject','express','then','catch','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','hasOwnProperty','Unknown\x20status','params','Unknown\x20id','../../config/pm2','../../config/logger','api','path','bluebird','sendStatus','status','stack','name','send','npm\x20install','info'];(function(_0x402c68,_0x259544){var _0x1ba470=function(_0x323d17){while(--_0x323d17){_0x402c68['push'](_0x402c68['shift']());}};_0x1ba470(++_0x259544);}(_0x0fd9,0xa3));var _0x90fd=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x0fd9[_0x542da8];return _0x533d7e;};'use strict';var _=require('lodash');var pm2=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var path=require(_0x90fd('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0x90fd('0x4'));function handleEntityNotFound(_0x2a5f76,_0xb7cf6){return function(_0x37a8be){if(!_0x37a8be){_0x2a5f76[_0x90fd('0x5')](0x194);;}return _0x37a8be;};}function respondWithResult(_0x23e11b,_0x5e2107){_0x5e2107=_0x5e2107||0xc8;return function(_0x4ff2d4){if(_0x4ff2d4){return _0x23e11b[_0x90fd('0x6')](_0x5e2107)['json'](_0x4ff2d4);}return null;};}function handleError(_0x5a604a,_0x2acef7){_0x2acef7=_0x2acef7||0x1f4;return function(_0x1becf2){logger['error'](_0x1becf2[_0x90fd('0x7')]);if(_0x1becf2[_0x90fd('0x8')]){delete _0x1becf2[_0x90fd('0x8')];}_0x5a604a[_0x90fd('0x6')](_0x2acef7)[_0x90fd('0x9')](_0x1becf2);};}function execChildProcess(){return new BPromise(function(_0x3be346,_0x2aae77){exec(_0x90fd('0xa'),function(_0x3c541e,_0x48943e,_0x23c417){logger[_0x90fd('0xb')](_0x48943e);logger['info'](_0x23c417);if(_0x3c541e){logger[_0x90fd('0xc')](_0x3c541e);return _0x2aae77(_0x3c541e);}return _0x3be346(_0x48943e);});});}exports[_0x90fd('0xd')]=function(_0x19a594,_0x5f28ab){return pm2[_0x90fd('0xe')]()['then'](function(_0x1cae40){if(_0x1cae40){var _0xb402d9=_[_0x90fd('0xf')](_0x1cae40,function(_0x1b3f3b){return _0x1b3f3b[_0x90fd('0x8')]===_0x90fd('0x10')||_0x1b3f3b[_0x90fd('0x8')]==='motion2';});return{'rows':_0xb402d9,'count':_0xb402d9['length']};}return null;})[_0x90fd('0x11')](respondWithResult(_0x5f28ab,null))[_0x90fd('0x12')](handleError(_0x5f28ab,null));};exports['show']=function(_0x130489,_0x13a694){return pm2[_0x90fd('0x13')](_0x130489['params']['id'])[_0x90fd('0x11')](respondWithResult(_0x13a694,null))[_0x90fd('0x11')](handleEntityNotFound(_0x13a694,null))[_0x90fd('0x12')](handleError(_0x13a694,null));};exports[_0x90fd('0x14')]=function(_0x251957,_0x58866f){if(_0x251957[_0x90fd('0x15')][_0x90fd('0x8')]&&_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]){var _0x19e79b=path[_0x90fd('0x17')](__dirname,_0x90fd('0x18'),_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]);var _0x493c26=process[_0x90fd('0x19')]();process[_0x90fd('0x1a')](path[_0x90fd('0x1b')](_0x19e79b));return execChildProcess()[_0x90fd('0x11')](function(_0x411a6a){process[_0x90fd('0x1a')](_0x493c26);return pm2[_0x90fd('0x1c')]({'name':_0x251957[_0x90fd('0x15')]['name'],'script':_0x19e79b});})[_0x90fd('0x11')](function(_0x52b066){pm2[_0x90fd('0x1d')]();return _0x52b066[0x0];})[_0x90fd('0x11')](respondWithResult(_0x58866f,0xc9))[_0x90fd('0x12')](handleError(_0x58866f,null));}else{return _0x58866f[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x90fd('0x1e')]=function(_0xe333f0,_0x2fffe6){if(_0xe333f0[_0x90fd('0x15')]['id']){delete _0xe333f0[_0x90fd('0x15')]['id'];}var _0x428bc2={'online':'restart','stopped':'stop'};if(_0x428bc2[_0x90fd('0x1f')](_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')])){return pm2[_0x428bc2[_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')]]](_0xe333f0['params']['id'])['then'](respondWithResult(_0x2fffe6,0xc8))[_0x90fd('0x12')](handleError(_0x2fffe6,null));}else{return _0x2fffe6[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x20')});}};exports['destroy']=function(_0x59aede,_0x12dea4){if(_0x59aede[_0x90fd('0x15')]['id']){delete _0x59aede[_0x90fd('0x15')]['id'];}if(_0x59aede[_0x90fd('0x21')]['id']){return pm2['delete'](_0x59aede[_0x90fd('0x21')]['id'])[_0x90fd('0x11')](function(_0x7fb8bc){pm2[_0x90fd('0x1d')]();return _0x7fb8bc[0x0];})[_0x90fd('0x11')](respondWithResult(_0x12dea4,null))[_0x90fd('0x12')](handleError(_0x12dea4,null));}else{return _0x12dea4[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 32adf28..9d57d88 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 _0x85a1=['/agents','isAuthenticated','getAgents','/queues','exports','express','./realtime.controller','get'];(function(_0x446f00,_0x19769e){var _0x35fff3=function(_0x3c5308){while(--_0x3c5308){_0x446f00['push'](_0x446f00['shift']());}};_0x35fff3(++_0x19769e);}(_0x85a1,0x145));var _0x185a=function(_0x21632a,_0x28f971){_0x21632a=_0x21632a-0x0;var _0x30b01d=_0x85a1[_0x21632a];return _0x30b01d;};'use strict';var express=require(_0x185a('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x185a('0x1'));router[_0x185a('0x2')](_0x185a('0x3'),auth[_0x185a('0x4')](),controller[_0x185a('0x5')]);router[_0x185a('0x2')](_0x185a('0x6'),auth['isAuthenticated'](),controller['getQueues']);module[_0x185a('0x7')]=router; \ No newline at end of file +var _0x3521=['get','/queues','getQueues','exports','../../components/auth/service','isAuthenticated','getAgents'];(function(_0x27d3a8,_0x54fcd1){var _0x3d5403=function(_0x16c8aa){while(--_0x16c8aa){_0x27d3a8['push'](_0x27d3a8['shift']());}};_0x3d5403(++_0x54fcd1);}(_0x3521,0x17e));var _0x1352=function(_0x24d451,_0x4b5a2d){_0x24d451=_0x24d451-0x0;var _0x5015bd=_0x3521[_0x24d451];return _0x5015bd;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1352('0x0'));var controller=require('./realtime.controller');router['get']('/agents',auth[_0x1352('0x1')](),controller[_0x1352('0x2')]);router[_0x1352('0x3')](_0x1352('0x4'),auth[_0x1352('0x1')](),controller[_0x1352('0x5')]);module[_0x1352('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 3aba174..c182b7f 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 _0xd2ce=['order','push','Pause','where','merge','user','role','userProfileId','online','extraQueryConditions','assign','getResources','User','findAndCountAll','map','find','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','format','startCase','fieldName','key','outbound','dialActive','dialMethod','QueueCampaigns','filter','getRealtimeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','undefined','limit','count','offset','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','rawAttributes','type','getOptions','FIELD(id,'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xd2ce,0x16d));var _0xed2c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd2ce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var rta=require(_0xed2c('0x1'));var rtq=require(_0xed2c('0x2'));var qs=require(_0xed2c('0x3'));var utils=require(_0xed2c('0x4'));var db=require(_0xed2c('0x5'))['db'];var APIBadRequestError=require(_0xed2c('0x6'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x397df5,_0x5edc8e){return function(_0x5ca85e){if(_0x5ca85e){var _0x937158=typeof _0x5edc8e['offset']===_0xed2c('0x7')&&typeof _0x5edc8e[_0xed2c('0x8')]===_0xed2c('0x7');var _0x23a5f2=_0x5ca85e[_0xed2c('0x9')];var _0x3ffb0d=_0x937158?0x0:_0x5edc8e[_0xed2c('0xa')];var _0x5c49e4=_0x937158?_0x5ca85e[_0xed2c('0x9')]:_0x5edc8e[_0xed2c('0xa')]+_0x5edc8e[_0xed2c('0x8')];var _0x28bd7b;if(_0x5c49e4>=_0x23a5f2){_0x5c49e4=_0x23a5f2;_0x28bd7b=0xc8;}else{_0x28bd7b=0xce;}_0x397df5[_0xed2c('0xb')](_0x28bd7b);return _0x397df5[_0xed2c('0xc')](_0xed2c('0xd'),_0x3ffb0d+'-'+_0x5c49e4+'/'+_0x23a5f2)[_0xed2c('0xe')](_0x5ca85e);}return null;};}exports[_0xed2c('0xf')]=function(_0x18f79d,_0xcc704d){var _0x4f5621={'count':0x0,'rows':[]};var _0x465f49={};var _0x3e42e7;var _0x3e3acf=utils[_0xed2c('0x10')]();var _0x16f89d;var _0x5449ea;var _0x882656=_0x18f79d['query'][_0xed2c('0x11')];var _0x264f30=_0x18f79d[_0xed2c('0x12')][_0xed2c('0x13')];var _0x1f4b60=_0x18f79d['query'][_0xed2c('0x14')];var _0x384084=_0x264f30===_0xed2c('0x15')||_0x264f30===_0xed2c('0x16')?!![]:![];var _0x2748fb=[];var _0x144d2e;var _0x376117;Promise[_0xed2c('0x17')]()[_0xed2c('0x18')](function(){if(_0x18f79d[_0xed2c('0x12')][_0xed2c('0x19')]){if(!utils[_0xed2c('0x1a')](_0x18f79d[_0xed2c('0x12')][_0xed2c('0x19')])){throw new APIBadRequestError(util['format'](_0xed2c('0x1b'),_0x18f79d['query'][_0xed2c('0x19')]));}_0x3e42e7=_0x18f79d[_0xed2c('0x12')][_0xed2c('0x19')][_0xed2c('0x1c')]();}if(!_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]||!_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]['includes'](_0xed2c('0x1e'))){_0x18f79d[_0xed2c('0x12')]['sort']=rta[_0xed2c('0x1f')](_0x18f79d['query'][_0xed2c('0x1d')]);return;}var _0x1946f1=rta[_0xed2c('0x20')](_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]);_0x18f79d[_0xed2c('0x12')][_0xed2c('0x1d')]=_0x1946f1[_0xed2c('0x21')][_0xed2c('0x22')](',');_0x144d2e=_0x1946f1['order'];})[_0xed2c('0x18')](function(){if(!_0x882656){return[];}return rta[_0xed2c('0x23')](_0x882656,_0x3e42e7);})['then'](function(_0x4efa4b){_0x2748fb=_0x4efa4b;return rta[_0xed2c('0x24')]();})[_0xed2c('0x18')](function(_0x1025bc){_0x5449ea=_0x1025bc[_0xed2c('0x25')];if((!_0x264f30||_0x384084)&&!_0x144d2e){return _0x2748fb;}if(_0x144d2e&&!_0x264f30){return rta[_0xed2c('0x26')](_0x5449ea,_0x2748fb,_0x144d2e);}else{return rta[_0xed2c('0x27')](_0x5449ea,_0x2748fb,_0x264f30);}})[_0xed2c('0x18')](function(_0x3dd83d){_0x2748fb=_0x3dd83d;var _0xb0f188=![];if(_0x2748fb[_0xed2c('0x28')]===0x0){if(_0x882656||_0x264f30){_0xb0f188=!![];}if(_0x384084){_0xb0f188=![];}}if(_0xb0f188){return _0x4f5621;}var _0x3342cf=_['map'](db['User'][_0xed2c('0x29')],function(_0x15bc96){return{'name':_0x15bc96['fieldName'],'type':_0x15bc96[_0xed2c('0x2a')]['key']};});_0x18f79d['query']['role']='agent';_0x465f49=qs[_0xed2c('0x2b')](_0x3342cf,_0x18f79d);_0x465f49['raw']=!![];var _0x2d24e9=[];if(_0x2748fb[_0xed2c('0x28')]>0x0){_0x2d24e9['push']({'id':{'$in':_0x2748fb}});if(_0x144d2e&&!_0x264f30){_0x376117=[db['sequelize']['literal'](_0xed2c('0x2c')+_0x2748fb+')')];_0x465f49[_0xed2c('0x2d')]=_0x376117;}}if(_0x384084){_0x3e3acf['forEach'](function(_0x4491fe){var _0x25b0d0=!![];if(_0x264f30===_0xed2c('0x16')&&_0x3e42e7!==_0x4491fe){_0x25b0d0=![];}_0x2d24e9[_0xed2c('0x2e')]({[_0x4491fe+_0xed2c('0x2f')]:_0x25b0d0});});if(_0x1f4b60){_0x2d24e9[_0xed2c('0x2e')]({'pauseType':_0x1f4b60});}}else if(_0x264f30){_0x3e3acf['forEach'](function(_0x3303ba){_0x2d24e9['push']({[_0x3303ba+_0xed2c('0x2f')]:![]});});}_0x465f49[_0xed2c('0x30')]=_[_0xed2c('0x31')](_0x465f49[_0xed2c('0x30')],{'$and':_0x2d24e9});if(_0x18f79d[_0xed2c('0x32')][_0xed2c('0x33')]===_0xed2c('0x32')){var _0x5373e6={'params':{'id':_0x18f79d[_0xed2c('0x32')][_0xed2c('0x34')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x2748fb,'customSorting':_0x376117}};if(_0x18f79d[_0xed2c('0x12')][_0xed2c('0x35')]){_0x5373e6['query'][_0xed2c('0x35')]=!![];}if(_0x384084){_0x5373e6[_0xed2c('0x12')][_0xed2c('0x36')]=_0x2d24e9;}_0x5373e6[_0xed2c('0x12')]=Object[_0xed2c('0x37')](_0x5373e6[_0xed2c('0x12')],_0x18f79d[_0xed2c('0x12')]);return db['UserProfile'][_0xed2c('0x38')](_0x5373e6);}return db[_0xed2c('0x39')][_0xed2c('0x3a')](_0x465f49);})[_0xed2c('0x18')](function(_0x5b46e9){_0x4f5621[_0xed2c('0x9')]=_0x5b46e9[_0xed2c('0x9')];_0x16f89d=_0x5b46e9[_0xed2c('0x25')];return _0x16f89d[_0xed2c('0x3b')](function(_0x499d37){var _0x9b18b1=_[_0xed2c('0x3c')](_0x5449ea,['id',_0x499d37['id']]);if(_0x9b18b1){var _0x30980a=rta[_0xed2c('0x3d')](_0x9b18b1);_[_0xed2c('0x31')](_0x499d37,_0x30980a);}_0x499d37[_0xed2c('0x1e')]=rta[_0xed2c('0x3e')](_0x499d37);if(_0x499d37[_0xed2c('0x1e')][_0xed2c('0x3f')](_0xed2c('0x15'))){_0x3e3acf['forEach'](function(_0x439b46){if(_0x499d37[_0x439b46+_0xed2c('0x2f')]){if(_0x439b46===_0xed2c('0x40')){if(_0x499d37[_0xed2c('0x41')]!==_0xed2c('0x42')){_0x499d37[_0xed2c('0x41')]=_0xed2c('0x15');}}else{_0x499d37[_0x439b46+'Status']='pause';}}});}return _0x499d37;});})[_0xed2c('0x18')](function(_0x477292){if(!_0x144d2e||_0x376117){return _0x477292;}return rta[_0xed2c('0x43')](_0x477292,_0x144d2e);})['then'](function(_0x5d6367){var _0x52ff45=rta[_0xed2c('0x44')]();_0x4f5621[_0xed2c('0x25')]=_0x5d6367[_0xed2c('0x3b')](function(_0x1624e9){return _[_0xed2c('0x45')](_0x1624e9,_0x52ff45);});return _0x4f5621;})[_0xed2c('0x18')](respondWithFilteredResult(_0xcc704d,_0x465f49))[_0xed2c('0x46')](APIHandleError(_0xcc704d));};exports[_0xed2c('0x47')]=function(_0x3ffe4e,_0x1661b5){var _0x29425d={'count':0x0,'rows':[]};var _0x15ffca={};var _0x411cd8;var _0x4ddaff;var _0x52432d;Promise[_0xed2c('0x17')]()[_0xed2c('0x18')](function(){if(_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x19')]){if(!utils[_0xed2c('0x1a')](_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x19')])){throw new APIBadRequestError(util[_0xed2c('0x48')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3ffe4e['query']['channel']));}_0x411cd8=_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x19')][_0xed2c('0x1c')]();}var _0x928a4=_[_0xed2c('0x49')](_0x411cd8)+'Queue';var _0x1174da=_[_0xed2c('0x3b')](db[_0x928a4]['rawAttributes'],function(_0x1a702b){return{'name':_0x1a702b[_0xed2c('0x4a')],'type':_0x1a702b[_0xed2c('0x2a')][_0xed2c('0x4b')]};});if(!_0x3ffe4e[_0xed2c('0x12')]['fields']){var _0x36b1c0=['id','name'];if(_0x411cd8===_0xed2c('0x40')){_0x36b1c0[_0xed2c('0x2e')](_0xed2c('0x2a'));if(_0x3ffe4e['query']['type']===_0xed2c('0x4c')){_0x36b1c0[_0xed2c('0x2e')]([_0xed2c('0x4d'),_0xed2c('0x4e')]);}}_0x3ffe4e['query']['fields']=_0x36b1c0[_0xed2c('0x22')](',');}_0x15ffca=qs[_0xed2c('0x2b')](_0x1174da,_0x3ffe4e);if(_0x3ffe4e['user'][_0xed2c('0x33')]===_0xed2c('0x32')){var _0x5cd8c5={'params':{'id':_0x3ffe4e[_0xed2c('0x32')][_0xed2c('0x34')]},'query':{'section':_0x411cd8===_0xed2c('0x40')&&_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x2a')]===_0xed2c('0x4c')?_0xed2c('0x4f'):_[_0xed2c('0x49')](_0x411cd8)+'Queues','type':_0x3ffe4e[_0xed2c('0x12')][_0xed2c('0x2a')],'nolimit':!![],'sort':'name','filter':_0x3ffe4e['query'][_0xed2c('0x50')]}};_0x5cd8c5[_0xed2c('0x12')]=Object[_0xed2c('0x37')](_0x5cd8c5[_0xed2c('0x12')],_0x3ffe4e['query']);delete _0x5cd8c5[_0xed2c('0x12')]['id'];return db['UserProfile'][_0xed2c('0x38')](_0x5cd8c5);}return db[_0x928a4]['findAndCountAll'](_0x15ffca);})[_0xed2c('0x18')](function(_0x22431b){_0x29425d[_0xed2c('0x9')]=_0x22431b[_0xed2c('0x9')];_0x4ddaff=_0x22431b[_0xed2c('0x25')];return rtq[_0xed2c('0x51')](_0x3ffe4e,_0x411cd8);})[_0xed2c('0x18')](function(_0x376f94){_0x52432d=_0x376f94[_0xed2c('0x25')];return rtq['initializeQueues'](_0x4ddaff,_0x52432d,_0x411cd8,_0x3ffe4e[_0xed2c('0x12')]['type']);})[_0xed2c('0x18')](function(_0x27bef1){_0x29425d[_0xed2c('0x25')]=_0x27bef1;return _0x29425d;})[_0xed2c('0x18')](respondWithFilteredResult(_0x1661b5,_0x15ffca))[_0xed2c('0x46')](APIHandleError(_0x1661b5));}; \ No newline at end of file +var _0xacb3=['getRealtimeAgentsQueryFields','catch','getQueues','startCase','Queue','fieldName','name','voice','dialActive','dialMethod','userProfileId','outbound','QueueCampaigns','Queues','filter','findAndCountAll','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','isValidChannel','channel','format','toLowerCase','sort','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','then','length','map','User','rawAttributes','type','role','getOptions','raw','push','literal','Pause','forEach','where','user','Agents','agent','online','extraQueryConditions','assign','UserProfile','getResources','find','filterAgentAttributes','merge','getAgentStatus','globalStatus','voiceStatus','talking','Status'];(function(_0xe53d7,_0x42a52e){var _0x10c273=function(_0x51151f){while(--_0x51151f){_0xe53d7['push'](_0xe53d7['shift']());}};_0x10c273(++_0x42a52e);}(_0xacb3,0x66));var _0x3acb=function(_0x39d89b,_0x413243){_0x39d89b=_0x39d89b-0x0;var _0x477b21=_0xacb3[_0x39d89b];return _0x477b21;};'use strict';var _=require('lodash');var util=require(_0x3acb('0x0'));var rta=require(_0x3acb('0x1'));var rtq=require(_0x3acb('0x2'));var qs=require(_0x3acb('0x3'));var utils=require(_0x3acb('0x4'));var db=require(_0x3acb('0x5'))['db'];var APIBadRequestError=require(_0x3acb('0x6'))['APIBadRequestError'];var APIHandleError=require(_0x3acb('0x6'))[_0x3acb('0x7')];function respondWithFilteredResult(_0x1e7ebb,_0x13670c){return function(_0x470928){if(_0x470928){var _0x5b61b6=typeof _0x13670c[_0x3acb('0x8')]===_0x3acb('0x9')&&typeof _0x13670c[_0x3acb('0xa')]===_0x3acb('0x9');var _0x54715e=_0x470928[_0x3acb('0xb')];var _0x523a97=_0x5b61b6?0x0:_0x13670c[_0x3acb('0x8')];var _0x182e50=_0x5b61b6?_0x470928['count']:_0x13670c[_0x3acb('0x8')]+_0x13670c[_0x3acb('0xa')];var _0x5f18f7;if(_0x182e50>=_0x54715e){_0x182e50=_0x54715e;_0x5f18f7=0xc8;}else{_0x5f18f7=0xce;}_0x1e7ebb[_0x3acb('0xc')](_0x5f18f7);return _0x1e7ebb['set'](_0x3acb('0xd'),_0x523a97+'-'+_0x182e50+'/'+_0x54715e)[_0x3acb('0xe')](_0x470928);}return null;};}exports[_0x3acb('0xf')]=function(_0x1cc8bf,_0x38aa19){var _0x4b87b2={'count':0x0,'rows':[]};var _0x4a147d={};var _0x4c932e;var _0x4f88d3=utils[_0x3acb('0x10')]();var _0x1e1371;var _0xf314b3;var _0x871f0a=_0x1cc8bf[_0x3acb('0x11')]['globalQueueFilter'];var _0x247931=_0x1cc8bf['query'][_0x3acb('0x12')];var _0x29cd62=_0x1cc8bf[_0x3acb('0x11')][_0x3acb('0x13')];var _0x243f29=_0x247931===_0x3acb('0x14')||_0x247931===_0x3acb('0x15')?!![]:![];var _0xaae66=[];var _0x44f20e;var _0x36493f;Promise[_0x3acb('0x16')]()['then'](function(){if(_0x1cc8bf['query']['channel']){if(!utils[_0x3acb('0x17')](_0x1cc8bf[_0x3acb('0x11')][_0x3acb('0x18')])){throw new APIBadRequestError(util[_0x3acb('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1cc8bf[_0x3acb('0x11')]['channel']));}_0x4c932e=_0x1cc8bf[_0x3acb('0x11')][_0x3acb('0x18')][_0x3acb('0x1a')]();}if(!_0x1cc8bf[_0x3acb('0x11')][_0x3acb('0x1b')]||!_0x1cc8bf[_0x3acb('0x11')][_0x3acb('0x1b')]['includes']('globalStatus')){_0x1cc8bf[_0x3acb('0x11')]['sort']=rta['validateSortParameter'](_0x1cc8bf['query']['sort']);return;}var _0x25227f=rta[_0x3acb('0x1c')](_0x1cc8bf[_0x3acb('0x11')][_0x3acb('0x1b')]);_0x1cc8bf['query'][_0x3acb('0x1b')]=_0x25227f[_0x3acb('0x1d')][_0x3acb('0x1e')](',');_0x44f20e=_0x25227f[_0x3acb('0x1f')];})['then'](function(){if(!_0x871f0a){return[];}return rta[_0x3acb('0x20')](_0x871f0a,_0x4c932e);})['then'](function(_0x1860cd){_0xaae66=_0x1860cd;return rta[_0x3acb('0x21')]();})['then'](function(_0x1838ce){_0xf314b3=_0x1838ce[_0x3acb('0x22')];if((!_0x247931||_0x243f29)&&!_0x44f20e){return _0xaae66;}if(_0x44f20e&&!_0x247931){return rta['getSortedAgentsIdsByStatus'](_0xf314b3,_0xaae66,_0x44f20e);}else{return rta[_0x3acb('0x23')](_0xf314b3,_0xaae66,_0x247931);}})[_0x3acb('0x24')](function(_0x1ab3d1){_0xaae66=_0x1ab3d1;var _0x1a4644=![];if(_0xaae66[_0x3acb('0x25')]===0x0){if(_0x871f0a||_0x247931){_0x1a4644=!![];}if(_0x243f29){_0x1a4644=![];}}if(_0x1a4644){return _0x4b87b2;}var _0x55d05f=_[_0x3acb('0x26')](db[_0x3acb('0x27')][_0x3acb('0x28')],function(_0x45e56f){return{'name':_0x45e56f['fieldName'],'type':_0x45e56f[_0x3acb('0x29')]['key']};});_0x1cc8bf[_0x3acb('0x11')][_0x3acb('0x2a')]='agent';_0x4a147d=qs[_0x3acb('0x2b')](_0x55d05f,_0x1cc8bf);_0x4a147d[_0x3acb('0x2c')]=!![];var _0x5aa3c5=[];if(_0xaae66[_0x3acb('0x25')]>0x0){_0x5aa3c5[_0x3acb('0x2d')]({'id':{'$in':_0xaae66}});if(_0x44f20e&&!_0x247931){_0x36493f=[db['sequelize'][_0x3acb('0x2e')]('FIELD(id,'+_0xaae66+')')];_0x4a147d[_0x3acb('0x1f')]=_0x36493f;}}if(_0x243f29){_0x4f88d3['forEach'](function(_0x1f425e){var _0x388b86=!![];if(_0x247931===_0x3acb('0x15')&&_0x4c932e!==_0x1f425e){_0x388b86=![];}_0x5aa3c5[_0x3acb('0x2d')]({[_0x1f425e+_0x3acb('0x2f')]:_0x388b86});});if(_0x29cd62){_0x5aa3c5[_0x3acb('0x2d')]({'pauseType':_0x29cd62});}}else if(_0x247931){_0x4f88d3[_0x3acb('0x30')](function(_0x1f1c98){_0x5aa3c5[_0x3acb('0x2d')]({[_0x1f1c98+_0x3acb('0x2f')]:![]});});}_0x4a147d['where']=_['merge'](_0x4a147d[_0x3acb('0x31')],{'$and':_0x5aa3c5});if(_0x1cc8bf[_0x3acb('0x32')][_0x3acb('0x2a')]===_0x3acb('0x32')){var _0xd1b0a1={'params':{'id':_0x1cc8bf[_0x3acb('0x32')]['userProfileId']},'query':{'section':_0x3acb('0x33'),'role':_0x3acb('0x34'),'raw':!![],'ids':_0xaae66,'customSorting':_0x36493f}};if(_0x1cc8bf[_0x3acb('0x11')]['online']){_0xd1b0a1['query'][_0x3acb('0x35')]=!![];}if(_0x243f29){_0xd1b0a1[_0x3acb('0x11')][_0x3acb('0x36')]=_0x5aa3c5;}_0xd1b0a1[_0x3acb('0x11')]=Object[_0x3acb('0x37')](_0xd1b0a1[_0x3acb('0x11')],_0x1cc8bf['query']);return db[_0x3acb('0x38')][_0x3acb('0x39')](_0xd1b0a1);}return db[_0x3acb('0x27')]['findAndCountAll'](_0x4a147d);})[_0x3acb('0x24')](function(_0x57bd0f){_0x4b87b2[_0x3acb('0xb')]=_0x57bd0f[_0x3acb('0xb')];_0x1e1371=_0x57bd0f['rows'];return _0x1e1371[_0x3acb('0x26')](function(_0x26f9e3){var _0x6d3ee9=_[_0x3acb('0x3a')](_0xf314b3,['id',_0x26f9e3['id']]);if(_0x6d3ee9){var _0x12de5e=rta[_0x3acb('0x3b')](_0x6d3ee9);_[_0x3acb('0x3c')](_0x26f9e3,_0x12de5e);}_0x26f9e3['globalStatus']=rta[_0x3acb('0x3d')](_0x26f9e3);if(_0x26f9e3[_0x3acb('0x3e')]['includes'](_0x3acb('0x14'))){_0x4f88d3['forEach'](function(_0x69219e){if(_0x26f9e3[_0x69219e+_0x3acb('0x2f')]){if(_0x69219e==='voice'){if(_0x26f9e3[_0x3acb('0x3f')]!==_0x3acb('0x40')){_0x26f9e3[_0x3acb('0x3f')]='pause';}}else{_0x26f9e3[_0x69219e+_0x3acb('0x41')]=_0x3acb('0x14');}}});}return _0x26f9e3;});})[_0x3acb('0x24')](function(_0x3727d9){if(!_0x44f20e||_0x36493f){return _0x3727d9;}return rta['sortAgentsByStatus'](_0x3727d9,_0x44f20e);})['then'](function(_0xe25ee1){var _0x81ef52=rta[_0x3acb('0x42')]();_0x4b87b2['rows']=_0xe25ee1['map'](function(_0x1ef355){return _['pick'](_0x1ef355,_0x81ef52);});return _0x4b87b2;})[_0x3acb('0x24')](respondWithFilteredResult(_0x38aa19,_0x4a147d))[_0x3acb('0x43')](APIHandleError(_0x38aa19));};exports[_0x3acb('0x44')]=function(_0x599c1c,_0x292f75){var _0x45ebe2={'count':0x0,'rows':[]};var _0xeb9aa4={};var _0x2916da;var _0x53d719;var _0x2f02cf;Promise[_0x3acb('0x16')]()[_0x3acb('0x24')](function(){if(_0x599c1c[_0x3acb('0x11')][_0x3acb('0x18')]){if(!utils['isValidChannel'](_0x599c1c[_0x3acb('0x11')]['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x599c1c[_0x3acb('0x11')][_0x3acb('0x18')]));}_0x2916da=_0x599c1c[_0x3acb('0x11')]['channel']['toLowerCase']();}var _0x4b9a77=_[_0x3acb('0x45')](_0x2916da)+_0x3acb('0x46');var _0x4c62c8=_[_0x3acb('0x26')](db[_0x4b9a77]['rawAttributes'],function(_0x5eaa90){return{'name':_0x5eaa90[_0x3acb('0x47')],'type':_0x5eaa90[_0x3acb('0x29')]['key']};});if(!_0x599c1c[_0x3acb('0x11')][_0x3acb('0x1d')]){var _0x5ab55a=['id',_0x3acb('0x48')];if(_0x2916da===_0x3acb('0x49')){_0x5ab55a['push'](_0x3acb('0x29'));if(_0x599c1c[_0x3acb('0x11')][_0x3acb('0x29')]==='outbound'){_0x5ab55a[_0x3acb('0x2d')]([_0x3acb('0x4a'),_0x3acb('0x4b')]);}}_0x599c1c[_0x3acb('0x11')][_0x3acb('0x1d')]=_0x5ab55a[_0x3acb('0x1e')](',');}_0xeb9aa4=qs['getOptions'](_0x4c62c8,_0x599c1c);if(_0x599c1c[_0x3acb('0x32')][_0x3acb('0x2a')]===_0x3acb('0x32')){var _0x413eaa={'params':{'id':_0x599c1c[_0x3acb('0x32')][_0x3acb('0x4c')]},'query':{'section':_0x2916da==='voice'&&_0x599c1c[_0x3acb('0x11')]['type']===_0x3acb('0x4d')?_0x3acb('0x4e'):_[_0x3acb('0x45')](_0x2916da)+_0x3acb('0x4f'),'type':_0x599c1c[_0x3acb('0x11')][_0x3acb('0x29')],'nolimit':!![],'sort':'name','filter':_0x599c1c['query'][_0x3acb('0x50')]}};_0x413eaa[_0x3acb('0x11')]=Object[_0x3acb('0x37')](_0x413eaa['query'],_0x599c1c['query']);delete _0x413eaa[_0x3acb('0x11')]['id'];return db[_0x3acb('0x38')][_0x3acb('0x39')](_0x413eaa);}return db[_0x4b9a77][_0x3acb('0x51')](_0xeb9aa4);})[_0x3acb('0x24')](function(_0x22ab70){_0x45ebe2[_0x3acb('0xb')]=_0x22ab70['count'];_0x53d719=_0x22ab70['rows'];return rtq[_0x3acb('0x52')](_0x599c1c,_0x2916da);})[_0x3acb('0x24')](function(_0x47c829){_0x2f02cf=_0x47c829['rows'];return rtq[_0x3acb('0x53')](_0x53d719,_0x2f02cf,_0x2916da,_0x599c1c['query'][_0x3acb('0x29')]);})[_0x3acb('0x24')](function(_0x29e444){_0x45ebe2['rows']=_0x29e444;return _0x45ebe2;})[_0x3acb('0x24')](respondWithFilteredResult(_0x292f75,_0xeb9aa4))['catch'](APIHandleError(_0x292f75));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index faa7d0a..470d3e2 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x44f280,_0x4a1dad){var _0x4ee19d=function(_0xc02f51){while(--_0xc02f51){_0x44f280['push'](_0x44f280['shift']());}};_0x4ee19d(++_0x4a1dad);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x12842a,_0x44b22a){var _0xd1faac=function(_0x5be694){while(--_0x5be694){_0x12842a['push'](_0x12842a['shift']());}};_0xd1faac(++_0x44b22a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xcb91[_0x1c6089];return _0x4d97c1;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6442944..6c7bfeb 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 _0x3d49=['DATE','exports','INTEGER','STRING'];(function(_0x6b9481,_0x5061ec){var _0x5e161f=function(_0x3ab4e3){while(--_0x3ab4e3){_0x6b9481['push'](_0x6b9481['shift']());}};_0x5e161f(++_0x5061ec);}(_0x3d49,0x151));var _0x93d4=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x3d49[_0x26bcec];return _0x1049dc;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'state':{'type':Sequelize[_0x93d4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x93d4('0x2')]},'scheduledat':{'type':Sequelize[_0x93d4('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x93d4('0x3')]},'responsetime':{'type':Sequelize[_0x93d4('0x3')]},'ringtime':{'type':Sequelize[_0x93d4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x93d4('0x2')]},'campaigntype':{'type':Sequelize[_0x93d4('0x2')]},'membername':{'type':Sequelize[_0x93d4('0x2')]}}; \ No newline at end of file +var _0x93bb=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x353856,_0x5ce89d){var _0xa58048=function(_0x2cc6a9){while(--_0x2cc6a9){_0x353856['push'](_0x353856['shift']());}};_0xa58048(++_0x5ce89d);}(_0x93bb,0x135));var _0xb93b=function(_0xf81561,_0x59d28e){_0xf81561=_0xf81561-0x0;var _0x1e1986=_0x93bb[_0xf81561];return _0x1e1986;};'use strict';var Sequelize=require(_0xb93b('0x0'));module[_0xb93b('0x1')]={'state':{'type':Sequelize[_0xb93b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb93b('0x3')]},'scheduledat':{'type':Sequelize[_0xb93b('0x4')]},'uniqueid':{'type':Sequelize[_0xb93b('0x3')]},'starttime':{'type':Sequelize[_0xb93b('0x4')]},'responsetime':{'type':Sequelize[_0xb93b('0x4')]},'ringtime':{'type':Sequelize[_0xb93b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb93b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb93b('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9f93383..29af133 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 _0x9ae3=['exports','lodash','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0xfacee2,_0x29c3b0){var _0x4cc9ea=function(_0x26ed31){while(--_0x26ed31){_0xfacee2['push'](_0xfacee2['shift']());}};_0x4cc9ea(++_0x29c3b0);}(_0x9ae3,0x199));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x39ae('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x39ae('0x1'));var BPromise=require('bluebird');var rp=require(_0x39ae('0x2'));var fs=require('fs');var path=require(_0x39ae('0x3'));var rimraf=require(_0x39ae('0x4'));var config=require(_0x39ae('0x5'));var attributes=require(_0x39ae('0x6'));module[_0x39ae('0x7')]=function(_0x5c186d,_0x3ca680){return _0x5c186d['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdae5=['report_agent_preview','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','ReportAgentPreview'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdae5,0x198));var _0x5dae=function(_0x3c5656,_0x4806f6){_0x3c5656=_0x3c5656-0x0;var _0x5270db=_0xdae5[_0x3c5656];return _0x5270db;};'use strict';var _=require(_0x5dae('0x0'));var util=require('util');var logger=require(_0x5dae('0x1'))(_0x5dae('0x2'));var moment=require(_0x5dae('0x3'));var BPromise=require(_0x5dae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dae('0x5'));var rimraf=require(_0x5dae('0x6'));var config=require(_0x5dae('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0xf55162,_0x2750eb){return _0xf55162[_0x5dae('0x8')](_0x5dae('0x9'),attributes,{'tableName':_0x5dae('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 54b3d55..d9d0519 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 _0xdeed=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','create','body','options','moment','bluebird'];(function(_0x4bdee9,_0x5eaf4d){var _0x31d570=function(_0x4f394a){while(--_0x4f394a){_0x4bdee9['push'](_0x4bdee9['shift']());}};_0x31d570(++_0x5eaf4d);}(_0xdeed,0x106));var _0xddee=function(_0x1bb3df,_0x64e429){_0x1bb3df=_0x1bb3df-0x0;var _0x4e78dc=_0xdeed[_0x1bb3df];return _0x4e78dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xddee('0x0'));var BPromise=require(_0xddee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddee('0x2'));var db=require(_0xddee('0x3'))['db'];var utils=require(_0xddee('0x4'));var logger=require('../../config/logger')(_0xddee('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddee('0x6')][_0xddee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fe515,_0x1c4aa4,_0x153d6d){return new BPromise(function(_0x1e9c28,_0x498e07){return client[_0xddee('0x8')](_0x3fe515,_0x153d6d)[_0xddee('0x9')](function(_0x49a5ed){logger[_0xddee('0xa')](_0xddee('0xb'),_0x1c4aa4,_0xddee('0xc'));logger[_0xddee('0xd')](_0xddee('0xe'),_0x1c4aa4,'request\x20sent',JSON[_0xddee('0xf')](_0x49a5ed));if(_0x49a5ed[_0xddee('0x10')]){if(_0x49a5ed['error'][_0xddee('0x11')]===0x1f4){logger[_0xddee('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1c4aa4,_0x49a5ed[_0xddee('0x10')][_0xddee('0x12')]);return _0x498e07(_0x49a5ed[_0xddee('0x10')][_0xddee('0x12')]);}logger[_0xddee('0x10')](_0xddee('0xb'),_0x1c4aa4,_0x49a5ed[_0xddee('0x10')][_0xddee('0x12')]);return _0x1e9c28(_0x49a5ed['error']['message']);}else{logger[_0xddee('0xa')](_0xddee('0xb'),_0x1c4aa4,'request\x20sent');_0x1e9c28(_0x49a5ed['result'][_0xddee('0x12')]);}})[_0xddee('0x13')](function(_0x12b11e){logger[_0xddee('0x10')](_0xddee('0xb'),_0x1c4aa4,_0x12b11e);_0x498e07(_0x12b11e);});});}exports[_0xddee('0x14')]=function(_0x118b60){var _0xc1cbe2=this;return new Promise(function(_0x17845,_0x82aa07){return db['ReportAgentPreview'][_0xddee('0x15')](_0x118b60[_0xddee('0x16')],{'raw':_0x118b60[_0xddee('0x17')]?_0x118b60[_0xddee('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xc45ba){logger[_0xddee('0xa')](_0xddee('0x14'),_0x118b60);logger[_0xddee('0xd')](_0xddee('0x14'),_0x118b60,JSON[_0xddee('0xf')](_0xc45ba));_0x17845(_0xc45ba);})[_0xddee('0x13')](function(_0x5c0117){logger[_0xddee('0x10')](_0xddee('0x14'),_0x5c0117['message'],_0x118b60);_0x82aa07(_0xc1cbe2[_0xddee('0x10')](0x1f4,_0x5c0117[_0xddee('0x12')]));});});}; \ No newline at end of file +var _0x140c=['client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x33a252,_0x2199dd){var _0x489c25=function(_0x21db03){while(--_0x21db03){_0x33a252['push'](_0x33a252['shift']());}};_0x489c25(++_0x2199dd);}(_0x140c,0xea));var _0xc140=function(_0x2c7125,_0x45d69e){_0x2c7125=_0x2c7125-0x0;var _0x59fb12=_0x140c[_0x2c7125];return _0x59fb12;};'use strict';var _=require(_0xc140('0x0'));var util=require('util');var moment=require(_0xc140('0x1'));var BPromise=require(_0xc140('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc140('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc140('0x4'));var logger=require(_0xc140('0x5'))(_0xc140('0x6'));var config=require(_0xc140('0x7'));var jayson=require(_0xc140('0x8'));var client=jayson[_0xc140('0x9')][_0xc140('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3993a2,_0x34a199,_0x43efb6){return new BPromise(function(_0x1d3966,_0x5ef533){return client['request'](_0x3993a2,_0x43efb6)[_0xc140('0xb')](function(_0x2ec87f){logger[_0xc140('0xc')](_0xc140('0xd'),_0x34a199,'request\x20sent');logger[_0xc140('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x34a199,_0xc140('0xf'),JSON[_0xc140('0x10')](_0x2ec87f));if(_0x2ec87f[_0xc140('0x11')]){if(_0x2ec87f['error'][_0xc140('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x34a199,_0x2ec87f['error'][_0xc140('0x13')]);return _0x5ef533(_0x2ec87f['error'][_0xc140('0x13')]);}logger['error'](_0xc140('0xd'),_0x34a199,_0x2ec87f[_0xc140('0x11')][_0xc140('0x13')]);return _0x1d3966(_0x2ec87f[_0xc140('0x11')]['message']);}else{logger[_0xc140('0xc')](_0xc140('0xd'),_0x34a199,'request\x20sent');_0x1d3966(_0x2ec87f['result'][_0xc140('0x13')]);}})[_0xc140('0x14')](function(_0x44bba0){logger[_0xc140('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x34a199,_0x44bba0);_0x5ef533(_0x44bba0);});});}exports[_0xc140('0x15')]=function(_0x3b7f89){var _0x156fbd=this;return new Promise(function(_0x51c1f1,_0x4b6f1b){return db[_0xc140('0x16')][_0xc140('0x17')](_0x3b7f89[_0xc140('0x18')],{'raw':_0x3b7f89[_0xc140('0x19')]?_0x3b7f89[_0xc140('0x19')][_0xc140('0x1a')]===undefined?!![]:![]:!![]})[_0xc140('0xb')](function(_0x38be85){logger['info']('CreateReportAgentPreview',_0x3b7f89);logger['debug'](_0xc140('0x15'),_0x3b7f89,JSON[_0xc140('0x10')](_0x38be85));_0x51c1f1(_0x38be85);})['catch'](function(_0x33cba4){logger[_0xc140('0x11')](_0xc140('0x15'),_0x33cba4[_0xc140('0x13')],_0x3b7f89);_0x4b6f1b(_0x156fbd['error'](0x1f4,_0x33cba4['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 72a8610..c1c225a 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 _0xf801=['/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues'];(function(_0x28aa1a,_0x27e74f){var _0x2f669a=function(_0x28cc20){while(--_0x28cc20){_0x28aa1a['push'](_0x28aa1a['shift']());}};_0x2f669a(++_0x27e74f);}(_0xf801,0x96));var _0x1f80=function(_0x459c2b,_0x44b2d9){_0x459c2b=_0x459c2b-0x0;var _0x26bc62=_0xf801[_0x459c2b];return _0x26bc62;};'use strict';var multer=require(_0x1f80('0x0'));var util=require(_0x1f80('0x1'));var path=require(_0x1f80('0x2'));var express=require(_0x1f80('0x3'));var router=express['Router']();var auth=require(_0x1f80('0x4'));var controller=require(_0x1f80('0x5'));router['get'](_0x1f80('0x6'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x8')]);router[_0x1f80('0x9')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x1f80('0xa')]);router['get'](_0x1f80('0xb'),auth[_0x1f80('0x7')](),controller[_0x1f80('0xc')]);router[_0x1f80('0x9')](_0x1f80('0xd'),auth[_0x1f80('0x7')](),controller[_0x1f80('0xe')]);router[_0x1f80('0x9')]('/chat/queues',auth['isAuthenticated'](),controller[_0x1f80('0xf')]);router['get'](_0x1f80('0x10'),auth['isAuthenticated'](),controller[_0x1f80('0x11')]);router['get'](_0x1f80('0x12'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x13')]);router[_0x1f80('0x9')]('/openchannel/queues',auth[_0x1f80('0x7')](),controller[_0x1f80('0x14')]);router[_0x1f80('0x9')](_0x1f80('0x15'),auth['isAuthenticated'](),controller[_0x1f80('0x16')]);router[_0x1f80('0x9')]('/whatsapp/queues',auth[_0x1f80('0x7')](),controller[_0x1f80('0x17')]);router['get'](_0x1f80('0x18'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x19')]);router['get'](_0x1f80('0x1a'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x1b')]);router[_0x1f80('0x9')]('/voice/queues/channels',auth[_0x1f80('0x7')](),controller[_0x1f80('0x1c')]);router[_0x1f80('0x9')](_0x1f80('0x1d'),auth[_0x1f80('0x7')](),controller['voiceQueuesChannel']);router[_0x1f80('0x9')](_0x1f80('0x1e'),auth['isAuthenticated'](),controller[_0x1f80('0x1f')]);router[_0x1f80('0x9')](_0x1f80('0x20'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x21')]);router[_0x1f80('0x9')]('/voice/queues/:id',auth[_0x1f80('0x7')](),controller[_0x1f80('0x22')]);router[_0x1f80('0x23')](_0x1f80('0x24'),auth['isAuthenticated'](),controller[_0x1f80('0x25')]);router[_0x1f80('0x9')](_0x1f80('0x26'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x27')]);router[_0x1f80('0x9')](_0x1f80('0x28'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x1f80('0x9')](_0x1f80('0x29'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x2a')]);router[_0x1f80('0x23')](_0x1f80('0x2b'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x2c')]);router[_0x1f80('0x9')](_0x1f80('0x2d'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x2e')]);router['get'](_0x1f80('0x2f'),auth[_0x1f80('0x7')](),controller['trunks']);router[_0x1f80('0x9')](_0x1f80('0x30'),auth['isAuthenticated'](),controller[_0x1f80('0x31')]);router['get'](_0x1f80('0x32'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x33')]);router[_0x1f80('0x9')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1f80('0x34')]);router['get']('/mail/queues/waitinginteractions',auth[_0x1f80('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x1f80('0x9')]('/openchannel/queues/waitinginteractions',auth[_0x1f80('0x7')](),controller[_0x1f80('0x35')]);router[_0x1f80('0x9')](_0x1f80('0x36'),auth['isAuthenticated'](),controller[_0x1f80('0x37')]);router[_0x1f80('0x9')](_0x1f80('0x38'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x39')]);router[_0x1f80('0x9')](_0x1f80('0x3a'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3b')]);router['get'](_0x1f80('0x3c'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x1f80('0x3d')](_0x1f80('0x3e'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')](_0x1f80('0x40')));router[_0x1f80('0x9')](_0x1f80('0x41'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x42')]);router[_0x1f80('0x3d')](_0x1f80('0x43'),auth[_0x1f80('0x7')](),controller['queueNotify'](_0x1f80('0x44')));router['get'](_0x1f80('0x45'),auth['isAuthenticated'](),controller[_0x1f80('0x46')]);router[_0x1f80('0x3d')]('/fax/queues/:id/notify',auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')]('fax'));router[_0x1f80('0x9')](_0x1f80('0x47'),auth['isAuthenticated'](),controller[_0x1f80('0x48')]);router[_0x1f80('0x3d')](_0x1f80('0x49'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')](_0x1f80('0x4a')));router[_0x1f80('0x9')]('/openchannel/queues/:id',auth[_0x1f80('0x7')](),controller[_0x1f80('0x4b')]);router[_0x1f80('0x3d')](_0x1f80('0x4c'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x3f')](_0x1f80('0x4d')));router[_0x1f80('0x3d')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x1f80('0x3f')]('whatsapp'));router[_0x1f80('0x9')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x1f80('0x4e')]);router[_0x1f80('0x9')](_0x1f80('0x4f'),auth['isAuthenticated'](),controller[_0x1f80('0x50')]);router['post'](_0x1f80('0x51'),auth[_0x1f80('0x7')](),controller[_0x1f80('0x52')]);module[_0x1f80('0x53')]=router; \ No newline at end of file +var _0x1d89=['put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','sms','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents'];(function(_0x375ce4,_0x597227){var _0x2fb9ab=function(_0x2db87a){while(--_0x2db87a){_0x375ce4['push'](_0x375ce4['shift']());}};_0x2fb9ab(++_0x597227);}(_0x1d89,0x179));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x91d8('0x0'));var util=require(_0x91d8('0x1'));var path=require(_0x91d8('0x2'));var express=require(_0x91d8('0x3'));var router=express[_0x91d8('0x4')]();var auth=require(_0x91d8('0x5'));var controller=require(_0x91d8('0x6'));router[_0x91d8('0x7')]('/voice/channels',auth[_0x91d8('0x8')](),controller[_0x91d8('0x9')]);router['get'](_0x91d8('0xa'),auth[_0x91d8('0x8')](),controller['voiceChannelMixMonitor']);router[_0x91d8('0x7')](_0x91d8('0xb'),auth[_0x91d8('0x8')](),controller[_0x91d8('0xc')]);router[_0x91d8('0x7')](_0x91d8('0xd'),auth[_0x91d8('0x8')](),controller[_0x91d8('0xe')]);router[_0x91d8('0x7')](_0x91d8('0xf'),auth[_0x91d8('0x8')](),controller['chatQueues']);router[_0x91d8('0x7')](_0x91d8('0x10'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x11')]);router[_0x91d8('0x7')](_0x91d8('0x12'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x13')]);router[_0x91d8('0x7')]('/openchannel/queues',auth[_0x91d8('0x8')](),controller[_0x91d8('0x14')]);router[_0x91d8('0x7')]('/sms/queues',auth[_0x91d8('0x8')](),controller[_0x91d8('0x15')]);router[_0x91d8('0x7')](_0x91d8('0x16'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x17')]);router[_0x91d8('0x7')]('/fax/queues',auth[_0x91d8('0x8')](),controller[_0x91d8('0x18')]);router[_0x91d8('0x7')](_0x91d8('0x19'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x1a')]);router['get'](_0x91d8('0x1b'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x1c')]);router[_0x91d8('0x7')](_0x91d8('0x1d'),auth[_0x91d8('0x8')](),controller['voiceQueuesChannel']);router[_0x91d8('0x7')](_0x91d8('0x1e'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x1f')]);router[_0x91d8('0x7')](_0x91d8('0x20'),auth['isAuthenticated'](),controller[_0x91d8('0x21')]);router[_0x91d8('0x7')](_0x91d8('0x22'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x23')]);router['put']('/voice/queues/:id',auth[_0x91d8('0x8')](),controller[_0x91d8('0x24')]);router['get'](_0x91d8('0x25'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x26')]);router[_0x91d8('0x7')](_0x91d8('0x27'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x28')]);router[_0x91d8('0x7')](_0x91d8('0x29'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x2a')]);router[_0x91d8('0x2b')](_0x91d8('0x2c'),auth['isAuthenticated'](),controller[_0x91d8('0x2d')]);router['get'](_0x91d8('0x2e'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x2f')]);router[_0x91d8('0x7')](_0x91d8('0x30'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x31')]);router[_0x91d8('0x7')](_0x91d8('0x32'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x33')]);router[_0x91d8('0x7')](_0x91d8('0x34'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x35')]);router['get'](_0x91d8('0x36'),auth['isAuthenticated'](),controller[_0x91d8('0x37')]);router['get'](_0x91d8('0x38'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x39')]);router[_0x91d8('0x7')](_0x91d8('0x3a'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x3b')]);router['get'](_0x91d8('0x3c'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x3d')]);router[_0x91d8('0x7')]('/sms/queues/waitinginteractions',auth[_0x91d8('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x91d8('0x7')](_0x91d8('0x3e'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x3f')]);router['get'](_0x91d8('0x40'),auth[_0x91d8('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x91d8('0x41')](_0x91d8('0x42'),auth['isAuthenticated'](),controller[_0x91d8('0x43')](_0x91d8('0x44')));router[_0x91d8('0x7')]('/mail/queues/:id',auth[_0x91d8('0x8')](),controller[_0x91d8('0x45')]);router['post'](_0x91d8('0x46'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x43')](_0x91d8('0x47')));router[_0x91d8('0x7')]('/chat/queues/:id',auth[_0x91d8('0x8')](),controller[_0x91d8('0x48')]);router['post'](_0x91d8('0x49'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x43')]('fax'));router[_0x91d8('0x7')](_0x91d8('0x4a'),auth['isAuthenticated'](),controller[_0x91d8('0x4b')]);router['post'](_0x91d8('0x4c'),auth[_0x91d8('0x8')](),controller[_0x91d8('0x43')](_0x91d8('0x4d')));router[_0x91d8('0x7')]('/openchannel/queues/:id',auth[_0x91d8('0x8')](),controller[_0x91d8('0x4e')]);router[_0x91d8('0x41')]('/sms/queues/:id/notify',auth[_0x91d8('0x8')](),controller[_0x91d8('0x43')](_0x91d8('0x4f')));router[_0x91d8('0x41')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x91d8('0x43')]('whatsapp'));router[_0x91d8('0x7')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x91d8('0x50')]);router['get']('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x91d8('0x51')]);router[_0x91d8('0x41')]('/agents/:id/notify',auth[_0x91d8('0x8')](),controller[_0x91d8('0x52')]);module[_0x91d8('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 81e4cc9..70ca4f5 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(_0x17fa8d,_0x1225dc){var _0x2b4ae5=function(_0x1230da){while(--_0x1230da){_0x17fa8d['push'](_0x17fa8d['shift']());}};_0x2b4ae5(++_0x1225dc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x4bf450,_0x31ba60){var _0x10bb8f=function(_0x11fe6f){while(--_0x11fe6f){_0x4bf450['push'](_0x4bf450['shift']());}};_0x10bb8f(++_0x31ba60);}(_0xe706,0xa3));var _0x6e70=function(_0x2350dd,_0x53e293){_0x2350dd=_0x2350dd-0x0;var _0x5ca2db=_0xe706[_0x2350dd];return _0x5ca2db;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e2bfaa9..6b1b4a1 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 _0x352e=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x33b5b3,_0x113f0a){var _0x51949d=function(_0x2e334f){while(--_0x2e334f){_0x33b5b3['push'](_0x33b5b3['shift']());}};_0x51949d(++_0x113f0a);}(_0x352e,0x13a));var _0xe352=function(_0x250e08,_0x55be8a){_0x250e08=_0x250e08-0x0;var _0xe236ee=_0x352e[_0x250e08];return _0xe236ee;};'use strict';var multer=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var path=require(_0xe352('0x2'));var timeout=require('connect-timeout');var express=require(_0xe352('0x3'));var router=express[_0xe352('0x4')]();var fs_extra=require(_0xe352('0x5'));var auth=require(_0xe352('0x6'));var interaction=require(_0xe352('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xe352('0x8')]('/',auth[_0xe352('0x9')](),controller[_0xe352('0xa')]);router[_0xe352('0x8')](_0xe352('0xb'),auth[_0xe352('0x9')](),controller[_0xe352('0xc')]);router[_0xe352('0x8')](_0xe352('0xd'),auth[_0xe352('0x9')](),controller['run']);router[_0xe352('0xe')]('/',auth[_0xe352('0x9')](),controller['create']);router[_0xe352('0xf')](_0xe352('0xb'),auth[_0xe352('0x9')](),controller[_0xe352('0x10')]);router[_0xe352('0x11')](_0xe352('0xb'),auth['isAuthenticated'](),controller[_0xe352('0x12')]);module[_0xe352('0x13')]=router; \ No newline at end of file +var _0x05c3=['/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show'];(function(_0x3dd582,_0x23590b){var _0x4e9e11=function(_0x356591){while(--_0x356591){_0x3dd582['push'](_0x3dd582['shift']());}};_0x4e9e11(++_0x23590b);}(_0x05c3,0x112));var _0x305c=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x05c3[_0x217c2e];return _0x22b7d8;};'use strict';var multer=require('multer');var util=require(_0x305c('0x0'));var path=require(_0x305c('0x1'));var timeout=require(_0x305c('0x2'));var express=require(_0x305c('0x3'));var router=express[_0x305c('0x4')]();var fs_extra=require(_0x305c('0x5'));var auth=require(_0x305c('0x6'));var interaction=require(_0x305c('0x7'));var config=require(_0x305c('0x8'));var controller=require(_0x305c('0x9'));router[_0x305c('0xa')]('/',auth[_0x305c('0xb')](),controller[_0x305c('0xc')]);router[_0x305c('0xa')]('/:id',auth[_0x305c('0xb')](),controller[_0x305c('0xd')]);router['get'](_0x305c('0xe'),auth[_0x305c('0xb')](),controller[_0x305c('0xf')]);router[_0x305c('0x10')]('/',auth[_0x305c('0xb')](),controller[_0x305c('0x11')]);router[_0x305c('0x12')](_0x305c('0x13'),auth[_0x305c('0xb')](),controller[_0x305c('0x14')]);router[_0x305c('0x15')](_0x305c('0x13'),auth[_0x305c('0xb')](),controller[_0x305c('0x16')]);module[_0x305c('0x17')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index dbbe51e..f71ed49 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 _0x91c0=['DATE','ENUM','years','quarters','weeks','hours','days','csv','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x2323fe,_0x2f5b88){var _0x2d123c=function(_0x28bdfa){while(--_0x28bdfa){_0x2323fe['push'](_0x2323fe['shift']());}};_0x2d123c(++_0x2f5b88);}(_0x91c0,0xb6));var _0x091c=function(_0x5d2a22,_0x38b102){_0x5d2a22=_0x5d2a22-0x0;var _0x35490e=_0x91c0[_0x5d2a22];return _0x35490e;};'use strict';var Sequelize=require(_0x091c('0x0'));module[_0x091c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x091c('0x2')]},'active':{'type':Sequelize[_0x091c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x091c('0x4')},'startAt':{'type':Sequelize[_0x091c('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x091c('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x091c('0x6')](_0x091c('0x7'),_0x091c('0x8'),'months',_0x091c('0x9'),'days',_0x091c('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x091c('0xb')},'output':{'type':Sequelize['ENUM'](_0x091c('0xc'),'pdf',_0x091c('0xd')),'allowNull':![],'defaultValue':_0x091c('0xc')},'type':{'type':Sequelize[_0x091c('0x6')](_0x091c('0xe'),_0x091c('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x091c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x091c('0x2')]},'cc':{'type':Sequelize[_0x091c('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x091c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1576=['custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','hours','minutes','days','pdf','xlsx','csv'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x1576,0x1a2));var _0x6157=function(_0x1925df,_0xbd3e63){_0x1925df=_0x1925df-0x0;var _0x2f4e05=_0x1576[_0x1925df];return _0x2f4e05;};'use strict';var Sequelize=require(_0x6157('0x0'));module[_0x6157('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6157('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6157('0x3')},'startAt':{'type':Sequelize[_0x6157('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6157('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6157('0x5')](_0x6157('0x6'),_0x6157('0x7'),'months','weeks','days',_0x6157('0x8'),_0x6157('0x9')),'allowNull':![],'defaultValue':_0x6157('0xa')},'output':{'type':Sequelize[_0x6157('0x5')]('csv',_0x6157('0xb'),_0x6157('0xc')),'allowNull':![],'defaultValue':_0x6157('0xd')},'type':{'type':Sequelize[_0x6157('0x5')](_0x6157('0xe'),_0x6157('0xf')),'allowNull':![],'defaultValue':_0x6157('0xe')},'sendMail':{'type':Sequelize[_0x6157('0x10')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6157('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x6157('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 7fb944f..70a18e3 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 _0xf6b8=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','Scheduler','destroy','end','error','stack','name','send','index','Schedule','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','options','includeAll','rows','show','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x39b316,_0x3def1e){var _0x182ab1=function(_0x3e4f10){while(--_0x3e4f10){_0x39b316['push'](_0x39b316['shift']());}};_0x182ab1(++_0x3def1e);}(_0xf6b8,0x1e6));var _0x8f6b=function(_0x278648,_0x23be73){_0x278648=_0x278648-0x0;var _0x10d2e5=_0xf6b8[_0x278648];return _0x10d2e5;};'use strict';var emlformat=require(_0x8f6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f6b('0x1'));var jsonpatch=require(_0x8f6b('0x2'));var rp=require(_0x8f6b('0x3'));var moment=require('moment');var BPromise=require(_0x8f6b('0x4'));var Mustache=require(_0x8f6b('0x5'));var util=require(_0x8f6b('0x6'));var path=require(_0x8f6b('0x7'));var sox=require(_0x8f6b('0x8'));var csv=require(_0x8f6b('0x9'));var ejs=require(_0x8f6b('0xa'));var fs=require('fs');var fs_extra=require(_0x8f6b('0xb'));var _=require(_0x8f6b('0xc'));var squel=require(_0x8f6b('0xd'));var crypto=require(_0x8f6b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8f6b('0xf'));var toCsv=require(_0x8f6b('0x9'));var querystring=require(_0x8f6b('0x10'));var Papa=require(_0x8f6b('0x11'));var Redis=require('ioredis');var authService=require(_0x8f6b('0x12'));var qs=require(_0x8f6b('0x13'));var as=require(_0x8f6b('0x14'));var hardwareService=require(_0x8f6b('0x15'));var logger=require(_0x8f6b('0x16'))(_0x8f6b('0x17'));var utils=require(_0x8f6b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8f6b('0x19'));var db=require(_0x8f6b('0x1a'))['db'];function respondWithStatusCode(_0xa24424,_0x5080e){_0x5080e=_0x5080e||0xcc;return function(_0x2d8eb0){if(_0x2d8eb0){return _0xa24424[_0x8f6b('0x1b')](_0x5080e);}return _0xa24424[_0x8f6b('0x1c')](_0x5080e)['end']();};}function respondWithResult(_0x15da62,_0x5871cd){_0x5871cd=_0x5871cd||0xc8;return function(_0x594bfc){if(_0x594bfc){return _0x15da62[_0x8f6b('0x1c')](_0x5871cd)['json'](_0x594bfc);}};}function respondWithFilteredResult(_0x460222,_0x1ac053){return function(_0x23a954){if(_0x23a954){var _0x1bbe99=typeof _0x1ac053[_0x8f6b('0x1d')]===_0x8f6b('0x1e')&&typeof _0x1ac053[_0x8f6b('0x1f')]===_0x8f6b('0x1e');var _0x1a6bed=_0x23a954[_0x8f6b('0x20')];var _0x53cb03=_0x1bbe99?0x0:_0x1ac053[_0x8f6b('0x1d')];var _0x555b22=_0x1bbe99?_0x23a954[_0x8f6b('0x20')]:_0x1ac053[_0x8f6b('0x1d')]+_0x1ac053['limit'];var _0x1e2758;if(_0x555b22>=_0x1a6bed){_0x555b22=_0x1a6bed;_0x1e2758=0xc8;}else{_0x1e2758=0xce;}_0x460222[_0x8f6b('0x1c')](_0x1e2758);return _0x460222[_0x8f6b('0x21')](_0x8f6b('0x22'),_0x53cb03+'-'+_0x555b22+'/'+_0x1a6bed)[_0x8f6b('0x23')](_0x23a954);}return null;};}function patchUpdates(_0x591f29){return function(_0x534a81){try{jsonpatch[_0x8f6b('0x24')](_0x534a81,_0x591f29,!![]);}catch(_0x383d8b){return BPromise[_0x8f6b('0x25')](_0x383d8b);}return _0x534a81[_0x8f6b('0x26')]();};}function saveUpdates(_0x45fb00,_0x491e72){return function(_0x223979){if(_0x223979){return _0x223979['update'](_0x45fb00)[_0x8f6b('0x27')](function(_0x32ce38){return _0x32ce38;});}return null;};}function removeEntity(_0x5579c6,_0x39993b){return function(_0x52342d){if(_0x52342d){return _0x52342d['destroy']()[_0x8f6b('0x27')](function(){var _0x232c83=_0x52342d[_0x8f6b('0x28')]({'plain':!![]});var _0x5b9008=_0x8f6b('0x29');return db['UserProfileResource'][_0x8f6b('0x2a')]({'where':{'type':_0x5b9008,'resourceId':_0x232c83['id']}})['then'](function(){return _0x52342d;});})[_0x8f6b('0x27')](function(){_0x5579c6[_0x8f6b('0x1c')](0xcc)[_0x8f6b('0x2b')]();});}};}function handleEntityNotFound(_0x231bdf,_0x3a6cfe){return function(_0x3a7bd1){if(!_0x3a7bd1){_0x231bdf[_0x8f6b('0x1b')](0x194);}return _0x3a7bd1;};}function handleError(_0x4e0804,_0x5f4a46){_0x5f4a46=_0x5f4a46||0x1f4;return function(_0x12fe3e){logger[_0x8f6b('0x2c')](_0x12fe3e[_0x8f6b('0x2d')]);if(_0x12fe3e[_0x8f6b('0x2e')]){delete _0x12fe3e[_0x8f6b('0x2e')];}_0x4e0804['status'](_0x5f4a46)[_0x8f6b('0x2f')](_0x12fe3e);};}exports[_0x8f6b('0x30')]=function(_0x401bfa,_0x4e28f6){var _0x144b7b={},_0x5349e4={},_0x24c113={'count':0x0,'rows':[]};var _0x1ff01e=_['map'](db[_0x8f6b('0x31')]['rawAttributes'],function(_0x44f98c){return{'name':_0x44f98c[_0x8f6b('0x32')],'type':_0x44f98c['type'][_0x8f6b('0x33')]};});_0x5349e4[_0x8f6b('0x34')]=_[_0x8f6b('0x35')](_0x1ff01e,_0x8f6b('0x2e'));_0x5349e4[_0x8f6b('0x36')]=_[_0x8f6b('0x37')](_0x401bfa[_0x8f6b('0x36')]);_0x5349e4[_0x8f6b('0x38')]=_[_0x8f6b('0x39')](_0x5349e4[_0x8f6b('0x34')],_0x5349e4['query']);_0x144b7b['attributes']=_['intersection'](_0x5349e4['model'],qs[_0x8f6b('0x3a')](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x3a')]));_0x144b7b[_0x8f6b('0x3b')]=_0x144b7b[_0x8f6b('0x3b')][_0x8f6b('0x3c')]?_0x144b7b['attributes']:_0x5349e4[_0x8f6b('0x34')];if(!_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x3d')](_0x8f6b('0x3e'))){_0x144b7b[_0x8f6b('0x1f')]=qs['limit'](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x1f')]);_0x144b7b['offset']=qs[_0x8f6b('0x1d')](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x1d')]);}_0x144b7b['order']=qs[_0x8f6b('0x3f')](_0x401bfa[_0x8f6b('0x36')][_0x8f6b('0x3f')]);_0x144b7b['where']=qs['filters'](_['pick'](_0x401bfa[_0x8f6b('0x36')],_0x5349e4['filters']),_0x1ff01e);if(_0x401bfa[_0x8f6b('0x36')]['filter']){_0x144b7b[_0x8f6b('0x40')]=_[_0x8f6b('0x41')](_0x144b7b[_0x8f6b('0x40')],{'$or':_['map'](_0x1ff01e,function(_0x50cad4){if(_0x50cad4[_0x8f6b('0x42')]!==_0x8f6b('0x43')){var _0x69c97d={};_0x69c97d[_0x50cad4['name']]={'$like':'%'+_0x401bfa['query']['filter']+'%'};return _0x69c97d;}})});}_0x144b7b=_[_0x8f6b('0x41')]({},_0x144b7b,_0x401bfa[_0x8f6b('0x44')]);var _0x4ae023={'where':_0x144b7b[_0x8f6b('0x40')]};return db[_0x8f6b('0x31')][_0x8f6b('0x20')](_0x4ae023)['then'](function(_0x5cd18f){_0x24c113['count']=_0x5cd18f;if(_0x401bfa['query'][_0x8f6b('0x45')]){_0x144b7b['include']=[{'all':!![]}];}return db[_0x8f6b('0x31')]['findAll'](_0x144b7b);})[_0x8f6b('0x27')](function(_0x4ae803){_0x24c113[_0x8f6b('0x46')]=_0x4ae803;return _0x24c113;})['then'](respondWithFilteredResult(_0x4e28f6,_0x144b7b))['catch'](handleError(_0x4e28f6,null));};exports[_0x8f6b('0x47')]=function(_0x11f5ed,_0x4b7086){var _0x2691ff={'raw':![],'where':{'id':_0x11f5ed[_0x8f6b('0x48')]['id']}},_0xb4488={};_0xb4488[_0x8f6b('0x34')]=_[_0x8f6b('0x37')](db['Schedule']['rawAttributes']);_0xb4488[_0x8f6b('0x36')]=_[_0x8f6b('0x37')](_0x11f5ed[_0x8f6b('0x36')]);_0xb4488['filters']=_[_0x8f6b('0x39')](_0xb4488[_0x8f6b('0x34')],_0xb4488[_0x8f6b('0x36')]);_0x2691ff['attributes']=_['intersection'](_0xb4488[_0x8f6b('0x34')],qs[_0x8f6b('0x3a')](_0x11f5ed[_0x8f6b('0x36')][_0x8f6b('0x3a')]));_0x2691ff[_0x8f6b('0x3b')]=_0x2691ff[_0x8f6b('0x3b')]['length']?_0x2691ff['attributes']:_0xb4488[_0x8f6b('0x34')];if(_0x11f5ed['query'][_0x8f6b('0x45')]){_0x2691ff['include']=[{'all':!![]}];}_0x2691ff=_[_0x8f6b('0x41')]({},_0x2691ff,_0x11f5ed['options']);return db[_0x8f6b('0x31')][_0x8f6b('0x49')](_0x2691ff)['then'](handleEntityNotFound(_0x4b7086,null))[_0x8f6b('0x27')](respondWithResult(_0x4b7086,null))['catch'](handleError(_0x4b7086,null));};exports[_0x8f6b('0x4a')]=function(_0x303e55,_0x5bef87){return db['Schedule'][_0x8f6b('0x4a')](_0x303e55[_0x8f6b('0x4b')],{})[_0x8f6b('0x27')](function(_0x5bce14){var _0x1c298e=_0x303e55[_0x8f6b('0x4c')][_0x8f6b('0x28')]({'plain':!![]});if(!_0x1c298e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c298e['role']===_0x8f6b('0x4c')){var _0x59623b=_0x5bce14[_0x8f6b('0x28')]({'plain':!![]});var _0x790198='Scheduler';return db[_0x8f6b('0x4d')][_0x8f6b('0x49')]({'where':{'name':_0x790198,'userProfileId':_0x1c298e[_0x8f6b('0x4e')]},'raw':!![]})['then'](function(_0x1cc586){if(_0x1cc586&&_0x1cc586[_0x8f6b('0x4f')]===0x0){return db[_0x8f6b('0x50')][_0x8f6b('0x4a')]({'name':_0x59623b['name'],'resourceId':_0x59623b['id'],'type':_0x1cc586[_0x8f6b('0x2e')],'sectionId':_0x1cc586['id']},{})['then'](function(){return _0x5bce14;});}else{return _0x5bce14;}})[_0x8f6b('0x51')](function(_0x45f470){logger[_0x8f6b('0x2c')](_0x8f6b('0x52'),_0x45f470);throw _0x45f470;});}return _0x5bce14;})[_0x8f6b('0x27')](respondWithResult(_0x5bef87,0xc9))[_0x8f6b('0x51')](handleError(_0x5bef87,null));};exports['update']=function(_0x37f1d7,_0x49f89b){if(_0x37f1d7['body']['id']){delete _0x37f1d7['body']['id'];}return db[_0x8f6b('0x31')][_0x8f6b('0x49')]({'where':{'id':_0x37f1d7['params']['id']}})[_0x8f6b('0x27')](handleEntityNotFound(_0x49f89b,null))['then'](saveUpdates(_0x37f1d7[_0x8f6b('0x4b')],null))['then'](respondWithResult(_0x49f89b,null))[_0x8f6b('0x51')](handleError(_0x49f89b,null));};exports[_0x8f6b('0x2a')]=function(_0x75c117,_0x5efa2b){return db[_0x8f6b('0x31')][_0x8f6b('0x49')]({'where':{'id':_0x75c117[_0x8f6b('0x48')]['id']}})[_0x8f6b('0x27')](handleEntityNotFound(_0x5efa2b,null))['then'](removeEntity(_0x5efa2b,null))[_0x8f6b('0x51')](handleError(_0x5efa2b,null));};exports['run']=function(_0x5c759a,_0x52f00e,_0x8bdca4){var _0x2706e1=require(_0x8f6b('0x53'));return db['Schedule'][_0x8f6b('0x49')]({'where':{'id':_0x5c759a[_0x8f6b('0x48')]['id']},'raw':!![]})[_0x8f6b('0x27')](handleEntityNotFound(_0x52f00e,null))[_0x8f6b('0x27')](function(){_0x2706e1[_0x8f6b('0x54')](_0x5c759a['params']['id']);})[_0x8f6b('0x27')](respondWithStatusCode(_0x52f00e,null))[_0x8f6b('0x51')](handleError(_0x52f00e,null));}; \ No newline at end of file +var _0x5824=['Schedule','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','options','include','findAll','catch','params','merge','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','error','run','../../config/schedule','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Scheduler','UserProfileResource','end','stack','name','send','map'];(function(_0x54d203,_0x374a3d){var _0x1b7fbd=function(_0x407d03){while(--_0x407d03){_0x54d203['push'](_0x54d203['shift']());}};_0x1b7fbd(++_0x374a3d);}(_0x5824,0x73));var _0x4582=function(_0x245367,_0x7cbe8b){_0x245367=_0x245367-0x0;var _0x1f2695=_0x5824[_0x245367];return _0x1f2695;};'use strict';var emlformat=require(_0x4582('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4582('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4582('0x2'));var moment=require(_0x4582('0x3'));var BPromise=require(_0x4582('0x4'));var Mustache=require(_0x4582('0x5'));var util=require(_0x4582('0x6'));var path=require(_0x4582('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4582('0x8'));var fs=require('fs');var fs_extra=require(_0x4582('0x9'));var _=require(_0x4582('0xa'));var squel=require(_0x4582('0xb'));var crypto=require(_0x4582('0xc'));var jsforce=require(_0x4582('0xd'));var deskjs=require(_0x4582('0xe'));var toCsv=require(_0x4582('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4582('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4582('0x11'));var as=require(_0x4582('0x12'));var hardwareService=require(_0x4582('0x13'));var logger=require(_0x4582('0x14'))(_0x4582('0x15'));var utils=require(_0x4582('0x16'));var config=require(_0x4582('0x17'));var licenseUtil=require(_0x4582('0x18'));var db=require(_0x4582('0x19'))['db'];function respondWithStatusCode(_0x3c3b55,_0xf7f043){_0xf7f043=_0xf7f043||0xcc;return function(_0x1d2443){if(_0x1d2443){return _0x3c3b55['sendStatus'](_0xf7f043);}return _0x3c3b55[_0x4582('0x1a')](_0xf7f043)['end']();};}function respondWithResult(_0xb23aa8,_0x541082){_0x541082=_0x541082||0xc8;return function(_0x12424b){if(_0x12424b){return _0xb23aa8[_0x4582('0x1a')](_0x541082)[_0x4582('0x1b')](_0x12424b);}};}function respondWithFilteredResult(_0x1b3a18,_0x9b59ac){return function(_0x16c284){if(_0x16c284){var _0x41a421=typeof _0x9b59ac[_0x4582('0x1c')]===_0x4582('0x1d')&&typeof _0x9b59ac[_0x4582('0x1e')]===_0x4582('0x1d');var _0x354c3e=_0x16c284[_0x4582('0x1f')];var _0x378747=_0x41a421?0x0:_0x9b59ac[_0x4582('0x1c')];var _0x40a1bb=_0x41a421?_0x16c284['count']:_0x9b59ac[_0x4582('0x1c')]+_0x9b59ac['limit'];var _0x89e7c4;if(_0x40a1bb>=_0x354c3e){_0x40a1bb=_0x354c3e;_0x89e7c4=0xc8;}else{_0x89e7c4=0xce;}_0x1b3a18[_0x4582('0x1a')](_0x89e7c4);return _0x1b3a18[_0x4582('0x20')](_0x4582('0x21'),_0x378747+'-'+_0x40a1bb+'/'+_0x354c3e)[_0x4582('0x1b')](_0x16c284);}return null;};}function patchUpdates(_0x1300cc){return function(_0x53c0bd){try{jsonpatch[_0x4582('0x22')](_0x53c0bd,_0x1300cc,!![]);}catch(_0x19d6a6){return BPromise[_0x4582('0x23')](_0x19d6a6);}return _0x53c0bd[_0x4582('0x24')]();};}function saveUpdates(_0x454c8c,_0x1e608e){return function(_0x3ad356){if(_0x3ad356){return _0x3ad356[_0x4582('0x25')](_0x454c8c)['then'](function(_0x2ec60f){return _0x2ec60f;});}return null;};}function removeEntity(_0x4330c3,_0x248654){return function(_0x35d44a){if(_0x35d44a){return _0x35d44a[_0x4582('0x26')]()[_0x4582('0x27')](function(){var _0x55e7c6=_0x35d44a['get']({'plain':!![]});var _0x664d4c=_0x4582('0x28');return db[_0x4582('0x29')][_0x4582('0x26')]({'where':{'type':_0x664d4c,'resourceId':_0x55e7c6['id']}})[_0x4582('0x27')](function(){return _0x35d44a;});})[_0x4582('0x27')](function(){_0x4330c3['status'](0xcc)[_0x4582('0x2a')]();});}};}function handleEntityNotFound(_0x36dec9,_0x4a0de1){return function(_0x27adfc){if(!_0x27adfc){_0x36dec9['sendStatus'](0x194);}return _0x27adfc;};}function handleError(_0x260123,_0x471c0c){_0x471c0c=_0x471c0c||0x1f4;return function(_0x23f671){logger['error'](_0x23f671[_0x4582('0x2b')]);if(_0x23f671[_0x4582('0x2c')]){delete _0x23f671[_0x4582('0x2c')];}_0x260123['status'](_0x471c0c)[_0x4582('0x2d')](_0x23f671);};}exports['index']=function(_0xfc7ca1,_0x4a5252){var _0x106911={},_0x33d1d5={},_0x497ca3={'count':0x0,'rows':[]};var _0xf19b12=_[_0x4582('0x2e')](db[_0x4582('0x2f')]['rawAttributes'],function(_0x40b221){return{'name':_0x40b221[_0x4582('0x30')],'type':_0x40b221[_0x4582('0x31')]['key']};});_0x33d1d5[_0x4582('0x32')]=_['map'](_0xf19b12,'name');_0x33d1d5[_0x4582('0x33')]=_[_0x4582('0x34')](_0xfc7ca1['query']);_0x33d1d5[_0x4582('0x35')]=_[_0x4582('0x36')](_0x33d1d5[_0x4582('0x32')],_0x33d1d5[_0x4582('0x33')]);_0x106911[_0x4582('0x37')]=_[_0x4582('0x36')](_0x33d1d5[_0x4582('0x32')],qs[_0x4582('0x38')](_0xfc7ca1[_0x4582('0x33')][_0x4582('0x38')]));_0x106911[_0x4582('0x37')]=_0x106911['attributes'][_0x4582('0x39')]?_0x106911['attributes']:_0x33d1d5['model'];if(!_0xfc7ca1[_0x4582('0x33')][_0x4582('0x3a')](_0x4582('0x3b'))){_0x106911[_0x4582('0x1e')]=qs[_0x4582('0x1e')](_0xfc7ca1['query'][_0x4582('0x1e')]);_0x106911[_0x4582('0x1c')]=qs[_0x4582('0x1c')](_0xfc7ca1[_0x4582('0x33')][_0x4582('0x1c')]);}_0x106911['order']=qs['sort'](_0xfc7ca1[_0x4582('0x33')][_0x4582('0x3c')]);_0x106911['where']=qs[_0x4582('0x35')](_['pick'](_0xfc7ca1['query'],_0x33d1d5[_0x4582('0x35')]),_0xf19b12);if(_0xfc7ca1[_0x4582('0x33')][_0x4582('0x3d')]){_0x106911[_0x4582('0x3e')]=_['merge'](_0x106911['where'],{'$or':_[_0x4582('0x2e')](_0xf19b12,function(_0x583b20){if(_0x583b20[_0x4582('0x31')]!==_0x4582('0x3f')){var _0x3e0d68={};_0x3e0d68[_0x583b20[_0x4582('0x2c')]]={'$like':'%'+_0xfc7ca1[_0x4582('0x33')][_0x4582('0x3d')]+'%'};return _0x3e0d68;}})});}_0x106911=_['merge']({},_0x106911,_0xfc7ca1[_0x4582('0x40')]);var _0x1c3eda={'where':_0x106911[_0x4582('0x3e')]};return db['Schedule'][_0x4582('0x1f')](_0x1c3eda)['then'](function(_0x42977e){_0x497ca3[_0x4582('0x1f')]=_0x42977e;if(_0xfc7ca1['query']['includeAll']){_0x106911[_0x4582('0x41')]=[{'all':!![]}];}return db[_0x4582('0x2f')][_0x4582('0x42')](_0x106911);})[_0x4582('0x27')](function(_0x14eaca){_0x497ca3['rows']=_0x14eaca;return _0x497ca3;})[_0x4582('0x27')](respondWithFilteredResult(_0x4a5252,_0x106911))[_0x4582('0x43')](handleError(_0x4a5252,null));};exports['show']=function(_0x241f3c,_0x56734d){var _0x315866={'raw':![],'where':{'id':_0x241f3c[_0x4582('0x44')]['id']}},_0x441378={};_0x441378[_0x4582('0x32')]=_['keys'](db[_0x4582('0x2f')]['rawAttributes']);_0x441378[_0x4582('0x33')]=_['keys'](_0x241f3c[_0x4582('0x33')]);_0x441378[_0x4582('0x35')]=_['intersection'](_0x441378['model'],_0x441378[_0x4582('0x33')]);_0x315866[_0x4582('0x37')]=_[_0x4582('0x36')](_0x441378[_0x4582('0x32')],qs[_0x4582('0x38')](_0x241f3c[_0x4582('0x33')][_0x4582('0x38')]));_0x315866[_0x4582('0x37')]=_0x315866[_0x4582('0x37')][_0x4582('0x39')]?_0x315866[_0x4582('0x37')]:_0x441378['model'];if(_0x241f3c[_0x4582('0x33')]['includeAll']){_0x315866['include']=[{'all':!![]}];}_0x315866=_[_0x4582('0x45')]({},_0x315866,_0x241f3c['options']);return db[_0x4582('0x2f')][_0x4582('0x46')](_0x315866)[_0x4582('0x27')](handleEntityNotFound(_0x56734d,null))[_0x4582('0x27')](respondWithResult(_0x56734d,null))[_0x4582('0x43')](handleError(_0x56734d,null));};exports[_0x4582('0x47')]=function(_0x4e9561,_0x4a988c){return db['Schedule'][_0x4582('0x47')](_0x4e9561[_0x4582('0x48')],{})['then'](function(_0x106b72){var _0x1133b0=_0x4e9561[_0x4582('0x49')][_0x4582('0x4a')]({'plain':!![]});if(!_0x1133b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1133b0['role']===_0x4582('0x49')){var _0x170a41=_0x106b72['get']({'plain':!![]});var _0x339d7d=_0x4582('0x28');return db[_0x4582('0x4b')]['find']({'where':{'name':_0x339d7d,'userProfileId':_0x1133b0[_0x4582('0x4c')]},'raw':!![]})[_0x4582('0x27')](function(_0x4f0013){if(_0x4f0013&&_0x4f0013[_0x4582('0x4d')]===0x0){return db['UserProfileResource'][_0x4582('0x47')]({'name':_0x170a41['name'],'resourceId':_0x170a41['id'],'type':_0x4f0013[_0x4582('0x2c')],'sectionId':_0x4f0013['id']},{})[_0x4582('0x27')](function(){return _0x106b72;});}else{return _0x106b72;}})[_0x4582('0x43')](function(_0xa6ebaf){logger[_0x4582('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa6ebaf);throw _0xa6ebaf;});}return _0x106b72;})[_0x4582('0x27')](respondWithResult(_0x4a988c,0xc9))[_0x4582('0x43')](handleError(_0x4a988c,null));};exports['update']=function(_0x44d4d2,_0x2d6237){if(_0x44d4d2['body']['id']){delete _0x44d4d2['body']['id'];}return db['Schedule'][_0x4582('0x46')]({'where':{'id':_0x44d4d2['params']['id']}})['then'](handleEntityNotFound(_0x2d6237,null))['then'](saveUpdates(_0x44d4d2[_0x4582('0x48')],null))[_0x4582('0x27')](respondWithResult(_0x2d6237,null))['catch'](handleError(_0x2d6237,null));};exports[_0x4582('0x26')]=function(_0xf31206,_0x3d7bfa){return db[_0x4582('0x2f')]['find']({'where':{'id':_0xf31206[_0x4582('0x44')]['id']}})[_0x4582('0x27')](handleEntityNotFound(_0x3d7bfa,null))[_0x4582('0x27')](removeEntity(_0x3d7bfa,null))[_0x4582('0x43')](handleError(_0x3d7bfa,null));};exports[_0x4582('0x4f')]=function(_0xfc3a21,_0x3964aa,_0x395785){var _0x59a13=require(_0x4582('0x50'));return db[_0x4582('0x2f')][_0x4582('0x46')]({'where':{'id':_0xfc3a21['params']['id']},'raw':!![]})[_0x4582('0x27')](handleEntityNotFound(_0x3964aa,null))[_0x4582('0x27')](function(){_0x59a13[_0x4582('0x4f')](_0xfc3a21[_0x4582('0x44')]['id']);})[_0x4582('0x27')](respondWithStatusCode(_0x3964aa,null))['catch'](handleError(_0x3964aa,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 567689f..c846e0d 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 _0xc82e=['tools_schedules','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','define','Schedule'];(function(_0x2e11ab,_0x4e146e){var _0x1dd724=function(_0x4c6abb){while(--_0x4c6abb){_0x2e11ab['push'](_0x2e11ab['shift']());}};_0x1dd724(++_0x4e146e);}(_0xc82e,0x12d));var _0xec82=function(_0x2e44f3,_0x186488){_0x2e44f3=_0x2e44f3-0x0;var _0x233656=_0xc82e[_0x2e44f3];return _0x233656;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec82('0x0'))(_0xec82('0x1'));var moment=require(_0xec82('0x2'));var BPromise=require('bluebird');var rp=require(_0xec82('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec82('0x4'));var config=require(_0xec82('0x5'));var attributes=require(_0xec82('0x6'));module['exports']=function(_0x3f11fa,_0x54d7f6){return _0x3f11fa[_0xec82('0x7')](_0xec82('0x8'),attributes,{'tableName':_0xec82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x920d=['path','rimraf','../../config/environment','./schedule.attributes','exports','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa9dc6f,_0x27d8f0){var _0x201588=function(_0x4a8de8){while(--_0x4a8de8){_0xa9dc6f['push'](_0xa9dc6f['shift']());}};_0x201588(++_0x27d8f0);}(_0x920d,0x132));var _0xd920=function(_0x337a0b,_0x103d02){_0x337a0b=_0x337a0b-0x0;var _0x57a904=_0x920d[_0x337a0b];return _0x57a904;};'use strict';var _=require(_0xd920('0x0'));var util=require(_0xd920('0x1'));var logger=require(_0xd920('0x2'))(_0xd920('0x3'));var moment=require(_0xd920('0x4'));var BPromise=require(_0xd920('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd920('0x6'));var rimraf=require(_0xd920('0x7'));var config=require(_0xd920('0x8'));var attributes=require(_0xd920('0x9'));module[_0xd920('0xa')]=function(_0xcfc4ff,_0x5abc07){return _0xcfc4ff['define']('Schedule',attributes,{'tableName':_0xd920('0xb'),'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 67a3107..950720e 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 _0xea55=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','moment'];(function(_0x304fa8,_0x14785c){var _0x187282=function(_0x27a0a0){while(--_0x27a0a0){_0x304fa8['push'](_0x304fa8['shift']());}};_0x187282(++_0x14785c);}(_0xea55,0xcb));var _0x5ea5=function(_0x539a16,_0x1b7fb4){_0x539a16=_0x539a16-0x0;var _0x439e5b=_0xea55[_0x539a16];return _0x439e5b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ea5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ea5('0x1'));var db=require(_0x5ea5('0x2'))['db'];var utils=require(_0x5ea5('0x3'));var logger=require('../../config/logger')(_0x5ea5('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5ea5('0x5')][_0x5ea5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2f14fc,_0x241225,_0x2767af){return new BPromise(function(_0x43eb08,_0x518608){return client['request'](_0x2f14fc,_0x2767af)['then'](function(_0x211b4d){logger[_0x5ea5('0x7')](_0x5ea5('0x8'),_0x241225,'request\x20sent');logger[_0x5ea5('0x9')](_0x5ea5('0xa'),_0x241225,_0x5ea5('0xb'),JSON[_0x5ea5('0xc')](_0x211b4d));if(_0x211b4d['error']){if(_0x211b4d['error'][_0x5ea5('0xd')]===0x1f4){logger['error'](_0x5ea5('0x8'),_0x241225,_0x211b4d[_0x5ea5('0xe')][_0x5ea5('0xf')]);return _0x518608(_0x211b4d['error'][_0x5ea5('0xf')]);}logger[_0x5ea5('0xe')](_0x5ea5('0x8'),_0x241225,_0x211b4d['error'][_0x5ea5('0xf')]);return _0x43eb08(_0x211b4d[_0x5ea5('0xe')]['message']);}else{logger[_0x5ea5('0x7')]('Schedule,\x20%s,\x20%s',_0x241225,_0x5ea5('0xb'));_0x43eb08(_0x211b4d['result']['message']);}})[_0x5ea5('0x10')](function(_0x22dd31){logger['error']('Schedule,\x20%s,\x20%s',_0x241225,_0x22dd31);_0x518608(_0x22dd31);});});} \ No newline at end of file +var _0x882c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird'];(function(_0x47c829,_0x557336){var _0x48dda6=function(_0x319d3d){while(--_0x319d3d){_0x47c829['push'](_0x47c829['shift']());}};_0x48dda6(++_0x557336);}(_0x882c,0x70));var _0xc882=function(_0x2d80af,_0xfdfd5b){_0x2d80af=_0x2d80af-0x0;var _0x4917c6=_0x882c[_0x2d80af];return _0x4917c6;};'use strict';var _=require(_0xc882('0x0'));var util=require(_0xc882('0x1'));var moment=require('moment');var BPromise=require(_0xc882('0x2'));var rs=require(_0xc882('0x3'));var fs=require('fs');var Redis=require(_0xc882('0x4'));var db=require(_0xc882('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc882('0x6'))(_0xc882('0x7'));var config=require(_0xc882('0x8'));var jayson=require(_0xc882('0x9'));var client=jayson[_0xc882('0xa')][_0xc882('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2225b5,_0x238cb5,_0x1220dc){return new BPromise(function(_0x2164ff,_0xa070a3){return client[_0xc882('0xc')](_0x2225b5,_0x1220dc)[_0xc882('0xd')](function(_0x4424c6){logger[_0xc882('0xe')](_0xc882('0xf'),_0x238cb5,'request\x20sent');logger[_0xc882('0x10')](_0xc882('0x11'),_0x238cb5,_0xc882('0x12'),JSON['stringify'](_0x4424c6));if(_0x4424c6[_0xc882('0x13')]){if(_0x4424c6[_0xc882('0x13')][_0xc882('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x238cb5,_0x4424c6['error']['message']);return _0xa070a3(_0x4424c6['error'][_0xc882('0x15')]);}logger['error'](_0xc882('0xf'),_0x238cb5,_0x4424c6[_0xc882('0x13')]['message']);return _0x2164ff(_0x4424c6[_0xc882('0x13')]['message']);}else{logger['info'](_0xc882('0xf'),_0x238cb5,_0xc882('0x12'));_0x2164ff(_0x4424c6[_0xc882('0x16')][_0xc882('0x15')]);}})['catch'](function(_0x34e17f){logger[_0xc882('0x13')](_0xc882('0xf'),_0x238cb5,_0x34e17f);_0xa070a3(_0x34e17f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ca47f40..058c25f 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 _0xfc48=['./screenRecording.controller','get','isAuthenticated','index','describe','show','/:id/download','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f3cf2,_0xca3d39){var _0x2ba111=function(_0x5c5dc3){while(--_0x5c5dc3){_0x2f3cf2['push'](_0x2f3cf2['shift']());}};_0x2ba111(++_0xca3d39);}(_0xfc48,0x199));var _0x8fc4=function(_0x1ba9b9,_0x1f0144){_0x1ba9b9=_0x1ba9b9-0x0;var _0x12db6d=_0xfc48[_0x1ba9b9];return _0x12db6d;};'use strict';var multer=require(_0x8fc4('0x0'));var util=require(_0x8fc4('0x1'));var path=require(_0x8fc4('0x2'));var timeout=require(_0x8fc4('0x3'));var express=require(_0x8fc4('0x4'));var router=express[_0x8fc4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8fc4('0x6'));var interaction=require(_0x8fc4('0x7'));var config=require(_0x8fc4('0x8'));var controller=require(_0x8fc4('0x9'));router[_0x8fc4('0xa')]('/',auth[_0x8fc4('0xb')](),controller[_0x8fc4('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8fc4('0xd')]);router[_0x8fc4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8fc4('0xe')]);router[_0x8fc4('0xa')](_0x8fc4('0xf'),auth[_0x8fc4('0xb')](),controller['download']);router[_0x8fc4('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8fc4('0x11')](_0x8fc4('0x12'),auth[_0x8fc4('0xb')](),controller[_0x8fc4('0x13')]);router[_0x8fc4('0x14')](_0x8fc4('0x12'),auth[_0x8fc4('0xb')](),controller['destroy']);module[_0x8fc4('0x15')]=router; \ No newline at end of file +var _0x35ff=['path','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','put','update','delete','destroy','util'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x35ff,0xb3));var _0xf35f=function(_0x33c36e,_0x15f3a7){_0x33c36e=_0x33c36e-0x0;var _0x26c2ef=_0x35ff[_0x33c36e];return _0x26c2ef;};'use strict';var multer=require('multer');var util=require(_0xf35f('0x0'));var path=require(_0xf35f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf35f('0x2'));var router=express[_0xf35f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf35f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf35f('0x5'));var controller=require(_0xf35f('0x6'));router[_0xf35f('0x7')]('/',auth[_0xf35f('0x8')](),controller[_0xf35f('0x9')]);router[_0xf35f('0x7')]('/describe',auth[_0xf35f('0x8')](),controller[_0xf35f('0xa')]);router[_0xf35f('0x7')](_0xf35f('0xb'),auth['isAuthenticated'](),controller[_0xf35f('0xc')]);router[_0xf35f('0x7')](_0xf35f('0xd'),auth[_0xf35f('0x8')](),controller[_0xf35f('0xe')]);router[_0xf35f('0xf')]('/',auth[_0xf35f('0x8')](),controller['create']);router[_0xf35f('0x10')](_0xf35f('0xb'),auth[_0xf35f('0x8')](),controller[_0xf35f('0x11')]);router[_0xf35f('0x12')](_0xf35f('0xb'),auth[_0xf35f('0x8')](),controller[_0xf35f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index b53aafa..2e832bc 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 _0xf277=['updatedAt','sequelize','moment','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','duration','DATE','startedAt','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf277,0x1e1));var _0x7f27=function(_0x10857f,_0x4e460b){_0x10857f=_0x10857f-0x0;var _0x3b7b92=_0xf277[_0x10857f];return _0x3b7b92;};'use strict';var Sequelize=require(_0x7f27('0x0'));var moment=require(_0x7f27('0x1'));var path=require('path');var config=require(_0x7f27('0x2'));module['exports']={'format':{'type':Sequelize[_0x7f27('0x3')],'get':function(){return this[_0x7f27('0x4')](_0x7f27('0x5'))?path[_0x7f27('0x6')](this[_0x7f27('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x7f27('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7f27('0x7')],'set':function(_0x39dcee){var _0x480cd6=_0x39dcee[_0x7f27('0x8')](/\\/g,'/');this[_0x7f27('0x9')]('value',_0x480cd6);}},'rating':{'type':Sequelize[_0x7f27('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7f27('0xa')],'set':function(_0x8ecc84){this[_0x7f27('0x9')]('startedAt',moment()['subtract'](_0x8ecc84,'ms'));this[_0x7f27('0x9')]('closedAt',moment());this[_0x7f27('0x9')](_0x7f27('0xb'),_0x8ecc84);}},'startedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this[_0x7f27('0x4')](_0x7f27('0xd')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}},'closedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this['getDataValue'](_0x7f27('0x10')))[_0x7f27('0xe')](_0x7f27('0x11'))[_0x7f27('0xf')]();}},'createdAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this[_0x7f27('0x4')](_0x7f27('0x12')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}},'updatedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this['getDataValue'](_0x7f27('0x13')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}}}; \ No newline at end of file +var _0x349e=['startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','subtract','closedAt','duration','DATE'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x349e,0xcb));var _0xe349=function(_0x1ac4d4,_0x6e8b8d){_0x1ac4d4=_0x1ac4d4-0x0;var _0x1a2315=_0x349e[_0x1ac4d4];return _0x1a2315;};'use strict';var Sequelize=require(_0xe349('0x0'));var moment=require(_0xe349('0x1'));var path=require(_0xe349('0x2'));var config=require(_0xe349('0x3'));module[_0xe349('0x4')]={'format':{'type':Sequelize[_0xe349('0x5')],'get':function(){return this[_0xe349('0x6')](_0xe349('0x7'))?path[_0xe349('0x8')](this['getDataValue'](_0xe349('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xe349('0x9')],'set':function(_0x494605){var _0xcb9b49=_0x494605[_0xe349('0xa')](/\\/g,'/');this['setDataValue'](_0xe349('0x7'),_0xcb9b49);}},'rating':{'type':Sequelize[_0xe349('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe349('0xb')],'set':function(_0x7b08d2){this[_0xe349('0xc')]('startedAt',moment()[_0xe349('0xd')](_0x7b08d2,'ms'));this[_0xe349('0xc')](_0xe349('0xe'),moment());this[_0xe349('0xc')](_0xe349('0xf'),_0x7b08d2);}},'startedAt':{'type':Sequelize[_0xe349('0x10')],'get':function(){return moment(this[_0xe349('0x6')](_0xe349('0x11')))[_0xe349('0x12')](_0xe349('0x13'))[_0xe349('0x14')]();}},'closedAt':{'type':Sequelize[_0xe349('0x10')],'get':function(){return moment(this[_0xe349('0x6')](_0xe349('0xe')))[_0xe349('0x12')](_0xe349('0x13'))[_0xe349('0x14')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe349('0x6')]('createdAt'))[_0xe349('0x12')](_0xe349('0x13'))[_0xe349('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xe349('0x15')))[_0xe349('0x12')](_0xe349('0x13'))[_0xe349('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9a8a4b7..9ea204e 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 _0x038b=['offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','root','%s.cypher','decryptFile','secrets','recording','join','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x74d1ba,_0x4935de){var _0x51a47b=function(_0xbe0576){while(--_0xbe0576){_0x74d1ba['push'](_0x74d1ba['shift']());}};_0x51a47b(++_0x4935de);}(_0x038b,0x114));var _0xb038=function(_0x49bedb,_0x4f0f54){_0x49bedb=_0x49bedb-0x0;var _0x24eea8=_0x038b[_0x49bedb];return _0x24eea8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x2d')](_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24')),[_0xb038('0x2e')]);_0xc387d['query']=_[_0xb038('0x2f')](_0x2855a6['query']);_0xc387d[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x32')]);_0x12b3b6[_0xb038('0x33')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x32')][_0xb038('0x34')]));_0x12b3b6['attributes']=_0x12b3b6[_0xb038('0x33')][_0xb038('0x35')]?_0x12b3b6[_0xb038('0x33')]:_0xc387d['model'];if(!_0x2855a6['query']['hasOwnProperty'](_0xb038('0x36'))){_0x12b3b6[_0xb038('0x1b')]=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x32')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs['offset'](_0x2855a6[_0xb038('0x32')][_0xb038('0x18')]);}_0x12b3b6[_0xb038('0x37')]=qs[_0xb038('0x38')](_0x2855a6['query'][_0xb038('0x38')]);_0x12b3b6[_0xb038('0x39')]=qs['filters'](_['pick'](_0x2855a6[_0xb038('0x32')],_0xc387d[_0xb038('0x30')]),_0x1783d4);if(_0x2855a6[_0xb038('0x32')][_0xb038('0x3a')]){_0x12b3b6[_0xb038('0x39')]=_['merge'](_0x12b3b6[_0xb038('0x39')],{'$or':_[_0xb038('0x26')](_0x1783d4,function(_0x26d48c){if(_0x26d48c[_0xb038('0x2a')]!=='VIRTUAL'){var _0x793da9={};_0x793da9[_0x26d48c[_0xb038('0x24')]]={'$like':'%'+_0x2855a6[_0xb038('0x32')]['filter']+'%'};return _0x793da9;}})});}_0x12b3b6=_[_0xb038('0x3b')]({},_0x12b3b6,_0x2855a6['options']);var _0x36f281={'where':_0x12b3b6[_0xb038('0x39')]};return db[_0xb038('0x27')]['count'](_0x36f281)[_0xb038('0x22')](function(_0x357c78){_0x551b55[_0xb038('0x1a')]=_0x357c78;if(_0x2855a6['query'][_0xb038('0x3c')]){_0x12b3b6[_0xb038('0x3d')]=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3e')](_0x12b3b6);})['then'](function(_0x28b922){_0x551b55[_0xb038('0x3f')]=_0x28b922;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x40')](handleError(_0x28a6a9,null));};exports['show']=function(_0x19dc7b,_0x269c7d){var _0x57816c={'raw':![],'where':{'id':_0x19dc7b[_0xb038('0x41')]['id']}},_0x207fb5={};_0x207fb5[_0xb038('0x2c')]=_['keys'](db[_0xb038('0x27')][_0xb038('0x28')]);_0x207fb5['query']=_['keys'](_0x19dc7b[_0xb038('0x32')]);_0x207fb5[_0xb038('0x30')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],_0x207fb5[_0xb038('0x32')]);_0x57816c[_0xb038('0x33')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],qs['fields'](_0x19dc7b['query']['fields']));_0x57816c[_0xb038('0x33')]=_0x57816c[_0xb038('0x33')]['length']?_0x57816c[_0xb038('0x33')]:_0x207fb5[_0xb038('0x2c')];if(_0x19dc7b[_0xb038('0x32')]['includeAll']){_0x57816c[_0xb038('0x3d')]=[{'all':!![]}];}_0x57816c=_['merge']({},_0x57816c,_0x19dc7b['options']);return db[_0xb038('0x27')][_0xb038('0x42')](_0x57816c)[_0xb038('0x22')](handleEntityNotFound(_0x269c7d,null))[_0xb038('0x22')](respondWithResult(_0x269c7d,null))[_0xb038('0x40')](handleError(_0x269c7d,null));};exports[_0xb038('0x43')]=function(_0x2f053a,_0x473aae){return db[_0xb038('0x27')][_0xb038('0x43')](_0x2f053a['body'],{})[_0xb038('0x22')](respondWithResult(_0x473aae,0xc9))[_0xb038('0x40')](handleError(_0x473aae,null));};exports['update']=function(_0x906c9c,_0x19ab72){if(_0x906c9c['body']['id']){delete _0x906c9c[_0xb038('0x44')]['id'];}delete _0x906c9c[_0xb038('0x44')][_0xb038('0x45')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x46')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x47')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x48')];return db['ScreenRecording'][_0xb038('0x42')]({'where':{'id':_0x906c9c[_0xb038('0x41')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x19ab72,null))[_0xb038('0x22')](saveUpdates(_0x906c9c[_0xb038('0x44')],null))[_0xb038('0x22')](respondWithResult(_0x19ab72,null))['catch'](handleError(_0x19ab72,null));};exports[_0xb038('0x49')]=function(_0x2f3622,_0x2b2b4d){return db[_0xb038('0x27')][_0xb038('0x49')]()[_0xb038('0x22')](respondWithResult(_0x2b2b4d,null))[_0xb038('0x40')](handleError(_0x2b2b4d,null));};exports['download']=function(_0x3abe7a,_0x5c4a79,_0x77f211){var _0x1ea8ad=require(_0xb038('0x4a'));var _0x998fe3=![];var _0x1518c4={};if(_0x3abe7a['query']['type']&&_0x3abe7a['query'][_0xb038('0x2a')]===_0xb038('0x4b')){_0x1518c4[_0xb038('0x4b')]=_0x3abe7a[_0xb038('0x41')]['id'];}else{_0x1518c4['id']=_0x3abe7a[_0xb038('0x41')]['id'];}return db[_0xb038('0x27')]['find']({'where':_0x1518c4,'attributes':['id',_0xb038('0x48')],'raw':!![]})[_0xb038('0x22')](handleEntityNotFound(_0x5c4a79,null))['then'](function(_0x5b27d3){if(_0x5b27d3){var _0xf2907b=path['join'](config[_0xb038('0x4c')],'server/files/screen_recordings',_0x5b27d3[_0xb038('0x48')]);var _0x4677b8=util[_0xb038('0x2e')](_0xb038('0x4d'),_0xf2907b);if(fs['existsSync'](_0x4677b8)){_0x998fe3=!![];return _0x1ea8ad[_0xb038('0x4e')](_0x4677b8,_0xf2907b,config[_0xb038('0x4f')][_0xb038('0x50')])[_0xb038('0x22')](function(){return _0x5b27d3;});}return _0x5b27d3;}})[_0xb038('0x22')](function(_0x1246c8){if(_0x1246c8){var _0x14a553=path[_0xb038('0x51')](config[_0xb038('0x4c')],_0xb038('0x52'),_0x1246c8[_0xb038('0x48')]);if(!fs[_0xb038('0x53')](_0x14a553)){throw new db['Sequelize'][(_0xb038('0x54'))](_0xb038('0x55'));}if(_0x1246c8[_0xb038('0x56')]){return _0x5c4a79[_0xb038('0x57')](_0x14a553,_0x1246c8[_0xb038('0x56')]+path['extname'](_0x14a553),function(){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}else{return _0x5c4a79['download'](_0x14a553,function(_0xfb3ce6){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}}})['catch'](function(_0x15d61c){if(_0x15d61c[_0xb038('0x59')]===_0xb038('0x55')){_0x5c4a79[_0xb038('0x16')](0x194)[_0xb038('0x5a')](_0xb038('0x5b'));}else{return handleError(_0x5c4a79,null);}});};exports[_0xb038('0x5c')]=function(_0xe275b8,_0x769f1e){return db[_0xb038('0x27')]['find']({'where':{'id':_0xe275b8[_0xb038('0x41')]['id']}})['then'](function(_0x189894){if(_[_0xb038('0x5d')](_0x189894)){throw new ReferenceError(_0xb038('0x5e'));}return _0x189894;})[_0xb038('0x22')](function(_0x1f5f3f){var _0x23fb92=path[_0xb038('0x51')](config['root'],'server/files/screen_recordings',_0x1f5f3f[_0xb038('0x48')]);logger[_0xb038('0x5f')](_0xb038('0x60'),_0x23fb92);if(!_['isNil'](_0x1f5f3f['value'])&&fs[_0xb038('0x53')](_0x23fb92)){logger['info'](_0xb038('0x61')+_0x23fb92+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb038('0x62')](_0x23fb92);}_0x23fb92=_0x23fb92+'.cypher';if(!_[_0xb038('0x5d')](_0x1f5f3f[_0xb038('0x48')])&&fs[_0xb038('0x53')](_0x23fb92)){logger[_0xb038('0x5f')](_0xb038('0x61')+_0x23fb92+_0xb038('0x63'));fs['unlinkSync'](_0x23fb92);}return _0x1f5f3f;})['then'](function(_0x45e628){if(!_0x45e628)throw new InternalError();return _0x45e628['destroy']();})[_0xb038('0x22')](function(){_0x769f1e[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();})['catch'](handleError(_0x769f1e,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2f8d05,_0x1e3c54){_0x2f8d05=_0x2f8d05-0x0;var _0x5e2316=_0x4c4e[_0x2f8d05];return _0x5e2316;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 114a79c..4ac3e97 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 _0xd537=['define','screen_recordings','interactionid','../../config/logger','moment','bluebird','request-promise','rimraf','./screenRecording.attributes'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xd537,0x159));var _0x7d53=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd537[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d53('0x0'))('api');var moment=require(_0x7d53('0x1'));var BPromise=require(_0x7d53('0x2'));var rp=require(_0x7d53('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d53('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d53('0x5'));module['exports']=function(_0x11b6a7,_0x5126e4){return _0x11b6a7[_0x7d53('0x6')]('ScreenRecording',attributes,{'tableName':_0x7d53('0x7'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x7d53('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cc7=['api','moment','request-promise','path','../../config/environment','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0x4cc7,0x81));var _0x74cc=function(_0x5008c8,_0x342e4a){_0x5008c8=_0x5008c8-0x0;var _0x28d778=_0x4cc7[_0x5008c8];return _0x28d778;};'use strict';var _=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var logger=require(_0x74cc('0x2'))(_0x74cc('0x3'));var moment=require(_0x74cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x74cc('0x5'));var fs=require('fs');var path=require(_0x74cc('0x6'));var rimraf=require('rimraf');var config=require(_0x74cc('0x7'));var attributes=require('./screenRecording.attributes');module[_0x74cc('0x8')]=function(_0x129f7e,_0x3ed485){return _0x129f7e[_0x74cc('0x9')](_0x74cc('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x74cc('0xb'),'fields':[_0x74cc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 55f70c5..978c143 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 _0xa96d=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x441a9e,_0x1d1ed5){var _0x238c72=function(_0x100fab){while(--_0x100fab){_0x441a9e['push'](_0x441a9e['shift']());}};_0x238c72(++_0x1d1ed5);}(_0xa96d,0x18f));var _0xda96=function(_0x5cd7a3,_0x1aa14f){_0x5cd7a3=_0x5cd7a3-0x0;var _0x21235d=_0xa96d[_0x5cd7a3];return _0x21235d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda96('0x0'));var BPromise=require(_0xda96('0x1'));var rs=require(_0xda96('0x2'));var fs=require('fs');var Redis=require(_0xda96('0x3'));var db=require(_0xda96('0x4'))['db'];var utils=require(_0xda96('0x5'));var logger=require(_0xda96('0x6'))(_0xda96('0x7'));var config=require('../../config/environment');var jayson=require(_0xda96('0x8'));var client=jayson['client'][_0xda96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1b7e,_0x2c36f3,_0x164029){return new BPromise(function(_0x4ee04f,_0x1e4a7b){return client[_0xda96('0xa')](_0x5e1b7e,_0x164029)[_0xda96('0xb')](function(_0x4534a3){logger[_0xda96('0xc')](_0xda96('0xd'),_0x2c36f3,_0xda96('0xe'));logger[_0xda96('0xf')](_0xda96('0x10'),_0x2c36f3,_0xda96('0xe'),JSON[_0xda96('0x11')](_0x4534a3));if(_0x4534a3[_0xda96('0x12')]){if(_0x4534a3[_0xda96('0x12')][_0xda96('0x13')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2c36f3,_0x4534a3[_0xda96('0x12')][_0xda96('0x14')]);return _0x1e4a7b(_0x4534a3['error']['message']);}logger[_0xda96('0x12')](_0xda96('0xd'),_0x2c36f3,_0x4534a3['error']['message']);return _0x4ee04f(_0x4534a3[_0xda96('0x12')][_0xda96('0x14')]);}else{logger[_0xda96('0xc')](_0xda96('0xd'),_0x2c36f3,_0xda96('0xe'));_0x4ee04f(_0x4534a3[_0xda96('0x15')][_0xda96('0x14')]);}})[_0xda96('0x16')](function(_0x3f26c0){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2c36f3,_0x3f26c0);_0x1e4a7b(_0x3f26c0);});});} \ No newline at end of file +var _0x9352=['../../config/environment','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x3a5db0,_0x12b8ef){var _0x369a32=function(_0xb95e07){while(--_0xb95e07){_0x3a5db0['push'](_0x3a5db0['shift']());}};_0x369a32(++_0x12b8ef);}(_0x9352,0xa0));var _0x2935=function(_0x30cf59,_0x4a164f){_0x30cf59=_0x30cf59-0x0;var _0x30eb66=_0x9352[_0x30cf59];return _0x30eb66;};'use strict';var _=require(_0x2935('0x0'));var util=require(_0x2935('0x1'));var moment=require(_0x2935('0x2'));var BPromise=require(_0x2935('0x3'));var rs=require(_0x2935('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2935('0x5'))['db'];var utils=require(_0x2935('0x6'));var logger=require('../../config/logger')(_0x2935('0x7'));var config=require(_0x2935('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2935('0x9')][_0x2935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x997302,_0x558425,_0x3e871f){return new BPromise(function(_0x400136,_0xbfb2ea){return client[_0x2935('0xb')](_0x997302,_0x3e871f)['then'](function(_0x3229f6){logger[_0x2935('0xc')](_0x2935('0xd'),_0x558425,_0x2935('0xe'));logger[_0x2935('0xf')](_0x2935('0x10'),_0x558425,_0x2935('0xe'),JSON['stringify'](_0x3229f6));if(_0x3229f6[_0x2935('0x11')]){if(_0x3229f6[_0x2935('0x11')]['code']===0x1f4){logger[_0x2935('0x11')](_0x2935('0xd'),_0x558425,_0x3229f6[_0x2935('0x11')][_0x2935('0x12')]);return _0xbfb2ea(_0x3229f6[_0x2935('0x11')][_0x2935('0x12')]);}logger['error'](_0x2935('0xd'),_0x558425,_0x3229f6[_0x2935('0x11')]['message']);return _0x400136(_0x3229f6[_0x2935('0x11')][_0x2935('0x12')]);}else{logger[_0x2935('0xc')](_0x2935('0xd'),_0x558425,_0x2935('0xe'));_0x400136(_0x3229f6[_0x2935('0x13')][_0x2935('0x12')]);}})[_0x2935('0x14')](function(_0xfc6432){logger[_0x2935('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x558425,_0xfc6432);_0xbfb2ea(_0xfc6432);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index cc52116..98665ee 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 _0x1247=['getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','addLogoLogin','root','preferred','addPreferred','join','single','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred'];(function(_0x148f1a,_0x38eadd){var _0x47da7f=function(_0x46ed20){while(--_0x46ed20){_0x148f1a['push'](_0x148f1a['shift']());}};_0x47da7f(++_0x38eadd);}(_0x1247,0x117));var _0x7124=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0x1247[_0x3c4dad];return _0x1a4f49;};'use strict';var multer=require(_0x7124('0x0'));var util=require(_0x7124('0x1'));var path=require(_0x7124('0x2'));var timeout=require(_0x7124('0x3'));var express=require(_0x7124('0x4'));var router=express[_0x7124('0x5')]();var fs_extra=require(_0x7124('0x6'));var auth=require(_0x7124('0x7'));var interaction=require(_0x7124('0x8'));var config=require(_0x7124('0x9'));var controller=require('./setting.controller');router['get']('/',auth[_0x7124('0xa')](),controller['index']);router[_0x7124('0xb')](_0x7124('0xc'),controller[_0x7124('0xd')]);router[_0x7124('0xb')](_0x7124('0xe'),controller[_0x7124('0xf')]);router[_0x7124('0xb')](_0x7124('0x10'),controller['getLogo']);router[_0x7124('0xb')](_0x7124('0x11'),controller[_0x7124('0x12')]);router[_0x7124('0xb')](_0x7124('0x13'),controller[_0x7124('0x14')]);router['get'](_0x7124('0x15'),controller[_0x7124('0x16')]);router[_0x7124('0xb')](_0x7124('0x17'),controller[_0x7124('0x18')]);var upload=multer({'storage':multer[_0x7124('0x19')]({'destination':function(_0x3b3490,_0x3c079d,_0x4d6dc5){_0x4d6dc5(null,path['join'](config['root'],_0x7124('0x1a')));},'filename':function(_0x214e51,_0x4ac3b1,_0x272df9){_0x272df9(null,util[_0x7124('0x1b')](_0x7124('0x1c'),_0x7124('0x1d'),path[_0x7124('0x1e')](_0x4ac3b1[_0x7124('0x1f')])));}})});router[_0x7124('0x20')]('/:id/logo',upload['single'](_0x7124('0x21')),controller[_0x7124('0x22')]);var upload=multer({'storage':multer[_0x7124('0x19')]({'destination':function(_0x5e042e,_0x235ca2,_0x14327d){_0x14327d(null,path['join'](config['root'],_0x7124('0x1a')));},'filename':function(_0x3396f7,_0x6978a6,_0x38beaa){_0x38beaa(null,util[_0x7124('0x1b')](_0x7124('0x1c'),'logologin',path['extname'](_0x6978a6[_0x7124('0x1f')])));}})});router['post'](_0x7124('0x11'),upload['single']('file'),controller[_0x7124('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x169e20,_0x71a8f8,_0x5ebaa0){_0x5ebaa0(null,path['join'](config[_0x7124('0x24')],_0x7124('0x1a')));},'filename':function(_0x4ce2b8,_0x5566d9,_0x13c357){_0x13c357(null,util[_0x7124('0x1b')](_0x7124('0x1c'),_0x7124('0x25'),path[_0x7124('0x1e')](_0x5566d9[_0x7124('0x1f')])));}})});router[_0x7124('0x20')]('/:id/preferred',upload['single'](_0x7124('0x21')),controller[_0x7124('0x26')]);var upload=multer({'storage':multer[_0x7124('0x19')]({'destination':function(_0x1ed532,_0x467eea,_0x219029){_0x219029(null,path[_0x7124('0x27')](config['root'],_0x7124('0x1a')));},'filename':function(_0x39563e,_0x414d36,_0x20a6d7){_0x20a6d7(null,util[_0x7124('0x1b')](_0x7124('0x1c'),'favicon',path[_0x7124('0x1e')](_0x414d36[_0x7124('0x1f')])));}})});router['post'](_0x7124('0x17'),upload[_0x7124('0x28')](_0x7124('0x21')),controller['addFavicon']);router['put'](_0x7124('0xe'),auth['isAuthenticated'](),controller[_0x7124('0x29')]);module[_0x7124('0x2a')]=router; \ No newline at end of file +var _0x321e=['addFavicon','put','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','addLogo','file','addLogoLogin','preferred','addPreferred','favicon','post','/:id/favicon'];(function(_0x1ebc88,_0x638cd6){var _0xcef294=function(_0x5104bb){while(--_0x5104bb){_0x1ebc88['push'](_0x1ebc88['shift']());}};_0xcef294(++_0x638cd6);}(_0x321e,0x14a));var _0xe321=function(_0x552076,_0x44f166){_0x552076=_0x552076-0x0;var _0x2fc4be=_0x321e[_0x552076];return _0x2fc4be;};'use strict';var multer=require(_0xe321('0x0'));var util=require(_0xe321('0x1'));var path=require(_0xe321('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe321('0x3')]();var fs_extra=require(_0xe321('0x4'));var auth=require(_0xe321('0x5'));var interaction=require(_0xe321('0x6'));var config=require(_0xe321('0x7'));var controller=require(_0xe321('0x8'));router[_0xe321('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe321('0x9')]('/now',controller[_0xe321('0xa')]);router['get'](_0xe321('0xb'),controller['show']);router[_0xe321('0x9')](_0xe321('0xc'),controller[_0xe321('0xd')]);router[_0xe321('0x9')](_0xe321('0xe'),controller[_0xe321('0xf')]);router[_0xe321('0x9')](_0xe321('0x10'),controller[_0xe321('0x11')]);router['get'](_0xe321('0x12'),controller[_0xe321('0x13')]);router[_0xe321('0x9')]('/:id/favicon',controller[_0xe321('0x14')]);var upload=multer({'storage':multer[_0xe321('0x15')]({'destination':function(_0x39a0e0,_0x2453c5,_0x53550a){_0x53550a(null,path[_0xe321('0x16')](config[_0xe321('0x17')],_0xe321('0x18')));},'filename':function(_0x474011,_0x5cd53c,_0x21d877){_0x21d877(null,util[_0xe321('0x19')](_0xe321('0x1a'),_0xe321('0x1b'),path[_0xe321('0x1c')](_0x5cd53c[_0xe321('0x1d')])));}})});router['post'](_0xe321('0xc'),upload[_0xe321('0x1e')]('file'),controller[_0xe321('0x1f')]);var upload=multer({'storage':multer[_0xe321('0x15')]({'destination':function(_0x15b0e7,_0x2dde03,_0x9edcda){_0x9edcda(null,path[_0xe321('0x16')](config[_0xe321('0x17')],_0xe321('0x18')));},'filename':function(_0x1bf231,_0x24626c,_0x5e620c){_0x5e620c(null,util[_0xe321('0x19')]('%s%s','logologin',path[_0xe321('0x1c')](_0x24626c['originalname'])));}})});router['post'](_0xe321('0xe'),upload[_0xe321('0x1e')](_0xe321('0x20')),controller[_0xe321('0x21')]);var upload=multer({'storage':multer[_0xe321('0x15')]({'destination':function(_0x3d5745,_0x43a73c,_0x38e38d){_0x38e38d(null,path['join'](config[_0xe321('0x17')],_0xe321('0x18')));},'filename':function(_0x3f0549,_0x19110e,_0x3e10c3){_0x3e10c3(null,util[_0xe321('0x19')]('%s%s',_0xe321('0x22'),path[_0xe321('0x1c')](_0x19110e[_0xe321('0x1d')])));}})});router['post'](_0xe321('0x12'),upload[_0xe321('0x1e')](_0xe321('0x20')),controller[_0xe321('0x23')]);var upload=multer({'storage':multer[_0xe321('0x15')]({'destination':function(_0xb89bb6,_0x36042f,_0x1ad286){_0x1ad286(null,path[_0xe321('0x16')](config['root'],_0xe321('0x18')));},'filename':function(_0x28f5d0,_0x2d4741,_0x1d5c47){_0x1d5c47(null,util[_0xe321('0x19')](_0xe321('0x1a'),_0xe321('0x24'),path[_0xe321('0x1c')](_0x2d4741[_0xe321('0x1d')])));}})});router[_0xe321('0x25')](_0xe321('0x26'),upload[_0xe321('0x1e')](_0xe321('0x20')),controller[_0xe321('0x27')]);router[_0xe321('0x28')]('/:id',auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f33c5f7..ab6891c 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x2bd40e,_0x27a313){var _0x492c82=function(_0x592235){while(--_0x592235){_0x2bd40e['push'](_0x2bd40e['shift']());}};_0x492c82(++_0x27a313);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x2fd662,_0x614bad){var _0x528cdf=function(_0x301e71){while(--_0x301e71){_0x2fd662['push'](_0x2fd662['shift']());}};_0x528cdf(++_0x614bad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6183f38..772f653 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 _0xdc0d=['../../config/license/util','../../mysqldb','client','http','request','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','end','name','send','index','Setting','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','update','body','find','file','filename','logo','loginLogo','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','getLicense','default','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2033c6,_0x27015c){var _0x508b4c=function(_0x48445a){while(--_0x48445a){_0x2033c6['push'](_0x2033c6['shift']());}};_0x508b4c(++_0x27015c);}(_0xdc0d,0x1db));var _0xddc0=function(_0x199e57,_0x9396b0){_0x199e57=_0x199e57-0x0;var _0x31ce5f=_0xdc0d[_0x199e57];return _0x31ce5f;};'use strict';var emlformat=require(_0xddc0('0x0'));var rimraf=require(_0xddc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddc0('0x2'));var rp=require('request-promise');var moment=require(_0xddc0('0x3'));var BPromise=require(_0xddc0('0x4'));var Mustache=require(_0xddc0('0x5'));var util=require(_0xddc0('0x6'));var path=require(_0xddc0('0x7'));var sox=require(_0xddc0('0x8'));var csv=require(_0xddc0('0x9'));var ejs=require(_0xddc0('0xa'));var fs=require('fs');var fs_extra=require(_0xddc0('0xb'));var _=require('lodash');var squel=require(_0xddc0('0xc'));var crypto=require(_0xddc0('0xd'));var jsforce=require(_0xddc0('0xe'));var deskjs=require(_0xddc0('0xf'));var toCsv=require(_0xddc0('0x9'));var querystring=require(_0xddc0('0x10'));var Papa=require('papaparse');var Redis=require(_0xddc0('0x11'));var authService=require(_0xddc0('0x12'));var qs=require(_0xddc0('0x13'));var as=require(_0xddc0('0x14'));var hardwareService=require(_0xddc0('0x15'));var logger=require(_0xddc0('0x16'))(_0xddc0('0x17'));var utils=require(_0xddc0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xddc0('0x19'));var db=require(_0xddc0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xddc0('0x1b')][_0xddc0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xde1081,_0x39d44c,_0x2faa0d,_0x53fb88){return new BPromise(function(_0xd08dd7,_0x28d771){var _0x523089=_0x53fb88||client;return _0x523089[_0xddc0('0x1d')](_0xde1081,_0x2faa0d)['then'](function(_0x387bb7){logger[_0xddc0('0x1e')](_0xddc0('0x1f'),_0x39d44c,'request\x20sent');logger['debug'](_0xddc0('0x20'),_0x39d44c,_0xddc0('0x21'),JSON[_0xddc0('0x22')](_0x387bb7));if(_0x387bb7[_0xddc0('0x23')]){if(_0x387bb7['error'][_0xddc0('0x24')]===0x1f4){logger[_0xddc0('0x23')](_0xddc0('0x1f'),_0x39d44c,_0x387bb7[_0xddc0('0x23')]['message']);return _0x28d771(_0x387bb7[_0xddc0('0x23')][_0xddc0('0x25')]);}logger[_0xddc0('0x23')]('Setting,\x20%s,\x20%s',_0x39d44c,_0x387bb7[_0xddc0('0x23')]['message']);return _0xd08dd7(_0x387bb7[_0xddc0('0x23')][_0xddc0('0x25')]);}else{logger['info'](_0xddc0('0x1f'),_0x39d44c,_0xddc0('0x21'));_0xd08dd7(_0x387bb7[_0xddc0('0x26')]['message']);}})[_0xddc0('0x27')](function(_0x4d8582){logger[_0xddc0('0x23')]('Setting,\x20%s,\x20%s',_0x39d44c,_0x4d8582);_0x28d771(_0x4d8582);});});}function respondWithStatusCode(_0x1f08f4,_0x4ce667){_0x4ce667=_0x4ce667||0xcc;return function(_0x22d48e){if(_0x22d48e){return _0x1f08f4[_0xddc0('0x28')](_0x4ce667);}return _0x1f08f4[_0xddc0('0x29')](_0x4ce667)['end']();};}function respondWithResult(_0x202964,_0x1211f0){_0x1211f0=_0x1211f0||0xc8;return function(_0x196dd2){if(_0x196dd2){return _0x202964['status'](_0x1211f0)[_0xddc0('0x2a')](_0x196dd2);}};}function respondWithFilteredResult(_0x3b9762,_0x41342e){return function(_0x344a0a){if(_0x344a0a){var _0x129dae=typeof _0x41342e['offset']===_0xddc0('0x2b')&&typeof _0x41342e['limit']==='undefined';var _0x5a8429=_0x344a0a[_0xddc0('0x2c')];var _0x41cef6=_0x129dae?0x0:_0x41342e[_0xddc0('0x2d')];var _0x3ab930=_0x129dae?_0x344a0a[_0xddc0('0x2c')]:_0x41342e[_0xddc0('0x2d')]+_0x41342e[_0xddc0('0x2e')];var _0x3ddda7;if(_0x3ab930>=_0x5a8429){_0x3ab930=_0x5a8429;_0x3ddda7=0xc8;}else{_0x3ddda7=0xce;}_0x3b9762[_0xddc0('0x29')](_0x3ddda7);return _0x3b9762[_0xddc0('0x2f')](_0xddc0('0x30'),_0x41cef6+'-'+_0x3ab930+'/'+_0x5a8429)[_0xddc0('0x2a')](_0x344a0a);}return null;};}function patchUpdates(_0x487055){return function(_0x1e3be8){try{jsonpatch[_0xddc0('0x31')](_0x1e3be8,_0x487055,!![]);}catch(_0x2eb265){return BPromise[_0xddc0('0x32')](_0x2eb265);}return _0x1e3be8[_0xddc0('0x33')]();};}function saveUpdates(_0x459390,_0x3e1eb9){return function(_0x101778){if(_0x101778){return _0x101778['update'](_0x459390)[_0xddc0('0x34')](function(_0x2ab5b0){return _0x2ab5b0;});}return null;};}function removeEntity(_0x3c37a6,_0x401278){return function(_0x162512){if(_0x162512){return _0x162512['destroy']()['then'](function(){_0x3c37a6[_0xddc0('0x29')](0xcc)[_0xddc0('0x35')]();});}};}function handleEntityNotFound(_0x56e1cb,_0xe784e){return function(_0x614f06){if(!_0x614f06){_0x56e1cb['sendStatus'](0x194);}return _0x614f06;};}function handleError(_0x5b983e,_0x4326a6){_0x4326a6=_0x4326a6||0x1f4;return function(_0x134dc8){logger[_0xddc0('0x23')](_0x134dc8['stack']);if(_0x134dc8['name']){delete _0x134dc8[_0xddc0('0x36')];}_0x5b983e[_0xddc0('0x29')](_0x4326a6)[_0xddc0('0x37')](_0x134dc8);};}exports[_0xddc0('0x38')]=function(_0x1dcadc,_0x4e10ab){var _0x44c237={},_0x5d6dfa={},_0x349542={'count':0x0,'rows':[]};var _0x593d35=_['map'](db[_0xddc0('0x39')][_0xddc0('0x3a')],function(_0x1161c7){return{'name':_0x1161c7[_0xddc0('0x3b')],'type':_0x1161c7[_0xddc0('0x3c')][_0xddc0('0x3d')]};});_0x5d6dfa['model']=_['map'](_0x593d35,_0xddc0('0x36'));_0x5d6dfa[_0xddc0('0x3e')]=_[_0xddc0('0x3f')](_0x1dcadc['query']);_0x5d6dfa['filters']=_['intersection'](_0x5d6dfa[_0xddc0('0x40')],_0x5d6dfa['query']);_0x44c237[_0xddc0('0x41')]=_[_0xddc0('0x42')](_0x5d6dfa[_0xddc0('0x40')],qs['fields'](_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x43')]));_0x44c237[_0xddc0('0x41')]=_0x44c237[_0xddc0('0x41')][_0xddc0('0x44')]?_0x44c237['attributes']:_0x5d6dfa[_0xddc0('0x40')];if(!_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x45')](_0xddc0('0x46'))){_0x44c237['limit']=qs['limit'](_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x2e')]);_0x44c237[_0xddc0('0x2d')]=qs[_0xddc0('0x2d')](_0x1dcadc[_0xddc0('0x3e')]['offset']);}_0x44c237[_0xddc0('0x47')]=qs[_0xddc0('0x48')](_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x48')]);_0x44c237[_0xddc0('0x49')]=qs['filters'](_[_0xddc0('0x4a')](_0x1dcadc['query'],_0x5d6dfa[_0xddc0('0x4b')]),_0x593d35);if(_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x4c')]){_0x44c237[_0xddc0('0x49')]=_[_0xddc0('0x4d')](_0x44c237['where'],{'$or':_[_0xddc0('0x4e')](_0x593d35,function(_0x1d3122){if(_0x1d3122['type']!==_0xddc0('0x4f')){var _0xbd5833={};_0xbd5833[_0x1d3122[_0xddc0('0x36')]]={'$like':'%'+_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x4c')]+'%'};return _0xbd5833;}})});}_0x44c237=_['merge']({},_0x44c237,_0x1dcadc[_0xddc0('0x50')]);var _0x5cd760={'where':_0x44c237[_0xddc0('0x49')]};return db['Setting'][_0xddc0('0x2c')](_0x5cd760)[_0xddc0('0x34')](function(_0x477e10){_0x349542['count']=_0x477e10;if(_0x1dcadc[_0xddc0('0x3e')][_0xddc0('0x51')]){_0x44c237[_0xddc0('0x52')]=[{'all':!![]}];}return db['Setting'][_0xddc0('0x53')](_0x44c237);})[_0xddc0('0x34')](function(_0x17cd54){_0x349542[_0xddc0('0x54')]=_0x17cd54;return _0x349542;})[_0xddc0('0x34')](respondWithFilteredResult(_0x4e10ab,_0x44c237))[_0xddc0('0x27')](handleError(_0x4e10ab,null));};exports[_0xddc0('0x55')]=function(_0x356eeb,_0x584122){var _0x41e2ca={'raw':![],'where':{'id':_0x356eeb[_0xddc0('0x56')]['id']}},_0x2072b9={};_0x2072b9[_0xddc0('0x40')]=_[_0xddc0('0x3f')](db[_0xddc0('0x39')][_0xddc0('0x3a')]);_0x2072b9[_0xddc0('0x3e')]=_[_0xddc0('0x3f')](_0x356eeb[_0xddc0('0x3e')]);_0x2072b9[_0xddc0('0x4b')]=_['intersection'](_0x2072b9[_0xddc0('0x40')],_0x2072b9[_0xddc0('0x3e')]);_0x41e2ca[_0xddc0('0x41')]=_[_0xddc0('0x42')](_0x2072b9['model'],qs[_0xddc0('0x43')](_0x356eeb[_0xddc0('0x3e')][_0xddc0('0x43')]));_0x41e2ca['attributes']=_0x41e2ca[_0xddc0('0x41')][_0xddc0('0x44')]?_0x41e2ca['attributes']:_0x2072b9[_0xddc0('0x40')];if(_0x356eeb[_0xddc0('0x3e')][_0xddc0('0x51')]){_0x41e2ca[_0xddc0('0x52')]=[{'all':!![]}];}_0x41e2ca=_[_0xddc0('0x4d')]({},_0x41e2ca,_0x356eeb[_0xddc0('0x50')]);return db[_0xddc0('0x39')]['find'](_0x41e2ca)[_0xddc0('0x34')](handleEntityNotFound(_0x584122,null))['then'](respondWithResult(_0x584122,null))['catch'](handleError(_0x584122,null));};exports[_0xddc0('0x57')]=function(_0x52a267,_0x9ad54c){if(_0x52a267[_0xddc0('0x58')]['id']){delete _0x52a267[_0xddc0('0x58')]['id'];}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x52a267[_0xddc0('0x56')]['id']}})[_0xddc0('0x34')](handleEntityNotFound(_0x9ad54c,null))[_0xddc0('0x34')](saveUpdates(_0x52a267[_0xddc0('0x58')],null))[_0xddc0('0x34')](respondWithResult(_0x9ad54c,null))[_0xddc0('0x27')](handleError(_0x9ad54c,null));};exports['addLogo']=function(_0x168aec,_0x509cd0,_0x552bb2){if(_0x168aec[_0xddc0('0x5a')]&&_0x168aec['file'][_0xddc0('0x5b')]){_0x168aec['body'][_0xddc0('0x5c')]=_0x168aec['file']['filename'];}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x168aec['params']['id']}})[_0xddc0('0x34')](handleEntityNotFound(_0x509cd0,null))[_0xddc0('0x34')](saveUpdates(_0x168aec[_0xddc0('0x58')],null))[_0xddc0('0x34')](respondWithResult(_0x509cd0,null))['catch'](handleError(_0x509cd0,null));};exports['addLogoLogin']=function(_0x59160f,_0x2647fa,_0xf2fa30){if(_0x59160f[_0xddc0('0x5a')]&&_0x59160f['file']['filename']){_0x59160f['body'][_0xddc0('0x5d')]=_0x59160f[_0xddc0('0x5a')][_0xddc0('0x5b')];}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x59160f[_0xddc0('0x56')]['id']}})[_0xddc0('0x34')](handleEntityNotFound(_0x2647fa,null))[_0xddc0('0x34')](saveUpdates(_0x59160f['body'],null))[_0xddc0('0x34')](respondWithResult(_0x2647fa,null))['catch'](handleError(_0x2647fa,null));};var utilLicense=require(_0xddc0('0x19'));exports['getLogo']=function(_0xda8a6f,_0x5cad0a,_0x56f6c9){var _0x52e089='server/files/images/logos';var _0x2585a6={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x304c9b){if(_0x304c9b){_0x2585a6=_0x304c9b;}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0xda8a6f[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),_0xddc0('0x5f'),_0xddc0('0x60'),'defaultLoginLogo','defaultPreferred',_0xddc0('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x5cad0a,null))[_0xddc0('0x34')](function(_0x47d4ec){if(_0x47d4ec){var _0x5dd5e2=_0x47d4ec[_0xddc0('0x5c')]&&fs[_0xddc0('0x62')](path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_[_0xddc0('0x65')](_0x47d4ec['logo'])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_['toLower'](_0x47d4ec[_0xddc0('0x5c')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_[_0xddc0('0x65')](_0xddc0('0x66')));var _0x5b9034='default'+_['upperFirst'](_0xddc0('0x5c'));if(_0x47d4ec[_0x5b9034]||!_0x2585a6['custom']){_0x5dd5e2=path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x52e089,_['toLower'](_0xddc0('0x66')));}if(!fs['existsSync'](_0x5dd5e2)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_[_0xddc0('0x69')](_0xddc0('0x5c'))+_0xddc0('0x6a'));}return _0x5cad0a[_0xddc0('0x6b')](_0x5dd5e2);}})[_0xddc0('0x27')](handleError(_0x5cad0a,null));};var utilLicense=require(_0xddc0('0x19'));exports[_0xddc0('0x6c')]=function(_0x535bc4,_0x7a3981,_0x362c36){var _0x5ee385='server/files/images/logos';var _0xb00109={'custom':![]};return utilLicense['getLicense']()[_0xddc0('0x34')](function(_0x3a3f6e){if(_0x3a3f6e){_0xb00109=_0x3a3f6e;}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x535bc4[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),_0xddc0('0x5f'),_0xddc0('0x60'),_0xddc0('0x6d'),_0xddc0('0x6e'),_0xddc0('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x7a3981,null))['then'](function(_0xb520d){if(_0xb520d){var _0x36383f=_0xb520d[_0xddc0('0x5d')]&&fs['existsSync'](path[_0xddc0('0x63')](config['root'],_0x5ee385,_[_0xddc0('0x65')](_0xb520d['loginLogo'])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x5ee385,_[_0xddc0('0x65')](_0xb520d[_0xddc0('0x5d')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x5ee385,_['toLower'](_0xddc0('0x6f')));var _0x375303='default'+_['upperFirst'](_0xddc0('0x5d'));if(_0xb520d[_0x375303]||!_0xb00109[_0xddc0('0x70')]){_0x36383f=path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x5ee385,_['toLower'](_0xddc0('0x6f')));}if(!fs[_0xddc0('0x62')](_0x36383f)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_[_0xddc0('0x69')](_0xddc0('0x5d'))+_0xddc0('0x6a'));}return _0x7a3981[_0xddc0('0x6b')](_0x36383f);}})[_0xddc0('0x27')](handleError(_0x7a3981,null));};exports[_0xddc0('0x71')]=function(_0x1c9850,_0x38d370){return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x1c9850[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x72')]})['then'](respondWithResult(_0x38d370,null))['catch'](handleError(_0x38d370,null));};exports[_0xddc0('0x73')]=function(_0x3af6b7,_0x74e9b0,_0x38a572){if(_0x3af6b7['file']&&_0x3af6b7[_0xddc0('0x5a')][_0xddc0('0x5b')]){_0x3af6b7['body']['preferred']=_0x3af6b7[_0xddc0('0x5a')]['filename'];}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x3af6b7[_0xddc0('0x56')]['id']}})['then'](handleEntityNotFound(_0x74e9b0,null))['then'](saveUpdates(_0x3af6b7[_0xddc0('0x58')],null))[_0xddc0('0x34')](respondWithResult(_0x74e9b0,null))[_0xddc0('0x27')](handleError(_0x74e9b0,null));};var utilLicense=require('../../config/license/util');exports[_0xddc0('0x74')]=function(_0x27dd93,_0x22c8fa,_0x1605f6){var _0x45dcdf='server/files/images/logos';var _0x23d17d={'custom':![]};return utilLicense[_0xddc0('0x75')]()[_0xddc0('0x34')](function(_0x597194){if(_0x597194){_0x23d17d=_0x597194;}return db[_0xddc0('0x39')][_0xddc0('0x59')]({'where':{'id':_0x27dd93[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),'favicon',_0xddc0('0x60'),_0xddc0('0x6d'),_0xddc0('0x6e'),_0xddc0('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x22c8fa,null))[_0xddc0('0x34')](function(_0x6fc0a2){if(_0x6fc0a2){var _0x6c3309=_0x6fc0a2[_0xddc0('0x5e')]&&fs[_0xddc0('0x62')](path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_['toLower'](_0x6fc0a2['preferred'])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_[_0xddc0('0x65')](_0x6fc0a2[_0xddc0('0x5e')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_['toLower']('default_preferred.png'));var _0x411088=_0xddc0('0x76')+_['upperFirst'](_0xddc0('0x5e'));if(_0x6fc0a2[_0x411088]||!_0x23d17d['custom']||!_0x23d17d[_0xddc0('0x5e')]){_0x6c3309=path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x45dcdf,_[_0xddc0('0x65')](_0xddc0('0x77')));}if(!fs[_0xddc0('0x62')](_0x6c3309)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_['upperFirst'](_0xddc0('0x5e'))+'\x20not\x20found');}return _0x22c8fa['download'](_0x6c3309);}})[_0xddc0('0x27')](handleError(_0x22c8fa,null));};exports[_0xddc0('0x78')]=function(_0x10cf19,_0x1a68af,_0x2356f2){if(_0x10cf19[_0xddc0('0x5a')]&&_0x10cf19[_0xddc0('0x5a')][_0xddc0('0x5b')]){_0x10cf19[_0xddc0('0x58')][_0xddc0('0x5f')]=_0x10cf19[_0xddc0('0x5a')][_0xddc0('0x5b')];}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x10cf19['params']['id']}})['then'](handleEntityNotFound(_0x1a68af,null))[_0xddc0('0x34')](saveUpdates(_0x10cf19[_0xddc0('0x58')],null))['then'](respondWithResult(_0x1a68af,null))['catch'](handleError(_0x1a68af,null));};var utilLicense=require(_0xddc0('0x19'));exports['getFavicon']=function(_0x2aa946,_0x316b25,_0x145d1e){var _0x1a61ed='server/files/images/logos';var _0x23e1d1={'custom':![]};return utilLicense[_0xddc0('0x75')]()[_0xddc0('0x34')](function(_0x371426){if(_0x371426){_0x23e1d1=_0x371426;}return db['Setting'][_0xddc0('0x59')]({'where':{'id':_0x2aa946[_0xddc0('0x56')]['id']},'attributes':[_0xddc0('0x5c'),_0xddc0('0x5d'),_0xddc0('0x5e'),'favicon',_0xddc0('0x60'),_0xddc0('0x6d'),'defaultPreferred',_0xddc0('0x61')],'raw':!![]});})[_0xddc0('0x34')](handleEntityNotFound(_0x316b25,null))[_0xddc0('0x34')](function(_0xfc7870){if(_0xfc7870){var _0x4c8a87=_0xfc7870[_0xddc0('0x5f')]&&fs[_0xddc0('0x62')](path['join'](config['root'],_0x1a61ed,_['toLower'](_0xfc7870[_0xddc0('0x5f')])))?path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x1a61ed,_['toLower'](_0xfc7870[_0xddc0('0x5f')])):path[_0xddc0('0x63')](config[_0xddc0('0x64')],_0x1a61ed,_[_0xddc0('0x65')](_0xddc0('0x79')));var _0x304f7a='default'+_[_0xddc0('0x69')](_0xddc0('0x5f'));if(_0xfc7870[_0x304f7a]||!_0x23e1d1[_0xddc0('0x70')]){_0x4c8a87=path['join'](config['root'],_0x1a61ed,_[_0xddc0('0x65')]('default_favicon.ico'));}if(!fs[_0xddc0('0x62')](_0x4c8a87)){throw new db[(_0xddc0('0x67'))][(_0xddc0('0x68'))](_[_0xddc0('0x69')](_0xddc0('0x5f'))+'\x20not\x20found');}return _0x316b25['download'](_0x4c8a87);}})['catch'](handleError(_0x316b25,null));};exports[_0xddc0('0x7a')]=function(_0x1e0ac4,_0x25724d){var _0x250649={'offset':moment()['utcOffset']()};_0x250649['now']=moment()[_0xddc0('0x7b')](_0x250649[_0xddc0('0x2d')])['format'](_0xddc0('0x7c'));return _0x25724d['status'](0xc8)[_0xddc0('0x37')](_0x250649);}; \ No newline at end of file +var _0x96ea=['send','index','map','Setting','rawAttributes','type','model','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','fields','find','body','addLogo','filename','logo','addLogoLogin','file','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultFavicon','toLower','join','root','default_logo.svg','default','upperFirst','custom','existsSync','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','Sequelize','securePassword','addPreferred','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','sendStatus','name'];(function(_0x57d00d,_0x3bb282){var _0x2d2b37=function(_0x595b76){while(--_0x595b76){_0x57d00d['push'](_0x57d00d['shift']());}};_0x2d2b37(++_0x3bb282);}(_0x96ea,0xc3));var _0xa96e=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x96ea[_0x149ca0];return _0x56b6b9;};'use strict';var emlformat=require(_0xa96e('0x0'));var rimraf=require(_0xa96e('0x1'));var zipdir=require(_0xa96e('0x2'));var jsonpatch=require(_0xa96e('0x3'));var rp=require(_0xa96e('0x4'));var moment=require(_0xa96e('0x5'));var BPromise=require(_0xa96e('0x6'));var Mustache=require('mustache');var util=require(_0xa96e('0x7'));var path=require('path');var sox=require(_0xa96e('0x8'));var csv=require(_0xa96e('0x9'));var ejs=require(_0xa96e('0xa'));var fs=require('fs');var fs_extra=require(_0xa96e('0xb'));var _=require('lodash');var squel=require(_0xa96e('0xc'));var crypto=require(_0xa96e('0xd'));var jsforce=require(_0xa96e('0xe'));var deskjs=require(_0xa96e('0xf'));var toCsv=require(_0xa96e('0x9'));var querystring=require(_0xa96e('0x10'));var Papa=require(_0xa96e('0x11'));var Redis=require(_0xa96e('0x12'));var authService=require(_0xa96e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa96e('0x14'));var hardwareService=require(_0xa96e('0x15'));var logger=require(_0xa96e('0x16'))('api');var utils=require(_0xa96e('0x17'));var config=require(_0xa96e('0x18'));var licenseUtil=require(_0xa96e('0x19'));var db=require(_0xa96e('0x1a'))['db'];var jayson=require(_0xa96e('0x1b'));var client=jayson['client'][_0xa96e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11a77a,_0x381faf,_0x419629,_0x6ba9e5){return new BPromise(function(_0x32a856,_0x341acb){var _0x477695=_0x6ba9e5||client;return _0x477695['request'](_0x11a77a,_0x419629)[_0xa96e('0x1d')](function(_0x24c949){logger[_0xa96e('0x1e')](_0xa96e('0x1f'),_0x381faf,'request\x20sent');logger[_0xa96e('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x381faf,'request\x20sent',JSON[_0xa96e('0x21')](_0x24c949));if(_0x24c949[_0xa96e('0x22')]){if(_0x24c949[_0xa96e('0x22')][_0xa96e('0x23')]===0x1f4){logger[_0xa96e('0x22')](_0xa96e('0x1f'),_0x381faf,_0x24c949[_0xa96e('0x22')][_0xa96e('0x24')]);return _0x341acb(_0x24c949[_0xa96e('0x22')]['message']);}logger[_0xa96e('0x22')](_0xa96e('0x1f'),_0x381faf,_0x24c949[_0xa96e('0x22')][_0xa96e('0x24')]);return _0x32a856(_0x24c949[_0xa96e('0x22')][_0xa96e('0x24')]);}else{logger[_0xa96e('0x1e')](_0xa96e('0x1f'),_0x381faf,_0xa96e('0x25'));_0x32a856(_0x24c949[_0xa96e('0x26')]['message']);}})[_0xa96e('0x27')](function(_0x2c7556){logger[_0xa96e('0x22')](_0xa96e('0x1f'),_0x381faf,_0x2c7556);_0x341acb(_0x2c7556);});});}function respondWithStatusCode(_0x51a610,_0x3c526a){_0x3c526a=_0x3c526a||0xcc;return function(_0x2c6035){if(_0x2c6035){return _0x51a610['sendStatus'](_0x3c526a);}return _0x51a610[_0xa96e('0x28')](_0x3c526a)[_0xa96e('0x29')]();};}function respondWithResult(_0x372549,_0x35e1a1){_0x35e1a1=_0x35e1a1||0xc8;return function(_0x3c2c80){if(_0x3c2c80){return _0x372549[_0xa96e('0x28')](_0x35e1a1)['json'](_0x3c2c80);}};}function respondWithFilteredResult(_0x3c6deb,_0x519ed1){return function(_0x108ef4){if(_0x108ef4){var _0x1fa972=typeof _0x519ed1['offset']===_0xa96e('0x2a')&&typeof _0x519ed1[_0xa96e('0x2b')]==='undefined';var _0x9b3cb3=_0x108ef4[_0xa96e('0x2c')];var _0x249e83=_0x1fa972?0x0:_0x519ed1[_0xa96e('0x2d')];var _0x26c5f5=_0x1fa972?_0x108ef4['count']:_0x519ed1[_0xa96e('0x2d')]+_0x519ed1[_0xa96e('0x2b')];var _0x3d1646;if(_0x26c5f5>=_0x9b3cb3){_0x26c5f5=_0x9b3cb3;_0x3d1646=0xc8;}else{_0x3d1646=0xce;}_0x3c6deb['status'](_0x3d1646);return _0x3c6deb[_0xa96e('0x2e')](_0xa96e('0x2f'),_0x249e83+'-'+_0x26c5f5+'/'+_0x9b3cb3)[_0xa96e('0x30')](_0x108ef4);}return null;};}function patchUpdates(_0x4a1b49){return function(_0x4b867b){try{jsonpatch[_0xa96e('0x31')](_0x4b867b,_0x4a1b49,!![]);}catch(_0x1c815d){return BPromise[_0xa96e('0x32')](_0x1c815d);}return _0x4b867b['save']();};}function saveUpdates(_0x13b020,_0x170f8b){return function(_0x5087d0){if(_0x5087d0){return _0x5087d0[_0xa96e('0x33')](_0x13b020)[_0xa96e('0x1d')](function(_0xfcac44){return _0xfcac44;});}return null;};}function removeEntity(_0xa4b884,_0x493f4d){return function(_0x384d06){if(_0x384d06){return _0x384d06[_0xa96e('0x34')]()[_0xa96e('0x1d')](function(){_0xa4b884[_0xa96e('0x28')](0xcc)[_0xa96e('0x29')]();});}};}function handleEntityNotFound(_0x285e98,_0x5a2c56){return function(_0x32a939){if(!_0x32a939){_0x285e98[_0xa96e('0x35')](0x194);}return _0x32a939;};}function handleError(_0x434ba7,_0x18e323){_0x18e323=_0x18e323||0x1f4;return function(_0x7f9825){logger[_0xa96e('0x22')](_0x7f9825['stack']);if(_0x7f9825[_0xa96e('0x36')]){delete _0x7f9825[_0xa96e('0x36')];}_0x434ba7[_0xa96e('0x28')](_0x18e323)[_0xa96e('0x37')](_0x7f9825);};}exports[_0xa96e('0x38')]=function(_0x43f86d,_0x22f36){var _0x48253a={},_0x308a96={},_0x4f70a8={'count':0x0,'rows':[]};var _0x5847ed=_[_0xa96e('0x39')](db[_0xa96e('0x3a')][_0xa96e('0x3b')],function(_0x1ee907){return{'name':_0x1ee907['fieldName'],'type':_0x1ee907[_0xa96e('0x3c')]['key']};});_0x308a96[_0xa96e('0x3d')]=_['map'](_0x5847ed,_0xa96e('0x36'));_0x308a96['query']=_['keys'](_0x43f86d['query']);_0x308a96['filters']=_[_0xa96e('0x3e')](_0x308a96[_0xa96e('0x3d')],_0x308a96[_0xa96e('0x3f')]);_0x48253a[_0xa96e('0x40')]=_['intersection'](_0x308a96['model'],qs['fields'](_0x43f86d['query']['fields']));_0x48253a[_0xa96e('0x40')]=_0x48253a[_0xa96e('0x40')][_0xa96e('0x41')]?_0x48253a['attributes']:_0x308a96[_0xa96e('0x3d')];if(!_0x43f86d[_0xa96e('0x3f')][_0xa96e('0x42')](_0xa96e('0x43'))){_0x48253a[_0xa96e('0x2b')]=qs[_0xa96e('0x2b')](_0x43f86d[_0xa96e('0x3f')][_0xa96e('0x2b')]);_0x48253a[_0xa96e('0x2d')]=qs[_0xa96e('0x2d')](_0x43f86d['query']['offset']);}_0x48253a[_0xa96e('0x44')]=qs[_0xa96e('0x45')](_0x43f86d[_0xa96e('0x3f')][_0xa96e('0x45')]);_0x48253a[_0xa96e('0x46')]=qs[_0xa96e('0x47')](_[_0xa96e('0x48')](_0x43f86d[_0xa96e('0x3f')],_0x308a96[_0xa96e('0x47')]),_0x5847ed);if(_0x43f86d[_0xa96e('0x3f')][_0xa96e('0x49')]){_0x48253a[_0xa96e('0x46')]=_[_0xa96e('0x4a')](_0x48253a[_0xa96e('0x46')],{'$or':_['map'](_0x5847ed,function(_0x5bc63f){if(_0x5bc63f[_0xa96e('0x3c')]!==_0xa96e('0x4b')){var _0x5bdf78={};_0x5bdf78[_0x5bc63f[_0xa96e('0x36')]]={'$like':'%'+_0x43f86d[_0xa96e('0x3f')]['filter']+'%'};return _0x5bdf78;}})});}_0x48253a=_[_0xa96e('0x4a')]({},_0x48253a,_0x43f86d[_0xa96e('0x4c')]);var _0x3d8e08={'where':_0x48253a[_0xa96e('0x46')]};return db[_0xa96e('0x3a')][_0xa96e('0x2c')](_0x3d8e08)[_0xa96e('0x1d')](function(_0xd625f7){_0x4f70a8['count']=_0xd625f7;if(_0x43f86d[_0xa96e('0x3f')][_0xa96e('0x4d')]){_0x48253a[_0xa96e('0x4e')]=[{'all':!![]}];}return db[_0xa96e('0x3a')][_0xa96e('0x4f')](_0x48253a);})[_0xa96e('0x1d')](function(_0xae9d73){_0x4f70a8[_0xa96e('0x50')]=_0xae9d73;return _0x4f70a8;})['then'](respondWithFilteredResult(_0x22f36,_0x48253a))['catch'](handleError(_0x22f36,null));};exports['show']=function(_0x53d2ed,_0x5ef198){var _0x3faae9={'raw':![],'where':{'id':_0x53d2ed[_0xa96e('0x51')]['id']}},_0x3ee721={};_0x3ee721[_0xa96e('0x3d')]=_[_0xa96e('0x52')](db[_0xa96e('0x3a')]['rawAttributes']);_0x3ee721[_0xa96e('0x3f')]=_[_0xa96e('0x52')](_0x53d2ed[_0xa96e('0x3f')]);_0x3ee721[_0xa96e('0x47')]=_[_0xa96e('0x3e')](_0x3ee721[_0xa96e('0x3d')],_0x3ee721[_0xa96e('0x3f')]);_0x3faae9[_0xa96e('0x40')]=_[_0xa96e('0x3e')](_0x3ee721[_0xa96e('0x3d')],qs[_0xa96e('0x53')](_0x53d2ed[_0xa96e('0x3f')][_0xa96e('0x53')]));_0x3faae9[_0xa96e('0x40')]=_0x3faae9[_0xa96e('0x40')][_0xa96e('0x41')]?_0x3faae9[_0xa96e('0x40')]:_0x3ee721[_0xa96e('0x3d')];if(_0x53d2ed[_0xa96e('0x3f')][_0xa96e('0x4d')]){_0x3faae9[_0xa96e('0x4e')]=[{'all':!![]}];}_0x3faae9=_[_0xa96e('0x4a')]({},_0x3faae9,_0x53d2ed[_0xa96e('0x4c')]);return db['Setting'][_0xa96e('0x54')](_0x3faae9)[_0xa96e('0x1d')](handleEntityNotFound(_0x5ef198,null))[_0xa96e('0x1d')](respondWithResult(_0x5ef198,null))[_0xa96e('0x27')](handleError(_0x5ef198,null));};exports['update']=function(_0x1a478c,_0x16cf2a){if(_0x1a478c[_0xa96e('0x55')]['id']){delete _0x1a478c[_0xa96e('0x55')]['id'];}return db['Setting'][_0xa96e('0x54')]({'where':{'id':_0x1a478c[_0xa96e('0x51')]['id']}})[_0xa96e('0x1d')](handleEntityNotFound(_0x16cf2a,null))[_0xa96e('0x1d')](saveUpdates(_0x1a478c[_0xa96e('0x55')],null))[_0xa96e('0x1d')](respondWithResult(_0x16cf2a,null))['catch'](handleError(_0x16cf2a,null));};exports[_0xa96e('0x56')]=function(_0x1cd5c2,_0x1e3f98,_0x184ad0){if(_0x1cd5c2['file']&&_0x1cd5c2['file'][_0xa96e('0x57')]){_0x1cd5c2[_0xa96e('0x55')][_0xa96e('0x58')]=_0x1cd5c2['file'][_0xa96e('0x57')];}return db['Setting']['find']({'where':{'id':_0x1cd5c2[_0xa96e('0x51')]['id']}})[_0xa96e('0x1d')](handleEntityNotFound(_0x1e3f98,null))[_0xa96e('0x1d')](saveUpdates(_0x1cd5c2[_0xa96e('0x55')],null))[_0xa96e('0x1d')](respondWithResult(_0x1e3f98,null))[_0xa96e('0x27')](handleError(_0x1e3f98,null));};exports[_0xa96e('0x59')]=function(_0x153da1,_0x53c4c4,_0x1934a3){if(_0x153da1[_0xa96e('0x5a')]&&_0x153da1[_0xa96e('0x5a')]['filename']){_0x153da1[_0xa96e('0x55')][_0xa96e('0x5b')]=_0x153da1['file'][_0xa96e('0x57')];}return db[_0xa96e('0x3a')]['find']({'where':{'id':_0x153da1[_0xa96e('0x51')]['id']}})['then'](handleEntityNotFound(_0x53c4c4,null))['then'](saveUpdates(_0x153da1[_0xa96e('0x55')],null))[_0xa96e('0x1d')](respondWithResult(_0x53c4c4,null))[_0xa96e('0x27')](handleError(_0x53c4c4,null));};var utilLicense=require(_0xa96e('0x19'));exports[_0xa96e('0x5c')]=function(_0x1ad947,_0x463b31,_0x2d2190){var _0x168a0e=_0xa96e('0x5d');var _0x254a3d={'custom':![]};return utilLicense[_0xa96e('0x5e')]()[_0xa96e('0x1d')](function(_0x4e5bab){if(_0x4e5bab){_0x254a3d=_0x4e5bab;}return db['Setting']['find']({'where':{'id':_0x1ad947['params']['id']},'attributes':[_0xa96e('0x58'),_0xa96e('0x5b'),_0xa96e('0x5f'),'favicon',_0xa96e('0x60'),_0xa96e('0x61'),'defaultPreferred',_0xa96e('0x62')],'raw':!![]});})[_0xa96e('0x1d')](handleEntityNotFound(_0x463b31,null))[_0xa96e('0x1d')](function(_0x45596d){if(_0x45596d){var _0x3cda40=_0x45596d['logo']&&fs['existsSync'](path['join'](config['root'],_0x168a0e,_[_0xa96e('0x63')](_0x45596d[_0xa96e('0x58')])))?path[_0xa96e('0x64')](config['root'],_0x168a0e,_[_0xa96e('0x63')](_0x45596d[_0xa96e('0x58')])):path['join'](config[_0xa96e('0x65')],_0x168a0e,_[_0xa96e('0x63')](_0xa96e('0x66')));var _0x37beee=_0xa96e('0x67')+_[_0xa96e('0x68')](_0xa96e('0x58'));if(_0x45596d[_0x37beee]||!_0x254a3d[_0xa96e('0x69')]){_0x3cda40=path[_0xa96e('0x64')](config[_0xa96e('0x65')],_0x168a0e,_['toLower'](_0xa96e('0x66')));}if(!fs[_0xa96e('0x6a')](_0x3cda40)){throw new db['Sequelize'][(_0xa96e('0x6b'))](_[_0xa96e('0x68')](_0xa96e('0x58'))+_0xa96e('0x6c'));}return _0x463b31[_0xa96e('0x6d')](_0x3cda40);}})[_0xa96e('0x27')](handleError(_0x463b31,null));};var utilLicense=require(_0xa96e('0x19'));exports[_0xa96e('0x6e')]=function(_0x5c80de,_0x19983b,_0x141e15){var _0x538282=_0xa96e('0x5d');var _0x5a3fe7={'custom':![]};return utilLicense[_0xa96e('0x5e')]()[_0xa96e('0x1d')](function(_0x419c64){if(_0x419c64){_0x5a3fe7=_0x419c64;}return db[_0xa96e('0x3a')][_0xa96e('0x54')]({'where':{'id':_0x5c80de[_0xa96e('0x51')]['id']},'attributes':[_0xa96e('0x58'),_0xa96e('0x5b'),'preferred','favicon','defaultLogo','defaultLoginLogo',_0xa96e('0x6f'),_0xa96e('0x62')],'raw':!![]});})[_0xa96e('0x1d')](handleEntityNotFound(_0x19983b,null))[_0xa96e('0x1d')](function(_0x503c99){if(_0x503c99){var _0x1679f4=_0x503c99[_0xa96e('0x5b')]&&fs[_0xa96e('0x6a')](path[_0xa96e('0x64')](config[_0xa96e('0x65')],_0x538282,_[_0xa96e('0x63')](_0x503c99['loginLogo'])))?path['join'](config[_0xa96e('0x65')],_0x538282,_[_0xa96e('0x63')](_0x503c99[_0xa96e('0x5b')])):path[_0xa96e('0x64')](config['root'],_0x538282,_[_0xa96e('0x63')](_0xa96e('0x70')));var _0x1cc847=_0xa96e('0x67')+_['upperFirst']('loginLogo');if(_0x503c99[_0x1cc847]||!_0x5a3fe7[_0xa96e('0x69')]){_0x1679f4=path['join'](config[_0xa96e('0x65')],_0x538282,_[_0xa96e('0x63')](_0xa96e('0x70')));}if(!fs[_0xa96e('0x6a')](_0x1679f4)){throw new db[(_0xa96e('0x71'))]['ValidationError'](_[_0xa96e('0x68')]('loginLogo')+_0xa96e('0x6c'));}return _0x19983b[_0xa96e('0x6d')](_0x1679f4);}})['catch'](handleError(_0x19983b,null));};exports['gdpr']=function(_0x3148e2,_0x41a24d){return db[_0xa96e('0x3a')][_0xa96e('0x54')]({'where':{'id':_0x3148e2[_0xa96e('0x51')]['id']},'attributes':[_0xa96e('0x72')]})[_0xa96e('0x1d')](respondWithResult(_0x41a24d,null))[_0xa96e('0x27')](handleError(_0x41a24d,null));};exports[_0xa96e('0x73')]=function(_0x2fa278,_0xd22434,_0x36e717){if(_0x2fa278[_0xa96e('0x5a')]&&_0x2fa278[_0xa96e('0x5a')][_0xa96e('0x57')]){_0x2fa278['body'][_0xa96e('0x5f')]=_0x2fa278['file'][_0xa96e('0x57')];}return db[_0xa96e('0x3a')][_0xa96e('0x54')]({'where':{'id':_0x2fa278[_0xa96e('0x51')]['id']}})[_0xa96e('0x1d')](handleEntityNotFound(_0xd22434,null))[_0xa96e('0x1d')](saveUpdates(_0x2fa278[_0xa96e('0x55')],null))[_0xa96e('0x1d')](respondWithResult(_0xd22434,null))[_0xa96e('0x27')](handleError(_0xd22434,null));};var utilLicense=require('../../config/license/util');exports[_0xa96e('0x74')]=function(_0x1e327c,_0x393029,_0x53b904){var _0x2e9d8e=_0xa96e('0x5d');var _0x400f98={'custom':![]};return utilLicense[_0xa96e('0x5e')]()[_0xa96e('0x1d')](function(_0xfc6e46){if(_0xfc6e46){_0x400f98=_0xfc6e46;}return db[_0xa96e('0x3a')][_0xa96e('0x54')]({'where':{'id':_0x1e327c[_0xa96e('0x51')]['id']},'attributes':[_0xa96e('0x58'),_0xa96e('0x5b'),_0xa96e('0x5f'),_0xa96e('0x75'),_0xa96e('0x60'),'defaultLoginLogo',_0xa96e('0x6f'),_0xa96e('0x62')],'raw':!![]});})[_0xa96e('0x1d')](handleEntityNotFound(_0x393029,null))[_0xa96e('0x1d')](function(_0x3b5588){if(_0x3b5588){var _0x29c8b8=_0x3b5588[_0xa96e('0x5f')]&&fs[_0xa96e('0x6a')](path[_0xa96e('0x64')](config['root'],_0x2e9d8e,_[_0xa96e('0x63')](_0x3b5588[_0xa96e('0x5f')])))?path[_0xa96e('0x64')](config['root'],_0x2e9d8e,_['toLower'](_0x3b5588[_0xa96e('0x5f')])):path['join'](config[_0xa96e('0x65')],_0x2e9d8e,_[_0xa96e('0x63')](_0xa96e('0x76')));var _0x1ac5e4=_0xa96e('0x67')+_[_0xa96e('0x68')]('preferred');if(_0x3b5588[_0x1ac5e4]||!_0x400f98[_0xa96e('0x69')]||!_0x400f98[_0xa96e('0x5f')]){_0x29c8b8=path['join'](config['root'],_0x2e9d8e,_['toLower'](_0xa96e('0x76')));}if(!fs[_0xa96e('0x6a')](_0x29c8b8)){throw new db['Sequelize'][(_0xa96e('0x6b'))](_[_0xa96e('0x68')]('preferred')+_0xa96e('0x6c'));}return _0x393029['download'](_0x29c8b8);}})[_0xa96e('0x27')](handleError(_0x393029,null));};exports[_0xa96e('0x77')]=function(_0x2827e1,_0x5b9a42,_0x157f0a){if(_0x2827e1[_0xa96e('0x5a')]&&_0x2827e1['file'][_0xa96e('0x57')]){_0x2827e1['body'][_0xa96e('0x75')]=_0x2827e1[_0xa96e('0x5a')]['filename'];}return db[_0xa96e('0x3a')][_0xa96e('0x54')]({'where':{'id':_0x2827e1[_0xa96e('0x51')]['id']}})[_0xa96e('0x1d')](handleEntityNotFound(_0x5b9a42,null))['then'](saveUpdates(_0x2827e1[_0xa96e('0x55')],null))[_0xa96e('0x1d')](respondWithResult(_0x5b9a42,null))['catch'](handleError(_0x5b9a42,null));};var utilLicense=require(_0xa96e('0x19'));exports[_0xa96e('0x78')]=function(_0x193c34,_0x4ae87c,_0x259c3e){var _0x4a28c9=_0xa96e('0x5d');var _0x7be4d={'custom':![]};return utilLicense[_0xa96e('0x5e')]()[_0xa96e('0x1d')](function(_0x494b85){if(_0x494b85){_0x7be4d=_0x494b85;}return db['Setting'][_0xa96e('0x54')]({'where':{'id':_0x193c34['params']['id']},'attributes':[_0xa96e('0x58'),_0xa96e('0x5b'),'preferred',_0xa96e('0x75'),'defaultLogo',_0xa96e('0x61'),_0xa96e('0x6f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4ae87c,null))['then'](function(_0x4d1813){if(_0x4d1813){var _0x2d43df=_0x4d1813[_0xa96e('0x75')]&&fs[_0xa96e('0x6a')](path[_0xa96e('0x64')](config[_0xa96e('0x65')],_0x4a28c9,_['toLower'](_0x4d1813[_0xa96e('0x75')])))?path[_0xa96e('0x64')](config[_0xa96e('0x65')],_0x4a28c9,_[_0xa96e('0x63')](_0x4d1813[_0xa96e('0x75')])):path[_0xa96e('0x64')](config[_0xa96e('0x65')],_0x4a28c9,_[_0xa96e('0x63')](_0xa96e('0x79')));var _0x5b1293=_0xa96e('0x67')+_[_0xa96e('0x68')](_0xa96e('0x75'));if(_0x4d1813[_0x5b1293]||!_0x7be4d[_0xa96e('0x69')]){_0x2d43df=path[_0xa96e('0x64')](config[_0xa96e('0x65')],_0x4a28c9,_[_0xa96e('0x63')](_0xa96e('0x79')));}if(!fs[_0xa96e('0x6a')](_0x2d43df)){throw new db['Sequelize'][(_0xa96e('0x6b'))](_[_0xa96e('0x68')](_0xa96e('0x75'))+'\x20not\x20found');}return _0x4ae87c[_0xa96e('0x6d')](_0x2d43df);}})[_0xa96e('0x27')](handleError(_0x4ae87c,null));};exports['getDate']=function(_0x2061cf,_0x206246){var _0x54e18e={'offset':moment()[_0xa96e('0x7a')]()};_0x54e18e[_0xa96e('0x7b')]=moment()[_0xa96e('0x7a')](_0x54e18e[_0xa96e('0x2d')])[_0xa96e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x206246[_0xa96e('0x28')](0xc8)[_0xa96e('0x37')](_0x54e18e);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 96a46e5..130a3e3 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x4612df,_0x37a8f7){var _0x2804c6=function(_0x2b1979){while(--_0x2b1979){_0x4612df['push'](_0x4612df['shift']());}};_0x2804c6(++_0x37a8f7);}(_0x3e74,0x175));var _0x43e7=function(_0x28f4be,_0x2f36bb){_0x28f4be=_0x28f4be-0x0;var _0x409a2f=_0x3e74[_0x28f4be];return _0x409a2f;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 9b421da..b944df4 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 _0x88d8=['rpc','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x88d8,0xbd));var _0x888d=function(_0x2ee6d9,_0x196d2a){_0x2ee6d9=_0x2ee6d9-0x0;var _0x2745d7=_0x88d8[_0x2ee6d9];return _0x2745d7;};'use strict';var _=require(_0x888d('0x0'));var util=require(_0x888d('0x1'));var moment=require(_0x888d('0x2'));var BPromise=require(_0x888d('0x3'));var rs=require(_0x888d('0x4'));var fs=require('fs');var Redis=require(_0x888d('0x5'));var db=require(_0x888d('0x6'))['db'];var utils=require(_0x888d('0x7'));var logger=require(_0x888d('0x8'))(_0x888d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x888d('0xa')][_0x888d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3682e8,_0x20d3ff,_0x245d90){return new BPromise(function(_0x541b0d,_0x4d61d6){return client[_0x888d('0xc')](_0x3682e8,_0x245d90)[_0x888d('0xd')](function(_0x46474d){logger[_0x888d('0xe')](_0x888d('0xf'),_0x20d3ff,_0x888d('0x10'));logger[_0x888d('0x11')](_0x888d('0x12'),_0x20d3ff,_0x888d('0x10'),JSON[_0x888d('0x13')](_0x46474d));if(_0x46474d[_0x888d('0x14')]){if(_0x46474d[_0x888d('0x14')][_0x888d('0x15')]===0x1f4){logger['error'](_0x888d('0xf'),_0x20d3ff,_0x46474d['error'][_0x888d('0x16')]);return _0x4d61d6(_0x46474d[_0x888d('0x14')][_0x888d('0x16')]);}logger['error'](_0x888d('0xf'),_0x20d3ff,_0x46474d[_0x888d('0x14')][_0x888d('0x16')]);return _0x541b0d(_0x46474d[_0x888d('0x14')][_0x888d('0x16')]);}else{logger[_0x888d('0xe')](_0x888d('0xf'),_0x20d3ff,'request\x20sent');_0x541b0d(_0x46474d[_0x888d('0x17')][_0x888d('0x16')]);}})[_0x888d('0x18')](function(_0x4c8cd6){logger[_0x888d('0x14')](_0x888d('0xf'),_0x20d3ff,_0x4c8cd6);_0x4d61d6(_0x4c8cd6);});});}exports[_0x888d('0x19')]=function(_0x29a550){var _0x134165=this;return new Promise(function(_0x3ac0f9,_0x2f8839){return db[_0x888d('0x1a')][_0x888d('0x1b')]({'raw':_0x29a550[_0x888d('0x1c')]?_0x29a550[_0x888d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x29a550['options']?_0x29a550[_0x888d('0x1c')]['where']||null:null,'attributes':_0x29a550[_0x888d('0x1c')]?_0x29a550[_0x888d('0x1c')][_0x888d('0x1d')]||null:null,'include':_0x29a550['options']?_0x29a550['options'][_0x888d('0x1e')]?_['map'](_0x29a550[_0x888d('0x1c')][_0x888d('0x1e')],function(_0x4ebdee){return{'model':db[_0x4ebdee[_0x888d('0x1f')]],'as':_0x4ebdee['as'],'attributes':_0x4ebdee[_0x888d('0x1d')],'include':_0x4ebdee[_0x888d('0x1e')]?_[_0x888d('0x20')](_0x4ebdee[_0x888d('0x1e')],function(_0x32c7ca){return{'model':db[_0x32c7ca['model']],'as':_0x32c7ca['as'],'attributes':_0x32c7ca[_0x888d('0x1d')],'include':_0x32c7ca['include']?_['map'](_0x32c7ca[_0x888d('0x1e')],function(_0x3e4b58){return{'model':db[_0x3e4b58[_0x888d('0x1f')]],'as':_0x3e4b58['as'],'attributes':_0x3e4b58['attributes']};}):[]};}):[]};}):[]:[]})[_0x888d('0xd')](function(_0x481350){logger[_0x888d('0xe')]('ShowSetting',_0x29a550);logger['debug']('ShowSetting',_0x29a550,JSON['stringify'](_0x481350));_0x3ac0f9(_0x481350);})[_0x888d('0x18')](function(_0x2aa8aa){logger[_0x888d('0x14')](_0x888d('0x19'),_0x2aa8aa[_0x888d('0x16')],_0x29a550);_0x2f8839(_0x134165[_0x888d('0x14')](0x1f4,_0x2aa8aa[_0x888d('0x16')]));});});}; \ No newline at end of file +var _0x33bc=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s'];(function(_0x1eb58b,_0x51b660){var _0x57ea98=function(_0x40716a){while(--_0x40716a){_0x1eb58b['push'](_0x1eb58b['shift']());}};_0x57ea98(++_0x51b660);}(_0x33bc,0xcb));var _0xc33b=function(_0xc0212,_0x3172c9){_0xc0212=_0xc0212-0x0;var _0x8f9d79=_0x33bc[_0xc0212];return _0x8f9d79;};'use strict';var _=require('lodash');var util=require(_0xc33b('0x0'));var moment=require(_0xc33b('0x1'));var BPromise=require(_0xc33b('0x2'));var rs=require(_0xc33b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc33b('0x4'))['db'];var utils=require(_0xc33b('0x5'));var logger=require(_0xc33b('0x6'))('rpc');var config=require(_0xc33b('0x7'));var jayson=require(_0xc33b('0x8'));var client=jayson[_0xc33b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f5114,_0x569926,_0x5ed4ca){return new BPromise(function(_0x4ac0b2,_0x3d9a00){return client[_0xc33b('0xa')](_0x5f5114,_0x5ed4ca)[_0xc33b('0xb')](function(_0x4b98d4){logger[_0xc33b('0xc')](_0xc33b('0xd'),_0x569926,_0xc33b('0xe'));logger[_0xc33b('0xf')](_0xc33b('0x10'),_0x569926,_0xc33b('0xe'),JSON[_0xc33b('0x11')](_0x4b98d4));if(_0x4b98d4[_0xc33b('0x12')]){if(_0x4b98d4['error']['code']===0x1f4){logger[_0xc33b('0x12')](_0xc33b('0xd'),_0x569926,_0x4b98d4['error'][_0xc33b('0x13')]);return _0x3d9a00(_0x4b98d4['error'][_0xc33b('0x13')]);}logger[_0xc33b('0x12')](_0xc33b('0xd'),_0x569926,_0x4b98d4[_0xc33b('0x12')][_0xc33b('0x13')]);return _0x4ac0b2(_0x4b98d4[_0xc33b('0x12')][_0xc33b('0x13')]);}else{logger['info'](_0xc33b('0xd'),_0x569926,_0xc33b('0xe'));_0x4ac0b2(_0x4b98d4[_0xc33b('0x14')]['message']);}})[_0xc33b('0x15')](function(_0x3e15ec){logger[_0xc33b('0x12')]('Setting,\x20%s,\x20%s',_0x569926,_0x3e15ec);_0x3d9a00(_0x3e15ec);});});}exports[_0xc33b('0x16')]=function(_0x8d8821){var _0x30918a=this;return new Promise(function(_0x581ec7,_0x327caf){return db['Setting'][_0xc33b('0x17')]({'raw':_0x8d8821[_0xc33b('0x18')]?_0x8d8821[_0xc33b('0x18')][_0xc33b('0x19')]===undefined?!![]:![]:!![],'where':_0x8d8821['options']?_0x8d8821[_0xc33b('0x18')][_0xc33b('0x1a')]||null:null,'attributes':_0x8d8821['options']?_0x8d8821[_0xc33b('0x18')][_0xc33b('0x1b')]||null:null,'include':_0x8d8821[_0xc33b('0x18')]?_0x8d8821[_0xc33b('0x18')][_0xc33b('0x1c')]?_['map'](_0x8d8821[_0xc33b('0x18')][_0xc33b('0x1c')],function(_0x30ec38){return{'model':db[_0x30ec38['model']],'as':_0x30ec38['as'],'attributes':_0x30ec38[_0xc33b('0x1b')],'include':_0x30ec38[_0xc33b('0x1c')]?_['map'](_0x30ec38[_0xc33b('0x1c')],function(_0x4649ca){return{'model':db[_0x4649ca['model']],'as':_0x4649ca['as'],'attributes':_0x4649ca[_0xc33b('0x1b')],'include':_0x4649ca[_0xc33b('0x1c')]?_[_0xc33b('0x1d')](_0x4649ca[_0xc33b('0x1c')],function(_0xdf1bb9){return{'model':db[_0xdf1bb9[_0xc33b('0x1e')]],'as':_0xdf1bb9['as'],'attributes':_0xdf1bb9['attributes']};}):[]};}):[]};}):[]:[]})[_0xc33b('0xb')](function(_0x259017){logger[_0xc33b('0xc')](_0xc33b('0x16'),_0x8d8821);logger[_0xc33b('0xf')](_0xc33b('0x16'),_0x8d8821,JSON['stringify'](_0x259017));_0x581ec7(_0x259017);})[_0xc33b('0x15')](function(_0x2ddf73){logger[_0xc33b('0x12')](_0xc33b('0x16'),_0x2ddf73[_0xc33b('0x13')],_0x8d8821);_0x327caf(_0x30918a[_0xc33b('0x12')](0x1f4,_0x2ddf73[_0xc33b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 670dfa7..6005156 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(_0x9a3c82,_0x39b592){var _0x52a746=function(_0x493ed5){while(--_0x493ed5){_0x9a3c82['push'](_0x9a3c82['shift']());}};_0x52a746(++_0x39b592);}(_0x7a54,0x106));var _0x47a5=function(_0x5f9710,_0x5def89){_0x5f9710=_0x5f9710-0x0;var _0x159593=_0x7a54[_0x5f9710];return _0x159593;};'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(_0x18c3d5,_0x52234e){var _0x887e0c=function(_0x760eae){while(--_0x760eae){_0x18c3d5['push'](_0x18c3d5['shift']());}};_0x887e0c(++_0x52234e);}(_0x7a54,0x106));var _0x47a5=function(_0xf2db94,_0x15e796){_0xf2db94=_0xf2db94-0x0;var _0x3049e8=_0x7a54[_0xf2db94];return _0x3049e8;};'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 66130e9..98d6552 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 _0x34b5=['BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc'];(function(_0x218984,_0x38651e){var _0x3498ee=function(_0x266da5){while(--_0x266da5){_0x218984['push'](_0x218984['shift']());}};_0x3498ee(++_0x38651e);}(_0x34b5,0x1d5));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x534b('0x0'));var rs=require(_0x534b('0x1'));module[_0x534b('0x2')]={'name':{'type':Sequelize[_0x534b('0x3')],'unique':_0x534b('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x534b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x534b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x534b('0x3')],'defaultValue':function(){return rs[_0x534b('0x5')]();}},'phone':{'type':Sequelize[_0x534b('0x3')]},'type':{'type':Sequelize[_0x534b('0x6')](_0x534b('0x7'),_0x534b('0x8'),_0x534b('0x9'),_0x534b('0xa'),_0x534b('0xb'),_0x534b('0xc'),_0x534b('0xd'),_0x534b('0xe'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x534b('0x3')]},'authToken':{'type':Sequelize[_0x534b('0x3')]},'smsMethod':{'type':Sequelize[_0x534b('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x534b('0x3')]},'apiKey':{'type':Sequelize[_0x534b('0x3')]},'applicationId':{'type':Sequelize[_0x534b('0x3')]},'accountId':{'type':Sequelize[_0x534b('0x3')]},'senderString':{'type':Sequelize[_0x534b('0x3')]},'deliveryReport':{'type':Sequelize[_0x534b('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x534b('0x10');}},'notificationSound':{'type':Sequelize[_0x534b('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x534b('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x534b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x534b('0x11')],'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[_0x534b('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x534b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x534b('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x534b('0x11')],'comment':_0x534b('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x534b('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5cdd84){if(!_0x5cdd84)this[_0x534b('0x13')](_0x534b('0x14'),null);this[_0x534b('0x13')](_0x534b('0x15'),_0x5cdd84);}}}; \ No newline at end of file +var _0x34f8=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x54fda4,_0x5aed81){var _0x377b49=function(_0x15214e){while(--_0x15214e){_0x54fda4['push'](_0x54fda4['shift']());}};_0x377b49(++_0x5aed81);}(_0x34f8,0x15b));var _0x834f=function(_0x4f16ed,_0xabc55a){_0x4f16ed=_0x4f16ed-0x0;var _0x561717=_0x34f8[_0x4f16ed];return _0x561717;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x834f('0x0'));module[_0x834f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x834f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x834f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x834f('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x834f('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x834f('0x5')](_0x834f('0x6'),_0x834f('0x7'),_0x834f('0x8'),_0x834f('0x9'),_0x834f('0xa'),_0x834f('0xb'),_0x834f('0xc'),'csc','infobip',_0x834f('0xd'))},'accountSid':{'type':Sequelize[_0x834f('0x3')]},'authId':{'type':Sequelize[_0x834f('0x3')]},'authToken':{'type':Sequelize[_0x834f('0x3')]},'smsMethod':{'type':Sequelize[_0x834f('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x834f('0x3')]},'password':{'type':Sequelize[_0x834f('0x3')]},'apiKey':{'type':Sequelize[_0x834f('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x834f('0x3')]},'senderString':{'type':Sequelize[_0x834f('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x834f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x834f('0xe')],'defaultValue':function(){return _0x834f('0xf');}},'notificationSound':{'type':Sequelize[_0x834f('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x834f('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x834f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x834f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x834f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x834f('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x834f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x834f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x834f('0x11')],'comment':_0x834f('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x834f('0x10')],'defaultValue':![],'comment':_0x834f('0x13'),'set':function(_0x26cb3b){if(!_0x26cb3b)this[_0x834f('0x14')](_0x834f('0x15'),null);this[_0x834f('0x14')](_0x834f('0x16'),_0x26cb3b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 99afb12..c04bec5 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 _0xc922=['options','SmsAccount','findAll','show','params','length','includeAll','find','create','body','user','role','SmsAccounts','userProfileId','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','CmList','List','DESC','SmsMessage','Messages','dataValues','push','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0xc922,0x96));var _0x2c92=function(_0x6028a9,_0x2811bf){_0x6028a9=_0x6028a9-0x0;var _0x2af623=_0xc922[_0x6028a9];return _0x2af623;};'use strict';var emlformat=require(_0x2c92('0x0'));var rimraf=require(_0x2c92('0x1'));var zipdir=require(_0x2c92('0x2'));var jsonpatch=require(_0x2c92('0x3'));var rp=require(_0x2c92('0x4'));var moment=require(_0x2c92('0x5'));var BPromise=require(_0x2c92('0x6'));var Mustache=require(_0x2c92('0x7'));var util=require(_0x2c92('0x8'));var path=require(_0x2c92('0x9'));var sox=require(_0x2c92('0xa'));var csv=require(_0x2c92('0xb'));var ejs=require(_0x2c92('0xc'));var fs=require('fs');var fs_extra=require(_0x2c92('0xd'));var _=require(_0x2c92('0xe'));var squel=require(_0x2c92('0xf'));var crypto=require(_0x2c92('0x10'));var jsforce=require(_0x2c92('0x11'));var deskjs=require(_0x2c92('0x12'));var toCsv=require(_0x2c92('0xb'));var querystring=require('querystring');var Papa=require(_0x2c92('0x13'));var Redis=require(_0x2c92('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2c92('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c92('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c92('0x17'));var db=require(_0x2c92('0x18'))['db'];config[_0x2c92('0x19')]=_['defaults'](config[_0x2c92('0x19')],{'host':_0x2c92('0x1a'),'port':0x18eb});var socket=require(_0x2c92('0x1b'))(new Redis(config[_0x2c92('0x19')]));require(_0x2c92('0x1c'))[_0x2c92('0x1d')](socket);var jayson=require(_0x2c92('0x1e'));var client=jayson[_0x2c92('0x1f')][_0x2c92('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x49df78,_0x4a70ad,_0x5abb43,_0x1f7ffd){return new BPromise(function(_0x4fe88b,_0x458db8){var _0x2a7811=_0x1f7ffd||client;return _0x2a7811[_0x2c92('0x21')](_0x49df78,_0x5abb43)[_0x2c92('0x22')](function(_0x158aef){logger[_0x2c92('0x23')](_0x2c92('0x24'),_0x4a70ad,_0x2c92('0x25'));logger[_0x2c92('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4a70ad,_0x2c92('0x25'),JSON[_0x2c92('0x27')](_0x158aef));if(_0x158aef[_0x2c92('0x28')]){if(_0x158aef[_0x2c92('0x28')][_0x2c92('0x29')]===0x1f4){logger[_0x2c92('0x28')](_0x2c92('0x24'),_0x4a70ad,_0x158aef[_0x2c92('0x28')][_0x2c92('0x2a')]);return _0x458db8(_0x158aef[_0x2c92('0x28')][_0x2c92('0x2a')]);}logger[_0x2c92('0x28')]('SmsAccount,\x20%s,\x20%s',_0x4a70ad,_0x158aef[_0x2c92('0x28')][_0x2c92('0x2a')]);return _0x4fe88b(_0x158aef[_0x2c92('0x28')]['message']);}else{logger[_0x2c92('0x23')](_0x2c92('0x24'),_0x4a70ad,_0x2c92('0x25'));_0x4fe88b(_0x158aef[_0x2c92('0x2b')][_0x2c92('0x2a')]);}})[_0x2c92('0x2c')](function(_0x6e8000){logger[_0x2c92('0x28')](_0x2c92('0x24'),_0x4a70ad,_0x6e8000);_0x458db8(_0x6e8000);});});}function respondWithStatusCode(_0x48b007,_0x363f15){_0x363f15=_0x363f15||0xcc;return function(_0x2fb525){if(_0x2fb525){return _0x48b007[_0x2c92('0x2d')](_0x363f15);}return _0x48b007['status'](_0x363f15)['end']();};}function respondWithResult(_0x66f9ff,_0xfd2861){_0xfd2861=_0xfd2861||0xc8;return function(_0x2ff620){if(_0x2ff620){return _0x66f9ff[_0x2c92('0x2e')](_0xfd2861)[_0x2c92('0x2f')](_0x2ff620);}};}function respondWithFilteredResult(_0x40a54c,_0x2307f1){return function(_0x37a47e){if(_0x37a47e){var _0x19080f=typeof _0x2307f1[_0x2c92('0x30')]===_0x2c92('0x31')&&typeof _0x2307f1[_0x2c92('0x32')]===_0x2c92('0x31');var _0x2a8729=_0x37a47e[_0x2c92('0x33')];var _0x4f8bd9=_0x19080f?0x0:_0x2307f1[_0x2c92('0x30')];var _0x3173bc=_0x19080f?_0x37a47e[_0x2c92('0x33')]:_0x2307f1['offset']+_0x2307f1[_0x2c92('0x32')];var _0x5738ce;if(_0x3173bc>=_0x2a8729){_0x3173bc=_0x2a8729;_0x5738ce=0xc8;}else{_0x5738ce=0xce;}_0x40a54c[_0x2c92('0x2e')](_0x5738ce);return _0x40a54c['set'](_0x2c92('0x34'),_0x4f8bd9+'-'+_0x3173bc+'/'+_0x2a8729)[_0x2c92('0x2f')](_0x37a47e);}return null;};}function patchUpdates(_0x2df983){return function(_0x17ef8c){try{jsonpatch[_0x2c92('0x35')](_0x17ef8c,_0x2df983,!![]);}catch(_0x1c3b9c){return BPromise[_0x2c92('0x36')](_0x1c3b9c);}return _0x17ef8c[_0x2c92('0x37')]();};}function saveUpdates(_0xd6055c,_0x46efa0){return function(_0x2c1f49){if(_0x2c1f49){return _0x2c1f49[_0x2c92('0x38')](_0xd6055c)[_0x2c92('0x22')](function(_0x1b353e){return _0x1b353e;});}return null;};}function removeEntity(_0x286eef,_0x9cc052){return function(_0x1cc9f3){if(_0x1cc9f3){return _0x1cc9f3[_0x2c92('0x39')]()[_0x2c92('0x22')](function(){var _0xde7fa3=_0x1cc9f3[_0x2c92('0x3a')]({'plain':!![]});var _0x861be6='SmsAccounts';return db[_0x2c92('0x3b')]['destroy']({'where':{'type':_0x861be6,'resourceId':_0xde7fa3['id']}})[_0x2c92('0x22')](function(){return _0x1cc9f3;});})[_0x2c92('0x22')](function(){_0x286eef[_0x2c92('0x2e')](0xcc)[_0x2c92('0x3c')]();});}};}function handleEntityNotFound(_0x267094,_0x1f3c1d){return function(_0x19298b){if(!_0x19298b){_0x267094[_0x2c92('0x2d')](0x194);}return _0x19298b;};}function handleError(_0x21ca32,_0x312794){_0x312794=_0x312794||0x1f4;return function(_0x2fe2af){logger[_0x2c92('0x28')](_0x2fe2af[_0x2c92('0x3d')]);if(_0x2fe2af[_0x2c92('0x3e')]){delete _0x2fe2af[_0x2c92('0x3e')];}_0x21ca32[_0x2c92('0x2e')](_0x312794)[_0x2c92('0x3f')](_0x2fe2af);};}exports[_0x2c92('0x40')]=function(_0xe33311,_0x322cc8){var _0x4432f8={'include':[{'model':db[_0x2c92('0x41')],'as':_0x2c92('0x42')}]},_0x581800={},_0x22cdce={'count':0x0,'rows':[]};var _0xda04ad=_[_0x2c92('0x43')](db['SmsAccount'][_0x2c92('0x44')],function(_0x2fb977){return{'name':_0x2fb977[_0x2c92('0x45')],'type':_0x2fb977[_0x2c92('0x46')][_0x2c92('0x47')]};});_0x581800[_0x2c92('0x48')]=_['map'](_0xda04ad,_0x2c92('0x3e'));_0x581800[_0x2c92('0x49')]=_[_0x2c92('0x4a')](_0xe33311['query']);_0x581800[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x581800['model'],_0x581800[_0x2c92('0x49')]);_0x4432f8[_0x2c92('0x4d')]=_[_0x2c92('0x4c')](_0x581800[_0x2c92('0x48')],qs['fields'](_0xe33311[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x4432f8['attributes']=_0x4432f8['attributes']['length']?_0x4432f8[_0x2c92('0x4d')]:_0x581800[_0x2c92('0x48')];if(!_0xe33311[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x4432f8['limit']=qs[_0x2c92('0x32')](_0xe33311[_0x2c92('0x49')][_0x2c92('0x32')]);_0x4432f8[_0x2c92('0x30')]=qs[_0x2c92('0x30')](_0xe33311[_0x2c92('0x49')][_0x2c92('0x30')]);}_0x4432f8['order']=qs[_0x2c92('0x51')](_0xe33311['query']['sort']);_0x4432f8[_0x2c92('0x52')]=qs['filters'](_[_0x2c92('0x53')](_0xe33311[_0x2c92('0x49')],_0x581800['filters']),_0xda04ad);if(_0xe33311[_0x2c92('0x49')]['filter']){_0x4432f8[_0x2c92('0x52')]=_[_0x2c92('0x54')](_0x4432f8[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0xda04ad,function(_0x18c4c5){if(_0x18c4c5['type']!==_0x2c92('0x55')){var _0xda9f07={};_0xda9f07[_0x18c4c5[_0x2c92('0x3e')]]={'$like':'%'+_0xe33311[_0x2c92('0x49')]['filter']+'%'};return _0xda9f07;}})});}_0x4432f8=_['merge']({},_0x4432f8,_0xe33311[_0x2c92('0x56')]);var _0x56346a={'where':_0x4432f8[_0x2c92('0x52')]};return db[_0x2c92('0x57')][_0x2c92('0x33')](_0x56346a)[_0x2c92('0x22')](function(_0x467144){_0x22cdce['count']=_0x467144;if(_0xe33311[_0x2c92('0x49')]['includeAll']){_0x4432f8['include']=[{'all':!![]}];}return db[_0x2c92('0x57')][_0x2c92('0x58')](_0x4432f8);})[_0x2c92('0x22')](function(_0xe5b7dd){_0x22cdce['rows']=_0xe5b7dd;return _0x22cdce;})['then'](respondWithFilteredResult(_0x322cc8,_0x4432f8))[_0x2c92('0x2c')](handleError(_0x322cc8,null));};exports[_0x2c92('0x59')]=function(_0x419c39,_0x12418c){var _0x10caba={'raw':![],'where':{'id':_0x419c39[_0x2c92('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x2c92('0x42')}]},_0x50f58e={};_0x50f58e[_0x2c92('0x48')]=_['keys'](db[_0x2c92('0x57')][_0x2c92('0x44')]);_0x50f58e[_0x2c92('0x49')]=_[_0x2c92('0x4a')](_0x419c39[_0x2c92('0x49')]);_0x50f58e['filters']=_[_0x2c92('0x4c')](_0x50f58e[_0x2c92('0x48')],_0x50f58e[_0x2c92('0x49')]);_0x10caba[_0x2c92('0x4d')]=_['intersection'](_0x50f58e['model'],qs[_0x2c92('0x4e')](_0x419c39['query'][_0x2c92('0x4e')]));_0x10caba[_0x2c92('0x4d')]=_0x10caba[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x10caba['attributes']:_0x50f58e[_0x2c92('0x48')];if(_0x419c39['query'][_0x2c92('0x5c')]){_0x10caba['include']=[{'all':!![]}];}_0x10caba=_['merge']({},_0x10caba,_0x419c39['options']);return db[_0x2c92('0x57')][_0x2c92('0x5d')](_0x10caba)[_0x2c92('0x22')](handleEntityNotFound(_0x12418c,null))[_0x2c92('0x22')](respondWithResult(_0x12418c,null))['catch'](handleError(_0x12418c,null));};exports[_0x2c92('0x5e')]=function(_0x2163e7,_0x255266){return db[_0x2c92('0x57')][_0x2c92('0x5e')](_0x2163e7[_0x2c92('0x5f')],{})[_0x2c92('0x22')](function(_0x519ce8){var _0x5eff0f=_0x2163e7[_0x2c92('0x60')][_0x2c92('0x3a')]({'plain':!![]});if(!_0x5eff0f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eff0f[_0x2c92('0x61')]===_0x2c92('0x60')){var _0x5ee7ef=_0x519ce8[_0x2c92('0x3a')]({'plain':!![]});var _0x26094c=_0x2c92('0x62');return db['UserProfileSection'][_0x2c92('0x5d')]({'where':{'name':_0x26094c,'userProfileId':_0x5eff0f[_0x2c92('0x63')]},'raw':!![]})['then'](function(_0x3105a0){if(_0x3105a0&&_0x3105a0['autoAssociation']===0x0){return db[_0x2c92('0x3b')][_0x2c92('0x5e')]({'name':_0x5ee7ef['name'],'resourceId':_0x5ee7ef['id'],'type':_0x3105a0[_0x2c92('0x3e')],'sectionId':_0x3105a0['id']},{})[_0x2c92('0x22')](function(){return _0x519ce8;});}else{return _0x519ce8;}})[_0x2c92('0x2c')](function(_0x1c2774){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2774);throw _0x1c2774;});}return _0x519ce8;})[_0x2c92('0x22')](respondWithResult(_0x255266,0xc9))[_0x2c92('0x2c')](handleError(_0x255266,null));};exports['update']=function(_0x3fbbdd,_0x40d8d6){if(_0x3fbbdd[_0x2c92('0x5f')]['id']){delete _0x3fbbdd['body']['id'];}return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x3fbbdd['params']['id']},'include':[{'model':db[_0x2c92('0x41')],'as':_0x2c92('0x42')}]})['then'](handleEntityNotFound(_0x40d8d6,null))[_0x2c92('0x22')](saveUpdates(_0x3fbbdd[_0x2c92('0x5f')],null))[_0x2c92('0x22')](respondWithResult(_0x40d8d6,null))['catch'](handleError(_0x40d8d6,null));};exports['destroy']=function(_0x464cdf,_0x2cb35a){return db['SmsAccount'][_0x2c92('0x5d')]({'where':{'id':_0x464cdf[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x2cb35a,null))[_0x2c92('0x22')](removeEntity(_0x2cb35a,null))['catch'](handleError(_0x2cb35a,null));};exports[_0x2c92('0x64')]=function(_0x7adf3c,_0x3f2ef9){return db[_0x2c92('0x57')][_0x2c92('0x64')]()['then'](respondWithResult(_0x3f2ef9,null))[_0x2c92('0x2c')](handleError(_0x3f2ef9,null));};exports[_0x2c92('0x65')]=function(_0x213317,_0x258236,_0x4a0408){if(_0x213317['body']['id']){delete _0x213317['body']['id'];}return db['SmsAccount'][_0x2c92('0x5d')]({'where':{'id':_0x213317[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x258236,null))[_0x2c92('0x22')](function(_0x828981){if(_0x828981){_0x213317[_0x2c92('0x5f')][_0x2c92('0x66')]=_0x828981['id'];return db[_0x2c92('0x67')]['create'](_0x213317[_0x2c92('0x5f')]);}})[_0x2c92('0x22')](respondWithResult(_0x258236,null))['catch'](handleError(_0x258236,null));};exports[_0x2c92('0x68')]=function(_0x21bda5,_0x1d28b1,_0x3ccfa4){var _0x29b77f={'raw':![],'where':{}};var _0x54efcf={};var _0x23eec3={'count':0x0,'rows':[]};return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0x21bda5[_0x2c92('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1d28b1,null))[_0x2c92('0x22')](function(_0xe06008){if(_0xe06008){_0x54efcf[_0x2c92('0x48')]=_['keys'](db[_0x2c92('0x67')]['rawAttributes']);_0x54efcf[_0x2c92('0x49')]=_[_0x2c92('0x4a')](_0x21bda5[_0x2c92('0x49')]);_0x54efcf[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x54efcf[_0x2c92('0x48')],_0x54efcf[_0x2c92('0x49')]);_0x29b77f['attributes']=_[_0x2c92('0x4c')](_0x54efcf[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x21bda5['query'][_0x2c92('0x4e')]));_0x29b77f['attributes']=_0x29b77f[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x29b77f[_0x2c92('0x4d')]:_0x54efcf['model'];if(!_0x21bda5['query'][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x29b77f[_0x2c92('0x32')]=qs['limit'](_0x21bda5[_0x2c92('0x49')][_0x2c92('0x32')]);_0x29b77f['offset']=qs[_0x2c92('0x30')](_0x21bda5[_0x2c92('0x49')]['offset']);}_0x29b77f[_0x2c92('0x6a')]=qs['sort'](_0x21bda5[_0x2c92('0x49')]['sort']);_0x29b77f[_0x2c92('0x52')]=qs[_0x2c92('0x4b')](_['pick'](_0x21bda5[_0x2c92('0x49')],_0x54efcf[_0x2c92('0x4b')]));_0x29b77f[_0x2c92('0x52')][_0x2c92('0x66')]=_0xe06008['id'];if(_0x21bda5[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x29b77f[_0x2c92('0x52')]=_[_0x2c92('0x54')](_0x29b77f[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x29b77f[_0x2c92('0x4d')],function(_0x5467b1){var _0x233830={};_0x233830[_0x5467b1]={'$like':'%'+_0x21bda5[_0x2c92('0x49')][_0x2c92('0x6b')]+'%'};return _0x233830;})});}_0x29b77f=_['merge']({},_0x29b77f,_0x21bda5['options']);return db[_0x2c92('0x67')][_0x2c92('0x33')]({'where':_0x29b77f[_0x2c92('0x52')]})[_0x2c92('0x22')](function(_0x5aa313){_0x23eec3[_0x2c92('0x33')]=_0x5aa313;if(_0x21bda5[_0x2c92('0x49')][_0x2c92('0x5c')]){_0x29b77f['include']=[{'all':!![]}];}return db['Disposition'][_0x2c92('0x58')](_0x29b77f);})[_0x2c92('0x22')](function(_0x4f000a){_0x23eec3[_0x2c92('0x6c')]=_0x4f000a;return _0x23eec3;});}})[_0x2c92('0x22')](respondWithFilteredResult(_0x1d28b1,_0x29b77f))[_0x2c92('0x2c')](handleError(_0x1d28b1,null));};exports[_0x2c92('0x6d')]=function(_0x332f05,_0x1aef29,_0x239eff){return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x332f05['params']['id']}})['then'](handleEntityNotFound(_0x1aef29,null))['then'](function(_0x2ecbc8){if(_0x2ecbc8){return _0x2ecbc8[_0x2c92('0x6d')](_0x332f05[_0x2c92('0x49')][_0x2c92('0x6e')]);}})[_0x2c92('0x22')](respondWithStatusCode(_0x1aef29,null))['catch'](handleError(_0x1aef29,null));};exports[_0x2c92('0x6f')]=function(_0x15fae5,_0x5aa094,_0x1d3b2c){if(_0x15fae5[_0x2c92('0x5f')]['id']){delete _0x15fae5[_0x2c92('0x5f')]['id'];}return db[_0x2c92('0x57')]['find']({'where':{'id':_0x15fae5[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x5aa094,null))[_0x2c92('0x22')](function(_0x1300ca){if(_0x1300ca){_0x15fae5['body']['SmsAccountId']=_0x1300ca['id'];return db[_0x2c92('0x70')][_0x2c92('0x5e')](_0x15fae5[_0x2c92('0x5f')]);}})['then'](respondWithResult(_0x5aa094,null))[_0x2c92('0x2c')](handleError(_0x5aa094,null));};exports[_0x2c92('0x71')]=function(_0xe6b7c,_0x9dae94,_0x66bb1d){var _0x4b3189={'raw':![],'where':{}};var _0x562664={};var _0x5afe34={'count':0x0,'rows':[]};return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0xe6b7c[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x9dae94,null))['then'](function(_0x2a69d8){if(_0x2a69d8){_0x562664[_0x2c92('0x48')]=_[_0x2c92('0x4a')](db[_0x2c92('0x70')][_0x2c92('0x44')]);_0x562664[_0x2c92('0x49')]=_['keys'](_0xe6b7c[_0x2c92('0x49')]);_0x562664[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x562664[_0x2c92('0x48')],_0x562664[_0x2c92('0x49')]);_0x4b3189[_0x2c92('0x4d')]=_[_0x2c92('0x4c')](_0x562664[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x4b3189[_0x2c92('0x4d')]=_0x4b3189[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x4b3189[_0x2c92('0x4d')]:_0x562664['model'];if(!_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x4b3189[_0x2c92('0x32')]=qs['limit'](_0xe6b7c[_0x2c92('0x49')]['limit']);_0x4b3189['offset']=qs[_0x2c92('0x30')](_0xe6b7c[_0x2c92('0x49')]['offset']);}_0x4b3189[_0x2c92('0x6a')]=qs['sort'](_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x51')]);_0x4b3189['where']=qs[_0x2c92('0x4b')](_['pick'](_0xe6b7c[_0x2c92('0x49')],_0x562664[_0x2c92('0x4b')]));_0x4b3189['where']['SmsAccountId']=_0x2a69d8['id'];if(_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x4b3189[_0x2c92('0x52')]=_[_0x2c92('0x54')](_0x4b3189[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x4b3189[_0x2c92('0x4d')],function(_0x35fcf4){var _0x4d75b4={};_0x4d75b4[_0x35fcf4]={'$like':'%'+_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x6b')]+'%'};return _0x4d75b4;})});}_0x4b3189=_[_0x2c92('0x54')]({},_0x4b3189,_0xe6b7c[_0x2c92('0x56')]);return db[_0x2c92('0x70')][_0x2c92('0x33')]({'where':_0x4b3189['where']})[_0x2c92('0x22')](function(_0x511999){_0x5afe34[_0x2c92('0x33')]=_0x511999;if(_0xe6b7c[_0x2c92('0x49')][_0x2c92('0x5c')]){_0x4b3189['include']=[{'all':!![]}];}return db[_0x2c92('0x70')]['findAll'](_0x4b3189);})[_0x2c92('0x22')](function(_0x36b0bb){_0x5afe34[_0x2c92('0x6c')]=_0x36b0bb;return _0x5afe34;});}})[_0x2c92('0x22')](respondWithFilteredResult(_0x9dae94,_0x4b3189))[_0x2c92('0x2c')](handleError(_0x9dae94,null));};exports['removeAnswers']=function(_0x5578d2,_0x279c72,_0x279d43){return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x5578d2[_0x2c92('0x5a')]['id']}})['then'](handleEntityNotFound(_0x279c72,null))[_0x2c92('0x22')](function(_0x521305){if(_0x521305){return _0x521305[_0x2c92('0x72')](_0x5578d2[_0x2c92('0x49')][_0x2c92('0x6e')]);}})[_0x2c92('0x22')](respondWithStatusCode(_0x279c72,null))[_0x2c92('0x2c')](handleError(_0x279c72,null));};exports[_0x2c92('0x73')]=function(_0x4052cd,_0x2d32b0,_0x1dbcbe){var _0x558ee2={'channel':_0x2c92('0x74')};var _0x287b63=[];var _0x256bdf=[];var _0x290ca4={};return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x4052cd['params']['id']},'include':[{'model':db[_0x2c92('0x75')],'as':_0x2c92('0x76')}]})[_0x2c92('0x22')](handleEntityNotFound(_0x2d32b0,null))[_0x2c92('0x22')](function(_0x3551b1){_0x558ee2[_0x2c92('0x77')]=_0x3551b1;_0x558ee2[_0x2c92('0x78')]=_[_0x2c92('0x79')](_0x3551b1[_0x2c92('0x76')],[_0x2c92('0x7a')],[_0x2c92('0x7b')]);if(_0x558ee2[_0x2c92('0x77')][_0x2c92('0x76')]){delete _0x558ee2[_0x2c92('0x77')]['Applications'];}return db[_0x2c92('0x7c')][_0x2c92('0x64')]();})[_0x2c92('0x22')](function(_0x5c71c2){if(!_0x5c71c2){throw new db[(_0x2c92('0x7d'))]['ValidationError'](_0x2c92('0x7e'));}_0x287b63=_[_0x2c92('0x7f')](_[_0x2c92('0x4a')](_0x5c71c2),[_0x2c92('0x80'),_0x2c92('0x81')]);_0x256bdf=_[_0x2c92('0x7f')](_[_0x2c92('0x4a')](_0x5c71c2),[_0x2c92('0x80'),_0x2c92('0x81'),_0x2c92('0x82'),'ListId']);_0x558ee2[_0x2c92('0x5f')]={'mapKey':'mobile'};if(_0x558ee2[_0x2c92('0x77')][_0x2c92('0x46')]){switch(_0x558ee2['account']['type']){case _0x2c92('0x83'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd['body'][_0x2c92('0x85')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd['body']['Body'];_0x558ee2['body'][_0x2c92('0x86')]=_0x4052cd[_0x2c92('0x5f')]['MessageSid'];break;case _0x2c92('0x87'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]='+'+_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x88')];_0x558ee2[_0x2c92('0x5f')]['body']=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x89')];break;case _0x2c92('0x8a'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')]['body']=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x2a')];break;case _0x2c92('0x8b'):_0x558ee2['body']['from']=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd['body'][_0x2c92('0x5f')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd['body'][_0x2c92('0x8c')];break;case _0x2c92('0x8d'):_0x558ee2['body'][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x85')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x8e')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd['body'][_0x2c92('0x8f')];break;case'infobip':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]='+'+_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x90')][0x0][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x90')][0x0][_0x2c92('0x89')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x90')][0x0][_0x2c92('0x86')];break;case _0x2c92('0x91'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')]['originatingAddress'];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x92')][_0x2c92('0x2a')];break;case _0x2c92('0x93'):_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x94')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x89')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x95')];break;case _0x2c92('0x96'):_0x558ee2[_0x2c92('0x5f')]['messageId']=_0x4052cd[_0x2c92('0x5f')][0x0][_0x2c92('0x2a')]['id'];_0x558ee2[_0x2c92('0x5f')]['from']=_0x4052cd[_0x2c92('0x5f')][0x0][_0x2c92('0x2a')][_0x2c92('0x84')];_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]=_0x4052cd['body'][0x0]['message'][_0x2c92('0x89')];break;case _0x2c92('0x97'):_0x558ee2['body'][_0x2c92('0x84')]=_0x4052cd[_0x2c92('0x5f')][_0x2c92('0x84')];_0x558ee2['body'][_0x2c92('0x5f')]=_0x4052cd['body'][_0x2c92('0x2a')];_0x558ee2['body']['messageId']=_0x4052cd['body'][_0x2c92('0x98')];break;}}if(_0x558ee2[_0x2c92('0x5f')]['id']){delete _0x558ee2[_0x2c92('0x5f')]['id'];}if(_[_0x2c92('0x99')](_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')])){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')])||_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')]===''){throw new db['Sequelize'][(_0x2c92('0x9a'))](_0x2c92('0x9b'));}if(_[_0x2c92('0x99')](_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')])){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x256bdf);}if(!_[_0x2c92('0x9d')](_0x256bdf,_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')])){throw new db[(_0x2c92('0x7d'))]['ValidationError'](_0x2c92('0x9e')+_0x256bdf);}_0x290ca4[_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')]]=_0x558ee2[_0x2c92('0x5f')]['from'];return db['CmList']['find']({'where':{'id':_0x558ee2[_0x2c92('0x77')][_0x2c92('0x9f')]},'include':[{'model':db['CmContact'],'as':_0x2c92('0xa0'),'where':_0x290ca4,'limit':0x1,'order':[[_0x2c92('0x81'),'DESC']]}]});})[_0x2c92('0x22')](handleEntityNotFound(_0x2d32b0,null))[_0x2c92('0x22')](function(_0x2c3df1){if(_0x2c3df1){_0x558ee2[_0x2c92('0xa1')]=_[_0x2c92('0xa2')](_0x2c3df1,[_0x2c92('0xa0')]);if(_0x2c3df1[_0x2c92('0xa0')][_0x2c92('0x5b')]){return _0x2c3df1[_0x2c92('0xa0')][0x0];}var _0x35e9a2=_[_0x2c92('0xa3')](_0x558ee2[_0x2c92('0x5f')],{'firstName':_0x558ee2[_0x2c92('0x5f')]['from'],'ListId':_0x2c3df1['id']});_0x35e9a2[_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x9c')]]=_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')];return db['CmContact'][_0x2c92('0x5e')](_0x35e9a2,{'fields':_0x287b63,'raw':!![]});}})[_0x2c92('0x22')](handleEntityNotFound(_0x2d32b0,null))[_0x2c92('0x22')](function(_0x2a1e77){if(_0x2a1e77){_0x558ee2[_0x2c92('0xa4')]=_0x2a1e77;var _0x39c395={'ContactId':_0x2a1e77['id'],'phone':_0x558ee2['body'][_0x2c92('0x84')],'SmsAccountId':_0x4052cd['params']['id']};var _0x96945b={'ContactId':_0x2a1e77['id'],'SmsAccountId':_0x4052cd['params']['id'],'closed':![]};return db[_0x2c92('0xa5')][_0x2c92('0x5d')]({'where':_0x96945b})[_0x2c92('0x22')](function(_0x4e684d){if(_0x4e684d){return[_0x4e684d,![]];}return db['SmsInteraction'][_0x2c92('0x5e')](_0x39c395)['then'](function(_0x2a3db6){return[_0x2a3db6,!![]];});});}})[_0x2c92('0xa6')](function(_0x7bc562,_0x157c56){_0x558ee2[_0x2c92('0xa7')]=_0x7bc562['get']({'plain':!![]});_0x558ee2['interaction'][_0x2c92('0xa8')]=![];if(_0x157c56){if(_0x558ee2[_0x2c92('0x77')]['autoclose']){_0x558ee2[_0x2c92('0x78')]['push']({'id':0x0,'priority':_0x558ee2['applications'][_0x2c92('0x5b')]+0x1,'app':_0x2c92('0xa9'),'appdata':_0x2c92('0xaa'),'interval':_0x2c92('0xab')});}_0x558ee2['interaction'][_0x2c92('0xa8')]=!![];}return db['SmsMessage'][_0x2c92('0x5e')]({'phone':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x84')],'messageId':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x86')],'body':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0x5f')],'SmsAccountId':_0x4052cd[_0x2c92('0x5a')]['id'],'SmsInteractionId':_0x7bc562['id'],'direction':'in','ContactId':_0x7bc562[_0x2c92('0xac')],'AttachmentId':_0x558ee2[_0x2c92('0x5f')][_0x2c92('0xad')]});})[_0x2c92('0x22')](function(_0x5e3d33){_0x558ee2['message']=_0x5e3d33;if(!_0x558ee2['interaction'][_0x2c92('0xae')])return;return db[_0x2c92('0xaf')][_0x2c92('0x5d')]({'attributes':['id','name'],'where':{'id':_0x558ee2[_0x2c92('0xa7')][_0x2c92('0xae')]}});})[_0x2c92('0x22')](function(_0x10edf9){if(_0x10edf9){_0x558ee2[_0x2c92('0x78')][_0x2c92('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10edf9['name']+','+(_0x558ee2[_0x2c92('0x77')][_0x2c92('0xb1')]||0xa),'interval':'*,*,*,*'});}if(!_0x558ee2[_0x2c92('0xa7')][_0x2c92('0xb2')])return;return db[_0x2c92('0xb3')][_0x2c92('0x5d')]({'attributes':['id',_0x2c92('0x3e')],'where':{'id':_0x558ee2[_0x2c92('0xa7')][_0x2c92('0xb2')]}});})[_0x2c92('0x22')](function(_0x11e306){if(_0x11e306){_0x558ee2[_0x2c92('0x78')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x11e306[_0x2c92('0x3e')]+','+(_0x558ee2[_0x2c92('0x77')][_0x2c92('0xb4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2c92('0xb5'),_0x2c92('0xb6'),_0x558ee2);})['then'](function(_0x318587){if(_0x318587){var _0xca27b=0xc8;var _0x10eb25='receiveMessage';logger[_0x2c92('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10eb25,_0xca27b,'entity\x20found');logger[_0x2c92('0x26')](_0x2c92('0xb7'),_0x10eb25,_0xca27b,_0x2c92('0xb8'),JSON[_0x2c92('0x27')](_0x318587));if(_0x558ee2[_0x2c92('0x77')][_0x2c92('0x46')]===_0x2c92('0x83')){return _0x2d32b0[_0x2c92('0x2e')](_0xca27b)['set'](_0x2c92('0xb9'),_0x2c92('0xba'))[_0x2c92('0x3f')](_0x2c92('0xbb'));}else{return _0x2d32b0[_0x2c92('0x2e')](_0xca27b)[_0x2c92('0x2f')](_0x318587);}}})['catch'](handleError(_0x2d32b0,null));};exports['addApplications']=function(_0x4398ae,_0x273357){var _0x2235f9=_0x4398ae['params']['id'];var _0x35086e=_0x4398ae[_0x2c92('0x5f')];var _0x2b3089=0xc8;var _0x13d4e8=null;return db[_0x2c92('0xbc')][_0x2c92('0xbd')]({'isolationLevel':db[_0x2c92('0xbc')][_0x2c92('0xbe')][_0x2c92('0xbf')][_0x2c92('0xc0')]},function(_0x5959f6){return db['SmsAccount'][_0x2c92('0x69')]({'where':{'id':_0x2235f9},'transaction':_0x5959f6})['then'](function(_0x5973b9){if(_0x5973b9){return db[_0x2c92('0x75')]['destroy']({'where':{'SmsAccountId':_0x2235f9},'transaction':_0x5959f6})['then'](function(){var _0x37d99a=_['map'](_0x35086e,function(_0x1f41b0){_0x1f41b0['SmsAccountId']=_0x2235f9;return _0x1f41b0;});return db['SmsApplication'][_0x2c92('0xc1')](_0x37d99a,{'transaction':_0x5959f6});});}else{_0x2b3089=0x194;_0x13d4e8=[];}});})[_0x2c92('0x22')](function(){if(_0x2b3089!==0x194){return db[_0x2c92('0x75')]['findAndCountAll']({'where':{'SmsAccountId':_0x2235f9},'order':_0x2c92('0x7a')})[_0x2c92('0x22')](function(_0x2cf040){_0x13d4e8=_0x2cf040;});}})[_0x2c92('0x2c')](function(_0x283c5c){_0x2b3089=0x1f4;logger[_0x2c92('0x28')](_0x283c5c[_0x2c92('0x3d')]);if(_0x283c5c[_0x2c92('0x3e')]){delete _0x283c5c[_0x2c92('0x3e')];}_0x13d4e8=_0x283c5c;})[_0x2c92('0xc2')](function(){if(_0x13d4e8===null){_0x273357['sendStatus'](_0x2b3089);}else{if(_0x2b3089===0x1f4){_0x273357[_0x2c92('0x2e')](_0x2b3089)[_0x2c92('0x3f')](_0x13d4e8);}else{_0x273357['status'](_0x2b3089)[_0x2c92('0x2f')](_0x13d4e8);}}});};exports[_0x2c92('0xc3')]=function(_0x68157c,_0x451df2,_0x498a31){var _0x22a17a={};var _0x4d4823={};var _0x43a5f1;var _0x33b130;return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0x68157c[_0x2c92('0x5a')]['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x451df2,null))[_0x2c92('0x22')](function(_0x423b3e){if(_0x423b3e){_0x43a5f1=_0x423b3e;_0x4d4823['model']=_[_0x2c92('0x4a')](db[_0x2c92('0x75')][_0x2c92('0x44')]);_0x4d4823[_0x2c92('0x49')]=_['keys'](_0x68157c[_0x2c92('0x49')]);_0x4d4823['filters']=_[_0x2c92('0x4c')](_0x4d4823[_0x2c92('0x48')],_0x4d4823[_0x2c92('0x49')]);_0x22a17a[_0x2c92('0x4d')]=_['intersection'](_0x4d4823[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x68157c[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x22a17a['attributes']=_0x22a17a[_0x2c92('0x4d')]['length']?_0x22a17a[_0x2c92('0x4d')]:_0x4d4823[_0x2c92('0x48')];_0x22a17a[_0x2c92('0x6a')]=qs[_0x2c92('0x51')](_0x68157c[_0x2c92('0x49')]['sort']);_0x22a17a['where']=qs[_0x2c92('0x4b')](_['pick'](_0x68157c['query'],_0x4d4823['filters']));if(_0x68157c[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x22a17a[_0x2c92('0x52')]=_['merge'](_0x22a17a[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x22a17a['attributes'],function(_0x3959b4){var _0xc2d715={};_0xc2d715[_0x3959b4]={'$like':'%'+_0x68157c['query'][_0x2c92('0x6b')]+'%'};return _0xc2d715;})});}_0x22a17a=_['merge']({},_0x22a17a,_0x68157c[_0x2c92('0x56')]);return _0x43a5f1['getApplications'](_0x22a17a);}})[_0x2c92('0x22')](function(_0x1ce722){if(_0x1ce722){_0x33b130=_0x1ce722[_0x2c92('0x5b')];if(!_0x68157c[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x22a17a['limit']=qs['limit'](_0x68157c['query']['limit']);_0x22a17a['offset']=qs[_0x2c92('0x30')](_0x68157c['query']['offset']);}return _0x43a5f1[_0x2c92('0xc3')](_0x22a17a);}})[_0x2c92('0x22')](function(_0x459d76){if(_0x459d76){return _0x459d76?{'count':_0x33b130,'rows':_0x459d76}:null;}})[_0x2c92('0x22')](respondWithResult(_0x451df2,null))['catch'](handleError(_0x451df2,null));};exports['getInteractions']=function(_0x2a2d61,_0x50e09b,_0x3edd82){var _0x17aaba={'raw':![],'where':{}};var _0x428fc8={};var _0x4ff498={'count':0x0,'rows':[]};return db[_0x2c92('0x57')][_0x2c92('0x69')]({'where':{'id':_0x2a2d61['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x50e09b,null))[_0x2c92('0x22')](function(_0x2717ff){if(_0x2717ff){_0x428fc8['model']=_[_0x2c92('0x4a')](db[_0x2c92('0xa5')][_0x2c92('0x44')]);_0x428fc8['query']=_['keys'](_0x2a2d61[_0x2c92('0x49')]);_0x428fc8[_0x2c92('0x4b')]=_[_0x2c92('0x4c')](_0x428fc8[_0x2c92('0x48')],_0x428fc8['query']);_0x17aaba[_0x2c92('0x4d')]=_[_0x2c92('0x4c')](_0x428fc8[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x4e')]));_0x17aaba[_0x2c92('0x4d')]=_0x17aaba[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x17aaba['attributes']:_0x428fc8[_0x2c92('0x48')];if(!_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x17aaba['limit']=qs['limit'](_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x32')]);_0x17aaba[_0x2c92('0x30')]=qs[_0x2c92('0x30')](_0x2a2d61[_0x2c92('0x49')]['offset']);}_0x17aaba[_0x2c92('0x6a')]=qs[_0x2c92('0x51')](_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x51')]);_0x17aaba[_0x2c92('0x52')]=qs[_0x2c92('0x4b')](_['pick'](_0x2a2d61[_0x2c92('0x49')],_0x428fc8[_0x2c92('0x4b')]));_0x17aaba[_0x2c92('0x52')][_0x2c92('0x66')]=_0x2717ff['id'];if(_0x2a2d61[_0x2c92('0x49')]['filter']){_0x17aaba['where']=_['merge'](_0x17aaba[_0x2c92('0x52')],{'$or':_[_0x2c92('0x43')](_0x17aaba[_0x2c92('0x4d')],function(_0x23f4bc){var _0x3def66={};_0x3def66[_0x23f4bc]={'$like':'%'+_0x2a2d61[_0x2c92('0x49')][_0x2c92('0x6b')]+'%'};return _0x3def66;})});}_0x17aaba=_['merge']({},_0x17aaba,_0x2a2d61[_0x2c92('0x56')]);return db[_0x2c92('0xa5')]['count']({'where':_0x17aaba[_0x2c92('0x52')]})['then'](function(_0x3a5f02){_0x4ff498[_0x2c92('0x33')]=_0x3a5f02;if(_0x2a2d61['query']['includeAll']){_0x17aaba['include']=[{'model':db['CmContact'],'as':_0x2c92('0xc4'),'required':![]},{'model':db[_0x2c92('0xaf')],'as':_0x2c92('0xc5'),'attributes':['name',_0x2c92('0xc6'),_0x2c92('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x2c92('0xc8'),'attributes':['id',_0x2c92('0x3e'),_0x2c92('0xc9')],'where':_0x2a2d61[_0x2c92('0x49')][_0x2c92('0xca')]?{'id':_0x2a2d61[_0x2c92('0x49')][_0x2c92('0xca')]}:undefined,'required':_0x2a2d61['query']['tag']?!![]:![]}];}return db[_0x2c92('0xa5')][_0x2c92('0x58')](_0x17aaba);})[_0x2c92('0x22')](function(_0x4dc2c7){_0x4ff498[_0x2c92('0x6c')]=_0x4dc2c7;return _0x4ff498;});}})[_0x2c92('0x22')](respondWithFilteredResult(_0x50e09b,_0x17aaba))[_0x2c92('0x2c')](handleError(_0x50e09b,null));};exports[_0x2c92('0x3f')]=function(_0x3815ab,_0x49258f,_0x3e6db2){var _0x4a2215,_0x3805a7,_0x3b962d;if(_[_0x2c92('0x99')](_0x3815ab[_0x2c92('0x5f')]['body'])||_0x3815ab['body'][_0x2c92('0x5f')]===''){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))](_0x2c92('0x9b'));}if(_[_0x2c92('0x99')](_0x3815ab['body']['to'])){throw new db[(_0x2c92('0x7d'))][(_0x2c92('0x9a'))](_0x2c92('0xcb'));}_0x4a2215=_0x3815ab[_0x2c92('0x5f')]['to'];return db[_0x2c92('0x57')]['find']({'where':{'id':_0x3815ab['params']['id']},'include':[{'model':db[_0x2c92('0xcc')],'as':_0x2c92('0xcd'),'include':[{'model':db[_0x2c92('0x7c')],'as':_0x2c92('0xa0'),'where':{'mobile':_0x4a2215},'limit':0x1,'order':[[_0x2c92('0x81'),_0x2c92('0xce')]]}]}]})['then'](handleEntityNotFound(_0x49258f,null))[_0x2c92('0x22')](function(_0x3a6b06){if(_0x3a6b06&&_0x3a6b06[_0x2c92('0xcd')]){_0x3805a7=_0x3a6b06[_0x2c92('0x3a')]({'plain':!![]});if(_0x3805a7['List']&&_0x3805a7['List']['Contacts'][_0x2c92('0x5b')]){return _0x3805a7[_0x2c92('0xcd')][_0x2c92('0xa0')][0x0];}return db[_0x2c92('0x7c')][_0x2c92('0x5e')](_[_0x2c92('0xa3')](_0x3815ab[_0x2c92('0x5f')],{'firstName':_0x4a2215,'mobile':_0x4a2215,'phone':_0x4a2215,'ListId':_0x3805a7['ListId']}));}})[_0x2c92('0x22')](handleEntityNotFound(_0x49258f,null))['then'](function(_0x266dc4){if(_0x266dc4){_0x3b962d=_0x266dc4;return db[_0x2c92('0xa5')]['find']({'where':{'ContactId':_0x3b962d['id'],'closed':![],'SmsAccountId':_0x3805a7['id']}})[_0x2c92('0x22')](function(_0x21d626){if(_0x21d626){return[_0x21d626,![]];}return db[_0x2c92('0xa5')][_0x2c92('0x5e')]({'UserId':_0x3815ab[_0x2c92('0x60')]['id'],'ContactId':_0x3b962d['id'],'SmsAccountId':_0x3805a7['id'],'phone':_0x4a2215,'firstMsgDirection':'out','Messages':[_[_0x2c92('0x54')](_0x3815ab[_0x2c92('0x5f')],{'read':![],'body':_0x3815ab[_0x2c92('0x5f')][_0x2c92('0x5f')],'phone':_0x4a2215,'SmsAccountId':_0x3805a7['id'],'UserId':_0x3815ab[_0x2c92('0x60')]['id'],'ContactId':_0x3b962d['id']})]},{'include':[{'model':db[_0x2c92('0xcf')],'as':_0x2c92('0xd0')}]})[_0x2c92('0x22')](function(_0x2f6fa0){return[_0x2f6fa0,!![]];});});}})[_0x2c92('0xa6')](function(_0x3ad0a6,_0x34961a){if(_0x34961a){return _0x3ad0a6;}return db[_0x2c92('0xcf')][_0x2c92('0x5e')](_['merge'](_0x3815ab[_0x2c92('0x5f')],{'read':![],'body':_0x3815ab[_0x2c92('0x5f')]['body'],'phone':_0x4a2215,'SmsAccountId':_0x3805a7['id'],'SmsInteractionId':_0x3ad0a6['id'],'UserId':_0x3815ab['user']['id'],'ContactId':_0x3b962d['id']}))[_0x2c92('0x22')](function(_0xeae792){_0x3ad0a6[_0x2c92('0xd1')][_0x2c92('0xd0')]=[];_0x3ad0a6['dataValues'][_0x2c92('0xd0')][_0x2c92('0xd2')](_0xeae792[_0x2c92('0xd1')]);return _0x3ad0a6;});})[_0x2c92('0x22')](respondWithResult(_0x49258f,null))[_0x2c92('0x2c')](handleError(_0x49258f,null));};exports[_0x2c92('0x2e')]=function(_0x315e2a,_0x33d6c2,_0x1e1546){if(_0x315e2a['body']['id']){delete _0x315e2a[_0x2c92('0x5f')]['id'];}var _0x32b423,_0x402ec8,_0xa1fb4d;return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x315e2a['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x33d6c2,null))[_0x2c92('0x22')](function(_0x46b1be){if(_0x46b1be){_0xa1fb4d=_0x46b1be;logger[_0x2c92('0x26')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0xd4'),_0x46b1be['type'],util['inspect'](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));switch(_0x46b1be['type']){case _0x2c92('0x87'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd5')]&&_0x315e2a['body'][_0x2c92('0x2e')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')]['status'];return db[_0x2c92('0xcf')][_0x2c92('0x5d')]({'where':{'messageId':_0x315e2a['body'][_0x2c92('0xd5')]}});}break;case _0x2c92('0x8a'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd6')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd7')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x315e2a['body'][_0x2c92('0xd6')]}});}break;case _0x2c92('0x8b'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x8c')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd8')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xd8')];return db['SmsMessage'][_0x2c92('0x5d')]({'where':{'messageId':_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x8c')]}});}break;case _0x2c92('0xd9'):var _0x4329ff=_0x315e2a[_0x2c92('0x5f')]['results'][0x0];if(_0x4329ff['messageId']&&_0x4329ff[_0x2c92('0x2e')]['groupName']==='DELIVERED'){_0x402ec8=_0x4329ff['status'][_0x2c92('0xda')];return db[_0x2c92('0xcf')][_0x2c92('0x5d')]({'where':{'messageId':_0x4329ff[_0x2c92('0x86')]}});}break;case _0x2c92('0x93'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x86')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x2e')]){_0x402ec8=_0x315e2a['body'][_0x2c92('0x2e')];return db[_0x2c92('0xcf')]['find']({'where':{'messageId':_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x86')]}});}break;case _0x2c92('0x96'):if(_0x315e2a[_0x2c92('0x5f')][0x0][_0x2c92('0x2a')]['id']){_0x402ec8=_0x315e2a['body'][0x0]['type'];return db['SmsMessage'][_0x2c92('0x5d')]({'where':{'messageId':_0x315e2a['body'][0x0][_0x2c92('0x2a')]['id']}});}break;case _0x2c92('0x97'):if(_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xdb')]&&_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x2e')]){_0x402ec8=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x2e')];return db[_0x2c92('0xcf')]['find']({'where':{'messageId':_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x33d6c2,null))[_0x2c92('0x22')](function(_0x435da6){if(_0x435da6){_0x32b423=_0x435da6;switch(_0xa1fb4d['type']){case'skebby':if(_0x402ec8===_0x2c92('0xdc')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status','skebby',util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x8a'):if(_0x402ec8==='1'){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0x87'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x8b'):if(!_0x315e2a[_0x2c92('0x5f')][_0x2c92('0xde')]&&_0x402ec8>=0xc8&&_0x402ec8<=0xce){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status',_0x2c92('0x8b'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0xd9'):var _0x591c99=_0x315e2a[_0x2c92('0x5f')][_0x2c92('0x90')][0x0];if(_0x591c99['status'][_0x2c92('0xda')]===_0x2c92('0xdc')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger['error'](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0xd9'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x93'):if(_0x402ec8==_0x2c92('0xdf')||_0x402ec8==_0x2c92('0xe0')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0x93'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x2c92('0x96'):if(_0x402ec8==_0x2c92('0xe1')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status',_0x2c92('0x96'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x402ec8===_0x2c92('0xe2')||_0x402ec8===_0x2c92('0xe3')){return _0x32b423[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),_0x2c92('0x2e'),_0x2c92('0x97'),util[_0x2c92('0xdd')](_0x315e2a[_0x2c92('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x32b423;}})[_0x2c92('0x22')](respondWithResult(_0x33d6c2,null))[_0x2c92('0x2c')](handleError(_0x33d6c2,null));};exports[_0x2c92('0xe4')]=function(_0x4fcf67,_0x2c4213,_0x2ee38a){var _0x219812,_0x1d1ea6,_0x3d319a;return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x4fcf67['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x2c4213,null))[_0x2c92('0x22')](function(_0x489c69){if(_0x489c69){_0x3d319a=_0x489c69;logger[_0x2c92('0x26')](_0x2c92('0xd3'),_0x2c92('0x2e'),'received\x20delivery\x20report\x20from',_0x489c69[_0x2c92('0x46')],util[_0x2c92('0xdd')](_0x4fcf67[_0x2c92('0x49')],{'showHidden':![],'depth':null}));switch(_0x489c69['type']){case _0x2c92('0x91'):if(_0x4fcf67[_0x2c92('0x49')][_0x2c92('0xe5')]&&_0x4fcf67[_0x2c92('0x49')][_0x2c92('0xe6')]){_0x1d1ea6=_0x4fcf67['query'][_0x2c92('0xe6')];return db[_0x2c92('0xcf')][_0x2c92('0x5d')]({'where':{'messageId':_0x4fcf67[_0x2c92('0x49')][_0x2c92('0xe5')]}});}break;}}})['then'](handleEntityNotFound(_0x2c4213,null))[_0x2c92('0x22')](function(_0x40649f){if(_0x40649f){_0x219812=_0x40649f;switch(_0x3d319a['type']){case _0x2c92('0x91'):if(_0x1d1ea6==='2'||_0x1d1ea6==='6'){return _0x219812[_0x2c92('0x38')]({'read':!![]});}else{logger[_0x2c92('0x28')](_0x2c92('0xd3'),'status','csc',util['inspect'](_0x4fcf67[_0x2c92('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x219812;}})['then'](respondWithResult(_0x2c4213,null))['catch'](handleError(_0x2c4213,null));};exports[_0x2c92('0xe7')]=function(_0x1bd427,_0x326b0f,_0x3b92e4){return db[_0x2c92('0x57')][_0x2c92('0x5d')]({'where':{'id':_0x1bd427['params']['id']}})['then'](handleEntityNotFound(_0x326b0f,null))['then'](function(_0x36a37e){if(_0x36a37e){return _0x36a37e['addAgents'](_0x1bd427[_0x2c92('0x5f')][_0x2c92('0x6e')],_[_0x2c92('0xa2')](_0x1bd427[_0x2c92('0x5f')],[_0x2c92('0x6e'),'id'])||{})[_0x2c92('0xa6')](function(_0x549b47){for(var _0x1892e7=0x0;_0x1892e7<_0x1bd427['body'][_0x2c92('0x6e')]['length'];_0x1892e7+=0x1){socket[_0x2c92('0xe8')]('userSmsAccount:save',{'UserId':Number(_0x1bd427[_0x2c92('0x5f')][_0x2c92('0x6e')][_0x1892e7]),'SmsAccountId':Number(_0x1bd427[_0x2c92('0x5a')]['id'])});}return _0x549b47;});}})[_0x2c92('0x22')](respondWithResult(_0x326b0f,null))[_0x2c92('0x2c')](handleError(_0x326b0f,null));};exports['removeAgents']=function(_0x15c958,_0x521f47,_0x2ce903){return db[_0x2c92('0x57')]['find']({'where':{'id':_0x15c958[_0x2c92('0x5a')]['id']}})['then'](handleEntityNotFound(_0x521f47,null))[_0x2c92('0x22')](function(_0x5a1a23){if(_0x5a1a23){return _0x5a1a23[_0x2c92('0xe9')](_0x15c958[_0x2c92('0x49')][_0x2c92('0x6e')])[_0x2c92('0x22')](function(){if(_['isArray'](_0x15c958['query'][_0x2c92('0x6e')])){for(var _0x454b92=0x0;_0x454b92<_0x15c958[_0x2c92('0x49')]['ids'][_0x2c92('0x5b')];_0x454b92+=0x1){socket[_0x2c92('0xe8')]('userSmsAccount:remove',{'UserId':Number(_0x15c958['query'][_0x2c92('0x6e')][_0x454b92]),'SmsAccountId':Number(_0x15c958['params']['id'])});}}else{socket[_0x2c92('0xe8')](_0x2c92('0xea'),{'UserId':Number(_0x15c958['query'][_0x2c92('0x6e')]),'SmsAccountId':Number(_0x15c958['params']['id'])});}});}})[_0x2c92('0x22')](respondWithStatusCode(_0x521f47,null))[_0x2c92('0x2c')](handleError(_0x521f47,null));};exports[_0x2c92('0xeb')]=function(_0x1f2ee1,_0x294b7e,_0x439444){var _0x2d1981={};var _0x265f7f={};var _0x5bbe78;var _0x407fbb;return db['SmsAccount'][_0x2c92('0x69')]({'where':{'id':_0x1f2ee1['params']['id']}})[_0x2c92('0x22')](handleEntityNotFound(_0x294b7e,null))[_0x2c92('0x22')](function(_0x37466b){if(_0x37466b){_0x5bbe78=_0x37466b;_0x265f7f[_0x2c92('0x48')]=_[_0x2c92('0x4a')](db['User'][_0x2c92('0x44')]);_0x265f7f['query']=_[_0x2c92('0x4a')](_0x1f2ee1[_0x2c92('0x49')]);_0x265f7f['filters']=_[_0x2c92('0x4c')](_0x265f7f[_0x2c92('0x48')],_0x265f7f[_0x2c92('0x49')]);_0x2d1981[_0x2c92('0x4d')]=_['intersection'](_0x265f7f[_0x2c92('0x48')],qs[_0x2c92('0x4e')](_0x1f2ee1['query']['fields']));_0x2d1981['attributes']=_0x2d1981[_0x2c92('0x4d')][_0x2c92('0x5b')]?_0x2d1981[_0x2c92('0x4d')]:_0x265f7f[_0x2c92('0x48')];_0x2d1981[_0x2c92('0x6a')]=qs[_0x2c92('0x51')](_0x1f2ee1['query']['sort']);_0x2d1981[_0x2c92('0x52')]=qs[_0x2c92('0x4b')](_[_0x2c92('0x53')](_0x1f2ee1[_0x2c92('0x49')],_0x265f7f[_0x2c92('0x4b')]));if(_0x1f2ee1[_0x2c92('0x49')][_0x2c92('0x6b')]){_0x2d1981[_0x2c92('0x52')]=_['merge'](_0x2d1981['where'],{'$or':_['map'](_0x2d1981[_0x2c92('0x4d')],function(_0x3730a9){var _0x295808={};_0x295808[_0x3730a9]={'$like':'%'+_0x1f2ee1[_0x2c92('0x49')]['filter']+'%'};return _0x295808;})});}_0x2d1981=_[_0x2c92('0x54')]({},_0x2d1981,_0x1f2ee1['options']);return _0x5bbe78[_0x2c92('0xeb')](_0x2d1981);}})[_0x2c92('0x22')](function(_0x4dacc3){if(_0x4dacc3){_0x407fbb=_0x4dacc3[_0x2c92('0x5b')];if(!_0x1f2ee1['query'][_0x2c92('0x4f')](_0x2c92('0x50'))){_0x2d1981['limit']=qs[_0x2c92('0x32')](_0x1f2ee1[_0x2c92('0x49')][_0x2c92('0x32')]);_0x2d1981[_0x2c92('0x30')]=qs['offset'](_0x1f2ee1['query']['offset']);}return _0x5bbe78[_0x2c92('0xeb')](_0x2d1981);}})[_0x2c92('0x22')](function(_0x3bfd2d){if(_0x3bfd2d){return _0x3bfd2d?{'count':_0x407fbb,'rows':_0x3bfd2d}:null;}})[_0x2c92('0x22')](respondWithResult(_0x294b7e,null))['catch'](handleError(_0x294b7e,null));}; \ No newline at end of file +var _0x7d82=['isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','http','request','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','SmsAccounts','destroy','stack','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','filter','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','Disposition','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','twilio','From','Body','messageId','MessageSid','skebby','from','sender','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','SmsQueue','unshift','queue','waitForTheAssignedQueue','receiveMessage','info','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','Contact','Owner','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','requestid','statusInt','status_code','groupName','DELIVERED','redif','connectel','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','message-id','state','csc','addAgents','removeAgents'];(function(_0x393a41,_0x5e5068){var _0x29c158=function(_0x51e2a1){while(--_0x51e2a1){_0x393a41['push'](_0x393a41['shift']());}};_0x29c158(++_0x5e5068);}(_0x7d82,0xe7));var _0x27d8=function(_0x395039,_0x1e2f2e){_0x395039=_0x395039-0x0;var _0x2b95d2=_0x7d82[_0x395039];return _0x2b95d2;};'use strict';var emlformat=require(_0x27d8('0x0'));var rimraf=require(_0x27d8('0x1'));var zipdir=require(_0x27d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27d8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x27d8('0x4'));var util=require(_0x27d8('0x5'));var path=require(_0x27d8('0x6'));var sox=require(_0x27d8('0x7'));var csv=require(_0x27d8('0x8'));var ejs=require(_0x27d8('0x9'));var fs=require('fs');var fs_extra=require(_0x27d8('0xa'));var _=require(_0x27d8('0xb'));var squel=require(_0x27d8('0xc'));var crypto=require(_0x27d8('0xd'));var jsforce=require(_0x27d8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x27d8('0x8'));var querystring=require('querystring');var Papa=require(_0x27d8('0xf'));var Redis=require(_0x27d8('0x10'));var authService=require(_0x27d8('0x11'));var qs=require(_0x27d8('0x12'));var as=require(_0x27d8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x27d8('0x14'));var utils=require(_0x27d8('0x15'));var config=require(_0x27d8('0x16'));var licenseUtil=require(_0x27d8('0x17'));var db=require(_0x27d8('0x18'))['db'];config[_0x27d8('0x19')]=_[_0x27d8('0x1a')](config[_0x27d8('0x19')],{'host':_0x27d8('0x1b'),'port':0x18eb});var socket=require(_0x27d8('0x1c'))(new Redis(config[_0x27d8('0x19')]));require(_0x27d8('0x1d'))['register'](socket);var jayson=require(_0x27d8('0x1e'));var client=jayson['client'][_0x27d8('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x27ad3c,_0x1c77ee,_0x4113a4,_0x4eedc2){return new BPromise(function(_0x44ca35,_0x21c62f){var _0x24e442=_0x4eedc2||client;return _0x24e442[_0x27d8('0x20')](_0x27ad3c,_0x4113a4)['then'](function(_0x5b7eeb){logger['info']('SmsAccount,\x20%s,\x20%s',_0x1c77ee,_0x27d8('0x21'));logger[_0x27d8('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1c77ee,_0x27d8('0x21'),JSON[_0x27d8('0x23')](_0x5b7eeb));if(_0x5b7eeb[_0x27d8('0x24')]){if(_0x5b7eeb[_0x27d8('0x24')][_0x27d8('0x25')]===0x1f4){logger[_0x27d8('0x24')](_0x27d8('0x26'),_0x1c77ee,_0x5b7eeb[_0x27d8('0x24')][_0x27d8('0x27')]);return _0x21c62f(_0x5b7eeb[_0x27d8('0x24')][_0x27d8('0x27')]);}logger[_0x27d8('0x24')](_0x27d8('0x26'),_0x1c77ee,_0x5b7eeb['error'][_0x27d8('0x27')]);return _0x44ca35(_0x5b7eeb[_0x27d8('0x24')][_0x27d8('0x27')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1c77ee,_0x27d8('0x21'));_0x44ca35(_0x5b7eeb[_0x27d8('0x28')][_0x27d8('0x27')]);}})['catch'](function(_0x4a8c01){logger[_0x27d8('0x24')](_0x27d8('0x26'),_0x1c77ee,_0x4a8c01);_0x21c62f(_0x4a8c01);});});}function respondWithStatusCode(_0x1bd74d,_0x3d5402){_0x3d5402=_0x3d5402||0xcc;return function(_0x2c15a9){if(_0x2c15a9){return _0x1bd74d[_0x27d8('0x29')](_0x3d5402);}return _0x1bd74d['status'](_0x3d5402)[_0x27d8('0x2a')]();};}function respondWithResult(_0x472672,_0x2ef787){_0x2ef787=_0x2ef787||0xc8;return function(_0x151a54){if(_0x151a54){return _0x472672[_0x27d8('0x2b')](_0x2ef787)[_0x27d8('0x2c')](_0x151a54);}};}function respondWithFilteredResult(_0x40ec93,_0x3ab448){return function(_0x44745f){if(_0x44745f){var _0x42dc04=typeof _0x3ab448[_0x27d8('0x2d')]==='undefined'&&typeof _0x3ab448['limit']===_0x27d8('0x2e');var _0x31fdba=_0x44745f[_0x27d8('0x2f')];var _0x5a06ff=_0x42dc04?0x0:_0x3ab448['offset'];var _0x3550c6=_0x42dc04?_0x44745f[_0x27d8('0x2f')]:_0x3ab448[_0x27d8('0x2d')]+_0x3ab448['limit'];var _0xef0261;if(_0x3550c6>=_0x31fdba){_0x3550c6=_0x31fdba;_0xef0261=0xc8;}else{_0xef0261=0xce;}_0x40ec93['status'](_0xef0261);return _0x40ec93[_0x27d8('0x30')](_0x27d8('0x31'),_0x5a06ff+'-'+_0x3550c6+'/'+_0x31fdba)[_0x27d8('0x2c')](_0x44745f);}return null;};}function patchUpdates(_0x28e69d){return function(_0x558825){try{jsonpatch[_0x27d8('0x32')](_0x558825,_0x28e69d,!![]);}catch(_0x2b714b){return BPromise[_0x27d8('0x33')](_0x2b714b);}return _0x558825['save']();};}function saveUpdates(_0x4ff6f4,_0xca68da){return function(_0x4de5ff){if(_0x4de5ff){return _0x4de5ff[_0x27d8('0x34')](_0x4ff6f4)[_0x27d8('0x35')](function(_0x7c009b){return _0x7c009b;});}return null;};}function removeEntity(_0x35fa44,_0x1c4611){return function(_0x2f1ac7){if(_0x2f1ac7){return _0x2f1ac7['destroy']()[_0x27d8('0x35')](function(){var _0x57e429=_0x2f1ac7[_0x27d8('0x36')]({'plain':!![]});var _0x7f3abe=_0x27d8('0x37');return db['UserProfileResource'][_0x27d8('0x38')]({'where':{'type':_0x7f3abe,'resourceId':_0x57e429['id']}})[_0x27d8('0x35')](function(){return _0x2f1ac7;});})['then'](function(){_0x35fa44[_0x27d8('0x2b')](0xcc)[_0x27d8('0x2a')]();});}};}function handleEntityNotFound(_0x1ff658,_0x150520){return function(_0x540877){if(!_0x540877){_0x1ff658['sendStatus'](0x194);}return _0x540877;};}function handleError(_0xdd2506,_0x3e630c){_0x3e630c=_0x3e630c||0x1f4;return function(_0x474432){logger[_0x27d8('0x24')](_0x474432[_0x27d8('0x39')]);if(_0x474432['name']){delete _0x474432['name'];}_0xdd2506['status'](_0x3e630c)[_0x27d8('0x3a')](_0x474432);};}exports['index']=function(_0x2b40a8,_0xe3882d){var _0x1d07c5={'include':[{'model':db[_0x27d8('0x3b')],'as':_0x27d8('0x3c')}]},_0x2ac19d={},_0x339de2={'count':0x0,'rows':[]};var _0x1744cc=_[_0x27d8('0x3d')](db[_0x27d8('0x3e')][_0x27d8('0x3f')],function(_0x157b41){return{'name':_0x157b41[_0x27d8('0x40')],'type':_0x157b41['type'][_0x27d8('0x41')]};});_0x2ac19d[_0x27d8('0x42')]=_['map'](_0x1744cc,_0x27d8('0x43'));_0x2ac19d[_0x27d8('0x44')]=_[_0x27d8('0x45')](_0x2b40a8['query']);_0x2ac19d[_0x27d8('0x46')]=_['intersection'](_0x2ac19d[_0x27d8('0x42')],_0x2ac19d[_0x27d8('0x44')]);_0x1d07c5[_0x27d8('0x47')]=_[_0x27d8('0x48')](_0x2ac19d[_0x27d8('0x42')],qs[_0x27d8('0x49')](_0x2b40a8[_0x27d8('0x44')][_0x27d8('0x49')]));_0x1d07c5[_0x27d8('0x47')]=_0x1d07c5[_0x27d8('0x47')][_0x27d8('0x4a')]?_0x1d07c5['attributes']:_0x2ac19d[_0x27d8('0x42')];if(!_0x2b40a8[_0x27d8('0x44')][_0x27d8('0x4b')](_0x27d8('0x4c'))){_0x1d07c5[_0x27d8('0x4d')]=qs[_0x27d8('0x4d')](_0x2b40a8[_0x27d8('0x44')][_0x27d8('0x4d')]);_0x1d07c5[_0x27d8('0x2d')]=qs[_0x27d8('0x2d')](_0x2b40a8[_0x27d8('0x44')][_0x27d8('0x2d')]);}_0x1d07c5[_0x27d8('0x4e')]=qs[_0x27d8('0x4f')](_0x2b40a8[_0x27d8('0x44')][_0x27d8('0x4f')]);_0x1d07c5[_0x27d8('0x50')]=qs[_0x27d8('0x46')](_[_0x27d8('0x51')](_0x2b40a8['query'],_0x2ac19d[_0x27d8('0x46')]),_0x1744cc);if(_0x2b40a8[_0x27d8('0x44')]['filter']){_0x1d07c5[_0x27d8('0x50')]=_[_0x27d8('0x52')](_0x1d07c5[_0x27d8('0x50')],{'$or':_[_0x27d8('0x3d')](_0x1744cc,function(_0xca9165){if(_0xca9165[_0x27d8('0x53')]!=='VIRTUAL'){var _0x593327={};_0x593327[_0xca9165['name']]={'$like':'%'+_0x2b40a8[_0x27d8('0x44')][_0x27d8('0x54')]+'%'};return _0x593327;}})});}_0x1d07c5=_['merge']({},_0x1d07c5,_0x2b40a8[_0x27d8('0x55')]);var _0x484ac6={'where':_0x1d07c5[_0x27d8('0x50')]};return db[_0x27d8('0x3e')][_0x27d8('0x2f')](_0x484ac6)[_0x27d8('0x35')](function(_0x41a12c){_0x339de2['count']=_0x41a12c;if(_0x2b40a8[_0x27d8('0x44')][_0x27d8('0x56')]){_0x1d07c5['include']=[{'all':!![]}];}return db[_0x27d8('0x3e')][_0x27d8('0x57')](_0x1d07c5);})[_0x27d8('0x35')](function(_0x3d56e){_0x339de2['rows']=_0x3d56e;return _0x339de2;})[_0x27d8('0x35')](respondWithFilteredResult(_0xe3882d,_0x1d07c5))[_0x27d8('0x58')](handleError(_0xe3882d,null));};exports[_0x27d8('0x59')]=function(_0x5277aa,_0x9b24ce){var _0xfbb4e7={'raw':![],'where':{'id':_0x5277aa['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x507052={};_0x507052[_0x27d8('0x42')]=_[_0x27d8('0x45')](db[_0x27d8('0x3e')]['rawAttributes']);_0x507052[_0x27d8('0x44')]=_[_0x27d8('0x45')](_0x5277aa['query']);_0x507052['filters']=_[_0x27d8('0x48')](_0x507052[_0x27d8('0x42')],_0x507052[_0x27d8('0x44')]);_0xfbb4e7[_0x27d8('0x47')]=_[_0x27d8('0x48')](_0x507052[_0x27d8('0x42')],qs[_0x27d8('0x49')](_0x5277aa[_0x27d8('0x44')][_0x27d8('0x49')]));_0xfbb4e7[_0x27d8('0x47')]=_0xfbb4e7['attributes'][_0x27d8('0x4a')]?_0xfbb4e7[_0x27d8('0x47')]:_0x507052[_0x27d8('0x42')];if(_0x5277aa[_0x27d8('0x44')]['includeAll']){_0xfbb4e7[_0x27d8('0x5a')]=[{'all':!![]}];}_0xfbb4e7=_['merge']({},_0xfbb4e7,_0x5277aa['options']);return db[_0x27d8('0x3e')][_0x27d8('0x5b')](_0xfbb4e7)[_0x27d8('0x35')](handleEntityNotFound(_0x9b24ce,null))[_0x27d8('0x35')](respondWithResult(_0x9b24ce,null))[_0x27d8('0x58')](handleError(_0x9b24ce,null));};exports[_0x27d8('0x5c')]=function(_0x333d03,_0x13dfd3){return db[_0x27d8('0x3e')]['create'](_0x333d03[_0x27d8('0x5d')],{})['then'](function(_0x205a91){var _0xc6f7d9=_0x333d03[_0x27d8('0x5e')][_0x27d8('0x36')]({'plain':!![]});if(!_0xc6f7d9)throw new Error(_0x27d8('0x5f'));if(_0xc6f7d9['role']===_0x27d8('0x5e')){var _0x50c0a3=_0x205a91[_0x27d8('0x36')]({'plain':!![]});var _0x5a00dd='SmsAccounts';return db['UserProfileSection'][_0x27d8('0x5b')]({'where':{'name':_0x5a00dd,'userProfileId':_0xc6f7d9['userProfileId']},'raw':!![]})[_0x27d8('0x35')](function(_0x1ed2c4){if(_0x1ed2c4&&_0x1ed2c4[_0x27d8('0x60')]===0x0){return db[_0x27d8('0x61')][_0x27d8('0x5c')]({'name':_0x50c0a3[_0x27d8('0x43')],'resourceId':_0x50c0a3['id'],'type':_0x1ed2c4[_0x27d8('0x43')],'sectionId':_0x1ed2c4['id']},{})[_0x27d8('0x35')](function(){return _0x205a91;});}else{return _0x205a91;}})[_0x27d8('0x58')](function(_0x419b46){logger[_0x27d8('0x24')](_0x27d8('0x62'),_0x419b46);throw _0x419b46;});}return _0x205a91;})[_0x27d8('0x35')](respondWithResult(_0x13dfd3,0xc9))['catch'](handleError(_0x13dfd3,null));};exports[_0x27d8('0x34')]=function(_0x203a34,_0x29c189){if(_0x203a34[_0x27d8('0x5d')]['id']){delete _0x203a34[_0x27d8('0x5d')]['id'];}return db['SmsAccount'][_0x27d8('0x5b')]({'where':{'id':_0x203a34[_0x27d8('0x63')]['id']},'include':[{'model':db[_0x27d8('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x27d8('0x35')](handleEntityNotFound(_0x29c189,null))[_0x27d8('0x35')](saveUpdates(_0x203a34[_0x27d8('0x5d')],null))[_0x27d8('0x35')](respondWithResult(_0x29c189,null))[_0x27d8('0x58')](handleError(_0x29c189,null));};exports['destroy']=function(_0x5619c8,_0x3bd2f7){return db[_0x27d8('0x3e')][_0x27d8('0x5b')]({'where':{'id':_0x5619c8[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x3bd2f7,null))[_0x27d8('0x35')](removeEntity(_0x3bd2f7,null))[_0x27d8('0x58')](handleError(_0x3bd2f7,null));};exports[_0x27d8('0x64')]=function(_0x94d9d7,_0x5ce932){return db[_0x27d8('0x3e')]['describe']()[_0x27d8('0x35')](respondWithResult(_0x5ce932,null))[_0x27d8('0x58')](handleError(_0x5ce932,null));};exports['addDisposition']=function(_0x56a555,_0xbad953,_0x427056){if(_0x56a555[_0x27d8('0x5d')]['id']){delete _0x56a555[_0x27d8('0x5d')]['id'];}return db[_0x27d8('0x3e')][_0x27d8('0x5b')]({'where':{'id':_0x56a555[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0xbad953,null))[_0x27d8('0x35')](function(_0x56a8da){if(_0x56a8da){_0x56a555[_0x27d8('0x5d')][_0x27d8('0x65')]=_0x56a8da['id'];return db[_0x27d8('0x66')][_0x27d8('0x5c')](_0x56a555[_0x27d8('0x5d')]);}})[_0x27d8('0x35')](respondWithResult(_0xbad953,null))['catch'](handleError(_0xbad953,null));};exports['getDispositions']=function(_0x503a0b,_0x300dd4,_0x15ad9e){var _0x5e113b={'raw':![],'where':{}};var _0x5b945b={};var _0x216016={'count':0x0,'rows':[]};return db[_0x27d8('0x3e')][_0x27d8('0x67')]({'where':{'id':_0x503a0b[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x300dd4,null))[_0x27d8('0x35')](function(_0x11a981){if(_0x11a981){_0x5b945b[_0x27d8('0x42')]=_[_0x27d8('0x45')](db[_0x27d8('0x66')]['rawAttributes']);_0x5b945b[_0x27d8('0x44')]=_[_0x27d8('0x45')](_0x503a0b[_0x27d8('0x44')]);_0x5b945b[_0x27d8('0x46')]=_[_0x27d8('0x48')](_0x5b945b[_0x27d8('0x42')],_0x5b945b['query']);_0x5e113b[_0x27d8('0x47')]=_['intersection'](_0x5b945b[_0x27d8('0x42')],qs[_0x27d8('0x49')](_0x503a0b['query'][_0x27d8('0x49')]));_0x5e113b[_0x27d8('0x47')]=_0x5e113b['attributes']['length']?_0x5e113b['attributes']:_0x5b945b[_0x27d8('0x42')];if(!_0x503a0b[_0x27d8('0x44')][_0x27d8('0x4b')](_0x27d8('0x4c'))){_0x5e113b['limit']=qs['limit'](_0x503a0b['query'][_0x27d8('0x4d')]);_0x5e113b['offset']=qs[_0x27d8('0x2d')](_0x503a0b[_0x27d8('0x44')][_0x27d8('0x2d')]);}_0x5e113b[_0x27d8('0x4e')]=qs[_0x27d8('0x4f')](_0x503a0b['query'][_0x27d8('0x4f')]);_0x5e113b['where']=qs[_0x27d8('0x46')](_['pick'](_0x503a0b[_0x27d8('0x44')],_0x5b945b[_0x27d8('0x46')]));_0x5e113b[_0x27d8('0x50')][_0x27d8('0x65')]=_0x11a981['id'];if(_0x503a0b[_0x27d8('0x44')][_0x27d8('0x54')]){_0x5e113b[_0x27d8('0x50')]=_['merge'](_0x5e113b[_0x27d8('0x50')],{'$or':_[_0x27d8('0x3d')](_0x5e113b['attributes'],function(_0x32ed34){var _0x193fbb={};_0x193fbb[_0x32ed34]={'$like':'%'+_0x503a0b[_0x27d8('0x44')][_0x27d8('0x54')]+'%'};return _0x193fbb;})});}_0x5e113b=_[_0x27d8('0x52')]({},_0x5e113b,_0x503a0b['options']);return db['Disposition']['count']({'where':_0x5e113b[_0x27d8('0x50')]})[_0x27d8('0x35')](function(_0x49dcbd){_0x216016[_0x27d8('0x2f')]=_0x49dcbd;if(_0x503a0b[_0x27d8('0x44')][_0x27d8('0x56')]){_0x5e113b[_0x27d8('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x27d8('0x57')](_0x5e113b);})['then'](function(_0x2bcca5){_0x216016[_0x27d8('0x68')]=_0x2bcca5;return _0x216016;});}})['then'](respondWithFilteredResult(_0x300dd4,_0x5e113b))['catch'](handleError(_0x300dd4,null));};exports[_0x27d8('0x69')]=function(_0x4f1a31,_0xc8addc,_0x78da0a){return db[_0x27d8('0x3e')]['find']({'where':{'id':_0x4f1a31[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0xc8addc,null))[_0x27d8('0x35')](function(_0xe23f03){if(_0xe23f03){return _0xe23f03[_0x27d8('0x69')](_0x4f1a31[_0x27d8('0x44')][_0x27d8('0x6a')]);}})[_0x27d8('0x35')](respondWithStatusCode(_0xc8addc,null))[_0x27d8('0x58')](handleError(_0xc8addc,null));};exports[_0x27d8('0x6b')]=function(_0x224255,_0x40e4ad,_0x1967a6){if(_0x224255['body']['id']){delete _0x224255['body']['id'];}return db[_0x27d8('0x3e')]['find']({'where':{'id':_0x224255['params']['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x40e4ad,null))['then'](function(_0x4d93d3){if(_0x4d93d3){_0x224255[_0x27d8('0x5d')][_0x27d8('0x65')]=_0x4d93d3['id'];return db[_0x27d8('0x6c')][_0x27d8('0x5c')](_0x224255[_0x27d8('0x5d')]);}})[_0x27d8('0x35')](respondWithResult(_0x40e4ad,null))['catch'](handleError(_0x40e4ad,null));};exports[_0x27d8('0x6d')]=function(_0x50f697,_0x126948,_0x169488){var _0x214054={'raw':![],'where':{}};var _0x73965e={};var _0x1278f5={'count':0x0,'rows':[]};return db[_0x27d8('0x3e')][_0x27d8('0x67')]({'where':{'id':_0x50f697[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x126948,null))[_0x27d8('0x35')](function(_0x365100){if(_0x365100){_0x73965e[_0x27d8('0x42')]=_[_0x27d8('0x45')](db[_0x27d8('0x6c')][_0x27d8('0x3f')]);_0x73965e[_0x27d8('0x44')]=_[_0x27d8('0x45')](_0x50f697['query']);_0x73965e[_0x27d8('0x46')]=_[_0x27d8('0x48')](_0x73965e[_0x27d8('0x42')],_0x73965e[_0x27d8('0x44')]);_0x214054[_0x27d8('0x47')]=_[_0x27d8('0x48')](_0x73965e[_0x27d8('0x42')],qs['fields'](_0x50f697[_0x27d8('0x44')][_0x27d8('0x49')]));_0x214054[_0x27d8('0x47')]=_0x214054['attributes']['length']?_0x214054[_0x27d8('0x47')]:_0x73965e[_0x27d8('0x42')];if(!_0x50f697[_0x27d8('0x44')]['hasOwnProperty'](_0x27d8('0x4c'))){_0x214054[_0x27d8('0x4d')]=qs[_0x27d8('0x4d')](_0x50f697[_0x27d8('0x44')][_0x27d8('0x4d')]);_0x214054['offset']=qs[_0x27d8('0x2d')](_0x50f697['query'][_0x27d8('0x2d')]);}_0x214054[_0x27d8('0x4e')]=qs[_0x27d8('0x4f')](_0x50f697[_0x27d8('0x44')][_0x27d8('0x4f')]);_0x214054[_0x27d8('0x50')]=qs[_0x27d8('0x46')](_[_0x27d8('0x51')](_0x50f697[_0x27d8('0x44')],_0x73965e[_0x27d8('0x46')]));_0x214054[_0x27d8('0x50')][_0x27d8('0x65')]=_0x365100['id'];if(_0x50f697[_0x27d8('0x44')][_0x27d8('0x54')]){_0x214054[_0x27d8('0x50')]=_[_0x27d8('0x52')](_0x214054[_0x27d8('0x50')],{'$or':_[_0x27d8('0x3d')](_0x214054[_0x27d8('0x47')],function(_0x1054e5){var _0x3d5273={};_0x3d5273[_0x1054e5]={'$like':'%'+_0x50f697[_0x27d8('0x44')][_0x27d8('0x54')]+'%'};return _0x3d5273;})});}_0x214054=_[_0x27d8('0x52')]({},_0x214054,_0x50f697['options']);return db[_0x27d8('0x6c')][_0x27d8('0x2f')]({'where':_0x214054[_0x27d8('0x50')]})[_0x27d8('0x35')](function(_0x4ab714){_0x1278f5[_0x27d8('0x2f')]=_0x4ab714;if(_0x50f697[_0x27d8('0x44')][_0x27d8('0x56')]){_0x214054['include']=[{'all':!![]}];}return db[_0x27d8('0x6c')][_0x27d8('0x57')](_0x214054);})[_0x27d8('0x35')](function(_0x478b4c){_0x1278f5[_0x27d8('0x68')]=_0x478b4c;return _0x1278f5;});}})['then'](respondWithFilteredResult(_0x126948,_0x214054))[_0x27d8('0x58')](handleError(_0x126948,null));};exports[_0x27d8('0x6e')]=function(_0x2f793e,_0x2c1e01,_0x18bd4a){return db[_0x27d8('0x3e')][_0x27d8('0x5b')]({'where':{'id':_0x2f793e[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x2c1e01,null))[_0x27d8('0x35')](function(_0x38afcb){if(_0x38afcb){return _0x38afcb[_0x27d8('0x6e')](_0x2f793e[_0x27d8('0x44')][_0x27d8('0x6a')]);}})[_0x27d8('0x35')](respondWithStatusCode(_0x2c1e01,null))[_0x27d8('0x58')](handleError(_0x2c1e01,null));};exports[_0x27d8('0x6f')]=function(_0x547ec4,_0x4e3706,_0x2b0303){var _0x16e8e0={'channel':'sms'};var _0x5d5f3f=[];var _0x5dc282=[];var _0x3a9596={};return db[_0x27d8('0x3e')]['find']({'where':{'id':_0x547ec4[_0x27d8('0x63')]['id']},'include':[{'model':db[_0x27d8('0x70')],'as':_0x27d8('0x71')}]})[_0x27d8('0x35')](handleEntityNotFound(_0x4e3706,null))[_0x27d8('0x35')](function(_0x2a8b38){_0x16e8e0[_0x27d8('0x72')]=_0x2a8b38;_0x16e8e0[_0x27d8('0x73')]=_[_0x27d8('0x74')](_0x2a8b38[_0x27d8('0x71')],['priority'],['asc']);if(_0x16e8e0[_0x27d8('0x72')][_0x27d8('0x71')]){delete _0x16e8e0[_0x27d8('0x72')][_0x27d8('0x71')];}return db[_0x27d8('0x75')]['describe']();})[_0x27d8('0x35')](function(_0x220045){if(!_0x220045){throw new db['Sequelize'][(_0x27d8('0x76'))](_0x27d8('0x77'));}_0x5d5f3f=_['difference'](_[_0x27d8('0x45')](_0x220045),[_0x27d8('0x78'),_0x27d8('0x79')]);_0x5dc282=_['difference'](_[_0x27d8('0x45')](_0x220045),[_0x27d8('0x78'),_0x27d8('0x79'),_0x27d8('0x7a'),'ListId']);_0x16e8e0[_0x27d8('0x5d')]={'mapKey':'mobile'};if(_0x16e8e0['account']['type']){switch(_0x16e8e0[_0x27d8('0x72')][_0x27d8('0x53')]){case _0x27d8('0x7b'):_0x16e8e0[_0x27d8('0x5d')]['from']=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x7c')];_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x5d')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x7d')];_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x7e')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x7f')];break;case _0x27d8('0x80'):_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]='+'+_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x82')];_0x16e8e0['body'][_0x27d8('0x5d')]=_0x547ec4['body'][_0x27d8('0x83')];break;case'connectel':_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x81')];_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x5d')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x27')];break;case _0x27d8('0x84'):_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x81')];_0x16e8e0[_0x27d8('0x5d')]['body']=_0x547ec4['body']['body'];_0x16e8e0['body']['messageId']=_0x547ec4['body'][_0x27d8('0x85')];break;case _0x27d8('0x86'):_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x7c')];_0x16e8e0['body'][_0x27d8('0x5d')]=_0x547ec4['body'][_0x27d8('0x87')];_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x7e')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x88')];break;case _0x27d8('0x89'):_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]='+'+_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x8a')][0x0][_0x27d8('0x81')];_0x16e8e0['body']['body']=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x8a')][0x0][_0x27d8('0x83')];_0x16e8e0['body'][_0x27d8('0x7e')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x8a')][0x0][_0x27d8('0x7e')];break;case'csc':_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x8b')];_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x5d')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x8c')][_0x27d8('0x27')];break;case _0x27d8('0x8d'):_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]=_0x547ec4[_0x27d8('0x5d')]['fromNumber'];_0x16e8e0[_0x27d8('0x5d')]['body']=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x83')];_0x16e8e0['body']['messageId']=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x8e')];break;case _0x27d8('0x8f'):_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x7e')]=_0x547ec4[_0x27d8('0x5d')][0x0]['message']['id'];_0x16e8e0[_0x27d8('0x5d')]['from']=_0x547ec4[_0x27d8('0x5d')][0x0][_0x27d8('0x27')]['from'];_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x5d')]=_0x547ec4[_0x27d8('0x5d')][0x0][_0x27d8('0x27')][_0x27d8('0x83')];break;case _0x27d8('0x90'):_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x81')];_0x16e8e0['body'][_0x27d8('0x5d')]=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x27')];_0x16e8e0[_0x27d8('0x5d')]['messageId']=_0x547ec4[_0x27d8('0x5d')][_0x27d8('0x91')];break;}}if(_0x16e8e0[_0x27d8('0x5d')]['id']){delete _0x16e8e0[_0x27d8('0x5d')]['id'];}if(_[_0x27d8('0x92')](_0x16e8e0[_0x27d8('0x5d')]['from'])){throw new db['Sequelize'][(_0x27d8('0x76'))](_0x27d8('0x93'));}if(_['isNil'](_0x16e8e0[_0x27d8('0x5d')]['body'])||_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x5d')]===''){throw new db[(_0x27d8('0x94'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x27d8('0x92')](_0x16e8e0[_0x27d8('0x5d')]['mapKey'])){throw new db[(_0x27d8('0x94'))][(_0x27d8('0x76'))](_0x27d8('0x95')+_0x5dc282);}if(!_[_0x27d8('0x96')](_0x5dc282,_0x16e8e0[_0x27d8('0x5d')]['mapKey'])){throw new db[(_0x27d8('0x94'))][(_0x27d8('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dc282);}_0x3a9596[_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x97')]]=_0x16e8e0['body'][_0x27d8('0x81')];return db['CmList'][_0x27d8('0x5b')]({'where':{'id':_0x16e8e0[_0x27d8('0x72')][_0x27d8('0x98')]},'include':[{'model':db['CmContact'],'as':_0x27d8('0x99'),'where':_0x3a9596,'limit':0x1,'order':[[_0x27d8('0x79'),_0x27d8('0x9a')]]}]});})[_0x27d8('0x35')](handleEntityNotFound(_0x4e3706,null))[_0x27d8('0x35')](function(_0x39a414){if(_0x39a414){_0x16e8e0[_0x27d8('0x9b')]=_[_0x27d8('0x9c')](_0x39a414,[_0x27d8('0x99')]);if(_0x39a414[_0x27d8('0x99')]['length']){return _0x39a414[_0x27d8('0x99')][0x0];}var _0x5d9f68=_[_0x27d8('0x1a')](_0x16e8e0['body'],{'firstName':_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')],'ListId':_0x39a414['id']});_0x5d9f68[_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x97')]]=_0x16e8e0[_0x27d8('0x5d')]['from'];return db['CmContact']['create'](_0x5d9f68,{'fields':_0x5d5f3f,'raw':!![]});}})[_0x27d8('0x35')](handleEntityNotFound(_0x4e3706,null))['then'](function(_0x33cd90){if(_0x33cd90){_0x16e8e0[_0x27d8('0x9d')]=_0x33cd90;var _0x4c9baf={'ContactId':_0x33cd90['id'],'phone':_0x16e8e0[_0x27d8('0x5d')]['from'],'SmsAccountId':_0x547ec4[_0x27d8('0x63')]['id']};var _0x434bd0={'ContactId':_0x33cd90['id'],'SmsAccountId':_0x547ec4[_0x27d8('0x63')]['id'],'closed':![]};return db[_0x27d8('0x9e')][_0x27d8('0x5b')]({'where':_0x434bd0})[_0x27d8('0x35')](function(_0x57c65e){if(_0x57c65e){return[_0x57c65e,![]];}return db[_0x27d8('0x9e')][_0x27d8('0x5c')](_0x4c9baf)[_0x27d8('0x35')](function(_0x226cdb){return[_0x226cdb,!![]];});});}})[_0x27d8('0x9f')](function(_0x10c8cc,_0x18b4d3){_0x16e8e0[_0x27d8('0xa0')]=_0x10c8cc['get']({'plain':!![]});_0x16e8e0[_0x27d8('0xa0')][_0x27d8('0xa1')]=![];if(_0x18b4d3){if(_0x16e8e0[_0x27d8('0x72')]['autoclose']){_0x16e8e0[_0x27d8('0x73')]['push']({'id':0x0,'priority':_0x16e8e0[_0x27d8('0x73')][_0x27d8('0x4a')]+0x1,'app':_0x27d8('0xa2'),'appdata':_0x27d8('0xa3'),'interval':'*,*,*,*'});}_0x16e8e0[_0x27d8('0xa0')]['created']=!![];}return db[_0x27d8('0xa4')][_0x27d8('0x5c')]({'phone':_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x81')],'messageId':_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0x7e')],'body':_0x16e8e0['body'][_0x27d8('0x5d')],'SmsAccountId':_0x547ec4[_0x27d8('0x63')]['id'],'SmsInteractionId':_0x10c8cc['id'],'direction':'in','ContactId':_0x10c8cc[_0x27d8('0xa5')],'AttachmentId':_0x16e8e0[_0x27d8('0x5d')][_0x27d8('0xa6')]});})[_0x27d8('0x35')](function(_0x4b3153){_0x16e8e0[_0x27d8('0x27')]=_0x4b3153;if(!_0x16e8e0['interaction'][_0x27d8('0xa7')])return;return db[_0x27d8('0xa8')][_0x27d8('0x5b')]({'attributes':['id',_0x27d8('0x43')],'where':{'id':_0x16e8e0[_0x27d8('0xa0')][_0x27d8('0xa7')]}});})[_0x27d8('0x35')](function(_0x24550e){if(_0x24550e){_0x16e8e0[_0x27d8('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0x27d8('0xa9'),'appdata':_0x24550e[_0x27d8('0x43')]+','+(_0x16e8e0[_0x27d8('0x72')][_0x27d8('0xaa')]||0xa),'interval':'*,*,*,*'});}if(!_0x16e8e0[_0x27d8('0xa0')][_0x27d8('0xab')])return;return db[_0x27d8('0xac')][_0x27d8('0x5b')]({'attributes':['id',_0x27d8('0x43')],'where':{'id':_0x16e8e0[_0x27d8('0xa0')][_0x27d8('0xab')]}});})[_0x27d8('0x35')](function(_0x507f96){if(_0x507f96){_0x16e8e0[_0x27d8('0x73')][_0x27d8('0xad')]({'id':0x0,'priority':0x1,'app':_0x27d8('0xae'),'appdata':_0x507f96['name']+','+(_0x16e8e0[_0x27d8('0x72')][_0x27d8('0xaf')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x16e8e0);})[_0x27d8('0x35')](function(_0x15edeb){if(_0x15edeb){var _0x247a57=0xc8;var _0x2c780b=_0x27d8('0xb0');logger[_0x27d8('0xb1')](_0x27d8('0xb2'),_0x2c780b,_0x247a57,_0x27d8('0xb3'));logger['debug'](_0x27d8('0xb4'),_0x2c780b,_0x247a57,'entity\x20found',JSON['stringify'](_0x15edeb));if(_0x16e8e0[_0x27d8('0x72')][_0x27d8('0x53')]===_0x27d8('0x7b')){return _0x4e3706[_0x27d8('0x2b')](_0x247a57)['set'](_0x27d8('0xb5'),_0x27d8('0xb6'))[_0x27d8('0x3a')](_0x27d8('0xb7'));}else{return _0x4e3706[_0x27d8('0x2b')](_0x247a57)['json'](_0x15edeb);}}})[_0x27d8('0x58')](handleError(_0x4e3706,null));};exports[_0x27d8('0xb8')]=function(_0x12a8c5,_0x390d7b){var _0x2f3a56=_0x12a8c5[_0x27d8('0x63')]['id'];var _0x5b0c10=_0x12a8c5[_0x27d8('0x5d')];var _0x4867ad=0xc8;var _0x5ca371=null;return db[_0x27d8('0xb9')][_0x27d8('0xba')]({'isolationLevel':db[_0x27d8('0xb9')][_0x27d8('0xbb')][_0x27d8('0xbc')]['READ_COMMITTED']},function(_0x126dbf){return db[_0x27d8('0x3e')]['findOne']({'where':{'id':_0x2f3a56},'transaction':_0x126dbf})[_0x27d8('0x35')](function(_0x2e3bc5){if(_0x2e3bc5){return db[_0x27d8('0x70')][_0x27d8('0x38')]({'where':{'SmsAccountId':_0x2f3a56},'transaction':_0x126dbf})[_0x27d8('0x35')](function(){var _0x315c4a=_['map'](_0x5b0c10,function(_0x15cdf7){_0x15cdf7['SmsAccountId']=_0x2f3a56;return _0x15cdf7;});return db['SmsApplication']['bulkCreate'](_0x315c4a,{'transaction':_0x126dbf});});}else{_0x4867ad=0x194;_0x5ca371=[];}});})[_0x27d8('0x35')](function(){if(_0x4867ad!==0x194){return db['SmsApplication'][_0x27d8('0xbd')]({'where':{'SmsAccountId':_0x2f3a56},'order':'priority'})['then'](function(_0x44905f){_0x5ca371=_0x44905f;});}})[_0x27d8('0x58')](function(_0x418afd){_0x4867ad=0x1f4;logger[_0x27d8('0x24')](_0x418afd[_0x27d8('0x39')]);if(_0x418afd[_0x27d8('0x43')]){delete _0x418afd['name'];}_0x5ca371=_0x418afd;})[_0x27d8('0xbe')](function(){if(_0x5ca371===null){_0x390d7b[_0x27d8('0x29')](_0x4867ad);}else{if(_0x4867ad===0x1f4){_0x390d7b[_0x27d8('0x2b')](_0x4867ad)[_0x27d8('0x3a')](_0x5ca371);}else{_0x390d7b[_0x27d8('0x2b')](_0x4867ad)[_0x27d8('0x2c')](_0x5ca371);}}});};exports[_0x27d8('0xbf')]=function(_0x57a809,_0x4d11c6,_0x5726e0){var _0x4f03b6={};var _0xdebd90={};var _0x17e30d;var _0x1f32f0;return db[_0x27d8('0x3e')][_0x27d8('0x67')]({'where':{'id':_0x57a809[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x4d11c6,null))[_0x27d8('0x35')](function(_0x433a73){if(_0x433a73){_0x17e30d=_0x433a73;_0xdebd90[_0x27d8('0x42')]=_[_0x27d8('0x45')](db[_0x27d8('0x70')][_0x27d8('0x3f')]);_0xdebd90[_0x27d8('0x44')]=_['keys'](_0x57a809[_0x27d8('0x44')]);_0xdebd90[_0x27d8('0x46')]=_[_0x27d8('0x48')](_0xdebd90[_0x27d8('0x42')],_0xdebd90['query']);_0x4f03b6[_0x27d8('0x47')]=_['intersection'](_0xdebd90['model'],qs[_0x27d8('0x49')](_0x57a809[_0x27d8('0x44')][_0x27d8('0x49')]));_0x4f03b6[_0x27d8('0x47')]=_0x4f03b6[_0x27d8('0x47')][_0x27d8('0x4a')]?_0x4f03b6['attributes']:_0xdebd90['model'];_0x4f03b6['order']=qs[_0x27d8('0x4f')](_0x57a809[_0x27d8('0x44')]['sort']);_0x4f03b6[_0x27d8('0x50')]=qs[_0x27d8('0x46')](_[_0x27d8('0x51')](_0x57a809[_0x27d8('0x44')],_0xdebd90[_0x27d8('0x46')]));if(_0x57a809[_0x27d8('0x44')]['filter']){_0x4f03b6[_0x27d8('0x50')]=_[_0x27d8('0x52')](_0x4f03b6[_0x27d8('0x50')],{'$or':_[_0x27d8('0x3d')](_0x4f03b6[_0x27d8('0x47')],function(_0x2a61a3){var _0x38f94d={};_0x38f94d[_0x2a61a3]={'$like':'%'+_0x57a809[_0x27d8('0x44')][_0x27d8('0x54')]+'%'};return _0x38f94d;})});}_0x4f03b6=_[_0x27d8('0x52')]({},_0x4f03b6,_0x57a809[_0x27d8('0x55')]);return _0x17e30d[_0x27d8('0xbf')](_0x4f03b6);}})['then'](function(_0x44475d){if(_0x44475d){_0x1f32f0=_0x44475d[_0x27d8('0x4a')];if(!_0x57a809[_0x27d8('0x44')]['hasOwnProperty'](_0x27d8('0x4c'))){_0x4f03b6[_0x27d8('0x4d')]=qs[_0x27d8('0x4d')](_0x57a809['query'][_0x27d8('0x4d')]);_0x4f03b6[_0x27d8('0x2d')]=qs[_0x27d8('0x2d')](_0x57a809[_0x27d8('0x44')][_0x27d8('0x2d')]);}return _0x17e30d[_0x27d8('0xbf')](_0x4f03b6);}})[_0x27d8('0x35')](function(_0x365ba7){if(_0x365ba7){return _0x365ba7?{'count':_0x1f32f0,'rows':_0x365ba7}:null;}})['then'](respondWithResult(_0x4d11c6,null))[_0x27d8('0x58')](handleError(_0x4d11c6,null));};exports['getInteractions']=function(_0x16ef47,_0xafe29f,_0x59cdbe){var _0x73c594={'raw':![],'where':{}};var _0xa18c7e={};var _0x3a2560={'count':0x0,'rows':[]};return db[_0x27d8('0x3e')]['findOne']({'where':{'id':_0x16ef47['params']['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0xafe29f,null))[_0x27d8('0x35')](function(_0x42d05b){if(_0x42d05b){_0xa18c7e[_0x27d8('0x42')]=_[_0x27d8('0x45')](db[_0x27d8('0x9e')][_0x27d8('0x3f')]);_0xa18c7e[_0x27d8('0x44')]=_[_0x27d8('0x45')](_0x16ef47[_0x27d8('0x44')]);_0xa18c7e['filters']=_['intersection'](_0xa18c7e['model'],_0xa18c7e['query']);_0x73c594[_0x27d8('0x47')]=_[_0x27d8('0x48')](_0xa18c7e[_0x27d8('0x42')],qs[_0x27d8('0x49')](_0x16ef47[_0x27d8('0x44')]['fields']));_0x73c594['attributes']=_0x73c594['attributes']['length']?_0x73c594['attributes']:_0xa18c7e[_0x27d8('0x42')];if(!_0x16ef47[_0x27d8('0x44')][_0x27d8('0x4b')](_0x27d8('0x4c'))){_0x73c594[_0x27d8('0x4d')]=qs['limit'](_0x16ef47[_0x27d8('0x44')][_0x27d8('0x4d')]);_0x73c594['offset']=qs[_0x27d8('0x2d')](_0x16ef47[_0x27d8('0x44')][_0x27d8('0x2d')]);}_0x73c594[_0x27d8('0x4e')]=qs[_0x27d8('0x4f')](_0x16ef47[_0x27d8('0x44')][_0x27d8('0x4f')]);_0x73c594[_0x27d8('0x50')]=qs[_0x27d8('0x46')](_['pick'](_0x16ef47[_0x27d8('0x44')],_0xa18c7e[_0x27d8('0x46')]));_0x73c594['where'][_0x27d8('0x65')]=_0x42d05b['id'];if(_0x16ef47[_0x27d8('0x44')][_0x27d8('0x54')]){_0x73c594['where']=_[_0x27d8('0x52')](_0x73c594[_0x27d8('0x50')],{'$or':_[_0x27d8('0x3d')](_0x73c594[_0x27d8('0x47')],function(_0x5ce88a){var _0x5d9849={};_0x5d9849[_0x5ce88a]={'$like':'%'+_0x16ef47[_0x27d8('0x44')][_0x27d8('0x54')]+'%'};return _0x5d9849;})});}_0x73c594=_[_0x27d8('0x52')]({},_0x73c594,_0x16ef47[_0x27d8('0x55')]);return db[_0x27d8('0x9e')]['count']({'where':_0x73c594[_0x27d8('0x50')]})[_0x27d8('0x35')](function(_0x337067){_0x3a2560['count']=_0x337067;if(_0x16ef47[_0x27d8('0x44')]['includeAll']){_0x73c594[_0x27d8('0x5a')]=[{'model':db[_0x27d8('0x75')],'as':_0x27d8('0xc0'),'required':![]},{'model':db['User'],'as':_0x27d8('0xc1'),'attributes':['name','fullname',_0x27d8('0xc2')],'required':![]},{'model':db[_0x27d8('0xc3')],'as':_0x27d8('0xc4'),'attributes':['id',_0x27d8('0x43'),'color'],'where':_0x16ef47[_0x27d8('0x44')]['tag']?{'id':_0x16ef47[_0x27d8('0x44')][_0x27d8('0xc5')]}:undefined,'required':_0x16ef47['query'][_0x27d8('0xc5')]?!![]:![]}];}return db[_0x27d8('0x9e')][_0x27d8('0x57')](_0x73c594);})['then'](function(_0x6251de){_0x3a2560[_0x27d8('0x68')]=_0x6251de;return _0x3a2560;});}})['then'](respondWithFilteredResult(_0xafe29f,_0x73c594))['catch'](handleError(_0xafe29f,null));};exports[_0x27d8('0x3a')]=function(_0x51a7de,_0x396ca6,_0x413443){var _0x1cbb9d,_0x5a458a,_0x2cbe9c;if(_['isNil'](_0x51a7de[_0x27d8('0x5d')][_0x27d8('0x5d')])||_0x51a7de[_0x27d8('0x5d')][_0x27d8('0x5d')]===''){throw new db['Sequelize'][(_0x27d8('0x76'))](_0x27d8('0xc6'));}if(_[_0x27d8('0x92')](_0x51a7de['body']['to'])){throw new db[(_0x27d8('0x94'))][(_0x27d8('0x76'))](_0x27d8('0xc7'));}_0x1cbb9d=_0x51a7de[_0x27d8('0x5d')]['to'];return db[_0x27d8('0x3e')][_0x27d8('0x5b')]({'where':{'id':_0x51a7de['params']['id']},'include':[{'model':db[_0x27d8('0xc8')],'as':'List','include':[{'model':db[_0x27d8('0x75')],'as':'Contacts','where':{'mobile':_0x1cbb9d},'limit':0x1,'order':[[_0x27d8('0x79'),_0x27d8('0x9a')]]}]}]})[_0x27d8('0x35')](handleEntityNotFound(_0x396ca6,null))[_0x27d8('0x35')](function(_0x360ce3){if(_0x360ce3&&_0x360ce3[_0x27d8('0xc9')]){_0x5a458a=_0x360ce3['get']({'plain':!![]});if(_0x5a458a[_0x27d8('0xc9')]&&_0x5a458a[_0x27d8('0xc9')]['Contacts'][_0x27d8('0x4a')]){return _0x5a458a['List'][_0x27d8('0x99')][0x0];}return db['CmContact']['create'](_['defaults'](_0x51a7de[_0x27d8('0x5d')],{'firstName':_0x1cbb9d,'mobile':_0x1cbb9d,'phone':_0x1cbb9d,'ListId':_0x5a458a['ListId']}));}})[_0x27d8('0x35')](handleEntityNotFound(_0x396ca6,null))[_0x27d8('0x35')](function(_0x15f9fc){if(_0x15f9fc){_0x2cbe9c=_0x15f9fc;return db[_0x27d8('0x9e')][_0x27d8('0x5b')]({'where':{'ContactId':_0x2cbe9c['id'],'closed':![],'SmsAccountId':_0x5a458a['id']}})[_0x27d8('0x35')](function(_0x3cc329){if(_0x3cc329){return[_0x3cc329,![]];}return db[_0x27d8('0x9e')][_0x27d8('0x5c')]({'UserId':_0x51a7de['user']['id'],'ContactId':_0x2cbe9c['id'],'SmsAccountId':_0x5a458a['id'],'phone':_0x1cbb9d,'firstMsgDirection':_0x27d8('0xca'),'Messages':[_[_0x27d8('0x52')](_0x51a7de[_0x27d8('0x5d')],{'read':![],'body':_0x51a7de[_0x27d8('0x5d')][_0x27d8('0x5d')],'phone':_0x1cbb9d,'SmsAccountId':_0x5a458a['id'],'UserId':_0x51a7de['user']['id'],'ContactId':_0x2cbe9c['id']})]},{'include':[{'model':db[_0x27d8('0xa4')],'as':_0x27d8('0xcb')}]})[_0x27d8('0x35')](function(_0x2c77be){return[_0x2c77be,!![]];});});}})['spread'](function(_0x35bccd,_0x46fe56){if(_0x46fe56){return _0x35bccd;}return db[_0x27d8('0xa4')]['create'](_[_0x27d8('0x52')](_0x51a7de[_0x27d8('0x5d')],{'read':![],'body':_0x51a7de[_0x27d8('0x5d')][_0x27d8('0x5d')],'phone':_0x1cbb9d,'SmsAccountId':_0x5a458a['id'],'SmsInteractionId':_0x35bccd['id'],'UserId':_0x51a7de[_0x27d8('0x5e')]['id'],'ContactId':_0x2cbe9c['id']}))['then'](function(_0x1862a1){_0x35bccd['dataValues'][_0x27d8('0xcb')]=[];_0x35bccd[_0x27d8('0xcc')][_0x27d8('0xcb')]['push'](_0x1862a1[_0x27d8('0xcc')]);return _0x35bccd;});})[_0x27d8('0x35')](respondWithResult(_0x396ca6,null))['catch'](handleError(_0x396ca6,null));};exports[_0x27d8('0x2b')]=function(_0x46bb76,_0x3363ab,_0x54f96d){if(_0x46bb76[_0x27d8('0x5d')]['id']){delete _0x46bb76[_0x27d8('0x5d')]['id'];}var _0x1c3560,_0x4cdd61,_0x5cbef8;return db[_0x27d8('0x3e')]['find']({'where':{'id':_0x46bb76[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x3363ab,null))[_0x27d8('0x35')](function(_0x40395d){if(_0x40395d){_0x5cbef8=_0x40395d;logger[_0x27d8('0x22')](_0x27d8('0xb2'),_0x27d8('0x2b'),_0x27d8('0xcd'),_0x40395d[_0x27d8('0x53')],util[_0x27d8('0xce')](_0x46bb76['body'],{'showHidden':![],'depth':null}));switch(_0x40395d[_0x27d8('0x53')]){case _0x27d8('0x80'):if(_0x46bb76[_0x27d8('0x5d')]['skebby_dispatch_id']&&_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x2b')]){_0x4cdd61=_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x2b')];return db[_0x27d8('0xa4')][_0x27d8('0x5b')]({'where':{'messageId':_0x46bb76[_0x27d8('0x5d')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x46bb76[_0x27d8('0x5d')][_0x27d8('0xcf')]&&_0x46bb76[_0x27d8('0x5d')][_0x27d8('0xd0')]){_0x4cdd61=_0x46bb76[_0x27d8('0x5d')][_0x27d8('0xd0')];return db[_0x27d8('0xa4')][_0x27d8('0x5b')]({'where':{'messageId':_0x46bb76[_0x27d8('0x5d')][_0x27d8('0xcf')]}});}break;case'clicksend':if(_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x85')]&&_0x46bb76[_0x27d8('0x5d')]['status_code']){_0x4cdd61=_0x46bb76[_0x27d8('0x5d')][_0x27d8('0xd1')];return db[_0x27d8('0xa4')][_0x27d8('0x5b')]({'where':{'messageId':_0x46bb76[_0x27d8('0x5d')]['message_id']}});}break;case _0x27d8('0x89'):var _0x1333d8=_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x8a')][0x0];if(_0x1333d8[_0x27d8('0x7e')]&&_0x1333d8[_0x27d8('0x2b')][_0x27d8('0xd2')]===_0x27d8('0xd3')){_0x4cdd61=_0x1333d8[_0x27d8('0x2b')][_0x27d8('0xd2')];return db['SmsMessage']['find']({'where':{'messageId':_0x1333d8[_0x27d8('0x7e')]}});}break;case _0x27d8('0x8d'):if(_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x7e')]&&_0x46bb76[_0x27d8('0x5d')]['status']){_0x4cdd61=_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x2b')];return db[_0x27d8('0xa4')][_0x27d8('0x5b')]({'where':{'messageId':_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x7e')]}});}break;case'bandwidth':if(_0x46bb76['body'][0x0][_0x27d8('0x27')]['id']){_0x4cdd61=_0x46bb76[_0x27d8('0x5d')][0x0]['type'];return db['SmsMessage'][_0x27d8('0x5b')]({'where':{'messageId':_0x46bb76[_0x27d8('0x5d')][0x0][_0x27d8('0x27')]['id']}});}break;case _0x27d8('0x90'):if(_0x46bb76['body']['redif']&&_0x46bb76[_0x27d8('0x5d')][_0x27d8('0x2b')]){_0x4cdd61=_0x46bb76[_0x27d8('0x5d')]['status'];return db[_0x27d8('0xa4')][_0x27d8('0x5b')]({'where':{'messageId':_0x46bb76[_0x27d8('0x5d')][_0x27d8('0xd4')]}});}break;}}})[_0x27d8('0x35')](handleEntityNotFound(_0x3363ab,null))[_0x27d8('0x35')](function(_0x234639){if(_0x234639){_0x1c3560=_0x234639;switch(_0x5cbef8[_0x27d8('0x53')]){case _0x27d8('0x80'):if(_0x4cdd61===_0x27d8('0xd3')){return _0x1c3560['update']({'read':!![]});}else{logger[_0x27d8('0x24')](_0x27d8('0xb2'),_0x27d8('0x2b'),'skebby',util[_0x27d8('0xce')](_0x46bb76['body'],{'showHidden':![],'depth':null}));}break;case _0x27d8('0xd5'):if(_0x4cdd61==='1'){return _0x1c3560['update']({'read':!![]});}else{logger[_0x27d8('0x24')](_0x27d8('0xb2'),_0x27d8('0x2b'),_0x27d8('0x80'),util[_0x27d8('0xce')](_0x46bb76[_0x27d8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x27d8('0x84'):if(!_0x46bb76[_0x27d8('0x5d')][_0x27d8('0xd6')]&&_0x4cdd61>=0xc8&&_0x4cdd61<=0xce){return _0x1c3560[_0x27d8('0x34')]({'read':!![]});}else{logger[_0x27d8('0x24')](_0x27d8('0xb2'),_0x27d8('0x2b'),_0x27d8('0x84'),util['inspect'](_0x46bb76[_0x27d8('0x5d')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x86ce4c=_0x46bb76['body'][_0x27d8('0x8a')][0x0];if(_0x86ce4c['status'][_0x27d8('0xd2')]===_0x27d8('0xd3')){return _0x1c3560[_0x27d8('0x34')]({'read':!![]});}else{logger[_0x27d8('0x24')](_0x27d8('0xb2'),'status',_0x27d8('0x89'),util['inspect'](_0x46bb76[_0x27d8('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4cdd61==_0x27d8('0xd7')||_0x4cdd61==_0x27d8('0xd8')){return _0x1c3560[_0x27d8('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x27d8('0x2b'),_0x27d8('0x8d'),util[_0x27d8('0xce')](_0x46bb76['body'],{'showHidden':![],'depth':null}));}break;case _0x27d8('0x8f'):if(_0x4cdd61=='message-delivered'){return _0x1c3560[_0x27d8('0x34')]({'read':!![]});}else{logger[_0x27d8('0x24')](_0x27d8('0xb2'),_0x27d8('0x2b'),'bandwidth',util['inspect'](_0x46bb76['body'],{'showHidden':![],'depth':null}));}break;case _0x27d8('0x90'):if(_0x4cdd61===_0x27d8('0xd9')||_0x4cdd61==='ACCEPTD'){return _0x1c3560[_0x27d8('0x34')]({'read':!![]});}else{logger[_0x27d8('0x24')](_0x27d8('0xb2'),_0x27d8('0x2b'),'intelepeer',util['inspect'](_0x46bb76[_0x27d8('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x1c3560;}})[_0x27d8('0x35')](respondWithResult(_0x3363ab,null))[_0x27d8('0x58')](handleError(_0x3363ab,null));};exports['statusGet']=function(_0x1b87c4,_0x5603a8,_0x188416){var _0x51491d,_0x359de5,_0x1d13cc;return db[_0x27d8('0x3e')][_0x27d8('0x5b')]({'where':{'id':_0x1b87c4[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x5603a8,null))[_0x27d8('0x35')](function(_0x1a3006){if(_0x1a3006){_0x1d13cc=_0x1a3006;logger['debug'](_0x27d8('0xb2'),_0x27d8('0x2b'),_0x27d8('0xcd'),_0x1a3006[_0x27d8('0x53')],util[_0x27d8('0xce')](_0x1b87c4['query'],{'showHidden':![],'depth':null}));switch(_0x1a3006[_0x27d8('0x53')]){case'csc':if(_0x1b87c4[_0x27d8('0x44')][_0x27d8('0xda')]&&_0x1b87c4[_0x27d8('0x44')][_0x27d8('0xdb')]){_0x359de5=_0x1b87c4['query']['state'];return db[_0x27d8('0xa4')][_0x27d8('0x5b')]({'where':{'messageId':_0x1b87c4['query'][_0x27d8('0xda')]}});}break;}}})[_0x27d8('0x35')](handleEntityNotFound(_0x5603a8,null))[_0x27d8('0x35')](function(_0x238bcd){if(_0x238bcd){_0x51491d=_0x238bcd;switch(_0x1d13cc[_0x27d8('0x53')]){case _0x27d8('0xdc'):if(_0x359de5==='2'||_0x359de5==='6'){return _0x51491d[_0x27d8('0x34')]({'read':!![]});}else{logger['error'](_0x27d8('0xb2'),'status',_0x27d8('0xdc'),util[_0x27d8('0xce')](_0x1b87c4[_0x27d8('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x51491d;}})[_0x27d8('0x35')](respondWithResult(_0x5603a8,null))[_0x27d8('0x58')](handleError(_0x5603a8,null));};exports[_0x27d8('0xdd')]=function(_0x15b23f,_0x5b0554,_0x2536d4){return db[_0x27d8('0x3e')][_0x27d8('0x5b')]({'where':{'id':_0x15b23f[_0x27d8('0x63')]['id']}})['then'](handleEntityNotFound(_0x5b0554,null))[_0x27d8('0x35')](function(_0xb7eea5){if(_0xb7eea5){return _0xb7eea5[_0x27d8('0xdd')](_0x15b23f[_0x27d8('0x5d')]['ids'],_[_0x27d8('0x9c')](_0x15b23f[_0x27d8('0x5d')],['ids','id'])||{})[_0x27d8('0x9f')](function(_0x293600){for(var _0xc2cded=0x0;_0xc2cded<_0x15b23f[_0x27d8('0x5d')][_0x27d8('0x6a')][_0x27d8('0x4a')];_0xc2cded+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x15b23f[_0x27d8('0x5d')][_0x27d8('0x6a')][_0xc2cded]),'SmsAccountId':Number(_0x15b23f[_0x27d8('0x63')]['id'])});}return _0x293600;});}})[_0x27d8('0x35')](respondWithResult(_0x5b0554,null))[_0x27d8('0x58')](handleError(_0x5b0554,null));};exports[_0x27d8('0xde')]=function(_0x95c0cb,_0x16c5f7,_0x1a0f05){return db['SmsAccount'][_0x27d8('0x5b')]({'where':{'id':_0x95c0cb[_0x27d8('0x63')]['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x16c5f7,null))[_0x27d8('0x35')](function(_0x3a3e77){if(_0x3a3e77){return _0x3a3e77[_0x27d8('0xde')](_0x95c0cb[_0x27d8('0x44')]['ids'])['then'](function(){if(_[_0x27d8('0xdf')](_0x95c0cb[_0x27d8('0x44')][_0x27d8('0x6a')])){for(var _0xf407ab=0x0;_0xf407ab<_0x95c0cb['query']['ids'][_0x27d8('0x4a')];_0xf407ab+=0x1){socket['emit'](_0x27d8('0xe0'),{'UserId':Number(_0x95c0cb[_0x27d8('0x44')][_0x27d8('0x6a')][_0xf407ab]),'SmsAccountId':Number(_0x95c0cb[_0x27d8('0x63')]['id'])});}}else{socket[_0x27d8('0xe1')](_0x27d8('0xe0'),{'UserId':Number(_0x95c0cb['query'][_0x27d8('0x6a')]),'SmsAccountId':Number(_0x95c0cb[_0x27d8('0x63')]['id'])});}});}})[_0x27d8('0x35')](respondWithStatusCode(_0x16c5f7,null))[_0x27d8('0x58')](handleError(_0x16c5f7,null));};exports[_0x27d8('0xe2')]=function(_0x19c538,_0x2595d8,_0x3e6a72){var _0x52c40e={};var _0xad42ab={};var _0x512322;var _0x557e27;return db[_0x27d8('0x3e')][_0x27d8('0x67')]({'where':{'id':_0x19c538['params']['id']}})[_0x27d8('0x35')](handleEntityNotFound(_0x2595d8,null))[_0x27d8('0x35')](function(_0x52f86e){if(_0x52f86e){_0x512322=_0x52f86e;_0xad42ab[_0x27d8('0x42')]=_[_0x27d8('0x45')](db[_0x27d8('0xa8')]['rawAttributes']);_0xad42ab['query']=_[_0x27d8('0x45')](_0x19c538[_0x27d8('0x44')]);_0xad42ab[_0x27d8('0x46')]=_[_0x27d8('0x48')](_0xad42ab[_0x27d8('0x42')],_0xad42ab[_0x27d8('0x44')]);_0x52c40e['attributes']=_[_0x27d8('0x48')](_0xad42ab[_0x27d8('0x42')],qs['fields'](_0x19c538['query'][_0x27d8('0x49')]));_0x52c40e['attributes']=_0x52c40e[_0x27d8('0x47')][_0x27d8('0x4a')]?_0x52c40e[_0x27d8('0x47')]:_0xad42ab[_0x27d8('0x42')];_0x52c40e['order']=qs['sort'](_0x19c538[_0x27d8('0x44')][_0x27d8('0x4f')]);_0x52c40e[_0x27d8('0x50')]=qs[_0x27d8('0x46')](_['pick'](_0x19c538[_0x27d8('0x44')],_0xad42ab[_0x27d8('0x46')]));if(_0x19c538[_0x27d8('0x44')][_0x27d8('0x54')]){_0x52c40e[_0x27d8('0x50')]=_[_0x27d8('0x52')](_0x52c40e[_0x27d8('0x50')],{'$or':_[_0x27d8('0x3d')](_0x52c40e['attributes'],function(_0x1d9832){var _0x94227a={};_0x94227a[_0x1d9832]={'$like':'%'+_0x19c538[_0x27d8('0x44')][_0x27d8('0x54')]+'%'};return _0x94227a;})});}_0x52c40e=_[_0x27d8('0x52')]({},_0x52c40e,_0x19c538[_0x27d8('0x55')]);return _0x512322['getAgents'](_0x52c40e);}})['then'](function(_0x3c339e){if(_0x3c339e){_0x557e27=_0x3c339e[_0x27d8('0x4a')];if(!_0x19c538[_0x27d8('0x44')][_0x27d8('0x4b')]('nolimit')){_0x52c40e[_0x27d8('0x4d')]=qs['limit'](_0x19c538[_0x27d8('0x44')]['limit']);_0x52c40e['offset']=qs[_0x27d8('0x2d')](_0x19c538[_0x27d8('0x44')][_0x27d8('0x2d')]);}return _0x512322[_0x27d8('0xe2')](_0x52c40e);}})[_0x27d8('0x35')](function(_0x1a4b80){if(_0x1a4b80){return _0x1a4b80?{'count':_0x557e27,'rows':_0x1a4b80}:null;}})[_0x27d8('0x35')](respondWithResult(_0x2595d8,null))['catch'](handleError(_0x2595d8,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index aaa25d9..99a3c83 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 _0x6e60=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6e60,0x105));var _0x06e6=function(_0x57ba8c,_0x27fe76){_0x57ba8c=_0x57ba8c-0x0;var _0x26fa08=_0x6e60[_0x57ba8c];return _0x26fa08;};'use strict';var EventEmitter=require(_0x06e6('0x0'));var SmsAccount=require(_0x06e6('0x1'))['db'][_0x06e6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x06e6('0x3')](0x0);var events={'afterCreate':_0x06e6('0x4'),'afterUpdate':_0x06e6('0x5'),'afterDestroy':_0x06e6('0x6')};function emitEvent(_0x279bfd){return function(_0x125ed5,_0x12a31b,_0x1e7364){SmsAccountEvents[_0x06e6('0x7')](_0x279bfd+':'+_0x125ed5['id'],_0x125ed5);SmsAccountEvents[_0x06e6('0x7')](_0x279bfd,_0x125ed5);_0x1e7364(null);};}for(var e in events){if(events[_0x06e6('0x8')](e)){var event=events[e];SmsAccount[_0x06e6('0x9')](e,emitEvent(event));}}module[_0x06e6('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x9825=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9825,0xe3));var _0x5982=function(_0x3cdd5e,_0x98ad6a){_0x3cdd5e=_0x3cdd5e-0x0;var _0x145520=_0x9825[_0x3cdd5e];return _0x145520;};'use strict';var EventEmitter=require(_0x5982('0x0'));var SmsAccount=require(_0x5982('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5982('0x2'),'afterUpdate':'update','afterDestroy':_0x5982('0x3')};function emitEvent(_0x48862d){return function(_0xe7f504,_0x8f75d9,_0x509b88){SmsAccountEvents['emit'](_0x48862d+':'+_0xe7f504['id'],_0xe7f504);SmsAccountEvents['emit'](_0x48862d,_0xe7f504);_0x509b88(null);};}for(var e in events){if(events[_0x5982('0x4')](e)){var event=events[e];SmsAccount[_0x5982('0x5')](e,emitEvent(event));}}module[_0x5982('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d83950f..bb016a9 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 _0x4db9=['bluebird','request-promise','rimraf','./smsAccount.attributes','SmsAccount','lodash','util','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4db9,0x1d9));var _0x94db=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x4db9[_0x151721];return _0x2deaa7;};'use strict';var _=require(_0x94db('0x0'));var util=require(_0x94db('0x1'));var logger=require(_0x94db('0x2'))(_0x94db('0x3'));var moment=require('moment');var BPromise=require(_0x94db('0x4'));var rp=require(_0x94db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94db('0x6'));var config=require('../../config/environment');var attributes=require(_0x94db('0x7'));module['exports']=function(_0x4630b3,_0x442158){return _0x4630b3['define'](_0x94db('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef40=['SmsAccount','sms_accounts','util','../../config/logger','api','request-promise','path','../../config/environment','./smsAccount.attributes','define'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xef40,0x110));var _0x0ef4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef40[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0ef4('0x0'));var logger=require(_0x0ef4('0x1'))(_0x0ef4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ef4('0x3'));var fs=require('fs');var path=require(_0x0ef4('0x4'));var rimraf=require('rimraf');var config=require(_0x0ef4('0x5'));var attributes=require(_0x0ef4('0x6'));module['exports']=function(_0x1cbc44,_0x24e483){return _0x1cbc44[_0x0ef4('0x7')](_0x0ef4('0x8'),attributes,{'tableName':_0x0ef4('0x9'),'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 028fb62..e990883 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 _0xdaaf=['include','attributes','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','socket.io-emitter','redis','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','map'];(function(_0x341519,_0x5c2df4){var _0x308e6c=function(_0x29ca8e){while(--_0x29ca8e){_0x341519['push'](_0x341519['shift']());}};_0x308e6c(++_0x5c2df4);}(_0xdaaf,0x1af));var _0xfdaa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdaaf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xfdaa('0x0'));var util=require('util');var moment=require(_0xfdaa('0x1'));var BPromise=require('bluebird');var rs=require(_0xfdaa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdaa('0x3'))['db'];var utils=require(_0xfdaa('0x4'));var logger=require(_0xfdaa('0x5'))('rpc');var config=require(_0xfdaa('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfdaa('0x7')]({'port':0x232a});config['redis']=_[_0xfdaa('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfdaa('0x9'))(new Redis(config[_0xfdaa('0xa')]));require(_0xfdaa('0xb'))[_0xfdaa('0xc')](socket);function respondWithRpcPromise(_0x5618fe,_0x41462c,_0x30d434){return new BPromise(function(_0x38a239,_0x1b03cf){return client[_0xfdaa('0xd')](_0x5618fe,_0x30d434)[_0xfdaa('0xe')](function(_0x593685){logger['info'](_0xfdaa('0xf'),_0x41462c,_0xfdaa('0x10'));logger[_0xfdaa('0x11')](_0xfdaa('0x12'),_0x41462c,_0xfdaa('0x10'),JSON[_0xfdaa('0x13')](_0x593685));if(_0x593685[_0xfdaa('0x14')]){if(_0x593685[_0xfdaa('0x14')]['code']===0x1f4){logger[_0xfdaa('0x14')](_0xfdaa('0xf'),_0x41462c,_0x593685['error'][_0xfdaa('0x15')]);return _0x1b03cf(_0x593685[_0xfdaa('0x14')]['message']);}logger[_0xfdaa('0x14')]('SmsAccount,\x20%s,\x20%s',_0x41462c,_0x593685[_0xfdaa('0x14')][_0xfdaa('0x15')]);return _0x38a239(_0x593685[_0xfdaa('0x14')][_0xfdaa('0x15')]);}else{logger[_0xfdaa('0x16')]('SmsAccount,\x20%s,\x20%s',_0x41462c,_0xfdaa('0x10'));_0x38a239(_0x593685[_0xfdaa('0x17')][_0xfdaa('0x15')]);}})[_0xfdaa('0x18')](function(_0x3f333f){logger[_0xfdaa('0x14')](_0xfdaa('0xf'),_0x41462c,_0x3f333f);_0x1b03cf(_0x3f333f);});});}exports[_0xfdaa('0x19')]=function(_0x5d37fa){var _0x5342c6=this;return new Promise(function(_0x2243c1,_0x6e2de1){return db[_0xfdaa('0x1a')][_0xfdaa('0x1b')]({'raw':_0x5d37fa[_0xfdaa('0x1c')]?_0x5d37fa[_0xfdaa('0x1c')][_0xfdaa('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d37fa[_0xfdaa('0x1c')]?_0x5d37fa[_0xfdaa('0x1c')]['where']||null:null,'attributes':_0x5d37fa['options']?_0x5d37fa['options']['attributes']||null:null,'include':_0x5d37fa['options']?_0x5d37fa['options']['include']?_[_0xfdaa('0x1e')](_0x5d37fa[_0xfdaa('0x1c')][_0xfdaa('0x1f')],function(_0x1d393f){return{'model':db[_0x1d393f['model']],'as':_0x1d393f['as'],'attributes':_0x1d393f[_0xfdaa('0x20')],'include':_0x1d393f[_0xfdaa('0x1f')]?_[_0xfdaa('0x1e')](_0x1d393f[_0xfdaa('0x1f')],function(_0x151e95){return{'model':db[_0x151e95['model']],'as':_0x151e95['as'],'attributes':_0x151e95[_0xfdaa('0x20')],'include':_0x151e95[_0xfdaa('0x1f')]?_['map'](_0x151e95[_0xfdaa('0x1f')],function(_0x3ca9ad){return{'model':db[_0x3ca9ad['model']],'as':_0x3ca9ad['as'],'attributes':_0x3ca9ad[_0xfdaa('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x122fdc){logger[_0xfdaa('0x16')](_0xfdaa('0x19'),_0x5d37fa);logger[_0xfdaa('0x11')]('ShowSmsAccount',_0x5d37fa,JSON[_0xfdaa('0x13')](_0x122fdc));_0x2243c1(_0x122fdc);})['catch'](function(_0xe75e2f){logger[_0xfdaa('0x14')](_0xfdaa('0x19'),_0xe75e2f[_0xfdaa('0x15')],_0x5d37fa);_0x6e2de1(_0x5342c6[_0xfdaa('0x14')](0x1f4,_0xe75e2f[_0xfdaa('0x15')]));});});}; \ No newline at end of file +var _0xf5e8=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','include','map','model','attributes','lodash'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf5e8,0x17b));var _0x8f5e=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xf5e8[_0x173f10];return _0x53142d;};'use strict';var _=require(_0x8f5e('0x0'));var util=require(_0x8f5e('0x1'));var moment=require('moment');var BPromise=require(_0x8f5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f5e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f5e('0x4'))(_0x8f5e('0x5'));var config=require(_0x8f5e('0x6'));var jayson=require(_0x8f5e('0x7'));var client=jayson[_0x8f5e('0x8')]['http']({'port':0x232a});config['redis']=_[_0x8f5e('0x9')](config['redis'],{'host':_0x8f5e('0xa'),'port':0x18eb});var socket=require(_0x8f5e('0xb'))(new Redis(config[_0x8f5e('0xc')]));require(_0x8f5e('0xd'))[_0x8f5e('0xe')](socket);function respondWithRpcPromise(_0x27ceb6,_0x4756ca,_0x4fab2a){return new BPromise(function(_0x2ea165,_0x2c63e6){return client[_0x8f5e('0xf')](_0x27ceb6,_0x4fab2a)[_0x8f5e('0x10')](function(_0x5c63ff){logger[_0x8f5e('0x11')]('SmsAccount,\x20%s,\x20%s',_0x4756ca,'request\x20sent');logger[_0x8f5e('0x12')](_0x8f5e('0x13'),_0x4756ca,_0x8f5e('0x14'),JSON[_0x8f5e('0x15')](_0x5c63ff));if(_0x5c63ff[_0x8f5e('0x16')]){if(_0x5c63ff[_0x8f5e('0x16')][_0x8f5e('0x17')]===0x1f4){logger[_0x8f5e('0x16')](_0x8f5e('0x18'),_0x4756ca,_0x5c63ff['error'][_0x8f5e('0x19')]);return _0x2c63e6(_0x5c63ff[_0x8f5e('0x16')][_0x8f5e('0x19')]);}logger[_0x8f5e('0x16')](_0x8f5e('0x18'),_0x4756ca,_0x5c63ff[_0x8f5e('0x16')]['message']);return _0x2ea165(_0x5c63ff[_0x8f5e('0x16')][_0x8f5e('0x19')]);}else{logger[_0x8f5e('0x11')](_0x8f5e('0x18'),_0x4756ca,_0x8f5e('0x14'));_0x2ea165(_0x5c63ff[_0x8f5e('0x1a')][_0x8f5e('0x19')]);}})[_0x8f5e('0x1b')](function(_0x2218fa){logger[_0x8f5e('0x16')](_0x8f5e('0x18'),_0x4756ca,_0x2218fa);_0x2c63e6(_0x2218fa);});});}exports[_0x8f5e('0x1c')]=function(_0x5eb1b0){var _0x17b158=this;return new Promise(function(_0x518d5f,_0x3e12dd){return db[_0x8f5e('0x1d')][_0x8f5e('0x1e')]({'raw':_0x5eb1b0['options']?_0x5eb1b0['options'][_0x8f5e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5eb1b0[_0x8f5e('0x20')]?_0x5eb1b0[_0x8f5e('0x20')][_0x8f5e('0x21')]||null:null,'attributes':_0x5eb1b0[_0x8f5e('0x20')]?_0x5eb1b0[_0x8f5e('0x20')]['attributes']||null:null,'include':_0x5eb1b0['options']?_0x5eb1b0[_0x8f5e('0x20')][_0x8f5e('0x22')]?_[_0x8f5e('0x23')](_0x5eb1b0['options'][_0x8f5e('0x22')],function(_0x6d67f5){return{'model':db[_0x6d67f5[_0x8f5e('0x24')]],'as':_0x6d67f5['as'],'attributes':_0x6d67f5[_0x8f5e('0x25')],'include':_0x6d67f5[_0x8f5e('0x22')]?_['map'](_0x6d67f5[_0x8f5e('0x22')],function(_0x14e99a){return{'model':db[_0x14e99a[_0x8f5e('0x24')]],'as':_0x14e99a['as'],'attributes':_0x14e99a[_0x8f5e('0x25')],'include':_0x14e99a[_0x8f5e('0x22')]?_[_0x8f5e('0x23')](_0x14e99a[_0x8f5e('0x22')],function(_0x409b2c){return{'model':db[_0x409b2c[_0x8f5e('0x24')]],'as':_0x409b2c['as'],'attributes':_0x409b2c['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f5e('0x10')](function(_0x1fb927){logger[_0x8f5e('0x11')](_0x8f5e('0x1c'),_0x5eb1b0);logger[_0x8f5e('0x12')](_0x8f5e('0x1c'),_0x5eb1b0,JSON[_0x8f5e('0x15')](_0x1fb927));_0x518d5f(_0x1fb927);})[_0x8f5e('0x1b')](function(_0x504b7d){logger['error']('ShowSmsAccount',_0x504b7d[_0x8f5e('0x19')],_0x5eb1b0);_0x3e12dd(_0x17b158[_0x8f5e('0x16')](0x1f4,_0x504b7d[_0x8f5e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ae0d4e1..5a1de55 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 0f12146..760297a 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x4cca27,_0x18e06f){var _0x3d8219=function(_0x2ba31b){while(--_0x2ba31b){_0x4cca27['push'](_0x4cca27['shift']());}};_0x3d8219(++_0x18e06f);}(_0x3e74,0x175));var _0x43e7=function(_0x3ead8a,_0x345299){_0x3ead8a=_0x3ead8a-0x0;var _0x2be942=_0x3e74[_0x3ead8a];return _0x2be942;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x5a8543,_0x57619c){var _0x2cedf3=function(_0xfcaf7){while(--_0xfcaf7){_0x5a8543['push'](_0x5a8543['shift']());}};_0x2cedf3(++_0x57619c);}(_0xe14b,0x93));var _0xbe14=function(_0x5442da,_0x5253b0){_0x5442da=_0x5442da-0x0;var _0x5bee3b=_0xe14b[_0x5442da];return _0x5bee3b;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1c575df..dc53891 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 _0xd2af=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x4c08c5,_0x47bba6){var _0x311d93=function(_0x5f28c6){while(--_0x5f28c6){_0x4c08c5['push'](_0x4c08c5['shift']());}};_0x311d93(++_0x47bba6);}(_0xd2af,0x1c5));var _0xfd2a=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0xd2af[_0x3f25db];return _0x54f29d;};'use strict';var Sequelize=require(_0xfd2a('0x0'));module[_0xfd2a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfd2a('0x2')],'allowNull':![],'defaultValue':_0xfd2a('0x3')},'appdata':{'type':Sequelize[_0xfd2a('0x4')]()},'description':{'type':Sequelize[_0xfd2a('0x2')]},'interval':{'type':Sequelize[_0xfd2a('0x2')],'defaultValue':_0xfd2a('0x5')}}; \ No newline at end of file +var _0xb748=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x48697a,_0x3264b2){var _0x24af1a=function(_0x265e7e){while(--_0x265e7e){_0x48697a['push'](_0x48697a['shift']());}};_0x24af1a(++_0x3264b2);}(_0xb748,0x88));var _0x8b74=function(_0x3045a8,_0x2a8ed9){_0x3045a8=_0x3045a8-0x0;var _0x19a514=_0xb748[_0x3045a8];return _0x19a514;};'use strict';var Sequelize=require(_0x8b74('0x0'));module[_0x8b74('0x1')]={'priority':{'type':Sequelize[_0x8b74('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8b74('0x3')],'allowNull':![],'defaultValue':_0x8b74('0x4')},'appdata':{'type':Sequelize[_0x8b74('0x5')]()},'description':{'type':Sequelize[_0x8b74('0x3')]},'interval':{'type':Sequelize[_0x8b74('0x3')],'defaultValue':_0x8b74('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b1c5a04..3637298 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 _0x5d42=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsApplication','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x11df49,_0x31ab0b){var _0x299835=function(_0x46c3a8){while(--_0x46c3a8){_0x11df49['push'](_0x11df49['shift']());}};_0x299835(++_0x31ab0b);}(_0x5d42,0x13a));var _0x25d4=function(_0x5c320e,_0x33b919){_0x5c320e=_0x5c320e-0x0;var _0x1bcd2d=_0x5d42[_0x5c320e];return _0x1bcd2d;};'use strict';var emlformat=require(_0x25d4('0x0'));var rimraf=require(_0x25d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25d4('0x2'));var rp=require(_0x25d4('0x3'));var moment=require(_0x25d4('0x4'));var BPromise=require(_0x25d4('0x5'));var Mustache=require(_0x25d4('0x6'));var util=require(_0x25d4('0x7'));var path=require(_0x25d4('0x8'));var sox=require(_0x25d4('0x9'));var csv=require(_0x25d4('0xa'));var ejs=require(_0x25d4('0xb'));var fs=require('fs');var fs_extra=require(_0x25d4('0xc'));var _=require(_0x25d4('0xd'));var squel=require(_0x25d4('0xe'));var crypto=require('crypto');var jsforce=require(_0x25d4('0xf'));var deskjs=require(_0x25d4('0x10'));var toCsv=require(_0x25d4('0xa'));var querystring=require(_0x25d4('0x11'));var Papa=require('papaparse');var Redis=require(_0x25d4('0x12'));var authService=require(_0x25d4('0x13'));var qs=require(_0x25d4('0x14'));var as=require(_0x25d4('0x15'));var hardwareService=require(_0x25d4('0x16'));var logger=require(_0x25d4('0x17'))(_0x25d4('0x18'));var utils=require('../../config/utils');var config=require(_0x25d4('0x19'));var licenseUtil=require(_0x25d4('0x1a'));var db=require(_0x25d4('0x1b'))['db'];function respondWithStatusCode(_0xf6b4aa,_0x44bb81){_0x44bb81=_0x44bb81||0xcc;return function(_0x4284d5){if(_0x4284d5){return _0xf6b4aa['sendStatus'](_0x44bb81);}return _0xf6b4aa['status'](_0x44bb81)[_0x25d4('0x1c')]();};}function respondWithResult(_0x11a319,_0x5e0b19){_0x5e0b19=_0x5e0b19||0xc8;return function(_0x515bef){if(_0x515bef){return _0x11a319[_0x25d4('0x1d')](_0x5e0b19)[_0x25d4('0x1e')](_0x515bef);}};}function respondWithFilteredResult(_0x58fa94,_0x12a3d4){return function(_0x425cd3){if(_0x425cd3){var _0x53352d=typeof _0x12a3d4[_0x25d4('0x1f')]===_0x25d4('0x20')&&typeof _0x12a3d4['limit']===_0x25d4('0x20');var _0x45e141=_0x425cd3[_0x25d4('0x21')];var _0x507313=_0x53352d?0x0:_0x12a3d4[_0x25d4('0x1f')];var _0x2076d7=_0x53352d?_0x425cd3[_0x25d4('0x21')]:_0x12a3d4['offset']+_0x12a3d4[_0x25d4('0x22')];var _0x907f63;if(_0x2076d7>=_0x45e141){_0x2076d7=_0x45e141;_0x907f63=0xc8;}else{_0x907f63=0xce;}_0x58fa94[_0x25d4('0x1d')](_0x907f63);return _0x58fa94[_0x25d4('0x23')](_0x25d4('0x24'),_0x507313+'-'+_0x2076d7+'/'+_0x45e141)[_0x25d4('0x1e')](_0x425cd3);}return null;};}function patchUpdates(_0xc1fc5c){return function(_0x4aeb95){try{jsonpatch['apply'](_0x4aeb95,_0xc1fc5c,!![]);}catch(_0x968b18){return BPromise[_0x25d4('0x25')](_0x968b18);}return _0x4aeb95[_0x25d4('0x26')]();};}function saveUpdates(_0xbbc1d6,_0x36c374){return function(_0x53ab67){if(_0x53ab67){return _0x53ab67[_0x25d4('0x27')](_0xbbc1d6)['then'](function(_0x5e466d){return _0x5e466d;});}return null;};}function removeEntity(_0x366543,_0x1a16ce){return function(_0x46804c){if(_0x46804c){return _0x46804c[_0x25d4('0x28')]()['then'](function(){_0x366543[_0x25d4('0x1d')](0xcc)[_0x25d4('0x1c')]();});}};}function handleEntityNotFound(_0x215e51,_0x5a73af){return function(_0x540a45){if(!_0x540a45){_0x215e51[_0x25d4('0x29')](0x194);}return _0x540a45;};}function handleError(_0x469a37,_0x2514a9){_0x2514a9=_0x2514a9||0x1f4;return function(_0x29de0e){logger[_0x25d4('0x2a')](_0x29de0e[_0x25d4('0x2b')]);if(_0x29de0e[_0x25d4('0x2c')]){delete _0x29de0e['name'];}_0x469a37['status'](_0x2514a9)[_0x25d4('0x2d')](_0x29de0e);};}exports[_0x25d4('0x2e')]=function(_0x422ae9,_0x734467){var _0x23d86d={},_0x2660a3={},_0x48d557={'count':0x0,'rows':[]};var _0x5d2530=_[_0x25d4('0x2f')](db['SmsApplication'][_0x25d4('0x30')],function(_0x18a021){return{'name':_0x18a021[_0x25d4('0x31')],'type':_0x18a021[_0x25d4('0x32')]['key']};});_0x2660a3[_0x25d4('0x33')]=_[_0x25d4('0x2f')](_0x5d2530,_0x25d4('0x2c'));_0x2660a3[_0x25d4('0x34')]=_[_0x25d4('0x35')](_0x422ae9[_0x25d4('0x34')]);_0x2660a3[_0x25d4('0x36')]=_[_0x25d4('0x37')](_0x2660a3[_0x25d4('0x33')],_0x2660a3[_0x25d4('0x34')]);_0x23d86d['attributes']=_['intersection'](_0x2660a3['model'],qs['fields'](_0x422ae9[_0x25d4('0x34')][_0x25d4('0x38')]));_0x23d86d[_0x25d4('0x39')]=_0x23d86d[_0x25d4('0x39')][_0x25d4('0x3a')]?_0x23d86d[_0x25d4('0x39')]:_0x2660a3[_0x25d4('0x33')];if(!_0x422ae9['query'][_0x25d4('0x3b')]('nolimit')){_0x23d86d[_0x25d4('0x22')]=qs[_0x25d4('0x22')](_0x422ae9[_0x25d4('0x34')][_0x25d4('0x22')]);_0x23d86d[_0x25d4('0x1f')]=qs[_0x25d4('0x1f')](_0x422ae9[_0x25d4('0x34')][_0x25d4('0x1f')]);}_0x23d86d[_0x25d4('0x3c')]=qs[_0x25d4('0x3d')](_0x422ae9['query'][_0x25d4('0x3d')]);_0x23d86d[_0x25d4('0x3e')]=qs['filters'](_[_0x25d4('0x3f')](_0x422ae9[_0x25d4('0x34')],_0x2660a3[_0x25d4('0x36')]),_0x5d2530);if(_0x422ae9[_0x25d4('0x34')][_0x25d4('0x40')]){_0x23d86d[_0x25d4('0x3e')]=_[_0x25d4('0x41')](_0x23d86d[_0x25d4('0x3e')],{'$or':_['map'](_0x5d2530,function(_0x5c14ec){if(_0x5c14ec[_0x25d4('0x32')]!==_0x25d4('0x42')){var _0x574d1c={};_0x574d1c[_0x5c14ec[_0x25d4('0x2c')]]={'$like':'%'+_0x422ae9[_0x25d4('0x34')]['filter']+'%'};return _0x574d1c;}})});}_0x23d86d=_['merge']({},_0x23d86d,_0x422ae9[_0x25d4('0x43')]);var _0x337eb3={'where':_0x23d86d['where']};return db[_0x25d4('0x44')][_0x25d4('0x21')](_0x337eb3)[_0x25d4('0x45')](function(_0x40f57a){_0x48d557[_0x25d4('0x21')]=_0x40f57a;if(_0x422ae9[_0x25d4('0x34')][_0x25d4('0x46')]){_0x23d86d[_0x25d4('0x47')]=[{'all':!![]}];}return db[_0x25d4('0x44')][_0x25d4('0x48')](_0x23d86d);})[_0x25d4('0x45')](function(_0x299074){_0x48d557[_0x25d4('0x49')]=_0x299074;return _0x48d557;})[_0x25d4('0x45')](respondWithFilteredResult(_0x734467,_0x23d86d))[_0x25d4('0x4a')](handleError(_0x734467,null));};exports[_0x25d4('0x4b')]=function(_0x177e76,_0x5a8d5d){var _0x24a20c={'raw':!![],'where':{'id':_0x177e76[_0x25d4('0x4c')]['id']}},_0x19a465={};_0x19a465[_0x25d4('0x33')]=_[_0x25d4('0x35')](db[_0x25d4('0x44')][_0x25d4('0x30')]);_0x19a465[_0x25d4('0x34')]=_[_0x25d4('0x35')](_0x177e76['query']);_0x19a465[_0x25d4('0x36')]=_[_0x25d4('0x37')](_0x19a465['model'],_0x19a465[_0x25d4('0x34')]);_0x24a20c['attributes']=_[_0x25d4('0x37')](_0x19a465[_0x25d4('0x33')],qs[_0x25d4('0x38')](_0x177e76['query'][_0x25d4('0x38')]));_0x24a20c['attributes']=_0x24a20c[_0x25d4('0x39')][_0x25d4('0x3a')]?_0x24a20c[_0x25d4('0x39')]:_0x19a465['model'];if(_0x177e76[_0x25d4('0x34')]['includeAll']){_0x24a20c[_0x25d4('0x47')]=[{'all':!![]}];}_0x24a20c=_[_0x25d4('0x41')]({},_0x24a20c,_0x177e76[_0x25d4('0x43')]);return db[_0x25d4('0x44')][_0x25d4('0x4d')](_0x24a20c)['then'](handleEntityNotFound(_0x5a8d5d,null))[_0x25d4('0x45')](respondWithResult(_0x5a8d5d,null))['catch'](handleError(_0x5a8d5d,null));};exports['create']=function(_0x162d76,_0x1cdf72){return db[_0x25d4('0x44')][_0x25d4('0x4e')](_0x162d76[_0x25d4('0x4f')],{})[_0x25d4('0x45')](respondWithResult(_0x1cdf72,0xc9))[_0x25d4('0x4a')](handleError(_0x1cdf72,null));};exports[_0x25d4('0x27')]=function(_0x3fc1a2,_0x24daa3){if(_0x3fc1a2[_0x25d4('0x4f')]['id']){delete _0x3fc1a2[_0x25d4('0x4f')]['id'];}return db[_0x25d4('0x44')][_0x25d4('0x4d')]({'where':{'id':_0x3fc1a2[_0x25d4('0x4c')]['id']}})[_0x25d4('0x45')](handleEntityNotFound(_0x24daa3,null))['then'](saveUpdates(_0x3fc1a2[_0x25d4('0x4f')],null))[_0x25d4('0x45')](respondWithResult(_0x24daa3,null))['catch'](handleError(_0x24daa3,null));};exports['destroy']=function(_0x8e0a23,_0x3b46a8){return db['SmsApplication'][_0x25d4('0x4d')]({'where':{'id':_0x8e0a23[_0x25d4('0x4c')]['id']}})[_0x25d4('0x45')](handleEntityNotFound(_0x3b46a8,null))[_0x25d4('0x45')](removeEntity(_0x3b46a8,null))[_0x25d4('0x4a')](handleError(_0x3b46a8,null));}; \ No newline at end of file +var _0xea7a=['status','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','rows','catch','show','params','keys','rawAttributes','include','create','SmsApplication','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x47707e,_0x58c7dc){var _0x37b727=function(_0x158bf4){while(--_0x158bf4){_0x47707e['push'](_0x47707e['shift']());}};_0x37b727(++_0x58c7dc);}(_0xea7a,0x6b));var _0xaea7=function(_0x193470,_0x2f433e){_0x193470=_0x193470-0x0;var _0x293a1e=_0xea7a[_0x193470];return _0x293a1e;};'use strict';var emlformat=require(_0xaea7('0x0'));var rimraf=require(_0xaea7('0x1'));var zipdir=require(_0xaea7('0x2'));var jsonpatch=require(_0xaea7('0x3'));var rp=require(_0xaea7('0x4'));var moment=require(_0xaea7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaea7('0x6'));var util=require('util');var path=require(_0xaea7('0x7'));var sox=require(_0xaea7('0x8'));var csv=require(_0xaea7('0x9'));var ejs=require(_0xaea7('0xa'));var fs=require('fs');var fs_extra=require(_0xaea7('0xb'));var _=require(_0xaea7('0xc'));var squel=require(_0xaea7('0xd'));var crypto=require(_0xaea7('0xe'));var jsforce=require(_0xaea7('0xf'));var deskjs=require(_0xaea7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaea7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaea7('0x12'));var as=require(_0xaea7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaea7('0x14'))(_0xaea7('0x15'));var utils=require(_0xaea7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11092d,_0x23ca74){_0x23ca74=_0x23ca74||0xcc;return function(_0x2d0aad){if(_0x2d0aad){return _0x11092d[_0xaea7('0x17')](_0x23ca74);}return _0x11092d['status'](_0x23ca74)[_0xaea7('0x18')]();};}function respondWithResult(_0xdbfcc7,_0x116711){_0x116711=_0x116711||0xc8;return function(_0x4158ba){if(_0x4158ba){return _0xdbfcc7['status'](_0x116711)[_0xaea7('0x19')](_0x4158ba);}};}function respondWithFilteredResult(_0x11b9b1,_0x519e6c){return function(_0x2efebe){if(_0x2efebe){var _0x1eda4d=typeof _0x519e6c[_0xaea7('0x1a')]===_0xaea7('0x1b')&&typeof _0x519e6c[_0xaea7('0x1c')]===_0xaea7('0x1b');var _0x4c0b09=_0x2efebe[_0xaea7('0x1d')];var _0x595ea8=_0x1eda4d?0x0:_0x519e6c['offset'];var _0x2457cc=_0x1eda4d?_0x2efebe[_0xaea7('0x1d')]:_0x519e6c[_0xaea7('0x1a')]+_0x519e6c[_0xaea7('0x1c')];var _0xab8316;if(_0x2457cc>=_0x4c0b09){_0x2457cc=_0x4c0b09;_0xab8316=0xc8;}else{_0xab8316=0xce;}_0x11b9b1['status'](_0xab8316);return _0x11b9b1[_0xaea7('0x1e')](_0xaea7('0x1f'),_0x595ea8+'-'+_0x2457cc+'/'+_0x4c0b09)[_0xaea7('0x19')](_0x2efebe);}return null;};}function patchUpdates(_0x2142f5){return function(_0x75cf63){try{jsonpatch[_0xaea7('0x20')](_0x75cf63,_0x2142f5,!![]);}catch(_0x1ee54a){return BPromise[_0xaea7('0x21')](_0x1ee54a);}return _0x75cf63['save']();};}function saveUpdates(_0x1d7d07,_0x5386f4){return function(_0x37130d){if(_0x37130d){return _0x37130d[_0xaea7('0x22')](_0x1d7d07)[_0xaea7('0x23')](function(_0x30bd13){return _0x30bd13;});}return null;};}function removeEntity(_0x36f7e3,_0x2fce70){return function(_0x57ff21){if(_0x57ff21){return _0x57ff21[_0xaea7('0x24')]()[_0xaea7('0x23')](function(){_0x36f7e3[_0xaea7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fecac,_0x19e721){return function(_0x114a3d){if(!_0x114a3d){_0x3fecac['sendStatus'](0x194);}return _0x114a3d;};}function handleError(_0x502d46,_0x57bdd8){_0x57bdd8=_0x57bdd8||0x1f4;return function(_0x54bab4){logger[_0xaea7('0x26')](_0x54bab4[_0xaea7('0x27')]);if(_0x54bab4['name']){delete _0x54bab4[_0xaea7('0x28')];}_0x502d46[_0xaea7('0x25')](_0x57bdd8)[_0xaea7('0x29')](_0x54bab4);};}exports[_0xaea7('0x2a')]=function(_0x218a29,_0x3eb764){var _0x3d865d={},_0x5cfddc={},_0x132946={'count':0x0,'rows':[]};var _0x2b1b67=_[_0xaea7('0x2b')](db['SmsApplication']['rawAttributes'],function(_0x5e745b){return{'name':_0x5e745b[_0xaea7('0x2c')],'type':_0x5e745b['type'][_0xaea7('0x2d')]};});_0x5cfddc[_0xaea7('0x2e')]=_[_0xaea7('0x2b')](_0x2b1b67,'name');_0x5cfddc[_0xaea7('0x2f')]=_['keys'](_0x218a29['query']);_0x5cfddc[_0xaea7('0x30')]=_[_0xaea7('0x31')](_0x5cfddc['model'],_0x5cfddc[_0xaea7('0x2f')]);_0x3d865d[_0xaea7('0x32')]=_['intersection'](_0x5cfddc[_0xaea7('0x2e')],qs['fields'](_0x218a29[_0xaea7('0x2f')][_0xaea7('0x33')]));_0x3d865d[_0xaea7('0x32')]=_0x3d865d[_0xaea7('0x32')][_0xaea7('0x34')]?_0x3d865d[_0xaea7('0x32')]:_0x5cfddc[_0xaea7('0x2e')];if(!_0x218a29[_0xaea7('0x2f')][_0xaea7('0x35')](_0xaea7('0x36'))){_0x3d865d[_0xaea7('0x1c')]=qs[_0xaea7('0x1c')](_0x218a29[_0xaea7('0x2f')][_0xaea7('0x1c')]);_0x3d865d[_0xaea7('0x1a')]=qs[_0xaea7('0x1a')](_0x218a29['query'][_0xaea7('0x1a')]);}_0x3d865d['order']=qs[_0xaea7('0x37')](_0x218a29[_0xaea7('0x2f')][_0xaea7('0x37')]);_0x3d865d['where']=qs[_0xaea7('0x30')](_[_0xaea7('0x38')](_0x218a29[_0xaea7('0x2f')],_0x5cfddc[_0xaea7('0x30')]),_0x2b1b67);if(_0x218a29[_0xaea7('0x2f')][_0xaea7('0x39')]){_0x3d865d[_0xaea7('0x3a')]=_['merge'](_0x3d865d[_0xaea7('0x3a')],{'$or':_['map'](_0x2b1b67,function(_0x275fde){if(_0x275fde['type']!==_0xaea7('0x3b')){var _0x182b69={};_0x182b69[_0x275fde['name']]={'$like':'%'+_0x218a29[_0xaea7('0x2f')][_0xaea7('0x39')]+'%'};return _0x182b69;}})});}_0x3d865d=_[_0xaea7('0x3c')]({},_0x3d865d,_0x218a29[_0xaea7('0x3d')]);var _0x4ada83={'where':_0x3d865d[_0xaea7('0x3a')]};return db['SmsApplication'][_0xaea7('0x1d')](_0x4ada83)[_0xaea7('0x23')](function(_0x413e75){_0x132946['count']=_0x413e75;if(_0x218a29[_0xaea7('0x2f')]['includeAll']){_0x3d865d['include']=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x3d865d);})[_0xaea7('0x23')](function(_0x17b8fe){_0x132946[_0xaea7('0x3e')]=_0x17b8fe;return _0x132946;})[_0xaea7('0x23')](respondWithFilteredResult(_0x3eb764,_0x3d865d))[_0xaea7('0x3f')](handleError(_0x3eb764,null));};exports[_0xaea7('0x40')]=function(_0x2e971a,_0x41a300){var _0x173e47={'raw':!![],'where':{'id':_0x2e971a[_0xaea7('0x41')]['id']}},_0x2da3d6={};_0x2da3d6[_0xaea7('0x2e')]=_[_0xaea7('0x42')](db['SmsApplication'][_0xaea7('0x43')]);_0x2da3d6[_0xaea7('0x2f')]=_['keys'](_0x2e971a[_0xaea7('0x2f')]);_0x2da3d6[_0xaea7('0x30')]=_[_0xaea7('0x31')](_0x2da3d6['model'],_0x2da3d6['query']);_0x173e47[_0xaea7('0x32')]=_[_0xaea7('0x31')](_0x2da3d6[_0xaea7('0x2e')],qs[_0xaea7('0x33')](_0x2e971a['query']['fields']));_0x173e47[_0xaea7('0x32')]=_0x173e47[_0xaea7('0x32')]['length']?_0x173e47['attributes']:_0x2da3d6[_0xaea7('0x2e')];if(_0x2e971a[_0xaea7('0x2f')]['includeAll']){_0x173e47[_0xaea7('0x44')]=[{'all':!![]}];}_0x173e47=_[_0xaea7('0x3c')]({},_0x173e47,_0x2e971a['options']);return db['SmsApplication']['find'](_0x173e47)[_0xaea7('0x23')](handleEntityNotFound(_0x41a300,null))[_0xaea7('0x23')](respondWithResult(_0x41a300,null))[_0xaea7('0x3f')](handleError(_0x41a300,null));};exports[_0xaea7('0x45')]=function(_0x5f0158,_0x283890){return db[_0xaea7('0x46')][_0xaea7('0x45')](_0x5f0158[_0xaea7('0x47')],{})['then'](respondWithResult(_0x283890,0xc9))[_0xaea7('0x3f')](handleError(_0x283890,null));};exports[_0xaea7('0x22')]=function(_0x40c736,_0x14f85a){if(_0x40c736[_0xaea7('0x47')]['id']){delete _0x40c736[_0xaea7('0x47')]['id'];}return db[_0xaea7('0x46')]['find']({'where':{'id':_0x40c736[_0xaea7('0x41')]['id']}})['then'](handleEntityNotFound(_0x14f85a,null))[_0xaea7('0x23')](saveUpdates(_0x40c736[_0xaea7('0x47')],null))[_0xaea7('0x23')](respondWithResult(_0x14f85a,null))[_0xaea7('0x3f')](handleError(_0x14f85a,null));};exports[_0xaea7('0x24')]=function(_0x1cbd30,_0x50be9e){return db[_0xaea7('0x46')]['find']({'where':{'id':_0x1cbd30[_0xaea7('0x41')]['id']}})[_0xaea7('0x23')](handleEntityNotFound(_0x50be9e,null))[_0xaea7('0x23')](removeEntity(_0x50be9e,null))[_0xaea7('0x3f')](handleError(_0x50be9e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2bf0126..7807541 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 _0xd3fe=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xd3fe,0xb2));var _0xed3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xed3f('0x0'));var logger=require(_0xed3f('0x1'))(_0xed3f('0x2'));var moment=require(_0xed3f('0x3'));var BPromise=require(_0xed3f('0x4'));var rp=require(_0xed3f('0x5'));var fs=require('fs');var path=require(_0xed3f('0x6'));var rimraf=require(_0xed3f('0x7'));var config=require(_0xed3f('0x8'));var attributes=require(_0xed3f('0x9'));module[_0xed3f('0xa')]=function(_0xe6f2d6,_0x5b42ee){return _0xe6f2d6[_0xed3f('0xb')](_0xed3f('0xc'),attributes,{'tableName':_0xed3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed3f('0xe'),'collate':_0xed3f('0xf')});}; \ No newline at end of file +var _0x3051=['sms_applications','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x57b551,_0x41c7e7){var _0x40d829=function(_0x20c523){while(--_0x20c523){_0x57b551['push'](_0x57b551['shift']());}};_0x40d829(++_0x41c7e7);}(_0x3051,0x85));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1305('0x0'));var moment=require(_0x1305('0x1'));var BPromise=require(_0x1305('0x2'));var rp=require(_0x1305('0x3'));var fs=require('fs');var path=require(_0x1305('0x4'));var rimraf=require('rimraf');var config=require(_0x1305('0x5'));var attributes=require(_0x1305('0x6'));module[_0x1305('0x7')]=function(_0x88ee5b,_0x42ba46){return _0x88ee5b[_0x1305('0x8')](_0x1305('0x9'),attributes,{'tableName':_0x1305('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1305('0xb'),'collate':_0x1305('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 610d273..5ad53b8 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 _0x806d=['code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0xd307d9,_0x50e8e0){var _0x209bf8=function(_0x335069){while(--_0x335069){_0xd307d9['push'](_0xd307d9['shift']());}};_0x209bf8(++_0x50e8e0);}(_0x806d,0x131));var _0xd806=function(_0x543662,_0x1d196a){_0x543662=_0x543662-0x0;var _0x4b40bb=_0x806d[_0x543662];return _0x4b40bb;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var moment=require(_0xd806('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd806('0x3'))['db'];var utils=require(_0xd806('0x4'));var logger=require('../../config/logger')(_0xd806('0x5'));var config=require('../../config/environment');var jayson=require(_0xd806('0x6'));var client=jayson[_0xd806('0x7')][_0xd806('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26135a,_0x3a3446,_0x3873bf){return new BPromise(function(_0x1c1932,_0x4c8dea){return client[_0xd806('0x9')](_0x26135a,_0x3873bf)[_0xd806('0xa')](function(_0x902695){logger[_0xd806('0xb')]('SmsApplication,\x20%s,\x20%s',_0x3a3446,_0xd806('0xc'));logger['debug'](_0xd806('0xd'),_0x3a3446,_0xd806('0xc'),JSON['stringify'](_0x902695));if(_0x902695[_0xd806('0xe')]){if(_0x902695[_0xd806('0xe')][_0xd806('0xf')]===0x1f4){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695[_0xd806('0xe')][_0xd806('0x11')]);return _0x4c8dea(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695['error'][_0xd806('0x11')]);return _0x1c1932(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}else{logger['info'](_0xd806('0x10'),_0x3a3446,'request\x20sent');_0x1c1932(_0x902695[_0xd806('0x12')][_0xd806('0x11')]);}})[_0xd806('0x13')](function(_0x138725){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x138725);_0x4c8dea(_0x138725);});});} \ No newline at end of file +var _0x8561=['result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x46abc3,_0x9c8f7b){var _0x4efd5e=function(_0x5909ed){while(--_0x5909ed){_0x46abc3['push'](_0x46abc3['shift']());}};_0x4efd5e(++_0x9c8f7b);}(_0x8561,0x1b2));var _0x1856=function(_0x4fe9cf,_0x2f047c){_0x4fe9cf=_0x4fe9cf-0x0;var _0xe20b02=_0x8561[_0x4fe9cf];return _0xe20b02;};'use strict';var _=require('lodash');var util=require(_0x1856('0x0'));var moment=require(_0x1856('0x1'));var BPromise=require('bluebird');var rs=require(_0x1856('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1856('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1856('0x4'))('rpc');var config=require(_0x1856('0x5'));var jayson=require(_0x1856('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe76f7e,_0x56a214,_0x598eba){return new BPromise(function(_0x1c79b0,_0x567852){return client['request'](_0xe76f7e,_0x598eba)['then'](function(_0x5c3bc5){logger[_0x1856('0x7')](_0x1856('0x8'),_0x56a214,'request\x20sent');logger['debug'](_0x1856('0x9'),_0x56a214,'request\x20sent',JSON[_0x1856('0xa')](_0x5c3bc5));if(_0x5c3bc5[_0x1856('0xb')]){if(_0x5c3bc5[_0x1856('0xb')]['code']===0x1f4){logger[_0x1856('0xb')](_0x1856('0x8'),_0x56a214,_0x5c3bc5['error'][_0x1856('0xc')]);return _0x567852(_0x5c3bc5[_0x1856('0xb')][_0x1856('0xc')]);}logger['error'](_0x1856('0x8'),_0x56a214,_0x5c3bc5[_0x1856('0xb')][_0x1856('0xc')]);return _0x1c79b0(_0x5c3bc5['error'][_0x1856('0xc')]);}else{logger[_0x1856('0x7')](_0x1856('0x8'),_0x56a214,_0x1856('0xd'));_0x1c79b0(_0x5c3bc5[_0x1856('0xe')][_0x1856('0xc')]);}})[_0x1856('0xf')](function(_0x51ed04){logger['error'](_0x1856('0x8'),_0x56a214,_0x51ed04);_0x567852(_0x51ed04);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 36b3bb4..7c91791 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 _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x462577,_0x3a25c1){var _0x238cca=function(_0xe6f466){while(--_0xe6f466){_0x462577['push'](_0x462577['shift']());}};_0x238cca(++_0x3a25c1);}(_0xb03e,0x1eb));var _0xeb03=function(_0x26b618,_0x105811){_0x26b618=_0x26b618-0x0;var _0x78475b=_0xb03e[_0x26b618];return _0x78475b;};'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('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file +var _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x416a10,_0x4180aa){var _0x1fbe17=function(_0x31b00d){while(--_0x31b00d){_0x416a10['push'](_0x416a10['shift']());}};_0x1fbe17(++_0x4180aa);}(_0xe605,0x92));var _0x5e60=function(_0x524cca,_0x493059){_0x524cca=_0x524cca-0x0;var _0x121207=_0xe605[_0x524cca];return _0x121207;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('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 dd35cb5..7b817b1 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 _0x19cb=['DATE','STRING','ENUM','out','BOOLEAN','INTEGER','moment','exports'];(function(_0x32bffb,_0x2d7bbe){var _0x54b297=function(_0x4aebfb){while(--_0x4aebfb){_0x32bffb['push'](_0x32bffb['shift']());}};_0x54b297(++_0x2d7bbe);}(_0x19cb,0x146));var _0xb19c=function(_0x1283cd,_0xf058c7){_0x1283cd=_0x1283cd-0x0;var _0x56b10b=_0x19cb[_0x1283cd];return _0x56b10b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb19c('0x0'));module[_0xb19c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb19c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb19c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb19c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb19c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb19c('0x4')]('in',_0xb19c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb19c('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb19c('0x7')]}}; \ No newline at end of file +var _0xb846=['ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x353643,_0x568495){var _0x394b32=function(_0x3924ae){while(--_0x3924ae){_0x353643['push'](_0x353643['shift']());}};_0x394b32(++_0x568495);}(_0xb846,0x1d0));var _0x6b84=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb846[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x6b84('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x6b84('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6b84('0x2')]},'disposition':{'type':Sequelize[_0x6b84('0x3')]},'secondDisposition':{'type':Sequelize[_0x6b84('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6b84('0x3')]},'read1stAt':{'type':Sequelize[_0x6b84('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6b84('0x4')]('in',_0x6b84('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6b84('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6b84('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index d83711b..8062708 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 _0x6ced=['addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','toString','join','server','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','createdAt','direction','secret','read','Account','name','Owner','fullname','get','Sms','N.A.','closed','closedAt','disposition','Messages','out','System','lastName','value','root','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','moment','bluebird','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','error','send','map','SmsInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','length','include','merge','create','body','update','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows'];(function(_0x568c76,_0x308d4b){var _0x46736f=function(_0x2a6582){while(--_0x2a6582){_0x568c76['push'](_0x568c76['shift']());}};_0x46736f(++_0x308d4b);}(_0x6ced,0x116));var _0xd6ce=function(_0x1f3a13,_0x1a6962){_0x1f3a13=_0x1f3a13-0x0;var _0x1bce83=_0x6ced[_0x1f3a13];return _0x1bce83;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xd6ce('0x0'));var BPromise=require(_0xd6ce('0x1'));var util=require('util');var path=require('path');var ejs=require(_0xd6ce('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd6ce('0x3'));var interaction=require(_0xd6ce('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0xd6ce('0x5'));var logger=require(_0xd6ce('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd6ce('0x7')]=_[_0xd6ce('0x8')](config['redis'],{'host':_0xd6ce('0x9'),'port':0x18eb});var socket=require(_0xd6ce('0xa'))(new Redis(config[_0xd6ce('0x7')]));require(_0xd6ce('0xb'))['register'](socket);function respondWithStatusCode(_0x289b26,_0x2303ed){_0x2303ed=_0x2303ed||0xcc;return function(_0x43ff8e){if(_0x43ff8e){return _0x289b26[_0xd6ce('0xc')](_0x2303ed);}return _0x289b26['status'](_0x2303ed)[_0xd6ce('0xd')]();};}function respondWithResult(_0x411f5e,_0xe250f1){_0xe250f1=_0xe250f1||0xc8;return function(_0x51630f){if(_0x51630f){return _0x411f5e[_0xd6ce('0xe')](_0xe250f1)['json'](_0x51630f);}};}function respondWithFilteredResult(_0x4611bb,_0xc4b12b){return function(_0x53da1c){if(_0x53da1c){var _0x768717=typeof _0xc4b12b[_0xd6ce('0xf')]===_0xd6ce('0x10')&&typeof _0xc4b12b[_0xd6ce('0x11')]===_0xd6ce('0x10');var _0x5bf6b9=_0x53da1c[_0xd6ce('0x12')];var _0x4d32f9=_0x768717?0x0:_0xc4b12b[_0xd6ce('0xf')];var _0x477bcc=_0x768717?_0x53da1c['count']:_0xc4b12b[_0xd6ce('0xf')]+_0xc4b12b[_0xd6ce('0x11')];var _0x5a0978;if(_0x477bcc>=_0x5bf6b9){_0x477bcc=_0x5bf6b9;_0x5a0978=0xc8;}else{_0x5a0978=0xce;}_0x4611bb[_0xd6ce('0xe')](_0x5a0978);return _0x4611bb[_0xd6ce('0x13')](_0xd6ce('0x14'),_0x4d32f9+'-'+_0x477bcc+'/'+_0x5bf6b9)[_0xd6ce('0x15')](_0x53da1c);}return null;};}function saveUpdates(_0x421d9b){return function(_0x5d007a){if(_0x5d007a){return _0x5d007a['update'](_0x421d9b)[_0xd6ce('0x16')](function(_0x5175cc){return _0x5175cc;});}return null;};}function removeEntity(_0x2ddc24){return function(_0x21548e){if(_0x21548e){return _0x21548e[_0xd6ce('0x17')]()['then'](function(){_0x2ddc24['status'](0xcc)[_0xd6ce('0xd')]();});}};}function handleEntityNotFound(_0x9d5e15){return function(_0x20edf4){if(!_0x20edf4){_0x9d5e15['sendStatus'](0x194);}return _0x20edf4;};}function handleError(_0x6d8b8c,_0x1e2db3){_0x1e2db3=_0x1e2db3||0x1f4;return function(_0x8fb6ac){logger[_0xd6ce('0x18')](_0x8fb6ac['stack']);if(_0x8fb6ac['name']){delete _0x8fb6ac['name'];}_0x6d8b8c[_0xd6ce('0xe')](_0x1e2db3)[_0xd6ce('0x19')](_0x8fb6ac);};}exports['index']=function(_0x1f3324,_0x24d69b){var _0x5afb62={};var _0x4fa841=_[_0xd6ce('0x1a')](db[_0xd6ce('0x1b')]['rawAttributes'],function(_0x5e755b){return{'name':_0x5e755b[_0xd6ce('0x1c')],'type':_0x5e755b[_0xd6ce('0x1d')][_0xd6ce('0x1e')]};});_0x5afb62=qs[_0xd6ce('0x1f')](_0x4fa841,_0x1f3324);return interaction[_0xd6ce('0x20')]('sms',_0x1f3324[_0xd6ce('0x21')],_0x1f3324[_0xd6ce('0x22')],_0x5afb62,_0x4fa841)[_0xd6ce('0x16')](respondWithFilteredResult(_0x24d69b,_0x5afb62))[_0xd6ce('0x23')](handleError(_0x24d69b,null));};exports[_0xd6ce('0x24')]=function(_0x40c244,_0x1c2721){var _0x7b3fd5={'raw':![],'where':{'id':_0x40c244[_0xd6ce('0x25')]['id']}},_0x13ef26={};_0x13ef26[_0xd6ce('0x26')]=_['keys'](db[_0xd6ce('0x1b')][_0xd6ce('0x27')]);_0x13ef26[_0xd6ce('0x21')]=_[_0xd6ce('0x28')](_0x40c244[_0xd6ce('0x21')]);_0x13ef26[_0xd6ce('0x29')]=_[_0xd6ce('0x2a')](_0x13ef26['model'],_0x13ef26['query']);_0x7b3fd5[_0xd6ce('0x2b')]=_[_0xd6ce('0x2a')](_0x13ef26['model'],qs['fields'](_0x40c244[_0xd6ce('0x21')][_0xd6ce('0x2c')]));_0x7b3fd5[_0xd6ce('0x2b')]=_0x7b3fd5[_0xd6ce('0x2b')][_0xd6ce('0x2d')]?_0x7b3fd5[_0xd6ce('0x2b')]:_0x13ef26[_0xd6ce('0x26')];if(_0x40c244[_0xd6ce('0x21')]['includeAll']){_0x7b3fd5[_0xd6ce('0x2e')]=[{'all':!![]}];}_0x7b3fd5=_[_0xd6ce('0x2f')]({},_0x7b3fd5,_0x40c244['options']);return db[_0xd6ce('0x1b')]['find'](_0x7b3fd5)[_0xd6ce('0x16')](handleEntityNotFound(_0x1c2721,null))[_0xd6ce('0x16')](respondWithResult(_0x1c2721,null))[_0xd6ce('0x23')](handleError(_0x1c2721,null));};exports[_0xd6ce('0x30')]=function(_0x38bc6f,_0x4630f5){return db['SmsInteraction']['create'](_0x38bc6f[_0xd6ce('0x31')],{})['then'](respondWithResult(_0x4630f5,0xc9))['catch'](handleError(_0x4630f5,null));};exports[_0xd6ce('0x32')]=function(_0x356029,_0x578e){if(_0x356029[_0xd6ce('0x31')]['id']){delete _0x356029[_0xd6ce('0x31')]['id'];}return db[_0xd6ce('0x1b')]['find']({'where':{'id':_0x356029[_0xd6ce('0x25')]['id']}})['then'](handleEntityNotFound(_0x578e,null))[_0xd6ce('0x16')](saveUpdates(_0x356029[_0xd6ce('0x31')],null))[_0xd6ce('0x16')](respondWithResult(_0x578e,null))[_0xd6ce('0x23')](handleError(_0x578e,null));};exports[_0xd6ce('0x17')]=function(_0x5cb790,_0x157a2a){return db[_0xd6ce('0x1b')][_0xd6ce('0x33')]({'where':{'id':_0x5cb790[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x157a2a,null))[_0xd6ce('0x16')](removeEntity(_0x157a2a,null))['catch'](handleError(_0x157a2a,null));};exports[_0xd6ce('0x34')]=function(_0x3979c7,_0x235e24){return db[_0xd6ce('0x1b')][_0xd6ce('0x34')]()[_0xd6ce('0x16')](respondWithResult(_0x235e24,null))[_0xd6ce('0x23')](handleError(_0x235e24,null));};exports[_0xd6ce('0x35')]=function(_0x2310bb,_0x527fa5){return db[_0xd6ce('0x36')][_0xd6ce('0x33')]({'where':{'id':_0x2310bb[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x527fa5,null))[_0xd6ce('0x16')](function(_0x1e5ea0){if(_0x1e5ea0){return _0x1e5ea0[_0xd6ce('0x35')](_0x2310bb[_0xd6ce('0x31')][_0xd6ce('0x37')],_[_0xd6ce('0x38')](_0x2310bb[_0xd6ce('0x31')],[_0xd6ce('0x37'),'id'])||{});}})[_0xd6ce('0x16')](respondWithResult(_0x527fa5,null))[_0xd6ce('0x23')](handleError(_0x527fa5,null));};exports[_0xd6ce('0x39')]=function(_0x3cdc80,_0x4a8acb){var _0x5f29d4={'raw':![],'where':{}};var _0x336405={};var _0x20d531={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xd6ce('0x3a')]({'where':{'id':_0x3cdc80[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x4a8acb,null))[_0xd6ce('0x16')](function(_0x170f38){if(_0x170f38){_0x336405[_0xd6ce('0x26')]=_[_0xd6ce('0x28')](db['SmsMessage'][_0xd6ce('0x27')]);_0x336405[_0xd6ce('0x21')]=_[_0xd6ce('0x28')](_0x3cdc80[_0xd6ce('0x21')]);_0x336405['filters']=_['intersection'](_0x336405[_0xd6ce('0x26')],_0x336405[_0xd6ce('0x21')]);_0x5f29d4[_0xd6ce('0x2b')]=_[_0xd6ce('0x2a')](_0x336405[_0xd6ce('0x26')],qs['fields'](_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x2c')]));_0x5f29d4['attributes']=_0x5f29d4['attributes']['length']?_0x5f29d4[_0xd6ce('0x2b')]:_0x336405[_0xd6ce('0x26')];if(!_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x3b')](_0xd6ce('0x3c'))){_0x5f29d4[_0xd6ce('0x11')]=qs[_0xd6ce('0x11')](_0x3cdc80[_0xd6ce('0x21')]['limit']);_0x5f29d4['offset']=qs['offset'](_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0xf')]);}_0x5f29d4[_0xd6ce('0x3d')]=qs[_0xd6ce('0x3e')](_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x3e')]);_0x5f29d4[_0xd6ce('0x3f')]=qs['filters'](_[_0xd6ce('0x40')](_0x3cdc80[_0xd6ce('0x21')],_0x336405[_0xd6ce('0x29')]));_0x5f29d4[_0xd6ce('0x3f')][_0xd6ce('0x41')]=_0x170f38['id'];if(_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x42')]){_0x5f29d4[_0xd6ce('0x3f')]=_['merge'](_0x5f29d4[_0xd6ce('0x3f')],{'$or':_[_0xd6ce('0x1a')](_0x5f29d4[_0xd6ce('0x2b')],function(_0x320af7){var _0x46148e={};_0x46148e[_0x320af7]={'$like':'%'+_0x3cdc80['query']['filter']+'%'};return _0x46148e;})});}if(_0x3cdc80[_0xd6ce('0x21')][_0xd6ce('0x43')]){var _0x9df78c=_0x3cdc80['query'][_0xd6ce('0x43')][_0xd6ce('0x44')](',');var _0x4eb52f={};_0x4eb52f[_0x9df78c[0x0]]={'$gte':moment(_0x9df78c[0x1])[_0xd6ce('0x45')](_0xd6ce('0x46'))};_0x5f29d4['where']=_[_0xd6ce('0x2f')](_0x5f29d4[_0xd6ce('0x3f')],_0x4eb52f);}_0x5f29d4=_[_0xd6ce('0x2f')]({},_0x5f29d4,_0x3cdc80[_0xd6ce('0x47')]);return db[_0xd6ce('0x36')][_0xd6ce('0x12')]({'where':_0x5f29d4[_0xd6ce('0x3f')]})[_0xd6ce('0x16')](function(_0x4265a5){_0x20d531['count']=_0x4265a5;if(_0x3cdc80[_0xd6ce('0x21')]['includeAll']){_0x5f29d4[_0xd6ce('0x2e')]=[{'all':!![]}];}return db['SmsMessage'][_0xd6ce('0x20')](_0x5f29d4);})[_0xd6ce('0x16')](function(_0x3d8fb2){_0x20d531[_0xd6ce('0x48')]=_0x3d8fb2;return _0x20d531;});}})['then'](respondWithFilteredResult(_0x4a8acb,_0x5f29d4))[_0xd6ce('0x23')](handleError(_0x4a8acb,null));};exports[_0xd6ce('0x49')]=function(_0x48457b,_0x2a7099){return db[_0xd6ce('0x1b')][_0xd6ce('0x33')]({'where':{'id':_0x48457b['params']['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0x2a7099,null))['then'](function(_0x57f91f){if(_0x57f91f){return _0x57f91f[_0xd6ce('0x4a')](_0x48457b[_0xd6ce('0x31')][_0xd6ce('0x37')],_[_0xd6ce('0x38')](_0x48457b[_0xd6ce('0x31')],['ids','id'])||{})[_0xd6ce('0x4b')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x48457b['body'][_0xd6ce('0x37')]}});})[_0xd6ce('0x16')](function(_0x3fe8df){socket[_0xd6ce('0x4c')](_0xd6ce('0x4d'),{'id':Number(_0x48457b[_0xd6ce('0x25')]['id']),'tags':_0x3fe8df||[]});return{'id':Number(_0x48457b[_0xd6ce('0x25')]['id']),'tags':_0x3fe8df||[]};});}})[_0xd6ce('0x16')](respondWithResult(_0x2a7099,null))[_0xd6ce('0x23')](handleError(_0x2a7099,null));};exports[_0xd6ce('0x4e')]=function(_0x19b23a,_0xe4d0b){return db[_0xd6ce('0x1b')][_0xd6ce('0x33')]({'where':{'id':_0x19b23a[_0xd6ce('0x25')]['id']}})[_0xd6ce('0x16')](handleEntityNotFound(_0xe4d0b,null))['then'](function(_0x578600){if(_0x578600){return _0x578600[_0xd6ce('0x4e')](_0x19b23a['query'][_0xd6ce('0x37')]);}})[_0xd6ce('0x16')](respondWithStatusCode(_0xe4d0b,null))[_0xd6ce('0x23')](handleError(_0xe4d0b,null));};exports[_0xd6ce('0x4f')]=function(_0x113646,_0x2d9153){var _0x39be5b=moment()['unix']()[_0xd6ce('0x50')]();var _0x16c1dd=path[_0xd6ce('0x51')](config['root'],_0xd6ce('0x52'),'files',_0xd6ce('0x53'));var _0x1579b2=path[_0xd6ce('0x51')](_0x16c1dd,_0x39be5b);var _0x5640a9=util[_0xd6ce('0x45')](_0xd6ce('0x54'),_0x113646[_0xd6ce('0x25')]['id'],_0x39be5b);var _0xce385f=path[_0xd6ce('0x51')](_0x16c1dd,_0x5640a9);var _0xd016f6=[];_0xd016f6[_0xd6ce('0x55')]({'model':db['User'],'as':_0xd6ce('0x56'),'attributes':['id','fullname'],'raw':!![]});_0xd016f6[_0xd6ce('0x55')]({'model':db[_0xd6ce('0x57')],'as':_0xd6ce('0x58'),'attributes':['id',_0xd6ce('0x59'),'lastName'],'raw':!![]});var _0x285108=[{'model':db[_0xd6ce('0x36')],'as':'Messages','attributes':['id',_0xd6ce('0x31'),_0xd6ce('0x5a'),_0xd6ce('0x5b'),_0xd6ce('0x5c'),_0xd6ce('0x5d')],'include':_0xd016f6}];_0x285108['push']({'model':db['SmsAccount'],'as':_0xd6ce('0x5e'),'attributes':['id',_0xd6ce('0x5f')]});_0x285108[_0xd6ce('0x55')]({'model':db[_0xd6ce('0x56')],'as':_0xd6ce('0x60'),'attributes':['id',_0xd6ce('0x61')]});return db['SmsInteraction'][_0xd6ce('0x33')]({'where':{'id':_0x113646[_0xd6ce('0x25')]['id']},'include':_0x285108})['then'](handleEntityNotFound(_0x2d9153,null))['then'](function(_0x3b91dd){if(_0x3b91dd){var _0x5401fd=_0x3b91dd[_0xd6ce('0x62')]({'plain':!![]});fs['mkdirSync'](_0x1579b2);var _0x4a546f={'channel':_0xd6ce('0x63'),'account':_0x5401fd['Account'][_0xd6ce('0x5f')],'agent':_0x5401fd[_0xd6ce('0x60')]?_0x5401fd['Owner'][_0xd6ce('0x61')]:_0xd6ce('0x64'),'createdAt':moment(_0x5401fd[_0xd6ce('0x5a')])[_0xd6ce('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6ce('0x50')](),'closedAt':_0x5401fd[_0xd6ce('0x65')]?moment(_0x5401fd[_0xd6ce('0x66')])['format'](_0xd6ce('0x46'))[_0xd6ce('0x50')]():'','disposition':_0x5401fd[_0xd6ce('0x67')],'messages':_(_0x5401fd[_0xd6ce('0x68')])[_0xd6ce('0x42')]({'secret':![]})[_0xd6ce('0x1a')](function(_0x1ba08b){return{'date':moment(_0x1ba08b[_0xd6ce('0x5a')])[_0xd6ce('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6ce('0x50')](),'sender':_0x1ba08b[_0xd6ce('0x5b')]===_0xd6ce('0x69')?_0x1ba08b[_0xd6ce('0x56')]?_0x1ba08b[_0xd6ce('0x56')][_0xd6ce('0x61')]:_0xd6ce('0x6a'):_0x1ba08b[_0xd6ce('0x58')][_0xd6ce('0x59')]+(_0x1ba08b[_0xd6ce('0x58')][_0xd6ce('0x6b')]?'\x20'+_0x1ba08b[_0xd6ce('0x58')][_0xd6ce('0x6b')]:''),'body':_0x1ba08b[_0xd6ce('0x31')],'direction':_0x1ba08b['direction']===_0xd6ce('0x69')?'A':'C','secret':_0x1ba08b[_0xd6ce('0x5c')],'read':_0x1ba08b[_0xd6ce('0x5d')]};})[_0xd6ce('0x6c')]()};return ejs['renderFile'](path['join'](config[_0xd6ce('0x6d')],_0xd6ce('0x52'),'views',_0xd6ce('0x6e')),{'interaction':_0x4a546f})['then'](function(_0x334e50){var _0x14b7ee=path[_0xd6ce('0x51')](_0x1579b2,_0xd6ce('0x6f')+_0x5401fd['id']+'-'+_0x39be5b+_0xd6ce('0x70'));var _0xe45308={'path':_0x14b7ee,'channel':_0xd6ce('0x63'),'interactionId':_0x5401fd['id']};return pdf[_0xd6ce('0x71')](_0x334e50,_0xe45308);})[_0xd6ce('0x16')](function(){return new BPromise(function(_0x134cd2,_0x565ad5){zipdir(_0x1579b2,{'saveTo':_0xce385f},function(_0x6df034,_0x5a23fa){if(_0x6df034)return _0x565ad5(_0x6df034);return _0x134cd2(_0x5a23fa);});})[_0xd6ce('0x16')](function(){return new BPromise(function(_0x33efab,_0x38ef7a){rimraf(_0x1579b2,function(_0x16c33f){if(_0x16c33f)_0x38ef7a(_0x16c33f);return _0x33efab();});});})[_0xd6ce('0x16')](function(){return _0x2d9153['download'](_0xce385f,_0x5640a9,function(_0x1c4713){if(_0x1c4713){console[_0xd6ce('0x72')](_0xd6ce('0x73'),_0x1c4713);}else{fs[_0xd6ce('0x74')](_0xce385f);}});});});}else{return _0x2d9153['sendStatus'](0xc8);}})[_0xd6ce('0x23')](handleError(_0x2d9153,null));}; \ No newline at end of file +var _0xd75b=['files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','Messages','out','System','secret','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','register','end','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','sendStatus','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','user','catch','show','params','model','keys','filters','query','intersection','attributes','length','includeAll','include','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','color','smsInteractionTags:save','download','unix','toString','join','server'];(function(_0x343813,_0xca7ddf){var _0x2ea3d7=function(_0x1ddc8e){while(--_0x1ddc8e){_0x343813['push'](_0x343813['shift']());}};_0x2ea3d7(++_0xca7ddf);}(_0xd75b,0x17e));var _0xbd75=function(_0x5db09e,_0x1710aa){_0x5db09e=_0x5db09e-0x0;var _0x38e88b=_0xd75b[_0x5db09e];return _0x38e88b;};'use strict';var rimraf=require(_0xbd75('0x0'));var zipdir=require(_0xbd75('0x1'));var moment=require(_0xbd75('0x2'));var BPromise=require(_0xbd75('0x3'));var util=require(_0xbd75('0x4'));var path=require('path');var ejs=require(_0xbd75('0x5'));var fs=require('fs');var _=require(_0xbd75('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xbd75('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xbd75('0x8'))(_0xbd75('0x9'));var config=require(_0xbd75('0xa'));var db=require(_0xbd75('0xb'))['db'];config[_0xbd75('0xc')]=_['defaults'](config[_0xbd75('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd75('0xc')]));require('./smsInteraction.socket')[_0xbd75('0xd')](socket);function respondWithStatusCode(_0x472e48,_0x5478d0){_0x5478d0=_0x5478d0||0xcc;return function(_0x28f61f){if(_0x28f61f){return _0x472e48['sendStatus'](_0x5478d0);}return _0x472e48['status'](_0x5478d0)[_0xbd75('0xe')]();};}function respondWithResult(_0x1f3ea2,_0x31b7cc){_0x31b7cc=_0x31b7cc||0xc8;return function(_0x1be90e){if(_0x1be90e){return _0x1f3ea2[_0xbd75('0xf')](_0x31b7cc)['json'](_0x1be90e);}};}function respondWithFilteredResult(_0x3d9efa,_0x601e8f){return function(_0x3af4d2){if(_0x3af4d2){var _0x571590=typeof _0x601e8f[_0xbd75('0x10')]===_0xbd75('0x11')&&typeof _0x601e8f[_0xbd75('0x12')]==='undefined';var _0x16e806=_0x3af4d2[_0xbd75('0x13')];var _0x199951=_0x571590?0x0:_0x601e8f[_0xbd75('0x10')];var _0x114a38=_0x571590?_0x3af4d2[_0xbd75('0x13')]:_0x601e8f[_0xbd75('0x10')]+_0x601e8f[_0xbd75('0x12')];var _0x438db4;if(_0x114a38>=_0x16e806){_0x114a38=_0x16e806;_0x438db4=0xc8;}else{_0x438db4=0xce;}_0x3d9efa[_0xbd75('0xf')](_0x438db4);return _0x3d9efa['set'](_0xbd75('0x14'),_0x199951+'-'+_0x114a38+'/'+_0x16e806)[_0xbd75('0x15')](_0x3af4d2);}return null;};}function saveUpdates(_0x236fb1){return function(_0x3bd7e6){if(_0x3bd7e6){return _0x3bd7e6[_0xbd75('0x16')](_0x236fb1)[_0xbd75('0x17')](function(_0x3cdbe5){return _0x3cdbe5;});}return null;};}function removeEntity(_0x5de5dd){return function(_0x2da829){if(_0x2da829){return _0x2da829[_0xbd75('0x18')]()[_0xbd75('0x17')](function(){_0x5de5dd[_0xbd75('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f5fd){return function(_0x249fa4){if(!_0x249fa4){_0x59f5fd[_0xbd75('0x19')](0x194);}return _0x249fa4;};}function handleError(_0x1e05bd,_0x2f8ba3){_0x2f8ba3=_0x2f8ba3||0x1f4;return function(_0x4eb533){logger['error'](_0x4eb533[_0xbd75('0x1a')]);if(_0x4eb533[_0xbd75('0x1b')]){delete _0x4eb533[_0xbd75('0x1b')];}_0x1e05bd[_0xbd75('0xf')](_0x2f8ba3)[_0xbd75('0x1c')](_0x4eb533);};}exports[_0xbd75('0x1d')]=function(_0x456800,_0x17d6fb){var _0xa81779={};var _0x116181=_[_0xbd75('0x1e')](db[_0xbd75('0x1f')][_0xbd75('0x20')],function(_0x128818){return{'name':_0x128818[_0xbd75('0x21')],'type':_0x128818[_0xbd75('0x22')][_0xbd75('0x23')]};});_0xa81779=qs['getOptions'](_0x116181,_0x456800);return interaction[_0xbd75('0x24')]('sms',_0x456800['query'],_0x456800[_0xbd75('0x25')],_0xa81779,_0x116181)[_0xbd75('0x17')](respondWithFilteredResult(_0x17d6fb,_0xa81779))[_0xbd75('0x26')](handleError(_0x17d6fb,null));};exports[_0xbd75('0x27')]=function(_0x482256,_0x529547){var _0x3b1dfb={'raw':![],'where':{'id':_0x482256[_0xbd75('0x28')]['id']}},_0x4bcef9={};_0x4bcef9[_0xbd75('0x29')]=_[_0xbd75('0x2a')](db[_0xbd75('0x1f')][_0xbd75('0x20')]);_0x4bcef9['query']=_['keys'](_0x482256['query']);_0x4bcef9[_0xbd75('0x2b')]=_['intersection'](_0x4bcef9[_0xbd75('0x29')],_0x4bcef9[_0xbd75('0x2c')]);_0x3b1dfb['attributes']=_[_0xbd75('0x2d')](_0x4bcef9[_0xbd75('0x29')],qs['fields'](_0x482256['query']['fields']));_0x3b1dfb['attributes']=_0x3b1dfb[_0xbd75('0x2e')][_0xbd75('0x2f')]?_0x3b1dfb[_0xbd75('0x2e')]:_0x4bcef9['model'];if(_0x482256[_0xbd75('0x2c')][_0xbd75('0x30')]){_0x3b1dfb[_0xbd75('0x31')]=[{'all':!![]}];}_0x3b1dfb=_['merge']({},_0x3b1dfb,_0x482256['options']);return db[_0xbd75('0x1f')][_0xbd75('0x32')](_0x3b1dfb)[_0xbd75('0x17')](handleEntityNotFound(_0x529547,null))['then'](respondWithResult(_0x529547,null))[_0xbd75('0x26')](handleError(_0x529547,null));};exports['create']=function(_0x289b2f,_0x54217b){return db[_0xbd75('0x1f')][_0xbd75('0x33')](_0x289b2f[_0xbd75('0x34')],{})[_0xbd75('0x17')](respondWithResult(_0x54217b,0xc9))[_0xbd75('0x26')](handleError(_0x54217b,null));};exports[_0xbd75('0x16')]=function(_0x3bdab7,_0x1b1498){if(_0x3bdab7['body']['id']){delete _0x3bdab7['body']['id'];}return db[_0xbd75('0x1f')]['find']({'where':{'id':_0x3bdab7['params']['id']}})[_0xbd75('0x17')](handleEntityNotFound(_0x1b1498,null))['then'](saveUpdates(_0x3bdab7['body'],null))['then'](respondWithResult(_0x1b1498,null))[_0xbd75('0x26')](handleError(_0x1b1498,null));};exports[_0xbd75('0x18')]=function(_0x4d2ca6,_0x4edb04){return db[_0xbd75('0x1f')][_0xbd75('0x32')]({'where':{'id':_0x4d2ca6[_0xbd75('0x28')]['id']}})[_0xbd75('0x17')](handleEntityNotFound(_0x4edb04,null))[_0xbd75('0x17')](removeEntity(_0x4edb04,null))['catch'](handleError(_0x4edb04,null));};exports[_0xbd75('0x35')]=function(_0xb3dbe3,_0x127bfb){return db[_0xbd75('0x1f')][_0xbd75('0x35')]()[_0xbd75('0x17')](respondWithResult(_0x127bfb,null))[_0xbd75('0x26')](handleError(_0x127bfb,null));};exports[_0xbd75('0x36')]=function(_0x58db37,_0xf0ea64){return db[_0xbd75('0x37')][_0xbd75('0x32')]({'where':{'id':_0x58db37[_0xbd75('0x28')]['id']}})[_0xbd75('0x17')](handleEntityNotFound(_0xf0ea64,null))['then'](function(_0x94722d){if(_0x94722d){return _0x94722d[_0xbd75('0x36')](_0x58db37['body'][_0xbd75('0x38')],_[_0xbd75('0x39')](_0x58db37[_0xbd75('0x34')],[_0xbd75('0x38'),'id'])||{});}})[_0xbd75('0x17')](respondWithResult(_0xf0ea64,null))[_0xbd75('0x26')](handleError(_0xf0ea64,null));};exports[_0xbd75('0x3a')]=function(_0x3b92d5,_0x12bec7){var _0x5151ff={'raw':![],'where':{}};var _0x34b167={};var _0x136037={'count':0x0,'rows':[]};return db[_0xbd75('0x1f')][_0xbd75('0x3b')]({'where':{'id':_0x3b92d5[_0xbd75('0x28')]['id']}})[_0xbd75('0x17')](handleEntityNotFound(_0x12bec7,null))[_0xbd75('0x17')](function(_0xaed485){if(_0xaed485){_0x34b167[_0xbd75('0x29')]=_[_0xbd75('0x2a')](db['SmsMessage'][_0xbd75('0x20')]);_0x34b167[_0xbd75('0x2c')]=_['keys'](_0x3b92d5[_0xbd75('0x2c')]);_0x34b167[_0xbd75('0x2b')]=_[_0xbd75('0x2d')](_0x34b167[_0xbd75('0x29')],_0x34b167['query']);_0x5151ff['attributes']=_[_0xbd75('0x2d')](_0x34b167[_0xbd75('0x29')],qs[_0xbd75('0x3c')](_0x3b92d5[_0xbd75('0x2c')][_0xbd75('0x3c')]));_0x5151ff[_0xbd75('0x2e')]=_0x5151ff[_0xbd75('0x2e')][_0xbd75('0x2f')]?_0x5151ff[_0xbd75('0x2e')]:_0x34b167[_0xbd75('0x29')];if(!_0x3b92d5['query'][_0xbd75('0x3d')](_0xbd75('0x3e'))){_0x5151ff[_0xbd75('0x12')]=qs['limit'](_0x3b92d5['query'][_0xbd75('0x12')]);_0x5151ff['offset']=qs[_0xbd75('0x10')](_0x3b92d5[_0xbd75('0x2c')][_0xbd75('0x10')]);}_0x5151ff[_0xbd75('0x3f')]=qs['sort'](_0x3b92d5[_0xbd75('0x2c')][_0xbd75('0x40')]);_0x5151ff[_0xbd75('0x41')]=qs[_0xbd75('0x2b')](_['pick'](_0x3b92d5[_0xbd75('0x2c')],_0x34b167['filters']));_0x5151ff[_0xbd75('0x41')]['SmsInteractionId']=_0xaed485['id'];if(_0x3b92d5[_0xbd75('0x2c')][_0xbd75('0x42')]){_0x5151ff[_0xbd75('0x41')]=_[_0xbd75('0x43')](_0x5151ff['where'],{'$or':_[_0xbd75('0x1e')](_0x5151ff[_0xbd75('0x2e')],function(_0xc1a486){var _0x44d202={};_0x44d202[_0xc1a486]={'$like':'%'+_0x3b92d5['query'][_0xbd75('0x42')]+'%'};return _0x44d202;})});}if(_0x3b92d5['query'][_0xbd75('0x44')]){var _0x565f48=_0x3b92d5[_0xbd75('0x2c')][_0xbd75('0x44')]['split'](',');var _0x2c8747={};_0x2c8747[_0x565f48[0x0]]={'$gte':moment(_0x565f48[0x1])[_0xbd75('0x45')](_0xbd75('0x46'))};_0x5151ff[_0xbd75('0x41')]=_[_0xbd75('0x43')](_0x5151ff[_0xbd75('0x41')],_0x2c8747);}_0x5151ff=_[_0xbd75('0x43')]({},_0x5151ff,_0x3b92d5[_0xbd75('0x47')]);return db[_0xbd75('0x37')][_0xbd75('0x13')]({'where':_0x5151ff[_0xbd75('0x41')]})['then'](function(_0x2f0e3a){_0x136037['count']=_0x2f0e3a;if(_0x3b92d5[_0xbd75('0x2c')][_0xbd75('0x30')]){_0x5151ff['include']=[{'all':!![]}];}return db['SmsMessage'][_0xbd75('0x24')](_0x5151ff);})[_0xbd75('0x17')](function(_0x4d355f){_0x136037[_0xbd75('0x48')]=_0x4d355f;return _0x136037;});}})[_0xbd75('0x17')](respondWithFilteredResult(_0x12bec7,_0x5151ff))['catch'](handleError(_0x12bec7,null));};exports['addTags']=function(_0x3070fe,_0x25df08){return db[_0xbd75('0x1f')][_0xbd75('0x32')]({'where':{'id':_0x3070fe['params']['id']}})[_0xbd75('0x17')](handleEntityNotFound(_0x25df08,null))[_0xbd75('0x17')](function(_0x13a777){if(_0x13a777){return _0x13a777[_0xbd75('0x49')](_0x3070fe[_0xbd75('0x34')][_0xbd75('0x38')],_['omit'](_0x3070fe[_0xbd75('0x34')],[_0xbd75('0x38'),'id'])||{})[_0xbd75('0x4a')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xbd75('0x4b')],'where':{'id':_0x3070fe['body'][_0xbd75('0x38')]}});})[_0xbd75('0x17')](function(_0x334a57){socket['emit'](_0xbd75('0x4c'),{'id':Number(_0x3070fe[_0xbd75('0x28')]['id']),'tags':_0x334a57||[]});return{'id':Number(_0x3070fe[_0xbd75('0x28')]['id']),'tags':_0x334a57||[]};});}})[_0xbd75('0x17')](respondWithResult(_0x25df08,null))[_0xbd75('0x26')](handleError(_0x25df08,null));};exports['removeTags']=function(_0x2b5509,_0xd028ba){return db[_0xbd75('0x1f')][_0xbd75('0x32')]({'where':{'id':_0x2b5509[_0xbd75('0x28')]['id']}})[_0xbd75('0x17')](handleEntityNotFound(_0xd028ba,null))[_0xbd75('0x17')](function(_0x7f3166){if(_0x7f3166){return _0x7f3166['removeTags'](_0x2b5509['query'][_0xbd75('0x38')]);}})[_0xbd75('0x17')](respondWithStatusCode(_0xd028ba,null))[_0xbd75('0x26')](handleError(_0xd028ba,null));};exports[_0xbd75('0x4d')]=function(_0x356f3d,_0x3176f5){var _0x5c1848=moment()[_0xbd75('0x4e')]()[_0xbd75('0x4f')]();var _0x4b8bb6=path[_0xbd75('0x50')](config['root'],_0xbd75('0x51'),_0xbd75('0x52'),_0xbd75('0x53'));var _0x420659=path[_0xbd75('0x50')](_0x4b8bb6,_0x5c1848);var _0x57896a=util[_0xbd75('0x45')](_0xbd75('0x54'),_0x356f3d[_0xbd75('0x28')]['id'],_0x5c1848);var _0x1c84e3=path[_0xbd75('0x50')](_0x4b8bb6,_0x57896a);var _0x1f2042=[];_0x1f2042[_0xbd75('0x55')]({'model':db[_0xbd75('0x56')],'as':_0xbd75('0x56'),'attributes':['id',_0xbd75('0x57')],'raw':!![]});_0x1f2042[_0xbd75('0x55')]({'model':db[_0xbd75('0x58')],'as':_0xbd75('0x59'),'attributes':['id',_0xbd75('0x5a'),_0xbd75('0x5b')],'raw':!![]});var _0x1960cd=[{'model':db[_0xbd75('0x37')],'as':'Messages','attributes':['id','body',_0xbd75('0x5c'),_0xbd75('0x5d'),'secret',_0xbd75('0x5e')],'include':_0x1f2042}];_0x1960cd[_0xbd75('0x55')]({'model':db[_0xbd75('0x5f')],'as':_0xbd75('0x60'),'attributes':['id',_0xbd75('0x1b')]});_0x1960cd[_0xbd75('0x55')]({'model':db['User'],'as':_0xbd75('0x61'),'attributes':['id',_0xbd75('0x57')]});return db['SmsInteraction'][_0xbd75('0x32')]({'where':{'id':_0x356f3d['params']['id']},'include':_0x1960cd})[_0xbd75('0x17')](handleEntityNotFound(_0x3176f5,null))[_0xbd75('0x17')](function(_0x2b0ff7){if(_0x2b0ff7){var _0x10d7f1=_0x2b0ff7[_0xbd75('0x62')]({'plain':!![]});fs[_0xbd75('0x63')](_0x420659);var _0x35f29d={'channel':_0xbd75('0x64'),'account':_0x10d7f1[_0xbd75('0x60')]['name'],'agent':_0x10d7f1[_0xbd75('0x61')]?_0x10d7f1[_0xbd75('0x61')][_0xbd75('0x57')]:_0xbd75('0x65'),'createdAt':moment(_0x10d7f1['createdAt'])[_0xbd75('0x45')](_0xbd75('0x46'))[_0xbd75('0x4f')](),'closedAt':_0x10d7f1[_0xbd75('0x66')]?moment(_0x10d7f1['closedAt'])['format'](_0xbd75('0x46'))['toString']():'','disposition':_0x10d7f1['disposition'],'messages':_(_0x10d7f1[_0xbd75('0x67')])[_0xbd75('0x42')]({'secret':![]})[_0xbd75('0x1e')](function(_0x362ee0){return{'date':moment(_0x362ee0['createdAt'])[_0xbd75('0x45')](_0xbd75('0x46'))['toString'](),'sender':_0x362ee0[_0xbd75('0x5d')]===_0xbd75('0x68')?_0x362ee0[_0xbd75('0x56')]?_0x362ee0[_0xbd75('0x56')]['fullname']:_0xbd75('0x69'):_0x362ee0[_0xbd75('0x59')][_0xbd75('0x5a')]+(_0x362ee0[_0xbd75('0x59')][_0xbd75('0x5b')]?'\x20'+_0x362ee0[_0xbd75('0x59')][_0xbd75('0x5b')]:''),'body':_0x362ee0[_0xbd75('0x34')],'direction':_0x362ee0['direction']===_0xbd75('0x68')?'A':'C','secret':_0x362ee0[_0xbd75('0x6a')],'read':_0x362ee0[_0xbd75('0x5e')]};})[_0xbd75('0x6b')]()};return ejs[_0xbd75('0x6c')](path[_0xbd75('0x50')](config[_0xbd75('0x6d')],_0xbd75('0x51'),_0xbd75('0x6e'),_0xbd75('0x6f')),{'interaction':_0x35f29d})['then'](function(_0x5af193){var _0x2cbaf1=path[_0xbd75('0x50')](_0x420659,_0xbd75('0x70')+_0x10d7f1['id']+'-'+_0x5c1848+_0xbd75('0x71'));var _0x271920={'path':_0x2cbaf1,'channel':_0xbd75('0x64'),'interactionId':_0x10d7f1['id']};return pdf[_0xbd75('0x72')](_0x5af193,_0x271920);})['then'](function(){return new BPromise(function(_0x494d61,_0x14c736){zipdir(_0x420659,{'saveTo':_0x1c84e3},function(_0x38885c,_0x35bc22){if(_0x38885c)return _0x14c736(_0x38885c);return _0x494d61(_0x35bc22);});})[_0xbd75('0x17')](function(){return new BPromise(function(_0x5ce808,_0x6020d6){rimraf(_0x420659,function(_0xe9213b){if(_0xe9213b)_0x6020d6(_0xe9213b);return _0x5ce808();});});})[_0xbd75('0x17')](function(){return _0x3176f5[_0xbd75('0x4d')](_0x1c84e3,_0x57896a,function(_0x51417c){if(_0x51417c){console['log'](_0xbd75('0x73'),_0x51417c);}else{fs['unlinkSync'](_0x1c84e3);}});});});}else{return _0x3176f5[_0xbd75('0x19')](0xc8);}})['catch'](handleError(_0x3176f5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ab33ddb..dcb05da 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 _0x5204=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4e534d,_0x4a311a){var _0x562655=function(_0x142320){while(--_0x142320){_0x4e534d['push'](_0x4e534d['shift']());}};_0x562655(++_0x4a311a);}(_0x5204,0xdf));var _0x4520=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0x5204[_0x1283d4];return _0x433643;};'use strict';var EventEmitter=require(_0x4520('0x0'));var SmsInteraction=require(_0x4520('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4520('0x1'))['db'][_0x4520('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4520('0x3')](0x0);var events={'afterCreate':_0x4520('0x4'),'afterUpdate':_0x4520('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41d89c){return function(_0x58b8a8,_0x180174,_0x209381){_0x58b8a8[_0x4520('0x6')]({'attributes':['id'],'raw':!![]})[_0x4520('0x7')](function(_0x396d29){_0x58b8a8[_0x4520('0x8')](_0x4520('0x9'),_0x396d29['map'](function(_0x297f0a){return{'id':_0x297f0a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x58b8a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4520('0x7')](function(_0x37a617){_0x58b8a8[_0x4520('0x8')](_0x4520('0xa'),_0x37a617[_0x4520('0xb')]);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c+':'+_0x58b8a8['id'],_0x58b8a8);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c,_0x58b8a8);_0x209381(null);})[_0x4520('0xd')](_0x209381(null));};}for(var e in events){if(events[_0x4520('0xe')](e)){var event=events[e];SmsInteraction[_0x4520('0xf')](e,emitEvent(event));}}module[_0x4520('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xf4f4=['findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x384082,_0x8080d2){_0x384082=_0x384082-0x0;var _0x2c4de8=_0xf4f4[_0x384082];return _0x2c4de8;};'use strict';var EventEmitter=require(_0x4f4f('0x0'));var SmsInteraction=require(_0x4f4f('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4f4f('0x1'))['db'][_0x4f4f('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4f4f('0x3')](0x0);var events={'afterCreate':_0x4f4f('0x4'),'afterUpdate':_0x4f4f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5a752b){return function(_0x593952,_0x3f274d,_0x132d5c){_0x593952[_0x4f4f('0x6')]({'attributes':['id'],'raw':!![]})[_0x4f4f('0x7')](function(_0x3c4877){_0x593952[_0x4f4f('0x8')](_0x4f4f('0x9'),_0x3c4877[_0x4f4f('0xa')](function(_0x48f6b9){return{'id':_0x48f6b9['id']};}));return SmsMessage[_0x4f4f('0xb')]({'where':{'SmsInteractionId':_0x593952['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f4f('0x7')](function(_0x39e36b){_0x593952[_0x4f4f('0x8')](_0x4f4f('0xc'),_0x39e36b[_0x4f4f('0xd')]);SmsInteractionEvents[_0x4f4f('0xe')](_0x5a752b+':'+_0x593952['id'],_0x593952);SmsInteractionEvents[_0x4f4f('0xe')](_0x5a752b,_0x593952);_0x132d5c(null);})['catch'](_0x132d5c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x4f4f('0xf')](e,emitEvent(event));}}module[_0x4f4f('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7a55fa8..7670e3f 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 _0x208a=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x30fe6d,_0x4c7ab6){var _0xde954c=function(_0x265b13){while(--_0x265b13){_0x30fe6d['push'](_0x30fe6d['shift']());}};_0xde954c(++_0x4c7ab6);}(_0x208a,0x1de));var _0xa208=function(_0x59ea7a,_0x396b92){_0x59ea7a=_0x59ea7a-0x0;var _0x2ac10f=_0x208a[_0x59ea7a];return _0x2ac10f;};'use strict';var _=require(_0xa208('0x0'));var util=require(_0xa208('0x1'));var logger=require(_0xa208('0x2'))(_0xa208('0x3'));var moment=require(_0xa208('0x4'));var BPromise=require('bluebird');var rp=require(_0xa208('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa208('0x6'));var config=require(_0xa208('0x7'));var attributes=require(_0xa208('0x8'));module[_0xa208('0x9')]=function(_0x78aa6b,_0x4989b7){return _0x78aa6b[_0xa208('0xa')](_0xa208('0xb'),attributes,{'tableName':_0xa208('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2401b5,_0x4c26af,_0x38b0d7){if(_0x2401b5[_0xa208('0xd')](_0xa208('0xe'))){_0x2401b5[_0xa208('0xf')]=moment()[_0xa208('0x10')](_0xa208('0x11'));}_0x38b0d7(null,_0x2401b5);}}});}; \ No newline at end of file +var _0x8801=['exports','define','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','./smsInteraction.attributes'];(function(_0x8844ae,_0x324bcd){var _0x23de44=function(_0x24024f){while(--_0x24024f){_0x8844ae['push'](_0x8844ae['shift']());}};_0x23de44(++_0x324bcd);}(_0x8801,0xd9));var _0x1880=function(_0x2d4d11,_0x1718d5){_0x2d4d11=_0x2d4d11-0x0;var _0x49c2fc=_0x8801[_0x2d4d11];return _0x49c2fc;};'use strict';var _=require(_0x1880('0x0'));var util=require(_0x1880('0x1'));var logger=require(_0x1880('0x2'))(_0x1880('0x3'));var moment=require(_0x1880('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1880('0x5'));var rimraf=require(_0x1880('0x6'));var config=require('../../config/environment');var attributes=require(_0x1880('0x7'));module[_0x1880('0x8')]=function(_0x482bdf,_0x43b24e){return _0x482bdf[_0x1880('0x9')](_0x1880('0xa'),attributes,{'tableName':_0x1880('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d0d20,_0x6b151f,_0x184fc9){if(_0x5d0d20[_0x1880('0xc')]('closed')){_0x5d0d20[_0x1880('0xd')]=moment()['format'](_0x1880('0xe'));}_0x184fc9(null,_0x5d0d20);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d2228c8..51f7153 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 _0x4559=['./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','then','debug','stringify','AddTagsToSmsInteraction','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x4559,0x141));var _0x9455=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x4559[_0x60df74];return _0x5ee872;};'use strict';var _=require(_0x9455('0x0'));var util=require(_0x9455('0x1'));var moment=require('moment');var BPromise=require(_0x9455('0x2'));var rs=require(_0x9455('0x3'));var fs=require('fs');var Redis=require(_0x9455('0x4'));var db=require(_0x9455('0x5'))['db'];var utils=require(_0x9455('0x6'));var logger=require(_0x9455('0x7'))(_0x9455('0x8'));var config=require('../../config/environment');var jayson=require(_0x9455('0x9'));var client=jayson[_0x9455('0xa')][_0x9455('0xb')]({'port':0x232a});config[_0x9455('0xc')]=_[_0x9455('0xd')](config[_0x9455('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9455('0xe'))(new Redis(config[_0x9455('0xc')]));require(_0x9455('0xf'))[_0x9455('0x10')](socket);function respondWithRpcPromise(_0x21d77c,_0x3d8000,_0x694f6d){return new BPromise(function(_0x7934c1,_0x3af3ba){return client[_0x9455('0x11')](_0x21d77c,_0x694f6d)['then'](function(_0x5f9e9b){logger[_0x9455('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x3d8000,'request\x20sent');logger['debug'](_0x9455('0x13'),_0x3d8000,_0x9455('0x14'),JSON['stringify'](_0x5f9e9b));if(_0x5f9e9b[_0x9455('0x15')]){if(_0x5f9e9b[_0x9455('0x15')][_0x9455('0x16')]===0x1f4){logger[_0x9455('0x15')](_0x9455('0x17'),_0x3d8000,_0x5f9e9b[_0x9455('0x15')][_0x9455('0x18')]);return _0x3af3ba(_0x5f9e9b[_0x9455('0x15')]['message']);}logger[_0x9455('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x3d8000,_0x5f9e9b[_0x9455('0x15')][_0x9455('0x18')]);return _0x7934c1(_0x5f9e9b[_0x9455('0x15')][_0x9455('0x18')]);}else{logger[_0x9455('0x12')](_0x9455('0x17'),_0x3d8000,_0x9455('0x14'));_0x7934c1(_0x5f9e9b['result'][_0x9455('0x18')]);}})[_0x9455('0x19')](function(_0x569460){logger['error'](_0x9455('0x17'),_0x3d8000,_0x569460);_0x3af3ba(_0x569460);});});}exports[_0x9455('0x1a')]=function(_0x2650ab){var _0x396b07=this;return new Promise(function(_0x3937c8,_0xf1ed7e){return db['SmsInteraction'][_0x9455('0x1b')](_0x2650ab[_0x9455('0x1c')],{'raw':_0x2650ab[_0x9455('0x1d')]?_0x2650ab['options'][_0x9455('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2650ab[_0x9455('0x1d')]?_0x2650ab[_0x9455('0x1d')][_0x9455('0x1f')]||null:null,'attributes':_0x2650ab['options']?_0x2650ab[_0x9455('0x1d')][_0x9455('0x20')]||null:null,'limit':_0x2650ab[_0x9455('0x1d')]?_0x2650ab[_0x9455('0x1d')][_0x9455('0x21')]||null:null})[_0x9455('0x22')](function(_0x283748){logger[_0x9455('0x12')]('UpdateSmsInteraction',_0x2650ab);logger[_0x9455('0x23')](_0x9455('0x1a'),_0x2650ab,JSON[_0x9455('0x24')](_0x283748));_0x3937c8(_0x283748);})['catch'](function(_0x3e6c75){logger[_0x9455('0x15')]('UpdateSmsInteraction',_0x3e6c75[_0x9455('0x18')],_0x2650ab);_0xf1ed7e(_0x396b07[_0x9455('0x15')](0x1f4,_0x3e6c75['message']));});});};exports[_0x9455('0x25')]=function(_0x34e9ca){return new Promise(function(_0x19e716,_0x414e62){return db['SmsInteraction']['find']({'where':_0x34e9ca[_0x9455('0x1d')]?_0x34e9ca[_0x9455('0x1d')][_0x9455('0x1f')]||null:null})['then'](function(_0x5cab38){if(_0x5cab38){return _0x5cab38[_0x9455('0x26')](_0x34e9ca[_0x9455('0x1c')][_0x9455('0x27')],_['omit'](_0x34e9ca['body'],[_0x9455('0x27'),'id'])||{});}})[_0x9455('0x28')](function(_0x377b55){logger['info'](_0x9455('0x29'),_0x34e9ca);logger[_0x9455('0x23')](_0x9455('0x29'),_0x34e9ca,JSON[_0x9455('0x24')](_0x377b55));_0x19e716(_0x377b55);})['catch'](function(_0x1409d0){logger[_0x9455('0x15')](_0x9455('0x29'),_0x1409d0['message'],_0x34e9ca);_0x414e62(_this[_0x9455('0x15')](0x1f4,_0x1409d0[_0x9455('0x18')]));});});}; \ No newline at end of file +var _0x179a=['info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','body','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','./smsInteraction.socket','register','request','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x179a,0x96));var _0xa179=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x179a[_0x43a6cd];return _0x5acb36;};'use strict';var _=require(_0xa179('0x0'));var util=require(_0xa179('0x1'));var moment=require(_0xa179('0x2'));var BPromise=require('bluebird');var rs=require(_0xa179('0x3'));var fs=require('fs');var Redis=require(_0xa179('0x4'));var db=require(_0xa179('0x5'))['db'];var utils=require(_0xa179('0x6'));var logger=require(_0xa179('0x7'))(_0xa179('0x8'));var config=require(_0xa179('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa179('0xa')][_0xa179('0xb')]({'port':0x232a});config['redis']=_[_0xa179('0xc')](config[_0xa179('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa179('0xd')]));require(_0xa179('0xe'))[_0xa179('0xf')](socket);function respondWithRpcPromise(_0x14a59e,_0x234ba5,_0x4be52c){return new BPromise(function(_0x3ae213,_0x5cfe61){return client[_0xa179('0x10')](_0x14a59e,_0x4be52c)[_0xa179('0x11')](function(_0xf93182){logger[_0xa179('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x234ba5,_0xa179('0x13'));logger[_0xa179('0x14')](_0xa179('0x15'),_0x234ba5,_0xa179('0x13'),JSON[_0xa179('0x16')](_0xf93182));if(_0xf93182[_0xa179('0x17')]){if(_0xf93182['error']['code']===0x1f4){logger[_0xa179('0x17')](_0xa179('0x18'),_0x234ba5,_0xf93182['error']['message']);return _0x5cfe61(_0xf93182[_0xa179('0x17')][_0xa179('0x19')]);}logger['error'](_0xa179('0x18'),_0x234ba5,_0xf93182[_0xa179('0x17')][_0xa179('0x19')]);return _0x3ae213(_0xf93182[_0xa179('0x17')]['message']);}else{logger[_0xa179('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x234ba5,_0xa179('0x13'));_0x3ae213(_0xf93182[_0xa179('0x1a')][_0xa179('0x19')]);}})[_0xa179('0x1b')](function(_0x20dc8f){logger['error'](_0xa179('0x18'),_0x234ba5,_0x20dc8f);_0x5cfe61(_0x20dc8f);});});}exports['UpdateSmsInteraction']=function(_0x36c765){var _0xf92e47=this;return new Promise(function(_0x1d9200,_0x3e3781){return db[_0xa179('0x1c')][_0xa179('0x1d')](_0x36c765[_0xa179('0x1e')],{'raw':_0x36c765['options']?_0x36c765[_0xa179('0x1f')][_0xa179('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36c765[_0xa179('0x1f')]?_0x36c765[_0xa179('0x1f')][_0xa179('0x21')]||null:null,'attributes':_0x36c765[_0xa179('0x1f')]?_0x36c765[_0xa179('0x1f')]['attributes']||null:null,'limit':_0x36c765['options']?_0x36c765['options'][_0xa179('0x22')]||null:null})[_0xa179('0x11')](function(_0xcab16c){logger[_0xa179('0x12')](_0xa179('0x23'),_0x36c765);logger['debug']('UpdateSmsInteraction',_0x36c765,JSON[_0xa179('0x16')](_0xcab16c));_0x1d9200(_0xcab16c);})['catch'](function(_0x91dd88){logger[_0xa179('0x17')](_0xa179('0x23'),_0x91dd88[_0xa179('0x19')],_0x36c765);_0x3e3781(_0xf92e47[_0xa179('0x17')](0x1f4,_0x91dd88[_0xa179('0x19')]));});});};exports[_0xa179('0x24')]=function(_0x30f409){return new Promise(function(_0x4a1692,_0x15491d){return db[_0xa179('0x1c')][_0xa179('0x25')]({'where':_0x30f409[_0xa179('0x1f')]?_0x30f409[_0xa179('0x1f')][_0xa179('0x21')]||null:null})[_0xa179('0x11')](function(_0x5e8732){if(_0x5e8732){return _0x5e8732[_0xa179('0x26')](_0x30f409[_0xa179('0x1e')]['ids'],_['omit'](_0x30f409[_0xa179('0x1e')],[_0xa179('0x27'),'id'])||{});}})[_0xa179('0x28')](function(_0x1bd23e){logger['info']('AddTags',_0x30f409);logger['debug']('AddTags',_0x30f409,JSON[_0xa179('0x16')](_0x1bd23e));_0x4a1692(_0x1bd23e);})[_0xa179('0x1b')](function(_0x5e4bad){logger['error'](_0xa179('0x29'),_0x5e4bad[_0xa179('0x19')],_0x30f409);_0x15491d(_this[_0xa179('0x17')](0x1f4,_0x5e4bad[_0xa179('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3c71cd8..adc3569 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 _0x2930=['length','save','remove','update','emit','removeListener','register'];(function(_0x3fe0c2,_0x3fe93e){var _0x4cd1d8=function(_0x485456){while(--_0x485456){_0x3fe0c2['push'](_0x3fe0c2['shift']());}};_0x4cd1d8(++_0x3fe93e);}(_0x2930,0x7f));var _0x0293=function(_0xdf529e,_0x59db47){_0xdf529e=_0xdf529e-0x0;var _0x3c58ba=_0x2930[_0xdf529e];return _0x3c58ba;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0293('0x0'),_0x0293('0x1'),_0x0293('0x2')];function createListener(_0xf050c0,_0x156332){return function(_0x1b3ac7){_0x156332[_0x0293('0x3')](_0xf050c0,_0x1b3ac7);};}function removeListener(_0x9de0c,_0x4b5e4b){return function(){SmsInteractionEvents[_0x0293('0x4')](_0x9de0c,_0x4b5e4b);};}exports[_0x0293('0x5')]=function(_0x3af89c){for(var _0x517815=0x0,_0x48a433=events[_0x0293('0x6')];_0x517815<_0x48a433;_0x517815++){var _0x37c88d=events[_0x517815];var _0x3db8e7=createListener('smsInteraction:'+_0x37c88d,_0x3af89c);SmsInteractionEvents['on'](_0x37c88d,_0x3db8e7);}}; \ No newline at end of file +var _0x77c9=['./smsInteraction.events','save','remove','update','emit'];(function(_0x39a526,_0x46c205){var _0x20728a=function(_0x8a5893){while(--_0x8a5893){_0x39a526['push'](_0x39a526['shift']());}};_0x20728a(++_0x46c205);}(_0x77c9,0x14f));var _0x977c=function(_0x2bdecd,_0x21805f){_0x2bdecd=_0x2bdecd-0x0;var _0x56116e=_0x77c9[_0x2bdecd];return _0x56116e;};'use strict';var SmsInteractionEvents=require(_0x977c('0x0'));var events=[_0x977c('0x1'),_0x977c('0x2'),_0x977c('0x3')];function createListener(_0x43fbcd,_0x23c8aa){return function(_0x515d4c){_0x23c8aa[_0x977c('0x4')](_0x43fbcd,_0x515d4c);};}function removeListener(_0x2e3dae,_0x1b15bc){return function(){SmsInteractionEvents['removeListener'](_0x2e3dae,_0x1b15bc);};}exports['register']=function(_0x29755b){for(var _0x3a3ec1=0x0,_0x15819c=events['length'];_0x3a3ec1<_0x15819c;_0x3a3ec1++){var _0x3bcaa8=events[_0x3a3ec1];var _0x560c82=createListener('smsInteraction:'+_0x3bcaa8,_0x29755b);SmsInteractionEvents['on'](_0x3bcaa8,_0x560c82);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ee207c3..045ed04 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 _0xbeb2=['exports','util','path','fs-extra','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','put','accept','delete'];(function(_0x215c73,_0x272244){var _0x3287b2=function(_0x59c9bc){while(--_0x59c9bc){_0x215c73['push'](_0x215c73['shift']());}};_0x3287b2(++_0x272244);}(_0xbeb2,0x1ba));var _0x2beb=function(_0x1ca86e,_0x17f5a8){_0x1ca86e=_0x1ca86e-0x0;var _0x2cae6d=_0xbeb2[_0x1ca86e];return _0x2cae6d;};'use strict';var multer=require('multer');var util=require(_0x2beb('0x0'));var path=require(_0x2beb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2beb('0x2'));var auth=require(_0x2beb('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2beb('0x4'));router[_0x2beb('0x5')]('/',auth[_0x2beb('0x6')](),controller[_0x2beb('0x7')]);router[_0x2beb('0x5')](_0x2beb('0x8'),auth[_0x2beb('0x6')](),controller[_0x2beb('0x9')]);router[_0x2beb('0x5')](_0x2beb('0xa'),auth[_0x2beb('0x6')](),controller[_0x2beb('0xb')]);router[_0x2beb('0xc')]('/',auth[_0x2beb('0x6')](),interaction['tracked'](_0x2beb('0xd'),_0x2beb('0xe')),controller[_0x2beb('0xf')]);router['post'](_0x2beb('0x10'),controller['status']);router['put'](_0x2beb('0xa'),auth[_0x2beb('0x6')](),controller['update']);router[_0x2beb('0x11')]('/:id/accept',auth[_0x2beb('0x6')](),controller[_0x2beb('0x12')]);router[_0x2beb('0x11')]('/:id/reject',auth[_0x2beb('0x6')](),controller['reject']);router[_0x2beb('0x13')]('/:id',auth[_0x2beb('0x6')](),controller['destroy']);module[_0x2beb('0x14')]=router; \ No newline at end of file +var _0x6a47=['../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','get','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','/:id/accept','put','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x6a47,0x112));var _0x76a4=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x6a47[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var path=require(_0x76a4('0x2'));var timeout=require(_0x76a4('0x3'));var express=require(_0x76a4('0x4'));var router=express['Router']();var fs_extra=require(_0x76a4('0x5'));var auth=require(_0x76a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x76a4('0x7'));var controller=require(_0x76a4('0x8'));router['get']('/',auth[_0x76a4('0x9')](),controller[_0x76a4('0xa')]);router['get'](_0x76a4('0xb'),auth[_0x76a4('0x9')](),controller['describe']);router[_0x76a4('0xc')](_0x76a4('0xd'),auth[_0x76a4('0x9')](),controller['show']);router[_0x76a4('0xe')]('/',auth[_0x76a4('0x9')](),interaction[_0x76a4('0xf')](_0x76a4('0x10'),_0x76a4('0x11')),controller[_0x76a4('0x12')]);router[_0x76a4('0xe')](_0x76a4('0x13'),controller[_0x76a4('0x14')]);router['put'](_0x76a4('0xd'),auth[_0x76a4('0x9')](),controller[_0x76a4('0x15')]);router['put'](_0x76a4('0x16'),auth[_0x76a4('0x9')](),controller['accept']);router[_0x76a4('0x17')](_0x76a4('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0x76a4('0x19')](_0x76a4('0xd'),auth['isAuthenticated'](),controller[_0x76a4('0x1a')]);module[_0x76a4('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 f3afc20..3850bc1 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 _0x842d=['DATE','sequelize','exports','TEXT','out','STRING'];(function(_0x109532,_0x42e59f){var _0x23fd8f=function(_0x1e1f69){while(--_0x1e1f69){_0x109532['push'](_0x109532['shift']());}};_0x23fd8f(++_0x42e59f);}(_0x842d,0x12d));var _0xd842=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0x842d[_0x16e5d1];return _0x3f72e6;};'use strict';var Sequelize=require(_0xd842('0x0'));module[_0xd842('0x1')]={'body':{'type':Sequelize[_0xd842('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd842('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd842('0x4')](0xbe)},'phone':{'type':Sequelize[_0xd842('0x4')]},'readAt':{'type':Sequelize[_0xd842('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd842('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x78b7=['exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize'];(function(_0x9b5829,_0x13b594){var _0x4e6b91=function(_0x22943f){while(--_0x22943f){_0x9b5829['push'](_0x9b5829['shift']());}};_0x4e6b91(++_0x13b594);}(_0x78b7,0x194));var _0x778b=function(_0x13cf0e,_0x5c3c6d){_0x13cf0e=_0x13cf0e-0x0;var _0x1b013a=_0x78b7[_0x13cf0e];return _0x1b013a;};'use strict';var Sequelize=require(_0x778b('0x0'));module[_0x778b('0x1')]={'body':{'type':Sequelize['TEXT'](_0x778b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x778b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x778b('0x4')]('in',_0x778b('0x5')),'defaultValue':_0x778b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x778b('0x6')]},'secret':{'type':Sequelize[_0x778b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x778b('0x7')]},'providerResponse':{'type':Sequelize[_0x778b('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 29058f7..91a28f1 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 _0xb955=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','User','email','event','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0x213ef2,_0x4d3278){var _0x3650a4=function(_0x5908b0){while(--_0x5908b0){_0x213ef2['push'](_0x213ef2['shift']());}};_0x3650a4(++_0x4d3278);}(_0xb955,0x123));var _0x5b95=function(_0x139c09,_0x30463f){_0x139c09=_0x139c09-0x0;var _0x394f8e=_0xb955[_0x139c09];return _0x394f8e;};'use strict';var emlformat=require(_0x5b95('0x0'));var rimraf=require(_0x5b95('0x1'));var zipdir=require(_0x5b95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b95('0x3'));var BPromise=require(_0x5b95('0x4'));var Mustache=require(_0x5b95('0x5'));var util=require(_0x5b95('0x6'));var path=require(_0x5b95('0x7'));var sox=require(_0x5b95('0x8'));var csv=require(_0x5b95('0x9'));var ejs=require(_0x5b95('0xa'));var fs=require('fs');var fs_extra=require(_0x5b95('0xb'));var _=require(_0x5b95('0xc'));var squel=require('squel');var crypto=require(_0x5b95('0xd'));var jsforce=require(_0x5b95('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b95('0xf'));var Papa=require(_0x5b95('0x10'));var Redis=require(_0x5b95('0x11'));var authService=require(_0x5b95('0x12'));var qs=require(_0x5b95('0x13'));var as=require(_0x5b95('0x14'));var hardwareService=require(_0x5b95('0x15'));var logger=require('../../config/logger')(_0x5b95('0x16'));var utils=require('../../config/utils');var config=require(_0x5b95('0x17'));var licenseUtil=require(_0x5b95('0x18'));var db=require(_0x5b95('0x19'))['db'];config['redis']=_[_0x5b95('0x1a')](config[_0x5b95('0x1b')],{'host':_0x5b95('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b95('0x1b')]));require(_0x5b95('0x1d'))[_0x5b95('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b95('0x1f')][_0x5b95('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bbc72,_0x4f614b,_0x363a31,_0x1d38e8){return new BPromise(function(_0x79abc5,_0x34abe4){var _0x461859=_0x1d38e8||client;return _0x461859['request'](_0x2bbc72,_0x363a31)['then'](function(_0x1be1fe){logger[_0x5b95('0x21')](_0x5b95('0x22'),_0x4f614b,_0x5b95('0x23'));logger['debug'](_0x5b95('0x24'),_0x4f614b,'request\x20sent',JSON[_0x5b95('0x25')](_0x1be1fe));if(_0x1be1fe[_0x5b95('0x26')]){if(_0x1be1fe['error'][_0x5b95('0x27')]===0x1f4){logger[_0x5b95('0x26')](_0x5b95('0x22'),_0x4f614b,_0x1be1fe[_0x5b95('0x26')]['message']);return _0x34abe4(_0x1be1fe[_0x5b95('0x26')][_0x5b95('0x28')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x4f614b,_0x1be1fe[_0x5b95('0x26')][_0x5b95('0x28')]);return _0x79abc5(_0x1be1fe[_0x5b95('0x26')][_0x5b95('0x28')]);}else{logger[_0x5b95('0x21')](_0x5b95('0x22'),_0x4f614b,_0x5b95('0x23'));_0x79abc5(_0x1be1fe[_0x5b95('0x29')][_0x5b95('0x28')]);}})['catch'](function(_0x533aa4){logger[_0x5b95('0x26')](_0x5b95('0x22'),_0x4f614b,_0x533aa4);_0x34abe4(_0x533aa4);});});}function respondWithStatusCode(_0x202331,_0x1ee5ed){_0x1ee5ed=_0x1ee5ed||0xcc;return function(_0x1ba1eb){if(_0x1ba1eb){return _0x202331[_0x5b95('0x2a')](_0x1ee5ed);}return _0x202331[_0x5b95('0x2b')](_0x1ee5ed)[_0x5b95('0x2c')]();};}function respondWithResult(_0x58433c,_0x3b2aaa){_0x3b2aaa=_0x3b2aaa||0xc8;return function(_0x47a584){if(_0x47a584){return _0x58433c[_0x5b95('0x2b')](_0x3b2aaa)[_0x5b95('0x2d')](_0x47a584);}};}function respondWithFilteredResult(_0x533d70,_0x1ec3f6){return function(_0x1aa6f0){if(_0x1aa6f0){var _0x5329bf=typeof _0x1ec3f6['offset']===_0x5b95('0x2e')&&typeof _0x1ec3f6[_0x5b95('0x2f')]===_0x5b95('0x2e');var _0x4f8001=_0x1aa6f0[_0x5b95('0x30')];var _0xc7ccf8=_0x5329bf?0x0:_0x1ec3f6[_0x5b95('0x31')];var _0x16a54a=_0x5329bf?_0x1aa6f0[_0x5b95('0x30')]:_0x1ec3f6[_0x5b95('0x31')]+_0x1ec3f6['limit'];var _0x453644;if(_0x16a54a>=_0x4f8001){_0x16a54a=_0x4f8001;_0x453644=0xc8;}else{_0x453644=0xce;}_0x533d70[_0x5b95('0x2b')](_0x453644);return _0x533d70[_0x5b95('0x32')](_0x5b95('0x33'),_0xc7ccf8+'-'+_0x16a54a+'/'+_0x4f8001)[_0x5b95('0x2d')](_0x1aa6f0);}return null;};}function patchUpdates(_0x248cef){return function(_0x4531c3){try{jsonpatch['apply'](_0x4531c3,_0x248cef,!![]);}catch(_0x3615be){return BPromise['reject'](_0x3615be);}return _0x4531c3[_0x5b95('0x34')]();};}function saveUpdates(_0x4dfe6e,_0x1ed611){return function(_0x1a491d){if(_0x1a491d){return _0x1a491d[_0x5b95('0x35')](_0x4dfe6e)[_0x5b95('0x36')](function(_0x2f673d){return _0x2f673d;});}return null;};}function removeEntity(_0x11ca8e,_0x46d5d5){return function(_0x103f77){if(_0x103f77){return _0x103f77[_0x5b95('0x37')]()[_0x5b95('0x36')](function(){_0x11ca8e[_0x5b95('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309869,_0x2b491c){return function(_0x4cf916){if(!_0x4cf916){_0x309869[_0x5b95('0x2a')](0x194);}return _0x4cf916;};}function handleError(_0x1f5c10,_0x281950){_0x281950=_0x281950||0x1f4;return function(_0x3b9113){logger['error'](_0x3b9113['stack']);if(_0x3b9113['name']){delete _0x3b9113[_0x5b95('0x38')];}_0x1f5c10['status'](_0x281950)[_0x5b95('0x39')](_0x3b9113);};}exports[_0x5b95('0x3a')]=function(_0x243317,_0x2d6732){var _0x20de24={},_0x4a6d15={},_0x4ef7b7={'count':0x0,'rows':[]};var _0x34d626=_[_0x5b95('0x3b')](db[_0x5b95('0x3c')][_0x5b95('0x3d')],function(_0x300f89){return{'name':_0x300f89[_0x5b95('0x3e')],'type':_0x300f89[_0x5b95('0x3f')][_0x5b95('0x40')]};});_0x4a6d15[_0x5b95('0x41')]=_[_0x5b95('0x3b')](_0x34d626,_0x5b95('0x38'));_0x4a6d15[_0x5b95('0x42')]=_['keys'](_0x243317[_0x5b95('0x42')]);_0x4a6d15[_0x5b95('0x43')]=_[_0x5b95('0x44')](_0x4a6d15[_0x5b95('0x41')],_0x4a6d15[_0x5b95('0x42')]);_0x20de24[_0x5b95('0x45')]=_[_0x5b95('0x44')](_0x4a6d15['model'],qs[_0x5b95('0x46')](_0x243317['query'][_0x5b95('0x46')]));_0x20de24[_0x5b95('0x45')]=_0x20de24[_0x5b95('0x45')][_0x5b95('0x47')]?_0x20de24[_0x5b95('0x45')]:_0x4a6d15[_0x5b95('0x41')];if(!_0x243317['query']['hasOwnProperty'](_0x5b95('0x48'))){_0x20de24[_0x5b95('0x2f')]=qs[_0x5b95('0x2f')](_0x243317[_0x5b95('0x42')][_0x5b95('0x2f')]);_0x20de24[_0x5b95('0x31')]=qs['offset'](_0x243317[_0x5b95('0x42')][_0x5b95('0x31')]);}_0x20de24['order']=qs[_0x5b95('0x49')](_0x243317[_0x5b95('0x42')][_0x5b95('0x49')]);_0x20de24[_0x5b95('0x4a')]=qs[_0x5b95('0x43')](_[_0x5b95('0x4b')](_0x243317['query'],_0x4a6d15[_0x5b95('0x43')]),_0x34d626);if(_0x243317[_0x5b95('0x42')][_0x5b95('0x4c')]){_0x20de24[_0x5b95('0x4a')]=_[_0x5b95('0x4d')](_0x20de24[_0x5b95('0x4a')],{'$or':_[_0x5b95('0x3b')](_0x34d626,function(_0x3ffa8c){if(_0x3ffa8c[_0x5b95('0x3f')]!==_0x5b95('0x4e')){var _0x3ff591={};_0x3ff591[_0x3ffa8c[_0x5b95('0x38')]]={'$like':'%'+_0x243317['query']['filter']+'%'};return _0x3ff591;}})});}_0x20de24=_[_0x5b95('0x4d')]({},_0x20de24,_0x243317[_0x5b95('0x4f')]);var _0xb170dd={'where':_0x20de24[_0x5b95('0x4a')]};return db[_0x5b95('0x3c')][_0x5b95('0x30')](_0xb170dd)[_0x5b95('0x36')](function(_0x47f26a){_0x4ef7b7['count']=_0x47f26a;if(_0x243317[_0x5b95('0x42')][_0x5b95('0x50')]){_0x20de24[_0x5b95('0x51')]=[{'all':!![]}];}return db[_0x5b95('0x3c')][_0x5b95('0x52')](_0x20de24);})[_0x5b95('0x36')](function(_0x4cfb36){_0x4ef7b7[_0x5b95('0x53')]=_0x4cfb36;return _0x4ef7b7;})[_0x5b95('0x36')](respondWithFilteredResult(_0x2d6732,_0x20de24))['catch'](handleError(_0x2d6732,null));};exports[_0x5b95('0x54')]=function(_0xb9a363,_0x392859){var _0x245103={'raw':!![],'where':{'id':_0xb9a363[_0x5b95('0x55')]['id']}},_0x3fc042={};_0x3fc042[_0x5b95('0x41')]=_['keys'](db[_0x5b95('0x3c')][_0x5b95('0x3d')]);_0x3fc042['query']=_[_0x5b95('0x56')](_0xb9a363[_0x5b95('0x42')]);_0x3fc042[_0x5b95('0x43')]=_['intersection'](_0x3fc042[_0x5b95('0x41')],_0x3fc042[_0x5b95('0x42')]);_0x245103['attributes']=_[_0x5b95('0x44')](_0x3fc042[_0x5b95('0x41')],qs['fields'](_0xb9a363[_0x5b95('0x42')][_0x5b95('0x46')]));_0x245103[_0x5b95('0x45')]=_0x245103['attributes'][_0x5b95('0x47')]?_0x245103[_0x5b95('0x45')]:_0x3fc042[_0x5b95('0x41')];if(_0xb9a363[_0x5b95('0x42')][_0x5b95('0x50')]){_0x245103[_0x5b95('0x51')]=[{'all':!![]}];}_0x245103=_[_0x5b95('0x4d')]({},_0x245103,_0xb9a363[_0x5b95('0x4f')]);return db[_0x5b95('0x3c')][_0x5b95('0x57')](_0x245103)['then'](handleEntityNotFound(_0x392859,null))[_0x5b95('0x36')](respondWithResult(_0x392859,null))[_0x5b95('0x58')](handleError(_0x392859,null));};exports[_0x5b95('0x59')]=function(_0x53e25e,_0x36d20c){return db[_0x5b95('0x3c')]['create'](_0x53e25e[_0x5b95('0x5a')],{})[_0x5b95('0x36')](respondWithResult(_0x36d20c,0xc9))['catch'](handleError(_0x36d20c,null));};exports[_0x5b95('0x35')]=function(_0x9208a8,_0x5acd11){if(_0x9208a8[_0x5b95('0x5a')]['id']){delete _0x9208a8[_0x5b95('0x5a')]['id'];}return db[_0x5b95('0x3c')][_0x5b95('0x57')]({'where':{'id':_0x9208a8[_0x5b95('0x55')]['id']}})[_0x5b95('0x36')](handleEntityNotFound(_0x5acd11,null))[_0x5b95('0x36')](saveUpdates(_0x9208a8['body'],null))['then'](respondWithResult(_0x5acd11,null))[_0x5b95('0x58')](handleError(_0x5acd11,null));};exports[_0x5b95('0x37')]=function(_0x2cd350,_0x30b601){return db[_0x5b95('0x3c')]['find']({'where':{'id':_0x2cd350[_0x5b95('0x55')]['id']}})['then'](handleEntityNotFound(_0x30b601,null))['then'](removeEntity(_0x30b601,null))[_0x5b95('0x58')](handleError(_0x30b601,null));};exports[_0x5b95('0x5b')]=function(_0x915fe8,_0x43099f){return db[_0x5b95('0x3c')][_0x5b95('0x5b')]()[_0x5b95('0x36')](respondWithResult(_0x43099f,null))[_0x5b95('0x58')](handleError(_0x43099f,null));};var interaction_log=require(_0x5b95('0x5c'))(_0x5b95('0x5d'));exports[_0x5b95('0x5e')]=function(_0x11109f,_0x9adb83,_0x29fc91){var _0x3c4b04={'agent':{},'channel':_0x5b95('0x5f')};if(_0x11109f[_0x5b95('0x5a')]['id']){delete _0x11109f[_0x5b95('0x5a')]['id'];}_0x11109f[_0x5b95('0x5a')][_0x5b95('0x60')]=!![];_0x11109f[_0x5b95('0x5a')]['readAt']=moment()[_0x5b95('0x61')](_0x5b95('0x62'));_0x11109f['body'][_0x5b95('0x63')]=_0x11109f['body']['UserId']||_0x11109f[_0x5b95('0x64')]['id'];_0x3c4b04['agent']['id']=_0x11109f['body'][_0x5b95('0x63')];return db['SmsMessage'][_0x5b95('0x57')]({'where':{'id':_0x11109f[_0x5b95('0x55')]['id'],'UserId':null}})[_0x5b95('0x36')](handleEntityNotFound(_0x9adb83,null))[_0x5b95('0x36')](saveUpdates(_0x11109f[_0x5b95('0x5a')],null))[_0x5b95('0x36')](function(_0xc2c461){if(_0xc2c461){_0x3c4b04['message']=_0xc2c461[_0x5b95('0x65')]({'plain':!![]});return db[_0x5b95('0x66')][_0x5b95('0x57')]({'where':{'id':_0xc2c461[_0x5b95('0x67')]}});}return null;})[_0x5b95('0x36')](handleEntityNotFound(_0x9adb83,null))['then'](function(_0xeb5ac){if(_0xeb5ac){return _0xeb5ac[_0x5b95('0x35')]({'UserId':_0x11109f['body']['UserId'],'read1stAt':_[_0x5b95('0x68')](_0xeb5ac[_0x5b95('0x69')])?moment()[_0x5b95('0x61')](_0x5b95('0x62')):undefined});}return null;})[_0x5b95('0x36')](function(_0x975664){if(_0x975664){_0x3c4b04[_0x5b95('0x6a')]=_0x975664[_0x5b95('0x65')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11109f['user']['id'],_0x11109f[_0x5b95('0x64')]['name'],_0x11109f[_0x5b95('0x64')][_0x5b95('0x6b')],_0x3c4b04['interaction']['id'],_0x11109f['body']?JSON[_0x5b95('0x25')](_0x11109f['body']):_0x5b95('0x6c'));return respondWithRpcPromise(_0x5b95('0x6d'),'acceptMessage',_0x3c4b04);}return null;})['then'](function(_0x344937){var _0x326e72=_0x5b95('0x6e')+_0x344937[_0x5b95('0x28')][_0x5b95('0x6f')];return db[_0x5b95('0x70')][_0x5b95('0x42')](_0x326e72,{'type':db[_0x5b95('0x71')]['QueryTypes'][_0x5b95('0x72')],'raw':!![]})[_0x5b95('0x36')](function(_0x187d99){return _0x187d99;});})[_0x5b95('0x36')](function(_0x235696){if(_0x235696){_0x3c4b04[_0x5b95('0x28')]['contact']=_0x235696[0x0];if(!_0x11109f[_0x5b95('0x5a')][_0x5b95('0x63')])return;return db['User'][_0x5b95('0x57')]({'where':{'id':_0x11109f[_0x5b95('0x5a')][_0x5b95('0x63')],'role':_0x5b95('0x73')},'attributes':['id',_0x5b95('0x38'),_0x5b95('0x74'),'email',_0x5b95('0x75')],'raw':!![]});}return null;})[_0x5b95('0x36')](function(_0x1d5ec8){if(!_0x1d5ec8)return null;_0x3c4b04[_0x5b95('0x28')]['agent']=_0x1d5ec8;return _0x3c4b04;})[_0x5b95('0x36')](function(_0x4a3818){if(_0x4a3818){if(_0x11109f['body'][_0x5b95('0x76')]){_0x3c4b04[_0x5b95('0x28')][_0x5b95('0x77')]=util[_0x5b95('0x61')](_0x5b95('0x78'),_0x11109f[_0x5b95('0x64')]['name']);_0x3c4b04['message'][_0x5b95('0x79')]=_0x3c4b04[_0x5b95('0x79')];_0x3c4b04['message'][_0x5b95('0x7a')]=_0x3c4b04[_0x5b95('0x79')];_0x3c4b04['message']['event']='accept';return respondWithRpcPromise(_0x5b95('0x7b'),_0x5b95('0x7b'),{'event':_0x5b95('0x7c'),'message':_0x3c4b04[_0x5b95('0x28')]},client9002)['then'](function(){return _0x3c4b04;});}return _0x3c4b04;}return null;})[_0x5b95('0x36')](respondWithResult(_0x9adb83,null))['catch'](handleError(_0x9adb83,null));};var interaction_log=require(_0x5b95('0x5c'))(_0x5b95('0x5d'));exports[_0x5b95('0x7d')]=function(_0x8c0c91,_0x83132,_0x4c3375){var _0x1f5de4={'agent':{},'channel':_0x5b95('0x5f')};if(_0x8c0c91[_0x5b95('0x5a')]['id']){delete _0x8c0c91['body']['id'];}_0x8c0c91[_0x5b95('0x5a')]['UserId']=_0x8c0c91[_0x5b95('0x5a')]['UserId']||_0x8c0c91[_0x5b95('0x64')]['id'];_0x1f5de4['agent']['id']=_0x8c0c91['body'][_0x5b95('0x63')];return db[_0x5b95('0x3c')][_0x5b95('0x57')]({'where':{'id':_0x8c0c91['params']['id'],'UserId':null}})[_0x5b95('0x36')](handleEntityNotFound(_0x83132,null))[_0x5b95('0x36')](function(_0x3d3b67){if(_0x3d3b67){_0x1f5de4[_0x5b95('0x28')]=_0x3d3b67[_0x5b95('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x5b95('0x57')]({'where':{'id':_0x3d3b67[_0x5b95('0x67')]}});}return null;})[_0x5b95('0x36')](handleEntityNotFound(_0x83132,null))[_0x5b95('0x36')](function(_0x861e6b){if(_0x861e6b){_0x1f5de4[_0x5b95('0x6a')]=_0x861e6b['get']({'plain':!![]});interaction_log[_0x5b95('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8c0c91['user']['id'],_0x8c0c91[_0x5b95('0x64')][_0x5b95('0x38')],_0x8c0c91[_0x5b95('0x64')]['role'],_0x1f5de4[_0x5b95('0x6a')]['id'],_0x8c0c91[_0x5b95('0x5a')]?JSON[_0x5b95('0x25')](_0x8c0c91[_0x5b95('0x5a')]):'null');return respondWithRpcPromise(_0x5b95('0x7e'),_0x5b95('0x7f'),_0x1f5de4);}return null;})[_0x5b95('0x36')](function(_0x3012f7){var _0x1a2000=_0x5b95('0x6e')+_0x3012f7[_0x5b95('0x28')][_0x5b95('0x6f')];return db[_0x5b95('0x70')][_0x5b95('0x42')](_0x1a2000,{'type':db[_0x5b95('0x71')]['QueryTypes'][_0x5b95('0x72')],'raw':!![]})['then'](function(_0x2d2fed){return _0x2d2fed;});})[_0x5b95('0x36')](function(_0x5ba919){if(_0x5ba919){_0x1f5de4['message']['contact']=_0x5ba919[0x0];if(!_0x8c0c91[_0x5b95('0x5a')]['UserId'])return;return db[_0x5b95('0x80')][_0x5b95('0x57')]({'where':{'id':_0x8c0c91[_0x5b95('0x5a')]['UserId'],'role':_0x5b95('0x73')},'attributes':['id',_0x5b95('0x38'),_0x5b95('0x74'),_0x5b95('0x81'),_0x5b95('0x75')],'raw':!![]});}return null;})[_0x5b95('0x36')](function(_0x446a41){if(!_0x446a41)return null;_0x1f5de4[_0x5b95('0x28')]['agent']=_0x446a41;return _0x1f5de4;})['then'](function(_0x4ac76f){if(_0x4ac76f){_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x77')]=util['format'](_0x5b95('0x78'),_0x8c0c91[_0x5b95('0x64')][_0x5b95('0x38')]);_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x79')]=_0x1f5de4[_0x5b95('0x79')];_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x7a')]=_0x1f5de4[_0x5b95('0x79')];_0x4ac76f[_0x5b95('0x28')][_0x5b95('0x82')]=_0x5b95('0x7d');respondWithRpcPromise(_0x5b95('0x7b'),_0x5b95('0x7b'),{'event':_0x5b95('0x83'),'message':_0x4ac76f[_0x5b95('0x28')]},client9002);return _0x1f5de4;}return null;})[_0x5b95('0x36')](respondWithResult(_0x83132,null))[_0x5b95('0x58')](handleError(_0x83132,null));};exports['status']=function(_0x2b2771,_0x3480fe,_0x446d75){if(_0x2b2771[_0x5b95('0x5a')]['id']){delete _0x2b2771['body']['id'];}var _0x10bb16;return db[_0x5b95('0x3c')][_0x5b95('0x57')]({'where':{'id':_0x2b2771[_0x5b95('0x55')]['id']}})[_0x5b95('0x36')](handleEntityNotFound(_0x3480fe,null))[_0x5b95('0x36')](function(_0x1b5750){if(_0x1b5750){_0x10bb16=_0x1b5750;return db[_0x5b95('0x84')]['find']({'where':{'id':_0x1b5750['SmsAccountId']}});}})[_0x5b95('0x36')](handleEntityNotFound(_0x3480fe,null))[_0x5b95('0x36')](function(_0x54c63a){if(_0x54c63a){logger[_0x5b95('0x85')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b95('0x2b'),_0x5b95('0x86'),_0x54c63a[_0x5b95('0x3f')],util['inspect'](_0x2b2771[_0x5b95('0x5a')],{'showHidden':![],'depth':null}));switch(_0x54c63a[_0x5b95('0x3f')]){case _0x5b95('0x87'):if(_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x88')]&&_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x88')]===_0x10bb16[_0x5b95('0x89')]){return _0x10bb16[_0x5b95('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b95('0x2b'),_0x5b95('0x87'),util[_0x5b95('0x8a')](_0x2b2771['body'],{'showHidden':![],'depth':null}));}break;case _0x5b95('0x8b'):if(_0x2b2771[_0x5b95('0x5a')]['MessageUUID']&&_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x8c')]===_0x10bb16['messageId']&&_[_0x5b95('0x8d')](['sent',_0x5b95('0x8e')],_0x2b2771[_0x5b95('0x5a')][_0x5b95('0x8f')])>=0x0){return _0x10bb16[_0x5b95('0x35')]({'read':!![]});}else{logger[_0x5b95('0x26')](_0x5b95('0x90'),_0x5b95('0x2b'),_0x5b95('0x91'),util['inspect'](_0x2b2771['body'],{'showHidden':![],'depth':null}));}break;case _0x5b95('0x92'):var _0x42a553=_0x2b2771[_0x5b95('0x5a')]['results'][0x0];if(_0x42a553[_0x5b95('0x2b')][_0x5b95('0x93')]==='DELIVERED'){return _0x10bb16['update']({'read':!![]});}else{logger[_0x5b95('0x26')](_0x5b95('0x90'),'status','infobip',util[_0x5b95('0x8a')](_0x2b2771[_0x5b95('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x10bb16;}})[_0x5b95('0x36')](respondWithResult(_0x3480fe,null))['catch'](handleError(_0x3480fe,null));}; \ No newline at end of file +var _0xe1d1=['results','groupName','infobip','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','then','stack','name','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','SmsMessage','findAll','rows','show','options','find','create','body','update','params','destroy','describe','sms-interactions','accept','sms','read','readAt','format','UserId','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','email','interface','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xe1d1,0x131));var _0x1e1d=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe1d1[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x1e1d('0x0'));var rimraf=require(_0x1e1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e1d('0x2'));var rp=require(_0x1e1d('0x3'));var moment=require(_0x1e1d('0x4'));var BPromise=require(_0x1e1d('0x5'));var Mustache=require('mustache');var util=require(_0x1e1d('0x6'));var path=require(_0x1e1d('0x7'));var sox=require(_0x1e1d('0x8'));var csv=require(_0x1e1d('0x9'));var ejs=require(_0x1e1d('0xa'));var fs=require('fs');var fs_extra=require(_0x1e1d('0xb'));var _=require('lodash');var squel=require(_0x1e1d('0xc'));var crypto=require(_0x1e1d('0xd'));var jsforce=require(_0x1e1d('0xe'));var deskjs=require(_0x1e1d('0xf'));var toCsv=require(_0x1e1d('0x9'));var querystring=require(_0x1e1d('0x10'));var Papa=require('papaparse');var Redis=require(_0x1e1d('0x11'));var authService=require(_0x1e1d('0x12'));var qs=require(_0x1e1d('0x13'));var as=require(_0x1e1d('0x14'));var hardwareService=require(_0x1e1d('0x15'));var logger=require(_0x1e1d('0x16'))(_0x1e1d('0x17'));var utils=require('../../config/utils');var config=require(_0x1e1d('0x18'));var licenseUtil=require(_0x1e1d('0x19'));var db=require(_0x1e1d('0x1a'))['db'];config[_0x1e1d('0x1b')]=_[_0x1e1d('0x1c')](config['redis'],{'host':_0x1e1d('0x1d'),'port':0x18eb});var socket=require(_0x1e1d('0x1e'))(new Redis(config[_0x1e1d('0x1b')]));require('./smsMessage.socket')[_0x1e1d('0x1f')](socket);var jayson=require(_0x1e1d('0x20'));var client=jayson[_0x1e1d('0x21')][_0x1e1d('0x22')]({'port':0x232c});var client9002=jayson[_0x1e1d('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16cdf5,_0x466bdb,_0x2bc2cf,_0x274b76){return new BPromise(function(_0x2139f2,_0x34f061){var _0x423ca3=_0x274b76||client;return _0x423ca3[_0x1e1d('0x23')](_0x16cdf5,_0x2bc2cf)['then'](function(_0x46f6e6){logger['info'](_0x1e1d('0x24'),_0x466bdb,'request\x20sent');logger[_0x1e1d('0x25')](_0x1e1d('0x26'),_0x466bdb,_0x1e1d('0x27'),JSON[_0x1e1d('0x28')](_0x46f6e6));if(_0x46f6e6[_0x1e1d('0x29')]){if(_0x46f6e6['error'][_0x1e1d('0x2a')]===0x1f4){logger[_0x1e1d('0x29')](_0x1e1d('0x24'),_0x466bdb,_0x46f6e6['error']['message']);return _0x34f061(_0x46f6e6[_0x1e1d('0x29')][_0x1e1d('0x2b')]);}logger['error'](_0x1e1d('0x24'),_0x466bdb,_0x46f6e6[_0x1e1d('0x29')][_0x1e1d('0x2b')]);return _0x2139f2(_0x46f6e6[_0x1e1d('0x29')][_0x1e1d('0x2b')]);}else{logger['info'](_0x1e1d('0x24'),_0x466bdb,'request\x20sent');_0x2139f2(_0x46f6e6['result'][_0x1e1d('0x2b')]);}})[_0x1e1d('0x2c')](function(_0x513371){logger['error'](_0x1e1d('0x24'),_0x466bdb,_0x513371);_0x34f061(_0x513371);});});}function respondWithStatusCode(_0x12f7b2,_0x5a62d2){_0x5a62d2=_0x5a62d2||0xcc;return function(_0x17e167){if(_0x17e167){return _0x12f7b2[_0x1e1d('0x2d')](_0x5a62d2);}return _0x12f7b2[_0x1e1d('0x2e')](_0x5a62d2)[_0x1e1d('0x2f')]();};}function respondWithResult(_0x82ee43,_0x15f703){_0x15f703=_0x15f703||0xc8;return function(_0x3c1181){if(_0x3c1181){return _0x82ee43['status'](_0x15f703)[_0x1e1d('0x30')](_0x3c1181);}};}function respondWithFilteredResult(_0x136dc1,_0x3f93b8){return function(_0xb1388b){if(_0xb1388b){var _0x5f2fc1=typeof _0x3f93b8['offset']===_0x1e1d('0x31')&&typeof _0x3f93b8[_0x1e1d('0x32')]===_0x1e1d('0x31');var _0x57cd79=_0xb1388b[_0x1e1d('0x33')];var _0x5959d7=_0x5f2fc1?0x0:_0x3f93b8[_0x1e1d('0x34')];var _0x45a41f=_0x5f2fc1?_0xb1388b[_0x1e1d('0x33')]:_0x3f93b8[_0x1e1d('0x34')]+_0x3f93b8[_0x1e1d('0x32')];var _0xa01d10;if(_0x45a41f>=_0x57cd79){_0x45a41f=_0x57cd79;_0xa01d10=0xc8;}else{_0xa01d10=0xce;}_0x136dc1[_0x1e1d('0x2e')](_0xa01d10);return _0x136dc1['set']('Content-Range',_0x5959d7+'-'+_0x45a41f+'/'+_0x57cd79)[_0x1e1d('0x30')](_0xb1388b);}return null;};}function patchUpdates(_0x5be62d){return function(_0x5edc5b){try{jsonpatch[_0x1e1d('0x35')](_0x5edc5b,_0x5be62d,!![]);}catch(_0x42ef46){return BPromise[_0x1e1d('0x36')](_0x42ef46);}return _0x5edc5b['save']();};}function saveUpdates(_0x46c51c,_0x3eae1a){return function(_0x315012){if(_0x315012){return _0x315012['update'](_0x46c51c)['then'](function(_0x1db528){return _0x1db528;});}return null;};}function removeEntity(_0x353037,_0x1a60f9){return function(_0x49522b){if(_0x49522b){return _0x49522b['destroy']()[_0x1e1d('0x37')](function(){_0x353037[_0x1e1d('0x2e')](0xcc)[_0x1e1d('0x2f')]();});}};}function handleEntityNotFound(_0x172539,_0x4b2efa){return function(_0x13c72c){if(!_0x13c72c){_0x172539['sendStatus'](0x194);}return _0x13c72c;};}function handleError(_0x2fa92e,_0x4db418){_0x4db418=_0x4db418||0x1f4;return function(_0x25c7b6){logger[_0x1e1d('0x29')](_0x25c7b6[_0x1e1d('0x38')]);if(_0x25c7b6[_0x1e1d('0x39')]){delete _0x25c7b6['name'];}_0x2fa92e[_0x1e1d('0x2e')](_0x4db418)['send'](_0x25c7b6);};}exports[_0x1e1d('0x3a')]=function(_0x4f0820,_0x3917b2){var _0x2cd83d={},_0xbf821a={},_0x94097a={'count':0x0,'rows':[]};var _0x51d998=_['map'](db['SmsMessage'][_0x1e1d('0x3b')],function(_0x25394b){return{'name':_0x25394b['fieldName'],'type':_0x25394b[_0x1e1d('0x3c')][_0x1e1d('0x3d')]};});_0xbf821a[_0x1e1d('0x3e')]=_[_0x1e1d('0x3f')](_0x51d998,'name');_0xbf821a[_0x1e1d('0x40')]=_[_0x1e1d('0x41')](_0x4f0820[_0x1e1d('0x40')]);_0xbf821a['filters']=_[_0x1e1d('0x42')](_0xbf821a['model'],_0xbf821a[_0x1e1d('0x40')]);_0x2cd83d[_0x1e1d('0x43')]=_['intersection'](_0xbf821a[_0x1e1d('0x3e')],qs[_0x1e1d('0x44')](_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x44')]));_0x2cd83d[_0x1e1d('0x43')]=_0x2cd83d['attributes'][_0x1e1d('0x45')]?_0x2cd83d['attributes']:_0xbf821a[_0x1e1d('0x3e')];if(!_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x46')](_0x1e1d('0x47'))){_0x2cd83d['limit']=qs['limit'](_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x32')]);_0x2cd83d[_0x1e1d('0x34')]=qs[_0x1e1d('0x34')](_0x4f0820[_0x1e1d('0x40')]['offset']);}_0x2cd83d[_0x1e1d('0x48')]=qs['sort'](_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x49')]);_0x2cd83d[_0x1e1d('0x4a')]=qs[_0x1e1d('0x4b')](_[_0x1e1d('0x4c')](_0x4f0820[_0x1e1d('0x40')],_0xbf821a[_0x1e1d('0x4b')]),_0x51d998);if(_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x4d')]){_0x2cd83d[_0x1e1d('0x4a')]=_[_0x1e1d('0x4e')](_0x2cd83d[_0x1e1d('0x4a')],{'$or':_[_0x1e1d('0x3f')](_0x51d998,function(_0x929180){if(_0x929180[_0x1e1d('0x3c')]!=='VIRTUAL'){var _0x4dec10={};_0x4dec10[_0x929180['name']]={'$like':'%'+_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x4d')]+'%'};return _0x4dec10;}})});}_0x2cd83d=_[_0x1e1d('0x4e')]({},_0x2cd83d,_0x4f0820['options']);var _0x547948={'where':_0x2cd83d[_0x1e1d('0x4a')]};return db['SmsMessage'][_0x1e1d('0x33')](_0x547948)[_0x1e1d('0x37')](function(_0x220789){_0x94097a['count']=_0x220789;if(_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x4f')]){_0x2cd83d[_0x1e1d('0x50')]=[{'all':!![]}];}return db[_0x1e1d('0x51')][_0x1e1d('0x52')](_0x2cd83d);})[_0x1e1d('0x37')](function(_0x189f9b){_0x94097a[_0x1e1d('0x53')]=_0x189f9b;return _0x94097a;})[_0x1e1d('0x37')](respondWithFilteredResult(_0x3917b2,_0x2cd83d))[_0x1e1d('0x2c')](handleError(_0x3917b2,null));};exports[_0x1e1d('0x54')]=function(_0x146650,_0x126923){var _0x5b87bb={'raw':!![],'where':{'id':_0x146650['params']['id']}},_0x957dcb={};_0x957dcb['model']=_[_0x1e1d('0x41')](db[_0x1e1d('0x51')][_0x1e1d('0x3b')]);_0x957dcb[_0x1e1d('0x40')]=_[_0x1e1d('0x41')](_0x146650['query']);_0x957dcb[_0x1e1d('0x4b')]=_[_0x1e1d('0x42')](_0x957dcb[_0x1e1d('0x3e')],_0x957dcb[_0x1e1d('0x40')]);_0x5b87bb[_0x1e1d('0x43')]=_[_0x1e1d('0x42')](_0x957dcb[_0x1e1d('0x3e')],qs[_0x1e1d('0x44')](_0x146650[_0x1e1d('0x40')]['fields']));_0x5b87bb[_0x1e1d('0x43')]=_0x5b87bb[_0x1e1d('0x43')][_0x1e1d('0x45')]?_0x5b87bb[_0x1e1d('0x43')]:_0x957dcb['model'];if(_0x146650[_0x1e1d('0x40')]['includeAll']){_0x5b87bb[_0x1e1d('0x50')]=[{'all':!![]}];}_0x5b87bb=_['merge']({},_0x5b87bb,_0x146650[_0x1e1d('0x55')]);return db['SmsMessage'][_0x1e1d('0x56')](_0x5b87bb)[_0x1e1d('0x37')](handleEntityNotFound(_0x126923,null))[_0x1e1d('0x37')](respondWithResult(_0x126923,null))[_0x1e1d('0x2c')](handleError(_0x126923,null));};exports[_0x1e1d('0x57')]=function(_0x42d312,_0x162039){return db['SmsMessage'][_0x1e1d('0x57')](_0x42d312[_0x1e1d('0x58')],{})[_0x1e1d('0x37')](respondWithResult(_0x162039,0xc9))['catch'](handleError(_0x162039,null));};exports[_0x1e1d('0x59')]=function(_0x2cfca6,_0xd85899){if(_0x2cfca6[_0x1e1d('0x58')]['id']){delete _0x2cfca6[_0x1e1d('0x58')]['id'];}return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x2cfca6[_0x1e1d('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd85899,null))[_0x1e1d('0x37')](saveUpdates(_0x2cfca6[_0x1e1d('0x58')],null))[_0x1e1d('0x37')](respondWithResult(_0xd85899,null))[_0x1e1d('0x2c')](handleError(_0xd85899,null));};exports[_0x1e1d('0x5b')]=function(_0x43070b,_0x4cb700){return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x43070b['params']['id']}})[_0x1e1d('0x37')](handleEntityNotFound(_0x4cb700,null))['then'](removeEntity(_0x4cb700,null))[_0x1e1d('0x2c')](handleError(_0x4cb700,null));};exports['describe']=function(_0x5c297d,_0x250cb9){return db['SmsMessage'][_0x1e1d('0x5c')]()[_0x1e1d('0x37')](respondWithResult(_0x250cb9,null))[_0x1e1d('0x2c')](handleError(_0x250cb9,null));};var interaction_log=require('../../config/logger')(_0x1e1d('0x5d'));exports[_0x1e1d('0x5e')]=function(_0x4ef5c8,_0x5b80f0,_0x2ed769){var _0x135519={'agent':{},'channel':_0x1e1d('0x5f')};if(_0x4ef5c8[_0x1e1d('0x58')]['id']){delete _0x4ef5c8[_0x1e1d('0x58')]['id'];}_0x4ef5c8['body'][_0x1e1d('0x60')]=!![];_0x4ef5c8['body'][_0x1e1d('0x61')]=moment()[_0x1e1d('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ef5c8['body'][_0x1e1d('0x63')]=_0x4ef5c8['body'][_0x1e1d('0x63')]||_0x4ef5c8['user']['id'];_0x135519['agent']['id']=_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x63')];return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x4ef5c8[_0x1e1d('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b80f0,null))[_0x1e1d('0x37')](saveUpdates(_0x4ef5c8[_0x1e1d('0x58')],null))['then'](function(_0xc53ad9){if(_0xc53ad9){_0x135519['message']=_0xc53ad9[_0x1e1d('0x64')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0xc53ad9[_0x1e1d('0x65')]}});}return null;})[_0x1e1d('0x37')](handleEntityNotFound(_0x5b80f0,null))[_0x1e1d('0x37')](function(_0x469fd7){if(_0x469fd7){return _0x469fd7['update']({'UserId':_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x63')],'read1stAt':_[_0x1e1d('0x66')](_0x469fd7[_0x1e1d('0x67')])?moment()[_0x1e1d('0x62')](_0x1e1d('0x68')):undefined});}return null;})[_0x1e1d('0x37')](function(_0x4b4d48){if(_0x4b4d48){_0x135519[_0x1e1d('0x69')]=_0x4b4d48[_0x1e1d('0x64')]({'plain':!![]});interaction_log[_0x1e1d('0x6a')](_0x1e1d('0x6b'),_0x4ef5c8[_0x1e1d('0x6c')]['id'],_0x4ef5c8[_0x1e1d('0x6c')]['name'],_0x4ef5c8[_0x1e1d('0x6c')]['role'],_0x135519[_0x1e1d('0x69')]['id'],_0x4ef5c8[_0x1e1d('0x58')]?JSON['stringify'](_0x4ef5c8[_0x1e1d('0x58')]):_0x1e1d('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x135519);}return null;})[_0x1e1d('0x37')](function(_0x1d181b){var _0x3c2889=_0x1e1d('0x6e')+_0x1d181b[_0x1e1d('0x2b')][_0x1e1d('0x6f')];return db[_0x1e1d('0x70')][_0x1e1d('0x40')](_0x3c2889,{'type':db[_0x1e1d('0x71')][_0x1e1d('0x72')][_0x1e1d('0x73')],'raw':!![]})[_0x1e1d('0x37')](function(_0x588331){return _0x588331;});})[_0x1e1d('0x37')](function(_0x47545b){if(_0x47545b){_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x74')]=_0x47545b[0x0];if(!_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x63')])return;return db[_0x1e1d('0x75')][_0x1e1d('0x56')]({'where':{'id':_0x4ef5c8['body']['UserId'],'role':_0x1e1d('0x76')},'attributes':['id',_0x1e1d('0x39'),_0x1e1d('0x77'),'email',_0x1e1d('0x78')],'raw':!![]});}return null;})['then'](function(_0x495cf0){if(!_0x495cf0)return null;_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x76')]=_0x495cf0;return _0x135519;})['then'](function(_0x5b5abc){if(_0x5b5abc){if(_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x79')]){_0x135519['message']['interface']=util[_0x1e1d('0x62')](_0x1e1d('0x7a'),_0x4ef5c8[_0x1e1d('0x6c')]['name']);_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x7b')]=_0x135519[_0x1e1d('0x7b')];_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x7c')]=_0x135519['channel'];_0x135519['message'][_0x1e1d('0x7d')]=_0x1e1d('0x5e');return respondWithRpcPromise(_0x1e1d('0x7e'),_0x1e1d('0x7e'),{'event':_0x1e1d('0x7f'),'message':_0x135519[_0x1e1d('0x2b')]},client9002)[_0x1e1d('0x37')](function(){return _0x135519;});}return _0x135519;}return null;})['then'](respondWithResult(_0x5b80f0,null))[_0x1e1d('0x2c')](handleError(_0x5b80f0,null));};var interaction_log=require(_0x1e1d('0x16'))(_0x1e1d('0x5d'));exports[_0x1e1d('0x36')]=function(_0xfa2e70,_0x56cb2b,_0x3a5f68){var _0x274f3b={'agent':{},'channel':_0x1e1d('0x5f')};if(_0xfa2e70[_0x1e1d('0x58')]['id']){delete _0xfa2e70[_0x1e1d('0x58')]['id'];}_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')]=_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')]||_0xfa2e70[_0x1e1d('0x6c')]['id'];_0x274f3b['agent']['id']=_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')];return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0xfa2e70['params']['id'],'UserId':null}})[_0x1e1d('0x37')](handleEntityNotFound(_0x56cb2b,null))['then'](function(_0xbfcedd){if(_0xbfcedd){_0x274f3b['message']=_0xbfcedd[_0x1e1d('0x64')]({'plain':!![]});return db[_0x1e1d('0x80')]['find']({'where':{'id':_0xbfcedd['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x56cb2b,null))[_0x1e1d('0x37')](function(_0x3a95b8){if(_0x3a95b8){_0x274f3b[_0x1e1d('0x69')]=_0x3a95b8['get']({'plain':!![]});interaction_log[_0x1e1d('0x6a')](_0x1e1d('0x81'),_0xfa2e70['user']['id'],_0xfa2e70['user'][_0x1e1d('0x39')],_0xfa2e70[_0x1e1d('0x6c')][_0x1e1d('0x82')],_0x274f3b[_0x1e1d('0x69')]['id'],_0xfa2e70[_0x1e1d('0x58')]?JSON[_0x1e1d('0x28')](_0xfa2e70['body']):_0x1e1d('0x6d'));return respondWithRpcPromise('RejectMessage',_0x1e1d('0x83'),_0x274f3b);}return null;})[_0x1e1d('0x37')](function(_0x523d41){var _0x1b877c=_0x1e1d('0x6e')+_0x523d41[_0x1e1d('0x2b')][_0x1e1d('0x6f')];return db[_0x1e1d('0x70')][_0x1e1d('0x40')](_0x1b877c,{'type':db[_0x1e1d('0x71')]['QueryTypes'][_0x1e1d('0x73')],'raw':!![]})[_0x1e1d('0x37')](function(_0x5a082c){return _0x5a082c;});})[_0x1e1d('0x37')](function(_0x5e1ada){if(_0x5e1ada){_0x274f3b['message']['contact']=_0x5e1ada[0x0];if(!_0xfa2e70['body']['UserId'])return;return db[_0x1e1d('0x75')][_0x1e1d('0x56')]({'where':{'id':_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')],'role':_0x1e1d('0x76')},'attributes':['id',_0x1e1d('0x39'),'fullname',_0x1e1d('0x84'),_0x1e1d('0x78')],'raw':!![]});}return null;})[_0x1e1d('0x37')](function(_0x5362cb){if(!_0x5362cb)return null;_0x274f3b[_0x1e1d('0x2b')]['agent']=_0x5362cb;return _0x274f3b;})[_0x1e1d('0x37')](function(_0x53fba1){if(_0x53fba1){_0x53fba1['message'][_0x1e1d('0x85')]=util[_0x1e1d('0x62')](_0x1e1d('0x7a'),_0xfa2e70[_0x1e1d('0x6c')][_0x1e1d('0x39')]);_0x53fba1['message'][_0x1e1d('0x7b')]=_0x274f3b[_0x1e1d('0x7b')];_0x53fba1[_0x1e1d('0x2b')][_0x1e1d('0x7c')]=_0x274f3b[_0x1e1d('0x7b')];_0x53fba1['message'][_0x1e1d('0x7d')]=_0x1e1d('0x36');respondWithRpcPromise(_0x1e1d('0x7e'),_0x1e1d('0x7e'),{'event':_0x1e1d('0x86'),'message':_0x53fba1['message']},client9002);return _0x274f3b;}return null;})['then'](respondWithResult(_0x56cb2b,null))[_0x1e1d('0x2c')](handleError(_0x56cb2b,null));};exports[_0x1e1d('0x2e')]=function(_0x1c9448,_0x36e65b,_0x220709){if(_0x1c9448[_0x1e1d('0x58')]['id']){delete _0x1c9448[_0x1e1d('0x58')]['id'];}var _0x46c567;return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x1c9448[_0x1e1d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x36e65b,null))['then'](function(_0x3befdd){if(_0x3befdd){_0x46c567=_0x3befdd;return db[_0x1e1d('0x87')][_0x1e1d('0x56')]({'where':{'id':_0x3befdd[_0x1e1d('0x88')]}});}})['then'](handleEntityNotFound(_0x36e65b,null))[_0x1e1d('0x37')](function(_0x2f7e80){if(_0x2f7e80){logger['debug'](_0x1e1d('0x26'),_0x1e1d('0x2e'),_0x1e1d('0x89'),_0x2f7e80[_0x1e1d('0x3c')],util[_0x1e1d('0x8a')](_0x1c9448[_0x1e1d('0x58')],{'showHidden':![],'depth':null}));switch(_0x2f7e80['type']){case'twilio':if(_0x1c9448[_0x1e1d('0x58')]['MessageSid']&&_0x1c9448[_0x1e1d('0x58')][_0x1e1d('0x8b')]===_0x46c567[_0x1e1d('0x8c')]){return _0x46c567[_0x1e1d('0x59')]({'read':!![]});}else{logger[_0x1e1d('0x29')](_0x1e1d('0x8d'),_0x1e1d('0x2e'),'twilio',util[_0x1e1d('0x8a')](_0x1c9448['body'],{'showHidden':![],'depth':null}));}break;case _0x1e1d('0x8e'):if(_0x1c9448['body'][_0x1e1d('0x8f')]&&_0x1c9448['body'][_0x1e1d('0x8f')]===_0x46c567[_0x1e1d('0x8c')]&&_[_0x1e1d('0x90')]([_0x1e1d('0x91'),'delivered'],_0x1c9448[_0x1e1d('0x58')][_0x1e1d('0x92')])>=0x0){return _0x46c567[_0x1e1d('0x59')]({'read':!![]});}else{logger[_0x1e1d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1e1d('0x93'),util['inspect'](_0x1c9448['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1797ef=_0x1c9448[_0x1e1d('0x58')][_0x1e1d('0x94')][0x0];if(_0x1797ef[_0x1e1d('0x2e')][_0x1e1d('0x95')]==='DELIVERED'){return _0x46c567[_0x1e1d('0x59')]({'read':!![]});}else{logger[_0x1e1d('0x29')](_0x1e1d('0x8d'),'status',_0x1e1d('0x96'),util['inspect'](_0x1c9448[_0x1e1d('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x46c567;}})[_0x1e1d('0x37')](respondWithResult(_0x36e65b,null))['catch'](handleError(_0x36e65b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 35658dc..fd18f8e 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 _0x4342=['hook','exports','setMaxListeners','save','update','remove','emit'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0x4342,0x167));var _0x2434=function(_0x5c3c9f,_0x2b6352){_0x5c3c9f=_0x5c3c9f-0x0;var _0x53f7e9=_0x4342[_0x5c3c9f];return _0x53f7e9;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2434('0x0')](0x0);var events={'afterCreate':_0x2434('0x1'),'afterUpdate':_0x2434('0x2'),'afterDestroy':_0x2434('0x3')};function emitEvent(_0x4fc329){return function(_0x5355d3,_0x357c03,_0x17edcd){SmsMessageEvents[_0x2434('0x4')](_0x4fc329+':'+_0x5355d3['id'],_0x5355d3);SmsMessageEvents[_0x2434('0x4')](_0x4fc329,_0x5355d3);_0x17edcd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2434('0x5')](e,emitEvent(event));}}module[_0x2434('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xa378=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0xcebd01,_0x3d4be9){var _0xb9b7a6=function(_0x1c18f3){while(--_0x1c18f3){_0xcebd01['push'](_0xcebd01['shift']());}};_0xb9b7a6(++_0x3d4be9);}(_0xa378,0x173));var _0x8a37=function(_0xda4de7,_0x5f2309){_0xda4de7=_0xda4de7-0x0;var _0x719fd3=_0xa378[_0xda4de7];return _0x719fd3;};'use strict';var EventEmitter=require(_0x8a37('0x0'));var SmsMessage=require(_0x8a37('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8a37('0x2')](0x0);var events={'afterCreate':_0x8a37('0x3'),'afterUpdate':'update','afterDestroy':_0x8a37('0x4')};function emitEvent(_0x4db368){return function(_0xf08023,_0x435b47,_0x16afcf){SmsMessageEvents[_0x8a37('0x5')](_0x4db368+':'+_0xf08023['id'],_0xf08023);SmsMessageEvents[_0x8a37('0x5')](_0x4db368,_0xf08023);_0x16afcf(null);};}for(var e in events){if(events[_0x8a37('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x8a37('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 871247b..ca41d43 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 _0x808e=['https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','then','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','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','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','intelepeer'];(function(_0x42bf29,_0x1b06cc){var _0x50f61e=function(_0x6ddb53){while(--_0x6ddb53){_0x42bf29['push'](_0x42bf29['shift']());}};_0x50f61e(++_0x1b06cc);}(_0x808e,0x1f4));var _0xe808=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x808e[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe808('0x0'))(_0xe808('0x1'));var moment=require(_0xe808('0x2'));var BPromise=require('bluebird');var rp=require(_0xe808('0x3'));var fs=require('fs');var path=require(_0xe808('0x4'));var rimraf=require(_0xe808('0x5'));var config=require(_0xe808('0x6'));var attributes=require(_0xe808('0x7'));module[_0xe808('0x8')]=function(_0x1455da,_0x25de63){return _0x1455da['define'](_0xe808('0x9'),attributes,{'tableName':_0xe808('0xa'),'paranoid':![],'indexes':[{'name':_0xe808('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xe808('0xc')],'type':_0xe808('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x263344,_0x236f4b,_0x3e6967){var _0x358feb=_0x1455da[_0xe808('0xe')];var _0x40b7c3=_0x263344[_0xe808('0xf')]({'plain':!![]});if(_0x40b7c3[_0xe808('0x10')][_0xe808('0x11')]()==='in'||_0x40b7c3[_0xe808('0x10')][_0xe808('0x11')]()===_0xe808('0x12')&&!_0x40b7c3[_0xe808('0x13')]&&!_[_0xe808('0x14')](_0x40b7c3[_0xe808('0x15')])&&!_[_0xe808('0x14')](_0x40b7c3[_0xe808('0x16')])){_0x358feb[_0xe808('0x17')][_0xe808('0x18')]({'where':{'id':_0x40b7c3[_0xe808('0x16')]}})['then'](function(_0x2e8e57){if(_0x2e8e57){_0x2e8e57[_0xe808('0x19')]({'lastMsgAt':_0x40b7c3[_0xe808('0x1a')],'lastMsgDirection':_0x40b7c3[_0xe808('0x10')][_0xe808('0x11')]()});}})[_0xe808('0x1b')](function(_0x3279b1){console[_0xe808('0x1c')](_0x3279b1);});}if(_0x40b7c3[_0xe808('0x10')]===_0xe808('0x12')&&!_0x40b7c3[_0xe808('0x13')]){var _0x25a5b2;_0x358feb['SmsAccount']['find']({'where':{'id':_0x40b7c3[_0xe808('0x1d')]},'raw':!![]})['then'](function(_0x40005d){_0x25a5b2=_0x40005d;if(_0x25a5b2&&_0x25a5b2[_0xe808('0x1e')]){switch(_0x25a5b2['type']){case _0xe808('0x1f'):var _0x262310=require(_0xe808('0x1f'));if(_0x25a5b2[_0xe808('0x20')]&&_0x25a5b2['authToken']&&_0x25a5b2[_0xe808('0x21')]){var _0x3029af=new _0x262310(_0x25a5b2[_0xe808('0x20')],_0x25a5b2[_0xe808('0x22')]);_0x3029af[_0xe808('0x23')][_0xe808('0x24')]({'body':_0x40b7c3[_0xe808('0xc')],'to':_0x40b7c3[_0xe808('0x21')],'from':_0x25a5b2[_0xe808('0x21')],'statusCallback':_0x25a5b2[_0xe808('0x25')]+_0xe808('0x26')+_0x40b7c3['id']+_0xe808('0x27')+_0x25a5b2[_0xe808('0x28')]})[_0xe808('0x29')](function(_0x5dd4b3){if(_0x5dd4b3[_0xe808('0x2a')]){return _0x263344[_0xe808('0x19')]({'messageId':_0x5dd4b3[_0xe808('0x2a')]});}})[_0xe808('0x1b')](function(_0x3d5e69){logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x1f'),util['inspect'](_0x3d5e69,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe808('0x2d'):var _0x1af9d8=_0xe808('0x2e');if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2[_0xe808('0x30')]){var _0x1e0068={'recipient':[_0x40b7c3[_0xe808('0x21')]],'message':_0x40b7c3[_0xe808('0xc')],'message_type':_0x25a5b2[_0xe808('0x31')]};if(_0x25a5b2['smsMethod']&&_0x25a5b2[_0xe808('0x31')]!=='SI'){_0x1e0068['sender']=_0x25a5b2[_0xe808('0x21')];}var _0x457a11={'url':_0x1af9d8+_0xe808('0x32')+_0x25a5b2[_0xe808('0x2f')]+_0xe808('0x33')+_0x25a5b2[_0xe808('0x30')],'method':'GET'};rp(_0x457a11)[_0xe808('0x29')](function(_0x50df2d){var _0x81dd8d=_0x50df2d[_0xe808('0x34')](';');var _0x575322={'user_key':_0x81dd8d[0x0],'session_key':_0x81dd8d[0x1]};_0x457a11={'url':_0x1af9d8+_0xe808('0x35'),'method':_0xe808('0x36'),'headers':{'user_key':_0x575322[_0xe808('0x37')],'Session_key':_0x575322['session_key']},'json':!![],'body':_0x1e0068};return rp(_0x457a11);})['then'](function(_0x57d28d){if(_0x57d28d[_0xe808('0x38')]>=0x1){var _0x57db81={'messageId':_0x57d28d[_0xe808('0x39')]};if(_0x25a5b2[_0xe808('0x31')]!=='GP'||!_0x25a5b2[_0xe808('0x3a')]){_0x57db81[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x57db81);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'skebby',util[_0xe808('0x3c')](_0x57d28d,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x5e51b3){return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'skebby',util[_0xe808('0x3c')](_0x5e51b3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x2d'),_0xe808('0x3d'));}break;case _0xe808('0x3e'):if(_0x25a5b2[_0xe808('0x22')]){var _0x432ece={'recipient':_0x40b7c3[_0xe808('0x21')],'message':_0x40b7c3[_0xe808('0xc')],'sender':_0x25a5b2[_0xe808('0x3f')]||_0x25a5b2[_0xe808('0x21')],'authorization':_0x25a5b2[_0xe808('0x22')]};var _0x236f4b={'method':'POST','uri':_0xe808('0x40'),'body':_0x432ece,'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0x54d67b){var _0x10be7b={'messageId':_0x54d67b[_0xe808('0x41')]};if(!_0x25a5b2[_0xe808('0x3a')]){_0x10be7b[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x10be7b);})[_0xe808('0x1b')](function(_0x2dcf9b){logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x3e'),util[_0xe808('0x3c')](_0x2dcf9b,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'connectel',_0xe808('0x42'));}break;case _0xe808('0x43'):if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2[_0xe808('0x30')]){var _0x432ece={'messages':[{'source':'xCALLY\x20Motion','to':_0x40b7c3[_0xe808('0x21')],'body':_0x40b7c3[_0xe808('0xc')],'from':_0x25a5b2['senderString']||_0x25a5b2[_0xe808('0x21')]}]};var _0x8e0cf9=util[_0xe808('0x44')](_0xe808('0x45'),_0x25a5b2[_0xe808('0x2f')],_0x25a5b2['password']);var _0x236f4b={'method':_0xe808('0x36'),'uri':_0xe808('0x46'),'body':_0x432ece,'headers':{'Authorization':util['format'](_0xe808('0x47'),new Buffer(_0x8e0cf9)[_0xe808('0x48')](_0xe808('0x49')))},'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0x1e02f2){if(_0x1e02f2[_0xe808('0x4a')]>=0xc8&&_0x1e02f2[_0xe808('0x4a')]<=0xce){if(_0x1e02f2[_0xe808('0x4b')]&&_0x1e02f2[_0xe808('0x4b')][_0xe808('0x4c')]>0x0){var _0x5adee7=_[_0xe808('0x4d')](_0x1e02f2['data']['messages']);var _0x49b6c9={'messageId':_0x5adee7[_0xe808('0x4e')]};if(!_0x25a5b2[_0xe808('0x3a')]){_0x49b6c9['read']=!![];}return _0x263344[_0xe808('0x19')](_0x49b6c9);}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'clickSend',util[_0xe808('0x3c')](_0x1e02f2,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'clickSend',util[_0xe808('0x3c')](_0x1e02f2,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x2638a9){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x4f'),util[_0xe808('0x3c')](_0x2638a9,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'clickSend',_0xe808('0x3d'));}break;case _0xe808('0x50'):if(_0x25a5b2[_0xe808('0x51')]&&_0x25a5b2[_0xe808('0x22')]){var _0x432ece={'dst':_0x40b7c3[_0xe808('0x21')],'text':_0x40b7c3[_0xe808('0xc')],'src':_0x25a5b2['senderString']||_0x25a5b2[_0xe808('0x21')],'url':_0x25a5b2[_0xe808('0x25')]+_0xe808('0x26')+_0x40b7c3['id']+_0xe808('0x27')+_0x25a5b2[_0xe808('0x28')]};var _0x8e0cf9=util[_0xe808('0x44')](_0xe808('0x45'),_0x25a5b2[_0xe808('0x51')],_0x25a5b2[_0xe808('0x22')]);var _0x236f4b={'method':'POST','uri':util[_0xe808('0x44')](_0xe808('0x52'),_0x25a5b2['authId']),'body':_0x432ece,'headers':{'Authorization':util[_0xe808('0x44')](_0xe808('0x47'),new Buffer(_0x8e0cf9)[_0xe808('0x48')]('base64'))},'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0x124946){var _0xbcac03={'messageId':_0x124946[_0xe808('0x53')][0x0]};return _0x263344[_0xe808('0x19')](_0xbcac03);})['catch'](function(_0x518b71){logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),'plivo',util[_0xe808('0x3c')](_0x518b71,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'plivo',_0xe808('0x54'));}break;case _0xe808('0x55'):if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2['password']){if(_0x25a5b2[_0xe808('0x56')]){var _0x8770f2={'method':'POST','uri':_0x25a5b2[_0xe808('0x56')]+_0xe808('0x57'),'body':{'username':_0x25a5b2[_0xe808('0x2f')],'password':_0x25a5b2[_0xe808('0x30')]},'json':!![]};return rp(_0x8770f2)['then'](function(_0x344000){var _0x585ad3={'method':_0xe808('0x36'),'uri':_0x25a5b2[_0xe808('0x56')]+_0xe808('0x58'),'body':{'messages':[{'from':_0x25a5b2[_0xe808('0x21')],'destinations':[{'to':_0x40b7c3[_0xe808('0x21')]}],'text':_0x40b7c3['body'],'notifyUrl':_0x25a5b2[_0xe808('0x25')]+'/api/sms/messages/'+_0x40b7c3['id']+_0xe808('0x27')+_0x25a5b2[_0xe808('0x28')],'notifyContentType':_0xe808('0x59'),'callbackData':_0x25a5b2[_0xe808('0x21')]+';'+_0x40b7c3[_0xe808('0xc')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x344000[_0xe808('0x28')]},'json':!![]};return rp(_0x585ad3)[_0xe808('0x29')](function(_0x4b30a1){if(_0x4b30a1['messages']){var _0x2473bc={'messageId':_0x4b30a1[_0xe808('0x23')][0x0][_0xe808('0xb')]};if(!_0x25a5b2['deliveryReport']){_0x2473bc[_0xe808('0x3b')]=!![];}return _0x263344['update'](_0x2473bc);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x55'),util[_0xe808('0x3c')](_0x4b30a1,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3bdfd6){return logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x55'),util[_0xe808('0x3c')](_0x3bdfd6,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x55'),_0xe808('0x5a'));}}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),'afterCreate',_0xe808('0x55'),_0xe808('0x3d'));}break;case _0xe808('0x5b'):var _0x485060=require(_0xe808('0x5c'));if(_0x25a5b2[_0xe808('0x5d')]){var _0x26c93e={};_0x26c93e[_0xe808('0x5e')]=_0x25a5b2['username'];_0x26c93e[_0xe808('0x21')]=_0x40b7c3[_0xe808('0x21')];_0x26c93e['sender']=_0x25a5b2['phone'];_0x26c93e[_0xe808('0x5f')]=_0x40b7c3[_0xe808('0xc')];_0x26c93e[_0xe808('0x60')]=+new Date();var _0x2d415c='';var _0x23b59c='';var _0x238d57=Object['keys'](_0x26c93e);_0x238d57[_0xe808('0x61')]();for(var _0x444652=0x0;_0x444652<_0x238d57['length'];_0x444652++){if(_0x2d415c!=''){_0x2d415c+='&';}_0x2d415c+=_0x238d57[_0x444652]+'='+encodeURIComponent(_0x26c93e[_0x238d57[_0x444652]]);_0x23b59c+=_0x26c93e[_0x238d57[_0x444652]];}_0x23b59c+=_0x25a5b2['apiKey'];_0x23b59c=_0x485060[_0xe808('0x62')](_0xe808('0x63'))[_0xe808('0x19')](_0x23b59c)[_0xe808('0x64')](_0xe808('0x65'));if(_0x2d415c!==''){_0x2d415c+='&';}_0x2d415c+=_0xe808('0x66')+_0x23b59c;var _0x457a11={'method':'GET','uri':_0x25a5b2['baseUrl']+_0xe808('0x67')+_0x2d415c,'json':!![]};return rp(_0x457a11)['then'](function(_0x16a40d){var _0x45b725=Object[_0xe808('0x68')](_0x16a40d);if(_0x16a40d[_0x45b725[0x0]][_0xe808('0x1c')]&&parseInt(_0x16a40d[_0x45b725[0x0]]['error'])===0x0){var _0x393474={'messageId':_0x16a40d[_0x45b725[0x0]][_0xe808('0x69')]};if(!_0x25a5b2[_0xe808('0x3a')]){_0x393474[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x393474);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'csc',util['inspect'](_0x16a40d['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x8646b8){return logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x5b'),util['inspect'](_0x8646b8,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),'afterCreate',_0xe808('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x25a5b2[_0xe808('0x5d')]){var _0x275c1c={'method':_0xe808('0x36'),'uri':_0xe808('0x6a'),'headers':{'Authorization':_0x25a5b2[_0xe808('0x5d')]},'body':{'content':_0x40b7c3['body'],'to':[_0x40b7c3[_0xe808('0x21')]],'from':_0x25a5b2['phone'],'binary':![],'clientMessageId':_0xe808('0x6b'),'charset':_0xe808('0x6c')},'json':!![]};rp(_0x275c1c)[_0xe808('0x29')](function(_0x1e94e5){if(!_0x1e94e5[_0xe808('0x1c')]){var _0x3555b8={'messageId':_0x1e94e5[_0xe808('0x23')][0x0]['apiMessageId']};if(!_0x25a5b2[_0xe808('0x3a')]){_0x3555b8[_0xe808('0x3b')]=!![];}return _0x263344[_0xe808('0x19')](_0x3555b8);}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),'afterCreate',_0xe808('0x6d'),util[_0xe808('0x3c')](_0x1e94e5[_0xe808('0x1c')],{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x23f9ae){return logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x6d'),util[_0xe808('0x3c')](_0x23f9ae,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'clickatell',_0xe808('0x6e'));}break;case _0xe808('0x6f'):if(_0x25a5b2[_0xe808('0x2f')]&&_0x25a5b2[_0xe808('0x30')]){var _0x8e0cf9=util[_0xe808('0x44')](_0xe808('0x45'),_0x25a5b2['username'],_0x25a5b2[_0xe808('0x30')]);var _0x236f4b={'method':'POST','uri':_0xe808('0x70')+_0x25a5b2['accountId']+'/messages','body':{'to':[_0x40b7c3[_0xe808('0x21')]],'text':_0x40b7c3[_0xe808('0xc')],'from':_0x25a5b2[_0xe808('0x21')],'applicationId':_0x25a5b2[_0xe808('0x71')]},'headers':{'Authorization':util[_0xe808('0x44')](_0xe808('0x47'),new Buffer(_0x8e0cf9)['toString'](_0xe808('0x49')))},'json':!![]};rp(_0x236f4b)[_0xe808('0x29')](function(_0xb6e4ce){if(_0xb6e4ce['id']){var _0x23a548={'messageId':_0xb6e4ce['id']};return _0x263344[_0xe808('0x19')](_0x23a548);}else{logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x6f'),util[_0xe808('0x3c')](_0xb6e4ce,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x2deb7d){logger['error'](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x6f'),util[_0xe808('0x3c')](_0x2deb7d,{'showHidden':![],'depth':null}));});}else{logger[_0xe808('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe808('0x2b'),_0xe808('0x6f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe808('0x72'):if(_0x25a5b2['apiKey']){var _0x2416de={};var _0x457a11={'method':_0xe808('0x36'),'uri':_0xe808('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x25a5b2[_0xe808('0x5d')],'Content-Type':_0xe808('0x59')},'body':{'from':_0x25a5b2[_0xe808('0x21')],'to':_0x40b7c3['phone'],'text':_0x40b7c3[_0xe808('0xc')]},'json':!![]};return rp(_0x457a11)['then'](function(_0x3a4eec){if(_0x3a4eec[_0xe808('0x74')]==0xca){_0x2416de[_0xe808('0x75')]=_0x3a4eec;var _0x4a4acd={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xe808('0x76')+_0x25a5b2[_0xe808('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x2416de[_0xe808('0x75')]['refid']},'json':!![]};return rp(_0x4a4acd)[_0xe808('0x29')](function(_0x4dbe33){_0x2416de['status']=_0x4dbe33;var _0x36b4ee={'messageId':_0x2416de[_0xe808('0x75')][_0xe808('0x77')],'read':!![]};return _0x263344[_0xe808('0x19')](_0x36b4ee);});}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),'intelepeer',util[_0xe808('0x3c')](_0x3a4eec,{'showHidden':![],'depth':null}));}})[_0xe808('0x1b')](function(_0x4b0553){return logger['error'](_0xe808('0x2c'),'afterCreate','intelepeer',util[_0xe808('0x3c')](_0x4b0553,{'showHidden':![],'depth':null}));});}else{return logger[_0xe808('0x1c')](_0xe808('0x2c'),_0xe808('0x2b'),_0xe808('0x72'),_0xe808('0x78'));}break;}}})['finally'](function(){_0x3e6967();});}else{_0x3e6967();}}},'charset':_0xe808('0x79'),'collate':_0xe808('0x7a')});}; \ No newline at end of file +var _0xcebc=['bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','toString','base64','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','get','direction','out','isNil','SmsInteractionId','SmsInteraction','update','createdAt','catch','error','secret','SmsAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sort','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId'];(function(_0x372b45,_0x11a859){var _0x44ee28=function(_0xe092c5){while(--_0xe092c5){_0x372b45['push'](_0x372b45['shift']());}};_0x44ee28(++_0x11a859);}(_0xcebc,0x16f));var _0xcceb=function(_0x4e0265,_0x469cdc){_0x4e0265=_0x4e0265-0x0;var _0x1deea7=_0xcebc[_0x4e0265];return _0x1deea7;};'use strict';var _=require(_0xcceb('0x0'));var util=require('util');var logger=require(_0xcceb('0x1'))(_0xcceb('0x2'));var moment=require(_0xcceb('0x3'));var BPromise=require('bluebird');var rp=require(_0xcceb('0x4'));var fs=require('fs');var path=require(_0xcceb('0x5'));var rimraf=require(_0xcceb('0x6'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xcceb('0x7')]=function(_0x4da498,_0xa426e1){return _0x4da498[_0xcceb('0x8')](_0xcceb('0x9'),attributes,{'tableName':_0xcceb('0xa'),'paranoid':![],'indexes':[{'name':_0xcceb('0xb'),'fields':[_0xcceb('0xb')]},{'name':'fti_sms_messages','fields':[_0xcceb('0xc')],'type':_0xcceb('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x435ff4,_0x1e0508,_0xbbc909){var _0x10ee9c=_0x4da498['models'];var _0x242be4=_0x435ff4[_0xcceb('0xe')]({'plain':!![]});if(_0x242be4[_0xcceb('0xf')]['toLowerCase']()==='in'||_0x242be4[_0xcceb('0xf')]['toLowerCase']()===_0xcceb('0x10')&&!_0x242be4['secret']&&!_[_0xcceb('0x11')](_0x242be4['UserId'])&&!_[_0xcceb('0x11')](_0x242be4[_0xcceb('0x12')])){_0x10ee9c[_0xcceb('0x13')]['findOne']({'where':{'id':_0x242be4['SmsInteractionId']}})['then'](function(_0x41a879){if(_0x41a879){_0x41a879[_0xcceb('0x14')]({'lastMsgAt':_0x242be4[_0xcceb('0x15')],'lastMsgDirection':_0x242be4[_0xcceb('0xf')]['toLowerCase']()});}})[_0xcceb('0x16')](function(_0x336b53){console[_0xcceb('0x17')](_0x336b53);});}if(_0x242be4[_0xcceb('0xf')]==='out'&&!_0x242be4[_0xcceb('0x18')]){var _0x576ba;_0x10ee9c[_0xcceb('0x19')][_0xcceb('0x1a')]({'where':{'id':_0x242be4['SmsAccountId']},'raw':!![]})[_0xcceb('0x1b')](function(_0x39756c){_0x576ba=_0x39756c;if(_0x576ba&&_0x576ba[_0xcceb('0x1c')]){switch(_0x576ba['type']){case _0xcceb('0x1d'):var _0x384f59=require(_0xcceb('0x1d'));if(_0x576ba[_0xcceb('0x1e')]&&_0x576ba[_0xcceb('0x1f')]&&_0x576ba[_0xcceb('0x20')]){var _0x49696a=new _0x384f59(_0x576ba[_0xcceb('0x1e')],_0x576ba[_0xcceb('0x1f')]);_0x49696a[_0xcceb('0x21')][_0xcceb('0x22')]({'body':_0x242be4[_0xcceb('0xc')],'to':_0x242be4[_0xcceb('0x20')],'from':_0x576ba[_0xcceb('0x20')],'statusCallback':_0x576ba[_0xcceb('0x23')]+_0xcceb('0x24')+_0x242be4['id']+'/status?token='+_0x576ba[_0xcceb('0x25')]})['then'](function(_0x5df275){if(_0x5df275[_0xcceb('0x26')]){return _0x435ff4[_0xcceb('0x14')]({'messageId':_0x5df275[_0xcceb('0x26')]});}})['catch'](function(_0x12b397){logger['error'](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x1d'),util['inspect'](_0x12b397,{'showHidden':![],'depth':null}));});}else{logger[_0xcceb('0x17')](_0xcceb('0x27'),'afterCreate',_0xcceb('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xcceb('0x29'):var _0x362c4e=_0xcceb('0x2a');if(_0x576ba[_0xcceb('0x2b')]&&_0x576ba[_0xcceb('0x2c')]){var _0x2a07ba={'recipient':[_0x242be4['phone']],'message':_0x242be4[_0xcceb('0xc')],'message_type':_0x576ba[_0xcceb('0x2d')]};if(_0x576ba[_0xcceb('0x2d')]&&_0x576ba[_0xcceb('0x2d')]!=='SI'){_0x2a07ba[_0xcceb('0x2e')]=_0x576ba[_0xcceb('0x20')];}var _0x5f6b72={'url':_0x362c4e+_0xcceb('0x2f')+_0x576ba['username']+_0xcceb('0x30')+_0x576ba[_0xcceb('0x2c')],'method':_0xcceb('0x31')};rp(_0x5f6b72)[_0xcceb('0x1b')](function(_0x240d78){var _0x5bb94c=_0x240d78[_0xcceb('0x32')](';');var _0x258e0f={'user_key':_0x5bb94c[0x0],'session_key':_0x5bb94c[0x1]};_0x5f6b72={'url':_0x362c4e+_0xcceb('0x33'),'method':_0xcceb('0x34'),'headers':{'user_key':_0x258e0f['user_key'],'Session_key':_0x258e0f[_0xcceb('0x35')]},'json':!![],'body':_0x2a07ba};return rp(_0x5f6b72);})['then'](function(_0x44c783){if(_0x44c783[_0xcceb('0x36')]>=0x1){var _0x3532aa={'messageId':_0x44c783[_0xcceb('0x37')]};if(_0x576ba[_0xcceb('0x2d')]!=='GP'||!_0x576ba[_0xcceb('0x38')]){_0x3532aa[_0xcceb('0x39')]=!![];}return _0x435ff4[_0xcceb('0x14')](_0x3532aa);}else{return logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x29'),util[_0xcceb('0x3a')](_0x44c783,{'showHidden':![],'depth':null}));}})['catch'](function(_0x11eb37){return logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x29'),util[_0xcceb('0x3a')](_0x11eb37,{'showHidden':![],'depth':null}));});}else{logger[_0xcceb('0x17')](_0xcceb('0x27'),'afterCreate',_0xcceb('0x29'),_0xcceb('0x3b'));}break;case _0xcceb('0x3c'):if(_0x576ba[_0xcceb('0x1f')]){var _0x2f1497={'recipient':_0x242be4[_0xcceb('0x20')],'message':_0x242be4[_0xcceb('0xc')],'sender':_0x576ba[_0xcceb('0x3d')]||_0x576ba['phone'],'authorization':_0x576ba[_0xcceb('0x1f')]};var _0x1e0508={'method':_0xcceb('0x34'),'uri':_0xcceb('0x3e'),'body':_0x2f1497,'json':!![]};rp(_0x1e0508)[_0xcceb('0x1b')](function(_0x5bddc2){var _0x4782d6={'messageId':_0x5bddc2['requestid']};if(!_0x576ba[_0xcceb('0x38')]){_0x4782d6[_0xcceb('0x39')]=!![];}return _0x435ff4[_0xcceb('0x14')](_0x4782d6);})[_0xcceb('0x16')](function(_0x151406){logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x3c'),util[_0xcceb('0x3a')](_0x151406,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x3c'),_0xcceb('0x3f'));}break;case'clicksend':if(_0x576ba[_0xcceb('0x2b')]&&_0x576ba[_0xcceb('0x2c')]){var _0x2f1497={'messages':[{'source':_0xcceb('0x40'),'to':_0x242be4['phone'],'body':_0x242be4[_0xcceb('0xc')],'from':_0x576ba[_0xcceb('0x3d')]||_0x576ba[_0xcceb('0x20')]}]};var _0x5228a3=util[_0xcceb('0x41')](_0xcceb('0x42'),_0x576ba[_0xcceb('0x2b')],_0x576ba[_0xcceb('0x2c')]);var _0x1e0508={'method':_0xcceb('0x34'),'uri':_0xcceb('0x43'),'body':_0x2f1497,'headers':{'Authorization':util[_0xcceb('0x41')]('Basic\x20%s',new Buffer(_0x5228a3)['toString']('base64'))},'json':!![]};rp(_0x1e0508)[_0xcceb('0x1b')](function(_0x2aebd5){if(_0x2aebd5[_0xcceb('0x44')]>=0xc8&&_0x2aebd5['http_code']<=0xce){if(_0x2aebd5['data']&&_0x2aebd5[_0xcceb('0x45')][_0xcceb('0x46')]>0x0){var _0xaf2476=_[_0xcceb('0x47')](_0x2aebd5[_0xcceb('0x45')][_0xcceb('0x21')]);var _0x286fc0={'messageId':_0xaf2476[_0xcceb('0x48')]};if(!_0x576ba['deliveryReport']){_0x286fc0[_0xcceb('0x39')]=!![];}return _0x435ff4[_0xcceb('0x14')](_0x286fc0);}else{logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x49'),util[_0xcceb('0x3a')](_0x2aebd5,{'showHidden':![],'depth':null}));}}else{logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x49'),util[_0xcceb('0x3a')](_0x2aebd5,{'showHidden':![],'depth':null}));}})[_0xcceb('0x16')](function(_0x4b2f55){logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),'clickSend',util[_0xcceb('0x3a')](_0x4b2f55,{'showHidden':![],'depth':null}));});}else{logger[_0xcceb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcceb('0x28'),_0xcceb('0x49'),_0xcceb('0x3b'));}break;case _0xcceb('0x4a'):if(_0x576ba[_0xcceb('0x4b')]&&_0x576ba[_0xcceb('0x1f')]){var _0x2f1497={'dst':_0x242be4[_0xcceb('0x20')],'text':_0x242be4[_0xcceb('0xc')],'src':_0x576ba[_0xcceb('0x3d')]||_0x576ba[_0xcceb('0x20')],'url':_0x576ba[_0xcceb('0x23')]+_0xcceb('0x24')+_0x242be4['id']+_0xcceb('0x4c')+_0x576ba[_0xcceb('0x25')]};var _0x5228a3=util[_0xcceb('0x41')](_0xcceb('0x42'),_0x576ba['authId'],_0x576ba[_0xcceb('0x1f')]);var _0x1e0508={'method':_0xcceb('0x34'),'uri':util[_0xcceb('0x41')](_0xcceb('0x4d'),_0x576ba[_0xcceb('0x4b')]),'body':_0x2f1497,'headers':{'Authorization':util[_0xcceb('0x41')](_0xcceb('0x4e'),new Buffer(_0x5228a3)['toString']('base64'))},'json':!![]};rp(_0x1e0508)[_0xcceb('0x1b')](function(_0x47312c){var _0x3f7306={'messageId':_0x47312c['message_uuid'][0x0]};return _0x435ff4[_0xcceb('0x14')](_0x3f7306);})[_0xcceb('0x16')](function(_0x269468){logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x4a'),util[_0xcceb('0x3a')](_0x269468,{'showHidden':![],'depth':null}));});}else{logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),'plivo',_0xcceb('0x4f'));}break;case _0xcceb('0x50'):if(_0x576ba[_0xcceb('0x2b')]&&_0x576ba[_0xcceb('0x2c')]){if(_0x576ba[_0xcceb('0x51')]){var _0x13ffa6={'method':_0xcceb('0x34'),'uri':_0x576ba[_0xcceb('0x51')]+'/auth/1/session','body':{'username':_0x576ba[_0xcceb('0x2b')],'password':_0x576ba[_0xcceb('0x2c')]},'json':!![]};return rp(_0x13ffa6)[_0xcceb('0x1b')](function(_0x2b7c67){var _0x10a71b={'method':_0xcceb('0x34'),'uri':_0x576ba[_0xcceb('0x51')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x576ba['phone'],'destinations':[{'to':_0x242be4[_0xcceb('0x20')]}],'text':_0x242be4[_0xcceb('0xc')],'notifyUrl':_0x576ba['remote']+'/api/sms/messages/'+_0x242be4['id']+'/status?token='+_0x576ba[_0xcceb('0x25')],'notifyContentType':_0xcceb('0x52'),'callbackData':_0x576ba[_0xcceb('0x20')]+';'+_0x242be4['body']}]},'headers':{'Authorization':_0xcceb('0x53')+_0x2b7c67[_0xcceb('0x25')]},'json':!![]};return rp(_0x10a71b)['then'](function(_0x5b7f85){if(_0x5b7f85[_0xcceb('0x21')]){var _0x29ff36={'messageId':_0x5b7f85['messages'][0x0][_0xcceb('0xb')]};if(!_0x576ba[_0xcceb('0x38')]){_0x29ff36['read']=!![];}return _0x435ff4[_0xcceb('0x14')](_0x29ff36);}else{return logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x50'),util[_0xcceb('0x3a')](_0x5b7f85,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x510a11){return logger[_0xcceb('0x17')](_0xcceb('0x27'),'afterCreate',_0xcceb('0x50'),util[_0xcceb('0x3a')](_0x510a11,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xcceb('0x50'),_0xcceb('0x54'));}}else{logger[_0xcceb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xcceb('0x55'):var _0x3412d4=require(_0xcceb('0x56'));if(_0x576ba[_0xcceb('0x57')]){var _0x15e31e={};_0x15e31e[_0xcceb('0x58')]=_0x576ba[_0xcceb('0x2b')];_0x15e31e[_0xcceb('0x20')]=_0x242be4[_0xcceb('0x20')];_0x15e31e[_0xcceb('0x2e')]=_0x576ba[_0xcceb('0x20')];_0x15e31e['text']=_0x242be4['body'];_0x15e31e['timestamp']=+new Date();var _0x426a8d='';var _0x4e3e4f='';var _0x5c2d10=Object['keys'](_0x15e31e);_0x5c2d10[_0xcceb('0x59')]();for(var _0x142ebe=0x0;_0x142ebe<_0x5c2d10['length'];_0x142ebe++){if(_0x426a8d!=''){_0x426a8d+='&';}_0x426a8d+=_0x5c2d10[_0x142ebe]+'='+encodeURIComponent(_0x15e31e[_0x5c2d10[_0x142ebe]]);_0x4e3e4f+=_0x15e31e[_0x5c2d10[_0x142ebe]];}_0x4e3e4f+=_0x576ba['apiKey'];_0x4e3e4f=_0x3412d4[_0xcceb('0x5a')](_0xcceb('0x5b'))[_0xcceb('0x14')](_0x4e3e4f)[_0xcceb('0x5c')]('hex');if(_0x426a8d!==''){_0x426a8d+='&';}_0x426a8d+=_0xcceb('0x5d')+_0x4e3e4f;var _0x5f6b72={'method':_0xcceb('0x31'),'uri':_0x576ba[_0xcceb('0x51')]+_0xcceb('0x5e')+_0x426a8d,'json':!![]};return rp(_0x5f6b72)[_0xcceb('0x1b')](function(_0x179a2d){var _0x42e71a=Object['keys'](_0x179a2d);if(_0x179a2d[_0x42e71a[0x0]]['error']&&parseInt(_0x179a2d[_0x42e71a[0x0]][_0xcceb('0x17')])===0x0){var _0x1f42aa={'messageId':_0x179a2d[_0x42e71a[0x0]][_0xcceb('0x5f')]};if(!_0x576ba[_0xcceb('0x38')]){_0x1f42aa[_0xcceb('0x39')]=!![];}return _0x435ff4['update'](_0x1f42aa);}else{return logger[_0xcceb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcceb('0x28'),_0xcceb('0x55'),util['inspect'](_0x179a2d[_0xcceb('0x17')],{'showHidden':![],'depth':null}));}})[_0xcceb('0x16')](function(_0x155062){return logger[_0xcceb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcceb('0x28'),'csc',util[_0xcceb('0x3a')](_0x155062,{'showHidden':![],'depth':null}));});}else{logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x55'),_0xcceb('0x60'));}break;case _0xcceb('0x61'):if(_0x576ba[_0xcceb('0x57')]){var _0x3eecc0={'method':'POST','uri':_0xcceb('0x62'),'headers':{'Authorization':_0x576ba[_0xcceb('0x57')]},'body':{'content':_0x242be4[_0xcceb('0xc')],'to':[_0x242be4['phone']],'from':_0x576ba[_0xcceb('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0xcceb('0x63')},'json':!![]};rp(_0x3eecc0)[_0xcceb('0x1b')](function(_0x2a70e3){if(!_0x2a70e3[_0xcceb('0x17')]){var _0x4c4169={'messageId':_0x2a70e3[_0xcceb('0x21')][0x0][_0xcceb('0x64')]};if(!_0x576ba['deliveryReport']){_0x4c4169[_0xcceb('0x39')]=!![];}return _0x435ff4[_0xcceb('0x14')](_0x4c4169);}else{return logger['error'](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x61'),util[_0xcceb('0x3a')](_0x2a70e3['error'],{'showHidden':![],'depth':null}));}})[_0xcceb('0x16')](function(_0x3f132a){return logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),'clickatell',util[_0xcceb('0x3a')](_0x3f132a,{'showHidden':![],'depth':null}));});}else{logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x61'),_0xcceb('0x60'));}break;case _0xcceb('0x65'):if(_0x576ba['username']&&_0x576ba[_0xcceb('0x2c')]){var _0x5228a3=util['format'](_0xcceb('0x42'),_0x576ba[_0xcceb('0x2b')],_0x576ba[_0xcceb('0x2c')]);var _0x1e0508={'method':_0xcceb('0x34'),'uri':_0xcceb('0x66')+_0x576ba[_0xcceb('0x67')]+_0xcceb('0x68'),'body':{'to':[_0x242be4['phone']],'text':_0x242be4['body'],'from':_0x576ba['phone'],'applicationId':_0x576ba['applicationId']},'headers':{'Authorization':util[_0xcceb('0x41')](_0xcceb('0x4e'),new Buffer(_0x5228a3)[_0xcceb('0x69')](_0xcceb('0x6a')))},'json':!![]};rp(_0x1e0508)[_0xcceb('0x1b')](function(_0x4ac01e){if(_0x4ac01e['id']){var _0xc7c463={'messageId':_0x4ac01e['id']};return _0x435ff4[_0xcceb('0x14')](_0xc7c463);}else{logger[_0xcceb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcceb('0x28'),_0xcceb('0x65'),util[_0xcceb('0x3a')](_0x4ac01e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c577a){logger[_0xcceb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcceb('0x28'),_0xcceb('0x65'),util[_0xcceb('0x3a')](_0x3c577a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x65'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x576ba[_0xcceb('0x57')]){var _0x3292c4={};var _0x5f6b72={'method':_0xcceb('0x34'),'uri':_0xcceb('0x6b'),'headers':{'Authorization':_0xcceb('0x6c')+_0x576ba[_0xcceb('0x57')],'Content-Type':_0xcceb('0x52')},'body':{'from':_0x576ba[_0xcceb('0x20')],'to':_0x242be4[_0xcceb('0x20')],'text':_0x242be4[_0xcceb('0xc')]},'json':!![]};return rp(_0x5f6b72)[_0xcceb('0x1b')](function(_0x14c39f){if(_0x14c39f[_0xcceb('0x6d')]==0xca){_0x3292c4[_0xcceb('0x6e')]=_0x14c39f;var _0x5d8121={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xcceb('0x6c')+_0x576ba['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x3292c4[_0xcceb('0x6e')][_0xcceb('0x6f')]},'json':!![]};return rp(_0x5d8121)[_0xcceb('0x1b')](function(_0x3324c0){_0x3292c4[_0xcceb('0x70')]=_0x3324c0;var _0x57a176={'messageId':_0x3292c4[_0xcceb('0x6e')][_0xcceb('0x6f')],'read':!![]};return _0x435ff4[_0xcceb('0x14')](_0x57a176);});}else{return logger[_0xcceb('0x17')](_0xcceb('0x27'),'afterCreate',_0xcceb('0x71'),util['inspect'](_0x14c39f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3ad307){return logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),_0xcceb('0x71'),util[_0xcceb('0x3a')](_0x3ad307,{'showHidden':![],'depth':null}));});}else{return logger[_0xcceb('0x17')](_0xcceb('0x27'),_0xcceb('0x28'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xcceb('0x72')](function(){_0xbbc909();});}else{_0xbbc909();}}},'charset':_0xcceb('0x73'),'collate':_0xcceb('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2a821e3..dcc58c4 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 _0x5d97=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x5cadab,_0x1dadcb){var _0x2a6d2b=function(_0x1c226a){while(--_0x1c226a){_0x5cadab['push'](_0x5cadab['shift']());}};_0x2a6d2b(++_0x1dadcb);}(_0x5d97,0x19c));var _0x75d9=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5d97[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x75d9('0x0'));var util=require(_0x75d9('0x1'));var moment=require(_0x75d9('0x2'));var BPromise=require(_0x75d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75d9('0x4'));var db=require(_0x75d9('0x5'))['db'];var utils=require(_0x75d9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x75d9('0x7'));var jayson=require(_0x75d9('0x8'));var client=jayson[_0x75d9('0x9')][_0x75d9('0xa')]({'port':0x232a});config['redis']=_[_0x75d9('0xb')](config[_0x75d9('0xc')],{'host':_0x75d9('0xd'),'port':0x18eb});var socket=require(_0x75d9('0xe'))(new Redis(config[_0x75d9('0xc')]));require(_0x75d9('0xf'))[_0x75d9('0x10')](socket);function respondWithRpcPromise(_0x42a363,_0x2db0c5,_0xbccc9d){return new BPromise(function(_0x566d4f,_0x3388e6){return client[_0x75d9('0x11')](_0x42a363,_0xbccc9d)[_0x75d9('0x12')](function(_0x2c33f8){logger['info'](_0x75d9('0x13'),_0x2db0c5,_0x75d9('0x14'));logger[_0x75d9('0x15')](_0x75d9('0x16'),_0x2db0c5,'request\x20sent',JSON[_0x75d9('0x17')](_0x2c33f8));if(_0x2c33f8['error']){if(_0x2c33f8[_0x75d9('0x18')]['code']===0x1f4){logger[_0x75d9('0x18')](_0x75d9('0x13'),_0x2db0c5,_0x2c33f8[_0x75d9('0x18')][_0x75d9('0x19')]);return _0x3388e6(_0x2c33f8[_0x75d9('0x18')][_0x75d9('0x19')]);}logger[_0x75d9('0x18')](_0x75d9('0x13'),_0x2db0c5,_0x2c33f8[_0x75d9('0x18')][_0x75d9('0x19')]);return _0x566d4f(_0x2c33f8['error']['message']);}else{logger[_0x75d9('0x1a')](_0x75d9('0x13'),_0x2db0c5,'request\x20sent');_0x566d4f(_0x2c33f8[_0x75d9('0x1b')][_0x75d9('0x19')]);}})[_0x75d9('0x1c')](function(_0x26aa75){logger['error'](_0x75d9('0x13'),_0x2db0c5,_0x26aa75);_0x3388e6(_0x26aa75);});});}exports[_0x75d9('0x1d')]=function(_0xb3ecc1){var _0x25ba8b=this;return new Promise(function(_0x51a58d,_0x15ab4c){return db[_0x75d9('0x1e')][_0x75d9('0x1f')](_0xb3ecc1[_0x75d9('0x20')],{'raw':_0xb3ecc1['options']?_0xb3ecc1[_0x75d9('0x21')][_0x75d9('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x403013){logger['info'](_0x75d9('0x1d'),_0xb3ecc1);logger['debug'](_0x75d9('0x1d'),_0xb3ecc1,JSON[_0x75d9('0x17')](_0x403013));_0x51a58d(_0x403013);})[_0x75d9('0x1c')](function(_0x49cf02){logger['error'](_0x75d9('0x1d'),_0x49cf02[_0x75d9('0x19')],_0xb3ecc1);_0x15ab4c(_0x25ba8b[_0x75d9('0x18')](0x1f4,_0x49cf02[_0x75d9('0x19')]));});});}; \ No newline at end of file +var _0x4096=['result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x135505,_0xb1160b){var _0x4315e4=function(_0x54175b){while(--_0x54175b){_0x135505['push'](_0x135505['shift']());}};_0x4315e4(++_0xb1160b);}(_0x4096,0x1d8));var _0x6409=function(_0x5b29b5,_0x47b2fa){_0x5b29b5=_0x5b29b5-0x0;var _0x488186=_0x4096[_0x5b29b5];return _0x488186;};'use strict';var _=require(_0x6409('0x0'));var util=require(_0x6409('0x1'));var moment=require(_0x6409('0x2'));var BPromise=require(_0x6409('0x3'));var rs=require(_0x6409('0x4'));var fs=require('fs');var Redis=require(_0x6409('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6409('0x6'));var logger=require(_0x6409('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6409('0x8'));var client=jayson[_0x6409('0x9')][_0x6409('0xa')]({'port':0x232a});config[_0x6409('0xb')]=_[_0x6409('0xc')](config[_0x6409('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6409('0xb')]));require(_0x6409('0xd'))[_0x6409('0xe')](socket);function respondWithRpcPromise(_0x222bc5,_0x57c996,_0x526d78){return new BPromise(function(_0x3a375e,_0x220b83){return client[_0x6409('0xf')](_0x222bc5,_0x526d78)[_0x6409('0x10')](function(_0x11b3ec){logger[_0x6409('0x11')](_0x6409('0x12'),_0x57c996,_0x6409('0x13'));logger[_0x6409('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x57c996,_0x6409('0x13'),JSON[_0x6409('0x15')](_0x11b3ec));if(_0x11b3ec[_0x6409('0x16')]){if(_0x11b3ec['error']['code']===0x1f4){logger[_0x6409('0x16')](_0x6409('0x12'),_0x57c996,_0x11b3ec[_0x6409('0x16')][_0x6409('0x17')]);return _0x220b83(_0x11b3ec[_0x6409('0x16')][_0x6409('0x17')]);}logger['error'](_0x6409('0x12'),_0x57c996,_0x11b3ec[_0x6409('0x16')][_0x6409('0x17')]);return _0x3a375e(_0x11b3ec[_0x6409('0x16')]['message']);}else{logger[_0x6409('0x11')]('SmsMessage,\x20%s,\x20%s',_0x57c996,'request\x20sent');_0x3a375e(_0x11b3ec[_0x6409('0x18')][_0x6409('0x17')]);}})[_0x6409('0x19')](function(_0x49fdfe){logger[_0x6409('0x16')](_0x6409('0x12'),_0x57c996,_0x49fdfe);_0x220b83(_0x49fdfe);});});}exports[_0x6409('0x1a')]=function(_0x4e9f64){var _0x2bbd5e=this;return new Promise(function(_0x58e660,_0x5cc25e){return db[_0x6409('0x1b')][_0x6409('0x1c')](_0x4e9f64[_0x6409('0x1d')],{'raw':_0x4e9f64['options']?_0x4e9f64[_0x6409('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4eaeee){logger['info'](_0x6409('0x1a'),_0x4e9f64);logger[_0x6409('0x14')](_0x6409('0x1a'),_0x4e9f64,JSON[_0x6409('0x15')](_0x4eaeee));_0x58e660(_0x4eaeee);})[_0x6409('0x19')](function(_0x3770ac){logger['error'](_0x6409('0x1a'),_0x3770ac[_0x6409('0x17')],_0x4e9f64);_0x5cc25e(_0x2bbd5e[_0x6409('0x16')](0x1f4,_0x3770ac[_0x6409('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 13a7607..f57c3cf 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 _0x54da=['register','length','save','remove','emit','removeListener'];(function(_0x111f22,_0x5ba1ec){var _0x2b8ba3=function(_0x2ae8ed){while(--_0x2ae8ed){_0x111f22['push'](_0x111f22['shift']());}};_0x2b8ba3(++_0x5ba1ec);}(_0x54da,0x176));var _0xa54d=function(_0x195270,_0x412abb){_0x195270=_0x195270-0x0;var _0x5398dd=_0x54da[_0x195270];return _0x5398dd;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xa54d('0x0'),_0xa54d('0x1'),'update'];function createListener(_0x48583a,_0x4ae73a){return function(_0x11b832){_0x4ae73a[_0xa54d('0x2')](_0x48583a,_0x11b832);};}function removeListener(_0x55f2ca,_0x5b9590){return function(){SmsMessageEvents[_0xa54d('0x3')](_0x55f2ca,_0x5b9590);};}exports[_0xa54d('0x4')]=function(_0x25f7dd){for(var _0xc7bfc8=0x0,_0x586f0a=events[_0xa54d('0x5')];_0xc7bfc8<_0x586f0a;_0xc7bfc8++){var _0x5b9456=events[_0xc7bfc8];var _0x3ab2a8=createListener('smsMessage:'+_0x5b9456,_0x25f7dd);SmsMessageEvents['on'](_0x5b9456,_0x3ab2a8);}}; \ No newline at end of file +var _0xe825=['update','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x34945d,_0x14b432){var _0x2163a6=function(_0x29666a){while(--_0x29666a){_0x34945d['push'](_0x34945d['shift']());}};_0x2163a6(++_0x14b432);}(_0xe825,0x77));var _0x5e82=function(_0x2254f3,_0x36ed5c){_0x2254f3=_0x2254f3-0x0;var _0x2e3ec5=_0xe825[_0x2254f3];return _0x2e3ec5;};'use strict';var SmsMessageEvents=require(_0x5e82('0x0'));var events=['save','remove',_0x5e82('0x1')];function createListener(_0x5367df,_0x3e4df9){return function(_0x3c9264){_0x3e4df9[_0x5e82('0x2')](_0x5367df,_0x3c9264);};}function removeListener(_0x3e2212,_0x20c8d1){return function(){SmsMessageEvents[_0x5e82('0x3')](_0x3e2212,_0x20c8d1);};}exports['register']=function(_0x1cc4e8){for(var _0x44761e=0x0,_0x342815=events[_0x5e82('0x4')];_0x44761e<_0x342815;_0x44761e++){var _0x42359e=events[_0x44761e];var _0x4076ea=createListener(_0x5e82('0x5')+_0x42359e,_0x1cc4e8);SmsMessageEvents['on'](_0x42359e,_0x4076ea);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a3ddf49..31e4bf5 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 _0x92b9=['isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get'];(function(_0x3aef1e,_0x2da550){var _0xdef669=function(_0xd937d){while(--_0xd937d){_0x3aef1e['push'](_0x3aef1e['shift']());}};_0xdef669(++_0x2da550);}(_0x92b9,0x14b));var _0x992b=function(_0x5b77ae,_0x1a62fd){_0x5b77ae=_0x5b77ae-0x0;var _0x1b2c49=_0x92b9[_0x5b77ae];return _0x1b2c49;};'use strict';var multer=require(_0x992b('0x0'));var util=require(_0x992b('0x1'));var path=require(_0x992b('0x2'));var timeout=require(_0x992b('0x3'));var express=require(_0x992b('0x4'));var router=express['Router']();var fs_extra=require(_0x992b('0x5'));var auth=require(_0x992b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x992b('0x7'));var controller=require(_0x992b('0x8'));router[_0x992b('0x9')]('/',auth[_0x992b('0xa')](),controller['index']);router['get'](_0x992b('0xb'),auth[_0x992b('0xa')](),controller[_0x992b('0xc')]);router[_0x992b('0x9')](_0x992b('0xd'),auth['isAuthenticated'](),controller[_0x992b('0xe')]);router[_0x992b('0x9')](_0x992b('0xf'),auth[_0x992b('0xa')](),controller[_0x992b('0x10')]);router['get']('/:id/teams',auth[_0x992b('0xa')](),controller[_0x992b('0x11')]);router['get']('/:id/users',auth[_0x992b('0xa')](),controller[_0x992b('0x12')]);router[_0x992b('0x13')]('/',auth[_0x992b('0xa')](),controller[_0x992b('0x14')]);router[_0x992b('0x13')](_0x992b('0x15'),auth[_0x992b('0xa')](),controller[_0x992b('0x16')]);router['post'](_0x992b('0x17'),auth[_0x992b('0xa')](),controller[_0x992b('0x18')]);router[_0x992b('0x19')](_0x992b('0xd'),auth[_0x992b('0xa')](),controller[_0x992b('0x1a')]);router['delete']('/:id',auth[_0x992b('0xa')](),controller['destroy']);router[_0x992b('0x1b')](_0x992b('0x15'),auth[_0x992b('0xa')](),controller[_0x992b('0x1c')]);router[_0x992b('0x1b')](_0x992b('0x17'),auth[_0x992b('0xa')](),controller[_0x992b('0x1d')]);module[_0x992b('0x1e')]=router; \ No newline at end of file +var _0x5915=['index','/describe','describe','get','/:id','show','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x17f018,_0x6fb066){var _0x12e19b=function(_0x33ab5f){while(--_0x33ab5f){_0x17f018['push'](_0x17f018['shift']());}};_0x12e19b(++_0x6fb066);}(_0x5915,0x14a));var _0x5591=function(_0x285aaf,_0x2b1f45){_0x285aaf=_0x285aaf-0x0;var _0x3e4d42=_0x5915[_0x285aaf];return _0x3e4d42;};'use strict';var multer=require(_0x5591('0x0'));var util=require(_0x5591('0x1'));var path=require(_0x5591('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5591('0x3')]();var fs_extra=require(_0x5591('0x4'));var auth=require(_0x5591('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5591('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x5591('0x7')](),controller[_0x5591('0x8')]);router['get'](_0x5591('0x9'),auth[_0x5591('0x7')](),controller[_0x5591('0xa')]);router[_0x5591('0xb')](_0x5591('0xc'),auth['isAuthenticated'](),controller[_0x5591('0xd')]);router[_0x5591('0xb')]('/:id/members',auth[_0x5591('0x7')](),controller['getMembers']);router[_0x5591('0xb')](_0x5591('0xe'),auth['isAuthenticated'](),controller[_0x5591('0xf')]);router['get'](_0x5591('0x10'),auth[_0x5591('0x7')](),controller['getAgents']);router[_0x5591('0x11')]('/',auth[_0x5591('0x7')](),controller[_0x5591('0x12')]);router[_0x5591('0x11')](_0x5591('0xe'),auth[_0x5591('0x7')](),controller['addTeams']);router[_0x5591('0x11')](_0x5591('0x10'),auth['isAuthenticated'](),controller[_0x5591('0x13')]);router[_0x5591('0x14')](_0x5591('0xc'),auth[_0x5591('0x7')](),controller['update']);router[_0x5591('0x15')](_0x5591('0xc'),auth[_0x5591('0x7')](),controller[_0x5591('0x16')]);router[_0x5591('0x15')](_0x5591('0xe'),auth[_0x5591('0x7')](),controller[_0x5591('0x17')]);router[_0x5591('0x15')](_0x5591('0x10'),auth[_0x5591('0x7')](),controller[_0x5591('0x18')]);module[_0x5591('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 72e7e62..c6188b8 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 _0x7e38=['rrmemory','beepall','roundrobin','exports','name','STRING','INTEGER'];(function(_0x347826,_0x57f63c){var _0x1696de=function(_0x257081){while(--_0x257081){_0x347826['push'](_0x347826['shift']());}};_0x1696de(++_0x57f63c);}(_0x7e38,0xe3));var _0x87e3=function(_0x470ea4,_0x76804f){_0x470ea4=_0x470ea4-0x0;var _0x9c7b1a=_0x7e38[_0x470ea4];return _0x9c7b1a;};'use strict';var Sequelize=require('sequelize');module[_0x87e3('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x87e3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x87e3('0x2')]},'timeout':{'type':Sequelize[_0x87e3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x87e3('0x4'),_0x87e3('0x5'),_0x87e3('0x6'))}}; \ No newline at end of file +var _0xac71=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x5d13e0,_0x263bb4){var _0xf25969=function(_0x165857){while(--_0x165857){_0x5d13e0['push'](_0x5d13e0['shift']());}};_0xf25969(++_0x263bb4);}(_0xac71,0x1e1));var _0x1ac7=function(_0x1f337b,_0x5512fb){_0x1f337b=_0x1f337b-0x0;var _0x5eb800=_0xac71[_0x1f337b];return _0x5eb800;};'use strict';var Sequelize=require(_0x1ac7('0x0'));module[_0x1ac7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1ac7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ac7('0x3')]},'timeout':{'type':Sequelize[_0x1ac7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ac7('0x5')]('rrmemory',_0x1ac7('0x6'),_0x1ac7('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index fa2149b..3425a98 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x0b0e[_0x55e1d1];return _0x1165db;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x4f6852,_0x4470b2){var _0x5c31b0=function(_0x2a4a0e){while(--_0x2a4a0e){_0x4f6852['push'](_0x4f6852['shift']());}};_0x5c31b0(++_0x4470b2);}(_0x7a54,0x106));var _0x47a5=function(_0x47a550,_0x43066d){_0x47a550=_0x47a550-0x0;var _0x3dd1d9=_0x7a54[_0x47a550];return _0x3dd1d9;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d3ce5a9..c3feaa8 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 _0x2cb1=['hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2d0382,_0x156114){var _0x30814e=function(_0x4d008b){while(--_0x4d008b){_0x2d0382['push'](_0x2d0382['shift']());}};_0x30814e(++_0x156114);}(_0x2cb1,0x1cf));var _0x12cb=function(_0x47f9da,_0x4f99e7){_0x47f9da=_0x47f9da-0x0;var _0x3acb09=_0x2cb1[_0x47f9da];return _0x3acb09;};'use strict';var EventEmitter=require(_0x12cb('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x12cb('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x12cb('0x2')](0x0);var events={'afterCreate':_0x12cb('0x3'),'afterUpdate':_0x12cb('0x4'),'afterDestroy':_0x12cb('0x5')};function emitEvent(_0x18f588){return function(_0x56ca38,_0x3d3be4,_0x253e22){SmsQueueEvents[_0x12cb('0x6')](_0x18f588+':'+_0x56ca38['id'],_0x56ca38);SmsQueueEvents[_0x12cb('0x6')](_0x18f588,_0x56ca38);_0x253e22(null);};}for(var e in events){if(events[_0x12cb('0x7')](e)){var event=events[e];SmsQueue[_0x12cb('0x8')](e,emitEvent(event));}}module[_0x12cb('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x8d3e=['save','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0xe88b1c,_0x1883d7){var _0x5135d7=function(_0x482d8b){while(--_0x482d8b){_0xe88b1c['push'](_0xe88b1c['shift']());}};_0x5135d7(++_0x1883d7);}(_0x8d3e,0x1bc));var _0xe8d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d3e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xe8d3('0x0'));var SmsQueue=require(_0xe8d3('0x1'))['db'][_0xe8d3('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe8d3('0x3')](0x0);var events={'afterCreate':_0xe8d3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21ed97){return function(_0x317881,_0x49fa0f,_0x3a0cd9){SmsQueueEvents[_0xe8d3('0x5')](_0x21ed97+':'+_0x317881['id'],_0x317881);SmsQueueEvents['emit'](_0x21ed97,_0x317881);_0x3a0cd9(null);};}for(var e in events){if(events[_0xe8d3('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xe8d3('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 79a18cd..1a12fa0 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 _0x1b0a=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define'];(function(_0x1f3267,_0x5a314c){var _0x1e17de=function(_0x298fcc){while(--_0x298fcc){_0x1f3267['push'](_0x1f3267['shift']());}};_0x1e17de(++_0x5a314c);}(_0x1b0a,0x97));var _0xa1b0=function(_0x49278b,_0x30fca1){_0x49278b=_0x49278b-0x0;var _0x1f79e2=_0x1b0a[_0x49278b];return _0x1f79e2;};'use strict';var _=require(_0xa1b0('0x0'));var util=require(_0xa1b0('0x1'));var logger=require(_0xa1b0('0x2'))(_0xa1b0('0x3'));var moment=require(_0xa1b0('0x4'));var BPromise=require(_0xa1b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa1b0('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xa1b0('0x7')]=function(_0x41e5ac,_0x485bd1){return _0x41e5ac[_0xa1b0('0x8')]('SmsQueue',attributes,{'tableName':_0xa1b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6dc=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsQueue','sms_queues','lodash'];(function(_0x572199,_0x842cdf){var _0x57f262=function(_0x1f9371){while(--_0x1f9371){_0x572199['push'](_0x572199['shift']());}};_0x57f262(++_0x842cdf);}(_0xf6dc,0xef));var _0xcf6d=function(_0x54340a,_0x3da614){_0x54340a=_0x54340a-0x0;var _0x1d65da=_0xf6dc[_0x54340a];return _0x1d65da;};'use strict';var _=require(_0xcf6d('0x0'));var util=require(_0xcf6d('0x1'));var logger=require(_0xcf6d('0x2'))('api');var moment=require(_0xcf6d('0x3'));var BPromise=require(_0xcf6d('0x4'));var rp=require(_0xcf6d('0x5'));var fs=require('fs');var path=require(_0xcf6d('0x6'));var rimraf=require('rimraf');var config=require(_0xcf6d('0x7'));var attributes=require('./smsQueue.attributes');module[_0xcf6d('0x8')]=function(_0x295eee,_0x2709b3){return _0x295eee[_0xcf6d('0x9')](_0xcf6d('0xa'),attributes,{'tableName':_0xcf6d('0xb'),'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 ca5cb63..2041da4 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 _0x627a=['error','code','message','result','SmsQueue','findAll','options','raw','where','attributes','include','model','map','GetSmsQueue','catch','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0x627a,0x1df));var _0xa627=function(_0x355ea3,_0x3a9f08){_0x355ea3=_0x355ea3-0x0;var _0x25aba6=_0x627a[_0x355ea3];return _0x25aba6;};'use strict';var _=require(_0xa627('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa627('0x1'));var rs=require(_0xa627('0x2'));var fs=require('fs');var Redis=require(_0xa627('0x3'));var db=require(_0xa627('0x4'))['db'];var utils=require(_0xa627('0x5'));var logger=require(_0xa627('0x6'))(_0xa627('0x7'));var config=require(_0xa627('0x8'));var jayson=require(_0xa627('0x9'));var client=jayson[_0xa627('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa627('0xb')](config[_0xa627('0xc')],{'host':_0xa627('0xd'),'port':0x18eb});var socket=require(_0xa627('0xe'))(new Redis(config[_0xa627('0xc')]));require(_0xa627('0xf'))[_0xa627('0x10')](socket);function respondWithRpcPromise(_0x3eee5c,_0x55875f,_0x1c5c76){return new BPromise(function(_0x8f5fbb,_0x2af8b3){return client[_0xa627('0x11')](_0x3eee5c,_0x1c5c76)[_0xa627('0x12')](function(_0x27f156){logger[_0xa627('0x13')](_0xa627('0x14'),_0x55875f,_0xa627('0x15'));logger[_0xa627('0x16')](_0xa627('0x17'),_0x55875f,_0xa627('0x15'),JSON[_0xa627('0x18')](_0x27f156));if(_0x27f156[_0xa627('0x19')]){if(_0x27f156[_0xa627('0x19')][_0xa627('0x1a')]===0x1f4){logger[_0xa627('0x19')](_0xa627('0x14'),_0x55875f,_0x27f156['error'][_0xa627('0x1b')]);return _0x2af8b3(_0x27f156['error']['message']);}logger[_0xa627('0x19')]('SmsQueue,\x20%s,\x20%s',_0x55875f,_0x27f156[_0xa627('0x19')][_0xa627('0x1b')]);return _0x8f5fbb(_0x27f156[_0xa627('0x19')][_0xa627('0x1b')]);}else{logger['info'](_0xa627('0x14'),_0x55875f,_0xa627('0x15'));_0x8f5fbb(_0x27f156[_0xa627('0x1c')][_0xa627('0x1b')]);}})['catch'](function(_0x5ccf63){logger[_0xa627('0x19')](_0xa627('0x14'),_0x55875f,_0x5ccf63);_0x2af8b3(_0x5ccf63);});});}exports['GetSmsQueue']=function(_0x387506){var _0x178613=this;return new Promise(function(_0x52345c,_0x5c1ed4){return db[_0xa627('0x1d')][_0xa627('0x1e')]({'raw':_0x387506[_0xa627('0x1f')]?_0x387506[_0xa627('0x1f')][_0xa627('0x20')]===undefined?!![]:![]:!![],'where':_0x387506['options']?_0x387506[_0xa627('0x1f')][_0xa627('0x21')]||null:null,'attributes':_0x387506[_0xa627('0x1f')]?_0x387506['options'][_0xa627('0x22')]||null:null,'limit':_0x387506[_0xa627('0x1f')]?_0x387506['options']['limit']||null:null,'include':_0x387506[_0xa627('0x1f')]?_0x387506[_0xa627('0x1f')][_0xa627('0x23')]?_['map'](_0x387506[_0xa627('0x1f')][_0xa627('0x23')],function(_0xd4cc75){return{'model':db[_0xd4cc75[_0xa627('0x24')]],'as':_0xd4cc75['as'],'attributes':_0xd4cc75[_0xa627('0x22')],'include':_0xd4cc75[_0xa627('0x23')]?_[_0xa627('0x25')](_0xd4cc75['include'],function(_0x3ed358){return{'model':db[_0x3ed358[_0xa627('0x24')]],'as':_0x3ed358['as'],'attributes':_0x3ed358[_0xa627('0x22')],'include':_0x3ed358[_0xa627('0x23')]?_[_0xa627('0x25')](_0x3ed358['include'],function(_0x18f181){return{'model':db[_0x18f181[_0xa627('0x24')]],'as':_0x18f181['as'],'attributes':_0x18f181[_0xa627('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa627('0x12')](function(_0x147b4b){logger['info'](_0xa627('0x26'),_0x387506);logger[_0xa627('0x16')](_0xa627('0x26'),_0x387506,JSON[_0xa627('0x18')](_0x147b4b));_0x52345c(_0x147b4b);})[_0xa627('0x27')](function(_0x12569e){logger['error'](_0xa627('0x26'),_0x12569e[_0xa627('0x1b')],_0x387506);_0x5c1ed4(_0x178613[_0xa627('0x19')](0x1f4,_0x12569e[_0xa627('0x1b')]));});});};exports[_0xa627('0x28')]=function(_0x424fba){var _0x5dbc1b=this;return new Promise(function(_0x1ca1bd,_0x130af6){return db['SmsQueue'][_0xa627('0x29')]({'raw':_0x424fba['options']?_0x424fba[_0xa627('0x1f')][_0xa627('0x20')]===undefined?!![]:![]:!![],'where':_0x424fba[_0xa627('0x1f')]?_0x424fba[_0xa627('0x1f')]['where']||null:null,'attributes':_0x424fba[_0xa627('0x1f')]?_0x424fba[_0xa627('0x1f')]['attributes']||null:null,'include':_0x424fba[_0xa627('0x1f')]?_0x424fba[_0xa627('0x1f')][_0xa627('0x23')]?_[_0xa627('0x25')](_0x424fba[_0xa627('0x1f')][_0xa627('0x23')],function(_0x23e4af){return{'model':db[_0x23e4af[_0xa627('0x24')]],'as':_0x23e4af['as'],'attributes':_0x23e4af['attributes'],'include':_0x23e4af[_0xa627('0x23')]?_[_0xa627('0x25')](_0x23e4af['include'],function(_0x314487){return{'model':db[_0x314487[_0xa627('0x24')]],'as':_0x314487['as'],'attributes':_0x314487[_0xa627('0x22')],'include':_0x314487[_0xa627('0x23')]?_['map'](_0x314487[_0xa627('0x23')],function(_0x13c7fd){return{'model':db[_0x13c7fd[_0xa627('0x24')]],'as':_0x13c7fd['as'],'attributes':_0x13c7fd['attributes']};}):[]};}):[]};}):[]:[]})[_0xa627('0x12')](function(_0x5c0e6e){logger['info'](_0xa627('0x28'),_0x424fba);logger[_0xa627('0x16')](_0xa627('0x28'),_0x424fba,JSON[_0xa627('0x18')](_0x5c0e6e));_0x1ca1bd(_0x5c0e6e);})[_0xa627('0x27')](function(_0x3f2e2d){logger[_0xa627('0x19')](_0xa627('0x28'),_0x3f2e2d['message'],_0x424fba);_0x130af6(_0x5dbc1b[_0xa627('0x19')](0x1f4,_0x3f2e2d[_0xa627('0x1b')]));});});}; \ No newline at end of file +var _0xe80e=['message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','debug','raw','ShowSmsQueue','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xf3bfef,_0x235dcc){var _0xcf3dc0=function(_0x337f94){while(--_0x337f94){_0xf3bfef['push'](_0xf3bfef['shift']());}};_0xcf3dc0(++_0x235dcc);}(_0xe80e,0x11a));var _0xee80=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe80e[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0xee80('0x0'));var util=require('util');var moment=require(_0xee80('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee80('0x2'));var db=require(_0xee80('0x3'))['db'];var utils=require(_0xee80('0x4'));var logger=require(_0xee80('0x5'))(_0xee80('0x6'));var config=require(_0xee80('0x7'));var jayson=require(_0xee80('0x8'));var client=jayson[_0xee80('0x9')][_0xee80('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xee80('0xb')],{'host':_0xee80('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee80('0xb')]));require(_0xee80('0xd'))['register'](socket);function respondWithRpcPromise(_0x4e44fe,_0x18ca64,_0x202a2e){return new BPromise(function(_0x44f426,_0x2573d6){return client[_0xee80('0xe')](_0x4e44fe,_0x202a2e)[_0xee80('0xf')](function(_0x5b68a8){logger[_0xee80('0x10')](_0xee80('0x11'),_0x18ca64,_0xee80('0x12'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x18ca64,_0xee80('0x12'),JSON[_0xee80('0x13')](_0x5b68a8));if(_0x5b68a8[_0xee80('0x14')]){if(_0x5b68a8[_0xee80('0x14')][_0xee80('0x15')]===0x1f4){logger[_0xee80('0x14')]('SmsQueue,\x20%s,\x20%s',_0x18ca64,_0x5b68a8[_0xee80('0x14')][_0xee80('0x16')]);return _0x2573d6(_0x5b68a8[_0xee80('0x14')][_0xee80('0x16')]);}logger[_0xee80('0x14')]('SmsQueue,\x20%s,\x20%s',_0x18ca64,_0x5b68a8[_0xee80('0x14')][_0xee80('0x16')]);return _0x44f426(_0x5b68a8[_0xee80('0x14')][_0xee80('0x16')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x18ca64,_0xee80('0x12'));_0x44f426(_0x5b68a8[_0xee80('0x17')]['message']);}})[_0xee80('0x18')](function(_0x1e7798){logger['error'](_0xee80('0x11'),_0x18ca64,_0x1e7798);_0x2573d6(_0x1e7798);});});}exports[_0xee80('0x19')]=function(_0x505336){var _0xbe2e49=this;return new Promise(function(_0x2449a3,_0x2d6de8){return db[_0xee80('0x1a')][_0xee80('0x1b')]({'raw':_0x505336['options']?_0x505336[_0xee80('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x505336[_0xee80('0x1c')]?_0x505336['options'][_0xee80('0x1d')]||null:null,'attributes':_0x505336['options']?_0x505336[_0xee80('0x1c')][_0xee80('0x1e')]||null:null,'limit':_0x505336[_0xee80('0x1c')]?_0x505336['options'][_0xee80('0x1f')]||null:null,'include':_0x505336[_0xee80('0x1c')]?_0x505336[_0xee80('0x1c')][_0xee80('0x20')]?_[_0xee80('0x21')](_0x505336['options'][_0xee80('0x20')],function(_0x2306b4){return{'model':db[_0x2306b4['model']],'as':_0x2306b4['as'],'attributes':_0x2306b4['attributes'],'include':_0x2306b4['include']?_['map'](_0x2306b4[_0xee80('0x20')],function(_0x339555){return{'model':db[_0x339555[_0xee80('0x22')]],'as':_0x339555['as'],'attributes':_0x339555['attributes'],'include':_0x339555[_0xee80('0x20')]?_[_0xee80('0x21')](_0x339555[_0xee80('0x20')],function(_0x166731){return{'model':db[_0x166731[_0xee80('0x22')]],'as':_0x166731['as'],'attributes':_0x166731[_0xee80('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xee80('0xf')](function(_0x13264b){logger[_0xee80('0x10')](_0xee80('0x19'),_0x505336);logger[_0xee80('0x23')](_0xee80('0x19'),_0x505336,JSON[_0xee80('0x13')](_0x13264b));_0x2449a3(_0x13264b);})[_0xee80('0x18')](function(_0x56576d){logger['error'](_0xee80('0x19'),_0x56576d['message'],_0x505336);_0x2d6de8(_0xbe2e49[_0xee80('0x14')](0x1f4,_0x56576d[_0xee80('0x16')]));});});};exports['ShowSmsQueue']=function(_0x2d2b7f){var _0x4a16c9=this;return new Promise(function(_0x34d5a6,_0x47d013){return db[_0xee80('0x1a')]['find']({'raw':_0x2d2b7f['options']?_0x2d2b7f[_0xee80('0x1c')][_0xee80('0x24')]===undefined?!![]:![]:!![],'where':_0x2d2b7f[_0xee80('0x1c')]?_0x2d2b7f[_0xee80('0x1c')][_0xee80('0x1d')]||null:null,'attributes':_0x2d2b7f[_0xee80('0x1c')]?_0x2d2b7f[_0xee80('0x1c')]['attributes']||null:null,'include':_0x2d2b7f[_0xee80('0x1c')]?_0x2d2b7f[_0xee80('0x1c')][_0xee80('0x20')]?_['map'](_0x2d2b7f[_0xee80('0x1c')][_0xee80('0x20')],function(_0x5801fe){return{'model':db[_0x5801fe[_0xee80('0x22')]],'as':_0x5801fe['as'],'attributes':_0x5801fe[_0xee80('0x1e')],'include':_0x5801fe[_0xee80('0x20')]?_['map'](_0x5801fe[_0xee80('0x20')],function(_0x2c9661){return{'model':db[_0x2c9661['model']],'as':_0x2c9661['as'],'attributes':_0x2c9661[_0xee80('0x1e')],'include':_0x2c9661[_0xee80('0x20')]?_[_0xee80('0x21')](_0x2c9661[_0xee80('0x20')],function(_0x21c216){return{'model':db[_0x21c216[_0xee80('0x22')]],'as':_0x21c216['as'],'attributes':_0x21c216[_0xee80('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ab86b){logger[_0xee80('0x10')]('ShowSmsQueue',_0x2d2b7f);logger[_0xee80('0x23')](_0xee80('0x25'),_0x2d2b7f,JSON[_0xee80('0x13')](_0x4ab86b));_0x34d5a6(_0x4ab86b);})['catch'](function(_0x5095c0){logger[_0xee80('0x14')]('ShowSmsQueue',_0x5095c0[_0xee80('0x16')],_0x2d2b7f);_0x47d013(_0x4a16c9['error'](0x1f4,_0x5095c0[_0xee80('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ac1eabe..c42acdb 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 _0x86fc=['update','emit','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x86fc,0x9d));var _0xc86f=function(_0x53f531,_0x202e60){_0x53f531=_0x53f531-0x0;var _0x312f00=_0x86fc[_0x53f531];return _0x312f00;};'use strict';var SmsQueueEvents=require(_0xc86f('0x0'));var events=[_0xc86f('0x1'),_0xc86f('0x2'),_0xc86f('0x3')];function createListener(_0x3be02e,_0x1a62e2){return function(_0x19e781){_0x1a62e2[_0xc86f('0x4')](_0x3be02e,_0x19e781);};}function removeListener(_0x42dcce,_0x119323){return function(){SmsQueueEvents['removeListener'](_0x42dcce,_0x119323);};}exports[_0xc86f('0x5')]=function(_0x409fe1){for(var _0x267fde=0x0,_0x3848c1=events[_0xc86f('0x6')];_0x267fde<_0x3848c1;_0x267fde++){var _0x1c6810=events[_0x267fde];var _0x274b55=createListener(_0xc86f('0x7')+_0x1c6810,_0x409fe1);SmsQueueEvents['on'](_0x1c6810,_0x274b55);}}; \ No newline at end of file +var _0x709b=['smsQueue:','./smsQueue.events','save','remove','emit','removeListener'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0x709b,0x1e1));var _0xb709=function(_0x359a7f,_0x5e2d4b){_0x359a7f=_0x359a7f-0x0;var _0x3ac9dd=_0x709b[_0x359a7f];return _0x3ac9dd;};'use strict';var SmsQueueEvents=require(_0xb709('0x0'));var events=[_0xb709('0x1'),_0xb709('0x2'),'update'];function createListener(_0x1c09e4,_0x185fcb){return function(_0x1915e6){_0x185fcb[_0xb709('0x3')](_0x1c09e4,_0x1915e6);};}function removeListener(_0x4873c5,_0x68a890){return function(){SmsQueueEvents[_0xb709('0x4')](_0x4873c5,_0x68a890);};}exports['register']=function(_0x31e0a4){for(var _0x3b14a1=0x0,_0x260275=events['length'];_0x3b14a1<_0x260275;_0x3b14a1++){var _0x3ce5c4=events[_0x3b14a1];var _0x2df03e=createListener(_0xb709('0x5')+_0x3ce5c4,_0x31e0a4);SmsQueueEvents['on'](_0x3ce5c4,_0x2df03e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 258089d..9bfdc32 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 _0x180d=['./smsQueueReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0x180d,0x19c));var _0xd180=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x180d[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xd180('0x0'));var util=require(_0xd180('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd180('0x2'));var router=express[_0xd180('0x3')]();var fs_extra=require(_0xd180('0x4'));var auth=require(_0xd180('0x5'));var interaction=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var controller=require(_0xd180('0x8'));router['get']('/',auth[_0xd180('0x9')](),controller[_0xd180('0xa')]);router[_0xd180('0xb')]('/describe',auth[_0xd180('0x9')](),controller[_0xd180('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd180('0xd')]);router[_0xd180('0xe')]('/',auth[_0xd180('0x9')](),controller[_0xd180('0xf')]);router[_0xd180('0x10')](_0xd180('0x11'),auth[_0xd180('0x9')](),controller[_0xd180('0x12')]);router[_0xd180('0x13')](_0xd180('0x11'),auth[_0xd180('0x9')](),controller['destroy']);module[_0xd180('0x14')]=router; \ No newline at end of file +var _0xcf7a=['create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x46b992,_0x2457c8){var _0x3d4a35=function(_0x22d5d9){while(--_0x22d5d9){_0x46b992['push'](_0x46b992['shift']());}};_0x3d4a35(++_0x2457c8);}(_0xcf7a,0x159));var _0xacf7=function(_0x2abf32,_0x5e2908){_0x2abf32=_0x2abf32-0x0;var _0x20228b=_0xcf7a[_0x2abf32];return _0x20228b;};'use strict';var multer=require(_0xacf7('0x0'));var util=require(_0xacf7('0x1'));var path=require(_0xacf7('0x2'));var timeout=require('connect-timeout');var express=require(_0xacf7('0x3'));var router=express[_0xacf7('0x4')]();var fs_extra=require(_0xacf7('0x5'));var auth=require(_0xacf7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xacf7('0x7'));var controller=require(_0xacf7('0x8'));router['get']('/',auth[_0xacf7('0x9')](),controller[_0xacf7('0xa')]);router[_0xacf7('0xb')]('/describe',auth[_0xacf7('0x9')](),controller['describe']);router['get'](_0xacf7('0xc'),auth[_0xacf7('0x9')](),controller[_0xacf7('0xd')]);router[_0xacf7('0xe')]('/',auth['isAuthenticated'](),controller[_0xacf7('0xf')]);router[_0xacf7('0x10')]('/:id',auth[_0xacf7('0x9')](),controller[_0xacf7('0x11')]);router[_0xacf7('0x12')](_0xacf7('0xc'),auth['isAuthenticated'](),controller[_0xacf7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6bebf3e..8f016aa 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 _0x8218=['sequelize','exports','STRING','DATE','moment'];(function(_0x12d38e,_0x4db2db){var _0x379569=function(_0x359b84){while(--_0x359b84){_0x12d38e['push'](_0x12d38e['shift']());}};_0x379569(++_0x4db2db);}(_0x8218,0xb3));var _0x8821=function(_0x41fa87,_0x119133){_0x41fa87=_0x41fa87-0x0;var _0x2f4ad1=_0x8218[_0x41fa87];return _0x2f4ad1;};'use strict';var moment=require(_0x8821('0x0'));var Sequelize=require(_0x8821('0x1'));module[_0x8821('0x2')]={'uniqueid':{'type':Sequelize[_0x8821('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8821('0x4')]},'reason':{'type':Sequelize[_0x8821('0x3')]}}; \ No newline at end of file +var _0x8b3d=['DATE','moment','sequelize','exports','STRING'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8b3d,0x1af));var _0xd8b3=function(_0x3bf688,_0x53e860){_0x3bf688=_0x3bf688-0x0;var _0x1ce532=_0x8b3d[_0x3bf688];return _0x1ce532;};'use strict';var moment=require(_0xd8b3('0x0'));var Sequelize=require(_0xd8b3('0x1'));module[_0xd8b3('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd8b3('0x3')]},'joinAt':{'type':Sequelize[_0xd8b3('0x4')]},'leaveAt':{'type':Sequelize[_0xd8b3('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd8b3('0x4')]},'reason':{'type':Sequelize[_0xd8b3('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d0ca404..f4a2d0a 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 _0x5b3a=['path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','update','destroy','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','then','SmsQueueReport','findAll','rows','show','includeAll','include','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4c5af1,_0x2436de){var _0x4e3c6e=function(_0x446aba){while(--_0x446aba){_0x4c5af1['push'](_0x4c5af1['shift']());}};_0x4e3c6e(++_0x2436de);}(_0x5b3a,0x164));var _0xa5b3=function(_0x73a211,_0xbc1dd8){_0x73a211=_0x73a211-0x0;var _0xf6602a=_0x5b3a[_0x73a211];return _0xf6602a;};'use strict';var emlformat=require(_0xa5b3('0x0'));var rimraf=require(_0xa5b3('0x1'));var zipdir=require(_0xa5b3('0x2'));var jsonpatch=require(_0xa5b3('0x3'));var rp=require(_0xa5b3('0x4'));var moment=require(_0xa5b3('0x5'));var BPromise=require(_0xa5b3('0x6'));var Mustache=require(_0xa5b3('0x7'));var util=require(_0xa5b3('0x8'));var path=require(_0xa5b3('0x9'));var sox=require(_0xa5b3('0xa'));var csv=require(_0xa5b3('0xb'));var ejs=require(_0xa5b3('0xc'));var fs=require('fs');var fs_extra=require(_0xa5b3('0xd'));var _=require('lodash');var squel=require(_0xa5b3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5b3('0xf'));var toCsv=require(_0xa5b3('0xb'));var querystring=require('querystring');var Papa=require(_0xa5b3('0x10'));var Redis=require(_0xa5b3('0x11'));var authService=require(_0xa5b3('0x12'));var qs=require(_0xa5b3('0x13'));var as=require(_0xa5b3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5b3('0x15'))(_0xa5b3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa5b3('0x17'));var db=require(_0xa5b3('0x18'))['db'];function respondWithStatusCode(_0x46be47,_0x3f5579){_0x3f5579=_0x3f5579||0xcc;return function(_0x51681f){if(_0x51681f){return _0x46be47[_0xa5b3('0x19')](_0x3f5579);}return _0x46be47[_0xa5b3('0x1a')](_0x3f5579)[_0xa5b3('0x1b')]();};}function respondWithResult(_0x454e4d,_0x555034){_0x555034=_0x555034||0xc8;return function(_0x2ccd8a){if(_0x2ccd8a){return _0x454e4d['status'](_0x555034)['json'](_0x2ccd8a);}};}function respondWithFilteredResult(_0x32c92f,_0x1a3cf6){return function(_0x8d332e){if(_0x8d332e){var _0x1b802d=typeof _0x1a3cf6[_0xa5b3('0x1c')]===_0xa5b3('0x1d')&&typeof _0x1a3cf6['limit']===_0xa5b3('0x1d');var _0x58a817=_0x8d332e[_0xa5b3('0x1e')];var _0x1fe609=_0x1b802d?0x0:_0x1a3cf6[_0xa5b3('0x1c')];var _0x4101f8=_0x1b802d?_0x8d332e[_0xa5b3('0x1e')]:_0x1a3cf6['offset']+_0x1a3cf6[_0xa5b3('0x1f')];var _0x25e219;if(_0x4101f8>=_0x58a817){_0x4101f8=_0x58a817;_0x25e219=0xc8;}else{_0x25e219=0xce;}_0x32c92f[_0xa5b3('0x1a')](_0x25e219);return _0x32c92f['set'](_0xa5b3('0x20'),_0x1fe609+'-'+_0x4101f8+'/'+_0x58a817)[_0xa5b3('0x21')](_0x8d332e);}return null;};}function patchUpdates(_0x597284){return function(_0x41226e){try{jsonpatch[_0xa5b3('0x22')](_0x41226e,_0x597284,!![]);}catch(_0x88a720){return BPromise['reject'](_0x88a720);}return _0x41226e['save']();};}function saveUpdates(_0x57aa08,_0x402178){return function(_0xacda5){if(_0xacda5){return _0xacda5[_0xa5b3('0x23')](_0x57aa08)['then'](function(_0x3cf252){return _0x3cf252;});}return null;};}function removeEntity(_0x1c60e7,_0x338142){return function(_0x2cbab8){if(_0x2cbab8){return _0x2cbab8[_0xa5b3('0x24')]()['then'](function(){_0x1c60e7[_0xa5b3('0x1a')](0xcc)[_0xa5b3('0x1b')]();});}};}function handleEntityNotFound(_0x58588a,_0x278ec2){return function(_0x40f355){if(!_0x40f355){_0x58588a[_0xa5b3('0x19')](0x194);}return _0x40f355;};}function handleError(_0x3a8c0b,_0x72382b){_0x72382b=_0x72382b||0x1f4;return function(_0x4ea0bb){logger[_0xa5b3('0x25')](_0x4ea0bb['stack']);if(_0x4ea0bb[_0xa5b3('0x26')]){delete _0x4ea0bb['name'];}_0x3a8c0b[_0xa5b3('0x1a')](_0x72382b)[_0xa5b3('0x27')](_0x4ea0bb);};}exports['index']=function(_0x126481,_0x2660f4){var _0x11b602={},_0x31789={},_0x594886={'count':0x0,'rows':[]};var _0x365f03=_['map'](db['SmsQueueReport'][_0xa5b3('0x28')],function(_0x2d25ea){return{'name':_0x2d25ea[_0xa5b3('0x29')],'type':_0x2d25ea[_0xa5b3('0x2a')][_0xa5b3('0x2b')]};});_0x31789[_0xa5b3('0x2c')]=_[_0xa5b3('0x2d')](_0x365f03,'name');_0x31789[_0xa5b3('0x2e')]=_[_0xa5b3('0x2f')](_0x126481['query']);_0x31789['filters']=_[_0xa5b3('0x30')](_0x31789[_0xa5b3('0x2c')],_0x31789[_0xa5b3('0x2e')]);_0x11b602[_0xa5b3('0x31')]=_[_0xa5b3('0x30')](_0x31789[_0xa5b3('0x2c')],qs['fields'](_0x126481[_0xa5b3('0x2e')]['fields']));_0x11b602[_0xa5b3('0x31')]=_0x11b602[_0xa5b3('0x31')][_0xa5b3('0x32')]?_0x11b602[_0xa5b3('0x31')]:_0x31789['model'];if(!_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x33')]('nolimit')){_0x11b602[_0xa5b3('0x1f')]=qs[_0xa5b3('0x1f')](_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x1f')]);_0x11b602[_0xa5b3('0x1c')]=qs[_0xa5b3('0x1c')](_0x126481['query'][_0xa5b3('0x1c')]);}_0x11b602[_0xa5b3('0x34')]=qs[_0xa5b3('0x35')](_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x35')]);_0x11b602[_0xa5b3('0x36')]=qs[_0xa5b3('0x37')](_[_0xa5b3('0x38')](_0x126481[_0xa5b3('0x2e')],_0x31789['filters']),_0x365f03);if(_0x126481[_0xa5b3('0x2e')][_0xa5b3('0x39')]){_0x11b602[_0xa5b3('0x36')]=_['merge'](_0x11b602['where'],{'$or':_[_0xa5b3('0x2d')](_0x365f03,function(_0x52b1dd){if(_0x52b1dd['type']!==_0xa5b3('0x3a')){var _0x302d26={};_0x302d26[_0x52b1dd[_0xa5b3('0x26')]]={'$like':'%'+_0x126481[_0xa5b3('0x2e')]['filter']+'%'};return _0x302d26;}})});}_0x11b602=_['merge']({},_0x11b602,_0x126481['options']);var _0x2e5465={'where':_0x11b602[_0xa5b3('0x36')]};return db['SmsQueueReport'][_0xa5b3('0x1e')](_0x2e5465)[_0xa5b3('0x3b')](function(_0x3fa1da){_0x594886['count']=_0x3fa1da;if(_0x126481['query']['includeAll']){_0x11b602['include']=[{'all':!![]}];}return db[_0xa5b3('0x3c')][_0xa5b3('0x3d')](_0x11b602);})[_0xa5b3('0x3b')](function(_0xc41040){_0x594886[_0xa5b3('0x3e')]=_0xc41040;return _0x594886;})['then'](respondWithFilteredResult(_0x2660f4,_0x11b602))['catch'](handleError(_0x2660f4,null));};exports[_0xa5b3('0x3f')]=function(_0x4f1417,_0x4369df){var _0x5be12f={'raw':!![],'where':{'id':_0x4f1417['params']['id']}},_0x4aa771={};_0x4aa771['model']=_[_0xa5b3('0x2f')](db['SmsQueueReport'][_0xa5b3('0x28')]);_0x4aa771[_0xa5b3('0x2e')]=_['keys'](_0x4f1417[_0xa5b3('0x2e')]);_0x4aa771[_0xa5b3('0x37')]=_['intersection'](_0x4aa771['model'],_0x4aa771[_0xa5b3('0x2e')]);_0x5be12f[_0xa5b3('0x31')]=_[_0xa5b3('0x30')](_0x4aa771[_0xa5b3('0x2c')],qs['fields'](_0x4f1417['query']['fields']));_0x5be12f['attributes']=_0x5be12f['attributes'][_0xa5b3('0x32')]?_0x5be12f['attributes']:_0x4aa771[_0xa5b3('0x2c')];if(_0x4f1417[_0xa5b3('0x2e')][_0xa5b3('0x40')]){_0x5be12f[_0xa5b3('0x41')]=[{'all':!![]}];}_0x5be12f=_['merge']({},_0x5be12f,_0x4f1417[_0xa5b3('0x42')]);return db[_0xa5b3('0x3c')][_0xa5b3('0x43')](_0x5be12f)[_0xa5b3('0x3b')](handleEntityNotFound(_0x4369df,null))['then'](respondWithResult(_0x4369df,null))[_0xa5b3('0x44')](handleError(_0x4369df,null));};exports[_0xa5b3('0x45')]=function(_0x18434e,_0x15254e){return db[_0xa5b3('0x3c')]['create'](_0x18434e[_0xa5b3('0x46')],{})['then'](respondWithResult(_0x15254e,0xc9))['catch'](handleError(_0x15254e,null));};exports[_0xa5b3('0x23')]=function(_0x139008,_0x4ecc59){if(_0x139008[_0xa5b3('0x46')]['id']){delete _0x139008[_0xa5b3('0x46')]['id'];}return db[_0xa5b3('0x3c')][_0xa5b3('0x43')]({'where':{'id':_0x139008[_0xa5b3('0x47')]['id']}})[_0xa5b3('0x3b')](handleEntityNotFound(_0x4ecc59,null))[_0xa5b3('0x3b')](saveUpdates(_0x139008[_0xa5b3('0x46')],null))[_0xa5b3('0x3b')](respondWithResult(_0x4ecc59,null))[_0xa5b3('0x44')](handleError(_0x4ecc59,null));};exports['destroy']=function(_0x2e7ef8,_0x569d66){return db[_0xa5b3('0x3c')]['find']({'where':{'id':_0x2e7ef8[_0xa5b3('0x47')]['id']}})[_0xa5b3('0x3b')](handleEntityNotFound(_0x569d66,null))[_0xa5b3('0x3b')](removeEntity(_0x569d66,null))['catch'](handleError(_0x569d66,null));};exports[_0xa5b3('0x48')]=function(_0x2a6822,_0x471df3){return db[_0xa5b3('0x3c')]['describe']()['then'](respondWithResult(_0x471df3,null))['catch'](handleError(_0x471df3,null));}; \ No newline at end of file +var _0x801d=['send','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','catch','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','save','update','then','error','stack','name'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x801d,0x18f));var _0xd801=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x801d[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0xd801('0x0'));var rimraf=require(_0xd801('0x1'));var zipdir=require(_0xd801('0x2'));var jsonpatch=require(_0xd801('0x3'));var rp=require('request-promise');var moment=require(_0xd801('0x4'));var BPromise=require(_0xd801('0x5'));var Mustache=require(_0xd801('0x6'));var util=require('util');var path=require(_0xd801('0x7'));var sox=require('sox');var csv=require(_0xd801('0x8'));var ejs=require(_0xd801('0x9'));var fs=require('fs');var fs_extra=require(_0xd801('0xa'));var _=require(_0xd801('0xb'));var squel=require(_0xd801('0xc'));var crypto=require(_0xd801('0xd'));var jsforce=require(_0xd801('0xe'));var deskjs=require(_0xd801('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd801('0x10'));var Papa=require(_0xd801('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd801('0x12'));var as=require(_0xd801('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd801('0x14'))(_0xd801('0x15'));var utils=require(_0xd801('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd801('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x563dd8,_0x15032d){_0x15032d=_0x15032d||0xcc;return function(_0x48a5cb){if(_0x48a5cb){return _0x563dd8[_0xd801('0x18')](_0x15032d);}return _0x563dd8['status'](_0x15032d)[_0xd801('0x19')]();};}function respondWithResult(_0x1519d9,_0x39435a){_0x39435a=_0x39435a||0xc8;return function(_0x42007e){if(_0x42007e){return _0x1519d9[_0xd801('0x1a')](_0x39435a)['json'](_0x42007e);}};}function respondWithFilteredResult(_0x1c35f6,_0x4b1815){return function(_0x5ef53b){if(_0x5ef53b){var _0x456f51=typeof _0x4b1815[_0xd801('0x1b')]===_0xd801('0x1c')&&typeof _0x4b1815[_0xd801('0x1d')]===_0xd801('0x1c');var _0x3b0354=_0x5ef53b['count'];var _0x54d3f1=_0x456f51?0x0:_0x4b1815['offset'];var _0x4bcb72=_0x456f51?_0x5ef53b['count']:_0x4b1815['offset']+_0x4b1815[_0xd801('0x1d')];var _0x16ddb4;if(_0x4bcb72>=_0x3b0354){_0x4bcb72=_0x3b0354;_0x16ddb4=0xc8;}else{_0x16ddb4=0xce;}_0x1c35f6[_0xd801('0x1a')](_0x16ddb4);return _0x1c35f6[_0xd801('0x1e')](_0xd801('0x1f'),_0x54d3f1+'-'+_0x4bcb72+'/'+_0x3b0354)[_0xd801('0x20')](_0x5ef53b);}return null;};}function patchUpdates(_0x47c6a1){return function(_0x1ce8ba){try{jsonpatch['apply'](_0x1ce8ba,_0x47c6a1,!![]);}catch(_0x56ec07){return BPromise['reject'](_0x56ec07);}return _0x1ce8ba[_0xd801('0x21')]();};}function saveUpdates(_0x1fb3d3,_0xfd88cb){return function(_0x462841){if(_0x462841){return _0x462841[_0xd801('0x22')](_0x1fb3d3)[_0xd801('0x23')](function(_0x53d53f){return _0x53d53f;});}return null;};}function removeEntity(_0xce91f9,_0x23adec){return function(_0x4bc9f6){if(_0x4bc9f6){return _0x4bc9f6['destroy']()[_0xd801('0x23')](function(){_0xce91f9[_0xd801('0x1a')](0xcc)[_0xd801('0x19')]();});}};}function handleEntityNotFound(_0xccfe08,_0x55990d){return function(_0x58a57c){if(!_0x58a57c){_0xccfe08[_0xd801('0x18')](0x194);}return _0x58a57c;};}function handleError(_0x5b7850,_0x31c32e){_0x31c32e=_0x31c32e||0x1f4;return function(_0x191d3b){logger[_0xd801('0x24')](_0x191d3b[_0xd801('0x25')]);if(_0x191d3b[_0xd801('0x26')]){delete _0x191d3b['name'];}_0x5b7850['status'](_0x31c32e)[_0xd801('0x27')](_0x191d3b);};}exports['index']=function(_0x5859fd,_0x1e7d40){var _0xa25c3c={},_0x177ddc={},_0x1d2a45={'count':0x0,'rows':[]};var _0x182aee=_[_0xd801('0x28')](db[_0xd801('0x29')][_0xd801('0x2a')],function(_0x1a0769){return{'name':_0x1a0769['fieldName'],'type':_0x1a0769[_0xd801('0x2b')][_0xd801('0x2c')]};});_0x177ddc[_0xd801('0x2d')]=_[_0xd801('0x28')](_0x182aee,_0xd801('0x26'));_0x177ddc[_0xd801('0x2e')]=_[_0xd801('0x2f')](_0x5859fd['query']);_0x177ddc[_0xd801('0x30')]=_[_0xd801('0x31')](_0x177ddc[_0xd801('0x2d')],_0x177ddc['query']);_0xa25c3c['attributes']=_[_0xd801('0x31')](_0x177ddc[_0xd801('0x2d')],qs[_0xd801('0x32')](_0x5859fd[_0xd801('0x2e')]['fields']));_0xa25c3c[_0xd801('0x33')]=_0xa25c3c['attributes']['length']?_0xa25c3c['attributes']:_0x177ddc['model'];if(!_0x5859fd[_0xd801('0x2e')][_0xd801('0x34')](_0xd801('0x35'))){_0xa25c3c[_0xd801('0x1d')]=qs[_0xd801('0x1d')](_0x5859fd[_0xd801('0x2e')]['limit']);_0xa25c3c[_0xd801('0x1b')]=qs['offset'](_0x5859fd[_0xd801('0x2e')]['offset']);}_0xa25c3c[_0xd801('0x36')]=qs['sort'](_0x5859fd[_0xd801('0x2e')]['sort']);_0xa25c3c['where']=qs[_0xd801('0x30')](_['pick'](_0x5859fd[_0xd801('0x2e')],_0x177ddc[_0xd801('0x30')]),_0x182aee);if(_0x5859fd[_0xd801('0x2e')][_0xd801('0x37')]){_0xa25c3c[_0xd801('0x38')]=_[_0xd801('0x39')](_0xa25c3c[_0xd801('0x38')],{'$or':_[_0xd801('0x28')](_0x182aee,function(_0xe9d130){if(_0xe9d130[_0xd801('0x2b')]!==_0xd801('0x3a')){var _0x42f7bd={};_0x42f7bd[_0xe9d130[_0xd801('0x26')]]={'$like':'%'+_0x5859fd['query']['filter']+'%'};return _0x42f7bd;}})});}_0xa25c3c=_[_0xd801('0x39')]({},_0xa25c3c,_0x5859fd[_0xd801('0x3b')]);var _0x408fb6={'where':_0xa25c3c['where']};return db['SmsQueueReport']['count'](_0x408fb6)[_0xd801('0x23')](function(_0x488395){_0x1d2a45['count']=_0x488395;if(_0x5859fd[_0xd801('0x2e')][_0xd801('0x3c')]){_0xa25c3c[_0xd801('0x3d')]=[{'all':!![]}];}return db[_0xd801('0x29')][_0xd801('0x3e')](_0xa25c3c);})[_0xd801('0x23')](function(_0x3c5306){_0x1d2a45[_0xd801('0x3f')]=_0x3c5306;return _0x1d2a45;})[_0xd801('0x23')](respondWithFilteredResult(_0x1e7d40,_0xa25c3c))['catch'](handleError(_0x1e7d40,null));};exports[_0xd801('0x40')]=function(_0x265da1,_0xf7c3da){var _0x189a6c={'raw':!![],'where':{'id':_0x265da1['params']['id']}},_0x5b34db={};_0x5b34db[_0xd801('0x2d')]=_[_0xd801('0x2f')](db['SmsQueueReport']['rawAttributes']);_0x5b34db['query']=_[_0xd801('0x2f')](_0x265da1[_0xd801('0x2e')]);_0x5b34db['filters']=_[_0xd801('0x31')](_0x5b34db[_0xd801('0x2d')],_0x5b34db[_0xd801('0x2e')]);_0x189a6c[_0xd801('0x33')]=_[_0xd801('0x31')](_0x5b34db[_0xd801('0x2d')],qs['fields'](_0x265da1[_0xd801('0x2e')][_0xd801('0x32')]));_0x189a6c[_0xd801('0x33')]=_0x189a6c['attributes'][_0xd801('0x41')]?_0x189a6c[_0xd801('0x33')]:_0x5b34db[_0xd801('0x2d')];if(_0x265da1[_0xd801('0x2e')][_0xd801('0x3c')]){_0x189a6c[_0xd801('0x3d')]=[{'all':!![]}];}_0x189a6c=_[_0xd801('0x39')]({},_0x189a6c,_0x265da1[_0xd801('0x3b')]);return db['SmsQueueReport']['find'](_0x189a6c)[_0xd801('0x23')](handleEntityNotFound(_0xf7c3da,null))['then'](respondWithResult(_0xf7c3da,null))[_0xd801('0x42')](handleError(_0xf7c3da,null));};exports[_0xd801('0x43')]=function(_0x538f08,_0x1b9c50){return db[_0xd801('0x29')]['create'](_0x538f08['body'],{})[_0xd801('0x23')](respondWithResult(_0x1b9c50,0xc9))[_0xd801('0x42')](handleError(_0x1b9c50,null));};exports[_0xd801('0x22')]=function(_0x16b1f9,_0x23a358){if(_0x16b1f9[_0xd801('0x44')]['id']){delete _0x16b1f9[_0xd801('0x44')]['id'];}return db['SmsQueueReport'][_0xd801('0x45')]({'where':{'id':_0x16b1f9[_0xd801('0x46')]['id']}})[_0xd801('0x23')](handleEntityNotFound(_0x23a358,null))['then'](saveUpdates(_0x16b1f9[_0xd801('0x44')],null))[_0xd801('0x23')](respondWithResult(_0x23a358,null))['catch'](handleError(_0x23a358,null));};exports[_0xd801('0x47')]=function(_0x307982,_0x709ceb){return db[_0xd801('0x29')]['find']({'where':{'id':_0x307982[_0xd801('0x46')]['id']}})[_0xd801('0x23')](handleEntityNotFound(_0x709ceb,null))[_0xd801('0x23')](removeEntity(_0x709ceb,null))[_0xd801('0x42')](handleError(_0x709ceb,null));};exports[_0xd801('0x48')]=function(_0x24b63a,_0x58aab5){return db['SmsQueueReport'][_0xd801('0x48')]()['then'](respondWithResult(_0x58aab5,null))['catch'](handleError(_0x58aab5,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 934cec7..0859eb0 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x4f260d,_0x19f7d9){var _0x355d2a=function(_0xcacd19){while(--_0xcacd19){_0x4f260d['push'](_0x4f260d['shift']());}};_0x355d2a(++_0x19f7d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x43e7dd,_0x21358e){var _0x37eae5=function(_0x19b78a){while(--_0x19b78a){_0x43e7dd['push'](_0x43e7dd['shift']());}};_0x37eae5(++_0x21358e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 21d37b2..122882c 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 _0x06f5=['error','code','SmsQueueReport,\x20%s,\x20%s','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d0be9,_0x37184c){var _0x1de2c7=function(_0x32b7ea){while(--_0x32b7ea){_0x4d0be9['push'](_0x4d0be9['shift']());}};_0x1de2c7(++_0x37184c);}(_0x06f5,0x93));var _0x506f=function(_0x575cf7,_0x1180cf){_0x575cf7=_0x575cf7-0x0;var _0x2e5e54=_0x06f5[_0x575cf7];return _0x2e5e54;};'use strict';var _=require(_0x506f('0x0'));var util=require('util');var moment=require(_0x506f('0x1'));var BPromise=require('bluebird');var rs=require(_0x506f('0x2'));var fs=require('fs');var Redis=require(_0x506f('0x3'));var db=require(_0x506f('0x4'))['db'];var utils=require(_0x506f('0x5'));var logger=require(_0x506f('0x6'))(_0x506f('0x7'));var config=require(_0x506f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x506f('0x9')][_0x506f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d47e3,_0x38457b,_0x178d4a){return new BPromise(function(_0x1627ce,_0x16f3f7){return client[_0x506f('0xb')](_0x1d47e3,_0x178d4a)[_0x506f('0xc')](function(_0x9e7232){logger[_0x506f('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x38457b,_0x506f('0xe'));logger[_0x506f('0xf')](_0x506f('0x10'),_0x38457b,'request\x20sent',JSON[_0x506f('0x11')](_0x9e7232));if(_0x9e7232[_0x506f('0x12')]){if(_0x9e7232[_0x506f('0x12')][_0x506f('0x13')]===0x1f4){logger[_0x506f('0x12')](_0x506f('0x14'),_0x38457b,_0x9e7232[_0x506f('0x12')][_0x506f('0x15')]);return _0x16f3f7(_0x9e7232[_0x506f('0x12')]['message']);}logger['error'](_0x506f('0x14'),_0x38457b,_0x9e7232['error'][_0x506f('0x15')]);return _0x1627ce(_0x9e7232[_0x506f('0x12')][_0x506f('0x15')]);}else{logger[_0x506f('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x38457b,_0x506f('0xe'));_0x1627ce(_0x9e7232['result'][_0x506f('0x15')]);}})['catch'](function(_0x5b7762){logger['error'](_0x506f('0x14'),_0x38457b,_0x5b7762);_0x16f3f7(_0x5b7762);});});}exports[_0x506f('0x16')]=function(_0x4a16ca){var _0x53122d=this;return new Promise(function(_0x46a348,_0x5503de){return db[_0x506f('0x17')][_0x506f('0x18')](_0x4a16ca[_0x506f('0x19')],{'raw':_0x4a16ca['options']?_0x4a16ca[_0x506f('0x1a')][_0x506f('0x1b')]===undefined?!![]:![]:!![]})[_0x506f('0xc')](function(_0x151421){logger['info']('CreateSmsQueueReport',_0x4a16ca);logger[_0x506f('0xf')](_0x506f('0x16'),_0x4a16ca,JSON[_0x506f('0x11')](_0x151421));_0x46a348(_0x151421);})[_0x506f('0x1c')](function(_0x353340){logger['error'](_0x506f('0x16'),_0x353340[_0x506f('0x15')],_0x4a16ca);_0x5503de(_0x53122d[_0x506f('0x12')](0x1f4,_0x353340[_0x506f('0x15')]));});});};exports[_0x506f('0x1d')]=function(_0x236e79){var _0xc14da1=this;return new Promise(function(_0x122f62,_0x2c23d1){return db[_0x506f('0x17')]['update'](_0x236e79[_0x506f('0x19')],{'raw':_0x236e79[_0x506f('0x1a')]?_0x236e79[_0x506f('0x1a')][_0x506f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x236e79[_0x506f('0x1a')]?_0x236e79[_0x506f('0x1a')][_0x506f('0x1e')]||null:null,'attributes':_0x236e79['options']?_0x236e79[_0x506f('0x1a')][_0x506f('0x1f')]||null:null,'limit':_0x236e79[_0x506f('0x1a')]?_0x236e79[_0x506f('0x1a')][_0x506f('0x20')]||null:null})[_0x506f('0xc')](function(_0x54b7bd){logger[_0x506f('0xd')](_0x506f('0x1d'),_0x236e79);logger[_0x506f('0xf')](_0x506f('0x1d'),_0x236e79,JSON[_0x506f('0x11')](_0x54b7bd));_0x122f62(_0x54b7bd);})[_0x506f('0x1c')](function(_0x4180ff){logger[_0x506f('0x12')]('UpdateSmsQueueReport',_0x4180ff['message'],_0x236e79);_0x2c23d1(_0xc14da1[_0x506f('0x12')](0x1f4,_0x4180ff[_0x506f('0x15')]));});});}; \ No newline at end of file +var _0xdc78=['CreateSmsQueueReport','debug','UpdateSmsQueueReport','options','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SmsQueueReport','create','raw'];(function(_0x2b7a95,_0x332646){var _0x684a90=function(_0x4ae7f7){while(--_0x4ae7f7){_0x2b7a95['push'](_0x2b7a95['shift']());}};_0x684a90(++_0x332646);}(_0xdc78,0xd8));var _0x8dc7=function(_0x2975f1,_0x453f49){_0x2975f1=_0x2975f1-0x0;var _0x2c08d5=_0xdc78[_0x2975f1];return _0x2c08d5;};'use strict';var _=require(_0x8dc7('0x0'));var util=require('util');var moment=require(_0x8dc7('0x1'));var BPromise=require(_0x8dc7('0x2'));var rs=require(_0x8dc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8dc7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8dc7('0x5'))('rpc');var config=require(_0x8dc7('0x6'));var jayson=require(_0x8dc7('0x7'));var client=jayson[_0x8dc7('0x8')][_0x8dc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x146ed0,_0x53f25d,_0x11a953){return new BPromise(function(_0x1757fe,_0x613c3d){return client[_0x8dc7('0xa')](_0x146ed0,_0x11a953)[_0x8dc7('0xb')](function(_0x8cd29b){logger['info'](_0x8dc7('0xc'),_0x53f25d,_0x8dc7('0xd'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x53f25d,_0x8dc7('0xd'),JSON[_0x8dc7('0xe')](_0x8cd29b));if(_0x8cd29b[_0x8dc7('0xf')]){if(_0x8cd29b[_0x8dc7('0xf')][_0x8dc7('0x10')]===0x1f4){logger[_0x8dc7('0xf')](_0x8dc7('0xc'),_0x53f25d,_0x8cd29b['error'][_0x8dc7('0x11')]);return _0x613c3d(_0x8cd29b['error'][_0x8dc7('0x11')]);}logger[_0x8dc7('0xf')](_0x8dc7('0xc'),_0x53f25d,_0x8cd29b['error']['message']);return _0x1757fe(_0x8cd29b['error'][_0x8dc7('0x11')]);}else{logger[_0x8dc7('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x53f25d,_0x8dc7('0xd'));_0x1757fe(_0x8cd29b[_0x8dc7('0x13')]['message']);}})[_0x8dc7('0x14')](function(_0x3f665b){logger[_0x8dc7('0xf')](_0x8dc7('0xc'),_0x53f25d,_0x3f665b);_0x613c3d(_0x3f665b);});});}exports['CreateSmsQueueReport']=function(_0x367c69){var _0x3bd508=this;return new Promise(function(_0x29c061,_0x40776c){return db[_0x8dc7('0x15')][_0x8dc7('0x16')](_0x367c69['body'],{'raw':_0x367c69['options']?_0x367c69['options'][_0x8dc7('0x17')]===undefined?!![]:![]:!![]})[_0x8dc7('0xb')](function(_0x5a0990){logger[_0x8dc7('0x12')](_0x8dc7('0x18'),_0x367c69);logger[_0x8dc7('0x19')](_0x8dc7('0x18'),_0x367c69,JSON[_0x8dc7('0xe')](_0x5a0990));_0x29c061(_0x5a0990);})[_0x8dc7('0x14')](function(_0x4a0e19){logger[_0x8dc7('0xf')]('CreateSmsQueueReport',_0x4a0e19[_0x8dc7('0x11')],_0x367c69);_0x40776c(_0x3bd508[_0x8dc7('0xf')](0x1f4,_0x4a0e19[_0x8dc7('0x11')]));});});};exports[_0x8dc7('0x1a')]=function(_0x2c76be){var _0x5d62d5=this;return new Promise(function(_0x1a3e56,_0x10b971){return db[_0x8dc7('0x15')]['update'](_0x2c76be['body'],{'raw':_0x2c76be[_0x8dc7('0x1b')]?_0x2c76be[_0x8dc7('0x1b')][_0x8dc7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c76be[_0x8dc7('0x1b')]?_0x2c76be[_0x8dc7('0x1b')][_0x8dc7('0x1c')]||null:null,'attributes':_0x2c76be[_0x8dc7('0x1b')]?_0x2c76be['options'][_0x8dc7('0x1d')]||null:null,'limit':_0x2c76be[_0x8dc7('0x1b')]?_0x2c76be[_0x8dc7('0x1b')]['limit']||null:null})[_0x8dc7('0xb')](function(_0x3f24c1){logger[_0x8dc7('0x12')](_0x8dc7('0x1a'),_0x2c76be);logger['debug']('UpdateSmsQueueReport',_0x2c76be,JSON[_0x8dc7('0xe')](_0x3f24c1));_0x1a3e56(_0x3f24c1);})[_0x8dc7('0x14')](function(_0x81b900){logger[_0x8dc7('0xf')](_0x8dc7('0x1a'),_0x81b900[_0x8dc7('0x11')],_0x2c76be);_0x10b971(_0x5d62d5[_0x8dc7('0xf')](0x1f4,_0x81b900[_0x8dc7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a9276fe..5661cbe 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 _0xcb66=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x25d022,_0x560323){var _0x3593d5=function(_0x1152b6){while(--_0x1152b6){_0x25d022['push'](_0x25d022['shift']());}};_0x3593d5(++_0x560323);}(_0xcb66,0x19f));var _0x6cb6=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xcb66[_0x9b7a64];return _0x33fd98;};'use strict';var multer=require('multer');var util=require(_0x6cb6('0x0'));var path=require(_0x6cb6('0x1'));var timeout=require(_0x6cb6('0x2'));var express=require(_0x6cb6('0x3'));var router=express[_0x6cb6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb6('0x5'));var interaction=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var controller=require(_0x6cb6('0x8'));router[_0x6cb6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6cb6('0x9')](_0x6cb6('0xa'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xc')]);router[_0x6cb6('0x9')](_0x6cb6('0xd'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xe')]);router[_0x6cb6('0xf')]('/',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x10')]);router[_0x6cb6('0x11')](_0x6cb6('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x12')]);module[_0x6cb6('0x13')]=router; \ No newline at end of file +var _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x1c6d44,_0x1b7780){var _0x49d1a7=function(_0x1e6b18){while(--_0x1e6b18){_0x1c6d44['push'](_0x1c6d44['shift']());}};_0x49d1a7(++_0x1b7780);}(_0x84ab,0x12f));var _0xb84a=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x84ab[_0x186376];return _0x2dbdd9;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index b1977f0..779a602 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x432259,_0x23fdba){var _0x47b232=function(_0x57f178){while(--_0x57f178){_0x432259['push'](_0x432259['shift']());}};_0x47b232(++_0x23fdba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x181fc3,_0x140283){var _0x15adbe=function(_0x121d0e){while(--_0x121d0e){_0x181fc3['push'](_0x181fc3['shift']());}};_0x15adbe(++_0x140283);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 05152a2..279f804 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 _0x07ea=['hasOwnProperty','nolimit','sort','where','pick','merge','map','include','findAll','rows','catch','show','rawAttributes','length','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','send','index','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x375d6f,_0x27308e){var _0x598dd7=function(_0x2f4523){while(--_0x2f4523){_0x375d6f['push'](_0x375d6f['shift']());}};_0x598dd7(++_0x27308e);}(_0x07ea,0x177));var _0xa07e=function(_0x55253a,_0x711a4f){_0x55253a=_0x55253a-0x0;var _0x1bc913=_0x07ea[_0x55253a];return _0x1bc913;};'use strict';var emlformat=require(_0xa07e('0x0'));var rimraf=require(_0xa07e('0x1'));var zipdir=require(_0xa07e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa07e('0x3'));var BPromise=require(_0xa07e('0x4'));var Mustache=require(_0xa07e('0x5'));var util=require(_0xa07e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa07e('0x7'));var ejs=require(_0xa07e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa07e('0x9'));var squel=require(_0xa07e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa07e('0x7'));var querystring=require(_0xa07e('0xb'));var Papa=require(_0xa07e('0xc'));var Redis=require(_0xa07e('0xd'));var authService=require(_0xa07e('0xe'));var qs=require(_0xa07e('0xf'));var as=require(_0xa07e('0x10'));var hardwareService=require(_0xa07e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa07e('0x12'));var config=require(_0xa07e('0x13'));var licenseUtil=require(_0xa07e('0x14'));var db=require(_0xa07e('0x15'))['db'];function respondWithStatusCode(_0x37facf,_0x4f0033){_0x4f0033=_0x4f0033||0xcc;return function(_0x2e2d45){if(_0x2e2d45){return _0x37facf[_0xa07e('0x16')](_0x4f0033);}return _0x37facf[_0xa07e('0x17')](_0x4f0033)[_0xa07e('0x18')]();};}function respondWithResult(_0x14c595,_0x409ee1){_0x409ee1=_0x409ee1||0xc8;return function(_0x2f0860){if(_0x2f0860){return _0x14c595[_0xa07e('0x17')](_0x409ee1)[_0xa07e('0x19')](_0x2f0860);}};}function respondWithFilteredResult(_0x42250e,_0x5f003a){return function(_0x288d47){if(_0x288d47){var _0x5900f4=typeof _0x5f003a[_0xa07e('0x1a')]===_0xa07e('0x1b')&&typeof _0x5f003a[_0xa07e('0x1c')]===_0xa07e('0x1b');var _0x2320e=_0x288d47[_0xa07e('0x1d')];var _0x51430d=_0x5900f4?0x0:_0x5f003a[_0xa07e('0x1a')];var _0x42e36b=_0x5900f4?_0x288d47[_0xa07e('0x1d')]:_0x5f003a[_0xa07e('0x1a')]+_0x5f003a[_0xa07e('0x1c')];var _0x4e3c90;if(_0x42e36b>=_0x2320e){_0x42e36b=_0x2320e;_0x4e3c90=0xc8;}else{_0x4e3c90=0xce;}_0x42250e[_0xa07e('0x17')](_0x4e3c90);return _0x42250e[_0xa07e('0x1e')](_0xa07e('0x1f'),_0x51430d+'-'+_0x42e36b+'/'+_0x2320e)[_0xa07e('0x19')](_0x288d47);}return null;};}function patchUpdates(_0x56268){return function(_0x27a9d0){try{jsonpatch['apply'](_0x27a9d0,_0x56268,!![]);}catch(_0x4f76f2){return BPromise['reject'](_0x4f76f2);}return _0x27a9d0[_0xa07e('0x20')]();};}function saveUpdates(_0xc1de3b,_0x52513f){return function(_0x513e97){if(_0x513e97){return _0x513e97[_0xa07e('0x21')](_0xc1de3b)[_0xa07e('0x22')](function(_0x43fba6){return _0x43fba6;});}return null;};}function removeEntity(_0xc1e2b,_0x5708a2){return function(_0x4f2cb9){if(_0x4f2cb9){return _0x4f2cb9[_0xa07e('0x23')]()[_0xa07e('0x22')](function(){_0xc1e2b['status'](0xcc)[_0xa07e('0x18')]();});}};}function handleEntityNotFound(_0x1fb9bf,_0x50c6eb){return function(_0x1508e8){if(!_0x1508e8){_0x1fb9bf[_0xa07e('0x16')](0x194);}return _0x1508e8;};}function handleError(_0x1336ab,_0x25c3fa){_0x25c3fa=_0x25c3fa||0x1f4;return function(_0x140f20){logger['error'](_0x140f20[_0xa07e('0x24')]);if(_0x140f20['name']){delete _0x140f20[_0xa07e('0x25')];}_0x1336ab[_0xa07e('0x17')](_0x25c3fa)[_0xa07e('0x26')](_0x140f20);};}exports[_0xa07e('0x27')]=function(_0x1c8611,_0x420daf){var _0x34b32d={},_0x130406={},_0x31da01={'count':0x0,'rows':[]};var _0x200a5a=_['map'](db[_0xa07e('0x28')]['rawAttributes'],function(_0x55053d){return{'name':_0x55053d[_0xa07e('0x29')],'type':_0x55053d[_0xa07e('0x2a')][_0xa07e('0x2b')]};});_0x130406[_0xa07e('0x2c')]=_['map'](_0x200a5a,_0xa07e('0x25'));_0x130406[_0xa07e('0x2d')]=_[_0xa07e('0x2e')](_0x1c8611[_0xa07e('0x2d')]);_0x130406[_0xa07e('0x2f')]=_[_0xa07e('0x30')](_0x130406[_0xa07e('0x2c')],_0x130406[_0xa07e('0x2d')]);_0x34b32d[_0xa07e('0x31')]=_[_0xa07e('0x30')](_0x130406[_0xa07e('0x2c')],qs[_0xa07e('0x32')](_0x1c8611[_0xa07e('0x2d')][_0xa07e('0x32')]));_0x34b32d[_0xa07e('0x31')]=_0x34b32d[_0xa07e('0x31')]['length']?_0x34b32d[_0xa07e('0x31')]:_0x130406[_0xa07e('0x2c')];if(!_0x1c8611['query'][_0xa07e('0x33')](_0xa07e('0x34'))){_0x34b32d['limit']=qs[_0xa07e('0x1c')](_0x1c8611[_0xa07e('0x2d')][_0xa07e('0x1c')]);_0x34b32d['offset']=qs[_0xa07e('0x1a')](_0x1c8611[_0xa07e('0x2d')]['offset']);}_0x34b32d['order']=qs[_0xa07e('0x35')](_0x1c8611[_0xa07e('0x2d')][_0xa07e('0x35')]);_0x34b32d[_0xa07e('0x36')]=qs[_0xa07e('0x2f')](_[_0xa07e('0x37')](_0x1c8611[_0xa07e('0x2d')],_0x130406[_0xa07e('0x2f')]),_0x200a5a);if(_0x1c8611['query']['filter']){_0x34b32d['where']=_[_0xa07e('0x38')](_0x34b32d[_0xa07e('0x36')],{'$or':_[_0xa07e('0x39')](_0x200a5a,function(_0xb48a44){if(_0xb48a44['type']!=='VIRTUAL'){var _0x3b346a={};_0x3b346a[_0xb48a44[_0xa07e('0x25')]]={'$like':'%'+_0x1c8611[_0xa07e('0x2d')]['filter']+'%'};return _0x3b346a;}})});}_0x34b32d=_[_0xa07e('0x38')]({},_0x34b32d,_0x1c8611['options']);var _0x310386={'where':_0x34b32d['where']};return db[_0xa07e('0x28')][_0xa07e('0x1d')](_0x310386)[_0xa07e('0x22')](function(_0x3d4172){_0x31da01[_0xa07e('0x1d')]=_0x3d4172;if(_0x1c8611[_0xa07e('0x2d')]['includeAll']){_0x34b32d[_0xa07e('0x3a')]=[{'all':!![]}];}return db[_0xa07e('0x28')][_0xa07e('0x3b')](_0x34b32d);})[_0xa07e('0x22')](function(_0x309635){_0x31da01[_0xa07e('0x3c')]=_0x309635;return _0x31da01;})[_0xa07e('0x22')](respondWithFilteredResult(_0x420daf,_0x34b32d))[_0xa07e('0x3d')](handleError(_0x420daf,null));};exports[_0xa07e('0x3e')]=function(_0x42c981,_0x46a796){var _0x5996ca={'raw':!![],'where':{'id':_0x42c981['params']['id']}},_0xcafe4c={};_0xcafe4c[_0xa07e('0x2c')]=_[_0xa07e('0x2e')](db[_0xa07e('0x28')][_0xa07e('0x3f')]);_0xcafe4c[_0xa07e('0x2d')]=_[_0xa07e('0x2e')](_0x42c981['query']);_0xcafe4c[_0xa07e('0x2f')]=_[_0xa07e('0x30')](_0xcafe4c['model'],_0xcafe4c[_0xa07e('0x2d')]);_0x5996ca[_0xa07e('0x31')]=_[_0xa07e('0x30')](_0xcafe4c[_0xa07e('0x2c')],qs[_0xa07e('0x32')](_0x42c981[_0xa07e('0x2d')][_0xa07e('0x32')]));_0x5996ca[_0xa07e('0x31')]=_0x5996ca[_0xa07e('0x31')][_0xa07e('0x40')]?_0x5996ca[_0xa07e('0x31')]:_0xcafe4c[_0xa07e('0x2c')];if(_0x42c981['query'][_0xa07e('0x41')]){_0x5996ca[_0xa07e('0x3a')]=[{'all':!![]}];}_0x5996ca=_[_0xa07e('0x38')]({},_0x5996ca,_0x42c981['options']);return db[_0xa07e('0x28')]['find'](_0x5996ca)[_0xa07e('0x22')](handleEntityNotFound(_0x46a796,null))[_0xa07e('0x22')](respondWithResult(_0x46a796,null))[_0xa07e('0x3d')](handleError(_0x46a796,null));};exports[_0xa07e('0x42')]=function(_0x2d135e,_0x3fb02){return db[_0xa07e('0x28')]['create'](_0x2d135e[_0xa07e('0x43')],{})[_0xa07e('0x22')](respondWithResult(_0x3fb02,0xc9))[_0xa07e('0x3d')](handleError(_0x3fb02,null));};exports[_0xa07e('0x21')]=function(_0x90a846,_0x767e30){if(_0x90a846[_0xa07e('0x43')]['id']){delete _0x90a846[_0xa07e('0x43')]['id'];}return db[_0xa07e('0x28')][_0xa07e('0x44')]({'where':{'id':_0x90a846[_0xa07e('0x45')]['id']}})[_0xa07e('0x22')](handleEntityNotFound(_0x767e30,null))['then'](saveUpdates(_0x90a846['body'],null))['then'](respondWithResult(_0x767e30,null))['catch'](handleError(_0x767e30,null));};exports[_0xa07e('0x23')]=function(_0x1f2e8a,_0x42b15d){return db[_0xa07e('0x28')][_0xa07e('0x44')]({'where':{'id':_0x1f2e8a[_0xa07e('0x45')]['id']}})[_0xa07e('0x22')](handleEntityNotFound(_0x42b15d,null))[_0xa07e('0x22')](removeEntity(_0x42b15d,null))[_0xa07e('0x3d')](handleError(_0x42b15d,null));};exports[_0xa07e('0x46')]=function(_0x11b38b,_0x226ba3){return db[_0xa07e('0x28')][_0xa07e('0x46')]()['then'](respondWithResult(_0x226ba3,null))[_0xa07e('0x3d')](handleError(_0x226ba3,null));}; \ No newline at end of file +var _0xab30=['show','params','keys','SmsTransferReport','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','then','destroy','end','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','include','rows','catch'];(function(_0x50be61,_0xc3dc2e){var _0x517fef=function(_0x2f598e){while(--_0x2f598e){_0x50be61['push'](_0x50be61['shift']());}};_0x517fef(++_0xc3dc2e);}(_0xab30,0x1ad));var _0x0ab3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xab30[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x0ab3('0x0'));var rimraf=require(_0x0ab3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ab3('0x2'));var rp=require(_0x0ab3('0x3'));var moment=require(_0x0ab3('0x4'));var BPromise=require(_0x0ab3('0x5'));var Mustache=require(_0x0ab3('0x6'));var util=require(_0x0ab3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0ab3('0x8'));var ejs=require(_0x0ab3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab3('0xa'));var squel=require('squel');var crypto=require(_0x0ab3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0ab3('0xc'));var toCsv=require(_0x0ab3('0x8'));var querystring=require(_0x0ab3('0xd'));var Papa=require(_0x0ab3('0xe'));var Redis=require(_0x0ab3('0xf'));var authService=require(_0x0ab3('0x10'));var qs=require(_0x0ab3('0x11'));var as=require(_0x0ab3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ab3('0x13'));var utils=require('../../config/utils');var config=require(_0x0ab3('0x14'));var licenseUtil=require(_0x0ab3('0x15'));var db=require(_0x0ab3('0x16'))['db'];function respondWithStatusCode(_0x456c54,_0x3d274b){_0x3d274b=_0x3d274b||0xcc;return function(_0x520283){if(_0x520283){return _0x456c54[_0x0ab3('0x17')](_0x3d274b);}return _0x456c54['status'](_0x3d274b)['end']();};}function respondWithResult(_0x506e07,_0x308e34){_0x308e34=_0x308e34||0xc8;return function(_0x223a25){if(_0x223a25){return _0x506e07[_0x0ab3('0x18')](_0x308e34)[_0x0ab3('0x19')](_0x223a25);}};}function respondWithFilteredResult(_0x227684,_0x4c7443){return function(_0xffde0f){if(_0xffde0f){var _0x5f563f=typeof _0x4c7443['offset']===_0x0ab3('0x1a')&&typeof _0x4c7443['limit']===_0x0ab3('0x1a');var _0x375d5a=_0xffde0f[_0x0ab3('0x1b')];var _0x3e02f4=_0x5f563f?0x0:_0x4c7443[_0x0ab3('0x1c')];var _0x578ba6=_0x5f563f?_0xffde0f[_0x0ab3('0x1b')]:_0x4c7443[_0x0ab3('0x1c')]+_0x4c7443[_0x0ab3('0x1d')];var _0x114c89;if(_0x578ba6>=_0x375d5a){_0x578ba6=_0x375d5a;_0x114c89=0xc8;}else{_0x114c89=0xce;}_0x227684[_0x0ab3('0x18')](_0x114c89);return _0x227684[_0x0ab3('0x1e')]('Content-Range',_0x3e02f4+'-'+_0x578ba6+'/'+_0x375d5a)['json'](_0xffde0f);}return null;};}function patchUpdates(_0x33751e){return function(_0x5e9bd6){try{jsonpatch[_0x0ab3('0x1f')](_0x5e9bd6,_0x33751e,!![]);}catch(_0x3db0eb){return BPromise[_0x0ab3('0x20')](_0x3db0eb);}return _0x5e9bd6['save']();};}function saveUpdates(_0x1772ce,_0x24b419){return function(_0x15023e){if(_0x15023e){return _0x15023e['update'](_0x1772ce)[_0x0ab3('0x21')](function(_0x330b17){return _0x330b17;});}return null;};}function removeEntity(_0xf4239,_0x4affbf){return function(_0x3e7bdd){if(_0x3e7bdd){return _0x3e7bdd[_0x0ab3('0x22')]()[_0x0ab3('0x21')](function(){_0xf4239[_0x0ab3('0x18')](0xcc)[_0x0ab3('0x23')]();});}};}function handleEntityNotFound(_0x54f780,_0x202a67){return function(_0x435c59){if(!_0x435c59){_0x54f780['sendStatus'](0x194);}return _0x435c59;};}function handleError(_0x5c3ca8,_0x480bd0){_0x480bd0=_0x480bd0||0x1f4;return function(_0x505de9){logger['error'](_0x505de9['stack']);if(_0x505de9[_0x0ab3('0x24')]){delete _0x505de9['name'];}_0x5c3ca8[_0x0ab3('0x18')](_0x480bd0)[_0x0ab3('0x25')](_0x505de9);};}exports[_0x0ab3('0x26')]=function(_0x397bb6,_0x3e7034){var _0x6c8ffa={},_0x463333={},_0xd0b648={'count':0x0,'rows':[]};var _0x4036af=_[_0x0ab3('0x27')](db['SmsTransferReport'][_0x0ab3('0x28')],function(_0x152c87){return{'name':_0x152c87['fieldName'],'type':_0x152c87[_0x0ab3('0x29')][_0x0ab3('0x2a')]};});_0x463333[_0x0ab3('0x2b')]=_['map'](_0x4036af,'name');_0x463333[_0x0ab3('0x2c')]=_['keys'](_0x397bb6[_0x0ab3('0x2c')]);_0x463333[_0x0ab3('0x2d')]=_[_0x0ab3('0x2e')](_0x463333[_0x0ab3('0x2b')],_0x463333['query']);_0x6c8ffa[_0x0ab3('0x2f')]=_[_0x0ab3('0x2e')](_0x463333[_0x0ab3('0x2b')],qs[_0x0ab3('0x30')](_0x397bb6[_0x0ab3('0x2c')]['fields']));_0x6c8ffa[_0x0ab3('0x2f')]=_0x6c8ffa['attributes'][_0x0ab3('0x31')]?_0x6c8ffa['attributes']:_0x463333[_0x0ab3('0x2b')];if(!_0x397bb6[_0x0ab3('0x2c')]['hasOwnProperty'](_0x0ab3('0x32'))){_0x6c8ffa['limit']=qs[_0x0ab3('0x1d')](_0x397bb6[_0x0ab3('0x2c')][_0x0ab3('0x1d')]);_0x6c8ffa[_0x0ab3('0x1c')]=qs[_0x0ab3('0x1c')](_0x397bb6['query'][_0x0ab3('0x1c')]);}_0x6c8ffa[_0x0ab3('0x33')]=qs['sort'](_0x397bb6[_0x0ab3('0x2c')]['sort']);_0x6c8ffa[_0x0ab3('0x34')]=qs['filters'](_[_0x0ab3('0x35')](_0x397bb6['query'],_0x463333[_0x0ab3('0x2d')]),_0x4036af);if(_0x397bb6[_0x0ab3('0x2c')]['filter']){_0x6c8ffa[_0x0ab3('0x34')]=_[_0x0ab3('0x36')](_0x6c8ffa[_0x0ab3('0x34')],{'$or':_[_0x0ab3('0x27')](_0x4036af,function(_0x28ebb3){if(_0x28ebb3[_0x0ab3('0x29')]!==_0x0ab3('0x37')){var _0x4f67b6={};_0x4f67b6[_0x28ebb3[_0x0ab3('0x24')]]={'$like':'%'+_0x397bb6[_0x0ab3('0x2c')][_0x0ab3('0x38')]+'%'};return _0x4f67b6;}})});}_0x6c8ffa=_[_0x0ab3('0x36')]({},_0x6c8ffa,_0x397bb6[_0x0ab3('0x39')]);var _0x196444={'where':_0x6c8ffa['where']};return db['SmsTransferReport'][_0x0ab3('0x1b')](_0x196444)[_0x0ab3('0x21')](function(_0x14ae19){_0xd0b648[_0x0ab3('0x1b')]=_0x14ae19;if(_0x397bb6[_0x0ab3('0x2c')]['includeAll']){_0x6c8ffa[_0x0ab3('0x3a')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x6c8ffa);})[_0x0ab3('0x21')](function(_0x149310){_0xd0b648[_0x0ab3('0x3b')]=_0x149310;return _0xd0b648;})[_0x0ab3('0x21')](respondWithFilteredResult(_0x3e7034,_0x6c8ffa))[_0x0ab3('0x3c')](handleError(_0x3e7034,null));};exports[_0x0ab3('0x3d')]=function(_0x5ebb41,_0x348b1a){var _0x105721={'raw':!![],'where':{'id':_0x5ebb41[_0x0ab3('0x3e')]['id']}},_0x5892db={};_0x5892db['model']=_[_0x0ab3('0x3f')](db[_0x0ab3('0x40')][_0x0ab3('0x28')]);_0x5892db['query']=_[_0x0ab3('0x3f')](_0x5ebb41[_0x0ab3('0x2c')]);_0x5892db[_0x0ab3('0x2d')]=_[_0x0ab3('0x2e')](_0x5892db['model'],_0x5892db[_0x0ab3('0x2c')]);_0x105721[_0x0ab3('0x2f')]=_[_0x0ab3('0x2e')](_0x5892db[_0x0ab3('0x2b')],qs['fields'](_0x5ebb41[_0x0ab3('0x2c')][_0x0ab3('0x30')]));_0x105721['attributes']=_0x105721[_0x0ab3('0x2f')]['length']?_0x105721[_0x0ab3('0x2f')]:_0x5892db['model'];if(_0x5ebb41[_0x0ab3('0x2c')]['includeAll']){_0x105721[_0x0ab3('0x3a')]=[{'all':!![]}];}_0x105721=_[_0x0ab3('0x36')]({},_0x105721,_0x5ebb41[_0x0ab3('0x39')]);return db[_0x0ab3('0x40')][_0x0ab3('0x41')](_0x105721)[_0x0ab3('0x21')](handleEntityNotFound(_0x348b1a,null))[_0x0ab3('0x21')](respondWithResult(_0x348b1a,null))['catch'](handleError(_0x348b1a,null));};exports[_0x0ab3('0x42')]=function(_0x11a1fa,_0x2ce1d0){return db[_0x0ab3('0x40')][_0x0ab3('0x42')](_0x11a1fa[_0x0ab3('0x43')],{})[_0x0ab3('0x21')](respondWithResult(_0x2ce1d0,0xc9))[_0x0ab3('0x3c')](handleError(_0x2ce1d0,null));};exports[_0x0ab3('0x44')]=function(_0x4c61eb,_0x2e6c2e){if(_0x4c61eb[_0x0ab3('0x43')]['id']){delete _0x4c61eb[_0x0ab3('0x43')]['id'];}return db[_0x0ab3('0x40')]['find']({'where':{'id':_0x4c61eb[_0x0ab3('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2e6c2e,null))[_0x0ab3('0x21')](saveUpdates(_0x4c61eb[_0x0ab3('0x43')],null))[_0x0ab3('0x21')](respondWithResult(_0x2e6c2e,null))[_0x0ab3('0x3c')](handleError(_0x2e6c2e,null));};exports[_0x0ab3('0x22')]=function(_0x5812b3,_0x461c7e){return db[_0x0ab3('0x40')]['find']({'where':{'id':_0x5812b3[_0x0ab3('0x3e')]['id']}})[_0x0ab3('0x21')](handleEntityNotFound(_0x461c7e,null))['then'](removeEntity(_0x461c7e,null))[_0x0ab3('0x3c')](handleError(_0x461c7e,null));};exports[_0x0ab3('0x45')]=function(_0x2d3e47,_0x2d4f8b){return db[_0x0ab3('0x40')]['describe']()[_0x0ab3('0x21')](respondWithResult(_0x2d4f8b,null))[_0x0ab3('0x3c')](handleError(_0x2d4f8b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6e8be95..b5e9b6e 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 _0x94cf=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x327d3f,_0x1ebe0b){var _0x2449b5=function(_0x11ab6b){while(--_0x11ab6b){_0x327d3f['push'](_0x327d3f['shift']());}};_0x2449b5(++_0x1ebe0b);}(_0x94cf,0xc2));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf94c('0x0'));var logger=require(_0xf94c('0x1'))(_0xf94c('0x2'));var moment=require('moment');var BPromise=require(_0xf94c('0x3'));var rp=require(_0xf94c('0x4'));var fs=require('fs');var path=require(_0xf94c('0x5'));var rimraf=require(_0xf94c('0x6'));var config=require(_0xf94c('0x7'));var attributes=require(_0xf94c('0x8'));module[_0xf94c('0x9')]=function(_0x1c0879,_0x139ac3){return _0x1c0879['define'](_0xf94c('0xa'),attributes,{'tableName':_0xf94c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf94c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd5=['report_sms_transfer','uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cd5,0x72));var _0x54cd=function(_0x7b1927,_0x7d3e65){_0x7b1927=_0x7b1927-0x0;var _0x2deaaa=_0x4cd5[_0x7b1927];return _0x2deaaa;};'use strict';var _=require(_0x54cd('0x0'));var util=require(_0x54cd('0x1'));var logger=require('../../config/logger')(_0x54cd('0x2'));var moment=require('moment');var BPromise=require(_0x54cd('0x3'));var rp=require(_0x54cd('0x4'));var fs=require('fs');var path=require(_0x54cd('0x5'));var rimraf=require(_0x54cd('0x6'));var config=require(_0x54cd('0x7'));var attributes=require(_0x54cd('0x8'));module[_0x54cd('0x9')]=function(_0x376b70,_0x2382d2){return _0x376b70[_0x54cd('0xa')](_0x54cd('0xb'),attributes,{'tableName':_0x54cd('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x54cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 2bc0de0..97bac64 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 _0x0ec6=['client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4c5855,_0x2049fd){var _0x34bf92=function(_0x615723){while(--_0x615723){_0x4c5855['push'](_0x4c5855['shift']());}};_0x34bf92(++_0x2049fd);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x450940,_0xc87bbe){_0x450940=_0x450940-0x0;var _0x3f498d=_0x0ec6[_0x450940];return _0x3f498d;};'use strict';var _=require(_0x60ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60ec('0x1'));var rs=require(_0x60ec('0x2'));var fs=require('fs');var Redis=require(_0x60ec('0x3'));var db=require(_0x60ec('0x4'))['db'];var utils=require(_0x60ec('0x5'));var logger=require(_0x60ec('0x6'))(_0x60ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x60ec('0x8'));var client=jayson[_0x60ec('0x9')][_0x60ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x74adc4,_0x5d4cba,_0xcb974c){return new BPromise(function(_0x488ab8,_0x2c4a14){return client[_0x60ec('0xb')](_0x74adc4,_0xcb974c)[_0x60ec('0xc')](function(_0x1363c2){logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,'request\x20sent');logger['debug'](_0x60ec('0xf'),_0x5d4cba,_0x60ec('0x10'),JSON[_0x60ec('0x11')](_0x1363c2));if(_0x1363c2[_0x60ec('0x12')]){if(_0x1363c2[_0x60ec('0x12')]['code']===0x1f4){logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x2c4a14(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x488ab8(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}else{logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,_0x60ec('0x10'));_0x488ab8(_0x1363c2[_0x60ec('0x14')]['message']);}})[_0x60ec('0x15')](function(_0x2778dd){logger[_0x60ec('0x12')](_0x60ec('0xe'),_0x5d4cba,_0x2778dd);_0x2c4a14(_0x2778dd);});});} \ No newline at end of file +var _0x96f1=['../../config/environment','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x24a49d,_0x508563){var _0x19a64f=function(_0x41ca41){while(--_0x41ca41){_0x24a49d['push'](_0x24a49d['shift']());}};_0x19a64f(++_0x508563);}(_0x96f1,0x19c));var _0x196f=function(_0x300fa6,_0x4fab17){_0x300fa6=_0x300fa6-0x0;var _0x5606b2=_0x96f1[_0x300fa6];return _0x5606b2;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var moment=require(_0x196f('0x2'));var BPromise=require(_0x196f('0x3'));var rs=require(_0x196f('0x4'));var fs=require('fs');var Redis=require(_0x196f('0x5'));var db=require(_0x196f('0x6'))['db'];var utils=require(_0x196f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x196f('0x8'));var jayson=require(_0x196f('0x9'));var client=jayson[_0x196f('0xa')][_0x196f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17f603,_0x59bc2e,_0x427333){return new BPromise(function(_0x425e5c,_0x7dc33b){return client[_0x196f('0xc')](_0x17f603,_0x427333)['then'](function(_0x1f29a4){logger['info'](_0x196f('0xd'),_0x59bc2e,'request\x20sent');logger[_0x196f('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x59bc2e,'request\x20sent',JSON['stringify'](_0x1f29a4));if(_0x1f29a4['error']){if(_0x1f29a4[_0x196f('0xf')][_0x196f('0x10')]===0x1f4){logger[_0x196f('0xf')](_0x196f('0xd'),_0x59bc2e,_0x1f29a4[_0x196f('0xf')][_0x196f('0x11')]);return _0x7dc33b(_0x1f29a4['error'][_0x196f('0x11')]);}logger['error'](_0x196f('0xd'),_0x59bc2e,_0x1f29a4['error'][_0x196f('0x11')]);return _0x425e5c(_0x1f29a4['error'][_0x196f('0x11')]);}else{logger[_0x196f('0x12')](_0x196f('0xd'),_0x59bc2e,_0x196f('0x13'));_0x425e5c(_0x1f29a4[_0x196f('0x14')][_0x196f('0x11')]);}})['catch'](function(_0x11bd6c){logger[_0x196f('0xf')](_0x196f('0xd'),_0x59bc2e,_0x11bd6c);_0x7dc33b(_0x11bd6c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 34f9ebc..9cb6e2a 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 _0xa09f=['exports','multer','util','connect-timeout','express','Router','fs-extra','get','index','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','single','file','create','put','delete'];(function(_0x3fbd88,_0xf6d86c){var _0x4d95bc=function(_0x10ed43){while(--_0x10ed43){_0x3fbd88['push'](_0x3fbd88['shift']());}};_0x4d95bc(++_0xf6d86c);}(_0xa09f,0x139));var _0xfa09=function(_0x38887b,_0x217c73){_0x38887b=_0x38887b-0x0;var _0x2a6d19=_0xa09f[_0x38887b];return _0x2a6d19;};'use strict';var multer=require(_0xfa09('0x0'));var util=require(_0xfa09('0x1'));var path=require('path');var timeout=require(_0xfa09('0x2'));var express=require(_0xfa09('0x3'));var router=express[_0xfa09('0x4')]();var fs_extra=require(_0xfa09('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xfa09('0x6')]('/',auth['isAuthenticated'](),controller[_0xfa09('0x7')]);router[_0xfa09('0x6')](_0xfa09('0x8'),auth[_0xfa09('0x9')](),controller[_0xfa09('0xa')]);router['get']('/:id/download',auth[_0xfa09('0x9')](),controller[_0xfa09('0xb')]);var upload=multer({'storage':multer[_0xfa09('0xc')]({'destination':function(_0x5983fc,_0x56b081,_0x3478d8){_0x3478d8(null,path[_0xfa09('0xd')](config[_0xfa09('0xe')],_0xfa09('0xf')));},'filename':function(_0x3e3db5,_0x4f6dab,_0x1fca56){_0x4f6dab['originalname']=_0x4f6dab[_0xfa09('0x10')][_0xfa09('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1fca56(null,util['format'](_0xfa09('0x12'),path[_0xfa09('0x13')](_0x4f6dab[_0xfa09('0x10')],path['extname'](_0x4f6dab[_0xfa09('0x10')])),Date['now'](),path['extname'](_0x4f6dab['originalname'])));}})});router['post']('/',upload[_0xfa09('0x14')](_0xfa09('0x15')),controller[_0xfa09('0x16')]);router[_0xfa09('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfa09('0x18')](_0xfa09('0x8'),auth[_0xfa09('0x9')](),controller[_0xfa09('0x18')]);module[_0xfa09('0x19')]=router; \ No newline at end of file +var _0x9414=['extname','now','post','single','file','/:id','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./sound.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s'];(function(_0x222b0c,_0x183b87){var _0x24c4fa=function(_0x51a5ab){while(--_0x51a5ab){_0x222b0c['push'](_0x222b0c['shift']());}};_0x24c4fa(++_0x183b87);}(_0x9414,0x158));var _0x4941=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0x9414[_0x8b631b];return _0x3e6832;};'use strict';var multer=require(_0x4941('0x0'));var util=require('util');var path=require(_0x4941('0x1'));var timeout=require(_0x4941('0x2'));var express=require('express');var router=express[_0x4941('0x3')]();var fs_extra=require(_0x4941('0x4'));var auth=require(_0x4941('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4941('0x6'));router[_0x4941('0x7')]('/',auth[_0x4941('0x8')](),controller['index']);router[_0x4941('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4941('0x9')]);router[_0x4941('0x7')](_0x4941('0xa'),auth[_0x4941('0x8')](),controller[_0x4941('0xb')]);var upload=multer({'storage':multer[_0x4941('0xc')]({'destination':function(_0x401fbb,_0x395f35,_0x5bcbf2){_0x5bcbf2(null,path[_0x4941('0xd')](config[_0x4941('0xe')],_0x4941('0xf')));},'filename':function(_0x49612b,_0x475a7b,_0x362909){_0x475a7b['originalname']=_0x475a7b[_0x4941('0x10')][_0x4941('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x362909(null,util[_0x4941('0x12')](_0x4941('0x13'),path['basename'](_0x475a7b[_0x4941('0x10')],path[_0x4941('0x14')](_0x475a7b[_0x4941('0x10')])),Date[_0x4941('0x15')](),path['extname'](_0x475a7b['originalname'])));}})});router[_0x4941('0x16')]('/',upload[_0x4941('0x17')](_0x4941('0x18')),controller['create']);router['put'](_0x4941('0x19'),auth[_0x4941('0x8')](),controller[_0x4941('0x1a')]);router[_0x4941('0x1b')](_0x4941('0x19'),auth[_0x4941('0x8')](),controller[_0x4941('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 59d7c3c..a4ecef7 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 _0x0851=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x0851,0x8a));var _0x1085=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0x0851[_0x2b18c9];return _0x8b913c;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'name':{'type':Sequelize[_0x1085('0x2')],'unique':_0x1085('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x1085('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1085('0x2')]},'original_format':{'type':Sequelize[_0x1085('0x2')]},'original_duration':{'type':Sequelize[_0x1085('0x4')]},'original_sampleCount':{'type':Sequelize[_0x1085('0x5')]},'original_channelCount':{'type':Sequelize[_0x1085('0x6')]},'original_bitRate':{'type':Sequelize[_0x1085('0x5')]},'original_sampleRate':{'type':Sequelize[_0x1085('0x6')]},'converted_format':{'type':Sequelize[_0x1085('0x2')]},'converted_duration':{'type':Sequelize[_0x1085('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x1085('0x5')]},'converted_channelCount':{'type':Sequelize[_0x1085('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2c06=['sequelize','exports','STRING','name','BIGINT','INTEGER','FLOAT'];(function(_0x45aa3b,_0xfca4ce){var _0x4943c4=function(_0x1b6321){while(--_0x1b6321){_0x45aa3b['push'](_0x45aa3b['shift']());}};_0x4943c4(++_0xfca4ce);}(_0x2c06,0x1dc));var _0x62c0=function(_0x4fa55d,_0x56fa43){_0x4fa55d=_0x4fa55d-0x0;var _0x108361=_0x2c06[_0x4fa55d];return _0x108361;};'use strict';var Sequelize=require(_0x62c0('0x0'));module[_0x62c0('0x1')]={'name':{'type':Sequelize[_0x62c0('0x2')],'unique':_0x62c0('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x62c0('0x2')]},'display_name':{'type':Sequelize[_0x62c0('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x62c0('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x62c0('0x4')]},'original_channelCount':{'type':Sequelize[_0x62c0('0x5')]},'original_bitRate':{'type':Sequelize[_0x62c0('0x4')]},'original_sampleRate':{'type':Sequelize[_0x62c0('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x62c0('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x62c0('0x4')]},'converted_channelCount':{'type':Sequelize[_0x62c0('0x5')]},'converted_bitRate':{'type':Sequelize[_0x62c0('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x62c0('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index eee4263..1e4aece 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 _0xaafb=['converted_sampleRate','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','original_format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Sound','count','include','findAll','rows','show','params','length','includeAll','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','format','%s.%s','catch','create','basename','file','originalname','extname','filename','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xaafb,0x182));var _0xbaaf=function(_0x2fd03e,_0x3594c8){_0x2fd03e=_0x2fd03e-0x0;var _0x3ff2d5=_0xaafb[_0x2fd03e];return _0x3ff2d5;};'use strict';var emlformat=require(_0xbaaf('0x0'));var rimraf=require(_0xbaaf('0x1'));var zipdir=require(_0xbaaf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbaaf('0x3'));var moment=require(_0xbaaf('0x4'));var BPromise=require(_0xbaaf('0x5'));var Mustache=require(_0xbaaf('0x6'));var util=require('util');var path=require(_0xbaaf('0x7'));var sox=require(_0xbaaf('0x8'));var csv=require(_0xbaaf('0x9'));var ejs=require(_0xbaaf('0xa'));var fs=require('fs');var fs_extra=require(_0xbaaf('0xb'));var _=require(_0xbaaf('0xc'));var squel=require(_0xbaaf('0xd'));var crypto=require(_0xbaaf('0xe'));var jsforce=require(_0xbaaf('0xf'));var deskjs=require(_0xbaaf('0x10'));var toCsv=require(_0xbaaf('0x9'));var querystring=require(_0xbaaf('0x11'));var Papa=require(_0xbaaf('0x12'));var Redis=require('ioredis');var authService=require(_0xbaaf('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbaaf('0x14'));var logger=require(_0xbaaf('0x15'))(_0xbaaf('0x16'));var utils=require(_0xbaaf('0x17'));var config=require(_0xbaaf('0x18'));var licenseUtil=require(_0xbaaf('0x19'));var db=require(_0xbaaf('0x1a'))['db'];function respondWithStatusCode(_0x2ac77d,_0x394893){_0x394893=_0x394893||0xcc;return function(_0x472852){if(_0x472852){return _0x2ac77d[_0xbaaf('0x1b')](_0x394893);}return _0x2ac77d[_0xbaaf('0x1c')](_0x394893)[_0xbaaf('0x1d')]();};}function respondWithResult(_0x48fe9b,_0x4df207){_0x4df207=_0x4df207||0xc8;return function(_0x24a94e){if(_0x24a94e){return _0x48fe9b['status'](_0x4df207)[_0xbaaf('0x1e')](_0x24a94e);}};}function respondWithFilteredResult(_0x1e1a61,_0x2d1721){return function(_0x259fcf){if(_0x259fcf){var _0x5f5b8d=typeof _0x2d1721[_0xbaaf('0x1f')]===_0xbaaf('0x20')&&typeof _0x2d1721[_0xbaaf('0x21')]===_0xbaaf('0x20');var _0x3b8a2a=_0x259fcf['count'];var _0x35b550=_0x5f5b8d?0x0:_0x2d1721['offset'];var _0x3530d8=_0x5f5b8d?_0x259fcf['count']:_0x2d1721[_0xbaaf('0x1f')]+_0x2d1721['limit'];var _0x125d31;if(_0x3530d8>=_0x3b8a2a){_0x3530d8=_0x3b8a2a;_0x125d31=0xc8;}else{_0x125d31=0xce;}_0x1e1a61[_0xbaaf('0x1c')](_0x125d31);return _0x1e1a61['set']('Content-Range',_0x35b550+'-'+_0x3530d8+'/'+_0x3b8a2a)['json'](_0x259fcf);}return null;};}function patchUpdates(_0x41b6b4){return function(_0x1866bc){try{jsonpatch[_0xbaaf('0x22')](_0x1866bc,_0x41b6b4,!![]);}catch(_0x5c319e){return BPromise['reject'](_0x5c319e);}return _0x1866bc[_0xbaaf('0x23')]();};}function saveUpdates(_0x170b63,_0x5110c8){return function(_0x38bea1){if(_0x38bea1){return _0x38bea1[_0xbaaf('0x24')](_0x170b63)[_0xbaaf('0x25')](function(_0x2faac8){return _0x2faac8;});}return null;};}function removeEntity(_0xf9021f,_0x4e0dde){return function(_0x592368){if(_0x592368){return _0x592368[_0xbaaf('0x26')]()[_0xbaaf('0x25')](function(){var _0x2d64db=_0x592368[_0xbaaf('0x27')]({'plain':!![]});var _0x566c42='Sounds';return db[_0xbaaf('0x28')][_0xbaaf('0x26')]({'where':{'type':_0x566c42,'resourceId':_0x2d64db['id']}})['then'](function(){return _0x592368;});})[_0xbaaf('0x25')](function(){_0xf9021f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39511f,_0x1132a7){return function(_0x4ecab6){if(!_0x4ecab6){_0x39511f[_0xbaaf('0x1b')](0x194);}return _0x4ecab6;};}function handleError(_0x5ad909,_0x3bb1db){_0x3bb1db=_0x3bb1db||0x1f4;return function(_0xe8c04a){logger[_0xbaaf('0x29')](_0xe8c04a['stack']);if(_0xe8c04a[_0xbaaf('0x2a')]){delete _0xe8c04a[_0xbaaf('0x2a')];}_0x5ad909[_0xbaaf('0x1c')](_0x3bb1db)[_0xbaaf('0x2b')](_0xe8c04a);};}exports[_0xbaaf('0x2c')]=function(_0x361550,_0x5311a9){var _0x109b9={},_0x5b910f={},_0x16d10b={'count':0x0,'rows':[]};var _0x97b506=_['map'](db['Sound'][_0xbaaf('0x2d')],function(_0x17b780){return{'name':_0x17b780[_0xbaaf('0x2e')],'type':_0x17b780[_0xbaaf('0x2f')][_0xbaaf('0x30')]};});_0x5b910f[_0xbaaf('0x31')]=_[_0xbaaf('0x32')](_0x97b506,_0xbaaf('0x2a'));_0x5b910f['query']=_[_0xbaaf('0x33')](_0x361550[_0xbaaf('0x34')]);_0x5b910f[_0xbaaf('0x35')]=_['intersection'](_0x5b910f['model'],_0x5b910f[_0xbaaf('0x34')]);_0x109b9['attributes']=_[_0xbaaf('0x36')](_0x5b910f[_0xbaaf('0x31')],qs[_0xbaaf('0x37')](_0x361550[_0xbaaf('0x34')]['fields']));_0x109b9[_0xbaaf('0x38')]=_0x109b9['attributes']['length']?_0x109b9['attributes']:_0x5b910f[_0xbaaf('0x31')];if(!_0x361550[_0xbaaf('0x34')][_0xbaaf('0x39')](_0xbaaf('0x3a'))){_0x109b9[_0xbaaf('0x21')]=qs[_0xbaaf('0x21')](_0x361550[_0xbaaf('0x34')]['limit']);_0x109b9[_0xbaaf('0x1f')]=qs['offset'](_0x361550[_0xbaaf('0x34')][_0xbaaf('0x1f')]);}_0x109b9['order']=qs[_0xbaaf('0x3b')](_0x361550[_0xbaaf('0x34')][_0xbaaf('0x3b')]);_0x109b9[_0xbaaf('0x3c')]=qs['filters'](_[_0xbaaf('0x3d')](_0x361550[_0xbaaf('0x34')],_0x5b910f[_0xbaaf('0x35')]),_0x97b506);if(_0x361550['query'][_0xbaaf('0x3e')]){_0x109b9['where']=_['merge'](_0x109b9['where'],{'$or':_[_0xbaaf('0x32')](_0x97b506,function(_0x41033c){if(_0x41033c[_0xbaaf('0x2f')]!==_0xbaaf('0x3f')){var _0x21c950={};_0x21c950[_0x41033c[_0xbaaf('0x2a')]]={'$like':'%'+_0x361550['query'][_0xbaaf('0x3e')]+'%'};return _0x21c950;}})});}_0x109b9=_[_0xbaaf('0x40')]({},_0x109b9,_0x361550[_0xbaaf('0x41')]);var _0x314c1a={'where':_0x109b9[_0xbaaf('0x3c')]};return db[_0xbaaf('0x42')][_0xbaaf('0x43')](_0x314c1a)[_0xbaaf('0x25')](function(_0xf88c24){_0x16d10b[_0xbaaf('0x43')]=_0xf88c24;if(_0x361550[_0xbaaf('0x34')]['includeAll']){_0x109b9[_0xbaaf('0x44')]=[{'all':!![]}];}return db[_0xbaaf('0x42')][_0xbaaf('0x45')](_0x109b9);})['then'](function(_0xa20171){_0x16d10b[_0xbaaf('0x46')]=_0xa20171;return _0x16d10b;})[_0xbaaf('0x25')](respondWithFilteredResult(_0x5311a9,_0x109b9))['catch'](handleError(_0x5311a9,null));};exports[_0xbaaf('0x47')]=function(_0x36df9b,_0x276128){var _0x1b717a={'raw':!![],'where':{'id':_0x36df9b[_0xbaaf('0x48')]['id']}},_0x2ef4={};_0x2ef4[_0xbaaf('0x31')]=_[_0xbaaf('0x33')](db['Sound'][_0xbaaf('0x2d')]);_0x2ef4['query']=_['keys'](_0x36df9b[_0xbaaf('0x34')]);_0x2ef4['filters']=_[_0xbaaf('0x36')](_0x2ef4[_0xbaaf('0x31')],_0x2ef4[_0xbaaf('0x34')]);_0x1b717a[_0xbaaf('0x38')]=_[_0xbaaf('0x36')](_0x2ef4[_0xbaaf('0x31')],qs[_0xbaaf('0x37')](_0x36df9b['query'][_0xbaaf('0x37')]));_0x1b717a[_0xbaaf('0x38')]=_0x1b717a[_0xbaaf('0x38')][_0xbaaf('0x49')]?_0x1b717a['attributes']:_0x2ef4[_0xbaaf('0x31')];if(_0x36df9b[_0xbaaf('0x34')][_0xbaaf('0x4a')]){_0x1b717a[_0xbaaf('0x44')]=[{'all':!![]}];}_0x1b717a=_[_0xbaaf('0x40')]({},_0x1b717a,_0x36df9b[_0xbaaf('0x41')]);return db[_0xbaaf('0x42')][_0xbaaf('0x4b')](_0x1b717a)[_0xbaaf('0x25')](handleEntityNotFound(_0x276128,null))[_0xbaaf('0x25')](respondWithResult(_0x276128,null))['catch'](handleError(_0x276128,null));};exports[_0xbaaf('0x4c')]=function(_0x17b67b,_0x3c393d,_0x1515ac){return db[_0xbaaf('0x42')][_0xbaaf('0x4b')]({'where':{'id':_0x17b67b[_0xbaaf('0x48')]['id']},'attributes':[_0xbaaf('0x2a'),_0xbaaf('0x4d'),_0xbaaf('0x4e')],'raw':!![]})[_0xbaaf('0x25')](handleEntityNotFound(_0x3c393d,null))[_0xbaaf('0x25')](function(_0x2ff47a){if(_0x2ff47a){if(!fs[_0xbaaf('0x4f')](path[_0xbaaf('0x50')](config[_0xbaaf('0x51')],_0xbaaf('0x52'),_0x2ff47a['save_name']+'.'+_0x2ff47a[_0xbaaf('0x4e')]))){throw new db[(_0xbaaf('0x53'))]['ValidationError']('Sound\x20not\x20found');}return _0x3c393d['download'](path[_0xbaaf('0x50')](config['root'],_0xbaaf('0x52'),util[_0xbaaf('0x54')]('%s.%s',_0x2ff47a[_0xbaaf('0x4d')],_0x2ff47a[_0xbaaf('0x4e')])),util['format'](_0xbaaf('0x55'),_0x2ff47a[_0xbaaf('0x2a')],_0x2ff47a['converted_format']));}return null;})[_0xbaaf('0x56')](handleError(_0x3c393d,null));};exports[_0xbaaf('0x57')]=function(_0x462bab,_0x717f62,_0x452974){var _0x56fa44={'name':path[_0xbaaf('0x58')](_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5a')],path[_0xbaaf('0x5b')](_0x462bab[_0xbaaf('0x59')]['originalname'])),'save_name':path[_0xbaaf('0x58')](_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5c')],path[_0xbaaf('0x5b')](_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5c')])),'original_format':path[_0xbaaf('0x5b')](_0x462bab['file'][_0xbaaf('0x5a')])['substring'](0x1),'converted_format':'wav'};var _0x39200d=path['join'](config[_0xbaaf('0x51')],_0xbaaf('0x5d'),_0x462bab[_0xbaaf('0x59')][_0xbaaf('0x5c')]);var _0x409256=path[_0xbaaf('0x50')](config[_0xbaaf('0x51')],'server/files/sounds/converted',util['format'](_0xbaaf('0x55'),path[_0xbaaf('0x58')](_0x462bab[_0xbaaf('0x59')]['filename'],path['extname'](_0x462bab['file']['filename'])),_0x56fa44['converted_format']));logger[_0xbaaf('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x39200d);logger[_0xbaaf('0x5e')](_0xbaaf('0x5f'),_0x409256);try{fs[_0xbaaf('0x60')](_0x39200d,parseInt(_0xbaaf('0x61'),0x8));var _0x50815c=sox[_0xbaaf('0x62')](_0x39200d,_0x409256,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50815c['on']('error',function(_0x520735){fs[_0xbaaf('0x63')](_0x39200d);_0x717f62[_0xbaaf('0x1c')](0x1f4)[_0xbaaf('0x2b')](_0x520735);});_0x50815c['on'](_0xbaaf('0x64'),function(_0x4938d0){_0x56fa44[_0xbaaf('0x65')]=isNaN(_0x4938d0[_0xbaaf('0x66')])?null:_0x4938d0[_0xbaaf('0x66')]*0x3e8;_0x56fa44[_0xbaaf('0x67')]=isNaN(_0x4938d0[_0xbaaf('0x68')])?null:_0x4938d0[_0xbaaf('0x68')];_0x56fa44[_0xbaaf('0x69')]=isNaN(_0x4938d0[_0xbaaf('0x6a')])?null:_0x4938d0[_0xbaaf('0x6a')];_0x56fa44[_0xbaaf('0x6b')]=isNaN(_0x4938d0[_0xbaaf('0x6c')])?null:_0x4938d0['bitRate'];_0x56fa44[_0xbaaf('0x6d')]=isNaN(_0x4938d0[_0xbaaf('0x6e')])?null:_0x4938d0['sampleRate'];});_0x50815c['on'](_0xbaaf('0x6f'),function(_0x1686ce){_0x56fa44['converted_duration']=isNaN(_0x1686ce['duration'])?null:_0x1686ce['duration']*0x3e8;_0x56fa44[_0xbaaf('0x70')]=isNaN(_0x1686ce['sampleCount'])?null:_0x1686ce[_0xbaaf('0x68')];_0x56fa44[_0xbaaf('0x71')]=isNaN(_0x1686ce[_0xbaaf('0x6a')])?null:_0x1686ce[_0xbaaf('0x6a')];_0x56fa44['converted_bitRate']=isNaN(_0x1686ce[_0xbaaf('0x6c')])?null:_0x1686ce[_0xbaaf('0x6c')];_0x56fa44[_0xbaaf('0x72')]=isNaN(_0x1686ce[_0xbaaf('0x6e')])?null:_0x1686ce[_0xbaaf('0x6e')];});_0x50815c['on'](_0xbaaf('0x1d'),function(){fs[_0xbaaf('0x60')](_0x409256,parseInt('0777',0x8));return db[_0xbaaf('0x42')][_0xbaaf('0x57')](_0x56fa44)[_0xbaaf('0x25')](function(_0x16abe1){var _0x4e8a12={'role':_0x462bab['body'][_0xbaaf('0x73')],'userProfileId':_0x462bab['body'][_0xbaaf('0x74')]};if(!_0x4e8a12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e8a12[_0xbaaf('0x73')]===_0xbaaf('0x75')){var _0x3595c2=_0x16abe1[_0xbaaf('0x27')]({'plain':!![]});return db[_0xbaaf('0x76')]['find']({'where':{'name':_0xbaaf('0x77'),'userProfileId':_0x4e8a12[_0xbaaf('0x74')]},'raw':!![]})['then'](function(_0x1f4b48){if(_0x1f4b48&&_0x1f4b48[_0xbaaf('0x78')]===0x0){return db[_0xbaaf('0x28')][_0xbaaf('0x57')]({'name':_0x3595c2[_0xbaaf('0x2a')],'resourceId':_0x3595c2['id'],'type':_0x1f4b48[_0xbaaf('0x2a')],'sectionId':_0x1f4b48['id']},{})[_0xbaaf('0x25')](function(){return _0x16abe1;});}else{return _0x16abe1;}})[_0xbaaf('0x56')](function(_0x2bcb05){logger[_0xbaaf('0x29')](_0xbaaf('0x79'),_0x2bcb05);throw _0x2bcb05;});}return _0x16abe1;})['then'](respondWithResult(_0x717f62,null))[_0xbaaf('0x56')](handleError(_0x717f62,null));});_0x50815c[_0xbaaf('0x7a')]();}catch(_0x541b6a){_0x717f62['status'](0x1f4)[_0xbaaf('0x2b')](_0x541b6a);}};exports[_0xbaaf('0x24')]=function(_0x57fa23,_0x4ff5b5,_0x5a17db){return db[_0xbaaf('0x42')]['find']({'where':{'id':_0x57fa23['params']['id']}})[_0xbaaf('0x25')](handleEntityNotFound(_0x4ff5b5,null))['then'](saveUpdates(_['pick'](_0x57fa23[_0xbaaf('0x7b')],[_0xbaaf('0x2a'),'description']),null))[_0xbaaf('0x25')](respondWithResult(_0x4ff5b5,null))[_0xbaaf('0x56')](handleError(_0x4ff5b5,null));};exports['delete']=function(_0xf05c4d,_0x84b01a,_0x5038c0){return db[_0xbaaf('0x42')][_0xbaaf('0x4b')]({'where':{'id':_0xf05c4d[_0xbaaf('0x48')]['id']}})[_0xbaaf('0x25')](function(_0x103af2){if(_0x103af2){return _0x103af2[_0xbaaf('0x26')]();}})[_0xbaaf('0x25')](function(_0x404d3c){var _0x1871d2=path['join'](config[_0xbaaf('0x51')],_0xbaaf('0x5d'),util[_0xbaaf('0x54')](_0xbaaf('0x55'),_0x404d3c[_0xbaaf('0x4d')],_0x404d3c[_0xbaaf('0x7c')]));var _0x11017a=path[_0xbaaf('0x50')](config[_0xbaaf('0x51')],'server/files/sounds/converted',util['format'](_0xbaaf('0x55'),_0x404d3c[_0xbaaf('0x4d')],_0x404d3c[_0xbaaf('0x4e')]));fs[_0xbaaf('0x63')](_0x1871d2);fs[_0xbaaf('0x63')](_0x11017a);return _0x404d3c;})[_0xbaaf('0x25')](function(_0x4d50c3){if(_0x4d50c3){return _0x84b01a[_0xbaaf('0x1c')](0xcc)[_0xbaaf('0x1d')]();}})[_0xbaaf('0x25')](handleEntityNotFound(_0x84b01a,null))[_0xbaaf('0x56')](handleError(_0x84b01a,null));}; \ No newline at end of file +var _0x11a2=['chmodSync','0777','unlinkSync','send','src','original_duration','duration','sampleCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','start','description','original_format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','end','error','stack','name','index','map','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','merge','options','Sound','includeAll','include','rows','show','params','rawAttributes','find','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download','root','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s'];(function(_0x16eb19,_0x58cea4){var _0x312a25=function(_0x343702){while(--_0x343702){_0x16eb19['push'](_0x16eb19['shift']());}};_0x312a25(++_0x58cea4);}(_0x11a2,0x95));var _0x211a=function(_0x1e5b88,_0x2dabbb){_0x1e5b88=_0x1e5b88-0x0;var _0x4e2876=_0x11a2[_0x1e5b88];return _0x4e2876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x211a('0x0'));var zipdir=require(_0x211a('0x1'));var jsonpatch=require(_0x211a('0x2'));var rp=require('request-promise');var moment=require(_0x211a('0x3'));var BPromise=require(_0x211a('0x4'));var Mustache=require(_0x211a('0x5'));var util=require('util');var path=require(_0x211a('0x6'));var sox=require(_0x211a('0x7'));var csv=require(_0x211a('0x8'));var ejs=require(_0x211a('0x9'));var fs=require('fs');var fs_extra=require(_0x211a('0xa'));var _=require(_0x211a('0xb'));var squel=require(_0x211a('0xc'));var crypto=require(_0x211a('0xd'));var jsforce=require(_0x211a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x211a('0x8'));var querystring=require(_0x211a('0xf'));var Papa=require(_0x211a('0x10'));var Redis=require(_0x211a('0x11'));var authService=require(_0x211a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x211a('0x13'))('api');var utils=require(_0x211a('0x14'));var config=require(_0x211a('0x15'));var licenseUtil=require(_0x211a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aee4e,_0x1cd0e2){_0x1cd0e2=_0x1cd0e2||0xcc;return function(_0x5942a5){if(_0x5942a5){return _0x3aee4e[_0x211a('0x17')](_0x1cd0e2);}return _0x3aee4e['status'](_0x1cd0e2)['end']();};}function respondWithResult(_0x32fbe9,_0x387c16){_0x387c16=_0x387c16||0xc8;return function(_0x37fae3){if(_0x37fae3){return _0x32fbe9[_0x211a('0x18')](_0x387c16)['json'](_0x37fae3);}};}function respondWithFilteredResult(_0x136d14,_0x5c2828){return function(_0x294900){if(_0x294900){var _0x58e6be=typeof _0x5c2828[_0x211a('0x19')]==='undefined'&&typeof _0x5c2828[_0x211a('0x1a')]==='undefined';var _0x543b4f=_0x294900[_0x211a('0x1b')];var _0x1c40e2=_0x58e6be?0x0:_0x5c2828[_0x211a('0x19')];var _0x593b5f=_0x58e6be?_0x294900['count']:_0x5c2828['offset']+_0x5c2828[_0x211a('0x1a')];var _0x5e37c0;if(_0x593b5f>=_0x543b4f){_0x593b5f=_0x543b4f;_0x5e37c0=0xc8;}else{_0x5e37c0=0xce;}_0x136d14['status'](_0x5e37c0);return _0x136d14[_0x211a('0x1c')](_0x211a('0x1d'),_0x1c40e2+'-'+_0x593b5f+'/'+_0x543b4f)['json'](_0x294900);}return null;};}function patchUpdates(_0x26f738){return function(_0x28f52c){try{jsonpatch[_0x211a('0x1e')](_0x28f52c,_0x26f738,!![]);}catch(_0x30e24a){return BPromise[_0x211a('0x1f')](_0x30e24a);}return _0x28f52c[_0x211a('0x20')]();};}function saveUpdates(_0x3b6632,_0x338c9f){return function(_0xf11e1b){if(_0xf11e1b){return _0xf11e1b[_0x211a('0x21')](_0x3b6632)[_0x211a('0x22')](function(_0xec2af3){return _0xec2af3;});}return null;};}function removeEntity(_0x926260,_0x5db4f5){return function(_0x16479b){if(_0x16479b){return _0x16479b['destroy']()[_0x211a('0x22')](function(){var _0x5333dd=_0x16479b[_0x211a('0x23')]({'plain':!![]});var _0x1b890e=_0x211a('0x24');return db[_0x211a('0x25')][_0x211a('0x26')]({'where':{'type':_0x1b890e,'resourceId':_0x5333dd['id']}})[_0x211a('0x22')](function(){return _0x16479b;});})[_0x211a('0x22')](function(){_0x926260['status'](0xcc)[_0x211a('0x27')]();});}};}function handleEntityNotFound(_0x13755f,_0x35f589){return function(_0x41c061){if(!_0x41c061){_0x13755f[_0x211a('0x17')](0x194);}return _0x41c061;};}function handleError(_0x303408,_0x5aa379){_0x5aa379=_0x5aa379||0x1f4;return function(_0x27ee43){logger[_0x211a('0x28')](_0x27ee43[_0x211a('0x29')]);if(_0x27ee43[_0x211a('0x2a')]){delete _0x27ee43[_0x211a('0x2a')];}_0x303408[_0x211a('0x18')](_0x5aa379)['send'](_0x27ee43);};}exports[_0x211a('0x2b')]=function(_0x3e9325,_0x29fbcc){var _0x2bf21a={},_0x6a294={},_0x5a58db={'count':0x0,'rows':[]};var _0x3f3e35=_[_0x211a('0x2c')](db['Sound']['rawAttributes'],function(_0x32c1dc){return{'name':_0x32c1dc['fieldName'],'type':_0x32c1dc['type'][_0x211a('0x2d')]};});_0x6a294[_0x211a('0x2e')]=_[_0x211a('0x2c')](_0x3f3e35,_0x211a('0x2a'));_0x6a294['query']=_[_0x211a('0x2f')](_0x3e9325[_0x211a('0x30')]);_0x6a294[_0x211a('0x31')]=_[_0x211a('0x32')](_0x6a294[_0x211a('0x2e')],_0x6a294[_0x211a('0x30')]);_0x2bf21a[_0x211a('0x33')]=_[_0x211a('0x32')](_0x6a294[_0x211a('0x2e')],qs[_0x211a('0x34')](_0x3e9325['query']['fields']));_0x2bf21a['attributes']=_0x2bf21a[_0x211a('0x33')][_0x211a('0x35')]?_0x2bf21a[_0x211a('0x33')]:_0x6a294[_0x211a('0x2e')];if(!_0x3e9325['query'][_0x211a('0x36')](_0x211a('0x37'))){_0x2bf21a[_0x211a('0x1a')]=qs[_0x211a('0x1a')](_0x3e9325[_0x211a('0x30')][_0x211a('0x1a')]);_0x2bf21a[_0x211a('0x19')]=qs['offset'](_0x3e9325[_0x211a('0x30')]['offset']);}_0x2bf21a[_0x211a('0x38')]=qs[_0x211a('0x39')](_0x3e9325[_0x211a('0x30')][_0x211a('0x39')]);_0x2bf21a['where']=qs[_0x211a('0x31')](_[_0x211a('0x3a')](_0x3e9325[_0x211a('0x30')],_0x6a294[_0x211a('0x31')]),_0x3f3e35);if(_0x3e9325['query']['filter']){_0x2bf21a[_0x211a('0x3b')]=_['merge'](_0x2bf21a[_0x211a('0x3b')],{'$or':_[_0x211a('0x2c')](_0x3f3e35,function(_0x2c275e){if(_0x2c275e[_0x211a('0x3c')]!=='VIRTUAL'){var _0x5bb4fc={};_0x5bb4fc[_0x2c275e[_0x211a('0x2a')]]={'$like':'%'+_0x3e9325[_0x211a('0x30')]['filter']+'%'};return _0x5bb4fc;}})});}_0x2bf21a=_[_0x211a('0x3d')]({},_0x2bf21a,_0x3e9325[_0x211a('0x3e')]);var _0x99acdd={'where':_0x2bf21a[_0x211a('0x3b')]};return db[_0x211a('0x3f')][_0x211a('0x1b')](_0x99acdd)[_0x211a('0x22')](function(_0x5d289d){_0x5a58db[_0x211a('0x1b')]=_0x5d289d;if(_0x3e9325[_0x211a('0x30')][_0x211a('0x40')]){_0x2bf21a[_0x211a('0x41')]=[{'all':!![]}];}return db[_0x211a('0x3f')]['findAll'](_0x2bf21a);})[_0x211a('0x22')](function(_0x5d72bc){_0x5a58db[_0x211a('0x42')]=_0x5d72bc;return _0x5a58db;})[_0x211a('0x22')](respondWithFilteredResult(_0x29fbcc,_0x2bf21a))['catch'](handleError(_0x29fbcc,null));};exports[_0x211a('0x43')]=function(_0x3d99f7,_0x4a8096){var _0x3e1b37={'raw':!![],'where':{'id':_0x3d99f7[_0x211a('0x44')]['id']}},_0x3cf931={};_0x3cf931[_0x211a('0x2e')]=_[_0x211a('0x2f')](db[_0x211a('0x3f')][_0x211a('0x45')]);_0x3cf931[_0x211a('0x30')]=_[_0x211a('0x2f')](_0x3d99f7[_0x211a('0x30')]);_0x3cf931[_0x211a('0x31')]=_[_0x211a('0x32')](_0x3cf931[_0x211a('0x2e')],_0x3cf931['query']);_0x3e1b37[_0x211a('0x33')]=_[_0x211a('0x32')](_0x3cf931[_0x211a('0x2e')],qs['fields'](_0x3d99f7['query'][_0x211a('0x34')]));_0x3e1b37[_0x211a('0x33')]=_0x3e1b37[_0x211a('0x33')][_0x211a('0x35')]?_0x3e1b37[_0x211a('0x33')]:_0x3cf931['model'];if(_0x3d99f7['query'][_0x211a('0x40')]){_0x3e1b37[_0x211a('0x41')]=[{'all':!![]}];}_0x3e1b37=_['merge']({},_0x3e1b37,_0x3d99f7[_0x211a('0x3e')]);return db[_0x211a('0x3f')][_0x211a('0x46')](_0x3e1b37)['then'](handleEntityNotFound(_0x4a8096,null))['then'](respondWithResult(_0x4a8096,null))['catch'](handleError(_0x4a8096,null));};exports['download']=function(_0x2f5758,_0x53e314,_0x4ebaaa){return db[_0x211a('0x3f')]['find']({'where':{'id':_0x2f5758[_0x211a('0x44')]['id']},'attributes':['name','save_name',_0x211a('0x47')],'raw':!![]})[_0x211a('0x22')](handleEntityNotFound(_0x53e314,null))[_0x211a('0x22')](function(_0x42215a){if(_0x42215a){if(!fs[_0x211a('0x48')](path[_0x211a('0x49')](config['root'],_0x211a('0x4a'),_0x42215a[_0x211a('0x4b')]+'.'+_0x42215a['converted_format']))){throw new db[(_0x211a('0x4c'))][(_0x211a('0x4d'))](_0x211a('0x4e'));}return _0x53e314[_0x211a('0x4f')](path[_0x211a('0x49')](config[_0x211a('0x50')],_0x211a('0x4a'),util['format'](_0x211a('0x51'),_0x42215a['save_name'],_0x42215a[_0x211a('0x47')])),util[_0x211a('0x52')](_0x211a('0x51'),_0x42215a['name'],_0x42215a[_0x211a('0x47')]));}return null;})['catch'](handleError(_0x53e314,null));};exports[_0x211a('0x53')]=function(_0x2fda4f,_0x3a07a5,_0x409fef){var _0x3bea88={'name':path[_0x211a('0x54')](_0x2fda4f[_0x211a('0x55')][_0x211a('0x56')],path[_0x211a('0x57')](_0x2fda4f[_0x211a('0x55')][_0x211a('0x56')])),'save_name':path[_0x211a('0x54')](_0x2fda4f[_0x211a('0x55')][_0x211a('0x58')],path[_0x211a('0x57')](_0x2fda4f[_0x211a('0x55')][_0x211a('0x58')])),'original_format':path['extname'](_0x2fda4f['file'][_0x211a('0x56')])[_0x211a('0x59')](0x1),'converted_format':_0x211a('0x5a')};var _0x40e894=path[_0x211a('0x49')](config[_0x211a('0x50')],_0x211a('0x5b'),_0x2fda4f[_0x211a('0x55')][_0x211a('0x58')]);var _0xc8686b=path['join'](config[_0x211a('0x50')],_0x211a('0x4a'),util[_0x211a('0x52')](_0x211a('0x51'),path[_0x211a('0x54')](_0x2fda4f[_0x211a('0x55')]['filename'],path[_0x211a('0x57')](_0x2fda4f['file']['filename'])),_0x3bea88[_0x211a('0x47')]));logger[_0x211a('0x5c')](_0x211a('0x5d'),_0x40e894);logger[_0x211a('0x5c')](_0x211a('0x5e'),_0xc8686b);try{fs[_0x211a('0x5f')](_0x40e894,parseInt(_0x211a('0x60'),0x8));var _0x3f1c1e=sox['transcode'](_0x40e894,_0xc8686b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3f1c1e['on'](_0x211a('0x28'),function(_0x5a25b3){fs[_0x211a('0x61')](_0x40e894);_0x3a07a5[_0x211a('0x18')](0x1f4)[_0x211a('0x62')](_0x5a25b3);});_0x3f1c1e['on'](_0x211a('0x63'),function(_0x3d678a){_0x3bea88[_0x211a('0x64')]=isNaN(_0x3d678a[_0x211a('0x65')])?null:_0x3d678a[_0x211a('0x65')]*0x3e8;_0x3bea88['original_sampleCount']=isNaN(_0x3d678a[_0x211a('0x66')])?null:_0x3d678a[_0x211a('0x66')];_0x3bea88['original_channelCount']=isNaN(_0x3d678a['channelCount'])?null:_0x3d678a['channelCount'];_0x3bea88[_0x211a('0x67')]=isNaN(_0x3d678a[_0x211a('0x68')])?null:_0x3d678a[_0x211a('0x68')];_0x3bea88['original_sampleRate']=isNaN(_0x3d678a[_0x211a('0x69')])?null:_0x3d678a['sampleRate'];});_0x3f1c1e['on'](_0x211a('0x6a'),function(_0x4a5397){_0x3bea88[_0x211a('0x6b')]=isNaN(_0x4a5397[_0x211a('0x65')])?null:_0x4a5397['duration']*0x3e8;_0x3bea88[_0x211a('0x6c')]=isNaN(_0x4a5397['sampleCount'])?null:_0x4a5397['sampleCount'];_0x3bea88[_0x211a('0x6d')]=isNaN(_0x4a5397[_0x211a('0x6e')])?null:_0x4a5397[_0x211a('0x6e')];_0x3bea88['converted_bitRate']=isNaN(_0x4a5397[_0x211a('0x68')])?null:_0x4a5397[_0x211a('0x68')];_0x3bea88['converted_sampleRate']=isNaN(_0x4a5397['sampleRate'])?null:_0x4a5397[_0x211a('0x69')];});_0x3f1c1e['on']('end',function(){fs['chmodSync'](_0xc8686b,parseInt('0777',0x8));return db['Sound'][_0x211a('0x53')](_0x3bea88)[_0x211a('0x22')](function(_0x17d931){var _0x75f298={'role':_0x2fda4f[_0x211a('0x6f')][_0x211a('0x70')],'userProfileId':_0x2fda4f[_0x211a('0x6f')]['userProfileId']};if(!_0x75f298)throw new Error(_0x211a('0x71'));if(_0x75f298[_0x211a('0x70')]===_0x211a('0x72')){var _0xe9bb6a=_0x17d931[_0x211a('0x23')]({'plain':!![]});return db[_0x211a('0x73')]['find']({'where':{'name':_0x211a('0x24'),'userProfileId':_0x75f298['userProfileId']},'raw':!![]})[_0x211a('0x22')](function(_0x1c7486){if(_0x1c7486&&_0x1c7486[_0x211a('0x74')]===0x0){return db['UserProfileResource'][_0x211a('0x53')]({'name':_0xe9bb6a[_0x211a('0x2a')],'resourceId':_0xe9bb6a['id'],'type':_0x1c7486[_0x211a('0x2a')],'sectionId':_0x1c7486['id']},{})['then'](function(){return _0x17d931;});}else{return _0x17d931;}})['catch'](function(_0x380e26){logger['error'](_0x211a('0x75'),_0x380e26);throw _0x380e26;});}return _0x17d931;})[_0x211a('0x22')](respondWithResult(_0x3a07a5,null))[_0x211a('0x76')](handleError(_0x3a07a5,null));});_0x3f1c1e[_0x211a('0x77')]();}catch(_0x6948fb){_0x3a07a5['status'](0x1f4)[_0x211a('0x62')](_0x6948fb);}};exports[_0x211a('0x21')]=function(_0x5485c2,_0x379a4d,_0x47ffa4){return db[_0x211a('0x3f')]['find']({'where':{'id':_0x5485c2[_0x211a('0x44')]['id']}})[_0x211a('0x22')](handleEntityNotFound(_0x379a4d,null))['then'](saveUpdates(_[_0x211a('0x3a')](_0x5485c2[_0x211a('0x6f')],['name',_0x211a('0x78')]),null))['then'](respondWithResult(_0x379a4d,null))[_0x211a('0x76')](handleError(_0x379a4d,null));};exports['delete']=function(_0x267477,_0x27f8c3,_0x33f3ee){return db[_0x211a('0x3f')][_0x211a('0x46')]({'where':{'id':_0x267477[_0x211a('0x44')]['id']}})['then'](function(_0x40e75f){if(_0x40e75f){return _0x40e75f[_0x211a('0x26')]();}})[_0x211a('0x22')](function(_0xc55f78){var _0x19a849=path[_0x211a('0x49')](config['root'],_0x211a('0x5b'),util[_0x211a('0x52')]('%s.%s',_0xc55f78[_0x211a('0x4b')],_0xc55f78[_0x211a('0x79')]));var _0x41fe6e=path['join'](config[_0x211a('0x50')],_0x211a('0x4a'),util[_0x211a('0x52')]('%s.%s',_0xc55f78['save_name'],_0xc55f78[_0x211a('0x47')]));fs[_0x211a('0x61')](_0x19a849);fs[_0x211a('0x61')](_0x41fe6e);return _0xc55f78;})[_0x211a('0x22')](function(_0x350d26){if(_0x350d26){return _0x27f8c3[_0x211a('0x18')](0xcc)[_0x211a('0x27')]();}})['then'](handleEntityNotFound(_0x27f8c3,null))[_0x211a('0x76')](handleError(_0x27f8c3,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e0c8c91..219c1ad 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 _0x0feb=['define','Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x46c087,_0x3db911){var _0x3b0c0b=function(_0x37d1a1){while(--_0x37d1a1){_0x46c087['push'](_0x46c087['shift']());}};_0x3b0c0b(++_0x3db911);}(_0x0feb,0x1dc));var _0xb0fe=function(_0x2dc78c,_0x3f8259){_0x2dc78c=_0x2dc78c-0x0;var _0x2f0753=_0x0feb[_0x2dc78c];return _0x2f0753;};'use strict';var _=require(_0xb0fe('0x0'));var util=require(_0xb0fe('0x1'));var logger=require('../../config/logger')(_0xb0fe('0x2'));var moment=require(_0xb0fe('0x3'));var BPromise=require(_0xb0fe('0x4'));var rp=require(_0xb0fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0fe('0x6'));var attributes=require('./sound.attributes');module[_0xb0fe('0x7')]=function(_0x1f4633,_0x59933e){return _0x1f4633[_0xb0fe('0x8')](_0xb0fe('0x9'),attributes,{'tableName':_0xb0fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a29=['path','rimraf','./sound.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x36537a,_0x1604d2){var _0x625775=function(_0x4fea51){while(--_0x4fea51){_0x36537a['push'](_0x36537a['shift']());}};_0x625775(++_0x1604d2);}(_0x1a29,0x113));var _0x91a2=function(_0x554e24,_0x4ef8f6){_0x554e24=_0x554e24-0x0;var _0x25b475=_0x1a29[_0x554e24];return _0x25b475;};'use strict';var _=require(_0x91a2('0x0'));var util=require(_0x91a2('0x1'));var logger=require(_0x91a2('0x2'))(_0x91a2('0x3'));var moment=require('moment');var BPromise=require(_0x91a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91a2('0x5'));var rimraf=require(_0x91a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x91a2('0x7'));module[_0x91a2('0x8')]=function(_0x14c395,_0x503212){return _0x14c395[_0x91a2('0x9')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 84283b3..60ded0d 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 _0x643b=['attributes','include','map','model','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where'];(function(_0x4ad53c,_0x28e859){var _0x18c534=function(_0x2ff871){while(--_0x2ff871){_0x4ad53c['push'](_0x4ad53c['shift']());}};_0x18c534(++_0x28e859);}(_0x643b,0x11b));var _0xb643=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x643b[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xb643('0x0'));var moment=require(_0xb643('0x1'));var BPromise=require('bluebird');var rs=require(_0xb643('0x2'));var fs=require('fs');var Redis=require(_0xb643('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb643('0x4'));var logger=require(_0xb643('0x5'))(_0xb643('0x6'));var config=require(_0xb643('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb643('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57598c,_0x41103d,_0x4b0516){return new BPromise(function(_0x2417d5,_0x2ea1dd){return client['request'](_0x57598c,_0x4b0516)[_0xb643('0x9')](function(_0x5462e2){logger[_0xb643('0xa')](_0xb643('0xb'),_0x41103d,'request\x20sent');logger[_0xb643('0xc')](_0xb643('0xd'),_0x41103d,_0xb643('0xe'),JSON[_0xb643('0xf')](_0x5462e2));if(_0x5462e2[_0xb643('0x10')]){if(_0x5462e2[_0xb643('0x10')][_0xb643('0x11')]===0x1f4){logger[_0xb643('0x10')]('Sound,\x20%s,\x20%s',_0x41103d,_0x5462e2[_0xb643('0x10')][_0xb643('0x12')]);return _0x2ea1dd(_0x5462e2[_0xb643('0x10')][_0xb643('0x12')]);}logger[_0xb643('0x10')]('Sound,\x20%s,\x20%s',_0x41103d,_0x5462e2[_0xb643('0x10')]['message']);return _0x2417d5(_0x5462e2['error'][_0xb643('0x12')]);}else{logger[_0xb643('0xa')](_0xb643('0xb'),_0x41103d,_0xb643('0xe'));_0x2417d5(_0x5462e2[_0xb643('0x13')][_0xb643('0x12')]);}})[_0xb643('0x14')](function(_0x5d6b56){logger['error'](_0xb643('0xb'),_0x41103d,_0x5d6b56);_0x2ea1dd(_0x5d6b56);});});}exports[_0xb643('0x15')]=function(_0x10b2d5){var _0x13a3aa=this;return new Promise(function(_0x1c8bd5,_0x5203b4){return db[_0xb643('0x16')][_0xb643('0x17')]({'raw':_0x10b2d5[_0xb643('0x18')]?_0x10b2d5['options'][_0xb643('0x19')]===undefined?!![]:![]:!![],'where':_0x10b2d5[_0xb643('0x18')]?_0x10b2d5['options'][_0xb643('0x1a')]||null:null,'attributes':_0x10b2d5['options']?_0x10b2d5[_0xb643('0x18')][_0xb643('0x1b')]||null:null,'include':_0x10b2d5[_0xb643('0x18')]?_0x10b2d5['options'][_0xb643('0x1c')]?_[_0xb643('0x1d')](_0x10b2d5[_0xb643('0x18')][_0xb643('0x1c')],function(_0x514133){return{'model':db[_0x514133[_0xb643('0x1e')]],'as':_0x514133['as'],'attributes':_0x514133[_0xb643('0x1b')],'include':_0x514133[_0xb643('0x1c')]?_[_0xb643('0x1d')](_0x514133[_0xb643('0x1c')],function(_0x9a5920){return{'model':db[_0x9a5920[_0xb643('0x1e')]],'as':_0x9a5920['as'],'attributes':_0x9a5920[_0xb643('0x1b')],'include':_0x9a5920[_0xb643('0x1c')]?_[_0xb643('0x1d')](_0x9a5920[_0xb643('0x1c')],function(_0x327091){return{'model':db[_0x327091[_0xb643('0x1e')]],'as':_0x327091['as'],'attributes':_0x327091[_0xb643('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb643('0x9')](function(_0x23a25a){logger[_0xb643('0xa')](_0xb643('0x15'),_0x10b2d5);logger['debug'](_0xb643('0x15'),_0x10b2d5,JSON[_0xb643('0xf')](_0x23a25a));_0x1c8bd5(_0x23a25a);})['catch'](function(_0x37c299){logger[_0xb643('0x10')](_0xb643('0x15'),_0x37c299[_0xb643('0x12')],_0x10b2d5);_0x5203b4(_0x13a3aa[_0xb643('0x10')](0x1f4,_0x37c299[_0xb643('0x12')]));});});}; \ No newline at end of file +var _0xbca6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','Sound,\x20%s,\x20%s','result','catch','ShowSound','find','options','where','attributes','map','model','include','debug','stringify','lodash'];(function(_0xa2ac9,_0xf07f28){var _0x690e9b=function(_0x5b2582){while(--_0x5b2582){_0xa2ac9['push'](_0xa2ac9['shift']());}};_0x690e9b(++_0xf07f28);}(_0xbca6,0x1b1));var _0x6bca=function(_0x2bfcb1,_0x36cdea){_0x2bfcb1=_0x2bfcb1-0x0;var _0x399b18=_0xbca6[_0x2bfcb1];return _0x399b18;};'use strict';var _=require(_0x6bca('0x0'));var util=require(_0x6bca('0x1'));var moment=require(_0x6bca('0x2'));var BPromise=require(_0x6bca('0x3'));var rs=require(_0x6bca('0x4'));var fs=require('fs');var Redis=require(_0x6bca('0x5'));var db=require(_0x6bca('0x6'))['db'];var utils=require(_0x6bca('0x7'));var logger=require('../../config/logger')(_0x6bca('0x8'));var config=require('../../config/environment');var jayson=require(_0x6bca('0x9'));var client=jayson[_0x6bca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6e0bd,_0x13afde,_0x11cded){return new BPromise(function(_0x4e9e41,_0x20a655){return client['request'](_0xd6e0bd,_0x11cded)[_0x6bca('0xb')](function(_0x51e29e){logger[_0x6bca('0xc')]('Sound,\x20%s,\x20%s',_0x13afde,_0x6bca('0xd'));logger['debug'](_0x6bca('0xe'),_0x13afde,_0x6bca('0xd'),JSON['stringify'](_0x51e29e));if(_0x51e29e[_0x6bca('0xf')]){if(_0x51e29e[_0x6bca('0xf')][_0x6bca('0x10')]===0x1f4){logger[_0x6bca('0xf')]('Sound,\x20%s,\x20%s',_0x13afde,_0x51e29e[_0x6bca('0xf')][_0x6bca('0x11')]);return _0x20a655(_0x51e29e[_0x6bca('0xf')][_0x6bca('0x11')]);}logger['error'](_0x6bca('0x12'),_0x13afde,_0x51e29e[_0x6bca('0xf')][_0x6bca('0x11')]);return _0x4e9e41(_0x51e29e[_0x6bca('0xf')][_0x6bca('0x11')]);}else{logger[_0x6bca('0xc')](_0x6bca('0x12'),_0x13afde,_0x6bca('0xd'));_0x4e9e41(_0x51e29e[_0x6bca('0x13')]['message']);}})[_0x6bca('0x14')](function(_0x4a99eb){logger['error']('Sound,\x20%s,\x20%s',_0x13afde,_0x4a99eb);_0x20a655(_0x4a99eb);});});}exports[_0x6bca('0x15')]=function(_0x49787e){var _0xd89d64=this;return new Promise(function(_0x328bfa,_0xa2193e){return db['Sound'][_0x6bca('0x16')]({'raw':_0x49787e[_0x6bca('0x17')]?_0x49787e[_0x6bca('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x49787e['options']?_0x49787e['options'][_0x6bca('0x18')]||null:null,'attributes':_0x49787e[_0x6bca('0x17')]?_0x49787e[_0x6bca('0x17')][_0x6bca('0x19')]||null:null,'include':_0x49787e['options']?_0x49787e['options']['include']?_[_0x6bca('0x1a')](_0x49787e[_0x6bca('0x17')]['include'],function(_0x1b90bf){return{'model':db[_0x1b90bf[_0x6bca('0x1b')]],'as':_0x1b90bf['as'],'attributes':_0x1b90bf[_0x6bca('0x19')],'include':_0x1b90bf[_0x6bca('0x1c')]?_[_0x6bca('0x1a')](_0x1b90bf[_0x6bca('0x1c')],function(_0x5e12a9){return{'model':db[_0x5e12a9[_0x6bca('0x1b')]],'as':_0x5e12a9['as'],'attributes':_0x5e12a9[_0x6bca('0x19')],'include':_0x5e12a9[_0x6bca('0x1c')]?_[_0x6bca('0x1a')](_0x5e12a9[_0x6bca('0x1c')],function(_0x594aee){return{'model':db[_0x594aee[_0x6bca('0x1b')]],'as':_0x594aee['as'],'attributes':_0x594aee[_0x6bca('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6bca('0xb')](function(_0x33ee1e){logger[_0x6bca('0xc')](_0x6bca('0x15'),_0x49787e);logger[_0x6bca('0x1d')](_0x6bca('0x15'),_0x49787e,JSON[_0x6bca('0x1e')](_0x33ee1e));_0x328bfa(_0x33ee1e);})[_0x6bca('0x14')](function(_0x409c97){logger['error'](_0x6bca('0x15'),_0x409c97[_0x6bca('0x11')],_0x49787e);_0xa2193e(_0xd89d64[_0x6bca('0xf')](0x1f4,_0x409c97[_0x6bca('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 66c342e..fa37c63 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x17d4ae,_0x95fba7){var _0x54aa77=function(_0x4f4bdd){while(--_0x4f4bdd){_0x17d4ae['push'](_0x17d4ae['shift']());}};_0x54aa77(++_0x95fba7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x34d0ff,_0x32a807){_0x34d0ff=_0x34d0ff-0x0;var _0xcc474b=_0x9ffd[_0x34d0ff];return _0xcc474b;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0749450..659222a 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 _0x1b53=['sequelize','TEXT','medium','ENUM','out','STRING'];(function(_0x302416,_0x1b5caf){var _0x38d027=function(_0x15f8b0){while(--_0x15f8b0){_0x302416['push'](_0x302416['shift']());}};_0x38d027(++_0x1b5caf);}(_0x1b53,0x1da));var _0x31b5=function(_0x189194,_0xd7104d){_0x189194=_0x189194-0x0;var _0x352623=_0x1b53[_0x189194];return _0x352623;};'use strict';var Sequelize=require(_0x31b5('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x31b5('0x1')](_0x31b5('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x31b5('0x3')]('in',_0x31b5('0x4')),'defaultValue':_0x31b5('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x31b5('0x5')]},'providerResponse':{'type':Sequelize[_0x31b5('0x1')]}}; \ No newline at end of file +var _0xa29d=['medium','ENUM','out','TEXT','sequelize','exports','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa29d,0xa5));var _0xda29=function(_0x45f6ca,_0x431195){_0x45f6ca=_0x45f6ca-0x0;var _0x56dc03=_0xa29d[_0x45f6ca];return _0x56dc03;};'use strict';var Sequelize=require(_0xda29('0x0'));module[_0xda29('0x1')]={'uniqueid':{'type':Sequelize[_0xda29('0x2')]},'body':{'type':Sequelize['TEXT'](_0xda29('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xda29('0x4')]('in',_0xda29('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xda29('0x2')]},'providerResponse':{'type':Sequelize[_0xda29('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c539bd1..3c5b281 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 _0x7c93=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','catch','show','params','find','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2b41f0,_0x46f59b){var _0xf3365c=function(_0x1448cd){while(--_0x1448cd){_0x2b41f0['push'](_0x2b41f0['shift']());}};_0xf3365c(++_0x46f59b);}(_0x7c93,0x16e));var _0x37c9=function(_0x22423,_0x26bfb5){_0x22423=_0x22423-0x0;var _0x13989f=_0x7c93[_0x22423];return _0x13989f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x37c9('0x0'));var jsonpatch=require(_0x37c9('0x1'));var rp=require(_0x37c9('0x2'));var moment=require('moment');var BPromise=require(_0x37c9('0x3'));var Mustache=require(_0x37c9('0x4'));var util=require(_0x37c9('0x5'));var path=require(_0x37c9('0x6'));var sox=require(_0x37c9('0x7'));var csv=require(_0x37c9('0x8'));var ejs=require(_0x37c9('0x9'));var fs=require('fs');var fs_extra=require(_0x37c9('0xa'));var _=require(_0x37c9('0xb'));var squel=require(_0x37c9('0xc'));var crypto=require(_0x37c9('0xd'));var jsforce=require(_0x37c9('0xe'));var deskjs=require(_0x37c9('0xf'));var toCsv=require(_0x37c9('0x8'));var querystring=require(_0x37c9('0x10'));var Papa=require(_0x37c9('0x11'));var Redis=require(_0x37c9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x37c9('0x13'));var as=require(_0x37c9('0x14'));var hardwareService=require(_0x37c9('0x15'));var logger=require(_0x37c9('0x16'))(_0x37c9('0x17'));var utils=require(_0x37c9('0x18'));var config=require(_0x37c9('0x19'));var licenseUtil=require(_0x37c9('0x1a'));var db=require(_0x37c9('0x1b'))['db'];function respondWithStatusCode(_0x317144,_0x146b8a){_0x146b8a=_0x146b8a||0xcc;return function(_0x8a8e03){if(_0x8a8e03){return _0x317144['sendStatus'](_0x146b8a);}return _0x317144[_0x37c9('0x1c')](_0x146b8a)[_0x37c9('0x1d')]();};}function respondWithResult(_0x28dc4f,_0x1a6553){_0x1a6553=_0x1a6553||0xc8;return function(_0x33c07c){if(_0x33c07c){return _0x28dc4f[_0x37c9('0x1c')](_0x1a6553)[_0x37c9('0x1e')](_0x33c07c);}};}function respondWithFilteredResult(_0x1377d4,_0x1181da){return function(_0x5adecd){if(_0x5adecd){var _0x3bf156=typeof _0x1181da[_0x37c9('0x1f')]==='undefined'&&typeof _0x1181da[_0x37c9('0x20')]===_0x37c9('0x21');var _0x35b72d=_0x5adecd[_0x37c9('0x22')];var _0x3b03c1=_0x3bf156?0x0:_0x1181da[_0x37c9('0x1f')];var _0x3938c2=_0x3bf156?_0x5adecd['count']:_0x1181da['offset']+_0x1181da[_0x37c9('0x20')];var _0x157350;if(_0x3938c2>=_0x35b72d){_0x3938c2=_0x35b72d;_0x157350=0xc8;}else{_0x157350=0xce;}_0x1377d4[_0x37c9('0x1c')](_0x157350);return _0x1377d4[_0x37c9('0x23')](_0x37c9('0x24'),_0x3b03c1+'-'+_0x3938c2+'/'+_0x35b72d)[_0x37c9('0x1e')](_0x5adecd);}return null;};}function patchUpdates(_0x1c78d5){return function(_0x7253f6){try{jsonpatch[_0x37c9('0x25')](_0x7253f6,_0x1c78d5,!![]);}catch(_0x9b63fd){return BPromise[_0x37c9('0x26')](_0x9b63fd);}return _0x7253f6[_0x37c9('0x27')]();};}function saveUpdates(_0x5a1ef5,_0x3aa32a){return function(_0x48f2fe){if(_0x48f2fe){return _0x48f2fe[_0x37c9('0x28')](_0x5a1ef5)[_0x37c9('0x29')](function(_0x1c0eaf){return _0x1c0eaf;});}return null;};}function removeEntity(_0x15dbeb,_0x3c9931){return function(_0x30b8e3){if(_0x30b8e3){return _0x30b8e3[_0x37c9('0x2a')]()['then'](function(){_0x15dbeb[_0x37c9('0x1c')](0xcc)[_0x37c9('0x1d')]();});}};}function handleEntityNotFound(_0x463213,_0x37eb03){return function(_0x440677){if(!_0x440677){_0x463213[_0x37c9('0x2b')](0x194);}return _0x440677;};}function handleError(_0x4a2ade,_0x1875c8){_0x1875c8=_0x1875c8||0x1f4;return function(_0x53c7a9){logger[_0x37c9('0x2c')](_0x53c7a9['stack']);if(_0x53c7a9[_0x37c9('0x2d')]){delete _0x53c7a9['name'];}_0x4a2ade[_0x37c9('0x1c')](_0x1875c8)['send'](_0x53c7a9);};}exports['index']=function(_0x2966f6,_0x23542b){var _0xc2b21e={},_0x4f9ab7={},_0x10663c={'count':0x0,'rows':[]};var _0x57fc0b=_[_0x37c9('0x2e')](db['SquareMessage'][_0x37c9('0x2f')],function(_0x12daa3){return{'name':_0x12daa3[_0x37c9('0x30')],'type':_0x12daa3[_0x37c9('0x31')][_0x37c9('0x32')]};});_0x4f9ab7[_0x37c9('0x33')]=_[_0x37c9('0x2e')](_0x57fc0b,'name');_0x4f9ab7[_0x37c9('0x34')]=_[_0x37c9('0x35')](_0x2966f6[_0x37c9('0x34')]);_0x4f9ab7['filters']=_[_0x37c9('0x36')](_0x4f9ab7[_0x37c9('0x33')],_0x4f9ab7[_0x37c9('0x34')]);_0xc2b21e[_0x37c9('0x37')]=_[_0x37c9('0x36')](_0x4f9ab7[_0x37c9('0x33')],qs[_0x37c9('0x38')](_0x2966f6['query']['fields']));_0xc2b21e[_0x37c9('0x37')]=_0xc2b21e[_0x37c9('0x37')][_0x37c9('0x39')]?_0xc2b21e[_0x37c9('0x37')]:_0x4f9ab7['model'];if(!_0x2966f6[_0x37c9('0x34')][_0x37c9('0x3a')](_0x37c9('0x3b'))){_0xc2b21e[_0x37c9('0x20')]=qs['limit'](_0x2966f6['query'][_0x37c9('0x20')]);_0xc2b21e['offset']=qs[_0x37c9('0x1f')](_0x2966f6['query'][_0x37c9('0x1f')]);}_0xc2b21e[_0x37c9('0x3c')]=qs[_0x37c9('0x3d')](_0x2966f6['query']['sort']);_0xc2b21e[_0x37c9('0x3e')]=qs['filters'](_[_0x37c9('0x3f')](_0x2966f6[_0x37c9('0x34')],_0x4f9ab7['filters']),_0x57fc0b);if(_0x2966f6[_0x37c9('0x34')]['filter']){_0xc2b21e[_0x37c9('0x3e')]=_[_0x37c9('0x40')](_0xc2b21e['where'],{'$or':_[_0x37c9('0x2e')](_0x57fc0b,function(_0x3093aa){if(_0x3093aa['type']!==_0x37c9('0x41')){var _0x12af74={};_0x12af74[_0x3093aa['name']]={'$like':'%'+_0x2966f6['query'][_0x37c9('0x42')]+'%'};return _0x12af74;}})});}_0xc2b21e=_[_0x37c9('0x40')]({},_0xc2b21e,_0x2966f6[_0x37c9('0x43')]);var _0x4892cd={'where':_0xc2b21e[_0x37c9('0x3e')]};return db[_0x37c9('0x44')]['count'](_0x4892cd)[_0x37c9('0x29')](function(_0x4bdfc5){_0x10663c[_0x37c9('0x22')]=_0x4bdfc5;if(_0x2966f6[_0x37c9('0x34')][_0x37c9('0x45')]){_0xc2b21e[_0x37c9('0x46')]=[{'all':!![]}];}return db[_0x37c9('0x44')][_0x37c9('0x47')](_0xc2b21e);})[_0x37c9('0x29')](function(_0x59b8b3){_0x10663c['rows']=_0x59b8b3;return _0x10663c;})[_0x37c9('0x29')](respondWithFilteredResult(_0x23542b,_0xc2b21e))[_0x37c9('0x48')](handleError(_0x23542b,null));};exports[_0x37c9('0x49')]=function(_0x5029b1,_0x205683){var _0x1e53b1={'raw':!![],'where':{'id':_0x5029b1[_0x37c9('0x4a')]['id']}},_0x4be10b={};_0x4be10b['model']=_['keys'](db[_0x37c9('0x44')][_0x37c9('0x2f')]);_0x4be10b['query']=_[_0x37c9('0x35')](_0x5029b1[_0x37c9('0x34')]);_0x4be10b['filters']=_[_0x37c9('0x36')](_0x4be10b[_0x37c9('0x33')],_0x4be10b['query']);_0x1e53b1[_0x37c9('0x37')]=_[_0x37c9('0x36')](_0x4be10b[_0x37c9('0x33')],qs['fields'](_0x5029b1[_0x37c9('0x34')]['fields']));_0x1e53b1[_0x37c9('0x37')]=_0x1e53b1[_0x37c9('0x37')][_0x37c9('0x39')]?_0x1e53b1[_0x37c9('0x37')]:_0x4be10b[_0x37c9('0x33')];if(_0x5029b1[_0x37c9('0x34')]['includeAll']){_0x1e53b1[_0x37c9('0x46')]=[{'all':!![]}];}_0x1e53b1=_[_0x37c9('0x40')]({},_0x1e53b1,_0x5029b1['options']);return db[_0x37c9('0x44')][_0x37c9('0x4b')](_0x1e53b1)[_0x37c9('0x29')](handleEntityNotFound(_0x205683,null))[_0x37c9('0x29')](respondWithResult(_0x205683,null))['catch'](handleError(_0x205683,null));};exports['create']=function(_0x278d7d,_0xa03c01){return db[_0x37c9('0x44')]['create'](_0x278d7d[_0x37c9('0x4c')],{})['then'](respondWithResult(_0xa03c01,0xc9))[_0x37c9('0x48')](handleError(_0xa03c01,null));};exports[_0x37c9('0x28')]=function(_0x4d40e4,_0x4b677b){if(_0x4d40e4[_0x37c9('0x4c')]['id']){delete _0x4d40e4[_0x37c9('0x4c')]['id'];}return db['SquareMessage'][_0x37c9('0x4b')]({'where':{'id':_0x4d40e4[_0x37c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b677b,null))[_0x37c9('0x29')](saveUpdates(_0x4d40e4[_0x37c9('0x4c')],null))[_0x37c9('0x29')](respondWithResult(_0x4b677b,null))[_0x37c9('0x48')](handleError(_0x4b677b,null));};exports[_0x37c9('0x2a')]=function(_0x2befd1,_0x1594ce){return db[_0x37c9('0x44')][_0x37c9('0x4b')]({'where':{'id':_0x2befd1['params']['id']}})['then'](handleEntityNotFound(_0x1594ce,null))[_0x37c9('0x29')](removeEntity(_0x1594ce,null))[_0x37c9('0x48')](handleError(_0x1594ce,null));}; \ No newline at end of file +var _0xdaed=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0xdaed,0xcb));var _0xddae=function(_0x3f6d6b,_0x4a395d){_0x3f6d6b=_0x3f6d6b-0x0;var _0x49523f=_0xdaed[_0x3f6d6b];return _0x49523f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddae('0x1'));var rp=require('request-promise');var moment=require(_0xddae('0x2'));var BPromise=require(_0xddae('0x3'));var Mustache=require(_0xddae('0x4'));var util=require(_0xddae('0x5'));var path=require(_0xddae('0x6'));var sox=require(_0xddae('0x7'));var csv=require(_0xddae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddae('0x9'));var _=require(_0xddae('0xa'));var squel=require(_0xddae('0xb'));var crypto=require(_0xddae('0xc'));var jsforce=require(_0xddae('0xd'));var deskjs=require(_0xddae('0xe'));var toCsv=require('to-csv');var querystring=require(_0xddae('0xf'));var Papa=require(_0xddae('0x10'));var Redis=require(_0xddae('0x11'));var authService=require(_0xddae('0x12'));var qs=require(_0xddae('0x13'));var as=require(_0xddae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddae('0x15'))('api');var utils=require(_0xddae('0x16'));var config=require(_0xddae('0x17'));var licenseUtil=require(_0xddae('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3410ac,_0x4b8b30){_0x4b8b30=_0x4b8b30||0xcc;return function(_0x96e59a){if(_0x96e59a){return _0x3410ac[_0xddae('0x19')](_0x4b8b30);}return _0x3410ac[_0xddae('0x1a')](_0x4b8b30)[_0xddae('0x1b')]();};}function respondWithResult(_0x21df99,_0x362474){_0x362474=_0x362474||0xc8;return function(_0x43cffa){if(_0x43cffa){return _0x21df99['status'](_0x362474)[_0xddae('0x1c')](_0x43cffa);}};}function respondWithFilteredResult(_0x372fa3,_0x39b46f){return function(_0x3b0932){if(_0x3b0932){var _0x141e22=typeof _0x39b46f[_0xddae('0x1d')]===_0xddae('0x1e')&&typeof _0x39b46f[_0xddae('0x1f')]===_0xddae('0x1e');var _0x5a204b=_0x3b0932[_0xddae('0x20')];var _0xc2d0e0=_0x141e22?0x0:_0x39b46f[_0xddae('0x1d')];var _0x1cebdb=_0x141e22?_0x3b0932[_0xddae('0x20')]:_0x39b46f[_0xddae('0x1d')]+_0x39b46f[_0xddae('0x1f')];var _0x2f2951;if(_0x1cebdb>=_0x5a204b){_0x1cebdb=_0x5a204b;_0x2f2951=0xc8;}else{_0x2f2951=0xce;}_0x372fa3[_0xddae('0x1a')](_0x2f2951);return _0x372fa3[_0xddae('0x21')](_0xddae('0x22'),_0xc2d0e0+'-'+_0x1cebdb+'/'+_0x5a204b)[_0xddae('0x1c')](_0x3b0932);}return null;};}function patchUpdates(_0x367e73){return function(_0x2c31d6){try{jsonpatch['apply'](_0x2c31d6,_0x367e73,!![]);}catch(_0x5636e8){return BPromise['reject'](_0x5636e8);}return _0x2c31d6['save']();};}function saveUpdates(_0x2168a2,_0x4ee4f8){return function(_0x379695){if(_0x379695){return _0x379695[_0xddae('0x23')](_0x2168a2)[_0xddae('0x24')](function(_0x26d87e){return _0x26d87e;});}return null;};}function removeEntity(_0x303b61,_0x18458e){return function(_0x4333cc){if(_0x4333cc){return _0x4333cc[_0xddae('0x25')]()[_0xddae('0x24')](function(){_0x303b61[_0xddae('0x1a')](0xcc)[_0xddae('0x1b')]();});}};}function handleEntityNotFound(_0x5dff4c,_0x314f36){return function(_0x178c5e){if(!_0x178c5e){_0x5dff4c[_0xddae('0x19')](0x194);}return _0x178c5e;};}function handleError(_0xe458a0,_0x25c5f4){_0x25c5f4=_0x25c5f4||0x1f4;return function(_0x2895db){logger[_0xddae('0x26')](_0x2895db[_0xddae('0x27')]);if(_0x2895db[_0xddae('0x28')]){delete _0x2895db[_0xddae('0x28')];}_0xe458a0[_0xddae('0x1a')](_0x25c5f4)[_0xddae('0x29')](_0x2895db);};}exports[_0xddae('0x2a')]=function(_0x32dcdc,_0x147b56){var _0x3feafc={},_0x31bbd9={},_0x5695b7={'count':0x0,'rows':[]};var _0x153eba=_[_0xddae('0x2b')](db[_0xddae('0x2c')][_0xddae('0x2d')],function(_0x4db171){return{'name':_0x4db171[_0xddae('0x2e')],'type':_0x4db171[_0xddae('0x2f')][_0xddae('0x30')]};});_0x31bbd9[_0xddae('0x31')]=_['map'](_0x153eba,_0xddae('0x28'));_0x31bbd9[_0xddae('0x32')]=_[_0xddae('0x33')](_0x32dcdc[_0xddae('0x32')]);_0x31bbd9[_0xddae('0x34')]=_[_0xddae('0x35')](_0x31bbd9['model'],_0x31bbd9[_0xddae('0x32')]);_0x3feafc[_0xddae('0x36')]=_['intersection'](_0x31bbd9[_0xddae('0x31')],qs[_0xddae('0x37')](_0x32dcdc[_0xddae('0x32')][_0xddae('0x37')]));_0x3feafc[_0xddae('0x36')]=_0x3feafc['attributes']['length']?_0x3feafc[_0xddae('0x36')]:_0x31bbd9[_0xddae('0x31')];if(!_0x32dcdc[_0xddae('0x32')]['hasOwnProperty']('nolimit')){_0x3feafc['limit']=qs[_0xddae('0x1f')](_0x32dcdc['query']['limit']);_0x3feafc[_0xddae('0x1d')]=qs['offset'](_0x32dcdc['query'][_0xddae('0x1d')]);}_0x3feafc[_0xddae('0x38')]=qs[_0xddae('0x39')](_0x32dcdc[_0xddae('0x32')][_0xddae('0x39')]);_0x3feafc[_0xddae('0x3a')]=qs['filters'](_[_0xddae('0x3b')](_0x32dcdc['query'],_0x31bbd9[_0xddae('0x34')]),_0x153eba);if(_0x32dcdc['query'][_0xddae('0x3c')]){_0x3feafc[_0xddae('0x3a')]=_[_0xddae('0x3d')](_0x3feafc[_0xddae('0x3a')],{'$or':_[_0xddae('0x2b')](_0x153eba,function(_0x17a025){if(_0x17a025[_0xddae('0x2f')]!=='VIRTUAL'){var _0x85f803={};_0x85f803[_0x17a025[_0xddae('0x28')]]={'$like':'%'+_0x32dcdc[_0xddae('0x32')][_0xddae('0x3c')]+'%'};return _0x85f803;}})});}_0x3feafc=_[_0xddae('0x3d')]({},_0x3feafc,_0x32dcdc[_0xddae('0x3e')]);var _0x46a262={'where':_0x3feafc['where']};return db[_0xddae('0x2c')][_0xddae('0x20')](_0x46a262)['then'](function(_0x2cab93){_0x5695b7['count']=_0x2cab93;if(_0x32dcdc[_0xddae('0x32')][_0xddae('0x3f')]){_0x3feafc[_0xddae('0x40')]=[{'all':!![]}];}return db[_0xddae('0x2c')][_0xddae('0x41')](_0x3feafc);})[_0xddae('0x24')](function(_0x1a2248){_0x5695b7[_0xddae('0x42')]=_0x1a2248;return _0x5695b7;})[_0xddae('0x24')](respondWithFilteredResult(_0x147b56,_0x3feafc))[_0xddae('0x43')](handleError(_0x147b56,null));};exports[_0xddae('0x44')]=function(_0x3edc6e,_0x57d5ef){var _0x14a68c={'raw':!![],'where':{'id':_0x3edc6e['params']['id']}},_0x48c4e0={};_0x48c4e0[_0xddae('0x31')]=_[_0xddae('0x33')](db[_0xddae('0x2c')][_0xddae('0x2d')]);_0x48c4e0[_0xddae('0x32')]=_['keys'](_0x3edc6e[_0xddae('0x32')]);_0x48c4e0[_0xddae('0x34')]=_[_0xddae('0x35')](_0x48c4e0[_0xddae('0x31')],_0x48c4e0[_0xddae('0x32')]);_0x14a68c[_0xddae('0x36')]=_[_0xddae('0x35')](_0x48c4e0[_0xddae('0x31')],qs[_0xddae('0x37')](_0x3edc6e[_0xddae('0x32')][_0xddae('0x37')]));_0x14a68c['attributes']=_0x14a68c[_0xddae('0x36')][_0xddae('0x45')]?_0x14a68c[_0xddae('0x36')]:_0x48c4e0[_0xddae('0x31')];if(_0x3edc6e[_0xddae('0x32')][_0xddae('0x3f')]){_0x14a68c[_0xddae('0x40')]=[{'all':!![]}];}_0x14a68c=_[_0xddae('0x3d')]({},_0x14a68c,_0x3edc6e[_0xddae('0x3e')]);return db[_0xddae('0x2c')][_0xddae('0x46')](_0x14a68c)[_0xddae('0x24')](handleEntityNotFound(_0x57d5ef,null))[_0xddae('0x24')](respondWithResult(_0x57d5ef,null))[_0xddae('0x43')](handleError(_0x57d5ef,null));};exports[_0xddae('0x47')]=function(_0x31cbf7,_0x21ac33){return db[_0xddae('0x2c')][_0xddae('0x47')](_0x31cbf7[_0xddae('0x48')],{})[_0xddae('0x24')](respondWithResult(_0x21ac33,0xc9))[_0xddae('0x43')](handleError(_0x21ac33,null));};exports[_0xddae('0x23')]=function(_0x46e3a6,_0x167c84){if(_0x46e3a6['body']['id']){delete _0x46e3a6[_0xddae('0x48')]['id'];}return db[_0xddae('0x2c')][_0xddae('0x46')]({'where':{'id':_0x46e3a6[_0xddae('0x49')]['id']}})['then'](handleEntityNotFound(_0x167c84,null))[_0xddae('0x24')](saveUpdates(_0x46e3a6[_0xddae('0x48')],null))[_0xddae('0x24')](respondWithResult(_0x167c84,null))[_0xddae('0x43')](handleError(_0x167c84,null));};exports[_0xddae('0x25')]=function(_0x2fdea5,_0x360c79){return db[_0xddae('0x2c')][_0xddae('0x46')]({'where':{'id':_0x2fdea5['params']['id']}})[_0xddae('0x24')](handleEntityNotFound(_0x360c79,null))['then'](removeEntity(_0x360c79,null))['catch'](handleError(_0x360c79,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 7e4c798..4df9280 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 _0x8ff6=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api','moment','bluebird'];(function(_0x3317d1,_0xc52ed){var _0xb1ed76=function(_0x47a88f){while(--_0x47a88f){_0x3317d1['push'](_0x3317d1['shift']());}};_0xb1ed76(++_0xc52ed);}(_0x8ff6,0x10f));var _0x68ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ff6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x68ff('0x0'));var util=require(_0x68ff('0x1'));var logger=require('../../config/logger')(_0x68ff('0x2'));var moment=require(_0x68ff('0x3'));var BPromise=require(_0x68ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x68ff('0x5'));var config=require(_0x68ff('0x6'));var attributes=require(_0x68ff('0x7'));module[_0x68ff('0x8')]=function(_0x18f409,_0x5eb699){return _0x18f409[_0x68ff('0x9')](_0x68ff('0xa'),attributes,{'tableName':_0x68ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacf7=['SquareMessage','square_messages','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xacf7,0x86));var _0x7acf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xacf7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7acf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7acf('0x1'));var moment=require(_0x7acf('0x2'));var BPromise=require(_0x7acf('0x3'));var rp=require(_0x7acf('0x4'));var fs=require('fs');var path=require(_0x7acf('0x5'));var rimraf=require(_0x7acf('0x6'));var config=require(_0x7acf('0x7'));var attributes=require(_0x7acf('0x8'));module[_0x7acf('0x9')]=function(_0x2e1fdb,_0x313833){return _0x2e1fdb['define'](_0x7acf('0xa'),attributes,{'tableName':_0x7acf('0xb'),'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 b3bc87b..7497c93 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 _0x085f=['result','catch','CreateSquareMessage','SquareMessage','create','options','raw','debug','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x512171,_0x30f118){var _0x347b48=function(_0x1b578c){while(--_0x1b578c){_0x512171['push'](_0x512171['shift']());}};_0x347b48(++_0x30f118);}(_0x085f,0xe9));var _0xf085=function(_0x2e262e,_0x1525d4){_0x2e262e=_0x2e262e-0x0;var _0x33f175=_0x085f[_0x2e262e];return _0x33f175;};'use strict';var _=require(_0xf085('0x0'));var util=require(_0xf085('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf085('0x2'));var fs=require('fs');var Redis=require(_0xf085('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf085('0x4'))('rpc');var config=require(_0xf085('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf085('0x6')][_0xf085('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x570981,_0xc286da,_0x42666d){return new BPromise(function(_0x7a4cfe,_0x5cc355){return client[_0xf085('0x8')](_0x570981,_0x42666d)[_0xf085('0x9')](function(_0x403d1a){logger[_0xf085('0xa')](_0xf085('0xb'),_0xc286da,_0xf085('0xc'));logger['debug'](_0xf085('0xd'),_0xc286da,_0xf085('0xc'),JSON['stringify'](_0x403d1a));if(_0x403d1a[_0xf085('0xe')]){if(_0x403d1a[_0xf085('0xe')][_0xf085('0xf')]===0x1f4){logger[_0xf085('0xe')]('SquareMessage,\x20%s,\x20%s',_0xc286da,_0x403d1a['error']['message']);return _0x5cc355(_0x403d1a['error'][_0xf085('0x10')]);}logger[_0xf085('0xe')](_0xf085('0xb'),_0xc286da,_0x403d1a[_0xf085('0xe')]['message']);return _0x7a4cfe(_0x403d1a[_0xf085('0xe')][_0xf085('0x10')]);}else{logger[_0xf085('0xa')](_0xf085('0xb'),_0xc286da,'request\x20sent');_0x7a4cfe(_0x403d1a[_0xf085('0x11')][_0xf085('0x10')]);}})[_0xf085('0x12')](function(_0x312f50){logger[_0xf085('0xe')](_0xf085('0xb'),_0xc286da,_0x312f50);_0x5cc355(_0x312f50);});});}exports[_0xf085('0x13')]=function(_0x4df9f7){var _0x6caa87=this;return new Promise(function(_0x14dabe,_0x395d88){return db[_0xf085('0x14')][_0xf085('0x15')](_0x4df9f7['body'],{'raw':_0x4df9f7[_0xf085('0x16')]?_0x4df9f7[_0xf085('0x16')][_0xf085('0x17')]===undefined?!![]:![]:!![]})[_0xf085('0x9')](function(_0x3fce8b){logger['info'](_0xf085('0x13'),_0x4df9f7);logger[_0xf085('0x18')](_0xf085('0x13'),_0x4df9f7,JSON['stringify'](_0x3fce8b));_0x14dabe(_0x3fce8b);})[_0xf085('0x12')](function(_0x38816b){logger['error'](_0xf085('0x13'),_0x38816b[_0xf085('0x10')],_0x4df9f7);_0x395d88(_0x6caa87[_0xf085('0xe')](0x1f4,_0x38816b['message']));});});}; \ No newline at end of file +var _0x1f69=['then','info','request\x20sent','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','SquareMessage','create','body','options','raw','CreateSquareMessage','catch','lodash','util','moment','bluebird','randomstring','jayson/promise','client'];(function(_0x5db408,_0x331e6a){var _0x1db3af=function(_0x43d119){while(--_0x43d119){_0x5db408['push'](_0x5db408['shift']());}};_0x1db3af(++_0x331e6a);}(_0x1f69,0x161));var _0x91f6=function(_0x478a7d,_0x310562){_0x478a7d=_0x478a7d-0x0;var _0x37b91e=_0x1f69[_0x478a7d];return _0x37b91e;};'use strict';var _=require(_0x91f6('0x0'));var util=require(_0x91f6('0x1'));var moment=require(_0x91f6('0x2'));var BPromise=require(_0x91f6('0x3'));var rs=require(_0x91f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x91f6('0x5'));var client=jayson[_0x91f6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57eaf4,_0x1b209d,_0x153297){return new BPromise(function(_0x57dd5b,_0x561e7c){return client['request'](_0x57eaf4,_0x153297)[_0x91f6('0x7')](function(_0x332d09){logger[_0x91f6('0x8')]('SquareMessage,\x20%s,\x20%s',_0x1b209d,_0x91f6('0x9'));logger[_0x91f6('0xa')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x1b209d,'request\x20sent',JSON[_0x91f6('0xb')](_0x332d09));if(_0x332d09[_0x91f6('0xc')]){if(_0x332d09[_0x91f6('0xc')][_0x91f6('0xd')]===0x1f4){logger[_0x91f6('0xc')](_0x91f6('0xe'),_0x1b209d,_0x332d09[_0x91f6('0xc')][_0x91f6('0xf')]);return _0x561e7c(_0x332d09[_0x91f6('0xc')][_0x91f6('0xf')]);}logger[_0x91f6('0xc')](_0x91f6('0xe'),_0x1b209d,_0x332d09[_0x91f6('0xc')][_0x91f6('0xf')]);return _0x57dd5b(_0x332d09[_0x91f6('0xc')]['message']);}else{logger[_0x91f6('0x8')]('SquareMessage,\x20%s,\x20%s',_0x1b209d,'request\x20sent');_0x57dd5b(_0x332d09[_0x91f6('0x10')][_0x91f6('0xf')]);}})['catch'](function(_0x2c6b4d){logger[_0x91f6('0xc')](_0x91f6('0xe'),_0x1b209d,_0x2c6b4d);_0x561e7c(_0x2c6b4d);});});}exports['CreateSquareMessage']=function(_0x5769f9){var _0x5571f7=this;return new Promise(function(_0xbea9d4,_0x20ab9d){return db[_0x91f6('0x11')][_0x91f6('0x12')](_0x5769f9[_0x91f6('0x13')],{'raw':_0x5769f9[_0x91f6('0x14')]?_0x5769f9[_0x91f6('0x14')][_0x91f6('0x15')]===undefined?!![]:![]:!![]})[_0x91f6('0x7')](function(_0x585907){logger[_0x91f6('0x8')]('CreateSquareMessage',_0x5769f9);logger['debug'](_0x91f6('0x16'),_0x5769f9,JSON[_0x91f6('0xb')](_0x585907));_0xbea9d4(_0x585907);})[_0x91f6('0x17')](function(_0x410e7c){logger[_0x91f6('0xc')](_0x91f6('0x16'),_0x410e7c[_0x91f6('0xf')],_0x5769f9);_0x20ab9d(_0x5571f7[_0x91f6('0xc')](0x1f4,_0x410e7c[_0x91f6('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 18d174e..793e6db 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 _0x698d=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','create','put','delete'];(function(_0x3e3ba6,_0x5e5ba1){var _0x1186e8=function(_0x1b6d19){while(--_0x1b6d19){_0x3e3ba6['push'](_0x3e3ba6['shift']());}};_0x1186e8(++_0x5e5ba1);}(_0x698d,0x158));var _0xd698=function(_0x2ab00c,_0x213a97){_0x2ab00c=_0x2ab00c-0x0;var _0x14f11c=_0x698d[_0x2ab00c];return _0x14f11c;};'use strict';var multer=require(_0xd698('0x0'));var util=require(_0xd698('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd698('0x2'));var auth=require(_0xd698('0x3'));var interaction=require(_0xd698('0x4'));var config=require(_0xd698('0x5'));var controller=require(_0xd698('0x6'));router[_0xd698('0x7')]('/',auth[_0xd698('0x8')](),controller[_0xd698('0x9')]);router['get'](_0xd698('0xa'),auth['isAuthenticated'](),controller[_0xd698('0xb')]);router[_0xd698('0x7')](_0xd698('0xc'),auth[_0xd698('0x8')](),timeout('15s'),controller[_0xd698('0xd')]);router['post']('/',auth[_0xd698('0x8')](),controller[_0xd698('0xe')]);router[_0xd698('0xf')](_0xd698('0xa'),auth[_0xd698('0x8')](),controller['update']);router[_0xd698('0x10')](_0xd698('0xa'),auth[_0xd698('0x8')](),controller[_0xd698('0x11')]);module[_0xd698('0x12')]=router; \ No newline at end of file +var _0x2cd0=['./squareOdbc.controller','index','get','isAuthenticated','show','/:id/test','test','post','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x230628,_0x4b01f9){var _0xd221b1=function(_0x3a5610){while(--_0x3a5610){_0x230628['push'](_0x230628['shift']());}};_0xd221b1(++_0x4b01f9);}(_0x2cd0,0x76));var _0x02cd=function(_0x1dc0d6,_0xa034fc){_0x1dc0d6=_0x1dc0d6-0x0;var _0x2d848c=_0x2cd0[_0x1dc0d6];return _0x2d848c;};'use strict';var multer=require(_0x02cd('0x0'));var util=require('util');var path=require(_0x02cd('0x1'));var timeout=require(_0x02cd('0x2'));var express=require(_0x02cd('0x3'));var router=express[_0x02cd('0x4')]();var fs_extra=require(_0x02cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x02cd('0x6'));var config=require(_0x02cd('0x7'));var controller=require(_0x02cd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x02cd('0x9')]);router[_0x02cd('0xa')]('/:id',auth[_0x02cd('0xb')](),controller[_0x02cd('0xc')]);router[_0x02cd('0xa')](_0x02cd('0xd'),auth['isAuthenticated'](),timeout('15s'),controller[_0x02cd('0xe')]);router[_0x02cd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x02cd('0x10')](_0x02cd('0x11'),auth[_0x02cd('0xb')](),controller[_0x02cd('0x12')]);router[_0x02cd('0x13')](_0x02cd('0x11'),auth[_0x02cd('0xb')](),controller['destroy']);module[_0x02cd('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index fd37ffe..444c2e4 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 _0x89b1=['exports','STRING','name','sequelize'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x89b1,0x1a7));var _0x189b=function(_0x328d59,_0x543156){_0x328d59=_0x328d59-0x0;var _0x312a9a=_0x89b1[_0x328d59];return _0x312a9a;};'use strict';var Sequelize=require(_0x189b('0x0'));module[_0x189b('0x1')]={'name':{'type':Sequelize[_0x189b('0x2')],'unique':_0x189b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x189b('0x2')]}}; \ No newline at end of file +var _0x888b=['exports','STRING','name','sequelize'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x888b,0xbb));var _0xb888=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x888b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xb888('0x0'));module[_0xb888('0x1')]={'name':{'type':Sequelize[_0xb888('0x2')],'unique':_0xb888('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb888('0x2')]},'description':{'type':Sequelize[_0xb888('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8bd503f..0c793b1 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 _0x4c32=['model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','get','ODBC','then','error','stack','name','send','index','map','SquareOdbc','fieldName','type'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x4c32,0x11d));var _0x24c3=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x4c32[_0x17928f];return _0x500b63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24c3('0x0'));var zipdir=require(_0x24c3('0x1'));var jsonpatch=require(_0x24c3('0x2'));var rp=require(_0x24c3('0x3'));var moment=require('moment');var BPromise=require(_0x24c3('0x4'));var Mustache=require('mustache');var util=require(_0x24c3('0x5'));var path=require(_0x24c3('0x6'));var sox=require(_0x24c3('0x7'));var csv=require(_0x24c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24c3('0x9'));var _=require(_0x24c3('0xa'));var squel=require(_0x24c3('0xb'));var crypto=require(_0x24c3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x24c3('0x8'));var querystring=require(_0x24c3('0xd'));var Papa=require(_0x24c3('0xe'));var Redis=require(_0x24c3('0xf'));var authService=require(_0x24c3('0x10'));var qs=require(_0x24c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24c3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x24c3('0x13'));var config=require(_0x24c3('0x14'));var licenseUtil=require(_0x24c3('0x15'));var db=require(_0x24c3('0x16'))['db'];function respondWithStatusCode(_0x5b965c,_0x5362d3){_0x5362d3=_0x5362d3||0xcc;return function(_0x16ce73){if(_0x16ce73){return _0x5b965c[_0x24c3('0x17')](_0x5362d3);}return _0x5b965c['status'](_0x5362d3)[_0x24c3('0x18')]();};}function respondWithResult(_0x23fa17,_0x5d6a1a){_0x5d6a1a=_0x5d6a1a||0xc8;return function(_0x520518){if(_0x520518){return _0x23fa17['status'](_0x5d6a1a)['json'](_0x520518);}};}function respondWithFilteredResult(_0x42c243,_0x3cad06){return function(_0x5915b9){if(_0x5915b9){var _0x1c2523=typeof _0x3cad06[_0x24c3('0x19')]===_0x24c3('0x1a')&&typeof _0x3cad06[_0x24c3('0x1b')]===_0x24c3('0x1a');var _0x309a0b=_0x5915b9[_0x24c3('0x1c')];var _0xb935e3=_0x1c2523?0x0:_0x3cad06[_0x24c3('0x19')];var _0x3e3e76=_0x1c2523?_0x5915b9[_0x24c3('0x1c')]:_0x3cad06[_0x24c3('0x19')]+_0x3cad06[_0x24c3('0x1b')];var _0x3acdac;if(_0x3e3e76>=_0x309a0b){_0x3e3e76=_0x309a0b;_0x3acdac=0xc8;}else{_0x3acdac=0xce;}_0x42c243['status'](_0x3acdac);return _0x42c243['set'](_0x24c3('0x1d'),_0xb935e3+'-'+_0x3e3e76+'/'+_0x309a0b)[_0x24c3('0x1e')](_0x5915b9);}return null;};}function patchUpdates(_0x45f2e6){return function(_0x8bc162){try{jsonpatch[_0x24c3('0x1f')](_0x8bc162,_0x45f2e6,!![]);}catch(_0x56341d){return BPromise[_0x24c3('0x20')](_0x56341d);}return _0x8bc162['save']();};}function saveUpdates(_0x4e21ca,_0x3a9df3){return function(_0xa34f94){if(_0xa34f94){return _0xa34f94[_0x24c3('0x21')](_0x4e21ca)['then'](function(_0x554561){return _0x554561;});}return null;};}function removeEntity(_0x1c58a3,_0x42dd4b){return function(_0x176531){if(_0x176531){return _0x176531[_0x24c3('0x22')]()['then'](function(){var _0x4415a3=_0x176531[_0x24c3('0x23')]({'plain':!![]});var _0x2257e7=_0x24c3('0x24');return db['UserProfileResource'][_0x24c3('0x22')]({'where':{'type':_0x2257e7,'resourceId':_0x4415a3['id']}})[_0x24c3('0x25')](function(){return _0x176531;});})[_0x24c3('0x25')](function(){_0x1c58a3['status'](0xcc)[_0x24c3('0x18')]();});}};}function handleEntityNotFound(_0x4611c8,_0x5dd03e){return function(_0x1427bc){if(!_0x1427bc){_0x4611c8[_0x24c3('0x17')](0x194);}return _0x1427bc;};}function handleError(_0x33c5a6,_0x571141){_0x571141=_0x571141||0x1f4;return function(_0x528368){logger[_0x24c3('0x26')](_0x528368[_0x24c3('0x27')]);if(_0x528368[_0x24c3('0x28')]){delete _0x528368[_0x24c3('0x28')];}_0x33c5a6['status'](_0x571141)[_0x24c3('0x29')](_0x528368);};}exports[_0x24c3('0x2a')]=function(_0x2d71d2,_0x434fa6){var _0x53d990={},_0xd61ae7={},_0xa09096={'count':0x0,'rows':[]};var _0x1910ab=_[_0x24c3('0x2b')](db[_0x24c3('0x2c')]['rawAttributes'],function(_0xbfc10){return{'name':_0xbfc10[_0x24c3('0x2d')],'type':_0xbfc10[_0x24c3('0x2e')]['key']};});_0xd61ae7[_0x24c3('0x2f')]=_[_0x24c3('0x2b')](_0x1910ab,'name');_0xd61ae7[_0x24c3('0x30')]=_[_0x24c3('0x31')](_0x2d71d2[_0x24c3('0x30')]);_0xd61ae7['filters']=_['intersection'](_0xd61ae7[_0x24c3('0x2f')],_0xd61ae7[_0x24c3('0x30')]);_0x53d990[_0x24c3('0x32')]=_['intersection'](_0xd61ae7[_0x24c3('0x2f')],qs[_0x24c3('0x33')](_0x2d71d2[_0x24c3('0x30')]['fields']));_0x53d990[_0x24c3('0x32')]=_0x53d990[_0x24c3('0x32')][_0x24c3('0x34')]?_0x53d990[_0x24c3('0x32')]:_0xd61ae7[_0x24c3('0x2f')];if(!_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x35')]('nolimit')){_0x53d990[_0x24c3('0x1b')]=qs['limit'](_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x1b')]);_0x53d990[_0x24c3('0x19')]=qs[_0x24c3('0x19')](_0x2d71d2[_0x24c3('0x30')]['offset']);}_0x53d990[_0x24c3('0x36')]=qs[_0x24c3('0x37')](_0x2d71d2[_0x24c3('0x30')]['sort']);_0x53d990[_0x24c3('0x38')]=qs[_0x24c3('0x39')](_['pick'](_0x2d71d2['query'],_0xd61ae7[_0x24c3('0x39')]),_0x1910ab);if(_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x3a')]){_0x53d990[_0x24c3('0x38')]=_[_0x24c3('0x3b')](_0x53d990[_0x24c3('0x38')],{'$or':_[_0x24c3('0x2b')](_0x1910ab,function(_0x4500f4){if(_0x4500f4[_0x24c3('0x2e')]!==_0x24c3('0x3c')){var _0x2ae82c={};_0x2ae82c[_0x4500f4['name']]={'$like':'%'+_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x3a')]+'%'};return _0x2ae82c;}})});}_0x53d990=_[_0x24c3('0x3b')]({},_0x53d990,_0x2d71d2[_0x24c3('0x3d')]);var _0x4922c5={'where':_0x53d990['where']};return db[_0x24c3('0x2c')]['count'](_0x4922c5)['then'](function(_0x5d5c04){_0xa09096[_0x24c3('0x1c')]=_0x5d5c04;if(_0x2d71d2[_0x24c3('0x30')][_0x24c3('0x3e')]){_0x53d990[_0x24c3('0x3f')]=[{'all':!![]}];}return db[_0x24c3('0x2c')][_0x24c3('0x40')](_0x53d990);})[_0x24c3('0x25')](function(_0x11d676){_0xa09096[_0x24c3('0x41')]=_0x11d676;return _0xa09096;})[_0x24c3('0x25')](respondWithFilteredResult(_0x434fa6,_0x53d990))[_0x24c3('0x42')](handleError(_0x434fa6,null));};exports['show']=function(_0x47f268,_0x27b958){var _0x3d3726={'raw':!![],'where':{'id':_0x47f268[_0x24c3('0x43')]['id']}},_0x1e2563={};_0x1e2563[_0x24c3('0x2f')]=_[_0x24c3('0x31')](db[_0x24c3('0x2c')]['rawAttributes']);_0x1e2563[_0x24c3('0x30')]=_['keys'](_0x47f268[_0x24c3('0x30')]);_0x1e2563[_0x24c3('0x39')]=_[_0x24c3('0x44')](_0x1e2563['model'],_0x1e2563[_0x24c3('0x30')]);_0x3d3726[_0x24c3('0x32')]=_[_0x24c3('0x44')](_0x1e2563['model'],qs[_0x24c3('0x33')](_0x47f268['query'][_0x24c3('0x33')]));_0x3d3726[_0x24c3('0x32')]=_0x3d3726[_0x24c3('0x32')][_0x24c3('0x34')]?_0x3d3726[_0x24c3('0x32')]:_0x1e2563['model'];if(_0x47f268[_0x24c3('0x30')][_0x24c3('0x3e')]){_0x3d3726[_0x24c3('0x3f')]=[{'all':!![]}];}_0x3d3726=_['merge']({},_0x3d3726,_0x47f268[_0x24c3('0x3d')]);return db[_0x24c3('0x2c')]['find'](_0x3d3726)[_0x24c3('0x25')](handleEntityNotFound(_0x27b958,null))[_0x24c3('0x25')](respondWithResult(_0x27b958,null))[_0x24c3('0x42')](handleError(_0x27b958,null));};exports['create']=function(_0x5e0b2d,_0xb35ede){return db[_0x24c3('0x2c')][_0x24c3('0x45')](_0x5e0b2d[_0x24c3('0x46')],{})['then'](function(_0x2c1f20){var _0x1df3bc=_0x5e0b2d[_0x24c3('0x47')][_0x24c3('0x23')]({'plain':!![]});if(!_0x1df3bc)throw new Error(_0x24c3('0x48'));if(_0x1df3bc['role']===_0x24c3('0x47')){var _0x1bcaba=_0x2c1f20[_0x24c3('0x23')]({'plain':!![]});var _0x32605c='ODBC';return db[_0x24c3('0x49')][_0x24c3('0x4a')]({'where':{'name':_0x32605c,'userProfileId':_0x1df3bc[_0x24c3('0x4b')]},'raw':!![]})[_0x24c3('0x25')](function(_0x10dbfd){if(_0x10dbfd&&_0x10dbfd[_0x24c3('0x4c')]===0x0){return db['UserProfileResource'][_0x24c3('0x45')]({'name':_0x1bcaba[_0x24c3('0x28')],'resourceId':_0x1bcaba['id'],'type':_0x10dbfd['name'],'sectionId':_0x10dbfd['id']},{})[_0x24c3('0x25')](function(){return _0x2c1f20;});}else{return _0x2c1f20;}})[_0x24c3('0x42')](function(_0x5e9758){logger[_0x24c3('0x26')](_0x24c3('0x4d'),_0x5e9758);throw _0x5e9758;});}return _0x2c1f20;})[_0x24c3('0x25')](respondWithResult(_0xb35ede,0xc9))[_0x24c3('0x42')](handleError(_0xb35ede,null));};exports[_0x24c3('0x21')]=function(_0x55fba4,_0x1f05fa){if(_0x55fba4['body']['id']){delete _0x55fba4[_0x24c3('0x46')]['id'];}return db[_0x24c3('0x2c')][_0x24c3('0x4a')]({'where':{'id':_0x55fba4[_0x24c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f05fa,null))[_0x24c3('0x25')](saveUpdates(_0x55fba4[_0x24c3('0x46')],null))[_0x24c3('0x25')](respondWithResult(_0x1f05fa,null))['catch'](handleError(_0x1f05fa,null));};exports[_0x24c3('0x22')]=function(_0x3a48cc,_0xc5b2d7){return db[_0x24c3('0x2c')][_0x24c3('0x4a')]({'where':{'id':_0x3a48cc[_0x24c3('0x43')]['id']}})[_0x24c3('0x25')](handleEntityNotFound(_0xc5b2d7,null))['then'](removeEntity(_0xc5b2d7,null))[_0x24c3('0x42')](handleError(_0xc5b2d7,null));};exports[_0x24c3('0x4e')]=function(_0x5c08af,_0x3b3c14,_0x3b7ce6){var _0x40cdb3;return db[_0x24c3('0x2c')][_0x24c3('0x4a')]({'where':{'id':_0x5c08af[_0x24c3('0x43')]['id']},'attributes':['id',_0x24c3('0x4f')]})[_0x24c3('0x25')](handleEntityNotFound(_0x3b3c14,null))[_0x24c3('0x25')](function(_0x301c22){if(_0x301c22){var _0x5bf811=require(_0x24c3('0x50'))();_0x5bf811[_0x24c3('0x51')](_0x301c22['dsn']);_0x5bf811[_0x24c3('0x52')]();return _0x301c22;}})[_0x24c3('0x25')](respondWithResult(_0x3b3c14,null))[_0x24c3('0x42')](handleError(_0x3b3c14,null));}; \ No newline at end of file +var _0x9899=['dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','end','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','body','params','test'];(function(_0x2639c5,_0x16065f){var _0x3072dc=function(_0x42c2c4){while(--_0x42c2c4){_0x2639c5['push'](_0x2639c5['shift']());}};_0x3072dc(++_0x16065f);}(_0x9899,0x168));var _0x9989=function(_0x47f090,_0x2d7d04){_0x47f090=_0x47f090-0x0;var _0x2be288=_0x9899[_0x47f090];return _0x2be288;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9989('0x0'));var zipdir=require(_0x9989('0x1'));var jsonpatch=require(_0x9989('0x2'));var rp=require(_0x9989('0x3'));var moment=require(_0x9989('0x4'));var BPromise=require(_0x9989('0x5'));var Mustache=require(_0x9989('0x6'));var util=require(_0x9989('0x7'));var path=require(_0x9989('0x8'));var sox=require(_0x9989('0x9'));var csv=require(_0x9989('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9989('0xb'));var _=require(_0x9989('0xc'));var squel=require(_0x9989('0xd'));var crypto=require(_0x9989('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9989('0xf'));var toCsv=require(_0x9989('0xa'));var querystring=require('querystring');var Papa=require(_0x9989('0x10'));var Redis=require(_0x9989('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9989('0x12'));var as=require(_0x9989('0x13'));var hardwareService=require(_0x9989('0x14'));var logger=require(_0x9989('0x15'))('api');var utils=require(_0x9989('0x16'));var config=require(_0x9989('0x17'));var licenseUtil=require(_0x9989('0x18'));var db=require(_0x9989('0x19'))['db'];function respondWithStatusCode(_0x4eab60,_0x58a632){_0x58a632=_0x58a632||0xcc;return function(_0x26f851){if(_0x26f851){return _0x4eab60[_0x9989('0x1a')](_0x58a632);}return _0x4eab60[_0x9989('0x1b')](_0x58a632)['end']();};}function respondWithResult(_0x292872,_0x39ce5c){_0x39ce5c=_0x39ce5c||0xc8;return function(_0x9b7f21){if(_0x9b7f21){return _0x292872[_0x9989('0x1b')](_0x39ce5c)[_0x9989('0x1c')](_0x9b7f21);}};}function respondWithFilteredResult(_0x4cb005,_0x23f632){return function(_0x186276){if(_0x186276){var _0x54400e=typeof _0x23f632['offset']===_0x9989('0x1d')&&typeof _0x23f632[_0x9989('0x1e')]==='undefined';var _0x43322d=_0x186276[_0x9989('0x1f')];var _0x14d7f7=_0x54400e?0x0:_0x23f632['offset'];var _0x46bf9e=_0x54400e?_0x186276[_0x9989('0x1f')]:_0x23f632[_0x9989('0x20')]+_0x23f632[_0x9989('0x1e')];var _0x5c3b4c;if(_0x46bf9e>=_0x43322d){_0x46bf9e=_0x43322d;_0x5c3b4c=0xc8;}else{_0x5c3b4c=0xce;}_0x4cb005[_0x9989('0x1b')](_0x5c3b4c);return _0x4cb005['set'](_0x9989('0x21'),_0x14d7f7+'-'+_0x46bf9e+'/'+_0x43322d)[_0x9989('0x1c')](_0x186276);}return null;};}function patchUpdates(_0x566df1){return function(_0x454c23){try{jsonpatch[_0x9989('0x22')](_0x454c23,_0x566df1,!![]);}catch(_0x570d8a){return BPromise[_0x9989('0x23')](_0x570d8a);}return _0x454c23[_0x9989('0x24')]();};}function saveUpdates(_0x36fa83,_0x418f52){return function(_0x3a2c2b){if(_0x3a2c2b){return _0x3a2c2b[_0x9989('0x25')](_0x36fa83)['then'](function(_0xd42b6){return _0xd42b6;});}return null;};}function removeEntity(_0x3d3b1d,_0xc66332){return function(_0x3ddb72){if(_0x3ddb72){return _0x3ddb72['destroy']()[_0x9989('0x26')](function(){var _0x25dd9c=_0x3ddb72[_0x9989('0x27')]({'plain':!![]});var _0x59c1ad=_0x9989('0x28');return db[_0x9989('0x29')][_0x9989('0x2a')]({'where':{'type':_0x59c1ad,'resourceId':_0x25dd9c['id']}})[_0x9989('0x26')](function(){return _0x3ddb72;});})[_0x9989('0x26')](function(){_0x3d3b1d[_0x9989('0x1b')](0xcc)[_0x9989('0x2b')]();});}};}function handleEntityNotFound(_0x286045,_0xa563db){return function(_0x58cb5b){if(!_0x58cb5b){_0x286045[_0x9989('0x1a')](0x194);}return _0x58cb5b;};}function handleError(_0x451ee5,_0x45ed0e){_0x45ed0e=_0x45ed0e||0x1f4;return function(_0x36f314){logger[_0x9989('0x2c')](_0x36f314['stack']);if(_0x36f314[_0x9989('0x2d')]){delete _0x36f314[_0x9989('0x2d')];}_0x451ee5[_0x9989('0x1b')](_0x45ed0e)[_0x9989('0x2e')](_0x36f314);};}exports[_0x9989('0x2f')]=function(_0x159cf5,_0x14b267){var _0x2d6079={},_0x10e4ec={},_0xa92400={'count':0x0,'rows':[]};var _0x13a5f8=_[_0x9989('0x30')](db[_0x9989('0x31')][_0x9989('0x32')],function(_0x41ae96){return{'name':_0x41ae96[_0x9989('0x33')],'type':_0x41ae96[_0x9989('0x34')][_0x9989('0x35')]};});_0x10e4ec['model']=_['map'](_0x13a5f8,'name');_0x10e4ec[_0x9989('0x36')]=_[_0x9989('0x37')](_0x159cf5['query']);_0x10e4ec['filters']=_['intersection'](_0x10e4ec[_0x9989('0x38')],_0x10e4ec[_0x9989('0x36')]);_0x2d6079[_0x9989('0x39')]=_[_0x9989('0x3a')](_0x10e4ec['model'],qs['fields'](_0x159cf5['query']['fields']));_0x2d6079['attributes']=_0x2d6079['attributes'][_0x9989('0x3b')]?_0x2d6079[_0x9989('0x39')]:_0x10e4ec[_0x9989('0x38')];if(!_0x159cf5[_0x9989('0x36')][_0x9989('0x3c')](_0x9989('0x3d'))){_0x2d6079[_0x9989('0x1e')]=qs['limit'](_0x159cf5[_0x9989('0x36')][_0x9989('0x1e')]);_0x2d6079[_0x9989('0x20')]=qs[_0x9989('0x20')](_0x159cf5[_0x9989('0x36')]['offset']);}_0x2d6079['order']=qs['sort'](_0x159cf5[_0x9989('0x36')][_0x9989('0x3e')]);_0x2d6079[_0x9989('0x3f')]=qs[_0x9989('0x40')](_[_0x9989('0x41')](_0x159cf5[_0x9989('0x36')],_0x10e4ec[_0x9989('0x40')]),_0x13a5f8);if(_0x159cf5['query'][_0x9989('0x42')]){_0x2d6079[_0x9989('0x3f')]=_['merge'](_0x2d6079[_0x9989('0x3f')],{'$or':_[_0x9989('0x30')](_0x13a5f8,function(_0x5a019f){if(_0x5a019f['type']!==_0x9989('0x43')){var _0x531324={};_0x531324[_0x5a019f[_0x9989('0x2d')]]={'$like':'%'+_0x159cf5[_0x9989('0x36')][_0x9989('0x42')]+'%'};return _0x531324;}})});}_0x2d6079=_[_0x9989('0x44')]({},_0x2d6079,_0x159cf5[_0x9989('0x45')]);var _0x35cbda={'where':_0x2d6079['where']};return db[_0x9989('0x31')][_0x9989('0x1f')](_0x35cbda)['then'](function(_0x50d1c6){_0xa92400[_0x9989('0x1f')]=_0x50d1c6;if(_0x159cf5[_0x9989('0x36')]['includeAll']){_0x2d6079['include']=[{'all':!![]}];}return db[_0x9989('0x31')][_0x9989('0x46')](_0x2d6079);})[_0x9989('0x26')](function(_0x47c554){_0xa92400[_0x9989('0x47')]=_0x47c554;return _0xa92400;})[_0x9989('0x26')](respondWithFilteredResult(_0x14b267,_0x2d6079))[_0x9989('0x48')](handleError(_0x14b267,null));};exports[_0x9989('0x49')]=function(_0x1abd43,_0x10d0d3){var _0x13b18d={'raw':!![],'where':{'id':_0x1abd43['params']['id']}},_0xb55c9d={};_0xb55c9d['model']=_['keys'](db[_0x9989('0x31')][_0x9989('0x32')]);_0xb55c9d['query']=_['keys'](_0x1abd43['query']);_0xb55c9d[_0x9989('0x40')]=_[_0x9989('0x3a')](_0xb55c9d[_0x9989('0x38')],_0xb55c9d[_0x9989('0x36')]);_0x13b18d[_0x9989('0x39')]=_['intersection'](_0xb55c9d[_0x9989('0x38')],qs['fields'](_0x1abd43[_0x9989('0x36')][_0x9989('0x4a')]));_0x13b18d[_0x9989('0x39')]=_0x13b18d[_0x9989('0x39')][_0x9989('0x3b')]?_0x13b18d[_0x9989('0x39')]:_0xb55c9d[_0x9989('0x38')];if(_0x1abd43[_0x9989('0x36')]['includeAll']){_0x13b18d[_0x9989('0x4b')]=[{'all':!![]}];}_0x13b18d=_[_0x9989('0x44')]({},_0x13b18d,_0x1abd43[_0x9989('0x45')]);return db[_0x9989('0x31')][_0x9989('0x4c')](_0x13b18d)[_0x9989('0x26')](handleEntityNotFound(_0x10d0d3,null))[_0x9989('0x26')](respondWithResult(_0x10d0d3,null))[_0x9989('0x48')](handleError(_0x10d0d3,null));};exports[_0x9989('0x4d')]=function(_0x4a1d8b,_0x2d49ee){return db[_0x9989('0x31')]['create'](_0x4a1d8b['body'],{})['then'](function(_0x1f0c3c){var _0x414874=_0x4a1d8b[_0x9989('0x4e')][_0x9989('0x27')]({'plain':!![]});if(!_0x414874)throw new Error(_0x9989('0x4f'));if(_0x414874['role']==='user'){var _0x43c1ea=_0x1f0c3c[_0x9989('0x27')]({'plain':!![]});var _0x1c6dc8=_0x9989('0x28');return db['UserProfileSection'][_0x9989('0x4c')]({'where':{'name':_0x1c6dc8,'userProfileId':_0x414874[_0x9989('0x50')]},'raw':!![]})[_0x9989('0x26')](function(_0x4a2b2f){if(_0x4a2b2f&&_0x4a2b2f[_0x9989('0x51')]===0x0){return db[_0x9989('0x29')][_0x9989('0x4d')]({'name':_0x43c1ea['name'],'resourceId':_0x43c1ea['id'],'type':_0x4a2b2f['name'],'sectionId':_0x4a2b2f['id']},{})[_0x9989('0x26')](function(){return _0x1f0c3c;});}else{return _0x1f0c3c;}})['catch'](function(_0x19620e){logger[_0x9989('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19620e);throw _0x19620e;});}return _0x1f0c3c;})['then'](respondWithResult(_0x2d49ee,0xc9))[_0x9989('0x48')](handleError(_0x2d49ee,null));};exports['update']=function(_0xca25a,_0x1a29da){if(_0xca25a['body']['id']){delete _0xca25a[_0x9989('0x52')]['id'];}return db[_0x9989('0x31')][_0x9989('0x4c')]({'where':{'id':_0xca25a['params']['id']}})[_0x9989('0x26')](handleEntityNotFound(_0x1a29da,null))['then'](saveUpdates(_0xca25a[_0x9989('0x52')],null))[_0x9989('0x26')](respondWithResult(_0x1a29da,null))[_0x9989('0x48')](handleError(_0x1a29da,null));};exports[_0x9989('0x2a')]=function(_0x7a3d02,_0x3264c4){return db['SquareOdbc'][_0x9989('0x4c')]({'where':{'id':_0x7a3d02[_0x9989('0x53')]['id']}})['then'](handleEntityNotFound(_0x3264c4,null))[_0x9989('0x26')](removeEntity(_0x3264c4,null))[_0x9989('0x48')](handleError(_0x3264c4,null));};exports[_0x9989('0x54')]=function(_0x10c1fd,_0x45aba5,_0x2465c4){var _0x3f7d63;return db[_0x9989('0x31')][_0x9989('0x4c')]({'where':{'id':_0x10c1fd[_0x9989('0x53')]['id']},'attributes':['id',_0x9989('0x55')]})[_0x9989('0x26')](handleEntityNotFound(_0x45aba5,null))[_0x9989('0x26')](function(_0x236147){if(_0x236147){var _0x3a5d6a=require(_0x9989('0x56'))();_0x3a5d6a[_0x9989('0x57')](_0x236147[_0x9989('0x55')]);_0x3a5d6a[_0x9989('0x58')]();return _0x236147;}})[_0x9989('0x26')](respondWithResult(_0x45aba5,null))[_0x9989('0x48')](handleError(_0x45aba5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index adee988..2f76689 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 _0x9a3d=['bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','moment'];(function(_0x117eae,_0x40f89f){var _0x5cd499=function(_0x34e7a0){while(--_0x34e7a0){_0x117eae['push'](_0x117eae['shift']());}};_0x5cd499(++_0x40f89f);}(_0x9a3d,0x14e));var _0xd9a3=function(_0x7bb70d,_0x4e79dc){_0x7bb70d=_0x7bb70d-0x0;var _0x5c7a09=_0x9a3d[_0x7bb70d];return _0x5c7a09;};'use strict';var _=require('lodash');var util=require(_0xd9a3('0x0'));var logger=require(_0xd9a3('0x1'))(_0xd9a3('0x2'));var moment=require(_0xd9a3('0x3'));var BPromise=require(_0xd9a3('0x4'));var rp=require(_0xd9a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9a3('0x6'));var config=require(_0xd9a3('0x7'));var attributes=require(_0xd9a3('0x8'));module[_0xd9a3('0x9')]=function(_0x5355b8,_0x1ff64f){return _0x5355b8[_0xd9a3('0xa')](_0xd9a3('0xb'),attributes,{'tableName':_0xd9a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe29=['request-promise','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment'];(function(_0x4c99fc,_0x29a9d0){var _0x170c37=function(_0x13793c){while(--_0x13793c){_0x4c99fc['push'](_0x4c99fc['shift']());}};_0x170c37(++_0x29a9d0);}(_0xfe29,0xf9));var _0x9fe2=function(_0x17d116,_0x3f5029){_0x17d116=_0x17d116-0x0;var _0x557de8=_0xfe29[_0x17d116];return _0x557de8;};'use strict';var _=require(_0x9fe2('0x0'));var util=require('util');var logger=require(_0x9fe2('0x1'))(_0x9fe2('0x2'));var moment=require(_0x9fe2('0x3'));var BPromise=require('bluebird');var rp=require(_0x9fe2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fe2('0x5'));var config=require('../../config/environment');var attributes=require(_0x9fe2('0x6'));module[_0x9fe2('0x7')]=function(_0x21c345,_0x14b0da){return _0x21c345[_0x9fe2('0x8')](_0x9fe2('0x9'),attributes,{'tableName':_0x9fe2('0xa'),'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 ddc16b1..5b49839 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 _0x1665=['where','attributes','include','map','model','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','ShowSquareOdbc','SquareOdbc','options','raw'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x1665,0x114));var _0x5166=function(_0x593f13,_0x4301b0){_0x593f13=_0x593f13-0x0;var _0x5e702c=_0x1665[_0x593f13];return _0x5e702c;};'use strict';var _=require(_0x5166('0x0'));var util=require(_0x5166('0x1'));var moment=require('moment');var BPromise=require(_0x5166('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5166('0x3'));var db=require(_0x5166('0x4'))['db'];var utils=require(_0x5166('0x5'));var logger=require('../../config/logger')(_0x5166('0x6'));var config=require('../../config/environment');var jayson=require(_0x5166('0x7'));var client=jayson[_0x5166('0x8')][_0x5166('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9aa3,_0x3047b8,_0x122167){return new BPromise(function(_0xd6ba06,_0x1a0d25){return client[_0x5166('0xa')](_0x5d9aa3,_0x122167)[_0x5166('0xb')](function(_0x4f25b1){logger[_0x5166('0xc')](_0x5166('0xd'),_0x3047b8,_0x5166('0xe'));logger[_0x5166('0xf')](_0x5166('0x10'),_0x3047b8,_0x5166('0xe'),JSON['stringify'](_0x4f25b1));if(_0x4f25b1['error']){if(_0x4f25b1[_0x5166('0x11')]['code']===0x1f4){logger[_0x5166('0x11')](_0x5166('0xd'),_0x3047b8,_0x4f25b1[_0x5166('0x11')][_0x5166('0x12')]);return _0x1a0d25(_0x4f25b1['error'][_0x5166('0x12')]);}logger['error'](_0x5166('0xd'),_0x3047b8,_0x4f25b1[_0x5166('0x11')][_0x5166('0x12')]);return _0xd6ba06(_0x4f25b1[_0x5166('0x11')][_0x5166('0x12')]);}else{logger[_0x5166('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x3047b8,'request\x20sent');_0xd6ba06(_0x4f25b1[_0x5166('0x13')][_0x5166('0x12')]);}})['catch'](function(_0xfb5c69){logger[_0x5166('0x11')](_0x5166('0xd'),_0x3047b8,_0xfb5c69);_0x1a0d25(_0xfb5c69);});});}exports[_0x5166('0x14')]=function(_0x32457c){var _0x28a62b=this;return new Promise(function(_0x37b945,_0x326f16){return db[_0x5166('0x15')]['find']({'raw':_0x32457c[_0x5166('0x16')]?_0x32457c[_0x5166('0x16')][_0x5166('0x17')]===undefined?!![]:![]:!![],'where':_0x32457c[_0x5166('0x16')]?_0x32457c['options'][_0x5166('0x18')]||null:null,'attributes':_0x32457c[_0x5166('0x16')]?_0x32457c[_0x5166('0x16')][_0x5166('0x19')]||null:null,'include':_0x32457c[_0x5166('0x16')]?_0x32457c['options'][_0x5166('0x1a')]?_[_0x5166('0x1b')](_0x32457c['options']['include'],function(_0x5a17a2){return{'model':db[_0x5a17a2['model']],'as':_0x5a17a2['as'],'attributes':_0x5a17a2[_0x5166('0x19')],'include':_0x5a17a2[_0x5166('0x1a')]?_[_0x5166('0x1b')](_0x5a17a2[_0x5166('0x1a')],function(_0x905bc5){return{'model':db[_0x905bc5['model']],'as':_0x905bc5['as'],'attributes':_0x905bc5[_0x5166('0x19')],'include':_0x905bc5[_0x5166('0x1a')]?_[_0x5166('0x1b')](_0x905bc5['include'],function(_0x439165){return{'model':db[_0x439165[_0x5166('0x1c')]],'as':_0x439165['as'],'attributes':_0x439165[_0x5166('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2c0b){logger[_0x5166('0xc')](_0x5166('0x14'),_0x32457c);logger[_0x5166('0xf')](_0x5166('0x14'),_0x32457c,JSON[_0x5166('0x1d')](_0x2d2c0b));_0x37b945(_0x2d2c0b);})['catch'](function(_0x16e92e){logger[_0x5166('0x11')](_0x5166('0x14'),_0x16e92e['message'],_0x32457c);_0x326f16(_0x28a62b['error'](0x1f4,_0x16e92e['message']));});});}; \ No newline at end of file +var _0xa290=['../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis'];(function(_0x32a2e7,_0x1b3203){var _0x3ae8ef=function(_0x404807){while(--_0x404807){_0x32a2e7['push'](_0x32a2e7['shift']());}};_0x3ae8ef(++_0x1b3203);}(_0xa290,0x1cc));var _0x0a29=function(_0x467ea6,_0x2a97a7){_0x467ea6=_0x467ea6-0x0;var _0x2f0ed3=_0xa290[_0x467ea6];return _0x2f0ed3;};'use strict';var _=require(_0x0a29('0x0'));var util=require(_0x0a29('0x1'));var moment=require(_0x0a29('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a29('0x3'));var fs=require('fs');var Redis=require(_0x0a29('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a29('0x5'))(_0x0a29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0a29('0x7'));var client=jayson[_0x0a29('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b208,_0x3993d8,_0x506f8b){return new BPromise(function(_0x6de66b,_0x39147a){return client[_0x0a29('0x9')](_0x50b208,_0x506f8b)[_0x0a29('0xa')](function(_0x150c85){logger[_0x0a29('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x3993d8,_0x0a29('0xc'));logger['debug'](_0x0a29('0xd'),_0x3993d8,'request\x20sent',JSON[_0x0a29('0xe')](_0x150c85));if(_0x150c85[_0x0a29('0xf')]){if(_0x150c85[_0x0a29('0xf')][_0x0a29('0x10')]===0x1f4){logger[_0x0a29('0xf')](_0x0a29('0x11'),_0x3993d8,_0x150c85[_0x0a29('0xf')][_0x0a29('0x12')]);return _0x39147a(_0x150c85[_0x0a29('0xf')][_0x0a29('0x12')]);}logger[_0x0a29('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x3993d8,_0x150c85[_0x0a29('0xf')][_0x0a29('0x12')]);return _0x6de66b(_0x150c85[_0x0a29('0xf')][_0x0a29('0x12')]);}else{logger[_0x0a29('0xb')](_0x0a29('0x11'),_0x3993d8,_0x0a29('0xc'));_0x6de66b(_0x150c85[_0x0a29('0x13')][_0x0a29('0x12')]);}})[_0x0a29('0x14')](function(_0x1afe60){logger['error'](_0x0a29('0x11'),_0x3993d8,_0x1afe60);_0x39147a(_0x1afe60);});});}exports[_0x0a29('0x15')]=function(_0x5e96fa){var _0x45fca4=this;return new Promise(function(_0x26b443,_0x38b47f){return db[_0x0a29('0x16')]['find']({'raw':_0x5e96fa[_0x0a29('0x17')]?_0x5e96fa[_0x0a29('0x17')][_0x0a29('0x18')]===undefined?!![]:![]:!![],'where':_0x5e96fa[_0x0a29('0x17')]?_0x5e96fa[_0x0a29('0x17')][_0x0a29('0x19')]||null:null,'attributes':_0x5e96fa[_0x0a29('0x17')]?_0x5e96fa[_0x0a29('0x17')][_0x0a29('0x1a')]||null:null,'include':_0x5e96fa[_0x0a29('0x17')]?_0x5e96fa[_0x0a29('0x17')][_0x0a29('0x1b')]?_[_0x0a29('0x1c')](_0x5e96fa[_0x0a29('0x17')]['include'],function(_0x22f76e){return{'model':db[_0x22f76e[_0x0a29('0x1d')]],'as':_0x22f76e['as'],'attributes':_0x22f76e[_0x0a29('0x1a')],'include':_0x22f76e[_0x0a29('0x1b')]?_[_0x0a29('0x1c')](_0x22f76e[_0x0a29('0x1b')],function(_0x3f6576){return{'model':db[_0x3f6576['model']],'as':_0x3f6576['as'],'attributes':_0x3f6576[_0x0a29('0x1a')],'include':_0x3f6576['include']?_[_0x0a29('0x1c')](_0x3f6576[_0x0a29('0x1b')],function(_0x33d0d6){return{'model':db[_0x33d0d6['model']],'as':_0x33d0d6['as'],'attributes':_0x33d0d6[_0x0a29('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a29('0xa')](function(_0x28291e){logger[_0x0a29('0xb')](_0x0a29('0x15'),_0x5e96fa);logger[_0x0a29('0x1e')](_0x0a29('0x15'),_0x5e96fa,JSON[_0x0a29('0xe')](_0x28291e));_0x26b443(_0x28291e);})[_0x0a29('0x14')](function(_0xb9d5d7){logger['error']('ShowSquareOdbc',_0xb9d5d7[_0x0a29('0x12')],_0x5e96fa);_0x38b47f(_0x45fca4[_0x0a29('0xf')](0x1f4,_0xb9d5d7[_0x0a29('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 1a49e36..3cef40d 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 _0xa4fb=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x2e3fe3,_0xec368e){var _0x590ae1=function(_0x1a72a2){while(--_0x1a72a2){_0x2e3fe3['push'](_0x2e3fe3['shift']());}};_0x590ae1(++_0xec368e);}(_0xa4fb,0xea));var _0xba4f=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xa4fb[_0x4715d2];return _0x141811;};'use strict';var multer=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var path=require(_0xba4f('0x2'));var timeout=require('connect-timeout');var express=require(_0xba4f('0x3'));var router=express['Router']();var fs_extra=require(_0xba4f('0x4'));var auth=require(_0xba4f('0x5'));var interaction=require(_0xba4f('0x6'));var config=require(_0xba4f('0x7'));var controller=require(_0xba4f('0x8'));router[_0xba4f('0x9')]('/',auth[_0xba4f('0xa')](),controller[_0xba4f('0xb')]);router[_0xba4f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba4f('0xc')]);router[_0xba4f('0xd')]('/',auth[_0xba4f('0xa')](),controller[_0xba4f('0xe')]);router[_0xba4f('0xf')](_0xba4f('0x10'),auth[_0xba4f('0xa')](),controller[_0xba4f('0x11')]);router[_0xba4f('0x12')](_0xba4f('0x10'),auth[_0xba4f('0xa')](),controller[_0xba4f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9b52=['fs-extra','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x541e4f,_0x48d7fa){var _0x5c1711=function(_0x10fdb1){while(--_0x10fdb1){_0x541e4f['push'](_0x541e4f['shift']());}};_0x5c1711(++_0x48d7fa);}(_0x9b52,0x1e8));var _0x29b5=function(_0x331085,_0x46ef3b){_0x331085=_0x331085-0x0;var _0x1547f4=_0x9b52[_0x331085];return _0x1547f4;};'use strict';var multer=require(_0x29b5('0x0'));var util=require(_0x29b5('0x1'));var path=require(_0x29b5('0x2'));var timeout=require(_0x29b5('0x3'));var express=require(_0x29b5('0x4'));var router=express[_0x29b5('0x5')]();var fs_extra=require(_0x29b5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29b5('0x7'));var controller=require(_0x29b5('0x8'));router[_0x29b5('0x9')]('/',auth[_0x29b5('0xa')](),controller[_0x29b5('0xb')]);router['get']('/:id',auth[_0x29b5('0xa')](),controller[_0x29b5('0xc')]);router[_0x29b5('0xd')]('/',auth[_0x29b5('0xa')](),controller['create']);router[_0x29b5('0xe')](_0x29b5('0xf'),auth[_0x29b5('0xa')](),controller[_0x29b5('0x10')]);router[_0x29b5('0x11')](_0x29b5('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x29b5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 73ac471..26471c9 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 _0xa145=['long','production','toString','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa145,0x1a5));var _0x5a14=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xa145[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0x5a14('0x0'));module[_0x5a14('0x1')]={'name':{'type':Sequelize[_0x5a14('0x2')],'unique':_0x5a14('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5a14('0x2')]},'notes':{'type':Sequelize[_0x5a14('0x4')]},'preproduction':{'type':Sequelize[_0x5a14('0x5')]('long'),'get':function(){if(this[_0x5a14('0x6')](_0x5a14('0x7'))){return this[_0x5a14('0x6')](_0x5a14('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x5a14('0x8')),'get':function(){if(this[_0x5a14('0x6')](_0x5a14('0x9'))){return this[_0x5a14('0x6')]('production')[_0x5a14('0xa')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7ebb=['production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long'];(function(_0x2df5fd,_0x5dfa77){var _0x97f729=function(_0x3ea627){while(--_0x3ea627){_0x2df5fd['push'](_0x2df5fd['shift']());}};_0x97f729(++_0x5dfa77);}(_0x7ebb,0x161));var _0xb7eb=function(_0x2113d8,_0x5a3232){_0x2113d8=_0x2113d8-0x0;var _0x1c8538=_0x7ebb[_0x2113d8];return _0x1c8538;};'use strict';var Sequelize=require(_0xb7eb('0x0'));module[_0xb7eb('0x1')]={'name':{'type':Sequelize[_0xb7eb('0x2')],'unique':_0xb7eb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb7eb('0x2')]},'notes':{'type':Sequelize[_0xb7eb('0x4')]},'preproduction':{'type':Sequelize[_0xb7eb('0x5')]('long'),'get':function(){if(this[_0xb7eb('0x6')](_0xb7eb('0x7'))){return this[_0xb7eb('0x6')](_0xb7eb('0x7'))[_0xb7eb('0x8')](_0xb7eb('0x9'));}}},'production':{'type':Sequelize[_0xb7eb('0x5')](_0xb7eb('0xa')),'get':function(){if(this[_0xb7eb('0x6')](_0xb7eb('0xb'))){return this['getDataValue']('production')[_0xb7eb('0x8')](_0xb7eb('0x9'));}}},'savedAt':{'type':Sequelize[_0xb7eb('0xc')]},'publishedAt':{'type':Sequelize[_0xb7eb('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 4d291a5..d59f693 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 _0x7c66=['offset','undefined','set','update','then','destroy','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','production','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c66,0xc6));var _0x67c6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7c66[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x67c6('0x0'));var Redis=require(_0x67c6('0x1'));var qs=require(_0x67c6('0x2'));var logger=require('../../config/logger')(_0x67c6('0x3'));var config=require(_0x67c6('0x4'));var db=require(_0x67c6('0x5'))['db'];config[_0x67c6('0x6')]=_[_0x67c6('0x7')](config[_0x67c6('0x6')],{'host':_0x67c6('0x8'),'port':0x18eb});var socket=require(_0x67c6('0x9'))(new Redis(config[_0x67c6('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x288d18,_0x4fbf6c){_0x4fbf6c=_0x4fbf6c||0xc8;return function(_0x234304){if(_0x234304){return _0x288d18[_0x67c6('0xa')](_0x4fbf6c)[_0x67c6('0xb')](_0x234304);}};}function respondWithFilteredResult(_0x4e092f,_0x124ece){return function(_0xc6be6f){if(_0xc6be6f){var _0x3d22f9=typeof _0x124ece[_0x67c6('0xc')]==='undefined'&&typeof _0x124ece['limit']===_0x67c6('0xd');var _0x2c7933=_0xc6be6f['count'];var _0x21a932=_0x3d22f9?0x0:_0x124ece[_0x67c6('0xc')];var _0x46a32f=_0x3d22f9?_0xc6be6f['count']:_0x124ece['offset']+_0x124ece['limit'];var _0x5d5c30;if(_0x46a32f>=_0x2c7933){_0x46a32f=_0x2c7933;_0x5d5c30=0xc8;}else{_0x5d5c30=0xce;}_0x4e092f[_0x67c6('0xa')](_0x5d5c30);return _0x4e092f[_0x67c6('0xe')]('Content-Range',_0x21a932+'-'+_0x46a32f+'/'+_0x2c7933)['json'](_0xc6be6f);}return null;};}function saveUpdates(_0x5c85eb){return function(_0x3127e5){if(_0x3127e5){return _0x3127e5[_0x67c6('0xf')](_0x5c85eb)[_0x67c6('0x10')](function(_0x551241){return _0x551241;});}return null;};}function removeEntity(_0x543505){return function(_0x2d7dc5){if(_0x2d7dc5){return _0x2d7dc5[_0x67c6('0x11')]()['then'](function(){var _0x35c6cb=_0x2d7dc5['get']({'plain':!![]});var _0x23350b=_0x67c6('0x12');return db[_0x67c6('0x13')][_0x67c6('0x11')]({'where':{'type':_0x23350b,'resourceId':_0x35c6cb['id']}})[_0x67c6('0x10')](function(){return _0x2d7dc5;});})[_0x67c6('0x10')](function(){var _0x15bcb2=new Redis(config[_0x67c6('0x6')]);_0x15bcb2[_0x67c6('0x14')](_0x67c6('0x15'),JSON[_0x67c6('0x16')]({'id':_0x2d7dc5['id'],'deleted':!![]}));})[_0x67c6('0x10')](function(){_0x543505['status'](0xcc)[_0x67c6('0x17')]();});}};}function handleEntityNotFound(_0x394fc3){return function(_0x566d8d){if(!_0x566d8d){_0x394fc3[_0x67c6('0x18')](0x194);}return _0x566d8d;};}function handleError(_0x38b10b,_0x2d7029){_0x2d7029=_0x2d7029||0x1f4;return function(_0xbadd18){logger[_0x67c6('0x19')](_0xbadd18['stack']);if(_0xbadd18[_0x67c6('0x1a')]){delete _0xbadd18[_0x67c6('0x1a')];}_0x38b10b[_0x67c6('0xa')](_0x2d7029)[_0x67c6('0x1b')](_0xbadd18);};}exports[_0x67c6('0x1c')]=function(_0xc33b7f,_0x18eb02){var _0x598e75={},_0x38cb09={},_0x2176ba={'count':0x0,'rows':[]};var _0x359c37=_[_0x67c6('0x1d')](db[_0x67c6('0x1e')][_0x67c6('0x1f')],function(_0x429bb1){return{'name':_0x429bb1[_0x67c6('0x20')],'type':_0x429bb1[_0x67c6('0x21')]['key']};});_0x38cb09['model']=_[_0x67c6('0x1d')](_0x359c37,_0x67c6('0x1a'));_0x38cb09[_0x67c6('0x22')]=_[_0x67c6('0x23')](_0xc33b7f[_0x67c6('0x22')]);_0x38cb09['filters']=_[_0x67c6('0x24')](_0x38cb09[_0x67c6('0x25')],_0x38cb09[_0x67c6('0x22')]);_0x598e75[_0x67c6('0x26')]=_['intersection'](_0x38cb09[_0x67c6('0x25')],qs[_0x67c6('0x27')](_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x27')]));_0x598e75[_0x67c6('0x26')]=_0x598e75['attributes']['length']?_0x598e75[_0x67c6('0x26')]:_0x38cb09[_0x67c6('0x25')];if(!_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x28')](_0x67c6('0x29'))){_0x598e75['limit']=qs[_0x67c6('0x2a')](_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x2a')]);_0x598e75[_0x67c6('0xc')]=qs[_0x67c6('0xc')](_0xc33b7f['query'][_0x67c6('0xc')]);}_0x598e75[_0x67c6('0x2b')]=qs['sort'](_0xc33b7f['query'][_0x67c6('0x2c')]);_0x598e75[_0x67c6('0x2d')]=qs[_0x67c6('0x2e')](_[_0x67c6('0x2f')](_0xc33b7f[_0x67c6('0x22')],_0x38cb09['filters']),_0x359c37);if(_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x30')]){_0x598e75[_0x67c6('0x2d')]=_['merge'](_0x598e75[_0x67c6('0x2d')],{'$or':_[_0x67c6('0x1d')](_0x359c37,function(_0x2df079){if(_0x2df079[_0x67c6('0x21')]!==_0x67c6('0x31')){var _0x2c46b1={};_0x2c46b1[_0x2df079[_0x67c6('0x1a')]]={'$like':'%'+_0xc33b7f[_0x67c6('0x22')][_0x67c6('0x30')]+'%'};return _0x2c46b1;}})});}_0x598e75=_[_0x67c6('0x32')]({},_0x598e75,_0xc33b7f[_0x67c6('0x33')]);var _0x4c5aff={'where':_0x598e75[_0x67c6('0x2d')]};return db['SquareProject'][_0x67c6('0x34')](_0x4c5aff)[_0x67c6('0x10')](function(_0x55be31){_0x2176ba[_0x67c6('0x34')]=_0x55be31;if(_0xc33b7f['query'][_0x67c6('0x35')]){_0x598e75['include']=[{'all':!![]}];}return db[_0x67c6('0x1e')][_0x67c6('0x36')](_0x598e75);})[_0x67c6('0x10')](function(_0xb2e17f){_0x2176ba['rows']=_0xb2e17f;return _0x2176ba;})['then'](respondWithFilteredResult(_0x18eb02,_0x598e75))[_0x67c6('0x37')](handleError(_0x18eb02,null));};exports[_0x67c6('0x38')]=function(_0x114cf5,_0x1387f5){var _0x50279c={'raw':![],'where':{'id':_0x114cf5[_0x67c6('0x39')]['id']}},_0x50fa1d={};_0x50fa1d['model']=_[_0x67c6('0x23')](db['SquareProject']['rawAttributes']);_0x50fa1d['query']=_['keys'](_0x114cf5['query']);_0x50fa1d['filters']=_[_0x67c6('0x24')](_0x50fa1d['model'],_0x50fa1d[_0x67c6('0x22')]);_0x50279c[_0x67c6('0x26')]=_[_0x67c6('0x24')](_0x50fa1d[_0x67c6('0x25')],qs[_0x67c6('0x27')](_0x114cf5['query'][_0x67c6('0x27')]));_0x50279c[_0x67c6('0x26')]=_0x50279c[_0x67c6('0x26')][_0x67c6('0x3a')]?_0x50279c[_0x67c6('0x26')]:_0x50fa1d['model'];if(_0x114cf5[_0x67c6('0x22')][_0x67c6('0x35')]){_0x50279c[_0x67c6('0x3b')]=[{'all':!![]}];}_0x50279c=_[_0x67c6('0x32')]({},_0x50279c,_0x114cf5[_0x67c6('0x33')]);return db[_0x67c6('0x1e')][_0x67c6('0x3c')](_0x50279c)[_0x67c6('0x10')](handleEntityNotFound(_0x1387f5,null))[_0x67c6('0x10')](respondWithResult(_0x1387f5,null))['catch'](handleError(_0x1387f5,null));};exports['create']=function(_0x54dd0f,_0x72dab0){return db[_0x67c6('0x1e')][_0x67c6('0x3d')](_0x54dd0f[_0x67c6('0x3e')],{})[_0x67c6('0x10')](function(_0x3e2b4b){var _0x54f612=_0x54dd0f[_0x67c6('0x3f')]['get']({'plain':!![]});if(!_0x54f612)throw new Error(_0x67c6('0x40'));if(_0x54f612[_0x67c6('0x41')]===_0x67c6('0x3f')){var _0xb01878=_0x3e2b4b[_0x67c6('0x42')]({'plain':!![]});var _0x53f942=_0x67c6('0x12');return db[_0x67c6('0x43')][_0x67c6('0x3c')]({'where':{'name':_0x53f942,'userProfileId':_0x54f612['userProfileId']},'raw':!![]})[_0x67c6('0x10')](function(_0x1faa20){if(_0x1faa20&&_0x1faa20[_0x67c6('0x44')]===0x0){return db[_0x67c6('0x13')][_0x67c6('0x3d')]({'name':_0xb01878[_0x67c6('0x1a')],'resourceId':_0xb01878['id'],'type':_0x1faa20[_0x67c6('0x1a')],'sectionId':_0x1faa20['id']},{})['then'](function(){return _0x3e2b4b;});}else{return _0x3e2b4b;}})[_0x67c6('0x37')](function(_0x4146d1){logger[_0x67c6('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4146d1);throw _0x4146d1;});}return _0x3e2b4b;})['then'](respondWithResult(_0x72dab0,0xc9))[_0x67c6('0x37')](handleError(_0x72dab0,null));};exports[_0x67c6('0xf')]=function(_0x564185,_0x108974){if(_0x564185[_0x67c6('0x3e')]['id']){delete _0x564185[_0x67c6('0x3e')]['id'];}return db[_0x67c6('0x1e')][_0x67c6('0x3c')]({'where':{'id':_0x564185[_0x67c6('0x39')]['id']}})[_0x67c6('0x10')](handleEntityNotFound(_0x108974,null))[_0x67c6('0x10')](saveUpdates(_0x564185[_0x67c6('0x3e')],null))['then'](function(_0x38440e){if(!_0x38440e)return;var _0x5940aa=_0x38440e[_0x67c6('0x42')]({'plain':!![]});return _0x5940aa;})[_0x67c6('0x10')](function(_0x19a056){var _0x128614=new Redis(config[_0x67c6('0x6')]);_0x128614[_0x67c6('0x14')]('agi',JSON[_0x67c6('0x16')](_['pick'](_0x19a056,['id',_0x67c6('0x1a'),_0x67c6('0x45')])));return _0x19a056;})[_0x67c6('0x10')](respondWithResult(_0x108974,null))[_0x67c6('0x37')](handleError(_0x108974,null));};exports[_0x67c6('0x11')]=function(_0x5cba71,_0x512dda){return db['SquareProject'][_0x67c6('0x3c')]({'where':{'id':_0x5cba71[_0x67c6('0x39')]['id']}})[_0x67c6('0x10')](handleEntityNotFound(_0x512dda,null))[_0x67c6('0x10')](removeEntity(_0x512dda,null))[_0x67c6('0x37')](handleError(_0x512dda,null));}; \ No newline at end of file +var _0x67c9=['include','rows','show','includeAll','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','error','body','params','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','json','undefined','limit','offset','count','status','set','update','destroy','then','get','SquareProjects','publish','agi','stringify','end','sendStatus','stack','name','send','index','SquareProject','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options'];(function(_0x5184be,_0x273aff){var _0x1845ba=function(_0x27a4da){while(--_0x27a4da){_0x5184be['push'](_0x5184be['shift']());}};_0x1845ba(++_0x273aff);}(_0x67c9,0xdf));var _0x967c=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0x67c9[_0x1ce9ea];return _0x2a95b9;};'use strict';var _=require(_0x967c('0x0'));var Redis=require(_0x967c('0x1'));var qs=require(_0x967c('0x2'));var logger=require('../../config/logger')('api');var config=require(_0x967c('0x3'));var db=require(_0x967c('0x4'))['db'];config['redis']=_[_0x967c('0x5')](config[_0x967c('0x6')],{'host':_0x967c('0x7'),'port':0x18eb});var socket=require(_0x967c('0x8'))(new Redis(config['redis']));require(_0x967c('0x9'))[_0x967c('0xa')](socket);function respondWithResult(_0xc352cb,_0x22216c){_0x22216c=_0x22216c||0xc8;return function(_0x2e9e23){if(_0x2e9e23){return _0xc352cb['status'](_0x22216c)[_0x967c('0xb')](_0x2e9e23);}};}function respondWithFilteredResult(_0x43e4ff,_0x3045d9){return function(_0x5642ac){if(_0x5642ac){var _0x4120af=typeof _0x3045d9['offset']===_0x967c('0xc')&&typeof _0x3045d9[_0x967c('0xd')]==='undefined';var _0x2aaa19=_0x5642ac['count'];var _0x4f1415=_0x4120af?0x0:_0x3045d9[_0x967c('0xe')];var _0x38f59c=_0x4120af?_0x5642ac[_0x967c('0xf')]:_0x3045d9[_0x967c('0xe')]+_0x3045d9['limit'];var _0x5502a4;if(_0x38f59c>=_0x2aaa19){_0x38f59c=_0x2aaa19;_0x5502a4=0xc8;}else{_0x5502a4=0xce;}_0x43e4ff[_0x967c('0x10')](_0x5502a4);return _0x43e4ff[_0x967c('0x11')]('Content-Range',_0x4f1415+'-'+_0x38f59c+'/'+_0x2aaa19)[_0x967c('0xb')](_0x5642ac);}return null;};}function saveUpdates(_0x170331){return function(_0x30ec35){if(_0x30ec35){return _0x30ec35[_0x967c('0x12')](_0x170331)['then'](function(_0xa258c){return _0xa258c;});}return null;};}function removeEntity(_0x2deacb){return function(_0x311354){if(_0x311354){return _0x311354[_0x967c('0x13')]()[_0x967c('0x14')](function(){var _0x57ec68=_0x311354[_0x967c('0x15')]({'plain':!![]});var _0xf85def=_0x967c('0x16');return db['UserProfileResource'][_0x967c('0x13')]({'where':{'type':_0xf85def,'resourceId':_0x57ec68['id']}})[_0x967c('0x14')](function(){return _0x311354;});})['then'](function(){var _0x5c13f8=new Redis(config[_0x967c('0x6')]);_0x5c13f8[_0x967c('0x17')](_0x967c('0x18'),JSON[_0x967c('0x19')]({'id':_0x311354['id'],'deleted':!![]}));})['then'](function(){_0x2deacb[_0x967c('0x10')](0xcc)[_0x967c('0x1a')]();});}};}function handleEntityNotFound(_0x24d412){return function(_0x2708ef){if(!_0x2708ef){_0x24d412[_0x967c('0x1b')](0x194);}return _0x2708ef;};}function handleError(_0x13e1bb,_0x3b88d2){_0x3b88d2=_0x3b88d2||0x1f4;return function(_0x51fdca){logger['error'](_0x51fdca[_0x967c('0x1c')]);if(_0x51fdca[_0x967c('0x1d')]){delete _0x51fdca[_0x967c('0x1d')];}_0x13e1bb['status'](_0x3b88d2)[_0x967c('0x1e')](_0x51fdca);};}exports[_0x967c('0x1f')]=function(_0x48a631,_0x43b4bf){var _0x40e0aa={},_0x578f25={},_0x351240={'count':0x0,'rows':[]};var _0x328e28=_['map'](db[_0x967c('0x20')]['rawAttributes'],function(_0x1f7064){return{'name':_0x1f7064[_0x967c('0x21')],'type':_0x1f7064[_0x967c('0x22')][_0x967c('0x23')]};});_0x578f25[_0x967c('0x24')]=_[_0x967c('0x25')](_0x328e28,_0x967c('0x1d'));_0x578f25['query']=_[_0x967c('0x26')](_0x48a631['query']);_0x578f25[_0x967c('0x27')]=_[_0x967c('0x28')](_0x578f25[_0x967c('0x24')],_0x578f25[_0x967c('0x29')]);_0x40e0aa[_0x967c('0x2a')]=_[_0x967c('0x28')](_0x578f25[_0x967c('0x24')],qs['fields'](_0x48a631[_0x967c('0x29')][_0x967c('0x2b')]));_0x40e0aa[_0x967c('0x2a')]=_0x40e0aa[_0x967c('0x2a')][_0x967c('0x2c')]?_0x40e0aa['attributes']:_0x578f25[_0x967c('0x24')];if(!_0x48a631[_0x967c('0x29')][_0x967c('0x2d')](_0x967c('0x2e'))){_0x40e0aa[_0x967c('0xd')]=qs[_0x967c('0xd')](_0x48a631['query'][_0x967c('0xd')]);_0x40e0aa[_0x967c('0xe')]=qs[_0x967c('0xe')](_0x48a631[_0x967c('0x29')]['offset']);}_0x40e0aa['order']=qs[_0x967c('0x2f')](_0x48a631[_0x967c('0x29')][_0x967c('0x2f')]);_0x40e0aa[_0x967c('0x30')]=qs[_0x967c('0x27')](_['pick'](_0x48a631[_0x967c('0x29')],_0x578f25[_0x967c('0x27')]),_0x328e28);if(_0x48a631[_0x967c('0x29')][_0x967c('0x31')]){_0x40e0aa[_0x967c('0x30')]=_[_0x967c('0x32')](_0x40e0aa[_0x967c('0x30')],{'$or':_[_0x967c('0x25')](_0x328e28,function(_0x441112){if(_0x441112['type']!==_0x967c('0x33')){var _0x549214={};_0x549214[_0x441112[_0x967c('0x1d')]]={'$like':'%'+_0x48a631['query'][_0x967c('0x31')]+'%'};return _0x549214;}})});}_0x40e0aa=_[_0x967c('0x32')]({},_0x40e0aa,_0x48a631[_0x967c('0x34')]);var _0xe17ebb={'where':_0x40e0aa['where']};return db[_0x967c('0x20')][_0x967c('0xf')](_0xe17ebb)[_0x967c('0x14')](function(_0x161190){_0x351240[_0x967c('0xf')]=_0x161190;if(_0x48a631['query']['includeAll']){_0x40e0aa[_0x967c('0x35')]=[{'all':!![]}];}return db[_0x967c('0x20')]['findAll'](_0x40e0aa);})['then'](function(_0x43c0e7){_0x351240[_0x967c('0x36')]=_0x43c0e7;return _0x351240;})['then'](respondWithFilteredResult(_0x43b4bf,_0x40e0aa))['catch'](handleError(_0x43b4bf,null));};exports[_0x967c('0x37')]=function(_0x4ca45f,_0x2eadd7){var _0x4a1868={'raw':![],'where':{'id':_0x4ca45f['params']['id']}},_0x44efc3={};_0x44efc3['model']=_[_0x967c('0x26')](db['SquareProject']['rawAttributes']);_0x44efc3[_0x967c('0x29')]=_['keys'](_0x4ca45f['query']);_0x44efc3['filters']=_['intersection'](_0x44efc3[_0x967c('0x24')],_0x44efc3['query']);_0x4a1868['attributes']=_['intersection'](_0x44efc3[_0x967c('0x24')],qs[_0x967c('0x2b')](_0x4ca45f[_0x967c('0x29')][_0x967c('0x2b')]));_0x4a1868['attributes']=_0x4a1868['attributes'][_0x967c('0x2c')]?_0x4a1868[_0x967c('0x2a')]:_0x44efc3[_0x967c('0x24')];if(_0x4ca45f[_0x967c('0x29')][_0x967c('0x38')]){_0x4a1868[_0x967c('0x35')]=[{'all':!![]}];}_0x4a1868=_[_0x967c('0x32')]({},_0x4a1868,_0x4ca45f[_0x967c('0x34')]);return db[_0x967c('0x20')][_0x967c('0x39')](_0x4a1868)[_0x967c('0x14')](handleEntityNotFound(_0x2eadd7,null))['then'](respondWithResult(_0x2eadd7,null))[_0x967c('0x3a')](handleError(_0x2eadd7,null));};exports[_0x967c('0x3b')]=function(_0x2e0578,_0x4d4988){return db[_0x967c('0x20')][_0x967c('0x3b')](_0x2e0578['body'],{})[_0x967c('0x14')](function(_0x24b33c){var _0x15ceaf=_0x2e0578[_0x967c('0x3c')][_0x967c('0x15')]({'plain':!![]});if(!_0x15ceaf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15ceaf['role']===_0x967c('0x3c')){var _0xdd917d=_0x24b33c[_0x967c('0x15')]({'plain':!![]});var _0x18fb62='SquareProjects';return db[_0x967c('0x3d')][_0x967c('0x39')]({'where':{'name':_0x18fb62,'userProfileId':_0x15ceaf[_0x967c('0x3e')]},'raw':!![]})[_0x967c('0x14')](function(_0x4942b8){if(_0x4942b8&&_0x4942b8[_0x967c('0x3f')]===0x0){return db['UserProfileResource'][_0x967c('0x3b')]({'name':_0xdd917d[_0x967c('0x1d')],'resourceId':_0xdd917d['id'],'type':_0x4942b8[_0x967c('0x1d')],'sectionId':_0x4942b8['id']},{})[_0x967c('0x14')](function(){return _0x24b33c;});}else{return _0x24b33c;}})[_0x967c('0x3a')](function(_0x29cabc){logger[_0x967c('0x40')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29cabc);throw _0x29cabc;});}return _0x24b33c;})['then'](respondWithResult(_0x4d4988,0xc9))[_0x967c('0x3a')](handleError(_0x4d4988,null));};exports[_0x967c('0x12')]=function(_0x3c860c,_0x3bb737){if(_0x3c860c[_0x967c('0x41')]['id']){delete _0x3c860c[_0x967c('0x41')]['id'];}return db[_0x967c('0x20')][_0x967c('0x39')]({'where':{'id':_0x3c860c[_0x967c('0x42')]['id']}})[_0x967c('0x14')](handleEntityNotFound(_0x3bb737,null))[_0x967c('0x14')](saveUpdates(_0x3c860c[_0x967c('0x41')],null))[_0x967c('0x14')](function(_0x2b4c17){if(!_0x2b4c17)return;var _0x32d2e0=_0x2b4c17[_0x967c('0x15')]({'plain':!![]});return _0x32d2e0;})[_0x967c('0x14')](function(_0xfad382){var _0x36396d=new Redis(config['redis']);_0x36396d[_0x967c('0x17')](_0x967c('0x18'),JSON[_0x967c('0x19')](_[_0x967c('0x43')](_0xfad382,['id','name',_0x967c('0x44')])));return _0xfad382;})[_0x967c('0x14')](respondWithResult(_0x3bb737,null))[_0x967c('0x3a')](handleError(_0x3bb737,null));};exports['destroy']=function(_0x45dc81,_0x548654){return db[_0x967c('0x20')][_0x967c('0x39')]({'where':{'id':_0x45dc81['params']['id']}})['then'](handleEntityNotFound(_0x548654,null))['then'](removeEntity(_0x548654,null))[_0x967c('0x3a')](handleError(_0x548654,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b461788..d5738b0 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 _0xb5c6=['SquareProject','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x498d5f,_0xcc0dc0){var _0x5b8176=function(_0x50b273){while(--_0x50b273){_0x498d5f['push'](_0x498d5f['shift']());}};_0x5b8176(++_0xcc0dc0);}(_0xb5c6,0xee));var _0x6b5c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb5c6[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x6b5c('0x0'));var SquareProject=require(_0x6b5c('0x1'))['db'][_0x6b5c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6b5c('0x3')](0x0);var events={'afterCreate':_0x6b5c('0x4'),'afterUpdate':_0x6b5c('0x5'),'afterDestroy':_0x6b5c('0x6')};function emitEvent(_0x49ddd5){return function(_0x144265,_0x42d5f3,_0x201d99){SquareProjectEvents['emit'](_0x49ddd5+':'+_0x144265['id'],_0x144265);SquareProjectEvents['emit'](_0x49ddd5,_0x144265);_0x201d99(null);};}for(var e in events){if(events[_0x6b5c('0x7')](e)){var event=events[e];SquareProject[_0x6b5c('0x8')](e,emitEvent(event));}}module[_0x6b5c('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x9b7b=['save','update','remove','emit','hook','exports','SquareProject','setMaxListeners'];(function(_0x28cf91,_0x574a1d){var _0x2db5a5=function(_0x28818){while(--_0x28818){_0x28cf91['push'](_0x28cf91['shift']());}};_0x2db5a5(++_0x574a1d);}(_0x9b7b,0xf6));var _0xb9b7=function(_0x22528f,_0xd67586){_0x22528f=_0x22528f-0x0;var _0x4b4709=_0x9b7b[_0x22528f];return _0x4b4709;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xb9b7('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb9b7('0x1')](0x0);var events={'afterCreate':_0xb9b7('0x2'),'afterUpdate':_0xb9b7('0x3'),'afterDestroy':_0xb9b7('0x4')};function emitEvent(_0x4d8426){return function(_0x4799d6,_0x1a5fed,_0x2b289e){SquareProjectEvents[_0xb9b7('0x5')](_0x4d8426+':'+_0x4799d6['id'],_0x4799d6);SquareProjectEvents['emit'](_0x4d8426,_0x4799d6);_0x2b289e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb9b7('0x6')](e,emitEvent(event));}}module[_0xb9b7('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index dc1bf71..93a2d80 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 _0x3b72=['rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3b72,0x150));var _0x23b7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3b72[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x23b7('0x0'));var util=require('util');var logger=require(_0x23b7('0x1'))(_0x23b7('0x2'));var moment=require('moment');var BPromise=require(_0x23b7('0x3'));var rp=require(_0x23b7('0x4'));var fs=require('fs');var path=require(_0x23b7('0x5'));var rimraf=require(_0x23b7('0x6'));var config=require(_0x23b7('0x7'));var attributes=require(_0x23b7('0x8'));module[_0x23b7('0x9')]=function(_0x3c8a4d,_0x2b29bb){return _0x3c8a4d[_0x23b7('0xa')]('SquareProject',attributes,{'tableName':_0x23b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d593e,_0x54c371,_0x1ba2bd){if(_0x1d593e['changed']('preproduction')){_0x1d593e[_0x23b7('0xc')]=moment()[_0x23b7('0xd')](_0x23b7('0xe'));}if(_0x1d593e[_0x23b7('0xf')](_0x23b7('0x10'))){_0x1d593e[_0x23b7('0x11')]=moment()[_0x23b7('0xd')](_0x23b7('0xe'));}_0x1ba2bd(null,_0x1d593e);}}});}; \ No newline at end of file +var _0x8fdf=['preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','exports','define','square_projects','changed'];(function(_0x21bfb6,_0x4ed5ec){var _0x5a226b=function(_0x10257f){while(--_0x10257f){_0x21bfb6['push'](_0x21bfb6['shift']());}};_0x5a226b(++_0x4ed5ec);}(_0x8fdf,0x16d));var _0xf8fd=function(_0x152d78,_0x20aa42){_0x152d78=_0x152d78-0x0;var _0xf1e2de=_0x8fdf[_0x152d78];return _0xf1e2de;};'use strict';var _=require('lodash');var util=require(_0xf8fd('0x0'));var logger=require(_0xf8fd('0x1'))(_0xf8fd('0x2'));var moment=require(_0xf8fd('0x3'));var BPromise=require(_0xf8fd('0x4'));var rp=require(_0xf8fd('0x5'));var fs=require('fs');var path=require(_0xf8fd('0x6'));var rimraf=require(_0xf8fd('0x7'));var config=require('../../config/environment');var attributes=require(_0xf8fd('0x8'));module[_0xf8fd('0x9')]=function(_0x3809be,_0x3604f9){return _0x3809be[_0xf8fd('0xa')]('SquareProject',attributes,{'tableName':_0xf8fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x335f75,_0x32da7e,_0x193142){if(_0x335f75[_0xf8fd('0xc')](_0xf8fd('0xd'))){_0x335f75[_0xf8fd('0xe')]=moment()['format'](_0xf8fd('0xf'));}if(_0x335f75[_0xf8fd('0xc')](_0xf8fd('0x10'))){_0x335f75[_0xf8fd('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x193142(null,_0x335f75);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f7d5651..820ce5c 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 _0x1cda=['raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x229092,_0x4989cc){var _0xfdb022=function(_0x10e0b3){while(--_0x10e0b3){_0x229092['push'](_0x229092['shift']());}};_0xfdb022(++_0x4989cc);}(_0x1cda,0x15f));var _0xa1cd=function(_0xd60285,_0x189cd3){_0xd60285=_0xd60285-0x0;var _0x13279d=_0x1cda[_0xd60285];return _0x13279d;};'use strict';var _=require('lodash');var Redis=require(_0xa1cd('0x0'));var db=require(_0xa1cd('0x1'))['db'];var logger=require(_0xa1cd('0x2'))('rpc');var config=require(_0xa1cd('0x3'));config[_0xa1cd('0x4')]=_[_0xa1cd('0x5')](config[_0xa1cd('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1cd('0x6'))(new Redis(config[_0xa1cd('0x4')]));require(_0xa1cd('0x7'))[_0xa1cd('0x8')](socket);exports[_0xa1cd('0x9')]=function(_0xf6bde1){var _0x18211e=this;return new Promise(function(_0x1c702f,_0x4237af){return db[_0xa1cd('0xa')][_0xa1cd('0xb')]({'raw':_0xf6bde1[_0xa1cd('0xc')]?_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0xd')]===undefined?!![]:![]:!![],'where':_0xf6bde1['options']?_0xf6bde1['options']['where']||null:null,'attributes':_0xf6bde1['options']?_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0xe')]||null:null,'limit':_0xf6bde1[_0xa1cd('0xc')]?_0xf6bde1['options'][_0xa1cd('0xf')]||null:null,'include':_0xf6bde1['options']?_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0x10')]?_[_0xa1cd('0x11')](_0xf6bde1[_0xa1cd('0xc')][_0xa1cd('0x10')],function(_0xa2cc1){return{'model':db[_0xa2cc1[_0xa1cd('0x12')]],'as':_0xa2cc1['as'],'attributes':_0xa2cc1[_0xa1cd('0xe')],'include':_0xa2cc1['include']?_[_0xa1cd('0x11')](_0xa2cc1[_0xa1cd('0x10')],function(_0x456629){return{'model':db[_0x456629[_0xa1cd('0x12')]],'as':_0x456629['as'],'attributes':_0x456629[_0xa1cd('0xe')],'include':_0x456629[_0xa1cd('0x10')]?_[_0xa1cd('0x11')](_0x456629[_0xa1cd('0x10')],function(_0x2c0312){return{'model':db[_0x2c0312[_0xa1cd('0x12')]],'as':_0x2c0312['as'],'attributes':_0x2c0312[_0xa1cd('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa1cd('0x13')](function(_0x5105ee){logger[_0xa1cd('0x14')](_0xa1cd('0x9'),_0xf6bde1);logger[_0xa1cd('0x15')]('GetSquareProjects',_0xf6bde1,JSON[_0xa1cd('0x16')](_0x5105ee));_0x1c702f(_0x5105ee);})[_0xa1cd('0x17')](function(_0x10e785){logger[_0xa1cd('0x18')](_0xa1cd('0x9'),_0x10e785[_0xa1cd('0x19')],_0xf6bde1);_0x4237af(_0x18211e[_0xa1cd('0x18')](0x1f4,_0x10e785[_0xa1cd('0x19')]));});});};exports[_0xa1cd('0x1a')]=function(_0x426c6c){var _0x21cfa9=this;return new Promise(function(_0x3c8356,_0xdf6022){return db[_0xa1cd('0xa')][_0xa1cd('0x1b')]({'raw':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c[_0xa1cd('0xc')][_0xa1cd('0xd')]===undefined?!![]:![]:!![],'where':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c[_0xa1cd('0xc')]['where']||null:null,'attributes':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c[_0xa1cd('0xc')]['attributes']||null:null,'include':_0x426c6c[_0xa1cd('0xc')]?_0x426c6c['options']['include']?_['map'](_0x426c6c[_0xa1cd('0xc')][_0xa1cd('0x10')],function(_0x1b00a9){return{'model':db[_0x1b00a9[_0xa1cd('0x12')]],'as':_0x1b00a9['as'],'attributes':_0x1b00a9[_0xa1cd('0xe')],'include':_0x1b00a9[_0xa1cd('0x10')]?_[_0xa1cd('0x11')](_0x1b00a9[_0xa1cd('0x10')],function(_0x483df1){return{'model':db[_0x483df1['model']],'as':_0x483df1['as'],'attributes':_0x483df1[_0xa1cd('0xe')],'include':_0x483df1[_0xa1cd('0x10')]?_['map'](_0x483df1[_0xa1cd('0x10')],function(_0x44d0d5){return{'model':db[_0x44d0d5[_0xa1cd('0x12')]],'as':_0x44d0d5['as'],'attributes':_0x44d0d5[_0xa1cd('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa1cd('0x13')](function(_0x34bcee){logger[_0xa1cd('0x14')](_0xa1cd('0x1a'),_0x426c6c);logger[_0xa1cd('0x15')]('ShowSquareProject',_0x426c6c,JSON[_0xa1cd('0x16')](_0x34bcee));_0x3c8356(_0x34bcee);})[_0xa1cd('0x17')](function(_0x2c7da1){logger[_0xa1cd('0x18')](_0xa1cd('0x1a'),_0x2c7da1[_0xa1cd('0x19')],_0x426c6c);_0xdf6022(_0x21cfa9['error'](0x1f4,_0x2c7da1[_0xa1cd('0x19')]));});});}; \ No newline at end of file +var _0x958f=['model','attributes','then','debug','stringify','catch','error','message','info','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','include','map'];(function(_0x551a10,_0x446b1b){var _0x59e0c7=function(_0x5954b1){while(--_0x5954b1){_0x551a10['push'](_0x551a10['shift']());}};_0x59e0c7(++_0x446b1b);}(_0x958f,0x118));var _0xf958=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x958f[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xf958('0x0'));var Redis=require(_0xf958('0x1'));var db=require(_0xf958('0x2'))['db'];var logger=require(_0xf958('0x3'))(_0xf958('0x4'));var config=require('../../config/environment');config['redis']=_[_0xf958('0x5')](config[_0xf958('0x6')],{'host':_0xf958('0x7'),'port':0x18eb});var socket=require(_0xf958('0x8'))(new Redis(config[_0xf958('0x6')]));require(_0xf958('0x9'))[_0xf958('0xa')](socket);exports[_0xf958('0xb')]=function(_0x4a8dea){var _0x5efcb2=this;return new Promise(function(_0x1b5e75,_0x182d1c){return db[_0xf958('0xc')][_0xf958('0xd')]({'raw':_0x4a8dea[_0xf958('0xe')]?_0x4a8dea['options'][_0xf958('0xf')]===undefined?!![]:![]:!![],'where':_0x4a8dea[_0xf958('0xe')]?_0x4a8dea[_0xf958('0xe')][_0xf958('0x10')]||null:null,'attributes':_0x4a8dea['options']?_0x4a8dea[_0xf958('0xe')]['attributes']||null:null,'limit':_0x4a8dea[_0xf958('0xe')]?_0x4a8dea['options'][_0xf958('0x11')]||null:null,'include':_0x4a8dea[_0xf958('0xe')]?_0x4a8dea[_0xf958('0xe')][_0xf958('0x12')]?_[_0xf958('0x13')](_0x4a8dea[_0xf958('0xe')][_0xf958('0x12')],function(_0x1f30b6){return{'model':db[_0x1f30b6[_0xf958('0x14')]],'as':_0x1f30b6['as'],'attributes':_0x1f30b6[_0xf958('0x15')],'include':_0x1f30b6[_0xf958('0x12')]?_[_0xf958('0x13')](_0x1f30b6[_0xf958('0x12')],function(_0x18268b){return{'model':db[_0x18268b[_0xf958('0x14')]],'as':_0x18268b['as'],'attributes':_0x18268b[_0xf958('0x15')],'include':_0x18268b['include']?_[_0xf958('0x13')](_0x18268b['include'],function(_0x5c2985){return{'model':db[_0x5c2985[_0xf958('0x14')]],'as':_0x5c2985['as'],'attributes':_0x5c2985[_0xf958('0x15')]};}):[]};}):[]};}):[]:[]})[_0xf958('0x16')](function(_0x19e127){logger['info'](_0xf958('0xb'),_0x4a8dea);logger[_0xf958('0x17')](_0xf958('0xb'),_0x4a8dea,JSON[_0xf958('0x18')](_0x19e127));_0x1b5e75(_0x19e127);})[_0xf958('0x19')](function(_0x40853c){logger[_0xf958('0x1a')]('GetSquareProjects',_0x40853c['message'],_0x4a8dea);_0x182d1c(_0x5efcb2['error'](0x1f4,_0x40853c[_0xf958('0x1b')]));});});};exports['ShowSquareProject']=function(_0x13256f){var _0xe38478=this;return new Promise(function(_0x37d5df,_0xc18891){return db[_0xf958('0xc')]['find']({'raw':_0x13256f[_0xf958('0xe')]?_0x13256f[_0xf958('0xe')][_0xf958('0xf')]===undefined?!![]:![]:!![],'where':_0x13256f[_0xf958('0xe')]?_0x13256f['options']['where']||null:null,'attributes':_0x13256f[_0xf958('0xe')]?_0x13256f[_0xf958('0xe')]['attributes']||null:null,'include':_0x13256f['options']?_0x13256f[_0xf958('0xe')][_0xf958('0x12')]?_[_0xf958('0x13')](_0x13256f['options'][_0xf958('0x12')],function(_0x540be2){return{'model':db[_0x540be2['model']],'as':_0x540be2['as'],'attributes':_0x540be2[_0xf958('0x15')],'include':_0x540be2['include']?_[_0xf958('0x13')](_0x540be2[_0xf958('0x12')],function(_0x5d7a1e){return{'model':db[_0x5d7a1e[_0xf958('0x14')]],'as':_0x5d7a1e['as'],'attributes':_0x5d7a1e[_0xf958('0x15')],'include':_0x5d7a1e[_0xf958('0x12')]?_[_0xf958('0x13')](_0x5d7a1e[_0xf958('0x12')],function(_0x440ca9){return{'model':db[_0x440ca9['model']],'as':_0x440ca9['as'],'attributes':_0x440ca9['attributes']};}):[]};}):[]};}):[]:[]})[_0xf958('0x16')](function(_0x13ef90){logger[_0xf958('0x1c')](_0xf958('0x1d'),_0x13256f);logger[_0xf958('0x17')](_0xf958('0x1d'),_0x13256f,JSON[_0xf958('0x18')](_0x13ef90));_0x37d5df(_0x13ef90);})['catch'](function(_0x33922b){logger[_0xf958('0x1a')](_0xf958('0x1d'),_0x33922b[_0xf958('0x1b')],_0x13256f);_0xc18891(_0xe38478[_0xf958('0x1a')](0x1f4,_0x33922b[_0xf958('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index eb52c1e..36063e9 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 _0xb9a3=['register','length','./squareProject.events','save','remove','update','emit'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xb9a3,0x1f3));var _0x3b9a=function(_0x1086ce,_0x32ca26){_0x1086ce=_0x1086ce-0x0;var _0x12b0f6=_0xb9a3[_0x1086ce];return _0x12b0f6;};'use strict';var SquareProjectEvents=require(_0x3b9a('0x0'));var events=[_0x3b9a('0x1'),_0x3b9a('0x2'),_0x3b9a('0x3')];function createListener(_0x2277ea,_0x4bb8d9){return function(_0x5e1a67){_0x4bb8d9[_0x3b9a('0x4')](_0x2277ea,_0x5e1a67);};}function removeListener(_0x4c7334,_0x221c84){return function(){SquareProjectEvents['removeListener'](_0x4c7334,_0x221c84);};}exports[_0x3b9a('0x5')]=function(_0x1841c5){for(var _0x20c220=0x0,_0x46b47f=events[_0x3b9a('0x6')];_0x20c220<_0x46b47f;_0x20c220++){var _0x2fc844=events[_0x20c220];var _0x214a0f=createListener('squareProject:'+_0x2fc844,_0x1841c5);SquareProjectEvents['on'](_0x2fc844,_0x214a0f);}}; \ No newline at end of file +var _0xb300=['./squareProject.events','save','remove','update','emit','register','squareProject:'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb300,0xcb));var _0x0b30=function(_0x57ef5d,_0x59f427){_0x57ef5d=_0x57ef5d-0x0;var _0x5a02f9=_0xb300[_0x57ef5d];return _0x5a02f9;};'use strict';var SquareProjectEvents=require(_0x0b30('0x0'));var events=[_0x0b30('0x1'),_0x0b30('0x2'),_0x0b30('0x3')];function createListener(_0x6ddf39,_0x18562d){return function(_0x26a9bc){_0x18562d[_0x0b30('0x4')](_0x6ddf39,_0x26a9bc);};}function removeListener(_0xb11a79,_0x588d10){return function(){SquareProjectEvents['removeListener'](_0xb11a79,_0x588d10);};}exports[_0x0b30('0x5')]=function(_0x3e3c8d){for(var _0x597f5e=0x0,_0x4051c9=events['length'];_0x597f5e<_0x4051c9;_0x597f5e++){var _0x3138a6=events[_0x597f5e];var _0x24e55d=createListener(_0x0b30('0x6')+_0x3138a6,_0x3e3c8d);SquareProjectEvents['on'](_0x3138a6,_0x24e55d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 33a46a5..926ffca 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(_0x359935,_0x33d1af){var _0x22e402=function(_0x355057){while(--_0x355057){_0x359935['push'](_0x359935['shift']());}};_0x22e402(++_0x33d1af);}(_0x5fab,0x177));var _0xb5fa=function(_0x35b80e,_0x120fd7){_0x35b80e=_0x35b80e-0x0;var _0x363914=_0x5fab[_0x35b80e];return _0x363914;};'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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x518eb1,_0x13ed00){var _0xdae5f7=function(_0x2495ad){while(--_0x2495ad){_0x518eb1['push'](_0x518eb1['shift']());}};_0xdae5f7(++_0x13ed00);}(_0x53ec,0x192));var _0xc53e=function(_0x40889c,_0x73e154){_0x40889c=_0x40889c-0x0;var _0x1e69a3=_0x53ec[_0x40889c];return _0x1e69a3;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index d9125cf..e681913 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x174547,_0x1cd215){var _0x46cb79=function(_0x45fbbe){while(--_0x45fbbe){_0x174547['push'](_0x174547['shift']());}};_0x46cb79(++_0x1cd215);}(_0x7c09,0x102));var _0x97c0=function(_0x5339e4,_0x24fbf7){_0x5339e4=_0x5339e4-0x0;var _0x4f8abb=_0x7c09[_0x5339e4];return _0x4f8abb;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file +var _0x2eb2=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_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 3f5cef5..b209ecd 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 _0x821b=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','update','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s'];(function(_0x34ab07,_0x4be6ba){var _0x2b394d=function(_0x29f044){while(--_0x29f044){_0x34ab07['push'](_0x34ab07['shift']());}};_0x2b394d(++_0x4be6ba);}(_0x821b,0x12d));var _0xb821=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x821b[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xb821('0x0'));var rimraf=require(_0xb821('0x1'));var zipdir=require(_0xb821('0x2'));var jsonpatch=require(_0xb821('0x3'));var rp=require(_0xb821('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb821('0x5'));var path=require(_0xb821('0x6'));var sox=require('sox');var csv=require(_0xb821('0x7'));var ejs=require(_0xb821('0x8'));var fs=require('fs');var fs_extra=require(_0xb821('0x9'));var _=require(_0xb821('0xa'));var squel=require(_0xb821('0xb'));var crypto=require('crypto');var jsforce=require(_0xb821('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb821('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb821('0xd'));var qs=require(_0xb821('0xe'));var as=require(_0xb821('0xf'));var hardwareService=require(_0xb821('0x10'));var logger=require(_0xb821('0x11'))(_0xb821('0x12'));var utils=require(_0xb821('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb821('0x14'));var db=require(_0xb821('0x15'))['db'];function respondWithStatusCode(_0x592b0e,_0x1a05e5){_0x1a05e5=_0x1a05e5||0xcc;return function(_0x44d773){if(_0x44d773){return _0x592b0e['sendStatus'](_0x1a05e5);}return _0x592b0e[_0xb821('0x16')](_0x1a05e5)[_0xb821('0x17')]();};}function respondWithResult(_0x196210,_0x734843){_0x734843=_0x734843||0xc8;return function(_0x365180){if(_0x365180){return _0x196210['status'](_0x734843)[_0xb821('0x18')](_0x365180);}};}function respondWithFilteredResult(_0x41c503,_0x4d3c86){return function(_0x26f236){if(_0x26f236){var _0x14a29c=typeof _0x4d3c86['offset']===_0xb821('0x19')&&typeof _0x4d3c86[_0xb821('0x1a')]==='undefined';var _0x515982=_0x26f236[_0xb821('0x1b')];var _0x10ab13=_0x14a29c?0x0:_0x4d3c86['offset'];var _0x3d6287=_0x14a29c?_0x26f236[_0xb821('0x1b')]:_0x4d3c86['offset']+_0x4d3c86[_0xb821('0x1a')];var _0x208904;if(_0x3d6287>=_0x515982){_0x3d6287=_0x515982;_0x208904=0xc8;}else{_0x208904=0xce;}_0x41c503[_0xb821('0x16')](_0x208904);return _0x41c503[_0xb821('0x1c')](_0xb821('0x1d'),_0x10ab13+'-'+_0x3d6287+'/'+_0x515982)[_0xb821('0x18')](_0x26f236);}return null;};}function patchUpdates(_0x4b37af){return function(_0x4cb49e){try{jsonpatch[_0xb821('0x1e')](_0x4cb49e,_0x4b37af,!![]);}catch(_0x2d0057){return BPromise[_0xb821('0x1f')](_0x2d0057);}return _0x4cb49e[_0xb821('0x20')]();};}function saveUpdates(_0x30d802,_0x532bb7){return function(_0x110ae5){if(_0x110ae5){return _0x110ae5['update'](_0x30d802)[_0xb821('0x21')](function(_0xb27e1){return _0xb27e1;});}return null;};}function removeEntity(_0x5203d7,_0x1b57a6){return function(_0x279f10){if(_0x279f10){return _0x279f10['destroy']()[_0xb821('0x21')](function(){_0x5203d7[_0xb821('0x16')](0xcc)[_0xb821('0x17')]();});}};}function handleEntityNotFound(_0x3dea33,_0x5455d3){return function(_0x1763d0){if(!_0x1763d0){_0x3dea33[_0xb821('0x22')](0x194);}return _0x1763d0;};}function handleError(_0x5be6e6,_0x5e6099){_0x5e6099=_0x5e6099||0x1f4;return function(_0x5c6340){logger[_0xb821('0x23')](_0x5c6340[_0xb821('0x24')]);if(_0x5c6340[_0xb821('0x25')]){delete _0x5c6340[_0xb821('0x25')];}_0x5be6e6[_0xb821('0x16')](_0x5e6099)[_0xb821('0x26')](_0x5c6340);};}exports[_0xb821('0x27')]=function(_0x1404e5,_0x53aa66){var _0x268f0f={},_0x353444={},_0x4e00e6={'count':0x0,'rows':[]};var _0x542dbd=_[_0xb821('0x28')](db[_0xb821('0x29')][_0xb821('0x2a')],function(_0x4909cc){return{'name':_0x4909cc['fieldName'],'type':_0x4909cc[_0xb821('0x2b')][_0xb821('0x2c')]};});_0x353444[_0xb821('0x2d')]=_['map'](_0x542dbd,'name');_0x353444[_0xb821('0x2e')]=_[_0xb821('0x2f')](_0x1404e5[_0xb821('0x2e')]);_0x353444[_0xb821('0x30')]=_[_0xb821('0x31')](_0x353444[_0xb821('0x2d')],_0x353444[_0xb821('0x2e')]);_0x268f0f[_0xb821('0x32')]=_[_0xb821('0x31')](_0x353444['model'],qs[_0xb821('0x33')](_0x1404e5[_0xb821('0x2e')][_0xb821('0x33')]));_0x268f0f[_0xb821('0x32')]=_0x268f0f['attributes'][_0xb821('0x34')]?_0x268f0f['attributes']:_0x353444[_0xb821('0x2d')];if(!_0x1404e5[_0xb821('0x2e')][_0xb821('0x35')](_0xb821('0x36'))){_0x268f0f[_0xb821('0x1a')]=qs[_0xb821('0x1a')](_0x1404e5[_0xb821('0x2e')][_0xb821('0x1a')]);_0x268f0f[_0xb821('0x37')]=qs[_0xb821('0x37')](_0x1404e5['query'][_0xb821('0x37')]);}_0x268f0f['order']=qs[_0xb821('0x38')](_0x1404e5[_0xb821('0x2e')][_0xb821('0x38')]);_0x268f0f[_0xb821('0x39')]=qs['filters'](_[_0xb821('0x3a')](_0x1404e5[_0xb821('0x2e')],_0x353444[_0xb821('0x30')]),_0x542dbd);if(_0x1404e5[_0xb821('0x2e')][_0xb821('0x3b')]){_0x268f0f[_0xb821('0x39')]=_[_0xb821('0x3c')](_0x268f0f['where'],{'$or':_['map'](_0x542dbd,function(_0x3ef3e3){if(_0x3ef3e3[_0xb821('0x2b')]!==_0xb821('0x3d')){var _0x466896={};_0x466896[_0x3ef3e3[_0xb821('0x25')]]={'$like':'%'+_0x1404e5[_0xb821('0x2e')][_0xb821('0x3b')]+'%'};return _0x466896;}})});}_0x268f0f=_[_0xb821('0x3c')]({},_0x268f0f,_0x1404e5['options']);var _0x1adafa={'where':_0x268f0f[_0xb821('0x39')]};return db['SquareRecording']['count'](_0x1adafa)[_0xb821('0x21')](function(_0x47059d){_0x4e00e6[_0xb821('0x1b')]=_0x47059d;if(_0x1404e5[_0xb821('0x2e')]['includeAll']){_0x268f0f['include']=[{'all':!![]}];}return db['SquareRecording'][_0xb821('0x3e')](_0x268f0f);})[_0xb821('0x21')](function(_0x20f33c){_0x4e00e6[_0xb821('0x3f')]=_0x20f33c;return _0x4e00e6;})['then'](respondWithFilteredResult(_0x53aa66,_0x268f0f))[_0xb821('0x40')](handleError(_0x53aa66,null));};exports[_0xb821('0x41')]=function(_0x1548d7,_0x5dfce){var _0x493e97={'raw':!![],'where':{'id':_0x1548d7[_0xb821('0x42')]['id']}},_0xf32906={};_0xf32906[_0xb821('0x2d')]=_[_0xb821('0x2f')](db[_0xb821('0x29')][_0xb821('0x2a')]);_0xf32906[_0xb821('0x2e')]=_[_0xb821('0x2f')](_0x1548d7['query']);_0xf32906[_0xb821('0x30')]=_[_0xb821('0x31')](_0xf32906[_0xb821('0x2d')],_0xf32906['query']);_0x493e97['attributes']=_[_0xb821('0x31')](_0xf32906[_0xb821('0x2d')],qs['fields'](_0x1548d7['query']['fields']));_0x493e97['attributes']=_0x493e97['attributes'][_0xb821('0x34')]?_0x493e97[_0xb821('0x32')]:_0xf32906['model'];if(_0x1548d7[_0xb821('0x2e')][_0xb821('0x43')]){_0x493e97[_0xb821('0x44')]=[{'all':!![]}];}_0x493e97=_[_0xb821('0x3c')]({},_0x493e97,_0x1548d7[_0xb821('0x45')]);return db['SquareRecording'][_0xb821('0x46')](_0x493e97)[_0xb821('0x21')](handleEntityNotFound(_0x5dfce,null))[_0xb821('0x21')](respondWithResult(_0x5dfce,null))[_0xb821('0x40')](handleError(_0x5dfce,null));};exports[_0xb821('0x47')]=function(_0x42fe52,_0x4b7b66){return db[_0xb821('0x29')][_0xb821('0x47')](_0x42fe52[_0xb821('0x48')],{})[_0xb821('0x21')](respondWithResult(_0x4b7b66,0xc9))[_0xb821('0x40')](handleError(_0x4b7b66,null));};exports[_0xb821('0x49')]=function(_0x2ee970,_0x5cbda9){if(_0x2ee970[_0xb821('0x48')]['id']){delete _0x2ee970['body']['id'];}return db[_0xb821('0x29')][_0xb821('0x46')]({'where':{'id':_0x2ee970[_0xb821('0x42')]['id']}})[_0xb821('0x21')](handleEntityNotFound(_0x5cbda9,null))[_0xb821('0x21')](saveUpdates(_0x2ee970[_0xb821('0x48')],null))[_0xb821('0x21')](respondWithResult(_0x5cbda9,null))[_0xb821('0x40')](handleError(_0x5cbda9,null));};exports[_0xb821('0x4a')]=function(_0x81c458,_0x2ffd8d,_0x16b54f){var _0x23fa5b=require(_0xb821('0x4b'));var _0x9c98a7=![];var _0x1b2ba6={};if(_0x81c458['query'][_0xb821('0x2b')]&&_0x81c458[_0xb821('0x2e')][_0xb821('0x2b')]===_0xb821('0x4c')){_0x1b2ba6[_0xb821('0x4c')]=_0x81c458['params']['id'];}else{_0x1b2ba6['id']=_0x81c458['params']['id'];}return db[_0xb821('0x29')][_0xb821('0x46')]({'where':_0x1b2ba6,'attributes':['id','savePath',_0xb821('0x4d')],'raw':!![]})[_0xb821('0x21')](handleEntityNotFound(_0x2ffd8d,null))['then'](function(_0xc38ca2){if(_0xc38ca2){var _0xcf6b58=_0xc38ca2[_0xb821('0x4e')];var _0x406822=util[_0xb821('0x4f')](_0xb821('0x50'),_0xcf6b58);if(fs[_0xb821('0x51')](_0x406822)){_0x9c98a7=!![];return _0x23fa5b[_0xb821('0x52')](_0x406822,_0xcf6b58,config['secrets'][_0xb821('0x53')])[_0xb821('0x21')](function(){return _0xc38ca2;});}return _0xc38ca2;}})[_0xb821('0x21')](function(_0x109a77){if(_0x109a77){var _0x274fca=_0x109a77['savePath'];if(!fs[_0xb821('0x51')](_0x274fca)){throw new db[(_0xb821('0x54'))][(_0xb821('0x55'))](_0xb821('0x56'));}if(_0x109a77[_0xb821('0x4d')]){return _0x2ffd8d['download'](_0x274fca,_0x109a77[_0xb821('0x4d')]+path[_0xb821('0x57')](_0x274fca),function(){if(_0x9c98a7){fs[_0xb821('0x58')](_0x274fca);}});}else{return _0x2ffd8d[_0xb821('0x4a')](_0x274fca,function(_0x517606){if(_0x9c98a7){fs[_0xb821('0x58')](_0x274fca);}});}}})[_0xb821('0x40')](function(_0xac5c07){if(_0xac5c07[_0xb821('0x59')]===_0xb821('0x56')){_0x2ffd8d['status'](0x194)['send'](_0xb821('0x5a'));}else{return handleError(_0x2ffd8d,null);}});};exports['destroy']=function(_0x506bc4,_0x43cb2b){return db[_0xb821('0x29')][_0xb821('0x46')]({'where':{'id':_0x506bc4[_0xb821('0x42')]['id']}})[_0xb821('0x21')](function(_0x4d1772){if(_[_0xb821('0x5b')](_0x4d1772)){throw new ReferenceError(_0xb821('0x5c'));}return _0x4d1772;})[_0xb821('0x21')](function(_0x40a7ba){var _0xcf2860=_0x40a7ba['savePath'];logger[_0xb821('0x5d')](_0xb821('0x5e'),_0xcf2860);if(!_['isNil'](_0x40a7ba['savePath'])&&fs[_0xb821('0x51')](_0xcf2860)){logger['info']('File:\x20\x22'+_0xcf2860+_0xb821('0x5f'));fs[_0xb821('0x60')](_0xcf2860);}_0xcf2860=_0xcf2860+_0xb821('0x61');if(!_['isNil'](_0x40a7ba['savePath'])&&fs[_0xb821('0x51')](_0xcf2860)){logger[_0xb821('0x5d')](_0xb821('0x62')+_0xcf2860+_0xb821('0x5f'));fs[_0xb821('0x60')](_0xcf2860);}return _0x40a7ba;})['then'](function(_0x1ddb2f){if(!_0x1ddb2f)throw new InternalError();return _0x1ddb2f['destroy']();})['then'](function(){_0x43cb2b['status'](0xcc)[_0xb821('0x17')]();})['catch'](handleError(_0x43cb2b,null));}; \ No newline at end of file +var _0xd86b=['filters','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','catch','show','fields','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','secrets','Sequelize','ValidationError','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','error','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x7d653b,_0x3f3341){var _0x3a30e7=function(_0x4e7b60){while(--_0x4e7b60){_0x7d653b['push'](_0x7d653b['shift']());}};_0x3a30e7(++_0x3f3341);}(_0xd86b,0x18a));var _0xbd86=function(_0x460dae,_0x3a907f){_0x460dae=_0x460dae-0x0;var _0x36e6d0=_0xd86b[_0x460dae];return _0x36e6d0;};'use strict';var emlformat=require(_0xbd86('0x0'));var rimraf=require(_0xbd86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbd86('0x2'));var BPromise=require(_0xbd86('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbd86('0x4'));var sox=require('sox');var csv=require(_0xbd86('0x5'));var ejs=require(_0xbd86('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbd86('0x7'));var crypto=require(_0xbd86('0x8'));var jsforce=require(_0xbd86('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xbd86('0x5'));var querystring=require(_0xbd86('0xa'));var Papa=require(_0xbd86('0xb'));var Redis=require('ioredis');var authService=require(_0xbd86('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xbd86('0xd'));var hardwareService=require(_0xbd86('0xe'));var logger=require(_0xbd86('0xf'))(_0xbd86('0x10'));var utils=require(_0xbd86('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xbd86('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c97a1,_0x41dfee){_0x41dfee=_0x41dfee||0xcc;return function(_0x344e7a){if(_0x344e7a){return _0x2c97a1[_0xbd86('0x13')](_0x41dfee);}return _0x2c97a1[_0xbd86('0x14')](_0x41dfee)[_0xbd86('0x15')]();};}function respondWithResult(_0x44113,_0xe7ef12){_0xe7ef12=_0xe7ef12||0xc8;return function(_0x581e88){if(_0x581e88){return _0x44113['status'](_0xe7ef12)['json'](_0x581e88);}};}function respondWithFilteredResult(_0x2e24da,_0x504709){return function(_0x429dc9){if(_0x429dc9){var _0x3eeb7c=typeof _0x504709[_0xbd86('0x16')]==='undefined'&&typeof _0x504709[_0xbd86('0x17')]===_0xbd86('0x18');var _0x273035=_0x429dc9[_0xbd86('0x19')];var _0x314775=_0x3eeb7c?0x0:_0x504709[_0xbd86('0x16')];var _0x36f15b=_0x3eeb7c?_0x429dc9[_0xbd86('0x19')]:_0x504709[_0xbd86('0x16')]+_0x504709[_0xbd86('0x17')];var _0x6c0349;if(_0x36f15b>=_0x273035){_0x36f15b=_0x273035;_0x6c0349=0xc8;}else{_0x6c0349=0xce;}_0x2e24da['status'](_0x6c0349);return _0x2e24da[_0xbd86('0x1a')](_0xbd86('0x1b'),_0x314775+'-'+_0x36f15b+'/'+_0x273035)['json'](_0x429dc9);}return null;};}function patchUpdates(_0x5bd6a0){return function(_0xd758bf){try{jsonpatch[_0xbd86('0x1c')](_0xd758bf,_0x5bd6a0,!![]);}catch(_0xbc13dd){return BPromise[_0xbd86('0x1d')](_0xbc13dd);}return _0xd758bf['save']();};}function saveUpdates(_0x509fe3,_0x787afe){return function(_0x47e3c3){if(_0x47e3c3){return _0x47e3c3[_0xbd86('0x1e')](_0x509fe3)['then'](function(_0x24dcdd){return _0x24dcdd;});}return null;};}function removeEntity(_0x1bef7f,_0x506838){return function(_0x3fcb9c){if(_0x3fcb9c){return _0x3fcb9c['destroy']()['then'](function(){_0x1bef7f[_0xbd86('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22fe79,_0x2c4cf2){return function(_0x3b7ba6){if(!_0x3b7ba6){_0x22fe79[_0xbd86('0x13')](0x194);}return _0x3b7ba6;};}function handleError(_0x319453,_0x1fcb65){_0x1fcb65=_0x1fcb65||0x1f4;return function(_0x406601){logger[_0xbd86('0x1f')](_0x406601[_0xbd86('0x20')]);if(_0x406601[_0xbd86('0x21')]){delete _0x406601[_0xbd86('0x21')];}_0x319453[_0xbd86('0x14')](_0x1fcb65)[_0xbd86('0x22')](_0x406601);};}exports['index']=function(_0x2eec01,_0x263d29){var _0x3300b1={},_0x3fc48b={},_0x142757={'count':0x0,'rows':[]};var _0xab53bd=_['map'](db[_0xbd86('0x23')][_0xbd86('0x24')],function(_0xe11196){return{'name':_0xe11196[_0xbd86('0x25')],'type':_0xe11196[_0xbd86('0x26')][_0xbd86('0x27')]};});_0x3fc48b['model']=_[_0xbd86('0x28')](_0xab53bd,'name');_0x3fc48b[_0xbd86('0x29')]=_[_0xbd86('0x2a')](_0x2eec01[_0xbd86('0x29')]);_0x3fc48b['filters']=_[_0xbd86('0x2b')](_0x3fc48b[_0xbd86('0x2c')],_0x3fc48b['query']);_0x3300b1[_0xbd86('0x2d')]=_['intersection'](_0x3fc48b[_0xbd86('0x2c')],qs['fields'](_0x2eec01[_0xbd86('0x29')]['fields']));_0x3300b1[_0xbd86('0x2d')]=_0x3300b1[_0xbd86('0x2d')][_0xbd86('0x2e')]?_0x3300b1[_0xbd86('0x2d')]:_0x3fc48b['model'];if(!_0x2eec01[_0xbd86('0x29')][_0xbd86('0x2f')](_0xbd86('0x30'))){_0x3300b1[_0xbd86('0x17')]=qs['limit'](_0x2eec01[_0xbd86('0x29')][_0xbd86('0x17')]);_0x3300b1['offset']=qs[_0xbd86('0x16')](_0x2eec01[_0xbd86('0x29')][_0xbd86('0x16')]);}_0x3300b1[_0xbd86('0x31')]=qs[_0xbd86('0x32')](_0x2eec01[_0xbd86('0x29')][_0xbd86('0x32')]);_0x3300b1['where']=qs[_0xbd86('0x33')](_[_0xbd86('0x34')](_0x2eec01['query'],_0x3fc48b[_0xbd86('0x33')]),_0xab53bd);if(_0x2eec01[_0xbd86('0x29')][_0xbd86('0x35')]){_0x3300b1[_0xbd86('0x36')]=_[_0xbd86('0x37')](_0x3300b1['where'],{'$or':_[_0xbd86('0x28')](_0xab53bd,function(_0x28a55f){if(_0x28a55f['type']!==_0xbd86('0x38')){var _0x3b8ff2={};_0x3b8ff2[_0x28a55f[_0xbd86('0x21')]]={'$like':'%'+_0x2eec01[_0xbd86('0x29')][_0xbd86('0x35')]+'%'};return _0x3b8ff2;}})});}_0x3300b1=_[_0xbd86('0x37')]({},_0x3300b1,_0x2eec01['options']);var _0x55eeb0={'where':_0x3300b1[_0xbd86('0x36')]};return db['SquareRecording'][_0xbd86('0x19')](_0x55eeb0)[_0xbd86('0x39')](function(_0xd2dc2c){_0x142757[_0xbd86('0x19')]=_0xd2dc2c;if(_0x2eec01[_0xbd86('0x29')][_0xbd86('0x3a')]){_0x3300b1['include']=[{'all':!![]}];}return db['SquareRecording'][_0xbd86('0x3b')](_0x3300b1);})[_0xbd86('0x39')](function(_0x17a643){_0x142757['rows']=_0x17a643;return _0x142757;})['then'](respondWithFilteredResult(_0x263d29,_0x3300b1))[_0xbd86('0x3c')](handleError(_0x263d29,null));};exports[_0xbd86('0x3d')]=function(_0x3b9a82,_0x53e1ae){var _0x311943={'raw':!![],'where':{'id':_0x3b9a82['params']['id']}},_0x48a4cc={};_0x48a4cc[_0xbd86('0x2c')]=_[_0xbd86('0x2a')](db[_0xbd86('0x23')][_0xbd86('0x24')]);_0x48a4cc[_0xbd86('0x29')]=_[_0xbd86('0x2a')](_0x3b9a82[_0xbd86('0x29')]);_0x48a4cc[_0xbd86('0x33')]=_['intersection'](_0x48a4cc['model'],_0x48a4cc[_0xbd86('0x29')]);_0x311943['attributes']=_[_0xbd86('0x2b')](_0x48a4cc[_0xbd86('0x2c')],qs['fields'](_0x3b9a82[_0xbd86('0x29')][_0xbd86('0x3e')]));_0x311943[_0xbd86('0x2d')]=_0x311943['attributes']['length']?_0x311943[_0xbd86('0x2d')]:_0x48a4cc[_0xbd86('0x2c')];if(_0x3b9a82[_0xbd86('0x29')]['includeAll']){_0x311943['include']=[{'all':!![]}];}_0x311943=_[_0xbd86('0x37')]({},_0x311943,_0x3b9a82['options']);return db[_0xbd86('0x23')][_0xbd86('0x3f')](_0x311943)[_0xbd86('0x39')](handleEntityNotFound(_0x53e1ae,null))[_0xbd86('0x39')](respondWithResult(_0x53e1ae,null))[_0xbd86('0x3c')](handleError(_0x53e1ae,null));};exports['create']=function(_0x146994,_0x20940d){return db[_0xbd86('0x23')][_0xbd86('0x40')](_0x146994[_0xbd86('0x41')],{})[_0xbd86('0x39')](respondWithResult(_0x20940d,0xc9))[_0xbd86('0x3c')](handleError(_0x20940d,null));};exports[_0xbd86('0x1e')]=function(_0x1b7a49,_0x3b7311){if(_0x1b7a49['body']['id']){delete _0x1b7a49[_0xbd86('0x41')]['id'];}return db[_0xbd86('0x23')]['find']({'where':{'id':_0x1b7a49[_0xbd86('0x42')]['id']}})[_0xbd86('0x39')](handleEntityNotFound(_0x3b7311,null))[_0xbd86('0x39')](saveUpdates(_0x1b7a49['body'],null))['then'](respondWithResult(_0x3b7311,null))[_0xbd86('0x3c')](handleError(_0x3b7311,null));};exports[_0xbd86('0x43')]=function(_0x1c1829,_0x23fc28,_0x405015){var _0x92e419=require(_0xbd86('0x44'));var _0x19cd4a=![];var _0x2ce4e2={};if(_0x1c1829[_0xbd86('0x29')]['type']&&_0x1c1829[_0xbd86('0x29')][_0xbd86('0x26')]===_0xbd86('0x45')){_0x2ce4e2[_0xbd86('0x45')]=_0x1c1829[_0xbd86('0x42')]['id'];}else{_0x2ce4e2['id']=_0x1c1829[_0xbd86('0x42')]['id'];}return db['SquareRecording'][_0xbd86('0x3f')]({'where':_0x2ce4e2,'attributes':['id',_0xbd86('0x46'),_0xbd86('0x47')],'raw':!![]})[_0xbd86('0x39')](handleEntityNotFound(_0x23fc28,null))[_0xbd86('0x39')](function(_0x2176fc){if(_0x2176fc){var _0x4ec902=_0x2176fc[_0xbd86('0x46')];var _0x57eb62=util['format'](_0xbd86('0x48'),_0x4ec902);if(fs[_0xbd86('0x49')](_0x57eb62)){_0x19cd4a=!![];return _0x92e419['decryptFile'](_0x57eb62,_0x4ec902,config[_0xbd86('0x4a')]['recording'])[_0xbd86('0x39')](function(){return _0x2176fc;});}return _0x2176fc;}})['then'](function(_0x79e679){if(_0x79e679){var _0x1c0148=_0x79e679[_0xbd86('0x46')];if(!fs['existsSync'](_0x1c0148)){throw new db[(_0xbd86('0x4b'))][(_0xbd86('0x4c'))]('SquareRecording\x20not\x20found');}if(_0x79e679[_0xbd86('0x47')]){return _0x23fc28[_0xbd86('0x43')](_0x1c0148,_0x79e679['filename']+path[_0xbd86('0x4d')](_0x1c0148),function(){if(_0x19cd4a){fs['unlink'](_0x1c0148);}});}else{return _0x23fc28[_0xbd86('0x43')](_0x1c0148,function(_0x28d8a5){if(_0x19cd4a){fs[_0xbd86('0x4e')](_0x1c0148);}});}}})[_0xbd86('0x3c')](function(_0x4974b0){if(_0x4974b0['message']==='SquareRecording\x20not\x20found'){_0x23fc28['status'](0x194)[_0xbd86('0x22')](_0xbd86('0x4f'));}else{return handleError(_0x23fc28,null);}});};exports[_0xbd86('0x50')]=function(_0x3f6f51,_0x5d24c8){return db[_0xbd86('0x23')][_0xbd86('0x3f')]({'where':{'id':_0x3f6f51[_0xbd86('0x42')]['id']}})[_0xbd86('0x39')](function(_0xc6717a){if(_[_0xbd86('0x51')](_0xc6717a)){throw new ReferenceError(_0xbd86('0x52'));}return _0xc6717a;})[_0xbd86('0x39')](function(_0x139479){var _0x12ac0b=_0x139479[_0xbd86('0x46')];logger['info'](_0xbd86('0x53'),_0x12ac0b);if(!_['isNil'](_0x139479[_0xbd86('0x46')])&&fs[_0xbd86('0x49')](_0x12ac0b)){logger[_0xbd86('0x54')](_0xbd86('0x55')+_0x12ac0b+_0xbd86('0x56'));fs[_0xbd86('0x57')](_0x12ac0b);}_0x12ac0b=_0x12ac0b+_0xbd86('0x58');if(!_[_0xbd86('0x51')](_0x139479[_0xbd86('0x46')])&&fs['existsSync'](_0x12ac0b)){logger['info'](_0xbd86('0x55')+_0x12ac0b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd86('0x57')](_0x12ac0b);}return _0x139479;})[_0xbd86('0x39')](function(_0x73195e){if(!_0x73195e)throw new InternalError();return _0x73195e[_0xbd86('0x50')]();})[_0xbd86('0x39')](function(){_0x5d24c8[_0xbd86('0x14')](0xcc)[_0xbd86('0x15')]();})['catch'](handleError(_0x5d24c8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d62e47f..3aa19bc 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 _0xc029=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash'];(function(_0x129edf,_0xfa7302){var _0x70563a=function(_0x549205){while(--_0x549205){_0x129edf['push'](_0x129edf['shift']());}};_0x70563a(++_0xfa7302);}(_0xc029,0x1df));var _0x9c02=function(_0x11dc4d,_0x45f353){_0x11dc4d=_0x11dc4d-0x0;var _0x125d12=_0xc029[_0x11dc4d];return _0x125d12;};'use strict';var _=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var logger=require(_0x9c02('0x2'))(_0x9c02('0x3'));var moment=require(_0x9c02('0x4'));var BPromise=require(_0x9c02('0x5'));var rp=require(_0x9c02('0x6'));var fs=require('fs');var path=require(_0x9c02('0x7'));var rimraf=require(_0x9c02('0x8'));var config=require(_0x9c02('0x9'));var attributes=require(_0x9c02('0xa'));module[_0x9c02('0xb')]=function(_0x18792d,_0x14c7f8){return _0x18792d[_0x9c02('0xc')](_0x9c02('0xd'),attributes,{'tableName':_0x9c02('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bfc=['exports','define','SquareRecording','square_recordings','util','../../config/logger','api','bluebird','path','../../config/environment','./squareRecording.attributes'];(function(_0x34ff2d,_0xfce28c){var _0x2a581b=function(_0x50a9b7){while(--_0x50a9b7){_0x34ff2d['push'](_0x34ff2d['shift']());}};_0x2a581b(++_0xfce28c);}(_0x6bfc,0x159));var _0xc6bf=function(_0x43333a,_0xef7a8d){_0x43333a=_0x43333a-0x0;var _0x2bfcb7=_0x6bfc[_0x43333a];return _0x2bfcb7;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var logger=require(_0xc6bf('0x1'))(_0xc6bf('0x2'));var moment=require('moment');var BPromise=require(_0xc6bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6bf('0x4'));var rimraf=require('rimraf');var config=require(_0xc6bf('0x5'));var attributes=require(_0xc6bf('0x6'));module[_0xc6bf('0x7')]=function(_0x4a999e,_0x27a5d9){return _0x4a999e[_0xc6bf('0x8')](_0xc6bf('0x9'),attributes,{'tableName':_0xc6bf('0xa'),'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 b556b79..3c336cd 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 _0x70c1=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','options','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x70c1,0x11e));var _0x170c=function(_0x41e435,_0x3dfb2a){_0x41e435=_0x41e435-0x0;var _0x26f689=_0x70c1[_0x41e435];return _0x26f689;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x170c('0x0'));var BPromise=require(_0x170c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x170c('0x2'));var db=require(_0x170c('0x3'))['db'];var utils=require(_0x170c('0x4'));var logger=require(_0x170c('0x5'))(_0x170c('0x6'));var config=require(_0x170c('0x7'));var jayson=require(_0x170c('0x8'));var client=jayson['client'][_0x170c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41a4af,_0x4264a1,_0x585b09){return new BPromise(function(_0x34df7b,_0x18df28){return client[_0x170c('0xa')](_0x41a4af,_0x585b09)['then'](function(_0x445720){logger[_0x170c('0xb')](_0x170c('0xc'),_0x4264a1,'request\x20sent');logger[_0x170c('0xd')](_0x170c('0xe'),_0x4264a1,_0x170c('0xf'),JSON[_0x170c('0x10')](_0x445720));if(_0x445720[_0x170c('0x11')]){if(_0x445720[_0x170c('0x11')]['code']===0x1f4){logger[_0x170c('0x11')](_0x170c('0xc'),_0x4264a1,_0x445720[_0x170c('0x11')][_0x170c('0x12')]);return _0x18df28(_0x445720[_0x170c('0x11')][_0x170c('0x12')]);}logger['error'](_0x170c('0xc'),_0x4264a1,_0x445720[_0x170c('0x11')][_0x170c('0x12')]);return _0x34df7b(_0x445720[_0x170c('0x11')][_0x170c('0x12')]);}else{logger[_0x170c('0xb')]('SquareRecording,\x20%s,\x20%s',_0x4264a1,_0x170c('0xf'));_0x34df7b(_0x445720[_0x170c('0x13')][_0x170c('0x12')]);}})[_0x170c('0x14')](function(_0x67ff01){logger[_0x170c('0x11')](_0x170c('0xc'),_0x4264a1,_0x67ff01);_0x18df28(_0x67ff01);});});}exports[_0x170c('0x15')]=function(_0x51ca7c){var _0x2025eb=this;return new Promise(function(_0x1e3a4f,_0x4205ed){return db[_0x170c('0x16')][_0x170c('0x17')](_0x51ca7c['body'],{'raw':_0x51ca7c[_0x170c('0x18')]?_0x51ca7c[_0x170c('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x170c('0x19')](function(_0x4998fb){logger['info'](_0x170c('0x15'),_0x51ca7c);logger[_0x170c('0xd')](_0x170c('0x15'),_0x51ca7c,JSON[_0x170c('0x10')](_0x4998fb));_0x1e3a4f(_0x4998fb);})[_0x170c('0x14')](function(_0x3607f6){logger[_0x170c('0x11')](_0x170c('0x15'),_0x3607f6['message'],_0x51ca7c);_0x4205ed(_0x2025eb['error'](0x1f4,_0x3607f6[_0x170c('0x12')]));});});}; \ No newline at end of file +var _0x3ee5=['../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5ac3e6,_0x625c0d){var _0x119296=function(_0x1aead3){while(--_0x1aead3){_0x5ac3e6['push'](_0x5ac3e6['shift']());}};_0x119296(++_0x625c0d);}(_0x3ee5,0xe8));var _0x53ee=function(_0x277dd6,_0x2db7bc){_0x277dd6=_0x277dd6-0x0;var _0xc0acf=_0x3ee5[_0x277dd6];return _0xc0acf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53ee('0x0'));var BPromise=require(_0x53ee('0x1'));var rs=require(_0x53ee('0x2'));var fs=require('fs');var Redis=require(_0x53ee('0x3'));var db=require(_0x53ee('0x4'))['db'];var utils=require(_0x53ee('0x5'));var logger=require(_0x53ee('0x6'))(_0x53ee('0x7'));var config=require(_0x53ee('0x8'));var jayson=require(_0x53ee('0x9'));var client=jayson['client'][_0x53ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37e1d7,_0x3df953,_0x38b039){return new BPromise(function(_0x5ce4e4,_0xe761c7){return client[_0x53ee('0xb')](_0x37e1d7,_0x38b039)[_0x53ee('0xc')](function(_0x426337){logger[_0x53ee('0xd')](_0x53ee('0xe'),_0x3df953,_0x53ee('0xf'));logger['debug'](_0x53ee('0x10'),_0x3df953,_0x53ee('0xf'),JSON['stringify'](_0x426337));if(_0x426337[_0x53ee('0x11')]){if(_0x426337['error'][_0x53ee('0x12')]===0x1f4){logger['error'](_0x53ee('0xe'),_0x3df953,_0x426337['error'][_0x53ee('0x13')]);return _0xe761c7(_0x426337[_0x53ee('0x11')]['message']);}logger[_0x53ee('0x11')](_0x53ee('0xe'),_0x3df953,_0x426337['error'][_0x53ee('0x13')]);return _0x5ce4e4(_0x426337[_0x53ee('0x11')][_0x53ee('0x13')]);}else{logger[_0x53ee('0xd')](_0x53ee('0xe'),_0x3df953,_0x53ee('0xf'));_0x5ce4e4(_0x426337[_0x53ee('0x14')][_0x53ee('0x13')]);}})[_0x53ee('0x15')](function(_0x4bc490){logger[_0x53ee('0x11')](_0x53ee('0xe'),_0x3df953,_0x4bc490);_0xe761c7(_0x4bc490);});});}exports['CreateSquareRecording']=function(_0x5617be){var _0x23291b=this;return new Promise(function(_0x1976fd,_0x35dd82){return db[_0x53ee('0x16')][_0x53ee('0x17')](_0x5617be[_0x53ee('0x18')],{'raw':_0x5617be[_0x53ee('0x19')]?_0x5617be[_0x53ee('0x19')][_0x53ee('0x1a')]===undefined?!![]:![]:!![]})[_0x53ee('0xc')](function(_0x53a071){logger['info'](_0x53ee('0x1b'),_0x5617be);logger[_0x53ee('0x1c')]('CreateSquareRecording',_0x5617be,JSON[_0x53ee('0x1d')](_0x53a071));_0x1976fd(_0x53a071);})[_0x53ee('0x15')](function(_0x5a6635){logger[_0x53ee('0x11')](_0x53ee('0x1b'),_0x5a6635[_0x53ee('0x13')],_0x5617be);_0x35dd82(_0x23291b['error'](0x1f4,_0x5a6635[_0x53ee('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 4ed3ae6..307322f 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x36cd93,_0x593481){var _0x10f6cd=function(_0x1c3aa3){while(--_0x1c3aa3){_0x36cd93['push'](_0x36cd93['shift']());}};_0x10f6cd(++_0x593481);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4273179..b554ffd 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 _0xeb8d=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xeb8d,0x89));var _0xdeb8=function(_0x2a863f,_0x3e7a74){_0x2a863f=_0x2a863f-0x0;var _0x525dac=_0xeb8d[_0x2a863f];return _0x525dac;};'use strict';var Sequelize=require(_0xdeb8('0x0'));module[_0xdeb8('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xdeb8('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdeb8('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdeb8('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xdeb8('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xdeb8('0x2')]},'callingani2':{'type':Sequelize[_0xdeb8('0x2')]},'callington':{'type':Sequelize[_0xdeb8('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xdeb8('0x2')]},'rdnis':{'type':Sequelize[_0xdeb8('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdeb8('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xdeb8('0x2')]},'accountcode':{'type':Sequelize[_0xdeb8('0x2')]},'threadid':{'type':Sequelize[_0xdeb8('0x2')]},'project_name':{'type':Sequelize[_0xdeb8('0x2')]},'joinAt':{'type':Sequelize[_0xdeb8('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xdeb8('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xd845=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x20663d,_0x58e90c){var _0x134404=function(_0x2099e4){while(--_0x2099e4){_0x20663d['push'](_0x20663d['shift']());}};_0x134404(++_0x58e90c);}(_0xd845,0x74));var _0x5d84=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xd845[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x5d84('0x0'));module[_0x5d84('0x1')]={'network':{'type':Sequelize[_0x5d84('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x5d84('0x2')]},'channel':{'type':Sequelize[_0x5d84('0x2')]},'language':{'type':Sequelize[_0x5d84('0x2')]},'type':{'type':Sequelize[_0x5d84('0x2')]},'uniqueid':{'type':Sequelize[_0x5d84('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5d84('0x2')]},'calleridname':{'type':Sequelize[_0x5d84('0x2')]},'callingpres':{'type':Sequelize[_0x5d84('0x2')]},'callingani2':{'type':Sequelize[_0x5d84('0x2')]},'callington':{'type':Sequelize[_0x5d84('0x2')]},'callingtns':{'type':Sequelize[_0x5d84('0x2')]},'dnid':{'type':Sequelize[_0x5d84('0x2')]},'rdnis':{'type':Sequelize[_0x5d84('0x2')]},'context':{'type':Sequelize[_0x5d84('0x2')]},'extension':{'type':Sequelize[_0x5d84('0x2')]},'priority':{'type':Sequelize[_0x5d84('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5d84('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x5d84('0x2')]},'joinAt':{'type':Sequelize[_0x5d84('0x3')]},'leaveAt':{'type':Sequelize[_0x5d84('0x3')]},'bot':{'type':Sequelize[_0x5d84('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8a8b88a..88213f6 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 _0x05ca=['send','index','map','SquareReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','body','update','find','describe','eml-format','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name'];(function(_0x41fe28,_0x5dfbad){var _0x190689=function(_0x35b203){while(--_0x35b203){_0x41fe28['push'](_0x41fe28['shift']());}};_0x190689(++_0x5dfbad);}(_0x05ca,0x199));var _0xa05c=function(_0x10ac4c,_0x137e61){_0x10ac4c=_0x10ac4c-0x0;var _0x56d383=_0x05ca[_0x10ac4c];return _0x56d383;};'use strict';var emlformat=require(_0xa05c('0x0'));var rimraf=require(_0xa05c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa05c('0x2'));var rp=require(_0xa05c('0x3'));var moment=require(_0xa05c('0x4'));var BPromise=require(_0xa05c('0x5'));var Mustache=require(_0xa05c('0x6'));var util=require(_0xa05c('0x7'));var path=require('path');var sox=require(_0xa05c('0x8'));var csv=require(_0xa05c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa05c('0xa'));var _=require(_0xa05c('0xb'));var squel=require(_0xa05c('0xc'));var crypto=require(_0xa05c('0xd'));var jsforce=require(_0xa05c('0xe'));var deskjs=require(_0xa05c('0xf'));var toCsv=require(_0xa05c('0x9'));var querystring=require(_0xa05c('0x10'));var Papa=require(_0xa05c('0x11'));var Redis=require(_0xa05c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa05c('0x13'));var hardwareService=require(_0xa05c('0x14'));var logger=require(_0xa05c('0x15'))('api');var utils=require(_0xa05c('0x16'));var config=require(_0xa05c('0x17'));var licenseUtil=require(_0xa05c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfdd0ac,_0x16b2b7){_0x16b2b7=_0x16b2b7||0xcc;return function(_0xbb9381){if(_0xbb9381){return _0xfdd0ac[_0xa05c('0x19')](_0x16b2b7);}return _0xfdd0ac[_0xa05c('0x1a')](_0x16b2b7)[_0xa05c('0x1b')]();};}function respondWithResult(_0x253d27,_0x26dd6d){_0x26dd6d=_0x26dd6d||0xc8;return function(_0x19d7f1){if(_0x19d7f1){return _0x253d27['status'](_0x26dd6d)[_0xa05c('0x1c')](_0x19d7f1);}};}function respondWithFilteredResult(_0x545411,_0x2628b5){return function(_0x5ac284){if(_0x5ac284){var _0x269aeb=typeof _0x2628b5[_0xa05c('0x1d')]===_0xa05c('0x1e')&&typeof _0x2628b5[_0xa05c('0x1f')]===_0xa05c('0x1e');var _0x696316=_0x5ac284[_0xa05c('0x20')];var _0x33ddd3=_0x269aeb?0x0:_0x2628b5[_0xa05c('0x1d')];var _0xab62ac=_0x269aeb?_0x5ac284[_0xa05c('0x20')]:_0x2628b5[_0xa05c('0x1d')]+_0x2628b5['limit'];var _0x279600;if(_0xab62ac>=_0x696316){_0xab62ac=_0x696316;_0x279600=0xc8;}else{_0x279600=0xce;}_0x545411['status'](_0x279600);return _0x545411[_0xa05c('0x21')](_0xa05c('0x22'),_0x33ddd3+'-'+_0xab62ac+'/'+_0x696316)['json'](_0x5ac284);}return null;};}function patchUpdates(_0x48620d){return function(_0x52dc4e){try{jsonpatch['apply'](_0x52dc4e,_0x48620d,!![]);}catch(_0x249aa1){return BPromise[_0xa05c('0x23')](_0x249aa1);}return _0x52dc4e[_0xa05c('0x24')]();};}function saveUpdates(_0xb5fc3c,_0x18493a){return function(_0x3e3e8b){if(_0x3e3e8b){return _0x3e3e8b['update'](_0xb5fc3c)[_0xa05c('0x25')](function(_0x16b832){return _0x16b832;});}return null;};}function removeEntity(_0xc0720e,_0x516b8b){return function(_0x15281b){if(_0x15281b){return _0x15281b[_0xa05c('0x26')]()[_0xa05c('0x25')](function(){_0xc0720e[_0xa05c('0x1a')](0xcc)[_0xa05c('0x1b')]();});}};}function handleEntityNotFound(_0x4021f5,_0x4132ed){return function(_0x44b204){if(!_0x44b204){_0x4021f5[_0xa05c('0x19')](0x194);}return _0x44b204;};}function handleError(_0xd3587d,_0x2bfb95){_0x2bfb95=_0x2bfb95||0x1f4;return function(_0x5ef299){logger[_0xa05c('0x27')](_0x5ef299['stack']);if(_0x5ef299[_0xa05c('0x28')]){delete _0x5ef299[_0xa05c('0x28')];}_0xd3587d[_0xa05c('0x1a')](_0x2bfb95)[_0xa05c('0x29')](_0x5ef299);};}exports[_0xa05c('0x2a')]=function(_0x4bc442,_0xb08dfc){var _0x5e2ecf={},_0x3351d4={},_0x107ad0={'count':0x0,'rows':[]};var _0x85f3db=_[_0xa05c('0x2b')](db[_0xa05c('0x2c')]['rawAttributes'],function(_0x5638d8){return{'name':_0x5638d8[_0xa05c('0x2d')],'type':_0x5638d8[_0xa05c('0x2e')][_0xa05c('0x2f')]};});_0x3351d4['model']=_[_0xa05c('0x2b')](_0x85f3db,'name');_0x3351d4['query']=_[_0xa05c('0x30')](_0x4bc442[_0xa05c('0x31')]);_0x3351d4[_0xa05c('0x32')]=_[_0xa05c('0x33')](_0x3351d4[_0xa05c('0x34')],_0x3351d4[_0xa05c('0x31')]);_0x5e2ecf[_0xa05c('0x35')]=_[_0xa05c('0x33')](_0x3351d4[_0xa05c('0x34')],qs[_0xa05c('0x36')](_0x4bc442[_0xa05c('0x31')][_0xa05c('0x36')]));_0x5e2ecf[_0xa05c('0x35')]=_0x5e2ecf[_0xa05c('0x35')][_0xa05c('0x37')]?_0x5e2ecf['attributes']:_0x3351d4['model'];if(!_0x4bc442[_0xa05c('0x31')]['hasOwnProperty'](_0xa05c('0x38'))){_0x5e2ecf[_0xa05c('0x1f')]=qs['limit'](_0x4bc442[_0xa05c('0x31')]['limit']);_0x5e2ecf[_0xa05c('0x1d')]=qs[_0xa05c('0x1d')](_0x4bc442[_0xa05c('0x31')]['offset']);}_0x5e2ecf['order']=qs[_0xa05c('0x39')](_0x4bc442[_0xa05c('0x31')]['sort']);_0x5e2ecf['where']=qs['filters'](_[_0xa05c('0x3a')](_0x4bc442[_0xa05c('0x31')],_0x3351d4[_0xa05c('0x32')]),_0x85f3db);if(_0x4bc442[_0xa05c('0x31')][_0xa05c('0x3b')]){_0x5e2ecf[_0xa05c('0x3c')]=_[_0xa05c('0x3d')](_0x5e2ecf['where'],{'$or':_[_0xa05c('0x2b')](_0x85f3db,function(_0x23458f){if(_0x23458f[_0xa05c('0x2e')]!==_0xa05c('0x3e')){var _0x383f28={};_0x383f28[_0x23458f[_0xa05c('0x28')]]={'$like':'%'+_0x4bc442[_0xa05c('0x31')][_0xa05c('0x3b')]+'%'};return _0x383f28;}})});}_0x5e2ecf=_[_0xa05c('0x3d')]({},_0x5e2ecf,_0x4bc442[_0xa05c('0x3f')]);var _0x432e8a={'where':_0x5e2ecf[_0xa05c('0x3c')]};return db['SquareReport'][_0xa05c('0x20')](_0x432e8a)[_0xa05c('0x25')](function(_0x10ef21){_0x107ad0['count']=_0x10ef21;if(_0x4bc442[_0xa05c('0x31')][_0xa05c('0x40')]){_0x5e2ecf[_0xa05c('0x41')]=[{'all':!![]}];}return db[_0xa05c('0x2c')][_0xa05c('0x42')](_0x5e2ecf);})[_0xa05c('0x25')](function(_0x29223b){_0x107ad0['rows']=_0x29223b;return _0x107ad0;})['then'](respondWithFilteredResult(_0xb08dfc,_0x5e2ecf))[_0xa05c('0x43')](handleError(_0xb08dfc,null));};exports[_0xa05c('0x44')]=function(_0x3f8140,_0x24fe4f){var _0x26ee38={'raw':!![],'where':{'id':_0x3f8140[_0xa05c('0x45')]['id']}},_0x1ad21a={};_0x1ad21a[_0xa05c('0x34')]=_[_0xa05c('0x30')](db[_0xa05c('0x2c')][_0xa05c('0x46')]);_0x1ad21a[_0xa05c('0x31')]=_['keys'](_0x3f8140['query']);_0x1ad21a[_0xa05c('0x32')]=_['intersection'](_0x1ad21a[_0xa05c('0x34')],_0x1ad21a[_0xa05c('0x31')]);_0x26ee38['attributes']=_[_0xa05c('0x33')](_0x1ad21a[_0xa05c('0x34')],qs[_0xa05c('0x36')](_0x3f8140['query']['fields']));_0x26ee38[_0xa05c('0x35')]=_0x26ee38[_0xa05c('0x35')][_0xa05c('0x37')]?_0x26ee38['attributes']:_0x1ad21a[_0xa05c('0x34')];if(_0x3f8140[_0xa05c('0x31')]['includeAll']){_0x26ee38['include']=[{'all':!![]}];}_0x26ee38=_[_0xa05c('0x3d')]({},_0x26ee38,_0x3f8140[_0xa05c('0x3f')]);return db[_0xa05c('0x2c')]['find'](_0x26ee38)['then'](handleEntityNotFound(_0x24fe4f,null))['then'](respondWithResult(_0x24fe4f,null))[_0xa05c('0x43')](handleError(_0x24fe4f,null));};exports['create']=function(_0xd2fde1,_0x144450){return db['SquareReport']['create'](_0xd2fde1[_0xa05c('0x47')],{})[_0xa05c('0x25')](respondWithResult(_0x144450,0xc9))[_0xa05c('0x43')](handleError(_0x144450,null));};exports[_0xa05c('0x48')]=function(_0x2c1594,_0x189aef){if(_0x2c1594[_0xa05c('0x47')]['id']){delete _0x2c1594[_0xa05c('0x47')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x2c1594[_0xa05c('0x45')]['id']}})['then'](handleEntityNotFound(_0x189aef,null))[_0xa05c('0x25')](saveUpdates(_0x2c1594['body'],null))[_0xa05c('0x25')](respondWithResult(_0x189aef,null))[_0xa05c('0x43')](handleError(_0x189aef,null));};exports[_0xa05c('0x26')]=function(_0x54adc9,_0x48a5f5){return db[_0xa05c('0x2c')][_0xa05c('0x49')]({'where':{'id':_0x54adc9[_0xa05c('0x45')]['id']}})[_0xa05c('0x25')](handleEntityNotFound(_0x48a5f5,null))['then'](removeEntity(_0x48a5f5,null))[_0xa05c('0x43')](handleError(_0x48a5f5,null));};exports[_0xa05c('0x4a')]=function(_0x24bf55,_0xf66294){return db[_0xa05c('0x2c')]['describe']()[_0xa05c('0x25')](respondWithResult(_0xf66294,null))['catch'](handleError(_0xf66294,null));}; \ No newline at end of file +var _0x004f=['name','send','index','SquareReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x004f,0x70));var _0xf004=function(_0x5d5f3c,_0x5f4688){_0x5d5f3c=_0x5d5f3c-0x0;var _0x291fd7=_0x004f[_0x5d5f3c];return _0x291fd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf004('0x0'));var zipdir=require(_0xf004('0x1'));var jsonpatch=require(_0xf004('0x2'));var rp=require(_0xf004('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf004('0x4'));var util=require(_0xf004('0x5'));var path=require(_0xf004('0x6'));var sox=require(_0xf004('0x7'));var csv=require('to-csv');var ejs=require(_0xf004('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf004('0x9'));var crypto=require(_0xf004('0xa'));var jsforce=require(_0xf004('0xb'));var deskjs=require(_0xf004('0xc'));var toCsv=require(_0xf004('0xd'));var querystring=require(_0xf004('0xe'));var Papa=require(_0xf004('0xf'));var Redis=require(_0xf004('0x10'));var authService=require(_0xf004('0x11'));var qs=require(_0xf004('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf004('0x13'))(_0xf004('0x14'));var utils=require('../../config/utils');var config=require(_0xf004('0x15'));var licenseUtil=require(_0xf004('0x16'));var db=require(_0xf004('0x17'))['db'];function respondWithStatusCode(_0x24524a,_0x46ea21){_0x46ea21=_0x46ea21||0xcc;return function(_0x1eef2e){if(_0x1eef2e){return _0x24524a['sendStatus'](_0x46ea21);}return _0x24524a['status'](_0x46ea21)[_0xf004('0x18')]();};}function respondWithResult(_0x448e82,_0x3dee3a){_0x3dee3a=_0x3dee3a||0xc8;return function(_0xca9401){if(_0xca9401){return _0x448e82[_0xf004('0x19')](_0x3dee3a)['json'](_0xca9401);}};}function respondWithFilteredResult(_0x498e79,_0x266f7d){return function(_0x1555d6){if(_0x1555d6){var _0x36ad86=typeof _0x266f7d[_0xf004('0x1a')]===_0xf004('0x1b')&&typeof _0x266f7d[_0xf004('0x1c')]===_0xf004('0x1b');var _0x52a85c=_0x1555d6[_0xf004('0x1d')];var _0x4f41ab=_0x36ad86?0x0:_0x266f7d['offset'];var _0x509543=_0x36ad86?_0x1555d6['count']:_0x266f7d[_0xf004('0x1a')]+_0x266f7d[_0xf004('0x1c')];var _0x592a33;if(_0x509543>=_0x52a85c){_0x509543=_0x52a85c;_0x592a33=0xc8;}else{_0x592a33=0xce;}_0x498e79[_0xf004('0x19')](_0x592a33);return _0x498e79['set'](_0xf004('0x1e'),_0x4f41ab+'-'+_0x509543+'/'+_0x52a85c)['json'](_0x1555d6);}return null;};}function patchUpdates(_0x83ad11){return function(_0x21cbda){try{jsonpatch[_0xf004('0x1f')](_0x21cbda,_0x83ad11,!![]);}catch(_0x275e8a){return BPromise[_0xf004('0x20')](_0x275e8a);}return _0x21cbda[_0xf004('0x21')]();};}function saveUpdates(_0x459f13,_0x1000c3){return function(_0x5de688){if(_0x5de688){return _0x5de688[_0xf004('0x22')](_0x459f13)[_0xf004('0x23')](function(_0x5bc450){return _0x5bc450;});}return null;};}function removeEntity(_0x23b3e2,_0xc1714){return function(_0x4f5a8c){if(_0x4f5a8c){return _0x4f5a8c[_0xf004('0x24')]()[_0xf004('0x23')](function(){_0x23b3e2[_0xf004('0x19')](0xcc)[_0xf004('0x18')]();});}};}function handleEntityNotFound(_0x3e1c9d,_0x4c35b1){return function(_0x1d0731){if(!_0x1d0731){_0x3e1c9d[_0xf004('0x25')](0x194);}return _0x1d0731;};}function handleError(_0x48d0c3,_0x23c283){_0x23c283=_0x23c283||0x1f4;return function(_0x485e2f){logger[_0xf004('0x26')](_0x485e2f[_0xf004('0x27')]);if(_0x485e2f['name']){delete _0x485e2f[_0xf004('0x28')];}_0x48d0c3[_0xf004('0x19')](_0x23c283)[_0xf004('0x29')](_0x485e2f);};}exports[_0xf004('0x2a')]=function(_0x2a7cc8,_0x247b88){var _0xb38bd4={},_0x1027ca={},_0x2cb6cc={'count':0x0,'rows':[]};var _0x45b17b=_['map'](db[_0xf004('0x2b')][_0xf004('0x2c')],function(_0x366d21){return{'name':_0x366d21[_0xf004('0x2d')],'type':_0x366d21['type'][_0xf004('0x2e')]};});_0x1027ca[_0xf004('0x2f')]=_[_0xf004('0x30')](_0x45b17b,'name');_0x1027ca[_0xf004('0x31')]=_[_0xf004('0x32')](_0x2a7cc8[_0xf004('0x31')]);_0x1027ca[_0xf004('0x33')]=_[_0xf004('0x34')](_0x1027ca['model'],_0x1027ca[_0xf004('0x31')]);_0xb38bd4[_0xf004('0x35')]=_[_0xf004('0x34')](_0x1027ca[_0xf004('0x2f')],qs[_0xf004('0x36')](_0x2a7cc8[_0xf004('0x31')]['fields']));_0xb38bd4[_0xf004('0x35')]=_0xb38bd4[_0xf004('0x35')][_0xf004('0x37')]?_0xb38bd4[_0xf004('0x35')]:_0x1027ca[_0xf004('0x2f')];if(!_0x2a7cc8[_0xf004('0x31')][_0xf004('0x38')](_0xf004('0x39'))){_0xb38bd4[_0xf004('0x1c')]=qs[_0xf004('0x1c')](_0x2a7cc8['query'][_0xf004('0x1c')]);_0xb38bd4[_0xf004('0x1a')]=qs[_0xf004('0x1a')](_0x2a7cc8[_0xf004('0x31')]['offset']);}_0xb38bd4[_0xf004('0x3a')]=qs[_0xf004('0x3b')](_0x2a7cc8[_0xf004('0x31')]['sort']);_0xb38bd4[_0xf004('0x3c')]=qs[_0xf004('0x33')](_['pick'](_0x2a7cc8[_0xf004('0x31')],_0x1027ca[_0xf004('0x33')]),_0x45b17b);if(_0x2a7cc8[_0xf004('0x31')][_0xf004('0x3d')]){_0xb38bd4[_0xf004('0x3c')]=_[_0xf004('0x3e')](_0xb38bd4[_0xf004('0x3c')],{'$or':_[_0xf004('0x30')](_0x45b17b,function(_0x5666a7){if(_0x5666a7[_0xf004('0x3f')]!==_0xf004('0x40')){var _0x2640e5={};_0x2640e5[_0x5666a7[_0xf004('0x28')]]={'$like':'%'+_0x2a7cc8[_0xf004('0x31')][_0xf004('0x3d')]+'%'};return _0x2640e5;}})});}_0xb38bd4=_['merge']({},_0xb38bd4,_0x2a7cc8[_0xf004('0x41')]);var _0x219317={'where':_0xb38bd4[_0xf004('0x3c')]};return db['SquareReport'][_0xf004('0x1d')](_0x219317)[_0xf004('0x23')](function(_0x141a74){_0x2cb6cc['count']=_0x141a74;if(_0x2a7cc8['query'][_0xf004('0x42')]){_0xb38bd4[_0xf004('0x43')]=[{'all':!![]}];}return db[_0xf004('0x2b')][_0xf004('0x44')](_0xb38bd4);})[_0xf004('0x23')](function(_0x5e6aa3){_0x2cb6cc[_0xf004('0x45')]=_0x5e6aa3;return _0x2cb6cc;})[_0xf004('0x23')](respondWithFilteredResult(_0x247b88,_0xb38bd4))['catch'](handleError(_0x247b88,null));};exports['show']=function(_0x2a16e2,_0x2532f8){var _0x3c1385={'raw':!![],'where':{'id':_0x2a16e2[_0xf004('0x46')]['id']}},_0x5316ad={};_0x5316ad[_0xf004('0x2f')]=_[_0xf004('0x32')](db['SquareReport'][_0xf004('0x2c')]);_0x5316ad[_0xf004('0x31')]=_[_0xf004('0x32')](_0x2a16e2[_0xf004('0x31')]);_0x5316ad[_0xf004('0x33')]=_[_0xf004('0x34')](_0x5316ad[_0xf004('0x2f')],_0x5316ad[_0xf004('0x31')]);_0x3c1385[_0xf004('0x35')]=_['intersection'](_0x5316ad[_0xf004('0x2f')],qs[_0xf004('0x36')](_0x2a16e2[_0xf004('0x31')]['fields']));_0x3c1385[_0xf004('0x35')]=_0x3c1385[_0xf004('0x35')][_0xf004('0x37')]?_0x3c1385[_0xf004('0x35')]:_0x5316ad[_0xf004('0x2f')];if(_0x2a16e2['query'][_0xf004('0x42')]){_0x3c1385[_0xf004('0x43')]=[{'all':!![]}];}_0x3c1385=_[_0xf004('0x3e')]({},_0x3c1385,_0x2a16e2[_0xf004('0x41')]);return db['SquareReport'][_0xf004('0x47')](_0x3c1385)[_0xf004('0x23')](handleEntityNotFound(_0x2532f8,null))[_0xf004('0x23')](respondWithResult(_0x2532f8,null))[_0xf004('0x48')](handleError(_0x2532f8,null));};exports[_0xf004('0x49')]=function(_0x233bf2,_0x53c790){return db[_0xf004('0x2b')][_0xf004('0x49')](_0x233bf2[_0xf004('0x4a')],{})[_0xf004('0x23')](respondWithResult(_0x53c790,0xc9))['catch'](handleError(_0x53c790,null));};exports[_0xf004('0x22')]=function(_0x19ac07,_0xd684){if(_0x19ac07['body']['id']){delete _0x19ac07[_0xf004('0x4a')]['id'];}return db[_0xf004('0x2b')]['find']({'where':{'id':_0x19ac07[_0xf004('0x46')]['id']}})[_0xf004('0x23')](handleEntityNotFound(_0xd684,null))['then'](saveUpdates(_0x19ac07[_0xf004('0x4a')],null))[_0xf004('0x23')](respondWithResult(_0xd684,null))[_0xf004('0x48')](handleError(_0xd684,null));};exports[_0xf004('0x24')]=function(_0x340d49,_0x52581f){return db[_0xf004('0x2b')][_0xf004('0x47')]({'where':{'id':_0x340d49['params']['id']}})['then'](handleEntityNotFound(_0x52581f,null))[_0xf004('0x23')](removeEntity(_0x52581f,null))[_0xf004('0x48')](handleError(_0x52581f,null));};exports['describe']=function(_0x3a3542,_0x595629){return db[_0xf004('0x2b')][_0xf004('0x4b')]()[_0xf004('0x23')](respondWithResult(_0x595629,null))['catch'](handleError(_0x595629,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 107affc..a90c81c 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 _0x71b7=['exports','define','SquareReport','uid_pname','uniqueid','leaveAt','../../config/logger','moment','bluebird','path','../../config/environment','./squareReport.attributes'];(function(_0x2b94d5,_0x3b8853){var _0x3217c0=function(_0x4720c2){while(--_0x4720c2){_0x2b94d5['push'](_0x2b94d5['shift']());}};_0x3217c0(++_0x3b8853);}(_0x71b7,0x1da));var _0x771b=function(_0x3d1244,_0x156028){_0x3d1244=_0x3d1244-0x0;var _0x5d6372=_0x71b7[_0x3d1244];return _0x5d6372;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x771b('0x0'))('api');var moment=require(_0x771b('0x1'));var BPromise=require(_0x771b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x771b('0x3'));var rimraf=require('rimraf');var config=require(_0x771b('0x4'));var attributes=require(_0x771b('0x5'));module[_0x771b('0x6')]=function(_0xd05d6c,_0x48997c){return _0xd05d6c[_0x771b('0x7')](_0x771b('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x771b('0x9'),'fields':[_0x771b('0xa'),'project_name']},{'name':_0x771b('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb798=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','project_name','leaveAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb798,0x1ad));var _0x8b79=function(_0x436c1d,_0x1f55a0){_0x436c1d=_0x436c1d-0x0;var _0x4bfad5=_0xb798[_0x436c1d];return _0x4bfad5;};'use strict';var _=require(_0x8b79('0x0'));var util=require(_0x8b79('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b79('0x2'));var BPromise=require(_0x8b79('0x3'));var rp=require(_0x8b79('0x4'));var fs=require('fs');var path=require(_0x8b79('0x5'));var rimraf=require('rimraf');var config=require(_0x8b79('0x6'));var attributes=require(_0x8b79('0x7'));module[_0x8b79('0x8')]=function(_0x514b58,_0x171fda){return _0x514b58['define'](_0x8b79('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x8b79('0xa'),'fields':['uniqueid',_0x8b79('0xb')]},{'name':_0x8b79('0xc'),'fields':[_0x8b79('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f66529b..0a4e615 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 _0x18e2=['UpdateSquareReport','update','body','options','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareReport','SquareReport','create','raw'];(function(_0x1f2554,_0x3d2a14){var _0x216269=function(_0x511c4a){while(--_0x511c4a){_0x1f2554['push'](_0x1f2554['shift']());}};_0x216269(++_0x3d2a14);}(_0x18e2,0x1c0));var _0x218e=function(_0x534231,_0x55a338){_0x534231=_0x534231-0x0;var _0x195f36=_0x18e2[_0x534231];return _0x195f36;};'use strict';var _=require(_0x218e('0x0'));var util=require('util');var moment=require(_0x218e('0x1'));var BPromise=require(_0x218e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x218e('0x3'));var db=require(_0x218e('0x4'))['db'];var utils=require(_0x218e('0x5'));var logger=require(_0x218e('0x6'))(_0x218e('0x7'));var config=require('../../config/environment');var jayson=require(_0x218e('0x8'));var client=jayson[_0x218e('0x9')][_0x218e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d7132,_0x4b7b32,_0x12389d){return new BPromise(function(_0x5b5c04,_0x1966f1){return client[_0x218e('0xb')](_0x3d7132,_0x12389d)[_0x218e('0xc')](function(_0x3e072e){logger[_0x218e('0xd')](_0x218e('0xe'),_0x4b7b32,_0x218e('0xf'));logger[_0x218e('0x10')](_0x218e('0x11'),_0x4b7b32,_0x218e('0xf'),JSON[_0x218e('0x12')](_0x3e072e));if(_0x3e072e['error']){if(_0x3e072e['error'][_0x218e('0x13')]===0x1f4){logger[_0x218e('0x14')](_0x218e('0xe'),_0x4b7b32,_0x3e072e['error'][_0x218e('0x15')]);return _0x1966f1(_0x3e072e[_0x218e('0x14')][_0x218e('0x15')]);}logger[_0x218e('0x14')](_0x218e('0xe'),_0x4b7b32,_0x3e072e[_0x218e('0x14')][_0x218e('0x15')]);return _0x5b5c04(_0x3e072e[_0x218e('0x14')][_0x218e('0x15')]);}else{logger['info'](_0x218e('0xe'),_0x4b7b32,_0x218e('0xf'));_0x5b5c04(_0x3e072e[_0x218e('0x16')][_0x218e('0x15')]);}})[_0x218e('0x17')](function(_0x3a0c00){logger[_0x218e('0x14')](_0x218e('0xe'),_0x4b7b32,_0x3a0c00);_0x1966f1(_0x3a0c00);});});}exports[_0x218e('0x18')]=function(_0x551e5c){var _0xb90da=this;return new Promise(function(_0x4a596d,_0x45b3d5){return db[_0x218e('0x19')][_0x218e('0x1a')](_0x551e5c['body'],{'raw':_0x551e5c['options']?_0x551e5c['options'][_0x218e('0x1b')]===undefined?!![]:![]:!![]})[_0x218e('0xc')](function(_0x26e307){logger[_0x218e('0xd')](_0x218e('0x18'),_0x551e5c);logger['debug'](_0x218e('0x18'),_0x551e5c,JSON[_0x218e('0x12')](_0x26e307));_0x4a596d(_0x26e307);})[_0x218e('0x17')](function(_0xad9684){logger[_0x218e('0x14')](_0x218e('0x18'),_0xad9684['message'],_0x551e5c);_0x45b3d5(_0xb90da[_0x218e('0x14')](0x1f4,_0xad9684['message']));});});};exports[_0x218e('0x1c')]=function(_0x59861f){var _0x2213b9=this;return new Promise(function(_0x241e44,_0x1d1dce){return db[_0x218e('0x19')][_0x218e('0x1d')](_0x59861f[_0x218e('0x1e')],{'raw':_0x59861f[_0x218e('0x1f')]?_0x59861f[_0x218e('0x1f')][_0x218e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59861f[_0x218e('0x1f')]?_0x59861f[_0x218e('0x1f')][_0x218e('0x20')]||null:null,'attributes':_0x59861f[_0x218e('0x1f')]?_0x59861f[_0x218e('0x1f')]['attributes']||null:null,'limit':_0x59861f[_0x218e('0x1f')]?_0x59861f['options'][_0x218e('0x21')]||null:null})[_0x218e('0xc')](function(_0x586a54){logger['info'](_0x218e('0x1c'),_0x59861f);logger[_0x218e('0x10')](_0x218e('0x1c'),_0x59861f,JSON[_0x218e('0x12')](_0x586a54));_0x241e44(_0x586a54);})[_0x218e('0x17')](function(_0x5557dc){logger[_0x218e('0x14')]('UpdateSquareReport',_0x5557dc['message'],_0x59861f);_0x1d1dce(_0x2213b9[_0x218e('0x14')](0x1f4,_0x5557dc[_0x218e('0x15')]));});});}; \ No newline at end of file +var _0xf463=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','create','body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','attributes','limit'];(function(_0x4e6701,_0x352e0c){var _0x2576c1=function(_0x4f24da){while(--_0x4f24da){_0x4e6701['push'](_0x4e6701['shift']());}};_0x2576c1(++_0x352e0c);}(_0xf463,0x1f0));var _0x3f46=function(_0x1e4617,_0x22fcf8){_0x1e4617=_0x1e4617-0x0;var _0x31d803=_0xf463[_0x1e4617];return _0x31d803;};'use strict';var _=require(_0x3f46('0x0'));var util=require(_0x3f46('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f46('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3f46('0x3'))(_0x3f46('0x4'));var config=require(_0x3f46('0x5'));var jayson=require(_0x3f46('0x6'));var client=jayson['client'][_0x3f46('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19cfbc,_0x3a4786,_0x4694d0){return new BPromise(function(_0x22b4b0,_0x30593c){return client[_0x3f46('0x8')](_0x19cfbc,_0x4694d0)[_0x3f46('0x9')](function(_0x9a30ee){logger['info'](_0x3f46('0xa'),_0x3a4786,_0x3f46('0xb'));logger[_0x3f46('0xc')](_0x3f46('0xd'),_0x3a4786,_0x3f46('0xb'),JSON[_0x3f46('0xe')](_0x9a30ee));if(_0x9a30ee['error']){if(_0x9a30ee[_0x3f46('0xf')][_0x3f46('0x10')]===0x1f4){logger[_0x3f46('0xf')]('SquareReport,\x20%s,\x20%s',_0x3a4786,_0x9a30ee['error'][_0x3f46('0x11')]);return _0x30593c(_0x9a30ee['error']['message']);}logger[_0x3f46('0xf')](_0x3f46('0xa'),_0x3a4786,_0x9a30ee[_0x3f46('0xf')]['message']);return _0x22b4b0(_0x9a30ee[_0x3f46('0xf')][_0x3f46('0x11')]);}else{logger[_0x3f46('0x12')](_0x3f46('0xa'),_0x3a4786,_0x3f46('0xb'));_0x22b4b0(_0x9a30ee['result']['message']);}})[_0x3f46('0x13')](function(_0x558abc){logger['error']('SquareReport,\x20%s,\x20%s',_0x3a4786,_0x558abc);_0x30593c(_0x558abc);});});}exports['CreateSquareReport']=function(_0xea4c15){var _0x4614d9=this;return new Promise(function(_0x36857e,_0xe6d75c){return db['SquareReport'][_0x3f46('0x14')](_0xea4c15[_0x3f46('0x15')],{'raw':_0xea4c15[_0x3f46('0x16')]?_0xea4c15[_0x3f46('0x16')][_0x3f46('0x17')]===undefined?!![]:![]:!![]})[_0x3f46('0x9')](function(_0x16c083){logger[_0x3f46('0x12')]('CreateSquareReport',_0xea4c15);logger['debug']('CreateSquareReport',_0xea4c15,JSON[_0x3f46('0xe')](_0x16c083));_0x36857e(_0x16c083);})[_0x3f46('0x13')](function(_0x32a4a4){logger[_0x3f46('0xf')](_0x3f46('0x18'),_0x32a4a4['message'],_0xea4c15);_0xe6d75c(_0x4614d9[_0x3f46('0xf')](0x1f4,_0x32a4a4[_0x3f46('0x11')]));});});};exports[_0x3f46('0x19')]=function(_0x383ea7){var _0x468e59=this;return new Promise(function(_0x5ec832,_0x12d29d){return db[_0x3f46('0x1a')][_0x3f46('0x1b')](_0x383ea7[_0x3f46('0x15')],{'raw':_0x383ea7[_0x3f46('0x16')]?_0x383ea7['options'][_0x3f46('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x383ea7[_0x3f46('0x16')]?_0x383ea7[_0x3f46('0x16')][_0x3f46('0x1c')]||null:null,'attributes':_0x383ea7['options']?_0x383ea7[_0x3f46('0x16')][_0x3f46('0x1d')]||null:null,'limit':_0x383ea7[_0x3f46('0x16')]?_0x383ea7['options'][_0x3f46('0x1e')]||null:null})[_0x3f46('0x9')](function(_0x5e5706){logger['info'](_0x3f46('0x19'),_0x383ea7);logger[_0x3f46('0xc')](_0x3f46('0x19'),_0x383ea7,JSON['stringify'](_0x5e5706));_0x5ec832(_0x5e5706);})['catch'](function(_0x499a85){logger[_0x3f46('0xf')](_0x3f46('0x19'),_0x499a85['message'],_0x383ea7);_0x12d29d(_0x468e59[_0x3f46('0xf')](0x1f4,_0x499a85['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b2a0fee..84aa6da 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 _0x42d0=['/describe','describe','/:id','show','post','create','update','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x5e7b06,_0x48f427){var _0x3cd052=function(_0x3cb2a7){while(--_0x3cb2a7){_0x5e7b06['push'](_0x5e7b06['shift']());}};_0x3cd052(++_0x48f427);}(_0x42d0,0x105));var _0x042d=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x42d0[_0x186376];return _0x2dbdd9;};'use strict';var multer=require('multer');var util=require(_0x042d('0x0'));var path=require(_0x042d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x042d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x042d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x042d('0x4'));var controller=require(_0x042d('0x5'));router[_0x042d('0x6')]('/',auth[_0x042d('0x7')](),controller[_0x042d('0x8')]);router[_0x042d('0x6')](_0x042d('0x9'),auth['isAuthenticated'](),controller[_0x042d('0xa')]);router['get'](_0x042d('0xb'),auth['isAuthenticated'](),controller[_0x042d('0xc')]);router[_0x042d('0xd')]('/',auth[_0x042d('0x7')](),controller[_0x042d('0xe')]);router['put'](_0x042d('0xb'),auth[_0x042d('0x7')](),controller[_0x042d('0xf')]);router['delete']('/:id',auth[_0x042d('0x7')](),controller[_0x042d('0x10')]);module[_0x042d('0x11')]=router; \ No newline at end of file +var _0x1228=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','/:id','delete','destroy','exports','multer'];(function(_0x1f59c8,_0xf17df8){var _0x1a90a3=function(_0x533b5f){while(--_0x533b5f){_0x1f59c8['push'](_0x1f59c8['shift']());}};_0x1a90a3(++_0xf17df8);}(_0x1228,0x1c7));var _0x8122=function(_0x50c12f,_0x28e72b){_0x50c12f=_0x50c12f-0x0;var _0x544cb6=_0x1228[_0x50c12f];return _0x544cb6;};'use strict';var multer=require(_0x8122('0x0'));var util=require(_0x8122('0x1'));var path=require(_0x8122('0x2'));var timeout=require('connect-timeout');var express=require(_0x8122('0x3'));var router=express[_0x8122('0x4')]();var fs_extra=require(_0x8122('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8122('0x6'));var config=require(_0x8122('0x7'));var controller=require('./squareReportDetail.controller');router[_0x8122('0x8')]('/',auth[_0x8122('0x9')](),controller[_0x8122('0xa')]);router[_0x8122('0x8')](_0x8122('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8122('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8122('0xc')]);router[_0x8122('0xd')]('/',auth[_0x8122('0x9')](),controller[_0x8122('0xe')]);router['put'](_0x8122('0xf'),auth[_0x8122('0x9')](),controller['update']);router[_0x8122('0x10')](_0x8122('0xf'),auth[_0x8122('0x9')](),controller[_0x8122('0x11')]);module[_0x8122('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 677a9f9..07e8a33 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 _0xe4e4=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4e4,0x17f));var _0x4e4e=function(_0x1fa0f9,_0x1e1ab0){_0x1fa0f9=_0x1fa0f9-0x0;var _0x466457=_0xe4e4[_0x1fa0f9];return _0x466457;};'use strict';var Sequelize=require(_0x4e4e('0x0'));module[_0x4e4e('0x1')]={'uniqueid':{'type':Sequelize[_0x4e4e('0x2')]},'node':{'type':Sequelize[_0x4e4e('0x2')]},'application':{'type':Sequelize[_0x4e4e('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4e4e('0x2')]}}; \ No newline at end of file +var _0xde60=['STRING','TEXT','sequelize','exports'];(function(_0x4521e3,_0x10a8a4){var _0x46a272=function(_0x2f4c64){while(--_0x2f4c64){_0x4521e3['push'](_0x4521e3['shift']());}};_0x46a272(++_0x10a8a4);}(_0xde60,0x18a));var _0x0de6=function(_0x2373f5,_0x55fbde){_0x2373f5=_0x2373f5-0x0;var _0x31cf35=_0xde60[_0x2373f5];return _0x31cf35;};'use strict';var Sequelize=require(_0x0de6('0x0'));module[_0x0de6('0x1')]={'uniqueid':{'type':Sequelize[_0x0de6('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x0de6('0x3')]},'project_name':{'type':Sequelize[_0x0de6('0x2')]},'callerid':{'type':Sequelize[_0x0de6('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f455868..85cb2ff 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 _0x8264=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','SquareDetailsReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x53955a,_0x1177fd){var _0x146e46=function(_0x5b1535){while(--_0x5b1535){_0x53955a['push'](_0x53955a['shift']());}};_0x146e46(++_0x1177fd);}(_0x8264,0x1ae));var _0x4826=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0x8264[_0x4ba380];return _0x4b111b;};'use strict';var emlformat=require(_0x4826('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4826('0x1'));var jsonpatch=require(_0x4826('0x2'));var rp=require(_0x4826('0x3'));var moment=require(_0x4826('0x4'));var BPromise=require(_0x4826('0x5'));var Mustache=require(_0x4826('0x6'));var util=require(_0x4826('0x7'));var path=require(_0x4826('0x8'));var sox=require(_0x4826('0x9'));var csv=require(_0x4826('0xa'));var ejs=require(_0x4826('0xb'));var fs=require('fs');var fs_extra=require(_0x4826('0xc'));var _=require(_0x4826('0xd'));var squel=require(_0x4826('0xe'));var crypto=require(_0x4826('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4826('0xa'));var querystring=require(_0x4826('0x10'));var Papa=require('papaparse');var Redis=require(_0x4826('0x11'));var authService=require(_0x4826('0x12'));var qs=require(_0x4826('0x13'));var as=require(_0x4826('0x14'));var hardwareService=require(_0x4826('0x15'));var logger=require(_0x4826('0x16'))(_0x4826('0x17'));var utils=require(_0x4826('0x18'));var config=require(_0x4826('0x19'));var licenseUtil=require(_0x4826('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13e2c1,_0x3fb8e4){_0x3fb8e4=_0x3fb8e4||0xcc;return function(_0x3ddfb1){if(_0x3ddfb1){return _0x13e2c1[_0x4826('0x1b')](_0x3fb8e4);}return _0x13e2c1[_0x4826('0x1c')](_0x3fb8e4)[_0x4826('0x1d')]();};}function respondWithResult(_0xcc1b2a,_0x5275a0){_0x5275a0=_0x5275a0||0xc8;return function(_0x363514){if(_0x363514){return _0xcc1b2a[_0x4826('0x1c')](_0x5275a0)[_0x4826('0x1e')](_0x363514);}};}function respondWithFilteredResult(_0x28a678,_0x4e503d){return function(_0x5d40fe){if(_0x5d40fe){var _0x29a97a=typeof _0x4e503d[_0x4826('0x1f')]===_0x4826('0x20')&&typeof _0x4e503d[_0x4826('0x21')]===_0x4826('0x20');var _0x351dd2=_0x5d40fe[_0x4826('0x22')];var _0x2e1c69=_0x29a97a?0x0:_0x4e503d['offset'];var _0x521192=_0x29a97a?_0x5d40fe[_0x4826('0x22')]:_0x4e503d[_0x4826('0x1f')]+_0x4e503d[_0x4826('0x21')];var _0x259d0f;if(_0x521192>=_0x351dd2){_0x521192=_0x351dd2;_0x259d0f=0xc8;}else{_0x259d0f=0xce;}_0x28a678[_0x4826('0x1c')](_0x259d0f);return _0x28a678[_0x4826('0x23')]('Content-Range',_0x2e1c69+'-'+_0x521192+'/'+_0x351dd2)[_0x4826('0x1e')](_0x5d40fe);}return null;};}function patchUpdates(_0x4d73ee){return function(_0xd53c3f){try{jsonpatch[_0x4826('0x24')](_0xd53c3f,_0x4d73ee,!![]);}catch(_0x529d24){return BPromise[_0x4826('0x25')](_0x529d24);}return _0xd53c3f[_0x4826('0x26')]();};}function saveUpdates(_0x27b10e,_0x371768){return function(_0x5ed3d0){if(_0x5ed3d0){return _0x5ed3d0[_0x4826('0x27')](_0x27b10e)[_0x4826('0x28')](function(_0x320ec5){return _0x320ec5;});}return null;};}function removeEntity(_0x5b6b9c,_0x871da9){return function(_0x2d92b1){if(_0x2d92b1){return _0x2d92b1[_0x4826('0x29')]()[_0x4826('0x28')](function(){_0x5b6b9c[_0x4826('0x1c')](0xcc)[_0x4826('0x1d')]();});}};}function handleEntityNotFound(_0x199c58,_0x130d6a){return function(_0x5a6704){if(!_0x5a6704){_0x199c58[_0x4826('0x1b')](0x194);}return _0x5a6704;};}function handleError(_0x5c9a01,_0x28153c){_0x28153c=_0x28153c||0x1f4;return function(_0xd4d5b4){logger[_0x4826('0x2a')](_0xd4d5b4['stack']);if(_0xd4d5b4[_0x4826('0x2b')]){delete _0xd4d5b4[_0x4826('0x2b')];}_0x5c9a01['status'](_0x28153c)[_0x4826('0x2c')](_0xd4d5b4);};}exports['index']=function(_0x250429,_0x154d87){var _0xeb5dbd={},_0x43fa35={},_0x483311={'count':0x0,'rows':[]};var _0x13df78=_[_0x4826('0x2d')](db[_0x4826('0x2e')][_0x4826('0x2f')],function(_0x1f250e){return{'name':_0x1f250e['fieldName'],'type':_0x1f250e[_0x4826('0x30')][_0x4826('0x31')]};});_0x43fa35[_0x4826('0x32')]=_[_0x4826('0x2d')](_0x13df78,_0x4826('0x2b'));_0x43fa35['query']=_[_0x4826('0x33')](_0x250429[_0x4826('0x34')]);_0x43fa35[_0x4826('0x35')]=_[_0x4826('0x36')](_0x43fa35['model'],_0x43fa35[_0x4826('0x34')]);_0xeb5dbd[_0x4826('0x37')]=_[_0x4826('0x36')](_0x43fa35[_0x4826('0x32')],qs[_0x4826('0x38')](_0x250429['query']['fields']));_0xeb5dbd[_0x4826('0x37')]=_0xeb5dbd[_0x4826('0x37')][_0x4826('0x39')]?_0xeb5dbd[_0x4826('0x37')]:_0x43fa35[_0x4826('0x32')];if(!_0x250429[_0x4826('0x34')][_0x4826('0x3a')](_0x4826('0x3b'))){_0xeb5dbd[_0x4826('0x21')]=qs['limit'](_0x250429[_0x4826('0x34')][_0x4826('0x21')]);_0xeb5dbd['offset']=qs[_0x4826('0x1f')](_0x250429[_0x4826('0x34')][_0x4826('0x1f')]);}_0xeb5dbd['order']=qs[_0x4826('0x3c')](_0x250429[_0x4826('0x34')][_0x4826('0x3c')]);_0xeb5dbd[_0x4826('0x3d')]=qs['filters'](_[_0x4826('0x3e')](_0x250429[_0x4826('0x34')],_0x43fa35['filters']),_0x13df78);if(_0x250429['query'][_0x4826('0x3f')]){_0xeb5dbd['where']=_[_0x4826('0x40')](_0xeb5dbd[_0x4826('0x3d')],{'$or':_[_0x4826('0x2d')](_0x13df78,function(_0xa718f9){if(_0xa718f9['type']!==_0x4826('0x41')){var _0x2a391a={};_0x2a391a[_0xa718f9[_0x4826('0x2b')]]={'$like':'%'+_0x250429[_0x4826('0x34')]['filter']+'%'};return _0x2a391a;}})});}_0xeb5dbd=_['merge']({},_0xeb5dbd,_0x250429['options']);var _0x4221a4={'where':_0xeb5dbd[_0x4826('0x3d')]};return db[_0x4826('0x2e')][_0x4826('0x22')](_0x4221a4)['then'](function(_0x2d04ab){_0x483311[_0x4826('0x22')]=_0x2d04ab;if(_0x250429[_0x4826('0x34')][_0x4826('0x42')]){_0xeb5dbd['include']=[{'all':!![]}];}return db[_0x4826('0x2e')][_0x4826('0x43')](_0xeb5dbd);})[_0x4826('0x28')](function(_0xd01961){_0x483311['rows']=_0xd01961;return _0x483311;})[_0x4826('0x28')](respondWithFilteredResult(_0x154d87,_0xeb5dbd))[_0x4826('0x44')](handleError(_0x154d87,null));};exports[_0x4826('0x45')]=function(_0x554a97,_0x2983b7){var _0x3745f4={'raw':!![],'where':{'id':_0x554a97[_0x4826('0x46')]['id']}},_0x3e6a38={};_0x3e6a38[_0x4826('0x32')]=_[_0x4826('0x33')](db[_0x4826('0x2e')][_0x4826('0x2f')]);_0x3e6a38[_0x4826('0x34')]=_[_0x4826('0x33')](_0x554a97[_0x4826('0x34')]);_0x3e6a38[_0x4826('0x35')]=_[_0x4826('0x36')](_0x3e6a38[_0x4826('0x32')],_0x3e6a38[_0x4826('0x34')]);_0x3745f4[_0x4826('0x37')]=_[_0x4826('0x36')](_0x3e6a38[_0x4826('0x32')],qs[_0x4826('0x38')](_0x554a97[_0x4826('0x34')][_0x4826('0x38')]));_0x3745f4[_0x4826('0x37')]=_0x3745f4[_0x4826('0x37')][_0x4826('0x39')]?_0x3745f4[_0x4826('0x37')]:_0x3e6a38[_0x4826('0x32')];if(_0x554a97[_0x4826('0x34')]['includeAll']){_0x3745f4[_0x4826('0x47')]=[{'all':!![]}];}_0x3745f4=_[_0x4826('0x40')]({},_0x3745f4,_0x554a97['options']);return db[_0x4826('0x2e')][_0x4826('0x48')](_0x3745f4)['then'](handleEntityNotFound(_0x2983b7,null))['then'](respondWithResult(_0x2983b7,null))[_0x4826('0x44')](handleError(_0x2983b7,null));};exports[_0x4826('0x49')]=function(_0x1dde14,_0x4cc9fe){return db[_0x4826('0x2e')][_0x4826('0x49')](_0x1dde14[_0x4826('0x4a')],{})[_0x4826('0x28')](respondWithResult(_0x4cc9fe,0xc9))['catch'](handleError(_0x4cc9fe,null));};exports[_0x4826('0x27')]=function(_0x30f6d2,_0x2cfe39){if(_0x30f6d2['body']['id']){delete _0x30f6d2['body']['id'];}return db[_0x4826('0x2e')][_0x4826('0x48')]({'where':{'id':_0x30f6d2[_0x4826('0x46')]['id']}})[_0x4826('0x28')](handleEntityNotFound(_0x2cfe39,null))[_0x4826('0x28')](saveUpdates(_0x30f6d2[_0x4826('0x4a')],null))[_0x4826('0x28')](respondWithResult(_0x2cfe39,null))[_0x4826('0x44')](handleError(_0x2cfe39,null));};exports[_0x4826('0x29')]=function(_0x1845ff,_0x1ad1ae){return db[_0x4826('0x2e')][_0x4826('0x48')]({'where':{'id':_0x1845ff[_0x4826('0x46')]['id']}})[_0x4826('0x28')](handleEntityNotFound(_0x1ad1ae,null))[_0x4826('0x28')](removeEntity(_0x1ad1ae,null))[_0x4826('0x44')](handleError(_0x1ad1ae,null));};exports['describe']=function(_0x2d5cf9,_0x139e1f){return db['SquareDetailsReport'][_0x4826('0x4b')]()[_0x4826('0x28')](respondWithResult(_0x139e1f,null))['catch'](handleError(_0x139e1f,null));}; \ No newline at end of file +var _0xbbbd=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','destroy','then','error','name','map','SquareDetailsReport','fieldName','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x464e9b,_0x4c2aaa){var _0x20f0e2=function(_0x111193){while(--_0x111193){_0x464e9b['push'](_0x464e9b['shift']());}};_0x20f0e2(++_0x4c2aaa);}(_0xbbbd,0x1d3));var _0xdbbb=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xbbbd[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0xdbbb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbbb('0x1'));var jsonpatch=require(_0xdbbb('0x2'));var rp=require(_0xdbbb('0x3'));var moment=require(_0xdbbb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbbb('0x5'));var util=require(_0xdbbb('0x6'));var path=require(_0xdbbb('0x7'));var sox=require(_0xdbbb('0x8'));var csv=require(_0xdbbb('0x9'));var ejs=require(_0xdbbb('0xa'));var fs=require('fs');var fs_extra=require(_0xdbbb('0xb'));var _=require('lodash');var squel=require(_0xdbbb('0xc'));var crypto=require(_0xdbbb('0xd'));var jsforce=require(_0xdbbb('0xe'));var deskjs=require(_0xdbbb('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdbbb('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdbbb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdbbb('0x12'));var config=require(_0xdbbb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbbb('0x14'))['db'];function respondWithStatusCode(_0x105fd0,_0x19f328){_0x19f328=_0x19f328||0xcc;return function(_0x4820e7){if(_0x4820e7){return _0x105fd0[_0xdbbb('0x15')](_0x19f328);}return _0x105fd0[_0xdbbb('0x16')](_0x19f328)[_0xdbbb('0x17')]();};}function respondWithResult(_0x14a7c0,_0x1b04eb){_0x1b04eb=_0x1b04eb||0xc8;return function(_0x447669){if(_0x447669){return _0x14a7c0[_0xdbbb('0x16')](_0x1b04eb)[_0xdbbb('0x18')](_0x447669);}};}function respondWithFilteredResult(_0x2c7488,_0x2be9c1){return function(_0x1b3b67){if(_0x1b3b67){var _0x50404f=typeof _0x2be9c1[_0xdbbb('0x19')]==='undefined'&&typeof _0x2be9c1['limit']===_0xdbbb('0x1a');var _0x1f3639=_0x1b3b67[_0xdbbb('0x1b')];var _0x29e207=_0x50404f?0x0:_0x2be9c1[_0xdbbb('0x19')];var _0x57e00c=_0x50404f?_0x1b3b67[_0xdbbb('0x1b')]:_0x2be9c1[_0xdbbb('0x19')]+_0x2be9c1['limit'];var _0x577a4a;if(_0x57e00c>=_0x1f3639){_0x57e00c=_0x1f3639;_0x577a4a=0xc8;}else{_0x577a4a=0xce;}_0x2c7488[_0xdbbb('0x16')](_0x577a4a);return _0x2c7488['set']('Content-Range',_0x29e207+'-'+_0x57e00c+'/'+_0x1f3639)[_0xdbbb('0x18')](_0x1b3b67);}return null;};}function patchUpdates(_0x1fe212){return function(_0x367b07){try{jsonpatch[_0xdbbb('0x1c')](_0x367b07,_0x1fe212,!![]);}catch(_0xc019ea){return BPromise[_0xdbbb('0x1d')](_0xc019ea);}return _0x367b07[_0xdbbb('0x1e')]();};}function saveUpdates(_0x299d93,_0x343e40){return function(_0x3c2c85){if(_0x3c2c85){return _0x3c2c85[_0xdbbb('0x1f')](_0x299d93)['then'](function(_0x79e597){return _0x79e597;});}return null;};}function removeEntity(_0xea765f,_0x5e2ff0){return function(_0x2dc7d6){if(_0x2dc7d6){return _0x2dc7d6[_0xdbbb('0x20')]()[_0xdbbb('0x21')](function(){_0xea765f[_0xdbbb('0x16')](0xcc)[_0xdbbb('0x17')]();});}};}function handleEntityNotFound(_0x559071,_0x13ca90){return function(_0x40c793){if(!_0x40c793){_0x559071[_0xdbbb('0x15')](0x194);}return _0x40c793;};}function handleError(_0x4e596b,_0x297272){_0x297272=_0x297272||0x1f4;return function(_0x356801){logger[_0xdbbb('0x22')](_0x356801['stack']);if(_0x356801['name']){delete _0x356801[_0xdbbb('0x23')];}_0x4e596b[_0xdbbb('0x16')](_0x297272)['send'](_0x356801);};}exports['index']=function(_0x90166a,_0x512fa4){var _0x76a5e5={},_0x583d51={},_0x89e26e={'count':0x0,'rows':[]};var _0x4ebd98=_[_0xdbbb('0x24')](db[_0xdbbb('0x25')]['rawAttributes'],function(_0x4fa4e9){return{'name':_0x4fa4e9[_0xdbbb('0x26')],'type':_0x4fa4e9['type'][_0xdbbb('0x27')]};});_0x583d51['model']=_[_0xdbbb('0x24')](_0x4ebd98,'name');_0x583d51[_0xdbbb('0x28')]=_[_0xdbbb('0x29')](_0x90166a[_0xdbbb('0x28')]);_0x583d51['filters']=_['intersection'](_0x583d51[_0xdbbb('0x2a')],_0x583d51[_0xdbbb('0x28')]);_0x76a5e5[_0xdbbb('0x2b')]=_[_0xdbbb('0x2c')](_0x583d51[_0xdbbb('0x2a')],qs[_0xdbbb('0x2d')](_0x90166a[_0xdbbb('0x28')]['fields']));_0x76a5e5[_0xdbbb('0x2b')]=_0x76a5e5[_0xdbbb('0x2b')]['length']?_0x76a5e5[_0xdbbb('0x2b')]:_0x583d51[_0xdbbb('0x2a')];if(!_0x90166a[_0xdbbb('0x28')][_0xdbbb('0x2e')](_0xdbbb('0x2f'))){_0x76a5e5[_0xdbbb('0x30')]=qs[_0xdbbb('0x30')](_0x90166a[_0xdbbb('0x28')]['limit']);_0x76a5e5['offset']=qs['offset'](_0x90166a[_0xdbbb('0x28')]['offset']);}_0x76a5e5[_0xdbbb('0x31')]=qs[_0xdbbb('0x32')](_0x90166a[_0xdbbb('0x28')][_0xdbbb('0x32')]);_0x76a5e5[_0xdbbb('0x33')]=qs[_0xdbbb('0x34')](_[_0xdbbb('0x35')](_0x90166a[_0xdbbb('0x28')],_0x583d51[_0xdbbb('0x34')]),_0x4ebd98);if(_0x90166a['query'][_0xdbbb('0x36')]){_0x76a5e5[_0xdbbb('0x33')]=_[_0xdbbb('0x37')](_0x76a5e5['where'],{'$or':_[_0xdbbb('0x24')](_0x4ebd98,function(_0x5e636d){if(_0x5e636d['type']!==_0xdbbb('0x38')){var _0x1212fc={};_0x1212fc[_0x5e636d['name']]={'$like':'%'+_0x90166a['query'][_0xdbbb('0x36')]+'%'};return _0x1212fc;}})});}_0x76a5e5=_['merge']({},_0x76a5e5,_0x90166a[_0xdbbb('0x39')]);var _0x3c4c0d={'where':_0x76a5e5[_0xdbbb('0x33')]};return db['SquareDetailsReport'][_0xdbbb('0x1b')](_0x3c4c0d)[_0xdbbb('0x21')](function(_0x159b96){_0x89e26e['count']=_0x159b96;if(_0x90166a[_0xdbbb('0x28')][_0xdbbb('0x3a')]){_0x76a5e5[_0xdbbb('0x3b')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x76a5e5);})[_0xdbbb('0x21')](function(_0x514f4d){_0x89e26e[_0xdbbb('0x3c')]=_0x514f4d;return _0x89e26e;})[_0xdbbb('0x21')](respondWithFilteredResult(_0x512fa4,_0x76a5e5))['catch'](handleError(_0x512fa4,null));};exports[_0xdbbb('0x3d')]=function(_0x121daa,_0x2379a4){var _0x3700ce={'raw':!![],'where':{'id':_0x121daa[_0xdbbb('0x3e')]['id']}},_0x2fd9f4={};_0x2fd9f4[_0xdbbb('0x2a')]=_[_0xdbbb('0x29')](db[_0xdbbb('0x25')][_0xdbbb('0x3f')]);_0x2fd9f4[_0xdbbb('0x28')]=_[_0xdbbb('0x29')](_0x121daa[_0xdbbb('0x28')]);_0x2fd9f4[_0xdbbb('0x34')]=_['intersection'](_0x2fd9f4[_0xdbbb('0x2a')],_0x2fd9f4['query']);_0x3700ce[_0xdbbb('0x2b')]=_[_0xdbbb('0x2c')](_0x2fd9f4[_0xdbbb('0x2a')],qs['fields'](_0x121daa[_0xdbbb('0x28')]['fields']));_0x3700ce[_0xdbbb('0x2b')]=_0x3700ce[_0xdbbb('0x2b')]['length']?_0x3700ce[_0xdbbb('0x2b')]:_0x2fd9f4[_0xdbbb('0x2a')];if(_0x121daa[_0xdbbb('0x28')][_0xdbbb('0x3a')]){_0x3700ce[_0xdbbb('0x3b')]=[{'all':!![]}];}_0x3700ce=_[_0xdbbb('0x37')]({},_0x3700ce,_0x121daa[_0xdbbb('0x39')]);return db[_0xdbbb('0x25')][_0xdbbb('0x40')](_0x3700ce)[_0xdbbb('0x21')](handleEntityNotFound(_0x2379a4,null))[_0xdbbb('0x21')](respondWithResult(_0x2379a4,null))[_0xdbbb('0x41')](handleError(_0x2379a4,null));};exports[_0xdbbb('0x42')]=function(_0x354524,_0x34fcbb){return db['SquareDetailsReport'][_0xdbbb('0x42')](_0x354524[_0xdbbb('0x43')],{})[_0xdbbb('0x21')](respondWithResult(_0x34fcbb,0xc9))[_0xdbbb('0x41')](handleError(_0x34fcbb,null));};exports['update']=function(_0x5bce12,_0x2e00c6){if(_0x5bce12[_0xdbbb('0x43')]['id']){delete _0x5bce12['body']['id'];}return db[_0xdbbb('0x25')][_0xdbbb('0x40')]({'where':{'id':_0x5bce12[_0xdbbb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2e00c6,null))[_0xdbbb('0x21')](saveUpdates(_0x5bce12[_0xdbbb('0x43')],null))[_0xdbbb('0x21')](respondWithResult(_0x2e00c6,null))[_0xdbbb('0x41')](handleError(_0x2e00c6,null));};exports[_0xdbbb('0x20')]=function(_0x1dacbd,_0x2165d0){return db['SquareDetailsReport'][_0xdbbb('0x40')]({'where':{'id':_0x1dacbd[_0xdbbb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2165d0,null))[_0xdbbb('0x21')](removeEntity(_0x2165d0,null))[_0xdbbb('0x41')](handleError(_0x2165d0,null));};exports['describe']=function(_0x474438,_0x2ecd09){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x2ecd09,null))[_0xdbbb('0x41')](handleError(_0x2ecd09,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 41f08ae..3e11a1d 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 _0x3253=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x3253,0x173));var _0x3325=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x3253[_0x5fe69a];return _0x3f1aee;};'use strict';var _=require(_0x3325('0x0'));var util=require(_0x3325('0x1'));var logger=require(_0x3325('0x2'))(_0x3325('0x3'));var moment=require(_0x3325('0x4'));var BPromise=require(_0x3325('0x5'));var rp=require(_0x3325('0x6'));var fs=require('fs');var path=require(_0x3325('0x7'));var rimraf=require(_0x3325('0x8'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x3325('0x9')]=function(_0x59f81e,_0x1cfbb9){return _0x59f81e['define'](_0x3325('0xa'),attributes,{'tableName':_0x3325('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7cc=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4d2e3e,_0x5d18f8){var _0x119a62=function(_0x2fc89d){while(--_0x2fc89d){_0x4d2e3e['push'](_0x4d2e3e['shift']());}};_0x119a62(++_0x5d18f8);}(_0xa7cc,0xfc));var _0xca7c=function(_0x453a74,_0x21e3da){_0x453a74=_0x453a74-0x0;var _0x10c069=_0xa7cc[_0x453a74];return _0x10c069;};'use strict';var _=require(_0xca7c('0x0'));var util=require(_0xca7c('0x1'));var logger=require(_0xca7c('0x2'))(_0xca7c('0x3'));var moment=require(_0xca7c('0x4'));var BPromise=require('bluebird');var rp=require(_0xca7c('0x5'));var fs=require('fs');var path=require(_0xca7c('0x6'));var rimraf=require('rimraf');var config=require(_0xca7c('0x7'));var attributes=require(_0xca7c('0x8'));module[_0xca7c('0x9')]=function(_0x1a284c,_0x1036a3){return _0x1a284c[_0xca7c('0xa')](_0xca7c('0xb'),attributes,{'tableName':_0xca7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index de951fa..e2f8d10 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 _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(_0x24703f,_0x2669d3){var _0x2dc703=function(_0x4b6b90){while(--_0x4b6b90){_0x24703f['push'](_0x24703f['shift']());}};_0x2dc703(++_0x2669d3);}(_0xefda,0x96));var _0xaefd=function(_0x2ca692,_0x19574a){_0x2ca692=_0x2ca692-0x0;var _0x151bbe=_0xefda[_0x2ca692];return _0x151bbe;};'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 +var _0x5713=['SquareDetailsReport','create','body','options','raw','stringify','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport'];(function(_0x39428c,_0x34b23a){var _0x52d069=function(_0x394962){while(--_0x394962){_0x39428c['push'](_0x39428c['shift']());}};_0x52d069(++_0x34b23a);}(_0x5713,0x1c7));var _0x3571=function(_0x39760b,_0x496d85){_0x39760b=_0x39760b-0x0;var _0x10c303=_0x5713[_0x39760b];return _0x10c303;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var moment=require('moment');var BPromise=require(_0x3571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3571('0x3'));var db=require(_0x3571('0x4'))['db'];var utils=require(_0x3571('0x5'));var logger=require(_0x3571('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3571('0x7'));var client=jayson[_0x3571('0x8')][_0x3571('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432a48,_0x3a6f29,_0x1f8f0f){return new BPromise(function(_0x48b06d,_0x358ba1){return client[_0x3571('0xa')](_0x432a48,_0x1f8f0f)[_0x3571('0xb')](function(_0x288fc8){logger[_0x3571('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3a6f29,'request\x20sent');logger[_0x3571('0xd')](_0x3571('0xe'),_0x3a6f29,_0x3571('0xf'),JSON['stringify'](_0x288fc8));if(_0x288fc8['error']){if(_0x288fc8['error']['code']===0x1f4){logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x358ba1(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x48b06d(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}else{logger[_0x3571('0xc')](_0x3571('0x11'),_0x3a6f29,_0x3571('0xf'));_0x48b06d(_0x288fc8[_0x3571('0x13')]['message']);}})['catch'](function(_0x48c77e){logger[_0x3571('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x3a6f29,_0x48c77e);_0x358ba1(_0x48c77e);});});}exports[_0x3571('0x14')]=function(_0x37881f){var _0x4b745a=this;return new Promise(function(_0x22a418,_0xab19b1){return db[_0x3571('0x15')][_0x3571('0x16')](_0x37881f[_0x3571('0x17')],{'raw':_0x37881f[_0x3571('0x18')]?_0x37881f['options'][_0x3571('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1cdda8){logger[_0x3571('0xc')]('CreateSquareDetailsReport',_0x37881f);logger['debug']('CreateSquareDetailsReport',_0x37881f,JSON[_0x3571('0x1a')](_0x1cdda8));_0x22a418(_0x1cdda8);})[_0x3571('0x1b')](function(_0xa6cd35){logger[_0x3571('0x10')](_0x3571('0x14'),_0xa6cd35['message'],_0x37881f);_0xab19b1(_0x4b745a[_0x3571('0x10')](0x1f4,_0xa6cd35[_0x3571('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ae5bea1..8551621 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 _0x49b0=['get','isAuthenticated','index','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x2a2631,_0x493162){var _0x30a716=function(_0x4b01ec){while(--_0x4b01ec){_0x2a2631['push'](_0x2a2631['shift']());}};_0x30a716(++_0x493162);}(_0x49b0,0x1be));var _0x049b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x49b0[_0x4565bf];return _0x5610ba;};'use strict';var express=require(_0x049b('0x0'));var router=express[_0x049b('0x1')]();var auth=require(_0x049b('0x2'));var controller=require(_0x049b('0x3'));router[_0x049b('0x4')]('/',auth[_0x049b('0x5')](),controller[_0x049b('0x6')]);router[_0x049b('0x4')](_0x049b('0x7'),auth['isAuthenticated'](),controller['killProcess']);module[_0x049b('0x8')]=router; \ No newline at end of file +var _0x164f=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','Router','../../components/auth/service'];(function(_0x2e69c4,_0x2b2db9){var _0x1a594f=function(_0x5b5efe){while(--_0x5b5efe){_0x2e69c4['push'](_0x2e69c4['shift']());}};_0x1a594f(++_0x2b2db9);}(_0x164f,0x18a));var _0xf164=function(_0x4551a5,_0x316289){_0x4551a5=_0x4551a5-0x0;var _0x5c7c71=_0x164f[_0x4551a5];return _0x5c7c71;};'use strict';var express=require('express');var router=express[_0xf164('0x0')]();var auth=require(_0xf164('0x1'));var controller=require(_0xf164('0x2'));router[_0xf164('0x3')]('/',auth['isAuthenticated'](),controller[_0xf164('0x4')]);router[_0xf164('0x3')](_0xf164('0x5'),auth[_0xf164('0x6')](),controller[_0xf164('0x7')]);module[_0xf164('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ef7dc91..c995c37 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 _0xf6bb=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT'];(function(_0x18dcdf,_0x41808c){var _0x34a6b4=function(_0x23c0f9){while(--_0x23c0f9){_0x18dcdf['push'](_0x18dcdf['shift']());}};_0x34a6b4(++_0x41808c);}(_0xf6bb,0x1e1));var _0xbf6b=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0xf6bb[_0x5f0501];return _0x3c2c45;};'use strict';var info=require(_0xbf6b('0x0'));var exec=require(_0xbf6b('0x1'))[_0xbf6b('0x2')];var logger=require(_0xbf6b('0x3'))(_0xbf6b('0x4'));var util=require(_0xbf6b('0x5'));var BPromise=require(_0xbf6b('0x6'));var _=require(_0xbf6b('0x7'));function handleError(_0x5e8475,_0x45ec8f,_0x1d0041){_0x45ec8f=_0x45ec8f||0x1f4;return function(_0x32bc14){logger[_0xbf6b('0x8')](_0xbf6b('0x9'),_0x1d0041,_0x45ec8f,util[_0xbf6b('0xa')](_0x32bc14,{'showHidden':![],'depth':null}));delete _0x32bc14[_0xbf6b('0xb')];_0x5e8475[_0xbf6b('0xc')](_0x45ec8f)['send'](_0x32bc14);};}exports[_0xbf6b('0xd')]=function(_0x154e10,_0x17ad38){return info[_0xbf6b('0xe')]()[_0xbf6b('0xf')](function(_0x461334){return _0x17ad38[_0xbf6b('0xc')](0xc8)[_0xbf6b('0x10')](_0x461334);})[_0xbf6b('0x11')](function(_0x1ae35b){return _0x17ad38[_0xbf6b('0xc')](0x1f4)[_0xbf6b('0x10')](_0x1ae35b);});};exports[_0xbf6b('0x12')]=function(_0x4e1e8c,_0x3e7e48){var _0x5e2f28=[_0xbf6b('0x13')];return new BPromise(function(_0x3cd1a8,_0x6d1f06){return exec(util[_0xbf6b('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4e1e8c[_0xbf6b('0x15')]['pid']),function(_0x1e7579,_0x16de7f,_0xab7505){if(_0x1e7579){return _0x6d1f06(_0x1e7579);}return _0x3cd1a8(_0x16de7f);});})[_0xbf6b('0xf')](function(_0xb194d4){var _0x1fa17e=![];var _0x1647fd=_0xb194d4[_0xbf6b('0x16')](/\n/);for(var _0x23afa8=0x0,_0x4286b3=_0x5e2f28[_0xbf6b('0x17')];_0x23afa8<_0x4286b3,_0x1fa17e===![];_0x23afa8+=0x1){if(_0xb194d4[_0xbf6b('0x18')](_0x5e2f28[_0x23afa8])>=0x0){_0x1fa17e=!![];}}if(!_0x1fa17e){throw new Error(util[_0xbf6b('0x14')](_0xbf6b('0x19'),_0x4e1e8c[_0xbf6b('0x15')][_0xbf6b('0x1a')]));}process[_0xbf6b('0x1b')](_0x4e1e8c[_0xbf6b('0x15')][_0xbf6b('0x1a')],_0xbf6b('0x1c'));return _0x3e7e48[_0xbf6b('0xc')](0xc8)['json']({'message':util['format'](_0xbf6b('0x1d'),_0x4e1e8c['params'][_0xbf6b('0x1a')])});})[_0xbf6b('0x11')](handleError(_0x3e7e48,null,_0xbf6b('0x12')));}; \ No newline at end of file +var _0x79d8=['exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process'];(function(_0x4d06b9,_0x4d0574){var _0x1eb7c9=function(_0x54f796){while(--_0x54f796){_0x4d06b9['push'](_0x4d06b9['shift']());}};_0x1eb7c9(++_0x4d0574);}(_0x79d8,0xe9));var _0x879d=function(_0x38aa8c,_0x51d7b3){_0x38aa8c=_0x38aa8c-0x0;var _0x3e43ac=_0x79d8[_0x38aa8c];return _0x3e43ac;};'use strict';var info=require('systeminformation');var exec=require(_0x879d('0x0'))[_0x879d('0x1')];var logger=require(_0x879d('0x2'))(_0x879d('0x3'));var util=require(_0x879d('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x37c614,_0x5e08d8,_0x5bc0e7){_0x5e08d8=_0x5e08d8||0x1f4;return function(_0x24cef9){logger[_0x879d('0x5')](_0x879d('0x6'),_0x5bc0e7,_0x5e08d8,util[_0x879d('0x7')](_0x24cef9,{'showHidden':![],'depth':null}));delete _0x24cef9[_0x879d('0x8')];_0x37c614[_0x879d('0x9')](_0x5e08d8)[_0x879d('0xa')](_0x24cef9);};}exports[_0x879d('0xb')]=function(_0x20d436,_0x27c3e5){return info['getAllData']()['then'](function(_0x4112c7){return _0x27c3e5[_0x879d('0x9')](0xc8)[_0x879d('0xc')](_0x4112c7);})['catch'](function(_0xb7a793){return _0x27c3e5[_0x879d('0x9')](0x1f4)[_0x879d('0xc')](_0xb7a793);});};exports[_0x879d('0xd')]=function(_0x31b365,_0x290669){var _0x313fec=[_0x879d('0xe')];return new BPromise(function(_0x186b52,_0x2d56da){return exec(util['format'](_0x879d('0xf'),_0x31b365['params'][_0x879d('0x10')]),function(_0x1bdc07,_0x2c3da8,_0x5bcc77){if(_0x1bdc07){return _0x2d56da(_0x1bdc07);}return _0x186b52(_0x2c3da8);});})[_0x879d('0x11')](function(_0x4c1c13){var _0x350221=![];var _0x1029c6=_0x4c1c13[_0x879d('0x12')](/\n/);for(var _0x2d2f23=0x0,_0x270948=_0x313fec[_0x879d('0x13')];_0x2d2f23<_0x270948,_0x350221===![];_0x2d2f23+=0x1){if(_0x4c1c13['indexOf'](_0x313fec[_0x2d2f23])>=0x0){_0x350221=!![];}}if(!_0x350221){throw new Error(util[_0x879d('0x14')](_0x879d('0x15'),_0x31b365[_0x879d('0x16')]['pid']));}process[_0x879d('0x17')](_0x31b365[_0x879d('0x16')][_0x879d('0x10')],'SIGINT');return _0x290669[_0x879d('0x9')](0xc8)['json']({'message':util[_0x879d('0x14')](_0x879d('0x18'),_0x31b365['params']['pid'])});})[_0x879d('0x19')](handleError(_0x290669,null,_0x879d('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5203051..5e62a58 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 _0xc25d=['connect-timeout','express','fs-extra','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/:id','show','update','delete','exports'];(function(_0x128fcd,_0x59568f){var _0x4811ad=function(_0x12643a){while(--_0x12643a){_0x128fcd['push'](_0x128fcd['shift']());}};_0x4811ad(++_0x59568f);}(_0xc25d,0x1ee));var _0xdc25=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xc25d[_0xb725be];return _0x2f2424;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdc25('0x0'));var express=require(_0xdc25('0x1'));var router=express['Router']();var fs_extra=require(_0xdc25('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xdc25('0x3'));var config=require('../../config/environment');var controller=require(_0xdc25('0x4'));router['get']('/',auth[_0xdc25('0x5')](),controller[_0xdc25('0x6')]);router[_0xdc25('0x7')](_0xdc25('0x8'),auth[_0xdc25('0x5')](),controller[_0xdc25('0x9')]);router['post']('/',auth[_0xdc25('0x5')](),controller['create']);router['put'](_0xdc25('0x8'),auth[_0xdc25('0x5')](),controller[_0xdc25('0xa')]);router[_0xdc25('0xb')]('/:id',auth[_0xdc25('0x5')](),controller['destroy']);module[_0xdc25('0xc')]=router; \ No newline at end of file +var _0x989b=['multer','util','path','express','Router','../../components/auth/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0xaab22e,_0x3bab3c){var _0x1cd2fa=function(_0x5620f2){while(--_0x5620f2){_0xaab22e['push'](_0xaab22e['shift']());}};_0x1cd2fa(++_0x3bab3c);}(_0x989b,0x198));var _0xb989=function(_0x55b680,_0x1411d1){_0x55b680=_0x55b680-0x0;var _0x34bbea=_0x989b[_0x55b680];return _0x34bbea;};'use strict';var multer=require(_0xb989('0x0'));var util=require(_0xb989('0x1'));var path=require(_0xb989('0x2'));var timeout=require('connect-timeout');var express=require(_0xb989('0x3'));var router=express[_0xb989('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb989('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb989('0x6'));router[_0xb989('0x7')]('/',auth[_0xb989('0x8')](),controller[_0xb989('0x9')]);router[_0xb989('0x7')](_0xb989('0xa'),auth[_0xb989('0x8')](),controller[_0xb989('0xb')]);router[_0xb989('0xc')]('/',auth['isAuthenticated'](),controller[_0xb989('0xd')]);router[_0xb989('0xe')](_0xb989('0xa'),auth[_0xb989('0x8')](),controller['update']);router[_0xb989('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb989('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b9e6c35..1b49c51 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 _0x5c00=['STRING','sequelize','exports'];(function(_0x957193,_0x3fec8b){var _0x9473f8=function(_0x34b82b){while(--_0x34b82b){_0x957193['push'](_0x957193['shift']());}};_0x9473f8(++_0x3fec8b);}(_0x5c00,0x17e));var _0x05c0=function(_0x3eceb2,_0x509ff8){_0x3eceb2=_0x3eceb2-0x0;var _0x818bc4=_0x5c00[_0x3eceb2];return _0x818bc4;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x0490=['STRING','exports'];(function(_0x5f2a3e,_0x4dfb33){var _0x35887f=function(_0x3618b4){while(--_0x3618b4){_0x5f2a3e['push'](_0x5f2a3e['shift']());}};_0x35887f(++_0x4dfb33);}(_0x0490,0x147));var _0x0049=function(_0x99e71,_0xed8ec5){_0x99e71=_0x99e71-0x0;var _0x34687c=_0x0490[_0x99e71];return _0x34687c;};'use strict';var Sequelize=require('sequelize');module[_0x0049('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x0049('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f75358a..739d5e9 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 _0x9c44=['update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','keys','include','find','catch','create','body','user','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x57f233,_0xfb0574){var _0x22ba63=function(_0x12d7f3){while(--_0x12d7f3){_0x57f233['push'](_0x57f233['shift']());}};_0x22ba63(++_0xfb0574);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){var _0x5850f2=_0x26c640[_0x49c4('0x24')]({'plain':!![]});var _0x9cb797='Tags';return db[_0x49c4('0x25')][_0x49c4('0x23')]({'where':{'type':_0x9cb797,'resourceId':_0x5850f2['id']}})[_0x49c4('0x26')](function(){return _0x26c640;});})[_0x49c4('0x26')](function(){_0x2263ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x449960,_0x53c199){return function(_0x3800b7){if(!_0x3800b7){_0x449960[_0x49c4('0x27')](0x194);}return _0x3800b7;};}function handleError(_0x3f1708,_0x372a47){_0x372a47=_0x372a47||0x1f4;return function(_0x5987ae){logger[_0x49c4('0x28')](_0x5987ae[_0x49c4('0x29')]);if(_0x5987ae[_0x49c4('0x2a')]){delete _0x5987ae[_0x49c4('0x2a')];}_0x3f1708[_0x49c4('0x16')](_0x372a47)[_0x49c4('0x2b')](_0x5987ae);};}exports[_0x49c4('0x2c')]=function(_0x427b26,_0x17b50f){var _0x2cbd88={},_0x46f7ea={},_0x4ea6ea={'count':0x0,'rows':[]};var _0x4f4495=_['map'](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x1eb035){return{'name':_0x1eb035[_0x49c4('0x2f')],'type':_0x1eb035[_0x49c4('0x30')]['key']};});_0x46f7ea[_0x49c4('0x31')]=_[_0x49c4('0x32')](_0x4f4495,_0x49c4('0x2a'));_0x46f7ea[_0x49c4('0x33')]=_['keys'](_0x427b26['query']);_0x46f7ea[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x46f7ea[_0x49c4('0x31')],_0x46f7ea[_0x49c4('0x33')]);_0x2cbd88[_0x49c4('0x36')]=_['intersection'](_0x46f7ea[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x427b26[_0x49c4('0x33')]['fields']));_0x2cbd88['attributes']=_0x2cbd88[_0x49c4('0x36')][_0x49c4('0x38')]?_0x2cbd88[_0x49c4('0x36')]:_0x46f7ea[_0x49c4('0x31')];if(!_0x427b26[_0x49c4('0x33')][_0x49c4('0x39')](_0x49c4('0x3a'))){_0x2cbd88[_0x49c4('0x1b')]=qs[_0x49c4('0x1b')](_0x427b26['query'][_0x49c4('0x1b')]);_0x2cbd88['offset']=qs[_0x49c4('0x19')](_0x427b26[_0x49c4('0x33')][_0x49c4('0x19')]);}_0x2cbd88[_0x49c4('0x3b')]=qs['sort'](_0x427b26[_0x49c4('0x33')][_0x49c4('0x3c')]);_0x2cbd88[_0x49c4('0x3d')]=qs['filters'](_[_0x49c4('0x3e')](_0x427b26[_0x49c4('0x33')],_0x46f7ea[_0x49c4('0x34')]),_0x4f4495);if(_0x427b26[_0x49c4('0x33')][_0x49c4('0x3f')]){_0x2cbd88[_0x49c4('0x3d')]=_[_0x49c4('0x40')](_0x2cbd88[_0x49c4('0x3d')],{'$or':_[_0x49c4('0x32')](_0x4f4495,function(_0x2f1105){if(_0x2f1105[_0x49c4('0x30')]!=='VIRTUAL'){var _0x2d2510={};_0x2d2510[_0x2f1105[_0x49c4('0x2a')]]={'$like':'%'+_0x427b26[_0x49c4('0x33')][_0x49c4('0x3f')]+'%'};return _0x2d2510;}})});}_0x2cbd88=_[_0x49c4('0x40')]({},_0x2cbd88,_0x427b26[_0x49c4('0x41')]);var _0x1be62d={'where':_0x2cbd88[_0x49c4('0x3d')]};return db[_0x49c4('0x2d')][_0x49c4('0x1c')](_0x1be62d)[_0x49c4('0x26')](function(_0xa3d59e){_0x4ea6ea[_0x49c4('0x1c')]=_0xa3d59e;if(_0x427b26['query'][_0x49c4('0x42')]){_0x2cbd88['include']=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x43')](_0x2cbd88);})[_0x49c4('0x26')](function(_0x1480da){_0x4ea6ea[_0x49c4('0x44')]=_0x1480da;return _0x4ea6ea;})[_0x49c4('0x26')](respondWithFilteredResult(_0x17b50f,_0x2cbd88))['catch'](handleError(_0x17b50f,null));};exports['show']=function(_0x20490b,_0x1e7bdc){var _0x38349b={'raw':!![],'where':{'id':_0x20490b['params']['id']}},_0x117151={};_0x117151[_0x49c4('0x31')]=_[_0x49c4('0x45')](db[_0x49c4('0x2d')][_0x49c4('0x2e')]);_0x117151[_0x49c4('0x33')]=_[_0x49c4('0x45')](_0x20490b[_0x49c4('0x33')]);_0x117151[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x117151['model'],_0x117151[_0x49c4('0x33')]);_0x38349b['attributes']=_[_0x49c4('0x35')](_0x117151[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x20490b[_0x49c4('0x33')][_0x49c4('0x37')]));_0x38349b['attributes']=_0x38349b[_0x49c4('0x36')][_0x49c4('0x38')]?_0x38349b[_0x49c4('0x36')]:_0x117151[_0x49c4('0x31')];if(_0x20490b[_0x49c4('0x33')][_0x49c4('0x42')]){_0x38349b[_0x49c4('0x46')]=[{'all':!![]}];}_0x38349b=_['merge']({},_0x38349b,_0x20490b[_0x49c4('0x41')]);return db['Tag'][_0x49c4('0x47')](_0x38349b)[_0x49c4('0x26')](handleEntityNotFound(_0x1e7bdc,null))[_0x49c4('0x26')](respondWithResult(_0x1e7bdc,null))[_0x49c4('0x48')](handleError(_0x1e7bdc,null));};exports[_0x49c4('0x49')]=function(_0x30bea5,_0x2c6be1){return db['Tag'][_0x49c4('0x49')](_0x30bea5[_0x49c4('0x4a')],{})['then'](function(_0x1e1ac4){var _0xaece5f=_0x30bea5[_0x49c4('0x4b')][_0x49c4('0x24')]({'plain':!![]});if(!_0xaece5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaece5f['role']===_0x49c4('0x4b')){var _0x4e8221=_0x1e1ac4[_0x49c4('0x24')]({'plain':!![]});var _0x1f941f=_0x49c4('0x4c');return db[_0x49c4('0x4d')][_0x49c4('0x47')]({'where':{'name':_0x1f941f,'userProfileId':_0xaece5f[_0x49c4('0x4e')]},'raw':!![]})[_0x49c4('0x26')](function(_0x563f0b){if(_0x563f0b&&_0x563f0b[_0x49c4('0x4f')]===0x0){return db[_0x49c4('0x25')][_0x49c4('0x49')]({'name':_0x4e8221[_0x49c4('0x2a')],'resourceId':_0x4e8221['id'],'type':_0x563f0b[_0x49c4('0x2a')],'sectionId':_0x563f0b['id']},{})[_0x49c4('0x26')](function(){return _0x1e1ac4;});}else{return _0x1e1ac4;}})[_0x49c4('0x48')](function(_0x25d174){logger[_0x49c4('0x28')](_0x49c4('0x50'),_0x25d174);throw _0x25d174;});}return _0x1e1ac4;})['then'](respondWithResult(_0x2c6be1,0xc9))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x22')]=function(_0x3f9a9d,_0x527e74){if(_0x3f9a9d['body']['id']){delete _0x3f9a9d[_0x49c4('0x4a')]['id'];}return db['Tag']['find']({'where':{'id':_0x3f9a9d[_0x49c4('0x51')]['id']}})[_0x49c4('0x26')](handleEntityNotFound(_0x527e74,null))[_0x49c4('0x26')](saveUpdates(_0x3f9a9d[_0x49c4('0x4a')],null))[_0x49c4('0x26')](respondWithResult(_0x527e74,null))[_0x49c4('0x48')](handleError(_0x527e74,null));};exports[_0x49c4('0x23')]=function(_0x50798e,_0x859dde){return db[_0x49c4('0x2d')][_0x49c4('0x47')]({'where':{'id':_0x50798e[_0x49c4('0x51')]['id']}})[_0x49c4('0x26')](handleEntityNotFound(_0x859dde,null))[_0x49c4('0x26')](removeEntity(_0x859dde,null))['catch'](handleError(_0x859dde,null));}; \ No newline at end of file +var _0x4c6d=['apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','find','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x17e498,_0x48989c){_0x17e498=_0x17e498-0x0;var _0x4cd515=_0x4c6d[_0x17e498];return _0x4cd515;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require('moment');var BPromise=require(_0xd4c6('0x5'));var Mustache=require(_0xd4c6('0x6'));var util=require(_0xd4c6('0x7'));var path=require('path');var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4c6('0xa'));var _=require(_0xd4c6('0xb'));var squel=require(_0xd4c6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xd'));var deskjs=require(_0xd4c6('0xe'));var toCsv=require(_0xd4c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd4c6('0xf'));var Redis=require(_0xd4c6('0x10'));var authService=require(_0xd4c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require(_0xd4c6('0x16'));var config=require(_0xd4c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b902,_0x489171){_0x489171=_0x489171||0xcc;return function(_0x162681){if(_0x162681){return _0x35b902[_0xd4c6('0x18')](_0x489171);}return _0x35b902[_0xd4c6('0x19')](_0x489171)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x3a2143,_0x384a98){_0x384a98=_0x384a98||0xc8;return function(_0x94f42e){if(_0x94f42e){return _0x3a2143['status'](_0x384a98)['json'](_0x94f42e);}};}function respondWithFilteredResult(_0x11e6c2,_0x3deb85){return function(_0x25e1fb){if(_0x25e1fb){var _0x25204d=typeof _0x3deb85[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x3deb85[_0xd4c6('0x1d')]==='undefined';var _0x761a3e=_0x25e1fb[_0xd4c6('0x1e')];var _0x23a16f=_0x25204d?0x0:_0x3deb85[_0xd4c6('0x1b')];var _0x31f328=_0x25204d?_0x25e1fb['count']:_0x3deb85[_0xd4c6('0x1b')]+_0x3deb85[_0xd4c6('0x1d')];var _0x359577;if(_0x31f328>=_0x761a3e){_0x31f328=_0x761a3e;_0x359577=0xc8;}else{_0x359577=0xce;}_0x11e6c2['status'](_0x359577);return _0x11e6c2[_0xd4c6('0x1f')](_0xd4c6('0x20'),_0x23a16f+'-'+_0x31f328+'/'+_0x761a3e)[_0xd4c6('0x21')](_0x25e1fb);}return null;};}function patchUpdates(_0x3b1658){return function(_0x48dbf8){try{jsonpatch[_0xd4c6('0x22')](_0x48dbf8,_0x3b1658,!![]);}catch(_0x4a10d8){return BPromise[_0xd4c6('0x23')](_0x4a10d8);}return _0x48dbf8[_0xd4c6('0x24')]();};}function saveUpdates(_0x2750c9,_0x222813){return function(_0xf536e0){if(_0xf536e0){return _0xf536e0[_0xd4c6('0x25')](_0x2750c9)[_0xd4c6('0x26')](function(_0x3f99e8){return _0x3f99e8;});}return null;};}function removeEntity(_0x155cb3,_0x466330){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0xd4c6('0x27')]()['then'](function(){var _0x582326=_0x1ebb17[_0xd4c6('0x28')]({'plain':!![]});var _0x2febbf='Tags';return db[_0xd4c6('0x29')][_0xd4c6('0x27')]({'where':{'type':_0x2febbf,'resourceId':_0x582326['id']}})[_0xd4c6('0x26')](function(){return _0x1ebb17;});})['then'](function(){_0x155cb3[_0xd4c6('0x19')](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x5614f3,_0x406ed0){return function(_0x8ce066){if(!_0x8ce066){_0x5614f3[_0xd4c6('0x18')](0x194);}return _0x8ce066;};}function handleError(_0x488e7e,_0x3ce942){_0x3ce942=_0x3ce942||0x1f4;return function(_0x3b656d){logger[_0xd4c6('0x2a')](_0x3b656d[_0xd4c6('0x2b')]);if(_0x3b656d[_0xd4c6('0x2c')]){delete _0x3b656d[_0xd4c6('0x2c')];}_0x488e7e[_0xd4c6('0x19')](_0x3ce942)[_0xd4c6('0x2d')](_0x3b656d);};}exports[_0xd4c6('0x2e')]=function(_0x1de7ae,_0x441119){var _0x31e3d0={},_0x15d312={},_0x112969={'count':0x0,'rows':[]};var _0x5d7997=_[_0xd4c6('0x2f')](db[_0xd4c6('0x30')][_0xd4c6('0x31')],function(_0x38d423){return{'name':_0x38d423['fieldName'],'type':_0x38d423['type']['key']};});_0x15d312[_0xd4c6('0x32')]=_[_0xd4c6('0x2f')](_0x5d7997,_0xd4c6('0x2c'));_0x15d312[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x1de7ae[_0xd4c6('0x33')]);_0x15d312[_0xd4c6('0x35')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],_0x15d312[_0xd4c6('0x33')]);_0x31e3d0[_0xd4c6('0x36')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x1de7ae[_0xd4c6('0x33')]['fields']));_0x31e3d0[_0xd4c6('0x36')]=_0x31e3d0[_0xd4c6('0x36')][_0xd4c6('0x38')]?_0x31e3d0[_0xd4c6('0x36')]:_0x15d312['model'];if(!_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x39')](_0xd4c6('0x3a'))){_0x31e3d0[_0xd4c6('0x1d')]=qs[_0xd4c6('0x1d')](_0x1de7ae['query'][_0xd4c6('0x1d')]);_0x31e3d0[_0xd4c6('0x1b')]=qs[_0xd4c6('0x1b')](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x1b')]);}_0x31e3d0[_0xd4c6('0x3b')]=qs['sort'](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3c')]);_0x31e3d0[_0xd4c6('0x3d')]=qs['filters'](_[_0xd4c6('0x3e')](_0x1de7ae[_0xd4c6('0x33')],_0x15d312[_0xd4c6('0x35')]),_0x5d7997);if(_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]){_0x31e3d0[_0xd4c6('0x3d')]=_[_0xd4c6('0x40')](_0x31e3d0[_0xd4c6('0x3d')],{'$or':_[_0xd4c6('0x2f')](_0x5d7997,function(_0x4c00f0){if(_0x4c00f0[_0xd4c6('0x41')]!=='VIRTUAL'){var _0x55063c={};_0x55063c[_0x4c00f0[_0xd4c6('0x2c')]]={'$like':'%'+_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]+'%'};return _0x55063c;}})});}_0x31e3d0=_[_0xd4c6('0x40')]({},_0x31e3d0,_0x1de7ae[_0xd4c6('0x42')]);var _0x536d65={'where':_0x31e3d0['where']};return db[_0xd4c6('0x30')][_0xd4c6('0x1e')](_0x536d65)[_0xd4c6('0x26')](function(_0x14ee8f){_0x112969['count']=_0x14ee8f;if(_0x1de7ae[_0xd4c6('0x33')]['includeAll']){_0x31e3d0[_0xd4c6('0x43')]=[{'all':!![]}];}return db[_0xd4c6('0x30')][_0xd4c6('0x44')](_0x31e3d0);})['then'](function(_0x470157){_0x112969[_0xd4c6('0x45')]=_0x470157;return _0x112969;})[_0xd4c6('0x26')](respondWithFilteredResult(_0x441119,_0x31e3d0))[_0xd4c6('0x46')](handleError(_0x441119,null));};exports[_0xd4c6('0x47')]=function(_0x3ef1b0,_0x11f62e){var _0x3beb89={'raw':!![],'where':{'id':_0x3ef1b0['params']['id']}},_0x343d94={};_0x343d94[_0xd4c6('0x32')]=_[_0xd4c6('0x34')](db[_0xd4c6('0x30')]['rawAttributes']);_0x343d94[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x3ef1b0[_0xd4c6('0x33')]);_0x343d94['filters']=_['intersection'](_0x343d94[_0xd4c6('0x32')],_0x343d94[_0xd4c6('0x33')]);_0x3beb89[_0xd4c6('0x36')]=_['intersection'](_0x343d94[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x37')]));_0x3beb89[_0xd4c6('0x36')]=_0x3beb89[_0xd4c6('0x36')]['length']?_0x3beb89[_0xd4c6('0x36')]:_0x343d94[_0xd4c6('0x32')];if(_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x48')]){_0x3beb89[_0xd4c6('0x43')]=[{'all':!![]}];}_0x3beb89=_[_0xd4c6('0x40')]({},_0x3beb89,_0x3ef1b0[_0xd4c6('0x42')]);return db[_0xd4c6('0x30')]['find'](_0x3beb89)['then'](handleEntityNotFound(_0x11f62e,null))[_0xd4c6('0x26')](respondWithResult(_0x11f62e,null))[_0xd4c6('0x46')](handleError(_0x11f62e,null));};exports[_0xd4c6('0x49')]=function(_0x5bb875,_0x37aa81){return db[_0xd4c6('0x30')][_0xd4c6('0x49')](_0x5bb875['body'],{})[_0xd4c6('0x26')](function(_0xa6bd55){var _0x17193f=_0x5bb875[_0xd4c6('0x4a')]['get']({'plain':!![]});if(!_0x17193f)throw new Error(_0xd4c6('0x4b'));if(_0x17193f[_0xd4c6('0x4c')]===_0xd4c6('0x4a')){var _0x14279d=_0xa6bd55[_0xd4c6('0x28')]({'plain':!![]});var _0x2803ef=_0xd4c6('0x4d');return db['UserProfileSection'][_0xd4c6('0x4e')]({'where':{'name':_0x2803ef,'userProfileId':_0x17193f[_0xd4c6('0x4f')]},'raw':!![]})[_0xd4c6('0x26')](function(_0x4a62a8){if(_0x4a62a8&&_0x4a62a8[_0xd4c6('0x50')]===0x0){return db[_0xd4c6('0x29')][_0xd4c6('0x49')]({'name':_0x14279d[_0xd4c6('0x2c')],'resourceId':_0x14279d['id'],'type':_0x4a62a8[_0xd4c6('0x2c')],'sectionId':_0x4a62a8['id']},{})[_0xd4c6('0x26')](function(){return _0xa6bd55;});}else{return _0xa6bd55;}})[_0xd4c6('0x46')](function(_0x591c7c){logger[_0xd4c6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x591c7c);throw _0x591c7c;});}return _0xa6bd55;})['then'](respondWithResult(_0x37aa81,0xc9))[_0xd4c6('0x46')](handleError(_0x37aa81,null));};exports['update']=function(_0x868da9,_0x574665){if(_0x868da9[_0xd4c6('0x51')]['id']){delete _0x868da9['body']['id'];}return db['Tag'][_0xd4c6('0x4e')]({'where':{'id':_0x868da9[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x574665,null))[_0xd4c6('0x26')](saveUpdates(_0x868da9[_0xd4c6('0x51')],null))[_0xd4c6('0x26')](respondWithResult(_0x574665,null))[_0xd4c6('0x46')](handleError(_0x574665,null));};exports[_0xd4c6('0x27')]=function(_0x33fac6,_0x5e52db){return db[_0xd4c6('0x30')][_0xd4c6('0x4e')]({'where':{'id':_0x33fac6[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x5e52db,null))[_0xd4c6('0x26')](removeEntity(_0x5e52db,null))[_0xd4c6('0x46')](handleError(_0x5e52db,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 281fd0e..7cafa83 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 _0xd887=['rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','api','bluebird','request-promise'];(function(_0x563692,_0x428494){var _0x78b79b=function(_0x3e94cf){while(--_0x3e94cf){_0x563692['push'](_0x563692['shift']());}};_0x78b79b(++_0x428494);}(_0xd887,0x131));var _0x7d88=function(_0x7430b4,_0x3526ec){_0x7430b4=_0x7430b4-0x0;var _0x44bbd5=_0xd887[_0x7430b4];return _0x44bbd5;};'use strict';var _=require(_0x7d88('0x0'));var util=require(_0x7d88('0x1'));var logger=require('../../config/logger')(_0x7d88('0x2'));var moment=require('moment');var BPromise=require(_0x7d88('0x3'));var rp=require(_0x7d88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d88('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d88('0x6'));module[_0x7d88('0x7')]=function(_0x2a896d,_0x1456c6){return _0x2a896d[_0x7d88('0x8')]('Tag',attributes,{'tableName':_0x7d88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd239=['rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xd239,0x92));var _0x9d23=function(_0x1eb3a9,_0x1bc3d2){_0x1eb3a9=_0x1eb3a9-0x0;var _0x588a71=_0xd239[_0x1eb3a9];return _0x588a71;};'use strict';var _=require(_0x9d23('0x0'));var util=require(_0x9d23('0x1'));var logger=require(_0x9d23('0x2'))(_0x9d23('0x3'));var moment=require(_0x9d23('0x4'));var BPromise=require(_0x9d23('0x5'));var rp=require(_0x9d23('0x6'));var fs=require('fs');var path=require(_0x9d23('0x7'));var rimraf=require(_0x9d23('0x8'));var config=require(_0x9d23('0x9'));var attributes=require(_0x9d23('0xa'));module[_0x9d23('0xb')]=function(_0x204f94,_0x595e14){return _0x204f94[_0x9d23('0xc')]('Tag',attributes,{'tableName':_0x9d23('0xd'),'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 b6bb2b2..56b32a5 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 _0x89c3=['jayson/promise','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x89c3,0xff));var _0x389c=function(_0x4abffe,_0x1f961e){_0x4abffe=_0x4abffe-0x0;var _0x2b3c9c=_0x89c3[_0x4abffe];return _0x2b3c9c;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var moment=require(_0x389c('0x2'));var BPromise=require(_0x389c('0x3'));var rs=require(_0x389c('0x4'));var fs=require('fs');var Redis=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];var utils=require(_0x389c('0x7'));var logger=require('../../config/logger')(_0x389c('0x8'));var config=require('../../config/environment');var jayson=require(_0x389c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3e3f,_0x4a83ab,_0x58bf11){return new BPromise(function(_0x33cb72,_0x41b63b){return client[_0x389c('0xa')](_0x2f3e3f,_0x58bf11)[_0x389c('0xb')](function(_0x41c92b){logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,_0x389c('0xe'));logger[_0x389c('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4a83ab,_0x389c('0xe'),JSON[_0x389c('0x10')](_0x41c92b));if(_0x41c92b[_0x389c('0x11')]){if(_0x41c92b[_0x389c('0x11')][_0x389c('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x41b63b(_0x41c92b[_0x389c('0x11')]['message']);}logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x33cb72(_0x41c92b['error'][_0x389c('0x13')]);}else{logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,'request\x20sent');_0x33cb72(_0x41c92b[_0x389c('0x14')][_0x389c('0x13')]);}})[_0x389c('0x15')](function(_0x3d6099){logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x3d6099);_0x41b63b(_0x3d6099);});});} \ No newline at end of file +var _0x6737=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c4161,_0x97bcc4){var _0x34f1e9=function(_0x31fd69){while(--_0x31fd69){_0x5c4161['push'](_0x5c4161['shift']());}};_0x34f1e9(++_0x97bcc4);}(_0x6737,0xe2));var _0x7673=function(_0x2e7e2e,_0x29fc92){_0x2e7e2e=_0x2e7e2e-0x0;var _0x16f6d3=_0x6737[_0x2e7e2e];return _0x16f6d3;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af802,_0x4e4b24,_0x53d67d){return new BPromise(function(_0x5292f7,_0x285c6d){return client['request'](_0x5af802,_0x53d67d)[_0x7673('0xa')](function(_0x1fb769){logger['info'](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));logger[_0x7673('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x4e4b24,'request\x20sent',JSON[_0x7673('0xe')](_0x1fb769));if(_0x1fb769['error']){if(_0x1fb769[_0x7673('0xf')][_0x7673('0x10')]===0x1f4){logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);return _0x285c6d(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769['error'][_0x7673('0x11')]);return _0x5292f7(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}else{logger[_0x7673('0x12')](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));_0x5292f7(_0x1fb769[_0x7673('0x13')]['message']);}})['catch'](function(_0x164d05){logger[_0x7673('0xf')]('Tag,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6ff2bf0..dbf1eba 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 4f75e2b..69d1f8b 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 _0x0713=['STRING','name'];(function(_0x9a9ce8,_0x391ac1){var _0x219a55=function(_0x263431){while(--_0x263431){_0x9a9ce8['push'](_0x9a9ce8['shift']());}};_0x219a55(++_0x391ac1);}(_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 +var _0xe706=['STRING','sequelize','exports'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xe706,0xa3));var _0x6e70=function(_0x3bc298,_0x583d14){_0x3bc298=_0x3bc298-0x0;var _0x31bf58=_0xe706[_0x3bc298];return _0x31bf58;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 565a2fa..665db40 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 _0xb867=['util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','Team','includeAll','include','findAll','rows','show','options','catch','create','body','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','params','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','Queue','pick','toLowerCase','Queues','addQueues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','get','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','all','removeAgents','isArray','user','Queue:remove','filter','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x3fe0ad,_0x3407b1){var _0x52de50=function(_0x1a2c6c){while(--_0x1a2c6c){_0x3fe0ad['push'](_0x3fe0ad['shift']());}};_0x52de50(++_0x3407b1);}(_0xb867,0x137));var _0x7b86=function(_0x37a2b9,_0x375682){_0x37a2b9=_0x37a2b9-0x0;var _0x1e6709=_0xb867[_0x37a2b9];return _0x1e6709;};'use strict';var emlformat=require(_0x7b86('0x0'));var rimraf=require(_0x7b86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b86('0x2'));var rp=require(_0x7b86('0x3'));var moment=require(_0x7b86('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b86('0x5'));var path=require(_0x7b86('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b86('0x7'));var fs=require('fs');var fs_extra=require(_0x7b86('0x8'));var _=require(_0x7b86('0x9'));var squel=require('squel');var crypto=require(_0x7b86('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7b86('0xb'));var toCsv=require(_0x7b86('0xc'));var querystring=require(_0x7b86('0xd'));var Papa=require(_0x7b86('0xe'));var Redis=require(_0x7b86('0xf'));var authService=require(_0x7b86('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b86('0x11'));var hardwareService=require(_0x7b86('0x12'));var logger=require('../../config/logger')(_0x7b86('0x13'));var utils=require(_0x7b86('0x14'));var config=require(_0x7b86('0x15'));var licenseUtil=require(_0x7b86('0x16'));var db=require(_0x7b86('0x17'))['db'];config[_0x7b86('0x18')]=_[_0x7b86('0x19')](config['redis'],{'host':_0x7b86('0x1a'),'port':0x18eb});var socket=require(_0x7b86('0x1b'))(new Redis(config[_0x7b86('0x18')]));require('./team.socket')[_0x7b86('0x1c')](socket);function respondWithStatusCode(_0x30f2a5,_0x4c81af){_0x4c81af=_0x4c81af||0xcc;return function(_0x119c39){if(_0x119c39){return _0x30f2a5[_0x7b86('0x1d')](_0x4c81af);}return _0x30f2a5[_0x7b86('0x1e')](_0x4c81af)[_0x7b86('0x1f')]();};}function respondWithResult(_0x2cdd0b,_0x76c13f){_0x76c13f=_0x76c13f||0xc8;return function(_0x3ad169){if(_0x3ad169){return _0x2cdd0b['status'](_0x76c13f)['json'](_0x3ad169);}};}function respondWithFilteredResult(_0x5092c0,_0x160a17){return function(_0x1c3647){if(_0x1c3647){var _0x376947=typeof _0x160a17['offset']===_0x7b86('0x20')&&typeof _0x160a17[_0x7b86('0x21')]==='undefined';var _0x2b08ba=_0x1c3647[_0x7b86('0x22')];var _0x4a74e0=_0x376947?0x0:_0x160a17['offset'];var _0x516254=_0x376947?_0x1c3647[_0x7b86('0x22')]:_0x160a17[_0x7b86('0x23')]+_0x160a17[_0x7b86('0x21')];var _0x5a229c;if(_0x516254>=_0x2b08ba){_0x516254=_0x2b08ba;_0x5a229c=0xc8;}else{_0x5a229c=0xce;}_0x5092c0[_0x7b86('0x1e')](_0x5a229c);return _0x5092c0[_0x7b86('0x24')](_0x7b86('0x25'),_0x4a74e0+'-'+_0x516254+'/'+_0x2b08ba)[_0x7b86('0x26')](_0x1c3647);}return null;};}function patchUpdates(_0x183f82){return function(_0x3baded){try{jsonpatch[_0x7b86('0x27')](_0x3baded,_0x183f82,!![]);}catch(_0x1cc335){return BPromise[_0x7b86('0x28')](_0x1cc335);}return _0x3baded[_0x7b86('0x29')]();};}function saveUpdates(_0x430a11,_0x17002c){return function(_0x10b423){if(_0x10b423){return _0x10b423[_0x7b86('0x2a')](_0x430a11)[_0x7b86('0x2b')](function(_0x6bf3b3){return _0x6bf3b3;});}return null;};}function handleEntityNotFound(_0x558373,_0x7d4b1f){return function(_0x2d10d0){if(!_0x2d10d0){_0x558373['sendStatus'](0x194);}return _0x2d10d0;};}function handleError(_0x47d254,_0x335b3f){_0x335b3f=_0x335b3f||0x1f4;return function(_0x63e560){logger[_0x7b86('0x2c')](_0x63e560[_0x7b86('0x2d')]);if(_0x63e560[_0x7b86('0x2e')]){delete _0x63e560[_0x7b86('0x2e')];}_0x47d254['status'](_0x335b3f)[_0x7b86('0x2f')](_0x63e560);};}exports[_0x7b86('0x30')]=function(_0x59dc94,_0x4d4dff){var _0x193f91={},_0x55fc82={},_0x168fd3={'count':0x0,'rows':[]};var _0x4980a4=_[_0x7b86('0x31')](db['Team'][_0x7b86('0x32')],function(_0x16d05f){return{'name':_0x16d05f[_0x7b86('0x33')],'type':_0x16d05f['type'][_0x7b86('0x34')]};});_0x55fc82[_0x7b86('0x35')]=_[_0x7b86('0x31')](_0x4980a4,_0x7b86('0x2e'));_0x55fc82[_0x7b86('0x36')]=_[_0x7b86('0x37')](_0x59dc94[_0x7b86('0x36')]);_0x55fc82[_0x7b86('0x38')]=_['intersection'](_0x55fc82[_0x7b86('0x35')],_0x55fc82[_0x7b86('0x36')]);_0x193f91['attributes']=_[_0x7b86('0x39')](_0x55fc82['model'],qs[_0x7b86('0x3a')](_0x59dc94[_0x7b86('0x36')][_0x7b86('0x3a')]));_0x193f91[_0x7b86('0x3b')]=_0x193f91[_0x7b86('0x3b')][_0x7b86('0x3c')]?_0x193f91[_0x7b86('0x3b')]:_0x55fc82['model'];if(!_0x59dc94[_0x7b86('0x36')]['hasOwnProperty'](_0x7b86('0x3d'))){_0x193f91['limit']=qs[_0x7b86('0x21')](_0x59dc94[_0x7b86('0x36')][_0x7b86('0x21')]);_0x193f91[_0x7b86('0x23')]=qs[_0x7b86('0x23')](_0x59dc94[_0x7b86('0x36')][_0x7b86('0x23')]);}_0x193f91[_0x7b86('0x3e')]=qs[_0x7b86('0x3f')](_0x59dc94[_0x7b86('0x36')]['sort']);_0x193f91[_0x7b86('0x40')]=qs[_0x7b86('0x38')](_['pick'](_0x59dc94[_0x7b86('0x36')],_0x55fc82[_0x7b86('0x38')]),_0x4980a4);if(_0x59dc94[_0x7b86('0x36')]['filter']){_0x193f91[_0x7b86('0x40')]=_[_0x7b86('0x41')](_0x193f91[_0x7b86('0x40')],{'$or':_[_0x7b86('0x31')](_0x4980a4,function(_0x4918f2){if(_0x4918f2['type']!==_0x7b86('0x42')){var _0x182d56={};_0x182d56[_0x4918f2[_0x7b86('0x2e')]]={'$like':'%'+_0x59dc94[_0x7b86('0x36')]['filter']+'%'};return _0x182d56;}})});}_0x193f91=_[_0x7b86('0x41')]({},_0x193f91,_0x59dc94['options']);var _0x4fdfec={'where':_0x193f91[_0x7b86('0x40')]};return db[_0x7b86('0x43')][_0x7b86('0x22')](_0x4fdfec)[_0x7b86('0x2b')](function(_0xa23304){_0x168fd3['count']=_0xa23304;if(_0x59dc94[_0x7b86('0x36')][_0x7b86('0x44')]){_0x193f91[_0x7b86('0x45')]=[{'all':!![]}];}return db[_0x7b86('0x43')][_0x7b86('0x46')](_0x193f91);})[_0x7b86('0x2b')](function(_0x3812a2){_0x168fd3[_0x7b86('0x47')]=_0x3812a2;return _0x168fd3;})[_0x7b86('0x2b')](respondWithFilteredResult(_0x4d4dff,_0x193f91))['catch'](handleError(_0x4d4dff,null));};exports[_0x7b86('0x48')]=function(_0x143e49,_0x45d039){var _0x23c079={'raw':![],'where':{'id':_0x143e49['params']['id']}},_0x1bd40d={};_0x1bd40d[_0x7b86('0x35')]=_[_0x7b86('0x37')](db[_0x7b86('0x43')][_0x7b86('0x32')]);_0x1bd40d[_0x7b86('0x36')]=_['keys'](_0x143e49[_0x7b86('0x36')]);_0x1bd40d[_0x7b86('0x38')]=_[_0x7b86('0x39')](_0x1bd40d['model'],_0x1bd40d['query']);_0x23c079[_0x7b86('0x3b')]=_[_0x7b86('0x39')](_0x1bd40d[_0x7b86('0x35')],qs[_0x7b86('0x3a')](_0x143e49['query']['fields']));_0x23c079['attributes']=_0x23c079['attributes'][_0x7b86('0x3c')]?_0x23c079[_0x7b86('0x3b')]:_0x1bd40d[_0x7b86('0x35')];if(_0x143e49[_0x7b86('0x36')][_0x7b86('0x44')]){_0x23c079['include']=[{'all':!![]}];}_0x23c079=_[_0x7b86('0x41')]({},_0x23c079,_0x143e49[_0x7b86('0x49')]);return db[_0x7b86('0x43')]['find'](_0x23c079)[_0x7b86('0x2b')](handleEntityNotFound(_0x45d039,null))[_0x7b86('0x2b')](respondWithResult(_0x45d039,null))[_0x7b86('0x4a')](handleError(_0x45d039,null));};exports['create']=function(_0x39dcb7,_0x1c14bb){return db['Team'][_0x7b86('0x4b')](_0x39dcb7[_0x7b86('0x4c')],{})[_0x7b86('0x2b')](function(_0x5deb38){var _0x1e82f0=_0x39dcb7['user']['get']({'plain':!![]});if(!_0x1e82f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e82f0[_0x7b86('0x4d')]==='user'){var _0x1286a1=_0x5deb38['get']({'plain':!![]});var _0x3ce850=_0x7b86('0x4e');return db[_0x7b86('0x4f')]['find']({'where':{'name':_0x3ce850,'userProfileId':_0x1e82f0[_0x7b86('0x50')]},'raw':!![]})[_0x7b86('0x2b')](function(_0xd18b1b){if(_0xd18b1b&&_0xd18b1b[_0x7b86('0x51')]===0x0){return db[_0x7b86('0x52')]['create']({'name':_0x1286a1['name'],'resourceId':_0x1286a1['id'],'type':_0xd18b1b['name'],'sectionId':_0xd18b1b['id']},{})[_0x7b86('0x2b')](function(){return _0x5deb38;});}else{return _0x5deb38;}})['catch'](function(_0x82d284){logger['error'](_0x7b86('0x53'),_0x82d284);throw _0x82d284;});}return _0x5deb38;})[_0x7b86('0x2b')](respondWithResult(_0x1c14bb,0xc9))['catch'](handleError(_0x1c14bb,null));};exports[_0x7b86('0x2a')]=function(_0x336b32,_0xcb3395){if(_0x336b32[_0x7b86('0x4c')]['id']){delete _0x336b32['body']['id'];}return db['Team'][_0x7b86('0x54')]({'where':{'id':_0x336b32['params']['id']}})[_0x7b86('0x2b')](handleEntityNotFound(_0xcb3395,null))['then'](saveUpdates(_0x336b32[_0x7b86('0x4c')],null))[_0x7b86('0x2b')](respondWithResult(_0xcb3395,null))['catch'](handleError(_0xcb3395,null));};exports['destroy']=function(_0x10469f,_0x30428d){var _0x2ab19d=_0x10469f['params']['id'];var _0x23a630=[];return db[_0x7b86('0x55')][_0x7b86('0x56')](function(_0x457e74){var _0x409740=_0x7b86('0x57')+_0x2ab19d;return db[_0x7b86('0x55')]['query'](_0x409740,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74})[_0x7b86('0x2b')](function(_0x2fa77f){_0x23a630=_[_0x7b86('0x31')](_0x2fa77f,function(_0x33477b){return Number(_0x33477b['UserId']);});})['then'](function(){var _0x3c40b5=_0x7b86('0x5b')+_0x2ab19d;return db[_0x7b86('0x55')][_0x7b86('0x36')](_0x3c40b5,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x27778d){var _0x97adaf=_[_0x7b86('0x31')](_0x27778d,function(_0x213f5e){return Number(_0x213f5e[_0x7b86('0x5c')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x23a630},'VoiceQueueId':{'$in':_0x97adaf}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x421eb0=_0x7b86('0x5d')+_0x2ab19d;return db[_0x7b86('0x55')]['query'](_0x421eb0,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x158a86){var _0xee0ac3=_[_0x7b86('0x31')](_0x158a86,function(_0xd53ea6){return Number(_0xd53ea6[_0x7b86('0x5e')]);});return db['UserMailQueue'][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'MailQueueId':{'$in':_0xee0ac3}},'transaction':_0x457e74});})['then'](function(){var _0x2e1dcf=_0x7b86('0x60')+_0x2ab19d;return db['sequelize']['query'](_0x2e1dcf,{'type':db[_0x7b86('0x58')]['QueryTypes'][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})['then'](function(_0x1b9da1){var _0x320ba6=_[_0x7b86('0x31')](_0x1b9da1,function(_0x127401){return Number(_0x127401['SmsQueueId']);});return db[_0x7b86('0x61')]['destroy']({'where':{'UserId':{'$in':_0x23a630},'SmsQueueId':{'$in':_0x320ba6}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x18b50c=_0x7b86('0x62')+_0x2ab19d;return db['sequelize']['query'](_0x18b50c,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x1c2e97){var _0x16c662=_['map'](_0x1c2e97,function(_0x5f2cfd){return Number(_0x5f2cfd['ChatQueueId']);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x23a630},'ChatQueueId':{'$in':_0x16c662}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x4d97a5=_0x7b86('0x63')+_0x2ab19d;return db[_0x7b86('0x55')][_0x7b86('0x36')](_0x4d97a5,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x3aa070){var _0x40afa2=_[_0x7b86('0x31')](_0x3aa070,function(_0x3aaf84){return Number(_0x3aaf84[_0x7b86('0x64')]);});return db[_0x7b86('0x65')][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'FaxQueueId':{'$in':_0x40afa2}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x1b8f8e=_0x7b86('0x66')+_0x2ab19d;return db['sequelize'][_0x7b86('0x36')](_0x1b8f8e,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x1a68de){var _0x5e3b0f=_[_0x7b86('0x31')](_0x1a68de,function(_0x45a0ad){return Number(_0x45a0ad[_0x7b86('0x67')]);});return db[_0x7b86('0x68')]['destroy']({'where':{'UserId':{'$in':_0x23a630},'OpenchannelQueueId':{'$in':_0x5e3b0f}},'transaction':_0x457e74});})[_0x7b86('0x2b')](function(){var _0x5664b6=_0x7b86('0x69')+_0x2ab19d;return db[_0x7b86('0x55')]['query'](_0x5664b6,{'type':db[_0x7b86('0x58')][_0x7b86('0x59')][_0x7b86('0x5a')],'raw':!![],'transaction':_0x457e74});})['then'](function(_0xb2efd1){var _0xc7057a=_['map'](_0xb2efd1,function(_0x2aedd7){return Number(_0x2aedd7[_0x7b86('0x6a')]);});return db[_0x7b86('0x6b')][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'WhatsappQueueId':{'$in':_0xc7057a}},'transaction':_0x457e74});})['then'](function(){return db[_0x7b86('0x6c')][_0x7b86('0x54')]({'where':{'TeamId':_0x2ab19d}});})['then'](function(_0x5ce5fd){if(_0x5ce5fd===null){return;}return db[_0x7b86('0x6d')][_0x7b86('0x5f')]({'where':{'UserId':{'$in':_0x23a630},'VoicePrefixId':_0x5ce5fd[_0x7b86('0x6e')]},'transaction':_0x457e74});})['then'](function(){return db[_0x7b86('0x43')][_0x7b86('0x5f')]({'where':{'id':_0x2ab19d},'cascade':!![],'transaction':_0x457e74});})[_0x7b86('0x2b')](function(_0x152420){if(_0x152420===0x0){_0x30428d[_0x7b86('0x1d')](0x194);}else{return db[_0x7b86('0x52')][_0x7b86('0x5f')]({'where':{'type':_0x7b86('0x4e'),'resourceId':_0x2ab19d},'cascade':!![],'transaction':_0x457e74})['then'](function(){_0x30428d[_0x7b86('0x1e')](0xcc)[_0x7b86('0x1f')]();});}})['catch'](function(_0xe78356){_0x30428d[_0x7b86('0x1e')](0x1f4)['send'](_0xe78356);});});};exports[_0x7b86('0x6f')]=function(_0x5ce989,_0xf64a61,_0x5064d1){return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x5ce989[_0x7b86('0x71')]['id']}})['then'](handleEntityNotFound(_0xf64a61,null))[_0x7b86('0x2b')](function(_0x3ed8fb){if(!_0x5ce989['query']['channel']||!utils[_0x7b86('0x72')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x73')])){throw new db[(_0x7b86('0x58'))][(_0x7b86('0x74'))](_0x7b86('0x75'));}var _0x35c542={};var _0x1f0707={};_0x1f0707[_0x7b86('0x35')]=_[_0x7b86('0x37')](db[_[_0x7b86('0x76')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x73')]['toLowerCase']())+_0x7b86('0x77')]['rawAttributes']);_0x1f0707[_0x7b86('0x36')]=_['keys'](_0x5ce989[_0x7b86('0x36')]);_0x1f0707[_0x7b86('0x38')]=_[_0x7b86('0x39')](_0x1f0707[_0x7b86('0x35')],_0x1f0707['query']);_0x35c542[_0x7b86('0x3b')]=_[_0x7b86('0x39')](_0x1f0707[_0x7b86('0x35')],qs['fields'](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x3a')]));_0x35c542[_0x7b86('0x3b')]=_0x35c542['attributes'][_0x7b86('0x3c')]?_0x35c542[_0x7b86('0x3b')]:_0x1f0707['model'];_0x35c542[_0x7b86('0x21')]=qs[_0x7b86('0x21')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x21')]);_0x35c542[_0x7b86('0x23')]=qs[_0x7b86('0x23')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x23')]);_0x35c542[_0x7b86('0x3e')]=qs[_0x7b86('0x3f')](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x3f')]);_0x35c542[_0x7b86('0x40')]=qs[_0x7b86('0x38')](_[_0x7b86('0x78')](_0x5ce989['query'],_0x1f0707[_0x7b86('0x38')]));_0x35c542=_[_0x7b86('0x41')]({},_0x35c542,_0x5ce989['options']);return _0x3ed8fb['get'+_['capitalize'](_0x5ce989[_0x7b86('0x36')][_0x7b86('0x73')][_0x7b86('0x79')]())+_0x7b86('0x7a')](_0x35c542);})['then'](respondWithResult(_0xf64a61,null))[_0x7b86('0x4a')](handleError(_0xf64a61,null));};exports[_0x7b86('0x7b')]=function(_0x39c507,_0x1c3ccd,_0x360ebc){return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x39c507[_0x7b86('0x71')]['id']}})[_0x7b86('0x2b')](function(_0x2cb3d6){if(_0x2cb3d6){if(!_0x39c507['body'][_0x7b86('0x73')]||!utils[_0x7b86('0x72')](_0x39c507[_0x7b86('0x4c')][_0x7b86('0x73')])){throw new db[(_0x7b86('0x58'))][(_0x7b86('0x74'))]('Unknown\x20channel');}return _0x2cb3d6['add'+_[_0x7b86('0x76')](_0x39c507[_0x7b86('0x4c')][_0x7b86('0x73')][_0x7b86('0x79')]())+_0x7b86('0x7a')](_0x39c507[_0x7b86('0x4c')][_0x7b86('0x7c')]);}return null;})[_0x7b86('0x2b')](handleEntityNotFound(_0x1c3ccd,null))['then'](respondWithStatusCode(_0x1c3ccd,null))[_0x7b86('0x4a')](handleError(_0x1c3ccd,null));};exports[_0x7b86('0x7d')]=function(_0x3dd859,_0x380451,_0x20701e){return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x3dd859['params']['id']}})['then'](function(_0x4ac64d){if(_0x4ac64d){if(!_0x3dd859[_0x7b86('0x36')]['channel']||!utils['isValidChannel'](_0x3dd859[_0x7b86('0x36')]['channel'])){throw new db[(_0x7b86('0x58'))][(_0x7b86('0x74'))]('Unknown\x20channel');}return _0x4ac64d[_0x7b86('0x7e')+_[_0x7b86('0x76')](_0x3dd859[_0x7b86('0x36')][_0x7b86('0x73')][_0x7b86('0x79')]())+_0x7b86('0x7a')](_0x3dd859[_0x7b86('0x36')][_0x7b86('0x7c')]);}return null;})[_0x7b86('0x2b')](handleEntityNotFound(_0x380451,null))[_0x7b86('0x2b')](respondWithStatusCode(_0x380451,null))[_0x7b86('0x4a')](handleError(_0x380451,null));};exports[_0x7b86('0x7f')]=function(_0x3b8dcf,_0x249ead){var _0x553894=_['isArray'](_0x3b8dcf[_0x7b86('0x4c')][_0x7b86('0x7c')])?_0x3b8dcf[_0x7b86('0x4c')][_0x7b86('0x7c')]:[_0x3b8dcf['body'][_0x7b86('0x7c')]];var _0x4ff288=_0x3b8dcf['params']['id'];return db[_0x7b86('0x43')][_0x7b86('0x54')]({'where':{'id':_0x4ff288}})[_0x7b86('0x2b')](handleEntityNotFound(_0x249ead,null))['then'](function(_0x146255){if(_0x146255){var _0x414309=[_0x7b86('0x80'),_0x7b86('0x81'),_0x7b86('0x82'),_0x7b86('0x83'),_0x7b86('0x84'),_0x7b86('0x85'),_0x7b86('0x86')];return db[_0x7b86('0x55')][_0x7b86('0x56')](function(_0x2d1759){var _0x330b9b=_[_0x7b86('0x31')](_0x414309,function(_0x5bcbd0){var _0x3489aa={'attributes':['id',_0x7b86('0x2e')]};if(_0x5bcbd0===_0x7b86('0x80')){_0x3489aa[_0x7b86('0x87')]={'attributes':['penalty']};}return _0x146255[_0x7b86('0x88')+_0x5bcbd0+_0x7b86('0x7a')](_0x3489aa)['then'](function(_0x3c8a36){var _0x290ecf=_[_0x7b86('0x31')](_0x3c8a36,function(_0x16f21e){var _0x57d32a=_[_0x7b86('0x31')](_0x553894,function(_0x100fb3){var _0x41d000={'where':{'UserId':_0x100fb3,[_0x5bcbd0+_0x7b86('0x89')]:_0x16f21e['id']},'transaction':_0x2d1759};if(_0x5bcbd0===_0x7b86('0x80')){_0x41d000[_0x7b86('0x19')]={'penalty':_0x16f21e[_0x7b86('0x8a')][_0x7b86('0x8b')]};}return db[_0x7b86('0x8c')+_0x5bcbd0+'Queue'][_0x7b86('0x8d')](_0x41d000)['then'](function(){socket[_0x7b86('0x8e')]('user'+_0x5bcbd0+_0x7b86('0x8f'),{'UserId':_0x100fb3,[_0x5bcbd0+_0x7b86('0x89')]:_0x16f21e['id']});if(_0x5bcbd0!==_0x7b86('0x80')){return;}return db[_0x7b86('0x8c')][_0x7b86('0x46')]({'where':{'id':_0x553894,'online':0x1},'attributes':['id',_0x7b86('0x2e'),_0x7b86('0x90'),_0x7b86('0x91'),_0x7b86('0x92')],'raw':!![]})[_0x7b86('0x2b')](function(_0x3fd8fe){var _0x2bb59=_['map'](_0x3fd8fe,function(_0x5a54bb){return db[_0x7b86('0x93')][_0x7b86('0x94')]({'membername':_0x5a54bb['name'],'UserId':_0x5a54bb['id'],'queue_name':_0x16f21e['name'],'VoiceQueueId':_0x16f21e['id'],'interface':_['isNil'](_0x5a54bb[_0x7b86('0x92')])?util[_0x7b86('0x95')]('SIP/%s',_0x5a54bb[_0x7b86('0x2e')]):_0x5a54bb[_0x7b86('0x92')],'paused':_0x5a54bb[_0x7b86('0x91')]||![],'penalty':_0x16f21e['TeamVoiceQueue']['penalty']},{'transaction':_0x2d1759});});return Promise[_0x7b86('0x96')](_0x2bb59);});});});return Promise['all'](_0x57d32a);});return Promise[_0x7b86('0x96')](_0x290ecf);})[_0x7b86('0x2b')](function(){return db[_0x7b86('0x6c')]['findOne']({'where':{'teamId':_0x4ff288}})['then'](function(_0x12a591){if(_0x12a591){var _0x5a7523=_[_0x7b86('0x31')](_0x553894,function(_0x4f8f62){db[_0x7b86('0x6d')][_0x7b86('0x94')]({'UserId':_0x4f8f62,'VoicePrefixId':_0x12a591[_0x7b86('0x6e')]});});return Promise[_0x7b86('0x96')](_0x5a7523);}});});});return Promise[_0x7b86('0x96')](_0x330b9b)['then'](function(){return _0x146255[_0x7b86('0x7f')](_0x553894,{'transaction':_0x2d1759})['spread'](function(_0x2c5e56){return _0x2c5e56;});});});}})[_0x7b86('0x2b')](respondWithResult(_0x249ead,null))['catch'](handleError(_0x249ead,null));};exports[_0x7b86('0x97')]=function(_0x560567,_0x33b7a9){var _0x35e9a2=_[_0x7b86('0x98')](_0x560567[_0x7b86('0x36')][_0x7b86('0x7c')])?_0x560567[_0x7b86('0x36')][_0x7b86('0x7c')]:[_0x560567[_0x7b86('0x36')][_0x7b86('0x7c')]];var _0x19a3ab=_0x560567[_0x7b86('0x71')]['id'];return db[_0x7b86('0x43')][_0x7b86('0x54')]({'where':{'id':_0x19a3ab}})[_0x7b86('0x2b')](handleEntityNotFound(_0x33b7a9,null))[_0x7b86('0x2b')](function(_0x4b6c09){if(_0x4b6c09){var _0x293fa4=[_0x7b86('0x80'),_0x7b86('0x81'),_0x7b86('0x82'),_0x7b86('0x83'),_0x7b86('0x84'),_0x7b86('0x85'),_0x7b86('0x86')];return db[_0x7b86('0x55')][_0x7b86('0x56')](function(_0x4c205f){var _0x25ee3e=_[_0x7b86('0x31')](_0x293fa4,function(_0xea0d4b){var _0x43b76c={'attributes':['id','name']};return _0x4b6c09[_0x7b86('0x88')+_0xea0d4b+_0x7b86('0x7a')](_0x43b76c)[_0x7b86('0x2b')](function(_0x29c642){var _0x46cec5=_[_0x7b86('0x31')](_0x29c642,function(_0x38f56c){return _0x38f56c[_0x7b86('0x97')](_0x35e9a2,{'transaction':_0x4c205f})[_0x7b86('0x2b')](function(){var _0x39d32c=_[_0x7b86('0x31')](_0x35e9a2,function(_0x22d55a){socket[_0x7b86('0x8e')](_0x7b86('0x99')+_0xea0d4b+_0x7b86('0x9a'),{'UserId':Number(_0x22d55a),[_0xea0d4b+'QueueId']:_0x38f56c['id']});if(_0xea0d4b!==_0x7b86('0x80')){return;}return db[_0x7b86('0x93')][_0x7b86('0x5f')]({'where':{'VoiceQueueId':_0x38f56c['id'],'UserId':_0x22d55a},'transaction':_0x4c205f});});return Promise[_0x7b86('0x96')](_0x39d32c);});});return Promise[_0x7b86('0x96')](_0x46cec5);});});return Promise['all'](_0x25ee3e)[_0x7b86('0x2b')](function(){return _0x4b6c09[_0x7b86('0x97')](_0x35e9a2,{'transaction':_0x4c205f});})[_0x7b86('0x2b')](function(){return db['TeamVoicePrefix'][_0x7b86('0x70')]({'where':{'teamId':_0x19a3ab}})[_0x7b86('0x2b')](function(_0x76cf1e){if(_0x76cf1e){var _0x45bd1b=_[_0x7b86('0x31')](_0x35e9a2,function(_0x3f41cb){db[_0x7b86('0x6d')]['destroy']({'where':{'UserId':_0x3f41cb,'VoicePrefixId':_0x76cf1e[_0x7b86('0x6e')]}});});return Promise['all'](_0x45bd1b);}});});});}})[_0x7b86('0x2b')](respondWithStatusCode(_0x33b7a9,null))[_0x7b86('0x4a')](handleError(_0x33b7a9,null));};exports['getAgents']=function(_0x5a403f,_0x5f50fc,_0x50e651){var _0x11e110={};var _0x6f819a={};var _0x1d5e34;var _0x2bfb6e;return db[_0x7b86('0x43')][_0x7b86('0x70')]({'where':{'id':_0x5a403f[_0x7b86('0x71')]['id']}})['then'](handleEntityNotFound(_0x5f50fc,null))[_0x7b86('0x2b')](function(_0x2facec){if(_0x2facec){_0x1d5e34=_0x2facec;_0x6f819a[_0x7b86('0x35')]=_[_0x7b86('0x37')](db[_0x7b86('0x8c')]['rawAttributes']);_0x6f819a[_0x7b86('0x36')]=_[_0x7b86('0x37')](_0x5a403f[_0x7b86('0x36')]);_0x6f819a[_0x7b86('0x38')]=_[_0x7b86('0x39')](_0x6f819a[_0x7b86('0x35')],_0x6f819a[_0x7b86('0x36')]);_0x11e110['attributes']=_[_0x7b86('0x39')](_0x6f819a['model'],qs['fields'](_0x5a403f['query']['fields']));_0x11e110[_0x7b86('0x3b')]=_0x11e110['attributes'][_0x7b86('0x3c')]?_0x11e110[_0x7b86('0x3b')]:_0x6f819a[_0x7b86('0x35')];_0x11e110['order']=qs[_0x7b86('0x3f')](_0x5a403f[_0x7b86('0x36')][_0x7b86('0x3f')]);_0x11e110[_0x7b86('0x40')]=qs[_0x7b86('0x38')](_[_0x7b86('0x78')](_0x5a403f[_0x7b86('0x36')],_0x6f819a[_0x7b86('0x38')]));if(_0x5a403f[_0x7b86('0x36')][_0x7b86('0x9b')]){_0x11e110[_0x7b86('0x40')]=_[_0x7b86('0x41')](_0x11e110[_0x7b86('0x40')],{'$or':_[_0x7b86('0x31')](_0x11e110[_0x7b86('0x3b')],function(_0x47c6ce){var _0x29044d={};_0x29044d[_0x47c6ce]={'$like':'%'+_0x5a403f[_0x7b86('0x36')][_0x7b86('0x9b')]+'%'};return _0x29044d;})});}_0x11e110=_['merge']({},_0x11e110,_0x5a403f[_0x7b86('0x49')]);return _0x1d5e34[_0x7b86('0x9c')](_0x11e110);}})[_0x7b86('0x2b')](function(_0x601d1d){if(_0x601d1d){_0x2bfb6e=_0x601d1d[_0x7b86('0x3c')];if(!_0x5a403f[_0x7b86('0x36')][_0x7b86('0x9d')](_0x7b86('0x3d'))){_0x11e110[_0x7b86('0x21')]=qs[_0x7b86('0x21')](_0x5a403f[_0x7b86('0x36')][_0x7b86('0x21')]);_0x11e110[_0x7b86('0x23')]=qs[_0x7b86('0x23')](_0x5a403f['query'][_0x7b86('0x23')]);}return _0x1d5e34[_0x7b86('0x9c')](_0x11e110);}})[_0x7b86('0x2b')](function(_0x1e3ca4){if(_0x1e3ca4){return _0x1e3ca4?{'count':_0x2bfb6e,'rows':_0x1e3ca4}:null;}})[_0x7b86('0x2b')](respondWithResult(_0x5f50fc,null))[_0x7b86('0x4a')](handleError(_0x5f50fc,null));}; \ No newline at end of file +var _0x57f1=['UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','removeAgents','Fax','nolimit','getAgents','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','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','Team','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','UserSmsQueue','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','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','rawAttributes','capitalize','Queues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','findOrCreate','emit','Queue:save','User','online','voicePause','interface'];(function(_0x42a303,_0x25fc01){var _0x28a844=function(_0x5b245e){while(--_0x5b245e){_0x42a303['push'](_0x42a303['shift']());}};_0x28a844(++_0x25fc01);}(_0x57f1,0x13c));var _0x157f=function(_0x2ca684,_0x4a1184){_0x2ca684=_0x2ca684-0x0;var _0x1f79f0=_0x57f1[_0x2ca684];return _0x1f79f0;};'use strict';var emlformat=require(_0x157f('0x0'));var rimraf=require(_0x157f('0x1'));var zipdir=require(_0x157f('0x2'));var jsonpatch=require(_0x157f('0x3'));var rp=require(_0x157f('0x4'));var moment=require(_0x157f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x157f('0x6'));var util=require(_0x157f('0x7'));var path=require(_0x157f('0x8'));var sox=require(_0x157f('0x9'));var csv=require(_0x157f('0xa'));var ejs=require(_0x157f('0xb'));var fs=require('fs');var fs_extra=require(_0x157f('0xc'));var _=require(_0x157f('0xd'));var squel=require(_0x157f('0xe'));var crypto=require(_0x157f('0xf'));var jsforce=require(_0x157f('0x10'));var deskjs=require(_0x157f('0x11'));var toCsv=require(_0x157f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x157f('0x12'));var authService=require(_0x157f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x157f('0x14'));var logger=require(_0x157f('0x15'))(_0x157f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x157f('0x17')]=_[_0x157f('0x18')](config['redis'],{'host':_0x157f('0x19'),'port':0x18eb});var socket=require(_0x157f('0x1a'))(new Redis(config['redis']));require('./team.socket')[_0x157f('0x1b')](socket);function respondWithStatusCode(_0x38a35d,_0x163d5b){_0x163d5b=_0x163d5b||0xcc;return function(_0x3837e0){if(_0x3837e0){return _0x38a35d[_0x157f('0x1c')](_0x163d5b);}return _0x38a35d[_0x157f('0x1d')](_0x163d5b)[_0x157f('0x1e')]();};}function respondWithResult(_0xb47cf5,_0x47f4f2){_0x47f4f2=_0x47f4f2||0xc8;return function(_0xc872fa){if(_0xc872fa){return _0xb47cf5[_0x157f('0x1d')](_0x47f4f2)[_0x157f('0x1f')](_0xc872fa);}};}function respondWithFilteredResult(_0x3d70a0,_0x18f3bd){return function(_0x556a66){if(_0x556a66){var _0xc76a50=typeof _0x18f3bd[_0x157f('0x20')]==='undefined'&&typeof _0x18f3bd[_0x157f('0x21')]===_0x157f('0x22');var _0x58e322=_0x556a66[_0x157f('0x23')];var _0x25ae0b=_0xc76a50?0x0:_0x18f3bd[_0x157f('0x20')];var _0x431d7c=_0xc76a50?_0x556a66[_0x157f('0x23')]:_0x18f3bd[_0x157f('0x20')]+_0x18f3bd[_0x157f('0x21')];var _0x551624;if(_0x431d7c>=_0x58e322){_0x431d7c=_0x58e322;_0x551624=0xc8;}else{_0x551624=0xce;}_0x3d70a0[_0x157f('0x1d')](_0x551624);return _0x3d70a0['set'](_0x157f('0x24'),_0x25ae0b+'-'+_0x431d7c+'/'+_0x58e322)[_0x157f('0x1f')](_0x556a66);}return null;};}function patchUpdates(_0x588ade){return function(_0x2c2f1c){try{jsonpatch[_0x157f('0x25')](_0x2c2f1c,_0x588ade,!![]);}catch(_0x541bb9){return BPromise[_0x157f('0x26')](_0x541bb9);}return _0x2c2f1c[_0x157f('0x27')]();};}function saveUpdates(_0x3db138,_0x5f19e9){return function(_0x5eb519){if(_0x5eb519){return _0x5eb519[_0x157f('0x28')](_0x3db138)[_0x157f('0x29')](function(_0x41c041){return _0x41c041;});}return null;};}function handleEntityNotFound(_0x2a7c07,_0x2e7f14){return function(_0x5aa176){if(!_0x5aa176){_0x2a7c07[_0x157f('0x1c')](0x194);}return _0x5aa176;};}function handleError(_0x544d83,_0x4cf632){_0x4cf632=_0x4cf632||0x1f4;return function(_0x244d2b){logger[_0x157f('0x2a')](_0x244d2b[_0x157f('0x2b')]);if(_0x244d2b[_0x157f('0x2c')]){delete _0x244d2b[_0x157f('0x2c')];}_0x544d83[_0x157f('0x1d')](_0x4cf632)['send'](_0x244d2b);};}exports[_0x157f('0x2d')]=function(_0x248724,_0x2083f6){var _0x786518={},_0x2ac80d={},_0x1549fd={'count':0x0,'rows':[]};var _0x2f4dbe=_['map'](db[_0x157f('0x2e')]['rawAttributes'],function(_0x562317){return{'name':_0x562317[_0x157f('0x2f')],'type':_0x562317['type']['key']};});_0x2ac80d[_0x157f('0x30')]=_[_0x157f('0x31')](_0x2f4dbe,'name');_0x2ac80d[_0x157f('0x32')]=_[_0x157f('0x33')](_0x248724[_0x157f('0x32')]);_0x2ac80d[_0x157f('0x34')]=_['intersection'](_0x2ac80d[_0x157f('0x30')],_0x2ac80d[_0x157f('0x32')]);_0x786518[_0x157f('0x35')]=_[_0x157f('0x36')](_0x2ac80d[_0x157f('0x30')],qs[_0x157f('0x37')](_0x248724['query'][_0x157f('0x37')]));_0x786518[_0x157f('0x35')]=_0x786518['attributes'][_0x157f('0x38')]?_0x786518['attributes']:_0x2ac80d[_0x157f('0x30')];if(!_0x248724[_0x157f('0x32')][_0x157f('0x39')]('nolimit')){_0x786518[_0x157f('0x21')]=qs[_0x157f('0x21')](_0x248724[_0x157f('0x32')][_0x157f('0x21')]);_0x786518['offset']=qs['offset'](_0x248724[_0x157f('0x32')]['offset']);}_0x786518[_0x157f('0x3a')]=qs[_0x157f('0x3b')](_0x248724[_0x157f('0x32')]['sort']);_0x786518[_0x157f('0x3c')]=qs['filters'](_[_0x157f('0x3d')](_0x248724[_0x157f('0x32')],_0x2ac80d['filters']),_0x2f4dbe);if(_0x248724['query'][_0x157f('0x3e')]){_0x786518[_0x157f('0x3c')]=_[_0x157f('0x3f')](_0x786518['where'],{'$or':_[_0x157f('0x31')](_0x2f4dbe,function(_0x1f9186){if(_0x1f9186['type']!==_0x157f('0x40')){var _0x24f473={};_0x24f473[_0x1f9186[_0x157f('0x2c')]]={'$like':'%'+_0x248724[_0x157f('0x32')][_0x157f('0x3e')]+'%'};return _0x24f473;}})});}_0x786518=_[_0x157f('0x3f')]({},_0x786518,_0x248724[_0x157f('0x41')]);var _0x305604={'where':_0x786518[_0x157f('0x3c')]};return db[_0x157f('0x2e')][_0x157f('0x23')](_0x305604)['then'](function(_0xd199e4){_0x1549fd[_0x157f('0x23')]=_0xd199e4;if(_0x248724[_0x157f('0x32')][_0x157f('0x42')]){_0x786518['include']=[{'all':!![]}];}return db['Team'][_0x157f('0x43')](_0x786518);})[_0x157f('0x29')](function(_0x2d0a1a){_0x1549fd[_0x157f('0x44')]=_0x2d0a1a;return _0x1549fd;})['then'](respondWithFilteredResult(_0x2083f6,_0x786518))['catch'](handleError(_0x2083f6,null));};exports['show']=function(_0xe289b,_0x1147c4){var _0x56df84={'raw':![],'where':{'id':_0xe289b[_0x157f('0x45')]['id']}},_0x325161={};_0x325161[_0x157f('0x30')]=_[_0x157f('0x33')](db[_0x157f('0x2e')]['rawAttributes']);_0x325161[_0x157f('0x32')]=_[_0x157f('0x33')](_0xe289b[_0x157f('0x32')]);_0x325161['filters']=_[_0x157f('0x36')](_0x325161[_0x157f('0x30')],_0x325161['query']);_0x56df84[_0x157f('0x35')]=_['intersection'](_0x325161[_0x157f('0x30')],qs['fields'](_0xe289b[_0x157f('0x32')]['fields']));_0x56df84[_0x157f('0x35')]=_0x56df84[_0x157f('0x35')][_0x157f('0x38')]?_0x56df84[_0x157f('0x35')]:_0x325161[_0x157f('0x30')];if(_0xe289b[_0x157f('0x32')][_0x157f('0x42')]){_0x56df84[_0x157f('0x46')]=[{'all':!![]}];}_0x56df84=_[_0x157f('0x3f')]({},_0x56df84,_0xe289b['options']);return db['Team']['find'](_0x56df84)[_0x157f('0x29')](handleEntityNotFound(_0x1147c4,null))[_0x157f('0x29')](respondWithResult(_0x1147c4,null))['catch'](handleError(_0x1147c4,null));};exports[_0x157f('0x47')]=function(_0x1f825a,_0x537fca){return db[_0x157f('0x2e')][_0x157f('0x47')](_0x1f825a[_0x157f('0x48')],{})['then'](function(_0xd2c70d){var _0x3e78c3=_0x1f825a[_0x157f('0x49')][_0x157f('0x4a')]({'plain':!![]});if(!_0x3e78c3)throw new Error(_0x157f('0x4b'));if(_0x3e78c3[_0x157f('0x4c')]===_0x157f('0x49')){var _0x4bceb0=_0xd2c70d[_0x157f('0x4a')]({'plain':!![]});var _0x95bc46=_0x157f('0x4d');return db['UserProfileSection'][_0x157f('0x4e')]({'where':{'name':_0x95bc46,'userProfileId':_0x3e78c3[_0x157f('0x4f')]},'raw':!![]})['then'](function(_0x557a5b){if(_0x557a5b&&_0x557a5b[_0x157f('0x50')]===0x0){return db[_0x157f('0x51')]['create']({'name':_0x4bceb0[_0x157f('0x2c')],'resourceId':_0x4bceb0['id'],'type':_0x557a5b[_0x157f('0x2c')],'sectionId':_0x557a5b['id']},{})['then'](function(){return _0xd2c70d;});}else{return _0xd2c70d;}})['catch'](function(_0xef6f44){logger[_0x157f('0x2a')](_0x157f('0x52'),_0xef6f44);throw _0xef6f44;});}return _0xd2c70d;})[_0x157f('0x29')](respondWithResult(_0x537fca,0xc9))['catch'](handleError(_0x537fca,null));};exports[_0x157f('0x28')]=function(_0x1f4091,_0x3eddb1){if(_0x1f4091[_0x157f('0x48')]['id']){delete _0x1f4091['body']['id'];}return db['Team']['find']({'where':{'id':_0x1f4091[_0x157f('0x45')]['id']}})['then'](handleEntityNotFound(_0x3eddb1,null))[_0x157f('0x29')](saveUpdates(_0x1f4091['body'],null))['then'](respondWithResult(_0x3eddb1,null))[_0x157f('0x53')](handleError(_0x3eddb1,null));};exports[_0x157f('0x54')]=function(_0x41afec,_0x3ac634){var _0x42642e=_0x41afec[_0x157f('0x45')]['id'];var _0x104d41=[];return db[_0x157f('0x55')][_0x157f('0x56')](function(_0xa2f5bf){var _0x5c86a8=_0x157f('0x57')+_0x42642e;return db['sequelize']['query'](_0x5c86a8,{'type':db[_0x157f('0x58')]['QueryTypes'][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf})[_0x157f('0x29')](function(_0x47d1e6){_0x104d41=_[_0x157f('0x31')](_0x47d1e6,function(_0x5ec451){return Number(_0x5ec451['UserId']);});})[_0x157f('0x29')](function(){var _0x249daa=_0x157f('0x5a')+_0x42642e;return db['sequelize'][_0x157f('0x32')](_0x249daa,{'type':db['Sequelize'][_0x157f('0x5b')][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf});})['then'](function(_0x28a55d){var _0x1aaa14=_[_0x157f('0x31')](_0x28a55d,function(_0x48c1aa){return Number(_0x48c1aa[_0x157f('0x5c')]);});return db[_0x157f('0x5d')][_0x157f('0x54')]({'where':{'UserId':{'$in':_0x104d41},'VoiceQueueId':{'$in':_0x1aaa14}},'transaction':_0xa2f5bf});})['then'](function(){var _0x3a9dbc=_0x157f('0x5e')+_0x42642e;return db[_0x157f('0x55')][_0x157f('0x32')](_0x3a9dbc,{'type':db[_0x157f('0x58')][_0x157f('0x5b')][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(_0x18dfbf){var _0x40f6f2=_[_0x157f('0x31')](_0x18dfbf,function(_0x11a560){return Number(_0x11a560[_0x157f('0x5f')]);});return db[_0x157f('0x60')]['destroy']({'where':{'UserId':{'$in':_0x104d41},'MailQueueId':{'$in':_0x40f6f2}},'transaction':_0xa2f5bf});})['then'](function(){var _0x1c161e='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x42642e;return db[_0x157f('0x55')][_0x157f('0x32')](_0x1c161e,{'type':db[_0x157f('0x58')][_0x157f('0x5b')][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(_0x45b444){var _0x54ea2b=_['map'](_0x45b444,function(_0x4c09fb){return Number(_0x4c09fb['SmsQueueId']);});return db[_0x157f('0x61')][_0x157f('0x54')]({'where':{'UserId':{'$in':_0x104d41},'SmsQueueId':{'$in':_0x54ea2b}},'transaction':_0xa2f5bf});})['then'](function(){var _0xc51394=_0x157f('0x62')+_0x42642e;return db[_0x157f('0x55')]['query'](_0xc51394,{'type':db[_0x157f('0x58')]['QueryTypes'][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf});})['then'](function(_0x2f3f18){var _0x249933=_[_0x157f('0x31')](_0x2f3f18,function(_0x264929){return Number(_0x264929[_0x157f('0x63')]);});return db[_0x157f('0x64')][_0x157f('0x54')]({'where':{'UserId':{'$in':_0x104d41},'ChatQueueId':{'$in':_0x249933}},'transaction':_0xa2f5bf});})['then'](function(){var _0x2ae637=_0x157f('0x65')+_0x42642e;return db[_0x157f('0x55')][_0x157f('0x32')](_0x2ae637,{'type':db[_0x157f('0x58')][_0x157f('0x5b')][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(_0x36801a){var _0x9b10de=_['map'](_0x36801a,function(_0x553ae7){return Number(_0x553ae7[_0x157f('0x66')]);});return db[_0x157f('0x67')]['destroy']({'where':{'UserId':{'$in':_0x104d41},'FaxQueueId':{'$in':_0x9b10de}},'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(){var _0x33dada=_0x157f('0x68')+_0x42642e;return db[_0x157f('0x55')][_0x157f('0x32')](_0x33dada,{'type':db[_0x157f('0x58')]['QueryTypes'][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(_0x1983e6){var _0x39fb15=_['map'](_0x1983e6,function(_0x1af5b9){return Number(_0x1af5b9[_0x157f('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x104d41},'OpenchannelQueueId':{'$in':_0x39fb15}},'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(){var _0x33d8d5=_0x157f('0x6a')+_0x42642e;return db[_0x157f('0x55')][_0x157f('0x32')](_0x33d8d5,{'type':db[_0x157f('0x58')][_0x157f('0x5b')][_0x157f('0x59')],'raw':!![],'transaction':_0xa2f5bf});})['then'](function(_0x66076b){var _0x3d9aaf=_['map'](_0x66076b,function(_0x5b026a){return Number(_0x5b026a['WhatsappQueueId']);});return db[_0x157f('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x104d41},'WhatsappQueueId':{'$in':_0x3d9aaf}},'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(){return db[_0x157f('0x6c')][_0x157f('0x4e')]({'where':{'TeamId':_0x42642e}});})[_0x157f('0x29')](function(_0x33d548){if(_0x33d548===null){return;}return db[_0x157f('0x6d')][_0x157f('0x54')]({'where':{'UserId':{'$in':_0x104d41},'VoicePrefixId':_0x33d548[_0x157f('0x6e')]},'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(){return db['Team'][_0x157f('0x54')]({'where':{'id':_0x42642e},'cascade':!![],'transaction':_0xa2f5bf});})[_0x157f('0x29')](function(_0x84a73a){if(_0x84a73a===0x0){_0x3ac634[_0x157f('0x1c')](0x194);}else{return db[_0x157f('0x51')][_0x157f('0x54')]({'where':{'type':_0x157f('0x4d'),'resourceId':_0x42642e},'cascade':!![],'transaction':_0xa2f5bf})[_0x157f('0x29')](function(){_0x3ac634[_0x157f('0x1d')](0xcc)[_0x157f('0x1e')]();});}})[_0x157f('0x53')](function(_0x5a62e7){_0x3ac634[_0x157f('0x1d')](0x1f4)['send'](_0x5a62e7);});});};exports[_0x157f('0x6f')]=function(_0x3fb73f,_0x2f3aa6,_0x532c30){return db['Team'][_0x157f('0x70')]({'where':{'id':_0x3fb73f[_0x157f('0x45')]['id']}})[_0x157f('0x29')](handleEntityNotFound(_0x2f3aa6,null))['then'](function(_0x273400){if(!_0x3fb73f[_0x157f('0x32')][_0x157f('0x71')]||!utils[_0x157f('0x72')](_0x3fb73f[_0x157f('0x32')][_0x157f('0x71')])){throw new db[(_0x157f('0x58'))][(_0x157f('0x73'))](_0x157f('0x74'));}var _0x29ef63={};var _0x29011f={};_0x29011f[_0x157f('0x30')]=_['keys'](db[_['capitalize'](_0x3fb73f[_0x157f('0x32')]['channel'][_0x157f('0x75')]())+'Queue'][_0x157f('0x76')]);_0x29011f[_0x157f('0x32')]=_[_0x157f('0x33')](_0x3fb73f[_0x157f('0x32')]);_0x29011f[_0x157f('0x34')]=_[_0x157f('0x36')](_0x29011f[_0x157f('0x30')],_0x29011f[_0x157f('0x32')]);_0x29ef63[_0x157f('0x35')]=_[_0x157f('0x36')](_0x29011f['model'],qs[_0x157f('0x37')](_0x3fb73f[_0x157f('0x32')][_0x157f('0x37')]));_0x29ef63['attributes']=_0x29ef63[_0x157f('0x35')][_0x157f('0x38')]?_0x29ef63[_0x157f('0x35')]:_0x29011f[_0x157f('0x30')];_0x29ef63[_0x157f('0x21')]=qs[_0x157f('0x21')](_0x3fb73f['query'][_0x157f('0x21')]);_0x29ef63[_0x157f('0x20')]=qs[_0x157f('0x20')](_0x3fb73f[_0x157f('0x32')]['offset']);_0x29ef63['order']=qs[_0x157f('0x3b')](_0x3fb73f[_0x157f('0x32')][_0x157f('0x3b')]);_0x29ef63[_0x157f('0x3c')]=qs['filters'](_[_0x157f('0x3d')](_0x3fb73f[_0x157f('0x32')],_0x29011f[_0x157f('0x34')]));_0x29ef63=_[_0x157f('0x3f')]({},_0x29ef63,_0x3fb73f['options']);return _0x273400['get'+_[_0x157f('0x77')](_0x3fb73f[_0x157f('0x32')][_0x157f('0x71')]['toLowerCase']())+_0x157f('0x78')](_0x29ef63);})[_0x157f('0x29')](respondWithResult(_0x2f3aa6,null))['catch'](handleError(_0x2f3aa6,null));};exports['addQueues']=function(_0x4f07a5,_0x32ec5a,_0x2dd9fb){return db[_0x157f('0x2e')]['findOne']({'where':{'id':_0x4f07a5[_0x157f('0x45')]['id']}})[_0x157f('0x29')](function(_0x1cd907){if(_0x1cd907){if(!_0x4f07a5['body'][_0x157f('0x71')]||!utils['isValidChannel'](_0x4f07a5[_0x157f('0x48')][_0x157f('0x71')])){throw new db[(_0x157f('0x58'))]['ValidationError'](_0x157f('0x74'));}return _0x1cd907[_0x157f('0x79')+_[_0x157f('0x77')](_0x4f07a5[_0x157f('0x48')][_0x157f('0x71')]['toLowerCase']())+_0x157f('0x78')](_0x4f07a5[_0x157f('0x48')][_0x157f('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x32ec5a,null))[_0x157f('0x29')](respondWithStatusCode(_0x32ec5a,null))[_0x157f('0x53')](handleError(_0x32ec5a,null));};exports[_0x157f('0x7b')]=function(_0x3791dc,_0x48d8e2,_0x4f58f6){return db['Team']['findOne']({'where':{'id':_0x3791dc[_0x157f('0x45')]['id']}})[_0x157f('0x29')](function(_0x80a71a){if(_0x80a71a){if(!_0x3791dc[_0x157f('0x32')]['channel']||!utils['isValidChannel'](_0x3791dc['query'][_0x157f('0x71')])){throw new db[(_0x157f('0x58'))][(_0x157f('0x73'))](_0x157f('0x74'));}return _0x80a71a[_0x157f('0x7c')+_['capitalize'](_0x3791dc[_0x157f('0x32')][_0x157f('0x71')][_0x157f('0x75')]())+'Queues'](_0x3791dc['query'][_0x157f('0x7a')]);}return null;})[_0x157f('0x29')](handleEntityNotFound(_0x48d8e2,null))[_0x157f('0x29')](respondWithStatusCode(_0x48d8e2,null))[_0x157f('0x53')](handleError(_0x48d8e2,null));};exports[_0x157f('0x7d')]=function(_0x5956f9,_0x65f38b){var _0x5a2f69=_[_0x157f('0x7e')](_0x5956f9['body'][_0x157f('0x7a')])?_0x5956f9['body'][_0x157f('0x7a')]:[_0x5956f9[_0x157f('0x48')]['ids']];var _0x4d6b6b=_0x5956f9[_0x157f('0x45')]['id'];return db[_0x157f('0x2e')][_0x157f('0x4e')]({'where':{'id':_0x4d6b6b}})[_0x157f('0x29')](handleEntityNotFound(_0x65f38b,null))[_0x157f('0x29')](function(_0x11cb5a){if(_0x11cb5a){var _0xdf2bc6=[_0x157f('0x7f'),_0x157f('0x80'),_0x157f('0x81'),_0x157f('0x82'),'Fax',_0x157f('0x83'),_0x157f('0x84')];return db[_0x157f('0x55')]['transaction'](function(_0x42c45b){var _0x3a6f94=_[_0x157f('0x31')](_0xdf2bc6,function(_0x1cbd04){var _0x4856a6={'attributes':['id','name']};if(_0x1cbd04==='Voice'){_0x4856a6[_0x157f('0x85')]={'attributes':[_0x157f('0x86')]};}return _0x11cb5a[_0x157f('0x4a')+_0x1cbd04+_0x157f('0x78')](_0x4856a6)[_0x157f('0x29')](function(_0x1ab904){var _0xcca2ca=_[_0x157f('0x31')](_0x1ab904,function(_0x361dfb){var _0x25c318=_[_0x157f('0x31')](_0x5a2f69,function(_0x225b58){var _0x7e7da3={'where':{'UserId':_0x225b58,[_0x1cbd04+_0x157f('0x87')]:_0x361dfb['id']},'transaction':_0x42c45b};if(_0x1cbd04===_0x157f('0x7f')){_0x7e7da3[_0x157f('0x18')]={'penalty':_0x361dfb['TeamVoiceQueue'][_0x157f('0x86')]};}return db['User'+_0x1cbd04+'Queue'][_0x157f('0x88')](_0x7e7da3)[_0x157f('0x29')](function(){socket[_0x157f('0x89')]('user'+_0x1cbd04+_0x157f('0x8a'),{'UserId':_0x225b58,[_0x1cbd04+_0x157f('0x87')]:_0x361dfb['id']});if(_0x1cbd04!==_0x157f('0x7f')){return;}return db[_0x157f('0x8b')][_0x157f('0x43')]({'where':{'id':_0x5a2f69,'online':0x1},'attributes':['id',_0x157f('0x2c'),_0x157f('0x8c'),_0x157f('0x8d'),_0x157f('0x8e')],'raw':!![]})[_0x157f('0x29')](function(_0x1cfc9a){var _0x10f11c=_[_0x157f('0x31')](_0x1cfc9a,function(_0x395db9){return db[_0x157f('0x8f')][_0x157f('0x90')]({'membername':_0x395db9['name'],'UserId':_0x395db9['id'],'queue_name':_0x361dfb[_0x157f('0x2c')],'VoiceQueueId':_0x361dfb['id'],'interface':_[_0x157f('0x91')](_0x395db9[_0x157f('0x8e')])?util[_0x157f('0x92')](_0x157f('0x93'),_0x395db9[_0x157f('0x2c')]):_0x395db9['interface'],'paused':_0x395db9[_0x157f('0x8d')]||![],'penalty':_0x361dfb['TeamVoiceQueue'][_0x157f('0x86')]},{'transaction':_0x42c45b});});return Promise[_0x157f('0x94')](_0x10f11c);});});});return Promise[_0x157f('0x94')](_0x25c318);});return Promise[_0x157f('0x94')](_0xcca2ca);})[_0x157f('0x29')](function(){return db['TeamVoicePrefix'][_0x157f('0x70')]({'where':{'teamId':_0x4d6b6b}})[_0x157f('0x29')](function(_0x3ddc98){if(_0x3ddc98){var _0x38d36e=_['map'](_0x5a2f69,function(_0x2e8d37){db[_0x157f('0x6d')][_0x157f('0x90')]({'UserId':_0x2e8d37,'VoicePrefixId':_0x3ddc98[_0x157f('0x6e')]});});return Promise[_0x157f('0x94')](_0x38d36e);}});});});return Promise['all'](_0x3a6f94)[_0x157f('0x29')](function(){return _0x11cb5a[_0x157f('0x7d')](_0x5a2f69,{'transaction':_0x42c45b})['spread'](function(_0x5d4a68){return _0x5d4a68;});});});}})[_0x157f('0x29')](respondWithResult(_0x65f38b,null))['catch'](handleError(_0x65f38b,null));};exports[_0x157f('0x95')]=function(_0x2275ff,_0x24a0d5){var _0x4cecfa=_['isArray'](_0x2275ff[_0x157f('0x32')]['ids'])?_0x2275ff[_0x157f('0x32')]['ids']:[_0x2275ff[_0x157f('0x32')][_0x157f('0x7a')]];var _0x5f50a5=_0x2275ff[_0x157f('0x45')]['id'];return db[_0x157f('0x2e')][_0x157f('0x4e')]({'where':{'id':_0x5f50a5}})[_0x157f('0x29')](handleEntityNotFound(_0x24a0d5,null))[_0x157f('0x29')](function(_0x494b44){if(_0x494b44){var _0x270a35=[_0x157f('0x7f'),_0x157f('0x80'),_0x157f('0x81'),_0x157f('0x82'),_0x157f('0x96'),_0x157f('0x83'),_0x157f('0x84')];return db[_0x157f('0x55')][_0x157f('0x56')](function(_0xd58710){var _0x5d65b2=_[_0x157f('0x31')](_0x270a35,function(_0x45a631){var _0x2ac3c7={'attributes':['id',_0x157f('0x2c')]};return _0x494b44['get'+_0x45a631+_0x157f('0x78')](_0x2ac3c7)['then'](function(_0x6cd727){var _0x3aa446=_['map'](_0x6cd727,function(_0x4e3db7){return _0x4e3db7[_0x157f('0x95')](_0x4cecfa,{'transaction':_0xd58710})[_0x157f('0x29')](function(){var _0x1000cd=_['map'](_0x4cecfa,function(_0x125307){socket['emit'](_0x157f('0x49')+_0x45a631+'Queue:remove',{'UserId':Number(_0x125307),[_0x45a631+_0x157f('0x87')]:_0x4e3db7['id']});if(_0x45a631!==_0x157f('0x7f')){return;}return db[_0x157f('0x8f')][_0x157f('0x54')]({'where':{'VoiceQueueId':_0x4e3db7['id'],'UserId':_0x125307},'transaction':_0xd58710});});return Promise[_0x157f('0x94')](_0x1000cd);});});return Promise[_0x157f('0x94')](_0x3aa446);});});return Promise[_0x157f('0x94')](_0x5d65b2)[_0x157f('0x29')](function(){return _0x494b44[_0x157f('0x95')](_0x4cecfa,{'transaction':_0xd58710});})[_0x157f('0x29')](function(){return db[_0x157f('0x6c')][_0x157f('0x70')]({'where':{'teamId':_0x5f50a5}})[_0x157f('0x29')](function(_0x2735ab){if(_0x2735ab){var _0x5ef772=_[_0x157f('0x31')](_0x4cecfa,function(_0x186122){db[_0x157f('0x6d')][_0x157f('0x54')]({'where':{'UserId':_0x186122,'VoicePrefixId':_0x2735ab['VoicePrefixId']}});});return Promise[_0x157f('0x94')](_0x5ef772);}});});});}})[_0x157f('0x29')](respondWithStatusCode(_0x24a0d5,null))[_0x157f('0x53')](handleError(_0x24a0d5,null));};exports['getAgents']=function(_0x454613,_0x2ae736,_0x219203){var _0x549cb2={};var _0x4fb423={};var _0xa88110;var _0x3c6357;return db[_0x157f('0x2e')][_0x157f('0x70')]({'where':{'id':_0x454613[_0x157f('0x45')]['id']}})[_0x157f('0x29')](handleEntityNotFound(_0x2ae736,null))[_0x157f('0x29')](function(_0xccbab1){if(_0xccbab1){_0xa88110=_0xccbab1;_0x4fb423[_0x157f('0x30')]=_[_0x157f('0x33')](db[_0x157f('0x8b')][_0x157f('0x76')]);_0x4fb423[_0x157f('0x32')]=_[_0x157f('0x33')](_0x454613['query']);_0x4fb423['filters']=_[_0x157f('0x36')](_0x4fb423[_0x157f('0x30')],_0x4fb423[_0x157f('0x32')]);_0x549cb2[_0x157f('0x35')]=_[_0x157f('0x36')](_0x4fb423['model'],qs[_0x157f('0x37')](_0x454613[_0x157f('0x32')][_0x157f('0x37')]));_0x549cb2[_0x157f('0x35')]=_0x549cb2[_0x157f('0x35')][_0x157f('0x38')]?_0x549cb2[_0x157f('0x35')]:_0x4fb423[_0x157f('0x30')];_0x549cb2[_0x157f('0x3a')]=qs[_0x157f('0x3b')](_0x454613[_0x157f('0x32')][_0x157f('0x3b')]);_0x549cb2[_0x157f('0x3c')]=qs[_0x157f('0x34')](_[_0x157f('0x3d')](_0x454613['query'],_0x4fb423['filters']));if(_0x454613[_0x157f('0x32')][_0x157f('0x3e')]){_0x549cb2[_0x157f('0x3c')]=_['merge'](_0x549cb2[_0x157f('0x3c')],{'$or':_['map'](_0x549cb2[_0x157f('0x35')],function(_0x36df6b){var _0x35c44e={};_0x35c44e[_0x36df6b]={'$like':'%'+_0x454613[_0x157f('0x32')]['filter']+'%'};return _0x35c44e;})});}_0x549cb2=_[_0x157f('0x3f')]({},_0x549cb2,_0x454613[_0x157f('0x41')]);return _0xa88110['getAgents'](_0x549cb2);}})[_0x157f('0x29')](function(_0x2f12fe){if(_0x2f12fe){_0x3c6357=_0x2f12fe['length'];if(!_0x454613['query'][_0x157f('0x39')](_0x157f('0x97'))){_0x549cb2[_0x157f('0x21')]=qs[_0x157f('0x21')](_0x454613[_0x157f('0x32')]['limit']);_0x549cb2['offset']=qs[_0x157f('0x20')](_0x454613[_0x157f('0x32')][_0x157f('0x20')]);}return _0xa88110[_0x157f('0x98')](_0x549cb2);}})[_0x157f('0x29')](function(_0x482dd8){if(_0x482dd8){return _0x482dd8?{'count':_0x3c6357,'rows':_0x482dd8}:null;}})[_0x157f('0x29')](respondWithResult(_0x2ae736,null))['catch'](handleError(_0x2ae736,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b4eb66d..24e6f81 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 _0x621f=['update','emit','exports','events','Team','setMaxListeners','save'];(function(_0x521204,_0x141bd9){var _0x28f5c5=function(_0x36f94c){while(--_0x36f94c){_0x521204['push'](_0x521204['shift']());}};_0x28f5c5(++_0x141bd9);}(_0x621f,0x137));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf621('0x0'));var Team=require('../../mysqldb')['db'][_0xf621('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xf621('0x2')](0x0);var events={'afterCreate':_0xf621('0x3'),'afterUpdate':_0xf621('0x4'),'afterDestroy':'remove'};function emitEvent(_0x515cec){return function(_0x46944a,_0x401059,_0x596288){TeamEvents[_0xf621('0x5')](_0x515cec+':'+_0x46944a['id'],_0x46944a);TeamEvents[_0xf621('0x5')](_0x515cec,_0x46944a);_0x596288(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xf621('0x6')]=TeamEvents; \ No newline at end of file +var _0xa116=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','Team','setMaxListeners','save'];(function(_0x411925,_0x1d9a78){var _0x13ef11=function(_0x56ca71){while(--_0x56ca71){_0x411925['push'](_0x411925['shift']());}};_0x13ef11(++_0x1d9a78);}(_0xa116,0x1d0));var _0x6a11=function(_0x141c1f,_0x263186){_0x141c1f=_0x141c1f-0x0;var _0x1e3e01=_0xa116[_0x141c1f];return _0x1e3e01;};'use strict';var EventEmitter=require('events');var Team=require(_0x6a11('0x0'))['db'][_0x6a11('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x6a11('0x2')](0x0);var events={'afterCreate':_0x6a11('0x3'),'afterUpdate':_0x6a11('0x4'),'afterDestroy':_0x6a11('0x5')};function emitEvent(_0x1b9e16){return function(_0x5232ac,_0x19b7d1,_0xd2ecdb){TeamEvents[_0x6a11('0x6')](_0x1b9e16+':'+_0x5232ac['id'],_0x5232ac);TeamEvents['emit'](_0x1b9e16,_0x5232ac);_0xd2ecdb(null);};}for(var e in events){if(events[_0x6a11('0x7')](e)){var event=events[e];Team[_0x6a11('0x8')](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 d5c8f18..e869aa4 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 _0xddab=['Queues','map','channel','catch','exports','define','Team','Chat','Fax','Mail','Openchannel','Sms','then','all','lodash','./team.attributes','get'];(function(_0x5d77fb,_0x2616e8){var _0x270181=function(_0x3ab093){while(--_0x3ab093){_0x5d77fb['push'](_0x5d77fb['shift']());}};_0x270181(++_0x2616e8);}(_0xddab,0x195));var _0xbdda=function(_0x5bc534,_0xc39d1a){_0x5bc534=_0x5bc534-0x0;var _0x134075=_0xddab[_0x5bc534];return _0x134075;};'use strict';var _=require(_0xbdda('0x0'));var attributes=require(_0xbdda('0x1'));function getQueuesByChannel(_0x3e8e7c,_0x57d392){var _0x5bfcf0=_0xbdda('0x2')+_0x57d392+_0xbdda('0x3');return _0x3e8e7c[_0x5bfcf0]()['then'](function(_0x5968c2){return _[_0xbdda('0x4')](_0x5968c2,function(_0x4ab810){_0x4ab810['setDataValue'](_0xbdda('0x5'),_0x57d392);return _0x4ab810;});})[_0xbdda('0x6')](function(_0x16dfa4){throw _0x16dfa4;});}module[_0xbdda('0x7')]=function(_0x4cc98a){return _0x4cc98a[_0xbdda('0x8')](_0xbdda('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4a08d2=this;var _0x44bcbe=[_0xbdda('0xa'),_0xbdda('0xb'),_0xbdda('0xc'),_0xbdda('0xd'),_0xbdda('0xe'),'Voice','Whatsapp'];return Promise['resolve']()[_0xbdda('0xf')](function(){var _0x9f3fc4=_['map'](_0x44bcbe,function(_0x1bdf07){return getQueuesByChannel(_0x4a08d2,_0x1bdf07);});return Promise[_0xbdda('0x10')](_0x9f3fc4);})['catch'](function(_0x42afcb){throw _0x42afcb;});}}});}; \ No newline at end of file +var _0x7755=['define','teams','Fax','Mail','Openchannel','Voice','Whatsapp','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch','exports'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x7755,0xf6));var _0x5775=function(_0x4f4c11,_0xdb6add){_0x4f4c11=_0x4f4c11-0x0;var _0x4dfd33=_0x7755[_0x4f4c11];return _0x4dfd33;};'use strict';var _=require(_0x5775('0x0'));var attributes=require(_0x5775('0x1'));function getQueuesByChannel(_0x282f9c,_0x54327a){var _0x261e40=_0x5775('0x2')+_0x54327a+_0x5775('0x3');return _0x282f9c[_0x261e40]()[_0x5775('0x4')](function(_0x3dfb36){return _[_0x5775('0x5')](_0x3dfb36,function(_0x487876){_0x487876[_0x5775('0x6')]('channel',_0x54327a);return _0x487876;});})[_0x5775('0x7')](function(_0x81e2e5){throw _0x81e2e5;});}module[_0x5775('0x8')]=function(_0x4baa45){return _0x4baa45[_0x5775('0x9')]('Team',attributes,{'tableName':_0x5775('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5600c7=this;var _0x58bf0c=['Chat',_0x5775('0xb'),_0x5775('0xc'),_0x5775('0xd'),'Sms',_0x5775('0xe'),_0x5775('0xf')];return Promise['resolve']()[_0x5775('0x4')](function(){var _0x55d9bb=_[_0x5775('0x5')](_0x58bf0c,function(_0x4a6249){return getQueuesByChannel(_0x5600c7,_0x4a6249);});return Promise[_0x5775('0x10')](_0x55d9bb);})['catch'](function(_0x770183){throw _0x770183;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d0da812..88b92e5 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 _0xb04c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','Team,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x432bdc,_0x500534){var _0x44e665=function(_0x12ddc4){while(--_0x12ddc4){_0x432bdc['push'](_0x432bdc['shift']());}};_0x44e665(++_0x500534);}(_0xb04c,0x109));var _0xcb04=function(_0x41531f,_0x50fb91){_0x41531f=_0x41531f-0x0;var _0x11dbd1=_0xb04c[_0x41531f];return _0x11dbd1;};'use strict';var _=require(_0xcb04('0x0'));var util=require(_0xcb04('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb04('0x2'));var fs=require('fs');var Redis=require(_0xcb04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb04('0x4'));var logger=require(_0xcb04('0x5'))(_0xcb04('0x6'));var config=require(_0xcb04('0x7'));var jayson=require(_0xcb04('0x8'));var client=jayson[_0xcb04('0x9')]['http']({'port':0x232a});config[_0xcb04('0xa')]=_[_0xcb04('0xb')](config['redis'],{'host':_0xcb04('0xc'),'port':0x18eb});var socket=require(_0xcb04('0xd'))(new Redis(config[_0xcb04('0xa')]));require(_0xcb04('0xe'))[_0xcb04('0xf')](socket);function respondWithRpcPromise(_0x3c1373,_0x385866,_0x380a97){return new BPromise(function(_0x57823b,_0x2379ad){return client[_0xcb04('0x10')](_0x3c1373,_0x380a97)[_0xcb04('0x11')](function(_0x474a11){logger[_0xcb04('0x12')]('Team,\x20%s,\x20%s',_0x385866,_0xcb04('0x13'));logger[_0xcb04('0x14')](_0xcb04('0x15'),_0x385866,_0xcb04('0x13'),JSON['stringify'](_0x474a11));if(_0x474a11[_0xcb04('0x16')]){if(_0x474a11[_0xcb04('0x16')]['code']===0x1f4){logger[_0xcb04('0x16')]('Team,\x20%s,\x20%s',_0x385866,_0x474a11[_0xcb04('0x16')]['message']);return _0x2379ad(_0x474a11[_0xcb04('0x16')][_0xcb04('0x17')]);}logger['error'](_0xcb04('0x18'),_0x385866,_0x474a11[_0xcb04('0x16')][_0xcb04('0x17')]);return _0x57823b(_0x474a11[_0xcb04('0x16')][_0xcb04('0x17')]);}else{logger[_0xcb04('0x12')](_0xcb04('0x18'),_0x385866,_0xcb04('0x13'));_0x57823b(_0x474a11[_0xcb04('0x19')][_0xcb04('0x17')]);}})[_0xcb04('0x1a')](function(_0x41c60b){logger[_0xcb04('0x16')]('Team,\x20%s,\x20%s',_0x385866,_0x41c60b);_0x2379ad(_0x41c60b);});});} \ No newline at end of file +var _0xbb99=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x403058,_0x4accee){var _0xed5f10=function(_0xd0a6ff){while(--_0xd0a6ff){_0x403058['push'](_0x403058['shift']());}};_0xed5f10(++_0x4accee);}(_0xbb99,0x1ec));var _0x9bb9=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xbb99[_0x4de586];return _0x46baf5;};'use strict';var _=require(_0x9bb9('0x0'));var util=require(_0x9bb9('0x1'));var moment=require(_0x9bb9('0x2'));var BPromise=require(_0x9bb9('0x3'));var rs=require(_0x9bb9('0x4'));var fs=require('fs');var Redis=require(_0x9bb9('0x5'));var db=require(_0x9bb9('0x6'))['db'];var utils=require(_0x9bb9('0x7'));var logger=require(_0x9bb9('0x8'))(_0x9bb9('0x9'));var config=require(_0x9bb9('0xa'));var jayson=require(_0x9bb9('0xb'));var client=jayson['client'][_0x9bb9('0xc')]({'port':0x232a});config['redis']=_[_0x9bb9('0xd')](config[_0x9bb9('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bb9('0xe')]));require(_0x9bb9('0xf'))[_0x9bb9('0x10')](socket);function respondWithRpcPromise(_0x37a827,_0x1174b8,_0x503165){return new BPromise(function(_0x49f693,_0x10fd36){return client[_0x9bb9('0x11')](_0x37a827,_0x503165)[_0x9bb9('0x12')](function(_0x1a30dc){logger[_0x9bb9('0x13')](_0x9bb9('0x14'),_0x1174b8,_0x9bb9('0x15'));logger[_0x9bb9('0x16')](_0x9bb9('0x17'),_0x1174b8,_0x9bb9('0x15'),JSON['stringify'](_0x1a30dc));if(_0x1a30dc[_0x9bb9('0x18')]){if(_0x1a30dc['error'][_0x9bb9('0x19')]===0x1f4){logger[_0x9bb9('0x18')](_0x9bb9('0x14'),_0x1174b8,_0x1a30dc[_0x9bb9('0x18')][_0x9bb9('0x1a')]);return _0x10fd36(_0x1a30dc[_0x9bb9('0x18')][_0x9bb9('0x1a')]);}logger[_0x9bb9('0x18')](_0x9bb9('0x14'),_0x1174b8,_0x1a30dc[_0x9bb9('0x18')]['message']);return _0x49f693(_0x1a30dc[_0x9bb9('0x18')][_0x9bb9('0x1a')]);}else{logger[_0x9bb9('0x13')](_0x9bb9('0x14'),_0x1174b8,'request\x20sent');_0x49f693(_0x1a30dc[_0x9bb9('0x1b')]['message']);}})[_0x9bb9('0x1c')](function(_0x12781d){logger[_0x9bb9('0x18')]('Team,\x20%s,\x20%s',_0x1174b8,_0x12781d);_0x10fd36(_0x12781d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 635b436..32fc989 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 _0xe3c9=['removeListener','length','team:','save','update','emit'];(function(_0x12d1ad,_0x13833b){var _0x433816=function(_0x5b45f4){while(--_0x5b45f4){_0x12d1ad['push'](_0x12d1ad['shift']());}};_0x433816(++_0x13833b);}(_0xe3c9,0x1ad));var _0x9e3c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe3c9[_0x13e741];return _0x3f8bb3;};'use strict';var TeamEvents=require('./team.events');var events=[_0x9e3c('0x0'),'remove',_0x9e3c('0x1')];function createListener(_0x1a0602,_0x3b8dde){return function(_0x506a5a){_0x3b8dde[_0x9e3c('0x2')](_0x1a0602,_0x506a5a);};}function removeListener(_0x3532a7,_0x3dd874){return function(){TeamEvents[_0x9e3c('0x3')](_0x3532a7,_0x3dd874);};}exports['register']=function(_0x344bd1){for(var _0xd6e54e=0x0,_0x5347cb=events[_0x9e3c('0x4')];_0xd6e54e<_0x5347cb;_0xd6e54e++){var _0x335e99=events[_0xd6e54e];var _0x59a631=createListener(_0x9e3c('0x5')+_0x335e99,_0x344bd1);TeamEvents['on'](_0x335e99,_0x59a631);}}; \ No newline at end of file +var _0x20a3=['remove','update','removeListener','register','team:','./team.events'];(function(_0x1bb774,_0x3a3f23){var _0x197da7=function(_0x2f9440){while(--_0x2f9440){_0x1bb774['push'](_0x1bb774['shift']());}};_0x197da7(++_0x3a3f23);}(_0x20a3,0x15b));var _0x320a=function(_0x2d3711,_0x43d60d){_0x2d3711=_0x2d3711-0x0;var _0x477858=_0x20a3[_0x2d3711];return _0x477858;};'use strict';var TeamEvents=require(_0x320a('0x0'));var events=['save',_0x320a('0x1'),_0x320a('0x2')];function createListener(_0x10e96b,_0x4e93fe){return function(_0x55c4fc){_0x4e93fe['emit'](_0x10e96b,_0x55c4fc);};}function removeListener(_0x33337d,_0x1a2ed1){return function(){TeamEvents[_0x320a('0x3')](_0x33337d,_0x1a2ed1);};}exports[_0x320a('0x4')]=function(_0x29c229){for(var _0x2d7eb=0x0,_0x5284af=events['length'];_0x2d7eb<_0x5284af;_0x2d7eb++){var _0xe77a45=events[_0x2d7eb];var _0x304ccc=createListener(_0x320a('0x5')+_0xe77a45,_0x29c229);TeamEvents['on'](_0xe77a45,_0x304ccc);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index bb3b005..cbbf580 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 _0x4e3c=['exports','INTEGER'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0x4e3c,0x1b4));var _0xc4e3=function(_0x1f5834,_0x421950){_0x1f5834=_0x1f5834-0x0;var _0x418e31=_0x4e3c[_0x1f5834];return _0x418e31;};'use strict';var Sequelize=require('sequelize');module[_0xc4e3('0x0')]={'TeamId':{'type':Sequelize[_0xc4e3('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x94cc=['INTEGER','sequelize','exports'];(function(_0x1a0158,_0x15cee7){var _0x13bc2a=function(_0x45b047){while(--_0x45b047){_0x1a0158['push'](_0x1a0158['shift']());}};_0x13bc2a(++_0x15cee7);}(_0x94cc,0x133));var _0xc94c=function(_0x4e00ae,_0x4749c6){_0x4e00ae=_0x4e00ae-0x0;var _0x35ac24=_0x94cc[_0x4e00ae];return _0x35ac24;};'use strict';var Sequelize=require(_0xc94c('0x0'));module[_0xc94c('0x1')]={'TeamId':{'type':Sequelize[_0xc94c('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xc94c('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 9f7fbd6..8c68fc2 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 _0xae60=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x473ab1,_0x546984){var _0x7e6eed=function(_0xcfb55f){while(--_0xcfb55f){_0x473ab1['push'](_0x473ab1['shift']());}};_0x7e6eed(++_0x546984);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xae60[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('api');var moment=require(_0x0ae6('0x3'));var BPromise=require(_0x0ae6('0x4'));var rp=require(_0x0ae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x0ae6('0x8')]=function(_0x25ac7c,_0x30e000){return _0x25ac7c[_0x0ae6('0x9')](_0x0ae6('0xa'),attributes,{'tableName':_0x0ae6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','team_has_voice_prefixes','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e40dd,_0x36b960){var _0x29ccb7=function(_0x2d0a4e){while(--_0x2d0a4e){_0x1e40dd['push'](_0x1e40dd['shift']());}};_0x29ccb7(++_0x36b960);}(_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('./teamVoicePrefix.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('TeamVoicePrefix',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ce14ad8..9570fb4 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x9e54c5,_0x7d72a5){var _0x4b8bad=function(_0x5522d1){while(--_0x5522d1){_0x9e54c5['push'](_0x9e54c5['shift']());}};_0x4b8bad(++_0x7d72a5);}(_0x70e0,0x17b));var _0x070e=function(_0x46f001,_0x34b36b){_0x46f001=_0x46f001-0x0;var _0x5a7e51=_0x70e0[_0x46f001];return _0x5a7e51;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2f84736..c51c84b 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 _0xb828=['sequelize','INTEGER'];(function(_0x51ee5d,_0x2cb75d){var _0x57346c=function(_0x1969b8){while(--_0x1969b8){_0x51ee5d['push'](_0x51ee5d['shift']());}};_0x57346c(++_0x2cb75d);}(_0xb828,0x9e));var _0x8b82=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xb828[_0x8c1005];return _0x175354;};'use strict';var Sequelize=require(_0x8b82('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8b82('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x60da=['exports','INTEGER','sequelize'];(function(_0x353bbb,_0x56e1ab){var _0x4e6a0e=function(_0x2e1703){while(--_0x2e1703){_0x353bbb['push'](_0x353bbb['shift']());}};_0x4e6a0e(++_0x56e1ab);}(_0x60da,0x161));var _0xa60d=function(_0x59f04b,_0x68da87){_0x59f04b=_0x59f04b-0x0;var _0x277e91=_0x60da[_0x59f04b];return _0x277e91;};'use strict';var Sequelize=require(_0xa60d('0x0'));module[_0xa60d('0x1')]={'penalty':{'type':Sequelize[_0xa60d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 46f4bb4..4fcd87f 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 _0xcf1c=['moment','bluebird','request-promise','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xcf1c,0x18d));var _0xccf1=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xcf1c[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require(_0xccf1('0x0'));var util=require(_0xccf1('0x1'));var logger=require('../../config/logger')(_0xccf1('0x2'));var moment=require(_0xccf1('0x3'));var BPromise=require(_0xccf1('0x4'));var rp=require(_0xccf1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xccf1('0x6'));module['exports']=function(_0x17e358,_0x2ee316){return _0x17e358[_0xccf1('0x7')](_0xccf1('0x8'),attributes,{'tableName':_0xccf1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f75=['path','rimraf','../../config/environment','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','request-promise'];(function(_0xbc80cb,_0xa494a9){var _0x405849=function(_0x2c7433){while(--_0x2c7433){_0xbc80cb['push'](_0xbc80cb['shift']());}};_0x405849(++_0xa494a9);}(_0x9f75,0x15a));var _0x59f7=function(_0x3b08be,_0x18e06e){_0x3b08be=_0x3b08be-0x0;var _0x109e95=_0x9f75[_0x3b08be];return _0x109e95;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59f7('0x3'));var fs=require('fs');var path=require(_0x59f7('0x4'));var rimraf=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x59f7('0x7')]=function(_0x278f11,_0x5485fa){return _0x278f11['define'](_0x59f7('0x8'),attributes,{'tableName':_0x59f7('0x9'),'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 057d12e..16c108b 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 _0x5afe=['jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x33155a,_0x1c4a6e){var _0x31c14f=function(_0x5f2b51){while(--_0x5f2b51){_0x33155a['push'](_0x33155a['shift']());}};_0x31c14f(++_0x1c4a6e);}(_0x5afe,0x1ab));var _0xe5af=function(_0x2cf702,_0x333323){_0x2cf702=_0x2cf702-0x0;var _0x15f7a6=_0x5afe[_0x2cf702];return _0x15f7a6;};'use strict';var _=require(_0xe5af('0x0'));var util=require(_0xe5af('0x1'));var moment=require(_0xe5af('0x2'));var BPromise=require(_0xe5af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5af('0x4'));var db=require(_0xe5af('0x5'))['db'];var utils=require(_0xe5af('0x6'));var logger=require(_0xe5af('0x7'))(_0xe5af('0x8'));var config=require(_0xe5af('0x9'));var jayson=require(_0xe5af('0xa'));var client=jayson[_0xe5af('0xb')][_0xe5af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f5d82,_0x5737c2,_0x2161df){return new BPromise(function(_0x1cc1f3,_0x4876a3){return client['request'](_0x4f5d82,_0x2161df)[_0xe5af('0xd')](function(_0x7e621c){logger[_0xe5af('0xe')](_0xe5af('0xf'),_0x5737c2,_0xe5af('0x10'));logger[_0xe5af('0x11')](_0xe5af('0x12'),_0x5737c2,'request\x20sent',JSON['stringify'](_0x7e621c));if(_0x7e621c[_0xe5af('0x13')]){if(_0x7e621c[_0xe5af('0x13')][_0xe5af('0x14')]===0x1f4){logger[_0xe5af('0x13')](_0xe5af('0xf'),_0x5737c2,_0x7e621c[_0xe5af('0x13')][_0xe5af('0x15')]);return _0x4876a3(_0x7e621c['error'][_0xe5af('0x15')]);}logger[_0xe5af('0x13')](_0xe5af('0xf'),_0x5737c2,_0x7e621c[_0xe5af('0x13')][_0xe5af('0x15')]);return _0x1cc1f3(_0x7e621c[_0xe5af('0x13')][_0xe5af('0x15')]);}else{logger[_0xe5af('0xe')](_0xe5af('0xf'),_0x5737c2,'request\x20sent');_0x1cc1f3(_0x7e621c['result'][_0xe5af('0x15')]);}})[_0xe5af('0x16')](function(_0x305eda){logger[_0xe5af('0x13')](_0xe5af('0xf'),_0x5737c2,_0x305eda);_0x4876a3(_0x305eda);});});} \ No newline at end of file +var _0x9abc=['client','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x48f2ad,_0x1fb17d){var _0x4b081f=function(_0xf6f82e){while(--_0xf6f82e){_0x48f2ad['push'](_0x48f2ad['shift']());}};_0x4b081f(++_0x1fb17d);}(_0x9abc,0x1e3));var _0xc9ab=function(_0x4916bb,_0x28b567){_0x4916bb=_0x4916bb-0x0;var _0x4914fb=_0x9abc[_0x4916bb];return _0x4914fb;};'use strict';var _=require(_0xc9ab('0x0'));var util=require(_0xc9ab('0x1'));var moment=require(_0xc9ab('0x2'));var BPromise=require(_0xc9ab('0x3'));var rs=require(_0xc9ab('0x4'));var fs=require('fs');var Redis=require(_0xc9ab('0x5'));var db=require(_0xc9ab('0x6'))['db'];var utils=require(_0xc9ab('0x7'));var logger=require(_0xc9ab('0x8'))(_0xc9ab('0x9'));var config=require('../../config/environment');var jayson=require(_0xc9ab('0xa'));var client=jayson[_0xc9ab('0xb')][_0xc9ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x301aca,_0x1324aa,_0xa0edb){return new BPromise(function(_0x5ced9c,_0x58709b){return client[_0xc9ab('0xd')](_0x301aca,_0xa0edb)[_0xc9ab('0xe')](function(_0x4f0409){logger[_0xc9ab('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1324aa,_0xc9ab('0x10'));logger[_0xc9ab('0x11')](_0xc9ab('0x12'),_0x1324aa,_0xc9ab('0x10'),JSON[_0xc9ab('0x13')](_0x4f0409));if(_0x4f0409['error']){if(_0x4f0409[_0xc9ab('0x14')][_0xc9ab('0x15')]===0x1f4){logger[_0xc9ab('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1324aa,_0x4f0409[_0xc9ab('0x14')][_0xc9ab('0x16')]);return _0x58709b(_0x4f0409[_0xc9ab('0x14')]['message']);}logger[_0xc9ab('0x14')](_0xc9ab('0x17'),_0x1324aa,_0x4f0409[_0xc9ab('0x14')][_0xc9ab('0x16')]);return _0x5ced9c(_0x4f0409['error'][_0xc9ab('0x16')]);}else{logger[_0xc9ab('0xf')](_0xc9ab('0x17'),_0x1324aa,_0xc9ab('0x10'));_0x5ced9c(_0x4f0409[_0xc9ab('0x18')][_0xc9ab('0x16')]);}})[_0xc9ab('0x19')](function(_0x711fe1){logger[_0xc9ab('0x14')](_0xc9ab('0x17'),_0x1324aa,_0x711fe1);_0x58709b(_0x711fe1);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 307d289..c31b416 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 _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1bae8b,_0x216db4){var _0x5a8751=function(_0x59eae3){while(--_0x59eae3){_0x1bae8b['push'](_0x1bae8b['shift']());}};_0x5a8751(++_0x216db4);}(_0xb03e,0x1eb));var _0xeb03=function(_0x19867d,_0x3e1f1f){_0x19867d=_0x19867d-0x0;var _0x359fb4=_0xb03e[_0x19867d];return _0x359fb4;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file +var _0xf954=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','create','put','destroy','exports','multer','util'];(function(_0x4c96f8,_0x961e7a){var _0xc48b04=function(_0x2f13d5){while(--_0x2f13d5){_0x4c96f8['push'](_0x4c96f8['shift']());}};_0xc48b04(++_0x961e7a);}(_0xf954,0x10e));var _0x4f95=function(_0x192bc9,_0x4408c7){_0x192bc9=_0x192bc9-0x0;var _0x48397b=_0xf954[_0x192bc9];return _0x48397b;};'use strict';var multer=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var path=require(_0x4f95('0x2'));var timeout=require(_0x4f95('0x3'));var express=require(_0x4f95('0x4'));var router=express[_0x4f95('0x5')]();var fs_extra=require(_0x4f95('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f95('0x7'));var controller=require(_0x4f95('0x8'));router[_0x4f95('0x9')]('/',auth[_0x4f95('0xa')](),controller['index']);router[_0x4f95('0x9')](_0x4f95('0xb'),auth[_0x4f95('0xa')](),controller[_0x4f95('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f95('0xd')]);router[_0x4f95('0xe')](_0x4f95('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4f95('0xb'),auth[_0x4f95('0xa')](),controller[_0x4f95('0xf')]);module[_0x4f95('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4297e79..99756cb 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 _0x8476=['sequelize','exports','STRING'];(function(_0x38605b,_0x3a41fd){var _0x14c334=function(_0x31c9da){while(--_0x31c9da){_0x38605b['push'](_0x38605b['shift']());}};_0x14c334(++_0x3a41fd);}(_0x8476,0x1bf));var _0x6847=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0x8476[_0x50abc4];return _0x5a745d;};'use strict';var Sequelize=require(_0x6847('0x0'));module[_0x6847('0x1')]={'name':{'type':Sequelize[_0x6847('0x2')]},'description':{'type':Sequelize[_0x6847('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x64bc=['STRING','TEXT','sequelize'];(function(_0xa5febd,_0x43ac20){var _0xcd46a8=function(_0x20bede){while(--_0x20bede){_0xa5febd['push'](_0xa5febd['shift']());}};_0xcd46a8(++_0x43ac20);}(_0x64bc,0x140));var _0xc64b=function(_0x3799ac,_0x4756a2){_0x3799ac=_0x3799ac-0x0;var _0x3e9c5e=_0x64bc[_0x3799ac];return _0x3e9c5e;};'use strict';var Sequelize=require(_0xc64b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc64b('0x1')]},'description':{'type':Sequelize[_0xc64b('0x1')]},'html':{'type':Sequelize[_0xc64b('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0820996..415dc6d 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 _0xc385=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','filter','options','where','Template','includeAll','include','findAll','rows','show','params','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra'];(function(_0x4d8fe1,_0x3ed474){var _0x46685e=function(_0x268c73){while(--_0x268c73){_0x4d8fe1['push'](_0x4d8fe1['shift']());}};_0x46685e(++_0x3ed474);}(_0xc385,0xa0));var _0x5c38=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc385[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x5c38('0x0'));var rimraf=require(_0x5c38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c38('0x2'));var rp=require('request-promise');var moment=require(_0x5c38('0x3'));var BPromise=require(_0x5c38('0x4'));var Mustache=require('mustache');var util=require(_0x5c38('0x5'));var path=require('path');var sox=require(_0x5c38('0x6'));var csv=require(_0x5c38('0x7'));var ejs=require(_0x5c38('0x8'));var fs=require('fs');var fs_extra=require(_0x5c38('0x9'));var _=require(_0x5c38('0xa'));var squel=require('squel');var crypto=require(_0x5c38('0xb'));var jsforce=require(_0x5c38('0xc'));var deskjs=require(_0x5c38('0xd'));var toCsv=require(_0x5c38('0x7'));var querystring=require(_0x5c38('0xe'));var Papa=require(_0x5c38('0xf'));var Redis=require(_0x5c38('0x10'));var authService=require(_0x5c38('0x11'));var qs=require(_0x5c38('0x12'));var as=require(_0x5c38('0x13'));var hardwareService=require(_0x5c38('0x14'));var logger=require(_0x5c38('0x15'))(_0x5c38('0x16'));var utils=require('../../config/utils');var config=require(_0x5c38('0x17'));var licenseUtil=require(_0x5c38('0x18'));var db=require(_0x5c38('0x19'))['db'];function respondWithStatusCode(_0x5f3cf5,_0x4fd611){_0x4fd611=_0x4fd611||0xcc;return function(_0x30328a){if(_0x30328a){return _0x5f3cf5[_0x5c38('0x1a')](_0x4fd611);}return _0x5f3cf5[_0x5c38('0x1b')](_0x4fd611)['end']();};}function respondWithResult(_0x292a0a,_0x487b34){_0x487b34=_0x487b34||0xc8;return function(_0x298f4c){if(_0x298f4c){return _0x292a0a[_0x5c38('0x1b')](_0x487b34)[_0x5c38('0x1c')](_0x298f4c);}};}function respondWithFilteredResult(_0x1af090,_0x4852cb){return function(_0x3baed){if(_0x3baed){var _0x3ade09=typeof _0x4852cb[_0x5c38('0x1d')]===_0x5c38('0x1e')&&typeof _0x4852cb[_0x5c38('0x1f')]===_0x5c38('0x1e');var _0x29ab8d=_0x3baed['count'];var _0x2f0121=_0x3ade09?0x0:_0x4852cb[_0x5c38('0x1d')];var _0x37e100=_0x3ade09?_0x3baed[_0x5c38('0x20')]:_0x4852cb[_0x5c38('0x1d')]+_0x4852cb[_0x5c38('0x1f')];var _0x216d33;if(_0x37e100>=_0x29ab8d){_0x37e100=_0x29ab8d;_0x216d33=0xc8;}else{_0x216d33=0xce;}_0x1af090[_0x5c38('0x1b')](_0x216d33);return _0x1af090[_0x5c38('0x21')](_0x5c38('0x22'),_0x2f0121+'-'+_0x37e100+'/'+_0x29ab8d)['json'](_0x3baed);}return null;};}function patchUpdates(_0x10d402){return function(_0xca1d14){try{jsonpatch[_0x5c38('0x23')](_0xca1d14,_0x10d402,!![]);}catch(_0x4effbf){return BPromise[_0x5c38('0x24')](_0x4effbf);}return _0xca1d14[_0x5c38('0x25')]();};}function saveUpdates(_0x5bb2fb,_0x28c954){return function(_0x17248f){if(_0x17248f){return _0x17248f[_0x5c38('0x26')](_0x5bb2fb)[_0x5c38('0x27')](function(_0x12af4c){return _0x12af4c;});}return null;};}function removeEntity(_0x2b5e14,_0x560698){return function(_0x11313d){if(_0x11313d){return _0x11313d[_0x5c38('0x28')]()[_0x5c38('0x27')](function(){var _0x1b224a=_0x11313d[_0x5c38('0x29')]({'plain':!![]});var _0x8d25a9='Templates';return db[_0x5c38('0x2a')]['destroy']({'where':{'type':_0x8d25a9,'resourceId':_0x1b224a['id']}})[_0x5c38('0x27')](function(){return _0x11313d;});})[_0x5c38('0x27')](function(){_0x2b5e14[_0x5c38('0x1b')](0xcc)[_0x5c38('0x2b')]();});}};}function handleEntityNotFound(_0x247fd6,_0x2cb27a){return function(_0x1a8746){if(!_0x1a8746){_0x247fd6[_0x5c38('0x1a')](0x194);}return _0x1a8746;};}function handleError(_0xb41d85,_0x67d67d){_0x67d67d=_0x67d67d||0x1f4;return function(_0x16fdf3){logger[_0x5c38('0x2c')](_0x16fdf3[_0x5c38('0x2d')]);if(_0x16fdf3['name']){delete _0x16fdf3[_0x5c38('0x2e')];}_0xb41d85['status'](_0x67d67d)[_0x5c38('0x2f')](_0x16fdf3);};}exports[_0x5c38('0x30')]=function(_0x279e6e,_0x35611b){var _0x1f1f52={},_0x1c0ff2={},_0x1979df={'count':0x0,'rows':[]};var _0x55edd0=_[_0x5c38('0x31')](db['Template']['rawAttributes'],function(_0x21f02c){return{'name':_0x21f02c[_0x5c38('0x32')],'type':_0x21f02c[_0x5c38('0x33')][_0x5c38('0x34')]};});_0x1c0ff2[_0x5c38('0x35')]=_[_0x5c38('0x31')](_0x55edd0,_0x5c38('0x2e'));_0x1c0ff2[_0x5c38('0x36')]=_[_0x5c38('0x37')](_0x279e6e['query']);_0x1c0ff2[_0x5c38('0x38')]=_['intersection'](_0x1c0ff2[_0x5c38('0x35')],_0x1c0ff2[_0x5c38('0x36')]);_0x1f1f52['attributes']=_[_0x5c38('0x39')](_0x1c0ff2[_0x5c38('0x35')],qs[_0x5c38('0x3a')](_0x279e6e[_0x5c38('0x36')][_0x5c38('0x3a')]));_0x1f1f52[_0x5c38('0x3b')]=_0x1f1f52[_0x5c38('0x3b')][_0x5c38('0x3c')]?_0x1f1f52['attributes']:_0x1c0ff2['model'];if(!_0x279e6e['query'][_0x5c38('0x3d')](_0x5c38('0x3e'))){_0x1f1f52[_0x5c38('0x1f')]=qs[_0x5c38('0x1f')](_0x279e6e[_0x5c38('0x36')][_0x5c38('0x1f')]);_0x1f1f52[_0x5c38('0x1d')]=qs[_0x5c38('0x1d')](_0x279e6e[_0x5c38('0x36')][_0x5c38('0x1d')]);}_0x1f1f52[_0x5c38('0x3f')]=qs[_0x5c38('0x40')](_0x279e6e[_0x5c38('0x36')]['sort']);_0x1f1f52['where']=qs['filters'](_['pick'](_0x279e6e['query'],_0x1c0ff2[_0x5c38('0x38')]),_0x55edd0);if(_0x279e6e[_0x5c38('0x36')]['filter']){_0x1f1f52['where']=_[_0x5c38('0x41')](_0x1f1f52['where'],{'$or':_[_0x5c38('0x31')](_0x55edd0,function(_0x25a1c2){if(_0x25a1c2[_0x5c38('0x33')]!==_0x5c38('0x42')){var _0x3d6d91={};_0x3d6d91[_0x25a1c2['name']]={'$like':'%'+_0x279e6e[_0x5c38('0x36')][_0x5c38('0x43')]+'%'};return _0x3d6d91;}})});}_0x1f1f52=_['merge']({},_0x1f1f52,_0x279e6e[_0x5c38('0x44')]);var _0x4e02c8={'where':_0x1f1f52[_0x5c38('0x45')]};return db[_0x5c38('0x46')][_0x5c38('0x20')](_0x4e02c8)['then'](function(_0x13be7d){_0x1979df[_0x5c38('0x20')]=_0x13be7d;if(_0x279e6e[_0x5c38('0x36')][_0x5c38('0x47')]){_0x1f1f52[_0x5c38('0x48')]=[{'all':!![]}];}return db[_0x5c38('0x46')][_0x5c38('0x49')](_0x1f1f52);})[_0x5c38('0x27')](function(_0xc6ab98){_0x1979df[_0x5c38('0x4a')]=_0xc6ab98;return _0x1979df;})['then'](respondWithFilteredResult(_0x35611b,_0x1f1f52))['catch'](handleError(_0x35611b,null));};exports[_0x5c38('0x4b')]=function(_0x58fd1e,_0x1caa5a){var _0x1d658b={'raw':!![],'where':{'id':_0x58fd1e[_0x5c38('0x4c')]['id']}},_0x106333={};_0x106333[_0x5c38('0x35')]=_[_0x5c38('0x37')](db[_0x5c38('0x46')]['rawAttributes']);_0x106333[_0x5c38('0x36')]=_['keys'](_0x58fd1e[_0x5c38('0x36')]);_0x106333[_0x5c38('0x38')]=_['intersection'](_0x106333[_0x5c38('0x35')],_0x106333[_0x5c38('0x36')]);_0x1d658b[_0x5c38('0x3b')]=_[_0x5c38('0x39')](_0x106333[_0x5c38('0x35')],qs[_0x5c38('0x3a')](_0x58fd1e[_0x5c38('0x36')][_0x5c38('0x3a')]));_0x1d658b[_0x5c38('0x3b')]=_0x1d658b[_0x5c38('0x3b')][_0x5c38('0x3c')]?_0x1d658b[_0x5c38('0x3b')]:_0x106333[_0x5c38('0x35')];if(_0x58fd1e[_0x5c38('0x36')]['includeAll']){_0x1d658b['include']=[{'all':!![]}];}_0x1d658b=_[_0x5c38('0x41')]({},_0x1d658b,_0x58fd1e['options']);return db[_0x5c38('0x46')]['find'](_0x1d658b)['then'](handleEntityNotFound(_0x1caa5a,null))[_0x5c38('0x27')](respondWithResult(_0x1caa5a,null))[_0x5c38('0x4d')](handleError(_0x1caa5a,null));};exports['create']=function(_0x5771c7,_0x5dfcfc){return db['Template']['create'](_0x5771c7[_0x5c38('0x4e')],{})[_0x5c38('0x27')](function(_0x4881d5){var _0x32e5b6=_0x5771c7['user'][_0x5c38('0x29')]({'plain':!![]});if(!_0x32e5b6)throw new Error(_0x5c38('0x4f'));if(_0x32e5b6[_0x5c38('0x50')]==='user'){var _0x37140e=_0x4881d5[_0x5c38('0x29')]({'plain':!![]});var _0x32bb8c='Templates';return db[_0x5c38('0x51')]['find']({'where':{'name':_0x32bb8c,'userProfileId':_0x32e5b6['userProfileId']},'raw':!![]})[_0x5c38('0x27')](function(_0x2ea0fb){if(_0x2ea0fb&&_0x2ea0fb[_0x5c38('0x52')]===0x0){return db[_0x5c38('0x2a')][_0x5c38('0x53')]({'name':_0x37140e[_0x5c38('0x2e')],'resourceId':_0x37140e['id'],'type':_0x2ea0fb[_0x5c38('0x2e')],'sectionId':_0x2ea0fb['id']},{})['then'](function(){return _0x4881d5;});}else{return _0x4881d5;}})['catch'](function(_0x2f77d6){logger[_0x5c38('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f77d6);throw _0x2f77d6;});}return _0x4881d5;})['then'](respondWithResult(_0x5dfcfc,0xc9))['catch'](handleError(_0x5dfcfc,null));};exports[_0x5c38('0x26')]=function(_0x4fad09,_0x492f24){if(_0x4fad09[_0x5c38('0x4e')]['id']){delete _0x4fad09[_0x5c38('0x4e')]['id'];}return db[_0x5c38('0x46')][_0x5c38('0x54')]({'where':{'id':_0x4fad09['params']['id']}})[_0x5c38('0x27')](handleEntityNotFound(_0x492f24,null))['then'](saveUpdates(_0x4fad09['body'],null))[_0x5c38('0x27')](respondWithResult(_0x492f24,null))[_0x5c38('0x4d')](handleError(_0x492f24,null));};exports[_0x5c38('0x28')]=function(_0x6fccba,_0x37d20c){return db[_0x5c38('0x46')][_0x5c38('0x54')]({'where':{'id':_0x6fccba[_0x5c38('0x4c')]['id']}})[_0x5c38('0x27')](handleEntityNotFound(_0x37d20c,null))[_0x5c38('0x27')](removeEntity(_0x37d20c,null))[_0x5c38('0x4d')](handleError(_0x37d20c,null));}; \ No newline at end of file +var _0x51ec=['ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','UserProfileResource','destroy','then','end','error','stack','name','send','index','map','Template','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv'];(function(_0x35b1e4,_0x5830fb){var _0x272d2e=function(_0x186b9c){while(--_0x186b9c){_0x35b1e4['push'](_0x35b1e4['shift']());}};_0x272d2e(++_0x5830fb);}(_0x51ec,0xf7));var _0xc51e=function(_0x1ea2be,_0x29ee72){_0x1ea2be=_0x1ea2be-0x0;var _0x1a1075=_0x51ec[_0x1ea2be];return _0x1a1075;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc51e('0x0'));var zipdir=require(_0xc51e('0x1'));var jsonpatch=require(_0xc51e('0x2'));var rp=require(_0xc51e('0x3'));var moment=require(_0xc51e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc51e('0x5'));var util=require('util');var path=require(_0xc51e('0x6'));var sox=require('sox');var csv=require(_0xc51e('0x7'));var ejs=require(_0xc51e('0x8'));var fs=require('fs');var fs_extra=require(_0xc51e('0x9'));var _=require(_0xc51e('0xa'));var squel=require(_0xc51e('0xb'));var crypto=require(_0xc51e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc51e('0xd'));var Papa=require(_0xc51e('0xe'));var Redis=require(_0xc51e('0xf'));var authService=require(_0xc51e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc51e('0x11'));var hardwareService=require(_0xc51e('0x12'));var logger=require(_0xc51e('0x13'))(_0xc51e('0x14'));var utils=require(_0xc51e('0x15'));var config=require(_0xc51e('0x16'));var licenseUtil=require(_0xc51e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc0cb1e,_0x3d30f0){_0x3d30f0=_0x3d30f0||0xcc;return function(_0x4034af){if(_0x4034af){return _0xc0cb1e[_0xc51e('0x18')](_0x3d30f0);}return _0xc0cb1e[_0xc51e('0x19')](_0x3d30f0)['end']();};}function respondWithResult(_0x1d1dbd,_0x3dfef0){_0x3dfef0=_0x3dfef0||0xc8;return function(_0x533a59){if(_0x533a59){return _0x1d1dbd['status'](_0x3dfef0)[_0xc51e('0x1a')](_0x533a59);}};}function respondWithFilteredResult(_0x2dc8b1,_0x96d450){return function(_0x58a561){if(_0x58a561){var _0x34f8ca=typeof _0x96d450[_0xc51e('0x1b')]===_0xc51e('0x1c')&&typeof _0x96d450[_0xc51e('0x1d')]==='undefined';var _0x19b82c=_0x58a561[_0xc51e('0x1e')];var _0x4402e4=_0x34f8ca?0x0:_0x96d450[_0xc51e('0x1b')];var _0x1e5ec0=_0x34f8ca?_0x58a561[_0xc51e('0x1e')]:_0x96d450['offset']+_0x96d450['limit'];var _0x230d28;if(_0x1e5ec0>=_0x19b82c){_0x1e5ec0=_0x19b82c;_0x230d28=0xc8;}else{_0x230d28=0xce;}_0x2dc8b1[_0xc51e('0x19')](_0x230d28);return _0x2dc8b1[_0xc51e('0x1f')](_0xc51e('0x20'),_0x4402e4+'-'+_0x1e5ec0+'/'+_0x19b82c)['json'](_0x58a561);}return null;};}function patchUpdates(_0x4bd340){return function(_0x26bf96){try{jsonpatch[_0xc51e('0x21')](_0x26bf96,_0x4bd340,!![]);}catch(_0x1137c8){return BPromise['reject'](_0x1137c8);}return _0x26bf96[_0xc51e('0x22')]();};}function saveUpdates(_0x8a808d,_0x4bb28f){return function(_0x398c05){if(_0x398c05){return _0x398c05[_0xc51e('0x23')](_0x8a808d)['then'](function(_0x3db530){return _0x3db530;});}return null;};}function removeEntity(_0xa87f2,_0x39a33c){return function(_0x394ee1){if(_0x394ee1){return _0x394ee1['destroy']()['then'](function(){var _0x492c2d=_0x394ee1[_0xc51e('0x24')]({'plain':!![]});var _0x6db0='Templates';return db[_0xc51e('0x25')][_0xc51e('0x26')]({'where':{'type':_0x6db0,'resourceId':_0x492c2d['id']}})[_0xc51e('0x27')](function(){return _0x394ee1;});})[_0xc51e('0x27')](function(){_0xa87f2['status'](0xcc)[_0xc51e('0x28')]();});}};}function handleEntityNotFound(_0x2dff30,_0x1080bb){return function(_0x3f4c4d){if(!_0x3f4c4d){_0x2dff30[_0xc51e('0x18')](0x194);}return _0x3f4c4d;};}function handleError(_0x37edc8,_0x292078){_0x292078=_0x292078||0x1f4;return function(_0x119b66){logger[_0xc51e('0x29')](_0x119b66[_0xc51e('0x2a')]);if(_0x119b66['name']){delete _0x119b66[_0xc51e('0x2b')];}_0x37edc8[_0xc51e('0x19')](_0x292078)[_0xc51e('0x2c')](_0x119b66);};}exports[_0xc51e('0x2d')]=function(_0xcb722,_0xf138dd){var _0x138d0c={},_0x2ec6cf={},_0x541805={'count':0x0,'rows':[]};var _0x205f89=_[_0xc51e('0x2e')](db[_0xc51e('0x2f')]['rawAttributes'],function(_0x431d38){return{'name':_0x431d38[_0xc51e('0x30')],'type':_0x431d38['type'][_0xc51e('0x31')]};});_0x2ec6cf[_0xc51e('0x32')]=_[_0xc51e('0x2e')](_0x205f89,_0xc51e('0x2b'));_0x2ec6cf[_0xc51e('0x33')]=_[_0xc51e('0x34')](_0xcb722[_0xc51e('0x33')]);_0x2ec6cf[_0xc51e('0x35')]=_[_0xc51e('0x36')](_0x2ec6cf[_0xc51e('0x32')],_0x2ec6cf[_0xc51e('0x33')]);_0x138d0c[_0xc51e('0x37')]=_[_0xc51e('0x36')](_0x2ec6cf[_0xc51e('0x32')],qs[_0xc51e('0x38')](_0xcb722[_0xc51e('0x33')]['fields']));_0x138d0c[_0xc51e('0x37')]=_0x138d0c[_0xc51e('0x37')]['length']?_0x138d0c['attributes']:_0x2ec6cf[_0xc51e('0x32')];if(!_0xcb722[_0xc51e('0x33')][_0xc51e('0x39')](_0xc51e('0x3a'))){_0x138d0c[_0xc51e('0x1d')]=qs[_0xc51e('0x1d')](_0xcb722[_0xc51e('0x33')][_0xc51e('0x1d')]);_0x138d0c['offset']=qs[_0xc51e('0x1b')](_0xcb722[_0xc51e('0x33')][_0xc51e('0x1b')]);}_0x138d0c[_0xc51e('0x3b')]=qs[_0xc51e('0x3c')](_0xcb722['query']['sort']);_0x138d0c['where']=qs[_0xc51e('0x35')](_['pick'](_0xcb722[_0xc51e('0x33')],_0x2ec6cf['filters']),_0x205f89);if(_0xcb722['query']['filter']){_0x138d0c['where']=_[_0xc51e('0x3d')](_0x138d0c[_0xc51e('0x3e')],{'$or':_[_0xc51e('0x2e')](_0x205f89,function(_0x271525){if(_0x271525[_0xc51e('0x3f')]!==_0xc51e('0x40')){var _0x3ef504={};_0x3ef504[_0x271525[_0xc51e('0x2b')]]={'$like':'%'+_0xcb722[_0xc51e('0x33')][_0xc51e('0x41')]+'%'};return _0x3ef504;}})});}_0x138d0c=_[_0xc51e('0x3d')]({},_0x138d0c,_0xcb722[_0xc51e('0x42')]);var _0x557409={'where':_0x138d0c[_0xc51e('0x3e')]};return db[_0xc51e('0x2f')]['count'](_0x557409)['then'](function(_0x279819){_0x541805['count']=_0x279819;if(_0xcb722['query'][_0xc51e('0x43')]){_0x138d0c[_0xc51e('0x44')]=[{'all':!![]}];}return db[_0xc51e('0x2f')][_0xc51e('0x45')](_0x138d0c);})[_0xc51e('0x27')](function(_0x2bb340){_0x541805[_0xc51e('0x46')]=_0x2bb340;return _0x541805;})[_0xc51e('0x27')](respondWithFilteredResult(_0xf138dd,_0x138d0c))['catch'](handleError(_0xf138dd,null));};exports[_0xc51e('0x47')]=function(_0x415663,_0x3e711c){var _0x4b205b={'raw':!![],'where':{'id':_0x415663[_0xc51e('0x48')]['id']}},_0x2aa395={};_0x2aa395[_0xc51e('0x32')]=_[_0xc51e('0x34')](db[_0xc51e('0x2f')][_0xc51e('0x49')]);_0x2aa395['query']=_[_0xc51e('0x34')](_0x415663[_0xc51e('0x33')]);_0x2aa395[_0xc51e('0x35')]=_['intersection'](_0x2aa395['model'],_0x2aa395['query']);_0x4b205b['attributes']=_['intersection'](_0x2aa395['model'],qs[_0xc51e('0x38')](_0x415663['query'][_0xc51e('0x38')]));_0x4b205b[_0xc51e('0x37')]=_0x4b205b['attributes'][_0xc51e('0x4a')]?_0x4b205b[_0xc51e('0x37')]:_0x2aa395[_0xc51e('0x32')];if(_0x415663[_0xc51e('0x33')][_0xc51e('0x43')]){_0x4b205b[_0xc51e('0x44')]=[{'all':!![]}];}_0x4b205b=_[_0xc51e('0x3d')]({},_0x4b205b,_0x415663['options']);return db['Template'][_0xc51e('0x4b')](_0x4b205b)[_0xc51e('0x27')](handleEntityNotFound(_0x3e711c,null))[_0xc51e('0x27')](respondWithResult(_0x3e711c,null))['catch'](handleError(_0x3e711c,null));};exports[_0xc51e('0x4c')]=function(_0x32d7c2,_0x49660a){return db[_0xc51e('0x2f')]['create'](_0x32d7c2[_0xc51e('0x4d')],{})['then'](function(_0xd5776b){var _0x1de093=_0x32d7c2[_0xc51e('0x4e')][_0xc51e('0x24')]({'plain':!![]});if(!_0x1de093)throw new Error(_0xc51e('0x4f'));if(_0x1de093[_0xc51e('0x50')]===_0xc51e('0x4e')){var _0x1192ff=_0xd5776b[_0xc51e('0x24')]({'plain':!![]});var _0x47ff48=_0xc51e('0x51');return db[_0xc51e('0x52')]['find']({'where':{'name':_0x47ff48,'userProfileId':_0x1de093[_0xc51e('0x53')]},'raw':!![]})[_0xc51e('0x27')](function(_0x408907){if(_0x408907&&_0x408907['autoAssociation']===0x0){return db[_0xc51e('0x25')][_0xc51e('0x4c')]({'name':_0x1192ff[_0xc51e('0x2b')],'resourceId':_0x1192ff['id'],'type':_0x408907['name'],'sectionId':_0x408907['id']},{})[_0xc51e('0x27')](function(){return _0xd5776b;});}else{return _0xd5776b;}})['catch'](function(_0x1fb574){logger[_0xc51e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fb574);throw _0x1fb574;});}return _0xd5776b;})[_0xc51e('0x27')](respondWithResult(_0x49660a,0xc9))[_0xc51e('0x54')](handleError(_0x49660a,null));};exports['update']=function(_0x47056a,_0x57f0c6){if(_0x47056a[_0xc51e('0x4d')]['id']){delete _0x47056a[_0xc51e('0x4d')]['id'];}return db[_0xc51e('0x2f')][_0xc51e('0x4b')]({'where':{'id':_0x47056a[_0xc51e('0x48')]['id']}})[_0xc51e('0x27')](handleEntityNotFound(_0x57f0c6,null))[_0xc51e('0x27')](saveUpdates(_0x47056a[_0xc51e('0x4d')],null))[_0xc51e('0x27')](respondWithResult(_0x57f0c6,null))[_0xc51e('0x54')](handleError(_0x57f0c6,null));};exports[_0xc51e('0x26')]=function(_0x321c41,_0x2269be){return db[_0xc51e('0x2f')][_0xc51e('0x4b')]({'where':{'id':_0x321c41[_0xc51e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2269be,null))['then'](removeEntity(_0x2269be,null))[_0xc51e('0x54')](handleError(_0x2269be,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a7b33d2..80f3a24 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 _0x5e79=['rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x2047b7,_0x4690fc){var _0x55bee6=function(_0x410d90){while(--_0x410d90){_0x2047b7['push'](_0x2047b7['shift']());}};_0x55bee6(++_0x4690fc);}(_0x5e79,0x1c3));var _0x95e7=function(_0x12e037,_0x5c8a8a){_0x12e037=_0x12e037-0x0;var _0x564f67=_0x5e79[_0x12e037];return _0x564f67;};'use strict';var _=require(_0x95e7('0x0'));var util=require(_0x95e7('0x1'));var logger=require(_0x95e7('0x2'))(_0x95e7('0x3'));var moment=require(_0x95e7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95e7('0x5'));var config=require(_0x95e7('0x6'));var attributes=require(_0x95e7('0x7'));module[_0x95e7('0x8')]=function(_0x164112,_0x374c9d){return _0x164112[_0x95e7('0x9')](_0x95e7('0xa'),attributes,{'tableName':_0x95e7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x230b=['moment','path','rimraf','exports','Template','tools_templates','lodash','util','../../config/logger','api'];(function(_0x460231,_0x5a2ae2){var _0x7be477=function(_0x584f81){while(--_0x584f81){_0x460231['push'](_0x460231['shift']());}};_0x7be477(++_0x5a2ae2);}(_0x230b,0x164));var _0xb230=function(_0x37d780,_0x2d9563){_0x37d780=_0x37d780-0x0;var _0x13dd0b=_0x230b[_0x37d780];return _0x13dd0b;};'use strict';var _=require(_0xb230('0x0'));var util=require(_0xb230('0x1'));var logger=require(_0xb230('0x2'))(_0xb230('0x3'));var moment=require(_0xb230('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb230('0x5'));var rimraf=require(_0xb230('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xb230('0x7')]=function(_0x13e3b7,_0x20bf4c){return _0x13e3b7['define'](_0xb230('0x8'),attributes,{'tableName':_0xb230('0x9'),'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 3de3bac..2e9df80 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 _0x2932=['client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','findAll','options','raw','where','attributes','limit','map','include','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4c19cc,_0x24e1c4){var _0x2d9319=function(_0x3e6ec8){while(--_0x3e6ec8){_0x4c19cc['push'](_0x4c19cc['shift']());}};_0x2d9319(++_0x24e1c4);}(_0x2932,0x9c));var _0x2293=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x2932[_0x1b95a1];return _0x57aef1;};'use strict';var _=require('lodash');var util=require(_0x2293('0x0'));var moment=require('moment');var BPromise=require(_0x2293('0x1'));var rs=require(_0x2293('0x2'));var fs=require('fs');var Redis=require(_0x2293('0x3'));var db=require(_0x2293('0x4'))['db'];var utils=require(_0x2293('0x5'));var logger=require(_0x2293('0x6'))(_0x2293('0x7'));var config=require('../../config/environment');var jayson=require(_0x2293('0x8'));var client=jayson[_0x2293('0x9')][_0x2293('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c4c0,_0x5b5daf,_0x248fcc){return new BPromise(function(_0xc2452a,_0x44907e){return client[_0x2293('0xb')](_0x36c4c0,_0x248fcc)[_0x2293('0xc')](function(_0x10a25a){logger[_0x2293('0xd')](_0x2293('0xe'),_0x5b5daf,_0x2293('0xf'));logger[_0x2293('0x10')](_0x2293('0x11'),_0x5b5daf,'request\x20sent',JSON[_0x2293('0x12')](_0x10a25a));if(_0x10a25a[_0x2293('0x13')]){if(_0x10a25a[_0x2293('0x13')][_0x2293('0x14')]===0x1f4){logger['error'](_0x2293('0xe'),_0x5b5daf,_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);return _0x44907e(_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);}logger[_0x2293('0x13')](_0x2293('0xe'),_0x5b5daf,_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);return _0xc2452a(_0x10a25a[_0x2293('0x13')][_0x2293('0x15')]);}else{logger[_0x2293('0xd')](_0x2293('0xe'),_0x5b5daf,_0x2293('0xf'));_0xc2452a(_0x10a25a['result']['message']);}})[_0x2293('0x16')](function(_0x196490){logger[_0x2293('0x13')]('Template,\x20%s,\x20%s',_0x5b5daf,_0x196490);_0x44907e(_0x196490);});});}exports[_0x2293('0x17')]=function(_0x5686cc){var _0xc16ce6=this;return new Promise(function(_0x2fafdd,_0x130d9d){return db['Template'][_0x2293('0x18')]({'raw':_0x5686cc[_0x2293('0x19')]?_0x5686cc[_0x2293('0x19')][_0x2293('0x1a')]===undefined?!![]:![]:!![],'where':_0x5686cc[_0x2293('0x19')]?_0x5686cc['options'][_0x2293('0x1b')]||null:null,'attributes':_0x5686cc['options']?_0x5686cc[_0x2293('0x19')][_0x2293('0x1c')]||null:null,'limit':_0x5686cc[_0x2293('0x19')]?_0x5686cc[_0x2293('0x19')][_0x2293('0x1d')]||null:null,'include':_0x5686cc[_0x2293('0x19')]?_0x5686cc[_0x2293('0x19')]['include']?_[_0x2293('0x1e')](_0x5686cc[_0x2293('0x19')][_0x2293('0x1f')],function(_0x4da585){return{'model':db[_0x4da585['model']],'as':_0x4da585['as'],'attributes':_0x4da585['attributes'],'include':_0x4da585[_0x2293('0x1f')]?_[_0x2293('0x1e')](_0x4da585[_0x2293('0x1f')],function(_0x356939){return{'model':db[_0x356939[_0x2293('0x20')]],'as':_0x356939['as'],'attributes':_0x356939[_0x2293('0x1c')],'include':_0x356939[_0x2293('0x1f')]?_[_0x2293('0x1e')](_0x356939[_0x2293('0x1f')],function(_0x154b7c){return{'model':db[_0x154b7c['model']],'as':_0x154b7c['as'],'attributes':_0x154b7c[_0x2293('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x303a72){logger[_0x2293('0xd')](_0x2293('0x17'),_0x5686cc);logger['debug'](_0x2293('0x17'),_0x5686cc,JSON[_0x2293('0x12')](_0x303a72));_0x2fafdd(_0x303a72);})['catch'](function(_0x3f5341){logger[_0x2293('0x13')](_0x2293('0x17'),_0x3f5341[_0x2293('0x15')],_0x5686cc);_0x130d9d(_0xc16ce6[_0x2293('0x13')](0x1f4,_0x3f5341[_0x2293('0x15')]));});});}; \ No newline at end of file +var _0x12a7=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','debug','stringify'];(function(_0xf166de,_0x335fa7){var _0x4434f7=function(_0x1c5121){while(--_0x1c5121){_0xf166de['push'](_0xf166de['shift']());}};_0x4434f7(++_0x335fa7);}(_0x12a7,0x198));var _0x712a=function(_0x3062db,_0x48d92a){_0x3062db=_0x3062db-0x0;var _0xb3c45a=_0x12a7[_0x3062db];return _0xb3c45a;};'use strict';var _=require(_0x712a('0x0'));var util=require(_0x712a('0x1'));var moment=require('moment');var BPromise=require(_0x712a('0x2'));var rs=require(_0x712a('0x3'));var fs=require('fs');var Redis=require(_0x712a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x712a('0x5'));var logger=require(_0x712a('0x6'))(_0x712a('0x7'));var config=require(_0x712a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x712a('0x9')][_0x712a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f7bb8,_0x132141,_0x29021e){return new BPromise(function(_0x27b816,_0x24f3d7){return client[_0x712a('0xb')](_0x2f7bb8,_0x29021e)[_0x712a('0xc')](function(_0x59444e){logger[_0x712a('0xd')](_0x712a('0xe'),_0x132141,_0x712a('0xf'));logger['debug'](_0x712a('0x10'),_0x132141,_0x712a('0xf'),JSON['stringify'](_0x59444e));if(_0x59444e[_0x712a('0x11')]){if(_0x59444e['error'][_0x712a('0x12')]===0x1f4){logger[_0x712a('0x11')](_0x712a('0xe'),_0x132141,_0x59444e[_0x712a('0x11')]['message']);return _0x24f3d7(_0x59444e[_0x712a('0x11')]['message']);}logger['error'](_0x712a('0xe'),_0x132141,_0x59444e[_0x712a('0x11')][_0x712a('0x13')]);return _0x27b816(_0x59444e[_0x712a('0x11')][_0x712a('0x13')]);}else{logger[_0x712a('0xd')](_0x712a('0xe'),_0x132141,_0x712a('0xf'));_0x27b816(_0x59444e[_0x712a('0x14')][_0x712a('0x13')]);}})[_0x712a('0x15')](function(_0x4db73b){logger[_0x712a('0x11')](_0x712a('0xe'),_0x132141,_0x4db73b);_0x24f3d7(_0x4db73b);});});}exports[_0x712a('0x16')]=function(_0x2590a2){var _0x5b7f4a=this;return new Promise(function(_0x2da924,_0x5ea49b){return db[_0x712a('0x17')][_0x712a('0x18')]({'raw':_0x2590a2[_0x712a('0x19')]?_0x2590a2[_0x712a('0x19')][_0x712a('0x1a')]===undefined?!![]:![]:!![],'where':_0x2590a2[_0x712a('0x19')]?_0x2590a2[_0x712a('0x19')]['where']||null:null,'attributes':_0x2590a2[_0x712a('0x19')]?_0x2590a2[_0x712a('0x19')][_0x712a('0x1b')]||null:null,'limit':_0x2590a2[_0x712a('0x19')]?_0x2590a2[_0x712a('0x19')][_0x712a('0x1c')]||null:null,'include':_0x2590a2[_0x712a('0x19')]?_0x2590a2['options'][_0x712a('0x1d')]?_[_0x712a('0x1e')](_0x2590a2[_0x712a('0x19')]['include'],function(_0x2fcf31){return{'model':db[_0x2fcf31[_0x712a('0x1f')]],'as':_0x2fcf31['as'],'attributes':_0x2fcf31['attributes'],'include':_0x2fcf31['include']?_[_0x712a('0x1e')](_0x2fcf31[_0x712a('0x1d')],function(_0xc81c28){return{'model':db[_0xc81c28[_0x712a('0x1f')]],'as':_0xc81c28['as'],'attributes':_0xc81c28[_0x712a('0x1b')],'include':_0xc81c28['include']?_[_0x712a('0x1e')](_0xc81c28[_0x712a('0x1d')],function(_0x5240bb){return{'model':db[_0x5240bb[_0x712a('0x1f')]],'as':_0x5240bb['as'],'attributes':_0x5240bb[_0x712a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x712a('0xc')](function(_0x4faa51){logger['info'](_0x712a('0x16'),_0x2590a2);logger[_0x712a('0x20')](_0x712a('0x16'),_0x2590a2,JSON[_0x712a('0x21')](_0x4faa51));_0x2da924(_0x4faa51);})[_0x712a('0x15')](function(_0x2f8678){logger[_0x712a('0x11')](_0x712a('0x16'),_0x2f8678[_0x712a('0x13')],_0x2590a2);_0x5ea49b(_0x5b7f4a[_0x712a('0x11')](0x1f4,_0x2f8678[_0x712a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 59a41b5..c555e78 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 _0xe672=['addAnyCondition','addAction','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe672,0x1e4));var _0x2e67=function(_0x35966c,_0x275c99){_0x35966c=_0x35966c-0x0;var _0x4056db=_0xe672[_0x35966c];return _0x4056db;};'use strict';var multer=require(_0x2e67('0x0'));var util=require('util');var path=require(_0x2e67('0x1'));var timeout=require(_0x2e67('0x2'));var express=require(_0x2e67('0x3'));var router=express[_0x2e67('0x4')]();var fs_extra=require(_0x2e67('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e67('0x6'));var controller=require(_0x2e67('0x7'));router[_0x2e67('0x8')]('/',auth[_0x2e67('0x9')](),controller['index']);router['get'](_0x2e67('0xa'),auth[_0x2e67('0x9')](),controller[_0x2e67('0xb')]);router[_0x2e67('0x8')]('/:id/all_conditions',auth[_0x2e67('0x9')](),controller[_0x2e67('0xc')]);router[_0x2e67('0x8')](_0x2e67('0xd'),auth[_0x2e67('0x9')](),controller[_0x2e67('0xe')]);router[_0x2e67('0x8')](_0x2e67('0xf'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x10')]);router[_0x2e67('0x11')]('/',auth[_0x2e67('0x9')](),controller['create']);router['post'](_0x2e67('0x12'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x13')]);router[_0x2e67('0x11')](_0x2e67('0xd'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x14')]);router[_0x2e67('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x2e67('0x15')]);router['put'](_0x2e67('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2e67('0x16')](_0x2e67('0xa'),auth[_0x2e67('0x9')](),controller[_0x2e67('0x17')]);module['exports']=router; \ No newline at end of file +var _0xfc0c=['addAction','put','/:id','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0xfc0c,0x103));var _0xcfc0=function(_0x167346,_0x1c1dfc){_0x167346=_0x167346-0x0;var _0x41d4af=_0xfc0c[_0x167346];return _0x41d4af;};'use strict';var multer=require('multer');var util=require(_0xcfc0('0x0'));var path=require(_0xcfc0('0x1'));var timeout=require('connect-timeout');var express=require(_0xcfc0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcfc0('0x3'));var interaction=require(_0xcfc0('0x4'));var config=require(_0xcfc0('0x5'));var controller=require(_0xcfc0('0x6'));router[_0xcfc0('0x7')]('/',auth['isAuthenticated'](),controller[_0xcfc0('0x8')]);router[_0xcfc0('0x7')]('/:id',auth[_0xcfc0('0x9')](),controller[_0xcfc0('0xa')]);router['get'](_0xcfc0('0xb'),auth['isAuthenticated'](),controller[_0xcfc0('0xc')]);router[_0xcfc0('0x7')](_0xcfc0('0xd'),auth[_0xcfc0('0x9')](),controller[_0xcfc0('0xe')]);router['get'](_0xcfc0('0xf'),auth['isAuthenticated'](),controller[_0xcfc0('0x10')]);router[_0xcfc0('0x11')]('/',auth[_0xcfc0('0x9')](),controller[_0xcfc0('0x12')]);router[_0xcfc0('0x11')]('/:id/all_conditions',auth[_0xcfc0('0x9')](),controller[_0xcfc0('0x13')]);router['post'](_0xcfc0('0xd'),auth[_0xcfc0('0x9')](),controller[_0xcfc0('0x14')]);router[_0xcfc0('0x11')](_0xcfc0('0xf'),auth['isAuthenticated'](),controller[_0xcfc0('0x15')]);router[_0xcfc0('0x16')](_0xcfc0('0x17'),auth['isAuthenticated'](),controller[_0xcfc0('0x18')]);router[_0xcfc0('0x19')](_0xcfc0('0x17'),auth['isAuthenticated'](),controller[_0xcfc0('0x1a')]);module[_0xcfc0('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 d8393e0..f7f9785 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 _0x337c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x333c2b,_0x4bf3ce){var _0x52e2c0=function(_0x119867){while(--_0x119867){_0x333c2b['push'](_0x333c2b['shift']());}};_0x52e2c0(++_0x4bf3ce);}(_0x337c,0x10d));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc337('0x0'));module[_0xc337('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc337('0x2')]},'description':{'type':Sequelize[_0xc337('0x2')]},'status':{'type':Sequelize[_0xc337('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf55e=['BOOLEAN','sequelize','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf55e,0xa0));var _0xef55=function(_0x56dc7a,_0x5246c9){_0x56dc7a=_0x56dc7a-0x0;var _0x4bfb60=_0xf55e[_0x56dc7a];return _0x4bfb60;};'use strict';var Sequelize=require(_0xef55('0x0'));module['exports']={'name':{'type':Sequelize[_0xef55('0x1')]},'channel':{'type':Sequelize[_0xef55('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xef55('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index a38e9db..4655103 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 _0x51fb=['set','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','Trigger','includeAll','include','findAll','rows','keys','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','hasOwnProperty','nolimit','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count'];(function(_0x26ff7f,_0x25bd10){var _0x4ff798=function(_0x585888){while(--_0x585888){_0x26ff7f['push'](_0x26ff7f['shift']());}};_0x4ff798(++_0x25bd10);}(_0x51fb,0x16c));var _0xb51f=function(_0x285387,_0x4a226d){_0x285387=_0x285387-0x0;var _0x3a18b6=_0x51fb[_0x285387];return _0x3a18b6;};'use strict';var emlformat=require(_0xb51f('0x0'));var rimraf=require(_0xb51f('0x1'));var zipdir=require(_0xb51f('0x2'));var jsonpatch=require(_0xb51f('0x3'));var rp=require(_0xb51f('0x4'));var moment=require(_0xb51f('0x5'));var BPromise=require(_0xb51f('0x6'));var Mustache=require(_0xb51f('0x7'));var util=require('util');var path=require(_0xb51f('0x8'));var sox=require('sox');var csv=require(_0xb51f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb51f('0xa'));var squel=require(_0xb51f('0xb'));var crypto=require(_0xb51f('0xc'));var jsforce=require(_0xb51f('0xd'));var deskjs=require(_0xb51f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb51f('0xf'));var Papa=require(_0xb51f('0x10'));var Redis=require(_0xb51f('0x11'));var authService=require(_0xb51f('0x12'));var qs=require(_0xb51f('0x13'));var as=require(_0xb51f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb51f('0x15'))('api');var utils=require(_0xb51f('0x16'));var config=require(_0xb51f('0x17'));var licenseUtil=require(_0xb51f('0x18'));var db=require(_0xb51f('0x19'))['db'];function respondWithStatusCode(_0x4b4cb3,_0x466d6f){_0x466d6f=_0x466d6f||0xcc;return function(_0xf70520){if(_0xf70520){return _0x4b4cb3[_0xb51f('0x1a')](_0x466d6f);}return _0x4b4cb3[_0xb51f('0x1b')](_0x466d6f)['end']();};}function respondWithResult(_0x1d6a2a,_0x443cd4){_0x443cd4=_0x443cd4||0xc8;return function(_0x3da4e9){if(_0x3da4e9){return _0x1d6a2a['status'](_0x443cd4)['json'](_0x3da4e9);}};}function respondWithFilteredResult(_0x53c008,_0xeceee){return function(_0x26231b){if(_0x26231b){var _0x3f0bb3=typeof _0xeceee[_0xb51f('0x1c')]===_0xb51f('0x1d')&&typeof _0xeceee[_0xb51f('0x1e')]===_0xb51f('0x1d');var _0x2d8a04=_0x26231b['count'];var _0x4eeda4=_0x3f0bb3?0x0:_0xeceee[_0xb51f('0x1c')];var _0x9eed63=_0x3f0bb3?_0x26231b[_0xb51f('0x1f')]:_0xeceee[_0xb51f('0x1c')]+_0xeceee['limit'];var _0x2812b6;if(_0x9eed63>=_0x2d8a04){_0x9eed63=_0x2d8a04;_0x2812b6=0xc8;}else{_0x2812b6=0xce;}_0x53c008[_0xb51f('0x1b')](_0x2812b6);return _0x53c008[_0xb51f('0x20')](_0xb51f('0x21'),_0x4eeda4+'-'+_0x9eed63+'/'+_0x2d8a04)['json'](_0x26231b);}return null;};}function patchUpdates(_0x51761d){return function(_0x5b2ca5){try{jsonpatch[_0xb51f('0x22')](_0x5b2ca5,_0x51761d,!![]);}catch(_0x2f2af9){return BPromise[_0xb51f('0x23')](_0x2f2af9);}return _0x5b2ca5[_0xb51f('0x24')]();};}function saveUpdates(_0x27235c,_0x377c43){return function(_0xd5a200){if(_0xd5a200){return _0xd5a200[_0xb51f('0x25')](_0x27235c)['then'](function(_0x13b4db){return _0x13b4db;});}return null;};}function removeEntity(_0x30171f,_0x3aa01b){return function(_0x37fef2){if(_0x37fef2){return _0x37fef2[_0xb51f('0x26')]()[_0xb51f('0x27')](function(){var _0x14ad3d=_0x37fef2[_0xb51f('0x28')]({'plain':!![]});var _0x5addbe=_0xb51f('0x29');return db[_0xb51f('0x2a')][_0xb51f('0x26')]({'where':{'type':_0x5addbe,'resourceId':_0x14ad3d['id']}})[_0xb51f('0x27')](function(){return _0x37fef2;});})[_0xb51f('0x27')](function(){_0x30171f[_0xb51f('0x1b')](0xcc)[_0xb51f('0x2b')]();});}};}function handleEntityNotFound(_0x282e4d,_0x121259){return function(_0x5c4447){if(!_0x5c4447){_0x282e4d['sendStatus'](0x194);}return _0x5c4447;};}function handleError(_0x34a51a,_0x5ade55){_0x5ade55=_0x5ade55||0x1f4;return function(_0x550759){logger[_0xb51f('0x2c')](_0x550759[_0xb51f('0x2d')]);if(_0x550759[_0xb51f('0x2e')]){delete _0x550759['name'];}_0x34a51a[_0xb51f('0x1b')](_0x5ade55)[_0xb51f('0x2f')](_0x550759);};}exports[_0xb51f('0x30')]=function(_0x5dba75,_0x540018){var _0x3f6563={},_0x7fb822={},_0x250890={'count':0x0,'rows':[]};var _0x2bda4e=_[_0xb51f('0x31')](db['Trigger'][_0xb51f('0x32')],function(_0x3de8d5){return{'name':_0x3de8d5[_0xb51f('0x33')],'type':_0x3de8d5[_0xb51f('0x34')][_0xb51f('0x35')]};});_0x7fb822[_0xb51f('0x36')]=_[_0xb51f('0x31')](_0x2bda4e,_0xb51f('0x2e'));_0x7fb822['query']=_['keys'](_0x5dba75[_0xb51f('0x37')]);_0x7fb822['filters']=_[_0xb51f('0x38')](_0x7fb822[_0xb51f('0x36')],_0x7fb822[_0xb51f('0x37')]);_0x3f6563['attributes']=_[_0xb51f('0x38')](_0x7fb822[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x5dba75['query'][_0xb51f('0x39')]));_0x3f6563[_0xb51f('0x3a')]=_0x3f6563['attributes'][_0xb51f('0x3b')]?_0x3f6563[_0xb51f('0x3a')]:_0x7fb822['model'];if(!_0x5dba75[_0xb51f('0x37')]['hasOwnProperty']('nolimit')){_0x3f6563[_0xb51f('0x1e')]=qs[_0xb51f('0x1e')](_0x5dba75[_0xb51f('0x37')][_0xb51f('0x1e')]);_0x3f6563[_0xb51f('0x1c')]=qs['offset'](_0x5dba75[_0xb51f('0x37')]['offset']);}_0x3f6563[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x5dba75[_0xb51f('0x37')][_0xb51f('0x3d')]);_0x3f6563[_0xb51f('0x3e')]=qs[_0xb51f('0x3f')](_[_0xb51f('0x40')](_0x5dba75[_0xb51f('0x37')],_0x7fb822[_0xb51f('0x3f')]),_0x2bda4e);if(_0x5dba75['query'][_0xb51f('0x41')]){_0x3f6563['where']=_[_0xb51f('0x42')](_0x3f6563[_0xb51f('0x3e')],{'$or':_[_0xb51f('0x31')](_0x2bda4e,function(_0x57d8ac){if(_0x57d8ac['type']!==_0xb51f('0x43')){var _0x4119e7={};_0x4119e7[_0x57d8ac[_0xb51f('0x2e')]]={'$like':'%'+_0x5dba75[_0xb51f('0x37')][_0xb51f('0x41')]+'%'};return _0x4119e7;}})});}_0x3f6563=_['merge']({},_0x3f6563,_0x5dba75['options']);var _0x29fb89={'where':_0x3f6563[_0xb51f('0x3e')]};return db[_0xb51f('0x44')][_0xb51f('0x1f')](_0x29fb89)[_0xb51f('0x27')](function(_0x3b0a22){_0x250890[_0xb51f('0x1f')]=_0x3b0a22;if(_0x5dba75['query'][_0xb51f('0x45')]){_0x3f6563[_0xb51f('0x46')]=[{'all':!![]}];}return db['Trigger'][_0xb51f('0x47')](_0x3f6563);})[_0xb51f('0x27')](function(_0x39a1fa){_0x250890[_0xb51f('0x48')]=_0x39a1fa;return _0x250890;})[_0xb51f('0x27')](respondWithFilteredResult(_0x540018,_0x3f6563))['catch'](handleError(_0x540018,null));};exports['show']=function(_0x1704a4,_0xe106b8){var _0x3d8cf5={'raw':![],'where':{'id':_0x1704a4['params']['id']}},_0x15370d={};_0x15370d['model']=_[_0xb51f('0x49')](db[_0xb51f('0x44')]['rawAttributes']);_0x15370d['query']=_[_0xb51f('0x49')](_0x1704a4['query']);_0x15370d[_0xb51f('0x3f')]=_[_0xb51f('0x38')](_0x15370d[_0xb51f('0x36')],_0x15370d[_0xb51f('0x37')]);_0x3d8cf5[_0xb51f('0x3a')]=_[_0xb51f('0x38')](_0x15370d[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x1704a4[_0xb51f('0x37')]['fields']));_0x3d8cf5[_0xb51f('0x3a')]=_0x3d8cf5['attributes'][_0xb51f('0x3b')]?_0x3d8cf5[_0xb51f('0x3a')]:_0x15370d[_0xb51f('0x36')];if(_0x1704a4[_0xb51f('0x37')][_0xb51f('0x45')]){_0x3d8cf5[_0xb51f('0x46')]=[{'all':!![]}];}_0x3d8cf5=_[_0xb51f('0x42')]({},_0x3d8cf5,_0x1704a4[_0xb51f('0x4a')]);return db[_0xb51f('0x44')][_0xb51f('0x4b')](_0x3d8cf5)[_0xb51f('0x27')](handleEntityNotFound(_0xe106b8,null))[_0xb51f('0x27')](respondWithResult(_0xe106b8,null))['catch'](handleError(_0xe106b8,null));};exports['create']=function(_0x202738,_0xba2ecd){return db[_0xb51f('0x44')]['create'](_0x202738[_0xb51f('0x4c')],{})[_0xb51f('0x27')](function(_0x1f6b12){var _0x142de4=_0x202738[_0xb51f('0x4d')][_0xb51f('0x28')]({'plain':!![]});if(!_0x142de4)throw new Error(_0xb51f('0x4e'));if(_0x142de4['role']===_0xb51f('0x4d')){var _0x40967b=_0x1f6b12[_0xb51f('0x28')]({'plain':!![]});var _0x3b83cf='Triggers';return db[_0xb51f('0x4f')][_0xb51f('0x4b')]({'where':{'name':_0x3b83cf,'userProfileId':_0x142de4[_0xb51f('0x50')]},'raw':!![]})[_0xb51f('0x27')](function(_0x3c94c3){if(_0x3c94c3&&_0x3c94c3[_0xb51f('0x51')]===0x0){return db[_0xb51f('0x2a')][_0xb51f('0x52')]({'name':_0x40967b[_0xb51f('0x2e')],'resourceId':_0x40967b['id'],'type':_0x3c94c3[_0xb51f('0x2e')],'sectionId':_0x3c94c3['id']},{})[_0xb51f('0x27')](function(){return _0x1f6b12;});}else{return _0x1f6b12;}})[_0xb51f('0x53')](function(_0x2fbe93){logger[_0xb51f('0x2c')](_0xb51f('0x54'),_0x2fbe93);throw _0x2fbe93;});}return _0x1f6b12;})['then'](respondWithResult(_0xba2ecd,0xc9))[_0xb51f('0x53')](handleError(_0xba2ecd,null));};exports[_0xb51f('0x25')]=function(_0x162487,_0x1ce7ca){if(_0x162487[_0xb51f('0x4c')]['id']){delete _0x162487['body']['id'];}return db[_0xb51f('0x44')][_0xb51f('0x4b')]({'where':{'id':_0x162487[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x1ce7ca,null))[_0xb51f('0x27')](saveUpdates(_0x162487['body'],null))[_0xb51f('0x27')](respondWithResult(_0x1ce7ca,null))['catch'](handleError(_0x1ce7ca,null));};exports[_0xb51f('0x26')]=function(_0x1a2a96,_0x452597){return db[_0xb51f('0x44')]['find']({'where':{'id':_0x1a2a96[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x452597,null))['then'](removeEntity(_0x452597,null))[_0xb51f('0x53')](handleError(_0x452597,null));};exports[_0xb51f('0x56')]=function(_0x2a08b2,_0x4fbf78,_0x4c1b1f){if(_0x2a08b2['body']['id']){delete _0x2a08b2[_0xb51f('0x4c')]['id'];}return db[_0xb51f('0x44')]['find']({'where':{'id':_0x2a08b2[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x4fbf78,null))[_0xb51f('0x27')](function(_0x23af5a){if(_0x23af5a){_0x2a08b2['body'][_0xb51f('0x57')]=_0x23af5a['id'];return db[_0xb51f('0x58')][_0xb51f('0x52')](_0x2a08b2[_0xb51f('0x4c')]);}})[_0xb51f('0x27')](respondWithResult(_0x4fbf78,null))[_0xb51f('0x53')](handleError(_0x4fbf78,null));};exports['addAnyCondition']=function(_0x347082,_0xf7182a,_0x248f35){if(_0x347082['body']['id']){delete _0x347082[_0xb51f('0x4c')]['id'];}return db[_0xb51f('0x44')]['find']({'where':{'id':_0x347082[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0xf7182a,null))[_0xb51f('0x27')](function(_0x51cce6){if(_0x51cce6){_0x347082[_0xb51f('0x4c')][_0xb51f('0x59')]=_0x51cce6['id'];return db[_0xb51f('0x58')][_0xb51f('0x52')](_0x347082[_0xb51f('0x4c')]);}})['then'](respondWithResult(_0xf7182a,null))[_0xb51f('0x53')](handleError(_0xf7182a,null));};exports[_0xb51f('0x5a')]=function(_0x1d4e9b,_0x3a8ac7,_0x796931){var _0xcf4049={};var _0x335980={};var _0x483dd4;var _0x4c698c;return db[_0xb51f('0x44')]['findOne']({'where':{'id':_0x1d4e9b[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x3a8ac7,null))[_0xb51f('0x27')](function(_0x5db8e6){if(_0x5db8e6){_0x483dd4=_0x5db8e6;_0x335980[_0xb51f('0x36')]=_[_0xb51f('0x49')](db[_0xb51f('0x58')]['rawAttributes']);_0x335980[_0xb51f('0x37')]=_[_0xb51f('0x49')](_0x1d4e9b[_0xb51f('0x37')]);_0x335980[_0xb51f('0x3f')]=_['intersection'](_0x335980['model'],_0x335980[_0xb51f('0x37')]);_0xcf4049[_0xb51f('0x3a')]=_['intersection'](_0x335980[_0xb51f('0x36')],qs['fields'](_0x1d4e9b['query']['fields']));_0xcf4049[_0xb51f('0x3a')]=_0xcf4049['attributes'][_0xb51f('0x3b')]?_0xcf4049[_0xb51f('0x3a')]:_0x335980[_0xb51f('0x36')];_0xcf4049[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x1d4e9b['query'][_0xb51f('0x3d')]);_0xcf4049[_0xb51f('0x3e')]=qs[_0xb51f('0x3f')](_[_0xb51f('0x40')](_0x1d4e9b[_0xb51f('0x37')],_0x335980['filters']));if(_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x41')]){_0xcf4049[_0xb51f('0x3e')]=_[_0xb51f('0x42')](_0xcf4049[_0xb51f('0x3e')],{'$or':_['map'](_0xcf4049[_0xb51f('0x3a')],function(_0x27f583){var _0x16462c={};_0x16462c[_0x27f583]={'$like':'%'+_0x1d4e9b['query'][_0xb51f('0x41')]+'%'};return _0x16462c;})});}_0xcf4049=_[_0xb51f('0x42')]({},_0xcf4049,_0x1d4e9b[_0xb51f('0x4a')]);return _0x483dd4[_0xb51f('0x5a')](_0xcf4049);}})[_0xb51f('0x27')](function(_0x429af9){if(_0x429af9){_0x4c698c=_0x429af9[_0xb51f('0x3b')];if(!_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x5b')](_0xb51f('0x5c'))){_0xcf4049[_0xb51f('0x1e')]=qs[_0xb51f('0x1e')](_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x1e')]);_0xcf4049[_0xb51f('0x1c')]=qs[_0xb51f('0x1c')](_0x1d4e9b[_0xb51f('0x37')][_0xb51f('0x1c')]);}return _0x483dd4['getAllConditions'](_0xcf4049);}})[_0xb51f('0x27')](function(_0x286ac2){if(_0x286ac2){return _0x286ac2?{'count':_0x4c698c,'rows':_0x286ac2}:null;}})['then'](respondWithResult(_0x3a8ac7,null))[_0xb51f('0x53')](handleError(_0x3a8ac7,null));};exports[_0xb51f('0x5d')]=function(_0x599b02,_0x427c9d,_0x1658ed){var _0x1048b9={};var _0x59f1ec={};var _0x5c52fb;var _0x2fc3f9;return db[_0xb51f('0x44')][_0xb51f('0x5e')]({'where':{'id':_0x599b02['params']['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x427c9d,null))[_0xb51f('0x27')](function(_0x3afc83){if(_0x3afc83){_0x5c52fb=_0x3afc83;_0x59f1ec[_0xb51f('0x36')]=_[_0xb51f('0x49')](db[_0xb51f('0x58')][_0xb51f('0x32')]);_0x59f1ec[_0xb51f('0x37')]=_[_0xb51f('0x49')](_0x599b02[_0xb51f('0x37')]);_0x59f1ec['filters']=_[_0xb51f('0x38')](_0x59f1ec[_0xb51f('0x36')],_0x59f1ec['query']);_0x1048b9['attributes']=_[_0xb51f('0x38')](_0x59f1ec[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x39')]));_0x1048b9[_0xb51f('0x3a')]=_0x1048b9['attributes'][_0xb51f('0x3b')]?_0x1048b9[_0xb51f('0x3a')]:_0x59f1ec[_0xb51f('0x36')];_0x1048b9[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x3d')]);_0x1048b9['where']=qs['filters'](_['pick'](_0x599b02[_0xb51f('0x37')],_0x59f1ec[_0xb51f('0x3f')]));if(_0x599b02[_0xb51f('0x37')][_0xb51f('0x41')]){_0x1048b9[_0xb51f('0x3e')]=_[_0xb51f('0x42')](_0x1048b9[_0xb51f('0x3e')],{'$or':_[_0xb51f('0x31')](_0x1048b9[_0xb51f('0x3a')],function(_0x5e742a){var _0x185c5b={};_0x185c5b[_0x5e742a]={'$like':'%'+_0x599b02[_0xb51f('0x37')]['filter']+'%'};return _0x185c5b;})});}_0x1048b9=_['merge']({},_0x1048b9,_0x599b02['options']);return _0x5c52fb[_0xb51f('0x5d')](_0x1048b9);}})[_0xb51f('0x27')](function(_0x120d42){if(_0x120d42){_0x2fc3f9=_0x120d42['length'];if(!_0x599b02[_0xb51f('0x37')][_0xb51f('0x5b')](_0xb51f('0x5c'))){_0x1048b9['limit']=qs[_0xb51f('0x1e')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x1e')]);_0x1048b9[_0xb51f('0x1c')]=qs[_0xb51f('0x1c')](_0x599b02[_0xb51f('0x37')][_0xb51f('0x1c')]);}return _0x5c52fb[_0xb51f('0x5d')](_0x1048b9);}})[_0xb51f('0x27')](function(_0x1cb4d4){if(_0x1cb4d4){return _0x1cb4d4?{'count':_0x2fc3f9,'rows':_0x1cb4d4}:null;}})[_0xb51f('0x27')](respondWithResult(_0x427c9d,null))[_0xb51f('0x53')](handleError(_0x427c9d,null));};exports[_0xb51f('0x5f')]=function(_0x369642,_0x19cfc8,_0x1ba692){if(_0x369642['body']['id']){delete _0x369642[_0xb51f('0x4c')]['id'];}return db['Trigger'][_0xb51f('0x4b')]({'where':{'id':_0x369642[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x19cfc8,null))[_0xb51f('0x27')](function(_0x3bcc82){if(_0x3bcc82){_0x369642['body'][_0xb51f('0x60')]=_0x3bcc82['id'];return db[_0xb51f('0x61')][_0xb51f('0x52')](_0x369642[_0xb51f('0x4c')]);}})[_0xb51f('0x27')](respondWithResult(_0x19cfc8,null))[_0xb51f('0x53')](handleError(_0x19cfc8,null));};exports[_0xb51f('0x62')]=function(_0x57e35c,_0x244f40,_0x4f89e8){var _0x5db82b={};var _0x66f719={};var _0x4fe07a;var _0x524b77;return db[_0xb51f('0x44')][_0xb51f('0x5e')]({'where':{'id':_0x57e35c[_0xb51f('0x55')]['id']}})[_0xb51f('0x27')](handleEntityNotFound(_0x244f40,null))[_0xb51f('0x27')](function(_0x4f7498){if(_0x4f7498){_0x4fe07a=_0x4f7498;_0x66f719['model']=_[_0xb51f('0x49')](db[_0xb51f('0x61')][_0xb51f('0x32')]);_0x66f719[_0xb51f('0x37')]=_[_0xb51f('0x49')](_0x57e35c[_0xb51f('0x37')]);_0x66f719[_0xb51f('0x3f')]=_[_0xb51f('0x38')](_0x66f719[_0xb51f('0x36')],_0x66f719['query']);_0x5db82b[_0xb51f('0x3a')]=_[_0xb51f('0x38')](_0x66f719[_0xb51f('0x36')],qs[_0xb51f('0x39')](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x39')]));_0x5db82b['attributes']=_0x5db82b[_0xb51f('0x3a')][_0xb51f('0x3b')]?_0x5db82b[_0xb51f('0x3a')]:_0x66f719['model'];_0x5db82b[_0xb51f('0x3c')]=qs[_0xb51f('0x3d')](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x3d')]);_0x5db82b[_0xb51f('0x3e')]=qs[_0xb51f('0x3f')](_[_0xb51f('0x40')](_0x57e35c[_0xb51f('0x37')],_0x66f719[_0xb51f('0x3f')]));if(_0x57e35c['query'][_0xb51f('0x41')]){_0x5db82b['where']=_['merge'](_0x5db82b[_0xb51f('0x3e')],{'$or':_[_0xb51f('0x31')](_0x5db82b[_0xb51f('0x3a')],function(_0xc21345){var _0x2f5b74={};_0x2f5b74[_0xc21345]={'$like':'%'+_0x57e35c[_0xb51f('0x37')][_0xb51f('0x41')]+'%'};return _0x2f5b74;})});}_0x5db82b=_['merge']({},_0x5db82b,_0x57e35c[_0xb51f('0x4a')]);return _0x4fe07a[_0xb51f('0x62')](_0x5db82b);}})[_0xb51f('0x27')](function(_0x595319){if(_0x595319){_0x524b77=_0x595319['length'];if(!_0x57e35c['query'][_0xb51f('0x5b')](_0xb51f('0x5c'))){_0x5db82b[_0xb51f('0x1e')]=qs['limit'](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x1e')]);_0x5db82b['offset']=qs['offset'](_0x57e35c[_0xb51f('0x37')][_0xb51f('0x1c')]);}return _0x4fe07a[_0xb51f('0x62')](_0x5db82b);}})[_0xb51f('0x27')](function(_0x4caeb7){if(_0x4caeb7){return _0x4caeb7?{'count':_0x524b77,'rows':_0x4caeb7}:null;}})['then'](respondWithResult(_0x244f40,null))['catch'](handleError(_0x244f40,null));}; \ No newline at end of file +var _0xde0e=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','includeAll','include','Trigger','rows','catch','length','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','options','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3d61c6,_0x4571e6){var _0x47e0df=function(_0x25adfd){while(--_0x25adfd){_0x3d61c6['push'](_0x3d61c6['shift']());}};_0x47e0df(++_0x4571e6);}(_0xde0e,0xfc));var _0xede0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde0e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xede0('0x0'));var rimraf=require(_0xede0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xede0('0x2'));var rp=require(_0xede0('0x3'));var moment=require('moment');var BPromise=require(_0xede0('0x4'));var Mustache=require(_0xede0('0x5'));var util=require(_0xede0('0x6'));var path=require(_0xede0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xede0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xede0('0x9'));var squel=require(_0xede0('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xede0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xede0('0xc'));var Papa=require(_0xede0('0xd'));var Redis=require(_0xede0('0xe'));var authService=require(_0xede0('0xf'));var qs=require(_0xede0('0x10'));var as=require(_0xede0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xede0('0x12'));var utils=require(_0xede0('0x13'));var config=require(_0xede0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xede0('0x15'))['db'];function respondWithStatusCode(_0x7c2508,_0x3850aa){_0x3850aa=_0x3850aa||0xcc;return function(_0x2da8ac){if(_0x2da8ac){return _0x7c2508[_0xede0('0x16')](_0x3850aa);}return _0x7c2508['status'](_0x3850aa)[_0xede0('0x17')]();};}function respondWithResult(_0xe4638b,_0x3751d2){_0x3751d2=_0x3751d2||0xc8;return function(_0x1e2216){if(_0x1e2216){return _0xe4638b[_0xede0('0x18')](_0x3751d2)['json'](_0x1e2216);}};}function respondWithFilteredResult(_0x29c3cd,_0x4521d0){return function(_0x2958fc){if(_0x2958fc){var _0x4d49ca=typeof _0x4521d0[_0xede0('0x19')]==='undefined'&&typeof _0x4521d0['limit']==='undefined';var _0xf51a76=_0x2958fc[_0xede0('0x1a')];var _0xaa5508=_0x4d49ca?0x0:_0x4521d0['offset'];var _0x5efb25=_0x4d49ca?_0x2958fc['count']:_0x4521d0[_0xede0('0x19')]+_0x4521d0[_0xede0('0x1b')];var _0x2702d1;if(_0x5efb25>=_0xf51a76){_0x5efb25=_0xf51a76;_0x2702d1=0xc8;}else{_0x2702d1=0xce;}_0x29c3cd[_0xede0('0x18')](_0x2702d1);return _0x29c3cd[_0xede0('0x1c')](_0xede0('0x1d'),_0xaa5508+'-'+_0x5efb25+'/'+_0xf51a76)['json'](_0x2958fc);}return null;};}function patchUpdates(_0x5142af){return function(_0xa7701e){try{jsonpatch[_0xede0('0x1e')](_0xa7701e,_0x5142af,!![]);}catch(_0x30a106){return BPromise[_0xede0('0x1f')](_0x30a106);}return _0xa7701e[_0xede0('0x20')]();};}function saveUpdates(_0xd46117,_0x1c9fe8){return function(_0x203011){if(_0x203011){return _0x203011[_0xede0('0x21')](_0xd46117)[_0xede0('0x22')](function(_0x47ba99){return _0x47ba99;});}return null;};}function removeEntity(_0x5074b7,_0x114139){return function(_0x1c78c6){if(_0x1c78c6){return _0x1c78c6[_0xede0('0x23')]()[_0xede0('0x22')](function(){var _0x57f84a=_0x1c78c6[_0xede0('0x24')]({'plain':!![]});var _0x220876=_0xede0('0x25');return db[_0xede0('0x26')][_0xede0('0x23')]({'where':{'type':_0x220876,'resourceId':_0x57f84a['id']}})[_0xede0('0x22')](function(){return _0x1c78c6;});})[_0xede0('0x22')](function(){_0x5074b7['status'](0xcc)[_0xede0('0x17')]();});}};}function handleEntityNotFound(_0x4d8a04,_0x18a065){return function(_0x468da5){if(!_0x468da5){_0x4d8a04['sendStatus'](0x194);}return _0x468da5;};}function handleError(_0x268532,_0x12d37a){_0x12d37a=_0x12d37a||0x1f4;return function(_0x3b6618){logger[_0xede0('0x27')](_0x3b6618[_0xede0('0x28')]);if(_0x3b6618[_0xede0('0x29')]){delete _0x3b6618[_0xede0('0x29')];}_0x268532[_0xede0('0x18')](_0x12d37a)[_0xede0('0x2a')](_0x3b6618);};}exports[_0xede0('0x2b')]=function(_0x1e617d,_0x1b5900){var _0x4b4cd6={},_0x52c207={},_0x1fbf43={'count':0x0,'rows':[]};var _0x16fca2=_[_0xede0('0x2c')](db['Trigger'][_0xede0('0x2d')],function(_0x2b9604){return{'name':_0x2b9604[_0xede0('0x2e')],'type':_0x2b9604['type'][_0xede0('0x2f')]};});_0x52c207[_0xede0('0x30')]=_[_0xede0('0x2c')](_0x16fca2,'name');_0x52c207[_0xede0('0x31')]=_[_0xede0('0x32')](_0x1e617d[_0xede0('0x31')]);_0x52c207[_0xede0('0x33')]=_[_0xede0('0x34')](_0x52c207[_0xede0('0x30')],_0x52c207['query']);_0x4b4cd6[_0xede0('0x35')]=_['intersection'](_0x52c207[_0xede0('0x30')],qs[_0xede0('0x36')](_0x1e617d[_0xede0('0x31')][_0xede0('0x36')]));_0x4b4cd6[_0xede0('0x35')]=_0x4b4cd6['attributes']['length']?_0x4b4cd6[_0xede0('0x35')]:_0x52c207['model'];if(!_0x1e617d['query'][_0xede0('0x37')](_0xede0('0x38'))){_0x4b4cd6['limit']=qs[_0xede0('0x1b')](_0x1e617d[_0xede0('0x31')]['limit']);_0x4b4cd6[_0xede0('0x19')]=qs[_0xede0('0x19')](_0x1e617d[_0xede0('0x31')]['offset']);}_0x4b4cd6[_0xede0('0x39')]=qs[_0xede0('0x3a')](_0x1e617d['query'][_0xede0('0x3a')]);_0x4b4cd6['where']=qs[_0xede0('0x33')](_[_0xede0('0x3b')](_0x1e617d[_0xede0('0x31')],_0x52c207[_0xede0('0x33')]),_0x16fca2);if(_0x1e617d['query'][_0xede0('0x3c')]){_0x4b4cd6[_0xede0('0x3d')]=_[_0xede0('0x3e')](_0x4b4cd6[_0xede0('0x3d')],{'$or':_['map'](_0x16fca2,function(_0x445ea0){if(_0x445ea0[_0xede0('0x3f')]!=='VIRTUAL'){var _0x235703={};_0x235703[_0x445ea0[_0xede0('0x29')]]={'$like':'%'+_0x1e617d['query']['filter']+'%'};return _0x235703;}})});}_0x4b4cd6=_['merge']({},_0x4b4cd6,_0x1e617d['options']);var _0x23616e={'where':_0x4b4cd6[_0xede0('0x3d')]};return db['Trigger'][_0xede0('0x1a')](_0x23616e)[_0xede0('0x22')](function(_0x4fc680){_0x1fbf43[_0xede0('0x1a')]=_0x4fc680;if(_0x1e617d['query'][_0xede0('0x40')]){_0x4b4cd6[_0xede0('0x41')]=[{'all':!![]}];}return db[_0xede0('0x42')]['findAll'](_0x4b4cd6);})['then'](function(_0x3e3fd6){_0x1fbf43[_0xede0('0x43')]=_0x3e3fd6;return _0x1fbf43;})[_0xede0('0x22')](respondWithFilteredResult(_0x1b5900,_0x4b4cd6))[_0xede0('0x44')](handleError(_0x1b5900,null));};exports['show']=function(_0x1fbf75,_0x5219b0){var _0x3747f9={'raw':![],'where':{'id':_0x1fbf75['params']['id']}},_0x8f2e75={};_0x8f2e75[_0xede0('0x30')]=_[_0xede0('0x32')](db['Trigger'][_0xede0('0x2d')]);_0x8f2e75['query']=_[_0xede0('0x32')](_0x1fbf75['query']);_0x8f2e75[_0xede0('0x33')]=_[_0xede0('0x34')](_0x8f2e75[_0xede0('0x30')],_0x8f2e75[_0xede0('0x31')]);_0x3747f9[_0xede0('0x35')]=_[_0xede0('0x34')](_0x8f2e75[_0xede0('0x30')],qs[_0xede0('0x36')](_0x1fbf75[_0xede0('0x31')]['fields']));_0x3747f9[_0xede0('0x35')]=_0x3747f9[_0xede0('0x35')][_0xede0('0x45')]?_0x3747f9['attributes']:_0x8f2e75[_0xede0('0x30')];if(_0x1fbf75[_0xede0('0x31')][_0xede0('0x40')]){_0x3747f9[_0xede0('0x41')]=[{'all':!![]}];}_0x3747f9=_['merge']({},_0x3747f9,_0x1fbf75['options']);return db[_0xede0('0x42')][_0xede0('0x46')](_0x3747f9)[_0xede0('0x22')](handleEntityNotFound(_0x5219b0,null))[_0xede0('0x22')](respondWithResult(_0x5219b0,null))[_0xede0('0x44')](handleError(_0x5219b0,null));};exports['create']=function(_0x516a0b,_0x263cf5){return db['Trigger'][_0xede0('0x47')](_0x516a0b[_0xede0('0x48')],{})[_0xede0('0x22')](function(_0x4ce584){var _0xa92e6b=_0x516a0b[_0xede0('0x49')][_0xede0('0x24')]({'plain':!![]});if(!_0xa92e6b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa92e6b[_0xede0('0x4a')]===_0xede0('0x49')){var _0x21550a=_0x4ce584[_0xede0('0x24')]({'plain':!![]});var _0x2b0719=_0xede0('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x2b0719,'userProfileId':_0xa92e6b['userProfileId']},'raw':!![]})['then'](function(_0xe72a62){if(_0xe72a62&&_0xe72a62[_0xede0('0x4b')]===0x0){return db[_0xede0('0x26')][_0xede0('0x47')]({'name':_0x21550a['name'],'resourceId':_0x21550a['id'],'type':_0xe72a62[_0xede0('0x29')],'sectionId':_0xe72a62['id']},{})['then'](function(){return _0x4ce584;});}else{return _0x4ce584;}})[_0xede0('0x44')](function(_0x5569bc){logger[_0xede0('0x27')](_0xede0('0x4c'),_0x5569bc);throw _0x5569bc;});}return _0x4ce584;})[_0xede0('0x22')](respondWithResult(_0x263cf5,0xc9))[_0xede0('0x44')](handleError(_0x263cf5,null));};exports[_0xede0('0x21')]=function(_0x45247d,_0x3cd8ce){if(_0x45247d['body']['id']){delete _0x45247d['body']['id'];}return db[_0xede0('0x42')][_0xede0('0x46')]({'where':{'id':_0x45247d[_0xede0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3cd8ce,null))[_0xede0('0x22')](saveUpdates(_0x45247d[_0xede0('0x48')],null))['then'](respondWithResult(_0x3cd8ce,null))[_0xede0('0x44')](handleError(_0x3cd8ce,null));};exports[_0xede0('0x23')]=function(_0x54a39a,_0x516733){return db[_0xede0('0x42')]['find']({'where':{'id':_0x54a39a[_0xede0('0x4d')]['id']}})[_0xede0('0x22')](handleEntityNotFound(_0x516733,null))[_0xede0('0x22')](removeEntity(_0x516733,null))['catch'](handleError(_0x516733,null));};exports[_0xede0('0x4e')]=function(_0x11b747,_0x70bef,_0x39e085){if(_0x11b747[_0xede0('0x48')]['id']){delete _0x11b747[_0xede0('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x11b747['params']['id']}})[_0xede0('0x22')](handleEntityNotFound(_0x70bef,null))[_0xede0('0x22')](function(_0x35c055){if(_0x35c055){_0x11b747[_0xede0('0x48')][_0xede0('0x4f')]=_0x35c055['id'];return db['Condition'][_0xede0('0x47')](_0x11b747[_0xede0('0x48')]);}})['then'](respondWithResult(_0x70bef,null))['catch'](handleError(_0x70bef,null));};exports[_0xede0('0x50')]=function(_0x1e8e4f,_0x18e304,_0x1e2c53){if(_0x1e8e4f[_0xede0('0x48')]['id']){delete _0x1e8e4f['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x1e8e4f['params']['id']}})[_0xede0('0x22')](handleEntityNotFound(_0x18e304,null))[_0xede0('0x22')](function(_0x110253){if(_0x110253){_0x1e8e4f[_0xede0('0x48')][_0xede0('0x51')]=_0x110253['id'];return db[_0xede0('0x52')]['create'](_0x1e8e4f[_0xede0('0x48')]);}})['then'](respondWithResult(_0x18e304,null))['catch'](handleError(_0x18e304,null));};exports[_0xede0('0x53')]=function(_0x1e4279,_0x372b3d,_0x5130a5){var _0x20fd64={};var _0x501698={};var _0x59759a;var _0x44820e;return db[_0xede0('0x42')][_0xede0('0x54')]({'where':{'id':_0x1e4279['params']['id']}})['then'](handleEntityNotFound(_0x372b3d,null))['then'](function(_0x2b173b){if(_0x2b173b){_0x59759a=_0x2b173b;_0x501698[_0xede0('0x30')]=_[_0xede0('0x32')](db['Condition']['rawAttributes']);_0x501698[_0xede0('0x31')]=_[_0xede0('0x32')](_0x1e4279[_0xede0('0x31')]);_0x501698[_0xede0('0x33')]=_[_0xede0('0x34')](_0x501698[_0xede0('0x30')],_0x501698['query']);_0x20fd64[_0xede0('0x35')]=_[_0xede0('0x34')](_0x501698[_0xede0('0x30')],qs[_0xede0('0x36')](_0x1e4279[_0xede0('0x31')][_0xede0('0x36')]));_0x20fd64[_0xede0('0x35')]=_0x20fd64[_0xede0('0x35')][_0xede0('0x45')]?_0x20fd64[_0xede0('0x35')]:_0x501698[_0xede0('0x30')];_0x20fd64[_0xede0('0x39')]=qs['sort'](_0x1e4279['query'][_0xede0('0x3a')]);_0x20fd64[_0xede0('0x3d')]=qs[_0xede0('0x33')](_[_0xede0('0x3b')](_0x1e4279[_0xede0('0x31')],_0x501698[_0xede0('0x33')]));if(_0x1e4279[_0xede0('0x31')]['filter']){_0x20fd64['where']=_[_0xede0('0x3e')](_0x20fd64[_0xede0('0x3d')],{'$or':_[_0xede0('0x2c')](_0x20fd64[_0xede0('0x35')],function(_0x4c13c3){var _0x1b9e35={};_0x1b9e35[_0x4c13c3]={'$like':'%'+_0x1e4279[_0xede0('0x31')]['filter']+'%'};return _0x1b9e35;})});}_0x20fd64=_[_0xede0('0x3e')]({},_0x20fd64,_0x1e4279['options']);return _0x59759a['getAllConditions'](_0x20fd64);}})[_0xede0('0x22')](function(_0x5f83b3){if(_0x5f83b3){_0x44820e=_0x5f83b3[_0xede0('0x45')];if(!_0x1e4279[_0xede0('0x31')][_0xede0('0x37')](_0xede0('0x38'))){_0x20fd64[_0xede0('0x1b')]=qs[_0xede0('0x1b')](_0x1e4279[_0xede0('0x31')][_0xede0('0x1b')]);_0x20fd64[_0xede0('0x19')]=qs['offset'](_0x1e4279[_0xede0('0x31')][_0xede0('0x19')]);}return _0x59759a[_0xede0('0x53')](_0x20fd64);}})[_0xede0('0x22')](function(_0x455979){if(_0x455979){return _0x455979?{'count':_0x44820e,'rows':_0x455979}:null;}})['then'](respondWithResult(_0x372b3d,null))['catch'](handleError(_0x372b3d,null));};exports['getAnyConditions']=function(_0x48f27c,_0xab1c80,_0x3e647b){var _0x3635aa={};var _0x2164ff={};var _0x4dcacc;var _0x367b7d;return db[_0xede0('0x42')][_0xede0('0x54')]({'where':{'id':_0x48f27c['params']['id']}})['then'](handleEntityNotFound(_0xab1c80,null))[_0xede0('0x22')](function(_0x2fff12){if(_0x2fff12){_0x4dcacc=_0x2fff12;_0x2164ff[_0xede0('0x30')]=_[_0xede0('0x32')](db[_0xede0('0x52')][_0xede0('0x2d')]);_0x2164ff[_0xede0('0x31')]=_[_0xede0('0x32')](_0x48f27c[_0xede0('0x31')]);_0x2164ff['filters']=_[_0xede0('0x34')](_0x2164ff[_0xede0('0x30')],_0x2164ff[_0xede0('0x31')]);_0x3635aa[_0xede0('0x35')]=_[_0xede0('0x34')](_0x2164ff['model'],qs[_0xede0('0x36')](_0x48f27c[_0xede0('0x31')][_0xede0('0x36')]));_0x3635aa['attributes']=_0x3635aa['attributes'][_0xede0('0x45')]?_0x3635aa['attributes']:_0x2164ff[_0xede0('0x30')];_0x3635aa[_0xede0('0x39')]=qs['sort'](_0x48f27c[_0xede0('0x31')]['sort']);_0x3635aa[_0xede0('0x3d')]=qs[_0xede0('0x33')](_[_0xede0('0x3b')](_0x48f27c[_0xede0('0x31')],_0x2164ff[_0xede0('0x33')]));if(_0x48f27c[_0xede0('0x31')]['filter']){_0x3635aa[_0xede0('0x3d')]=_['merge'](_0x3635aa[_0xede0('0x3d')],{'$or':_['map'](_0x3635aa[_0xede0('0x35')],function(_0x504050){var _0x954669={};_0x954669[_0x504050]={'$like':'%'+_0x48f27c['query']['filter']+'%'};return _0x954669;})});}_0x3635aa=_[_0xede0('0x3e')]({},_0x3635aa,_0x48f27c[_0xede0('0x55')]);return _0x4dcacc['getAnyConditions'](_0x3635aa);}})[_0xede0('0x22')](function(_0xd5ad01){if(_0xd5ad01){_0x367b7d=_0xd5ad01[_0xede0('0x45')];if(!_0x48f27c[_0xede0('0x31')]['hasOwnProperty']('nolimit')){_0x3635aa['limit']=qs['limit'](_0x48f27c[_0xede0('0x31')][_0xede0('0x1b')]);_0x3635aa['offset']=qs[_0xede0('0x19')](_0x48f27c[_0xede0('0x31')][_0xede0('0x19')]);}return _0x4dcacc['getAnyConditions'](_0x3635aa);}})['then'](function(_0xd08734){if(_0xd08734){return _0xd08734?{'count':_0x367b7d,'rows':_0xd08734}:null;}})[_0xede0('0x22')](respondWithResult(_0xab1c80,null))[_0xede0('0x44')](handleError(_0xab1c80,null));};exports[_0xede0('0x56')]=function(_0x2c28f5,_0x2226a8,_0x4390ac){if(_0x2c28f5[_0xede0('0x48')]['id']){delete _0x2c28f5[_0xede0('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2c28f5[_0xede0('0x4d')]['id']}})[_0xede0('0x22')](handleEntityNotFound(_0x2226a8,null))[_0xede0('0x22')](function(_0x3c1f24){if(_0x3c1f24){_0x2c28f5['body'][_0xede0('0x57')]=_0x3c1f24['id'];return db[_0xede0('0x58')][_0xede0('0x47')](_0x2c28f5[_0xede0('0x48')]);}})[_0xede0('0x22')](respondWithResult(_0x2226a8,null))['catch'](handleError(_0x2226a8,null));};exports['getActions']=function(_0x2cdf86,_0x75106a,_0x2b051b){var _0x135727={};var _0x4b4166={};var _0x21beb3;var _0x374278;return db['Trigger'][_0xede0('0x54')]({'where':{'id':_0x2cdf86[_0xede0('0x4d')]['id']}})[_0xede0('0x22')](handleEntityNotFound(_0x75106a,null))['then'](function(_0x39aa05){if(_0x39aa05){_0x21beb3=_0x39aa05;_0x4b4166[_0xede0('0x30')]=_[_0xede0('0x32')](db['Action']['rawAttributes']);_0x4b4166[_0xede0('0x31')]=_[_0xede0('0x32')](_0x2cdf86['query']);_0x4b4166['filters']=_[_0xede0('0x34')](_0x4b4166[_0xede0('0x30')],_0x4b4166[_0xede0('0x31')]);_0x135727[_0xede0('0x35')]=_[_0xede0('0x34')](_0x4b4166[_0xede0('0x30')],qs[_0xede0('0x36')](_0x2cdf86[_0xede0('0x31')]['fields']));_0x135727['attributes']=_0x135727[_0xede0('0x35')]['length']?_0x135727[_0xede0('0x35')]:_0x4b4166[_0xede0('0x30')];_0x135727[_0xede0('0x39')]=qs[_0xede0('0x3a')](_0x2cdf86['query']['sort']);_0x135727[_0xede0('0x3d')]=qs[_0xede0('0x33')](_[_0xede0('0x3b')](_0x2cdf86[_0xede0('0x31')],_0x4b4166[_0xede0('0x33')]));if(_0x2cdf86['query']['filter']){_0x135727[_0xede0('0x3d')]=_[_0xede0('0x3e')](_0x135727['where'],{'$or':_[_0xede0('0x2c')](_0x135727['attributes'],function(_0x4a7b8c){var _0x28dc96={};_0x28dc96[_0x4a7b8c]={'$like':'%'+_0x2cdf86[_0xede0('0x31')][_0xede0('0x3c')]+'%'};return _0x28dc96;})});}_0x135727=_[_0xede0('0x3e')]({},_0x135727,_0x2cdf86[_0xede0('0x55')]);return _0x21beb3[_0xede0('0x59')](_0x135727);}})[_0xede0('0x22')](function(_0x1816fd){if(_0x1816fd){_0x374278=_0x1816fd[_0xede0('0x45')];if(!_0x2cdf86[_0xede0('0x31')]['hasOwnProperty']('nolimit')){_0x135727[_0xede0('0x1b')]=qs[_0xede0('0x1b')](_0x2cdf86['query'][_0xede0('0x1b')]);_0x135727[_0xede0('0x19')]=qs[_0xede0('0x19')](_0x2cdf86[_0xede0('0x31')][_0xede0('0x19')]);}return _0x21beb3[_0xede0('0x59')](_0x135727);}})[_0xede0('0x22')](function(_0x308353){if(_0x308353){return _0x308353?{'count':_0x374278,'rows':_0x308353}:null;}})[_0xede0('0x22')](respondWithResult(_0x75106a,null))['catch'](handleError(_0x75106a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 257aeb4..b53d94f 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 _0x0328=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','Trigger','tools_triggers','lodash','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0328,0x172));var _0x8032=function(_0x62e5a,_0x380232){_0x62e5a=_0x62e5a-0x0;var _0x144048=_0x0328[_0x62e5a];return _0x144048;};'use strict';var _=require(_0x8032('0x0'));var util=require(_0x8032('0x1'));var logger=require(_0x8032('0x2'))(_0x8032('0x3'));var moment=require(_0x8032('0x4'));var BPromise=require(_0x8032('0x5'));var rp=require(_0x8032('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8032('0x7'));var config=require(_0x8032('0x8'));var attributes=require(_0x8032('0x9'));module['exports']=function(_0x7ccda3,_0x553c90){return _0x7ccda3['define'](_0x8032('0xa'),attributes,{'tableName':_0x8032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab29=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0xab29,0x145));var _0x9ab2=function(_0x357a5c,_0x4c771f){_0x357a5c=_0x357a5c-0x0;var _0x25ba64=_0xab29[_0x357a5c];return _0x25ba64;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var logger=require(_0x9ab2('0x2'))(_0x9ab2('0x3'));var moment=require('moment');var BPromise=require(_0x9ab2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ab2('0x5'));var rimraf=require(_0x9ab2('0x6'));var config=require(_0x9ab2('0x7'));var attributes=require(_0x9ab2('0x8'));module[_0x9ab2('0x9')]=function(_0x47cc4f,_0x3c3e85){return _0x47cc4f[_0x9ab2('0xa')](_0x9ab2('0xb'),attributes,{'tableName':_0x9ab2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index dac6c75..3226178 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 _0xa075=['Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','model','map','ShowTrigger','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2bccd9,_0x1d0e16){var _0xdabd4c=function(_0x2d15f8){while(--_0x2d15f8){_0x2bccd9['push'](_0x2bccd9['shift']());}};_0xdabd4c(++_0x1d0e16);}(_0xa075,0x102));var _0x5a07=function(_0x14cf6,_0x52f437){_0x14cf6=_0x14cf6-0x0;var _0xbcad5f=_0xa075[_0x14cf6];return _0xbcad5f;};'use strict';var _=require(_0x5a07('0x0'));var util=require(_0x5a07('0x1'));var moment=require(_0x5a07('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a07('0x5'))(_0x5a07('0x6'));var config=require(_0x5a07('0x7'));var jayson=require(_0x5a07('0x8'));var client=jayson[_0x5a07('0x9')][_0x5a07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54fec8,_0xbd9400,_0x1053cb){return new BPromise(function(_0x1195a3,_0x5dbc16){return client[_0x5a07('0xb')](_0x54fec8,_0x1053cb)[_0x5a07('0xc')](function(_0x5be6ff){logger[_0x5a07('0xd')](_0x5a07('0xe'),_0xbd9400,_0x5a07('0xf'));logger[_0x5a07('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0xbd9400,'request\x20sent',JSON[_0x5a07('0x11')](_0x5be6ff));if(_0x5be6ff[_0x5a07('0x12')]){if(_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x13')]===0x1f4){logger[_0x5a07('0x12')](_0x5a07('0xe'),_0xbd9400,_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);return _0x5dbc16(_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);}logger[_0x5a07('0x12')](_0x5a07('0xe'),_0xbd9400,_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);return _0x1195a3(_0x5be6ff[_0x5a07('0x12')][_0x5a07('0x14')]);}else{logger[_0x5a07('0xd')](_0x5a07('0xe'),_0xbd9400,_0x5a07('0xf'));_0x1195a3(_0x5be6ff[_0x5a07('0x15')][_0x5a07('0x14')]);}})[_0x5a07('0x16')](function(_0x202a4e){logger['error'](_0x5a07('0xe'),_0xbd9400,_0x202a4e);_0x5dbc16(_0x202a4e);});});}exports[_0x5a07('0x17')]=function(_0x225de9){var _0x566f85=this;return new Promise(function(_0x3405a1,_0xb23dd4){return db[_0x5a07('0x18')]['findAll']({'raw':_0x225de9[_0x5a07('0x19')]?_0x225de9[_0x5a07('0x19')][_0x5a07('0x1a')]===undefined?!![]:![]:!![],'where':_0x225de9[_0x5a07('0x19')]?_0x225de9['options'][_0x5a07('0x1b')]||null:null,'attributes':_0x225de9[_0x5a07('0x19')]?_0x225de9[_0x5a07('0x19')][_0x5a07('0x1c')]||null:null,'limit':_0x225de9['options']?_0x225de9[_0x5a07('0x19')][_0x5a07('0x1d')]||null:null,'include':_0x225de9['options']?_0x225de9['options']['include']?_['map'](_0x225de9[_0x5a07('0x19')][_0x5a07('0x1e')],function(_0x1013f0){return{'model':db[_0x1013f0[_0x5a07('0x1f')]],'as':_0x1013f0['as'],'attributes':_0x1013f0[_0x5a07('0x1c')],'include':_0x1013f0[_0x5a07('0x1e')]?_[_0x5a07('0x20')](_0x1013f0['include'],function(_0x487036){return{'model':db[_0x487036[_0x5a07('0x1f')]],'as':_0x487036['as'],'attributes':_0x487036[_0x5a07('0x1c')],'include':_0x487036['include']?_[_0x5a07('0x20')](_0x487036['include'],function(_0x52602d){return{'model':db[_0x52602d[_0x5a07('0x1f')]],'as':_0x52602d['as'],'attributes':_0x52602d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47fa33){logger[_0x5a07('0xd')](_0x5a07('0x17'),_0x225de9);logger['debug'](_0x5a07('0x17'),_0x225de9,JSON[_0x5a07('0x11')](_0x47fa33));_0x3405a1(_0x47fa33);})[_0x5a07('0x16')](function(_0x12b052){logger[_0x5a07('0x12')]('GetTrigger',_0x12b052['message'],_0x225de9);_0xb23dd4(_0x566f85[_0x5a07('0x12')](0x1f4,_0x12b052[_0x5a07('0x14')]));});});};exports[_0x5a07('0x21')]=function(_0x53ceae){var _0x278da3=this;return new Promise(function(_0x143b02,_0x5a0439){return db[_0x5a07('0x18')]['find']({'raw':_0x53ceae[_0x5a07('0x19')]?_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1a')]===undefined?!![]:![]:!![],'where':_0x53ceae[_0x5a07('0x19')]?_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1b')]||null:null,'attributes':_0x53ceae[_0x5a07('0x19')]?_0x53ceae['options'][_0x5a07('0x1c')]||null:null,'include':_0x53ceae[_0x5a07('0x19')]?_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1e')]?_['map'](_0x53ceae[_0x5a07('0x19')][_0x5a07('0x1e')],function(_0x262ae4){return{'model':db[_0x262ae4['model']],'as':_0x262ae4['as'],'attributes':_0x262ae4[_0x5a07('0x1c')],'include':_0x262ae4[_0x5a07('0x1e')]?_[_0x5a07('0x20')](_0x262ae4['include'],function(_0x49ba8c){return{'model':db[_0x49ba8c[_0x5a07('0x1f')]],'as':_0x49ba8c['as'],'attributes':_0x49ba8c[_0x5a07('0x1c')],'include':_0x49ba8c[_0x5a07('0x1e')]?_['map'](_0x49ba8c[_0x5a07('0x1e')],function(_0xe5c8fc){return{'model':db[_0xe5c8fc[_0x5a07('0x1f')]],'as':_0xe5c8fc['as'],'attributes':_0xe5c8fc[_0x5a07('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5a07('0xc')](function(_0x564905){logger[_0x5a07('0xd')](_0x5a07('0x21'),_0x53ceae);logger[_0x5a07('0x10')](_0x5a07('0x21'),_0x53ceae,JSON[_0x5a07('0x11')](_0x564905));_0x143b02(_0x564905);})[_0x5a07('0x16')](function(_0x8d5d3f){logger[_0x5a07('0x12')](_0x5a07('0x21'),_0x8d5d3f[_0x5a07('0x14')],_0x53ceae);_0x5a0439(_0x278da3['error'](0x1f4,_0x8d5d3f[_0x5a07('0x14')]));});});}; \ No newline at end of file +var _0x47de=['Trigger','findAll','raw','options','where','attributes','limit','include','model','map','ShowTrigger','find','util','moment','bluebird','ioredis','../../config/utils','rpc','client','http','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrigger'];(function(_0x46f06d,_0x48ca3e){var _0x511e7d=function(_0x26be6e){while(--_0x26be6e){_0x46f06d['push'](_0x46f06d['shift']());}};_0x511e7d(++_0x48ca3e);}(_0x47de,0xb1));var _0xe47d=function(_0x4511dd,_0x1d3e8f){_0x4511dd=_0x4511dd-0x0;var _0x36cae1=_0x47de[_0x4511dd];return _0x36cae1;};'use strict';var _=require('lodash');var util=require(_0xe47d('0x0'));var moment=require(_0xe47d('0x1'));var BPromise=require(_0xe47d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe47d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe47d('0x4'));var logger=require('../../config/logger')(_0xe47d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe47d('0x6')][_0xe47d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10d349,_0x16f73b,_0x2f495e){return new BPromise(function(_0x3680d3,_0x3e37c0){return client['request'](_0x10d349,_0x2f495e)[_0xe47d('0x8')](function(_0xa09787){logger[_0xe47d('0x9')](_0xe47d('0xa'),_0x16f73b,'request\x20sent');logger[_0xe47d('0xb')](_0xe47d('0xc'),_0x16f73b,_0xe47d('0xd'),JSON[_0xe47d('0xe')](_0xa09787));if(_0xa09787[_0xe47d('0xf')]){if(_0xa09787['error'][_0xe47d('0x10')]===0x1f4){logger[_0xe47d('0xf')]('Trigger,\x20%s,\x20%s',_0x16f73b,_0xa09787[_0xe47d('0xf')][_0xe47d('0x11')]);return _0x3e37c0(_0xa09787[_0xe47d('0xf')]['message']);}logger[_0xe47d('0xf')]('Trigger,\x20%s,\x20%s',_0x16f73b,_0xa09787['error'][_0xe47d('0x11')]);return _0x3680d3(_0xa09787[_0xe47d('0xf')]['message']);}else{logger[_0xe47d('0x9')](_0xe47d('0xa'),_0x16f73b,_0xe47d('0xd'));_0x3680d3(_0xa09787[_0xe47d('0x12')][_0xe47d('0x11')]);}})[_0xe47d('0x13')](function(_0x297fe3){logger[_0xe47d('0xf')](_0xe47d('0xa'),_0x16f73b,_0x297fe3);_0x3e37c0(_0x297fe3);});});}exports[_0xe47d('0x14')]=function(_0x120b9e){var _0x4fbd7f=this;return new Promise(function(_0x432e64,_0x58ba9f){return db[_0xe47d('0x15')][_0xe47d('0x16')]({'raw':_0x120b9e['options']?_0x120b9e['options'][_0xe47d('0x17')]===undefined?!![]:![]:!![],'where':_0x120b9e[_0xe47d('0x18')]?_0x120b9e['options'][_0xe47d('0x19')]||null:null,'attributes':_0x120b9e[_0xe47d('0x18')]?_0x120b9e[_0xe47d('0x18')][_0xe47d('0x1a')]||null:null,'limit':_0x120b9e['options']?_0x120b9e[_0xe47d('0x18')][_0xe47d('0x1b')]||null:null,'include':_0x120b9e[_0xe47d('0x18')]?_0x120b9e[_0xe47d('0x18')][_0xe47d('0x1c')]?_['map'](_0x120b9e[_0xe47d('0x18')]['include'],function(_0x102d01){return{'model':db[_0x102d01['model']],'as':_0x102d01['as'],'attributes':_0x102d01[_0xe47d('0x1a')],'include':_0x102d01['include']?_['map'](_0x102d01[_0xe47d('0x1c')],function(_0x5cbb46){return{'model':db[_0x5cbb46[_0xe47d('0x1d')]],'as':_0x5cbb46['as'],'attributes':_0x5cbb46[_0xe47d('0x1a')],'include':_0x5cbb46[_0xe47d('0x1c')]?_[_0xe47d('0x1e')](_0x5cbb46[_0xe47d('0x1c')],function(_0x5c0b93){return{'model':db[_0x5c0b93[_0xe47d('0x1d')]],'as':_0x5c0b93['as'],'attributes':_0x5c0b93[_0xe47d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe47d('0x8')](function(_0x4a0fc1){logger[_0xe47d('0x9')](_0xe47d('0x14'),_0x120b9e);logger[_0xe47d('0xb')](_0xe47d('0x14'),_0x120b9e,JSON[_0xe47d('0xe')](_0x4a0fc1));_0x432e64(_0x4a0fc1);})[_0xe47d('0x13')](function(_0x30a829){logger['error'](_0xe47d('0x14'),_0x30a829['message'],_0x120b9e);_0x58ba9f(_0x4fbd7f[_0xe47d('0xf')](0x1f4,_0x30a829[_0xe47d('0x11')]));});});};exports[_0xe47d('0x1f')]=function(_0x311904){var _0x3d88fa=this;return new Promise(function(_0x58dadb,_0x19095e){return db[_0xe47d('0x15')][_0xe47d('0x20')]({'raw':_0x311904[_0xe47d('0x18')]?_0x311904[_0xe47d('0x18')][_0xe47d('0x17')]===undefined?!![]:![]:!![],'where':_0x311904['options']?_0x311904[_0xe47d('0x18')][_0xe47d('0x19')]||null:null,'attributes':_0x311904['options']?_0x311904[_0xe47d('0x18')]['attributes']||null:null,'include':_0x311904['options']?_0x311904['options'][_0xe47d('0x1c')]?_[_0xe47d('0x1e')](_0x311904['options'][_0xe47d('0x1c')],function(_0xcb7dce){return{'model':db[_0xcb7dce[_0xe47d('0x1d')]],'as':_0xcb7dce['as'],'attributes':_0xcb7dce[_0xe47d('0x1a')],'include':_0xcb7dce[_0xe47d('0x1c')]?_[_0xe47d('0x1e')](_0xcb7dce['include'],function(_0xf2fe67){return{'model':db[_0xf2fe67[_0xe47d('0x1d')]],'as':_0xf2fe67['as'],'attributes':_0xf2fe67[_0xe47d('0x1a')],'include':_0xf2fe67[_0xe47d('0x1c')]?_[_0xe47d('0x1e')](_0xf2fe67['include'],function(_0x47a456){return{'model':db[_0x47a456[_0xe47d('0x1d')]],'as':_0x47a456['as'],'attributes':_0x47a456[_0xe47d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe47d('0x8')](function(_0x37ad3c){logger[_0xe47d('0x9')]('ShowTrigger',_0x311904);logger[_0xe47d('0xb')](_0xe47d('0x1f'),_0x311904,JSON[_0xe47d('0xe')](_0x37ad3c));_0x58dadb(_0x37ad3c);})[_0xe47d('0x13')](function(_0x5add62){logger['error'](_0xe47d('0x1f'),_0x5add62['message'],_0x311904);_0x19095e(_0x3d88fa[_0xe47d('0xf')](0x1f4,_0x5add62['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 90c030d..ab9e084 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 _0xfc10=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','clone','post','create','put','update','delete','destroy','exports'];(function(_0x1f0d60,_0x58a2c2){var _0x148a20=function(_0x96e0a3){while(--_0x96e0a3){_0x1f0d60['push'](_0x1f0d60['shift']());}};_0x148a20(++_0x58a2c2);}(_0xfc10,0x11e));var _0x0fc1=function(_0x192e54,_0xd77a5e){_0x192e54=_0x192e54-0x0;var _0x57d9b3=_0xfc10[_0x192e54];return _0x57d9b3;};'use strict';var multer=require(_0x0fc1('0x0'));var util=require(_0x0fc1('0x1'));var path=require(_0x0fc1('0x2'));var timeout=require(_0x0fc1('0x3'));var express=require(_0x0fc1('0x4'));var router=express['Router']();var fs_extra=require(_0x0fc1('0x5'));var auth=require(_0x0fc1('0x6'));var interaction=require(_0x0fc1('0x7'));var config=require(_0x0fc1('0x8'));var controller=require(_0x0fc1('0x9'));router[_0x0fc1('0xa')]('/',auth['isAuthenticated'](),controller[_0x0fc1('0xb')]);router[_0x0fc1('0xa')](_0x0fc1('0xc'),auth[_0x0fc1('0xd')](),controller['show']);router['post']('/:id/clone',auth[_0x0fc1('0xd')](),controller[_0x0fc1('0xe')]);router[_0x0fc1('0xf')]('/',auth[_0x0fc1('0xd')](),controller[_0x0fc1('0x10')]);router[_0x0fc1('0x11')](_0x0fc1('0xc'),auth[_0x0fc1('0xd')](),controller[_0x0fc1('0x12')]);router[_0x0fc1('0x13')](_0x0fc1('0xc'),auth[_0x0fc1('0xd')](),controller[_0x0fc1('0x14')]);module[_0x0fc1('0x15')]=router; \ No newline at end of file +var _0x5493=['/:id','show','post','isAuthenticated','clone','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get'];(function(_0xf09878,_0x4b3f94){var _0xba379f=function(_0x3c92da){while(--_0x3c92da){_0xf09878['push'](_0xf09878['shift']());}};_0xba379f(++_0x4b3f94);}(_0x5493,0x15f));var _0x3549=function(_0x4aedd6,_0x5d7d88){_0x4aedd6=_0x4aedd6-0x0;var _0x4f24fc=_0x5493[_0x4aedd6];return _0x4f24fc;};'use strict';var multer=require('multer');var util=require(_0x3549('0x0'));var path=require(_0x3549('0x1'));var timeout=require('connect-timeout');var express=require(_0x3549('0x2'));var router=express[_0x3549('0x3')]();var fs_extra=require(_0x3549('0x4'));var auth=require(_0x3549('0x5'));var interaction=require(_0x3549('0x6'));var config=require('../../config/environment');var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3549('0x7')]);router[_0x3549('0x8')](_0x3549('0x9'),auth['isAuthenticated'](),controller[_0x3549('0xa')]);router[_0x3549('0xb')]('/:id/clone',auth[_0x3549('0xc')](),controller[_0x3549('0xd')]);router[_0x3549('0xb')]('/',auth[_0x3549('0xc')](),controller[_0x3549('0xe')]);router[_0x3549('0xf')]('/:id',auth[_0x3549('0xc')](),controller[_0x3549('0x10')]);router[_0x3549('0x11')](_0x3549('0x9'),auth[_0x3549('0xc')](),controller[_0x3549('0x12')]);module[_0x3549('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index d017a66..fecc0ff 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 _0xa2b8=['from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','active','actpass','dynamic','update','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer'];(function(_0x14bad0,_0x583f36){var _0x503713=function(_0x4bb510){while(--_0x4bb510){_0x14bad0['push'](_0x14bad0['shift']());}};_0x503713(++_0x583f36);}(_0xa2b8,0x180));var _0x8a2b=function(_0x3db0a6,_0x5e67d3){_0x3db0a6=_0x3db0a6-0x0;var _0x19f504=_0xa2b8[_0x3db0a6];return _0x19f504;};'use strict';var Sequelize=require(_0x8a2b('0x0'));module[_0x8a2b('0x1')]={'name':{'type':Sequelize[_0x8a2b('0x2')],'allowNull':![],'unique':_0x8a2b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x5'),_0x8a2b('0x6'),_0x8a2b('0x7')),'allowNull':![],'defaultValue':_0x8a2b('0x5')},'context':{'type':Sequelize[_0x8a2b('0x2')],'allowNull':![],'defaultValue':_0x8a2b('0x8')},'callingpres':{'type':Sequelize[_0x8a2b('0x4')]('ALLOWED_NOT_SCREENED',_0x8a2b('0x9'),_0x8a2b('0xa'),_0x8a2b('0xb'),_0x8a2b('0xc'),_0x8a2b('0xd'),_0x8a2b('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0x8a2b('0x2')]},'permit':{'type':Sequelize[_0x8a2b('0x2')]},'secret':{'type':Sequelize[_0x8a2b('0x2')]},'md5secret':{'type':Sequelize[_0x8a2b('0x2')]},'remotesecret':{'type':Sequelize[_0x8a2b('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x8a2b('0xf'),'set':function(_0xc5707e){this[_0x8a2b('0x10')](_0x8a2b('0x11'),_0xc5707e?_0xc5707e[_0x8a2b('0x12')](','):null);},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x11'))?this['getDataValue'](_0x8a2b('0x11'))[_0x8a2b('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x15'),_0x8a2b('0x16'),'shortinfo','inband','auto'),'defaultValue':_0x8a2b('0x15')},'directmedia':{'type':Sequelize[_0x8a2b('0x4')]('yes','no',_0x8a2b('0x17'),'update',_0x8a2b('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8a2b('0x2')]},'directmediadeny':{'type':Sequelize[_0x8a2b('0x2')]},'nat':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':_0x8a2b('0x1a'),'set':function(_0x44478){this['setDataValue'](_0x8a2b('0x1b'),_0x44478?_0x44478['join'](','):null);},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x1b'))?this['getDataValue'](_0x8a2b('0x1b'))[_0x8a2b('0x14')](','):null;},'comment':_0x8a2b('0x1c')},'callgroup':{'type':Sequelize[_0x8a2b('0x2')]},'namedcallgroup':{'type':Sequelize[_0x8a2b('0x2')]},'pickupgroup':{'type':Sequelize[_0x8a2b('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8a2b('0x2')]},'language':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8a2b('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x8a2b('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2880c3){this['setDataValue'](_0x8a2b('0x1e'),_0x2880c3?_0x2880c3['join'](';'):_0x8a2b('0x1f'));},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x1e'))?this[_0x8a2b('0x13')]('allow')[_0x8a2b('0x14')](';'):null;},'comment':_0x8a2b('0x20')},'autoframing':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':_0x8a2b('0x21'),'set':function(_0x5c1b88){this[_0x8a2b('0x10')](_0x8a2b('0x22'),_0x5c1b88?_0x5c1b88[_0x8a2b('0x12')](','):null);},'get':function(){return this[_0x8a2b('0x13')](_0x8a2b('0x22'))?this[_0x8a2b('0x13')](_0x8a2b('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8a2b('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no',_0x8a2b('0x23'))},'promiscredir':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'setvar':{'type':Sequelize[_0x8a2b('0x2')]},'callerid':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x8a2b('0x2')]},'callcounter':{'type':Sequelize[_0x8a2b('0x4')]('yes','no'),'defaultValue':_0x8a2b('0x19')},'busylevel':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x8a2b('0x2')]},'videosupport':{'type':Sequelize[_0x8a2b('0x4')]('yes','no',_0x8a2b('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'mailbox':{'type':Sequelize[_0x8a2b('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x8a2b('0x26'),_0x8a2b('0x27'),_0x8a2b('0x28'))},'session_expires':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x29'),_0x8a2b('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x8a2b('0x2')]},'regexten':{'type':Sequelize[_0x8a2b('0x2')]},'fromdomain':{'type':Sequelize[_0x8a2b('0x2')]},'fromuser':{'type':Sequelize[_0x8a2b('0x2')]},'port':{'type':Sequelize[_0x8a2b('0x24')](0x5)},'qualify':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no'),'defaultValue':_0x8a2b('0x19')},'keepalive':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x8a2b('0x2')]},'defaultuser':{'type':Sequelize[_0x8a2b('0x2')]},'rtptimeout':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no',_0x8a2b('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8a2b('0x2')]},'callbackextension':{'type':Sequelize[_0x8a2b('0x2')]},'timert1':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'timerb':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x8a2b('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x8a2b('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x8a2b('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'encryption':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x8a2b('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x8a2b('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x8a2b('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x8a2b('0x2')]},'dtlscipher':{'type':Sequelize[_0x8a2b('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x8a2b('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8a2b('0x2c'),'passive',_0x8a2b('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8a2b('0x2')]},'usereqphone':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x8a2b('0x2')]},'call_limit':{'type':Sequelize[_0x8a2b('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x8a2b('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8a2b('0x2')]},'host':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':_0x8a2b('0x2e')},'canreinvite':{'type':Sequelize[_0x8a2b('0x4')](_0x8a2b('0x19'),'no',_0x8a2b('0x17'),_0x8a2b('0x2f'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x8a2b('0x2')]},'active':{'type':Sequelize[_0x8a2b('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8a2b('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x27f8=['join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai','certificate','passive','dynamic','update,nonat','BOOLEAN','sequelize','ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x27f8,0x10d));var _0x827f=function(_0x2a8122,_0xd957e){_0x2a8122=_0x2a8122-0x0;var _0x49a5c7=_0x27f8[_0x2a8122];return _0x49a5c7;};'use strict';var Sequelize=require(_0x827f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x2'),'user',_0x827f('0x3')),'allowNull':![],'defaultValue':_0x827f('0x2')},'context':{'type':Sequelize[_0x827f('0x4')],'allowNull':![],'defaultValue':_0x827f('0x5')},'callingpres':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x6'),_0x827f('0x7'),_0x827f('0x8'),'ALLOWED',_0x827f('0x9'),_0x827f('0xa'),_0x827f('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x827f('0x4')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x827f('0x4')]},'remotesecret':{'type':Sequelize[_0x827f('0x4')]},'transport':{'type':Sequelize[_0x827f('0x4')],'defaultValue':'udp','set':function(_0x272ff2){this[_0x827f('0xc')]('transport',_0x272ff2?_0x272ff2[_0x827f('0xd')](','):null);},'get':function(){return this[_0x827f('0xe')]('transport')?this[_0x827f('0xe')](_0x827f('0xf'))[_0x827f('0x10')](','):null;},'comment':_0x827f('0x11')},'dtmfmode':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x12'),_0x827f('0x13'),'shortinfo',_0x827f('0x14'),_0x827f('0x15')),'defaultValue':_0x827f('0x12')},'directmedia':{'type':Sequelize[_0x827f('0x1')]('yes','no',_0x827f('0x16'),_0x827f('0x17'),_0x827f('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x827f('0x4')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x310f3a){this[_0x827f('0xc')](_0x827f('0x19'),_0x310f3a?_0x310f3a[_0x827f('0xd')](','):null);},'get':function(){return this[_0x827f('0xe')]('nat')?this[_0x827f('0xe')]('nat')[_0x827f('0x10')](','):null;},'comment':_0x827f('0x1a')},'callgroup':{'type':Sequelize[_0x827f('0x4')]},'namedcallgroup':{'type':Sequelize[_0x827f('0x4')]},'pickupgroup':{'type':Sequelize[_0x827f('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x827f('0x4')]},'language':{'type':Sequelize[_0x827f('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x827f('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x827f('0x4')],'defaultValue':_0x827f('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x827f('0x1c'),'set':function(_0x2fb678){this['setDataValue']('allow',_0x2fb678?_0x2fb678[_0x827f('0xd')](';'):_0x827f('0x1c'));},'get':function(){return this[_0x827f('0xe')]('allow')?this['getDataValue'](_0x827f('0x1d'))[_0x827f('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no')},'insecure':{'type':Sequelize[_0x827f('0x4')],'defaultValue':_0x827f('0x1f'),'set':function(_0x4e0c1f){this[_0x827f('0xc')](_0x827f('0x20'),_0x4e0c1f?_0x4e0c1f[_0x827f('0xd')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x827f('0xe')](_0x827f('0x20'))['split'](','):null;},'comment':_0x827f('0x21')},'trustrpid':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no',_0x827f('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no')},'useclientcode':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no')},'accountcode':{'type':Sequelize[_0x827f('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x827f('0x24')},'amaflags':{'type':Sequelize[_0x827f('0x4')]},'callcounter':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no'),'defaultValue':_0x827f('0x1e')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no')},'ignoresdpversion':{'type':Sequelize[_0x827f('0x1')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x827f('0x4')]},'videosupport':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x827f('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x25'),_0x827f('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x827f('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x827f('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x27'),_0x827f('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x827f('0x4')]},'regexten':{'type':Sequelize[_0x827f('0x4')]},'fromdomain':{'type':Sequelize[_0x827f('0x4')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x827f('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x827f('0x4')]},'defaultuser':{'type':Sequelize[_0x827f('0x4')]},'rtptimeout':{'type':Sequelize[_0x827f('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x827f('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no',_0x827f('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x827f('0x4')]},'callbackextension':{'type':Sequelize[_0x827f('0x4')]},'timert1':{'type':Sequelize[_0x827f('0x23')](0xb)},'timerb':{'type':Sequelize[_0x827f('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x827f('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x827f('0x4')]},'contactdeny':{'type':Sequelize[_0x827f('0x4')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x827f('0x4')]},'maxforwards':{'type':Sequelize[_0x827f('0x23')](0xb)},'encryption':{'type':Sequelize[_0x827f('0x1')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x827f('0x1')]('yes','no')},'force_avp':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x827f('0x1e'),'no')},'dtlsverify':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no','fingerprint',_0x827f('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x827f('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x827f('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x827f('0x4')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x827f('0x4')]},'dtlscapath':{'type':Sequelize[_0x827f('0x4')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x827f('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x827f('0x4')]},'usereqphone':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x827f('0x4')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x827f('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no')},'subscribemwi':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no')},'vmexten':{'type':Sequelize[_0x827f('0x4')]},'mohinterpret':{'type':Sequelize[_0x827f('0x4')]},'mohsuggest':{'type':Sequelize[_0x827f('0x4')]},'parkinglot':{'type':Sequelize[_0x827f('0x4')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x827f('0x4')],'defaultValue':_0x827f('0x2c')},'canreinvite':{'type':Sequelize[_0x827f('0x1')](_0x827f('0x1e'),'no',_0x827f('0x16'),_0x827f('0x17'),_0x827f('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x827f('0x4')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x827f('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 bfef788..d3d68c9 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 _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x48c5f3,_0x12e63c){var _0x63f3a4=function(_0x4d0e89){while(--_0x4d0e89){_0x48c5f3['push'](_0x48c5f3['shift']());}};_0x63f3a4(++_0x12e63c);}(_0x24ca,0x1bc));var _0xa24c=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x24ca[_0x210603];return _0x1bcb7d;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x4b49cc,_0x24c7f5){var _0x3e60aa=function(_0x7c2fd8){while(--_0x7c2fd8){_0x4b49cc['push'](_0x4b49cc['shift']());}};_0x3e60aa(++_0x24c7f5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4797e1,_0x56e098){_0x4797e1=_0x4797e1-0x0;var _0x12002a=_0x9bde[_0x4797e1];return _0x12002a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 006afbc..717839b 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 _0x36fe=['./trunk.attributes','define','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x36fe,0xb3));var _0xe36f=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x36fe[_0x3ad7ad];return _0x225a60;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var logger=require(_0xe36f('0x2'))('api');var moment=require(_0xe36f('0x3'));var BPromise=require(_0xe36f('0x4'));var rp=require(_0xe36f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe36f('0x6'));var config=require(_0xe36f('0x7'));var attributes=require(_0xe36f('0x8'));module['exports']=function(_0x29d4df,_0x3b96f0){return _0x29d4df[_0xe36f('0x9')]('Trunk',attributes,{'tableName':_0xe36f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6e5=['define','tools_trunks','lodash','util','../../config/logger','moment','bluebird','../../config/environment','exports'];(function(_0x2752ba,_0x585baf){var _0x4070d7=function(_0x52a6d2){while(--_0x52a6d2){_0x2752ba['push'](_0x2752ba['shift']());}};_0x4070d7(++_0x585baf);}(_0xa6e5,0xc8));var _0x5a6e=function(_0x36617c,_0x12b879){_0x36617c=_0x36617c-0x0;var _0x26e24d=_0xa6e5[_0x36617c];return _0x26e24d;};'use strict';var _=require(_0x5a6e('0x0'));var util=require(_0x5a6e('0x1'));var logger=require(_0x5a6e('0x2'))('api');var moment=require(_0x5a6e('0x3'));var BPromise=require(_0x5a6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a6e('0x5'));var attributes=require('./trunk.attributes');module[_0x5a6e('0x6')]=function(_0x30c7a8,_0x21e4e4){return _0x30c7a8[_0x5a6e('0x7')]('Trunk',attributes,{'tableName':_0x5a6e('0x8'),'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 6c06406..e8e64c5 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 _0x90dd=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrunk','findAll','options','where','attributes','map','model','include','ShowTrunk','Trunk','raw','moment','bluebird'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x90dd,0x13d));var _0xd90d=function(_0x4b8193,_0x27b1b4){_0x4b8193=_0x4b8193-0x0;var _0x4872ef=_0x90dd[_0x4b8193];return _0x4872ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd90d('0x0'));var BPromise=require(_0xd90d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd90d('0x2'));var logger=require(_0xd90d('0x3'))(_0xd90d('0x4'));var config=require(_0xd90d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd90d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3c0b63,_0x1ce53d,_0x422e95){return new BPromise(function(_0x5ae4da,_0x207d30){return client['request'](_0x3c0b63,_0x422e95)[_0xd90d('0x7')](function(_0x68559f){logger[_0xd90d('0x8')](_0xd90d('0x9'),_0x1ce53d,'request\x20sent');logger[_0xd90d('0xa')](_0xd90d('0xb'),_0x1ce53d,_0xd90d('0xc'),JSON[_0xd90d('0xd')](_0x68559f));if(_0x68559f['error']){if(_0x68559f[_0xd90d('0xe')][_0xd90d('0xf')]===0x1f4){logger[_0xd90d('0xe')](_0xd90d('0x9'),_0x1ce53d,_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);return _0x207d30(_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);}logger['error'](_0xd90d('0x9'),_0x1ce53d,_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);return _0x5ae4da(_0x68559f[_0xd90d('0xe')][_0xd90d('0x10')]);}else{logger['info'](_0xd90d('0x9'),_0x1ce53d,_0xd90d('0xc'));_0x5ae4da(_0x68559f['result'][_0xd90d('0x10')]);}})[_0xd90d('0x11')](function(_0x751644){logger[_0xd90d('0xe')](_0xd90d('0x9'),_0x1ce53d,_0x751644);_0x207d30(_0x751644);});});}exports[_0xd90d('0x12')]=function(_0x4a1703){var _0x72006a=this;return new Promise(function(_0x1deca8,_0x2a6929){return db['Trunk'][_0xd90d('0x13')]({'raw':_0x4a1703[_0xd90d('0x14')]?_0x4a1703[_0xd90d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4a1703[_0xd90d('0x14')]?_0x4a1703[_0xd90d('0x14')][_0xd90d('0x15')]||null:null,'attributes':_0x4a1703['options']?_0x4a1703[_0xd90d('0x14')][_0xd90d('0x16')]||null:null,'limit':_0x4a1703[_0xd90d('0x14')]?_0x4a1703['options']['limit']||null:null,'include':_0x4a1703[_0xd90d('0x14')]?_0x4a1703[_0xd90d('0x14')]['include']?_[_0xd90d('0x17')](_0x4a1703[_0xd90d('0x14')]['include'],function(_0x11e9bf){return{'model':db[_0x11e9bf[_0xd90d('0x18')]],'as':_0x11e9bf['as'],'attributes':_0x11e9bf[_0xd90d('0x16')],'include':_0x11e9bf[_0xd90d('0x19')]?_[_0xd90d('0x17')](_0x11e9bf['include'],function(_0x887ae5){return{'model':db[_0x887ae5['model']],'as':_0x887ae5['as'],'attributes':_0x887ae5[_0xd90d('0x16')],'include':_0x887ae5['include']?_['map'](_0x887ae5[_0xd90d('0x19')],function(_0x5efdc6){return{'model':db[_0x5efdc6[_0xd90d('0x18')]],'as':_0x5efdc6['as'],'attributes':_0x5efdc6[_0xd90d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd90d('0x7')](function(_0x5e3cbc){logger[_0xd90d('0x8')](_0xd90d('0x12'),_0x4a1703);logger[_0xd90d('0xa')]('GetTrunk',_0x4a1703,JSON['stringify'](_0x5e3cbc));_0x1deca8(_0x5e3cbc);})[_0xd90d('0x11')](function(_0x2640aa){logger[_0xd90d('0xe')]('GetTrunk',_0x2640aa[_0xd90d('0x10')],_0x4a1703);_0x2a6929(_0x72006a['error'](0x1f4,_0x2640aa[_0xd90d('0x10')]));});});};exports[_0xd90d('0x1a')]=function(_0x5182bf){var _0x486c41=this;return new Promise(function(_0x3e091f,_0x4efcf8){return db[_0xd90d('0x1b')]['find']({'raw':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')][_0xd90d('0x1c')]===undefined?!![]:![]:!![],'where':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')][_0xd90d('0x15')]||null:null,'attributes':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')][_0xd90d('0x16')]||null:null,'include':_0x5182bf[_0xd90d('0x14')]?_0x5182bf[_0xd90d('0x14')]['include']?_['map'](_0x5182bf[_0xd90d('0x14')][_0xd90d('0x19')],function(_0x435a8f){return{'model':db[_0x435a8f['model']],'as':_0x435a8f['as'],'attributes':_0x435a8f['attributes'],'include':_0x435a8f[_0xd90d('0x19')]?_[_0xd90d('0x17')](_0x435a8f[_0xd90d('0x19')],function(_0x4353f0){return{'model':db[_0x4353f0['model']],'as':_0x4353f0['as'],'attributes':_0x4353f0['attributes'],'include':_0x4353f0['include']?_['map'](_0x4353f0[_0xd90d('0x19')],function(_0x5a994d){return{'model':db[_0x5a994d['model']],'as':_0x5a994d['as'],'attributes':_0x5a994d[_0xd90d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd90d('0x7')](function(_0x120b7f){logger[_0xd90d('0x8')](_0xd90d('0x1a'),_0x5182bf);logger[_0xd90d('0xa')](_0xd90d('0x1a'),_0x5182bf,JSON[_0xd90d('0xd')](_0x120b7f));_0x3e091f(_0x120b7f);})[_0xd90d('0x11')](function(_0x502f84){logger[_0xd90d('0xe')]('ShowTrunk',_0x502f84[_0xd90d('0x10')],_0x5182bf);_0x4efcf8(_0x486c41[_0xd90d('0xe')](0x1f4,_0x502f84[_0xd90d('0x10')]));});});}; \ No newline at end of file +var _0x07ae=['message','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','map','include','model','find','ShowTrunk','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3eb109,_0x2c3a36){var _0x3810c2=function(_0x261959){while(--_0x261959){_0x3eb109['push'](_0x3eb109['shift']());}};_0x3810c2(++_0x2c3a36);}(_0x07ae,0x1c8));var _0xe07a=function(_0x1f3094,_0x2b57e6){_0x1f3094=_0x1f3094-0x0;var _0x27b636=_0x07ae[_0x1f3094];return _0x27b636;};'use strict';var _=require(_0xe07a('0x0'));var util=require('util');var moment=require(_0xe07a('0x1'));var BPromise=require(_0xe07a('0x2'));var rs=require(_0xe07a('0x3'));var fs=require('fs');var Redis=require(_0xe07a('0x4'));var db=require(_0xe07a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe07a('0x6'))(_0xe07a('0x7'));var config=require(_0xe07a('0x8'));var jayson=require(_0xe07a('0x9'));var client=jayson[_0xe07a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5afb10,_0x3a635f,_0x696bd3){return new BPromise(function(_0x2ea99b,_0x3d69a2){return client['request'](_0x5afb10,_0x696bd3)[_0xe07a('0xb')](function(_0x40e735){logger[_0xe07a('0xc')](_0xe07a('0xd'),_0x3a635f,_0xe07a('0xe'));logger[_0xe07a('0xf')](_0xe07a('0x10'),_0x3a635f,_0xe07a('0xe'),JSON[_0xe07a('0x11')](_0x40e735));if(_0x40e735[_0xe07a('0x12')]){if(_0x40e735[_0xe07a('0x12')][_0xe07a('0x13')]===0x1f4){logger[_0xe07a('0x12')](_0xe07a('0xd'),_0x3a635f,_0x40e735[_0xe07a('0x12')][_0xe07a('0x14')]);return _0x3d69a2(_0x40e735[_0xe07a('0x12')][_0xe07a('0x14')]);}logger['error'](_0xe07a('0xd'),_0x3a635f,_0x40e735[_0xe07a('0x12')]['message']);return _0x2ea99b(_0x40e735[_0xe07a('0x12')][_0xe07a('0x14')]);}else{logger[_0xe07a('0xc')](_0xe07a('0xd'),_0x3a635f,_0xe07a('0xe'));_0x2ea99b(_0x40e735['result']['message']);}})[_0xe07a('0x15')](function(_0x3f92df){logger[_0xe07a('0x12')]('Trunk,\x20%s,\x20%s',_0x3a635f,_0x3f92df);_0x3d69a2(_0x3f92df);});});}exports[_0xe07a('0x16')]=function(_0x164fb5){var _0x42585c=this;return new Promise(function(_0x418da7,_0x42d38f){return db[_0xe07a('0x17')]['findAll']({'raw':_0x164fb5[_0xe07a('0x18')]?_0x164fb5['options'][_0xe07a('0x19')]===undefined?!![]:![]:!![],'where':_0x164fb5[_0xe07a('0x18')]?_0x164fb5[_0xe07a('0x18')][_0xe07a('0x1a')]||null:null,'attributes':_0x164fb5[_0xe07a('0x18')]?_0x164fb5['options'][_0xe07a('0x1b')]||null:null,'limit':_0x164fb5[_0xe07a('0x18')]?_0x164fb5[_0xe07a('0x18')][_0xe07a('0x1c')]||null:null,'include':_0x164fb5['options']?_0x164fb5[_0xe07a('0x18')]['include']?_[_0xe07a('0x1d')](_0x164fb5[_0xe07a('0x18')][_0xe07a('0x1e')],function(_0x7fee23){return{'model':db[_0x7fee23[_0xe07a('0x1f')]],'as':_0x7fee23['as'],'attributes':_0x7fee23[_0xe07a('0x1b')],'include':_0x7fee23['include']?_['map'](_0x7fee23[_0xe07a('0x1e')],function(_0x607a3c){return{'model':db[_0x607a3c[_0xe07a('0x1f')]],'as':_0x607a3c['as'],'attributes':_0x607a3c[_0xe07a('0x1b')],'include':_0x607a3c[_0xe07a('0x1e')]?_[_0xe07a('0x1d')](_0x607a3c['include'],function(_0x416f0d){return{'model':db[_0x416f0d[_0xe07a('0x1f')]],'as':_0x416f0d['as'],'attributes':_0x416f0d[_0xe07a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe07a('0xb')](function(_0x4c727d){logger[_0xe07a('0xc')]('GetTrunk',_0x164fb5);logger[_0xe07a('0xf')](_0xe07a('0x16'),_0x164fb5,JSON[_0xe07a('0x11')](_0x4c727d));_0x418da7(_0x4c727d);})[_0xe07a('0x15')](function(_0x13e394){logger[_0xe07a('0x12')](_0xe07a('0x16'),_0x13e394[_0xe07a('0x14')],_0x164fb5);_0x42d38f(_0x42585c['error'](0x1f4,_0x13e394['message']));});});};exports['ShowTrunk']=function(_0x3404e8){var _0x495e38=this;return new Promise(function(_0x55063d,_0x5857b2){return db[_0xe07a('0x17')][_0xe07a('0x20')]({'raw':_0x3404e8['options']?_0x3404e8[_0xe07a('0x18')][_0xe07a('0x19')]===undefined?!![]:![]:!![],'where':_0x3404e8[_0xe07a('0x18')]?_0x3404e8[_0xe07a('0x18')][_0xe07a('0x1a')]||null:null,'attributes':_0x3404e8[_0xe07a('0x18')]?_0x3404e8[_0xe07a('0x18')][_0xe07a('0x1b')]||null:null,'include':_0x3404e8[_0xe07a('0x18')]?_0x3404e8[_0xe07a('0x18')]['include']?_[_0xe07a('0x1d')](_0x3404e8[_0xe07a('0x18')][_0xe07a('0x1e')],function(_0x4e7243){return{'model':db[_0x4e7243['model']],'as':_0x4e7243['as'],'attributes':_0x4e7243[_0xe07a('0x1b')],'include':_0x4e7243['include']?_[_0xe07a('0x1d')](_0x4e7243[_0xe07a('0x1e')],function(_0x5499b6){return{'model':db[_0x5499b6['model']],'as':_0x5499b6['as'],'attributes':_0x5499b6[_0xe07a('0x1b')],'include':_0x5499b6['include']?_[_0xe07a('0x1d')](_0x5499b6[_0xe07a('0x1e')],function(_0x5628a2){return{'model':db[_0x5628a2[_0xe07a('0x1f')]],'as':_0x5628a2['as'],'attributes':_0x5628a2[_0xe07a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe07a('0xb')](function(_0x3515a0){logger[_0xe07a('0xc')](_0xe07a('0x21'),_0x3404e8);logger[_0xe07a('0xf')](_0xe07a('0x21'),_0x3404e8,JSON[_0xe07a('0x11')](_0x3515a0));_0x55063d(_0x3515a0);})[_0xe07a('0x15')](function(_0x7a2727){logger[_0xe07a('0x12')](_0xe07a('0x21'),_0x7a2727['message'],_0x3404e8);_0x5857b2(_0x495e38[_0xe07a('0x12')](0x1f4,_0x7a2727[_0xe07a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 8c6d2e7..7e22cef 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 _0x5167=['../../components/auth/service','./user-setting.controller','put','/:id','update','exports','express','Router'];(function(_0x2d9746,_0x23ec17){var _0x1f9b51=function(_0x2afb38){while(--_0x2afb38){_0x2d9746['push'](_0x2d9746['shift']());}};_0x1f9b51(++_0x23ec17);}(_0x5167,0x18e));var _0x7516=function(_0x5c7a3e,_0x56db85){_0x5c7a3e=_0x5c7a3e-0x0;var _0x1c4118=_0x5167[_0x5c7a3e];return _0x1c4118;};'use strict';var express=require(_0x7516('0x0'));var router=express[_0x7516('0x1')]();var auth=require(_0x7516('0x2'));var controller=require(_0x7516('0x3'));router[_0x7516('0x4')](_0x7516('0x5'),auth['isAuthenticated'](),controller[_0x7516('0x6')]);module[_0x7516('0x7')]=router; \ No newline at end of file +var _0xe229=['update','exports','express','Router','./user-setting.controller','/:id','isAuthenticated'];(function(_0x5779be,_0x52d30d){var _0x28e499=function(_0x3e0aab){while(--_0x3e0aab){_0x5779be['push'](_0x5779be['shift']());}};_0x28e499(++_0x52d30d);}(_0xe229,0x12f));var _0x9e22=function(_0x4ee8ff,_0x38725a){_0x4ee8ff=_0x4ee8ff-0x0;var _0x309d1b=_0xe229[_0x4ee8ff];return _0x309d1b;};'use strict';var express=require(_0x9e22('0x0'));var router=express[_0x9e22('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9e22('0x2'));router['put'](_0x9e22('0x3'),auth[_0x9e22('0x4')](),controller[_0x9e22('0x5')]);module[_0x9e22('0x6')]=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 3081845..76a2447 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 _0xa6aa=['ENUM','BOOLEAN','INTEGER','UserId','sequelize','error','info','debug','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa6aa,0x1c6));var _0xaa6a=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xa6aa[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0xaa6a('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xaa6a('0x1'),'warning',_0xaa6a('0x2'),_0xaa6a('0x3')];module[_0xaa6a('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xaa6a('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xaa6a('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xaa6a('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xaa6a('0x7')],'unique':_0xaa6a('0x8')}}; \ No newline at end of file +var _0xcd1c=['INTEGER','sequelize','error','warning','exports','ENUM','BOOLEAN'];(function(_0x4a3826,_0x497517){var _0x5c1a33=function(_0x342a8a){while(--_0x342a8a){_0x4a3826['push'](_0x4a3826['shift']());}};_0x5c1a33(++_0x497517);}(_0xcd1c,0x78));var _0xccd1=function(_0x22d02c,_0x15300f){_0x22d02c=_0x22d02c-0x0;var _0x5158f1=_0xcd1c[_0x22d02c];return _0x5158f1;};'use strict';var Sequelize=require(_0xccd1('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xccd1('0x1'),_0xccd1('0x2'),'info','debug'];module[_0xccd1('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xccd1('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xccd1('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xccd1('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xccd1('0x6')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 6621691..e17f9bd 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 _0x562d=['register','localhost','status','update','then','sendStatus','error','stack','name','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','lodash','ioredis','../../config/logger','../../mysqldb','socket.io-emitter','redis'];(function(_0x4091bc,_0x441db5){var _0x3432e1=function(_0x519a97){while(--_0x519a97){_0x4091bc['push'](_0x4091bc['shift']());}};_0x3432e1(++_0x441db5);}(_0x562d,0xe1));var _0xd562=function(_0x15291b,_0x17870b){_0x15291b=_0x15291b-0x0;var _0x12492a=_0x562d[_0x15291b];return _0x12492a;};'use strict';var _=require(_0xd562('0x0'));var Redis=require(_0xd562('0x1'));var logger=require(_0xd562('0x2'))('api');var config=require('../../config/environment');var db=require(_0xd562('0x3'))['db'];var socket=require(_0xd562('0x4'))(new Redis(config[_0xd562('0x5')]));require('./user-setting.socket')[_0xd562('0x6')](socket);config['redis']=_['defaults'](config[_0xd562('0x5')],{'host':_0xd562('0x7'),'port':0x18eb});function respondWithResult(_0x3e6465,_0x3b03fe){_0x3b03fe=_0x3b03fe||0xc8;return function(_0x21f82a){if(_0x21f82a){return _0x3e6465[_0xd562('0x8')](_0x3b03fe)['json'](_0x21f82a);}};}function saveUpdates(_0x1fdb93){return function(_0x5ef5e2){if(_0x5ef5e2){return _0x5ef5e2[_0xd562('0x9')](_0x1fdb93)[_0xd562('0xa')](function(_0x2f3572){return _0x2f3572;});}return null;};}function handleEntityNotFound(_0x31e826){return function(_0x22750e){if(!_0x22750e){_0x31e826[_0xd562('0xb')](0x194);}return _0x22750e;};}function handleError(_0x381265,_0x467927){_0x467927=_0x467927||0x1f4;return function(_0x15a39e){logger[_0xd562('0xc')](_0x15a39e[_0xd562('0xd')]);if(_0x15a39e['name']){delete _0x15a39e[_0xd562('0xe')];}_0x381265['status'](_0x467927)['send'](_0x15a39e);};}exports[_0xd562('0x9')]=function(_0x583523,_0x39522e){if(_0x583523['user']['role']!==_0xd562('0xf'))throw new Error(_0xd562('0x10'));if(isNaN(Number(_0x583523[_0xd562('0x11')]['id'])))throw new Error(_0xd562('0x12'));return db[_0xd562('0x13')]['find']({'where':{'id':_0x583523[_0xd562('0x11')]['id']}})[_0xd562('0xa')](handleEntityNotFound(_0x39522e,null))['then'](saveUpdates(_0x583523[_0xd562('0x14')],null))[_0xd562('0xa')](respondWithResult(_0x39522e,null))['catch'](handleError(_0x39522e,null));}; \ No newline at end of file +var _0x24cd=['localhost','status','json','then','sendStatus','stack','name','send','update','user','role','admin','params','Invalid\x20user\x20setting\x20id','find','catch','lodash','ioredis','api','../../mysqldb','socket.io-emitter','redis','register'];(function(_0x1ffd67,_0x1c18ba){var _0xce170f=function(_0x16cdb2){while(--_0x16cdb2){_0x1ffd67['push'](_0x1ffd67['shift']());}};_0xce170f(++_0x1c18ba);}(_0x24cd,0x83));var _0xd24c=function(_0x41bc74,_0x439b07){_0x41bc74=_0x41bc74-0x0;var _0x548d9b=_0x24cd[_0x41bc74];return _0x548d9b;};'use strict';var _=require(_0xd24c('0x0'));var Redis=require(_0xd24c('0x1'));var logger=require('../../config/logger')(_0xd24c('0x2'));var config=require('../../config/environment');var db=require(_0xd24c('0x3'))['db'];var socket=require(_0xd24c('0x4'))(new Redis(config[_0xd24c('0x5')]));require('./user-setting.socket')[_0xd24c('0x6')](socket);config[_0xd24c('0x5')]=_['defaults'](config[_0xd24c('0x5')],{'host':_0xd24c('0x7'),'port':0x18eb});function respondWithResult(_0x2a432a,_0x95eb94){_0x95eb94=_0x95eb94||0xc8;return function(_0x3d4d20){if(_0x3d4d20){return _0x2a432a[_0xd24c('0x8')](_0x95eb94)[_0xd24c('0x9')](_0x3d4d20);}};}function saveUpdates(_0x316755){return function(_0x4bc6a2){if(_0x4bc6a2){return _0x4bc6a2['update'](_0x316755)[_0xd24c('0xa')](function(_0x42033c){return _0x42033c;});}return null;};}function handleEntityNotFound(_0x21b8d9){return function(_0x43ab46){if(!_0x43ab46){_0x21b8d9[_0xd24c('0xb')](0x194);}return _0x43ab46;};}function handleError(_0x1aa701,_0x1060a3){_0x1060a3=_0x1060a3||0x1f4;return function(_0x453907){logger['error'](_0x453907[_0xd24c('0xc')]);if(_0x453907[_0xd24c('0xd')]){delete _0x453907['name'];}_0x1aa701[_0xd24c('0x8')](_0x1060a3)[_0xd24c('0xe')](_0x453907);};}exports[_0xd24c('0xf')]=function(_0x85e141,_0x32d8b0){if(_0x85e141[_0xd24c('0x10')][_0xd24c('0x11')]!==_0xd24c('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x85e141[_0xd24c('0x13')]['id'])))throw new Error(_0xd24c('0x14'));return db['UserSetting'][_0xd24c('0x15')]({'where':{'id':_0x85e141[_0xd24c('0x13')]['id']}})[_0xd24c('0xa')](handleEntityNotFound(_0x32d8b0,null))[_0xd24c('0xa')](saveUpdates(_0x85e141['body'],null))['then'](respondWithResult(_0x32d8b0,null))[_0xd24c('0x16')](handleError(_0x32d8b0,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 488d4cd..7656cf1 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 _0xce71=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xce71,0x1ad));var _0x1ce7=function(_0x5ecca4,_0x5a5b0f){_0x5ecca4=_0x5ecca4-0x0;var _0x7d031=_0xce71[_0x5ecca4];return _0x7d031;};'use strict';var EventEmitter=require(_0x1ce7('0x0'));var UserSetting=require(_0x1ce7('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1ce7('0x2')](0x0);var events={'afterCreate':_0x1ce7('0x3'),'afterUpdate':_0x1ce7('0x4'),'afterDestroy':_0x1ce7('0x5')};function emitEvent(_0x2574be){return function(_0x4c9675,_0xd1f325,_0x145503){UserSettingEvents[_0x1ce7('0x6')](_0x2574be+':'+_0x4c9675['id'],_0x4c9675);UserSettingEvents[_0x1ce7('0x6')](_0x2574be,_0x4c9675);_0x145503(null);};}for(var e in events){if(events[_0x1ce7('0x7')](e)){var event=events[e];UserSetting[_0x1ce7('0x8')](e,emitEvent(event));}}module[_0x1ce7('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x115a=['exports','events','../../mysqldb','UserSetting','save','remove','emit','hasOwnProperty','hook'];(function(_0x217c19,_0x23f95e){var _0x31a021=function(_0x4d04e5){while(--_0x4d04e5){_0x217c19['push'](_0x217c19['shift']());}};_0x31a021(++_0x23f95e);}(_0x115a,0x19f));var _0xa115=function(_0x5723c7,_0x4e9b14){_0x5723c7=_0x5723c7-0x0;var _0x5c2f7b=_0x115a[_0x5723c7];return _0x5c2f7b;};'use strict';var EventEmitter=require(_0xa115('0x0'));var UserSetting=require(_0xa115('0x1'))['db'][_0xa115('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa115('0x3'),'afterUpdate':'update','afterDestroy':_0xa115('0x4')};function emitEvent(_0x2c1570){return function(_0x39a9f3,_0x5e4b6c,_0x473ba5){UserSettingEvents[_0xa115('0x5')](_0x2c1570+':'+_0x39a9f3['id'],_0x39a9f3);UserSettingEvents['emit'](_0x2c1570,_0x39a9f3);_0x473ba5(null);};}for(var e in events){if(events[_0xa115('0x6')](e)){var event=events[e];UserSetting[_0xa115('0x7')](e,emitEvent(event));}}module[_0xa115('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 454b159..97934c3 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 _0xee11=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee11,0x146));var _0x1ee1=function(_0xc2bf5e,_0x3b48c1){_0xc2bf5e=_0xc2bf5e-0x0;var _0x3e4354=_0xee11[_0xc2bf5e];return _0x3e4354;};'use strict';var attributes=require(_0x1ee1('0x0'));module['exports']=function(_0x4e1a0d){return _0x4e1a0d[_0x1ee1('0x1')](_0x1ee1('0x2'),attributes,{'tableName':_0x1ee1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1eb386){if(!_0x1eb386[_0x1ee1('0x4')])_0x1eb386[_0x1ee1('0x5')]=null;else if(_0x1eb386[_0x1ee1('0x5')]===null)_0x1eb386[_0x1ee1('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xfc4c=['user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfc4c,0xca));var _0xcfc4=function(_0x2d4856,_0x36daa4){_0x2d4856=_0x2d4856-0x0;var _0x2e9028=_0xfc4c[_0x2d4856];return _0x2e9028;};'use strict';var attributes=require(_0xcfc4('0x0'));module[_0xcfc4('0x1')]=function(_0x203a38){return _0x203a38['define'](_0xcfc4('0x2'),attributes,{'tableName':_0xcfc4('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a0bd9){if(!_0x3a0bd9['clientSideLoggingEnabled'])_0x3a0bd9['clientSideLoggingEnabledSince']=null;else if(_0x3a0bd9[_0xcfc4('0x4')]===null)_0x3a0bd9[_0xcfc4('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 0e97beb..eaa0c43 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 _0xb2cd=['user-setting:update','user-setting:update:user-','UserId','user-setting:','./user-setting.events','save','update','emit'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xb2cd,0x1d4));var _0xdb2c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xb2cd[_0x12fc8d];return _0x3f9d04;};'use strict';var UserSettingEvents=require(_0xdb2c('0x0'));var events=[_0xdb2c('0x1'),'remove',_0xdb2c('0x2')];function createListener(_0x1ad483,_0x17a21e){return function(_0x47fdac){_0x17a21e[_0xdb2c('0x3')](_0x1ad483,_0x47fdac);if(_0x1ad483===_0xdb2c('0x4')){_0x17a21e[_0xdb2c('0x3')](_0xdb2c('0x5')+_0x47fdac[_0xdb2c('0x6')],_0x47fdac);}};}exports['register']=function(_0x163c10){for(var _0x362493=0x0,_0x4b4371=events['length'];_0x362493<_0x4b4371;_0x362493++){var _0x5a13f3=events[_0x362493];var _0x18a92d=createListener(_0xdb2c('0x7')+_0x5a13f3,_0x163c10);UserSettingEvents['on'](_0x5a13f3,_0x18a92d);}}; \ No newline at end of file +var _0xa3c6=['user-setting:update','register','./user-setting.events','save','remove','update','emit'];(function(_0x455996,_0x2e2fac){var _0x68bf57=function(_0xe5ec13){while(--_0xe5ec13){_0x455996['push'](_0x455996['shift']());}};_0x68bf57(++_0x2e2fac);}(_0xa3c6,0xb1));var _0x6a3c=function(_0x2f1663,_0x3dae40){_0x2f1663=_0x2f1663-0x0;var _0x2accb6=_0xa3c6[_0x2f1663];return _0x2accb6;};'use strict';var UserSettingEvents=require(_0x6a3c('0x0'));var events=[_0x6a3c('0x1'),_0x6a3c('0x2'),_0x6a3c('0x3')];function createListener(_0x24b593,_0x47c518){return function(_0x21ab55){_0x47c518[_0x6a3c('0x4')](_0x24b593,_0x21ab55);if(_0x24b593===_0x6a3c('0x5')){_0x47c518[_0x6a3c('0x4')]('user-setting:update:user-'+_0x21ab55['UserId'],_0x21ab55);}};}exports[_0x6a3c('0x6')]=function(_0x73eef7){for(var _0xa534d7=0x0,_0xdc14ba=events['length'];_0xa534d7<_0xdc14ba;_0xa534d7++){var _0x59b7e4=events[_0xa534d7];var _0x2b14c9=createListener('user-setting:'+_0x59b7e4,_0x73eef7);UserSettingEvents['on'](_0x59b7e4,_0x2b14c9);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index bd00dd8..58516ee 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 _0xb338=['createApiKey','put','update','/:id/password','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','connect-timeout','express','Router','../../config/environment','./user.controller','isAuthenticated','get','/describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','/:id/api_key'];(function(_0x6c71bb,_0x3e5acf){var _0x508f22=function(_0x573e45){while(--_0x573e45){_0x6c71bb['push'](_0x6c71bb['shift']());}};_0x508f22(++_0x3e5acf);}(_0xb338,0x16e));var _0x8b33=function(_0x2d42b7,_0x391076){_0x2d42b7=_0x2d42b7-0x0;var _0x3ac15a=_0xb338[_0x2d42b7];return _0x3ac15a;};'use strict';var multer=require(_0x8b33('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8b33('0x1'));var express=require(_0x8b33('0x2'));var router=express[_0x8b33('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b33('0x4'));var controller=require(_0x8b33('0x5'));router['get']('/',auth[_0x8b33('0x6')](),controller['index']);router[_0x8b33('0x7')](_0x8b33('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x8b33('0x7')](_0x8b33('0x9'),auth[_0x8b33('0x6')](),controller[_0x8b33('0xa')]);router[_0x8b33('0x7')](_0x8b33('0xb'),auth[_0x8b33('0x6')](),controller['getPresence']);router[_0x8b33('0x7')](_0x8b33('0xc'),auth[_0x8b33('0x6')](),controller[_0x8b33('0xd')]);router[_0x8b33('0x7')](_0x8b33('0xe'),controller[_0x8b33('0xf')]);router[_0x8b33('0x7')]('/:id/open_tabs',auth[_0x8b33('0x6')](),controller[_0x8b33('0x10')]);router[_0x8b33('0x7')](_0x8b33('0x11'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x12')]);router[_0x8b33('0x7')](_0x8b33('0x13'),auth[_0x8b33('0x6')](),controller['getQueues']);router[_0x8b33('0x7')]('/:id/queues_rt',auth[_0x8b33('0x6')](),controller[_0x8b33('0x14')]);router[_0x8b33('0x7')]('/:id/groups',auth[_0x8b33('0x6')](),controller[_0x8b33('0x15')]);router['get'](_0x8b33('0x16'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x17')]);router[_0x8b33('0x7')](_0x8b33('0x18'),auth['isAuthenticated'](),controller[_0x8b33('0x19')]);router[_0x8b33('0x7')](_0x8b33('0x1a'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x1b')]);router['get'](_0x8b33('0x1c'),auth['isAuthenticated'](),controller[_0x8b33('0x1d')]);router[_0x8b33('0x7')](_0x8b33('0x1e'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x1f')]);router[_0x8b33('0x7')](_0x8b33('0x20'),auth['isAuthenticated'](),controller[_0x8b33('0x21')]);router['get'](_0x8b33('0x22'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x23')]);router[_0x8b33('0x7')](_0x8b33('0x24'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x25')]);router['get'](_0x8b33('0x26'),auth[_0x8b33('0x6')](),controller['getTeams']);router[_0x8b33('0x7')](_0x8b33('0x27'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x8b33('0x28'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x29')]);router['get'](_0x8b33('0x2a'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x2b')]);router[_0x8b33('0x7')](_0x8b33('0x2c'),auth[_0x8b33('0x6')](),controller['getFaxAccounts']);router[_0x8b33('0x7')](_0x8b33('0x2d'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x2e')]);router[_0x8b33('0x7')](_0x8b33('0x2f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x30')]);router['get'](_0x8b33('0x31'),auth[_0x8b33('0x6')](),controller['getSmsAccounts']);router[_0x8b33('0x7')](_0x8b33('0x32'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x33')]);router['get']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x8b33('0x34')]);router[_0x8b33('0x7')](_0x8b33('0x35'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x36')]);router[_0x8b33('0x7')]('/:id/api_key',auth[_0x8b33('0x6')](),controller[_0x8b33('0x37')]);router[_0x8b33('0x38')](_0x8b33('0x11'),auth['isAuthenticated'](),controller[_0x8b33('0x39')]);router[_0x8b33('0x38')]('/',auth[_0x8b33('0x6')](),controller[_0x8b33('0x3a')]);router[_0x8b33('0x38')]('/create_many',auth[_0x8b33('0x6')](),controller[_0x8b33('0x3b')]);router[_0x8b33('0x38')](_0x8b33('0x13'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f9805,_0x3d37ff,_0x29a8ea){_0x29a8ea(null,path[_0x8b33('0x3d')](config[_0x8b33('0x3e')],_0x8b33('0x3f')));},'filename':function(_0x4623e6,_0x1d5907,_0x4d454d){_0x4d454d(null,util[_0x8b33('0x40')](_0x8b33('0x41'),Date[_0x8b33('0x42')](),_0x1d5907[_0x8b33('0x43')]));}})});router[_0x8b33('0x38')](_0x8b33('0xe'),upload['single']('file'),controller[_0x8b33('0x44')]);router[_0x8b33('0x38')](_0x8b33('0x45'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x46')]);router[_0x8b33('0x38')](_0x8b33('0x47'),auth[_0x8b33('0x6')](),controller['logout']);router[_0x8b33('0x38')](_0x8b33('0x48'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x49')]);router[_0x8b33('0x38')](_0x8b33('0x4a'),auth['isAuthenticated'](),controller[_0x8b33('0x4b')]);router[_0x8b33('0x38')](_0x8b33('0x26'),auth['isAuthenticated'](),controller[_0x8b33('0x4c')]);router[_0x8b33('0x38')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x8b33('0x4d')]);router[_0x8b33('0x38')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x8b33('0x4e')]);router[_0x8b33('0x38')](_0x8b33('0x4f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x50')]);router[_0x8b33('0x38')](_0x8b33('0x51'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x52')]);router[_0x8b33('0x38')](_0x8b33('0x53'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x54')]);router[_0x8b33('0x38')]('/:id/whatsapp_interactions',auth[_0x8b33('0x6')](),controller['addWhatsappInteractions']);router[_0x8b33('0x38')](_0x8b33('0x2c'),auth['isAuthenticated'](),controller[_0x8b33('0x55')]);router[_0x8b33('0x38')](_0x8b33('0x2d'),auth[_0x8b33('0x6')](),controller['addMailAccounts']);router['post'](_0x8b33('0x2f'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x8b33('0x38')](_0x8b33('0x31'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x56')]);router[_0x8b33('0x38')](_0x8b33('0x32'),auth['isAuthenticated'](),controller[_0x8b33('0x57')]);router[_0x8b33('0x38')](_0x8b33('0x58'),auth[_0x8b33('0x6')](),controller['addWhatsappAccounts']);router['post'](_0x8b33('0x59'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x5a')]);router[_0x8b33('0x5b')](_0x8b33('0xc'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x5c')]);router[_0x8b33('0x5b')](_0x8b33('0x5d'),auth['isAuthenticated'](),controller['changePassword']);router['delete'](_0x8b33('0x13'),auth[_0x8b33('0x6')](),controller['removeQueues']);router[_0x8b33('0x5e')](_0x8b33('0x26'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x5f')]);router[_0x8b33('0x5e')](_0x8b33('0xc'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x60')]);router['delete'](_0x8b33('0x61'),auth['isAuthenticated'](),controller[_0x8b33('0x62')]);router[_0x8b33('0x5e')]('/:id/mail_interactions',auth[_0x8b33('0x6')](),controller[_0x8b33('0x63')]);router[_0x8b33('0x5e')](_0x8b33('0x4f'),auth['isAuthenticated'](),controller[_0x8b33('0x64')]);router[_0x8b33('0x5e')]('/:id/sms_interactions',auth[_0x8b33('0x6')](),controller[_0x8b33('0x65')]);router[_0x8b33('0x5e')]('/:id/openchannel_interactions',auth[_0x8b33('0x6')](),controller[_0x8b33('0x66')]);router[_0x8b33('0x5e')](_0x8b33('0x67'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x68')]);router[_0x8b33('0x5e')](_0x8b33('0x2c'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x69')]);router[_0x8b33('0x5e')](_0x8b33('0x2d'),auth['isAuthenticated'](),controller[_0x8b33('0x6a')]);router['delete'](_0x8b33('0x2f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6b')]);router[_0x8b33('0x5e')](_0x8b33('0x31'),auth[_0x8b33('0x6')](),controller['removeSmsAccounts']);router[_0x8b33('0x5e')](_0x8b33('0x32'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6c')]);router[_0x8b33('0x5e')](_0x8b33('0x58'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6d')]);router['delete'](_0x8b33('0x59'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x6e')]);router[_0x8b33('0x38')](_0x8b33('0x6f'),auth[_0x8b33('0x6')](),controller[_0x8b33('0x70')]);module[_0x8b33('0x71')]=router; \ No newline at end of file +var _0xe924=['getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','addAvatar','/:id/login','login','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs'];(function(_0x4a141b,_0x4ce4cc){var _0x45847f=function(_0x15910a){while(--_0x15910a){_0x4a141b['push'](_0x4a141b['shift']());}};_0x45847f(++_0x4ce4cc);}(_0xe924,0x141));var _0x4e92=function(_0xc4537c,_0x22cbfb){_0xc4537c=_0xc4537c-0x0;var _0x224bfb=_0xe924[_0xc4537c];return _0x224bfb;};'use strict';var multer=require(_0x4e92('0x0'));var util=require(_0x4e92('0x1'));var path=require(_0x4e92('0x2'));var timeout=require(_0x4e92('0x3'));var express=require(_0x4e92('0x4'));var router=express[_0x4e92('0x5')]();var fs_extra=require(_0x4e92('0x6'));var auth=require(_0x4e92('0x7'));var interaction=require(_0x4e92('0x8'));var config=require(_0x4e92('0x9'));var controller=require(_0x4e92('0xa'));router['get']('/',auth[_0x4e92('0xb')](),controller['index']);router[_0x4e92('0xc')](_0x4e92('0xd'),auth[_0x4e92('0xb')](),controller[_0x4e92('0xe')]);router[_0x4e92('0xc')](_0x4e92('0xf'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x10')]);router[_0x4e92('0xc')](_0x4e92('0x11'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x12')]);router['get'](_0x4e92('0x13'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x14')]);router[_0x4e92('0xc')](_0x4e92('0x15'),controller[_0x4e92('0x16')]);router[_0x4e92('0xc')](_0x4e92('0x17'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x18')]);router[_0x4e92('0xc')](_0x4e92('0x19'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x1a')]);router[_0x4e92('0xc')](_0x4e92('0x1b'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x1c')]);router[_0x4e92('0xc')](_0x4e92('0x1d'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x1e')]);router['get']('/:id/groups',auth[_0x4e92('0xb')](),controller[_0x4e92('0x1f')]);router[_0x4e92('0xc')](_0x4e92('0x20'),auth[_0x4e92('0xb')](),controller['getRecordings']);router[_0x4e92('0xc')](_0x4e92('0x21'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x4e92('0xc')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x4e92('0x22')]);router[_0x4e92('0xc')](_0x4e92('0x23'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x24')]);router[_0x4e92('0xc')](_0x4e92('0x25'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x26')]);router[_0x4e92('0xc')](_0x4e92('0x27'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x28')]);router[_0x4e92('0xc')](_0x4e92('0x29'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x2a')]);router[_0x4e92('0xc')](_0x4e92('0x2b'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x2c')]);router[_0x4e92('0xc')](_0x4e92('0x2d'),auth['isAuthenticated'](),controller[_0x4e92('0x2e')]);router[_0x4e92('0xc')](_0x4e92('0x2f'),auth['isAuthenticated'](),controller[_0x4e92('0x30')]);router[_0x4e92('0xc')](_0x4e92('0x31'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x32')]);router[_0x4e92('0xc')](_0x4e92('0x33'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x4e92('0xc')](_0x4e92('0x34'),auth[_0x4e92('0xb')](),controller['getFaxAccounts']);router[_0x4e92('0xc')](_0x4e92('0x35'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x36')]);router[_0x4e92('0xc')](_0x4e92('0x37'),auth['isAuthenticated'](),controller[_0x4e92('0x38')]);router[_0x4e92('0xc')](_0x4e92('0x39'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x3a')]);router[_0x4e92('0xc')]('/:id/chat_websites',auth[_0x4e92('0xb')](),controller[_0x4e92('0x3b')]);router[_0x4e92('0xc')]('/:id/whatsapp_accounts',auth[_0x4e92('0xb')](),controller[_0x4e92('0x3c')]);router[_0x4e92('0xc')](_0x4e92('0x3d'),auth['isAuthenticated'](),controller['getScheduledCalls']);router['get'](_0x4e92('0x3e'),auth[_0x4e92('0xb')](),controller['getApiKey']);router[_0x4e92('0x3f')](_0x4e92('0x19'),auth[_0x4e92('0xb')](),controller['addContacts']);router['post']('/',auth[_0x4e92('0xb')](),controller['create']);router[_0x4e92('0x3f')](_0x4e92('0x40'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x41')]);router[_0x4e92('0x3f')](_0x4e92('0x1b'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x42')]);var upload=multer({'storage':multer[_0x4e92('0x43')]({'destination':function(_0x2291a9,_0x38c461,_0x129548){_0x129548(null,path[_0x4e92('0x44')](config[_0x4e92('0x45')],_0x4e92('0x46')));},'filename':function(_0x52028e,_0x5a1fca,_0x55867d){_0x55867d(null,util[_0x4e92('0x47')]('%s-%s',Date[_0x4e92('0x48')](),_0x5a1fca[_0x4e92('0x49')]));}})});router[_0x4e92('0x3f')](_0x4e92('0x15'),upload[_0x4e92('0x4a')]('file'),controller[_0x4e92('0x4b')]);router['post'](_0x4e92('0x4c'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x4d')]);router[_0x4e92('0x3f')]('/:id/logout',auth[_0x4e92('0xb')](),controller[_0x4e92('0x4e')]);router[_0x4e92('0x3f')]('/:id/pause',auth[_0x4e92('0xb')](),controller[_0x4e92('0x4f')]);router[_0x4e92('0x3f')](_0x4e92('0x50'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x51')]);router[_0x4e92('0x3f')](_0x4e92('0x2d'),auth['isAuthenticated'](),controller[_0x4e92('0x52')]);router[_0x4e92('0x3f')](_0x4e92('0x53'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x54')]);router[_0x4e92('0x3f')](_0x4e92('0x55'),auth[_0x4e92('0xb')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x4e92('0xb')](),controller['addFaxInteractions']);router[_0x4e92('0x3f')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x4e92('0x56')]);router['post'](_0x4e92('0x57'),auth[_0x4e92('0xb')](),controller['addOpenchannelInteractions']);router[_0x4e92('0x3f')]('/:id/whatsapp_interactions',auth[_0x4e92('0xb')](),controller[_0x4e92('0x58')]);router[_0x4e92('0x3f')](_0x4e92('0x34'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x59')]);router[_0x4e92('0x3f')](_0x4e92('0x35'),auth[_0x4e92('0xb')](),controller['addMailAccounts']);router[_0x4e92('0x3f')](_0x4e92('0x37'),auth[_0x4e92('0xb')](),controller['addOpenchannelAccounts']);router[_0x4e92('0x3f')]('/:id/sms_accounts',auth[_0x4e92('0xb')](),controller[_0x4e92('0x5a')]);router[_0x4e92('0x3f')](_0x4e92('0x5b'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x5c')]);router[_0x4e92('0x3f')](_0x4e92('0x5d'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x5e')]);router[_0x4e92('0x3f')]('/:id/api_key',auth[_0x4e92('0xb')](),controller['createApiKey']);router[_0x4e92('0x5f')](_0x4e92('0x13'),auth['isAuthenticated'](),controller[_0x4e92('0x60')]);router[_0x4e92('0x5f')](_0x4e92('0x61'),auth['isAuthenticated'](),controller[_0x4e92('0x62')]);router[_0x4e92('0x63')](_0x4e92('0x1b'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x64')]);router[_0x4e92('0x63')](_0x4e92('0x2d'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x65')]);router[_0x4e92('0x63')](_0x4e92('0x13'),auth[_0x4e92('0xb')](),controller['destroy']);router[_0x4e92('0x63')]('/:id/chat_interactions',auth[_0x4e92('0xb')](),controller['removeChatInteractions']);router[_0x4e92('0x63')](_0x4e92('0x55'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x66')]);router[_0x4e92('0x63')](_0x4e92('0x67'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x68')]);router[_0x4e92('0x63')]('/:id/sms_interactions',auth[_0x4e92('0xb')](),controller[_0x4e92('0x69')]);router[_0x4e92('0x63')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x4e92('0x6a')]);router[_0x4e92('0x63')](_0x4e92('0x6b'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x6c')]);router['delete'](_0x4e92('0x34'),auth[_0x4e92('0xb')](),controller['removeFaxAccounts']);router[_0x4e92('0x63')](_0x4e92('0x35'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x6d')]);router[_0x4e92('0x63')](_0x4e92('0x37'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x6e')]);router[_0x4e92('0x63')](_0x4e92('0x39'),auth[_0x4e92('0xb')](),controller['removeSmsAccounts']);router[_0x4e92('0x63')](_0x4e92('0x5b'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x6f')]);router[_0x4e92('0x63')]('/:id/whatsapp_accounts',auth[_0x4e92('0xb')](),controller[_0x4e92('0x70')]);router['delete']('/:id/api_key',auth[_0x4e92('0xb')](),controller[_0x4e92('0x71')]);router[_0x4e92('0x3f')](_0x4e92('0x72'),auth[_0x4e92('0xb')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 45d1d07..9d37251 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 _0x5b2b=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','format','getDataValue','email','admin','user','agent','telephone','local','INTEGER','internal','callerid','\x22%s\x22\x20<%s>','DATE','BOOLEAN','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x5b2b,0x15b));var _0xb5b2=function(_0x31ed73,_0xf1d9af){_0x31ed73=_0x31ed73-0x0;var _0xe43ce6=_0x5b2b[_0x31ed73];return _0xe43ce6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xb5b2('0x0'));var _=require(_0xb5b2('0x1'));module[_0xb5b2('0x2')]={'name':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'unique':_0xb5b2('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x640b40){this['setDataValue'](_0xb5b2('0x4'),_0x640b40);this[_0xb5b2('0x5')](_0xb5b2('0x6'),_0x640b40);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x57bd1b){this[_0xb5b2('0x5')](_0xb5b2('0x7'),_0x57bd1b);this[_0xb5b2('0x5')]('callerid',util[_0xb5b2('0x8')]('\x22%s\x22\x20<%s>',_0x57bd1b,this[_0xb5b2('0x9')]('internal')));}},'alias':{'type':Sequelize[_0xb5b2('0x3')]},'email':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'unique':_0xb5b2('0xa'),'validate':{'isEmail':!![]},'set':function(_0x2ca3c6){if(_0x2ca3c6){this['setDataValue'](_0xb5b2('0xa'),_0x2ca3c6['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0xb5b2('0xb'),_0xb5b2('0xc'),_0xb5b2('0xd'),_0xb5b2('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb5b2('0x3')],'defaultValue':_0xb5b2('0xf')},'internal':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':![],'unique':'internal','set':function(_0x251b08){this['setDataValue'](_0xb5b2('0x11'),_0x251b08);this[_0xb5b2('0x5')]('accountcode',_0x251b08);this[_0xb5b2('0x5')](_0xb5b2('0x12'),util['format'](_0xb5b2('0x13'),this['getDataValue'](_0xb5b2('0x7')),_0x251b08));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb5b2('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xb5b2('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb5b2('0x3')]},'country':{'type':Sequelize[_0xb5b2('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb5b2('0x14')]},'voicePause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb5b2('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb5b2('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb5b2('0x16')},'ipaddr':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xb5b2('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x18'),_0xb5b2('0xc'),_0xb5b2('0x19')),'allowNull':!![],'defaultValue':_0xb5b2('0x18')},'context':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![],'defaultValue':_0xb5b2('0x1a')},'callingpres':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x1b'),_0xb5b2('0x1c'),_0xb5b2('0x1d'),_0xb5b2('0x1e'),_0xb5b2('0x1f'),'PROHIB_PASSED_SCREEN',_0xb5b2('0x20'),_0xb5b2('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb5b2('0x22'),'set':function(_0x4080ba){this[_0xb5b2('0x5')](_0xb5b2('0x23'),_0x4080ba?_0x4080ba[_0xb5b2('0x24')](','):null);},'get':function(){return this[_0xb5b2('0x9')]('transport')?this[_0xb5b2('0x9')](_0xb5b2('0x23'))['split'](','):null;},'comment':_0xb5b2('0x25')},'dtmfmode':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x26'),'info',_0xb5b2('0x27'),_0xb5b2('0x28'),_0xb5b2('0x29')),'allowNull':!![],'defaultValue':_0xb5b2('0x26')},'directmedia':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x2b'),_0xb5b2('0x2c'),_0xb5b2('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2351f3){this[_0xb5b2('0x5')](_0xb5b2('0x2e'),_0x2351f3?_0x2351f3['join'](','):null);},'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x2e'))?this['getDataValue'](_0xb5b2('0x2e'))[_0xb5b2('0x2f')](','):null;},'comment':_0xb5b2('0x30')},'callgroup':{'type':Sequelize[_0xb5b2('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb5b2('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'defaultValue':_0xb5b2('0x31')},'allow':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':![],'defaultValue':_0xb5b2('0x32'),'set':function(_0x11ca62){this[_0xb5b2('0x5')](_0xb5b2('0x33'),_0x11ca62?_0x11ca62[_0xb5b2('0x24')](';'):_0xb5b2('0x32'));},'get':function(){return this[_0xb5b2('0x9')]('allow')?this['getDataValue'](_0xb5b2('0x33'))[_0xb5b2('0x2f')](';'):null;},'comment':_0xb5b2('0x34')},'autoframing':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![],'set':function(_0x33dba0){this[_0xb5b2('0x5')](_0xb5b2('0x35'),_0x33dba0?_0x33dba0[_0xb5b2('0x24')](','):null);},'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x35'))?this[_0xb5b2('0x9')](_0xb5b2('0x35'))[_0xb5b2('0x2f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb5b2('0x37')},'amaflags':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xb5b2('0x2a')},'busylevel':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb5b2('0x17')]('yes','no',_0xb5b2('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x39'),_0xb5b2('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xb5b2('0x3b'),_0xb5b2('0x3c')),'allowNull':!![],'defaultValue':_0xb5b2('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'allowNull':!![],'defaultValue':_0xb5b2('0x2a')},'keepalive':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x3d'),_0xb5b2('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xb5b2('0x3f'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xb5b2('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb5b2('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb5b2('0x17')](_0xb5b2('0x2a'),'no',_0xb5b2('0x2b'),_0xb5b2('0x2c'),_0xb5b2('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb5b2('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xb5b2('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb5b2('0x41')]},'showWebBar':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0,'set':function(_0xb3f4be){this[_0xb5b2('0x5')](_0xb5b2('0x42'),_0xb3f4be);var _0x4d2e7a=this[_0xb5b2('0x43')]({'plain':!![]});switch(_0xb3f4be){case 0x0:case 0x1:var _0x4062d9=_0x4d2e7a[_0xb5b2('0x23')]?_[_0xb5b2('0x44')](_0x4d2e7a[_0xb5b2('0x23')])?_0x4d2e7a['transport'][_0xb5b2('0x24')]():_0x4d2e7a[_0xb5b2('0x23')]:_0xb5b2('0x22');if(_0x4062d9===_0xb5b2('0x45')){_0x4062d9=_0xb5b2('0x22');}this['setDataValue']('transport',_0x4062d9);this['setDataValue'](_0xb5b2('0x46'),'no');this[_0xb5b2('0x5')](_0xb5b2('0x47'),null);this[_0xb5b2('0x5')](_0xb5b2('0x48'),null);this[_0xb5b2('0x5')]('icesupport',null);this['setDataValue']('dtlsenable',null);this['setDataValue'](_0xb5b2('0x49'),null);this['setDataValue'](_0xb5b2('0x4a'),null);this[_0xb5b2('0x5')](_0xb5b2('0x4b'),null);this[_0xb5b2('0x5')](_0xb5b2('0x4c'),null);this[_0xb5b2('0x5')](_0xb5b2('0x4d'),'no');break;case 0x2:this[_0xb5b2('0x5')](_0xb5b2('0x23'),'wss');this[_0xb5b2('0x5')](_0xb5b2('0x46'),'yes');this['setDataValue'](_0xb5b2('0x47'),'yes');this['setDataValue'](_0xb5b2('0x48'),_0xb5b2('0x2a'));this[_0xb5b2('0x5')](_0xb5b2('0x4e'),_0xb5b2('0x2a'));this[_0xb5b2('0x5')]('dtlsenable','yes');this[_0xb5b2('0x5')](_0xb5b2('0x49'),'no');this['setDataValue'](_0xb5b2('0x4a'),_0xb5b2('0x4f'));this[_0xb5b2('0x5')](_0xb5b2('0x4b'),_0x4d2e7a['dtlscertfile']||_0xb5b2('0x50'));this[_0xb5b2('0x5')](_0xb5b2('0x4c'),_0x4d2e7a[_0xb5b2('0x4c')]||_0xb5b2('0x51'));this['setDataValue']('rtcp_mux',_0xb5b2('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xb5b2('0x41')],'set':function(_0x5d9326){this[_0xb5b2('0x5')](_0xb5b2('0x52'),_0x5d9326?_0x5d9326[_0xb5b2('0x24')](','):[]);},'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x52'))?_[_0xb5b2('0x53')](this[_0xb5b2('0x9')](_0xb5b2('0x52'))[_0xb5b2('0x2f')](','),function(_0x2a4519){return parseInt(_0x2a4519,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb5b2('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb5b2('0x17')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb5b2('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb5b2('0x54')],'get':function(){return this[_0xb5b2('0x9')](_0xb5b2('0x55'))?this[_0xb5b2('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb5b2('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb5b2('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![],'set':function(_0x327ce9){if(typeof _0x327ce9===_0xb5b2('0x56')){var _0x7a1547=_0x327ce9==='1'?!![]:_0x327ce9==='0'?![]:_0x327ce9===_0xb5b2('0x57')?!![]:_0x327ce9===_0xb5b2('0x58')?![]:![];this['setDataValue'](_0xb5b2('0x59'),_0x7a1547);}else{this[_0xb5b2('0x5')]('screenrecording',_0x327ce9);}}},'blocked':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![],'set':function(_0x3155be){this[_0xb5b2('0x5')](_0xb5b2('0x5a'),_0x3155be);if(_0x3155be===!![]){this[_0xb5b2('0x5')](_0xb5b2('0x5b'),moment());this[_0xb5b2('0x5')](_0xb5b2('0x5c'),0x0);}else{this[_0xb5b2('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xb5b2('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb5b2('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb5b2('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7cb2=['map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','always','accept','refuse','uas','certificate','passive','nonat','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlscertfile','rtcp_mux','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions'];(function(_0x655931,_0xc8604){var _0x255092=function(_0x2cba33){while(--_0x2cba33){_0x655931['push'](_0x655931['shift']());}};_0x255092(++_0xc8604);}(_0x7cb2,0x1d5));var _0x27cb=function(_0x4ad035,_0x19a80e){_0x4ad035=_0x4ad035-0x0;var _0x394cce=_0x7cb2[_0x4ad035];return _0x394cce;};'use strict';var Sequelize=require(_0x27cb('0x0'));var moment=require(_0x27cb('0x1'));var util=require(_0x27cb('0x2'));var _=require(_0x27cb('0x3'));module[_0x27cb('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x27cb('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x19a004){this['setDataValue']('name',_0x19a004);this[_0x27cb('0x6')](_0x27cb('0x7'),_0x19a004);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x393344){this['setDataValue'](_0x27cb('0x8'),_0x393344);this[_0x27cb('0x6')](_0x27cb('0x9'),util[_0x27cb('0xa')](_0x27cb('0xb'),_0x393344,this[_0x27cb('0xc')](_0x27cb('0xd'))));}},'alias':{'type':Sequelize[_0x27cb('0xe')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x27cb('0xf'),'validate':{'isEmail':!![]},'set':function(_0x5ccd10){if(_0x5ccd10){this[_0x27cb('0x6')](_0x27cb('0xf'),_0x5ccd10[_0x27cb('0x10')]());}}},'role':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x12'),_0x27cb('0x13'),_0x27cb('0x14'),_0x27cb('0x15')),'allowNull':![]},'password':{'type':Sequelize[_0x27cb('0xe')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x27cb('0x16')},'internal':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':![],'unique':_0x27cb('0xd'),'set':function(_0x43ecf5){this[_0x27cb('0x6')](_0x27cb('0xd'),_0x43ecf5);this[_0x27cb('0x6')](_0x27cb('0x18'),_0x43ecf5);this['setDataValue'](_0x27cb('0x9'),util['format']('\x22%s\x22\x20<%s>',this[_0x27cb('0xc')](_0x27cb('0x8')),_0x43ecf5));}},'salt':{'type':Sequelize[_0x27cb('0xe')]},'phone':{'type':Sequelize[_0x27cb('0xe')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x27cb('0xe')]},'zipcode':{'type':Sequelize[_0x27cb('0xe')]},'userpic':{'type':Sequelize[_0x27cb('0xe')]},'city':{'type':Sequelize[_0x27cb('0xe')]},'country':{'type':Sequelize[_0x27cb('0xe')]},'online':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x27cb('0xe')],'defaultValue':_0x27cb('0x1a')},'lastPauseAt':{'type':Sequelize[_0x27cb('0x1b')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x27cb('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x27cb('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'host':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'port':{'type':Sequelize[_0x27cb('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x27cb('0x11')]('friend',_0x27cb('0x13'),_0x27cb('0x1c')),'allowNull':!![],'defaultValue':_0x27cb('0x1d')},'context':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![],'defaultValue':_0x27cb('0x1e')},'callingpres':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x1f'),_0x27cb('0x20'),_0x27cb('0x21'),_0x27cb('0x22'),'PROHIB_NOT_SCREENED',_0x27cb('0x23'),_0x27cb('0x24'),_0x27cb('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'permit':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'secret':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'transport':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![],'defaultValue':_0x27cb('0x26'),'set':function(_0x54e777){this[_0x27cb('0x6')](_0x27cb('0x27'),_0x54e777?_0x54e777[_0x27cb('0x28')](','):null);},'get':function(){return this[_0x27cb('0xc')](_0x27cb('0x27'))?this[_0x27cb('0xc')]('transport')[_0x27cb('0x29')](','):null;},'comment':_0x27cb('0x2a')},'dtmfmode':{'type':Sequelize[_0x27cb('0x11')]('rfc2833','info',_0x27cb('0x2b'),_0x27cb('0x2c'),_0x27cb('0x2d')),'allowNull':!![],'defaultValue':_0x27cb('0x2e')},'directmedia':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no','nonat',_0x27cb('0x30'),_0x27cb('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'nat':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![],'defaultValue':_0x27cb('0x32'),'set':function(_0x4b6272){this[_0x27cb('0x6')](_0x27cb('0x33'),_0x4b6272?_0x4b6272[_0x27cb('0x28')](','):null);},'get':function(){return this[_0x27cb('0xc')](_0x27cb('0x33'))?this[_0x27cb('0xc')](_0x27cb('0x33'))[_0x27cb('0x29')](','):null;},'comment':_0x27cb('0x34')},'callgroup':{'type':Sequelize[_0x27cb('0xe')]},'namedcallgroup':{'type':Sequelize[_0x27cb('0xe')]},'pickupgroup':{'type':Sequelize[_0x27cb('0xe')]},'namedpickupgroup':{'type':Sequelize[_0x27cb('0xe')]},'language':{'type':Sequelize[_0x27cb('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x27cb('0xe')]},'disallow':{'type':Sequelize[_0x27cb('0xe')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x27cb('0xe')],'allowNull':![],'defaultValue':_0x27cb('0x35'),'set':function(_0x408d22){this[_0x27cb('0x6')]('allow',_0x408d22?_0x408d22[_0x27cb('0x28')](';'):_0x27cb('0x35'));},'get':function(){return this[_0x27cb('0xc')]('allow')?this[_0x27cb('0xc')]('allow')[_0x27cb('0x29')](';'):null;},'comment':_0x27cb('0x36')},'autoframing':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![],'set':function(_0x8ff423){this['setDataValue'](_0x27cb('0x37'),_0x8ff423?_0x8ff423[_0x27cb('0x28')](','):null);},'get':function(){return this[_0x27cb('0xc')]('insecure')?this[_0x27cb('0xc')](_0x27cb('0x37'))[_0x27cb('0x29')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x27cb('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x27cb('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x27cb('0x11')]('yes','no',_0x27cb('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x27cb('0x11')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x27cb('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'template':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no',_0x27cb('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x3a'),_0x27cb('0x3b'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'allowNull':!![],'defaultValue':_0x27cb('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x27cb('0x2f')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x27cb('0x11')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x27cb('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x27cb('0x11')]('yes','no','fingerprint',_0x27cb('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x27cb('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x27cb('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x27cb('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x27cb('0x11')](_0x27cb('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x27cb('0x2f'),'no',_0x27cb('0x3f'),_0x27cb('0x30'),_0x27cb('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x27cb('0xe')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x57e97a){this[_0x27cb('0x6')](_0x27cb('0x41'),_0x57e97a);var _0x5e895c=this[_0x27cb('0x42')]({'plain':!![]});switch(_0x57e97a){case 0x0:case 0x1:var _0x519f05=_0x5e895c[_0x27cb('0x27')]?_[_0x27cb('0x43')](_0x5e895c[_0x27cb('0x27')])?_0x5e895c[_0x27cb('0x27')]['join']():_0x5e895c[_0x27cb('0x27')]:_0x27cb('0x26');if(_0x519f05===_0x27cb('0x44')){_0x519f05=_0x27cb('0x26');}this[_0x27cb('0x6')](_0x27cb('0x27'),_0x519f05);this[_0x27cb('0x6')](_0x27cb('0x45'),'no');this[_0x27cb('0x6')](_0x27cb('0x46'),null);this[_0x27cb('0x6')](_0x27cb('0x47'),null);this['setDataValue'](_0x27cb('0x48'),null);this[_0x27cb('0x6')]('dtlsenable',null);this[_0x27cb('0x6')](_0x27cb('0x49'),null);this[_0x27cb('0x6')]('dtlssetup',null);this['setDataValue'](_0x27cb('0x4a'),null);this[_0x27cb('0x6')]('dtlsprivatekey',null);this[_0x27cb('0x6')](_0x27cb('0x4b'),'no');break;case 0x2:this['setDataValue'](_0x27cb('0x27'),_0x27cb('0x44'));this[_0x27cb('0x6')]('encryption',_0x27cb('0x2f'));this[_0x27cb('0x6')](_0x27cb('0x46'),_0x27cb('0x2f'));this[_0x27cb('0x6')](_0x27cb('0x47'),_0x27cb('0x2f'));this[_0x27cb('0x6')](_0x27cb('0x48'),_0x27cb('0x2f'));this[_0x27cb('0x6')](_0x27cb('0x4c'),_0x27cb('0x2f'));this['setDataValue'](_0x27cb('0x49'),'no');this['setDataValue']('dtlssetup',_0x27cb('0x4d'));this[_0x27cb('0x6')](_0x27cb('0x4a'),_0x5e895c[_0x27cb('0x4a')]||_0x27cb('0x4e'));this[_0x27cb('0x6')](_0x27cb('0x4f'),_0x5e895c[_0x27cb('0x4f')]||_0x27cb('0x50'));this[_0x27cb('0x6')](_0x27cb('0x4b'),_0x27cb('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x27cb('0x51')],'set':function(_0x259ec2){this[_0x27cb('0x6')](_0x27cb('0x52'),_0x259ec2?_0x259ec2[_0x27cb('0x28')](','):[]);},'get':function(){return this[_0x27cb('0xc')](_0x27cb('0x52'))?_[_0x27cb('0x53')](this[_0x27cb('0xc')]('permissions')[_0x27cb('0x29')](','),function(_0x34c61f){return parseInt(_0x34c61f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x27cb('0xe')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x27cb('0xe')]},'phoneBarBusyNumber':{'type':Sequelize[_0x27cb('0xe')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x27cb('0xe')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x27cb('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x27cb('0xe')]},'phoneBarEnableJaws':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x27cb('0x54')],'get':function(){return this[_0x27cb('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0x27cb('0xc')](_0x27cb('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x27cb('0xe')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xc5e1cb){if(typeof _0xc5e1cb===_0x27cb('0x56')){var _0x50f9be=_0xc5e1cb==='1'?!![]:_0xc5e1cb==='0'?![]:_0xc5e1cb===_0x27cb('0x57')?!![]:_0xc5e1cb===_0x27cb('0x58')?![]:![];this[_0x27cb('0x6')](_0x27cb('0x59'),_0x50f9be);}else{this['setDataValue'](_0x27cb('0x59'),_0xc5e1cb);}}},'blocked':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![],'set':function(_0x236ca7){this[_0x27cb('0x6')]('blocked',_0x236ca7);if(_0x236ca7===!![]){this[_0x27cb('0x6')](_0x27cb('0x5a'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0x27cb('0x6')](_0x27cb('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x27cb('0x1b')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x27cb('0x17')](0x5)[_0x27cb('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x27cb('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x27cb('0x19')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ff78d34..3b28e72 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 _0xcb0f=['$and','$or','$gt','$lte','$eq','$notBetween','$notIn','$like','$notILike','$overlap','$contains','$contained','$any','lastName','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','teams','queues','inbound','flatten','toString','lower','asc','desc','substring','orderBy','offline','unavailable','slice','charAt','toUpperCase','QueryTypes','select','field','ui.','InteractionId','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','../../mysqldb','redis','./user.socket','defaults','localhost','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','update','then','role','agent','emit','userNotification:recalc:','get','Users','user','Telephones','telephone','filter','ignore','map','value','name','UserProfileResource','destroy','stack','User','rawAttributes','type','key','password','salt','resetPasswordExpires','md5secret','index','where','query','include','UserSetting','includes','attributes','findAll','rows','openTabs','true','length','push','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','getOptions','userSetting','merge','options','find','chat','catch','body','params','addContacts','ids','omit','internal','findById','securePassword','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)','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','102','113','110','104','105','106','107','108','111','114','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Agents','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','spread','toLowerCase','Queue:save','voice','VoiceQueue','SIP/%s','penalty','UserVoiceQueueRt','upsert','removeQueues','remove','Queues','QueueId','Queue:remove','addAvatar','server/files/images/logos/default_profile.png','userpic','download','join','root','server/files/images/','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','format','User\x20with\x20id\x20%s\x20not\x20found','describe','hasOwnProperty','includeAll','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','mobile','LOCAL/%s@from-sip/n','interface','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGININPAUSE','resolve','logout','pause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','unpause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','transaction','addTeams','Team','flattenDeep','getDataValue','Voice','TeamVoicePrefix','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','UserVoicePrefix','VoicePrefixId','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','ChatWebsite','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper'];(function(_0x2e4041,_0x315cb2){var _0x3d9e66=function(_0x1e9e8c){while(--_0x1e9e8c){_0x2e4041['push'](_0x2e4041['shift']());}};_0x3d9e66(++_0x315cb2);}(_0xcb0f,0x1c2));var _0xfcb0=function(_0x2edb5e,_0x164a44){_0x2edb5e=_0x2edb5e-0x0;var _0x5b442c=_0xcb0f[_0x2edb5e];return _0x5b442c;};'use strict';var moment=require(_0xfcb0('0x0'));var util=require(_0xfcb0('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require(_0xfcb0('0x2'));var authService=require(_0xfcb0('0x3'));var contacts=require(_0xfcb0('0x4'));var qs=require(_0xfcb0('0x5'));var rta=require('../../components/realtime/agents');var logger=require('../../config/logger')(_0xfcb0('0x6'));var utils=require(_0xfcb0('0x7'));var config=require(_0xfcb0('0x8'));var licenseUtil=require(_0xfcb0('0x9'));var APIBadRequestError=require(_0xfcb0('0xa'))[_0xfcb0('0xb')];var APINotFoundError=require(_0xfcb0('0xa'))[_0xfcb0('0xc')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0xfcb0('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xfcb0('0xe')]));require(_0xfcb0('0xf'))['register'](socket);config[_0xfcb0('0xe')]=_[_0xfcb0('0x10')](config[_0xfcb0('0xe')],{'host':_0xfcb0('0x11'),'port':0x18eb});var values;function respondWithStatusCode(_0x5888c1,_0x11bccf){_0x11bccf=_0x11bccf||0xcc;return function(_0x22dfa4){if(_0x22dfa4){return _0x5888c1[_0xfcb0('0x12')](_0x11bccf);}return _0x5888c1['status'](_0x11bccf)[_0xfcb0('0x13')]();};}function respondWithResult(_0x32b83d,_0x549478){_0x549478=_0x549478||0xc8;return function(_0x4b44bf){if(_0x4b44bf){return _0x32b83d['status'](_0x549478)[_0xfcb0('0x14')](_0x4b44bf);}};}function respondWithFilteredResult(_0x337a93,_0x536aa8){return function(_0x133d9d){if(_0x133d9d){var _0x34605f=typeof _0x536aa8[_0xfcb0('0x15')]==='undefined'&&typeof _0x536aa8['limit']===_0xfcb0('0x16');var _0x4119fb=_0x133d9d[_0xfcb0('0x17')];var _0x5e91ed=_0x34605f?0x0:_0x536aa8['offset'];var _0xee30b4=_0x34605f?_0x133d9d[_0xfcb0('0x17')]:_0x536aa8[_0xfcb0('0x15')]+_0x536aa8[_0xfcb0('0x18')];var _0x514573;if(_0xee30b4>=_0x4119fb){_0xee30b4=_0x4119fb;_0x514573=0xc8;}else{_0x514573=0xce;}_0x337a93[_0xfcb0('0x19')](_0x514573);return _0x337a93[_0xfcb0('0x1a')](_0xfcb0('0x1b'),_0x5e91ed+'-'+_0xee30b4+'/'+_0x4119fb)[_0xfcb0('0x14')](_0x133d9d);}return null;};}function saveUpdates(_0x3c7181){return function(_0x58154c){if(_0x58154c){return _0x58154c[_0xfcb0('0x1c')](_0x3c7181)[_0xfcb0('0x1d')](function(_0x3ec8b0){if(_0x3ec8b0[_0xfcb0('0x1e')]===_0xfcb0('0x1f')){socket[_0xfcb0('0x20')](_0xfcb0('0x21')+_0x3ec8b0['id'],_0x3ec8b0);}return _0x3ec8b0;});}return null;};}function removeEntity(_0x3a87b3){return function(_0x49fb3b){if(_0x49fb3b){return _0x49fb3b['destroy']()['then'](function(){var _0x46b29b=_0x49fb3b[_0xfcb0('0x22')]({'plain':!![]});if(_0x46b29b['role']==='admin')return;var _0x4ecf1f=[{'name':_0xfcb0('0x23'),'value':_0xfcb0('0x24'),'ignore':!![]},{'name':'Agents','value':_0xfcb0('0x1f'),'ignore':![]},{'name':_0xfcb0('0x25'),'value':_0xfcb0('0x26'),'ignore':![]}];var _0x5c5c84=_(_0x4ecf1f)[_0xfcb0('0x27')](_0xfcb0('0x28'))[_0xfcb0('0x29')]('value')[_0xfcb0('0x2a')]();if(_['includes'](_0x5c5c84,_0x46b29b[_0xfcb0('0x1e')])){return;}var _0x51f852=_['find'](_0x4ecf1f,['value',_0x46b29b[_0xfcb0('0x1e')]])[_0xfcb0('0x2b')];return db[_0xfcb0('0x2c')][_0xfcb0('0x2d')]({'where':{'type':_0x51f852,'resourceId':_0x46b29b['id']}})[_0xfcb0('0x1d')](function(){return _0x49fb3b;});})[_0xfcb0('0x1d')](function(){_0x3a87b3[_0xfcb0('0x19')](0xcc)[_0xfcb0('0x13')]();});}};}function handleEntityNotFound(_0x382ec5){return function(_0x351b31){if(!_0x351b31){_0x382ec5[_0xfcb0('0x12')](0x194);}return _0x351b31;};}function handleError(_0x5783d2,_0x34f87d){_0x34f87d=_0x34f87d||0x1f4;return function(_0x19724f){logger['error'](_0x19724f[_0xfcb0('0x2e')]);if(_0x19724f[_0xfcb0('0x2b')]){delete _0x19724f[_0xfcb0('0x2b')];}_0x5783d2[_0xfcb0('0x19')](_0x34f87d)['send'](_0x19724f);};}function getUserAttributes(){return _(db[_0xfcb0('0x2f')][_0xfcb0('0x30')])[_0xfcb0('0x29')](function(_0x280bee){return{'name':_0x280bee['fieldName'],'type':_0x280bee[_0xfcb0('0x31')][_0xfcb0('0x32')]};})[_0xfcb0('0x27')](function(_0xca9871){return![_0xfcb0('0x33'),_0xfcb0('0x34'),'previousPasswords','resetPasswordToken',_0xfcb0('0x35'),_0xfcb0('0x36')]['includes'](_0xca9871[_0xfcb0('0x2b')]);})['value']();}exports[_0xfcb0('0x37')]=function(_0x1b5480,_0x43c228){var _0x5429cf={},_0x1127e8={'count':0x0,'rows':[]};var _0x3c056e=getUserAttributes();_0x5429cf=qs['getOptions'](_0x3c056e,_0x1b5480);var _0x57e8c8={'where':_0x5429cf[_0xfcb0('0x38')]};return db[_0xfcb0('0x2f')][_0xfcb0('0x17')](_0x57e8c8)[_0xfcb0('0x1d')](function(_0x210d36){_0x1127e8['count']=_0x210d36;if(_0x1b5480[_0xfcb0('0x39')]['includeAll']){_0x5429cf[_0xfcb0('0x3a')]=[{'all':!![]}];}if(_0x1b5480[_0xfcb0('0x39')]['userSetting']==='true'){_0x5429cf[_0xfcb0('0x3a')]=[{'model':db[_0xfcb0('0x3b')],'as':'userSetting'}];}if(!_[_0xfcb0('0x3c')](_0x5429cf[_0xfcb0('0x3d')],'id')){_0x5429cf['attributes']['push']('id');}return db[_0xfcb0('0x2f')][_0xfcb0('0x3e')](_0x5429cf);})[_0xfcb0('0x1d')](function(_0x3e09d4){_0x1127e8[_0xfcb0('0x3f')]=_0x3e09d4;if(_0x1b5480[_0xfcb0('0x39')][_0xfcb0('0x40')]===_0xfcb0('0x41')){var _0x1ce5a6=[];for(var _0x3d8c0e=0x0;_0x3d8c0e<_0x1127e8[_0xfcb0('0x3f')][_0xfcb0('0x42')];_0x3d8c0e++){_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs('chat',_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x45'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x46'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6['push'](get_open_tabs(_0xfcb0('0x47'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e][_0xfcb0('0x44')]));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x48'),_0x1127e8[_0xfcb0('0x3f')][_0x3d8c0e]['dataValues']));_0x1ce5a6[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x49'),_0x1127e8['rows'][_0x3d8c0e][_0xfcb0('0x44')]));}return Promise[_0xfcb0('0x4a')](_0x1ce5a6)[_0xfcb0('0x1d')](function(){return _0x1127e8;});}else{return _0x1127e8;}})['then'](respondWithFilteredResult(_0x43c228,_0x5429cf))['catch'](handleError(_0x43c228,null));};exports[_0xfcb0('0x4b')]=function(_0x5c7bec,_0x3314a8){var _0x549a90=getUserAttributes();_0x5c7bec['query']['id']=_0x5c7bec['params']['id'];var _0x3d6399=qs[_0xfcb0('0x4c')](_0x549a90,_0x5c7bec);if(_0x5c7bec['query']['includeAll']){_0x3d6399[_0xfcb0('0x3a')]=[{'all':!![]}];}if(_0x5c7bec['query'][_0xfcb0('0x4d')]===_0xfcb0('0x41')){_0x3d6399[_0xfcb0('0x3a')]=[{'model':db[_0xfcb0('0x3b')],'as':_0xfcb0('0x4d')}];}_0x3d6399=_[_0xfcb0('0x4e')]({},_0x3d6399,_0x5c7bec[_0xfcb0('0x4f')]);if(!_[_0xfcb0('0x3c')](_0x3d6399[_0xfcb0('0x3d')],'id')){_0x3d6399[_0xfcb0('0x3d')][_0xfcb0('0x43')]('id');}return db[_0xfcb0('0x2f')][_0xfcb0('0x50')](_0x3d6399)[_0xfcb0('0x1d')](handleEntityNotFound(_0x3314a8,null))[_0xfcb0('0x1d')](function(_0x9b2726){var _0x444436=[];values=_0x9b2726;if(_0x5c7bec['query'][_0xfcb0('0x40')]===_0xfcb0('0x41')){_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x51'),_0x9b2726[_0xfcb0('0x44')]));_0x444436['push'](get_open_tabs('sms',_0x9b2726[_0xfcb0('0x44')]));_0x444436[_0xfcb0('0x43')](get_open_tabs('openchannel',_0x9b2726[_0xfcb0('0x44')]));_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x49'),_0x9b2726[_0xfcb0('0x44')]));_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x46'),_0x9b2726['dataValues']));_0x444436[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x47'),_0x9b2726[_0xfcb0('0x44')]));return Promise['all'](_0x444436);}else{return values;}})[_0xfcb0('0x1d')](function(){return values;})['then'](respondWithResult(_0x3314a8,null))[_0xfcb0('0x52')](handleError(_0x3314a8,null));};exports[_0xfcb0('0x1c')]=function(_0x53ab9f,_0x123218){if(_0x53ab9f[_0xfcb0('0x53')]['id']){delete _0x53ab9f[_0xfcb0('0x53')]['id'];}delete _0x53ab9f['body'][_0xfcb0('0x1e')];return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x53ab9f[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x123218,null))['then'](saveUpdates(_0x53ab9f[_0xfcb0('0x53')],null))[_0xfcb0('0x1d')](respondWithResult(_0x123218,null))['catch'](handleError(_0x123218,null));};exports['describe']=function(_0x2b96b2,_0x2ee332){return db[_0xfcb0('0x2f')]['describe']()[_0xfcb0('0x1d')](respondWithResult(_0x2ee332,null))['catch'](handleError(_0x2ee332,null));};exports[_0xfcb0('0x55')]=function(_0x5e8c0c,_0x4af158){return db[_0xfcb0('0x2f')]['find']({'where':{'id':_0x5e8c0c[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x4af158,null))[_0xfcb0('0x1d')](function(_0x42f6c5){if(_0x42f6c5){return _0x42f6c5[_0xfcb0('0x55')](_0x5e8c0c[_0xfcb0('0x53')][_0xfcb0('0x56')],_[_0xfcb0('0x57')](_0x5e8c0c['body'],[_0xfcb0('0x56'),'id'])||{});}})[_0xfcb0('0x1d')](respondWithResult(_0x4af158,null))[_0xfcb0('0x52')](handleError(_0x4af158,null));};function validateUser(_0x2caea3){return new Promise(function(_0x4b9df7,_0xdb87c8){if(_0x2caea3[_0xfcb0('0x58')])return _0x4b9df7(_0x2caea3);return db['Setting'][_0xfcb0('0x59')](0x1)['then'](function(_0x22fbd5){if(_0x22fbd5[_0xfcb0('0x5a')])authService[_0xfcb0('0x5b')](_0x2caea3[_0xfcb0('0x33')]);db[_0xfcb0('0x2f')][_0xfcb0('0x5c')](_0xfcb0('0x58'))[_0xfcb0('0x1d')](function(_0x4ad03f){if(_[_0xfcb0('0x5d')](_0x4ad03f)){_0x2caea3[_0xfcb0('0x58')]=_0x22fbd5['min_internal']||0x1;return;}if(_[_0xfcb0('0x5d')](_0x22fbd5[_0xfcb0('0x5e')])||_0x22fbd5[_0xfcb0('0x5e')]===_0x4ad03f){_0x2caea3['internal']=_0x4ad03f+0x1;return;}if(_0x22fbd5[_0xfcb0('0x5e')]>_0x4ad03f){_0x2caea3[_0xfcb0('0x58')]=_0x22fbd5[_0xfcb0('0x5e')];return;}return db[_0xfcb0('0x5f')][_0xfcb0('0x39')](_0xfcb0('0x60'),{'type':db['sequelize']['QueryTypes'][_0xfcb0('0x61')]})['then'](function(_0x538d9e){if(_0x538d9e&&_0x538d9e[_0xfcb0('0x42')]){for(var _0x152b63=0x0,_0x5e990e=_0x538d9e[_0xfcb0('0x42')];_0x152b63<_0x5e990e&&_['isNil'](_0x2caea3[_0xfcb0('0x58')]);_0x152b63++){if(_0x22fbd5[_0xfcb0('0x5e')]<=_0x538d9e[_0x152b63]['from']){_0x2caea3[_0xfcb0('0x58')]=_0x538d9e[_0x152b63][_0xfcb0('0x62')];}else if(_0x22fbd5['min_internal']>_0x538d9e[_0x152b63][_0xfcb0('0x62')]&&_0x22fbd5['min_internal']<=_0x538d9e[_0x152b63]['to']){_0x2caea3[_0xfcb0('0x58')]=_0x22fbd5['min_internal'];}}}if(_[_0xfcb0('0x5d')](_0x2caea3[_0xfcb0('0x58')])){_0x2caea3['internal']=_0x4ad03f+0x1;}return _0x4b9df7(_0x2caea3);});});})['catch'](function(_0x566673){_0xdb87c8(_0x566673);});});}function updateUser(_0x596c46){return new Promise(function(_0x478af0,_0x25577a){try{if(_0x596c46['voicemail']){_0x596c46[_0xfcb0('0x63')]=_0x596c46[_0xfcb0('0x58')];_0x596c46[_0xfcb0('0x64')]={'mailbox':_0x596c46[_0xfcb0('0x58')],'password':_0x596c46[_0xfcb0('0x33')],'fullname':_0x596c46[_0xfcb0('0x65')],'email':_0x596c46[_0xfcb0('0x66')]};}if(_0x596c46[_0xfcb0('0x1e')]===_0xfcb0('0x1f')){if(!_0x596c46[_0xfcb0('0x67')])_0x596c46[_0xfcb0('0x67')]=[_0xfcb0('0x68'),_0xfcb0('0x69'),'103',_0xfcb0('0x6a'),_0xfcb0('0x6b'),_0xfcb0('0x6c'),_0xfcb0('0x6d'),_0xfcb0('0x6e'),_0xfcb0('0x6f'),_0xfcb0('0x70'),'109','100',_0xfcb0('0x71'),_0xfcb0('0x72'),'115'];}_0x478af0(_0x596c46);}catch(_0x19ff6e){_0x25577a(_0x19ff6e);}});}exports['create']=function(_0x5ec5c0,_0x53515e){if(_0x5ec5c0[_0xfcb0('0x24')][_0xfcb0('0x1e')]===_0xfcb0('0x1f'))throw new Error('Unauthorized');if(_0x5ec5c0[_0xfcb0('0x53')][_0xfcb0('0x1e')]===_0xfcb0('0x24')&&_0x5ec5c0['user'][_0xfcb0('0x1e')]!==_0xfcb0('0x73')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5ec5c0[_0xfcb0('0x53')][_0xfcb0('0x1e')]==='admin'&&_0x5ec5c0[_0xfcb0('0x24')]['role']!=='admin'){throw new Error(_0xfcb0('0x74'));}return licenseUtil[_0xfcb0('0x75')]([_0x5ec5c0[_0xfcb0('0x53')]])[_0xfcb0('0x1d')](function(){return validateUser(_0x5ec5c0[_0xfcb0('0x53')]);})[_0xfcb0('0x1d')](function(_0x1c15da){return updateUser(_0x1c15da)['then'](function(_0x45456c){if(_0x45456c[_0xfcb0('0x1e')]===_0xfcb0('0x73')){_0x45456c['settingsEnabled']=_0x5ec5c0[_0xfcb0('0x24')][_0xfcb0('0x76')];delete _0x45456c[_0xfcb0('0x77')];}return _0x45456c;});})[_0xfcb0('0x1d')](function(_0x193e59){return db[_0xfcb0('0x2f')][_0xfcb0('0x78')](_0x193e59,{'include':[{'model':db[_0xfcb0('0x64')],'as':_0xfcb0('0x64')}]});})[_0xfcb0('0x1d')](function(_0x29cb9f){if(_0x5ec5c0['body']['role']===_0xfcb0('0x24'))return _0x29cb9f;if(_0x5ec5c0[_0xfcb0('0x24')][_0xfcb0('0x1e')]!==_0xfcb0('0x24'))return _0x29cb9f;return db[_0xfcb0('0x79')]['find']({'where':{'name':_0x29cb9f[_0xfcb0('0x1e')]===_0xfcb0('0x1f')?_0xfcb0('0x7a'):_0xfcb0('0x25'),'userProfileId':_0x5ec5c0[_0xfcb0('0x24')]['userProfileId']},'raw':!![]})[_0xfcb0('0x1d')](function(_0x37a09d){if(!_0x37a09d||_0x37a09d[_0xfcb0('0x7b')]!=0x0)return _0x29cb9f;return db[_0xfcb0('0x2c')]['create']({'name':_0x29cb9f[_0xfcb0('0x2b')],'resourceId':_0x29cb9f['id'],'type':_0x37a09d['name'],'sectionId':_0x37a09d['id']},{})[_0xfcb0('0x1d')](function(){return _0x29cb9f;});})[_0xfcb0('0x52')](function(_0x42e8c6){logger[_0xfcb0('0x7c')](_0xfcb0('0x7d'),_0x42e8c6);throw _0x42e8c6;});})[_0xfcb0('0x1d')](respondWithResult(_0x53515e,0xc9))[_0xfcb0('0x52')](handleError(_0x53515e,null));};exports[_0xfcb0('0x7e')]=function(_0x3486bc,_0xc79ea){var _0x4496a2=_0x3486bc[_0xfcb0('0x53')];var _0x182c0c=[];if(_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x1e')]==='agent')throw new Error(_0xfcb0('0x7f'));if(_[_0xfcb0('0x80')](_0x4496a2,[_0xfcb0('0x1e'),'user'])&&_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x1e')]!=='admin'){throw new Error(_0xfcb0('0x81'));}if(_['some'](_0x4496a2,[_0xfcb0('0x1e'),'admin'])&&_0x3486bc[_0xfcb0('0x24')]['role']!==_0xfcb0('0x73')){throw new Error(_0xfcb0('0x82'));}return licenseUtil[_0xfcb0('0x75')](_0x4496a2)[_0xfcb0('0x1d')](function(){return validateUser(_0x4496a2[0x0]);})['then'](function(){for(var _0xc50b9d=0x1;_0xc50b9d<_0x4496a2[_0xfcb0('0x42')];_0xc50b9d++){var _0x3757b9=_0x4496a2[_0xc50b9d-0x1][_0xfcb0('0x58')];if(!_0x4496a2[_0xc50b9d]['internal'])_0x4496a2[_0xc50b9d][_0xfcb0('0x58')]=_0x3757b9+0x1;_0x182c0c[_0xfcb0('0x43')](validateUser(_0x4496a2[_0xc50b9d]));}return Promise[_0xfcb0('0x4a')](_0x182c0c);})['then'](function(){_0x182c0c=[];for(var _0x4a588c=0x0;_0x4a588c<_0x4496a2['length'];_0x4a588c++){_0x182c0c['push'](updateUser(_0x4496a2[_0x4a588c]));}return Promise['all'](_0x182c0c);})[_0xfcb0('0x1d')](function(){_0x182c0c=_0x4496a2[_0xfcb0('0x29')](function(_0x2555da){return db[_0xfcb0('0x2f')]['create'](_0x2555da,{'include':[{'model':db[_0xfcb0('0x64')],'as':_0xfcb0('0x64')}]})[_0xfcb0('0x1d')](function(_0x311676){_0x2555da['id']=_0x311676['id'];return _0x2555da;});});return Promise[_0xfcb0('0x4a')](_0x182c0c);})['then'](function(_0x36f3c5){if(_0x3486bc[_0xfcb0('0x53')][_0xfcb0('0x1e')]===_0xfcb0('0x24'))return _0x36f3c5;if(_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x1e')]!==_0xfcb0('0x24'))return _0x36f3c5;var _0x14a762=_[_0xfcb0('0x80')](_0x36f3c5,function(_0x4dbb79){return _0x4dbb79[_0xfcb0('0x1e')]===_0xfcb0('0x1f')||_0x4dbb79[_0xfcb0('0x1e')]===_0xfcb0('0x26');});if(!_0x14a762)return _0x36f3c5;return db[_0xfcb0('0x79')][_0xfcb0('0x3e')]({'where':{'name':{'$or':[_0xfcb0('0x7a'),_0xfcb0('0x25')]},'userProfileId':_0x3486bc[_0xfcb0('0x24')][_0xfcb0('0x77')]},'raw':!![]})[_0xfcb0('0x1d')](function(_0x17db49){if(_[_0xfcb0('0x83')](_0x17db49)||!_['some'](_0x17db49,['autoAssociation',0x0]))return _0x36f3c5;_0x182c0c=[];var _0xac9454=_(_0x17db49)['map'](function(_0x22ef3e){if(_0x22ef3e['autoAssociation']===0x1)return;return _0x22ef3e['name']==='Agents'?'agent':_0xfcb0('0x26');})[_0xfcb0('0x84')]()[_0xfcb0('0x2a')]();for(var _0x5c19d3=0x0;_0x5c19d3<_0x36f3c5['length'];_0x5c19d3++){if(!_['includes'](_0xac9454,_0x36f3c5[_0x5c19d3]['role']))return;var _0x9323bf=_0x36f3c5[_0x5c19d3][_0xfcb0('0x1e')]===_0xfcb0('0x1f')?_0xfcb0('0x7a'):_0xfcb0('0x25');_0x182c0c[_0xfcb0('0x43')](db[_0xfcb0('0x2c')][_0xfcb0('0x78')]({'name':_0x36f3c5[_0x5c19d3][_0xfcb0('0x2b')],'resourceId':_0x36f3c5[_0x5c19d3]['id'],'type':_0x9323bf,'sectionId':_[_0xfcb0('0x50')](_0x17db49,['name',_0x9323bf])['id']},{}));}return Promise['all'](_0x182c0c);});})[_0xfcb0('0x1d')](respondWithResult(_0xc79ea,0xc9))['catch'](handleError(_0xc79ea,null));};exports[_0xfcb0('0x85')]=function(_0x19bd61,_0x19d8b0){if(_0x19bd61[_0xfcb0('0x53')]['id']){delete _0x19bd61[_0xfcb0('0x53')]['id'];}return db['User'][_0xfcb0('0x50')]({'where':{'id':_0x19bd61[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](function(_0x21b59d){if(!_0x21b59d)return null;if(_0x21b59d['id']===_0x19bd61[_0xfcb0('0x24')]['id']){if(!_0x19bd61['body'][_0xfcb0('0x86')]||!_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')]){throw new db['Sequelize'][(_0xfcb0('0x88'))](_0xfcb0('0x89'));}if(!_0x21b59d[_0xfcb0('0x8a')](_0x19bd61[_0xfcb0('0x53')]['oldPassword'])){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x8c'));}if(_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x86')]===_0x19bd61['body'][_0xfcb0('0x87')]){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x8d'));}}else if(_0x19bd61[_0xfcb0('0x24')][_0xfcb0('0x1e')]===_0xfcb0('0x73')){if(!_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')]){throw new db['Sequelize'][(_0xfcb0('0x88'))](_0xfcb0('0x8e'));}}else if(_0x19bd61[_0xfcb0('0x24')][_0xfcb0('0x1e')]===_0xfcb0('0x24')){if(!_0x19bd61[_0xfcb0('0x53')]['newPassword']){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x8e'));}if(_0x21b59d['role']!==_0xfcb0('0x1f')){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x7f'));}}else{throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x7f'));}return _0x21b59d;})[_0xfcb0('0x1d')](handleEntityNotFound(_0x19d8b0,null))[_0xfcb0('0x1d')](function(_0x270e60){return db[_0xfcb0('0x8f')][_0xfcb0('0x90')]({'attributes':['id',_0xfcb0('0x5a'),'enforcePasswordHistory',_0xfcb0('0x91')]})[_0xfcb0('0x1d')](function(_0x3a29c4){if(_0x3a29c4[_0xfcb0('0x5a')])authService[_0xfcb0('0x5b')](_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')]);if(!_0x3a29c4[_0xfcb0('0x92')]||!_0x270e60[_0xfcb0('0x93')])return _0x270e60;authService[_0xfcb0('0x94')](_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')],_0x270e60[_0xfcb0('0x93')],_0x3a29c4[_0xfcb0('0x91')]);return _0x270e60;})[_0xfcb0('0x1d')](saveUpdates({'password':_0x19bd61[_0xfcb0('0x53')]['newPassword'],'passwordResetAt':_0x19bd61['user']['id']==_0x19bd61[_0xfcb0('0x54')]['id']?moment():null,'previousPasswords':authService[_0xfcb0('0x95')](_0x19bd61[_0xfcb0('0x53')][_0xfcb0('0x87')],_0x270e60[_0xfcb0('0x93')])},null));})[_0xfcb0('0x1d')](respondWithResult(_0x19d8b0,null))[_0xfcb0('0x52')](handleError(_0x19d8b0,null));};exports['addQueues']=function(_0x39d7ef,_0x2d31c5){var _0x15bbd9=_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x96')];return db[_0xfcb0('0x2f')]['find']({'where':{'id':_0x39d7ef[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e'),_0xfcb0('0x97'),_0xfcb0('0x98'),_0xfcb0('0x99'),'interface']})[_0xfcb0('0x1d')](handleEntityNotFound(_0x2d31c5,null))[_0xfcb0('0x1d')](function(_0x475678){if(_0x475678){if(!utils[_0xfcb0('0x9a')](_0x15bbd9)){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x9b'));}return _0x475678[_0xfcb0('0x9c')+_[_0xfcb0('0x9d')](_0x15bbd9['toLowerCase']())+'Queues'](_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x56')],{'penalty':_0x39d7ef[_0xfcb0('0x53')]['penalty']||0x0})[_0xfcb0('0x9e')](function(_0x2a322a){for(var _0x3610c8=0x0;_0x3610c8<_0x39d7ef['body']['ids'][_0xfcb0('0x42')];_0x3610c8+=0x1){var _0x28bf68={'UserId':Number(_0x39d7ef[_0xfcb0('0x54')]['id'])};_0x28bf68[_[_0xfcb0('0x9d')](_0x15bbd9[_0xfcb0('0x9f')]())+'QueueId']=Number(_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x56')][_0x3610c8]);socket['emit'](_0xfcb0('0x24')+_[_0xfcb0('0x9d')](_0x15bbd9['toLowerCase']())+_0xfcb0('0xa0'),_0x28bf68);}return _0x2a322a;})[_0xfcb0('0x1d')](function(){if(_0x15bbd9===_0xfcb0('0xa1')){return db[_0xfcb0('0xa2')]['findAll']({'where':{'id':_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0x56')]||[]},'raw':!![],'attributes':['id',_0xfcb0('0x2b')]});}})['then'](function(_0x1928d5){var _0x282818=_0x475678['get']({'plain':!![]});var _0x2ad304=[];if(_0x15bbd9==='voice'&&_0x282818['role']===_0xfcb0('0x1f')&&_0x282818[_0xfcb0('0x97')]){for(let _0x158656=0x0;_0x158656<_0x1928d5[_0xfcb0('0x42')];_0x158656+=0x1){_0x2ad304[_0xfcb0('0x43')]({'membername':_0x282818[_0xfcb0('0x2b')],'UserId':_0x282818['id'],'queue_name':_0x1928d5[_0x158656]['name'],'VoiceQueueId':_0x1928d5[_0x158656]['id'],'interface':_[_0xfcb0('0x5d')](_0x282818['interface'])?util['format'](_0xfcb0('0xa3'),_0x282818[_0xfcb0('0x2b')]):_0x282818['interface'],'paused':_0x282818[_0xfcb0('0x99')]||![],'penalty':_0x39d7ef[_0xfcb0('0x53')][_0xfcb0('0xa4')]||0x0});}return Promise[_0xfcb0('0x4a')](_0x2ad304[_0xfcb0('0x29')](function(_0x46079f){return db[_0xfcb0('0xa5')][_0xfcb0('0xa6')](_0x46079f);}));}return _0x475678;});}})[_0xfcb0('0x1d')](respondWithStatusCode(_0x2d31c5,null))[_0xfcb0('0x52')](handleError(_0x2d31c5,null));};exports[_0xfcb0('0xa7')]=function(_0x4c99cb,_0x329fa5){var _0x334755,_0x4c8798;return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x4c99cb['params']['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e')]})[_0xfcb0('0x1d')](handleEntityNotFound(_0x329fa5,null))[_0xfcb0('0x1d')](function(_0x375de9){if(_0x375de9){_0x334755=_0x375de9;if(!_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')]||!utils[_0xfcb0('0x9a')](_0x4c99cb['query']['channel'])){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0x9b'));}return _0x375de9[_0xfcb0('0xa8')+_[_0xfcb0('0x9d')](_0x4c99cb[_0xfcb0('0x39')]['channel']['toLowerCase']())+_0xfcb0('0xa9')](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x56')]);}})[_0xfcb0('0x1d')](function(_0x7cfc1){if(_['isArray'](_0x4c99cb['query'][_0xfcb0('0x56')])){for(var _0x4b24df=0x0;_0x4b24df<_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x56')][_0xfcb0('0x42')];_0x4b24df+=0x1){_0x4c8798={'UserId':Number(_0x4c99cb[_0xfcb0('0x54')]['id'])};_0x4c8798[_['capitalize'](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+_0xfcb0('0xaa')]=Number(_0x4c99cb['query']['ids'][_0x4b24df]);socket[_0xfcb0('0x20')](_0xfcb0('0x24')+_['capitalize'](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+_0xfcb0('0xab'),_0x4c8798);}}else{_0x4c8798={'UserId':Number(_0x4c99cb['params']['id'])};_0x4c8798[_[_0xfcb0('0x9d')](_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+_0xfcb0('0xaa')]=Number(_0x4c99cb['query'][_0xfcb0('0x56')]);socket['emit'](_0xfcb0('0x24')+_[_0xfcb0('0x9d')](_0x4c99cb['query'][_0xfcb0('0x96')][_0xfcb0('0x9f')]())+'Queue:remove',_0x4c8798);}return _0x7cfc1;})['then'](function(){if(_0x4c99cb['query'][_0xfcb0('0x96')]===_0xfcb0('0xa1')){return db[_0xfcb0('0xa5')][_0xfcb0('0x2d')]({'where':{'UserId':_0x4c99cb['params']['id'],'VoiceQueueId':_0x4c99cb[_0xfcb0('0x39')][_0xfcb0('0x56')]},'individualHooks':!![]})[_0xfcb0('0x1d')](function(){return _0x334755;});}return _0x334755;})[_0xfcb0('0x1d')](respondWithStatusCode(_0x329fa5,null))['catch'](handleError(_0x329fa5,null));};exports[_0xfcb0('0xac')]=function(_0x5b6fd7,_0x377cd3){_0x5b6fd7['body']['userpic']=_0x5b6fd7['file']['filename'];return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x5b6fd7[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x377cd3,null))['then'](saveUpdates(_0x5b6fd7[_0xfcb0('0x53')],null))[_0xfcb0('0x1d')](respondWithResult(_0x377cd3,null))[_0xfcb0('0x52')](handleError(_0x377cd3,null));};exports['getAvatar']=function(_0x1b0961,_0x347ec1){var _0x5ac2e4=path['join'](config['root'],_0xfcb0('0xad'));return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x1b0961[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0xae')],'raw':!![]})['then'](handleEntityNotFound(_0x347ec1,null))[_0xfcb0('0x1d')](function(_0x4b72c4){if(_0x4b72c4){if(_[_0xfcb0('0x5d')](_0x4b72c4['userpic'])){return _0x347ec1[_0xfcb0('0xaf')](_0x5ac2e4);}else{if(!fs['existsSync'](path[_0xfcb0('0xb0')](config[_0xfcb0('0xb1')],_0xfcb0('0xb2'),_0x4b72c4[_0xfcb0('0xae')]))){return _0x347ec1['download'](_0x5ac2e4);}return _0x347ec1['download'](path[_0xfcb0('0xb0')](config[_0xfcb0('0xb1')],_0xfcb0('0xb2'),_0x4b72c4[_0xfcb0('0xae')]));}}})[_0xfcb0('0x52')](handleError(_0x347ec1,null));};exports['getOpenTabs']=function(_0x510191,_0x295d2f){return db['User']['find']({'where':{'id':_0x510191[_0xfcb0('0x54')]['id']},'attributes':['id']})[_0xfcb0('0x1d')](handleEntityNotFound(_0x295d2f,null))[_0xfcb0('0x1d')](function(_0x4374ca){var _0x106f55=[];values=_0x4374ca[_0xfcb0('0x44')];_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x51'),_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs('sms',_0x4374ca['dataValues']));_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x48'),_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x49'),_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs('fax',_0x4374ca[_0xfcb0('0x44')]));_0x106f55[_0xfcb0('0x43')](get_open_tabs(_0xfcb0('0x47'),_0x4374ca[_0xfcb0('0x44')]));return Promise[_0xfcb0('0x4a')](_0x106f55);})['then'](function(_0xe44f0d){if(_0xe44f0d){var _0x2387af=_[_0xfcb0('0x29')](values['ChatOpenTabs'],function(_0x111722){return{'channel':_0xfcb0('0xb3'),'id':_0x111722['id'],'createdAt':_0x111722[_0xfcb0('0xb4')]};});var _0x552ceb=_[_0xfcb0('0x29')](values[_0xfcb0('0xb5')],function(_0x2f7e89){return{'channel':_0xfcb0('0xb6'),'id':_0x2f7e89['id'],'createdAt':_0x2f7e89[_0xfcb0('0xb4')]};});var _0x1d3e1e=_[_0xfcb0('0x29')](values[_0xfcb0('0xb7')],function(_0x5e853c){return{'channel':'OPENCHANNEL','id':_0x5e853c['id'],'createdAt':_0x5e853c[_0xfcb0('0xb4')]};});var _0x180c2a=_[_0xfcb0('0x29')](values[_0xfcb0('0xb8')],function(_0x2a7b1c){return{'channel':_0xfcb0('0xb9'),'id':_0x2a7b1c['id'],'createdAt':_0x2a7b1c['createdAt']};});var _0x4b3b4d=_['map'](values[_0xfcb0('0xba')],function(_0x52bbe0){return{'channel':_0xfcb0('0xbb'),'id':_0x52bbe0['id'],'createdAt':_0x52bbe0[_0xfcb0('0xb4')]};});var _0x5ee34c=_[_0xfcb0('0x29')](values[_0xfcb0('0xbc')],function(_0x4f8316){return{'channel':'WHATSAPP','id':_0x4f8316['id'],'createdAt':_0x4f8316[_0xfcb0('0xb4')]};});var _0x146c15=_[_0xfcb0('0xbd')](_0x2387af,_0x552ceb,_0x1d3e1e,_0x180c2a,_0x4b3b4d,_0x5ee34c);var _0x5ddb32={'count':_0x146c15[_0xfcb0('0x42')],'rows':_0x146c15};return _0x5ddb32;}else return null;})[_0xfcb0('0x1d')](respondWithResult(_0x295d2f,null))['catch'](handleError(_0x295d2f,null));};exports[_0xfcb0('0xbe')]=function(_0x5cb6fa,_0x5ddf7d){var _0x29e04b={};return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x5cb6fa[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](function(_0x119bba){if(!_0x119bba){throw new APINotFoundError(util[_0xfcb0('0xbf')](_0xfcb0('0xc0'),_0x5cb6fa['params']['id']));}return contacts[_0xfcb0('0xc1')]();})[_0xfcb0('0x1d')](function(_0x47c116){_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0x2f')]=_0x5cb6fa['params']['id'];_0x29e04b=qs[_0xfcb0('0x4c')](_0x47c116,_0x5cb6fa);if(_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xc3'))){_0x29e04b[_0xfcb0('0x3a')]=[{'model':db[_0xfcb0('0xc4')],'as':_0xfcb0('0xc5'),'required':![]},{'model':db[_0xfcb0('0xc6')],'as':_0xfcb0('0xc7'),'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0xc8')],'where':_0x5cb6fa[_0xfcb0('0x39')]['tag']?{'id':_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0xc9')]}:undefined,'required':_0x5cb6fa[_0xfcb0('0x39')][_0xfcb0('0xc9')]?!![]:![]}];}return contacts[_0xfcb0('0x3e')](_0x5cb6fa[_0xfcb0('0x39')],_0x5cb6fa[_0xfcb0('0x24')],_0x29e04b,_0x47c116);})[_0xfcb0('0x1d')](respondWithFilteredResult(_0x5ddf7d,_0x29e04b))[_0xfcb0('0x52')](APIHandleError(_0x5ddf7d));};exports[_0xfcb0('0xca')]=function(_0x9b539d,_0x1e9376){var _0x5ec88c;var _0x34964c={};var _0x154c4c;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x9b539d[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e')]})[_0xfcb0('0x1d')](handleEntityNotFound(_0x1e9376,null))[_0xfcb0('0x1d')](function(_0x932711){if(!utils[_0xfcb0('0x9a')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])){throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))]('Unknown\x20channel');}_0x5ec88c=_0x932711;var _0xcb20ca={};_0xcb20ca[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_[_0xfcb0('0x9d')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])+_0xfcb0('0xcd')][_0xfcb0('0x30')]);_0xcb20ca[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x9b539d[_0xfcb0('0x39')]);_0xcb20ca[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0xcb20ca[_0xfcb0('0xcb')],_0xcb20ca[_0xfcb0('0x39')]);_0x34964c[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0xcb20ca['model'],qs['fields'](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x34964c[_0xfcb0('0x3d')]=_0x34964c['attributes'][_0xfcb0('0x42')]?_0x34964c[_0xfcb0('0x3d')]:_0xcb20ca[_0xfcb0('0xcb')];_0x34964c[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x9b539d['query'][_0xfcb0('0xd2')]);_0x34964c[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x9b539d['query'],_0xcb20ca[_0xfcb0('0xce')]));if(_0x9b539d['query'][_0xfcb0('0x27')]){_0x34964c['where']=_[_0xfcb0('0x4e')](_0x34964c['where'],{'$or':_[_0xfcb0('0x29')](_0x34964c[_0xfcb0('0x3d')],function(_0x372ab3){var _0x5d291f={};_0x5d291f[_0x372ab3]={'$like':'%'+_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x5d291f;})});}_0x34964c=_[_0xfcb0('0x4e')]({},_0x34964c,_0x9b539d[_0xfcb0('0x4f')]);switch(_0x5ec88c[_0xfcb0('0x1e')]){case'admin':return db[_[_0xfcb0('0x9d')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])+_0xfcb0('0xcd')]['findAll'](_0x34964c);case'user':case'agent':return _0x5ec88c[_0xfcb0('0x22')+_['capitalize'](_0x9b539d[_0xfcb0('0x39')]['channel'])+_0xfcb0('0xa9')](_0x34964c);default:throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0xd4'));}})['then'](function(_0x4139b3){_0x154c4c=_0x4139b3[_0xfcb0('0x42')];if(!_0x9b539d[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x34964c[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x34964c[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x15')]);}switch(_0x5ec88c[_0xfcb0('0x1e')]){case _0xfcb0('0x73'):return db[_[_0xfcb0('0x9d')](_0x9b539d[_0xfcb0('0x39')][_0xfcb0('0x96')])+'Queue'][_0xfcb0('0x3e')](_0x34964c);case _0xfcb0('0x24'):case _0xfcb0('0x1f'):return _0x5ec88c[_0xfcb0('0x22')+_[_0xfcb0('0x9d')](_0x9b539d['query'][_0xfcb0('0x96')])+_0xfcb0('0xa9')](_0x34964c);}})[_0xfcb0('0x1d')](function(_0x3f65d0){return{'count':_0x154c4c,'rows':_0x3f65d0};})[_0xfcb0('0x1d')](respondWithResult(_0x1e9376,null))['catch'](handleError(_0x1e9376,null));};exports['getVoiceQueuesRt']=function(_0x402695,_0x4fc624){var _0x3fdad8={};var _0x8d97d5={};var _0x50b99a;var _0x499037;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x402695[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x4fc624,null))[_0xfcb0('0x1d')](function(_0x372e87){if(_0x372e87){_0x50b99a=_0x372e87;_0x8d97d5[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db['UserVoiceQueueRt'][_0xfcb0('0x30')]);_0x8d97d5['query']=_[_0xfcb0('0xcc')](_0x402695[_0xfcb0('0x39')]);_0x8d97d5[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x8d97d5['model'],_0x8d97d5[_0xfcb0('0x39')]);_0x3fdad8['attributes']=_[_0xfcb0('0xcf')](_0x8d97d5[_0xfcb0('0xcb')],qs['fields'](_0x402695[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x3fdad8[_0xfcb0('0x3d')]=_0x3fdad8[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x3fdad8[_0xfcb0('0x3d')]:_0x8d97d5[_0xfcb0('0xcb')];_0x3fdad8['order']=qs[_0xfcb0('0xd2')](_0x402695[_0xfcb0('0x39')]['sort']);_0x3fdad8[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x402695[_0xfcb0('0x39')],_0x8d97d5['filters']));if(_0x402695[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x3fdad8[_0xfcb0('0x38')]=_['merge'](_0x3fdad8[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x3fdad8['attributes'],function(_0x2f01fa){var _0x5d9317={};_0x5d9317[_0x2f01fa]={'$like':'%'+_0x402695[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x5d9317;})});}_0x3fdad8=_[_0xfcb0('0x4e')]({},_0x3fdad8,_0x402695['options']);return _0x50b99a[_0xfcb0('0xd6')](_0x3fdad8);}})['then'](function(_0x4dce62){if(_0x4dce62){_0x499037=_0x4dce62[_0xfcb0('0x42')];if(!_0x402695[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x3fdad8[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x402695[_0xfcb0('0x39')]['limit']);_0x3fdad8['offset']=qs[_0xfcb0('0x15')](_0x402695['query'][_0xfcb0('0x15')]);}return _0x50b99a['getVoiceQueuesRt'](_0x3fdad8);}})[_0xfcb0('0x1d')](function(_0x5a692c){if(_0x5a692c){return _0x5a692c?{'count':_0x499037,'rows':_0x5a692c}:null;}})['then'](respondWithResult(_0x4fc624,null))['catch'](handleError(_0x4fc624,null));};exports[_0xfcb0('0xd7')]=function(_0x411833,_0x2a7cd3){var _0x11ef49={};var _0x488f87={};var _0x1a14fc;var _0x20f847;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x411833[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a7cd3,null))[_0xfcb0('0x1d')](function(_0xbfbc7e){if(_0xbfbc7e){_0x1a14fc=_0xbfbc7e;_0x488f87[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db['ChatGroup'][_0xfcb0('0x30')]);_0x488f87[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x411833['query']);_0x488f87[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x488f87['model'],_0x488f87[_0xfcb0('0x39')]);_0x11ef49[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x488f87[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x411833[_0xfcb0('0x39')]['fields']));_0x11ef49[_0xfcb0('0x3d')]=_0x11ef49[_0xfcb0('0x3d')]['length']?_0x11ef49['attributes']:_0x488f87['model'];_0x11ef49[_0xfcb0('0xd1')]=qs['sort'](_0x411833['query']['sort']);_0x11ef49[_0xfcb0('0x38')]=qs['filters'](_['pick'](_0x411833[_0xfcb0('0x39')],_0x488f87[_0xfcb0('0xce')]));if(_0x411833[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x11ef49[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x11ef49[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x11ef49[_0xfcb0('0x3d')],function(_0x133a1a){var _0x198925={};_0x198925[_0x133a1a]={'$like':'%'+_0x411833[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x198925;})});}_0x11ef49=_['merge']({},_0x11ef49,_0x411833['options']);return _0x1a14fc[_0xfcb0('0xd7')](_0x11ef49);}})['then'](function(_0x3f8d2c){if(_0x3f8d2c){_0x20f847=_0x3f8d2c[_0xfcb0('0x42')];if(!_0x411833[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x11ef49[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x411833[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x11ef49[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x411833['query'][_0xfcb0('0x15')]);}return _0x1a14fc[_0xfcb0('0xd7')](_0x11ef49);}})['then'](function(_0x2ec5e7){if(_0x2ec5e7){return _0x2ec5e7?{'count':_0x20f847,'rows':_0x2ec5e7}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x2a7cd3,null))[_0xfcb0('0x52')](handleError(_0x2a7cd3,null));};exports['getRecordings']=function(_0x4065ae,_0xbfe016){var _0x7828b5={'raw':!![],'where':{}};var _0x420ea0={};var _0x4abe06={'count':0x0,'rows':[]};return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x4065ae[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0xbfe016,null))[_0xfcb0('0x1d')](function(_0x14f68d){if(_0x14f68d){_0x420ea0[_0xfcb0('0xcb')]=_['keys'](db[_0xfcb0('0xd8')][_0xfcb0('0x30')]);_0x420ea0[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x4065ae[_0xfcb0('0x39')]);_0x420ea0['filters']=_[_0xfcb0('0xcf')](_0x420ea0['model'],_0x420ea0[_0xfcb0('0x39')]);_0x7828b5[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x420ea0[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x7828b5[_0xfcb0('0x3d')]=_0x7828b5[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x7828b5[_0xfcb0('0x3d')]:_0x420ea0[_0xfcb0('0xcb')];if(!_0x4065ae['query'][_0xfcb0('0xc2')]('nolimit')){_0x7828b5['limit']=qs[_0xfcb0('0x18')](_0x4065ae['query'][_0xfcb0('0x18')]);_0x7828b5[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x4065ae['query']['offset']);}_0x7828b5[_0xfcb0('0xd1')]=qs['sort'](_0x4065ae[_0xfcb0('0x39')]['sort']);_0x7828b5[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x4065ae['query'],_0x420ea0['filters']));_0x7828b5[_0xfcb0('0x38')][_0xfcb0('0xd9')]=_0x14f68d['id'];if(_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x7828b5[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x7828b5[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x7828b5[_0xfcb0('0x3d')],function(_0x38c3cf){var _0x1d3b80={};_0x1d3b80[_0x38c3cf]={'$like':'%'+_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x1d3b80;})});}_0x7828b5=_[_0xfcb0('0x4e')]({},_0x7828b5,_0x4065ae[_0xfcb0('0x4f')]);return db[_0xfcb0('0xd8')][_0xfcb0('0x17')]({'where':_0x7828b5[_0xfcb0('0x38')]})[_0xfcb0('0x1d')](function(_0x42cb17){_0x4abe06[_0xfcb0('0x17')]=_0x42cb17;if(_0x4065ae[_0xfcb0('0x39')][_0xfcb0('0xc3')]){_0x7828b5['include']=[{'all':!![]}];}return db[_0xfcb0('0xd8')]['findAll'](_0x7828b5);})[_0xfcb0('0x1d')](function(_0x21d1a4){_0x4abe06[_0xfcb0('0x3f')]=_0x21d1a4;return _0x4abe06;});}})[_0xfcb0('0x1d')](respondWithFilteredResult(_0xbfe016,_0x7828b5))['catch'](handleError(_0xbfe016,null));};exports[_0xfcb0('0xda')]=function(_0x5d63f7,_0x3859f8){var _0x15b52a={'raw':!![],'where':{}};var _0xed9165={};var _0x4214cc={'count':0x0,'rows':[]};return db[_0xfcb0('0x2f')]['findOne']({'where':{'id':_0x5d63f7[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x3859f8,null))['then'](function(_0x58b95b){if(_0x58b95b){_0xed9165[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xdb')][_0xfcb0('0x30')]);_0xed9165[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x5d63f7[_0xfcb0('0x39')]);_0xed9165[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0xed9165['model'],_0xed9165[_0xfcb0('0x39')]);_0x15b52a[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0xed9165['model'],qs[_0xfcb0('0xd0')](_0x5d63f7[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x15b52a['attributes']=_0x15b52a['attributes']['length']?_0x15b52a[_0xfcb0('0x3d')]:_0xed9165[_0xfcb0('0xcb')];if(!_0x5d63f7[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x15b52a['limit']=qs[_0xfcb0('0x18')](_0x5d63f7['query'][_0xfcb0('0x18')]);_0x15b52a[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x5d63f7[_0xfcb0('0x39')][_0xfcb0('0x15')]);}_0x15b52a[_0xfcb0('0xd1')]=qs['sort'](_0x5d63f7[_0xfcb0('0x39')]['sort']);_0x15b52a['where']=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x5d63f7[_0xfcb0('0x39')],_0xed9165['filters']));_0x15b52a[_0xfcb0('0x38')]['UserId']=_0x58b95b['id'];if(_0x5d63f7[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x15b52a[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x15b52a[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x15b52a[_0xfcb0('0x3d')],function(_0x5f3f89){var _0x1993d3={};_0x1993d3[_0x5f3f89]={'$like':'%'+_0x5d63f7[_0xfcb0('0x39')]['filter']+'%'};return _0x1993d3;})});}_0x15b52a=_[_0xfcb0('0x4e')]({},_0x15b52a,_0x5d63f7[_0xfcb0('0x4f')]);return db[_0xfcb0('0xdb')][_0xfcb0('0x17')]({'where':_0x15b52a[_0xfcb0('0x38')]})[_0xfcb0('0x1d')](function(_0x50b826){_0x4214cc['count']=_0x50b826;if(_0x5d63f7['query'][_0xfcb0('0xc3')]){_0x15b52a[_0xfcb0('0x3a')]=[{'all':!![]}];}return db[_0xfcb0('0xdb')][_0xfcb0('0x3e')](_0x15b52a);})[_0xfcb0('0x1d')](function(_0x12a003){_0x4214cc[_0xfcb0('0x3f')]=_0x12a003;return _0x4214cc;});}})[_0xfcb0('0x1d')](respondWithFilteredResult(_0x3859f8,_0x15b52a))[_0xfcb0('0x52')](handleError(_0x3859f8,null));};exports[_0xfcb0('0xdc')]=function(_0xa864c5,_0x117746){var _0x42491f={};var _0x302f9c={};var _0x2cef3d;var _0x3eae57;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0xa864c5[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x117746,null))[_0xfcb0('0x1d')](function(_0x43cace){if(_0x43cace){_0x2cef3d=_0x43cace;_0x302f9c[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xdd')][_0xfcb0('0x30')]);_0x302f9c[_0xfcb0('0x39')]=_['keys'](_0xa864c5[_0xfcb0('0x39')]);_0x302f9c['filters']=_[_0xfcb0('0xcf')](_0x302f9c[_0xfcb0('0xcb')],_0x302f9c[_0xfcb0('0x39')]);_0x42491f[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x302f9c[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x42491f[_0xfcb0('0x3d')]=_0x42491f[_0xfcb0('0x3d')]['length']?_0x42491f[_0xfcb0('0x3d')]:_0x302f9c[_0xfcb0('0xcb')];_0x42491f[_0xfcb0('0xd1')]=qs['sort'](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x42491f[_0xfcb0('0x38')]=qs['filters'](_[_0xfcb0('0xd3')](_0xa864c5[_0xfcb0('0x39')],_0x302f9c[_0xfcb0('0xce')]));if(_0xa864c5['query'][_0xfcb0('0x27')]){_0x42491f[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x42491f['where'],{'$or':_['map'](_0x42491f[_0xfcb0('0x3d')],function(_0x53a6e5){var _0x31c3be={};_0x31c3be[_0x53a6e5]={'$like':'%'+_0xa864c5[_0xfcb0('0x39')]['filter']+'%'};return _0x31c3be;})});}_0x42491f=_[_0xfcb0('0x4e')]({},_0x42491f,_0xa864c5[_0xfcb0('0x4f')]);return _0x2cef3d[_0xfcb0('0xdc')](_0x42491f);}})['then'](function(_0x2b9336){if(_0x2b9336){_0x3eae57=_0x2b9336[_0xfcb0('0x42')];if(!_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0xc2')]('nolimit')){_0x42491f[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x42491f[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0xa864c5[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x2cef3d[_0xfcb0('0xdc')](_0x42491f);}})[_0xfcb0('0x1d')](function(_0x394c2c){if(_0x394c2c){return _0x394c2c?{'count':_0x3eae57,'rows':_0x394c2c}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x117746,null))[_0xfcb0('0x52')](handleError(_0x117746,null));};exports[_0xfcb0('0xde')]=function(_0x974693,_0x2d42df){var _0x1823b6={};var _0x12bc87={};var _0x47e995;var _0x30abdd;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x974693['params']['id']}})['then'](handleEntityNotFound(_0x2d42df,null))[_0xfcb0('0x1d')](function(_0x1a53f8){if(_0x1a53f8){_0x47e995=_0x1a53f8;_0x12bc87[_0xfcb0('0xcb')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x12bc87['query']=_[_0xfcb0('0xcc')](_0x974693[_0xfcb0('0x39')]);_0x12bc87['filters']=_['intersection'](_0x12bc87[_0xfcb0('0xcb')],_0x12bc87[_0xfcb0('0x39')]);_0x1823b6[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x12bc87[_0xfcb0('0xcb')],qs['fields'](_0x974693[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x1823b6['attributes']=_0x1823b6['attributes'][_0xfcb0('0x42')]?_0x1823b6[_0xfcb0('0x3d')]:_0x12bc87[_0xfcb0('0xcb')];_0x1823b6[_0xfcb0('0xd1')]=qs['sort'](_0x974693[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x1823b6[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x974693['query'],_0x12bc87[_0xfcb0('0xce')]));if(_0x974693[_0xfcb0('0x39')]['filter']){_0x1823b6['where']=_[_0xfcb0('0x4e')](_0x1823b6['where'],{'$or':_['map'](_0x1823b6[_0xfcb0('0x3d')],function(_0x14892c){var _0x11c68c={};_0x11c68c[_0x14892c]={'$like':'%'+_0x974693[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x11c68c;})});}_0x1823b6=_[_0xfcb0('0x4e')]({},_0x1823b6,_0x974693[_0xfcb0('0x4f')]);return _0x47e995[_0xfcb0('0xde')](_0x1823b6);}})[_0xfcb0('0x1d')](function(_0x53cfab){if(_0x53cfab){_0x30abdd=_0x53cfab['length'];if(!_0x974693['query'][_0xfcb0('0xc2')]('nolimit')){_0x1823b6[_0xfcb0('0x18')]=qs['limit'](_0x974693[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x1823b6[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x974693[_0xfcb0('0x39')]['offset']);}return _0x47e995[_0xfcb0('0xde')](_0x1823b6);}})[_0xfcb0('0x1d')](function(_0x1441f9){if(_0x1441f9){return _0x1441f9?{'count':_0x30abdd,'rows':_0x1441f9}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x2d42df,null))['catch'](handleError(_0x2d42df,null));};exports[_0xfcb0('0xdf')]=function(_0x1a0086,_0x29adc3){var _0x20c606={'raw':!![],'where':{}};var _0x1532cb={};var _0x43d999={'count':0x0,'rows':[]};return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x1a0086['params']['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x29adc3,null))[_0xfcb0('0x1d')](function(_0xa14dbf){if(_0xa14dbf){_0x1532cb[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xe0')]['rawAttributes']);_0x1532cb[_0xfcb0('0x39')]=_['keys'](_0x1a0086[_0xfcb0('0x39')]);_0x1532cb[_0xfcb0('0xce')]=_['intersection'](_0x1532cb['model'],_0x1532cb[_0xfcb0('0x39')]);_0x20c606['attributes']=_['intersection'](_0x1532cb[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x1a0086['query'][_0xfcb0('0xd0')]));_0x20c606[_0xfcb0('0x3d')]=_0x20c606[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x20c606[_0xfcb0('0x3d')]:_0x1532cb['model'];if(!_0x1a0086['query']['hasOwnProperty']('nolimit')){_0x20c606['limit']=qs['limit'](_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x20c606[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0x15')]);}_0x20c606[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x20c606[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x1a0086[_0xfcb0('0x39')],_0x1532cb[_0xfcb0('0xce')]));_0x20c606[_0xfcb0('0x38')][_0xfcb0('0xd9')]=_0xa14dbf['id'];if(_0x1a0086[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x20c606[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x20c606['where'],{'$or':_['map'](_0x20c606[_0xfcb0('0x3d')],function(_0x3c9442){var _0x546b47={};_0x546b47[_0x3c9442]={'$like':'%'+_0x1a0086['query'][_0xfcb0('0x27')]+'%'};return _0x546b47;})});}_0x20c606=_[_0xfcb0('0x4e')]({},_0x20c606,_0x1a0086[_0xfcb0('0x4f')]);return db[_0xfcb0('0xe0')][_0xfcb0('0x17')]({'where':_0x20c606['where']})[_0xfcb0('0x1d')](function(_0x4d1d61){_0x43d999[_0xfcb0('0x17')]=_0x4d1d61;if(_0x1a0086['query'][_0xfcb0('0xc3')]){_0x20c606[_0xfcb0('0x3a')]=[{'all':!![]}];}return db[_0xfcb0('0xe0')]['findAll'](_0x20c606);})['then'](function(_0x519ff0){_0x43d999[_0xfcb0('0x3f')]=_0x519ff0;return _0x43d999;});}})[_0xfcb0('0x1d')](respondWithFilteredResult(_0x29adc3,_0x20c606))['catch'](handleError(_0x29adc3,null));};exports[_0xfcb0('0xe1')]=function(_0x37f450,_0x1cf671){var _0x34141a={};var _0x3ac006={};var _0x4b5880;var _0x418079;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x37f450[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x1cf671,null))[_0xfcb0('0x1d')](function(_0x2f1e5d){if(_0x2f1e5d){_0x4b5880=_0x2f1e5d;_0x3ac006[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0xe2')]['rawAttributes']);_0x3ac006[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x37f450['query']);_0x3ac006['filters']=_[_0xfcb0('0xcf')](_0x3ac006[_0xfcb0('0xcb')],_0x3ac006[_0xfcb0('0x39')]);_0x34141a[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x3ac006['model'],qs[_0xfcb0('0xd0')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x34141a[_0xfcb0('0x3d')]=_0x34141a[_0xfcb0('0x3d')]['length']?_0x34141a[_0xfcb0('0x3d')]:_0x3ac006['model'];_0x34141a[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x34141a['where']=qs['filters'](_[_0xfcb0('0xd3')](_0x37f450[_0xfcb0('0x39')],_0x3ac006[_0xfcb0('0xce')]));if(_0x37f450[_0xfcb0('0x39')]['filter']){_0x34141a[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x34141a['where'],{'$or':_[_0xfcb0('0x29')](_0x34141a[_0xfcb0('0x3d')],function(_0x2c900a){var _0x430d06={};_0x430d06[_0x2c900a]={'$like':'%'+_0x37f450[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x430d06;})});}_0x34141a=_[_0xfcb0('0x4e')]({},_0x34141a,_0x37f450['options']);return _0x4b5880[_0xfcb0('0xe1')](_0x34141a);}})[_0xfcb0('0x1d')](function(_0x54d9c4){if(_0x54d9c4){_0x418079=_0x54d9c4[_0xfcb0('0x42')];if(!_0x37f450[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x34141a['limit']=qs[_0xfcb0('0x18')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x34141a['offset']=qs[_0xfcb0('0x15')](_0x37f450[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x4b5880['getSmsInteractions'](_0x34141a);}})[_0xfcb0('0x1d')](function(_0x3f4349){if(_0x3f4349){return _0x3f4349?{'count':_0x418079,'rows':_0x3f4349}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x1cf671,null))['catch'](handleError(_0x1cf671,null));};exports[_0xfcb0('0xe3')]=function(_0x30c977,_0x4f442e){var _0x454f04={};var _0x82e73b={};var _0x1ecda1;var _0x328b99;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x30c977[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f442e,null))[_0xfcb0('0x1d')](function(_0x665c7){if(_0x665c7){_0x1ecda1=_0x665c7;_0x82e73b['model']=_[_0xfcb0('0xcc')](db[_0xfcb0('0xe4')][_0xfcb0('0x30')]);_0x82e73b[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x30c977[_0xfcb0('0x39')]);_0x82e73b['filters']=_['intersection'](_0x82e73b[_0xfcb0('0xcb')],_0x82e73b[_0xfcb0('0x39')]);_0x454f04[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x82e73b[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x30c977[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x454f04['attributes']=_0x454f04['attributes'][_0xfcb0('0x42')]?_0x454f04['attributes']:_0x82e73b[_0xfcb0('0xcb')];_0x454f04[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x30c977[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x454f04['where']=qs['filters'](_['pick'](_0x30c977[_0xfcb0('0x39')],_0x82e73b['filters']));if(_0x30c977[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x454f04[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x454f04[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x454f04[_0xfcb0('0x3d')],function(_0x3d09c3){var _0x55e014={};_0x55e014[_0x3d09c3]={'$like':'%'+_0x30c977[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x55e014;})});}_0x454f04=_['merge']({},_0x454f04,_0x30c977[_0xfcb0('0x4f')]);return _0x1ecda1[_0xfcb0('0xe3')](_0x454f04);}})[_0xfcb0('0x1d')](function(_0x2bc488){if(_0x2bc488){_0x328b99=_0x2bc488[_0xfcb0('0x42')];if(!_0x30c977[_0xfcb0('0x39')]['hasOwnProperty'](_0xfcb0('0xd5'))){_0x454f04['limit']=qs[_0xfcb0('0x18')](_0x30c977[_0xfcb0('0x39')]['limit']);_0x454f04[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x30c977[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x1ecda1['getFaxInteractions'](_0x454f04);}})[_0xfcb0('0x1d')](function(_0x160a1e){if(_0x160a1e){return _0x160a1e?{'count':_0x328b99,'rows':_0x160a1e}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x4f442e,null))['catch'](handleError(_0x4f442e,null));};exports[_0xfcb0('0xe5')]=function(_0x12bfb7,_0x2c3101){var _0x446ea3={};var _0x3b5e2d={};var _0x333b65;var _0x5bd6cf;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0x12bfb7[_0xfcb0('0x54')]['id']}})['then'](handleEntityNotFound(_0x2c3101,null))[_0xfcb0('0x1d')](function(_0x3e60e6){if(_0x3e60e6){_0x333b65=_0x3e60e6;_0x3b5e2d[_0xfcb0('0xcb')]=_['keys'](db[_0xfcb0('0xe6')][_0xfcb0('0x30')]);_0x3b5e2d[_0xfcb0('0x39')]=_[_0xfcb0('0xcc')](_0x12bfb7[_0xfcb0('0x39')]);_0x3b5e2d[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x3b5e2d[_0xfcb0('0xcb')],_0x3b5e2d['query']);_0x446ea3[_0xfcb0('0x3d')]=_['intersection'](_0x3b5e2d[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x12bfb7[_0xfcb0('0x39')]['fields']));_0x446ea3['attributes']=_0x446ea3[_0xfcb0('0x3d')][_0xfcb0('0x42')]?_0x446ea3[_0xfcb0('0x3d')]:_0x3b5e2d['model'];_0x446ea3[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x12bfb7['query']['sort']);_0x446ea3[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_['pick'](_0x12bfb7[_0xfcb0('0x39')],_0x3b5e2d[_0xfcb0('0xce')]));if(_0x12bfb7['query'][_0xfcb0('0x27')]){_0x446ea3[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x446ea3[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x446ea3[_0xfcb0('0x3d')],function(_0x587b0b){var _0x473587={};_0x473587[_0x587b0b]={'$like':'%'+_0x12bfb7[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x473587;})});}_0x446ea3=_[_0xfcb0('0x4e')]({},_0x446ea3,_0x12bfb7[_0xfcb0('0x4f')]);return _0x333b65['getWhatsappInteractions'](_0x446ea3);}})[_0xfcb0('0x1d')](function(_0x202f62){if(_0x202f62){_0x5bd6cf=_0x202f62[_0xfcb0('0x42')];if(!_0x12bfb7['query'][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x446ea3['limit']=qs[_0xfcb0('0x18')](_0x12bfb7['query'][_0xfcb0('0x18')]);_0x446ea3[_0xfcb0('0x15')]=qs[_0xfcb0('0x15')](_0x12bfb7['query'][_0xfcb0('0x15')]);}return _0x333b65['getWhatsappInteractions'](_0x446ea3);}})[_0xfcb0('0x1d')](function(_0x20778e){if(_0x20778e){return _0x20778e?{'count':_0x5bd6cf,'rows':_0x20778e}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x2c3101,null))['catch'](handleError(_0x2c3101,null));};exports['login']=function(_0x5327e8,_0x23bc98,_0x3d4279){var _0x331173;var _0x32988e;var _0x1c2ab3;var _0x415748=!_['isNil'](_0x5327e8[_0xfcb0('0x54')]['id'])?_0x5327e8[_0xfcb0('0x54')]['id']:!_[_0xfcb0('0x5d')](_0x5327e8['user']['id'])?_0x5327e8[_0xfcb0('0x24')]['id']:null;return db['User'][_0xfcb0('0x50')]({'where':{'id':_0x415748,'role':{'$or':[_0xfcb0('0x73'),_0xfcb0('0x24'),_0xfcb0('0x1f')]}},'attributes':['id',_0xfcb0('0x2b'),'phone',_0xfcb0('0xe7'),_0xfcb0('0x1e'),_0xfcb0('0x58'),_0xfcb0('0x98')]})[_0xfcb0('0x1d')](function(_0x57aba4){if(_0x57aba4){if(_0x57aba4[_0xfcb0('0x1e')]===_0xfcb0('0x1f')){_0x331173=_0x57aba4;if(_0x5327e8[_0xfcb0('0x53')]['interface']){_0x1c2ab3=util[_0xfcb0('0xbf')](_0xfcb0('0xe8'),_0x331173[_0x5327e8['body'][_0xfcb0('0xe9')]]);}else if(_0x5327e8['body'][_0xfcb0('0xea')]){_0x1c2ab3=util[_0xfcb0('0xbf')](_0xfcb0('0xa3'),_0x5327e8['body'][_0xfcb0('0xea')]);}else{_0x1c2ab3=util[_0xfcb0('0xbf')](_0xfcb0('0xa3'),_0x331173[_0xfcb0('0x2b')]);}socket['to'](util[_0xfcb0('0xbf')](_0xfcb0('0xeb'),_0x331173['name']))[_0xfcb0('0x20')](_0xfcb0('0xec'),{'user':{'id':_0x331173['id'],'name':_0x331173[_0xfcb0('0x2b')]},'ip':_0x5327e8[_0xfcb0('0xed')][_0xfcb0('0xee')]||_0x5327e8[_0xfcb0('0xef')][_0xfcb0('0xf0')]||_0x5327e8['socket'][_0xfcb0('0xf0')]||_0x5327e8[_0xfcb0('0xef')][_0xfcb0('0xf1')]['remoteAddress']});return db[_0xfcb0('0xa5')][_0xfcb0('0x2d')]({'where':{'membername':_0x331173[_0xfcb0('0x2b')]},'individualHooks':!![]});}}else{throw new db[(_0xfcb0('0x8b'))][(_0xfcb0('0x88'))](_0xfcb0('0xf2'));}})['then'](function(){if(_0x331173){return _0x331173[_0xfcb0('0xf3')]({'raw':!![]});}})['then'](function(_0x2f7cf4){if(_0x331173){if(_0x2f7cf4){_0x32988e=_0x2f7cf4;if(_0x32988e['length']){var _0x2af211=_0x32988e[_0xfcb0('0x29')](function(_0x6569e3){var _0x40fa6c={'membername':_0x331173[_0xfcb0('0x2b')],'UserId':_0x331173['id'],'queue_name':_0x6569e3[_0xfcb0('0x2b')],'VoiceQueueId':_0x6569e3['id'],'interface':_0x1c2ab3,'paused':_0x331173[_0xfcb0('0x98')]||![],'penalty':_0x6569e3[_0xfcb0('0xf4')]||0x0};return db[_0xfcb0('0xa5')][_0xfcb0('0xa6')](_0x40fa6c);});return Promise['all'](_0x2af211);}}}})[_0xfcb0('0x1d')](function(){if(_0x331173){return db[_0xfcb0('0xf5')][_0xfcb0('0x3e')]({'where':{'membername':_0x331173[_0xfcb0('0x2b')],'exitAt':null}});}})[_0xfcb0('0x1d')](function(_0x430e81){if(_0x331173){var _0x37da81=[];_0x430e81[_0xfcb0('0xf6')](function(_0x20cb7b){_0x37da81[_0xfcb0('0x43')](_0x20cb7b[_0xfcb0('0x1c')]({'exitAt':moment()['format'](_0xfcb0('0xf7'))}));});return Promise['all'](_0x37da81);}})['then'](function(){if(_0x331173){var _0x24721b=[];var _0x569960=[];var _0x440906=utils[_0xfcb0('0xf8')]();var _0x144048={'membername':_0x331173['name'],'interface':_0x1c2ab3,'enterAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7')),'role':_0x331173[_0xfcb0('0x1e')],'internal':_0x331173[_0xfcb0('0x58')]};_0x440906[_0xfcb0('0xf6')](function(_0x57cfe2){_0x24721b[_0xfcb0('0x43')](_[_0xfcb0('0x4e')]({'channel':_0x57cfe2,'type':'LOGIN','data1':_0x5327e8[_0xfcb0('0x53')]['device'],'data2':_0x1c2ab3},_0x144048));if(_0x331173[_0xfcb0('0x98')]){_0x569960[_0xfcb0('0x43')](_[_0xfcb0('0x4e')]({'channel':_0x57cfe2,'type':'PAUSE','data1':_0xfcb0('0xf9')},_0x144048));}});return db['MemberReport'][_0xfcb0('0x7e')](_0x24721b[_0xfcb0('0xbd')](_0x569960),{'individualHooks':!![]});}})[_0xfcb0('0x1d')](function(){if(_0x331173){return _0x331173['update']({'online':!![],'lastLoginAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7')),'voicePause':_0x331173[_0xfcb0('0x98')]||![],'mailPause':_0x331173['loginInPause']||![],'chatPause':_0x331173['loginInPause']||![],'faxPause':_0x331173[_0xfcb0('0x98')]||![],'smsPause':_0x331173[_0xfcb0('0x98')]||![],'openchannelPause':_0x331173['loginInPause']||![],'whatsappPause':_0x331173[_0xfcb0('0x98')]||![],'pauseType':_0x331173['loginInPause']?_0xfcb0('0xf9'):null,'interface':_0x1c2ab3,'lastPauseAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7'))});}})['then'](function(_0x43e08f){if(_0x5327e8['isMiddleware']){return _0x3d4279();}else{return Promise[_0xfcb0('0xfa')](_0x43e08f)[_0xfcb0('0x1d')](respondWithResult(_0x23bc98,null));}})[_0xfcb0('0x52')](handleError(_0x23bc98,null));};exports[_0xfcb0('0xfb')]=function(_0x234952,_0x53d716){var _0xdda93;return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x234952[_0xfcb0('0x54')]['id'],'role':_0xfcb0('0x1f')},'attributes':['id',_0xfcb0('0x2b'),'role']})[_0xfcb0('0x1d')](handleEntityNotFound(_0x53d716,null))['then'](function(_0x89f4b2){if(_0x89f4b2){_0xdda93=_0x89f4b2;return db[_0xfcb0('0xa5')]['destroy']({'where':{'membername':_0xdda93[_0xfcb0('0x2b')]},'individualHooks':!![]});}})['then'](function(){return db[_0xfcb0('0xf5')][_0xfcb0('0x3e')]({'where':{'membername':_0xdda93['name'],'exitAt':null}});})[_0xfcb0('0x1d')](function(_0x140bd2){var _0x310f97=[];_0x140bd2[_0xfcb0('0xf6')](function(_0x14c7ef){_0x310f97[_0xfcb0('0x43')](_0x14c7ef[_0xfcb0('0x1c')]({'exitAt':moment()[_0xfcb0('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x310f97);})[_0xfcb0('0x1d')](function(){return _0xdda93[_0xfcb0('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfcb0('0x1d')](respondWithResult(_0x53d716,null))[_0xfcb0('0x52')](handleError(_0x53d716,null));};exports[_0xfcb0('0xfc')]=function(_0x2b7469,_0x14d485){var _0x28f313;return db[_0xfcb0('0xa5')][_0xfcb0('0x1c')]({'paused':0x1},{'where':{'UserId':_0x2b7469[_0xfcb0('0x54')]['id']},'individualHooks':!![]})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x2f')][_0xfcb0('0x50')]({'where':{'id':_0x2b7469[_0xfcb0('0x54')]['id'],'role':_0xfcb0('0x1f')},'attributes':['id',_0xfcb0('0x2b'),'role','internal',_0xfcb0('0xe9'),_0xfcb0('0x97')]});})[_0xfcb0('0x1d')](handleEntityNotFound(_0x14d485,null))['then'](function(_0x224f87){if(_0x224f87){_0x28f313=_0x224f87;return db[_0xfcb0('0xf5')][_0xfcb0('0x3e')]({'where':{'membername':_0x28f313['name'],'type':'PAUSE','exitAt':null}});}})[_0xfcb0('0x1d')](function(_0x408adc){if(_0x408adc['length']){var _0x448132=moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7'));for(var _0x29dcb5=0x0,_0x1fa723=_0x408adc['length'];_0x29dcb5<_0x1fa723;_0x29dcb5++){_0x408adc[_0x29dcb5][_0xfcb0('0xfd')]({'exitAt':_0x448132});}}})[_0xfcb0('0x1d')](function(){var _0xea84a6=[];var _0x3c1b86=utils[_0xfcb0('0xf8')]();_0x3c1b86[_0xfcb0('0xf6')](function(_0x38e46d){_0xea84a6[_0xfcb0('0x43')]({'channel':_0x38e46d,'membername':_0x28f313[_0xfcb0('0x2b')],'interface':_[_0xfcb0('0x5d')](_0x28f313[_0xfcb0('0xe9')])?util[_0xfcb0('0xbf')]('SIP/%s',_0x28f313[_0xfcb0('0x2b')]):_0x28f313[_0xfcb0('0xe9')],'type':_0xfcb0('0xfe'),'enterAt':moment()[_0xfcb0('0xbf')](_0xfcb0('0xf7')),'data1':_0x2b7469[_0xfcb0('0x53')][_0xfcb0('0x31')]||_0xfcb0('0xff'),'role':_0x28f313[_0xfcb0('0x1e')],'internal':_0x28f313[_0xfcb0('0x58')]});});return db['MemberReport'][_0xfcb0('0x7e')](_0xea84a6,{'individualHooks':!![]});})[_0xfcb0('0x1d')](function(){return _0x28f313['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2b7469[_0xfcb0('0x53')][_0xfcb0('0x31')]||_0xfcb0('0xff'),'lastPauseAt':moment()[_0xfcb0('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x14d485,null))[_0xfcb0('0x52')](handleError(_0x14d485,null));};exports[_0xfcb0('0x100')]=function(_0x2f4804,_0x33a208){if(_0x2f4804['body'][_0xfcb0('0x96')]&&!utils[_0xfcb0('0x9a')](_0x2f4804[_0xfcb0('0x53')]['channel'])){throw new APIBadRequestError(util[_0xfcb0('0xbf')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2f4804[_0xfcb0('0x53')]['channel']));}return db['User']['find']({'where':{'id':_0x2f4804[_0xfcb0('0x54')]['id']},'attributes':['id',_0xfcb0('0x2b'),_0xfcb0('0x1e'),_0xfcb0('0x58'),_0xfcb0('0xe9'),_0xfcb0('0x97'),'voicePause','mailPause','chatPause',_0xfcb0('0x101'),_0xfcb0('0x102'),_0xfcb0('0x103'),_0xfcb0('0x104'),_0xfcb0('0x105'),_0xfcb0('0x106')]})[_0xfcb0('0x1d')](function(_0x338bba){if(!_0x338bba){throw new APINotFoundError(util[_0xfcb0('0xbf')](_0xfcb0('0xc0'),_0x2f4804[_0xfcb0('0x54')]['id']));}return _0x338bba[_0xfcb0('0x100')](_0x2f4804[_0xfcb0('0x53')][_0xfcb0('0x96')]);})[_0xfcb0('0x1d')](respondWithResult(_0x33a208,null))['catch'](APIHandleError(_0x33a208));};exports[_0xfcb0('0x107')]=function(_0x407805,_0x304819){var _0x463dd6={};var _0x592f68={};var _0x19cb34;var _0x1f698e;return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x407805[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x304819,null))['then'](function(_0x4467d0){if(_0x4467d0){_0x19cb34=_0x4467d0;_0x592f68[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db['Team'][_0xfcb0('0x30')]);_0x592f68['query']=_['keys'](_0x407805['query']);_0x592f68[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x592f68[_0xfcb0('0xcb')],_0x592f68[_0xfcb0('0x39')]);_0x463dd6['attributes']=_['intersection'](_0x592f68[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x407805[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x463dd6[_0xfcb0('0x3d')]=_0x463dd6[_0xfcb0('0x3d')]['length']?_0x463dd6[_0xfcb0('0x3d')]:_0x592f68[_0xfcb0('0xcb')];_0x463dd6[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x407805[_0xfcb0('0x39')]['sort']);_0x463dd6['where']=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x407805[_0xfcb0('0x39')],_0x592f68['filters']));if(_0x407805[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x463dd6[_0xfcb0('0x38')]=_[_0xfcb0('0x4e')](_0x463dd6[_0xfcb0('0x38')],{'$or':_['map'](_0x463dd6[_0xfcb0('0x3d')],function(_0x272191){var _0x29c127={};_0x29c127[_0x272191]={'$like':'%'+_0x407805['query']['filter']+'%'};return _0x29c127;})});}_0x463dd6=_[_0xfcb0('0x4e')]({},_0x463dd6,_0x407805[_0xfcb0('0x4f')]);return _0x19cb34[_0xfcb0('0x107')](_0x463dd6);}})[_0xfcb0('0x1d')](function(_0x33b4a5){if(_0x33b4a5){_0x1f698e=_0x33b4a5[_0xfcb0('0x42')];if(!_0x407805[_0xfcb0('0x39')][_0xfcb0('0xc2')](_0xfcb0('0xd5'))){_0x463dd6[_0xfcb0('0x18')]=qs['limit'](_0x407805['query'][_0xfcb0('0x18')]);_0x463dd6[_0xfcb0('0x15')]=qs['offset'](_0x407805[_0xfcb0('0x39')][_0xfcb0('0x15')]);}return _0x19cb34['getTeams'](_0x463dd6);}})[_0xfcb0('0x1d')](function(_0x373fee){if(_0x373fee){return _0x373fee?{'count':_0x1f698e,'rows':_0x373fee}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x304819,null))[_0xfcb0('0x52')](handleError(_0x304819,null));};exports['addTeams']=function(_0x5a625d,_0x5d972){var _0x477fee=_0x5a625d[_0xfcb0('0x54')]['id'];var _0x2c9a0e=_0x5a625d[_0xfcb0('0x53')]?_0x5a625d['body'][_0xfcb0('0x56')]:null;var _0x1f7fa3=[];return Promise[_0xfcb0('0xfa')]()[_0xfcb0('0x1d')](function(){if(!_0x2c9a0e)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x477fee}});})[_0xfcb0('0x1d')](function(_0x257c41){if(!_0x257c41)throw new APINotFoundError(util[_0xfcb0('0xbf')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5a625d[_0xfcb0('0x54')]['id']));return db[_0xfcb0('0x5f')][_0xfcb0('0x108')](function(_0x29812e){return _0x257c41[_0xfcb0('0x109')](_0x2c9a0e,{'transaction':_0x29812e})['then'](function(){return db[_0xfcb0('0x10a')][_0xfcb0('0x3e')]({'where':{'id':{'$in':_0x2c9a0e}}});})[_0xfcb0('0x1d')](function(_0x3448e4){var _0x12d43e=_[_0xfcb0('0x29')](_0x3448e4,function(_0x1aaf7b){return _0x1aaf7b['getAssociatedQueues']();});return Promise[_0xfcb0('0x4a')](_0x12d43e);})['then'](function(_0xf87751){_0x1f7fa3=_[_0xfcb0('0x10b')](_0xf87751);var _0x2838b7=_[_0xfcb0('0x29')](_0x1f7fa3,function(_0x4eec0d){return _0x4eec0d['addAgent'](_0x257c41['id'],{'transaction':_0x29812e});});return Promise[_0xfcb0('0x4a')](_0x2838b7);})['then'](function(){if(!_0x257c41[_0xfcb0('0x97')])return;var _0x31bbe3=_[_0xfcb0('0x27')](_0x1f7fa3,function(_0x4ef7c9){return _0x4ef7c9[_0xfcb0('0x10c')](_0xfcb0('0x96'))===_0xfcb0('0x10d');});var _0x14534c=_[_0xfcb0('0x29')](_0x31bbe3,function(_0x157f92){return db[_0xfcb0('0xa5')]['upsert']({'membername':_0x257c41['name'],'UserId':_0x257c41['id'],'queue_name':_0x157f92[_0xfcb0('0x2b')],'VoiceQueueId':_0x157f92['id'],'interface':_[_0xfcb0('0x5d')](_0x257c41[_0xfcb0('0xe9')])?util[_0xfcb0('0xbf')](_0xfcb0('0xa3'),_0x257c41[_0xfcb0('0x2b')]):_0x257c41[_0xfcb0('0xe9')],'paused':_0x257c41[_0xfcb0('0x99')]||![],'penalty':_0x257c41[_0xfcb0('0xa4')]},{'transaction':_0x29812e});});return Promise[_0xfcb0('0x4a')](_0x14534c);})['then'](function(){return db[_0xfcb0('0x10e')][_0xfcb0('0x3e')]({'where':{'teamId':{'$in':_0x2c9a0e}}});})[_0xfcb0('0x1d')](function(_0x554564){var _0x17227e=_['map'](_0x554564,function(_0x4cea52){return db['UserVoicePrefix'][_0xfcb0('0x78')]({'UserId':_0x257c41['id'],'VoicePrefixId':_0x4cea52['VoicePrefixId']},{'transaction':_0x29812e});});return Promise['all'](_0x17227e);});});})[_0xfcb0('0x1d')](function(){for(var _0x47f3fd=0x0;_0x47f3fd<_0x1f7fa3[_0xfcb0('0x42')];_0x47f3fd++){var _0x1e5c86=_0x1f7fa3[_0x47f3fd]['getDataValue'](_0xfcb0('0x96'));var _0x46c5e5=_0x1e5c86+_0xfcb0('0xaa');socket[_0xfcb0('0x20')](_0xfcb0('0x24')+_0x1e5c86+'Queue:save',{'UserId':_0x477fee,['queueField']:_0x1f7fa3[_0x47f3fd]['id']});}})['then'](respondWithStatusCode(_0x5d972,null))[_0xfcb0('0x52')](APIHandleError(_0x5d972));};exports[_0xfcb0('0x10f')]=function(_0x431e32,_0x211690){var _0x55e6bf=_0x431e32['params']['id'];var _0x7a0203=null;if(_0x431e32['query']['ids']){_0x7a0203=_[_0xfcb0('0x110')](_0x431e32[_0xfcb0('0x39')][_0xfcb0('0x56')])?_0x431e32[_0xfcb0('0x39')]['ids']:[_0x431e32[_0xfcb0('0x39')][_0xfcb0('0x56')]];}var _0x287d1f=[];return Promise[_0xfcb0('0xfa')]()[_0xfcb0('0x1d')](function(){if(!_0x7a0203)throw new APIBadRequestError(_0xfcb0('0x111'));})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x2f')][_0xfcb0('0x90')]({'where':{'id':_0x55e6bf}});})[_0xfcb0('0x1d')](function(_0x142886){if(!_0x142886)throw new APINotFoundError(util[_0xfcb0('0xbf')](_0xfcb0('0xc0'),_0x431e32[_0xfcb0('0x54')]['id']));return db[_0xfcb0('0x5f')]['transaction'](function(_0x2ecb96){return _0x142886[_0xfcb0('0x10f')](_0x7a0203,{'transaction':_0x2ecb96})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x10a')][_0xfcb0('0x3e')]({'where':{'id':{'$in':_0x7a0203}}});})[_0xfcb0('0x1d')](function(_0x5bad5a){var _0x3a7ef4=_['map'](_0x5bad5a,function(_0x506289){return _0x506289[_0xfcb0('0x112')]();});return Promise[_0xfcb0('0x4a')](_0x3a7ef4);})[_0xfcb0('0x1d')](function(_0x392a06){_0x287d1f=_[_0xfcb0('0x10b')](_0x392a06);var _0x36294b=_['map'](_0x287d1f,function(_0x557ef1){return _0x557ef1[_0xfcb0('0x113')](_0x142886['id'],{'transaction':_0x2ecb96});});return Promise[_0xfcb0('0x4a')](_0x36294b);})[_0xfcb0('0x1d')](function(){if(!_0x142886[_0xfcb0('0x97')])return;var _0x232f3=_[_0xfcb0('0x27')](_0x287d1f,function(_0x5a15c0){return _0x5a15c0[_0xfcb0('0x10c')]('channel')==='Voice';});var _0x2ba8d9=_[_0xfcb0('0x29')](_0x232f3,function(_0x22b9c3){return db[_0xfcb0('0xa5')]['destroy']({'where':{'VoiceQueueId':_0x22b9c3['id'],'UserId':_0x142886['id']},'transaction':_0x2ecb96});});return Promise['all'](_0x2ba8d9);})[_0xfcb0('0x1d')](function(){return db[_0xfcb0('0x10e')][_0xfcb0('0x3e')]({'where':{'teamId':{'$in':_0x7a0203}}});})[_0xfcb0('0x1d')](function(_0xe36668){var _0x111085=_[_0xfcb0('0x29')](_0xe36668,function(_0x4cfaff){return db[_0xfcb0('0x114')]['destroy']({'where':{'UserId':_0x142886['id'],'VoicePrefixId':_0x4cfaff[_0xfcb0('0x115')]}},{'transaction':_0x2ecb96});});return Promise['all'](_0x111085);});});})['then'](function(){for(var _0x2b24ac=0x0;_0x2b24ac<_0x287d1f[_0xfcb0('0x42')];_0x2b24ac++){var _0x106463=_0x287d1f[_0x2b24ac][_0xfcb0('0x10c')](_0xfcb0('0x96'));var _0x1b137b=_0x106463+_0xfcb0('0xaa');socket[_0xfcb0('0x20')](_0xfcb0('0x24')+_0x106463+_0xfcb0('0xab'),{'UserId':_0x55e6bf,['queueField']:_0x287d1f[_0x2b24ac]['id']});}})['then'](respondWithStatusCode(_0x211690,null))[_0xfcb0('0x52')](APIHandleError(_0x211690));};exports['getLists']=function(_0x30dee9,_0x17fcb8){var _0x40730f={};var _0x36bfe8={};var _0x54f06e;var _0x2dd500;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0x30dee9['params']['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x17fcb8,null))[_0xfcb0('0x1d')](function(_0x462fc1){if(_0x462fc1){_0x54f06e=_0x462fc1;_0x36bfe8['model']=_[_0xfcb0('0xcc')](db['CmList']['rawAttributes']);_0x36bfe8[_0xfcb0('0x39')]=_['keys'](_0x30dee9[_0xfcb0('0x39')]);_0x36bfe8[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x36bfe8[_0xfcb0('0xcb')],_0x36bfe8[_0xfcb0('0x39')]);_0x40730f['attributes']=_[_0xfcb0('0xcf')](_0x36bfe8[_0xfcb0('0xcb')],qs[_0xfcb0('0xd0')](_0x30dee9['query'][_0xfcb0('0xd0')]));_0x40730f[_0xfcb0('0x3d')]=_0x40730f['attributes'][_0xfcb0('0x42')]?_0x40730f[_0xfcb0('0x3d')]:_0x36bfe8['model'];_0x40730f[_0xfcb0('0xd1')]=qs[_0xfcb0('0xd2')](_0x30dee9[_0xfcb0('0x39')]['sort']);_0x40730f[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x30dee9['query'],_0x36bfe8[_0xfcb0('0xce')]));if(_0x30dee9['query']['filter']){_0x40730f['where']=_[_0xfcb0('0x4e')](_0x40730f[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x40730f[_0xfcb0('0x3d')],function(_0x88bd33){var _0x2eec8f={};_0x2eec8f[_0x88bd33]={'$like':'%'+_0x30dee9[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x2eec8f;})});}_0x40730f=_['merge']({},_0x40730f,_0x30dee9[_0xfcb0('0x4f')]);return _0x54f06e['getLists'](_0x40730f);}})[_0xfcb0('0x1d')](function(_0x30e1c6){if(_0x30e1c6){_0x2dd500=_0x30e1c6[_0xfcb0('0x42')];if(!_0x30dee9[_0xfcb0('0x39')][_0xfcb0('0xc2')]('nolimit')){_0x40730f[_0xfcb0('0x18')]=qs[_0xfcb0('0x18')](_0x30dee9[_0xfcb0('0x39')][_0xfcb0('0x18')]);_0x40730f['offset']=qs[_0xfcb0('0x15')](_0x30dee9[_0xfcb0('0x39')]['offset']);}return _0x54f06e[_0xfcb0('0x116')](_0x40730f);}})[_0xfcb0('0x1d')](function(_0x2fb6e9){if(_0x2fb6e9){return _0x2fb6e9?{'count':_0x2dd500,'rows':_0x2fb6e9}:null;}})[_0xfcb0('0x1d')](respondWithResult(_0x17fcb8,null))[_0xfcb0('0x52')](handleError(_0x17fcb8,null));};exports[_0xfcb0('0x117')]=function(_0x3691f2,_0x4a3c3e){var _0x3bc22c={};var _0x3a26f5={};var _0x1a116d;return db['User'][_0xfcb0('0x90')]({'where':{'id':_0x3691f2[_0xfcb0('0x54')]['id']}})[_0xfcb0('0x1d')](handleEntityNotFound(_0x4a3c3e,null))[_0xfcb0('0x1d')](function(_0x19129f){if(_0x19129f){_0x1a116d=_0x19129f;_0x3a26f5[_0xfcb0('0xcb')]=_[_0xfcb0('0xcc')](db[_0xfcb0('0x2f')][_0xfcb0('0x30')]);_0x3a26f5['query']=_[_0xfcb0('0xcc')](_0x3691f2[_0xfcb0('0x39')]);_0x3a26f5[_0xfcb0('0xce')]=_[_0xfcb0('0xcf')](_0x3a26f5[_0xfcb0('0xcb')],_0x3a26f5['query']);_0x3bc22c[_0xfcb0('0x3d')]=_[_0xfcb0('0xcf')](_0x3a26f5['model'],qs[_0xfcb0('0xd0')](_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0xd0')]));_0x3bc22c[_0xfcb0('0x3d')]=_0x3bc22c[_0xfcb0('0x3d')]['length']?_0x3bc22c[_0xfcb0('0x3d')]:_0x3a26f5[_0xfcb0('0xcb')];_0x3bc22c['order']=qs[_0xfcb0('0xd2')](_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0xd2')]);_0x3bc22c[_0xfcb0('0x38')]=qs[_0xfcb0('0xce')](_[_0xfcb0('0xd3')](_0x3691f2[_0xfcb0('0x39')],_0x3a26f5['filters']));if(_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0x27')]){_0x3bc22c['where']=_[_0xfcb0('0x4e')](_0x3bc22c[_0xfcb0('0x38')],{'$or':_[_0xfcb0('0x29')](_0x3bc22c['attributes'],function(_0x3d48d5){var _0x40a1bc={};_0x40a1bc[_0x3d48d5]={'$like':'%'+_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0x27')]+'%'};return _0x40a1bc;})});}_0x3bc22c[_0xfcb0('0xcb')]=db[_0xfcb0('0x2f')];_0x3bc22c['as']=_0xfcb0('0x7a');_0x3bc22c=_['merge']({},_0x3bc22c,_0x3691f2[_0xfcb0('0x4f')]);return _0x1a116d[_0xfcb0('0xf3')]({'include':[_0x3bc22c]});}})[_0xfcb0('0x1d')](function(_0x1da6e5){if(_0x1da6e5){var _0x48bf0b={},_0x28b95c=[];for(var _0x1009de=0x0;_0x1009de<_0x1da6e5[_0xfcb0('0x42')];_0x1009de+=0x1){for(var _0x373e17=0x0,_0x5383fb;_0x373e17<_0x1da6e5[_0x1009de]['Agents'][_0xfcb0('0x42')];_0x373e17+=0x1){_0x5383fb=_0x1da6e5[_0x1009de][_0xfcb0('0x7a')][_0x373e17][_0xfcb0('0x22')]({'plain':!![]});_0x48bf0b[_0x5383fb['id']]=_0x5383fb;}}_0x48bf0b=_[_0xfcb0('0x118')](_0x48bf0b);for(var _0x4c6dd0=qs[_0xfcb0('0x15')](_0x3691f2[_0xfcb0('0x39')][_0xfcb0('0x15')]);_0x4c6dd0<_0x48bf0b[_0xfcb0('0x42')]&&_0x28b95c[_0xfcb0('0x42')]=_0x42d3a0){_0x48fb55=_0x42d3a0;_0x14c3f4=0xc8;}else{_0x14c3f4=0xce;}_0x469b4b[_0x74aa('0x1b')](_0x14c3f4);return _0x469b4b[_0x74aa('0x1c')]('Content-Range',_0x5816e8+'-'+_0x48fb55+'/'+_0x42d3a0)[_0x74aa('0x16')](_0x2a82e3);}return null;};}function saveUpdates(_0x1c3d3b){return function(_0x3f94b0){if(_0x3f94b0){return _0x3f94b0['update'](_0x1c3d3b)[_0x74aa('0x1d')](function(_0x340d11){if(_0x340d11['role']===_0x74aa('0x1e')){socket[_0x74aa('0x1f')](_0x74aa('0x20')+_0x340d11['id'],_0x340d11);}return _0x340d11;});}return null;};}function removeEntity(_0x5c5d37){return function(_0x5dfe46){if(_0x5dfe46){return _0x5dfe46['destroy']()[_0x74aa('0x1d')](function(){var _0x67bb6=_0x5dfe46['get']({'plain':!![]});if(_0x67bb6['role']===_0x74aa('0x21'))return;var _0x5e180d=[{'name':'Users','value':_0x74aa('0x22'),'ignore':!![]},{'name':'Agents','value':_0x74aa('0x1e'),'ignore':![]},{'name':'Telephones','value':_0x74aa('0x23'),'ignore':![]}];var _0x310579=_(_0x5e180d)['filter'](_0x74aa('0x24'))[_0x74aa('0x25')](_0x74aa('0x26'))[_0x74aa('0x26')]();if(_['includes'](_0x310579,_0x67bb6[_0x74aa('0x27')])){return;}var _0x4b6a8e=_['find'](_0x5e180d,[_0x74aa('0x26'),_0x67bb6[_0x74aa('0x27')]])['name'];return db[_0x74aa('0x28')][_0x74aa('0x29')]({'where':{'type':_0x4b6a8e,'resourceId':_0x67bb6['id']}})[_0x74aa('0x1d')](function(){return _0x5dfe46;});})[_0x74aa('0x1d')](function(){_0x5c5d37[_0x74aa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x131ce2){return function(_0x516184){if(!_0x516184){_0x131ce2[_0x74aa('0x2a')](0x194);}return _0x516184;};}function handleError(_0x5db9b7,_0x1ee9f3){_0x1ee9f3=_0x1ee9f3||0x1f4;return function(_0x448bd2){logger[_0x74aa('0x2b')](_0x448bd2['stack']);if(_0x448bd2['name']){delete _0x448bd2[_0x74aa('0x2c')];}_0x5db9b7[_0x74aa('0x1b')](_0x1ee9f3)[_0x74aa('0x2d')](_0x448bd2);};}function getUserAttributes(){return _(db[_0x74aa('0x2e')][_0x74aa('0x2f')])['map'](function(_0x59c92b){return{'name':_0x59c92b[_0x74aa('0x30')],'type':_0x59c92b[_0x74aa('0x31')][_0x74aa('0x32')]};})[_0x74aa('0x33')](function(_0x288943){return!['password',_0x74aa('0x34'),_0x74aa('0x35'),_0x74aa('0x36'),_0x74aa('0x37'),_0x74aa('0x38')][_0x74aa('0x39')](_0x288943[_0x74aa('0x2c')]);})[_0x74aa('0x26')]();}exports['index']=function(_0x221ce6,_0x590733){var _0x576a55={},_0x2f43fe={'count':0x0,'rows':[]};var _0x14a8e4=getUserAttributes();_0x576a55=qs[_0x74aa('0x3a')](_0x14a8e4,_0x221ce6);var _0x5e2563={'where':_0x576a55['where']};return db['User'][_0x74aa('0x1a')](_0x5e2563)[_0x74aa('0x1d')](function(_0x2e0db7){_0x2f43fe[_0x74aa('0x1a')]=_0x2e0db7;if(_0x221ce6[_0x74aa('0x3b')]['includeAll']){_0x576a55[_0x74aa('0x3c')]=[{'all':!![]}];}if(_0x221ce6[_0x74aa('0x3b')][_0x74aa('0x3d')]===_0x74aa('0x3e')){_0x576a55[_0x74aa('0x3c')]=[{'model':db[_0x74aa('0x3f')],'as':_0x74aa('0x3d')}];}if(!_[_0x74aa('0x39')](_0x576a55[_0x74aa('0x40')],'id')){_0x576a55[_0x74aa('0x40')][_0x74aa('0x41')]('id');}return db[_0x74aa('0x2e')][_0x74aa('0x42')](_0x576a55);})[_0x74aa('0x1d')](function(_0x4a22d6){_0x2f43fe[_0x74aa('0x43')]=_0x4a22d6;if(_0x221ce6[_0x74aa('0x3b')][_0x74aa('0x44')]===_0x74aa('0x3e')){var _0x4ba377=[];for(var _0x36cff5=0x0;_0x36cff5<_0x2f43fe['rows'][_0x74aa('0x45')];_0x36cff5++){_0x4ba377['push'](get_open_tabs(_0x74aa('0x46'),_0x2f43fe[_0x74aa('0x43')][_0x36cff5][_0x74aa('0x47')]));_0x4ba377['push'](get_open_tabs(_0x74aa('0x48'),_0x2f43fe[_0x74aa('0x43')][_0x36cff5][_0x74aa('0x47')]));_0x4ba377['push'](get_open_tabs(_0x74aa('0x49'),_0x2f43fe[_0x74aa('0x43')][_0x36cff5][_0x74aa('0x47')]));_0x4ba377['push'](get_open_tabs(_0x74aa('0x4a'),_0x2f43fe[_0x74aa('0x43')][_0x36cff5][_0x74aa('0x47')]));_0x4ba377[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x4b'),_0x2f43fe[_0x74aa('0x43')][_0x36cff5][_0x74aa('0x47')]));_0x4ba377[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x4c'),_0x2f43fe[_0x74aa('0x43')][_0x36cff5][_0x74aa('0x47')]));}return Promise[_0x74aa('0x4d')](_0x4ba377)[_0x74aa('0x1d')](function(){return _0x2f43fe;});}else{return _0x2f43fe;}})[_0x74aa('0x1d')](respondWithFilteredResult(_0x590733,_0x576a55))['catch'](handleError(_0x590733,null));};exports[_0x74aa('0x4e')]=function(_0x64937d,_0x3afab1){var _0x1efc94=getUserAttributes();_0x64937d[_0x74aa('0x3b')]['id']=_0x64937d['params']['id'];var _0x2b2352=qs[_0x74aa('0x3a')](_0x1efc94,_0x64937d);if(_0x64937d[_0x74aa('0x3b')][_0x74aa('0x4f')]){_0x2b2352[_0x74aa('0x3c')]=[{'all':!![]}];}if(_0x64937d[_0x74aa('0x3b')][_0x74aa('0x3d')]===_0x74aa('0x3e')){_0x2b2352[_0x74aa('0x3c')]=[{'model':db['UserSetting'],'as':_0x74aa('0x3d')}];}_0x2b2352=_['merge']({},_0x2b2352,_0x64937d['options']);if(!_[_0x74aa('0x39')](_0x2b2352[_0x74aa('0x40')],'id')){_0x2b2352[_0x74aa('0x40')]['push']('id');}return db[_0x74aa('0x2e')]['find'](_0x2b2352)[_0x74aa('0x1d')](handleEntityNotFound(_0x3afab1,null))[_0x74aa('0x1d')](function(_0x564c79){var _0x5e69f2=[];values=_0x564c79;if(_0x64937d[_0x74aa('0x3b')][_0x74aa('0x44')]===_0x74aa('0x3e')){_0x5e69f2['push'](get_open_tabs(_0x74aa('0x46'),_0x564c79['dataValues']));_0x5e69f2[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x48'),_0x564c79['dataValues']));_0x5e69f2[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x4b'),_0x564c79['dataValues']));_0x5e69f2[_0x74aa('0x41')](get_open_tabs('whatsapp',_0x564c79['dataValues']));_0x5e69f2[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x49'),_0x564c79[_0x74aa('0x47')]));_0x5e69f2['push'](get_open_tabs(_0x74aa('0x4a'),_0x564c79['dataValues']));return Promise[_0x74aa('0x4d')](_0x5e69f2);}else{return values;}})[_0x74aa('0x1d')](function(){return values;})['then'](respondWithResult(_0x3afab1,null))[_0x74aa('0x50')](handleError(_0x3afab1,null));};exports[_0x74aa('0x51')]=function(_0x2604c0,_0x3d9c9f){if(_0x2604c0[_0x74aa('0x52')]['id']){delete _0x2604c0[_0x74aa('0x52')]['id'];}delete _0x2604c0[_0x74aa('0x52')][_0x74aa('0x27')];return db['User'][_0x74aa('0x53')]({'where':{'id':_0x2604c0[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x3d9c9f,null))[_0x74aa('0x1d')](saveUpdates(_0x2604c0['body'],null))[_0x74aa('0x1d')](respondWithResult(_0x3d9c9f,null))[_0x74aa('0x50')](handleError(_0x3d9c9f,null));};exports['describe']=function(_0x73e30d,_0x3e170d){return db[_0x74aa('0x2e')][_0x74aa('0x55')]()['then'](respondWithResult(_0x3e170d,null))[_0x74aa('0x50')](handleError(_0x3e170d,null));};exports[_0x74aa('0x56')]=function(_0x5d7ade,_0x556844){return db[_0x74aa('0x2e')][_0x74aa('0x53')]({'where':{'id':_0x5d7ade[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x556844,null))[_0x74aa('0x1d')](function(_0x3aa9f6){if(_0x3aa9f6){return _0x3aa9f6[_0x74aa('0x56')](_0x5d7ade[_0x74aa('0x52')][_0x74aa('0x57')],_[_0x74aa('0x58')](_0x5d7ade[_0x74aa('0x52')],['ids','id'])||{});}})[_0x74aa('0x1d')](respondWithResult(_0x556844,null))[_0x74aa('0x50')](handleError(_0x556844,null));};function validateUser(_0x2d453d){return new Promise(function(_0x15faf7,_0x4e25a2){if(_0x2d453d['internal'])return _0x15faf7(_0x2d453d);return db[_0x74aa('0x59')][_0x74aa('0x5a')](0x1)[_0x74aa('0x1d')](function(_0x199271){if(_0x199271['securePassword'])authService['validatePasswordPattern'](_0x2d453d['password']);db['User'][_0x74aa('0x5b')](_0x74aa('0x5c'))[_0x74aa('0x1d')](function(_0x4dc141){if(_[_0x74aa('0x5d')](_0x4dc141)){_0x2d453d[_0x74aa('0x5c')]=_0x199271['min_internal']||0x1;return;}if(_['isNil'](_0x199271[_0x74aa('0x5e')])||_0x199271[_0x74aa('0x5e')]===_0x4dc141){_0x2d453d[_0x74aa('0x5c')]=_0x4dc141+0x1;return;}if(_0x199271[_0x74aa('0x5e')]>_0x4dc141){_0x2d453d['internal']=_0x199271[_0x74aa('0x5e')];return;}return db[_0x74aa('0x5f')][_0x74aa('0x3b')](_0x74aa('0x60'),{'type':db[_0x74aa('0x5f')][_0x74aa('0x61')]['SELECT']})[_0x74aa('0x1d')](function(_0x36f48a){if(_0x36f48a&&_0x36f48a[_0x74aa('0x45')]){for(var _0x499930=0x0,_0x3b4e40=_0x36f48a[_0x74aa('0x45')];_0x499930<_0x3b4e40&&_[_0x74aa('0x5d')](_0x2d453d['internal']);_0x499930++){if(_0x199271['min_internal']<=_0x36f48a[_0x499930][_0x74aa('0x62')]){_0x2d453d[_0x74aa('0x5c')]=_0x36f48a[_0x499930][_0x74aa('0x62')];}else if(_0x199271[_0x74aa('0x5e')]>_0x36f48a[_0x499930][_0x74aa('0x62')]&&_0x199271[_0x74aa('0x5e')]<=_0x36f48a[_0x499930]['to']){_0x2d453d[_0x74aa('0x5c')]=_0x199271['min_internal'];}}}if(_[_0x74aa('0x5d')](_0x2d453d['internal'])){_0x2d453d[_0x74aa('0x5c')]=_0x4dc141+0x1;}return _0x15faf7(_0x2d453d);});});})['catch'](function(_0x3cfa24){_0x4e25a2(_0x3cfa24);});});}function updateUser(_0x15292a){return new Promise(function(_0x38ba4c,_0x398907){try{if(_0x15292a[_0x74aa('0x63')]){_0x15292a['mailbox']=_0x15292a['internal'];_0x15292a['VoiceMail']={'mailbox':_0x15292a[_0x74aa('0x5c')],'password':_0x15292a[_0x74aa('0x64')],'fullname':_0x15292a['fullname'],'email':_0x15292a['email']};}if(_0x15292a['role']==='agent'){if(!_0x15292a[_0x74aa('0x65')])_0x15292a[_0x74aa('0x65')]=[_0x74aa('0x66'),'102',_0x74aa('0x67'),_0x74aa('0x68'),_0x74aa('0x69'),_0x74aa('0x6a'),_0x74aa('0x6b'),_0x74aa('0x6c'),'107',_0x74aa('0x6d'),_0x74aa('0x6e'),'100',_0x74aa('0x6f'),_0x74aa('0x70'),'115'];}_0x38ba4c(_0x15292a);}catch(_0x50de0e){_0x398907(_0x50de0e);}});}exports[_0x74aa('0x71')]=function(_0x55664a,_0x33657f){if(_0x55664a[_0x74aa('0x22')][_0x74aa('0x27')]===_0x74aa('0x1e'))throw new Error(_0x74aa('0x72'));if(_0x55664a['body'][_0x74aa('0x27')]==='user'&&_0x55664a['user']['role']!==_0x74aa('0x21')){throw new Error(_0x74aa('0x73'));}if(_0x55664a[_0x74aa('0x52')][_0x74aa('0x27')]===_0x74aa('0x21')&&_0x55664a[_0x74aa('0x22')]['role']!==_0x74aa('0x21')){throw new Error(_0x74aa('0x74'));}return licenseUtil['checkUserLimits']([_0x55664a['body']])[_0x74aa('0x1d')](function(){return validateUser(_0x55664a[_0x74aa('0x52')]);})['then'](function(_0x1a6326){return updateUser(_0x1a6326)[_0x74aa('0x1d')](function(_0x5678f2){if(_0x5678f2[_0x74aa('0x27')]===_0x74aa('0x21')){_0x5678f2[_0x74aa('0x75')]=_0x55664a['user'][_0x74aa('0x75')];delete _0x5678f2[_0x74aa('0x76')];}return _0x5678f2;});})[_0x74aa('0x1d')](function(_0x583009){return db[_0x74aa('0x2e')]['create'](_0x583009,{'include':[{'model':db['VoiceMail'],'as':_0x74aa('0x77')}]});})[_0x74aa('0x1d')](function(_0x5346fd){if(_0x55664a[_0x74aa('0x52')][_0x74aa('0x27')]==='user')return _0x5346fd;if(_0x55664a[_0x74aa('0x22')]['role']!=='user')return _0x5346fd;return db[_0x74aa('0x78')][_0x74aa('0x53')]({'where':{'name':_0x5346fd['role']===_0x74aa('0x1e')?'Agents':_0x74aa('0x79'),'userProfileId':_0x55664a['user']['userProfileId']},'raw':!![]})[_0x74aa('0x1d')](function(_0x34260b){if(!_0x34260b||_0x34260b[_0x74aa('0x7a')]!=0x0)return _0x5346fd;return db[_0x74aa('0x28')]['create']({'name':_0x5346fd['name'],'resourceId':_0x5346fd['id'],'type':_0x34260b[_0x74aa('0x2c')],'sectionId':_0x34260b['id']},{})[_0x74aa('0x1d')](function(){return _0x5346fd;});})[_0x74aa('0x50')](function(_0x1c0e98){logger[_0x74aa('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c0e98);throw _0x1c0e98;});})[_0x74aa('0x1d')](respondWithResult(_0x33657f,0xc9))[_0x74aa('0x50')](handleError(_0x33657f,null));};exports[_0x74aa('0x7b')]=function(_0x2f6375,_0x98befe){var _0x405c2b=_0x2f6375['body'];var _0x4d7b21=[];if(_0x2f6375[_0x74aa('0x22')]['role']===_0x74aa('0x1e'))throw new Error('Unauthorized');if(_[_0x74aa('0x7c')](_0x405c2b,['role',_0x74aa('0x22')])&&_0x2f6375[_0x74aa('0x22')][_0x74aa('0x27')]!==_0x74aa('0x21')){throw new Error(_0x74aa('0x73'));}if(_[_0x74aa('0x7c')](_0x405c2b,['role',_0x74aa('0x21')])&&_0x2f6375[_0x74aa('0x22')][_0x74aa('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x74aa('0x7d')](_0x405c2b)[_0x74aa('0x1d')](function(){return validateUser(_0x405c2b[0x0]);})[_0x74aa('0x1d')](function(){for(var _0x1fe530=0x1;_0x1fe530<_0x405c2b['length'];_0x1fe530++){var _0x404bcd=_0x405c2b[_0x1fe530-0x1]['internal'];if(!_0x405c2b[_0x1fe530]['internal'])_0x405c2b[_0x1fe530][_0x74aa('0x5c')]=_0x404bcd+0x1;_0x4d7b21[_0x74aa('0x41')](validateUser(_0x405c2b[_0x1fe530]));}return Promise[_0x74aa('0x4d')](_0x4d7b21);})[_0x74aa('0x1d')](function(){_0x4d7b21=[];for(var _0x657815=0x0;_0x657815<_0x405c2b['length'];_0x657815++){_0x4d7b21[_0x74aa('0x41')](updateUser(_0x405c2b[_0x657815]));}return Promise[_0x74aa('0x4d')](_0x4d7b21);})[_0x74aa('0x1d')](function(){_0x4d7b21=_0x405c2b['map'](function(_0x6cc464){return db[_0x74aa('0x2e')][_0x74aa('0x71')](_0x6cc464,{'include':[{'model':db[_0x74aa('0x77')],'as':'VoiceMail'}]})['then'](function(_0x3408a9){_0x6cc464['id']=_0x3408a9['id'];return _0x6cc464;});});return Promise[_0x74aa('0x4d')](_0x4d7b21);})['then'](function(_0x185d17){if(_0x2f6375['body'][_0x74aa('0x27')]===_0x74aa('0x22'))return _0x185d17;if(_0x2f6375[_0x74aa('0x22')][_0x74aa('0x27')]!==_0x74aa('0x22'))return _0x185d17;var _0x612662=_[_0x74aa('0x7c')](_0x185d17,function(_0x1cbb14){return _0x1cbb14[_0x74aa('0x27')]===_0x74aa('0x1e')||_0x1cbb14[_0x74aa('0x27')]===_0x74aa('0x23');});if(!_0x612662)return _0x185d17;return db[_0x74aa('0x78')][_0x74aa('0x42')]({'where':{'name':{'$or':[_0x74aa('0x7e'),_0x74aa('0x79')]},'userProfileId':_0x2f6375['user'][_0x74aa('0x76')]},'raw':!![]})['then'](function(_0x534a29){if(_['isEmpty'](_0x534a29)||!_[_0x74aa('0x7c')](_0x534a29,['autoAssociation',0x0]))return _0x185d17;_0x4d7b21=[];var _0x3a5d9b=_(_0x534a29)['map'](function(_0x5f1bd5){if(_0x5f1bd5['autoAssociation']===0x1)return;return _0x5f1bd5['name']===_0x74aa('0x7e')?_0x74aa('0x1e'):_0x74aa('0x23');})[_0x74aa('0x7f')]()[_0x74aa('0x26')]();for(var _0x4d8704=0x0;_0x4d8704<_0x185d17['length'];_0x4d8704++){if(!_['includes'](_0x3a5d9b,_0x185d17[_0x4d8704][_0x74aa('0x27')]))return;var _0x439151=_0x185d17[_0x4d8704][_0x74aa('0x27')]===_0x74aa('0x1e')?'Agents':_0x74aa('0x79');_0x4d7b21[_0x74aa('0x41')](db[_0x74aa('0x28')][_0x74aa('0x71')]({'name':_0x185d17[_0x4d8704][_0x74aa('0x2c')],'resourceId':_0x185d17[_0x4d8704]['id'],'type':_0x439151,'sectionId':_[_0x74aa('0x53')](_0x534a29,[_0x74aa('0x2c'),_0x439151])['id']},{}));}return Promise[_0x74aa('0x4d')](_0x4d7b21);});})['then'](respondWithResult(_0x98befe,0xc9))[_0x74aa('0x50')](handleError(_0x98befe,null));};exports[_0x74aa('0x80')]=function(_0x43c689,_0x4227af){if(_0x43c689['body']['id']){delete _0x43c689[_0x74aa('0x52')]['id'];}return db['User'][_0x74aa('0x53')]({'where':{'id':_0x43c689['params']['id']}})[_0x74aa('0x1d')](function(_0xb701cc){if(!_0xb701cc)return null;if(_0xb701cc['id']===_0x43c689[_0x74aa('0x22')]['id']){if(!_0x43c689[_0x74aa('0x52')][_0x74aa('0x81')]||!_0x43c689[_0x74aa('0x52')][_0x74aa('0x82')]){throw new db[(_0x74aa('0x83'))][(_0x74aa('0x84'))](_0x74aa('0x85'));}if(!_0xb701cc['authenticate'](_0x43c689[_0x74aa('0x52')][_0x74aa('0x81')])){throw new db['Sequelize'][(_0x74aa('0x84'))]('Wrong\x20credentials');}if(_0x43c689['body'][_0x74aa('0x81')]===_0x43c689[_0x74aa('0x52')][_0x74aa('0x82')]){throw new db[(_0x74aa('0x83'))][(_0x74aa('0x84'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x43c689[_0x74aa('0x22')][_0x74aa('0x27')]==='admin'){if(!_0x43c689[_0x74aa('0x52')][_0x74aa('0x82')]){throw new db['Sequelize'][(_0x74aa('0x84'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x43c689[_0x74aa('0x22')][_0x74aa('0x27')]==='user'){if(!_0x43c689[_0x74aa('0x52')]['newPassword']){throw new db[(_0x74aa('0x83'))][(_0x74aa('0x84'))](_0x74aa('0x86'));}if(_0xb701cc[_0x74aa('0x27')]!=='agent'){throw new db['Sequelize'][(_0x74aa('0x84'))]('Unauthorized');}}else{throw new db[(_0x74aa('0x83'))]['ValidationError'](_0x74aa('0x72'));}return _0xb701cc;})[_0x74aa('0x1d')](handleEntityNotFound(_0x4227af,null))[_0x74aa('0x1d')](function(_0x38a185){return db[_0x74aa('0x59')][_0x74aa('0x87')]({'attributes':['id',_0x74aa('0x88'),_0x74aa('0x89'),_0x74aa('0x8a')]})[_0x74aa('0x1d')](function(_0x22e8f3){if(_0x22e8f3[_0x74aa('0x88')])authService[_0x74aa('0x8b')](_0x43c689['body']['newPassword']);if(!_0x22e8f3[_0x74aa('0x89')]||!_0x38a185[_0x74aa('0x35')])return _0x38a185;authService[_0x74aa('0x8c')](_0x43c689[_0x74aa('0x52')]['newPassword'],_0x38a185[_0x74aa('0x35')],_0x22e8f3[_0x74aa('0x8a')]);return _0x38a185;})[_0x74aa('0x1d')](saveUpdates({'password':_0x43c689[_0x74aa('0x52')]['newPassword'],'passwordResetAt':_0x43c689[_0x74aa('0x22')]['id']==_0x43c689[_0x74aa('0x54')]['id']?moment():null,'previousPasswords':authService[_0x74aa('0x8d')](_0x43c689[_0x74aa('0x52')][_0x74aa('0x82')],_0x38a185[_0x74aa('0x35')])},null));})[_0x74aa('0x1d')](respondWithResult(_0x4227af,null))[_0x74aa('0x50')](handleError(_0x4227af,null));};exports[_0x74aa('0x8e')]=function(_0x445994,_0x51b314){var _0x522d4b=_0x445994[_0x74aa('0x52')][_0x74aa('0x8f')];return db[_0x74aa('0x2e')][_0x74aa('0x53')]({'where':{'id':_0x445994[_0x74aa('0x54')]['id']},'attributes':['id',_0x74aa('0x2c'),_0x74aa('0x27'),'online',_0x74aa('0x90'),_0x74aa('0x91'),_0x74aa('0x92')]})[_0x74aa('0x1d')](handleEntityNotFound(_0x51b314,null))[_0x74aa('0x1d')](function(_0x414e68){if(_0x414e68){if(!utils[_0x74aa('0x93')](_0x522d4b)){throw new db['Sequelize']['ValidationError'](_0x74aa('0x94'));}return _0x414e68[_0x74aa('0x95')+_[_0x74aa('0x96')](_0x522d4b['toLowerCase']())+_0x74aa('0x97')](_0x445994[_0x74aa('0x52')][_0x74aa('0x57')],{'penalty':_0x445994[_0x74aa('0x52')][_0x74aa('0x98')]||0x0})[_0x74aa('0x99')](function(_0xdb93a8){for(var _0x1c1e16=0x0;_0x1c1e16<_0x445994['body'][_0x74aa('0x57')][_0x74aa('0x45')];_0x1c1e16+=0x1){var _0x31b0f3={'UserId':Number(_0x445994[_0x74aa('0x54')]['id'])};_0x31b0f3[_[_0x74aa('0x96')](_0x522d4b[_0x74aa('0x9a')]())+_0x74aa('0x9b')]=Number(_0x445994[_0x74aa('0x52')][_0x74aa('0x57')][_0x1c1e16]);socket[_0x74aa('0x1f')](_0x74aa('0x22')+_[_0x74aa('0x96')](_0x522d4b[_0x74aa('0x9a')]())+_0x74aa('0x9c'),_0x31b0f3);}return _0xdb93a8;})[_0x74aa('0x1d')](function(){if(_0x522d4b===_0x74aa('0x9d')){return db[_0x74aa('0x9e')][_0x74aa('0x42')]({'where':{'id':_0x445994['body'][_0x74aa('0x57')]||[]},'raw':!![],'attributes':['id',_0x74aa('0x2c')]});}})['then'](function(_0x36e0b8){var _0x12b091=_0x414e68[_0x74aa('0x9f')]({'plain':!![]});var _0x27ab9c=[];if(_0x522d4b==='voice'&&_0x12b091['role']===_0x74aa('0x1e')&&_0x12b091['online']){for(let _0x249ca8=0x0;_0x249ca8<_0x36e0b8['length'];_0x249ca8+=0x1){_0x27ab9c[_0x74aa('0x41')]({'membername':_0x12b091[_0x74aa('0x2c')],'UserId':_0x12b091['id'],'queue_name':_0x36e0b8[_0x249ca8][_0x74aa('0x2c')],'VoiceQueueId':_0x36e0b8[_0x249ca8]['id'],'interface':_['isNil'](_0x12b091['interface'])?util[_0x74aa('0xa0')](_0x74aa('0xa1'),_0x12b091[_0x74aa('0x2c')]):_0x12b091[_0x74aa('0x92')],'paused':_0x12b091[_0x74aa('0x91')]||![],'penalty':_0x445994[_0x74aa('0x52')][_0x74aa('0x98')]||0x0});}return Promise[_0x74aa('0x4d')](_0x27ab9c['map'](function(_0x6f7861){return db[_0x74aa('0xa2')][_0x74aa('0xa3')](_0x6f7861);}));}return _0x414e68;});}})[_0x74aa('0x1d')](respondWithStatusCode(_0x51b314,null))[_0x74aa('0x50')](handleError(_0x51b314,null));};exports[_0x74aa('0xa4')]=function(_0x2f3459,_0x198680){var _0xefa8d1,_0x507d56;return db[_0x74aa('0x2e')][_0x74aa('0x53')]({'where':{'id':_0x2f3459[_0x74aa('0x54')]['id']},'attributes':['id',_0x74aa('0x2c'),_0x74aa('0x27')]})[_0x74aa('0x1d')](handleEntityNotFound(_0x198680,null))['then'](function(_0x9cf587){if(_0x9cf587){_0xefa8d1=_0x9cf587;if(!_0x2f3459['query'][_0x74aa('0x8f')]||!utils[_0x74aa('0x93')](_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x8f')])){throw new db[(_0x74aa('0x83'))][(_0x74aa('0x84'))](_0x74aa('0x94'));}return _0x9cf587[_0x74aa('0xa5')+_[_0x74aa('0x96')](_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x8f')]['toLowerCase']())+'Queues'](_0x2f3459['query']['ids']);}})[_0x74aa('0x1d')](function(_0x2c5a81){if(_[_0x74aa('0xa6')](_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x57')])){for(var _0x3d9837=0x0;_0x3d9837<_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x57')][_0x74aa('0x45')];_0x3d9837+=0x1){_0x507d56={'UserId':Number(_0x2f3459['params']['id'])};_0x507d56[_[_0x74aa('0x96')](_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x8f')][_0x74aa('0x9a')]())+'QueueId']=Number(_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x57')][_0x3d9837]);socket[_0x74aa('0x1f')](_0x74aa('0x22')+_[_0x74aa('0x96')](_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x8f')]['toLowerCase']())+_0x74aa('0xa7'),_0x507d56);}}else{_0x507d56={'UserId':Number(_0x2f3459[_0x74aa('0x54')]['id'])};_0x507d56[_[_0x74aa('0x96')](_0x2f3459[_0x74aa('0x3b')]['channel'][_0x74aa('0x9a')]())+_0x74aa('0x9b')]=Number(_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x57')]);socket[_0x74aa('0x1f')](_0x74aa('0x22')+_[_0x74aa('0x96')](_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x8f')]['toLowerCase']())+_0x74aa('0xa7'),_0x507d56);}return _0x2c5a81;})[_0x74aa('0x1d')](function(){if(_0x2f3459[_0x74aa('0x3b')][_0x74aa('0x8f')]===_0x74aa('0x9d')){return db[_0x74aa('0xa2')]['destroy']({'where':{'UserId':_0x2f3459['params']['id'],'VoiceQueueId':_0x2f3459['query'][_0x74aa('0x57')]},'individualHooks':!![]})[_0x74aa('0x1d')](function(){return _0xefa8d1;});}return _0xefa8d1;})[_0x74aa('0x1d')](respondWithStatusCode(_0x198680,null))[_0x74aa('0x50')](handleError(_0x198680,null));};exports[_0x74aa('0xa8')]=function(_0x26d438,_0x1a6d5b){_0x26d438['body']['userpic']=_0x26d438[_0x74aa('0xa9')][_0x74aa('0xaa')];return db[_0x74aa('0x2e')]['find']({'where':{'id':_0x26d438[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x1a6d5b,null))['then'](saveUpdates(_0x26d438[_0x74aa('0x52')],null))[_0x74aa('0x1d')](respondWithResult(_0x1a6d5b,null))[_0x74aa('0x50')](handleError(_0x1a6d5b,null));};exports[_0x74aa('0xab')]=function(_0xbf8f32,_0x469892){var _0x12a439=path[_0x74aa('0xac')](config[_0x74aa('0xad')],_0x74aa('0xae'));return db['User']['find']({'where':{'id':_0xbf8f32[_0x74aa('0x54')]['id']},'attributes':['id',_0x74aa('0xaf')],'raw':!![]})[_0x74aa('0x1d')](handleEntityNotFound(_0x469892,null))[_0x74aa('0x1d')](function(_0x2acac9){if(_0x2acac9){if(_[_0x74aa('0x5d')](_0x2acac9[_0x74aa('0xaf')])){return _0x469892['download'](_0x12a439);}else{if(!fs['existsSync'](path['join'](config[_0x74aa('0xad')],'server/files/images/',_0x2acac9[_0x74aa('0xaf')]))){return _0x469892[_0x74aa('0xb0')](_0x12a439);}return _0x469892[_0x74aa('0xb0')](path[_0x74aa('0xac')](config[_0x74aa('0xad')],'server/files/images/',_0x2acac9['userpic']));}}})['catch'](handleError(_0x469892,null));};exports[_0x74aa('0xb1')]=function(_0x59f15c,_0x48cf83){return db[_0x74aa('0x2e')][_0x74aa('0x53')]({'where':{'id':_0x59f15c[_0x74aa('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x48cf83,null))[_0x74aa('0x1d')](function(_0x148572){var _0x55604a=[];values=_0x148572[_0x74aa('0x47')];_0x55604a['push'](get_open_tabs('chat',_0x148572[_0x74aa('0x47')]));_0x55604a[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x48'),_0x148572['dataValues']));_0x55604a['push'](get_open_tabs(_0x74aa('0x4b'),_0x148572['dataValues']));_0x55604a[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x4c'),_0x148572[_0x74aa('0x47')]));_0x55604a[_0x74aa('0x41')](get_open_tabs(_0x74aa('0x49'),_0x148572[_0x74aa('0x47')]));_0x55604a['push'](get_open_tabs(_0x74aa('0x4a'),_0x148572[_0x74aa('0x47')]));return Promise[_0x74aa('0x4d')](_0x55604a);})[_0x74aa('0x1d')](function(_0xa2b722){if(_0xa2b722){var _0x22915d=_[_0x74aa('0x25')](values[_0x74aa('0xb2')],function(_0x44bd7d){return{'channel':_0x74aa('0xb3'),'id':_0x44bd7d['id'],'createdAt':_0x44bd7d[_0x74aa('0xb4')]};});var _0x2dc3b9=_[_0x74aa('0x25')](values['FaxOpenTabs'],function(_0x183ea3){return{'channel':'FAX','id':_0x183ea3['id'],'createdAt':_0x183ea3[_0x74aa('0xb4')]};});var _0x192dba=_[_0x74aa('0x25')](values[_0x74aa('0xb5')],function(_0x1f7e46){return{'channel':_0x74aa('0xb6'),'id':_0x1f7e46['id'],'createdAt':_0x1f7e46[_0x74aa('0xb4')]};});var _0x2b647a=_[_0x74aa('0x25')](values['MailOpenTabs'],function(_0x4f84c5){return{'channel':_0x74aa('0xb7'),'id':_0x4f84c5['id'],'createdAt':_0x4f84c5[_0x74aa('0xb4')]};});var _0x122d76=_['map'](values['SmsOpenTabs'],function(_0x4b4e6a){return{'channel':_0x74aa('0xb8'),'id':_0x4b4e6a['id'],'createdAt':_0x4b4e6a[_0x74aa('0xb4')]};});var _0x271e88=_[_0x74aa('0x25')](values[_0x74aa('0xb9')],function(_0x16258a){return{'channel':'WHATSAPP','id':_0x16258a['id'],'createdAt':_0x16258a[_0x74aa('0xb4')]};});var _0x124ffe=_['concat'](_0x22915d,_0x2dc3b9,_0x192dba,_0x2b647a,_0x122d76,_0x271e88);var _0xe8dc43={'count':_0x124ffe[_0x74aa('0x45')],'rows':_0x124ffe};return _0xe8dc43;}else return null;})[_0x74aa('0x1d')](respondWithResult(_0x48cf83,null))[_0x74aa('0x50')](handleError(_0x48cf83,null));};exports[_0x74aa('0xba')]=function(_0x19c2ce,_0x43ff52){var _0x5ed734={};return db[_0x74aa('0x2e')]['findOne']({'where':{'id':_0x19c2ce[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](function(_0x4e5f5e){if(!_0x4e5f5e){throw new APINotFoundError(util[_0x74aa('0xa0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x19c2ce[_0x74aa('0x54')]['id']));}return contacts[_0x74aa('0x55')]();})['then'](function(_0x44755e){_0x19c2ce[_0x74aa('0x3b')][_0x74aa('0x2e')]=_0x19c2ce[_0x74aa('0x54')]['id'];_0x5ed734=qs[_0x74aa('0x3a')](_0x44755e,_0x19c2ce);if(_0x19c2ce[_0x74aa('0x3b')][_0x74aa('0xbb')]('includeAll')){_0x5ed734['include']=[{'model':db[_0x74aa('0xbc')],'as':_0x74aa('0xbd'),'required':![]},{'model':db[_0x74aa('0xbe')],'as':'Tags','attributes':['id',_0x74aa('0x2c'),'color'],'where':_0x19c2ce[_0x74aa('0x3b')][_0x74aa('0xbf')]?{'id':_0x19c2ce[_0x74aa('0x3b')][_0x74aa('0xbf')]}:undefined,'required':_0x19c2ce['query'][_0x74aa('0xbf')]?!![]:![]}];}return contacts[_0x74aa('0x42')](_0x19c2ce[_0x74aa('0x3b')],_0x19c2ce[_0x74aa('0x22')],_0x5ed734,_0x44755e);})[_0x74aa('0x1d')](respondWithFilteredResult(_0x43ff52,_0x5ed734))['catch'](APIHandleError(_0x43ff52));};exports[_0x74aa('0xc0')]=function(_0x1a0fdd,_0x59dc65){var _0x5606fd;var _0x512c85={};var _0x340e69;return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x1a0fdd[_0x74aa('0x54')]['id']},'attributes':['id',_0x74aa('0x2c'),_0x74aa('0x27')]})['then'](handleEntityNotFound(_0x59dc65,null))[_0x74aa('0x1d')](function(_0x3112f2){if(!utils[_0x74aa('0x93')](_0x1a0fdd[_0x74aa('0x3b')]['channel'])){throw new db[(_0x74aa('0x83'))]['ValidationError']('Unknown\x20channel');}_0x5606fd=_0x3112f2;var _0x901b57={};_0x901b57[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_['capitalize'](_0x1a0fdd[_0x74aa('0x3b')][_0x74aa('0x8f')])+'Queue'][_0x74aa('0x2f')]);_0x901b57[_0x74aa('0x3b')]=_['keys'](_0x1a0fdd[_0x74aa('0x3b')]);_0x901b57[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x901b57[_0x74aa('0xc1')],_0x901b57['query']);_0x512c85[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x901b57[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x1a0fdd[_0x74aa('0x3b')][_0x74aa('0xc5')]));_0x512c85['attributes']=_0x512c85[_0x74aa('0x40')][_0x74aa('0x45')]?_0x512c85[_0x74aa('0x40')]:_0x901b57[_0x74aa('0xc1')];_0x512c85[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x1a0fdd['query']['sort']);_0x512c85['where']=qs[_0x74aa('0xc3')](_[_0x74aa('0xc8')](_0x1a0fdd[_0x74aa('0x3b')],_0x901b57[_0x74aa('0xc3')]));if(_0x1a0fdd['query'][_0x74aa('0x33')]){_0x512c85['where']=_['merge'](_0x512c85[_0x74aa('0xc9')],{'$or':_[_0x74aa('0x25')](_0x512c85[_0x74aa('0x40')],function(_0x37d42c){var _0x3577ad={};_0x3577ad[_0x37d42c]={'$like':'%'+_0x1a0fdd[_0x74aa('0x3b')]['filter']+'%'};return _0x3577ad;})});}_0x512c85=_[_0x74aa('0xca')]({},_0x512c85,_0x1a0fdd[_0x74aa('0xcb')]);switch(_0x5606fd['role']){case _0x74aa('0x21'):return db[_[_0x74aa('0x96')](_0x1a0fdd[_0x74aa('0x3b')][_0x74aa('0x8f')])+_0x74aa('0xcc')]['findAll'](_0x512c85);case'user':case _0x74aa('0x1e'):return _0x5606fd[_0x74aa('0x9f')+_[_0x74aa('0x96')](_0x1a0fdd['query'][_0x74aa('0x8f')])+_0x74aa('0x97')](_0x512c85);default:throw new db[(_0x74aa('0x83'))][(_0x74aa('0x84'))](_0x74aa('0xcd'));}})[_0x74aa('0x1d')](function(_0x23d56c){_0x340e69=_0x23d56c['length'];if(!_0x1a0fdd[_0x74aa('0x3b')][_0x74aa('0xbb')](_0x74aa('0xce'))){_0x512c85['limit']=qs['limit'](_0x1a0fdd[_0x74aa('0x3b')][_0x74aa('0x19')]);_0x512c85[_0x74aa('0x17')]=qs['offset'](_0x1a0fdd[_0x74aa('0x3b')]['offset']);}switch(_0x5606fd[_0x74aa('0x27')]){case'admin':return db[_[_0x74aa('0x96')](_0x1a0fdd[_0x74aa('0x3b')][_0x74aa('0x8f')])+_0x74aa('0xcc')][_0x74aa('0x42')](_0x512c85);case'user':case _0x74aa('0x1e'):return _0x5606fd['get'+_[_0x74aa('0x96')](_0x1a0fdd['query'][_0x74aa('0x8f')])+_0x74aa('0x97')](_0x512c85);}})['then'](function(_0x4e8067){return{'count':_0x340e69,'rows':_0x4e8067};})['then'](respondWithResult(_0x59dc65,null))[_0x74aa('0x50')](handleError(_0x59dc65,null));};exports[_0x74aa('0xcf')]=function(_0x5775fc,_0x46f16c){var _0x7085ca={};var _0x77302d={};var _0x3c0a0a;var _0x49cf4b;return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x5775fc[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x46f16c,null))[_0x74aa('0x1d')](function(_0x5e2c46){if(_0x5e2c46){_0x3c0a0a=_0x5e2c46;_0x77302d[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_0x74aa('0xa2')][_0x74aa('0x2f')]);_0x77302d[_0x74aa('0x3b')]=_['keys'](_0x5775fc[_0x74aa('0x3b')]);_0x77302d[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x77302d[_0x74aa('0xc1')],_0x77302d[_0x74aa('0x3b')]);_0x7085ca[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x77302d[_0x74aa('0xc1')],qs['fields'](_0x5775fc['query'][_0x74aa('0xc5')]));_0x7085ca['attributes']=_0x7085ca[_0x74aa('0x40')][_0x74aa('0x45')]?_0x7085ca[_0x74aa('0x40')]:_0x77302d[_0x74aa('0xc1')];_0x7085ca[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x5775fc[_0x74aa('0x3b')]['sort']);_0x7085ca[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_[_0x74aa('0xc8')](_0x5775fc[_0x74aa('0x3b')],_0x77302d[_0x74aa('0xc3')]));if(_0x5775fc[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x7085ca[_0x74aa('0xc9')]=_['merge'](_0x7085ca[_0x74aa('0xc9')],{'$or':_['map'](_0x7085ca[_0x74aa('0x40')],function(_0x2497ee){var _0x3d1026={};_0x3d1026[_0x2497ee]={'$like':'%'+_0x5775fc['query'][_0x74aa('0x33')]+'%'};return _0x3d1026;})});}_0x7085ca=_[_0x74aa('0xca')]({},_0x7085ca,_0x5775fc[_0x74aa('0xcb')]);return _0x3c0a0a[_0x74aa('0xcf')](_0x7085ca);}})['then'](function(_0x2b5e7e){if(_0x2b5e7e){_0x49cf4b=_0x2b5e7e['length'];if(!_0x5775fc['query'][_0x74aa('0xbb')](_0x74aa('0xce'))){_0x7085ca[_0x74aa('0x19')]=qs[_0x74aa('0x19')](_0x5775fc[_0x74aa('0x3b')]['limit']);_0x7085ca[_0x74aa('0x17')]=qs['offset'](_0x5775fc[_0x74aa('0x3b')][_0x74aa('0x17')]);}return _0x3c0a0a[_0x74aa('0xcf')](_0x7085ca);}})['then'](function(_0x61481){if(_0x61481){return _0x61481?{'count':_0x49cf4b,'rows':_0x61481}:null;}})[_0x74aa('0x1d')](respondWithResult(_0x46f16c,null))[_0x74aa('0x50')](handleError(_0x46f16c,null));};exports[_0x74aa('0xd0')]=function(_0x5173d9,_0x16d279){var _0x3ee479={};var _0x5517d5={};var _0x23f37a;var _0x5d61d1;return db[_0x74aa('0x2e')]['findOne']({'where':{'id':_0x5173d9[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x16d279,null))[_0x74aa('0x1d')](function(_0x43e622){if(_0x43e622){_0x23f37a=_0x43e622;_0x5517d5['model']=_[_0x74aa('0xc2')](db[_0x74aa('0xd1')][_0x74aa('0x2f')]);_0x5517d5[_0x74aa('0x3b')]=_[_0x74aa('0xc2')](_0x5173d9[_0x74aa('0x3b')]);_0x5517d5[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x5517d5[_0x74aa('0xc1')],_0x5517d5[_0x74aa('0x3b')]);_0x3ee479[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x5517d5[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x5173d9['query'][_0x74aa('0xc5')]));_0x3ee479[_0x74aa('0x40')]=_0x3ee479['attributes'][_0x74aa('0x45')]?_0x3ee479[_0x74aa('0x40')]:_0x5517d5[_0x74aa('0xc1')];_0x3ee479[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x5173d9[_0x74aa('0x3b')]['sort']);_0x3ee479[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_['pick'](_0x5173d9[_0x74aa('0x3b')],_0x5517d5[_0x74aa('0xc3')]));if(_0x5173d9[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x3ee479[_0x74aa('0xc9')]=_[_0x74aa('0xca')](_0x3ee479['where'],{'$or':_[_0x74aa('0x25')](_0x3ee479[_0x74aa('0x40')],function(_0x16970d){var _0x3a4ada={};_0x3a4ada[_0x16970d]={'$like':'%'+_0x5173d9[_0x74aa('0x3b')][_0x74aa('0x33')]+'%'};return _0x3a4ada;})});}_0x3ee479=_[_0x74aa('0xca')]({},_0x3ee479,_0x5173d9[_0x74aa('0xcb')]);return _0x23f37a[_0x74aa('0xd0')](_0x3ee479);}})['then'](function(_0x55ea4c){if(_0x55ea4c){_0x5d61d1=_0x55ea4c['length'];if(!_0x5173d9[_0x74aa('0x3b')][_0x74aa('0xbb')](_0x74aa('0xce'))){_0x3ee479[_0x74aa('0x19')]=qs['limit'](_0x5173d9[_0x74aa('0x3b')]['limit']);_0x3ee479[_0x74aa('0x17')]=qs[_0x74aa('0x17')](_0x5173d9[_0x74aa('0x3b')]['offset']);}return _0x23f37a[_0x74aa('0xd0')](_0x3ee479);}})[_0x74aa('0x1d')](function(_0x3b7c49){if(_0x3b7c49){return _0x3b7c49?{'count':_0x5d61d1,'rows':_0x3b7c49}:null;}})[_0x74aa('0x1d')](respondWithResult(_0x16d279,null))[_0x74aa('0x50')](handleError(_0x16d279,null));};exports[_0x74aa('0xd2')]=function(_0x225a51,_0x23afac){var _0x6fb7f1={'raw':!![],'where':{}};var _0x354aa9={};var _0x453f76={'count':0x0,'rows':[]};return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x225a51[_0x74aa('0x54')]['id']}})['then'](handleEntityNotFound(_0x23afac,null))[_0x74aa('0x1d')](function(_0x5c2570){if(_0x5c2570){_0x354aa9[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_0x74aa('0xd3')][_0x74aa('0x2f')]);_0x354aa9[_0x74aa('0x3b')]=_[_0x74aa('0xc2')](_0x225a51[_0x74aa('0x3b')]);_0x354aa9[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x354aa9[_0x74aa('0xc1')],_0x354aa9[_0x74aa('0x3b')]);_0x6fb7f1[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x354aa9['model'],qs[_0x74aa('0xc5')](_0x225a51[_0x74aa('0x3b')][_0x74aa('0xc5')]));_0x6fb7f1[_0x74aa('0x40')]=_0x6fb7f1[_0x74aa('0x40')][_0x74aa('0x45')]?_0x6fb7f1['attributes']:_0x354aa9['model'];if(!_0x225a51[_0x74aa('0x3b')]['hasOwnProperty'](_0x74aa('0xce'))){_0x6fb7f1[_0x74aa('0x19')]=qs['limit'](_0x225a51[_0x74aa('0x3b')][_0x74aa('0x19')]);_0x6fb7f1[_0x74aa('0x17')]=qs[_0x74aa('0x17')](_0x225a51[_0x74aa('0x3b')]['offset']);}_0x6fb7f1[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x225a51['query']['sort']);_0x6fb7f1[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_['pick'](_0x225a51['query'],_0x354aa9[_0x74aa('0xc3')]));_0x6fb7f1['where'][_0x74aa('0xd4')]=_0x5c2570['id'];if(_0x225a51[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x6fb7f1[_0x74aa('0xc9')]=_['merge'](_0x6fb7f1['where'],{'$or':_[_0x74aa('0x25')](_0x6fb7f1[_0x74aa('0x40')],function(_0x1c3a5e){var _0x37af6f={};_0x37af6f[_0x1c3a5e]={'$like':'%'+_0x225a51[_0x74aa('0x3b')][_0x74aa('0x33')]+'%'};return _0x37af6f;})});}_0x6fb7f1=_['merge']({},_0x6fb7f1,_0x225a51[_0x74aa('0xcb')]);return db[_0x74aa('0xd3')][_0x74aa('0x1a')]({'where':_0x6fb7f1[_0x74aa('0xc9')]})[_0x74aa('0x1d')](function(_0x5a7d9e){_0x453f76['count']=_0x5a7d9e;if(_0x225a51['query'][_0x74aa('0x4f')]){_0x6fb7f1[_0x74aa('0x3c')]=[{'all':!![]}];}return db[_0x74aa('0xd3')]['findAll'](_0x6fb7f1);})[_0x74aa('0x1d')](function(_0x10d8e8){_0x453f76[_0x74aa('0x43')]=_0x10d8e8;return _0x453f76;});}})[_0x74aa('0x1d')](respondWithFilteredResult(_0x23afac,_0x6fb7f1))[_0x74aa('0x50')](handleError(_0x23afac,null));};exports[_0x74aa('0xd5')]=function(_0x13f987,_0xc6dfa9){var _0x5911ad={'raw':!![],'where':{}};var _0x3739ee={};var _0x161728={'count':0x0,'rows':[]};return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x13f987[_0x74aa('0x54')]['id']}})['then'](handleEntityNotFound(_0xc6dfa9,null))[_0x74aa('0x1d')](function(_0x15f812){if(_0x15f812){_0x3739ee['model']=_[_0x74aa('0xc2')](db[_0x74aa('0xd6')][_0x74aa('0x2f')]);_0x3739ee['query']=_['keys'](_0x13f987[_0x74aa('0x3b')]);_0x3739ee['filters']=_[_0x74aa('0xc4')](_0x3739ee[_0x74aa('0xc1')],_0x3739ee[_0x74aa('0x3b')]);_0x5911ad[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x3739ee[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x13f987[_0x74aa('0x3b')]['fields']));_0x5911ad[_0x74aa('0x40')]=_0x5911ad[_0x74aa('0x40')][_0x74aa('0x45')]?_0x5911ad[_0x74aa('0x40')]:_0x3739ee['model'];if(!_0x13f987[_0x74aa('0x3b')][_0x74aa('0xbb')](_0x74aa('0xce'))){_0x5911ad['limit']=qs['limit'](_0x13f987[_0x74aa('0x3b')][_0x74aa('0x19')]);_0x5911ad['offset']=qs[_0x74aa('0x17')](_0x13f987[_0x74aa('0x3b')]['offset']);}_0x5911ad[_0x74aa('0xc6')]=qs['sort'](_0x13f987[_0x74aa('0x3b')]['sort']);_0x5911ad[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_[_0x74aa('0xc8')](_0x13f987[_0x74aa('0x3b')],_0x3739ee[_0x74aa('0xc3')]));_0x5911ad[_0x74aa('0xc9')]['UserId']=_0x15f812['id'];if(_0x13f987[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x5911ad[_0x74aa('0xc9')]=_['merge'](_0x5911ad[_0x74aa('0xc9')],{'$or':_[_0x74aa('0x25')](_0x5911ad['attributes'],function(_0x4f5a58){var _0x595638={};_0x595638[_0x4f5a58]={'$like':'%'+_0x13f987[_0x74aa('0x3b')]['filter']+'%'};return _0x595638;})});}_0x5911ad=_['merge']({},_0x5911ad,_0x13f987[_0x74aa('0xcb')]);return db[_0x74aa('0xd6')][_0x74aa('0x1a')]({'where':_0x5911ad[_0x74aa('0xc9')]})[_0x74aa('0x1d')](function(_0x509cff){_0x161728[_0x74aa('0x1a')]=_0x509cff;if(_0x13f987[_0x74aa('0x3b')][_0x74aa('0x4f')]){_0x5911ad['include']=[{'all':!![]}];}return db[_0x74aa('0xd6')]['findAll'](_0x5911ad);})[_0x74aa('0x1d')](function(_0x25bd9e){_0x161728[_0x74aa('0x43')]=_0x25bd9e;return _0x161728;});}})[_0x74aa('0x1d')](respondWithFilteredResult(_0xc6dfa9,_0x5911ad))['catch'](handleError(_0xc6dfa9,null));};exports['getChatInteractions']=function(_0x2692f1,_0x1b2e5e){var _0x1fd921={};var _0x5748fe={};var _0x567552;var _0x263521;return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x2692f1[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x1b2e5e,null))[_0x74aa('0x1d')](function(_0xb7d736){if(_0xb7d736){_0x567552=_0xb7d736;_0x5748fe[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_0x74aa('0xd7')][_0x74aa('0x2f')]);_0x5748fe[_0x74aa('0x3b')]=_['keys'](_0x2692f1['query']);_0x5748fe['filters']=_['intersection'](_0x5748fe[_0x74aa('0xc1')],_0x5748fe[_0x74aa('0x3b')]);_0x1fd921[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x5748fe[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x2692f1['query']['fields']));_0x1fd921[_0x74aa('0x40')]=_0x1fd921[_0x74aa('0x40')]['length']?_0x1fd921[_0x74aa('0x40')]:_0x5748fe['model'];_0x1fd921[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x2692f1['query'][_0x74aa('0xc7')]);_0x1fd921[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_[_0x74aa('0xc8')](_0x2692f1['query'],_0x5748fe['filters']));if(_0x2692f1[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x1fd921['where']=_['merge'](_0x1fd921[_0x74aa('0xc9')],{'$or':_[_0x74aa('0x25')](_0x1fd921['attributes'],function(_0x599863){var _0x1e1465={};_0x1e1465[_0x599863]={'$like':'%'+_0x2692f1['query'][_0x74aa('0x33')]+'%'};return _0x1e1465;})});}_0x1fd921=_[_0x74aa('0xca')]({},_0x1fd921,_0x2692f1[_0x74aa('0xcb')]);return _0x567552[_0x74aa('0xd8')](_0x1fd921);}})[_0x74aa('0x1d')](function(_0x19c41f){if(_0x19c41f){_0x263521=_0x19c41f['length'];if(!_0x2692f1[_0x74aa('0x3b')]['hasOwnProperty'](_0x74aa('0xce'))){_0x1fd921[_0x74aa('0x19')]=qs[_0x74aa('0x19')](_0x2692f1[_0x74aa('0x3b')][_0x74aa('0x19')]);_0x1fd921[_0x74aa('0x17')]=qs[_0x74aa('0x17')](_0x2692f1[_0x74aa('0x3b')][_0x74aa('0x17')]);}return _0x567552['getChatInteractions'](_0x1fd921);}})[_0x74aa('0x1d')](function(_0x424ace){if(_0x424ace){return _0x424ace?{'count':_0x263521,'rows':_0x424ace}:null;}})[_0x74aa('0x1d')](respondWithResult(_0x1b2e5e,null))[_0x74aa('0x50')](handleError(_0x1b2e5e,null));};exports[_0x74aa('0xd9')]=function(_0x5f8baf,_0x2b95e3){var _0x48b0fb={};var _0x4c95c5={};var _0x371e45;var _0x2cd1d6;return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x5f8baf[_0x74aa('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b95e3,null))[_0x74aa('0x1d')](function(_0x2303d0){if(_0x2303d0){_0x371e45=_0x2303d0;_0x4c95c5[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_0x74aa('0xda')][_0x74aa('0x2f')]);_0x4c95c5['query']=_['keys'](_0x5f8baf[_0x74aa('0x3b')]);_0x4c95c5[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x4c95c5['model'],_0x4c95c5[_0x74aa('0x3b')]);_0x48b0fb[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x4c95c5[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x5f8baf[_0x74aa('0x3b')]['fields']));_0x48b0fb[_0x74aa('0x40')]=_0x48b0fb[_0x74aa('0x40')]['length']?_0x48b0fb[_0x74aa('0x40')]:_0x4c95c5[_0x74aa('0xc1')];_0x48b0fb[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x5f8baf[_0x74aa('0x3b')]['sort']);_0x48b0fb['where']=qs['filters'](_[_0x74aa('0xc8')](_0x5f8baf['query'],_0x4c95c5['filters']));if(_0x5f8baf['query'][_0x74aa('0x33')]){_0x48b0fb[_0x74aa('0xc9')]=_['merge'](_0x48b0fb['where'],{'$or':_['map'](_0x48b0fb[_0x74aa('0x40')],function(_0x10787b){var _0x81227c={};_0x81227c[_0x10787b]={'$like':'%'+_0x5f8baf[_0x74aa('0x3b')][_0x74aa('0x33')]+'%'};return _0x81227c;})});}_0x48b0fb=_[_0x74aa('0xca')]({},_0x48b0fb,_0x5f8baf[_0x74aa('0xcb')]);return _0x371e45[_0x74aa('0xd9')](_0x48b0fb);}})['then'](function(_0x7f3c1f){if(_0x7f3c1f){_0x2cd1d6=_0x7f3c1f['length'];if(!_0x5f8baf[_0x74aa('0x3b')][_0x74aa('0xbb')](_0x74aa('0xce'))){_0x48b0fb[_0x74aa('0x19')]=qs['limit'](_0x5f8baf['query'][_0x74aa('0x19')]);_0x48b0fb['offset']=qs[_0x74aa('0x17')](_0x5f8baf['query'][_0x74aa('0x17')]);}return _0x371e45[_0x74aa('0xd9')](_0x48b0fb);}})['then'](function(_0x5d8a4b){if(_0x5d8a4b){return _0x5d8a4b?{'count':_0x2cd1d6,'rows':_0x5d8a4b}:null;}})[_0x74aa('0x1d')](respondWithResult(_0x2b95e3,null))[_0x74aa('0x50')](handleError(_0x2b95e3,null));};exports[_0x74aa('0xdb')]=function(_0x184aaa,_0x25c968){var _0x4eae0d={'raw':!![],'where':{}};var _0x731c51={};var _0x59dcf4={'count':0x0,'rows':[]};return db['User'][_0x74aa('0x87')]({'where':{'id':_0x184aaa['params']['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x25c968,null))['then'](function(_0x4636b0){if(_0x4636b0){_0x731c51[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_0x74aa('0xdc')]['rawAttributes']);_0x731c51[_0x74aa('0x3b')]=_[_0x74aa('0xc2')](_0x184aaa['query']);_0x731c51[_0x74aa('0xc3')]=_['intersection'](_0x731c51['model'],_0x731c51[_0x74aa('0x3b')]);_0x4eae0d[_0x74aa('0x40')]=_['intersection'](_0x731c51[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x184aaa['query']['fields']));_0x4eae0d[_0x74aa('0x40')]=_0x4eae0d[_0x74aa('0x40')][_0x74aa('0x45')]?_0x4eae0d[_0x74aa('0x40')]:_0x731c51[_0x74aa('0xc1')];if(!_0x184aaa['query']['hasOwnProperty'](_0x74aa('0xce'))){_0x4eae0d[_0x74aa('0x19')]=qs['limit'](_0x184aaa[_0x74aa('0x3b')][_0x74aa('0x19')]);_0x4eae0d[_0x74aa('0x17')]=qs[_0x74aa('0x17')](_0x184aaa[_0x74aa('0x3b')][_0x74aa('0x17')]);}_0x4eae0d[_0x74aa('0xc6')]=qs['sort'](_0x184aaa['query'][_0x74aa('0xc7')]);_0x4eae0d[_0x74aa('0xc9')]=qs['filters'](_[_0x74aa('0xc8')](_0x184aaa[_0x74aa('0x3b')],_0x731c51[_0x74aa('0xc3')]));_0x4eae0d[_0x74aa('0xc9')]['UserId']=_0x4636b0['id'];if(_0x184aaa['query'][_0x74aa('0x33')]){_0x4eae0d['where']=_[_0x74aa('0xca')](_0x4eae0d[_0x74aa('0xc9')],{'$or':_['map'](_0x4eae0d[_0x74aa('0x40')],function(_0x179fe7){var _0xc8a1af={};_0xc8a1af[_0x179fe7]={'$like':'%'+_0x184aaa[_0x74aa('0x3b')]['filter']+'%'};return _0xc8a1af;})});}_0x4eae0d=_[_0x74aa('0xca')]({},_0x4eae0d,_0x184aaa[_0x74aa('0xcb')]);return db[_0x74aa('0xdc')][_0x74aa('0x1a')]({'where':_0x4eae0d['where']})[_0x74aa('0x1d')](function(_0x29cb90){_0x59dcf4[_0x74aa('0x1a')]=_0x29cb90;if(_0x184aaa[_0x74aa('0x3b')][_0x74aa('0x4f')]){_0x4eae0d[_0x74aa('0x3c')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x4eae0d);})[_0x74aa('0x1d')](function(_0x2fec05){_0x59dcf4[_0x74aa('0x43')]=_0x2fec05;return _0x59dcf4;});}})['then'](respondWithFilteredResult(_0x25c968,_0x4eae0d))['catch'](handleError(_0x25c968,null));};exports[_0x74aa('0xdd')]=function(_0x39c44c,_0x3e464c){var _0x1908f2={};var _0x1af83f={};var _0x3a88a3;var _0x4f3893;return db['User']['findOne']({'where':{'id':_0x39c44c[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x3e464c,null))['then'](function(_0x1ef474){if(_0x1ef474){_0x3a88a3=_0x1ef474;_0x1af83f['model']=_[_0x74aa('0xc2')](db['SmsInteraction'][_0x74aa('0x2f')]);_0x1af83f[_0x74aa('0x3b')]=_[_0x74aa('0xc2')](_0x39c44c[_0x74aa('0x3b')]);_0x1af83f[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x1af83f[_0x74aa('0xc1')],_0x1af83f[_0x74aa('0x3b')]);_0x1908f2[_0x74aa('0x40')]=_['intersection'](_0x1af83f[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x39c44c[_0x74aa('0x3b')][_0x74aa('0xc5')]));_0x1908f2[_0x74aa('0x40')]=_0x1908f2['attributes']['length']?_0x1908f2['attributes']:_0x1af83f['model'];_0x1908f2[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x39c44c[_0x74aa('0x3b')][_0x74aa('0xc7')]);_0x1908f2[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_['pick'](_0x39c44c['query'],_0x1af83f[_0x74aa('0xc3')]));if(_0x39c44c[_0x74aa('0x3b')]['filter']){_0x1908f2[_0x74aa('0xc9')]=_[_0x74aa('0xca')](_0x1908f2[_0x74aa('0xc9')],{'$or':_[_0x74aa('0x25')](_0x1908f2[_0x74aa('0x40')],function(_0x5e3e1d){var _0x29354a={};_0x29354a[_0x5e3e1d]={'$like':'%'+_0x39c44c[_0x74aa('0x3b')][_0x74aa('0x33')]+'%'};return _0x29354a;})});}_0x1908f2=_['merge']({},_0x1908f2,_0x39c44c[_0x74aa('0xcb')]);return _0x3a88a3[_0x74aa('0xdd')](_0x1908f2);}})[_0x74aa('0x1d')](function(_0x510313){if(_0x510313){_0x4f3893=_0x510313[_0x74aa('0x45')];if(!_0x39c44c[_0x74aa('0x3b')][_0x74aa('0xbb')](_0x74aa('0xce'))){_0x1908f2[_0x74aa('0x19')]=qs[_0x74aa('0x19')](_0x39c44c['query'][_0x74aa('0x19')]);_0x1908f2[_0x74aa('0x17')]=qs[_0x74aa('0x17')](_0x39c44c['query']['offset']);}return _0x3a88a3[_0x74aa('0xdd')](_0x1908f2);}})[_0x74aa('0x1d')](function(_0x557b4c){if(_0x557b4c){return _0x557b4c?{'count':_0x4f3893,'rows':_0x557b4c}:null;}})[_0x74aa('0x1d')](respondWithResult(_0x3e464c,null))[_0x74aa('0x50')](handleError(_0x3e464c,null));};exports[_0x74aa('0xde')]=function(_0x250d0d,_0x31b25b){var _0x3ce5d7={};var _0x4c150a={};var _0xfde1a6;var _0x358102;return db[_0x74aa('0x2e')]['findOne']({'where':{'id':_0x250d0d[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x31b25b,null))[_0x74aa('0x1d')](function(_0x3452d9){if(_0x3452d9){_0xfde1a6=_0x3452d9;_0x4c150a[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_0x74aa('0xdf')][_0x74aa('0x2f')]);_0x4c150a[_0x74aa('0x3b')]=_[_0x74aa('0xc2')](_0x250d0d[_0x74aa('0x3b')]);_0x4c150a[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x4c150a['model'],_0x4c150a[_0x74aa('0x3b')]);_0x3ce5d7[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x4c150a[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x250d0d['query'][_0x74aa('0xc5')]));_0x3ce5d7[_0x74aa('0x40')]=_0x3ce5d7[_0x74aa('0x40')][_0x74aa('0x45')]?_0x3ce5d7[_0x74aa('0x40')]:_0x4c150a[_0x74aa('0xc1')];_0x3ce5d7[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x250d0d[_0x74aa('0x3b')][_0x74aa('0xc7')]);_0x3ce5d7[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_['pick'](_0x250d0d['query'],_0x4c150a['filters']));if(_0x250d0d[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x3ce5d7[_0x74aa('0xc9')]=_['merge'](_0x3ce5d7[_0x74aa('0xc9')],{'$or':_['map'](_0x3ce5d7[_0x74aa('0x40')],function(_0x3a0e20){var _0x405f6a={};_0x405f6a[_0x3a0e20]={'$like':'%'+_0x250d0d['query'][_0x74aa('0x33')]+'%'};return _0x405f6a;})});}_0x3ce5d7=_[_0x74aa('0xca')]({},_0x3ce5d7,_0x250d0d[_0x74aa('0xcb')]);return _0xfde1a6[_0x74aa('0xde')](_0x3ce5d7);}})[_0x74aa('0x1d')](function(_0x2b58b7){if(_0x2b58b7){_0x358102=_0x2b58b7['length'];if(!_0x250d0d['query'][_0x74aa('0xbb')]('nolimit')){_0x3ce5d7[_0x74aa('0x19')]=qs[_0x74aa('0x19')](_0x250d0d[_0x74aa('0x3b')][_0x74aa('0x19')]);_0x3ce5d7['offset']=qs[_0x74aa('0x17')](_0x250d0d[_0x74aa('0x3b')][_0x74aa('0x17')]);}return _0xfde1a6['getFaxInteractions'](_0x3ce5d7);}})[_0x74aa('0x1d')](function(_0x585ba4){if(_0x585ba4){return _0x585ba4?{'count':_0x358102,'rows':_0x585ba4}:null;}})[_0x74aa('0x1d')](respondWithResult(_0x31b25b,null))['catch'](handleError(_0x31b25b,null));};exports[_0x74aa('0xe0')]=function(_0x1a5fe6,_0x2dfb4a){var _0x475878={};var _0x4da546={};var _0x1a47c3;var _0x5d6945;return db['User'][_0x74aa('0x87')]({'where':{'id':_0x1a5fe6[_0x74aa('0x54')]['id']}})['then'](handleEntityNotFound(_0x2dfb4a,null))[_0x74aa('0x1d')](function(_0x155ec7){if(_0x155ec7){_0x1a47c3=_0x155ec7;_0x4da546[_0x74aa('0xc1')]=_['keys'](db[_0x74aa('0xe1')][_0x74aa('0x2f')]);_0x4da546[_0x74aa('0x3b')]=_['keys'](_0x1a5fe6[_0x74aa('0x3b')]);_0x4da546[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x4da546[_0x74aa('0xc1')],_0x4da546['query']);_0x475878[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x4da546['model'],qs[_0x74aa('0xc5')](_0x1a5fe6[_0x74aa('0x3b')][_0x74aa('0xc5')]));_0x475878['attributes']=_0x475878['attributes'][_0x74aa('0x45')]?_0x475878[_0x74aa('0x40')]:_0x4da546['model'];_0x475878['order']=qs['sort'](_0x1a5fe6[_0x74aa('0x3b')][_0x74aa('0xc7')]);_0x475878[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_['pick'](_0x1a5fe6[_0x74aa('0x3b')],_0x4da546[_0x74aa('0xc3')]));if(_0x1a5fe6[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x475878[_0x74aa('0xc9')]=_[_0x74aa('0xca')](_0x475878[_0x74aa('0xc9')],{'$or':_[_0x74aa('0x25')](_0x475878[_0x74aa('0x40')],function(_0x256890){var _0x496fb2={};_0x496fb2[_0x256890]={'$like':'%'+_0x1a5fe6['query'][_0x74aa('0x33')]+'%'};return _0x496fb2;})});}_0x475878=_['merge']({},_0x475878,_0x1a5fe6[_0x74aa('0xcb')]);return _0x1a47c3[_0x74aa('0xe0')](_0x475878);}})[_0x74aa('0x1d')](function(_0x15d921){if(_0x15d921){_0x5d6945=_0x15d921['length'];if(!_0x1a5fe6[_0x74aa('0x3b')]['hasOwnProperty'](_0x74aa('0xce'))){_0x475878[_0x74aa('0x19')]=qs[_0x74aa('0x19')](_0x1a5fe6[_0x74aa('0x3b')]['limit']);_0x475878[_0x74aa('0x17')]=qs[_0x74aa('0x17')](_0x1a5fe6[_0x74aa('0x3b')]['offset']);}return _0x1a47c3[_0x74aa('0xe0')](_0x475878);}})[_0x74aa('0x1d')](function(_0x262d6d){if(_0x262d6d){return _0x262d6d?{'count':_0x5d6945,'rows':_0x262d6d}:null;}})[_0x74aa('0x1d')](respondWithResult(_0x2dfb4a,null))[_0x74aa('0x50')](handleError(_0x2dfb4a,null));};exports['login']=function(_0x1f1b98,_0x13a3ce,_0x516af9){var _0x5eecb5;var _0x5f0713;var _0x4c96f7;var _0x47edb4=!_[_0x74aa('0x5d')](_0x1f1b98[_0x74aa('0x54')]['id'])?_0x1f1b98[_0x74aa('0x54')]['id']:!_[_0x74aa('0x5d')](_0x1f1b98[_0x74aa('0x22')]['id'])?_0x1f1b98[_0x74aa('0x22')]['id']:null;return db[_0x74aa('0x2e')][_0x74aa('0x53')]({'where':{'id':_0x47edb4,'role':{'$or':[_0x74aa('0x21'),'user','agent']}},'attributes':['id',_0x74aa('0x2c'),'phone','mobile',_0x74aa('0x27'),'internal',_0x74aa('0x90')]})[_0x74aa('0x1d')](function(_0x171d93){if(_0x171d93){if(_0x171d93[_0x74aa('0x27')]==='agent'){_0x5eecb5=_0x171d93;if(_0x1f1b98['body'][_0x74aa('0x92')]){_0x4c96f7=util[_0x74aa('0xa0')]('LOCAL/%s@from-sip/n',_0x5eecb5[_0x1f1b98[_0x74aa('0x52')][_0x74aa('0x92')]]);}else if(_0x1f1b98['body']['intrf']){_0x4c96f7=util[_0x74aa('0xa0')](_0x74aa('0xa1'),_0x1f1b98['body'][_0x74aa('0xe2')]);}else{_0x4c96f7=util[_0x74aa('0xa0')](_0x74aa('0xa1'),_0x5eecb5[_0x74aa('0x2c')]);}socket['to'](util[_0x74aa('0xa0')]('user:%s',_0x5eecb5[_0x74aa('0x2c')]))['emit'](_0x74aa('0xe3'),{'user':{'id':_0x5eecb5['id'],'name':_0x5eecb5[_0x74aa('0x2c')]},'ip':_0x1f1b98['headers']['x-forwarded-for']||_0x1f1b98[_0x74aa('0xe4')][_0x74aa('0xe5')]||_0x1f1b98[_0x74aa('0xe6')][_0x74aa('0xe5')]||_0x1f1b98[_0x74aa('0xe4')]['socket'][_0x74aa('0xe5')]});return db['UserVoiceQueueRt'][_0x74aa('0x29')]({'where':{'membername':_0x5eecb5[_0x74aa('0x2c')]},'individualHooks':!![]});}}else{throw new db[(_0x74aa('0x83'))][(_0x74aa('0x84'))](_0x74aa('0xe7'));}})[_0x74aa('0x1d')](function(){if(_0x5eecb5){return _0x5eecb5[_0x74aa('0xe8')]({'raw':!![]});}})[_0x74aa('0x1d')](function(_0x45ab28){if(_0x5eecb5){if(_0x45ab28){_0x5f0713=_0x45ab28;if(_0x5f0713[_0x74aa('0x45')]){var _0x44fe4c=_0x5f0713[_0x74aa('0x25')](function(_0x4fa9b8){var _0x36c6d3={'membername':_0x5eecb5[_0x74aa('0x2c')],'UserId':_0x5eecb5['id'],'queue_name':_0x4fa9b8['name'],'VoiceQueueId':_0x4fa9b8['id'],'interface':_0x4c96f7,'paused':_0x5eecb5['loginInPause']||![],'penalty':_0x4fa9b8[_0x74aa('0xe9')]||0x0};return db[_0x74aa('0xa2')][_0x74aa('0xa3')](_0x36c6d3);});return Promise[_0x74aa('0x4d')](_0x44fe4c);}}}})['then'](function(){if(_0x5eecb5){return db[_0x74aa('0xea')][_0x74aa('0x42')]({'where':{'membername':_0x5eecb5[_0x74aa('0x2c')],'exitAt':null}});}})[_0x74aa('0x1d')](function(_0xdfeb78){if(_0x5eecb5){var _0x3b9f7b=[];_0xdfeb78[_0x74aa('0xeb')](function(_0x31b816){_0x3b9f7b['push'](_0x31b816[_0x74aa('0x51')]({'exitAt':moment()['format'](_0x74aa('0xec'))}));});return Promise['all'](_0x3b9f7b);}})[_0x74aa('0x1d')](function(){if(_0x5eecb5){var _0x143b30=[];var _0x5f40bd=[];var _0x151e18=utils[_0x74aa('0xed')]();var _0x171377={'membername':_0x5eecb5[_0x74aa('0x2c')],'interface':_0x4c96f7,'enterAt':moment()[_0x74aa('0xa0')](_0x74aa('0xec')),'role':_0x5eecb5['role'],'internal':_0x5eecb5[_0x74aa('0x5c')]};_0x151e18['forEach'](function(_0x2a50ce){_0x143b30[_0x74aa('0x41')](_[_0x74aa('0xca')]({'channel':_0x2a50ce,'type':'LOGIN','data1':_0x1f1b98[_0x74aa('0x52')]['device'],'data2':_0x4c96f7},_0x171377));if(_0x5eecb5[_0x74aa('0x90')]){_0x5f40bd[_0x74aa('0x41')](_[_0x74aa('0xca')]({'channel':_0x2a50ce,'type':_0x74aa('0xee'),'data1':'LOGININPAUSE'},_0x171377));}});return db[_0x74aa('0xea')]['bulkCreate'](_0x143b30[_0x74aa('0xef')](_0x5f40bd),{'individualHooks':!![]});}})[_0x74aa('0x1d')](function(){if(_0x5eecb5){return _0x5eecb5[_0x74aa('0x51')]({'online':!![],'lastLoginAt':moment()[_0x74aa('0xa0')](_0x74aa('0xec')),'voicePause':_0x5eecb5['loginInPause']||![],'mailPause':_0x5eecb5['loginInPause']||![],'chatPause':_0x5eecb5[_0x74aa('0x90')]||![],'faxPause':_0x5eecb5['loginInPause']||![],'smsPause':_0x5eecb5[_0x74aa('0x90')]||![],'openchannelPause':_0x5eecb5[_0x74aa('0x90')]||![],'whatsappPause':_0x5eecb5[_0x74aa('0x90')]||![],'pauseType':_0x5eecb5[_0x74aa('0x90')]?'LOGININPAUSE':null,'interface':_0x4c96f7,'lastPauseAt':moment()[_0x74aa('0xa0')](_0x74aa('0xec'))});}})[_0x74aa('0x1d')](function(_0x37cc71){if(_0x1f1b98[_0x74aa('0xf0')]){return _0x516af9();}else{return Promise[_0x74aa('0xf1')](_0x37cc71)[_0x74aa('0x1d')](respondWithResult(_0x13a3ce,null));}})[_0x74aa('0x50')](handleError(_0x13a3ce,null));};exports['logout']=function(_0x2012c5,_0x4b3cf3){var _0x23a435;return db['User'][_0x74aa('0x53')]({'where':{'id':_0x2012c5[_0x74aa('0x54')]['id'],'role':_0x74aa('0x1e')},'attributes':['id','name','role']})[_0x74aa('0x1d')](handleEntityNotFound(_0x4b3cf3,null))[_0x74aa('0x1d')](function(_0x10b2fd){if(_0x10b2fd){_0x23a435=_0x10b2fd;return db[_0x74aa('0xa2')]['destroy']({'where':{'membername':_0x23a435['name']},'individualHooks':!![]});}})[_0x74aa('0x1d')](function(){return db[_0x74aa('0xea')][_0x74aa('0x42')]({'where':{'membername':_0x23a435[_0x74aa('0x2c')],'exitAt':null}});})[_0x74aa('0x1d')](function(_0x558d9d){var _0x3fda10=[];_0x558d9d[_0x74aa('0xeb')](function(_0x4225b6){_0x3fda10[_0x74aa('0x41')](_0x4225b6['update']({'exitAt':moment()[_0x74aa('0xa0')](_0x74aa('0xec'))}));});return Promise[_0x74aa('0x4d')](_0x3fda10);})['then'](function(){return _0x23a435[_0x74aa('0x51')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x74aa('0x1d')](respondWithResult(_0x4b3cf3,null))[_0x74aa('0x50')](handleError(_0x4b3cf3,null));};exports[_0x74aa('0xf2')]=function(_0x8c84ee,_0xc01715){var _0x4d7ed7;return db[_0x74aa('0xa2')][_0x74aa('0x51')]({'paused':0x1},{'where':{'UserId':_0x8c84ee[_0x74aa('0x54')]['id']},'individualHooks':!![]})[_0x74aa('0x1d')](function(){return db['User'][_0x74aa('0x53')]({'where':{'id':_0x8c84ee[_0x74aa('0x54')]['id'],'role':_0x74aa('0x1e')},'attributes':['id',_0x74aa('0x2c'),_0x74aa('0x27'),_0x74aa('0x5c'),_0x74aa('0x92'),_0x74aa('0xf3')]});})['then'](handleEntityNotFound(_0xc01715,null))[_0x74aa('0x1d')](function(_0x598905){if(_0x598905){_0x4d7ed7=_0x598905;return db[_0x74aa('0xea')][_0x74aa('0x42')]({'where':{'membername':_0x4d7ed7[_0x74aa('0x2c')],'type':_0x74aa('0xee'),'exitAt':null}});}})[_0x74aa('0x1d')](function(_0x94e9f1){if(_0x94e9f1['length']){var _0x1b2a82=moment()['format'](_0x74aa('0xec'));for(var _0x234b0d=0x0,_0x5f4756=_0x94e9f1['length'];_0x234b0d<_0x5f4756;_0x234b0d++){_0x94e9f1[_0x234b0d][_0x74aa('0xf4')]({'exitAt':_0x1b2a82});}}})[_0x74aa('0x1d')](function(){var _0x307a6c=[];var _0x1fe3f6=utils[_0x74aa('0xed')]();_0x1fe3f6[_0x74aa('0xeb')](function(_0x362e09){_0x307a6c[_0x74aa('0x41')]({'channel':_0x362e09,'membername':_0x4d7ed7[_0x74aa('0x2c')],'interface':_[_0x74aa('0x5d')](_0x4d7ed7['interface'])?util[_0x74aa('0xa0')](_0x74aa('0xa1'),_0x4d7ed7[_0x74aa('0x2c')]):_0x4d7ed7[_0x74aa('0x92')],'type':_0x74aa('0xee'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x8c84ee[_0x74aa('0x52')]['type']||_0x74aa('0xf5'),'role':_0x4d7ed7['role'],'internal':_0x4d7ed7[_0x74aa('0x5c')]});});return db[_0x74aa('0xea')][_0x74aa('0x7b')](_0x307a6c,{'individualHooks':!![]});})[_0x74aa('0x1d')](function(){return _0x4d7ed7['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x8c84ee[_0x74aa('0x52')]['type']||_0x74aa('0xf5'),'lastPauseAt':moment()['format'](_0x74aa('0xec'))});})[_0x74aa('0x1d')](respondWithResult(_0xc01715,null))[_0x74aa('0x50')](handleError(_0xc01715,null));};exports[_0x74aa('0xf6')]=function(_0x51a852,_0x48a52b){if(_0x51a852[_0x74aa('0x52')][_0x74aa('0x8f')]&&!utils['isValidChannel'](_0x51a852[_0x74aa('0x52')][_0x74aa('0x8f')])){throw new APIBadRequestError(util[_0x74aa('0xa0')](_0x74aa('0xf7'),_0x51a852['body'][_0x74aa('0x8f')]));}return db[_0x74aa('0x2e')]['find']({'where':{'id':_0x51a852['params']['id']},'attributes':['id','name',_0x74aa('0x27'),_0x74aa('0x5c'),_0x74aa('0x92'),_0x74aa('0xf3'),_0x74aa('0x91'),'mailPause',_0x74aa('0xf8'),_0x74aa('0xf9'),'openchannelPause','smsPause',_0x74aa('0xfa'),_0x74aa('0xfb'),'lastPauseAt']})[_0x74aa('0x1d')](function(_0x283440){if(!_0x283440){throw new APINotFoundError(util[_0x74aa('0xa0')](_0x74aa('0xfc'),_0x51a852[_0x74aa('0x54')]['id']));}return _0x283440[_0x74aa('0xf6')](_0x51a852[_0x74aa('0x52')][_0x74aa('0x8f')]);})[_0x74aa('0x1d')](respondWithResult(_0x48a52b,null))['catch'](APIHandleError(_0x48a52b));};exports[_0x74aa('0xfd')]=function(_0x13e369,_0xdae3f5){var _0x16c61e={};var _0x4fcf10={};var _0x2373c4;var _0x301514;return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x13e369['params']['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0xdae3f5,null))['then'](function(_0x7abf1c){if(_0x7abf1c){_0x2373c4=_0x7abf1c;_0x4fcf10[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db['Team'][_0x74aa('0x2f')]);_0x4fcf10['query']=_['keys'](_0x13e369['query']);_0x4fcf10['filters']=_['intersection'](_0x4fcf10['model'],_0x4fcf10[_0x74aa('0x3b')]);_0x16c61e[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x4fcf10[_0x74aa('0xc1')],qs['fields'](_0x13e369['query'][_0x74aa('0xc5')]));_0x16c61e[_0x74aa('0x40')]=_0x16c61e[_0x74aa('0x40')][_0x74aa('0x45')]?_0x16c61e[_0x74aa('0x40')]:_0x4fcf10['model'];_0x16c61e['order']=qs[_0x74aa('0xc7')](_0x13e369['query'][_0x74aa('0xc7')]);_0x16c61e[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_['pick'](_0x13e369[_0x74aa('0x3b')],_0x4fcf10[_0x74aa('0xc3')]));if(_0x13e369[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x16c61e['where']=_['merge'](_0x16c61e[_0x74aa('0xc9')],{'$or':_[_0x74aa('0x25')](_0x16c61e[_0x74aa('0x40')],function(_0x245a92){var _0x334c99={};_0x334c99[_0x245a92]={'$like':'%'+_0x13e369[_0x74aa('0x3b')]['filter']+'%'};return _0x334c99;})});}_0x16c61e=_[_0x74aa('0xca')]({},_0x16c61e,_0x13e369['options']);return _0x2373c4[_0x74aa('0xfd')](_0x16c61e);}})[_0x74aa('0x1d')](function(_0x1e02b4){if(_0x1e02b4){_0x301514=_0x1e02b4[_0x74aa('0x45')];if(!_0x13e369[_0x74aa('0x3b')][_0x74aa('0xbb')](_0x74aa('0xce'))){_0x16c61e[_0x74aa('0x19')]=qs[_0x74aa('0x19')](_0x13e369[_0x74aa('0x3b')]['limit']);_0x16c61e['offset']=qs[_0x74aa('0x17')](_0x13e369[_0x74aa('0x3b')]['offset']);}return _0x2373c4['getTeams'](_0x16c61e);}})['then'](function(_0x18648f){if(_0x18648f){return _0x18648f?{'count':_0x301514,'rows':_0x18648f}:null;}})['then'](respondWithResult(_0xdae3f5,null))['catch'](handleError(_0xdae3f5,null));};exports[_0x74aa('0xfe')]=function(_0x4f2185,_0xcf23b4){var _0x3aa09f=_0x4f2185[_0x74aa('0x54')]['id'];var _0xf21143=_0x4f2185['body']?_0x4f2185[_0x74aa('0x52')]['ids']:null;var _0x50f6d0=[];return Promise['resolve']()[_0x74aa('0x1d')](function(){if(!_0xf21143)throw new APIBadRequestError(_0x74aa('0xff'));})[_0x74aa('0x1d')](function(){return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x3aa09f}});})[_0x74aa('0x1d')](function(_0x3a33ae){if(!_0x3a33ae)throw new APINotFoundError(util[_0x74aa('0xa0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4f2185[_0x74aa('0x54')]['id']));return db[_0x74aa('0x5f')][_0x74aa('0x100')](function(_0x3be0f5){return _0x3a33ae['addTeams'](_0xf21143,{'transaction':_0x3be0f5})[_0x74aa('0x1d')](function(){return db['Team'][_0x74aa('0x42')]({'where':{'id':{'$in':_0xf21143}}});})[_0x74aa('0x1d')](function(_0x5d1db6){var _0x15d9ec=_[_0x74aa('0x25')](_0x5d1db6,function(_0x2c7828){return _0x2c7828[_0x74aa('0x101')]();});return Promise['all'](_0x15d9ec);})['then'](function(_0x5604cb){_0x50f6d0=_['flattenDeep'](_0x5604cb);var _0x800662=_[_0x74aa('0x25')](_0x50f6d0,function(_0xe0a4e2){return _0xe0a4e2[_0x74aa('0x102')](_0x3a33ae['id'],{'transaction':_0x3be0f5});});return Promise[_0x74aa('0x4d')](_0x800662);})['then'](function(){if(!_0x3a33ae[_0x74aa('0xf3')])return;var _0x2b9ec8=_[_0x74aa('0x33')](_0x50f6d0,function(_0x538ecd){return _0x538ecd[_0x74aa('0x103')](_0x74aa('0x8f'))===_0x74aa('0x104');});var _0x4d2b7c=_[_0x74aa('0x25')](_0x2b9ec8,function(_0x1dec8e){return db[_0x74aa('0xa2')][_0x74aa('0xa3')]({'membername':_0x3a33ae['name'],'UserId':_0x3a33ae['id'],'queue_name':_0x1dec8e[_0x74aa('0x2c')],'VoiceQueueId':_0x1dec8e['id'],'interface':_[_0x74aa('0x5d')](_0x3a33ae[_0x74aa('0x92')])?util['format'](_0x74aa('0xa1'),_0x3a33ae[_0x74aa('0x2c')]):_0x3a33ae[_0x74aa('0x92')],'paused':_0x3a33ae[_0x74aa('0x91')]||![],'penalty':_0x3a33ae[_0x74aa('0x98')]},{'transaction':_0x3be0f5});});return Promise[_0x74aa('0x4d')](_0x4d2b7c);})[_0x74aa('0x1d')](function(){return db[_0x74aa('0x105')]['findAll']({'where':{'teamId':{'$in':_0xf21143}}});})['then'](function(_0x3ea337){var _0x12237d=_[_0x74aa('0x25')](_0x3ea337,function(_0x997782){return db[_0x74aa('0x106')][_0x74aa('0x71')]({'UserId':_0x3a33ae['id'],'VoicePrefixId':_0x997782[_0x74aa('0x107')]},{'transaction':_0x3be0f5});});return Promise[_0x74aa('0x4d')](_0x12237d);});});})[_0x74aa('0x1d')](function(){for(var _0x13c4fa=0x0;_0x13c4fa<_0x50f6d0[_0x74aa('0x45')];_0x13c4fa++){var _0x3ec2bb=_0x50f6d0[_0x13c4fa][_0x74aa('0x103')](_0x74aa('0x8f'));var _0x36c044=_0x3ec2bb+_0x74aa('0x9b');socket[_0x74aa('0x1f')](_0x74aa('0x22')+_0x3ec2bb+_0x74aa('0x9c'),{'UserId':_0x3aa09f,['queueField']:_0x50f6d0[_0x13c4fa]['id']});}})[_0x74aa('0x1d')](respondWithStatusCode(_0xcf23b4,null))['catch'](APIHandleError(_0xcf23b4));};exports[_0x74aa('0x108')]=function(_0x5dc043,_0x1c4097){var _0x3cb059=_0x5dc043[_0x74aa('0x54')]['id'];var _0x489b72=null;if(_0x5dc043[_0x74aa('0x3b')]['ids']){_0x489b72=_['isArray'](_0x5dc043[_0x74aa('0x3b')][_0x74aa('0x57')])?_0x5dc043['query'][_0x74aa('0x57')]:[_0x5dc043[_0x74aa('0x3b')][_0x74aa('0x57')]];}var _0xf77217=[];return Promise[_0x74aa('0xf1')]()[_0x74aa('0x1d')](function(){if(!_0x489b72)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x74aa('0x1d')](function(){return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x3cb059}});})[_0x74aa('0x1d')](function(_0x527a17){if(!_0x527a17)throw new APINotFoundError(util[_0x74aa('0xa0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5dc043[_0x74aa('0x54')]['id']));return db[_0x74aa('0x5f')][_0x74aa('0x100')](function(_0x4618a6){return _0x527a17[_0x74aa('0x108')](_0x489b72,{'transaction':_0x4618a6})[_0x74aa('0x1d')](function(){return db[_0x74aa('0x109')][_0x74aa('0x42')]({'where':{'id':{'$in':_0x489b72}}});})[_0x74aa('0x1d')](function(_0x33e4b1){var _0x3e3594=_[_0x74aa('0x25')](_0x33e4b1,function(_0x41f0b7){return _0x41f0b7[_0x74aa('0x101')]();});return Promise[_0x74aa('0x4d')](_0x3e3594);})[_0x74aa('0x1d')](function(_0xac959c){_0xf77217=_['flattenDeep'](_0xac959c);var _0x1bace7=_[_0x74aa('0x25')](_0xf77217,function(_0x214efa){return _0x214efa['removeAgent'](_0x527a17['id'],{'transaction':_0x4618a6});});return Promise[_0x74aa('0x4d')](_0x1bace7);})[_0x74aa('0x1d')](function(){if(!_0x527a17[_0x74aa('0xf3')])return;var _0x29e7ea=_[_0x74aa('0x33')](_0xf77217,function(_0x400f51){return _0x400f51[_0x74aa('0x103')]('channel')===_0x74aa('0x104');});var _0x41a123=_[_0x74aa('0x25')](_0x29e7ea,function(_0x3ea2d5){return db[_0x74aa('0xa2')][_0x74aa('0x29')]({'where':{'VoiceQueueId':_0x3ea2d5['id'],'UserId':_0x527a17['id']},'transaction':_0x4618a6});});return Promise['all'](_0x41a123);})[_0x74aa('0x1d')](function(){return db[_0x74aa('0x105')][_0x74aa('0x42')]({'where':{'teamId':{'$in':_0x489b72}}});})[_0x74aa('0x1d')](function(_0x3e276f){var _0xa41635=_[_0x74aa('0x25')](_0x3e276f,function(_0x1c85f0){return db[_0x74aa('0x106')][_0x74aa('0x29')]({'where':{'UserId':_0x527a17['id'],'VoicePrefixId':_0x1c85f0[_0x74aa('0x107')]}},{'transaction':_0x4618a6});});return Promise['all'](_0xa41635);});});})['then'](function(){for(var _0x192e26=0x0;_0x192e26<_0xf77217[_0x74aa('0x45')];_0x192e26++){var _0x196ff4=_0xf77217[_0x192e26][_0x74aa('0x103')](_0x74aa('0x8f'));var _0x31bdf1=_0x196ff4+_0x74aa('0x9b');socket[_0x74aa('0x1f')](_0x74aa('0x22')+_0x196ff4+'Queue:remove',{'UserId':_0x3cb059,['queueField']:_0xf77217[_0x192e26]['id']});}})[_0x74aa('0x1d')](respondWithStatusCode(_0x1c4097,null))[_0x74aa('0x50')](APIHandleError(_0x1c4097));};exports[_0x74aa('0x10a')]=function(_0x287dbe,_0x58a9ab){var _0x3859dc={};var _0x4b328b={};var _0x258896;var _0x3eb1de;return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x287dbe['params']['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x58a9ab,null))[_0x74aa('0x1d')](function(_0x4c496d){if(_0x4c496d){_0x258896=_0x4c496d;_0x4b328b[_0x74aa('0xc1')]=_[_0x74aa('0xc2')](db[_0x74aa('0xbc')][_0x74aa('0x2f')]);_0x4b328b[_0x74aa('0x3b')]=_[_0x74aa('0xc2')](_0x287dbe[_0x74aa('0x3b')]);_0x4b328b[_0x74aa('0xc3')]=_[_0x74aa('0xc4')](_0x4b328b['model'],_0x4b328b['query']);_0x3859dc[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x4b328b[_0x74aa('0xc1')],qs['fields'](_0x287dbe[_0x74aa('0x3b')][_0x74aa('0xc5')]));_0x3859dc[_0x74aa('0x40')]=_0x3859dc['attributes'][_0x74aa('0x45')]?_0x3859dc['attributes']:_0x4b328b[_0x74aa('0xc1')];_0x3859dc[_0x74aa('0xc6')]=qs[_0x74aa('0xc7')](_0x287dbe[_0x74aa('0x3b')][_0x74aa('0xc7')]);_0x3859dc[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_[_0x74aa('0xc8')](_0x287dbe[_0x74aa('0x3b')],_0x4b328b['filters']));if(_0x287dbe[_0x74aa('0x3b')][_0x74aa('0x33')]){_0x3859dc['where']=_[_0x74aa('0xca')](_0x3859dc['where'],{'$or':_[_0x74aa('0x25')](_0x3859dc[_0x74aa('0x40')],function(_0x4c7514){var _0x3a3565={};_0x3a3565[_0x4c7514]={'$like':'%'+_0x287dbe[_0x74aa('0x3b')][_0x74aa('0x33')]+'%'};return _0x3a3565;})});}_0x3859dc=_[_0x74aa('0xca')]({},_0x3859dc,_0x287dbe['options']);return _0x258896['getLists'](_0x3859dc);}})[_0x74aa('0x1d')](function(_0x321410){if(_0x321410){_0x3eb1de=_0x321410[_0x74aa('0x45')];if(!_0x287dbe['query'][_0x74aa('0xbb')]('nolimit')){_0x3859dc[_0x74aa('0x19')]=qs[_0x74aa('0x19')](_0x287dbe[_0x74aa('0x3b')][_0x74aa('0x19')]);_0x3859dc[_0x74aa('0x17')]=qs['offset'](_0x287dbe[_0x74aa('0x3b')]['offset']);}return _0x258896[_0x74aa('0x10a')](_0x3859dc);}})[_0x74aa('0x1d')](function(_0x297003){if(_0x297003){return _0x297003?{'count':_0x3eb1de,'rows':_0x297003}:null;}})['then'](respondWithResult(_0x58a9ab,null))['catch'](handleError(_0x58a9ab,null));};exports[_0x74aa('0x10b')]=function(_0x57d371,_0x375ebd){var _0x26864b={};var _0x4fc8cc={};var _0x5f585a;return db[_0x74aa('0x2e')][_0x74aa('0x87')]({'where':{'id':_0x57d371[_0x74aa('0x54')]['id']}})[_0x74aa('0x1d')](handleEntityNotFound(_0x375ebd,null))[_0x74aa('0x1d')](function(_0x692418){if(_0x692418){_0x5f585a=_0x692418;_0x4fc8cc[_0x74aa('0xc1')]=_['keys'](db[_0x74aa('0x2e')]['rawAttributes']);_0x4fc8cc[_0x74aa('0x3b')]=_[_0x74aa('0xc2')](_0x57d371['query']);_0x4fc8cc[_0x74aa('0xc3')]=_['intersection'](_0x4fc8cc['model'],_0x4fc8cc[_0x74aa('0x3b')]);_0x26864b[_0x74aa('0x40')]=_[_0x74aa('0xc4')](_0x4fc8cc[_0x74aa('0xc1')],qs[_0x74aa('0xc5')](_0x57d371[_0x74aa('0x3b')]['fields']));_0x26864b['attributes']=_0x26864b[_0x74aa('0x40')][_0x74aa('0x45')]?_0x26864b[_0x74aa('0x40')]:_0x4fc8cc[_0x74aa('0xc1')];_0x26864b['order']=qs[_0x74aa('0xc7')](_0x57d371[_0x74aa('0x3b')][_0x74aa('0xc7')]);_0x26864b[_0x74aa('0xc9')]=qs[_0x74aa('0xc3')](_['pick'](_0x57d371[_0x74aa('0x3b')],_0x4fc8cc['filters']));if(_0x57d371[_0x74aa('0x3b')]['filter']){_0x26864b[_0x74aa('0xc9')]=_['merge'](_0x26864b['where'],{'$or':_[_0x74aa('0x25')](_0x26864b['attributes'],function(_0x29af7a){var _0x5f054f={};_0x5f054f[_0x29af7a]={'$like':'%'+_0x57d371['query'][_0x74aa('0x33')]+'%'};return _0x5f054f;})});}_0x26864b[_0x74aa('0xc1')]=db[_0x74aa('0x2e')];_0x26864b['as']=_0x74aa('0x7e');_0x26864b=_[_0x74aa('0xca')]({},_0x26864b,_0x57d371[_0x74aa('0xcb')]);return _0x5f585a['getVoiceQueues']({'include':[_0x26864b]});}})[_0x74aa('0x1d')](function(_0x405daf){if(_0x405daf){var _0x2f8d8c={},_0x1d58f6=[];for(var _0x581c32=0x0;_0x581c32<_0x405daf[_0x74aa('0x45')];_0x581c32+=0x1){for(var _0x10228d=0x0,_0x10d61b;_0x10228d<_0x405daf[_0x581c32]['Agents'][_0x74aa('0x45')];_0x10228d+=0x1){_0x10d61b=_0x405daf[_0x581c32][_0x74aa('0x7e')][_0x10228d][_0x74aa('0x9f')]({'plain':!![]});_0x2f8d8c[_0x10d61b['id']]=_0x10d61b;}}_0x2f8d8c=_[_0x74aa('0x10c')](_0x2f8d8c);for(var _0x32fb82=qs[_0x74aa('0x17')](_0x57d371['query'][_0x74aa('0x17')]);_0x32fb82<_0x2f8d8c[_0x74aa('0x45')]&&_0x1d58f6[_0x74aa('0x45')]=_0xafc7d5[_0xd482('0x4c')]){throw new Error(_0xd482('0x4d'));}})['then'](function(){if(_0x1bfbc5){return db[_0xd482('0x40')][_0xd482('0x41')]({'where':{'membername':_0x1bfbc5['name']},'individualHooks':!![]});}})['then'](function(){if(_0x1bfbc5){return _0x1bfbc5[_0xd482('0x4e')]({'raw':!![]});}})[_0xd482('0x18')](function(_0x112e6e){if(_0x1bfbc5){if(_0x112e6e){var _0x3ac270=[];_0x190c8b=_0x112e6e;if(_0x190c8b[_0xd482('0x28')]){for(var _0x5142b8=0x0;_0x5142b8<_0x190c8b['length'];_0x5142b8++){_0x3ac270[_0xd482('0x2a')](db['UserVoiceQueueRt']['upsert']({'membername':_0x1bfbc5[_0xd482('0x21')],'UserId':_0x1bfbc5['id'],'queue_name':_0x190c8b[_0x5142b8][_0xd482('0x21')],'VoiceQueueId':_0x190c8b[_0x5142b8]['id'],'interface':_0x27a535,'paused':_0x1bfbc5[_0xd482('0x48')]||![],'penalty':_0x190c8b[_0x5142b8][_0xd482('0x4f')]||0x0}));}return BPromise[_0xd482('0x44')](_0x3ac270);}}}})[_0xd482('0x18')](function(){if(_0x1bfbc5){return db[_0xd482('0x26')][_0xd482('0x11')]({'where':{'membername':_0x1bfbc5[_0xd482('0x21')],'exitAt':null}});}})[_0xd482('0x18')](function(_0x1fb320){if(_0x1bfbc5){if(_0x1fb320&&_0x1fb320[_0xd482('0x28')]){var _0x3d9891=[];_0x1fb320[_0xd482('0x42')](function(_0x50f754){_0x3d9891[_0xd482('0x2a')](_0x50f754['update']({'exitAt':moment()[_0xd482('0x23')](_0xd482('0x43'))}));});return BPromise[_0xd482('0x44')](_0x3d9891);}}})['then'](function(){if(_0x1bfbc5){var _0x743054=[];var _0x4bb16b=[];var _0x3c5f25=utils[_0xd482('0x29')]();var _0x270c9f={'membername':_0x1bfbc5[_0xd482('0x21')],'interface':_0x27a535,'enterAt':moment()[_0xd482('0x23')](_0xd482('0x43')),'role':_0x1bfbc5[_0xd482('0x22')],'internal':_0x1bfbc5[_0xd482('0x30')]};_0x3c5f25[_0xd482('0x42')](function(_0xae64e6){_0x743054[_0xd482('0x2a')](_[_0xd482('0x50')]({'channel':_0xae64e6,'type':_0xd482('0x51'),'data1':'callysquare','data2':_0x27a535},_0x270c9f));if(_0x1bfbc5['loginInPause']){_0x4bb16b[_0xd482('0x2a')](_[_0xd482('0x50')]({'channel':_0xae64e6,'type':_0xd482('0x27'),'data1':'LOGININPAUSE'},_0x270c9f));}});return db[_0xd482('0x26')][_0xd482('0x32')](_0x743054['concat'](_0x4bb16b),{'individualHooks':!![]});}})[_0xd482('0x18')](function(){if(_0x1bfbc5){return _0x1bfbc5['update']({'online':!![],'lastLoginAt':moment()[_0xd482('0x23')](_0xd482('0x43')),'voicePause':_0x1bfbc5['loginInPause']||![],'mailPause':_0x1bfbc5[_0xd482('0x48')]||![],'chatPause':_0x1bfbc5['loginInPause']||![],'faxPause':_0x1bfbc5[_0xd482('0x48')]||![],'smsPause':_0x1bfbc5[_0xd482('0x48')]||![],'openchannelPause':_0x1bfbc5['loginInPause']||![],'pauseType':_0x1bfbc5['loginInPause']?_0xd482('0x52'):null,'lastPauseAt':moment()[_0xd482('0x23')](_0xd482('0x43')),'interface':_0x27a535});}})[_0xd482('0x18')](function(_0x17915d){_0x4f6585(_0x17915d);})[_0xd482('0x1c')](function(_0x4bae88){_0x57c744(_0x1b52f0[_0xd482('0x1d')](0x1f4,_0x4bae88[_0xd482('0x1e')]));});});}; \ No newline at end of file +var _0xd4da=['redis','./user.socket','GetUser','User','options','raw','include','map','model','attributes','then','info','catch','error','message','ShowUser','find','where','stringify','internal','format','params','UserVoiceQueueRt','update','MemberReport','findAll','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','type','UnpauseUser','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','role','online','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','bulkCreate','concat','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','localhost','socket.io-emitter'];(function(_0x2e4ad6,_0x40e8d1){var _0x22d9c1=function(_0x4e562f){while(--_0x4e562f){_0x2e4ad6['push'](_0x2e4ad6['shift']());}};_0x22d9c1(++_0x40e8d1);}(_0xd4da,0xa5));var _0xad4d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd4da[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xad4d('0x0'));var util=require(_0xad4d('0x1'));var moment=require(_0xad4d('0x2'));var BPromise=require('bluebird');var Redis=require(_0xad4d('0x3'));var db=require(_0xad4d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad4d('0x5'))(_0xad4d('0x6'));var config=require(_0xad4d('0x7'));config['redis']=_[_0xad4d('0x8')](config['redis'],{'host':_0xad4d('0x9'),'port':0x18eb});var socket=require(_0xad4d('0xa'))(new Redis(config[_0xad4d('0xb')]));require(_0xad4d('0xc'))['register'](socket);exports[_0xad4d('0xd')]=function(_0x204050){var _0x2b6e41=this;return new Promise(function(_0x37781d,_0x3c5261){return db[_0xad4d('0xe')]['findAll']({'raw':_0x204050[_0xad4d('0xf')]?_0x204050['options'][_0xad4d('0x10')]===undefined?!![]:![]:!![],'where':_0x204050[_0xad4d('0xf')]?_0x204050['options']['where']||null:null,'attributes':_0x204050[_0xad4d('0xf')]?_0x204050[_0xad4d('0xf')]['attributes']||null:null,'limit':_0x204050[_0xad4d('0xf')]?_0x204050['options']['limit']||null:null,'include':_0x204050['options']?_0x204050[_0xad4d('0xf')][_0xad4d('0x11')]?_[_0xad4d('0x12')](_0x204050[_0xad4d('0xf')]['include'],function(_0x3f8a21){return{'model':db[_0x3f8a21[_0xad4d('0x13')]],'as':_0x3f8a21['as'],'attributes':_0x3f8a21[_0xad4d('0x14')],'include':_0x3f8a21[_0xad4d('0x11')]?_[_0xad4d('0x12')](_0x3f8a21['include'],function(_0x27435e){return{'model':db[_0x27435e[_0xad4d('0x13')]],'as':_0x27435e['as'],'attributes':_0x27435e[_0xad4d('0x14')],'include':_0x27435e[_0xad4d('0x11')]?_[_0xad4d('0x12')](_0x27435e['include'],function(_0x563ccf){return{'model':db[_0x563ccf[_0xad4d('0x13')]],'as':_0x563ccf['as'],'attributes':_0x563ccf[_0xad4d('0x14')]};}):[]};}):[]};}):[]:[]})[_0xad4d('0x15')](function(_0x5c6874){logger[_0xad4d('0x16')]('GetUser',_0x204050);logger['debug']('GetUser',_0x204050,JSON['stringify'](_0x5c6874));_0x37781d(_0x5c6874);})[_0xad4d('0x17')](function(_0x206c61){logger[_0xad4d('0x18')](_0xad4d('0xd'),_0x206c61[_0xad4d('0x19')],_0x204050);_0x3c5261(_0x2b6e41[_0xad4d('0x18')](0x1f4,_0x206c61[_0xad4d('0x19')]));});});};exports[_0xad4d('0x1a')]=function(_0x2ee03d){var _0x4aee34=this;return new Promise(function(_0x596921,_0x26284c){return db[_0xad4d('0xe')][_0xad4d('0x1b')]({'raw':_0x2ee03d[_0xad4d('0xf')]?_0x2ee03d[_0xad4d('0xf')][_0xad4d('0x10')]===undefined?!![]:![]:!![],'where':_0x2ee03d[_0xad4d('0xf')]?_0x2ee03d['options'][_0xad4d('0x1c')]||null:null,'attributes':_0x2ee03d[_0xad4d('0xf')]?_0x2ee03d[_0xad4d('0xf')]['attributes']||null:null,'include':_0x2ee03d[_0xad4d('0xf')]?_0x2ee03d[_0xad4d('0xf')]['include']?_['map'](_0x2ee03d[_0xad4d('0xf')][_0xad4d('0x11')],function(_0x2a6327){return{'model':db[_0x2a6327[_0xad4d('0x13')]],'as':_0x2a6327['as'],'attributes':_0x2a6327[_0xad4d('0x14')],'include':_0x2a6327[_0xad4d('0x11')]?_['map'](_0x2a6327['include'],function(_0x423180){return{'model':db[_0x423180[_0xad4d('0x13')]],'as':_0x423180['as'],'attributes':_0x423180[_0xad4d('0x14')],'include':_0x423180[_0xad4d('0x11')]?_[_0xad4d('0x12')](_0x423180[_0xad4d('0x11')],function(_0x548519){return{'model':db[_0x548519['model']],'as':_0x548519['as'],'attributes':_0x548519[_0xad4d('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1914ab){logger['info'](_0xad4d('0x1a'),_0x2ee03d);logger['debug'](_0xad4d('0x1a'),_0x2ee03d,JSON[_0xad4d('0x1d')](_0x1914ab));_0x596921(_0x1914ab);})[_0xad4d('0x17')](function(_0x4ea6fb){logger[_0xad4d('0x18')](_0xad4d('0x1a'),_0x4ea6fb['message'],_0x2ee03d);_0x26284c(_0x4aee34[_0xad4d('0x18')](0x1f4,_0x4ea6fb[_0xad4d('0x19')]));});});};exports['PauseUser']=function(_0x4b9f8c){var _0x38de76;return db['User'][_0xad4d('0x1b')]({'where':_0x4b9f8c[_0xad4d('0xf')][_0xad4d('0x1c')]||{},'attributes':['id','name','role',_0xad4d('0x1e'),'interface']})[_0xad4d('0x15')](function(_0x295b38){if(!_0x295b38){throw new Error(util[_0xad4d('0x1f')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4b9f8c[_0xad4d('0x20')]['id']));}_0x38de76=_0x295b38;return db[_0xad4d('0x21')][_0xad4d('0x22')]({'paused':0x1},{'where':{'UserId':_0x38de76['id']},'individualHooks':!![]});})['then'](function(){return db[_0xad4d('0x23')][_0xad4d('0x24')]({'where':{'membername':_0x38de76[_0xad4d('0x25')],'type':_0xad4d('0x26'),'exitAt':null}});})[_0xad4d('0x15')](function(_0xfba815){if(_0xfba815&&_0xfba815[_0xad4d('0x27')]){var _0x648002=moment()[_0xad4d('0x1f')](_0xad4d('0x28'));for(var _0x526d2a=0x0,_0x32de08=_0xfba815[_0xad4d('0x27')];_0x526d2a<_0x32de08;_0x526d2a++){_0xfba815[_0x526d2a][_0xad4d('0x29')]({'exitAt':_0x648002});}}})[_0xad4d('0x15')](function(){var _0x53c50e=[];var _0x25bf37=utils[_0xad4d('0x2a')]();_0x25bf37[_0xad4d('0x2b')](function(_0x366102){_0x53c50e[_0xad4d('0x2c')]({'channel':_0x366102,'membername':_0x38de76[_0xad4d('0x25')],'interface':_[_0xad4d('0x2d')](_0x38de76[_0xad4d('0x2e')])?util[_0xad4d('0x1f')](_0xad4d('0x2f'),_0x38de76['name']):_0x38de76[_0xad4d('0x2e')],'type':_0xad4d('0x26'),'enterAt':moment()[_0xad4d('0x1f')](_0xad4d('0x28')),'data1':_0x4b9f8c[_0xad4d('0x30')]['type']||_0xad4d('0x31'),'role':_0x38de76['role'],'internal':_0x38de76[_0xad4d('0x1e')],'uniqueid':_0x4b9f8c[_0xad4d('0x30')][_0xad4d('0x32')]||null});});return db[_0xad4d('0x23')]['bulkCreate'](_0x53c50e,{'individualHooks':!![]});})[_0xad4d('0x15')](function(){return _0x38de76['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4b9f8c[_0xad4d('0x30')][_0xad4d('0x33')]||_0xad4d('0x31'),'lastPauseAt':moment()[_0xad4d('0x1f')](_0xad4d('0x28'))});})[_0xad4d('0x17')](function(_0x5c5d60){throw _0x5c5d60;});};exports[_0xad4d('0x34')]=function(_0x17a8f0){return Promise[_0xad4d('0x35')]()['then'](function(){if(_0x17a8f0[_0xad4d('0x30')]['channel']&&!utils[_0xad4d('0x36')](_0x17a8f0['body'][_0xad4d('0x37')])){throw new Error(util['format'](_0xad4d('0x38'),_0x17a8f0['body'][_0xad4d('0x37')]));}return db['User'][_0xad4d('0x39')]({'where':_0x17a8f0['options'][_0xad4d('0x1c')]||{},'attributes':['id',_0xad4d('0x25'),_0xad4d('0x3a'),'internal','interface',_0xad4d('0x3b'),'voicePause','mailPause',_0xad4d('0x3c'),'faxPause',_0xad4d('0x3d'),_0xad4d('0x3e'),_0xad4d('0x3f'),_0xad4d('0x40'),_0xad4d('0x41')]});})[_0xad4d('0x15')](function(_0x1540e6){if(!_0x1540e6){throw new Error(util[_0xad4d('0x1f')]('User\x20with\x20id\x20%s\x20not\x20found',_0x17a8f0[_0xad4d('0x20')]['id']));}return _0x1540e6[_0xad4d('0x42')](_0x17a8f0[_0xad4d('0x30')][_0xad4d('0x37')],_0xad4d('0x43'));})[_0xad4d('0x17')](function(_0x449fbc){throw _0x449fbc;});};exports[_0xad4d('0x44')]=function(_0x224d47){var _0x52e538=this;return new Promise(function(_0x4ee971,_0x13e968){var _0x4aeb75;return db[_0xad4d('0xe')][_0xad4d('0x39')]({'where':_0x224d47[_0xad4d('0xf')]['where']||{},'attributes':['id',_0xad4d('0x25')]})[_0xad4d('0x15')](function(_0x22dcb9){if(_0x22dcb9){_0x4aeb75=_0x22dcb9;return db[_0xad4d('0x21')][_0xad4d('0x45')]({'where':{'membername':_0x4aeb75['name']},'individualHooks':!![]});}})['then'](function(){if(_0x4aeb75){return db['MemberReport'][_0xad4d('0x24')]({'where':{'membername':_0x4aeb75[_0xad4d('0x25')],'exitAt':null}});}})[_0xad4d('0x15')](function(_0x14fd6b){if(_0x4aeb75){if(_0x14fd6b&&_0x14fd6b[_0xad4d('0x27')]){var _0x20075a=[];_0x14fd6b['forEach'](function(_0xe9176){_0x20075a[_0xad4d('0x2c')](_0xe9176[_0xad4d('0x22')]({'exitAt':moment()[_0xad4d('0x1f')](_0xad4d('0x28'))}));});return BPromise[_0xad4d('0x46')](_0x20075a);}}})[_0xad4d('0x15')](function(){if(_0x4aeb75){return _0x4aeb75[_0xad4d('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x1e3485){_0x4ee971(_0x1e3485);})['catch'](function(_0x363742){_0x13e968(_0x52e538['error'](0x1f4,_0x363742[_0xad4d('0x19')]));});});};exports[_0xad4d('0x47')]=function(_0x152d44){var _0x412b7a=this;return new Promise(function(_0xb10111,_0x142046){var _0x6803e3;var _0x3ebfc9;var _0xebc5c4;var _0x270a06;return db[_0xad4d('0xe')]['findOne']({'where':_0x152d44[_0xad4d('0xf')][_0xad4d('0x1c')]||{},'attributes':['id',_0xad4d('0x25'),'role',_0xad4d('0x48'),_0xad4d('0x49'),'internal',_0xad4d('0x4a'),_0xad4d('0x2e')]})[_0xad4d('0x15')](function(_0x2f88fe){if(_0x2f88fe){_0x6803e3=_0x2f88fe;_0x270a06=_0x152d44['body']['interface']?_0x152d44[_0xad4d('0x30')]['interface']:util[_0xad4d('0x1f')]('SIP/%s',_0x6803e3['name']);return db[_0xad4d('0xe')][_0xad4d('0x4b')]({'where':{'role':_0xad4d('0x4c'),'online':!![],'id':{'$ne':_0x6803e3['id']}}});}})['then'](function(_0x1ecec1){if(_0x1ecec1){_0xebc5c4=_0x1ecec1;return require(_0xad4d('0x4d'))[_0xad4d('0x4e')]();}})[_0xad4d('0x15')](function(_0x4dfbc6){if(_0x4dfbc6&&_0x4dfbc6[_0xad4d('0x4f')]&&_0xebc5c4>=_0x4dfbc6['agents']){throw new Error(_0xad4d('0x50'));}})[_0xad4d('0x15')](function(){if(_0x6803e3){return db[_0xad4d('0x21')]['destroy']({'where':{'membername':_0x6803e3[_0xad4d('0x25')]},'individualHooks':!![]});}})[_0xad4d('0x15')](function(){if(_0x6803e3){return _0x6803e3['getVoiceQueues']({'raw':!![]});}})[_0xad4d('0x15')](function(_0x20257b){if(_0x6803e3){if(_0x20257b){var _0x160e5f=[];_0x3ebfc9=_0x20257b;if(_0x3ebfc9[_0xad4d('0x27')]){for(var _0x5d46a6=0x0;_0x5d46a6<_0x3ebfc9['length'];_0x5d46a6++){_0x160e5f[_0xad4d('0x2c')](db[_0xad4d('0x21')][_0xad4d('0x51')]({'membername':_0x6803e3['name'],'UserId':_0x6803e3['id'],'queue_name':_0x3ebfc9[_0x5d46a6][_0xad4d('0x25')],'VoiceQueueId':_0x3ebfc9[_0x5d46a6]['id'],'interface':_0x270a06,'paused':_0x6803e3[_0xad4d('0x4a')]||![],'penalty':_0x3ebfc9[_0x5d46a6][_0xad4d('0x52')]||0x0}));}return BPromise[_0xad4d('0x46')](_0x160e5f);}}}})[_0xad4d('0x15')](function(){if(_0x6803e3){return db[_0xad4d('0x23')][_0xad4d('0x24')]({'where':{'membername':_0x6803e3[_0xad4d('0x25')],'exitAt':null}});}})[_0xad4d('0x15')](function(_0x525a1d){if(_0x6803e3){if(_0x525a1d&&_0x525a1d[_0xad4d('0x27')]){var _0x5d5aaf=[];_0x525a1d['forEach'](function(_0x10ceb4){_0x5d5aaf[_0xad4d('0x2c')](_0x10ceb4['update']({'exitAt':moment()[_0xad4d('0x1f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xad4d('0x46')](_0x5d5aaf);}}})[_0xad4d('0x15')](function(){if(_0x6803e3){var _0x132515=[];var _0x3afa95=[];var _0x34aa54=utils[_0xad4d('0x2a')]();var _0x4c769a={'membername':_0x6803e3['name'],'interface':_0x270a06,'enterAt':moment()[_0xad4d('0x1f')](_0xad4d('0x28')),'role':_0x6803e3[_0xad4d('0x3a')],'internal':_0x6803e3[_0xad4d('0x1e')]};_0x34aa54['forEach'](function(_0x3d8aa1){_0x132515[_0xad4d('0x2c')](_[_0xad4d('0x53')]({'channel':_0x3d8aa1,'type':_0xad4d('0x54'),'data1':_0xad4d('0x55'),'data2':_0x270a06},_0x4c769a));if(_0x6803e3[_0xad4d('0x4a')]){_0x3afa95[_0xad4d('0x2c')](_['merge']({'channel':_0x3d8aa1,'type':_0xad4d('0x26'),'data1':'LOGININPAUSE'},_0x4c769a));}});return db[_0xad4d('0x23')][_0xad4d('0x56')](_0x132515[_0xad4d('0x57')](_0x3afa95),{'individualHooks':!![]});}})[_0xad4d('0x15')](function(){if(_0x6803e3){return _0x6803e3['update']({'online':!![],'lastLoginAt':moment()[_0xad4d('0x1f')](_0xad4d('0x28')),'voicePause':_0x6803e3['loginInPause']||![],'mailPause':_0x6803e3['loginInPause']||![],'chatPause':_0x6803e3[_0xad4d('0x4a')]||![],'faxPause':_0x6803e3[_0xad4d('0x4a')]||![],'smsPause':_0x6803e3['loginInPause']||![],'openchannelPause':_0x6803e3[_0xad4d('0x4a')]||![],'pauseType':_0x6803e3[_0xad4d('0x4a')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xad4d('0x1f')](_0xad4d('0x28')),'interface':_0x270a06});}})['then'](function(_0x43b65e){_0xb10111(_0x43b65e);})['catch'](function(_0x3392b3){_0x142046(_0x412b7a[_0xad4d('0x18')](0x1f4,_0x3392b3[_0xad4d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a843974..550e34c 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 _0xe114=['length','./user.events','save','remove','update','removeListener'];(function(_0x3c45b4,_0x1941cf){var _0x73361f=function(_0x1ab007){while(--_0x1ab007){_0x3c45b4['push'](_0x3c45b4['shift']());}};_0x73361f(++_0x1941cf);}(_0xe114,0x199));var _0x4e11=function(_0x323a54,_0x273b61){_0x323a54=_0x323a54-0x0;var _0x48ad04=_0xe114[_0x323a54];return _0x48ad04;};'use strict';var UserEvents=require(_0x4e11('0x0'));var events=[_0x4e11('0x1'),_0x4e11('0x2'),_0x4e11('0x3')];function createListener(_0x5501e6,_0xefaf9e){return function(_0x4415d2){_0xefaf9e['emit'](_0x5501e6,_0x4415d2);};}function removeListener(_0x579f44,_0xac8236){return function(){UserEvents[_0x4e11('0x4')](_0x579f44,_0xac8236);};}exports['register']=function(_0x2fc7ee){for(var _0x36baa8=0x0,_0x1179b0=events[_0x4e11('0x5')];_0x36baa8<_0x1179b0;_0x36baa8++){var _0x660368=events[_0x36baa8];var _0x243f41=createListener('user:'+_0x660368,_0x2fc7ee);UserEvents['on'](_0x660368,_0x243f41);}}; \ No newline at end of file +var _0xa095=['remove','update','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x3786dd,_0x5777fc){var _0x4c7a8e=function(_0x119047){while(--_0x119047){_0x3786dd['push'](_0x3786dd['shift']());}};_0x4c7a8e(++_0x5777fc);}(_0xa095,0xdf));var _0x5a09=function(_0x272ea6,_0x3f0673){_0x272ea6=_0x272ea6-0x0;var _0x43ef03=_0xa095[_0x272ea6];return _0x43ef03;};'use strict';var UserEvents=require(_0x5a09('0x0'));var events=[_0x5a09('0x1'),_0x5a09('0x2'),_0x5a09('0x3')];function createListener(_0x2c16df,_0x339ce4){return function(_0x51df00){_0x339ce4[_0x5a09('0x4')](_0x2c16df,_0x51df00);};}function removeListener(_0x16b43f,_0xca4089){return function(){UserEvents[_0x5a09('0x5')](_0x16b43f,_0xca4089);};}exports[_0x5a09('0x6')]=function(_0x40ce32){for(var _0x32e26f=0x0,_0x14fb15=events[_0x5a09('0x7')];_0x32e26f<_0x14fb15;_0x32e26f++){var _0x2bb3da=events[_0x32e26f];var _0x59ba23=createListener(_0x5a09('0x8')+_0x2bb3da,_0x40ce32);UserEvents['on'](_0x2bb3da,_0x59ba23);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c2f0041..ecb19f4 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(_0xb50e8b,_0x2272b4){var _0x53af14=function(_0x27483b){while(--_0x27483b){_0xb50e8b['push'](_0xb50e8b['shift']());}};_0x53af14(++_0x2272b4);}(_0xe706,0xa3));var _0x6e70=function(_0x25aaec,_0x159e5b){_0x25aaec=_0x25aaec-0x0;var _0x293c2f=_0xe706[_0x25aaec];return _0x293c2f;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x175da3,_0x2c89f2){var _0x45afc8=function(_0x1b862f){while(--_0x1b862f){_0x175da3['push'](_0x175da3['shift']());}};_0x45afc8(++_0x2c89f2);}(_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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f21ace0..fc5f7cc 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 _0x8412=['exports','sequelize'];(function(_0x169790,_0x48aa33){var _0x4d0f36=function(_0x2a848d){while(--_0x2a848d){_0x169790['push'](_0x169790['shift']());}};_0x4d0f36(++_0x48aa33);}(_0x8412,0xdf));var _0x2841=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x8412[_0x5471ec];return _0x121d4c;};'use strict';var Sequelize=require(_0x2841('0x0'));module[_0x2841('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8511=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8511,0xf0));var _0x1851=function(_0x59d839,_0x1b16b9){_0x59d839=_0x59d839-0x0;var _0x1e04cc=_0x8511[_0x59d839];return _0x1e04cc;};'use strict';var Sequelize=require(_0x1851('0x0'));module[_0x1851('0x1')]={'penalty':{'type':Sequelize[_0x1851('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 bc1275d..664381f 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 _0xdc39=['bluebird','path','../../config/environment','./userChatQueue.attributes','user_has_chat_queues','util','../../config/logger','moment'];(function(_0xc86912,_0x5eb4e9){var _0x5d6b9f=function(_0x5d4037){while(--_0x5d4037){_0xc86912['push'](_0xc86912['shift']());}};_0x5d6b9f(++_0x5eb4e9);}(_0xdc39,0x65));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9dc3('0x0'));var logger=require(_0x9dc3('0x1'))('api');var moment=require(_0x9dc3('0x2'));var BPromise=require(_0x9dc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dc3('0x4'));var rimraf=require('rimraf');var config=require(_0x9dc3('0x5'));var attributes=require(_0x9dc3('0x6'));module['exports']=function(_0x3c7ccf,_0x533f1e){return _0x3c7ccf['define']('UserChatQueue',attributes,{'tableName':_0x9dc3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3507=['exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x17698c,_0x3a3470){var _0x9d250c=function(_0x566484){while(--_0x566484){_0x17698c['push'](_0x17698c['shift']());}};_0x9d250c(++_0x3a3470);}(_0x3507,0x1b0));var _0x7350=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x3507[_0xf5d71c];return _0x5af672;};'use strict';var _=require(_0x7350('0x0'));var util=require(_0x7350('0x1'));var logger=require(_0x7350('0x2'))(_0x7350('0x3'));var moment=require(_0x7350('0x4'));var BPromise=require(_0x7350('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7350('0x6'));var rimraf=require('rimraf');var config=require(_0x7350('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x7350('0x8')]=function(_0x297e9a,_0x4c4150){return _0x297e9a[_0x7350('0x9')]('UserChatQueue',attributes,{'tableName':_0x7350('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 dec5554..1028856 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 _0xce38=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x440bf6,_0x31e6d9){var _0x2c0a6c=function(_0x19f22b){while(--_0x19f22b){_0x440bf6['push'](_0x440bf6['shift']());}};_0x2c0a6c(++_0x31e6d9);}(_0xce38,0x1a1));var _0x8ce3=function(_0x2a3b70,_0x137f86){_0x2a3b70=_0x2a3b70-0x0;var _0x376380=_0xce38[_0x2a3b70];return _0x376380;};'use strict';var _=require(_0x8ce3('0x0'));var util=require(_0x8ce3('0x1'));var moment=require(_0x8ce3('0x2'));var BPromise=require(_0x8ce3('0x3'));var rs=require(_0x8ce3('0x4'));var fs=require('fs');var Redis=require(_0x8ce3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ce3('0x6'));var logger=require(_0x8ce3('0x7'))(_0x8ce3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ce3('0x9')][_0x8ce3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17dde3,_0x4a5323,_0x1de3ba){return new BPromise(function(_0x5d8133,_0x171429){return client[_0x8ce3('0xb')](_0x17dde3,_0x1de3ba)[_0x8ce3('0xc')](function(_0x2cd060){logger[_0x8ce3('0xd')](_0x8ce3('0xe'),_0x4a5323,_0x8ce3('0xf'));logger[_0x8ce3('0x10')](_0x8ce3('0x11'),_0x4a5323,_0x8ce3('0xf'),JSON[_0x8ce3('0x12')](_0x2cd060));if(_0x2cd060[_0x8ce3('0x13')]){if(_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x14')]===0x1f4){logger[_0x8ce3('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4a5323,_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x15')]);return _0x171429(_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x15')]);}logger[_0x8ce3('0x13')](_0x8ce3('0xe'),_0x4a5323,_0x2cd060['error'][_0x8ce3('0x15')]);return _0x5d8133(_0x2cd060[_0x8ce3('0x13')][_0x8ce3('0x15')]);}else{logger[_0x8ce3('0xd')](_0x8ce3('0xe'),_0x4a5323,_0x8ce3('0xf'));_0x5d8133(_0x2cd060[_0x8ce3('0x16')][_0x8ce3('0x15')]);}})[_0x8ce3('0x17')](function(_0x300214){logger[_0x8ce3('0x13')](_0x8ce3('0xe'),_0x4a5323,_0x300214);_0x171429(_0x300214);});});} \ No newline at end of file +var _0xaf63=['error','code','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb21e66,_0x2e1601){var _0x12c178=function(_0x4d2c8b){while(--_0x4d2c8b){_0xb21e66['push'](_0xb21e66['shift']());}};_0x12c178(++_0x2e1601);}(_0xaf63,0x99));var _0x3af6=function(_0x364820,_0x41b9ab){_0x364820=_0x364820-0x0;var _0x539dcd=_0xaf63[_0x364820];return _0x539dcd;};'use strict';var _=require(_0x3af6('0x0'));var util=require(_0x3af6('0x1'));var moment=require(_0x3af6('0x2'));var BPromise=require(_0x3af6('0x3'));var rs=require(_0x3af6('0x4'));var fs=require('fs');var Redis=require(_0x3af6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3af6('0x6'))(_0x3af6('0x7'));var config=require('../../config/environment');var jayson=require(_0x3af6('0x8'));var client=jayson[_0x3af6('0x9')][_0x3af6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bc692,_0x27f0e7,_0x57edd3){return new BPromise(function(_0x2a407b,_0x495cc2){return client['request'](_0x5bc692,_0x57edd3)['then'](function(_0x4e1286){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x27f0e7,_0x3af6('0xb'));logger[_0x3af6('0xc')](_0x3af6('0xd'),_0x27f0e7,_0x3af6('0xb'),JSON[_0x3af6('0xe')](_0x4e1286));if(_0x4e1286['error']){if(_0x4e1286[_0x3af6('0xf')][_0x3af6('0x10')]===0x1f4){logger[_0x3af6('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x27f0e7,_0x4e1286[_0x3af6('0xf')][_0x3af6('0x11')]);return _0x495cc2(_0x4e1286[_0x3af6('0xf')][_0x3af6('0x11')]);}logger['error'](_0x3af6('0x12'),_0x27f0e7,_0x4e1286[_0x3af6('0xf')]['message']);return _0x2a407b(_0x4e1286[_0x3af6('0xf')][_0x3af6('0x11')]);}else{logger['info'](_0x3af6('0x12'),_0x27f0e7,_0x3af6('0xb'));_0x2a407b(_0x4e1286[_0x3af6('0x13')][_0x3af6('0x11')]);}})[_0x3af6('0x14')](function(_0x49a900){logger[_0x3af6('0xf')](_0x3af6('0x12'),_0x27f0e7,_0x49a900);_0x495cc2(_0x49a900);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 46552e6..396c89f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3ec5ab,_0x17b398){var _0x39e35e=function(_0x30d8a5){while(--_0x30d8a5){_0x3ec5ab['push'](_0x3ec5ab['shift']());}};_0x39e35e(++_0x17b398);}(_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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x38f6c6,_0x2af5f4){var _0x4fd1a5=function(_0x2ba610){while(--_0x2ba610){_0x38f6c6['push'](_0x38f6c6['shift']());}};_0x4fd1a5(++_0x2af5f4);}(_0x70e0,0x17b));var _0x070e=function(_0x10a440,_0x36fe59){_0x10a440=_0x10a440-0x0;var _0x5b734c=_0x70e0[_0x10a440];return _0x5b734c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2399947..132431f 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 _0x6890=['sequelize','exports','INTEGER','STRING'];(function(_0x55a802,_0x10ab3a){var _0x1a0461=function(_0x43d162){while(--_0x43d162){_0x55a802['push'](_0x55a802['shift']());}};_0x1a0461(++_0x10ab3a);}(_0x6890,0xfc));var _0x0689=function(_0x214c64,_0x3b91ac){_0x214c64=_0x214c64-0x0;var _0x2c7b20=_0x6890[_0x214c64];return _0x2c7b20;};'use strict';var Sequelize=require(_0x0689('0x0'));module[_0x0689('0x1')]={'penalty':{'type':Sequelize[_0x0689('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0689('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0689('0x3')]}}; \ No newline at end of file +var _0x09a3=['INTEGER','STRING','exports'];(function(_0x4ad227,_0x58c194){var _0x509bba=function(_0x5e2d00){while(--_0x5e2d00){_0x4ad227['push'](_0x4ad227['shift']());}};_0x509bba(++_0x58c194);}(_0x09a3,0x155));var _0x309a=function(_0x27a792,_0x47a814){_0x27a792=_0x27a792-0x0;var _0x139445=_0x09a3[_0x27a792];return _0x139445;};'use strict';var Sequelize=require('sequelize');module[_0x309a('0x0')]={'penalty':{'type':Sequelize[_0x309a('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x309a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x309a('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0897a44..da5e8c1 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 _0x1bf2=['../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x22e3ed,_0x3eb095){var _0x9213e8=function(_0x4278dd){while(--_0x4278dd){_0x22e3ed['push'](_0x22e3ed['shift']());}};_0x9213e8(++_0x3eb095);}(_0x1bf2,0x165));var _0x21bf=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x1bf2[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x21bf('0x0'));var util=require('util');var logger=require(_0x21bf('0x1'))('api');var moment=require('moment');var BPromise=require(_0x21bf('0x2'));var rp=require(_0x21bf('0x3'));var fs=require('fs');var path=require(_0x21bf('0x4'));var rimraf=require(_0x21bf('0x5'));var config=require(_0x21bf('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x21bf('0x7')]=function(_0x29a331,_0xa5e3a4){return _0x29a331[_0x21bf('0x8')](_0x21bf('0x9'),attributes,{'tableName':_0x21bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafae=['./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0xafae,0x6c));var _0xeafa=function(_0x2e61fe,_0x313e17){_0x2e61fe=_0x2e61fe-0x0;var _0x337302=_0xafae[_0x2e61fe];return _0x337302;};'use strict';var _=require(_0xeafa('0x0'));var util=require(_0xeafa('0x1'));var logger=require(_0xeafa('0x2'))(_0xeafa('0x3'));var moment=require(_0xeafa('0x4'));var BPromise=require(_0xeafa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeafa('0x6'));var rimraf=require(_0xeafa('0x7'));var config=require(_0xeafa('0x8'));var attributes=require(_0xeafa('0x9'));module['exports']=function(_0x2ee80e,_0x185489){return _0x2ee80e[_0xeafa('0xa')](_0xeafa('0xb'),attributes,{'tableName':_0xeafa('0xc'),'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 aad1cf6..3e3f84a 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 _0xba6e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x5143b7,_0x414ceb){var _0x4960a4=function(_0x5ac96a){while(--_0x5ac96a){_0x5143b7['push'](_0x5143b7['shift']());}};_0x4960a4(++_0x414ceb);}(_0xba6e,0x105));var _0xeba6=function(_0x5928e1,_0xca2bf0){_0x5928e1=_0x5928e1-0x0;var _0xe11fb9=_0xba6e[_0x5928e1];return _0xe11fb9;};'use strict';var _=require(_0xeba6('0x0'));var util=require(_0xeba6('0x1'));var moment=require(_0xeba6('0x2'));var BPromise=require(_0xeba6('0x3'));var rs=require(_0xeba6('0x4'));var fs=require('fs');var Redis=require(_0xeba6('0x5'));var db=require(_0xeba6('0x6'))['db'];var utils=require(_0xeba6('0x7'));var logger=require(_0xeba6('0x8'))(_0xeba6('0x9'));var config=require(_0xeba6('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeba6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aba13,_0x453dd9,_0x3173af){return new BPromise(function(_0x94b784,_0x56de6c){return client[_0xeba6('0xc')](_0x5aba13,_0x3173af)[_0xeba6('0xd')](function(_0x11e6ac){logger['info'](_0xeba6('0xe'),_0x453dd9,'request\x20sent');logger[_0xeba6('0xf')](_0xeba6('0x10'),_0x453dd9,_0xeba6('0x11'),JSON[_0xeba6('0x12')](_0x11e6ac));if(_0x11e6ac[_0xeba6('0x13')]){if(_0x11e6ac[_0xeba6('0x13')]['code']===0x1f4){logger[_0xeba6('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x453dd9,_0x11e6ac[_0xeba6('0x13')][_0xeba6('0x14')]);return _0x56de6c(_0x11e6ac['error'][_0xeba6('0x14')]);}logger[_0xeba6('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x453dd9,_0x11e6ac['error']['message']);return _0x94b784(_0x11e6ac['error'][_0xeba6('0x14')]);}else{logger[_0xeba6('0x15')](_0xeba6('0xe'),_0x453dd9,'request\x20sent');_0x94b784(_0x11e6ac[_0xeba6('0x16')][_0xeba6('0x14')]);}})[_0xeba6('0x17')](function(_0x81a6dd){logger[_0xeba6('0x13')](_0xeba6('0xe'),_0x453dd9,_0x81a6dd);_0x56de6c(_0x81a6dd);});});} \ No newline at end of file +var _0x0013=['jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x0013,0x1d9));var _0x3001=function(_0x179210,_0x14c175){_0x179210=_0x179210-0x0;var _0x46fa62=_0x0013[_0x179210];return _0x46fa62;};'use strict';var _=require('lodash');var util=require(_0x3001('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3001('0x1'));var fs=require('fs');var Redis=require(_0x3001('0x2'));var db=require(_0x3001('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3001('0x4'))(_0x3001('0x5'));var config=require(_0x3001('0x6'));var jayson=require(_0x3001('0x7'));var client=jayson['client'][_0x3001('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dee5e,_0x210212,_0x1ee9b5){return new BPromise(function(_0x3cb552,_0x4ce810){return client['request'](_0x1dee5e,_0x1ee9b5)[_0x3001('0x9')](function(_0x1adb73){logger[_0x3001('0xa')](_0x3001('0xb'),_0x210212,_0x3001('0xc'));logger[_0x3001('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x210212,_0x3001('0xc'),JSON[_0x3001('0xe')](_0x1adb73));if(_0x1adb73['error']){if(_0x1adb73[_0x3001('0xf')][_0x3001('0x10')]===0x1f4){logger[_0x3001('0xf')](_0x3001('0xb'),_0x210212,_0x1adb73[_0x3001('0xf')][_0x3001('0x11')]);return _0x4ce810(_0x1adb73[_0x3001('0xf')][_0x3001('0x11')]);}logger[_0x3001('0xf')](_0x3001('0xb'),_0x210212,_0x1adb73[_0x3001('0xf')][_0x3001('0x11')]);return _0x3cb552(_0x1adb73[_0x3001('0xf')][_0x3001('0x11')]);}else{logger[_0x3001('0xa')](_0x3001('0xb'),_0x210212,_0x3001('0xc'));_0x3cb552(_0x1adb73[_0x3001('0x12')][_0x3001('0x11')]);}})[_0x3001('0x13')](function(_0x17a304){logger[_0x3001('0xf')](_0x3001('0xb'),_0x210212,_0x17a304);_0x4ce810(_0x17a304);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 38db19c..e34a53c 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x99ee48,_0x30eaf3){var _0x44c023=function(_0x231bea){while(--_0x231bea){_0x99ee48['push'](_0x99ee48['shift']());}};_0x44c023(++_0x30eaf3);}(_0x70e0,0x17b));var _0x070e=function(_0x219651,_0x581d7a){_0x219651=_0x219651-0x0;var _0x1fc917=_0x70e0[_0x219651];return _0x1fc917;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xe4fcba,_0x5e0e43){var _0x21d782=function(_0x3a1c59){while(--_0x3a1c59){_0xe4fcba['push'](_0xe4fcba['shift']());}};_0x21d782(++_0x5e0e43);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xcb91[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c32736a..50c34c3 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 _0x74d6=['sequelize','exports','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x74d6,0xc9));var _0x674d=function(_0x34c716,_0x1c15f9){_0x34c716=_0x34c716-0x0;var _0x5c120a=_0x74d6[_0x34c716];return _0x5c120a;};'use strict';var Sequelize=require(_0x674d('0x0'));module[_0x674d('0x1')]={'penalty':{'type':Sequelize[_0x674d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x689c=['INTEGER'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x689c,0x9e));var _0xc689=function(_0x2a0450,_0x3602c1){_0x2a0450=_0x2a0450-0x0;var _0x6bd8d1=_0x689c[_0x2a0450];return _0x6bd8d1;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc689('0x0')],'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 e6f3e18..6f024e4 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 _0x497a=['rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3c203c,_0x1d236b){var _0x563942=function(_0xae459e){while(--_0xae459e){_0x3c203c['push'](_0x3c203c['shift']());}};_0x563942(++_0x1d236b);}(_0x497a,0x125));var _0xa497=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x497a[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xa497('0x0'));var util=require(_0xa497('0x1'));var logger=require(_0xa497('0x2'))(_0xa497('0x3'));var moment=require('moment');var BPromise=require(_0xa497('0x4'));var rp=require(_0xa497('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa497('0x6'));var config=require(_0xa497('0x7'));var attributes=require(_0xa497('0x8'));module[_0xa497('0x9')]=function(_0x912bd8,_0x5b12c0){return _0x912bd8[_0xa497('0xa')](_0xa497('0xb'),attributes,{'tableName':_0xa497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x048d=['rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','bluebird','path'];(function(_0x34d7b3,_0x583851){var _0x1b850a=function(_0x2e8941){while(--_0x2e8941){_0x34d7b3['push'](_0x34d7b3['shift']());}};_0x1b850a(++_0x583851);}(_0x048d,0x13a));var _0xd048=function(_0x47c985,_0x4d73b8){_0x47c985=_0x47c985-0x0;var _0x9f74f5=_0x048d[_0x47c985];return _0x9f74f5;};'use strict';var _=require(_0xd048('0x0'));var util=require(_0xd048('0x1'));var logger=require(_0xd048('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd048('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd048('0x4'));var rimraf=require(_0xd048('0x5'));var config=require('../../config/environment');var attributes=require(_0xd048('0x6'));module[_0xd048('0x7')]=function(_0x3b46b5,_0x13f2ef){return _0x3b46b5[_0xd048('0x8')](_0xd048('0x9'),attributes,{'tableName':_0xd048('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 915149c..e6debf1 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x3d3545,_0x42b645){var _0x141327=function(_0x4055e0){while(--_0x4055e0){_0x3d3545['push'](_0x3d3545['shift']());}};_0x141327(++_0x42b645);}(_0x4b84,0x1cc));var _0x44b8=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x4b84[_0x333fc8];return _0x432439;};'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')]('UserMailQueue,\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')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _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(_0x5b309f,_0x400aa9){var _0x1f1cb8=function(_0x2f4022){while(--_0x2f4022){_0x5b309f['push'](_0x5b309f['shift']());}};_0x1f1cb8(++_0x400aa9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4544c8,_0x5de2d7){_0x4544c8=_0x4544c8-0x0;var _0x5afe0e=_0x7fbe[_0x4544c8];return _0x5afe0e;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index abb5b6d..cb3bd1a 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 _0x2620=['./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x426b63,_0x3b4c07){var _0x1adcc0=function(_0x638c80){while(--_0x638c80){_0x426b63['push'](_0x426b63['shift']());}};_0x1adcc0(++_0x3b4c07);}(_0x2620,0x161));var _0x0262=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x2620[_0x11155f];return _0xd07e48;};'use strict';var multer=require(_0x0262('0x0'));var util=require('util');var path=require(_0x0262('0x1'));var timeout=require(_0x0262('0x2'));var express=require(_0x0262('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0262('0x4'));var interaction=require(_0x0262('0x5'));var config=require(_0x0262('0x6'));var controller=require(_0x0262('0x7'));router[_0x0262('0x8')]('/',auth[_0x0262('0x9')](),controller[_0x0262('0xa')]);module[_0x0262('0xb')]=router; \ No newline at end of file +var _0xa704=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','express'];(function(_0x32f5f7,_0x1fb429){var _0x6c175e=function(_0x6b10f2){while(--_0x6b10f2){_0x32f5f7['push'](_0x32f5f7['shift']());}};_0x6c175e(++_0x1fb429);}(_0xa704,0x88));var _0x4a70=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0xa704[_0x71cd05];return _0x59c9e7;};'use strict';var multer=require(_0x4a70('0x0'));var util=require(_0x4a70('0x1'));var path=require(_0x4a70('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a70('0x3'));var router=express[_0x4a70('0x4')]();var fs_extra=require(_0x4a70('0x5'));var auth=require(_0x4a70('0x6'));var interaction=require(_0x4a70('0x7'));var config=require(_0x4a70('0x8'));var controller=require(_0x4a70('0x9'));router[_0x4a70('0xa')]('/',auth[_0x4a70('0xb')](),controller[_0x4a70('0xc')]);module[_0x4a70('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 5c8ee3c..497452d 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 _0xf78c=['BOOLEAN','sequelize','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf78c,0x1c5));var _0xcf78=function(_0xee484f,_0x47a676){_0xee484f=_0xee484f-0x0;var _0x1a4b86=_0xf78c[_0xee484f];return _0x1a4b86;};'use strict';var Sequelize=require(_0xcf78('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xcf78('0x1')]},'recipientsId':{'type':Sequelize[_0xcf78('0x2')]},'recipientsDescription':{'type':Sequelize[_0xcf78('0x1')]},'beep':{'type':Sequelize[_0xcf78('0x3')]}}; \ No newline at end of file +var _0x0cbc=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2cd669,_0x29352c){var _0x1cc27c=function(_0x46041e){while(--_0x46041e){_0x2cd669['push'](_0x2cd669['shift']());}};_0x1cc27c(++_0x29352c);}(_0x0cbc,0x162));var _0xc0cb=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x0cbc[_0x2d89ce];return _0x3fad10;};'use strict';var Sequelize=require(_0xc0cb('0x0'));module[_0xc0cb('0x1')]={'body':{'type':Sequelize[_0xc0cb('0x2')]},'senderName':{'type':Sequelize[_0xc0cb('0x3')]},'recipientsId':{'type':Sequelize[_0xc0cb('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc0cb('0x3')]},'beep':{'type':Sequelize[_0xc0cb('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ae115c2..be3c7f1 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 _0xe2f8=['all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','forEach','recipient','emit','catch','Template','render','html','startCase','toLowerCase','User','union','ids','queue','replace','Queue'];(function(_0x54b7aa,_0x2c6d68){var _0x2c598f=function(_0x2b2616){while(--_0x2b2616){_0x54b7aa['push'](_0x54b7aa['shift']());}};_0x2c598f(++_0x2c6d68);}(_0xe2f8,0x1ee));var _0x8e2f=function(_0x44069e,_0x1f82f9){_0x44069e=_0x44069e-0x0;var _0xe9316e=_0xe2f8[_0x44069e];return _0xe9316e;};'use strict';var emlformat=require(_0x8e2f('0x0'));var rimraf=require(_0x8e2f('0x1'));var zipdir=require(_0x8e2f('0x2'));var jsonpatch=require(_0x8e2f('0x3'));var rp=require(_0x8e2f('0x4'));var moment=require('moment');var BPromise=require(_0x8e2f('0x5'));var Mustache=require(_0x8e2f('0x6'));var util=require(_0x8e2f('0x7'));var path=require('path');var sox=require(_0x8e2f('0x8'));var csv=require(_0x8e2f('0x9'));var ejs=require(_0x8e2f('0xa'));var fs=require('fs');var fs_extra=require(_0x8e2f('0xb'));var _=require(_0x8e2f('0xc'));var squel=require(_0x8e2f('0xd'));var crypto=require(_0x8e2f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e2f('0xf'));var toCsv=require(_0x8e2f('0x9'));var querystring=require(_0x8e2f('0x10'));var Papa=require('papaparse');var Redis=require(_0x8e2f('0x11'));var authService=require(_0x8e2f('0x12'));var qs=require(_0x8e2f('0x13'));var as=require(_0x8e2f('0x14'));var hardwareService=require(_0x8e2f('0x15'));var logger=require(_0x8e2f('0x16'))(_0x8e2f('0x17'));var utils=require(_0x8e2f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8e2f('0x19'));var db=require(_0x8e2f('0x1a'))['db'];config[_0x8e2f('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e2f('0x1b')]));require('./userNotification.socket')[_0x8e2f('0x1c')](socket);function respondWithStatusCode(_0x2d85e5,_0x11e52c){_0x11e52c=_0x11e52c||0xcc;return function(_0x180e60){if(_0x180e60){return _0x2d85e5[_0x8e2f('0x1d')](_0x11e52c);}return _0x2d85e5[_0x8e2f('0x1e')](_0x11e52c)[_0x8e2f('0x1f')]();};}function respondWithResult(_0x3aba48,_0x4d9e26){_0x4d9e26=_0x4d9e26||0xc8;return function(_0xc17d52){if(_0xc17d52){return _0x3aba48[_0x8e2f('0x1e')](_0x4d9e26)[_0x8e2f('0x20')](_0xc17d52);}};}function respondWithFilteredResult(_0x1cbe67,_0x1093bc){return function(_0x50924b){if(_0x50924b){var _0x176b84=typeof _0x1093bc['offset']===_0x8e2f('0x21')&&typeof _0x1093bc[_0x8e2f('0x22')]===_0x8e2f('0x21');var _0x23f841=_0x50924b[_0x8e2f('0x23')];var _0x1321a3=_0x176b84?0x0:_0x1093bc[_0x8e2f('0x24')];var _0x171077=_0x176b84?_0x50924b[_0x8e2f('0x23')]:_0x1093bc['offset']+_0x1093bc[_0x8e2f('0x22')];var _0x436e2b;if(_0x171077>=_0x23f841){_0x171077=_0x23f841;_0x436e2b=0xc8;}else{_0x436e2b=0xce;}_0x1cbe67[_0x8e2f('0x1e')](_0x436e2b);return _0x1cbe67[_0x8e2f('0x25')](_0x8e2f('0x26'),_0x1321a3+'-'+_0x171077+'/'+_0x23f841)[_0x8e2f('0x20')](_0x50924b);}return null;};}function patchUpdates(_0x3d46c8){return function(_0x3e3625){try{jsonpatch[_0x8e2f('0x27')](_0x3e3625,_0x3d46c8,!![]);}catch(_0x323158){return BPromise[_0x8e2f('0x28')](_0x323158);}return _0x3e3625['save']();};}function saveUpdates(_0x3bc1d5,_0x333f75){return function(_0x2bdc3c){if(_0x2bdc3c){return _0x2bdc3c[_0x8e2f('0x29')](_0x3bc1d5)[_0x8e2f('0x2a')](function(_0x2efeeb){return _0x2efeeb;});}return null;};}function removeEntity(_0x1c5009,_0x4e4885){return function(_0x3ca19d){if(_0x3ca19d){return _0x3ca19d[_0x8e2f('0x2b')]()['then'](function(){_0x1c5009[_0x8e2f('0x1e')](0xcc)[_0x8e2f('0x1f')]();});}};}function handleEntityNotFound(_0x4e4bd2,_0x264a7c){return function(_0xab960d){if(!_0xab960d){_0x4e4bd2[_0x8e2f('0x1d')](0x194);}return _0xab960d;};}function handleError(_0x342cb4,_0x59bb89){_0x59bb89=_0x59bb89||0x1f4;return function(_0x3f525f){logger[_0x8e2f('0x2c')](_0x3f525f[_0x8e2f('0x2d')]);if(_0x3f525f[_0x8e2f('0x2e')]){delete _0x3f525f[_0x8e2f('0x2e')];}_0x342cb4[_0x8e2f('0x1e')](_0x59bb89)['send'](_0x3f525f);};}exports[_0x8e2f('0x2f')]=function(_0x1bbc14,_0x3f8d90,_0x4d4263){if(!_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')](_0x8e2f('0x32'))&&!_0x1bbc14['body'][_0x8e2f('0x31')](_0x8e2f('0x33'))){throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')](_0x8e2f('0x33'))&&!_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')](_0x8e2f('0x36'))){throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))](_0x8e2f('0x37'));}if(!_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x31')]('recipients')){throw new db[(_0x8e2f('0x34'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x28160e=JSON['parse'](_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x38')]);}catch(_0x514e6c){logger[_0x8e2f('0x2c')](_0x514e6c);throw new db['Sequelize']['ValidationError'](_0x8e2f('0x39'));}var _0x5c0d97=[_0x8e2f('0x3a'),_0x8e2f('0x3b'),_0x8e2f('0x3c'),_0x8e2f('0x3d'),'smsqueue',_0x8e2f('0x3e'),_0x8e2f('0x3f'),_0x8e2f('0x40'),'user'];if(_[_0x8e2f('0x41')](_0x28160e,function(_0x2f2b79){return!_[_0x8e2f('0x42')](_0x5c0d97,_0x2f2b79[_0x8e2f('0x43')]['toLowerCase']());})){throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))](_0x8e2f('0x44'));}}}var _0x541f06={};_0x541f06['senderName']=_0x1bbc14['body']['hasOwnProperty'](_0x8e2f('0x45'))?_0x1bbc14[_0x8e2f('0x30')]['senderName']:_0x1bbc14[_0x8e2f('0x46')]['fullname'];_0x541f06[_0x8e2f('0x47')]=_['isEmpty'](_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x47')])?null:_0x1bbc14['body'][_0x8e2f('0x47')];_0x541f06[_0x8e2f('0x48')]=_0x1bbc14[_0x8e2f('0x30')][_0x8e2f('0x48')]||![];_0x541f06[_0x8e2f('0x49')]=_0x1bbc14[_0x8e2f('0x46')]['id'];return getContent(_0x1bbc14[_0x8e2f('0x30')])[_0x8e2f('0x2a')](function(_0x387326){_0x541f06[_0x8e2f('0x30')]=_0x387326;return getRecipients(_0x28160e);})[_0x8e2f('0x2a')](function(_0x3dfc12){_0x541f06[_0x8e2f('0x4a')]=_[_0x8e2f('0x4b')](_0x3dfc12)[_0x8e2f('0x4c')](',');return db['sequelize'][_0x8e2f('0x4d')](function(_0x1d9466){return db[_0x8e2f('0x4e')]['create'](_0x541f06,{'raw':!![],'transaction':_0x1d9466})[_0x8e2f('0x2a')](function(_0x5df6e3){var _0x25fefd={'sender':_0x541f06['senderName'],'description':_0x541f06[_0x8e2f('0x47')],'content':_0x541f06[_0x8e2f('0x30')],'beep':_0x541f06['beep']};_0x3dfc12[_0x8e2f('0x4f')](function(_0x115d7f){_0x25fefd[_0x8e2f('0x50')]=_0x115d7f;socket[_0x8e2f('0x51')]('userNotification:send',_0x25fefd);});return _0x5df6e3;});});})[_0x8e2f('0x2a')](respondWithResult(_0x3f8d90,0xc9))[_0x8e2f('0x52')](handleError(_0x3f8d90,null));};function getContent(_0x3d2588){return new BPromise(function(_0x42ceab,_0x478aed){if(_0x3d2588[_0x8e2f('0x32')]){_0x42ceab(_0x3d2588[_0x8e2f('0x32')]);return;}return db[_0x8e2f('0x53')]['findOne']({'attributes':['html'],'where':{'id':_0x3d2588[_0x8e2f('0x33')]},'raw':!![]})[_0x8e2f('0x2a')](function(_0x5a4b1f){if(!_0x5a4b1f)throw new db[(_0x8e2f('0x34'))][(_0x8e2f('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x492f31=Mustache[_0x8e2f('0x54')](_0x5a4b1f[_0x8e2f('0x55')],_0x3d2588[_0x8e2f('0x36')]);_0x42ceab(_0x492f31);})[_0x8e2f('0x52')](function(_0x580ebb){_0x478aed(_0x580ebb);});});}function getRecipients(_0x35ced4){return new BPromise(function(_0x32c951,_0x545eb4){var _0x3fa873=[];var _0x32a0d0=[];_0x35ced4[_0x8e2f('0x4f')](function(_0x194f77){var _0x119359=_[_0x8e2f('0x56')](_0x194f77[_0x8e2f('0x43')][_0x8e2f('0x57')]());if(_0x119359===_0x8e2f('0x58')){_0x3fa873=_[_0x8e2f('0x59')](_0x3fa873,_0x194f77[_0x8e2f('0x5a')]);}else{if(_[_0x8e2f('0x42')](_0x119359,_0x8e2f('0x5b')))_0x119359=_0x119359[_0x8e2f('0x5c')](_0x8e2f('0x5b'),_0x8e2f('0x5d'));_0x194f77['ids'][_0x8e2f('0x4f')](function(_0x308abe){_0x32a0d0['push'](getAgents(_0x119359,_0x308abe));});}});return BPromise[_0x8e2f('0x5e')](_0x32a0d0)[_0x8e2f('0x2a')](function(_0x4a37a3){_0x3fa873=_['union'](_0x3fa873,_[_0x8e2f('0x5f')](_0x4a37a3));_0x32c951(_0x3fa873);})[_0x8e2f('0x52')](function(_0xe1d32b){_0x545eb4(_0xe1d32b);});});}function getAgents(_0x530299,_0x2ecca4){return new BPromise(function(_0x29129a,_0x192387){return db[_0x530299]['findOne']({'where':{'id':_0x2ecca4}})['then'](function(_0x28883c){return _0x28883c[_0x8e2f('0x60')]({'attributes':['id'],'raw':!![]})[_0x8e2f('0x2a')](function(_0x46000c){var _0x59834f=_[_0x8e2f('0x61')](_0x46000c,'id');_0x29129a(_0x59834f);});})[_0x8e2f('0x52')](function(_0x4d9895){_0x192387(_0x4d9895);});});} \ No newline at end of file +var _0x6a39=['flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','chatqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','User','union','includes','queue','Queue','ids','push','all'];(function(_0x38f47d,_0x15944b){var _0x54ebe6=function(_0x16923d){while(--_0x16923d){_0x38f47d['push'](_0x38f47d['shift']());}};_0x54ebe6(++_0x15944b);}(_0x6a39,0xc7));var _0x96a3=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0x6a39[_0x326c48];return _0xf71bc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x96a3('0x0'));var zipdir=require(_0x96a3('0x1'));var jsonpatch=require(_0x96a3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x96a3('0x3'));var util=require(_0x96a3('0x4'));var path=require(_0x96a3('0x5'));var sox=require(_0x96a3('0x6'));var csv=require(_0x96a3('0x7'));var ejs=require(_0x96a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96a3('0x9'));var squel=require(_0x96a3('0xa'));var crypto=require(_0x96a3('0xb'));var jsforce=require(_0x96a3('0xc'));var deskjs=require(_0x96a3('0xd'));var toCsv=require(_0x96a3('0x7'));var querystring=require('querystring');var Papa=require(_0x96a3('0xe'));var Redis=require(_0x96a3('0xf'));var authService=require(_0x96a3('0x10'));var qs=require(_0x96a3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96a3('0x12'));var logger=require(_0x96a3('0x13'))(_0x96a3('0x14'));var utils=require(_0x96a3('0x15'));var config=require(_0x96a3('0x16'));var licenseUtil=require(_0x96a3('0x17'));var db=require(_0x96a3('0x18'))['db'];config[_0x96a3('0x19')]=_[_0x96a3('0x1a')](config[_0x96a3('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x96a3('0x1b'))(new Redis(config[_0x96a3('0x19')]));require(_0x96a3('0x1c'))[_0x96a3('0x1d')](socket);function respondWithStatusCode(_0x23541c,_0x5d1b6d){_0x5d1b6d=_0x5d1b6d||0xcc;return function(_0x1670e3){if(_0x1670e3){return _0x23541c[_0x96a3('0x1e')](_0x5d1b6d);}return _0x23541c[_0x96a3('0x1f')](_0x5d1b6d)['end']();};}function respondWithResult(_0xc5e331,_0x163351){_0x163351=_0x163351||0xc8;return function(_0x4621f8){if(_0x4621f8){return _0xc5e331[_0x96a3('0x1f')](_0x163351)[_0x96a3('0x20')](_0x4621f8);}};}function respondWithFilteredResult(_0x22d941,_0x506594){return function(_0x14f5b7){if(_0x14f5b7){var _0x5db8ac=typeof _0x506594[_0x96a3('0x21')]===_0x96a3('0x22')&&typeof _0x506594[_0x96a3('0x23')]===_0x96a3('0x22');var _0x167dd2=_0x14f5b7[_0x96a3('0x24')];var _0x4f2b11=_0x5db8ac?0x0:_0x506594[_0x96a3('0x21')];var _0x21967e=_0x5db8ac?_0x14f5b7[_0x96a3('0x24')]:_0x506594[_0x96a3('0x21')]+_0x506594[_0x96a3('0x23')];var _0x3e662b;if(_0x21967e>=_0x167dd2){_0x21967e=_0x167dd2;_0x3e662b=0xc8;}else{_0x3e662b=0xce;}_0x22d941['status'](_0x3e662b);return _0x22d941[_0x96a3('0x25')](_0x96a3('0x26'),_0x4f2b11+'-'+_0x21967e+'/'+_0x167dd2)[_0x96a3('0x20')](_0x14f5b7);}return null;};}function patchUpdates(_0x435d1e){return function(_0x31a5af){try{jsonpatch['apply'](_0x31a5af,_0x435d1e,!![]);}catch(_0x5c770c){return BPromise['reject'](_0x5c770c);}return _0x31a5af[_0x96a3('0x27')]();};}function saveUpdates(_0x347335,_0x413d1f){return function(_0x392509){if(_0x392509){return _0x392509[_0x96a3('0x28')](_0x347335)[_0x96a3('0x29')](function(_0x28dc0b){return _0x28dc0b;});}return null;};}function removeEntity(_0x5e2f8f,_0x3f81d6){return function(_0x5e2e23){if(_0x5e2e23){return _0x5e2e23['destroy']()[_0x96a3('0x29')](function(){_0x5e2f8f[_0x96a3('0x1f')](0xcc)[_0x96a3('0x2a')]();});}};}function handleEntityNotFound(_0x4fa257,_0x575cae){return function(_0x32d5e6){if(!_0x32d5e6){_0x4fa257[_0x96a3('0x1e')](0x194);}return _0x32d5e6;};}function handleError(_0xe8b3a3,_0x3fde18){_0x3fde18=_0x3fde18||0x1f4;return function(_0x5caafa){logger['error'](_0x5caafa['stack']);if(_0x5caafa[_0x96a3('0x2b')]){delete _0x5caafa[_0x96a3('0x2b')];}_0xe8b3a3[_0x96a3('0x1f')](_0x3fde18)[_0x96a3('0x2c')](_0x5caafa);};}exports[_0x96a3('0x2d')]=function(_0x297652,_0x1d15dd,_0x192b56){if(!_0x297652['body'][_0x96a3('0x2e')]('text')&&!_0x297652[_0x96a3('0x2f')][_0x96a3('0x2e')](_0x96a3('0x30'))){throw new db[(_0x96a3('0x31'))][(_0x96a3('0x32'))](_0x96a3('0x33'));}else{if(_0x297652[_0x96a3('0x2f')]['hasOwnProperty'](_0x96a3('0x30'))&&!_0x297652[_0x96a3('0x2f')][_0x96a3('0x2e')]('view')){throw new db[(_0x96a3('0x31'))][(_0x96a3('0x32'))](_0x96a3('0x34'));}if(!_0x297652[_0x96a3('0x2f')][_0x96a3('0x2e')](_0x96a3('0x35'))){throw new db[(_0x96a3('0x31'))][(_0x96a3('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x214bd0=JSON[_0x96a3('0x36')](_0x297652[_0x96a3('0x2f')]['recipients']);}catch(_0x45a8b7){logger[_0x96a3('0x37')](_0x45a8b7);throw new db['Sequelize'][(_0x96a3('0x32'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5c77c9=[_0x96a3('0x38'),'faxqueue',_0x96a3('0x39'),_0x96a3('0x3a'),_0x96a3('0x3b'),'voicequeue',_0x96a3('0x3c'),_0x96a3('0x3d'),_0x96a3('0x3e')];if(_['some'](_0x214bd0,function(_0x4b367b){return!_['includes'](_0x5c77c9,_0x4b367b[_0x96a3('0x3f')][_0x96a3('0x40')]());})){throw new db[(_0x96a3('0x31'))][(_0x96a3('0x32'))](_0x96a3('0x41'));}}}var _0x85816b={};_0x85816b[_0x96a3('0x42')]=_0x297652['body'][_0x96a3('0x2e')](_0x96a3('0x42'))?_0x297652['body'][_0x96a3('0x42')]:_0x297652[_0x96a3('0x3e')]['fullname'];_0x85816b[_0x96a3('0x43')]=_[_0x96a3('0x44')](_0x297652[_0x96a3('0x2f')][_0x96a3('0x43')])?null:_0x297652['body'][_0x96a3('0x43')];_0x85816b['beep']=_0x297652[_0x96a3('0x2f')][_0x96a3('0x45')]||![];_0x85816b['SenderId']=_0x297652['user']['id'];return getContent(_0x297652['body'])['then'](function(_0x111d52){_0x85816b['body']=_0x111d52;return getRecipients(_0x214bd0);})['then'](function(_0x4a2824){_0x85816b[_0x96a3('0x46')]=_['sortBy'](_0x4a2824)[_0x96a3('0x47')](',');return db[_0x96a3('0x48')]['transaction'](function(_0xa42268){return db[_0x96a3('0x49')][_0x96a3('0x4a')](_0x85816b,{'raw':!![],'transaction':_0xa42268})[_0x96a3('0x29')](function(_0x4e6437){var _0x3185e9={'sender':_0x85816b[_0x96a3('0x42')],'description':_0x85816b['recipientsDescription'],'content':_0x85816b[_0x96a3('0x2f')],'beep':_0x85816b[_0x96a3('0x45')]};_0x4a2824[_0x96a3('0x4b')](function(_0x547f82){_0x3185e9[_0x96a3('0x4c')]=_0x547f82;socket[_0x96a3('0x4d')](_0x96a3('0x4e'),_0x3185e9);});return _0x4e6437;});});})['then'](respondWithResult(_0x1d15dd,0xc9))[_0x96a3('0x4f')](handleError(_0x1d15dd,null));};function getContent(_0x1150e6){return new BPromise(function(_0x290774,_0x3697ef){if(_0x1150e6['text']){_0x290774(_0x1150e6[_0x96a3('0x50')]);return;}return db[_0x96a3('0x51')][_0x96a3('0x52')]({'attributes':[_0x96a3('0x53')],'where':{'id':_0x1150e6[_0x96a3('0x30')]},'raw':!![]})[_0x96a3('0x29')](function(_0x16c0c3){if(!_0x16c0c3)throw new db[(_0x96a3('0x31'))][(_0x96a3('0x32'))](_0x96a3('0x54'));var _0x16ed0d=Mustache['render'](_0x16c0c3[_0x96a3('0x53')],_0x1150e6[_0x96a3('0x55')]);_0x290774(_0x16ed0d);})[_0x96a3('0x4f')](function(_0x445630){_0x3697ef(_0x445630);});});}function getRecipients(_0x1016f9){return new BPromise(function(_0x958ce9,_0x560c0d){var _0x5aec69=[];var _0x27483b=[];_0x1016f9[_0x96a3('0x4b')](function(_0x4d9a84){var _0x30f67a=_[_0x96a3('0x56')](_0x4d9a84[_0x96a3('0x3f')][_0x96a3('0x40')]());if(_0x30f67a===_0x96a3('0x57')){_0x5aec69=_[_0x96a3('0x58')](_0x5aec69,_0x4d9a84['ids']);}else{if(_[_0x96a3('0x59')](_0x30f67a,_0x96a3('0x5a')))_0x30f67a=_0x30f67a['replace'](_0x96a3('0x5a'),_0x96a3('0x5b'));_0x4d9a84[_0x96a3('0x5c')][_0x96a3('0x4b')](function(_0x2863a7){_0x27483b[_0x96a3('0x5d')](getAgents(_0x30f67a,_0x2863a7));});}});return BPromise[_0x96a3('0x5e')](_0x27483b)[_0x96a3('0x29')](function(_0x1638b2){_0x5aec69=_[_0x96a3('0x58')](_0x5aec69,_[_0x96a3('0x5f')](_0x1638b2));_0x958ce9(_0x5aec69);})[_0x96a3('0x4f')](function(_0xbcae1e){_0x560c0d(_0xbcae1e);});});}function getAgents(_0x5abde7,_0x29176c){return new BPromise(function(_0x50d52a,_0x1ad57f){return db[_0x5abde7][_0x96a3('0x52')]({'where':{'id':_0x29176c}})[_0x96a3('0x29')](function(_0x4f44f3){return _0x4f44f3[_0x96a3('0x60')]({'attributes':['id'],'raw':!![]})[_0x96a3('0x29')](function(_0x4f720f){var _0xeae3c=_[_0x96a3('0x61')](_0x4f720f,'id');_0x50d52a(_0xeae3c);});})[_0x96a3('0x4f')](function(_0x3b52b7){_0x1ad57f(_0x3b52b7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 12392cb..62d7e7f 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 _0x0057=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0057,0x19c));var _0x7005=function(_0x5ba72b,_0x2857bf){_0x5ba72b=_0x5ba72b-0x0;var _0x5d9386=_0x0057[_0x5ba72b];return _0x5d9386;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x7005('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7005('0x1')](0x0);var events={'afterCreate':_0x7005('0x2'),'afterUpdate':_0x7005('0x3'),'afterDestroy':_0x7005('0x4')};function emitEvent(_0x56a76d){return function(_0x1bd6c4,_0x406ab2,_0x49eedb){UserNotificationEvents[_0x7005('0x5')](_0x56a76d+':'+_0x1bd6c4['id'],_0x1bd6c4);UserNotificationEvents[_0x7005('0x5')](_0x56a76d,_0x1bd6c4);_0x49eedb(null);};}for(var e in events){if(events[_0x7005('0x6')](e)){var event=events[e];UserNotification[_0x7005('0x7')](e,emitEvent(event));}}module[_0x7005('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x493e=['exports','events','../../mysqldb','UserNotification','save','remove','emit','hook'];(function(_0x2a6991,_0xb054dc){var _0x8680f5=function(_0x1f6cdf){while(--_0x1f6cdf){_0x2a6991['push'](_0x2a6991['shift']());}};_0x8680f5(++_0xb054dc);}(_0x493e,0x1c1));var _0xe493=function(_0x3eeba3,_0x12ee75){_0x3eeba3=_0x3eeba3-0x0;var _0x6c6f1f=_0x493e[_0x3eeba3];return _0x6c6f1f;};'use strict';var EventEmitter=require(_0xe493('0x0'));var UserNotification=require(_0xe493('0x1'))['db'][_0xe493('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe493('0x3'),'afterUpdate':'update','afterDestroy':_0xe493('0x4')};function emitEvent(_0x5d3fe9){return function(_0x214a2d,_0x125c6f,_0x17fb51){UserNotificationEvents[_0xe493('0x5')](_0x5d3fe9+':'+_0x214a2d['id'],_0x214a2d);UserNotificationEvents[_0xe493('0x5')](_0x5d3fe9,_0x214a2d);_0x17fb51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xe493('0x6')](e,emitEvent(event));}}module[_0xe493('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 72f0967..ecf4dbe 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 _0x6bfb=['moment','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x15e133,_0x12718e){var _0x4c2991=function(_0x40b8f5){while(--_0x40b8f5){_0x15e133['push'](_0x15e133['shift']());}};_0x4c2991(++_0x12718e);}(_0x6bfb,0x169));var _0xb6bf=function(_0x10e7b2,_0xb80dad){_0x10e7b2=_0x10e7b2-0x0;var _0x1174a0=_0x6bfb[_0x10e7b2];return _0x1174a0;};'use strict';var _=require(_0xb6bf('0x0'));var util=require(_0xb6bf('0x1'));var logger=require(_0xb6bf('0x2'))('api');var moment=require(_0xb6bf('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6bf('0x5'));var config=require(_0xb6bf('0x6'));var attributes=require(_0xb6bf('0x7'));module[_0xb6bf('0x8')]=function(_0x39a9d9,_0x11c9f7){return _0x39a9d9[_0xb6bf('0x9')](_0xb6bf('0xa'),attributes,{'tableName':_0xb6bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6bf('0xc'),'collate':_0xb6bf('0xd')});}; \ No newline at end of file +var _0xf3de=['bluebird','request-promise','path','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x30d11a,_0x28a751){var _0x5638bb=function(_0x2af7c0){while(--_0x2af7c0){_0x30d11a['push'](_0x30d11a['shift']());}};_0x5638bb(++_0x28a751);}(_0xf3de,0x1c3));var _0xef3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3de[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef3d('0x0'));var util=require(_0xef3d('0x1'));var logger=require(_0xef3d('0x2'))('api');var moment=require(_0xef3d('0x3'));var BPromise=require(_0xef3d('0x4'));var rp=require(_0xef3d('0x5'));var fs=require('fs');var path=require(_0xef3d('0x6'));var rimraf=require(_0xef3d('0x7'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0xef3d('0x8')]=function(_0x1ca7f3,_0xe8f4ba){return _0x1ca7f3[_0xef3d('0x9')](_0xef3d('0xa'),attributes,{'tableName':_0xef3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef3d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 73309d8..45b3fb5 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 _0x5327=['catch','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5327,0x19f));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7532('0x0'));var util=require(_0x7532('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7532('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7532('0x3'));var logger=require('../../config/logger')(_0x7532('0x4'));var config=require(_0x7532('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7532('0x6')][_0x7532('0x7')]({'port':0x232a});config['redis']=_[_0x7532('0x8')](config[_0x7532('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7532('0xa'))(new Redis(config[_0x7532('0x9')]));require(_0x7532('0xb'))['register'](socket);function respondWithRpcPromise(_0x4d9bce,_0x5ec141,_0x15bf5f){return new BPromise(function(_0x554394,_0x1948e1){return client[_0x7532('0xc')](_0x4d9bce,_0x15bf5f)[_0x7532('0xd')](function(_0x4a425b){logger[_0x7532('0xe')](_0x7532('0xf'),_0x5ec141,_0x7532('0x10'));logger[_0x7532('0x11')](_0x7532('0x12'),_0x5ec141,_0x7532('0x10'),JSON['stringify'](_0x4a425b));if(_0x4a425b['error']){if(_0x4a425b[_0x7532('0x13')]['code']===0x1f4){logger[_0x7532('0x13')]('UserNotification,\x20%s,\x20%s',_0x5ec141,_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);return _0x1948e1(_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);}logger[_0x7532('0x13')](_0x7532('0xf'),_0x5ec141,_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);return _0x554394(_0x4a425b[_0x7532('0x13')][_0x7532('0x14')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x5ec141,_0x7532('0x10'));_0x554394(_0x4a425b[_0x7532('0x15')]['message']);}})[_0x7532('0x16')](function(_0x53ddfa){logger[_0x7532('0x13')]('UserNotification,\x20%s,\x20%s',_0x5ec141,_0x53ddfa);_0x1948e1(_0x53ddfa);});});} \ No newline at end of file +var _0x1008=['./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','client','http','redis','localhost','socket.io-emitter'];(function(_0xd333a1,_0x1f61a0){var _0x553a60=function(_0x13761f){while(--_0x13761f){_0xd333a1['push'](_0xd333a1['shift']());}};_0x553a60(++_0x1f61a0);}(_0x1008,0xf2));var _0x8100=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x1008[_0x324012];return _0x435cf2;};'use strict';var _=require(_0x8100('0x0'));var util=require(_0x8100('0x1'));var moment=require(_0x8100('0x2'));var BPromise=require(_0x8100('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8100('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8100('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8100('0x6')][_0x8100('0x7')]({'port':0x232a});config[_0x8100('0x8')]=_['defaults'](config[_0x8100('0x8')],{'host':_0x8100('0x9'),'port':0x18eb});var socket=require(_0x8100('0xa'))(new Redis(config[_0x8100('0x8')]));require(_0x8100('0xb'))[_0x8100('0xc')](socket);function respondWithRpcPromise(_0x5efbe4,_0x37c98d,_0x3dae71){return new BPromise(function(_0x9f46eb,_0x194e3a){return client[_0x8100('0xd')](_0x5efbe4,_0x3dae71)[_0x8100('0xe')](function(_0x4fdbf1){logger['info'](_0x8100('0xf'),_0x37c98d,_0x8100('0x10'));logger[_0x8100('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x37c98d,_0x8100('0x10'),JSON[_0x8100('0x12')](_0x4fdbf1));if(_0x4fdbf1['error']){if(_0x4fdbf1[_0x8100('0x13')]['code']===0x1f4){logger[_0x8100('0x13')](_0x8100('0xf'),_0x37c98d,_0x4fdbf1['error'][_0x8100('0x14')]);return _0x194e3a(_0x4fdbf1[_0x8100('0x13')][_0x8100('0x14')]);}logger[_0x8100('0x13')](_0x8100('0xf'),_0x37c98d,_0x4fdbf1[_0x8100('0x13')]['message']);return _0x9f46eb(_0x4fdbf1[_0x8100('0x13')][_0x8100('0x14')]);}else{logger['info'](_0x8100('0xf'),_0x37c98d,'request\x20sent');_0x9f46eb(_0x4fdbf1[_0x8100('0x15')]['message']);}})[_0x8100('0x16')](function(_0x3de073){logger[_0x8100('0x13')](_0x8100('0xf'),_0x37c98d,_0x3de073);_0x194e3a(_0x3de073);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 33ea80a..6b45c99 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 _0xa3db=['length','userNotification:','./userNotification.events','save','remove','update','emit','register'];(function(_0x52d889,_0x420658){var _0x2abd0f=function(_0x3d4529){while(--_0x3d4529){_0x52d889['push'](_0x52d889['shift']());}};_0x2abd0f(++_0x420658);}(_0xa3db,0x19a));var _0xba3d=function(_0x152e3e,_0x4b3a83){_0x152e3e=_0x152e3e-0x0;var _0x2d6efb=_0xa3db[_0x152e3e];return _0x2d6efb;};'use strict';var UserNotificationEvents=require(_0xba3d('0x0'));var events=[_0xba3d('0x1'),_0xba3d('0x2'),_0xba3d('0x3')];function createListener(_0x3efcc1,_0x5c0054){return function(_0x34b9a6){_0x5c0054[_0xba3d('0x4')](_0x3efcc1,_0x34b9a6);};}function removeListener(_0x1debec,_0x41cb87){return function(){UserNotificationEvents['removeListener'](_0x1debec,_0x41cb87);};}exports[_0xba3d('0x5')]=function(_0x123ae7){for(var _0x2bc28e=0x0,_0x1f7ba5=events[_0xba3d('0x6')];_0x2bc28e<_0x1f7ba5;_0x2bc28e++){var _0x55482c=events[_0x2bc28e];var _0x5acf3a=createListener(_0xba3d('0x7')+_0x55482c,_0x123ae7);UserNotificationEvents['on'](_0x55482c,_0x5acf3a);}}; \ No newline at end of file +var _0xb5fc=['register','userNotification:','./userNotification.events','remove','update','emit','removeListener'];(function(_0x74c392,_0x29cc28){var _0x306791=function(_0x677d58){while(--_0x677d58){_0x74c392['push'](_0x74c392['shift']());}};_0x306791(++_0x29cc28);}(_0xb5fc,0x16e));var _0xcb5f=function(_0x442f4c,_0x2beee2){_0x442f4c=_0x442f4c-0x0;var _0x3b4b26=_0xb5fc[_0x442f4c];return _0x3b4b26;};'use strict';var UserNotificationEvents=require(_0xcb5f('0x0'));var events=['save',_0xcb5f('0x1'),_0xcb5f('0x2')];function createListener(_0x11aba8,_0xd1b103){return function(_0x105a21){_0xd1b103[_0xcb5f('0x3')](_0x11aba8,_0x105a21);};}function removeListener(_0x3a213d,_0x122240){return function(){UserNotificationEvents[_0xcb5f('0x4')](_0x3a213d,_0x122240);};}exports[_0xcb5f('0x5')]=function(_0x5b6bf1){for(var _0x41fec6=0x0,_0x21df80=events['length'];_0x41fec6<_0x21df80;_0x41fec6++){var _0x3cb24a=events[_0x41fec6];var _0x5196b0=createListener(_0xcb5f('0x6')+_0x3cb24a,_0x5b6bf1);UserNotificationEvents['on'](_0x3cb24a,_0x5196b0);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 2324d23..4d0b73e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x540089,_0x2aa6ce){var _0x11ffc7=function(_0x40b205){while(--_0x40b205){_0x540089['push'](_0x540089['shift']());}};_0x11ffc7(++_0x2aa6ce);}(_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(_0x53d4da,_0xeac21b){var _0x3130cb=function(_0x431fd6){while(--_0x431fd6){_0x53d4da['push'](_0x53d4da['shift']());}};_0x3130cb(++_0xeac21b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2b6be9,_0x5cc118){_0x2b6be9=_0x2b6be9-0x0;var _0x3a847a=_0xedd9[_0x2b6be9];return _0x3a847a;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e87e866..19e38bf 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 _0xe8f7=['INTEGER','sequelize'];(function(_0x538066,_0x2fec66){var _0x1d624c=function(_0x2db73d){while(--_0x2db73d){_0x538066['push'](_0x538066['shift']());}};_0x1d624c(++_0x2fec66);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7e8f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7e8f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf4df=['INTEGER'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xf4df,0x83));var _0xff4d=function(_0x254e3d,_0x36a15c){_0x254e3d=_0x254e3d-0x0;var _0x59ebf8=_0xf4df[_0x254e3d];return _0x59ebf8;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xff4d('0x0')],'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 ba60372..dddca7c 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 _0xfb43=['lodash','util','moment','path','../../config/environment','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfb43,0xfc));var _0x3fb4=function(_0x5dfd80,_0x1f30ac){_0x5dfd80=_0x5dfd80-0x0;var _0x45247d=_0xfb43[_0x5dfd80];return _0x45247d;};'use strict';var _=require(_0x3fb4('0x0'));var util=require(_0x3fb4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3fb4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fb4('0x3'));var rimraf=require('rimraf');var config=require(_0x3fb4('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x3fb4('0x5')]=function(_0x8dbe25,_0x122ee5){return _0x8dbe25['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69e9=['path','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x4ec8ff,_0xab6f36){var _0x1399e2=function(_0x13034f){while(--_0x13034f){_0x4ec8ff['push'](_0x4ec8ff['shift']());}};_0x1399e2(++_0xab6f36);}(_0x69e9,0x18b));var _0x969e=function(_0x4644ce,_0x51b5ce){_0x4644ce=_0x4644ce-0x0;var _0x5d47df=_0x69e9[_0x4644ce];return _0x5d47df;};'use strict';var _=require('lodash');var util=require(_0x969e('0x0'));var logger=require(_0x969e('0x1'))(_0x969e('0x2'));var moment=require(_0x969e('0x3'));var BPromise=require('bluebird');var rp=require(_0x969e('0x4'));var fs=require('fs');var path=require(_0x969e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x969e('0x6'));module[_0x969e('0x7')]=function(_0xfbe496,_0x421862){return _0xfbe496['define'](_0x969e('0x8'),attributes,{'tableName':_0x969e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index dfb3efd..1c73cad 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 _0x4134=['code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x271960,_0x129acd){var _0xe80d69=function(_0x4b1d59){while(--_0x4b1d59){_0x271960['push'](_0x271960['shift']());}};_0xe80d69(++_0x129acd);}(_0x4134,0x1c6));var _0x4413=function(_0x3c44de,_0xbc19f7){_0x3c44de=_0x3c44de-0x0;var _0x394764=_0x4134[_0x3c44de];return _0x394764;};'use strict';var _=require('lodash');var util=require(_0x4413('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4413('0x1'));var fs=require('fs');var Redis=require(_0x4413('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4413('0x3'));var logger=require(_0x4413('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4413('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x104165,_0x11cbec,_0x5653fc){return new BPromise(function(_0x567f95,_0x1411b5){return client[_0x4413('0x6')](_0x104165,_0x5653fc)[_0x4413('0x7')](function(_0x487741){logger[_0x4413('0x8')](_0x4413('0x9'),_0x11cbec,_0x4413('0xa'));logger[_0x4413('0xb')](_0x4413('0xc'),_0x11cbec,'request\x20sent',JSON['stringify'](_0x487741));if(_0x487741[_0x4413('0xd')]){if(_0x487741[_0x4413('0xd')][_0x4413('0xe')]===0x1f4){logger[_0x4413('0xd')](_0x4413('0x9'),_0x11cbec,_0x487741[_0x4413('0xd')][_0x4413('0xf')]);return _0x1411b5(_0x487741[_0x4413('0xd')][_0x4413('0xf')]);}logger[_0x4413('0xd')](_0x4413('0x9'),_0x11cbec,_0x487741[_0x4413('0xd')]['message']);return _0x567f95(_0x487741['error'][_0x4413('0xf')]);}else{logger[_0x4413('0x8')](_0x4413('0x9'),_0x11cbec,'request\x20sent');_0x567f95(_0x487741[_0x4413('0x10')][_0x4413('0xf')]);}})[_0x4413('0x11')](function(_0x92eec1){logger[_0x4413('0xd')](_0x4413('0x9'),_0x11cbec,_0x92eec1);_0x1411b5(_0x92eec1);});});} \ No newline at end of file +var _0x7865=['../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x27f53b,_0x35551e){var _0x426b36=function(_0x2c22c1){while(--_0x2c22c1){_0x27f53b['push'](_0x27f53b['shift']());}};_0x426b36(++_0x35551e);}(_0x7865,0x1a0));var _0x5786=function(_0x2a8ba6,_0x5ddbe3){_0x2a8ba6=_0x2a8ba6-0x0;var _0x2396d6=_0x7865[_0x2a8ba6];return _0x2396d6;};'use strict';var _=require('lodash');var util=require(_0x5786('0x0'));var moment=require(_0x5786('0x1'));var BPromise=require(_0x5786('0x2'));var rs=require(_0x5786('0x3'));var fs=require('fs');var Redis=require(_0x5786('0x4'));var db=require(_0x5786('0x5'))['db'];var utils=require(_0x5786('0x6'));var logger=require(_0x5786('0x7'))(_0x5786('0x8'));var config=require(_0x5786('0x9'));var jayson=require(_0x5786('0xa'));var client=jayson[_0x5786('0xb')][_0x5786('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5816c0,_0x50601a,_0x386ec9){return new BPromise(function(_0x47f470,_0x52b93e){return client[_0x5786('0xd')](_0x5816c0,_0x386ec9)[_0x5786('0xe')](function(_0x4b1768){logger[_0x5786('0xf')](_0x5786('0x10'),_0x50601a,_0x5786('0x11'));logger['debug'](_0x5786('0x12'),_0x50601a,_0x5786('0x11'),JSON[_0x5786('0x13')](_0x4b1768));if(_0x4b1768['error']){if(_0x4b1768[_0x5786('0x14')][_0x5786('0x15')]===0x1f4){logger[_0x5786('0x14')](_0x5786('0x10'),_0x50601a,_0x4b1768['error']['message']);return _0x52b93e(_0x4b1768[_0x5786('0x14')][_0x5786('0x16')]);}logger['error'](_0x5786('0x10'),_0x50601a,_0x4b1768[_0x5786('0x14')][_0x5786('0x16')]);return _0x47f470(_0x4b1768[_0x5786('0x14')][_0x5786('0x16')]);}else{logger[_0x5786('0xf')](_0x5786('0x10'),_0x50601a,_0x5786('0x11'));_0x47f470(_0x4b1768[_0x5786('0x17')][_0x5786('0x16')]);}})[_0x5786('0x18')](function(_0x3d6699){logger[_0x5786('0x14')](_0x5786('0x10'),_0x50601a,_0x3d6699);_0x52b93e(_0x3d6699);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e8f9ebe..39b5112 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 _0x8813=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','put','update','delete','/:id','destroy','removeSections','multer','path','connect-timeout'];(function(_0x329f72,_0x161674){var _0x635cca=function(_0x317251){while(--_0x317251){_0x329f72['push'](_0x329f72['shift']());}};_0x635cca(++_0x161674);}(_0x8813,0xdd));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3881('0x0'));var util=require('util');var path=require(_0x3881('0x1'));var timeout=require(_0x3881('0x2'));var express=require(_0x3881('0x3'));var router=express[_0x3881('0x4')]();var fs_extra=require(_0x3881('0x5'));var auth=require(_0x3881('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3881('0x7'));var controller=require('./userProfile.controller');router[_0x3881('0x8')]('/',auth['isAuthenticated'](),controller[_0x3881('0x9')]);router['get'](_0x3881('0xa'),auth[_0x3881('0xb')](),controller[_0x3881('0xc')]);router[_0x3881('0x8')]('/:id',auth[_0x3881('0xb')](),controller[_0x3881('0xd')]);router[_0x3881('0x8')](_0x3881('0xe'),auth[_0x3881('0xb')](),controller[_0x3881('0xf')]);router[_0x3881('0x8')](_0x3881('0x10'),auth[_0x3881('0xb')](),controller[_0x3881('0x11')]);router[_0x3881('0x12')]('/',auth[_0x3881('0xb')](),controller['create']);router[_0x3881('0x12')](_0x3881('0x13'),auth[_0x3881('0xb')](),controller[_0x3881('0x14')]);router[_0x3881('0x12')](_0x3881('0xe'),auth[_0x3881('0xb')](),controller[_0x3881('0x15')]);router[_0x3881('0x12')]('/:id/resources',auth[_0x3881('0xb')](),controller['addResources']);router[_0x3881('0x16')]('/:id',auth[_0x3881('0xb')](),controller[_0x3881('0x17')]);router[_0x3881('0x18')](_0x3881('0x19'),auth['isAuthenticated'](),controller[_0x3881('0x1a')]);router[_0x3881('0x18')]('/:id/sections',auth[_0x3881('0xb')](),controller[_0x3881('0x1b')]);router['delete']('/:id/resources',auth[_0x3881('0xb')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0x9713=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','update','removeSections','delete','removeResources','multer','util','path','connect-timeout'];(function(_0x360641,_0x3cf8be){var _0x25056b=function(_0x1472ef){while(--_0x1472ef){_0x360641['push'](_0x360641['shift']());}};_0x25056b(++_0x3cf8be);}(_0x9713,0xdc));var _0x3971=function(_0x405d10,_0x2c09bf){_0x405d10=_0x405d10-0x0;var _0x7be192=_0x9713[_0x405d10];return _0x7be192;};'use strict';var multer=require(_0x3971('0x0'));var util=require(_0x3971('0x1'));var path=require(_0x3971('0x2'));var timeout=require(_0x3971('0x3'));var express=require(_0x3971('0x4'));var router=express[_0x3971('0x5')]();var fs_extra=require(_0x3971('0x6'));var auth=require(_0x3971('0x7'));var interaction=require(_0x3971('0x8'));var config=require('../../config/environment');var controller=require(_0x3971('0x9'));router[_0x3971('0xa')]('/',auth[_0x3971('0xb')](),controller[_0x3971('0xc')]);router[_0x3971('0xa')](_0x3971('0xd'),auth[_0x3971('0xb')](),controller[_0x3971('0xe')]);router[_0x3971('0xa')](_0x3971('0xf'),auth[_0x3971('0xb')](),controller['show']);router[_0x3971('0xa')](_0x3971('0x10'),auth['isAuthenticated'](),controller['getSections']);router[_0x3971('0xa')](_0x3971('0x11'),auth[_0x3971('0xb')](),controller[_0x3971('0x12')]);router[_0x3971('0x13')]('/',auth['isAuthenticated'](),controller[_0x3971('0x14')]);router[_0x3971('0x13')](_0x3971('0x15'),auth[_0x3971('0xb')](),controller[_0x3971('0x16')]);router[_0x3971('0x13')](_0x3971('0x10'),auth[_0x3971('0xb')](),controller['addSections']);router['post'](_0x3971('0x11'),auth[_0x3971('0xb')](),controller[_0x3971('0x17')]);router['put'](_0x3971('0xf'),auth['isAuthenticated'](),controller[_0x3971('0x18')]);router['delete'](_0x3971('0xf'),auth[_0x3971('0xb')](),controller['destroy']);router['delete']('/:id/sections',auth[_0x3971('0xb')](),controller[_0x3971('0x19')]);router[_0x3971('0x1a')](_0x3971('0x11'),auth['isAuthenticated'](),controller[_0x3971('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 3111c7e..20f37c3 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 _0x5feb=['join','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5feb,0x1f3));var _0xb5fe=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x5feb[_0x4164f2];return _0x2575c7;};'use strict';var Sequelize=require(_0xb5fe('0x0'));module[_0xb5fe('0x1')]={'name':{'type':Sequelize[_0xb5fe('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe906bd){this[_0xb5fe('0x3')](_0xb5fe('0x4'),_0xe906bd?_0xe906bd[_0xb5fe('0x5')](''):[]);},'get':function(){return this[_0xb5fe('0x6')]('crudPermissions')?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb5fe('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb5fe('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4e77=['STRING','name','setDataValue','getDataValue','crudPermissions','split','BOOLEAN','exports'];(function(_0x34a410,_0x53fb5){var _0xf92ec3=function(_0x4d86b9){while(--_0x4d86b9){_0x34a410['push'](_0x34a410['shift']());}};_0xf92ec3(++_0x53fb5);}(_0x4e77,0x8f));var _0x74e7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4e77[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x74e7('0x0')]={'name':{'type':Sequelize[_0x74e7('0x1')],'allowNull':![],'unique':_0x74e7('0x2')},'crudPermissions':{'type':Sequelize[_0x74e7('0x1')],'set':function(_0x2628d0){this[_0x74e7('0x3')]('crudPermissions',_0x2628d0?_0x2628d0['join'](''):[]);},'get':function(){return this[_0x74e7('0x4')](_0x74e7('0x5'))?this[_0x74e7('0x4')](_0x74e7('0x5'))[_0x74e7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x74e7('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x74e7('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x74e7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x74e7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x74e7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x74e7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x74e7('0x7')],'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 cde9142..798ea59 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 _0x75f1=['addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','includeAll','findAll','rows','catch','params','include','merge','options','create','body','clone','get','omit','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','createdAt','sectionId','Resources','find','describe','addSections','userProfileId','UserProfileResource','push','enabled','includes','subsections','concat','findOne','Dashboard','resourceId','Plugin'];(function(_0x4eb746,_0x4202c4){var _0x26094a=function(_0x493485){while(--_0x493485){_0x4eb746['push'](_0x4eb746['shift']());}};_0x26094a(++_0x4202c4);}(_0x75f1,0x1db));var _0x175f=function(_0x36daf3,_0x2ea0dd){_0x36daf3=_0x36daf3-0x0;var _0x3e4e26=_0x75f1[_0x36daf3];return _0x3e4e26;};'use strict';var emlformat=require(_0x175f('0x0'));var rimraf=require(_0x175f('0x1'));var zipdir=require(_0x175f('0x2'));var jsonpatch=require(_0x175f('0x3'));var rp=require(_0x175f('0x4'));var moment=require(_0x175f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x175f('0x6'));var util=require(_0x175f('0x7'));var path=require(_0x175f('0x8'));var sox=require(_0x175f('0x9'));var csv=require('to-csv');var ejs=require(_0x175f('0xa'));var fs=require('fs');var fs_extra=require(_0x175f('0xb'));var _=require(_0x175f('0xc'));var squel=require(_0x175f('0xd'));var crypto=require(_0x175f('0xe'));var jsforce=require(_0x175f('0xf'));var deskjs=require(_0x175f('0x10'));var toCsv=require(_0x175f('0x11'));var querystring=require(_0x175f('0x12'));var Papa=require('papaparse');var Redis=require(_0x175f('0x13'));var authService=require(_0x175f('0x14'));var qs=require(_0x175f('0x15'));var as=require(_0x175f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x175f('0x17'))(_0x175f('0x18'));var utils=require(_0x175f('0x19'));var config=require(_0x175f('0x1a'));var licenseUtil=require(_0x175f('0x1b'));var db=require(_0x175f('0x1c'))['db'];config[_0x175f('0x1d')]=_[_0x175f('0x1e')](config[_0x175f('0x1d')],{'host':_0x175f('0x1f'),'port':0x18eb});var socket=require(_0x175f('0x20'))(new Redis(config[_0x175f('0x1d')]));require('./userProfile.socket')[_0x175f('0x21')](socket);function respondWithStatusCode(_0x18fa2d,_0x5472ac){_0x5472ac=_0x5472ac||0xcc;return function(_0x271c59){if(_0x271c59){return _0x18fa2d[_0x175f('0x22')](_0x5472ac);}return _0x18fa2d[_0x175f('0x23')](_0x5472ac)[_0x175f('0x24')]();};}function respondWithResult(_0x357cc9,_0x2e3432){_0x2e3432=_0x2e3432||0xc8;return function(_0x471c64){if(_0x471c64){return _0x357cc9[_0x175f('0x23')](_0x2e3432)['json'](_0x471c64);}};}function respondWithFilteredResult(_0x8b1462,_0x3c57a8){return function(_0x27f9f7){if(_0x27f9f7){var _0x159aee=typeof _0x3c57a8[_0x175f('0x25')]===_0x175f('0x26')&&typeof _0x3c57a8['limit']==='undefined';var _0x524ba2=_0x27f9f7['count'];var _0x16d87f=_0x159aee?0x0:_0x3c57a8['offset'];var _0x5b280f=_0x159aee?_0x27f9f7[_0x175f('0x27')]:_0x3c57a8[_0x175f('0x25')]+_0x3c57a8['limit'];var _0x4bd9af;if(_0x5b280f>=_0x524ba2){_0x5b280f=_0x524ba2;_0x4bd9af=0xc8;}else{_0x4bd9af=0xce;}_0x8b1462[_0x175f('0x23')](_0x4bd9af);return _0x8b1462[_0x175f('0x28')]('Content-Range',_0x16d87f+'-'+_0x5b280f+'/'+_0x524ba2)[_0x175f('0x29')](_0x27f9f7);}return null;};}function patchUpdates(_0xfc65c){return function(_0x18a154){try{jsonpatch[_0x175f('0x2a')](_0x18a154,_0xfc65c,!![]);}catch(_0x3c8c40){return BPromise['reject'](_0x3c8c40);}return _0x18a154[_0x175f('0x2b')]();};}function saveUpdates(_0xa2dd2e,_0x5b3ab1){return function(_0x19d988){if(_0x19d988){return _0x19d988[_0x175f('0x2c')](_0xa2dd2e)[_0x175f('0x2d')](function(_0xb58ad0){return _0xb58ad0;});}return null;};}function removeEntity(_0x463e0a,_0x1bcc14){return function(_0x4e92cf){if(_0x4e92cf){return _0x4e92cf[_0x175f('0x2e')]()['then'](function(){_0x463e0a[_0x175f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cd8a,_0x108339){return function(_0xef7854){if(!_0xef7854){_0x39cd8a[_0x175f('0x22')](0x194);}return _0xef7854;};}function handleError(_0x1b3ffe,_0x4ff86d){_0x4ff86d=_0x4ff86d||0x1f4;return function(_0x452949){logger[_0x175f('0x2f')](_0x452949[_0x175f('0x30')]);if(_0x452949[_0x175f('0x31')]){delete _0x452949[_0x175f('0x31')];}_0x1b3ffe[_0x175f('0x23')](_0x4ff86d)[_0x175f('0x32')](_0x452949);};}exports['index']=function(_0x23d0bf,_0x5c1387){var _0x2cd787={},_0x1eeae8={},_0x5a15a7={'count':0x0,'rows':[]};var _0x30d1ee=_[_0x175f('0x33')](db[_0x175f('0x34')][_0x175f('0x35')],function(_0x4cdde7){return{'name':_0x4cdde7[_0x175f('0x36')],'type':_0x4cdde7[_0x175f('0x37')][_0x175f('0x38')]};});_0x1eeae8[_0x175f('0x39')]=_[_0x175f('0x33')](_0x30d1ee,_0x175f('0x31'));_0x1eeae8[_0x175f('0x3a')]=_[_0x175f('0x3b')](_0x23d0bf['query']);_0x1eeae8[_0x175f('0x3c')]=_['intersection'](_0x1eeae8['model'],_0x1eeae8[_0x175f('0x3a')]);_0x2cd787[_0x175f('0x3d')]=_[_0x175f('0x3e')](_0x1eeae8[_0x175f('0x39')],qs[_0x175f('0x3f')](_0x23d0bf[_0x175f('0x3a')][_0x175f('0x3f')]));_0x2cd787[_0x175f('0x3d')]=_0x2cd787[_0x175f('0x3d')][_0x175f('0x40')]?_0x2cd787[_0x175f('0x3d')]:_0x1eeae8[_0x175f('0x39')];if(!_0x23d0bf[_0x175f('0x3a')][_0x175f('0x41')](_0x175f('0x42'))){_0x2cd787[_0x175f('0x43')]=qs['limit'](_0x23d0bf[_0x175f('0x3a')][_0x175f('0x43')]);_0x2cd787[_0x175f('0x25')]=qs['offset'](_0x23d0bf[_0x175f('0x3a')]['offset']);}_0x2cd787[_0x175f('0x44')]=qs[_0x175f('0x45')](_0x23d0bf[_0x175f('0x3a')]['sort']);_0x2cd787[_0x175f('0x46')]=qs['filters'](_[_0x175f('0x47')](_0x23d0bf[_0x175f('0x3a')],_0x1eeae8['filters']),_0x30d1ee);if(_0x23d0bf[_0x175f('0x3a')][_0x175f('0x48')]){_0x2cd787[_0x175f('0x46')]=_['merge'](_0x2cd787[_0x175f('0x46')],{'$or':_[_0x175f('0x33')](_0x30d1ee,function(_0x45547d){if(_0x45547d[_0x175f('0x37')]!=='VIRTUAL'){var _0x26fafb={};_0x26fafb[_0x45547d[_0x175f('0x31')]]={'$like':'%'+_0x23d0bf[_0x175f('0x3a')]['filter']+'%'};return _0x26fafb;}})});}_0x2cd787=_['merge']({},_0x2cd787,_0x23d0bf['options']);var _0x5df965={'where':_0x2cd787['where']};return db['UserProfile'][_0x175f('0x27')](_0x5df965)[_0x175f('0x2d')](function(_0x1f466b){_0x5a15a7[_0x175f('0x27')]=_0x1f466b;if(_0x23d0bf[_0x175f('0x3a')][_0x175f('0x49')]){_0x2cd787['include']=[{'all':!![]}];}return db[_0x175f('0x34')][_0x175f('0x4a')](_0x2cd787);})['then'](function(_0x7f790e){_0x5a15a7[_0x175f('0x4b')]=_0x7f790e;return _0x5a15a7;})[_0x175f('0x2d')](respondWithFilteredResult(_0x5c1387,_0x2cd787))[_0x175f('0x4c')](handleError(_0x5c1387,null));};exports['show']=function(_0x7c7d7b,_0x34020f){var _0x5d6bc5={'raw':![],'where':{'id':_0x7c7d7b[_0x175f('0x4d')]['id']}},_0x15cdfa={};_0x15cdfa['model']=_[_0x175f('0x3b')](db[_0x175f('0x34')][_0x175f('0x35')]);_0x15cdfa[_0x175f('0x3a')]=_['keys'](_0x7c7d7b['query']);_0x15cdfa[_0x175f('0x3c')]=_[_0x175f('0x3e')](_0x15cdfa[_0x175f('0x39')],_0x15cdfa[_0x175f('0x3a')]);_0x5d6bc5[_0x175f('0x3d')]=_[_0x175f('0x3e')](_0x15cdfa[_0x175f('0x39')],qs[_0x175f('0x3f')](_0x7c7d7b['query'][_0x175f('0x3f')]));_0x5d6bc5[_0x175f('0x3d')]=_0x5d6bc5[_0x175f('0x3d')][_0x175f('0x40')]?_0x5d6bc5[_0x175f('0x3d')]:_0x15cdfa['model'];if(_0x7c7d7b[_0x175f('0x3a')]['includeAll']){_0x5d6bc5[_0x175f('0x4e')]=[{'all':!![]}];}_0x5d6bc5=_[_0x175f('0x4f')]({},_0x5d6bc5,_0x7c7d7b[_0x175f('0x50')]);return db[_0x175f('0x34')]['find'](_0x5d6bc5)['then'](handleEntityNotFound(_0x34020f,null))[_0x175f('0x2d')](respondWithResult(_0x34020f,null))[_0x175f('0x4c')](handleError(_0x34020f,null));};exports[_0x175f('0x51')]=function(_0x244577,_0x519e91){return db['UserProfile'][_0x175f('0x51')](_0x244577[_0x175f('0x52')],{})[_0x175f('0x2d')](respondWithResult(_0x519e91,0xc9))[_0x175f('0x4c')](handleError(_0x519e91,null));};exports[_0x175f('0x53')]=function(_0x50dcdf,_0x2cb826){var _0x40747a={'where':{'id':_0x50dcdf['params']['id']}},_0x2bba6e={};_0x2bba6e[_0x175f('0x39')]=_[_0x175f('0x3b')](db[_0x175f('0x34')][_0x175f('0x35')]);_0x40747a[_0x175f('0x3d')]=_[_0x175f('0x3e')](_0x2bba6e['model'],qs[_0x175f('0x3f')](_0x50dcdf[_0x175f('0x3a')][_0x175f('0x3f')]));_0x40747a['attributes']=_0x40747a[_0x175f('0x3d')][_0x175f('0x40')]?_0x40747a['attributes']:_0x2bba6e['model'];if(_0x50dcdf[_0x175f('0x3a')]['includeAll']){_0x40747a[_0x175f('0x4e')]=[{'all':!![]}];}_0x40747a=_[_0x175f('0x4f')]({},_0x40747a,_0x50dcdf[_0x175f('0x50')]);return db['UserProfile']['find'](_0x40747a)[_0x175f('0x2d')](handleEntityNotFound(_0x2cb826,null))[_0x175f('0x2d')](function(_0x54bc66){if(_0x54bc66){var _0x181748=_0x54bc66[_0x175f('0x54')]({'plain':!![]});_0x181748=qs[_0x175f('0x55')](_0x181748,['id','createdAt','updatedAt',_0x175f('0x56')]);_0x50dcdf[_0x175f('0x52')]=_['omit'](_0x50dcdf[_0x175f('0x52')],['id','createdAt',_0x175f('0x57')]);return db[_0x175f('0x58')][_0x175f('0x59')](function(_0x3a0baa){return db['UserProfile'][_0x175f('0x51')](_[_0x175f('0x4f')](_0x181748,_0x50dcdf[_0x175f('0x52')]),{'include':_0x50dcdf[_0x175f('0x3a')][_0x175f('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x3a0baa})[_0x175f('0x2d')](function(_0x2268b1){var _0x29cd3e=_0x2268b1[_0x175f('0x54')]({'plain':!![]});return db[_0x175f('0x5a')][_0x175f('0x4a')]({'where':{'userProfileId':_0x50dcdf[_0x175f('0x4d')]['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x2c822e){if(_0x2c822e){return BPromise[_0x175f('0x5b')](_0x2c822e,function(_0x43a53a){return new BPromise(function(_0x5b79cb,_0x1b9b21){if(_0x43a53a['autoAssociation']===null||_0x43a53a[_0x175f('0x5c')]===0x1)_0x5b79cb(null);return db['UserProfileResource'][_0x175f('0x4a')]({'where':{'sectionId':_0x43a53a['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x15f855){var _0xc8d9d9=_['map'](_0x15f855,function(_0x328d62){return qs[_0x175f('0x55')](_0x328d62,['id',_0x175f('0x5d'),'updatedAt',_0x175f('0x5e')]);});_0x5b79cb(_0xc8d9d9);})[_0x175f('0x4c')](function(_0x367d58){_0x1b9b21(_0x367d58);});})[_0x175f('0x2d')](function(_0x588151){var _0x1b4643=qs[_0x175f('0x55')](_0x43a53a,['id',_0x175f('0x5d'),_0x175f('0x57')]);_0x1b4643['userProfileId']=_0x29cd3e['id'];if(_0x588151)_0x1b4643[_0x175f('0x5f')]=_0x588151;return _0x1b4643;})[_0x175f('0x2d')](function(_0x46904a){return db['UserProfileSection'][_0x175f('0x51')](_0x46904a,{'include':[{'model':db['UserProfileResource'],'as':_0x175f('0x5f')}],'raw':!![],'transaction':_0x3a0baa});});})[_0x175f('0x2d')](function(){return _0x29cd3e;});}});});});}})[_0x175f('0x2d')](respondWithResult(_0x2cb826,0xc9))[_0x175f('0x4c')](handleError(_0x2cb826,null));};exports['update']=function(_0x3b37a8,_0x4c8570){if(_0x3b37a8[_0x175f('0x52')]['id']){delete _0x3b37a8[_0x175f('0x52')]['id'];}return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x3b37a8['params']['id']}})['then'](handleEntityNotFound(_0x4c8570,null))['then'](saveUpdates(_0x3b37a8[_0x175f('0x52')],null))[_0x175f('0x2d')](respondWithResult(_0x4c8570,null))[_0x175f('0x4c')](handleError(_0x4c8570,null));};exports['destroy']=function(_0x10dfce,_0x49b00a){return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x10dfce[_0x175f('0x4d')]['id']}})[_0x175f('0x2d')](handleEntityNotFound(_0x49b00a,null))[_0x175f('0x2d')](removeEntity(_0x49b00a,null))[_0x175f('0x4c')](handleError(_0x49b00a,null));};exports[_0x175f('0x61')]=function(_0x1caf22,_0xbb0d73){return db[_0x175f('0x34')]['describe']()['then'](respondWithResult(_0xbb0d73,null))['catch'](handleError(_0xbb0d73,null));};exports[_0x175f('0x62')]=function(_0x18e826,_0x40cb5d){var _0x301bba=_0x18e826[_0x175f('0x52')];return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x18e826[_0x175f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40cb5d,null))[_0x175f('0x2d')](function(_0x549762){if(_0x549762){return db[_0x175f('0x58')][_0x175f('0x59')](function(_0x2ec3e9){return db[_0x175f('0x5a')][_0x175f('0x2e')]({'where':{'userProfileId':_0x18e826[_0x175f('0x4d')]['id'],'sectionId':_[_0x175f('0x33')](_0x301bba,function(_0x585b29){return _0x585b29['sectionId'];})},'transaction':_0x2ec3e9})['then'](function(){var _0x4c5400=_[_0x175f('0x33')](_0x301bba,function(_0xadd38f){_0xadd38f[_0x175f('0x63')]=_0x18e826[_0x175f('0x4d')]['id'];return _0xadd38f;});var _0x1b5b46=[];return BPromise[_0x175f('0x5b')](_0x4c5400,function(_0x15e0a7){return db['UserProfileSection'][_0x175f('0x51')](_0x15e0a7,{'include':[{'model':db[_0x175f('0x64')],'as':_0x175f('0x5f')}],'raw':!![],'transaction':_0x2ec3e9})[_0x175f('0x2d')](function(_0x5d2d53){_0x1b5b46[_0x175f('0x65')](_0x5d2d53[_0x175f('0x54')]({'plain':!![]}));});})[_0x175f('0x2d')](function(){return _0x1b5b46;});});});}})[_0x175f('0x2d')](function(_0x462559){return _0x462559;})[_0x175f('0x2d')](respondWithResult(_0x40cb5d,null))['catch'](handleError(_0x40cb5d,null));};exports['removeSections']=function(_0x4e59cf,_0x5e0ebe){var _0x3f8256;return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x4e59cf[_0x175f('0x4d')]['id']},'attributes':['id',_0x175f('0x31')]})[_0x175f('0x2d')](handleEntityNotFound(_0x5e0ebe,null))[_0x175f('0x2d')](function(_0x40c6ca){if(_0x40c6ca){_0x3f8256=_0x40c6ca;return db[_0x175f('0x5a')][_0x175f('0x2e')]({'where':{'userProfileId':_0x4e59cf[_0x175f('0x4d')]['id'],'sectionId':_0x4e59cf['query']['ids']}});}})['then'](function(){return _0x3f8256;})[_0x175f('0x2d')](respondWithStatusCode(_0x5e0ebe,null))['catch'](handleError(_0x5e0ebe,null));};exports['getSections']=function(_0x266499,_0x1f94ba){var _0x3f9319=[];var _0x4eb8f1=[];return db[_0x175f('0x5a')][_0x175f('0x4a')]({'where':{'userProfileId':_0x266499[_0x175f('0x4d')]['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x31c425){_0x3f9319=_[_0x175f('0x48')](_0x31c425,function(_0x504464){return _0x504464[_0x175f('0x66')]===0x1||_[_0x175f('0x67')]([0x3eb,0x709],_0x504464[_0x175f('0x5e')]);});if(!_['isEmpty'](_0x3f9319)){return _[_0x175f('0x33')](_0x3f9319,function(_0xf41353){return _0xf41353['sectionId'];});}else{return;}})[_0x175f('0x2d')](function(_0x913ce8){if(_0x913ce8)_0x4eb8f1=_0x913ce8;if(_['includes'](_0x4eb8f1,0x64)){var _0x4f5753=_[_0x175f('0x60')](_0x3f9319,{'sectionId':0x64});return hasDefaultDashboard(_0x4f5753)[_0x175f('0x2d')](function(_0x2d6e2a){return _[_0x175f('0x33')](_0x3f9319,function(_0x1d5f21){if(_0x1d5f21[_0x175f('0x5e')]===0x64){_0x1d5f21['subsections']=_0x2d6e2a;}return _0x1d5f21;});});}else{return;}})[_0x175f('0x2d')](function(_0x3177fe){if(_0x3177fe)_0x3f9319=_0x3177fe;if(_['includes'](_0x4eb8f1,0x3eb)){var _0x374864=_[_0x175f('0x60')](_0x3f9319,{'sectionId':0x3eb});return getCustomDashboards(_0x374864)[_0x175f('0x2d')](function(_0x2779be){return _['map'](_0x3f9319,function(_0x2b0cf1){if(_0x374864[_0x175f('0x66')]){if(_0x2b0cf1['sectionId']===0x3eb){_0x2b0cf1[_0x175f('0x68')]=_0x2779be;}}else{if(_0x2b0cf1[_0x175f('0x5e')]===0x64){if(!_0x2b0cf1[_0x175f('0x68')]){_0x2b0cf1[_0x175f('0x68')]=[];}_0x2b0cf1[_0x175f('0x68')]=_0x2b0cf1['subsections'][_0x175f('0x69')](_0x2779be);}}return _0x2b0cf1;});});}else{return;}})[_0x175f('0x2d')](function(_0x3d16ea){if(_0x3d16ea)_0x3f9319=_0x3d16ea;if(_['includes'](_0x4eb8f1,0x709)){var _0x2dfac0=_[_0x175f('0x60')](_0x3f9319,{'sectionId':0x709});return getPlugins(_0x2dfac0)[_0x175f('0x2d')](function(_0x105b6f){if(_0x2dfac0[_0x175f('0x66')]){return _[_0x175f('0x33')](_0x3f9319,function(_0x11dc0a){if(_0x11dc0a['sectionId']===0x709){_0x11dc0a['subsections']=_0x105b6f;}return _0x11dc0a;});}else{var _0x54e6f1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x105b6f};var _0x1519ba=_[_0x175f('0x33')](_0x3f9319);_0x1519ba[_0x175f('0x65')](_0x54e6f1);return _0x1519ba;}});}else{return;}})[_0x175f('0x2d')](function(_0x4eaf1f){if(_0x4eaf1f)_0x3f9319=_0x4eaf1f;return _[_0x175f('0x48')](_0x3f9319,[_0x175f('0x66'),0x1]);})[_0x175f('0x2d')](respondWithResult(_0x1f94ba,null))['catch'](handleError(_0x1f94ba,null));};function hasDefaultDashboard(_0x521e80){var _0x3a5b98=[0x65];return new BPromise(function(_0x49afc5,_0x220bd1){try{if(_0x521e80[_0x175f('0x5c')]){_0x49afc5(_0x3a5b98);}else{return db[_0x175f('0x64')][_0x175f('0x6a')]({'where':{'sectionId':_0x521e80['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x298c13){_0x298c13?_0x49afc5(_0x3a5b98):_0x49afc5();});}}catch(_0x2de488){_0x220bd1(_0x2de488);}});}function getCustomDashboards(_0x377d26){var _0x514f1e=[];return new BPromise(function(_0x703f66,_0x4db72c){try{if(_0x377d26[_0x175f('0x5c')]){return db[_0x175f('0x6b')][_0x175f('0x4a')]({'raw':!![]})[_0x175f('0x2d')](function(_0x59ef5f){_0x59ef5f['forEach'](function(_0x2cd5eb){_0x514f1e[_0x175f('0x65')](_0x2cd5eb['id']+0x1869f);});_0x703f66(_0x514f1e);});}else{return db[_0x175f('0x64')][_0x175f('0x4a')]({'where':{'sectionId':_0x377d26['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x2cd2f0){_0x2cd2f0['forEach'](function(_0x459965){_0x514f1e['push'](_0x459965[_0x175f('0x6c')]+0x1869f);});_0x703f66(_0x514f1e);});}}catch(_0x66ac4){_0x4db72c(_0x66ac4);}});}function getPlugins(_0x5788dc){var _0x5360f0=[];return new BPromise(function(_0x39dd14,_0x14573f){try{if(_0x5788dc['autoAssociation']){return db[_0x175f('0x6d')]['findAll']({'raw':!![]})[_0x175f('0x2d')](function(_0x108b6a){_0x108b6a['forEach'](function(_0x251032){_0x5360f0[_0x175f('0x65')](_0x251032['id']+0x15b38);});_0x39dd14(_0x5360f0);});}else{return db[_0x175f('0x64')][_0x175f('0x4a')]({'where':{'sectionId':_0x5788dc['id']},'raw':!![]})[_0x175f('0x2d')](function(_0x300a41){_0x300a41['forEach'](function(_0x26d35){_0x5360f0[_0x175f('0x65')](_0x26d35[_0x175f('0x6c')]+0x15b38);});_0x39dd14(_0x5360f0);});}}catch(_0x131c12){_0x14573f(_0x131c12);}});}exports[_0x175f('0x6e')]=function(_0x4f9490,_0xd0fb93){return db[_0x175f('0x34')][_0x175f('0x60')]({'where':{'id':_0x4f9490['params']['id']}})[_0x175f('0x2d')](handleEntityNotFound(_0xd0fb93,null))['then'](function(_0x1f8f13){if(_0x1f8f13){return db[_0x175f('0x58')][_0x175f('0x59')](function(_0x197f67){return db['UserProfileSection'][_0x175f('0x4a')]({'where':{'userProfileId':_0x4f9490[_0x175f('0x4d')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x36b25d){if(_0x36b25d){return db[_0x175f('0x5a')][_0x175f('0x2e')]({'where':{'userProfileId':_0x4f9490[_0x175f('0x4d')]['id'],'id':_['map'](_0x36b25d,function(_0x53ba0c){return _0x53ba0c['id'];})},'transaction':_0x197f67});}})[_0x175f('0x2d')](function(_0x59a4cc){var _0xc52aba=_[_0x175f('0x33')](_0x4f9490['body'],function(_0x48c655){_0x48c655['userProfileId']=_0x4f9490[_0x175f('0x4d')]['id'];return _0x48c655;});return db[_0x175f('0x5a')][_0x175f('0x6f')](_0xc52aba,{'raw':!![],'transaction':_0x197f67});})[_0x175f('0x2d')](function(_0x13dd0f){var _0x343f1c=_[_0x175f('0x48')](_[_0x175f('0x33')](_0x13dd0f,function(_0x5a0bef){return _0x5a0bef[_0x175f('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x343f1c){return db[_0x175f('0x5a')][_0x175f('0x4a')]({'where':{'userProfileId':_0x4f9490[_0x175f('0x4d')]['id'],'sectionId':_['map'](_0x343f1c,function(_0x1b3ba3){return _0x1b3ba3[_0x175f('0x5e')];})},'attributes':['id',_0x175f('0x5e')],'raw':!![]})[_0x175f('0x2d')](function(_0x51972f){var _0x4d4b1a=_[_0x175f('0x33')](_0x4f9490[_0x175f('0x52')],function(_0x29f910){_0x29f910[_0x175f('0x63')]=_0x4f9490[_0x175f('0x4d')]['id'];return _0x29f910;});return db['UserProfileResource'][_0x175f('0x6f')](_0x4d4b1a,{'raw':!![],'transaction':_0x197f67});});}})['catch'](handleError(_0xd0fb93,null));});}})['then'](function(_0x577fb3){var _0x29b5fe=_[_0x175f('0x33')](_0x577fb3,function(_0x4719a3){return _0x4719a3[_0x175f('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0xd0fb93,null))[_0x175f('0x4c')](handleError(_0xd0fb93,null));};exports['removeResources']=function(_0x135338,_0x28c542,_0x1d1f5f){return db['UserProfile'][_0x175f('0x60')]({'where':{'id':_0x135338[_0x175f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x28c542,null))[_0x175f('0x2d')](function(_0x4e7d25){if(_0x4e7d25){return _0x4e7d25[_0x175f('0x70')](_0x135338['query']['ids']);}})[_0x175f('0x2d')](respondWithStatusCode(_0x28c542,null))[_0x175f('0x4c')](handleError(_0x28c542,null));};exports['getResources']=function(_0x161e7e,_0x292653){var _0x30f068={};if(!_0x161e7e[_0x175f('0x3a')][_0x175f('0x71')])throw new Error(_0x175f('0x72'));if(!_0x161e7e['query'][_0x175f('0x41')]('nolimit')){_0x30f068[_0x175f('0x43')]=qs['limit'](_0x161e7e['query'][_0x175f('0x43')]);_0x30f068[_0x175f('0x25')]=qs['offset'](_0x161e7e[_0x175f('0x3a')][_0x175f('0x25')]);}return db['UserProfile'][_0x175f('0x60')]({'where':{'id':_0x161e7e['params']['id']}})[_0x175f('0x2d')](function(_0x249742){if(!_0x249742)throw new Error(_0x175f('0x73')+_0x161e7e[_0x175f('0x4d')]['id']);return db[_0x175f('0x34')][_0x175f('0x74')](_0x161e7e);})['then'](respondWithFilteredResult(_0x292653,_0x30f068))[_0x175f('0x4c')](handleError(_0x292653,null));}; \ No newline at end of file +var _0x7c91=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','includeAll','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','removeSections','ids','getSections','enabled','includes','subsections','concat','push','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length'];(function(_0x4876f7,_0x324e5f){var _0xcd6afb=function(_0x360d96){while(--_0x360d96){_0x4876f7['push'](_0x4876f7['shift']());}};_0xcd6afb(++_0x324e5f);}(_0x7c91,0x119));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x17c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17c9('0x1'));var jsonpatch=require(_0x17c9('0x2'));var rp=require(_0x17c9('0x3'));var moment=require(_0x17c9('0x4'));var BPromise=require(_0x17c9('0x5'));var Mustache=require(_0x17c9('0x6'));var util=require('util');var path=require(_0x17c9('0x7'));var sox=require(_0x17c9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17c9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x17c9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x17c9('0xb'));var toCsv=require(_0x17c9('0xc'));var querystring=require(_0x17c9('0xd'));var Papa=require('papaparse');var Redis=require(_0x17c9('0xe'));var authService=require(_0x17c9('0xf'));var qs=require(_0x17c9('0x10'));var as=require(_0x17c9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17c9('0x12'))('api');var utils=require(_0x17c9('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x17c9('0x14')](config[_0x17c9('0x15')],{'host':_0x17c9('0x16'),'port':0x18eb});var socket=require(_0x17c9('0x17'))(new Redis(config[_0x17c9('0x15')]));require('./userProfile.socket')[_0x17c9('0x18')](socket);function respondWithStatusCode(_0xe3ab80,_0x18d71a){_0x18d71a=_0x18d71a||0xcc;return function(_0x2f4e4a){if(_0x2f4e4a){return _0xe3ab80[_0x17c9('0x19')](_0x18d71a);}return _0xe3ab80[_0x17c9('0x1a')](_0x18d71a)[_0x17c9('0x1b')]();};}function respondWithResult(_0x38b36c,_0xf18c7){_0xf18c7=_0xf18c7||0xc8;return function(_0x7deddd){if(_0x7deddd){return _0x38b36c['status'](_0xf18c7)['json'](_0x7deddd);}};}function respondWithFilteredResult(_0x1827fc,_0xb8b61e){return function(_0xa334ed){if(_0xa334ed){var _0x13135c=typeof _0xb8b61e['offset']===_0x17c9('0x1c')&&typeof _0xb8b61e['limit']===_0x17c9('0x1c');var _0x14ec4d=_0xa334ed[_0x17c9('0x1d')];var _0x10ea57=_0x13135c?0x0:_0xb8b61e[_0x17c9('0x1e')];var _0x3deff8=_0x13135c?_0xa334ed[_0x17c9('0x1d')]:_0xb8b61e[_0x17c9('0x1e')]+_0xb8b61e[_0x17c9('0x1f')];var _0x4dee35;if(_0x3deff8>=_0x14ec4d){_0x3deff8=_0x14ec4d;_0x4dee35=0xc8;}else{_0x4dee35=0xce;}_0x1827fc[_0x17c9('0x1a')](_0x4dee35);return _0x1827fc[_0x17c9('0x20')]('Content-Range',_0x10ea57+'-'+_0x3deff8+'/'+_0x14ec4d)[_0x17c9('0x21')](_0xa334ed);}return null;};}function patchUpdates(_0x23bcaf){return function(_0x474a2d){try{jsonpatch[_0x17c9('0x22')](_0x474a2d,_0x23bcaf,!![]);}catch(_0x4e8c91){return BPromise[_0x17c9('0x23')](_0x4e8c91);}return _0x474a2d[_0x17c9('0x24')]();};}function saveUpdates(_0x3300e2,_0x35e1eb){return function(_0x42f216){if(_0x42f216){return _0x42f216['update'](_0x3300e2)[_0x17c9('0x25')](function(_0x146ddc){return _0x146ddc;});}return null;};}function removeEntity(_0x4aada5,_0x3dfac9){return function(_0x38d40d){if(_0x38d40d){return _0x38d40d[_0x17c9('0x26')]()[_0x17c9('0x25')](function(){_0x4aada5['status'](0xcc)[_0x17c9('0x1b')]();});}};}function handleEntityNotFound(_0x47de2d,_0x4e2b0c){return function(_0x487637){if(!_0x487637){_0x47de2d[_0x17c9('0x19')](0x194);}return _0x487637;};}function handleError(_0x30aa60,_0x43ebbf){_0x43ebbf=_0x43ebbf||0x1f4;return function(_0x486e66){logger[_0x17c9('0x27')](_0x486e66[_0x17c9('0x28')]);if(_0x486e66['name']){delete _0x486e66[_0x17c9('0x29')];}_0x30aa60['status'](_0x43ebbf)[_0x17c9('0x2a')](_0x486e66);};}exports[_0x17c9('0x2b')]=function(_0x1f174c,_0xd68263){var _0x299595={},_0x45d3cf={},_0x200736={'count':0x0,'rows':[]};var _0x45c235=_[_0x17c9('0x2c')](db[_0x17c9('0x2d')][_0x17c9('0x2e')],function(_0x166032){return{'name':_0x166032[_0x17c9('0x2f')],'type':_0x166032['type']['key']};});_0x45d3cf[_0x17c9('0x30')]=_[_0x17c9('0x2c')](_0x45c235,_0x17c9('0x29'));_0x45d3cf[_0x17c9('0x31')]=_['keys'](_0x1f174c[_0x17c9('0x31')]);_0x45d3cf[_0x17c9('0x32')]=_[_0x17c9('0x33')](_0x45d3cf['model'],_0x45d3cf[_0x17c9('0x31')]);_0x299595[_0x17c9('0x34')]=_[_0x17c9('0x33')](_0x45d3cf[_0x17c9('0x30')],qs[_0x17c9('0x35')](_0x1f174c[_0x17c9('0x31')]['fields']));_0x299595[_0x17c9('0x34')]=_0x299595[_0x17c9('0x34')][_0x17c9('0x36')]?_0x299595[_0x17c9('0x34')]:_0x45d3cf[_0x17c9('0x30')];if(!_0x1f174c[_0x17c9('0x31')][_0x17c9('0x37')]('nolimit')){_0x299595['limit']=qs[_0x17c9('0x1f')](_0x1f174c[_0x17c9('0x31')][_0x17c9('0x1f')]);_0x299595[_0x17c9('0x1e')]=qs[_0x17c9('0x1e')](_0x1f174c[_0x17c9('0x31')]['offset']);}_0x299595[_0x17c9('0x38')]=qs[_0x17c9('0x39')](_0x1f174c[_0x17c9('0x31')]['sort']);_0x299595[_0x17c9('0x3a')]=qs[_0x17c9('0x32')](_[_0x17c9('0x3b')](_0x1f174c[_0x17c9('0x31')],_0x45d3cf[_0x17c9('0x32')]),_0x45c235);if(_0x1f174c[_0x17c9('0x31')][_0x17c9('0x3c')]){_0x299595['where']=_[_0x17c9('0x3d')](_0x299595[_0x17c9('0x3a')],{'$or':_[_0x17c9('0x2c')](_0x45c235,function(_0x5ca55c){if(_0x5ca55c[_0x17c9('0x3e')]!==_0x17c9('0x3f')){var _0x36ba9e={};_0x36ba9e[_0x5ca55c['name']]={'$like':'%'+_0x1f174c[_0x17c9('0x31')][_0x17c9('0x3c')]+'%'};return _0x36ba9e;}})});}_0x299595=_[_0x17c9('0x3d')]({},_0x299595,_0x1f174c[_0x17c9('0x40')]);var _0x39f560={'where':_0x299595[_0x17c9('0x3a')]};return db[_0x17c9('0x2d')][_0x17c9('0x1d')](_0x39f560)[_0x17c9('0x25')](function(_0x3a1e85){_0x200736[_0x17c9('0x1d')]=_0x3a1e85;if(_0x1f174c[_0x17c9('0x31')]['includeAll']){_0x299595[_0x17c9('0x41')]=[{'all':!![]}];}return db[_0x17c9('0x2d')][_0x17c9('0x42')](_0x299595);})[_0x17c9('0x25')](function(_0x2d95d6){_0x200736[_0x17c9('0x43')]=_0x2d95d6;return _0x200736;})[_0x17c9('0x25')](respondWithFilteredResult(_0xd68263,_0x299595))[_0x17c9('0x44')](handleError(_0xd68263,null));};exports[_0x17c9('0x45')]=function(_0x16973f,_0x33c3a1){var _0x53c600={'raw':![],'where':{'id':_0x16973f[_0x17c9('0x46')]['id']}},_0x513507={};_0x513507[_0x17c9('0x30')]=_[_0x17c9('0x47')](db[_0x17c9('0x2d')][_0x17c9('0x2e')]);_0x513507['query']=_['keys'](_0x16973f['query']);_0x513507[_0x17c9('0x32')]=_[_0x17c9('0x33')](_0x513507[_0x17c9('0x30')],_0x513507[_0x17c9('0x31')]);_0x53c600[_0x17c9('0x34')]=_[_0x17c9('0x33')](_0x513507['model'],qs[_0x17c9('0x35')](_0x16973f['query'][_0x17c9('0x35')]));_0x53c600['attributes']=_0x53c600['attributes'][_0x17c9('0x36')]?_0x53c600[_0x17c9('0x34')]:_0x513507[_0x17c9('0x30')];if(_0x16973f[_0x17c9('0x31')]['includeAll']){_0x53c600[_0x17c9('0x41')]=[{'all':!![]}];}_0x53c600=_[_0x17c9('0x3d')]({},_0x53c600,_0x16973f[_0x17c9('0x40')]);return db[_0x17c9('0x2d')]['find'](_0x53c600)[_0x17c9('0x25')](handleEntityNotFound(_0x33c3a1,null))[_0x17c9('0x25')](respondWithResult(_0x33c3a1,null))['catch'](handleError(_0x33c3a1,null));};exports[_0x17c9('0x48')]=function(_0x48b7a,_0x8a332c){return db[_0x17c9('0x2d')][_0x17c9('0x48')](_0x48b7a[_0x17c9('0x49')],{})[_0x17c9('0x25')](respondWithResult(_0x8a332c,0xc9))[_0x17c9('0x44')](handleError(_0x8a332c,null));};exports[_0x17c9('0x4a')]=function(_0x49eaca,_0x3f5077){var _0x2f74cc={'where':{'id':_0x49eaca[_0x17c9('0x46')]['id']}},_0x2bfa15={};_0x2bfa15['model']=_[_0x17c9('0x47')](db[_0x17c9('0x2d')][_0x17c9('0x2e')]);_0x2f74cc['attributes']=_[_0x17c9('0x33')](_0x2bfa15['model'],qs['fields'](_0x49eaca[_0x17c9('0x31')][_0x17c9('0x35')]));_0x2f74cc['attributes']=_0x2f74cc['attributes']['length']?_0x2f74cc[_0x17c9('0x34')]:_0x2bfa15['model'];if(_0x49eaca[_0x17c9('0x31')]['includeAll']){_0x2f74cc[_0x17c9('0x41')]=[{'all':!![]}];}_0x2f74cc=_[_0x17c9('0x3d')]({},_0x2f74cc,_0x49eaca[_0x17c9('0x40')]);return db[_0x17c9('0x2d')][_0x17c9('0x4b')](_0x2f74cc)[_0x17c9('0x25')](handleEntityNotFound(_0x3f5077,null))[_0x17c9('0x25')](function(_0x31444c){if(_0x31444c){var _0x3f8060=_0x31444c[_0x17c9('0x4c')]({'plain':!![]});_0x3f8060=qs[_0x17c9('0x4d')](_0x3f8060,['id',_0x17c9('0x4e'),_0x17c9('0x4f'),_0x17c9('0x50')]);_0x49eaca[_0x17c9('0x49')]=_[_0x17c9('0x4d')](_0x49eaca[_0x17c9('0x49')],['id',_0x17c9('0x4e'),_0x17c9('0x4f')]);return db[_0x17c9('0x51')]['transaction'](function(_0x3cb5d8){return db[_0x17c9('0x2d')][_0x17c9('0x48')](_['merge'](_0x3f8060,_0x49eaca[_0x17c9('0x49')]),{'include':_0x49eaca['query'][_0x17c9('0x52')]?[{'all':!![]}]:undefined,'transaction':_0x3cb5d8})[_0x17c9('0x25')](function(_0x46b4e9){var _0x3689a5=_0x46b4e9[_0x17c9('0x4c')]({'plain':!![]});return db[_0x17c9('0x53')][_0x17c9('0x42')]({'where':{'userProfileId':_0x49eaca[_0x17c9('0x46')]['id']},'raw':!![]})[_0x17c9('0x25')](function(_0x4ed13b){if(_0x4ed13b){return BPromise[_0x17c9('0x54')](_0x4ed13b,function(_0x4757d4){return new BPromise(function(_0x100f1e,_0x59d597){if(_0x4757d4['autoAssociation']===null||_0x4757d4[_0x17c9('0x55')]===0x1)_0x100f1e(null);return db[_0x17c9('0x56')][_0x17c9('0x42')]({'where':{'sectionId':_0x4757d4['id']},'raw':!![]})[_0x17c9('0x25')](function(_0x2e18cf){var _0x3a1ebf=_[_0x17c9('0x2c')](_0x2e18cf,function(_0x446bb5){return qs['omit'](_0x446bb5,['id',_0x17c9('0x4e'),'updatedAt',_0x17c9('0x57')]);});_0x100f1e(_0x3a1ebf);})[_0x17c9('0x44')](function(_0x584367){_0x59d597(_0x584367);});})[_0x17c9('0x25')](function(_0x35ef79){var _0x339228=qs[_0x17c9('0x4d')](_0x4757d4,['id',_0x17c9('0x4e'),'updatedAt']);_0x339228[_0x17c9('0x58')]=_0x3689a5['id'];if(_0x35ef79)_0x339228[_0x17c9('0x59')]=_0x35ef79;return _0x339228;})[_0x17c9('0x25')](function(_0x55dd3e){return db[_0x17c9('0x53')][_0x17c9('0x48')](_0x55dd3e,{'include':[{'model':db[_0x17c9('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x3cb5d8});});})[_0x17c9('0x25')](function(){return _0x3689a5;});}});});});}})[_0x17c9('0x25')](respondWithResult(_0x3f5077,0xc9))[_0x17c9('0x44')](handleError(_0x3f5077,null));};exports['update']=function(_0x4c6dd9,_0x417041){if(_0x4c6dd9['body']['id']){delete _0x4c6dd9[_0x17c9('0x49')]['id'];}return db['UserProfile'][_0x17c9('0x4b')]({'where':{'id':_0x4c6dd9[_0x17c9('0x46')]['id']}})[_0x17c9('0x25')](handleEntityNotFound(_0x417041,null))['then'](saveUpdates(_0x4c6dd9[_0x17c9('0x49')],null))['then'](respondWithResult(_0x417041,null))[_0x17c9('0x44')](handleError(_0x417041,null));};exports[_0x17c9('0x26')]=function(_0x1884f8,_0x229c80){return db[_0x17c9('0x2d')][_0x17c9('0x4b')]({'where':{'id':_0x1884f8['params']['id']}})[_0x17c9('0x25')](handleEntityNotFound(_0x229c80,null))[_0x17c9('0x25')](removeEntity(_0x229c80,null))[_0x17c9('0x44')](handleError(_0x229c80,null));};exports[_0x17c9('0x5a')]=function(_0x1ee82e,_0x14592c){return db['UserProfile']['describe']()[_0x17c9('0x25')](respondWithResult(_0x14592c,null))[_0x17c9('0x44')](handleError(_0x14592c,null));};exports[_0x17c9('0x5b')]=function(_0x2ca802,_0x2dcc30){var _0x3925f4=_0x2ca802[_0x17c9('0x49')];return db[_0x17c9('0x2d')][_0x17c9('0x4b')]({'where':{'id':_0x2ca802[_0x17c9('0x46')]['id']}})[_0x17c9('0x25')](handleEntityNotFound(_0x2dcc30,null))[_0x17c9('0x25')](function(_0x57c8fc){if(_0x57c8fc){return db[_0x17c9('0x51')]['transaction'](function(_0x380101){return db[_0x17c9('0x53')][_0x17c9('0x26')]({'where':{'userProfileId':_0x2ca802[_0x17c9('0x46')]['id'],'sectionId':_[_0x17c9('0x2c')](_0x3925f4,function(_0x271cf4){return _0x271cf4[_0x17c9('0x57')];})},'transaction':_0x380101})['then'](function(){var _0x5c3714=_[_0x17c9('0x2c')](_0x3925f4,function(_0x57aa72){_0x57aa72[_0x17c9('0x58')]=_0x2ca802[_0x17c9('0x46')]['id'];return _0x57aa72;});var _0x4ecb6c=[];return BPromise[_0x17c9('0x54')](_0x5c3714,function(_0x9cf334){return db[_0x17c9('0x53')][_0x17c9('0x48')](_0x9cf334,{'include':[{'model':db['UserProfileResource'],'as':_0x17c9('0x59')}],'raw':!![],'transaction':_0x380101})[_0x17c9('0x25')](function(_0x35e181){_0x4ecb6c['push'](_0x35e181[_0x17c9('0x4c')]({'plain':!![]}));});})[_0x17c9('0x25')](function(){return _0x4ecb6c;});});});}})[_0x17c9('0x25')](function(_0x3efd8f){return _0x3efd8f;})['then'](respondWithResult(_0x2dcc30,null))['catch'](handleError(_0x2dcc30,null));};exports[_0x17c9('0x5c')]=function(_0x31d3ad,_0x3d0661){var _0x4095ab;return db[_0x17c9('0x2d')][_0x17c9('0x4b')]({'where':{'id':_0x31d3ad[_0x17c9('0x46')]['id']},'attributes':['id',_0x17c9('0x29')]})[_0x17c9('0x25')](handleEntityNotFound(_0x3d0661,null))['then'](function(_0x49fae3){if(_0x49fae3){_0x4095ab=_0x49fae3;return db[_0x17c9('0x53')][_0x17c9('0x26')]({'where':{'userProfileId':_0x31d3ad[_0x17c9('0x46')]['id'],'sectionId':_0x31d3ad[_0x17c9('0x31')][_0x17c9('0x5d')]}});}})[_0x17c9('0x25')](function(){return _0x4095ab;})['then'](respondWithStatusCode(_0x3d0661,null))[_0x17c9('0x44')](handleError(_0x3d0661,null));};exports[_0x17c9('0x5e')]=function(_0x20fcba,_0x595678){var _0x2c9d9d=[];var _0x275972=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x20fcba[_0x17c9('0x46')]['id']},'raw':!![]})[_0x17c9('0x25')](function(_0x5e59aa){_0x2c9d9d=_[_0x17c9('0x3c')](_0x5e59aa,function(_0x105f64){return _0x105f64[_0x17c9('0x5f')]===0x1||_[_0x17c9('0x60')]([0x3eb,0x709],_0x105f64[_0x17c9('0x57')]);});if(!_['isEmpty'](_0x2c9d9d)){return _[_0x17c9('0x2c')](_0x2c9d9d,function(_0x3f3a85){return _0x3f3a85[_0x17c9('0x57')];});}else{return;}})[_0x17c9('0x25')](function(_0x1cb730){if(_0x1cb730)_0x275972=_0x1cb730;if(_['includes'](_0x275972,0x64)){var _0x1bb916=_['find'](_0x2c9d9d,{'sectionId':0x64});return hasDefaultDashboard(_0x1bb916)[_0x17c9('0x25')](function(_0x1f5345){return _[_0x17c9('0x2c')](_0x2c9d9d,function(_0x5ad20f){if(_0x5ad20f['sectionId']===0x64){_0x5ad20f['subsections']=_0x1f5345;}return _0x5ad20f;});});}else{return;}})[_0x17c9('0x25')](function(_0xeea992){if(_0xeea992)_0x2c9d9d=_0xeea992;if(_[_0x17c9('0x60')](_0x275972,0x3eb)){var _0xf31a49=_[_0x17c9('0x4b')](_0x2c9d9d,{'sectionId':0x3eb});return getCustomDashboards(_0xf31a49)['then'](function(_0x599bb1){return _[_0x17c9('0x2c')](_0x2c9d9d,function(_0x4264c5){if(_0xf31a49[_0x17c9('0x5f')]){if(_0x4264c5[_0x17c9('0x57')]===0x3eb){_0x4264c5[_0x17c9('0x61')]=_0x599bb1;}}else{if(_0x4264c5[_0x17c9('0x57')]===0x64){if(!_0x4264c5[_0x17c9('0x61')]){_0x4264c5[_0x17c9('0x61')]=[];}_0x4264c5['subsections']=_0x4264c5['subsections'][_0x17c9('0x62')](_0x599bb1);}}return _0x4264c5;});});}else{return;}})['then'](function(_0x454423){if(_0x454423)_0x2c9d9d=_0x454423;if(_['includes'](_0x275972,0x709)){var _0x100fe4=_[_0x17c9('0x4b')](_0x2c9d9d,{'sectionId':0x709});return getPlugins(_0x100fe4)[_0x17c9('0x25')](function(_0x9bf1f0){if(_0x100fe4[_0x17c9('0x5f')]){return _['map'](_0x2c9d9d,function(_0x252166){if(_0x252166[_0x17c9('0x57')]===0x709){_0x252166[_0x17c9('0x61')]=_0x9bf1f0;}return _0x252166;});}else{var _0xba88df={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9bf1f0};var _0x2685e1=_[_0x17c9('0x2c')](_0x2c9d9d);_0x2685e1[_0x17c9('0x63')](_0xba88df);return _0x2685e1;}});}else{return;}})[_0x17c9('0x25')](function(_0x38c8e0){if(_0x38c8e0)_0x2c9d9d=_0x38c8e0;return _[_0x17c9('0x3c')](_0x2c9d9d,[_0x17c9('0x5f'),0x1]);})[_0x17c9('0x25')](respondWithResult(_0x595678,null))['catch'](handleError(_0x595678,null));};function hasDefaultDashboard(_0x2ba2ee){var _0x3ee976=[0x65];return new BPromise(function(_0x2c5602,_0x112167){try{if(_0x2ba2ee['autoAssociation']){_0x2c5602(_0x3ee976);}else{return db[_0x17c9('0x56')][_0x17c9('0x64')]({'where':{'sectionId':_0x2ba2ee['id']},'raw':!![]})[_0x17c9('0x25')](function(_0x36cc6c){_0x36cc6c?_0x2c5602(_0x3ee976):_0x2c5602();});}}catch(_0xaae2bf){_0x112167(_0xaae2bf);}});}function getCustomDashboards(_0x52b88f){var _0x9622f0=[];return new BPromise(function(_0x1ebbfc,_0x14e3ef){try{if(_0x52b88f[_0x17c9('0x55')]){return db[_0x17c9('0x65')][_0x17c9('0x42')]({'raw':!![]})['then'](function(_0x823c2a){_0x823c2a[_0x17c9('0x66')](function(_0x212a7c){_0x9622f0[_0x17c9('0x63')](_0x212a7c['id']+0x1869f);});_0x1ebbfc(_0x9622f0);});}else{return db[_0x17c9('0x56')]['findAll']({'where':{'sectionId':_0x52b88f['id']},'raw':!![]})['then'](function(_0x55f970){_0x55f970[_0x17c9('0x66')](function(_0x3707b0){_0x9622f0['push'](_0x3707b0['resourceId']+0x1869f);});_0x1ebbfc(_0x9622f0);});}}catch(_0x4d6ecd){_0x14e3ef(_0x4d6ecd);}});}function getPlugins(_0x36d8dd){var _0x52f246=[];return new BPromise(function(_0x27a598,_0xb0756c){try{if(_0x36d8dd[_0x17c9('0x55')]){return db[_0x17c9('0x67')]['findAll']({'raw':!![]})[_0x17c9('0x25')](function(_0xa68c85){_0xa68c85[_0x17c9('0x66')](function(_0x7d27d5){_0x52f246[_0x17c9('0x63')](_0x7d27d5['id']+0x15b38);});_0x27a598(_0x52f246);});}else{return db['UserProfileResource'][_0x17c9('0x42')]({'where':{'sectionId':_0x36d8dd['id']},'raw':!![]})[_0x17c9('0x25')](function(_0x455871){_0x455871['forEach'](function(_0x3968e4){_0x52f246['push'](_0x3968e4[_0x17c9('0x68')]+0x15b38);});_0x27a598(_0x52f246);});}}catch(_0x35120d){_0xb0756c(_0x35120d);}});}exports[_0x17c9('0x69')]=function(_0x3cf663,_0x310951){return db[_0x17c9('0x2d')][_0x17c9('0x4b')]({'where':{'id':_0x3cf663[_0x17c9('0x46')]['id']}})[_0x17c9('0x25')](handleEntityNotFound(_0x310951,null))[_0x17c9('0x25')](function(_0x508d78){if(_0x508d78){return db[_0x17c9('0x51')]['transaction'](function(_0x5b681f){return db[_0x17c9('0x53')][_0x17c9('0x42')]({'where':{'userProfileId':_0x3cf663['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x1553ce){if(_0x1553ce){return db[_0x17c9('0x53')][_0x17c9('0x26')]({'where':{'userProfileId':_0x3cf663[_0x17c9('0x46')]['id'],'id':_[_0x17c9('0x2c')](_0x1553ce,function(_0x2630e7){return _0x2630e7['id'];})},'transaction':_0x5b681f});}})[_0x17c9('0x25')](function(_0x4673f4){var _0x2dc28d=_['map'](_0x3cf663['body'],function(_0x43cd52){_0x43cd52[_0x17c9('0x58')]=_0x3cf663['params']['id'];return _0x43cd52;});return db[_0x17c9('0x53')][_0x17c9('0x6a')](_0x2dc28d,{'raw':!![],'transaction':_0x5b681f});})[_0x17c9('0x25')](function(_0x2836f9){var _0x155bce=_[_0x17c9('0x3c')](_[_0x17c9('0x2c')](_0x2836f9,function(_0x4b2540){return _0x4b2540[_0x17c9('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x155bce){return db[_0x17c9('0x53')]['findAll']({'where':{'userProfileId':_0x3cf663['params']['id'],'sectionId':_[_0x17c9('0x2c')](_0x155bce,function(_0x2d88d5){return _0x2d88d5['sectionId'];})},'attributes':['id',_0x17c9('0x57')],'raw':!![]})[_0x17c9('0x25')](function(_0x1a077a){var _0x11c75d=_[_0x17c9('0x2c')](_0x3cf663[_0x17c9('0x49')],function(_0x237d98){_0x237d98['userProfileId']=_0x3cf663[_0x17c9('0x46')]['id'];return _0x237d98;});return db[_0x17c9('0x56')][_0x17c9('0x6a')](_0x11c75d,{'raw':!![],'transaction':_0x5b681f});});}})['catch'](handleError(_0x310951,null));});}})[_0x17c9('0x25')](function(_0x19ca9a){var _0xc14bf0=_[_0x17c9('0x2c')](_0x19ca9a,function(_0x39ef79){return _0x39ef79[_0x17c9('0x4c')]({'plain':!![]});});})[_0x17c9('0x25')](respondWithResult(_0x310951,null))[_0x17c9('0x44')](handleError(_0x310951,null));};exports['removeResources']=function(_0x2cb3ee,_0x225433,_0x67a4d4){return db[_0x17c9('0x2d')]['find']({'where':{'id':_0x2cb3ee[_0x17c9('0x46')]['id']}})['then'](handleEntityNotFound(_0x225433,null))[_0x17c9('0x25')](function(_0xfd8f31){if(_0xfd8f31){return _0xfd8f31[_0x17c9('0x6b')](_0x2cb3ee[_0x17c9('0x31')][_0x17c9('0x5d')]);}})[_0x17c9('0x25')](respondWithStatusCode(_0x225433,null))[_0x17c9('0x44')](handleError(_0x225433,null));};exports[_0x17c9('0x6c')]=function(_0x12e06e,_0x54f35c){var _0x5c8092={};if(!_0x12e06e[_0x17c9('0x31')]['section'])throw new Error(_0x17c9('0x6d'));if(!_0x12e06e[_0x17c9('0x31')]['hasOwnProperty'](_0x17c9('0x6e'))){_0x5c8092[_0x17c9('0x1f')]=qs[_0x17c9('0x1f')](_0x12e06e['query']['limit']);_0x5c8092['offset']=qs[_0x17c9('0x1e')](_0x12e06e[_0x17c9('0x31')]['offset']);}return db[_0x17c9('0x2d')]['find']({'where':{'id':_0x12e06e['params']['id']}})['then'](function(_0x2fb18a){if(!_0x2fb18a)throw new Error(_0x17c9('0x6f')+_0x12e06e['params']['id']);return db['UserProfile'][_0x17c9('0x6c')](_0x12e06e);})['then'](respondWithFilteredResult(_0x54f35c,_0x5c8092))[_0x17c9('0x44')](handleError(_0x54f35c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index efe21ad..759fd72 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 _0x2525=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4517f3,_0x3af8ef){var _0x1d63d3=function(_0x459a04){while(--_0x459a04){_0x4517f3['push'](_0x4517f3['shift']());}};_0x1d63d3(++_0x3af8ef);}(_0x2525,0x1f0));var _0x5252=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2525[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0x5252('0x0'));var UserProfile=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5252('0x3')](0x0);var events={'afterCreate':_0x5252('0x4'),'afterUpdate':_0x5252('0x5'),'afterDestroy':_0x5252('0x6')};function emitEvent(_0x1138af){return function(_0x28efdd,_0x4907eb,_0x4a73a2){UserProfileEvents[_0x5252('0x7')](_0x1138af+':'+_0x28efdd['id'],_0x28efdd);UserProfileEvents[_0x5252('0x7')](_0x1138af,_0x28efdd);_0x4a73a2(null);};}for(var e in events){if(events[_0x5252('0x8')](e)){var event=events[e];UserProfile[_0x5252('0x9')](e,emitEvent(event));}}module[_0x5252('0xa')]=UserProfileEvents; \ No newline at end of file +var _0xeda7=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeda7,0x196));var _0x7eda=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xeda7[_0x10004e];return _0x5af990;};'use strict';var EventEmitter=require(_0x7eda('0x0'));var UserProfile=require(_0x7eda('0x1'))['db'][_0x7eda('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7eda('0x3')](0x0);var events={'afterCreate':_0x7eda('0x4'),'afterUpdate':_0x7eda('0x5'),'afterDestroy':_0x7eda('0x6')};function emitEvent(_0x2b1d21){return function(_0x324a25,_0x36a9f1,_0x15856b){UserProfileEvents[_0x7eda('0x7')](_0x2b1d21+':'+_0x324a25['id'],_0x324a25);UserProfileEvents[_0x7eda('0x7')](_0x2b1d21,_0x324a25);_0x15856b(null);};}for(var e in events){if(events[_0x7eda('0x8')](e)){var event=events[e];UserProfile[_0x7eda('0x9')](e,emitEvent(event));}}module[_0x7eda('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c71d566..703af58 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 _0x8f18=['telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','VoiceQueues','users','agents','user','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','slice','Sequelize','select','ui.','InteractionId','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','then','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','all','push','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','options','include','reportType','reportId','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tags','color','tag','ThroughTags','openTabs','dataValues','openchannel','./userProfile.attributes','squel','models','field','filter','value','findAll','catch','model','associatedResources','name','resolve','UserProfileResource','map','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x8f18,0x1e6));var _0x88f1=function(_0x11e203,_0x4fd4ce){_0x11e203=_0x11e203-0x0;var _0x2a0a4b=_0x8f18[_0x11e203];return _0x2a0a4b;};'use strict';var _=require('lodash');var attributes=require(_0x88f1('0x0'));var squel=require(_0x88f1('0x1'));module['exports']=function(_0x5aee9a){var _0x39717f=_0x5aee9a[_0x88f1('0x2')];function _0x1da27d(_0x4d6511,_0x143144){return new Promise(function(_0x34f55d,_0x5420b8){if(!_0x143144)return _0x34f55d(null);var _0x3865d4=_0x143144['filter']?{[_0x143144['filter'][_0x88f1('0x3')]]:_0x143144[_0x88f1('0x4')][_0x88f1('0x5')]}:undefined;return _0x39717f[_0x4d6511][_0x88f1('0x6')]({'where':_0x3865d4,'raw':!![]})['then'](function(_0x189fef){_0x143144['associatedResources']=_['map'](_0x189fef,'id');_0x34f55d(_0x143144);})[_0x88f1('0x7')](function(_0x3ec34e){_0x5420b8(_0x3ec34e);});});}function _0x32a2fa(_0x5a21cf,_0xa5c94c){return new Promise(function(_0x12b8cd,_0x37efcd){var _0x284863=_0x5a21cf[_0x88f1('0x4')]?{[_0x5a21cf[_0x88f1('0x4')]['field']]:_0x5a21cf[_0x88f1('0x4')]['value']}:undefined;return _0x39717f[_0x5a21cf[_0x88f1('0x8')]][_0x88f1('0x6')]({'where':_0x284863,'raw':!![]})['then'](function(_0x4efe82){_0xa5c94c[_0x88f1('0x9')]=_['map'](_0x4efe82,function(_0x27c78f){return _0x27c78f[_0x88f1('0xa')];});_0x12b8cd(_0xa5c94c);})[_0x88f1('0x7')](function(_0xba786c){_0x37efcd(_0xba786c);});});}function _0x4e9072(_0x433911,_0x5f2a02,_0x566dc9){if(!_0x5f2a02)return Promise[_0x88f1('0xb')](null);return new Promise(function(_0x47f444,_0x5e0ee8){return _0x39717f[_0x88f1('0xc')][_0x88f1('0x6')]({'where':{'sectionId':_0x5f2a02['id']},'raw':!![]})['then'](function(_0x3532cb){if(_0x433911[_0x88f1('0x3')]&&_0x433911[_0x88f1('0x3')]!=='id'){_0x5f2a02[_0x88f1('0x9')]=_[_0x88f1('0xd')](_0x3532cb,function(_0x8b7478){return _0x8b7478[_0x433911[_0x88f1('0x3')]];});}else{if(_0x566dc9===_0x88f1('0xe')){_0x5f2a02['associatedResources']=_['map'](_0x3532cb,function(_0x3edf2f){return{'id':_0x3edf2f[_0x88f1('0xf')],'type':_0x3edf2f[_0x88f1('0x10')]};});}else{_0x5f2a02[_0x88f1('0x9')]=_[_0x88f1('0xd')](_0x3532cb,function(_0x345e8c){return _0x345e8c[_0x88f1('0xf')];});}}_0x47f444(_0x5f2a02);})['catch'](function(_0xf8744e){_0x5e0ee8(_0xf8744e);});});}function _0x35a297(_0x5d13da,_0x2e7ff1){var _0x1248c3={'parentSections':[]};switch(_0x5d13da[_0x88f1('0x11')]()){case'squareprojects':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x13');break;case'odbc':_0x1248c3[_0x88f1('0x12')]='SquareOdbc';break;case _0x88f1('0x14'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x15');_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x17'),'field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x18')}];break;case _0x88f1('0x19'):_0x1248c3[_0x88f1('0x12')]='JscriptyProject';break;case _0x88f1('0x1a'):_0x1248c3['childModel']=_0x88f1('0x1b');_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x1c'),'field':'id','foreignKey':_0x88f1('0x1d')}];break;case _0x88f1('0x1e'):_0x1248c3[_0x88f1('0x12')]='CmList';break;case _0x88f1('0x1f'):_0x1248c3['childModel']=_0x88f1('0x20');break;case _0x88f1('0x21'):_0x1248c3['childModel']=_0x88f1('0x22');break;case _0x88f1('0x23'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x24');break;case _0x88f1('0x25'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x26');break;case'faxqueues':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x27');break;case _0x88f1('0x28'):_0x1248c3[_0x88f1('0x12')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case'outboundroutes':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x29');break;case _0x88f1('0x2a'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x2b');break;case _0x88f1('0x2c'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x2d');break;case _0x88f1('0x2e'):_0x1248c3['childModel']=_0x88f1('0x2f');_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x30'),'field':'name','foreignKey':_0x88f1('0x31'),'model':_0x88f1('0x32'),'filter':{'field':'role','value':[_0x88f1('0x33')]}},{'name':_0x88f1('0x34'),'field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x31'),'model':_0x88f1('0x32'),'filter':{'field':_0x88f1('0x35'),'value':[_0x88f1('0x36')]}},{'name':'VoiceQueues','field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x37'),'model':_0x88f1('0x38'),'filter':{'field':_0x88f1('0x10'),'value':[_0x88f1('0x39')]}},{'name':_0x88f1('0x3a'),'field':_0x88f1('0xa'),'foreignKey':_0x88f1('0x37'),'model':_0x88f1('0x38'),'filter':{'field':'type','value':[_0x88f1('0x3b')]}}];break;case'musiconholds':_0x1248c3['childModel']=_0x88f1('0x3c');break;case'chanspies':_0x1248c3['childModel']='VoiceChanSpy';break;case _0x88f1('0x3d'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x3e');break;case _0x88f1('0x3f'):_0x1248c3['childModel']=_0x88f1('0x40');break;case _0x88f1('0x41'):_0x1248c3['childModel']='MailQueue';break;case'mailaccounts':_0x1248c3['childModel']=_0x88f1('0x42');break;case _0x88f1('0x43'):_0x1248c3[_0x88f1('0x12')]='MailSubstatus';break;case _0x88f1('0x44'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x45');break;case'openchannelaccounts':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x46');break;case _0x88f1('0x47'):_0x1248c3['childModel']=_0x88f1('0x48');break;case _0x88f1('0x49'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x4a');break;case _0x88f1('0x4b'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x4c');break;case'whatsappaccounts':_0x1248c3[_0x88f1('0x12')]='WhatsappAccount';break;case _0x88f1('0x4d'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x4e');break;case'voicequeues':case'queuecampaigns':_0x1248c3['childModel']=_0x88f1('0x38');if(_0x2e7ff1){_0x1248c3[_0x88f1('0x16')]=[{'name':_0x88f1('0x4f')},{'name':_0x88f1('0x3a')}];}break;case _0x88f1('0x50'):case _0x88f1('0x51'):case'telephones':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x32');if(_0x2e7ff1){_0x1248c3[_0x88f1('0x16')]=[{'name':'Users','filter':{'field':_0x88f1('0x35'),'value':['admin',_0x88f1('0x52')]},'ignore':!![]},{'name':_0x88f1('0x30')},{'name':_0x88f1('0x34')}];}break;case'zendeskaccounts':_0x1248c3['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x53');break;case _0x88f1('0x54'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x55');break;case _0x88f1('0x56'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x57');break;case'deskaccounts':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x58');break;case _0x88f1('0x59'):_0x1248c3['childModel']=_0x88f1('0x5a');break;case _0x88f1('0x5b'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x32');break;case _0x88f1('0x5c'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x5d');break;case'dispositions':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x5e');break;case _0x88f1('0x5f'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x60');break;case _0x88f1('0x61'):_0x1248c3[_0x88f1('0x12')]='Interval';break;case _0x88f1('0x62'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x63');break;case _0x88f1('0x64'):_0x1248c3[_0x88f1('0x12')]='Schedule';break;case _0x88f1('0x65'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x66');break;case _0x88f1('0x67'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x68');break;case _0x88f1('0x69'):_0x1248c3['childModel']=_0x88f1('0x6a');break;case _0x88f1('0x6b'):_0x1248c3['childModel']=_0x88f1('0x6c');break;case _0x88f1('0x6d'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x6e');break;case'variables':_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x6f');break;case _0x88f1('0x70'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0x71');break;case _0x88f1('0x72'):_0x1248c3[_0x88f1('0x12')]=_0x88f1('0xe');_0x1248c3['parentSections']=[{'name':_0x88f1('0x73'),'field':'id','foreignKey':'reportId'}];break;case _0x88f1('0x74'):_0x1248c3['childModel']='AnalyticMetric';break;}return _0x1248c3;}function _0x2fe076(_0x55c1cb,_0x3383d7){var _0x179e34=_0x55c1cb[_0x88f1('0x75')](0x0)[_0x88f1('0x76')]()+_0x55c1cb[_0x88f1('0x77')](0x1);var _0x55e4e3={'type':_0x39717f[_0x88f1('0x78')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x110663,_0x19ed10){var _0x4b1c00=squel[_0x88f1('0x79')]()[_0x88f1('0x3')](_0x88f1('0x7a')+_0x179e34+_0x88f1('0x7b'),'id')[_0x88f1('0x3')]('ui.createdAt')[_0x88f1('0x7c')](_0x88f1('0x7d')+_0x55c1cb+'_interactions','ui')[_0x88f1('0x7e')](_0x88f1('0x7f'),_0x3383d7['id']);return _0x39717f[_0x88f1('0x80')][_0x88f1('0x81')](_0x4b1c00['toString'](),_0x55e4e3)[_0x88f1('0x82')](function(_0x4bbc4d){_0x3383d7[_0x179e34+'OpenTabs']=_0x4bbc4d;_0x110663(_0x4bbc4d);})['catch'](function(_0x2a5140){_0x19ed10(_0x2a5140);});});}return _0x5aee9a['define'](_0x88f1('0x83'),attributes,{'tableName':_0x88f1('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2f02c1){var _0x55a789=require(_0x88f1('0x85'));var _0x30a531={'raw':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0x86')],'where':{}};var _0x1f08be={};var _0x1c68c1={'count':0x0,'rows':[]};var _0x1a44a9=_0x2f02c1['query'][_0x88f1('0x87')];var _0x4dccec=_0x2f02c1[_0x88f1('0x81')][_0x88f1('0x88')]||![];var _0x14646e=_0x35a297(_0x1a44a9,_0x4dccec);if(!_0x14646e['childModel'])throw new Error(_0x88f1('0x89')+_0x1a44a9+'\x27');var _0x266538=[{'name':_0x1a44a9}];if(!_[_0x88f1('0x8a')](_0x14646e[_0x88f1('0x16')]))_0x266538=_0x14646e[_0x88f1('0x16')];var _0x3bcf43=[];for(var _0x47f0a1=0x0;_0x47f0a1<_0x266538[_0x88f1('0x8b')];_0x47f0a1++){_0x3bcf43['push'](_0x39717f[_0x88f1('0x8c')][_0x88f1('0x8d')]({'where':{'userProfileId':_0x2f02c1['params']['id'],'name':_0x266538[_0x47f0a1][_0x88f1('0xa')]},'raw':!![]}));}return Promise[_0x88f1('0x8e')](_0x3bcf43)['then'](function(_0x2548ff){var _0xd4113e=_[_0x88f1('0x4')](_0x2548ff,function(_0x5b6a6f){return _0x5b6a6f?_0x5b6a6f:undefined;});var _0x19c294=_[_0x88f1('0x4')](_0x266538,['ignore',!![]]);var _0x16f8cd=_[_0x88f1('0x8a')](_0xd4113e)&&_[_0x88f1('0x8a')](_0x19c294)?null:_['union'](_0x19c294,_0xd4113e);if(!_0x16f8cd)return null;var _0x463279=[];for(var _0x3619df=0x0;_0x3619df<_0x16f8cd[_0x88f1('0x8b')];_0x3619df++){var _0x1f3e54=_[_0x88f1('0x8d')](_0x266538,function(_0x633735){return _0x16f8cd[_0x3619df]?_0x633735['name']===_0x16f8cd[_0x3619df][_0x88f1('0xa')]:null;});if(_0x1f3e54){if(_0x16f8cd[_0x3619df]['ignore']){_0x463279[_0x88f1('0x8f')](_0x1da27d(_0x14646e[_0x88f1('0x12')],_0x16f8cd[_0x3619df]));}else{if(!_0x16f8cd[_0x3619df][_0x88f1('0x90')]){_0x463279['push'](_0x4e9072(_0x1f3e54,_0x16f8cd[_0x3619df],_0x14646e[_0x88f1('0x12')]));}else{if(_0x1f3e54[_0x88f1('0x8')]){_0x463279[_0x88f1('0x8f')](_0x32a2fa(_0x1f3e54,_0x16f8cd[_0x3619df]));}}}}}return Promise['all'](_0x463279);})[_0x88f1('0x82')](function(_0x3324d8){var _0x835b1b=_0x3324d8;var _0x2b7c9b=null;if(_0x835b1b){_0x2b7c9b=_0x835b1b[_0x88f1('0x8b')]===0x1?_0x835b1b[0x0]:null;}if(!_0x2b7c9b&&!_0x835b1b)return _0x1c68c1;var _0x586001=_0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0x91')];_0x1f08be['model']=_[_0x88f1('0x92')](_0x586001);_0x1f08be['query']=_[_0x88f1('0x92')](_0x2f02c1[_0x88f1('0x81')]);_0x1f08be[_0x88f1('0x93')]=_[_0x88f1('0x94')](_0x1f08be['model'],_0x1f08be[_0x88f1('0x81')]);_0x30a531[_0x88f1('0x95')]=_[_0x88f1('0x94')](_0x1f08be[_0x88f1('0x8')],_0x55a789[_0x88f1('0x96')](_0x2f02c1[_0x88f1('0x81')]['fields']));_0x30a531['attributes']=_0x30a531[_0x88f1('0x95')]['length']?_0x30a531[_0x88f1('0x95')]:_0x1f08be[_0x88f1('0x8')];if(!_0x2f02c1[_0x88f1('0x81')]['hasOwnProperty'](_0x88f1('0x97'))){_0x30a531[_0x88f1('0x98')]=_0x55a789['limit'](_0x2f02c1['query'][_0x88f1('0x98')]);_0x30a531[_0x88f1('0x99')]=_0x55a789[_0x88f1('0x99')](_0x2f02c1['query'][_0x88f1('0x99')]);}_0x30a531[_0x88f1('0x9a')]=_0x55a789[_0x88f1('0x9b')](_0x2f02c1[_0x88f1('0x81')][_0x88f1('0x9b')]);_0x30a531['where']=_0x55a789['filters'](_[_0x88f1('0x9c')](_0x2f02c1[_0x88f1('0x81')],_0x1f08be[_0x88f1('0x93')]));if(_0x2f02c1[_0x88f1('0x81')]['filter']){_0x30a531[_0x88f1('0x7e')]=_[_0x88f1('0x9d')](_0x30a531[_0x88f1('0x7e')],{'$or':_['map'](_0x586001,function(_0x416f7c){if(_0x416f7c['type'][_0x88f1('0x9e')]!==_0x88f1('0x9f')){var _0x1e9d68={};_0x1e9d68[_0x416f7c[_0x88f1('0x3')]]={'$like':'%'+_0x2f02c1[_0x88f1('0x81')]['filter']+'%'};return _0x1e9d68;}})});}var _0x4d5ad6=[];var _0x3961b7=null;var _0x425b7e={};if(_0x2b7c9b){_0x3961b7=_[_0x88f1('0x8d')](_0x266538,[_0x88f1('0xa'),_0x2b7c9b[_0x88f1('0xa')]]);if(_0x3961b7[_0x88f1('0x3')]){_0x425b7e={};if(_0x14646e['childModel']===_0x88f1('0xe')){_0x425b7e[_0x3961b7[_0x88f1('0xa0')]]=_['map'](_0x2b7c9b['associatedResources'],'id');}else{_0x425b7e[_0x3961b7[_0x88f1('0xa0')]]=_0x2b7c9b[_0x88f1('0x9')];}_0x4d5ad6[_0x88f1('0x8f')](_0x425b7e);}else{_0x30a531[_0x88f1('0x7e')]['id']=_0x2b7c9b[_0x88f1('0x9')];}}else{for(var _0x652a28=0x0;_0x652a28<_0x835b1b[_0x88f1('0x8b')];_0x652a28++){_0x3961b7=_[_0x88f1('0x8d')](_0x266538,[_0x88f1('0xa'),_0x835b1b[_0x652a28][_0x88f1('0xa')]]);if(_0x3961b7[_0x88f1('0x3')]){_0x425b7e={};_0x425b7e[_0x3961b7[_0x88f1('0xa0')]]=_0x835b1b[_0x652a28][_0x88f1('0x9')];_0x4d5ad6['push'](_0x425b7e);}else{if(!_0x30a531['where']['id'])_0x30a531[_0x88f1('0x7e')]['id']=[];_0x835b1b[_0x652a28][_0x88f1('0x9')]['forEach'](function(_0x18458d){_0x30a531[_0x88f1('0x7e')]['id'][_0x88f1('0x8f')](_0x18458d);});}}}if(!_[_0x88f1('0x8a')](_0x4d5ad6)){_0x30a531[_0x88f1('0x7e')]=_[_0x88f1('0x9d')](_0x30a531[_0x88f1('0x7e')],{'$and':{'$or':_0x4d5ad6}});}_0x30a531=_[_0x88f1('0x9d')]({},_0x30a531,_0x2f02c1[_0x88f1('0xa1')]);if(_0x2b7c9b&&!_0x2b7c9b[_0x88f1('0x90')]&&_0x14646e['childModel']===_0x88f1('0xe')){if(_0x2f02c1['query']['includeAll']){_0x30a531[_0x88f1('0xa2')]=[{'all':!![]}];}return _0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0x6')](_0x30a531)['then'](function(_0x432260){var _0x29ed7a=[];_0x432260['forEach'](function(_0x4a1f4d){var _0x5759cb;switch(_0x4a1f4d[_0x88f1('0xa3')]){case'default':_0x5759cb=_['find'](_0x2b7c9b[_0x88f1('0x9')],function(_0x27cea7){return _0x27cea7['id']===_0x4a1f4d[_0x88f1('0xa4')]&&_0x27cea7[_0x88f1('0x10')]==='DefaultReports';});break;case _0x88f1('0xa5'):_0x5759cb=_[_0x88f1('0x8d')](_0x2b7c9b[_0x88f1('0x9')],function(_0x2adb8d){return _0x2adb8d['id']===_0x4a1f4d[_0x88f1('0xa4')]&&_0x2adb8d[_0x88f1('0x10')]===_0x88f1('0xa6');});break;}if(_0x5759cb)_0x29ed7a[_0x88f1('0x8f')](_0x4a1f4d);});_0x1c68c1[_0x88f1('0xa7')]=_0x29ed7a[_0x88f1('0x8b')];_0x1c68c1[_0x88f1('0xa8')]=_0x29ed7a;return _0x1c68c1;});}else{if(!_[_0x88f1('0x8a')](_0x2f02c1[_0x88f1('0x81')]['ids'])){_0x30a531['where']['id']=_0x30a531[_0x88f1('0x7e')]['id']?_[_0x88f1('0x94')](_0x30a531[_0x88f1('0x7e')]['id'],_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xa9')]):_0x2f02c1['query'][_0x88f1('0xa9')];if(_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaa')]){_0x30a531[_0x88f1('0x9a')]=_0x2f02c1['query']['customSorting'];}}if(_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xab')]){_0x30a531['where']=_[_0x88f1('0x9d')](_0x30a531['where'],{'$and':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xab')]});}return _0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0xa7')]({'where':_0x30a531[_0x88f1('0x7e')]})[_0x88f1('0x82')](function(_0xdfae62){_0x1c68c1['count']=_0xdfae62;if(_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xac')]){if(_0x14646e[_0x88f1('0x12')]===_0x88f1('0x1b')){_0x30a531[_0x88f1('0xa2')]=[{'model':_0x39717f[_0x88f1('0x68')],'as':_0x88f1('0xad'),'attributes':['id',_0x88f1('0xa'),_0x88f1('0xae')],'required':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]?!![]:![]},{'model':_0x39717f['Tag'],'as':_0x88f1('0xb0'),'attributes':['id',_0x88f1('0xa'),_0x88f1('0xae')],'through':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]?{'attributes':[],'where':{'TagId':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]||undefined}}:{},'required':_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xaf')]?!![]:![]}];}else{_0x30a531[_0x88f1('0xa2')]=[{'all':!![]}];}}return _0x39717f[_0x14646e[_0x88f1('0x12')]][_0x88f1('0x6')](_0x30a531);})[_0x88f1('0x82')](function(_0xfb3839){_0x1c68c1[_0x88f1('0xa8')]=_0xfb3839;if(_0x1a44a9==='Agents'&&_0x2f02c1[_0x88f1('0x81')][_0x88f1('0xb1')]==='true'){var _0x2e2e9e=[];for(var _0x400980=0x0;_0x400980<_0x1c68c1[_0x88f1('0xa8')][_0x88f1('0x8b')];_0x400980++){_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('chat',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('sms',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('fax',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('mail',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076(_0x88f1('0xb3'),_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));_0x2e2e9e[_0x88f1('0x8f')](_0x2fe076('whatsapp',_0x1c68c1[_0x88f1('0xa8')][_0x400980][_0x88f1('0xb2')]));}return Promise[_0x88f1('0x8e')](_0x2e2e9e)['then'](function(){return _0x1c68c1;});}return _0x1c68c1;});}});}}});}; \ No newline at end of file +var _0xae20=['fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','custom','reportId','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','CmContact','Tags','color','ThroughTags','tag','Agents','openTabs','true','chat','sms','dataValues','fax','whatsapp','all','squel','models','filter','field','value','findAll','then','model','associatedResources','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','map','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','JscriptyProject','contacts','Lists','ListId','lists','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','role','agent','Telephones','membername','User','VoiceQueues','inbound','QueueCampaigns','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','users','telephones','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','pauses','scheduler','sounds','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','metrics','AnalyticMetric','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','UserProfile','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes'];(function(_0x1e2130,_0x3c670c){var _0x1df983=function(_0x185566){while(--_0x185566){_0x1e2130['push'](_0x1e2130['shift']());}};_0x1df983(++_0x3c670c);}(_0xae20,0xe4));var _0x0ae2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae20[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require(_0x0ae2('0x0'));module['exports']=function(_0x32d626){var _0x36f5e0=_0x32d626[_0x0ae2('0x1')];function _0x3a168d(_0x42d340,_0x3de825){return new Promise(function(_0x5c3587,_0x46b04d){if(!_0x3de825)return _0x5c3587(null);var _0x5870ae=_0x3de825['filter']?{[_0x3de825[_0x0ae2('0x2')][_0x0ae2('0x3')]]:_0x3de825[_0x0ae2('0x2')][_0x0ae2('0x4')]}:undefined;return _0x36f5e0[_0x42d340][_0x0ae2('0x5')]({'where':_0x5870ae,'raw':!![]})[_0x0ae2('0x6')](function(_0x48dc66){_0x3de825['associatedResources']=_['map'](_0x48dc66,'id');_0x5c3587(_0x3de825);})['catch'](function(_0x35a1ec){_0x46b04d(_0x35a1ec);});});}function _0x598357(_0x11941d,_0x1f2f6a){return new Promise(function(_0x4b4194,_0x5999d0){var _0x5e92ef=_0x11941d[_0x0ae2('0x2')]?{[_0x11941d[_0x0ae2('0x2')][_0x0ae2('0x3')]]:_0x11941d[_0x0ae2('0x2')][_0x0ae2('0x4')]}:undefined;return _0x36f5e0[_0x11941d[_0x0ae2('0x7')]]['findAll']({'where':_0x5e92ef,'raw':!![]})[_0x0ae2('0x6')](function(_0x1ab901){_0x1f2f6a[_0x0ae2('0x8')]=_['map'](_0x1ab901,function(_0x2309cd){return _0x2309cd[_0x0ae2('0x9')];});_0x4b4194(_0x1f2f6a);})[_0x0ae2('0xa')](function(_0x2b87f6){_0x5999d0(_0x2b87f6);});});}function _0x12247b(_0x14a873,_0x244b69,_0x13d8c3){if(!_0x244b69)return Promise[_0x0ae2('0xb')](null);return new Promise(function(_0x43e716,_0x54c7d4){return _0x36f5e0[_0x0ae2('0xc')]['findAll']({'where':{'sectionId':_0x244b69['id']},'raw':!![]})[_0x0ae2('0x6')](function(_0x270769){if(_0x14a873[_0x0ae2('0x3')]&&_0x14a873[_0x0ae2('0x3')]!=='id'){_0x244b69[_0x0ae2('0x8')]=_['map'](_0x270769,function(_0x52d32b){return _0x52d32b[_0x14a873[_0x0ae2('0x3')]];});}else{if(_0x13d8c3===_0x0ae2('0xd')){_0x244b69[_0x0ae2('0x8')]=_[_0x0ae2('0xe')](_0x270769,function(_0x215c85){return{'id':_0x215c85[_0x0ae2('0xf')],'type':_0x215c85[_0x0ae2('0x10')]};});}else{_0x244b69[_0x0ae2('0x8')]=_[_0x0ae2('0xe')](_0x270769,function(_0x1e04b2){return _0x1e04b2[_0x0ae2('0xf')];});}}_0x43e716(_0x244b69);})[_0x0ae2('0xa')](function(_0x224b78){_0x54c7d4(_0x224b78);});});}function _0x45cadc(_0x8b54e,_0xc35561){var _0x5a42aa={'parentSections':[]};switch(_0x8b54e[_0x0ae2('0x11')]()){case _0x0ae2('0x12'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x14');break;case _0x0ae2('0x15'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x16');break;case _0x0ae2('0x17'):_0x5a42aa[_0x0ae2('0x13')]='SquareRecording';_0x5a42aa[_0x0ae2('0x18')]=[{'name':_0x0ae2('0x19'),'field':_0x0ae2('0x9'),'foreignKey':_0x0ae2('0x1a')}];break;case'projects':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x1b');break;case _0x0ae2('0x1c'):_0x5a42aa['childModel']='CmContact';_0x5a42aa[_0x0ae2('0x18')]=[{'name':_0x0ae2('0x1d'),'field':'id','foreignKey':_0x0ae2('0x1e')}];break;case _0x0ae2('0x1f'):_0x5a42aa[_0x0ae2('0x13')]='CmList';break;case _0x0ae2('0x20'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x21');break;case'globalcustomfields':_0x5a42aa[_0x0ae2('0x13')]='CmCustomField';break;case _0x0ae2('0x22'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x23');break;case _0x0ae2('0x24'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x25');break;case _0x0ae2('0x26'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x27');break;case _0x0ae2('0x28'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x29');break;case'inboundroutes':case _0x0ae2('0x2a'):case _0x0ae2('0x2b'):_0x5a42aa['childModel']=_0x0ae2('0x2c');break;case'contexts':_0x5a42aa['childModel']=_0x0ae2('0x2d');break;case _0x0ae2('0x2e'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x2f');break;case _0x0ae2('0x30'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x31');_0x5a42aa[_0x0ae2('0x18')]=[{'name':'Agents','field':_0x0ae2('0x9'),'foreignKey':'membername','model':'User','filter':{'field':_0x0ae2('0x32'),'value':[_0x0ae2('0x33')]}},{'name':_0x0ae2('0x34'),'field':_0x0ae2('0x9'),'foreignKey':_0x0ae2('0x35'),'model':_0x0ae2('0x36'),'filter':{'field':_0x0ae2('0x32'),'value':['telephone']}},{'name':_0x0ae2('0x37'),'field':_0x0ae2('0x9'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x0ae2('0x10'),'value':[_0x0ae2('0x38')]}},{'name':_0x0ae2('0x39'),'field':_0x0ae2('0x9'),'foreignKey':_0x0ae2('0x3a'),'model':_0x0ae2('0x3b'),'filter':{'field':'type','value':[_0x0ae2('0x3c')]}}];break;case _0x0ae2('0x3d'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x3e');break;case _0x0ae2('0x3f'):_0x5a42aa[_0x0ae2('0x13')]='VoiceChanSpy';break;case'voiceprefixes':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x40');break;case _0x0ae2('0x41'):_0x5a42aa[_0x0ae2('0x13')]='Campaign';break;case _0x0ae2('0x42'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x43');break;case _0x0ae2('0x44'):_0x5a42aa['childModel']=_0x0ae2('0x45');break;case _0x0ae2('0x46'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x47');break;case _0x0ae2('0x48'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x49');break;case'openchannelaccounts':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x4a');break;case _0x0ae2('0x4b'):_0x5a42aa[_0x0ae2('0x13')]='SmsQueue';break;case _0x0ae2('0x4c'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x4d');break;case _0x0ae2('0x4e'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x4f');break;case _0x0ae2('0x50'):_0x5a42aa[_0x0ae2('0x13')]='WhatsappAccount';break;case'teams':_0x5a42aa[_0x0ae2('0x13')]='Team';break;case'voicequeues':case'queuecampaigns':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x3b');if(_0xc35561){_0x5a42aa[_0x0ae2('0x18')]=[{'name':_0x0ae2('0x37')},{'name':_0x0ae2('0x39')}];}break;case _0x0ae2('0x51'):case'agents':case _0x0ae2('0x52'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x36');if(_0xc35561){_0x5a42aa[_0x0ae2('0x18')]=[{'name':'Users','filter':{'field':'role','value':[_0x0ae2('0x53'),_0x0ae2('0x54')]},'ignore':!![]},{'name':'Agents'},{'name':_0x0ae2('0x34')}];}break;case _0x0ae2('0x55'):_0x5a42aa['childModel']=_0x0ae2('0x56');break;case'salesforceaccounts':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x57');break;case'freshdeskaccounts':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x58');break;case _0x0ae2('0x59'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x5a');break;case _0x0ae2('0x5b'):_0x5a42aa['childModel']=_0x0ae2('0x5c');break;case _0x0ae2('0x5d'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x5e');break;case'vtigeraccounts':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x36');break;case'cannedanswers':_0x5a42aa['childModel']=_0x0ae2('0x5f');break;case _0x0ae2('0x60'):_0x5a42aa['childModel']='Disposition';break;case _0x0ae2('0x61'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x62');break;case _0x0ae2('0x63'):_0x5a42aa[_0x0ae2('0x13')]='Interval';break;case _0x0ae2('0x64'):_0x5a42aa['childModel']='Pause';break;case _0x0ae2('0x65'):_0x5a42aa[_0x0ae2('0x13')]='Schedule';break;case _0x0ae2('0x66'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x67');break;case _0x0ae2('0x68'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x69');break;case'templates':_0x5a42aa['childModel']=_0x0ae2('0x6a');break;case _0x0ae2('0x6b'):_0x5a42aa['childModel']=_0x0ae2('0x6c');break;case _0x0ae2('0x6d'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x6e');break;case _0x0ae2('0x6f'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x70');break;case'plugins':_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x71');break;case _0x0ae2('0x72'):_0x5a42aa[_0x0ae2('0x13')]='AnalyticExtractedReport';_0x5a42aa['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x0ae2('0x73'):_0x5a42aa[_0x0ae2('0x13')]=_0x0ae2('0x74');break;}return _0x5a42aa;}function _0xd8161e(_0x2a3f43,_0x355b1e){var _0x400027=_0x2a3f43['charAt'](0x0)[_0x0ae2('0x75')]()+_0x2a3f43[_0x0ae2('0x76')](0x1);var _0x5ab3ac={'type':_0x36f5e0['Sequelize'][_0x0ae2('0x77')][_0x0ae2('0x78')],'raw':!![]};return new Promise(function(_0xa8ceac,_0x5d5138){var _0x1f8a4a=squel[_0x0ae2('0x79')]()[_0x0ae2('0x3')](_0x0ae2('0x7a')+_0x400027+'InteractionId','id')['field'](_0x0ae2('0x7b'))['from'](_0x0ae2('0x7c')+_0x2a3f43+_0x0ae2('0x7d'),'ui')['where'](_0x0ae2('0x7e'),_0x355b1e['id']);return _0x36f5e0[_0x0ae2('0x7f')][_0x0ae2('0x80')](_0x1f8a4a['toString'](),_0x5ab3ac)['then'](function(_0x2d8353){_0x355b1e[_0x400027+'OpenTabs']=_0x2d8353;_0xa8ceac(_0x2d8353);})['catch'](function(_0x10382e){_0x5d5138(_0x10382e);});});}return _0x32d626['define'](_0x0ae2('0x81'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3b765d){var _0x339d4a=require('../../components/parsers/qs');var _0x218e4d={'raw':_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0x82')],'where':{}};var _0x172eb6={};var _0x575ede={'count':0x0,'rows':[]};var _0x2b3fba=_0x3b765d['query'][_0x0ae2('0x83')];var _0x35d244=_0x3b765d['query']['mergeResources']||![];var _0x442533=_0x45cadc(_0x2b3fba,_0x35d244);if(!_0x442533[_0x0ae2('0x13')])throw new Error(_0x0ae2('0x84')+_0x2b3fba+'\x27');var _0x3a315b=[{'name':_0x2b3fba}];if(!_[_0x0ae2('0x85')](_0x442533[_0x0ae2('0x18')]))_0x3a315b=_0x442533[_0x0ae2('0x18')];var _0x2905a4=[];for(var _0x3dffa7=0x0;_0x3dffa7<_0x3a315b[_0x0ae2('0x86')];_0x3dffa7++){_0x2905a4[_0x0ae2('0x87')](_0x36f5e0[_0x0ae2('0x88')][_0x0ae2('0x89')]({'where':{'userProfileId':_0x3b765d['params']['id'],'name':_0x3a315b[_0x3dffa7][_0x0ae2('0x9')]},'raw':!![]}));}return Promise['all'](_0x2905a4)[_0x0ae2('0x6')](function(_0x8e7eb3){var _0x509b27=_[_0x0ae2('0x2')](_0x8e7eb3,function(_0x3b7366){return _0x3b7366?_0x3b7366:undefined;});var _0x135667=_[_0x0ae2('0x2')](_0x3a315b,[_0x0ae2('0x8a'),!![]]);var _0x1b602b=_[_0x0ae2('0x85')](_0x509b27)&&_[_0x0ae2('0x85')](_0x135667)?null:_[_0x0ae2('0x8b')](_0x135667,_0x509b27);if(!_0x1b602b)return null;var _0xe3b545=[];for(var _0x321f4a=0x0;_0x321f4a<_0x1b602b[_0x0ae2('0x86')];_0x321f4a++){var _0x481922=_['find'](_0x3a315b,function(_0x169751){return _0x1b602b[_0x321f4a]?_0x169751[_0x0ae2('0x9')]===_0x1b602b[_0x321f4a][_0x0ae2('0x9')]:null;});if(_0x481922){if(_0x1b602b[_0x321f4a][_0x0ae2('0x8a')]){_0xe3b545[_0x0ae2('0x87')](_0x3a168d(_0x442533[_0x0ae2('0x13')],_0x1b602b[_0x321f4a]));}else{if(!_0x1b602b[_0x321f4a][_0x0ae2('0x8c')]){_0xe3b545[_0x0ae2('0x87')](_0x12247b(_0x481922,_0x1b602b[_0x321f4a],_0x442533[_0x0ae2('0x13')]));}else{if(_0x481922[_0x0ae2('0x7')]){_0xe3b545[_0x0ae2('0x87')](_0x598357(_0x481922,_0x1b602b[_0x321f4a]));}}}}}return Promise['all'](_0xe3b545);})[_0x0ae2('0x6')](function(_0x2dbf8a){var _0x35ca6b=_0x2dbf8a;var _0x21a9d4=null;if(_0x35ca6b){_0x21a9d4=_0x35ca6b[_0x0ae2('0x86')]===0x1?_0x35ca6b[0x0]:null;}if(!_0x21a9d4&&!_0x35ca6b)return _0x575ede;var _0x1878e0=_0x36f5e0[_0x442533['childModel']][_0x0ae2('0x8d')];_0x172eb6[_0x0ae2('0x7')]=_[_0x0ae2('0x8e')](_0x1878e0);_0x172eb6[_0x0ae2('0x80')]=_[_0x0ae2('0x8e')](_0x3b765d[_0x0ae2('0x80')]);_0x172eb6[_0x0ae2('0x8f')]=_[_0x0ae2('0x90')](_0x172eb6[_0x0ae2('0x7')],_0x172eb6[_0x0ae2('0x80')]);_0x218e4d[_0x0ae2('0x91')]=_[_0x0ae2('0x90')](_0x172eb6[_0x0ae2('0x7')],_0x339d4a[_0x0ae2('0x92')](_0x3b765d['query'][_0x0ae2('0x92')]));_0x218e4d[_0x0ae2('0x91')]=_0x218e4d['attributes'][_0x0ae2('0x86')]?_0x218e4d[_0x0ae2('0x91')]:_0x172eb6[_0x0ae2('0x7')];if(!_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0x93')](_0x0ae2('0x94'))){_0x218e4d['limit']=_0x339d4a[_0x0ae2('0x95')](_0x3b765d['query'][_0x0ae2('0x95')]);_0x218e4d[_0x0ae2('0x96')]=_0x339d4a['offset'](_0x3b765d[_0x0ae2('0x80')]['offset']);}_0x218e4d['order']=_0x339d4a[_0x0ae2('0x97')](_0x3b765d['query'][_0x0ae2('0x97')]);_0x218e4d[_0x0ae2('0x98')]=_0x339d4a['filters'](_[_0x0ae2('0x99')](_0x3b765d[_0x0ae2('0x80')],_0x172eb6[_0x0ae2('0x8f')]));if(_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0x2')]){_0x218e4d[_0x0ae2('0x98')]=_['merge'](_0x218e4d[_0x0ae2('0x98')],{'$or':_[_0x0ae2('0xe')](_0x1878e0,function(_0x2bbd1e){if(_0x2bbd1e[_0x0ae2('0x10')][_0x0ae2('0x9a')]!==_0x0ae2('0x9b')){var _0x2f9995={};_0x2f9995[_0x2bbd1e['field']]={'$like':'%'+_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0x2')]+'%'};return _0x2f9995;}})});}var _0xc84d54=[];var _0x858e7d=null;var _0x2d6137={};if(_0x21a9d4){_0x858e7d=_[_0x0ae2('0x89')](_0x3a315b,['name',_0x21a9d4[_0x0ae2('0x9')]]);if(_0x858e7d[_0x0ae2('0x3')]){_0x2d6137={};if(_0x442533[_0x0ae2('0x13')]==='AnalyticExtractedReport'){_0x2d6137[_0x858e7d[_0x0ae2('0x9c')]]=_['map'](_0x21a9d4[_0x0ae2('0x8')],'id');}else{_0x2d6137[_0x858e7d[_0x0ae2('0x9c')]]=_0x21a9d4[_0x0ae2('0x8')];}_0xc84d54[_0x0ae2('0x87')](_0x2d6137);}else{_0x218e4d[_0x0ae2('0x98')]['id']=_0x21a9d4['associatedResources'];}}else{for(var _0x33378b=0x0;_0x33378b<_0x35ca6b['length'];_0x33378b++){_0x858e7d=_[_0x0ae2('0x89')](_0x3a315b,[_0x0ae2('0x9'),_0x35ca6b[_0x33378b][_0x0ae2('0x9')]]);if(_0x858e7d[_0x0ae2('0x3')]){_0x2d6137={};_0x2d6137[_0x858e7d[_0x0ae2('0x9c')]]=_0x35ca6b[_0x33378b][_0x0ae2('0x8')];_0xc84d54['push'](_0x2d6137);}else{if(!_0x218e4d['where']['id'])_0x218e4d[_0x0ae2('0x98')]['id']=[];_0x35ca6b[_0x33378b][_0x0ae2('0x8')][_0x0ae2('0x9d')](function(_0x465f31){_0x218e4d[_0x0ae2('0x98')]['id'][_0x0ae2('0x87')](_0x465f31);});}}}if(!_[_0x0ae2('0x85')](_0xc84d54)){_0x218e4d[_0x0ae2('0x98')]=_[_0x0ae2('0x9e')](_0x218e4d['where'],{'$and':{'$or':_0xc84d54}});}_0x218e4d=_['merge']({},_0x218e4d,_0x3b765d[_0x0ae2('0x9f')]);if(_0x21a9d4&&!_0x21a9d4[_0x0ae2('0x8c')]&&_0x442533[_0x0ae2('0x13')]==='AnalyticExtractedReport'){if(_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xa0')]){_0x218e4d[_0x0ae2('0xa1')]=[{'all':!![]}];}return _0x36f5e0[_0x442533['childModel']][_0x0ae2('0x5')](_0x218e4d)['then'](function(_0x4567fe){var _0x1214ce=[];_0x4567fe[_0x0ae2('0x9d')](function(_0x5c727d){var _0x36674a;switch(_0x5c727d[_0x0ae2('0xa2')]){case _0x0ae2('0xa3'):_0x36674a=_[_0x0ae2('0x89')](_0x21a9d4['associatedResources'],function(_0x27387a){return _0x27387a['id']===_0x5c727d['reportId']&&_0x27387a[_0x0ae2('0x10')]==='DefaultReports';});break;case _0x0ae2('0xa4'):_0x36674a=_[_0x0ae2('0x89')](_0x21a9d4[_0x0ae2('0x8')],function(_0x141fae){return _0x141fae['id']===_0x5c727d[_0x0ae2('0xa5')]&&_0x141fae[_0x0ae2('0x10')]===_0x0ae2('0xa6');});break;}if(_0x36674a)_0x1214ce['push'](_0x5c727d);});_0x575ede[_0x0ae2('0xa7')]=_0x1214ce[_0x0ae2('0x86')];_0x575ede[_0x0ae2('0xa8')]=_0x1214ce;return _0x575ede;});}else{if(!_[_0x0ae2('0x85')](_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xa9')])){_0x218e4d['where']['id']=_0x218e4d[_0x0ae2('0x98')]['id']?_[_0x0ae2('0x90')](_0x218e4d[_0x0ae2('0x98')]['id'],_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xa9')]):_0x3b765d[_0x0ae2('0x80')]['ids'];if(_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xaa')]){_0x218e4d[_0x0ae2('0xab')]=_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xaa')];}}if(_0x3b765d[_0x0ae2('0x80')]['extraQueryConditions']){_0x218e4d[_0x0ae2('0x98')]=_[_0x0ae2('0x9e')](_0x218e4d[_0x0ae2('0x98')],{'$and':_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xac')]});}return _0x36f5e0[_0x442533[_0x0ae2('0x13')]][_0x0ae2('0xa7')]({'where':_0x218e4d[_0x0ae2('0x98')]})[_0x0ae2('0x6')](function(_0x5d290d){_0x575ede[_0x0ae2('0xa7')]=_0x5d290d;if(_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xa0')]){if(_0x442533['childModel']===_0x0ae2('0xad')){_0x218e4d['include']=[{'model':_0x36f5e0[_0x0ae2('0x69')],'as':_0x0ae2('0xae'),'attributes':['id',_0x0ae2('0x9'),_0x0ae2('0xaf')],'required':_0x3b765d[_0x0ae2('0x80')]['tag']?!![]:![]},{'model':_0x36f5e0[_0x0ae2('0x69')],'as':_0x0ae2('0xb0'),'attributes':['id',_0x0ae2('0x9'),'color'],'through':_0x3b765d['query'][_0x0ae2('0xb1')]?{'attributes':[],'where':{'TagId':_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xb1')]||undefined}}:{},'required':_0x3b765d[_0x0ae2('0x80')]['tag']?!![]:![]}];}else{_0x218e4d['include']=[{'all':!![]}];}}return _0x36f5e0[_0x442533['childModel']][_0x0ae2('0x5')](_0x218e4d);})[_0x0ae2('0x6')](function(_0x4759a9){_0x575ede[_0x0ae2('0xa8')]=_0x4759a9;if(_0x2b3fba===_0x0ae2('0xb2')&&_0x3b765d[_0x0ae2('0x80')][_0x0ae2('0xb3')]===_0x0ae2('0xb4')){var _0x42c0e3=[];for(var _0x5c0482=0x0;_0x5c0482<_0x575ede[_0x0ae2('0xa8')][_0x0ae2('0x86')];_0x5c0482++){_0x42c0e3[_0x0ae2('0x87')](_0xd8161e(_0x0ae2('0xb5'),_0x575ede['rows'][_0x5c0482]['dataValues']));_0x42c0e3[_0x0ae2('0x87')](_0xd8161e(_0x0ae2('0xb6'),_0x575ede['rows'][_0x5c0482][_0x0ae2('0xb7')]));_0x42c0e3['push'](_0xd8161e(_0x0ae2('0xb8'),_0x575ede[_0x0ae2('0xa8')][_0x5c0482]['dataValues']));_0x42c0e3[_0x0ae2('0x87')](_0xd8161e('mail',_0x575ede['rows'][_0x5c0482]['dataValues']));_0x42c0e3['push'](_0xd8161e('openchannel',_0x575ede['rows'][_0x5c0482]['dataValues']));_0x42c0e3[_0x0ae2('0x87')](_0xd8161e(_0x0ae2('0xb9'),_0x575ede['rows'][_0x5c0482][_0x0ae2('0xb7')]));}return Promise[_0x0ae2('0xba')](_0x42c0e3)[_0x0ae2('0x6')](function(){return _0x575ede;});}return _0x575ede;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 4290c3b..1b7fe84 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 _0xe0dc=['../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xdda617,_0x54ca1b){var _0x3b8bd9=function(_0x2fad0e){while(--_0x2fad0e){_0xdda617['push'](_0xdda617['shift']());}};_0x3b8bd9(++_0x54ca1b);}(_0xe0dc,0x190));var _0xce0d=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xe0dc[_0x54b283];return _0x2462b3;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var moment=require(_0xce0d('0x1'));var BPromise=require(_0xce0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce0d('0x3'));var db=require(_0xce0d('0x4'))['db'];var utils=require(_0xce0d('0x5'));var logger=require(_0xce0d('0x6'))('rpc');var config=require(_0xce0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce0d('0x8')][_0xce0d('0x9')]({'port':0x232a});config[_0xce0d('0xa')]=_[_0xce0d('0xb')](config[_0xce0d('0xa')],{'host':_0xce0d('0xc'),'port':0x18eb});var socket=require(_0xce0d('0xd'))(new Redis(config[_0xce0d('0xa')]));require(_0xce0d('0xe'))[_0xce0d('0xf')](socket);function respondWithRpcPromise(_0x29b996,_0xada75a,_0xc0e7c5){return new BPromise(function(_0x3edaad,_0x3a4d42){return client[_0xce0d('0x10')](_0x29b996,_0xc0e7c5)[_0xce0d('0x11')](function(_0x431271){logger[_0xce0d('0x12')]('UserProfile,\x20%s,\x20%s',_0xada75a,_0xce0d('0x13'));logger[_0xce0d('0x14')](_0xce0d('0x15'),_0xada75a,_0xce0d('0x13'),JSON[_0xce0d('0x16')](_0x431271));if(_0x431271[_0xce0d('0x17')]){if(_0x431271[_0xce0d('0x17')][_0xce0d('0x18')]===0x1f4){logger[_0xce0d('0x17')](_0xce0d('0x19'),_0xada75a,_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);return _0x3a4d42(_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);}logger[_0xce0d('0x17')](_0xce0d('0x19'),_0xada75a,_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);return _0x3edaad(_0x431271[_0xce0d('0x17')][_0xce0d('0x1a')]);}else{logger[_0xce0d('0x12')](_0xce0d('0x19'),_0xada75a,_0xce0d('0x13'));_0x3edaad(_0x431271[_0xce0d('0x1b')][_0xce0d('0x1a')]);}})[_0xce0d('0x1c')](function(_0x1f4049){logger[_0xce0d('0x17')](_0xce0d('0x19'),_0xada75a,_0x1f4049);_0x3a4d42(_0x1f4049);});});} \ No newline at end of file +var _0x1c63=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x40f098,_0x3a804c){var _0x9a07bc=function(_0x1dc7c8){while(--_0x1dc7c8){_0x40f098['push'](_0x40f098['shift']());}};_0x9a07bc(++_0x3a804c);}(_0x1c63,0xdc));var _0x31c6=function(_0x15a3d3,_0x1fe368){_0x15a3d3=_0x15a3d3-0x0;var _0x1fa778=_0x1c63[_0x15a3d3];return _0x1fa778;};'use strict';var _=require(_0x31c6('0x0'));var util=require(_0x31c6('0x1'));var moment=require(_0x31c6('0x2'));var BPromise=require(_0x31c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31c6('0x4'));var db=require(_0x31c6('0x5'))['db'];var utils=require(_0x31c6('0x6'));var logger=require('../../config/logger')(_0x31c6('0x7'));var config=require(_0x31c6('0x8'));var jayson=require(_0x31c6('0x9'));var client=jayson[_0x31c6('0xa')][_0x31c6('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x31c6('0xc')],{'host':_0x31c6('0xd'),'port':0x18eb});var socket=require(_0x31c6('0xe'))(new Redis(config[_0x31c6('0xc')]));require(_0x31c6('0xf'))['register'](socket);function respondWithRpcPromise(_0x731d0f,_0x1172bb,_0xb21602){return new BPromise(function(_0x2ee25a,_0x45466b){return client['request'](_0x731d0f,_0xb21602)[_0x31c6('0x10')](function(_0x4d02f1){logger[_0x31c6('0x11')](_0x31c6('0x12'),_0x1172bb,'request\x20sent');logger[_0x31c6('0x13')](_0x31c6('0x14'),_0x1172bb,_0x31c6('0x15'),JSON[_0x31c6('0x16')](_0x4d02f1));if(_0x4d02f1[_0x31c6('0x17')]){if(_0x4d02f1[_0x31c6('0x17')]['code']===0x1f4){logger[_0x31c6('0x17')](_0x31c6('0x12'),_0x1172bb,_0x4d02f1[_0x31c6('0x17')][_0x31c6('0x18')]);return _0x45466b(_0x4d02f1[_0x31c6('0x17')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x1172bb,_0x4d02f1['error'][_0x31c6('0x18')]);return _0x2ee25a(_0x4d02f1['error'][_0x31c6('0x18')]);}else{logger[_0x31c6('0x11')](_0x31c6('0x12'),_0x1172bb,_0x31c6('0x15'));_0x2ee25a(_0x4d02f1[_0x31c6('0x19')][_0x31c6('0x18')]);}})[_0x31c6('0x1a')](function(_0x2fd91f){logger['error']('UserProfile,\x20%s,\x20%s',_0x1172bb,_0x2fd91f);_0x45466b(_0x2fd91f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 35f0263..3ba2e1d 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 _0x8481=['removeListener','register','length','userProfile:','./userProfile.events','remove','update','emit'];(function(_0x32eca6,_0x132713){var _0x242626=function(_0x4a17a8){while(--_0x4a17a8){_0x32eca6['push'](_0x32eca6['shift']());}};_0x242626(++_0x132713);}(_0x8481,0x114));var _0x1848=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x8481[_0x4a82ac];return _0x58ee97;};'use strict';var UserProfileEvents=require(_0x1848('0x0'));var events=['save',_0x1848('0x1'),_0x1848('0x2')];function createListener(_0x5480bd,_0x545cd5){return function(_0x4c125d){_0x545cd5[_0x1848('0x3')](_0x5480bd,_0x4c125d);};}function removeListener(_0x5f45ba,_0x99708c){return function(){UserProfileEvents[_0x1848('0x4')](_0x5f45ba,_0x99708c);};}exports[_0x1848('0x5')]=function(_0x2678a7){for(var _0x5f3fe0=0x0,_0x177192=events[_0x1848('0x6')];_0x5f3fe0<_0x177192;_0x5f3fe0++){var _0xfac01b=events[_0x5f3fe0];var _0x14dcbc=createListener(_0x1848('0x7')+_0xfac01b,_0x2678a7);UserProfileEvents['on'](_0xfac01b,_0x14dcbc);}}; \ No newline at end of file +var _0x9609=['register','save','remove','update','removeListener'];(function(_0x5615a9,_0x3831ad){var _0x5a5e3d=function(_0x2f6c26){while(--_0x2f6c26){_0x5615a9['push'](_0x5615a9['shift']());}};_0x5a5e3d(++_0x3831ad);}(_0x9609,0x187));var _0x9960=function(_0x3529a0,_0x434424){_0x3529a0=_0x3529a0-0x0;var _0x9e6d12=_0x9609[_0x3529a0];return _0x9e6d12;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x9960('0x0'),_0x9960('0x1'),_0x9960('0x2')];function createListener(_0x37267a,_0x28ad2c){return function(_0x3527f4){_0x28ad2c['emit'](_0x37267a,_0x3527f4);};}function removeListener(_0x467d42,_0x1bdd90){return function(){UserProfileEvents[_0x9960('0x3')](_0x467d42,_0x1bdd90);};}exports[_0x9960('0x4')]=function(_0x139868){for(var _0x4b2b1d=0x0,_0x28941a=events['length'];_0x4b2b1d<_0x28941a;_0x4b2b1d++){var _0x3b2a0f=events[_0x4b2b1d];var _0x241767=createListener('userProfile:'+_0x3b2a0f,_0x139868);UserProfileEvents['on'](_0x3b2a0f,_0x241767);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2290cc8..7899d2c 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 _0x6f69=['put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x385567,_0x40550f){var _0x49cf95=function(_0x4d3081){while(--_0x4d3081){_0x385567['push'](_0x385567['shift']());}};_0x49cf95(++_0x40550f);}(_0x6f69,0x1e0));var _0x96f6=function(_0x17c412,_0x5b0714){_0x17c412=_0x17c412-0x0;var _0x568900=_0x6f69[_0x17c412];return _0x568900;};'use strict';var multer=require(_0x96f6('0x0'));var util=require(_0x96f6('0x1'));var path=require(_0x96f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x96f6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x96f6('0x4'));var interaction=require(_0x96f6('0x5'));var config=require('../../config/environment');var controller=require(_0x96f6('0x6'));router['get']('/',auth[_0x96f6('0x7')](),controller[_0x96f6('0x8')]);router[_0x96f6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x96f6('0xa'),auth[_0x96f6('0x7')](),controller[_0x96f6('0xb')]);router[_0x96f6('0xc')]('/',auth['isAuthenticated'](),controller[_0x96f6('0xd')]);router[_0x96f6('0xe')](_0x96f6('0xa'),auth['isAuthenticated'](),controller[_0x96f6('0xf')]);router[_0x96f6('0x10')](_0x96f6('0xa'),auth['isAuthenticated'](),controller[_0x96f6('0x11')]);module[_0x96f6('0x12')]=router; \ No newline at end of file +var _0xfb3f=['fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x472120,_0x3e844e){var _0x4afacc=function(_0x3050f8){while(--_0x3050f8){_0x472120['push'](_0x472120['shift']());}};_0x4afacc(++_0x3e844e);}(_0xfb3f,0xd9));var _0xffb3=function(_0x47af83,_0x24bd57){_0x47af83=_0x47af83-0x0;var _0x1c37cf=_0xfb3f[_0x47af83];return _0x1c37cf;};'use strict';var multer=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var path=require('path');var timeout=require(_0xffb3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xffb3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xffb3('0x4'));var config=require(_0xffb3('0x5'));var controller=require(_0xffb3('0x6'));router[_0xffb3('0x7')]('/',auth[_0xffb3('0x8')](),controller[_0xffb3('0x9')]);router[_0xffb3('0x7')](_0xffb3('0xa'),auth['isAuthenticated'](),controller[_0xffb3('0xb')]);router[_0xffb3('0x7')](_0xffb3('0xc'),auth[_0xffb3('0x8')](),controller[_0xffb3('0xd')]);router['post']('/',auth[_0xffb3('0x8')](),controller[_0xffb3('0xe')]);router[_0xffb3('0xf')](_0xffb3('0xc'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x10')]);router[_0xffb3('0x11')](_0xffb3('0xc'),auth['isAuthenticated'](),controller[_0xffb3('0x12')]);module[_0xffb3('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7fa39a3..0b2a18a 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 _0x35d9=['INTEGER','sequelize','exports','STRING'];(function(_0x54b321,_0x2d3c0c){var _0x5f0f18=function(_0xc0cc12){while(--_0xc0cc12){_0x54b321['push'](_0x54b321['shift']());}};_0x5f0f18(++_0x2d3c0c);}(_0x35d9,0xed));var _0x935d=function(_0x2244d3,_0x4280bc){_0x2244d3=_0x2244d3-0x0;var _0x5720dd=_0x35d9[_0x2244d3];return _0x5720dd;};'use strict';var Sequelize=require(_0x935d('0x0'));module[_0x935d('0x1')]={'name':{'type':Sequelize[_0x935d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x935d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x935d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2c79=['STRING','INTEGER','sequelize','exports'];(function(_0x1c5814,_0x3d3ed7){var _0x2b1826=function(_0x1479cd){while(--_0x1479cd){_0x1c5814['push'](_0x1c5814['shift']());}};_0x2b1826(++_0x3d3ed7);}(_0x2c79,0x15a));var _0x92c7=function(_0x3e02f2,_0x27c5a8){_0x3e02f2=_0x3e02f2-0x0;var _0x3d61c0=_0x2c79[_0x3e02f2];return _0x3d61c0;};'use strict';var Sequelize=require(_0x92c7('0x0'));module[_0x92c7('0x1')]={'name':{'type':Sequelize[_0x92c7('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x92c7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x92c7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 48f6ab2..f306f03 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 _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15d30c,_0x4e22f7){_0x15d30c=_0x15d30c-0x0;var _0x2191c4=_0x5f2f[_0x15d30c];return _0x2191c4;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x477a6f,_0x2dee04){_0x477a6f=_0x477a6f-0x0;var _0x4ac07c=_0x9f0e[_0x477a6f];return _0x4ac07c;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3f6ed5c..5e41f30 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 _0x5448=['sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x3481dd,_0x5e533a){var _0x3748d3=function(_0x4abcfc){while(--_0x4abcfc){_0x3481dd['push'](_0x3481dd['shift']());}};_0x3748d3(++_0x5e533a);}(_0x5448,0xc1));var _0x8544=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x5448[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x8544('0x0'));var util=require(_0x8544('0x1'));var logger=require(_0x8544('0x2'))(_0x8544('0x3'));var moment=require(_0x8544('0x4'));var BPromise=require(_0x8544('0x5'));var rp=require(_0x8544('0x6'));var fs=require('fs');var path=require(_0x8544('0x7'));var rimraf=require(_0x8544('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x8544('0x9')]=function(_0x128c6a,_0x42b802){return _0x128c6a[_0x8544('0xa')](_0x8544('0xb'),attributes,{'tableName':_0x8544('0xc'),'paranoid':![],'indexes':[{'name':_0x8544('0xd'),'fields':[_0x8544('0xe'),_0x8544('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb43=['compositeIndex','resourceId','sectionId','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserProfileResource','user_profile_has_resources'];(function(_0x588fa5,_0x4aef94){var _0x1e766d=function(_0x4ed06a){while(--_0x4ed06a){_0x588fa5['push'](_0x588fa5['shift']());}};_0x1e766d(++_0x4aef94);}(_0xfb43,0x1bf));var _0x3fb4=function(_0x17099b,_0x4adce2){_0x17099b=_0x17099b-0x0;var _0x57e744=_0xfb43[_0x17099b];return _0x57e744;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fb4('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3fb4('0x1'));var rp=require(_0x3fb4('0x2'));var fs=require('fs');var path=require(_0x3fb4('0x3'));var rimraf=require(_0x3fb4('0x4'));var config=require(_0x3fb4('0x5'));var attributes=require('./userProfileResource.attributes');module[_0x3fb4('0x6')]=function(_0x595885,_0x5246ec){return _0x595885['define'](_0x3fb4('0x7'),attributes,{'tableName':_0x3fb4('0x8'),'paranoid':![],'indexes':[{'name':_0x3fb4('0x9'),'fields':[_0x3fb4('0xa'),_0x3fb4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6317b7c..b8cf743 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 _0x98d8=['randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x4b287d,_0x2ea048){var _0x563b27=function(_0x9e9396){while(--_0x9e9396){_0x4b287d['push'](_0x4b287d['shift']());}};_0x563b27(++_0x2ea048);}(_0x98d8,0xce));var _0x898d=function(_0x4132d1,_0x41fbbd){_0x4132d1=_0x4132d1-0x0;var _0x27d9cb=_0x98d8[_0x4132d1];return _0x27d9cb;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var moment=require(_0x898d('0x2'));var BPromise=require(_0x898d('0x3'));var rs=require(_0x898d('0x4'));var fs=require('fs');var Redis=require(_0x898d('0x5'));var db=require(_0x898d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x898d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x898d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16b99a,_0x4e8c68,_0x1de5df){return new BPromise(function(_0x4fe1bf,_0x3e9ba6){return client[_0x898d('0x9')](_0x16b99a,_0x1de5df)[_0x898d('0xa')](function(_0x40f217){logger[_0x898d('0xb')](_0x898d('0xc'),_0x4e8c68,_0x898d('0xd'));logger[_0x898d('0xe')](_0x898d('0xf'),_0x4e8c68,_0x898d('0xd'),JSON[_0x898d('0x10')](_0x40f217));if(_0x40f217[_0x898d('0x11')]){if(_0x40f217[_0x898d('0x11')][_0x898d('0x12')]===0x1f4){logger[_0x898d('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x4e8c68,_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);return _0x3e9ba6(_0x40f217['error'][_0x898d('0x13')]);}logger[_0x898d('0x11')](_0x898d('0xc'),_0x4e8c68,_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);return _0x4fe1bf(_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);}else{logger['info'](_0x898d('0xc'),_0x4e8c68,_0x898d('0xd'));_0x4fe1bf(_0x40f217['result']['message']);}})[_0x898d('0x14')](function(_0x42a098){logger[_0x898d('0x11')](_0x898d('0xc'),_0x4e8c68,_0x42a098);_0x3e9ba6(_0x42a098);});});} \ No newline at end of file +var _0xaf1d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x5f2f26,_0x40ce95){var _0x447d39=function(_0x23923a){while(--_0x23923a){_0x5f2f26['push'](_0x5f2f26['shift']());}};_0x447d39(++_0x40ce95);}(_0xaf1d,0x95));var _0xdaf1=function(_0xf61506,_0x4c1f5c){_0xf61506=_0xf61506-0x0;var _0x28f218=_0xaf1d[_0xf61506];return _0x28f218;};'use strict';var _=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var moment=require(_0xdaf1('0x2'));var BPromise=require(_0xdaf1('0x3'));var rs=require(_0xdaf1('0x4'));var fs=require('fs');var Redis=require(_0xdaf1('0x5'));var db=require(_0xdaf1('0x6'))['db'];var utils=require(_0xdaf1('0x7'));var logger=require(_0xdaf1('0x8'))(_0xdaf1('0x9'));var config=require(_0xdaf1('0xa'));var jayson=require(_0xdaf1('0xb'));var client=jayson[_0xdaf1('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x570970,_0x33c57b,_0xee0636){return new BPromise(function(_0x35b098,_0x33c5a4){return client[_0xdaf1('0xd')](_0x570970,_0xee0636)[_0xdaf1('0xe')](function(_0x2c7601){logger[_0xdaf1('0xf')](_0xdaf1('0x10'),_0x33c57b,_0xdaf1('0x11'));logger['debug'](_0xdaf1('0x12'),_0x33c57b,_0xdaf1('0x11'),JSON[_0xdaf1('0x13')](_0x2c7601));if(_0x2c7601['error']){if(_0x2c7601[_0xdaf1('0x14')][_0xdaf1('0x15')]===0x1f4){logger['error'](_0xdaf1('0x10'),_0x33c57b,_0x2c7601['error'][_0xdaf1('0x16')]);return _0x33c5a4(_0x2c7601['error'][_0xdaf1('0x16')]);}logger['error'](_0xdaf1('0x10'),_0x33c57b,_0x2c7601['error'][_0xdaf1('0x16')]);return _0x35b098(_0x2c7601[_0xdaf1('0x14')][_0xdaf1('0x16')]);}else{logger[_0xdaf1('0xf')](_0xdaf1('0x10'),_0x33c57b,'request\x20sent');_0x35b098(_0x2c7601[_0xdaf1('0x17')][_0xdaf1('0x16')]);}})[_0xdaf1('0x18')](function(_0x50c68a){logger[_0xdaf1('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x33c57b,_0x50c68a);_0x33c5a4(_0x50c68a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 2eb5541..d3b9fb8 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 _0x10d3=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','update','delete','/:id','destroy','multer'];(function(_0x522d58,_0x1b8513){var _0x54d3d3=function(_0x1ce956){while(--_0x1ce956){_0x522d58['push'](_0x522d58['shift']());}};_0x54d3d3(++_0x1b8513);}(_0x10d3,0xef));var _0x310d=function(_0x4195c2,_0x57e3b8){_0x4195c2=_0x4195c2-0x0;var _0x273062=_0x10d3[_0x4195c2];return _0x273062;};'use strict';var multer=require(_0x310d('0x0'));var util=require('util');var path=require(_0x310d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x310d('0x2'));var auth=require(_0x310d('0x3'));var interaction=require(_0x310d('0x4'));var config=require(_0x310d('0x5'));var controller=require(_0x310d('0x6'));router['get']('/',auth[_0x310d('0x7')](),controller[_0x310d('0x8')]);router[_0x310d('0x9')](_0x310d('0xa'),auth[_0x310d('0x7')](),controller[_0x310d('0xb')]);router[_0x310d('0x9')]('/:id',auth[_0x310d('0x7')](),controller[_0x310d('0xc')]);router[_0x310d('0xd')]('/',auth['isAuthenticated'](),controller[_0x310d('0xe')]);router[_0x310d('0xf')]('/:id',auth[_0x310d('0x7')](),controller[_0x310d('0x10')]);router[_0x310d('0x11')](_0x310d('0x12'),auth['isAuthenticated'](),controller[_0x310d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2fcf=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x4470b2,_0x267efc){var _0x5d07d1=function(_0x5be44a){while(--_0x5be44a){_0x4470b2['push'](_0x4470b2['shift']());}};_0x5d07d1(++_0x267efc);}(_0x2fcf,0x1ea));var _0xf2fc=function(_0x78e522,_0x37c539){_0x78e522=_0x78e522-0x0;var _0x4a170d=_0x2fcf[_0x78e522];return _0x4a170d;};'use strict';var multer=require(_0xf2fc('0x0'));var util=require(_0xf2fc('0x1'));var path=require(_0xf2fc('0x2'));var timeout=require(_0xf2fc('0x3'));var express=require(_0xf2fc('0x4'));var router=express[_0xf2fc('0x5')]();var fs_extra=require(_0xf2fc('0x6'));var auth=require(_0xf2fc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf2fc('0x8'));var controller=require(_0xf2fc('0x9'));router[_0xf2fc('0xa')]('/',auth[_0xf2fc('0xb')](),controller[_0xf2fc('0xc')]);router[_0xf2fc('0xa')]('/describe',auth[_0xf2fc('0xb')](),controller[_0xf2fc('0xd')]);router[_0xf2fc('0xa')](_0xf2fc('0xe'),auth['isAuthenticated'](),controller[_0xf2fc('0xf')]);router[_0xf2fc('0x10')]('/',auth[_0xf2fc('0xb')](),controller[_0xf2fc('0x11')]);router[_0xf2fc('0x12')](_0xf2fc('0xe'),auth['isAuthenticated'](),controller[_0xf2fc('0x13')]);router[_0xf2fc('0x14')](_0xf2fc('0xe'),auth['isAuthenticated'](),controller[_0xf2fc('0x15')]);module[_0xf2fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 73ecea3..f71cb2c 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 _0xb688=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split','exports'];(function(_0x245b0f,_0x4a5ed2){var _0x337c3f=function(_0xc8b994){while(--_0xc8b994){_0x245b0f['push'](_0x245b0f['shift']());}};_0x337c3f(++_0x4a5ed2);}(_0xb688,0xcf));var _0x8b68=function(_0x50f60f,_0x37c2ca){_0x50f60f=_0x50f60f-0x0;var _0x298ad1=_0xb688[_0x50f60f];return _0x298ad1;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8b68('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41030e){this[_0x8b68('0x4')](_0x8b68('0x5'),_0x41030e?_0x41030e[_0x8b68('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8b68('0x5'))?this['getDataValue'](_0x8b68('0x5'))[_0x8b68('0x7')](''):[];}}}; \ No newline at end of file +var _0x5eb8=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0xeb2d38,_0x4bc673){var _0x4227b2=function(_0x5e7e6e){while(--_0x5e7e6e){_0xeb2d38['push'](_0xeb2d38['shift']());}};_0x4227b2(++_0x4bc673);}(_0x5eb8,0xb0));var _0x85eb=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0x5eb8[_0x584b9d];return _0x172053;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x85eb('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x85eb('0x0')],'set':function(_0x13b1df){this[_0x85eb('0x3')](_0x85eb('0x4'),_0x13b1df?_0x13b1df[_0x85eb('0x5')](''):[]);},'get':function(){return this[_0x85eb('0x6')](_0x85eb('0x4'))?this['getDataValue'](_0x85eb('0x4'))[_0x85eb('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1c4739a..d63635b 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 _0x2024=['json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','includeAll','include','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x5b3b6a,_0x906f49){var _0x4a9af7=function(_0x435c41){while(--_0x435c41){_0x5b3b6a['push'](_0x5b3b6a['shift']());}};_0x4a9af7(++_0x906f49);}(_0x2024,0x77));var _0x4202=function(_0x2b2be3,_0x431946){_0x2b2be3=_0x2b2be3-0x0;var _0xedd99c=_0x2024[_0x2b2be3];return _0xedd99c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4202('0x0'));var zipdir=require(_0x4202('0x1'));var jsonpatch=require(_0x4202('0x2'));var rp=require('request-promise');var moment=require(_0x4202('0x3'));var BPromise=require(_0x4202('0x4'));var Mustache=require(_0x4202('0x5'));var util=require(_0x4202('0x6'));var path=require(_0x4202('0x7'));var sox=require(_0x4202('0x8'));var csv=require(_0x4202('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4202('0xa'));var _=require(_0x4202('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4202('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4202('0x9'));var querystring=require('querystring');var Papa=require(_0x4202('0xd'));var Redis=require(_0x4202('0xe'));var authService=require(_0x4202('0xf'));var qs=require(_0x4202('0x10'));var as=require(_0x4202('0x11'));var hardwareService=require(_0x4202('0x12'));var logger=require(_0x4202('0x13'))(_0x4202('0x14'));var utils=require('../../config/utils');var config=require(_0x4202('0x15'));var licenseUtil=require(_0x4202('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e82b2,_0x550e18){_0x550e18=_0x550e18||0xcc;return function(_0x583c9){if(_0x583c9){return _0x5e82b2[_0x4202('0x17')](_0x550e18);}return _0x5e82b2[_0x4202('0x18')](_0x550e18)['end']();};}function respondWithResult(_0x29311a,_0x50bf16){_0x50bf16=_0x50bf16||0xc8;return function(_0x3b697d){if(_0x3b697d){return _0x29311a[_0x4202('0x18')](_0x50bf16)[_0x4202('0x19')](_0x3b697d);}};}function respondWithFilteredResult(_0xbd752f,_0xcc2766){return function(_0x4dcd87){if(_0x4dcd87){var _0x19c477=typeof _0xcc2766[_0x4202('0x1a')]===_0x4202('0x1b')&&typeof _0xcc2766[_0x4202('0x1c')]===_0x4202('0x1b');var _0x47599a=_0x4dcd87[_0x4202('0x1d')];var _0x4e8d40=_0x19c477?0x0:_0xcc2766['offset'];var _0x56ffd7=_0x19c477?_0x4dcd87[_0x4202('0x1d')]:_0xcc2766[_0x4202('0x1a')]+_0xcc2766[_0x4202('0x1c')];var _0x40b213;if(_0x56ffd7>=_0x47599a){_0x56ffd7=_0x47599a;_0x40b213=0xc8;}else{_0x40b213=0xce;}_0xbd752f[_0x4202('0x18')](_0x40b213);return _0xbd752f['set'](_0x4202('0x1e'),_0x4e8d40+'-'+_0x56ffd7+'/'+_0x47599a)[_0x4202('0x19')](_0x4dcd87);}return null;};}function patchUpdates(_0x3a69c0){return function(_0x4be5c3){try{jsonpatch['apply'](_0x4be5c3,_0x3a69c0,!![]);}catch(_0xc7ab17){return BPromise[_0x4202('0x1f')](_0xc7ab17);}return _0x4be5c3['save']();};}function saveUpdates(_0x2b701a,_0x392452){return function(_0x49c181){if(_0x49c181){return _0x49c181[_0x4202('0x20')](_0x2b701a)[_0x4202('0x21')](function(_0x55bb9b){return _0x55bb9b;});}return null;};}function removeEntity(_0x214e11,_0xce56c9){return function(_0x5ed33b){if(_0x5ed33b){return _0x5ed33b[_0x4202('0x22')]()[_0x4202('0x21')](function(){_0x214e11['status'](0xcc)[_0x4202('0x23')]();});}};}function handleEntityNotFound(_0x1b694e,_0x29fd18){return function(_0x73a5ff){if(!_0x73a5ff){_0x1b694e[_0x4202('0x17')](0x194);}return _0x73a5ff;};}function handleError(_0x45a40d,_0xe7f968){_0xe7f968=_0xe7f968||0x1f4;return function(_0x33fe8d){logger[_0x4202('0x24')](_0x33fe8d[_0x4202('0x25')]);if(_0x33fe8d[_0x4202('0x26')]){delete _0x33fe8d[_0x4202('0x26')];}_0x45a40d[_0x4202('0x18')](_0xe7f968)[_0x4202('0x27')](_0x33fe8d);};}exports[_0x4202('0x28')]=function(_0x4309e7,_0x3f7a99){var _0x588d93={},_0x4b3568={},_0x4f8f29={'count':0x0,'rows':[]};var _0x375abe=_['map'](db[_0x4202('0x29')][_0x4202('0x2a')],function(_0x241225){return{'name':_0x241225[_0x4202('0x2b')],'type':_0x241225['type']['key']};});_0x4b3568[_0x4202('0x2c')]=_[_0x4202('0x2d')](_0x375abe,_0x4202('0x26'));_0x4b3568[_0x4202('0x2e')]=_[_0x4202('0x2f')](_0x4309e7[_0x4202('0x2e')]);_0x4b3568[_0x4202('0x30')]=_[_0x4202('0x31')](_0x4b3568[_0x4202('0x2c')],_0x4b3568[_0x4202('0x2e')]);_0x588d93[_0x4202('0x32')]=_[_0x4202('0x31')](_0x4b3568[_0x4202('0x2c')],qs[_0x4202('0x33')](_0x4309e7['query'][_0x4202('0x33')]));_0x588d93[_0x4202('0x32')]=_0x588d93['attributes'][_0x4202('0x34')]?_0x588d93['attributes']:_0x4b3568[_0x4202('0x2c')];if(!_0x4309e7[_0x4202('0x2e')][_0x4202('0x35')]('nolimit')){_0x588d93[_0x4202('0x1c')]=qs['limit'](_0x4309e7['query'][_0x4202('0x1c')]);_0x588d93['offset']=qs[_0x4202('0x1a')](_0x4309e7[_0x4202('0x2e')][_0x4202('0x1a')]);}_0x588d93[_0x4202('0x36')]=qs['sort'](_0x4309e7['query'][_0x4202('0x37')]);_0x588d93[_0x4202('0x38')]=qs[_0x4202('0x30')](_[_0x4202('0x39')](_0x4309e7['query'],_0x4b3568[_0x4202('0x30')]),_0x375abe);if(_0x4309e7[_0x4202('0x2e')][_0x4202('0x3a')]){_0x588d93[_0x4202('0x38')]=_[_0x4202('0x3b')](_0x588d93['where'],{'$or':_[_0x4202('0x2d')](_0x375abe,function(_0x300d09){if(_0x300d09[_0x4202('0x3c')]!==_0x4202('0x3d')){var _0xedeba7={};_0xedeba7[_0x300d09[_0x4202('0x26')]]={'$like':'%'+_0x4309e7['query'][_0x4202('0x3a')]+'%'};return _0xedeba7;}})});}_0x588d93=_[_0x4202('0x3b')]({},_0x588d93,_0x4309e7['options']);var _0x5941bf={'where':_0x588d93['where']};return db[_0x4202('0x29')][_0x4202('0x1d')](_0x5941bf)[_0x4202('0x21')](function(_0x3ce742){_0x4f8f29[_0x4202('0x1d')]=_0x3ce742;if(_0x4309e7[_0x4202('0x2e')]['includeAll']){_0x588d93['include']=[{'all':!![]}];}return db[_0x4202('0x29')][_0x4202('0x3e')](_0x588d93);})[_0x4202('0x21')](function(_0x110559){_0x4f8f29[_0x4202('0x3f')]=_0x110559;return _0x4f8f29;})[_0x4202('0x21')](respondWithFilteredResult(_0x3f7a99,_0x588d93))[_0x4202('0x40')](handleError(_0x3f7a99,null));};exports['show']=function(_0xd804b6,_0xc36f52){var _0x463975={'raw':![],'where':{'id':_0xd804b6['params']['id']}},_0x4b5070={};_0x4b5070[_0x4202('0x2c')]=_[_0x4202('0x2f')](db['UserProfileSection'][_0x4202('0x2a')]);_0x4b5070[_0x4202('0x2e')]=_['keys'](_0xd804b6['query']);_0x4b5070['filters']=_[_0x4202('0x31')](_0x4b5070[_0x4202('0x2c')],_0x4b5070[_0x4202('0x2e')]);_0x463975[_0x4202('0x32')]=_[_0x4202('0x31')](_0x4b5070[_0x4202('0x2c')],qs[_0x4202('0x33')](_0xd804b6[_0x4202('0x2e')]['fields']));_0x463975[_0x4202('0x32')]=_0x463975[_0x4202('0x32')][_0x4202('0x34')]?_0x463975[_0x4202('0x32')]:_0x4b5070[_0x4202('0x2c')];if(_0xd804b6[_0x4202('0x2e')][_0x4202('0x41')]){_0x463975[_0x4202('0x42')]=[{'all':!![]}];}_0x463975=_['merge']({},_0x463975,_0xd804b6['options']);return db[_0x4202('0x29')][_0x4202('0x43')](_0x463975)[_0x4202('0x21')](handleEntityNotFound(_0xc36f52,null))[_0x4202('0x21')](respondWithResult(_0xc36f52,null))['catch'](handleError(_0xc36f52,null));};exports['create']=function(_0x4e77d2,_0xc7196){return db[_0x4202('0x29')][_0x4202('0x44')](_0x4e77d2[_0x4202('0x45')],{})[_0x4202('0x21')](respondWithResult(_0xc7196,0xc9))['catch'](handleError(_0xc7196,null));};exports[_0x4202('0x20')]=function(_0x59f059,_0x250f5f){if(_0x59f059[_0x4202('0x45')]['id']){delete _0x59f059['body']['id'];}return db[_0x4202('0x29')][_0x4202('0x43')]({'where':{'id':_0x59f059['params']['id']}})[_0x4202('0x21')](handleEntityNotFound(_0x250f5f,null))[_0x4202('0x21')](saveUpdates(_0x59f059[_0x4202('0x45')],null))[_0x4202('0x21')](respondWithResult(_0x250f5f,null))[_0x4202('0x40')](handleError(_0x250f5f,null));};exports['destroy']=function(_0x15cadf,_0x4073b0){return db[_0x4202('0x29')]['find']({'where':{'id':_0x15cadf[_0x4202('0x46')]['id']}})[_0x4202('0x21')](handleEntityNotFound(_0x4073b0,null))[_0x4202('0x21')](removeEntity(_0x4073b0,null))[_0x4202('0x40')](handleError(_0x4073b0,null));};exports[_0x4202('0x47')]=function(_0x310af2,_0x443fe2){return db[_0x4202('0x29')][_0x4202('0x47')]()['then'](respondWithResult(_0x443fe2,null))[_0x4202('0x40')](handleError(_0x443fe2,null));}; \ No newline at end of file +var _0xa910=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','UserProfileSection','include','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x469e36,_0x4905ec){var _0x52e165=function(_0x47da15){while(--_0x47da15){_0x469e36['push'](_0x469e36['shift']());}};_0x52e165(++_0x4905ec);}(_0xa910,0x15f));var _0x0a91=function(_0x23d985,_0x11d506){_0x23d985=_0x23d985-0x0;var _0x3aa367=_0xa910[_0x23d985];return _0x3aa367;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a91('0x0'));var zipdir=require(_0x0a91('0x1'));var jsonpatch=require(_0x0a91('0x2'));var rp=require(_0x0a91('0x3'));var moment=require(_0x0a91('0x4'));var BPromise=require(_0x0a91('0x5'));var Mustache=require(_0x0a91('0x6'));var util=require(_0x0a91('0x7'));var path=require(_0x0a91('0x8'));var sox=require(_0x0a91('0x9'));var csv=require('to-csv');var ejs=require(_0x0a91('0xa'));var fs=require('fs');var fs_extra=require(_0x0a91('0xb'));var _=require('lodash');var squel=require(_0x0a91('0xc'));var crypto=require(_0x0a91('0xd'));var jsforce=require(_0x0a91('0xe'));var deskjs=require(_0x0a91('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a91('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0a91('0x11'));var as=require(_0x0a91('0x12'));var hardwareService=require(_0x0a91('0x13'));var logger=require(_0x0a91('0x14'))(_0x0a91('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e5b52,_0x4cac47){_0x4cac47=_0x4cac47||0xcc;return function(_0xe66781){if(_0xe66781){return _0x2e5b52[_0x0a91('0x16')](_0x4cac47);}return _0x2e5b52[_0x0a91('0x17')](_0x4cac47)['end']();};}function respondWithResult(_0x9335b3,_0x410c4c){_0x410c4c=_0x410c4c||0xc8;return function(_0x49bac2){if(_0x49bac2){return _0x9335b3[_0x0a91('0x17')](_0x410c4c)[_0x0a91('0x18')](_0x49bac2);}};}function respondWithFilteredResult(_0x34b0db,_0xb51d29){return function(_0x916a79){if(_0x916a79){var _0x546de0=typeof _0xb51d29[_0x0a91('0x19')]===_0x0a91('0x1a')&&typeof _0xb51d29[_0x0a91('0x1b')]===_0x0a91('0x1a');var _0x2779de=_0x916a79[_0x0a91('0x1c')];var _0x32b1a3=_0x546de0?0x0:_0xb51d29[_0x0a91('0x19')];var _0x2e1cd7=_0x546de0?_0x916a79['count']:_0xb51d29[_0x0a91('0x19')]+_0xb51d29[_0x0a91('0x1b')];var _0x6e5ec;if(_0x2e1cd7>=_0x2779de){_0x2e1cd7=_0x2779de;_0x6e5ec=0xc8;}else{_0x6e5ec=0xce;}_0x34b0db['status'](_0x6e5ec);return _0x34b0db[_0x0a91('0x1d')](_0x0a91('0x1e'),_0x32b1a3+'-'+_0x2e1cd7+'/'+_0x2779de)[_0x0a91('0x18')](_0x916a79);}return null;};}function patchUpdates(_0x5d7b57){return function(_0x5c456d){try{jsonpatch[_0x0a91('0x1f')](_0x5c456d,_0x5d7b57,!![]);}catch(_0x243dd7){return BPromise[_0x0a91('0x20')](_0x243dd7);}return _0x5c456d[_0x0a91('0x21')]();};}function saveUpdates(_0x409bc9,_0x213027){return function(_0x262c23){if(_0x262c23){return _0x262c23[_0x0a91('0x22')](_0x409bc9)[_0x0a91('0x23')](function(_0x5889e1){return _0x5889e1;});}return null;};}function removeEntity(_0x28060c,_0x5058cb){return function(_0x259d8d){if(_0x259d8d){return _0x259d8d[_0x0a91('0x24')]()[_0x0a91('0x23')](function(){_0x28060c['status'](0xcc)[_0x0a91('0x25')]();});}};}function handleEntityNotFound(_0xacdb2f,_0x20f67a){return function(_0xafb849){if(!_0xafb849){_0xacdb2f[_0x0a91('0x16')](0x194);}return _0xafb849;};}function handleError(_0x481608,_0x2c3371){_0x2c3371=_0x2c3371||0x1f4;return function(_0x48b87f){logger['error'](_0x48b87f['stack']);if(_0x48b87f[_0x0a91('0x26')]){delete _0x48b87f[_0x0a91('0x26')];}_0x481608[_0x0a91('0x17')](_0x2c3371)[_0x0a91('0x27')](_0x48b87f);};}exports['index']=function(_0x327af2,_0x4f4d7f){var _0xe09f38={},_0x4bc6e5={},_0x87d595={'count':0x0,'rows':[]};var _0x4f1668=_['map'](db['UserProfileSection'][_0x0a91('0x28')],function(_0x583940){return{'name':_0x583940[_0x0a91('0x29')],'type':_0x583940[_0x0a91('0x2a')][_0x0a91('0x2b')]};});_0x4bc6e5[_0x0a91('0x2c')]=_[_0x0a91('0x2d')](_0x4f1668,_0x0a91('0x26'));_0x4bc6e5[_0x0a91('0x2e')]=_[_0x0a91('0x2f')](_0x327af2[_0x0a91('0x2e')]);_0x4bc6e5[_0x0a91('0x30')]=_[_0x0a91('0x31')](_0x4bc6e5['model'],_0x4bc6e5['query']);_0xe09f38[_0x0a91('0x32')]=_[_0x0a91('0x31')](_0x4bc6e5[_0x0a91('0x2c')],qs[_0x0a91('0x33')](_0x327af2['query'][_0x0a91('0x33')]));_0xe09f38['attributes']=_0xe09f38[_0x0a91('0x32')][_0x0a91('0x34')]?_0xe09f38[_0x0a91('0x32')]:_0x4bc6e5[_0x0a91('0x2c')];if(!_0x327af2[_0x0a91('0x2e')][_0x0a91('0x35')]('nolimit')){_0xe09f38['limit']=qs['limit'](_0x327af2[_0x0a91('0x2e')][_0x0a91('0x1b')]);_0xe09f38[_0x0a91('0x19')]=qs[_0x0a91('0x19')](_0x327af2[_0x0a91('0x2e')][_0x0a91('0x19')]);}_0xe09f38[_0x0a91('0x36')]=qs[_0x0a91('0x37')](_0x327af2[_0x0a91('0x2e')]['sort']);_0xe09f38['where']=qs[_0x0a91('0x30')](_[_0x0a91('0x38')](_0x327af2[_0x0a91('0x2e')],_0x4bc6e5[_0x0a91('0x30')]),_0x4f1668);if(_0x327af2['query'][_0x0a91('0x39')]){_0xe09f38[_0x0a91('0x3a')]=_['merge'](_0xe09f38['where'],{'$or':_[_0x0a91('0x2d')](_0x4f1668,function(_0x13029e){if(_0x13029e[_0x0a91('0x2a')]!==_0x0a91('0x3b')){var _0xed07af={};_0xed07af[_0x13029e[_0x0a91('0x26')]]={'$like':'%'+_0x327af2[_0x0a91('0x2e')][_0x0a91('0x39')]+'%'};return _0xed07af;}})});}_0xe09f38=_[_0x0a91('0x3c')]({},_0xe09f38,_0x327af2[_0x0a91('0x3d')]);var _0x5e0e8e={'where':_0xe09f38[_0x0a91('0x3a')]};return db[_0x0a91('0x3e')][_0x0a91('0x1c')](_0x5e0e8e)['then'](function(_0x39f7d4){_0x87d595[_0x0a91('0x1c')]=_0x39f7d4;if(_0x327af2[_0x0a91('0x2e')]['includeAll']){_0xe09f38[_0x0a91('0x3f')]=[{'all':!![]}];}return db[_0x0a91('0x3e')]['findAll'](_0xe09f38);})[_0x0a91('0x23')](function(_0x5c9e88){_0x87d595[_0x0a91('0x40')]=_0x5c9e88;return _0x87d595;})[_0x0a91('0x23')](respondWithFilteredResult(_0x4f4d7f,_0xe09f38))[_0x0a91('0x41')](handleError(_0x4f4d7f,null));};exports['show']=function(_0x46d9eb,_0x49f0fc){var _0xdf1037={'raw':![],'where':{'id':_0x46d9eb[_0x0a91('0x42')]['id']}},_0x2c6916={};_0x2c6916[_0x0a91('0x2c')]=_[_0x0a91('0x2f')](db[_0x0a91('0x3e')][_0x0a91('0x28')]);_0x2c6916[_0x0a91('0x2e')]=_[_0x0a91('0x2f')](_0x46d9eb[_0x0a91('0x2e')]);_0x2c6916[_0x0a91('0x30')]=_[_0x0a91('0x31')](_0x2c6916[_0x0a91('0x2c')],_0x2c6916[_0x0a91('0x2e')]);_0xdf1037[_0x0a91('0x32')]=_[_0x0a91('0x31')](_0x2c6916['model'],qs['fields'](_0x46d9eb[_0x0a91('0x2e')][_0x0a91('0x33')]));_0xdf1037[_0x0a91('0x32')]=_0xdf1037['attributes'][_0x0a91('0x34')]?_0xdf1037[_0x0a91('0x32')]:_0x2c6916[_0x0a91('0x2c')];if(_0x46d9eb[_0x0a91('0x2e')]['includeAll']){_0xdf1037[_0x0a91('0x3f')]=[{'all':!![]}];}_0xdf1037=_[_0x0a91('0x3c')]({},_0xdf1037,_0x46d9eb[_0x0a91('0x3d')]);return db[_0x0a91('0x3e')][_0x0a91('0x43')](_0xdf1037)[_0x0a91('0x23')](handleEntityNotFound(_0x49f0fc,null))[_0x0a91('0x23')](respondWithResult(_0x49f0fc,null))[_0x0a91('0x41')](handleError(_0x49f0fc,null));};exports[_0x0a91('0x44')]=function(_0x33a10e,_0x476cc4){return db[_0x0a91('0x3e')]['create'](_0x33a10e['body'],{})[_0x0a91('0x23')](respondWithResult(_0x476cc4,0xc9))[_0x0a91('0x41')](handleError(_0x476cc4,null));};exports[_0x0a91('0x22')]=function(_0x2eef94,_0x2f151d){if(_0x2eef94['body']['id']){delete _0x2eef94['body']['id'];}return db[_0x0a91('0x3e')][_0x0a91('0x43')]({'where':{'id':_0x2eef94[_0x0a91('0x42')]['id']}})[_0x0a91('0x23')](handleEntityNotFound(_0x2f151d,null))[_0x0a91('0x23')](saveUpdates(_0x2eef94[_0x0a91('0x45')],null))[_0x0a91('0x23')](respondWithResult(_0x2f151d,null))[_0x0a91('0x41')](handleError(_0x2f151d,null));};exports[_0x0a91('0x24')]=function(_0x1684b2,_0x12e42a){return db[_0x0a91('0x3e')][_0x0a91('0x43')]({'where':{'id':_0x1684b2[_0x0a91('0x42')]['id']}})[_0x0a91('0x23')](handleEntityNotFound(_0x12e42a,null))[_0x0a91('0x23')](removeEntity(_0x12e42a,null))[_0x0a91('0x41')](handleError(_0x12e42a,null));};exports[_0x0a91('0x46')]=function(_0x291c8b,_0xcf8ceb){return db[_0x0a91('0x3e')][_0x0a91('0x46')]()[_0x0a91('0x23')](respondWithResult(_0xcf8ceb,null))[_0x0a91('0x41')](handleError(_0xcf8ceb,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0b3f526..9d72188 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 _0x5b57=['api','moment','bluebird','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','../../config/logger'];(function(_0x3285a3,_0xdbc3c7){var _0x392540=function(_0x33f243){while(--_0x33f243){_0x3285a3['push'](_0x3285a3['shift']());}};_0x392540(++_0xdbc3c7);}(_0x5b57,0x80));var _0x75b5=function(_0x269da9,_0x3c2b8c){_0x269da9=_0x269da9-0x0;var _0x12f391=_0x5b57[_0x269da9];return _0x12f391;};'use strict';var _=require(_0x75b5('0x0'));var util=require('util');var logger=require(_0x75b5('0x1'))(_0x75b5('0x2'));var moment=require(_0x75b5('0x3'));var BPromise=require(_0x75b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75b5('0x5'));var config=require(_0x75b5('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x75b5('0x7')]=function(_0x48a9ac,_0x2d3be8){return _0x48a9ac[_0x75b5('0x8')](_0x75b5('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x75b5('0xa'),'fields':[_0x75b5('0xb'),_0x75b5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x303a=['moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x2b087a,_0x5967d3){var _0x38f0e7=function(_0x177c77){while(--_0x177c77){_0x2b087a['push'](_0x2b087a['shift']());}};_0x38f0e7(++_0x5967d3);}(_0x303a,0xea));var _0xa303=function(_0x46939d,_0xc1b36d){_0x46939d=_0x46939d-0x0;var _0x5105e8=_0x303a[_0x46939d];return _0x5105e8;};'use strict';var _=require(_0xa303('0x0'));var util=require(_0xa303('0x1'));var logger=require(_0xa303('0x2'))(_0xa303('0x3'));var moment=require(_0xa303('0x4'));var BPromise=require(_0xa303('0x5'));var rp=require(_0xa303('0x6'));var fs=require('fs');var path=require(_0xa303('0x7'));var rimraf=require('rimraf');var config=require(_0xa303('0x8'));var attributes=require(_0xa303('0x9'));module[_0xa303('0xa')]=function(_0x52acea,_0x60933d){return _0x52acea[_0xa303('0xb')](_0xa303('0xc'),attributes,{'tableName':_0xa303('0xd'),'paranoid':![],'indexes':[{'name':_0xa303('0xe'),'fields':[_0xa303('0xf'),_0xa303('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 18e451d..6128c16 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 _0x3c3e=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1870c7,_0x5aebca){var _0x2e0590=function(_0x4750f3){while(--_0x4750f3){_0x1870c7['push'](_0x1870c7['shift']());}};_0x2e0590(++_0x5aebca);}(_0x3c3e,0x103));var _0xe3c3=function(_0x3631ea,_0xe57b78){_0x3631ea=_0x3631ea-0x0;var _0x3630d6=_0x3c3e[_0x3631ea];return _0x3630d6;};'use strict';var _=require(_0xe3c3('0x0'));var util=require(_0xe3c3('0x1'));var moment=require(_0xe3c3('0x2'));var BPromise=require(_0xe3c3('0x3'));var rs=require(_0xe3c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe3c3('0x5'));var logger=require('../../config/logger')(_0xe3c3('0x6'));var config=require('../../config/environment');var jayson=require(_0xe3c3('0x7'));var client=jayson[_0xe3c3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1144a1,_0x35f041,_0x2e3527){return new BPromise(function(_0x311997,_0x3fbaae){return client['request'](_0x1144a1,_0x2e3527)['then'](function(_0x27f310){logger[_0xe3c3('0x9')](_0xe3c3('0xa'),_0x35f041,_0xe3c3('0xb'));logger[_0xe3c3('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x35f041,_0xe3c3('0xb'),JSON[_0xe3c3('0xd')](_0x27f310));if(_0x27f310['error']){if(_0x27f310[_0xe3c3('0xe')]['code']===0x1f4){logger[_0xe3c3('0xe')](_0xe3c3('0xa'),_0x35f041,_0x27f310[_0xe3c3('0xe')][_0xe3c3('0xf')]);return _0x3fbaae(_0x27f310[_0xe3c3('0xe')][_0xe3c3('0xf')]);}logger[_0xe3c3('0xe')](_0xe3c3('0xa'),_0x35f041,_0x27f310[_0xe3c3('0xe')]['message']);return _0x311997(_0x27f310[_0xe3c3('0xe')][_0xe3c3('0xf')]);}else{logger[_0xe3c3('0x9')](_0xe3c3('0xa'),_0x35f041,_0xe3c3('0xb'));_0x311997(_0x27f310[_0xe3c3('0x10')][_0xe3c3('0xf')]);}})['catch'](function(_0x83a450){logger['error'](_0xe3c3('0xa'),_0x35f041,_0x83a450);_0x3fbaae(_0x83a450);});});} \ No newline at end of file +var _0x6c32=['request','info','request\x20sent','debug','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x5b6f38,_0x50e106){var _0x198b58=function(_0x5c1159){while(--_0x5c1159){_0x5b6f38['push'](_0x5b6f38['shift']());}};_0x198b58(++_0x50e106);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require('util');var moment=require(_0x26c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x26c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26c3('0x3'))['db'];var utils=require(_0x26c3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x26c3('0x5'));var jayson=require(_0x26c3('0x6'));var client=jayson[_0x26c3('0x7')][_0x26c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17bc12,_0x2756e5,_0x438a89){return new BPromise(function(_0x11ed3d,_0x2134b8){return client[_0x26c3('0x9')](_0x17bc12,_0x438a89)['then'](function(_0x561496){logger[_0x26c3('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x2756e5,_0x26c3('0xb'));logger[_0x26c3('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2756e5,_0x26c3('0xb'),JSON[_0x26c3('0xd')](_0x561496));if(_0x561496[_0x26c3('0xe')]){if(_0x561496[_0x26c3('0xe')][_0x26c3('0xf')]===0x1f4){logger['error'](_0x26c3('0x10'),_0x2756e5,_0x561496[_0x26c3('0xe')][_0x26c3('0x11')]);return _0x2134b8(_0x561496[_0x26c3('0xe')][_0x26c3('0x11')]);}logger[_0x26c3('0xe')](_0x26c3('0x10'),_0x2756e5,_0x561496[_0x26c3('0xe')]['message']);return _0x11ed3d(_0x561496['error'][_0x26c3('0x11')]);}else{logger[_0x26c3('0xa')](_0x26c3('0x10'),_0x2756e5,_0x26c3('0xb'));_0x11ed3d(_0x561496[_0x26c3('0x12')][_0x26c3('0x11')]);}})['catch'](function(_0x2edaca){logger[_0x26c3('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2756e5,_0x2edaca);_0x2134b8(_0x2edaca);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ef4d8f1..4e44cc9 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4fb2dd,_0x139852){var _0x1aefec=function(_0x576fd8){while(--_0x576fd8){_0x4fb2dd['push'](_0x4fb2dd['shift']());}};_0x1aefec(++_0x139852);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xcb91[_0x16e57d];return _0x40239c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x50daa4,_0x3c336d){var _0x389935=function(_0x292d12){while(--_0x292d12){_0x50daa4['push'](_0x50daa4['shift']());}};_0x389935(++_0x3c336d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 17d78f8..abb1b25 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 _0x4f16=['exports','INTEGER'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0x4f16,0x12a));var _0x64f1=function(_0x5d2507,_0x556fac){_0x5d2507=_0x5d2507-0x0;var _0x198c07=_0x4f16[_0x5d2507];return _0x198c07;};'use strict';var Sequelize=require('sequelize');module[_0x64f1('0x0')]={'penalty':{'type':Sequelize[_0x64f1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd958=['sequelize','INTEGER'];(function(_0x589542,_0xd69447){var _0x57eccf=function(_0x473d20){while(--_0x473d20){_0x589542['push'](_0x589542['shift']());}};_0x57eccf(++_0xd69447);}(_0xd958,0x15c));var _0x8d95=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xd958[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x8d95('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8d95('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 5611e36..405047d 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 _0x292c=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x2f2dd0,_0x242127){var _0x3c48d1=function(_0x4516b1){while(--_0x4516b1){_0x2f2dd0['push'](_0x2f2dd0['shift']());}};_0x3c48d1(++_0x242127);}(_0x292c,0x66));var _0xc292=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x292c[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var logger=require(_0xc292('0x1'))(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require(_0xc292('0x4'));var rp=require(_0xc292('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc292('0x6'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xc292('0x7')]=function(_0x1c45ed,_0x2c01eb){return _0x1c45ed[_0xc292('0x8')](_0xc292('0x9'),attributes,{'tableName':_0xc292('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4b6=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment'];(function(_0x3abdd4,_0x22a0cd){var _0x55cb90=function(_0x446b93){while(--_0x446b93){_0x3abdd4['push'](_0x3abdd4['shift']());}};_0x55cb90(++_0x22a0cd);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x78f398,_0x5a198d){_0x78f398=_0x78f398-0x0;var _0x3687f1=_0xb4b6[_0x78f398];return _0x3687f1;};'use strict';var _=require('lodash');var util=require(_0x6b4b('0x0'));var logger=require(_0x6b4b('0x1'))(_0x6b4b('0x2'));var moment=require(_0x6b4b('0x3'));var BPromise=require(_0x6b4b('0x4'));var rp=require(_0x6b4b('0x5'));var fs=require('fs');var path=require(_0x6b4b('0x6'));var rimraf=require(_0x6b4b('0x7'));var config=require(_0x6b4b('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x6b4b('0x9')]=function(_0x49e81c,_0x3915de){return _0x49e81c[_0x6b4b('0xa')](_0x6b4b('0xb'),attributes,{'tableName':_0x6b4b('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 41d37b7..f7bd29f 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 _0x0f52=['../../config/logger','rpc','jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x0f52,0xd9));var _0x20f5=function(_0x27cb8a,_0x467852){_0x27cb8a=_0x27cb8a-0x0;var _0x42bb73=_0x0f52[_0x27cb8a];return _0x42bb73;};'use strict';var _=require('lodash');var util=require(_0x20f5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x20f5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20f5('0x2'))['db'];var utils=require(_0x20f5('0x3'));var logger=require(_0x20f5('0x4'))(_0x20f5('0x5'));var config=require('../../config/environment');var jayson=require(_0x20f5('0x6'));var client=jayson[_0x20f5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d375e,_0x5ad818,_0x1ab142){return new BPromise(function(_0x3d8279,_0x4f764f){return client['request'](_0x2d375e,_0x1ab142)[_0x20f5('0x8')](function(_0x4c88e4){logger[_0x20f5('0x9')](_0x20f5('0xa'),_0x5ad818,'request\x20sent');logger[_0x20f5('0xb')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5ad818,_0x20f5('0xc'),JSON['stringify'](_0x4c88e4));if(_0x4c88e4['error']){if(_0x4c88e4[_0x20f5('0xd')]['code']===0x1f4){logger[_0x20f5('0xd')](_0x20f5('0xa'),_0x5ad818,_0x4c88e4[_0x20f5('0xd')][_0x20f5('0xe')]);return _0x4f764f(_0x4c88e4['error'][_0x20f5('0xe')]);}logger[_0x20f5('0xd')](_0x20f5('0xa'),_0x5ad818,_0x4c88e4['error'][_0x20f5('0xe')]);return _0x3d8279(_0x4c88e4[_0x20f5('0xd')][_0x20f5('0xe')]);}else{logger[_0x20f5('0x9')](_0x20f5('0xa'),_0x5ad818,_0x20f5('0xc'));_0x3d8279(_0x4c88e4[_0x20f5('0xf')][_0x20f5('0xe')]);}})[_0x20f5('0x10')](function(_0x53d270){logger[_0x20f5('0xd')](_0x20f5('0xa'),_0x5ad818,_0x53d270);_0x4f764f(_0x53d270);});});} \ No newline at end of file +var _0x50b6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x50b6,0xd3));var _0x650b=function(_0x572586,_0x573f28){_0x572586=_0x572586-0x0;var _0x21e880=_0x50b6[_0x572586];return _0x21e880;};'use strict';var _=require(_0x650b('0x0'));var util=require(_0x650b('0x1'));var moment=require(_0x650b('0x2'));var BPromise=require(_0x650b('0x3'));var rs=require(_0x650b('0x4'));var fs=require('fs');var Redis=require(_0x650b('0x5'));var db=require(_0x650b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x650b('0x7'))('rpc');var config=require(_0x650b('0x8'));var jayson=require(_0x650b('0x9'));var client=jayson[_0x650b('0xa')][_0x650b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ac6c5,_0x46df8b,_0xa8a66a){return new BPromise(function(_0x3f2b11,_0x3ff22f){return client['request'](_0x4ac6c5,_0xa8a66a)[_0x650b('0xc')](function(_0x3f83d8){logger[_0x650b('0xd')](_0x650b('0xe'),_0x46df8b,'request\x20sent');logger['debug'](_0x650b('0xf'),_0x46df8b,'request\x20sent',JSON[_0x650b('0x10')](_0x3f83d8));if(_0x3f83d8[_0x650b('0x11')]){if(_0x3f83d8[_0x650b('0x11')][_0x650b('0x12')]===0x1f4){logger[_0x650b('0x11')](_0x650b('0xe'),_0x46df8b,_0x3f83d8[_0x650b('0x11')][_0x650b('0x13')]);return _0x3ff22f(_0x3f83d8[_0x650b('0x11')][_0x650b('0x13')]);}logger[_0x650b('0x11')](_0x650b('0xe'),_0x46df8b,_0x3f83d8['error']['message']);return _0x3f2b11(_0x3f83d8['error'][_0x650b('0x13')]);}else{logger[_0x650b('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x46df8b,'request\x20sent');_0x3f2b11(_0x3f83d8['result'][_0x650b('0x13')]);}})[_0x650b('0x14')](function(_0x533de5){logger['error'](_0x650b('0xe'),_0x46df8b,_0x533de5);_0x3ff22f(_0x533de5);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 221ed6e..ff52513 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 _0xba31=['INTEGER','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xba31,0xa0));var _0x1ba3=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0xba31[_0x5bc5fe];return _0x298ea7;};'use strict';var Sequelize=require(_0x1ba3('0x0'));module[_0x1ba3('0x1')]={'UserId':{'type':Sequelize[_0x1ba3('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1ba3('0x2')]}}; \ No newline at end of file +var _0x7ffc=['INTEGER'];(function(_0x27847e,_0x4a4123){var _0x4433cf=function(_0x4ddcee){while(--_0x4ddcee){_0x27847e['push'](_0x27847e['shift']());}};_0x4433cf(++_0x4a4123);}(_0x7ffc,0x129));var _0xc7ff=function(_0x3eb498,_0x1cdc12){_0x3eb498=_0x3eb498-0x0;var _0x327f69=_0x7ffc[_0x3eb498];return _0x327f69;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0xc7ff('0x0')]},'VoicePrefixId':{'type':Sequelize[_0xc7ff('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 88ad5fb..106ad51 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(_0x507724,_0x4553f5){var _0x23776f=function(_0x575ca4){while(--_0x575ca4){_0x507724['push'](_0x507724['shift']());}};_0x23776f(++_0x4553f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x33f374,_0x2443df){var _0x14c7bc=function(_0x1947c7){while(--_0x1947c7){_0x33f374['push'](_0x33f374['shift']());}};_0x14c7bc(++_0x2443df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 407f76b..425240d 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ccb4b,_0x1c5bdc){var _0x2fd92c=function(_0x1a0286){while(--_0x1a0286){_0x1ccb4b['push'](_0x1ccb4b['shift']());}};_0x2fd92c(++_0x1c5bdc);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x29b4c0,_0x469e30){var _0x4e2d05=function(_0xa206f8){while(--_0xa206f8){_0x29b4c0['push'](_0x29b4c0['shift']());}};_0x4e2d05(++_0x469e30);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0xcb91[_0x3bab09];return _0x164376;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 45c61a7..73f396b 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 _0x8e70=['sequelize','exports'];(function(_0x17a5cb,_0x3952a8){var _0x525e63=function(_0x1bce90){while(--_0x1bce90){_0x17a5cb['push'](_0x17a5cb['shift']());}};_0x525e63(++_0x3952a8);}(_0x8e70,0x88));var _0x08e7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8e70[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x08e7('0x0'));module[_0x08e7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa6ff=['exports','INTEGER','sequelize'];(function(_0x57b62f,_0x3694df){var _0x10dc65=function(_0x2586f5){while(--_0x2586f5){_0x57b62f['push'](_0x57b62f['shift']());}};_0x10dc65(++_0x3694df);}(_0xa6ff,0x10a));var _0xfa6f=function(_0x41cadf,_0x308e96){_0x41cadf=_0x41cadf-0x0;var _0x3bd7c4=_0xa6ff[_0x41cadf];return _0x3bd7c4;};'use strict';var Sequelize=require(_0xfa6f('0x0'));module[_0xfa6f('0x1')]={'penalty':{'type':Sequelize[_0xfa6f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index b9983ac..a233227 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 _0x6f5f=['user_has_voice_queues','lodash','util','moment','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x20ae2f,_0x455457){var _0x47adce=function(_0xae326f){while(--_0xae326f){_0x20ae2f['push'](_0x20ae2f['shift']());}};_0x47adce(++_0x455457);}(_0x6f5f,0xf3));var _0xf6f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6f5('0x0'));var util=require(_0xf6f5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf6f5('0x2'));var BPromise=require(_0xf6f5('0x3'));var rp=require(_0xf6f5('0x4'));var fs=require('fs');var path=require(_0xf6f5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6f5('0x6'));module[_0xf6f5('0x7')]=function(_0xe61aa,_0x3dd1a4){return _0xe61aa[_0xf6f5('0x8')](_0xf6f5('0x9'),attributes,{'tableName':_0xf6f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23b7=['../../config/logger','api','bluebird','path','rimraf','exports','define','UserVoiceQueue','util'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x23b7,0xe0));var _0x723b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23b7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x723b('0x0'));var logger=require(_0x723b('0x1'))(_0x723b('0x2'));var moment=require('moment');var BPromise=require(_0x723b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x723b('0x4'));var rimraf=require(_0x723b('0x5'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x723b('0x6')]=function(_0x83a2c5,_0x17de2d){return _0x83a2c5[_0x723b('0x7')](_0x723b('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 9fdb841..45f48ab 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 _0x6192=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x539fef,_0x17f310){var _0x1c9d6f=function(_0x562903){while(--_0x562903){_0x539fef['push'](_0x539fef['shift']());}};_0x1c9d6f(++_0x17f310);}(_0x6192,0x19e));var _0x2619=function(_0xf8b548,_0x55255c){_0xf8b548=_0xf8b548-0x0;var _0x10010f=_0x6192[_0xf8b548];return _0x10010f;};'use strict';var _=require(_0x2619('0x0'));var util=require(_0x2619('0x1'));var moment=require(_0x2619('0x2'));var BPromise=require(_0x2619('0x3'));var rs=require(_0x2619('0x4'));var fs=require('fs');var Redis=require(_0x2619('0x5'));var db=require(_0x2619('0x6'))['db'];var utils=require(_0x2619('0x7'));var logger=require(_0x2619('0x8'))('rpc');var config=require(_0x2619('0x9'));var jayson=require(_0x2619('0xa'));var client=jayson[_0x2619('0xb')][_0x2619('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7e5cb9,_0x171790,_0x4d3d2a){return new BPromise(function(_0x362e7f,_0x23239d){return client[_0x2619('0xd')](_0x7e5cb9,_0x4d3d2a)['then'](function(_0x5bcfdf){logger[_0x2619('0xe')](_0x2619('0xf'),_0x171790,_0x2619('0x10'));logger[_0x2619('0x11')](_0x2619('0x12'),_0x171790,_0x2619('0x10'),JSON[_0x2619('0x13')](_0x5bcfdf));if(_0x5bcfdf['error']){if(_0x5bcfdf['error']['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x171790,_0x5bcfdf[_0x2619('0x14')]['message']);return _0x23239d(_0x5bcfdf['error'][_0x2619('0x15')]);}logger[_0x2619('0x14')](_0x2619('0xf'),_0x171790,_0x5bcfdf['error'][_0x2619('0x15')]);return _0x362e7f(_0x5bcfdf['error'][_0x2619('0x15')]);}else{logger[_0x2619('0xe')](_0x2619('0xf'),_0x171790,_0x2619('0x10'));_0x362e7f(_0x5bcfdf[_0x2619('0x16')]['message']);}})['catch'](function(_0x1f0280){logger[_0x2619('0x14')](_0x2619('0xf'),_0x171790,_0x1f0280);_0x23239d(_0x1f0280);});});} \ No newline at end of file +var _0x4239=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x4239,0x102));var _0x9423=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x4239[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require(_0x9423('0x0'));var moment=require(_0x9423('0x1'));var BPromise=require(_0x9423('0x2'));var rs=require(_0x9423('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9423('0x4'))['db'];var utils=require(_0x9423('0x5'));var logger=require(_0x9423('0x6'))(_0x9423('0x7'));var config=require(_0x9423('0x8'));var jayson=require(_0x9423('0x9'));var client=jayson[_0x9423('0xa')][_0x9423('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da8a9,_0x32b7ef,_0x30642f){return new BPromise(function(_0x536118,_0x2b2e38){return client[_0x9423('0xc')](_0x2da8a9,_0x30642f)[_0x9423('0xd')](function(_0x4ef1f9){logger['info'](_0x9423('0xe'),_0x32b7ef,_0x9423('0xf'));logger[_0x9423('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x32b7ef,_0x9423('0xf'),JSON[_0x9423('0x11')](_0x4ef1f9));if(_0x4ef1f9[_0x9423('0x12')]){if(_0x4ef1f9[_0x9423('0x12')][_0x9423('0x13')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x32b7ef,_0x4ef1f9[_0x9423('0x12')][_0x9423('0x14')]);return _0x2b2e38(_0x4ef1f9[_0x9423('0x12')]['message']);}logger[_0x9423('0x12')](_0x9423('0xe'),_0x32b7ef,_0x4ef1f9[_0x9423('0x12')]['message']);return _0x536118(_0x4ef1f9['error'][_0x9423('0x14')]);}else{logger[_0x9423('0x15')](_0x9423('0xe'),_0x32b7ef,_0x9423('0xf'));_0x536118(_0x4ef1f9['result'][_0x9423('0x14')]);}})['catch'](function(_0x22dfd4){logger[_0x9423('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x32b7ef,_0x22dfd4);_0x2b2e38(_0x22dfd4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 02a6909..27b9035 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x151227,_0x1c2d2d){var _0x9b7602=function(_0x28f9a6){while(--_0x28f9a6){_0x151227['push'](_0x151227['shift']());}};_0x9b7602(++_0x1c2d2d);}(_0xe706,0xa3));var _0x6e70=function(_0xa5c63f,_0x2aaaa8){_0xa5c63f=_0xa5c63f-0x0;var _0xf352b1=_0xe706[_0xa5c63f];return _0xf352b1;};'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(_0x3dd1cf,_0x55a570){var _0x4c63b9=function(_0x3acd75){while(--_0x3acd75){_0x3dd1cf['push'](_0x3dd1cf['shift']());}};_0x4c63b9(++_0x55a570);}(_0x70e0,0x17b));var _0x070e=function(_0x3bde24,_0x1d6138){_0x3bde24=_0x3bde24-0x0;var _0x3a6886=_0x70e0[_0x3bde24];return _0x3a6886;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index cad59d2..a13e3f0 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 _0x6f26=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x7c10f3,_0x4447fe){var _0x51d432=function(_0x3e8c68){while(--_0x3e8c68){_0x7c10f3['push'](_0x7c10f3['shift']());}};_0x51d432(++_0x4447fe);}(_0x6f26,0x1ad));var _0x66f2=function(_0x4159bc,_0x13aa41){_0x4159bc=_0x4159bc-0x0;var _0x536069=_0x6f26[_0x4159bc];return _0x536069;};'use strict';var Sequelize=require('sequelize');module[_0x66f2('0x0')]={'uniqueid':{'type':Sequelize[_0x66f2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x66f2('0x2')},'membername':{'type':Sequelize[_0x66f2('0x3')],'allowNull':![],'comment':_0x66f2('0x2')},'UserId':{'type':Sequelize[_0x66f2('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x66f2('0x3')],'allowNull':![],'unique':_0x66f2('0x4'),'comment':_0x66f2('0x2')},'VoiceQueueId':{'type':Sequelize[_0x66f2('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x66f2('0x3')],'allowNull':![],'unique':_0x66f2('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x66f2('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x66f2('0x1')](0xb),'defaultValue':0x0,'comment':_0x66f2('0x2')}}; \ No newline at end of file +var _0xa8cd=['sequelize','exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface'];(function(_0x91a06,_0x2d8649){var _0xbd1732=function(_0x571e53){while(--_0x571e53){_0x91a06['push'](_0x91a06['shift']());}};_0xbd1732(++_0x2d8649);}(_0xa8cd,0x7e));var _0xda8c=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xa8cd[_0x3e182f];return _0x23edc9;};'use strict';var Sequelize=require(_0xda8c('0x0'));module[_0xda8c('0x1')]={'uniqueid':{'type':Sequelize[_0xda8c('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xda8c('0x3')],'allowNull':![],'comment':_0xda8c('0x4')},'UserId':{'type':Sequelize[_0xda8c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xda8c('0x3')],'allowNull':![],'unique':_0xda8c('0x5'),'comment':_0xda8c('0x4')},'VoiceQueueId':{'type':Sequelize[_0xda8c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xda8c('0x3')],'allowNull':![],'unique':_0xda8c('0x5'),'comment':_0xda8c('0x4')},'penalty':{'type':Sequelize[_0xda8c('0x2')](0xb),'defaultValue':0x0,'comment':_0xda8c('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7f2108d..6f2b49f 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 _0xb63b=['emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xb63b,0xfd));var _0xbb63=function(_0x4c1c36,_0x1575f2){_0x4c1c36=_0x4c1c36-0x0;var _0x47a637=_0xb63b[_0x4c1c36];return _0x47a637;};'use strict';var EventEmitter=require(_0xbb63('0x0'));var UserVoiceQueueRt=require(_0xbb63('0x1'))['db'][_0xbb63('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xbb63('0x3')](0x0);var events={'afterCreate':_0xbb63('0x4'),'afterUpdate':_0xbb63('0x5'),'afterDestroy':_0xbb63('0x6')};function emitEvent(_0x4ad978){return function(_0x3d8e72,_0x56d582,_0x298955){UserVoiceQueueRtEvents['emit'](_0x4ad978+':'+_0x3d8e72['id'],_0x3d8e72);UserVoiceQueueRtEvents[_0xbb63('0x7')](_0x4ad978,_0x3d8e72);_0x298955(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xbb63('0x8')](e,emitEvent(event));}}module[_0xbb63('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5ca7=['save','emit','hasOwnProperty','hook','exports','UserVoiceQueueRt','setMaxListeners'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x5ca7,0x18d));var _0x75ca=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5ca7[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x75ca('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x75ca('0x1')](0x0);var events={'afterCreate':_0x75ca('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5da3c7){return function(_0x34277,_0x4f8b9,_0x1c849f){UserVoiceQueueRtEvents[_0x75ca('0x3')](_0x5da3c7+':'+_0x34277['id'],_0x34277);UserVoiceQueueRtEvents[_0x75ca('0x3')](_0x5da3c7,_0x34277);_0x1c849f(null);};}for(var e in events){if(events[_0x75ca('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x75ca('0x5')](e,emitEvent(event));}}module[_0x75ca('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0c7a5c6..8bcf6aa 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 _0x41d9=['../../config/environment','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41d9,0x9b));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var logger=require(_0x941d('0x2'))(_0x941d('0x3'));var moment=require('moment');var BPromise=require(_0x941d('0x4'));var rp=require(_0x941d('0x5'));var fs=require('fs');var path=require(_0x941d('0x6'));var rimraf=require('rimraf');var config=require(_0x941d('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x941d('0x8')]=function(_0x11e294,_0x169159){return _0x11e294['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0079=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x51ed98,_0x21a723){var _0x3e50aa=function(_0x239524){while(--_0x239524){_0x51ed98['push'](_0x51ed98['shift']());}};_0x3e50aa(++_0x21a723);}(_0x0079,0x104));var _0x9007=function(_0x39c3ef,_0x8f88f5){_0x39c3ef=_0x39c3ef-0x0;var _0x3cb4c7=_0x0079[_0x39c3ef];return _0x3cb4c7;};'use strict';var _=require(_0x9007('0x0'));var util=require(_0x9007('0x1'));var logger=require('../../config/logger')(_0x9007('0x2'));var moment=require('moment');var BPromise=require(_0x9007('0x3'));var rp=require(_0x9007('0x4'));var fs=require('fs');var path=require(_0x9007('0x5'));var rimraf=require(_0x9007('0x6'));var config=require(_0x9007('0x7'));var attributes=require(_0x9007('0x8'));module[_0x9007('0x9')]=function(_0x54e546,_0x256620){return _0x54e546[_0x9007('0xa')](_0x9007('0xb'),attributes,{'tableName':_0x9007('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 06fae72..c531447 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 _0xd0ab=['result','catch','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message'];(function(_0xc88275,_0x5ea571){var _0x303c72=function(_0x32d068){while(--_0x32d068){_0xc88275['push'](_0xc88275['shift']());}};_0x303c72(++_0x5ea571);}(_0xd0ab,0x13f));var _0xbd0a=function(_0x583d1b,_0x3c33b9){_0x583d1b=_0x583d1b-0x0;var _0x5f10d8=_0xd0ab[_0x583d1b];return _0x5f10d8;};'use strict';var _=require('lodash');var util=require(_0xbd0a('0x0'));var moment=require('moment');var BPromise=require(_0xbd0a('0x1'));var rs=require(_0xbd0a('0x2'));var fs=require('fs');var Redis=require(_0xbd0a('0x3'));var db=require(_0xbd0a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbd0a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xbd0a('0x6')]['http']({'port':0x232a});config[_0xbd0a('0x7')]=_['defaults'](config[_0xbd0a('0x7')],{'host':_0xbd0a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd0a('0x7')]));require(_0xbd0a('0x9'))[_0xbd0a('0xa')](socket);function respondWithRpcPromise(_0x4ea438,_0x496790,_0x252637){return new BPromise(function(_0x38ff2f,_0x942b03){return client[_0xbd0a('0xb')](_0x4ea438,_0x252637)[_0xbd0a('0xc')](function(_0x4d9d39){logger[_0xbd0a('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x496790,_0xbd0a('0xe'));logger[_0xbd0a('0xf')](_0xbd0a('0x10'),_0x496790,_0xbd0a('0xe'),JSON['stringify'](_0x4d9d39));if(_0x4d9d39['error']){if(_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x12')]===0x1f4){logger[_0xbd0a('0x11')](_0xbd0a('0x13'),_0x496790,_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x14')]);return _0x942b03(_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x14')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x496790,_0x4d9d39[_0xbd0a('0x11')]['message']);return _0x38ff2f(_0x4d9d39[_0xbd0a('0x11')][_0xbd0a('0x14')]);}else{logger['info'](_0xbd0a('0x13'),_0x496790,_0xbd0a('0xe'));_0x38ff2f(_0x4d9d39[_0xbd0a('0x15')][_0xbd0a('0x14')]);}})[_0xbd0a('0x16')](function(_0x2da410){logger['error'](_0xbd0a('0x13'),_0x496790,_0x2da410);_0x942b03(_0x2da410);});});}exports['GetVoiceQueueRtPauses']=function(_0xb979d6){var _0x524c7d=this;return new Promise(function(_0x2dec61,_0x5c77de){return db[_0xbd0a('0x17')]['findAll']({'raw':_0xb979d6[_0xbd0a('0x18')]?_0xb979d6[_0xbd0a('0x18')][_0xbd0a('0x19')]===undefined?!![]:![]:!![],'where':_0xb979d6[_0xbd0a('0x18')]?_0xb979d6[_0xbd0a('0x18')][_0xbd0a('0x1a')]||null:null,'attributes':[[db[_0xbd0a('0x1b')]['fn'](_0xbd0a('0x1c'),db['sequelize']['fn']('IF',db[_0xbd0a('0x1b')][_0xbd0a('0x1d')](_0xbd0a('0x1e')))),_0xbd0a('0x1f')]]})[_0xbd0a('0xc')](function(_0x4ca38f){logger['info'](_0xbd0a('0x20'),_0xb979d6);logger['debug'](_0xbd0a('0x20'),_0xb979d6,JSON[_0xbd0a('0x21')](_0x4ca38f));_0x2dec61(_0x4ca38f);})[_0xbd0a('0x16')](function(_0x42be3a){logger['error'](_0xbd0a('0x20'),_0x42be3a[_0xbd0a('0x14')],_0xb979d6);_0x5c77de(_0x524c7d[_0xbd0a('0x11')](0x1f4,_0x42be3a[_0xbd0a('0x14')]));});});}; \ No newline at end of file +var _0xa618=['result','catch','UserVoiceQueueRt','findAll','raw','options','where','sequelize','literal','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','lodash','util','moment','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x71b37c,_0x45c57b){var _0x4e77b1=function(_0x3ea9d0){while(--_0x3ea9d0){_0x71b37c['push'](_0x71b37c['shift']());}};_0x4e77b1(++_0x45c57b);}(_0xa618,0x114));var _0x8a61=function(_0x4500ad,_0x5d9283){_0x4500ad=_0x4500ad-0x0;var _0x4e9512=_0xa618[_0x4500ad];return _0x4e9512;};'use strict';var _=require(_0x8a61('0x0'));var util=require(_0x8a61('0x1'));var moment=require(_0x8a61('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(_0x8a61('0x3'));var logger=require(_0x8a61('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a61('0x5'));var client=jayson[_0x8a61('0x6')]['http']({'port':0x232a});config[_0x8a61('0x7')]=_[_0x8a61('0x8')](config[_0x8a61('0x7')],{'host':_0x8a61('0x9'),'port':0x18eb});var socket=require(_0x8a61('0xa'))(new Redis(config[_0x8a61('0x7')]));require('./userVoiceQueueRt.socket')[_0x8a61('0xb')](socket);function respondWithRpcPromise(_0xa1e669,_0x51da06,_0x35c0ee){return new BPromise(function(_0x187297,_0x4cfd4f){return client[_0x8a61('0xc')](_0xa1e669,_0x35c0ee)['then'](function(_0x998c39){logger[_0x8a61('0xd')](_0x8a61('0xe'),_0x51da06,_0x8a61('0xf'));logger[_0x8a61('0x10')](_0x8a61('0x11'),_0x51da06,_0x8a61('0xf'),JSON['stringify'](_0x998c39));if(_0x998c39['error']){if(_0x998c39[_0x8a61('0x12')][_0x8a61('0x13')]===0x1f4){logger[_0x8a61('0x12')](_0x8a61('0xe'),_0x51da06,_0x998c39[_0x8a61('0x12')][_0x8a61('0x14')]);return _0x4cfd4f(_0x998c39[_0x8a61('0x12')]['message']);}logger[_0x8a61('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x51da06,_0x998c39[_0x8a61('0x12')]['message']);return _0x187297(_0x998c39['error'][_0x8a61('0x14')]);}else{logger['info'](_0x8a61('0xe'),_0x51da06,_0x8a61('0xf'));_0x187297(_0x998c39[_0x8a61('0x15')]['message']);}})[_0x8a61('0x16')](function(_0x489de5){logger[_0x8a61('0x12')](_0x8a61('0xe'),_0x51da06,_0x489de5);_0x4cfd4f(_0x489de5);});});}exports['GetVoiceQueueRtPauses']=function(_0xc339a){var _0x46bffb=this;return new Promise(function(_0x5d2ea1,_0x10e8a7){return db[_0x8a61('0x17')][_0x8a61('0x18')]({'raw':_0xc339a['options']?_0xc339a['options'][_0x8a61('0x19')]===undefined?!![]:![]:!![],'where':_0xc339a[_0x8a61('0x1a')]?_0xc339a[_0x8a61('0x1a')][_0x8a61('0x1b')]||null:null,'attributes':[[db[_0x8a61('0x1c')]['fn']('COUNT',db[_0x8a61('0x1c')]['fn']('IF',db['sequelize'][_0x8a61('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0x8a61('0x1e')]]})['then'](function(_0x577127){logger[_0x8a61('0xd')]('GetVoiceQueueRtPauses',_0xc339a);logger[_0x8a61('0x10')](_0x8a61('0x1f'),_0xc339a,JSON[_0x8a61('0x20')](_0x577127));_0x5d2ea1(_0x577127);})[_0x8a61('0x16')](function(_0x4ca78c){logger[_0x8a61('0x12')](_0x8a61('0x1f'),_0x4ca78c[_0x8a61('0x14')],_0xc339a);_0x10e8a7(_0x46bffb[_0x8a61('0x12')](0x1f4,_0x4ca78c['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 534027a..be92ce5 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 _0x2975=['update','removeListener','register','length','userVoiceQueueRt:','save','remove'];(function(_0x1937a2,_0x1bbffd){var _0x3347c7=function(_0x2021c3){while(--_0x2021c3){_0x1937a2['push'](_0x1937a2['shift']());}};_0x3347c7(++_0x1bbffd);}(_0x2975,0x1c5));var _0x5297=function(_0x1f80c8,_0x44ed21){_0x1f80c8=_0x1f80c8-0x0;var _0x867980=_0x2975[_0x1f80c8];return _0x867980;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x5297('0x0'),_0x5297('0x1'),_0x5297('0x2')];function createListener(_0x1a511b,_0x115e60){return function(_0x178801){_0x115e60['emit'](_0x1a511b,_0x178801);};}function removeListener(_0x56371f,_0x5e9de3){return function(){UserVoiceQueueRtEvents[_0x5297('0x3')](_0x56371f,_0x5e9de3);};}exports[_0x5297('0x4')]=function(_0x11a43d){for(var _0x3da9c6=0x0,_0x4d1d2c=events[_0x5297('0x5')];_0x3da9c6<_0x4d1d2c;_0x3da9c6++){var _0x1b72a7=events[_0x3da9c6];var _0x4f12b0=createListener(_0x5297('0x6')+_0x1b72a7,_0x11a43d);UserVoiceQueueRtEvents['on'](_0x1b72a7,_0x4f12b0);}}; \ No newline at end of file +var _0x64f5=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','emit'];(function(_0x3f8647,_0x39c233){var _0x39d095=function(_0x367490){while(--_0x367490){_0x3f8647['push'](_0x3f8647['shift']());}};_0x39d095(++_0x39c233);}(_0x64f5,0x17e));var _0x564f=function(_0x96bd45,_0x252f0c){_0x96bd45=_0x96bd45-0x0;var _0x23dcaf=_0x64f5[_0x96bd45];return _0x23dcaf;};'use strict';var UserVoiceQueueRtEvents=require(_0x564f('0x0'));var events=['save','remove','update'];function createListener(_0x39903b,_0x493091){return function(_0x2e7142){_0x493091[_0x564f('0x1')](_0x39903b,_0x2e7142);};}function removeListener(_0x59c424,_0x2607d6){return function(){UserVoiceQueueRtEvents[_0x564f('0x2')](_0x59c424,_0x2607d6);};}exports[_0x564f('0x3')]=function(_0x72b009){for(var _0x4bbedf=0x0,_0x4d3dae=events[_0x564f('0x4')];_0x4bbedf<_0x4d3dae;_0x4bbedf++){var _0x28db5a=events[_0x4bbedf];var _0x275bd6=createListener(_0x564f('0x5')+_0x28db5a,_0x72b009);UserVoiceQueueRtEvents['on'](_0x28db5a,_0x275bd6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index c0a9fc3..509c589 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x470d59,_0x2d6c72){var _0x48d24b=function(_0x1ebd42){while(--_0x1ebd42){_0x470d59['push'](_0x470d59['shift']());}};_0x48d24b(++_0x2d6c72);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x39b51a,_0x5ac56c){var _0x52eeef=function(_0x5112a6){while(--_0x5112a6){_0x39b51a['push'](_0x39b51a['shift']());}};_0x52eeef(++_0x5ac56c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xcb91[_0x498334];return _0x13bb70;};'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 fbdee9f..3327b0b 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 _0xfeec=['INTEGER','sequelize'];(function(_0x1b1c33,_0x3a6eb4){var _0x5a133a=function(_0x5dfdd9){while(--_0x5dfdd9){_0x1b1c33['push'](_0x1b1c33['shift']());}};_0x5a133a(++_0x3a6eb4);}(_0xfeec,0xd9));var _0xcfee=function(_0x35f60f,_0x4a4e98){_0x35f60f=_0x35f60f-0x0;var _0x37cb4a=_0xfeec[_0x35f60f];return _0x37cb4a;};'use strict';var Sequelize=require(_0xcfee('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcfee('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f1f=['sequelize','exports'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x5f1f,0x1a0));var _0xf5f1=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x5f1f[_0x326e79];return _0x37eb89;};'use strict';var Sequelize=require(_0xf5f1('0x0'));module[_0xf5f1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 e993f3e..8852748 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 _0xd028=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x170db7,_0x3652df){var _0x13cc2c=function(_0x3149b3){while(--_0x3149b3){_0x170db7['push'](_0x170db7['shift']());}};_0x13cc2c(++_0x3652df);}(_0xd028,0xd0));var _0x8d02=function(_0x5a3fa5,_0x31f617){_0x5a3fa5=_0x5a3fa5-0x0;var _0x3bd85d=_0xd028[_0x5a3fa5];return _0x3bd85d;};'use strict';var _=require('lodash');var util=require(_0x8d02('0x0'));var logger=require(_0x8d02('0x1'))(_0x8d02('0x2'));var moment=require(_0x8d02('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d02('0x4'));var fs=require('fs');var path=require(_0x8d02('0x5'));var rimraf=require(_0x8d02('0x6'));var config=require(_0x8d02('0x7'));var attributes=require(_0x8d02('0x8'));module[_0x8d02('0x9')]=function(_0x41d77b,_0x496826){return _0x41d77b[_0x8d02('0xa')](_0x8d02('0xb'),attributes,{'tableName':_0x8d02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a66=['../../config/logger','api','moment','bluebird','path','rimraf','./userWhatsappQueue.attributes','user_has_whatsapp_queues','lodash','util'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2a66,0x152));var _0x62a6=function(_0x491fbc,_0x1a708a){_0x491fbc=_0x491fbc-0x0;var _0x2559d7=_0x2a66[_0x491fbc];return _0x2559d7;};'use strict';var _=require(_0x62a6('0x0'));var util=require(_0x62a6('0x1'));var logger=require(_0x62a6('0x2'))(_0x62a6('0x3'));var moment=require(_0x62a6('0x4'));var BPromise=require(_0x62a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62a6('0x6'));var rimraf=require(_0x62a6('0x7'));var config=require('../../config/environment');var attributes=require(_0x62a6('0x8'));module['exports']=function(_0x1dc4ce,_0xc169e3){return _0x1dc4ce['define']('UserWhatsappQueue',attributes,{'tableName':_0x62a6('0x9'),'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 01b6b8b..9e5ccd5 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 _0x9f3e=['stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x25d2fa,_0x1d35c6){var _0x42d4aa=function(_0x590383){while(--_0x590383){_0x25d2fa['push'](_0x25d2fa['shift']());}};_0x42d4aa(++_0x1d35c6);}(_0x9f3e,0xed));var _0xe9f3=function(_0x137106,_0x1c47ef){_0x137106=_0x137106-0x0;var _0x9fc4f5=_0x9f3e[_0x137106];return _0x9fc4f5;};'use strict';var _=require(_0xe9f3('0x0'));var util=require(_0xe9f3('0x1'));var moment=require(_0xe9f3('0x2'));var BPromise=require(_0xe9f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9f3('0x5'));var logger=require(_0xe9f3('0x6'))('rpc');var config=require(_0xe9f3('0x7'));var jayson=require(_0xe9f3('0x8'));var client=jayson[_0xe9f3('0x9')][_0xe9f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2859,_0x2ae7df,_0x43e300){return new BPromise(function(_0x2d9204,_0x2077c0){return client[_0xe9f3('0xb')](_0x3e2859,_0x43e300)[_0xe9f3('0xc')](function(_0x51e000){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x2ae7df,_0xe9f3('0xd'));logger[_0xe9f3('0xe')](_0xe9f3('0xf'),_0x2ae7df,_0xe9f3('0xd'),JSON[_0xe9f3('0x10')](_0x51e000));if(_0x51e000[_0xe9f3('0x11')]){if(_0x51e000['error'][_0xe9f3('0x12')]===0x1f4){logger[_0xe9f3('0x11')](_0xe9f3('0x13'),_0x2ae7df,_0x51e000[_0xe9f3('0x11')][_0xe9f3('0x14')]);return _0x2077c0(_0x51e000[_0xe9f3('0x11')][_0xe9f3('0x14')]);}logger[_0xe9f3('0x11')](_0xe9f3('0x13'),_0x2ae7df,_0x51e000['error'][_0xe9f3('0x14')]);return _0x2d9204(_0x51e000[_0xe9f3('0x11')]['message']);}else{logger[_0xe9f3('0x15')](_0xe9f3('0x13'),_0x2ae7df,_0xe9f3('0xd'));_0x2d9204(_0x51e000[_0xe9f3('0x16')][_0xe9f3('0x14')]);}})['catch'](function(_0x17640e){logger[_0xe9f3('0x11')](_0xe9f3('0x13'),_0x2ae7df,_0x17640e);_0x2077c0(_0x17640e);});});} \ No newline at end of file +var _0xf5cb=['client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x44dfd8,_0x3e8caa){var _0x1ec3ef=function(_0x3f3b0b){while(--_0x3f3b0b){_0x44dfd8['push'](_0x44dfd8['shift']());}};_0x1ec3ef(++_0x3e8caa);}(_0xf5cb,0x17d));var _0xbf5c=function(_0x33f609,_0x49e952){_0x33f609=_0x33f609-0x0;var _0x4d8062=_0xf5cb[_0x33f609];return _0x4d8062;};'use strict';var _=require(_0xbf5c('0x0'));var util=require(_0xbf5c('0x1'));var moment=require(_0xbf5c('0x2'));var BPromise=require(_0xbf5c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf5c('0x4'));var db=require(_0xbf5c('0x5'))['db'];var utils=require(_0xbf5c('0x6'));var logger=require('../../config/logger')(_0xbf5c('0x7'));var config=require(_0xbf5c('0x8'));var jayson=require(_0xbf5c('0x9'));var client=jayson[_0xbf5c('0xa')][_0xbf5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc4e1,_0x32051d,_0xfdc356){return new BPromise(function(_0xf81a71,_0x41a96c){return client['request'](_0x3bc4e1,_0xfdc356)[_0xbf5c('0xc')](function(_0x22f1ed){logger[_0xbf5c('0xd')](_0xbf5c('0xe'),_0x32051d,_0xbf5c('0xf'));logger[_0xbf5c('0x10')](_0xbf5c('0x11'),_0x32051d,'request\x20sent',JSON[_0xbf5c('0x12')](_0x22f1ed));if(_0x22f1ed[_0xbf5c('0x13')]){if(_0x22f1ed['error'][_0xbf5c('0x14')]===0x1f4){logger[_0xbf5c('0x13')](_0xbf5c('0xe'),_0x32051d,_0x22f1ed[_0xbf5c('0x13')]['message']);return _0x41a96c(_0x22f1ed['error'][_0xbf5c('0x15')]);}logger[_0xbf5c('0x13')](_0xbf5c('0xe'),_0x32051d,_0x22f1ed['error'][_0xbf5c('0x15')]);return _0xf81a71(_0x22f1ed[_0xbf5c('0x13')][_0xbf5c('0x15')]);}else{logger[_0xbf5c('0xd')](_0xbf5c('0xe'),_0x32051d,_0xbf5c('0xf'));_0xf81a71(_0x22f1ed['result'][_0xbf5c('0x15')]);}})[_0xbf5c('0x16')](function(_0x461dcd){logger[_0xbf5c('0x13')](_0xbf5c('0xe'),_0x32051d,_0x461dcd);_0x41a96c(_0x461dcd);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e5f6e52..dd49845 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 _0x2f72=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x32ca0b,_0x49c78b){var _0x1587bd=function(_0x2ca8fe){while(--_0x2ca8fe){_0x32ca0b['push'](_0x32ca0b['shift']());}};_0x1587bd(++_0x49c78b);}(_0x2f72,0x166));var _0x22f7=function(_0x4dfc5c,_0x43df75){_0x4dfc5c=_0x4dfc5c-0x0;var _0x3e7b9a=_0x2f72[_0x4dfc5c];return _0x3e7b9a;};'use strict';var multer=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var path=require(_0x22f7('0x2'));var timeout=require(_0x22f7('0x3'));var express=require(_0x22f7('0x4'));var router=express[_0x22f7('0x5')]();var fs_extra=require(_0x22f7('0x6'));var auth=require(_0x22f7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x22f7('0x8'));var controller=require(_0x22f7('0x9'));router[_0x22f7('0xa')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0xc')]);router[_0x22f7('0xa')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0xe')]);router[_0x22f7('0xf')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0x10')]);router[_0x22f7('0x11')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0x12')]);router['delete'](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller['destroy']);module[_0x22f7('0x13')]=router; \ No newline at end of file +var _0x9ade=['/:id','show','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','./variable.controller','get','isAuthenticated','index'];(function(_0x421a8b,_0x3888a5){var _0x4ff042=function(_0x5423cb){while(--_0x5423cb){_0x421a8b['push'](_0x421a8b['shift']());}};_0x4ff042(++_0x3888a5);}(_0x9ade,0x107));var _0xe9ad=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x9ade[_0x1597e2];return _0x4c8c0a;};'use strict';var multer=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe9ad('0x2'));var router=express['Router']();var fs_extra=require(_0xe9ad('0x3'));var auth=require(_0xe9ad('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe9ad('0x5'));router[_0xe9ad('0x6')]('/',auth[_0xe9ad('0x7')](),controller[_0xe9ad('0x8')]);router[_0xe9ad('0x6')](_0xe9ad('0x9'),auth[_0xe9ad('0x7')](),controller[_0xe9ad('0xa')]);router['post']('/',auth[_0xe9ad('0x7')](),controller[_0xe9ad('0xb')]);router[_0xe9ad('0xc')](_0xe9ad('0x9'),auth[_0xe9ad('0x7')](),controller[_0xe9ad('0xd')]);router[_0xe9ad('0xe')](_0xe9ad('0x9'),auth[_0xe9ad('0x7')](),controller[_0xe9ad('0xf')]);module[_0xe9ad('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 02a11b2..1248c31 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 _0x1a28=['STRING','name','sequelize','exports'];(function(_0xa5b0c1,_0x2273f5){var _0x564872=function(_0x3e0f02){while(--_0x3e0f02){_0xa5b0c1['push'](_0xa5b0c1['shift']());}};_0x564872(++_0x2273f5);}(_0x1a28,0x10e));var _0x81a2=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x1a28[_0x4ec7f2];return _0x118004;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'name':{'type':Sequelize[_0x81a2('0x2')],'unique':_0x81a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x81a2('0x2')]}}; \ No newline at end of file +var _0x71a1=['STRING','name','sequelize','exports'];(function(_0x516029,_0x1d96d0){var _0x1244b4=function(_0x49e9d2){while(--_0x49e9d2){_0x516029['push'](_0x516029['shift']());}};_0x1244b4(++_0x1d96d0);}(_0x71a1,0xfa));var _0x171a=function(_0xc760dd,_0x52353a){_0xc760dd=_0xc760dd-0x0;var _0x3848ad=_0x71a1[_0xc760dd];return _0x3848ad;};'use strict';var Sequelize=require(_0x171a('0x0'));module[_0x171a('0x1')]={'name':{'type':Sequelize[_0x171a('0x2')],'unique':_0x171a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x171a('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d4e3ea6..c79092d 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 _0xd667=['lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x526a39,_0x4d63f9){var _0x396733=function(_0x440f12){while(--_0x440f12){_0x526a39['push'](_0x526a39['shift']());}};_0x396733(++_0x4d63f9);}(_0xd667,0x94));var _0x7d66=function(_0x52c72f,_0x818765){_0x52c72f=_0x52c72f-0x0;var _0x3e0249=_0xd667[_0x52c72f];return _0x3e0249;};'use strict';var emlformat=require(_0x7d66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d66('0x1'));var jsonpatch=require(_0x7d66('0x2'));var rp=require(_0x7d66('0x3'));var moment=require(_0x7d66('0x4'));var BPromise=require(_0x7d66('0x5'));var Mustache=require(_0x7d66('0x6'));var util=require(_0x7d66('0x7'));var path=require(_0x7d66('0x8'));var sox=require('sox');var csv=require(_0x7d66('0x9'));var ejs=require(_0x7d66('0xa'));var fs=require('fs');var fs_extra=require(_0x7d66('0xb'));var _=require(_0x7d66('0xc'));var squel=require(_0x7d66('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d66('0xe'));var toCsv=require(_0x7d66('0x9'));var querystring=require('querystring');var Papa=require(_0x7d66('0xf'));var Redis=require(_0x7d66('0x10'));var authService=require(_0x7d66('0x11'));var qs=require(_0x7d66('0x12'));var as=require(_0x7d66('0x13'));var hardwareService=require(_0x7d66('0x14'));var logger=require(_0x7d66('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7d66('0x16'));var licenseUtil=require(_0x7d66('0x17'));var db=require(_0x7d66('0x18'))['db'];function respondWithStatusCode(_0x580a2c,_0x3fcf7c){_0x3fcf7c=_0x3fcf7c||0xcc;return function(_0xdf2bc0){if(_0xdf2bc0){return _0x580a2c[_0x7d66('0x19')](_0x3fcf7c);}return _0x580a2c[_0x7d66('0x1a')](_0x3fcf7c)[_0x7d66('0x1b')]();};}function respondWithResult(_0x306510,_0x38686a){_0x38686a=_0x38686a||0xc8;return function(_0x57fe20){if(_0x57fe20){return _0x306510['status'](_0x38686a)['json'](_0x57fe20);}};}function respondWithFilteredResult(_0xd3a930,_0x77acd9){return function(_0x371066){if(_0x371066){var _0x5eae1a=typeof _0x77acd9[_0x7d66('0x1c')]===_0x7d66('0x1d')&&typeof _0x77acd9[_0x7d66('0x1e')]===_0x7d66('0x1d');var _0x476869=_0x371066[_0x7d66('0x1f')];var _0xaacfb4=_0x5eae1a?0x0:_0x77acd9[_0x7d66('0x1c')];var _0x54d54d=_0x5eae1a?_0x371066[_0x7d66('0x1f')]:_0x77acd9['offset']+_0x77acd9[_0x7d66('0x1e')];var _0x4a2537;if(_0x54d54d>=_0x476869){_0x54d54d=_0x476869;_0x4a2537=0xc8;}else{_0x4a2537=0xce;}_0xd3a930[_0x7d66('0x1a')](_0x4a2537);return _0xd3a930[_0x7d66('0x20')]('Content-Range',_0xaacfb4+'-'+_0x54d54d+'/'+_0x476869)[_0x7d66('0x21')](_0x371066);}return null;};}function patchUpdates(_0x2a85b7){return function(_0x1d0e3f){try{jsonpatch[_0x7d66('0x22')](_0x1d0e3f,_0x2a85b7,!![]);}catch(_0x2df9cb){return BPromise[_0x7d66('0x23')](_0x2df9cb);}return _0x1d0e3f[_0x7d66('0x24')]();};}function saveUpdates(_0x33ffaa,_0xe4b502){return function(_0x30886f){if(_0x30886f){return _0x30886f[_0x7d66('0x25')](_0x33ffaa)[_0x7d66('0x26')](function(_0x424327){return _0x424327;});}return null;};}function removeEntity(_0xe30628,_0xeaf1ec){return function(_0x4dd693){if(_0x4dd693){return _0x4dd693[_0x7d66('0x27')]()[_0x7d66('0x26')](function(){var _0x34fbfd=_0x4dd693['get']({'plain':!![]});var _0x1fe366='Variables';return db['UserProfileResource'][_0x7d66('0x27')]({'where':{'type':_0x1fe366,'resourceId':_0x34fbfd['id']}})[_0x7d66('0x26')](function(){return _0x4dd693;});})[_0x7d66('0x26')](function(){_0xe30628[_0x7d66('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45abf7,_0x27739c){return function(_0x49c9bb){if(!_0x49c9bb){_0x45abf7['sendStatus'](0x194);}return _0x49c9bb;};}function handleError(_0x40044f,_0x43b2d6){_0x43b2d6=_0x43b2d6||0x1f4;return function(_0x31d418){logger[_0x7d66('0x28')](_0x31d418[_0x7d66('0x29')]);if(_0x31d418[_0x7d66('0x2a')]){delete _0x31d418[_0x7d66('0x2a')];}_0x40044f[_0x7d66('0x1a')](_0x43b2d6)['send'](_0x31d418);};}exports['index']=function(_0x2f4db6,_0x840bc6){var _0x353c12={},_0x344bb3={},_0x2648ba={'count':0x0,'rows':[]};var _0x56fa8a=_[_0x7d66('0x2b')](db[_0x7d66('0x2c')][_0x7d66('0x2d')],function(_0x4242f9){return{'name':_0x4242f9[_0x7d66('0x2e')],'type':_0x4242f9[_0x7d66('0x2f')]['key']};});_0x344bb3[_0x7d66('0x30')]=_['map'](_0x56fa8a,_0x7d66('0x2a'));_0x344bb3[_0x7d66('0x31')]=_[_0x7d66('0x32')](_0x2f4db6[_0x7d66('0x31')]);_0x344bb3[_0x7d66('0x33')]=_['intersection'](_0x344bb3[_0x7d66('0x30')],_0x344bb3['query']);_0x353c12[_0x7d66('0x34')]=_[_0x7d66('0x35')](_0x344bb3[_0x7d66('0x30')],qs[_0x7d66('0x36')](_0x2f4db6['query'][_0x7d66('0x36')]));_0x353c12[_0x7d66('0x34')]=_0x353c12[_0x7d66('0x34')]['length']?_0x353c12[_0x7d66('0x34')]:_0x344bb3[_0x7d66('0x30')];if(!_0x2f4db6['query'][_0x7d66('0x37')]('nolimit')){_0x353c12['limit']=qs[_0x7d66('0x1e')](_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x1e')]);_0x353c12[_0x7d66('0x1c')]=qs[_0x7d66('0x1c')](_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x1c')]);}_0x353c12[_0x7d66('0x38')]=qs[_0x7d66('0x39')](_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x39')]);_0x353c12['where']=qs[_0x7d66('0x33')](_[_0x7d66('0x3a')](_0x2f4db6['query'],_0x344bb3['filters']),_0x56fa8a);if(_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x3b')]){_0x353c12[_0x7d66('0x3c')]=_[_0x7d66('0x3d')](_0x353c12['where'],{'$or':_[_0x7d66('0x2b')](_0x56fa8a,function(_0x67ac58){if(_0x67ac58[_0x7d66('0x2f')]!=='VIRTUAL'){var _0x2e6fd8={};_0x2e6fd8[_0x67ac58['name']]={'$like':'%'+_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x3b')]+'%'};return _0x2e6fd8;}})});}_0x353c12=_[_0x7d66('0x3d')]({},_0x353c12,_0x2f4db6[_0x7d66('0x3e')]);var _0x32adf1={'where':_0x353c12[_0x7d66('0x3c')]};return db[_0x7d66('0x2c')][_0x7d66('0x1f')](_0x32adf1)[_0x7d66('0x26')](function(_0x3b4eee){_0x2648ba['count']=_0x3b4eee;if(_0x2f4db6[_0x7d66('0x31')][_0x7d66('0x3f')]){_0x353c12[_0x7d66('0x40')]=[{'all':!![]}];}return db[_0x7d66('0x2c')]['findAll'](_0x353c12);})[_0x7d66('0x26')](function(_0x29a1d8){_0x2648ba[_0x7d66('0x41')]=_0x29a1d8;return _0x2648ba;})[_0x7d66('0x26')](respondWithFilteredResult(_0x840bc6,_0x353c12))[_0x7d66('0x42')](handleError(_0x840bc6,null));};exports['show']=function(_0x3f24b2,_0x5b6dd1){var _0x405c16={'raw':!![],'where':{'id':_0x3f24b2['params']['id']}},_0x982a0={};_0x982a0[_0x7d66('0x30')]=_[_0x7d66('0x32')](db[_0x7d66('0x2c')]['rawAttributes']);_0x982a0[_0x7d66('0x31')]=_[_0x7d66('0x32')](_0x3f24b2[_0x7d66('0x31')]);_0x982a0['filters']=_[_0x7d66('0x35')](_0x982a0[_0x7d66('0x30')],_0x982a0[_0x7d66('0x31')]);_0x405c16[_0x7d66('0x34')]=_[_0x7d66('0x35')](_0x982a0[_0x7d66('0x30')],qs['fields'](_0x3f24b2['query']['fields']));_0x405c16[_0x7d66('0x34')]=_0x405c16[_0x7d66('0x34')][_0x7d66('0x43')]?_0x405c16[_0x7d66('0x34')]:_0x982a0[_0x7d66('0x30')];if(_0x3f24b2['query']['includeAll']){_0x405c16[_0x7d66('0x40')]=[{'all':!![]}];}_0x405c16=_[_0x7d66('0x3d')]({},_0x405c16,_0x3f24b2[_0x7d66('0x3e')]);return db[_0x7d66('0x2c')][_0x7d66('0x44')](_0x405c16)[_0x7d66('0x26')](handleEntityNotFound(_0x5b6dd1,null))['then'](respondWithResult(_0x5b6dd1,null))['catch'](handleError(_0x5b6dd1,null));};exports[_0x7d66('0x45')]=function(_0x3cf7d1,_0x54b70){return db[_0x7d66('0x2c')][_0x7d66('0x45')](_0x3cf7d1['body'],{})[_0x7d66('0x26')](function(_0xf6c24f){var _0x3758fd=_0x3cf7d1[_0x7d66('0x46')][_0x7d66('0x47')]({'plain':!![]});if(!_0x3758fd)throw new Error(_0x7d66('0x48'));if(_0x3758fd[_0x7d66('0x49')]===_0x7d66('0x46')){var _0x754b57=_0xf6c24f[_0x7d66('0x47')]({'plain':!![]});var _0x363b82=_0x7d66('0x4a');return db[_0x7d66('0x4b')][_0x7d66('0x44')]({'where':{'name':_0x363b82,'userProfileId':_0x3758fd[_0x7d66('0x4c')]},'raw':!![]})['then'](function(_0x4f74a3){if(_0x4f74a3&&_0x4f74a3[_0x7d66('0x4d')]===0x0){return db['UserProfileResource'][_0x7d66('0x45')]({'name':_0x754b57[_0x7d66('0x2a')],'resourceId':_0x754b57['id'],'type':_0x4f74a3['name'],'sectionId':_0x4f74a3['id']},{})['then'](function(){return _0xf6c24f;});}else{return _0xf6c24f;}})[_0x7d66('0x42')](function(_0x5a198a){logger[_0x7d66('0x28')](_0x7d66('0x4e'),_0x5a198a);throw _0x5a198a;});}return _0xf6c24f;})[_0x7d66('0x26')](respondWithResult(_0x54b70,0xc9))['catch'](handleError(_0x54b70,null));};exports[_0x7d66('0x25')]=function(_0x3cb9c1,_0x189530){if(_0x3cb9c1[_0x7d66('0x4f')]['id']){delete _0x3cb9c1[_0x7d66('0x4f')]['id'];}return db[_0x7d66('0x2c')][_0x7d66('0x44')]({'where':{'id':_0x3cb9c1['params']['id']}})['then'](handleEntityNotFound(_0x189530,null))['then'](saveUpdates(_0x3cb9c1[_0x7d66('0x4f')],null))[_0x7d66('0x26')](respondWithResult(_0x189530,null))[_0x7d66('0x42')](handleError(_0x189530,null));};exports['destroy']=function(_0x3e81d7,_0x343871){return db[_0x7d66('0x2c')]['find']({'where':{'id':_0x3e81d7['params']['id']}})[_0x7d66('0x26')](handleEntityNotFound(_0x343871,null))['then'](removeEntity(_0x343871,null))[_0x7d66('0x42')](handleError(_0x343871,null));}; \ No newline at end of file +var _0x194a=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x41bd33,_0x8dd533){var _0x1ef83a=function(_0x5821aa){while(--_0x5821aa){_0x41bd33['push'](_0x41bd33['shift']());}};_0x1ef83a(++_0x8dd533);}(_0x194a,0xe7));var _0xa194=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x194a[_0x588011];return _0x3b3773;};'use strict';var emlformat=require(_0xa194('0x0'));var rimraf=require(_0xa194('0x1'));var zipdir=require(_0xa194('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa194('0x3'));var moment=require(_0xa194('0x4'));var BPromise=require(_0xa194('0x5'));var Mustache=require(_0xa194('0x6'));var util=require(_0xa194('0x7'));var path=require(_0xa194('0x8'));var sox=require(_0xa194('0x9'));var csv=require(_0xa194('0xa'));var ejs=require(_0xa194('0xb'));var fs=require('fs');var fs_extra=require(_0xa194('0xc'));var _=require('lodash');var squel=require(_0xa194('0xd'));var crypto=require(_0xa194('0xe'));var jsforce=require(_0xa194('0xf'));var deskjs=require(_0xa194('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa194('0x11'));var Papa=require('papaparse');var Redis=require(_0xa194('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa194('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa194('0x14'))(_0xa194('0x15'));var utils=require(_0xa194('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa194('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18bbdd,_0x476299){_0x476299=_0x476299||0xcc;return function(_0x49088b){if(_0x49088b){return _0x18bbdd[_0xa194('0x18')](_0x476299);}return _0x18bbdd[_0xa194('0x19')](_0x476299)[_0xa194('0x1a')]();};}function respondWithResult(_0x27dce9,_0x38885e){_0x38885e=_0x38885e||0xc8;return function(_0x3b0a58){if(_0x3b0a58){return _0x27dce9[_0xa194('0x19')](_0x38885e)[_0xa194('0x1b')](_0x3b0a58);}};}function respondWithFilteredResult(_0x5d39a3,_0x46f713){return function(_0x5f23b0){if(_0x5f23b0){var _0x426db1=typeof _0x46f713[_0xa194('0x1c')]===_0xa194('0x1d')&&typeof _0x46f713[_0xa194('0x1e')]===_0xa194('0x1d');var _0x5aca93=_0x5f23b0['count'];var _0x53d0a4=_0x426db1?0x0:_0x46f713[_0xa194('0x1c')];var _0x59249e=_0x426db1?_0x5f23b0[_0xa194('0x1f')]:_0x46f713[_0xa194('0x1c')]+_0x46f713[_0xa194('0x1e')];var _0x492fa6;if(_0x59249e>=_0x5aca93){_0x59249e=_0x5aca93;_0x492fa6=0xc8;}else{_0x492fa6=0xce;}_0x5d39a3[_0xa194('0x19')](_0x492fa6);return _0x5d39a3[_0xa194('0x20')](_0xa194('0x21'),_0x53d0a4+'-'+_0x59249e+'/'+_0x5aca93)[_0xa194('0x1b')](_0x5f23b0);}return null;};}function patchUpdates(_0x497f1d){return function(_0x15ab13){try{jsonpatch[_0xa194('0x22')](_0x15ab13,_0x497f1d,!![]);}catch(_0x3e97dc){return BPromise[_0xa194('0x23')](_0x3e97dc);}return _0x15ab13['save']();};}function saveUpdates(_0x29be4b,_0x589134){return function(_0x5af25b){if(_0x5af25b){return _0x5af25b[_0xa194('0x24')](_0x29be4b)[_0xa194('0x25')](function(_0x14e46a){return _0x14e46a;});}return null;};}function removeEntity(_0x2ad550,_0x3e76f4){return function(_0x220c33){if(_0x220c33){return _0x220c33[_0xa194('0x26')]()[_0xa194('0x25')](function(){var _0x237982=_0x220c33[_0xa194('0x27')]({'plain':!![]});var _0x10e4ee=_0xa194('0x28');return db[_0xa194('0x29')][_0xa194('0x26')]({'where':{'type':_0x10e4ee,'resourceId':_0x237982['id']}})['then'](function(){return _0x220c33;});})[_0xa194('0x25')](function(){_0x2ad550[_0xa194('0x19')](0xcc)[_0xa194('0x1a')]();});}};}function handleEntityNotFound(_0xd2e367,_0x57032f){return function(_0x4a69e8){if(!_0x4a69e8){_0xd2e367[_0xa194('0x18')](0x194);}return _0x4a69e8;};}function handleError(_0x5d8a3c,_0x44e9d8){_0x44e9d8=_0x44e9d8||0x1f4;return function(_0x50b9e6){logger['error'](_0x50b9e6[_0xa194('0x2a')]);if(_0x50b9e6[_0xa194('0x2b')]){delete _0x50b9e6[_0xa194('0x2b')];}_0x5d8a3c[_0xa194('0x19')](_0x44e9d8)[_0xa194('0x2c')](_0x50b9e6);};}exports[_0xa194('0x2d')]=function(_0x3aa4b4,_0x1d9e25){var _0x4093b8={},_0x101652={},_0x520910={'count':0x0,'rows':[]};var _0x1184af=_[_0xa194('0x2e')](db[_0xa194('0x2f')]['rawAttributes'],function(_0x48d524){return{'name':_0x48d524['fieldName'],'type':_0x48d524['type'][_0xa194('0x30')]};});_0x101652[_0xa194('0x31')]=_[_0xa194('0x2e')](_0x1184af,_0xa194('0x2b'));_0x101652[_0xa194('0x32')]=_[_0xa194('0x33')](_0x3aa4b4['query']);_0x101652[_0xa194('0x34')]=_['intersection'](_0x101652[_0xa194('0x31')],_0x101652[_0xa194('0x32')]);_0x4093b8['attributes']=_['intersection'](_0x101652[_0xa194('0x31')],qs[_0xa194('0x35')](_0x3aa4b4[_0xa194('0x32')][_0xa194('0x35')]));_0x4093b8[_0xa194('0x36')]=_0x4093b8[_0xa194('0x36')][_0xa194('0x37')]?_0x4093b8['attributes']:_0x101652[_0xa194('0x31')];if(!_0x3aa4b4['query']['hasOwnProperty'](_0xa194('0x38'))){_0x4093b8[_0xa194('0x1e')]=qs[_0xa194('0x1e')](_0x3aa4b4[_0xa194('0x32')]['limit']);_0x4093b8[_0xa194('0x1c')]=qs[_0xa194('0x1c')](_0x3aa4b4[_0xa194('0x32')][_0xa194('0x1c')]);}_0x4093b8[_0xa194('0x39')]=qs['sort'](_0x3aa4b4[_0xa194('0x32')][_0xa194('0x3a')]);_0x4093b8[_0xa194('0x3b')]=qs[_0xa194('0x34')](_[_0xa194('0x3c')](_0x3aa4b4['query'],_0x101652[_0xa194('0x34')]),_0x1184af);if(_0x3aa4b4[_0xa194('0x32')][_0xa194('0x3d')]){_0x4093b8['where']=_[_0xa194('0x3e')](_0x4093b8[_0xa194('0x3b')],{'$or':_[_0xa194('0x2e')](_0x1184af,function(_0x2ab3cc){if(_0x2ab3cc[_0xa194('0x3f')]!=='VIRTUAL'){var _0x341297={};_0x341297[_0x2ab3cc[_0xa194('0x2b')]]={'$like':'%'+_0x3aa4b4[_0xa194('0x32')][_0xa194('0x3d')]+'%'};return _0x341297;}})});}_0x4093b8=_[_0xa194('0x3e')]({},_0x4093b8,_0x3aa4b4[_0xa194('0x40')]);var _0x1938aa={'where':_0x4093b8[_0xa194('0x3b')]};return db[_0xa194('0x2f')][_0xa194('0x1f')](_0x1938aa)[_0xa194('0x25')](function(_0x1bec27){_0x520910[_0xa194('0x1f')]=_0x1bec27;if(_0x3aa4b4[_0xa194('0x32')][_0xa194('0x41')]){_0x4093b8['include']=[{'all':!![]}];}return db['Variable'][_0xa194('0x42')](_0x4093b8);})[_0xa194('0x25')](function(_0x30d5a0){_0x520910[_0xa194('0x43')]=_0x30d5a0;return _0x520910;})[_0xa194('0x25')](respondWithFilteredResult(_0x1d9e25,_0x4093b8))[_0xa194('0x44')](handleError(_0x1d9e25,null));};exports[_0xa194('0x45')]=function(_0x111089,_0x5a6d6e){var _0x103303={'raw':!![],'where':{'id':_0x111089['params']['id']}},_0x124194={};_0x124194['model']=_[_0xa194('0x33')](db['Variable']['rawAttributes']);_0x124194[_0xa194('0x32')]=_[_0xa194('0x33')](_0x111089[_0xa194('0x32')]);_0x124194[_0xa194('0x34')]=_[_0xa194('0x46')](_0x124194[_0xa194('0x31')],_0x124194[_0xa194('0x32')]);_0x103303[_0xa194('0x36')]=_[_0xa194('0x46')](_0x124194[_0xa194('0x31')],qs['fields'](_0x111089[_0xa194('0x32')][_0xa194('0x35')]));_0x103303[_0xa194('0x36')]=_0x103303[_0xa194('0x36')][_0xa194('0x37')]?_0x103303[_0xa194('0x36')]:_0x124194[_0xa194('0x31')];if(_0x111089[_0xa194('0x32')][_0xa194('0x41')]){_0x103303[_0xa194('0x47')]=[{'all':!![]}];}_0x103303=_[_0xa194('0x3e')]({},_0x103303,_0x111089[_0xa194('0x40')]);return db[_0xa194('0x2f')][_0xa194('0x48')](_0x103303)['then'](handleEntityNotFound(_0x5a6d6e,null))[_0xa194('0x25')](respondWithResult(_0x5a6d6e,null))[_0xa194('0x44')](handleError(_0x5a6d6e,null));};exports['create']=function(_0x2920f0,_0x11a9c0){return db['Variable'][_0xa194('0x49')](_0x2920f0[_0xa194('0x4a')],{})['then'](function(_0x5af619){var _0x1da97e=_0x2920f0[_0xa194('0x4b')]['get']({'plain':!![]});if(!_0x1da97e)throw new Error(_0xa194('0x4c'));if(_0x1da97e[_0xa194('0x4d')]==='user'){var _0x3ccf5c=_0x5af619['get']({'plain':!![]});var _0x2774b6=_0xa194('0x28');return db[_0xa194('0x4e')][_0xa194('0x48')]({'where':{'name':_0x2774b6,'userProfileId':_0x1da97e[_0xa194('0x4f')]},'raw':!![]})['then'](function(_0x1b06c6){if(_0x1b06c6&&_0x1b06c6[_0xa194('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x3ccf5c['name'],'resourceId':_0x3ccf5c['id'],'type':_0x1b06c6[_0xa194('0x2b')],'sectionId':_0x1b06c6['id']},{})['then'](function(){return _0x5af619;});}else{return _0x5af619;}})[_0xa194('0x44')](function(_0x53cca5){logger[_0xa194('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53cca5);throw _0x53cca5;});}return _0x5af619;})[_0xa194('0x25')](respondWithResult(_0x11a9c0,0xc9))[_0xa194('0x44')](handleError(_0x11a9c0,null));};exports[_0xa194('0x24')]=function(_0x5685ff,_0x4ed1ae){if(_0x5685ff[_0xa194('0x4a')]['id']){delete _0x5685ff[_0xa194('0x4a')]['id'];}return db['Variable'][_0xa194('0x48')]({'where':{'id':_0x5685ff[_0xa194('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ed1ae,null))[_0xa194('0x25')](saveUpdates(_0x5685ff['body'],null))[_0xa194('0x25')](respondWithResult(_0x4ed1ae,null))[_0xa194('0x44')](handleError(_0x4ed1ae,null));};exports['destroy']=function(_0x1699d5,_0x34b3bd){return db[_0xa194('0x2f')]['find']({'where':{'id':_0x1699d5[_0xa194('0x52')]['id']}})[_0xa194('0x25')](handleEntityNotFound(_0x34b3bd,null))['then'](removeEntity(_0x34b3bd,null))['catch'](handleError(_0x34b3bd,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 44c5fb7..0613007 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 _0x8234=['tools_variables','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable'];(function(_0x48cac8,_0x150d03){var _0x539232=function(_0x2fe472){while(--_0x2fe472){_0x48cac8['push'](_0x48cac8['shift']());}};_0x539232(++_0x150d03);}(_0x8234,0x198));var _0x4823=function(_0xdf4058,_0x3d913d){_0xdf4058=_0xdf4058-0x0;var _0x141888=_0x8234[_0xdf4058];return _0x141888;};'use strict';var _=require(_0x4823('0x0'));var util=require(_0x4823('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4823('0x2'));var rp=require(_0x4823('0x3'));var fs=require('fs');var path=require(_0x4823('0x4'));var rimraf=require(_0x4823('0x5'));var config=require(_0x4823('0x6'));var attributes=require(_0x4823('0x7'));module['exports']=function(_0x3ebb91,_0x284f01){return _0x3ebb91[_0x4823('0x8')](_0x4823('0x9'),attributes,{'tableName':_0x4823('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8015=['util','../../config/logger','moment','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','lodash'];(function(_0x1a5350,_0x13ea98){var _0x54c702=function(_0xd817d8){while(--_0xd817d8){_0x1a5350['push'](_0x1a5350['shift']());}};_0x54c702(++_0x13ea98);}(_0x8015,0x1a1));var _0x5801=function(_0x3c78e2,_0x4a8d43){_0x3c78e2=_0x3c78e2-0x0;var _0xf291a5=_0x8015[_0x3c78e2];return _0xf291a5;};'use strict';var _=require(_0x5801('0x0'));var util=require(_0x5801('0x1'));var logger=require(_0x5801('0x2'))('api');var moment=require(_0x5801('0x3'));var BPromise=require('bluebird');var rp=require(_0x5801('0x4'));var fs=require('fs');var path=require(_0x5801('0x5'));var rimraf=require('rimraf');var config=require(_0x5801('0x6'));var attributes=require(_0x5801('0x7'));module[_0x5801('0x8')]=function(_0x2c2fb1,_0x281dc9){return _0x2c2fb1[_0x5801('0x9')](_0x5801('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index c65d7f2..2a847d6 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x39da12,_0x2365e3){var _0x3c68a3=function(_0x464264){while(--_0x464264){_0x39da12['push'](_0x39da12['shift']());}};_0x3c68a3(++_0x2365e3);}(_0x55ca,0x126));var _0xa55c=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0x55ca[_0x51539c];return _0x4f7914;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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'];(function(_0x29e179,_0x26e2d3){var _0x48483c=function(_0x315533){while(--_0x315533){_0x29e179['push'](_0x29e179['shift']());}};_0x48483c(++_0x26e2d3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xf7c208,_0x5cbc84){_0xf7c208=_0xf7c208-0x0;var _0x16992d=_0x7fbe[_0xf7c208];return _0x16992d;};'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);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a96659c..fe927f8 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 _0xea2e=['fetch','get','reset','/pull','pull','restart','/migrations','migrations','exports','./version.controller','index','/fetch','isAuthenticated','canUpdate'];(function(_0x39f119,_0xc67edd){var _0x36d66c=function(_0x55b146){while(--_0x55b146){_0x39f119['push'](_0x39f119['shift']());}};_0x36d66c(++_0xc67edd);}(_0xea2e,0x1d7));var _0xeea2=function(_0x262006,_0xc16061){_0x262006=_0x262006-0x0;var _0x9b2b5e=_0xea2e[_0x262006];return _0x9b2b5e;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xeea2('0x0'));router['get']('/',controller[_0xeea2('0x1')]);router['get'](_0xeea2('0x2'),auth[_0xeea2('0x3')](),auth[_0xeea2('0x4')](),controller[_0xeea2('0x5')]);router[_0xeea2('0x6')]('/reset',auth[_0xeea2('0x3')](),auth[_0xeea2('0x4')](),controller[_0xeea2('0x7')]);router['get'](_0xeea2('0x8'),auth[_0xeea2('0x3')](),auth['canUpdate'](),controller[_0xeea2('0x9')]);router[_0xeea2('0x6')]('/restart',auth['isAuthenticated'](),controller[_0xeea2('0xa')]);router[_0xeea2('0x6')](_0xeea2('0xb'),controller[_0xeea2('0xc')]);module[_0xeea2('0xd')]=router; \ No newline at end of file +var _0x753c=['index','/fetch','fetch','/reset','isAuthenticated','canUpdate','reset','/pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get'];(function(_0x2368d9,_0x14130f){var _0x588016=function(_0x3edde3){while(--_0x3edde3){_0x2368d9['push'](_0x2368d9['shift']());}};_0x588016(++_0x14130f);}(_0x753c,0x18c));var _0xc753=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x753c[_0x2b4411];return _0x8e41ef;};'use strict';var express=require(_0xc753('0x0'));var router=express[_0xc753('0x1')]();var auth=require(_0xc753('0x2'));var controller=require('./version.controller');router[_0xc753('0x3')]('/',controller[_0xc753('0x4')]);router[_0xc753('0x3')](_0xc753('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc753('0x6')]);router['get'](_0xc753('0x7'),auth[_0xc753('0x8')](),auth[_0xc753('0x9')](),controller[_0xc753('0xa')]);router[_0xc753('0x3')](_0xc753('0xb'),auth[_0xc753('0x8')](),auth[_0xc753('0x9')](),controller['pull']);router[_0xc753('0x3')]('/restart',auth[_0xc753('0x8')](),controller[_0xc753('0xc')]);router[_0xc753('0x3')](_0xc753('0xd'),controller[_0xc753('0xe')]);module[_0xc753('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1726df9..8b335a8 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 _0x5839=['version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','fetch','tags','latest','origin','master','error','status','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','.js','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','Database\x20already\x20up-to-date','umzug','path','lodash'];(function(_0x24cd9e,_0x294c4b){var _0x3f4b98=function(_0xcfdb9c){while(--_0xcfdb9c){_0x24cd9e['push'](_0x24cd9e['shift']());}};_0x3f4b98(++_0x294c4b);}(_0x5839,0x1d1));var _0x9583=function(_0x177d06,_0x16308d){_0x177d06=_0x177d06-0x0;var _0x4f7e1d=_0x5839[_0x177d06];return _0x4f7e1d;};'use strict';var Umzug=require(_0x9583('0x0'));var path=require(_0x9583('0x1'));var fs=require('fs');var _=require(_0x9583('0x2'));var pkginfo=require('pkginfo')(module,_0x9583('0x3'));var compareVersions=require(_0x9583('0x4'));var exec=require(_0x9583('0x5'))[_0x9583('0x6')];var db=require(_0x9583('0x7'))['db'];var config=require(_0x9583('0x8'));var pm2=require(_0x9583('0x9'));var logger=require(_0x9583('0xa'))('update');var git=require(_0x9583('0xb'))(config[_0x9583('0xc')]);exports[_0x9583('0xd')]=function(_0x220737,_0x76948c){var _0x50194e={'current':module[_0x9583('0xe')][_0x9583('0x3')],'phonebar':0x2};if(_0x220737['query']&&_0x220737['query']['latest']){return git[_0x9583('0xf')]()[_0x9583('0x10')](function(_0x2bab99,_0x252e61){_0x50194e[_0x9583('0x11')]=(_0x2bab99?module[_0x9583('0xe')]['version']:_0x252e61['latest'])||'2.0.0';return _0x76948c['status'](0xc8)['json'](_0x50194e);});}else{return _0x76948c['status'](0xc8)['json'](_0x50194e);}};exports['fetch']=function(_0x460abd,_0xdda6dd){return git['fetch']([_0x9583('0x12'),_0x9583('0x13')],function(_0x142656){if(_0x142656){logger[_0x9583('0x14')](_0x142656);return _0xdda6dd[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x142656);}logger[_0x9583('0x17')](_0x9583('0x18'));return _0xdda6dd[_0x9583('0x15')](0xc8)['json']({'output':_0x9583('0x19')});});};exports[_0x9583('0x1a')]=function(_0x4c4675,_0x20416e){return git[_0x9583('0x1a')]([_0x9583('0x1b'),_0x9583('0x1c')],function(_0x143360){if(_0x143360){logger[_0x9583('0x14')](_0x143360);return _0x20416e[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x143360);}logger[_0x9583('0x17')](_0x9583('0x1d'));return _0x20416e[_0x9583('0x15')](0xc8)[_0x9583('0x16')]({'output':'git\x20reset\x20--hard'});});};exports[_0x9583('0x1e')]=function(_0x3bbc3b,_0x4dc5c2){exec('npm\x20install\x20--production',function(_0x1e9a08,_0x3d92df,_0x10ec56){logger['info'](_0x3d92df);logger[_0x9583('0x17')](_0x10ec56);if(_0x1e9a08){logger[_0x9583('0x14')](_0x1e9a08);return _0x4dc5c2[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x1e9a08);}return _0x4dc5c2[_0x9583('0x15')](0xc8)[_0x9583('0x16')]({'output':_0x3d92df});});};exports[_0x9583('0x1f')]=function(_0x2c06e2,_0x358dab){return pm2[_0x9583('0x1f')](_0x9583('0x20'))[_0x9583('0x21')](function(_0xc56634){logger['info'](_0x9583('0x22'),_0xc56634);return _0x358dab['status'](0xc8)[_0x9583('0x16')]({'output':_0x9583('0x23')});})[_0x9583('0x24')](function(_0x447b9b){logger[_0x9583('0x14')](_0x447b9b);return _0x358dab[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x447b9b);});};exports[_0x9583('0x25')]=function(_0x3720a7,_0x45f528){var _0x3035b8=fs['readdirSync'](path['join'](config['root'],_0x9583('0x26'),'migrations'));var _0x5eaf83=[];for(var _0x35f906=0x0;_0x35f906<_0x3035b8[_0x9583('0x27')];_0x35f906++){var _0x36d453=_0x3035b8[_0x35f906]['replace'](_0x9583('0x28'),'');if(compareVersions(module[_0x9583('0xe')][_0x9583('0x3')],_0x36d453)===-0x1){_0x5eaf83['push'](_0x36d453);}}if(_0x5eaf83[_0x9583('0x27')]){var _0x1da543=_0x5eaf83[_0x9583('0x29')](compareVersions);var _0x227d25=new Umzug({'storage':_0x9583('0x2a'),'storageOptions':{'model':db[_0x9583('0x2b')],'modelName':_0x9583('0x2b'),'columnName':_0x9583('0x3')},'migrations':{'params':[db[_0x9583('0x2a')][_0x9583('0x2c')](),db['sequelize'][_0x9583('0x2d')],function(){throw new Error(_0x9583('0x2e'));}],'path':path['join'](config['root'],'server',_0x9583('0x25')),'pattern':/\.js$/}});_0x227d25['up']({'migrations':_[_0x9583('0x2f')](_0x1da543,function(_0x113fda){return _0x113fda+'.js';})})[_0x9583('0x21')](function(){return _0x45f528[_0x9583('0x15')](0xc8)[_0x9583('0x16')]({'output':_0x9583('0x30')+module['exports'][_0x9583('0x3')]+_0x9583('0x31')+_[_0x9583('0x32')](_0x1da543),'migrations':_['join'](_0x1da543)});})[_0x9583('0x24')](function(_0x6eff79){if(_0x6eff79 instanceof db['sequelize']['UniqueConstraintError']){return _0x45f528['status'](0xc8)['json']({'output':_0x9583('0x33')});}else{return _0x45f528[_0x9583('0x15')](0x1f4)[_0x9583('0x16')](_0x6eff79);}});}else{return _0x45f528['status'](0xc8)[_0x9583('0x16')]({'output':_0x9583('0x33')});}}; \ No newline at end of file +var _0xb714=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','query','latest','tags','json','status','fetch','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','restart','motion2','then'];(function(_0x3dbd37,_0x1551bd){var _0x1a7d78=function(_0x4a2bca){while(--_0x4a2bca){_0x3dbd37['push'](_0x3dbd37['shift']());}};_0x1a7d78(++_0x1551bd);}(_0xb714,0xba));var _0x4b71=function(_0x268916,_0x1c27e1){_0x268916=_0x268916-0x0;var _0x38f8a4=_0xb714[_0x268916];return _0x38f8a4;};'use strict';var Umzug=require(_0x4b71('0x0'));var path=require(_0x4b71('0x1'));var fs=require('fs');var _=require(_0x4b71('0x2'));var pkginfo=require(_0x4b71('0x3'))(module,_0x4b71('0x4'));var compareVersions=require(_0x4b71('0x5'));var exec=require(_0x4b71('0x6'))[_0x4b71('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x4b71('0x8'));var pm2=require(_0x4b71('0x9'));var logger=require(_0x4b71('0xa'))(_0x4b71('0xb'));var git=require('simple-git')(config[_0x4b71('0xc')]);exports['index']=function(_0x2e23b4,_0x16a700){var _0x2e6ecf={'current':module[_0x4b71('0xd')]['version'],'phonebar':0x2};if(_0x2e23b4[_0x4b71('0xe')]&&_0x2e23b4[_0x4b71('0xe')][_0x4b71('0xf')]){return git['fetch']()[_0x4b71('0x10')](function(_0x452e60,_0x3d7375){_0x2e6ecf[_0x4b71('0xf')]=(_0x452e60?module[_0x4b71('0xd')][_0x4b71('0x4')]:_0x3d7375[_0x4b71('0xf')])||'2.0.0';return _0x16a700['status'](0xc8)[_0x4b71('0x11')](_0x2e6ecf);});}else{return _0x16a700[_0x4b71('0x12')](0xc8)[_0x4b71('0x11')](_0x2e6ecf);}};exports[_0x4b71('0x13')]=function(_0x55ada6,_0x232c7c){return git['fetch'](['origin',_0x4b71('0x14')],function(_0x3ff145){if(_0x3ff145){logger['error'](_0x3ff145);return _0x232c7c['status'](0x1f4)[_0x4b71('0x11')](_0x3ff145);}logger[_0x4b71('0x15')](_0x4b71('0x16'));return _0x232c7c[_0x4b71('0x12')](0xc8)[_0x4b71('0x11')]({'output':_0x4b71('0x17')});});};exports[_0x4b71('0x18')]=function(_0x7b34a,_0x1bc2aa){return git[_0x4b71('0x18')]([_0x4b71('0x19'),_0x4b71('0x1a')],function(_0x553f62){if(_0x553f62){logger['error'](_0x553f62);return _0x1bc2aa[_0x4b71('0x12')](0x1f4)['json'](_0x553f62);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1bc2aa[_0x4b71('0x12')](0xc8)[_0x4b71('0x11')]({'output':_0x4b71('0x1b')});});};exports[_0x4b71('0x1c')]=function(_0x37c6ee,_0x4468be){exec(_0x4b71('0x1d'),function(_0x42e4e1,_0x5739ef,_0x19875d){logger[_0x4b71('0x15')](_0x5739ef);logger[_0x4b71('0x15')](_0x19875d);if(_0x42e4e1){logger[_0x4b71('0x1e')](_0x42e4e1);return _0x4468be[_0x4b71('0x12')](0x1f4)[_0x4b71('0x11')](_0x42e4e1);}return _0x4468be[_0x4b71('0x12')](0xc8)[_0x4b71('0x11')]({'output':_0x5739ef});});};exports[_0x4b71('0x1f')]=function(_0x8893fe,_0x3cf861){return pm2[_0x4b71('0x1f')](_0x4b71('0x20'))[_0x4b71('0x21')](function(_0x1d84cd){logger[_0x4b71('0x15')](_0x4b71('0x22'),_0x1d84cd);return _0x3cf861[_0x4b71('0x12')](0xc8)[_0x4b71('0x11')]({'output':_0x4b71('0x23')});})[_0x4b71('0x24')](function(_0x295779){logger[_0x4b71('0x1e')](_0x295779);return _0x3cf861[_0x4b71('0x12')](0x1f4)[_0x4b71('0x11')](_0x295779);});};exports['migrations']=function(_0x5a1545,_0x42f73e){var _0x5692d1=fs[_0x4b71('0x25')](path[_0x4b71('0x26')](config[_0x4b71('0xc')],_0x4b71('0x27'),_0x4b71('0x28')));var _0x3de86e=[];for(var _0x41a071=0x0;_0x41a071<_0x5692d1[_0x4b71('0x29')];_0x41a071++){var _0x996a3d=_0x5692d1[_0x41a071]['replace']('.js','');if(compareVersions(module['exports'][_0x4b71('0x4')],_0x996a3d)===-0x1){_0x3de86e[_0x4b71('0x2a')](_0x996a3d);}}if(_0x3de86e[_0x4b71('0x29')]){var _0x1eb712=_0x3de86e[_0x4b71('0x2b')](compareVersions);var _0x350d15=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x4b71('0x2c')],'modelName':_0x4b71('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x4b71('0x2d')][_0x4b71('0x2e')](),db['sequelize'][_0x4b71('0x2f')],function(){throw new Error(_0x4b71('0x30'));}],'path':path[_0x4b71('0x26')](config[_0x4b71('0xc')],'server',_0x4b71('0x28')),'pattern':/\.js$/}});_0x350d15['up']({'migrations':_['map'](_0x1eb712,function(_0x3d9629){return _0x3d9629+_0x4b71('0x31');})})[_0x4b71('0x21')](function(){return _0x42f73e[_0x4b71('0x12')](0xc8)[_0x4b71('0x11')]({'output':_0x4b71('0x32')+module['exports'][_0x4b71('0x4')]+_0x4b71('0x33')+_[_0x4b71('0x34')](_0x1eb712),'migrations':_['join'](_0x1eb712)});})['catch'](function(_0x4ca7f5){if(_0x4ca7f5 instanceof db['sequelize'][_0x4b71('0x35')]){return _0x42f73e['status'](0xc8)[_0x4b71('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x42f73e[_0x4b71('0x12')](0x1f4)['json'](_0x4ca7f5);}});}else{return _0x42f73e[_0x4b71('0x12')](0xc8)[_0x4b71('0x11')]({'output':_0x4b71('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index dd98fe6..7a6e5ee 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 _0x9fd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x9fd9,0x1af));var _0x99fd=function(_0x5cfc1e,_0x13a37c){_0x5cfc1e=_0x5cfc1e-0x0;var _0x44c04d=_0x9fd9[_0x5cfc1e];return _0x44c04d;};'use strict';var multer=require(_0x99fd('0x0'));var util=require(_0x99fd('0x1'));var path=require(_0x99fd('0x2'));var timeout=require(_0x99fd('0x3'));var express=require(_0x99fd('0x4'));var router=express[_0x99fd('0x5')]();var fs_extra=require(_0x99fd('0x6'));var auth=require(_0x99fd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x99fd('0x8'));var controller=require(_0x99fd('0x9'));router['get']('/',auth[_0x99fd('0xa')](),controller[_0x99fd('0xb')]);router[_0x99fd('0xc')](_0x99fd('0xd'),auth[_0x99fd('0xa')](),controller[_0x99fd('0xe')]);router[_0x99fd('0xc')](_0x99fd('0xf'),auth[_0x99fd('0xa')](),controller[_0x99fd('0x10')]);router[_0x99fd('0x11')]('/',auth[_0x99fd('0xa')](),controller[_0x99fd('0x12')]);router[_0x99fd('0x13')](_0x99fd('0xf'),auth[_0x99fd('0xa')](),controller[_0x99fd('0x14')]);router[_0x99fd('0x15')]('/:id',auth[_0x99fd('0xa')](),controller[_0x99fd('0x16')]);module[_0x99fd('0x17')]=router; \ No newline at end of file +var _0x03e9=['post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x03e9,0x1ec));var _0x903e=function(_0x525fa2,_0x3b974d){_0x525fa2=_0x525fa2-0x0;var _0x4f68c9=_0x03e9[_0x525fa2];return _0x4f68c9;};'use strict';var multer=require(_0x903e('0x0'));var util=require('util');var path=require(_0x903e('0x1'));var timeout=require(_0x903e('0x2'));var express=require('express');var router=express[_0x903e('0x3')]();var fs_extra=require(_0x903e('0x4'));var auth=require(_0x903e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x903e('0x6'));router[_0x903e('0x7')]('/',auth[_0x903e('0x8')](),controller['index']);router[_0x903e('0x7')](_0x903e('0x9'),auth[_0x903e('0x8')](),controller['describe']);router['get'](_0x903e('0xa'),auth['isAuthenticated'](),controller[_0x903e('0xb')]);router[_0x903e('0xc')]('/',auth['isAuthenticated'](),controller[_0x903e('0xd')]);router[_0x903e('0xe')](_0x903e('0xa'),auth['isAuthenticated'](),controller[_0x903e('0xf')]);router['delete'](_0x903e('0xa'),auth[_0x903e('0x8')](),controller[_0x903e('0x10')]);module[_0x903e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7f472da..fcc1d9a 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 _0xc2a2=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x14aa96,_0x52c180){var _0x520d32=function(_0x3dd977){while(--_0x3dd977){_0x14aa96['push'](_0x14aa96['shift']());}};_0x520d32(++_0x52c180);}(_0xc2a2,0x84));var _0x2c2a=function(_0x4bdb81,_0x528833){_0x4bdb81=_0x4bdb81-0x0;var _0x297323=_0xc2a2[_0x4bdb81];return _0x297323;};'use strict';var Sequelize=require(_0x2c2a('0x0'));module[_0x2c2a('0x1')]={'type':{'type':Sequelize[_0x2c2a('0x2')]},'uniqueid':{'type':Sequelize[_0x2c2a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2c2a('0x2')]},'queue':{'type':Sequelize[_0x2c2a('0x2')]},'interface':{'type':Sequelize[_0x2c2a('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2c2a('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2c2a('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2c2a('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2c2a('0x2')]},'channel':{'type':Sequelize[_0x2c2a('0x2')]},'channelstate':{'type':Sequelize[_0x2c2a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2c2a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2c2a('0x2')]},'connectedlinename':{'type':Sequelize[_0x2c2a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2c2a('0x2')]},'exten':{'type':Sequelize[_0x2c2a('0x2')]},'priority':{'type':Sequelize[_0x2c2a('0x2')]},'destchannel':{'type':Sequelize[_0x2c2a('0x2')]},'destchannelstate':{'type':Sequelize[_0x2c2a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2c2a('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x2c2a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2c2a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2c2a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x2c2a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2c2a('0x2')]},'destuniqueid':{'type':Sequelize[_0x2c2a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x2c2a('0x2')]},'transfer':{'type':Sequelize[_0x2c2a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2c2a('0x2')],'comment':_0x2c2a('0x6')},'transferexten':{'type':Sequelize[_0x2c2a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2c2a('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1867=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0xc7209,_0x59b633){var _0x3f8072=function(_0x333415){while(--_0x333415){_0xc7209['push'](_0xc7209['shift']());}};_0x3f8072(++_0x59b633);}(_0x1867,0xb5));var _0x7186=function(_0x50a44b,_0x39791f){_0x50a44b=_0x50a44b-0x0;var _0xc34e7=_0x1867[_0x50a44b];return _0xc34e7;};'use strict';var Sequelize=require(_0x7186('0x0'));module[_0x7186('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7186('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7186('0x2')]},'queue':{'type':Sequelize[_0x7186('0x2')]},'interface':{'type':Sequelize[_0x7186('0x2')]},'membername':{'type':Sequelize[_0x7186('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7186('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7186('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7186('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7186('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7186('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7186('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7186('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7186('0x5')]},'agentacw':{'type':Sequelize[_0x7186('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7186('0x5')]},'reason':{'type':Sequelize[_0x7186('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7186('0x2')]},'channelstate':{'type':Sequelize[_0x7186('0x5')]},'channelstatedesc':{'type':Sequelize[_0x7186('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7186('0x2')]},'connectedlinename':{'type':Sequelize[_0x7186('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7186('0x2')]},'context':{'type':Sequelize[_0x7186('0x2')]},'exten':{'type':Sequelize[_0x7186('0x2')]},'priority':{'type':Sequelize[_0x7186('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7186('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x7186('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7186('0x2')]},'destcalleridname':{'type':Sequelize[_0x7186('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7186('0x2')]},'destcontext':{'type':Sequelize[_0x7186('0x2')]},'destexten':{'type':Sequelize[_0x7186('0x2')]},'destpriority':{'type':Sequelize[_0x7186('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7186('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7186('0x2')]},'transfer':{'type':Sequelize[_0x7186('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7186('0x2')],'comment':_0x7186('0x6')},'transferexten':{'type':Sequelize[_0x7186('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7186('0x2')]},'agententerreason':{'type':Sequelize[_0x7186('0x5')],'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 18ca2bc..9885f52 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(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 5a7317f..5c3ff08 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 _0x3831=['bluebird','request-promise','rimraf','./voiceAgentReport.attributes','define','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment'];(function(_0x24f92b,_0xc395fe){var _0x2a3bed=function(_0x4253b2){while(--_0x4253b2){_0x24f92b['push'](_0x24f92b['shift']());}};_0x2a3bed(++_0xc395fe);}(_0x3831,0x14c));var _0x1383=function(_0x5bfea1,_0x494abb){_0x5bfea1=_0x5bfea1-0x0;var _0x42d2fa=_0x3831[_0x5bfea1];return _0x42d2fa;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1383('0x6'));var config=require('../../config/environment');var attributes=require(_0x1383('0x7'));module['exports']=function(_0x5b64b1,_0x5eb4d8){return _0x5b64b1[_0x1383('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1383('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1383('0xa'),_0x1383('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb81=['define','report_agent','uniqueid','destuniqueid','lodash','util','api','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xcb81,0x154));var _0x1cb8=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0xcb81[_0x34b87f];return _0x449805;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb8('0x3'));var rimraf=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var attributes=require(_0x1cb8('0x6'));module[_0x1cb8('0x7')]=function(_0x4e5c19,_0x98d682){return _0x4e5c19[_0x1cb8('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb8('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb8('0xa'),_0x1cb8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b0866f2..5c425ae 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 _0x2a1d=['UpdateVoiceAgentReport','update','where','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x2a1d,0x184));var _0xd2a1=function(_0x5f3ea0,_0x111f48){_0x5f3ea0=_0x5f3ea0-0x0;var _0x4ff1f6=_0x2a1d[_0x5f3ea0];return _0x4ff1f6;};'use strict';var _=require(_0xd2a1('0x0'));var util=require('util');var moment=require(_0xd2a1('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2a1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2a1('0x3'))['db'];var utils=require(_0xd2a1('0x4'));var logger=require(_0xd2a1('0x5'))(_0xd2a1('0x6'));var config=require(_0xd2a1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2a1('0x8')][_0xd2a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4af5,_0x24164b,_0x50c2b8){return new BPromise(function(_0x230328,_0x476fcf){return client[_0xd2a1('0xa')](_0x2a4af5,_0x50c2b8)[_0xd2a1('0xb')](function(_0x2f5076){logger[_0xd2a1('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x24164b,_0xd2a1('0xd'));logger[_0xd2a1('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x24164b,'request\x20sent',JSON[_0xd2a1('0xf')](_0x2f5076));if(_0x2f5076[_0xd2a1('0x10')]){if(_0x2f5076['error'][_0xd2a1('0x11')]===0x1f4){logger[_0xd2a1('0x10')](_0xd2a1('0x12'),_0x24164b,_0x2f5076[_0xd2a1('0x10')]['message']);return _0x476fcf(_0x2f5076['error']['message']);}logger[_0xd2a1('0x10')](_0xd2a1('0x12'),_0x24164b,_0x2f5076[_0xd2a1('0x10')][_0xd2a1('0x13')]);return _0x230328(_0x2f5076[_0xd2a1('0x10')][_0xd2a1('0x13')]);}else{logger[_0xd2a1('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x24164b,_0xd2a1('0xd'));_0x230328(_0x2f5076[_0xd2a1('0x14')][_0xd2a1('0x13')]);}})[_0xd2a1('0x15')](function(_0x1d1b14){logger[_0xd2a1('0x10')](_0xd2a1('0x12'),_0x24164b,_0x1d1b14);_0x476fcf(_0x1d1b14);});});}exports[_0xd2a1('0x16')]=function(_0xb9590a){var _0x3fdb69=this;return new Promise(function(_0x250f13,_0x1b2d6d){return db[_0xd2a1('0x17')][_0xd2a1('0x18')](_0xb9590a[_0xd2a1('0x19')],{'raw':_0xb9590a[_0xd2a1('0x1a')]?_0xb9590a[_0xd2a1('0x1a')][_0xd2a1('0x1b')]===undefined?!![]:![]:!![]})[_0xd2a1('0xb')](function(_0x2d5a55){logger[_0xd2a1('0xc')]('CreateVoiceAgentReport',_0xb9590a);logger['debug']('CreateVoiceAgentReport',_0xb9590a,JSON[_0xd2a1('0xf')](_0x2d5a55));_0x250f13(_0x2d5a55);})['catch'](function(_0x37e033){logger[_0xd2a1('0x10')](_0xd2a1('0x16'),_0x37e033[_0xd2a1('0x13')],_0xb9590a);_0x1b2d6d(_0x3fdb69[_0xd2a1('0x10')](0x1f4,_0x37e033[_0xd2a1('0x13')]));});});};exports[_0xd2a1('0x1c')]=function(_0x4b1cd7){var _0x1ce8f4=this;return new Promise(function(_0x47efe2,_0x3b186d){return db[_0xd2a1('0x17')][_0xd2a1('0x1d')](_0x4b1cd7[_0xd2a1('0x19')],{'raw':_0x4b1cd7['options']?_0x4b1cd7[_0xd2a1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1cd7['options']?_0x4b1cd7[_0xd2a1('0x1a')][_0xd2a1('0x1e')]||null:null,'attributes':_0x4b1cd7[_0xd2a1('0x1a')]?_0x4b1cd7[_0xd2a1('0x1a')]['attributes']||null:null,'limit':_0x4b1cd7[_0xd2a1('0x1a')]?_0x4b1cd7[_0xd2a1('0x1a')][_0xd2a1('0x1f')]||null:null})[_0xd2a1('0xb')](function(_0xcd53e3){logger['info']('UpdateVoiceAgentReport',_0x4b1cd7);logger[_0xd2a1('0xe')]('UpdateVoiceAgentReport',_0x4b1cd7,JSON[_0xd2a1('0xf')](_0xcd53e3));_0x47efe2(_0xcd53e3);})[_0xd2a1('0x15')](function(_0x141cd1){logger['error'](_0xd2a1('0x1c'),_0x141cd1[_0xd2a1('0x13')],_0x4b1cd7);_0x3b186d(_0x1ce8f4[_0xd2a1('0x10')](0x1f4,_0x141cd1[_0xd2a1('0x13')]));});});}; \ No newline at end of file +var _0x3f55=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','UpdateVoiceAgentReport','update','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0x3f55,0x72));var _0x53f5=function(_0x89f772,_0x45088a){_0x89f772=_0x89f772-0x0;var _0x4857a3=_0x3f55[_0x89f772];return _0x4857a3;};'use strict';var _=require(_0x53f5('0x0'));var util=require(_0x53f5('0x1'));var moment=require(_0x53f5('0x2'));var BPromise=require(_0x53f5('0x3'));var rs=require(_0x53f5('0x4'));var fs=require('fs');var Redis=require(_0x53f5('0x5'));var db=require(_0x53f5('0x6'))['db'];var utils=require(_0x53f5('0x7'));var logger=require(_0x53f5('0x8'))(_0x53f5('0x9'));var config=require(_0x53f5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x53f5('0xb')][_0x53f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x490d1b,_0x311262,_0x5cdae8){return new BPromise(function(_0x1e15e7,_0x1970a1){return client[_0x53f5('0xd')](_0x490d1b,_0x5cdae8)[_0x53f5('0xe')](function(_0x36ccfa){logger[_0x53f5('0xf')](_0x53f5('0x10'),_0x311262,_0x53f5('0x11'));logger['debug'](_0x53f5('0x12'),_0x311262,_0x53f5('0x11'),JSON['stringify'](_0x36ccfa));if(_0x36ccfa[_0x53f5('0x13')]){if(_0x36ccfa['error']['code']===0x1f4){logger[_0x53f5('0x13')](_0x53f5('0x10'),_0x311262,_0x36ccfa['error']['message']);return _0x1970a1(_0x36ccfa['error'][_0x53f5('0x14')]);}logger[_0x53f5('0x13')](_0x53f5('0x10'),_0x311262,_0x36ccfa['error'][_0x53f5('0x14')]);return _0x1e15e7(_0x36ccfa['error'][_0x53f5('0x14')]);}else{logger[_0x53f5('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x311262,'request\x20sent');_0x1e15e7(_0x36ccfa['result'][_0x53f5('0x14')]);}})[_0x53f5('0x15')](function(_0x4dce5c){logger[_0x53f5('0x13')](_0x53f5('0x10'),_0x311262,_0x4dce5c);_0x1970a1(_0x4dce5c);});});}exports[_0x53f5('0x16')]=function(_0x5da90c){var _0x48f7e6=this;return new Promise(function(_0x5e8842,_0x52b843){return db[_0x53f5('0x17')][_0x53f5('0x18')](_0x5da90c[_0x53f5('0x19')],{'raw':_0x5da90c[_0x53f5('0x1a')]?_0x5da90c[_0x53f5('0x1a')][_0x53f5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x295e10){logger[_0x53f5('0xf')](_0x53f5('0x16'),_0x5da90c);logger['debug']('CreateVoiceAgentReport',_0x5da90c,JSON[_0x53f5('0x1c')](_0x295e10));_0x5e8842(_0x295e10);})[_0x53f5('0x15')](function(_0x5e0c27){logger[_0x53f5('0x13')]('CreateVoiceAgentReport',_0x5e0c27[_0x53f5('0x14')],_0x5da90c);_0x52b843(_0x48f7e6[_0x53f5('0x13')](0x1f4,_0x5e0c27[_0x53f5('0x14')]));});});};exports[_0x53f5('0x1d')]=function(_0x2e3e65){var _0x49b223=this;return new Promise(function(_0x57432e,_0x4d81c2){return db[_0x53f5('0x17')][_0x53f5('0x1e')](_0x2e3e65['body'],{'raw':_0x2e3e65['options']?_0x2e3e65[_0x53f5('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e3e65[_0x53f5('0x1a')]?_0x2e3e65[_0x53f5('0x1a')]['where']||null:null,'attributes':_0x2e3e65[_0x53f5('0x1a')]?_0x2e3e65[_0x53f5('0x1a')][_0x53f5('0x1f')]||null:null,'limit':_0x2e3e65['options']?_0x2e3e65['options']['limit']||null:null})[_0x53f5('0xe')](function(_0x44eea4){logger[_0x53f5('0xf')](_0x53f5('0x1d'),_0x2e3e65);logger[_0x53f5('0x20')](_0x53f5('0x1d'),_0x2e3e65,JSON[_0x53f5('0x1c')](_0x44eea4));_0x57432e(_0x44eea4);})[_0x53f5('0x15')](function(_0xae7dda){logger[_0x53f5('0x13')](_0x53f5('0x1d'),_0xae7dda[_0x53f5('0x14')],_0x2e3e65);_0x4d81c2(_0x49b223[_0x53f5('0x13')](0x1f4,_0xae7dda[_0x53f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f7fa890..41642fe 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 _0x7217=['../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file +var _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','/describe','isAuthenticated','/:id','create'];(function(_0x16b1b8,_0x432d03){var _0x558b1e=function(_0xf47f2f){while(--_0xf47f2f){_0x16b1b8['push'](_0x16b1b8['shift']());}};_0x558b1e(++_0x432d03);}(_0x038b,0x114));var _0xb038=function(_0x2a6682,_0x2edf4b){_0x2a6682=_0x2a6682-0x0;var _0x20a6c0=_0x038b[_0x2a6682];return _0x20a6c0;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb038('0x7')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller['describe']);router['get'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller['show']);router['post']('/',auth[_0xb038('0x9')](),controller[_0xb038('0xb')]);router['put'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xc')]);router[_0xb038('0xd')](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xe')]);module[_0xb038('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c53fa8d..9873502 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 _0xebc0=['STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0xebc0,0xe5));var _0x0ebc=function(_0x54ef34,_0x119ec1){_0x54ef34=_0x54ef34-0x0;var _0xd06ff1=_0xebc0[_0x54ef34];return _0xd06ff1;};'use strict';var Sequelize=require(_0x0ebc('0x0'));module[_0x0ebc('0x1')]={'uniqueid':{'type':Sequelize[_0x0ebc('0x2')]},'type':{'type':Sequelize['ENUM'](_0x0ebc('0x3'),_0x0ebc('0x4'),_0x0ebc('0x5'),_0x0ebc('0x6'),_0x0ebc('0x7'),_0x0ebc('0x8'))},'tag':{'type':Sequelize[_0x0ebc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0ebc('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0ebc('0x2')]},'destinationchannel':{'type':Sequelize[_0x0ebc('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0ebc('0x9')]},'answertime':{'type':Sequelize[_0x0ebc('0x9')]},'endtime':{'type':Sequelize[_0x0ebc('0x9')]},'duration':{'type':Sequelize[_0x0ebc('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0ebc('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0ebc('0x2')]},'amaflags':{'type':Sequelize[_0x0ebc('0x2')]},'userfield':{'type':Sequelize[_0x0ebc('0x2')]},'userDisposition':{'type':Sequelize[_0x0ebc('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x0ebc('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x0ebc('0x2')]},'note':{'type':Sequelize[_0x0ebc('0x2')]},'prefix':{'type':Sequelize[_0x0ebc('0x2')]},'routeid':{'type':Sequelize[_0x0ebc('0xa')]},'sipcallid':{'type':Sequelize[_0x0ebc('0x2')]}}; \ No newline at end of file +var _0xd7ab=['INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','DATE'];(function(_0x11b8b3,_0x30f7fd){var _0x20c810=function(_0x85666b){while(--_0x85666b){_0x11b8b3['push'](_0x11b8b3['shift']());}};_0x20c810(++_0x30f7fd);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd7ab[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xbd7a('0x0'));module[_0xbd7a('0x1')]={'uniqueid':{'type':Sequelize[_0xbd7a('0x2')]},'type':{'type':Sequelize[_0xbd7a('0x3')](_0xbd7a('0x4'),_0xbd7a('0x5'),_0xbd7a('0x6'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0xbd7a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xbd7a('0x2')]},'destinationcontext':{'type':Sequelize[_0xbd7a('0x2')]},'callerid':{'type':Sequelize[_0xbd7a('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xbd7a('0x2')]},'lastapplication':{'type':Sequelize[_0xbd7a('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xbd7a('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbd7a('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xbd7a('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xbd7a('0x2')]},'userfield':{'type':Sequelize[_0xbd7a('0x2')]},'userDisposition':{'type':Sequelize[_0xbd7a('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xbd7a('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xbd7a('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xbd7a('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xbd7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index bd982b2..2ca1c3a 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x2af672,_0x48dd4e){var _0x2127ef=function(_0x3ad7d7){while(--_0x3ad7d7){_0x2af672['push'](_0x2af672['shift']());}};_0x2127ef(++_0x48dd4e);}(_0xdb28,0x106));var _0x8db2=function(_0x5aecf5,_0x20b388){_0x5aecf5=_0x5aecf5-0x0;var _0x4ac826=_0xdb28[_0x5aecf5];return _0x4ac826;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','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','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xadb5,0xad));var _0x5adb=function(_0x20a662,_0x2676f7){_0x20a662=_0x20a662-0x0;var _0x124c21=_0xadb5[_0x20a662];return _0x124c21;};'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['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a3183f4..bbf4709 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 _0xe586=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x56592c,_0x1ba585){var _0x5985e2=function(_0x18e9fb){while(--_0x18e9fb){_0x56592c['push'](_0x56592c['shift']());}};_0x5985e2(++_0x1ba585);}(_0xe586,0xc8));var _0x6e58=function(_0x3fd450,_0x3537b1){_0x3fd450=_0x3fd450-0x0;var _0x1a16cc=_0xe586[_0x3fd450];return _0x1a16cc;};'use strict';var _=require(_0x6e58('0x0'));var util=require(_0x6e58('0x1'));var logger=require(_0x6e58('0x2'))('api');var moment=require(_0x6e58('0x3'));var BPromise=require(_0x6e58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e58('0x5'));var rimraf=require(_0x6e58('0x6'));var config=require(_0x6e58('0x7'));var attributes=require(_0x6e58('0x8'));module[_0x6e58('0x9')]=function(_0xc77f2a,_0x3fff2d){return _0xc77f2a[_0x6e58('0xa')](_0x6e58('0xb'),attributes,{'tableName':_0x6e58('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6e58('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa61d=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','moment','request-promise','path'];(function(_0x51d95d,_0x20a886){var _0x2ca247=function(_0x16a37e){while(--_0x16a37e){_0x51d95d['push'](_0x51d95d['shift']());}};_0x2ca247(++_0x20a886);}(_0xa61d,0x7f));var _0xda61=function(_0x30f7ef,_0x3ec7e0){_0x30f7ef=_0x30f7ef-0x0;var _0x595f63=_0xa61d[_0x30f7ef];return _0x595f63;};'use strict';var _=require(_0xda61('0x0'));var util=require(_0xda61('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xda61('0x2'));var BPromise=require('bluebird');var rp=require(_0xda61('0x3'));var fs=require('fs');var path=require(_0xda61('0x4'));var rimraf=require(_0xda61('0x5'));var config=require(_0xda61('0x6'));var attributes=require(_0xda61('0x7'));module[_0xda61('0x8')]=function(_0x2b94b9,_0x30781e){return _0x2b94b9[_0xda61('0x9')](_0xda61('0xa'),attributes,{'tableName':_0xda61('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b31e97d..92c721d 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 _0x785d=['UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceCallReport'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x785d,0x1b3));var _0xd785=function(_0x1e8f39,_0x81ddc6){_0x1e8f39=_0x1e8f39-0x0;var _0x3f9ef0=_0x785d[_0x1e8f39];return _0x3f9ef0;};'use strict';var _=require(_0xd785('0x0'));var util=require(_0xd785('0x1'));var moment=require(_0xd785('0x2'));var BPromise=require(_0xd785('0x3'));var rs=require(_0xd785('0x4'));var fs=require('fs');var Redis=require(_0xd785('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd785('0x6'));var logger=require(_0xd785('0x7'))('rpc');var config=require(_0xd785('0x8'));var jayson=require(_0xd785('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290679,_0x50599c,_0x579ff3){return new BPromise(function(_0x2158ec,_0x3e0196){return client[_0xd785('0xa')](_0x290679,_0x579ff3)['then'](function(_0x2af301){logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,_0xd785('0xd'));logger[_0xd785('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x50599c,_0xd785('0xd'),JSON[_0xd785('0xf')](_0x2af301));if(_0x2af301['error']){if(_0x2af301['error'][_0xd785('0x10')]===0x1f4){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x2af301[_0xd785('0x11')]['message']);return _0x3e0196(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}logger[_0xd785('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x50599c,_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);return _0x2158ec(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}else{logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,'request\x20sent');_0x2158ec(_0x2af301[_0xd785('0x13')][_0xd785('0x12')]);}})[_0xd785('0x14')](function(_0x467c1e){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x467c1e);_0x3e0196(_0x467c1e);});});}exports[_0xd785('0x15')]=function(_0x29d72d){var _0x3c974c=this;return new Promise(function(_0x2d4079,_0x54aab3){return db[_0xd785('0x16')]['findAll']({'raw':_0x29d72d['options']?_0x29d72d[_0xd785('0x17')][_0xd785('0x18')]===undefined?!![]:![]:!![],'where':_0x29d72d[_0xd785('0x17')]?_0x29d72d['options'][_0xd785('0x19')]||null:null,'attributes':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x1a')]||null:null,'limit':_0x29d72d[_0xd785('0x17')]?_0x29d72d['options'][_0xd785('0x1b')]||null:null,'include':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x1c')]?_[_0xd785('0x1d')](_0x29d72d[_0xd785('0x17')][_0xd785('0x1c')],function(_0x267772){return{'model':db[_0x267772['model']],'as':_0x267772['as'],'attributes':_0x267772['attributes'],'include':_0x267772[_0xd785('0x1c')]?_[_0xd785('0x1d')](_0x267772[_0xd785('0x1c')],function(_0x206fd9){return{'model':db[_0x206fd9[_0xd785('0x1e')]],'as':_0x206fd9['as'],'attributes':_0x206fd9[_0xd785('0x1a')],'include':_0x206fd9[_0xd785('0x1c')]?_[_0xd785('0x1d')](_0x206fd9[_0xd785('0x1c')],function(_0x3c7bf5){return{'model':db[_0x3c7bf5[_0xd785('0x1e')]],'as':_0x3c7bf5['as'],'attributes':_0x3c7bf5[_0xd785('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd785('0x1f')](function(_0x1218e0){logger[_0xd785('0xb')]('GetVoiceCallReport',_0x29d72d);logger[_0xd785('0xe')](_0xd785('0x15'),_0x29d72d,JSON['stringify'](_0x1218e0));_0x2d4079(_0x1218e0);})[_0xd785('0x14')](function(_0x1639dd){logger[_0xd785('0x11')](_0xd785('0x15'),_0x1639dd[_0xd785('0x12')],_0x29d72d);_0x54aab3(_0x3c974c[_0xd785('0x11')](0x1f4,_0x1639dd[_0xd785('0x12')]));});});};exports[_0xd785('0x20')]=function(_0x26d865){var _0x123c2d=this;return new Promise(function(_0x3701a4,_0x438e15){return db[_0xd785('0x16')]['create'](_0x26d865['body'],{'raw':_0x26d865['options']?_0x26d865[_0xd785('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd785('0x1f')](function(_0x27aac4){logger[_0xd785('0xb')](_0xd785('0x20'),_0x26d865);logger[_0xd785('0xe')]('CreateVoiceCallReport',_0x26d865,JSON['stringify'](_0x27aac4));_0x3701a4(_0x27aac4);})[_0xd785('0x14')](function(_0x5b5655){logger['error'](_0xd785('0x20'),_0x5b5655[_0xd785('0x12')],_0x26d865);_0x438e15(_0x123c2d[_0xd785('0x11')](0x1f4,_0x5b5655['message']));});});};exports[_0xd785('0x21')]=function(_0x58ccb4){var _0x25c37b=this;return new Promise(function(_0x46f680,_0x1bf922){return db[_0xd785('0x16')][_0xd785('0x22')](_0x58ccb4[_0xd785('0x23')],{'raw':_0x58ccb4[_0xd785('0x17')]?_0x58ccb4['options'][_0xd785('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ccb4[_0xd785('0x17')]?_0x58ccb4[_0xd785('0x17')]['where']||null:null,'attributes':_0x58ccb4['options']?_0x58ccb4[_0xd785('0x17')][_0xd785('0x1a')]||null:null,'limit':_0x58ccb4[_0xd785('0x17')]?_0x58ccb4[_0xd785('0x17')][_0xd785('0x1b')]||null:null})['then'](function(_0x5e3283){logger[_0xd785('0xb')](_0xd785('0x21'),_0x58ccb4);logger[_0xd785('0xe')](_0xd785('0x21'),_0x58ccb4,JSON[_0xd785('0xf')](_0x5e3283));_0x46f680(_0x5e3283);})['catch'](function(_0x4b331c){logger[_0xd785('0x11')]('UpdateVoiceCallReport',_0x4b331c['message'],_0x58ccb4);_0x1bf922(_0x25c37b[_0xd785('0x11')](0x1f4,_0x4b331c[_0xd785('0x12')]));});});}; \ No newline at end of file +var _0x9871=['GetVoiceCallReport','debug','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x9871,0x197));var _0x1987=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x9871[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x1987('0x0'));var util=require(_0x1987('0x1'));var moment=require('moment');var BPromise=require(_0x1987('0x2'));var rs=require(_0x1987('0x3'));var fs=require('fs');var Redis=require(_0x1987('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1987('0x5'));var logger=require(_0x1987('0x6'))(_0x1987('0x7'));var config=require(_0x1987('0x8'));var jayson=require(_0x1987('0x9'));var client=jayson[_0x1987('0xa')][_0x1987('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bec31,_0x25dc15,_0x1a9af1){return new BPromise(function(_0x23cebf,_0x5163e2){return client[_0x1987('0xc')](_0x2bec31,_0x1a9af1)[_0x1987('0xd')](function(_0x5c3452){logger[_0x1987('0xe')](_0x1987('0xf'),_0x25dc15,_0x1987('0x10'));logger['debug'](_0x1987('0x11'),_0x25dc15,_0x1987('0x10'),JSON[_0x1987('0x12')](_0x5c3452));if(_0x5c3452[_0x1987('0x13')]){if(_0x5c3452[_0x1987('0x13')]['code']===0x1f4){logger[_0x1987('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x25dc15,_0x5c3452['error'][_0x1987('0x14')]);return _0x5163e2(_0x5c3452['error'][_0x1987('0x14')]);}logger[_0x1987('0x13')](_0x1987('0xf'),_0x25dc15,_0x5c3452[_0x1987('0x13')][_0x1987('0x14')]);return _0x23cebf(_0x5c3452[_0x1987('0x13')][_0x1987('0x14')]);}else{logger[_0x1987('0xe')](_0x1987('0xf'),_0x25dc15,_0x1987('0x10'));_0x23cebf(_0x5c3452[_0x1987('0x15')][_0x1987('0x14')]);}})[_0x1987('0x16')](function(_0x2a0761){logger[_0x1987('0x13')](_0x1987('0xf'),_0x25dc15,_0x2a0761);_0x5163e2(_0x2a0761);});});}exports['GetVoiceCallReport']=function(_0x327c58){var _0x1868e8=this;return new Promise(function(_0x53d9d0,_0x2dec04){return db[_0x1987('0x17')][_0x1987('0x18')]({'raw':_0x327c58[_0x1987('0x19')]?_0x327c58[_0x1987('0x19')][_0x1987('0x1a')]===undefined?!![]:![]:!![],'where':_0x327c58[_0x1987('0x19')]?_0x327c58[_0x1987('0x19')][_0x1987('0x1b')]||null:null,'attributes':_0x327c58[_0x1987('0x19')]?_0x327c58['options'][_0x1987('0x1c')]||null:null,'limit':_0x327c58[_0x1987('0x19')]?_0x327c58['options'][_0x1987('0x1d')]||null:null,'include':_0x327c58[_0x1987('0x19')]?_0x327c58['options'][_0x1987('0x1e')]?_[_0x1987('0x1f')](_0x327c58[_0x1987('0x19')][_0x1987('0x1e')],function(_0x426d04){return{'model':db[_0x426d04[_0x1987('0x20')]],'as':_0x426d04['as'],'attributes':_0x426d04[_0x1987('0x1c')],'include':_0x426d04['include']?_['map'](_0x426d04[_0x1987('0x1e')],function(_0x5b69ca){return{'model':db[_0x5b69ca[_0x1987('0x20')]],'as':_0x5b69ca['as'],'attributes':_0x5b69ca[_0x1987('0x1c')],'include':_0x5b69ca[_0x1987('0x1e')]?_[_0x1987('0x1f')](_0x5b69ca[_0x1987('0x1e')],function(_0x3953dc){return{'model':db[_0x3953dc[_0x1987('0x20')]],'as':_0x3953dc['as'],'attributes':_0x3953dc[_0x1987('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1987('0xd')](function(_0x32f029){logger['info'](_0x1987('0x21'),_0x327c58);logger[_0x1987('0x22')](_0x1987('0x21'),_0x327c58,JSON[_0x1987('0x12')](_0x32f029));_0x53d9d0(_0x32f029);})[_0x1987('0x16')](function(_0x3728b6){logger['error'](_0x1987('0x21'),_0x3728b6[_0x1987('0x14')],_0x327c58);_0x2dec04(_0x1868e8[_0x1987('0x13')](0x1f4,_0x3728b6[_0x1987('0x14')]));});});};exports[_0x1987('0x23')]=function(_0x162f2f){var _0x1850d0=this;return new Promise(function(_0x54bc05,_0x5b8320){return db[_0x1987('0x17')][_0x1987('0x24')](_0x162f2f['body'],{'raw':_0x162f2f[_0x1987('0x19')]?_0x162f2f[_0x1987('0x19')][_0x1987('0x1a')]===undefined?!![]:![]:!![]})[_0x1987('0xd')](function(_0x2416be){logger[_0x1987('0xe')](_0x1987('0x23'),_0x162f2f);logger[_0x1987('0x22')](_0x1987('0x23'),_0x162f2f,JSON['stringify'](_0x2416be));_0x54bc05(_0x2416be);})['catch'](function(_0x36c2d6){logger[_0x1987('0x13')](_0x1987('0x23'),_0x36c2d6[_0x1987('0x14')],_0x162f2f);_0x5b8320(_0x1850d0[_0x1987('0x13')](0x1f4,_0x36c2d6[_0x1987('0x14')]));});});};exports[_0x1987('0x25')]=function(_0x5c464d){var _0x4bb7b0=this;return new Promise(function(_0x19b934,_0x3e214a){return db[_0x1987('0x17')][_0x1987('0x26')](_0x5c464d[_0x1987('0x27')],{'raw':_0x5c464d[_0x1987('0x19')]?_0x5c464d[_0x1987('0x19')][_0x1987('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c464d[_0x1987('0x19')]?_0x5c464d['options']['where']||null:null,'attributes':_0x5c464d[_0x1987('0x19')]?_0x5c464d['options'][_0x1987('0x1c')]||null:null,'limit':_0x5c464d[_0x1987('0x19')]?_0x5c464d[_0x1987('0x19')]['limit']||null:null})[_0x1987('0xd')](function(_0x563ff3){logger['info'](_0x1987('0x25'),_0x5c464d);logger[_0x1987('0x22')](_0x1987('0x25'),_0x5c464d,JSON['stringify'](_0x563ff3));_0x19b934(_0x563ff3);})[_0x1987('0x16')](function(_0x75dce9){logger[_0x1987('0x13')](_0x1987('0x25'),_0x75dce9[_0x1987('0x14')],_0x5c464d);_0x3e214a(_0x4bb7b0[_0x1987('0x13')](0x1f4,_0x75dce9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index d41b570..569e5d6 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 _0x87b4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x87b4,0x1c7));var _0x487b=function(_0x34fb70,_0x28c51b){_0x34fb70=_0x34fb70-0x0;var _0x4c6a36=_0x87b4[_0x34fb70];return _0x4c6a36;};'use strict';var multer=require(_0x487b('0x0'));var util=require(_0x487b('0x1'));var path=require(_0x487b('0x2'));var timeout=require(_0x487b('0x3'));var express=require('express');var router=express[_0x487b('0x4')]();var fs_extra=require(_0x487b('0x5'));var auth=require(_0x487b('0x6'));var interaction=require(_0x487b('0x7'));var config=require(_0x487b('0x8'));var controller=require(_0x487b('0x9'));router[_0x487b('0xa')]('/',auth[_0x487b('0xb')](),controller[_0x487b('0xc')]);router[_0x487b('0xa')](_0x487b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x487b('0xe')]('/',auth[_0x487b('0xb')](),controller[_0x487b('0xf')]);router[_0x487b('0x10')]('/:id',auth[_0x487b('0xb')](),controller[_0x487b('0x11')]);router[_0x487b('0x12')](_0x487b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x487b('0x13')]=router; \ No newline at end of file +var _0xeb2f=['isAuthenticated','index','/:id','show','create','put','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x497cdb,_0x12fc43){var _0x39e664=function(_0x3a61c1){while(--_0x3a61c1){_0x497cdb['push'](_0x497cdb['shift']());}};_0x39e664(++_0x12fc43);}(_0xeb2f,0x1e4));var _0xfeb2=function(_0x172581,_0x1c2351){_0x172581=_0x172581-0x0;var _0x4b10a9=_0xeb2f[_0x172581];return _0x4b10a9;};'use strict';var multer=require('multer');var util=require(_0xfeb2('0x0'));var path=require('path');var timeout=require(_0xfeb2('0x1'));var express=require(_0xfeb2('0x2'));var router=express[_0xfeb2('0x3')]();var fs_extra=require(_0xfeb2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfeb2('0x5'));var config=require(_0xfeb2('0x6'));var controller=require(_0xfeb2('0x7'));router[_0xfeb2('0x8')]('/',auth[_0xfeb2('0x9')](),controller[_0xfeb2('0xa')]);router[_0xfeb2('0x8')](_0xfeb2('0xb'),auth['isAuthenticated'](),controller[_0xfeb2('0xc')]);router['post']('/',auth[_0xfeb2('0x9')](),controller[_0xfeb2('0xd')]);router[_0xfeb2('0xe')](_0xfeb2('0xb'),auth[_0xfeb2('0x9')](),controller[_0xfeb2('0xf')]);router[_0xfeb2('0x10')](_0xfeb2('0xb'),auth[_0xfeb2('0x9')](),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 6b279db..3a9a3f9 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 _0x7029=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x40bfb8,_0x5075a0){var _0x3950e5=function(_0x494453){while(--_0x494453){_0x40bfb8['push'](_0x40bfb8['shift']());}};_0x3950e5(++_0x5075a0);}(_0x7029,0x1d0));var _0x9702=function(_0x3bce7a,_0x352801){_0x3bce7a=_0x3bce7a-0x0;var _0x9785a6=_0x7029[_0x3bce7a];return _0x9785a6;};'use strict';var Sequelize=require(_0x9702('0x0'));module[_0x9702('0x1')]={'name':{'type':Sequelize[_0x9702('0x2')]},'prefix':{'type':Sequelize[_0x9702('0x2')],'unique':_0x9702('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x9702('0x2')],'set':function(_0x5606ed){this[_0x9702('0x4')](_0x9702('0x5'),_0x5606ed?_0x5606ed[_0x9702('0x6')](''):[]);},'get':function(){return this[_0x9702('0x7')](_0x9702('0x5'))?this[_0x9702('0x7')]('options')[_0x9702('0x8')](''):[];}},'auth':{'type':Sequelize[_0x9702('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x9702('0x2')]},'record':{'type':Sequelize[_0x9702('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9702('0x2')]},'description':{'type':Sequelize[_0x9702('0x2')]}}; \ No newline at end of file +var _0x7236=['setDataValue','BOOLEAN','sequelize','exports','name','STRING'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x7236,0xe0));var _0x6723=function(_0x1424ae,_0x153651){_0x1424ae=_0x1424ae-0x0;var _0x4a5bc6=_0x7236[_0x1424ae];return _0x4a5bc6;};'use strict';var Sequelize=require(_0x6723('0x0'));module[_0x6723('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x6723('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x6723('0x3')],'set':function(_0x4a7d74){this[_0x6723('0x4')]('options',_0x4a7d74?_0x4a7d74['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this['getDataValue']('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x6723('0x5')],'defaultValue':![]},'password':{'type':Sequelize[_0x6723('0x3')]},'record':{'type':Sequelize[_0x6723('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6723('0x3')]},'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 440bdc3..baa687b 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 _0xf2a6=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceChanSpy','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','bluebird'];(function(_0x576f60,_0x5522de){var _0x364982=function(_0x47932d){while(--_0x47932d){_0x576f60['push'](_0x576f60['shift']());}};_0x364982(++_0x5522de);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x11ecc8,_0x44edcf){_0x11ecc8=_0x11ecc8-0x0;var _0x21057d=_0xf2a6[_0x11ecc8];return _0x21057d;};'use strict';var emlformat=require(_0x6f2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6f2a('0x1'));var moment=require('moment');var BPromise=require(_0x6f2a('0x2'));var Mustache=require(_0x6f2a('0x3'));var util=require(_0x6f2a('0x4'));var path=require(_0x6f2a('0x5'));var sox=require(_0x6f2a('0x6'));var csv=require(_0x6f2a('0x7'));var ejs=require(_0x6f2a('0x8'));var fs=require('fs');var fs_extra=require(_0x6f2a('0x9'));var _=require(_0x6f2a('0xa'));var squel=require(_0x6f2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f2a('0xc'));var deskjs=require(_0x6f2a('0xd'));var toCsv=require(_0x6f2a('0x7'));var querystring=require(_0x6f2a('0xe'));var Papa=require('papaparse');var Redis=require(_0x6f2a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6f2a('0x10'));var as=require(_0x6f2a('0x11'));var hardwareService=require(_0x6f2a('0x12'));var logger=require('../../config/logger')(_0x6f2a('0x13'));var utils=require('../../config/utils');var config=require(_0x6f2a('0x14'));var licenseUtil=require(_0x6f2a('0x15'));var db=require(_0x6f2a('0x16'))['db'];function respondWithStatusCode(_0x59df4e,_0x46a54f){_0x46a54f=_0x46a54f||0xcc;return function(_0x4f1b32){if(_0x4f1b32){return _0x59df4e[_0x6f2a('0x17')](_0x46a54f);}return _0x59df4e[_0x6f2a('0x18')](_0x46a54f)[_0x6f2a('0x19')]();};}function respondWithResult(_0x421e15,_0xe24075){_0xe24075=_0xe24075||0xc8;return function(_0x5224e6){if(_0x5224e6){return _0x421e15[_0x6f2a('0x18')](_0xe24075)[_0x6f2a('0x1a')](_0x5224e6);}};}function respondWithFilteredResult(_0x27ca04,_0x44b317){return function(_0x1057f2){if(_0x1057f2){var _0x3dfc44=typeof _0x44b317[_0x6f2a('0x1b')]===_0x6f2a('0x1c')&&typeof _0x44b317[_0x6f2a('0x1d')]===_0x6f2a('0x1c');var _0x2aaed5=_0x1057f2[_0x6f2a('0x1e')];var _0x5c408b=_0x3dfc44?0x0:_0x44b317[_0x6f2a('0x1b')];var _0x3171b9=_0x3dfc44?_0x1057f2[_0x6f2a('0x1e')]:_0x44b317[_0x6f2a('0x1b')]+_0x44b317[_0x6f2a('0x1d')];var _0x43602b;if(_0x3171b9>=_0x2aaed5){_0x3171b9=_0x2aaed5;_0x43602b=0xc8;}else{_0x43602b=0xce;}_0x27ca04[_0x6f2a('0x18')](_0x43602b);return _0x27ca04[_0x6f2a('0x1f')](_0x6f2a('0x20'),_0x5c408b+'-'+_0x3171b9+'/'+_0x2aaed5)[_0x6f2a('0x1a')](_0x1057f2);}return null;};}function patchUpdates(_0x33554f){return function(_0x4eca00){try{jsonpatch[_0x6f2a('0x21')](_0x4eca00,_0x33554f,!![]);}catch(_0x20e7ff){return BPromise[_0x6f2a('0x22')](_0x20e7ff);}return _0x4eca00[_0x6f2a('0x23')]();};}function saveUpdates(_0x1da29f,_0x108b8b){return function(_0x28a8c2){if(_0x28a8c2){return _0x28a8c2['update'](_0x1da29f)[_0x6f2a('0x24')](function(_0x590c40){return _0x590c40;});}return null;};}function removeEntity(_0xb7de5a,_0x301aa9){return function(_0x148240){if(_0x148240){return _0x148240['destroy']()[_0x6f2a('0x24')](function(){var _0xb7cd00=_0x148240['get']({'plain':!![]});var _0x55c1bc=_0x6f2a('0x25');return db[_0x6f2a('0x26')][_0x6f2a('0x27')]({'where':{'type':_0x55c1bc,'resourceId':_0xb7cd00['id']}})[_0x6f2a('0x24')](function(){return _0x148240;});})[_0x6f2a('0x24')](function(){_0xb7de5a['status'](0xcc)[_0x6f2a('0x19')]();});}};}function handleEntityNotFound(_0x549dd7,_0x3ac571){return function(_0xd64d6){if(!_0xd64d6){_0x549dd7['sendStatus'](0x194);}return _0xd64d6;};}function handleError(_0x3973e8,_0x409ea4){_0x409ea4=_0x409ea4||0x1f4;return function(_0x498d7e){logger[_0x6f2a('0x28')](_0x498d7e[_0x6f2a('0x29')]);if(_0x498d7e[_0x6f2a('0x2a')]){delete _0x498d7e[_0x6f2a('0x2a')];}_0x3973e8[_0x6f2a('0x18')](_0x409ea4)[_0x6f2a('0x2b')](_0x498d7e);};}exports[_0x6f2a('0x2c')]=function(_0x4da5dc,_0xb0f466){var _0x5a0a3c={},_0x34acb0={},_0x4e188f={'count':0x0,'rows':[]};var _0x34b78e=_[_0x6f2a('0x2d')](db[_0x6f2a('0x2e')]['rawAttributes'],function(_0xedbbba){return{'name':_0xedbbba['fieldName'],'type':_0xedbbba[_0x6f2a('0x2f')][_0x6f2a('0x30')]};});_0x34acb0['model']=_[_0x6f2a('0x2d')](_0x34b78e,_0x6f2a('0x2a'));_0x34acb0[_0x6f2a('0x31')]=_['keys'](_0x4da5dc['query']);_0x34acb0['filters']=_[_0x6f2a('0x32')](_0x34acb0['model'],_0x34acb0[_0x6f2a('0x31')]);_0x5a0a3c[_0x6f2a('0x33')]=_['intersection'](_0x34acb0[_0x6f2a('0x34')],qs[_0x6f2a('0x35')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x35')]));_0x5a0a3c['attributes']=_0x5a0a3c[_0x6f2a('0x33')]['length']?_0x5a0a3c[_0x6f2a('0x33')]:_0x34acb0[_0x6f2a('0x34')];if(!_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x5a0a3c[_0x6f2a('0x1d')]=qs[_0x6f2a('0x1d')](_0x4da5dc['query'][_0x6f2a('0x1d')]);_0x5a0a3c[_0x6f2a('0x1b')]=qs[_0x6f2a('0x1b')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x1b')]);}_0x5a0a3c[_0x6f2a('0x38')]=qs[_0x6f2a('0x39')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x39')]);_0x5a0a3c[_0x6f2a('0x3a')]=qs[_0x6f2a('0x3b')](_['pick'](_0x4da5dc[_0x6f2a('0x31')],_0x34acb0[_0x6f2a('0x3b')]),_0x34b78e);if(_0x4da5dc[_0x6f2a('0x31')]['filter']){_0x5a0a3c[_0x6f2a('0x3a')]=_[_0x6f2a('0x3c')](_0x5a0a3c[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x34b78e,function(_0x2dfd7d){if(_0x2dfd7d[_0x6f2a('0x2f')]!==_0x6f2a('0x3d')){var _0x44c61d={};_0x44c61d[_0x2dfd7d[_0x6f2a('0x2a')]]={'$like':'%'+_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x3e')]+'%'};return _0x44c61d;}})});}_0x5a0a3c=_['merge']({},_0x5a0a3c,_0x4da5dc[_0x6f2a('0x3f')]);var _0xccc1c={'where':_0x5a0a3c[_0x6f2a('0x3a')]};return db['VoiceChanSpy'][_0x6f2a('0x1e')](_0xccc1c)[_0x6f2a('0x24')](function(_0x14f869){_0x4e188f[_0x6f2a('0x1e')]=_0x14f869;if(_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x40')]){_0x5a0a3c[_0x6f2a('0x41')]=[{'all':!![]}];}return db[_0x6f2a('0x2e')]['findAll'](_0x5a0a3c);})[_0x6f2a('0x24')](function(_0x5be543){_0x4e188f['rows']=_0x5be543;return _0x4e188f;})[_0x6f2a('0x24')](respondWithFilteredResult(_0xb0f466,_0x5a0a3c))[_0x6f2a('0x42')](handleError(_0xb0f466,null));};exports[_0x6f2a('0x43')]=function(_0xfe3724,_0x4b5782){var _0x3e43cd={'raw':![],'where':{'id':_0xfe3724[_0x6f2a('0x44')]['id']}},_0x10bf26={};_0x10bf26[_0x6f2a('0x34')]=_[_0x6f2a('0x45')](db[_0x6f2a('0x2e')]['rawAttributes']);_0x10bf26[_0x6f2a('0x31')]=_[_0x6f2a('0x45')](_0xfe3724[_0x6f2a('0x31')]);_0x10bf26[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x10bf26[_0x6f2a('0x34')],_0x10bf26['query']);_0x3e43cd['attributes']=_[_0x6f2a('0x32')](_0x10bf26['model'],qs[_0x6f2a('0x35')](_0xfe3724['query'][_0x6f2a('0x35')]));_0x3e43cd[_0x6f2a('0x33')]=_0x3e43cd['attributes']['length']?_0x3e43cd['attributes']:_0x10bf26[_0x6f2a('0x34')];if(_0xfe3724['query']['includeAll']){_0x3e43cd[_0x6f2a('0x41')]=[{'all':!![]}];}_0x3e43cd=_[_0x6f2a('0x3c')]({},_0x3e43cd,_0xfe3724[_0x6f2a('0x3f')]);return db[_0x6f2a('0x2e')]['find'](_0x3e43cd)[_0x6f2a('0x24')](handleEntityNotFound(_0x4b5782,null))[_0x6f2a('0x24')](respondWithResult(_0x4b5782,null))[_0x6f2a('0x42')](handleError(_0x4b5782,null));};exports[_0x6f2a('0x46')]=function(_0x3d8f60,_0xb59bd1){return db['VoiceChanSpy'][_0x6f2a('0x46')](_0x3d8f60[_0x6f2a('0x47')],{})[_0x6f2a('0x24')](function(_0xfd6940){var _0x1f6a48=_0x3d8f60[_0x6f2a('0x48')]['get']({'plain':!![]});if(!_0x1f6a48)throw new Error(_0x6f2a('0x49'));if(_0x1f6a48[_0x6f2a('0x4a')]===_0x6f2a('0x48')){var _0x5e72fe=_0xfd6940['get']({'plain':!![]});var _0x435fec=_0x6f2a('0x25');return db[_0x6f2a('0x4b')][_0x6f2a('0x4c')]({'where':{'name':_0x435fec,'userProfileId':_0x1f6a48[_0x6f2a('0x4d')]},'raw':!![]})[_0x6f2a('0x24')](function(_0x450160){if(_0x450160&&_0x450160[_0x6f2a('0x4e')]===0x0){return db[_0x6f2a('0x26')][_0x6f2a('0x46')]({'name':_0x5e72fe[_0x6f2a('0x2a')],'resourceId':_0x5e72fe['id'],'type':_0x450160[_0x6f2a('0x2a')],'sectionId':_0x450160['id']},{})[_0x6f2a('0x24')](function(){return _0xfd6940;});}else{return _0xfd6940;}})['catch'](function(_0x2c26fc){logger['error'](_0x6f2a('0x4f'),_0x2c26fc);throw _0x2c26fc;});}return _0xfd6940;})['then'](respondWithResult(_0xb59bd1,0xc9))[_0x6f2a('0x42')](handleError(_0xb59bd1,null));};exports['update']=function(_0x13d759,_0x1c1ad9){if(_0x13d759[_0x6f2a('0x47')]['id']){delete _0x13d759['body']['id'];}return db[_0x6f2a('0x2e')]['find']({'where':{'id':_0x13d759[_0x6f2a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c1ad9,null))['then'](saveUpdates(_0x13d759[_0x6f2a('0x47')],null))[_0x6f2a('0x24')](respondWithResult(_0x1c1ad9,null))[_0x6f2a('0x42')](handleError(_0x1c1ad9,null));};exports[_0x6f2a('0x27')]=function(_0x429acf,_0x30f41f){return db[_0x6f2a('0x2e')]['find']({'where':{'id':_0x429acf[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x30f41f,null))[_0x6f2a('0x24')](removeEntity(_0x30f41f,null))[_0x6f2a('0x42')](handleError(_0x30f41f,null));}; \ No newline at end of file +var _0x544a=['ChanSpies','UserProfileResource','destroy','end','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','get'];(function(_0x43992a,_0x42bfc6){var _0x13964d=function(_0x22dd9d){while(--_0x22dd9d){_0x43992a['push'](_0x43992a['shift']());}};_0x13964d(++_0x42bfc6);}(_0x544a,0x118));var _0xa544=function(_0x531777,_0x3aafa8){_0x531777=_0x531777-0x0;var _0x1799f6=_0x544a[_0x531777];return _0x1799f6;};'use strict';var emlformat=require(_0xa544('0x0'));var rimraf=require(_0xa544('0x1'));var zipdir=require(_0xa544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa544('0x3'));var BPromise=require(_0xa544('0x4'));var Mustache=require(_0xa544('0x5'));var util=require(_0xa544('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa544('0x7'));var fs=require('fs');var fs_extra=require(_0xa544('0x8'));var _=require(_0xa544('0x9'));var squel=require('squel');var crypto=require(_0xa544('0xa'));var jsforce=require(_0xa544('0xb'));var deskjs=require(_0xa544('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa544('0xd'));var Papa=require(_0xa544('0xe'));var Redis=require(_0xa544('0xf'));var authService=require(_0xa544('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa544('0x11'));var hardwareService=require(_0xa544('0x12'));var logger=require(_0xa544('0x13'))(_0xa544('0x14'));var utils=require(_0xa544('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa544('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5388,_0x49bdea){_0x49bdea=_0x49bdea||0xcc;return function(_0x3de77b){if(_0x3de77b){return _0x5c5388[_0xa544('0x17')](_0x49bdea);}return _0x5c5388['status'](_0x49bdea)['end']();};}function respondWithResult(_0x53ed57,_0x3736e3){_0x3736e3=_0x3736e3||0xc8;return function(_0xe13644){if(_0xe13644){return _0x53ed57[_0xa544('0x18')](_0x3736e3)['json'](_0xe13644);}};}function respondWithFilteredResult(_0xd59245,_0xb9ecf7){return function(_0x8f8bfa){if(_0x8f8bfa){var _0x25c611=typeof _0xb9ecf7[_0xa544('0x19')]===_0xa544('0x1a')&&typeof _0xb9ecf7['limit']===_0xa544('0x1a');var _0x37c0c0=_0x8f8bfa['count'];var _0x5ddb99=_0x25c611?0x0:_0xb9ecf7[_0xa544('0x19')];var _0x3b423b=_0x25c611?_0x8f8bfa[_0xa544('0x1b')]:_0xb9ecf7[_0xa544('0x19')]+_0xb9ecf7[_0xa544('0x1c')];var _0x1a2dfb;if(_0x3b423b>=_0x37c0c0){_0x3b423b=_0x37c0c0;_0x1a2dfb=0xc8;}else{_0x1a2dfb=0xce;}_0xd59245[_0xa544('0x18')](_0x1a2dfb);return _0xd59245[_0xa544('0x1d')](_0xa544('0x1e'),_0x5ddb99+'-'+_0x3b423b+'/'+_0x37c0c0)[_0xa544('0x1f')](_0x8f8bfa);}return null;};}function patchUpdates(_0x19912e){return function(_0x317d10){try{jsonpatch[_0xa544('0x20')](_0x317d10,_0x19912e,!![]);}catch(_0xb6c18){return BPromise[_0xa544('0x21')](_0xb6c18);}return _0x317d10['save']();};}function saveUpdates(_0x4d9a8f,_0x463698){return function(_0x2fea4b){if(_0x2fea4b){return _0x2fea4b['update'](_0x4d9a8f)[_0xa544('0x22')](function(_0x272540){return _0x272540;});}return null;};}function removeEntity(_0xbda5ab,_0x12d6cf){return function(_0x3ad30a){if(_0x3ad30a){return _0x3ad30a['destroy']()['then'](function(){var _0xe9bea3=_0x3ad30a[_0xa544('0x23')]({'plain':!![]});var _0x220cf9=_0xa544('0x24');return db[_0xa544('0x25')][_0xa544('0x26')]({'where':{'type':_0x220cf9,'resourceId':_0xe9bea3['id']}})['then'](function(){return _0x3ad30a;});})[_0xa544('0x22')](function(){_0xbda5ab[_0xa544('0x18')](0xcc)[_0xa544('0x27')]();});}};}function handleEntityNotFound(_0x453e37,_0x4675c9){return function(_0x3f464c){if(!_0x3f464c){_0x453e37[_0xa544('0x17')](0x194);}return _0x3f464c;};}function handleError(_0x442a69,_0x3f422d){_0x3f422d=_0x3f422d||0x1f4;return function(_0x17d6bb){logger['error'](_0x17d6bb['stack']);if(_0x17d6bb[_0xa544('0x28')]){delete _0x17d6bb[_0xa544('0x28')];}_0x442a69[_0xa544('0x18')](_0x3f422d)[_0xa544('0x29')](_0x17d6bb);};}exports[_0xa544('0x2a')]=function(_0x18149e,_0x5835dd){var _0x208362={},_0x4478ec={},_0x4d8245={'count':0x0,'rows':[]};var _0x5c8705=_['map'](db[_0xa544('0x2b')][_0xa544('0x2c')],function(_0x83bfb2){return{'name':_0x83bfb2[_0xa544('0x2d')],'type':_0x83bfb2[_0xa544('0x2e')]['key']};});_0x4478ec[_0xa544('0x2f')]=_[_0xa544('0x30')](_0x5c8705,_0xa544('0x28'));_0x4478ec['query']=_[_0xa544('0x31')](_0x18149e[_0xa544('0x32')]);_0x4478ec[_0xa544('0x33')]=_[_0xa544('0x34')](_0x4478ec[_0xa544('0x2f')],_0x4478ec[_0xa544('0x32')]);_0x208362['attributes']=_[_0xa544('0x34')](_0x4478ec[_0xa544('0x2f')],qs['fields'](_0x18149e['query'][_0xa544('0x35')]));_0x208362[_0xa544('0x36')]=_0x208362[_0xa544('0x36')][_0xa544('0x37')]?_0x208362[_0xa544('0x36')]:_0x4478ec[_0xa544('0x2f')];if(!_0x18149e[_0xa544('0x32')][_0xa544('0x38')]('nolimit')){_0x208362['limit']=qs[_0xa544('0x1c')](_0x18149e[_0xa544('0x32')][_0xa544('0x1c')]);_0x208362[_0xa544('0x19')]=qs[_0xa544('0x19')](_0x18149e[_0xa544('0x32')][_0xa544('0x19')]);}_0x208362[_0xa544('0x39')]=qs[_0xa544('0x3a')](_0x18149e[_0xa544('0x32')]['sort']);_0x208362[_0xa544('0x3b')]=qs['filters'](_['pick'](_0x18149e[_0xa544('0x32')],_0x4478ec[_0xa544('0x33')]),_0x5c8705);if(_0x18149e[_0xa544('0x32')][_0xa544('0x3c')]){_0x208362[_0xa544('0x3b')]=_[_0xa544('0x3d')](_0x208362[_0xa544('0x3b')],{'$or':_['map'](_0x5c8705,function(_0x55ba3f){if(_0x55ba3f['type']!==_0xa544('0x3e')){var _0x20b5f1={};_0x20b5f1[_0x55ba3f['name']]={'$like':'%'+_0x18149e[_0xa544('0x32')]['filter']+'%'};return _0x20b5f1;}})});}_0x208362=_[_0xa544('0x3d')]({},_0x208362,_0x18149e['options']);var _0x55f2c8={'where':_0x208362[_0xa544('0x3b')]};return db[_0xa544('0x2b')][_0xa544('0x1b')](_0x55f2c8)[_0xa544('0x22')](function(_0x799b68){_0x4d8245[_0xa544('0x1b')]=_0x799b68;if(_0x18149e[_0xa544('0x32')][_0xa544('0x3f')]){_0x208362[_0xa544('0x40')]=[{'all':!![]}];}return db[_0xa544('0x2b')]['findAll'](_0x208362);})[_0xa544('0x22')](function(_0x18ab11){_0x4d8245[_0xa544('0x41')]=_0x18ab11;return _0x4d8245;})[_0xa544('0x22')](respondWithFilteredResult(_0x5835dd,_0x208362))[_0xa544('0x42')](handleError(_0x5835dd,null));};exports[_0xa544('0x43')]=function(_0x13eb1e,_0x508cce){var _0x40939b={'raw':![],'where':{'id':_0x13eb1e[_0xa544('0x44')]['id']}},_0x1a04a4={};_0x1a04a4['model']=_['keys'](db[_0xa544('0x2b')]['rawAttributes']);_0x1a04a4[_0xa544('0x32')]=_[_0xa544('0x31')](_0x13eb1e[_0xa544('0x32')]);_0x1a04a4[_0xa544('0x33')]=_['intersection'](_0x1a04a4[_0xa544('0x2f')],_0x1a04a4[_0xa544('0x32')]);_0x40939b['attributes']=_[_0xa544('0x34')](_0x1a04a4[_0xa544('0x2f')],qs[_0xa544('0x35')](_0x13eb1e[_0xa544('0x32')][_0xa544('0x35')]));_0x40939b['attributes']=_0x40939b[_0xa544('0x36')][_0xa544('0x37')]?_0x40939b[_0xa544('0x36')]:_0x1a04a4[_0xa544('0x2f')];if(_0x13eb1e[_0xa544('0x32')]['includeAll']){_0x40939b[_0xa544('0x40')]=[{'all':!![]}];}_0x40939b=_['merge']({},_0x40939b,_0x13eb1e['options']);return db[_0xa544('0x2b')][_0xa544('0x45')](_0x40939b)[_0xa544('0x22')](handleEntityNotFound(_0x508cce,null))['then'](respondWithResult(_0x508cce,null))[_0xa544('0x42')](handleError(_0x508cce,null));};exports[_0xa544('0x46')]=function(_0x2b0f4a,_0x17504f){return db[_0xa544('0x2b')][_0xa544('0x46')](_0x2b0f4a[_0xa544('0x47')],{})['then'](function(_0x3dfa06){var _0x4d0423=_0x2b0f4a[_0xa544('0x48')][_0xa544('0x23')]({'plain':!![]});if(!_0x4d0423)throw new Error(_0xa544('0x49'));if(_0x4d0423['role']===_0xa544('0x48')){var _0x2890d2=_0x3dfa06[_0xa544('0x23')]({'plain':!![]});var _0x3fa211=_0xa544('0x24');return db[_0xa544('0x4a')]['find']({'where':{'name':_0x3fa211,'userProfileId':_0x4d0423['userProfileId']},'raw':!![]})[_0xa544('0x22')](function(_0x5dad55){if(_0x5dad55&&_0x5dad55[_0xa544('0x4b')]===0x0){return db[_0xa544('0x25')]['create']({'name':_0x2890d2[_0xa544('0x28')],'resourceId':_0x2890d2['id'],'type':_0x5dad55[_0xa544('0x28')],'sectionId':_0x5dad55['id']},{})[_0xa544('0x22')](function(){return _0x3dfa06;});}else{return _0x3dfa06;}})[_0xa544('0x42')](function(_0x14cc36){logger[_0xa544('0x4c')](_0xa544('0x4d'),_0x14cc36);throw _0x14cc36;});}return _0x3dfa06;})[_0xa544('0x22')](respondWithResult(_0x17504f,0xc9))[_0xa544('0x42')](handleError(_0x17504f,null));};exports[_0xa544('0x4e')]=function(_0x1f5e22,_0x307119){if(_0x1f5e22['body']['id']){delete _0x1f5e22['body']['id'];}return db[_0xa544('0x2b')][_0xa544('0x45')]({'where':{'id':_0x1f5e22[_0xa544('0x44')]['id']}})['then'](handleEntityNotFound(_0x307119,null))['then'](saveUpdates(_0x1f5e22['body'],null))[_0xa544('0x22')](respondWithResult(_0x307119,null))[_0xa544('0x42')](handleError(_0x307119,null));};exports['destroy']=function(_0x3dc061,_0x54c2a4){return db['VoiceChanSpy'][_0xa544('0x45')]({'where':{'id':_0x3dc061['params']['id']}})[_0xa544('0x22')](handleEntityNotFound(_0x54c2a4,null))['then'](removeEntity(_0x54c2a4,null))['catch'](handleError(_0x54c2a4,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9703bf4..1bd002c 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 _0x9383=['destroy','VoiceExtension','lodash','./voiceChanSpy.attributes','context','format','%s%s','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','agent','exports','models','define','VoiceChanSpy','then','bulkCreate','catch'];(function(_0x4480c1,_0x319692){var _0x1e040b=function(_0x5ddb94){while(--_0x5ddb94){_0x4480c1['push'](_0x4480c1['shift']());}};_0x1e040b(++_0x319692);}(_0x9383,0x6e));var _0x3938=function(_0x37206b,_0x18fb8a){_0x37206b=_0x37206b-0x0;var _0x2f42ac=_0x9383[_0x37206b];return _0x2f42ac;};'use strict';var _=require(_0x3938('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x3938('0x1'));var getUserApplications=function(_0x2cd073,_0x435614,_0x182f19){var _0x23a508=0x1;var _0x2af90c=[];var _0x529fa5={'context':_0x435614[_0x3938('0x2')]||'from-sip','exten':util[_0x3938('0x3')](_0x3938('0x4'),_0x2cd073['prefix'],_0x182f19),'type':_0x3938('0x5'),'isApp':![],'ChanSpyId':_0x2cd073['id'],'UserId':_0x435614['id']};_0x2af90c['push'](_[_0x3938('0x6')]({'app':_0x3938('0x7'),'appdata':util['format'](_0x3938('0x8'),_0x3938('0x9')),'priority':_0x23a508++},_0x529fa5));if(_0x2cd073[_0x3938('0xa')]){_0x2af90c[_0x3938('0xb')](_[_0x3938('0x6')]({'app':_0x3938('0xc'),'appdata':util[_0x3938('0x3')](_0x3938('0xd'),_0x2cd073['recordingFormat']),'priority':_0x23a508++},_0x529fa5));}if(_0x2cd073[_0x3938('0xe')]){_0x2af90c[_0x3938('0xb')](_[_0x3938('0x6')]({'app':_0x3938('0xf'),'appdata':_0x2cd073[_0x3938('0x10')],'priority':_0x23a508++},_0x529fa5));}_0x2af90c['push'](_[_0x3938('0x6')]({'app':_0x3938('0x11'),'appdata':util[_0x3938('0x3')](_0x3938('0x12'),_0x435614[_0x3938('0x13')],_0x2cd073[_0x3938('0x14')]?_0x2cd073[_0x3938('0x14')][_0x3938('0x15')](''):''),'priority':_0x23a508++},_0x529fa5));if(_0x2cd073['record']){_0x2af90c['push'](_['merge']({'app':'StopMixMonitor','priority':_0x23a508++},_0x529fa5));}return _0x2af90c;};var getChanSpyApplications=function(_0x1d504a,_0x3be7e2){var _0x306d39=[];for(var _0x555706=0x0,_0x2e65fb=0x1;_0x555706<_0x3be7e2[_0x3938('0x16')];_0x555706++,_0x2e65fb=0x1){_0x306d39=_0x306d39[_0x3938('0x17')](getUserApplications(_0x1d504a,_0x3be7e2[_0x555706],_0x3be7e2[_0x555706]['internal']));if(_0x3be7e2[_0x555706][_0x3938('0x18')]!=_0x3be7e2[_0x555706][_0x3938('0x13')]){_0x306d39=_0x306d39['concat'](getUserApplications(_0x1d504a,_0x3be7e2[_0x555706],_0x3be7e2[_0x555706][_0x3938('0x13')]));}}return _0x306d39;};var getChanSpyPromise=function(_0x5edd72,_0x9bbaae){return new BPromise(function(_0x358d43,_0x11ea05){return _0x5edd72[_0x3938('0x19')]['findAll']({'attributes':['id','name',_0x3938('0x18')],'where':{'role':_0x3938('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x539616){if(_0x539616){return _0x358d43(getChanSpyApplications(_0x9bbaae,_0x539616));}return _0x358d43([]);})['catch'](function(_0x17a9ba){_0x11ea05(_0x17a9ba);});});};module[_0x3938('0x1b')]=function(_0x393ff7,_0x5f4610){var _0x4e4b0d=_0x393ff7[_0x3938('0x1c')];return _0x393ff7[_0x3938('0x1d')](_0x3938('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d9310,_0x2fc301,_0x1cd0ce){return getChanSpyPromise(_0x4e4b0d,_0x4d9310)[_0x3938('0x1f')](function(_0xec35d6){if(_0xec35d6&&_0xec35d6[_0x3938('0x16')]){return _0x4e4b0d['VoiceExtension'][_0x3938('0x20')](_0xec35d6);}})['then'](function(){_0x1cd0ce();})[_0x3938('0x21')](function(_0x264d7f){_0x1cd0ce(_0x264d7f);});},'afterUpdate':function(_0x5e3864,_0x1d52aa,_0x5b7f3f){return _0x4e4b0d['VoiceExtension'][_0x3938('0x22')]({'where':{'ChanSpyId':_0x5e3864['id']}})[_0x3938('0x1f')](function(){return getChanSpyPromise(_0x4e4b0d,_0x5e3864);})['then'](function(_0x6b43fd){if(_0x6b43fd&&_0x6b43fd['length']){return _0x4e4b0d[_0x3938('0x23')][_0x3938('0x20')](_0x6b43fd);}})[_0x3938('0x1f')](function(){_0x5b7f3f();})['catch'](function(_0x4d040e){_0x5b7f3f(_0x4d040e);});},'afterDestroy':function(_0x306f62,_0x54febe,_0x5c483e){return _0x4e4b0d[_0x3938('0x23')]['destroy']({'where':{'ChanSpyId':_0x306f62['id']}})[_0x3938('0x1f')](function(){_0x5c483e();})[_0x3938('0x21')](function(_0x1d49fa){_0x5c483e(_0x1d49fa);});}}});}; \ No newline at end of file +var _0x1645=['models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','from-sip','format','prefix','push','merge','Set','record','MixMonitor','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','then','catch','exports'];(function(_0x2fdd0b,_0x873607){var _0x4abf2b=function(_0xd90e68){while(--_0xd90e68){_0x2fdd0b['push'](_0x2fdd0b['shift']());}};_0x4abf2b(++_0x873607);}(_0x1645,0x8f));var _0x5164=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1645[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5164('0x0'));var util=require(_0x5164('0x1'));var BPromise=require('bluebird');var attributes=require(_0x5164('0x2'));var getUserApplications=function(_0x230e46,_0x2c573c,_0x4e861e){var _0xab942f=0x1;var _0x77d1=[];var _0x177fe5={'context':_0x2c573c['context']||_0x5164('0x3'),'exten':util[_0x5164('0x4')]('%s%s',_0x230e46[_0x5164('0x5')],_0x4e861e),'type':'system','isApp':![],'ChanSpyId':_0x230e46['id'],'UserId':_0x2c573c['id']};_0x77d1[_0x5164('0x6')](_[_0x5164('0x7')]({'app':_0x5164('0x8'),'appdata':util[_0x5164('0x4')]('CDR(type)=%s','chanspy'),'priority':_0xab942f++},_0x177fe5));if(_0x230e46[_0x5164('0x9')]){_0x77d1[_0x5164('0x6')](_[_0x5164('0x7')]({'app':_0x5164('0xa'),'appdata':util[_0x5164('0x4')]('${UNIQUEID}.%s,a',_0x230e46[_0x5164('0xb')]),'priority':_0xab942f++},_0x177fe5));}if(_0x230e46['auth']){_0x77d1[_0x5164('0x6')](_[_0x5164('0x7')]({'app':_0x5164('0xc'),'appdata':_0x230e46[_0x5164('0xd')],'priority':_0xab942f++},_0x177fe5));}_0x77d1[_0x5164('0x6')](_[_0x5164('0x7')]({'app':_0x5164('0xe'),'appdata':util[_0x5164('0x4')](_0x5164('0xf'),_0x2c573c[_0x5164('0x10')],_0x230e46[_0x5164('0x11')]?_0x230e46[_0x5164('0x11')][_0x5164('0x12')](''):''),'priority':_0xab942f++},_0x177fe5));if(_0x230e46['record']){_0x77d1['push'](_[_0x5164('0x7')]({'app':_0x5164('0x13'),'priority':_0xab942f++},_0x177fe5));}return _0x77d1;};var getChanSpyApplications=function(_0x4a8554,_0xbe71dd){var _0x971abd=[];for(var _0x57f5cd=0x0,_0x6f8e87=0x1;_0x57f5cd<_0xbe71dd['length'];_0x57f5cd++,_0x6f8e87=0x1){_0x971abd=_0x971abd[_0x5164('0x14')](getUserApplications(_0x4a8554,_0xbe71dd[_0x57f5cd],_0xbe71dd[_0x57f5cd]['internal']));if(_0xbe71dd[_0x57f5cd][_0x5164('0x15')]!=_0xbe71dd[_0x57f5cd][_0x5164('0x10')]){_0x971abd=_0x971abd[_0x5164('0x14')](getUserApplications(_0x4a8554,_0xbe71dd[_0x57f5cd],_0xbe71dd[_0x57f5cd]['name']));}}return _0x971abd;};var getChanSpyPromise=function(_0xcf2e1a,_0x4e7256){return new BPromise(function(_0x2fa52a,_0x1913af){return _0xcf2e1a[_0x5164('0x16')][_0x5164('0x17')]({'attributes':['id',_0x5164('0x10'),_0x5164('0x15')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x5164('0x18')](function(_0x43b238){if(_0x43b238){return _0x2fa52a(getChanSpyApplications(_0x4e7256,_0x43b238));}return _0x2fa52a([]);})[_0x5164('0x19')](function(_0x52901b){_0x1913af(_0x52901b);});});};module[_0x5164('0x1a')]=function(_0x375407,_0x1d9374){var _0x3cb440=_0x375407[_0x5164('0x1b')];return _0x375407['define'](_0x5164('0x1c'),attributes,{'tableName':_0x5164('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b0174,_0x66b062,_0x1dd2d0){return getChanSpyPromise(_0x3cb440,_0x5b0174)['then'](function(_0x164e51){if(_0x164e51&&_0x164e51[_0x5164('0x1e')]){return _0x3cb440[_0x5164('0x1f')][_0x5164('0x20')](_0x164e51);}})['then'](function(){_0x1dd2d0();})['catch'](function(_0x2370c6){_0x1dd2d0(_0x2370c6);});},'afterUpdate':function(_0x22018e,_0x21e226,_0x3c26c3){return _0x3cb440[_0x5164('0x1f')][_0x5164('0x21')]({'where':{'ChanSpyId':_0x22018e['id']}})[_0x5164('0x18')](function(){return getChanSpyPromise(_0x3cb440,_0x22018e);})[_0x5164('0x18')](function(_0x178eca){if(_0x178eca&&_0x178eca[_0x5164('0x1e')]){return _0x3cb440['VoiceExtension'][_0x5164('0x20')](_0x178eca);}})[_0x5164('0x18')](function(){_0x3c26c3();})['catch'](function(_0x545f12){_0x3c26c3(_0x545f12);});},'afterDestroy':function(_0xaef67b,_0x495168,_0x511f7c){return _0x3cb440[_0x5164('0x1f')]['destroy']({'where':{'ChanSpyId':_0xaef67b['id']}})[_0x5164('0x18')](function(){_0x511f7c();})[_0x5164('0x19')](function(_0x414932){_0x511f7c(_0x414932);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b294646..c55546c 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 _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4058,0x129));var _0x8405=function(_0x16d3d1,_0x5e31d8){_0x16d3d1=_0x16d3d1-0x0;var _0x11504c=_0x4058[_0x16d3d1];return _0x11504c;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file +var _0xac55=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x466dee,_0x4c9527){var _0x4997c0=function(_0xc34ef){while(--_0xc34ef){_0x466dee['push'](_0x466dee['shift']());}};_0x4997c0(++_0x4c9527);}(_0xac55,0x1c8));var _0x5ac5=function(_0x373189,_0x2afdf7){_0x373189=_0x373189-0x0;var _0xe2fddc=_0xac55[_0x373189];return _0xe2fddc;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var moment=require(_0x5ac5('0x2'));var BPromise=require(_0x5ac5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac5('0x4'));var db=require(_0x5ac5('0x5'))['db'];var utils=require(_0x5ac5('0x6'));var logger=require(_0x5ac5('0x7'))(_0x5ac5('0x8'));var config=require(_0x5ac5('0x9'));var jayson=require(_0x5ac5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34093b,_0x247752,_0x2bee03){return new BPromise(function(_0x42551a,_0x455a94){return client[_0x5ac5('0xb')](_0x34093b,_0x2bee03)[_0x5ac5('0xc')](function(_0x5b84a3){logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));logger['debug'](_0x5ac5('0xf'),_0x247752,_0x5ac5('0xe'),JSON['stringify'](_0x5b84a3));if(_0x5b84a3[_0x5ac5('0x10')]){if(_0x5b84a3[_0x5ac5('0x10')]['code']===0x1f4){logger[_0x5ac5('0x10')](_0x5ac5('0xd'),_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x455a94(_0x5b84a3[_0x5ac5('0x10')]['message']);}logger[_0x5ac5('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x42551a(_0x5b84a3['error'][_0x5ac5('0x11')]);}else{logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));_0x42551a(_0x5b84a3[_0x5ac5('0x12')][_0x5ac5('0x11')]);}})[_0x5ac5('0x13')](function(_0x3e35e9){logger[_0x5ac5('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x247752,_0x3e35e9);_0x455a94(_0x3e35e9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 589c2aa..0745ecb 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 _0xb141=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','show','post'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xb141,0x15a));var _0x1b14=function(_0x2f071f,_0x12cb52){_0x2f071f=_0x2f071f-0x0;var _0x1062ac=_0xb141[_0x2f071f];return _0x1062ac;};'use strict';var multer=require(_0x1b14('0x0'));var util=require(_0x1b14('0x1'));var path=require(_0x1b14('0x2'));var timeout=require(_0x1b14('0x3'));var express=require('express');var router=express[_0x1b14('0x4')]();var fs_extra=require(_0x1b14('0x5'));var auth=require(_0x1b14('0x6'));var interaction=require(_0x1b14('0x7'));var config=require('../../config/environment');var controller=require(_0x1b14('0x8'));router[_0x1b14('0x9')]('/',auth[_0x1b14('0xa')](),controller[_0x1b14('0xb')]);router['get']('/:id',auth[_0x1b14('0xa')](),controller[_0x1b14('0xc')]);router[_0x1b14('0xd')]('/',auth[_0x1b14('0xa')](),controller['create']);router[_0x1b14('0xe')](_0x1b14('0xf'),auth['isAuthenticated'](),controller[_0x1b14('0x10')]);router[_0x1b14('0x11')]('/:id',auth[_0x1b14('0xa')](),controller[_0x1b14('0x12')]);module[_0x1b14('0x13')]=router; \ No newline at end of file +var _0x8f1d=['create','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8f1d,0x17c));var _0xd8f1=function(_0x39b68b,_0x4ad96d){_0x39b68b=_0x39b68b-0x0;var _0xae091f=_0x8f1d[_0x39b68b];return _0xae091f;};'use strict';var multer=require(_0xd8f1('0x0'));var util=require(_0xd8f1('0x1'));var path=require(_0xd8f1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd8f1('0x3')]();var fs_extra=require(_0xd8f1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8f1('0x5'));var controller=require(_0xd8f1('0x6'));router[_0xd8f1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd8f1('0x7')]('/:id',auth[_0xd8f1('0x8')](),controller[_0xd8f1('0x9')]);router[_0xd8f1('0xa')]('/',auth[_0xd8f1('0x8')](),controller[_0xd8f1('0xb')]);router[_0xd8f1('0xc')](_0xd8f1('0xd'),auth[_0xd8f1('0x8')](),controller[_0xd8f1('0xe')]);router[_0xd8f1('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd8f1('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index d9c9916..4d53b9e 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 _0x1037=['name','BOOLEAN','sequelize','STRING'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0x1037,0x6e));var _0x7103=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x1037[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0x7103('0x0'));module['exports']={'name':{'type':Sequelize[_0x7103('0x1')],'unique':_0x7103('0x2')},'description':{'type':Sequelize[_0x7103('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7103('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc34=['STRING','name','BOOLEAN','sequelize'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xbc34,0x1a3));var _0x4bc3=function(_0x1a2729,_0x2700e1){_0x1a2729=_0x1a2729-0x0;var _0x7e373e=_0xbc34[_0x1a2729];return _0x7e373e;};'use strict';var Sequelize=require(_0x4bc3('0x0'));module['exports']={'name':{'type':Sequelize[_0x4bc3('0x1')],'unique':_0x4bc3('0x2')},'description':{'type':Sequelize[_0x4bc3('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4bc3('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 3ac5447..d3c4c8d 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 _0x159c=['pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','readFileSync','utf8','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x59bc12,_0x2eaf8e){var _0x55eebd=function(_0x551fe0){while(--_0x551fe0){_0x59bc12['push'](_0x59bc12['shift']());}};_0x55eebd(++_0x2eaf8e);}(_0x159c,0x88));var _0xc159=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x159c[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc159('0x0'));var rimraf=require(_0xc159('0x1'));var zipdir=require(_0xc159('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc159('0x3'));var moment=require(_0xc159('0x4'));var BPromise=require(_0xc159('0x5'));var Mustache=require(_0xc159('0x6'));var util=require(_0xc159('0x7'));var path=require('path');var sox=require(_0xc159('0x8'));var csv=require(_0xc159('0x9'));var ejs=require(_0xc159('0xa'));var fs=require('fs');var fs_extra=require(_0xc159('0xb'));var _=require(_0xc159('0xc'));var squel=require('squel');var crypto=require(_0xc159('0xd'));var jsforce=require(_0xc159('0xe'));var deskjs=require(_0xc159('0xf'));var toCsv=require(_0xc159('0x9'));var querystring=require(_0xc159('0x10'));var Papa=require('papaparse');var Redis=require(_0xc159('0x11'));var authService=require(_0xc159('0x12'));var qs=require(_0xc159('0x13'));var as=require(_0xc159('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc159('0x15'));var config=require(_0xc159('0x16'));var licenseUtil=require(_0xc159('0x17'));var db=require(_0xc159('0x18'))['db'];var jayson=require(_0xc159('0x19'));var client=jayson[_0xc159('0x1a')][_0xc159('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3974df,_0x3d6d0e,_0x34500a,_0x288342){return new BPromise(function(_0x4917a2,_0x20f07d){var _0x55fe17=_0x288342||client;return _0x55fe17['request'](_0x3974df,_0x34500a)['then'](function(_0x5acc70){logger[_0xc159('0x1c')](_0xc159('0x1d'),_0x3d6d0e,_0xc159('0x1e'));logger[_0xc159('0x1f')](_0xc159('0x20'),_0x3d6d0e,'request\x20sent',JSON[_0xc159('0x21')](_0x5acc70));if(_0x5acc70['error']){if(_0x5acc70[_0xc159('0x22')][_0xc159('0x23')]===0x1f4){logger['error'](_0xc159('0x1d'),_0x3d6d0e,_0x5acc70[_0xc159('0x22')][_0xc159('0x24')]);return _0x20f07d(_0x5acc70[_0xc159('0x22')][_0xc159('0x24')]);}logger[_0xc159('0x22')]('VoiceContext,\x20%s,\x20%s',_0x3d6d0e,_0x5acc70['error'][_0xc159('0x24')]);return _0x4917a2(_0x5acc70['error'][_0xc159('0x24')]);}else{logger[_0xc159('0x1c')](_0xc159('0x1d'),_0x3d6d0e,_0xc159('0x1e'));_0x4917a2(_0x5acc70[_0xc159('0x25')][_0xc159('0x24')]);}})[_0xc159('0x26')](function(_0x25abe9){logger[_0xc159('0x22')](_0xc159('0x1d'),_0x3d6d0e,_0x25abe9);_0x20f07d(_0x25abe9);});});}function respondWithStatusCode(_0xafa50c,_0x137a23){_0x137a23=_0x137a23||0xcc;return function(_0x19e060){if(_0x19e060){return _0xafa50c[_0xc159('0x27')](_0x137a23);}return _0xafa50c[_0xc159('0x28')](_0x137a23)['end']();};}function respondWithResult(_0x1278d0,_0xdb1bcb){_0xdb1bcb=_0xdb1bcb||0xc8;return function(_0x8b1ca9){if(_0x8b1ca9){return _0x1278d0[_0xc159('0x28')](_0xdb1bcb)[_0xc159('0x29')](_0x8b1ca9);}};}function respondWithFilteredResult(_0x25dc2e,_0x12e730){return function(_0x19605f){if(_0x19605f){var _0x740212=typeof _0x12e730['offset']===_0xc159('0x2a')&&typeof _0x12e730[_0xc159('0x2b')]===_0xc159('0x2a');var _0x4edd37=_0x19605f[_0xc159('0x2c')];var _0x1904af=_0x740212?0x0:_0x12e730[_0xc159('0x2d')];var _0x3f370a=_0x740212?_0x19605f[_0xc159('0x2c')]:_0x12e730[_0xc159('0x2d')]+_0x12e730[_0xc159('0x2b')];var _0x21d261;if(_0x3f370a>=_0x4edd37){_0x3f370a=_0x4edd37;_0x21d261=0xc8;}else{_0x21d261=0xce;}_0x25dc2e[_0xc159('0x28')](_0x21d261);return _0x25dc2e['set'](_0xc159('0x2e'),_0x1904af+'-'+_0x3f370a+'/'+_0x4edd37)[_0xc159('0x29')](_0x19605f);}return null;};}function patchUpdates(_0xc0e2e8){return function(_0x178ab9){try{jsonpatch['apply'](_0x178ab9,_0xc0e2e8,!![]);}catch(_0xf1dacc){return BPromise[_0xc159('0x2f')](_0xf1dacc);}return _0x178ab9[_0xc159('0x30')]();};}function saveUpdates(_0x147557,_0x3f08e9){return function(_0x495b48){if(_0x495b48){return _0x495b48[_0xc159('0x31')](_0x147557)[_0xc159('0x32')](function(_0x43f3d2){return _0x43f3d2;});}return null;};}function removeEntity(_0x16549e,_0x1f87c4){return function(_0x349c65){if(_0x349c65){return _0x349c65[_0xc159('0x33')]()[_0xc159('0x32')](function(){var _0x53bdb5=_0x349c65[_0xc159('0x34')]({'plain':!![]});var _0x19f55a=_0xc159('0x35');return db[_0xc159('0x36')][_0xc159('0x33')]({'where':{'type':_0x19f55a,'resourceId':_0x53bdb5['id']}})[_0xc159('0x32')](function(){return _0x349c65;});})['then'](function(){_0x16549e[_0xc159('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56306a,_0x13d05c){return function(_0x2e2d6e){if(!_0x2e2d6e){_0x56306a[_0xc159('0x27')](0x194);}return _0x2e2d6e;};}function handleError(_0x3ee454,_0xf9a95){_0xf9a95=_0xf9a95||0x1f4;return function(_0x195ce2){logger[_0xc159('0x22')](_0x195ce2[_0xc159('0x37')]);if(_0x195ce2[_0xc159('0x38')]){delete _0x195ce2['name'];}_0x3ee454[_0xc159('0x28')](_0xf9a95)['send'](_0x195ce2);};}exports[_0xc159('0x39')]=function(_0x35dbf4,_0x2744c9){var _0x17724e={},_0x32fc54={},_0x441e23={'count':0x0,'rows':[]};var _0x589336=_[_0xc159('0x3a')](db[_0xc159('0x3b')][_0xc159('0x3c')],function(_0xa2c473){return{'name':_0xa2c473[_0xc159('0x3d')],'type':_0xa2c473[_0xc159('0x3e')][_0xc159('0x3f')]};});_0x32fc54[_0xc159('0x40')]=_['map'](_0x589336,'name');_0x32fc54[_0xc159('0x41')]=_[_0xc159('0x42')](_0x35dbf4['query']);_0x32fc54[_0xc159('0x43')]=_[_0xc159('0x44')](_0x32fc54[_0xc159('0x40')],_0x32fc54['query']);_0x17724e[_0xc159('0x45')]=_[_0xc159('0x44')](_0x32fc54[_0xc159('0x40')],qs['fields'](_0x35dbf4['query'][_0xc159('0x46')]));_0x17724e[_0xc159('0x45')]=_0x17724e[_0xc159('0x45')][_0xc159('0x47')]?_0x17724e['attributes']:_0x32fc54[_0xc159('0x40')];if(!_0x35dbf4['query'][_0xc159('0x48')](_0xc159('0x49'))){_0x17724e[_0xc159('0x2b')]=qs[_0xc159('0x2b')](_0x35dbf4['query']['limit']);_0x17724e[_0xc159('0x2d')]=qs['offset'](_0x35dbf4[_0xc159('0x41')]['offset']);}_0x17724e[_0xc159('0x4a')]=qs[_0xc159('0x4b')](_0x35dbf4[_0xc159('0x41')][_0xc159('0x4b')]);_0x17724e['where']=qs[_0xc159('0x43')](_[_0xc159('0x4c')](_0x35dbf4[_0xc159('0x41')],_0x32fc54[_0xc159('0x43')]),_0x589336);if(_0x35dbf4['query'][_0xc159('0x4d')]){_0x17724e[_0xc159('0x4e')]=_[_0xc159('0x4f')](_0x17724e[_0xc159('0x4e')],{'$or':_[_0xc159('0x3a')](_0x589336,function(_0x2ee84b){if(_0x2ee84b['type']!==_0xc159('0x50')){var _0x1a3544={};_0x1a3544[_0x2ee84b['name']]={'$like':'%'+_0x35dbf4[_0xc159('0x41')][_0xc159('0x4d')]+'%'};return _0x1a3544;}})});}_0x17724e=_[_0xc159('0x4f')]({},_0x17724e,_0x35dbf4[_0xc159('0x51')]);var _0x115637={'where':_0x17724e[_0xc159('0x4e')]};return db[_0xc159('0x3b')][_0xc159('0x2c')](_0x115637)[_0xc159('0x32')](function(_0x42df32){_0x441e23['count']=_0x42df32;if(_0x35dbf4[_0xc159('0x41')]['includeAll']){_0x17724e[_0xc159('0x52')]=[{'all':!![]}];}return db['VoiceContext'][_0xc159('0x53')](_0x17724e);})[_0xc159('0x32')](function(_0x1e27db){_0x441e23[_0xc159('0x54')]=_0x1e27db;return _0x441e23;})[_0xc159('0x32')](respondWithFilteredResult(_0x2744c9,_0x17724e))['catch'](handleError(_0x2744c9,null));};exports['show']=function(_0x41a486,_0x1c7912){var _0x19f9e9={'raw':![],'where':{'id':_0x41a486[_0xc159('0x55')]['id']}},_0x46ebab={};_0x46ebab[_0xc159('0x40')]=_[_0xc159('0x42')](db[_0xc159('0x3b')][_0xc159('0x3c')]);_0x46ebab['query']=_[_0xc159('0x42')](_0x41a486[_0xc159('0x41')]);_0x46ebab[_0xc159('0x43')]=_['intersection'](_0x46ebab['model'],_0x46ebab[_0xc159('0x41')]);_0x19f9e9[_0xc159('0x45')]=_['intersection'](_0x46ebab[_0xc159('0x40')],qs[_0xc159('0x46')](_0x41a486['query']['fields']));_0x19f9e9[_0xc159('0x45')]=_0x19f9e9[_0xc159('0x45')][_0xc159('0x47')]?_0x19f9e9[_0xc159('0x45')]:_0x46ebab[_0xc159('0x40')];if(_0x41a486[_0xc159('0x41')][_0xc159('0x56')]){_0x19f9e9[_0xc159('0x52')]=[{'all':!![]}];}_0x19f9e9=_[_0xc159('0x4f')]({},_0x19f9e9,_0x41a486[_0xc159('0x51')]);return db[_0xc159('0x3b')][_0xc159('0x57')](_0x19f9e9)[_0xc159('0x32')](handleEntityNotFound(_0x1c7912,null))[_0xc159('0x32')](respondWithResult(_0x1c7912,null))[_0xc159('0x26')](handleError(_0x1c7912,null));};exports[_0xc159('0x58')]=function(_0x374824,_0x1c45c7,_0x38592b){var _0x56eb26;return db[_0xc159('0x3b')][_0xc159('0x58')](_0x374824[_0xc159('0x59')],{'raw':!![]})[_0xc159('0x32')](function(_0xcc61f6){_0x56eb26=_0xcc61f6;return db[_0xc159('0x3b')][_0xc159('0x53')]({'raw':!![]});})[_0xc159('0x32')](function(_0x2e5bea){var _0x4f52dd=fs['readFileSync'](path[_0xc159('0x5a')](config[_0xc159('0x5b')],_0xc159('0x5c')),'utf8');var _0x30ebb7=ejs[_0xc159('0x5d')](_0x4f52dd,{'contexts':_0x2e5bea||[]});fs[_0xc159('0x5e')](_0xc159('0x5f'),_0x30ebb7);})[_0xc159('0x32')](function(){return respondWithRpcPromise(_0xc159('0x60'),_0xc159('0x58'),{'module':_0xc159('0x61')});})[_0xc159('0x32')](function(){var _0x30af95=_0x374824[_0xc159('0x62')][_0xc159('0x34')]({'plain':!![]});if(!_0x30af95)throw new Error(_0xc159('0x63'));if(_0x30af95[_0xc159('0x64')]==='user'){var _0x10534a=_0x56eb26[_0xc159('0x34')]({'plain':!![]});return db[_0xc159('0x65')]['find']({'where':{'name':'Contexts','userProfileId':_0x30af95[_0xc159('0x66')]},'raw':!![]})[_0xc159('0x32')](function(_0xef7f02){if(_0xef7f02&&_0xef7f02[_0xc159('0x67')]===0x0){return db['UserProfileResource'][_0xc159('0x58')]({'name':_0x10534a['name'],'resourceId':_0x10534a['id'],'type':_0xef7f02[_0xc159('0x38')],'sectionId':_0xef7f02['id']},{})[_0xc159('0x32')](function(){return _0x56eb26;});}else{return _0x56eb26;}})['catch'](function(_0x3132c1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3132c1);throw _0x3132c1;});}return _0x56eb26;})[_0xc159('0x32')](respondWithResult(_0x1c45c7,0xc9))[_0xc159('0x26')](handleError(_0x1c45c7,null));};exports[_0xc159('0x31')]=function(_0xf4497,_0x385023,_0x1d34fd){var _0xba0567;return db['VoiceContext'][_0xc159('0x57')]({'where':{'id':_0xf4497[_0xc159('0x55')]['id']}})['then'](handleEntityNotFound(_0x385023,null))[_0xc159('0x32')](saveUpdates(_0xf4497[_0xc159('0x59')],null))['then'](function(_0x2b88cf){if(_0x2b88cf){_0xba0567=_0x2b88cf;return db[_0xc159('0x3b')][_0xc159('0x53')]({'raw':!![]});}})['then'](function(_0x219be8){var _0x28e33a=fs[_0xc159('0x68')](path['join'](config[_0xc159('0x5b')],'server/files/templates/context.ejs'),_0xc159('0x69'));var _0x49d57a=ejs['render'](_0x28e33a,{'contexts':_0x219be8||[]});fs[_0xc159('0x5e')](_0xc159('0x5f'),_0x49d57a);})[_0xc159('0x32')](function(){return respondWithRpcPromise(_0xc159('0x60'),_0xc159('0x31'),{'module':'chan_sip.so'});})[_0xc159('0x32')](function(){return _0xba0567;})['then'](respondWithResult(_0x385023,null))['catch'](handleError(_0x385023,null));};exports['destroy']=function(_0x3e8757,_0x2d74d5,_0xdfff4f){var _0x257c03;return db[_0xc159('0x3b')][_0xc159('0x57')]({'where':{'id':_0x3e8757['params']['id']}})['then'](handleEntityNotFound(_0x2d74d5,null))[_0xc159('0x32')](removeEntity(_0x2d74d5,null))[_0xc159('0x32')](function(){return db[_0xc159('0x3b')]['findAll']({'raw':!![]});})[_0xc159('0x32')](function(_0x1799a6){var _0xc7ae14=fs[_0xc159('0x68')](path['join'](config[_0xc159('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x59834d=ejs[_0xc159('0x5d')](_0xc7ae14,{'contexts':_0x1799a6});fs['writeFileSync'](_0xc159('0x5f'),_0x59834d);return respondWithRpcPromise(_0xc159('0x60'),_0xc159('0x33'),{'module':_0xc159('0x61')});})['catch'](handleError(_0x2d74d5,null));}; \ No newline at end of file +var _0xb30a=['sox','to-csv','ejs','fs-extra','squel','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','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','Contexts','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceContext','include','findAll','rows','show','includeAll','find','create','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','server/files/templates/context.ejs','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x184ff5,_0x34db55){var _0x297e3a=function(_0x2693ca){while(--_0x2693ca){_0x184ff5['push'](_0x184ff5['shift']());}};_0x297e3a(++_0x34db55);}(_0xb30a,0x65));var _0xab30=function(_0x5a64ff,_0x9655fe){_0x5a64ff=_0x5a64ff-0x0;var _0x5fcfd3=_0xb30a[_0x5a64ff];return _0x5fcfd3;};'use strict';var emlformat=require(_0xab30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab30('0x1'));var jsonpatch=require(_0xab30('0x2'));var rp=require(_0xab30('0x3'));var moment=require(_0xab30('0x4'));var BPromise=require(_0xab30('0x5'));var Mustache=require(_0xab30('0x6'));var util=require(_0xab30('0x7'));var path=require(_0xab30('0x8'));var sox=require(_0xab30('0x9'));var csv=require(_0xab30('0xa'));var ejs=require(_0xab30('0xb'));var fs=require('fs');var fs_extra=require(_0xab30('0xc'));var _=require('lodash');var squel=require(_0xab30('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab30('0xe'));var toCsv=require(_0xab30('0xa'));var querystring=require('querystring');var Papa=require(_0xab30('0xf'));var Redis=require(_0xab30('0x10'));var authService=require(_0xab30('0x11'));var qs=require(_0xab30('0x12'));var as=require(_0xab30('0x13'));var hardwareService=require(_0xab30('0x14'));var logger=require(_0xab30('0x15'))(_0xab30('0x16'));var utils=require(_0xab30('0x17'));var config=require(_0xab30('0x18'));var licenseUtil=require(_0xab30('0x19'));var db=require(_0xab30('0x1a'))['db'];var jayson=require(_0xab30('0x1b'));var client=jayson[_0xab30('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23ea5c,_0x35b548,_0x4f5c2c,_0x2df3b6){return new BPromise(function(_0x15cdc5,_0x34c821){var _0x2ff565=_0x2df3b6||client;return _0x2ff565[_0xab30('0x1d')](_0x23ea5c,_0x4f5c2c)[_0xab30('0x1e')](function(_0x6991d4){logger[_0xab30('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x35b548,_0xab30('0x20'));logger[_0xab30('0x21')](_0xab30('0x22'),_0x35b548,_0xab30('0x20'),JSON[_0xab30('0x23')](_0x6991d4));if(_0x6991d4[_0xab30('0x24')]){if(_0x6991d4['error'][_0xab30('0x25')]===0x1f4){logger[_0xab30('0x24')](_0xab30('0x26'),_0x35b548,_0x6991d4[_0xab30('0x24')]['message']);return _0x34c821(_0x6991d4[_0xab30('0x24')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x35b548,_0x6991d4[_0xab30('0x24')][_0xab30('0x27')]);return _0x15cdc5(_0x6991d4[_0xab30('0x24')]['message']);}else{logger[_0xab30('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x35b548,_0xab30('0x20'));_0x15cdc5(_0x6991d4[_0xab30('0x28')][_0xab30('0x27')]);}})[_0xab30('0x29')](function(_0x5d99e3){logger[_0xab30('0x24')](_0xab30('0x26'),_0x35b548,_0x5d99e3);_0x34c821(_0x5d99e3);});});}function respondWithStatusCode(_0x3096cc,_0x582f4d){_0x582f4d=_0x582f4d||0xcc;return function(_0x3583fc){if(_0x3583fc){return _0x3096cc[_0xab30('0x2a')](_0x582f4d);}return _0x3096cc['status'](_0x582f4d)[_0xab30('0x2b')]();};}function respondWithResult(_0x5b2641,_0x59ef10){_0x59ef10=_0x59ef10||0xc8;return function(_0x4bd300){if(_0x4bd300){return _0x5b2641[_0xab30('0x2c')](_0x59ef10)[_0xab30('0x2d')](_0x4bd300);}};}function respondWithFilteredResult(_0x17dca0,_0x56c05b){return function(_0xdcdddc){if(_0xdcdddc){var _0x1fbe10=typeof _0x56c05b[_0xab30('0x2e')]===_0xab30('0x2f')&&typeof _0x56c05b[_0xab30('0x30')]===_0xab30('0x2f');var _0x386fcb=_0xdcdddc[_0xab30('0x31')];var _0x28f5e0=_0x1fbe10?0x0:_0x56c05b[_0xab30('0x2e')];var _0x3b3a7=_0x1fbe10?_0xdcdddc[_0xab30('0x31')]:_0x56c05b[_0xab30('0x2e')]+_0x56c05b[_0xab30('0x30')];var _0x31d91b;if(_0x3b3a7>=_0x386fcb){_0x3b3a7=_0x386fcb;_0x31d91b=0xc8;}else{_0x31d91b=0xce;}_0x17dca0['status'](_0x31d91b);return _0x17dca0[_0xab30('0x32')](_0xab30('0x33'),_0x28f5e0+'-'+_0x3b3a7+'/'+_0x386fcb)[_0xab30('0x2d')](_0xdcdddc);}return null;};}function patchUpdates(_0x44eabb){return function(_0x25efee){try{jsonpatch['apply'](_0x25efee,_0x44eabb,!![]);}catch(_0x12a974){return BPromise[_0xab30('0x34')](_0x12a974);}return _0x25efee[_0xab30('0x35')]();};}function saveUpdates(_0x803000,_0x90513c){return function(_0x2e6574){if(_0x2e6574){return _0x2e6574[_0xab30('0x36')](_0x803000)[_0xab30('0x1e')](function(_0x1e74f5){return _0x1e74f5;});}return null;};}function removeEntity(_0x5a736a,_0x35f52c){return function(_0x78568d){if(_0x78568d){return _0x78568d['destroy']()[_0xab30('0x1e')](function(){var _0xe5734d=_0x78568d['get']({'plain':!![]});var _0x2aa6d0=_0xab30('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x2aa6d0,'resourceId':_0xe5734d['id']}})['then'](function(){return _0x78568d;});})[_0xab30('0x1e')](function(){_0x5a736a[_0xab30('0x2c')](0xcc)[_0xab30('0x2b')]();});}};}function handleEntityNotFound(_0x29e39d,_0x432b63){return function(_0x56d175){if(!_0x56d175){_0x29e39d[_0xab30('0x2a')](0x194);}return _0x56d175;};}function handleError(_0x26005f,_0x14aa00){_0x14aa00=_0x14aa00||0x1f4;return function(_0x19de33){logger['error'](_0x19de33[_0xab30('0x38')]);if(_0x19de33[_0xab30('0x39')]){delete _0x19de33[_0xab30('0x39')];}_0x26005f[_0xab30('0x2c')](_0x14aa00)[_0xab30('0x3a')](_0x19de33);};}exports[_0xab30('0x3b')]=function(_0xb21b3b,_0x386cf4){var _0x5650dd={},_0x36fd28={},_0x35b8ac={'count':0x0,'rows':[]};var _0x10ec70=_[_0xab30('0x3c')](db['VoiceContext'][_0xab30('0x3d')],function(_0x569fdb){return{'name':_0x569fdb[_0xab30('0x3e')],'type':_0x569fdb[_0xab30('0x3f')][_0xab30('0x40')]};});_0x36fd28[_0xab30('0x41')]=_[_0xab30('0x3c')](_0x10ec70,'name');_0x36fd28[_0xab30('0x42')]=_[_0xab30('0x43')](_0xb21b3b[_0xab30('0x42')]);_0x36fd28[_0xab30('0x44')]=_['intersection'](_0x36fd28[_0xab30('0x41')],_0x36fd28['query']);_0x5650dd[_0xab30('0x45')]=_[_0xab30('0x46')](_0x36fd28[_0xab30('0x41')],qs[_0xab30('0x47')](_0xb21b3b[_0xab30('0x42')]['fields']));_0x5650dd['attributes']=_0x5650dd[_0xab30('0x45')][_0xab30('0x48')]?_0x5650dd[_0xab30('0x45')]:_0x36fd28[_0xab30('0x41')];if(!_0xb21b3b[_0xab30('0x42')][_0xab30('0x49')](_0xab30('0x4a'))){_0x5650dd[_0xab30('0x30')]=qs[_0xab30('0x30')](_0xb21b3b[_0xab30('0x42')][_0xab30('0x30')]);_0x5650dd['offset']=qs[_0xab30('0x2e')](_0xb21b3b['query']['offset']);}_0x5650dd['order']=qs[_0xab30('0x4b')](_0xb21b3b[_0xab30('0x42')][_0xab30('0x4b')]);_0x5650dd[_0xab30('0x4c')]=qs['filters'](_['pick'](_0xb21b3b[_0xab30('0x42')],_0x36fd28['filters']),_0x10ec70);if(_0xb21b3b[_0xab30('0x42')][_0xab30('0x4d')]){_0x5650dd[_0xab30('0x4c')]=_[_0xab30('0x4e')](_0x5650dd['where'],{'$or':_[_0xab30('0x3c')](_0x10ec70,function(_0x2ca530){if(_0x2ca530[_0xab30('0x3f')]!==_0xab30('0x4f')){var _0x342a9f={};_0x342a9f[_0x2ca530[_0xab30('0x39')]]={'$like':'%'+_0xb21b3b[_0xab30('0x42')][_0xab30('0x4d')]+'%'};return _0x342a9f;}})});}_0x5650dd=_[_0xab30('0x4e')]({},_0x5650dd,_0xb21b3b[_0xab30('0x50')]);var _0x12b237={'where':_0x5650dd[_0xab30('0x4c')]};return db[_0xab30('0x51')][_0xab30('0x31')](_0x12b237)[_0xab30('0x1e')](function(_0x223219){_0x35b8ac[_0xab30('0x31')]=_0x223219;if(_0xb21b3b['query']['includeAll']){_0x5650dd[_0xab30('0x52')]=[{'all':!![]}];}return db[_0xab30('0x51')][_0xab30('0x53')](_0x5650dd);})[_0xab30('0x1e')](function(_0x1cef65){_0x35b8ac[_0xab30('0x54')]=_0x1cef65;return _0x35b8ac;})[_0xab30('0x1e')](respondWithFilteredResult(_0x386cf4,_0x5650dd))[_0xab30('0x29')](handleError(_0x386cf4,null));};exports[_0xab30('0x55')]=function(_0x2ba2bc,_0x5d0adf){var _0x5913f0={'raw':![],'where':{'id':_0x2ba2bc['params']['id']}},_0x5b950d={};_0x5b950d[_0xab30('0x41')]=_[_0xab30('0x43')](db['VoiceContext'][_0xab30('0x3d')]);_0x5b950d[_0xab30('0x42')]=_[_0xab30('0x43')](_0x2ba2bc['query']);_0x5b950d[_0xab30('0x44')]=_[_0xab30('0x46')](_0x5b950d[_0xab30('0x41')],_0x5b950d[_0xab30('0x42')]);_0x5913f0['attributes']=_[_0xab30('0x46')](_0x5b950d['model'],qs[_0xab30('0x47')](_0x2ba2bc[_0xab30('0x42')]['fields']));_0x5913f0[_0xab30('0x45')]=_0x5913f0[_0xab30('0x45')][_0xab30('0x48')]?_0x5913f0['attributes']:_0x5b950d[_0xab30('0x41')];if(_0x2ba2bc[_0xab30('0x42')][_0xab30('0x56')]){_0x5913f0['include']=[{'all':!![]}];}_0x5913f0=_['merge']({},_0x5913f0,_0x2ba2bc[_0xab30('0x50')]);return db[_0xab30('0x51')][_0xab30('0x57')](_0x5913f0)[_0xab30('0x1e')](handleEntityNotFound(_0x5d0adf,null))[_0xab30('0x1e')](respondWithResult(_0x5d0adf,null))[_0xab30('0x29')](handleError(_0x5d0adf,null));};exports[_0xab30('0x58')]=function(_0x571555,_0x38e9e8,_0x3a3930){var _0x3d5e58;return db[_0xab30('0x51')]['create'](_0x571555['body'],{'raw':!![]})[_0xab30('0x1e')](function(_0x206984){_0x3d5e58=_0x206984;return db['VoiceContext'][_0xab30('0x53')]({'raw':!![]});})[_0xab30('0x1e')](function(_0x590e34){var _0x5dc181=fs[_0xab30('0x59')](path['join'](config[_0xab30('0x5a')],'server/files/templates/context.ejs'),_0xab30('0x5b'));var _0x118f69=ejs[_0xab30('0x5c')](_0x5dc181,{'contexts':_0x590e34||[]});fs[_0xab30('0x5d')](_0xab30('0x5e'),_0x118f69);})[_0xab30('0x1e')](function(){return respondWithRpcPromise('Reload',_0xab30('0x58'),{'module':_0xab30('0x5f')});})[_0xab30('0x1e')](function(){var _0x1099cf=_0x571555['user'][_0xab30('0x60')]({'plain':!![]});if(!_0x1099cf)throw new Error(_0xab30('0x61'));if(_0x1099cf[_0xab30('0x62')]===_0xab30('0x63')){var _0x26e4aa=_0x3d5e58['get']({'plain':!![]});return db[_0xab30('0x64')][_0xab30('0x57')]({'where':{'name':_0xab30('0x37'),'userProfileId':_0x1099cf[_0xab30('0x65')]},'raw':!![]})['then'](function(_0x1d98ad){if(_0x1d98ad&&_0x1d98ad[_0xab30('0x66')]===0x0){return db[_0xab30('0x67')][_0xab30('0x58')]({'name':_0x26e4aa[_0xab30('0x39')],'resourceId':_0x26e4aa['id'],'type':_0x1d98ad['name'],'sectionId':_0x1d98ad['id']},{})[_0xab30('0x1e')](function(){return _0x3d5e58;});}else{return _0x3d5e58;}})[_0xab30('0x29')](function(_0x27f745){logger['error'](_0xab30('0x68'),_0x27f745);throw _0x27f745;});}return _0x3d5e58;})[_0xab30('0x1e')](respondWithResult(_0x38e9e8,0xc9))[_0xab30('0x29')](handleError(_0x38e9e8,null));};exports[_0xab30('0x36')]=function(_0x15113f,_0x300fb7,_0x2f371d){var _0x2acde1;return db[_0xab30('0x51')][_0xab30('0x57')]({'where':{'id':_0x15113f['params']['id']}})[_0xab30('0x1e')](handleEntityNotFound(_0x300fb7,null))[_0xab30('0x1e')](saveUpdates(_0x15113f[_0xab30('0x69')],null))[_0xab30('0x1e')](function(_0x93e17c){if(_0x93e17c){_0x2acde1=_0x93e17c;return db['VoiceContext'][_0xab30('0x53')]({'raw':!![]});}})['then'](function(_0x3d3866){var _0x22134a=fs['readFileSync'](path[_0xab30('0x6a')](config[_0xab30('0x5a')],_0xab30('0x6b')),_0xab30('0x5b'));var _0x1e06b1=ejs['render'](_0x22134a,{'contexts':_0x3d3866||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1e06b1);})['then'](function(){return respondWithRpcPromise('Reload',_0xab30('0x36'),{'module':_0xab30('0x5f')});})[_0xab30('0x1e')](function(){return _0x2acde1;})[_0xab30('0x1e')](respondWithResult(_0x300fb7,null))[_0xab30('0x29')](handleError(_0x300fb7,null));};exports[_0xab30('0x6c')]=function(_0x26780b,_0x1d8801,_0x37a2b4){var _0x2e4d69;return db[_0xab30('0x51')]['find']({'where':{'id':_0x26780b[_0xab30('0x6d')]['id']}})[_0xab30('0x1e')](handleEntityNotFound(_0x1d8801,null))[_0xab30('0x1e')](removeEntity(_0x1d8801,null))['then'](function(){return db[_0xab30('0x51')]['findAll']({'raw':!![]});})[_0xab30('0x1e')](function(_0x3b5d77){var _0x432211=fs[_0xab30('0x59')](path[_0xab30('0x6a')](config[_0xab30('0x5a')],'server/files/templates/context.ejs'),_0xab30('0x5b'));var _0x52707e=ejs['render'](_0x432211,{'contexts':_0x3b5d77});fs[_0xab30('0x5d')](_0xab30('0x5e'),_0x52707e);return respondWithRpcPromise('Reload',_0xab30('0x6c'),{'module':_0xab30('0x5f')});})[_0xab30('0x29')](handleError(_0x1d8801,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9bfca58..a6c04df 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 _0x10bf=['./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x190603,_0x2fc135){var _0x112448=function(_0x3ebce5){while(--_0x3ebce5){_0x190603['push'](_0x190603['shift']());}};_0x112448(++_0x2fc135);}(_0x10bf,0xf3));var _0xf10b=function(_0x16960e,_0x169c9f){_0x16960e=_0x16960e-0x0;var _0x1c24ce=_0x10bf[_0x16960e];return _0x1c24ce;};'use strict';var _=require(_0xf10b('0x0'));var util=require(_0xf10b('0x1'));var logger=require(_0xf10b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf10b('0x3'));var rp=require(_0xf10b('0x4'));var fs=require('fs');var path=require(_0xf10b('0x5'));var rimraf=require('rimraf');var config=require(_0xf10b('0x6'));var attributes=require(_0xf10b('0x7'));module['exports']=function(_0x464806,_0x5d135d){return _0x464806['define'](_0xf10b('0x8'),attributes,{'tableName':_0xf10b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef7c=['exports','define','voice_contexts','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xef7c,0x19a));var _0xcef7=function(_0xe17b06,_0x51cb33){_0xe17b06=_0xe17b06-0x0;var _0x38374f=_0xef7c[_0xe17b06];return _0x38374f;};'use strict';var _=require(_0xcef7('0x0'));var util=require(_0xcef7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcef7('0x2'));var BPromise=require('bluebird');var rp=require(_0xcef7('0x3'));var fs=require('fs');var path=require(_0xcef7('0x4'));var rimraf=require(_0xcef7('0x5'));var config=require(_0xcef7('0x6'));var attributes=require(_0xcef7('0x7'));module[_0xcef7('0x8')]=function(_0x468208,_0xbb74b0){return _0x468208[_0xcef7('0x9')]('VoiceContext',attributes,{'tableName':_0xcef7('0xa'),'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 5e6878b..48204aa 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 _0xa30e=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0xd05f72,_0x2f1629){var _0x3b1dee=function(_0x211cfe){while(--_0x211cfe){_0xd05f72['push'](_0xd05f72['shift']());}};_0x3b1dee(++_0x2f1629);}(_0xa30e,0x117));var _0xea30=function(_0x1e50fc,_0x3d2684){_0x1e50fc=_0x1e50fc-0x0;var _0x497f51=_0xa30e[_0x1e50fc];return _0x497f51;};'use strict';var _=require(_0xea30('0x0'));var util=require(_0xea30('0x1'));var moment=require(_0xea30('0x2'));var BPromise=require(_0xea30('0x3'));var rs=require(_0xea30('0x4'));var fs=require('fs');var Redis=require(_0xea30('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea30('0x6'));var config=require(_0xea30('0x7'));var jayson=require(_0xea30('0x8'));var client=jayson['client'][_0xea30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33e178,_0x10c36f,_0x32320b){return new BPromise(function(_0x1c5d00,_0xc7858e){return client[_0xea30('0xa')](_0x33e178,_0x32320b)[_0xea30('0xb')](function(_0x4192e9){logger[_0xea30('0xc')](_0xea30('0xd'),_0x10c36f,_0xea30('0xe'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x10c36f,_0xea30('0xe'),JSON[_0xea30('0xf')](_0x4192e9));if(_0x4192e9[_0xea30('0x10')]){if(_0x4192e9[_0xea30('0x10')][_0xea30('0x11')]===0x1f4){logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);return _0xc7858e(_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);}logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x4192e9['error'][_0xea30('0x12')]);return _0x1c5d00(_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);}else{logger['info'](_0xea30('0xd'),_0x10c36f,_0xea30('0xe'));_0x1c5d00(_0x4192e9[_0xea30('0x13')][_0xea30('0x12')]);}})[_0xea30('0x14')](function(_0x36212e){logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x36212e);_0xc7858e(_0x36212e);});});} \ No newline at end of file +var _0x43c8=['client','http','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x43c8,0xaf));var _0x843c=function(_0x39753c,_0x2824ad){_0x39753c=_0x39753c-0x0;var _0x194f8d=_0x43c8[_0x39753c];return _0x194f8d;};'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')]('VoiceContext,\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);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e35cc1c..8679353 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 _0x34bb=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update'];(function(_0x1d7df3,_0x4263cc){var _0x275210=function(_0xcaf857){while(--_0xcaf857){_0x1d7df3['push'](_0x1d7df3['shift']());}};_0x275210(++_0x4263cc);}(_0x34bb,0x129));var _0xb34b=function(_0x1fe130,_0x2e1d15){_0x1fe130=_0x1fe130-0x0;var _0x1403ad=_0x34bb[_0x1fe130];return _0x1403ad;};'use strict';var multer=require(_0xb34b('0x0'));var util=require(_0xb34b('0x1'));var path=require(_0xb34b('0x2'));var timeout=require(_0xb34b('0x3'));var express=require(_0xb34b('0x4'));var router=express[_0xb34b('0x5')]();var fs_extra=require(_0xb34b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb34b('0x7'));var controller=require(_0xb34b('0x8'));router[_0xb34b('0x9')]('/',auth[_0xb34b('0xa')](),controller['index']);router['get'](_0xb34b('0xb'),auth[_0xb34b('0xa')](),controller['describe']);router[_0xb34b('0x9')](_0xb34b('0xc'),auth[_0xb34b('0xa')](),controller[_0xb34b('0xd')]);router[_0xb34b('0xe')]('/',auth[_0xb34b('0xa')](),controller[_0xb34b('0xf')]);router[_0xb34b('0x10')](_0xb34b('0xc'),auth[_0xb34b('0xa')](),controller[_0xb34b('0x11')]);router[_0xb34b('0x12')]('/:id',auth[_0xb34b('0xa')](),controller[_0xb34b('0x13')]);module[_0xb34b('0x14')]=router; \ No newline at end of file +var _0x7511=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x502666,_0x45fd9d){var _0x4c4efd=function(_0x425433){while(--_0x425433){_0x502666['push'](_0x502666['shift']());}};_0x4c4efd(++_0x45fd9d);}(_0x7511,0x1d0));var _0x1751=function(_0x29a7a9,_0x46c742){_0x29a7a9=_0x29a7a9-0x0;var _0x53713b=_0x7511[_0x29a7a9];return _0x53713b;};'use strict';var multer=require(_0x1751('0x0'));var util=require(_0x1751('0x1'));var path=require(_0x1751('0x2'));var timeout=require(_0x1751('0x3'));var express=require(_0x1751('0x4'));var router=express[_0x1751('0x5')]();var fs_extra=require(_0x1751('0x6'));var auth=require(_0x1751('0x7'));var interaction=require(_0x1751('0x8'));var config=require('../../config/environment');var controller=require(_0x1751('0x9'));router[_0x1751('0xa')]('/',auth[_0x1751('0xb')](),controller[_0x1751('0xc')]);router[_0x1751('0xa')](_0x1751('0xd'),auth['isAuthenticated'](),controller[_0x1751('0xe')]);router[_0x1751('0xa')](_0x1751('0xf'),auth[_0x1751('0xb')](),controller[_0x1751('0x10')]);router[_0x1751('0x11')]('/',auth[_0x1751('0xb')](),controller[_0x1751('0x12')]);router['put'](_0x1751('0xf'),auth[_0x1751('0xb')](),controller['update']);router[_0x1751('0x13')](_0x1751('0xf'),auth['isAuthenticated'](),controller[_0x1751('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 695348f..e2bd90e 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 _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x2eaadf,_0x104e72){var _0x2e5e8a=function(_0x42b665){while(--_0x42b665){_0x2eaadf['push'](_0x2eaadf['shift']());}};_0x2e5e8a(++_0x104e72);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xf3cd[_0x39772f];return _0xc9edbf;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x25aa2c,_0x5d1171){var _0x2706bc=function(_0x8924de){while(--_0x8924de){_0x25aa2c['push'](_0x25aa2c['shift']());}};_0x2706bc(++_0x5d1171);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0xf01de3,_0x318183){_0xf01de3=_0xf01de3-0x0;var _0x3688a4=_0x8d0e[_0xf01de3];return _0x3688a4;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2347910..69d024d 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 _0xdc34=['fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','fieldName','type','map','query','keys','intersection','model','attributes'];(function(_0xb5cb23,_0x336cbb){var _0x2edd65=function(_0x33469e){while(--_0x33469e){_0xb5cb23['push'](_0xb5cb23['shift']());}};_0x2edd65(++_0x336cbb);}(_0xdc34,0x66));var _0x4dc3=function(_0x5561c7,_0x4daf57){_0x5561c7=_0x5561c7-0x0;var _0x56de1b=_0xdc34[_0x5561c7];return _0x56de1b;};'use strict';var emlformat=require(_0x4dc3('0x0'));var rimraf=require(_0x4dc3('0x1'));var zipdir=require(_0x4dc3('0x2'));var jsonpatch=require(_0x4dc3('0x3'));var rp=require(_0x4dc3('0x4'));var moment=require(_0x4dc3('0x5'));var BPromise=require(_0x4dc3('0x6'));var Mustache=require('mustache');var util=require(_0x4dc3('0x7'));var path=require(_0x4dc3('0x8'));var sox=require('sox');var csv=require(_0x4dc3('0x9'));var ejs=require(_0x4dc3('0xa'));var fs=require('fs');var fs_extra=require(_0x4dc3('0xb'));var _=require(_0x4dc3('0xc'));var squel=require(_0x4dc3('0xd'));var crypto=require(_0x4dc3('0xe'));var jsforce=require(_0x4dc3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4dc3('0x10'));var Papa=require('papaparse');var Redis=require(_0x4dc3('0x11'));var authService=require(_0x4dc3('0x12'));var qs=require(_0x4dc3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dc3('0x14'));var logger=require(_0x4dc3('0x15'))(_0x4dc3('0x16'));var utils=require(_0x4dc3('0x17'));var config=require(_0x4dc3('0x18'));var licenseUtil=require(_0x4dc3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c7480,_0x3ed19d){_0x3ed19d=_0x3ed19d||0xcc;return function(_0x57f2f7){if(_0x57f2f7){return _0x2c7480['sendStatus'](_0x3ed19d);}return _0x2c7480['status'](_0x3ed19d)[_0x4dc3('0x1a')]();};}function respondWithResult(_0x57fc33,_0x9c3f2){_0x9c3f2=_0x9c3f2||0xc8;return function(_0x13b5c6){if(_0x13b5c6){return _0x57fc33[_0x4dc3('0x1b')](_0x9c3f2)[_0x4dc3('0x1c')](_0x13b5c6);}};}function respondWithFilteredResult(_0x37c61b,_0x292bf0){return function(_0x504b84){if(_0x504b84){var _0x1337b8=typeof _0x292bf0['offset']===_0x4dc3('0x1d')&&typeof _0x292bf0['limit']==='undefined';var _0x400fca=_0x504b84[_0x4dc3('0x1e')];var _0x2d1711=_0x1337b8?0x0:_0x292bf0[_0x4dc3('0x1f')];var _0x4e92d2=_0x1337b8?_0x504b84[_0x4dc3('0x1e')]:_0x292bf0[_0x4dc3('0x1f')]+_0x292bf0[_0x4dc3('0x20')];var _0x355294;if(_0x4e92d2>=_0x400fca){_0x4e92d2=_0x400fca;_0x355294=0xc8;}else{_0x355294=0xce;}_0x37c61b['status'](_0x355294);return _0x37c61b['set'](_0x4dc3('0x21'),_0x2d1711+'-'+_0x4e92d2+'/'+_0x400fca)['json'](_0x504b84);}return null;};}function patchUpdates(_0x5129ac){return function(_0x5b66e8){try{jsonpatch[_0x4dc3('0x22')](_0x5b66e8,_0x5129ac,!![]);}catch(_0x39bfbf){return BPromise['reject'](_0x39bfbf);}return _0x5b66e8[_0x4dc3('0x23')]();};}function saveUpdates(_0x4cb450,_0x5ed613){return function(_0x498011){if(_0x498011){return _0x498011[_0x4dc3('0x24')](_0x4cb450)[_0x4dc3('0x25')](function(_0x573bf4){return _0x573bf4;});}return null;};}function removeEntity(_0x22d0a9,_0x2e6d22){return function(_0x351e4f){if(_0x351e4f){return _0x351e4f[_0x4dc3('0x26')]()['then'](function(){_0x22d0a9[_0x4dc3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x579e6c,_0x4143b1){return function(_0x502aba){if(!_0x502aba){_0x579e6c[_0x4dc3('0x27')](0x194);}return _0x502aba;};}function handleError(_0x2a337e,_0x22c76b){_0x22c76b=_0x22c76b||0x1f4;return function(_0x51d6d8){logger[_0x4dc3('0x28')](_0x51d6d8['stack']);if(_0x51d6d8[_0x4dc3('0x29')]){delete _0x51d6d8[_0x4dc3('0x29')];}_0x2a337e[_0x4dc3('0x1b')](_0x22c76b)[_0x4dc3('0x2a')](_0x51d6d8);};}exports[_0x4dc3('0x2b')]=function(_0x58ed6c,_0x591c2c){var _0x23d22e={},_0x1c8d7d={},_0x4b7ceb={'count':0x0,'rows':[]};var _0x5216ee=_['map'](db['VoiceDialReport']['rawAttributes'],function(_0x3c9754){return{'name':_0x3c9754[_0x4dc3('0x2c')],'type':_0x3c9754[_0x4dc3('0x2d')]['key']};});_0x1c8d7d['model']=_[_0x4dc3('0x2e')](_0x5216ee,_0x4dc3('0x29'));_0x1c8d7d[_0x4dc3('0x2f')]=_[_0x4dc3('0x30')](_0x58ed6c[_0x4dc3('0x2f')]);_0x1c8d7d['filters']=_[_0x4dc3('0x31')](_0x1c8d7d[_0x4dc3('0x32')],_0x1c8d7d['query']);_0x23d22e[_0x4dc3('0x33')]=_[_0x4dc3('0x31')](_0x1c8d7d['model'],qs[_0x4dc3('0x34')](_0x58ed6c[_0x4dc3('0x2f')][_0x4dc3('0x34')]));_0x23d22e['attributes']=_0x23d22e[_0x4dc3('0x33')][_0x4dc3('0x35')]?_0x23d22e[_0x4dc3('0x33')]:_0x1c8d7d[_0x4dc3('0x32')];if(!_0x58ed6c[_0x4dc3('0x2f')]['hasOwnProperty'](_0x4dc3('0x36'))){_0x23d22e['limit']=qs[_0x4dc3('0x20')](_0x58ed6c['query'][_0x4dc3('0x20')]);_0x23d22e[_0x4dc3('0x1f')]=qs[_0x4dc3('0x1f')](_0x58ed6c[_0x4dc3('0x2f')][_0x4dc3('0x1f')]);}_0x23d22e[_0x4dc3('0x37')]=qs[_0x4dc3('0x38')](_0x58ed6c['query'][_0x4dc3('0x38')]);_0x23d22e[_0x4dc3('0x39')]=qs[_0x4dc3('0x3a')](_[_0x4dc3('0x3b')](_0x58ed6c[_0x4dc3('0x2f')],_0x1c8d7d['filters']),_0x5216ee);if(_0x58ed6c['query'][_0x4dc3('0x3c')]){_0x23d22e[_0x4dc3('0x39')]=_[_0x4dc3('0x3d')](_0x23d22e[_0x4dc3('0x39')],{'$or':_['map'](_0x5216ee,function(_0x192280){if(_0x192280[_0x4dc3('0x2d')]!==_0x4dc3('0x3e')){var _0x5a369c={};_0x5a369c[_0x192280[_0x4dc3('0x29')]]={'$like':'%'+_0x58ed6c['query'][_0x4dc3('0x3c')]+'%'};return _0x5a369c;}})});}_0x23d22e=_['merge']({},_0x23d22e,_0x58ed6c[_0x4dc3('0x3f')]);var _0x1a095b={'where':_0x23d22e[_0x4dc3('0x39')]};return db[_0x4dc3('0x40')][_0x4dc3('0x1e')](_0x1a095b)[_0x4dc3('0x25')](function(_0x1fba3c){_0x4b7ceb['count']=_0x1fba3c;if(_0x58ed6c[_0x4dc3('0x2f')][_0x4dc3('0x41')]){_0x23d22e[_0x4dc3('0x42')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x4dc3('0x43')](_0x23d22e);})['then'](function(_0x2fd6a0){_0x4b7ceb[_0x4dc3('0x44')]=_0x2fd6a0;return _0x4b7ceb;})[_0x4dc3('0x25')](respondWithFilteredResult(_0x591c2c,_0x23d22e))[_0x4dc3('0x45')](handleError(_0x591c2c,null));};exports[_0x4dc3('0x46')]=function(_0x336e24,_0x1188bd){var _0x5dd49c={'raw':!![],'where':{'id':_0x336e24[_0x4dc3('0x47')]['id']}},_0x4f5d79={};_0x4f5d79[_0x4dc3('0x32')]=_[_0x4dc3('0x30')](db['VoiceDialReport'][_0x4dc3('0x48')]);_0x4f5d79[_0x4dc3('0x2f')]=_['keys'](_0x336e24[_0x4dc3('0x2f')]);_0x4f5d79[_0x4dc3('0x3a')]=_['intersection'](_0x4f5d79[_0x4dc3('0x32')],_0x4f5d79[_0x4dc3('0x2f')]);_0x5dd49c[_0x4dc3('0x33')]=_['intersection'](_0x4f5d79['model'],qs[_0x4dc3('0x34')](_0x336e24[_0x4dc3('0x2f')][_0x4dc3('0x34')]));_0x5dd49c[_0x4dc3('0x33')]=_0x5dd49c[_0x4dc3('0x33')]['length']?_0x5dd49c[_0x4dc3('0x33')]:_0x4f5d79[_0x4dc3('0x32')];if(_0x336e24[_0x4dc3('0x2f')][_0x4dc3('0x41')]){_0x5dd49c[_0x4dc3('0x42')]=[{'all':!![]}];}_0x5dd49c=_[_0x4dc3('0x3d')]({},_0x5dd49c,_0x336e24[_0x4dc3('0x3f')]);return db[_0x4dc3('0x40')][_0x4dc3('0x49')](_0x5dd49c)['then'](handleEntityNotFound(_0x1188bd,null))[_0x4dc3('0x25')](respondWithResult(_0x1188bd,null))[_0x4dc3('0x45')](handleError(_0x1188bd,null));};exports['create']=function(_0xb4ee09,_0x193305){return db[_0x4dc3('0x40')][_0x4dc3('0x4a')](_0xb4ee09['body'],{})[_0x4dc3('0x25')](respondWithResult(_0x193305,0xc9))[_0x4dc3('0x45')](handleError(_0x193305,null));};exports['update']=function(_0x419f0e,_0x45392d){if(_0x419f0e[_0x4dc3('0x4b')]['id']){delete _0x419f0e[_0x4dc3('0x4b')]['id'];}return db[_0x4dc3('0x40')][_0x4dc3('0x49')]({'where':{'id':_0x419f0e[_0x4dc3('0x47')]['id']}})[_0x4dc3('0x25')](handleEntityNotFound(_0x45392d,null))[_0x4dc3('0x25')](saveUpdates(_0x419f0e[_0x4dc3('0x4b')],null))[_0x4dc3('0x25')](respondWithResult(_0x45392d,null))['catch'](handleError(_0x45392d,null));};exports[_0x4dc3('0x26')]=function(_0x2d2c6a,_0x5869bb){return db['VoiceDialReport'][_0x4dc3('0x49')]({'where':{'id':_0x2d2c6a[_0x4dc3('0x47')]['id']}})[_0x4dc3('0x25')](handleEntityNotFound(_0x5869bb,null))[_0x4dc3('0x25')](removeEntity(_0x5869bb,null))[_0x4dc3('0x45')](handleError(_0x5869bb,null));};exports[_0x4dc3('0x4c')]=function(_0x3420ea,_0x3d5288){return db[_0x4dc3('0x40')][_0x4dc3('0x4c')]()[_0x4dc3('0x25')](respondWithResult(_0x3d5288,null))['catch'](handleError(_0x3d5288,null));}; \ No newline at end of file +var _0xb691=['sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','apply','reject','save','update','then','destroy','error','stack','name','send','VoiceDialReport','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','query','nolimit'];(function(_0xb096ef,_0x20ebdf){var _0x5ac5b=function(_0x11b4be){while(--_0x11b4be){_0xb096ef['push'](_0xb096ef['shift']());}};_0x5ac5b(++_0x20ebdf);}(_0xb691,0xa5));var _0x1b69=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb691[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x1b69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b69('0x1'));var jsonpatch=require(_0x1b69('0x2'));var rp=require(_0x1b69('0x3'));var moment=require('moment');var BPromise=require(_0x1b69('0x4'));var Mustache=require(_0x1b69('0x5'));var util=require(_0x1b69('0x6'));var path=require(_0x1b69('0x7'));var sox=require(_0x1b69('0x8'));var csv=require('to-csv');var ejs=require(_0x1b69('0x9'));var fs=require('fs');var fs_extra=require(_0x1b69('0xa'));var _=require(_0x1b69('0xb'));var squel=require(_0x1b69('0xc'));var crypto=require(_0x1b69('0xd'));var jsforce=require(_0x1b69('0xe'));var deskjs=require(_0x1b69('0xf'));var toCsv=require(_0x1b69('0x10'));var querystring=require(_0x1b69('0x11'));var Papa=require(_0x1b69('0x12'));var Redis=require(_0x1b69('0x13'));var authService=require(_0x1b69('0x14'));var qs=require(_0x1b69('0x15'));var as=require(_0x1b69('0x16'));var hardwareService=require(_0x1b69('0x17'));var logger=require(_0x1b69('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1b69('0x19'));var db=require(_0x1b69('0x1a'))['db'];function respondWithStatusCode(_0x337a8b,_0x454c35){_0x454c35=_0x454c35||0xcc;return function(_0x158e5c){if(_0x158e5c){return _0x337a8b[_0x1b69('0x1b')](_0x454c35);}return _0x337a8b[_0x1b69('0x1c')](_0x454c35)[_0x1b69('0x1d')]();};}function respondWithResult(_0xb4134a,_0x9b372d){_0x9b372d=_0x9b372d||0xc8;return function(_0x3a9806){if(_0x3a9806){return _0xb4134a[_0x1b69('0x1c')](_0x9b372d)['json'](_0x3a9806);}};}function respondWithFilteredResult(_0x4cf7f8,_0x1309b2){return function(_0x2d5300){if(_0x2d5300){var _0xf4f70f=typeof _0x1309b2['offset']===_0x1b69('0x1e')&&typeof _0x1309b2[_0x1b69('0x1f')]===_0x1b69('0x1e');var _0x467d9d=_0x2d5300['count'];var _0x1fdcc5=_0xf4f70f?0x0:_0x1309b2[_0x1b69('0x20')];var _0x30e631=_0xf4f70f?_0x2d5300[_0x1b69('0x21')]:_0x1309b2['offset']+_0x1309b2[_0x1b69('0x1f')];var _0x3b71cf;if(_0x30e631>=_0x467d9d){_0x30e631=_0x467d9d;_0x3b71cf=0xc8;}else{_0x3b71cf=0xce;}_0x4cf7f8[_0x1b69('0x1c')](_0x3b71cf);return _0x4cf7f8['set']('Content-Range',_0x1fdcc5+'-'+_0x30e631+'/'+_0x467d9d)['json'](_0x2d5300);}return null;};}function patchUpdates(_0x19264b){return function(_0x44c437){try{jsonpatch[_0x1b69('0x22')](_0x44c437,_0x19264b,!![]);}catch(_0x11da23){return BPromise[_0x1b69('0x23')](_0x11da23);}return _0x44c437[_0x1b69('0x24')]();};}function saveUpdates(_0x4abb18,_0x1105fa){return function(_0x1d08c0){if(_0x1d08c0){return _0x1d08c0[_0x1b69('0x25')](_0x4abb18)[_0x1b69('0x26')](function(_0x31f686){return _0x31f686;});}return null;};}function removeEntity(_0x552a04,_0x39d931){return function(_0x427176){if(_0x427176){return _0x427176[_0x1b69('0x27')]()[_0x1b69('0x26')](function(){_0x552a04['status'](0xcc)[_0x1b69('0x1d')]();});}};}function handleEntityNotFound(_0x49a550,_0x33aa8d){return function(_0x15f842){if(!_0x15f842){_0x49a550[_0x1b69('0x1b')](0x194);}return _0x15f842;};}function handleError(_0x34675b,_0x432552){_0x432552=_0x432552||0x1f4;return function(_0x588de5){logger[_0x1b69('0x28')](_0x588de5[_0x1b69('0x29')]);if(_0x588de5[_0x1b69('0x2a')]){delete _0x588de5[_0x1b69('0x2a')];}_0x34675b[_0x1b69('0x1c')](_0x432552)[_0x1b69('0x2b')](_0x588de5);};}exports['index']=function(_0x5c551e,_0x56aefb){var _0x29c76f={},_0x16449b={},_0x5a803c={'count':0x0,'rows':[]};var _0x1b6993=_['map'](db[_0x1b69('0x2c')][_0x1b69('0x2d')],function(_0x223fa8){return{'name':_0x223fa8['fieldName'],'type':_0x223fa8[_0x1b69('0x2e')][_0x1b69('0x2f')]};});_0x16449b[_0x1b69('0x30')]=_['map'](_0x1b6993,_0x1b69('0x2a'));_0x16449b['query']=_[_0x1b69('0x31')](_0x5c551e['query']);_0x16449b[_0x1b69('0x32')]=_[_0x1b69('0x33')](_0x16449b['model'],_0x16449b['query']);_0x29c76f[_0x1b69('0x34')]=_[_0x1b69('0x33')](_0x16449b[_0x1b69('0x30')],qs[_0x1b69('0x35')](_0x5c551e['query'][_0x1b69('0x35')]));_0x29c76f[_0x1b69('0x34')]=_0x29c76f[_0x1b69('0x34')][_0x1b69('0x36')]?_0x29c76f['attributes']:_0x16449b[_0x1b69('0x30')];if(!_0x5c551e[_0x1b69('0x37')]['hasOwnProperty'](_0x1b69('0x38'))){_0x29c76f['limit']=qs[_0x1b69('0x1f')](_0x5c551e[_0x1b69('0x37')]['limit']);_0x29c76f['offset']=qs[_0x1b69('0x20')](_0x5c551e['query'][_0x1b69('0x20')]);}_0x29c76f['order']=qs[_0x1b69('0x39')](_0x5c551e[_0x1b69('0x37')]['sort']);_0x29c76f[_0x1b69('0x3a')]=qs[_0x1b69('0x32')](_[_0x1b69('0x3b')](_0x5c551e[_0x1b69('0x37')],_0x16449b[_0x1b69('0x32')]),_0x1b6993);if(_0x5c551e[_0x1b69('0x37')][_0x1b69('0x3c')]){_0x29c76f[_0x1b69('0x3a')]=_[_0x1b69('0x3d')](_0x29c76f['where'],{'$or':_[_0x1b69('0x3e')](_0x1b6993,function(_0x1d6295){if(_0x1d6295['type']!=='VIRTUAL'){var _0x2e67a8={};_0x2e67a8[_0x1d6295[_0x1b69('0x2a')]]={'$like':'%'+_0x5c551e['query'][_0x1b69('0x3c')]+'%'};return _0x2e67a8;}})});}_0x29c76f=_[_0x1b69('0x3d')]({},_0x29c76f,_0x5c551e[_0x1b69('0x3f')]);var _0x23f449={'where':_0x29c76f[_0x1b69('0x3a')]};return db[_0x1b69('0x2c')]['count'](_0x23f449)[_0x1b69('0x26')](function(_0x525d8c){_0x5a803c[_0x1b69('0x21')]=_0x525d8c;if(_0x5c551e[_0x1b69('0x37')][_0x1b69('0x40')]){_0x29c76f[_0x1b69('0x41')]=[{'all':!![]}];}return db[_0x1b69('0x2c')]['findAll'](_0x29c76f);})['then'](function(_0x4ab59d){_0x5a803c[_0x1b69('0x42')]=_0x4ab59d;return _0x5a803c;})[_0x1b69('0x26')](respondWithFilteredResult(_0x56aefb,_0x29c76f))[_0x1b69('0x43')](handleError(_0x56aefb,null));};exports[_0x1b69('0x44')]=function(_0x4830ee,_0x1973be){var _0x111ee4={'raw':!![],'where':{'id':_0x4830ee[_0x1b69('0x45')]['id']}},_0x2299c6={};_0x2299c6[_0x1b69('0x30')]=_[_0x1b69('0x31')](db[_0x1b69('0x2c')]['rawAttributes']);_0x2299c6['query']=_['keys'](_0x4830ee['query']);_0x2299c6[_0x1b69('0x32')]=_[_0x1b69('0x33')](_0x2299c6[_0x1b69('0x30')],_0x2299c6[_0x1b69('0x37')]);_0x111ee4[_0x1b69('0x34')]=_[_0x1b69('0x33')](_0x2299c6[_0x1b69('0x30')],qs[_0x1b69('0x35')](_0x4830ee[_0x1b69('0x37')][_0x1b69('0x35')]));_0x111ee4[_0x1b69('0x34')]=_0x111ee4[_0x1b69('0x34')][_0x1b69('0x36')]?_0x111ee4[_0x1b69('0x34')]:_0x2299c6['model'];if(_0x4830ee['query']['includeAll']){_0x111ee4['include']=[{'all':!![]}];}_0x111ee4=_[_0x1b69('0x3d')]({},_0x111ee4,_0x4830ee[_0x1b69('0x3f')]);return db[_0x1b69('0x2c')]['find'](_0x111ee4)[_0x1b69('0x26')](handleEntityNotFound(_0x1973be,null))[_0x1b69('0x26')](respondWithResult(_0x1973be,null))[_0x1b69('0x43')](handleError(_0x1973be,null));};exports[_0x1b69('0x46')]=function(_0x666464,_0x1cfe1a){return db[_0x1b69('0x2c')]['create'](_0x666464[_0x1b69('0x47')],{})['then'](respondWithResult(_0x1cfe1a,0xc9))[_0x1b69('0x43')](handleError(_0x1cfe1a,null));};exports[_0x1b69('0x25')]=function(_0x593afc,_0x206de7){if(_0x593afc[_0x1b69('0x47')]['id']){delete _0x593afc['body']['id'];}return db[_0x1b69('0x2c')][_0x1b69('0x48')]({'where':{'id':_0x593afc['params']['id']}})['then'](handleEntityNotFound(_0x206de7,null))['then'](saveUpdates(_0x593afc[_0x1b69('0x47')],null))[_0x1b69('0x26')](respondWithResult(_0x206de7,null))['catch'](handleError(_0x206de7,null));};exports[_0x1b69('0x27')]=function(_0x415b77,_0x4b10b0){return db[_0x1b69('0x2c')]['find']({'where':{'id':_0x415b77[_0x1b69('0x45')]['id']}})[_0x1b69('0x26')](handleEntityNotFound(_0x4b10b0,null))[_0x1b69('0x26')](removeEntity(_0x4b10b0,null))[_0x1b69('0x43')](handleError(_0x4b10b0,null));};exports['describe']=function(_0x1100ff,_0x2d2bca){return db[_0x1b69('0x2c')][_0x1b69('0x49')]()[_0x1b69('0x26')](respondWithResult(_0x2d2bca,null))[_0x1b69('0x43')](handleError(_0x2d2bca,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9f63768..594230a 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 _0xac05=['define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x535617,_0x229ffe){var _0x542d35=function(_0x44978d){while(--_0x44978d){_0x535617['push'](_0x535617['shift']());}};_0x542d35(++_0x229ffe);}(_0xac05,0x1c3));var _0x5ac0=function(_0x52e3c9,_0x1f639c){_0x52e3c9=_0x52e3c9-0x0;var _0x41c430=_0xac05[_0x52e3c9];return _0x41c430;};'use strict';var _=require(_0x5ac0('0x0'));var util=require(_0x5ac0('0x1'));var logger=require(_0x5ac0('0x2'))(_0x5ac0('0x3'));var moment=require(_0x5ac0('0x4'));var BPromise=require(_0x5ac0('0x5'));var rp=require(_0x5ac0('0x6'));var fs=require('fs');var path=require(_0x5ac0('0x7'));var rimraf=require(_0x5ac0('0x8'));var config=require(_0x5ac0('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x5ac0('0xa')]=function(_0xfcf73e,_0x5ca7e4){return _0xfcf73e[_0x5ac0('0xb')](_0x5ac0('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x5ac0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefa0=['bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','report_dial','uniqueid','lodash','util','api','moment'];(function(_0x9d6c90,_0xf775ea){var _0x1a2040=function(_0x24a407){while(--_0x24a407){_0x9d6c90['push'](_0x9d6c90['shift']());}};_0x1a2040(++_0xf775ea);}(_0xefa0,0xbc));var _0x0efa=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xefa0[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x0efa('0x0'));var util=require(_0x0efa('0x1'));var logger=require('../../config/logger')(_0x0efa('0x2'));var moment=require(_0x0efa('0x3'));var BPromise=require(_0x0efa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0efa('0x5'));var rimraf=require(_0x0efa('0x6'));var config=require(_0x0efa('0x7'));var attributes=require(_0x0efa('0x8'));module[_0x0efa('0x9')]=function(_0x478259,_0x2d7351){return _0x478259['define']('VoiceDialReport',attributes,{'tableName':_0x0efa('0xa'),'paranoid':![],'indexes':[{'fields':[_0x0efa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 52d3f7e..02edc9d 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 _0x9c70=['options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','body','limit','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceDialReport','create'];(function(_0x4d121d,_0x3fe733){var _0xffa031=function(_0x1fec1b){while(--_0x1fec1b){_0x4d121d['push'](_0x4d121d['shift']());}};_0xffa031(++_0x3fe733);}(_0x9c70,0x98));var _0x09c7=function(_0xd4470d,_0x47318d){_0xd4470d=_0xd4470d-0x0;var _0x5544c5=_0x9c70[_0xd4470d];return _0x5544c5;};'use strict';var _=require('lodash');var util=require(_0x09c7('0x0'));var moment=require('moment');var BPromise=require(_0x09c7('0x1'));var rs=require(_0x09c7('0x2'));var fs=require('fs');var Redis=require(_0x09c7('0x3'));var db=require(_0x09c7('0x4'))['db'];var utils=require(_0x09c7('0x5'));var logger=require('../../config/logger')(_0x09c7('0x6'));var config=require(_0x09c7('0x7'));var jayson=require(_0x09c7('0x8'));var client=jayson[_0x09c7('0x9')][_0x09c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb63ef,_0x8b4fec,_0x459211){return new BPromise(function(_0x49022c,_0x414844){return client['request'](_0xb63ef,_0x459211)[_0x09c7('0xb')](function(_0x305dec){logger[_0x09c7('0xc')](_0x09c7('0xd'),_0x8b4fec,_0x09c7('0xe'));logger['debug'](_0x09c7('0xf'),_0x8b4fec,_0x09c7('0xe'),JSON['stringify'](_0x305dec));if(_0x305dec['error']){if(_0x305dec[_0x09c7('0x10')]['code']===0x1f4){logger[_0x09c7('0x10')](_0x09c7('0xd'),_0x8b4fec,_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);return _0x414844(_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);}logger[_0x09c7('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x8b4fec,_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);return _0x49022c(_0x305dec[_0x09c7('0x10')][_0x09c7('0x11')]);}else{logger[_0x09c7('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x8b4fec,_0x09c7('0xe'));_0x49022c(_0x305dec[_0x09c7('0x12')][_0x09c7('0x11')]);}})[_0x09c7('0x13')](function(_0x346332){logger[_0x09c7('0x10')](_0x09c7('0xd'),_0x8b4fec,_0x346332);_0x414844(_0x346332);});});}exports['CreateVoiceDialReport']=function(_0x35b396){var _0x1c5799=this;return new Promise(function(_0x4803e2,_0x20432d){return db[_0x09c7('0x14')][_0x09c7('0x15')](_0x35b396['body'],{'raw':_0x35b396[_0x09c7('0x16')]?_0x35b396[_0x09c7('0x16')][_0x09c7('0x17')]===undefined?!![]:![]:!![]})[_0x09c7('0xb')](function(_0x49e2c7){logger[_0x09c7('0xc')](_0x09c7('0x18'),_0x35b396);logger['debug']('CreateVoiceDialReport',_0x35b396,JSON['stringify'](_0x49e2c7));_0x4803e2(_0x49e2c7);})[_0x09c7('0x13')](function(_0x787298){logger['error'](_0x09c7('0x18'),_0x787298[_0x09c7('0x11')],_0x35b396);_0x20432d(_0x1c5799[_0x09c7('0x10')](0x1f4,_0x787298[_0x09c7('0x11')]));});});};exports[_0x09c7('0x19')]=function(_0x4b2caf){var _0x276537=this;return new Promise(function(_0x86a4e0,_0x119cfc){return db[_0x09c7('0x14')]['update'](_0x4b2caf[_0x09c7('0x1a')],{'raw':_0x4b2caf[_0x09c7('0x16')]?_0x4b2caf[_0x09c7('0x16')][_0x09c7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2caf['options']?_0x4b2caf[_0x09c7('0x16')]['where']||null:null,'attributes':_0x4b2caf[_0x09c7('0x16')]?_0x4b2caf[_0x09c7('0x16')]['attributes']||null:null,'limit':_0x4b2caf['options']?_0x4b2caf[_0x09c7('0x16')][_0x09c7('0x1b')]||null:null})['then'](function(_0x156d5f){logger[_0x09c7('0xc')](_0x09c7('0x19'),_0x4b2caf);logger[_0x09c7('0x1c')](_0x09c7('0x19'),_0x4b2caf,JSON['stringify'](_0x156d5f));_0x86a4e0(_0x156d5f);})[_0x09c7('0x13')](function(_0x3bbb6e){logger['error'](_0x09c7('0x19'),_0x3bbb6e[_0x09c7('0x11')],_0x4b2caf);_0x119cfc(_0x276537[_0x09c7('0x10')](0x1f4,_0x3bbb6e[_0x09c7('0x11')]));});});}; \ No newline at end of file +var _0x560f=['code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f9ea9,_0x19840d){var _0x291e7f=function(_0x8012b4){while(--_0x8012b4){_0x3f9ea9['push'](_0x3f9ea9['shift']());}};_0x291e7f(++_0x19840d);}(_0x560f,0x11e));var _0xf560=function(_0x3ed67f,_0x1e357e){_0x3ed67f=_0x3ed67f-0x0;var _0x3bcbf5=_0x560f[_0x3ed67f];return _0x3bcbf5;};'use strict';var _=require(_0xf560('0x0'));var util=require(_0xf560('0x1'));var moment=require(_0xf560('0x2'));var BPromise=require(_0xf560('0x3'));var rs=require(_0xf560('0x4'));var fs=require('fs');var Redis=require(_0xf560('0x5'));var db=require(_0xf560('0x6'))['db'];var utils=require(_0xf560('0x7'));var logger=require(_0xf560('0x8'))('rpc');var config=require(_0xf560('0x9'));var jayson=require(_0xf560('0xa'));var client=jayson[_0xf560('0xb')][_0xf560('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbe6d96,_0x33e24f,_0x3c912f){return new BPromise(function(_0x5478ff,_0x746e89){return client[_0xf560('0xd')](_0xbe6d96,_0x3c912f)['then'](function(_0x205efd){logger['info'](_0xf560('0xe'),_0x33e24f,_0xf560('0xf'));logger[_0xf560('0x10')](_0xf560('0x11'),_0x33e24f,_0xf560('0xf'),JSON[_0xf560('0x12')](_0x205efd));if(_0x205efd['error']){if(_0x205efd[_0xf560('0x13')][_0xf560('0x14')]===0x1f4){logger[_0xf560('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x33e24f,_0x205efd[_0xf560('0x13')][_0xf560('0x15')]);return _0x746e89(_0x205efd[_0xf560('0x13')]['message']);}logger[_0xf560('0x13')](_0xf560('0xe'),_0x33e24f,_0x205efd[_0xf560('0x13')][_0xf560('0x15')]);return _0x5478ff(_0x205efd[_0xf560('0x13')][_0xf560('0x15')]);}else{logger[_0xf560('0x16')](_0xf560('0xe'),_0x33e24f,'request\x20sent');_0x5478ff(_0x205efd[_0xf560('0x17')][_0xf560('0x15')]);}})[_0xf560('0x18')](function(_0x39faad){logger[_0xf560('0x13')](_0xf560('0xe'),_0x33e24f,_0x39faad);_0x746e89(_0x39faad);});});}exports[_0xf560('0x19')]=function(_0x134f2d){var _0x53a3a7=this;return new Promise(function(_0x369e63,_0x5e4075){return db[_0xf560('0x1a')]['create'](_0x134f2d[_0xf560('0x1b')],{'raw':_0x134f2d[_0xf560('0x1c')]?_0x134f2d[_0xf560('0x1c')][_0xf560('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3041fc){logger['info'](_0xf560('0x19'),_0x134f2d);logger[_0xf560('0x10')](_0xf560('0x19'),_0x134f2d,JSON[_0xf560('0x12')](_0x3041fc));_0x369e63(_0x3041fc);})[_0xf560('0x18')](function(_0x4b604a){logger['error'](_0xf560('0x19'),_0x4b604a[_0xf560('0x15')],_0x134f2d);_0x5e4075(_0x53a3a7['error'](0x1f4,_0x4b604a[_0xf560('0x15')]));});});};exports[_0xf560('0x1e')]=function(_0x153238){var _0x622f49=this;return new Promise(function(_0x1c23e0,_0x192b81){return db[_0xf560('0x1a')][_0xf560('0x1f')](_0x153238[_0xf560('0x1b')],{'raw':_0x153238[_0xf560('0x1c')]?_0x153238[_0xf560('0x1c')][_0xf560('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153238[_0xf560('0x1c')]?_0x153238['options']['where']||null:null,'attributes':_0x153238[_0xf560('0x1c')]?_0x153238['options'][_0xf560('0x20')]||null:null,'limit':_0x153238[_0xf560('0x1c')]?_0x153238[_0xf560('0x1c')]['limit']||null:null})[_0xf560('0x21')](function(_0x4c054a){logger['info']('UpdateVoiceDialReport',_0x153238);logger[_0xf560('0x10')](_0xf560('0x1e'),_0x153238,JSON['stringify'](_0x4c054a));_0x1c23e0(_0x4c054a);})[_0xf560('0x18')](function(_0xc8b597){logger[_0xf560('0x13')]('UpdateVoiceDialReport',_0xc8b597[_0xf560('0x15')],_0x153238);_0x192b81(_0x622f49[_0xf560('0x13')](0x1f4,_0xc8b597['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b7bacf2..25ef099 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 _0x8cba=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','addApplications','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x8cba,0xa3));var _0xa8cb=function(_0x1785e8,_0x492aac){_0x1785e8=_0x1785e8-0x0;var _0x5e6021=_0x8cba[_0x1785e8];return _0x5e6021;};'use strict';var multer=require(_0xa8cb('0x0'));var util=require(_0xa8cb('0x1'));var path=require('path');var timeout=require(_0xa8cb('0x2'));var express=require(_0xa8cb('0x3'));var router=express[_0xa8cb('0x4')]();var fs_extra=require(_0xa8cb('0x5'));var auth=require(_0xa8cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8cb('0x7'));var controller=require(_0xa8cb('0x8'));router[_0xa8cb('0x9')]('/',auth[_0xa8cb('0xa')](),controller[_0xa8cb('0xb')]);router['get'](_0xa8cb('0xc'),auth['isAuthenticated'](),controller[_0xa8cb('0xd')]);router[_0xa8cb('0xe')]('/',auth[_0xa8cb('0xa')](),controller['create']);router[_0xa8cb('0xe')]('/:id/applications',auth[_0xa8cb('0xa')](),controller[_0xa8cb('0xf')]);router[_0xa8cb('0x10')](_0xa8cb('0xc'),auth[_0xa8cb('0xa')](),controller[_0xa8cb('0x11')]);router['delete']('/:id',auth[_0xa8cb('0xa')](),controller['destroy']);module[_0xa8cb('0x12')]=router; \ No newline at end of file +var _0x41f2=['update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','put'];(function(_0x114597,_0x2e6a4d){var _0x77bd13=function(_0x45fd70){while(--_0x45fd70){_0x114597['push'](_0x114597['shift']());}};_0x77bd13(++_0x2e6a4d);}(_0x41f2,0x81));var _0x241f=function(_0x4e8d25,_0x3945c5){_0x4e8d25=_0x4e8d25-0x0;var _0x48daef=_0x41f2[_0x4e8d25];return _0x48daef;};'use strict';var multer=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x241f('0x2'));var router=express[_0x241f('0x3')]();var fs_extra=require(_0x241f('0x4'));var auth=require(_0x241f('0x5'));var interaction=require(_0x241f('0x6'));var config=require(_0x241f('0x7'));var controller=require(_0x241f('0x8'));router[_0x241f('0x9')]('/',auth[_0x241f('0xa')](),controller[_0x241f('0xb')]);router[_0x241f('0x9')](_0x241f('0xc'),auth['isAuthenticated'](),controller[_0x241f('0xd')]);router[_0x241f('0xe')]('/',auth[_0x241f('0xa')](),controller[_0x241f('0xf')]);router[_0x241f('0xe')](_0x241f('0x10'),auth[_0x241f('0xa')](),controller['addApplications']);router[_0x241f('0x11')](_0x241f('0xc'),auth[_0x241f('0xa')](),controller[_0x241f('0x12')]);router[_0x241f('0x13')]('/:id',auth[_0x241f('0xa')](),controller['destroy']);module[_0x241f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 534a3bd..6b5d172 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 _0x103a=['getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','system','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x103a,0x134));var _0xa103=function(_0xee852a,_0xaa3a3a){_0xee852a=_0xee852a-0x0;var _0x2af24d=_0x103a[_0xee852a];return _0x2af24d;};'use strict';var Sequelize=require(_0xa103('0x0'));module[_0xa103('0x1')]={'context':{'type':Sequelize[_0xa103('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xa103('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xa103('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa103('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xa103('0x5')](_0xa103('0x6'),_0xa103('0x7'),_0xa103('0x8'),'inbound-fax','outbound-fax',_0xa103('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa103('0x2')],'allowNull':![],'defaultValue':_0xa103('0xa')},'IntervalId':{'type':Sequelize[_0xa103('0xb')]},'isApp':{'type':Sequelize[_0xa103('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa103('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa103('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xa103('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa103('0xb')]},'recordingFormat':{'type':Sequelize[_0xa103('0x2')],'defaultValue':_0xa103('0xd')},'answer':{'type':Sequelize[_0xa103('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa103('0xe')],'get':function(_0x10e608){return this[_0xa103('0xf')](_0xa103('0x10'));}},'alias':{'type':Sequelize[_0xa103('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8150=['getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL'];(function(_0x2f6c03,_0xf9f9cf){var _0x3fb69e=function(_0x21603f){while(--_0x21603f){_0x2f6c03['push'](_0x2f6c03['shift']());}};_0x3fb69e(++_0xf9f9cf);}(_0x8150,0xb2));var _0x0815=function(_0x1d7127,_0x5d7325){_0x1d7127=_0x1d7127-0x0;var _0x43ce47=_0x8150[_0x1d7127];return _0x43ce47;};'use strict';var Sequelize=require('sequelize');module[_0x0815('0x0')]={'context':{'type':Sequelize[_0x0815('0x1')],'allowNull':![],'unique':_0x0815('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0815('0x1')],'allowNull':![],'unique':_0x0815('0x2')},'priority':{'type':Sequelize[_0x0815('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x0815('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0815('0x3')},'appdata':{'type':Sequelize[_0x0815('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0815('0x4')]('inbound',_0x0815('0x5'),'internal',_0x0815('0x6'),_0x0815('0x7'),'system',_0x0815('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0815('0x9')},'IntervalId':{'type':Sequelize[_0x0815('0xa')]},'isApp':{'type':Sequelize[_0x0815('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0815('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x0815('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0815('0xa')]},'recordingFormat':{'type':Sequelize[_0x0815('0x1')],'defaultValue':_0x0815('0xc')},'answer':{'type':Sequelize[_0x0815('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0815('0xd')],'get':function(_0x48a8d7){return this[_0x0815('0xe')](_0x0815('0xf'));}},'alias':{'type':Sequelize[_0x0815('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 82ed670..b9f9167 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 _0x17c2=['localhost','socket.io-emitter','./voiceExtension.socket','undefined','limit','count','offset','status','Content-Range','json','destroy','get','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','value','type','name','UserProfileResource','then','error','send','map','VoiceExtension','rawAttributes','key','query','keys','model','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','outbound','exten','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x3f280a,_0xabd9fd){var _0x1ee43e=function(_0x1ca574){while(--_0x1ca574){_0x3f280a['push'](_0x3f280a['shift']());}};_0x1ee43e(++_0xabd9fd);}(_0x17c2,0x188));var _0x217c=function(_0x89ee68,_0x18ca4d){_0x89ee68=_0x89ee68-0x0;var _0x1dfd3b=_0x17c2[_0x89ee68];return _0x1dfd3b;};'use strict';var _=require('lodash');var Redis=require(_0x217c('0x0'));var qs=require(_0x217c('0x1'));var logger=require(_0x217c('0x2'))(_0x217c('0x3'));var config=require(_0x217c('0x4'));var db=require(_0x217c('0x5'))['db'];config[_0x217c('0x6')]=_[_0x217c('0x7')](config[_0x217c('0x6')],{'host':_0x217c('0x8'),'port':0x18eb});var socket=require(_0x217c('0x9'))(new Redis(config[_0x217c('0x6')]));require(_0x217c('0xa'))['register'](socket);function respondWithStatusCode(_0x5932cc,_0x3d7147){_0x3d7147=_0x3d7147||0xcc;return function(_0x3cb9be){if(_0x3cb9be){return _0x5932cc['sendStatus'](_0x3d7147);}return _0x5932cc['status'](_0x3d7147)['end']();};}function respondWithResult(_0x22e3e5,_0x3b0d7d){_0x3b0d7d=_0x3b0d7d||0xc8;return function(_0xdf1b2c){if(_0xdf1b2c){return _0x22e3e5['status'](_0x3b0d7d)['json'](_0xdf1b2c);}};}function respondWithFilteredResult(_0x2d8049,_0x2fe8e3){return function(_0x4c2574){if(_0x4c2574){var _0x3286ee=typeof _0x2fe8e3['offset']===_0x217c('0xb')&&typeof _0x2fe8e3[_0x217c('0xc')]===_0x217c('0xb');var _0x4efe8b=_0x4c2574[_0x217c('0xd')];var _0x1e9e13=_0x3286ee?0x0:_0x2fe8e3['offset'];var _0x3561fa=_0x3286ee?_0x4c2574[_0x217c('0xd')]:_0x2fe8e3[_0x217c('0xe')]+_0x2fe8e3[_0x217c('0xc')];var _0x2a6da9;if(_0x3561fa>=_0x4efe8b){_0x3561fa=_0x4efe8b;_0x2a6da9=0xc8;}else{_0x2a6da9=0xce;}_0x2d8049[_0x217c('0xf')](_0x2a6da9);return _0x2d8049['set'](_0x217c('0x10'),_0x1e9e13+'-'+_0x3561fa+'/'+_0x4efe8b)[_0x217c('0x11')](_0x4c2574);}return null;};}function removeEntity(_0xaf517c){return function(_0x2f067b){if(_0x2f067b){return _0x2f067b[_0x217c('0x12')]()['then'](function(){var _0x5373cb=_0x2f067b[_0x217c('0x13')]({'plain':!![]});var _0x4865e5=[{'name':'InboundRoutes','value':_0x217c('0x14'),'ignore':![]},{'name':_0x217c('0x15'),'value':'outbound','ignore':![]},{'name':_0x217c('0x16'),'value':_0x217c('0x17'),'ignore':![]}];var _0x3f329b=_(_0x4865e5)[_0x217c('0x18')](_0x217c('0x19'))['map'](_0x217c('0x1a'))[_0x217c('0x1a')]();if(_['includes'](_0x3f329b,_0x5373cb[_0x217c('0x1b')])){return;}var _0x15d7cd=_['find'](_0x4865e5,[_0x217c('0x1a'),_0x5373cb['type']])[_0x217c('0x1c')];return db[_0x217c('0x1d')][_0x217c('0x12')]({'where':{'type':_0x15d7cd,'resourceId':_0x5373cb['id']}})['then'](function(){return _0x2f067b;});})[_0x217c('0x1e')](function(){_0xaf517c[_0x217c('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5575fe){return function(_0x24c217){if(!_0x24c217){_0x5575fe['sendStatus'](0x194);}return _0x24c217;};}function handleError(_0x877c2c,_0x51e6b9){_0x51e6b9=_0x51e6b9||0x1f4;return function(_0x15f242){logger[_0x217c('0x1f')](_0x15f242['stack']);if(_0x15f242[_0x217c('0x1c')]){delete _0x15f242[_0x217c('0x1c')];}_0x877c2c[_0x217c('0xf')](_0x51e6b9)[_0x217c('0x20')](_0x15f242);};}exports['index']=function(_0x17ef2d,_0x38f8d1){var _0x5d1c30={},_0x2f1778={},_0x1b5b42={'count':0x0,'rows':[]};var _0x22309a=_[_0x217c('0x21')](db[_0x217c('0x22')][_0x217c('0x23')],function(_0x13297a){return{'name':_0x13297a['fieldName'],'type':_0x13297a[_0x217c('0x1b')][_0x217c('0x24')]};});_0x2f1778['model']=_[_0x217c('0x21')](_0x22309a,_0x217c('0x1c'));_0x2f1778[_0x217c('0x25')]=_[_0x217c('0x26')](_0x17ef2d[_0x217c('0x25')]);_0x2f1778['filters']=_['intersection'](_0x2f1778[_0x217c('0x27')],_0x2f1778[_0x217c('0x25')]);_0x5d1c30['attributes']=_[_0x217c('0x28')](_0x2f1778[_0x217c('0x27')],qs['fields'](_0x17ef2d[_0x217c('0x25')]['fields']));_0x5d1c30['attributes']=_0x5d1c30[_0x217c('0x29')]['length']?_0x5d1c30[_0x217c('0x29')]:_0x2f1778[_0x217c('0x27')];if(!_0x17ef2d[_0x217c('0x25')][_0x217c('0x2a')](_0x217c('0x2b'))){_0x5d1c30[_0x217c('0xc')]=qs[_0x217c('0xc')](_0x17ef2d[_0x217c('0x25')][_0x217c('0xc')]);_0x5d1c30[_0x217c('0xe')]=qs[_0x217c('0xe')](_0x17ef2d[_0x217c('0x25')][_0x217c('0xe')]);}_0x5d1c30['order']=qs[_0x217c('0x2c')](_0x17ef2d[_0x217c('0x25')][_0x217c('0x2c')]);_0x5d1c30[_0x217c('0x2d')]=qs[_0x217c('0x2e')](_[_0x217c('0x2f')](_0x17ef2d[_0x217c('0x25')],_0x2f1778[_0x217c('0x2e')]),_0x22309a);if(_0x17ef2d[_0x217c('0x25')][_0x217c('0x18')]){_0x5d1c30[_0x217c('0x2d')]=_[_0x217c('0x30')](_0x5d1c30[_0x217c('0x2d')],{'$or':_['map'](_0x22309a,function(_0x270ef3){if(_0x270ef3[_0x217c('0x1b')]!=='VIRTUAL'){var _0x219fae={};_0x219fae[_0x270ef3[_0x217c('0x1c')]]={'$like':'%'+_0x17ef2d[_0x217c('0x25')][_0x217c('0x18')]+'%'};return _0x219fae;}})});}_0x5d1c30=_[_0x217c('0x30')]({},_0x5d1c30,_0x17ef2d[_0x217c('0x31')]);var _0x558799={'where':_0x5d1c30['where']};return db[_0x217c('0x22')][_0x217c('0xd')](_0x558799)[_0x217c('0x1e')](function(_0x5ad164){_0x1b5b42[_0x217c('0xd')]=_0x5ad164;if(_0x17ef2d[_0x217c('0x25')][_0x217c('0x32')]){_0x5d1c30['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x217c('0x33')](_0x5d1c30);})[_0x217c('0x1e')](function(_0x479328){_0x1b5b42[_0x217c('0x34')]=_0x479328;return _0x1b5b42;})[_0x217c('0x1e')](respondWithFilteredResult(_0x38f8d1,_0x5d1c30))[_0x217c('0x35')](handleError(_0x38f8d1,null));};exports[_0x217c('0x36')]=function(_0x57d5db,_0x2e4c6f){var _0x3f99f6={'raw':![],'where':{'id':_0x57d5db[_0x217c('0x37')]['id']}},_0x270e02={};_0x270e02[_0x217c('0x27')]=_['keys'](db[_0x217c('0x22')][_0x217c('0x23')]);_0x270e02['query']=_['keys'](_0x57d5db[_0x217c('0x25')]);_0x270e02[_0x217c('0x2e')]=_[_0x217c('0x28')](_0x270e02[_0x217c('0x27')],_0x270e02[_0x217c('0x25')]);_0x3f99f6[_0x217c('0x29')]=_[_0x217c('0x28')](_0x270e02[_0x217c('0x27')],qs[_0x217c('0x38')](_0x57d5db['query'][_0x217c('0x38')]));_0x3f99f6[_0x217c('0x29')]=_0x3f99f6[_0x217c('0x29')]['length']?_0x3f99f6[_0x217c('0x29')]:_0x270e02['model'];if(_0x57d5db['query']['includeAll']){_0x3f99f6[_0x217c('0x39')]=[{'all':!![]}];}_0x3f99f6=_['merge']({},_0x3f99f6,_0x57d5db[_0x217c('0x31')]);return db['VoiceExtension'][_0x217c('0x3a')](_0x3f99f6)[_0x217c('0x1e')](handleEntityNotFound(_0x2e4c6f,null))[_0x217c('0x1e')](respondWithResult(_0x2e4c6f,null))[_0x217c('0x35')](handleError(_0x2e4c6f,null));};exports[_0x217c('0x12')]=function(_0x34a46a,_0xccc78e){return db[_0x217c('0x22')][_0x217c('0x3a')]({'where':{'id':_0x34a46a['params']['id']}})[_0x217c('0x1e')](handleEntityNotFound(_0xccc78e,null))[_0x217c('0x1e')](removeEntity(_0xccc78e,null))['catch'](handleError(_0xccc78e,null));};exports[_0x217c('0x3b')]=function(_0x158264,_0x5aa81a){if(_0x158264[_0x217c('0x3c')][_0x217c('0x1b')]===_0x217c('0x3d')&&!_['startsWith'](_0x158264[_0x217c('0x3c')][_0x217c('0x3e')],'_')){_0x158264[_0x217c('0x3c')][_0x217c('0x3e')]='_'['concat'](_0x158264['body'][_0x217c('0x3e')]);}return db[_0x217c('0x22')]['create'](_0x158264[_0x217c('0x3c')],{'raw':![]})['then'](function(_0x160359){var _0x5a942b=_0x158264[_0x217c('0x3f')]['get']({'plain':!![]});if(!_0x5a942b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a942b[_0x217c('0x40')]===_0x217c('0x3f')){var _0x26c2bd=_0x160359[_0x217c('0x13')]({'plain':!![]});var _0x3f18e3=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x217c('0x15'),'value':_0x217c('0x3d')},{'name':_0x217c('0x16'),'value':_0x217c('0x17')}];var _0xe77b8f=_[_0x217c('0x3a')](_0x3f18e3,[_0x217c('0x1a'),_0x26c2bd[_0x217c('0x1b')]])[_0x217c('0x1c')];return db['UserProfileSection'][_0x217c('0x3a')]({'where':{'name':_0xe77b8f,'userProfileId':_0x5a942b[_0x217c('0x41')]},'raw':!![]})[_0x217c('0x1e')](function(_0x13c468){if(_0x13c468&&_0x13c468['autoAssociation']===0x0){return db[_0x217c('0x1d')]['create']({'name':_0x26c2bd['name'],'resourceId':_0x26c2bd['id'],'type':_0x13c468[_0x217c('0x1c')],'sectionId':_0x13c468['id']},{})[_0x217c('0x1e')](function(){return _0x160359;});}else{return _0x160359;}})['catch'](function(_0x1239e9){logger[_0x217c('0x1f')](_0x217c('0x42'),_0x1239e9);throw _0x1239e9;});}return _0x160359;})[_0x217c('0x1e')](respondWithResult(_0x5aa81a,0xc9))[_0x217c('0x35')](handleError(_0x5aa81a,null));};exports[_0x217c('0x43')]=function(_0x33b881,_0x1e58c9){if(_0x33b881[_0x217c('0x3c')]['id']){delete _0x33b881[_0x217c('0x3c')]['id'];}return db['VoiceExtension'][_0x217c('0x3a')]({'where':{'id':_0x33b881['params']['id']}})['then'](handleEntityNotFound(_0x1e58c9,null))['then'](function(_0x2730cc){if(_0x2730cc){return db[_0x217c('0x22')]['update'](_['pick'](_0x33b881[_0x217c('0x3c')],['exten',_0x217c('0x44'),'description','recordingFormat','cutdigits','mandatoryDisposition',_0x217c('0x45')]),{'where':{'context':_0x2730cc[_0x217c('0x44')],'exten':_0x2730cc[_0x217c('0x3e')]},'individualHooks':!![]})[_0x217c('0x1e')](function(_0x3fd7ea){return _0x3fd7ea;});}return null;})[_0x217c('0x1e')](respondWithStatusCode(_0x1e58c9,null))[_0x217c('0x35')](handleError(_0x1e58c9,null));};exports['addApplications']=function(_0x4491e4,_0x42cff7){var _0x11ee11=_0x4491e4[_0x217c('0x37')]['id'];var _0x249936=_0x4491e4[_0x217c('0x3c')];var _0xc6cc3f=0xc8;var _0x1a8bd3=null;return db[_0x217c('0x46')]['transaction']({'isolationLevel':db[_0x217c('0x46')][_0x217c('0x47')][_0x217c('0x48')][_0x217c('0x49')]},function(_0x362792){return db[_0x217c('0x22')]['findOne']({'where':{'id':_0x11ee11},'transaction':_0x362792})[_0x217c('0x1e')](function(_0x34df05){if(_0x34df05){return db[_0x217c('0x22')][_0x217c('0x12')]({'where':{'VoiceExtensionId':_0x11ee11},'transaction':_0x362792})[_0x217c('0x1e')](function(){var _0x31e4a7=_[_0x217c('0x21')](_0x249936,function(_0x3d2237){_0x3d2237[_0x217c('0x4a')]=_0x11ee11;_0x3d2237[_0x217c('0x4b')]=!![];return _0x3d2237;});return _0x34df05['createRouting'](_0x31e4a7);})[_0x217c('0x1e')](function(_0x23570b){return db['VoiceExtension'][_0x217c('0x4c')](_0x23570b,{'transaction':_0x362792});});}else{_0xc6cc3f=0x194;_0x1a8bd3=[];}});})['then'](function(){if(_0xc6cc3f!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x11ee11},'order':_0x217c('0x4d')})[_0x217c('0x1e')](function(_0x4f2e78){_0x1a8bd3=_0x4f2e78;});}})['catch'](function(_0x163acc){_0xc6cc3f=0x1f4;logger[_0x217c('0x1f')](_0x163acc[_0x217c('0x4e')]);if(_0x163acc[_0x217c('0x1c')]){delete _0x163acc[_0x217c('0x1c')];}_0x1a8bd3=_0x163acc;})[_0x217c('0x4f')](function(){if(_0x1a8bd3===null){_0x42cff7['sendStatus'](_0xc6cc3f);}else{if(_0xc6cc3f===0x1f4){_0x42cff7['status'](_0xc6cc3f)[_0x217c('0x20')](_0x1a8bd3);}else{_0x42cff7[_0x217c('0xf')](_0xc6cc3f)[_0x217c('0x11')](_0x1a8bd3);}}});}; \ No newline at end of file +var _0x88e2=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','send','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','VoiceExtension','rawAttributes','fieldName','key','query','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','keys','intersection','includeAll','destroy','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','userProfileId'];(function(_0x42ed13,_0x3b4ac9){var _0xee1201=function(_0x24b44a){while(--_0x24b44a){_0x42ed13['push'](_0x42ed13['shift']());}};_0xee1201(++_0x3b4ac9);}(_0x88e2,0x6a));var _0x288e=function(_0x2babbf,_0x11a0da){_0x2babbf=_0x2babbf-0x0;var _0x46d2b8=_0x88e2[_0x2babbf];return _0x46d2b8;};'use strict';var _=require(_0x288e('0x0'));var Redis=require('ioredis');var qs=require(_0x288e('0x1'));var logger=require(_0x288e('0x2'))(_0x288e('0x3'));var config=require('../../config/environment');var db=require(_0x288e('0x4'))['db'];config[_0x288e('0x5')]=_[_0x288e('0x6')](config['redis'],{'host':_0x288e('0x7'),'port':0x18eb});var socket=require(_0x288e('0x8'))(new Redis(config['redis']));require(_0x288e('0x9'))[_0x288e('0xa')](socket);function respondWithStatusCode(_0x517a7f,_0x339f0a){_0x339f0a=_0x339f0a||0xcc;return function(_0x28a713){if(_0x28a713){return _0x517a7f[_0x288e('0xb')](_0x339f0a);}return _0x517a7f['status'](_0x339f0a)[_0x288e('0xc')]();};}function respondWithResult(_0x3bb89a,_0x59b3ca){_0x59b3ca=_0x59b3ca||0xc8;return function(_0x5a3b85){if(_0x5a3b85){return _0x3bb89a[_0x288e('0xd')](_0x59b3ca)[_0x288e('0xe')](_0x5a3b85);}};}function respondWithFilteredResult(_0x2ef98c,_0x2657f0){return function(_0x18890b){if(_0x18890b){var _0x339080=typeof _0x2657f0['offset']===_0x288e('0xf')&&typeof _0x2657f0[_0x288e('0x10')]===_0x288e('0xf');var _0x270079=_0x18890b[_0x288e('0x11')];var _0xbe9a6b=_0x339080?0x0:_0x2657f0[_0x288e('0x12')];var _0x124a66=_0x339080?_0x18890b[_0x288e('0x11')]:_0x2657f0[_0x288e('0x12')]+_0x2657f0[_0x288e('0x10')];var _0x5f53e0;if(_0x124a66>=_0x270079){_0x124a66=_0x270079;_0x5f53e0=0xc8;}else{_0x5f53e0=0xce;}_0x2ef98c[_0x288e('0xd')](_0x5f53e0);return _0x2ef98c['set'](_0x288e('0x13'),_0xbe9a6b+'-'+_0x124a66+'/'+_0x270079)['json'](_0x18890b);}return null;};}function removeEntity(_0xdb5abc){return function(_0x271015){if(_0x271015){return _0x271015['destroy']()[_0x288e('0x14')](function(){var _0x58a71=_0x271015[_0x288e('0x15')]({'plain':!![]});var _0x32942a=[{'name':_0x288e('0x16'),'value':_0x288e('0x17'),'ignore':![]},{'name':_0x288e('0x18'),'value':_0x288e('0x19'),'ignore':![]},{'name':'InternalRoutes','value':_0x288e('0x1a'),'ignore':![]}];var _0x51dcf0=_(_0x32942a)['filter'](_0x288e('0x1b'))[_0x288e('0x1c')](_0x288e('0x1d'))[_0x288e('0x1d')]();if(_[_0x288e('0x1e')](_0x51dcf0,_0x58a71[_0x288e('0x1f')])){return;}var _0x353074=_[_0x288e('0x20')](_0x32942a,[_0x288e('0x1d'),_0x58a71[_0x288e('0x1f')]])['name'];return db[_0x288e('0x21')]['destroy']({'where':{'type':_0x353074,'resourceId':_0x58a71['id']}})[_0x288e('0x14')](function(){return _0x271015;});})['then'](function(){_0xdb5abc[_0x288e('0xd')](0xcc)[_0x288e('0xc')]();});}};}function handleEntityNotFound(_0x4eb99f){return function(_0x5ac2ec){if(!_0x5ac2ec){_0x4eb99f[_0x288e('0xb')](0x194);}return _0x5ac2ec;};}function handleError(_0x192d9f,_0x25ffc6){_0x25ffc6=_0x25ffc6||0x1f4;return function(_0x52fb01){logger[_0x288e('0x22')](_0x52fb01[_0x288e('0x23')]);if(_0x52fb01['name']){delete _0x52fb01[_0x288e('0x24')];}_0x192d9f['status'](_0x25ffc6)['send'](_0x52fb01);};}exports['index']=function(_0xd2feeb,_0x36f3e0){var _0x5d8548={},_0x2d1ea2={},_0x3a572f={'count':0x0,'rows':[]};var _0x31e1a3=_[_0x288e('0x1c')](db[_0x288e('0x25')][_0x288e('0x26')],function(_0x21e0f1){return{'name':_0x21e0f1[_0x288e('0x27')],'type':_0x21e0f1[_0x288e('0x1f')][_0x288e('0x28')]};});_0x2d1ea2['model']=_[_0x288e('0x1c')](_0x31e1a3,_0x288e('0x24'));_0x2d1ea2[_0x288e('0x29')]=_['keys'](_0xd2feeb['query']);_0x2d1ea2['filters']=_['intersection'](_0x2d1ea2[_0x288e('0x2a')],_0x2d1ea2[_0x288e('0x29')]);_0x5d8548[_0x288e('0x2b')]=_['intersection'](_0x2d1ea2['model'],qs['fields'](_0xd2feeb[_0x288e('0x29')][_0x288e('0x2c')]));_0x5d8548[_0x288e('0x2b')]=_0x5d8548['attributes'][_0x288e('0x2d')]?_0x5d8548['attributes']:_0x2d1ea2[_0x288e('0x2a')];if(!_0xd2feeb[_0x288e('0x29')][_0x288e('0x2e')](_0x288e('0x2f'))){_0x5d8548[_0x288e('0x10')]=qs['limit'](_0xd2feeb[_0x288e('0x29')][_0x288e('0x10')]);_0x5d8548[_0x288e('0x12')]=qs[_0x288e('0x12')](_0xd2feeb[_0x288e('0x29')][_0x288e('0x12')]);}_0x5d8548['order']=qs[_0x288e('0x30')](_0xd2feeb[_0x288e('0x29')][_0x288e('0x30')]);_0x5d8548[_0x288e('0x31')]=qs['filters'](_['pick'](_0xd2feeb[_0x288e('0x29')],_0x2d1ea2[_0x288e('0x32')]),_0x31e1a3);if(_0xd2feeb[_0x288e('0x29')]['filter']){_0x5d8548[_0x288e('0x31')]=_[_0x288e('0x33')](_0x5d8548[_0x288e('0x31')],{'$or':_[_0x288e('0x1c')](_0x31e1a3,function(_0x39d3f1){if(_0x39d3f1[_0x288e('0x1f')]!==_0x288e('0x34')){var _0x2718b5={};_0x2718b5[_0x39d3f1[_0x288e('0x24')]]={'$like':'%'+_0xd2feeb[_0x288e('0x29')][_0x288e('0x35')]+'%'};return _0x2718b5;}})});}_0x5d8548=_[_0x288e('0x33')]({},_0x5d8548,_0xd2feeb['options']);var _0x3c4077={'where':_0x5d8548[_0x288e('0x31')]};return db[_0x288e('0x25')]['count'](_0x3c4077)[_0x288e('0x14')](function(_0x2991d6){_0x3a572f[_0x288e('0x11')]=_0x2991d6;if(_0xd2feeb[_0x288e('0x29')]['includeAll']){_0x5d8548[_0x288e('0x36')]=[{'all':!![]}];}return db[_0x288e('0x25')][_0x288e('0x37')](_0x5d8548);})[_0x288e('0x14')](function(_0x25a580){_0x3a572f[_0x288e('0x38')]=_0x25a580;return _0x3a572f;})[_0x288e('0x14')](respondWithFilteredResult(_0x36f3e0,_0x5d8548))[_0x288e('0x39')](handleError(_0x36f3e0,null));};exports[_0x288e('0x3a')]=function(_0x5d425e,_0x55718c){var _0x18d1b6={'raw':![],'where':{'id':_0x5d425e[_0x288e('0x3b')]['id']}},_0x5926d6={};_0x5926d6['model']=_['keys'](db['VoiceExtension'][_0x288e('0x26')]);_0x5926d6[_0x288e('0x29')]=_[_0x288e('0x3c')](_0x5d425e[_0x288e('0x29')]);_0x5926d6[_0x288e('0x32')]=_[_0x288e('0x3d')](_0x5926d6[_0x288e('0x2a')],_0x5926d6[_0x288e('0x29')]);_0x18d1b6['attributes']=_[_0x288e('0x3d')](_0x5926d6['model'],qs['fields'](_0x5d425e[_0x288e('0x29')][_0x288e('0x2c')]));_0x18d1b6[_0x288e('0x2b')]=_0x18d1b6['attributes'][_0x288e('0x2d')]?_0x18d1b6[_0x288e('0x2b')]:_0x5926d6[_0x288e('0x2a')];if(_0x5d425e[_0x288e('0x29')][_0x288e('0x3e')]){_0x18d1b6['include']=[{'all':!![]}];}_0x18d1b6=_[_0x288e('0x33')]({},_0x18d1b6,_0x5d425e['options']);return db[_0x288e('0x25')]['find'](_0x18d1b6)['then'](handleEntityNotFound(_0x55718c,null))[_0x288e('0x14')](respondWithResult(_0x55718c,null))[_0x288e('0x39')](handleError(_0x55718c,null));};exports[_0x288e('0x3f')]=function(_0x405f19,_0xa1b993){return db['VoiceExtension'][_0x288e('0x20')]({'where':{'id':_0x405f19['params']['id']}})[_0x288e('0x14')](handleEntityNotFound(_0xa1b993,null))['then'](removeEntity(_0xa1b993,null))[_0x288e('0x39')](handleError(_0xa1b993,null));};exports['create']=function(_0x2b50d7,_0x53da3c){if(_0x2b50d7[_0x288e('0x40')][_0x288e('0x1f')]==='outbound'&&!_[_0x288e('0x41')](_0x2b50d7['body'][_0x288e('0x42')],'_')){_0x2b50d7[_0x288e('0x40')][_0x288e('0x42')]='_'[_0x288e('0x43')](_0x2b50d7[_0x288e('0x40')][_0x288e('0x42')]);}return db['VoiceExtension'][_0x288e('0x44')](_0x2b50d7[_0x288e('0x40')],{'raw':![]})[_0x288e('0x14')](function(_0x50cbc0){var _0x4d90a8=_0x2b50d7[_0x288e('0x45')][_0x288e('0x15')]({'plain':!![]});if(!_0x4d90a8)throw new Error(_0x288e('0x46'));if(_0x4d90a8[_0x288e('0x47')]===_0x288e('0x45')){var _0x1c40c0=_0x50cbc0[_0x288e('0x15')]({'plain':!![]});var _0x1a05c3=[{'name':_0x288e('0x16'),'value':_0x288e('0x17')},{'name':_0x288e('0x18'),'value':'outbound'},{'name':_0x288e('0x48'),'value':_0x288e('0x1a')}];var _0x473651=_[_0x288e('0x20')](_0x1a05c3,[_0x288e('0x1d'),_0x1c40c0[_0x288e('0x1f')]])[_0x288e('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x473651,'userProfileId':_0x4d90a8[_0x288e('0x49')]},'raw':!![]})[_0x288e('0x14')](function(_0x3107bd){if(_0x3107bd&&_0x3107bd['autoAssociation']===0x0){return db[_0x288e('0x21')][_0x288e('0x44')]({'name':_0x1c40c0['name'],'resourceId':_0x1c40c0['id'],'type':_0x3107bd[_0x288e('0x24')],'sectionId':_0x3107bd['id']},{})[_0x288e('0x14')](function(){return _0x50cbc0;});}else{return _0x50cbc0;}})[_0x288e('0x39')](function(_0x33d056){logger[_0x288e('0x22')](_0x288e('0x4a'),_0x33d056);throw _0x33d056;});}return _0x50cbc0;})[_0x288e('0x14')](respondWithResult(_0x53da3c,0xc9))[_0x288e('0x39')](handleError(_0x53da3c,null));};exports[_0x288e('0x4b')]=function(_0x29f93d,_0x537168){if(_0x29f93d[_0x288e('0x40')]['id']){delete _0x29f93d[_0x288e('0x40')]['id'];}return db['VoiceExtension'][_0x288e('0x20')]({'where':{'id':_0x29f93d[_0x288e('0x3b')]['id']}})[_0x288e('0x14')](handleEntityNotFound(_0x537168,null))[_0x288e('0x14')](function(_0x17b833){if(_0x17b833){return db[_0x288e('0x25')][_0x288e('0x4b')](_[_0x288e('0x4c')](_0x29f93d[_0x288e('0x40')],[_0x288e('0x42'),_0x288e('0x4d'),'description',_0x288e('0x4e'),'cutdigits',_0x288e('0x4f'),_0x288e('0x50')]),{'where':{'context':_0x17b833[_0x288e('0x4d')],'exten':_0x17b833[_0x288e('0x42')]},'individualHooks':!![]})[_0x288e('0x14')](function(_0x34ae0b){return _0x34ae0b;});}return null;})[_0x288e('0x14')](respondWithStatusCode(_0x537168,null))['catch'](handleError(_0x537168,null));};exports['addApplications']=function(_0x294264,_0x564204){var _0x5b11ca=_0x294264[_0x288e('0x3b')]['id'];var _0x63328b=_0x294264[_0x288e('0x40')];var _0x190fb7=0xc8;var _0x128d1f=null;return db[_0x288e('0x51')][_0x288e('0x52')]({'isolationLevel':db['sequelize'][_0x288e('0x53')][_0x288e('0x54')][_0x288e('0x55')]},function(_0x52637c){return db[_0x288e('0x25')]['findOne']({'where':{'id':_0x5b11ca},'transaction':_0x52637c})[_0x288e('0x14')](function(_0x355af5){if(_0x355af5){return db[_0x288e('0x25')][_0x288e('0x3f')]({'where':{'VoiceExtensionId':_0x5b11ca},'transaction':_0x52637c})[_0x288e('0x14')](function(){var _0x16249e=_[_0x288e('0x1c')](_0x63328b,function(_0x4cdeec){_0x4cdeec['VoiceExtensionId']=_0x5b11ca;_0x4cdeec[_0x288e('0x56')]=!![];return _0x4cdeec;});return _0x355af5['createRouting'](_0x16249e);})[_0x288e('0x14')](function(_0x23829e){return db[_0x288e('0x25')][_0x288e('0x57')](_0x23829e,{'transaction':_0x52637c});});}else{_0x190fb7=0x194;_0x128d1f=[];}});})[_0x288e('0x14')](function(){if(_0x190fb7!==0x194){return db[_0x288e('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5b11ca},'order':_0x288e('0x58')})['then'](function(_0x3aaf77){_0x128d1f=_0x3aaf77;});}})['catch'](function(_0x2edc02){_0x190fb7=0x1f4;logger[_0x288e('0x22')](_0x2edc02['stack']);if(_0x2edc02['name']){delete _0x2edc02[_0x288e('0x24')];}_0x128d1f=_0x2edc02;})['finally'](function(){if(_0x128d1f===null){_0x564204['sendStatus'](_0x190fb7);}else{if(_0x190fb7===0x1f4){_0x564204[_0x288e('0xd')](_0x190fb7)[_0x288e('0x59')](_0x128d1f);}else{_0x564204[_0x288e('0xd')](_0x190fb7)[_0x288e('0xe')](_0x128d1f);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6180dda..5f392ad 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 _0x129f=['remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x97932c,_0x16e944){var _0x5aedc9=function(_0x2ccc43){while(--_0x2ccc43){_0x97932c['push'](_0x97932c['shift']());}};_0x5aedc9(++_0x16e944);}(_0x129f,0xe5));var _0xf129=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x129f[_0xdea41a];return _0x15d0d8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xf129('0x0'))['db'][_0xf129('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf129('0x2')](0x0);var events={'afterCreate':_0xf129('0x3'),'afterUpdate':_0xf129('0x4'),'afterDestroy':_0xf129('0x5')};function emitEvent(_0x3ae520){return function(_0x2b1727,_0x519a74,_0x1a4297){VoiceExtensionEvents[_0xf129('0x6')](_0x3ae520+':'+_0x2b1727['id'],_0x2b1727);VoiceExtensionEvents[_0xf129('0x6')](_0x3ae520,_0x2b1727);_0x1a4297(null);};}for(var e in events){if(events[_0xf129('0x7')](e)){var event=events[e];VoiceExtension[_0xf129('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xd3a0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x16bc8e,_0xaf1b59){var _0x13362d=function(_0x241487){while(--_0x241487){_0x16bc8e['push'](_0x16bc8e['shift']());}};_0x13362d(++_0xaf1b59);}(_0xd3a0,0xcc));var _0x0d3a=function(_0x2d3127,_0x5c8089){_0x2d3127=_0x2d3127-0x0;var _0x470537=_0xd3a0[_0x2d3127];return _0x470537;};'use strict';var EventEmitter=require(_0x0d3a('0x0'));var VoiceExtension=require(_0x0d3a('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d3a('0x2'),'afterUpdate':_0x0d3a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x32ac3f){return function(_0x1b4953,_0x273e26,_0x59c5d9){VoiceExtensionEvents[_0x0d3a('0x4')](_0x32ac3f+':'+_0x1b4953['id'],_0x1b4953);VoiceExtensionEvents[_0x0d3a('0x4')](_0x32ac3f,_0x1b4953);_0x59c5d9(null);};}for(var e in events){if(events[_0x0d3a('0x5')](e)){var event=events[e];VoiceExtension[_0x0d3a('0x6')](e,emitEvent(event));}}module[_0x0d3a('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 087dcfe..a2ce0b7 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 _0xecbe=['CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','name','param','split','prefix','phone','SIP','join','U(xcally-mixmonitor-context)','isEmpty','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','alias','NoOp','No\x20alias\x20set','exten','inbound','push'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xecbe,0x9b));var _0xeecb=function(_0x39e740,_0x3a3084){_0x39e740=_0x39e740-0x0;var _0x49d5fc=_0xecbe[_0x39e740];return _0x49d5fc;};'use strict';var _=require(_0xeecb('0x0'));var attributes=require(_0xeecb('0x1'));module['exports']=function(_0x56096e){var _0x30fcbf=_0x56096e[_0xeecb('0x2')];function _0x2709a3(_0x374ca5){var _0x11de56=0x2;var _0x1f84de=[{'type':_0x374ca5[_0xeecb('0x3')],'app':_0xeecb('0x4'),'appdata':_0xeecb('0x5')+_0x374ca5[_0xeecb('0x3')],'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5['exten'],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']},{'type':_0x374ca5['type'],'app':_0x374ca5[_0xeecb('0x7')]?_0xeecb('0x4'):_0xeecb('0x8'),'appdata':_0x374ca5[_0xeecb('0x7')]?'CDR(routeAlias)='+_0x374ca5[_0xeecb('0x7')]:_0xeecb('0x9'),'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5[_0xeecb('0xa')],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']}];if(_0x374ca5[_0xeecb('0x3')]===_0xeecb('0xb')){_0x1f84de[_0xeecb('0xc')]({'type':_0xeecb('0xb'),'app':'Set','appdata':_0xeecb('0xd')+_0x374ca5['id'],'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5['exten'],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']});}_0x1f84de[_0xeecb('0xc')]({'type':_0x374ca5[_0xeecb('0x3')],'app':_0xeecb('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5[_0xeecb('0xa')],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']},{'type':_0x374ca5['type'],'app':'Set','appdata':_0xeecb('0xe'),'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5['exten'],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']},{'type':_0x374ca5[_0xeecb('0x3')],'app':'Set','appdata':_0xeecb('0xf'),'context':_0x374ca5[_0xeecb('0x6')],'exten':_0x374ca5[_0xeecb('0xa')],'priority':_0x11de56++,'VoiceExtensionId':_0x374ca5['id']});return _0x1f84de;}function _0x5760ed(_0x676ee1){var _0x2d15d5=0x2;var _0x5ce6a7=[{'type':_0xeecb('0x10'),'app':'Set','appdata':_0xeecb('0x11'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0x676ee1[_0xeecb('0x7')]?_0xeecb('0x4'):_0xeecb('0x8'),'appdata':_0x676ee1['alias']?_0xeecb('0x12')+_0x676ee1[_0xeecb('0x7')]:_0xeecb('0x9'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x13')+(_0x676ee1[_0xeecb('0x14')]?_0xeecb('0x15')+_0x676ee1['cutdigits']+'}':_0xeecb('0x16')),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':'Set','appdata':_0xeecb('0xd')+_0x676ee1['id'],'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':'ExecIf','appdata':_0xeecb('0x17')+(_0x2d15d5+0x2)+_0xeecb('0x18')+(_0x2d15d5+0x1)+')','context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':'Set','appdata':_0x676ee1[_0xeecb('0x14')]?_0xeecb('0x19')+_0x676ee1['cutdigits']+'}':_0xeecb('0x1a'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x1b'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':'outbound','app':_0xeecb('0x4'),'appdata':_0xeecb('0xe'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x1c')+_0x676ee1['id'],'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']}];if(_0x676ee1[_0xeecb('0x1d')](_0xeecb('0x1e'))&&_0x676ee1[_0xeecb('0x1e')]!==_0xeecb('0x1f')){_0x5ce6a7[_0xeecb('0xc')]({'type':'outbound','app':_0xeecb('0x4'),'appdata':_0xeecb('0x20'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']},{'type':_0xeecb('0x10'),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x21')+_0x676ee1[_0xeecb('0x1e')]||_0xeecb('0x22'),'context':_0x676ee1[_0xeecb('0x6')],'exten':_0x676ee1[_0xeecb('0xa')],'priority':_0x2d15d5++,'VoiceExtensionId':_0x676ee1['id']});}return _0x5ce6a7;}function _0x448ace(_0x5ee4c,_0x2dfb51){var _0x109a13=[{'name':_0xeecb('0x23'),'param':0x0},{'name':_0xeecb('0x24'),'param':0x1},{'name':_0xeecb('0x25'),'param':0x2},{'name':'url','param':0x3}];var _0x307a1d={};var _0x289045=_0x2dfb51['split'](',');var _0x377bc8=[];for(var _0x28acac=0x0;_0x28acac<_0x109a13[_0xeecb('0x26')];_0x28acac++){switch(_0x109a13[_0x28acac][_0xeecb('0x27')]){case'trunk':_0x307a1d[_0xeecb('0x23')]=_0x289045[_0x109a13[_0x28acac][_0xeecb('0x28')]][_0xeecb('0x29')]('/')[0x1];_0x307a1d['phone']=_0x289045[_0x109a13[_0x28acac]['param']][_0xeecb('0x29')]('/')[0x2];_0x307a1d[_0xeecb('0x2a')]=_0x307a1d[_0xeecb('0x2b')]?_0x307a1d['phone'][_0xeecb('0x29')]('$')[0x0]:undefined;_0x307a1d[_0xeecb('0x2b')]=_0x5ee4c[_0xeecb('0x14')]?(_0x307a1d[_0xeecb('0x2a')]||'')+'${EXTEN:'+_0x5ee4c[_0xeecb('0x14')]+'}':(_0x307a1d['prefix']||'')+_0xeecb('0x16');_0x377bc8[_0x109a13[_0x28acac]['param']]=[_0xeecb('0x2c'),_0x307a1d[_0xeecb('0x23')],_0x307a1d[_0xeecb('0x2b')]][_0xeecb('0x2d')]('/');break;case _0xeecb('0x25'):_0x307a1d[_0xeecb('0x25')]=_0x289045[_0x109a13[_0x28acac][_0xeecb('0x28')]];if(_0x5ee4c['recordingFormat']!==_0xeecb('0x1f')){if(_0x307a1d[_0xeecb('0x25')]['indexOf'](_0xeecb('0x2e'))<0x0){_0x307a1d[_0xeecb('0x25')]+='U(xcally-mixmonitor-context)';}}else{_0x307a1d[_0xeecb('0x25')]=_0x307a1d[_0xeecb('0x25')]['replace'](_0xeecb('0x2e'),'');}_0x377bc8[_0x109a13[_0x28acac]['param']]=_0x307a1d['options'];break;default:_0x377bc8[_0x109a13[_0x28acac][_0xeecb('0x28')]]=_0x289045[_0x109a13[_0x28acac][_0xeecb('0x28')]];}}return _0x377bc8[_0xeecb('0x2d')](',');}function _0x23c55e(_0x3ee564,_0x57670d,_0x183104){return new Promise(function(_0x50c060,_0x19ccec){var _0x27128e=[];if(_[_0xeecb('0x2f')](_0x57670d))return _0x50c060(_0x27128e);_0x30fcbf['Interval']['findAll']({'attributes':['id',_0xeecb('0x30'),'IntervalId'],'raw':!![]})[_0xeecb('0x31')](function(_0x71aa9e){for(var _0x198f4f=0x0,_0x4710e3=0x0;_0x198f4f<_0x57670d[_0xeecb('0x26')];_0x198f4f++,_0x4710e3=0x0){var _0x38e809=_0x57670d[_0x198f4f];var _0x46ddc3=[];var _0x182795=[];delete _0x38e809['id'];if(_0x38e809['interval']!==_0xeecb('0x32')){_0x38e809[_0xeecb('0x33')]=[_0x38e809['interval']];}else{_0x38e809['intervals']=_0x38e809[_0xeecb('0x34')]?_[_0xeecb('0x35')](_[_0xeecb('0x36')](_0x71aa9e,{'IntervalId':_0x38e809[_0xeecb('0x34')]}),_0xeecb('0x30')):[];}_0x38e809[_0xeecb('0x6')]=_0x3ee564[_0xeecb('0x6')];_0x38e809['exten']=_0x3ee564[_0xeecb('0xa')];if(_0x38e809[_0xeecb('0x3')])_0x38e809[_0xeecb('0x3')]=_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')]();if(_0x3ee564['type']===_0xeecb('0x10')){if(_0x38e809[_0xeecb('0x1d')](_0xeecb('0x38'))&&_0x38e809[_0xeecb('0x38')]&&_0x38e809['tag']!=='--'){_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x39')+_0x38e809[_0xeecb('0x38')],'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')]['toLowerCase'](),'app':_0xeecb('0x3a'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x38e809[_0xeecb('0x3b')]?_0xeecb('0x3c')+_0x38e809['callerID']+')':_0xeecb('0x3d')),'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')]['length']+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}else{if(_0x38e809[_0xeecb('0x1d')](_0xeecb('0x3e'))){if([_0xeecb('0x3f'),_0xeecb('0x40')][_0xeecb('0x41')](_0x38e809[_0xeecb('0x42')][_0xeecb('0x37')]())&&_0x38e809[_0xeecb('0x43')]!=='custom'){if(_0x38e809[_0xeecb('0x3e')]){_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':_0xeecb('0x3a'),'appdata':_0xeecb('0x44'),'context':_0x3ee564['context'],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});_0x46ddc3['push']({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':_0xeecb('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809['intervals'][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}else{_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809['type']['toLowerCase'](),'app':_0xeecb('0x3a'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});_0x46ddc3[_0xeecb('0xc')]({'type':_0x38e809[_0xeecb('0x3')][_0xeecb('0x37')](),'app':'Set','appdata':_0xeecb('0x45'),'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}}}}for(var _0x375a78=0x0;_0x375a78<_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')];_0x375a78++){var _0x3048b9=_0x183104+_0x38e809[_0xeecb('0x33')]['length'];var _0x1ed184=_0x375a78===_0x38e809[_0xeecb('0x33')][_0xeecb('0x26')]-0x1?_0x183104+_0x46ddc3[_0xeecb('0x26')]+_0x182795[_0xeecb('0x26')]+0x2:_0x183104+_0x375a78+0x1;_0x46ddc3[_0xeecb('0x46')](_0x375a78,0x0,{'type':_0x3ee564[_0xeecb('0x3')],'app':'GotoIfTime','appdata':_0x38e809['intervals'][_0x375a78]+'?'+_0x3ee564['context']+_0xeecb('0x47')+_0x3048b9+':'+_0x3ee564['context']+',${EXTEN},'+_0x1ed184,'exten':_0x3ee564[_0xeecb('0xa')],'context':_0x3ee564[_0xeecb('0x6')],'priority':_0x183104+_0x375a78,'VoiceExtensionId':_0x3ee564['id']});}if(_0x38e809['appType']===_0xeecb('0x48')){_0x38e809[_0xeecb('0x49')]=_0x448ace(_0x3ee564,_0x38e809['appdata']);}if(_0x38e809[_0xeecb('0x43')]==='agi'){_0x46ddc3['push']({'type':_0x38e809[_0xeecb('0x3')]['toLowerCase'](),'app':_0xeecb('0x4'),'appdata':_0xeecb('0x4a'),'context':_0x3ee564[_0xeecb('0x6')],'exten':_0x3ee564[_0xeecb('0xa')],'priority':_0x38e809['intervals'][_0xeecb('0x26')]+_0x183104+_0x4710e3++,'VoiceExtensionId':_0x3ee564['id']});}_0x38e809['priority']=_0x46ddc3['length']?_[_0xeecb('0x4b')](_0x46ddc3)[_0xeecb('0x4c')]+0x1:_0x183104;_0x27128e=_[_0xeecb('0x4d')](_0x27128e,_0x46ddc3,[_0x38e809],_0x182795);_0x183104=_[_0xeecb('0x4b')](_0x27128e)[_0xeecb('0x4c')]+0x1;}return _0x50c060(_0x27128e);})[_0xeecb('0x4e')](function(_0x322890){_0x19ccec(_0x322890);});});}return _0x56096e[_0xeecb('0x4f')](_0xeecb('0x50'),attributes,{'tableName':_0xeecb('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1c7382){var _0x2d82f2=this[_0xeecb('0x52')]({'plain':!![]});var _0xfc9e1d=_0x2d82f2[_0xeecb('0x3')]==='outbound'?_0x5760ed(_0x2d82f2):_0x2709a3(_0x2d82f2);return _0x23c55e(_0x2d82f2,_0x1c7382,_[_0xeecb('0x4b')](_0xfc9e1d)[_0xeecb('0x4c')]+0x1)[_0xeecb('0x31')](function(_0x54ad1a){var _0x4b9f54=_['concat'](_0xfc9e1d,_0x54ad1a);_0x4b9f54[_0xeecb('0xc')]({'type':_0x2d82f2['type'],'app':_0xeecb('0x53'),'exten':_0x2d82f2[_0xeecb('0xa')],'context':_0x2d82f2[_0xeecb('0x6')],'priority':_[_0xeecb('0x4b')](_0x4b9f54)[_0xeecb('0x4c')]+0x1,'VoiceExtensionId':_0x2d82f2['id']});return _0x4b9f54;});}}});}; \ No newline at end of file +var _0x9515=['map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','answer','queue','playback','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','appType','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','NoOp','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','param','split','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','length','intervals'];(function(_0x36d902,_0x35b9ec){var _0x3dd24c=function(_0x3b8eab){while(--_0x3b8eab){_0x36d902['push'](_0x36d902['shift']());}};_0x3dd24c(++_0x35b9ec);}(_0x9515,0x109));var _0x5951=function(_0x2cefc5,_0x108d4e){_0x2cefc5=_0x2cefc5-0x0;var _0x5f39ce=_0x9515[_0x2cefc5];return _0x5f39ce;};'use strict';var _=require(_0x5951('0x0'));var attributes=require(_0x5951('0x1'));module[_0x5951('0x2')]=function(_0x39a63f){var _0x2a4bd6=_0x39a63f[_0x5951('0x3')];function _0x54800c(_0x4f6cc1){var _0x3068ba=0x2;var _0x415552=[{'type':_0x4f6cc1[_0x5951('0x4')],'app':_0x5951('0x5'),'appdata':_0x5951('0x6')+_0x4f6cc1[_0x5951('0x4')],'context':_0x4f6cc1['context'],'exten':_0x4f6cc1[_0x5951('0x7')],'priority':_0x3068ba++,'VoiceExtensionId':_0x4f6cc1['id']},{'type':_0x4f6cc1[_0x5951('0x4')],'app':_0x4f6cc1[_0x5951('0x8')]?_0x5951('0x5'):'NoOp','appdata':_0x4f6cc1[_0x5951('0x8')]?_0x5951('0x9')+_0x4f6cc1[_0x5951('0x8')]:_0x5951('0xa'),'context':_0x4f6cc1[_0x5951('0xb')],'exten':_0x4f6cc1[_0x5951('0x7')],'priority':_0x3068ba++,'VoiceExtensionId':_0x4f6cc1['id']}];if(_0x4f6cc1[_0x5951('0x4')]===_0x5951('0xc')){_0x415552['push']({'type':_0x5951('0xc'),'app':_0x5951('0x5'),'appdata':_0x5951('0xd')+_0x4f6cc1['id'],'context':_0x4f6cc1['context'],'exten':_0x4f6cc1['exten'],'priority':_0x3068ba++,'VoiceExtensionId':_0x4f6cc1['id']});}_0x415552[_0x5951('0xe')]({'type':_0x4f6cc1[_0x5951('0x4')],'app':_0x5951('0x5'),'appdata':_0x5951('0xf'),'context':_0x4f6cc1[_0x5951('0xb')],'exten':_0x4f6cc1[_0x5951('0x7')],'priority':_0x3068ba++,'VoiceExtensionId':_0x4f6cc1['id']},{'type':_0x4f6cc1['type'],'app':_0x5951('0x5'),'appdata':_0x5951('0x10'),'context':_0x4f6cc1[_0x5951('0xb')],'exten':_0x4f6cc1[_0x5951('0x7')],'priority':_0x3068ba++,'VoiceExtensionId':_0x4f6cc1['id']},{'type':_0x4f6cc1['type'],'app':_0x5951('0x5'),'appdata':_0x5951('0x11'),'context':_0x4f6cc1[_0x5951('0xb')],'exten':_0x4f6cc1['exten'],'priority':_0x3068ba++,'VoiceExtensionId':_0x4f6cc1['id']});return _0x415552;}function _0x8983ac(_0xd58728){var _0x3c00c9=0x2;var _0x36a4e1=[{'type':_0x5951('0x12'),'app':_0x5951('0x5'),'appdata':'CDR(type)=outbound','context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728['exten'],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':_0xd58728['alias']?'Set':_0x5951('0x13'),'appdata':_0xd58728[_0x5951('0x8')]?_0x5951('0x9')+_0xd58728['alias']:_0x5951('0xa'),'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728['exten'],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':_0x5951('0x5'),'appdata':'CDR(destination)='+(_0xd58728[_0x5951('0x14')]?_0x5951('0x15')+_0xd58728['cutdigits']+'}':_0x5951('0x16')),'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':'Set','appdata':_0x5951('0xd')+_0xd58728['id'],'context':_0xd58728['context'],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':_0x5951('0x17'),'appdata':_0x5951('0x18')+(_0x3c00c9+0x2)+_0x5951('0x19')+(_0x3c00c9+0x1)+')','context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':'Set','appdata':_0xd58728[_0x5951('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0xd58728[_0x5951('0x14')]+'}':_0x5951('0x1a'),'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':_0x5951('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':_0x5951('0x5'),'appdata':_0x5951('0x10'),'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728['exten'],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':_0x5951('0x5'),'appdata':_0x5951('0x11'),'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':_0x5951('0x12'),'app':_0x5951('0x5'),'appdata':_0x5951('0x1b')+_0xd58728['id'],'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728['exten'],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']}];if(_0xd58728[_0x5951('0x1c')](_0x5951('0x1d'))&&_0xd58728[_0x5951('0x1d')]!==_0x5951('0x1e')){_0x36a4e1[_0x5951('0xe')]({'type':'outbound','app':_0x5951('0x5'),'appdata':_0x5951('0x1f'),'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']},{'type':'outbound','app':_0x5951('0x5'),'appdata':_0x5951('0x20')+_0xd58728[_0x5951('0x1d')]||_0x5951('0x21'),'context':_0xd58728[_0x5951('0xb')],'exten':_0xd58728[_0x5951('0x7')],'priority':_0x3c00c9++,'VoiceExtensionId':_0xd58728['id']});}return _0x36a4e1;}function _0x4884a4(_0x9616b8,_0x5cfd3b){var _0xc05c2a=[{'name':_0x5951('0x22'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x5951('0x23'),'param':0x2},{'name':_0x5951('0x24'),'param':0x3}];var _0x3eb0d5={};var _0x59698b=_0x5cfd3b['split'](',');var _0x56abbe=[];for(var _0x1db12a=0x0;_0x1db12a<_0xc05c2a['length'];_0x1db12a++){switch(_0xc05c2a[_0x1db12a]['name']){case'trunk':_0x3eb0d5['trunk']=_0x59698b[_0xc05c2a[_0x1db12a][_0x5951('0x25')]][_0x5951('0x26')]('/')[0x1];_0x3eb0d5[_0x5951('0x27')]=_0x59698b[_0xc05c2a[_0x1db12a][_0x5951('0x25')]][_0x5951('0x26')]('/')[0x2];_0x3eb0d5[_0x5951('0x28')]=_0x3eb0d5[_0x5951('0x27')]?_0x3eb0d5[_0x5951('0x27')][_0x5951('0x26')]('$')[0x0]:undefined;_0x3eb0d5[_0x5951('0x27')]=_0x9616b8['cutdigits']?(_0x3eb0d5['prefix']||'')+_0x5951('0x15')+_0x9616b8[_0x5951('0x14')]+'}':(_0x3eb0d5['prefix']||'')+_0x5951('0x16');_0x56abbe[_0xc05c2a[_0x1db12a]['param']]=[_0x5951('0x29'),_0x3eb0d5[_0x5951('0x22')],_0x3eb0d5[_0x5951('0x27')]][_0x5951('0x2a')]('/');break;case _0x5951('0x23'):_0x3eb0d5[_0x5951('0x23')]=_0x59698b[_0xc05c2a[_0x1db12a][_0x5951('0x25')]];if(_0x9616b8[_0x5951('0x1d')]!==_0x5951('0x1e')){if(_0x3eb0d5['options']['indexOf'](_0x5951('0x2b'))<0x0){_0x3eb0d5[_0x5951('0x23')]+=_0x5951('0x2b');}}else{_0x3eb0d5[_0x5951('0x23')]=_0x3eb0d5['options'][_0x5951('0x2c')]('U(xcally-mixmonitor-context)','');}_0x56abbe[_0xc05c2a[_0x1db12a][_0x5951('0x25')]]=_0x3eb0d5['options'];break;default:_0x56abbe[_0xc05c2a[_0x1db12a][_0x5951('0x25')]]=_0x59698b[_0xc05c2a[_0x1db12a][_0x5951('0x25')]];}}return _0x56abbe[_0x5951('0x2a')](',');}function _0x5ea6cc(_0x4b93f0,_0xc9e0d5,_0x1715ff){return new Promise(function(_0x20fe67,_0x2f66f9){var _0x12a1d5=[];if(_[_0x5951('0x2d')](_0xc9e0d5))return _0x20fe67(_0x12a1d5);_0x2a4bd6['Interval'][_0x5951('0x2e')]({'attributes':['id',_0x5951('0x2f'),_0x5951('0x30')],'raw':!![]})['then'](function(_0x5c8ac9){for(var _0x2eb909=0x0,_0x24fc03=0x0;_0x2eb909<_0xc9e0d5[_0x5951('0x31')];_0x2eb909++,_0x24fc03=0x0){var _0x4741c7=_0xc9e0d5[_0x2eb909];var _0x27db13=[];var _0x182f9d=[];delete _0x4741c7['id'];if(_0x4741c7[_0x5951('0x2f')]!=='*,*,*,*'){_0x4741c7[_0x5951('0x32')]=[_0x4741c7['interval']];}else{_0x4741c7[_0x5951('0x32')]=_0x4741c7['IntervalId']?_[_0x5951('0x33')](_[_0x5951('0x34')](_0x5c8ac9,{'IntervalId':_0x4741c7['IntervalId']}),'interval'):[];}_0x4741c7[_0x5951('0xb')]=_0x4b93f0[_0x5951('0xb')];_0x4741c7[_0x5951('0x7')]=_0x4b93f0[_0x5951('0x7')];if(_0x4741c7[_0x5951('0x4')])_0x4741c7[_0x5951('0x4')]=_0x4741c7[_0x5951('0x4')][_0x5951('0x35')]();if(_0x4b93f0[_0x5951('0x4')]===_0x5951('0x12')){if(_0x4741c7[_0x5951('0x1c')]('tag')&&_0x4741c7[_0x5951('0x36')]&&_0x4741c7[_0x5951('0x36')]!=='--'){_0x27db13[_0x5951('0xe')]({'type':_0x4741c7['type']['toLowerCase'](),'app':'Set','appdata':_0x5951('0x37')+_0x4741c7['tag'],'context':_0x4b93f0['context'],'exten':_0x4b93f0[_0x5951('0x7')],'priority':_0x4741c7[_0x5951('0x32')][_0x5951('0x31')]+_0x1715ff+_0x24fc03++,'VoiceExtensionId':_0x4b93f0['id']});}_0x27db13[_0x5951('0xe')]({'type':_0x4741c7[_0x5951('0x4')][_0x5951('0x35')](),'app':_0x5951('0x17'),'appdata':_0x5951('0x38')+(_0x4741c7['callerID']?_0x5951('0x39')+_0x4741c7[_0x5951('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x4b93f0[_0x5951('0xb')],'exten':_0x4b93f0[_0x5951('0x7')],'priority':_0x4741c7[_0x5951('0x32')][_0x5951('0x31')]+_0x1715ff+_0x24fc03++,'VoiceExtensionId':_0x4b93f0['id']});}else{if(_0x4741c7[_0x5951('0x1c')](_0x5951('0x3b'))){if([_0x5951('0x3c'),_0x5951('0x3d')]['includes'](_0x4741c7['app'][_0x5951('0x35')]())&&_0x4741c7['appType']!==_0x5951('0x3e')){if(_0x4741c7[_0x5951('0x3b')]){_0x27db13[_0x5951('0xe')]({'type':_0x4741c7['type']['toLowerCase'](),'app':_0x5951('0x17'),'appdata':_0x5951('0x3f'),'context':_0x4b93f0['context'],'exten':_0x4b93f0['exten'],'priority':_0x4741c7['intervals'][_0x5951('0x31')]+_0x1715ff+_0x24fc03++,'VoiceExtensionId':_0x4b93f0['id']});_0x27db13['push']({'type':_0x4741c7[_0x5951('0x4')][_0x5951('0x35')](),'app':_0x5951('0x5'),'appdata':_0x5951('0x40'),'context':_0x4b93f0[_0x5951('0xb')],'exten':_0x4b93f0['exten'],'priority':_0x4741c7[_0x5951('0x32')][_0x5951('0x31')]+_0x1715ff+_0x24fc03++,'VoiceExtensionId':_0x4b93f0['id']});}else{_0x27db13[_0x5951('0xe')]({'type':_0x4741c7[_0x5951('0x4')]['toLowerCase'](),'app':_0x5951('0x17'),'appdata':_0x5951('0x41'),'context':_0x4b93f0[_0x5951('0xb')],'exten':_0x4b93f0[_0x5951('0x7')],'priority':_0x4741c7[_0x5951('0x32')][_0x5951('0x31')]+_0x1715ff+_0x24fc03++,'VoiceExtensionId':_0x4b93f0['id']});_0x27db13[_0x5951('0xe')]({'type':_0x4741c7[_0x5951('0x4')][_0x5951('0x35')](),'app':_0x5951('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4b93f0[_0x5951('0xb')],'exten':_0x4b93f0[_0x5951('0x7')],'priority':_0x4741c7[_0x5951('0x32')][_0x5951('0x31')]+_0x1715ff+_0x24fc03++,'VoiceExtensionId':_0x4b93f0['id']});}}}}for(var _0x3715ef=0x0;_0x3715ef<_0x4741c7[_0x5951('0x32')][_0x5951('0x31')];_0x3715ef++){var _0x1db4e9=_0x1715ff+_0x4741c7[_0x5951('0x32')][_0x5951('0x31')];var _0x85eeb6=_0x3715ef===_0x4741c7['intervals'][_0x5951('0x31')]-0x1?_0x1715ff+_0x27db13[_0x5951('0x31')]+_0x182f9d[_0x5951('0x31')]+0x2:_0x1715ff+_0x3715ef+0x1;_0x27db13[_0x5951('0x42')](_0x3715ef,0x0,{'type':_0x4b93f0[_0x5951('0x4')],'app':'GotoIfTime','appdata':_0x4741c7[_0x5951('0x32')][_0x3715ef]+'?'+_0x4b93f0['context']+',${EXTEN},'+_0x1db4e9+':'+_0x4b93f0[_0x5951('0xb')]+_0x5951('0x43')+_0x85eeb6,'exten':_0x4b93f0[_0x5951('0x7')],'context':_0x4b93f0[_0x5951('0xb')],'priority':_0x1715ff+_0x3715ef,'VoiceExtensionId':_0x4b93f0['id']});}if(_0x4741c7[_0x5951('0x44')]===_0x5951('0x45')){_0x4741c7[_0x5951('0x46')]=_0x4884a4(_0x4b93f0,_0x4741c7[_0x5951('0x46')]);}if(_0x4741c7[_0x5951('0x44')]==='agi'){_0x27db13[_0x5951('0xe')]({'type':_0x4741c7['type'][_0x5951('0x35')](),'app':_0x5951('0x5'),'appdata':_0x5951('0x47'),'context':_0x4b93f0[_0x5951('0xb')],'exten':_0x4b93f0['exten'],'priority':_0x4741c7[_0x5951('0x32')][_0x5951('0x31')]+_0x1715ff+_0x24fc03++,'VoiceExtensionId':_0x4b93f0['id']});}_0x4741c7[_0x5951('0x48')]=_0x27db13[_0x5951('0x31')]?_[_0x5951('0x49')](_0x27db13)[_0x5951('0x48')]+0x1:_0x1715ff;_0x12a1d5=_[_0x5951('0x4a')](_0x12a1d5,_0x27db13,[_0x4741c7],_0x182f9d);_0x1715ff=_['last'](_0x12a1d5)[_0x5951('0x48')]+0x1;}return _0x20fe67(_0x12a1d5);})[_0x5951('0x4b')](function(_0x45a0ee){_0x2f66f9(_0x45a0ee);});});}return _0x39a63f[_0x5951('0x4c')](_0x5951('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x18dce0){var _0x30e277=this['get']({'plain':!![]});var _0x127dc2=_0x30e277[_0x5951('0x4')]==='outbound'?_0x8983ac(_0x30e277):_0x54800c(_0x30e277);return _0x5ea6cc(_0x30e277,_0x18dce0,_[_0x5951('0x49')](_0x127dc2)[_0x5951('0x48')]+0x1)['then'](function(_0x492515){var _0xe4366c=_[_0x5951('0x4a')](_0x127dc2,_0x492515);_0xe4366c['push']({'type':_0x30e277['type'],'app':_0x5951('0x4e'),'exten':_0x30e277[_0x5951('0x7')],'context':_0x30e277[_0x5951('0xb')],'priority':_['last'](_0xe4366c)[_0x5951('0x48')]+0x1,'VoiceExtensionId':_0x30e277['id']});return _0xe4366c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c01e070..5788081 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 _0xac6a=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','map','include','model','attributes','debug','stringify','catch','lodash'];(function(_0x57de8d,_0x14289a){var _0x200558=function(_0x6c1cbe){while(--_0x6c1cbe){_0x57de8d['push'](_0x57de8d['shift']());}};_0x200558(++_0x14289a);}(_0xac6a,0xc2));var _0xaac6=function(_0x1c438c,_0x10eaf7){_0x1c438c=_0x1c438c-0x0;var _0xdb25e4=_0xac6a[_0x1c438c];return _0xdb25e4;};'use strict';var _=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var BPromise=require(_0xaac6('0x3'));var rs=require(_0xaac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac6('0x6'))(_0xaac6('0x7'));var config=require(_0xaac6('0x8'));var jayson=require(_0xaac6('0x9'));var client=jayson[_0xaac6('0xa')][_0xaac6('0xb')]({'port':0x232a});config[_0xaac6('0xc')]=_[_0xaac6('0xd')](config[_0xaac6('0xc')],{'host':_0xaac6('0xe'),'port':0x18eb});var socket=require(_0xaac6('0xf'))(new Redis(config[_0xaac6('0xc')]));require('./voiceExtension.socket')[_0xaac6('0x10')](socket);function respondWithRpcPromise(_0x160834,_0x31fa92,_0x37c3ba){return new BPromise(function(_0x19345a,_0x2b9460){return client['request'](_0x160834,_0x37c3ba)[_0xaac6('0x11')](function(_0x1605a3){logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));logger['debug'](_0xaac6('0x15'),_0x31fa92,_0xaac6('0x14'),JSON['stringify'](_0x1605a3));if(_0x1605a3['error']){if(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x17')]===0x1f4){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x2b9460(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);}logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x19345a(_0x1605a3['error']['message']);}else{logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));_0x19345a(_0x1605a3[_0xaac6('0x19')][_0xaac6('0x18')]);}})['catch'](function(_0x22d66e){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x22d66e);_0x2b9460(_0x22d66e);});});}exports[_0xaac6('0x1a')]=function(_0xab5028){var _0x1e7c3e=this;return new Promise(function(_0x450019,_0x4a6064){return db[_0xaac6('0x1b')][_0xaac6('0x1c')]({'raw':_0xab5028[_0xaac6('0x1d')]?_0xab5028[_0xaac6('0x1d')][_0xaac6('0x1e')]===undefined?!![]:![]:!![],'where':_0xab5028[_0xaac6('0x1d')]?_0xab5028[_0xaac6('0x1d')]['where']||null:null,'attributes':_0xab5028['options']?_0xab5028[_0xaac6('0x1d')]['attributes']||null:null,'limit':_0xab5028[_0xaac6('0x1d')]?_0xab5028[_0xaac6('0x1d')][_0xaac6('0x1f')]||null:null,'include':_0xab5028['options']?_0xab5028[_0xaac6('0x1d')]['include']?_[_0xaac6('0x20')](_0xab5028[_0xaac6('0x1d')][_0xaac6('0x21')],function(_0x335300){return{'model':db[_0x335300[_0xaac6('0x22')]],'as':_0x335300['as'],'attributes':_0x335300['attributes'],'include':_0x335300[_0xaac6('0x21')]?_[_0xaac6('0x20')](_0x335300['include'],function(_0x50a896){return{'model':db[_0x50a896[_0xaac6('0x22')]],'as':_0x50a896['as'],'attributes':_0x50a896['attributes'],'include':_0x50a896[_0xaac6('0x21')]?_[_0xaac6('0x20')](_0x50a896[_0xaac6('0x21')],function(_0x3b63f3){return{'model':db[_0x3b63f3[_0xaac6('0x22')]],'as':_0x3b63f3['as'],'attributes':_0x3b63f3[_0xaac6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaac6('0x11')](function(_0xb02a9b){logger[_0xaac6('0x12')]('GetVoiceExtension',_0xab5028);logger[_0xaac6('0x24')](_0xaac6('0x1a'),_0xab5028,JSON[_0xaac6('0x25')](_0xb02a9b));_0x450019(_0xb02a9b);})[_0xaac6('0x26')](function(_0xf71ad8){logger['error']('GetVoiceExtension',_0xf71ad8[_0xaac6('0x18')],_0xab5028);_0x4a6064(_0x1e7c3e[_0xaac6('0x16')](0x1f4,_0xf71ad8[_0xaac6('0x18')]));});});}; \ No newline at end of file +var _0x5655=['http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceExtension','VoiceExtension','options','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1d923d,_0x2d6c62){var _0x1d1493=function(_0x32d835){while(--_0x32d835){_0x1d923d['push'](_0x1d923d['shift']());}};_0x1d1493(++_0x2d6c62);}(_0x5655,0x15e));var _0x5565=function(_0x285120,_0x43ec7c){_0x285120=_0x285120-0x0;var _0x545006=_0x5655[_0x285120];return _0x545006;};'use strict';var _=require(_0x5565('0x0'));var util=require(_0x5565('0x1'));var moment=require(_0x5565('0x2'));var BPromise=require(_0x5565('0x3'));var rs=require(_0x5565('0x4'));var fs=require('fs');var Redis=require(_0x5565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5565('0x6'))('rpc');var config=require(_0x5565('0x7'));var jayson=require(_0x5565('0x8'));var client=jayson[_0x5565('0x9')][_0x5565('0xa')]({'port':0x232a});config[_0x5565('0xb')]=_['defaults'](config[_0x5565('0xb')],{'host':_0x5565('0xc'),'port':0x18eb});var socket=require(_0x5565('0xd'))(new Redis(config[_0x5565('0xb')]));require(_0x5565('0xe'))[_0x5565('0xf')](socket);function respondWithRpcPromise(_0x4ac5e3,_0x581dca,_0x367ce8){return new BPromise(function(_0x52db0e,_0x498370){return client[_0x5565('0x10')](_0x4ac5e3,_0x367ce8)[_0x5565('0x11')](function(_0x5d0d99){logger['info'](_0x5565('0x12'),_0x581dca,_0x5565('0x13'));logger[_0x5565('0x14')](_0x5565('0x15'),_0x581dca,_0x5565('0x13'),JSON[_0x5565('0x16')](_0x5d0d99));if(_0x5d0d99[_0x5565('0x17')]){if(_0x5d0d99[_0x5565('0x17')]['code']===0x1f4){logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x498370(_0x5d0d99['error'][_0x5565('0x18')]);}logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x52db0e(_0x5d0d99['error']['message']);}else{logger[_0x5565('0x19')](_0x5565('0x12'),_0x581dca,'request\x20sent');_0x52db0e(_0x5d0d99[_0x5565('0x1a')][_0x5565('0x18')]);}})[_0x5565('0x1b')](function(_0x5712ad){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x581dca,_0x5712ad);_0x498370(_0x5712ad);});});}exports[_0x5565('0x1c')]=function(_0x336edb){var _0x6486f3=this;return new Promise(function(_0xb6e20c,_0x183e20){return db[_0x5565('0x1d')]['findAll']({'raw':_0x336edb[_0x5565('0x1e')]?_0x336edb[_0x5565('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x336edb[_0x5565('0x1e')]?_0x336edb[_0x5565('0x1e')][_0x5565('0x1f')]||null:null,'attributes':_0x336edb['options']?_0x336edb[_0x5565('0x1e')]['attributes']||null:null,'limit':_0x336edb[_0x5565('0x1e')]?_0x336edb[_0x5565('0x1e')]['limit']||null:null,'include':_0x336edb['options']?_0x336edb[_0x5565('0x1e')][_0x5565('0x20')]?_[_0x5565('0x21')](_0x336edb['options']['include'],function(_0x28aa02){return{'model':db[_0x28aa02[_0x5565('0x22')]],'as':_0x28aa02['as'],'attributes':_0x28aa02['attributes'],'include':_0x28aa02[_0x5565('0x20')]?_[_0x5565('0x21')](_0x28aa02['include'],function(_0x2c4dee){return{'model':db[_0x2c4dee['model']],'as':_0x2c4dee['as'],'attributes':_0x2c4dee[_0x5565('0x23')],'include':_0x2c4dee[_0x5565('0x20')]?_[_0x5565('0x21')](_0x2c4dee[_0x5565('0x20')],function(_0x8d4988){return{'model':db[_0x8d4988[_0x5565('0x22')]],'as':_0x8d4988['as'],'attributes':_0x8d4988[_0x5565('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5565('0x11')](function(_0x7e9c06){logger['info'](_0x5565('0x1c'),_0x336edb);logger['debug']('GetVoiceExtension',_0x336edb,JSON[_0x5565('0x16')](_0x7e9c06));_0xb6e20c(_0x7e9c06);})['catch'](function(_0x37925a){logger[_0x5565('0x17')](_0x5565('0x1c'),_0x37925a['message'],_0x336edb);_0x183e20(_0x6486f3['error'](0x1f4,_0x37925a[_0x5565('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 5a557b3..31e2184 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x2ba500,_0x5c5f61){var _0x2efd44=function(_0x349e67){while(--_0x349e67){_0x2ba500['push'](_0x2ba500['shift']());}};_0x2efd44(++_0x5c5f61);}(_0x53ec,0x192));var _0xc53e=function(_0x441819,_0x5b8d0a){_0x441819=_0x441819-0x0;var _0x478882=_0x53ec[_0x441819];return _0x478882;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x249b3e,_0x22890f){var _0x3f3ecf=function(_0x562959){while(--_0x562959){_0x249b3e['push'](_0x249b3e['shift']());}};_0x3f3ecf(++_0x22890f);}(_0xf494,0x1c6));var _0x4f49=function(_0x5dbddc,_0x520fb7){_0x5dbddc=_0x5dbddc-0x0;var _0x15c7d1=_0xf494[_0x5dbddc];return _0x15c7d1;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6a38ca3..80adc10 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5f1b34,_0x18f8d8){var _0x128f85=function(_0x32dea0){while(--_0x32dea0){_0x5f1b34['push'](_0x5f1b34['shift']());}};_0x128f85(++_0x18f8d8);}(_0x5fab,0x177));var _0xb5fa=function(_0x5108bf,_0x1e9b2a){_0x5108bf=_0x5108bf-0x0;var _0x343c7e=_0x5fab[_0x5108bf];return _0x343c7e;};'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 _0xeda8=['show','/:id/messages','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x1dac6e,_0x469bec){var _0x371528=function(_0x34bbe3){while(--_0x34bbe3){_0x1dac6e['push'](_0x1dac6e['shift']());}};_0x371528(++_0x469bec);}(_0xeda8,0x104));var _0x8eda=function(_0x3813d8,_0x254da7){_0x3813d8=_0x3813d8-0x0;var _0x2c3c50=_0xeda8[_0x3813d8];return _0x2c3c50;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')](_0x8eda('0x11'),auth['isAuthenticated'](),controller[_0x8eda('0x12')]);router['delete'](_0x8eda('0x11'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);module[_0x8eda('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b25d0eb..b09ec11 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 _0xa91b=['TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x319b87,_0x54b470){var _0x507350=function(_0x222652){while(--_0x222652){_0x319b87['push'](_0x319b87['shift']());}};_0x507350(++_0x54b470);}(_0xa91b,0x1b6));var _0xba91=function(_0x484dae,_0x198c2a){_0x484dae=_0x484dae-0x0;var _0x16aeb7=_0xa91b[_0x484dae];return _0x16aeb7;};'use strict';var Sequelize=require(_0xba91('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xba91('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xba91('0x2'),'unique':_0xba91('0x3')},'mailbox':{'type':Sequelize[_0xba91('0x1')],'defaultValue':'','allowNull':![],'unique':_0xba91('0x3')},'password':{'type':Sequelize[_0xba91('0x1')]},'fullname':{'type':Sequelize[_0xba91('0x1')]},'email':{'type':Sequelize[_0xba91('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4d3d99){this[_0xba91('0x4')](_0xba91('0x5'),typeof _0x4d3d99===_0xba91('0x6')&&_0x4d3d99['trim']()?_0x4d3d99[_0xba91('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xba91('0x8')},'attach':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':_0xba91('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xba91('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xba91('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':_0xba91('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xba91('0x9')](_0xba91('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xba91('0x9')]('yes','no'),'defaultValue':_0xba91('0xa'),'allowNull':![]},'stamp':{'type':_0xba91('0xc')},'emailsubject':{'type':Sequelize[_0xba91('0x1')]},'emailbody':{'type':Sequelize[_0xba91('0x1')]},'maxsecs':{'type':Sequelize[_0xba91('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xba91('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xba91('0xe')](_0xba91('0xf'))+_0xba91('0x10')+this[_0xba91('0xe')](_0xba91('0x11'));}}}; \ No newline at end of file +var _0x50e9=['central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x3d3a99,_0x548366){var _0x23912a=function(_0x1af7d5){while(--_0x1af7d5){_0x3d3a99['push'](_0x3d3a99['shift']());}};_0x23912a(++_0x548366);}(_0x50e9,0x101));var _0x950e=function(_0xe260f2,_0x55fbea){_0xe260f2=_0xe260f2-0x0;var _0x442dd7=_0x50e9[_0xe260f2];return _0x442dd7;};'use strict';var Sequelize=require(_0x950e('0x0'));module[_0x950e('0x1')]={'customer_id':{'type':Sequelize[_0x950e('0x2')]},'context':{'type':Sequelize[_0x950e('0x2')],'defaultValue':_0x950e('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x950e('0x2')],'defaultValue':'','allowNull':![],'unique':_0x950e('0x4')},'password':{'type':Sequelize[_0x950e('0x2')]},'fullname':{'type':Sequelize[_0x950e('0x2')]},'email':{'type':Sequelize[_0x950e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x8cb7f9){this[_0x950e('0x5')](_0x950e('0x6'),typeof _0x8cb7f9===_0x950e('0x7')&&_0x8cb7f9[_0x950e('0x8')]()?_0x8cb7f9['trim']():null);}},'pager':{'type':Sequelize[_0x950e('0x2')]},'tz':{'type':Sequelize[_0x950e('0x2')],'defaultValue':_0x950e('0x9')},'attach':{'type':Sequelize[_0x950e('0xa')](_0x950e('0xb'),'no'),'defaultValue':_0x950e('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x950e('0xa')](_0x950e('0xb'),'no'),'defaultValue':_0x950e('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x950e('0x2')]},'callback':{'type':Sequelize[_0x950e('0x2')]},'review':{'type':Sequelize[_0x950e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x950e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x950e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x950e('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x950e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x950e('0xa')](_0x950e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x950e('0xa')](_0x950e('0xb'),'no'),'defaultValue':_0x950e('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x950e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x950e('0xa')](_0x950e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x950e('0xa')](_0x950e('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x950e('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x950e('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x950e('0xe')],'get':function(){return this[_0x950e('0xf')](_0x950e('0x10'))+_0x950e('0x11')+this[_0x950e('0xf')](_0x950e('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1d871f2..8d8063f 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 _0x757a=['../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','get','Voicemails','UserProfileResource','destroy','end','error','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','findAndCountAll','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xecd1d7,_0x42d954){var _0x404fc4=function(_0x2d3309){while(--_0x2d3309){_0xecd1d7['push'](_0xecd1d7['shift']());}};_0x404fc4(++_0x42d954);}(_0x757a,0xde));var _0xa757=function(_0x265814,_0x1055a0){_0x265814=_0x265814-0x0;var _0x39915e=_0x757a[_0x265814];return _0x39915e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){var _0x59e9d4=_0x2bf276[_0xa757('0x1f')]({'plain':!![]});var _0x47903b=_0xa757('0x20');return db[_0xa757('0x21')][_0xa757('0x22')]({'where':{'type':_0x47903b,'resourceId':_0x59e9d4['id']}})['then'](function(){return _0x2bf276;});})[_0xa757('0x1e')](function(){_0x2ca10d[_0xa757('0x15')](0xcc)[_0xa757('0x23')]();});}};}function handleEntityNotFound(_0x3bf7f3,_0x5b4779){return function(_0x449a7d){if(!_0x449a7d){_0x3bf7f3['sendStatus'](0x194);}return _0x449a7d;};}function handleError(_0x5a5664,_0x54b75e){_0x54b75e=_0x54b75e||0x1f4;return function(_0x4f8de2){logger[_0xa757('0x24')](_0x4f8de2['stack']);if(_0x4f8de2[_0xa757('0x25')]){delete _0x4f8de2[_0xa757('0x25')];}_0x5a5664['status'](_0x54b75e)[_0xa757('0x26')](_0x4f8de2);};}exports['index']=function(_0x2c4823,_0xa6d0f6){var _0x5307c3={},_0x235e54={},_0x5ade7b={'count':0x0,'rows':[]};var _0x3a4a66=_[_0xa757('0x27')](db[_0xa757('0x28')][_0xa757('0x29')],function(_0xcc87c0){return{'name':_0xcc87c0[_0xa757('0x2a')],'type':_0xcc87c0[_0xa757('0x2b')][_0xa757('0x2c')]};});_0x235e54[_0xa757('0x2d')]=_[_0xa757('0x27')](_0x3a4a66,_0xa757('0x25'));_0x235e54[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x2c4823[_0xa757('0x2e')]);_0x235e54[_0xa757('0x30')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],_0x235e54[_0xa757('0x2e')]);_0x5307c3[_0xa757('0x32')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],qs[_0xa757('0x33')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x33')]));_0x5307c3['attributes']=_0x5307c3[_0xa757('0x32')][_0xa757('0x34')]?_0x5307c3[_0xa757('0x32')]:_0x235e54[_0xa757('0x2d')];if(!_0x2c4823[_0xa757('0x2e')]['hasOwnProperty'](_0xa757('0x35'))){_0x5307c3[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x1a')]);_0x5307c3[_0xa757('0x17')]=qs['offset'](_0x2c4823[_0xa757('0x2e')][_0xa757('0x17')]);}_0x5307c3[_0xa757('0x36')]=qs[_0xa757('0x37')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x37')]);_0x5307c3[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x2c4823['query'],_0x235e54[_0xa757('0x30')]),_0x3a4a66);if(_0x2c4823[_0xa757('0x2e')][_0xa757('0x3a')]){_0x5307c3[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x5307c3[_0xa757('0x38')],{'$or':_['map'](_0x3a4a66,function(_0x10d3fd){if(_0x10d3fd[_0xa757('0x2b')]!=='VIRTUAL'){var _0x5eae0b={};_0x5eae0b[_0x10d3fd[_0xa757('0x25')]]={'$like':'%'+_0x2c4823[_0xa757('0x2e')]['filter']+'%'};return _0x5eae0b;}})});}_0x5307c3=_['merge']({},_0x5307c3,_0x2c4823[_0xa757('0x3c')]);var _0x1725a2={'where':_0x5307c3[_0xa757('0x38')]};return db['VoiceMail'][_0xa757('0x19')](_0x1725a2)[_0xa757('0x1e')](function(_0x26802c){_0x5ade7b[_0xa757('0x19')]=_0x26802c;if(_0x2c4823[_0xa757('0x2e')]['includeAll']){_0x5307c3[_0xa757('0x3d')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5307c3);})[_0xa757('0x1e')](function(_0x57298b){_0x5ade7b[_0xa757('0x3e')]=_0x57298b;return _0x5ade7b;})[_0xa757('0x1e')](respondWithFilteredResult(_0xa6d0f6,_0x5307c3))[_0xa757('0x3f')](handleError(_0xa6d0f6,null));};exports['show']=function(_0x5d25bb,_0x11e141){var _0x129d77={'raw':!![],'where':{'id':_0x5d25bb[_0xa757('0x40')]['id']}},_0x2b171c={};_0x2b171c[_0xa757('0x2d')]=_[_0xa757('0x2f')](db['VoiceMail'][_0xa757('0x29')]);_0x2b171c[_0xa757('0x2e')]=_['keys'](_0x5d25bb[_0xa757('0x2e')]);_0x2b171c['filters']=_[_0xa757('0x31')](_0x2b171c[_0xa757('0x2d')],_0x2b171c['query']);_0x129d77[_0xa757('0x32')]=_[_0xa757('0x31')](_0x2b171c['model'],qs[_0xa757('0x33')](_0x5d25bb[_0xa757('0x2e')][_0xa757('0x33')]));_0x129d77[_0xa757('0x32')]=_0x129d77['attributes'][_0xa757('0x34')]?_0x129d77[_0xa757('0x32')]:_0x2b171c[_0xa757('0x2d')];if(_0x5d25bb[_0xa757('0x2e')]['includeAll']){_0x129d77[_0xa757('0x3d')]=[{'all':!![]}];}_0x129d77=_['merge']({},_0x129d77,_0x5d25bb['options']);return db[_0xa757('0x28')][_0xa757('0x41')](_0x129d77)[_0xa757('0x1e')](handleEntityNotFound(_0x11e141,null))['then'](respondWithResult(_0x11e141,null))[_0xa757('0x3f')](handleError(_0x11e141,null));};exports['create']=function(_0x2ed63f,_0x151cc3){return db[_0xa757('0x28')][_0xa757('0x42')](_0x2ed63f[_0xa757('0x43')],{})[_0xa757('0x1e')](function(_0x57bf73){var _0x505cd=_0x2ed63f['user'][_0xa757('0x1f')]({'plain':!![]});if(!_0x505cd)throw new Error(_0xa757('0x44'));if(_0x505cd[_0xa757('0x45')]===_0xa757('0x46')){var _0x319988=_0x57bf73[_0xa757('0x1f')]({'plain':!![]});var _0x15bad7=_0xa757('0x20');return db[_0xa757('0x47')][_0xa757('0x41')]({'where':{'name':_0x15bad7,'userProfileId':_0x505cd[_0xa757('0x48')]},'raw':!![]})[_0xa757('0x1e')](function(_0x2367c7){if(_0x2367c7&&_0x2367c7[_0xa757('0x49')]===0x0){return db[_0xa757('0x21')][_0xa757('0x42')]({'name':_0x319988['name'],'resourceId':_0x319988['id'],'type':_0x2367c7[_0xa757('0x25')],'sectionId':_0x2367c7['id']},{})['then'](function(){return _0x57bf73;});}else{return _0x57bf73;}})[_0xa757('0x3f')](function(_0x311c25){logger[_0xa757('0x24')](_0xa757('0x4a'),_0x311c25);throw _0x311c25;});}return _0x57bf73;})['then'](respondWithResult(_0x151cc3,0xc9))[_0xa757('0x3f')](handleError(_0x151cc3,null));};exports[_0xa757('0x1d')]=function(_0x8614f9,_0x980e1){if(_0x8614f9['body']['id']){delete _0x8614f9[_0xa757('0x43')]['id'];}return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x8614f9[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x980e1,null))[_0xa757('0x1e')](saveUpdates(_0x8614f9['body'],null))['then'](respondWithResult(_0x980e1,null))['catch'](handleError(_0x980e1,null));};exports['destroy']=function(_0x1d8742,_0x9b3779){return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x1d8742[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x9b3779,null))['then'](removeEntity(_0x9b3779,null))[_0xa757('0x3f')](handleError(_0x9b3779,null));};exports[_0xa757('0x4b')]=function(_0x34e03f,_0x29b2f5,_0x48b578){return db[_0xa757('0x28')][_0xa757('0x4c')]({'where':{'id':_0x34e03f['params']['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x29b2f5,null))['then'](function(_0x211980){var _0x5d375c;var _0x51be6e={},_0x58633a={};_0x58633a['model']=_[_0xa757('0x2f')](db[_0xa757('0x4d')][_0xa757('0x29')]);_0x58633a[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x34e03f[_0xa757('0x2e')]);_0x58633a['filters']=_['intersection'](_0x58633a[_0xa757('0x2d')],_0x58633a[_0xa757('0x2e')]);_0x51be6e[_0xa757('0x32')]=_['intersection'](_0x58633a['model'],qs[_0xa757('0x33')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x33')]));_0x51be6e[_0xa757('0x32')]=_0x51be6e[_0xa757('0x32')][_0xa757('0x34')]?_0x51be6e['attributes']:_0x58633a[_0xa757('0x2d')];if(!_0x34e03f[_0xa757('0x2e')][_0xa757('0x4e')](_0xa757('0x35'))){_0x51be6e[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x1a')]);_0x51be6e[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x34e03f['query'][_0xa757('0x17')]);}_0x51be6e['order']=qs['sort'](_0x34e03f[_0xa757('0x2e')][_0xa757('0x37')]);_0x51be6e[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x34e03f[_0xa757('0x2e')],_0x58633a[_0xa757('0x30')]));if(_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]){_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e['where'],{'$or':_[_0xa757('0x27')](_0x51be6e[_0xa757('0x32')],function(_0x5f0b71){var _0x11ebb3={};_0x11ebb3[_0x5f0b71]={'$like':'%'+_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]+'%'};return _0x11ebb3;})});}_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e[_0xa757('0x38')],{'mailboxuser':_0x211980['mailbox']});_0x51be6e=_[_0xa757('0x3b')]({},_0x51be6e,_0x34e03f['options']);return db[_0xa757('0x4d')][_0xa757('0x4f')](_0x51be6e)[_0xa757('0x1e')](respondWithFilteredResult(_0x29b2f5,_0x51be6e));})[_0xa757('0x3f')](handleError(_0x29b2f5,null));}; \ No newline at end of file +var _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0x334201,_0x39f06f){var _0x134700=function(_0x28d73f){while(--_0x28d73f){_0x334201['push'](_0x334201['shift']());}};_0x134700(++_0x39f06f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x446fec,_0x19da2a){_0x446fec=_0x446fec-0x0;var _0x165385=_0xf4eb[_0x446fec];return _0x165385;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1219e78..1f47100 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 _0x5b09=['mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail'];(function(_0x207301,_0x235203){var _0x10be14=function(_0x203ac4){while(--_0x203ac4){_0x207301['push'](_0x207301['shift']());}};_0x10be14(++_0x235203);}(_0x5b09,0x1d3));var _0x95b0=function(_0x671422,_0x4e27c7){_0x671422=_0x671422-0x0;var _0x129938=_0x5b09[_0x671422];return _0x129938;};'use strict';var _=require(_0x95b0('0x0'));var util=require(_0x95b0('0x1'));var logger=require('../../config/logger')(_0x95b0('0x2'));var moment=require(_0x95b0('0x3'));var BPromise=require(_0x95b0('0x4'));var rp=require(_0x95b0('0x5'));var fs=require('fs');var path=require(_0x95b0('0x6'));var rimraf=require(_0x95b0('0x7'));var config=require(_0x95b0('0x8'));var attributes=require('./voiceMail.attributes');module[_0x95b0('0x9')]=function(_0x3a1a82,_0x505a06){return _0x3a1a82[_0x95b0('0xa')](_0x95b0('0xb'),attributes,{'tableName':_0x95b0('0xc'),'paranoid':![],'indexes':[{'name':_0x95b0('0xd'),'fields':[_0x95b0('0xe'),_0x95b0('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8bec=['voice_voicemail','context','lodash','../../config/logger','api','moment','path','rimraf','./voiceMail.attributes','define','VoiceMail'];(function(_0x2c3a00,_0x5df5c4){var _0x17cf44=function(_0x20ceb9){while(--_0x20ceb9){_0x2c3a00['push'](_0x2c3a00['shift']());}};_0x17cf44(++_0x5df5c4);}(_0x8bec,0x1d0));var _0xc8be=function(_0x40eced,_0x2d13a1){_0x40eced=_0x40eced-0x0;var _0x348580=_0x8bec[_0x40eced];return _0x348580;};'use strict';var _=require(_0xc8be('0x0'));var util=require('util');var logger=require(_0xc8be('0x1'))(_0xc8be('0x2'));var moment=require(_0xc8be('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8be('0x4'));var rimraf=require(_0xc8be('0x5'));var config=require('../../config/environment');var attributes=require(_0xc8be('0x6'));module['exports']=function(_0x985d5b,_0x71a243){return _0x985d5b[_0xc8be('0x7')](_0xc8be('0x8'),attributes,{'tableName':_0xc8be('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xc8be('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c5298f8..2669125 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 _0x0df7=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x179000,_0x214f27){var _0xbdf0d=function(_0x58f2ac){while(--_0x58f2ac){_0x179000['push'](_0x179000['shift']());}};_0xbdf0d(++_0x214f27);}(_0x0df7,0xec));var _0x70df=function(_0x36d9ac,_0x314606){_0x36d9ac=_0x36d9ac-0x0;var _0x281977=_0x0df7[_0x36d9ac];return _0x281977;};'use strict';var _=require(_0x70df('0x0'));var util=require(_0x70df('0x1'));var moment=require(_0x70df('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70df('0x3'));var db=require(_0x70df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70df('0x5'));var config=require('../../config/environment');var jayson=require(_0x70df('0x6'));var client=jayson['client'][_0x70df('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x285694,_0x5aab71,_0x1f1a68){return new BPromise(function(_0x47c04e,_0x13cb23){return client['request'](_0x285694,_0x1f1a68)[_0x70df('0x8')](function(_0x37709c){logger['info'](_0x70df('0x9'),_0x5aab71,_0x70df('0xa'));logger[_0x70df('0xb')](_0x70df('0xc'),_0x5aab71,_0x70df('0xa'),JSON[_0x70df('0xd')](_0x37709c));if(_0x37709c[_0x70df('0xe')]){if(_0x37709c[_0x70df('0xe')]['code']===0x1f4){logger['error'](_0x70df('0x9'),_0x5aab71,_0x37709c[_0x70df('0xe')]['message']);return _0x13cb23(_0x37709c[_0x70df('0xe')][_0x70df('0xf')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x5aab71,_0x37709c[_0x70df('0xe')][_0x70df('0xf')]);return _0x47c04e(_0x37709c[_0x70df('0xe')]['message']);}else{logger[_0x70df('0x10')](_0x70df('0x9'),_0x5aab71,_0x70df('0xa'));_0x47c04e(_0x37709c[_0x70df('0x11')][_0x70df('0xf')]);}})[_0x70df('0x12')](function(_0x415b4e){logger[_0x70df('0xe')](_0x70df('0x9'),_0x5aab71,_0x415b4e);_0x13cb23(_0x415b4e);});});} \ No newline at end of file +var _0x9120=['code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d8f05,_0x3cfe31){var _0x25254c=function(_0x4994b4){while(--_0x4994b4){_0x2d8f05['push'](_0x2d8f05['shift']());}};_0x25254c(++_0x3cfe31);}(_0x9120,0x123));var _0x0912=function(_0x38d19b,_0x2ad484){_0x38d19b=_0x38d19b-0x0;var _0x3c4c5d=_0x9120[_0x38d19b];return _0x3c4c5d;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var moment=require('moment');var BPromise=require(_0x0912('0x2'));var rs=require(_0x0912('0x3'));var fs=require('fs');var Redis=require(_0x0912('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0912('0x5'));var logger=require(_0x0912('0x6'))('rpc');var config=require(_0x0912('0x7'));var jayson=require(_0x0912('0x8'));var client=jayson[_0x0912('0x9')][_0x0912('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x119af6,_0x12e510,_0x7bb0b9){return new BPromise(function(_0xd49ab,_0x58b245){return client[_0x0912('0xb')](_0x119af6,_0x7bb0b9)[_0x0912('0xc')](function(_0x18f9c0){logger['info'](_0x0912('0xd'),_0x12e510,_0x0912('0xe'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x12e510,'request\x20sent',JSON[_0x0912('0xf')](_0x18f9c0));if(_0x18f9c0['error']){if(_0x18f9c0[_0x0912('0x10')][_0x0912('0x11')]===0x1f4){logger[_0x0912('0x10')]('VoiceMail,\x20%s,\x20%s',_0x12e510,_0x18f9c0['error'][_0x0912('0x12')]);return _0x58b245(_0x18f9c0[_0x0912('0x10')]['message']);}logger[_0x0912('0x10')](_0x0912('0xd'),_0x12e510,_0x18f9c0[_0x0912('0x10')][_0x0912('0x12')]);return _0xd49ab(_0x18f9c0[_0x0912('0x10')][_0x0912('0x12')]);}else{logger[_0x0912('0x13')](_0x0912('0xd'),_0x12e510,'request\x20sent');_0xd49ab(_0x18f9c0[_0x0912('0x14')][_0x0912('0x12')]);}})[_0x0912('0x15')](function(_0xf9c5be){logger['error'](_0x0912('0xd'),_0x12e510,_0xf9c5be);_0x58b245(_0xf9c5be);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6b071d3..3073e89 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 _0xb159=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x49f30e,_0xf28439){var _0x2cafd5=function(_0x581d4c){while(--_0x581d4c){_0x49f30e['push'](_0x49f30e['shift']());}};_0x2cafd5(++_0xf28439);}(_0xb159,0x174));var _0x9b15=function(_0x47d2f9,_0x27b6d7){_0x47d2f9=_0x47d2f9-0x0;var _0x59f02b=_0xb159[_0x47d2f9];return _0x59f02b;};'use strict';var multer=require(_0x9b15('0x0'));var util=require('util');var path=require(_0x9b15('0x1'));var timeout=require(_0x9b15('0x2'));var express=require(_0x9b15('0x3'));var router=express[_0x9b15('0x4')]();var fs_extra=require(_0x9b15('0x5'));var auth=require(_0x9b15('0x6'));var interaction=require(_0x9b15('0x7'));var config=require(_0x9b15('0x8'));var controller=require(_0x9b15('0x9'));router[_0x9b15('0xa')]('/',auth[_0x9b15('0xb')](),controller[_0x9b15('0xc')]);router[_0x9b15('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9b15('0xa')](_0x9b15('0xd'),auth[_0x9b15('0xb')](),controller['download']);router[_0x9b15('0xe')]('/',auth[_0x9b15('0xb')](),controller[_0x9b15('0xf')]);router['put'](_0x9b15('0x10'),auth[_0x9b15('0xb')](),controller[_0x9b15('0x11')]);router[_0x9b15('0x12')](_0x9b15('0x10'),auth[_0x9b15('0xb')](),controller[_0x9b15('0x13')]);module[_0x9b15('0x14')]=router; \ No newline at end of file +var _0x6285=['../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','show','/:id/download','download','post','/:id','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12a020,_0x85b476){var _0x63cddd=function(_0x13bff5){while(--_0x13bff5){_0x12a020['push'](_0x12a020['shift']());}};_0x63cddd(++_0x85b476);}(_0x6285,0x103));var _0x5628=function(_0x31abc5,_0x9b12c9){_0x31abc5=_0x31abc5-0x0;var _0xb1610c=_0x6285[_0x31abc5];return _0xb1610c;};'use strict';var multer=require(_0x5628('0x0'));var util=require('util');var path=require(_0x5628('0x1'));var timeout=require(_0x5628('0x2'));var express=require(_0x5628('0x3'));var router=express['Router']();var fs_extra=require(_0x5628('0x4'));var auth=require(_0x5628('0x5'));var interaction=require(_0x5628('0x6'));var config=require(_0x5628('0x7'));var controller=require(_0x5628('0x8'));router['get']('/',auth[_0x5628('0x9')](),controller[_0x5628('0xa')]);router[_0x5628('0xb')]('/:id',auth[_0x5628('0x9')](),controller[_0x5628('0xc')]);router['get'](_0x5628('0xd'),auth[_0x5628('0x9')](),controller[_0x5628('0xe')]);router[_0x5628('0xf')]('/',auth[_0x5628('0x9')](),controller['create']);router['put'](_0x5628('0x10'),auth[_0x5628('0x9')](),controller[_0x5628('0x11')]);router['delete'](_0x5628('0x10'),auth[_0x5628('0x9')](),controller[_0x5628('0x12')]);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 0958339..d8e6dba 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 _0xf271=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x2836ef,_0x27d12d){var _0x40b686=function(_0x482ce0){while(--_0x482ce0){_0x2836ef['push'](_0x2836ef['shift']());}};_0x40b686(++_0x27d12d);}(_0xf271,0x191));var _0x1f27=function(_0xe4989c,_0x215994){_0xe4989c=_0xe4989c-0x0;var _0x952d3=_0xf271[_0xe4989c];return _0x952d3;};'use strict';var Sequelize=require(_0x1f27('0x0'));module[_0x1f27('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f3378){return this[_0x1f27('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x1f27('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x1f27('0x5')](_0x1f27('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1f27('0x4')],'defaultValue':''},'stamp':{'type':_0x1f27('0x7'),'defaultValue':Sequelize[_0x1f27('0x8')](_0x1f27('0x9'))}}; \ No newline at end of file +var _0x706d=['BLOB','long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x4583f5,_0x48986e){var _0x16513b=function(_0x324230){while(--_0x324230){_0x4583f5['push'](_0x4583f5['shift']());}};_0x16513b(++_0x48986e);}(_0x706d,0xa3));var _0xd706=function(_0x1c063a,_0x310740){_0x1c063a=_0x1c063a-0x0;var _0x367e98=_0x706d[_0x1c063a];return _0x367e98;};'use strict';var Sequelize=require('sequelize');module[_0xd706('0x0')]={'name':{'type':Sequelize[_0xd706('0x1')],'get':function(_0x5edc06){return this[_0xd706('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xd706('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd706('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xd706('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd706('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd706('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xd706('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd706('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xd706('0x5')](_0xd706('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xd706('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0xd706('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 761632d..d08ee2e 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 _0x556a=['send','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','map','rawAttributes','type','key','model','differenceBy','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceMailMessage','include','findAll','catch','show','params','keys','includeAll','create','body','find','destroy','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition'];(function(_0x19632c,_0x4c22e2){var _0x5225ea=function(_0x27a5ab){while(--_0x27a5ab){_0x19632c['push'](_0x19632c['shift']());}};_0x5225ea(++_0x4c22e2);}(_0x556a,0x1d5));var _0xa556=function(_0x262af0,_0x41301a){_0x262af0=_0x262af0-0x0;var _0x18413e=_0x556a[_0x262af0];return _0x18413e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa556('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa556('0x1'));var rp=require(_0xa556('0x2'));var moment=require(_0xa556('0x3'));var BPromise=require(_0xa556('0x4'));var Mustache=require(_0xa556('0x5'));var util=require(_0xa556('0x6'));var path=require(_0xa556('0x7'));var sox=require(_0xa556('0x8'));var csv=require(_0xa556('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa556('0xa'));var _=require('lodash');var squel=require(_0xa556('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa556('0x9'));var querystring=require(_0xa556('0xc'));var Papa=require(_0xa556('0xd'));var Redis=require(_0xa556('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa556('0xf'));var logger=require(_0xa556('0x10'))(_0xa556('0x11'));var utils=require(_0xa556('0x12'));var config=require(_0xa556('0x13'));var licenseUtil=require(_0xa556('0x14'));var db=require(_0xa556('0x15'))['db'];function respondWithStatusCode(_0x39c75f,_0x2586de){_0x2586de=_0x2586de||0xcc;return function(_0x46b2b0){if(_0x46b2b0){return _0x39c75f[_0xa556('0x16')](_0x2586de);}return _0x39c75f[_0xa556('0x17')](_0x2586de)[_0xa556('0x18')]();};}function respondWithResult(_0x2fd92b,_0x557e58){_0x557e58=_0x557e58||0xc8;return function(_0x27c098){if(_0x27c098){return _0x2fd92b['status'](_0x557e58)[_0xa556('0x19')](_0x27c098);}};}function respondWithFilteredResult(_0x2cb0c7,_0x5431a6){return function(_0x5d8d93){if(_0x5d8d93){var _0x2a0310=typeof _0x5431a6[_0xa556('0x1a')]===_0xa556('0x1b')&&typeof _0x5431a6[_0xa556('0x1c')]===_0xa556('0x1b');var _0x590063=_0x5d8d93[_0xa556('0x1d')];var _0x819684=_0x2a0310?0x0:_0x5431a6[_0xa556('0x1a')];var _0x45aba3=_0x2a0310?_0x5d8d93[_0xa556('0x1d')]:_0x5431a6[_0xa556('0x1a')]+_0x5431a6['limit'];var _0x438094;if(_0x45aba3>=_0x590063){_0x45aba3=_0x590063;_0x438094=0xc8;}else{_0x438094=0xce;}_0x2cb0c7[_0xa556('0x17')](_0x438094);return _0x2cb0c7[_0xa556('0x1e')](_0xa556('0x1f'),_0x819684+'-'+_0x45aba3+'/'+_0x590063)['json'](_0x5d8d93);}return null;};}function patchUpdates(_0x4c039e){return function(_0x5e4271){try{jsonpatch[_0xa556('0x20')](_0x5e4271,_0x4c039e,!![]);}catch(_0x37967b){return BPromise[_0xa556('0x21')](_0x37967b);}return _0x5e4271[_0xa556('0x22')]();};}function saveUpdates(_0xdfc5b7,_0x4d77f6){return function(_0x333e35){if(_0x333e35){return _0x333e35['update'](_0xdfc5b7)['then'](function(_0x30e84b){return _0x30e84b;});}return null;};}function removeEntity(_0x1f4c65,_0x5e5e69){return function(_0x2df9ee){if(_0x2df9ee){return _0x2df9ee['destroy']()[_0xa556('0x23')](function(){_0x1f4c65['status'](0xcc)[_0xa556('0x18')]();});}};}function handleEntityNotFound(_0x445ef1,_0x9a2b23){return function(_0x3b1061){if(!_0x3b1061){_0x445ef1[_0xa556('0x16')](0x194);}return _0x3b1061;};}function handleError(_0x32ec43,_0x5d0777){_0x5d0777=_0x5d0777||0x1f4;return function(_0x8b24ee){logger['error'](_0x8b24ee['stack']);if(_0x8b24ee[_0xa556('0x24')]){delete _0x8b24ee[_0xa556('0x24')];}_0x32ec43[_0xa556('0x17')](_0x5d0777)['send'](_0x8b24ee);};}exports['index']=function(_0x40f342,_0x236779){var _0x38631b={},_0x20dbfb={},_0x1bf186={'count':0x0,'rows':[]};var _0x177002=_[_0xa556('0x25')](db['VoiceMailMessage'][_0xa556('0x26')],function(_0x35d32f){return{'name':_0x35d32f['fieldName'],'type':_0x35d32f[_0xa556('0x27')][_0xa556('0x28')]};});_0x20dbfb[_0xa556('0x29')]=_[_0xa556('0x2a')](_[_0xa556('0x25')](_0x177002,_0xa556('0x24')),[_0xa556('0x24')]);_0x20dbfb[_0xa556('0x2b')]=_['keys'](_0x40f342['query']);_0x20dbfb['filters']=_[_0xa556('0x2c')](_0x20dbfb[_0xa556('0x29')],_0x20dbfb[_0xa556('0x2b')]);_0x38631b[_0xa556('0x2d')]=_[_0xa556('0x2c')](_0x20dbfb[_0xa556('0x29')],qs[_0xa556('0x2e')](_0x40f342[_0xa556('0x2b')][_0xa556('0x2e')]));_0x38631b[_0xa556('0x2d')]=_0x38631b[_0xa556('0x2d')][_0xa556('0x2f')]?_0x38631b[_0xa556('0x2d')]:_0x20dbfb[_0xa556('0x29')];if(!_0x40f342[_0xa556('0x2b')][_0xa556('0x30')]('nolimit')){_0x38631b['limit']=qs[_0xa556('0x1c')](_0x40f342[_0xa556('0x2b')]['limit']);_0x38631b[_0xa556('0x1a')]=qs[_0xa556('0x1a')](_0x40f342[_0xa556('0x2b')][_0xa556('0x1a')]);}_0x38631b['order']=qs[_0xa556('0x31')](_0x40f342[_0xa556('0x2b')][_0xa556('0x31')]);_0x38631b[_0xa556('0x32')]=qs[_0xa556('0x33')](_[_0xa556('0x34')](_0x40f342[_0xa556('0x2b')],_0x20dbfb[_0xa556('0x33')]),_0x177002);if(_0x40f342['query'][_0xa556('0x35')]){_0x38631b[_0xa556('0x32')]=_['merge'](_0x38631b[_0xa556('0x32')],{'$or':_[_0xa556('0x25')](_0x177002,function(_0x224523){if(_0x224523[_0xa556('0x27')]!==_0xa556('0x36')){var _0x35bd75={};_0x35bd75[_0x224523[_0xa556('0x24')]]={'$like':'%'+_0x40f342['query'][_0xa556('0x35')]+'%'};return _0x35bd75;}})});}_0x38631b=_[_0xa556('0x37')]({},_0x38631b,_0x40f342[_0xa556('0x38')]);var _0x12cdec={'where':_0x38631b['where']};return db[_0xa556('0x39')][_0xa556('0x1d')](_0x12cdec)[_0xa556('0x23')](function(_0x5ec4c6){_0x1bf186[_0xa556('0x1d')]=_0x5ec4c6;if(_0x40f342['query']['includeAll']){_0x38631b[_0xa556('0x3a')]=[{'all':!![]}];}return db[_0xa556('0x39')][_0xa556('0x3b')](_0x38631b);})[_0xa556('0x23')](function(_0x21614b){_0x1bf186['rows']=_0x21614b;return _0x1bf186;})[_0xa556('0x23')](respondWithFilteredResult(_0x236779,_0x38631b))[_0xa556('0x3c')](handleError(_0x236779,null));};exports[_0xa556('0x3d')]=function(_0x4fddd0,_0x12f213){var _0x361f33={'raw':!![],'where':{'id':_0x4fddd0[_0xa556('0x3e')]['id']}},_0x463bb7={};_0x463bb7[_0xa556('0x29')]=_['keys'](db['VoiceMailMessage'][_0xa556('0x26')]);_0x463bb7[_0xa556('0x2b')]=_[_0xa556('0x3f')](_0x4fddd0['query']);_0x463bb7['filters']=_[_0xa556('0x2c')](_0x463bb7[_0xa556('0x29')],_0x463bb7[_0xa556('0x2b')]);_0x361f33[_0xa556('0x2d')]=_[_0xa556('0x2c')](_0x463bb7[_0xa556('0x29')],qs[_0xa556('0x2e')](_0x4fddd0[_0xa556('0x2b')][_0xa556('0x2e')]));_0x361f33['attributes']=_0x361f33[_0xa556('0x2d')][_0xa556('0x2f')]?_0x361f33[_0xa556('0x2d')]:_0x463bb7['model'];if(_0x4fddd0[_0xa556('0x2b')][_0xa556('0x40')]){_0x361f33[_0xa556('0x3a')]=[{'all':!![]}];}_0x361f33=_[_0xa556('0x37')]({},_0x361f33,_0x4fddd0[_0xa556('0x38')]);return db[_0xa556('0x39')]['find'](_0x361f33)[_0xa556('0x23')](handleEntityNotFound(_0x12f213,null))[_0xa556('0x23')](respondWithResult(_0x12f213,null))[_0xa556('0x3c')](handleError(_0x12f213,null));};exports[_0xa556('0x41')]=function(_0x2b2e6c,_0x54e366){return db[_0xa556('0x39')][_0xa556('0x41')](_0x2b2e6c[_0xa556('0x42')],{})[_0xa556('0x23')](respondWithResult(_0x54e366,0xc9))[_0xa556('0x3c')](handleError(_0x54e366,null));};exports['update']=function(_0xebe223,_0x29a72d){if(_0xebe223['body']['id']){delete _0xebe223[_0xa556('0x42')]['id'];}return db['VoiceMailMessage'][_0xa556('0x43')]({'where':{'id':_0xebe223[_0xa556('0x3e')]['id']}})[_0xa556('0x23')](handleEntityNotFound(_0x29a72d,null))[_0xa556('0x23')](saveUpdates(_0xebe223[_0xa556('0x42')],null))[_0xa556('0x23')](respondWithResult(_0x29a72d,null))[_0xa556('0x3c')](handleError(_0x29a72d,null));};exports[_0xa556('0x44')]=function(_0x2b1592,_0x4d222d){return db[_0xa556('0x39')][_0xa556('0x43')]({'where':{'id':_0x2b1592[_0xa556('0x3e')]['id']}})[_0xa556('0x23')](handleEntityNotFound(_0x4d222d,null))[_0xa556('0x23')](removeEntity(_0x4d222d,null))[_0xa556('0x3c')](handleError(_0x4d222d,null));};exports[_0xa556('0x45')]=function(_0x11b343,_0x1f1e90,_0x1651a3){return db[_0xa556('0x39')]['find']({'where':{'id':_0x11b343['params']['id']},'attributes':['id',_0xa556('0x46'),'msg_id']})['then'](handleEntityNotFound(_0x1f1e90,null))[_0xa556('0x23')](function(_0x24995a){if(_0x24995a){if(!_0x24995a['recording']){throw new db[(_0xa556('0x47'))]['ValidationError'](_0xa556('0x48'));}var _0x384428={'Content-Type':_0xa556('0x49'),'Content-Disposition':_0xa556('0x4a')};if(_0x24995a[_0xa556('0x4b')]){_0x384428[_0xa556('0x4c')]='attachment;\x20filename=\x22'+_0x24995a[_0xa556('0x4b')]+'.wav\x22';}_0x1f1e90[_0xa556('0x1e')](_0x384428);return _0x1f1e90[_0xa556('0x4d')](new Buffer(_0x24995a[_0xa556('0x46')]));}})[_0xa556('0x3c')](handleError(_0x1f1e90,null));}; \ No newline at end of file +var _0xb227=['send','VoiceMailMessage','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','create','update','body','find','destroy','download','msg_id','recording','Sequelize','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../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','apply','reject','save','then','error','name'];(function(_0x39d289,_0x4de0fc){var _0x115f57=function(_0x4bc7ff){while(--_0x4bc7ff){_0x39d289['push'](_0x39d289['shift']());}};_0x115f57(++_0x4de0fc);}(_0xb227,0xd5));var _0x7b22=function(_0x1c9083,_0x2c0633){_0x1c9083=_0x1c9083-0x0;var _0x383cf6=_0xb227[_0x1c9083];return _0x383cf6;};'use strict';var emlformat=require(_0x7b22('0x0'));var rimraf=require(_0x7b22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7b22('0x2'));var moment=require(_0x7b22('0x3'));var BPromise=require(_0x7b22('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7b22('0x5'));var csv=require('to-csv');var ejs=require(_0x7b22('0x6'));var fs=require('fs');var fs_extra=require(_0x7b22('0x7'));var _=require(_0x7b22('0x8'));var squel=require(_0x7b22('0x9'));var crypto=require(_0x7b22('0xa'));var jsforce=require(_0x7b22('0xb'));var deskjs=require(_0x7b22('0xc'));var toCsv=require(_0x7b22('0xd'));var querystring=require(_0x7b22('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b22('0xf'));var as=require(_0x7b22('0x10'));var hardwareService=require(_0x7b22('0x11'));var logger=require(_0x7b22('0x12'))(_0x7b22('0x13'));var utils=require(_0x7b22('0x14'));var config=require(_0x7b22('0x15'));var licenseUtil=require(_0x7b22('0x16'));var db=require(_0x7b22('0x17'))['db'];function respondWithStatusCode(_0x547fd7,_0x1b5acb){_0x1b5acb=_0x1b5acb||0xcc;return function(_0x384aef){if(_0x384aef){return _0x547fd7[_0x7b22('0x18')](_0x1b5acb);}return _0x547fd7[_0x7b22('0x19')](_0x1b5acb)[_0x7b22('0x1a')]();};}function respondWithResult(_0x4c57b7,_0x1a77b6){_0x1a77b6=_0x1a77b6||0xc8;return function(_0x3030ba){if(_0x3030ba){return _0x4c57b7['status'](_0x1a77b6)[_0x7b22('0x1b')](_0x3030ba);}};}function respondWithFilteredResult(_0x12a0ca,_0x4691c4){return function(_0x500667){if(_0x500667){var _0x268e6e=typeof _0x4691c4[_0x7b22('0x1c')]==='undefined'&&typeof _0x4691c4[_0x7b22('0x1d')]===_0x7b22('0x1e');var _0x5a1fe7=_0x500667['count'];var _0x26cfe1=_0x268e6e?0x0:_0x4691c4['offset'];var _0x2a5b77=_0x268e6e?_0x500667[_0x7b22('0x1f')]:_0x4691c4[_0x7b22('0x1c')]+_0x4691c4[_0x7b22('0x1d')];var _0x2082c4;if(_0x2a5b77>=_0x5a1fe7){_0x2a5b77=_0x5a1fe7;_0x2082c4=0xc8;}else{_0x2082c4=0xce;}_0x12a0ca[_0x7b22('0x19')](_0x2082c4);return _0x12a0ca[_0x7b22('0x20')]('Content-Range',_0x26cfe1+'-'+_0x2a5b77+'/'+_0x5a1fe7)[_0x7b22('0x1b')](_0x500667);}return null;};}function patchUpdates(_0x5d9897){return function(_0x8d9994){try{jsonpatch[_0x7b22('0x21')](_0x8d9994,_0x5d9897,!![]);}catch(_0x35c6a1){return BPromise[_0x7b22('0x22')](_0x35c6a1);}return _0x8d9994[_0x7b22('0x23')]();};}function saveUpdates(_0x5e6e4c,_0x1fb0e9){return function(_0x241566){if(_0x241566){return _0x241566['update'](_0x5e6e4c)['then'](function(_0x2c16a6){return _0x2c16a6;});}return null;};}function removeEntity(_0x1cd3c0,_0x563971){return function(_0xef83fe){if(_0xef83fe){return _0xef83fe['destroy']()[_0x7b22('0x24')](function(){_0x1cd3c0[_0x7b22('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95a7d5,_0x4d4754){return function(_0x46039e){if(!_0x46039e){_0x95a7d5['sendStatus'](0x194);}return _0x46039e;};}function handleError(_0x2c3add,_0x18ccc9){_0x18ccc9=_0x18ccc9||0x1f4;return function(_0x206c6f){logger[_0x7b22('0x25')](_0x206c6f['stack']);if(_0x206c6f['name']){delete _0x206c6f[_0x7b22('0x26')];}_0x2c3add['status'](_0x18ccc9)[_0x7b22('0x27')](_0x206c6f);};}exports['index']=function(_0x20c100,_0x14bfe7){var _0x22f512={},_0x542089={},_0x38bb42={'count':0x0,'rows':[]};var _0x1198ad=_['map'](db[_0x7b22('0x28')][_0x7b22('0x29')],function(_0x293007){return{'name':_0x293007[_0x7b22('0x2a')],'type':_0x293007[_0x7b22('0x2b')][_0x7b22('0x2c')]};});_0x542089['model']=_['differenceBy'](_[_0x7b22('0x2d')](_0x1198ad,_0x7b22('0x26')),[_0x7b22('0x26')]);_0x542089[_0x7b22('0x2e')]=_[_0x7b22('0x2f')](_0x20c100[_0x7b22('0x2e')]);_0x542089['filters']=_[_0x7b22('0x30')](_0x542089[_0x7b22('0x31')],_0x542089[_0x7b22('0x2e')]);_0x22f512[_0x7b22('0x32')]=_[_0x7b22('0x30')](_0x542089[_0x7b22('0x31')],qs[_0x7b22('0x33')](_0x20c100[_0x7b22('0x2e')][_0x7b22('0x33')]));_0x22f512['attributes']=_0x22f512['attributes'][_0x7b22('0x34')]?_0x22f512[_0x7b22('0x32')]:_0x542089[_0x7b22('0x31')];if(!_0x20c100[_0x7b22('0x2e')][_0x7b22('0x35')](_0x7b22('0x36'))){_0x22f512[_0x7b22('0x1d')]=qs[_0x7b22('0x1d')](_0x20c100[_0x7b22('0x2e')][_0x7b22('0x1d')]);_0x22f512[_0x7b22('0x1c')]=qs[_0x7b22('0x1c')](_0x20c100[_0x7b22('0x2e')][_0x7b22('0x1c')]);}_0x22f512[_0x7b22('0x37')]=qs['sort'](_0x20c100[_0x7b22('0x2e')][_0x7b22('0x38')]);_0x22f512[_0x7b22('0x39')]=qs[_0x7b22('0x3a')](_[_0x7b22('0x3b')](_0x20c100[_0x7b22('0x2e')],_0x542089[_0x7b22('0x3a')]),_0x1198ad);if(_0x20c100[_0x7b22('0x2e')]['filter']){_0x22f512[_0x7b22('0x39')]=_[_0x7b22('0x3c')](_0x22f512[_0x7b22('0x39')],{'$or':_[_0x7b22('0x2d')](_0x1198ad,function(_0x456b40){if(_0x456b40[_0x7b22('0x2b')]!==_0x7b22('0x3d')){var _0x3dedc0={};_0x3dedc0[_0x456b40[_0x7b22('0x26')]]={'$like':'%'+_0x20c100[_0x7b22('0x2e')][_0x7b22('0x3e')]+'%'};return _0x3dedc0;}})});}_0x22f512=_[_0x7b22('0x3c')]({},_0x22f512,_0x20c100['options']);var _0x4030d8={'where':_0x22f512[_0x7b22('0x39')]};return db[_0x7b22('0x28')][_0x7b22('0x1f')](_0x4030d8)[_0x7b22('0x24')](function(_0x3a4dad){_0x38bb42['count']=_0x3a4dad;if(_0x20c100[_0x7b22('0x2e')]['includeAll']){_0x22f512[_0x7b22('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x7b22('0x40')](_0x22f512);})[_0x7b22('0x24')](function(_0x2638da){_0x38bb42[_0x7b22('0x41')]=_0x2638da;return _0x38bb42;})['then'](respondWithFilteredResult(_0x14bfe7,_0x22f512))[_0x7b22('0x42')](handleError(_0x14bfe7,null));};exports[_0x7b22('0x43')]=function(_0x464c72,_0x4ddba8){var _0x210934={'raw':!![],'where':{'id':_0x464c72[_0x7b22('0x44')]['id']}},_0x1e45b0={};_0x1e45b0['model']=_[_0x7b22('0x2f')](db['VoiceMailMessage']['rawAttributes']);_0x1e45b0[_0x7b22('0x2e')]=_[_0x7b22('0x2f')](_0x464c72[_0x7b22('0x2e')]);_0x1e45b0[_0x7b22('0x3a')]=_[_0x7b22('0x30')](_0x1e45b0[_0x7b22('0x31')],_0x1e45b0[_0x7b22('0x2e')]);_0x210934[_0x7b22('0x32')]=_[_0x7b22('0x30')](_0x1e45b0[_0x7b22('0x31')],qs[_0x7b22('0x33')](_0x464c72[_0x7b22('0x2e')][_0x7b22('0x33')]));_0x210934[_0x7b22('0x32')]=_0x210934[_0x7b22('0x32')][_0x7b22('0x34')]?_0x210934[_0x7b22('0x32')]:_0x1e45b0[_0x7b22('0x31')];if(_0x464c72[_0x7b22('0x2e')][_0x7b22('0x45')]){_0x210934[_0x7b22('0x3f')]=[{'all':!![]}];}_0x210934=_[_0x7b22('0x3c')]({},_0x210934,_0x464c72[_0x7b22('0x46')]);return db[_0x7b22('0x28')]['find'](_0x210934)[_0x7b22('0x24')](handleEntityNotFound(_0x4ddba8,null))[_0x7b22('0x24')](respondWithResult(_0x4ddba8,null))[_0x7b22('0x42')](handleError(_0x4ddba8,null));};exports[_0x7b22('0x47')]=function(_0x4d2651,_0x16790a){return db['VoiceMailMessage'][_0x7b22('0x47')](_0x4d2651['body'],{})[_0x7b22('0x24')](respondWithResult(_0x16790a,0xc9))[_0x7b22('0x42')](handleError(_0x16790a,null));};exports[_0x7b22('0x48')]=function(_0x2d376b,_0x434d45){if(_0x2d376b[_0x7b22('0x49')]['id']){delete _0x2d376b[_0x7b22('0x49')]['id'];}return db[_0x7b22('0x28')][_0x7b22('0x4a')]({'where':{'id':_0x2d376b[_0x7b22('0x44')]['id']}})[_0x7b22('0x24')](handleEntityNotFound(_0x434d45,null))[_0x7b22('0x24')](saveUpdates(_0x2d376b[_0x7b22('0x49')],null))['then'](respondWithResult(_0x434d45,null))[_0x7b22('0x42')](handleError(_0x434d45,null));};exports[_0x7b22('0x4b')]=function(_0x2a58ca,_0x324122){return db[_0x7b22('0x28')][_0x7b22('0x4a')]({'where':{'id':_0x2a58ca['params']['id']}})[_0x7b22('0x24')](handleEntityNotFound(_0x324122,null))[_0x7b22('0x24')](removeEntity(_0x324122,null))['catch'](handleError(_0x324122,null));};exports[_0x7b22('0x4c')]=function(_0x35627d,_0x4cc37c,_0x544adf){return db['VoiceMailMessage']['find']({'where':{'id':_0x35627d['params']['id']},'attributes':['id','recording',_0x7b22('0x4d')]})[_0x7b22('0x24')](handleEntityNotFound(_0x4cc37c,null))[_0x7b22('0x24')](function(_0x7662d2){if(_0x7662d2){if(!_0x7662d2[_0x7b22('0x4e')]){throw new db[(_0x7b22('0x4f'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x294a26={'Content-Type':_0x7b22('0x50'),'Content-Disposition':'attachment'};if(_0x7662d2['msg_id']){_0x294a26[_0x7b22('0x51')]=_0x7b22('0x52')+_0x7662d2[_0x7b22('0x4d')]+_0x7b22('0x53');}_0x4cc37c['set'](_0x294a26);return _0x4cc37c[_0x7b22('0x27')](new Buffer(_0x7662d2[_0x7b22('0x4e')]));}})['catch'](handleError(_0x4cc37c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4a1acd7..425fee9 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 _0x8444=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8444,0x185));var _0x4844=function(_0x275b85,_0x1a3f17){_0x275b85=_0x275b85-0x0;var _0x428ce5=_0x8444[_0x275b85];return _0x428ce5;};'use strict';var _=require(_0x4844('0x0'));var util=require(_0x4844('0x1'));var logger=require(_0x4844('0x2'))(_0x4844('0x3'));var moment=require(_0x4844('0x4'));var BPromise=require(_0x4844('0x5'));var rp=require(_0x4844('0x6'));var fs=require('fs');var path=require(_0x4844('0x7'));var rimraf=require(_0x4844('0x8'));var config=require('../../config/environment');var attributes=require(_0x4844('0x9'));module[_0x4844('0xa')]=function(_0x48e2fa,_0x4ab1be){return _0x48e2fa['define']('VoiceMailMessage',attributes,{'tableName':_0x4844('0xb'),'paranoid':![],'indexes':[{'name':_0x4844('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x25f1=['./voiceMailMessage.attributes','exports','define','dir','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x23d625,_0x4c83dc){var _0x37235d=function(_0x4382d2){while(--_0x4382d2){_0x23d625['push'](_0x23d625['shift']());}};_0x37235d(++_0x4c83dc);}(_0x25f1,0x138));var _0x125f=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x25f1[_0x56e0e8];return _0x2dab50;};'use strict';var _=require(_0x125f('0x0'));var util=require(_0x125f('0x1'));var logger=require('../../config/logger')(_0x125f('0x2'));var moment=require(_0x125f('0x3'));var BPromise=require(_0x125f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x125f('0x5'));var rimraf=require(_0x125f('0x6'));var config=require('../../config/environment');var attributes=require(_0x125f('0x7'));module[_0x125f('0x8')]=function(_0x2c47a4,_0x149b51){return _0x2c47a4[_0x125f('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x125f('0xa'),'fields':[_0x125f('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a82e5c0..94ec89f 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 _0x16ae=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x16ae,0x1e6));var _0xe16a=function(_0x3d47f2,_0x180ece){_0x3d47f2=_0x3d47f2-0x0;var _0x481a6e=_0x16ae[_0x3d47f2];return _0x481a6e;};'use strict';var _=require(_0xe16a('0x0'));var util=require(_0xe16a('0x1'));var moment=require(_0xe16a('0x2'));var BPromise=require(_0xe16a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe16a('0x4'));var db=require(_0xe16a('0x5'))['db'];var utils=require(_0xe16a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe16a('0x7'));var client=jayson[_0xe16a('0x8')][_0xe16a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33da64,_0x1ad78e,_0x2e3dd1){return new BPromise(function(_0x24e580,_0x320c0e){return client[_0xe16a('0xa')](_0x33da64,_0x2e3dd1)[_0xe16a('0xb')](function(_0x4c5691){logger[_0xe16a('0xc')](_0xe16a('0xd'),_0x1ad78e,'request\x20sent');logger[_0xe16a('0xe')](_0xe16a('0xf'),_0x1ad78e,_0xe16a('0x10'),JSON['stringify'](_0x4c5691));if(_0x4c5691['error']){if(_0x4c5691[_0xe16a('0x11')][_0xe16a('0x12')]===0x1f4){logger[_0xe16a('0x11')](_0xe16a('0xd'),_0x1ad78e,_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);return _0x320c0e(_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);}logger[_0xe16a('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x1ad78e,_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);return _0x24e580(_0x4c5691[_0xe16a('0x11')][_0xe16a('0x13')]);}else{logger['info'](_0xe16a('0xd'),_0x1ad78e,_0xe16a('0x10'));_0x24e580(_0x4c5691[_0xe16a('0x14')]['message']);}})[_0xe16a('0x15')](function(_0x2a2bf7){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1ad78e,_0x2a2bf7);_0x320c0e(_0x2a2bf7);});});} \ No newline at end of file +var _0xc239=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4e8f33,_0x3650c7){var _0x501af1=function(_0x490a3a){while(--_0x490a3a){_0x4e8f33['push'](_0x4e8f33['shift']());}};_0x501af1(++_0x3650c7);}(_0xc239,0x93));var _0x9c23=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc239[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x9c23('0x0'));var util=require(_0x9c23('0x1'));var moment=require('moment');var BPromise=require(_0x9c23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c23('0x3'));var db=require(_0x9c23('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c23('0x5'))(_0x9c23('0x6'));var config=require(_0x9c23('0x7'));var jayson=require(_0x9c23('0x8'));var client=jayson[_0x9c23('0x9')][_0x9c23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9177e1,_0x227c8f,_0x404542){return new BPromise(function(_0x4566b4,_0x1df282){return client['request'](_0x9177e1,_0x404542)['then'](function(_0x24eee7){logger[_0x9c23('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x227c8f,_0x9c23('0xc'));logger[_0x9c23('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x227c8f,_0x9c23('0xc'),JSON[_0x9c23('0xe')](_0x24eee7));if(_0x24eee7[_0x9c23('0xf')]){if(_0x24eee7[_0x9c23('0xf')][_0x9c23('0x10')]===0x1f4){logger[_0x9c23('0xf')](_0x9c23('0x11'),_0x227c8f,_0x24eee7[_0x9c23('0xf')][_0x9c23('0x12')]);return _0x1df282(_0x24eee7['error'][_0x9c23('0x12')]);}logger[_0x9c23('0xf')](_0x9c23('0x11'),_0x227c8f,_0x24eee7[_0x9c23('0xf')][_0x9c23('0x12')]);return _0x4566b4(_0x24eee7[_0x9c23('0xf')][_0x9c23('0x12')]);}else{logger[_0x9c23('0xb')](_0x9c23('0x11'),_0x227c8f,_0x9c23('0xc'));_0x4566b4(_0x24eee7['result']['message']);}})['catch'](function(_0x4f7dd2){logger[_0x9c23('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x227c8f,_0x4f7dd2);_0x1df282(_0x4f7dd2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b30064b..70c0417 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 _0xae90=['post','create','/:id/sounds','addSound','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','isAuthenticated','getSounds'];(function(_0x43df6f,_0x5f5dd8){var _0x31b6b9=function(_0x5ec359){while(--_0x5ec359){_0x43df6f['push'](_0x43df6f['shift']());}};_0x31b6b9(++_0x5f5dd8);}(_0xae90,0x1c1));var _0x0ae9=function(_0x16660e,_0x3bee28){_0x16660e=_0x16660e-0x0;var _0x6978b8=_0xae90[_0x16660e];return _0x6978b8;};'use strict';var multer=require(_0x0ae9('0x0'));var util=require(_0x0ae9('0x1'));var path=require(_0x0ae9('0x2'));var timeout=require(_0x0ae9('0x3'));var express=require(_0x0ae9('0x4'));var router=express['Router']();var fs_extra=require(_0x0ae9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae9('0x6'));var config=require(_0x0ae9('0x7'));var controller=require(_0x0ae9('0x8'));router[_0x0ae9('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ae9('0xa')]);router[_0x0ae9('0x9')]('/:id',auth[_0x0ae9('0xb')](),controller['show']);router['get']('/:id/sounds',auth['isAuthenticated'](),controller[_0x0ae9('0xc')]);router[_0x0ae9('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ae9('0xe')]);router['post'](_0x0ae9('0xf'),auth[_0x0ae9('0xb')](),controller[_0x0ae9('0x10')]);router['put'](_0x0ae9('0x11'),auth[_0x0ae9('0xb')](),controller[_0x0ae9('0x12')]);router[_0x0ae9('0x13')]('/:id',auth[_0x0ae9('0xb')](),controller[_0x0ae9('0x14')]);router['delete']('/:id/sounds/:id2',auth[_0x0ae9('0xb')](),controller['removeSound']);module[_0x0ae9('0x15')]=router; \ No newline at end of file +var _0xbdf8=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','create','addSound','put','destroy','removeSound','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2fb8c7,_0x2db97a){var _0x235ce6=function(_0x2a2d8f){while(--_0x2a2d8f){_0x2fb8c7['push'](_0x2fb8c7['shift']());}};_0x235ce6(++_0x2db97a);}(_0xbdf8,0x1c2));var _0x8bdf=function(_0x4bddba,_0xf1dcdd){_0x4bddba=_0x4bddba-0x0;var _0x26eb93=_0xbdf8[_0x4bddba];return _0x26eb93;};'use strict';var multer=require('multer');var util=require(_0x8bdf('0x0'));var path=require(_0x8bdf('0x1'));var timeout=require(_0x8bdf('0x2'));var express=require(_0x8bdf('0x3'));var router=express['Router']();var fs_extra=require(_0x8bdf('0x4'));var auth=require(_0x8bdf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8bdf('0x6'));router[_0x8bdf('0x7')]('/',auth[_0x8bdf('0x8')](),controller[_0x8bdf('0x9')]);router['get'](_0x8bdf('0xa'),auth[_0x8bdf('0x8')](),controller['show']);router[_0x8bdf('0x7')](_0x8bdf('0xb'),auth[_0x8bdf('0x8')](),controller[_0x8bdf('0xc')]);router['post']('/',auth[_0x8bdf('0x8')](),controller[_0x8bdf('0xd')]);router['post'](_0x8bdf('0xb'),auth[_0x8bdf('0x8')](),controller[_0x8bdf('0xe')]);router[_0x8bdf('0xf')](_0x8bdf('0xa'),auth[_0x8bdf('0x8')](),controller['update']);router['delete'](_0x8bdf('0xa'),auth[_0x8bdf('0x8')](),controller[_0x8bdf('0x10')]);router['delete']('/:id/sounds/:id2',auth[_0x8bdf('0x8')](),controller[_0x8bdf('0x11')]);module[_0x8bdf('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c9b0763..c481735 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 _0x1f06=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name'];(function(_0x93d3a7,_0x204287){var _0x45656a=function(_0x1c4667){while(--_0x1c4667){_0x93d3a7['push'](_0x93d3a7['shift']());}};_0x45656a(++_0x204287);}(_0x1f06,0xe3));var _0x61f0=function(_0x54c935,_0x1dee96){_0x54c935=_0x54c935-0x0;var _0x17963c=_0x1f06[_0x54c935];return _0x17963c;};'use strict';var Sequelize=require(_0x61f0('0x0'));module[_0x61f0('0x1')]={'name':{'type':Sequelize[_0x61f0('0x2')],'allowNull':![],'unique':_0x61f0('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x61f0('0x4'),_0x61f0('0x5'),_0x61f0('0x6'),_0x61f0('0x7'),_0x61f0('0x8')),'allowNull':!![],'defaultValue':_0x61f0('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![],'defaultValue':_0x61f0('0x9')},'format':{'type':Sequelize[_0x61f0('0x2')],'allowNull':!![]},'stamp':{'type':_0x61f0('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xda7c=['custom','files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','sequelize','exports','ENUM'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xda7c,0x171));var _0xcda7=function(_0x5d2c9a,_0x1d96df){_0x5d2c9a=_0x5d2c9a-0x0;var _0x3d42fd=_0xda7c[_0x5d2c9a];return _0x3d42fd;};'use strict';var Sequelize=require(_0xcda7('0x0'));module[_0xcda7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xcda7('0x2')](_0xcda7('0x3'),_0xcda7('0x4'),_0xcda7('0x5'),_0xcda7('0x6'),_0xcda7('0x7'),_0xcda7('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xcda7('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0xcda7('0x9')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xcda7('0x9')],'allowNull':!![],'defaultValue':_0xcda7('0xa')},'format':{'type':Sequelize[_0xcda7('0x9')],'allowNull':!![]},'stamp':{'type':_0xcda7('0xb')},'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 97015b0..576cad5 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 _0xc3c5=['format','%s.%s','basename','extname','converted_format','message','removeSound','id2','findOne','unlinkSync','getSounds','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','VoiceMusicOnHold','rows','catch','keys','body','find','params','create','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','transaction','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','save_name','createdAt','server/files/sounds/converted'];(function(_0x1b943f,_0x6f6e83){var _0x8b7549=function(_0x5b52d3){while(--_0x5b52d3){_0x1b943f['push'](_0x1b943f['shift']());}};_0x8b7549(++_0x6f6e83);}(_0xc3c5,0x1dc));var _0x5c3c=function(_0xb2b11e,_0x9c66dd){_0xb2b11e=_0xb2b11e-0x0;var _0x4ffc76=_0xc3c5[_0xb2b11e];return _0x4ffc76;};'use strict';var emlformat=require(_0x5c3c('0x0'));var rimraf=require(_0x5c3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c3c('0x2'));var rp=require(_0x5c3c('0x3'));var moment=require(_0x5c3c('0x4'));var BPromise=require(_0x5c3c('0x5'));var Mustache=require(_0x5c3c('0x6'));var util=require(_0x5c3c('0x7'));var path=require(_0x5c3c('0x8'));var sox=require(_0x5c3c('0x9'));var csv=require('to-csv');var ejs=require(_0x5c3c('0xa'));var fs=require('fs');var fs_extra=require(_0x5c3c('0xb'));var _=require(_0x5c3c('0xc'));var squel=require(_0x5c3c('0xd'));var crypto=require(_0x5c3c('0xe'));var jsforce=require(_0x5c3c('0xf'));var deskjs=require(_0x5c3c('0x10'));var toCsv=require(_0x5c3c('0x11'));var querystring=require(_0x5c3c('0x12'));var Papa=require(_0x5c3c('0x13'));var Redis=require(_0x5c3c('0x14'));var authService=require(_0x5c3c('0x15'));var qs=require(_0x5c3c('0x16'));var as=require(_0x5c3c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c3c('0x18'));var utils=require(_0x5c3c('0x19'));var config=require(_0x5c3c('0x1a'));var licenseUtil=require(_0x5c3c('0x1b'));var db=require(_0x5c3c('0x1c'))['db'];function respondWithStatusCode(_0x4a360f,_0x3616d6){_0x3616d6=_0x3616d6||0xcc;return function(_0x3fbc30){if(_0x3fbc30){return _0x4a360f[_0x5c3c('0x1d')](_0x3616d6);}return _0x4a360f[_0x5c3c('0x1e')](_0x3616d6)[_0x5c3c('0x1f')]();};}function respondWithResult(_0x2cec6d,_0x7f46cd){_0x7f46cd=_0x7f46cd||0xc8;return function(_0x38bc38){if(_0x38bc38){return _0x2cec6d[_0x5c3c('0x1e')](_0x7f46cd)[_0x5c3c('0x20')](_0x38bc38);}};}function respondWithFilteredResult(_0x2a5132,_0x24eab1){return function(_0x1aff11){if(_0x1aff11){var _0x47f42a=typeof _0x24eab1['offset']===_0x5c3c('0x21')&&typeof _0x24eab1[_0x5c3c('0x22')]==='undefined';var _0x2fe2f5=_0x1aff11[_0x5c3c('0x23')];var _0x124e5d=_0x47f42a?0x0:_0x24eab1[_0x5c3c('0x24')];var _0x304004=_0x47f42a?_0x1aff11[_0x5c3c('0x23')]:_0x24eab1[_0x5c3c('0x24')]+_0x24eab1[_0x5c3c('0x22')];var _0x52fa73;if(_0x304004>=_0x2fe2f5){_0x304004=_0x2fe2f5;_0x52fa73=0xc8;}else{_0x52fa73=0xce;}_0x2a5132[_0x5c3c('0x1e')](_0x52fa73);return _0x2a5132[_0x5c3c('0x25')]('Content-Range',_0x124e5d+'-'+_0x304004+'/'+_0x2fe2f5)[_0x5c3c('0x20')](_0x1aff11);}return null;};}function patchUpdates(_0x47d786){return function(_0x65c249){try{jsonpatch[_0x5c3c('0x26')](_0x65c249,_0x47d786,!![]);}catch(_0x4f7cdf){return BPromise[_0x5c3c('0x27')](_0x4f7cdf);}return _0x65c249['save']();};}function saveUpdates(_0x5ea51a,_0x380f49){return function(_0x69de){if(_0x69de){return _0x69de[_0x5c3c('0x28')](_0x5ea51a)['then'](function(_0x4a7f9d){return _0x4a7f9d;});}return null;};}function removeEntity(_0x3d5c3a,_0x1636bc){return function(_0x3233b3){if(_0x3233b3){return _0x3233b3['destroy']()[_0x5c3c('0x29')](function(){var _0x72b610=_0x3233b3[_0x5c3c('0x2a')]({'plain':!![]});var _0x5d9dce=_0x5c3c('0x2b');return db[_0x5c3c('0x2c')][_0x5c3c('0x2d')]({'where':{'type':_0x5d9dce,'resourceId':_0x72b610['id']}})[_0x5c3c('0x29')](function(){return _0x3233b3;});})[_0x5c3c('0x29')](function(){_0x3d5c3a[_0x5c3c('0x1e')](0xcc)[_0x5c3c('0x1f')]();});}};}function handleEntityNotFound(_0x583426,_0x491e0b){return function(_0x11e007){if(!_0x11e007){_0x583426[_0x5c3c('0x1d')](0x194);}return _0x11e007;};}function handleError(_0x1cfefc,_0x5bc528){_0x5bc528=_0x5bc528||0x1f4;return function(_0x3e8517){logger[_0x5c3c('0x2e')](_0x3e8517[_0x5c3c('0x2f')]);if(_0x3e8517[_0x5c3c('0x30')]){delete _0x3e8517[_0x5c3c('0x30')];}_0x1cfefc[_0x5c3c('0x1e')](_0x5bc528)[_0x5c3c('0x31')](_0x3e8517);};}exports[_0x5c3c('0x32')]=function(_0x15d16a,_0x35c97c){var _0x50adbc={},_0x5d465e={},_0xc87509={'count':0x0,'rows':[]};var _0x1b01fa=_[_0x5c3c('0x33')](db['VoiceMusicOnHold'][_0x5c3c('0x34')],function(_0x5730d3){return{'name':_0x5730d3[_0x5c3c('0x35')],'type':_0x5730d3[_0x5c3c('0x36')]['key']};});_0x5d465e[_0x5c3c('0x37')]=_[_0x5c3c('0x33')](_0x1b01fa,_0x5c3c('0x30'));_0x5d465e[_0x5c3c('0x38')]=_['keys'](_0x15d16a[_0x5c3c('0x38')]);_0x5d465e['filters']=_[_0x5c3c('0x39')](_0x5d465e['model'],_0x5d465e[_0x5c3c('0x38')]);_0x50adbc[_0x5c3c('0x3a')]=_[_0x5c3c('0x39')](_0x5d465e['model'],qs[_0x5c3c('0x3b')](_0x15d16a[_0x5c3c('0x38')]['fields']));_0x50adbc['attributes']=_0x50adbc[_0x5c3c('0x3a')][_0x5c3c('0x3c')]?_0x50adbc[_0x5c3c('0x3a')]:_0x5d465e['model'];if(!_0x15d16a['query'][_0x5c3c('0x3d')](_0x5c3c('0x3e'))){_0x50adbc[_0x5c3c('0x22')]=qs['limit'](_0x15d16a[_0x5c3c('0x38')]['limit']);_0x50adbc[_0x5c3c('0x24')]=qs[_0x5c3c('0x24')](_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x24')]);}_0x50adbc[_0x5c3c('0x3f')]=qs['sort'](_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x40')]);delete _0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x40')];_0x50adbc[_0x5c3c('0x41')]=qs[_0x5c3c('0x42')](_['pick'](_0x15d16a[_0x5c3c('0x38')],_0x5d465e['filters']),_0x1b01fa);if(_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x43')]){_0x50adbc['where']=_[_0x5c3c('0x44')](_0x50adbc[_0x5c3c('0x41')],{'$or':_['map'](_0x1b01fa,function(_0x3a8e9c){if(_0x3a8e9c[_0x5c3c('0x36')]!=='VIRTUAL'){var _0x1e9154={};_0x1e9154[_0x3a8e9c['name']]={'$like':'%'+_0x15d16a[_0x5c3c('0x38')][_0x5c3c('0x43')]+'%'};return _0x1e9154;}})});}_0x50adbc=_[_0x5c3c('0x44')]({},_0x50adbc,_0x15d16a[_0x5c3c('0x45')]);var _0x547842={'where':_0x50adbc['where']};return db['VoiceMusicOnHold']['count'](_0x547842)[_0x5c3c('0x29')](function(_0x3a798c){_0xc87509['count']=_0x3a798c;if(_0x15d16a[_0x5c3c('0x38')]['includeAll']){_0x50adbc[_0x5c3c('0x46')]=[{'all':!![]}];}return db[_0x5c3c('0x47')]['findAll'](_0x50adbc);})[_0x5c3c('0x29')](function(_0x37b4f2){_0xc87509[_0x5c3c('0x48')]=_0x37b4f2;return _0xc87509;})[_0x5c3c('0x29')](respondWithFilteredResult(_0x35c97c,_0x50adbc))[_0x5c3c('0x49')](handleError(_0x35c97c,null));};exports['show']=function(_0x4c4eb0,_0x53c41d){var _0x224837={'raw':![],'where':{'id':_0x4c4eb0['params']['id']}},_0x36d106={};_0x36d106[_0x5c3c('0x37')]=_[_0x5c3c('0x4a')](db[_0x5c3c('0x47')][_0x5c3c('0x34')]);_0x36d106[_0x5c3c('0x38')]=_['keys'](_0x4c4eb0[_0x5c3c('0x38')]);_0x36d106[_0x5c3c('0x42')]=_['intersection'](_0x36d106[_0x5c3c('0x37')],_0x36d106[_0x5c3c('0x38')]);_0x224837[_0x5c3c('0x3a')]=_['intersection'](_0x36d106[_0x5c3c('0x37')],qs[_0x5c3c('0x3b')](_0x4c4eb0[_0x5c3c('0x38')][_0x5c3c('0x3b')]));_0x224837[_0x5c3c('0x3a')]=_0x224837[_0x5c3c('0x3a')][_0x5c3c('0x3c')]?_0x224837[_0x5c3c('0x3a')]:_0x36d106[_0x5c3c('0x37')];if(_0x4c4eb0['query']['includeAll']){_0x224837[_0x5c3c('0x46')]=[{'all':!![]}];}_0x224837=_[_0x5c3c('0x44')]({},_0x224837,_0x4c4eb0[_0x5c3c('0x45')]);return db[_0x5c3c('0x47')]['find'](_0x224837)[_0x5c3c('0x29')](handleEntityNotFound(_0x53c41d,null))[_0x5c3c('0x29')](respondWithResult(_0x53c41d,null))[_0x5c3c('0x49')](handleError(_0x53c41d,null));};exports[_0x5c3c('0x28')]=function(_0x824684,_0x168a3b){if(_0x824684[_0x5c3c('0x4b')]['id']){delete _0x824684[_0x5c3c('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x5c3c('0x4c')]({'where':{'id':_0x824684[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](handleEntityNotFound(_0x168a3b,null))[_0x5c3c('0x29')](saveUpdates(_0x824684['body'],null))[_0x5c3c('0x29')](respondWithResult(_0x168a3b,null))[_0x5c3c('0x49')](handleError(_0x168a3b,null));};exports[_0x5c3c('0x4e')]=function(_0xd8de25,_0x272a24,_0x1a2d27){return db['sequelize']['transaction'](function(_0x247160){if(_0xd8de25[_0x5c3c('0x4b')][_0x5c3c('0x4f')]===_0x5c3c('0x50')){_0xd8de25[_0x5c3c('0x4b')][_0x5c3c('0x51')]=path[_0x5c3c('0x52')](config[_0x5c3c('0x53')],_0x5c3c('0x54'),_0xd8de25[_0x5c3c('0x4b')][_0x5c3c('0x30')]);}return db[_0x5c3c('0x47')][_0x5c3c('0x4e')](_0xd8de25['body'],{'transaction':_0x247160})[_0x5c3c('0x29')](function(_0x19b4fd){if(_0xd8de25[_0x5c3c('0x4b')]['mode']===_0x5c3c('0x50')){fs[_0x5c3c('0x55')](_0x19b4fd[_0x5c3c('0x51')],parseInt(_0x5c3c('0x56'),0x8));}var _0x21459a=_0xd8de25['user'][_0x5c3c('0x2a')]({'plain':!![]});if(!_0x21459a)throw new Error(_0x5c3c('0x57'));if(_0x21459a[_0x5c3c('0x58')]==='user'){var _0x3ecc86=_0x19b4fd['get']({'plain':!![]});return db[_0x5c3c('0x59')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x21459a[_0x5c3c('0x5a')]},'raw':!![]})[_0x5c3c('0x29')](function(_0x4f5289){if(_0x4f5289&&_0x4f5289[_0x5c3c('0x5b')]===0x0){return db[_0x5c3c('0x2c')]['create']({'name':_0x3ecc86[_0x5c3c('0x30')],'resourceId':_0x3ecc86['id'],'type':_0x4f5289[_0x5c3c('0x30')],'sectionId':_0x4f5289['id']},{})['then'](function(){return _0x19b4fd;});}else{return _0x19b4fd;}})[_0x5c3c('0x49')](function(_0x3d9348){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d9348);});}return _0x19b4fd;});})[_0x5c3c('0x29')](respondWithResult(_0x272a24,0xc9))['catch'](handleError(_0x272a24,null));};exports[_0x5c3c('0x2d')]=function(_0x525458,_0x5740d1,_0x1fb57c){var _0x4c32db;return db[_0x5c3c('0x47')]['find']({'where':{'id':_0x525458[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](function(_0x1804bf){if(_0x1804bf){return db[_0x5c3c('0x5c')][_0x5c3c('0x5d')](function(_0x20fb74){return _0x1804bf[_0x5c3c('0x2d')]({'transaction':_0x20fb74,'raw':!![]})['then'](function(_0x1ab9e1){if(_0x1ab9e1[_0x5c3c('0x51')]){fs[_0x5c3c('0x5e')](_0x1ab9e1[_0x5c3c('0x51')])[_0x5c3c('0x5f')](function(_0x25089d){fs['unlinkSync'](path[_0x5c3c('0x52')](_0x1ab9e1['directory'],_0x25089d));});fs[_0x5c3c('0x60')](_0x1ab9e1[_0x5c3c('0x51')]);}return _0x1ab9e1;});})[_0x5c3c('0x49')](function(_0x5f5848){throw new db[(_0x5c3c('0x61'))][(_0x5c3c('0x62'))](_0x5f5848['message']);});}})['then'](handleEntityNotFound(_0x5740d1,null))['then'](removeEntity(_0x5740d1,null))[_0x5c3c('0x49')](handleError(_0x5740d1,null));};exports[_0x5c3c('0x63')]=function(_0x4d1126,_0x74a84a,_0x52f21e){return db['sequelize']['transaction'](function(_0x1b5545){var _0x3a1b0f;return db['VoiceMusicOnHold'][_0x5c3c('0x4c')]({'where':{'id':_0x4d1126[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](function(_0xa76329){if(_0xa76329){_0x3a1b0f=_0xa76329;return _0xa76329[_0x5c3c('0x63')](_0x4d1126['body']['id'],{'transaction':_0x1b5545});}})['then'](function(_0x49134a){if(_0x49134a){return db[_0x5c3c('0x64')]['findOne']({'where':{'id':_0x4d1126[_0x5c3c('0x4b')]['id']},'attributes':['id',_0x5c3c('0x30'),_0x5c3c('0x65'),'converted_format',_0x5c3c('0x66')],'raw':!![]});}})[_0x5c3c('0x29')](function(_0xb04b20){if(_0xb04b20){var _0x5d8ffe=path[_0x5c3c('0x52')](config[_0x5c3c('0x53')],_0x5c3c('0x67'),util[_0x5c3c('0x68')](_0x5c3c('0x69'),path[_0x5c3c('0x6a')](_0xb04b20[_0x5c3c('0x65')],path[_0x5c3c('0x6b')](_0xb04b20[_0x5c3c('0x65')])),_0xb04b20['converted_format']));var _0x205e45=path[_0x5c3c('0x52')](config[_0x5c3c('0x53')],'server/files/moh',_0x3a1b0f[_0x5c3c('0x30')],util[_0x5c3c('0x68')]('%s.%s',_0xb04b20['name'],_0xb04b20[_0x5c3c('0x6c')]));fs['symlinkSync'](_0x5d8ffe,_0x205e45);return _0xb04b20;}})['catch'](function(_0xaccfa){throw new db[(_0x5c3c('0x61'))][(_0x5c3c('0x62'))](_0xaccfa[_0x5c3c('0x6d')]);});})[_0x5c3c('0x29')](handleEntityNotFound(_0x74a84a,null))[_0x5c3c('0x29')](respondWithResult(_0x74a84a,0xc9))[_0x5c3c('0x49')](handleError(_0x74a84a,null));};exports[_0x5c3c('0x6e')]=function(_0x179fc1,_0x234f26,_0x43479d){return db['sequelize'][_0x5c3c('0x5d')](function(_0x2bcf3a){var _0x153233;return db[_0x5c3c('0x47')]['findOne']({'where':{'id':_0x179fc1[_0x5c3c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x234f26,null))['then'](function(_0x41d5be){if(_0x41d5be){_0x153233=_0x41d5be;return _0x41d5be[_0x5c3c('0x6e')](_0x179fc1[_0x5c3c('0x4d')][_0x5c3c('0x6f')]);}})[_0x5c3c('0x29')](function(_0x1ca8b7){if(_0x1ca8b7){return db[_0x5c3c('0x64')][_0x5c3c('0x70')]({'where':{'id':_0x179fc1['params'][_0x5c3c('0x6f')]},'attributes':['id',_0x5c3c('0x30'),'save_name',_0x5c3c('0x6c'),_0x5c3c('0x66')],'raw':!![]});}})[_0x5c3c('0x29')](function(_0x16baee){if(_0x16baee){fs[_0x5c3c('0x71')](path[_0x5c3c('0x52')](_0x153233['directory'],util['format'](_0x5c3c('0x69'),_0x16baee[_0x5c3c('0x30')],_0x16baee[_0x5c3c('0x6c')])));return _0x16baee;}})[_0x5c3c('0x49')](function(_0x11637d){throw new db[(_0x5c3c('0x61'))][(_0x5c3c('0x62'))](_0x11637d['message']);});})[_0x5c3c('0x29')](handleEntityNotFound(_0x234f26,null))[_0x5c3c('0x29')](respondWithStatusCode(_0x234f26,0xcc))[_0x5c3c('0x49')](handleError(_0x234f26,null));};exports[_0x5c3c('0x72')]=function(_0x432011,_0x112dad,_0x4619ce){var _0xcf025c={};var _0xa6a38c={};var _0x1e483;var _0x14246b;return db[_0x5c3c('0x47')][_0x5c3c('0x70')]({'where':{'id':_0x432011[_0x5c3c('0x4d')]['id']}})[_0x5c3c('0x29')](handleEntityNotFound(_0x112dad,null))[_0x5c3c('0x29')](function(_0x2073d3){if(_0x2073d3){_0x1e483=_0x2073d3;_0xa6a38c[_0x5c3c('0x37')]=_[_0x5c3c('0x4a')](db['Sound'][_0x5c3c('0x34')]);_0xa6a38c[_0x5c3c('0x38')]=_[_0x5c3c('0x4a')](_0x432011[_0x5c3c('0x38')]);_0xa6a38c['filters']=_[_0x5c3c('0x39')](_0xa6a38c[_0x5c3c('0x37')],_0xa6a38c[_0x5c3c('0x38')]);_0xcf025c['attributes']=_[_0x5c3c('0x39')](_0xa6a38c[_0x5c3c('0x37')],qs[_0x5c3c('0x3b')](_0x432011['query'][_0x5c3c('0x3b')]));_0xcf025c['attributes']=_0xcf025c[_0x5c3c('0x3a')][_0x5c3c('0x3c')]?_0xcf025c[_0x5c3c('0x3a')]:_0xa6a38c['model'];_0xcf025c[_0x5c3c('0x3f')]=qs[_0x5c3c('0x40')](_0x432011['query'][_0x5c3c('0x40')]);_0xcf025c['where']=qs[_0x5c3c('0x42')](_[_0x5c3c('0x73')](_0x432011[_0x5c3c('0x38')],_0xa6a38c[_0x5c3c('0x42')]));if(_0x432011['query']['filter']){_0xcf025c[_0x5c3c('0x41')]=_[_0x5c3c('0x44')](_0xcf025c['where'],{'$or':_[_0x5c3c('0x33')](_0xcf025c[_0x5c3c('0x3a')],function(_0x6f6b15){var _0x4eb195={};_0x4eb195[_0x6f6b15]={'$like':'%'+_0x432011['query']['filter']+'%'};return _0x4eb195;})});}_0xcf025c=_[_0x5c3c('0x44')]({},_0xcf025c,_0x432011[_0x5c3c('0x45')]);return _0x1e483[_0x5c3c('0x72')](_0xcf025c);}})['then'](function(_0x3ea287){if(_0x3ea287){_0x14246b=_0x3ea287['length'];if(!_0x432011['query'][_0x5c3c('0x3d')](_0x5c3c('0x3e'))){_0xcf025c[_0x5c3c('0x22')]=qs[_0x5c3c('0x22')](_0x432011[_0x5c3c('0x38')][_0x5c3c('0x22')]);_0xcf025c[_0x5c3c('0x24')]=qs['offset'](_0x432011[_0x5c3c('0x38')][_0x5c3c('0x24')]);}return _0x1e483[_0x5c3c('0x72')](_0xcf025c);}})[_0x5c3c('0x29')](function(_0x3a97ac){if(_0x3a97ac){return _0x3a97ac?{'count':_0x14246b,'rows':_0x3a97ac}:null;}})['then'](respondWithResult(_0x112dad,null))[_0x5c3c('0x49')](handleError(_0x112dad,null));}; \ No newline at end of file +var _0x976b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','update','destroy','then','get','UserProfileResource','end','error','stack','index','map','VoiceMusicOnHold','fieldName','type','model','name','query','keys','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','fields','find','body','params','create','sequelize','transaction','mode','files','directory','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','removeSound','findOne','id2','getSounds','length'];(function(_0x5e3965,_0x38c052){var _0x36248c=function(_0x353787){while(--_0x353787){_0x5e3965['push'](_0x5e3965['shift']());}};_0x36248c(++_0x38c052);}(_0x976b,0x1c8));var _0xb976=function(_0x34d24f,_0x2470fd){_0x34d24f=_0x34d24f-0x0;var _0x884323=_0x976b[_0x34d24f];return _0x884323;};'use strict';var emlformat=require(_0xb976('0x0'));var rimraf=require(_0xb976('0x1'));var zipdir=require(_0xb976('0x2'));var jsonpatch=require(_0xb976('0x3'));var rp=require(_0xb976('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb976('0x5'));var util=require(_0xb976('0x6'));var path=require(_0xb976('0x7'));var sox=require(_0xb976('0x8'));var csv=require('to-csv');var ejs=require(_0xb976('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb976('0xa'));var squel=require(_0xb976('0xb'));var crypto=require(_0xb976('0xc'));var jsforce=require(_0xb976('0xd'));var deskjs=require(_0xb976('0xe'));var toCsv=require(_0xb976('0xf'));var querystring=require('querystring');var Papa=require(_0xb976('0x10'));var Redis=require(_0xb976('0x11'));var authService=require(_0xb976('0x12'));var qs=require(_0xb976('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb976('0x14'));var logger=require(_0xb976('0x15'))(_0xb976('0x16'));var utils=require(_0xb976('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb976('0x18'));var db=require(_0xb976('0x19'))['db'];function respondWithStatusCode(_0x5bf331,_0x27cede){_0x27cede=_0x27cede||0xcc;return function(_0x2dc920){if(_0x2dc920){return _0x5bf331[_0xb976('0x1a')](_0x27cede);}return _0x5bf331[_0xb976('0x1b')](_0x27cede)['end']();};}function respondWithResult(_0x1e7a27,_0x403789){_0x403789=_0x403789||0xc8;return function(_0x31734a){if(_0x31734a){return _0x1e7a27[_0xb976('0x1b')](_0x403789)[_0xb976('0x1c')](_0x31734a);}};}function respondWithFilteredResult(_0x6c81de,_0x323dd0){return function(_0x4dea25){if(_0x4dea25){var _0x561299=typeof _0x323dd0[_0xb976('0x1d')]==='undefined'&&typeof _0x323dd0[_0xb976('0x1e')]==='undefined';var _0xd1be6b=_0x4dea25[_0xb976('0x1f')];var _0x1e5352=_0x561299?0x0:_0x323dd0[_0xb976('0x1d')];var _0x56cf7a=_0x561299?_0x4dea25[_0xb976('0x1f')]:_0x323dd0['offset']+_0x323dd0[_0xb976('0x1e')];var _0x3dcc40;if(_0x56cf7a>=_0xd1be6b){_0x56cf7a=_0xd1be6b;_0x3dcc40=0xc8;}else{_0x3dcc40=0xce;}_0x6c81de[_0xb976('0x1b')](_0x3dcc40);return _0x6c81de['set'](_0xb976('0x20'),_0x1e5352+'-'+_0x56cf7a+'/'+_0xd1be6b)[_0xb976('0x1c')](_0x4dea25);}return null;};}function patchUpdates(_0x2a19b3){return function(_0x167a5f){try{jsonpatch[_0xb976('0x21')](_0x167a5f,_0x2a19b3,!![]);}catch(_0x32330f){return BPromise['reject'](_0x32330f);}return _0x167a5f['save']();};}function saveUpdates(_0x5f2811,_0x58fdae){return function(_0x5a2ed6){if(_0x5a2ed6){return _0x5a2ed6[_0xb976('0x22')](_0x5f2811)['then'](function(_0x56a311){return _0x56a311;});}return null;};}function removeEntity(_0x395b4b,_0x11f9e7){return function(_0xab3546){if(_0xab3546){return _0xab3546[_0xb976('0x23')]()[_0xb976('0x24')](function(){var _0x366c03=_0xab3546[_0xb976('0x25')]({'plain':!![]});var _0x308f8b='MusicOnHolds';return db[_0xb976('0x26')][_0xb976('0x23')]({'where':{'type':_0x308f8b,'resourceId':_0x366c03['id']}})[_0xb976('0x24')](function(){return _0xab3546;});})[_0xb976('0x24')](function(){_0x395b4b[_0xb976('0x1b')](0xcc)[_0xb976('0x27')]();});}};}function handleEntityNotFound(_0x3d1389,_0x551194){return function(_0x34eb0f){if(!_0x34eb0f){_0x3d1389[_0xb976('0x1a')](0x194);}return _0x34eb0f;};}function handleError(_0x1e0f59,_0x5c349f){_0x5c349f=_0x5c349f||0x1f4;return function(_0x1dd890){logger[_0xb976('0x28')](_0x1dd890[_0xb976('0x29')]);if(_0x1dd890['name']){delete _0x1dd890['name'];}_0x1e0f59['status'](_0x5c349f)['send'](_0x1dd890);};}exports[_0xb976('0x2a')]=function(_0xb4c697,_0x449a42){var _0x225d28={},_0x3174af={},_0x2d1ff4={'count':0x0,'rows':[]};var _0x40dbc4=_[_0xb976('0x2b')](db[_0xb976('0x2c')]['rawAttributes'],function(_0x4a7462){return{'name':_0x4a7462[_0xb976('0x2d')],'type':_0x4a7462[_0xb976('0x2e')]['key']};});_0x3174af[_0xb976('0x2f')]=_['map'](_0x40dbc4,_0xb976('0x30'));_0x3174af[_0xb976('0x31')]=_[_0xb976('0x32')](_0xb4c697[_0xb976('0x31')]);_0x3174af['filters']=_['intersection'](_0x3174af[_0xb976('0x2f')],_0x3174af[_0xb976('0x31')]);_0x225d28[_0xb976('0x33')]=_[_0xb976('0x34')](_0x3174af[_0xb976('0x2f')],qs['fields'](_0xb4c697['query']['fields']));_0x225d28['attributes']=_0x225d28[_0xb976('0x33')]['length']?_0x225d28['attributes']:_0x3174af[_0xb976('0x2f')];if(!_0xb4c697['query'][_0xb976('0x35')](_0xb976('0x36'))){_0x225d28[_0xb976('0x1e')]=qs[_0xb976('0x1e')](_0xb4c697[_0xb976('0x31')][_0xb976('0x1e')]);_0x225d28[_0xb976('0x1d')]=qs[_0xb976('0x1d')](_0xb4c697['query']['offset']);}_0x225d28[_0xb976('0x37')]=qs[_0xb976('0x38')](_0xb4c697[_0xb976('0x31')]['sort']);delete _0xb4c697[_0xb976('0x31')]['sort'];_0x225d28[_0xb976('0x39')]=qs[_0xb976('0x3a')](_[_0xb976('0x3b')](_0xb4c697[_0xb976('0x31')],_0x3174af['filters']),_0x40dbc4);if(_0xb4c697[_0xb976('0x31')][_0xb976('0x3c')]){_0x225d28[_0xb976('0x39')]=_[_0xb976('0x3d')](_0x225d28[_0xb976('0x39')],{'$or':_['map'](_0x40dbc4,function(_0x2c0037){if(_0x2c0037[_0xb976('0x2e')]!==_0xb976('0x3e')){var _0x303081={};_0x303081[_0x2c0037[_0xb976('0x30')]]={'$like':'%'+_0xb4c697[_0xb976('0x31')][_0xb976('0x3c')]+'%'};return _0x303081;}})});}_0x225d28=_['merge']({},_0x225d28,_0xb4c697[_0xb976('0x3f')]);var _0x3033a5={'where':_0x225d28[_0xb976('0x39')]};return db['VoiceMusicOnHold'][_0xb976('0x1f')](_0x3033a5)[_0xb976('0x24')](function(_0x4976ec){_0x2d1ff4[_0xb976('0x1f')]=_0x4976ec;if(_0xb4c697[_0xb976('0x31')]['includeAll']){_0x225d28[_0xb976('0x40')]=[{'all':!![]}];}return db[_0xb976('0x2c')][_0xb976('0x41')](_0x225d28);})[_0xb976('0x24')](function(_0x4708a9){_0x2d1ff4[_0xb976('0x42')]=_0x4708a9;return _0x2d1ff4;})[_0xb976('0x24')](respondWithFilteredResult(_0x449a42,_0x225d28))[_0xb976('0x43')](handleError(_0x449a42,null));};exports[_0xb976('0x44')]=function(_0x3035d6,_0xd28907){var _0x2cbc5c={'raw':![],'where':{'id':_0x3035d6['params']['id']}},_0x732b21={};_0x732b21[_0xb976('0x2f')]=_[_0xb976('0x32')](db[_0xb976('0x2c')][_0xb976('0x45')]);_0x732b21[_0xb976('0x31')]=_['keys'](_0x3035d6[_0xb976('0x31')]);_0x732b21[_0xb976('0x3a')]=_['intersection'](_0x732b21[_0xb976('0x2f')],_0x732b21[_0xb976('0x31')]);_0x2cbc5c[_0xb976('0x33')]=_['intersection'](_0x732b21[_0xb976('0x2f')],qs[_0xb976('0x46')](_0x3035d6['query'][_0xb976('0x46')]));_0x2cbc5c[_0xb976('0x33')]=_0x2cbc5c['attributes']['length']?_0x2cbc5c[_0xb976('0x33')]:_0x732b21[_0xb976('0x2f')];if(_0x3035d6[_0xb976('0x31')]['includeAll']){_0x2cbc5c[_0xb976('0x40')]=[{'all':!![]}];}_0x2cbc5c=_[_0xb976('0x3d')]({},_0x2cbc5c,_0x3035d6[_0xb976('0x3f')]);return db[_0xb976('0x2c')][_0xb976('0x47')](_0x2cbc5c)[_0xb976('0x24')](handleEntityNotFound(_0xd28907,null))[_0xb976('0x24')](respondWithResult(_0xd28907,null))[_0xb976('0x43')](handleError(_0xd28907,null));};exports[_0xb976('0x22')]=function(_0x4b8a5d,_0x1b8ece){if(_0x4b8a5d[_0xb976('0x48')]['id']){delete _0x4b8a5d[_0xb976('0x48')]['id'];}return db[_0xb976('0x2c')][_0xb976('0x47')]({'where':{'id':_0x4b8a5d[_0xb976('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b8ece,null))['then'](saveUpdates(_0x4b8a5d[_0xb976('0x48')],null))['then'](respondWithResult(_0x1b8ece,null))['catch'](handleError(_0x1b8ece,null));};exports[_0xb976('0x4a')]=function(_0x20e20a,_0xbd5eb0,_0x2e3896){return db[_0xb976('0x4b')][_0xb976('0x4c')](function(_0x2ed8fc){if(_0x20e20a[_0xb976('0x48')][_0xb976('0x4d')]===_0xb976('0x4e')){_0x20e20a[_0xb976('0x48')][_0xb976('0x4f')]=path['join'](config['root'],_0xb976('0x50'),_0x20e20a['body'][_0xb976('0x30')]);}return db[_0xb976('0x2c')]['create'](_0x20e20a[_0xb976('0x48')],{'transaction':_0x2ed8fc})['then'](function(_0x591222){if(_0x20e20a[_0xb976('0x48')][_0xb976('0x4d')]===_0xb976('0x4e')){fs[_0xb976('0x51')](_0x591222[_0xb976('0x4f')],parseInt(_0xb976('0x52'),0x8));}var _0x5e83f4=_0x20e20a['user'][_0xb976('0x25')]({'plain':!![]});if(!_0x5e83f4)throw new Error(_0xb976('0x53'));if(_0x5e83f4[_0xb976('0x54')]===_0xb976('0x55')){var _0x47b0ca=_0x591222[_0xb976('0x25')]({'plain':!![]});return db[_0xb976('0x56')][_0xb976('0x47')]({'where':{'name':_0xb976('0x57'),'userProfileId':_0x5e83f4[_0xb976('0x58')]},'raw':!![]})[_0xb976('0x24')](function(_0x4b4b08){if(_0x4b4b08&&_0x4b4b08[_0xb976('0x59')]===0x0){return db[_0xb976('0x26')]['create']({'name':_0x47b0ca['name'],'resourceId':_0x47b0ca['id'],'type':_0x4b4b08['name'],'sectionId':_0x4b4b08['id']},{})[_0xb976('0x24')](function(){return _0x591222;});}else{return _0x591222;}})[_0xb976('0x43')](function(_0x98598a){logger[_0xb976('0x28')](_0xb976('0x5a'),_0x98598a);});}return _0x591222;});})[_0xb976('0x24')](respondWithResult(_0xbd5eb0,0xc9))[_0xb976('0x43')](handleError(_0xbd5eb0,null));};exports[_0xb976('0x23')]=function(_0x283082,_0x8c5b97,_0x505ab4){var _0x32c6d1;return db[_0xb976('0x2c')]['find']({'where':{'id':_0x283082['params']['id']}})[_0xb976('0x24')](function(_0x1dd5a0){if(_0x1dd5a0){return db[_0xb976('0x4b')][_0xb976('0x4c')](function(_0x1c4f51){return _0x1dd5a0['destroy']({'transaction':_0x1c4f51,'raw':!![]})[_0xb976('0x24')](function(_0x50a7c9){if(_0x50a7c9['directory']){fs['readdirSync'](_0x50a7c9[_0xb976('0x4f')])[_0xb976('0x5b')](function(_0x3c9814){fs[_0xb976('0x5c')](path[_0xb976('0x5d')](_0x50a7c9[_0xb976('0x4f')],_0x3c9814));});fs[_0xb976('0x5e')](_0x50a7c9[_0xb976('0x4f')]);}return _0x50a7c9;});})[_0xb976('0x43')](function(_0x5e0bec){throw new db[(_0xb976('0x5f'))][(_0xb976('0x60'))](_0x5e0bec[_0xb976('0x61')]);});}})[_0xb976('0x24')](handleEntityNotFound(_0x8c5b97,null))[_0xb976('0x24')](removeEntity(_0x8c5b97,null))[_0xb976('0x43')](handleError(_0x8c5b97,null));};exports['addSound']=function(_0x17916,_0x36a276,_0x110a77){return db[_0xb976('0x4b')][_0xb976('0x4c')](function(_0x269c8b){var _0x3358a6;return db[_0xb976('0x2c')][_0xb976('0x47')]({'where':{'id':_0x17916['params']['id']}})[_0xb976('0x24')](function(_0x38cc02){if(_0x38cc02){_0x3358a6=_0x38cc02;return _0x38cc02[_0xb976('0x62')](_0x17916['body']['id'],{'transaction':_0x269c8b});}})[_0xb976('0x24')](function(_0x34bfd8){if(_0x34bfd8){return db[_0xb976('0x63')]['findOne']({'where':{'id':_0x17916[_0xb976('0x48')]['id']},'attributes':['id','name','save_name',_0xb976('0x64'),_0xb976('0x65')],'raw':!![]});}})[_0xb976('0x24')](function(_0x43938e){if(_0x43938e){var _0x535465=path[_0xb976('0x5d')](config[_0xb976('0x66')],_0xb976('0x67'),util[_0xb976('0x68')](_0xb976('0x69'),path[_0xb976('0x6a')](_0x43938e[_0xb976('0x6b')],path[_0xb976('0x6c')](_0x43938e[_0xb976('0x6b')])),_0x43938e['converted_format']));var _0x5cb79b=path[_0xb976('0x5d')](config[_0xb976('0x66')],_0xb976('0x50'),_0x3358a6[_0xb976('0x30')],util[_0xb976('0x68')](_0xb976('0x69'),_0x43938e['name'],_0x43938e['converted_format']));fs['symlinkSync'](_0x535465,_0x5cb79b);return _0x43938e;}})[_0xb976('0x43')](function(_0x2be33c){throw new db[(_0xb976('0x5f'))]['ValidationError'](_0x2be33c[_0xb976('0x61')]);});})[_0xb976('0x24')](handleEntityNotFound(_0x36a276,null))[_0xb976('0x24')](respondWithResult(_0x36a276,0xc9))[_0xb976('0x43')](handleError(_0x36a276,null));};exports[_0xb976('0x6d')]=function(_0x3ecadf,_0x1b7949,_0x1b601c){return db['sequelize']['transaction'](function(_0x2e8010){var _0x134704;return db[_0xb976('0x2c')][_0xb976('0x6e')]({'where':{'id':_0x3ecadf[_0xb976('0x49')]['id']}})[_0xb976('0x24')](handleEntityNotFound(_0x1b7949,null))[_0xb976('0x24')](function(_0x4a0440){if(_0x4a0440){_0x134704=_0x4a0440;return _0x4a0440['removeSound'](_0x3ecadf[_0xb976('0x49')][_0xb976('0x6f')]);}})[_0xb976('0x24')](function(_0x4da638){if(_0x4da638){return db[_0xb976('0x63')]['findOne']({'where':{'id':_0x3ecadf[_0xb976('0x49')][_0xb976('0x6f')]},'attributes':['id',_0xb976('0x30'),_0xb976('0x6b'),_0xb976('0x64'),'createdAt'],'raw':!![]});}})[_0xb976('0x24')](function(_0xb5ac36){if(_0xb5ac36){fs[_0xb976('0x5c')](path[_0xb976('0x5d')](_0x134704[_0xb976('0x4f')],util['format'](_0xb976('0x69'),_0xb5ac36[_0xb976('0x30')],_0xb5ac36[_0xb976('0x64')])));return _0xb5ac36;}})[_0xb976('0x43')](function(_0x4dcd78){throw new db[(_0xb976('0x5f'))][(_0xb976('0x60'))](_0x4dcd78['message']);});})[_0xb976('0x24')](handleEntityNotFound(_0x1b7949,null))[_0xb976('0x24')](respondWithStatusCode(_0x1b7949,0xcc))['catch'](handleError(_0x1b7949,null));};exports[_0xb976('0x70')]=function(_0x4ea8b3,_0x3cad5a,_0x147e50){var _0x297f6d={};var _0x11c8a4={};var _0x96c60;var _0x344e0f;return db[_0xb976('0x2c')][_0xb976('0x6e')]({'where':{'id':_0x4ea8b3[_0xb976('0x49')]['id']}})[_0xb976('0x24')](handleEntityNotFound(_0x3cad5a,null))[_0xb976('0x24')](function(_0x7f31f5){if(_0x7f31f5){_0x96c60=_0x7f31f5;_0x11c8a4[_0xb976('0x2f')]=_[_0xb976('0x32')](db[_0xb976('0x63')][_0xb976('0x45')]);_0x11c8a4[_0xb976('0x31')]=_[_0xb976('0x32')](_0x4ea8b3[_0xb976('0x31')]);_0x11c8a4['filters']=_[_0xb976('0x34')](_0x11c8a4[_0xb976('0x2f')],_0x11c8a4['query']);_0x297f6d['attributes']=_[_0xb976('0x34')](_0x11c8a4['model'],qs[_0xb976('0x46')](_0x4ea8b3[_0xb976('0x31')][_0xb976('0x46')]));_0x297f6d[_0xb976('0x33')]=_0x297f6d[_0xb976('0x33')][_0xb976('0x71')]?_0x297f6d[_0xb976('0x33')]:_0x11c8a4[_0xb976('0x2f')];_0x297f6d['order']=qs[_0xb976('0x38')](_0x4ea8b3[_0xb976('0x31')]['sort']);_0x297f6d[_0xb976('0x39')]=qs[_0xb976('0x3a')](_[_0xb976('0x3b')](_0x4ea8b3[_0xb976('0x31')],_0x11c8a4[_0xb976('0x3a')]));if(_0x4ea8b3['query'][_0xb976('0x3c')]){_0x297f6d['where']=_['merge'](_0x297f6d[_0xb976('0x39')],{'$or':_[_0xb976('0x2b')](_0x297f6d[_0xb976('0x33')],function(_0x3e0d16){var _0x2a6ca6={};_0x2a6ca6[_0x3e0d16]={'$like':'%'+_0x4ea8b3[_0xb976('0x31')][_0xb976('0x3c')]+'%'};return _0x2a6ca6;})});}_0x297f6d=_[_0xb976('0x3d')]({},_0x297f6d,_0x4ea8b3['options']);return _0x96c60[_0xb976('0x70')](_0x297f6d);}})[_0xb976('0x24')](function(_0x48b7ca){if(_0x48b7ca){_0x344e0f=_0x48b7ca[_0xb976('0x71')];if(!_0x4ea8b3[_0xb976('0x31')][_0xb976('0x35')](_0xb976('0x36'))){_0x297f6d[_0xb976('0x1e')]=qs[_0xb976('0x1e')](_0x4ea8b3['query'][_0xb976('0x1e')]);_0x297f6d[_0xb976('0x1d')]=qs[_0xb976('0x1d')](_0x4ea8b3[_0xb976('0x31')][_0xb976('0x1d')]);}return _0x96c60[_0xb976('0x70')](_0x297f6d);}})[_0xb976('0x24')](function(_0x4d3d5d){if(_0x4d3d5d){return _0x4d3d5d?{'count':_0x344e0f,'rows':_0x4d3d5d}:null;}})[_0xb976('0x24')](respondWithResult(_0x3cad5a,null))['catch'](handleError(_0x3cad5a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1e48772..97d554c 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 _0x7dfc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0xa1ae5c,_0x44beef){var _0x4573c1=function(_0x2580ec){while(--_0x2580ec){_0xa1ae5c['push'](_0xa1ae5c['shift']());}};_0x4573c1(++_0x44beef);}(_0x7dfc,0x1d4));var _0xc7df=function(_0x56fec6,_0x3834f1){_0x56fec6=_0x56fec6-0x0;var _0x1ce7ac=_0x7dfc[_0x56fec6];return _0x1ce7ac;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var logger=require(_0xc7df('0x2'))(_0xc7df('0x3'));var moment=require(_0xc7df('0x4'));var BPromise=require(_0xc7df('0x5'));var rp=require(_0xc7df('0x6'));var fs=require('fs');var path=require(_0xc7df('0x7'));var rimraf=require(_0xc7df('0x8'));var config=require('../../config/environment');var attributes=require(_0xc7df('0x9'));module[_0xc7df('0xa')]=function(_0x4425cc,_0x780287){return _0x4425cc[_0xc7df('0xb')](_0xc7df('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3115=['api','moment','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util'];(function(_0x3a78e6,_0x2bb4c3){var _0x470278=function(_0x2808c7){while(--_0x2808c7){_0x3a78e6['push'](_0x3a78e6['shift']());}};_0x470278(++_0x2bb4c3);}(_0x3115,0x1f3));var _0x5311=function(_0x1ad0d0,_0x3e4614){_0x1ad0d0=_0x1ad0d0-0x0;var _0xa5e9ae=_0x3115[_0x1ad0d0];return _0xa5e9ae;};'use strict';var _=require('lodash');var util=require(_0x5311('0x0'));var logger=require('../../config/logger')(_0x5311('0x1'));var moment=require(_0x5311('0x2'));var BPromise=require('bluebird');var rp=require(_0x5311('0x3'));var fs=require('fs');var path=require(_0x5311('0x4'));var rimraf=require('rimraf');var config=require(_0x5311('0x5'));var attributes=require(_0x5311('0x6'));module[_0x5311('0x7')]=function(_0x280316,_0x46094a){return _0x280316[_0x5311('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x5311('0x9'),'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 10cdd09..8176090 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5acf43,_0x47756b){var _0x51d1ff=function(_0x2778c1){while(--_0x2778c1){_0x5acf43['push'](_0x5acf43['shift']());}};_0x51d1ff(++_0x47756b);}(_0xe706,0xa3));var _0x6e70=function(_0x565d0a,_0x4927cc){_0x565d0a=_0x565d0a-0x0;var _0x24c211=_0xe706[_0x565d0a];return _0x24c211;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x239148,_0x5dfdaf){var _0x30d373=function(_0x4a5695){while(--_0x4a5695){_0x239148['push'](_0x239148['shift']());}};_0x30d373(++_0x5dfdaf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xcb91[_0x58c20f];return _0x3b0318;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ecc1808..24e57ef 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 _0xe57d=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','describe','/:id','show','/:id/users','getAgents','/:id/teams','addAgents','post','addTeams','put','delete','destroy','removeAgents','exports','multer'];(function(_0x3d1c92,_0x2f03fb){var _0x4de912=function(_0x19fa18){while(--_0x19fa18){_0x3d1c92['push'](_0x3d1c92['shift']());}};_0x4de912(++_0x2f03fb);}(_0xe57d,0xd7));var _0xde57=function(_0x4cb086,_0x4cc048){_0x4cb086=_0x4cb086-0x0;var _0x10d1af=_0xe57d[_0x4cb086];return _0x10d1af;};'use strict';var multer=require(_0xde57('0x0'));var util=require('util');var path=require(_0xde57('0x1'));var timeout=require(_0xde57('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde57('0x3'));var auth=require(_0xde57('0x4'));var interaction=require(_0xde57('0x5'));var config=require('../../config/environment');var controller=require(_0xde57('0x6'));router['get']('/',auth[_0xde57('0x7')](),controller[_0xde57('0x8')]);router[_0xde57('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xde57('0xa')]);router['get'](_0xde57('0xb'),auth[_0xde57('0x7')](),controller[_0xde57('0xc')]);router['get'](_0xde57('0xd'),auth['isAuthenticated'](),controller[_0xde57('0xe')]);router[_0xde57('0x9')](_0xde57('0xf'),auth[_0xde57('0x7')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xde57('0xd'),auth[_0xde57('0x7')](),controller[_0xde57('0x10')]);router[_0xde57('0x11')]('/:id/teams',auth[_0xde57('0x7')](),controller[_0xde57('0x12')]);router[_0xde57('0x13')](_0xde57('0xb'),auth[_0xde57('0x7')](),controller['update']);router[_0xde57('0x14')](_0xde57('0xb'),auth[_0xde57('0x7')](),controller[_0xde57('0x15')]);router['delete'](_0xde57('0xd'),auth[_0xde57('0x7')](),controller[_0xde57('0x16')]);router['delete']('/:id/teams',auth[_0xde57('0x7')](),controller['removeTeams']);module[_0xde57('0x17')]=router; \ No newline at end of file +var _0xcee8=['get','/:id','show','/:id/users','/:id/teams','getTeams','create','post','addTeams','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0xcee8,0xb1));var _0x8cee=function(_0x455f07,_0x27fdc8){_0x455f07=_0x455f07-0x0;var _0x92c790=_0xcee8[_0x455f07];return _0x92c790;};'use strict';var multer=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var path=require(_0x8cee('0x2'));var timeout=require(_0x8cee('0x3'));var express=require(_0x8cee('0x4'));var router=express[_0x8cee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8cee('0x6'));var interaction=require(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var controller=require(_0x8cee('0x9'));router['get']('/',auth[_0x8cee('0xa')](),controller[_0x8cee('0xb')]);router['get']('/describe',auth[_0x8cee('0xa')](),controller['describe']);router[_0x8cee('0xc')](_0x8cee('0xd'),auth[_0x8cee('0xa')](),controller[_0x8cee('0xe')]);router['get'](_0x8cee('0xf'),auth[_0x8cee('0xa')](),controller['getAgents']);router[_0x8cee('0xc')](_0x8cee('0x10'),auth['isAuthenticated'](),controller[_0x8cee('0x11')]);router['post']('/',auth[_0x8cee('0xa')](),controller[_0x8cee('0x12')]);router[_0x8cee('0x13')](_0x8cee('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8cee('0x13')](_0x8cee('0x10'),auth[_0x8cee('0xa')](),controller[_0x8cee('0x14')]);router[_0x8cee('0x15')](_0x8cee('0xd'),auth[_0x8cee('0xa')](),controller[_0x8cee('0x16')]);router[_0x8cee('0x17')](_0x8cee('0xd'),auth[_0x8cee('0xa')](),controller[_0x8cee('0x18')]);router[_0x8cee('0x17')](_0x8cee('0xf'),auth[_0x8cee('0xa')](),controller['removeAgents']);router[_0x8cee('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8cee('0x19')]);module[_0x8cee('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b8e8e35..0f21bcb 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 _0xdba3=['VIRTUAL','system-','getDataValue','STRING','INTEGER','exports','name'];(function(_0x5e2f73,_0x45b945){var _0x2ca653=function(_0x2a34cd){while(--_0x2a34cd){_0x5e2f73['push'](_0x5e2f73['shift']());}};_0x2ca653(++_0x45b945);}(_0xdba3,0xe5));var _0x3dba=function(_0x3d3e09,_0x45f288){_0x3d3e09=_0x3d3e09-0x0;var _0x446c36=_0xdba3[_0x3d3e09];return _0x446c36;};'use strict';var Sequelize=require('sequelize');module[_0x3dba('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3dba('0x1')},'prefix':{'type':Sequelize[_0x3dba('0x2')],'get':function(_0x36e3ea){return _0x3dba('0x3')+this[_0x3dba('0x4')](_0x3dba('0x1'))+'-';}},'description':{'type':Sequelize[_0x3dba('0x5')]},'callerIdAll':{'type':Sequelize[_0x3dba('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x3dba('0x6')]}}; \ No newline at end of file +var _0x5aef=['name','sequelize','STRING','system-'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0x5aef,0xa9));var _0xf5ae=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0x5aef[_0x35e75a];return _0xb23c7f;};'use strict';var Sequelize=require(_0xf5ae('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5ae('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x328763){return _0xf5ae('0x2')+this['getDataValue'](_0xf5ae('0x3'))+'-';}},'description':{'type':Sequelize[_0xf5ae('0x1')]},'callerIdAll':{'type':Sequelize[_0xf5ae('0x1')]},'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 d103921..0eef017 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 _0x80ed=['../../mysqldb','redis','defaults','./voicePrefix.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','type','filter','merge','options','includeAll','include','rows','catch','show','length','find','params','describe','create','sequelize','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','pick','getTeams','findOne','Team','nolimit','addTeams','findAll','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','UserVoicePrefix','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','TeamId','includes','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/license/util'];(function(_0x3017eb,_0x263305){var _0x48df25=function(_0x54db96){while(--_0x54db96){_0x3017eb['push'](_0x3017eb['shift']());}};_0x48df25(++_0x263305);}(_0x80ed,0x11c));var _0xd80e=function(_0x459970,_0x2edbdf){_0x459970=_0x459970-0x0;var _0x8a148e=_0x80ed[_0x459970];return _0x8a148e;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];config[_0xd80e('0x1b')]=_[_0xd80e('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd80e('0x1d'))[_0xd80e('0x1e')](socket);function respondWithStatusCode(_0x3096ae,_0x1e8b63){_0x1e8b63=_0x1e8b63||0xcc;return function(_0x449c60){if(_0x449c60){return _0x3096ae['sendStatus'](_0x1e8b63);}return _0x3096ae[_0xd80e('0x1f')](_0x1e8b63)[_0xd80e('0x20')]();};}function respondWithResult(_0x3124e8,_0x3b48ae){_0x3b48ae=_0x3b48ae||0xc8;return function(_0x40a4d5){if(_0x40a4d5){return _0x3124e8[_0xd80e('0x1f')](_0x3b48ae)[_0xd80e('0x21')](_0x40a4d5);}};}function respondWithFilteredResult(_0x22ab67,_0x49e3e5){return function(_0x21ceec){if(_0x21ceec){var _0x1cc576=typeof _0x49e3e5[_0xd80e('0x22')]===_0xd80e('0x23')&&typeof _0x49e3e5['limit']===_0xd80e('0x23');var _0x175c67=_0x21ceec[_0xd80e('0x24')];var _0x527237=_0x1cc576?0x0:_0x49e3e5[_0xd80e('0x22')];var _0x2ef8a1=_0x1cc576?_0x21ceec[_0xd80e('0x24')]:_0x49e3e5[_0xd80e('0x22')]+_0x49e3e5[_0xd80e('0x25')];var _0x5509d4;if(_0x2ef8a1>=_0x175c67){_0x2ef8a1=_0x175c67;_0x5509d4=0xc8;}else{_0x5509d4=0xce;}_0x22ab67['status'](_0x5509d4);return _0x22ab67[_0xd80e('0x26')](_0xd80e('0x27'),_0x527237+'-'+_0x2ef8a1+'/'+_0x175c67)[_0xd80e('0x21')](_0x21ceec);}return null;};}function patchUpdates(_0x2d46e7){return function(_0x3eb3ca){try{jsonpatch[_0xd80e('0x28')](_0x3eb3ca,_0x2d46e7,!![]);}catch(_0x43152c){return BPromise['reject'](_0x43152c);}return _0x3eb3ca[_0xd80e('0x29')]();};}function saveUpdates(_0x57d70,_0x170109){return function(_0x5b0d6d){if(_0x5b0d6d){return _0x5b0d6d[_0xd80e('0x2a')](_0x57d70)[_0xd80e('0x2b')](function(_0xe9bb59){return _0xe9bb59;});}return null;};}function removeEntity(_0x482779,_0x521aa4){return function(_0x5420e7){if(_0x5420e7){return _0x5420e7[_0xd80e('0x2c')]()['then'](function(){var _0x9f9287=_0x5420e7[_0xd80e('0x2d')]({'plain':!![]});var _0x4e8ed9=_0xd80e('0x2e');return db[_0xd80e('0x2f')][_0xd80e('0x2c')]({'where':{'type':_0x4e8ed9,'resourceId':_0x9f9287['id']}})[_0xd80e('0x2b')](function(){return _0x5420e7;});})['then'](function(){_0x482779[_0xd80e('0x1f')](0xcc)[_0xd80e('0x20')]();});}};}function handleEntityNotFound(_0x845451,_0x39088b){return function(_0x2b1aaf){if(!_0x2b1aaf){_0x845451[_0xd80e('0x30')](0x194);}return _0x2b1aaf;};}function handleError(_0x289685,_0x138f19){_0x138f19=_0x138f19||0x1f4;return function(_0x5522dd){logger['error'](_0x5522dd[_0xd80e('0x31')]);if(_0x5522dd[_0xd80e('0x32')]){delete _0x5522dd[_0xd80e('0x32')];}_0x289685[_0xd80e('0x1f')](_0x138f19)[_0xd80e('0x33')](_0x5522dd);};}exports[_0xd80e('0x34')]=function(_0x506842,_0x568d82){var _0x39c124={},_0x2d6ae5={},_0x380f4f={'count':0x0,'rows':[]};var _0x122a72=_[_0xd80e('0x35')](db[_0xd80e('0x36')][_0xd80e('0x37')],function(_0x1a0dfe){return{'name':_0x1a0dfe['fieldName'],'type':_0x1a0dfe['type'][_0xd80e('0x38')]};});_0x2d6ae5[_0xd80e('0x39')]=_[_0xd80e('0x35')](_0x122a72,_0xd80e('0x32'));_0x2d6ae5[_0xd80e('0x3a')]=_[_0xd80e('0x3b')](_0x506842[_0xd80e('0x3a')]);_0x2d6ae5[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x2d6ae5[_0xd80e('0x39')],_0x2d6ae5['query']);_0x39c124[_0xd80e('0x3e')]=_['intersection'](_0x2d6ae5[_0xd80e('0x39')],qs[_0xd80e('0x3f')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x3f')]));_0x39c124['attributes']=_0x39c124[_0xd80e('0x3e')]['length']?_0x39c124[_0xd80e('0x3e')]:_0x2d6ae5['model'];if(!_0x506842[_0xd80e('0x3a')][_0xd80e('0x40')]('nolimit')){_0x39c124[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x506842[_0xd80e('0x3a')]['limit']);_0x39c124[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x22')]);}_0x39c124[_0xd80e('0x41')]=qs[_0xd80e('0x42')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x42')]);_0x39c124[_0xd80e('0x43')]=qs['filters'](_['pick'](_0x506842['query'],_0x2d6ae5[_0xd80e('0x3c')]),_0x122a72);if(_0x506842[_0xd80e('0x3a')]['filter']){_0x39c124[_0xd80e('0x43')]=_['merge'](_0x39c124[_0xd80e('0x43')],{'$or':_['map'](_0x122a72,function(_0x7bc136){if(_0x7bc136[_0xd80e('0x44')]!=='VIRTUAL'){var _0x58d58a={};_0x58d58a[_0x7bc136[_0xd80e('0x32')]]={'$like':'%'+_0x506842[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x58d58a;}})});}_0x39c124=_[_0xd80e('0x46')]({},_0x39c124,_0x506842[_0xd80e('0x47')]);var _0x19de99={'where':_0x39c124[_0xd80e('0x43')]};return db[_0xd80e('0x36')][_0xd80e('0x24')](_0x19de99)[_0xd80e('0x2b')](function(_0x1bbb36){_0x380f4f[_0xd80e('0x24')]=_0x1bbb36;if(_0x506842[_0xd80e('0x3a')][_0xd80e('0x48')]){_0x39c124[_0xd80e('0x49')]=[{'all':!![]}];}return db[_0xd80e('0x36')]['findAll'](_0x39c124);})['then'](function(_0x5bdea5){_0x380f4f[_0xd80e('0x4a')]=_0x5bdea5;return _0x380f4f;})['then'](respondWithFilteredResult(_0x568d82,_0x39c124))[_0xd80e('0x4b')](handleError(_0x568d82,null));};exports[_0xd80e('0x4c')]=function(_0x551bd5,_0x15a880){var _0x2612e7={'raw':![],'where':{'id':_0x551bd5['params']['id']}},_0x7c394f={};_0x7c394f['model']=_['keys'](db[_0xd80e('0x36')]['rawAttributes']);_0x7c394f[_0xd80e('0x3a')]=_[_0xd80e('0x3b')](_0x551bd5[_0xd80e('0x3a')]);_0x7c394f[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x7c394f['model'],_0x7c394f[_0xd80e('0x3a')]);_0x2612e7[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x7c394f['model'],qs[_0xd80e('0x3f')](_0x551bd5[_0xd80e('0x3a')][_0xd80e('0x3f')]));_0x2612e7['attributes']=_0x2612e7[_0xd80e('0x3e')][_0xd80e('0x4d')]?_0x2612e7[_0xd80e('0x3e')]:_0x7c394f[_0xd80e('0x39')];if(_0x551bd5[_0xd80e('0x3a')][_0xd80e('0x48')]){_0x2612e7['include']=[{'all':!![]}];}_0x2612e7=_['merge']({},_0x2612e7,_0x551bd5[_0xd80e('0x47')]);return db[_0xd80e('0x36')][_0xd80e('0x4e')](_0x2612e7)['then'](handleEntityNotFound(_0x15a880,null))['then'](respondWithResult(_0x15a880,null))[_0xd80e('0x4b')](handleError(_0x15a880,null));};exports[_0xd80e('0x2c')]=function(_0x183f78,_0x1c0da8){return db[_0xd80e('0x36')]['find']({'where':{'id':_0x183f78[_0xd80e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c0da8,null))[_0xd80e('0x2b')](removeEntity(_0x1c0da8,null))[_0xd80e('0x4b')](handleError(_0x1c0da8,null));};exports['describe']=function(_0x29af86,_0xd19881){return db[_0xd80e('0x36')][_0xd80e('0x50')]()[_0xd80e('0x2b')](respondWithResult(_0xd19881,null))[_0xd80e('0x4b')](handleError(_0xd19881,null));};exports[_0xd80e('0x51')]=function(_0x50be26,_0x178c51){var _0x377e68;return db[_0xd80e('0x52')]['transaction'](function(_0x52ab04){return db[_0xd80e('0x36')][_0xd80e('0x51')](_0x50be26[_0xd80e('0x53')],{'transaction':_0x52ab04})[_0xd80e('0x2b')](function(_0x2f66eb){_0x377e68=_0x2f66eb[_0xd80e('0x2d')]({'plain':!![]});return db[_0xd80e('0x54')][_0xd80e('0x4e')]({'where':{'id':_0x377e68['VoiceExtensionId']},'raw':!![]})[_0xd80e('0x2b')](function(_0x5d6590){return createVoicePrefixExtensions(_0x377e68,_0x5d6590,_0x52ab04);});});})[_0xd80e('0x2b')](function(){var _0x3c184c=_0x50be26[_0xd80e('0x55')][_0xd80e('0x2d')]({'plain':!![]});if(!_0x3c184c)throw new Error(_0xd80e('0x56'));if(_0x3c184c[_0xd80e('0x57')]==='user'){var _0x13270c=_0x377e68;return db['UserProfileSection'][_0xd80e('0x4e')]({'where':{'name':_0xd80e('0x2e'),'userProfileId':_0x3c184c['userProfileId']},'raw':!![]})['then'](function(_0x402c0f){if(_0x402c0f&&_0x402c0f[_0xd80e('0x58')]===0x0){return db[_0xd80e('0x2f')]['create']({'name':_0x13270c['name'],'resourceId':_0x13270c['id'],'type':_0x402c0f[_0xd80e('0x32')],'sectionId':_0x402c0f['id']},{})[_0xd80e('0x2b')](function(){return _0x377e68;});}else{return _0x377e68;}})['catch'](function(_0x386918){logger[_0xd80e('0x59')](_0xd80e('0x5a'),_0x386918);throw _0x386918;});}return _0x377e68;})['then'](respondWithResult(_0x178c51,null))[_0xd80e('0x4b')](handleError(_0x178c51,null));};function Extension(_0x589c0b,_0x720eab,_0x392704,_0x3d8e46){this[_0xd80e('0x5b')]='from-sip';this[_0xd80e('0x5c')]=_0x589c0b;this['app']=_0x392704;this[_0xd80e('0x44')]='system';this[_0xd80e('0x5d')]=_0xd80e('0x5e');this[_0xd80e('0x5f')]=_0x720eab;this[_0xd80e('0x60')]=_0x3d8e46;}function createVoicePrefixExtensions(_0x53dd96,_0x1738ff,_0x280798){return new BPromise(function(_0x5d775f,_0x2ebfea){var _0x391e0c=new Extension(formatPrefixName(_0x53dd96[_0xd80e('0x61')]),0x1,_0xd80e('0x62'),'Voice\x20Prefix');_0x391e0c[_0xd80e('0x63')]=_0x53dd96['id'];return db[_0xd80e('0x54')]['create'](_0x391e0c,{'transaction':_0x280798})[_0xd80e('0x2b')](function(_0x22c680){var _0x136040=_0x22c680['get']({'plain':!![]});var _0x562ed7=_['map'](addVoicePrefixExtensions(_0x53dd96,_0x1738ff),function(_0x5f241c){_0x5f241c[_0xd80e('0x64')]=_0x136040['id'];_0x5f241c['VoicePrefixId']=_0x53dd96['id'];return _0x5f241c;});return db[_0xd80e('0x54')][_0xd80e('0x65')](_0x562ed7,{'transaction':_0x280798})[_0xd80e('0x2b')](function(_0x4e1b08){if(!_0x4e1b08){return _0x2ebfea(_0xd80e('0x66'));}else{return _0x5d775f(_0x4e1b08);}})[_0xd80e('0x4b')](function(_0x2b3ad6){return _0x2ebfea(_0x2b3ad6);});});;});};function addVoicePrefixExtensions(_0x1a351b,_0x43ab7b){var _0x2a34cd=[];var _0x385453=formatPrefixName(_0x1a351b[_0xd80e('0x61')]);_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x2,'Set','CDR(prefix)='+_0x1a351b[_0xd80e('0x32')]));if(_0x1a351b[_0xd80e('0x68')]){_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x3,_0xd80e('0x69'),'PREFIX-CALLERIDALL='+_0x1a351b[_0xd80e('0x68')]));}else{_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x3,_0xd80e('0x62'),_0xd80e('0x6a')));}_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x4,'goto',_0x43ab7b[_0xd80e('0x5b')]+','+_0xd80e('0x6b')+(0x8+_0x1a351b[_0xd80e('0x32')][_0xd80e('0x4d')])+'}'+','+0x1));return _0x2a34cd;}function formatPrefixName(_0x53971e){var _0x215f2d='_';for(var _0x29be62=0x0;_0x29be62<_0x53971e[_0xd80e('0x4d')];_0x29be62++){if(_0x53971e[_0xd80e('0x6c')](_0x29be62)=='-'){_0x215f2d+=_0x53971e[_0xd80e('0x6c')](_0x29be62);}else{_0x215f2d+='['+_0x53971e[_0xd80e('0x6c')](_0x29be62)+']';}}_0x215f2d+='.';return _0x215f2d;}exports['update']=function(_0x3e3176,_0x393fb6,_0x5243c7){var _0x44cf88=_0x3e3176[_0xd80e('0x53')];_0x44cf88[_0xd80e('0x61')]=_0xd80e('0x6d')+_0x44cf88['name']+'-';return db[_0xd80e('0x52')]['transaction'](function(_0x314fbb){return db[_0xd80e('0x36')][_0xd80e('0x2a')](_0x44cf88,{'where':{'id':_0x44cf88['id']},'transaction':_0x314fbb})[_0xd80e('0x2b')](function(){return db[_0xd80e('0x54')]['destroy']({'where':{'VoicePrefixId':_0x44cf88['id']},'transaction':_0x314fbb})[_0xd80e('0x2b')](function(){return db[_0xd80e('0x54')][_0xd80e('0x4e')]({'where':{'id':_0x44cf88[_0xd80e('0x64')]},'raw':!![]})['then'](function(_0x46c926){return createVoicePrefixExtensions(_0x44cf88,_0x46c926,_0x314fbb);});});});})[_0xd80e('0x2b')](function(){return db['VoicePrefix'][_0xd80e('0x6e')](_0x44cf88['id']);})[_0xd80e('0x2b')](respondWithResult(_0x393fb6,null))[_0xd80e('0x4b')](handleError(_0x393fb6,null));};exports[_0xd80e('0x6f')]=function(_0x3feb77,_0x8b2fc4,_0x4a0dea){return db['VoicePrefix'][_0xd80e('0x4e')]({'where':{'id':_0x3feb77['params']['id']}})['then'](handleEntityNotFound(_0x8b2fc4,null))[_0xd80e('0x2b')](function(_0x1c830c){if(_0x1c830c){return _0x1c830c[_0xd80e('0x6f')](_0x3feb77[_0xd80e('0x53')][_0xd80e('0x70')],_[_0xd80e('0x71')](_0x3feb77[_0xd80e('0x53')],[_0xd80e('0x70'),'id'])||{})['spread'](function(_0x2d80d1){for(var _0xc5455e=0x0;_0xc5455e<_0x3feb77[_0xd80e('0x53')][_0xd80e('0x70')]['length'];_0xc5455e+=0x1){socket[_0xd80e('0x72')](_0xd80e('0x73'),{'UserId':Number(_0x3feb77['body'][_0xd80e('0x70')][_0xc5455e]),'VoicePrefixId':Number(_0x3feb77[_0xd80e('0x4f')]['id'])});}return _0x2d80d1;});}})['then'](respondWithResult(_0x8b2fc4,null))[_0xd80e('0x4b')](handleError(_0x8b2fc4,null));};exports[_0xd80e('0x74')]=function(_0x472dd3,_0x3fb194,_0x18299b){return db[_0xd80e('0x36')][_0xd80e('0x4e')]({'where':{'id':_0x472dd3[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x3fb194,null))[_0xd80e('0x2b')](function(_0x5d8e7c){if(_0x5d8e7c){return _0x5d8e7c[_0xd80e('0x74')](_0x472dd3[_0xd80e('0x3a')]['ids'])[_0xd80e('0x2b')](function(){if(_[_0xd80e('0x75')](_0x472dd3[_0xd80e('0x3a')]['ids'])){for(var _0x2090f4=0x0;_0x2090f4<_0x472dd3['query'][_0xd80e('0x70')][_0xd80e('0x4d')];_0x2090f4+=0x1){socket[_0xd80e('0x72')](_0xd80e('0x76'),{'UserId':Number(_0x472dd3[_0xd80e('0x3a')]['ids'][_0x2090f4]),'VoicePrefixId':Number(_0x472dd3[_0xd80e('0x4f')]['id'])});}}else{socket[_0xd80e('0x72')](_0xd80e('0x76'),{'UserId':Number(_0x472dd3[_0xd80e('0x3a')][_0xd80e('0x70')]),'VoicePrefixId':Number(_0x472dd3[_0xd80e('0x4f')]['id'])});}});}})[_0xd80e('0x2b')](respondWithStatusCode(_0x3fb194,null))[_0xd80e('0x4b')](handleError(_0x3fb194,null));};exports[_0xd80e('0x77')]=function(_0x28b7dc,_0x30a3d0,_0x99f183){var _0x31fd22={};var _0x1873d2={};var _0x5ddd1f;var _0x30ba45;return db['VoicePrefix']['findOne']({'where':{'id':_0x28b7dc['params']['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x30a3d0,null))[_0xd80e('0x2b')](function(_0x2d8f13){if(_0x2d8f13){_0x5ddd1f=_0x2d8f13;_0x1873d2[_0xd80e('0x39')]=_['keys'](db[_0xd80e('0x78')][_0xd80e('0x37')]);_0x1873d2[_0xd80e('0x3a')]=_['keys'](_0x28b7dc['query']);_0x1873d2[_0xd80e('0x3c')]=_['intersection'](_0x1873d2[_0xd80e('0x39')],_0x1873d2[_0xd80e('0x3a')]);_0x31fd22[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x1873d2[_0xd80e('0x39')],qs[_0xd80e('0x3f')](_0x28b7dc[_0xd80e('0x3a')]['fields']));_0x31fd22['attributes']=_0x31fd22['attributes'][_0xd80e('0x4d')]?_0x31fd22[_0xd80e('0x3e')]:_0x1873d2[_0xd80e('0x39')];_0x31fd22[_0xd80e('0x41')]=qs[_0xd80e('0x42')](_0x28b7dc[_0xd80e('0x3a')][_0xd80e('0x42')]);_0x31fd22[_0xd80e('0x43')]=qs[_0xd80e('0x3c')](_[_0xd80e('0x79')](_0x28b7dc[_0xd80e('0x3a')],_0x1873d2[_0xd80e('0x3c')]));if(_0x28b7dc[_0xd80e('0x3a')]['filter']){_0x31fd22[_0xd80e('0x43')]=_[_0xd80e('0x46')](_0x31fd22[_0xd80e('0x43')],{'$or':_[_0xd80e('0x35')](_0x31fd22[_0xd80e('0x3e')],function(_0x14ed09){var _0x34fcb2={};_0x34fcb2[_0x14ed09]={'$like':'%'+_0x28b7dc[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x34fcb2;})});}_0x31fd22=_[_0xd80e('0x46')]({},_0x31fd22,_0x28b7dc['options']);return _0x5ddd1f[_0xd80e('0x77')](_0x31fd22);}})[_0xd80e('0x2b')](function(_0x3e36e4){if(_0x3e36e4){_0x30ba45=_0x3e36e4[_0xd80e('0x4d')];if(!_0x28b7dc['query']['hasOwnProperty']('nolimit')){_0x31fd22[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x28b7dc['query'][_0xd80e('0x25')]);_0x31fd22[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x28b7dc['query'][_0xd80e('0x22')]);}return _0x5ddd1f['getAgents'](_0x31fd22);}})[_0xd80e('0x2b')](function(_0x247ebc){if(_0x247ebc){return _0x247ebc?{'count':_0x30ba45,'rows':_0x247ebc}:null;}})['then'](respondWithResult(_0x30a3d0,null))[_0xd80e('0x4b')](handleError(_0x30a3d0,null));};exports[_0xd80e('0x7a')]=function(_0x273551,_0x3d0f54,_0x511baa){var _0x366559={};var _0x494718={};var _0x120907;var _0x39721f;return db[_0xd80e('0x36')][_0xd80e('0x7b')]({'where':{'id':_0x273551[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x3d0f54,null))[_0xd80e('0x2b')](function(_0x23514b){if(_0x23514b){_0x120907=_0x23514b;_0x494718[_0xd80e('0x39')]=_[_0xd80e('0x3b')](db[_0xd80e('0x7c')]['rawAttributes']);_0x494718['query']=_['keys'](_0x273551[_0xd80e('0x3a')]);_0x494718[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x494718[_0xd80e('0x39')],_0x494718[_0xd80e('0x3a')]);_0x366559[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x494718[_0xd80e('0x39')],qs['fields'](_0x273551[_0xd80e('0x3a')]['fields']));_0x366559[_0xd80e('0x3e')]=_0x366559[_0xd80e('0x3e')][_0xd80e('0x4d')]?_0x366559['attributes']:_0x494718[_0xd80e('0x39')];_0x366559['order']=qs[_0xd80e('0x42')](_0x273551['query'][_0xd80e('0x42')]);_0x366559[_0xd80e('0x43')]=qs['filters'](_['pick'](_0x273551[_0xd80e('0x3a')],_0x494718[_0xd80e('0x3c')]));if(_0x273551[_0xd80e('0x3a')][_0xd80e('0x45')]){_0x366559[_0xd80e('0x43')]=_[_0xd80e('0x46')](_0x366559[_0xd80e('0x43')],{'$or':_['map'](_0x366559[_0xd80e('0x3e')],function(_0x5c8d28){var _0x33afc6={};_0x33afc6[_0x5c8d28]={'$like':'%'+_0x273551[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x33afc6;})});}_0x366559=_[_0xd80e('0x46')]({},_0x366559,_0x273551[_0xd80e('0x47')]);return _0x120907['getTeams'](_0x366559);}})['then'](function(_0x42e910){if(_0x42e910){_0x39721f=_0x42e910[_0xd80e('0x4d')];if(!_0x273551[_0xd80e('0x3a')][_0xd80e('0x40')](_0xd80e('0x7d'))){_0x366559[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x273551[_0xd80e('0x3a')][_0xd80e('0x25')]);_0x366559[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x273551[_0xd80e('0x3a')][_0xd80e('0x22')]);}return _0x120907['getTeams'](_0x366559);}})[_0xd80e('0x2b')](function(_0x54eaad){if(_0x54eaad){return _0x54eaad?{'count':_0x39721f,'rows':_0x54eaad}:null;}})[_0xd80e('0x2b')](respondWithResult(_0x3d0f54,null))[_0xd80e('0x4b')](handleError(_0x3d0f54,null));};exports[_0xd80e('0x7e')]=function(_0x3e60bf,_0x47184c,_0x53fbbd){var _0x5c108f=_0x3e60bf[_0xd80e('0x53')][_0xd80e('0x70')];var _0x4f010e;return db[_0xd80e('0x7c')][_0xd80e('0x7f')]({'where':{'id':_0x5c108f},'attributes':['id'],'include':[{'model':db[_0xd80e('0x78')],'as':_0xd80e('0x80'),'attributes':['id','name',_0xd80e('0x81'),_0xd80e('0x82'),_0xd80e('0x83')],'raw':!![]}]})[_0xd80e('0x2b')](function(_0x16737b){if(_0x16737b){_0x4f010e=_0x16737b;var _0xac3eff=_[_0xd80e('0x84')](_0x16737b,function(_0x3be383){var _0x50b24d=_0x3be383['get']({'plain':!![]});return _0x50b24d[_0xd80e('0x80')];});return db[_0xd80e('0x36')][_0xd80e('0x4e')]({'where':{'id':_0x3e60bf[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](function(_0x2c80ed){return db[_0xd80e('0x52')][_0xd80e('0x85')](function(_0x83a318){return _0x2c80ed[_0xd80e('0x7e')](_0x5c108f,{'transaction':_0x83a318})[_0xd80e('0x2b')](function(){return BPromise[_0xd80e('0x86')](_0x4f010e,function(_0x33e712){return db[_0xd80e('0x87')]['upsert']({'TeamId':_0x33e712['id'],'VoicePrefixId':_0x3e60bf[_0xd80e('0x4f')]['id']},{'transaction':_0x83a318});});})[_0xd80e('0x2b')](function(){return BPromise['each'](_0xac3eff,function(_0x2f90b3){return db[_0xd80e('0x88')]['findOrCreate']({'where':{'UserId':_0x2f90b3['id'],'VoicePrefixId':_0x3e60bf[_0xd80e('0x4f')]['id']},'transaction':_0x83a318});});})['then'](function(){_0xac3eff[_0xd80e('0x89')](function(_0x25455c){socket[_0xd80e('0x72')]('userVoicePrefix:save',{'UserId':_0x25455c['id'],'VoicePrefixId':_0x2c80ed['id']});});});});});}})[_0xd80e('0x2b')](respondWithStatusCode(_0x47184c,null))[_0xd80e('0x4b')](handleError(_0x47184c,null));};exports[_0xd80e('0x8a')]=function(_0x35bc9a,_0x598a2e,_0x1ba292){return db[_0xd80e('0x7c')][_0xd80e('0x7f')]({'where':{'id':_0x35bc9a[_0xd80e('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd80e('0x78')],'as':_0xd80e('0x80'),'attributes':['id'],'raw':!![]}]})[_0xd80e('0x2b')](handleEntityNotFound(_0x598a2e,null))[_0xd80e('0x2b')](function(_0x3a6e2d){var _0x4ba15d=_[_0xd80e('0x35')](_0x3a6e2d,'id');var _0x2635e9=[];var _0x21baed=[];var _0x570b33=squel['select']();_0x570b33[_0xd80e('0x8b')](_0xd80e('0x8c'))[_0xd80e('0x8d')](_0xd80e('0x8e'),'tq')[_0xd80e('0x8f')](_0xd80e('0x90'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd80e('0x43')](_0xd80e('0x91'),_0x35bc9a[_0xd80e('0x4f')]['id']);for(var _0x24c913=0x0;_0x24c913<_0x3a6e2d[_0xd80e('0x4d')];_0x24c913+=0x1){let _0x302063=_0x3a6e2d[_0x24c913];for(var _0x5a477c=0x0;_0x5a477c<_0x302063[_0xd80e('0x80')][_0xd80e('0x4d')];_0x5a477c+=0x1){let _0x54cbd5=_0x302063['Agents'][_0x5a477c];var _0x33d344=_0x570b33[_0xd80e('0x92')]();_0x33d344[_0xd80e('0x43')](_0xd80e('0x93'),_0x54cbd5['id']);_0x21baed[_0xd80e('0x67')](db[_0xd80e('0x52')][_0xd80e('0x3a')](_0x33d344[_0xd80e('0x94')](),{'type':db[_0xd80e('0x52')]['QueryTypes']['SELECT']})[_0xd80e('0x2b')](function(_0x1387b7){if(_0x1387b7[_0xd80e('0x4d')]===0x1){return _0x54cbd5['id'];}else{var _0xc8b46=_['every'](_[_0xd80e('0x35')](_0x1387b7,_0xd80e('0x95')),function(_0x13590b){return _[_0xd80e('0x96')](_0x4ba15d,_0x13590b);});if(_0xc8b46){return _0x54cbd5['id'];}}}));}}return BPromise['all'](_0x21baed)['then'](function(_0x527b34){_0x2635e9=_(_0x2635e9)[_0xd80e('0x97')](_0x527b34)[_0xd80e('0x98')]()[_0xd80e('0x99')]();return db['VoicePrefix'][_0xd80e('0x4e')]({'where':{'id':_0x35bc9a[_0xd80e('0x4f')]['id']}})['then'](function(_0x5b72de){return db[_0xd80e('0x52')][_0xd80e('0x85')](function(_0x2a46e7){return _0x5b72de[_0xd80e('0x8a')](_0x35bc9a['query'][_0xd80e('0x70')],{'transaction':_0x2a46e7})[_0xd80e('0x2b')](function(){if(!_[_0xd80e('0x9a')](_0x2635e9)){return _0x5b72de[_0xd80e('0x74')](_0x2635e9,{'transaction':_0x2a46e7});}})[_0xd80e('0x2b')](function(){_0x2635e9[_0xd80e('0x89')](function(_0x45a047){socket[_0xd80e('0x72')]('userVoicePrefix:remove',{'UserId':_0x45a047,'VoicePrefixId':_0x5b72de['id']});});});});});});})[_0xd80e('0x2b')](respondWithStatusCode(_0x598a2e,null))[_0xd80e('0x4b')](handleError(_0x598a2e,null));}; \ No newline at end of file +var _0x8603=['send','map','VoicePrefix','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','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','findOrCreate','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','includes','all','union','compact','forEach','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8603,0x190));var _0x3860=function(_0x3fcfb4,_0x4b303d){_0x3fcfb4=_0x3fcfb4-0x0;var _0x5ebffa=_0x8603[_0x3fcfb4];return _0x5ebffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['VoicePrefix'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x2c')]=function(_0x52456e,_0x29c52d){return db['VoicePrefix'][_0x3860('0x4e')]({'where':{'id':_0x52456e['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x29c52d,null))[_0x3860('0x28')](removeEntity(_0x29c52d,null))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports['describe']=function(_0x4876ab,_0x4408b5){return db[_0x3860('0x31')]['describe']()[_0x3860('0x28')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x4f')]=function(_0x1267e1,_0x254631){var _0x233eee;return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x3fad85){return db['VoicePrefix'][_0x3860('0x4f')](_0x1267e1[_0x3860('0x52')],{'transaction':_0x3fad85})[_0x3860('0x28')](function(_0x137789){_0x233eee=_0x137789[_0x3860('0x29')]({'plain':!![]});return db[_0x3860('0x53')]['find']({'where':{'id':_0x233eee[_0x3860('0x54')]},'raw':!![]})[_0x3860('0x28')](function(_0x19a26d){return createVoicePrefixExtensions(_0x233eee,_0x19a26d,_0x3fad85);});});})[_0x3860('0x28')](function(){var _0x3a55e7=_0x1267e1[_0x3860('0x55')][_0x3860('0x29')]({'plain':!![]});if(!_0x3a55e7)throw new Error(_0x3860('0x56'));if(_0x3a55e7['role']===_0x3860('0x55')){var _0x2ff0bf=_0x233eee;return db['UserProfileSection'][_0x3860('0x4e')]({'where':{'name':_0x3860('0x2a'),'userProfileId':_0x3a55e7[_0x3860('0x57')]},'raw':!![]})['then'](function(_0x17d2df){if(_0x17d2df&&_0x17d2df['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x2ff0bf[_0x3860('0x2e')],'resourceId':_0x2ff0bf['id'],'type':_0x17d2df[_0x3860('0x2e')],'sectionId':_0x17d2df['id']},{})[_0x3860('0x28')](function(){return _0x233eee;});}else{return _0x233eee;}})[_0x3860('0x47')](function(_0x1a4f58){logger[_0x3860('0x58')](_0x3860('0x59'),_0x1a4f58);throw _0x1a4f58;});}return _0x233eee;})[_0x3860('0x28')](respondWithResult(_0x254631,null))[_0x3860('0x47')](handleError(_0x254631,null));};function Extension(_0x2bac24,_0x58147d,_0x5ce9a4,_0x5111e0){this[_0x3860('0x5a')]='from-sip';this['exten']=_0x2bac24;this[_0x3860('0x5b')]=_0x5ce9a4;this[_0x3860('0x32')]=_0x3860('0x5c');this[_0x3860('0x5d')]=_0x3860('0x5e');this[_0x3860('0x5f')]=_0x58147d;this['appdata']=_0x5111e0;}function createVoicePrefixExtensions(_0x49ec68,_0x4df47b,_0x1d6c70){return new BPromise(function(_0x1c1da4,_0x2d1646){var _0x5ec169=new Extension(formatPrefixName(_0x49ec68[_0x3860('0x60')]),0x1,'NoOp',_0x3860('0x61'));_0x5ec169[_0x3860('0x62')]=_0x49ec68['id'];return db['VoiceExtension'][_0x3860('0x4f')](_0x5ec169,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0xfe45d8){var _0x27f817=_0xfe45d8['get']({'plain':!![]});var _0x18cc37=_[_0x3860('0x30')](addVoicePrefixExtensions(_0x49ec68,_0x4df47b),function(_0x17f248){_0x17f248['VoiceExtensionId']=_0x27f817['id'];_0x17f248['VoicePrefixId']=_0x49ec68['id'];return _0x17f248;});return db[_0x3860('0x53')][_0x3860('0x63')](_0x18cc37,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0x1ca0e7){if(!_0x1ca0e7){return _0x2d1646(_0x3860('0x64'));}else{return _0x1c1da4(_0x1ca0e7);}})[_0x3860('0x47')](function(_0x5d0210){return _0x2d1646(_0x5d0210);});});;});};function addVoicePrefixExtensions(_0x2d916a,_0x4fe4e8){var _0x5db8f9=[];var _0x15fa2d=formatPrefixName(_0x2d916a[_0x3860('0x60')]);_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x2,_0x3860('0x66'),_0x3860('0x67')+_0x2d916a[_0x3860('0x2e')]));if(_0x2d916a['callerIdAll']){_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x66'),_0x3860('0x68')+_0x2d916a[_0x3860('0x69')]));}else{_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x6a'),'No\x20callerid\x20available'));}_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x4,_0x3860('0x6b'),_0x4fe4e8[_0x3860('0x5a')]+','+'${EXTEN:'+(0x8+_0x2d916a['name'][_0x3860('0x4b')])+'}'+','+0x1));return _0x5db8f9;}function formatPrefixName(_0x2d425d){var _0x11c2c8='_';for(var _0x3b7a76=0x0;_0x3b7a76<_0x2d425d[_0x3860('0x4b')];_0x3b7a76++){if(_0x2d425d['charAt'](_0x3b7a76)=='-'){_0x11c2c8+=_0x2d425d['charAt'](_0x3b7a76);}else{_0x11c2c8+='['+_0x2d425d[_0x3860('0x6c')](_0x3b7a76)+']';}}_0x11c2c8+='.';return _0x11c2c8;}exports[_0x3860('0x6d')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){var _0x38ad4e=_0x47e144['body'];_0x38ad4e[_0x3860('0x60')]=_0x3860('0x6e')+_0x38ad4e[_0x3860('0x2e')]+'-';return db[_0x3860('0x50')]['transaction'](function(_0x1e8c5c){return db[_0x3860('0x31')]['update'](_0x38ad4e,{'where':{'id':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')][_0x3860('0x2c')]({'where':{'VoicePrefixId':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')]['find']({'where':{'id':_0x38ad4e[_0x3860('0x54')]},'raw':!![]})['then'](function(_0x543574){return createVoicePrefixExtensions(_0x38ad4e,_0x543574,_0x1e8c5c);});});});})[_0x3860('0x28')](function(){return db['VoicePrefix'][_0x3860('0x6f')](_0x38ad4e['id']);})[_0x3860('0x28')](respondWithResult(_0x5d9416,null))[_0x3860('0x47')](handleError(_0x5d9416,null));};exports[_0x3860('0x70')]=function(_0x19f717,_0x43c5a1,_0x4b3447){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x19f717[_0x3860('0x49')]['id']}})['then'](handleEntityNotFound(_0x43c5a1,null))[_0x3860('0x28')](function(_0x55661a){if(_0x55661a){return _0x55661a[_0x3860('0x70')](_0x19f717[_0x3860('0x52')]['ids'],_[_0x3860('0x71')](_0x19f717[_0x3860('0x52')],[_0x3860('0x72'),'id'])||{})['spread'](function(_0x572707){for(var _0x5a282a=0x0;_0x5a282a<_0x19f717['body'][_0x3860('0x72')][_0x3860('0x4b')];_0x5a282a+=0x1){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':Number(_0x19f717['body']['ids'][_0x5a282a]),'VoicePrefixId':Number(_0x19f717[_0x3860('0x49')]['id'])});}return _0x572707;});}})[_0x3860('0x28')](respondWithResult(_0x43c5a1,null))[_0x3860('0x47')](handleError(_0x43c5a1,null));};exports[_0x3860('0x75')]=function(_0x4b0652,_0x3a7c0c,_0x306560){return db['VoicePrefix']['find']({'where':{'id':_0x4b0652[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3a7c0c,null))[_0x3860('0x28')](function(_0x27894f){if(_0x27894f){return _0x27894f['removeAgents'](_0x4b0652['query'][_0x3860('0x72')])['then'](function(){if(_[_0x3860('0x76')](_0x4b0652[_0x3860('0x35')]['ids'])){for(var _0x4e7713=0x0;_0x4e7713<_0x4b0652['query'][_0x3860('0x72')][_0x3860('0x4b')];_0x4e7713+=0x1){socket['emit'](_0x3860('0x77'),{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')][_0x4e7713]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}}else{socket[_0x3860('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}});}})[_0x3860('0x28')](respondWithStatusCode(_0x3a7c0c,null))[_0x3860('0x47')](handleError(_0x3a7c0c,null));};exports['getAgents']=function(_0x313366,_0xf57e80,_0x2f3759){var _0x41ee6f={};var _0x28fcb6={};var _0x543c98;var _0x532370;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x313366[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xf57e80,null))[_0x3860('0x28')](function(_0x293c60){if(_0x293c60){_0x543c98=_0x293c60;_0x28fcb6[_0x3860('0x34')]=_['keys'](db[_0x3860('0x79')][_0x3860('0x4a')]);_0x28fcb6['query']=_[_0x3860('0x36')](_0x313366[_0x3860('0x35')]);_0x28fcb6[_0x3860('0x37')]=_['intersection'](_0x28fcb6[_0x3860('0x34')],_0x28fcb6[_0x3860('0x35')]);_0x41ee6f['attributes']=_[_0x3860('0x38')](_0x28fcb6['model'],qs[_0x3860('0x3a')](_0x313366[_0x3860('0x35')]['fields']));_0x41ee6f[_0x3860('0x39')]=_0x41ee6f[_0x3860('0x39')][_0x3860('0x4b')]?_0x41ee6f[_0x3860('0x39')]:_0x28fcb6[_0x3860('0x34')];_0x41ee6f['order']=qs[_0x3860('0x3e')](_0x313366[_0x3860('0x35')][_0x3860('0x3e')]);_0x41ee6f[_0x3860('0x3f')]=qs[_0x3860('0x37')](_['pick'](_0x313366['query'],_0x28fcb6[_0x3860('0x37')]));if(_0x313366[_0x3860('0x35')]['filter']){_0x41ee6f[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x41ee6f[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x41ee6f['attributes'],function(_0x3a0719){var _0x5a2f99={};_0x5a2f99[_0x3a0719]={'$like':'%'+_0x313366[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x5a2f99;})});}_0x41ee6f=_[_0x3860('0x42')]({},_0x41ee6f,_0x313366[_0x3860('0x44')]);return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})[_0x3860('0x28')](function(_0x467b1b){if(_0x467b1b){_0x532370=_0x467b1b['length'];if(!_0x313366[_0x3860('0x35')][_0x3860('0x3b')]('nolimit')){_0x41ee6f['limit']=qs['limit'](_0x313366['query'][_0x3860('0x20')]);_0x41ee6f[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x313366[_0x3860('0x35')][_0x3860('0x22')]);}return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})['then'](function(_0x204da6){if(_0x204da6){return _0x204da6?{'count':_0x532370,'rows':_0x204da6}:null;}})['then'](respondWithResult(_0xf57e80,null))[_0x3860('0x47')](handleError(_0xf57e80,null));};exports[_0x3860('0x7b')]=function(_0x897ea0,_0x221229,_0x459b6c){var _0x1108d2={};var _0x23d7f0={};var _0x52987a;var _0xcd4bd3;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x897ea0['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x221229,null))[_0x3860('0x28')](function(_0x1c87bd){if(_0x1c87bd){_0x52987a=_0x1c87bd;_0x23d7f0['model']=_[_0x3860('0x36')](db[_0x3860('0x7c')][_0x3860('0x4a')]);_0x23d7f0[_0x3860('0x35')]=_['keys'](_0x897ea0[_0x3860('0x35')]);_0x23d7f0[_0x3860('0x37')]=_[_0x3860('0x38')](_0x23d7f0['model'],_0x23d7f0[_0x3860('0x35')]);_0x1108d2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x23d7f0['model'],qs[_0x3860('0x3a')](_0x897ea0[_0x3860('0x35')][_0x3860('0x3a')]));_0x1108d2['attributes']=_0x1108d2[_0x3860('0x39')][_0x3860('0x4b')]?_0x1108d2[_0x3860('0x39')]:_0x23d7f0['model'];_0x1108d2[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x897ea0[_0x3860('0x35')]['sort']);_0x1108d2[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x897ea0['query'],_0x23d7f0[_0x3860('0x37')]));if(_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]){_0x1108d2[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x1108d2[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x1108d2[_0x3860('0x39')],function(_0x3f808c){var _0x1de607={};_0x1de607[_0x3f808c]={'$like':'%'+_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1de607;})});}_0x1108d2=_[_0x3860('0x42')]({},_0x1108d2,_0x897ea0[_0x3860('0x44')]);return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})[_0x3860('0x28')](function(_0x46661f){if(_0x46661f){_0xcd4bd3=_0x46661f[_0x3860('0x4b')];if(!_0x897ea0['query'][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1108d2[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x897ea0[_0x3860('0x35')][_0x3860('0x20')]);_0x1108d2[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x897ea0[_0x3860('0x35')][_0x3860('0x22')]);}return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})['then'](function(_0x252c19){if(_0x252c19){return _0x252c19?{'count':_0xcd4bd3,'rows':_0x252c19}:null;}})[_0x3860('0x28')](respondWithResult(_0x221229,null))[_0x3860('0x47')](handleError(_0x221229,null));};exports[_0x3860('0x7d')]=function(_0x4a929e,_0x1a1994,_0x2ece36){var _0x2fcf2c=_0x4a929e[_0x3860('0x52')]['ids'];var _0x280747;return db['Team']['findAll']({'where':{'id':_0x2fcf2c},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id',_0x3860('0x2e'),_0x3860('0x7f'),_0x3860('0x80'),_0x3860('0x81')],'raw':!![]}]})[_0x3860('0x28')](function(_0x273fed){if(_0x273fed){_0x280747=_0x273fed;var _0x3e4a88=_[_0x3860('0x82')](_0x273fed,function(_0x4677b0){var _0x559c=_0x4677b0[_0x3860('0x29')]({'plain':!![]});return _0x559c['Agents'];});return db[_0x3860('0x31')]['find']({'where':{'id':_0x4a929e[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x5891d8){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x1a9158){return _0x5891d8[_0x3860('0x7d')](_0x2fcf2c,{'transaction':_0x1a9158})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x280747,function(_0x12296a){return db['TeamVoicePrefix'][_0x3860('0x84')]({'TeamId':_0x12296a['id'],'VoicePrefixId':_0x4a929e[_0x3860('0x49')]['id']},{'transaction':_0x1a9158});});})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x3e4a88,function(_0x469ae6){return db['UserVoicePrefix'][_0x3860('0x85')]({'where':{'UserId':_0x469ae6['id'],'VoicePrefixId':_0x4a929e['params']['id']},'transaction':_0x1a9158});});})['then'](function(){_0x3e4a88['forEach'](function(_0x1059a4){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':_0x1059a4['id'],'VoicePrefixId':_0x5891d8['id']});});});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x1a1994,null))[_0x3860('0x47')](handleError(_0x1a1994,null));};exports[_0x3860('0x86')]=function(_0x270ca1,_0xe24a1d,_0x59c203){return db[_0x3860('0x7c')][_0x3860('0x45')]({'where':{'id':_0x270ca1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x28')](handleEntityNotFound(_0xe24a1d,null))['then'](function(_0x1fe2d8){var _0x4f07f3=_[_0x3860('0x30')](_0x1fe2d8,'id');var _0x5c196e=[];var _0x41fd53=[];var _0xf91fc2=squel['select']();_0xf91fc2[_0x3860('0x87')](_0x3860('0x88'))['from'](_0x3860('0x89'),'tq')[_0x3860('0x8a')](_0x3860('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3860('0x3f')]('VoicePrefixId\x20=\x20?',_0x270ca1[_0x3860('0x49')]['id']);for(var _0x18b845=0x0;_0x18b845<_0x1fe2d8['length'];_0x18b845+=0x1){let _0x20edc7=_0x1fe2d8[_0x18b845];for(var _0x2d8581=0x0;_0x2d8581<_0x20edc7[_0x3860('0x7e')][_0x3860('0x4b')];_0x2d8581+=0x1){let _0x2d4744=_0x20edc7['Agents'][_0x2d8581];var _0x410bf4=_0xf91fc2[_0x3860('0x8c')]();_0x410bf4['where']('ut.UserId\x20=\x20?',_0x2d4744['id']);_0x41fd53[_0x3860('0x65')](db['sequelize'][_0x3860('0x35')](_0x410bf4[_0x3860('0x8d')](),{'type':db['sequelize'][_0x3860('0x8e')]['SELECT']})[_0x3860('0x28')](function(_0x4b8128){if(_0x4b8128[_0x3860('0x4b')]===0x1){return _0x2d4744['id'];}else{var _0x24788d=_[_0x3860('0x8f')](_[_0x3860('0x30')](_0x4b8128,'TeamId'),function(_0x25a8f7){return _[_0x3860('0x90')](_0x4f07f3,_0x25a8f7);});if(_0x24788d){return _0x2d4744['id'];}}}));}}return BPromise[_0x3860('0x91')](_0x41fd53)[_0x3860('0x28')](function(_0x4b7f2a){_0x5c196e=_(_0x5c196e)[_0x3860('0x92')](_0x4b7f2a)[_0x3860('0x93')]()['value']();return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x270ca1[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x514374){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0xd2167f){return _0x514374[_0x3860('0x86')](_0x270ca1['query'][_0x3860('0x72')],{'transaction':_0xd2167f})['then'](function(){if(!_['isEmpty'](_0x5c196e)){return _0x514374['removeAgents'](_0x5c196e,{'transaction':_0xd2167f});}})[_0x3860('0x28')](function(){_0x5c196e[_0x3860('0x94')](function(_0x1a6929){socket['emit'](_0x3860('0x77'),{'UserId':_0x1a6929,'VoicePrefixId':_0x514374['id']});});});});});});})['then'](respondWithStatusCode(_0xe24a1d,null))[_0x3860('0x47')](handleError(_0xe24a1d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 22f0bcc..f6ac2b8 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 _0x6fb5=['remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x4774d3,_0x35092f){var _0x519686=function(_0xbcc31a){while(--_0xbcc31a){_0x4774d3['push'](_0x4774d3['shift']());}};_0x519686(++_0x35092f);}(_0x6fb5,0x67));var _0x56fb=function(_0x563358,_0x4d245f){_0x563358=_0x563358-0x0;var _0x57431e=_0x6fb5[_0x563358];return _0x57431e;};'use strict';var EventEmitter=require(_0x56fb('0x0'));var VoicePrefix=require(_0x56fb('0x1'))['db'][_0x56fb('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x56fb('0x3')](0x0);var events={'afterCreate':_0x56fb('0x4'),'afterUpdate':'update','afterDestroy':_0x56fb('0x5')};function emitEvent(_0x1ade26){return function(_0x264a7d,_0x4ac5c7,_0x1c0d3d){VoicePrefixEvents[_0x56fb('0x6')](_0x1ade26+':'+_0x264a7d['id'],_0x264a7d);VoicePrefixEvents[_0x56fb('0x6')](_0x1ade26,_0x264a7d);_0x1c0d3d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x56fb('0x7')](e,emitEvent(event));}}module[_0x56fb('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xbe4d=['events','../../mysqldb','VoicePrefix','setMaxListeners','emit','hasOwnProperty'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xbe4d,0x15c));var _0xdbe4=function(_0x5d202f,_0x1ecb9a){_0x5d202f=_0x5d202f-0x0;var _0x5ae4ab=_0xbe4d[_0x5d202f];return _0x5ae4ab;};'use strict';var EventEmitter=require(_0xdbe4('0x0'));var VoicePrefix=require(_0xdbe4('0x1'))['db'][_0xdbe4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdbe4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x94139a){return function(_0x4b7998,_0x43a9ee,_0x22fcc6){VoicePrefixEvents['emit'](_0x94139a+':'+_0x4b7998['id'],_0x4b7998);VoicePrefixEvents[_0xdbe4('0x4')](_0x94139a,_0x4b7998);_0x22fcc6(null);};}for(var e in events){if(events[_0xdbe4('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a7070a7..7c02a27 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 _0xdc64=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','VoicePrefix','lodash','util'];(function(_0x328f3f,_0x136175){var _0xc76b5d=function(_0x5ec9e0){while(--_0x5ec9e0){_0x328f3f['push'](_0x328f3f['shift']());}};_0xc76b5d(++_0x136175);}(_0xdc64,0xb9));var _0x4dc6=function(_0x215c79,_0xf25903){_0x215c79=_0x215c79-0x0;var _0x34b239=_0xdc64[_0x215c79];return _0x34b239;};'use strict';var _=require(_0x4dc6('0x0'));var util=require(_0x4dc6('0x1'));var logger=require(_0x4dc6('0x2'))(_0x4dc6('0x3'));var moment=require(_0x4dc6('0x4'));var BPromise=require(_0x4dc6('0x5'));var rp=require(_0x4dc6('0x6'));var fs=require('fs');var path=require(_0x4dc6('0x7'));var rimraf=require(_0x4dc6('0x8'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x4dc6('0x9')]=function(_0xcdcbda,_0x39f60f){return _0xcdcbda['define'](_0x4dc6('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3d2=['voice_prefixes','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports'];(function(_0x2e29cb,_0x2100b1){var _0x2b3ef8=function(_0x12c97a){while(--_0x12c97a){_0x2e29cb['push'](_0x2e29cb['shift']());}};_0x2b3ef8(++_0x2100b1);}(_0xd3d2,0xe7));var _0x2d3d=function(_0x27acb6,_0x4c1f64){_0x27acb6=_0x27acb6-0x0;var _0x1135e8=_0xd3d2[_0x27acb6];return _0x1135e8;};'use strict';var _=require(_0x2d3d('0x0'));var util=require(_0x2d3d('0x1'));var logger=require(_0x2d3d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2d3d('0x3'));var rp=require(_0x2d3d('0x4'));var fs=require('fs');var path=require(_0x2d3d('0x5'));var rimraf=require(_0x2d3d('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d3d('0x7'));module[_0x2d3d('0x8')]=function(_0x2276cb,_0x2e6178){return _0x2276cb['define']('VoicePrefix',attributes,{'tableName':_0x2d3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index bec9254..af2b3eb 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 _0x67d1=['client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x516d0d,_0x38542a){var _0x232a04=function(_0x2012cd){while(--_0x2012cd){_0x516d0d['push'](_0x516d0d['shift']());}};_0x232a04(++_0x38542a);}(_0x67d1,0xf1));var _0x167d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x67d1[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x167d('0x0'));var moment=require(_0x167d('0x1'));var BPromise=require('bluebird');var rs=require(_0x167d('0x2'));var fs=require('fs');var Redis=require(_0x167d('0x3'));var db=require(_0x167d('0x4'))['db'];var utils=require(_0x167d('0x5'));var logger=require('../../config/logger')(_0x167d('0x6'));var config=require(_0x167d('0x7'));var jayson=require(_0x167d('0x8'));var client=jayson[_0x167d('0x9')]['http']({'port':0x232a});config[_0x167d('0xa')]=_['defaults'](config['redis'],{'host':_0x167d('0xb'),'port':0x18eb});var socket=require(_0x167d('0xc'))(new Redis(config[_0x167d('0xa')]));require(_0x167d('0xd'))[_0x167d('0xe')](socket);function respondWithRpcPromise(_0x43f58f,_0x3bcaab,_0x5904cb){return new BPromise(function(_0x326877,_0x238f44){return client[_0x167d('0xf')](_0x43f58f,_0x5904cb)[_0x167d('0x10')](function(_0x3f0609){logger[_0x167d('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x3bcaab,_0x167d('0x12'));logger['debug'](_0x167d('0x13'),_0x3bcaab,_0x167d('0x12'),JSON['stringify'](_0x3f0609));if(_0x3f0609[_0x167d('0x14')]){if(_0x3f0609[_0x167d('0x14')][_0x167d('0x15')]===0x1f4){logger[_0x167d('0x14')](_0x167d('0x16'),_0x3bcaab,_0x3f0609['error']['message']);return _0x238f44(_0x3f0609[_0x167d('0x14')][_0x167d('0x17')]);}logger[_0x167d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x3bcaab,_0x3f0609[_0x167d('0x14')]['message']);return _0x326877(_0x3f0609[_0x167d('0x14')]['message']);}else{logger[_0x167d('0x11')](_0x167d('0x16'),_0x3bcaab,_0x167d('0x12'));_0x326877(_0x3f0609['result'][_0x167d('0x17')]);}})[_0x167d('0x18')](function(_0xdbc186){logger['error'](_0x167d('0x16'),_0x3bcaab,_0xdbc186);_0x238f44(_0xdbc186);});});} \ No newline at end of file +var _0x7ee1=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','randomstring','ioredis'];(function(_0x5ec5dc,_0x576c6b){var _0x1396ea=function(_0x33552b){while(--_0x33552b){_0x5ec5dc['push'](_0x5ec5dc['shift']());}};_0x1396ea(++_0x576c6b);}(_0x7ee1,0x8d));var _0x17ee=function(_0x3cccf0,_0x5c0c81){_0x3cccf0=_0x3cccf0-0x0;var _0x1a913e=_0x7ee1[_0x3cccf0];return _0x1a913e;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});config[_0x17ee('0x9')]=_['defaults'](config[_0x17ee('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ee('0xa'))(new Redis(config[_0x17ee('0x9')]));require(_0x17ee('0xb'))['register'](socket);function respondWithRpcPromise(_0x4b6374,_0x4d6bb5,_0x17f935){return new BPromise(function(_0x4ee1e0,_0x155964){return client[_0x17ee('0xc')](_0x4b6374,_0x17f935)[_0x17ee('0xd')](function(_0x3d4f0f){logger['info'](_0x17ee('0xe'),_0x4d6bb5,'request\x20sent');logger[_0x17ee('0xf')](_0x17ee('0x10'),_0x4d6bb5,_0x17ee('0x11'),JSON[_0x17ee('0x12')](_0x3d4f0f));if(_0x3d4f0f[_0x17ee('0x13')]){if(_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x14')]===0x1f4){logger[_0x17ee('0x13')](_0x17ee('0xe'),_0x4d6bb5,_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x15')]);return _0x155964(_0x3d4f0f['error']['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4d6bb5,_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x15')]);return _0x4ee1e0(_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x15')]);}else{logger[_0x17ee('0x16')](_0x17ee('0xe'),_0x4d6bb5,_0x17ee('0x11'));_0x4ee1e0(_0x3d4f0f['result'][_0x17ee('0x15')]);}})[_0x17ee('0x17')](function(_0x215bc7){logger[_0x17ee('0x13')](_0x17ee('0xe'),_0x4d6bb5,_0x215bc7);_0x155964(_0x215bc7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 95cd9d0..fdddee8 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 _0xdbfc=['removeListener','length','voicePrefix:','./voicePrefix.events','save','emit'];(function(_0x4af3e8,_0x2eeb30){var _0x3aaf84=function(_0x21fd67){while(--_0x21fd67){_0x4af3e8['push'](_0x4af3e8['shift']());}};_0x3aaf84(++_0x2eeb30);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x5f0dcd,_0x582c76){_0x5f0dcd=_0x5f0dcd-0x0;var _0x1c336a=_0xdbfc[_0x5f0dcd];return _0x1c336a;};'use strict';var VoicePrefixEvents=require(_0xcdbf('0x0'));var events=[_0xcdbf('0x1'),'remove','update'];function createListener(_0x364647,_0x3067d8){return function(_0x3db24f){_0x3067d8[_0xcdbf('0x2')](_0x364647,_0x3db24f);};}function removeListener(_0x26c4cf,_0x1c2ce4){return function(){VoicePrefixEvents[_0xcdbf('0x3')](_0x26c4cf,_0x1c2ce4);};}exports['register']=function(_0x3ffa10){for(var _0x4129cf=0x0,_0x54aeaf=events[_0xcdbf('0x4')];_0x4129cf<_0x54aeaf;_0x4129cf++){var _0x3c077d=events[_0x4129cf];var _0x409a4e=createListener(_0xcdbf('0x5')+_0x3c077d,_0x3ffa10);VoicePrefixEvents['on'](_0x3c077d,_0x409a4e);}}; \ No newline at end of file +var _0x205d=['remove','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x5980bc,_0xb047d4){var _0x903b09=function(_0x1046c4){while(--_0x1046c4){_0x5980bc['push'](_0x5980bc['shift']());}};_0x903b09(++_0xb047d4);}(_0x205d,0xf6));var _0xd205=function(_0x23e9af,_0x29c52c){_0x23e9af=_0x23e9af-0x0;var _0x2c4f8b=_0x205d[_0x23e9af];return _0x2c4f8b;};'use strict';var VoicePrefixEvents=require(_0xd205('0x0'));var events=[_0xd205('0x1'),_0xd205('0x2'),'update'];function createListener(_0x4a640b,_0x1eaf09){return function(_0xbd11c7){_0x1eaf09[_0xd205('0x3')](_0x4a640b,_0xbd11c7);};}function removeListener(_0x4bc52b,_0xd8bd69){return function(){VoicePrefixEvents[_0xd205('0x4')](_0x4bc52b,_0xd8bd69);};}exports[_0xd205('0x5')]=function(_0x45a533){for(var _0x4c078b=0x0,_0x2614e7=events[_0xd205('0x6')];_0x4c078b<_0x2614e7;_0x4c078b++){var _0xdb99a8=events[_0x4c078b];var _0x372211=createListener(_0xd205('0x7')+_0xdb99a8,_0x45a533);VoicePrefixEvents['on'](_0xdb99a8,_0x372211);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a257ac9..8e2bfe4 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1deff2,_0x4a9388){var _0x5a651c=function(_0x502f06){while(--_0x502f06){_0x1deff2['push'](_0x1deff2['shift']());}};_0x5a651c(++_0x4a9388);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x199a9b,_0x383a60){var _0x4c4454=function(_0x126b5c){while(--_0x126b5c){_0x199a9b['push'](_0x199a9b['shift']());}};_0x4c4454(++_0x383a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 66555cb..409a65c 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 _0x43dc=['#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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','default','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','ringall','setDataValue','getDataValue','type','dialMethod','booked','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','preview','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x1fae05,_0x1503b5){var _0x41bf22=function(_0x2a6419){while(--_0x2a6419){_0x1fae05['push'](_0x1fae05['shift']());}};_0x41bf22(++_0x1503b5);}(_0x43dc,0x64));var _0xc43d=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x43dc[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0xc43d('0x0'));module[_0xc43d('0x1')]={'name':{'type':Sequelize[_0xc43d('0x2')],'allowNull':![],'unique':_0xc43d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc43d('0x4')]('inbound',_0xc43d('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':_0xc43d('0x6')},'announce':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc43d('0x4')]('rr','ringall',_0xc43d('0x7'),_0xc43d('0x8'),'random',_0xc43d('0x9'),'linear',_0xc43d('0xa'),_0xc43d('0xb')),'allowNull':![],'defaultValue':_0xc43d('0xc'),'set':function(_0x11e207){this[_0xc43d('0xd')]('strategy',_0x11e207?_0x11e207:_0xc43d('0x9'));},'get':function(){var _0x523ed2=this[_0xc43d('0xe')](_0xc43d('0xf'));var _0x98da14=this['getDataValue'](_0xc43d('0x10'));var _0x56759a=this['getDataValue']('strategy');if(_0x523ed2===_0xc43d('0x5')){if(_0x98da14==='preview'){return null;}if(_0x98da14===_0xc43d('0x11')&&![_0xc43d('0x9'),_0xc43d('0x12')][_0xc43d('0x13')](_0x56759a)){this[_0xc43d('0xd')]('strategy',_0xc43d('0x9'));}}return _0x56759a;}},'servicelevel':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc43d('0x14')](0xb)},'timeout':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc43d('0x2')]},'weight':{'type':Sequelize[_0xc43d('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':_0xc43d('0x15')},'autopause':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no',_0xc43d('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc43d('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc43d('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xc43d('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc43d('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc43d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0xc43d('0x15'),'no',_0xc43d('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc43d('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xc43d('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc43d('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc43d('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc43d('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc43d('0x2')]},'queue_quantity1':{'type':Sequelize[_0xc43d('0x2')]},'queue_quantity2':{'type':Sequelize[_0xc43d('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xc43d('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x722e79){this[_0xc43d('0xd')](_0xc43d('0x18'),_0x722e79?_0x722e79[_0xc43d('0x19')](','):[]);},'get':function(){return this[_0xc43d('0xe')](_0xc43d('0x18'))?this[_0xc43d('0xe')]('periodic_announce')[_0xc43d('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':_0xc43d('0x15'),'set':function(_0xf62251){this[_0xc43d('0xd')]('joinempty',_0xf62251?_0xf62251['join'](','):undefined);},'get':function(){return this[_0xc43d('0xe')]('joinempty')?this[_0xc43d('0xe')](_0xc43d('0x1b'))[_0xc43d('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':'no','set':function(_0x3e8071){this[_0xc43d('0xd')](_0xc43d('0x1c'),_0x3e8071?_0x3e8071['join'](','):undefined);},'get':function(){return this[_0xc43d('0xe')](_0xc43d('0x1c'))?this[_0xc43d('0xe')]('leavewhenempty')[_0xc43d('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xc43d('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc43d('0x2')]},'description':{'type':Sequelize[_0xc43d('0x2')]},'acw':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'set':function(_0x9b2a65){this[_0xc43d('0xd')]('acw',_0x9b2a65);if(_0x9b2a65){if(this[_0xc43d('0xe')](_0xc43d('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc43d('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x1f'),_0xc43d('0x20'),_0xc43d('0x21'),_0xc43d('0x22'),'booked'),'defaultValue':'progressive','comment':_0xc43d('0x23')},'dialLimitChannel':{'type':Sequelize[_0xc43d('0x14')](0x4)[_0xc43d('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xc43d('0x14')](0x4)[_0xc43d('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc43d('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xc43d('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc43d('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x27'),_0xc43d('0x28')),'defaultValue':_0xc43d('0x28'),'comment':_0xc43d('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc43d('0x2a')](0x2)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc43d('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc43d('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc43d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc43d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':'tTxX','comment':_0xc43d('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x2f')},'dialQueueProject':{'type':Sequelize[_0xc43d('0x2')],'comment':_0xc43d('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'comment':_0xc43d('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':_0xc43d('0x34')},'dialPrefix':{'type':Sequelize[_0xc43d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc43d('0x4')](_0xc43d('0x35'),_0xc43d('0x36'),_0xc43d('0x37')),'defaultValue':_0xc43d('0x35')},'dialAMDActive':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'comment':_0xc43d('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xc43d('0x14')](0x9)[_0xc43d('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc43d('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc43d('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc43d('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc43d('0x14')](0x9)[_0xc43d('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc43d('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc43d('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc43d('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xc43d('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc43d('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc43d('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc43d('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc43d('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc43d('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc43d('0x14')](0x9)[_0xc43d('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xc43d('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':0x0,'comment':_0xc43d('0x41')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc43d('0x42'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xc43d('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc43d('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc43d('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x46')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc43d('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc43d('0x14')](0x3)[_0xc43d('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc43d('0x14')](0x5)[_0xc43d('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc43d('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc43d('0x14')],'allowNull':!![],'comment':_0xc43d('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f517a){if(!_0x4f517a)this['setDataValue'](_0xc43d('0x4d'),null);this[_0xc43d('0xd')](_0xc43d('0x4e'),_0x4f517a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc43d('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc43d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc43d('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xabd1=['type','dialMethod','preview','booked','roundrobin','INTEGER','yes','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','UNSIGNED','Max\x209999\x20channels,\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)','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)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue'];(function(_0xa6eba4,_0x52ad7d){var _0x55a78c=function(_0x224e11){while(--_0x224e11){_0xa6eba4['push'](_0xa6eba4['shift']());}};_0x55a78c(++_0x52ad7d);}(_0xabd1,0x13c));var _0x1abd=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xabd1[_0xa3c06b];return _0x33aa1d;};'use strict';var Sequelize=require(_0x1abd('0x0'));module[_0x1abd('0x1')]={'name':{'type':Sequelize[_0x1abd('0x2')],'allowNull':![],'unique':_0x1abd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x5'),_0x1abd('0x6')),'allowNull':![],'defaultValue':_0x1abd('0x5')},'musiconhold':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x1abd('0x4')]('rr',_0x1abd('0x7'),'leastrecent',_0x1abd('0x8'),'random',_0x1abd('0x9'),_0x1abd('0xa'),_0x1abd('0xb'),_0x1abd('0xc')),'allowNull':![],'defaultValue':_0x1abd('0x7'),'set':function(_0x5bc30a){this[_0x1abd('0xd')](_0x1abd('0xe'),_0x5bc30a?_0x5bc30a:_0x1abd('0x9'));},'get':function(){var _0x274837=this[_0x1abd('0xf')](_0x1abd('0x10'));var _0x457a70=this[_0x1abd('0xf')](_0x1abd('0x11'));var _0x5c3225=this[_0x1abd('0xf')]('strategy');if(_0x274837===_0x1abd('0x6')){if(_0x457a70===_0x1abd('0x12')){return null;}if(_0x457a70===_0x1abd('0x13')&&!['rrmemory',_0x1abd('0x14')]['includes'](_0x5c3225)){this['setDataValue']('strategy','rrmemory');}}return _0x5c3225;}},'servicelevel':{'type':Sequelize[_0x1abd('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1abd('0x15')](0xb)},'timeout':{'type':Sequelize[_0x1abd('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1abd('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1abd('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1abd('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1abd('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1abd('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1abd('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1abd('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1abd('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1abd('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1abd('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1abd('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1abd('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1abd('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no'),'defaultValue':_0x1abd('0x16')},'announce_holdtime':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1abd('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x1abd('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x1abd('0x2')]},'queue_quantity2':{'type':Sequelize[_0x1abd('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x1abd('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x1abd('0x17')],'set':function(_0x556ad2){this[_0x1abd('0xd')](_0x1abd('0x18'),_0x556ad2?_0x556ad2[_0x1abd('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0x1abd('0x18'))?this[_0x1abd('0xf')](_0x1abd('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':'yes','set':function(_0x15708f){this[_0x1abd('0xd')](_0x1abd('0x1a'),_0x15708f?_0x15708f[_0x1abd('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x1abd('0x1a'))?this['getDataValue']('joinempty')[_0x1abd('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':'no','set':function(_0x4b9623){this[_0x1abd('0xd')](_0x1abd('0x1c'),_0x4b9623?_0x4b9623[_0x1abd('0x19')](','):undefined);},'get':function(){return this[_0x1abd('0xf')]('leavewhenempty')?this[_0x1abd('0xf')](_0x1abd('0x1c'))[_0x1abd('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1abd('0x2')]},'description':{'type':Sequelize[_0x1abd('0x2')]},'acw':{'type':Sequelize[_0x1abd('0x1d')],'defaultValue':0x0,'set':function(_0x2e81d6){this[_0x1abd('0xd')](_0x1abd('0x1e'),_0x2e81d6);if(_0x2e81d6){if(this['getDataValue']('wrapuptime')<0x2){this[_0x1abd('0xd')](_0x1abd('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1abd('0x1d')],'defaultValue':0x0,'comment':_0x1abd('0x20')},'dialMethod':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x12'),'progressive',_0x1abd('0x21'),_0x1abd('0x22'),'booked'),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1abd('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1abd('0x24')},'dialLimitQueue':{'type':Sequelize[_0x1abd('0x15')](0x4)[_0x1abd('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x1abd('0x25')](0x2)[_0x1abd('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1abd('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x1abd('0x27'),_0x1abd('0x28')),'defaultValue':_0x1abd('0x28'),'comment':_0x1abd('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1abd('0x25')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1abd('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1abd('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1abd('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1abd('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':_0x1abd('0x2d'),'comment':_0x1abd('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1abd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x1abd('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1abd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1abd('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1abd('0x15')](0x5)[_0x1abd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1abd('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1abd('0x23')],'defaultValue':0x3,'comment':_0x1abd('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1abd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1abd('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1abd('0x15')](0x3)[_0x1abd('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1abd('0x36')},'dialTimezone':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':_0x1abd('0x37')},'dialPrefix':{'type':Sequelize[_0x1abd('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1abd('0x4')]('always','never','onlyIfOpen'),'defaultValue':_0x1abd('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1abd('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x1abd('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1abd('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x1abd('0x15')](0x9)[_0x1abd('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1abd('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1abd('0x15')](0x9)[_0x1abd('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1abd('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1abd('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1abd('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x1abd('0x15')](0x9)[_0x1abd('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1abd('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1abd('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1abd('0x15')](0x9)[_0x1abd('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1abd('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1abd('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1abd('0x15')](0x9)[_0x1abd('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x1abd('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1abd('0x40')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1abd('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1abd('0x4')](_0x1abd('0x42'),_0x1abd('0x43')),'defaultValue':_0x1abd('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x1abd('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1abd('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1abd('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1abd('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1abd('0x44')},'dialCutDigit':{'type':Sequelize[_0x1abd('0x15')](0x3)[_0x1abd('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1abd('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1abd('0x15')](0x3)[_0x1abd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1abd('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1abd('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x1abd('0x15')](0x3)[_0x1abd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1abd('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1abd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1abd('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1abd('0x4b')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1abd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1abd('0x15')](0x5)[_0x1abd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1abd('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1abd('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1abd('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1abd('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1abd('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x1abd('0x1d')],'defaultValue':![],'comment':_0x1abd('0x50'),'set':function(_0x2eea77){if(!_0x2eea77)this[_0x1abd('0xd')](_0x1abd('0x51'),null);this[_0x1abd('0xd')](_0x1abd('0x52'),_0x2eea77);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1abd('0x15')](0x3)[_0x1abd('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1abd('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1abd('0x15')](0x3)[_0x1abd('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1abd('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index dc01670..6fd654f 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 _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0xeb80bc,_0xcfc513){var _0x4845a5=function(_0xacaca8){while(--_0xacaca8){_0xeb80bc['push'](_0xeb80bc['shift']());}};_0x4845a5(++_0xcfc513);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file +var _0xf3cd=['CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','forEach','emit','removeTeams','Team','ids','select','field','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','name','UserProfileResource','VoiceQueue','fieldName','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','options','find','create','body','user','role','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','merge','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','order','sort','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x48f57e,_0x2ee67c){var _0x147a86=function(_0xd1d86c){while(--_0xd1d86c){_0x48f57e['push'](_0x48f57e['shift']());}};_0x147a86(++_0x2ee67c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0xf3cd[_0x2b2c53];return _0x311ec2;};'use strict';var moment=require(_0xdf3c('0x0'));var BPromise=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var _=require(_0xdf3c('0x3'));var squel=require(_0xdf3c('0x4'));var Redis=require(_0xdf3c('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x6'))(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x9')]=_[_0xdf3c('0xa')](config[_0xdf3c('0x9')],{'host':_0xdf3c('0xb'),'port':0x18eb});var socket=require(_0xdf3c('0xc'))(new Redis(config[_0xdf3c('0x9')]));require('./voiceQueue.socket')[_0xdf3c('0xd')](socket);function respondWithStatusCode(_0x52cf30,_0x52f855){_0x52f855=_0x52f855||0xcc;return function(_0x22d8ae){if(_0x22d8ae){return _0x52cf30[_0xdf3c('0xe')](_0x52f855);}return _0x52cf30['status'](_0x52f855)[_0xdf3c('0xf')]();};}function respondWithResult(_0x205f33,_0x2d420c){_0x2d420c=_0x2d420c||0xc8;return function(_0x21a6e5){if(_0x21a6e5){return _0x205f33[_0xdf3c('0x10')](_0x2d420c)[_0xdf3c('0x11')](_0x21a6e5);}};}function respondWithFilteredResult(_0xf7da9d,_0x32d2db){return function(_0x5e8925){if(_0x5e8925){var _0x1d483c=typeof _0x32d2db[_0xdf3c('0x12')]===_0xdf3c('0x13')&&typeof _0x32d2db[_0xdf3c('0x14')]==='undefined';var _0x2ae4ad=_0x5e8925[_0xdf3c('0x15')];var _0x13ea5f=_0x1d483c?0x0:_0x32d2db['offset'];var _0x18aafa=_0x1d483c?_0x5e8925[_0xdf3c('0x15')]:_0x32d2db[_0xdf3c('0x12')]+_0x32d2db[_0xdf3c('0x14')];var _0x21e587;if(_0x18aafa>=_0x2ae4ad){_0x18aafa=_0x2ae4ad;_0x21e587=0xc8;}else{_0x21e587=0xce;}_0xf7da9d[_0xdf3c('0x10')](_0x21e587);return _0xf7da9d[_0xdf3c('0x16')](_0xdf3c('0x17'),_0x13ea5f+'-'+_0x18aafa+'/'+_0x2ae4ad)[_0xdf3c('0x11')](_0x5e8925);}return null;};}function saveUpdates(_0x5d3991){return function(_0x54cdd4){if(_0x54cdd4){return _0x54cdd4[_0xdf3c('0x18')](_0x5d3991)[_0xdf3c('0x19')](function(_0xf1da1f){return _0xf1da1f;});}return null;};}function removeEntity(_0x18d4ec){return function(_0x1e2690){if(_0x1e2690){return _0x1e2690[_0xdf3c('0x1a')]()[_0xdf3c('0x19')](function(){var _0x3ee0af=_0x1e2690[_0xdf3c('0x1b')]({'plain':!![]});var _0x18fb5f=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d'),'ignore':![]},{'name':_0xdf3c('0x1e'),'value':'outbound','ignore':![]}];var _0x4d620f=_(_0x18fb5f)[_0xdf3c('0x1f')]('ignore')[_0xdf3c('0x20')](_0xdf3c('0x21'))[_0xdf3c('0x21')]();if(_[_0xdf3c('0x22')](_0x4d620f,_0x3ee0af[_0xdf3c('0x23')])){return;}var _0x36ba1c=_['find'](_0x18fb5f,[_0xdf3c('0x21'),_0x3ee0af[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x25')][_0xdf3c('0x1a')]({'where':{'type':_0x36ba1c,'resourceId':_0x3ee0af['id']}})[_0xdf3c('0x19')](function(){return _0x1e2690;});})[_0xdf3c('0x19')](function(){_0x18d4ec[_0xdf3c('0x10')](0xcc)[_0xdf3c('0xf')]();});}};}function handleEntityNotFound(_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x1adee4[_0xdf3c('0xe')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x24')];}_0x153daa[_0xdf3c('0x10')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={};var _0x1ccdd4={'count':0x0,'rows':[]};var _0x5c98a2=_[_0xdf3c('0x20')](db[_0xdf3c('0x26')]['rawAttributes'],function(_0x51e0a4){return{'name':_0x51e0a4[_0xdf3c('0x27')],'type':_0x51e0a4[_0xdf3c('0x23')][_0xdf3c('0x28')]};});_0xd3cfcb=qs['getOptions'](_0x5c98a2,_0x37ecfd);var _0x2355f6={'where':_0xd3cfcb[_0xdf3c('0x29')]};return db[_0xdf3c('0x26')][_0xdf3c('0x15')](_0x2355f6)['then'](function(_0xda0de0){_0x1ccdd4[_0xdf3c('0x15')]=_0xda0de0;_0xd3cfcb['include']=qs[_0xdf3c('0x2a')](_0x37ecfd[_0xdf3c('0x2b')]);return db[_0xdf3c('0x26')][_0xdf3c('0x2c')](_0xd3cfcb);})['then'](function(_0x33632f){_0x1ccdd4[_0xdf3c('0x2d')]=_0x33632f;return _0x1ccdd4;})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x2e')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x474564,_0x3e7a4b){var _0x5ddd21={'raw':![],'where':{'id':_0x474564[_0xdf3c('0x2f')]['id']}},_0x4f68f9={};_0x4f68f9['model']=_[_0xdf3c('0x30')](db['VoiceQueue']['rawAttributes']);_0x4f68f9['query']=_[_0xdf3c('0x30')](_0x474564[_0xdf3c('0x2b')]);_0x4f68f9[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4f68f9['model'],_0x4f68f9['query']);_0x5ddd21[_0xdf3c('0x33')]=_['intersection'](_0x4f68f9[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x474564[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5ddd21[_0xdf3c('0x33')]=_0x5ddd21[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5ddd21[_0xdf3c('0x33')]:_0x4f68f9[_0xdf3c('0x34')];if(_0x474564['query'][_0xdf3c('0x37')]){_0x5ddd21['include']=[{'all':!![]}];}_0x5ddd21=_['merge']({},_0x5ddd21,_0x474564[_0xdf3c('0x38')]);return db['VoiceQueue'][_0xdf3c('0x39')](_0x5ddd21)['then'](handleEntityNotFound(_0x3e7a4b,null))[_0xdf3c('0x19')](respondWithResult(_0x3e7a4b,null))[_0xdf3c('0x2e')](handleError(_0x3e7a4b,null));};exports[_0xdf3c('0x3a')]=function(_0x1349a4,_0x3098cb){return db[_0xdf3c('0x26')][_0xdf3c('0x3a')](_0x1349a4[_0xdf3c('0x3b')],{})[_0xdf3c('0x19')](function(_0xa65478){var _0x424acf=_0x1349a4[_0xdf3c('0x3c')]['get']({'plain':!![]});if(!_0x424acf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424acf[_0xdf3c('0x3d')]==='user'){var _0x3a6527=_0xa65478[_0xdf3c('0x1b')]({'plain':!![]});var _0x46194d=[{'name':_0xdf3c('0x1c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xdf3c('0x3e')}];var _0x33edab=_[_0xdf3c('0x39')](_0x46194d,['value',_0x3a6527[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x3f')][_0xdf3c('0x39')]({'where':{'name':_0x33edab,'userProfileId':_0x424acf['userProfileId']},'raw':!![]})[_0xdf3c('0x19')](function(_0x3e9be9){if(_0x3e9be9&&_0x3e9be9[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')][_0xdf3c('0x3a')]({'name':_0x3a6527['name'],'resourceId':_0x3a6527['id'],'type':_0x3e9be9[_0xdf3c('0x24')],'sectionId':_0x3e9be9['id']},{})[_0xdf3c('0x19')](function(){return _0xa65478;});}else{return _0xa65478;}})[_0xdf3c('0x2e')](function(_0x2456cf){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x2456cf);throw _0x2456cf;});}return _0xa65478;})['then'](respondWithResult(_0x3098cb,0xc9))['catch'](handleError(_0x3098cb,null));};exports[_0xdf3c('0x43')]=function(_0x2be86d,_0x5a4443){var _0x5c9885={'where':{'id':_0x2be86d[_0xdf3c('0x2f')]['id']}},_0x269723={};_0x269723[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x26')][_0xdf3c('0x44')]);_0x5c9885[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x269723[_0xdf3c('0x34')],qs['fields'](_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5c9885[_0xdf3c('0x33')]=_0x5c9885[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5c9885[_0xdf3c('0x33')]:_0x269723[_0xdf3c('0x34')];if(_0x2be86d['query'][_0xdf3c('0x37')]){_0x5c9885['include']=[{'all':!![]}];}_0x5c9885=_[_0xdf3c('0x45')]({},_0x5c9885,_0x2be86d['options']);return db[_0xdf3c('0x26')][_0xdf3c('0x39')](_0x5c9885)[_0xdf3c('0x19')](handleEntityNotFound(_0x5a4443,null))[_0xdf3c('0x19')](function(_0x5eef94){if(_0x5eef94){var _0x55da0f=_0x5eef94['get']({'plain':!![]});_0x55da0f=qs[_0xdf3c('0x46')](_0x55da0f,['id','createdAt',_0xdf3c('0x47')]);_0x2be86d[_0xdf3c('0x3b')]=_[_0xdf3c('0x46')](_0x2be86d[_0xdf3c('0x3b')],['id',_0xdf3c('0x48'),'updatedAt']);return db['VoiceQueue'][_0xdf3c('0x3a')](_[_0xdf3c('0x45')](_0x55da0f,_0x2be86d['body']),{'include':_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x37')]?[{'all':!![]}]:undefined})[_0xdf3c('0x19')](function(_0x3fda0a){var _0x38de63=_0x2be86d[_0xdf3c('0x3c')][_0xdf3c('0x1b')]({'plain':!![]});if(!_0x38de63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38de63['role']===_0xdf3c('0x3c')){var _0x28030e=_0x3fda0a[_0xdf3c('0x1b')]({'plain':!![]});var _0x1ad771=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d')},{'name':_0xdf3c('0x1e'),'value':_0xdf3c('0x3e')}];var _0x143d01=_[_0xdf3c('0x39')](_0x1ad771,[_0xdf3c('0x21'),_0x28030e['type']])[_0xdf3c('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x143d01,'userProfileId':_0x38de63['userProfileId']},'raw':!![]})['then'](function(_0x541c57){if(_0x541c57&&_0x541c57[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')]['create']({'name':_0x28030e[_0xdf3c('0x24')],'resourceId':_0x28030e['id'],'type':_0x541c57[_0xdf3c('0x24')],'sectionId':_0x541c57['id']},{})['then'](function(){return _0x3fda0a;});}else{return _0x3fda0a;}})[_0xdf3c('0x2e')](function(_0x28f935){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x28f935);throw _0x28f935;});}return _0x3fda0a;});}})[_0xdf3c('0x19')](respondWithResult(_0x5a4443,0xc9))[_0xdf3c('0x2e')](handleError(_0x5a4443,null));};exports[_0xdf3c('0x18')]=function(_0xdc859,_0x42efa2){if(_0xdc859[_0xdf3c('0x3b')]['id']){delete _0xdc859[_0xdf3c('0x3b')]['id'];}return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xdc859[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x42efa2,null))['then'](saveUpdates(_0xdc859[_0xdf3c('0x3b')],null))[_0xdf3c('0x19')](respondWithResult(_0x42efa2,null))[_0xdf3c('0x2e')](handleError(_0x42efa2,null));};exports['destroy']=function(_0x1effdb,_0x13bf69){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x1effdb['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x13bf69,null))[_0xdf3c('0x19')](removeEntity(_0x13bf69,null))[_0xdf3c('0x2e')](handleError(_0x13bf69,null));};exports[_0xdf3c('0x49')]=function(_0xed2a78,_0x30e6e1){var _0x3fca95={'raw':![],'where':{}};var _0x2a1559={};var _0x2922d8={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xed2a78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30e6e1,null))[_0xdf3c('0x19')](function(_0x204110){if(_0x204110){_0x2a1559[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmHopper']['rawAttributes']);_0x2a1559[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0xed2a78[_0xdf3c('0x2b')]);_0x2a1559['filters']=_[_0xdf3c('0x32')](_0x2a1559['model'],_0x2a1559['query']);_0x3fca95[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x2a1559[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x3fca95[_0xdf3c('0x33')]=_0x3fca95[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x3fca95[_0xdf3c('0x33')]:_0x2a1559[_0xdf3c('0x34')];if(!_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4b')]('nolimit')){_0x3fca95[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x3fca95[_0xdf3c('0x12')]=qs['offset'](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x3fca95[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x3fca95[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xed2a78[_0xdf3c('0x2b')],_0x2a1559['filters']));_0x3fca95[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x204110['id'];if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x3fca95[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x3fca95[_0xdf3c('0x29')],{'$or':_['map'](_0x3fca95[_0xdf3c('0x33')],function(_0x662fd5){var _0x4e1b77={};_0x4e1b77[_0x662fd5]={'$like':'%'+_0xed2a78['query'][_0xdf3c('0x1f')]+'%'};return _0x4e1b77;})});}_0x3fca95=_[_0xdf3c('0x45')]({},_0x3fca95,_0xed2a78[_0xdf3c('0x38')]);return db[_0xdf3c('0x50')][_0xdf3c('0x15')]({'where':_0x3fca95[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x38af90){_0x2922d8['count']=_0x38af90;if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x3fca95[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopper'][_0xdf3c('0x2c')](_0x3fca95);})[_0xdf3c('0x19')](function(_0x43d299){_0x2922d8['rows']=_0x43d299;return _0x2922d8;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x30e6e1,_0x3fca95))[_0xdf3c('0x2e')](handleError(_0x30e6e1,null));};exports[_0xdf3c('0x51')]=function(_0x1b279f,_0xe01538){var _0x12f737={'raw':!![],'where':{}};var _0x560348={};var _0x50753f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1b279f['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xe01538,null))[_0xdf3c('0x19')](function(_0xf66fae){if(_0xf66fae){_0x560348['model']=_[_0xdf3c('0x30')](db[_0xdf3c('0x52')][_0xdf3c('0x44')]);_0x560348['query']=_['keys'](_0x1b279f[_0xdf3c('0x2b')]);_0x560348['filters']=_[_0xdf3c('0x32')](_0x560348['model'],_0x560348[_0xdf3c('0x2b')]);_0x12f737[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x560348[_0xdf3c('0x34')],qs['fields'](_0x1b279f['query'][_0xdf3c('0x35')]));_0x12f737[_0xdf3c('0x33')]=_0x12f737[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x12f737[_0xdf3c('0x33')]:_0x560348[_0xdf3c('0x34')];if(!_0x1b279f['query'][_0xdf3c('0x4b')]('nolimit')){_0x12f737[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x12f737[_0xdf3c('0x12')]=qs['offset'](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x12f737[_0xdf3c('0x4c')]=qs['sort'](_0x1b279f['query']['sort']);_0x12f737['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1b279f[_0xdf3c('0x2b')],_0x560348[_0xdf3c('0x31')]));_0x12f737[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0xf66fae['id'];if(_0x1b279f['query'][_0xdf3c('0x1f')]){_0x12f737['where']=_[_0xdf3c('0x45')](_0x12f737[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x12f737[_0xdf3c('0x33')],function(_0x320452){var _0x3a221d={};_0x3a221d[_0x320452]={'$like':'%'+_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x3a221d;})});}_0x12f737=_[_0xdf3c('0x45')]({},_0x12f737,_0x1b279f[_0xdf3c('0x38')]);return db[_0xdf3c('0x52')][_0xdf3c('0x15')]({'where':_0x12f737[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x55fd73){_0x50753f[_0xdf3c('0x15')]=_0x55fd73;if(_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x12f737[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf3c('0x2c')](_0x12f737);})[_0xdf3c('0x19')](function(_0x54b7b8){_0x50753f['rows']=_0x54b7b8;return _0x50753f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0xe01538,_0x12f737))[_0xdf3c('0x2e')](handleError(_0xe01538,null));};exports[_0xdf3c('0x53')]=function(_0x1aaf8b,_0x44dd2a){var _0x56fc77={'raw':!![],'where':{}};var _0x50105b={};var _0x471d8f={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1aaf8b[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x44dd2a,null))['then'](function(_0x30235e){if(_0x30235e){_0x50105b[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x54')][_0xdf3c('0x44')]);_0x50105b['query']=_['keys'](_0x1aaf8b['query']);_0x50105b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],_0x50105b[_0xdf3c('0x2b')]);_0x56fc77[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1aaf8b['query'][_0xdf3c('0x35')]));_0x56fc77[_0xdf3c('0x33')]=_0x56fc77[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x56fc77[_0xdf3c('0x33')]:_0x50105b[_0xdf3c('0x34')];if(!_0x1aaf8b['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x56fc77['limit']=qs['limit'](_0x1aaf8b[_0xdf3c('0x2b')]['limit']);_0x56fc77[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1aaf8b['query'][_0xdf3c('0x12')]);}_0x56fc77[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x56fc77[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x1aaf8b[_0xdf3c('0x2b')],_0x50105b[_0xdf3c('0x31')]));_0x56fc77[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x30235e['id'];if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x56fc77['where']=_['merge'](_0x56fc77[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x56fc77[_0xdf3c('0x33')],function(_0x5b6419){var _0x38c374={};_0x38c374[_0x5b6419]={'$like':'%'+_0x1aaf8b['query']['filter']+'%'};return _0x38c374;})});}_0x56fc77=_[_0xdf3c('0x45')]({},_0x56fc77,_0x1aaf8b[_0xdf3c('0x38')]);return db['CmHopperFinal'][_0xdf3c('0x15')]({'where':_0x56fc77['where']})[_0xdf3c('0x19')](function(_0x4b35ff){_0x471d8f[_0xdf3c('0x15')]=_0x4b35ff;if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x56fc77[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x54')][_0xdf3c('0x2c')](_0x56fc77);})[_0xdf3c('0x19')](function(_0x2dc0d2){_0x471d8f[_0xdf3c('0x2d')]=_0x2dc0d2;return _0x471d8f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x44dd2a,_0x56fc77))[_0xdf3c('0x2e')](handleError(_0x44dd2a,null));};exports[_0xdf3c('0x56')]=function(_0x10528d,_0x1acc47){var _0x5b3aa5={'raw':!![],'where':{}};var _0x3cf465={};var _0x22bacf={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x10528d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x1acc47,null))[_0xdf3c('0x19')](function(_0x6e1899){if(_0x6e1899){_0x3cf465[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x57')][_0xdf3c('0x44')]);_0x3cf465[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x10528d[_0xdf3c('0x2b')]);_0x3cf465['filters']=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],_0x3cf465[_0xdf3c('0x2b')]);_0x5b3aa5[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5b3aa5[_0xdf3c('0x33')]=_0x5b3aa5[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5b3aa5['attributes']:_0x3cf465[_0xdf3c('0x34')];if(!_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x5b3aa5[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x10528d[_0xdf3c('0x2b')]['limit']);_0x5b3aa5[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x5b3aa5['order']=qs[_0xdf3c('0x4d')](_0x10528d[_0xdf3c('0x2b')]['sort']);_0x5b3aa5[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x10528d[_0xdf3c('0x2b')],_0x3cf465['filters']));_0x5b3aa5[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x6e1899['id'];if(_0x10528d[_0xdf3c('0x2b')]['filter']){_0x5b3aa5['where']=_[_0xdf3c('0x45')](_0x5b3aa5['where'],{'$or':_[_0xdf3c('0x20')](_0x5b3aa5[_0xdf3c('0x33')],function(_0x161604){var _0x91dd6e={};_0x91dd6e[_0x161604]={'$like':'%'+_0x10528d['query'][_0xdf3c('0x1f')]+'%'};return _0x91dd6e;})});}_0x5b3aa5=_[_0xdf3c('0x45')]({},_0x5b3aa5,_0x10528d['options']);return db[_0xdf3c('0x57')]['count']({'where':_0x5b3aa5[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x5429b6){_0x22bacf['count']=_0x5429b6;if(_0x10528d[_0xdf3c('0x2b')]['includeAll']){_0x5b3aa5[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x57')][_0xdf3c('0x2c')](_0x5b3aa5);})[_0xdf3c('0x19')](function(_0x19a723){_0x22bacf[_0xdf3c('0x2d')]=_0x19a723;return _0x22bacf;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1acc47,_0x5b3aa5))[_0xdf3c('0x2e')](handleError(_0x1acc47,null));};exports[_0xdf3c('0x58')]=function(_0x3d8ff0,_0x2a2f03){var _0x55975e={};var _0x4299d1={};var _0x132c27;var _0x52a641;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x3d8ff0[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2a2f03,null))[_0xdf3c('0x19')](function(_0x12576e){if(_0x12576e){_0x132c27=_0x12576e;_0x4299d1['model']=_[_0xdf3c('0x30')](db['Team'][_0xdf3c('0x44')]);_0x4299d1[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x3d8ff0[_0xdf3c('0x2b')]);_0x4299d1[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4299d1['model'],_0x4299d1[_0xdf3c('0x2b')]);_0x55975e[_0xdf3c('0x33')]=_['intersection'](_0x4299d1[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x55975e[_0xdf3c('0x33')]=_0x55975e[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x55975e[_0xdf3c('0x33')]:_0x4299d1['model'];_0x55975e['order']=qs[_0xdf3c('0x4d')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x55975e[_0xdf3c('0x29')]=qs['filters'](_['pick'](_0x3d8ff0[_0xdf3c('0x2b')],_0x4299d1['filters']));if(_0x3d8ff0[_0xdf3c('0x2b')]['filter']){_0x55975e[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x55975e[_0xdf3c('0x29')],{'$or':_['map'](_0x55975e[_0xdf3c('0x33')],function(_0x142cd0){var _0x5bf9a9={};_0x5bf9a9[_0x142cd0]={'$like':'%'+_0x3d8ff0['query'][_0xdf3c('0x1f')]+'%'};return _0x5bf9a9;})});}_0x55975e=_[_0xdf3c('0x45')]({},_0x55975e,_0x3d8ff0[_0xdf3c('0x38')]);return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x294682){if(_0x294682){_0x52a641=_0x294682[_0xdf3c('0x36')];if(!_0x3d8ff0['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x55975e[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x55975e[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x322cf5){if(_0x322cf5){return _0x322cf5?{'count':_0x52a641,'rows':_0x322cf5}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x2a2f03,null))[_0xdf3c('0x2e')](handleError(_0x2a2f03,null));};exports[_0xdf3c('0x59')]=function(_0x199ff0,_0x244bf0){var _0x1a0d61=_0x199ff0[_0xdf3c('0x3b')]['teams'];var _0x4c6615=_[_0xdf3c('0x20')](_0x1a0d61,'id');return db['Team']['findAll']({'where':{'id':_0x4c6615},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':'Agents','attributes':['id',_0xdf3c('0x24'),_0xdf3c('0x5b'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1c7b50){if(_0x1c7b50){var _0x3e0a0f=_[_0xdf3c('0x5c')](_0x1c7b50,function(_0x4d5216){var _0x197b8a=_0x4d5216['get']({'plain':!![]});_0x197b8a[_0xdf3c('0x5d')]['forEach'](function(_0x5b0101){_0x5b0101[_0xdf3c('0x5e')]=_[_0xdf3c('0x39')](_0x1a0d61,{'id':_0x197b8a['id']})[_0xdf3c('0x5e')];});return _0x197b8a[_0xdf3c('0x5d')];});return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x199ff0['params']['id']}})['then'](function(_0x128a4e){return db['sequelize'][_0xdf3c('0x5f')](function(_0x14244a){return _0x128a4e[_0xdf3c('0x59')](_0x4c6615,{'transaction':_0x14244a})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x1a0d61,function(_0x619c66){return db[_0xdf3c('0x61')]['upsert']({'TeamId':_0x619c66['id'],'VoiceQueueId':_0x199ff0['params']['id'],'penalty':_0x619c66[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x3e0a0f,function(_0x13a882){return db['UserVoiceQueue'][_0xdf3c('0x62')]({'where':{'UserId':_0x13a882['id'],'VoiceQueueId':_0x199ff0[_0xdf3c('0x2f')]['id']},'defaults':{'penalty':_0x13a882[_0xdf3c('0x5e')]},'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_[_0xdf3c('0x1f')](_0x3e0a0f,{'online':!![]}),function(_0x524482){return db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x524482['name'],'UserId':_0x524482['id'],'queue_name':_0x128a4e[_0xdf3c('0x24')],'VoiceQueueId':_0x128a4e['id'],'interface':_[_0xdf3c('0x65')](_0x524482[_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x524482[_0xdf3c('0x24')]):_0x524482[_0xdf3c('0x66')],'paused':_0x524482[_0xdf3c('0x68')]||![],'penalty':_0x524482[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){_0x3e0a0f[_0xdf3c('0x69')](function(_0x12ffd3){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':_0x12ffd3['id'],'VoiceQueueId':_0x128a4e['id']});});});});});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x244bf0,null))['catch'](handleError(_0x244bf0,null));};exports[_0xdf3c('0x6b')]=function(_0x160568,_0xfcf42f){return db[_0xdf3c('0x6c')][_0xdf3c('0x2c')]({'where':{'id':_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':_0xdf3c('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xdf3c('0x19')](handleEntityNotFound(_0xfcf42f,null))[_0xdf3c('0x19')](function(_0x5f09a0){var _0x379996=_[_0xdf3c('0x20')](_0x5f09a0,'id');var _0x5f1b51=[];var _0x323058=[];var _0x8fd9e4=squel[_0xdf3c('0x6e')]();_0x8fd9e4[_0xdf3c('0x6f')]('tq.TeamId')[_0xdf3c('0x70')](_0xdf3c('0x71'),'tq')[_0xdf3c('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xdf3c('0x73'),_0x160568[_0xdf3c('0x2f')]['id']);for(var _0x403ac5=0x0;_0x403ac5<_0x5f09a0[_0xdf3c('0x36')];_0x403ac5+=0x1){let _0x44d862=_0x5f09a0[_0x403ac5];for(var _0x33132b=0x0;_0x33132b<_0x44d862[_0xdf3c('0x5d')][_0xdf3c('0x36')];_0x33132b+=0x1){let _0x49c29e=_0x44d862[_0xdf3c('0x5d')][_0x33132b];var _0x5e868a=_0x8fd9e4[_0xdf3c('0x43')]();_0x5e868a[_0xdf3c('0x29')](_0xdf3c('0x74'),_0x49c29e['id']);_0x323058[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x5e868a['toString'](),{'type':db[_0xdf3c('0x76')][_0xdf3c('0x77')]['SELECT']})[_0xdf3c('0x19')](function(_0x270353){if(_0x270353[_0xdf3c('0x36')]===0x1){return _0x49c29e['id'];}else{var _0x3f6df9=_['every'](_[_0xdf3c('0x20')](_0x270353,'TeamId'),function(_0x7d9a0f){return _[_0xdf3c('0x22')](_0x379996,_0x7d9a0f);});if(_0x3f6df9){return _0x49c29e['id'];}}}));}}return BPromise[_0xdf3c('0x78')](_0x323058)[_0xdf3c('0x19')](function(_0x17669f){_0x5f1b51=_(_0x5f1b51)[_0xdf3c('0x79')](_0x17669f)['compact']()['value']();return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x160568[_0xdf3c('0x2f')]['id']}})['then'](function(_0x528c97){return db[_0xdf3c('0x76')]['transaction'](function(_0x58a2d8){return _0x528c97['removeTeams'](_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')],{'transaction':_0x58a2d8})[_0xdf3c('0x19')](function(){if(!_['isEmpty'](_0x5f1b51)){return _0x528c97[_0xdf3c('0x7a')](_0x5f1b51,{'transaction':_0x58a2d8})['then'](function(){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x160568[_0xdf3c('0x2f')]['id'],'UserId':_0x5f1b51},'transaction':_0x58a2d8});});}})[_0xdf3c('0x19')](function(){_0x5f1b51[_0xdf3c('0x69')](function(_0x467090){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':_0x467090,'VoiceQueueId':_0x528c97['id']});});});});});});})[_0xdf3c('0x19')](respondWithStatusCode(_0xfcf42f,null))['catch'](handleError(_0xfcf42f,null));};exports[_0xdf3c('0x7c')]=function(_0x4652af,_0x5e08bc){var _0x2702ca,_0x1e8646;return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x4652af['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x5e08bc,null))[_0xdf3c('0x19')](function(_0x3ea47d){if(_0x3ea47d){_0x1e8646=_0x3ea47d;return _0x3ea47d[_0xdf3c('0x7c')](_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x4652af[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{})[_0xdf3c('0x7d')](function(_0xfdb4e2){for(var _0x1c31ee=0x0;_0x1c31ee<_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x1c31ee+=0x1){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':Number(_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0x1c31ee]),'VoiceQueueId':Number(_0x4652af['params']['id'])});}return _0xfdb4e2;});}})[_0xdf3c('0x19')](function(_0xf39067){_0x2702ca=_0xf39067||[];if(_0x1e8646){return db[_0xdf3c('0x5a')][_0xdf3c('0x2c')]({'where':{'id':_0x4652af['body'][_0xdf3c('0x6d')]},'attributes':['id',_0xdf3c('0x24'),'online',_0xdf3c('0x68'),_0xdf3c('0x66')],'raw':!![]});}})['then'](function(_0x59c8f9){if(!_[_0xdf3c('0x7e')](_0x59c8f9)){var _0x388f8d=[];for(var _0x1c4964=0x0;_0x1c4964<_0x59c8f9['length'];_0x1c4964++){if(_0x59c8f9[_0x1c4964][_0xdf3c('0x5b')]){_0x388f8d['push'](db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x59c8f9[_0x1c4964][_0xdf3c('0x24')],'UserId':_0x59c8f9[_0x1c4964]['id'],'queue_name':_0x1e8646[_0xdf3c('0x24')],'VoiceQueueId':_0x1e8646['id'],'interface':_[_0xdf3c('0x65')](_0x59c8f9[_0x1c4964][_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x59c8f9[_0x1c4964]['name']):_0x59c8f9[_0x1c4964][_0xdf3c('0x66')],'paused':_0x59c8f9[_0x1c4964][_0xdf3c('0x68')]||![],'penalty':_0x4652af[_0xdf3c('0x3b')]['penalty']||0x0}));}}return BPromise[_0xdf3c('0x78')](_0x388f8d);}})['then'](function(){return _0x2702ca;})[_0xdf3c('0x19')](respondWithResult(_0x5e08bc,null))[_0xdf3c('0x2e')](handleError(_0x5e08bc,null));};exports['removeAgents']=function(_0x153bce,_0x4185f0){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x153bce['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4185f0,null))[_0xdf3c('0x19')](function(_0xa61c3f){if(_0xa61c3f){return _0xa61c3f[_0xdf3c('0x7a')](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])[_0xdf3c('0x19')](function(){if(_['isArray'](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])){for(var _0x26251d=0x0;_0x26251d<_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x26251d+=0x1){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0x26251d]),'VoiceQueueId':Number(_0x153bce[_0xdf3c('0x2f')]['id'])});}}else{socket['emit'](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')]),'VoiceQueueId':Number(_0x153bce['params']['id'])});}});}})[_0xdf3c('0x19')](function(_0x109153){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x153bce[_0xdf3c('0x2f')]['id'],'UserId':_0x153bce['query'][_0xdf3c('0x6d')]}})[_0xdf3c('0x19')](function(){return _0x109153;});})['then'](respondWithStatusCode(_0x4185f0,null))[_0xdf3c('0x2e')](handleError(_0x4185f0,null));};exports[_0xdf3c('0x7f')]=function(_0x38c6f3,_0xb39cc){var _0xcc2f18={};var _0x13ee9b={};var _0x8d7c0c;var _0x3d9041;return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x38c6f3[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xb39cc,null))['then'](function(_0x39bc51){if(_0x39bc51){_0x8d7c0c=_0x39bc51;_0x13ee9b[_0xdf3c('0x34')]=_['keys'](db['User'][_0xdf3c('0x44')]);_0x13ee9b[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x38c6f3[_0xdf3c('0x2b')]);_0x13ee9b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],_0x13ee9b[_0xdf3c('0x2b')]);_0xcc2f18['attributes']=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x38c6f3[_0xdf3c('0x2b')]['fields']));_0xcc2f18[_0xdf3c('0x33')]=_0xcc2f18[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0xcc2f18[_0xdf3c('0x33')]:_0x13ee9b['model'];_0xcc2f18[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x38c6f3[_0xdf3c('0x2b')]['sort']);_0xcc2f18['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x38c6f3[_0xdf3c('0x2b')],_0x13ee9b['filters']));if(_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0xcc2f18[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0xcc2f18[_0xdf3c('0x29')],{'$or':_['map'](_0xcc2f18['attributes'],function(_0x1cd1a7){var _0x48141c={};_0x48141c[_0x1cd1a7]={'$like':'%'+_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x48141c;})});}_0xcc2f18=_[_0xdf3c('0x45')]({},_0xcc2f18,_0x38c6f3[_0xdf3c('0x38')]);return _0x8d7c0c[_0xdf3c('0x7f')](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5a56b5){if(_0x5a56b5){_0x3d9041=_0x5a56b5[_0xdf3c('0x36')];if(!_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0xcc2f18['limit']=qs[_0xdf3c('0x14')](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0xcc2f18['offset']=qs['offset'](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x8d7c0c['getAgents'](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5eebe3){if(_0x5eebe3){return _0x5eebe3?{'count':_0x3d9041,'rows':_0x5eebe3}:null;}})[_0xdf3c('0x19')](respondWithResult(_0xb39cc,null))[_0xdf3c('0x2e')](handleError(_0xb39cc,null));};exports[_0xdf3c('0x80')]=function(_0x1961cd,_0x30659d){var _0x27f25a={};var _0x5e5dad={};var _0x19ce27;var _0x2c24b7;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1961cd[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30659d,null))[_0xdf3c('0x19')](function(_0x1dee13){if(_0x1dee13){_0x19ce27=_0x1dee13;_0x5e5dad[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x63')]['rawAttributes']);_0x5e5dad[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x1961cd['query']);_0x5e5dad[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x5e5dad[_0xdf3c('0x34')],_0x5e5dad[_0xdf3c('0x2b')]);_0x27f25a[_0xdf3c('0x33')]=_['intersection'](_0x5e5dad[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x27f25a[_0xdf3c('0x33')]=_0x27f25a[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x27f25a[_0xdf3c('0x33')]:_0x5e5dad[_0xdf3c('0x34')];_0x27f25a[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x27f25a['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1961cd['query'],_0x5e5dad[_0xdf3c('0x31')]));if(_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x27f25a[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x27f25a[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x27f25a[_0xdf3c('0x33')],function(_0xc3b6a1){var _0x3d9a1e={};_0x3d9a1e[_0xc3b6a1]={'$like':'%'+_0x1961cd['query'][_0xdf3c('0x1f')]+'%'};return _0x3d9a1e;})});}_0x27f25a=_[_0xdf3c('0x45')]({},_0x27f25a,_0x1961cd['options']);return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})['then'](function(_0x330ee0){if(_0x330ee0){_0x2c24b7=_0x330ee0['length'];if(!_0x1961cd[_0xdf3c('0x2b')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x27f25a[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x27f25a[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1961cd[_0xdf3c('0x2b')]['offset']);}return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})[_0xdf3c('0x19')](function(_0x1b3daa){return _0x1b3daa?{'count':_0x2c24b7,'rows':_0x1b3daa}:null;})['then'](respondWithResult(_0x30659d,null))[_0xdf3c('0x2e')](handleError(_0x30659d,null));};exports[_0xdf3c('0x81')]=function(_0x30e5ab,_0x465c59){var _0x571f14={};var _0x55a4fa={};var _0x4f7b39;var _0x5e5af3;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x30e5ab[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x465c59,null))[_0xdf3c('0x19')](function(_0x323d9b){if(_0x323d9b){_0x4f7b39=_0x323d9b;_0x55a4fa[_0xdf3c('0x34')]=_['keys'](db[_0xdf3c('0x82')]['rawAttributes']);_0x55a4fa[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x30e5ab[_0xdf3c('0x2b')]);_0x55a4fa[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x55a4fa[_0xdf3c('0x34')],_0x55a4fa[_0xdf3c('0x2b')]);_0x571f14[_0xdf3c('0x33')]=_['intersection'](_0x55a4fa[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x571f14[_0xdf3c('0x33')]=_0x571f14['attributes']['length']?_0x571f14[_0xdf3c('0x33')]:_0x55a4fa[_0xdf3c('0x34')];_0x571f14[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x571f14[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x30e5ab[_0xdf3c('0x2b')],_0x55a4fa[_0xdf3c('0x31')]));if(_0x30e5ab['query'][_0xdf3c('0x1f')]){_0x571f14[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x571f14[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x571f14[_0xdf3c('0x33')],function(_0x184a55){var _0x4e8ad8={};_0x4e8ad8[_0x184a55]={'$like':'%'+_0x30e5ab[_0xdf3c('0x2b')]['filter']+'%'};return _0x4e8ad8;})});}_0x571f14=_[_0xdf3c('0x45')]({},_0x571f14,_0x30e5ab['options']);return _0x4f7b39[_0xdf3c('0x81')](_0x571f14);}})[_0xdf3c('0x19')](function(_0x54d975){if(_0x54d975){_0x5e5af3=_0x54d975['length'];if(!_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x571f14[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x30e5ab['query'][_0xdf3c('0x14')]);_0x571f14[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x4f7b39['getLists'](_0x571f14);}})[_0xdf3c('0x19')](function(_0x55a593){if(_0x55a593){return _0x55a593?{'count':_0x5e5af3,'rows':_0x55a593}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x465c59,null))['catch'](handleError(_0x465c59,null));};exports['addLists']=function(_0x42d720,_0x2da908){var _0x3e2a89=moment()[_0xdf3c('0x83')](_0xdf3c('0x84'));var _0x4f4afd,_0xd3d760;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x42d720[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2da908,null))[_0xdf3c('0x19')](function(_0x386a3b){if(_0x386a3b){_0xd3d760=_0x386a3b;return _0x386a3b[_0xdf3c('0x85')](_0x42d720['body'][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x42d720[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x511630){var _0x2cf46;_0x4f4afd=_0x511630||[];var _0x43fc55=[];if(_0x511630){for(var _0x81b8dd=0x0;_0x81b8dd<_0x511630[_0xdf3c('0x36')];_0x81b8dd+=0x1){var _0xb852c5=_0x511630[_0x81b8dd][_0xdf3c('0x1b')]({'plain':!![]});_0xd3d760[_0xdf3c('0x86')]=_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]?_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]:_0xd3d760[_0xdf3c('0x86')];switch(_0xd3d760[_0xdf3c('0x86')]){case _0xdf3c('0x87'):_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0x8a'))[_0xdf3c('0x8b')](['phone',_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),'updatedAt'],squel[_0xdf3c('0x6e')]()['field'](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))['field']('\x27'+_0x3e2a89+'\x27','createdAt')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))['where'](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')]())['where'](_0xdf3c('0x94'))[_0xdf3c('0x29')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0xdf3c('0x70')](_0xdf3c('0x95'))[_0xdf3c('0x29')](_0xdf3c('0x73'),_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))[_0xdf3c('0x70')](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]())))[_0xdf3c('0x91')]();break;case _0xdf3c('0x97'):_0x2cf46=squel['insert']()[_0xdf3c('0x89')](_0xdf3c('0x8a'))['fromQuery']([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('phone','phone')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),_0xdf3c('0x8e'))['field'](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),'VoiceQueueId')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))['from'](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')]('ListId\x20=\x20?',_0xb852c5['CmListId']['toString']())[_0xdf3c('0x29')](_0xdf3c('0x94'))[_0xdf3c('0x29')](_0xdf3c('0x98'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))['from'](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id']['toString']())))[_0xdf3c('0x91')]();break;default:_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')]('cm_hopper')[_0xdf3c('0x8b')]([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27','scheduledAt')[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5['CmListId'][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id']['toString'](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')](_0xdf3c('0x99'),_0xb852c5[_0xdf3c('0x90')]['toString']())[_0xdf3c('0x29')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x43fc55['push'](db['sequelize'][_0xdf3c('0x2b')](_0x2cf46));}return BPromise[_0xdf3c('0x78')](_0x43fc55);}})[_0xdf3c('0x19')](function(){var _0x1eb736=[];var _0x321ff1=squel[_0xdf3c('0x88')]()['into'](_0xdf3c('0x9a'))['fromQuery']([_0xdf3c('0x9b'),_0xdf3c('0x8f'),_0xdf3c('0x9c'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x9d'))[_0xdf3c('0x6f')]('ci.item')[_0xdf3c('0x6f')](_0xdf3c('0x9e'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27','updatedAt')[_0xdf3c('0x70')](_0xdf3c('0x9f'),'ci')[_0xdf3c('0x72')](_0xdf3c('0x8a'),'h','h.ContactId=ci.CmContactId')[_0xdf3c('0x29')](_0xdf3c('0xa0'),_0x3e2a89)[_0xdf3c('0x29')](_0xdf3c('0xa1'),_0xdf3c('0xa2')))[_0xdf3c('0x91')]();_0x1eb736[_0xdf3c('0x75')](db['sequelize'][_0xdf3c('0x2b')](_0x321ff1));return BPromise[_0xdf3c('0x78')](_0x1eb736);})[_0xdf3c('0x19')](function(){return _0x4f4afd;})[_0xdf3c('0x19')](respondWithResult(_0x2da908,null))[_0xdf3c('0x2e')](handleError(_0x2da908,null));};exports[_0xdf3c('0xa3')]=function(_0x51404d,_0x4cfc67){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x51404d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4cfc67,null))[_0xdf3c('0x19')](function(_0x5e06a2){if(_0x5e06a2){return _0x5e06a2[_0xdf3c('0xa3')](_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})[_0xdf3c('0x19')](function(_0x2cab31){if(_0x2cab31){return db[_0xdf3c('0x50')]['destroy']({'where':{'ListId':_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0x51404d['params']['id']}})[_0xdf3c('0x19')](function(){return _0x2cab31;});}})['then'](respondWithStatusCode(_0x4cfc67,null))[_0xdf3c('0x2e')](handleError(_0x4cfc67,null));};exports[_0xdf3c('0xa4')]=function(_0xa6fa19,_0x16b173){var _0x578e41={};var _0x4815ee={};var _0xa523c8;var _0x52ae27;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xa6fa19[_0xdf3c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x16b173,null))[_0xdf3c('0x19')](function(_0x148785){if(_0x148785){_0xa523c8=_0x148785;_0x4815ee[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmList']['rawAttributes']);_0x4815ee[_0xdf3c('0x2b')]=_['keys'](_0xa6fa19[_0xdf3c('0x2b')]);_0x4815ee[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],_0x4815ee[_0xdf3c('0x2b')]);_0x578e41['attributes']=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xa6fa19['query'][_0xdf3c('0x35')]));_0x578e41[_0xdf3c('0x33')]=_0x578e41[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x578e41[_0xdf3c('0x33')]:_0x4815ee[_0xdf3c('0x34')];_0x578e41[_0xdf3c('0x4c')]=qs['sort'](_0xa6fa19['query'][_0xdf3c('0x4d')]);_0x578e41['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xa6fa19[_0xdf3c('0x2b')],_0x4815ee[_0xdf3c('0x31')]));if(_0xa6fa19['query'][_0xdf3c('0x1f')]){_0x578e41['where']=_[_0xdf3c('0x45')](_0x578e41['where'],{'$or':_[_0xdf3c('0x20')](_0x578e41[_0xdf3c('0x33')],function(_0x36fb96){var _0x2ac2ca={};_0x2ac2ca[_0x36fb96]={'$like':'%'+_0xa6fa19[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x2ac2ca;})});}_0x578e41=_[_0xdf3c('0x45')]({},_0x578e41,_0xa6fa19['options']);return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})[_0xdf3c('0x19')](function(_0x25d312){if(_0x25d312){_0x52ae27=_0x25d312[_0xdf3c('0x36')];if(!_0xa6fa19['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x578e41[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xa6fa19[_0xdf3c('0x2b')]['limit']);_0x578e41['offset']=qs['offset'](_0xa6fa19[_0xdf3c('0x2b')]['offset']);}return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})['then'](function(_0xbbc217){if(_0xbbc217){return _0xbbc217?{'count':_0x52ae27,'rows':_0xbbc217}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x16b173,null))[_0xdf3c('0x2e')](handleError(_0x16b173,null));};exports['addBlackLists']=function(_0x47d44e,_0x4dd133){var _0x2b8425;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x47d44e[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4dd133,null))[_0xdf3c('0x19')](function(_0x4009e0){if(_0x4009e0){return _0x4009e0[_0xdf3c('0xa5')](_0x47d44e[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x47d44e['body'],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x37e578){var _0x11436f;_0x2b8425=_0x37e578||[];var _0x1d66b6=[];if(_0x37e578){for(var _0x4b4bab=0x0;_0x4b4bab<_0x37e578[_0xdf3c('0x36')];_0x4b4bab+=0x1){var _0x290778=_0x37e578[_0x4b4bab][_0xdf3c('0x1b')]({'plain':!![]});_0x11436f=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0xa6'))['fromQuery']([_0xdf3c('0x8f'),'ContactId',_0xdf3c('0x8e'),_0xdf3c('0x4f'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('id','ContactId')[_0xdf3c('0x6f')](_0x290778[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x47d44e['params']['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x48'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0x290778['CmListId'][_0xdf3c('0x91')]())[_0xdf3c('0x29')](_0xdf3c('0x94')))[_0xdf3c('0x91')]();_0x1d66b6[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x11436f));}return BPromise[_0xdf3c('0x78')](_0x1d66b6);}})[_0xdf3c('0x19')](function(){return _0x2b8425;})[_0xdf3c('0x19')](respondWithResult(_0x4dd133,null))[_0xdf3c('0x2e')](handleError(_0x4dd133,null));};exports[_0xdf3c('0xa8')]=function(_0xc5ac78,_0x567748){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x567748,null))['then'](function(_0x290a39){if(_0x290a39){return _0x290a39['removeBlackLists'](_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})['then'](function(_0xabf05c){if(_0xabf05c){return db[_0xdf3c('0x57')][_0xdf3c('0x1a')]({'where':{'ListId':_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](function(){return _0xabf05c;});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x567748,null))['catch'](handleError(_0x567748,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 70aed58..35bc8e1 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 _0x6b60=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x6b60,0x1e6));var _0x06b6=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0x6b60[_0x1795df];return _0x3f13c0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x06b6('0x0'))['db'][_0x06b6('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x06b6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x06b6('0x3'),'afterDestroy':_0x06b6('0x4')};function emitEvent(_0x3b9bfd){return function(_0x3c4662,_0x6db76a,_0x2db1a9){VoiceQueueEvents['emit'](_0x3b9bfd+':'+_0x3c4662['id'],_0x3c4662);VoiceQueueEvents[_0x06b6('0x5')](_0x3b9bfd,_0x3c4662);_0x2db1a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x06b6('0x6')](e,emitEvent(event));}}module[_0x06b6('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x17e4=['remove','emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','update'];(function(_0x27597a,_0x4081fb){var _0x26df88=function(_0x270215){while(--_0x270215){_0x27597a['push'](_0x27597a['shift']());}};_0x26df88(++_0x4081fb);}(_0x17e4,0x152));var _0x417e=function(_0x56e8c3,_0x41349d){_0x56e8c3=_0x56e8c3-0x0;var _0x146a3e=_0x17e4[_0x56e8c3];return _0x146a3e;};'use strict';var EventEmitter=require(_0x417e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x417e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x417e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x417e('0x3'),'afterDestroy':_0x417e('0x4')};function emitEvent(_0x255ef0){return function(_0xf91d3b,_0x33d33f,_0x5c8b32){VoiceQueueEvents['emit'](_0x255ef0+':'+_0xf91d3b['id'],_0xf91d3b);VoiceQueueEvents[_0x417e('0x5')](_0x255ef0,_0xf91d3b);_0x5c8b32(null);};}for(var e in events){if(events[_0x417e('0x6')](e)){var event=events[e];VoiceQueue[_0x417e('0x7')](e,emitEvent(event));}}module[_0x417e('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 c50cc48..c3a128f 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1d8772,_0x5f2656){var _0x3d7db4=function(_0x23063f){while(--_0x23063f){_0x1d8772['push'](_0x1d8772['shift']());}};_0x3d7db4(++_0x5f2656);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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 +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x588f2c,_0x10e069){var _0x467467=function(_0xa0110d){while(--_0xa0110d){_0x588f2c['push'](_0x588f2c['shift']());}};_0x467467(++_0x10e069);}(_0x3e74,0x175));var _0x43e7=function(_0x3aac0a,_0x45cfcb){_0x3aac0a=_0x3aac0a-0x0;var _0x20e5bc=_0x3e74[_0x3aac0a];return _0x20e5bc;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1cbcbaa..425fd79 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 _0x2518=['../../config/environment','jayson/promise','http','redis','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','model','map','debug','ShowVoiceQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e9d38,_0x37b7bc){var _0x576735=function(_0x468891){while(--_0x468891){_0x4e9d38['push'](_0x4e9d38['shift']());}};_0x576735(++_0x37b7bc);}(_0x2518,0x129));var _0x8251=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2518[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8251('0x0'));var util=require('util');var moment=require(_0x8251('0x1'));var BPromise=require(_0x8251('0x2'));var rs=require(_0x8251('0x3'));var fs=require('fs');var Redis=require(_0x8251('0x4'));var db=require(_0x8251('0x5'))['db'];var utils=require(_0x8251('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8251('0x7'));var jayson=require(_0x8251('0x8'));var client=jayson['client'][_0x8251('0x9')]({'port':0x232a});config[_0x8251('0xa')]=_['defaults'](config[_0x8251('0xa')],{'host':_0x8251('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8251('0xc'))[_0x8251('0xd')](socket);function respondWithRpcPromise(_0x2c5158,_0x183ee1,_0x257869){return new BPromise(function(_0x1e1056,_0xf9fb74){return client[_0x8251('0xe')](_0x2c5158,_0x257869)[_0x8251('0xf')](function(_0x4686c3){logger[_0x8251('0x10')](_0x8251('0x11'),_0x183ee1,'request\x20sent');logger['debug'](_0x8251('0x12'),_0x183ee1,_0x8251('0x13'),JSON[_0x8251('0x14')](_0x4686c3));if(_0x4686c3[_0x8251('0x15')]){if(_0x4686c3[_0x8251('0x15')]['code']===0x1f4){logger[_0x8251('0x15')](_0x8251('0x11'),_0x183ee1,_0x4686c3[_0x8251('0x15')][_0x8251('0x16')]);return _0xf9fb74(_0x4686c3[_0x8251('0x15')]['message']);}logger[_0x8251('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x183ee1,_0x4686c3[_0x8251('0x15')][_0x8251('0x16')]);return _0x1e1056(_0x4686c3['error'][_0x8251('0x16')]);}else{logger[_0x8251('0x10')](_0x8251('0x11'),_0x183ee1,'request\x20sent');_0x1e1056(_0x4686c3[_0x8251('0x17')][_0x8251('0x16')]);}})[_0x8251('0x18')](function(_0x3e220f){logger[_0x8251('0x15')](_0x8251('0x11'),_0x183ee1,_0x3e220f);_0xf9fb74(_0x3e220f);});});}exports[_0x8251('0x19')]=function(_0x49a352){var _0x293412=this;return new Promise(function(_0x107dc1,_0x34db01){return db[_0x8251('0x1a')][_0x8251('0x1b')]({'raw':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')][_0x8251('0x1d')]===undefined?!![]:![]:!![],'where':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')]['where']||null:null,'attributes':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')][_0x8251('0x1e')]||null:null,'limit':_0x49a352['options']?_0x49a352[_0x8251('0x1c')][_0x8251('0x1f')]||null:null,'include':_0x49a352[_0x8251('0x1c')]?_0x49a352[_0x8251('0x1c')][_0x8251('0x20')]?_['map'](_0x49a352[_0x8251('0x1c')][_0x8251('0x20')],function(_0x18e646){return{'model':db[_0x18e646[_0x8251('0x21')]],'as':_0x18e646['as'],'attributes':_0x18e646[_0x8251('0x1e')],'include':_0x18e646[_0x8251('0x20')]?_[_0x8251('0x22')](_0x18e646[_0x8251('0x20')],function(_0x4d6b05){return{'model':db[_0x4d6b05[_0x8251('0x21')]],'as':_0x4d6b05['as'],'attributes':_0x4d6b05['attributes'],'include':_0x4d6b05[_0x8251('0x20')]?_[_0x8251('0x22')](_0x4d6b05[_0x8251('0x20')],function(_0x4ad44e){return{'model':db[_0x4ad44e[_0x8251('0x21')]],'as':_0x4ad44e['as'],'attributes':_0x4ad44e['attributes']};}):[]};}):[]};}):[]:[]})[_0x8251('0xf')](function(_0x9b0beb){logger[_0x8251('0x10')](_0x8251('0x19'),_0x49a352);logger[_0x8251('0x23')](_0x8251('0x19'),_0x49a352,JSON[_0x8251('0x14')](_0x9b0beb));_0x107dc1(_0x9b0beb);})[_0x8251('0x18')](function(_0x3f8f31){logger[_0x8251('0x15')](_0x8251('0x19'),_0x3f8f31[_0x8251('0x16')],_0x49a352);_0x34db01(_0x293412[_0x8251('0x15')](0x1f4,_0x3f8f31[_0x8251('0x16')]));});});};exports[_0x8251('0x24')]=function(_0x31c9d8){var _0x34cc29=this;return new Promise(function(_0x5513cc,_0x206eb5){return db['VoiceQueue']['find']({'raw':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8[_0x8251('0x1c')][_0x8251('0x1d')]===undefined?!![]:![]:!![],'where':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8[_0x8251('0x1c')][_0x8251('0x25')]||null:null,'attributes':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8[_0x8251('0x1c')]['attributes']||null:null,'include':_0x31c9d8[_0x8251('0x1c')]?_0x31c9d8['options'][_0x8251('0x20')]?_[_0x8251('0x22')](_0x31c9d8[_0x8251('0x1c')][_0x8251('0x20')],function(_0x5c841f){return{'model':db[_0x5c841f[_0x8251('0x21')]],'as':_0x5c841f['as'],'attributes':_0x5c841f[_0x8251('0x1e')],'include':_0x5c841f[_0x8251('0x20')]?_[_0x8251('0x22')](_0x5c841f['include'],function(_0x6880de){return{'model':db[_0x6880de[_0x8251('0x21')]],'as':_0x6880de['as'],'attributes':_0x6880de[_0x8251('0x1e')],'include':_0x6880de[_0x8251('0x20')]?_[_0x8251('0x22')](_0x6880de[_0x8251('0x20')],function(_0x13e05e){return{'model':db[_0x13e05e[_0x8251('0x21')]],'as':_0x13e05e['as'],'attributes':_0x13e05e[_0x8251('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8251('0xf')](function(_0x59d95b){logger[_0x8251('0x10')](_0x8251('0x24'),_0x31c9d8);logger['debug']('ShowVoiceQueue',_0x31c9d8,JSON[_0x8251('0x14')](_0x59d95b));_0x5513cc(_0x59d95b);})[_0x8251('0x18')](function(_0xdacd4c){logger[_0x8251('0x15')](_0x8251('0x24'),_0xdacd4c[_0x8251('0x16')],_0x31c9d8);_0x206eb5(_0x34cc29[_0x8251('0x15')](0x1f4,_0xdacd4c[_0x8251('0x16')]));});});}; \ No newline at end of file +var _0x0a37=['code','message','result','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceQueue','ShowVoiceQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a37,0x130));var _0x70a3=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x0a37[_0x34df4a];return _0x145c69;};'use strict';var _=require(_0x70a3('0x0'));var util=require('util');var moment=require(_0x70a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x70a3('0x2'));var fs=require('fs');var Redis=require(_0x70a3('0x3'));var db=require(_0x70a3('0x4'))['db'];var utils=require(_0x70a3('0x5'));var logger=require('../../config/logger')(_0x70a3('0x6'));var config=require(_0x70a3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x70a3('0x8')][_0x70a3('0x9')]({'port':0x232a});config[_0x70a3('0xa')]=_[_0x70a3('0xb')](config[_0x70a3('0xa')],{'host':_0x70a3('0xc'),'port':0x18eb});var socket=require(_0x70a3('0xd'))(new Redis(config['redis']));require(_0x70a3('0xe'))[_0x70a3('0xf')](socket);function respondWithRpcPromise(_0x353f7c,_0x52e7af,_0x1bf5fe){return new BPromise(function(_0x52a829,_0x48ce97){return client[_0x70a3('0x10')](_0x353f7c,_0x1bf5fe)['then'](function(_0x5c1ef9){logger[_0x70a3('0x11')](_0x70a3('0x12'),_0x52e7af,_0x70a3('0x13'));logger[_0x70a3('0x14')](_0x70a3('0x15'),_0x52e7af,_0x70a3('0x13'),JSON[_0x70a3('0x16')](_0x5c1ef9));if(_0x5c1ef9[_0x70a3('0x17')]){if(_0x5c1ef9[_0x70a3('0x17')][_0x70a3('0x18')]===0x1f4){logger[_0x70a3('0x17')](_0x70a3('0x12'),_0x52e7af,_0x5c1ef9[_0x70a3('0x17')][_0x70a3('0x19')]);return _0x48ce97(_0x5c1ef9[_0x70a3('0x17')][_0x70a3('0x19')]);}logger[_0x70a3('0x17')](_0x70a3('0x12'),_0x52e7af,_0x5c1ef9[_0x70a3('0x17')][_0x70a3('0x19')]);return _0x52a829(_0x5c1ef9[_0x70a3('0x17')][_0x70a3('0x19')]);}else{logger['info'](_0x70a3('0x12'),_0x52e7af,_0x70a3('0x13'));_0x52a829(_0x5c1ef9[_0x70a3('0x1a')][_0x70a3('0x19')]);}})[_0x70a3('0x1b')](function(_0x473de5){logger['error'](_0x70a3('0x12'),_0x52e7af,_0x473de5);_0x48ce97(_0x473de5);});});}exports['GetVoiceQueue']=function(_0x4c2d5e){var _0x5c115=this;return new Promise(function(_0x3ba33e,_0x26751a){return db[_0x70a3('0x1c')][_0x70a3('0x1d')]({'raw':_0x4c2d5e[_0x70a3('0x1e')]?_0x4c2d5e['options'][_0x70a3('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c2d5e['options']?_0x4c2d5e[_0x70a3('0x1e')][_0x70a3('0x20')]||null:null,'attributes':_0x4c2d5e['options']?_0x4c2d5e[_0x70a3('0x1e')][_0x70a3('0x21')]||null:null,'limit':_0x4c2d5e[_0x70a3('0x1e')]?_0x4c2d5e[_0x70a3('0x1e')][_0x70a3('0x22')]||null:null,'include':_0x4c2d5e[_0x70a3('0x1e')]?_0x4c2d5e[_0x70a3('0x1e')]['include']?_[_0x70a3('0x23')](_0x4c2d5e[_0x70a3('0x1e')]['include'],function(_0xc9bd22){return{'model':db[_0xc9bd22['model']],'as':_0xc9bd22['as'],'attributes':_0xc9bd22['attributes'],'include':_0xc9bd22[_0x70a3('0x24')]?_[_0x70a3('0x23')](_0xc9bd22[_0x70a3('0x24')],function(_0x142e18){return{'model':db[_0x142e18[_0x70a3('0x25')]],'as':_0x142e18['as'],'attributes':_0x142e18[_0x70a3('0x21')],'include':_0x142e18[_0x70a3('0x24')]?_[_0x70a3('0x23')](_0x142e18[_0x70a3('0x24')],function(_0x187a2f){return{'model':db[_0x187a2f[_0x70a3('0x25')]],'as':_0x187a2f['as'],'attributes':_0x187a2f[_0x70a3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x128896){logger['info'](_0x70a3('0x26'),_0x4c2d5e);logger[_0x70a3('0x14')](_0x70a3('0x26'),_0x4c2d5e,JSON[_0x70a3('0x16')](_0x128896));_0x3ba33e(_0x128896);})['catch'](function(_0x23664a){logger[_0x70a3('0x17')]('GetVoiceQueue',_0x23664a[_0x70a3('0x19')],_0x4c2d5e);_0x26751a(_0x5c115[_0x70a3('0x17')](0x1f4,_0x23664a[_0x70a3('0x19')]));});});};exports[_0x70a3('0x27')]=function(_0x375af2){var _0x491621=this;return new Promise(function(_0x1f74f6,_0xd6597c){return db[_0x70a3('0x1c')][_0x70a3('0x28')]({'raw':_0x375af2[_0x70a3('0x1e')]?_0x375af2['options'][_0x70a3('0x1f')]===undefined?!![]:![]:!![],'where':_0x375af2[_0x70a3('0x1e')]?_0x375af2['options'][_0x70a3('0x20')]||null:null,'attributes':_0x375af2[_0x70a3('0x1e')]?_0x375af2[_0x70a3('0x1e')]['attributes']||null:null,'include':_0x375af2['options']?_0x375af2['options'][_0x70a3('0x24')]?_['map'](_0x375af2[_0x70a3('0x1e')][_0x70a3('0x24')],function(_0x1f44e6){return{'model':db[_0x1f44e6[_0x70a3('0x25')]],'as':_0x1f44e6['as'],'attributes':_0x1f44e6[_0x70a3('0x21')],'include':_0x1f44e6[_0x70a3('0x24')]?_[_0x70a3('0x23')](_0x1f44e6[_0x70a3('0x24')],function(_0x52c809){return{'model':db[_0x52c809[_0x70a3('0x25')]],'as':_0x52c809['as'],'attributes':_0x52c809[_0x70a3('0x21')],'include':_0x52c809[_0x70a3('0x24')]?_[_0x70a3('0x23')](_0x52c809[_0x70a3('0x24')],function(_0x157a87){return{'model':db[_0x157a87[_0x70a3('0x25')]],'as':_0x157a87['as'],'attributes':_0x157a87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e7fd7){logger[_0x70a3('0x11')](_0x70a3('0x27'),_0x375af2);logger[_0x70a3('0x14')]('ShowVoiceQueue',_0x375af2,JSON[_0x70a3('0x16')](_0x1e7fd7));_0x1f74f6(_0x1e7fd7);})['catch'](function(_0x12e309){logger['error'](_0x70a3('0x27'),_0x12e309['message'],_0x375af2);_0xd6597c(_0x491621[_0x70a3('0x17')](0x1f4,_0x12e309[_0x70a3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 745633b..00bbb68 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 _0x8de1=['voiceQueue:','./voiceQueue.events','save','remove','update','removeListener','length'];(function(_0x3e0b2a,_0x48c54a){var _0x4b1237=function(_0x46cb84){while(--_0x46cb84){_0x3e0b2a['push'](_0x3e0b2a['shift']());}};_0x4b1237(++_0x48c54a);}(_0x8de1,0x8d));var _0x18de=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0x8de1[_0xb1b616];return _0x1259b0;};'use strict';var VoiceQueueEvents=require(_0x18de('0x0'));var events=[_0x18de('0x1'),_0x18de('0x2'),_0x18de('0x3')];function createListener(_0x586688,_0x461dda){return function(_0xedbad1){_0x461dda['emit'](_0x586688,_0xedbad1);};}function removeListener(_0x39773d,_0xfc2594){return function(){VoiceQueueEvents[_0x18de('0x4')](_0x39773d,_0xfc2594);};}exports['register']=function(_0x15cfdb){for(var _0x458c87=0x0,_0x4486e3=events[_0x18de('0x5')];_0x458c87<_0x4486e3;_0x458c87++){var _0xb6b13d=events[_0x458c87];var _0x802f08=createListener(_0x18de('0x6')+_0xb6b13d,_0x15cfdb);VoiceQueueEvents['on'](_0xb6b13d,_0x802f08);}}; \ No newline at end of file +var _0xfe67=['register','length','voiceQueue:','save','remove','update','emit','removeListener'];(function(_0x1a0ba7,_0x5c8bad){var _0x297e8c=function(_0x46f542){while(--_0x46f542){_0x1a0ba7['push'](_0x1a0ba7['shift']());}};_0x297e8c(++_0x5c8bad);}(_0xfe67,0x1c3));var _0x7fe6=function(_0x27b761,_0x183a44){_0x27b761=_0x27b761-0x0;var _0x582fb1=_0xfe67[_0x27b761];return _0x582fb1;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x7fe6('0x0'),_0x7fe6('0x1'),_0x7fe6('0x2')];function createListener(_0x477d41,_0x4e0329){return function(_0x368e95){_0x4e0329[_0x7fe6('0x3')](_0x477d41,_0x368e95);};}function removeListener(_0x2281f2,_0x4d230f){return function(){VoiceQueueEvents[_0x7fe6('0x4')](_0x2281f2,_0x4d230f);};}exports[_0x7fe6('0x5')]=function(_0x17d0a6){for(var _0x4513e8=0x0,_0x2ba2af=events[_0x7fe6('0x6')];_0x4513e8<_0x2ba2af;_0x4513e8++){var _0x133ace=events[_0x4513e8];var _0x92fe12=createListener(_0x7fe6('0x7')+_0x133ace,_0x17d0a6);VoiceQueueEvents['on'](_0x133ace,_0x92fe12);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 31f450d..1e09a77 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 _0xc248=['multer','path','Router','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc248,0x90));var _0x8c24=function(_0x170527,_0x10568e){_0x170527=_0x170527-0x0;var _0x748b63=_0xc248[_0x170527];return _0x748b63;};'use strict';var multer=require(_0x8c24('0x0'));var util=require('util');var path=require(_0x8c24('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c24('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8c24('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c24('0x4'));router[_0x8c24('0x5')]('/',auth[_0x8c24('0x6')](),controller[_0x8c24('0x7')]);router[_0x8c24('0x5')]('/describe',auth[_0x8c24('0x6')](),controller['describe']);router['get'](_0x8c24('0x8'),auth[_0x8c24('0x6')](),controller[_0x8c24('0x9')]);router['get'](_0x8c24('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8c24('0xb')]('/',auth[_0x8c24('0x6')](),controller[_0x8c24('0xc')]);router[_0x8c24('0xd')](_0x8c24('0xa'),auth[_0x8c24('0x6')](),controller[_0x8c24('0xe')]);router[_0x8c24('0xf')](_0x8c24('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33db=['./voiceQueueReport.controller','get','isAuthenticated','index','describe','getVoiceQueuesReport','show','post','put','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x33db,0x1d4));var _0xb33d=function(_0x62b58e,_0x46fe1e){_0x62b58e=_0x62b58e-0x0;var _0x37fe84=_0x33db[_0x62b58e];return _0x37fe84;};'use strict';var multer=require('multer');var util=require(_0xb33d('0x0'));var path=require(_0xb33d('0x1'));var timeout=require(_0xb33d('0x2'));var express=require('express');var router=express[_0xb33d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb33d('0x4'));var interaction=require(_0xb33d('0x5'));var config=require(_0xb33d('0x6'));var controller=require(_0xb33d('0x7'));router[_0xb33d('0x8')]('/',auth[_0xb33d('0x9')](),controller[_0xb33d('0xa')]);router['get']('/describe',auth[_0xb33d('0x9')](),controller[_0xb33d('0xb')]);router[_0xb33d('0x8')]('/index',auth[_0xb33d('0x9')](),controller[_0xb33d('0xc')]);router[_0xb33d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb33d('0xd')]);router[_0xb33d('0xe')]('/',auth[_0xb33d('0x9')](),controller['create']);router[_0xb33d('0xf')](_0xb33d('0x10'),auth[_0xb33d('0x9')](),controller['update']);router['delete'](_0xb33d('0x10'),auth[_0xb33d('0x9')](),controller[_0xb33d('0x11')]);module[_0xb33d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 364a6c7..70fa83a 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 _0x9495=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x9495,0x13c));var _0x5949=function(_0x25ad30,_0x4d9cb8){_0x25ad30=_0x25ad30-0x0;var _0x97c45e=_0x9495[_0x25ad30];return _0x97c45e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5949('0x0'));module['exports']={'type':{'type':Sequelize[_0x5949('0x1')]},'uniqueid':{'type':Sequelize[_0x5949('0x1')]},'calleridnum':{'type':Sequelize[_0x5949('0x1')]},'calleridname':{'type':Sequelize[_0x5949('0x1')]},'queue':{'type':Sequelize[_0x5949('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x5949('0x2')],'set':function(_0xd078eb){var _0x50a162=moment(_0xd078eb);var _0x20c493=moment(this[_0x5949('0x3')](_0x5949('0x4')))[_0x5949('0x5')](_0x5949('0x6'));var _0x50dbff=_0x50a162[_0x5949('0x7')](_0x20c493,_0x5949('0x8'));this['setDataValue'](_0x5949('0x9'),_0xd078eb);this[_0x5949('0xa')]('holdtime',_0x50dbff||null);}},'position':{'type':Sequelize[_0x5949('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5949('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5949('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x5949('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x5949('0xb')]},'channel':{'type':Sequelize[_0x5949('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5949('0x1')]},'connectedlinename':{'type':Sequelize[_0x5949('0x1')]},'accountcode':{'type':Sequelize[_0x5949('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5949('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5949('0x1')]},'transfer':{'type':Sequelize[_0x5949('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x5949('0xd')},'transferexten':{'type':Sequelize[_0x5949('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5949('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5949('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x5949('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x5949('0x1')]}}; \ No newline at end of file +var _0x03c4=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x50d87a,_0x2797fc){var _0x58a2f2=function(_0x1e6150){while(--_0x1e6150){_0x50d87a['push'](_0x50d87a['shift']());}};_0x58a2f2(++_0x2797fc);}(_0x03c4,0xa2));var _0x403c=function(_0x16956b,_0x52cd28){_0x16956b=_0x16956b-0x0;var _0x4cc179=_0x03c4[_0x16956b];return _0x4cc179;};'use strict';var Sequelize=require(_0x403c('0x0'));var moment=require(_0x403c('0x1'));module[_0x403c('0x2')]={'type':{'type':Sequelize[_0x403c('0x3')]},'uniqueid':{'type':Sequelize[_0x403c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x403c('0x3')]},'queue':{'type':Sequelize[_0x403c('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x403c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x403c('0x4')],'set':function(_0x34bdd6){var _0x33fc3b=moment(_0x34bdd6);var _0x5060a1=moment(this['getDataValue'](_0x403c('0x5')))[_0x403c('0x6')](_0x403c('0x7'));var _0x48f1ea=_0x33fc3b[_0x403c('0x8')](_0x5060a1,'seconds');this[_0x403c('0x9')](_0x403c('0xa'),_0x34bdd6);this[_0x403c('0x9')](_0x403c('0xb'),_0x48f1ea||null);}},'position':{'type':Sequelize[_0x403c('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x403c('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x403c('0x4')]},'queuecallerexit':{'type':Sequelize[_0x403c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x403c('0x3')],'comment':_0x403c('0xe')},'originalposition':{'type':Sequelize[_0x403c('0xc')]},'channel':{'type':Sequelize[_0x403c('0x3')]},'connectedlinenum':{'type':Sequelize[_0x403c('0x3')]},'connectedlinename':{'type':Sequelize[_0x403c('0x3')]},'accountcode':{'type':Sequelize[_0x403c('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x403c('0x3')]},'priority':{'type':Sequelize[_0x403c('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x403c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x403c('0x3')]},'transfer':{'type':Sequelize[_0x403c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x403c('0x3')],'comment':_0x403c('0xf')},'transferexten':{'type':Sequelize[_0x403c('0x3')]},'transferuniqueid':{'type':Sequelize[_0x403c('0x3')]},'disposition':{'type':Sequelize[_0x403c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x403c('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x403c('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x403c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index bed2b64..861af53 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 _0x25e0=['options','create','body','find','describe','getVoiceQueuesReport','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x25e0,0x197));var _0x025e=function(_0x4239c8,_0x2c0c6e){_0x4239c8=_0x4239c8-0x0;var _0x40323b=_0x25e0[_0x4239c8];return _0x40323b;};'use strict';var emlformat=require(_0x025e('0x0'));var rimraf=require(_0x025e('0x1'));var zipdir=require(_0x025e('0x2'));var jsonpatch=require(_0x025e('0x3'));var rp=require('request-promise');var moment=require(_0x025e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x025e('0x5'));var util=require(_0x025e('0x6'));var path=require('path');var sox=require(_0x025e('0x7'));var csv=require(_0x025e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x025e('0x9'));var squel=require(_0x025e('0xa'));var crypto=require(_0x025e('0xb'));var jsforce=require(_0x025e('0xc'));var deskjs=require(_0x025e('0xd'));var toCsv=require(_0x025e('0x8'));var querystring=require('querystring');var Papa=require(_0x025e('0xe'));var Redis=require(_0x025e('0xf'));var authService=require(_0x025e('0x10'));var qs=require(_0x025e('0x11'));var as=require(_0x025e('0x12'));var hardwareService=require(_0x025e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x025e('0x14'));var config=require(_0x025e('0x15'));var licenseUtil=require(_0x025e('0x16'));var db=require(_0x025e('0x17'))['db'];config['redis']=_[_0x025e('0x18')](config[_0x025e('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x180bd9,_0xacdd1b){_0xacdd1b=_0xacdd1b||0xcc;return function(_0x53f520){if(_0x53f520){return _0x180bd9[_0x025e('0x1a')](_0xacdd1b);}return _0x180bd9[_0x025e('0x1b')](_0xacdd1b)['end']();};}function respondWithResult(_0x5ada06,_0x57409c){_0x57409c=_0x57409c||0xc8;return function(_0x1b4333){if(_0x1b4333){return _0x5ada06[_0x025e('0x1b')](_0x57409c)['json'](_0x1b4333);}};}function respondWithFilteredResult(_0x520e07,_0xc38db5){return function(_0x566809){if(_0x566809){var _0x4c7799=typeof _0xc38db5['offset']==='undefined'&&typeof _0xc38db5[_0x025e('0x1c')]===_0x025e('0x1d');var _0x5d8aff=_0x566809['count'];var _0x2af355=_0x4c7799?0x0:_0xc38db5[_0x025e('0x1e')];var _0x3c30d9=_0x4c7799?_0x566809[_0x025e('0x1f')]:_0xc38db5[_0x025e('0x1e')]+_0xc38db5[_0x025e('0x1c')];var _0x40e4ed;if(_0x3c30d9>=_0x5d8aff){_0x3c30d9=_0x5d8aff;_0x40e4ed=0xc8;}else{_0x40e4ed=0xce;}_0x520e07[_0x025e('0x1b')](_0x40e4ed);return _0x520e07[_0x025e('0x20')](_0x025e('0x21'),_0x2af355+'-'+_0x3c30d9+'/'+_0x5d8aff)[_0x025e('0x22')](_0x566809);}return null;};}function patchUpdates(_0xbed2ea){return function(_0x496791){try{jsonpatch['apply'](_0x496791,_0xbed2ea,!![]);}catch(_0x287a07){return BPromise['reject'](_0x287a07);}return _0x496791[_0x025e('0x23')]();};}function saveUpdates(_0x29d8fb,_0x578a4c){return function(_0x59211d){if(_0x59211d){return _0x59211d[_0x025e('0x24')](_0x29d8fb)['then'](function(_0x4bd1df){return _0x4bd1df;});}return null;};}function removeEntity(_0x265b52,_0x2554e1){return function(_0x32d2f4){if(_0x32d2f4){return _0x32d2f4[_0x025e('0x25')]()[_0x025e('0x26')](function(){_0x265b52[_0x025e('0x1b')](0xcc)[_0x025e('0x27')]();});}};}function handleEntityNotFound(_0x428b87,_0x37279f){return function(_0x48080b){if(!_0x48080b){_0x428b87['sendStatus'](0x194);}return _0x48080b;};}function handleError(_0x2824dc,_0x3eb24f){_0x3eb24f=_0x3eb24f||0x1f4;return function(_0x39411d){logger[_0x025e('0x28')](_0x39411d[_0x025e('0x29')]);if(_0x39411d[_0x025e('0x2a')]){delete _0x39411d[_0x025e('0x2a')];}_0x2824dc[_0x025e('0x1b')](_0x3eb24f)[_0x025e('0x2b')](_0x39411d);};}exports[_0x025e('0x2c')]=function(_0x4c1da6,_0x49f0d5){var _0x3736a3={},_0x43a1b4={},_0x3723ae={'count':0x0,'rows':[]};var _0x159558=_[_0x025e('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x13e9eb){return{'name':_0x13e9eb[_0x025e('0x2e')],'type':_0x13e9eb[_0x025e('0x2f')][_0x025e('0x30')]};});_0x43a1b4[_0x025e('0x31')]=_[_0x025e('0x2d')](_0x159558,'name');_0x43a1b4[_0x025e('0x32')]=_[_0x025e('0x33')](_0x4c1da6[_0x025e('0x32')]);_0x43a1b4[_0x025e('0x34')]=_['intersection'](_0x43a1b4[_0x025e('0x31')],_0x43a1b4[_0x025e('0x32')]);_0x3736a3[_0x025e('0x35')]=_['intersection'](_0x43a1b4[_0x025e('0x31')],qs[_0x025e('0x36')](_0x4c1da6[_0x025e('0x32')][_0x025e('0x36')]));_0x3736a3[_0x025e('0x35')]=_0x3736a3[_0x025e('0x35')][_0x025e('0x37')]?_0x3736a3[_0x025e('0x35')]:_0x43a1b4['model'];if(!_0x4c1da6[_0x025e('0x32')][_0x025e('0x38')](_0x025e('0x39'))){_0x3736a3['limit']=qs[_0x025e('0x1c')](_0x4c1da6[_0x025e('0x32')][_0x025e('0x1c')]);_0x3736a3['offset']=qs[_0x025e('0x1e')](_0x4c1da6[_0x025e('0x32')]['offset']);}_0x3736a3['order']=qs[_0x025e('0x3a')](_0x4c1da6[_0x025e('0x32')][_0x025e('0x3a')]);_0x3736a3['where']=qs['filters'](_[_0x025e('0x3b')](_0x4c1da6['query'],_0x43a1b4[_0x025e('0x34')]),_0x159558);if(_0x4c1da6[_0x025e('0x32')][_0x025e('0x3c')]){_0x3736a3['where']=_[_0x025e('0x3d')](_0x3736a3[_0x025e('0x3e')],{'$or':_[_0x025e('0x2d')](_0x159558,function(_0x4cb550){if(_0x4cb550[_0x025e('0x2f')]!=='VIRTUAL'){var _0x6f8e34={};_0x6f8e34[_0x4cb550[_0x025e('0x2a')]]={'$like':'%'+_0x4c1da6[_0x025e('0x32')]['filter']+'%'};return _0x6f8e34;}})});}_0x3736a3=_[_0x025e('0x3d')]({},_0x3736a3,_0x4c1da6['options']);var _0x3d579f={'where':_0x3736a3[_0x025e('0x3e')]};return db[_0x025e('0x3f')][_0x025e('0x1f')](_0x3d579f)[_0x025e('0x26')](function(_0xa29b62){_0x3723ae[_0x025e('0x1f')]=_0xa29b62;if(_0x4c1da6[_0x025e('0x32')][_0x025e('0x40')]){_0x3736a3[_0x025e('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x025e('0x42')](_0x3736a3);})[_0x025e('0x26')](function(_0x2044f4){_0x3723ae[_0x025e('0x43')]=_0x2044f4;return _0x3723ae;})['then'](respondWithFilteredResult(_0x49f0d5,_0x3736a3))[_0x025e('0x44')](handleError(_0x49f0d5,null));};exports[_0x025e('0x45')]=function(_0x333da8,_0x37897b){var _0x3c2899={'raw':![],'where':{'id':_0x333da8[_0x025e('0x46')]['id']}},_0x430ee8={};_0x430ee8[_0x025e('0x31')]=_['keys'](db['VoiceQueueReport'][_0x025e('0x47')]);_0x430ee8[_0x025e('0x32')]=_[_0x025e('0x33')](_0x333da8[_0x025e('0x32')]);_0x430ee8[_0x025e('0x34')]=_['intersection'](_0x430ee8[_0x025e('0x31')],_0x430ee8['query']);_0x3c2899[_0x025e('0x35')]=_[_0x025e('0x48')](_0x430ee8[_0x025e('0x31')],qs[_0x025e('0x36')](_0x333da8[_0x025e('0x32')]['fields']));_0x3c2899['attributes']=_0x3c2899['attributes'][_0x025e('0x37')]?_0x3c2899[_0x025e('0x35')]:_0x430ee8[_0x025e('0x31')];if(_0x333da8[_0x025e('0x32')]['includeAll']){_0x3c2899[_0x025e('0x41')]=[{'all':!![]}];}_0x3c2899=_[_0x025e('0x3d')]({},_0x3c2899,_0x333da8[_0x025e('0x49')]);return db[_0x025e('0x3f')]['find'](_0x3c2899)[_0x025e('0x26')](handleEntityNotFound(_0x37897b,null))[_0x025e('0x26')](respondWithResult(_0x37897b,null))[_0x025e('0x44')](handleError(_0x37897b,null));};exports[_0x025e('0x4a')]=function(_0x2463c,_0x303697){return db[_0x025e('0x3f')][_0x025e('0x4a')](_0x2463c[_0x025e('0x4b')],{})[_0x025e('0x26')](respondWithResult(_0x303697,0xc9))[_0x025e('0x44')](handleError(_0x303697,null));};exports[_0x025e('0x24')]=function(_0x4a5fe7,_0x1970f3){if(_0x4a5fe7['body']['id']){delete _0x4a5fe7['body']['id'];}return db[_0x025e('0x3f')][_0x025e('0x4c')]({'where':{'id':_0x4a5fe7[_0x025e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1970f3,null))[_0x025e('0x26')](saveUpdates(_0x4a5fe7[_0x025e('0x4b')],null))[_0x025e('0x26')](respondWithResult(_0x1970f3,null))['catch'](handleError(_0x1970f3,null));};exports[_0x025e('0x25')]=function(_0x51c41b,_0x379b5f){return db[_0x025e('0x3f')][_0x025e('0x4c')]({'where':{'id':_0x51c41b[_0x025e('0x46')]['id']}})['then'](handleEntityNotFound(_0x379b5f,null))[_0x025e('0x26')](removeEntity(_0x379b5f,null))['catch'](handleError(_0x379b5f,null));};exports[_0x025e('0x4d')]=function(_0x503a3d,_0x649e){return db[_0x025e('0x3f')][_0x025e('0x4d')]()[_0x025e('0x26')](respondWithResult(_0x649e,null))[_0x025e('0x44')](handleError(_0x649e,null));};exports[_0x025e('0x4e')]=function(_0x125ce9,_0x5032e9){var _0x2a5582={},_0x316a4e={},_0x599ff3={'count':0x0,'rows':[]};_0x316a4e[_0x025e('0x31')]=_['keys'](db['VoiceQueueReport'][_0x025e('0x47')]);_0x316a4e[_0x025e('0x32')]=_['keys'](_0x125ce9[_0x025e('0x32')]);_0x316a4e[_0x025e('0x34')]=_['intersection'](_0x316a4e[_0x025e('0x31')],_0x316a4e[_0x025e('0x32')]);_0x2a5582[_0x025e('0x35')]=_[_0x025e('0x48')](_0x316a4e[_0x025e('0x31')],qs[_0x025e('0x36')](_0x125ce9[_0x025e('0x32')]['fields']));_0x2a5582['attributes']=_0x2a5582[_0x025e('0x35')][_0x025e('0x37')]?_0x2a5582[_0x025e('0x35')]:_0x316a4e[_0x025e('0x31')];if(!_0x125ce9[_0x025e('0x32')]['hasOwnProperty'](_0x025e('0x39'))){_0x2a5582[_0x025e('0x1c')]=qs[_0x025e('0x1c')](_0x125ce9['query'][_0x025e('0x1c')]);_0x2a5582[_0x025e('0x1e')]=qs[_0x025e('0x1e')](_0x125ce9['query'][_0x025e('0x1e')]);}_0x2a5582[_0x025e('0x4f')]=qs['sort'](_0x125ce9[_0x025e('0x32')]['sort']);_0x2a5582['where']=qs[_0x025e('0x34')](_[_0x025e('0x3b')](_0x125ce9[_0x025e('0x32')],_0x316a4e[_0x025e('0x34')]));if(_0x125ce9['query'][_0x025e('0x3c')]){_0x2a5582['where']=_[_0x025e('0x3d')](_0x2a5582[_0x025e('0x3e')],{'$or':_[_0x025e('0x2d')](_0x2a5582[_0x025e('0x35')],function(_0x21c327){var _0x1c2564={};_0x1c2564[_0x21c327]={'$like':'%'+_0x125ce9[_0x025e('0x32')]['filter']+'%'};return _0x1c2564;})});}_0x2a5582=_[_0x025e('0x3d')]({},_0x2a5582,_0x125ce9['options']);var _0x22dd12={'where':_0x2a5582[_0x025e('0x3e')]};return db[_0x025e('0x3f')][_0x025e('0x1f')](_0x22dd12)[_0x025e('0x26')](function(_0x53dcc5){_0x599ff3[_0x025e('0x1f')]=_0x53dcc5;if(_0x125ce9['query'][_0x025e('0x40')]){_0x2a5582[_0x025e('0x41')]=[{'all':!![]}];}return db[_0x025e('0x3f')][_0x025e('0x42')](_0x2a5582);})[_0x025e('0x26')](function(_0x562e67){_0x599ff3['rows']=_0x562e67;return _0x599ff3;})[_0x025e('0x26')](respondWithFilteredResult(_0x5032e9,_0x2a5582,_0x025e('0x4e')))[_0x025e('0x44')](handleError(_0x5032e9,null,_0x025e('0x4e')));}; \ No newline at end of file +var _0x2fac=['status','offset','undefined','limit','count','Content-Range','json','apply','update','then','end','sendStatus','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','describe','getVoiceQueuesReport','rawAttributes','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register'];(function(_0x547604,_0x42b276){var _0x5c50d2=function(_0x4b33c1){while(--_0x4b33c1){_0x547604['push'](_0x547604['shift']());}};_0x5c50d2(++_0x42b276);}(_0x2fac,0x180));var _0xc2fa=function(_0x2b953d,_0x3054f4){_0x2b953d=_0x2b953d-0x0;var _0x2f3cab=_0x2fac[_0x2b953d];return _0x2f3cab;};'use strict';var emlformat=require(_0xc2fa('0x0'));var rimraf=require(_0xc2fa('0x1'));var zipdir=require(_0xc2fa('0x2'));var jsonpatch=require(_0xc2fa('0x3'));var rp=require(_0xc2fa('0x4'));var moment=require(_0xc2fa('0x5'));var BPromise=require(_0xc2fa('0x6'));var Mustache=require('mustache');var util=require(_0xc2fa('0x7'));var path=require(_0xc2fa('0x8'));var sox=require('sox');var csv=require(_0xc2fa('0x9'));var ejs=require(_0xc2fa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc2fa('0xb'));var crypto=require(_0xc2fa('0xc'));var jsforce=require(_0xc2fa('0xd'));var deskjs=require(_0xc2fa('0xe'));var toCsv=require(_0xc2fa('0x9'));var querystring=require('querystring');var Papa=require(_0xc2fa('0xf'));var Redis=require(_0xc2fa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc2fa('0x11'));var as=require(_0xc2fa('0x12'));var hardwareService=require(_0xc2fa('0x13'));var logger=require(_0xc2fa('0x14'))(_0xc2fa('0x15'));var utils=require(_0xc2fa('0x16'));var config=require(_0xc2fa('0x17'));var licenseUtil=require(_0xc2fa('0x18'));var db=require(_0xc2fa('0x19'))['db'];config[_0xc2fa('0x1a')]=_['defaults'](config['redis'],{'host':_0xc2fa('0x1b'),'port':0x18eb});var socket=require(_0xc2fa('0x1c'))(new Redis(config[_0xc2fa('0x1a')]));require(_0xc2fa('0x1d'))[_0xc2fa('0x1e')](socket);function respondWithStatusCode(_0x3f3f95,_0x2f82ad){_0x2f82ad=_0x2f82ad||0xcc;return function(_0x3a9812){if(_0x3a9812){return _0x3f3f95['sendStatus'](_0x2f82ad);}return _0x3f3f95['status'](_0x2f82ad)['end']();};}function respondWithResult(_0x20881b,_0x2b5eed){_0x2b5eed=_0x2b5eed||0xc8;return function(_0x2db63d){if(_0x2db63d){return _0x20881b[_0xc2fa('0x1f')](_0x2b5eed)['json'](_0x2db63d);}};}function respondWithFilteredResult(_0x3dc450,_0x4ce2a8){return function(_0x313da1){if(_0x313da1){var _0xdebb75=typeof _0x4ce2a8[_0xc2fa('0x20')]===_0xc2fa('0x21')&&typeof _0x4ce2a8[_0xc2fa('0x22')]===_0xc2fa('0x21');var _0x4db95b=_0x313da1[_0xc2fa('0x23')];var _0x5b0cb0=_0xdebb75?0x0:_0x4ce2a8[_0xc2fa('0x20')];var _0x18676a=_0xdebb75?_0x313da1[_0xc2fa('0x23')]:_0x4ce2a8['offset']+_0x4ce2a8[_0xc2fa('0x22')];var _0x13baea;if(_0x18676a>=_0x4db95b){_0x18676a=_0x4db95b;_0x13baea=0xc8;}else{_0x13baea=0xce;}_0x3dc450[_0xc2fa('0x1f')](_0x13baea);return _0x3dc450['set'](_0xc2fa('0x24'),_0x5b0cb0+'-'+_0x18676a+'/'+_0x4db95b)[_0xc2fa('0x25')](_0x313da1);}return null;};}function patchUpdates(_0x3e067a){return function(_0x41e165){try{jsonpatch[_0xc2fa('0x26')](_0x41e165,_0x3e067a,!![]);}catch(_0x2e028a){return BPromise['reject'](_0x2e028a);}return _0x41e165['save']();};}function saveUpdates(_0x196701,_0x52e236){return function(_0x3aea48){if(_0x3aea48){return _0x3aea48[_0xc2fa('0x27')](_0x196701)[_0xc2fa('0x28')](function(_0x1fa452){return _0x1fa452;});}return null;};}function removeEntity(_0x42ebb3,_0x196f12){return function(_0x17b175){if(_0x17b175){return _0x17b175['destroy']()[_0xc2fa('0x28')](function(){_0x42ebb3[_0xc2fa('0x1f')](0xcc)[_0xc2fa('0x29')]();});}};}function handleEntityNotFound(_0x28dea3,_0x29eb3a){return function(_0x24ea3e){if(!_0x24ea3e){_0x28dea3[_0xc2fa('0x2a')](0x194);}return _0x24ea3e;};}function handleError(_0x115f02,_0x1f8efd){_0x1f8efd=_0x1f8efd||0x1f4;return function(_0x49dd61){logger['error'](_0x49dd61[_0xc2fa('0x2b')]);if(_0x49dd61[_0xc2fa('0x2c')]){delete _0x49dd61[_0xc2fa('0x2c')];}_0x115f02[_0xc2fa('0x1f')](_0x1f8efd)[_0xc2fa('0x2d')](_0x49dd61);};}exports[_0xc2fa('0x2e')]=function(_0xb451ca,_0x2d32d8){var _0x12c3b8={},_0x5a80e9={},_0x5bfabe={'count':0x0,'rows':[]};var _0x1d8eb6=_[_0xc2fa('0x2f')](db[_0xc2fa('0x30')]['rawAttributes'],function(_0x266830){return{'name':_0x266830[_0xc2fa('0x31')],'type':_0x266830[_0xc2fa('0x32')][_0xc2fa('0x33')]};});_0x5a80e9[_0xc2fa('0x34')]=_[_0xc2fa('0x2f')](_0x1d8eb6,_0xc2fa('0x2c'));_0x5a80e9['query']=_[_0xc2fa('0x35')](_0xb451ca[_0xc2fa('0x36')]);_0x5a80e9[_0xc2fa('0x37')]=_[_0xc2fa('0x38')](_0x5a80e9[_0xc2fa('0x34')],_0x5a80e9['query']);_0x12c3b8[_0xc2fa('0x39')]=_[_0xc2fa('0x38')](_0x5a80e9[_0xc2fa('0x34')],qs['fields'](_0xb451ca['query'][_0xc2fa('0x3a')]));_0x12c3b8[_0xc2fa('0x39')]=_0x12c3b8[_0xc2fa('0x39')][_0xc2fa('0x3b')]?_0x12c3b8['attributes']:_0x5a80e9['model'];if(!_0xb451ca['query'][_0xc2fa('0x3c')](_0xc2fa('0x3d'))){_0x12c3b8[_0xc2fa('0x22')]=qs[_0xc2fa('0x22')](_0xb451ca['query'][_0xc2fa('0x22')]);_0x12c3b8[_0xc2fa('0x20')]=qs[_0xc2fa('0x20')](_0xb451ca[_0xc2fa('0x36')][_0xc2fa('0x20')]);}_0x12c3b8[_0xc2fa('0x3e')]=qs[_0xc2fa('0x3f')](_0xb451ca[_0xc2fa('0x36')][_0xc2fa('0x3f')]);_0x12c3b8[_0xc2fa('0x40')]=qs['filters'](_['pick'](_0xb451ca[_0xc2fa('0x36')],_0x5a80e9['filters']),_0x1d8eb6);if(_0xb451ca['query'][_0xc2fa('0x41')]){_0x12c3b8['where']=_[_0xc2fa('0x42')](_0x12c3b8['where'],{'$or':_[_0xc2fa('0x2f')](_0x1d8eb6,function(_0x3a6015){if(_0x3a6015[_0xc2fa('0x32')]!==_0xc2fa('0x43')){var _0x311029={};_0x311029[_0x3a6015[_0xc2fa('0x2c')]]={'$like':'%'+_0xb451ca[_0xc2fa('0x36')][_0xc2fa('0x41')]+'%'};return _0x311029;}})});}_0x12c3b8=_['merge']({},_0x12c3b8,_0xb451ca[_0xc2fa('0x44')]);var _0x530ee5={'where':_0x12c3b8['where']};return db[_0xc2fa('0x30')][_0xc2fa('0x23')](_0x530ee5)['then'](function(_0x4758e5){_0x5bfabe[_0xc2fa('0x23')]=_0x4758e5;if(_0xb451ca['query'][_0xc2fa('0x45')]){_0x12c3b8[_0xc2fa('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xc2fa('0x47')](_0x12c3b8);})['then'](function(_0x3b7b79){_0x5bfabe[_0xc2fa('0x48')]=_0x3b7b79;return _0x5bfabe;})[_0xc2fa('0x28')](respondWithFilteredResult(_0x2d32d8,_0x12c3b8))[_0xc2fa('0x49')](handleError(_0x2d32d8,null));};exports['show']=function(_0x598d5d,_0x304acd){var _0x372b15={'raw':![],'where':{'id':_0x598d5d['params']['id']}},_0x1fdee9={};_0x1fdee9['model']=_[_0xc2fa('0x35')](db['VoiceQueueReport']['rawAttributes']);_0x1fdee9[_0xc2fa('0x36')]=_[_0xc2fa('0x35')](_0x598d5d[_0xc2fa('0x36')]);_0x1fdee9[_0xc2fa('0x37')]=_[_0xc2fa('0x38')](_0x1fdee9['model'],_0x1fdee9[_0xc2fa('0x36')]);_0x372b15[_0xc2fa('0x39')]=_[_0xc2fa('0x38')](_0x1fdee9[_0xc2fa('0x34')],qs[_0xc2fa('0x3a')](_0x598d5d[_0xc2fa('0x36')]['fields']));_0x372b15[_0xc2fa('0x39')]=_0x372b15[_0xc2fa('0x39')][_0xc2fa('0x3b')]?_0x372b15[_0xc2fa('0x39')]:_0x1fdee9[_0xc2fa('0x34')];if(_0x598d5d[_0xc2fa('0x36')]['includeAll']){_0x372b15[_0xc2fa('0x46')]=[{'all':!![]}];}_0x372b15=_[_0xc2fa('0x42')]({},_0x372b15,_0x598d5d[_0xc2fa('0x44')]);return db['VoiceQueueReport'][_0xc2fa('0x4a')](_0x372b15)[_0xc2fa('0x28')](handleEntityNotFound(_0x304acd,null))[_0xc2fa('0x28')](respondWithResult(_0x304acd,null))['catch'](handleError(_0x304acd,null));};exports[_0xc2fa('0x4b')]=function(_0x510d8e,_0x23ff85){return db[_0xc2fa('0x30')][_0xc2fa('0x4b')](_0x510d8e[_0xc2fa('0x4c')],{})['then'](respondWithResult(_0x23ff85,0xc9))['catch'](handleError(_0x23ff85,null));};exports['update']=function(_0xebce9d,_0x4f477e){if(_0xebce9d[_0xc2fa('0x4c')]['id']){delete _0xebce9d['body']['id'];}return db[_0xc2fa('0x30')][_0xc2fa('0x4a')]({'where':{'id':_0xebce9d[_0xc2fa('0x4d')]['id']}})[_0xc2fa('0x28')](handleEntityNotFound(_0x4f477e,null))['then'](saveUpdates(_0xebce9d[_0xc2fa('0x4c')],null))[_0xc2fa('0x28')](respondWithResult(_0x4f477e,null))['catch'](handleError(_0x4f477e,null));};exports[_0xc2fa('0x4e')]=function(_0x187513,_0x4aa7bb){return db[_0xc2fa('0x30')][_0xc2fa('0x4a')]({'where':{'id':_0x187513[_0xc2fa('0x4d')]['id']}})[_0xc2fa('0x28')](handleEntityNotFound(_0x4aa7bb,null))[_0xc2fa('0x28')](removeEntity(_0x4aa7bb,null))[_0xc2fa('0x49')](handleError(_0x4aa7bb,null));};exports[_0xc2fa('0x4f')]=function(_0x517c7e,_0x1cd626){return db[_0xc2fa('0x30')][_0xc2fa('0x4f')]()['then'](respondWithResult(_0x1cd626,null))['catch'](handleError(_0x1cd626,null));};exports[_0xc2fa('0x50')]=function(_0x390c7d,_0x3ced03){var _0x2ac284={},_0x2c9979={},_0x50aeb0={'count':0x0,'rows':[]};_0x2c9979['model']=_[_0xc2fa('0x35')](db[_0xc2fa('0x30')][_0xc2fa('0x51')]);_0x2c9979[_0xc2fa('0x36')]=_[_0xc2fa('0x35')](_0x390c7d[_0xc2fa('0x36')]);_0x2c9979[_0xc2fa('0x37')]=_[_0xc2fa('0x38')](_0x2c9979[_0xc2fa('0x34')],_0x2c9979[_0xc2fa('0x36')]);_0x2ac284['attributes']=_['intersection'](_0x2c9979[_0xc2fa('0x34')],qs[_0xc2fa('0x3a')](_0x390c7d[_0xc2fa('0x36')]['fields']));_0x2ac284[_0xc2fa('0x39')]=_0x2ac284['attributes'][_0xc2fa('0x3b')]?_0x2ac284['attributes']:_0x2c9979[_0xc2fa('0x34')];if(!_0x390c7d[_0xc2fa('0x36')][_0xc2fa('0x3c')](_0xc2fa('0x3d'))){_0x2ac284[_0xc2fa('0x22')]=qs['limit'](_0x390c7d[_0xc2fa('0x36')][_0xc2fa('0x22')]);_0x2ac284['offset']=qs[_0xc2fa('0x20')](_0x390c7d[_0xc2fa('0x36')][_0xc2fa('0x20')]);}_0x2ac284['order']=qs[_0xc2fa('0x3f')](_0x390c7d[_0xc2fa('0x36')]['sort']);_0x2ac284[_0xc2fa('0x40')]=qs[_0xc2fa('0x37')](_[_0xc2fa('0x52')](_0x390c7d[_0xc2fa('0x36')],_0x2c9979[_0xc2fa('0x37')]));if(_0x390c7d[_0xc2fa('0x36')][_0xc2fa('0x41')]){_0x2ac284['where']=_[_0xc2fa('0x42')](_0x2ac284[_0xc2fa('0x40')],{'$or':_[_0xc2fa('0x2f')](_0x2ac284['attributes'],function(_0x3c715e){var _0x33df71={};_0x33df71[_0x3c715e]={'$like':'%'+_0x390c7d[_0xc2fa('0x36')][_0xc2fa('0x41')]+'%'};return _0x33df71;})});}_0x2ac284=_['merge']({},_0x2ac284,_0x390c7d['options']);var _0x4420a5={'where':_0x2ac284[_0xc2fa('0x40')]};return db[_0xc2fa('0x30')]['count'](_0x4420a5)[_0xc2fa('0x28')](function(_0x2b7fc2){_0x50aeb0['count']=_0x2b7fc2;if(_0x390c7d[_0xc2fa('0x36')][_0xc2fa('0x45')]){_0x2ac284[_0xc2fa('0x46')]=[{'all':!![]}];}return db[_0xc2fa('0x30')][_0xc2fa('0x47')](_0x2ac284);})[_0xc2fa('0x28')](function(_0xd743a9){_0x50aeb0['rows']=_0xd743a9;return _0x50aeb0;})[_0xc2fa('0x28')](respondWithFilteredResult(_0x3ced03,_0x2ac284,'getVoiceQueuesReport'))[_0xc2fa('0x49')](handleError(_0x3ced03,null,_0xc2fa('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 967cc8b..d95c6c2 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 _0xdec1=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4b5a4b,_0x1b116b){var _0x27dae8=function(_0x5557a3){while(--_0x5557a3){_0x4b5a4b['push'](_0x4b5a4b['shift']());}};_0x27dae8(++_0x1b116b);}(_0xdec1,0x11f));var _0x1dec=function(_0x365d5c,_0x17a9af){_0x365d5c=_0x365d5c-0x0;var _0x1c146a=_0xdec1[_0x365d5c];return _0x1c146a;};'use strict';var EventEmitter=require(_0x1dec('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1dec('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1dec('0x2')](0x0);var events={'afterCreate':_0x1dec('0x3'),'afterUpdate':_0x1dec('0x4'),'afterDestroy':_0x1dec('0x5')};function emitEvent(_0x4e14b9){return function(_0x2f9165,_0x55ddd8,_0x442e75){VoiceQueueReportEvents[_0x1dec('0x6')](_0x4e14b9+':'+_0x2f9165['id'],_0x2f9165);VoiceQueueReportEvents['emit'](_0x4e14b9,_0x2f9165);_0x442e75(null);};}for(var e in events){if(events[_0x1dec('0x7')](e)){var event=events[e];VoiceQueueReport[_0x1dec('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x44f9=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0x44f9,0x133));var _0x944f=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x44f9[_0x487b0c];return _0x1adbdc;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x944f('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x944f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x944f('0x2'),'afterDestroy':_0x944f('0x3')};function emitEvent(_0x3a2eaf){return function(_0x29bbdc,_0x2cba03,_0x538683){VoiceQueueReportEvents['emit'](_0x3a2eaf+':'+_0x29bbdc['id'],_0x29bbdc);VoiceQueueReportEvents[_0x944f('0x4')](_0x3a2eaf,_0x29bbdc);_0x538683(null);};}for(var e in events){if(events[_0x944f('0x5')](e)){var event=events[e];VoiceQueueReport[_0x944f('0x6')](e,emitEvent(event));}}module[_0x944f('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3e2f585..b99250c 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 _0x3116=['bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','moment'];(function(_0x285e8f,_0x446cfd){var _0x2c63a1=function(_0xf70392){while(--_0xf70392){_0x285e8f['push'](_0x285e8f['shift']());}};_0x2c63a1(++_0x446cfd);}(_0x3116,0x165));var _0x6311=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x3116[_0x54d4a8];return _0x3b321b;};'use strict';var _=require('lodash');var util=require(_0x6311('0x0'));var logger=require(_0x6311('0x1'))('api');var moment=require(_0x6311('0x2'));var BPromise=require(_0x6311('0x3'));var rp=require(_0x6311('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6311('0x5'));var attributes=require(_0x6311('0x6'));module[_0x6311('0x7')]=function(_0x507964,_0xa3dbdf){return _0x507964[_0x6311('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x6311('0x9'),'paranoid':![],'indexes':[{'fields':[_0x6311('0xa')]},{'fields':[_0x6311('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd3c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','util','../../config/logger'];(function(_0x5eecb6,_0x1418e6){var _0x59f3be=function(_0x1abac5){while(--_0x1abac5){_0x5eecb6['push'](_0x5eecb6['shift']());}};_0x59f3be(++_0x1418e6);}(_0xbd3c,0x184));var _0xcbd3=function(_0x23e5c3,_0x49d2d7){_0x23e5c3=_0x23e5c3-0x0;var _0x1d4960=_0xbd3c[_0x23e5c3];return _0x1d4960;};'use strict';var _=require('lodash');var util=require(_0xcbd3('0x0'));var logger=require(_0xcbd3('0x1'))(_0xcbd3('0x2'));var moment=require(_0xcbd3('0x3'));var BPromise=require(_0xcbd3('0x4'));var rp=require(_0xcbd3('0x5'));var fs=require('fs');var path=require(_0xcbd3('0x6'));var rimraf=require(_0xcbd3('0x7'));var config=require(_0xcbd3('0x8'));var attributes=require(_0xcbd3('0x9'));module[_0xcbd3('0xa')]=function(_0x3259f4,_0x437b5c){return _0x3259f4[_0xcbd3('0xb')](_0xcbd3('0xc'),attributes,{'tableName':_0xcbd3('0xd'),'paranoid':![],'indexes':[{'fields':[_0xcbd3('0xe')]},{'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 46109d5..2ae6ffb 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 _0xfd16=['debug','UpdateVoiceQueueReport','body','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','VoiceQueueReport','create','CreateVoiceQueueReport'];(function(_0x4ac1d4,_0x426667){var _0x48b460=function(_0x50961a){while(--_0x50961a){_0x4ac1d4['push'](_0x4ac1d4['shift']());}};_0x48b460(++_0x426667);}(_0xfd16,0xa3));var _0x6fd1=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xfd16[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x6fd1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6fd1('0x1'));var rs=require(_0x6fd1('0x2'));var fs=require('fs');var Redis=require(_0x6fd1('0x3'));var db=require(_0x6fd1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fd1('0x5'))(_0x6fd1('0x6'));var config=require('../../config/environment');var jayson=require(_0x6fd1('0x7'));var client=jayson[_0x6fd1('0x8')]['http']({'port':0x232a});config[_0x6fd1('0x9')]=_[_0x6fd1('0xa')](config[_0x6fd1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fd1('0xb'))(new Redis(config[_0x6fd1('0x9')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x4afe47,_0x4abe1e,_0x2767dd){return new BPromise(function(_0xaa369d,_0xdd4b56){return client[_0x6fd1('0xc')](_0x4afe47,_0x2767dd)[_0x6fd1('0xd')](function(_0x5525f1){logger[_0x6fd1('0xe')](_0x6fd1('0xf'),_0x4abe1e,_0x6fd1('0x10'));logger['debug'](_0x6fd1('0x11'),_0x4abe1e,'request\x20sent',JSON[_0x6fd1('0x12')](_0x5525f1));if(_0x5525f1[_0x6fd1('0x13')]){if(_0x5525f1['error'][_0x6fd1('0x14')]===0x1f4){logger['error'](_0x6fd1('0xf'),_0x4abe1e,_0x5525f1[_0x6fd1('0x13')][_0x6fd1('0x15')]);return _0xdd4b56(_0x5525f1[_0x6fd1('0x13')][_0x6fd1('0x15')]);}logger[_0x6fd1('0x13')](_0x6fd1('0xf'),_0x4abe1e,_0x5525f1[_0x6fd1('0x13')][_0x6fd1('0x15')]);return _0xaa369d(_0x5525f1[_0x6fd1('0x13')]['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x4abe1e,_0x6fd1('0x10'));_0xaa369d(_0x5525f1[_0x6fd1('0x16')][_0x6fd1('0x15')]);}})[_0x6fd1('0x17')](function(_0x235fa5){logger['error'](_0x6fd1('0xf'),_0x4abe1e,_0x235fa5);_0xdd4b56(_0x235fa5);});});}exports[_0x6fd1('0x18')]=function(_0x1b1d6b){var _0x1f03ba=this;return new Promise(function(_0x1adf3b,_0x33706f){return db['VoiceQueueReport'][_0x6fd1('0x19')]({'raw':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1c')]||null:null,'attributes':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1d')]||null:null,'limit':_0x1b1d6b[_0x6fd1('0x1a')]?_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1e')]||null:null,'include':_0x1b1d6b['options']?_0x1b1d6b['options'][_0x6fd1('0x1f')]?_[_0x6fd1('0x20')](_0x1b1d6b[_0x6fd1('0x1a')][_0x6fd1('0x1f')],function(_0x5bd6ba){return{'model':db[_0x5bd6ba['model']],'as':_0x5bd6ba['as'],'attributes':_0x5bd6ba[_0x6fd1('0x1d')],'include':_0x5bd6ba[_0x6fd1('0x1f')]?_[_0x6fd1('0x20')](_0x5bd6ba[_0x6fd1('0x1f')],function(_0x2721f9){return{'model':db[_0x2721f9[_0x6fd1('0x21')]],'as':_0x2721f9['as'],'attributes':_0x2721f9[_0x6fd1('0x1d')],'include':_0x2721f9[_0x6fd1('0x1f')]?_[_0x6fd1('0x20')](_0x2721f9['include'],function(_0x403f21){return{'model':db[_0x403f21['model']],'as':_0x403f21['as'],'attributes':_0x403f21[_0x6fd1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6fd1('0xd')](function(_0xaa6dc5){logger[_0x6fd1('0xe')](_0x6fd1('0x18'),_0x1b1d6b);logger['debug']('GetVoiceQueueReport',_0x1b1d6b,JSON['stringify'](_0xaa6dc5));_0x1adf3b(_0xaa6dc5);})[_0x6fd1('0x17')](function(_0x2797f2){logger['error'](_0x6fd1('0x18'),_0x2797f2[_0x6fd1('0x15')],_0x1b1d6b);_0x33706f(_0x1f03ba['error'](0x1f4,_0x2797f2[_0x6fd1('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x122f79){var _0x402b39=this;return new Promise(function(_0x2f2866,_0x44f5a){return db[_0x6fd1('0x22')][_0x6fd1('0x23')](_0x122f79['body'],{'raw':_0x122f79['options']?_0x122f79[_0x6fd1('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x6fd1('0xd')](function(_0x22cae2){logger[_0x6fd1('0xe')](_0x6fd1('0x24'),_0x122f79);logger[_0x6fd1('0x25')](_0x6fd1('0x24'),_0x122f79,JSON['stringify'](_0x22cae2));_0x2f2866(_0x22cae2);})[_0x6fd1('0x17')](function(_0x3f63f8){logger[_0x6fd1('0x13')]('CreateVoiceQueueReport',_0x3f63f8[_0x6fd1('0x15')],_0x122f79);_0x44f5a(_0x402b39[_0x6fd1('0x13')](0x1f4,_0x3f63f8['message']));});});};exports[_0x6fd1('0x26')]=function(_0x2c11e8){var _0x5acac5=this;return new Promise(function(_0x13ec1d,_0x1a2fb7){return db['VoiceQueueReport']['update'](_0x2c11e8[_0x6fd1('0x27')],{'raw':_0x2c11e8['options']?_0x2c11e8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c11e8[_0x6fd1('0x1a')]?_0x2c11e8[_0x6fd1('0x1a')]['where']||null:null,'attributes':_0x2c11e8[_0x6fd1('0x1a')]?_0x2c11e8[_0x6fd1('0x1a')][_0x6fd1('0x1d')]||null:null,'limit':_0x2c11e8[_0x6fd1('0x1a')]?_0x2c11e8['options']['limit']||null:null})[_0x6fd1('0xd')](function(_0x4207c1){logger[_0x6fd1('0xe')](_0x6fd1('0x26'),_0x2c11e8);logger[_0x6fd1('0x25')](_0x6fd1('0x26'),_0x2c11e8,JSON[_0x6fd1('0x12')](_0x4207c1));_0x13ec1d(_0x4207c1);})[_0x6fd1('0x17')](function(_0xa1d6d7){logger[_0x6fd1('0x13')](_0x6fd1('0x26'),_0xa1d6d7[_0x6fd1('0x15')],_0x2c11e8);_0x1a2fb7(_0x5acac5[_0x6fd1('0x13')](0x1f4,_0xa1d6d7['message']));});});}; \ No newline at end of file +var _0x0042=['message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','CreateVoiceQueueReport','create','raw','stringify','UpdateVoiceQueueReport','body','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0042,0x1f2));var _0x2004=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x0042[_0x1655bb];return _0x5e2020;};'use strict';var _=require('lodash');var util=require(_0x2004('0x0'));var moment=require(_0x2004('0x1'));var BPromise=require('bluebird');var rs=require(_0x2004('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2004('0x3'))['db'];var utils=require(_0x2004('0x4'));var logger=require(_0x2004('0x5'))(_0x2004('0x6'));var config=require(_0x2004('0x7'));var jayson=require(_0x2004('0x8'));var client=jayson[_0x2004('0x9')]['http']({'port':0x232a});config[_0x2004('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2004('0xb'))(new Redis(config['redis']));require(_0x2004('0xc'))['register'](socket);function respondWithRpcPromise(_0x471c9f,_0x32af39,_0x1cbc81){return new BPromise(function(_0x2a4799,_0x449601){return client[_0x2004('0xd')](_0x471c9f,_0x1cbc81)[_0x2004('0xe')](function(_0x468020){logger[_0x2004('0xf')](_0x2004('0x10'),_0x32af39,_0x2004('0x11'));logger[_0x2004('0x12')](_0x2004('0x13'),_0x32af39,_0x2004('0x11'),JSON['stringify'](_0x468020));if(_0x468020[_0x2004('0x14')]){if(_0x468020['error'][_0x2004('0x15')]===0x1f4){logger['error'](_0x2004('0x10'),_0x32af39,_0x468020[_0x2004('0x14')][_0x2004('0x16')]);return _0x449601(_0x468020['error'][_0x2004('0x16')]);}logger[_0x2004('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x32af39,_0x468020['error'][_0x2004('0x16')]);return _0x2a4799(_0x468020[_0x2004('0x14')][_0x2004('0x16')]);}else{logger[_0x2004('0xf')](_0x2004('0x10'),_0x32af39,_0x2004('0x11'));_0x2a4799(_0x468020[_0x2004('0x17')][_0x2004('0x16')]);}})[_0x2004('0x18')](function(_0x5cc119){logger[_0x2004('0x14')](_0x2004('0x10'),_0x32af39,_0x5cc119);_0x449601(_0x5cc119);});});}exports[_0x2004('0x19')]=function(_0x22221c){var _0x3b2cde=this;return new Promise(function(_0x4786b4,_0x62464b){return db[_0x2004('0x1a')][_0x2004('0x1b')]({'raw':_0x22221c[_0x2004('0x1c')]?_0x22221c[_0x2004('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22221c[_0x2004('0x1c')]?_0x22221c[_0x2004('0x1c')][_0x2004('0x1d')]||null:null,'attributes':_0x22221c['options']?_0x22221c[_0x2004('0x1c')][_0x2004('0x1e')]||null:null,'limit':_0x22221c[_0x2004('0x1c')]?_0x22221c['options'][_0x2004('0x1f')]||null:null,'include':_0x22221c[_0x2004('0x1c')]?_0x22221c['options'][_0x2004('0x20')]?_['map'](_0x22221c[_0x2004('0x1c')][_0x2004('0x20')],function(_0x50c8f1){return{'model':db[_0x50c8f1[_0x2004('0x21')]],'as':_0x50c8f1['as'],'attributes':_0x50c8f1[_0x2004('0x1e')],'include':_0x50c8f1[_0x2004('0x20')]?_['map'](_0x50c8f1[_0x2004('0x20')],function(_0x3dcc85){return{'model':db[_0x3dcc85['model']],'as':_0x3dcc85['as'],'attributes':_0x3dcc85[_0x2004('0x1e')],'include':_0x3dcc85[_0x2004('0x20')]?_['map'](_0x3dcc85[_0x2004('0x20')],function(_0x4993eb){return{'model':db[_0x4993eb[_0x2004('0x21')]],'as':_0x4993eb['as'],'attributes':_0x4993eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x2004('0xe')](function(_0x142cc1){logger['info'](_0x2004('0x19'),_0x22221c);logger[_0x2004('0x12')]('GetVoiceQueueReport',_0x22221c,JSON['stringify'](_0x142cc1));_0x4786b4(_0x142cc1);})[_0x2004('0x18')](function(_0x5d2f0d){logger['error'](_0x2004('0x19'),_0x5d2f0d[_0x2004('0x16')],_0x22221c);_0x62464b(_0x3b2cde['error'](0x1f4,_0x5d2f0d[_0x2004('0x16')]));});});};exports[_0x2004('0x22')]=function(_0x597a88){var _0x53746d=this;return new Promise(function(_0xdd94ca,_0x1c48c7){return db[_0x2004('0x1a')][_0x2004('0x23')](_0x597a88['body'],{'raw':_0x597a88[_0x2004('0x1c')]?_0x597a88[_0x2004('0x1c')][_0x2004('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x433437){logger[_0x2004('0xf')](_0x2004('0x22'),_0x597a88);logger[_0x2004('0x12')](_0x2004('0x22'),_0x597a88,JSON[_0x2004('0x25')](_0x433437));_0xdd94ca(_0x433437);})['catch'](function(_0x1d6c5d){logger[_0x2004('0x14')]('CreateVoiceQueueReport',_0x1d6c5d[_0x2004('0x16')],_0x597a88);_0x1c48c7(_0x53746d[_0x2004('0x14')](0x1f4,_0x1d6c5d[_0x2004('0x16')]));});});};exports[_0x2004('0x26')]=function(_0x1d9e25){var _0x274af9=this;return new Promise(function(_0x311e6a,_0x323969){return db[_0x2004('0x1a')]['update'](_0x1d9e25[_0x2004('0x27')],{'raw':_0x1d9e25['options']?_0x1d9e25[_0x2004('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9e25[_0x2004('0x1c')]?_0x1d9e25[_0x2004('0x1c')][_0x2004('0x1d')]||null:null,'attributes':_0x1d9e25['options']?_0x1d9e25[_0x2004('0x1c')]['attributes']||null:null,'limit':_0x1d9e25['options']?_0x1d9e25['options']['limit']||null:null})[_0x2004('0xe')](function(_0x4bbc62){logger[_0x2004('0xf')]('UpdateVoiceQueueReport',_0x1d9e25);logger['debug'](_0x2004('0x26'),_0x1d9e25,JSON['stringify'](_0x4bbc62));_0x311e6a(_0x4bbc62);})[_0x2004('0x18')](function(_0x5c09da){logger['error'](_0x2004('0x26'),_0x5c09da[_0x2004('0x16')],_0x1d9e25);_0x323969(_0x274af9[_0x2004('0x14')](0x1f4,_0x5c09da[_0x2004('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c5fedc0..380d6ee 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 _0xb8ca=['save','remove','removeListener','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x5c6218,_0x3496c8){var _0x5beb85=function(_0x57c5c8){while(--_0x57c5c8){_0x5c6218['push'](_0x5c6218['shift']());}};_0x5beb85(++_0x3496c8);}(_0xb8ca,0x89));var _0xab8c=function(_0x23fb16,_0x189597){_0x23fb16=_0x23fb16-0x0;var _0x19c8de=_0xb8ca[_0x23fb16];return _0x19c8de;};'use strict';var VoiceQueueReportEvents=require(_0xab8c('0x0'));var events=[_0xab8c('0x1'),_0xab8c('0x2'),'update'];function createListener(_0x22f9bf,_0x1a2b0a){return function(_0x534d74){_0x1a2b0a['emit'](_0x22f9bf,_0x534d74);};}function removeListener(_0x40c0b4,_0x293bde){return function(){VoiceQueueReportEvents[_0xab8c('0x3')](_0x40c0b4,_0x293bde);};}exports[_0xab8c('0x4')]=function(_0x31cc24){for(var _0x340159=0x0,_0x506335=events['length'];_0x340159<_0x506335;_0x340159++){var _0x32f11f=events[_0x340159];var _0x56f6ac=createListener(_0xab8c('0x5')+_0x32f11f,_0x31cc24);VoiceQueueReportEvents['on'](_0x32f11f,_0x56f6ac);}}; \ No newline at end of file +var _0x6bac=['./voiceQueueReport.events','remove','update','removeListener','length'];(function(_0x3e4d22,_0xc940c){var _0x44e629=function(_0x19fbbe){while(--_0x19fbbe){_0x3e4d22['push'](_0x3e4d22['shift']());}};_0x44e629(++_0xc940c);}(_0x6bac,0xa5));var _0xc6ba=function(_0x80c0ef,_0x175325){_0x80c0ef=_0x80c0ef-0x0;var _0x15dfa1=_0x6bac[_0x80c0ef];return _0x15dfa1;};'use strict';var VoiceQueueReportEvents=require(_0xc6ba('0x0'));var events=['save',_0xc6ba('0x1'),_0xc6ba('0x2')];function createListener(_0xf479c,_0x1869a3){return function(_0x489037){_0x1869a3['emit'](_0xf479c,_0x489037);};}function removeListener(_0x487ef1,_0x378f3d){return function(){VoiceQueueReportEvents[_0xc6ba('0x3')](_0x487ef1,_0x378f3d);};}exports['register']=function(_0x222f20){for(var _0x2a16af=0x0,_0x33167e=events[_0xc6ba('0x4')];_0x2a16af<_0x33167e;_0x2a16af++){var _0x12d6e9=events[_0x2a16af];var _0x1fa2a8=createListener('voiceQueueReport:'+_0x12d6e9,_0x222f20);VoiceQueueReportEvents['on'](_0x12d6e9,_0x1fa2a8);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c393b5d..686a42b 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 _0x9abc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','update','delete','destroy','multer','util','path'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x9abc,0x1e3));var _0xc9ab=function(_0x17a30d,_0x357c97){_0x17a30d=_0x17a30d-0x0;var _0xd9ce9f=_0x9abc[_0x17a30d];return _0xd9ce9f;};'use strict';var multer=require(_0xc9ab('0x0'));var util=require(_0xc9ab('0x1'));var path=require(_0xc9ab('0x2'));var timeout=require(_0xc9ab('0x3'));var express=require(_0xc9ab('0x4'));var router=express[_0xc9ab('0x5')]();var fs_extra=require(_0xc9ab('0x6'));var auth=require(_0xc9ab('0x7'));var interaction=require(_0xc9ab('0x8'));var config=require(_0xc9ab('0x9'));var controller=require('./voiceQueuesLog.controller');router[_0xc9ab('0xa')]('/',auth[_0xc9ab('0xb')](),controller[_0xc9ab('0xc')]);router[_0xc9ab('0xa')](_0xc9ab('0xd'),auth[_0xc9ab('0xb')](),controller['show']);router['post']('/',auth[_0xc9ab('0xb')](),controller[_0xc9ab('0xe')]);router['put'](_0xc9ab('0xd'),auth['isAuthenticated'](),controller[_0xc9ab('0xf')]);router[_0xc9ab('0x10')](_0xc9ab('0xd'),auth[_0xc9ab('0xb')](),controller[_0xc9ab('0x11')]);module['exports']=router; \ No newline at end of file +var _0xade7=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xade7,0xd8));var _0x7ade=function(_0xdca4a6,_0x4965f6){_0xdca4a6=_0xdca4a6-0x0;var _0x5c5b95=_0xade7[_0xdca4a6];return _0x5c5b95;};'use strict';var multer=require(_0x7ade('0x0'));var util=require(_0x7ade('0x1'));var path=require('path');var timeout=require(_0x7ade('0x2'));var express=require(_0x7ade('0x3'));var router=express[_0x7ade('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7ade('0x5'));var config=require(_0x7ade('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x7ade('0x7')]('/',auth[_0x7ade('0x8')](),controller[_0x7ade('0x9')]);router[_0x7ade('0x7')](_0x7ade('0xa'),auth[_0x7ade('0x8')](),controller[_0x7ade('0xb')]);router[_0x7ade('0xc')]('/',auth[_0x7ade('0x8')](),controller[_0x7ade('0xd')]);router[_0x7ade('0xe')]('/:id',auth[_0x7ade('0x8')](),controller['update']);router['delete'](_0x7ade('0xa'),auth[_0x7ade('0x8')](),controller[_0x7ade('0xf')]);module[_0x7ade('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c01389c..acb473f 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 _0x8f76=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2f70b4,_0x53dbb2){var _0x419baf=function(_0x14eaa7){while(--_0x14eaa7){_0x2f70b4['push'](_0x2f70b4['shift']());}};_0x419baf(++_0x53dbb2);}(_0x8f76,0x73));var _0x68f7=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x8f76[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x68f7('0x0'));module[_0x68f7('0x1')]={'time':{'type':Sequelize[_0x68f7('0x2')]},'callid':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x68f7('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x68f7('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x68f7('0x4'))}}; \ No newline at end of file +var _0xad06=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','STRING','DATE'];(function(_0x2b6b98,_0x2d7b8d){var _0x50394c=function(_0x29e6c4){while(--_0x29e6c4){_0x2b6b98['push'](_0x2b6b98['shift']());}};_0x50394c(++_0x2d7b8d);}(_0xad06,0x101));var _0x6ad0=function(_0x567994,_0x37b8fb){_0x567994=_0x567994-0x0;var _0x9da788=_0xad06[_0x567994];return _0x9da788;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6ad0('0x0'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6ad0('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6ad0('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x6ad0('0x3')](_0x6ad0('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a53e2d5..5cfae22 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 _0x3707=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','update','body','find','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x620dbb,_0x2653b6){var _0x396c1e=function(_0x489d7d){while(--_0x489d7d){_0x620dbb['push'](_0x620dbb['shift']());}};_0x396c1e(++_0x2653b6);}(_0x3707,0x92));var _0x7370=function(_0x2f8519,_0x239d7c){_0x2f8519=_0x2f8519-0x0;var _0x897f55=_0x3707[_0x2f8519];return _0x897f55;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7370('0x0'));var jsonpatch=require(_0x7370('0x1'));var rp=require('request-promise');var moment=require(_0x7370('0x2'));var BPromise=require(_0x7370('0x3'));var Mustache=require(_0x7370('0x4'));var util=require(_0x7370('0x5'));var path=require(_0x7370('0x6'));var sox=require(_0x7370('0x7'));var csv=require(_0x7370('0x8'));var ejs=require(_0x7370('0x9'));var fs=require('fs');var fs_extra=require(_0x7370('0xa'));var _=require(_0x7370('0xb'));var squel=require(_0x7370('0xc'));var crypto=require('crypto');var jsforce=require(_0x7370('0xd'));var deskjs=require(_0x7370('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7370('0xf'));var Papa=require(_0x7370('0x10'));var Redis=require('ioredis');var authService=require(_0x7370('0x11'));var qs=require(_0x7370('0x12'));var as=require(_0x7370('0x13'));var hardwareService=require(_0x7370('0x14'));var logger=require(_0x7370('0x15'))(_0x7370('0x16'));var utils=require('../../config/utils');var config=require(_0x7370('0x17'));var licenseUtil=require(_0x7370('0x18'));var db=require(_0x7370('0x19'))['db'];function respondWithStatusCode(_0x5a6da8,_0x510ab8){_0x510ab8=_0x510ab8||0xcc;return function(_0x3b8dec){if(_0x3b8dec){return _0x5a6da8['sendStatus'](_0x510ab8);}return _0x5a6da8[_0x7370('0x1a')](_0x510ab8)[_0x7370('0x1b')]();};}function respondWithResult(_0x185f89,_0x350cdd){_0x350cdd=_0x350cdd||0xc8;return function(_0x1a8c26){if(_0x1a8c26){return _0x185f89[_0x7370('0x1a')](_0x350cdd)[_0x7370('0x1c')](_0x1a8c26);}};}function respondWithFilteredResult(_0x5d479f,_0x2f03ee){return function(_0x5a65e6){if(_0x5a65e6){var _0x51d0ae=typeof _0x2f03ee['offset']==='undefined'&&typeof _0x2f03ee[_0x7370('0x1d')]===_0x7370('0x1e');var _0xbdafe7=_0x5a65e6[_0x7370('0x1f')];var _0x229ddb=_0x51d0ae?0x0:_0x2f03ee[_0x7370('0x20')];var _0xd26c59=_0x51d0ae?_0x5a65e6[_0x7370('0x1f')]:_0x2f03ee[_0x7370('0x20')]+_0x2f03ee[_0x7370('0x1d')];var _0x2d4f52;if(_0xd26c59>=_0xbdafe7){_0xd26c59=_0xbdafe7;_0x2d4f52=0xc8;}else{_0x2d4f52=0xce;}_0x5d479f[_0x7370('0x1a')](_0x2d4f52);return _0x5d479f[_0x7370('0x21')](_0x7370('0x22'),_0x229ddb+'-'+_0xd26c59+'/'+_0xbdafe7)['json'](_0x5a65e6);}return null;};}function patchUpdates(_0x2f2c3a){return function(_0x1be31c){try{jsonpatch['apply'](_0x1be31c,_0x2f2c3a,!![]);}catch(_0x423306){return BPromise[_0x7370('0x23')](_0x423306);}return _0x1be31c[_0x7370('0x24')]();};}function saveUpdates(_0x158664,_0x3f4b2e){return function(_0x52af76){if(_0x52af76){return _0x52af76['update'](_0x158664)[_0x7370('0x25')](function(_0x3f0dcd){return _0x3f0dcd;});}return null;};}function removeEntity(_0x2c00b6,_0x56f87a){return function(_0x1d872e){if(_0x1d872e){return _0x1d872e[_0x7370('0x26')]()['then'](function(){_0x2c00b6['status'](0xcc)[_0x7370('0x1b')]();});}};}function handleEntityNotFound(_0x915765,_0x4041fe){return function(_0xe74863){if(!_0xe74863){_0x915765['sendStatus'](0x194);}return _0xe74863;};}function handleError(_0x18f197,_0x5c5c34){_0x5c5c34=_0x5c5c34||0x1f4;return function(_0x8182d0){logger[_0x7370('0x27')](_0x8182d0[_0x7370('0x28')]);if(_0x8182d0[_0x7370('0x29')]){delete _0x8182d0['name'];}_0x18f197[_0x7370('0x1a')](_0x5c5c34)['send'](_0x8182d0);};}exports[_0x7370('0x2a')]=function(_0x11b9ee,_0x45b57d){var _0x426b55={},_0xcd03be={},_0x3b205a={'count':0x0,'rows':[]};var _0x355f55=_[_0x7370('0x2b')](db[_0x7370('0x2c')][_0x7370('0x2d')],function(_0x33467b){return{'name':_0x33467b[_0x7370('0x2e')],'type':_0x33467b[_0x7370('0x2f')][_0x7370('0x30')]};});_0xcd03be['model']=_[_0x7370('0x2b')](_0x355f55,_0x7370('0x29'));_0xcd03be[_0x7370('0x31')]=_['keys'](_0x11b9ee['query']);_0xcd03be[_0x7370('0x32')]=_[_0x7370('0x33')](_0xcd03be[_0x7370('0x34')],_0xcd03be[_0x7370('0x31')]);_0x426b55[_0x7370('0x35')]=_[_0x7370('0x33')](_0xcd03be[_0x7370('0x34')],qs[_0x7370('0x36')](_0x11b9ee[_0x7370('0x31')][_0x7370('0x36')]));_0x426b55[_0x7370('0x35')]=_0x426b55[_0x7370('0x35')][_0x7370('0x37')]?_0x426b55[_0x7370('0x35')]:_0xcd03be[_0x7370('0x34')];if(!_0x11b9ee[_0x7370('0x31')][_0x7370('0x38')](_0x7370('0x39'))){_0x426b55['limit']=qs[_0x7370('0x1d')](_0x11b9ee[_0x7370('0x31')]['limit']);_0x426b55[_0x7370('0x20')]=qs[_0x7370('0x20')](_0x11b9ee['query']['offset']);}_0x426b55[_0x7370('0x3a')]=qs[_0x7370('0x3b')](_0x11b9ee[_0x7370('0x31')]['sort']);_0x426b55[_0x7370('0x3c')]=qs[_0x7370('0x32')](_[_0x7370('0x3d')](_0x11b9ee[_0x7370('0x31')],_0xcd03be[_0x7370('0x32')]),_0x355f55);if(_0x11b9ee['query'][_0x7370('0x3e')]){_0x426b55[_0x7370('0x3c')]=_[_0x7370('0x3f')](_0x426b55[_0x7370('0x3c')],{'$or':_[_0x7370('0x2b')](_0x355f55,function(_0x11985e){if(_0x11985e[_0x7370('0x2f')]!=='VIRTUAL'){var _0x55158d={};_0x55158d[_0x11985e[_0x7370('0x29')]]={'$like':'%'+_0x11b9ee['query']['filter']+'%'};return _0x55158d;}})});}_0x426b55=_[_0x7370('0x3f')]({},_0x426b55,_0x11b9ee[_0x7370('0x40')]);var _0x500368={'where':_0x426b55[_0x7370('0x3c')]};return db[_0x7370('0x2c')][_0x7370('0x1f')](_0x500368)['then'](function(_0x36f514){_0x3b205a[_0x7370('0x1f')]=_0x36f514;if(_0x11b9ee['query'][_0x7370('0x41')]){_0x426b55[_0x7370('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x7370('0x43')](_0x426b55);})[_0x7370('0x25')](function(_0x2dc793){_0x3b205a[_0x7370('0x44')]=_0x2dc793;return _0x3b205a;})['then'](respondWithFilteredResult(_0x45b57d,_0x426b55))['catch'](handleError(_0x45b57d,null));};exports[_0x7370('0x45')]=function(_0x3b0c51,_0x1f8b9c){var _0x875012={'raw':!![],'where':{'id':_0x3b0c51[_0x7370('0x46')]['id']}},_0x4fe02e={};_0x4fe02e[_0x7370('0x34')]=_[_0x7370('0x47')](db[_0x7370('0x2c')][_0x7370('0x2d')]);_0x4fe02e[_0x7370('0x31')]=_[_0x7370('0x47')](_0x3b0c51[_0x7370('0x31')]);_0x4fe02e['filters']=_[_0x7370('0x33')](_0x4fe02e[_0x7370('0x34')],_0x4fe02e[_0x7370('0x31')]);_0x875012['attributes']=_[_0x7370('0x33')](_0x4fe02e[_0x7370('0x34')],qs[_0x7370('0x36')](_0x3b0c51[_0x7370('0x31')][_0x7370('0x36')]));_0x875012[_0x7370('0x35')]=_0x875012[_0x7370('0x35')]['length']?_0x875012['attributes']:_0x4fe02e['model'];if(_0x3b0c51['query'][_0x7370('0x41')]){_0x875012[_0x7370('0x42')]=[{'all':!![]}];}_0x875012=_[_0x7370('0x3f')]({},_0x875012,_0x3b0c51[_0x7370('0x40')]);return db[_0x7370('0x2c')]['find'](_0x875012)[_0x7370('0x25')](handleEntityNotFound(_0x1f8b9c,null))[_0x7370('0x25')](respondWithResult(_0x1f8b9c,null))[_0x7370('0x48')](handleError(_0x1f8b9c,null));};exports[_0x7370('0x49')]=function(_0x43dfd7,_0x70428d){return db[_0x7370('0x2c')]['create'](_0x43dfd7['body'],{})[_0x7370('0x25')](respondWithResult(_0x70428d,0xc9))[_0x7370('0x48')](handleError(_0x70428d,null));};exports[_0x7370('0x4a')]=function(_0x443ea3,_0xc464b8){if(_0x443ea3['body']['id']){delete _0x443ea3[_0x7370('0x4b')]['id'];}return db[_0x7370('0x2c')]['find']({'where':{'id':_0x443ea3[_0x7370('0x46')]['id']}})[_0x7370('0x25')](handleEntityNotFound(_0xc464b8,null))[_0x7370('0x25')](saveUpdates(_0x443ea3['body'],null))[_0x7370('0x25')](respondWithResult(_0xc464b8,null))[_0x7370('0x48')](handleError(_0xc464b8,null));};exports['destroy']=function(_0x39e19d,_0x1e33ec){return db[_0x7370('0x2c')][_0x7370('0x4c')]({'where':{'id':_0x39e19d[_0x7370('0x46')]['id']}})[_0x7370('0x25')](handleEntityNotFound(_0x1e33ec,null))[_0x7370('0x25')](removeEntity(_0x1e33ec,null))['catch'](handleError(_0x1e33ec,null));}; \ No newline at end of file +var _0x7554=['params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceQueuesLog','includeAll','include','findAll','rows','catch','show'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x7554,0x1cd));var _0x4755=function(_0x264582,_0x184668){_0x264582=_0x264582-0x0;var _0x2137fc=_0x7554[_0x264582];return _0x2137fc;};'use strict';var emlformat=require(_0x4755('0x0'));var rimraf=require(_0x4755('0x1'));var zipdir=require(_0x4755('0x2'));var jsonpatch=require(_0x4755('0x3'));var rp=require(_0x4755('0x4'));var moment=require(_0x4755('0x5'));var BPromise=require(_0x4755('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4755('0x7'));var sox=require(_0x4755('0x8'));var csv=require(_0x4755('0x9'));var ejs=require(_0x4755('0xa'));var fs=require('fs');var fs_extra=require(_0x4755('0xb'));var _=require('lodash');var squel=require(_0x4755('0xc'));var crypto=require('crypto');var jsforce=require(_0x4755('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4755('0xe'));var Redis=require(_0x4755('0xf'));var authService=require(_0x4755('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4755('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4755('0x12'))(_0x4755('0x13'));var utils=require(_0x4755('0x14'));var config=require(_0x4755('0x15'));var licenseUtil=require(_0x4755('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2861b1,_0x1076cb){_0x1076cb=_0x1076cb||0xcc;return function(_0x2a2a7d){if(_0x2a2a7d){return _0x2861b1[_0x4755('0x17')](_0x1076cb);}return _0x2861b1[_0x4755('0x18')](_0x1076cb)[_0x4755('0x19')]();};}function respondWithResult(_0x22a325,_0x2c632d){_0x2c632d=_0x2c632d||0xc8;return function(_0x89541a){if(_0x89541a){return _0x22a325['status'](_0x2c632d)[_0x4755('0x1a')](_0x89541a);}};}function respondWithFilteredResult(_0x200f58,_0x49e60d){return function(_0x3aac32){if(_0x3aac32){var _0x30a947=typeof _0x49e60d['offset']===_0x4755('0x1b')&&typeof _0x49e60d[_0x4755('0x1c')]===_0x4755('0x1b');var _0x558b67=_0x3aac32[_0x4755('0x1d')];var _0x2e1d66=_0x30a947?0x0:_0x49e60d[_0x4755('0x1e')];var _0x41090c=_0x30a947?_0x3aac32[_0x4755('0x1d')]:_0x49e60d[_0x4755('0x1e')]+_0x49e60d[_0x4755('0x1c')];var _0x42f14f;if(_0x41090c>=_0x558b67){_0x41090c=_0x558b67;_0x42f14f=0xc8;}else{_0x42f14f=0xce;}_0x200f58[_0x4755('0x18')](_0x42f14f);return _0x200f58[_0x4755('0x1f')](_0x4755('0x20'),_0x2e1d66+'-'+_0x41090c+'/'+_0x558b67)['json'](_0x3aac32);}return null;};}function patchUpdates(_0x1b9b8c){return function(_0x378074){try{jsonpatch['apply'](_0x378074,_0x1b9b8c,!![]);}catch(_0xd49500){return BPromise[_0x4755('0x21')](_0xd49500);}return _0x378074[_0x4755('0x22')]();};}function saveUpdates(_0x4ca16e,_0x23d973){return function(_0x390e72){if(_0x390e72){return _0x390e72[_0x4755('0x23')](_0x4ca16e)[_0x4755('0x24')](function(_0x14ebbe){return _0x14ebbe;});}return null;};}function removeEntity(_0x5aa914,_0x29fce5){return function(_0x5212e8){if(_0x5212e8){return _0x5212e8[_0x4755('0x25')]()[_0x4755('0x24')](function(){_0x5aa914['status'](0xcc)[_0x4755('0x19')]();});}};}function handleEntityNotFound(_0xdbb97e,_0x27356e){return function(_0x1083b1){if(!_0x1083b1){_0xdbb97e['sendStatus'](0x194);}return _0x1083b1;};}function handleError(_0x3121f4,_0x1f6182){_0x1f6182=_0x1f6182||0x1f4;return function(_0x21d209){logger['error'](_0x21d209[_0x4755('0x26')]);if(_0x21d209[_0x4755('0x27')]){delete _0x21d209[_0x4755('0x27')];}_0x3121f4[_0x4755('0x18')](_0x1f6182)[_0x4755('0x28')](_0x21d209);};}exports[_0x4755('0x29')]=function(_0x58e962,_0x4e4028){var _0x1c9a85={},_0x5c34e9={},_0x4b1561={'count':0x0,'rows':[]};var _0x5bf08e=_[_0x4755('0x2a')](db['VoiceQueuesLog'][_0x4755('0x2b')],function(_0x2655a9){return{'name':_0x2655a9[_0x4755('0x2c')],'type':_0x2655a9[_0x4755('0x2d')][_0x4755('0x2e')]};});_0x5c34e9['model']=_[_0x4755('0x2a')](_0x5bf08e,_0x4755('0x27'));_0x5c34e9[_0x4755('0x2f')]=_[_0x4755('0x30')](_0x58e962[_0x4755('0x2f')]);_0x5c34e9[_0x4755('0x31')]=_[_0x4755('0x32')](_0x5c34e9[_0x4755('0x33')],_0x5c34e9[_0x4755('0x2f')]);_0x1c9a85['attributes']=_[_0x4755('0x32')](_0x5c34e9[_0x4755('0x33')],qs['fields'](_0x58e962[_0x4755('0x2f')][_0x4755('0x34')]));_0x1c9a85[_0x4755('0x35')]=_0x1c9a85['attributes'][_0x4755('0x36')]?_0x1c9a85[_0x4755('0x35')]:_0x5c34e9[_0x4755('0x33')];if(!_0x58e962[_0x4755('0x2f')][_0x4755('0x37')](_0x4755('0x38'))){_0x1c9a85['limit']=qs[_0x4755('0x1c')](_0x58e962[_0x4755('0x2f')][_0x4755('0x1c')]);_0x1c9a85[_0x4755('0x1e')]=qs[_0x4755('0x1e')](_0x58e962[_0x4755('0x2f')][_0x4755('0x1e')]);}_0x1c9a85[_0x4755('0x39')]=qs['sort'](_0x58e962['query'][_0x4755('0x3a')]);_0x1c9a85[_0x4755('0x3b')]=qs[_0x4755('0x31')](_[_0x4755('0x3c')](_0x58e962[_0x4755('0x2f')],_0x5c34e9[_0x4755('0x31')]),_0x5bf08e);if(_0x58e962[_0x4755('0x2f')][_0x4755('0x3d')]){_0x1c9a85[_0x4755('0x3b')]=_[_0x4755('0x3e')](_0x1c9a85[_0x4755('0x3b')],{'$or':_[_0x4755('0x2a')](_0x5bf08e,function(_0x5cbd04){if(_0x5cbd04[_0x4755('0x2d')]!==_0x4755('0x3f')){var _0x2ae4b8={};_0x2ae4b8[_0x5cbd04[_0x4755('0x27')]]={'$like':'%'+_0x58e962['query'][_0x4755('0x3d')]+'%'};return _0x2ae4b8;}})});}_0x1c9a85=_[_0x4755('0x3e')]({},_0x1c9a85,_0x58e962['options']);var _0x57172d={'where':_0x1c9a85[_0x4755('0x3b')]};return db[_0x4755('0x40')][_0x4755('0x1d')](_0x57172d)['then'](function(_0x51326c){_0x4b1561[_0x4755('0x1d')]=_0x51326c;if(_0x58e962[_0x4755('0x2f')][_0x4755('0x41')]){_0x1c9a85[_0x4755('0x42')]=[{'all':!![]}];}return db[_0x4755('0x40')][_0x4755('0x43')](_0x1c9a85);})[_0x4755('0x24')](function(_0x3e709d){_0x4b1561[_0x4755('0x44')]=_0x3e709d;return _0x4b1561;})[_0x4755('0x24')](respondWithFilteredResult(_0x4e4028,_0x1c9a85))[_0x4755('0x45')](handleError(_0x4e4028,null));};exports[_0x4755('0x46')]=function(_0x4c4385,_0xeeff45){var _0x2ebefa={'raw':!![],'where':{'id':_0x4c4385[_0x4755('0x47')]['id']}},_0x3edfdb={};_0x3edfdb['model']=_[_0x4755('0x30')](db['VoiceQueuesLog'][_0x4755('0x2b')]);_0x3edfdb['query']=_[_0x4755('0x30')](_0x4c4385['query']);_0x3edfdb['filters']=_[_0x4755('0x32')](_0x3edfdb['model'],_0x3edfdb[_0x4755('0x2f')]);_0x2ebefa[_0x4755('0x35')]=_[_0x4755('0x32')](_0x3edfdb[_0x4755('0x33')],qs[_0x4755('0x34')](_0x4c4385['query']['fields']));_0x2ebefa['attributes']=_0x2ebefa[_0x4755('0x35')][_0x4755('0x36')]?_0x2ebefa[_0x4755('0x35')]:_0x3edfdb[_0x4755('0x33')];if(_0x4c4385[_0x4755('0x2f')][_0x4755('0x41')]){_0x2ebefa[_0x4755('0x42')]=[{'all':!![]}];}_0x2ebefa=_[_0x4755('0x3e')]({},_0x2ebefa,_0x4c4385[_0x4755('0x48')]);return db[_0x4755('0x40')][_0x4755('0x49')](_0x2ebefa)[_0x4755('0x24')](handleEntityNotFound(_0xeeff45,null))[_0x4755('0x24')](respondWithResult(_0xeeff45,null))[_0x4755('0x45')](handleError(_0xeeff45,null));};exports[_0x4755('0x4a')]=function(_0x226573,_0xc54083){return db[_0x4755('0x40')][_0x4755('0x4a')](_0x226573[_0x4755('0x4b')],{})[_0x4755('0x24')](respondWithResult(_0xc54083,0xc9))[_0x4755('0x45')](handleError(_0xc54083,null));};exports[_0x4755('0x23')]=function(_0xf774b9,_0x4a4620){if(_0xf774b9[_0x4755('0x4b')]['id']){delete _0xf774b9[_0x4755('0x4b')]['id'];}return db[_0x4755('0x40')][_0x4755('0x49')]({'where':{'id':_0xf774b9['params']['id']}})[_0x4755('0x24')](handleEntityNotFound(_0x4a4620,null))[_0x4755('0x24')](saveUpdates(_0xf774b9[_0x4755('0x4b')],null))[_0x4755('0x24')](respondWithResult(_0x4a4620,null))[_0x4755('0x45')](handleError(_0x4a4620,null));};exports[_0x4755('0x25')]=function(_0x399cf6,_0x40a7b3){return db[_0x4755('0x40')][_0x4755('0x49')]({'where':{'id':_0x399cf6[_0x4755('0x47')]['id']}})[_0x4755('0x24')](handleEntityNotFound(_0x40a7b3,null))['then'](removeEntity(_0x40a7b3,null))[_0x4755('0x45')](handleError(_0x40a7b3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9d3aa36..3b0695c 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 _0x0811=['util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x4659d0,_0xce046a){var _0x172b17=function(_0x136141){while(--_0x136141){_0x4659d0['push'](_0x4659d0['shift']());}};_0x172b17(++_0xce046a);}(_0x0811,0xb3));var _0x1081=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0x0811[_0x22f75e];return _0x1f6ab3;};'use strict';var _=require(_0x1081('0x0'));var util=require(_0x1081('0x1'));var logger=require(_0x1081('0x2'))(_0x1081('0x3'));var moment=require(_0x1081('0x4'));var BPromise=require(_0x1081('0x5'));var rp=require(_0x1081('0x6'));var fs=require('fs');var path=require(_0x1081('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1081('0x8'));module['exports']=function(_0x4c332a,_0xdb1f60){return _0x4c332a[_0x1081('0x9')](_0x1081('0xa'),attributes,{'tableName':_0x1081('0xb'),'paranoid':![],'indexes':[{'name':_0x1081('0xc'),'fields':[_0x1081('0xd'),_0x1081('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x82ab=['define','voice_queues_log','event_dtm','event','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x525209,_0x256e19){var _0x4f438f=function(_0x1d027d){while(--_0x1d027d){_0x525209['push'](_0x525209['shift']());}};_0x4f438f(++_0x256e19);}(_0x82ab,0xad));var _0xb82a=function(_0x915a15,_0x31b9d2){_0x915a15=_0x915a15-0x0;var _0x24f642=_0x82ab[_0x915a15];return _0x24f642;};'use strict';var _=require('lodash');var util=require(_0xb82a('0x0'));var logger=require('../../config/logger')(_0xb82a('0x1'));var moment=require('moment');var BPromise=require(_0xb82a('0x2'));var rp=require(_0xb82a('0x3'));var fs=require('fs');var path=require(_0xb82a('0x4'));var rimraf=require(_0xb82a('0x5'));var config=require(_0xb82a('0x6'));var attributes=require(_0xb82a('0x7'));module[_0xb82a('0x8')]=function(_0x33def1,_0x2e46ac){return _0x33def1[_0xb82a('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0xb82a('0xa'),'paranoid':![],'indexes':[{'name':_0xb82a('0xb'),'fields':[_0xb82a('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f5c81ac..ecb5696 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 _0x894f=['jayson/promise','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x3afe9b,_0x37eb48){var _0x2eb67f=function(_0x2e3f35){while(--_0x2e3f35){_0x3afe9b['push'](_0x3afe9b['shift']());}};_0x2eb67f(++_0x37eb48);}(_0x894f,0x14d));var _0xf894=function(_0x1446be,_0x1c4126){_0x1446be=_0x1446be-0x0;var _0x5a9b8f=_0x894f[_0x1446be];return _0x5a9b8f;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var moment=require(_0xf894('0x2'));var BPromise=require(_0xf894('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf894('0x4'))['db'];var utils=require(_0xf894('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf894('0x6'));var jayson=require(_0xf894('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a9fc,_0x371f86,_0x56d9d6){return new BPromise(function(_0x190cb1,_0x3d8f21){return client[_0xf894('0x8')](_0x23a9fc,_0x56d9d6)[_0xf894('0x9')](function(_0x10bb84){logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));logger[_0xf894('0xd')](_0xf894('0xe'),_0x371f86,_0xf894('0xc'),JSON[_0xf894('0xf')](_0x10bb84));if(_0x10bb84[_0xf894('0x10')]){if(_0x10bb84[_0xf894('0x10')][_0xf894('0x11')]===0x1f4){logger[_0xf894('0x10')](_0xf894('0xb'),_0x371f86,_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);return _0x3d8f21(_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);}logger[_0xf894('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x10bb84[_0xf894('0x10')]['message']);return _0x190cb1(_0x10bb84['error'][_0xf894('0x12')]);}else{logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));_0x190cb1(_0x10bb84[_0xf894('0x13')]['message']);}})['catch'](function(_0x1865be){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x1865be);_0x3d8f21(_0x1865be);});});} \ No newline at end of file +var _0x63e4=['then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x16a14c,_0x2dbe5c){var _0x12d727=function(_0x15af80){while(--_0x15af80){_0x16a14c['push'](_0x16a14c['shift']());}};_0x12d727(++_0x2dbe5c);}(_0x63e4,0x12a));var _0x463e=function(_0xebc400,_0x5aa20c){_0xebc400=_0xebc400-0x0;var _0xc77d95=_0x63e4[_0xebc400];return _0xc77d95;};'use strict';var _=require(_0x463e('0x0'));var util=require(_0x463e('0x1'));var moment=require(_0x463e('0x2'));var BPromise=require(_0x463e('0x3'));var rs=require(_0x463e('0x4'));var fs=require('fs');var Redis=require(_0x463e('0x5'));var db=require(_0x463e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x463e('0x7'))(_0x463e('0x8'));var config=require(_0x463e('0x9'));var jayson=require(_0x463e('0xa'));var client=jayson[_0x463e('0xb')][_0x463e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x703906,_0x273c7a,_0x3a5492){return new BPromise(function(_0x6d5e93,_0x441fed){return client[_0x463e('0xd')](_0x703906,_0x3a5492)[_0x463e('0xe')](function(_0x33e94f){logger[_0x463e('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x273c7a,_0x463e('0x10'));logger[_0x463e('0x11')](_0x463e('0x12'),_0x273c7a,_0x463e('0x10'),JSON['stringify'](_0x33e94f));if(_0x33e94f[_0x463e('0x13')]){if(_0x33e94f[_0x463e('0x13')]['code']===0x1f4){logger[_0x463e('0x13')](_0x463e('0x14'),_0x273c7a,_0x33e94f[_0x463e('0x13')][_0x463e('0x15')]);return _0x441fed(_0x33e94f['error'][_0x463e('0x15')]);}logger[_0x463e('0x13')](_0x463e('0x14'),_0x273c7a,_0x33e94f[_0x463e('0x13')]['message']);return _0x6d5e93(_0x33e94f[_0x463e('0x13')][_0x463e('0x15')]);}else{logger[_0x463e('0xf')](_0x463e('0x14'),_0x273c7a,_0x463e('0x10'));_0x6d5e93(_0x33e94f[_0x463e('0x16')][_0x463e('0x15')]);}})[_0x463e('0x17')](function(_0x1b29ad){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x273c7a,_0x1b29ad);_0x441fed(_0x1b29ad);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b520763..5c60002 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 _0x90fe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','util','path','express'];(function(_0x5ae51d,_0x58305f){var _0x4d4acc=function(_0x117fac){while(--_0x117fac){_0x5ae51d['push'](_0x5ae51d['shift']());}};_0x4d4acc(++_0x58305f);}(_0x90fe,0x195));var _0xe90f=function(_0xb179ea,_0xe7c08a){_0xb179ea=_0xb179ea-0x0;var _0xded50a=_0x90fe[_0xb179ea];return _0xded50a;};'use strict';var multer=require('multer');var util=require(_0xe90f('0x0'));var path=require(_0xe90f('0x1'));var timeout=require('connect-timeout');var express=require(_0xe90f('0x2'));var router=express[_0xe90f('0x3')]();var fs_extra=require(_0xe90f('0x4'));var auth=require(_0xe90f('0x5'));var interaction=require(_0xe90f('0x6'));var config=require(_0xe90f('0x7'));var controller=require(_0xe90f('0x8'));router[_0xe90f('0x9')]('/',auth[_0xe90f('0xa')](),controller['index']);router[_0xe90f('0x9')](_0xe90f('0xb'),auth[_0xe90f('0xa')](),controller[_0xe90f('0xc')]);router['get'](_0xe90f('0xd'),auth[_0xe90f('0xa')](),controller[_0xe90f('0xe')]);router[_0xe90f('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xe90f('0xf')]);router['get'](_0xe90f('0x10'),controller[_0xe90f('0x11')]);router[_0xe90f('0x9')](_0xe90f('0x12'),auth[_0xe90f('0xa')](),controller[_0xe90f('0x13')]);router[_0xe90f('0x14')]('/',auth[_0xe90f('0xa')](),controller[_0xe90f('0x15')]);router[_0xe90f('0x14')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0xe90f('0x16')]('/:id',auth[_0xe90f('0xa')](),controller['update']);router[_0xe90f('0x17')]('/:id',auth[_0xe90f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3951=['/:id/transcribe','downloadTranscribe','post','create','runTranscribe','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/:id/downloads','downloads'];(function(_0xa57100,_0x529dac){var _0x453b4b=function(_0x552ea9){while(--_0x552ea9){_0xa57100['push'](_0xa57100['shift']());}};_0x453b4b(++_0x529dac);}(_0x3951,0x17f));var _0x1395=function(_0x5094e7,_0x1ef005){_0x5094e7=_0x5094e7-0x0;var _0x256aa3=_0x3951[_0x5094e7];return _0x256aa3;};'use strict';var multer=require(_0x1395('0x0'));var util=require('util');var path=require(_0x1395('0x1'));var timeout=require(_0x1395('0x2'));var express=require(_0x1395('0x3'));var router=express['Router']();var fs_extra=require(_0x1395('0x4'));var auth=require(_0x1395('0x5'));var interaction=require(_0x1395('0x6'));var config=require(_0x1395('0x7'));var controller=require(_0x1395('0x8'));router[_0x1395('0x9')]('/',auth[_0x1395('0xa')](),controller['index']);router['get']('/describe',auth[_0x1395('0xa')](),controller['describe']);router[_0x1395('0x9')]('/:id',auth[_0x1395('0xa')](),controller['show']);router[_0x1395('0x9')]('/:id/download',auth[_0x1395('0xa')](),controller['download']);router[_0x1395('0x9')](_0x1395('0xb'),controller[_0x1395('0xc')]);router['get'](_0x1395('0xd'),auth[_0x1395('0xa')](),controller[_0x1395('0xe')]);router[_0x1395('0xf')]('/',auth[_0x1395('0xa')](),controller[_0x1395('0x10')]);router[_0x1395('0xf')](_0x1395('0xd'),auth['isAuthenticated'](),controller[_0x1395('0x11')]);router['put'](_0x1395('0x12'),auth[_0x1395('0xa')](),controller[_0x1395('0x13')]);router[_0x1395('0x14')](_0x1395('0x12'),auth[_0x1395('0xa')](),controller['destroy']);module[_0x1395('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 8f56ee6..4a12f64 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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 87ed363..6dcc463 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 _0x6f72=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','VoiceRecording','includeAll','include','findAll','rows','catch','params','find','create','body','describe','download','uniqueid','value','existsSync','decryptFile','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','secrets','recording','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','runTranscribe','../../components/encryptor','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeRegion','language','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../components/auth/service'];(function(_0x3d537b,_0x5d2728){var _0x5d2e69=function(_0x7e90c6){while(--_0x7e90c6){_0x3d537b['push'](_0x3d537b['shift']());}};_0x5d2e69(++_0x5d2728);}(_0x6f72,0x19f));var _0x26f7=function(_0x4a71d7,_0x267324){_0x4a71d7=_0x4a71d7-0x0;var _0x145eb0=_0x6f72[_0x4a71d7];return _0x145eb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26f7('0x0'));var zipdir=require(_0x26f7('0x1'));var jsonpatch=require(_0x26f7('0x2'));var rp=require('request-promise');var moment=require(_0x26f7('0x3'));var BPromise=require(_0x26f7('0x4'));var Mustache=require(_0x26f7('0x5'));var util=require('util');var path=require(_0x26f7('0x6'));var sox=require(_0x26f7('0x7'));var csv=require(_0x26f7('0x8'));var ejs=require(_0x26f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26f7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x26f7('0xb'));var deskjs=require(_0x26f7('0xc'));var toCsv=require(_0x26f7('0x8'));var querystring=require('querystring');var Papa=require(_0x26f7('0xd'));var AWS=require(_0x26f7('0xe'));var uuidv4=require(_0x26f7('0xf'));var Redis=require('ioredis');var authService=require(_0x26f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x26f7('0x11'));var hardwareService=require(_0x26f7('0x12'));var logger=require(_0x26f7('0x13'))('api');var utils=require(_0x26f7('0x14'));var config=require(_0x26f7('0x15'));var licenseUtil=require(_0x26f7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a8e2b,_0x134033){_0x134033=_0x134033||0xcc;return function(_0x31aed3){if(_0x31aed3){return _0x4a8e2b[_0x26f7('0x17')](_0x134033);}return _0x4a8e2b[_0x26f7('0x18')](_0x134033)[_0x26f7('0x19')]();};}function respondWithResult(_0x44659e,_0x5e4710){_0x5e4710=_0x5e4710||0xc8;return function(_0x2adba3){if(_0x2adba3){return _0x44659e[_0x26f7('0x18')](_0x5e4710)[_0x26f7('0x1a')](_0x2adba3);}};}function respondWithFilteredResult(_0x42d4b0,_0x386a03){return function(_0x13ea59){if(_0x13ea59){var _0x29ccc6=typeof _0x386a03[_0x26f7('0x1b')]===_0x26f7('0x1c')&&typeof _0x386a03[_0x26f7('0x1d')]==='undefined';var _0x284cab=_0x13ea59[_0x26f7('0x1e')];var _0x3cbb22=_0x29ccc6?0x0:_0x386a03[_0x26f7('0x1b')];var _0x5e1967=_0x29ccc6?_0x13ea59[_0x26f7('0x1e')]:_0x386a03['offset']+_0x386a03['limit'];var _0x269552;if(_0x5e1967>=_0x284cab){_0x5e1967=_0x284cab;_0x269552=0xc8;}else{_0x269552=0xce;}_0x42d4b0[_0x26f7('0x18')](_0x269552);return _0x42d4b0[_0x26f7('0x1f')](_0x26f7('0x20'),_0x3cbb22+'-'+_0x5e1967+'/'+_0x284cab)[_0x26f7('0x1a')](_0x13ea59);}return null;};}function patchUpdates(_0x15508){return function(_0x507abf){try{jsonpatch[_0x26f7('0x21')](_0x507abf,_0x15508,!![]);}catch(_0x494992){return BPromise[_0x26f7('0x22')](_0x494992);}return _0x507abf[_0x26f7('0x23')]();};}function saveUpdates(_0x5ac5dd,_0x1532cf){return function(_0xb2957c){if(_0xb2957c){return _0xb2957c[_0x26f7('0x24')](_0x5ac5dd)['then'](function(_0x44390e){return _0x44390e;});}return null;};}function removeEntity(_0x283e9b,_0x5b8735){return function(_0x5ed018){if(_0x5ed018){return _0x5ed018[_0x26f7('0x25')]()[_0x26f7('0x26')](function(){_0x283e9b[_0x26f7('0x18')](0xcc)[_0x26f7('0x19')]();});}};}function handleEntityNotFound(_0x45e1a4,_0x22f845){return function(_0x3b85fd){if(!_0x3b85fd){_0x45e1a4[_0x26f7('0x17')](0x194);}return _0x3b85fd;};}function handleError(_0x17cb07,_0x43cde8){_0x43cde8=_0x43cde8||0x1f4;return function(_0x45040b){logger['error'](_0x45040b[_0x26f7('0x27')]);if(_0x45040b['name']){delete _0x45040b[_0x26f7('0x28')];}_0x17cb07[_0x26f7('0x18')](_0x43cde8)[_0x26f7('0x29')](_0x45040b);};}exports[_0x26f7('0x2a')]=function(_0x71d027,_0x11a042){var _0xb5f339={},_0x1ea574={},_0x4d25dc={'count':0x0,'rows':[]};var _0x499844=_[_0x26f7('0x2b')](db['VoiceRecording']['rawAttributes'],function(_0x277efd){return{'name':_0x277efd[_0x26f7('0x2c')],'type':_0x277efd[_0x26f7('0x2d')]['key']};});_0x1ea574[_0x26f7('0x2e')]=_[_0x26f7('0x2f')](_[_0x26f7('0x2b')](_0x499844,_0x26f7('0x28')),[_0x26f7('0x30')]);_0x1ea574[_0x26f7('0x31')]=_[_0x26f7('0x32')](_0x71d027[_0x26f7('0x31')]);_0x1ea574[_0x26f7('0x33')]=_['intersection'](_0x1ea574[_0x26f7('0x2e')],_0x1ea574[_0x26f7('0x31')]);_0xb5f339[_0x26f7('0x34')]=_[_0x26f7('0x35')](_0x1ea574[_0x26f7('0x2e')],qs['fields'](_0x71d027[_0x26f7('0x31')][_0x26f7('0x36')]));_0xb5f339[_0x26f7('0x34')]=_0xb5f339['attributes'][_0x26f7('0x37')]?_0xb5f339[_0x26f7('0x34')]:_0x1ea574['model'];if(!_0x71d027[_0x26f7('0x31')]['hasOwnProperty'](_0x26f7('0x38'))){_0xb5f339[_0x26f7('0x1d')]=qs[_0x26f7('0x1d')](_0x71d027[_0x26f7('0x31')][_0x26f7('0x1d')]);_0xb5f339[_0x26f7('0x1b')]=qs[_0x26f7('0x1b')](_0x71d027[_0x26f7('0x31')][_0x26f7('0x1b')]);}_0xb5f339[_0x26f7('0x39')]=qs[_0x26f7('0x3a')](_0x71d027[_0x26f7('0x31')][_0x26f7('0x3a')]);_0xb5f339[_0x26f7('0x3b')]=qs[_0x26f7('0x33')](_[_0x26f7('0x3c')](_0x71d027[_0x26f7('0x31')],_0x1ea574['filters']),_0x499844);if(_0x71d027[_0x26f7('0x31')][_0x26f7('0x3d')]){_0xb5f339[_0x26f7('0x3b')]=_[_0x26f7('0x3e')](_0xb5f339[_0x26f7('0x3b')],{'$or':_['map'](_0x499844,function(_0x2810e1){if(_0x2810e1[_0x26f7('0x2d')]!=='VIRTUAL'){var _0x260a47={};_0x260a47[_0x2810e1[_0x26f7('0x28')]]={'$like':'%'+_0x71d027[_0x26f7('0x31')][_0x26f7('0x3d')]+'%'};return _0x260a47;}})});}_0xb5f339=_[_0x26f7('0x3e')]({},_0xb5f339,_0x71d027[_0x26f7('0x3f')]);var _0x15de9f={'where':_0xb5f339[_0x26f7('0x3b')]};return db[_0x26f7('0x40')][_0x26f7('0x1e')](_0x15de9f)[_0x26f7('0x26')](function(_0x497f03){_0x4d25dc[_0x26f7('0x1e')]=_0x497f03;if(_0x71d027[_0x26f7('0x31')][_0x26f7('0x41')]){_0xb5f339[_0x26f7('0x42')]=[{'all':!![]}];}return db[_0x26f7('0x40')][_0x26f7('0x43')](_0xb5f339);})[_0x26f7('0x26')](function(_0x67a82d){_0x4d25dc[_0x26f7('0x44')]=_0x67a82d;return _0x4d25dc;})[_0x26f7('0x26')](respondWithFilteredResult(_0x11a042,_0xb5f339))[_0x26f7('0x45')](handleError(_0x11a042,null));};exports['show']=function(_0xc9050c,_0x21f79c){var _0x9848f={'raw':![],'where':{'id':_0xc9050c[_0x26f7('0x46')]['id']}},_0x43e2b1={};_0x43e2b1[_0x26f7('0x2e')]=_[_0x26f7('0x32')](db[_0x26f7('0x40')]['rawAttributes']);_0x43e2b1[_0x26f7('0x31')]=_['keys'](_0xc9050c[_0x26f7('0x31')]);_0x43e2b1[_0x26f7('0x33')]=_[_0x26f7('0x35')](_0x43e2b1[_0x26f7('0x2e')],_0x43e2b1[_0x26f7('0x31')]);_0x9848f[_0x26f7('0x34')]=_[_0x26f7('0x35')](_0x43e2b1['model'],qs['fields'](_0xc9050c[_0x26f7('0x31')][_0x26f7('0x36')]));_0x9848f[_0x26f7('0x34')]=_0x9848f[_0x26f7('0x34')][_0x26f7('0x37')]?_0x9848f[_0x26f7('0x34')]:_0x43e2b1[_0x26f7('0x2e')];if(_0xc9050c[_0x26f7('0x31')][_0x26f7('0x41')]){_0x9848f[_0x26f7('0x42')]=[{'all':!![]}];}_0x9848f=_[_0x26f7('0x3e')]({},_0x9848f,_0xc9050c['options']);return db['VoiceRecording'][_0x26f7('0x47')](_0x9848f)['then'](handleEntityNotFound(_0x21f79c,null))['then'](respondWithResult(_0x21f79c,null))[_0x26f7('0x45')](handleError(_0x21f79c,null));};exports[_0x26f7('0x48')]=function(_0x24ec8f,_0x5a4e7f){return db[_0x26f7('0x40')][_0x26f7('0x48')](_0x24ec8f[_0x26f7('0x49')],{})[_0x26f7('0x26')](respondWithResult(_0x5a4e7f,0xc9))[_0x26f7('0x45')](handleError(_0x5a4e7f,null));};exports['update']=function(_0xa50abc,_0x393d68){if(_0xa50abc[_0x26f7('0x49')]['id']){delete _0xa50abc[_0x26f7('0x49')]['id'];}return db[_0x26f7('0x40')]['find']({'where':{'id':_0xa50abc[_0x26f7('0x46')]['id']}})[_0x26f7('0x26')](handleEntityNotFound(_0x393d68,null))[_0x26f7('0x26')](saveUpdates(_0xa50abc['body'],null))['then'](respondWithResult(_0x393d68,null))['catch'](handleError(_0x393d68,null));};exports['describe']=function(_0x3d61fc,_0x4a0b03){return db[_0x26f7('0x40')][_0x26f7('0x4a')]()[_0x26f7('0x26')](respondWithResult(_0x4a0b03,null))[_0x26f7('0x45')](handleError(_0x4a0b03,null));};exports[_0x26f7('0x4b')]=function(_0x112c4f,_0x1a2693,_0x4ff5e7){var _0x14c19c=require('../../components/encryptor');var _0x28d88a=![];var _0x5861a0={};if(_0x112c4f['query'][_0x26f7('0x2d')]&&_0x112c4f[_0x26f7('0x31')][_0x26f7('0x2d')]===_0x26f7('0x4c')){_0x5861a0[_0x26f7('0x4c')]=_0x112c4f[_0x26f7('0x46')]['id'];}else{_0x5861a0['id']=_0x112c4f[_0x26f7('0x46')]['id'];}return db['VoiceRecording'][_0x26f7('0x47')]({'where':_0x5861a0,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1a2693,null))[_0x26f7('0x26')](function(_0x24ee67){if(_0x24ee67){var _0x513222=_0x24ee67[_0x26f7('0x4d')];var _0x3c5a43=util[_0x26f7('0x30')]('%s.cypher',_0x513222);if(fs[_0x26f7('0x4e')](_0x3c5a43)){_0x28d88a=!![];return _0x14c19c[_0x26f7('0x4f')](_0x3c5a43,_0x513222,config['secrets']['recording'])['then'](function(){return _0x24ee67;});}return _0x24ee67;}})['then'](function(_0x345c4d){if(_0x345c4d){var _0x3907b1=_0x345c4d[_0x26f7('0x4d')];if(!fs[_0x26f7('0x4e')](_0x3907b1)){throw new db[(_0x26f7('0x50'))]['ValidationError'](_0x26f7('0x51'));}if(_0x345c4d['filename']){return _0x1a2693['download'](_0x3907b1,_0x345c4d[_0x26f7('0x52')]+path['extname'](_0x3907b1),function(){if(_0x28d88a){fs[_0x26f7('0x53')](_0x3907b1);}});}else{return _0x1a2693['download'](_0x3907b1,function(_0x406fa9){if(_0x28d88a){fs[_0x26f7('0x53')](_0x3907b1);}});}}})[_0x26f7('0x45')](function(_0x113593){if(_0x113593[_0x26f7('0x54')]===_0x26f7('0x51')){_0x1a2693['status'](0x194)[_0x26f7('0x29')](_0x26f7('0x55'));}else{return handleError(_0x1a2693,null);}});};exports['downloads']=function(_0x4b75e3,_0x209cc1,_0x2d713f){var _0x44c28c=require('../../components/encryptor');var _0x4dfb61=![];var _0x7c9ea2={'$and':[db[_0x26f7('0x56')]['where'](db['sequelize']['fn'](_0x26f7('0x57'),db[_0x26f7('0x56')][_0x26f7('0x58')](_0x26f7('0x4c'))),_0x4b75e3['query'][_0x26f7('0x59')])]};if(_0x4b75e3[_0x26f7('0x31')][_0x26f7('0x2d')]&&_0x4b75e3['query'][_0x26f7('0x2d')]===_0x26f7('0x4c')){_0x7c9ea2[_0x26f7('0x5a')][_0x26f7('0x5b')]({'uniqueid':_0x4b75e3[_0x26f7('0x46')]['id']});}else{_0x7c9ea2[_0x26f7('0x5a')][_0x26f7('0x5b')]({'id':_0x4b75e3[_0x26f7('0x46')]['id']});}return db[_0x26f7('0x40')][_0x26f7('0x47')]({'where':_0x7c9ea2,'attributes':['id',_0x26f7('0x4d')],'raw':!![]})[_0x26f7('0x26')](handleEntityNotFound(_0x209cc1,null))[_0x26f7('0x26')](function(_0x38e1dd){if(_0x38e1dd){var _0x13567b=util['format'](_0x26f7('0x5c'),_0x38e1dd[_0x26f7('0x4d')]);if(fs['existsSync'](_0x13567b)){_0x4dfb61=!![];return _0x44c28c['decryptFile'](_0x13567b,_0x38e1dd[_0x26f7('0x4d')],config[_0x26f7('0x5d')][_0x26f7('0x5e')])[_0x26f7('0x26')](function(){return _0x38e1dd;});}return _0x38e1dd;}})[_0x26f7('0x26')](function(_0x17b28a){if(_0x17b28a){if(!fs[_0x26f7('0x4e')](_0x17b28a[_0x26f7('0x4d')])){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('VoiceRecording\x20not\x20found');}if(_0x17b28a['filename']){return _0x209cc1[_0x26f7('0x4b')](_0x17b28a[_0x26f7('0x4d')],_0x17b28a[_0x26f7('0x52')]+path['extname'](_0x17b28a[_0x26f7('0x4d')]),function(){if(_0x4dfb61){fs[_0x26f7('0x53')](_0x17b28a[_0x26f7('0x4d')]);}});}else{return _0x209cc1['download'](_0x17b28a[_0x26f7('0x4d')],function(_0x258a0f){if(_0x4dfb61){fs[_0x26f7('0x53')](_0x17b28a['value']);}});}}})[_0x26f7('0x45')](handleError(_0x209cc1,null));};exports['destroy']=function(_0x301250,_0x2e6c0a){return db[_0x26f7('0x40')][_0x26f7('0x47')]({'where':{'id':_0x301250[_0x26f7('0x46')]['id']}})[_0x26f7('0x26')](function(_0x46472b){if(_[_0x26f7('0x60')](_0x46472b)){throw new ReferenceError(_0x26f7('0x61'));}return _0x46472b;})[_0x26f7('0x26')](function(_0x4dceff){var _0x132793=_0x4dceff[_0x26f7('0x4d')];logger[_0x26f7('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x132793);if(!_[_0x26f7('0x60')](_0x4dceff[_0x26f7('0x4d')])&&fs[_0x26f7('0x4e')](_0x132793)){logger[_0x26f7('0x62')](_0x26f7('0x63')+_0x132793+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x26f7('0x64')](_0x132793);}_0x132793=_0x132793+_0x26f7('0x65');if(!_[_0x26f7('0x60')](_0x4dceff[_0x26f7('0x4d')])&&fs[_0x26f7('0x4e')](_0x132793)){logger[_0x26f7('0x62')]('File:\x20\x22'+_0x132793+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x132793);}return _0x4dceff;})['then'](function(_0x20881e){if(!_0x20881e)throw new InternalError();return _0x20881e['destroy']();})['then'](function(){_0x2e6c0a[_0x26f7('0x18')](0xcc)['end']();})[_0x26f7('0x45')](handleError(_0x2e6c0a,null));};function getBucketslist(_0x44036a,_0x32ee1b,_0x57fe72){return new Promise(function(_0xcfa03a,_0x2f686c){var _0x136fc9=new AWS['S3']({'accessKeyId':_0x32ee1b,'secretAccessKey':_0x44036a,'region':_0x57fe72});_0x136fc9[_0x26f7('0x66')]({},function(_0x2f1e92,_0x6a9255){if(_0x2f1e92){return _0x2f686c(_0x2f1e92);}else{return _0xcfa03a(_0x6a9255);}});});}function createBucket(_0x5b19fe,_0x3dfdf0,_0x6aa4e0,_0x5dda4e){return new Promise(function(_0x5656b0,_0x1dafa3){var _0x121d24=new AWS['S3']({'accessKeyId':_0x3dfdf0,'secretAccessKey':_0x5b19fe,'region':_0x6aa4e0});_0x121d24[_0x26f7('0x67')]({'Bucket':_0x5dda4e},function(_0x1e9a7f,_0x3650ac){if(_0x1e9a7f){return _0x1dafa3(_0x1e9a7f);}else{return _0x5656b0(_0x3650ac);}});});}function uploadFile(_0x1931a0,_0x15d54c,_0xacf8b3,_0x1a813d,_0x19efb6,_0x2c8238){return new Promise(function(_0x248e41,_0x395c79){var _0x1b5327=new AWS['S3']({'accessKeyId':_0x15d54c,'secretAccessKey':_0x1931a0,'region':_0xacf8b3});_0x1b5327[_0x26f7('0x68')]({'Bucket':_0x1a813d,'Key':_0x19efb6,'Body':_0x2c8238},function(_0x6e2422,_0xecad14){if(_0x6e2422){return _0x395c79(_0x6e2422);}else{return _0x248e41(_0xecad14);}});});}function startTranscribe(_0x290a48,_0x5bdfa7,_0x28e576,_0x558e25,_0x23c610,_0x5d1959){return new Promise(function(_0x1f6af8,_0x6a923){var _0x343eb0=new AWS[(_0x26f7('0x69'))]({'accessKeyId':_0x5bdfa7,'secretAccessKey':_0x290a48,'region':_0x28e576});_0x343eb0[_0x26f7('0x6a')]({'TranscriptionJobName':_0x558e25,'LanguageCode':_0x23c610,'Media':{'MediaFileUri':_0x5d1959}},function(_0xf7dbca,_0x1d8880){if(_0xf7dbca){return _0x6a923(_0xf7dbca);}else{return _0x1f6af8(_0x1d8880);}});});}function transcribe(_0x4948cf,_0x42ec5f,_0x2b6844,_0x3c1a49,_0x3698ff,_0x33bec8,_0x137ce6){return new Promise(function(_0xfa6a79,_0x3674bc){var _0x149c08={};logger[_0x26f7('0x62')](util[_0x26f7('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4948cf,_0x3698ff));return uploadFile(_0x42ec5f,_0x2b6844,_0x3c1a49,_0x3698ff,path['basename'](_0x33bec8),fs[_0x26f7('0x6b')](_0x33bec8))['then'](function(_0x1e1f30){logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x6c'),_0x4948cf,_0x3698ff,_0x1e1f30[_0x26f7('0x6d')]));_0x149c08['bucket']=_0x1e1f30['Bucket'];_0x149c08['location']=_0x1e1f30[_0x26f7('0x6d')];logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x6e'),_0x4948cf));return startTranscribe(_0x42ec5f,_0x2b6844,_0x3c1a49,uuidv4(),_0x137ce6,_0x1e1f30[_0x26f7('0x6d')]);})['then'](function(_0x6d28fc){logger['info'](util[_0x26f7('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4948cf,_0x6d28fc['TranscriptionJob'][_0x26f7('0x6f')]));_0x149c08[_0x26f7('0x70')]=_0x6d28fc['TranscriptionJob'][_0x26f7('0x6f')];_0x149c08['transcribeStatus']=_0x6d28fc['TranscriptionJob']['TranscriptionJobStatus'];return _0xfa6a79(_0x149c08);})[_0x26f7('0x45')](function(_0x534d1d){return _0x3674bc(_0x534d1d);});});}exports[_0x26f7('0x71')]=function(_0x23e350,_0x7c3966,_0x172e90){var _0x3f7c0c;var _0x2fa5bf;var _0x8bc318;var _0x2d9090=require(_0x26f7('0x72'));return db[_0x26f7('0x40')]['findOne']({'where':{'id':_0x23e350[_0x26f7('0x46')]['id']}})['then'](function(_0x1d6451){if(_0x1d6451){var _0x185846=util[_0x26f7('0x30')](_0x26f7('0x5c'),_0x1d6451[_0x26f7('0x4d')]);if(fs['existsSync'](_0x185846)){cypher=!![];return _0x2d9090[_0x26f7('0x4f')](_0x185846,_0x1d6451[_0x26f7('0x4d')],config[_0x26f7('0x5d')][_0x26f7('0x5e')])[_0x26f7('0x26')](function(){return _0x1d6451;});}return _0x1d6451;}})[_0x26f7('0x26')](function(_0x55994d){if(!_0x55994d){throw new db[(_0x26f7('0x50'))]['ValidationError'](_0x26f7('0x73'));}_0x2fa5bf=_0x55994d;return db[_0x26f7('0x74')][_0x26f7('0x75')]({'where':{'id':0x1}});})[_0x26f7('0x26')](handleEntityNotFound(_0x7c3966,null))['then'](function(_0x30938e){if(_0x30938e){_0x3f7c0c=_0x30938e;if(!_0x3f7c0c['transcribe']||!_0x3f7c0c['transcribeAccountId']||!_0x3f7c0c[_0x26f7('0x76')]||!_0x3f7c0c[_0x26f7('0x77')]||!_0x3f7c0c[_0x26f7('0x78')]){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('Transcribe\x20not\x20configured');}if(_0x23e350[_0x26f7('0x49')][_0x26f7('0x79')]&&(!_0x3f7c0c[_0x26f7('0x7a')]||!_0x3f7c0c[_0x26f7('0x7b')]||!_0x3f7c0c[_0x26f7('0x7c')]||!_0x3f7c0c[_0x26f7('0x77')]||!_0x3f7c0c[_0x26f7('0x78')])){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x26f7('0x7d')]['findOne']({'where':{'id':_0x3f7c0c[_0x26f7('0x7e')]}});}})[_0x26f7('0x26')](function(_0x13deac){if(!_0x13deac){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))](_0x26f7('0x7f'));}if(!_0x13deac['data1']||!_0x13deac[_0x26f7('0x80')]){throw new db[(_0x26f7('0x50'))][(_0x26f7('0x5f'))]('Cloud\x20Provider\x20not\x20configured');}_0x8bc318=_0x13deac;return getBucketslist(_0x8bc318['data1'],_0x8bc318[_0x26f7('0x80')],_0x3f7c0c['transcribeRegion']);})[_0x26f7('0x26')](function(_0x26a2ba){if(_0x26a2ba&&_0x26a2ba[_0x26f7('0x81')]){var _0x2227e6=_[_0x26f7('0x47')](_0x26a2ba[_0x26f7('0x81')],function(_0x1f0058){return _0x1f0058[_0x26f7('0x82')]===_0x3f7c0c[_0x26f7('0x78')];});if(!_0x2227e6){logger['info'](util[_0x26f7('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x23e350[_0x26f7('0x46')]['id'],_0x3f7c0c[_0x26f7('0x78')]));return createBucket(_0x8bc318['data1'],_0x8bc318[_0x26f7('0x80')],_0x3f7c0c['transcribeRegion'],_0x3f7c0c[_0x26f7('0x78')]);}logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x83'),_0x23e350[_0x26f7('0x46')]['id'],_0x3f7c0c[_0x26f7('0x78')]));return;}})[_0x26f7('0x26')](function(_0x39c442){if(_0x2fa5bf['transcribeStatus']===_0x26f7('0x84')){return transcribe(_0x23e350[_0x26f7('0x46')]['id'],_0x8bc318[_0x26f7('0x85')],_0x8bc318[_0x26f7('0x80')],_0x3f7c0c['transcribeRegion'],_0x3f7c0c[_0x26f7('0x78')],_0x2fa5bf[_0x26f7('0x4d')],_0x3f7c0c[_0x26f7('0x77')]);}else{logger[_0x26f7('0x62')](util[_0x26f7('0x30')](_0x26f7('0x86'),_0x23e350[_0x26f7('0x46')]['id']));return{'transcribeStatus':_0x26f7('0x87')};}})[_0x26f7('0x26')](function(_0x428a5b){if(_0x428a5b){_0x428a5b['tempSentiment']=_0x23e350['body']['runSentiment'];return _0x2fa5bf[_0x26f7('0x88')](_0x428a5b);}})[_0x26f7('0x26')](respondWithResult(_0x7c3966,null))[_0x26f7('0x45')](handleError(_0x7c3966,null));};function writeFile(_0x1c45f2,_0x65a0f){return new Promise(function(_0x2c6af6,_0xc7521a){fs[_0x26f7('0x89')](_0x65a0f,_0x1c45f2,function(_0xf761b3,_0x395e82){if(_0xf761b3){return _0xc7521a(_0xf761b3);}else{return _0x2c6af6(_0x395e82);}});});}exports[_0x26f7('0x8a')]=function(_0x25c089,_0x3d1d41,_0x14f507){return db[_0x26f7('0x40')][_0x26f7('0x75')]({'where':{'id':_0x25c089[_0x26f7('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d1d41))['then'](function(_0xaa30b4){if(_0xaa30b4&&_0xaa30b4[_0x26f7('0x8b')]){var _0x1b1882=_0xaa30b4[_0x26f7('0x8b')];var _0x159ec0=config[_0x26f7('0x8c')]+_0x26f7('0x8d')+_0xaa30b4['id']+_0x26f7('0x8e');if(fs['existsSync'](_0x159ec0)){return _0x159ec0;}return writeFile(_0x1b1882,_0x159ec0)[_0x26f7('0x26')](function(){return _0x159ec0;});}else{throw new db['Sequelize'][(_0x26f7('0x5f'))](_0x26f7('0x8f'));}})['then'](function(_0x4ebe4a){return _0x3d1d41['download'](_0x4ebe4a);})[_0x26f7('0x45')](handleError(_0x3d1d41));}; \ No newline at end of file +var _0xab2a=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','col','token','$and','push','Sequelize','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','status','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where'];(function(_0x50b10c,_0x54988e){var _0x185260=function(_0x5253e2){while(--_0x5253e2){_0x50b10c['push'](_0x50b10c['shift']());}};_0x185260(++_0x54988e);}(_0xab2a,0x180));var _0xaab2=function(_0x4f59d7,_0x2dbc58){_0x4f59d7=_0x4f59d7-0x0;var _0x12236e=_0xab2a[_0x4f59d7];return _0x12236e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaab2('0x0'));var zipdir=require(_0xaab2('0x1'));var jsonpatch=require(_0xaab2('0x2'));var rp=require(_0xaab2('0x3'));var moment=require('moment');var BPromise=require(_0xaab2('0x4'));var Mustache=require(_0xaab2('0x5'));var util=require(_0xaab2('0x6'));var path=require(_0xaab2('0x7'));var sox=require('sox');var csv=require(_0xaab2('0x8'));var ejs=require(_0xaab2('0x9'));var fs=require('fs');var fs_extra=require(_0xaab2('0xa'));var _=require('lodash');var squel=require(_0xaab2('0xb'));var crypto=require(_0xaab2('0xc'));var jsforce=require(_0xaab2('0xd'));var deskjs=require(_0xaab2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaab2('0xf'));var Papa=require(_0xaab2('0x10'));var AWS=require(_0xaab2('0x11'));var uuidv4=require(_0xaab2('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaab2('0x13'));var as=require(_0xaab2('0x14'));var hardwareService=require(_0xaab2('0x15'));var logger=require(_0xaab2('0x16'))('api');var utils=require(_0xaab2('0x17'));var config=require(_0xaab2('0x18'));var licenseUtil=require(_0xaab2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53c31d,_0x1849e3){_0x1849e3=_0x1849e3||0xcc;return function(_0x3217ea){if(_0x3217ea){return _0x53c31d[_0xaab2('0x1a')](_0x1849e3);}return _0x53c31d['status'](_0x1849e3)[_0xaab2('0x1b')]();};}function respondWithResult(_0x10ee1d,_0x28ce09){_0x28ce09=_0x28ce09||0xc8;return function(_0x18a2b9){if(_0x18a2b9){return _0x10ee1d['status'](_0x28ce09)[_0xaab2('0x1c')](_0x18a2b9);}};}function respondWithFilteredResult(_0x51f5a2,_0x321edd){return function(_0x694fa1){if(_0x694fa1){var _0x1d11dc=typeof _0x321edd[_0xaab2('0x1d')]===_0xaab2('0x1e')&&typeof _0x321edd[_0xaab2('0x1f')]===_0xaab2('0x1e');var _0x54d92d=_0x694fa1[_0xaab2('0x20')];var _0x5d7340=_0x1d11dc?0x0:_0x321edd[_0xaab2('0x1d')];var _0x39560b=_0x1d11dc?_0x694fa1[_0xaab2('0x20')]:_0x321edd[_0xaab2('0x1d')]+_0x321edd['limit'];var _0x3aeac0;if(_0x39560b>=_0x54d92d){_0x39560b=_0x54d92d;_0x3aeac0=0xc8;}else{_0x3aeac0=0xce;}_0x51f5a2['status'](_0x3aeac0);return _0x51f5a2[_0xaab2('0x21')](_0xaab2('0x22'),_0x5d7340+'-'+_0x39560b+'/'+_0x54d92d)[_0xaab2('0x1c')](_0x694fa1);}return null;};}function patchUpdates(_0x47998e){return function(_0x53e13d){try{jsonpatch[_0xaab2('0x23')](_0x53e13d,_0x47998e,!![]);}catch(_0x38327b){return BPromise['reject'](_0x38327b);}return _0x53e13d['save']();};}function saveUpdates(_0x1c65fd,_0x52131f){return function(_0x321286){if(_0x321286){return _0x321286[_0xaab2('0x24')](_0x1c65fd)[_0xaab2('0x25')](function(_0x1c614d){return _0x1c614d;});}return null;};}function removeEntity(_0x1d4705,_0x3884d0){return function(_0x106266){if(_0x106266){return _0x106266[_0xaab2('0x26')]()['then'](function(){_0x1d4705[_0xaab2('0x27')](0xcc)[_0xaab2('0x1b')]();});}};}function handleEntityNotFound(_0x2e9d11,_0x5154f0){return function(_0x12aa64){if(!_0x12aa64){_0x2e9d11[_0xaab2('0x1a')](0x194);}return _0x12aa64;};}function handleError(_0x1fc1f6,_0x2aeb6d){_0x2aeb6d=_0x2aeb6d||0x1f4;return function(_0xc28e8e){logger[_0xaab2('0x28')](_0xc28e8e[_0xaab2('0x29')]);if(_0xc28e8e[_0xaab2('0x2a')]){delete _0xc28e8e[_0xaab2('0x2a')];}_0x1fc1f6[_0xaab2('0x27')](_0x2aeb6d)[_0xaab2('0x2b')](_0xc28e8e);};}exports[_0xaab2('0x2c')]=function(_0x4f4cf7,_0x2093d5){var _0x384d75={},_0x39404a={},_0x1e0cce={'count':0x0,'rows':[]};var _0x4b5e2d=_[_0xaab2('0x2d')](db[_0xaab2('0x2e')][_0xaab2('0x2f')],function(_0xcd3047){return{'name':_0xcd3047[_0xaab2('0x30')],'type':_0xcd3047[_0xaab2('0x31')][_0xaab2('0x32')]};});_0x39404a[_0xaab2('0x33')]=_[_0xaab2('0x34')](_[_0xaab2('0x2d')](_0x4b5e2d,'name'),['format']);_0x39404a[_0xaab2('0x35')]=_[_0xaab2('0x36')](_0x4f4cf7['query']);_0x39404a[_0xaab2('0x37')]=_['intersection'](_0x39404a[_0xaab2('0x33')],_0x39404a['query']);_0x384d75['attributes']=_[_0xaab2('0x38')](_0x39404a[_0xaab2('0x33')],qs[_0xaab2('0x39')](_0x4f4cf7[_0xaab2('0x35')][_0xaab2('0x39')]));_0x384d75[_0xaab2('0x3a')]=_0x384d75[_0xaab2('0x3a')][_0xaab2('0x3b')]?_0x384d75['attributes']:_0x39404a[_0xaab2('0x33')];if(!_0x4f4cf7[_0xaab2('0x35')]['hasOwnProperty'](_0xaab2('0x3c'))){_0x384d75[_0xaab2('0x1f')]=qs['limit'](_0x4f4cf7[_0xaab2('0x35')][_0xaab2('0x1f')]);_0x384d75[_0xaab2('0x1d')]=qs[_0xaab2('0x1d')](_0x4f4cf7[_0xaab2('0x35')]['offset']);}_0x384d75['order']=qs[_0xaab2('0x3d')](_0x4f4cf7[_0xaab2('0x35')]['sort']);_0x384d75[_0xaab2('0x3e')]=qs[_0xaab2('0x37')](_[_0xaab2('0x3f')](_0x4f4cf7[_0xaab2('0x35')],_0x39404a[_0xaab2('0x37')]),_0x4b5e2d);if(_0x4f4cf7[_0xaab2('0x35')]['filter']){_0x384d75[_0xaab2('0x3e')]=_[_0xaab2('0x40')](_0x384d75['where'],{'$or':_['map'](_0x4b5e2d,function(_0x2db625){if(_0x2db625[_0xaab2('0x31')]!==_0xaab2('0x41')){var _0x4db369={};_0x4db369[_0x2db625[_0xaab2('0x2a')]]={'$like':'%'+_0x4f4cf7['query'][_0xaab2('0x42')]+'%'};return _0x4db369;}})});}_0x384d75=_['merge']({},_0x384d75,_0x4f4cf7[_0xaab2('0x43')]);var _0x459220={'where':_0x384d75[_0xaab2('0x3e')]};return db['VoiceRecording']['count'](_0x459220)[_0xaab2('0x25')](function(_0x51b11f){_0x1e0cce[_0xaab2('0x20')]=_0x51b11f;if(_0x4f4cf7[_0xaab2('0x35')][_0xaab2('0x44')]){_0x384d75[_0xaab2('0x45')]=[{'all':!![]}];}return db['VoiceRecording'][_0xaab2('0x46')](_0x384d75);})[_0xaab2('0x25')](function(_0x52ae56){_0x1e0cce['rows']=_0x52ae56;return _0x1e0cce;})[_0xaab2('0x25')](respondWithFilteredResult(_0x2093d5,_0x384d75))[_0xaab2('0x47')](handleError(_0x2093d5,null));};exports[_0xaab2('0x48')]=function(_0x58ffe4,_0xb8fc38){var _0x3f49e0={'raw':![],'where':{'id':_0x58ffe4['params']['id']}},_0x26d97a={};_0x26d97a[_0xaab2('0x33')]=_[_0xaab2('0x36')](db[_0xaab2('0x2e')][_0xaab2('0x2f')]);_0x26d97a[_0xaab2('0x35')]=_[_0xaab2('0x36')](_0x58ffe4[_0xaab2('0x35')]);_0x26d97a[_0xaab2('0x37')]=_[_0xaab2('0x38')](_0x26d97a[_0xaab2('0x33')],_0x26d97a['query']);_0x3f49e0[_0xaab2('0x3a')]=_[_0xaab2('0x38')](_0x26d97a[_0xaab2('0x33')],qs[_0xaab2('0x39')](_0x58ffe4[_0xaab2('0x35')][_0xaab2('0x39')]));_0x3f49e0[_0xaab2('0x3a')]=_0x3f49e0['attributes'][_0xaab2('0x3b')]?_0x3f49e0['attributes']:_0x26d97a[_0xaab2('0x33')];if(_0x58ffe4[_0xaab2('0x35')][_0xaab2('0x44')]){_0x3f49e0[_0xaab2('0x45')]=[{'all':!![]}];}_0x3f49e0=_[_0xaab2('0x40')]({},_0x3f49e0,_0x58ffe4['options']);return db['VoiceRecording'][_0xaab2('0x49')](_0x3f49e0)[_0xaab2('0x25')](handleEntityNotFound(_0xb8fc38,null))['then'](respondWithResult(_0xb8fc38,null))[_0xaab2('0x47')](handleError(_0xb8fc38,null));};exports[_0xaab2('0x4a')]=function(_0x1fb0d9,_0x2876a2){return db[_0xaab2('0x2e')]['create'](_0x1fb0d9[_0xaab2('0x4b')],{})[_0xaab2('0x25')](respondWithResult(_0x2876a2,0xc9))['catch'](handleError(_0x2876a2,null));};exports[_0xaab2('0x24')]=function(_0x2a04f4,_0x4be13a){if(_0x2a04f4[_0xaab2('0x4b')]['id']){delete _0x2a04f4[_0xaab2('0x4b')]['id'];}return db[_0xaab2('0x2e')]['find']({'where':{'id':_0x2a04f4['params']['id']}})[_0xaab2('0x25')](handleEntityNotFound(_0x4be13a,null))['then'](saveUpdates(_0x2a04f4['body'],null))[_0xaab2('0x25')](respondWithResult(_0x4be13a,null))[_0xaab2('0x47')](handleError(_0x4be13a,null));};exports[_0xaab2('0x4c')]=function(_0x20371f,_0x2ebc3e){return db[_0xaab2('0x2e')][_0xaab2('0x4c')]()[_0xaab2('0x25')](respondWithResult(_0x2ebc3e,null))[_0xaab2('0x47')](handleError(_0x2ebc3e,null));};exports[_0xaab2('0x4d')]=function(_0xe978ab,_0x10a56d,_0x20f6b6){var _0x466db5=require(_0xaab2('0x4e'));var _0x4511ed=![];var _0x3460ff={};if(_0xe978ab[_0xaab2('0x35')][_0xaab2('0x31')]&&_0xe978ab[_0xaab2('0x35')]['type']==='uniqueid'){_0x3460ff[_0xaab2('0x4f')]=_0xe978ab[_0xaab2('0x50')]['id'];}else{_0x3460ff['id']=_0xe978ab[_0xaab2('0x50')]['id'];}return db[_0xaab2('0x2e')][_0xaab2('0x49')]({'where':_0x3460ff,'attributes':['id','value'],'raw':!![]})[_0xaab2('0x25')](handleEntityNotFound(_0x10a56d,null))[_0xaab2('0x25')](function(_0x4aa389){if(_0x4aa389){var _0x429f9f=_0x4aa389[_0xaab2('0x51')];var _0x4a13c1=util[_0xaab2('0x52')](_0xaab2('0x53'),_0x429f9f);if(fs[_0xaab2('0x54')](_0x4a13c1)){_0x4511ed=!![];return _0x466db5[_0xaab2('0x55')](_0x4a13c1,_0x429f9f,config[_0xaab2('0x56')][_0xaab2('0x57')])[_0xaab2('0x25')](function(){return _0x4aa389;});}return _0x4aa389;}})[_0xaab2('0x25')](function(_0x50f89e){if(_0x50f89e){var _0x37a8d0=_0x50f89e[_0xaab2('0x51')];if(!fs[_0xaab2('0x54')](_0x37a8d0)){throw new db['Sequelize']['ValidationError'](_0xaab2('0x58'));}if(_0x50f89e[_0xaab2('0x59')]){return _0x10a56d[_0xaab2('0x4d')](_0x37a8d0,_0x50f89e[_0xaab2('0x59')]+path[_0xaab2('0x5a')](_0x37a8d0),function(){if(_0x4511ed){fs[_0xaab2('0x5b')](_0x37a8d0);}});}else{return _0x10a56d[_0xaab2('0x4d')](_0x37a8d0,function(_0x39a8e2){if(_0x4511ed){fs[_0xaab2('0x5b')](_0x37a8d0);}});}}})['catch'](function(_0x33387b){if(_0x33387b['message']===_0xaab2('0x58')){_0x10a56d[_0xaab2('0x27')](0x194)[_0xaab2('0x2b')]('Not\x20found');}else{return handleError(_0x10a56d,null);}});};exports[_0xaab2('0x5c')]=function(_0x1f7dd1,_0x5c9ea3,_0x6e5d6a){var _0x52386f=require(_0xaab2('0x4e'));var _0x39f9a7=![];var _0x431bb4={'$and':[db[_0xaab2('0x5d')][_0xaab2('0x3e')](db[_0xaab2('0x5d')]['fn'](_0xaab2('0x5e'),db[_0xaab2('0x5d')][_0xaab2('0x5f')]('uniqueid')),_0x1f7dd1[_0xaab2('0x35')][_0xaab2('0x60')])]};if(_0x1f7dd1[_0xaab2('0x35')][_0xaab2('0x31')]&&_0x1f7dd1[_0xaab2('0x35')][_0xaab2('0x31')]===_0xaab2('0x4f')){_0x431bb4[_0xaab2('0x61')][_0xaab2('0x62')]({'uniqueid':_0x1f7dd1[_0xaab2('0x50')]['id']});}else{_0x431bb4[_0xaab2('0x61')][_0xaab2('0x62')]({'id':_0x1f7dd1[_0xaab2('0x50')]['id']});}return db['VoiceRecording'][_0xaab2('0x49')]({'where':_0x431bb4,'attributes':['id',_0xaab2('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x5c9ea3,null))[_0xaab2('0x25')](function(_0x3d368e){if(_0x3d368e){var _0x2ce02c=util[_0xaab2('0x52')](_0xaab2('0x53'),_0x3d368e['value']);if(fs[_0xaab2('0x54')](_0x2ce02c)){_0x39f9a7=!![];return _0x52386f[_0xaab2('0x55')](_0x2ce02c,_0x3d368e[_0xaab2('0x51')],config[_0xaab2('0x56')]['recording'])[_0xaab2('0x25')](function(){return _0x3d368e;});}return _0x3d368e;}})[_0xaab2('0x25')](function(_0x23dc28){if(_0x23dc28){if(!fs[_0xaab2('0x54')](_0x23dc28['value'])){throw new db[(_0xaab2('0x63'))][(_0xaab2('0x64'))](_0xaab2('0x58'));}if(_0x23dc28['filename']){return _0x5c9ea3['download'](_0x23dc28[_0xaab2('0x51')],_0x23dc28[_0xaab2('0x59')]+path[_0xaab2('0x5a')](_0x23dc28['value']),function(){if(_0x39f9a7){fs[_0xaab2('0x5b')](_0x23dc28[_0xaab2('0x51')]);}});}else{return _0x5c9ea3[_0xaab2('0x4d')](_0x23dc28[_0xaab2('0x51')],function(_0x295936){if(_0x39f9a7){fs[_0xaab2('0x5b')](_0x23dc28[_0xaab2('0x51')]);}});}}})[_0xaab2('0x47')](handleError(_0x5c9ea3,null));};exports['destroy']=function(_0x59b7eb,_0x453802){return db[_0xaab2('0x2e')][_0xaab2('0x49')]({'where':{'id':_0x59b7eb['params']['id']}})[_0xaab2('0x25')](function(_0x6740bb){if(_[_0xaab2('0x65')](_0x6740bb)){throw new ReferenceError(_0xaab2('0x66'));}return _0x6740bb;})[_0xaab2('0x25')](function(_0x49d327){var _0xa1a0e=_0x49d327['value'];logger[_0xaab2('0x67')](_0xaab2('0x68'),_0xa1a0e);if(!_['isNil'](_0x49d327[_0xaab2('0x51')])&&fs[_0xaab2('0x54')](_0xa1a0e)){logger[_0xaab2('0x67')](_0xaab2('0x69')+_0xa1a0e+_0xaab2('0x6a'));fs[_0xaab2('0x6b')](_0xa1a0e);}_0xa1a0e=_0xa1a0e+_0xaab2('0x6c');if(!_['isNil'](_0x49d327[_0xaab2('0x51')])&&fs[_0xaab2('0x54')](_0xa1a0e)){logger[_0xaab2('0x67')](_0xaab2('0x69')+_0xa1a0e+_0xaab2('0x6a'));fs['unlinkSync'](_0xa1a0e);}return _0x49d327;})[_0xaab2('0x25')](function(_0x309e24){if(!_0x309e24)throw new InternalError();return _0x309e24[_0xaab2('0x26')]();})['then'](function(){_0x453802[_0xaab2('0x27')](0xcc)[_0xaab2('0x1b')]();})[_0xaab2('0x47')](handleError(_0x453802,null));};function getBucketslist(_0x2c36b8,_0x5e274b,_0x1385b2){return new Promise(function(_0xb1e980,_0x101e19){var _0x2979fa=new AWS['S3']({'accessKeyId':_0x5e274b,'secretAccessKey':_0x2c36b8,'region':_0x1385b2});_0x2979fa['listBuckets']({},function(_0x625382,_0x859a30){if(_0x625382){return _0x101e19(_0x625382);}else{return _0xb1e980(_0x859a30);}});});}function createBucket(_0x424dd6,_0x5ceda9,_0x4c75a7,_0x5b9de4){return new Promise(function(_0x3070f9,_0x3b3198){var _0x2cdb27=new AWS['S3']({'accessKeyId':_0x5ceda9,'secretAccessKey':_0x424dd6,'region':_0x4c75a7});_0x2cdb27[_0xaab2('0x6d')]({'Bucket':_0x5b9de4},function(_0x523527,_0x3aa675){if(_0x523527){return _0x3b3198(_0x523527);}else{return _0x3070f9(_0x3aa675);}});});}function uploadFile(_0x4129a7,_0x176146,_0xdc2bbf,_0x8ecf8b,_0x787377,_0x2a0f67){return new Promise(function(_0x5a2fdb,_0x143f2e){var _0x139bca=new AWS['S3']({'accessKeyId':_0x176146,'secretAccessKey':_0x4129a7,'region':_0xdc2bbf});_0x139bca['upload']({'Bucket':_0x8ecf8b,'Key':_0x787377,'Body':_0x2a0f67},function(_0x43115d,_0x3416d0){if(_0x43115d){return _0x143f2e(_0x43115d);}else{return _0x5a2fdb(_0x3416d0);}});});}function startTranscribe(_0x236925,_0x54f76d,_0x3542dc,_0xfb1be8,_0x1885b8,_0xb7ecbe){return new Promise(function(_0x167df3,_0x3ab1bd){var _0x51de7a=new AWS['TranscribeService']({'accessKeyId':_0x54f76d,'secretAccessKey':_0x236925,'region':_0x3542dc});_0x51de7a[_0xaab2('0x6e')]({'TranscriptionJobName':_0xfb1be8,'LanguageCode':_0x1885b8,'Media':{'MediaFileUri':_0xb7ecbe}},function(_0x1948d0,_0x1b06b5){if(_0x1948d0){return _0x3ab1bd(_0x1948d0);}else{return _0x167df3(_0x1b06b5);}});});}function transcribe(_0x403d67,_0x116860,_0x54adfb,_0x2865a7,_0x4501dd,_0x4e25c2,_0x331d26){return new Promise(function(_0x3f1d24,_0x2ef130){var _0x2ff05c={};logger[_0xaab2('0x67')](util[_0xaab2('0x52')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x403d67,_0x4501dd));return uploadFile(_0x116860,_0x54adfb,_0x2865a7,_0x4501dd,path[_0xaab2('0x6f')](_0x4e25c2),fs[_0xaab2('0x70')](_0x4e25c2))[_0xaab2('0x25')](function(_0x5a7419){logger['info'](util[_0xaab2('0x52')](_0xaab2('0x71'),_0x403d67,_0x4501dd,_0x5a7419['Location']));_0x2ff05c[_0xaab2('0x72')]=_0x5a7419['Bucket'];_0x2ff05c[_0xaab2('0x73')]=_0x5a7419[_0xaab2('0x74')];logger[_0xaab2('0x67')](util[_0xaab2('0x52')](_0xaab2('0x75'),_0x403d67));return startTranscribe(_0x116860,_0x54adfb,_0x2865a7,uuidv4(),_0x331d26,_0x5a7419['Location']);})['then'](function(_0xcfb733){logger['info'](util['format'](_0xaab2('0x76'),_0x403d67,_0xcfb733[_0xaab2('0x77')][_0xaab2('0x78')]));_0x2ff05c['transcribeName']=_0xcfb733[_0xaab2('0x77')][_0xaab2('0x78')];_0x2ff05c[_0xaab2('0x79')]=_0xcfb733[_0xaab2('0x77')][_0xaab2('0x7a')];return _0x3f1d24(_0x2ff05c);})[_0xaab2('0x47')](function(_0x4af9fb){return _0x2ef130(_0x4af9fb);});});}exports['runTranscribe']=function(_0x59ffd4,_0x402bc6,_0x318eb8){var _0x51d6a8;var _0x3eee6f;var _0x2ab050;var _0x1fe07a=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0x59ffd4[_0xaab2('0x50')]['id']}})[_0xaab2('0x25')](function(_0x4e122c){if(_0x4e122c){var _0x36db4a=util[_0xaab2('0x52')](_0xaab2('0x53'),_0x4e122c[_0xaab2('0x51')]);if(fs[_0xaab2('0x54')](_0x36db4a)){cypher=!![];return _0x1fe07a[_0xaab2('0x55')](_0x36db4a,_0x4e122c[_0xaab2('0x51')],config[_0xaab2('0x56')][_0xaab2('0x57')])['then'](function(){return _0x4e122c;});}return _0x4e122c;}})[_0xaab2('0x25')](function(_0x24a0f1){if(!_0x24a0f1){throw new db[(_0xaab2('0x63'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x3eee6f=_0x24a0f1;return db[_0xaab2('0x7b')][_0xaab2('0x7c')]({'where':{'id':0x1}});})[_0xaab2('0x25')](handleEntityNotFound(_0x402bc6,null))[_0xaab2('0x25')](function(_0x193558){if(_0x193558){_0x51d6a8=_0x193558;if(!_0x51d6a8[_0xaab2('0x7d')]||!_0x51d6a8[_0xaab2('0x7e')]||!_0x51d6a8[_0xaab2('0x7f')]||!_0x51d6a8[_0xaab2('0x80')]||!_0x51d6a8[_0xaab2('0x72')]){throw new db[(_0xaab2('0x63'))][(_0xaab2('0x64'))](_0xaab2('0x81'));}if(_0x59ffd4[_0xaab2('0x4b')]['runSentiment']&&(!_0x51d6a8['sentiment']||!_0x51d6a8[_0xaab2('0x82')]||!_0x51d6a8[_0xaab2('0x83')]||!_0x51d6a8[_0xaab2('0x80')]||!_0x51d6a8[_0xaab2('0x72')])){throw new db[(_0xaab2('0x63'))][(_0xaab2('0x64'))](_0xaab2('0x84'));}return db['CloudProvider'][_0xaab2('0x7c')]({'where':{'id':_0x51d6a8[_0xaab2('0x7e')]}});}})[_0xaab2('0x25')](function(_0x545ac9){if(!_0x545ac9){throw new db['Sequelize'][(_0xaab2('0x64'))](_0xaab2('0x85'));}if(!_0x545ac9[_0xaab2('0x86')]||!_0x545ac9['data2']){throw new db[(_0xaab2('0x63'))][(_0xaab2('0x64'))](_0xaab2('0x87'));}_0x2ab050=_0x545ac9;return getBucketslist(_0x2ab050['data1'],_0x2ab050[_0xaab2('0x88')],_0x51d6a8['transcribeRegion']);})[_0xaab2('0x25')](function(_0x47541f){if(_0x47541f&&_0x47541f[_0xaab2('0x89')]){var _0x1cbee9=_[_0xaab2('0x49')](_0x47541f[_0xaab2('0x89')],function(_0x5ef7d7){return _0x5ef7d7['Name']===_0x51d6a8[_0xaab2('0x72')];});if(!_0x1cbee9){logger['info'](util[_0xaab2('0x52')](_0xaab2('0x8a'),_0x59ffd4[_0xaab2('0x50')]['id'],_0x51d6a8['bucket']));return createBucket(_0x2ab050['data1'],_0x2ab050[_0xaab2('0x88')],_0x51d6a8[_0xaab2('0x7f')],_0x51d6a8[_0xaab2('0x72')]);}logger[_0xaab2('0x67')](util[_0xaab2('0x52')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x59ffd4['params']['id'],_0x51d6a8[_0xaab2('0x72')]));return;}})[_0xaab2('0x25')](function(_0x4e552c){if(_0x3eee6f['transcribeStatus']===_0xaab2('0x8b')){return transcribe(_0x59ffd4['params']['id'],_0x2ab050[_0xaab2('0x86')],_0x2ab050[_0xaab2('0x88')],_0x51d6a8[_0xaab2('0x7f')],_0x51d6a8['bucket'],_0x3eee6f[_0xaab2('0x51')],_0x51d6a8[_0xaab2('0x80')]);}else{logger[_0xaab2('0x67')](util[_0xaab2('0x52')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x59ffd4['params']['id']));return{'transcribeStatus':_0xaab2('0x8c')};}})[_0xaab2('0x25')](function(_0xc09e3d){if(_0xc09e3d){_0xc09e3d[_0xaab2('0x8d')]=_0x59ffd4[_0xaab2('0x4b')][_0xaab2('0x8e')];return _0x3eee6f[_0xaab2('0x8f')](_0xc09e3d);}})[_0xaab2('0x25')](respondWithResult(_0x402bc6,null))['catch'](handleError(_0x402bc6,null));};function writeFile(_0xb0a911,_0x598dee){return new Promise(function(_0x4a125e,_0x130219){fs['writeFile'](_0x598dee,_0xb0a911,function(_0x583230,_0x3b8c40){if(_0x583230){return _0x130219(_0x583230);}else{return _0x4a125e(_0x3b8c40);}});});}exports[_0xaab2('0x90')]=function(_0x377cb5,_0x57a2b8,_0x19ce85){return db[_0xaab2('0x2e')][_0xaab2('0x7c')]({'where':{'id':_0x377cb5['params']['id']}})[_0xaab2('0x25')](handleEntityNotFound(_0x57a2b8))[_0xaab2('0x25')](function(_0x448e7c){if(_0x448e7c&&_0x448e7c[_0xaab2('0x91')]){var _0x547bc2=_0x448e7c[_0xaab2('0x91')];var _0xd71a1b=config[_0xaab2('0x92')]+_0xaab2('0x93')+_0x448e7c['id']+'.txt';if(fs[_0xaab2('0x54')](_0xd71a1b)){return _0xd71a1b;}return writeFile(_0x547bc2,_0xd71a1b)[_0xaab2('0x25')](function(){return _0xd71a1b;});}else{throw new db[(_0xaab2('0x63'))]['ValidationError'](_0xaab2('0x94'));}})[_0xaab2('0x25')](function(_0x103964){return _0x57a2b8[_0xaab2('0x4d')](_0x103964);})[_0xaab2('0x47')](handleError(_0x57a2b8));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9ba661d..62a56f5 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 _0x6898=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x6898,0x11b));var _0x8689=function(_0x9f057f,_0x925030){_0x9f057f=_0x9f057f-0x0;var _0x524d08=_0x6898[_0x9f057f];return _0x524d08;};'use strict';var attributes=require(_0x8689('0x0'));module['exports']=function(_0x3b6c93,_0x15c5c2){return _0x3b6c93[_0x8689('0x1')](_0x8689('0x2'),attributes,{'tableName':_0x8689('0x3'),'paranoid':![],'indexes':[{'name':_0x8689('0x4'),'fields':[_0x8689('0x4')]},{'name':'transcribeStatus','fields':[_0x8689('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5b6=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x1d7ddb,_0x5b6326){var _0x28db07=function(_0x246431){while(--_0x246431){_0x1d7ddb['push'](_0x1d7ddb['shift']());}};_0x28db07(++_0x5b6326);}(_0xd5b6,0x73));var _0x6d5b=function(_0x2ed8e7,_0x495d77){_0x2ed8e7=_0x2ed8e7-0x0;var _0x128fe6=_0xd5b6[_0x2ed8e7];return _0x128fe6;};'use strict';var attributes=require(_0x6d5b('0x0'));module[_0x6d5b('0x1')]=function(_0x22d01e,_0x1f50ab){return _0x22d01e[_0x6d5b('0x2')](_0x6d5b('0x3'),attributes,{'tableName':_0x6d5b('0x4'),'paranoid':![],'indexes':[{'name':_0x6d5b('0x5'),'fields':['uniqueid']},{'name':_0x6d5b('0x6'),'fields':[_0x6d5b('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f6dea5a..1abf671 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 _0xd4a2=['client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','UpdateVoiceRecording','update','body','options','raw','attributes','limit','stringify','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','VoiceRecording','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','recording','unlink','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4287fe,_0x14ad49){var _0x329a39=function(_0x3c30a9){while(--_0x3c30a9){_0x4287fe['push'](_0x4287fe['shift']());}};_0x329a39(++_0x14ad49);}(_0xd4a2,0x173));var _0x2d4a=function(_0x322152,_0xd4dbfc){_0x322152=_0x322152-0x0;var _0x2d0c55=_0xd4a2[_0x322152];return _0x2d0c55;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57058f,_0x45fefb,_0x41b161){return new BPromise(function(_0x1f237e,_0x29597e){return client[_0x2d4a('0x9')](_0x57058f,_0x41b161)[_0x2d4a('0xa')](function(_0xb9f016){logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));logger[_0x2d4a('0xe')](_0x2d4a('0xf'),_0x45fefb,'request\x20sent',JSON['stringify'](_0xb9f016));if(_0xb9f016[_0x2d4a('0x10')]){if(_0xb9f016['error'][_0x2d4a('0x11')]===0x1f4){logger[_0x2d4a('0x10')](_0x2d4a('0xc'),_0x45fefb,_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);return _0x29597e(_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);}logger[_0x2d4a('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x45fefb,_0xb9f016['error'][_0x2d4a('0x12')]);return _0x1f237e(_0xb9f016['error'][_0x2d4a('0x12')]);}else{logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));_0x1f237e(_0xb9f016['result'][_0x2d4a('0x12')]);}})['catch'](function(_0x2838fa){logger['error'](_0x2d4a('0xc'),_0x45fefb,_0x2838fa);_0x29597e(_0x2838fa);});});}exports[_0x2d4a('0x13')]=function(_0x2188b2){var _0x388371=this;return new Promise(function(_0x498956,_0x4fd169){return db['VoiceRecording'][_0x2d4a('0x14')](_0x2188b2[_0x2d4a('0x15')],{'raw':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2['options']['where']||null:null,'attributes':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x18')]||null:null,'limit':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x19')]||null:null})[_0x2d4a('0xa')](function(_0xa43fb1){logger['info'](_0x2d4a('0x13'),_0x2188b2);logger[_0x2d4a('0xe')](_0x2d4a('0x13'),_0x2188b2,JSON[_0x2d4a('0x1a')](_0xa43fb1));_0x498956(_0xa43fb1);})[_0x2d4a('0x1b')](function(_0xed2822){logger[_0x2d4a('0x10')](_0x2d4a('0x13'),_0xed2822['message'],_0x2188b2);_0x4fd169(_0x388371['error'](0x1f4,_0xed2822['message']));});});};exports[_0x2d4a('0x1c')]=function(_0x5029f3){var _0x410f7d=this;return new Promise(function(_0x3a2fd3,_0x3d5558){var _0x1d2fa6=require(_0x2d4a('0x1d'));var _0x326c38;return db[_0x2d4a('0x1e')][_0x2d4a('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x2d4a('0xa')](function(_0x5ce262){_0x326c38=_0x5ce262;return db[_0x2d4a('0x20')][_0x2d4a('0x21')](_0x5029f3[_0x2d4a('0x15')]);})[_0x2d4a('0xa')](function(_0x101382){if(_0x326c38[_0x2d4a('0x22')]&&fs[_0x2d4a('0x23')](_0x101382[_0x2d4a('0x24')])){var _0x51b447=util[_0x2d4a('0x25')](_0x2d4a('0x26'),_0x101382[_0x2d4a('0x24')]);return _0x1d2fa6[_0x2d4a('0x27')](_0x101382[_0x2d4a('0x24')],_0x51b447,config['secrets'][_0x2d4a('0x28')])[_0x2d4a('0xa')](function(){fs[_0x2d4a('0x29')](_0x101382[_0x2d4a('0x24')]);logger[_0x2d4a('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x101382;});}return _0x101382;})[_0x2d4a('0xa')](function(_0x2ae694){logger[_0x2d4a('0xb')](_0x2d4a('0x1c'),_0x5029f3);logger[_0x2d4a('0xe')](_0x2d4a('0x1c'),_0x5029f3,JSON['stringify'](_0x2ae694));_0x3a2fd3(_0x2ae694);})[_0x2d4a('0x1b')](function(_0x28955f){logger[_0x2d4a('0x10')](_0x2d4a('0x1c'),_0x28955f[_0x2d4a('0x12')],_0x5029f3);_0x3d5558(_0x410f7d['error'](0x1f4,_0x28955f[_0x2d4a('0x12')]));});});}; \ No newline at end of file +var _0x430c=['../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','body','options','raw','where','limit','UpdateVoiceRecording','catch','CreateVoiceRecording'];(function(_0x169a2f,_0x3a8d03){var _0x19cb27=function(_0x77b10c){while(--_0x77b10c){_0x169a2f['push'](_0x169a2f['shift']());}};_0x19cb27(++_0x3a8d03);}(_0x430c,0x1a1));var _0xc430=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x430c[_0x2b737c];return _0x466ed5;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});}exports['UpdateVoiceRecording']=function(_0x5d3acc){var _0x36d112=this;return new Promise(function(_0x4c1937,_0x2bcb21){return db['VoiceRecording']['update'](_0x5d3acc[_0xc430('0x11')],{'raw':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d3acc[_0xc430('0x12')]?_0x5d3acc[_0xc430('0x12')][_0xc430('0x14')]||null:null,'attributes':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')]['attributes']||null:null,'limit':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x15')]||null:null})[_0xc430('0x8')](function(_0x56dd16){logger[_0xc430('0x9')]('UpdateVoiceRecording',_0x5d3acc);logger[_0xc430('0xb')](_0xc430('0x16'),_0x5d3acc,JSON['stringify'](_0x56dd16));_0x4c1937(_0x56dd16);})[_0xc430('0x17')](function(_0x3cdbd3){logger['error'](_0xc430('0x16'),_0x3cdbd3['message'],_0x5d3acc);_0x2bcb21(_0x36d112[_0xc430('0xe')](0x1f4,_0x3cdbd3['message']));});});};exports[_0xc430('0x18')]=function(_0x21e28a){var _0x50110b=this;return new Promise(function(_0x33433f,_0x2ec021){var _0x2c0422=require(_0xc430('0x19'));var _0x285407;return db['Setting'][_0xc430('0x1a')]({'attributes':['id',_0xc430('0x1b')],'where':{'id':0x1},'raw':!![]})[_0xc430('0x8')](function(_0x1591e3){_0x285407=_0x1591e3;return db['VoiceRecording'][_0xc430('0x1c')](_0x21e28a['body']);})[_0xc430('0x8')](function(_0x4ad29e){if(_0x285407[_0xc430('0x1b')]&&fs[_0xc430('0x1d')](_0x4ad29e[_0xc430('0x1e')])){var _0x3d7ccf=util['format'](_0xc430('0x1f'),_0x4ad29e[_0xc430('0x1e')]);return _0x2c0422[_0xc430('0x20')](_0x4ad29e[_0xc430('0x1e')],_0x3d7ccf,config['secrets'][_0xc430('0x21')])[_0xc430('0x8')](function(){fs['unlink'](_0x4ad29e[_0xc430('0x1e')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x4ad29e;});}return _0x4ad29e;})[_0xc430('0x8')](function(_0x973a39){logger[_0xc430('0x9')](_0xc430('0x18'),_0x21e28a);logger[_0xc430('0xb')](_0xc430('0x18'),_0x21e28a,JSON[_0xc430('0xd')](_0x973a39));_0x33433f(_0x973a39);})[_0xc430('0x17')](function(_0x47da0d){logger[_0xc430('0xe')]('CreateVoiceRecording',_0x47da0d[_0xc430('0xf')],_0x21e28a);_0x2ec021(_0x50110b[_0xc430('0xe')](0x1f4,_0x47da0d[_0xc430('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index e675e8d..704c128 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 _0x17cb=['express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x17cb,0x1f1));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb17c('0x0'));var path=require(_0xb17c('0x1'));var timeout=require(_0xb17c('0x2'));var express=require(_0xb17c('0x3'));var router=express[_0xb17c('0x4')]();var fs_extra=require(_0xb17c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb17c('0x6'));var config=require('../../config/environment');var controller=require(_0xb17c('0x7'));router[_0xb17c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb17c('0x9')]);router['get'](_0xb17c('0xa'),auth[_0xb17c('0xb')](),controller['describe']);router[_0xb17c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb17c('0xc')]('/',auth['isAuthenticated'](),controller[_0xb17c('0xd')]);router[_0xb17c('0xe')](_0xb17c('0xf'),auth['isAuthenticated'](),controller[_0xb17c('0x10')]);router[_0xb17c('0x11')](_0xb17c('0xf'),auth[_0xb17c('0xb')](),controller[_0xb17c('0x12')]);module[_0xb17c('0x13')]=router; \ No newline at end of file +var _0x3c13=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0xf64789,_0x55bdfa){var _0x3622f1=function(_0x799d4f){while(--_0x799d4f){_0xf64789['push'](_0xf64789['shift']());}};_0x3622f1(++_0x55bdfa);}(_0x3c13,0x114));var _0x33c1=function(_0x15970c,_0x4f691d){_0x15970c=_0x15970c-0x0;var _0x57e118=_0x3c13[_0x15970c];return _0x57e118;};'use strict';var multer=require(_0x33c1('0x0'));var util=require(_0x33c1('0x1'));var path=require(_0x33c1('0x2'));var timeout=require(_0x33c1('0x3'));var express=require(_0x33c1('0x4'));var router=express[_0x33c1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x33c1('0x6'));var config=require(_0x33c1('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x33c1('0x8')]('/',auth[_0x33c1('0x9')](),controller[_0x33c1('0xa')]);router[_0x33c1('0x8')]('/describe',auth[_0x33c1('0x9')](),controller[_0x33c1('0xb')]);router['get'](_0x33c1('0xc'),auth['isAuthenticated'](),controller[_0x33c1('0xd')]);router[_0x33c1('0xe')]('/',auth[_0x33c1('0x9')](),controller[_0x33c1('0xf')]);router[_0x33c1('0x10')](_0x33c1('0xc'),auth['isAuthenticated'](),controller[_0x33c1('0x11')]);router[_0x33c1('0x12')](_0x33c1('0xc'),auth['isAuthenticated'](),controller[_0x33c1('0x13')]);module[_0x33c1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 7939323..1e08883 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 _0xa018=['blind','STRING','sequelize','moment','ENUM'];(function(_0x2ec4c8,_0x188a13){var _0x27f1f5=function(_0xc922fd){while(--_0xc922fd){_0x2ec4c8['push'](_0x2ec4c8['shift']());}};_0x27f1f5(++_0x188a13);}(_0xa018,0xf2));var _0x8a01=function(_0x5a3205,_0x4079ae){_0x5a3205=_0x5a3205-0x0;var _0x46ad1c=_0xa018[_0x5a3205];return _0x46ad1c;};'use strict';var Sequelize=require(_0x8a01('0x0'));var moment=require(_0x8a01('0x1'));module['exports']={'type':{'type':Sequelize[_0x8a01('0x2')](_0x8a01('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x8a01('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x8a01('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x8a01('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x8a01('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x8a01('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x8a01('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x8a01('0x4')]},'transfereechannel':{'type':Sequelize[_0x8a01('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x8a01('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8a01('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8a01('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x8a01('0x4')]},'isexternal':{'type':Sequelize[_0x8a01('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x8a01('0x4')]},'extension':{'type':Sequelize[_0x8a01('0x4')]}}; \ No newline at end of file +var _0xfa3e=['Yes','sequelize','exports','ENUM','blind','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfa3e,0xd3));var _0xefa3=function(_0x503798,_0x3a02e6){_0x503798=_0x503798-0x0;var _0x214c01=_0xfa3e[_0x503798];return _0x214c01;};'use strict';var Sequelize=require(_0xefa3('0x0'));var moment=require('moment');module[_0xefa3('0x1')]={'type':{'type':Sequelize[_0xefa3('0x2')](_0xefa3('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xefa3('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xefa3('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xefa3('0x4')]},'transferercontext':{'type':Sequelize[_0xefa3('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xefa3('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xefa3('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xefa3('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xefa3('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xefa3('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xefa3('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xefa3('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xefa3('0x4')]},'isexternal':{'type':Sequelize[_0xefa3('0x2')](_0xefa3('0x5'),'No')},'context':{'type':Sequelize[_0xefa3('0x4')]},'extension':{'type':Sequelize[_0xefa3('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 58913db..45d41bf 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 _0xad45=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xad45,0xa9));var _0x5ad4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad45[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5ad4('0x0'));var rimraf=require(_0x5ad4('0x1'));var zipdir=require(_0x5ad4('0x2'));var jsonpatch=require(_0x5ad4('0x3'));var rp=require(_0x5ad4('0x4'));var moment=require(_0x5ad4('0x5'));var BPromise=require(_0x5ad4('0x6'));var Mustache=require(_0x5ad4('0x7'));var util=require(_0x5ad4('0x8'));var path=require('path');var sox=require(_0x5ad4('0x9'));var csv=require('to-csv');var ejs=require(_0x5ad4('0xa'));var fs=require('fs');var fs_extra=require(_0x5ad4('0xb'));var _=require('lodash');var squel=require(_0x5ad4('0xc'));var crypto=require(_0x5ad4('0xd'));var jsforce=require(_0x5ad4('0xe'));var deskjs=require(_0x5ad4('0xf'));var toCsv=require(_0x5ad4('0x10'));var querystring=require('querystring');var Papa=require(_0x5ad4('0x11'));var Redis=require(_0x5ad4('0x12'));var authService=require(_0x5ad4('0x13'));var qs=require(_0x5ad4('0x14'));var as=require(_0x5ad4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad4('0x16'))(_0x5ad4('0x17'));var utils=require(_0x5ad4('0x18'));var config=require(_0x5ad4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b8d9a,_0x360806){_0x360806=_0x360806||0xcc;return function(_0x164bc8){if(_0x164bc8){return _0x2b8d9a[_0x5ad4('0x1a')](_0x360806);}return _0x2b8d9a[_0x5ad4('0x1b')](_0x360806)[_0x5ad4('0x1c')]();};}function respondWithResult(_0x30d500,_0x1c09d6){_0x1c09d6=_0x1c09d6||0xc8;return function(_0x312028){if(_0x312028){return _0x30d500[_0x5ad4('0x1b')](_0x1c09d6)[_0x5ad4('0x1d')](_0x312028);}};}function respondWithFilteredResult(_0x51ae20,_0x1f6ecb){return function(_0x51f8fc){if(_0x51f8fc){var _0x524626=typeof _0x1f6ecb[_0x5ad4('0x1e')]==='undefined'&&typeof _0x1f6ecb[_0x5ad4('0x1f')]===_0x5ad4('0x20');var _0x2b6cce=_0x51f8fc[_0x5ad4('0x21')];var _0x556f10=_0x524626?0x0:_0x1f6ecb[_0x5ad4('0x1e')];var _0x2be514=_0x524626?_0x51f8fc[_0x5ad4('0x21')]:_0x1f6ecb['offset']+_0x1f6ecb[_0x5ad4('0x1f')];var _0x5c29ab;if(_0x2be514>=_0x2b6cce){_0x2be514=_0x2b6cce;_0x5c29ab=0xc8;}else{_0x5c29ab=0xce;}_0x51ae20[_0x5ad4('0x1b')](_0x5c29ab);return _0x51ae20[_0x5ad4('0x22')](_0x5ad4('0x23'),_0x556f10+'-'+_0x2be514+'/'+_0x2b6cce)[_0x5ad4('0x1d')](_0x51f8fc);}return null;};}function patchUpdates(_0x44eb08){return function(_0x702915){try{jsonpatch[_0x5ad4('0x24')](_0x702915,_0x44eb08,!![]);}catch(_0x596f6b){return BPromise[_0x5ad4('0x25')](_0x596f6b);}return _0x702915[_0x5ad4('0x26')]();};}function saveUpdates(_0x1e454f,_0x215880){return function(_0x1ee4cc){if(_0x1ee4cc){return _0x1ee4cc[_0x5ad4('0x27')](_0x1e454f)['then'](function(_0x49c6a3){return _0x49c6a3;});}return null;};}function removeEntity(_0x2e7e77,_0x4f140a){return function(_0x28e7ba){if(_0x28e7ba){return _0x28e7ba[_0x5ad4('0x28')]()[_0x5ad4('0x29')](function(){_0x2e7e77['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x281e45,_0x55889c){return function(_0x2d8141){if(!_0x2d8141){_0x281e45['sendStatus'](0x194);}return _0x2d8141;};}function handleError(_0x2cad0c,_0x849bfd){_0x849bfd=_0x849bfd||0x1f4;return function(_0x3ecfda){logger[_0x5ad4('0x2a')](_0x3ecfda[_0x5ad4('0x2b')]);if(_0x3ecfda[_0x5ad4('0x2c')]){delete _0x3ecfda['name'];}_0x2cad0c[_0x5ad4('0x1b')](_0x849bfd)['send'](_0x3ecfda);};}exports[_0x5ad4('0x2d')]=function(_0x8a4c50,_0x3985d0){var _0x4e73e1={},_0x1afb84={},_0x3b0877={'count':0x0,'rows':[]};var _0x4cbc6e=_[_0x5ad4('0x2e')](db[_0x5ad4('0x2f')]['rawAttributes'],function(_0x555c38){return{'name':_0x555c38['fieldName'],'type':_0x555c38['type'][_0x5ad4('0x30')]};});_0x1afb84[_0x5ad4('0x31')]=_[_0x5ad4('0x2e')](_0x4cbc6e,'name');_0x1afb84[_0x5ad4('0x32')]=_[_0x5ad4('0x33')](_0x8a4c50[_0x5ad4('0x32')]);_0x1afb84[_0x5ad4('0x34')]=_[_0x5ad4('0x35')](_0x1afb84[_0x5ad4('0x31')],_0x1afb84['query']);_0x4e73e1['attributes']=_[_0x5ad4('0x35')](_0x1afb84[_0x5ad4('0x31')],qs[_0x5ad4('0x36')](_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x36')]));_0x4e73e1['attributes']=_0x4e73e1[_0x5ad4('0x37')]['length']?_0x4e73e1['attributes']:_0x1afb84[_0x5ad4('0x31')];if(!_0x8a4c50['query'][_0x5ad4('0x38')](_0x5ad4('0x39'))){_0x4e73e1[_0x5ad4('0x1f')]=qs[_0x5ad4('0x1f')](_0x8a4c50['query'][_0x5ad4('0x1f')]);_0x4e73e1[_0x5ad4('0x1e')]=qs[_0x5ad4('0x1e')](_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x1e')]);}_0x4e73e1[_0x5ad4('0x3a')]=qs['sort'](_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x3b')]);_0x4e73e1['where']=qs['filters'](_[_0x5ad4('0x3c')](_0x8a4c50['query'],_0x1afb84['filters']),_0x4cbc6e);if(_0x8a4c50['query']['filter']){_0x4e73e1[_0x5ad4('0x3d')]=_[_0x5ad4('0x3e')](_0x4e73e1[_0x5ad4('0x3d')],{'$or':_[_0x5ad4('0x2e')](_0x4cbc6e,function(_0x7a4acb){if(_0x7a4acb[_0x5ad4('0x3f')]!=='VIRTUAL'){var _0x335642={};_0x335642[_0x7a4acb['name']]={'$like':'%'+_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x40')]+'%'};return _0x335642;}})});}_0x4e73e1=_[_0x5ad4('0x3e')]({},_0x4e73e1,_0x8a4c50[_0x5ad4('0x41')]);var _0x402fe0={'where':_0x4e73e1['where']};return db['VoiceTransferReport'][_0x5ad4('0x21')](_0x402fe0)[_0x5ad4('0x29')](function(_0x516b0d){_0x3b0877[_0x5ad4('0x21')]=_0x516b0d;if(_0x8a4c50[_0x5ad4('0x32')][_0x5ad4('0x42')]){_0x4e73e1[_0x5ad4('0x43')]=[{'all':!![]}];}return db[_0x5ad4('0x2f')][_0x5ad4('0x44')](_0x4e73e1);})[_0x5ad4('0x29')](function(_0x44acfc){_0x3b0877[_0x5ad4('0x45')]=_0x44acfc;return _0x3b0877;})[_0x5ad4('0x29')](respondWithFilteredResult(_0x3985d0,_0x4e73e1))[_0x5ad4('0x46')](handleError(_0x3985d0,null));};exports[_0x5ad4('0x47')]=function(_0x973d6e,_0x62d4cf){var _0x16806e={'raw':!![],'where':{'id':_0x973d6e[_0x5ad4('0x48')]['id']}},_0xbf4355={};_0xbf4355[_0x5ad4('0x31')]=_['keys'](db[_0x5ad4('0x2f')][_0x5ad4('0x49')]);_0xbf4355['query']=_[_0x5ad4('0x33')](_0x973d6e[_0x5ad4('0x32')]);_0xbf4355[_0x5ad4('0x34')]=_['intersection'](_0xbf4355[_0x5ad4('0x31')],_0xbf4355['query']);_0x16806e[_0x5ad4('0x37')]=_[_0x5ad4('0x35')](_0xbf4355['model'],qs[_0x5ad4('0x36')](_0x973d6e[_0x5ad4('0x32')][_0x5ad4('0x36')]));_0x16806e[_0x5ad4('0x37')]=_0x16806e[_0x5ad4('0x37')]['length']?_0x16806e[_0x5ad4('0x37')]:_0xbf4355[_0x5ad4('0x31')];if(_0x973d6e[_0x5ad4('0x32')][_0x5ad4('0x42')]){_0x16806e[_0x5ad4('0x43')]=[{'all':!![]}];}_0x16806e=_[_0x5ad4('0x3e')]({},_0x16806e,_0x973d6e[_0x5ad4('0x41')]);return db[_0x5ad4('0x2f')][_0x5ad4('0x4a')](_0x16806e)['then'](handleEntityNotFound(_0x62d4cf,null))['then'](respondWithResult(_0x62d4cf,null))['catch'](handleError(_0x62d4cf,null));};exports['create']=function(_0x457ab7,_0x125758){return db[_0x5ad4('0x2f')][_0x5ad4('0x4b')](_0x457ab7[_0x5ad4('0x4c')],{})[_0x5ad4('0x29')](respondWithResult(_0x125758,0xc9))['catch'](handleError(_0x125758,null));};exports['update']=function(_0xf9a9ef,_0x3f5a64){if(_0xf9a9ef[_0x5ad4('0x4c')]['id']){delete _0xf9a9ef[_0x5ad4('0x4c')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0xf9a9ef[_0x5ad4('0x48')]['id']}})[_0x5ad4('0x29')](handleEntityNotFound(_0x3f5a64,null))[_0x5ad4('0x29')](saveUpdates(_0xf9a9ef[_0x5ad4('0x4c')],null))[_0x5ad4('0x29')](respondWithResult(_0x3f5a64,null))['catch'](handleError(_0x3f5a64,null));};exports[_0x5ad4('0x28')]=function(_0x2af59f,_0x43a0c9){return db[_0x5ad4('0x2f')][_0x5ad4('0x4a')]({'where':{'id':_0x2af59f[_0x5ad4('0x48')]['id']}})['then'](handleEntityNotFound(_0x43a0c9,null))[_0x5ad4('0x29')](removeEntity(_0x43a0c9,null))['catch'](handleError(_0x43a0c9,null));};exports[_0x5ad4('0x4d')]=function(_0x1227eb,_0x32ba6e){return db['VoiceTransferReport']['describe']()[_0x5ad4('0x29')](respondWithResult(_0x32ba6e,null))[_0x5ad4('0x46')](handleError(_0x32ba6e,null));}; \ No newline at end of file +var _0x23b2=['../../mysqldb','sendStatus','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','status','error','stack','name','index','map','VoiceTransferReport','type','key','query','keys','filters','intersection','attributes','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x1424af,_0x30bb7e){var _0x36e353=function(_0xd3da2f){while(--_0xd3da2f){_0x1424af['push'](_0x1424af['shift']());}};_0x36e353(++_0x30bb7e);}(_0x23b2,0x7b));var _0x223b=function(_0x451000,_0x39e5de){_0x451000=_0x451000-0x0;var _0x26d750=_0x23b2[_0x451000];return _0x26d750;};'use strict';var emlformat=require(_0x223b('0x0'));var rimraf=require(_0x223b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x223b('0x2'));var rp=require(_0x223b('0x3'));var moment=require('moment');var BPromise=require(_0x223b('0x4'));var Mustache=require('mustache');var util=require(_0x223b('0x5'));var path=require(_0x223b('0x6'));var sox=require(_0x223b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x223b('0x8'));var _=require(_0x223b('0x9'));var squel=require(_0x223b('0xa'));var crypto=require(_0x223b('0xb'));var jsforce=require(_0x223b('0xc'));var deskjs=require(_0x223b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x223b('0xe'));var Papa=require(_0x223b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x223b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x223b('0x11'));var logger=require(_0x223b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x223b('0x13'));var licenseUtil=require(_0x223b('0x14'));var db=require(_0x223b('0x15'))['db'];function respondWithStatusCode(_0x19d8d4,_0x5d977c){_0x5d977c=_0x5d977c||0xcc;return function(_0x186e29){if(_0x186e29){return _0x19d8d4[_0x223b('0x16')](_0x5d977c);}return _0x19d8d4['status'](_0x5d977c)[_0x223b('0x17')]();};}function respondWithResult(_0x1c4a8c,_0x109680){_0x109680=_0x109680||0xc8;return function(_0x1bcb63){if(_0x1bcb63){return _0x1c4a8c['status'](_0x109680)['json'](_0x1bcb63);}};}function respondWithFilteredResult(_0x4a1483,_0x6e204b){return function(_0x5e2a8c){if(_0x5e2a8c){var _0x4d7ec5=typeof _0x6e204b[_0x223b('0x18')]==='undefined'&&typeof _0x6e204b[_0x223b('0x19')]===_0x223b('0x1a');var _0x31dadf=_0x5e2a8c[_0x223b('0x1b')];var _0x36ff50=_0x4d7ec5?0x0:_0x6e204b[_0x223b('0x18')];var _0x546ba2=_0x4d7ec5?_0x5e2a8c[_0x223b('0x1b')]:_0x6e204b[_0x223b('0x18')]+_0x6e204b[_0x223b('0x19')];var _0x18f01c;if(_0x546ba2>=_0x31dadf){_0x546ba2=_0x31dadf;_0x18f01c=0xc8;}else{_0x18f01c=0xce;}_0x4a1483['status'](_0x18f01c);return _0x4a1483[_0x223b('0x1c')](_0x223b('0x1d'),_0x36ff50+'-'+_0x546ba2+'/'+_0x31dadf)[_0x223b('0x1e')](_0x5e2a8c);}return null;};}function patchUpdates(_0x2d1822){return function(_0x15e54a){try{jsonpatch[_0x223b('0x1f')](_0x15e54a,_0x2d1822,!![]);}catch(_0x2bda98){return BPromise['reject'](_0x2bda98);}return _0x15e54a[_0x223b('0x20')]();};}function saveUpdates(_0x9d07e7,_0x55b213){return function(_0x38be2f){if(_0x38be2f){return _0x38be2f[_0x223b('0x21')](_0x9d07e7)['then'](function(_0x3b3810){return _0x3b3810;});}return null;};}function removeEntity(_0x23fd54,_0x3fc9dc){return function(_0x5f0263){if(_0x5f0263){return _0x5f0263[_0x223b('0x22')]()[_0x223b('0x23')](function(){_0x23fd54[_0x223b('0x24')](0xcc)[_0x223b('0x17')]();});}};}function handleEntityNotFound(_0x1204b8,_0x45b481){return function(_0x340d4a){if(!_0x340d4a){_0x1204b8[_0x223b('0x16')](0x194);}return _0x340d4a;};}function handleError(_0x4f8744,_0x5563ba){_0x5563ba=_0x5563ba||0x1f4;return function(_0xaed841){logger[_0x223b('0x25')](_0xaed841[_0x223b('0x26')]);if(_0xaed841[_0x223b('0x27')]){delete _0xaed841[_0x223b('0x27')];}_0x4f8744[_0x223b('0x24')](_0x5563ba)['send'](_0xaed841);};}exports[_0x223b('0x28')]=function(_0x4949b2,_0x3e11ae){var _0x594aa9={},_0x31b613={},_0x4789fb={'count':0x0,'rows':[]};var _0x117b7f=_[_0x223b('0x29')](db[_0x223b('0x2a')]['rawAttributes'],function(_0x350627){return{'name':_0x350627['fieldName'],'type':_0x350627[_0x223b('0x2b')][_0x223b('0x2c')]};});_0x31b613['model']=_[_0x223b('0x29')](_0x117b7f,_0x223b('0x27'));_0x31b613[_0x223b('0x2d')]=_[_0x223b('0x2e')](_0x4949b2[_0x223b('0x2d')]);_0x31b613[_0x223b('0x2f')]=_[_0x223b('0x30')](_0x31b613['model'],_0x31b613[_0x223b('0x2d')]);_0x594aa9['attributes']=_[_0x223b('0x30')](_0x31b613['model'],qs['fields'](_0x4949b2[_0x223b('0x2d')]['fields']));_0x594aa9['attributes']=_0x594aa9['attributes']['length']?_0x594aa9[_0x223b('0x31')]:_0x31b613[_0x223b('0x32')];if(!_0x4949b2['query'][_0x223b('0x33')]('nolimit')){_0x594aa9[_0x223b('0x19')]=qs[_0x223b('0x19')](_0x4949b2[_0x223b('0x2d')][_0x223b('0x19')]);_0x594aa9['offset']=qs[_0x223b('0x18')](_0x4949b2[_0x223b('0x2d')][_0x223b('0x18')]);}_0x594aa9['order']=qs['sort'](_0x4949b2['query'][_0x223b('0x34')]);_0x594aa9[_0x223b('0x35')]=qs[_0x223b('0x2f')](_[_0x223b('0x36')](_0x4949b2['query'],_0x31b613['filters']),_0x117b7f);if(_0x4949b2['query'][_0x223b('0x37')]){_0x594aa9[_0x223b('0x35')]=_[_0x223b('0x38')](_0x594aa9['where'],{'$or':_[_0x223b('0x29')](_0x117b7f,function(_0xcb160d){if(_0xcb160d[_0x223b('0x2b')]!==_0x223b('0x39')){var _0xf080ac={};_0xf080ac[_0xcb160d[_0x223b('0x27')]]={'$like':'%'+_0x4949b2[_0x223b('0x2d')][_0x223b('0x37')]+'%'};return _0xf080ac;}})});}_0x594aa9=_[_0x223b('0x38')]({},_0x594aa9,_0x4949b2[_0x223b('0x3a')]);var _0x252654={'where':_0x594aa9[_0x223b('0x35')]};return db[_0x223b('0x2a')]['count'](_0x252654)[_0x223b('0x23')](function(_0x408596){_0x4789fb[_0x223b('0x1b')]=_0x408596;if(_0x4949b2[_0x223b('0x2d')][_0x223b('0x3b')]){_0x594aa9[_0x223b('0x3c')]=[{'all':!![]}];}return db[_0x223b('0x2a')][_0x223b('0x3d')](_0x594aa9);})['then'](function(_0xeffa10){_0x4789fb[_0x223b('0x3e')]=_0xeffa10;return _0x4789fb;})['then'](respondWithFilteredResult(_0x3e11ae,_0x594aa9))[_0x223b('0x3f')](handleError(_0x3e11ae,null));};exports[_0x223b('0x40')]=function(_0x404e0f,_0x3d2f63){var _0x5265bd={'raw':!![],'where':{'id':_0x404e0f[_0x223b('0x41')]['id']}},_0x272963={};_0x272963[_0x223b('0x32')]=_[_0x223b('0x2e')](db[_0x223b('0x2a')]['rawAttributes']);_0x272963['query']=_[_0x223b('0x2e')](_0x404e0f['query']);_0x272963['filters']=_[_0x223b('0x30')](_0x272963[_0x223b('0x32')],_0x272963[_0x223b('0x2d')]);_0x5265bd[_0x223b('0x31')]=_[_0x223b('0x30')](_0x272963[_0x223b('0x32')],qs[_0x223b('0x42')](_0x404e0f['query']['fields']));_0x5265bd[_0x223b('0x31')]=_0x5265bd[_0x223b('0x31')][_0x223b('0x43')]?_0x5265bd[_0x223b('0x31')]:_0x272963['model'];if(_0x404e0f[_0x223b('0x2d')][_0x223b('0x3b')]){_0x5265bd[_0x223b('0x3c')]=[{'all':!![]}];}_0x5265bd=_[_0x223b('0x38')]({},_0x5265bd,_0x404e0f[_0x223b('0x3a')]);return db[_0x223b('0x2a')][_0x223b('0x44')](_0x5265bd)[_0x223b('0x23')](handleEntityNotFound(_0x3d2f63,null))[_0x223b('0x23')](respondWithResult(_0x3d2f63,null))['catch'](handleError(_0x3d2f63,null));};exports[_0x223b('0x45')]=function(_0x3d0545,_0x2d7744){return db[_0x223b('0x2a')]['create'](_0x3d0545[_0x223b('0x46')],{})[_0x223b('0x23')](respondWithResult(_0x2d7744,0xc9))[_0x223b('0x3f')](handleError(_0x2d7744,null));};exports[_0x223b('0x21')]=function(_0x33642f,_0x495b2b){if(_0x33642f['body']['id']){delete _0x33642f[_0x223b('0x46')]['id'];}return db['VoiceTransferReport'][_0x223b('0x44')]({'where':{'id':_0x33642f['params']['id']}})['then'](handleEntityNotFound(_0x495b2b,null))[_0x223b('0x23')](saveUpdates(_0x33642f[_0x223b('0x46')],null))[_0x223b('0x23')](respondWithResult(_0x495b2b,null))['catch'](handleError(_0x495b2b,null));};exports[_0x223b('0x22')]=function(_0x4ec555,_0x1aa6c5){return db[_0x223b('0x2a')]['find']({'where':{'id':_0x4ec555['params']['id']}})[_0x223b('0x23')](handleEntityNotFound(_0x1aa6c5,null))[_0x223b('0x23')](removeEntity(_0x1aa6c5,null))[_0x223b('0x3f')](handleError(_0x1aa6c5,null));};exports[_0x223b('0x47')]=function(_0x461d79,_0x530620){return db[_0x223b('0x2a')][_0x223b('0x47')]()[_0x223b('0x23')](respondWithResult(_0x530620,null))['catch'](handleError(_0x530620,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 644e4cc..299c5bb 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 _0xfdb6=['path','rimraf','exports','define','report_call_transfer','lodash','../../config/logger','bluebird','request-promise'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xfdb6,0x1a3));var _0x6fdb=function(_0x2b7d1a,_0x5639a4){_0x2b7d1a=_0x2b7d1a-0x0;var _0x4efeb3=_0xfdb6[_0x2b7d1a];return _0x4efeb3;};'use strict';var _=require(_0x6fdb('0x0'));var util=require('util');var logger=require(_0x6fdb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6fdb('0x2'));var rp=require(_0x6fdb('0x3'));var fs=require('fs');var path=require(_0x6fdb('0x4'));var rimraf=require(_0x6fdb('0x5'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x6fdb('0x6')]=function(_0x2b1adc,_0x58e5f2){return _0x2b1adc[_0x6fdb('0x7')]('VoiceTransferReport',attributes,{'tableName':_0x6fdb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6d6=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xe6d6,0x7f));var _0x6e6d=function(_0x189029,_0x4acf21){_0x189029=_0x189029-0x0;var _0x234408=_0xe6d6[_0x189029];return _0x234408;};'use strict';var _=require(_0x6e6d('0x0'));var util=require(_0x6e6d('0x1'));var logger=require(_0x6e6d('0x2'))(_0x6e6d('0x3'));var moment=require(_0x6e6d('0x4'));var BPromise=require(_0x6e6d('0x5'));var rp=require(_0x6e6d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e6d('0x7'));var config=require(_0x6e6d('0x8'));var attributes=require(_0x6e6d('0x9'));module[_0x6e6d('0xa')]=function(_0x1135f3,_0x15e5d1){return _0x1135f3[_0x6e6d('0xb')](_0x6e6d('0xc'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 6a5745f..a3561b1 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 _0x1d51=['create','options','raw','then','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport'];(function(_0x318d5b,_0x5bd9b0){var _0x201411=function(_0x510ba7){while(--_0x510ba7){_0x318d5b['push'](_0x318d5b['shift']());}};_0x201411(++_0x5bd9b0);}(_0x1d51,0x1d5));var _0x11d5=function(_0x4ddae0,_0x187bc9){_0x4ddae0=_0x4ddae0-0x0;var _0x417f3e=_0x1d51[_0x4ddae0];return _0x417f3e;};'use strict';var _=require('lodash');var util=require(_0x11d5('0x0'));var moment=require(_0x11d5('0x1'));var BPromise=require(_0x11d5('0x2'));var rs=require(_0x11d5('0x3'));var fs=require('fs');var Redis=require(_0x11d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x11d5('0x5'));var logger=require('../../config/logger')(_0x11d5('0x6'));var config=require(_0x11d5('0x7'));var jayson=require(_0x11d5('0x8'));var client=jayson[_0x11d5('0x9')][_0x11d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64b667,_0x35242a,_0x4ab76f){return new BPromise(function(_0x24238c,_0x569295){return client[_0x11d5('0xb')](_0x64b667,_0x4ab76f)['then'](function(_0x524747){logger[_0x11d5('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x35242a,_0x11d5('0xd'));logger[_0x11d5('0xe')](_0x11d5('0xf'),_0x35242a,_0x11d5('0xd'),JSON[_0x11d5('0x10')](_0x524747));if(_0x524747['error']){if(_0x524747[_0x11d5('0x11')][_0x11d5('0x12')]===0x1f4){logger['error'](_0x11d5('0x13'),_0x35242a,_0x524747[_0x11d5('0x11')]['message']);return _0x569295(_0x524747['error'][_0x11d5('0x14')]);}logger[_0x11d5('0x11')](_0x11d5('0x13'),_0x35242a,_0x524747['error'][_0x11d5('0x14')]);return _0x24238c(_0x524747['error'][_0x11d5('0x14')]);}else{logger['info'](_0x11d5('0x13'),_0x35242a,_0x11d5('0xd'));_0x24238c(_0x524747[_0x11d5('0x15')][_0x11d5('0x14')]);}})[_0x11d5('0x16')](function(_0x116285){logger[_0x11d5('0x11')](_0x11d5('0x13'),_0x35242a,_0x116285);_0x569295(_0x116285);});});}exports['CreateVoiceTransferReport']=function(_0x4db7de){var _0x3eb8b0=this;return new Promise(function(_0x2f0e49,_0x3d927f){return db[_0x11d5('0x17')][_0x11d5('0x18')](_0x4db7de['body'],{'raw':_0x4db7de[_0x11d5('0x19')]?_0x4db7de['options'][_0x11d5('0x1a')]===undefined?!![]:![]:!![]})[_0x11d5('0x1b')](function(_0x3b4622){logger[_0x11d5('0xc')](_0x11d5('0x1c'),_0x4db7de);logger[_0x11d5('0xe')]('CreateVoiceTransferReport',_0x4db7de,JSON['stringify'](_0x3b4622));_0x2f0e49(_0x3b4622);})[_0x11d5('0x16')](function(_0xbc35ef){logger[_0x11d5('0x11')](_0x11d5('0x1c'),_0xbc35ef[_0x11d5('0x14')],_0x4db7de);_0x3d927f(_0x3eb8b0[_0x11d5('0x11')](0x1f4,_0xbc35ef[_0x11d5('0x14')]));});});}; \ No newline at end of file +var _0x8e9e=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','catch','create','body','options','debug','CreateVoiceTransferReport'];(function(_0x32f3b8,_0x1c9fad){var _0x37980d=function(_0x845ecd){while(--_0x845ecd){_0x32f3b8['push'](_0x32f3b8['shift']());}};_0x37980d(++_0x1c9fad);}(_0x8e9e,0xe0));var _0xe8e9=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x8e9e[_0x30faee];return _0x3a90ab;};'use strict';var _=require(_0xe8e9('0x0'));var util=require(_0xe8e9('0x1'));var moment=require(_0xe8e9('0x2'));var BPromise=require(_0xe8e9('0x3'));var rs=require(_0xe8e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8e9('0x5'));var logger=require(_0xe8e9('0x6'))(_0xe8e9('0x7'));var config=require(_0xe8e9('0x8'));var jayson=require(_0xe8e9('0x9'));var client=jayson[_0xe8e9('0xa')][_0xe8e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33226a,_0x44388a,_0x257d42){return new BPromise(function(_0x2fc538,_0x4b11e8){return client[_0xe8e9('0xc')](_0x33226a,_0x257d42)[_0xe8e9('0xd')](function(_0x54b20f){logger[_0xe8e9('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x44388a,'request\x20sent');logger['debug'](_0xe8e9('0xf'),_0x44388a,'request\x20sent',JSON[_0xe8e9('0x10')](_0x54b20f));if(_0x54b20f['error']){if(_0x54b20f[_0xe8e9('0x11')][_0xe8e9('0x12')]===0x1f4){logger[_0xe8e9('0x11')](_0xe8e9('0x13'),_0x44388a,_0x54b20f[_0xe8e9('0x11')][_0xe8e9('0x14')]);return _0x4b11e8(_0x54b20f[_0xe8e9('0x11')][_0xe8e9('0x14')]);}logger[_0xe8e9('0x11')](_0xe8e9('0x13'),_0x44388a,_0x54b20f[_0xe8e9('0x11')][_0xe8e9('0x14')]);return _0x2fc538(_0x54b20f['error'][_0xe8e9('0x14')]);}else{logger['info'](_0xe8e9('0x13'),_0x44388a,_0xe8e9('0x15'));_0x2fc538(_0x54b20f['result']['message']);}})[_0xe8e9('0x16')](function(_0x5a1948){logger[_0xe8e9('0x11')](_0xe8e9('0x13'),_0x44388a,_0x5a1948);_0x4b11e8(_0x5a1948);});});}exports['CreateVoiceTransferReport']=function(_0x47992b){var _0x5bf06a=this;return new Promise(function(_0x3b6938,_0x950775){return db['VoiceTransferReport'][_0xe8e9('0x17')](_0x47992b[_0xe8e9('0x18')],{'raw':_0x47992b['options']?_0x47992b[_0xe8e9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe8e9('0xd')](function(_0x555d0){logger[_0xe8e9('0xe')]('CreateVoiceTransferReport',_0x47992b);logger[_0xe8e9('0x1a')](_0xe8e9('0x1b'),_0x47992b,JSON[_0xe8e9('0x10')](_0x555d0));_0x3b6938(_0x555d0);})[_0xe8e9('0x16')](function(_0x22c670){logger[_0xe8e9('0x11')](_0xe8e9('0x1b'),_0x22c670[_0xe8e9('0x14')],_0x47992b);_0x950775(_0x5bf06a['error'](0x1f4,_0x22c670['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c6ad5a6..9b4593f 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 _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x52b252,_0x106c11){var _0x330636=function(_0x10c768){while(--_0x10c768){_0x52b252['push'](_0x52b252['shift']());}};_0x330636(++_0x106c11);}(_0xf109,0xce));var _0x9f10=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xf109[_0x1a9204];return _0x17ca68;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x182082,_0x10bedf){var _0x68dc39=function(_0x2588dc){while(--_0x2588dc){_0x182082['push'](_0x182082['shift']());}};_0x68dc39(++_0x10bedf);}(_0xf4eb,0xec));var _0xbf4e=function(_0x375930,_0x3a4b16){_0x375930=_0x375930-0x0;var _0x611666=_0xf4eb[_0x375930];return _0x611666;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index df8462e..09c2ac7 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 _0x55ea=['NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','format','user:%s','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer\x20fired:','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','webbarapi','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x55ea,0xc9));var _0xa55e=function(_0x40998b,_0x27483e){_0x40998b=_0x40998b-0x0;var _0x319dfd=_0x55ea[_0x40998b];return _0x319dfd;};'use strict';var path=require(_0xa55e('0x0'));var fs=require('fs');var _=require(_0xa55e('0x1'));var db=require(_0xa55e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var jayson=require(_0xa55e('0x5'));var amiClient=jayson[_0xa55e('0x6')][_0xa55e('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xa55e('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config['redis'],{'host':_0xa55e('0x9'),'port':0x18eb});var io=require(_0xa55e('0xa'))(new Redis(config[_0xa55e('0xb')]));var Schema=require(_0xa55e('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'callNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x10')]},'callerId':{'type':_0xa55e('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':'string','required':[!![],_0xa55e('0x11')]},'transferNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]}});function emit(_0x12895e,_0x303698,_0x339f1e){logger['info'](_0x12895e,_0x303698,JSON[_0xa55e('0x13')](_0x339f1e));io['to'](_0x12895e)['emit'](_0x303698,_0x339f1e);}function handleError(_0x517142){return function(_0x4599b9){console[_0xa55e('0x14')](_0xa55e('0x15'),_0x4599b9,_0x4599b9 instanceof RangeError);logger[_0xa55e('0x16')](_0x4599b9[_0xa55e('0x17')]);if(_0x4599b9 instanceof RangeError){if(_0x4599b9['name']){delete _0x4599b9[_0xa55e('0x18')];}_0x517142['status'](0x194)['send'](_0x4599b9);}else{if(_0x4599b9[_0xa55e('0x18')]){delete _0x4599b9[_0xa55e('0x18')];}_0x517142[_0xa55e('0x19')](0x1f4)[_0xa55e('0x1a')](_0x4599b9);}};}function checkError(){return function(_0x51304d){if(!_0x51304d){throw new RangeError(_0xa55e('0x1b'));}return _0x51304d;};}function respondWithRpcPromise(_0x475dde,_0x267adb){return new BPromise(function(_0x9594a3,_0x5b0e74){var _0x53a2f9=amiClient;return _0x53a2f9[_0xa55e('0x1c')](_0x475dde,_0x267adb)['then'](function(_0xaaf2f1){if(_0xaaf2f1[_0xa55e('0x16')]){if(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1d')]===0x1f4){return _0x5b0e74(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}return _0x9594a3(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}else{_0x9594a3(_0xaaf2f1[_0xa55e('0x1f')]);}})[_0xa55e('0x20')](function(_0x3c519d){_0x5b0e74(_0x3c519d);});});}function getAgent(_0x137aca){return db[_0xa55e('0x21')][_0xa55e('0x22')]({'where':{'id':_0x137aca,'role':_0xa55e('0x23')}})[_0xa55e('0x24')](checkError());}function getAgentCheckSession(_0x2f2579,_0xa1917c){return new BPromise(function(_0x875010,_0x4eebcc){var _0x5c218d=respondWithRpcPromise(_0xa55e('0x25'));var _0x4ebcbd=getAgent(_0x2f2579);Promise[_0xa55e('0x26')]([_0x5c218d,_0x4ebcbd])['then'](function(_0x2fe4e9){var _0x4d9634=_0x2fe4e9[0x0];var _0x2758ca=_0x2fe4e9[0x1];var _0x532b13=_[_0xa55e('0x27')](_0x4d9634[_0xa55e('0x28')],function(_0x4a03ef){return _0x4a03ef[_0xa55e('0x29')]==_0x2758ca['id']&&_0x4a03ef[_0xa55e('0x2a')]==_0xa1917c;});if(_0x532b13[_0xa55e('0x2b')]==0x1){_0x875010(_0x2758ca);}else{_0x4eebcc(new RangeError(_0xa55e('0x2c')+_0xa1917c+'\x20not\x20found!'));}});});}exports[_0xa55e('0x2d')]=function(_0x25ecb3,_0x5b79d6){logger[_0xa55e('0x2e')](_0xa55e('0x2f'),_0x25ecb3[_0xa55e('0x30')]);var _0xcaeba6=originateValidation['validate'](_0x25ecb3[_0xa55e('0x30')]);if(_0xcaeba6['length']>0x0){return _0x5b79d6[_0xa55e('0x19')](0x190)['json'](_0xcaeba6);}var _0x339406=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x31')];var _0x1e53f0=_0x25ecb3['body'][_0xa55e('0x32')];var _0x5aec2c=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x33')];var _0x7999ac=_0x25ecb3['body'][_0xa55e('0x34')];return getAgent(_0x339406)[_0xa55e('0x24')](function(_0x602aa0){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x602aa0[_0xa55e('0x18')]);emit(util['format']('user:%s',_0x602aa0[_0xa55e('0x18')]),_0xa55e('0x36'),{'callNumber':_0x1e53f0,'callerId':_0x5aec2c,'callbackUrl':_0x7999ac});return _0x5b79d6[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x38')});})[_0xa55e('0x20')](handleError(_0x5b79d6));};exports[_0xa55e('0x39')]=function(_0x596a5d,_0x5cd5b3){logger[_0xa55e('0x2e')](_0xa55e('0x3a'),_0x596a5d[_0xa55e('0x30')]);var _0x351dbf=hangupValidation[_0xa55e('0xc')](_0x596a5d[_0xa55e('0x30')]);if(_0x351dbf[_0xa55e('0x2b')]>0x0){return _0x5cd5b3[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x351dbf);}var _0x113ab5=_0x596a5d[_0xa55e('0x30')]['userId'];var _0x1da8a9=_0x596a5d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x113ab5)['then'](function(_0x1e806a){logger['info'](_0xa55e('0x35'),_0x1e806a[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x1e806a[_0xa55e('0x18')]),_0xa55e('0x3d'),{'sessionId':_0x1da8a9});return _0x5cd5b3[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa55e('0x20')](handleError(_0x5cd5b3));};exports[_0xa55e('0x3e')]=function(_0x27e756,_0x518e06){logger[_0xa55e('0x2e')](_0xa55e('0x3f'),_0x27e756[_0xa55e('0x30')]);var _0xb43d62=answerValidation[_0xa55e('0xc')](_0x27e756[_0xa55e('0x30')]);if(_0xb43d62[_0xa55e('0x2b')]>0x0){return _0x518e06[_0xa55e('0x19')](0x190)['json'](_0xb43d62);}var _0x4bd20d=_0x27e756[_0xa55e('0x30')][_0xa55e('0x31')];var _0x186dc2=_0x27e756[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x4bd20d)[_0xa55e('0x24')](function(_0x52c3b5){logger[_0xa55e('0x2e')]('entityFound:',_0x52c3b5['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x52c3b5[_0xa55e('0x18')]),'webbar:answer',{'sessionId':_0x186dc2});return _0x518e06['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x40')});})['catch'](handleError(_0x518e06));};exports['hold']=function(_0x3ae40d,_0x1dda95){logger[_0xa55e('0x2e')](_0xa55e('0x41'),_0x3ae40d[_0xa55e('0x30')]);var _0x1031c9=holdValidation['validate'](_0x3ae40d['body']);if(_0x1031c9[_0xa55e('0x2b')]>0x0){return _0x1dda95[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1031c9);}var _0x259cb3=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5b8776=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x259cb3)[_0xa55e('0x24')](function(_0x1de3a8){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x1de3a8['name']);emit(util['format'](_0xa55e('0x3c'),_0x1de3a8['name']),_0xa55e('0x42'),{'sessionId':_0x5b8776});return _0x1dda95['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x43')});})[_0xa55e('0x20')](handleError(_0x1dda95));};exports[_0xa55e('0x44')]=function(_0x2c35a8,_0x63aa32){logger[_0xa55e('0x2e')](_0xa55e('0x45'),_0x2c35a8['body']);var _0x12c9e1=unholdValidation[_0xa55e('0xc')](_0x2c35a8[_0xa55e('0x30')]);if(_0x12c9e1[_0xa55e('0x2b')]>0x0){return _0x63aa32[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x12c9e1);}var _0x50bc5b=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x31')];var _0x42c00c=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x50bc5b)[_0xa55e('0x24')](function(_0x5e0e05){logger[_0xa55e('0x2e')]('entityFound:',_0x5e0e05[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x5e0e05[_0xa55e('0x18')]),_0xa55e('0x46'),{'sessionId':_0x42c00c});return _0x63aa32[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':_0xa55e('0x47')});})['catch'](handleError(_0x63aa32));};exports[_0xa55e('0x48')]=function(_0x5be88c,_0x4f7b59){logger[_0xa55e('0x2e')](_0xa55e('0x49'),_0x4f7b59[_0xa55e('0x30')]);var _0x1f03a8=callsValidation[_0xa55e('0xc')](_0x5be88c[_0xa55e('0x30')]);if(_0x1f03a8[_0xa55e('0x2b')]>0x0){return _0x4f7b59['status'](0x190)[_0xa55e('0x37')](_0x1f03a8);}var _0x33d1e4=_0x5be88c[_0xa55e('0x30')]['userId'];var _0x467ea7=respondWithRpcPromise(_0xa55e('0x25'));var _0x2aeae3=getAgent(_0x33d1e4);return Promise['all']([_0x467ea7,_0x2aeae3])[_0xa55e('0x24')](function(_0x12c5a0){var _0x28fd5a=_0x12c5a0[0x0];var _0x2a6a1f=_0x12c5a0[0x1];var _0x6f0032=_[_0xa55e('0x27')](_0x28fd5a[_0xa55e('0x28')],function(_0x2f8b5f){return _0x2f8b5f[_0xa55e('0x29')]==_0x2a6a1f['id'];});return _0x4f7b59[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'count':_0x6f0032['length'],'rows':_0x6f0032});})[_0xa55e('0x20')](handleError(_0x4f7b59));};exports['conference']=function(_0x373874,_0x1ea145){logger[_0xa55e('0x2e')](_0xa55e('0x4a'),_0x373874[_0xa55e('0x30')]);var _0x1bef1b=conferenceValidation[_0xa55e('0xc')](_0x373874[_0xa55e('0x30')]);if(_0x1bef1b[_0xa55e('0x2b')]>0x0){return _0x1ea145[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1bef1b);}var _0x424b87=_0x373874[_0xa55e('0x30')][_0xa55e('0x31')];return getAgent(_0x424b87)[_0xa55e('0x24')](function(_0x448641){logger['info']('entityFound:',_0x448641[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x448641[_0xa55e('0x18')]),'webbar:conference');return _0x1ea145['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1ea145));};exports['transfer']=function(_0x16f585,_0x37cd3a){logger[_0xa55e('0x2e')](_0xa55e('0x4b'),_0x16f585[_0xa55e('0x30')]);var _0x909ec4=transferValidation[_0xa55e('0xc')](_0x16f585[_0xa55e('0x30')]);if(_0x909ec4[_0xa55e('0x2b')]>0x0){return _0x37cd3a[_0xa55e('0x19')](0x190)['json'](_0x909ec4);}var _0x100633=_0x16f585[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5d9388=_0x16f585[_0xa55e('0x30')][_0xa55e('0x2a')];var _0x3dab7b=_0x16f585[_0xa55e('0x30')]['transferNumber'];return getAgent(_0x100633)[_0xa55e('0x24')](function(_0x14fcad){logger[_0xa55e('0x2e')]('entityFound:',_0x14fcad['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x14fcad[_0xa55e('0x18')]),'webbar:transfer',{'sessionId':_0x5d9388,'transferNumber':_0x3dab7b});return _0x37cd3a[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':'transfer\x20executed!'});})[_0xa55e('0x20')](handleError(_0x37cd3a));}; \ No newline at end of file +var _0x4c6d=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','send','status','request','then','error','code','message','result','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer\x20fired:','webbar:answer','hold','hold\x20fired:'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0xa76c3f,_0x2206d0){_0xa76c3f=_0xa76c3f-0x0;var _0x46d40c=_0x4c6d[_0xa76c3f];return _0x46d40c;};'use strict';var path=require(_0xd4c6('0x0'));var fs=require('fs');var _=require(_0xd4c6('0x1'));var db=require(_0xd4c6('0x2'))['db'];var config=require(_0xd4c6('0x3'));var util=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var jayson=require(_0xd4c6('0x5'));var amiClient=jayson[_0xd4c6('0x6')][_0xd4c6('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xd4c6('0x8'));var Redis=require(_0xd4c6('0x9'));config['redis']=_[_0xd4c6('0xa')](config[_0xd4c6('0xb')],{'host':_0xd4c6('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4c6('0xb')]));var Schema=require(_0xd4c6('0xd'));var originateValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xd4c6('0xf'),'required':[!![],_0xd4c6('0x10')]},'callerId':{'type':_0xd4c6('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd4c6('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd4c6('0xf'),'required':[!![],_0xd4c6('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd4c6('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]}});function emit(_0x25204d,_0x3cb95c,_0x3da1f4){logger[_0xd4c6('0x13')](_0x25204d,_0x3cb95c,JSON['stringify'](_0x3da1f4));io['to'](_0x25204d)[_0xd4c6('0x14')](_0x3cb95c,_0x3da1f4);}function handleError(_0x44126c){return function(_0x23a16f){console[_0xd4c6('0x15')](_0xd4c6('0x16'),_0x23a16f,_0x23a16f instanceof RangeError);logger['error'](_0x23a16f[_0xd4c6('0x17')]);if(_0x23a16f instanceof RangeError){if(_0x23a16f[_0xd4c6('0x18')]){delete _0x23a16f[_0xd4c6('0x18')];}_0x44126c['status'](0x194)[_0xd4c6('0x19')](_0x23a16f);}else{if(_0x23a16f[_0xd4c6('0x18')]){delete _0x23a16f[_0xd4c6('0x18')];}_0x44126c[_0xd4c6('0x1a')](0x1f4)['send'](_0x23a16f);}};}function checkError(){return function(_0x1c8427){if(!_0x1c8427){throw new RangeError('NotFound');}return _0x1c8427;};}function respondWithRpcPromise(_0x37f552,_0x150e28){return new BPromise(function(_0x2750c9,_0x222813){var _0xf536e0=amiClient;return _0xf536e0[_0xd4c6('0x1b')](_0x37f552,_0x150e28)[_0xd4c6('0x1c')](function(_0x3f99e8){if(_0x3f99e8[_0xd4c6('0x1d')]){if(_0x3f99e8[_0xd4c6('0x1d')][_0xd4c6('0x1e')]===0x1f4){return _0x222813(_0x3f99e8[_0xd4c6('0x1d')]['message']);}return _0x2750c9(_0x3f99e8['error'][_0xd4c6('0x1f')]);}else{_0x2750c9(_0x3f99e8[_0xd4c6('0x20')]);}})['catch'](function(_0x1dee19){_0x222813(_0x1dee19);});});}function getAgent(_0x3a2c50){return db[_0xd4c6('0x21')]['findOne']({'where':{'id':_0x3a2c50,'role':_0xd4c6('0x22')}})[_0xd4c6('0x1c')](checkError());}function getAgentCheckSession(_0x5614f3,_0x406ed0){return new BPromise(function(_0x8ce066,_0x25ea15){var _0x488e7e=respondWithRpcPromise(_0xd4c6('0x23'));var _0x3b656d=getAgent(_0x5614f3);Promise[_0xd4c6('0x24')]([_0x488e7e,_0x3b656d])[_0xd4c6('0x1c')](function(_0x2e8c34){var _0x160330=_0x2e8c34[0x0];var _0x41a8d2=_0x2e8c34[0x1];var _0x1f32d8=_[_0xd4c6('0x25')](_0x160330[_0xd4c6('0x26')],function(_0x441119){return _0x441119[_0xd4c6('0x27')]==_0x41a8d2['id']&&_0x441119[_0xd4c6('0x28')]==_0x406ed0;});if(_0x1f32d8[_0xd4c6('0x29')]==0x1){_0x8ce066(_0x41a8d2);}else{_0x25ea15(new RangeError('sessionId\x20'+_0x406ed0+_0xd4c6('0x2a')));}});});}exports[_0xd4c6('0x2b')]=function(_0x32deb7,_0x38d423){logger['info']('originate\x20fired:',_0x32deb7['body']);var _0x103ac3=originateValidation[_0xd4c6('0xd')](_0x32deb7[_0xd4c6('0x2c')]);if(_0x103ac3[_0xd4c6('0x29')]>0x0){return _0x38d423[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x103ac3);}var _0x1615ff=_0x32deb7['body'][_0xd4c6('0x2e')];var _0x3ae596=_0x32deb7[_0xd4c6('0x2c')]['callNumber'];var _0x24a716=_0x32deb7[_0xd4c6('0x2c')][_0xd4c6('0x2f')];var _0x4c69af=_0x32deb7[_0xd4c6('0x2c')][_0xd4c6('0x30')];return getAgent(_0x1615ff)[_0xd4c6('0x1c')](function(_0xe5aa2d){logger['info'](_0xd4c6('0x31'),_0xe5aa2d[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')](_0xd4c6('0x33'),_0xe5aa2d[_0xd4c6('0x18')]),'webbar:originate',{'callNumber':_0x3ae596,'callerId':_0x24a716,'callbackUrl':_0x4c69af});return _0x38d423[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x34')});})[_0xd4c6('0x35')](handleError(_0x38d423));};exports[_0xd4c6('0x36')]=function(_0x2cdb9d,_0x554666){logger[_0xd4c6('0x13')](_0xd4c6('0x37'),_0x2cdb9d[_0xd4c6('0x2c')]);var _0x5f4060=hangupValidation[_0xd4c6('0xd')](_0x2cdb9d[_0xd4c6('0x2c')]);if(_0x5f4060[_0xd4c6('0x29')]>0x0){return _0x554666[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5f4060);}var _0x20a4e8=_0x2cdb9d[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x2e1768=_0x2cdb9d['body'][_0xd4c6('0x28')];return getAgent(_0x20a4e8)['then'](function(_0x55063c){logger[_0xd4c6('0x13')](_0xd4c6('0x31'),_0x55063c[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')](_0xd4c6('0x33'),_0x55063c['name']),'webbar:hangup',{'sessionId':_0x2e1768});return _0x554666[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x38')});})[_0xd4c6('0x35')](handleError(_0x554666));};exports['answer']=function(_0x211d47,_0x494811){logger[_0xd4c6('0x13')](_0xd4c6('0x39'),_0x211d47[_0xd4c6('0x2c')]);var _0x51585c=answerValidation[_0xd4c6('0xd')](_0x211d47[_0xd4c6('0x2c')]);if(_0x51585c[_0xd4c6('0x29')]>0x0){return _0x494811[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x51585c);}var _0x3ef1b0=_0x211d47[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x343d94=_0x211d47['body'][_0xd4c6('0x28')];return getAgent(_0x3ef1b0)[_0xd4c6('0x1c')](function(_0xefcd5){logger['info'](_0xd4c6('0x31'),_0xefcd5[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')]('user:%s',_0xefcd5['name']),_0xd4c6('0x3a'),{'sessionId':_0x343d94});return _0x494811[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0xd4c6('0x35')](handleError(_0x494811));};exports[_0xd4c6('0x3b')]=function(_0x1a53e9,_0x258a95){logger[_0xd4c6('0x13')](_0xd4c6('0x3c'),_0x1a53e9['body']);var _0x22298a=holdValidation[_0xd4c6('0xd')](_0x1a53e9[_0xd4c6('0x2c')]);if(_0x22298a[_0xd4c6('0x29')]>0x0){return _0x258a95[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x22298a);}var _0x34fb42=_0x1a53e9[_0xd4c6('0x2c')]['userId'];var _0x4f26fc=_0x1a53e9[_0xd4c6('0x2c')][_0xd4c6('0x28')];return getAgent(_0x34fb42)[_0xd4c6('0x1c')](function(_0x5bb875){logger[_0xd4c6('0x13')](_0xd4c6('0x31'),_0x5bb875[_0xd4c6('0x18')]);emit(util['format'](_0xd4c6('0x33'),_0x5bb875[_0xd4c6('0x18')]),_0xd4c6('0x3d'),{'sessionId':_0x4f26fc});return _0x258a95[_0xd4c6('0x1a')](0xc8)['json']({'error':![],'message':_0xd4c6('0x3e')});})[_0xd4c6('0x35')](handleError(_0x258a95));};exports[_0xd4c6('0x3f')]=function(_0x14279d,_0x291837){logger[_0xd4c6('0x13')](_0xd4c6('0x40'),_0x14279d['body']);var _0x304f96=unholdValidation[_0xd4c6('0xd')](_0x14279d[_0xd4c6('0x2c')]);if(_0x304f96['length']>0x0){return _0x291837[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x304f96);}var _0x46bf10=_0x14279d[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x3e6df8=_0x14279d[_0xd4c6('0x2c')]['sessionId'];return getAgent(_0x46bf10)[_0xd4c6('0x1c')](function(_0x4a3092){logger['info'](_0xd4c6('0x31'),_0x4a3092['name']);emit(util[_0xd4c6('0x32')]('user:%s',_0x4a3092[_0xd4c6('0x18')]),'webbar:unhold',{'sessionId':_0x3e6df8});return _0x291837['status'](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x41')});})[_0xd4c6('0x35')](handleError(_0x291837));};exports[_0xd4c6('0x42')]=function(_0x5639b6,_0x241e6c){logger[_0xd4c6('0x13')](_0xd4c6('0x43'),_0x241e6c[_0xd4c6('0x2c')]);var _0x5e52db=callsValidation[_0xd4c6('0xd')](_0x5639b6[_0xd4c6('0x2c')]);if(_0x5e52db[_0xd4c6('0x29')]>0x0){return _0x241e6c[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5e52db);}var _0x1525a4=_0x5639b6[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x106710=respondWithRpcPromise(_0xd4c6('0x23'));var _0xe07a2d=getAgent(_0x1525a4);return Promise['all']([_0x106710,_0xe07a2d])['then'](function(_0x2dab4a){var _0x11c37d=_0x2dab4a[0x0];var _0x558ce2=_0x2dab4a[0x1];var _0x5179af=_['filter'](_0x11c37d[_0xd4c6('0x26')],function(_0x218250){return _0x218250['UserId']==_0x558ce2['id'];});return _0x241e6c['status'](0xc8)[_0xd4c6('0x2d')]({'count':_0x5179af[_0xd4c6('0x29')],'rows':_0x5179af});})[_0xd4c6('0x35')](handleError(_0x241e6c));};exports[_0xd4c6('0x44')]=function(_0x226549,_0x516e12){logger[_0xd4c6('0x13')](_0xd4c6('0x45'),_0x226549[_0xd4c6('0x2c')]);var _0x26cff1=conferenceValidation[_0xd4c6('0xd')](_0x226549[_0xd4c6('0x2c')]);if(_0x26cff1[_0xd4c6('0x29')]>0x0){return _0x516e12[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x26cff1);}var _0x20b5b9=_0x226549[_0xd4c6('0x2c')][_0xd4c6('0x2e')];return getAgent(_0x20b5b9)[_0xd4c6('0x1c')](function(_0x5a0400){logger['info'](_0xd4c6('0x31'),_0x5a0400['name']);emit(util['format']('user:%s',_0x5a0400[_0xd4c6('0x18')]),_0xd4c6('0x46'));return _0x516e12[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0xd4c6('0x35')](handleError(_0x516e12));};exports[_0xd4c6('0x47')]=function(_0x53dcea,_0x705041){logger[_0xd4c6('0x13')](_0xd4c6('0x48'),_0x53dcea[_0xd4c6('0x2c')]);var _0x5cf823=transferValidation[_0xd4c6('0xd')](_0x53dcea[_0xd4c6('0x2c')]);if(_0x5cf823['length']>0x0){return _0x705041[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5cf823);}var _0x5ae295=_0x53dcea[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x4cdf5f=_0x53dcea[_0xd4c6('0x2c')]['sessionId'];var _0x7aef4=_0x53dcea[_0xd4c6('0x2c')][_0xd4c6('0x49')];return getAgent(_0x5ae295)[_0xd4c6('0x1c')](function(_0x2a8448){logger[_0xd4c6('0x13')]('entityFound:',_0x2a8448[_0xd4c6('0x18')]);emit(util['format'](_0xd4c6('0x33'),_0x2a8448[_0xd4c6('0x18')]),'webbar:transfer',{'sessionId':_0x4cdf5f,'transferNumber':_0x7aef4});return _0x705041[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x4a')});})['catch'](handleError(_0x705041));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 71dc1a1..384e064 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 _0x10dd=['get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','put','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x10dd,0x87));var _0xd10d=function(_0x58cf56,_0x272465){_0x58cf56=_0x58cf56-0x0;var _0x2ef7a8=_0x10dd[_0x58cf56];return _0x2ef7a8;};'use strict';var multer=require('multer');var util=require(_0xd10d('0x0'));var path=require(_0xd10d('0x1'));var timeout=require(_0xd10d('0x2'));var express=require(_0xd10d('0x3'));var router=express[_0xd10d('0x4')]();var fs_extra=require(_0xd10d('0x5'));var auth=require(_0xd10d('0x6'));var interaction=require(_0xd10d('0x7'));var config=require('../../config/environment');var controller=require(_0xd10d('0x8'));router[_0xd10d('0x9')]('/',auth[_0xd10d('0xa')](),controller['index']);router['get'](_0xd10d('0xb'),auth['isAuthenticated'](),controller[_0xd10d('0xc')]);router[_0xd10d('0x9')](_0xd10d('0xd'),auth[_0xd10d('0xa')](),controller[_0xd10d('0xe')]);router[_0xd10d('0x9')]('/:id/dispositions',auth[_0xd10d('0xa')](),controller[_0xd10d('0xf')]);router['get'](_0xd10d('0x10'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x11')]);router[_0xd10d('0x9')](_0xd10d('0x12'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x13')]);router['get'](_0xd10d('0x14'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x15')]);router[_0xd10d('0x16')]('/',auth[_0xd10d('0xa')](),controller[_0xd10d('0x17')]);router['post'](_0xd10d('0x18'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x19')]);router[_0xd10d('0x16')]('/:id/canned_answers',auth[_0xd10d('0xa')](),controller['addAnswer']);router['post'](_0xd10d('0x12'),auth['isAuthenticated'](),controller[_0xd10d('0x1a')]);router[_0xd10d('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0xd10d('0x1b')]);router['post'](_0xd10d('0x1c'),controller[_0xd10d('0x1d')]);router[_0xd10d('0x16')](_0xd10d('0x1e'),auth[_0xd10d('0xa')](),controller['send']);router[_0xd10d('0x1f')]('/:id',auth[_0xd10d('0xa')](),controller['update']);router[_0xd10d('0x20')]('/:id',auth[_0xd10d('0xa')](),controller['destroy']);router[_0xd10d('0x20')](_0xd10d('0x18'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x21')]);router[_0xd10d('0x20')](_0xd10d('0x10'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x22')]);router[_0xd10d('0x20')](_0xd10d('0x12'),auth[_0xd10d('0xa')](),controller[_0xd10d('0x23')]);module['exports']=router; \ No newline at end of file +var _0xf57a=['/:id/notify','notify','/:id/send','send','put','/:id','delete','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/users','addAgents','addApplications'];(function(_0x4d54ec,_0x38c4d5){var _0x12d301=function(_0x34dc59){while(--_0x34dc59){_0x4d54ec['push'](_0x4d54ec['shift']());}};_0x12d301(++_0x38c4d5);}(_0xf57a,0x1f4));var _0xaf57=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xf57a[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xaf57('0x0'));var util=require(_0xaf57('0x1'));var path=require(_0xaf57('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf57('0x3'));var router=express[_0xaf57('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaf57('0x5'));var config=require(_0xaf57('0x6'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xaf57('0x7')](),controller[_0xaf57('0x8')]);router[_0xaf57('0x9')](_0xaf57('0xa'),auth[_0xaf57('0x7')](),controller[_0xaf57('0xb')]);router['get']('/:id',auth[_0xaf57('0x7')](),controller['show']);router['get']('/:id/dispositions',auth[_0xaf57('0x7')](),controller[_0xaf57('0xc')]);router['get'](_0xaf57('0xd'),auth[_0xaf57('0x7')](),controller['getAnswers']);router[_0xaf57('0x9')]('/:id/users',auth[_0xaf57('0x7')](),controller[_0xaf57('0xe')]);router['get'](_0xaf57('0xf'),auth['isAuthenticated'](),controller[_0xaf57('0x10')]);router[_0xaf57('0x11')]('/',auth[_0xaf57('0x7')](),controller[_0xaf57('0x12')]);router[_0xaf57('0x11')](_0xaf57('0x13'),auth['isAuthenticated'](),controller[_0xaf57('0x14')]);router[_0xaf57('0x11')]('/:id/canned_answers',auth[_0xaf57('0x7')](),controller[_0xaf57('0x15')]);router[_0xaf57('0x11')](_0xaf57('0x16'),auth['isAuthenticated'](),controller[_0xaf57('0x17')]);router[_0xaf57('0x11')](_0xaf57('0xf'),auth[_0xaf57('0x7')](),controller[_0xaf57('0x18')]);router[_0xaf57('0x11')](_0xaf57('0x19'),controller[_0xaf57('0x1a')]);router[_0xaf57('0x11')](_0xaf57('0x1b'),auth['isAuthenticated'](),controller[_0xaf57('0x1c')]);router[_0xaf57('0x1d')](_0xaf57('0x1e'),auth['isAuthenticated'](),controller['update']);router[_0xaf57('0x1f')](_0xaf57('0x1e'),auth['isAuthenticated'](),controller['destroy']);router[_0xaf57('0x1f')]('/:id/dispositions',auth[_0xaf57('0x7')](),controller[_0xaf57('0x20')]);router[_0xaf57('0x1f')](_0xaf57('0xd'),auth[_0xaf57('0x7')](),controller[_0xaf57('0x21')]);router[_0xaf57('0x1f')](_0xaf57('0x16'),auth[_0xaf57('0x7')](),controller['removeAgents']);module[_0xaf57('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 815ca42..2034d93 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 _0x692a=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x48d952,_0x4d41e9){var _0x4d358f=function(_0x246e7d){while(--_0x246e7d){_0x48d952['push'](_0x48d952['shift']());}};_0x4d358f(++_0x4d41e9);}(_0x692a,0x171));var _0xa692=function(_0x31ddba,_0x126ba9){_0x31ddba=_0x31ddba-0x0;var _0x2cce1e=_0x692a[_0x31ddba];return _0x2cce1e;};'use strict';var Sequelize=require(_0xa692('0x0'));var rs=require(_0xa692('0x1'));module['exports']={'name':{'type':Sequelize[_0xa692('0x2')],'unique':_0xa692('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa692('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa692('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xa692('0x2')]},'type':{'type':Sequelize[_0xa692('0x4')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xa692('0x2')]},'baseUrl':{'type':Sequelize[_0xa692('0x2')]},'authToken':{'type':Sequelize[_0xa692('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa692('0x5')],'defaultValue':function(){return _0xa692('0x6');}},'notificationSound':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa692('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa692('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa692('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x41dbf6){if(!_0x41dbf6){this[_0xa692('0xa')](_0xa692('0xb'),null);}this[_0xa692('0xa')](_0xa692('0xc'),_0x41dbf6);}},'description':{'type':Sequelize[_0xa692('0x2')]}}; \ No newline at end of file +var _0xbb5a=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbb5a,0x1b4));var _0xabb5=function(_0x336e38,_0x4a5ac0){_0x336e38=_0x336e38-0x0;var _0x13355f=_0xbb5a[_0x336e38];return _0x13355f;};'use strict';var Sequelize=require(_0xabb5('0x0'));var rs=require(_0xabb5('0x1'));module[_0xabb5('0x2')]={'name':{'type':Sequelize[_0xabb5('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xabb5('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xabb5('0x4')]();}},'phone':{'type':Sequelize[_0xabb5('0x3')]},'type':{'type':Sequelize[_0xabb5('0x5')](_0xabb5('0x6'),_0xabb5('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xabb5('0x3')]},'authToken':{'type':Sequelize[_0xabb5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xabb5('0x8')],'defaultValue':function(){return _0xabb5('0x9');}},'notificationSound':{'type':Sequelize[_0xabb5('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xabb5('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xabb5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xabb5('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xabb5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabb5('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabb5('0xb')],'comment':_0xabb5('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xabb5('0xd'),'set':function(_0x288438){if(!_0x288438){this[_0xabb5('0xe')](_0xabb5('0xf'),null);}this['setDataValue'](_0xabb5('0x10'),_0x288438);}},'description':{'type':Sequelize[_0xabb5('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index f5444ed..634f37a 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 _0xa405=['asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','pick','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','nolimit','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','send','getApplications','notify','Applications','account','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','priority'];(function(_0x411aa9,_0x42da07){var _0xdb7063=function(_0x1fe6d1){while(--_0x1fe6d1){_0x411aa9['push'](_0x411aa9['shift']());}};_0xdb7063(++_0x42da07);}(_0xa405,0x1ca));var _0x5a40=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa405[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a40('0x0'));var zipdir=require(_0x5a40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a40('0x2'));var moment=require(_0x5a40('0x3'));var BPromise=require(_0x5a40('0x4'));var Mustache=require(_0x5a40('0x5'));var util=require(_0x5a40('0x6'));var path=require('path');var sox=require(_0x5a40('0x7'));var csv=require(_0x5a40('0x8'));var ejs=require(_0x5a40('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a40('0xa'));var deskjs=require(_0x5a40('0xb'));var toCsv=require(_0x5a40('0x8'));var querystring=require(_0x5a40('0xc'));var Papa=require(_0x5a40('0xd'));var Redis=require(_0x5a40('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a40('0xf'));var logger=require('../../config/logger')(_0x5a40('0x10'));var utils=require('../../config/utils');var config=require(_0x5a40('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a40('0x12'))['db'];config[_0x5a40('0x13')]=_['defaults'](config[_0x5a40('0x13')],{'host':_0x5a40('0x14'),'port':0x18eb});var socket=require(_0x5a40('0x15'))(new Redis(config['redis']));require(_0x5a40('0x16'))[_0x5a40('0x17')](socket);var jayson=require(_0x5a40('0x18'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x56ec80,_0x12cc02,_0x1181fe,_0x1c0e57){return new BPromise(function(_0x20112f,_0x5a8270){var _0x20e4c0=_0x1c0e57||client;return _0x20e4c0['request'](_0x56ec80,_0x1181fe)['then'](function(_0x5c69c1){logger[_0x5a40('0x19')](_0x5a40('0x1a'),_0x12cc02,'request\x20sent');logger[_0x5a40('0x1b')](_0x5a40('0x1c'),_0x12cc02,_0x5a40('0x1d'),JSON[_0x5a40('0x1e')](_0x5c69c1));if(_0x5c69c1[_0x5a40('0x1f')]){if(_0x5c69c1['error'][_0x5a40('0x20')]===0x1f4){logger[_0x5a40('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x12cc02,_0x5c69c1[_0x5a40('0x1f')][_0x5a40('0x21')]);return _0x5a8270(_0x5c69c1[_0x5a40('0x1f')][_0x5a40('0x21')]);}logger[_0x5a40('0x1f')](_0x5a40('0x1a'),_0x12cc02,_0x5c69c1['error'][_0x5a40('0x21')]);return _0x20112f(_0x5c69c1[_0x5a40('0x1f')][_0x5a40('0x21')]);}else{logger[_0x5a40('0x19')](_0x5a40('0x1a'),_0x12cc02,_0x5a40('0x1d'));_0x20112f(_0x5c69c1[_0x5a40('0x22')][_0x5a40('0x21')]);}})[_0x5a40('0x23')](function(_0x4ca585){logger[_0x5a40('0x1f')](_0x5a40('0x1a'),_0x12cc02,_0x4ca585);_0x5a8270(_0x4ca585);});});}function respondWithStatusCode(_0x358012,_0x1c4a09){_0x1c4a09=_0x1c4a09||0xcc;return function(_0x55da80){if(_0x55da80){return _0x358012[_0x5a40('0x24')](_0x1c4a09);}return _0x358012[_0x5a40('0x25')](_0x1c4a09)[_0x5a40('0x26')]();};}function respondWithResult(_0x4758ae,_0x36188d){_0x36188d=_0x36188d||0xc8;return function(_0x44ed8f){if(_0x44ed8f){return _0x4758ae[_0x5a40('0x25')](_0x36188d)[_0x5a40('0x27')](_0x44ed8f);}};}function respondWithFilteredResult(_0x49fa77,_0x16dc8c){return function(_0x1aba06){if(_0x1aba06){var _0x4e1223=typeof _0x16dc8c['offset']===_0x5a40('0x28')&&typeof _0x16dc8c[_0x5a40('0x29')]===_0x5a40('0x28');var _0xdeeea7=_0x1aba06[_0x5a40('0x2a')];var _0x3e422d=_0x4e1223?0x0:_0x16dc8c['offset'];var _0x5b9f43=_0x4e1223?_0x1aba06['count']:_0x16dc8c[_0x5a40('0x2b')]+_0x16dc8c['limit'];var _0xf68af2;if(_0x5b9f43>=_0xdeeea7){_0x5b9f43=_0xdeeea7;_0xf68af2=0xc8;}else{_0xf68af2=0xce;}_0x49fa77['status'](_0xf68af2);return _0x49fa77[_0x5a40('0x2c')](_0x5a40('0x2d'),_0x3e422d+'-'+_0x5b9f43+'/'+_0xdeeea7)[_0x5a40('0x27')](_0x1aba06);}return null;};}function patchUpdates(_0xf90875){return function(_0x4bad46){try{jsonpatch[_0x5a40('0x2e')](_0x4bad46,_0xf90875,!![]);}catch(_0x441d99){return BPromise[_0x5a40('0x2f')](_0x441d99);}return _0x4bad46[_0x5a40('0x30')]();};}function saveUpdates(_0x15a17c,_0x69908f){return function(_0x1344a1){if(_0x1344a1){return _0x1344a1[_0x5a40('0x31')](_0x15a17c)['then'](function(_0x227374){return _0x227374;});}return null;};}function removeEntity(_0x5d2f00,_0x5a33cf){return function(_0x4f90e4){if(_0x4f90e4){return _0x4f90e4['destroy']()[_0x5a40('0x32')](function(){var _0x2ee9ab=_0x4f90e4[_0x5a40('0x33')]({'plain':!![]});var _0x4deb92='WhatsappAccounts';return db[_0x5a40('0x34')][_0x5a40('0x35')]({'where':{'type':_0x4deb92,'resourceId':_0x2ee9ab['id']}})[_0x5a40('0x32')](function(){return _0x4f90e4;});})[_0x5a40('0x32')](function(){_0x5d2f00['status'](0xcc)[_0x5a40('0x26')]();});}};}function handleEntityNotFound(_0x13cc0b,_0x3eeb8e){return function(_0x3e5596){if(!_0x3e5596){_0x13cc0b[_0x5a40('0x24')](0x194);}return _0x3e5596;};}function handleError(_0x4d8387,_0x52b3c3){_0x52b3c3=_0x52b3c3||0x1f4;return function(_0x457c06){logger[_0x5a40('0x1f')](_0x457c06[_0x5a40('0x36')]);if(_0x457c06['name']){delete _0x457c06[_0x5a40('0x37')];}_0x4d8387['status'](_0x52b3c3)['send'](_0x457c06);};}exports[_0x5a40('0x38')]=function(_0x5fd51b,_0x4fd509){var _0x45f802={'include':[{'model':db[_0x5a40('0x39')],'as':_0x5a40('0x3a')}]},_0x408e31={},_0x56e286={'count':0x0,'rows':[]};var _0x1420c6=_[_0x5a40('0x3b')](db[_0x5a40('0x3c')]['rawAttributes'],function(_0x336875){return{'name':_0x336875['fieldName'],'type':_0x336875['type'][_0x5a40('0x3d')]};});_0x408e31['model']=_[_0x5a40('0x3b')](_0x1420c6,_0x5a40('0x37'));_0x408e31[_0x5a40('0x3e')]=_['keys'](_0x5fd51b[_0x5a40('0x3e')]);_0x408e31[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x408e31[_0x5a40('0x41')],_0x408e31[_0x5a40('0x3e')]);_0x45f802['attributes']=_['intersection'](_0x408e31[_0x5a40('0x41')],qs['fields'](_0x5fd51b['query'][_0x5a40('0x42')]));_0x45f802[_0x5a40('0x43')]=_0x45f802[_0x5a40('0x43')][_0x5a40('0x44')]?_0x45f802[_0x5a40('0x43')]:_0x408e31[_0x5a40('0x41')];if(!_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x45f802[_0x5a40('0x29')]=qs['limit'](_0x5fd51b['query'][_0x5a40('0x29')]);_0x45f802[_0x5a40('0x2b')]=qs[_0x5a40('0x2b')](_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x2b')]);}_0x45f802[_0x5a40('0x46')]=qs[_0x5a40('0x47')](_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x47')]);_0x45f802[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_['pick'](_0x5fd51b[_0x5a40('0x3e')],_0x408e31['filters']),_0x1420c6);if(_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x49')]){_0x45f802['where']=_[_0x5a40('0x4a')](_0x45f802['where'],{'$or':_['map'](_0x1420c6,function(_0x191c44){if(_0x191c44[_0x5a40('0x4b')]!==_0x5a40('0x4c')){var _0x1f26e5={};_0x1f26e5[_0x191c44[_0x5a40('0x37')]]={'$like':'%'+_0x5fd51b['query'][_0x5a40('0x49')]+'%'};return _0x1f26e5;}})});}_0x45f802=_[_0x5a40('0x4a')]({},_0x45f802,_0x5fd51b[_0x5a40('0x4d')]);var _0x5b889c={'where':_0x45f802[_0x5a40('0x48')]};return db[_0x5a40('0x3c')][_0x5a40('0x2a')](_0x5b889c)[_0x5a40('0x32')](function(_0x1e83bb){_0x56e286[_0x5a40('0x2a')]=_0x1e83bb;if(_0x5fd51b[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x45f802[_0x5a40('0x4f')]=[{'all':!![]}];}return db[_0x5a40('0x3c')]['findAll'](_0x45f802);})[_0x5a40('0x32')](function(_0x337c86){_0x56e286[_0x5a40('0x50')]=_0x337c86;return _0x56e286;})[_0x5a40('0x32')](respondWithFilteredResult(_0x4fd509,_0x45f802))[_0x5a40('0x23')](handleError(_0x4fd509,null));};exports['show']=function(_0x1a97af,_0x1b24bf){var _0x3cd163={'raw':![],'where':{'id':_0x1a97af['params']['id']},'include':[{'model':db[_0x5a40('0x39')],'as':_0x5a40('0x3a')}]},_0x4fcc1a={};_0x4fcc1a[_0x5a40('0x41')]=_[_0x5a40('0x51')](db[_0x5a40('0x3c')]['rawAttributes']);_0x4fcc1a[_0x5a40('0x3e')]=_['keys'](_0x1a97af['query']);_0x4fcc1a['filters']=_['intersection'](_0x4fcc1a['model'],_0x4fcc1a[_0x5a40('0x3e')]);_0x3cd163['attributes']=_[_0x5a40('0x40')](_0x4fcc1a['model'],qs[_0x5a40('0x42')](_0x1a97af['query']['fields']));_0x3cd163[_0x5a40('0x43')]=_0x3cd163['attributes'][_0x5a40('0x44')]?_0x3cd163[_0x5a40('0x43')]:_0x4fcc1a[_0x5a40('0x41')];if(_0x1a97af[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x3cd163['include']=[{'all':!![]}];}_0x3cd163=_[_0x5a40('0x4a')]({},_0x3cd163,_0x1a97af[_0x5a40('0x4d')]);return db['WhatsappAccount'][_0x5a40('0x52')](_0x3cd163)[_0x5a40('0x32')](handleEntityNotFound(_0x1b24bf,null))['then'](respondWithResult(_0x1b24bf,null))[_0x5a40('0x23')](handleError(_0x1b24bf,null));};exports[_0x5a40('0x53')]=function(_0x4e2667,_0x17e748){return db[_0x5a40('0x3c')][_0x5a40('0x53')](_0x4e2667[_0x5a40('0x54')],{})['then'](function(_0x4a9284){var _0x5346a0=_0x4e2667['user'][_0x5a40('0x33')]({'plain':!![]});if(!_0x5346a0)throw new Error(_0x5a40('0x55'));if(_0x5346a0[_0x5a40('0x56')]===_0x5a40('0x57')){var _0xdd16ca=_0x4a9284[_0x5a40('0x33')]({'plain':!![]});var _0x2aaf99=_0x5a40('0x58');return db[_0x5a40('0x59')][_0x5a40('0x52')]({'where':{'name':_0x2aaf99,'userProfileId':_0x5346a0[_0x5a40('0x5a')]},'raw':!![]})[_0x5a40('0x32')](function(_0x44de4f){if(_0x44de4f&&_0x44de4f[_0x5a40('0x5b')]===0x0){return db[_0x5a40('0x34')]['create']({'name':_0xdd16ca[_0x5a40('0x37')],'resourceId':_0xdd16ca['id'],'type':_0x44de4f['name'],'sectionId':_0x44de4f['id']},{})['then'](function(){return _0x4a9284;});}else{return _0x4a9284;}})[_0x5a40('0x23')](function(_0x49f503){logger[_0x5a40('0x1f')](_0x5a40('0x5c'),_0x49f503);throw _0x49f503;});}return _0x4a9284;})[_0x5a40('0x32')](respondWithResult(_0x17e748,0xc9))[_0x5a40('0x23')](handleError(_0x17e748,null));};exports['update']=function(_0x1fd495,_0x23a641){if(_0x1fd495[_0x5a40('0x54')]['id']){delete _0x1fd495[_0x5a40('0x54')]['id'];}return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x1fd495[_0x5a40('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x23a641,null))['then'](saveUpdates(_0x1fd495[_0x5a40('0x54')],null))[_0x5a40('0x32')](respondWithResult(_0x23a641,null))[_0x5a40('0x23')](handleError(_0x23a641,null));};exports[_0x5a40('0x35')]=function(_0x1bdb3e,_0x20dd06){return db['WhatsappAccount']['find']({'where':{'id':_0x1bdb3e['params']['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x20dd06,null))[_0x5a40('0x32')](removeEntity(_0x20dd06,null))[_0x5a40('0x23')](handleError(_0x20dd06,null));};exports[_0x5a40('0x5e')]=function(_0x37108f,_0x2fc98a){return db[_0x5a40('0x3c')][_0x5a40('0x5e')]()['then'](respondWithResult(_0x2fc98a,null))[_0x5a40('0x23')](handleError(_0x2fc98a,null));};exports[_0x5a40('0x5f')]=function(_0x525fcf,_0xf685c8,_0x16db88){if(_0x525fcf[_0x5a40('0x54')]['id']){delete _0x525fcf[_0x5a40('0x54')]['id'];}return db['WhatsappAccount'][_0x5a40('0x52')]({'where':{'id':_0x525fcf[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0xf685c8,null))['then'](function(_0x512d86){if(_0x512d86){_0x525fcf['body']['WhatsappAccountId']=_0x512d86['id'];return db[_0x5a40('0x60')][_0x5a40('0x53')](_0x525fcf[_0x5a40('0x54')]);}})[_0x5a40('0x32')](respondWithResult(_0xf685c8,null))[_0x5a40('0x23')](handleError(_0xf685c8,null));};exports[_0x5a40('0x61')]=function(_0x42fbd2,_0x57fb95,_0x4b6f36){var _0x525752={'raw':![],'where':{}};var _0x597b64={};var _0x1c9670={'count':0x0,'rows':[]};return db[_0x5a40('0x3c')][_0x5a40('0x62')]({'where':{'id':_0x42fbd2[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x57fb95,null))[_0x5a40('0x32')](function(_0x13113a){if(_0x13113a){_0x597b64['model']=_[_0x5a40('0x51')](db[_0x5a40('0x60')][_0x5a40('0x63')]);_0x597b64[_0x5a40('0x3e')]=_[_0x5a40('0x51')](_0x42fbd2['query']);_0x597b64[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x597b64[_0x5a40('0x41')],_0x597b64[_0x5a40('0x3e')]);_0x525752['attributes']=_[_0x5a40('0x40')](_0x597b64[_0x5a40('0x41')],qs[_0x5a40('0x42')](_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x42')]));_0x525752[_0x5a40('0x43')]=_0x525752['attributes'][_0x5a40('0x44')]?_0x525752[_0x5a40('0x43')]:_0x597b64[_0x5a40('0x41')];if(!_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x525752[_0x5a40('0x29')]=qs[_0x5a40('0x29')](_0x42fbd2['query'][_0x5a40('0x29')]);_0x525752[_0x5a40('0x2b')]=qs[_0x5a40('0x2b')](_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x2b')]);}_0x525752['order']=qs[_0x5a40('0x47')](_0x42fbd2['query'][_0x5a40('0x47')]);_0x525752[_0x5a40('0x48')]=qs['filters'](_[_0x5a40('0x64')](_0x42fbd2['query'],_0x597b64[_0x5a40('0x3f')]));_0x525752[_0x5a40('0x48')][_0x5a40('0x65')]=_0x13113a['id'];if(_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x49')]){_0x525752[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0x525752['where'],{'$or':_['map'](_0x525752[_0x5a40('0x43')],function(_0x2000a4){var _0x4eb802={};_0x4eb802[_0x2000a4]={'$like':'%'+_0x42fbd2[_0x5a40('0x3e')]['filter']+'%'};return _0x4eb802;})});}_0x525752=_['merge']({},_0x525752,_0x42fbd2['options']);return db['Disposition'][_0x5a40('0x2a')]({'where':_0x525752[_0x5a40('0x48')]})[_0x5a40('0x32')](function(_0x3bb076){_0x1c9670[_0x5a40('0x2a')]=_0x3bb076;if(_0x42fbd2[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x525752[_0x5a40('0x4f')]=[{'all':!![]}];}return db[_0x5a40('0x60')]['findAll'](_0x525752);})['then'](function(_0x42d859){_0x1c9670[_0x5a40('0x50')]=_0x42d859;return _0x1c9670;});}})[_0x5a40('0x32')](respondWithFilteredResult(_0x57fb95,_0x525752))[_0x5a40('0x23')](handleError(_0x57fb95,null));};exports[_0x5a40('0x66')]=function(_0x291ce2,_0x27cec6,_0x6392a6){return db[_0x5a40('0x3c')]['find']({'where':{'id':_0x291ce2[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x27cec6,null))['then'](function(_0x49365d){if(_0x49365d){return _0x49365d[_0x5a40('0x66')](_0x291ce2[_0x5a40('0x3e')]['ids']);}})[_0x5a40('0x32')](respondWithStatusCode(_0x27cec6,null))[_0x5a40('0x23')](handleError(_0x27cec6,null));};exports[_0x5a40('0x67')]=function(_0x3f62cb,_0x135d0d,_0x5ce865){if(_0x3f62cb[_0x5a40('0x54')]['id']){delete _0x3f62cb['body']['id'];}return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x3f62cb[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x135d0d,null))[_0x5a40('0x32')](function(_0x223bb1){if(_0x223bb1){_0x3f62cb['body']['WhatsappAccountId']=_0x223bb1['id'];return db[_0x5a40('0x68')]['create'](_0x3f62cb[_0x5a40('0x54')]);}})[_0x5a40('0x32')](respondWithResult(_0x135d0d,null))['catch'](handleError(_0x135d0d,null));};exports[_0x5a40('0x69')]=function(_0x1431d8,_0x36360e,_0x472258){var _0x1adb60={'raw':![],'where':{}};var _0x8de451={};var _0x5de49f={'count':0x0,'rows':[]};return db[_0x5a40('0x3c')]['findOne']({'where':{'id':_0x1431d8[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x36360e,null))[_0x5a40('0x32')](function(_0x362993){if(_0x362993){_0x8de451[_0x5a40('0x41')]=_[_0x5a40('0x51')](db[_0x5a40('0x68')][_0x5a40('0x63')]);_0x8de451[_0x5a40('0x3e')]=_[_0x5a40('0x51')](_0x1431d8['query']);_0x8de451['filters']=_[_0x5a40('0x40')](_0x8de451[_0x5a40('0x41')],_0x8de451['query']);_0x1adb60['attributes']=_[_0x5a40('0x40')](_0x8de451['model'],qs[_0x5a40('0x42')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x42')]));_0x1adb60['attributes']=_0x1adb60[_0x5a40('0x43')][_0x5a40('0x44')]?_0x1adb60['attributes']:_0x8de451['model'];if(!_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x1adb60[_0x5a40('0x29')]=qs[_0x5a40('0x29')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x29')]);_0x1adb60['offset']=qs[_0x5a40('0x2b')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x2b')]);}_0x1adb60[_0x5a40('0x46')]=qs[_0x5a40('0x47')](_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x47')]);_0x1adb60[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_[_0x5a40('0x64')](_0x1431d8[_0x5a40('0x3e')],_0x8de451[_0x5a40('0x3f')]));_0x1adb60[_0x5a40('0x48')][_0x5a40('0x65')]=_0x362993['id'];if(_0x1431d8['query'][_0x5a40('0x49')]){_0x1adb60[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0x1adb60[_0x5a40('0x48')],{'$or':_[_0x5a40('0x3b')](_0x1adb60[_0x5a40('0x43')],function(_0x4f3994){var _0x19149d={};_0x19149d[_0x4f3994]={'$like':'%'+_0x1431d8['query'][_0x5a40('0x49')]+'%'};return _0x19149d;})});}_0x1adb60=_[_0x5a40('0x4a')]({},_0x1adb60,_0x1431d8[_0x5a40('0x4d')]);return db[_0x5a40('0x68')][_0x5a40('0x2a')]({'where':_0x1adb60[_0x5a40('0x48')]})[_0x5a40('0x32')](function(_0x341793){_0x5de49f[_0x5a40('0x2a')]=_0x341793;if(_0x1431d8[_0x5a40('0x3e')][_0x5a40('0x4e')]){_0x1adb60['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5a40('0x6a')](_0x1adb60);})[_0x5a40('0x32')](function(_0x2d3bfe){_0x5de49f[_0x5a40('0x50')]=_0x2d3bfe;return _0x5de49f;});}})[_0x5a40('0x32')](respondWithFilteredResult(_0x36360e,_0x1adb60))[_0x5a40('0x23')](handleError(_0x36360e,null));};exports[_0x5a40('0x6b')]=function(_0x22c8c8,_0xd3d93b,_0x21535e){return db['WhatsappAccount']['find']({'where':{'id':_0x22c8c8[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0xd3d93b,null))[_0x5a40('0x32')](function(_0x134bbf){if(_0x134bbf){return _0x134bbf[_0x5a40('0x6b')](_0x22c8c8[_0x5a40('0x3e')][_0x5a40('0x6c')]);}})['then'](respondWithStatusCode(_0xd3d93b,null))[_0x5a40('0x23')](handleError(_0xd3d93b,null));};exports[_0x5a40('0x6d')]=function(_0x289bca,_0x1e647d,_0x42d7c8){return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x289bca[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1e647d,null))[_0x5a40('0x32')](function(_0x1330a7){if(_0x1330a7){return _0x1330a7[_0x5a40('0x6d')](_0x289bca[_0x5a40('0x54')][_0x5a40('0x6c')],_[_0x5a40('0x6e')](_0x289bca[_0x5a40('0x54')],[_0x5a40('0x6c'),'id'])||{})[_0x5a40('0x6f')](function(_0x57bc18){for(var _0x5569fd=0x0;_0x5569fd<_0x289bca['body'][_0x5a40('0x6c')][_0x5a40('0x44')];_0x5569fd+=0x1){socket[_0x5a40('0x70')](_0x5a40('0x71'),{'UserId':Number(_0x289bca['body']['ids'][_0x5569fd]),'WhatsappAccountId':Number(_0x289bca[_0x5a40('0x5d')]['id'])});}return _0x57bc18;});}})[_0x5a40('0x32')](respondWithResult(_0x1e647d,null))['catch'](handleError(_0x1e647d,null));};exports[_0x5a40('0x72')]=function(_0x2d27ac,_0x260b7f,_0x38b07d){return db[_0x5a40('0x3c')][_0x5a40('0x52')]({'where':{'id':_0x2d27ac[_0x5a40('0x5d')]['id']}})[_0x5a40('0x32')](handleEntityNotFound(_0x260b7f,null))[_0x5a40('0x32')](function(_0x196a51){if(_0x196a51){return _0x196a51[_0x5a40('0x72')](_0x2d27ac[_0x5a40('0x3e')]['ids'])[_0x5a40('0x32')](function(){if(_[_0x5a40('0x73')](_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')])){for(var _0x3b149e=0x0;_0x3b149e<_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')]['length'];_0x3b149e+=0x1){socket[_0x5a40('0x70')](_0x5a40('0x74'),{'UserId':Number(_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')][_0x3b149e]),'WhatsappAccountId':Number(_0x2d27ac[_0x5a40('0x5d')]['id'])});}}else{socket[_0x5a40('0x70')](_0x5a40('0x74'),{'UserId':Number(_0x2d27ac[_0x5a40('0x3e')][_0x5a40('0x6c')]),'WhatsappAccountId':Number(_0x2d27ac[_0x5a40('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x260b7f,null))[_0x5a40('0x23')](handleError(_0x260b7f,null));};exports[_0x5a40('0x75')]=function(_0xda1a4f,_0xc0011a,_0x37b204){var _0xc832={};var _0x27b075={};var _0xfc570b;var _0x299639;return db['WhatsappAccount'][_0x5a40('0x62')]({'where':{'id':_0xda1a4f[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc0011a,null))['then'](function(_0x2c6415){if(_0x2c6415){_0xfc570b=_0x2c6415;_0x27b075[_0x5a40('0x41')]=_['keys'](db[_0x5a40('0x76')][_0x5a40('0x63')]);_0x27b075['query']=_[_0x5a40('0x51')](_0xda1a4f[_0x5a40('0x3e')]);_0x27b075[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x27b075[_0x5a40('0x41')],_0x27b075[_0x5a40('0x3e')]);_0xc832[_0x5a40('0x43')]=_[_0x5a40('0x40')](_0x27b075[_0x5a40('0x41')],qs['fields'](_0xda1a4f['query'][_0x5a40('0x42')]));_0xc832['attributes']=_0xc832['attributes'][_0x5a40('0x44')]?_0xc832[_0x5a40('0x43')]:_0x27b075['model'];_0xc832['order']=qs[_0x5a40('0x47')](_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x47')]);_0xc832[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_[_0x5a40('0x64')](_0xda1a4f[_0x5a40('0x3e')],_0x27b075['filters']));if(_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x49')]){_0xc832[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0xc832[_0x5a40('0x48')],{'$or':_[_0x5a40('0x3b')](_0xc832[_0x5a40('0x43')],function(_0x5614a0){var _0x6c540b={};_0x6c540b[_0x5614a0]={'$like':'%'+_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x49')]+'%'};return _0x6c540b;})});}_0xc832=_[_0x5a40('0x4a')]({},_0xc832,_0xda1a4f[_0x5a40('0x4d')]);return _0xfc570b['getAgents'](_0xc832);}})[_0x5a40('0x32')](function(_0xcc307){if(_0xcc307){_0x299639=_0xcc307[_0x5a40('0x44')];if(!_0xda1a4f[_0x5a40('0x3e')]['hasOwnProperty'](_0x5a40('0x77'))){_0xc832['limit']=qs[_0x5a40('0x29')](_0xda1a4f[_0x5a40('0x3e')][_0x5a40('0x29')]);_0xc832[_0x5a40('0x2b')]=qs[_0x5a40('0x2b')](_0xda1a4f['query']['offset']);}return _0xfc570b['getAgents'](_0xc832);}})[_0x5a40('0x32')](function(_0x5b60c6){if(_0x5b60c6){return _0x5b60c6?{'count':_0x299639,'rows':_0x5b60c6}:null;}})[_0x5a40('0x32')](respondWithResult(_0xc0011a,null))[_0x5a40('0x23')](handleError(_0xc0011a,null));};exports[_0x5a40('0x78')]=function(_0x4d8098,_0x4172d7){var _0x2130e7=_0x4d8098['params']['id'];var _0x455ec2=_0x4d8098[_0x5a40('0x54')];var _0x90e3ed=0xc8;var _0x3e4baf=null;return db[_0x5a40('0x79')][_0x5a40('0x7a')]({'isolationLevel':db[_0x5a40('0x79')][_0x5a40('0x7b')][_0x5a40('0x7c')][_0x5a40('0x7d')]},function(_0x2f2a6e){return db[_0x5a40('0x3c')]['findOne']({'where':{'id':_0x2130e7},'transaction':_0x2f2a6e})[_0x5a40('0x32')](function(_0x1fcd04){if(_0x1fcd04){return db[_0x5a40('0x7e')][_0x5a40('0x35')]({'where':{'WhatsappAccountId':_0x2130e7},'transaction':_0x2f2a6e})[_0x5a40('0x32')](function(){var _0xf181e4=_[_0x5a40('0x3b')](_0x455ec2,function(_0x254800){_0x254800[_0x5a40('0x65')]=_0x2130e7;return _0x254800;});return db[_0x5a40('0x7e')][_0x5a40('0x7f')](_0xf181e4,{'transaction':_0x2f2a6e});});}else{_0x90e3ed=0x194;_0x3e4baf=[];}});})[_0x5a40('0x32')](function(){if(_0x90e3ed!==0x194){return db[_0x5a40('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2130e7},'order':'priority'})[_0x5a40('0x32')](function(_0x22abbe){_0x3e4baf=_0x22abbe;});}})['catch'](function(_0x592605){_0x90e3ed=0x1f4;logger[_0x5a40('0x1f')](_0x592605[_0x5a40('0x36')]);if(_0x592605[_0x5a40('0x37')]){delete _0x592605[_0x5a40('0x37')];}_0x3e4baf=_0x592605;})[_0x5a40('0x80')](function(){if(_0x3e4baf===null){_0x4172d7[_0x5a40('0x24')](_0x90e3ed);}else{if(_0x90e3ed===0x1f4){_0x4172d7['status'](_0x90e3ed)[_0x5a40('0x81')](_0x3e4baf);}else{_0x4172d7[_0x5a40('0x25')](_0x90e3ed)[_0x5a40('0x27')](_0x3e4baf);}}});};exports[_0x5a40('0x82')]=function(_0x48ce07,_0x4e60ae,_0x7e6df2){var _0x24fa3e={};var _0x43c431={};var _0x224457;var _0x33cd69;return db['WhatsappAccount']['findOne']({'where':{'id':_0x48ce07[_0x5a40('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4e60ae,null))['then'](function(_0xfa17d0){if(_0xfa17d0){_0x224457=_0xfa17d0;_0x43c431[_0x5a40('0x41')]=_[_0x5a40('0x51')](db['WhatsappApplication'][_0x5a40('0x63')]);_0x43c431[_0x5a40('0x3e')]=_['keys'](_0x48ce07[_0x5a40('0x3e')]);_0x43c431[_0x5a40('0x3f')]=_[_0x5a40('0x40')](_0x43c431[_0x5a40('0x41')],_0x43c431[_0x5a40('0x3e')]);_0x24fa3e['attributes']=_[_0x5a40('0x40')](_0x43c431[_0x5a40('0x41')],qs[_0x5a40('0x42')](_0x48ce07[_0x5a40('0x3e')]['fields']));_0x24fa3e[_0x5a40('0x43')]=_0x24fa3e['attributes'][_0x5a40('0x44')]?_0x24fa3e['attributes']:_0x43c431['model'];_0x24fa3e['order']=qs[_0x5a40('0x47')](_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x47')]);_0x24fa3e[_0x5a40('0x48')]=qs[_0x5a40('0x3f')](_[_0x5a40('0x64')](_0x48ce07[_0x5a40('0x3e')],_0x43c431[_0x5a40('0x3f')]));if(_0x48ce07['query']['filter']){_0x24fa3e[_0x5a40('0x48')]=_[_0x5a40('0x4a')](_0x24fa3e[_0x5a40('0x48')],{'$or':_[_0x5a40('0x3b')](_0x24fa3e[_0x5a40('0x43')],function(_0x4365ee){var _0x2999db={};_0x2999db[_0x4365ee]={'$like':'%'+_0x48ce07['query'][_0x5a40('0x49')]+'%'};return _0x2999db;})});}_0x24fa3e=_[_0x5a40('0x4a')]({},_0x24fa3e,_0x48ce07[_0x5a40('0x4d')]);return _0x224457[_0x5a40('0x82')](_0x24fa3e);}})[_0x5a40('0x32')](function(_0x4b67d4){if(_0x4b67d4){_0x33cd69=_0x4b67d4[_0x5a40('0x44')];if(!_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x45')]('nolimit')){_0x24fa3e[_0x5a40('0x29')]=qs[_0x5a40('0x29')](_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x29')]);_0x24fa3e['offset']=qs['offset'](_0x48ce07[_0x5a40('0x3e')][_0x5a40('0x2b')]);}return _0x224457[_0x5a40('0x82')](_0x24fa3e);}})[_0x5a40('0x32')](function(_0x829df2){if(_0x829df2){return _0x829df2?{'count':_0x33cd69,'rows':_0x829df2}:null;}})[_0x5a40('0x32')](respondWithResult(_0x4e60ae,null))[_0x5a40('0x23')](handleError(_0x4e60ae,null));};exports[_0x5a40('0x83')]=function(_0x1a73ec,_0x171438,_0x2d9710){var _0x1ce4a9={'channel':'whatsapp'};var _0x48419f=[];var _0x2b136e=[];var _0x2ced09={};return db[_0x5a40('0x3c')]['find']({'where':{'id':_0x1a73ec[_0x5a40('0x5d')]['id']},'include':[{'model':db[_0x5a40('0x7e')],'as':_0x5a40('0x84')}]})[_0x5a40('0x32')](handleEntityNotFound(_0x171438,null))[_0x5a40('0x32')](function(_0x403ced){_0x1ce4a9[_0x5a40('0x85')]=_0x403ced;if(_0x1ce4a9[_0x5a40('0x85')]&&_0x1ce4a9['account'][_0x5a40('0x4b')]==='sinch'&&_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x86')]){if(_0x1a73ec['body'][_0x5a40('0x86')][_0x5a40('0x44')]===0x0)return;if(_0x1a73ec['body'][_0x5a40('0x86')][0x0][_0x5a40('0x87')]!==_0x5a40('0x88'))return;return db[_0x5a40('0x89')]['update']({'read':!![],'readAt':_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x86')][0x0][_0x5a40('0x8a')]},{'where':{'messageId':_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x5a40('0x32')](function(_0x13b642){return _0x171438[_0x5a40('0x25')](0xc8)['json'](_0x13b642);});}_0x1ce4a9[_0x5a40('0x8b')]=_[_0x5a40('0x8c')](_0x403ced[_0x5a40('0x84')],[_0x5a40('0x8d')],[_0x5a40('0x8e')]);if(_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x84')]){delete _0x1ce4a9['account'][_0x5a40('0x84')];}return db[_0x5a40('0x8f')]['describe']()[_0x5a40('0x32')](function(_0x9fc022){if(!_0x9fc022){throw new db[(_0x5a40('0x90'))][(_0x5a40('0x91'))]('no\x20available\x20attributes');}_0x48419f=_[_0x5a40('0x92')](_[_0x5a40('0x51')](_0x9fc022),[_0x5a40('0x93'),_0x5a40('0x94')]);_0x2b136e=_[_0x5a40('0x92')](_[_0x5a40('0x51')](_0x9fc022),[_0x5a40('0x93'),_0x5a40('0x94'),'CompanyId',_0x5a40('0x95')]);_0x1ce4a9['body']={'mapKey':_0x5a40('0x96')};if(_0x1ce4a9[_0x5a40('0x85')]&&_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x4b')]===_0x5a40('0x97')){_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x99')][_0x5a40('0x9a')](_0x5a40('0x9b'),'');_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x54')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9c')];_0x1ce4a9[_0x5a40('0x54')]['messageId']=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9d')];}if(_0x1ce4a9[_0x5a40('0x85')]&&_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x4b')]===_0x5a40('0x9e')){_0x1ce4a9[_0x5a40('0x54')]['from']=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9f')][0x0]['from'];_0x1ce4a9['body'][_0x5a40('0x54')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9f')][0x0][_0x5a40('0x21')]['body'];_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0xa0')]=_0x1a73ec[_0x5a40('0x54')][_0x5a40('0x9f')][0x0][_0x5a40('0xa1')];}if(_0x1ce4a9['body']['id']){delete _0x1ce4a9[_0x5a40('0x54')]['id'];}if(_[_0x5a40('0xa2')](_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')])){throw new db[(_0x5a40('0x90'))][(_0x5a40('0x91'))](_0x5a40('0xa3'));}if(_[_0x5a40('0xa2')](_0x1ce4a9['body'][_0x5a40('0x54')])||_0x1ce4a9[_0x5a40('0x54')]['body']===''){throw new db[(_0x5a40('0x90'))]['ValidationError'](_0x5a40('0xa4'));}if(_[_0x5a40('0xa2')](_0x1ce4a9['body'][_0x5a40('0xa5')])){throw new db[(_0x5a40('0x90'))]['ValidationError'](_0x5a40('0xa6')+_0x2b136e);}if(!_[_0x5a40('0xa7')](_0x2b136e,_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0xa5')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b136e);}_0x2ced09[_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0xa5')]]=_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')];return db[_0x5a40('0xa8')]['find']({'where':{'id':_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0x95')]},'include':[{'model':db[_0x5a40('0x8f')],'as':_0x5a40('0xa9'),'where':_0x2ced09,'limit':0x1,'order':[[_0x5a40('0x94'),_0x5a40('0xaa')]]}]});})[_0x5a40('0x32')](handleEntityNotFound(_0x171438,null))[_0x5a40('0x32')](function(_0x5ba390){if(_0x5ba390){_0x1ce4a9[_0x5a40('0xab')]=_[_0x5a40('0x6e')](_0x5ba390,[_0x5a40('0xa9')]);if(_0x5ba390[_0x5a40('0xa9')]['length']){return _0x5ba390[_0x5a40('0xa9')][0x0];}var _0x2ab507=_['defaults'](_0x1ce4a9[_0x5a40('0x54')],{'firstName':_0x1ce4a9['body']['from'],'ListId':_0x5ba390['id']});_0x2ab507[_0x1ce4a9['body'][_0x5a40('0xa5')]]=_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')];return db[_0x5a40('0x8f')][_0x5a40('0x53')](_0x2ab507,{'fields':_0x48419f,'raw':!![]});}})[_0x5a40('0x32')](handleEntityNotFound(_0x171438,null))['then'](function(_0x4f005f){if(_0x4f005f){_0x1ce4a9[_0x5a40('0xac')]=_0x4f005f;var _0x216223={'ContactId':_0x4f005f['id'],'phone':_0x1ce4a9['body'][_0x5a40('0x98')],'WhatsappAccountId':_0x1a73ec[_0x5a40('0x5d')]['id']};var _0x254946={'ContactId':_0x4f005f['id'],'WhatsappAccountId':_0x1a73ec[_0x5a40('0x5d')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x254946})['then'](function(_0x5a7a10){if(_0x5a7a10){return[_0x5a7a10,![]];}return db['WhatsappInteraction'][_0x5a40('0x53')](_0x216223)['then'](function(_0x118ded){return[_0x118ded,!![]];});});}})[_0x5a40('0x6f')](function(_0x5834e2,_0x5aaa87){_0x1ce4a9['interaction']=_0x5834e2[_0x5a40('0x33')]({'plain':!![]});_0x1ce4a9[_0x5a40('0xad')][_0x5a40('0xae')]=![];if(_0x5aaa87){if(_0x1ce4a9['account'][_0x5a40('0xaf')]){_0x1ce4a9[_0x5a40('0x8b')][_0x5a40('0xb0')]({'id':0x0,'priority':_0x1ce4a9[_0x5a40('0x8b')][_0x5a40('0x44')]+0x1,'app':_0x5a40('0xb1'),'appdata':_0x5a40('0xb2'),'interval':_0x5a40('0xb3')});}_0x1ce4a9['interaction'][_0x5a40('0xae')]=!![];}return db[_0x5a40('0x89')][_0x5a40('0x53')]({'phone':_0x1ce4a9[_0x5a40('0x54')][_0x5a40('0x98')],'messageId':_0x1ce4a9[_0x5a40('0x54')]['messageId'],'body':_0x1ce4a9[_0x5a40('0x54')]['body'],'WhatsappAccountId':_0x1a73ec['params']['id'],'WhatsappInteractionId':_0x5834e2['id'],'direction':'in','ContactId':_0x5834e2[_0x5a40('0xb4')],'AttachmentId':_0x1ce4a9[_0x5a40('0x54')]['AttachmentId']});})[_0x5a40('0x32')](function(_0x1a7342){_0x1ce4a9['message']=_0x1a7342;if(!_0x1ce4a9[_0x5a40('0xad')][_0x5a40('0xb5')])return;return db[_0x5a40('0x76')]['find']({'attributes':['id',_0x5a40('0x37')],'where':{'id':_0x1ce4a9['interaction']['UserId']}});})[_0x5a40('0x32')](function(_0x24ed38){if(_0x24ed38){_0x1ce4a9[_0x5a40('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x24ed38['name']+','+(_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0xb6')]||0xa),'interval':_0x5a40('0xb3')});}if(!_0x1ce4a9['interaction'][_0x5a40('0xb7')])return;return db[_0x5a40('0xb8')]['find']({'attributes':['id',_0x5a40('0x37')],'where':{'id':_0x1ce4a9['interaction'][_0x5a40('0xb7')]}});})['then'](function(_0x44ee38){if(_0x44ee38){_0x1ce4a9['applications'][_0x5a40('0xb9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x44ee38['name']+','+(_0x1ce4a9[_0x5a40('0x85')][_0x5a40('0xba')]||0x12c),'interval':_0x5a40('0xb3')});}return respondWithRpcPromise(_0x5a40('0xbb'),_0x5a40('0xbc'),_0x1ce4a9);})[_0x5a40('0x32')](function(_0x1f396f){if(_0x1f396f){var _0x1ac6c9=0xc8;var _0x42f552=_0x5a40('0xbd');logger[_0x5a40('0x19')](_0x5a40('0x1c'),_0x42f552,_0x1ac6c9,_0x5a40('0xbe'));logger[_0x5a40('0x1b')](_0x5a40('0xbf'),_0x42f552,_0x1ac6c9,_0x5a40('0xbe'),JSON[_0x5a40('0x1e')](_0x1f396f));if(_0x1ce4a9[_0x5a40('0x85')]['type']===_0x5a40('0x97')){return _0x171438[_0x5a40('0x25')](_0x1ac6c9)[_0x5a40('0x2c')](_0x5a40('0xc0'),'text/xml')[_0x5a40('0x81')](_0x5a40('0xc1'));}else{return _0x171438['status'](_0x1ac6c9)[_0x5a40('0x27')](_0x1f396f);}}});})[_0x5a40('0x23')](handleError(_0x171438,null));};exports[_0x5a40('0x81')]=function(_0x4c004f,_0xcf7a18,_0x27a263){var _0xaca5bf,_0xad70e7,_0x2124f1;if(_[_0x5a40('0xa2')](_0x4c004f[_0x5a40('0x54')]['body'])||_0x4c004f[_0x5a40('0x54')][_0x5a40('0x54')]===''){throw new db[(_0x5a40('0x90'))]['ValidationError'](_0x5a40('0xa4'));}if(_[_0x5a40('0xa2')](_0x4c004f[_0x5a40('0x54')]['to'])){throw new db[(_0x5a40('0x90'))][(_0x5a40('0x91'))](_0x5a40('0xc2'));}_0xaca5bf=_0x4c004f[_0x5a40('0x54')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x4c004f[_0x5a40('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x5a40('0xc3'),'include':[{'model':db[_0x5a40('0x8f')],'as':_0x5a40('0xa9'),'where':{'mobile':_0xaca5bf},'limit':0x1,'order':[[_0x5a40('0x94'),_0x5a40('0xaa')]]}]}]})[_0x5a40('0x32')](handleEntityNotFound(_0xcf7a18,null))[_0x5a40('0x32')](function(_0xd50487){if(_0xd50487&&_0xd50487[_0x5a40('0xc3')]){_0xad70e7=_0xd50487[_0x5a40('0x33')]({'plain':!![]});if(_0xad70e7[_0x5a40('0xc3')]&&_0xad70e7[_0x5a40('0xc3')][_0x5a40('0xa9')][_0x5a40('0x44')]){return _0xad70e7['List'][_0x5a40('0xa9')][0x0];}return db[_0x5a40('0x8f')][_0x5a40('0x53')](_[_0x5a40('0xc4')](_0x4c004f['body'],{'firstName':_0xaca5bf,'mobile':_0xaca5bf,'phone':_0xaca5bf,'ListId':_0xad70e7[_0x5a40('0x95')]}));}})[_0x5a40('0x32')](handleEntityNotFound(_0xcf7a18,null))[_0x5a40('0x32')](function(_0x19699b){if(_0x19699b){_0x2124f1=_0x19699b;return db['WhatsappInteraction'][_0x5a40('0x52')]({'where':{'ContactId':_0x2124f1['id'],'closed':![],'WhatsappAccountId':_0xad70e7['id']}})['then'](function(_0x454044){if(_0x454044){return[_0x454044,![]];}return db['WhatsappInteraction'][_0x5a40('0x53')]({'UserId':_0x4c004f[_0x5a40('0x57')]['id'],'ContactId':_0x2124f1['id'],'WhatsappAccountId':_0xad70e7['id'],'phone':_0xaca5bf,'firstMsgDirection':_0x5a40('0xc5'),'Messages':[_[_0x5a40('0x4a')](_0x4c004f[_0x5a40('0x54')],{'read':![],'body':_0x4c004f[_0x5a40('0x54')][_0x5a40('0x54')],'phone':_0xaca5bf,'WhatsappAccountId':_0xad70e7['id'],'UserId':_0x4c004f[_0x5a40('0x57')]['id'],'ContactId':_0x2124f1['id']})]},{'include':[{'model':db[_0x5a40('0x89')],'as':_0x5a40('0xc6')}]})['then'](function(_0x2724c2){return[_0x2724c2,!![]];});});}})[_0x5a40('0x6f')](function(_0xb4b42,_0x51b403){if(_0x51b403){return _0xb4b42;}return db[_0x5a40('0x89')]['create'](_[_0x5a40('0x4a')](_0x4c004f['body'],{'read':![],'body':_0x4c004f[_0x5a40('0x54')][_0x5a40('0x54')],'phone':_0xaca5bf,'WhatsappAccountId':_0xad70e7['id'],'WhatsappInteractionId':_0xb4b42['id'],'UserId':_0x4c004f[_0x5a40('0x57')]['id'],'ContactId':_0x2124f1['id']}))['then'](function(_0x492a2e){_0xb4b42['dataValues'][_0x5a40('0xc6')]=[];_0xb4b42[_0x5a40('0xc7')][_0x5a40('0xc6')]['push'](_0x492a2e[_0x5a40('0xc7')]);return _0xb4b42;});})[_0x5a40('0x32')](respondWithResult(_0xcf7a18,null))[_0x5a40('0x23')](handleError(_0xcf7a18,null));}; \ No newline at end of file +var _0xdab2=['receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','orderBy','asc','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','message_id','ValidationError','from\x20is\x20mandatory','isNil','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','WhatsappInteraction','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting'];(function(_0x5e707e,_0x417d4e){var _0x1eb733=function(_0x472b05){while(--_0x472b05){_0x5e707e['push'](_0x5e707e['shift']());}};_0x1eb733(++_0x417d4e);}(_0xdab2,0x19a));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2dab('0x0'));var rp=require(_0x2dab('0x1'));var moment=require(_0x2dab('0x2'));var BPromise=require(_0x2dab('0x3'));var Mustache=require(_0x2dab('0x4'));var util=require(_0x2dab('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2dab('0x6'));var ejs=require(_0x2dab('0x7'));var fs=require('fs');var fs_extra=require(_0x2dab('0x8'));var _=require(_0x2dab('0x9'));var squel=require(_0x2dab('0xa'));var crypto=require(_0x2dab('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2dab('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2dab('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2dab('0xd'));var as=require(_0x2dab('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dab('0xf'))('api');var utils=require(_0x2dab('0x10'));var config=require(_0x2dab('0x11'));var licenseUtil=require(_0x2dab('0x12'));var db=require(_0x2dab('0x13'))['db'];config[_0x2dab('0x14')]=_[_0x2dab('0x15')](config[_0x2dab('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2dab('0x16'))(new Redis(config[_0x2dab('0x14')]));require(_0x2dab('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2dab('0x18')]['http']({'port':0x232c});function respondWithRpcPromise(_0x67c96f,_0x2c4a96,_0x50c180,_0x2b9e56){return new BPromise(function(_0x7dbd33,_0xf2f21){var _0x1be988=_0x2b9e56||client;return _0x1be988[_0x2dab('0x19')](_0x67c96f,_0x50c180)[_0x2dab('0x1a')](function(_0x99fd17){logger[_0x2dab('0x1b')](_0x2dab('0x1c'),_0x2c4a96,_0x2dab('0x1d'));logger[_0x2dab('0x1e')](_0x2dab('0x1f'),_0x2c4a96,_0x2dab('0x1d'),JSON[_0x2dab('0x20')](_0x99fd17));if(_0x99fd17[_0x2dab('0x21')]){if(_0x99fd17['error']['code']===0x1f4){logger[_0x2dab('0x21')](_0x2dab('0x1c'),_0x2c4a96,_0x99fd17[_0x2dab('0x21')][_0x2dab('0x22')]);return _0xf2f21(_0x99fd17['error']['message']);}logger['error'](_0x2dab('0x1c'),_0x2c4a96,_0x99fd17['error'][_0x2dab('0x22')]);return _0x7dbd33(_0x99fd17[_0x2dab('0x21')]['message']);}else{logger['info'](_0x2dab('0x1c'),_0x2c4a96,_0x2dab('0x1d'));_0x7dbd33(_0x99fd17[_0x2dab('0x23')][_0x2dab('0x22')]);}})[_0x2dab('0x24')](function(_0x521522){logger['error'](_0x2dab('0x1c'),_0x2c4a96,_0x521522);_0xf2f21(_0x521522);});});}function respondWithStatusCode(_0x339be0,_0x4768e2){_0x4768e2=_0x4768e2||0xcc;return function(_0x2b533c){if(_0x2b533c){return _0x339be0[_0x2dab('0x25')](_0x4768e2);}return _0x339be0[_0x2dab('0x26')](_0x4768e2)['end']();};}function respondWithResult(_0x569eee,_0x5e3d2f){_0x5e3d2f=_0x5e3d2f||0xc8;return function(_0x1d2f90){if(_0x1d2f90){return _0x569eee[_0x2dab('0x26')](_0x5e3d2f)[_0x2dab('0x27')](_0x1d2f90);}};}function respondWithFilteredResult(_0x44abf0,_0x135155){return function(_0x210987){if(_0x210987){var _0x1972c0=typeof _0x135155[_0x2dab('0x28')]===_0x2dab('0x29')&&typeof _0x135155[_0x2dab('0x2a')]===_0x2dab('0x29');var _0x4f2d41=_0x210987[_0x2dab('0x2b')];var _0x1097fb=_0x1972c0?0x0:_0x135155[_0x2dab('0x28')];var _0x5d21d0=_0x1972c0?_0x210987[_0x2dab('0x2b')]:_0x135155[_0x2dab('0x28')]+_0x135155[_0x2dab('0x2a')];var _0x15a61e;if(_0x5d21d0>=_0x4f2d41){_0x5d21d0=_0x4f2d41;_0x15a61e=0xc8;}else{_0x15a61e=0xce;}_0x44abf0[_0x2dab('0x26')](_0x15a61e);return _0x44abf0[_0x2dab('0x2c')](_0x2dab('0x2d'),_0x1097fb+'-'+_0x5d21d0+'/'+_0x4f2d41)[_0x2dab('0x27')](_0x210987);}return null;};}function patchUpdates(_0x3d45bc){return function(_0x391010){try{jsonpatch['apply'](_0x391010,_0x3d45bc,!![]);}catch(_0x40bebd){return BPromise[_0x2dab('0x2e')](_0x40bebd);}return _0x391010[_0x2dab('0x2f')]();};}function saveUpdates(_0x5c13ad,_0x1ab2b9){return function(_0x1bb2e7){if(_0x1bb2e7){return _0x1bb2e7[_0x2dab('0x30')](_0x5c13ad)[_0x2dab('0x1a')](function(_0x4d6a61){return _0x4d6a61;});}return null;};}function removeEntity(_0x3d178a,_0x29470f){return function(_0x335b00){if(_0x335b00){return _0x335b00['destroy']()[_0x2dab('0x1a')](function(){var _0xb39430=_0x335b00[_0x2dab('0x31')]({'plain':!![]});var _0x525870='WhatsappAccounts';return db[_0x2dab('0x32')]['destroy']({'where':{'type':_0x525870,'resourceId':_0xb39430['id']}})[_0x2dab('0x1a')](function(){return _0x335b00;});})[_0x2dab('0x1a')](function(){_0x3d178a[_0x2dab('0x26')](0xcc)[_0x2dab('0x33')]();});}};}function handleEntityNotFound(_0x2c1108,_0x2dfc6a){return function(_0x216cee){if(!_0x216cee){_0x2c1108[_0x2dab('0x25')](0x194);}return _0x216cee;};}function handleError(_0x3edc37,_0x43f7a4){_0x43f7a4=_0x43f7a4||0x1f4;return function(_0x124776){logger[_0x2dab('0x21')](_0x124776['stack']);if(_0x124776[_0x2dab('0x34')]){delete _0x124776['name'];}_0x3edc37['status'](_0x43f7a4)[_0x2dab('0x35')](_0x124776);};}exports[_0x2dab('0x36')]=function(_0x3e9bff,_0xbcfd7a){var _0x3e935d={'include':[{'model':db[_0x2dab('0x37')],'as':_0x2dab('0x38')}]},_0x4da904={},_0x67e427={'count':0x0,'rows':[]};var _0x1ec93a=_['map'](db[_0x2dab('0x39')][_0x2dab('0x3a')],function(_0x1f6b86){return{'name':_0x1f6b86[_0x2dab('0x3b')],'type':_0x1f6b86['type'][_0x2dab('0x3c')]};});_0x4da904[_0x2dab('0x3d')]=_['map'](_0x1ec93a,_0x2dab('0x34'));_0x4da904[_0x2dab('0x3e')]=_[_0x2dab('0x3f')](_0x3e9bff[_0x2dab('0x3e')]);_0x4da904['filters']=_[_0x2dab('0x40')](_0x4da904[_0x2dab('0x3d')],_0x4da904[_0x2dab('0x3e')]);_0x3e935d[_0x2dab('0x41')]=_[_0x2dab('0x40')](_0x4da904[_0x2dab('0x3d')],qs[_0x2dab('0x42')](_0x3e9bff[_0x2dab('0x3e')][_0x2dab('0x42')]));_0x3e935d[_0x2dab('0x41')]=_0x3e935d[_0x2dab('0x41')][_0x2dab('0x43')]?_0x3e935d[_0x2dab('0x41')]:_0x4da904[_0x2dab('0x3d')];if(!_0x3e9bff[_0x2dab('0x3e')]['hasOwnProperty']('nolimit')){_0x3e935d[_0x2dab('0x2a')]=qs[_0x2dab('0x2a')](_0x3e9bff[_0x2dab('0x3e')][_0x2dab('0x2a')]);_0x3e935d[_0x2dab('0x28')]=qs[_0x2dab('0x28')](_0x3e9bff['query'][_0x2dab('0x28')]);}_0x3e935d[_0x2dab('0x44')]=qs[_0x2dab('0x45')](_0x3e9bff[_0x2dab('0x3e')]['sort']);_0x3e935d[_0x2dab('0x46')]=qs[_0x2dab('0x47')](_[_0x2dab('0x48')](_0x3e9bff[_0x2dab('0x3e')],_0x4da904[_0x2dab('0x47')]),_0x1ec93a);if(_0x3e9bff[_0x2dab('0x3e')][_0x2dab('0x49')]){_0x3e935d[_0x2dab('0x46')]=_[_0x2dab('0x4a')](_0x3e935d[_0x2dab('0x46')],{'$or':_[_0x2dab('0x4b')](_0x1ec93a,function(_0x1e8124){if(_0x1e8124[_0x2dab('0x4c')]!==_0x2dab('0x4d')){var _0x184cfe={};_0x184cfe[_0x1e8124['name']]={'$like':'%'+_0x3e9bff[_0x2dab('0x3e')][_0x2dab('0x49')]+'%'};return _0x184cfe;}})});}_0x3e935d=_['merge']({},_0x3e935d,_0x3e9bff[_0x2dab('0x4e')]);var _0x370cbe={'where':_0x3e935d[_0x2dab('0x46')]};return db[_0x2dab('0x39')][_0x2dab('0x2b')](_0x370cbe)[_0x2dab('0x1a')](function(_0x587043){_0x67e427[_0x2dab('0x2b')]=_0x587043;if(_0x3e9bff[_0x2dab('0x3e')]['includeAll']){_0x3e935d[_0x2dab('0x4f')]=[{'all':!![]}];}return db[_0x2dab('0x39')][_0x2dab('0x50')](_0x3e935d);})['then'](function(_0x5e0e70){_0x67e427['rows']=_0x5e0e70;return _0x67e427;})[_0x2dab('0x1a')](respondWithFilteredResult(_0xbcfd7a,_0x3e935d))[_0x2dab('0x24')](handleError(_0xbcfd7a,null));};exports[_0x2dab('0x51')]=function(_0x971f61,_0x2265f1){var _0x4ad717={'raw':![],'where':{'id':_0x971f61[_0x2dab('0x52')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x482573={};_0x482573['model']=_[_0x2dab('0x3f')](db[_0x2dab('0x39')][_0x2dab('0x3a')]);_0x482573[_0x2dab('0x3e')]=_[_0x2dab('0x3f')](_0x971f61['query']);_0x482573[_0x2dab('0x47')]=_[_0x2dab('0x40')](_0x482573['model'],_0x482573[_0x2dab('0x3e')]);_0x4ad717[_0x2dab('0x41')]=_[_0x2dab('0x40')](_0x482573['model'],qs[_0x2dab('0x42')](_0x971f61[_0x2dab('0x3e')][_0x2dab('0x42')]));_0x4ad717[_0x2dab('0x41')]=_0x4ad717[_0x2dab('0x41')][_0x2dab('0x43')]?_0x4ad717[_0x2dab('0x41')]:_0x482573['model'];if(_0x971f61[_0x2dab('0x3e')][_0x2dab('0x53')]){_0x4ad717[_0x2dab('0x4f')]=[{'all':!![]}];}_0x4ad717=_[_0x2dab('0x4a')]({},_0x4ad717,_0x971f61[_0x2dab('0x4e')]);return db['WhatsappAccount'][_0x2dab('0x54')](_0x4ad717)[_0x2dab('0x1a')](handleEntityNotFound(_0x2265f1,null))['then'](respondWithResult(_0x2265f1,null))['catch'](handleError(_0x2265f1,null));};exports[_0x2dab('0x55')]=function(_0x432a8e,_0x47cb33){return db[_0x2dab('0x39')][_0x2dab('0x55')](_0x432a8e['body'],{})[_0x2dab('0x1a')](function(_0x2b4f73){var _0x1fe10e=_0x432a8e[_0x2dab('0x56')][_0x2dab('0x31')]({'plain':!![]});if(!_0x1fe10e)throw new Error(_0x2dab('0x57'));if(_0x1fe10e[_0x2dab('0x58')]==='user'){var _0x4d9b6e=_0x2b4f73[_0x2dab('0x31')]({'plain':!![]});var _0x447a5f=_0x2dab('0x59');return db['UserProfileSection']['find']({'where':{'name':_0x447a5f,'userProfileId':_0x1fe10e[_0x2dab('0x5a')]},'raw':!![]})[_0x2dab('0x1a')](function(_0x2d29fd){if(_0x2d29fd&&_0x2d29fd[_0x2dab('0x5b')]===0x0){return db[_0x2dab('0x32')]['create']({'name':_0x4d9b6e[_0x2dab('0x34')],'resourceId':_0x4d9b6e['id'],'type':_0x2d29fd[_0x2dab('0x34')],'sectionId':_0x2d29fd['id']},{})[_0x2dab('0x1a')](function(){return _0x2b4f73;});}else{return _0x2b4f73;}})['catch'](function(_0x4070ae){logger[_0x2dab('0x21')](_0x2dab('0x5c'),_0x4070ae);throw _0x4070ae;});}return _0x2b4f73;})[_0x2dab('0x1a')](respondWithResult(_0x47cb33,0xc9))[_0x2dab('0x24')](handleError(_0x47cb33,null));};exports[_0x2dab('0x30')]=function(_0x3c1ea1,_0x43182f){if(_0x3c1ea1[_0x2dab('0x5d')]['id']){delete _0x3c1ea1[_0x2dab('0x5d')]['id'];}return db['WhatsappAccount'][_0x2dab('0x54')]({'where':{'id':_0x3c1ea1[_0x2dab('0x52')]['id']},'include':[{'model':db[_0x2dab('0x37')],'as':_0x2dab('0x38')}]})[_0x2dab('0x1a')](handleEntityNotFound(_0x43182f,null))['then'](saveUpdates(_0x3c1ea1[_0x2dab('0x5d')],null))[_0x2dab('0x1a')](respondWithResult(_0x43182f,null))[_0x2dab('0x24')](handleError(_0x43182f,null));};exports[_0x2dab('0x5e')]=function(_0x570cb2,_0x2cda34){return db[_0x2dab('0x39')]['find']({'where':{'id':_0x570cb2[_0x2dab('0x52')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x2cda34,null))[_0x2dab('0x1a')](removeEntity(_0x2cda34,null))[_0x2dab('0x24')](handleError(_0x2cda34,null));};exports[_0x2dab('0x5f')]=function(_0x14fa89,_0x1d7937){return db['WhatsappAccount'][_0x2dab('0x5f')]()[_0x2dab('0x1a')](respondWithResult(_0x1d7937,null))['catch'](handleError(_0x1d7937,null));};exports[_0x2dab('0x60')]=function(_0x109941,_0x2f6374,_0x2a4e0a){if(_0x109941['body']['id']){delete _0x109941['body']['id'];}return db[_0x2dab('0x39')][_0x2dab('0x54')]({'where':{'id':_0x109941['params']['id']}})['then'](handleEntityNotFound(_0x2f6374,null))['then'](function(_0x11c68b){if(_0x11c68b){_0x109941[_0x2dab('0x5d')][_0x2dab('0x61')]=_0x11c68b['id'];return db[_0x2dab('0x62')][_0x2dab('0x55')](_0x109941[_0x2dab('0x5d')]);}})[_0x2dab('0x1a')](respondWithResult(_0x2f6374,null))[_0x2dab('0x24')](handleError(_0x2f6374,null));};exports[_0x2dab('0x63')]=function(_0x3d404a,_0x4d78fb,_0x5dac11){var _0x40794f={'raw':![],'where':{}};var _0x5afad2={};var _0x3caf75={'count':0x0,'rows':[]};return db[_0x2dab('0x39')]['findOne']({'where':{'id':_0x3d404a[_0x2dab('0x52')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x4d78fb,null))[_0x2dab('0x1a')](function(_0x1ac203){if(_0x1ac203){_0x5afad2[_0x2dab('0x3d')]=_['keys'](db[_0x2dab('0x62')][_0x2dab('0x3a')]);_0x5afad2[_0x2dab('0x3e')]=_[_0x2dab('0x3f')](_0x3d404a[_0x2dab('0x3e')]);_0x5afad2[_0x2dab('0x47')]=_[_0x2dab('0x40')](_0x5afad2['model'],_0x5afad2['query']);_0x40794f[_0x2dab('0x41')]=_[_0x2dab('0x40')](_0x5afad2[_0x2dab('0x3d')],qs['fields'](_0x3d404a[_0x2dab('0x3e')]['fields']));_0x40794f['attributes']=_0x40794f[_0x2dab('0x41')]['length']?_0x40794f[_0x2dab('0x41')]:_0x5afad2[_0x2dab('0x3d')];if(!_0x3d404a[_0x2dab('0x3e')][_0x2dab('0x64')](_0x2dab('0x65'))){_0x40794f['limit']=qs[_0x2dab('0x2a')](_0x3d404a[_0x2dab('0x3e')][_0x2dab('0x2a')]);_0x40794f[_0x2dab('0x28')]=qs['offset'](_0x3d404a['query']['offset']);}_0x40794f['order']=qs[_0x2dab('0x45')](_0x3d404a[_0x2dab('0x3e')]['sort']);_0x40794f[_0x2dab('0x46')]=qs[_0x2dab('0x47')](_[_0x2dab('0x48')](_0x3d404a[_0x2dab('0x3e')],_0x5afad2['filters']));_0x40794f[_0x2dab('0x46')][_0x2dab('0x61')]=_0x1ac203['id'];if(_0x3d404a[_0x2dab('0x3e')][_0x2dab('0x49')]){_0x40794f[_0x2dab('0x46')]=_[_0x2dab('0x4a')](_0x40794f[_0x2dab('0x46')],{'$or':_[_0x2dab('0x4b')](_0x40794f[_0x2dab('0x41')],function(_0x2d18ea){var _0x520244={};_0x520244[_0x2d18ea]={'$like':'%'+_0x3d404a[_0x2dab('0x3e')][_0x2dab('0x49')]+'%'};return _0x520244;})});}_0x40794f=_['merge']({},_0x40794f,_0x3d404a[_0x2dab('0x4e')]);return db[_0x2dab('0x62')][_0x2dab('0x2b')]({'where':_0x40794f['where']})[_0x2dab('0x1a')](function(_0x5e93b6){_0x3caf75['count']=_0x5e93b6;if(_0x3d404a[_0x2dab('0x3e')][_0x2dab('0x53')]){_0x40794f[_0x2dab('0x4f')]=[{'all':!![]}];}return db[_0x2dab('0x62')][_0x2dab('0x50')](_0x40794f);})[_0x2dab('0x1a')](function(_0x3ca28c){_0x3caf75[_0x2dab('0x66')]=_0x3ca28c;return _0x3caf75;});}})[_0x2dab('0x1a')](respondWithFilteredResult(_0x4d78fb,_0x40794f))[_0x2dab('0x24')](handleError(_0x4d78fb,null));};exports[_0x2dab('0x67')]=function(_0x101274,_0x5221b0,_0x51fc3c){return db[_0x2dab('0x39')][_0x2dab('0x54')]({'where':{'id':_0x101274[_0x2dab('0x52')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x5221b0,null))['then'](function(_0x4f371d){if(_0x4f371d){return _0x4f371d[_0x2dab('0x67')](_0x101274[_0x2dab('0x3e')][_0x2dab('0x68')]);}})[_0x2dab('0x1a')](respondWithStatusCode(_0x5221b0,null))['catch'](handleError(_0x5221b0,null));};exports[_0x2dab('0x69')]=function(_0x2c7bf8,_0x2a96c9,_0x29bcae){if(_0x2c7bf8[_0x2dab('0x5d')]['id']){delete _0x2c7bf8[_0x2dab('0x5d')]['id'];}return db[_0x2dab('0x39')][_0x2dab('0x54')]({'where':{'id':_0x2c7bf8[_0x2dab('0x52')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x2a96c9,null))['then'](function(_0x1403ae){if(_0x1403ae){_0x2c7bf8[_0x2dab('0x5d')][_0x2dab('0x61')]=_0x1403ae['id'];return db[_0x2dab('0x6a')][_0x2dab('0x55')](_0x2c7bf8[_0x2dab('0x5d')]);}})[_0x2dab('0x1a')](respondWithResult(_0x2a96c9,null))['catch'](handleError(_0x2a96c9,null));};exports[_0x2dab('0x6b')]=function(_0x4cfcab,_0x385786,_0x568230){var _0x3f8753={'raw':![],'where':{}};var _0x385288={};var _0x24149b={'count':0x0,'rows':[]};return db[_0x2dab('0x39')][_0x2dab('0x6c')]({'where':{'id':_0x4cfcab['params']['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x385786,null))[_0x2dab('0x1a')](function(_0x3ab8ba){if(_0x3ab8ba){_0x385288['model']=_['keys'](db[_0x2dab('0x6a')][_0x2dab('0x3a')]);_0x385288[_0x2dab('0x3e')]=_[_0x2dab('0x3f')](_0x4cfcab['query']);_0x385288['filters']=_[_0x2dab('0x40')](_0x385288[_0x2dab('0x3d')],_0x385288[_0x2dab('0x3e')]);_0x3f8753[_0x2dab('0x41')]=_[_0x2dab('0x40')](_0x385288['model'],qs[_0x2dab('0x42')](_0x4cfcab[_0x2dab('0x3e')][_0x2dab('0x42')]));_0x3f8753[_0x2dab('0x41')]=_0x3f8753[_0x2dab('0x41')][_0x2dab('0x43')]?_0x3f8753[_0x2dab('0x41')]:_0x385288[_0x2dab('0x3d')];if(!_0x4cfcab[_0x2dab('0x3e')][_0x2dab('0x64')]('nolimit')){_0x3f8753[_0x2dab('0x2a')]=qs[_0x2dab('0x2a')](_0x4cfcab[_0x2dab('0x3e')][_0x2dab('0x2a')]);_0x3f8753[_0x2dab('0x28')]=qs[_0x2dab('0x28')](_0x4cfcab[_0x2dab('0x3e')]['offset']);}_0x3f8753[_0x2dab('0x44')]=qs[_0x2dab('0x45')](_0x4cfcab[_0x2dab('0x3e')]['sort']);_0x3f8753['where']=qs['filters'](_[_0x2dab('0x48')](_0x4cfcab[_0x2dab('0x3e')],_0x385288[_0x2dab('0x47')]));_0x3f8753['where'][_0x2dab('0x61')]=_0x3ab8ba['id'];if(_0x4cfcab['query']['filter']){_0x3f8753[_0x2dab('0x46')]=_['merge'](_0x3f8753[_0x2dab('0x46')],{'$or':_[_0x2dab('0x4b')](_0x3f8753['attributes'],function(_0x16e776){var _0x45ecaa={};_0x45ecaa[_0x16e776]={'$like':'%'+_0x4cfcab[_0x2dab('0x3e')]['filter']+'%'};return _0x45ecaa;})});}_0x3f8753=_['merge']({},_0x3f8753,_0x4cfcab[_0x2dab('0x4e')]);return db['CannedAnswer'][_0x2dab('0x2b')]({'where':_0x3f8753[_0x2dab('0x46')]})[_0x2dab('0x1a')](function(_0x35ebb4){_0x24149b['count']=_0x35ebb4;if(_0x4cfcab[_0x2dab('0x3e')][_0x2dab('0x53')]){_0x3f8753[_0x2dab('0x4f')]=[{'all':!![]}];}return db[_0x2dab('0x6a')]['findAll'](_0x3f8753);})[_0x2dab('0x1a')](function(_0x1609b0){_0x24149b[_0x2dab('0x66')]=_0x1609b0;return _0x24149b;});}})[_0x2dab('0x1a')](respondWithFilteredResult(_0x385786,_0x3f8753))[_0x2dab('0x24')](handleError(_0x385786,null));};exports[_0x2dab('0x6d')]=function(_0x5e8975,_0x136106,_0x358661){return db[_0x2dab('0x39')][_0x2dab('0x54')]({'where':{'id':_0x5e8975['params']['id']}})['then'](handleEntityNotFound(_0x136106,null))[_0x2dab('0x1a')](function(_0x4b03a2){if(_0x4b03a2){return _0x4b03a2[_0x2dab('0x6d')](_0x5e8975['query']['ids']);}})[_0x2dab('0x1a')](respondWithStatusCode(_0x136106,null))[_0x2dab('0x24')](handleError(_0x136106,null));};exports[_0x2dab('0x6e')]=function(_0x26c84a,_0x2b983f,_0xdcdf4a){return db[_0x2dab('0x39')][_0x2dab('0x54')]({'where':{'id':_0x26c84a['params']['id']}})['then'](handleEntityNotFound(_0x2b983f,null))[_0x2dab('0x1a')](function(_0x348c7c){if(_0x348c7c){return _0x348c7c[_0x2dab('0x6e')](_0x26c84a['body'][_0x2dab('0x68')],_[_0x2dab('0x6f')](_0x26c84a[_0x2dab('0x5d')],[_0x2dab('0x68'),'id'])||{})[_0x2dab('0x70')](function(_0x217420){for(var _0x43e6b2=0x0;_0x43e6b2<_0x26c84a[_0x2dab('0x5d')]['ids'][_0x2dab('0x43')];_0x43e6b2+=0x1){socket[_0x2dab('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x26c84a['body'][_0x2dab('0x68')][_0x43e6b2]),'WhatsappAccountId':Number(_0x26c84a[_0x2dab('0x52')]['id'])});}return _0x217420;});}})[_0x2dab('0x1a')](respondWithResult(_0x2b983f,null))[_0x2dab('0x24')](handleError(_0x2b983f,null));};exports[_0x2dab('0x72')]=function(_0xcbddbc,_0x570615,_0xdca269){return db[_0x2dab('0x39')][_0x2dab('0x54')]({'where':{'id':_0xcbddbc[_0x2dab('0x52')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x570615,null))[_0x2dab('0x1a')](function(_0x1f199a){if(_0x1f199a){return _0x1f199a[_0x2dab('0x72')](_0xcbddbc['query'][_0x2dab('0x68')])[_0x2dab('0x1a')](function(){if(_[_0x2dab('0x73')](_0xcbddbc[_0x2dab('0x3e')][_0x2dab('0x68')])){for(var _0x20f12a=0x0;_0x20f12a<_0xcbddbc[_0x2dab('0x3e')]['ids'][_0x2dab('0x43')];_0x20f12a+=0x1){socket[_0x2dab('0x71')](_0x2dab('0x74'),{'UserId':Number(_0xcbddbc['query'][_0x2dab('0x68')][_0x20f12a]),'WhatsappAccountId':Number(_0xcbddbc['params']['id'])});}}else{socket[_0x2dab('0x71')](_0x2dab('0x74'),{'UserId':Number(_0xcbddbc[_0x2dab('0x3e')][_0x2dab('0x68')]),'WhatsappAccountId':Number(_0xcbddbc[_0x2dab('0x52')]['id'])});}});}})[_0x2dab('0x1a')](respondWithStatusCode(_0x570615,null))[_0x2dab('0x24')](handleError(_0x570615,null));};exports[_0x2dab('0x75')]=function(_0x1cc9e1,_0x387205,_0x1b3371){var _0x386616={};var _0x30875a={};var _0x509fd6;var _0x176ee4;return db[_0x2dab('0x39')]['findOne']({'where':{'id':_0x1cc9e1[_0x2dab('0x52')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x387205,null))[_0x2dab('0x1a')](function(_0x38c618){if(_0x38c618){_0x509fd6=_0x38c618;_0x30875a['model']=_[_0x2dab('0x3f')](db[_0x2dab('0x76')][_0x2dab('0x3a')]);_0x30875a[_0x2dab('0x3e')]=_['keys'](_0x1cc9e1['query']);_0x30875a[_0x2dab('0x47')]=_['intersection'](_0x30875a[_0x2dab('0x3d')],_0x30875a['query']);_0x386616['attributes']=_['intersection'](_0x30875a['model'],qs['fields'](_0x1cc9e1[_0x2dab('0x3e')][_0x2dab('0x42')]));_0x386616[_0x2dab('0x41')]=_0x386616[_0x2dab('0x41')][_0x2dab('0x43')]?_0x386616[_0x2dab('0x41')]:_0x30875a[_0x2dab('0x3d')];_0x386616[_0x2dab('0x44')]=qs['sort'](_0x1cc9e1[_0x2dab('0x3e')][_0x2dab('0x45')]);_0x386616[_0x2dab('0x46')]=qs[_0x2dab('0x47')](_[_0x2dab('0x48')](_0x1cc9e1[_0x2dab('0x3e')],_0x30875a[_0x2dab('0x47')]));if(_0x1cc9e1['query'][_0x2dab('0x49')]){_0x386616[_0x2dab('0x46')]=_['merge'](_0x386616[_0x2dab('0x46')],{'$or':_[_0x2dab('0x4b')](_0x386616['attributes'],function(_0x523e66){var _0x1f073b={};_0x1f073b[_0x523e66]={'$like':'%'+_0x1cc9e1[_0x2dab('0x3e')][_0x2dab('0x49')]+'%'};return _0x1f073b;})});}_0x386616=_[_0x2dab('0x4a')]({},_0x386616,_0x1cc9e1['options']);return _0x509fd6[_0x2dab('0x75')](_0x386616);}})['then'](function(_0x2ea8b3){if(_0x2ea8b3){_0x176ee4=_0x2ea8b3['length'];if(!_0x1cc9e1[_0x2dab('0x3e')][_0x2dab('0x64')](_0x2dab('0x65'))){_0x386616[_0x2dab('0x2a')]=qs[_0x2dab('0x2a')](_0x1cc9e1[_0x2dab('0x3e')][_0x2dab('0x2a')]);_0x386616[_0x2dab('0x28')]=qs[_0x2dab('0x28')](_0x1cc9e1['query'][_0x2dab('0x28')]);}return _0x509fd6[_0x2dab('0x75')](_0x386616);}})['then'](function(_0x15ed90){if(_0x15ed90){return _0x15ed90?{'count':_0x176ee4,'rows':_0x15ed90}:null;}})['then'](respondWithResult(_0x387205,null))[_0x2dab('0x24')](handleError(_0x387205,null));};exports[_0x2dab('0x77')]=function(_0x48ed7c,_0xef81ba){var _0x535428=_0x48ed7c['params']['id'];var _0x58755b=_0x48ed7c[_0x2dab('0x5d')];var _0x424b07=0xc8;var _0x1a6820=null;return db['sequelize'][_0x2dab('0x78')]({'isolationLevel':db[_0x2dab('0x79')]['Transaction']['ISOLATION_LEVELS'][_0x2dab('0x7a')]},function(_0x3a225b){return db[_0x2dab('0x39')][_0x2dab('0x6c')]({'where':{'id':_0x535428},'transaction':_0x3a225b})[_0x2dab('0x1a')](function(_0x53f0a1){if(_0x53f0a1){return db[_0x2dab('0x7b')][_0x2dab('0x5e')]({'where':{'WhatsappAccountId':_0x535428},'transaction':_0x3a225b})['then'](function(){var _0x20da22=_[_0x2dab('0x4b')](_0x58755b,function(_0x1a8bfe){_0x1a8bfe['WhatsappAccountId']=_0x535428;return _0x1a8bfe;});return db[_0x2dab('0x7b')][_0x2dab('0x7c')](_0x20da22,{'transaction':_0x3a225b});});}else{_0x424b07=0x194;_0x1a6820=[];}});})[_0x2dab('0x1a')](function(){if(_0x424b07!==0x194){return db[_0x2dab('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x535428},'order':_0x2dab('0x7d')})[_0x2dab('0x1a')](function(_0x42f5f0){_0x1a6820=_0x42f5f0;});}})[_0x2dab('0x24')](function(_0x2dc073){_0x424b07=0x1f4;logger['error'](_0x2dc073[_0x2dab('0x7e')]);if(_0x2dc073[_0x2dab('0x34')]){delete _0x2dc073[_0x2dab('0x34')];}_0x1a6820=_0x2dc073;})[_0x2dab('0x7f')](function(){if(_0x1a6820===null){_0xef81ba[_0x2dab('0x25')](_0x424b07);}else{if(_0x424b07===0x1f4){_0xef81ba[_0x2dab('0x26')](_0x424b07)[_0x2dab('0x35')](_0x1a6820);}else{_0xef81ba[_0x2dab('0x26')](_0x424b07)[_0x2dab('0x27')](_0x1a6820);}}});};exports[_0x2dab('0x80')]=function(_0x1bce55,_0x28ed7b,_0x33db9c){var _0x172834={};var _0x3f5865={};var _0x559148;var _0x5477b2;return db[_0x2dab('0x39')][_0x2dab('0x6c')]({'where':{'id':_0x1bce55[_0x2dab('0x52')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x28ed7b,null))[_0x2dab('0x1a')](function(_0x43b4a3){if(_0x43b4a3){_0x559148=_0x43b4a3;_0x3f5865[_0x2dab('0x3d')]=_[_0x2dab('0x3f')](db[_0x2dab('0x7b')][_0x2dab('0x3a')]);_0x3f5865['query']=_[_0x2dab('0x3f')](_0x1bce55[_0x2dab('0x3e')]);_0x3f5865[_0x2dab('0x47')]=_['intersection'](_0x3f5865[_0x2dab('0x3d')],_0x3f5865[_0x2dab('0x3e')]);_0x172834['attributes']=_[_0x2dab('0x40')](_0x3f5865[_0x2dab('0x3d')],qs[_0x2dab('0x42')](_0x1bce55['query'][_0x2dab('0x42')]));_0x172834[_0x2dab('0x41')]=_0x172834['attributes'][_0x2dab('0x43')]?_0x172834[_0x2dab('0x41')]:_0x3f5865[_0x2dab('0x3d')];_0x172834[_0x2dab('0x44')]=qs[_0x2dab('0x45')](_0x1bce55[_0x2dab('0x3e')][_0x2dab('0x45')]);_0x172834['where']=qs[_0x2dab('0x47')](_['pick'](_0x1bce55[_0x2dab('0x3e')],_0x3f5865[_0x2dab('0x47')]));if(_0x1bce55['query']['filter']){_0x172834[_0x2dab('0x46')]=_[_0x2dab('0x4a')](_0x172834[_0x2dab('0x46')],{'$or':_[_0x2dab('0x4b')](_0x172834[_0x2dab('0x41')],function(_0x5b69b7){var _0x189854={};_0x189854[_0x5b69b7]={'$like':'%'+_0x1bce55[_0x2dab('0x3e')][_0x2dab('0x49')]+'%'};return _0x189854;})});}_0x172834=_[_0x2dab('0x4a')]({},_0x172834,_0x1bce55[_0x2dab('0x4e')]);return _0x559148[_0x2dab('0x80')](_0x172834);}})['then'](function(_0x25f55f){if(_0x25f55f){_0x5477b2=_0x25f55f[_0x2dab('0x43')];if(!_0x1bce55[_0x2dab('0x3e')]['hasOwnProperty'](_0x2dab('0x65'))){_0x172834['limit']=qs[_0x2dab('0x2a')](_0x1bce55[_0x2dab('0x3e')][_0x2dab('0x2a')]);_0x172834[_0x2dab('0x28')]=qs[_0x2dab('0x28')](_0x1bce55['query'][_0x2dab('0x28')]);}return _0x559148[_0x2dab('0x80')](_0x172834);}})[_0x2dab('0x1a')](function(_0x1f79bb){if(_0x1f79bb){return _0x1f79bb?{'count':_0x5477b2,'rows':_0x1f79bb}:null;}})[_0x2dab('0x1a')](respondWithResult(_0x28ed7b,null))[_0x2dab('0x24')](handleError(_0x28ed7b,null));};exports[_0x2dab('0x81')]=function(_0x155c35,_0x270cfb,_0x419db5){var _0x19aa7b={'channel':_0x2dab('0x82')};var _0x53913d=[];var _0x406c53=[];var _0x1ade3c={};return db[_0x2dab('0x39')]['find']({'where':{'id':_0x155c35[_0x2dab('0x52')]['id']},'include':[{'model':db[_0x2dab('0x7b')],'as':_0x2dab('0x83')}]})['then'](handleEntityNotFound(_0x270cfb,null))[_0x2dab('0x1a')](function(_0x25fc5c){_0x19aa7b[_0x2dab('0x84')]=_0x25fc5c;if(_0x19aa7b[_0x2dab('0x84')]&&_0x19aa7b['account'][_0x2dab('0x4c')]===_0x2dab('0x85')&&_0x155c35[_0x2dab('0x5d')][_0x2dab('0x86')]){if(_0x155c35[_0x2dab('0x5d')]['statuses']['length']===0x0)return;if(_0x155c35['body'][_0x2dab('0x86')][0x0][_0x2dab('0x87')]!=='read')return;return db[_0x2dab('0x88')][_0x2dab('0x30')]({'read':!![],'readAt':_0x155c35['body']['statuses'][0x0][_0x2dab('0x89')]},{'where':{'messageId':_0x155c35['body'][_0x2dab('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x2dab('0x1a')](function(_0x33d448){return _0x270cfb[_0x2dab('0x26')](0xc8)['json'](_0x33d448);});}_0x19aa7b['applications']=_[_0x2dab('0x8a')](_0x25fc5c[_0x2dab('0x83')],[_0x2dab('0x7d')],[_0x2dab('0x8b')]);if(_0x19aa7b[_0x2dab('0x84')]['Applications']){delete _0x19aa7b[_0x2dab('0x84')][_0x2dab('0x83')];}return db[_0x2dab('0x8c')]['describe']()[_0x2dab('0x1a')](function(_0x16417f){if(!_0x16417f){throw new db['Sequelize']['ValidationError'](_0x2dab('0x8d'));}_0x53913d=_['difference'](_[_0x2dab('0x3f')](_0x16417f),[_0x2dab('0x8e'),_0x2dab('0x8f')]);_0x406c53=_[_0x2dab('0x90')](_[_0x2dab('0x3f')](_0x16417f),[_0x2dab('0x8e'),_0x2dab('0x8f'),_0x2dab('0x91'),_0x2dab('0x92')]);_0x19aa7b[_0x2dab('0x5d')]={'mapKey':_0x2dab('0x93')};if(_0x19aa7b[_0x2dab('0x84')]&&_0x19aa7b[_0x2dab('0x84')][_0x2dab('0x4c')]===_0x2dab('0x94')){_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x95')]=_0x155c35[_0x2dab('0x5d')][_0x2dab('0x96')]['replace'](_0x2dab('0x97'),'');_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x5d')]=_0x155c35[_0x2dab('0x5d')][_0x2dab('0x98')];_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x99')]=_0x155c35[_0x2dab('0x5d')][_0x2dab('0x9a')];}if(_0x19aa7b['account']&&_0x19aa7b['account'][_0x2dab('0x4c')]===_0x2dab('0x85')){_0x19aa7b['body'][_0x2dab('0x95')]=_0x155c35[_0x2dab('0x5d')][_0x2dab('0x9b')][0x0]['from'];_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x5d')]=_0x155c35[_0x2dab('0x5d')][_0x2dab('0x9b')][0x0]['message'][_0x2dab('0x5d')];_0x19aa7b[_0x2dab('0x5d')]['messageId']=_0x155c35[_0x2dab('0x5d')][_0x2dab('0x9b')][0x0][_0x2dab('0x9c')];}if(_0x19aa7b[_0x2dab('0x5d')]['id']){delete _0x19aa7b['body']['id'];}if(_['isNil'](_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x95')])){throw new db['Sequelize'][(_0x2dab('0x9d'))](_0x2dab('0x9e'));}if(_[_0x2dab('0x9f')](_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x5d')])||_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x5d')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0xa0')])){throw new db[(_0x2dab('0xa1'))]['ValidationError'](_0x2dab('0xa2')+_0x406c53);}if(!_[_0x2dab('0xa3')](_0x406c53,_0x19aa7b['body'][_0x2dab('0xa0')])){throw new db[(_0x2dab('0xa1'))][(_0x2dab('0x9d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x406c53);}_0x1ade3c[_0x19aa7b['body'][_0x2dab('0xa0')]]=_0x19aa7b['body'][_0x2dab('0x95')];return db[_0x2dab('0xa4')]['find']({'where':{'id':_0x19aa7b[_0x2dab('0x84')]['ListId']},'include':[{'model':db[_0x2dab('0x8c')],'as':_0x2dab('0xa5'),'where':_0x1ade3c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x2dab('0x1a')](handleEntityNotFound(_0x270cfb,null))[_0x2dab('0x1a')](function(_0x38c061){if(_0x38c061){_0x19aa7b[_0x2dab('0xa6')]=_['omit'](_0x38c061,[_0x2dab('0xa5')]);if(_0x38c061[_0x2dab('0xa5')][_0x2dab('0x43')]){return _0x38c061['Contacts'][0x0];}var _0x388a81=_[_0x2dab('0x15')](_0x19aa7b[_0x2dab('0x5d')],{'firstName':_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x95')],'ListId':_0x38c061['id']});_0x388a81[_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0xa0')]]=_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x95')];return db[_0x2dab('0x8c')][_0x2dab('0x55')](_0x388a81,{'fields':_0x53913d,'raw':!![]});}})[_0x2dab('0x1a')](handleEntityNotFound(_0x270cfb,null))[_0x2dab('0x1a')](function(_0x574e14){if(_0x574e14){_0x19aa7b['contact']=_0x574e14;var _0x2aa3e1={'ContactId':_0x574e14['id'],'phone':_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x95')],'WhatsappAccountId':_0x155c35[_0x2dab('0x52')]['id']};var _0x487313={'ContactId':_0x574e14['id'],'WhatsappAccountId':_0x155c35[_0x2dab('0x52')]['id'],'closed':![]};return db[_0x2dab('0xa7')][_0x2dab('0x54')]({'where':_0x487313})[_0x2dab('0x1a')](function(_0x381092){if(_0x381092){return[_0x381092,![]];}return db[_0x2dab('0xa7')]['create'](_0x2aa3e1)[_0x2dab('0x1a')](function(_0x525514){return[_0x525514,!![]];});});}})[_0x2dab('0x70')](function(_0x16ce32,_0x524c68){_0x19aa7b[_0x2dab('0xa8')]=_0x16ce32['get']({'plain':!![]});_0x19aa7b['interaction'][_0x2dab('0xa9')]=![];if(_0x524c68){if(_0x19aa7b[_0x2dab('0x84')][_0x2dab('0xaa')]){_0x19aa7b[_0x2dab('0xab')][_0x2dab('0xac')]({'id':0x0,'priority':_0x19aa7b[_0x2dab('0xab')][_0x2dab('0x43')]+0x1,'app':'close','appdata':_0x2dab('0xad'),'interval':_0x2dab('0xae')});}_0x19aa7b[_0x2dab('0xa8')][_0x2dab('0xa9')]=!![];}return db[_0x2dab('0x88')][_0x2dab('0x55')]({'phone':_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x95')],'messageId':_0x19aa7b[_0x2dab('0x5d')]['messageId'],'body':_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0x5d')],'WhatsappAccountId':_0x155c35[_0x2dab('0x52')]['id'],'WhatsappInteractionId':_0x16ce32['id'],'direction':'in','ContactId':_0x16ce32[_0x2dab('0xaf')],'AttachmentId':_0x19aa7b[_0x2dab('0x5d')][_0x2dab('0xb0')]});})[_0x2dab('0x1a')](function(_0x3502e0){_0x19aa7b[_0x2dab('0x22')]=_0x3502e0;if(!_0x19aa7b[_0x2dab('0xa8')][_0x2dab('0xb1')])return;return db[_0x2dab('0x76')][_0x2dab('0x54')]({'attributes':['id',_0x2dab('0x34')],'where':{'id':_0x19aa7b[_0x2dab('0xa8')][_0x2dab('0xb1')]}});})['then'](function(_0x5e74a9){if(_0x5e74a9){_0x19aa7b['applications'][_0x2dab('0xb2')]({'id':0x0,'priority':0x0,'app':_0x2dab('0xb3'),'appdata':_0x5e74a9[_0x2dab('0x34')]+','+(_0x19aa7b[_0x2dab('0x84')][_0x2dab('0xb4')]||0xa),'interval':'*,*,*,*'});}if(!_0x19aa7b['interaction'][_0x2dab('0xb5')])return;return db[_0x2dab('0xb6')][_0x2dab('0x54')]({'attributes':['id',_0x2dab('0x34')],'where':{'id':_0x19aa7b['interaction'][_0x2dab('0xb5')]}});})[_0x2dab('0x1a')](function(_0x308bc5){if(_0x308bc5){_0x19aa7b['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x2dab('0xb7'),'appdata':_0x308bc5['name']+','+(_0x19aa7b[_0x2dab('0x84')][_0x2dab('0xb8')]||0x12c),'interval':_0x2dab('0xae')});}return respondWithRpcPromise(_0x2dab('0xb9'),_0x2dab('0xba'),_0x19aa7b);})['then'](function(_0x436350){if(_0x436350){var _0x10d6bc=0xc8;var _0x5dfc9d=_0x2dab('0xbb');logger[_0x2dab('0x1b')](_0x2dab('0x1f'),_0x5dfc9d,_0x10d6bc,_0x2dab('0xbc'));logger[_0x2dab('0x1e')](_0x2dab('0xbd'),_0x5dfc9d,_0x10d6bc,_0x2dab('0xbc'),JSON['stringify'](_0x436350));if(_0x19aa7b[_0x2dab('0x84')][_0x2dab('0x4c')]===_0x2dab('0x94')){return _0x270cfb[_0x2dab('0x26')](_0x10d6bc)['set']('Content-Type',_0x2dab('0xbe'))[_0x2dab('0x35')](_0x2dab('0xbf'));}else{return _0x270cfb['status'](_0x10d6bc)['json'](_0x436350);}}});})[_0x2dab('0x24')](handleError(_0x270cfb,null));};exports['send']=function(_0x5b3aa1,_0x141772,_0xee0d09){var _0x2b1a73,_0x43d898,_0x2d3e9f;if(_[_0x2dab('0x9f')](_0x5b3aa1[_0x2dab('0x5d')][_0x2dab('0x5d')])||_0x5b3aa1['body'][_0x2dab('0x5d')]===''){throw new db[(_0x2dab('0xa1'))][(_0x2dab('0x9d'))](_0x2dab('0xc0'));}if(_[_0x2dab('0x9f')](_0x5b3aa1['body']['to'])){throw new db['Sequelize'][(_0x2dab('0x9d'))](_0x2dab('0xc1'));}_0x2b1a73=_0x5b3aa1[_0x2dab('0x5d')]['to'];return db[_0x2dab('0x39')][_0x2dab('0x54')]({'where':{'id':_0x5b3aa1[_0x2dab('0x52')]['id']},'include':[{'model':db[_0x2dab('0xa4')],'as':_0x2dab('0xc2'),'include':[{'model':db['CmContact'],'as':_0x2dab('0xa5'),'where':{'mobile':_0x2b1a73},'limit':0x1,'order':[[_0x2dab('0x8f'),_0x2dab('0xc3')]]}]}]})['then'](handleEntityNotFound(_0x141772,null))[_0x2dab('0x1a')](function(_0x42512e){if(_0x42512e&&_0x42512e[_0x2dab('0xc2')]){_0x43d898=_0x42512e[_0x2dab('0x31')]({'plain':!![]});if(_0x43d898[_0x2dab('0xc2')]&&_0x43d898[_0x2dab('0xc2')][_0x2dab('0xa5')][_0x2dab('0x43')]){return _0x43d898['List']['Contacts'][0x0];}return db['CmContact'][_0x2dab('0x55')](_[_0x2dab('0x15')](_0x5b3aa1['body'],{'firstName':_0x2b1a73,'mobile':_0x2b1a73,'phone':_0x2b1a73,'ListId':_0x43d898[_0x2dab('0x92')]}));}})['then'](handleEntityNotFound(_0x141772,null))[_0x2dab('0x1a')](function(_0x1f6133){if(_0x1f6133){_0x2d3e9f=_0x1f6133;return db['WhatsappInteraction'][_0x2dab('0x54')]({'where':{'ContactId':_0x2d3e9f['id'],'closed':![],'WhatsappAccountId':_0x43d898['id']}})[_0x2dab('0x1a')](function(_0x2b6efc){if(_0x2b6efc){return[_0x2b6efc,![]];}return db[_0x2dab('0xa7')][_0x2dab('0x55')]({'UserId':_0x5b3aa1[_0x2dab('0x56')]['id'],'ContactId':_0x2d3e9f['id'],'WhatsappAccountId':_0x43d898['id'],'phone':_0x2b1a73,'firstMsgDirection':_0x2dab('0xc4'),'Messages':[_[_0x2dab('0x4a')](_0x5b3aa1['body'],{'read':![],'body':_0x5b3aa1[_0x2dab('0x5d')][_0x2dab('0x5d')],'phone':_0x2b1a73,'WhatsappAccountId':_0x43d898['id'],'UserId':_0x5b3aa1['user']['id'],'ContactId':_0x2d3e9f['id']})]},{'include':[{'model':db[_0x2dab('0x88')],'as':_0x2dab('0xc5')}]})['then'](function(_0x929958){return[_0x929958,!![]];});});}})['spread'](function(_0x90cb2e,_0x3eb063){if(_0x3eb063){return _0x90cb2e;}return db[_0x2dab('0x88')][_0x2dab('0x55')](_[_0x2dab('0x4a')](_0x5b3aa1['body'],{'read':![],'body':_0x5b3aa1['body'][_0x2dab('0x5d')],'phone':_0x2b1a73,'WhatsappAccountId':_0x43d898['id'],'WhatsappInteractionId':_0x90cb2e['id'],'UserId':_0x5b3aa1[_0x2dab('0x56')]['id'],'ContactId':_0x2d3e9f['id']}))[_0x2dab('0x1a')](function(_0x4fdc04){_0x90cb2e['dataValues'][_0x2dab('0xc5')]=[];_0x90cb2e[_0x2dab('0xc6')][_0x2dab('0xc5')][_0x2dab('0xac')](_0x4fdc04[_0x2dab('0xc6')]);return _0x90cb2e;});})[_0x2dab('0x1a')](respondWithResult(_0x141772,null))[_0x2dab('0x24')](handleError(_0x141772,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c92ba7b..ef83c9f 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 _0xa7c7=['WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c3908,_0x3da090){var _0x5c4ed6=function(_0x4b36ea){while(--_0x4b36ea){_0x1c3908['push'](_0x1c3908['shift']());}};_0x5c4ed6(++_0x3da090);}(_0xa7c7,0x1af));var _0x7a7c=function(_0x37d916,_0x3b41a4){_0x37d916=_0x37d916-0x0;var _0x17712a=_0xa7c7[_0x37d916];return _0x17712a;};'use strict';var EventEmitter=require(_0x7a7c('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x7a7c('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7a7c('0x2')](0x0);var events={'afterCreate':_0x7a7c('0x3'),'afterUpdate':_0x7a7c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x50ee9b){return function(_0x1e2f7b,_0x29b633,_0xe13805){WhatsappAccountEvents[_0x7a7c('0x5')](_0x50ee9b+':'+_0x1e2f7b['id'],_0x1e2f7b);WhatsappAccountEvents['emit'](_0x50ee9b,_0x1e2f7b);_0xe13805(null);};}for(var e in events){if(events[_0x7a7c('0x6')](e)){var event=events[e];WhatsappAccount[_0x7a7c('0x7')](e,emitEvent(event));}}module[_0x7a7c('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc8c3=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x5ca9bf,_0x399254){var _0x1e5a61=function(_0x17135e){while(--_0x17135e){_0x5ca9bf['push'](_0x5ca9bf['shift']());}};_0x1e5a61(++_0x399254);}(_0xc8c3,0x1bc));var _0x3c8c=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0xc8c3[_0x5a7f64];return _0x3d30f1;};'use strict';var EventEmitter=require(_0x3c8c('0x0'));var WhatsappAccount=require(_0x3c8c('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3c8c('0x2')](0x0);var events={'afterCreate':_0x3c8c('0x3'),'afterUpdate':_0x3c8c('0x4'),'afterDestroy':_0x3c8c('0x5')};function emitEvent(_0x437fe8){return function(_0x56c1bd,_0x4c0ca9,_0x2ac135){WhatsappAccountEvents[_0x3c8c('0x6')](_0x437fe8+':'+_0x56c1bd['id'],_0x56c1bd);WhatsappAccountEvents[_0x3c8c('0x6')](_0x437fe8,_0x56c1bd);_0x2ac135(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x3c8c('0x7')](e,emitEvent(event));}}module[_0x3c8c('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 8c245cd..12bee33 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 _0x6912=['whatsapp_accounts','../../config/logger','api','request-promise','path','rimraf'];(function(_0x36e31a,_0xddb24d){var _0x818540=function(_0x3da600){while(--_0x3da600){_0x36e31a['push'](_0x36e31a['shift']());}};_0x818540(++_0xddb24d);}(_0x6912,0x1a5));var _0x2691=function(_0x37e260,_0x3c729e){_0x37e260=_0x37e260-0x0;var _0x366060=_0x6912[_0x37e260];return _0x366060;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2691('0x0'))(_0x2691('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2691('0x2'));var fs=require('fs');var path=require(_0x2691('0x3'));var rimraf=require(_0x2691('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x3ab37a,_0x5d0ff9){return _0x3ab37a['define']('WhatsappAccount',attributes,{'tableName':_0x2691('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4444=['./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53d17e,_0xf979c9){var _0x35b0cc=function(_0x556323){while(--_0x556323){_0x53d17e['push'](_0x53d17e['shift']());}};_0x35b0cc(++_0xf979c9);}(_0x4444,0x18c));var _0x4444=function(_0x50c50b,_0x3a6fb3){_0x50c50b=_0x50c50b-0x0;var _0x423c29=_0x4444[_0x50c50b];return _0x423c29;};'use strict';var _=require(_0x4444('0x0'));var util=require(_0x4444('0x1'));var logger=require(_0x4444('0x2'))(_0x4444('0x3'));var moment=require(_0x4444('0x4'));var BPromise=require(_0x4444('0x5'));var rp=require(_0x4444('0x6'));var fs=require('fs');var path=require(_0x4444('0x7'));var rimraf=require(_0x4444('0x8'));var config=require(_0x4444('0x9'));var attributes=require(_0x4444('0xa'));module[_0x4444('0xb')]=function(_0x274e41,_0x4fd3c8){return _0x274e41[_0x4444('0xc')]('WhatsappAccount',attributes,{'tableName':_0x4444('0xd'),'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 fc564c2..7baa41a 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 _0xba6c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','options','raw','attributes','include','map','model','debug','ShowWhatsappAccount','lodash'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0xba6c,0x6e));var _0xcba6=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xba6c[_0x34d346];return _0x122d76;};'use strict';var _=require(_0xcba6('0x0'));var util=require(_0xcba6('0x1'));var moment=require(_0xcba6('0x2'));var BPromise=require(_0xcba6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcba6('0x4'));var db=require(_0xcba6('0x5'))['db'];var utils=require(_0xcba6('0x6'));var logger=require(_0xcba6('0x7'))(_0xcba6('0x8'));var config=require(_0xcba6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcba6('0xa')][_0xcba6('0xb')]({'port':0x232a});config[_0xcba6('0xc')]=_['defaults'](config['redis'],{'host':_0xcba6('0xd'),'port':0x18eb});var socket=require(_0xcba6('0xe'))(new Redis(config[_0xcba6('0xc')]));require('./whatsappAccount.socket')[_0xcba6('0xf')](socket);function respondWithRpcPromise(_0x205847,_0x460c80,_0xe5e339){return new BPromise(function(_0x4df12a,_0x201903){return client[_0xcba6('0x10')](_0x205847,_0xe5e339)[_0xcba6('0x11')](function(_0x3d154d){logger[_0xcba6('0x12')](_0xcba6('0x13'),_0x460c80,_0xcba6('0x14'));logger['debug'](_0xcba6('0x15'),_0x460c80,_0xcba6('0x14'),JSON[_0xcba6('0x16')](_0x3d154d));if(_0x3d154d['error']){if(_0x3d154d[_0xcba6('0x17')][_0xcba6('0x18')]===0x1f4){logger[_0xcba6('0x17')](_0xcba6('0x13'),_0x460c80,_0x3d154d['error'][_0xcba6('0x19')]);return _0x201903(_0x3d154d[_0xcba6('0x17')]['message']);}logger[_0xcba6('0x17')](_0xcba6('0x13'),_0x460c80,_0x3d154d[_0xcba6('0x17')]['message']);return _0x4df12a(_0x3d154d['error'][_0xcba6('0x19')]);}else{logger['info'](_0xcba6('0x13'),_0x460c80,_0xcba6('0x14'));_0x4df12a(_0x3d154d[_0xcba6('0x1a')][_0xcba6('0x19')]);}})[_0xcba6('0x1b')](function(_0x4074a7){logger[_0xcba6('0x17')](_0xcba6('0x13'),_0x460c80,_0x4074a7);_0x201903(_0x4074a7);});});}exports['ShowWhatsappAccount']=function(_0x5827ca){var _0x57b756=this;return new Promise(function(_0x3f42b6,_0x17414f){return db[_0xcba6('0x1c')]['find']({'raw':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca['options'][_0xcba6('0x1e')]===undefined?!![]:![]:!![],'where':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca[_0xcba6('0x1d')]['where']||null:null,'attributes':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca[_0xcba6('0x1d')][_0xcba6('0x1f')]||null:null,'include':_0x5827ca[_0xcba6('0x1d')]?_0x5827ca[_0xcba6('0x1d')][_0xcba6('0x20')]?_[_0xcba6('0x21')](_0x5827ca[_0xcba6('0x1d')][_0xcba6('0x20')],function(_0x10224e){return{'model':db[_0x10224e[_0xcba6('0x22')]],'as':_0x10224e['as'],'attributes':_0x10224e[_0xcba6('0x1f')],'include':_0x10224e[_0xcba6('0x20')]?_[_0xcba6('0x21')](_0x10224e[_0xcba6('0x20')],function(_0x193cc8){return{'model':db[_0x193cc8[_0xcba6('0x22')]],'as':_0x193cc8['as'],'attributes':_0x193cc8[_0xcba6('0x1f')],'include':_0x193cc8['include']?_[_0xcba6('0x21')](_0x193cc8[_0xcba6('0x20')],function(_0x31c19c){return{'model':db[_0x31c19c[_0xcba6('0x22')]],'as':_0x31c19c['as'],'attributes':_0x31c19c[_0xcba6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcba6('0x11')](function(_0x27b7c5){logger[_0xcba6('0x12')]('ShowWhatsappAccount',_0x5827ca);logger[_0xcba6('0x23')](_0xcba6('0x24'),_0x5827ca,JSON[_0xcba6('0x16')](_0x27b7c5));_0x3f42b6(_0x27b7c5);})['catch'](function(_0x503512){logger[_0xcba6('0x17')](_0xcba6('0x24'),_0x503512[_0xcba6('0x19')],_0x5827ca);_0x17414f(_0x57b756[_0xcba6('0x17')](0x1f4,_0x503512[_0xcba6('0x19')]));});});}; \ No newline at end of file +var _0xc7fd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','WhatsappAccount','find','options','where','attributes','include','map','model','then','ShowWhatsappAccount','debug'];(function(_0x344ff3,_0x2cbd1c){var _0x2ae10d=function(_0x4a549d){while(--_0x4a549d){_0x344ff3['push'](_0x344ff3['shift']());}};_0x2ae10d(++_0x2cbd1c);}(_0xc7fd,0xde));var _0xdc7f=function(_0x1bae48,_0x170c47){_0x1bae48=_0x1bae48-0x0;var _0x4bf87a=_0xc7fd[_0x1bae48];return _0x4bf87a;};'use strict';var _=require(_0xdc7f('0x0'));var util=require(_0xdc7f('0x1'));var moment=require(_0xdc7f('0x2'));var BPromise=require(_0xdc7f('0x3'));var rs=require(_0xdc7f('0x4'));var fs=require('fs');var Redis=require(_0xdc7f('0x5'));var db=require(_0xdc7f('0x6'))['db'];var utils=require(_0xdc7f('0x7'));var logger=require(_0xdc7f('0x8'))('rpc');var config=require(_0xdc7f('0x9'));var jayson=require(_0xdc7f('0xa'));var client=jayson[_0xdc7f('0xb')][_0xdc7f('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdc7f('0xd')],{'host':_0xdc7f('0xe'),'port':0x18eb});var socket=require(_0xdc7f('0xf'))(new Redis(config[_0xdc7f('0xd')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x474ae5,_0x4db2b0,_0x3b1aaf){return new BPromise(function(_0x4adbd7,_0x255b13){return client[_0xdc7f('0x10')](_0x474ae5,_0x3b1aaf)['then'](function(_0x985228){logger[_0xdc7f('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x4db2b0,_0xdc7f('0x12'));logger['debug'](_0xdc7f('0x13'),_0x4db2b0,_0xdc7f('0x12'),JSON[_0xdc7f('0x14')](_0x985228));if(_0x985228[_0xdc7f('0x15')]){if(_0x985228['error'][_0xdc7f('0x16')]===0x1f4){logger[_0xdc7f('0x15')](_0xdc7f('0x17'),_0x4db2b0,_0x985228['error'][_0xdc7f('0x18')]);return _0x255b13(_0x985228[_0xdc7f('0x15')]['message']);}logger[_0xdc7f('0x15')](_0xdc7f('0x17'),_0x4db2b0,_0x985228[_0xdc7f('0x15')][_0xdc7f('0x18')]);return _0x4adbd7(_0x985228['error'][_0xdc7f('0x18')]);}else{logger[_0xdc7f('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x4db2b0,'request\x20sent');_0x4adbd7(_0x985228['result'][_0xdc7f('0x18')]);}})[_0xdc7f('0x19')](function(_0x1c8ffb){logger[_0xdc7f('0x15')](_0xdc7f('0x17'),_0x4db2b0,_0x1c8ffb);_0x255b13(_0x1c8ffb);});});}exports['ShowWhatsappAccount']=function(_0x4506d8){var _0x202170=this;return new Promise(function(_0x57fd8a,_0x28126c){return db[_0xdc7f('0x1a')][_0xdc7f('0x1b')]({'raw':_0x4506d8[_0xdc7f('0x1c')]?_0x4506d8[_0xdc7f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4506d8[_0xdc7f('0x1c')]?_0x4506d8[_0xdc7f('0x1c')][_0xdc7f('0x1d')]||null:null,'attributes':_0x4506d8['options']?_0x4506d8[_0xdc7f('0x1c')][_0xdc7f('0x1e')]||null:null,'include':_0x4506d8[_0xdc7f('0x1c')]?_0x4506d8[_0xdc7f('0x1c')]['include']?_['map'](_0x4506d8[_0xdc7f('0x1c')][_0xdc7f('0x1f')],function(_0x2b6bb7){return{'model':db[_0x2b6bb7['model']],'as':_0x2b6bb7['as'],'attributes':_0x2b6bb7[_0xdc7f('0x1e')],'include':_0x2b6bb7[_0xdc7f('0x1f')]?_['map'](_0x2b6bb7[_0xdc7f('0x1f')],function(_0x148089){return{'model':db[_0x148089['model']],'as':_0x148089['as'],'attributes':_0x148089[_0xdc7f('0x1e')],'include':_0x148089[_0xdc7f('0x1f')]?_[_0xdc7f('0x20')](_0x148089[_0xdc7f('0x1f')],function(_0x37ecd1){return{'model':db[_0x37ecd1[_0xdc7f('0x21')]],'as':_0x37ecd1['as'],'attributes':_0x37ecd1['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc7f('0x22')](function(_0x4d65f9){logger[_0xdc7f('0x11')](_0xdc7f('0x23'),_0x4506d8);logger[_0xdc7f('0x24')](_0xdc7f('0x23'),_0x4506d8,JSON[_0xdc7f('0x14')](_0x4d65f9));_0x57fd8a(_0x4d65f9);})['catch'](function(_0x378e3b){logger[_0xdc7f('0x15')]('ShowWhatsappAccount',_0x378e3b['message'],_0x4506d8);_0x28126c(_0x202170[_0xdc7f('0x15')](0x1f4,_0x378e3b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 774eb62..11d1ba1 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 _0x80cd=['./whatsappAccount.events','save','update','emit','removeListener','register','whatsappAccount:'];(function(_0x2521f2,_0x1346fa){var _0x106409=function(_0x230c91){while(--_0x230c91){_0x2521f2['push'](_0x2521f2['shift']());}};_0x106409(++_0x1346fa);}(_0x80cd,0x13b));var _0xd80c=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x80cd[_0x4687df];return _0x32eaef;};'use strict';var WhatsappAccountEvents=require(_0xd80c('0x0'));var events=[_0xd80c('0x1'),'remove',_0xd80c('0x2')];function createListener(_0x3a81be,_0x1d2f16){return function(_0x395b53){_0x1d2f16[_0xd80c('0x3')](_0x3a81be,_0x395b53);};}function removeListener(_0x413eab,_0x1fd1e0){return function(){WhatsappAccountEvents[_0xd80c('0x4')](_0x413eab,_0x1fd1e0);};}exports[_0xd80c('0x5')]=function(_0x54be71){for(var _0x61fc3=0x0,_0x58cf8c=events['length'];_0x61fc3<_0x58cf8c;_0x61fc3++){var _0x4e234f=events[_0x61fc3];var _0x4a218b=createListener(_0xd80c('0x6')+_0x4e234f,_0x54be71);WhatsappAccountEvents['on'](_0x4e234f,_0x4a218b);}}; \ No newline at end of file +var _0xd1e6=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','register','length'];(function(_0x6e7c10,_0xa3fe0d){var _0x337b16=function(_0x384d6c){while(--_0x384d6c){_0x6e7c10['push'](_0x6e7c10['shift']());}};_0x337b16(++_0xa3fe0d);}(_0xd1e6,0x111));var _0x6d1e=function(_0x87105d,_0x384d5e){_0x87105d=_0x87105d-0x0;var _0x3f59b1=_0xd1e6[_0x87105d];return _0x3f59b1;};'use strict';var WhatsappAccountEvents=require(_0x6d1e('0x0'));var events=[_0x6d1e('0x1'),_0x6d1e('0x2'),_0x6d1e('0x3')];function createListener(_0x7214fa,_0x40c003){return function(_0x488317){_0x40c003[_0x6d1e('0x4')](_0x7214fa,_0x488317);};}function removeListener(_0x4975eb,_0x7b2e07){return function(){WhatsappAccountEvents['removeListener'](_0x4975eb,_0x7b2e07);};}exports[_0x6d1e('0x5')]=function(_0x1b37ae){for(var _0x4f584d=0x0,_0x120428=events[_0x6d1e('0x6')];_0x4f584d<_0x120428;_0x4f584d++){var _0x4eb57e=events[_0x4f584d];var _0xa5a83d=createListener(_0x6d1e('0x7')+_0x4eb57e,_0x1b37ae);WhatsappAccountEvents['on'](_0x4eb57e,_0xa5a83d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 68e8ca8..efcb32a 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 _0xcdc8=['/:id','show','post','create','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x171b65,_0x1aaf90){var _0xfb01b7=function(_0x29976d){while(--_0x29976d){_0x171b65['push'](_0x171b65['shift']());}};_0xfb01b7(++_0x1aaf90);}(_0xcdc8,0x1d5));var _0x8cdc=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xcdc8[_0x21aec3];return _0x288bbc;};'use strict';var multer=require('multer');var util=require(_0x8cdc('0x0'));var path=require(_0x8cdc('0x1'));var timeout=require('connect-timeout');var express=require(_0x8cdc('0x2'));var router=express[_0x8cdc('0x3')]();var fs_extra=require(_0x8cdc('0x4'));var auth=require(_0x8cdc('0x5'));var interaction=require(_0x8cdc('0x6'));var config=require(_0x8cdc('0x7'));var controller=require('./whatsappApplication.controller');router[_0x8cdc('0x8')]('/',auth[_0x8cdc('0x9')](),controller[_0x8cdc('0xa')]);router[_0x8cdc('0x8')](_0x8cdc('0xb'),auth[_0x8cdc('0x9')](),controller[_0x8cdc('0xc')]);router[_0x8cdc('0xd')]('/',auth[_0x8cdc('0x9')](),controller[_0x8cdc('0xe')]);router['put'](_0x8cdc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8cdc('0xf')](_0x8cdc('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8462=['./whatsappApplication.controller','isAuthenticated','index','get','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x562758,_0x2eab21){var _0x2d8d3e=function(_0x36327c){while(--_0x36327c){_0x562758['push'](_0x562758['shift']());}};_0x2d8d3e(++_0x2eab21);}(_0x8462,0x128));var _0x2846=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x8462[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require(_0x2846('0x0'));var util=require(_0x2846('0x1'));var path=require(_0x2846('0x2'));var timeout=require(_0x2846('0x3'));var express=require(_0x2846('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2846('0x5'));var interaction=require(_0x2846('0x6'));var config=require(_0x2846('0x7'));var controller=require(_0x2846('0x8'));router['get']('/',auth[_0x2846('0x9')](),controller[_0x2846('0xa')]);router[_0x2846('0xb')](_0x2846('0xc'),auth[_0x2846('0x9')](),controller['show']);router[_0x2846('0xd')]('/',auth[_0x2846('0x9')](),controller['create']);router[_0x2846('0xe')]('/:id',auth[_0x2846('0x9')](),controller[_0x2846('0xf')]);router[_0x2846('0x10')](_0x2846('0xc'),auth[_0x2846('0x9')](),controller[_0x2846('0x11')]);module[_0x2846('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 746eeb2..bf320db 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 _0x6f7f=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x6f7f,0x13c));var _0xf6f7=function(_0x1bc9cd,_0x4da80c){_0x1bc9cd=_0x1bc9cd-0x0;var _0x13bc89=_0x6f7f[_0x1bc9cd];return _0x13bc89;};'use strict';var Sequelize=require(_0xf6f7('0x0'));module[_0xf6f7('0x1')]={'priority':{'type':Sequelize[_0xf6f7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf6f7('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf6f7('0x4')]()},'description':{'type':Sequelize[_0xf6f7('0x3')]},'interval':{'type':Sequelize[_0xf6f7('0x3')],'defaultValue':_0xf6f7('0x5')}}; \ No newline at end of file +var _0xc818=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x4f46b6,_0x207ccf){var _0x37eb0e=function(_0x21fe76){while(--_0x21fe76){_0x4f46b6['push'](_0x4f46b6['shift']());}};_0x37eb0e(++_0x207ccf);}(_0xc818,0x86));var _0x8c81=function(_0x5bafaf,_0x3856ca){_0x5bafaf=_0x5bafaf-0x0;var _0x1bd33c=_0xc818[_0x5bafaf];return _0x1bd33c;};'use strict';var Sequelize=require(_0x8c81('0x0'));module[_0x8c81('0x1')]={'priority':{'type':Sequelize[_0x8c81('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c81('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8c81('0x4')]()},'description':{'type':Sequelize[_0x8c81('0x3')]},'interval':{'type':Sequelize[_0x8c81('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 969c309..cc7c306 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 _0xa35e=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','keys','include','options','create','body','find','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0xa35e,0x111));var _0xea35=function(_0x582d55,_0x4d9e1f){_0x582d55=_0x582d55-0x0;var _0xfd2e31=_0xa35e[_0x582d55];return _0xfd2e31;};'use strict';var emlformat=require(_0xea35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea35('0x1'));var jsonpatch=require(_0xea35('0x2'));var rp=require(_0xea35('0x3'));var moment=require(_0xea35('0x4'));var BPromise=require(_0xea35('0x5'));var Mustache=require(_0xea35('0x6'));var util=require(_0xea35('0x7'));var path=require(_0xea35('0x8'));var sox=require(_0xea35('0x9'));var csv=require(_0xea35('0xa'));var ejs=require(_0xea35('0xb'));var fs=require('fs');var fs_extra=require(_0xea35('0xc'));var _=require(_0xea35('0xd'));var squel=require(_0xea35('0xe'));var crypto=require('crypto');var jsforce=require(_0xea35('0xf'));var deskjs=require(_0xea35('0x10'));var toCsv=require(_0xea35('0xa'));var querystring=require('querystring');var Papa=require(_0xea35('0x11'));var Redis=require(_0xea35('0x12'));var authService=require(_0xea35('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xea35('0x14'));var hardwareService=require(_0xea35('0x15'));var logger=require(_0xea35('0x16'))(_0xea35('0x17'));var utils=require(_0xea35('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xea35('0x19'));var db=require(_0xea35('0x1a'))['db'];function respondWithStatusCode(_0x1914d4,_0x4a8e3d){_0x4a8e3d=_0x4a8e3d||0xcc;return function(_0x4eeb4b){if(_0x4eeb4b){return _0x1914d4[_0xea35('0x1b')](_0x4a8e3d);}return _0x1914d4[_0xea35('0x1c')](_0x4a8e3d)[_0xea35('0x1d')]();};}function respondWithResult(_0xb5f9a8,_0x4907be){_0x4907be=_0x4907be||0xc8;return function(_0x2c400a){if(_0x2c400a){return _0xb5f9a8['status'](_0x4907be)[_0xea35('0x1e')](_0x2c400a);}};}function respondWithFilteredResult(_0x3e7a79,_0x4ad1c3){return function(_0x281846){if(_0x281846){var _0x1a99af=typeof _0x4ad1c3[_0xea35('0x1f')]===_0xea35('0x20')&&typeof _0x4ad1c3[_0xea35('0x21')]===_0xea35('0x20');var _0x2b4322=_0x281846[_0xea35('0x22')];var _0x3b7336=_0x1a99af?0x0:_0x4ad1c3[_0xea35('0x1f')];var _0x4cf178=_0x1a99af?_0x281846[_0xea35('0x22')]:_0x4ad1c3[_0xea35('0x1f')]+_0x4ad1c3[_0xea35('0x21')];var _0x2d32e2;if(_0x4cf178>=_0x2b4322){_0x4cf178=_0x2b4322;_0x2d32e2=0xc8;}else{_0x2d32e2=0xce;}_0x3e7a79[_0xea35('0x1c')](_0x2d32e2);return _0x3e7a79['set'](_0xea35('0x23'),_0x3b7336+'-'+_0x4cf178+'/'+_0x2b4322)['json'](_0x281846);}return null;};}function patchUpdates(_0x9eb0a1){return function(_0x332fc2){try{jsonpatch['apply'](_0x332fc2,_0x9eb0a1,!![]);}catch(_0x123166){return BPromise[_0xea35('0x24')](_0x123166);}return _0x332fc2['save']();};}function saveUpdates(_0x1408ea,_0x3e46cf){return function(_0x3fa0c5){if(_0x3fa0c5){return _0x3fa0c5[_0xea35('0x25')](_0x1408ea)[_0xea35('0x26')](function(_0x50cf87){return _0x50cf87;});}return null;};}function removeEntity(_0x41c8c0,_0x1cb455){return function(_0x342749){if(_0x342749){return _0x342749[_0xea35('0x27')]()[_0xea35('0x26')](function(){_0x41c8c0[_0xea35('0x1c')](0xcc)[_0xea35('0x1d')]();});}};}function handleEntityNotFound(_0x49edd3,_0x5e6443){return function(_0x53510d){if(!_0x53510d){_0x49edd3[_0xea35('0x1b')](0x194);}return _0x53510d;};}function handleError(_0x590c4d,_0x56a63f){_0x56a63f=_0x56a63f||0x1f4;return function(_0x27b55a){logger['error'](_0x27b55a[_0xea35('0x28')]);if(_0x27b55a[_0xea35('0x29')]){delete _0x27b55a[_0xea35('0x29')];}_0x590c4d[_0xea35('0x1c')](_0x56a63f)['send'](_0x27b55a);};}exports[_0xea35('0x2a')]=function(_0x261a88,_0x2cffb5){var _0x33b3e7={},_0x5d4207={},_0x16fd14={'count':0x0,'rows':[]};var _0x5d8111=_[_0xea35('0x2b')](db[_0xea35('0x2c')][_0xea35('0x2d')],function(_0x2ff076){return{'name':_0x2ff076[_0xea35('0x2e')],'type':_0x2ff076[_0xea35('0x2f')][_0xea35('0x30')]};});_0x5d4207[_0xea35('0x31')]=_['map'](_0x5d8111,_0xea35('0x29'));_0x5d4207[_0xea35('0x32')]=_['keys'](_0x261a88[_0xea35('0x32')]);_0x5d4207['filters']=_[_0xea35('0x33')](_0x5d4207[_0xea35('0x31')],_0x5d4207[_0xea35('0x32')]);_0x33b3e7[_0xea35('0x34')]=_[_0xea35('0x33')](_0x5d4207[_0xea35('0x31')],qs[_0xea35('0x35')](_0x261a88['query']['fields']));_0x33b3e7[_0xea35('0x34')]=_0x33b3e7[_0xea35('0x34')]['length']?_0x33b3e7[_0xea35('0x34')]:_0x5d4207[_0xea35('0x31')];if(!_0x261a88['query'][_0xea35('0x36')]('nolimit')){_0x33b3e7[_0xea35('0x21')]=qs[_0xea35('0x21')](_0x261a88[_0xea35('0x32')][_0xea35('0x21')]);_0x33b3e7[_0xea35('0x1f')]=qs[_0xea35('0x1f')](_0x261a88[_0xea35('0x32')][_0xea35('0x1f')]);}_0x33b3e7[_0xea35('0x37')]=qs[_0xea35('0x38')](_0x261a88[_0xea35('0x32')]['sort']);_0x33b3e7['where']=qs[_0xea35('0x39')](_[_0xea35('0x3a')](_0x261a88['query'],_0x5d4207['filters']),_0x5d8111);if(_0x261a88[_0xea35('0x32')][_0xea35('0x3b')]){_0x33b3e7[_0xea35('0x3c')]=_['merge'](_0x33b3e7[_0xea35('0x3c')],{'$or':_['map'](_0x5d8111,function(_0x488104){if(_0x488104[_0xea35('0x2f')]!==_0xea35('0x3d')){var _0x244ec2={};_0x244ec2[_0x488104['name']]={'$like':'%'+_0x261a88['query'][_0xea35('0x3b')]+'%'};return _0x244ec2;}})});}_0x33b3e7=_[_0xea35('0x3e')]({},_0x33b3e7,_0x261a88['options']);var _0x366591={'where':_0x33b3e7[_0xea35('0x3c')]};return db[_0xea35('0x2c')][_0xea35('0x22')](_0x366591)[_0xea35('0x26')](function(_0x1e4d77){_0x16fd14['count']=_0x1e4d77;if(_0x261a88[_0xea35('0x32')][_0xea35('0x3f')]){_0x33b3e7['include']=[{'all':!![]}];}return db[_0xea35('0x2c')][_0xea35('0x40')](_0x33b3e7);})[_0xea35('0x26')](function(_0x73f98e){_0x16fd14[_0xea35('0x41')]=_0x73f98e;return _0x16fd14;})[_0xea35('0x26')](respondWithFilteredResult(_0x2cffb5,_0x33b3e7))[_0xea35('0x42')](handleError(_0x2cffb5,null));};exports['show']=function(_0x463b31,_0x49ca57){var _0x526b0f={'raw':!![],'where':{'id':_0x463b31[_0xea35('0x43')]['id']}},_0x5d6cf7={};_0x5d6cf7[_0xea35('0x31')]=_[_0xea35('0x44')](db[_0xea35('0x2c')][_0xea35('0x2d')]);_0x5d6cf7['query']=_[_0xea35('0x44')](_0x463b31[_0xea35('0x32')]);_0x5d6cf7[_0xea35('0x39')]=_[_0xea35('0x33')](_0x5d6cf7['model'],_0x5d6cf7[_0xea35('0x32')]);_0x526b0f[_0xea35('0x34')]=_[_0xea35('0x33')](_0x5d6cf7['model'],qs[_0xea35('0x35')](_0x463b31[_0xea35('0x32')][_0xea35('0x35')]));_0x526b0f[_0xea35('0x34')]=_0x526b0f['attributes']['length']?_0x526b0f[_0xea35('0x34')]:_0x5d6cf7['model'];if(_0x463b31['query'][_0xea35('0x3f')]){_0x526b0f[_0xea35('0x45')]=[{'all':!![]}];}_0x526b0f=_[_0xea35('0x3e')]({},_0x526b0f,_0x463b31[_0xea35('0x46')]);return db[_0xea35('0x2c')]['find'](_0x526b0f)[_0xea35('0x26')](handleEntityNotFound(_0x49ca57,null))[_0xea35('0x26')](respondWithResult(_0x49ca57,null))[_0xea35('0x42')](handleError(_0x49ca57,null));};exports[_0xea35('0x47')]=function(_0x2ec1e,_0x58a14f){return db[_0xea35('0x2c')][_0xea35('0x47')](_0x2ec1e['body'],{})[_0xea35('0x26')](respondWithResult(_0x58a14f,0xc9))[_0xea35('0x42')](handleError(_0x58a14f,null));};exports[_0xea35('0x25')]=function(_0x46172e,_0x53e744){if(_0x46172e[_0xea35('0x48')]['id']){delete _0x46172e['body']['id'];}return db[_0xea35('0x2c')]['find']({'where':{'id':_0x46172e[_0xea35('0x43')]['id']}})[_0xea35('0x26')](handleEntityNotFound(_0x53e744,null))[_0xea35('0x26')](saveUpdates(_0x46172e[_0xea35('0x48')],null))[_0xea35('0x26')](respondWithResult(_0x53e744,null))[_0xea35('0x42')](handleError(_0x53e744,null));};exports['destroy']=function(_0x1ef903,_0x525fd4){return db['WhatsappApplication'][_0xea35('0x49')]({'where':{'id':_0x1ef903[_0xea35('0x43')]['id']}})[_0xea35('0x26')](handleEntityNotFound(_0x525fd4,null))[_0xea35('0x26')](removeEntity(_0x525fd4,null))[_0xea35('0x42')](handleError(_0x525fd4,null));}; \ No newline at end of file +var _0xb875=['request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','catch','show','params','include','create','body','find','eml-format'];(function(_0x14272c,_0x581fd2){var _0x12a4cc=function(_0x3ec55c){while(--_0x3ec55c){_0x14272c['push'](_0x14272c['shift']());}};_0x12a4cc(++_0x581fd2);}(_0xb875,0x167));var _0x5b87=function(_0x1c048d,_0x43d0ea){_0x1c048d=_0x1c048d-0x0;var _0x44ba83=_0xb875[_0x1c048d];return _0x44ba83;};'use strict';var emlformat=require(_0x5b87('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b87('0x1'));var moment=require('moment');var BPromise=require(_0x5b87('0x2'));var Mustache=require(_0x5b87('0x3'));var util=require('util');var path=require(_0x5b87('0x4'));var sox=require(_0x5b87('0x5'));var csv=require(_0x5b87('0x6'));var ejs=require(_0x5b87('0x7'));var fs=require('fs');var fs_extra=require(_0x5b87('0x8'));var _=require(_0x5b87('0x9'));var squel=require(_0x5b87('0xa'));var crypto=require(_0x5b87('0xb'));var jsforce=require(_0x5b87('0xc'));var deskjs=require(_0x5b87('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5b87('0xe'));var Papa=require('papaparse');var Redis=require(_0x5b87('0xf'));var authService=require(_0x5b87('0x10'));var qs=require(_0x5b87('0x11'));var as=require(_0x5b87('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5b87('0x13'));var utils=require(_0x5b87('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5b87('0x15'));var db=require(_0x5b87('0x16'))['db'];function respondWithStatusCode(_0x99c7aa,_0x2a2790){_0x2a2790=_0x2a2790||0xcc;return function(_0x2de6a4){if(_0x2de6a4){return _0x99c7aa[_0x5b87('0x17')](_0x2a2790);}return _0x99c7aa[_0x5b87('0x18')](_0x2a2790)[_0x5b87('0x19')]();};}function respondWithResult(_0x90d2de,_0x570c1b){_0x570c1b=_0x570c1b||0xc8;return function(_0x413792){if(_0x413792){return _0x90d2de['status'](_0x570c1b)[_0x5b87('0x1a')](_0x413792);}};}function respondWithFilteredResult(_0xc4d3f4,_0x51ff4c){return function(_0x59bf2b){if(_0x59bf2b){var _0x2f9003=typeof _0x51ff4c['offset']===_0x5b87('0x1b')&&typeof _0x51ff4c[_0x5b87('0x1c')]===_0x5b87('0x1b');var _0x13cb13=_0x59bf2b[_0x5b87('0x1d')];var _0x18cfa8=_0x2f9003?0x0:_0x51ff4c[_0x5b87('0x1e')];var _0x4865da=_0x2f9003?_0x59bf2b['count']:_0x51ff4c['offset']+_0x51ff4c['limit'];var _0x1b0f5a;if(_0x4865da>=_0x13cb13){_0x4865da=_0x13cb13;_0x1b0f5a=0xc8;}else{_0x1b0f5a=0xce;}_0xc4d3f4[_0x5b87('0x18')](_0x1b0f5a);return _0xc4d3f4[_0x5b87('0x1f')](_0x5b87('0x20'),_0x18cfa8+'-'+_0x4865da+'/'+_0x13cb13)[_0x5b87('0x1a')](_0x59bf2b);}return null;};}function patchUpdates(_0x5491ec){return function(_0x63a24b){try{jsonpatch['apply'](_0x63a24b,_0x5491ec,!![]);}catch(_0x5ac69f){return BPromise[_0x5b87('0x21')](_0x5ac69f);}return _0x63a24b[_0x5b87('0x22')]();};}function saveUpdates(_0x4c8ce2,_0x1a1088){return function(_0x168a4f){if(_0x168a4f){return _0x168a4f[_0x5b87('0x23')](_0x4c8ce2)[_0x5b87('0x24')](function(_0x360010){return _0x360010;});}return null;};}function removeEntity(_0x2cb48e,_0x1afe46){return function(_0x23cfda){if(_0x23cfda){return _0x23cfda[_0x5b87('0x25')]()[_0x5b87('0x24')](function(){_0x2cb48e['status'](0xcc)[_0x5b87('0x19')]();});}};}function handleEntityNotFound(_0x250dec,_0x1ad64e){return function(_0x19d2d4){if(!_0x19d2d4){_0x250dec[_0x5b87('0x17')](0x194);}return _0x19d2d4;};}function handleError(_0x1368e1,_0x2d8edf){_0x2d8edf=_0x2d8edf||0x1f4;return function(_0x27b4e1){logger[_0x5b87('0x26')](_0x27b4e1[_0x5b87('0x27')]);if(_0x27b4e1[_0x5b87('0x28')]){delete _0x27b4e1['name'];}_0x1368e1['status'](_0x2d8edf)[_0x5b87('0x29')](_0x27b4e1);};}exports['index']=function(_0x706a59,_0x369fac){var _0x5806b0={},_0x49f639={},_0x43c0a0={'count':0x0,'rows':[]};var _0xad390f=_[_0x5b87('0x2a')](db[_0x5b87('0x2b')][_0x5b87('0x2c')],function(_0x583449){return{'name':_0x583449[_0x5b87('0x2d')],'type':_0x583449[_0x5b87('0x2e')]['key']};});_0x49f639[_0x5b87('0x2f')]=_['map'](_0xad390f,_0x5b87('0x28'));_0x49f639[_0x5b87('0x30')]=_[_0x5b87('0x31')](_0x706a59['query']);_0x49f639[_0x5b87('0x32')]=_[_0x5b87('0x33')](_0x49f639[_0x5b87('0x2f')],_0x49f639[_0x5b87('0x30')]);_0x5806b0['attributes']=_['intersection'](_0x49f639['model'],qs[_0x5b87('0x34')](_0x706a59['query'][_0x5b87('0x34')]));_0x5806b0['attributes']=_0x5806b0[_0x5b87('0x35')][_0x5b87('0x36')]?_0x5806b0['attributes']:_0x49f639[_0x5b87('0x2f')];if(!_0x706a59[_0x5b87('0x30')][_0x5b87('0x37')](_0x5b87('0x38'))){_0x5806b0['limit']=qs[_0x5b87('0x1c')](_0x706a59[_0x5b87('0x30')][_0x5b87('0x1c')]);_0x5806b0[_0x5b87('0x1e')]=qs[_0x5b87('0x1e')](_0x706a59[_0x5b87('0x30')][_0x5b87('0x1e')]);}_0x5806b0[_0x5b87('0x39')]=qs[_0x5b87('0x3a')](_0x706a59[_0x5b87('0x30')][_0x5b87('0x3a')]);_0x5806b0['where']=qs[_0x5b87('0x32')](_['pick'](_0x706a59[_0x5b87('0x30')],_0x49f639[_0x5b87('0x32')]),_0xad390f);if(_0x706a59[_0x5b87('0x30')][_0x5b87('0x3b')]){_0x5806b0[_0x5b87('0x3c')]=_[_0x5b87('0x3d')](_0x5806b0[_0x5b87('0x3c')],{'$or':_[_0x5b87('0x2a')](_0xad390f,function(_0x31d108){if(_0x31d108[_0x5b87('0x2e')]!=='VIRTUAL'){var _0x2ddd6a={};_0x2ddd6a[_0x31d108[_0x5b87('0x28')]]={'$like':'%'+_0x706a59['query'][_0x5b87('0x3b')]+'%'};return _0x2ddd6a;}})});}_0x5806b0=_[_0x5b87('0x3d')]({},_0x5806b0,_0x706a59[_0x5b87('0x3e')]);var _0x7e413a={'where':_0x5806b0[_0x5b87('0x3c')]};return db['WhatsappApplication'][_0x5b87('0x1d')](_0x7e413a)[_0x5b87('0x24')](function(_0x1bf9d1){_0x43c0a0['count']=_0x1bf9d1;if(_0x706a59[_0x5b87('0x30')][_0x5b87('0x3f')]){_0x5806b0['include']=[{'all':!![]}];}return db[_0x5b87('0x2b')][_0x5b87('0x40')](_0x5806b0);})[_0x5b87('0x24')](function(_0x17dd76){_0x43c0a0['rows']=_0x17dd76;return _0x43c0a0;})[_0x5b87('0x24')](respondWithFilteredResult(_0x369fac,_0x5806b0))[_0x5b87('0x41')](handleError(_0x369fac,null));};exports[_0x5b87('0x42')]=function(_0x4ddfcb,_0x458268){var _0x56f2c6={'raw':!![],'where':{'id':_0x4ddfcb[_0x5b87('0x43')]['id']}},_0x4564b9={};_0x4564b9[_0x5b87('0x2f')]=_[_0x5b87('0x31')](db[_0x5b87('0x2b')][_0x5b87('0x2c')]);_0x4564b9['query']=_[_0x5b87('0x31')](_0x4ddfcb[_0x5b87('0x30')]);_0x4564b9['filters']=_[_0x5b87('0x33')](_0x4564b9[_0x5b87('0x2f')],_0x4564b9[_0x5b87('0x30')]);_0x56f2c6['attributes']=_[_0x5b87('0x33')](_0x4564b9[_0x5b87('0x2f')],qs[_0x5b87('0x34')](_0x4ddfcb[_0x5b87('0x30')][_0x5b87('0x34')]));_0x56f2c6['attributes']=_0x56f2c6[_0x5b87('0x35')][_0x5b87('0x36')]?_0x56f2c6[_0x5b87('0x35')]:_0x4564b9[_0x5b87('0x2f')];if(_0x4ddfcb[_0x5b87('0x30')]['includeAll']){_0x56f2c6[_0x5b87('0x44')]=[{'all':!![]}];}_0x56f2c6=_[_0x5b87('0x3d')]({},_0x56f2c6,_0x4ddfcb[_0x5b87('0x3e')]);return db[_0x5b87('0x2b')]['find'](_0x56f2c6)[_0x5b87('0x24')](handleEntityNotFound(_0x458268,null))[_0x5b87('0x24')](respondWithResult(_0x458268,null))[_0x5b87('0x41')](handleError(_0x458268,null));};exports['create']=function(_0x47e00d,_0x408ca7){return db[_0x5b87('0x2b')][_0x5b87('0x45')](_0x47e00d['body'],{})[_0x5b87('0x24')](respondWithResult(_0x408ca7,0xc9))[_0x5b87('0x41')](handleError(_0x408ca7,null));};exports[_0x5b87('0x23')]=function(_0x1ed2c3,_0x82c788){if(_0x1ed2c3[_0x5b87('0x46')]['id']){delete _0x1ed2c3[_0x5b87('0x46')]['id'];}return db[_0x5b87('0x2b')][_0x5b87('0x47')]({'where':{'id':_0x1ed2c3[_0x5b87('0x43')]['id']}})[_0x5b87('0x24')](handleEntityNotFound(_0x82c788,null))[_0x5b87('0x24')](saveUpdates(_0x1ed2c3['body'],null))['then'](respondWithResult(_0x82c788,null))['catch'](handleError(_0x82c788,null));};exports[_0x5b87('0x25')]=function(_0x29308e,_0x4e9601){return db['WhatsappApplication'][_0x5b87('0x47')]({'where':{'id':_0x29308e[_0x5b87('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e9601,null))[_0x5b87('0x24')](removeEntity(_0x4e9601,null))[_0x5b87('0x41')](handleError(_0x4e9601,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d14c076..fcf5125 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 _0x29d4=['utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x367672,_0x171c6c){var _0x3b479e=function(_0x4d21db){while(--_0x4d21db){_0x367672['push'](_0x367672['shift']());}};_0x3b479e(++_0x171c6c);}(_0x29d4,0x1a1));var _0x429d=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x29d4[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));module[_0x429d('0x9')]=function(_0x1c55aa,_0xa71445){return _0x1c55aa[_0x429d('0xa')](_0x429d('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x429d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x35aa=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise'];(function(_0x4c4577,_0x100e06){var _0x5c04fa=function(_0x12bf0a){while(--_0x12bf0a){_0x4c4577['push'](_0x4c4577['shift']());}};_0x5c04fa(++_0x100e06);}(_0x35aa,0xbe));var _0xa35a=function(_0x5000e5,_0x1a2ed9){_0x5000e5=_0x5000e5-0x0;var _0x496c30=_0x35aa[_0x5000e5];return _0x496c30;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var logger=require(_0xa35a('0x1'))(_0xa35a('0x2'));var moment=require(_0xa35a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa35a('0x4'));var fs=require('fs');var path=require(_0xa35a('0x5'));var rimraf=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var attributes=require(_0xa35a('0x8'));module[_0xa35a('0x9')]=function(_0x449cfe,_0x10917d){return _0x449cfe['define'](_0xa35a('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa35a('0xb'),'collate':_0xa35a('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 0ef5465..4ac4c6e 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 _0xb458=['WhatsappApplication,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xb458,0x103));var _0x8b45=function(_0x4973e2,_0x3973a9){_0x4973e2=_0x4973e2-0x0;var _0x596228=_0xb458[_0x4973e2];return _0x596228;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file +var _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x4c50e4,_0x178209){var _0x238583=function(_0x53a800){while(--_0x53a800){_0x4c50e4['push'](_0x4c50e4['shift']());}};_0x238583(++_0x178209);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4c4305,_0x5c8599){_0x4c4305=_0x4c4305-0x0;var _0x4820ec=_0xa8a8[_0x4c4305];return _0x4820ec;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d8b70ad..900468a 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 _0x814b=['isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0x814b,0x1a2));var _0xb814=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x814b[_0x33154d];return _0x3b2f03;};'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('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['post']('/',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);router[_0xb814('0x15')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x16')]);router[_0xb814('0x15')](_0xb814('0x17'),auth[_0xb814('0xb')](),interaction[_0xb814('0x18')](_0xb814('0x19'),_0xb814('0x1a')),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),interaction[_0xb814('0x18')](_0xb814('0x19'),_0xb814('0x1d')),controller[_0xb814('0x1e')]);router[_0xb814('0x1f')]('/:id',auth[_0xb814('0xb')](),interaction['tracked'](_0xb814('0x19'),_0xb814('0x20')),controller['destroy']);router['delete']('/:id/tags',auth[_0xb814('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xcd59=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags'];(function(_0x1cb06f,_0x2f20e9){var _0x4638bd=function(_0xb53d93){while(--_0xb53d93){_0x1cb06f['push'](_0x1cb06f['shift']());}};_0x4638bd(++_0x2f20e9);}(_0xcd59,0x14b));var _0x9cd5=function(_0x3a0f77,_0x39f605){_0x3a0f77=_0x3a0f77-0x0;var _0x54fd0c=_0xcd59[_0x3a0f77];return _0x54fd0c;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xc')]);router[_0x9cd5('0xa')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller['describe']);router[_0x9cd5('0xa')](_0x9cd5('0xe'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0xa')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x11')]);router['get'](_0x9cd5('0x12'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x13')]);router[_0x9cd5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9cd5('0x14')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x15')]);router[_0x9cd5('0x14')](_0x9cd5('0x16'),auth['isAuthenticated'](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x19')),controller['addTags']);router['put']('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')]('whatsapp',_0x9cd5('0x1a')),controller[_0x9cd5('0x1b')]);router[_0x9cd5('0x1c')]('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x1d')),controller[_0x9cd5('0x1e')]);router[_0x9cd5('0x1c')]('/:id/tags',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x1f')]);module[_0x9cd5('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 751e4b9..dc39b28 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 _0x2c16=['DATE','STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','moment','exports'];(function(_0x55bed6,_0x5996a1){var _0x3dd98b=function(_0x3d23dc){while(--_0x3d23dc){_0x55bed6['push'](_0x55bed6['shift']());}};_0x3dd98b(++_0x5996a1);}(_0x2c16,0xf0));var _0x62c1=function(_0x56e9a1,_0x180afd){_0x56e9a1=_0x56e9a1-0x0;var _0xe4363f=_0x2c16[_0x56e9a1];return _0xe4363f;};'use strict';var Sequelize=require(_0x62c1('0x0'));var moment=require(_0x62c1('0x1'));module[_0x62c1('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x62c1('0x3')]},'disposition':{'type':Sequelize[_0x62c1('0x4')]},'secondDisposition':{'type':Sequelize[_0x62c1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x62c1('0x4')]},'note':{'type':Sequelize[_0x62c1('0x4')]},'phone':{'type':Sequelize[_0x62c1('0x4')]},'read1stAt':{'type':Sequelize[_0x62c1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x62c1('0x5')]('in',_0x62c1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x62c1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x62c1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x62c1('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x62c1('0x8')]}}; \ No newline at end of file +var _0xe797=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x871457,_0x467500){var _0x5c9848=function(_0x1c8a2d){while(--_0x1c8a2d){_0x871457['push'](_0x871457['shift']());}};_0x5c9848(++_0x467500);}(_0xe797,0x12a));var _0x7e79=function(_0x5870c1,_0x173ba3){_0x5870c1=_0x5870c1-0x0;var _0x344685=_0xe797[_0x5870c1];return _0x344685;};'use strict';var Sequelize=require(_0x7e79('0x0'));var moment=require(_0x7e79('0x1'));module[_0x7e79('0x2')]={'closed':{'type':Sequelize[_0x7e79('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7e79('0x4')]},'disposition':{'type':Sequelize[_0x7e79('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7e79('0x5')]},'note':{'type':Sequelize[_0x7e79('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7e79('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7e79('0x6')]('in',_0x7e79('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7e79('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7e79('0x3')],'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 b632584..659161c 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 _0xa23b=['emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Owner','fullname','mkdirSync','Account','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','rimraf','zip-dir','moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','catch','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','create','body','WhatsappInteraction','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xa23b,0x12f));var _0xba23=function(_0x423af3,_0x1b765b){_0x423af3=_0x423af3-0x0;var _0x302fec=_0xa23b[_0x423af3];return _0x302fec;};'use strict';var rimraf=require(_0xba23('0x0'));var zipdir=require(_0xba23('0x1'));var moment=require(_0xba23('0x2'));var BPromise=require('bluebird');var util=require(_0xba23('0x3'));var path=require(_0xba23('0x4'));var ejs=require(_0xba23('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xba23('0x6'));var qs=require(_0xba23('0x7'));var pdf=require(_0xba23('0x8'));var logger=require(_0xba23('0x9'))(_0xba23('0xa'));var config=require(_0xba23('0xb'));var db=require('../../mysqldb')['db'];config[_0xba23('0xc')]=_['defaults'](config[_0xba23('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xba23('0xd'))(new Redis(config[_0xba23('0xc')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5d34f1,_0xa30a6b){_0xa30a6b=_0xa30a6b||0xcc;return function(_0x5efafa){if(_0x5efafa){return _0x5d34f1[_0xba23('0xe')](_0xa30a6b);}return _0x5d34f1[_0xba23('0xf')](_0xa30a6b)[_0xba23('0x10')]();};}function respondWithResult(_0x2b659d,_0x2f7754){_0x2f7754=_0x2f7754||0xc8;return function(_0x2c80b0){if(_0x2c80b0){return _0x2b659d['status'](_0x2f7754)['json'](_0x2c80b0);}};}function respondWithFilteredResult(_0x8f3cf4,_0x390d84){return function(_0x2e4818){if(_0x2e4818){var _0x2f7d98=typeof _0x390d84['offset']===_0xba23('0x11')&&typeof _0x390d84[_0xba23('0x12')]===_0xba23('0x11');var _0x4847db=_0x2e4818[_0xba23('0x13')];var _0x5301b8=_0x2f7d98?0x0:_0x390d84[_0xba23('0x14')];var _0x58ebe1=_0x2f7d98?_0x2e4818[_0xba23('0x13')]:_0x390d84['offset']+_0x390d84[_0xba23('0x12')];var _0xcc4e02;if(_0x58ebe1>=_0x4847db){_0x58ebe1=_0x4847db;_0xcc4e02=0xc8;}else{_0xcc4e02=0xce;}_0x8f3cf4['status'](_0xcc4e02);return _0x8f3cf4[_0xba23('0x15')](_0xba23('0x16'),_0x5301b8+'-'+_0x58ebe1+'/'+_0x4847db)[_0xba23('0x17')](_0x2e4818);}return null;};}function saveUpdates(_0x21d450){return function(_0x196055){if(_0x196055){return _0x196055[_0xba23('0x18')](_0x21d450)[_0xba23('0x19')](function(_0x1c6889){return _0x1c6889;});}return null;};}function removeEntity(_0x3f4d7a){return function(_0x58d36a){if(_0x58d36a){return _0x58d36a[_0xba23('0x1a')]()[_0xba23('0x19')](function(){_0x3f4d7a[_0xba23('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x307171){return function(_0x541076){if(!_0x541076){_0x307171[_0xba23('0xe')](0x194);}return _0x541076;};}function handleError(_0x3c94dd,_0x2268aa){_0x2268aa=_0x2268aa||0x1f4;return function(_0x4082e9){logger['error'](_0x4082e9['stack']);if(_0x4082e9[_0xba23('0x1b')]){delete _0x4082e9[_0xba23('0x1b')];}_0x3c94dd[_0xba23('0xf')](_0x2268aa)[_0xba23('0x1c')](_0x4082e9);};}exports[_0xba23('0x1d')]=function(_0xcb2728,_0x39caf3){var _0x7e7e7e={};var _0x26840a=_[_0xba23('0x1e')](db['WhatsappInteraction'][_0xba23('0x1f')],function(_0x87bfe7){return{'name':_0x87bfe7[_0xba23('0x20')],'type':_0x87bfe7[_0xba23('0x21')]['key']};});_0x7e7e7e=qs[_0xba23('0x22')](_0x26840a,_0xcb2728);return interaction[_0xba23('0x23')](_0xba23('0x24'),_0xcb2728[_0xba23('0x25')],_0xcb2728[_0xba23('0x26')],_0x7e7e7e,_0x26840a)[_0xba23('0x19')](respondWithFilteredResult(_0x39caf3,_0x7e7e7e))[_0xba23('0x27')](handleError(_0x39caf3,null));};exports['show']=function(_0x1840a8,_0x1b03a3){var _0x2598de={'raw':![],'where':{'id':_0x1840a8[_0xba23('0x28')]['id']}},_0x2fbe21={};_0x2fbe21['model']=_[_0xba23('0x29')](db['WhatsappInteraction']['rawAttributes']);_0x2fbe21[_0xba23('0x25')]=_[_0xba23('0x29')](_0x1840a8[_0xba23('0x25')]);_0x2fbe21[_0xba23('0x2a')]=_[_0xba23('0x2b')](_0x2fbe21[_0xba23('0x2c')],_0x2fbe21[_0xba23('0x25')]);_0x2598de['attributes']=_[_0xba23('0x2b')](_0x2fbe21[_0xba23('0x2c')],qs[_0xba23('0x2d')](_0x1840a8[_0xba23('0x25')][_0xba23('0x2d')]));_0x2598de[_0xba23('0x2e')]=_0x2598de['attributes'][_0xba23('0x2f')]?_0x2598de['attributes']:_0x2fbe21[_0xba23('0x2c')];if(_0x1840a8[_0xba23('0x25')][_0xba23('0x30')]){_0x2598de[_0xba23('0x31')]=[{'all':!![]}];}_0x2598de=_[_0xba23('0x32')]({},_0x2598de,_0x1840a8[_0xba23('0x33')]);return db['WhatsappInteraction'][_0xba23('0x34')](_0x2598de)[_0xba23('0x19')](handleEntityNotFound(_0x1b03a3,null))[_0xba23('0x19')](respondWithResult(_0x1b03a3,null))[_0xba23('0x27')](handleError(_0x1b03a3,null));};exports[_0xba23('0x35')]=function(_0x1109a8,_0xcce577){return db['WhatsappInteraction']['create'](_0x1109a8[_0xba23('0x36')],{})['then'](respondWithResult(_0xcce577,0xc9))[_0xba23('0x27')](handleError(_0xcce577,null));};exports[_0xba23('0x18')]=function(_0x2e79b3,_0x270424){if(_0x2e79b3[_0xba23('0x36')]['id']){delete _0x2e79b3['body']['id'];}return db['WhatsappInteraction'][_0xba23('0x34')]({'where':{'id':_0x2e79b3['params']['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x270424,null))[_0xba23('0x19')](saveUpdates(_0x2e79b3['body'],null))[_0xba23('0x19')](respondWithResult(_0x270424,null))[_0xba23('0x27')](handleError(_0x270424,null));};exports[_0xba23('0x1a')]=function(_0x1e5688,_0x3d99b1){return db[_0xba23('0x37')][_0xba23('0x34')]({'where':{'id':_0x1e5688[_0xba23('0x28')]['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x3d99b1,null))[_0xba23('0x19')](removeEntity(_0x3d99b1,null))[_0xba23('0x27')](handleError(_0x3d99b1,null));};exports['describe']=function(_0x810eb4,_0x444b90){return db[_0xba23('0x37')][_0xba23('0x38')]()[_0xba23('0x19')](respondWithResult(_0x444b90,null))[_0xba23('0x27')](handleError(_0x444b90,null));};exports[_0xba23('0x39')]=function(_0x47074c,_0x4844fe){return db['WhatsappMessage']['find']({'where':{'id':_0x47074c[_0xba23('0x28')]['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x4844fe,null))['then'](function(_0x5b606c){if(_0x5b606c){return _0x5b606c['addMessage'](_0x47074c[_0xba23('0x36')][_0xba23('0x3a')],_[_0xba23('0x3b')](_0x47074c[_0xba23('0x36')],[_0xba23('0x3a'),'id'])||{});}})[_0xba23('0x19')](respondWithResult(_0x4844fe,null))[_0xba23('0x27')](handleError(_0x4844fe,null));};exports[_0xba23('0x3c')]=function(_0xd6a748,_0x45ed23){var _0x2aae84={'raw':![],'where':{}};var _0x534742={};var _0xe0dbb0={'count':0x0,'rows':[]};return db[_0xba23('0x37')][_0xba23('0x3d')]({'where':{'id':_0xd6a748['params']['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x45ed23,null))[_0xba23('0x19')](function(_0x34d599){if(_0x34d599){_0x534742[_0xba23('0x2c')]=_[_0xba23('0x29')](db[_0xba23('0x3e')]['rawAttributes']);_0x534742[_0xba23('0x25')]=_[_0xba23('0x29')](_0xd6a748['query']);_0x534742['filters']=_[_0xba23('0x2b')](_0x534742[_0xba23('0x2c')],_0x534742[_0xba23('0x25')]);_0x2aae84[_0xba23('0x2e')]=_['intersection'](_0x534742[_0xba23('0x2c')],qs[_0xba23('0x2d')](_0xd6a748['query']['fields']));_0x2aae84[_0xba23('0x2e')]=_0x2aae84[_0xba23('0x2e')]['length']?_0x2aae84[_0xba23('0x2e')]:_0x534742[_0xba23('0x2c')];if(!_0xd6a748[_0xba23('0x25')][_0xba23('0x3f')]('nolimit')){_0x2aae84[_0xba23('0x12')]=qs[_0xba23('0x12')](_0xd6a748[_0xba23('0x25')][_0xba23('0x12')]);_0x2aae84[_0xba23('0x14')]=qs['offset'](_0xd6a748['query'][_0xba23('0x14')]);}_0x2aae84['order']=qs[_0xba23('0x40')](_0xd6a748[_0xba23('0x25')][_0xba23('0x40')]);_0x2aae84[_0xba23('0x41')]=qs[_0xba23('0x2a')](_[_0xba23('0x42')](_0xd6a748[_0xba23('0x25')],_0x534742[_0xba23('0x2a')]));_0x2aae84[_0xba23('0x41')]['WhatsappInteractionId']=_0x34d599['id'];if(_0xd6a748[_0xba23('0x25')][_0xba23('0x43')]){_0x2aae84[_0xba23('0x41')]=_['merge'](_0x2aae84[_0xba23('0x41')],{'$or':_[_0xba23('0x1e')](_0x2aae84['attributes'],function(_0x142ccb){var _0x172604={};_0x172604[_0x142ccb]={'$like':'%'+_0xd6a748[_0xba23('0x25')][_0xba23('0x43')]+'%'};return _0x172604;})});}if(_0xd6a748[_0xba23('0x25')][_0xba23('0x44')]){var _0x66e0fb=_0xd6a748['query']['$gte'][_0xba23('0x45')](',');var _0x19e7b2={};_0x19e7b2[_0x66e0fb[0x0]]={'$gte':moment(_0x66e0fb[0x1])[_0xba23('0x46')](_0xba23('0x47'))};_0x2aae84[_0xba23('0x41')]=_[_0xba23('0x32')](_0x2aae84[_0xba23('0x41')],_0x19e7b2);}_0x2aae84=_[_0xba23('0x32')]({},_0x2aae84,_0xd6a748[_0xba23('0x33')]);return db['WhatsappMessage'][_0xba23('0x13')]({'where':_0x2aae84[_0xba23('0x41')]})[_0xba23('0x19')](function(_0x26223f){_0xe0dbb0[_0xba23('0x13')]=_0x26223f;if(_0xd6a748[_0xba23('0x25')][_0xba23('0x30')]){_0x2aae84[_0xba23('0x31')]=[{'all':!![]}];}return db[_0xba23('0x3e')][_0xba23('0x23')](_0x2aae84);})[_0xba23('0x19')](function(_0x1d45bc){_0xe0dbb0[_0xba23('0x48')]=_0x1d45bc;return _0xe0dbb0;});}})[_0xba23('0x19')](respondWithFilteredResult(_0x45ed23,_0x2aae84))[_0xba23('0x27')](handleError(_0x45ed23,null));};exports['addTags']=function(_0x2a3d3c,_0x4aea4a){return db['WhatsappInteraction'][_0xba23('0x34')]({'where':{'id':_0x2a3d3c['params']['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x4aea4a,null))[_0xba23('0x19')](function(_0x23614f){if(_0x23614f){return _0x23614f[_0xba23('0x49')](_0x2a3d3c[_0xba23('0x36')][_0xba23('0x3a')],_[_0xba23('0x3b')](_0x2a3d3c[_0xba23('0x36')],['ids','id'])||{})['spread'](function(){return db[_0xba23('0x4a')][_0xba23('0x23')]({'attributes':['id',_0xba23('0x1b'),'color'],'where':{'id':_0x2a3d3c[_0xba23('0x36')][_0xba23('0x3a')]}});})[_0xba23('0x19')](function(_0x5d0612){socket[_0xba23('0x4b')](_0xba23('0x4c'),{'id':Number(_0x2a3d3c[_0xba23('0x28')]['id']),'tags':_0x5d0612||[]});return{'id':Number(_0x2a3d3c[_0xba23('0x28')]['id']),'tags':_0x5d0612||[]};});}})[_0xba23('0x19')](respondWithResult(_0x4aea4a,null))[_0xba23('0x27')](handleError(_0x4aea4a,null));};exports[_0xba23('0x4d')]=function(_0x39f72c,_0x52582e){return db[_0xba23('0x37')][_0xba23('0x34')]({'where':{'id':_0x39f72c[_0xba23('0x28')]['id']}})[_0xba23('0x19')](handleEntityNotFound(_0x52582e,null))[_0xba23('0x19')](function(_0x27b3cb){if(_0x27b3cb){return _0x27b3cb['removeTags'](_0x39f72c[_0xba23('0x25')][_0xba23('0x3a')]);}})[_0xba23('0x19')](respondWithStatusCode(_0x52582e,null))[_0xba23('0x27')](handleError(_0x52582e,null));};exports[_0xba23('0x4e')]=function(_0x55d1fb,_0x4e8dd0){var _0x51940d=moment()[_0xba23('0x4f')]()[_0xba23('0x50')]();var _0x54db6a=path[_0xba23('0x51')](config[_0xba23('0x52')],_0xba23('0x53'),_0xba23('0x54'),_0xba23('0x55'));var _0x3b6b4c=path[_0xba23('0x51')](config[_0xba23('0x52')],_0xba23('0x53'),_0xba23('0x54'),'attachments');var _0x455ac2=path[_0xba23('0x51')](_0x54db6a,_0x51940d);var _0x374d63=util[_0xba23('0x46')](_0xba23('0x56'),_0x55d1fb[_0xba23('0x28')]['id'],_0x51940d);var _0x4a60f3=path['join'](_0x54db6a,_0x374d63);var _0x37756b=[];_0x37756b[_0xba23('0x57')]({'model':db['User'],'as':_0xba23('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x37756b['push']({'model':db[_0xba23('0x59')],'as':_0xba23('0x5a'),'attributes':['id',_0xba23('0x5b'),_0xba23('0x5c')],'raw':!![]});if(_0x55d1fb['query'][_0xba23('0x5d')]){_0x37756b['push']({'model':db['Attachment'],'as':_0xba23('0x5e'),'raw':!![]});}var _0x58b416=[{'model':db[_0xba23('0x3e')],'as':_0xba23('0x5f'),'attributes':['id',_0xba23('0x36'),_0xba23('0x60'),_0xba23('0x61'),_0xba23('0x62'),_0xba23('0x63')],'include':_0x37756b}];_0x58b416[_0xba23('0x57')]({'model':db[_0xba23('0x64')],'as':'Account','attributes':['id',_0xba23('0x1b')]});_0x58b416['push']({'model':db[_0xba23('0x58')],'as':_0xba23('0x65'),'attributes':['id',_0xba23('0x66')]});return db[_0xba23('0x37')][_0xba23('0x34')]({'where':{'id':_0x55d1fb[_0xba23('0x28')]['id']},'include':_0x58b416})[_0xba23('0x19')](handleEntityNotFound(_0x4e8dd0,null))['then'](function(_0x2bea1f){if(_0x2bea1f){var _0x1fc880=_0x2bea1f['get']({'plain':!![]});fs[_0xba23('0x67')](_0x455ac2);var _0x23a071={'channel':'Whatsapp','account':_0x1fc880[_0xba23('0x68')][_0xba23('0x1b')],'agent':_0x1fc880[_0xba23('0x65')]?_0x1fc880['Owner']['fullname']:_0xba23('0x69'),'createdAt':moment(_0x1fc880['createdAt'])[_0xba23('0x46')](_0xba23('0x47'))['toString'](),'closedAt':_0x1fc880[_0xba23('0x6a')]?moment(_0x1fc880[_0xba23('0x6b')])['format'](_0xba23('0x47'))[_0xba23('0x50')]():'','disposition':_0x1fc880[_0xba23('0x6c')],'messages':_(_0x1fc880[_0xba23('0x5f')])[_0xba23('0x43')]({'secret':![]})[_0xba23('0x1e')](function(_0x54c18e){if(_0x54c18e[_0xba23('0x5e')]){var _0x4ba7b1=path[_0xba23('0x51')](_0x3b6b4c,_0x54c18e[_0xba23('0x5e')][_0xba23('0x6d')]);if(fs[_0xba23('0x6e')](_0x4ba7b1)){fs[_0xba23('0x6f')](_0x4ba7b1)[_0xba23('0x70')](fs[_0xba23('0x71')](path[_0xba23('0x51')](_0x455ac2,_0x54c18e['Attachment'][_0xba23('0x6d')])));}}return{'date':moment(_0x54c18e[_0xba23('0x60')])['format'](_0xba23('0x47'))['toString'](),'sender':_0x54c18e[_0xba23('0x61')]===_0xba23('0x72')?_0x54c18e[_0xba23('0x58')]?_0x54c18e['User'][_0xba23('0x66')]:_0xba23('0x73'):_0x54c18e[_0xba23('0x5a')][_0xba23('0x5b')]+(_0x54c18e[_0xba23('0x5a')][_0xba23('0x5c')]?'\x20'+_0x54c18e[_0xba23('0x5a')][_0xba23('0x5c')]:''),'body':_0x54c18e['Attachment']?_0x54c18e[_0xba23('0x5e')][_0xba23('0x6d')]:_0x54c18e[_0xba23('0x36')],'direction':_0x54c18e[_0xba23('0x61')]===_0xba23('0x72')?'A':'C','secret':_0x54c18e[_0xba23('0x62')],'read':_0x54c18e[_0xba23('0x63')],'attachment':_0x54c18e['Attachment']};})[_0xba23('0x74')]()};return ejs[_0xba23('0x75')](path[_0xba23('0x51')](config[_0xba23('0x52')],_0xba23('0x53'),_0xba23('0x76'),_0xba23('0x77')),{'interaction':_0x23a071})[_0xba23('0x19')](function(_0x6777bd){var _0x313fdd=path[_0xba23('0x51')](_0x455ac2,_0xba23('0x78')+_0x1fc880['id']+'-'+_0x51940d+_0xba23('0x79'));var _0x20d45a={'path':_0x313fdd,'channel':_0xba23('0x7a'),'interactionId':_0x1fc880['id']};return pdf[_0xba23('0x7b')](_0x6777bd,_0x20d45a);})[_0xba23('0x19')](function(){return new BPromise(function(_0x2c211c,_0x12ab44){zipdir(_0x455ac2,{'saveTo':_0x4a60f3},function(_0x154d8e,_0x3708f8){if(_0x154d8e)return _0x12ab44(_0x154d8e);return _0x2c211c(_0x3708f8);});})[_0xba23('0x19')](function(){return new BPromise(function(_0x351e66,_0xc6e95d){rimraf(_0x455ac2,function(_0x4b9a72){if(_0x4b9a72)_0xc6e95d(_0x4b9a72);return _0x351e66();});});})[_0xba23('0x19')](function(){return _0x4e8dd0[_0xba23('0x4e')](_0x4a60f3,_0x374d63,function(_0x36f5c7){if(_0x36f5c7){console[_0xba23('0x7c')](_0xba23('0x7d'),_0x36f5c7);}else{fs['unlinkSync'](_0x4a60f3);}});});});}else{return _0x4e8dd0[_0xba23('0xe')](0xc8);}})[_0xba23('0x27')](handleError(_0x4e8dd0,null));}; \ No newline at end of file +var _0x11b1=['transcript-','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','error','stack','name','index','map','type','key','getOptions','query','then','catch','params','model','keys','WhatsappInteraction','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','options','find','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','pick','where','WhatsappInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','createdAt','closed','closedAt','disposition','basename','pipe','createWriteStream','out','Contact','lastName','views','downloadInteraction.ejs'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x11b1,0x1ed));var _0x111b=function(_0x26cdbf,_0x31dbf2){_0x26cdbf=_0x26cdbf-0x0;var _0x5d7e16=_0x11b1[_0x26cdbf];return _0x5d7e16;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x111b('0x0'));var moment=require(_0x111b('0x1'));var BPromise=require(_0x111b('0x2'));var util=require(_0x111b('0x3'));var path=require(_0x111b('0x4'));var ejs=require(_0x111b('0x5'));var fs=require('fs');var _=require(_0x111b('0x6'));var Redis=require(_0x111b('0x7'));var interaction=require(_0x111b('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x111b('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x111b('0xa'));var db=require(_0x111b('0xb'))['db'];config[_0x111b('0xc')]=_[_0x111b('0xd')](config[_0x111b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x111b('0xe'))(new Redis(config['redis']));require(_0x111b('0xf'))['register'](socket);function respondWithStatusCode(_0x16a40d,_0x4f2b58){_0x4f2b58=_0x4f2b58||0xcc;return function(_0x338c96){if(_0x338c96){return _0x16a40d[_0x111b('0x10')](_0x4f2b58);}return _0x16a40d[_0x111b('0x11')](_0x4f2b58)[_0x111b('0x12')]();};}function respondWithResult(_0x5b4fbc,_0x2c8e58){_0x2c8e58=_0x2c8e58||0xc8;return function(_0x56e681){if(_0x56e681){return _0x5b4fbc[_0x111b('0x11')](_0x2c8e58)['json'](_0x56e681);}};}function respondWithFilteredResult(_0x481500,_0x2186a4){return function(_0x5f369c){if(_0x5f369c){var _0x4a0046=typeof _0x2186a4[_0x111b('0x13')]===_0x111b('0x14')&&typeof _0x2186a4[_0x111b('0x15')]==='undefined';var _0x39c18c=_0x5f369c[_0x111b('0x16')];var _0x42945c=_0x4a0046?0x0:_0x2186a4[_0x111b('0x13')];var _0x37486c=_0x4a0046?_0x5f369c[_0x111b('0x16')]:_0x2186a4[_0x111b('0x13')]+_0x2186a4[_0x111b('0x15')];var _0x34992d;if(_0x37486c>=_0x39c18c){_0x37486c=_0x39c18c;_0x34992d=0xc8;}else{_0x34992d=0xce;}_0x481500['status'](_0x34992d);return _0x481500[_0x111b('0x17')](_0x111b('0x18'),_0x42945c+'-'+_0x37486c+'/'+_0x39c18c)[_0x111b('0x19')](_0x5f369c);}return null;};}function saveUpdates(_0x3064be){return function(_0x22bfa0){if(_0x22bfa0){return _0x22bfa0['update'](_0x3064be)['then'](function(_0x1f932b){return _0x1f932b;});}return null;};}function removeEntity(_0x153f73){return function(_0xa628e){if(_0xa628e){return _0xa628e[_0x111b('0x1a')]()['then'](function(){_0x153f73[_0x111b('0x11')](0xcc)[_0x111b('0x12')]();});}};}function handleEntityNotFound(_0x2c3acd){return function(_0x4364bc){if(!_0x4364bc){_0x2c3acd[_0x111b('0x10')](0x194);}return _0x4364bc;};}function handleError(_0x54d82f,_0x53e68e){_0x53e68e=_0x53e68e||0x1f4;return function(_0xabb258){logger[_0x111b('0x1b')](_0xabb258[_0x111b('0x1c')]);if(_0xabb258[_0x111b('0x1d')]){delete _0xabb258[_0x111b('0x1d')];}_0x54d82f['status'](_0x53e68e)['send'](_0xabb258);};}exports[_0x111b('0x1e')]=function(_0x225b34,_0x13854d){var _0x1373a7={};var _0x41b7ae=_[_0x111b('0x1f')](db['WhatsappInteraction']['rawAttributes'],function(_0x1ec533){return{'name':_0x1ec533['fieldName'],'type':_0x1ec533[_0x111b('0x20')][_0x111b('0x21')]};});_0x1373a7=qs[_0x111b('0x22')](_0x41b7ae,_0x225b34);return interaction['findAll']('whatsapp',_0x225b34[_0x111b('0x23')],_0x225b34['user'],_0x1373a7,_0x41b7ae)[_0x111b('0x24')](respondWithFilteredResult(_0x13854d,_0x1373a7))[_0x111b('0x25')](handleError(_0x13854d,null));};exports['show']=function(_0x2069c3,_0x173f33){var _0x5fb7f7={'raw':![],'where':{'id':_0x2069c3[_0x111b('0x26')]['id']}},_0x567ebc={};_0x567ebc[_0x111b('0x27')]=_[_0x111b('0x28')](db[_0x111b('0x29')][_0x111b('0x2a')]);_0x567ebc[_0x111b('0x23')]=_[_0x111b('0x28')](_0x2069c3[_0x111b('0x23')]);_0x567ebc[_0x111b('0x2b')]=_['intersection'](_0x567ebc[_0x111b('0x27')],_0x567ebc[_0x111b('0x23')]);_0x5fb7f7[_0x111b('0x2c')]=_[_0x111b('0x2d')](_0x567ebc['model'],qs['fields'](_0x2069c3[_0x111b('0x23')][_0x111b('0x2e')]));_0x5fb7f7['attributes']=_0x5fb7f7[_0x111b('0x2c')]['length']?_0x5fb7f7[_0x111b('0x2c')]:_0x567ebc[_0x111b('0x27')];if(_0x2069c3[_0x111b('0x23')][_0x111b('0x2f')]){_0x5fb7f7['include']=[{'all':!![]}];}_0x5fb7f7=_[_0x111b('0x30')]({},_0x5fb7f7,_0x2069c3[_0x111b('0x31')]);return db[_0x111b('0x29')][_0x111b('0x32')](_0x5fb7f7)[_0x111b('0x24')](handleEntityNotFound(_0x173f33,null))[_0x111b('0x24')](respondWithResult(_0x173f33,null))[_0x111b('0x25')](handleError(_0x173f33,null));};exports[_0x111b('0x33')]=function(_0xffa8c,_0x3b759a){return db[_0x111b('0x29')][_0x111b('0x33')](_0xffa8c[_0x111b('0x34')],{})['then'](respondWithResult(_0x3b759a,0xc9))[_0x111b('0x25')](handleError(_0x3b759a,null));};exports[_0x111b('0x35')]=function(_0x20c467,_0x9a0d){if(_0x20c467[_0x111b('0x34')]['id']){delete _0x20c467[_0x111b('0x34')]['id'];}return db[_0x111b('0x29')][_0x111b('0x32')]({'where':{'id':_0x20c467[_0x111b('0x26')]['id']}})[_0x111b('0x24')](handleEntityNotFound(_0x9a0d,null))[_0x111b('0x24')](saveUpdates(_0x20c467[_0x111b('0x34')],null))[_0x111b('0x24')](respondWithResult(_0x9a0d,null))[_0x111b('0x25')](handleError(_0x9a0d,null));};exports[_0x111b('0x1a')]=function(_0x31ef4f,_0x3c9982){return db[_0x111b('0x29')][_0x111b('0x32')]({'where':{'id':_0x31ef4f[_0x111b('0x26')]['id']}})['then'](handleEntityNotFound(_0x3c9982,null))[_0x111b('0x24')](removeEntity(_0x3c9982,null))[_0x111b('0x25')](handleError(_0x3c9982,null));};exports[_0x111b('0x36')]=function(_0x3abc27,_0x3099e5){return db[_0x111b('0x29')][_0x111b('0x36')]()[_0x111b('0x24')](respondWithResult(_0x3099e5,null))[_0x111b('0x25')](handleError(_0x3099e5,null));};exports[_0x111b('0x37')]=function(_0x3d7f61,_0x25b117){return db[_0x111b('0x38')][_0x111b('0x32')]({'where':{'id':_0x3d7f61[_0x111b('0x26')]['id']}})[_0x111b('0x24')](handleEntityNotFound(_0x25b117,null))[_0x111b('0x24')](function(_0x4c13f){if(_0x4c13f){return _0x4c13f[_0x111b('0x37')](_0x3d7f61['body'][_0x111b('0x39')],_[_0x111b('0x3a')](_0x3d7f61[_0x111b('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x25b117,null))[_0x111b('0x25')](handleError(_0x25b117,null));};exports[_0x111b('0x3b')]=function(_0xd5c5a4,_0x4c6504){var _0x1ba8c1={'raw':![],'where':{}};var _0x3d07a9={};var _0x1957bc={'count':0x0,'rows':[]};return db[_0x111b('0x29')][_0x111b('0x3c')]({'where':{'id':_0xd5c5a4[_0x111b('0x26')]['id']}})[_0x111b('0x24')](handleEntityNotFound(_0x4c6504,null))['then'](function(_0x4221a1){if(_0x4221a1){_0x3d07a9[_0x111b('0x27')]=_[_0x111b('0x28')](db[_0x111b('0x38')]['rawAttributes']);_0x3d07a9[_0x111b('0x23')]=_[_0x111b('0x28')](_0xd5c5a4[_0x111b('0x23')]);_0x3d07a9[_0x111b('0x2b')]=_[_0x111b('0x2d')](_0x3d07a9[_0x111b('0x27')],_0x3d07a9[_0x111b('0x23')]);_0x1ba8c1[_0x111b('0x2c')]=_[_0x111b('0x2d')](_0x3d07a9['model'],qs[_0x111b('0x2e')](_0xd5c5a4[_0x111b('0x23')][_0x111b('0x2e')]));_0x1ba8c1['attributes']=_0x1ba8c1[_0x111b('0x2c')]['length']?_0x1ba8c1[_0x111b('0x2c')]:_0x3d07a9['model'];if(!_0xd5c5a4[_0x111b('0x23')][_0x111b('0x3d')](_0x111b('0x3e'))){_0x1ba8c1[_0x111b('0x15')]=qs[_0x111b('0x15')](_0xd5c5a4[_0x111b('0x23')][_0x111b('0x15')]);_0x1ba8c1['offset']=qs[_0x111b('0x13')](_0xd5c5a4[_0x111b('0x23')][_0x111b('0x13')]);}_0x1ba8c1['order']=qs[_0x111b('0x3f')](_0xd5c5a4['query'][_0x111b('0x3f')]);_0x1ba8c1['where']=qs[_0x111b('0x2b')](_[_0x111b('0x40')](_0xd5c5a4[_0x111b('0x23')],_0x3d07a9[_0x111b('0x2b')]));_0x1ba8c1[_0x111b('0x41')][_0x111b('0x42')]=_0x4221a1['id'];if(_0xd5c5a4[_0x111b('0x23')]['filter']){_0x1ba8c1[_0x111b('0x41')]=_[_0x111b('0x30')](_0x1ba8c1[_0x111b('0x41')],{'$or':_[_0x111b('0x1f')](_0x1ba8c1['attributes'],function(_0x3d31e7){var _0x481c62={};_0x481c62[_0x3d31e7]={'$like':'%'+_0xd5c5a4[_0x111b('0x23')][_0x111b('0x43')]+'%'};return _0x481c62;})});}if(_0xd5c5a4[_0x111b('0x23')]['$gte']){var _0x294ca6=_0xd5c5a4['query']['$gte']['split'](',');var _0x18ffcd={};_0x18ffcd[_0x294ca6[0x0]]={'$gte':moment(_0x294ca6[0x1])[_0x111b('0x44')](_0x111b('0x45'))};_0x1ba8c1[_0x111b('0x41')]=_[_0x111b('0x30')](_0x1ba8c1[_0x111b('0x41')],_0x18ffcd);}_0x1ba8c1=_[_0x111b('0x30')]({},_0x1ba8c1,_0xd5c5a4[_0x111b('0x31')]);return db[_0x111b('0x38')][_0x111b('0x16')]({'where':_0x1ba8c1[_0x111b('0x41')]})['then'](function(_0x5508dd){_0x1957bc[_0x111b('0x16')]=_0x5508dd;if(_0xd5c5a4[_0x111b('0x23')][_0x111b('0x2f')]){_0x1ba8c1[_0x111b('0x46')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x111b('0x47')](_0x1ba8c1);})[_0x111b('0x24')](function(_0x2cdb1d){_0x1957bc[_0x111b('0x48')]=_0x2cdb1d;return _0x1957bc;});}})['then'](respondWithFilteredResult(_0x4c6504,_0x1ba8c1))[_0x111b('0x25')](handleError(_0x4c6504,null));};exports[_0x111b('0x49')]=function(_0x5d5796,_0x2c3afd){return db[_0x111b('0x29')][_0x111b('0x32')]({'where':{'id':_0x5d5796['params']['id']}})['then'](handleEntityNotFound(_0x2c3afd,null))['then'](function(_0x5b560e){if(_0x5b560e){return _0x5b560e[_0x111b('0x4a')](_0x5d5796['body'][_0x111b('0x39')],_[_0x111b('0x3a')](_0x5d5796[_0x111b('0x34')],[_0x111b('0x39'),'id'])||{})['spread'](function(){return db[_0x111b('0x4b')][_0x111b('0x47')]({'attributes':['id',_0x111b('0x1d'),'color'],'where':{'id':_0x5d5796[_0x111b('0x34')]['ids']}});})[_0x111b('0x24')](function(_0x4e59dd){socket[_0x111b('0x4c')](_0x111b('0x4d'),{'id':Number(_0x5d5796[_0x111b('0x26')]['id']),'tags':_0x4e59dd||[]});return{'id':Number(_0x5d5796['params']['id']),'tags':_0x4e59dd||[]};});}})['then'](respondWithResult(_0x2c3afd,null))[_0x111b('0x25')](handleError(_0x2c3afd,null));};exports[_0x111b('0x4e')]=function(_0x1b59db,_0x3c6e52){return db[_0x111b('0x29')][_0x111b('0x32')]({'where':{'id':_0x1b59db[_0x111b('0x26')]['id']}})['then'](handleEntityNotFound(_0x3c6e52,null))[_0x111b('0x24')](function(_0x3e5a77){if(_0x3e5a77){return _0x3e5a77[_0x111b('0x4e')](_0x1b59db[_0x111b('0x23')]['ids']);}})['then'](respondWithStatusCode(_0x3c6e52,null))[_0x111b('0x25')](handleError(_0x3c6e52,null));};exports[_0x111b('0x4f')]=function(_0x523a57,_0x3ebaf2){var _0x30fcdf=moment()[_0x111b('0x50')]()[_0x111b('0x51')]();var _0x337965=path['join'](config[_0x111b('0x52')],_0x111b('0x53'),_0x111b('0x54'),_0x111b('0x55'));var _0x4ffcd7=path[_0x111b('0x56')](config['root'],_0x111b('0x53'),_0x111b('0x54'),_0x111b('0x57'));var _0x28bf33=path[_0x111b('0x56')](_0x337965,_0x30fcdf);var _0x3d38be=util[_0x111b('0x44')](_0x111b('0x58'),_0x523a57[_0x111b('0x26')]['id'],_0x30fcdf);var _0x46abe2=path[_0x111b('0x56')](_0x337965,_0x3d38be);var _0x5e09f5=[];_0x5e09f5[_0x111b('0x59')]({'model':db[_0x111b('0x5a')],'as':_0x111b('0x5a'),'attributes':['id',_0x111b('0x5b')],'raw':!![]});_0x5e09f5[_0x111b('0x59')]({'model':db[_0x111b('0x5c')],'as':'Contact','attributes':['id',_0x111b('0x5d'),'lastName'],'raw':!![]});if(_0x523a57['query'][_0x111b('0x57')]){_0x5e09f5[_0x111b('0x59')]({'model':db[_0x111b('0x5e')],'as':'Attachment','raw':!![]});}var _0x2425ae=[{'model':db[_0x111b('0x38')],'as':_0x111b('0x5f'),'attributes':['id','body','createdAt',_0x111b('0x60'),_0x111b('0x61'),_0x111b('0x62')],'include':_0x5e09f5}];_0x2425ae[_0x111b('0x59')]({'model':db[_0x111b('0x63')],'as':_0x111b('0x64'),'attributes':['id',_0x111b('0x1d')]});_0x2425ae[_0x111b('0x59')]({'model':db[_0x111b('0x5a')],'as':'Owner','attributes':['id',_0x111b('0x5b')]});return db[_0x111b('0x29')][_0x111b('0x32')]({'where':{'id':_0x523a57[_0x111b('0x26')]['id']},'include':_0x2425ae})[_0x111b('0x24')](handleEntityNotFound(_0x3ebaf2,null))[_0x111b('0x24')](function(_0x26e963){if(_0x26e963){var _0x2aee51=_0x26e963[_0x111b('0x65')]({'plain':!![]});fs[_0x111b('0x66')](_0x28bf33);var _0x4170ee={'channel':_0x111b('0x67'),'account':_0x2aee51[_0x111b('0x64')][_0x111b('0x1d')],'agent':_0x2aee51[_0x111b('0x68')]?_0x2aee51[_0x111b('0x68')][_0x111b('0x5b')]:'N.A.','createdAt':moment(_0x2aee51[_0x111b('0x69')])['format'](_0x111b('0x45'))[_0x111b('0x51')](),'closedAt':_0x2aee51[_0x111b('0x6a')]?moment(_0x2aee51[_0x111b('0x6b')])[_0x111b('0x44')](_0x111b('0x45'))[_0x111b('0x51')]():'','disposition':_0x2aee51[_0x111b('0x6c')],'messages':_(_0x2aee51[_0x111b('0x5f')])[_0x111b('0x43')]({'secret':![]})[_0x111b('0x1f')](function(_0x5ee77d){if(_0x5ee77d[_0x111b('0x5e')]){var _0x480b8c=path[_0x111b('0x56')](_0x4ffcd7,_0x5ee77d[_0x111b('0x5e')][_0x111b('0x6d')]);if(fs['existsSync'](_0x480b8c)){fs['createReadStream'](_0x480b8c)[_0x111b('0x6e')](fs[_0x111b('0x6f')](path['join'](_0x28bf33,_0x5ee77d[_0x111b('0x5e')]['basename'])));}}return{'date':moment(_0x5ee77d[_0x111b('0x69')])[_0x111b('0x44')](_0x111b('0x45'))[_0x111b('0x51')](),'sender':_0x5ee77d['direction']===_0x111b('0x70')?_0x5ee77d[_0x111b('0x5a')]?_0x5ee77d[_0x111b('0x5a')]['fullname']:'System':_0x5ee77d[_0x111b('0x71')]['firstName']+(_0x5ee77d[_0x111b('0x71')][_0x111b('0x72')]?'\x20'+_0x5ee77d['Contact'][_0x111b('0x72')]:''),'body':_0x5ee77d[_0x111b('0x5e')]?_0x5ee77d[_0x111b('0x5e')][_0x111b('0x6d')]:_0x5ee77d[_0x111b('0x34')],'direction':_0x5ee77d['direction']===_0x111b('0x70')?'A':'C','secret':_0x5ee77d[_0x111b('0x61')],'read':_0x5ee77d['read'],'attachment':_0x5ee77d[_0x111b('0x5e')]};})['value']()};return ejs['renderFile'](path[_0x111b('0x56')](config['root'],_0x111b('0x53'),_0x111b('0x73'),_0x111b('0x74')),{'interaction':_0x4170ee})['then'](function(_0x4c223c){var _0x36907b=path[_0x111b('0x56')](_0x28bf33,_0x111b('0x75')+_0x2aee51['id']+'-'+_0x30fcdf+'.pdf');var _0x4b92ed={'path':_0x36907b,'channel':'Whatsapp','interactionId':_0x2aee51['id']};return pdf[_0x111b('0x76')](_0x4c223c,_0x4b92ed);})['then'](function(){return new BPromise(function(_0x1864cb,_0x5e0226){zipdir(_0x28bf33,{'saveTo':_0x46abe2},function(_0x2f916d,_0x24a9ff){if(_0x2f916d)return _0x5e0226(_0x2f916d);return _0x1864cb(_0x24a9ff);});})['then'](function(){return new BPromise(function(_0x462442,_0x1c2e06){rimraf(_0x28bf33,function(_0x7a1250){if(_0x7a1250)_0x1c2e06(_0x7a1250);return _0x462442();});});})['then'](function(){return _0x3ebaf2[_0x111b('0x4f')](_0x46abe2,_0x3d38be,function(_0x4892c5){if(_0x4892c5){console[_0x111b('0x77')](_0x111b('0x78'),_0x4892c5);}else{fs[_0x111b('0x79')](_0x46abe2);}});});});}else{return _0x3ebaf2['sendStatus'](0xc8);}})[_0x111b('0x25')](handleError(_0x3ebaf2,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3669c93..1a728be 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 _0x61a5=['events','WhatsappInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x104530,_0x1a94c3){var _0x32821f=function(_0x61d9d0){while(--_0x61d9d0){_0x104530['push'](_0x104530['shift']());}};_0x32821f(++_0x1a94c3);}(_0x61a5,0x19e));var _0x561a=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x61a5[_0x5c4d27];return _0x1dda1a;};'use strict';var EventEmitter=require(_0x561a('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x561a('0x1')];var WhatsappMessage=require(_0x561a('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x561a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x561a('0x4'),'afterDestroy':_0x561a('0x5')};function emitEvent(_0x1d8bd8){return function(_0x1bce83,_0x2261b3,_0x28ff42){_0x1bce83[_0x561a('0x6')]({'attributes':['id'],'raw':!![]})[_0x561a('0x7')](function(_0x4c2853){_0x1bce83[_0x561a('0x8')](_0x561a('0x9'),_0x4c2853[_0x561a('0xa')](function(_0x5cd4f6){return{'id':_0x5cd4f6['id']};}));return WhatsappMessage[_0x561a('0xb')]({'where':{'WhatsappInteractionId':_0x1bce83['id'],'direction':'in','read':![]},'raw':!![]});})[_0x561a('0x7')](function(_0x5a4e9b){_0x1bce83[_0x561a('0x8')](_0x561a('0xc'),_0x5a4e9b[_0x561a('0xd')]);WhatsappInteractionEvents[_0x561a('0xe')](_0x1d8bd8+':'+_0x1bce83['id'],_0x1bce83);WhatsappInteractionEvents['emit'](_0x1d8bd8,_0x1bce83);_0x28ff42(null);})['catch'](_0x28ff42(null));};}for(var e in events){if(events[_0x561a('0xf')](e)){var event=events[e];WhatsappInteraction[_0x561a('0x10')](e,emitEvent(event));}}module[_0x561a('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x7341=['hasOwnProperty','hook','exports','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','unreadMessages','length','emit','catch'];(function(_0x10f891,_0x253e70){var _0x198927=function(_0x286d15){while(--_0x286d15){_0x10f891['push'](_0x10f891['shift']());}};_0x198927(++_0x253e70);}(_0x7341,0xe4));var _0x1734=function(_0x58587d,_0x1b76e6){_0x58587d=_0x58587d-0x0;var _0x4d9e07=_0x7341[_0x58587d];return _0x4d9e07;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x1734('0x0')];var WhatsappMessage=require('../../mysqldb')['db'][_0x1734('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1734('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1734('0x3'),'afterDestroy':_0x1734('0x4')};function emitEvent(_0x3010fd){return function(_0x17c3d7,_0x2de514,_0x21efd9){_0x17c3d7[_0x1734('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ca30b){_0x17c3d7[_0x1734('0x6')](_0x1734('0x7'),_0x1ca30b['map'](function(_0x77b042){return{'id':_0x77b042['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x17c3d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x55b846){_0x17c3d7[_0x1734('0x6')](_0x1734('0x8'),_0x55b846[_0x1734('0x9')]);WhatsappInteractionEvents[_0x1734('0xa')](_0x3010fd+':'+_0x17c3d7['id'],_0x17c3d7);WhatsappInteractionEvents[_0x1734('0xa')](_0x3010fd,_0x17c3d7);_0x21efd9(null);})[_0x1734('0xb')](_0x21efd9(null));};}for(var e in events){if(events[_0x1734('0xc')](e)){var event=events[e];WhatsappInteraction[_0x1734('0xd')](e,emitEvent(event));}}module[_0x1734('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 05516c8..b1dbf97 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 _0x2a9a=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closed','closedAt'];(function(_0x2a9c57,_0x4f4114){var _0x4d4183=function(_0x115c49){while(--_0x115c49){_0x2a9c57['push'](_0x2a9c57['shift']());}};_0x4d4183(++_0x4f4114);}(_0x2a9a,0x89));var _0xa2a9=function(_0xc3f41,_0x17b93e){_0xc3f41=_0xc3f41-0x0;var _0x55f58e=_0x2a9a[_0xc3f41];return _0x55f58e;};'use strict';var _=require(_0xa2a9('0x0'));var util=require(_0xa2a9('0x1'));var logger=require(_0xa2a9('0x2'))(_0xa2a9('0x3'));var moment=require(_0xa2a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa2a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa2a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa2a9('0x7'));module[_0xa2a9('0x8')]=function(_0x122bc8,_0x58a799){return _0x122bc8['define'](_0xa2a9('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a973d,_0x46ed6e,_0x415ae1){if(_0x2a973d[_0xa2a9('0xa')](_0xa2a9('0xb'))){_0x2a973d[_0xa2a9('0xc')]=moment()[_0xa2a9('0xd')](_0xa2a9('0xe'));}_0x415ae1(null,_0x2a973d);}}});}; \ No newline at end of file +var _0xeba8=['api','moment','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','changed','closed','closedAt','format','lodash','../../config/logger'];(function(_0x1924fd,_0x2ae46d){var _0x45df39=function(_0x5f5110){while(--_0x5f5110){_0x1924fd['push'](_0x1924fd['shift']());}};_0x45df39(++_0x2ae46d);}(_0xeba8,0x194));var _0x8eba=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0xeba8[_0x541260];return _0x1dd2b5;};'use strict';var _=require(_0x8eba('0x0'));var util=require('util');var logger=require(_0x8eba('0x1'))(_0x8eba('0x2'));var moment=require(_0x8eba('0x3'));var BPromise=require('bluebird');var rp=require(_0x8eba('0x4'));var fs=require('fs');var path=require(_0x8eba('0x5'));var rimraf=require('rimraf');var config=require(_0x8eba('0x6'));var attributes=require(_0x8eba('0x7'));module[_0x8eba('0x8')]=function(_0x1cc13b,_0x44256b){return _0x1cc13b[_0x8eba('0x9')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2bb5f8,_0x262de7,_0x5a3a35){if(_0x2bb5f8[_0x8eba('0xa')](_0x8eba('0xb'))){_0x2bb5f8[_0x8eba('0xc')]=moment()[_0x8eba('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5a3a35(null,_0x2bb5f8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6f0b619..0468910 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 _0xfbaa=['register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter'];(function(_0xe36749,_0x2a45c8){var _0x5d86b7=function(_0x1219e5){while(--_0x1219e5){_0xe36749['push'](_0xe36749['shift']());}};_0x5d86b7(++_0x2a45c8);}(_0xfbaa,0x75));var _0xafba=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xfbaa[_0x55d8c5];return _0x225ae5;};'use strict';var _=require(_0xafba('0x0'));var util=require(_0xafba('0x1'));var moment=require(_0xafba('0x2'));var BPromise=require('bluebird');var rs=require(_0xafba('0x3'));var fs=require('fs');var Redis=require(_0xafba('0x4'));var db=require(_0xafba('0x5'))['db'];var utils=require(_0xafba('0x6'));var logger=require('../../config/logger')(_0xafba('0x7'));var config=require(_0xafba('0x8'));var jayson=require(_0xafba('0x9'));var client=jayson[_0xafba('0xa')][_0xafba('0xb')]({'port':0x232a});config['redis']=_[_0xafba('0xc')](config['redis'],{'host':_0xafba('0xd'),'port':0x18eb});var socket=require(_0xafba('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xafba('0xf')](socket);function respondWithRpcPromise(_0x8c9671,_0xbd8bf4,_0x51c7b2){return new BPromise(function(_0x1f8f08,_0x16822f){return client[_0xafba('0x10')](_0x8c9671,_0x51c7b2)[_0xafba('0x11')](function(_0xfb698b){logger[_0xafba('0x12')](_0xafba('0x13'),_0xbd8bf4,_0xafba('0x14'));logger[_0xafba('0x15')](_0xafba('0x16'),_0xbd8bf4,'request\x20sent',JSON[_0xafba('0x17')](_0xfb698b));if(_0xfb698b[_0xafba('0x18')]){if(_0xfb698b[_0xafba('0x18')][_0xafba('0x19')]===0x1f4){logger[_0xafba('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0xbd8bf4,_0xfb698b[_0xafba('0x18')][_0xafba('0x1a')]);return _0x16822f(_0xfb698b['error'][_0xafba('0x1a')]);}logger[_0xafba('0x18')](_0xafba('0x13'),_0xbd8bf4,_0xfb698b[_0xafba('0x18')][_0xafba('0x1a')]);return _0x1f8f08(_0xfb698b[_0xafba('0x18')][_0xafba('0x1a')]);}else{logger['info'](_0xafba('0x13'),_0xbd8bf4,_0xafba('0x14'));_0x1f8f08(_0xfb698b[_0xafba('0x1b')][_0xafba('0x1a')]);}})[_0xafba('0x1c')](function(_0x8a43c9){logger[_0xafba('0x18')](_0xafba('0x13'),_0xbd8bf4,_0x8a43c9);_0x16822f(_0x8a43c9);});});}exports[_0xafba('0x1d')]=function(_0x3fa1be){var _0xe716ea=this;return new Promise(function(_0x1ddd15,_0x4266be){return db['WhatsappInteraction'][_0xafba('0x1e')](_0x3fa1be[_0xafba('0x1f')],{'raw':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be['options'][_0xafba('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be['options'][_0xafba('0x22')]||null:null,'attributes':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be[_0xafba('0x20')]['attributes']||null:null,'limit':_0x3fa1be[_0xafba('0x20')]?_0x3fa1be[_0xafba('0x20')][_0xafba('0x23')]||null:null})['then'](function(_0x13f119){logger['info'](_0xafba('0x1d'),_0x3fa1be);logger[_0xafba('0x15')](_0xafba('0x1d'),_0x3fa1be,JSON[_0xafba('0x17')](_0x13f119));_0x1ddd15(_0x13f119);})[_0xafba('0x1c')](function(_0x515609){logger[_0xafba('0x18')](_0xafba('0x1d'),_0x515609[_0xafba('0x1a')],_0x3fa1be);_0x4266be(_0xe716ea['error'](0x1f4,_0x515609['message']));});});};exports[_0xafba('0x24')]=function(_0x49c980){return new Promise(function(_0x426c42,_0x265437){return db[_0xafba('0x25')][_0xafba('0x26')]({'where':_0x49c980[_0xafba('0x20')]?_0x49c980[_0xafba('0x20')]['where']||null:null})[_0xafba('0x11')](function(_0xc767f2){if(_0xc767f2){return _0xc767f2[_0xafba('0x27')](_0x49c980[_0xafba('0x1f')][_0xafba('0x28')],_[_0xafba('0x29')](_0x49c980[_0xafba('0x1f')],['ids','id'])||{});}})[_0xafba('0x2a')](function(_0x50d8b6){logger[_0xafba('0x12')](_0xafba('0x2b'),_0x49c980);logger['debug'](_0xafba('0x2b'),_0x49c980,JSON['stringify'](_0x50d8b6));_0x426c42(_0x50d8b6);})[_0xafba('0x1c')](function(_0x6d5afc){logger[_0xafba('0x18')]('AddTags',_0x6d5afc['message'],_0x49c980);_0x265437(_this['error'](0x1f4,_0x6d5afc[_0xafba('0x1a')]));});});}; \ No newline at end of file +var _0x9413=['WhatsappInteraction','options','raw','attributes','limit','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','find','ids','omit','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4f549c,_0x4466ba){var _0x20e779=function(_0x50b4d9){while(--_0x50b4d9){_0x4f549c['push'](_0x4f549c['shift']());}};_0x20e779(++_0x4466ba);}(_0x9413,0x108));var _0x3941=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x9413[_0x50fda9];return _0x36b92b;};'use strict';var _=require(_0x3941('0x0'));var util=require(_0x3941('0x1'));var moment=require(_0x3941('0x2'));var BPromise=require('bluebird');var rs=require(_0x3941('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3941('0x4'))['db'];var utils=require(_0x3941('0x5'));var logger=require(_0x3941('0x6'))(_0x3941('0x7'));var config=require(_0x3941('0x8'));var jayson=require(_0x3941('0x9'));var client=jayson[_0x3941('0xa')][_0x3941('0xb')]({'port':0x232a});config[_0x3941('0xc')]=_[_0x3941('0xd')](config[_0x3941('0xc')],{'host':_0x3941('0xe'),'port':0x18eb});var socket=require(_0x3941('0xf'))(new Redis(config['redis']));require(_0x3941('0x10'))[_0x3941('0x11')](socket);function respondWithRpcPromise(_0x385cde,_0x552751,_0x3218ab){return new BPromise(function(_0x28a781,_0x1bd5a8){return client[_0x3941('0x12')](_0x385cde,_0x3218ab)[_0x3941('0x13')](function(_0x394d2d){logger[_0x3941('0x14')](_0x3941('0x15'),_0x552751,'request\x20sent');logger['debug'](_0x3941('0x16'),_0x552751,'request\x20sent',JSON[_0x3941('0x17')](_0x394d2d));if(_0x394d2d[_0x3941('0x18')]){if(_0x394d2d[_0x3941('0x18')][_0x3941('0x19')]===0x1f4){logger[_0x3941('0x18')](_0x3941('0x15'),_0x552751,_0x394d2d[_0x3941('0x18')][_0x3941('0x1a')]);return _0x1bd5a8(_0x394d2d['error'][_0x3941('0x1a')]);}logger[_0x3941('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x552751,_0x394d2d['error'][_0x3941('0x1a')]);return _0x28a781(_0x394d2d[_0x3941('0x18')][_0x3941('0x1a')]);}else{logger[_0x3941('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x552751,_0x3941('0x1b'));_0x28a781(_0x394d2d[_0x3941('0x1c')][_0x3941('0x1a')]);}})[_0x3941('0x1d')](function(_0x206d6b){logger[_0x3941('0x18')](_0x3941('0x15'),_0x552751,_0x206d6b);_0x1bd5a8(_0x206d6b);});});}exports['UpdateWhatsappInteraction']=function(_0x5d1a4d){var _0x11cfa1=this;return new Promise(function(_0x3aa920,_0x2c7d26){return db[_0x3941('0x1e')]['update'](_0x5d1a4d['body'],{'raw':_0x5d1a4d['options']?_0x5d1a4d[_0x3941('0x1f')][_0x3941('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1a4d[_0x3941('0x1f')]?_0x5d1a4d[_0x3941('0x1f')]['where']||null:null,'attributes':_0x5d1a4d[_0x3941('0x1f')]?_0x5d1a4d[_0x3941('0x1f')][_0x3941('0x21')]||null:null,'limit':_0x5d1a4d[_0x3941('0x1f')]?_0x5d1a4d[_0x3941('0x1f')][_0x3941('0x22')]||null:null})[_0x3941('0x13')](function(_0x2aee70){logger[_0x3941('0x14')](_0x3941('0x23'),_0x5d1a4d);logger[_0x3941('0x24')](_0x3941('0x23'),_0x5d1a4d,JSON[_0x3941('0x17')](_0x2aee70));_0x3aa920(_0x2aee70);})[_0x3941('0x1d')](function(_0x2ae715){logger['error'](_0x3941('0x23'),_0x2ae715['message'],_0x5d1a4d);_0x2c7d26(_0x11cfa1[_0x3941('0x18')](0x1f4,_0x2ae715[_0x3941('0x1a')]));});});};exports[_0x3941('0x25')]=function(_0x166048){return new Promise(function(_0x2a732e,_0x157f16){return db[_0x3941('0x1e')][_0x3941('0x26')]({'where':_0x166048['options']?_0x166048[_0x3941('0x1f')]['where']||null:null})['then'](function(_0x312845){if(_0x312845){return _0x312845['addTags'](_0x166048['body'][_0x3941('0x27')],_[_0x3941('0x28')](_0x166048['body'],[_0x3941('0x27'),'id'])||{});}})['spread'](function(_0x14c423){logger['info'](_0x3941('0x29'),_0x166048);logger[_0x3941('0x24')](_0x3941('0x29'),_0x166048,JSON[_0x3941('0x17')](_0x14c423));_0x2a732e(_0x14c423);})[_0x3941('0x1d')](function(_0x453386){logger[_0x3941('0x18')](_0x3941('0x29'),_0x453386[_0x3941('0x1a')],_0x166048);_0x157f16(_this[_0x3941('0x18')](0x1f4,_0x453386[_0x3941('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 29f086c..7d11c9c 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 _0xcfbb=['emit','removeListener','register','whatsappInteraction:','save','remove','update'];(function(_0x481604,_0x276ff8){var _0x1ca4ed=function(_0x136e9d){while(--_0x136e9d){_0x481604['push'](_0x481604['shift']());}};_0x1ca4ed(++_0x276ff8);}(_0xcfbb,0x6d));var _0xbcfb=function(_0x3a5511,_0x46ee32){_0x3a5511=_0x3a5511-0x0;var _0x5e85a6=_0xcfbb[_0x3a5511];return _0x5e85a6;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xbcfb('0x0'),_0xbcfb('0x1'),_0xbcfb('0x2')];function createListener(_0x5a9d57,_0x1d715b){return function(_0x3df086){_0x1d715b[_0xbcfb('0x3')](_0x5a9d57,_0x3df086);};}function removeListener(_0x394132,_0x5c57fc){return function(){WhatsappInteractionEvents[_0xbcfb('0x4')](_0x394132,_0x5c57fc);};}exports[_0xbcfb('0x5')]=function(_0x54405b){for(var _0x2822fb=0x0,_0x5863c1=events['length'];_0x2822fb<_0x5863c1;_0x2822fb++){var _0x280bfb=events[_0x2822fb];var _0x45ddd1=createListener(_0xbcfb('0x6')+_0x280bfb,_0x54405b);WhatsappInteractionEvents['on'](_0x280bfb,_0x45ddd1);}}; \ No newline at end of file +var _0xd624=['./whatsappInteraction.events','save','remove','update','removeListener','length'];(function(_0x28d5e6,_0x4db88d){var _0x36f38c=function(_0x40b7e2){while(--_0x40b7e2){_0x28d5e6['push'](_0x28d5e6['shift']());}};_0x36f38c(++_0x4db88d);}(_0xd624,0x150));var _0x4d62=function(_0x1ad5d7,_0x1a1f86){_0x1ad5d7=_0x1ad5d7-0x0;var _0x15fcc9=_0xd624[_0x1ad5d7];return _0x15fcc9;};'use strict';var WhatsappInteractionEvents=require(_0x4d62('0x0'));var events=[_0x4d62('0x1'),_0x4d62('0x2'),_0x4d62('0x3')];function createListener(_0x51f209,_0xc18069){return function(_0x20f645){_0xc18069['emit'](_0x51f209,_0x20f645);};}function removeListener(_0x479816,_0x5e5107){return function(){WhatsappInteractionEvents[_0x4d62('0x4')](_0x479816,_0x5e5107);};}exports['register']=function(_0x50acd5){for(var _0x357e86=0x0,_0x4f08cc=events[_0x4d62('0x5')];_0x357e86<_0x4f08cc;_0x357e86++){var _0x9a43e6=events[_0x357e86];var _0x5c7e49=createListener('whatsappInteraction:'+_0x9a43e6,_0x50acd5);WhatsappInteractionEvents['on'](_0x9a43e6,_0x5c7e49);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 724ccb1..7eb8457 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 _0xbd3c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x20c52e,_0x86162d){var _0x2b0651=function(_0xdab9dc){while(--_0xdab9dc){_0x20c52e['push'](_0x20c52e['shift']());}};_0x2b0651(++_0x86162d);}(_0xbd3c,0xe7));var _0xcbd3=function(_0x201ef0,_0xae1e89){_0x201ef0=_0x201ef0-0x0;var _0x5a5bae=_0xbd3c[_0x201ef0];return _0x5a5bae;};'use strict';var multer=require(_0xcbd3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd3('0x1'));var router=express['Router']();var fs_extra=require(_0xcbd3('0x2'));var auth=require(_0xcbd3('0x3'));var interaction=require(_0xcbd3('0x4'));var config=require(_0xcbd3('0x5'));var controller=require(_0xcbd3('0x6'));router[_0xcbd3('0x7')]('/',auth['isAuthenticated'](),controller[_0xcbd3('0x8')]);router[_0xcbd3('0x7')](_0xcbd3('0x9'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0xb')]);router[_0xcbd3('0x7')]('/:id',auth[_0xcbd3('0xa')](),controller[_0xcbd3('0xc')]);router[_0xcbd3('0xd')]('/',auth[_0xcbd3('0xa')](),interaction[_0xcbd3('0xe')](_0xcbd3('0xf'),_0xcbd3('0x10')),controller[_0xcbd3('0x11')]);router['post'](_0xcbd3('0x12'),controller['status']);router[_0xcbd3('0x13')](_0xcbd3('0x14'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x15')]);router['put'](_0xcbd3('0x16'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x17')]);router['put'](_0xcbd3('0x18'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x19')]);router[_0xcbd3('0x1a')](_0xcbd3('0x14'),auth[_0xcbd3('0xa')](),controller[_0xcbd3('0x1b')]);module[_0xcbd3('0x1c')]=router; \ No newline at end of file +var _0xb45f=['/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create'];(function(_0x274cf0,_0x3e2917){var _0x353948=function(_0x1cf7d5){while(--_0x1cf7d5){_0x274cf0['push'](_0x274cf0['shift']());}};_0x353948(++_0x3e2917);}(_0xb45f,0xea));var _0xfb45=function(_0x269a3a,_0x22cdc6){_0x269a3a=_0x269a3a-0x0;var _0x11be08=_0xb45f[_0x269a3a];return _0x11be08;};'use strict';var multer=require(_0xfb45('0x0'));var util=require(_0xfb45('0x1'));var path=require(_0xfb45('0x2'));var timeout=require(_0xfb45('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfb45('0x4'));var auth=require(_0xfb45('0x5'));var interaction=require(_0xfb45('0x6'));var config=require(_0xfb45('0x7'));var controller=require(_0xfb45('0x8'));router[_0xfb45('0x9')]('/',auth[_0xfb45('0xa')](),controller['index']);router['get']('/describe',auth[_0xfb45('0xa')](),controller[_0xfb45('0xb')]);router['get'](_0xfb45('0xc'),auth[_0xfb45('0xa')](),controller[_0xfb45('0xd')]);router[_0xfb45('0xe')]('/',auth[_0xfb45('0xa')](),interaction[_0xfb45('0xf')](_0xfb45('0x10'),_0xfb45('0x11')),controller['create']);router[_0xfb45('0xe')](_0xfb45('0x12'),controller[_0xfb45('0x13')]);router['put']('/:id',auth[_0xfb45('0xa')](),controller[_0xfb45('0x14')]);router[_0xfb45('0x15')](_0xfb45('0x16'),auth[_0xfb45('0xa')](),controller[_0xfb45('0x17')]);router[_0xfb45('0x15')](_0xfb45('0x18'),auth['isAuthenticated'](),controller[_0xfb45('0x19')]);router[_0xfb45('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfb45('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c7f441e..7561280 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 _0xa453=['TEXT','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa453,0x1a2));var _0x3a45=function(_0x172cf7,_0x33592f){_0x172cf7=_0x172cf7-0x0;var _0x560d16=_0xa453[_0x172cf7];return _0x560d16;};'use strict';var Sequelize=require(_0x3a45('0x0'));module[_0x3a45('0x1')]={'body':{'type':Sequelize[_0x3a45('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3a45('0x3')]('in',_0x3a45('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3a45('0x5')]},'readAt':{'type':Sequelize[_0x3a45('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd7ae=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ae,0x10b));var _0xed7a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd7ae[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xed7a('0x0'));module[_0xed7a('0x1')]={'body':{'type':Sequelize[_0xed7a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xed7a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xed7a('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xed7a('0x5')](0xbe)},'phone':{'type':Sequelize[_0xed7a('0x5')]},'readAt':{'type':Sequelize[_0xed7a('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xed7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 14d305b..c3fec26 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 _0xb5db=['agent','fullname','email','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','internal','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','destroy','name','send','map','WhatsappMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','update','params','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb5db,0xaa));var _0xbb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5db[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb5d('0x0'));var zipdir=require(_0xbb5d('0x1'));var jsonpatch=require(_0xbb5d('0x2'));var rp=require(_0xbb5d('0x3'));var moment=require(_0xbb5d('0x4'));var BPromise=require(_0xbb5d('0x5'));var Mustache=require(_0xbb5d('0x6'));var util=require('util');var path=require(_0xbb5d('0x7'));var sox=require(_0xbb5d('0x8'));var csv=require(_0xbb5d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb5d('0xa'));var _=require(_0xbb5d('0xb'));var squel=require('squel');var crypto=require(_0xbb5d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbb5d('0xd'));var toCsv=require(_0xbb5d('0x9'));var querystring=require(_0xbb5d('0xe'));var Papa=require(_0xbb5d('0xf'));var Redis=require(_0xbb5d('0x10'));var authService=require(_0xbb5d('0x11'));var qs=require(_0xbb5d('0x12'));var as=require(_0xbb5d('0x13'));var hardwareService=require(_0xbb5d('0x14'));var logger=require('../../config/logger')(_0xbb5d('0x15'));var utils=require('../../config/utils');var config=require(_0xbb5d('0x16'));var licenseUtil=require(_0xbb5d('0x17'));var db=require(_0xbb5d('0x18'))['db'];config[_0xbb5d('0x19')]=_['defaults'](config[_0xbb5d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb5d('0x1a'))(new Redis(config[_0xbb5d('0x19')]));require(_0xbb5d('0x1b'))[_0xbb5d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbb5d('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xbb5d('0x1d')][_0xbb5d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5196b0,_0x5f2206,_0x48cea0,_0x2cc866){return new BPromise(function(_0x19ea85,_0x56de0b){var _0x262cc5=_0x2cc866||client;return _0x262cc5[_0xbb5d('0x1f')](_0x5196b0,_0x48cea0)[_0xbb5d('0x20')](function(_0x238e83){logger['info'](_0xbb5d('0x21'),_0x5f2206,_0xbb5d('0x22'));logger[_0xbb5d('0x23')](_0xbb5d('0x24'),_0x5f2206,'request\x20sent',JSON[_0xbb5d('0x25')](_0x238e83));if(_0x238e83[_0xbb5d('0x26')]){if(_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x27')]===0x1f4){logger[_0xbb5d('0x26')](_0xbb5d('0x21'),_0x5f2206,_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);return _0x56de0b(_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);}logger['error'](_0xbb5d('0x21'),_0x5f2206,_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);return _0x19ea85(_0x238e83[_0xbb5d('0x26')][_0xbb5d('0x28')]);}else{logger[_0xbb5d('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x5f2206,_0xbb5d('0x22'));_0x19ea85(_0x238e83[_0xbb5d('0x2a')][_0xbb5d('0x28')]);}})['catch'](function(_0x3fe963){logger['error'](_0xbb5d('0x21'),_0x5f2206,_0x3fe963);_0x56de0b(_0x3fe963);});});}function respondWithStatusCode(_0x559651,_0x4d8077){_0x4d8077=_0x4d8077||0xcc;return function(_0x2318d4){if(_0x2318d4){return _0x559651['sendStatus'](_0x4d8077);}return _0x559651[_0xbb5d('0x2b')](_0x4d8077)[_0xbb5d('0x2c')]();};}function respondWithResult(_0x176d4c,_0x27f6da){_0x27f6da=_0x27f6da||0xc8;return function(_0x372c3a){if(_0x372c3a){return _0x176d4c[_0xbb5d('0x2b')](_0x27f6da)['json'](_0x372c3a);}};}function respondWithFilteredResult(_0x425ec2,_0x2bdc53){return function(_0x527e99){if(_0x527e99){var _0xa098f1=typeof _0x2bdc53['offset']===_0xbb5d('0x2d')&&typeof _0x2bdc53[_0xbb5d('0x2e')]===_0xbb5d('0x2d');var _0x3ec514=_0x527e99[_0xbb5d('0x2f')];var _0x810e7e=_0xa098f1?0x0:_0x2bdc53[_0xbb5d('0x30')];var _0x585e3a=_0xa098f1?_0x527e99[_0xbb5d('0x2f')]:_0x2bdc53['offset']+_0x2bdc53['limit'];var _0x1039c1;if(_0x585e3a>=_0x3ec514){_0x585e3a=_0x3ec514;_0x1039c1=0xc8;}else{_0x1039c1=0xce;}_0x425ec2[_0xbb5d('0x2b')](_0x1039c1);return _0x425ec2[_0xbb5d('0x31')](_0xbb5d('0x32'),_0x810e7e+'-'+_0x585e3a+'/'+_0x3ec514)[_0xbb5d('0x33')](_0x527e99);}return null;};}function patchUpdates(_0x13824e){return function(_0x4d348f){try{jsonpatch[_0xbb5d('0x34')](_0x4d348f,_0x13824e,!![]);}catch(_0x237267){return BPromise['reject'](_0x237267);}return _0x4d348f[_0xbb5d('0x35')]();};}function saveUpdates(_0x169689,_0x1dff54){return function(_0x59fe92){if(_0x59fe92){return _0x59fe92['update'](_0x169689)[_0xbb5d('0x20')](function(_0xd9b197){return _0xd9b197;});}return null;};}function removeEntity(_0x671b2,_0x102eac){return function(_0x22ad94){if(_0x22ad94){return _0x22ad94[_0xbb5d('0x36')]()['then'](function(){_0x671b2[_0xbb5d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b4ae,_0x1486a5){return function(_0x47affc){if(!_0x47affc){_0x55b4ae['sendStatus'](0x194);}return _0x47affc;};}function handleError(_0x31eac8,_0x5a8aee){_0x5a8aee=_0x5a8aee||0x1f4;return function(_0x4c40be){logger['error'](_0x4c40be['stack']);if(_0x4c40be['name']){delete _0x4c40be[_0xbb5d('0x37')];}_0x31eac8[_0xbb5d('0x2b')](_0x5a8aee)[_0xbb5d('0x38')](_0x4c40be);};}exports['index']=function(_0x1f00dd,_0x4d19a0){var _0x17327a={},_0x2e1f91={},_0x586eab={'count':0x0,'rows':[]};var _0x3f4912=_[_0xbb5d('0x39')](db[_0xbb5d('0x3a')]['rawAttributes'],function(_0x3f6dcf){return{'name':_0x3f6dcf[_0xbb5d('0x3b')],'type':_0x3f6dcf[_0xbb5d('0x3c')][_0xbb5d('0x3d')]};});_0x2e1f91[_0xbb5d('0x3e')]=_[_0xbb5d('0x39')](_0x3f4912,_0xbb5d('0x37'));_0x2e1f91[_0xbb5d('0x3f')]=_['keys'](_0x1f00dd[_0xbb5d('0x3f')]);_0x2e1f91[_0xbb5d('0x40')]=_[_0xbb5d('0x41')](_0x2e1f91['model'],_0x2e1f91[_0xbb5d('0x3f')]);_0x17327a[_0xbb5d('0x42')]=_[_0xbb5d('0x41')](_0x2e1f91['model'],qs[_0xbb5d('0x43')](_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x43')]));_0x17327a[_0xbb5d('0x42')]=_0x17327a[_0xbb5d('0x42')][_0xbb5d('0x44')]?_0x17327a[_0xbb5d('0x42')]:_0x2e1f91[_0xbb5d('0x3e')];if(!_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x45')](_0xbb5d('0x46'))){_0x17327a[_0xbb5d('0x2e')]=qs[_0xbb5d('0x2e')](_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x2e')]);_0x17327a['offset']=qs[_0xbb5d('0x30')](_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x30')]);}_0x17327a['order']=qs[_0xbb5d('0x47')](_0x1f00dd[_0xbb5d('0x3f')]['sort']);_0x17327a[_0xbb5d('0x48')]=qs['filters'](_['pick'](_0x1f00dd[_0xbb5d('0x3f')],_0x2e1f91['filters']),_0x3f4912);if(_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x49')]){_0x17327a['where']=_[_0xbb5d('0x4a')](_0x17327a[_0xbb5d('0x48')],{'$or':_['map'](_0x3f4912,function(_0xd6e49d){if(_0xd6e49d['type']!==_0xbb5d('0x4b')){var _0x5d1917={};_0x5d1917[_0xd6e49d['name']]={'$like':'%'+_0x1f00dd[_0xbb5d('0x3f')]['filter']+'%'};return _0x5d1917;}})});}_0x17327a=_[_0xbb5d('0x4a')]({},_0x17327a,_0x1f00dd[_0xbb5d('0x4c')]);var _0x19c5f7={'where':_0x17327a[_0xbb5d('0x48')]};return db[_0xbb5d('0x3a')][_0xbb5d('0x2f')](_0x19c5f7)[_0xbb5d('0x20')](function(_0x268f48){_0x586eab[_0xbb5d('0x2f')]=_0x268f48;if(_0x1f00dd[_0xbb5d('0x3f')][_0xbb5d('0x4d')]){_0x17327a[_0xbb5d('0x4e')]=[{'all':!![]}];}return db[_0xbb5d('0x3a')][_0xbb5d('0x4f')](_0x17327a);})['then'](function(_0x19b4af){_0x586eab[_0xbb5d('0x50')]=_0x19b4af;return _0x586eab;})[_0xbb5d('0x20')](respondWithFilteredResult(_0x4d19a0,_0x17327a))[_0xbb5d('0x51')](handleError(_0x4d19a0,null));};exports[_0xbb5d('0x52')]=function(_0x257885,_0x42cc3d){var _0x1860ff={'raw':!![],'where':{'id':_0x257885['params']['id']}},_0x35dce6={};_0x35dce6['model']=_['keys'](db['WhatsappMessage'][_0xbb5d('0x53')]);_0x35dce6[_0xbb5d('0x3f')]=_[_0xbb5d('0x54')](_0x257885[_0xbb5d('0x3f')]);_0x35dce6[_0xbb5d('0x40')]=_['intersection'](_0x35dce6[_0xbb5d('0x3e')],_0x35dce6[_0xbb5d('0x3f')]);_0x1860ff[_0xbb5d('0x42')]=_[_0xbb5d('0x41')](_0x35dce6['model'],qs[_0xbb5d('0x43')](_0x257885[_0xbb5d('0x3f')][_0xbb5d('0x43')]));_0x1860ff[_0xbb5d('0x42')]=_0x1860ff['attributes'][_0xbb5d('0x44')]?_0x1860ff[_0xbb5d('0x42')]:_0x35dce6[_0xbb5d('0x3e')];if(_0x257885[_0xbb5d('0x3f')][_0xbb5d('0x4d')]){_0x1860ff[_0xbb5d('0x4e')]=[{'all':!![]}];}_0x1860ff=_[_0xbb5d('0x4a')]({},_0x1860ff,_0x257885['options']);return db['WhatsappMessage'][_0xbb5d('0x55')](_0x1860ff)[_0xbb5d('0x20')](handleEntityNotFound(_0x42cc3d,null))[_0xbb5d('0x20')](respondWithResult(_0x42cc3d,null))['catch'](handleError(_0x42cc3d,null));};exports['create']=function(_0x4c8f95,_0x51caec){return db[_0xbb5d('0x3a')][_0xbb5d('0x56')](_0x4c8f95[_0xbb5d('0x57')],{})[_0xbb5d('0x20')](respondWithResult(_0x51caec,0xc9))[_0xbb5d('0x51')](handleError(_0x51caec,null));};exports[_0xbb5d('0x58')]=function(_0x37b299,_0x16e948){if(_0x37b299[_0xbb5d('0x57')]['id']){delete _0x37b299[_0xbb5d('0x57')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x37b299[_0xbb5d('0x59')]['id']}})[_0xbb5d('0x20')](handleEntityNotFound(_0x16e948,null))['then'](saveUpdates(_0x37b299[_0xbb5d('0x57')],null))['then'](respondWithResult(_0x16e948,null))[_0xbb5d('0x51')](handleError(_0x16e948,null));};exports[_0xbb5d('0x36')]=function(_0x29732d,_0x47d87d){return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x29732d[_0xbb5d('0x59')]['id']}})[_0xbb5d('0x20')](handleEntityNotFound(_0x47d87d,null))[_0xbb5d('0x20')](removeEntity(_0x47d87d,null))[_0xbb5d('0x51')](handleError(_0x47d87d,null));};exports[_0xbb5d('0x5a')]=function(_0x2b4d53,_0x46a9d5){return db[_0xbb5d('0x3a')]['describe']()[_0xbb5d('0x20')](respondWithResult(_0x46a9d5,null))[_0xbb5d('0x51')](handleError(_0x46a9d5,null));};var interaction_log=require(_0xbb5d('0x5b'))(_0xbb5d('0x5c'));exports['accept']=function(_0x19d293,_0x55a452,_0x330a0e){var _0x4914d7={'agent':{},'channel':_0xbb5d('0x5d')};if(_0x19d293[_0xbb5d('0x57')]['id']){delete _0x19d293['body']['id'];}_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x5e')]=!![];_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x5f')]=moment()['format'](_0xbb5d('0x60'));_0x19d293['body'][_0xbb5d('0x61')]=_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')]||_0x19d293[_0xbb5d('0x62')]['id'];_0x4914d7['agent']['id']=_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')];return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x19d293['params']['id'],'UserId':null}})[_0xbb5d('0x20')](handleEntityNotFound(_0x55a452,null))[_0xbb5d('0x20')](saveUpdates(_0x19d293[_0xbb5d('0x57')],null))['then'](function(_0x4e760b){if(_0x4e760b){_0x4914d7['message']=_0x4e760b[_0xbb5d('0x63')]({'plain':!![]});return db[_0xbb5d('0x64')][_0xbb5d('0x55')]({'where':{'id':_0x4e760b[_0xbb5d('0x65')]}});}return null;})[_0xbb5d('0x20')](handleEntityNotFound(_0x55a452,null))[_0xbb5d('0x20')](function(_0x1f80f1){if(_0x1f80f1){return _0x1f80f1[_0xbb5d('0x58')]({'UserId':_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')],'read1stAt':_[_0xbb5d('0x66')](_0x1f80f1[_0xbb5d('0x67')])?moment()[_0xbb5d('0x68')](_0xbb5d('0x60')):undefined});}return null;})['then'](function(_0x4e81f1){if(_0x4e81f1){_0x4914d7['interaction']=_0x4e81f1[_0xbb5d('0x63')]({'plain':!![]});interaction_log['info'](_0xbb5d('0x69'),_0x19d293[_0xbb5d('0x62')]['id'],_0x19d293[_0xbb5d('0x62')][_0xbb5d('0x37')],_0x19d293['user'][_0xbb5d('0x6a')],_0x4914d7[_0xbb5d('0x6b')]['id'],_0x19d293[_0xbb5d('0x57')]?JSON[_0xbb5d('0x25')](_0x19d293['body']):_0xbb5d('0x6c'));return respondWithRpcPromise(_0xbb5d('0x6d'),_0xbb5d('0x6e'),_0x4914d7);}return null;})[_0xbb5d('0x20')](function(_0x110d7f){var _0x1cbeb0=_0xbb5d('0x6f')+_0x110d7f['message'][_0xbb5d('0x70')];return db[_0xbb5d('0x71')]['query'](_0x1cbeb0,{'type':db['Sequelize'][_0xbb5d('0x72')][_0xbb5d('0x73')],'raw':!![]})['then'](function(_0xca9015){return _0xca9015;});})['then'](function(_0x4b9e2a){if(_0x4b9e2a){_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x74')]=_0x4b9e2a[0x0];if(!_0x19d293[_0xbb5d('0x57')][_0xbb5d('0x61')])return;return db[_0xbb5d('0x75')]['find']({'where':{'id':_0x19d293['body'][_0xbb5d('0x61')],'role':_0xbb5d('0x76')},'attributes':['id',_0xbb5d('0x37'),_0xbb5d('0x77'),_0xbb5d('0x78'),'internal'],'raw':!![]});}return null;})[_0xbb5d('0x20')](function(_0x192f34){if(!_0x192f34)return null;_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x76')]=_0x192f34;return _0x4914d7;})[_0xbb5d('0x20')](function(_0x45f3b2){if(_0x45f3b2){if(_0x19d293[_0xbb5d('0x57')]['manual']){_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x79')]=util[_0xbb5d('0x68')](_0xbb5d('0x7a'),_0x19d293['user'][_0xbb5d('0x37')]);_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x7b')]=_0x4914d7[_0xbb5d('0x7b')];_0x4914d7[_0xbb5d('0x28')][_0xbb5d('0x7c')]=_0x4914d7[_0xbb5d('0x7b')];_0x4914d7['message'][_0xbb5d('0x7d')]=_0xbb5d('0x7e');return respondWithRpcPromise(_0xbb5d('0x7f'),'EventManager',{'event':_0xbb5d('0x80'),'message':_0x4914d7['message']},client9002)['then'](function(){return _0x4914d7;});}return _0x4914d7;}return null;})['then'](respondWithResult(_0x55a452,null))['catch'](handleError(_0x55a452,null));};var interaction_log=require('../../config/logger')(_0xbb5d('0x5c'));exports[_0xbb5d('0x81')]=function(_0x308a3e,_0x1b40a0,_0x1980b3){var _0x5385da={'agent':{},'channel':_0xbb5d('0x5d')};if(_0x308a3e[_0xbb5d('0x57')]['id']){delete _0x308a3e[_0xbb5d('0x57')]['id'];}_0x308a3e['body'][_0xbb5d('0x61')]=_0x308a3e[_0xbb5d('0x57')][_0xbb5d('0x61')]||_0x308a3e['user']['id'];_0x5385da[_0xbb5d('0x76')]['id']=_0x308a3e[_0xbb5d('0x57')][_0xbb5d('0x61')];return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x308a3e[_0xbb5d('0x59')]['id'],'UserId':null}})[_0xbb5d('0x20')](handleEntityNotFound(_0x1b40a0,null))['then'](function(_0x4a18eb){if(_0x4a18eb){_0x5385da[_0xbb5d('0x28')]=_0x4a18eb[_0xbb5d('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0xbb5d('0x55')]({'where':{'id':_0x4a18eb[_0xbb5d('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1b40a0,null))['then'](function(_0x21703c){if(_0x21703c){_0x5385da[_0xbb5d('0x6b')]=_0x21703c[_0xbb5d('0x63')]({'plain':!![]});interaction_log['info'](_0xbb5d('0x82'),_0x308a3e[_0xbb5d('0x62')]['id'],_0x308a3e[_0xbb5d('0x62')][_0xbb5d('0x37')],_0x308a3e[_0xbb5d('0x62')][_0xbb5d('0x6a')],_0x5385da[_0xbb5d('0x6b')]['id'],_0x308a3e[_0xbb5d('0x57')]?JSON[_0xbb5d('0x25')](_0x308a3e[_0xbb5d('0x57')]):_0xbb5d('0x6c'));return respondWithRpcPromise(_0xbb5d('0x83'),_0xbb5d('0x84'),_0x5385da);}return null;})['then'](function(_0x131ac4){var _0x34efb9=_0xbb5d('0x6f')+_0x131ac4[_0xbb5d('0x28')]['ContactId'];return db[_0xbb5d('0x71')][_0xbb5d('0x3f')](_0x34efb9,{'type':db[_0xbb5d('0x85')][_0xbb5d('0x72')][_0xbb5d('0x73')],'raw':!![]})[_0xbb5d('0x20')](function(_0xc76227){return _0xc76227;});})[_0xbb5d('0x20')](function(_0x341347){if(_0x341347){_0x5385da[_0xbb5d('0x28')][_0xbb5d('0x74')]=_0x341347[0x0];if(!_0x308a3e['body'][_0xbb5d('0x61')])return;return db[_0xbb5d('0x75')][_0xbb5d('0x55')]({'where':{'id':_0x308a3e[_0xbb5d('0x57')][_0xbb5d('0x61')],'role':_0xbb5d('0x76')},'attributes':['id',_0xbb5d('0x37'),_0xbb5d('0x77'),_0xbb5d('0x78'),_0xbb5d('0x86')],'raw':!![]});}return null;})[_0xbb5d('0x20')](function(_0x3b99df){if(!_0x3b99df)return null;_0x5385da[_0xbb5d('0x28')][_0xbb5d('0x76')]=_0x3b99df;return _0x5385da;})[_0xbb5d('0x20')](function(_0x42a101){if(_0x42a101){_0x42a101['message'][_0xbb5d('0x79')]=util['format']('SIP/%s',_0x308a3e[_0xbb5d('0x62')][_0xbb5d('0x37')]);_0x42a101[_0xbb5d('0x28')]['channel']=_0x5385da[_0xbb5d('0x7b')];_0x42a101[_0xbb5d('0x28')][_0xbb5d('0x7c')]=_0x5385da[_0xbb5d('0x7b')];_0x42a101[_0xbb5d('0x28')][_0xbb5d('0x7d')]='reject';respondWithRpcPromise(_0xbb5d('0x7f'),_0xbb5d('0x7f'),{'event':'rejectmessage','message':_0x42a101[_0xbb5d('0x28')]},client9002);return _0x5385da;}return null;})[_0xbb5d('0x20')](respondWithResult(_0x1b40a0,null))[_0xbb5d('0x51')](handleError(_0x1b40a0,null));};exports[_0xbb5d('0x2b')]=function(_0x1a94bc,_0x12e3ff,_0x18fd82){if(_0x1a94bc['body']['id']){delete _0x1a94bc[_0xbb5d('0x57')]['id'];}var _0x16e72b;return db[_0xbb5d('0x3a')][_0xbb5d('0x55')]({'where':{'id':_0x1a94bc[_0xbb5d('0x59')]['id']}})['then'](handleEntityNotFound(_0x12e3ff,null))[_0xbb5d('0x20')](function(_0x5e0dd5){if(_0x5e0dd5){_0x16e72b=_0x5e0dd5;return db['WhatsappAccount'][_0xbb5d('0x55')]({'where':{'id':_0x5e0dd5[_0xbb5d('0x87')]}});}})['then'](handleEntityNotFound(_0x12e3ff,null))[_0xbb5d('0x20')](function(_0xf451de){if(_0xf451de){logger[_0xbb5d('0x23')](_0xbb5d('0x88'),'status',_0xbb5d('0x89'),_0xf451de[_0xbb5d('0x3c')],util['inspect'](_0x1a94bc[_0xbb5d('0x57')],{'showHidden':![],'depth':null}));switch(_0xf451de[_0xbb5d('0x3c')]){case'twilio':if(_0x1a94bc[_0xbb5d('0x57')][_0xbb5d('0x8a')]&&_0x1a94bc['body'][_0xbb5d('0x8a')]===_0x16e72b[_0xbb5d('0x8b')]&&_0x1a94bc[_0xbb5d('0x57')][_0xbb5d('0x8c')]&&_0x1a94bc['body'][_0xbb5d('0x8c')]==='read'){return _0x16e72b[_0xbb5d('0x58')]({'read':!![]});}else{logger[_0xbb5d('0x26')](_0xbb5d('0x8d'),_0xbb5d('0x2b'),_0xbb5d('0x8e'),util[_0xbb5d('0x8f')](_0x1a94bc[_0xbb5d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x16e72b;}})[_0xbb5d('0x20')](respondWithResult(_0x12e3ff,null))[_0xbb5d('0x51')](handleError(_0x12e3ff,null));}; \ No newline at end of file +var _0x9e65=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','WhatsappMessage','includeAll','include','params','merge','create','body','find','describe','whatsapp-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE: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','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp','RejectMessage','rejectMessage','Sequelize','email','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf'];(function(_0xd72620,_0x24ea3f){var _0x58b32a=function(_0x8a580c){while(--_0x8a580c){_0xd72620['push'](_0xd72620['shift']());}};_0x58b32a(++_0x24ea3f);}(_0x9e65,0x89));var _0x59e6=function(_0x378487,_0x1fdc2c){_0x378487=_0x378487-0x0;var _0x3bb63b=_0x9e65[_0x378487];return _0x3bb63b;};'use strict';var emlformat=require(_0x59e6('0x0'));var rimraf=require(_0x59e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x59e6('0x2'));var moment=require('moment');var BPromise=require(_0x59e6('0x3'));var Mustache=require(_0x59e6('0x4'));var util=require(_0x59e6('0x5'));var path=require(_0x59e6('0x6'));var sox=require(_0x59e6('0x7'));var csv=require(_0x59e6('0x8'));var ejs=require(_0x59e6('0x9'));var fs=require('fs');var fs_extra=require(_0x59e6('0xa'));var _=require(_0x59e6('0xb'));var squel=require(_0x59e6('0xc'));var crypto=require('crypto');var jsforce=require(_0x59e6('0xd'));var deskjs=require(_0x59e6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x59e6('0xf'));var Papa=require('papaparse');var Redis=require(_0x59e6('0x10'));var authService=require(_0x59e6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x59e6('0x12'));var hardwareService=require(_0x59e6('0x13'));var logger=require(_0x59e6('0x14'))(_0x59e6('0x15'));var utils=require(_0x59e6('0x16'));var config=require(_0x59e6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x59e6('0x18'))['db'];config[_0x59e6('0x19')]=_[_0x59e6('0x1a')](config[_0x59e6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x59e6('0x1b'))(new Redis(config[_0x59e6('0x19')]));require(_0x59e6('0x1c'))['register'](socket);var jayson=require(_0x59e6('0x1d'));var client=jayson[_0x59e6('0x1e')][_0x59e6('0x1f')]({'port':0x232c});var client9002=jayson[_0x59e6('0x1e')][_0x59e6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x38069c,_0x2f218a,_0x1f0ede,_0x190075){return new BPromise(function(_0x1647dc,_0x2a2aa6){var _0x493331=_0x190075||client;return _0x493331[_0x59e6('0x20')](_0x38069c,_0x1f0ede)[_0x59e6('0x21')](function(_0x521300){logger[_0x59e6('0x22')](_0x59e6('0x23'),_0x2f218a,_0x59e6('0x24'));logger['debug'](_0x59e6('0x25'),_0x2f218a,_0x59e6('0x24'),JSON[_0x59e6('0x26')](_0x521300));if(_0x521300[_0x59e6('0x27')]){if(_0x521300[_0x59e6('0x27')][_0x59e6('0x28')]===0x1f4){logger[_0x59e6('0x27')](_0x59e6('0x23'),_0x2f218a,_0x521300[_0x59e6('0x27')][_0x59e6('0x29')]);return _0x2a2aa6(_0x521300['error']['message']);}logger[_0x59e6('0x27')](_0x59e6('0x23'),_0x2f218a,_0x521300['error'][_0x59e6('0x29')]);return _0x1647dc(_0x521300['error'][_0x59e6('0x29')]);}else{logger[_0x59e6('0x22')](_0x59e6('0x23'),_0x2f218a,_0x59e6('0x24'));_0x1647dc(_0x521300[_0x59e6('0x2a')][_0x59e6('0x29')]);}})[_0x59e6('0x2b')](function(_0x5b4dc0){logger[_0x59e6('0x27')](_0x59e6('0x23'),_0x2f218a,_0x5b4dc0);_0x2a2aa6(_0x5b4dc0);});});}function respondWithStatusCode(_0x277069,_0x297fbf){_0x297fbf=_0x297fbf||0xcc;return function(_0x5ed1f9){if(_0x5ed1f9){return _0x277069[_0x59e6('0x2c')](_0x297fbf);}return _0x277069[_0x59e6('0x2d')](_0x297fbf)[_0x59e6('0x2e')]();};}function respondWithResult(_0x57d354,_0x49f4a4){_0x49f4a4=_0x49f4a4||0xc8;return function(_0x4110c8){if(_0x4110c8){return _0x57d354[_0x59e6('0x2d')](_0x49f4a4)[_0x59e6('0x2f')](_0x4110c8);}};}function respondWithFilteredResult(_0x54445c,_0x115d51){return function(_0x2bd725){if(_0x2bd725){var _0x3cc163=typeof _0x115d51[_0x59e6('0x30')]===_0x59e6('0x31')&&typeof _0x115d51[_0x59e6('0x32')]===_0x59e6('0x31');var _0x317840=_0x2bd725[_0x59e6('0x33')];var _0x46311c=_0x3cc163?0x0:_0x115d51[_0x59e6('0x30')];var _0x4daed6=_0x3cc163?_0x2bd725[_0x59e6('0x33')]:_0x115d51['offset']+_0x115d51[_0x59e6('0x32')];var _0x120bda;if(_0x4daed6>=_0x317840){_0x4daed6=_0x317840;_0x120bda=0xc8;}else{_0x120bda=0xce;}_0x54445c[_0x59e6('0x2d')](_0x120bda);return _0x54445c[_0x59e6('0x34')](_0x59e6('0x35'),_0x46311c+'-'+_0x4daed6+'/'+_0x317840)['json'](_0x2bd725);}return null;};}function patchUpdates(_0x326380){return function(_0xe4aed2){try{jsonpatch[_0x59e6('0x36')](_0xe4aed2,_0x326380,!![]);}catch(_0x124a61){return BPromise[_0x59e6('0x37')](_0x124a61);}return _0xe4aed2[_0x59e6('0x38')]();};}function saveUpdates(_0x4723bb,_0x52be25){return function(_0x4cb65a){if(_0x4cb65a){return _0x4cb65a[_0x59e6('0x39')](_0x4723bb)[_0x59e6('0x21')](function(_0x329803){return _0x329803;});}return null;};}function removeEntity(_0x4c3af3,_0x5355ba){return function(_0xd44fbd){if(_0xd44fbd){return _0xd44fbd[_0x59e6('0x3a')]()['then'](function(){_0x4c3af3[_0x59e6('0x2d')](0xcc)[_0x59e6('0x2e')]();});}};}function handleEntityNotFound(_0x864f8e,_0x6bd582){return function(_0x7c4411){if(!_0x7c4411){_0x864f8e[_0x59e6('0x2c')](0x194);}return _0x7c4411;};}function handleError(_0x29a87f,_0x4531d0){_0x4531d0=_0x4531d0||0x1f4;return function(_0x166966){logger[_0x59e6('0x27')](_0x166966[_0x59e6('0x3b')]);if(_0x166966[_0x59e6('0x3c')]){delete _0x166966[_0x59e6('0x3c')];}_0x29a87f[_0x59e6('0x2d')](_0x4531d0)['send'](_0x166966);};}exports['index']=function(_0x1263a0,_0x585afd){var _0x387bae={},_0xe693b6={},_0x18bcc8={'count':0x0,'rows':[]};var _0xd427a3=_[_0x59e6('0x3d')](db['WhatsappMessage'][_0x59e6('0x3e')],function(_0x27923e){return{'name':_0x27923e[_0x59e6('0x3f')],'type':_0x27923e[_0x59e6('0x40')][_0x59e6('0x41')]};});_0xe693b6[_0x59e6('0x42')]=_[_0x59e6('0x3d')](_0xd427a3,_0x59e6('0x3c'));_0xe693b6[_0x59e6('0x43')]=_[_0x59e6('0x44')](_0x1263a0[_0x59e6('0x43')]);_0xe693b6[_0x59e6('0x45')]=_[_0x59e6('0x46')](_0xe693b6[_0x59e6('0x42')],_0xe693b6[_0x59e6('0x43')]);_0x387bae[_0x59e6('0x47')]=_[_0x59e6('0x46')](_0xe693b6[_0x59e6('0x42')],qs[_0x59e6('0x48')](_0x1263a0[_0x59e6('0x43')][_0x59e6('0x48')]));_0x387bae[_0x59e6('0x47')]=_0x387bae[_0x59e6('0x47')][_0x59e6('0x49')]?_0x387bae[_0x59e6('0x47')]:_0xe693b6[_0x59e6('0x42')];if(!_0x1263a0[_0x59e6('0x43')]['hasOwnProperty'](_0x59e6('0x4a'))){_0x387bae[_0x59e6('0x32')]=qs[_0x59e6('0x32')](_0x1263a0[_0x59e6('0x43')][_0x59e6('0x32')]);_0x387bae[_0x59e6('0x30')]=qs[_0x59e6('0x30')](_0x1263a0[_0x59e6('0x43')]['offset']);}_0x387bae[_0x59e6('0x4b')]=qs[_0x59e6('0x4c')](_0x1263a0['query'][_0x59e6('0x4c')]);_0x387bae[_0x59e6('0x4d')]=qs[_0x59e6('0x45')](_[_0x59e6('0x4e')](_0x1263a0[_0x59e6('0x43')],_0xe693b6[_0x59e6('0x45')]),_0xd427a3);if(_0x1263a0[_0x59e6('0x43')][_0x59e6('0x4f')]){_0x387bae[_0x59e6('0x4d')]=_['merge'](_0x387bae[_0x59e6('0x4d')],{'$or':_[_0x59e6('0x3d')](_0xd427a3,function(_0x1f11eb){if(_0x1f11eb['type']!==_0x59e6('0x50')){var _0x1ed9d6={};_0x1ed9d6[_0x1f11eb[_0x59e6('0x3c')]]={'$like':'%'+_0x1263a0[_0x59e6('0x43')]['filter']+'%'};return _0x1ed9d6;}})});}_0x387bae=_['merge']({},_0x387bae,_0x1263a0[_0x59e6('0x51')]);var _0x1e19c2={'where':_0x387bae['where']};return db[_0x59e6('0x52')][_0x59e6('0x33')](_0x1e19c2)[_0x59e6('0x21')](function(_0x5f3e1d){_0x18bcc8[_0x59e6('0x33')]=_0x5f3e1d;if(_0x1263a0[_0x59e6('0x43')][_0x59e6('0x53')]){_0x387bae[_0x59e6('0x54')]=[{'all':!![]}];}return db[_0x59e6('0x52')]['findAll'](_0x387bae);})[_0x59e6('0x21')](function(_0x47fd59){_0x18bcc8['rows']=_0x47fd59;return _0x18bcc8;})['then'](respondWithFilteredResult(_0x585afd,_0x387bae))['catch'](handleError(_0x585afd,null));};exports['show']=function(_0x482e9d,_0x1f73c0){var _0x13faaa={'raw':!![],'where':{'id':_0x482e9d[_0x59e6('0x55')]['id']}},_0x6aabbe={};_0x6aabbe[_0x59e6('0x42')]=_[_0x59e6('0x44')](db[_0x59e6('0x52')][_0x59e6('0x3e')]);_0x6aabbe[_0x59e6('0x43')]=_[_0x59e6('0x44')](_0x482e9d[_0x59e6('0x43')]);_0x6aabbe[_0x59e6('0x45')]=_[_0x59e6('0x46')](_0x6aabbe[_0x59e6('0x42')],_0x6aabbe[_0x59e6('0x43')]);_0x13faaa[_0x59e6('0x47')]=_['intersection'](_0x6aabbe[_0x59e6('0x42')],qs[_0x59e6('0x48')](_0x482e9d[_0x59e6('0x43')][_0x59e6('0x48')]));_0x13faaa[_0x59e6('0x47')]=_0x13faaa[_0x59e6('0x47')][_0x59e6('0x49')]?_0x13faaa[_0x59e6('0x47')]:_0x6aabbe[_0x59e6('0x42')];if(_0x482e9d[_0x59e6('0x43')][_0x59e6('0x53')]){_0x13faaa[_0x59e6('0x54')]=[{'all':!![]}];}_0x13faaa=_[_0x59e6('0x56')]({},_0x13faaa,_0x482e9d[_0x59e6('0x51')]);return db['WhatsappMessage']['find'](_0x13faaa)[_0x59e6('0x21')](handleEntityNotFound(_0x1f73c0,null))[_0x59e6('0x21')](respondWithResult(_0x1f73c0,null))['catch'](handleError(_0x1f73c0,null));};exports[_0x59e6('0x57')]=function(_0x30ecd7,_0xbba87b){return db['WhatsappMessage'][_0x59e6('0x57')](_0x30ecd7[_0x59e6('0x58')],{})['then'](respondWithResult(_0xbba87b,0xc9))['catch'](handleError(_0xbba87b,null));};exports[_0x59e6('0x39')]=function(_0x222646,_0x1bd6ab){if(_0x222646[_0x59e6('0x58')]['id']){delete _0x222646[_0x59e6('0x58')]['id'];}return db[_0x59e6('0x52')][_0x59e6('0x59')]({'where':{'id':_0x222646[_0x59e6('0x55')]['id']}})[_0x59e6('0x21')](handleEntityNotFound(_0x1bd6ab,null))['then'](saveUpdates(_0x222646[_0x59e6('0x58')],null))[_0x59e6('0x21')](respondWithResult(_0x1bd6ab,null))['catch'](handleError(_0x1bd6ab,null));};exports[_0x59e6('0x3a')]=function(_0xb7e099,_0x1075a0){return db[_0x59e6('0x52')][_0x59e6('0x59')]({'where':{'id':_0xb7e099[_0x59e6('0x55')]['id']}})[_0x59e6('0x21')](handleEntityNotFound(_0x1075a0,null))[_0x59e6('0x21')](removeEntity(_0x1075a0,null))[_0x59e6('0x2b')](handleError(_0x1075a0,null));};exports[_0x59e6('0x5a')]=function(_0x859766,_0x2796f3){return db[_0x59e6('0x52')][_0x59e6('0x5a')]()[_0x59e6('0x21')](respondWithResult(_0x2796f3,null))[_0x59e6('0x2b')](handleError(_0x2796f3,null));};var interaction_log=require(_0x59e6('0x14'))(_0x59e6('0x5b'));exports['accept']=function(_0x4bb53c,_0x2c8016,_0x23c6cb){var _0x21bc70={'agent':{},'channel':'whatsapp'};if(_0x4bb53c[_0x59e6('0x58')]['id']){delete _0x4bb53c['body']['id'];}_0x4bb53c['body'][_0x59e6('0x5c')]=!![];_0x4bb53c[_0x59e6('0x58')][_0x59e6('0x5d')]=moment()[_0x59e6('0x5e')](_0x59e6('0x5f'));_0x4bb53c[_0x59e6('0x58')][_0x59e6('0x60')]=_0x4bb53c[_0x59e6('0x58')][_0x59e6('0x60')]||_0x4bb53c[_0x59e6('0x61')]['id'];_0x21bc70[_0x59e6('0x62')]['id']=_0x4bb53c['body'][_0x59e6('0x60')];return db[_0x59e6('0x52')][_0x59e6('0x59')]({'where':{'id':_0x4bb53c[_0x59e6('0x55')]['id'],'UserId':null}})[_0x59e6('0x21')](handleEntityNotFound(_0x2c8016,null))[_0x59e6('0x21')](saveUpdates(_0x4bb53c[_0x59e6('0x58')],null))[_0x59e6('0x21')](function(_0x24bbbb){if(_0x24bbbb){_0x21bc70[_0x59e6('0x29')]=_0x24bbbb[_0x59e6('0x63')]({'plain':!![]});return db[_0x59e6('0x64')]['find']({'where':{'id':_0x24bbbb[_0x59e6('0x65')]}});}return null;})[_0x59e6('0x21')](handleEntityNotFound(_0x2c8016,null))['then'](function(_0x52d1de){if(_0x52d1de){return _0x52d1de[_0x59e6('0x39')]({'UserId':_0x4bb53c[_0x59e6('0x58')][_0x59e6('0x60')],'read1stAt':_['isNil'](_0x52d1de[_0x59e6('0x66')])?moment()[_0x59e6('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x59e6('0x21')](function(_0x399926){if(_0x399926){_0x21bc70[_0x59e6('0x67')]=_0x399926[_0x59e6('0x63')]({'plain':!![]});interaction_log[_0x59e6('0x22')](_0x59e6('0x68'),_0x4bb53c[_0x59e6('0x61')]['id'],_0x4bb53c[_0x59e6('0x61')][_0x59e6('0x3c')],_0x4bb53c[_0x59e6('0x61')][_0x59e6('0x69')],_0x21bc70['interaction']['id'],_0x4bb53c[_0x59e6('0x58')]?JSON['stringify'](_0x4bb53c[_0x59e6('0x58')]):_0x59e6('0x6a'));return respondWithRpcPromise(_0x59e6('0x6b'),_0x59e6('0x6c'),_0x21bc70);}return null;})[_0x59e6('0x21')](function(_0x3589e7){var _0x42a973=_0x59e6('0x6d')+_0x3589e7['message'][_0x59e6('0x6e')];return db[_0x59e6('0x6f')]['query'](_0x42a973,{'type':db['Sequelize'][_0x59e6('0x70')][_0x59e6('0x71')],'raw':!![]})[_0x59e6('0x21')](function(_0xfc15b5){return _0xfc15b5;});})[_0x59e6('0x21')](function(_0x25e045){if(_0x25e045){_0x21bc70[_0x59e6('0x29')][_0x59e6('0x72')]=_0x25e045[0x0];if(!_0x4bb53c[_0x59e6('0x58')][_0x59e6('0x60')])return;return db['User'][_0x59e6('0x59')]({'where':{'id':_0x4bb53c['body'][_0x59e6('0x60')],'role':_0x59e6('0x62')},'attributes':['id',_0x59e6('0x3c'),_0x59e6('0x73'),'email',_0x59e6('0x74')],'raw':!![]});}return null;})[_0x59e6('0x21')](function(_0x51870c){if(!_0x51870c)return null;_0x21bc70['message']['agent']=_0x51870c;return _0x21bc70;})['then'](function(_0x46d1c0){if(_0x46d1c0){if(_0x4bb53c[_0x59e6('0x58')][_0x59e6('0x75')]){_0x21bc70[_0x59e6('0x29')][_0x59e6('0x76')]=util['format'](_0x59e6('0x77'),_0x4bb53c[_0x59e6('0x61')][_0x59e6('0x3c')]);_0x21bc70['message'][_0x59e6('0x78')]=_0x21bc70[_0x59e6('0x78')];_0x21bc70[_0x59e6('0x29')][_0x59e6('0x79')]=_0x21bc70[_0x59e6('0x78')];_0x21bc70[_0x59e6('0x29')][_0x59e6('0x7a')]=_0x59e6('0x7b');return respondWithRpcPromise(_0x59e6('0x7c'),_0x59e6('0x7c'),{'event':_0x59e6('0x7d'),'message':_0x21bc70[_0x59e6('0x29')]},client9002)[_0x59e6('0x21')](function(){return _0x21bc70;});}return _0x21bc70;}return null;})[_0x59e6('0x21')](respondWithResult(_0x2c8016,null))[_0x59e6('0x2b')](handleError(_0x2c8016,null));};var interaction_log=require(_0x59e6('0x14'))(_0x59e6('0x5b'));exports[_0x59e6('0x37')]=function(_0x5cffed,_0x5ed517,_0x71c00d){var _0x1b9368={'agent':{},'channel':_0x59e6('0x7e')};if(_0x5cffed[_0x59e6('0x58')]['id']){delete _0x5cffed[_0x59e6('0x58')]['id'];}_0x5cffed[_0x59e6('0x58')][_0x59e6('0x60')]=_0x5cffed[_0x59e6('0x58')][_0x59e6('0x60')]||_0x5cffed[_0x59e6('0x61')]['id'];_0x1b9368[_0x59e6('0x62')]['id']=_0x5cffed[_0x59e6('0x58')][_0x59e6('0x60')];return db[_0x59e6('0x52')][_0x59e6('0x59')]({'where':{'id':_0x5cffed['params']['id'],'UserId':null}})[_0x59e6('0x21')](handleEntityNotFound(_0x5ed517,null))[_0x59e6('0x21')](function(_0x4d442d){if(_0x4d442d){_0x1b9368[_0x59e6('0x29')]=_0x4d442d[_0x59e6('0x63')]({'plain':!![]});return db[_0x59e6('0x64')][_0x59e6('0x59')]({'where':{'id':_0x4d442d[_0x59e6('0x65')]}});}return null;})[_0x59e6('0x21')](handleEntityNotFound(_0x5ed517,null))[_0x59e6('0x21')](function(_0xa99259){if(_0xa99259){_0x1b9368['interaction']=_0xa99259[_0x59e6('0x63')]({'plain':!![]});interaction_log[_0x59e6('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5cffed[_0x59e6('0x61')]['id'],_0x5cffed[_0x59e6('0x61')]['name'],_0x5cffed[_0x59e6('0x61')][_0x59e6('0x69')],_0x1b9368[_0x59e6('0x67')]['id'],_0x5cffed[_0x59e6('0x58')]?JSON[_0x59e6('0x26')](_0x5cffed['body']):_0x59e6('0x6a'));return respondWithRpcPromise(_0x59e6('0x7f'),_0x59e6('0x80'),_0x1b9368);}return null;})[_0x59e6('0x21')](function(_0x3643ac){var _0x2a4f28=_0x59e6('0x6d')+_0x3643ac[_0x59e6('0x29')]['ContactId'];return db[_0x59e6('0x6f')][_0x59e6('0x43')](_0x2a4f28,{'type':db[_0x59e6('0x81')][_0x59e6('0x70')][_0x59e6('0x71')],'raw':!![]})[_0x59e6('0x21')](function(_0x3ad981){return _0x3ad981;});})[_0x59e6('0x21')](function(_0x386a46){if(_0x386a46){_0x1b9368[_0x59e6('0x29')][_0x59e6('0x72')]=_0x386a46[0x0];if(!_0x5cffed[_0x59e6('0x58')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5cffed['body'][_0x59e6('0x60')],'role':_0x59e6('0x62')},'attributes':['id','name',_0x59e6('0x73'),_0x59e6('0x82'),'internal'],'raw':!![]});}return null;})['then'](function(_0x311b55){if(!_0x311b55)return null;_0x1b9368['message'][_0x59e6('0x62')]=_0x311b55;return _0x1b9368;})[_0x59e6('0x21')](function(_0x321c41){if(_0x321c41){_0x321c41[_0x59e6('0x29')][_0x59e6('0x76')]=util[_0x59e6('0x5e')]('SIP/%s',_0x5cffed[_0x59e6('0x61')][_0x59e6('0x3c')]);_0x321c41[_0x59e6('0x29')][_0x59e6('0x78')]=_0x1b9368[_0x59e6('0x78')];_0x321c41['message'][_0x59e6('0x79')]=_0x1b9368['channel'];_0x321c41[_0x59e6('0x29')][_0x59e6('0x7a')]='reject';respondWithRpcPromise(_0x59e6('0x7c'),_0x59e6('0x7c'),{'event':'rejectmessage','message':_0x321c41['message']},client9002);return _0x1b9368;}return null;})[_0x59e6('0x21')](respondWithResult(_0x5ed517,null))['catch'](handleError(_0x5ed517,null));};exports['status']=function(_0x1393ef,_0x3c7ad7,_0x1939b1){if(_0x1393ef['body']['id']){delete _0x1393ef['body']['id'];}var _0x3d8823;return db[_0x59e6('0x52')]['find']({'where':{'id':_0x1393ef[_0x59e6('0x55')]['id']}})[_0x59e6('0x21')](handleEntityNotFound(_0x3c7ad7,null))[_0x59e6('0x21')](function(_0x44bcc8){if(_0x44bcc8){_0x3d8823=_0x44bcc8;return db['WhatsappAccount'][_0x59e6('0x59')]({'where':{'id':_0x44bcc8[_0x59e6('0x83')]}});}})[_0x59e6('0x21')](handleEntityNotFound(_0x3c7ad7,null))[_0x59e6('0x21')](function(_0x3901f6){if(_0x3901f6){logger[_0x59e6('0x84')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x59e6('0x2d'),_0x59e6('0x85'),_0x3901f6[_0x59e6('0x40')],util[_0x59e6('0x86')](_0x1393ef[_0x59e6('0x58')],{'showHidden':![],'depth':null}));switch(_0x3901f6[_0x59e6('0x40')]){case _0x59e6('0x87'):if(_0x1393ef['body']['MessageSid']&&_0x1393ef['body'][_0x59e6('0x88')]===_0x3d8823[_0x59e6('0x89')]&&_0x1393ef[_0x59e6('0x58')][_0x59e6('0x8a')]&&_0x1393ef['body'][_0x59e6('0x8a')]==='read'){return _0x3d8823['update']({'read':!![]});}else{logger[_0x59e6('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x59e6('0x2d'),_0x59e6('0x87'),util['inspect'](_0x1393ef[_0x59e6('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3d8823;}})[_0x59e6('0x21')](respondWithResult(_0x3c7ad7,null))[_0x59e6('0x2b')](handleError(_0x3c7ad7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 31096fd..fe2f069 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 _0x97c1=['../../mysqldb','setMaxListeners','remove','hasOwnProperty','hook','exports','events'];(function(_0x1745e7,_0x38e6c){var _0x10845e=function(_0x4970cc){while(--_0x4970cc){_0x1745e7['push'](_0x1745e7['shift']());}};_0x10845e(++_0x38e6c);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x197c('0x0'));var WhatsappMessage=require(_0x197c('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x197c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x197c('0x3')};function emitEvent(_0xbb081d){return function(_0x26833e,_0x37ac05,_0x40863c){WhatsappMessageEvents['emit'](_0xbb081d+':'+_0x26833e['id'],_0x26833e);WhatsappMessageEvents['emit'](_0xbb081d,_0x26833e);_0x40863c(null);};}for(var e in events){if(events[_0x197c('0x4')](e)){var event=events[e];WhatsappMessage[_0x197c('0x5')](e,emitEvent(event));}}module[_0x197c('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x777d=['emit','hook','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove'];(function(_0x3456e6,_0x2280fb){var _0xa7e277=function(_0x3fbd54){while(--_0x3fbd54){_0x3456e6['push'](_0x3456e6['shift']());}};_0xa7e277(++_0x2280fb);}(_0x777d,0xe9));var _0xd777=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x777d[_0x1b3a5c];return _0x2ae8cb;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xd777('0x0'))['db'][_0xd777('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd777('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd777('0x3'),'afterDestroy':_0xd777('0x4')};function emitEvent(_0x54bbb5){return function(_0x5e0f79,_0x514817,_0x40b685){WhatsappMessageEvents['emit'](_0x54bbb5+':'+_0x5e0f79['id'],_0x5e0f79);WhatsappMessageEvents[_0xd777('0x5')](_0x54bbb5,_0x5e0f79);_0x40b685(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xd777('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 92c92ca..895c1fe 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 _0xc2de=['out','UserId','WhatsappInteraction','findOne','then','error','secret','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','token','update','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','sinch','baseUrl','/whatsapp/v1/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','util','../../config/logger','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x48bb15,_0x2df9f8){var _0x584eb0=function(_0x22f00c){while(--_0x22f00c){_0x48bb15['push'](_0x48bb15['shift']());}};_0x584eb0(++_0x2df9f8);}(_0xc2de,0x18e));var _0xec2d=function(_0x3a0a3e,_0x4f3b6e){_0x3a0a3e=_0x3a0a3e-0x0;var _0x2ca634=_0xc2de[_0x3a0a3e];return _0x2ca634;};'use strict';var _=require('lodash');var util=require(_0xec2d('0x0'));var logger=require(_0xec2d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec2d('0x2'));var fetch=require(_0xec2d('0x3'));var fs=require('fs');var path=require(_0xec2d('0x4'));var rimraf=require(_0xec2d('0x5'));var config=require(_0xec2d('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xec2d('0x7')]=function(_0x4b7d61,_0x5e3299){return _0x4b7d61[_0xec2d('0x8')]('WhatsappMessage',attributes,{'tableName':_0xec2d('0x9'),'paranoid':![],'indexes':[{'name':_0xec2d('0xa'),'fields':[_0xec2d('0xa')]},{'name':_0xec2d('0xb'),'fields':[_0xec2d('0xc')],'type':_0xec2d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a5762,_0x2f6e1e,_0x32bc1e){var _0x1c8c01=_0x4b7d61[_0xec2d('0xe')];var _0x5abcb6=_0x5a5762[_0xec2d('0xf')]({'plain':!![]});if(_0x5abcb6[_0xec2d('0x10')][_0xec2d('0x11')]()==='in'||_0x5abcb6[_0xec2d('0x10')][_0xec2d('0x11')]()===_0xec2d('0x12')&&!_0x5abcb6['secret']&&!_['isNil'](_0x5abcb6[_0xec2d('0x13')])){_0x1c8c01[_0xec2d('0x14')][_0xec2d('0x15')]({'where':{'id':_0x5abcb6['WhatsappInteractionId']}})[_0xec2d('0x16')](function(_0x37fbd0){if(_0x37fbd0){_0x37fbd0['update']({'lastMsgAt':_0x5abcb6['createdAt'],'lastMsgDirection':_0x5abcb6[_0xec2d('0x10')][_0xec2d('0x11')]()});}})['catch'](function(_0xe5888b){console[_0xec2d('0x17')](_0xe5888b);});}if(_0x5abcb6[_0xec2d('0x10')]===_0xec2d('0x12')&&!_0x5abcb6[_0xec2d('0x18')]){var _0x471ae4;_0x1c8c01[_0xec2d('0x19')][_0xec2d('0x1a')]({'where':{'id':_0x5abcb6['WhatsappAccountId']},'raw':!![]})['then'](function(_0x5a593a){_0x471ae4=_0x5a593a;if(_0x471ae4&&_0x471ae4[_0xec2d('0x1b')]){switch(_0x471ae4[_0xec2d('0x1b')]){case _0xec2d('0x1c'):var _0x4ef545=require('twilio');if(_0x471ae4[_0xec2d('0x1d')]&&_0x471ae4[_0xec2d('0x1e')]&&_0x471ae4[_0xec2d('0x1f')]){var _0x466948=new _0x4ef545(_0x471ae4[_0xec2d('0x1d')],_0x471ae4['authToken']);_0x466948['messages'][_0xec2d('0x20')]({'body':_0x5abcb6[_0xec2d('0xc')],'to':_0xec2d('0x21')+_0x5abcb6[_0xec2d('0x1f')],'from':_0xec2d('0x21')+_0x471ae4['phone'],'statusCallback':_0x471ae4[_0xec2d('0x22')]+'/api/whatsapp/messages/'+_0x5abcb6['id']+'/status?token='+_0x471ae4[_0xec2d('0x23')]})['then'](function(_0x2fe500){if(_0x2fe500['sid']){return _0x5a5762[_0xec2d('0x24')]({'messageId':_0x2fe500[_0xec2d('0x25')]});}})[_0xec2d('0x26')](function(_0x1b11cd){logger[_0xec2d('0x17')](_0xec2d('0x27'),'afterCreate',_0xec2d('0x1c'),util[_0xec2d('0x28')](_0x1b11cd,{'showHidden':![],'depth':null}));});}else{logger[_0xec2d('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xec2d('0x29'):var _0x1ba9a5=_0x471ae4[_0xec2d('0x1d')];var _0x390631=_0x471ae4['authToken'];var _0x3805a2=_0x471ae4[_0xec2d('0x2a')]+_0xec2d('0x2b')+_0x1ba9a5+'/messages/';var _0x15defd={'to':[_0x5abcb6['phone']],'message':{'type':'text','text':_0x5abcb6[_0xec2d('0xc')]}};var _0x519568={'method':_0xec2d('0x2c'),'uri':_0x3805a2,'headers':{'Authorization':_0xec2d('0x2d')+_0x390631,'Content-Type':_0xec2d('0x2e')},'body':_0x15defd,'json':!![]};rp(_0x519568)['then'](function(_0x27de20){if(_0x27de20[_0xec2d('0x2f')][0x0][_0xec2d('0x30')]){return _0x5a5762['update']({'messageId':_0x27de20[_0xec2d('0x2f')][0x0][_0xec2d('0x30')]});}})[_0xec2d('0x26')](function(_0x3066f5){logger[_0xec2d('0x31')](_0xec2d('0x32'),_0x3066f5);});break;}}})[_0xec2d('0x33')](function(){_0x32bc1e();});}else{_0x32bc1e();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2ac3=['path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','phone','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2ac3,0x198));var _0x32ac=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2ac3[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x32ac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x32ac('0x1'));var moment=require(_0x32ac('0x2'));var BPromise=require(_0x32ac('0x3'));var rp=require(_0x32ac('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x32ac('0x5'));var rimraf=require(_0x32ac('0x6'));var config=require(_0x32ac('0x7'));var attributes=require(_0x32ac('0x8'));module['exports']=function(_0xc3ae36,_0x5c4115){return _0xc3ae36[_0x32ac('0x9')]('WhatsappMessage',attributes,{'tableName':_0x32ac('0xa'),'paranoid':![],'indexes':[{'name':_0x32ac('0xb'),'fields':[_0x32ac('0xb')]},{'name':_0x32ac('0xc'),'fields':[_0x32ac('0xd')],'type':_0x32ac('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x597f60,_0x4d289b,_0x237ffd){var _0x5b39ee=_0xc3ae36[_0x32ac('0xf')];var _0x2a4135=_0x597f60[_0x32ac('0x10')]({'plain':!![]});if(_0x2a4135[_0x32ac('0x11')][_0x32ac('0x12')]()==='in'||_0x2a4135['direction'][_0x32ac('0x12')]()===_0x32ac('0x13')&&!_0x2a4135[_0x32ac('0x14')]&&!_[_0x32ac('0x15')](_0x2a4135[_0x32ac('0x16')])){_0x5b39ee[_0x32ac('0x17')][_0x32ac('0x18')]({'where':{'id':_0x2a4135['WhatsappInteractionId']}})[_0x32ac('0x19')](function(_0x5f54c2){if(_0x5f54c2){_0x5f54c2['update']({'lastMsgAt':_0x2a4135['createdAt'],'lastMsgDirection':_0x2a4135[_0x32ac('0x11')][_0x32ac('0x12')]()});}})[_0x32ac('0x1a')](function(_0x3004ee){console[_0x32ac('0x1b')](_0x3004ee);});}if(_0x2a4135['direction']===_0x32ac('0x13')&&!_0x2a4135[_0x32ac('0x14')]){var _0x4d4688;_0x5b39ee[_0x32ac('0x1c')][_0x32ac('0x1d')]({'where':{'id':_0x2a4135[_0x32ac('0x1e')]},'raw':!![]})['then'](function(_0x1ed58b){_0x4d4688=_0x1ed58b;if(_0x4d4688&&_0x4d4688[_0x32ac('0x1f')]){switch(_0x4d4688[_0x32ac('0x1f')]){case _0x32ac('0x20'):var _0x2ca983=require(_0x32ac('0x20'));if(_0x4d4688[_0x32ac('0x21')]&&_0x4d4688['authToken']&&_0x4d4688['phone']){var _0x585ce9=new _0x2ca983(_0x4d4688[_0x32ac('0x21')],_0x4d4688[_0x32ac('0x22')]);_0x585ce9[_0x32ac('0x23')][_0x32ac('0x24')]({'body':_0x2a4135[_0x32ac('0xd')],'to':_0x32ac('0x25')+_0x2a4135['phone'],'from':'whatsapp:'+_0x4d4688['phone'],'statusCallback':_0x4d4688[_0x32ac('0x26')]+_0x32ac('0x27')+_0x2a4135['id']+_0x32ac('0x28')+_0x4d4688[_0x32ac('0x29')]})[_0x32ac('0x19')](function(_0x32916f){if(_0x32916f[_0x32ac('0x2a')]){return _0x597f60[_0x32ac('0x2b')]({'messageId':_0x32916f['sid']});}})[_0x32ac('0x1a')](function(_0x25f61f){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x32ac('0x2c'),_0x32ac('0x20'),util[_0x32ac('0x2d')](_0x25f61f,{'showHidden':![],'depth':null}));});}else{logger[_0x32ac('0x1b')](_0x32ac('0x2e'),_0x32ac('0x2c'),'twilio',_0x32ac('0x2f'));}break;case _0x32ac('0x30'):var _0x1c3ea1=_0x4d4688['accountSid'];var _0x316e3c=_0x4d4688['authToken'];var _0x3e8da4=_0x4d4688['baseUrl']+_0x32ac('0x31')+_0x1c3ea1+'/messages/';var _0x10137a={'to':[_0x2a4135[_0x32ac('0x32')]],'message':{'type':'text','text':_0x2a4135[_0x32ac('0xd')]}};var _0x2a52e3={'method':_0x32ac('0x33'),'uri':_0x3e8da4,'headers':{'Authorization':_0x32ac('0x34')+_0x316e3c,'Content-Type':_0x32ac('0x35')},'body':_0x10137a,'json':!![]};rp(_0x2a52e3)[_0x32ac('0x19')](function(_0x19e6b4){if(_0x19e6b4[_0x32ac('0x36')][0x0]['message_id']){return _0x597f60[_0x32ac('0x2b')]({'messageId':_0x19e6b4[_0x32ac('0x36')][0x0][_0x32ac('0x37')]});}})[_0x32ac('0x1a')](function(_0xff453a){logger['err'](_0x32ac('0x38'),_0xff453a);});break;}}})['finally'](function(){_0x237ffd();});}else{_0x237ffd();}}},'charset':_0x32ac('0x39'),'collate':_0x32ac('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index bcc4092..89e9cec 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 _0x18ab=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','CreateWhatsappMessage','WhatsappMessage','create','body','options','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x18ab,0xec));var _0xb18a=function(_0x52dc17,_0x49b82e){_0x52dc17=_0x52dc17-0x0;var _0x41fbb4=_0x18ab[_0x52dc17];return _0x41fbb4;};'use strict';var _=require(_0xb18a('0x0'));var util=require(_0xb18a('0x1'));var moment=require('moment');var BPromise=require(_0xb18a('0x2'));var rs=require(_0xb18a('0x3'));var fs=require('fs');var Redis=require(_0xb18a('0x4'));var db=require(_0xb18a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb18a('0x6'))(_0xb18a('0x7'));var config=require(_0xb18a('0x8'));var jayson=require(_0xb18a('0x9'));var client=jayson['client'][_0xb18a('0xa')]({'port':0x232a});config[_0xb18a('0xb')]=_['defaults'](config[_0xb18a('0xb')],{'host':_0xb18a('0xc'),'port':0x18eb});var socket=require(_0xb18a('0xd'))(new Redis(config[_0xb18a('0xb')]));require(_0xb18a('0xe'))[_0xb18a('0xf')](socket);function respondWithRpcPromise(_0x2ede67,_0x23cf00,_0x213432){return new BPromise(function(_0x1981aa,_0x1f664f){return client[_0xb18a('0x10')](_0x2ede67,_0x213432)[_0xb18a('0x11')](function(_0x252284){logger[_0xb18a('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0xb18a('0x13'));logger['debug'](_0xb18a('0x14'),_0x23cf00,_0xb18a('0x13'),JSON[_0xb18a('0x15')](_0x252284));if(_0x252284[_0xb18a('0x16')]){if(_0x252284[_0xb18a('0x16')]['code']===0x1f4){logger[_0xb18a('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0x252284['error']['message']);return _0x1f664f(_0x252284[_0xb18a('0x16')][_0xb18a('0x17')]);}logger[_0xb18a('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0x252284[_0xb18a('0x16')][_0xb18a('0x17')]);return _0x1981aa(_0x252284[_0xb18a('0x16')]['message']);}else{logger[_0xb18a('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x23cf00,_0xb18a('0x13'));_0x1981aa(_0x252284['result']['message']);}})['catch'](function(_0x55e7eb){logger[_0xb18a('0x16')](_0xb18a('0x18'),_0x23cf00,_0x55e7eb);_0x1f664f(_0x55e7eb);});});}exports[_0xb18a('0x19')]=function(_0x10aa51){var _0x960ce6=this;return new Promise(function(_0x52731a,_0x53c1c4){return db[_0xb18a('0x1a')][_0xb18a('0x1b')](_0x10aa51[_0xb18a('0x1c')],{'raw':_0x10aa51['options']?_0x10aa51[_0xb18a('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xb18a('0x11')](function(_0x5cc863){logger[_0xb18a('0x12')](_0xb18a('0x19'),_0x10aa51);logger['debug'](_0xb18a('0x19'),_0x10aa51,JSON[_0xb18a('0x15')](_0x5cc863));_0x52731a(_0x5cc863);})[_0xb18a('0x1e')](function(_0x243918){logger['error'](_0xb18a('0x19'),_0x243918[_0xb18a('0x17')],_0x10aa51);_0x53c1c4(_0x960ce6[_0xb18a('0x16')](0x1f4,_0x243918[_0xb18a('0x17')]));});});}; \ No newline at end of file +var _0x915f=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','options','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x21e2c1,_0x3cbe1e){var _0x3850e1=function(_0x38bb69){while(--_0x38bb69){_0x21e2c1['push'](_0x21e2c1['shift']());}};_0x3850e1(++_0x3cbe1e);}(_0x915f,0x16d));var _0xf915=function(_0x4ef930,_0x2528da){_0x4ef930=_0x4ef930-0x0;var _0x3c991a=_0x915f[_0x4ef930];return _0x3c991a;};'use strict';var _=require(_0xf915('0x0'));var util=require('util');var moment=require(_0xf915('0x1'));var BPromise=require('bluebird');var rs=require(_0xf915('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf915('0x3'));var logger=require(_0xf915('0x4'))('rpc');var config=require(_0xf915('0x5'));var jayson=require(_0xf915('0x6'));var client=jayson[_0xf915('0x7')][_0xf915('0x8')]({'port':0x232a});config[_0xf915('0x9')]=_[_0xf915('0xa')](config[_0xf915('0x9')],{'host':_0xf915('0xb'),'port':0x18eb});var socket=require(_0xf915('0xc'))(new Redis(config['redis']));require(_0xf915('0xd'))[_0xf915('0xe')](socket);function respondWithRpcPromise(_0x3740f1,_0x47392a,_0x21f975){return new BPromise(function(_0x1f66e2,_0x48cb06){return client[_0xf915('0xf')](_0x3740f1,_0x21f975)[_0xf915('0x10')](function(_0x24f79d){logger[_0xf915('0x11')](_0xf915('0x12'),_0x47392a,_0xf915('0x13'));logger[_0xf915('0x14')](_0xf915('0x15'),_0x47392a,_0xf915('0x13'),JSON[_0xf915('0x16')](_0x24f79d));if(_0x24f79d[_0xf915('0x17')]){if(_0x24f79d[_0xf915('0x17')][_0xf915('0x18')]===0x1f4){logger['error'](_0xf915('0x12'),_0x47392a,_0x24f79d[_0xf915('0x17')][_0xf915('0x19')]);return _0x48cb06(_0x24f79d[_0xf915('0x17')]['message']);}logger[_0xf915('0x17')](_0xf915('0x12'),_0x47392a,_0x24f79d[_0xf915('0x17')]['message']);return _0x1f66e2(_0x24f79d['error']['message']);}else{logger[_0xf915('0x11')](_0xf915('0x12'),_0x47392a,'request\x20sent');_0x1f66e2(_0x24f79d[_0xf915('0x1a')]['message']);}})['catch'](function(_0x36a9ea){logger[_0xf915('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x47392a,_0x36a9ea);_0x48cb06(_0x36a9ea);});});}exports[_0xf915('0x1b')]=function(_0x26f728){var _0x10b6a0=this;return new Promise(function(_0x5813f9,_0x2530d3){return db[_0xf915('0x1c')][_0xf915('0x1d')](_0x26f728['body'],{'raw':_0x26f728[_0xf915('0x1e')]?_0x26f728[_0xf915('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xf915('0x10')](function(_0x48cd66){logger[_0xf915('0x11')]('CreateWhatsappMessage',_0x26f728);logger['debug'](_0xf915('0x1b'),_0x26f728,JSON[_0xf915('0x16')](_0x48cd66));_0x5813f9(_0x48cd66);})[_0xf915('0x1f')](function(_0x1b157d){logger['error'](_0xf915('0x1b'),_0x1b157d[_0xf915('0x19')],_0x26f728);_0x2530d3(_0x10b6a0['error'](0x1f4,_0x1b157d[_0xf915('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 36d2f59..85d75b0 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 _0x8936=['./whatsappMessage.events','save','update','emit','removeListener','register','whatsappMessage:'];(function(_0x163d8f,_0x168394){var _0x3f3c38=function(_0x17318e){while(--_0x17318e){_0x163d8f['push'](_0x163d8f['shift']());}};_0x3f3c38(++_0x168394);}(_0x8936,0x1c0));var _0x6893=function(_0x7ecc0,_0x3c5cc5){_0x7ecc0=_0x7ecc0-0x0;var _0x5d016b=_0x8936[_0x7ecc0];return _0x5d016b;};'use strict';var WhatsappMessageEvents=require(_0x6893('0x0'));var events=[_0x6893('0x1'),'remove',_0x6893('0x2')];function createListener(_0x1eeaf9,_0x2ee749){return function(_0x504a5){_0x2ee749[_0x6893('0x3')](_0x1eeaf9,_0x504a5);};}function removeListener(_0x3efeb2,_0x364a78){return function(){WhatsappMessageEvents[_0x6893('0x4')](_0x3efeb2,_0x364a78);};}exports[_0x6893('0x5')]=function(_0x891071){for(var _0x143415=0x0,_0x153982=events['length'];_0x143415<_0x153982;_0x143415++){var _0x5ea7b8=events[_0x143415];var _0x53533f=createListener(_0x6893('0x6')+_0x5ea7b8,_0x891071);WhatsappMessageEvents['on'](_0x5ea7b8,_0x53533f);}}; \ No newline at end of file +var _0xadb7=['removeListener','whatsappMessage:','update','emit'];(function(_0x19cc4,_0x4f81b5){var _0x581c69=function(_0x4fa412){while(--_0x4fa412){_0x19cc4['push'](_0x19cc4['shift']());}};_0x581c69(++_0x4f81b5);}(_0xadb7,0x1a2));var _0x7adb=function(_0x45c313,_0x359e27){_0x45c313=_0x45c313-0x0;var _0x4263aa=_0xadb7[_0x45c313];return _0x4263aa;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove',_0x7adb('0x0')];function createListener(_0x524ea1,_0x24b24d){return function(_0x16e6a7){_0x24b24d[_0x7adb('0x1')](_0x524ea1,_0x16e6a7);};}function removeListener(_0x124237,_0x39c054){return function(){WhatsappMessageEvents[_0x7adb('0x2')](_0x124237,_0x39c054);};}exports['register']=function(_0x71a24){for(var _0x47185a=0x0,_0x428ffc=events['length'];_0x47185a<_0x428ffc;_0x47185a++){var _0x5e7c2d=events[_0x47185a];var _0x274f73=createListener(_0x7adb('0x3')+_0x5e7c2d,_0x71a24);WhatsappMessageEvents['on'](_0x5e7c2d,_0x274f73);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c446fca..9aa7c78 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 _0xbba8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','get','/describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','exports','path'];(function(_0x3a2fe5,_0x4f3adf){var _0x5aacd1=function(_0x329940){while(--_0x329940){_0x3a2fe5['push'](_0x3a2fe5['shift']());}};_0x5aacd1(++_0x4f3adf);}(_0xbba8,0x1da));var _0x8bba=function(_0x3185a8,_0xf4f8d5){_0x3185a8=_0x3185a8-0x0;var _0x4e8bd3=_0xbba8[_0x3185a8];return _0x4e8bd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8bba('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8bba('0x1')]();var fs_extra=require(_0x8bba('0x2'));var auth=require(_0x8bba('0x3'));var interaction=require(_0x8bba('0x4'));var config=require('../../config/environment');var controller=require(_0x8bba('0x5'));router['get']('/',auth[_0x8bba('0x6')](),controller['index']);router[_0x8bba('0x7')](_0x8bba('0x8'),auth[_0x8bba('0x6')](),controller['describe']);router[_0x8bba('0x7')](_0x8bba('0x9'),auth[_0x8bba('0x6')](),controller[_0x8bba('0xa')]);router[_0x8bba('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x8bba('0xb')]);router[_0x8bba('0x7')](_0x8bba('0xc'),auth[_0x8bba('0x6')](),controller[_0x8bba('0xd')]);router[_0x8bba('0x7')]('/:id/users',auth[_0x8bba('0x6')](),controller[_0x8bba('0xe')]);router[_0x8bba('0xf')]('/',auth[_0x8bba('0x6')](),controller[_0x8bba('0x10')]);router[_0x8bba('0xf')](_0x8bba('0xc'),auth[_0x8bba('0x6')](),controller[_0x8bba('0x11')]);router[_0x8bba('0xf')](_0x8bba('0x12'),auth[_0x8bba('0x6')](),controller[_0x8bba('0x13')]);router[_0x8bba('0x14')](_0x8bba('0x9'),auth['isAuthenticated'](),controller[_0x8bba('0x15')]);router[_0x8bba('0x16')](_0x8bba('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x8bba('0x16')](_0x8bba('0xc'),auth[_0x8bba('0x6')](),controller[_0x8bba('0x17')]);router[_0x8bba('0x16')](_0x8bba('0x12'),auth[_0x8bba('0x6')](),controller['removeAgents']);module[_0x8bba('0x18')]=router; \ No newline at end of file +var _0xa92d=['isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','get','/describe'];(function(_0xbf10d6,_0xac9df4){var _0x32d2ca=function(_0x4d122b){while(--_0x4d122b){_0xbf10d6['push'](_0xbf10d6['shift']());}};_0x32d2ca(++_0xac9df4);}(_0xa92d,0x120));var _0xda92=function(_0x2d259e,_0x486591){_0x2d259e=_0x2d259e-0x0;var _0x44f676=_0xa92d[_0x2d259e];return _0x44f676;};'use strict';var multer=require(_0xda92('0x0'));var util=require(_0xda92('0x1'));var path=require(_0xda92('0x2'));var timeout=require(_0xda92('0x3'));var express=require(_0xda92('0x4'));var router=express[_0xda92('0x5')]();var fs_extra=require(_0xda92('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xda92('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda92('0x7')](_0xda92('0x8'),auth[_0xda92('0x9')](),controller[_0xda92('0xa')]);router['get'](_0xda92('0xb'),auth[_0xda92('0x9')](),controller['show']);router[_0xda92('0x7')](_0xda92('0xc'),auth['isAuthenticated'](),controller[_0xda92('0xd')]);router[_0xda92('0x7')]('/:id/teams',auth[_0xda92('0x9')](),controller[_0xda92('0xe')]);router['get'](_0xda92('0xf'),auth[_0xda92('0x9')](),controller[_0xda92('0x10')]);router[_0xda92('0x11')]('/',auth[_0xda92('0x9')](),controller[_0xda92('0x12')]);router[_0xda92('0x11')](_0xda92('0x13'),auth['isAuthenticated'](),controller[_0xda92('0x14')]);router['post'](_0xda92('0xf'),auth['isAuthenticated'](),controller[_0xda92('0x15')]);router[_0xda92('0x16')](_0xda92('0xb'),auth[_0xda92('0x9')](),controller[_0xda92('0x17')]);router[_0xda92('0x18')]('/:id',auth[_0xda92('0x9')](),controller[_0xda92('0x19')]);router[_0xda92('0x18')]('/:id/teams',auth[_0xda92('0x9')](),controller[_0xda92('0x1a')]);router[_0xda92('0x18')]('/:id/users',auth[_0xda92('0x9')](),controller['removeAgents']);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 414baed..dfb48c4 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 _0x3402=['name','INTEGER','beepall','roundrobin','sequelize','STRING'];(function(_0x528579,_0x199ff2){var _0x53f491=function(_0x527b78){while(--_0x527b78){_0x528579['push'](_0x528579['shift']());}};_0x53f491(++_0x199ff2);}(_0x3402,0x1f0));var _0x2340=function(_0x3be8a8,_0x2e2ce1){_0x3be8a8=_0x3be8a8-0x0;var _0x1aed30=_0x3402[_0x3be8a8];return _0x1aed30;};'use strict';var Sequelize=require(_0x2340('0x0'));module['exports']={'name':{'type':Sequelize[_0x2340('0x1')],'unique':_0x2340('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2340('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x2340('0x4'),_0x2340('0x5'))},'description':{'type':Sequelize[_0x2340('0x1')]}}; \ No newline at end of file +var _0xe189=['rrmemory','STRING','sequelize','name','INTEGER','ENUM'];(function(_0x2aa364,_0xaad995){var _0x1a7ef3=function(_0x4856c5){while(--_0x4856c5){_0x2aa364['push'](_0x2aa364['shift']());}};_0x1a7ef3(++_0xaad995);}(_0xe189,0x194));var _0x9e18=function(_0x198303,_0x5557b6){_0x198303=_0x198303-0x0;var _0x304343=_0xe189[_0x198303];return _0x304343;};'use strict';var Sequelize=require(_0x9e18('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9e18('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9e18('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9e18('0x3')](_0x9e18('0x4'),'beepall','roundrobin')},'description':{'type':Sequelize[_0x9e18('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index fcf5af0..206e18c 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 _0x525a=['agent','updatedAt','createdAt','format','SIP','whatsappPause','getTeams','Team','filter','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','findOne','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','localhost','socket.io-emitter','./whatsappQueue.socket','offset','undefined','limit','count','status','set','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','query','attributes','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','getMembers','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','merge','User','findAndCountAll','UserId'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x525a,0xa9));var _0xa525=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x525a[_0x247fa1];return _0x244f35;};'use strict';var BPromise=require(_0xa525('0x0'));var util=require('util');var _=require(_0xa525('0x1'));var squel=require(_0xa525('0x2'));var Redis=require(_0xa525('0x3'));var qs=require(_0xa525('0x4'));var logger=require(_0xa525('0x5'))(_0xa525('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xa525('0x7')],{'host':_0xa525('0x8'),'port':0x18eb});var socket=require(_0xa525('0x9'))(new Redis(config['redis']));require(_0xa525('0xa'))['register'](socket);function respondWithStatusCode(_0x4fd78a,_0x128466){_0x128466=_0x128466||0xcc;return function(_0xb39c47){if(_0xb39c47){return _0x4fd78a['sendStatus'](_0x128466);}return _0x4fd78a['status'](_0x128466)['end']();};}function respondWithResult(_0x137bc1,_0x1b5aa8){_0x1b5aa8=_0x1b5aa8||0xc8;return function(_0x2e617a){if(_0x2e617a){return _0x137bc1['status'](_0x1b5aa8)['json'](_0x2e617a);}};}function respondWithFilteredResult(_0x140a20,_0x51c739){return function(_0x24f5ed){if(_0x24f5ed){var _0x4d7453=typeof _0x51c739[_0xa525('0xb')]===_0xa525('0xc')&&typeof _0x51c739[_0xa525('0xd')]==='undefined';var _0x37a86f=_0x24f5ed[_0xa525('0xe')];var _0x11139c=_0x4d7453?0x0:_0x51c739[_0xa525('0xb')];var _0x4d55be=_0x4d7453?_0x24f5ed[_0xa525('0xe')]:_0x51c739[_0xa525('0xb')]+_0x51c739[_0xa525('0xd')];var _0x17295e;if(_0x4d55be>=_0x37a86f){_0x4d55be=_0x37a86f;_0x17295e=0xc8;}else{_0x17295e=0xce;}_0x140a20[_0xa525('0xf')](_0x17295e);return _0x140a20[_0xa525('0x10')]('Content-Range',_0x11139c+'-'+_0x4d55be+'/'+_0x37a86f)[_0xa525('0x11')](_0x24f5ed);}return null;};}function saveUpdates(_0x5c9e48){return function(_0x5acd6d){if(_0x5acd6d){return _0x5acd6d[_0xa525('0x12')](_0x5c9e48)[_0xa525('0x13')](function(_0xb2cdfc){return _0xb2cdfc;});}return null;};}function removeEntity(_0x39579b){return function(_0x2e137a){if(_0x2e137a){return _0x2e137a[_0xa525('0x14')]()[_0xa525('0x13')](function(){var _0x2c77a5=_0x2e137a[_0xa525('0x15')]({'plain':!![]});var _0x1cfe0e=_0xa525('0x16');return db[_0xa525('0x17')]['destroy']({'where':{'type':_0x1cfe0e,'resourceId':_0x2c77a5['id']}})[_0xa525('0x13')](function(){return _0x2e137a;});})[_0xa525('0x13')](function(){_0x39579b['status'](0xcc)[_0xa525('0x18')]();});}};}function handleEntityNotFound(_0xe00da2){return function(_0x38dc21){if(!_0x38dc21){_0xe00da2['sendStatus'](0x194);}return _0x38dc21;};}function handleError(_0x21ad14,_0x574fdf){_0x574fdf=_0x574fdf||0x1f4;return function(_0x16c7ef){logger['error'](_0x16c7ef[_0xa525('0x19')]);if(_0x16c7ef[_0xa525('0x1a')]){delete _0x16c7ef[_0xa525('0x1a')];}_0x21ad14[_0xa525('0xf')](_0x574fdf)[_0xa525('0x1b')](_0x16c7ef);};}exports[_0xa525('0x1c')]=function(_0x2a1e9c,_0xd18905){var _0x1998f3={};var _0x46608a={'count':0x0,'rows':[]};var _0x42c701=_[_0xa525('0x1d')](db[_0xa525('0x1e')][_0xa525('0x1f')],function(_0x2bbb01){return{'name':_0x2bbb01[_0xa525('0x20')],'type':_0x2bbb01[_0xa525('0x21')]['key']};});_0x1998f3=qs[_0xa525('0x22')](_0x42c701,_0x2a1e9c);var _0x21fb2d={'where':_0x1998f3[_0xa525('0x23')]};return db[_0xa525('0x1e')][_0xa525('0xe')](_0x21fb2d)[_0xa525('0x13')](function(_0x2306c7){_0x46608a['count']=_0x2306c7;_0x1998f3['include']=qs[_0xa525('0x24')](_0x2a1e9c['query']);return db[_0xa525('0x1e')][_0xa525('0x25')](_0x1998f3);})['then'](function(_0x357704){_0x46608a[_0xa525('0x26')]=_0x357704;return _0x46608a;})[_0xa525('0x13')](respondWithFilteredResult(_0xd18905,_0x1998f3))[_0xa525('0x27')](handleError(_0xd18905,null));};exports[_0xa525('0x28')]=function(_0x5e4d16,_0x154f99){var _0x1b4b6c={'raw':!![],'where':{'id':_0x5e4d16[_0xa525('0x29')]['id']}},_0x64e5eb={};_0x64e5eb[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x1e')]['rawAttributes']);_0x64e5eb['query']=_[_0xa525('0x2b')](_0x5e4d16['query']);_0x64e5eb[_0xa525('0x2c')]=_[_0xa525('0x2d')](_0x64e5eb[_0xa525('0x2a')],_0x64e5eb['query']);_0x1b4b6c['attributes']=_['intersection'](_0x64e5eb[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0x5e4d16[_0xa525('0x2f')]['fields']));_0x1b4b6c['attributes']=_0x1b4b6c[_0xa525('0x30')][_0xa525('0x31')]?_0x1b4b6c[_0xa525('0x30')]:_0x64e5eb[_0xa525('0x2a')];if(_0x5e4d16['query'][_0xa525('0x32')]){_0x1b4b6c[_0xa525('0x24')]=[{'all':!![]}];}_0x1b4b6c=_['merge']({},_0x1b4b6c,_0x5e4d16[_0xa525('0x33')]);return db[_0xa525('0x1e')][_0xa525('0x34')](_0x1b4b6c)[_0xa525('0x13')](handleEntityNotFound(_0x154f99,null))['then'](respondWithResult(_0x154f99,null))[_0xa525('0x27')](handleError(_0x154f99,null));};exports[_0xa525('0x35')]=function(_0x1adad1,_0x33e2d9){return db[_0xa525('0x1e')][_0xa525('0x35')](_0x1adad1[_0xa525('0x36')],{})[_0xa525('0x13')](function(_0x17996a){var _0xb6ac97=_0x1adad1[_0xa525('0x37')][_0xa525('0x15')]({'plain':!![]});if(!_0xb6ac97)throw new Error(_0xa525('0x38'));if(_0xb6ac97[_0xa525('0x39')]===_0xa525('0x37')){var _0x3f1dcb=_0x17996a[_0xa525('0x15')]({'plain':!![]});var _0xc76a30='WhatsappQueues';return db[_0xa525('0x3a')][_0xa525('0x34')]({'where':{'name':_0xc76a30,'userProfileId':_0xb6ac97[_0xa525('0x3b')]},'raw':!![]})['then'](function(_0x15e6a1){if(_0x15e6a1&&_0x15e6a1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3f1dcb['name'],'resourceId':_0x3f1dcb['id'],'type':_0x15e6a1[_0xa525('0x1a')],'sectionId':_0x15e6a1['id']},{})[_0xa525('0x13')](function(){return _0x17996a;});}else{return _0x17996a;}})[_0xa525('0x27')](function(_0x398b5c){logger[_0xa525('0x3c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x398b5c);throw _0x398b5c;});}return _0x17996a;})['then'](respondWithResult(_0x33e2d9,0xc9))['catch'](handleError(_0x33e2d9,null));};exports[_0xa525('0x12')]=function(_0x47ce35,_0x5a960e){if(_0x47ce35[_0xa525('0x36')]['id']){delete _0x47ce35['body']['id'];}return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x47ce35['params']['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x5a960e,null))[_0xa525('0x13')](saveUpdates(_0x47ce35[_0xa525('0x36')],null))['then'](respondWithResult(_0x5a960e,null))[_0xa525('0x27')](handleError(_0x5a960e,null));};exports[_0xa525('0x14')]=function(_0x3dea22,_0x377e07){return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x3dea22[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x377e07,null))[_0xa525('0x13')](removeEntity(_0x377e07,null))['catch'](handleError(_0x377e07,null));};exports['describe']=function(_0x1b94ea,_0x5e9f40){return db[_0xa525('0x1e')]['describe']()[_0xa525('0x13')](respondWithResult(_0x5e9f40,null))['catch'](handleError(_0x5e9f40,null));};exports[_0xa525('0x3d')]=function(_0x31b332,_0x1e9673){var _0x480f2a={'raw':!![],'where':{}},_0x5cc693={},_0x3f34d5;return db[_0xa525('0x1e')]['findOne']({'where':{'id':_0x31b332[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x1e9673,null))[_0xa525('0x13')](function(_0x5d35f3){if(_0x5d35f3){_0x3f34d5=_0x5d35f3[_0xa525('0x15')]({'plain':!![]});_0x5cc693[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x3e')]['rawAttributes']);_0x5cc693[_0xa525('0x2f')]=_[_0xa525('0x2b')](_0x31b332[_0xa525('0x2f')]);_0x5cc693[_0xa525('0x2c')]=_[_0xa525('0x2d')](_0x5cc693[_0xa525('0x2a')],_0x5cc693[_0xa525('0x2f')]);_0x480f2a[_0xa525('0x30')]=_[_0xa525('0x2d')](_0x5cc693[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0x31b332[_0xa525('0x2f')]['fields']));_0x480f2a[_0xa525('0x30')]=_0x480f2a[_0xa525('0x30')]['length']?_0x480f2a[_0xa525('0x30')]:_0x5cc693[_0xa525('0x2a')];if(!_0x31b332[_0xa525('0x2f')][_0xa525('0x3f')](_0xa525('0x40'))){_0x480f2a['limit']=qs[_0xa525('0xd')](_0x31b332['query'][_0xa525('0xd')]);_0x480f2a['offset']=qs['offset'](_0x31b332[_0xa525('0x2f')][_0xa525('0xb')]);}_0x480f2a[_0xa525('0x41')]=qs[_0xa525('0x42')](_0x31b332['query'][_0xa525('0x42')]);_0x480f2a[_0xa525('0x23')]=qs[_0xa525('0x2c')](_[_0xa525('0x43')](_0x31b332['query'],_0x5cc693[_0xa525('0x2c')]));_0x480f2a[_0xa525('0x23')][_0xa525('0x44')]=_0x5d35f3['id'];if(_0x31b332[_0xa525('0x2f')]['filter']){_0x480f2a[_0xa525('0x23')]=_['merge'](_0x480f2a[_0xa525('0x23')],{'$or':_['map'](_0x480f2a['attributes'],function(_0x1186cb){var _0x5d0c7e={};_0x5d0c7e[_0x1186cb]={'$like':'%'+_0x31b332[_0xa525('0x2f')]['filter']+'%'};return _0x5d0c7e;})});}_0x480f2a=_[_0xa525('0x45')]({},_0x480f2a,_0x31b332[_0xa525('0x33')]);return db[_0xa525('0x3e')][_0xa525('0x25')](_0x480f2a);}})[_0xa525('0x13')](function(_0x26a855){if(_0x26a855){return db[_0xa525('0x46')][_0xa525('0x47')]({'where':{'id':_[_0xa525('0x1d')](_0x26a855,_0xa525('0x48')),'role':_0xa525('0x49')},'attributes':['id',_0xa525('0x1a'),'whatsappPause',_0xa525('0x4a'),_0xa525('0x4b')]});}})[_0xa525('0x13')](function(_0x151b8f){if(_0x151b8f){return{'count':_0x151b8f['count'],'rows':_[_0xa525('0x1d')](_0x151b8f[_0xa525('0x26')],function(_0xa469ec){return{'membername':_0xa469ec[_0xa525('0x1a')],'UserId':_0xa469ec['id'],'queue_name':_0x3f34d5[_0xa525('0x1a')],'WhatsappQueueId':_0x3f34d5['id'],'interface':util[_0xa525('0x4c')]('%s/%s',_0xa525('0x4d'),_0xa469ec[_0xa525('0x1a')]),'penalty':0x0,'paused':_0xa469ec[_0xa525('0x4e')],'createdAt':_0xa469ec[_0xa525('0x4b')],'updatedAt':_0xa469ec['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa525('0x13')](respondWithFilteredResult(_0x1e9673,_0x480f2a))[_0xa525('0x27')](handleError(_0x1e9673,null));};exports[_0xa525('0x4f')]=function(_0xb2668d,_0x3533f6){var _0x3c8e82={};var _0x58673d={};var _0x1f5f9b;var _0x3af4ad;return db['WhatsappQueue']['findOne']({'where':{'id':_0xb2668d[_0xa525('0x29')]['id']}})['then'](handleEntityNotFound(_0x3533f6,null))['then'](function(_0x58edf5){if(_0x58edf5){_0x1f5f9b=_0x58edf5;_0x58673d[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x50')]['rawAttributes']);_0x58673d[_0xa525('0x2f')]=_['keys'](_0xb2668d[_0xa525('0x2f')]);_0x58673d['filters']=_[_0xa525('0x2d')](_0x58673d[_0xa525('0x2a')],_0x58673d['query']);_0x3c8e82[_0xa525('0x30')]=_[_0xa525('0x2d')](_0x58673d[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0xb2668d[_0xa525('0x2f')][_0xa525('0x2e')]));_0x3c8e82[_0xa525('0x30')]=_0x3c8e82[_0xa525('0x30')]['length']?_0x3c8e82['attributes']:_0x58673d[_0xa525('0x2a')];_0x3c8e82[_0xa525('0x41')]=qs['sort'](_0xb2668d[_0xa525('0x2f')]['sort']);_0x3c8e82[_0xa525('0x23')]=qs[_0xa525('0x2c')](_[_0xa525('0x43')](_0xb2668d[_0xa525('0x2f')],_0x58673d[_0xa525('0x2c')]));if(_0xb2668d['query'][_0xa525('0x51')]){_0x3c8e82[_0xa525('0x23')]=_['merge'](_0x3c8e82['where'],{'$or':_[_0xa525('0x1d')](_0x3c8e82[_0xa525('0x30')],function(_0x4ed16f){var _0x11c3f5={};_0x11c3f5[_0x4ed16f]={'$like':'%'+_0xb2668d['query'][_0xa525('0x51')]+'%'};return _0x11c3f5;})});}_0x3c8e82=_['merge']({},_0x3c8e82,_0xb2668d[_0xa525('0x33')]);return _0x1f5f9b[_0xa525('0x4f')](_0x3c8e82);}})[_0xa525('0x13')](function(_0x32b403){if(_0x32b403){_0x3af4ad=_0x32b403['length'];if(!_0xb2668d[_0xa525('0x2f')]['hasOwnProperty'](_0xa525('0x40'))){_0x3c8e82[_0xa525('0xd')]=qs['limit'](_0xb2668d[_0xa525('0x2f')][_0xa525('0xd')]);_0x3c8e82[_0xa525('0xb')]=qs['offset'](_0xb2668d[_0xa525('0x2f')][_0xa525('0xb')]);}return _0x1f5f9b[_0xa525('0x4f')](_0x3c8e82);}})[_0xa525('0x13')](function(_0x46bc2c){if(_0x46bc2c){return _0x46bc2c?{'count':_0x3af4ad,'rows':_0x46bc2c}:null;}})[_0xa525('0x13')](respondWithResult(_0x3533f6,null))[_0xa525('0x27')](handleError(_0x3533f6,null));};exports['addTeams']=function(_0x58db17,_0x1878bd){var _0x222df7=_0x58db17[_0xa525('0x36')][_0xa525('0x52')];return db[_0xa525('0x50')][_0xa525('0x25')]({'where':{'id':_0x222df7},'attributes':['id'],'include':[{'model':db[_0xa525('0x46')],'as':_0xa525('0x53'),'attributes':['id',_0xa525('0x1a'),_0xa525('0x54'),_0xa525('0x55'),'interface'],'raw':!![]}]})[_0xa525('0x13')](function(_0x2d5d9a){if(_0x2d5d9a){var _0xef84f1=_[_0xa525('0x56')](_0x2d5d9a,function(_0x242b39){var _0x944927=_0x242b39['get']({'plain':!![]});return _0x944927[_0xa525('0x53')];});return db[_0xa525('0x1e')]['find']({'where':{'id':_0x58db17[_0xa525('0x29')]['id']}})['then'](function(_0x173523){return db[_0xa525('0x57')][_0xa525('0x58')](function(_0x32b509){return _0x173523['addTeams'](_0x222df7,{'transaction':_0x32b509})[_0xa525('0x13')](function(){return BPromise[_0xa525('0x59')](_0xef84f1,function(_0x34f0e9){return db['UserWhatsappQueue'][_0xa525('0x5a')]({'where':{'UserId':_0x34f0e9['id'],'WhatsappQueueId':_0x58db17[_0xa525('0x29')]['id']},'transaction':_0x32b509});});})[_0xa525('0x13')](function(){_0xef84f1[_0xa525('0x5b')](function(_0x47d10d){socket['emit'](_0xa525('0x5c'),{'UserId':_0x47d10d['id'],'WhatsappQueueId':_0x173523['id']});});});});});}})[_0xa525('0x13')](respondWithStatusCode(_0x1878bd,null))[_0xa525('0x27')](handleError(_0x1878bd,null));};exports['removeTeams']=function(_0x177915,_0x108a9a){return db[_0xa525('0x50')][_0xa525('0x25')]({'where':{'id':_0x177915[_0xa525('0x2f')][_0xa525('0x52')]},'attributes':['id'],'include':[{'model':db[_0xa525('0x46')],'as':_0xa525('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x108a9a,null))['then'](function(_0x480ce0){var _0x10b9c9=_['map'](_0x480ce0,'id');var _0x2591e0=[];var _0x27efc2=[];var _0x54c80=squel[_0xa525('0x5d')]();_0x54c80[_0xa525('0x5e')](_0xa525('0x5f'))['from'](_0xa525('0x60'),'tq')[_0xa525('0x61')](_0xa525('0x62'),'ut',_0xa525('0x63'))['where'](_0xa525('0x64'),_0x177915['params']['id']);for(var _0x4f72c3=0x0;_0x4f72c3<_0x480ce0[_0xa525('0x31')];_0x4f72c3+=0x1){let _0x1f674a=_0x480ce0[_0x4f72c3];for(var _0x1537ea=0x0;_0x1537ea<_0x1f674a[_0xa525('0x53')][_0xa525('0x31')];_0x1537ea+=0x1){let _0x5a0073=_0x1f674a[_0xa525('0x53')][_0x1537ea];var _0x4bbcff=_0x54c80['clone']();_0x4bbcff[_0xa525('0x23')]('ut.UserId\x20=\x20?',_0x5a0073['id']);_0x27efc2[_0xa525('0x65')](db['sequelize'][_0xa525('0x2f')](_0x4bbcff[_0xa525('0x66')](),{'type':db[_0xa525('0x57')]['QueryTypes'][_0xa525('0x67')]})['then'](function(_0x3d2336){if(_0x3d2336[_0xa525('0x31')]===0x1){return _0x5a0073['id'];}else{var _0x20d84b=_[_0xa525('0x68')](_[_0xa525('0x1d')](_0x3d2336,_0xa525('0x69')),function(_0x4934da){return _[_0xa525('0x6a')](_0x10b9c9,_0x4934da);});if(_0x20d84b){return _0x5a0073['id'];}}}));}}return BPromise[_0xa525('0x6b')](_0x27efc2)[_0xa525('0x13')](function(_0x59a675){_0x2591e0=_(_0x2591e0)[_0xa525('0x6c')](_0x59a675)[_0xa525('0x6d')]()[_0xa525('0x6e')]();return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x177915['params']['id']}})[_0xa525('0x13')](function(_0x704ec9){return db[_0xa525('0x57')][_0xa525('0x58')](function(_0x4dfacf){return _0x704ec9['removeTeams'](_0x177915[_0xa525('0x2f')][_0xa525('0x52')],{'transaction':_0x4dfacf})[_0xa525('0x13')](function(){if(!_[_0xa525('0x6f')](_0x2591e0)){return _0x704ec9[_0xa525('0x70')](_0x2591e0,{'transaction':_0x4dfacf});}})[_0xa525('0x13')](function(){_0x2591e0[_0xa525('0x5b')](function(_0x3229ed){socket[_0xa525('0x71')]('userWhatsappQueue:remove',{'UserId':_0x3229ed,'WhatsappQueueId':_0x704ec9['id']});});});});});});})[_0xa525('0x13')](respondWithStatusCode(_0x108a9a,null))['catch'](handleError(_0x108a9a,null));};exports['addAgents']=function(_0x3c43ab,_0x30c0d5){return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x3c43ab[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x30c0d5,null))['then'](function(_0x393e4d){if(_0x393e4d){return _0x393e4d[_0xa525('0x72')](_0x3c43ab[_0xa525('0x36')][_0xa525('0x52')],_[_0xa525('0x73')](_0x3c43ab['body'],['ids','id'])||{})[_0xa525('0x74')](function(_0x6a563a){for(var _0x1075fb=0x0;_0x1075fb<_0x3c43ab[_0xa525('0x36')][_0xa525('0x52')][_0xa525('0x31')];_0x1075fb+=0x1){socket[_0xa525('0x71')](_0xa525('0x5c'),{'UserId':Number(_0x3c43ab[_0xa525('0x36')][_0xa525('0x52')][_0x1075fb]),'WhatsappQueueId':Number(_0x3c43ab[_0xa525('0x29')]['id'])});}return _0x6a563a;});}})[_0xa525('0x13')](respondWithResult(_0x30c0d5,null))[_0xa525('0x27')](handleError(_0x30c0d5,null));};exports[_0xa525('0x70')]=function(_0x27c9c9,_0x106fda){return db[_0xa525('0x1e')][_0xa525('0x34')]({'where':{'id':_0x27c9c9[_0xa525('0x29')]['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x106fda,null))[_0xa525('0x13')](function(_0x3077c3){if(_0x3077c3){return _0x3077c3[_0xa525('0x70')](_0x27c9c9['query']['ids'])[_0xa525('0x13')](function(){if(_[_0xa525('0x75')](_0x27c9c9['query'][_0xa525('0x52')])){for(var _0x1d7827=0x0;_0x1d7827<_0x27c9c9['query'][_0xa525('0x52')][_0xa525('0x31')];_0x1d7827+=0x1){socket[_0xa525('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x27c9c9['query'][_0xa525('0x52')][_0x1d7827]),'WhatsappQueueId':Number(_0x27c9c9[_0xa525('0x29')]['id'])});}}else{socket[_0xa525('0x71')](_0xa525('0x76'),{'UserId':Number(_0x27c9c9[_0xa525('0x2f')][_0xa525('0x52')]),'WhatsappQueueId':Number(_0x27c9c9[_0xa525('0x29')]['id'])});}});}})[_0xa525('0x13')](respondWithStatusCode(_0x106fda,null))[_0xa525('0x27')](handleError(_0x106fda,null));};exports[_0xa525('0x77')]=function(_0x2210e3,_0x3396f4){var _0x3ab802={};var _0x351bf7={};var _0x21d831;var _0x5c70f6;return db[_0xa525('0x1e')][_0xa525('0x78')]({'where':{'id':_0x2210e3['params']['id']}})[_0xa525('0x13')](handleEntityNotFound(_0x3396f4,null))['then'](function(_0x3fa4d9){if(_0x3fa4d9){_0x21d831=_0x3fa4d9;_0x351bf7[_0xa525('0x2a')]=_[_0xa525('0x2b')](db[_0xa525('0x46')][_0xa525('0x1f')]);_0x351bf7[_0xa525('0x2f')]=_['keys'](_0x2210e3[_0xa525('0x2f')]);_0x351bf7[_0xa525('0x2c')]=_[_0xa525('0x2d')](_0x351bf7[_0xa525('0x2a')],_0x351bf7[_0xa525('0x2f')]);_0x3ab802[_0xa525('0x30')]=_[_0xa525('0x2d')](_0x351bf7[_0xa525('0x2a')],qs[_0xa525('0x2e')](_0x2210e3[_0xa525('0x2f')]['fields']));_0x3ab802['attributes']=_0x3ab802['attributes'][_0xa525('0x31')]?_0x3ab802['attributes']:_0x351bf7[_0xa525('0x2a')];_0x3ab802['order']=qs['sort'](_0x2210e3[_0xa525('0x2f')][_0xa525('0x42')]);_0x3ab802[_0xa525('0x23')]=qs[_0xa525('0x2c')](_['pick'](_0x2210e3[_0xa525('0x2f')],_0x351bf7['filters']));if(_0x2210e3[_0xa525('0x2f')][_0xa525('0x51')]){_0x3ab802[_0xa525('0x23')]=_['merge'](_0x3ab802[_0xa525('0x23')],{'$or':_[_0xa525('0x1d')](_0x3ab802[_0xa525('0x30')],function(_0x5f4c01){var _0x106839={};_0x106839[_0x5f4c01]={'$like':'%'+_0x2210e3[_0xa525('0x2f')][_0xa525('0x51')]+'%'};return _0x106839;})});}_0x3ab802=_[_0xa525('0x45')]({},_0x3ab802,_0x2210e3[_0xa525('0x33')]);return _0x21d831[_0xa525('0x77')](_0x3ab802);}})[_0xa525('0x13')](function(_0x1a76ce){if(_0x1a76ce){_0x5c70f6=_0x1a76ce[_0xa525('0x31')];if(!_0x2210e3[_0xa525('0x2f')][_0xa525('0x3f')](_0xa525('0x40'))){_0x3ab802[_0xa525('0xd')]=qs[_0xa525('0xd')](_0x2210e3[_0xa525('0x2f')][_0xa525('0xd')]);_0x3ab802['offset']=qs[_0xa525('0xb')](_0x2210e3[_0xa525('0x2f')][_0xa525('0xb')]);}return _0x21d831[_0xa525('0x77')](_0x3ab802);}})[_0xa525('0x13')](function(_0x39e33f){if(_0x39e33f){return _0x39e33f?{'count':_0x5c70f6,'rows':_0x39e33f}:null;}})[_0xa525('0x13')](respondWithResult(_0x3396f4,null))['catch'](handleError(_0x3396f4,null));}; \ No newline at end of file +var _0xc805=['each','findOrCreate','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','union','value','removeTeams','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','end','offset','undefined','limit','count','status','set','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','hasOwnProperty','nolimit','order','sort','WhatsappQueueId','filter','merge','map','UserWhatsappQueue','findAll','User','UserId','createdAt','%s/%s','SIP','whatsappPause','updatedAt','Team','pick','getTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0xc805,0x114));var _0x5c80=function(_0x3e469e,_0x334923){_0x3e469e=_0x3e469e-0x0;var _0x33d855=_0xc805[_0x3e469e];return _0x33d855;};'use strict';var BPromise=require(_0x5c80('0x0'));var util=require(_0x5c80('0x1'));var _=require(_0x5c80('0x2'));var squel=require(_0x5c80('0x3'));var Redis=require(_0x5c80('0x4'));var qs=require(_0x5c80('0x5'));var logger=require(_0x5c80('0x6'))('api');var config=require(_0x5c80('0x7'));var db=require(_0x5c80('0x8'))['db'];config['redis']=_['defaults'](config[_0x5c80('0x9')],{'host':_0x5c80('0xa'),'port':0x18eb});var socket=require(_0x5c80('0xb'))(new Redis(config[_0x5c80('0x9')]));require(_0x5c80('0xc'))['register'](socket);function respondWithStatusCode(_0x1ae3df,_0x3dc962){_0x3dc962=_0x3dc962||0xcc;return function(_0x1bf93c){if(_0x1bf93c){return _0x1ae3df['sendStatus'](_0x3dc962);}return _0x1ae3df['status'](_0x3dc962)[_0x5c80('0xd')]();};}function respondWithResult(_0x1540ef,_0xca5a66){_0xca5a66=_0xca5a66||0xc8;return function(_0x4eb990){if(_0x4eb990){return _0x1540ef['status'](_0xca5a66)['json'](_0x4eb990);}};}function respondWithFilteredResult(_0xcf9dad,_0x481fe7){return function(_0x4fd9a9){if(_0x4fd9a9){var _0x2c06c6=typeof _0x481fe7[_0x5c80('0xe')]===_0x5c80('0xf')&&typeof _0x481fe7[_0x5c80('0x10')]===_0x5c80('0xf');var _0x379774=_0x4fd9a9[_0x5c80('0x11')];var _0x307446=_0x2c06c6?0x0:_0x481fe7[_0x5c80('0xe')];var _0x58e999=_0x2c06c6?_0x4fd9a9[_0x5c80('0x11')]:_0x481fe7[_0x5c80('0xe')]+_0x481fe7[_0x5c80('0x10')];var _0x501f6c;if(_0x58e999>=_0x379774){_0x58e999=_0x379774;_0x501f6c=0xc8;}else{_0x501f6c=0xce;}_0xcf9dad[_0x5c80('0x12')](_0x501f6c);return _0xcf9dad[_0x5c80('0x13')]('Content-Range',_0x307446+'-'+_0x58e999+'/'+_0x379774)[_0x5c80('0x14')](_0x4fd9a9);}return null;};}function saveUpdates(_0xb5b579){return function(_0x349414){if(_0x349414){return _0x349414[_0x5c80('0x15')](_0xb5b579)[_0x5c80('0x16')](function(_0x534468){return _0x534468;});}return null;};}function removeEntity(_0x48e5dc){return function(_0x7f7288){if(_0x7f7288){return _0x7f7288[_0x5c80('0x17')]()[_0x5c80('0x16')](function(){var _0x32a672=_0x7f7288[_0x5c80('0x18')]({'plain':!![]});var _0x35541f=_0x5c80('0x19');return db[_0x5c80('0x1a')][_0x5c80('0x17')]({'where':{'type':_0x35541f,'resourceId':_0x32a672['id']}})['then'](function(){return _0x7f7288;});})[_0x5c80('0x16')](function(){_0x48e5dc[_0x5c80('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da847){return function(_0x5641dd){if(!_0x5641dd){_0x2da847['sendStatus'](0x194);}return _0x5641dd;};}function handleError(_0x259ab0,_0x1523e4){_0x1523e4=_0x1523e4||0x1f4;return function(_0x2c9817){logger[_0x5c80('0x1b')](_0x2c9817[_0x5c80('0x1c')]);if(_0x2c9817['name']){delete _0x2c9817[_0x5c80('0x1d')];}_0x259ab0[_0x5c80('0x12')](_0x1523e4)[_0x5c80('0x1e')](_0x2c9817);};}exports[_0x5c80('0x1f')]=function(_0x3a691f,_0x3cc073){var _0x44a6f4={};var _0x4d26f5={'count':0x0,'rows':[]};var _0x194f44=_['map'](db[_0x5c80('0x20')][_0x5c80('0x21')],function(_0x21cc80){return{'name':_0x21cc80[_0x5c80('0x22')],'type':_0x21cc80[_0x5c80('0x23')][_0x5c80('0x24')]};});_0x44a6f4=qs[_0x5c80('0x25')](_0x194f44,_0x3a691f);var _0x1a6d4a={'where':_0x44a6f4[_0x5c80('0x26')]};return db[_0x5c80('0x20')][_0x5c80('0x11')](_0x1a6d4a)[_0x5c80('0x16')](function(_0x58b030){_0x4d26f5['count']=_0x58b030;_0x44a6f4[_0x5c80('0x27')]=qs['include'](_0x3a691f[_0x5c80('0x28')]);return db[_0x5c80('0x20')]['findAll'](_0x44a6f4);})[_0x5c80('0x16')](function(_0x4c6754){_0x4d26f5[_0x5c80('0x29')]=_0x4c6754;return _0x4d26f5;})[_0x5c80('0x16')](respondWithFilteredResult(_0x3cc073,_0x44a6f4))[_0x5c80('0x2a')](handleError(_0x3cc073,null));};exports[_0x5c80('0x2b')]=function(_0x136b82,_0x214d70){var _0x43bbf5={'raw':!![],'where':{'id':_0x136b82[_0x5c80('0x2c')]['id']}},_0x3c3f0e={};_0x3c3f0e[_0x5c80('0x2d')]=_['keys'](db['WhatsappQueue'][_0x5c80('0x21')]);_0x3c3f0e[_0x5c80('0x28')]=_[_0x5c80('0x2e')](_0x136b82[_0x5c80('0x28')]);_0x3c3f0e[_0x5c80('0x2f')]=_[_0x5c80('0x30')](_0x3c3f0e[_0x5c80('0x2d')],_0x3c3f0e[_0x5c80('0x28')]);_0x43bbf5[_0x5c80('0x31')]=_['intersection'](_0x3c3f0e[_0x5c80('0x2d')],qs['fields'](_0x136b82['query'][_0x5c80('0x32')]));_0x43bbf5['attributes']=_0x43bbf5[_0x5c80('0x31')]['length']?_0x43bbf5[_0x5c80('0x31')]:_0x3c3f0e[_0x5c80('0x2d')];if(_0x136b82[_0x5c80('0x28')][_0x5c80('0x33')]){_0x43bbf5[_0x5c80('0x27')]=[{'all':!![]}];}_0x43bbf5=_['merge']({},_0x43bbf5,_0x136b82[_0x5c80('0x34')]);return db[_0x5c80('0x20')][_0x5c80('0x35')](_0x43bbf5)[_0x5c80('0x16')](handleEntityNotFound(_0x214d70,null))[_0x5c80('0x16')](respondWithResult(_0x214d70,null))[_0x5c80('0x2a')](handleError(_0x214d70,null));};exports[_0x5c80('0x36')]=function(_0x3574a3,_0x30fedb){return db[_0x5c80('0x20')][_0x5c80('0x36')](_0x3574a3[_0x5c80('0x37')],{})[_0x5c80('0x16')](function(_0xdf1b80){var _0x227805=_0x3574a3[_0x5c80('0x38')]['get']({'plain':!![]});if(!_0x227805)throw new Error(_0x5c80('0x39'));if(_0x227805[_0x5c80('0x3a')]===_0x5c80('0x38')){var _0x5c300c=_0xdf1b80[_0x5c80('0x18')]({'plain':!![]});var _0x16a705='WhatsappQueues';return db['UserProfileSection'][_0x5c80('0x35')]({'where':{'name':_0x16a705,'userProfileId':_0x227805[_0x5c80('0x3b')]},'raw':!![]})[_0x5c80('0x16')](function(_0x1b2f31){if(_0x1b2f31&&_0x1b2f31['autoAssociation']===0x0){return db[_0x5c80('0x1a')][_0x5c80('0x36')]({'name':_0x5c300c['name'],'resourceId':_0x5c300c['id'],'type':_0x1b2f31[_0x5c80('0x1d')],'sectionId':_0x1b2f31['id']},{})[_0x5c80('0x16')](function(){return _0xdf1b80;});}else{return _0xdf1b80;}})[_0x5c80('0x2a')](function(_0x3780d9){logger[_0x5c80('0x1b')](_0x5c80('0x3c'),_0x3780d9);throw _0x3780d9;});}return _0xdf1b80;})[_0x5c80('0x16')](respondWithResult(_0x30fedb,0xc9))['catch'](handleError(_0x30fedb,null));};exports[_0x5c80('0x15')]=function(_0x2044de,_0x359d45){if(_0x2044de[_0x5c80('0x37')]['id']){delete _0x2044de[_0x5c80('0x37')]['id'];}return db[_0x5c80('0x20')][_0x5c80('0x35')]({'where':{'id':_0x2044de[_0x5c80('0x2c')]['id']}})[_0x5c80('0x16')](handleEntityNotFound(_0x359d45,null))[_0x5c80('0x16')](saveUpdates(_0x2044de['body'],null))[_0x5c80('0x16')](respondWithResult(_0x359d45,null))[_0x5c80('0x2a')](handleError(_0x359d45,null));};exports[_0x5c80('0x17')]=function(_0x2451e4,_0x4bc2c8){return db[_0x5c80('0x20')][_0x5c80('0x35')]({'where':{'id':_0x2451e4[_0x5c80('0x2c')]['id']}})[_0x5c80('0x16')](handleEntityNotFound(_0x4bc2c8,null))[_0x5c80('0x16')](removeEntity(_0x4bc2c8,null))['catch'](handleError(_0x4bc2c8,null));};exports[_0x5c80('0x3d')]=function(_0x39a94f,_0xfa8fee){return db['WhatsappQueue'][_0x5c80('0x3d')]()['then'](respondWithResult(_0xfa8fee,null))['catch'](handleError(_0xfa8fee,null));};exports[_0x5c80('0x3e')]=function(_0x4296cf,_0x260d0c){var _0xe797fc={'raw':!![],'where':{}},_0x214b5a={},_0x36d059;return db[_0x5c80('0x20')][_0x5c80('0x3f')]({'where':{'id':_0x4296cf[_0x5c80('0x2c')]['id']}})['then'](handleEntityNotFound(_0x260d0c,null))['then'](function(_0xec858f){if(_0xec858f){_0x36d059=_0xec858f['get']({'plain':!![]});_0x214b5a[_0x5c80('0x2d')]=_[_0x5c80('0x2e')](db['UserWhatsappQueue'][_0x5c80('0x21')]);_0x214b5a[_0x5c80('0x28')]=_[_0x5c80('0x2e')](_0x4296cf['query']);_0x214b5a[_0x5c80('0x2f')]=_[_0x5c80('0x30')](_0x214b5a[_0x5c80('0x2d')],_0x214b5a['query']);_0xe797fc[_0x5c80('0x31')]=_[_0x5c80('0x30')](_0x214b5a['model'],qs['fields'](_0x4296cf[_0x5c80('0x28')][_0x5c80('0x32')]));_0xe797fc[_0x5c80('0x31')]=_0xe797fc[_0x5c80('0x31')][_0x5c80('0x40')]?_0xe797fc[_0x5c80('0x31')]:_0x214b5a[_0x5c80('0x2d')];if(!_0x4296cf[_0x5c80('0x28')][_0x5c80('0x41')](_0x5c80('0x42'))){_0xe797fc[_0x5c80('0x10')]=qs['limit'](_0x4296cf[_0x5c80('0x28')][_0x5c80('0x10')]);_0xe797fc[_0x5c80('0xe')]=qs[_0x5c80('0xe')](_0x4296cf[_0x5c80('0x28')][_0x5c80('0xe')]);}_0xe797fc[_0x5c80('0x43')]=qs[_0x5c80('0x44')](_0x4296cf[_0x5c80('0x28')]['sort']);_0xe797fc[_0x5c80('0x26')]=qs[_0x5c80('0x2f')](_['pick'](_0x4296cf[_0x5c80('0x28')],_0x214b5a['filters']));_0xe797fc[_0x5c80('0x26')][_0x5c80('0x45')]=_0xec858f['id'];if(_0x4296cf['query'][_0x5c80('0x46')]){_0xe797fc[_0x5c80('0x26')]=_[_0x5c80('0x47')](_0xe797fc[_0x5c80('0x26')],{'$or':_[_0x5c80('0x48')](_0xe797fc[_0x5c80('0x31')],function(_0x198bf6){var _0x273f70={};_0x273f70[_0x198bf6]={'$like':'%'+_0x4296cf[_0x5c80('0x28')][_0x5c80('0x46')]+'%'};return _0x273f70;})});}_0xe797fc=_[_0x5c80('0x47')]({},_0xe797fc,_0x4296cf[_0x5c80('0x34')]);return db[_0x5c80('0x49')][_0x5c80('0x4a')](_0xe797fc);}})[_0x5c80('0x16')](function(_0x399171){if(_0x399171){return db[_0x5c80('0x4b')]['findAndCountAll']({'where':{'id':_[_0x5c80('0x48')](_0x399171,_0x5c80('0x4c')),'role':'agent'},'attributes':['id',_0x5c80('0x1d'),'whatsappPause','updatedAt',_0x5c80('0x4d')]});}})[_0x5c80('0x16')](function(_0x19c702){if(_0x19c702){return{'count':_0x19c702[_0x5c80('0x11')],'rows':_[_0x5c80('0x48')](_0x19c702['rows'],function(_0x19d144){return{'membername':_0x19d144[_0x5c80('0x1d')],'UserId':_0x19d144['id'],'queue_name':_0x36d059[_0x5c80('0x1d')],'WhatsappQueueId':_0x36d059['id'],'interface':util['format'](_0x5c80('0x4e'),_0x5c80('0x4f'),_0x19d144[_0x5c80('0x1d')]),'penalty':0x0,'paused':_0x19d144[_0x5c80('0x50')],'createdAt':_0x19d144[_0x5c80('0x4d')],'updatedAt':_0x19d144[_0x5c80('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c80('0x16')](respondWithFilteredResult(_0x260d0c,_0xe797fc))[_0x5c80('0x2a')](handleError(_0x260d0c,null));};exports['getTeams']=function(_0x4c9e8d,_0x57f368){var _0x420533={};var _0x4bfc5f={};var _0x2fd97f;var _0x12b9a4;return db[_0x5c80('0x20')][_0x5c80('0x3f')]({'where':{'id':_0x4c9e8d[_0x5c80('0x2c')]['id']}})[_0x5c80('0x16')](handleEntityNotFound(_0x57f368,null))['then'](function(_0x5b6847){if(_0x5b6847){_0x2fd97f=_0x5b6847;_0x4bfc5f[_0x5c80('0x2d')]=_[_0x5c80('0x2e')](db[_0x5c80('0x52')][_0x5c80('0x21')]);_0x4bfc5f[_0x5c80('0x28')]=_[_0x5c80('0x2e')](_0x4c9e8d[_0x5c80('0x28')]);_0x4bfc5f[_0x5c80('0x2f')]=_[_0x5c80('0x30')](_0x4bfc5f[_0x5c80('0x2d')],_0x4bfc5f[_0x5c80('0x28')]);_0x420533[_0x5c80('0x31')]=_['intersection'](_0x4bfc5f[_0x5c80('0x2d')],qs[_0x5c80('0x32')](_0x4c9e8d[_0x5c80('0x28')][_0x5c80('0x32')]));_0x420533[_0x5c80('0x31')]=_0x420533[_0x5c80('0x31')][_0x5c80('0x40')]?_0x420533[_0x5c80('0x31')]:_0x4bfc5f[_0x5c80('0x2d')];_0x420533[_0x5c80('0x43')]=qs[_0x5c80('0x44')](_0x4c9e8d[_0x5c80('0x28')][_0x5c80('0x44')]);_0x420533['where']=qs['filters'](_[_0x5c80('0x53')](_0x4c9e8d['query'],_0x4bfc5f[_0x5c80('0x2f')]));if(_0x4c9e8d[_0x5c80('0x28')][_0x5c80('0x46')]){_0x420533[_0x5c80('0x26')]=_[_0x5c80('0x47')](_0x420533[_0x5c80('0x26')],{'$or':_[_0x5c80('0x48')](_0x420533[_0x5c80('0x31')],function(_0x4fbd24){var _0x768f09={};_0x768f09[_0x4fbd24]={'$like':'%'+_0x4c9e8d['query'][_0x5c80('0x46')]+'%'};return _0x768f09;})});}_0x420533=_[_0x5c80('0x47')]({},_0x420533,_0x4c9e8d[_0x5c80('0x34')]);return _0x2fd97f['getTeams'](_0x420533);}})[_0x5c80('0x16')](function(_0xb65a2e){if(_0xb65a2e){_0x12b9a4=_0xb65a2e[_0x5c80('0x40')];if(!_0x4c9e8d[_0x5c80('0x28')]['hasOwnProperty'](_0x5c80('0x42'))){_0x420533['limit']=qs[_0x5c80('0x10')](_0x4c9e8d[_0x5c80('0x28')][_0x5c80('0x10')]);_0x420533[_0x5c80('0xe')]=qs[_0x5c80('0xe')](_0x4c9e8d['query'][_0x5c80('0xe')]);}return _0x2fd97f[_0x5c80('0x54')](_0x420533);}})[_0x5c80('0x16')](function(_0x9e1d01){if(_0x9e1d01){return _0x9e1d01?{'count':_0x12b9a4,'rows':_0x9e1d01}:null;}})[_0x5c80('0x16')](respondWithResult(_0x57f368,null))['catch'](handleError(_0x57f368,null));};exports['addTeams']=function(_0x10a0de,_0x1d7a6d){var _0x3f7570=_0x10a0de[_0x5c80('0x37')][_0x5c80('0x55')];return db[_0x5c80('0x52')][_0x5c80('0x4a')]({'where':{'id':_0x3f7570},'attributes':['id'],'include':[{'model':db[_0x5c80('0x4b')],'as':_0x5c80('0x56'),'attributes':['id',_0x5c80('0x1d'),_0x5c80('0x57'),_0x5c80('0x58'),'interface'],'raw':!![]}]})['then'](function(_0x4435ec){if(_0x4435ec){var _0x3a0e18=_[_0x5c80('0x59')](_0x4435ec,function(_0x36f46d){var _0x175584=_0x36f46d[_0x5c80('0x18')]({'plain':!![]});return _0x175584[_0x5c80('0x56')];});return db[_0x5c80('0x20')][_0x5c80('0x35')]({'where':{'id':_0x10a0de[_0x5c80('0x2c')]['id']}})['then'](function(_0x5946cf){return db[_0x5c80('0x5a')][_0x5c80('0x5b')](function(_0x23da65){return _0x5946cf[_0x5c80('0x5c')](_0x3f7570,{'transaction':_0x23da65})[_0x5c80('0x16')](function(){return BPromise[_0x5c80('0x5d')](_0x3a0e18,function(_0x2f0786){return db['UserWhatsappQueue'][_0x5c80('0x5e')]({'where':{'UserId':_0x2f0786['id'],'WhatsappQueueId':_0x10a0de['params']['id']},'transaction':_0x23da65});});})['then'](function(){_0x3a0e18['forEach'](function(_0x13400d){socket[_0x5c80('0x5f')](_0x5c80('0x60'),{'UserId':_0x13400d['id'],'WhatsappQueueId':_0x5946cf['id']});});});});});}})[_0x5c80('0x16')](respondWithStatusCode(_0x1d7a6d,null))[_0x5c80('0x2a')](handleError(_0x1d7a6d,null));};exports['removeTeams']=function(_0x487f5c,_0x435701){return db['Team'][_0x5c80('0x4a')]({'where':{'id':_0x487f5c[_0x5c80('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5c80('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5c80('0x16')](handleEntityNotFound(_0x435701,null))['then'](function(_0x3a110e){var _0x5459d4=_['map'](_0x3a110e,'id');var _0x582102=[];var _0x168968=[];var _0x47a466=squel[_0x5c80('0x61')]();_0x47a466[_0x5c80('0x62')](_0x5c80('0x63'))[_0x5c80('0x64')](_0x5c80('0x65'),'tq')['join'](_0x5c80('0x66'),'ut',_0x5c80('0x67'))[_0x5c80('0x26')](_0x5c80('0x68'),_0x487f5c[_0x5c80('0x2c')]['id']);for(var _0x27d70b=0x0;_0x27d70b<_0x3a110e['length'];_0x27d70b+=0x1){let _0x86d039=_0x3a110e[_0x27d70b];for(var _0x2d6a29=0x0;_0x2d6a29<_0x86d039[_0x5c80('0x56')]['length'];_0x2d6a29+=0x1){let _0x49b2dc=_0x86d039[_0x5c80('0x56')][_0x2d6a29];var _0x5eae60=_0x47a466[_0x5c80('0x69')]();_0x5eae60[_0x5c80('0x26')](_0x5c80('0x6a'),_0x49b2dc['id']);_0x168968['push'](db[_0x5c80('0x5a')][_0x5c80('0x28')](_0x5eae60[_0x5c80('0x6b')](),{'type':db[_0x5c80('0x5a')]['QueryTypes']['SELECT']})['then'](function(_0x23d7a8){if(_0x23d7a8['length']===0x1){return _0x49b2dc['id'];}else{var _0x43ae57=_[_0x5c80('0x6c')](_[_0x5c80('0x48')](_0x23d7a8,_0x5c80('0x6d')),function(_0x43e8a3){return _[_0x5c80('0x6e')](_0x5459d4,_0x43e8a3);});if(_0x43ae57){return _0x49b2dc['id'];}}}));}}return BPromise['all'](_0x168968)[_0x5c80('0x16')](function(_0x4ed8d3){_0x582102=_(_0x582102)[_0x5c80('0x6f')](_0x4ed8d3)['compact']()[_0x5c80('0x70')]();return db[_0x5c80('0x20')][_0x5c80('0x35')]({'where':{'id':_0x487f5c['params']['id']}})[_0x5c80('0x16')](function(_0x402986){return db[_0x5c80('0x5a')][_0x5c80('0x5b')](function(_0x8c75a){return _0x402986[_0x5c80('0x71')](_0x487f5c[_0x5c80('0x28')][_0x5c80('0x55')],{'transaction':_0x8c75a})[_0x5c80('0x16')](function(){if(!_[_0x5c80('0x72')](_0x582102)){return _0x402986[_0x5c80('0x73')](_0x582102,{'transaction':_0x8c75a});}})[_0x5c80('0x16')](function(){_0x582102[_0x5c80('0x74')](function(_0x593fa0){socket[_0x5c80('0x5f')](_0x5c80('0x75'),{'UserId':_0x593fa0,'WhatsappQueueId':_0x402986['id']});});});});});});})['then'](respondWithStatusCode(_0x435701,null))['catch'](handleError(_0x435701,null));};exports['addAgents']=function(_0x26079c,_0x35305f){return db[_0x5c80('0x20')][_0x5c80('0x35')]({'where':{'id':_0x26079c[_0x5c80('0x2c')]['id']}})['then'](handleEntityNotFound(_0x35305f,null))[_0x5c80('0x16')](function(_0xc9f6b9){if(_0xc9f6b9){return _0xc9f6b9[_0x5c80('0x76')](_0x26079c[_0x5c80('0x37')][_0x5c80('0x55')],_[_0x5c80('0x77')](_0x26079c[_0x5c80('0x37')],[_0x5c80('0x55'),'id'])||{})[_0x5c80('0x78')](function(_0x1f58d3){for(var _0x17b70d=0x0;_0x17b70d<_0x26079c[_0x5c80('0x37')][_0x5c80('0x55')][_0x5c80('0x40')];_0x17b70d+=0x1){socket[_0x5c80('0x5f')]('userWhatsappQueue:save',{'UserId':Number(_0x26079c[_0x5c80('0x37')][_0x5c80('0x55')][_0x17b70d]),'WhatsappQueueId':Number(_0x26079c[_0x5c80('0x2c')]['id'])});}return _0x1f58d3;});}})[_0x5c80('0x16')](respondWithResult(_0x35305f,null))[_0x5c80('0x2a')](handleError(_0x35305f,null));};exports[_0x5c80('0x73')]=function(_0x4b89f5,_0x37e279){return db[_0x5c80('0x20')][_0x5c80('0x35')]({'where':{'id':_0x4b89f5[_0x5c80('0x2c')]['id']}})[_0x5c80('0x16')](handleEntityNotFound(_0x37e279,null))[_0x5c80('0x16')](function(_0x185317){if(_0x185317){return _0x185317[_0x5c80('0x73')](_0x4b89f5['query'][_0x5c80('0x55')])[_0x5c80('0x16')](function(){if(_[_0x5c80('0x79')](_0x4b89f5[_0x5c80('0x28')][_0x5c80('0x55')])){for(var _0x5b16fa=0x0;_0x5b16fa<_0x4b89f5[_0x5c80('0x28')]['ids'][_0x5c80('0x40')];_0x5b16fa+=0x1){socket[_0x5c80('0x5f')](_0x5c80('0x75'),{'UserId':Number(_0x4b89f5[_0x5c80('0x28')]['ids'][_0x5b16fa]),'WhatsappQueueId':Number(_0x4b89f5[_0x5c80('0x2c')]['id'])});}}else{socket[_0x5c80('0x5f')](_0x5c80('0x75'),{'UserId':Number(_0x4b89f5[_0x5c80('0x28')][_0x5c80('0x55')]),'WhatsappQueueId':Number(_0x4b89f5['params']['id'])});}});}})[_0x5c80('0x16')](respondWithStatusCode(_0x37e279,null))[_0x5c80('0x2a')](handleError(_0x37e279,null));};exports[_0x5c80('0x7a')]=function(_0x4ff1d4,_0x3a657d){var _0x4c3718={};var _0x4aa979={};var _0x2bfa50;var _0x5ef963;return db['WhatsappQueue'][_0x5c80('0x3f')]({'where':{'id':_0x4ff1d4['params']['id']}})['then'](handleEntityNotFound(_0x3a657d,null))[_0x5c80('0x16')](function(_0x4236da){if(_0x4236da){_0x2bfa50=_0x4236da;_0x4aa979[_0x5c80('0x2d')]=_['keys'](db[_0x5c80('0x4b')]['rawAttributes']);_0x4aa979[_0x5c80('0x28')]=_['keys'](_0x4ff1d4['query']);_0x4aa979[_0x5c80('0x2f')]=_[_0x5c80('0x30')](_0x4aa979['model'],_0x4aa979[_0x5c80('0x28')]);_0x4c3718[_0x5c80('0x31')]=_[_0x5c80('0x30')](_0x4aa979[_0x5c80('0x2d')],qs['fields'](_0x4ff1d4[_0x5c80('0x28')]['fields']));_0x4c3718[_0x5c80('0x31')]=_0x4c3718[_0x5c80('0x31')]['length']?_0x4c3718[_0x5c80('0x31')]:_0x4aa979[_0x5c80('0x2d')];_0x4c3718[_0x5c80('0x43')]=qs[_0x5c80('0x44')](_0x4ff1d4[_0x5c80('0x28')][_0x5c80('0x44')]);_0x4c3718[_0x5c80('0x26')]=qs[_0x5c80('0x2f')](_[_0x5c80('0x53')](_0x4ff1d4[_0x5c80('0x28')],_0x4aa979[_0x5c80('0x2f')]));if(_0x4ff1d4[_0x5c80('0x28')]['filter']){_0x4c3718[_0x5c80('0x26')]=_['merge'](_0x4c3718[_0x5c80('0x26')],{'$or':_[_0x5c80('0x48')](_0x4c3718[_0x5c80('0x31')],function(_0x39648b){var _0x475103={};_0x475103[_0x39648b]={'$like':'%'+_0x4ff1d4[_0x5c80('0x28')][_0x5c80('0x46')]+'%'};return _0x475103;})});}_0x4c3718=_[_0x5c80('0x47')]({},_0x4c3718,_0x4ff1d4[_0x5c80('0x34')]);return _0x2bfa50['getAgents'](_0x4c3718);}})['then'](function(_0x457703){if(_0x457703){_0x5ef963=_0x457703['length'];if(!_0x4ff1d4['query'][_0x5c80('0x41')](_0x5c80('0x42'))){_0x4c3718[_0x5c80('0x10')]=qs[_0x5c80('0x10')](_0x4ff1d4[_0x5c80('0x28')]['limit']);_0x4c3718[_0x5c80('0xe')]=qs[_0x5c80('0xe')](_0x4ff1d4[_0x5c80('0x28')][_0x5c80('0xe')]);}return _0x2bfa50[_0x5c80('0x7a')](_0x4c3718);}})[_0x5c80('0x16')](function(_0x12d23c){if(_0x12d23c){return _0x12d23c?{'count':_0x5ef963,'rows':_0x12d23c}:null;}})[_0x5c80('0x16')](respondWithResult(_0x3a657d,null))[_0x5c80('0x2a')](handleError(_0x3a657d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 2b07895..d4bddf7 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 _0xfcd3=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','save','update'];(function(_0x48c22f,_0x5a5b3b){var _0xf15e7a=function(_0x235672){while(--_0x235672){_0x48c22f['push'](_0x48c22f['shift']());}};_0xf15e7a(++_0x5a5b3b);}(_0xfcd3,0x124));var _0x3fcd=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xfcd3[_0x2df724];return _0x1b2504;};'use strict';var EventEmitter=require(_0x3fcd('0x0'));var WhatsappQueue=require(_0x3fcd('0x1'))['db'][_0x3fcd('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3fcd('0x3'),'afterUpdate':_0x3fcd('0x4'),'afterDestroy':_0x3fcd('0x5')};function emitEvent(_0x3b56ca){return function(_0xd8e426,_0xce9081,_0xeab38f){WhatsappQueueEvents[_0x3fcd('0x6')](_0x3b56ca+':'+_0xd8e426['id'],_0xd8e426);WhatsappQueueEvents['emit'](_0x3b56ca,_0xd8e426);_0xeab38f(null);};}for(var e in events){if(events[_0x3fcd('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x3fcd('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xbae3=['emit','hasOwnProperty','hook','exports','events','WhatsappQueue','save'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xbae3,0x6d));var _0x3bae=function(_0x5d1b27,_0x411d3c){_0x5d1b27=_0x5d1b27-0x0;var _0x14f07=_0xbae3[_0x5d1b27];return _0x14f07;};'use strict';var EventEmitter=require(_0x3bae('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x3bae('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3bae('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3207d9){return function(_0x48e373,_0x4f5f9f,_0x156322){WhatsappQueueEvents[_0x3bae('0x3')](_0x3207d9+':'+_0x48e373['id'],_0x48e373);WhatsappQueueEvents[_0x3bae('0x3')](_0x3207d9,_0x48e373);_0x156322(null);};}for(var e in events){if(events[_0x3bae('0x4')](e)){var event=events[e];WhatsappQueue[_0x3bae('0x5')](e,emitEvent(event));}}module[_0x3bae('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6ba9fc1..05b2a46 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 _0xe2ec=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xe2ec,0x166));var _0xce2e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe2ec[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xce2e('0x0'));var util=require(_0xce2e('0x1'));var logger=require(_0xce2e('0x2'))('api');var moment=require(_0xce2e('0x3'));var BPromise=require(_0xce2e('0x4'));var rp=require(_0xce2e('0x5'));var fs=require('fs');var path=require(_0xce2e('0x6'));var rimraf=require(_0xce2e('0x7'));var config=require(_0xce2e('0x8'));var attributes=require(_0xce2e('0x9'));module[_0xce2e('0xa')]=function(_0x275fab,_0x2fe3c8){return _0x275fab[_0xce2e('0xb')](_0xce2e('0xc'),attributes,{'tableName':_0xce2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45cb=['path','rimraf','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x59d895,_0x3303ee){var _0x20a3a9=function(_0x364f7f){while(--_0x364f7f){_0x59d895['push'](_0x59d895['shift']());}};_0x20a3a9(++_0x3303ee);}(_0x45cb,0x15a));var _0xb45c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x45cb[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xb45c('0x0'));var util=require('util');var logger=require(_0xb45c('0x1'))('api');var moment=require(_0xb45c('0x2'));var BPromise=require(_0xb45c('0x3'));var rp=require(_0xb45c('0x4'));var fs=require('fs');var path=require(_0xb45c('0x5'));var rimraf=require(_0xb45c('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x398137,_0x5393aa){return _0x398137['define'](_0xb45c('0x7'),attributes,{'tableName':_0xb45c('0x8'),'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 b7fe76f..562602a 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 _0xedde=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetWhatsappQueue','findAll','options','attributes','limit','include','map','model','then','ShowWhatsappQueue','where','util','moment','randomstring','../../mysqldb'];(function(_0x516510,_0x48f18a){var _0x5c5246=function(_0x3ea365){while(--_0x3ea365){_0x516510['push'](_0x516510['shift']());}};_0x5c5246(++_0x48f18a);}(_0xedde,0x1f4));var _0xeedd=function(_0x6c05d2,_0x5c0e9f){_0x6c05d2=_0x6c05d2-0x0;var _0x1aefee=_0xedde[_0x6c05d2];return _0x1aefee;};'use strict';var _=require('lodash');var util=require(_0xeedd('0x0'));var moment=require(_0xeedd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeedd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeedd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeedd('0x4'))(_0xeedd('0x5'));var config=require('../../config/environment');var jayson=require(_0xeedd('0x6'));var client=jayson[_0xeedd('0x7')][_0xeedd('0x8')]({'port':0x232a});config[_0xeedd('0x9')]=_[_0xeedd('0xa')](config[_0xeedd('0x9')],{'host':_0xeedd('0xb'),'port':0x18eb});var socket=require(_0xeedd('0xc'))(new Redis(config[_0xeedd('0x9')]));require(_0xeedd('0xd'))[_0xeedd('0xe')](socket);function respondWithRpcPromise(_0x5b4363,_0x1ea318,_0x3cdd08){return new BPromise(function(_0x3ac9b6,_0x14cacb){return client[_0xeedd('0xf')](_0x5b4363,_0x3cdd08)['then'](function(_0x3e49da){logger[_0xeedd('0x10')](_0xeedd('0x11'),_0x1ea318,_0xeedd('0x12'));logger[_0xeedd('0x13')](_0xeedd('0x14'),_0x1ea318,'request\x20sent',JSON[_0xeedd('0x15')](_0x3e49da));if(_0x3e49da['error']){if(_0x3e49da[_0xeedd('0x16')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1ea318,_0x3e49da[_0xeedd('0x16')]['message']);return _0x14cacb(_0x3e49da['error'][_0xeedd('0x17')]);}logger[_0xeedd('0x16')](_0xeedd('0x11'),_0x1ea318,_0x3e49da['error'][_0xeedd('0x17')]);return _0x3ac9b6(_0x3e49da[_0xeedd('0x16')][_0xeedd('0x17')]);}else{logger[_0xeedd('0x10')](_0xeedd('0x11'),_0x1ea318,_0xeedd('0x12'));_0x3ac9b6(_0x3e49da['result'][_0xeedd('0x17')]);}})[_0xeedd('0x18')](function(_0x512cc1){logger[_0xeedd('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x1ea318,_0x512cc1);_0x14cacb(_0x512cc1);});});}exports[_0xeedd('0x19')]=function(_0x19f721){var _0x454a41=this;return new Promise(function(_0x3d8137,_0x4e5db6){return db['WhatsappQueue'][_0xeedd('0x1a')]({'raw':_0x19f721[_0xeedd('0x1b')]?_0x19f721[_0xeedd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x19f721[_0xeedd('0x1b')]?_0x19f721[_0xeedd('0x1b')]['where']||null:null,'attributes':_0x19f721[_0xeedd('0x1b')]?_0x19f721['options'][_0xeedd('0x1c')]||null:null,'limit':_0x19f721[_0xeedd('0x1b')]?_0x19f721['options'][_0xeedd('0x1d')]||null:null,'include':_0x19f721['options']?_0x19f721[_0xeedd('0x1b')][_0xeedd('0x1e')]?_['map'](_0x19f721[_0xeedd('0x1b')]['include'],function(_0x24431c){return{'model':db[_0x24431c['model']],'as':_0x24431c['as'],'attributes':_0x24431c[_0xeedd('0x1c')],'include':_0x24431c[_0xeedd('0x1e')]?_['map'](_0x24431c[_0xeedd('0x1e')],function(_0x449ecf){return{'model':db[_0x449ecf['model']],'as':_0x449ecf['as'],'attributes':_0x449ecf[_0xeedd('0x1c')],'include':_0x449ecf[_0xeedd('0x1e')]?_[_0xeedd('0x1f')](_0x449ecf[_0xeedd('0x1e')],function(_0x59977e){return{'model':db[_0x59977e[_0xeedd('0x20')]],'as':_0x59977e['as'],'attributes':_0x59977e[_0xeedd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeedd('0x21')](function(_0x66d8b8){logger[_0xeedd('0x10')]('GetWhatsappQueue',_0x19f721);logger['debug'](_0xeedd('0x19'),_0x19f721,JSON[_0xeedd('0x15')](_0x66d8b8));_0x3d8137(_0x66d8b8);})['catch'](function(_0xe36dac){logger[_0xeedd('0x16')](_0xeedd('0x19'),_0xe36dac[_0xeedd('0x17')],_0x19f721);_0x4e5db6(_0x454a41['error'](0x1f4,_0xe36dac[_0xeedd('0x17')]));});});};exports[_0xeedd('0x22')]=function(_0x2d8f38){var _0x26c0bb=this;return new Promise(function(_0x251fca,_0x3515be){return db['WhatsappQueue']['find']({'raw':_0x2d8f38['options']?_0x2d8f38[_0xeedd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d8f38[_0xeedd('0x1b')]?_0x2d8f38[_0xeedd('0x1b')][_0xeedd('0x23')]||null:null,'attributes':_0x2d8f38[_0xeedd('0x1b')]?_0x2d8f38['options'][_0xeedd('0x1c')]||null:null,'include':_0x2d8f38[_0xeedd('0x1b')]?_0x2d8f38[_0xeedd('0x1b')][_0xeedd('0x1e')]?_['map'](_0x2d8f38[_0xeedd('0x1b')]['include'],function(_0x1432cc){return{'model':db[_0x1432cc['model']],'as':_0x1432cc['as'],'attributes':_0x1432cc[_0xeedd('0x1c')],'include':_0x1432cc[_0xeedd('0x1e')]?_[_0xeedd('0x1f')](_0x1432cc[_0xeedd('0x1e')],function(_0x2f6d95){return{'model':db[_0x2f6d95['model']],'as':_0x2f6d95['as'],'attributes':_0x2f6d95[_0xeedd('0x1c')],'include':_0x2f6d95[_0xeedd('0x1e')]?_[_0xeedd('0x1f')](_0x2f6d95[_0xeedd('0x1e')],function(_0x32858f){return{'model':db[_0x32858f[_0xeedd('0x20')]],'as':_0x32858f['as'],'attributes':_0x32858f['attributes']};}):[]};}):[]};}):[]:[]})[_0xeedd('0x21')](function(_0x5cb2ca){logger['info']('ShowWhatsappQueue',_0x2d8f38);logger[_0xeedd('0x13')](_0xeedd('0x22'),_0x2d8f38,JSON['stringify'](_0x5cb2ca));_0x251fca(_0x5cb2ca);})[_0xeedd('0x18')](function(_0x464927){logger[_0xeedd('0x16')](_0xeedd('0x22'),_0x464927[_0xeedd('0x17')],_0x2d8f38);_0x3515be(_0x26c0bb['error'](0x1f4,_0x464927[_0xeedd('0x17')]));});});}; \ No newline at end of file +var _0x2de4=['options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll'];(function(_0x4180f2,_0x50d6cd){var _0x297a11=function(_0x600d3c){while(--_0x600d3c){_0x4180f2['push'](_0x4180f2['shift']());}};_0x297a11(++_0x50d6cd);}(_0x2de4,0xd5));var _0x42de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2de4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x42de('0x0'));var util=require(_0x42de('0x1'));var moment=require(_0x42de('0x2'));var BPromise=require(_0x42de('0x3'));var rs=require(_0x42de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42de('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x42de('0x6'))(_0x42de('0x7'));var config=require(_0x42de('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x42de('0x9')]({'port':0x232a});config[_0x42de('0xa')]=_['defaults'](config[_0x42de('0xa')],{'host':_0x42de('0xb'),'port':0x18eb});var socket=require(_0x42de('0xc'))(new Redis(config[_0x42de('0xa')]));require(_0x42de('0xd'))[_0x42de('0xe')](socket);function respondWithRpcPromise(_0x3bd42d,_0x13b97c,_0x34a98c){return new BPromise(function(_0x4cf525,_0x57a69d){return client[_0x42de('0xf')](_0x3bd42d,_0x34a98c)[_0x42de('0x10')](function(_0x488095){logger[_0x42de('0x11')](_0x42de('0x12'),_0x13b97c,_0x42de('0x13'));logger['debug'](_0x42de('0x14'),_0x13b97c,'request\x20sent',JSON['stringify'](_0x488095));if(_0x488095[_0x42de('0x15')]){if(_0x488095[_0x42de('0x15')][_0x42de('0x16')]===0x1f4){logger[_0x42de('0x15')](_0x42de('0x12'),_0x13b97c,_0x488095['error'][_0x42de('0x17')]);return _0x57a69d(_0x488095[_0x42de('0x15')][_0x42de('0x17')]);}logger[_0x42de('0x15')](_0x42de('0x12'),_0x13b97c,_0x488095[_0x42de('0x15')][_0x42de('0x17')]);return _0x4cf525(_0x488095[_0x42de('0x15')][_0x42de('0x17')]);}else{logger[_0x42de('0x11')](_0x42de('0x12'),_0x13b97c,_0x42de('0x13'));_0x4cf525(_0x488095[_0x42de('0x18')]['message']);}})[_0x42de('0x19')](function(_0x388fe9){logger[_0x42de('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x13b97c,_0x388fe9);_0x57a69d(_0x388fe9);});});}exports['GetWhatsappQueue']=function(_0x342b12){var _0x7444b2=this;return new Promise(function(_0x557a95,_0x30a667){return db['WhatsappQueue'][_0x42de('0x1a')]({'raw':_0x342b12[_0x42de('0x1b')]?_0x342b12[_0x42de('0x1b')][_0x42de('0x1c')]===undefined?!![]:![]:!![],'where':_0x342b12['options']?_0x342b12[_0x42de('0x1b')][_0x42de('0x1d')]||null:null,'attributes':_0x342b12['options']?_0x342b12[_0x42de('0x1b')][_0x42de('0x1e')]||null:null,'limit':_0x342b12[_0x42de('0x1b')]?_0x342b12[_0x42de('0x1b')][_0x42de('0x1f')]||null:null,'include':_0x342b12['options']?_0x342b12[_0x42de('0x1b')][_0x42de('0x20')]?_[_0x42de('0x21')](_0x342b12[_0x42de('0x1b')][_0x42de('0x20')],function(_0xc641a){return{'model':db[_0xc641a[_0x42de('0x22')]],'as':_0xc641a['as'],'attributes':_0xc641a['attributes'],'include':_0xc641a['include']?_['map'](_0xc641a[_0x42de('0x20')],function(_0x4041b2){return{'model':db[_0x4041b2[_0x42de('0x22')]],'as':_0x4041b2['as'],'attributes':_0x4041b2[_0x42de('0x1e')],'include':_0x4041b2[_0x42de('0x20')]?_['map'](_0x4041b2[_0x42de('0x20')],function(_0x3418ad){return{'model':db[_0x3418ad[_0x42de('0x22')]],'as':_0x3418ad['as'],'attributes':_0x3418ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x42de('0x10')](function(_0x3bbbd9){logger[_0x42de('0x11')](_0x42de('0x23'),_0x342b12);logger['debug']('GetWhatsappQueue',_0x342b12,JSON['stringify'](_0x3bbbd9));_0x557a95(_0x3bbbd9);})[_0x42de('0x19')](function(_0x296d76){logger[_0x42de('0x15')](_0x42de('0x23'),_0x296d76[_0x42de('0x17')],_0x342b12);_0x30a667(_0x7444b2[_0x42de('0x15')](0x1f4,_0x296d76['message']));});});};exports[_0x42de('0x24')]=function(_0x1f28f3){var _0x3491e9=this;return new Promise(function(_0x123a6b,_0x516fb9){return db[_0x42de('0x25')]['find']({'raw':_0x1f28f3['options']?_0x1f28f3[_0x42de('0x1b')][_0x42de('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f28f3[_0x42de('0x1b')]?_0x1f28f3['options'][_0x42de('0x1d')]||null:null,'attributes':_0x1f28f3[_0x42de('0x1b')]?_0x1f28f3['options']['attributes']||null:null,'include':_0x1f28f3[_0x42de('0x1b')]?_0x1f28f3[_0x42de('0x1b')][_0x42de('0x20')]?_[_0x42de('0x21')](_0x1f28f3['options']['include'],function(_0x334ddd){return{'model':db[_0x334ddd[_0x42de('0x22')]],'as':_0x334ddd['as'],'attributes':_0x334ddd[_0x42de('0x1e')],'include':_0x334ddd[_0x42de('0x20')]?_[_0x42de('0x21')](_0x334ddd['include'],function(_0x3d9592){return{'model':db[_0x3d9592['model']],'as':_0x3d9592['as'],'attributes':_0x3d9592[_0x42de('0x1e')],'include':_0x3d9592[_0x42de('0x20')]?_['map'](_0x3d9592[_0x42de('0x20')],function(_0x179d52){return{'model':db[_0x179d52[_0x42de('0x22')]],'as':_0x179d52['as'],'attributes':_0x179d52[_0x42de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x42de('0x10')](function(_0xa18941){logger[_0x42de('0x11')](_0x42de('0x24'),_0x1f28f3);logger[_0x42de('0x26')]('ShowWhatsappQueue',_0x1f28f3,JSON[_0x42de('0x27')](_0xa18941));_0x123a6b(_0xa18941);})[_0x42de('0x19')](function(_0x2aeb41){logger[_0x42de('0x15')](_0x42de('0x24'),_0x2aeb41[_0x42de('0x17')],_0x1f28f3);_0x516fb9(_0x3491e9['error'](0x1f4,_0x2aeb41[_0x42de('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b42ed0f..5f4e29b 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 _0x9bef=['whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener','length'];(function(_0x13fd57,_0x31c3ef){var _0x37e515=function(_0x213e0c){while(--_0x213e0c){_0x13fd57['push'](_0x13fd57['shift']());}};_0x37e515(++_0x31c3ef);}(_0x9bef,0xa2));var _0xf9be=function(_0x3138f8,_0x569f01){_0x3138f8=_0x3138f8-0x0;var _0x4b6a20=_0x9bef[_0x3138f8];return _0x4b6a20;};'use strict';var WhatsappQueueEvents=require(_0xf9be('0x0'));var events=[_0xf9be('0x1'),_0xf9be('0x2'),'update'];function createListener(_0xf32c7f,_0x402351){return function(_0x5e642e){_0x402351[_0xf9be('0x3')](_0xf32c7f,_0x5e642e);};}function removeListener(_0xdcd047,_0x20832d){return function(){WhatsappQueueEvents[_0xf9be('0x4')](_0xdcd047,_0x20832d);};}exports['register']=function(_0x30f005){for(var _0x3fc0fd=0x0,_0x4e06bd=events[_0xf9be('0x5')];_0x3fc0fd<_0x4e06bd;_0x3fc0fd++){var _0x52f9f6=events[_0x3fc0fd];var _0x254c68=createListener(_0xf9be('0x6')+_0x52f9f6,_0x30f005);WhatsappQueueEvents['on'](_0x52f9f6,_0x254c68);}}; \ No newline at end of file +var _0xcd5c=['register','length','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x3b3769,_0x181289){var _0x3f2d97=function(_0x366fac){while(--_0x366fac){_0x3b3769['push'](_0x3b3769['shift']());}};_0x3f2d97(++_0x181289);}(_0xcd5c,0x162));var _0xccd5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd5c[_0x4a9fb1];return _0x348672;};'use strict';var WhatsappQueueEvents=require(_0xccd5('0x0'));var events=[_0xccd5('0x1'),_0xccd5('0x2'),_0xccd5('0x3')];function createListener(_0x3c40ca,_0x73aa4b){return function(_0x52e215){_0x73aa4b[_0xccd5('0x4')](_0x3c40ca,_0x52e215);};}function removeListener(_0x3d069d,_0x69df48){return function(){WhatsappQueueEvents[_0xccd5('0x5')](_0x3d069d,_0x69df48);};}exports[_0xccd5('0x6')]=function(_0x5d7ede){for(var _0x5d5a25=0x0,_0x1f62a2=events[_0xccd5('0x7')];_0x5d5a25<_0x1f62a2;_0x5d5a25++){var _0x48eda1=events[_0x5d5a25];var _0x100a37=createListener('whatsappQueue:'+_0x48eda1,_0x5d7ede);WhatsappQueueEvents['on'](_0x48eda1,_0x100a37);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8cc27fc..53633ed 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 _0x61f0=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./whatsappQueueReport.controller'];(function(_0x4ddfc9,_0x7aceaf){var _0x23ae50=function(_0x3aa9a1){while(--_0x3aa9a1){_0x4ddfc9['push'](_0x4ddfc9['shift']());}};_0x23ae50(++_0x7aceaf);}(_0x61f0,0x67));var _0x061f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x61f0[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x061f('0x0'));var timeout=require(_0x061f('0x1'));var express=require('express');var router=express[_0x061f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x061f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x061f('0x4'));router[_0x061f('0x5')]('/',auth[_0x061f('0x6')](),controller[_0x061f('0x7')]);router[_0x061f('0x5')](_0x061f('0x8'),auth['isAuthenticated'](),controller[_0x061f('0x9')]);router[_0x061f('0x5')](_0x061f('0xa'),auth[_0x061f('0x6')](),controller['show']);router[_0x061f('0xb')]('/',auth[_0x061f('0x6')](),controller[_0x061f('0xc')]);router[_0x061f('0xd')](_0x061f('0xa'),auth['isAuthenticated'](),controller[_0x061f('0xe')]);router[_0x061f('0xf')]('/:id',auth[_0x061f('0x6')](),controller[_0x061f('0x10')]);module[_0x061f('0x11')]=router; \ No newline at end of file +var _0x1024=['fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','path','express','Router'];(function(_0x46d134,_0x209701){var _0x430d2c=function(_0x13f3c6){while(--_0x13f3c6){_0x46d134['push'](_0x46d134['shift']());}};_0x430d2c(++_0x209701);}(_0x1024,0x140));var _0x4102=function(_0x327fac,_0x4ac9b9){_0x327fac=_0x327fac-0x0;var _0x4e30a8=_0x1024[_0x327fac];return _0x4e30a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4102('0x0'));var timeout=require('connect-timeout');var express=require(_0x4102('0x1'));var router=express[_0x4102('0x2')]();var fs_extra=require(_0x4102('0x3'));var auth=require(_0x4102('0x4'));var interaction=require(_0x4102('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x4102('0x6')]('/',auth['isAuthenticated'](),controller[_0x4102('0x7')]);router[_0x4102('0x6')]('/describe',auth[_0x4102('0x8')](),controller['describe']);router[_0x4102('0x6')](_0x4102('0x9'),auth[_0x4102('0x8')](),controller[_0x4102('0xa')]);router[_0x4102('0xb')]('/',auth[_0x4102('0x8')](),controller[_0x4102('0xc')]);router['put'](_0x4102('0x9'),auth[_0x4102('0x8')](),controller[_0x4102('0xd')]);router[_0x4102('0xe')](_0x4102('0x9'),auth[_0x4102('0x8')](),controller[_0x4102('0xf')]);module[_0x4102('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 192dd9b..cf290db 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(_0x4ea52a,_0x419ea1){var _0x1ac9d0=function(_0x52b11d){while(--_0x52b11d){_0x4ea52a['push'](_0x4ea52a['shift']());}};_0x1ac9d0(++_0x419ea1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x53c977,_0x2d243d){var _0x50bced=function(_0xab5ef9){while(--_0xab5ef9){_0x53c977['push'](_0x53c977['shift']());}};_0x50bced(++_0x2d243d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index effa1dc..213234e 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 _0xb03e=['destroy','error','stack','name','send','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then'];(function(_0x555552,_0x576279){var _0x5b280d=function(_0x2ef8ef){while(--_0x2ef8ef){_0x555552['push'](_0x555552['shift']());}};_0x5b280d(++_0x576279);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1649dd,_0x2b7c73){_0x1649dd=_0x1649dd-0x0;var _0x518df7=_0xb03e[_0x1649dd];return _0x518df7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];function respondWithStatusCode(_0x367d36,_0x384cbe){_0x384cbe=_0x384cbe||0xcc;return function(_0x97f46d){if(_0x97f46d){return _0x367d36[_0xeb03('0x1b')](_0x384cbe);}return _0x367d36[_0xeb03('0x1c')](_0x384cbe)[_0xeb03('0x1d')]();};}function respondWithResult(_0x4d9c8e,_0x212082){_0x212082=_0x212082||0xc8;return function(_0x100bef){if(_0x100bef){return _0x4d9c8e[_0xeb03('0x1c')](_0x212082)[_0xeb03('0x1e')](_0x100bef);}};}function respondWithFilteredResult(_0x52be5b,_0x15f4fe){return function(_0x36f5d8){if(_0x36f5d8){var _0x3f26ef=typeof _0x15f4fe['offset']===_0xeb03('0x1f')&&typeof _0x15f4fe[_0xeb03('0x20')]===_0xeb03('0x1f');var _0x44716c=_0x36f5d8[_0xeb03('0x21')];var _0x1b4cbd=_0x3f26ef?0x0:_0x15f4fe[_0xeb03('0x22')];var _0x8d6725=_0x3f26ef?_0x36f5d8[_0xeb03('0x21')]:_0x15f4fe[_0xeb03('0x22')]+_0x15f4fe[_0xeb03('0x20')];var _0x2c238d;if(_0x8d6725>=_0x44716c){_0x8d6725=_0x44716c;_0x2c238d=0xc8;}else{_0x2c238d=0xce;}_0x52be5b[_0xeb03('0x1c')](_0x2c238d);return _0x52be5b[_0xeb03('0x23')]('Content-Range',_0x1b4cbd+'-'+_0x8d6725+'/'+_0x44716c)[_0xeb03('0x1e')](_0x36f5d8);}return null;};}function patchUpdates(_0x3855dd){return function(_0x413d3e){try{jsonpatch[_0xeb03('0x24')](_0x413d3e,_0x3855dd,!![]);}catch(_0xe5a1c2){return BPromise[_0xeb03('0x25')](_0xe5a1c2);}return _0x413d3e[_0xeb03('0x26')]();};}function saveUpdates(_0x2c795b,_0x3c3d09){return function(_0x5a704b){if(_0x5a704b){return _0x5a704b[_0xeb03('0x27')](_0x2c795b)[_0xeb03('0x28')](function(_0x11ea85){return _0x11ea85;});}return null;};}function removeEntity(_0x300dc0,_0x2f99e6){return function(_0x5dcda3){if(_0x5dcda3){return _0x5dcda3[_0xeb03('0x29')]()[_0xeb03('0x28')](function(){_0x300dc0[_0xeb03('0x1c')](0xcc)[_0xeb03('0x1d')]();});}};}function handleEntityNotFound(_0x3f276a,_0x119697){return function(_0xb04f34){if(!_0xb04f34){_0x3f276a[_0xeb03('0x1b')](0x194);}return _0xb04f34;};}function handleError(_0xbb7ff,_0x4984f6){_0x4984f6=_0x4984f6||0x1f4;return function(_0x832372){logger[_0xeb03('0x2a')](_0x832372[_0xeb03('0x2b')]);if(_0x832372[_0xeb03('0x2c')]){delete _0x832372['name'];}_0xbb7ff['status'](_0x4984f6)[_0xeb03('0x2d')](_0x832372);};}exports['index']=function(_0x31a622,_0x8bd544){var _0x160a37={},_0x5db8bb={},_0xd4c8ec={'count':0x0,'rows':[]};var _0x5de53a=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x421a27){return{'name':_0x421a27[_0xeb03('0x2e')],'type':_0x421a27['type']['key']};});_0x5db8bb['model']=_['map'](_0x5de53a,_0xeb03('0x2c'));_0x5db8bb[_0xeb03('0x2f')]=_[_0xeb03('0x30')](_0x31a622[_0xeb03('0x2f')]);_0x5db8bb[_0xeb03('0x31')]=_['intersection'](_0x5db8bb[_0xeb03('0x32')],_0x5db8bb['query']);_0x160a37[_0xeb03('0x33')]=_[_0xeb03('0x34')](_0x5db8bb[_0xeb03('0x32')],qs[_0xeb03('0x35')](_0x31a622[_0xeb03('0x2f')][_0xeb03('0x35')]));_0x160a37[_0xeb03('0x33')]=_0x160a37[_0xeb03('0x33')]['length']?_0x160a37[_0xeb03('0x33')]:_0x5db8bb['model'];if(!_0x31a622[_0xeb03('0x2f')][_0xeb03('0x36')](_0xeb03('0x37'))){_0x160a37[_0xeb03('0x20')]=qs[_0xeb03('0x20')](_0x31a622[_0xeb03('0x2f')]['limit']);_0x160a37[_0xeb03('0x22')]=qs['offset'](_0x31a622['query']['offset']);}_0x160a37[_0xeb03('0x38')]=qs[_0xeb03('0x39')](_0x31a622[_0xeb03('0x2f')][_0xeb03('0x39')]);_0x160a37[_0xeb03('0x3a')]=qs['filters'](_[_0xeb03('0x3b')](_0x31a622[_0xeb03('0x2f')],_0x5db8bb[_0xeb03('0x31')]),_0x5de53a);if(_0x31a622['query']['filter']){_0x160a37[_0xeb03('0x3a')]=_[_0xeb03('0x3c')](_0x160a37[_0xeb03('0x3a')],{'$or':_['map'](_0x5de53a,function(_0x328f72){if(_0x328f72[_0xeb03('0x3d')]!=='VIRTUAL'){var _0x49edb3={};_0x49edb3[_0x328f72[_0xeb03('0x2c')]]={'$like':'%'+_0x31a622[_0xeb03('0x2f')]['filter']+'%'};return _0x49edb3;}})});}_0x160a37=_[_0xeb03('0x3c')]({},_0x160a37,_0x31a622[_0xeb03('0x3e')]);var _0x3fa3de={'where':_0x160a37[_0xeb03('0x3a')]};return db[_0xeb03('0x3f')][_0xeb03('0x21')](_0x3fa3de)[_0xeb03('0x28')](function(_0x3c1c21){_0xd4c8ec[_0xeb03('0x21')]=_0x3c1c21;if(_0x31a622[_0xeb03('0x2f')][_0xeb03('0x40')]){_0x160a37[_0xeb03('0x41')]=[{'all':!![]}];}return db[_0xeb03('0x3f')][_0xeb03('0x42')](_0x160a37);})[_0xeb03('0x28')](function(_0x6b95dd){_0xd4c8ec[_0xeb03('0x43')]=_0x6b95dd;return _0xd4c8ec;})[_0xeb03('0x28')](respondWithFilteredResult(_0x8bd544,_0x160a37))[_0xeb03('0x44')](handleError(_0x8bd544,null));};exports[_0xeb03('0x45')]=function(_0x43e530,_0x2f83c3){var _0x2879b0={'raw':!![],'where':{'id':_0x43e530['params']['id']}},_0x5bb7d9={};_0x5bb7d9[_0xeb03('0x32')]=_[_0xeb03('0x30')](db[_0xeb03('0x3f')][_0xeb03('0x46')]);_0x5bb7d9[_0xeb03('0x2f')]=_[_0xeb03('0x30')](_0x43e530[_0xeb03('0x2f')]);_0x5bb7d9[_0xeb03('0x31')]=_['intersection'](_0x5bb7d9[_0xeb03('0x32')],_0x5bb7d9[_0xeb03('0x2f')]);_0x2879b0[_0xeb03('0x33')]=_[_0xeb03('0x34')](_0x5bb7d9[_0xeb03('0x32')],qs['fields'](_0x43e530['query'][_0xeb03('0x35')]));_0x2879b0['attributes']=_0x2879b0['attributes']['length']?_0x2879b0[_0xeb03('0x33')]:_0x5bb7d9[_0xeb03('0x32')];if(_0x43e530[_0xeb03('0x2f')][_0xeb03('0x40')]){_0x2879b0[_0xeb03('0x41')]=[{'all':!![]}];}_0x2879b0=_[_0xeb03('0x3c')]({},_0x2879b0,_0x43e530['options']);return db[_0xeb03('0x3f')]['find'](_0x2879b0)['then'](handleEntityNotFound(_0x2f83c3,null))[_0xeb03('0x28')](respondWithResult(_0x2f83c3,null))[_0xeb03('0x44')](handleError(_0x2f83c3,null));};exports[_0xeb03('0x47')]=function(_0x54d7ce,_0x404191){return db[_0xeb03('0x3f')][_0xeb03('0x47')](_0x54d7ce[_0xeb03('0x48')],{})[_0xeb03('0x28')](respondWithResult(_0x404191,0xc9))['catch'](handleError(_0x404191,null));};exports[_0xeb03('0x27')]=function(_0x4dc1f6,_0x13c295){if(_0x4dc1f6[_0xeb03('0x48')]['id']){delete _0x4dc1f6[_0xeb03('0x48')]['id'];}return db[_0xeb03('0x3f')][_0xeb03('0x49')]({'where':{'id':_0x4dc1f6[_0xeb03('0x4a')]['id']}})[_0xeb03('0x28')](handleEntityNotFound(_0x13c295,null))[_0xeb03('0x28')](saveUpdates(_0x4dc1f6[_0xeb03('0x48')],null))[_0xeb03('0x28')](respondWithResult(_0x13c295,null))[_0xeb03('0x44')](handleError(_0x13c295,null));};exports[_0xeb03('0x29')]=function(_0x2f2066,_0x345a98){return db[_0xeb03('0x3f')][_0xeb03('0x49')]({'where':{'id':_0x2f2066[_0xeb03('0x4a')]['id']}})[_0xeb03('0x28')](handleEntityNotFound(_0x345a98,null))[_0xeb03('0x28')](removeEntity(_0x345a98,null))[_0xeb03('0x44')](handleError(_0x345a98,null));};exports[_0xeb03('0x4b')]=function(_0x333fba,_0x1761ab){return db[_0xeb03('0x3f')]['describe']()[_0xeb03('0x28')](respondWithResult(_0x1761ab,null))[_0xeb03('0x44')](handleError(_0x1761ab,null));}; \ No newline at end of file +var _0xd8b0=['model','query','attributes','fields','nolimit','limit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','filters','length','find','create','body','params','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','WhatsappQueueReport','fieldName','type','keys','intersection'];(function(_0x3019ee,_0x57b963){var _0x580be1=function(_0x2d26de){while(--_0x2d26de){_0x3019ee['push'](_0x3019ee['shift']());}};_0x580be1(++_0x57b963);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={},_0x97050a={},_0x48f24f={'count':0x0,'rows':[]};var _0x2ab00d=_['map'](db[_0x0d8b('0x29')]['rawAttributes'],function(_0x3c8887){return{'name':_0x3c8887[_0x0d8b('0x2a')],'type':_0x3c8887[_0x0d8b('0x2b')]['key']};});_0x97050a['model']=_['map'](_0x2ab00d,_0x0d8b('0x27'));_0x97050a['query']=_[_0x0d8b('0x2c')](_0x59aa83['query']);_0x97050a['filters']=_[_0x0d8b('0x2d')](_0x97050a[_0x0d8b('0x2e')],_0x97050a[_0x0d8b('0x2f')]);_0x4b59e5[_0x0d8b('0x30')]=_[_0x0d8b('0x2d')](_0x97050a[_0x0d8b('0x2e')],qs[_0x0d8b('0x31')](_0x59aa83[_0x0d8b('0x2f')]['fields']));_0x4b59e5[_0x0d8b('0x30')]=_0x4b59e5[_0x0d8b('0x30')]['length']?_0x4b59e5[_0x0d8b('0x30')]:_0x97050a[_0x0d8b('0x2e')];if(!_0x59aa83[_0x0d8b('0x2f')]['hasOwnProperty'](_0x0d8b('0x32'))){_0x4b59e5[_0x0d8b('0x33')]=qs[_0x0d8b('0x33')](_0x59aa83[_0x0d8b('0x2f')][_0x0d8b('0x33')]);_0x4b59e5['offset']=qs[_0x0d8b('0x1c')](_0x59aa83[_0x0d8b('0x2f')]['offset']);}_0x4b59e5[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0x59aa83[_0x0d8b('0x2f')][_0x0d8b('0x35')]);_0x4b59e5[_0x0d8b('0x36')]=qs['filters'](_['pick'](_0x59aa83[_0x0d8b('0x2f')],_0x97050a['filters']),_0x2ab00d);if(_0x59aa83['query'][_0x0d8b('0x37')]){_0x4b59e5[_0x0d8b('0x36')]=_[_0x0d8b('0x38')](_0x4b59e5[_0x0d8b('0x36')],{'$or':_[_0x0d8b('0x39')](_0x2ab00d,function(_0x24c789){if(_0x24c789['type']!==_0x0d8b('0x3a')){var _0x6a02ad={};_0x6a02ad[_0x24c789[_0x0d8b('0x27')]]={'$like':'%'+_0x59aa83[_0x0d8b('0x2f')][_0x0d8b('0x37')]+'%'};return _0x6a02ad;}})});}_0x4b59e5=_[_0x0d8b('0x38')]({},_0x4b59e5,_0x59aa83[_0x0d8b('0x3b')]);var _0x5c980b={'where':_0x4b59e5[_0x0d8b('0x36')]};return db[_0x0d8b('0x29')][_0x0d8b('0x1e')](_0x5c980b)[_0x0d8b('0x24')](function(_0x59d3ad){_0x48f24f[_0x0d8b('0x1e')]=_0x59d3ad;if(_0x59aa83['query'][_0x0d8b('0x3c')]){_0x4b59e5[_0x0d8b('0x3d')]=[{'all':!![]}];}return db[_0x0d8b('0x29')][_0x0d8b('0x3e')](_0x4b59e5);})[_0x0d8b('0x24')](function(_0x3e632e){_0x48f24f[_0x0d8b('0x3f')]=_0x3e632e;return _0x48f24f;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x1b2b59,_0x4b59e5))[_0x0d8b('0x40')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x41')]=function(_0x482069,_0x571acf){var _0x576050={'raw':!![],'where':{'id':_0x482069['params']['id']}},_0x4d0811={};_0x4d0811[_0x0d8b('0x2e')]=_[_0x0d8b('0x2c')](db[_0x0d8b('0x29')]['rawAttributes']);_0x4d0811['query']=_[_0x0d8b('0x2c')](_0x482069[_0x0d8b('0x2f')]);_0x4d0811[_0x0d8b('0x42')]=_['intersection'](_0x4d0811[_0x0d8b('0x2e')],_0x4d0811[_0x0d8b('0x2f')]);_0x576050['attributes']=_['intersection'](_0x4d0811[_0x0d8b('0x2e')],qs['fields'](_0x482069[_0x0d8b('0x2f')]['fields']));_0x576050['attributes']=_0x576050[_0x0d8b('0x30')][_0x0d8b('0x43')]?_0x576050['attributes']:_0x4d0811['model'];if(_0x482069['query']['includeAll']){_0x576050[_0x0d8b('0x3d')]=[{'all':!![]}];}_0x576050=_[_0x0d8b('0x38')]({},_0x576050,_0x482069[_0x0d8b('0x3b')]);return db['WhatsappQueueReport'][_0x0d8b('0x44')](_0x576050)[_0x0d8b('0x24')](handleEntityNotFound(_0x571acf,null))[_0x0d8b('0x24')](respondWithResult(_0x571acf,null))[_0x0d8b('0x40')](handleError(_0x571acf,null));};exports[_0x0d8b('0x45')]=function(_0x2d5246,_0x11d22b){return db[_0x0d8b('0x29')][_0x0d8b('0x45')](_0x2d5246[_0x0d8b('0x46')],{})[_0x0d8b('0x24')](respondWithResult(_0x11d22b,0xc9))[_0x0d8b('0x40')](handleError(_0x11d22b,null));};exports[_0x0d8b('0x23')]=function(_0x3e569b,_0x570af8){if(_0x3e569b[_0x0d8b('0x46')]['id']){delete _0x3e569b[_0x0d8b('0x46')]['id'];}return db[_0x0d8b('0x29')][_0x0d8b('0x44')]({'where':{'id':_0x3e569b['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x570af8,null))['then'](saveUpdates(_0x3e569b['body'],null))[_0x0d8b('0x24')](respondWithResult(_0x570af8,null))[_0x0d8b('0x40')](handleError(_0x570af8,null));};exports[_0x0d8b('0x25')]=function(_0x4396b5,_0x505d22){return db[_0x0d8b('0x29')][_0x0d8b('0x44')]({'where':{'id':_0x4396b5[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x505d22,null))[_0x0d8b('0x24')](removeEntity(_0x505d22,null))['catch'](handleError(_0x505d22,null));};exports['describe']=function(_0x4e4d5f,_0x573f4f){return db[_0x0d8b('0x29')][_0x0d8b('0x48')]()['then'](respondWithResult(_0x573f4f,null))['catch'](handleError(_0x573f4f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 85d13ef..8635d53 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 _0xee29=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util'];(function(_0x24e428,_0x43bfae){var _0xfe15d2=function(_0x5c2690){while(--_0x5c2690){_0x24e428['push'](_0x24e428['shift']());}};_0xfe15d2(++_0x43bfae);}(_0xee29,0x1d2));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ee2('0x0'));var util=require(_0x9ee2('0x1'));var logger=require(_0x9ee2('0x2'))(_0x9ee2('0x3'));var moment=require('moment');var BPromise=require(_0x9ee2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ee2('0x5'));var rimraf=require(_0x9ee2('0x6'));var config=require(_0x9ee2('0x7'));var attributes=require(_0x9ee2('0x8'));module[_0x9ee2('0x9')]=function(_0x24ca28,_0x30e4e7){return _0x24ca28[_0x9ee2('0xa')](_0x9ee2('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x9ee2('0xc'),'fields':[_0x9ee2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4cb=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c3d95,_0x38d5e5){var _0x1f6b67=function(_0x427fc6){while(--_0x427fc6){_0x4c3d95['push'](_0x4c3d95['shift']());}};_0x1f6b67(++_0x38d5e5);}(_0xe4cb,0x156));var _0xbe4c=function(_0x6d818b,_0x79f75e){_0x6d818b=_0x6d818b-0x0;var _0x440855=_0xe4cb[_0x6d818b];return _0x440855;};'use strict';var _=require('lodash');var util=require(_0xbe4c('0x0'));var logger=require(_0xbe4c('0x1'))('api');var moment=require(_0xbe4c('0x2'));var BPromise=require(_0xbe4c('0x3'));var rp=require(_0xbe4c('0x4'));var fs=require('fs');var path=require(_0xbe4c('0x5'));var rimraf=require(_0xbe4c('0x6'));var config=require(_0xbe4c('0x7'));var attributes=require(_0xbe4c('0x8'));module[_0xbe4c('0x9')]=function(_0x5d15c3,_0x58066a){return _0x5d15c3[_0xbe4c('0xa')](_0xbe4c('0xb'),attributes,{'tableName':_0xbe4c('0xc'),'paranoid':![],'indexes':[{'name':_0xbe4c('0xd'),'fields':[_0xbe4c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 43c7b8f..c092baa 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 _0x823a=['catch','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw'];(function(_0xb7a71f,_0xdb3ac1){var _0x346f5a=function(_0xa96cd){while(--_0xa96cd){_0xb7a71f['push'](_0xb7a71f['shift']());}};_0x346f5a(++_0xdb3ac1);}(_0x823a,0x14a));var _0xa823=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x823a[_0x879e31];return _0x3467e8;};'use strict';var _=require(_0xa823('0x0'));var util=require(_0xa823('0x1'));var moment=require(_0xa823('0x2'));var BPromise=require(_0xa823('0x3'));var rs=require(_0xa823('0x4'));var fs=require('fs');var Redis=require(_0xa823('0x5'));var db=require(_0xa823('0x6'))['db'];var utils=require(_0xa823('0x7'));var logger=require(_0xa823('0x8'))(_0xa823('0x9'));var config=require(_0xa823('0xa'));var jayson=require(_0xa823('0xb'));var client=jayson[_0xa823('0xc')][_0xa823('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3e6049,_0x5d1591,_0x3724fa){return new BPromise(function(_0x1dc85e,_0x5b0a6f){return client[_0xa823('0xe')](_0x3e6049,_0x3724fa)[_0xa823('0xf')](function(_0x5c486f){logger[_0xa823('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5d1591,_0xa823('0x11'));logger[_0xa823('0x12')](_0xa823('0x13'),_0x5d1591,_0xa823('0x11'),JSON[_0xa823('0x14')](_0x5c486f));if(_0x5c486f[_0xa823('0x15')]){if(_0x5c486f[_0xa823('0x15')]['code']===0x1f4){logger[_0xa823('0x15')](_0xa823('0x16'),_0x5d1591,_0x5c486f[_0xa823('0x15')][_0xa823('0x17')]);return _0x5b0a6f(_0x5c486f['error'][_0xa823('0x17')]);}logger[_0xa823('0x15')](_0xa823('0x16'),_0x5d1591,_0x5c486f[_0xa823('0x15')][_0xa823('0x17')]);return _0x1dc85e(_0x5c486f[_0xa823('0x15')][_0xa823('0x17')]);}else{logger[_0xa823('0x10')](_0xa823('0x16'),_0x5d1591,_0xa823('0x11'));_0x1dc85e(_0x5c486f['result'][_0xa823('0x17')]);}})['catch'](function(_0x20ca5d){logger[_0xa823('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5d1591,_0x20ca5d);_0x5b0a6f(_0x20ca5d);});});}exports[_0xa823('0x18')]=function(_0x2995a4){var _0x191282=this;return new Promise(function(_0x41ce0d,_0x22669b){return db[_0xa823('0x19')][_0xa823('0x1a')](_0x2995a4[_0xa823('0x1b')],{'raw':_0x2995a4['options']?_0x2995a4[_0xa823('0x1c')][_0xa823('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x515bc1){logger[_0xa823('0x10')](_0xa823('0x18'),_0x2995a4);logger[_0xa823('0x12')](_0xa823('0x18'),_0x2995a4,JSON[_0xa823('0x14')](_0x515bc1));_0x41ce0d(_0x515bc1);})[_0xa823('0x1e')](function(_0x35caad){logger['error'](_0xa823('0x18'),_0x35caad[_0xa823('0x17')],_0x2995a4);_0x22669b(_0x191282[_0xa823('0x15')](0x1f4,_0x35caad[_0xa823('0x17')]));});});};exports[_0xa823('0x1f')]=function(_0x5b5c56){var _0x375455=this;return new Promise(function(_0x378d78,_0x152286){return db['WhatsappQueueReport'][_0xa823('0x20')](_0x5b5c56['body'],{'raw':_0x5b5c56['options']?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b5c56[_0xa823('0x1c')]?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x21')]||null:null,'attributes':_0x5b5c56[_0xa823('0x1c')]?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x22')]||null:null,'limit':_0x5b5c56[_0xa823('0x1c')]?_0x5b5c56[_0xa823('0x1c')][_0xa823('0x23')]||null:null})[_0xa823('0xf')](function(_0x96fa6f){logger['info'](_0xa823('0x1f'),_0x5b5c56);logger[_0xa823('0x12')]('UpdateWhatsappQueueReport',_0x5b5c56,JSON[_0xa823('0x14')](_0x96fa6f));_0x378d78(_0x96fa6f);})[_0xa823('0x1e')](function(_0x2edb04){logger[_0xa823('0x15')]('UpdateWhatsappQueueReport',_0x2edb04[_0xa823('0x17')],_0x5b5c56);_0x152286(_0x375455[_0xa823('0x15')](0x1f4,_0x2edb04['message']));});});}; \ No newline at end of file +var _0xd049=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update'];(function(_0x169ca0,_0x48d215){var _0x2ce4df=function(_0x2721ca){while(--_0x2721ca){_0x169ca0['push'](_0x169ca0['shift']());}};_0x2ce4df(++_0x48d215);}(_0xd049,0x87));var _0x9d04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd049[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x9d04('0x0'));var util=require(_0x9d04('0x1'));var moment=require(_0x9d04('0x2'));var BPromise=require(_0x9d04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d04('0x4'));var db=require(_0x9d04('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d04('0x6'))(_0x9d04('0x7'));var config=require('../../config/environment');var jayson=require(_0x9d04('0x8'));var client=jayson[_0x9d04('0x9')][_0x9d04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x595b9d,_0x1247e8,_0x3d93e1){return new BPromise(function(_0x2cd2a7,_0x24c3a6){return client[_0x9d04('0xb')](_0x595b9d,_0x3d93e1)[_0x9d04('0xc')](function(_0x346464){logger[_0x9d04('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1247e8,_0x9d04('0xe'));logger[_0x9d04('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1247e8,_0x9d04('0xe'),JSON[_0x9d04('0x10')](_0x346464));if(_0x346464[_0x9d04('0x11')]){if(_0x346464[_0x9d04('0x11')][_0x9d04('0x12')]===0x1f4){logger[_0x9d04('0x11')](_0x9d04('0x13'),_0x1247e8,_0x346464[_0x9d04('0x11')][_0x9d04('0x14')]);return _0x24c3a6(_0x346464['error'][_0x9d04('0x14')]);}logger[_0x9d04('0x11')](_0x9d04('0x13'),_0x1247e8,_0x346464['error'][_0x9d04('0x14')]);return _0x2cd2a7(_0x346464[_0x9d04('0x11')][_0x9d04('0x14')]);}else{logger[_0x9d04('0xd')](_0x9d04('0x13'),_0x1247e8,'request\x20sent');_0x2cd2a7(_0x346464[_0x9d04('0x15')][_0x9d04('0x14')]);}})[_0x9d04('0x16')](function(_0xa334df){logger[_0x9d04('0x11')](_0x9d04('0x13'),_0x1247e8,_0xa334df);_0x24c3a6(_0xa334df);});});}exports[_0x9d04('0x17')]=function(_0x515d38){var _0x47bb19=this;return new Promise(function(_0x29aecd,_0x4f366f){return db[_0x9d04('0x18')]['create'](_0x515d38[_0x9d04('0x19')],{'raw':_0x515d38[_0x9d04('0x1a')]?_0x515d38[_0x9d04('0x1a')][_0x9d04('0x1b')]===undefined?!![]:![]:!![]})[_0x9d04('0xc')](function(_0x31df64){logger[_0x9d04('0xd')]('CreateWhatsappQueueReport',_0x515d38);logger[_0x9d04('0xf')]('CreateWhatsappQueueReport',_0x515d38,JSON[_0x9d04('0x10')](_0x31df64));_0x29aecd(_0x31df64);})[_0x9d04('0x16')](function(_0x6bd9db){logger[_0x9d04('0x11')]('CreateWhatsappQueueReport',_0x6bd9db[_0x9d04('0x14')],_0x515d38);_0x4f366f(_0x47bb19['error'](0x1f4,_0x6bd9db[_0x9d04('0x14')]));});});};exports[_0x9d04('0x1c')]=function(_0xe9f2ce){var _0x3e3ac7=this;return new Promise(function(_0x3c33dd,_0x29ecf8){return db[_0x9d04('0x18')][_0x9d04('0x1d')](_0xe9f2ce[_0x9d04('0x19')],{'raw':_0xe9f2ce['options']?_0xe9f2ce[_0x9d04('0x1a')][_0x9d04('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9f2ce[_0x9d04('0x1a')]?_0xe9f2ce[_0x9d04('0x1a')][_0x9d04('0x1e')]||null:null,'attributes':_0xe9f2ce[_0x9d04('0x1a')]?_0xe9f2ce[_0x9d04('0x1a')][_0x9d04('0x1f')]||null:null,'limit':_0xe9f2ce[_0x9d04('0x1a')]?_0xe9f2ce[_0x9d04('0x1a')][_0x9d04('0x20')]||null:null})[_0x9d04('0xc')](function(_0x5a7e0a){logger['info'](_0x9d04('0x1c'),_0xe9f2ce);logger['debug'](_0x9d04('0x1c'),_0xe9f2ce,JSON[_0x9d04('0x10')](_0x5a7e0a));_0x3c33dd(_0x5a7e0a);})[_0x9d04('0x16')](function(_0x26af4){logger[_0x9d04('0x11')]('UpdateWhatsappQueueReport',_0x26af4[_0x9d04('0x14')],_0xe9f2ce);_0x29ecf8(_0x3e3ac7[_0x9d04('0x11')](0x1f4,_0x26af4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 15dee2c..0dd022c 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 _0x499c=['connect-timeout','express','Router','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x5e0914,_0x481afe){var _0x5eebff=function(_0x34c6f3){while(--_0x34c6f3){_0x5e0914['push'](_0x5e0914['shift']());}};_0x5eebff(++_0x481afe);}(_0x499c,0xe1));var _0xc499=function(_0x472e85,_0x5a8191){_0x472e85=_0x472e85-0x0;var _0x3109f1=_0x499c[_0x472e85];return _0x3109f1;};'use strict';var multer=require(_0xc499('0x0'));var util=require(_0xc499('0x1'));var path=require(_0xc499('0x2'));var timeout=require(_0xc499('0x3'));var express=require(_0xc499('0x4'));var router=express[_0xc499('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc499('0x6'));var controller=require(_0xc499('0x7'));router[_0xc499('0x8')]('/',auth['isAuthenticated'](),controller[_0xc499('0x9')]);router[_0xc499('0x8')]('/describe',auth[_0xc499('0xa')](),controller[_0xc499('0xb')]);router['get'](_0xc499('0xc'),auth[_0xc499('0xa')](),controller[_0xc499('0xd')]);router[_0xc499('0xe')]('/',auth[_0xc499('0xa')](),controller['create']);router[_0xc499('0xf')](_0xc499('0xc'),auth['isAuthenticated'](),controller[_0xc499('0x10')]);router[_0xc499('0x11')](_0xc499('0xc'),auth[_0xc499('0xa')](),controller['destroy']);module[_0xc499('0x12')]=router; \ No newline at end of file +var _0x012d=['delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','/describe','describe','get','/:id','post','create','put'];(function(_0x571714,_0x30d2b3){var _0x599a14=function(_0x3874fa){while(--_0x3874fa){_0x571714['push'](_0x571714['shift']());}};_0x599a14(++_0x30d2b3);}(_0x012d,0x67));var _0xd012=function(_0x3b3c7b,_0x2fbd79){_0x3b3c7b=_0x3b3c7b-0x0;var _0x2af256=_0x012d[_0x3b3c7b];return _0x2af256;};'use strict';var multer=require(_0xd012('0x0'));var util=require(_0xd012('0x1'));var path=require(_0xd012('0x2'));var timeout=require(_0xd012('0x3'));var express=require('express');var router=express[_0xd012('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd012('0x5'));var config=require(_0xd012('0x6'));var controller=require(_0xd012('0x7'));router['get']('/',auth[_0xd012('0x8')](),controller['index']);router['get'](_0xd012('0x9'),auth[_0xd012('0x8')](),controller[_0xd012('0xa')]);router[_0xd012('0xb')](_0xd012('0xc'),auth[_0xd012('0x8')](),controller['show']);router[_0xd012('0xd')]('/',auth[_0xd012('0x8')](),controller[_0xd012('0xe')]);router[_0xd012('0xf')](_0xd012('0xc'),auth[_0xd012('0x8')](),controller['update']);router[_0xd012('0x10')]('/:id',auth[_0xd012('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 69308f3..5f9832d 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 _0x5d86=['account','queue','DATE','sequelize','exports'];(function(_0x2ec37e,_0x93586a){var _0x3c5980=function(_0x555fb8){while(--_0x555fb8){_0x2ec37e['push'](_0x2ec37e['shift']());}};_0x3c5980(++_0x93586a);}(_0x5d86,0x76));var _0x65d8=function(_0x31659b,_0x3f07a1){_0x31659b=_0x31659b-0x0;var _0x48b140=_0x5d86[_0x31659b];return _0x48b140;};'use strict';var Sequelize=require(_0x65d8('0x0'));module[_0x65d8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x65d8('0x2'),'agent',_0x65d8('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65d8('0x4')]}}; \ No newline at end of file +var _0x1572=['ENUM','account','agent','queue','DATE','sequelize','exports','STRING'];(function(_0xe775be,_0x4822af){var _0x49e73c=function(_0x225efd){while(--_0x225efd){_0xe775be['push'](_0xe775be['shift']());}};_0x49e73c(++_0x4822af);}(_0x1572,0xf5));var _0x2157=function(_0x52fbcf,_0xaabe10){_0x52fbcf=_0x52fbcf-0x0;var _0x2b6792=_0x1572[_0x52fbcf];return _0x2b6792;};'use strict';var Sequelize=require(_0x2157('0x0'));module[_0x2157('0x1')]={'uniqueid':{'type':Sequelize[_0x2157('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2157('0x3')](_0x2157('0x4'),_0x2157('0x5'),_0x2157('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2157('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index cfff6d5..c2859f4 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 _0xcead=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','then','error','stack','send','map','WhatsappTransferReport','fieldName','key','name','query','keys','model','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x87fcc8,_0x21918e){var _0x5cb1dc=function(_0x139fbf){while(--_0x139fbf){_0x87fcc8['push'](_0x87fcc8['shift']());}};_0x5cb1dc(++_0x21918e);}(_0xcead,0x160));var _0xdcea=function(_0x1ae1fb,_0x81c2ec){_0x1ae1fb=_0x1ae1fb-0x0;var _0x57166=_0xcead[_0x1ae1fb];return _0x57166;};'use strict';var emlformat=require(_0xdcea('0x0'));var rimraf=require(_0xdcea('0x1'));var zipdir=require(_0xdcea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdcea('0x3'));var moment=require(_0xdcea('0x4'));var BPromise=require(_0xdcea('0x5'));var Mustache=require(_0xdcea('0x6'));var util=require(_0xdcea('0x7'));var path=require(_0xdcea('0x8'));var sox=require(_0xdcea('0x9'));var csv=require('to-csv');var ejs=require(_0xdcea('0xa'));var fs=require('fs');var fs_extra=require(_0xdcea('0xb'));var _=require(_0xdcea('0xc'));var squel=require(_0xdcea('0xd'));var crypto=require(_0xdcea('0xe'));var jsforce=require(_0xdcea('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdcea('0x10'));var querystring=require('querystring');var Papa=require(_0xdcea('0x11'));var Redis=require(_0xdcea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdcea('0x13'));var as=require(_0xdcea('0x14'));var hardwareService=require(_0xdcea('0x15'));var logger=require(_0xdcea('0x16'))(_0xdcea('0x17'));var utils=require('../../config/utils');var config=require(_0xdcea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcea('0x19'))['db'];function respondWithStatusCode(_0x2f78b0,_0x3477d0){_0x3477d0=_0x3477d0||0xcc;return function(_0x25ba76){if(_0x25ba76){return _0x2f78b0[_0xdcea('0x1a')](_0x3477d0);}return _0x2f78b0[_0xdcea('0x1b')](_0x3477d0)[_0xdcea('0x1c')]();};}function respondWithResult(_0x2f6e49,_0x8a7d47){_0x8a7d47=_0x8a7d47||0xc8;return function(_0xd28624){if(_0xd28624){return _0x2f6e49['status'](_0x8a7d47)[_0xdcea('0x1d')](_0xd28624);}};}function respondWithFilteredResult(_0xb1ef94,_0x2eb527){return function(_0x20f873){if(_0x20f873){var _0x139dfb=typeof _0x2eb527[_0xdcea('0x1e')]===_0xdcea('0x1f')&&typeof _0x2eb527[_0xdcea('0x20')]===_0xdcea('0x1f');var _0x304fab=_0x20f873[_0xdcea('0x21')];var _0x31fc30=_0x139dfb?0x0:_0x2eb527['offset'];var _0x2df73b=_0x139dfb?_0x20f873['count']:_0x2eb527['offset']+_0x2eb527[_0xdcea('0x20')];var _0x304961;if(_0x2df73b>=_0x304fab){_0x2df73b=_0x304fab;_0x304961=0xc8;}else{_0x304961=0xce;}_0xb1ef94[_0xdcea('0x1b')](_0x304961);return _0xb1ef94['set']('Content-Range',_0x31fc30+'-'+_0x2df73b+'/'+_0x304fab)[_0xdcea('0x1d')](_0x20f873);}return null;};}function patchUpdates(_0x39bfa4){return function(_0x37da12){try{jsonpatch['apply'](_0x37da12,_0x39bfa4,!![]);}catch(_0x316d73){return BPromise[_0xdcea('0x22')](_0x316d73);}return _0x37da12[_0xdcea('0x23')]();};}function saveUpdates(_0x2162e0,_0x1ba27b){return function(_0x27fb95){if(_0x27fb95){return _0x27fb95['update'](_0x2162e0)[_0xdcea('0x24')](function(_0x34eaf6){return _0x34eaf6;});}return null;};}function removeEntity(_0x57c6ae,_0x367583){return function(_0x38a5a6){if(_0x38a5a6){return _0x38a5a6['destroy']()['then'](function(){_0x57c6ae[_0xdcea('0x1b')](0xcc)[_0xdcea('0x1c')]();});}};}function handleEntityNotFound(_0x2b715c,_0x29a432){return function(_0x1ef9ef){if(!_0x1ef9ef){_0x2b715c[_0xdcea('0x1a')](0x194);}return _0x1ef9ef;};}function handleError(_0x1a5377,_0x15a270){_0x15a270=_0x15a270||0x1f4;return function(_0x18da7d){logger[_0xdcea('0x25')](_0x18da7d[_0xdcea('0x26')]);if(_0x18da7d['name']){delete _0x18da7d['name'];}_0x1a5377[_0xdcea('0x1b')](_0x15a270)[_0xdcea('0x27')](_0x18da7d);};}exports['index']=function(_0x5e519d,_0x44e563){var _0x10bed2={},_0x5cf427={},_0x3bbb0f={'count':0x0,'rows':[]};var _0x1fb961=_[_0xdcea('0x28')](db[_0xdcea('0x29')]['rawAttributes'],function(_0x266bc3){return{'name':_0x266bc3[_0xdcea('0x2a')],'type':_0x266bc3['type'][_0xdcea('0x2b')]};});_0x5cf427['model']=_['map'](_0x1fb961,_0xdcea('0x2c'));_0x5cf427[_0xdcea('0x2d')]=_[_0xdcea('0x2e')](_0x5e519d['query']);_0x5cf427['filters']=_['intersection'](_0x5cf427[_0xdcea('0x2f')],_0x5cf427[_0xdcea('0x2d')]);_0x10bed2['attributes']=_[_0xdcea('0x30')](_0x5cf427[_0xdcea('0x2f')],qs[_0xdcea('0x31')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x31')]));_0x10bed2['attributes']=_0x10bed2[_0xdcea('0x32')][_0xdcea('0x33')]?_0x10bed2[_0xdcea('0x32')]:_0x5cf427[_0xdcea('0x2f')];if(!_0x5e519d[_0xdcea('0x2d')]['hasOwnProperty'](_0xdcea('0x34'))){_0x10bed2[_0xdcea('0x20')]=qs[_0xdcea('0x20')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x20')]);_0x10bed2['offset']=qs[_0xdcea('0x1e')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x1e')]);}_0x10bed2[_0xdcea('0x35')]=qs[_0xdcea('0x36')](_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x36')]);_0x10bed2[_0xdcea('0x37')]=qs[_0xdcea('0x38')](_[_0xdcea('0x39')](_0x5e519d[_0xdcea('0x2d')],_0x5cf427[_0xdcea('0x38')]),_0x1fb961);if(_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x3a')]){_0x10bed2[_0xdcea('0x37')]=_[_0xdcea('0x3b')](_0x10bed2['where'],{'$or':_[_0xdcea('0x28')](_0x1fb961,function(_0x1a3a7f){if(_0x1a3a7f[_0xdcea('0x3c')]!==_0xdcea('0x3d')){var _0x33f5c3={};_0x33f5c3[_0x1a3a7f[_0xdcea('0x2c')]]={'$like':'%'+_0x5e519d[_0xdcea('0x2d')]['filter']+'%'};return _0x33f5c3;}})});}_0x10bed2=_[_0xdcea('0x3b')]({},_0x10bed2,_0x5e519d['options']);var _0x103028={'where':_0x10bed2[_0xdcea('0x37')]};return db['WhatsappTransferReport'][_0xdcea('0x21')](_0x103028)[_0xdcea('0x24')](function(_0x38fa8e){_0x3bbb0f[_0xdcea('0x21')]=_0x38fa8e;if(_0x5e519d[_0xdcea('0x2d')][_0xdcea('0x3e')]){_0x10bed2[_0xdcea('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xdcea('0x40')](_0x10bed2);})[_0xdcea('0x24')](function(_0x4904ab){_0x3bbb0f[_0xdcea('0x41')]=_0x4904ab;return _0x3bbb0f;})[_0xdcea('0x24')](respondWithFilteredResult(_0x44e563,_0x10bed2))[_0xdcea('0x42')](handleError(_0x44e563,null));};exports[_0xdcea('0x43')]=function(_0x518f42,_0x3840f0){var _0x1113de={'raw':!![],'where':{'id':_0x518f42['params']['id']}},_0x5e4849={};_0x5e4849['model']=_[_0xdcea('0x2e')](db[_0xdcea('0x29')][_0xdcea('0x44')]);_0x5e4849[_0xdcea('0x2d')]=_[_0xdcea('0x2e')](_0x518f42[_0xdcea('0x2d')]);_0x5e4849[_0xdcea('0x38')]=_['intersection'](_0x5e4849[_0xdcea('0x2f')],_0x5e4849[_0xdcea('0x2d')]);_0x1113de[_0xdcea('0x32')]=_[_0xdcea('0x30')](_0x5e4849['model'],qs[_0xdcea('0x31')](_0x518f42[_0xdcea('0x2d')]['fields']));_0x1113de['attributes']=_0x1113de[_0xdcea('0x32')][_0xdcea('0x33')]?_0x1113de[_0xdcea('0x32')]:_0x5e4849['model'];if(_0x518f42[_0xdcea('0x2d')][_0xdcea('0x3e')]){_0x1113de[_0xdcea('0x3f')]=[{'all':!![]}];}_0x1113de=_[_0xdcea('0x3b')]({},_0x1113de,_0x518f42[_0xdcea('0x45')]);return db['WhatsappTransferReport'][_0xdcea('0x46')](_0x1113de)['then'](handleEntityNotFound(_0x3840f0,null))[_0xdcea('0x24')](respondWithResult(_0x3840f0,null))[_0xdcea('0x42')](handleError(_0x3840f0,null));};exports[_0xdcea('0x47')]=function(_0x55fe2b,_0x356740){return db[_0xdcea('0x29')][_0xdcea('0x47')](_0x55fe2b[_0xdcea('0x48')],{})[_0xdcea('0x24')](respondWithResult(_0x356740,0xc9))[_0xdcea('0x42')](handleError(_0x356740,null));};exports['update']=function(_0x471e76,_0x4ace3f){if(_0x471e76[_0xdcea('0x48')]['id']){delete _0x471e76[_0xdcea('0x48')]['id'];}return db[_0xdcea('0x29')][_0xdcea('0x46')]({'where':{'id':_0x471e76[_0xdcea('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ace3f,null))[_0xdcea('0x24')](saveUpdates(_0x471e76[_0xdcea('0x48')],null))[_0xdcea('0x24')](respondWithResult(_0x4ace3f,null))[_0xdcea('0x42')](handleError(_0x4ace3f,null));};exports['destroy']=function(_0x35c8bd,_0xe40d25){return db[_0xdcea('0x29')][_0xdcea('0x46')]({'where':{'id':_0x35c8bd['params']['id']}})['then'](handleEntityNotFound(_0xe40d25,null))[_0xdcea('0x24')](removeEntity(_0xe40d25,null))[_0xdcea('0x42')](handleError(_0xe40d25,null));};exports[_0xdcea('0x4a')]=function(_0x2c3d21,_0x3eb49f){return db[_0xdcea('0x29')][_0xdcea('0x4a')]()['then'](respondWithResult(_0x3eb49f,null))[_0xdcea('0x42')](handleError(_0x3eb49f,null));}; \ No newline at end of file +var _0x1aaf=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','update','then','destroy','error','stack','name','map','WhatsappTransferReport','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','show','filters','includeAll','options','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x1aaf,0x103));var _0xf1aa=function(_0x49f2d6,_0x73d497){_0x49f2d6=_0x49f2d6-0x0;var _0x462bd7=_0x1aaf[_0x49f2d6];return _0x462bd7;};'use strict';var emlformat=require(_0xf1aa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1aa('0x1'));var rp=require(_0xf1aa('0x2'));var moment=require(_0xf1aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf1aa('0x4'));var util=require(_0xf1aa('0x5'));var path=require(_0xf1aa('0x6'));var sox=require(_0xf1aa('0x7'));var csv=require(_0xf1aa('0x8'));var ejs=require(_0xf1aa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1aa('0xa'));var squel=require('squel');var crypto=require(_0xf1aa('0xb'));var jsforce=require(_0xf1aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf1aa('0x8'));var querystring=require(_0xf1aa('0xd'));var Papa=require(_0xf1aa('0xe'));var Redis=require(_0xf1aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1aa('0x10'));var logger=require(_0xf1aa('0x11'))(_0xf1aa('0x12'));var utils=require(_0xf1aa('0x13'));var config=require(_0xf1aa('0x14'));var licenseUtil=require(_0xf1aa('0x15'));var db=require(_0xf1aa('0x16'))['db'];function respondWithStatusCode(_0x4b7314,_0x304a18){_0x304a18=_0x304a18||0xcc;return function(_0x1be487){if(_0x1be487){return _0x4b7314[_0xf1aa('0x17')](_0x304a18);}return _0x4b7314[_0xf1aa('0x18')](_0x304a18)[_0xf1aa('0x19')]();};}function respondWithResult(_0x5dc824,_0x31e823){_0x31e823=_0x31e823||0xc8;return function(_0x5b5a95){if(_0x5b5a95){return _0x5dc824[_0xf1aa('0x18')](_0x31e823)[_0xf1aa('0x1a')](_0x5b5a95);}};}function respondWithFilteredResult(_0x10eeb7,_0x2593d1){return function(_0xae88df){if(_0xae88df){var _0xd335de=typeof _0x2593d1[_0xf1aa('0x1b')]==='undefined'&&typeof _0x2593d1['limit']===_0xf1aa('0x1c');var _0x4985d8=_0xae88df[_0xf1aa('0x1d')];var _0x3c41b4=_0xd335de?0x0:_0x2593d1['offset'];var _0x3d6aaf=_0xd335de?_0xae88df[_0xf1aa('0x1d')]:_0x2593d1[_0xf1aa('0x1b')]+_0x2593d1[_0xf1aa('0x1e')];var _0x3d73c1;if(_0x3d6aaf>=_0x4985d8){_0x3d6aaf=_0x4985d8;_0x3d73c1=0xc8;}else{_0x3d73c1=0xce;}_0x10eeb7[_0xf1aa('0x18')](_0x3d73c1);return _0x10eeb7['set']('Content-Range',_0x3c41b4+'-'+_0x3d6aaf+'/'+_0x4985d8)['json'](_0xae88df);}return null;};}function patchUpdates(_0x3da4de){return function(_0x12511d){try{jsonpatch[_0xf1aa('0x1f')](_0x12511d,_0x3da4de,!![]);}catch(_0x436f77){return BPromise['reject'](_0x436f77);}return _0x12511d[_0xf1aa('0x20')]();};}function saveUpdates(_0x4ea82c,_0x26fa48){return function(_0x3546eb){if(_0x3546eb){return _0x3546eb[_0xf1aa('0x21')](_0x4ea82c)[_0xf1aa('0x22')](function(_0x181650){return _0x181650;});}return null;};}function removeEntity(_0x4742de,_0x4ff29d){return function(_0x46a2df){if(_0x46a2df){return _0x46a2df[_0xf1aa('0x23')]()['then'](function(){_0x4742de[_0xf1aa('0x18')](0xcc)[_0xf1aa('0x19')]();});}};}function handleEntityNotFound(_0x45b0a0,_0x28e4ff){return function(_0x46038f){if(!_0x46038f){_0x45b0a0[_0xf1aa('0x17')](0x194);}return _0x46038f;};}function handleError(_0x1fc124,_0x307f84){_0x307f84=_0x307f84||0x1f4;return function(_0x183025){logger[_0xf1aa('0x24')](_0x183025[_0xf1aa('0x25')]);if(_0x183025[_0xf1aa('0x26')]){delete _0x183025[_0xf1aa('0x26')];}_0x1fc124['status'](_0x307f84)['send'](_0x183025);};}exports['index']=function(_0xd88471,_0xe09fce){var _0x452851={},_0x172740={},_0x133e8c={'count':0x0,'rows':[]};var _0x53198a=_[_0xf1aa('0x27')](db[_0xf1aa('0x28')][_0xf1aa('0x29')],function(_0x274041){return{'name':_0x274041['fieldName'],'type':_0x274041['type']['key']};});_0x172740[_0xf1aa('0x2a')]=_[_0xf1aa('0x27')](_0x53198a,_0xf1aa('0x26'));_0x172740['query']=_[_0xf1aa('0x2b')](_0xd88471[_0xf1aa('0x2c')]);_0x172740['filters']=_['intersection'](_0x172740[_0xf1aa('0x2a')],_0x172740['query']);_0x452851[_0xf1aa('0x2d')]=_[_0xf1aa('0x2e')](_0x172740[_0xf1aa('0x2a')],qs[_0xf1aa('0x2f')](_0xd88471['query'][_0xf1aa('0x2f')]));_0x452851[_0xf1aa('0x2d')]=_0x452851['attributes'][_0xf1aa('0x30')]?_0x452851[_0xf1aa('0x2d')]:_0x172740[_0xf1aa('0x2a')];if(!_0xd88471['query'][_0xf1aa('0x31')](_0xf1aa('0x32'))){_0x452851['limit']=qs[_0xf1aa('0x1e')](_0xd88471[_0xf1aa('0x2c')][_0xf1aa('0x1e')]);_0x452851[_0xf1aa('0x1b')]=qs[_0xf1aa('0x1b')](_0xd88471[_0xf1aa('0x2c')][_0xf1aa('0x1b')]);}_0x452851[_0xf1aa('0x33')]=qs['sort'](_0xd88471[_0xf1aa('0x2c')][_0xf1aa('0x34')]);_0x452851[_0xf1aa('0x35')]=qs['filters'](_[_0xf1aa('0x36')](_0xd88471['query'],_0x172740['filters']),_0x53198a);if(_0xd88471[_0xf1aa('0x2c')][_0xf1aa('0x37')]){_0x452851[_0xf1aa('0x35')]=_[_0xf1aa('0x38')](_0x452851['where'],{'$or':_[_0xf1aa('0x27')](_0x53198a,function(_0x56f888){if(_0x56f888[_0xf1aa('0x39')]!==_0xf1aa('0x3a')){var _0x579033={};_0x579033[_0x56f888[_0xf1aa('0x26')]]={'$like':'%'+_0xd88471[_0xf1aa('0x2c')][_0xf1aa('0x37')]+'%'};return _0x579033;}})});}_0x452851=_[_0xf1aa('0x38')]({},_0x452851,_0xd88471['options']);var _0x50140e={'where':_0x452851['where']};return db['WhatsappTransferReport'][_0xf1aa('0x1d')](_0x50140e)[_0xf1aa('0x22')](function(_0x8ec094){_0x133e8c['count']=_0x8ec094;if(_0xd88471[_0xf1aa('0x2c')]['includeAll']){_0x452851[_0xf1aa('0x3b')]=[{'all':!![]}];}return db[_0xf1aa('0x28')][_0xf1aa('0x3c')](_0x452851);})['then'](function(_0x20c258){_0x133e8c['rows']=_0x20c258;return _0x133e8c;})[_0xf1aa('0x22')](respondWithFilteredResult(_0xe09fce,_0x452851))['catch'](handleError(_0xe09fce,null));};exports[_0xf1aa('0x3d')]=function(_0x50be25,_0xf7d3d0){var _0xb508e7={'raw':!![],'where':{'id':_0x50be25['params']['id']}},_0x849a1d={};_0x849a1d[_0xf1aa('0x2a')]=_[_0xf1aa('0x2b')](db[_0xf1aa('0x28')]['rawAttributes']);_0x849a1d[_0xf1aa('0x2c')]=_[_0xf1aa('0x2b')](_0x50be25['query']);_0x849a1d[_0xf1aa('0x3e')]=_[_0xf1aa('0x2e')](_0x849a1d['model'],_0x849a1d['query']);_0xb508e7['attributes']=_[_0xf1aa('0x2e')](_0x849a1d[_0xf1aa('0x2a')],qs[_0xf1aa('0x2f')](_0x50be25[_0xf1aa('0x2c')][_0xf1aa('0x2f')]));_0xb508e7[_0xf1aa('0x2d')]=_0xb508e7[_0xf1aa('0x2d')]['length']?_0xb508e7['attributes']:_0x849a1d[_0xf1aa('0x2a')];if(_0x50be25[_0xf1aa('0x2c')][_0xf1aa('0x3f')]){_0xb508e7['include']=[{'all':!![]}];}_0xb508e7=_[_0xf1aa('0x38')]({},_0xb508e7,_0x50be25[_0xf1aa('0x40')]);return db[_0xf1aa('0x28')][_0xf1aa('0x41')](_0xb508e7)[_0xf1aa('0x22')](handleEntityNotFound(_0xf7d3d0,null))[_0xf1aa('0x22')](respondWithResult(_0xf7d3d0,null))[_0xf1aa('0x42')](handleError(_0xf7d3d0,null));};exports['create']=function(_0x4e1f38,_0x4e7f6b){return db[_0xf1aa('0x28')][_0xf1aa('0x43')](_0x4e1f38[_0xf1aa('0x44')],{})[_0xf1aa('0x22')](respondWithResult(_0x4e7f6b,0xc9))['catch'](handleError(_0x4e7f6b,null));};exports[_0xf1aa('0x21')]=function(_0x128d8c,_0x7b44ab){if(_0x128d8c[_0xf1aa('0x44')]['id']){delete _0x128d8c['body']['id'];}return db[_0xf1aa('0x28')][_0xf1aa('0x41')]({'where':{'id':_0x128d8c['params']['id']}})['then'](handleEntityNotFound(_0x7b44ab,null))[_0xf1aa('0x22')](saveUpdates(_0x128d8c['body'],null))['then'](respondWithResult(_0x7b44ab,null))['catch'](handleError(_0x7b44ab,null));};exports[_0xf1aa('0x23')]=function(_0x144857,_0x3960b4){return db[_0xf1aa('0x28')][_0xf1aa('0x41')]({'where':{'id':_0x144857['params']['id']}})['then'](handleEntityNotFound(_0x3960b4,null))['then'](removeEntity(_0x3960b4,null))[_0xf1aa('0x42')](handleError(_0x3960b4,null));};exports[_0xf1aa('0x45')]=function(_0x367c56,_0x1cc5c5){return db[_0xf1aa('0x28')][_0xf1aa('0x45')]()[_0xf1aa('0x22')](respondWithResult(_0x1cc5c5,null))[_0xf1aa('0x42')](handleError(_0x1cc5c5,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 78542a7..4737d82 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 _0x4fce=['report_whatsapp_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fce,0x80));var _0xe4fc=function(_0x4bc921,_0x11a57f){_0x4bc921=_0x4bc921-0x0;var _0x2250ef=_0x4fce[_0x4bc921];return _0x2250ef;};'use strict';var _=require(_0xe4fc('0x0'));var util=require(_0xe4fc('0x1'));var logger=require('../../config/logger')(_0xe4fc('0x2'));var moment=require(_0xe4fc('0x3'));var BPromise=require(_0xe4fc('0x4'));var rp=require(_0xe4fc('0x5'));var fs=require('fs');var path=require(_0xe4fc('0x6'));var rimraf=require(_0xe4fc('0x7'));var config=require(_0xe4fc('0x8'));var attributes=require(_0xe4fc('0x9'));module[_0xe4fc('0xa')]=function(_0x156e9e,_0x478108){return _0x156e9e[_0xe4fc('0xb')]('WhatsappTransferReport',attributes,{'tableName':_0xe4fc('0xc'),'paranoid':![],'indexes':[{'name':_0xe4fc('0xd'),'fields':[_0xe4fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb65=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','../../config/environment','exports'];(function(_0x11c3d7,_0x4d9e67){var _0x4d37b0=function(_0x4d373e){while(--_0x4d373e){_0x11c3d7['push'](_0x11c3d7['shift']());}};_0x4d37b0(++_0x4d9e67);}(_0xcb65,0x164));var _0x5cb6=function(_0xc7ed29,_0x515330){_0xc7ed29=_0xc7ed29-0x0;var _0xf8da19=_0xcb65[_0xc7ed29];return _0xf8da19;};'use strict';var _=require('lodash');var util=require(_0x5cb6('0x0'));var logger=require(_0x5cb6('0x1'))(_0x5cb6('0x2'));var moment=require(_0x5cb6('0x3'));var BPromise=require('bluebird');var rp=require(_0x5cb6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5cb6('0x5'));var attributes=require('./whatsappTransferReport.attributes');module[_0x5cb6('0x6')]=function(_0x3d3c2f,_0x288245){return _0x3d3c2f[_0x5cb6('0x7')](_0x5cb6('0x8'),attributes,{'tableName':_0x5cb6('0x9'),'paranoid':![],'indexes':[{'name':_0x5cb6('0xa'),'fields':[_0x5cb6('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 32b4962..cc78272 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 _0x194f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x17f09f,_0xbada9d){var _0x2c456c=function(_0x281ea5){while(--_0x281ea5){_0x17f09f['push'](_0x17f09f['shift']());}};_0x2c456c(++_0xbada9d);}(_0x194f,0x75));var _0xf194=function(_0x2fdb61,_0x3f8308){_0x2fdb61=_0x2fdb61-0x0;var _0x1f1922=_0x194f[_0x2fdb61];return _0x1f1922;};'use strict';var _=require(_0xf194('0x0'));var util=require(_0xf194('0x1'));var moment=require(_0xf194('0x2'));var BPromise=require(_0xf194('0x3'));var rs=require(_0xf194('0x4'));var fs=require('fs');var Redis=require(_0xf194('0x5'));var db=require(_0xf194('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf194('0x7'))(_0xf194('0x8'));var config=require(_0xf194('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c25b6,_0x1635c8,_0x43d002){return new BPromise(function(_0x390c55,_0x19880c){return client['request'](_0x4c25b6,_0x43d002)[_0xf194('0xa')](function(_0x22bcac){logger[_0xf194('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1635c8,_0xf194('0xc'));logger['debug'](_0xf194('0xd'),_0x1635c8,_0xf194('0xc'),JSON[_0xf194('0xe')](_0x22bcac));if(_0x22bcac['error']){if(_0x22bcac[_0xf194('0xf')]['code']===0x1f4){logger[_0xf194('0xf')](_0xf194('0x10'),_0x1635c8,_0x22bcac[_0xf194('0xf')][_0xf194('0x11')]);return _0x19880c(_0x22bcac['error'][_0xf194('0x11')]);}logger['error'](_0xf194('0x10'),_0x1635c8,_0x22bcac[_0xf194('0xf')][_0xf194('0x11')]);return _0x390c55(_0x22bcac[_0xf194('0xf')][_0xf194('0x11')]);}else{logger[_0xf194('0xb')](_0xf194('0x10'),_0x1635c8,_0xf194('0xc'));_0x390c55(_0x22bcac[_0xf194('0x12')][_0xf194('0x11')]);}})[_0xf194('0x13')](function(_0x5390ca){logger[_0xf194('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1635c8,_0x5390ca);_0x19880c(_0x5390ca);});});} \ No newline at end of file +var _0xba35=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x65cb08,_0x134290){var _0x2c0d3e=function(_0x21b76c){while(--_0x21b76c){_0x65cb08['push'](_0x65cb08['shift']());}};_0x2c0d3e(++_0x134290);}(_0xba35,0x191));var _0x5ba3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xba35[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x5ba3('0x0'));var moment=require(_0x5ba3('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ba3('0x2'));var fs=require('fs');var Redis=require(_0x5ba3('0x3'));var db=require(_0x5ba3('0x4'))['db'];var utils=require(_0x5ba3('0x5'));var logger=require(_0x5ba3('0x6'))(_0x5ba3('0x7'));var config=require(_0x5ba3('0x8'));var jayson=require(_0x5ba3('0x9'));var client=jayson[_0x5ba3('0xa')][_0x5ba3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14d86f,_0x134a8a,_0x53f594){return new BPromise(function(_0xe23a1c,_0x398aef){return client['request'](_0x14d86f,_0x53f594)[_0x5ba3('0xc')](function(_0x23d5a3){logger[_0x5ba3('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x134a8a,_0x5ba3('0xe'));logger[_0x5ba3('0xf')](_0x5ba3('0x10'),_0x134a8a,_0x5ba3('0xe'),JSON['stringify'](_0x23d5a3));if(_0x23d5a3[_0x5ba3('0x11')]){if(_0x23d5a3['error'][_0x5ba3('0x12')]===0x1f4){logger[_0x5ba3('0x11')](_0x5ba3('0x13'),_0x134a8a,_0x23d5a3[_0x5ba3('0x11')]['message']);return _0x398aef(_0x23d5a3[_0x5ba3('0x11')][_0x5ba3('0x14')]);}logger[_0x5ba3('0x11')](_0x5ba3('0x13'),_0x134a8a,_0x23d5a3[_0x5ba3('0x11')]['message']);return _0xe23a1c(_0x23d5a3[_0x5ba3('0x11')][_0x5ba3('0x14')]);}else{logger[_0x5ba3('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x134a8a,_0x5ba3('0xe'));_0xe23a1c(_0x23d5a3[_0x5ba3('0x15')][_0x5ba3('0x14')]);}})['catch'](function(_0x3086ee){logger[_0x5ba3('0x11')](_0x5ba3('0x13'),_0x134a8a,_0x3086ee);_0x398aef(_0x3086ee);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 0132cf6..4ca2336 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3148=['sync','seedDB','default','then','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider'];(function(_0x289b08,_0x562de1){var _0x1d3ed5=function(_0x5b2e51){while(--_0x5b2e51){_0x289b08['push'](_0x289b08['shift']());}};_0x1d3ed5(++_0x562de1);}(_0x3148,0x1d3));var _0x8314=function(_0x3fbeef,_0x2840b4){_0x3fbeef=_0x3fbeef-0x0;var _0x14ec1f=_0x3148[_0x3fbeef];return _0x14ec1f;};'use strict';var _=require(_0x8314('0x0'));var db=require(_0x8314('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x8314('0x2'));var rpc=require(_0x8314('0x3'));var config=require(_0x8314('0x4'));var logger=require(_0x8314('0x5'))('app');var pm2=require(_0x8314('0x6'));var pm2Config=require(_0x8314('0x7'));var schedule=require(_0x8314('0x8'));var chat=require(_0x8314('0x9'));var whatsapp=require(_0x8314('0xa'));var transcribe=require(_0x8314('0xb'));var provider=require(_0x8314('0xc'));function main(){return db['sequelize'][_0x8314('0xd')]()['then'](function(){if(config[_0x8314('0xe')]){return seedDb[_0x8314('0xf')]();}})[_0x8314('0x10')](function(){return checkLicense[_0x8314('0xf')]();})[_0x8314('0x10')](function(){return rpc['listen']();})['then'](function(_0xfaf56c){logger[_0x8314('0x11')](_0xfaf56c);return chat[_0x8314('0x12')]();})[_0x8314('0x10')](function(){return whatsapp['start']();})[_0x8314('0x10')](function(){return schedule[_0x8314('0x12')]();})['then'](function(){return transcribe[_0x8314('0x12')]();})['then'](function(){return provider['start']();})[_0x8314('0x10')](function(_0xc924ca){logger[_0x8314('0x11')](_0xc924ca);return pm2[_0x8314('0x12')](pm2Config);})['then'](function(_0x9e90a6){var _0x2e7098=_0x9e90a6[_0x8314('0x13')](function(_0x136e09){return typeof _0x136e09[_0x8314('0x14')]===_0x8314('0x15')&&_0x136e09['exitCode']>=0x0;});if(_0x2e7098['length']>0x0){throw new Error(_0x2e7098[_0x8314('0x16')]+_0x8314('0x17')+_[_0x8314('0x18')](_0x2e7098,function(_0x570db3){return'\x22'+_0x570db3[_0x8314('0x19')][_0x8314('0x1a')]+'\x22';}));}logger['info'](_0x8314('0x1b'),_[_0x8314('0x18')](_['filter'](_0x9e90a6,{'status':_0x8314('0x1c')}),'name')[_0x8314('0x1d')]());logger[_0x8314('0x11')](_0x8314('0x1e'),_['map'](_['filter'](_0x9e90a6,function(_0x240f4b){return _0x240f4b[_0x8314('0x1f')]!==_0x8314('0x1c');}),_0x8314('0x1a'))[_0x8314('0x1d')]()||_0x8314('0x20'));console[_0x8314('0x21')](_0x8314('0x22'));})[_0x8314('0x23')](function(_0x1e9869){console['log'](_0x8314('0x24'),_0x1e9869);logger[_0x8314('0x25')](_0x8314('0x26'),_0x1e9869);process[_0x8314('0x27')](0x1);});}main(); \ No newline at end of file +var _0x9c5a=['filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','then','seedDB','default','listen','start','info'];(function(_0x2cc650,_0x2ee6ac){var _0x41b917=function(_0x59c92d){while(--_0x59c92d){_0x2cc650['push'](_0x2cc650['shift']());}};_0x41b917(++_0x2ee6ac);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2c16e8,_0xd64588){_0x2c16e8=_0x2c16e8-0x0;var _0x35a91c=_0x9c5a[_0x2c16e8];return _0x35a91c;};'use strict';var _=require(_0xa9c5('0x0'));var db=require(_0xa9c5('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xa9c5('0x2'));var rpc=require(_0xa9c5('0x3'));var config=require(_0xa9c5('0x4'));var logger=require(_0xa9c5('0x5'))('app');var pm2=require(_0xa9c5('0x6'));var pm2Config=require(_0xa9c5('0x7'));var schedule=require('./config/schedule');var chat=require(_0xa9c5('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xa9c5('0x9'));var provider=require(_0xa9c5('0xa'));function main(){return db['sequelize']['sync']()[_0xa9c5('0xb')](function(){if(config[_0xa9c5('0xc')]){return seedDb['default']();}})[_0xa9c5('0xb')](function(){return checkLicense[_0xa9c5('0xd')]();})['then'](function(){return rpc[_0xa9c5('0xe')]();})[_0xa9c5('0xb')](function(_0x4a19c0){logger['info'](_0x4a19c0);return chat[_0xa9c5('0xf')]();})[_0xa9c5('0xb')](function(){return whatsapp[_0xa9c5('0xf')]();})[_0xa9c5('0xb')](function(){return schedule[_0xa9c5('0xf')]();})[_0xa9c5('0xb')](function(){return transcribe[_0xa9c5('0xf')]();})[_0xa9c5('0xb')](function(){return provider[_0xa9c5('0xf')]();})[_0xa9c5('0xb')](function(_0x5915ad){logger[_0xa9c5('0x10')](_0x5915ad);return pm2[_0xa9c5('0xf')](pm2Config);})[_0xa9c5('0xb')](function(_0x3806c4){var _0x418ca5=_0x3806c4[_0xa9c5('0x11')](function(_0x251099){return typeof _0x251099[_0xa9c5('0x12')]===_0xa9c5('0x13')&&_0x251099[_0xa9c5('0x12')]>=0x0;});if(_0x418ca5['length']>0x0){throw new Error(_0x418ca5[_0xa9c5('0x14')]+_0xa9c5('0x15')+_[_0xa9c5('0x16')](_0x418ca5,function(_0x55cce5){return'\x22'+_0x55cce5[_0xa9c5('0x17')][_0xa9c5('0x18')]+'\x22';}));}logger[_0xa9c5('0x10')](_0xa9c5('0x19'),_[_0xa9c5('0x16')](_[_0xa9c5('0x11')](_0x3806c4,{'status':_0xa9c5('0x1a')}),_0xa9c5('0x18'))[_0xa9c5('0x1b')]());logger[_0xa9c5('0x10')](_0xa9c5('0x1c'),_[_0xa9c5('0x16')](_['filter'](_0x3806c4,function(_0x1115ad){return _0x1115ad[_0xa9c5('0x1d')]!=='online';}),'name')[_0xa9c5('0x1b')]()||_0xa9c5('0x1e'));console[_0xa9c5('0x1f')](_0xa9c5('0x20'));})[_0xa9c5('0x21')](function(_0xd4b8a1){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0xd4b8a1);logger[_0xa9c5('0x22')](_0xa9c5('0x23'),_0xd4b8a1);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 03ded0c..bfa6084 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 _0xd4a2=['downloadOmnichannelInteractions','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Unknown\x20authorization\x20format','query','apikey','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secrets','payload','options','verify','randomBytes','hex','toString','HS512','../../mysqldb','../../config/license/util','lodash','express-jwt','basic-auth','crypto','bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd4a2,0x173));var _0x2d4a=function(_0x264e59,_0x2e081a){_0x264e59=_0x264e59-0x0;var _0x33cc1b=_0xd4a2[_0x264e59];return _0x33cc1b;};'use strict';var db=require(_0x2d4a('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x2d4a('0x1'));var encryptor=require('../encryptor');var _=require(_0x2d4a('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x2d4a('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0x2d4a('0x4'));var crypto=require(_0x2d4a('0x5'));var BPromise=require(_0x2d4a('0x6'));var util=require(_0x2d4a('0x7'));var moment=require(_0x2d4a('0x8'));var validateJwt=expressJwt({'secret':config['secrets'][_0x2d4a('0x9')]});var userAttributes=['id',_0x2d4a('0xa'),_0x2d4a('0xb'),_0x2d4a('0xc'),_0x2d4a('0xd'),_0x2d4a('0xe'),_0x2d4a('0xf'),_0x2d4a('0x10'),_0x2d4a('0x11'),_0x2d4a('0x12'),_0x2d4a('0x13'),_0x2d4a('0x14'),'faxPause','smsPause',_0x2d4a('0x15'),'pauseType',_0x2d4a('0x16'),_0x2d4a('0x17'),_0x2d4a('0x18'),_0x2d4a('0x19'),_0x2d4a('0x1a'),_0x2d4a('0x1b'),_0x2d4a('0x1c'),_0x2d4a('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x2d4a('0x1e'),'phoneBarEnableDtmfTone',_0x2d4a('0x1f'),_0x2d4a('0x20'),_0x2d4a('0x21'),_0x2d4a('0x22'),'phoneBarRemoteControlPort',_0x2d4a('0x23'),'interface',_0x2d4a('0x24'),'privacyEnabled',_0x2d4a('0x25'),_0x2d4a('0x26'),_0x2d4a('0x27'),_0x2d4a('0x28'),'downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x2d4a('0x29'),_0x2d4a('0x2a'),_0x2d4a('0x2b'),_0x2d4a('0x2c'),_0x2d4a('0x2d'),_0x2d4a('0x2e'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x2d4a('0x2f'),_0x2d4a('0x30'),_0x2d4a('0x31'),_0x2d4a('0x32'),_0x2d4a('0x33')];exports[_0x2d4a('0x34')]=function(){return this[_0x2d4a('0x35')](!![])[_0x2d4a('0x36')](function(_0x5d5daa,_0x26e7b8,_0x3240a2){if(_0x5d5daa[_0x2d4a('0x37')]){_0x3240a2();}else{return db[_0x2d4a('0x38')][_0x2d4a('0x39')]({'where':{'id':_0x5d5daa[_0x2d4a('0x3a')]['id']},'attributes':['id',_0x2d4a('0x3b'),_0x2d4a('0x3c')],'raw':!![]})['then'](function(_0x544b9b){if(_0x544b9b&&_0x544b9b['closed']){return _0x26e7b8[_0x2d4a('0x3d')](_0x544b9b['disposition']===_0x2d4a('0x3e')?0x195:0x193)[_0x2d4a('0x3f')]({'message':_0x544b9b[_0x2d4a('0x3c')]===_0x2d4a('0x3e')?_0x2d4a('0x40'):_0x2d4a('0x41')});}else{_0x3240a2();}})[_0x2d4a('0x42')](function(_0x27b358){_0x3240a2(_0x27b358);});}});};exports['isAuthenticated']=function isAuthenticated(_0x436f53){return compose()['use'](function(_0x221602,_0x9bac28,_0xc497ce){var _0x20b87d;if(_0x221602[_0x2d4a('0x43')][_0x2d4a('0x44')]){if(_[_0x2d4a('0x45')](_0x221602[_0x2d4a('0x43')]['authorization'],_0x2d4a('0x46'))){var _0x3d94b7=basicAuth(_0x221602);db[_0x2d4a('0x47')][_0x2d4a('0x48')]({'where':{'name':_0x3d94b7[_0x2d4a('0xc')]}})['then'](function(_0x217653){if(!_0x217653||!_0x217653[_0x2d4a('0x49')](_0x3d94b7[_0x2d4a('0x4a')])){return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':'Wrong\x20credentials.'});}_0x221602[_0x2d4a('0x37')]={'id':_0x217653['id']};_0xc497ce();})[_0x2d4a('0x42')](function(_0x46b623){_0xc497ce(_0x46b623);});}else if(_[_0x2d4a('0x45')](_0x221602[_0x2d4a('0x43')][_0x2d4a('0x44')],'Bearer')){validateJwt(_0x221602,_0x9bac28,_0xc497ce);}else{if(_0x436f53){_0xc497ce();}else{return _0x9bac28[_0x2d4a('0x3d')](0x193)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x4b')});}}}else if(_0x221602[_0x2d4a('0x4c')][_0x2d4a('0x4d')]){try{var _0x4b20e4={'audience':hardwareConf[_0x2d4a('0x4e')](),'issuer':hardwareConf[_0x2d4a('0x4e')]()};verifyJwt(_0x221602['query'][_0x2d4a('0x4d')],_0x4b20e4)[_0x2d4a('0x4f')](function(_0x3dae78){return db[_0x2d4a('0x47')][_0x2d4a('0x48')]({'where':{'id':_0x3dae78[_0x2d4a('0x50')]}})['then'](function(_0x52106e){_0x20b87d=_0x52106e;return db[_0x2d4a('0x51')][_0x2d4a('0x39')]({'where':{'id':0x1},'attributes':[_0x2d4a('0x52'),_0x2d4a('0x53')],'raw':!![]});})[_0x2d4a('0x4f')](function(_0x5b49f9){if(!_0x20b87d||!_['isEqual'](_0x20b87d[_0x2d4a('0x54')],_0x3dae78['nonce'])){return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x20b87d[_0x2d4a('0x55')]){return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x56')});}if(_0x20b87d[_0x2d4a('0x57')]){if(_0x5b49f9[_0x2d4a('0x53')]>0x0){if(moment(_0x20b87d[_0x2d4a('0x58')])[_0x2d4a('0x59')](_0x5b49f9[_0x2d4a('0x53')],_0x2d4a('0x5a'))>moment()){return _0x9bac28[_0x2d4a('0x3d')](0x191)['json']({'message':_0x2d4a('0x56')});}}else{return _0x9bac28[_0x2d4a('0x3d')](0x191)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x56')});}}_0x221602[_0x2d4a('0x37')]={'id':_0x20b87d['id']};_0xc497ce();});})['catch'](function(){return _0x9bac28['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x20650d){_0xc497ce(_0x20650d);}}else if(_0x436f53){_0xc497ce();}else{return _0x9bac28[_0x2d4a('0x3d')](0x193)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x4b')});}})['use'](function(_0x155f2d,_0x3df6b4,_0x5e9704){if(_0x155f2d[_0x2d4a('0x37')]){db[_0x2d4a('0x47')][_0x2d4a('0x48')]({'where':{'id':_0x155f2d[_0x2d4a('0x37')]['id']},'attributes':userAttributes})[_0x2d4a('0x4f')](function(_0x2c91e1){if(!_0x2c91e1){return _0x3df6b4['status'](0x194)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x5b')});}_0x155f2d[_0x2d4a('0x37')]=_0x2c91e1;_0x5e9704();})[_0x2d4a('0x42')](function(_0x61bb3a){_0x5e9704(_0x61bb3a);});}else if(_0x436f53){_0x5e9704();}else{return _0x3df6b4[_0x2d4a('0x3d')](0x194)['json']({'message':_0x2d4a('0x5c')});}});};exports[_0x2d4a('0x5d')]=function canUpdate(){return compose()[_0x2d4a('0x36')](function(_0x4e1901,_0x2585db,_0x4a7b30){return licenseUtil[_0x2d4a('0x5e')]()[_0x2d4a('0x4f')](function(_0x336984){if(_0x336984[_0x2d4a('0x5f')]){_0x4a7b30();}else{return _0x2585db[_0x2d4a('0x3d')](0x193)['json']({'message':'Forbidden'});}})[_0x2d4a('0x42')](function(_0x3b579e){_0x4a7b30(_0x3b579e);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x2d4a('0x36')](function(_0x5b0008,_0x16b858,_0x13f768){return licenseUtil[_0x2d4a('0x5e')]()['then'](function(_0x38d795){if(_0x38d795['webrtc']){_0x13f768();}else{return _0x16b858[_0x2d4a('0x3d')](0x193)[_0x2d4a('0x3f')]({'message':_0x2d4a('0x60')});}})[_0x2d4a('0x42')](function(_0x1325ea){_0x13f768(_0x1325ea);});});};exports[_0x2d4a('0x61')]=function(_0x92842c,_0x2b2f4b,_0x1ffb96){_0x92842c[_0x2d4a('0x61')]=!![];return _0x1ffb96();};exports[_0x2d4a('0x62')]=function signToken(_0x5e2f07){return signJwt(_0x5e2f07);};exports[_0x2d4a('0x63')]=function(_0x26a070,_0x3336b2){if(!_0x26a070[_0x2d4a('0x37')]){return _0x3336b2[_0x2d4a('0x3d')](0x194)['json']({'message':_0x2d4a('0x64')});}var _0x6629cd={'payload':{'id':_0x26a070[_0x2d4a('0x37')]['id'],'role':_0x26a070[_0x2d4a('0x37')][_0x2d4a('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x6629cd)['then'](function(_0x4b9a52){_0x3336b2[_0x2d4a('0x65')](_0x2d4a('0x66'),_0x4b9a52);_0x3336b2['redirect'](_0x2d4a('0x67'));})[_0x2d4a('0x42')](function(_0x7f0807){return _0x3336b2[_0x2d4a('0x3d')](0x1f4)['send'](_0x7f0807);});};exports[_0x2d4a('0x68')]=function(_0x4e0198){if(_[_0x2d4a('0x69')](_0x4e0198[_0x2d4a('0x54')])||_[_0x2d4a('0x69')](_0x4e0198[_0x2d4a('0x6a')])){return null;}else{return createJwt(_0x4e0198);}};exports[_0x2d4a('0x6b')]=function(_0x3103ca){_0x3103ca[_0x2d4a('0x54')]=generateNonce();_0x3103ca[_0x2d4a('0x6a')]=generateIssuedAt();return createJwt(_0x3103ca);};exports['regenerateApiKey']=function(_0x255a82,_0x2cbe03){var _0x98046f=_0x255a82[_0x2d4a('0x4c')][_0x2d4a('0x4d')];if(_0x98046f){var _0x334d6a={'nonce':_0x2cbe03[_0x2d4a('0x54')],'iat':_0x2cbe03[_0x2d4a('0x6a')],'audience':hardwareConf[_0x2d4a('0x4e')](),'issuer':hardwareConf[_0x2d4a('0x4e')]()};return verifyJwt(_0x98046f,_0x334d6a)[_0x2d4a('0x4f')](function(){return generateApiKey(_0x2cbe03);});}else{throw{'message':_0x2d4a('0x6c')};}};exports[_0x2d4a('0x6d')]=function(_0xf3df0f){var _0x1ce950=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1ce950[_0x2d4a('0x6e')](_0xf3df0f))throw new db[(_0x2d4a('0x6f'))]['ValidationError'](_0x2d4a('0x70'));return;};exports[_0x2d4a('0x71')]=function(_0x5aafa4,_0x477ffd,_0x343f25){var _0x1f0b2b=encryptor[_0x2d4a('0x72')](_0x477ffd)[_0x2d4a('0x73')](',');for(var _0x206c30=0x0;_0x206c30<_0x343f25;_0x206c30++){if(!_0x1f0b2b[_0x206c30])break;if(_0x5aafa4[_0x2d4a('0x74')]()===_0x1f0b2b[_0x206c30][_0x2d4a('0x74')]()){var _0x22afb4=util[_0x2d4a('0x75')](_0x2d4a('0x76'),_0x343f25);if(_0x343f25===0x1){_0x22afb4=_0x2d4a('0x77');}throw new db['Sequelize'][(_0x2d4a('0x78'))](_0x22afb4);}}return;};exports[_0x2d4a('0x79')]=function(_0x48c1f9,_0xb5042d){var _0x3f42eb=_0xb5042d?encryptor[_0x2d4a('0x72')](_0xb5042d)[_0x2d4a('0x73')](','):[];if(_0x3f42eb[_0x2d4a('0x7a')]===0x5){_0x3f42eb[_0x2d4a('0x7b')](-0x1,0x1);}_0x3f42eb[_0x2d4a('0x7c')](_0x48c1f9);return encryptor[_0x2d4a('0x7d')](_0x3f42eb[_0x2d4a('0x7e')](','));};function signJwt(_0x282df8){var _0x5bbc96=BPromise[_0x2d4a('0x7f')](jwt[_0x2d4a('0x80')],{'context':jwt});var _0x20445e=_0x282df8['secret']||config[_0x2d4a('0x81')][_0x2d4a('0x9')];return new BPromise(function(_0x153914,_0x2f6851){_0x5bbc96(_0x282df8[_0x2d4a('0x82')],_0x20445e,_0x282df8[_0x2d4a('0x83')])[_0x2d4a('0x4f')](function(_0x3e05c3){_0x153914(_0x3e05c3);})[_0x2d4a('0x42')](function(_0x508648){_0x2f6851(_0x508648);});});}function verifyJwt(_0x21b8e9,_0x17ade0,_0x2a876b){var _0x17ef80=BPromise[_0x2d4a('0x7f')](jwt[_0x2d4a('0x84')],{'context':jwt});var _0x53f52b=_0x2a876b||config[_0x2d4a('0x81')][_0x2d4a('0x9')];return new BPromise(function(_0x22707f,_0x4809af){_0x17ef80(_0x21b8e9,_0x53f52b,_0x17ade0)[_0x2d4a('0x4f')](function(_0x442691){_0x22707f(_0x442691);})['catch'](function(_0x2b0e4c){_0x4809af(_0x2b0e4c);});});}function generateNonce(){return crypto[_0x2d4a('0x85')](0x10)['toString'](_0x2d4a('0x86'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x2d4a('0x87')]();}function createJwt(_0x4158ae){var _0x3b5bb9={'payload':{'iat':_0x4158ae[_0x2d4a('0x6a')],'nonce':_0x4158ae['apiKeyNonce']},'options':{'algorithm':_0x2d4a('0x88'),'subject':_0x4158ae['id'][_0x2d4a('0x87')](),'issuer':hardwareConf[_0x2d4a('0x4e')](),'audience':hardwareConf[_0x2d4a('0x4e')]()}};return signJwt(_0x3b5bb9)['then'](function(_0x4d8111){return{'iat':_0x4158ae[_0x2d4a('0x6a')],'nonce':_0x4158ae[_0x2d4a('0x54')],'token':_0x4d8111};});} \ No newline at end of file +var _0x1775=['isEqual','apiKeyNonce','nonce','status','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','use','User\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','closed','disposition','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','find','sub','then','Setting','allowedLoginAttempts','blockDuration'];(function(_0x3c37a1,_0x516d3f){var _0x5a1775=function(_0x4d8199){while(--_0x4d8199){_0x3c37a1['push'](_0x3c37a1['shift']());}};_0x5a1775(++_0x516d3f);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x5177('0x0'));var hardwareConf=require(_0x5177('0x1'));var licenseUtil=require(_0x5177('0x2'));var encryptor=require(_0x5177('0x3'));var _=require(_0x5177('0x4'));var jwt=require(_0x5177('0x5'));var expressJwt=require(_0x5177('0x6'));var compose=require(_0x5177('0x7'));var basicAuth=require(_0x5177('0x8'));var crypto=require(_0x5177('0x9'));var BPromise=require(_0x5177('0xa'));var util=require(_0x5177('0xb'));var moment=require(_0x5177('0xc'));var validateJwt=expressJwt({'secret':config[_0x5177('0xd')][_0x5177('0xe')]});var userAttributes=['id',_0x5177('0xf'),_0x5177('0x10'),_0x5177('0x11'),_0x5177('0x12'),_0x5177('0x13'),_0x5177('0x14'),_0x5177('0x15'),'md5secret','voicePause',_0x5177('0x16'),_0x5177('0x17'),_0x5177('0x18'),_0x5177('0x19'),_0x5177('0x1a'),'pauseType',_0x5177('0x1b'),_0x5177('0x1c'),_0x5177('0x1d'),_0x5177('0x1e'),_0x5177('0x1f'),_0x5177('0x20'),_0x5177('0x21'),_0x5177('0x22'),_0x5177('0x23'),_0x5177('0x24'),_0x5177('0x25'),_0x5177('0x26'),_0x5177('0x27'),_0x5177('0x28'),_0x5177('0x29'),_0x5177('0x2a'),_0x5177('0x2b'),_0x5177('0x2c'),_0x5177('0x2d'),'userProfileId',_0x5177('0x2e'),_0x5177('0x2f'),_0x5177('0x30'),_0x5177('0x31'),'downloadOmnichannelInteractions',_0x5177('0x32'),_0x5177('0x33'),_0x5177('0x34'),'chatAutoanswer',_0x5177('0x35'),'emailAutoanswer',_0x5177('0x36'),_0x5177('0x37'),_0x5177('0x38'),_0x5177('0x39'),_0x5177('0x3a'),_0x5177('0x3b'),_0x5177('0x3c'),_0x5177('0x3d'),_0x5177('0x3e'),_0x5177('0x3f')];exports[_0x5177('0x40')]=function(){return this[_0x5177('0x41')](!![])['use'](function(_0x3dcea1,_0x556f96,_0x30b60f){if(_0x3dcea1[_0x5177('0x42')]){_0x30b60f();}else{return db[_0x5177('0x43')][_0x5177('0x44')]({'where':{'id':_0x3dcea1['params']['id']},'attributes':['id',_0x5177('0x45'),'disposition'],'raw':!![]})['then'](function(_0x19a0c2){if(_0x19a0c2&&_0x19a0c2[_0x5177('0x45')]){return _0x556f96['status'](_0x19a0c2[_0x5177('0x46')]==='unmanaged'?0x195:0x193)[_0x5177('0x47')]({'message':_0x19a0c2[_0x5177('0x46')]==='unmanaged'?_0x5177('0x48'):_0x5177('0x49')});}else{_0x30b60f();}})[_0x5177('0x4a')](function(_0x7f86e){_0x30b60f(_0x7f86e);});}});};exports[_0x5177('0x41')]=function isAuthenticated(_0x1cef5d){return compose()['use'](function(_0x498fcd,_0x45cf20,_0x1c660e){var _0x7dae59;if(_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')]){if(_[_0x5177('0x4d')](_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')],'Basic')){var _0x42e1db=basicAuth(_0x498fcd);db[_0x5177('0x4e')]['find']({'where':{'name':_0x42e1db[_0x5177('0x11')]}})['then'](function(_0x172b36){if(!_0x172b36||!_0x172b36[_0x5177('0x4f')](_0x42e1db[_0x5177('0x50')])){return _0x45cf20['status'](0x191)['json']({'message':_0x5177('0x51')});}_0x498fcd[_0x5177('0x42')]={'id':_0x172b36['id']};_0x1c660e();})[_0x5177('0x4a')](function(_0x3735e9){_0x1c660e(_0x3735e9);});}else if(_[_0x5177('0x4d')](_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')],_0x5177('0x52'))){validateJwt(_0x498fcd,_0x45cf20,_0x1c660e);}else{if(_0x1cef5d){_0x1c660e();}else{return _0x45cf20['status'](0x193)[_0x5177('0x47')]({'message':_0x5177('0x53')});}}}else if(_0x498fcd['query'][_0x5177('0x54')]){try{var _0x2a26fc={'audience':hardwareConf[_0x5177('0x55')](),'issuer':hardwareConf[_0x5177('0x55')]()};verifyJwt(_0x498fcd[_0x5177('0x56')][_0x5177('0x54')],_0x2a26fc)['then'](function(_0x40c607){return db[_0x5177('0x4e')][_0x5177('0x57')]({'where':{'id':_0x40c607[_0x5177('0x58')]}})[_0x5177('0x59')](function(_0xacaa96){_0x7dae59=_0xacaa96;return db[_0x5177('0x5a')]['findOne']({'where':{'id':0x1},'attributes':[_0x5177('0x5b'),_0x5177('0x5c')],'raw':!![]});})['then'](function(_0x486dd5){if(!_0x7dae59||!_[_0x5177('0x5d')](_0x7dae59[_0x5177('0x5e')],_0x40c607[_0x5177('0x5f')])){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x61')});}if(_0x7dae59[_0x5177('0x62')]){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});}if(_0x7dae59[_0x5177('0x64')]){if(_0x486dd5[_0x5177('0x5c')]>0x0){if(moment(_0x7dae59[_0x5177('0x65')])['add'](_0x486dd5[_0x5177('0x5c')],_0x5177('0x66'))>moment()){return _0x45cf20['status'](0x191)[_0x5177('0x47')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});}}_0x498fcd['user']={'id':_0x7dae59['id']};_0x1c660e();});})['catch'](function(){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});});}catch(_0x177c4b){_0x1c660e(_0x177c4b);}}else if(_0x1cef5d){_0x1c660e();}else{return _0x45cf20[_0x5177('0x60')](0x193)[_0x5177('0x47')]({'message':_0x5177('0x53')});}})[_0x5177('0x67')](function(_0x4e287e,_0xe1c75c,_0x51ecc0){if(_0x4e287e['user']){db[_0x5177('0x4e')][_0x5177('0x57')]({'where':{'id':_0x4e287e['user']['id']},'attributes':userAttributes})[_0x5177('0x59')](function(_0x508178){if(!_0x508178){return _0xe1c75c['status'](0x194)[_0x5177('0x47')]({'message':_0x5177('0x68')});}_0x4e287e[_0x5177('0x42')]=_0x508178;_0x51ecc0();})[_0x5177('0x4a')](function(_0x191973){_0x51ecc0(_0x191973);});}else if(_0x1cef5d){_0x51ecc0();}else{return _0xe1c75c[_0x5177('0x60')](0x194)[_0x5177('0x47')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x5177('0x67')](function(_0x511dc0,_0x23be2a,_0x3476d3){return licenseUtil[_0x5177('0x69')]()[_0x5177('0x59')](function(_0x570812){if(_0x570812[_0x5177('0x6a')]){_0x3476d3();}else{return _0x23be2a[_0x5177('0x60')](0x193)[_0x5177('0x47')]({'message':_0x5177('0x6b')});}})[_0x5177('0x4a')](function(_0x10b370){_0x3476d3(_0x10b370);});});};exports[_0x5177('0x6c')]=function isWebrtcLicence(){return compose()[_0x5177('0x67')](function(_0x1ada68,_0x296a98,_0x3fec49){return licenseUtil['getLicense']()[_0x5177('0x59')](function(_0x481bda){if(_0x481bda['webrtc']){_0x3fec49();}else{return _0x296a98['status'](0x193)[_0x5177('0x47')]({'message':_0x5177('0x6b')});}})['catch'](function(_0x326405){_0x3fec49(_0x326405);});});};exports[_0x5177('0x6d')]=function(_0x208483,_0x4891fe,_0x1d4ae4){_0x208483['isMiddleware']=!![];return _0x1d4ae4();};exports['signToken']=function signToken(_0x5bd97b){return signJwt(_0x5bd97b);};exports[_0x5177('0x6e')]=function(_0x37d5dd,_0x1300d7){if(!_0x37d5dd['user']){return _0x1300d7['status'](0x194)[_0x5177('0x47')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x262ac4={'payload':{'id':_0x37d5dd[_0x5177('0x42')]['id'],'role':_0x37d5dd[_0x5177('0x42')][_0x5177('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x262ac4)[_0x5177('0x59')](function(_0xa0edd7){_0x1300d7[_0x5177('0x6f')](_0x5177('0x70'),_0xa0edd7);_0x1300d7[_0x5177('0x71')](_0x5177('0x72'));})[_0x5177('0x4a')](function(_0xb08267){return _0x1300d7[_0x5177('0x60')](0x1f4)['send'](_0xb08267);});};exports['retrieveApiKey']=function(_0x29ff0f){if(_['isNil'](_0x29ff0f[_0x5177('0x5e')])||_['isNil'](_0x29ff0f[_0x5177('0x73')])){return null;}else{return createJwt(_0x29ff0f);}};exports[_0x5177('0x74')]=function(_0x1e838a){_0x1e838a['apiKeyNonce']=generateNonce();_0x1e838a['apiKeyIat']=generateIssuedAt();return createJwt(_0x1e838a);};exports[_0x5177('0x75')]=function(_0x43b5b9,_0x2eb560){var _0xcc37fb=_0x43b5b9['query']['apikey'];if(_0xcc37fb){var _0x3f0e89={'nonce':_0x2eb560[_0x5177('0x5e')],'iat':_0x2eb560[_0x5177('0x73')],'audience':hardwareConf[_0x5177('0x55')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xcc37fb,_0x3f0e89)[_0x5177('0x59')](function(){return generateApiKey(_0x2eb560);});}else{throw{'message':_0x5177('0x76')};}};exports[_0x5177('0x77')]=function(_0x589da8){var _0x2b39ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2b39ba[_0x5177('0x78')](_0x589da8))throw new db[(_0x5177('0x79'))]['ValidationError'](_0x5177('0x7a'));return;};exports['validatePasswordHistory']=function(_0x40dfd6,_0x39fb92,_0x3268bd){var _0x5101fc=encryptor[_0x5177('0x7b')](_0x39fb92)[_0x5177('0x7c')](',');for(var _0xea44e=0x0;_0xea44e<_0x3268bd;_0xea44e++){if(!_0x5101fc[_0xea44e])break;if(_0x40dfd6[_0x5177('0x7d')]()===_0x5101fc[_0xea44e][_0x5177('0x7d')]()){var _0x74589e=util[_0x5177('0x7e')](_0x5177('0x7f'),_0x3268bd);if(_0x3268bd===0x1){_0x74589e='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x74589e);}}return;};exports[_0x5177('0x80')]=function(_0x18222f,_0x35aa22){var _0x75cc0e=_0x35aa22?encryptor[_0x5177('0x7b')](_0x35aa22)[_0x5177('0x7c')](','):[];if(_0x75cc0e['length']===0x5){_0x75cc0e['splice'](-0x1,0x1);}_0x75cc0e[_0x5177('0x81')](_0x18222f);return encryptor[_0x5177('0x82')](_0x75cc0e[_0x5177('0x83')](','));};function signJwt(_0x336017){var _0x123d40=BPromise[_0x5177('0x84')](jwt[_0x5177('0x85')],{'context':jwt});var _0xd9c1db=_0x336017[_0x5177('0x86')]||config['secrets'][_0x5177('0xe')];return new BPromise(function(_0x25a0be,_0x57e199){_0x123d40(_0x336017[_0x5177('0x87')],_0xd9c1db,_0x336017[_0x5177('0x88')])['then'](function(_0x69c264){_0x25a0be(_0x69c264);})[_0x5177('0x4a')](function(_0x11a63c){_0x57e199(_0x11a63c);});});}function verifyJwt(_0x4be4b2,_0x23b246,_0x400e27){var _0x5f5bd5=BPromise['promisify'](jwt[_0x5177('0x89')],{'context':jwt});var _0x4f76d7=_0x400e27||config[_0x5177('0xd')]['session'];return new BPromise(function(_0x2771fa,_0x16f17c){_0x5f5bd5(_0x4be4b2,_0x4f76d7,_0x23b246)['then'](function(_0x2af938){_0x2771fa(_0x2af938);})[_0x5177('0x4a')](function(_0x1975a3){_0x16f17c(_0x1975a3);});});}function generateNonce(){return crypto[_0x5177('0x8a')](0x10)[_0x5177('0x8b')](_0x5177('0x8c'));}function generateIssuedAt(){return Math[_0x5177('0x8d')](Date['now']()/0x3e8)[_0x5177('0x8b')]();}function createJwt(_0x54aabd){var _0x54c301={'payload':{'iat':_0x54aabd[_0x5177('0x73')],'nonce':_0x54aabd[_0x5177('0x5e')]},'options':{'algorithm':'HS512','subject':_0x54aabd['id'][_0x5177('0x8b')](),'issuer':hardwareConf[_0x5177('0x55')](),'audience':hardwareConf[_0x5177('0x55')]()}};return signJwt(_0x54c301)[_0x5177('0x59')](function(_0x19b587){return{'iat':_0x54aabd[_0x5177('0x73')],'nonce':_0x54aabd[_0x5177('0x5e')],'token':_0x19b587};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 273aae9..6887aed 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 _0x8e8a=['lodash','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','user','clause','then','ids','tag','countFilteredContacts','count','User','buildContactsQuery','rows','describe','CmContact','keys','startsWith','cf_','map','findOne','all','length','type','catch'];(function(_0x2ea356,_0x4c373b){var _0x1439d5=function(_0x1dab2c){while(--_0x1dab2c){_0x2ea356['push'](_0x2ea356['shift']());}};_0x1439d5(++_0x4c373b);}(_0x8e8a,0x1ba));var _0xa8e8=function(_0x216a6e,_0x5d85ac){_0x216a6e=_0x216a6e-0x0;var _0x2e5f85=_0x8e8a[_0x216a6e];return _0x2e5f85;};'use strict';var _=require(_0xa8e8('0x0'));var sqlUtils=require(_0xa8e8('0x1'));var db=require('../../mysqldb')['db'];exports[_0xa8e8('0x2')]=function(_0x15caed,_0x33e32a,_0x38ccd9,_0x5de256){var _0x323cf1={'count':0x0,'rows':[]};var _0x3c8469=sqlUtils[_0xa8e8('0x3')](_0x33e32a,_0x15caed);if(_0x3c8469){return Promise[_0xa8e8('0x4')](_0x323cf1);}var _0x1a21e1=sqlUtils[_0xa8e8('0x5')]();var _0x2d9c61={};var _0x411000=![];var _0x372a72=![];return Promise[_0xa8e8('0x4')]()['then'](function(){if(_0x15caed[_0xa8e8('0x6')]){return sqlUtils[_0xa8e8('0x7')](_0x15caed[_0xa8e8('0x6')],_0x5de256);}else{return sqlUtils[_0xa8e8('0x8')](_0x15caed,_0x5de256);}})['then'](function(_0x3a60e7){_0x1a21e1['where'](_0x3a60e7[_0xa8e8('0x9')]);_0x1a21e1[_0xa8e8('0xa')](_0x3a60e7[_0xa8e8('0xb')]);_0x1a21e1['where'](_0x3a60e7[_0xa8e8('0xc')]);_0x1a21e1[_0xa8e8('0xa')](_0x3a60e7[_0xa8e8('0xd')][_0xa8e8('0xe')]);_0x2d9c61=_0x3a60e7['tags'];_0x372a72=_0x3a60e7[_0xa8e8('0xd')]['skip'];return sqlUtils['checkListsRestrictions'](_0x33e32a,_0x15caed,_0x372a72);})[_0xa8e8('0xf')](function(_0x490640){_0x1a21e1[_0xa8e8('0xa')](_0x490640);var _0x59eaba=_0x15caed[_0xa8e8('0x6')]?_0x2d9c61[_0xa8e8('0x10')]:_0x15caed[_0xa8e8('0x11')];_0x411000=_0x59eaba?!![]:![];return sqlUtils[_0xa8e8('0x12')](_0x1a21e1,_0x59eaba);})['then'](function(_0x5012a3){_0x323cf1[_0xa8e8('0x13')]=_0x5012a3;if(_0x323cf1['count']===0x0){return;}if(_0x15caed[_0xa8e8('0x14')]){_0x372a72=!![];}return sqlUtils[_0xa8e8('0x15')](_0x1a21e1,_0x15caed[_0xa8e8('0xb')],_0x38ccd9,_0x411000,_0x2d9c61[_0xa8e8('0xe')],_0x372a72);})[_0xa8e8('0xf')](function(_0x24f346){if(!_0x24f346){return[];}return sqlUtils['getFilteredContacts'](_0x24f346,_0x15caed,_0x38ccd9);})[_0xa8e8('0xf')](function(_0x5546e0){_0x323cf1[_0xa8e8('0x16')]=_0x5546e0;return _0x323cf1;})['catch'](function(_0x5e221c){throw _0x5e221c;});};exports[_0xa8e8('0x17')]=function(){var _0x360672={};var _0x43628f=[];return db[_0xa8e8('0x18')][_0xa8e8('0x17')]()[_0xa8e8('0xf')](function(_0x1b6e71){_0x360672=_0x1b6e71;var _0x3cfdd1=Object[_0xa8e8('0x19')](_0x360672)['filter'](function(_0x8307d8){return _[_0xa8e8('0x1a')](_0x8307d8,_0xa8e8('0x1b'))?_0x8307d8:undefined;});var _0x3cdcea=_0x3cfdd1[_0xa8e8('0x1c')](function(_0x3d6b87){return db['CmCustomField'][_0xa8e8('0x1d')]({'where':{'id':_0x3d6b87['slice'](0x3)},'raw':!![]});});return Promise[_0xa8e8('0x1e')](_0x3cdcea);})['then'](function(_0x1effc5){for(var _0x114267=0x0;_0x114267<_0x1effc5[_0xa8e8('0x1f')];_0x114267++){if(_0x1effc5[_0x114267]){var _0x57aefb=_0xa8e8('0x1b')+_0x1effc5[_0x114267]['id'];_0x360672[_0x57aefb]['fieldType']=_0x1effc5[_0x114267]['type'];}}_0x43628f=_[_0xa8e8('0x1c')](Object[_0xa8e8('0x19')](_0x360672),function(_0x108927){return{'name':_0x108927,'type':_0x360672[_0x108927][_0xa8e8('0x20')]};});return _0x43628f;})[_0xa8e8('0x21')](function(_0x43c415){throw _0x43c415;});}; \ No newline at end of file +var _0x1765=['describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','lodash','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then','search','parseQueryParameters','where','default','filter','user','tags','skip','ids','tag','count','User','buildContactsQuery','rows','catch'];(function(_0x11cb08,_0x32ca60){var _0x1b3c3b=function(_0x349c1){while(--_0x349c1){_0x11cb08['push'](_0x11cb08['shift']());}};_0x1b3c3b(++_0x32ca60);}(_0x1765,0x13e));var _0x5176=function(_0x24ae03,_0x334660){_0x24ae03=_0x24ae03-0x0;var _0x38a29e=_0x1765[_0x24ae03];return _0x38a29e;};'use strict';var _=require(_0x5176('0x0'));var sqlUtils=require(_0x5176('0x1'));var db=require(_0x5176('0x2'))['db'];exports[_0x5176('0x3')]=function(_0xa362e8,_0x5ef37c,_0x388616,_0x334077){var _0x508969={'count':0x0,'rows':[]};var _0x5eaec5=sqlUtils['skipContactsQuery'](_0x5ef37c,_0xa362e8);if(_0x5eaec5){return Promise[_0x5176('0x4')](_0x508969);}var _0x293a15=sqlUtils[_0x5176('0x5')]();var _0x15acc5={};var _0x39f61c=![];var _0x593430=![];return Promise['resolve']()[_0x5176('0x6')](function(){if(_0xa362e8[_0x5176('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0xa362e8[_0x5176('0x7')],_0x334077);}else{return sqlUtils[_0x5176('0x8')](_0xa362e8,_0x334077);}})['then'](function(_0x297f1b){_0x293a15[_0x5176('0x9')](_0x297f1b[_0x5176('0xa')]);_0x293a15[_0x5176('0x9')](_0x297f1b['fields']);_0x293a15[_0x5176('0x9')](_0x297f1b[_0x5176('0xb')]);_0x293a15[_0x5176('0x9')](_0x297f1b[_0x5176('0xc')]['clause']);_0x15acc5=_0x297f1b[_0x5176('0xd')];_0x593430=_0x297f1b[_0x5176('0xc')][_0x5176('0xe')];return sqlUtils['checkListsRestrictions'](_0x5ef37c,_0xa362e8,_0x593430);})['then'](function(_0xd6bcf6){_0x293a15[_0x5176('0x9')](_0xd6bcf6);var _0x3e433a=_0xa362e8[_0x5176('0x7')]?_0x15acc5[_0x5176('0xf')]:_0xa362e8[_0x5176('0x10')];_0x39f61c=_0x3e433a?!![]:![];return sqlUtils['countFilteredContacts'](_0x293a15,_0x3e433a);})['then'](function(_0x259702){_0x508969[_0x5176('0x11')]=_0x259702;if(_0x508969[_0x5176('0x11')]===0x0){return;}if(_0xa362e8[_0x5176('0x12')]){_0x593430=!![];}return sqlUtils[_0x5176('0x13')](_0x293a15,_0xa362e8['fields'],_0x388616,_0x39f61c,_0x15acc5['clause'],_0x593430);})[_0x5176('0x6')](function(_0x10212d){if(!_0x10212d){return[];}return sqlUtils['getFilteredContacts'](_0x10212d,_0xa362e8,_0x388616);})['then'](function(_0x595014){_0x508969[_0x5176('0x14')]=_0x595014;return _0x508969;})[_0x5176('0x15')](function(_0x4bd611){throw _0x4bd611;});};exports[_0x5176('0x16')]=function(){var _0x3cf3b7={};var _0x26c3c7=[];return db[_0x5176('0x17')][_0x5176('0x16')]()[_0x5176('0x6')](function(_0x360b5d){_0x3cf3b7=_0x360b5d;var _0xb2d9f1=Object[_0x5176('0x18')](_0x3cf3b7)[_0x5176('0xb')](function(_0x5dc6b0){return _[_0x5176('0x19')](_0x5dc6b0,_0x5176('0x1a'))?_0x5dc6b0:undefined;});var _0x712302=_0xb2d9f1[_0x5176('0x1b')](function(_0x3e0303){return db[_0x5176('0x1c')][_0x5176('0x1d')]({'where':{'id':_0x3e0303[_0x5176('0x1e')](0x3)},'raw':!![]});});return Promise[_0x5176('0x1f')](_0x712302);})[_0x5176('0x6')](function(_0x28c3d6){for(var _0x3ff289=0x0;_0x3ff289<_0x28c3d6[_0x5176('0x20')];_0x3ff289++){if(_0x28c3d6[_0x3ff289]){var _0x4a7ef9=_0x5176('0x1a')+_0x28c3d6[_0x3ff289]['id'];_0x3cf3b7[_0x4a7ef9][_0x5176('0x21')]=_0x28c3d6[_0x3ff289]['type'];}}_0x26c3c7=_[_0x5176('0x1b')](Object[_0x5176('0x18')](_0x3cf3b7),function(_0x5bee02){return{'name':_0x5bee02,'type':_0x3cf3b7[_0x5bee02]['type']};});return _0x26c3c7;})[_0x5176('0x15')](function(_0x5e5532){throw _0x5e5532;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index fd8108c..21b67f1 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 _0x809b=['some','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','filter','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','group','having','order','DESC','findAll','color','SELECT','CmContact','sequelize','query','toString','Tags','isEmpty','QueryTypes','COUNT(*)','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','CompanyId','createdAt','updatedAt','includes','push','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','text','value','start','end','Tag','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','keys'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x809b,0x1bb));var _0xb809=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x809b[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var squel=require(_0xb809('0x0'));var as=require(_0xb809('0x1'));var qs=require(_0xb809('0x2'));var utils=require(_0xb809('0x3'));var db=require(_0xb809('0x4'))['db'];function skipContactsQuery(_0x280c34,_0x39635b){var _0x4ad5fa=![];if(_0x280c34[_0xb809('0x5')]===_0xb809('0x6')&&!_0x39635b[_0xb809('0x7')]&&!_0x39635b[_0xb809('0x8')]&&_0x39635b[_0xb809('0x9')]!==_0xb809('0xa')){_0x4ad5fa=!![];}return _0x4ad5fa;}function getContactsSubquery(){return squel[_0xb809('0xb')]()[_0xb809('0xc')]('cm_contacts','c')[_0xb809('0xd')](_0xb809('0xe'));}function applyJoinClauses(_0x4966cd,_0x6e8ae){var _0x502887=_0x6e8ae?'c':_0xb809('0xf');_0x4966cd[_0xb809('0x10')](_0xb809('0x11'),'uc','uc.CmContactId\x20=\x20'+_0x502887+_0xb809('0x12'))['left_join'](_0xb809('0x13'),'ct',_0xb809('0x14')+_0x502887+'.id')[_0xb809('0x10')](_0xb809('0x15'),'t',_0xb809('0x16'));return _0x4966cd;}function addFieldsToQuery(_0x248aba,_0x32e289,_0x5dffb3,_0x2eb132,_0xb2f1cb){var _0x17d5e9=_0xb2f1cb?'c':_0xb809('0xf');if(!_0x32e289){_0x32e289=['id',_0xb809('0x17'),'lastName',_0xb809('0x18'),_0xb809('0x19'),_0xb809('0x1a'),'email','ListId',_0xb809('0x1b'),_0xb809('0x1c'),_0xb809('0x1d'),'deletedAt','TagIds'];}else if(!_0x32e289[_0xb809('0x1e')]('id')){_0x32e289[_0xb809('0x1f')]('id');}var _0x3d1153=_0x5dffb3&&_0xb2f1cb||!_0x5dffb3&&!_0xb2f1cb;if(_0x2eb132){_0x3d1153=_0x2eb132&&_0xb2f1cb||!_0x2eb132&&!_0xb2f1cb;}_0x32e289['forEach'](function(_0x31ef94){if(_0x31ef94===_0xb809('0x20')){if(_0x3d1153){_0x248aba[_0xb809('0x21')](_0xb809('0x22'),_0x31ef94);}else if(_0x5dffb3||_0x2eb132){_0x248aba[_0xb809('0x21')](_0x17d5e9+'.'+_0x31ef94);}}else{_0x248aba[_0xb809('0x21')](_0x17d5e9+'.'+_0x31ef94);}});return _0x248aba;}function getSqlClauses(){var _0x490f75={'default':squel['expr'](),'fields':squel[_0xb809('0x23')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xb809('0x23')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x490f75;}function parseTagParameter(_0x36d8d5){var _0x2ba2f8=squel[_0xb809('0x23')]();if(_0x36d8d5){var _0x4ef581=utils[_0xb809('0x24')](_0x36d8d5);_0x4ef581[_0xb809('0x25')](function(_0x42cdb7){_0x2ba2f8['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x42cdb7+',%');});}return _0x2ba2f8;}function parseSearchFilter(_0x3c5e2c){var _0x58061c=squel['expr']();if(_0x3c5e2c){var _0x3daa0c=_0x3c5e2c[_0xb809('0x26')]('\x5c','\x5c\x5c')[_0xb809('0x26')](/'/g,'\x27\x27');if(_0x3daa0c[_0xb809('0x27')]('\x20')[_0xb809('0x28')]>0x1){_0x58061c['or'](_0xb809('0x29'),qs[_0xb809('0x2a')](_0x3daa0c,!![]),null);}else{if(qs[_0xb809('0x2b')](_0x3daa0c)){_0x58061c['or'](_0xb809('0x2c'),_0x3daa0c+'%');_0x58061c['or']('c.phone\x20LIKE\x20?',_0x3daa0c+'%');_0x58061c['or']('c.mobile\x20LIKE\x20?',_0x3daa0c+'%');_0x58061c['or'](_0xb809('0x2d'),_0x3daa0c+'%');}else if(qs[_0xb809('0x2e')](_0x3daa0c)){_0x58061c['or']('c.email\x20LIKE\x20?',_0x3daa0c+'%');}else{_0x58061c['or'](_0xb809('0x2f'),'%'+_0x3daa0c+'%');_0x58061c['or']('c.lastName\x20LIKE\x20?','%'+_0x3daa0c+'%');_0x58061c['or']('c.email\x20LIKE\x20?','%'+_0x3daa0c+'%');}}}return _0x58061c;}function parseAdvancedSearchFilter(_0x4b5036,_0x1d1fc8){var _0x3ddf9d=getSqlClauses();var _0x17be54=as[_0xb809('0x30')](_0x4b5036);var _0x126b4a=_0x17be54[_0xb809('0x31')];for(var _0x11b455=0x0;_0x11b455<_0x17be54[_0xb809('0x32')][_0xb809('0x28')];_0x11b455++){var _0x145e95=_0x17be54['conditions'][_0x11b455];var _0x1ec17a='c';var _0x2b5770=_[_0xb809('0x33')](_0x1d1fc8,['name',_0x145e95[_0xb809('0x21')]]);if(_0x2b5770){if(_0x145e95[_0xb809('0x21')]===_0xb809('0x34')||_0x2b5770[_0xb809('0x35')]===_0xb809('0x36')){_0x145e95[_0xb809('0x37')]='DATE';}var _0x4d7b50=as[_0xb809('0x38')](_0x1ec17a,_0x2b5770[_0xb809('0x39')],_0x145e95);_0x3ddf9d[_0xb809('0x3a')][_0x126b4a](_0x4d7b50[_0xb809('0x3b')],_0x4d7b50[_0xb809('0x3c')][_0xb809('0x3d')],_0x4d7b50['value'][_0xb809('0x3e')]);}else{if(_0x145e95[_0xb809('0x21')]===_0xb809('0x3f')){var _0x3a5442=_0x145e95[_0xb809('0x3c')][_0xb809('0x27')](',')['map'](function(_0x1acf24){return Number(_0x1acf24);});var _0x3fc879=parseTagParameter(_0x3a5442);_0x3ddf9d['tags'][_0xb809('0x40')][_0xb809('0x41')](_0x3fc879);_0x3ddf9d[_0xb809('0x42')][_0xb809('0x43')]=_0x3a5442;}else if(_0x145e95[_0xb809('0x21')]===_0xb809('0x44')){_0x3ddf9d[_0xb809('0x45')][_0xb809('0x40')][_0xb809('0x41')](_0xb809('0x46'),_0x145e95[_0xb809('0x3c')]);_0x3ddf9d['user']['skip']=!![];}}}return _0x3ddf9d;}function parseModelFields(_0x3cc02c,_0x4620b1){var _0x71afc=squel[_0xb809('0x23')]();var _0x2f2c30=_(_0x3cc02c)[_0xb809('0x47')]()['map'](function(_0x50c14a){return _[_0xb809('0x48')](_0x4620b1,[_0xb809('0x49'),_0x50c14a])?_0x50c14a:undefined;})[_0xb809('0x4a')]()['value']();if(_0x3cc02c[_0xb809('0x4b')]){_0x2f2c30[_0xb809('0x1f')](_0xb809('0x4b'));}if(_0x3cc02c[_0xb809('0x44')]){_0x2f2c30['push']('User');}if(_0x2f2c30[_0xb809('0x28')]>0x0){_0x2f2c30['forEach'](function(_0x3201f3){if(_0x3201f3==='ListId'){_0x71afc[_0xb809('0x41')](_0xb809('0x4c'),[][_0xb809('0x4d')](_0x3cc02c[_0x3201f3]));}else if(_0x3201f3===_0xb809('0x4b')){var _0x1e25c0='%'+_0x3cc02c[_0x3201f3]+'%';_0x71afc['and'](_0xb809('0x4e'),_0x1e25c0);}else if(_0x3201f3===_0xb809('0x44')){_0x71afc['and']('uc.UserId\x20=\x20?',_0x3cc02c[_0x3201f3]);}else{_0x71afc['and']('c.'+_0x3201f3+'\x20=\x20?',_0x3cc02c[_0x3201f3]);}});}return _0x71afc;}function parseQueryParameters(_0x33241a,_0x226cdc){var _0x31fe42=getSqlClauses();return Promise[_0xb809('0x4f')]()[_0xb809('0x50')](function(){return parseModelFields(_0x33241a,_0x226cdc);})[_0xb809('0x50')](function(_0x50823d){_0x31fe42['fields'][_0xb809('0x41')](_0x50823d);return parseTagParameter(_0x33241a['tag']);})['then'](function(_0x4276e3){_0x31fe42[_0xb809('0x42')]['clause']['and'](_0x4276e3);return parseSearchFilter(_0x33241a['filter']);})['then'](function(_0x1814ce){_0x31fe42[_0xb809('0x51')]=_0x1814ce;return _0x31fe42;});}function checkListsRestrictions(_0x3fcb45,_0x190b43,_0x1d46e1){var _0x45ab44=squel[_0xb809('0x23')]();return Promise[_0xb809('0x4f')]()[_0xb809('0x50')](function(){if(_0x190b43[_0xb809('0x7')]&&_0x3fcb45['role']===_0xb809('0x6')&&!_0x1d46e1){return _0x3fcb45[_0xb809('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xb13e50){if(_0xb13e50){if(_0xb13e50['length']===0x0){_0x45ab44[_0xb809('0x41')](_0xb809('0x53'));}else{_0x45ab44[_0xb809('0x41')]('c.ListId\x20IN\x20?',_['map'](_0xb13e50,'id'));}}})[_0xb809('0x50')](function(){return _0x45ab44;});}function buildContactsQuery(_0x5baed0,_0x4aca70,_0x1dd6eb,_0x5e50a2,_0x573b8c,_0x1921f9){if(_0x4aca70){_0x4aca70=_0x1dd6eb[_0xb809('0x54')];}_0x5baed0=addFieldsToQuery(_0x5baed0,_0x4aca70,_0x5e50a2,_0x1921f9,!![]);var _0x2e9197=squel['select']();_0x2e9197=addFieldsToQuery(_0x2e9197,_0x4aca70,_0x5e50a2,_0x1921f9,![]);if(_0x5e50a2||_0x1921f9){_0x5baed0=applyJoinClauses(_0x5baed0,!![]);_0x5baed0['group'](_0xb809('0x55'));if(_0x1dd6eb['limit']){_0x2e9197[_0xb809('0x56')](_0x1dd6eb['limit']);}if(_0x1dd6eb['offset']){_0x2e9197['offset'](_0x1dd6eb['offset']);}}else{_0x2e9197=applyJoinClauses(_0x2e9197,![]);_0x2e9197[_0xb809('0x57')]('subqry.id');if(_0x1dd6eb[_0xb809('0x56')]){_0x5baed0[_0xb809('0x56')](_0x1dd6eb[_0xb809('0x56')]);}if(_0x1dd6eb['offset']){_0x5baed0['offset'](_0x1dd6eb['offset']);}}_0x2e9197[_0xb809('0x58')](_0x573b8c);if(_0x1dd6eb['order']){_0x1dd6eb[_0xb809('0x59')][_0xb809('0x25')](function(_0x839248){_0x5baed0[_0xb809('0x59')]('c.'+_0x839248[0x0],_0x839248[0x1]===_0xb809('0x5a')?![]:!![]);_0x2e9197['order']('subqry.'+_0x839248[0x0],_0x839248[0x1]==='DESC'?![]:!![]);});}_0x2e9197['from'](_0x5baed0,'subqry');return _0x2e9197;}function getFilteredContacts(_0x4b8321){var _0x4e6721=[];return db['Tag'][_0xb809('0x5b')]({'attributes':['id','name',_0xb809('0x5c')],'raw':!![]})[_0xb809('0x50')](function(_0x718da6){_0x4e6721=_['keyBy'](_0x718da6,'id');var _0x4f397d={'type':db['Sequelize']['QueryTypes'][_0xb809('0x5d')],'model':db[_0xb809('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb809('0x5f')][_0xb809('0x60')](_0x4b8321[_0xb809('0x61')](),_0x4f397d);})['then'](function(_0x3c78d7){_0x3c78d7[_0xb809('0x25')](function(_0x2eabd4){if(_0x2eabd4[_0xb809('0x20')]){_0x2eabd4[_0xb809('0x62')]=[];_0x2eabd4[_0xb809('0x20')][_0xb809('0x27')](',')[_0xb809('0x25')](function(_0x200ed9){_0x2eabd4['Tags'][_0xb809('0x1f')](_0x4e6721[_0x200ed9]);});}delete _0x2eabd4[_0xb809('0x20')];});return _0x3c78d7;});}function countFilteredContacts(_0x14bd1f,_0x59f4a1){var _0x3b4ab3=_0x14bd1f['clone']();_0x3b4ab3[_0xb809('0x21')]('COUNT(*)');_0x3b4ab3=applyJoinClauses(_0x3b4ab3,!![]);_0x14bd1f[_0xb809('0x57')](_0xb809('0x55'));var _0x4b3ccb=utils[_0xb809('0x24')](_0x59f4a1);if(!_[_0xb809('0x63')](_0x4b3ccb)){_0x3b4ab3[_0xb809('0xd')]('t.id\x20IN\x20?',_0x4b3ccb);}var _0x31afaa={'type':db['Sequelize'][_0xb809('0x64')][_0xb809('0x5d')],'raw':!![]};return db[_0xb809('0x5f')]['query'](_0x3b4ab3[_0xb809('0x61')](),_0x31afaa)[_0xb809('0x50')](function(_0x5d708f){return _0x5d708f[0x0][_0xb809('0x65')];});}module[_0xb809('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x1e65=['\x20=\x20?','resolve','then','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','SELECT','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','subqry','firstName','lastName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','datetime','castTo','DATE','type','default','text','value','end','Tag','map','tags','clause','and','ids','user','skip','keys','name','compact','Contact','User','ListId','c.ListId\x20IN\x20?','concat','uc.UserId\x20=\x20?'];(function(_0x2d66ea,_0x14ae84){var _0x4a3f46=function(_0x144f7c){while(--_0x144f7c){_0x2d66ea['push'](_0x2d66ea['shift']());}};_0x4a3f46(++_0x14ae84);}(_0x1e65,0x174));var _0x51e6=function(_0x8bd93a,_0x94b27d){_0x8bd93a=_0x8bd93a-0x0;var _0xeef99e=_0x1e65[_0x8bd93a];return _0xeef99e;};'use strict';var _=require(_0x51e6('0x0'));var squel=require(_0x51e6('0x1'));var as=require(_0x51e6('0x2'));var qs=require(_0x51e6('0x3'));var utils=require(_0x51e6('0x4'));var db=require(_0x51e6('0x5'))['db'];function skipContactsQuery(_0x4943e6,_0x4702bf){var _0x5c36db=![];if(_0x4943e6[_0x51e6('0x6')]===_0x51e6('0x7')&&!_0x4702bf[_0x51e6('0x8')]&&!_0x4702bf['ListId']&&_0x4702bf[_0x51e6('0x9')]!==_0x51e6('0xa')){_0x5c36db=!![];}return _0x5c36db;}function getContactsSubquery(){return squel[_0x51e6('0xb')]()['from'](_0x51e6('0xc'),'c')[_0x51e6('0xd')](_0x51e6('0xe'));}function applyJoinClauses(_0x1aea55,_0x3c4d41){var _0x1f0935=_0x3c4d41?'c':'subqry';_0x1aea55[_0x51e6('0xf')]('cm_user_has_contacts','uc',_0x51e6('0x10')+_0x1f0935+_0x51e6('0x11'))[_0x51e6('0xf')](_0x51e6('0x12'),'ct',_0x51e6('0x13')+_0x1f0935+_0x51e6('0x11'))['left_join'](_0x51e6('0x14'),'t','t.id\x20=\x20ct.TagId');return _0x1aea55;}function addFieldsToQuery(_0x15ec2c,_0x17d85b,_0x36f9c1,_0x13254a,_0x176b85){var _0x19f664=_0x176b85?'c':_0x51e6('0x15');if(!_0x17d85b){_0x17d85b=['id',_0x51e6('0x16'),_0x51e6('0x17'),_0x51e6('0x18'),_0x51e6('0x19'),_0x51e6('0x1a'),_0x51e6('0x1b'),'ListId','CompanyId',_0x51e6('0x1c'),_0x51e6('0x1d'),_0x51e6('0x1e'),_0x51e6('0x1f')];}else if(!_0x17d85b['includes']('id')){_0x17d85b[_0x51e6('0x20')]('id');}var _0x4f8456=_0x36f9c1&&_0x176b85||!_0x36f9c1&&!_0x176b85;if(_0x13254a){_0x4f8456=_0x13254a&&_0x176b85||!_0x13254a&&!_0x176b85;}_0x17d85b[_0x51e6('0x21')](function(_0x2b5d87){if(_0x2b5d87===_0x51e6('0x1f')){if(_0x4f8456){_0x15ec2c[_0x51e6('0x22')](_0x51e6('0x23'),_0x2b5d87);}else if(_0x36f9c1||_0x13254a){_0x15ec2c[_0x51e6('0x22')](_0x19f664+'.'+_0x2b5d87);}}else{_0x15ec2c['field'](_0x19f664+'.'+_0x2b5d87);}});return _0x15ec2c;}function getSqlClauses(){var _0x462f85={'default':squel['expr'](),'fields':squel[_0x51e6('0x24')](),'filter':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x51e6('0x24')](),'skip':![]}};return _0x462f85;}function parseTagParameter(_0x2a3c29){var _0x572ec9=squel[_0x51e6('0x24')]();if(_0x2a3c29){var _0x21d98d=utils['getSelectedTags'](_0x2a3c29);_0x21d98d[_0x51e6('0x21')](function(_0x1ec18f){_0x572ec9['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ec18f+',%');});}return _0x572ec9;}function parseSearchFilter(_0x36a6a9){var _0x48f932=squel['expr']();if(_0x36a6a9){var _0x8dd52d=_0x36a6a9[_0x51e6('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x8dd52d[_0x51e6('0x26')]('\x20')[_0x51e6('0x27')]>0x1){_0x48f932['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x51e6('0x28')](_0x8dd52d,!![]),null);}else{if(qs[_0x51e6('0x29')](_0x8dd52d)){_0x48f932['or'](_0x51e6('0x2a'),_0x8dd52d+'%');_0x48f932['or'](_0x51e6('0x2b'),_0x8dd52d+'%');_0x48f932['or'](_0x51e6('0x2c'),_0x8dd52d+'%');_0x48f932['or'](_0x51e6('0x2d'),_0x8dd52d+'%');}else if(qs[_0x51e6('0x2e')](_0x8dd52d)){_0x48f932['or'](_0x51e6('0x2f'),_0x8dd52d+'%');}else{_0x48f932['or'](_0x51e6('0x30'),'%'+_0x8dd52d+'%');_0x48f932['or'](_0x51e6('0x31'),'%'+_0x8dd52d+'%');_0x48f932['or'](_0x51e6('0x2f'),'%'+_0x8dd52d+'%');}}}return _0x48f932;}function parseAdvancedSearchFilter(_0x5c9efc,_0x2176ba){var _0x510016=getSqlClauses();var _0x134798=as[_0x51e6('0x32')](_0x5c9efc);var _0x1fdd22=_0x134798[_0x51e6('0x33')];for(var _0x4b4e2e=0x0;_0x4b4e2e<_0x134798[_0x51e6('0x34')][_0x51e6('0x27')];_0x4b4e2e++){var _0x2c9775=_0x134798['conditions'][_0x4b4e2e];var _0x16babd='c';var _0xd3c1a5=_[_0x51e6('0x35')](_0x2176ba,['name',_0x2c9775[_0x51e6('0x22')]]);if(_0xd3c1a5){if(_0x2c9775['field']===_0x51e6('0x36')||_0xd3c1a5['fieldType']===_0x51e6('0x37')){_0x2c9775[_0x51e6('0x38')]=_0x51e6('0x39');}var _0x5e96ab=as['buildExpression'](_0x16babd,_0xd3c1a5[_0x51e6('0x3a')],_0x2c9775);_0x510016[_0x51e6('0x3b')][_0x1fdd22](_0x5e96ab[_0x51e6('0x3c')],_0x5e96ab[_0x51e6('0x3d')]['start'],_0x5e96ab['value'][_0x51e6('0x3e')]);}else{if(_0x2c9775[_0x51e6('0x22')]===_0x51e6('0x3f')){var _0x35d75a=_0x2c9775[_0x51e6('0x3d')]['split'](',')[_0x51e6('0x40')](function(_0x469ed6){return Number(_0x469ed6);});var _0x434afa=parseTagParameter(_0x35d75a);_0x510016[_0x51e6('0x41')][_0x51e6('0x42')][_0x51e6('0x43')](_0x434afa);_0x510016[_0x51e6('0x41')][_0x51e6('0x44')]=_0x35d75a;}else if(_0x2c9775[_0x51e6('0x22')]==='User'){_0x510016[_0x51e6('0x45')][_0x51e6('0x42')]['and']('uc.UserId\x20=\x20?',_0x2c9775[_0x51e6('0x3d')]);_0x510016[_0x51e6('0x45')][_0x51e6('0x46')]=!![];}}}return _0x510016;}function parseModelFields(_0x455665,_0x3c094b){var _0x27cb1d=squel[_0x51e6('0x24')]();var _0x911d8=_(_0x455665)[_0x51e6('0x47')]()[_0x51e6('0x40')](function(_0x49a963){return _['some'](_0x3c094b,[_0x51e6('0x48'),_0x49a963])?_0x49a963:undefined;})[_0x51e6('0x49')]()['value']();if(_0x455665[_0x51e6('0x4a')]){_0x911d8[_0x51e6('0x20')](_0x51e6('0x4a'));}if(_0x455665[_0x51e6('0x4b')]){_0x911d8['push'](_0x51e6('0x4b'));}if(_0x911d8['length']>0x0){_0x911d8[_0x51e6('0x21')](function(_0x478b21){if(_0x478b21===_0x51e6('0x4c')){_0x27cb1d[_0x51e6('0x43')](_0x51e6('0x4d'),[][_0x51e6('0x4e')](_0x455665[_0x478b21]));}else if(_0x478b21===_0x51e6('0x4a')){var _0x4613dc='%'+_0x455665[_0x478b21]+'%';_0x27cb1d[_0x51e6('0x43')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x4613dc);}else if(_0x478b21===_0x51e6('0x4b')){_0x27cb1d[_0x51e6('0x43')](_0x51e6('0x4f'),_0x455665[_0x478b21]);}else{_0x27cb1d[_0x51e6('0x43')]('c.'+_0x478b21+_0x51e6('0x50'),_0x455665[_0x478b21]);}});}return _0x27cb1d;}function parseQueryParameters(_0x2052ef,_0x15a435){var _0x2496a1=getSqlClauses();return Promise[_0x51e6('0x51')]()[_0x51e6('0x52')](function(){return parseModelFields(_0x2052ef,_0x15a435);})['then'](function(_0xbd3ac0){_0x2496a1['fields']['and'](_0xbd3ac0);return parseTagParameter(_0x2052ef[_0x51e6('0x53')]);})[_0x51e6('0x52')](function(_0x177431){_0x2496a1[_0x51e6('0x41')]['clause'][_0x51e6('0x43')](_0x177431);return parseSearchFilter(_0x2052ef[_0x51e6('0x54')]);})[_0x51e6('0x52')](function(_0x505b6b){_0x2496a1['filter']=_0x505b6b;return _0x2496a1;});}function checkListsRestrictions(_0x10e934,_0x7f2f2a,_0x19d01a){var _0x1db78b=squel['expr']();return Promise[_0x51e6('0x51')]()[_0x51e6('0x52')](function(){if(_0x7f2f2a[_0x51e6('0x8')]&&_0x10e934['role']===_0x51e6('0x7')&&!_0x19d01a){return _0x10e934[_0x51e6('0x55')]({'attributes':['id'],'raw':!![]});}})[_0x51e6('0x52')](function(_0x3fabc8){if(_0x3fabc8){if(_0x3fabc8[_0x51e6('0x27')]===0x0){_0x1db78b[_0x51e6('0x43')](_0x51e6('0x56'));}else{_0x1db78b[_0x51e6('0x43')]('c.ListId\x20IN\x20?',_[_0x51e6('0x40')](_0x3fabc8,'id'));}}})[_0x51e6('0x52')](function(){return _0x1db78b;});}function buildContactsQuery(_0x4979e5,_0x2e5870,_0x53fe18,_0x45397b,_0x4f937b,_0x3d2cf2){if(_0x2e5870){_0x2e5870=_0x53fe18[_0x51e6('0x57')];}_0x4979e5=addFieldsToQuery(_0x4979e5,_0x2e5870,_0x45397b,_0x3d2cf2,!![]);var _0xa5c8f5=squel[_0x51e6('0xb')]();_0xa5c8f5=addFieldsToQuery(_0xa5c8f5,_0x2e5870,_0x45397b,_0x3d2cf2,![]);if(_0x45397b||_0x3d2cf2){_0x4979e5=applyJoinClauses(_0x4979e5,!![]);_0x4979e5[_0x51e6('0x58')](_0x51e6('0x59'));if(_0x53fe18['limit']){_0xa5c8f5['limit'](_0x53fe18[_0x51e6('0x5a')]);}if(_0x53fe18[_0x51e6('0x5b')]){_0xa5c8f5[_0x51e6('0x5b')](_0x53fe18[_0x51e6('0x5b')]);}}else{_0xa5c8f5=applyJoinClauses(_0xa5c8f5,![]);_0xa5c8f5[_0x51e6('0x58')](_0x51e6('0x5c'));if(_0x53fe18[_0x51e6('0x5a')]){_0x4979e5['limit'](_0x53fe18[_0x51e6('0x5a')]);}if(_0x53fe18[_0x51e6('0x5b')]){_0x4979e5[_0x51e6('0x5b')](_0x53fe18['offset']);}}_0xa5c8f5[_0x51e6('0x5d')](_0x4f937b);if(_0x53fe18[_0x51e6('0x5e')]){_0x53fe18[_0x51e6('0x5e')]['forEach'](function(_0x4ee005){_0x4979e5[_0x51e6('0x5e')]('c.'+_0x4ee005[0x0],_0x4ee005[0x1]===_0x51e6('0x5f')?![]:!![]);_0xa5c8f5[_0x51e6('0x5e')](_0x51e6('0x60')+_0x4ee005[0x0],_0x4ee005[0x1]===_0x51e6('0x5f')?![]:!![]);});}_0xa5c8f5[_0x51e6('0x61')](_0x4979e5,_0x51e6('0x15'));return _0xa5c8f5;}function getFilteredContacts(_0x484e86){var _0x11f302=[];return db['Tag']['findAll']({'attributes':['id',_0x51e6('0x48'),_0x51e6('0x62')],'raw':!![]})[_0x51e6('0x52')](function(_0x2b1d62){_0x11f302=_[_0x51e6('0x63')](_0x2b1d62,'id');var _0x7086e={'type':db[_0x51e6('0x64')][_0x51e6('0x65')]['SELECT'],'model':db[_0x51e6('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x51e6('0x67')][_0x51e6('0x68')](_0x484e86[_0x51e6('0x69')](),_0x7086e);})[_0x51e6('0x52')](function(_0x1a861f){_0x1a861f['forEach'](function(_0x2c2564){if(_0x2c2564[_0x51e6('0x1f')]){_0x2c2564[_0x51e6('0x6a')]=[];_0x2c2564[_0x51e6('0x1f')]['split'](',')[_0x51e6('0x21')](function(_0x5211f2){_0x2c2564['Tags'][_0x51e6('0x20')](_0x11f302[_0x5211f2]);});}delete _0x2c2564['TagIds'];});return _0x1a861f;});}function countFilteredContacts(_0x1825da,_0x1708f9){var _0x1e11fe=_0x1825da[_0x51e6('0x6b')]();_0x1e11fe[_0x51e6('0x22')]('COUNT(*)');_0x1e11fe=applyJoinClauses(_0x1e11fe,!![]);_0x1825da[_0x51e6('0x58')](_0x51e6('0x59'));var _0x5db480=utils['getSelectedTags'](_0x1708f9);if(!_[_0x51e6('0x6c')](_0x5db480)){_0x1e11fe[_0x51e6('0xd')](_0x51e6('0x6d'),_0x5db480);}var _0x4c6405={'type':db[_0x51e6('0x64')][_0x51e6('0x65')][_0x51e6('0x6e')],'raw':!![]};return db[_0x51e6('0x67')]['query'](_0x1e11fe['toString'](),_0x4c6405)[_0x51e6('0x52')](function(_0x4475c8){return _0x4475c8[0x0][_0x51e6('0x6f')];});}module[_0x51e6('0x70')]={'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 ca0ffa8..58901b1 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 _0x0264=['aes-256-ctr','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','end','final','binary','write','close','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session'];(function(_0x2a2686,_0x49923b){var _0x4aff96=function(_0x10fc50){while(--_0x10fc50){_0x2a2686['push'](_0x2a2686['shift']());}};_0x4aff96(++_0x49923b);}(_0x0264,0x7d));var _0x4026=function(_0x53cf7f,_0x1121ca){_0x53cf7f=_0x53cf7f-0x0;var _0x299f5=_0x0264[_0x53cf7f];return _0x299f5;};'use strict';var crypto=require(_0x4026('0x0'));var fs=require('fs');var BPromise=require(_0x4026('0x1'));var _=require(_0x4026('0x2'));var config=require(_0x4026('0x3'));var logger=require(_0x4026('0x4'))(_0x4026('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x4026('0x6')],'algorithm':_0x4026('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x4026('0x8')]&&config[_0x4026('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x4026('0x8')][_0x4026('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x4026('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4026('0xa')](',\x20');logger['error'](config[_0x4026('0x8')][_0x4026('0x9')],_0x4026('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x367b70){return AES_SUPPORTED_RX['test'](_0x367b70);}function getSupportedCiphers(){return crypto[_0x4026('0xc')]()[_0x4026('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0xbfb809){return getSupportedCiphers()[_0x4026('0xe')](_0xbfb809)>-0x1;}function combineOptions(_0x39de76){var _0x1d6406={};for(var _0x4ff3e2 in fileOptions){if(fileOptions[_0x4026('0xf')](_0x4ff3e2)){_0x1d6406[_0x4ff3e2]=fileOptions[_0x4ff3e2];}}if(_0x39de76){for(var _0x30f9bb in _0x39de76){if(_0x39de76[_0x4026('0xf')](_0x30f9bb)){_0x1d6406[_0x30f9bb]=_0x39de76[_0x30f9bb];}}}return _0x1d6406;}exports['encryptFile']=function(_0x39c76d,_0x1d660c,_0x5c4b22,_0x1cc206){return new BPromise(function(_0x25b7e7,_0xcc32ff){_0x1cc206=combineOptions(_0x1cc206);var _0x4f42c7=new Buffer(_0x5c4b22);var _0x424417=fs[_0x4026('0x10')](_0x39c76d);var _0x26ddef=fs[_0x4026('0x11')](_0x1d660c);var _0x596d09=crypto[_0x4026('0x12')](_0x1cc206['algorithm'],_0x4f42c7);_0x424417['on'](_0x4026('0x13'),function(_0x305938){var _0x2ef30e=new Buffer(_0x596d09[_0x4026('0x14')](_0x305938),'binary');_0x26ddef['write'](_0x2ef30e);});_0x424417['on'](_0x4026('0x15'),function(){try{var _0xd819d1=new Buffer(_0x596d09[_0x4026('0x16')]('binary'),_0x4026('0x17'));_0x26ddef[_0x4026('0x18')](_0xd819d1);_0x26ddef['end']();_0x26ddef['on'](_0x4026('0x19'),function(){return _0x25b7e7(_0x1d660c);});}catch(_0x43d363){fs['unlink'](_0x1d660c);return _0xcc32ff(_0x43d363);}});});};exports[_0x4026('0x1a')]=function(_0x4e3463,_0x132661,_0x571082,_0x59839c){return new BPromise(function(_0x422fbd,_0x4cea00){_0x59839c=combineOptions(_0x59839c);var _0x16d8c3=new Buffer(_0x571082);var _0x36dc9c=fs['createReadStream'](_0x4e3463);var _0x32d036=fs['createWriteStream'](_0x132661);var _0x5ce456=crypto[_0x4026('0x1b')](_0x59839c[_0x4026('0x9')],_0x16d8c3);_0x36dc9c['on']('data',function(_0x4ec591){var _0x24a496=new Buffer(_0x5ce456['update'](_0x4ec591),_0x4026('0x17'));_0x32d036[_0x4026('0x18')](_0x24a496);});_0x36dc9c['on'](_0x4026('0x15'),function(){try{var _0x1ff942=new Buffer(_0x5ce456['final']('binary'),_0x4026('0x17'));_0x32d036['write'](_0x1ff942);_0x32d036[_0x4026('0x15')]();_0x32d036['on'](_0x4026('0x19'),function(){return _0x422fbd(_0x132661);});}catch(_0x27e655){fs['unlink'](_0x132661);return _0x4cea00(_0x27e655);}});});};exports[_0x4026('0x1c')]=function(_0x46df94,_0x106e8c,_0x5b42ff){var _0x31f753=_0x5b42ff||stringOptions[_0x4026('0x9')];var _0x278d1a=_0x106e8c||stringOptions[_0x4026('0x1d')];var _0x178f3d=crypto[_0x4026('0x12')](_0x31f753,_0x278d1a);var _0x38393f=_0x178f3d[_0x4026('0x14')](_0x46df94,_0x4026('0x1e'),_0x4026('0x1f'));_0x38393f+=_0x178f3d[_0x4026('0x16')](_0x4026('0x1f'));return _0x38393f;};exports[_0x4026('0x20')]=function(_0x3b2c21,_0x22e336,_0x5d012f){var _0x1a8925=_0x5d012f||stringOptions[_0x4026('0x9')];var _0x5dec7=_0x22e336||stringOptions[_0x4026('0x1d')];var _0x263834=crypto[_0x4026('0x1b')](_0x1a8925,_0x5dec7);var _0x2a57ae=_0x263834[_0x4026('0x14')](_0x3b2c21,_0x4026('0x1f'),_0x4026('0x1e'));_0x2a57ae+=_0x263834['final']('utf8');return _0x2a57ae;}; \ No newline at end of file +var _0xdadb=['write','final','binary','end','unlink','createReadStream','createDecipher','close','encryptString','secret','base64','utf8','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createWriteStream','data','update'];(function(_0x5dbb70,_0x44cc1e){var _0x3449a5=function(_0x396199){while(--_0x396199){_0x5dbb70['push'](_0x5dbb70['shift']());}};_0x3449a5(++_0x44cc1e);}(_0xdadb,0x69));var _0xbdad=function(_0x339854,_0x5cae3f){_0x339854=_0x339854-0x0;var _0x4b10aa=_0xdadb[_0x339854];return _0x4b10aa;};'use strict';var crypto=require(_0xbdad('0x0'));var fs=require('fs');var BPromise=require(_0xbdad('0x1'));var _=require(_0xbdad('0x2'));var config=require('../../config/environment');var logger=require(_0xbdad('0x3'))(_0xbdad('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbdad('0x5')][_0xbdad('0x6')],'algorithm':_0xbdad('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0xbdad('0x8')]&&config[_0xbdad('0x8')][_0xbdad('0x9')]){var isSupported=isAlgorithmSupported(config[_0xbdad('0x8')][_0xbdad('0x9')]);if(isSupported){fileOptions[_0xbdad('0x9')]=config[_0xbdad('0x8')][_0xbdad('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xbdad('0xa')](config[_0xbdad('0x8')][_0xbdad('0x9')],_0xbdad('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x49e25c){return AES_SUPPORTED_RX['test'](_0x49e25c);}function getSupportedCiphers(){return crypto[_0xbdad('0xc')]()[_0xbdad('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x5823bc){return getSupportedCiphers()['indexOf'](_0x5823bc)>-0x1;}function combineOptions(_0x10a055){var _0xc6c737={};for(var _0x262ea2 in fileOptions){if(fileOptions[_0xbdad('0xe')](_0x262ea2)){_0xc6c737[_0x262ea2]=fileOptions[_0x262ea2];}}if(_0x10a055){for(var _0x3d17ec in _0x10a055){if(_0x10a055[_0xbdad('0xe')](_0x3d17ec)){_0xc6c737[_0x3d17ec]=_0x10a055[_0x3d17ec];}}}return _0xc6c737;}exports[_0xbdad('0xf')]=function(_0x374956,_0x5da30f,_0x12cf42,_0x2c980d){return new BPromise(function(_0x43dc9,_0x10bd40){_0x2c980d=combineOptions(_0x2c980d);var _0x48582a=new Buffer(_0x12cf42);var _0x5c0d9f=fs['createReadStream'](_0x374956);var _0x21c872=fs[_0xbdad('0x10')](_0x5da30f);var _0x162044=crypto['createCipher'](_0x2c980d['algorithm'],_0x48582a);_0x5c0d9f['on'](_0xbdad('0x11'),function(_0x33d842){var _0x96f749=new Buffer(_0x162044[_0xbdad('0x12')](_0x33d842),'binary');_0x21c872[_0xbdad('0x13')](_0x96f749);});_0x5c0d9f['on']('end',function(){try{var _0x13f199=new Buffer(_0x162044[_0xbdad('0x14')]('binary'),_0xbdad('0x15'));_0x21c872['write'](_0x13f199);_0x21c872[_0xbdad('0x16')]();_0x21c872['on']('close',function(){return _0x43dc9(_0x5da30f);});}catch(_0x54f9a8){fs[_0xbdad('0x17')](_0x5da30f);return _0x10bd40(_0x54f9a8);}});});};exports['decryptFile']=function(_0x29b3d5,_0x30dfcf,_0x4021b0,_0x4e2ef9){return new BPromise(function(_0xe9f2f1,_0x22771e){_0x4e2ef9=combineOptions(_0x4e2ef9);var _0xda8436=new Buffer(_0x4021b0);var _0x1c204a=fs[_0xbdad('0x18')](_0x29b3d5);var _0x362892=fs['createWriteStream'](_0x30dfcf);var _0x4d9586=crypto[_0xbdad('0x19')](_0x4e2ef9[_0xbdad('0x9')],_0xda8436);_0x1c204a['on'](_0xbdad('0x11'),function(_0x552303){var _0x2097b1=new Buffer(_0x4d9586[_0xbdad('0x12')](_0x552303),'binary');_0x362892['write'](_0x2097b1);});_0x1c204a['on'](_0xbdad('0x16'),function(){try{var _0x17a191=new Buffer(_0x4d9586[_0xbdad('0x14')]('binary'),_0xbdad('0x15'));_0x362892[_0xbdad('0x13')](_0x17a191);_0x362892[_0xbdad('0x16')]();_0x362892['on'](_0xbdad('0x1a'),function(){return _0xe9f2f1(_0x30dfcf);});}catch(_0x416492){fs[_0xbdad('0x17')](_0x30dfcf);return _0x22771e(_0x416492);}});});};exports[_0xbdad('0x1b')]=function(_0x49276b,_0x2694e8,_0x27cc49){var _0x158bec=_0x27cc49||stringOptions[_0xbdad('0x9')];var _0x258efc=_0x2694e8||stringOptions[_0xbdad('0x1c')];var _0x17c1c6=crypto['createCipher'](_0x158bec,_0x258efc);var _0xebbd02=_0x17c1c6['update'](_0x49276b,'utf8','base64');_0xebbd02+=_0x17c1c6[_0xbdad('0x14')](_0xbdad('0x1d'));return _0xebbd02;};exports['decryptString']=function(_0x27c767,_0x3cfbae,_0x48e0a6){var _0x17efa6=_0x48e0a6||stringOptions[_0xbdad('0x9')];var _0x30f9f9=_0x3cfbae||stringOptions[_0xbdad('0x1c')];var _0x330df1=crypto[_0xbdad('0x19')](_0x17efa6,_0x30f9f9);var _0x32bdae=_0x330df1[_0xbdad('0x12')](_0x27c767,_0xbdad('0x1d'),_0xbdad('0x1e'));_0x32bdae+=_0x330df1[_0xbdad('0x14')](_0xbdad('0x1e'));return _0x32bdae;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ce312af..27734dd 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 _0xd11c=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','SELECT','num','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xd11c,0x86));var _0xcd11=function(_0x49e283,_0x1c8a0b){_0x49e283=_0x49e283-0x0;var _0x6d7b4e=_0xd11c[_0x49e283];return _0x6d7b4e;};'use strict';var util=require(_0xcd11('0x0'));var path=require(_0xcd11('0x1'));var _=require(_0xcd11('0x2'));var csv=require(_0xcd11('0x3'));var fs=require('fs');var BPromise=require(_0xcd11('0x4'));var zipdir=require(_0xcd11('0x5'));var rimraf=require(_0xcd11('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcd11('0x7')];var logger=require(_0xcd11('0x8'))(_0xcd11('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xcd11('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x59e4bd,_0x1811e6){var _0x459c06={'status':_0x59e4bd};var _0x3a99fd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1811e6){_0x459c06['savename']=_0x1811e6;}return db[_0xcd11('0xb')]['update'](_0x459c06,_0x3a99fd);}function main(){var _0x295851=0x1388;var _0x31d700;logger[_0xcd11('0xc')](util[_0xcd11('0xd')](_0xcd11('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xcd11('0xf')][_0xcd11('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcd11('0x11'),_0xcd11('0x12')]})[_0xcd11('0x13')](function(_0x1ddee3){if(_0x1ddee3){_0x31d700=_0x1ddee3;_0x295851=_0x31d700[_0xcd11('0x12')]||0x1388;}})[_0xcd11('0x13')](function(){return dbH[_0xcd11('0x14')]['query'](util[_0xcd11('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xcd11('0x14')]['QueryTypes'][_0xcd11('0x15')]});})[_0xcd11('0x13')](function(_0x4d6400){if(!_0x4d6400[0x0][_0xcd11('0x16')]){return analyticExtractedReport('Empty');}var _0x24a24c=[];var _0xa8d025=0x0;if(_0x31d700['split']){if(_0x4d6400&&_0x4d6400[_0xcd11('0x17')]){var _0x1549ce=_['range'](_0x4d6400[0x0][_0xcd11('0x16')]/_0x295851);var _0x4a6867=Number[_0xcd11('0x18')](_0x4d6400[0x0]['num']/_0x295851)?_0x4d6400[0x0]['num']%_0x295851:0x0;_0x1549ce[_0xcd11('0x19')](function(_0x22b48b){if(_0x22b48b>0x0){_0xa8d025+=_0x295851;}_0x24a24c['push'](dbH['sequelize'][_0xcd11('0x1a')](util[_0xcd11('0xd')](_0xcd11('0x1b'),QUERY,_0x295851,_0xa8d025),{'type':dbH[_0xcd11('0x14')]['QueryTypes'][_0xcd11('0x15')]}));});if(_0x4a6867>0x0){_0xa8d025+=_0x295851;_0x24a24c['push'](dbH[_0xcd11('0x14')]['query'](util[_0xcd11('0xd')](_0xcd11('0x1b'),QUERY,_0x4a6867,_0xa8d025),{'type':dbH[_0xcd11('0x14')][_0xcd11('0x1c')][_0xcd11('0x15')]}));}}}else{_0x24a24c[_0xcd11('0x1d')](dbH[_0xcd11('0x14')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xcd11('0x15')]}));}var _0x3068e8=path[_0xcd11('0x1e')](PATH);var _0x374bda=path[_0xcd11('0x1f')](PATH,_0xcd11('0x20'));var _0x24f5ff=_0x31d700[_0xcd11('0x11')]&&_0x24a24c[_0xcd11('0x17')]>0x1;var _0x1f998b=[];if(!fs[_0xcd11('0x21')](path[_0xcd11('0x22')](_0x3068e8,_0x374bda))&&_0x24f5ff){fs[_0xcd11('0x23')](path[_0xcd11('0x22')](_0x3068e8,_0x374bda));}return BPromise[_0xcd11('0x24')](_0x24a24c,function(_0x423830){_0x1f998b[_0xcd11('0x1d')](_0x423830);})['then'](function(){for(var _0x54a438=0x0;_0x54a438<_0x1f998b[_0xcd11('0x17')];_0x54a438+=0x1){var _0x524b9d;var _0x133586=_0x1f998b[_0x54a438];if(_0x24f5ff){_0x524b9d=path[_0xcd11('0x22')](_0x3068e8,_0x374bda,util['format'](_0xcd11('0x25'),_0x374bda,_0x54a438,_0xcd11('0x26')));}else{_0x524b9d=path[_0xcd11('0x22')](_0x3068e8,util[_0xcd11('0xd')](_0xcd11('0x27'),_0x374bda,'csv'));}fs['writeFileSync'](_0x524b9d,csv(_0x133586));}})[_0xcd11('0x13')](function(){if(_0x24f5ff){return new Promise(function(_0x580f41){zipdir(path[_0xcd11('0x22')](_0x3068e8,_0x374bda),{'saveTo':path[_0xcd11('0x22')](_0x3068e8,util[_0xcd11('0xd')](_0xcd11('0x27'),_0x374bda,_0xcd11('0x28')))},function(_0x2da2b1,_0x3c7d5a){rimraf(path[_0xcd11('0x22')](_0x3068e8,_0x374bda),function(){});_0x580f41('zip\x20finished');});});}})[_0xcd11('0x13')](function(){logger[_0xcd11('0xc')](util['format'](_0xcd11('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x24f5ff?util['format']('%s.%s',_0x374bda,_0x24f5ff?'zip':_0xcd11('0x26')):null);});})[_0xcd11('0x2a')](function(_0x51de0b){logger[_0xcd11('0xc')](util[_0xcd11('0xd')](_0xcd11('0x2b'),EXTRACTED_REPORT_ID,_0xcd11('0x2c')),util[_0xcd11('0x2d')](_0x51de0b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcd11('0x2e'));})[_0xcd11('0x2f')](function(){process[_0xcd11('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5e5d=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','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','util','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv'];(function(_0x3d965e,_0x5c0a9a){var _0x123d10=function(_0x2dceae){while(--_0x2dceae){_0x3d965e['push'](_0x3d965e['shift']());}};_0x123d10(++_0x5c0a9a);}(_0x5e5d,0xbf));var _0xd5e5=function(_0x4b4280,_0x9b86b1){_0x4b4280=_0x4b4280-0x0;var _0xbbb368=_0x5e5d[_0x4b4280];return _0xbbb368;};'use strict';var util=require(_0xd5e5('0x0'));var path=require('path');var _=require(_0xd5e5('0x1'));var csv=require(_0xd5e5('0x2'));var fs=require('fs');var BPromise=require(_0xd5e5('0x3'));var zipdir=require(_0xd5e5('0x4'));var rimraf=require('rimraf');var db=require(_0xd5e5('0x5'))['db'];var dbH=require(_0xd5e5('0x5'))[_0xd5e5('0x6')];var logger=require(_0xd5e5('0x7'))(_0xd5e5('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd5e5('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x37dff4,_0x26c076){var _0x10f230={'status':_0x37dff4};var _0x29a585={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26c076){_0x10f230['savename']=_0x26c076;}return db[_0xd5e5('0xa')][_0xd5e5('0xb')](_0x10f230,_0x29a585);}function main(){var _0x4d59d4=0x1388;var _0x58e016;logger['info'](util[_0xd5e5('0xc')](_0xd5e5('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xd5e5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd5e5('0xf'),_0xd5e5('0x10')]})[_0xd5e5('0x11')](function(_0x16fe37){if(_0x16fe37){_0x58e016=_0x16fe37;_0x4d59d4=_0x58e016['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xd5e5('0x12')][_0xd5e5('0x13')](util[_0xd5e5('0xc')](_0xd5e5('0x14'),QUERY),{'type':dbH[_0xd5e5('0x12')][_0xd5e5('0x15')][_0xd5e5('0x16')]});})[_0xd5e5('0x11')](function(_0x2061a2){if(!_0x2061a2[0x0][_0xd5e5('0x17')]){return analyticExtractedReport(_0xd5e5('0x18'));}var _0x155440=[];var _0x49852f=0x0;if(_0x58e016[_0xd5e5('0xf')]){if(_0x2061a2&&_0x2061a2[_0xd5e5('0x19')]){var _0x513f03=_[_0xd5e5('0x1a')](_0x2061a2[0x0]['num']/_0x4d59d4);var _0x17f8dc=Number[_0xd5e5('0x1b')](_0x2061a2[0x0][_0xd5e5('0x17')]/_0x4d59d4)?_0x2061a2[0x0][_0xd5e5('0x17')]%_0x4d59d4:0x0;_0x513f03[_0xd5e5('0x1c')](function(_0x1c9080){if(_0x1c9080>0x0){_0x49852f+=_0x4d59d4;}_0x155440[_0xd5e5('0x1d')](dbH[_0xd5e5('0x12')][_0xd5e5('0x13')](util[_0xd5e5('0xc')](_0xd5e5('0x1e'),QUERY,_0x4d59d4,_0x49852f),{'type':dbH[_0xd5e5('0x12')]['QueryTypes'][_0xd5e5('0x16')]}));});if(_0x17f8dc>0x0){_0x49852f+=_0x4d59d4;_0x155440['push'](dbH[_0xd5e5('0x12')]['query'](util[_0xd5e5('0xc')](_0xd5e5('0x1e'),QUERY,_0x17f8dc,_0x49852f),{'type':dbH[_0xd5e5('0x12')][_0xd5e5('0x15')][_0xd5e5('0x16')]}));}}}else{_0x155440[_0xd5e5('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0xd5e5('0x15')][_0xd5e5('0x16')]}));}var _0x46bfb7=path[_0xd5e5('0x1f')](PATH);var _0x35e111=path[_0xd5e5('0x20')](PATH,_0xd5e5('0x21'));var _0xdd1588=_0x58e016[_0xd5e5('0xf')]&&_0x155440[_0xd5e5('0x19')]>0x1;var _0x2aa649=[];if(!fs[_0xd5e5('0x22')](path[_0xd5e5('0x23')](_0x46bfb7,_0x35e111))&&_0xdd1588){fs[_0xd5e5('0x24')](path[_0xd5e5('0x23')](_0x46bfb7,_0x35e111));}return BPromise['each'](_0x155440,function(_0x5b45f9){_0x2aa649[_0xd5e5('0x1d')](_0x5b45f9);})['then'](function(){for(var _0x573575=0x0;_0x573575<_0x2aa649[_0xd5e5('0x19')];_0x573575+=0x1){var _0x1b4da2;var _0x1e6b74=_0x2aa649[_0x573575];if(_0xdd1588){_0x1b4da2=path[_0xd5e5('0x23')](_0x46bfb7,_0x35e111,util[_0xd5e5('0xc')](_0xd5e5('0x25'),_0x35e111,_0x573575,_0xd5e5('0x26')));}else{_0x1b4da2=path[_0xd5e5('0x23')](_0x46bfb7,util[_0xd5e5('0xc')](_0xd5e5('0x27'),_0x35e111,'csv'));}fs[_0xd5e5('0x28')](_0x1b4da2,csv(_0x1e6b74));}})[_0xd5e5('0x11')](function(){if(_0xdd1588){return new Promise(function(_0x23727f){zipdir(path[_0xd5e5('0x23')](_0x46bfb7,_0x35e111),{'saveTo':path[_0xd5e5('0x23')](_0x46bfb7,util['format'](_0xd5e5('0x27'),_0x35e111,_0xd5e5('0x29')))},function(_0x48f397,_0x3b1371){rimraf(path[_0xd5e5('0x23')](_0x46bfb7,_0x35e111),function(){});_0x23727f(_0xd5e5('0x2a'));});});}})[_0xd5e5('0x11')](function(){logger[_0xd5e5('0x2b')](util[_0xd5e5('0xc')](_0xd5e5('0x2c'),EXTRACTED_REPORT_ID,_0xd5e5('0x2d')));return analyticExtractedReport(_0xd5e5('0x2e'),_0xdd1588?util[_0xd5e5('0xc')](_0xd5e5('0x27'),_0x35e111,_0xdd1588?_0xd5e5('0x29'):_0xd5e5('0x26')):null);});})[_0xd5e5('0x2f')](function(_0x314d50){logger['info'](util[_0xd5e5('0xc')](_0xd5e5('0x30'),EXTRACTED_REPORT_ID,_0xd5e5('0x2d')),util[_0xd5e5('0x31')](_0x314d50,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd5e5('0x32'));})[_0xd5e5('0x33')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7897149..d7a5b06 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 _0x36bb=['zip-dir','rimraf','jsdom','bluebird','../../mysqldb','dbH','argv','savename','update','map','tableHeader','pick','fill','length','auto','body','push','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','.pdf','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT','catch','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','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','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer'];(function(_0x5665f0,_0x5708f1){var _0x13d0d2=function(_0x231d3f){while(--_0x231d3f){_0x5665f0['push'](_0x5665f0['shift']());}};_0x13d0d2(++_0x5708f1);}(_0x36bb,0x102));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb36b('0x0'));var fs=require('fs');var util=require(_0xb36b('0x1'));var path=require(_0xb36b('0x2'));var moment=require(_0xb36b('0x3'));var htmlToPdfmake=require(_0xb36b('0x4'));var PdfPrinter=require(_0xb36b('0x5'));var zipdir=require(_0xb36b('0x6'));var rimraf=require(_0xb36b('0x7'));var JSDOM=require(_0xb36b('0x8'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0xb36b('0x9'));var db=require(_0xb36b('0xa'))['db'];var dbH=require('../../mysqldb')[_0xb36b('0xb')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb36b('0xc')][0x2]);var QUERY=process[_0xb36b('0xc')][0x3];var PATH=process[_0xb36b('0xc')][0x4];var NAME=process[_0xb36b('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x50072e,_0x341904){var _0x53dda1={'status':_0x50072e};var _0x26fc2f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x341904){_0x53dda1[_0xb36b('0xd')]=_0x341904;}return db['AnalyticExtractedReport'][_0xb36b('0xe')](_0x53dda1,_0x26fc2f);}function getHeaders(_0x51e344){return _[_0xb36b('0xf')](_0x51e344,function(_0x4d1177){return{'text':_0x4d1177,'style':_0xb36b('0x10')};});}function getRows(_0x3e06e4,_0x3027c6){return _[_0xb36b('0xf')](_0x3027c6,function(_0x39bcb2){return _(_0x39bcb2)[_0xb36b('0x11')](_0x3e06e4)[_0xb36b('0xf')](function(_0x2ff22c){return _0x2ff22c?_['toString'](_0x2ff22c):'';})['value']();});}function createTable(_0x55b97c,_0x55fdbd){var _0x36d302={'widths':_[_0xb36b('0x12')](Array(_0x55b97c[_0xb36b('0x13')]),0x91),'heights':function(_0x11b72e){return _0x11b72e===0x0?_0xb36b('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x34b471=getHeaders(_0x55b97c);_0x36d302[_0xb36b('0x15')][_0xb36b('0x16')](_0x34b471);var _0x3ca5c2=getRows(_0x55b97c,_0x55fdbd);_0x36d302[_0xb36b('0x15')]=_0x36d302[_0xb36b('0x15')][_0xb36b('0x17')](_0x3ca5c2);return _0x36d302;}function createTables(_0x5d0b8d){var _0x3b758a=[];var _0x5e025b=_[_0xb36b('0x18')](Object['keys'](_0x5d0b8d[0x0]),0x5);_0x5e025b['forEach'](function(_0x35cf7b){_0x3b758a['push'](createTable(_0x35cf7b,_0x5d0b8d));});return _0x3b758a;}function getPDFDocDefinition(_0x11fd73){var _0x47bf64=util[_0xb36b('0x19')](_0xb36b('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xb36b('0x1b')])[_0xb36b('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xb36b('0x1c')])['format'](FORMAT));var _0x38e3be=[];for(var _0x3cf1af=0x0;_0x3cf1af<_0x11fd73[_0xb36b('0x13')];_0x3cf1af++){var _0x25b06d=[];if(_0x3cf1af===0x0){_0x25b06d[_0xb36b('0x16')]({'text':_0x47bf64,'style':_0xb36b('0x1d')});}var _0x3283fc={'table':_0x11fd73[_0x3cf1af]};if(_0x3cf1af>0x0){_0x3283fc[_0xb36b('0x1e')]=_0xb36b('0x1f');_0x3283fc[_0xb36b('0x20')]=[0x0,0x46,0x0,0x0];}_0x25b06d['push'](_0x3283fc);_0x38e3be[_0xb36b('0x16')](_0x25b06d);}return{'pageSize':'A4','pageOrientation':_0xb36b('0x21'),'content':_0x38e3be,'footer':function(_0x5f52f9,_0x3d9482){return{'text':_0x5f52f9['toString']()+_0xb36b('0x22')+_0x3d9482,'style':_0xb36b('0x23')};},'defaultStyle':{'font':_0xb36b('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb36b('0x25')},'footer':{'alignment':_0xb36b('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x574eb3){var _0x20b374=0x1388;var _0x4a5fed;if(!_0x574eb3[0x0][_0xb36b('0x27')]){return analyticExtractedReport(_0xb36b('0x28'));}return db[_0xb36b('0x29')][_0xb36b('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb36b('0x2b'),_0xb36b('0x2c')]})[_0xb36b('0x2d')](function(_0x203a73){if(_0x203a73){_0x4a5fed=_0x203a73;_0x20b374=_0x4a5fed[_0xb36b('0x2c')]||0x3e8;}})[_0xb36b('0x2d')](function(){var _0x10243f=[];var _0x383e58=0x0;if(_0x4a5fed[_0xb36b('0x2b')]){if(_0x574eb3&&_0x574eb3['length']){var _0x36156a=_['range'](_0x574eb3[0x0][_0xb36b('0x27')]/_0x20b374);var _0x5452cc=Number[_0xb36b('0x2e')](_0x574eb3[0x0]['num']/_0x20b374)?_0x574eb3[0x0][_0xb36b('0x27')]%_0x20b374:0x0;_0x36156a[_0xb36b('0x2f')](function(_0x482cf4){if(_0x482cf4>0x0){_0x383e58+=_0x20b374;}_0x10243f['push'](dbH[_0xb36b('0x30')][_0xb36b('0x31')](util['format'](_0xb36b('0x32'),QUERY,_0x20b374,_0x383e58),{'type':dbH[_0xb36b('0x30')][_0xb36b('0x33')]['SELECT']}));});if(_0x5452cc>0x0){_0x383e58+=_0x20b374;_0x10243f[_0xb36b('0x16')](dbH['sequelize'][_0xb36b('0x31')](util[_0xb36b('0x19')](_0xb36b('0x32'),QUERY,_0x5452cc,_0x383e58),{'type':dbH[_0xb36b('0x30')][_0xb36b('0x33')]['SELECT']}));}}}else{_0x10243f[_0xb36b('0x16')](dbH[_0xb36b('0x30')][_0xb36b('0x31')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x950cb6=path['dirname'](PATH);var _0x20c5e2=path['basename'](PATH,_0xb36b('0x34'));var _0x59076c=_0x4a5fed[_0xb36b('0x2b')]&&_0x10243f[_0xb36b('0x13')]>0x1;var _0x1539c9=[];if(!fs['existsSync'](path[_0xb36b('0x35')](_0x950cb6,_0x20c5e2))&&_0x59076c){fs[_0xb36b('0x36')](path[_0xb36b('0x35')](_0x950cb6,_0x20c5e2));}return BPromise[_0xb36b('0x37')](_0x10243f,function(_0x126a98){_0x1539c9[_0xb36b('0x16')](_0x126a98);})['then'](function(){var _0x2c8166=[];for(var _0x27803c=0x0;_0x27803c<_0x1539c9[_0xb36b('0x13')];_0x27803c+=0x1){var _0x348905=_0x1539c9[_0x27803c];var _0x3d3c0c=createTables(_[_0xb36b('0x38')](_0x348905));var _0x255378;var _0x1a9568=getPDFDocDefinition(_0x3d3c0c);var _0x892afc=getPDFPrinter();var _0x4bf372=_0x892afc['createPdfKitDocument'](_0x1a9568);if(_0x59076c){_0x255378=path['join'](_0x950cb6,_0x20c5e2,util[_0xb36b('0x19')](_0xb36b('0x39'),_0x20c5e2,_0x27803c,_0xb36b('0x3a')));}else{_0x255378=path[_0xb36b('0x35')](_0x950cb6,util[_0xb36b('0x19')](_0xb36b('0x3b'),_0x20c5e2,_0xb36b('0x3a')));}_0x2c8166['push'](writePDFDocument(_0x4bf372,_0x255378));}return Promise[_0xb36b('0x3c')](_0x2c8166);})[_0xb36b('0x2d')](function(){if(_0x59076c){return new Promise(function(_0x65d3b3){zipdir(path['join'](_0x950cb6,_0x20c5e2),{'saveTo':path[_0xb36b('0x35')](_0x950cb6,util[_0xb36b('0x19')](_0xb36b('0x3b'),_0x20c5e2,'zip'))},function(){rimraf(path['join'](_0x950cb6,_0x20c5e2),function(){});_0x65d3b3(_0xb36b('0x3d'));});});}})[_0xb36b('0x2d')](function(){if(!_0x59076c)return;rimraf(path['join'](_0x950cb6,_0x20c5e2),function(){});})['then'](function(){logger[_0xb36b('0x3e')](util[_0xb36b('0x19')](_0xb36b('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xb36b('0x40'),_0x59076c?util['format'](_0xb36b('0x3b'),_0x20c5e2,_0x59076c?_0xb36b('0x41'):_0xb36b('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb36b('0x3e')](util['format'](_0xb36b('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xb36b('0x43')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb36b('0x2d')](function(_0x156705){EXTRACTED_REPORT=_0x156705;return dbH[_0xb36b('0x30')][_0xb36b('0x31')](util[_0xb36b('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb36b('0x30')][_0xb36b('0x33')][_0xb36b('0x44')]});})[_0xb36b('0x2d')](extractReport)[_0xb36b('0x45')](function(_0x5a7faf){logger['info'](util[_0xb36b('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb36b('0x46')),util[_0xb36b('0x47')](_0x5a7faf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb36b('0x48'));})[_0xb36b('0x49')](function(){process[_0xb36b('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x55ec67=new PdfPrinter({'Arial':{'normal':__dirname+_0xb36b('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xb36b('0x4c')}});return _0x55ec67;}function getPDFDocDefinitionFromHTML(_0x14885c,_0x2e4574){var _0x56d703=util['format'](_0xb36b('0x4d'),_0x2e4574['channel'],_0x2e4574[_0xb36b('0x4e')]);var _0x317c5a=moment()['format'](_0xb36b('0x4f'))['toString']();var _0x1b6bf5=htmlToPdfmake(_0x14885c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1b6bf5],'defaultStyle':{'font':_0xb36b('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb36b('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb36b('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb36b('0x50')}},'header':function(){return[{'text':_0xb36b('0x51'),'style':_0xb36b('0x1d')}];},'footer':function(_0xa99276,_0x3bd131){return[{'text':util[_0xb36b('0x19')](_0xb36b('0x52'),_0x56d703,_0xa99276,_0x3bd131,_0x317c5a),'style':'footer'}];}};}function writePDFDocument(_0x3f7de1,_0x12ad2b){return new Promise(function(_0xe7078a,_0x4e89fb){var _0x12439c=_0x3f7de1[_0xb36b('0x53')](fs[_0xb36b('0x54')](_0x12ad2b));_0x12439c['on']('finish',function(){_0xe7078a(_0xb36b('0x55'));});_0x12439c['on'](_0xb36b('0x56'),function(_0x5a0a78){_0x4e89fb(_0x5a0a78);});_0x3f7de1['end']();});}exports[_0xb36b('0x57')]=function(_0x388a1a,_0x31fea7){var _0x3b098e=getPDFPrinter();var _0x16edb7=getPDFDocDefinitionFromHTML(_0x388a1a,_0x31fea7);var _0x5db552=_0x3b098e['createPdfKitDocument'](_0x16edb7);return writePDFDocument(_0x5db552,_0x31fea7['path'])[_0xb36b('0x45')](function(_0x3d53f4){throw _0x3d53f4;});}; \ No newline at end of file +var _0xd3c4=['pick','value','length','body','push','concat','chunk','keys','format','name','endDate','header','pageBreak','before','margin','toString','\x20/\x20','footer','Arial','right','Empty','Setting','split','splitSizePdf','then','range','num','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','path','catch','lodash','util','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader'];(function(_0x2e8bcd,_0x20af7f){var _0x44a762=function(_0x3dd4e3){while(--_0x3dd4e3){_0x2e8bcd['push'](_0x2e8bcd['shift']());}};_0x44a762(++_0x20af7f);}(_0xd3c4,0x107));var _0x4d3c=function(_0x4cb015,_0x35509c){_0x4cb015=_0x4cb015-0x0;var _0x30ad7f=_0xd3c4[_0x4cb015];return _0x30ad7f;};'use strict';var _=require(_0x4d3c('0x0'));var fs=require('fs');var util=require(_0x4d3c('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x4d3c('0x2'));var zipdir=require(_0x4d3c('0x3'));var rimraf=require(_0x4d3c('0x4'));var JSDOM=require(_0x4d3c('0x5'))[_0x4d3c('0x6')];var window=new JSDOM('')[_0x4d3c('0x7')];var BPromise=require(_0x4d3c('0x8'));var db=require(_0x4d3c('0x9'))['db'];var dbH=require('../../mysqldb')[_0x4d3c('0xa')];var logger=require('../../config/logger')(_0x4d3c('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x4d3c('0xc')][0x2]);var QUERY=process[_0x4d3c('0xc')][0x3];var PATH=process[_0x4d3c('0xc')][0x4];var NAME=process[_0x4d3c('0xc')][0x5];var FORMAT=_0x4d3c('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x21f56f,_0x3a1db8){var _0x170360={'status':_0x21f56f};var _0x12d691={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a1db8){_0x170360[_0x4d3c('0xe')]=_0x3a1db8;}return db[_0x4d3c('0xf')][_0x4d3c('0x10')](_0x170360,_0x12d691);}function getHeaders(_0x381449){return _[_0x4d3c('0x11')](_0x381449,function(_0x232d87){return{'text':_0x232d87,'style':_0x4d3c('0x12')};});}function getRows(_0x2b5a1a,_0x134e91){return _[_0x4d3c('0x11')](_0x134e91,function(_0x2ac36f){return _(_0x2ac36f)[_0x4d3c('0x13')](_0x2b5a1a)['map'](function(_0x3461d8){return _0x3461d8?_['toString'](_0x3461d8):'';})[_0x4d3c('0x14')]();});}function createTable(_0x18e9ce,_0x3dccc3){var _0x20ff6e={'widths':_['fill'](Array(_0x18e9ce[_0x4d3c('0x15')]),0x91),'heights':function(_0x74ded5){return _0x74ded5===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x45f01e=getHeaders(_0x18e9ce);_0x20ff6e[_0x4d3c('0x16')][_0x4d3c('0x17')](_0x45f01e);var _0x2b727d=getRows(_0x18e9ce,_0x3dccc3);_0x20ff6e[_0x4d3c('0x16')]=_0x20ff6e['body'][_0x4d3c('0x18')](_0x2b727d);return _0x20ff6e;}function createTables(_0x269dd8){var _0x2a4a06=[];var _0x5f5c9a=_[_0x4d3c('0x19')](Object[_0x4d3c('0x1a')](_0x269dd8[0x0]),0x5);_0x5f5c9a['forEach'](function(_0xe33749){_0x2a4a06[_0x4d3c('0x17')](createTable(_0xe33749,_0x269dd8));});return _0x2a4a06;}function getPDFDocDefinition(_0x5409bb){var _0x13937e=util[_0x4d3c('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x4d3c('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x4d3c('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x4d3c('0x1d')])['format'](FORMAT));var _0x577818=[];for(var _0x4760e9=0x0;_0x4760e9<_0x5409bb['length'];_0x4760e9++){var _0x543f39=[];if(_0x4760e9===0x0){_0x543f39['push']({'text':_0x13937e,'style':_0x4d3c('0x1e')});}var _0x5d3296={'table':_0x5409bb[_0x4760e9]};if(_0x4760e9>0x0){_0x5d3296[_0x4d3c('0x1f')]=_0x4d3c('0x20');_0x5d3296[_0x4d3c('0x21')]=[0x0,0x46,0x0,0x0];}_0x543f39[_0x4d3c('0x17')](_0x5d3296);_0x577818[_0x4d3c('0x17')](_0x543f39);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x577818,'footer':function(_0x3fdc57,_0x2359b1){return{'text':_0x3fdc57[_0x4d3c('0x22')]()+_0x4d3c('0x23')+_0x2359b1,'style':_0x4d3c('0x24')};},'defaultStyle':{'font':_0x4d3c('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x4d3c('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5b6629){var _0x26232c=0x1388;var _0x42879c;if(!_0x5b6629[0x0]['num']){return analyticExtractedReport(_0x4d3c('0x27'));}return db[_0x4d3c('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4d3c('0x29'),_0x4d3c('0x2a')]})['then'](function(_0x5b73a6){if(_0x5b73a6){_0x42879c=_0x5b73a6;_0x26232c=_0x42879c[_0x4d3c('0x2a')]||0x3e8;}})[_0x4d3c('0x2b')](function(){var _0x378697=[];var _0x3a272c=0x0;if(_0x42879c[_0x4d3c('0x29')]){if(_0x5b6629&&_0x5b6629[_0x4d3c('0x15')]){var _0x560813=_[_0x4d3c('0x2c')](_0x5b6629[0x0][_0x4d3c('0x2d')]/_0x26232c);var _0x37d47b=Number['isInteger'](_0x5b6629[0x0]['num']/_0x26232c)?_0x5b6629[0x0]['num']%_0x26232c:0x0;_0x560813[_0x4d3c('0x2e')](function(_0x779551){if(_0x779551>0x0){_0x3a272c+=_0x26232c;}_0x378697['push'](dbH[_0x4d3c('0x2f')]['query'](util[_0x4d3c('0x1b')](_0x4d3c('0x30'),QUERY,_0x26232c,_0x3a272c),{'type':dbH[_0x4d3c('0x2f')][_0x4d3c('0x31')]['SELECT']}));});if(_0x37d47b>0x0){_0x3a272c+=_0x26232c;_0x378697[_0x4d3c('0x17')](dbH['sequelize'][_0x4d3c('0x32')](util[_0x4d3c('0x1b')](_0x4d3c('0x30'),QUERY,_0x37d47b,_0x3a272c),{'type':dbH[_0x4d3c('0x2f')]['QueryTypes']['SELECT']}));}}}else{_0x378697[_0x4d3c('0x17')](dbH[_0x4d3c('0x2f')][_0x4d3c('0x32')](QUERY,{'type':dbH[_0x4d3c('0x2f')][_0x4d3c('0x31')][_0x4d3c('0x33')]}));}var _0x5680f0=path[_0x4d3c('0x34')](PATH);var _0x1aace2=path[_0x4d3c('0x35')](PATH,_0x4d3c('0x36'));var _0x55dc49=_0x42879c[_0x4d3c('0x29')]&&_0x378697[_0x4d3c('0x15')]>0x1;var _0x1c1374=[];if(!fs[_0x4d3c('0x37')](path[_0x4d3c('0x38')](_0x5680f0,_0x1aace2))&&_0x55dc49){fs[_0x4d3c('0x39')](path['join'](_0x5680f0,_0x1aace2));}return BPromise[_0x4d3c('0x3a')](_0x378697,function(_0x4fe5c7){_0x1c1374[_0x4d3c('0x17')](_0x4fe5c7);})[_0x4d3c('0x2b')](function(){var _0x47becd=[];for(var _0xf797f6=0x0;_0xf797f6<_0x1c1374[_0x4d3c('0x15')];_0xf797f6+=0x1){var _0x1fd137=_0x1c1374[_0xf797f6];var _0x4aba47=createTables(_['flatten'](_0x1fd137));var _0x295fad;var _0xb1592b=getPDFDocDefinition(_0x4aba47);var _0x126bbf=getPDFPrinter();var _0x277f20=_0x126bbf[_0x4d3c('0x3b')](_0xb1592b);if(_0x55dc49){_0x295fad=path[_0x4d3c('0x38')](_0x5680f0,_0x1aace2,util[_0x4d3c('0x1b')](_0x4d3c('0x3c'),_0x1aace2,_0xf797f6,_0x4d3c('0x3d')));}else{_0x295fad=path[_0x4d3c('0x38')](_0x5680f0,util['format'](_0x4d3c('0x3e'),_0x1aace2,_0x4d3c('0x3d')));}_0x47becd['push'](writePDFDocument(_0x277f20,_0x295fad));}return Promise[_0x4d3c('0x3f')](_0x47becd);})[_0x4d3c('0x2b')](function(){if(_0x55dc49){return new Promise(function(_0x4d1c5b){zipdir(path['join'](_0x5680f0,_0x1aace2),{'saveTo':path['join'](_0x5680f0,util[_0x4d3c('0x1b')](_0x4d3c('0x3e'),_0x1aace2,_0x4d3c('0x40')))},function(){rimraf(path[_0x4d3c('0x38')](_0x5680f0,_0x1aace2),function(){});_0x4d1c5b(_0x4d3c('0x41'));});});}})[_0x4d3c('0x2b')](function(){if(!_0x55dc49)return;rimraf(path[_0x4d3c('0x38')](_0x5680f0,_0x1aace2),function(){});})[_0x4d3c('0x2b')](function(){logger[_0x4d3c('0x42')](util[_0x4d3c('0x1b')](_0x4d3c('0x43'),EXTRACTED_REPORT_ID,_0x4d3c('0x44')));return analyticExtractedReport(_0x4d3c('0x45'),_0x55dc49?util['format'](_0x4d3c('0x3e'),_0x1aace2,_0x55dc49?_0x4d3c('0x40'):_0x4d3c('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x4d3c('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x4d3c('0xf')][_0x4d3c('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4d3c('0x2b')](function(_0x5b5593){EXTRACTED_REPORT=_0x5b5593;return dbH[_0x4d3c('0x2f')][_0x4d3c('0x32')](util[_0x4d3c('0x1b')](_0x4d3c('0x47'),QUERY),{'type':dbH[_0x4d3c('0x2f')][_0x4d3c('0x31')][_0x4d3c('0x33')]});})['then'](extractReport)['catch'](function(_0xc08663){logger[_0x4d3c('0x42')](util['format'](_0x4d3c('0x48'),EXTRACTED_REPORT_ID,_0x4d3c('0x44')),util[_0x4d3c('0x49')](_0xc08663,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4d3c('0x4a')](function(){process[_0x4d3c('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x579a96=new PdfPrinter({'Arial':{'normal':__dirname+_0x4d3c('0x4c'),'bold':__dirname+_0x4d3c('0x4d'),'italics':__dirname+_0x4d3c('0x4e'),'bolditalics':__dirname+_0x4d3c('0x4f')}});return _0x579a96;}function getPDFDocDefinitionFromHTML(_0x1b67ed,_0x15c00d){var _0x59a82b=util[_0x4d3c('0x1b')](_0x4d3c('0x50'),_0x15c00d[_0x4d3c('0x51')],_0x15c00d[_0x4d3c('0x52')]);var _0x39b269=moment()[_0x4d3c('0x1b')](_0x4d3c('0x53'))[_0x4d3c('0x22')]();var _0x337261=htmlToPdfmake(_0x1b67ed,{'window':window,'tableAutoSize':!![]});return{'content':[_0x337261],'defaultStyle':{'font':_0x4d3c('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4d3c('0x54'),'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':_0x4d3c('0x54')}},'header':function(){return[{'text':_0x4d3c('0x55'),'style':'header'}];},'footer':function(_0x513ad8,_0x2ab4b0){return[{'text':util[_0x4d3c('0x1b')](_0x4d3c('0x56'),_0x59a82b,_0x513ad8,_0x2ab4b0,_0x39b269),'style':_0x4d3c('0x24')}];}};}function writePDFDocument(_0x27a65f,_0x2bb22c){return new Promise(function(_0x3b1458,_0x142116){var _0x4496ca=_0x27a65f['pipe'](fs[_0x4d3c('0x57')](_0x2bb22c));_0x4496ca['on'](_0x4d3c('0x58'),function(){_0x3b1458(_0x4d3c('0x58'));});_0x4496ca['on'](_0x4d3c('0x59'),function(_0xc4d99d){_0x142116(_0xc4d99d);});_0x27a65f[_0x4d3c('0x5a')]();});}exports[_0x4d3c('0x5b')]=function(_0x3f5b36,_0x45a082){var _0x5bf116=getPDFPrinter();var _0x43a7f4=getPDFDocDefinitionFromHTML(_0x3f5b36,_0x45a082);var _0x1c6662=_0x5bf116['createPdfKitDocument'](_0x43a7f4);return writePDFDocument(_0x1c6662,_0x45a082[_0x4d3c('0x5c')])[_0x4d3c('0x5d')](function(_0x482005){throw _0x482005;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 822edab..a0d2b23 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 _0x4034=['json2xls','zip-dir','../../mysqldb','../../config/logger','argv','update','info','format','XLSX','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','split','range','isInteger','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','each','%s%d.%s','xlsx','join','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','inspect','Failed','finally','exit','path','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4034,0x166));var _0x4403=function(_0x42d0ed,_0x91a115){_0x42d0ed=_0x42d0ed-0x0;var _0x3f63f6=_0x4034[_0x42d0ed];return _0x3f63f6;};'use strict';var util=require('util');var path=require(_0x4403('0x0'));var _=require(_0x4403('0x1'));var fs=require('fs');var json2xls=require(_0x4403('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x4403('0x3'));var rimraf=require('rimraf');var db=require(_0x4403('0x4'))['db'];var dbH=require(_0x4403('0x4'))['dbH'];var logger=require(_0x4403('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4403('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x538c95,_0xfd91ca){var _0x517d90={'status':_0x538c95};var _0x4cdc07={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfd91ca){_0x517d90['savename']=_0xfd91ca;}return db['AnalyticExtractedReport'][_0x4403('0x7')](_0x517d90,_0x4cdc07);}function main(){var _0x2b91b5=0x1388;var _0x5f3756;logger[_0x4403('0x8')](util[_0x4403('0x9')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4403('0xa')));return db[_0x4403('0xb')][_0x4403('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4403('0xd')]})[_0x4403('0xe')](function(_0x461d33){if(_0x461d33){_0x5f3756=_0x461d33;_0x2b91b5=_0x5f3756[_0x4403('0xd')]||0x1388;}})[_0x4403('0xe')](function(){return dbH['sequelize'][_0x4403('0xf')](util['format'](_0x4403('0x10'),QUERY),{'type':dbH[_0x4403('0x11')]['QueryTypes'][_0x4403('0x12')]});})[_0x4403('0xe')](function(_0x26b124){if(!_0x26b124[0x0][_0x4403('0x13')]){return analyticExtractedReport(_0x4403('0x14'));}var _0xee64a6=[];var _0x1086fb=0x0;if(_0x5f3756[_0x4403('0x15')]){if(_0x26b124&&_0x26b124['length']){var _0x56ae70=_[_0x4403('0x16')](_0x26b124[0x0][_0x4403('0x13')]/_0x2b91b5);var _0x5ed2dc=Number[_0x4403('0x17')](_0x26b124[0x0][_0x4403('0x13')]/_0x2b91b5)?_0x26b124[0x0]['num']%_0x2b91b5:0x0;_0x56ae70['forEach'](function(_0x1eb151){if(_0x1eb151>0x0){_0x1086fb+=_0x2b91b5;}_0xee64a6['push'](dbH[_0x4403('0x11')][_0x4403('0xf')](util[_0x4403('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b91b5,_0x1086fb),{'type':dbH[_0x4403('0x11')][_0x4403('0x18')][_0x4403('0x12')]}));});if(_0x5ed2dc>0x0){_0x1086fb+=_0x2b91b5;_0xee64a6[_0x4403('0x19')](dbH['sequelize'][_0x4403('0xf')](util[_0x4403('0x9')](_0x4403('0x1a'),QUERY,_0x5ed2dc,_0x1086fb),{'type':dbH[_0x4403('0x11')][_0x4403('0x18')][_0x4403('0x12')]}));}}}else{_0xee64a6['push'](dbH[_0x4403('0x11')][_0x4403('0xf')](QUERY,{'type':dbH[_0x4403('0x11')][_0x4403('0x18')][_0x4403('0x12')]}));}var _0x3e037d=path['dirname'](PATH);var _0x5e4e60=path[_0x4403('0x1b')](PATH,_0x4403('0x1c'));var _0x2c263c=_0x5f3756['split']&&_0xee64a6[_0x4403('0x1d')]>0x1;var _0x59f0ea=[];if(!fs['existsSync'](path['join'](_0x3e037d,_0x5e4e60))&&_0x2c263c){fs['mkdirSync'](path['join'](_0x3e037d,_0x5e4e60));}return BPromise[_0x4403('0x1e')](_0xee64a6,function(_0x5998c6){_0x59f0ea['push'](_0x5998c6);})['then'](function(){for(var _0x24b8a5=0x0;_0x24b8a5<_0x59f0ea[_0x4403('0x1d')];_0x24b8a5+=0x1){var _0x36307d;var _0x2a13e7=_0x59f0ea[_0x24b8a5];if(_0x2c263c){_0x36307d=path['join'](_0x3e037d,_0x5e4e60,util[_0x4403('0x9')](_0x4403('0x1f'),_0x5e4e60,_0x24b8a5,_0x4403('0x20')));}else{_0x36307d=path[_0x4403('0x21')](_0x3e037d,util[_0x4403('0x9')]('%s.%s',_0x5e4e60,'xlsx'));}fs[_0x4403('0x22')](_0x36307d,json2xls(_0x2a13e7),_0x4403('0x23'));}})[_0x4403('0xe')](function(){if(_0x2c263c){return new Promise(function(_0x117422){zipdir(path[_0x4403('0x21')](_0x3e037d,_0x5e4e60),{'saveTo':path['join'](_0x3e037d,util['format']('%s.%s',_0x5e4e60,_0x4403('0x24')))},function(_0x179514,_0x452f2d){rimraf(path[_0x4403('0x21')](_0x3e037d,_0x5e4e60),function(){});_0x117422('zip\x20finished');});});}})[_0x4403('0xe')](function(){logger['info'](util[_0x4403('0x9')](_0x4403('0x25'),EXTRACTED_REPORT_ID,_0x4403('0xa')));return analyticExtractedReport(_0x4403('0x26'),_0x2c263c?util[_0x4403('0x9')](_0x4403('0x27'),_0x5e4e60,_0x2c263c?'zip':_0x4403('0x20')):null);});})[_0x4403('0x28')](function(_0xfd6dc2){logger[_0x4403('0x8')](util[_0x4403('0x9')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4403('0xa')),util[_0x4403('0x29')](_0xfd6dc2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4403('0x2a'));})[_0x4403('0x2b')](function(){process[_0x4403('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6c9c=['split','length','range','num','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','Completed','catch','inspect','Failed','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty'];(function(_0xd9d48b,_0x5389be){var _0x44973c=function(_0x2b2f98){while(--_0x2b2f98){_0xd9d48b['push'](_0xd9d48b['shift']());}};_0x44973c(++_0x5389be);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x48312c,_0x45776d){_0x48312c=_0x48312c-0x0;var _0x2404f2=_0x6c9c[_0x48312c];return _0x2404f2;};'use strict';var util=require(_0xc6c9('0x0'));var path=require(_0xc6c9('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xc6c9('0x2'));var BPromise=require(_0xc6c9('0x3'));var zipdir=require(_0xc6c9('0x4'));var rimraf=require(_0xc6c9('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc6c9('0x6'))[_0xc6c9('0x7')];var logger=require(_0xc6c9('0x8'))(_0xc6c9('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc6c9('0xa')][0x2]);var QUERY=process[_0xc6c9('0xa')][0x3];var PATH=process[_0xc6c9('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd310e9,_0x30db53){var _0x15cf6e={'status':_0xd310e9};var _0xb11c68={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x30db53){_0x15cf6e[_0xc6c9('0xb')]=_0x30db53;}return db[_0xc6c9('0xc')][_0xc6c9('0xd')](_0x15cf6e,_0xb11c68);}function main(){var _0x2fb627=0x1388;var _0x10a3d4;logger[_0xc6c9('0xe')](util[_0xc6c9('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc6c9('0x10')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc6c9('0x11')]})[_0xc6c9('0x12')](function(_0x2d35c9){if(_0x2d35c9){_0x10a3d4=_0x2d35c9;_0x2fb627=_0x10a3d4[_0xc6c9('0x11')]||0x1388;}})[_0xc6c9('0x12')](function(){return dbH[_0xc6c9('0x13')]['query'](util['format'](_0xc6c9('0x14'),QUERY),{'type':dbH[_0xc6c9('0x13')][_0xc6c9('0x15')][_0xc6c9('0x16')]});})[_0xc6c9('0x12')](function(_0x12d501){if(!_0x12d501[0x0]['num']){return analyticExtractedReport(_0xc6c9('0x17'));}var _0x242d20=[];var _0x406add=0x0;if(_0x10a3d4[_0xc6c9('0x18')]){if(_0x12d501&&_0x12d501[_0xc6c9('0x19')]){var _0x35c82c=_[_0xc6c9('0x1a')](_0x12d501[0x0][_0xc6c9('0x1b')]/_0x2fb627);var _0x40d245=Number[_0xc6c9('0x1c')](_0x12d501[0x0][_0xc6c9('0x1b')]/_0x2fb627)?_0x12d501[0x0]['num']%_0x2fb627:0x0;_0x35c82c['forEach'](function(_0x3b46af){if(_0x3b46af>0x0){_0x406add+=_0x2fb627;}_0x242d20[_0xc6c9('0x1d')](dbH[_0xc6c9('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2fb627,_0x406add),{'type':dbH['sequelize'][_0xc6c9('0x15')][_0xc6c9('0x16')]}));});if(_0x40d245>0x0){_0x406add+=_0x2fb627;_0x242d20[_0xc6c9('0x1d')](dbH[_0xc6c9('0x13')][_0xc6c9('0x1e')](util['format'](_0xc6c9('0x1f'),QUERY,_0x40d245,_0x406add),{'type':dbH[_0xc6c9('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x242d20['push'](dbH[_0xc6c9('0x13')][_0xc6c9('0x1e')](QUERY,{'type':dbH[_0xc6c9('0x13')][_0xc6c9('0x15')][_0xc6c9('0x16')]}));}var _0x589dbf=path['dirname'](PATH);var _0xb432ec=path[_0xc6c9('0x20')](PATH,_0xc6c9('0x21'));var _0x5e1817=_0x10a3d4[_0xc6c9('0x18')]&&_0x242d20[_0xc6c9('0x19')]>0x1;var _0x1fe406=[];if(!fs['existsSync'](path['join'](_0x589dbf,_0xb432ec))&&_0x5e1817){fs['mkdirSync'](path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec));}return BPromise[_0xc6c9('0x23')](_0x242d20,function(_0x9ffcb5){_0x1fe406[_0xc6c9('0x1d')](_0x9ffcb5);})[_0xc6c9('0x12')](function(){for(var _0x47fe8e=0x0;_0x47fe8e<_0x1fe406[_0xc6c9('0x19')];_0x47fe8e+=0x1){var _0x167173;var _0x5a6848=_0x1fe406[_0x47fe8e];if(_0x5e1817){_0x167173=path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec,util[_0xc6c9('0xf')](_0xc6c9('0x24'),_0xb432ec,_0x47fe8e,_0xc6c9('0x25')));}else{_0x167173=path[_0xc6c9('0x22')](_0x589dbf,util['format'](_0xc6c9('0x26'),_0xb432ec,_0xc6c9('0x25')));}fs[_0xc6c9('0x27')](_0x167173,json2xls(_0x5a6848),'binary');}})[_0xc6c9('0x12')](function(){if(_0x5e1817){return new Promise(function(_0x1493ca){zipdir(path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec),{'saveTo':path[_0xc6c9('0x22')](_0x589dbf,util[_0xc6c9('0xf')](_0xc6c9('0x26'),_0xb432ec,_0xc6c9('0x28')))},function(_0x156968,_0xa36594){rimraf(path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec),function(){});_0x1493ca('zip\x20finished');});});}})[_0xc6c9('0x12')](function(){logger['info'](util[_0xc6c9('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xc6c9('0x29'),_0x5e1817?util[_0xc6c9('0xf')](_0xc6c9('0x26'),_0xb432ec,_0x5e1817?'zip':_0xc6c9('0x25')):null);});})[_0xc6c9('0x2a')](function(_0x859dd8){logger[_0xc6c9('0xe')](util[_0xc6c9('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc6c9('0x10')),util[_0xc6c9('0x2b')](_0x859dd8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc6c9('0x2c'));})['finally'](function(){process[_0xc6c9('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ed8faaa..2e0112e 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 _0x7b07=['VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','extension','CDR(prefix)=${EXTEN:0:','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','type','Set','CDR(type)=%s','context'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b07,0x71));var _0x77b0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7b07[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x77b0('0x0'));function rewrite(_0x391b4a,_0x1d5f83){var _0x4b8ab9=this;return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x2')][_0x77b0('0x3')]({'raw':!![]})[_0x77b0('0x4')](function(_0x27aeb6){_0x4b8ab9[_0x77b0('0x5')]=_0x27aeb6;return _0x391b4a[_0x77b0('0x1')]['VoiceExtension'][_0x77b0('0x3')]({'where':{'IntervalId':_0x1d5f83['IntervalId']},'raw':!![]});})[_0x77b0('0x4')](function(_0x38c144){return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x77b0('0x7')](_[_0x77b0('0x8')](_0x38c144,_0x77b0('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x77b0('0x4')](function(_0x10a9c9){var _0x4f4b9c=_[_0x77b0('0xa')](_0x10a9c9,{'priority':'1'});var _0x1221a4=_[_0x77b0('0xa')](_0x10a9c9,{'isApp':0x1});var _0x156e82=_[_0x77b0('0xb')](_0x1221a4,_0x77b0('0x9'));var _0x4ec11a=[_0x77b0('0xc'),_0x77b0('0xd')];var _0x4b4e36=[];var _0x4dce24=[];for(var _0x568b8e in _0x156e82){if(_0x156e82[_0x77b0('0xe')](_0x568b8e)){_0x4b8ab9[_0x77b0('0xf')]=0x2;_0x4b8ab9[_0x77b0('0x10')]=[];_0x4b8ab9['extension']=_[_0x77b0('0x11')](_0x4f4b9c,{'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')]});_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':util['format'](_0x77b0('0x15'),_0x156e82[_0x568b8e][0x0]['type']),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});if(_0x156e82[_0x568b8e][0x0]['type']==='inbound'){_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':_0x77b0('0x18')+_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')],'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}else if(_0x156e82[_0x568b8e][0x0]['type']===_0x77b0('0x19')){if(_0x4b8ab9['extension']){_0x4b8ab9['extensions'][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x1a')+(_0x4b8ab9['extension'][_0x77b0('0x1b')]?_0x77b0('0x1c')+_0x4b8ab9['extension'][_0x77b0('0x1b')]+'}':_0x77b0('0x1d')),'context':_0x156e82[_0x568b8e][0x0]['context'],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}_0x4b8ab9['extensions']['push']({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':'CDR(routeid)='+_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')],'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});var _0x15ae2e=_0x4b8ab9[_0x77b0('0xf')]++;_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x1e'),'appdata':_0x77b0('0x1f')+(_0x15ae2e+0x2)+_0x77b0('0x20')+(_0x15ae2e+0x1)+')','context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x15ae2e,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});if(_0x4b8ab9[_0x77b0('0x21')]){_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x14'),'appdata':_0x4b8ab9['extension'][_0x77b0('0x1b')]?_0x77b0('0x22')+_0x4b8ab9[_0x77b0('0x21')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}_0x4b8ab9[_0x77b0('0x10')]['push']({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':'outboundrouteid='+_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')],'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});if(_0x4b8ab9[_0x77b0('0x21')]&&_0x4b8ab9[_0x77b0('0x21')][_0x77b0('0xe')](_0x77b0('0x23'))&&_0x4b8ab9[_0x77b0('0x21')]['recordingFormat']!=='none'){_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x24'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0]['exten'],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4b8ab9[_0x77b0('0x21')][_0x77b0('0x23')]||'wav','context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9['priority']++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}}_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x25'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0]['type'],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x26'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'priority':_0x4b8ab9[_0x77b0('0xf')]++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b8ab9['extensions'][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':'Set','appdata':_0x77b0('0x27'),'context':_0x156e82[_0x568b8e][0x0][_0x77b0('0x16')],'exten':_0x156e82[_0x568b8e][0x0]['exten'],'priority':_0x4b8ab9['priority']++,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0]['VoiceExtensionId']});for(var _0x3ba062=0x0,_0x742c1d=0x0;_0x3ba062<_0x156e82[_0x568b8e][_0x77b0('0x28')];_0x3ba062+=0x1,_0x742c1d=0x0){var _0x2586ae=_0x156e82[_0x568b8e][_0x3ba062];if(_0x2586ae[_0x77b0('0x13')]){_0x2586ae[_0x77b0('0x13')]=_0x2586ae[_0x77b0('0x13')][_0x77b0('0x29')]();}var _0x58ad1b=[];var _0x3db8e3=[];delete _0x2586ae['id'];delete _0x2586ae[_0x77b0('0x2a')];delete _0x2586ae[_0x77b0('0x2b')];var _0x1bd726=_0x2586ae[_0x77b0('0x2c')]!==_0x77b0('0x2d')?[_0x2586ae[_0x77b0('0x2c')]]:_0x2586ae['IntervalId']?_[_0x77b0('0x8')](_[_0x77b0('0xa')](_0x4b8ab9['intervals'],{'IntervalId':_0x2586ae[_0x77b0('0x2e')]}),_0x77b0('0x2c')):[];if(_0x2586ae[_0x77b0('0xe')](_0x77b0('0x2f'))){if(_0x2586ae['tag']&&_0x2586ae[_0x77b0('0x2f')]!=='--'){_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':_0x77b0('0x30')+_0x2586ae[_0x77b0('0x2f')],'context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae['VoiceExtensionId']});}}if(_0x2586ae['type']===_0x77b0('0x19')&&_0x2586ae[_0x77b0('0xe')](_0x77b0('0x31'))){if(_0x2586ae[_0x77b0('0x31')]){_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':_0x77b0('0x32')+_0x2586ae[_0x77b0('0x31')]+')','context':_0x2586ae['context'],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}else{_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae['exten'],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9['priority']+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}}if(_0x2586ae[_0x77b0('0xe')](_0x77b0('0x33'))){if(_0x4ec11a[_0x77b0('0x34')](_0x2586ae[_0x77b0('0x35')][_0x77b0('0x29')]())>=0x0&&_0x2586ae[_0x77b0('0x36')]!==_0x77b0('0x37')){if(_0x2586ae[_0x77b0('0x33')]){_0x58ad1b['push']({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae['exten'],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':'Set','appdata':_0x77b0('0x38'),'context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726['length']+_0x4b8ab9['priority']+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}else{_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726['length']+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});_0x58ad1b[_0x77b0('0x12')]({'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2586ae[_0x77b0('0x16')],'exten':_0x2586ae[_0x77b0('0x9')],'priority':_0x1bd726[_0x77b0('0x28')]+_0x4b8ab9[_0x77b0('0xf')]+_0x742c1d++,'VoiceExtensionId':_0x2586ae[_0x77b0('0x17')]});}}}for(var _0x3c488e=0x0;_0x3c488e<_0x1bd726[_0x77b0('0x28')];_0x3c488e+=0x1){var _0x1dd3ec=_0x4b8ab9[_0x77b0('0xf')]+_0x1bd726[_0x77b0('0x28')];var _0x47d510=_0x3c488e===_0x1bd726[_0x77b0('0x28')]-0x1?_0x4b8ab9[_0x77b0('0xf')]+_0x58ad1b[_0x77b0('0x28')]+_0x3db8e3[_0x77b0('0x28')]+0x2:_0x4b8ab9[_0x77b0('0xf')]+_0x3c488e+0x1;_0x58ad1b[_0x77b0('0x39')](_0x3c488e,0x0,{'type':_0x2586ae[_0x77b0('0x13')],'app':_0x77b0('0x3a'),'appdata':_0x1bd726[_0x3c488e]+'?'+_0x2586ae[_0x77b0('0x16')]+_0x77b0('0x3b')+_0x1dd3ec+':'+_0x2586ae[_0x77b0('0x16')]+_0x77b0('0x3b')+_0x47d510,'exten':_0x2586ae['exten'],'context':_0x2586ae[_0x77b0('0x16')],'priority':_0x4b8ab9['priority']+_0x3c488e,'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});}_0x2586ae[_0x77b0('0xf')]=_0x58ad1b[_0x77b0('0x28')]?_['last'](_0x58ad1b)['priority']+0x1:_0x4b8ab9[_0x77b0('0xf')];_0x4b8ab9['priority']=(_0x3db8e3['length']?_[_0x77b0('0x3c')](_0x3db8e3)[_0x77b0('0xf')]:_0x2586ae['priority'])+0x1;_0x4b8ab9[_0x77b0('0x10')]=_[_0x77b0('0x3d')](_0x4b8ab9[_0x77b0('0x10')],_0x58ad1b,[_0x2586ae],_0x3db8e3);}_0x4b8ab9[_0x77b0('0x10')][_0x77b0('0x12')]({'type':_0x156e82[_0x568b8e][0x0][_0x77b0('0x13')],'app':_0x77b0('0x3e'),'exten':_0x156e82[_0x568b8e][0x0][_0x77b0('0x9')],'context':_0x156e82[_0x568b8e][0x0]['context'],'priority':_0x4b8ab9[_0x77b0('0xf')],'VoiceExtensionId':_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]});_0x4b4e36[_0x77b0('0x12')](_0x156e82[_0x568b8e][0x0][_0x77b0('0x17')]);_0x4dce24=_[_0x77b0('0x3d')](_0x4dce24,_0x4b8ab9['extensions']);}}return _0x391b4a[_0x77b0('0x3f')](function(_0xb4c626){return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x6')][_0x77b0('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x4b4e36}},'transaction':_0xb4c626})[_0x77b0('0x4')](function(_0x519dba){return _0x391b4a[_0x77b0('0x1')][_0x77b0('0x6')]['bulkCreate'](_['sortBy'](_0x4dce24,_0x77b0('0xf')),{'transaction':_0xb4c626});});});})[_0x77b0('0x41')](function(_0x44ff7d){console[_0x77b0('0x42')](_0x44ff7d);});}exports[_0x77b0('0x43')]=rewrite; \ No newline at end of file +var _0x79e5=['none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','rewrite','lodash','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','exten','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat'];(function(_0x2788a6,_0x28b9cb){var _0x2a3d03=function(_0x4fb575){while(--_0x4fb575){_0x2788a6['push'](_0x2788a6['shift']());}};_0x2a3d03(++_0x28b9cb);}(_0x79e5,0x66));var _0x579e=function(_0x44c93a,_0x130f5c){_0x44c93a=_0x44c93a-0x0;var _0x53aa7a=_0x79e5[_0x44c93a];return _0x53aa7a;};'use strict';var _=require(_0x579e('0x0'));var util=require('util');function rewrite(_0x56264b,_0x410750){var _0x26427b=this;return _0x56264b['models'][_0x579e('0x1')][_0x579e('0x2')]({'raw':!![]})[_0x579e('0x3')](function(_0x5c73d1){_0x26427b[_0x579e('0x4')]=_0x5c73d1;return _0x56264b[_0x579e('0x5')][_0x579e('0x6')]['findAll']({'where':{'IntervalId':_0x410750[_0x579e('0x7')]},'raw':!![]});})[_0x579e('0x3')](function(_0x193857){return _0x56264b[_0x579e('0x5')][_0x579e('0x6')][_0x579e('0x2')]({'where':{'exten':{'$in':_[_0x579e('0x8')](_[_0x579e('0x9')](_0x193857,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x579e('0x3')](function(_0x338df4){var _0x2ee83c=_[_0x579e('0xa')](_0x338df4,{'priority':'1'});var _0x3af573=_[_0x579e('0xa')](_0x338df4,{'isApp':0x1});var _0x42f6bb=_[_0x579e('0xb')](_0x3af573,'exten');var _0x1637e7=[_0x579e('0xc'),'playback'];var _0x1d1745=[];var _0x4064c8=[];for(var _0x46006a in _0x42f6bb){if(_0x42f6bb[_0x579e('0xd')](_0x46006a)){_0x26427b[_0x579e('0xe')]=0x2;_0x26427b[_0x579e('0xf')]=[];_0x26427b[_0x579e('0x10')]=_[_0x579e('0x11')](_0x2ee83c,{'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')]});_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':util[_0x579e('0x16')]('CDR(type)=%s',_0x42f6bb[_0x46006a][0x0]['type']),'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});if(_0x42f6bb[_0x46006a][0x0]['type']===_0x579e('0x19')){_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':_0x579e('0x1a')+_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId'],'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0]['exten'],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});}else if(_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')]===_0x579e('0x1b')){if(_0x26427b[_0x579e('0x10')]){_0x26427b['extensions'][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':'CDR(destination)='+(_0x26427b[_0x579e('0x10')][_0x579e('0x1c')]?_0x579e('0x1d')+_0x26427b[_0x579e('0x10')][_0x579e('0x1c')]+'}':'${EXTEN}'),'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b['priority']++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});}_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0]['type'],'app':_0x579e('0x15'),'appdata':_0x579e('0x1a')+_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')],'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});var _0x4f9586=_0x26427b[_0x579e('0xe')]++;_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0]['type'],'app':'ExecIf','appdata':_0x579e('0x1e')+(_0x4f9586+0x2)+_0x579e('0x1f')+(_0x4f9586+0x1)+')','context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x4f9586,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId']});if(_0x26427b[_0x579e('0x10')]){_0x26427b[_0x579e('0xf')]['push']({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':'Set','appdata':_0x26427b[_0x579e('0x10')][_0x579e('0x1c')]?_0x579e('0x20')+_0x26427b['extension'][_0x579e('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId']});}_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':'Set','appdata':'outboundrouteid='+_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')],'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId']});if(_0x26427b[_0x579e('0x10')]&&_0x26427b['extension']['hasOwnProperty'](_0x579e('0x21'))&&_0x26427b[_0x579e('0x10')][_0x579e('0x21')]!==_0x579e('0x22')){_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0]['type'],'app':'Set','appdata':_0x579e('0x23'),'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});_0x26427b['extensions'][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x26427b[_0x579e('0x10')][_0x579e('0x21')]||_0x579e('0x24'),'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId']});}}_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':_0x579e('0x25'),'context':_0x42f6bb[_0x46006a][0x0]['context'],'exten':_0x42f6bb[_0x46006a][0x0]['exten'],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':_0x579e('0x26'),'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b['priority']++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':'Set','appdata':_0x579e('0x27'),'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'priority':_0x26427b[_0x579e('0xe')]++,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId']});for(var _0x1a2b56=0x0,_0x3c0648=0x0;_0x1a2b56<_0x42f6bb[_0x46006a][_0x579e('0x28')];_0x1a2b56+=0x1,_0x3c0648=0x0){var _0x3a9f4c=_0x42f6bb[_0x46006a][_0x1a2b56];if(_0x3a9f4c[_0x579e('0x14')]){_0x3a9f4c[_0x579e('0x14')]=_0x3a9f4c['type'][_0x579e('0x29')]();}var _0x4e2240=[];var _0x381a4c=[];delete _0x3a9f4c['id'];delete _0x3a9f4c[_0x579e('0x2a')];delete _0x3a9f4c[_0x579e('0x2b')];var _0x6d5a68=_0x3a9f4c[_0x579e('0x2c')]!==_0x579e('0x2d')?[_0x3a9f4c[_0x579e('0x2c')]]:_0x3a9f4c['IntervalId']?_['map'](_['filter'](_0x26427b['intervals'],{'IntervalId':_0x3a9f4c[_0x579e('0x7')]}),_0x579e('0x2c')):[];if(_0x3a9f4c['hasOwnProperty'](_0x579e('0x2e'))){if(_0x3a9f4c[_0x579e('0x2e')]&&_0x3a9f4c['tag']!=='--'){_0x4e2240[_0x579e('0x13')]({'type':_0x3a9f4c[_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':_0x579e('0x2f')+_0x3a9f4c[_0x579e('0x2e')],'context':_0x3a9f4c[_0x579e('0x17')],'exten':_0x3a9f4c[_0x579e('0x12')],'priority':_0x6d5a68['length']+_0x26427b['priority']+_0x3c0648++,'VoiceExtensionId':_0x3a9f4c['VoiceExtensionId']});}}if(_0x3a9f4c[_0x579e('0x14')]===_0x579e('0x1b')&&_0x3a9f4c[_0x579e('0xd')](_0x579e('0x30'))){if(_0x3a9f4c['callerID']){_0x4e2240[_0x579e('0x13')]({'type':_0x3a9f4c['type'],'app':'ExecIf','appdata':_0x579e('0x31')+_0x3a9f4c[_0x579e('0x30')]+')','context':_0x3a9f4c[_0x579e('0x17')],'exten':_0x3a9f4c[_0x579e('0x12')],'priority':_0x6d5a68[_0x579e('0x28')]+_0x26427b[_0x579e('0xe')]+_0x3c0648++,'VoiceExtensionId':_0x3a9f4c[_0x579e('0x18')]});}else{_0x4e2240[_0x579e('0x13')]({'type':_0x3a9f4c[_0x579e('0x14')],'app':_0x579e('0x32'),'appdata':_0x579e('0x33'),'context':_0x3a9f4c[_0x579e('0x17')],'exten':_0x3a9f4c['exten'],'priority':_0x6d5a68[_0x579e('0x28')]+_0x26427b[_0x579e('0xe')]+_0x3c0648++,'VoiceExtensionId':_0x3a9f4c[_0x579e('0x18')]});}}if(_0x3a9f4c[_0x579e('0xd')](_0x579e('0x34'))){if(_0x1637e7['indexOf'](_0x3a9f4c['app']['toLowerCase']())>=0x0&&_0x3a9f4c[_0x579e('0x35')]!=='custom'){if(_0x3a9f4c[_0x579e('0x34')]){_0x4e2240[_0x579e('0x13')]({'type':_0x3a9f4c['type'],'app':_0x579e('0x32'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3a9f4c[_0x579e('0x17')],'exten':_0x3a9f4c['exten'],'priority':_0x6d5a68[_0x579e('0x28')]+_0x26427b[_0x579e('0xe')]+_0x3c0648++,'VoiceExtensionId':_0x3a9f4c['VoiceExtensionId']});_0x4e2240[_0x579e('0x13')]({'type':_0x3a9f4c['type'],'app':'Set','appdata':_0x579e('0x36'),'context':_0x3a9f4c[_0x579e('0x17')],'exten':_0x3a9f4c[_0x579e('0x12')],'priority':_0x6d5a68[_0x579e('0x28')]+_0x26427b[_0x579e('0xe')]+_0x3c0648++,'VoiceExtensionId':_0x3a9f4c[_0x579e('0x18')]});}else{_0x4e2240[_0x579e('0x13')]({'type':_0x3a9f4c[_0x579e('0x14')],'app':_0x579e('0x32'),'appdata':_0x579e('0x37'),'context':_0x3a9f4c[_0x579e('0x17')],'exten':_0x3a9f4c[_0x579e('0x12')],'priority':_0x6d5a68['length']+_0x26427b['priority']+_0x3c0648++,'VoiceExtensionId':_0x3a9f4c[_0x579e('0x18')]});_0x4e2240[_0x579e('0x13')]({'type':_0x3a9f4c[_0x579e('0x14')],'app':_0x579e('0x15'),'appdata':_0x579e('0x38'),'context':_0x3a9f4c[_0x579e('0x17')],'exten':_0x3a9f4c[_0x579e('0x12')],'priority':_0x6d5a68[_0x579e('0x28')]+_0x26427b[_0x579e('0xe')]+_0x3c0648++,'VoiceExtensionId':_0x3a9f4c[_0x579e('0x18')]});}}}for(var _0x1c13cc=0x0;_0x1c13cc<_0x6d5a68['length'];_0x1c13cc+=0x1){var _0x15f9fb=_0x26427b[_0x579e('0xe')]+_0x6d5a68[_0x579e('0x28')];var _0x1b2909=_0x1c13cc===_0x6d5a68[_0x579e('0x28')]-0x1?_0x26427b['priority']+_0x4e2240[_0x579e('0x28')]+_0x381a4c[_0x579e('0x28')]+0x2:_0x26427b[_0x579e('0xe')]+_0x1c13cc+0x1;_0x4e2240[_0x579e('0x39')](_0x1c13cc,0x0,{'type':_0x3a9f4c[_0x579e('0x14')],'app':_0x579e('0x3a'),'appdata':_0x6d5a68[_0x1c13cc]+'?'+_0x3a9f4c['context']+',${EXTEN},'+_0x15f9fb+':'+_0x3a9f4c[_0x579e('0x17')]+_0x579e('0x3b')+_0x1b2909,'exten':_0x3a9f4c[_0x579e('0x12')],'context':_0x3a9f4c[_0x579e('0x17')],'priority':_0x26427b[_0x579e('0xe')]+_0x1c13cc,'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId']});}_0x3a9f4c[_0x579e('0xe')]=_0x4e2240[_0x579e('0x28')]?_['last'](_0x4e2240)[_0x579e('0xe')]+0x1:_0x26427b[_0x579e('0xe')];_0x26427b[_0x579e('0xe')]=(_0x381a4c['length']?_[_0x579e('0x3c')](_0x381a4c)['priority']:_0x3a9f4c[_0x579e('0xe')])+0x1;_0x26427b[_0x579e('0xf')]=_[_0x579e('0x3d')](_0x26427b[_0x579e('0xf')],_0x4e2240,[_0x3a9f4c],_0x381a4c);}_0x26427b[_0x579e('0xf')][_0x579e('0x13')]({'type':_0x42f6bb[_0x46006a][0x0][_0x579e('0x14')],'app':_0x579e('0x3e'),'exten':_0x42f6bb[_0x46006a][0x0][_0x579e('0x12')],'context':_0x42f6bb[_0x46006a][0x0][_0x579e('0x17')],'priority':_0x26427b[_0x579e('0xe')],'VoiceExtensionId':_0x42f6bb[_0x46006a][0x0][_0x579e('0x18')]});_0x1d1745[_0x579e('0x13')](_0x42f6bb[_0x46006a][0x0]['VoiceExtensionId']);_0x4064c8=_[_0x579e('0x3d')](_0x4064c8,_0x26427b[_0x579e('0xf')]);}}return _0x56264b[_0x579e('0x3f')](function(_0x1a5669){return _0x56264b[_0x579e('0x5')][_0x579e('0x6')][_0x579e('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x1d1745}},'transaction':_0x1a5669})[_0x579e('0x3')](function(_0x58fb8c){return _0x56264b[_0x579e('0x5')][_0x579e('0x6')][_0x579e('0x41')](_['sortBy'](_0x4064c8,_0x579e('0xe')),{'transaction':_0x1a5669});});});})[_0x579e('0x42')](function(_0x2d5b6b){console['error'](_0x2d5b6b);});}exports[_0x579e('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3c47343..8f51441 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 _0x366d=['cm_hopper_final','createdAt','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','sequelize','VoiceQueueId','onlyIfOpen','query','all','Campaign','CmList','CampaignId','BlackLists','generalCheckHopper','emit','contact:csv_','resolve','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate','Duplicate\x20Contact','create','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','inspect','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','fromQuery','id\x20IN\x20?','calleridnum'];(function(_0x396cad,_0x258a5a){var _0x276b0f=function(_0x51d2fd){while(--_0x51d2fd){_0x396cad['push'](_0x396cad['shift']());}};_0x276b0f(++_0x258a5a);}(_0x366d,0x8e));var _0xd366=function(_0x218388,_0x35e0e6){_0x218388=_0x218388-0x0;var _0x323fac=_0x366d[_0x218388];return _0x323fac;};'use strict';var BPromise=require(_0xd366('0x0'));var util=require('util');var _=require(_0xd366('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xd366('0x2'));var Redis=require(_0xd366('0x3'));var db=require(_0xd366('0x4'))['db'];var config=require(_0xd366('0x5'));var logger=require(_0xd366('0x6'))('api');config[_0xd366('0x7')]=_['defaults'](config[_0xd366('0x7')],{'host':_0xd366('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd366('0x7')]));require(_0xd366('0x9'))['register'](socket);try{if(!process[_0xd366('0xa')][0x2]||process[_0xd366('0xa')][0x2]===_0xd366('0xb')||process['argv'][0x2]==='null'){throw new Error(_0xd366('0xc'));}var FILEPATH=process['argv'][0x2];if(!process[_0xd366('0xa')][0x3]||process[_0xd366('0xa')][0x3]===_0xd366('0xb')||process[_0xd366('0xa')][0x3]===_0xd366('0xd')||!process['argv'][0x4]||process[_0xd366('0xa')][0x4]===_0xd366('0xb')||process[_0xd366('0xa')][0x4]===_0xd366('0xd')){throw new Error(_0xd366('0xe'));}var FIELDS=_[_0xd366('0xf')](process[_0xd366('0xa')][0x3]['split'](','),process[_0xd366('0xa')][0x4][_0xd366('0x10')](','));if(!process[_0xd366('0xa')][0x5]||process['argv'][0x5]===_0xd366('0xb')||process[_0xd366('0xa')][0x5]===_0xd366('0xd')){throw new Error(_0xd366('0x11'));}var LISTID=process[_0xd366('0xa')][0x5];var COMPANYID=process[_0xd366('0xa')][0x6]&&process[_0xd366('0xa')][0x6]!==_0xd366('0xb')&&process[_0xd366('0xa')][0x6]!==_0xd366('0xd')?process[_0xd366('0xa')][0x6]:null;var DUPLICATES=process[_0xd366('0xa')][0x7]&&process[_0xd366('0xa')][0x7]!==_0xd366('0xb')&&process[_0xd366('0xa')][0x7]!==_0xd366('0xd')?process[_0xd366('0xa')][0x7]:null;if(!process[_0xd366('0xa')][0x8]||process[_0xd366('0xa')][0x8]===_0xd366('0xb')||process['argv'][0x8]===_0xd366('0xd')){throw new Error(_0xd366('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x19a36b){logger[_0xd366('0x13')](_0x19a36b);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(_0x5cdaed,_0x4f832e,_0x159a28,_0x946800){var _0x38d234={'message':_0x4f832e};_0x38d234[_0x5cdaed]=!![];if(_0x159a28){_0x38d234[_0xd366('0x14')]=_0x159a28;}if(_0x946800){_0x38d234[_0xd366('0x15')]=_0x946800;}return _0x38d234;}function isEmail(_0x4b8543){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))*$/[_0xd366('0x16')](_0x4b8543);}function checkRow(_0x2a8052,_0x1c1f18,_0x56566c){return new BPromise(function(_0x36b533,_0x2c8a20){if(_[_0xd366('0x17')](_0x2a8052)){return _0x2c8a20(handleCheckRowError('error',_0xd366('0x18'),null,_0x56566c));}if(_0x2a8052[_0xd366('0x19')]&&_0x2a8052[_0xd366('0x19')]['length']){var _0x3b7e6a=_['map'](_0x2a8052[_0xd366('0x19')],'message')['join'](';');return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0x3b7e6a,null,_0x56566c));}var _0x485269={};for(var _0x11cb94 in FIELDS){if(FIELDS[_0xd366('0x1a')](_0x11cb94)&&FIELDS[_0x11cb94]){_0x485269[_0x11cb94]=_0x2a8052[_0xd366('0x1b')][0x0][FIELDS[_0x11cb94]]||_0x2a8052[_0xd366('0x1b')][0x0]['\ufeff'+FIELDS[_0x11cb94]];}}if(!_0x485269[_0xd366('0x1c')]){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x1d'),null,_0x56566c));}if(!_0x485269['phone']){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x1e'),null,_0x56566c));}if(_0x485269[_0xd366('0x1f')]){var _0x397da8=moment(_0x485269['birthDate'],_0xd366('0x20'));if(!_0x397da8[_0xd366('0x21')]()){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x22'),null,_0x56566c));}}if(_0x485269['email']){if(!isEmail(_0x485269[_0xd366('0x23')])){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x24'),null,_0x56566c));}}_0x485269['ListId']=LISTID;_0x485269[_0xd366('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xd366('0x26')]&&_0x1c1f18){var _0x35d4c9={};for(var _0x73edbf=0x0,_0x48113c=DUPLICATES[_0xd366('0x26')];_0x73edbf<_0x48113c;_0x73edbf+=0x1){_0x35d4c9[DUPLICATES[_0x73edbf]]=_0x485269[DUPLICATES[_0x73edbf]];}var _0x22aabf=_[_0xd366('0x27')](_0x1c1f18,_0x35d4c9);if(_0x22aabf){return _0x2c8a20(handleCheckRowError(_0xd366('0x28'),_0xd366('0x29'),_0x22aabf,_0x56566c));}}return db['CmContact'][_0xd366('0x2a')](_0x485269,{'raw':!![],'hooks':![],'fields':_[_0xd366('0x2b')](_0x485269)})['then'](function(_0x2cf74c){if(DUPLICATES&&DUPLICATES[_0xd366('0x26')]&&_0x1c1f18){_0x1c1f18[_0xd366('0x2c')](_['pick'](_0x485269,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2cf74c['id'];return _0x36b533();})[_0xd366('0x2d')](function(_0xb18bb5){return _0x2c8a20(handleCheckRowError(_0xd366('0x13'),_0xd366('0x2e')+(_0xb18bb5[_0xd366('0x2f')]||JSON[_0xd366('0x30')](_0xb18bb5)),null,_0x56566c));});});}function checkHopper(){function _0x419371(){return function(_0x47819c){logger[_0xd366('0x13')](_0xd366('0x31'),'checkHopper',util[_0xd366('0x32')](_0x47819c,{'showHidden':![],'depth':null}));};}var _0x4ce15b=function(_0x5e8089,_0x3275c3){var _0x297ea6=squel[_0xd366('0x33')]()['into'](_0xd366('0x34'))['fromQuery']([_0xd366('0x35'),_0xd366('0x36'),_0xd366('0x37'),_0xd366('0x38'),_0x3275c3,'createdAt',_0xd366('0x39')],squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x35'),_0xd366('0x35'))[_0xd366('0x3b')](_0xd366('0x3c'),_0xd366('0x36'))['field']('id',_0xd366('0x37'))[_0xd366('0x3b')](LISTID['toString'](),_0xd366('0x38'))['field'](_0x5e8089['id'][_0xd366('0x3d')](),_0x3275c3)[_0xd366('0x3b')]('NOW()','createdAt')[_0xd366('0x3b')]('NOW()',_0xd366('0x39'))[_0xd366('0x3e')](_0xd366('0x3f'))[_0xd366('0x40')](_0xd366('0x41'))[_0xd366('0x40')](_0xd366('0x42'),LISTID['toString']())[_0xd366('0x40')](_0xd366('0x43'))[_0xd366('0x40')](_0xd366('0x44'),squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x35'))[_0xd366('0x3e')](_0xd366('0x34'))['where'](_0x3275c3+_0xd366('0x45'),_0x5e8089['id'][_0xd366('0x3d')]())))[_0xd366('0x3d')]();return _0x297ea6;};var _0x4e2e9f=function(_0x45dc67,_0x263fd5){var _0x22627f=squel[_0xd366('0x33')]()[_0xd366('0x46')](_0xd366('0x34'))[_0xd366('0x47')]([_0xd366('0x35'),'scheduledAt',_0xd366('0x37'),_0xd366('0x38'),_0x263fd5,'createdAt',_0xd366('0x39')],squel['select']()[_0xd366('0x3b')](_0xd366('0x35'),'phone')[_0xd366('0x3b')](_0xd366('0x3c'),'scheduledAt')[_0xd366('0x3b')]('id',_0xd366('0x37'))[_0xd366('0x3b')](LISTID[_0xd366('0x3d')](),_0xd366('0x38'))[_0xd366('0x3b')](_0x45dc67['id'][_0xd366('0x3d')](),_0x263fd5)[_0xd366('0x3b')](_0xd366('0x3c'),'createdAt')['field'](_0xd366('0x3c'),_0xd366('0x39'))[_0xd366('0x3e')](_0xd366('0x3f'))[_0xd366('0x40')](_0xd366('0x41'))['where'](_0xd366('0x42'),LISTID[_0xd366('0x3d')]())[_0xd366('0x40')](_0xd366('0x48'),squel['str'](hopperContacts))[_0xd366('0x40')](_0xd366('0x43'))[_0xd366('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x49'))[_0xd366('0x3e')](_0xd366('0x4a'))['where'](_0x263fd5+_0xd366('0x45'),_0x45dc67['id']['toString']()))['where'](_0xd366('0x44'),squel['select']()[_0xd366('0x3b')]('phone')[_0xd366('0x3e')](_0xd366('0x34'))[_0xd366('0x40')](_0x263fd5+_0xd366('0x45'),_0x45dc67['id'][_0xd366('0x3d')]())))['toString']();return _0x22627f;};function _0x12c99f(_0x39c167,_0x4d0b3b){var _0x317fef=squel[_0xd366('0x33')]()[_0xd366('0x46')](_0xd366('0x34'))[_0xd366('0x47')](['phone','scheduledAt',_0xd366('0x37'),_0xd366('0x38'),_0x4d0b3b,'createdAt',_0xd366('0x39')],squel['select']()['field'](_0xd366('0x35'),'phone')[_0xd366('0x3b')]('NOW()','scheduledAt')[_0xd366('0x3b')]('id',_0xd366('0x37'))[_0xd366('0x3b')](LISTID[_0xd366('0x3d')](),'ListId')['field'](_0x39c167['id'][_0xd366('0x3d')](),_0x4d0b3b)['field']('NOW()',_0xd366('0x4b'))[_0xd366('0x3b')](_0xd366('0x3c'),'updatedAt')['from'](_0xd366('0x3f'))['where'](_0xd366('0x41'))['where'](_0xd366('0x42'),LISTID[_0xd366('0x3d')]())['where'](_0xd366('0x48'),squel[_0xd366('0x4c')](hopperContacts))[_0xd366('0x40')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x317fef;}function _0x570383(_0x4448e7,_0x1d4294){var _0x226a75=squel[_0xd366('0x33')]()[_0xd366('0x46')](_0xd366('0x4d'))[_0xd366('0x47')]([_0xd366('0x35'),'ContactId',_0xd366('0x38'),_0x1d4294,_0xd366('0x4b'),_0xd366('0x39')],squel[_0xd366('0x3a')]()[_0xd366('0x3b')](_0xd366('0x35'),'phone')[_0xd366('0x3b')]('id','ContactId')['field'](LISTID[_0xd366('0x3d')](),_0xd366('0x38'))[_0xd366('0x3b')](_0x4448e7['id'][_0xd366('0x3d')](),_0x1d4294)[_0xd366('0x3b')](_0xd366('0x3c'),_0xd366('0x4b'))[_0xd366('0x3b')](_0xd366('0x3c'),_0xd366('0x39'))[_0xd366('0x3e')]('cm_contacts')[_0xd366('0x40')]('deletedAt\x20IS\x20NULL')[_0xd366('0x40')](_0xd366('0x42'),LISTID['toString']())[_0xd366('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xd366('0x40')](_0xd366('0x43')))['toString']();return _0x226a75;}return db[_0xd366('0x4e')][_0xd366('0x4f')]({'where':{'type':_0xd366('0x50')},'attributes':['id',_0xd366('0x51')],'include':[{'model':db['CmList'],'as':_0xd366('0x52'),'where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x7a3c95){var _0x569a5e=[];if(_0x7a3c95){var _0x340852;for(var _0x3302e7=0x0,_0x55e2b4;_0x3302e7<_0x7a3c95[_0xd366('0x26')];_0x3302e7+=0x1){_0x55e2b4=_0x7a3c95[_0x3302e7][_0xd366('0x54')]({'plain':!![]});switch(_0x55e2b4['dialCheckDuplicateType']){case'always':_0x569a5e[_0xd366('0x2c')](db[_0xd366('0x55')]['query'](_0x4e2e9f(_0x55e2b4,_0xd366('0x56')))['then'](function(){})[_0xd366('0x2d')](_0x419371()));break;case _0xd366('0x57'):_0x569a5e['push'](db['sequelize'][_0xd366('0x58')](_0x4ce15b(_0x55e2b4,_0xd366('0x56')))['then'](function(){})[_0xd366('0x2d')](_0x419371()));break;default:_0x569a5e['push'](db[_0xd366('0x55')]['query'](_0x12c99f(_0x55e2b4,_0xd366('0x56')))[_0xd366('0x53')](function(){})['catch'](_0x419371()));}}}return _0x569a5e;})[_0xd366('0x59')]()['then'](function(){return db[_0xd366('0x4e')]['findAll']({'where':{'type':_0xd366('0x50')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x36868f){var _0x44acdc=[];if(_0x36868f){var _0xb381e0;for(var _0x56cc3f=0x0,_0x28d375;_0x56cc3f<_0x36868f[_0xd366('0x26')];_0x56cc3f+=0x1){_0x28d375=_0x36868f[_0x56cc3f][_0xd366('0x54')]({'plain':!![]});_0x44acdc['push'](db['sequelize'][_0xd366('0x58')](_0x570383(_0x28d375,'VoiceQueueId'))[_0xd366('0x53')](function(){})['catch'](_0x419371()));}}return _0x44acdc;})[_0xd366('0x59')]();})[_0xd366('0x53')](function(){return db[_0xd366('0x5a')][_0xd366('0x4f')]({'attributes':['id',_0xd366('0x51')],'include':[{'model':db[_0xd366('0x5b')],'as':_0xd366('0x52'),'where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x4c0232){var _0x54b6f1=[];if(_0x4c0232){for(var _0x475574=0x0,_0x3a3b61;_0x475574<_0x4c0232[_0xd366('0x26')];_0x475574+=0x1){_0x3a3b61=_0x4c0232[_0x475574][_0xd366('0x54')]({'plain':!![]});switch(_0x3a3b61[_0xd366('0x51')]){case'always':_0x54b6f1[_0xd366('0x2c')](db[_0xd366('0x55')]['query'](_0x4e2e9f(_0x3a3b61,'CampaignId'))[_0xd366('0x53')](function(){})['catch'](_0x419371()));break;case _0xd366('0x57'):_0x54b6f1['push'](db[_0xd366('0x55')][_0xd366('0x58')](_0x4ce15b(_0x3a3b61,_0xd366('0x5c')))[_0xd366('0x53')](function(){})[_0xd366('0x2d')](_0x419371()));break;default:_0x54b6f1[_0xd366('0x2c')](db['sequelize']['query'](_0x12c99f(_0x3a3b61,'CampaignId'))[_0xd366('0x53')](function(){})[_0xd366('0x2d')](_0x419371()));}}}return _0x54b6f1;})[_0xd366('0x59')]();})['then'](function(){return db[_0xd366('0x5a')][_0xd366('0x4f')]({'attributes':['id'],'include':[{'model':db[_0xd366('0x5b')],'as':_0xd366('0x5d'),'where':{'id':LISTID}}]})[_0xd366('0x53')](function(_0x4c3941){var _0x1f9d8e=[];if(_0x4c3941){for(var _0x5df08f=0x0,_0x3e51a4;_0x5df08f<_0x4c3941[_0xd366('0x26')];_0x5df08f+=0x1){_0x3e51a4=_0x4c3941[_0x5df08f][_0xd366('0x54')]({'plain':!![]});_0x1f9d8e[_0xd366('0x2c')](db['sequelize'][_0xd366('0x58')](_0x570383(_0x3e51a4,_0xd366('0x5c')))[_0xd366('0x53')](function(){})[_0xd366('0x2d')](_0x419371()));}}return _0x1f9d8e;})[_0xd366('0x59')]();})[_0xd366('0x2d')](function(_0x1fb73f){logger[_0xd366('0x13')]('cmContact,\x20%s,\x20%s',_0xd366('0x5e'),_0x1fb73f['message']);});}var processPromises=function(_0x4db43a){return BPromise[_0xd366('0x59')](promises)['then'](function(_0x4af2a6){})['catch'](function(_0x1f0fca){logger[_0xd366('0x13')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x1f0fca));})['finally'](function(){socket[_0xd366('0x5f')](_0xd366('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4db43a){return _0x4db43a['resume']();}});};var endCsv=function(){return BPromise[_0xd366('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xd366('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd366('0x62')](FILEPATH);}catch(_0x16ab0f){logger[_0xd366('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xd366('0x30')](_0x16ab0f));}finally{process['exit'](0x0);}});};process['on'](_0xd366('0x63'),function(){logger[_0xd366('0x64')](_0xd366('0x65'));endCsv();});function main(){return BPromise[_0xd366('0x61')]()[_0xd366('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd366('0x10')](',');return db['CmContact'][_0xd366('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd366('0x53')](function(_0x17993c){var _0x35f26d=fs[_0xd366('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd366('0x67')](_0x35f26d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c6401,_0x62b8a4){total+=0x1;var _0x244367=total;promises[_0xd366('0x2c')](checkRow(_0x1c6401,_0x17993c,_0x244367)[_0xd366('0x53')](function(){success+=0x1;})[_0xd366('0x2d')](function(_0x1173b1){if(_0x1173b1[_0xd366('0x13')]){errors+=0x1;delete _0x1173b1['error'];}else if(_0x1173b1['duplicate']){duplicates+=0x1;delete _0x1173b1['duplicate'];}rows[_0xd366('0x2c')](_0x1173b1);}));if(total%0xc8===0x0){_0x62b8a4[_0xd366('0x68')]();return processPromises(_0x62b8a4);}},'complete':function(){return processPromises()[_0xd366('0x53')](function(){logger[_0xd366('0x64')](_0xd366('0x69'));endCsv();});},'error':function(_0x5c0f85,_0x3938d9){logger['info'](_0xd366('0x6a'),JSON['stringify'](_0x5c0f85));endCsv();}});})['catch'](function(_0x206011){logger[_0xd366('0x13')](_0xd366('0x6b'),JSON[_0xd366('0x30')](_0x206011));});}main(); \ No newline at end of file +var _0x7ad8=['birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','CmContact','create','keys','then','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','phone','toString','NOW()','updatedAt','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_black','outbound','CmList','get','dialCheckDuplicateType','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','VoiceQueue','findAll','BlackLists','Campaign','always','CampaignId','all','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resume','resolve','contact:csv_','unlinkSync','exit','info','split','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid'];(function(_0x4131b0,_0x1afb33){var _0x1bcce2=function(_0x1c4893){while(--_0x1c4893){_0x4131b0['push'](_0x4131b0['shift']());}};_0x1bcce2(++_0x1afb33);}(_0x7ad8,0xb6));var _0x87ad=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x7ad8[_0x15dbca];return _0x326533;};'use strict';var BPromise=require(_0x87ad('0x0'));var util=require(_0x87ad('0x1'));var _=require(_0x87ad('0x2'));var fs=require('fs');var squel=require(_0x87ad('0x3'));var Papa=require('papaparse');var Redis=require(_0x87ad('0x4'));var db=require(_0x87ad('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x87ad('0x6'))(_0x87ad('0x7'));config[_0x87ad('0x8')]=_['defaults'](config['redis'],{'host':_0x87ad('0x9'),'port':0x18eb});var socket=require(_0x87ad('0xa'))(new Redis(config['redis']));require(_0x87ad('0xb'))[_0x87ad('0xc')](socket);try{if(!process['argv'][0x2]||process[_0x87ad('0xd')][0x2]===_0x87ad('0xe')||process[_0x87ad('0xd')][0x2]===_0x87ad('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x87ad('0xd')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0x87ad('0xd')][0x3]===_0x87ad('0xf')||!process[_0x87ad('0xd')][0x4]||process[_0x87ad('0xd')][0x4]===_0x87ad('0xe')||process[_0x87ad('0xd')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x87ad('0x10')](process[_0x87ad('0xd')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x87ad('0xd')][0x5]||process[_0x87ad('0xd')][0x5]===_0x87ad('0xe')||process[_0x87ad('0xd')][0x5]===_0x87ad('0xf')){throw new Error(_0x87ad('0x11'));}var LISTID=process[_0x87ad('0xd')][0x5];var COMPANYID=process[_0x87ad('0xd')][0x6]&&process[_0x87ad('0xd')][0x6]!=='undefined'&&process[_0x87ad('0xd')][0x6]!==_0x87ad('0xf')?process[_0x87ad('0xd')][0x6]:null;var DUPLICATES=process[_0x87ad('0xd')][0x7]&&process[_0x87ad('0xd')][0x7]!=='undefined'&&process[_0x87ad('0xd')][0x7]!==_0x87ad('0xf')?process['argv'][0x7]:null;if(!process[_0x87ad('0xd')][0x8]||process[_0x87ad('0xd')][0x8]===_0x87ad('0xe')||process[_0x87ad('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x87ad('0xd')][0x8];}catch(_0x342b0b){logger[_0x87ad('0x12')](_0x342b0b);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(_0x5a5d0d,_0x5e1e71,_0x5726fe,_0x2ee540){var _0x5c799e={'message':_0x5e1e71};_0x5c799e[_0x5a5d0d]=!![];if(_0x5726fe){_0x5c799e[_0x87ad('0x13')]=_0x5726fe;}if(_0x2ee540){_0x5c799e[_0x87ad('0x14')]=_0x2ee540;}return _0x5c799e;}function isEmail(_0x2f50c4){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))*$/[_0x87ad('0x15')](_0x2f50c4);}function checkRow(_0x571e28,_0x472079,_0x5482ea){return new BPromise(function(_0x1303db,_0x55ae42){if(_[_0x87ad('0x16')](_0x571e28)){return _0x55ae42(handleCheckRowError(_0x87ad('0x12'),_0x87ad('0x17'),null,_0x5482ea));}if(_0x571e28[_0x87ad('0x18')]&&_0x571e28[_0x87ad('0x18')]['length']){var _0x5c363d=_[_0x87ad('0x19')](_0x571e28['errors'],'message')[_0x87ad('0x1a')](';');return _0x55ae42(handleCheckRowError('error',_0x5c363d,null,_0x5482ea));}var _0x28e13e={};for(var _0x4b9fb8 in FIELDS){if(FIELDS[_0x87ad('0x1b')](_0x4b9fb8)&&FIELDS[_0x4b9fb8]){_0x28e13e[_0x4b9fb8]=_0x571e28['data'][0x0][FIELDS[_0x4b9fb8]]||_0x571e28['data'][0x0]['\ufeff'+FIELDS[_0x4b9fb8]];}}if(!_0x28e13e[_0x87ad('0x1c')]){return _0x55ae42(handleCheckRowError(_0x87ad('0x12'),_0x87ad('0x1d'),null,_0x5482ea));}if(!_0x28e13e['phone']){return _0x55ae42(handleCheckRowError('error',_0x87ad('0x1e'),null,_0x5482ea));}if(_0x28e13e['birthDate']){var _0x1dc308=moment(_0x28e13e[_0x87ad('0x1f')],_0x87ad('0x20'));if(!_0x1dc308[_0x87ad('0x21')]()){return _0x55ae42(handleCheckRowError(_0x87ad('0x12'),_0x87ad('0x22'),null,_0x5482ea));}}if(_0x28e13e[_0x87ad('0x23')]){if(!isEmail(_0x28e13e['email'])){return _0x55ae42(handleCheckRowError(_0x87ad('0x12'),_0x87ad('0x24'),null,_0x5482ea));}}_0x28e13e[_0x87ad('0x25')]=LISTID;_0x28e13e[_0x87ad('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x472079){var _0x52a1e8={};for(var _0x55d11b=0x0,_0x58d729=DUPLICATES[_0x87ad('0x27')];_0x55d11b<_0x58d729;_0x55d11b+=0x1){_0x52a1e8[DUPLICATES[_0x55d11b]]=_0x28e13e[DUPLICATES[_0x55d11b]];}var _0x6d294=_[_0x87ad('0x28')](_0x472079,_0x52a1e8);if(_0x6d294){return _0x55ae42(handleCheckRowError(_0x87ad('0x29'),'Duplicate\x20Contact',_0x6d294,_0x5482ea));}}return db[_0x87ad('0x2a')][_0x87ad('0x2b')](_0x28e13e,{'raw':!![],'hooks':![],'fields':_[_0x87ad('0x2c')](_0x28e13e)})[_0x87ad('0x2d')](function(_0x48e39e){if(DUPLICATES&&DUPLICATES[_0x87ad('0x27')]&&_0x472079){_0x472079['push'](_['pick'](_0x28e13e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x48e39e['id'];return _0x1303db();})['catch'](function(_0x204b2e){return _0x55ae42(handleCheckRowError(_0x87ad('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x204b2e[_0x87ad('0x2e')]||JSON[_0x87ad('0x2f')](_0x204b2e)),null,_0x5482ea));});});}function checkHopper(){function _0x1daae7(){return function(_0x44eefc){logger[_0x87ad('0x12')](_0x87ad('0x30'),_0x87ad('0x31'),util['inspect'](_0x44eefc,{'showHidden':![],'depth':null}));};}var _0x14c346=function(_0x140f5f,_0x25f510){var _0x4ff62f=squel[_0x87ad('0x32')]()[_0x87ad('0x33')](_0x87ad('0x34'))[_0x87ad('0x35')](['phone',_0x87ad('0x36'),_0x87ad('0x37'),'ListId',_0x25f510,_0x87ad('0x38'),'updatedAt'],squel[_0x87ad('0x39')]()[_0x87ad('0x3a')](_0x87ad('0x3b'),_0x87ad('0x3b'))[_0x87ad('0x3a')]('NOW()',_0x87ad('0x36'))[_0x87ad('0x3a')]('id',_0x87ad('0x37'))['field'](LISTID[_0x87ad('0x3c')](),_0x87ad('0x25'))[_0x87ad('0x3a')](_0x140f5f['id'][_0x87ad('0x3c')](),_0x25f510)[_0x87ad('0x3a')](_0x87ad('0x3d'),_0x87ad('0x38'))[_0x87ad('0x3a')](_0x87ad('0x3d'),_0x87ad('0x3e'))[_0x87ad('0x3f')]('cm_contacts')['where'](_0x87ad('0x40'))['where'](_0x87ad('0x41'),LISTID[_0x87ad('0x3c')]())[_0x87ad('0x42')](_0x87ad('0x43'))[_0x87ad('0x42')](_0x87ad('0x44'),squel[_0x87ad('0x39')]()[_0x87ad('0x3a')](_0x87ad('0x3b'))[_0x87ad('0x3f')](_0x87ad('0x34'))[_0x87ad('0x42')](_0x25f510+_0x87ad('0x45'),_0x140f5f['id'][_0x87ad('0x3c')]())))[_0x87ad('0x3c')]();return _0x4ff62f;};var _0x38477a=function(_0x5bcdcc,_0xbf3dcd){var _0x3c24e5=squel['insert']()[_0x87ad('0x33')]('cm_hopper')[_0x87ad('0x35')]([_0x87ad('0x3b'),'scheduledAt',_0x87ad('0x37'),_0x87ad('0x25'),_0xbf3dcd,_0x87ad('0x38'),_0x87ad('0x3e')],squel[_0x87ad('0x39')]()['field']('phone',_0x87ad('0x3b'))[_0x87ad('0x3a')]('NOW()',_0x87ad('0x36'))[_0x87ad('0x3a')]('id',_0x87ad('0x37'))[_0x87ad('0x3a')](LISTID[_0x87ad('0x3c')](),_0x87ad('0x25'))[_0x87ad('0x3a')](_0x5bcdcc['id'][_0x87ad('0x3c')](),_0xbf3dcd)[_0x87ad('0x3a')](_0x87ad('0x3d'),'createdAt')[_0x87ad('0x3a')](_0x87ad('0x3d'),'updatedAt')[_0x87ad('0x3f')](_0x87ad('0x46'))[_0x87ad('0x42')](_0x87ad('0x40'))[_0x87ad('0x42')]('ListId\x20=\x20?',LISTID[_0x87ad('0x3c')]())[_0x87ad('0x42')](_0x87ad('0x47'),squel[_0x87ad('0x48')](hopperContacts))[_0x87ad('0x42')](_0x87ad('0x43'))[_0x87ad('0x42')](_0x87ad('0x44'),squel['select']()['field'](_0x87ad('0x49'))['from']('cm_hopper_final')[_0x87ad('0x42')](_0xbf3dcd+_0x87ad('0x45'),_0x5bcdcc['id'][_0x87ad('0x3c')]()))[_0x87ad('0x42')](_0x87ad('0x44'),squel[_0x87ad('0x39')]()['field'](_0x87ad('0x3b'))[_0x87ad('0x3f')](_0x87ad('0x34'))[_0x87ad('0x42')](_0xbf3dcd+_0x87ad('0x45'),_0x5bcdcc['id']['toString']())))[_0x87ad('0x3c')]();return _0x3c24e5;};function _0x9bfa96(_0x5357a5,_0x5d7777){var _0x52198d=squel[_0x87ad('0x32')]()[_0x87ad('0x33')](_0x87ad('0x34'))[_0x87ad('0x35')]([_0x87ad('0x3b'),_0x87ad('0x36'),_0x87ad('0x37'),_0x87ad('0x25'),_0x5d7777,_0x87ad('0x38'),'updatedAt'],squel[_0x87ad('0x39')]()[_0x87ad('0x3a')](_0x87ad('0x3b'),_0x87ad('0x3b'))['field'](_0x87ad('0x3d'),_0x87ad('0x36'))[_0x87ad('0x3a')]('id',_0x87ad('0x37'))[_0x87ad('0x3a')](LISTID['toString'](),_0x87ad('0x25'))[_0x87ad('0x3a')](_0x5357a5['id'][_0x87ad('0x3c')](),_0x5d7777)[_0x87ad('0x3a')](_0x87ad('0x3d'),_0x87ad('0x38'))['field'](_0x87ad('0x3d'),_0x87ad('0x3e'))[_0x87ad('0x3f')](_0x87ad('0x46'))[_0x87ad('0x42')](_0x87ad('0x40'))['where'](_0x87ad('0x41'),LISTID[_0x87ad('0x3c')]())[_0x87ad('0x42')](_0x87ad('0x47'),squel[_0x87ad('0x48')](hopperContacts))[_0x87ad('0x42')](_0x87ad('0x43')))[_0x87ad('0x3c')]();return _0x52198d;}function _0x248f81(_0x32a164,_0x44c26c){var _0x36a888=squel[_0x87ad('0x32')]()[_0x87ad('0x33')](_0x87ad('0x4a'))[_0x87ad('0x35')](['phone',_0x87ad('0x37'),_0x87ad('0x25'),_0x44c26c,_0x87ad('0x38'),_0x87ad('0x3e')],squel[_0x87ad('0x39')]()[_0x87ad('0x3a')](_0x87ad('0x3b'),_0x87ad('0x3b'))[_0x87ad('0x3a')]('id',_0x87ad('0x37'))[_0x87ad('0x3a')](LISTID[_0x87ad('0x3c')](),_0x87ad('0x25'))[_0x87ad('0x3a')](_0x32a164['id'][_0x87ad('0x3c')](),_0x44c26c)[_0x87ad('0x3a')]('NOW()','createdAt')[_0x87ad('0x3a')]('NOW()',_0x87ad('0x3e'))[_0x87ad('0x3f')](_0x87ad('0x46'))[_0x87ad('0x42')](_0x87ad('0x40'))[_0x87ad('0x42')](_0x87ad('0x41'),LISTID['toString']())[_0x87ad('0x42')](_0x87ad('0x47'),squel['str'](hopperContacts))[_0x87ad('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x87ad('0x3c')]();return _0x36a888;}return db['VoiceQueue']['findAll']({'where':{'type':_0x87ad('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x87ad('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x87ad('0x2d')](function(_0x30c309){var _0x10b645=[];if(_0x30c309){var _0x5aa4fd;for(var _0x52f23a=0x0,_0x57799c;_0x52f23a<_0x30c309[_0x87ad('0x27')];_0x52f23a+=0x1){_0x57799c=_0x30c309[_0x52f23a][_0x87ad('0x4d')]({'plain':!![]});switch(_0x57799c[_0x87ad('0x4e')]){case'always':_0x10b645[_0x87ad('0x4f')](db[_0x87ad('0x50')]['query'](_0x38477a(_0x57799c,_0x87ad('0x51')))[_0x87ad('0x2d')](function(){})[_0x87ad('0x52')](_0x1daae7()));break;case _0x87ad('0x53'):_0x10b645[_0x87ad('0x4f')](db[_0x87ad('0x50')][_0x87ad('0x54')](_0x14c346(_0x57799c,_0x87ad('0x51')))[_0x87ad('0x2d')](function(){})[_0x87ad('0x52')](_0x1daae7()));break;default:_0x10b645['push'](db['sequelize']['query'](_0x9bfa96(_0x57799c,_0x87ad('0x51')))[_0x87ad('0x2d')](function(){})['catch'](_0x1daae7()));}}}return _0x10b645;})['all']()['then'](function(){return db[_0x87ad('0x55')][_0x87ad('0x56')]({'where':{'type':_0x87ad('0x4b')},'attributes':['id'],'include':[{'model':db[_0x87ad('0x4c')],'as':_0x87ad('0x57'),'where':{'id':LISTID}}]})[_0x87ad('0x2d')](function(_0x5682a9){var _0x5d816f=[];if(_0x5682a9){var _0x375446;for(var _0x4983c7=0x0,_0x5c0341;_0x4983c7<_0x5682a9[_0x87ad('0x27')];_0x4983c7+=0x1){_0x5c0341=_0x5682a9[_0x4983c7]['get']({'plain':!![]});_0x5d816f[_0x87ad('0x4f')](db[_0x87ad('0x50')]['query'](_0x248f81(_0x5c0341,'VoiceQueueId'))['then'](function(){})[_0x87ad('0x52')](_0x1daae7()));}}return _0x5d816f;})['all']();})[_0x87ad('0x2d')](function(){return db[_0x87ad('0x58')][_0x87ad('0x56')]({'attributes':['id',_0x87ad('0x4e')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x87ad('0x2d')](function(_0x370647){var _0x4fb2d2=[];if(_0x370647){for(var _0x232d31=0x0,_0x4e529f;_0x232d31<_0x370647['length'];_0x232d31+=0x1){_0x4e529f=_0x370647[_0x232d31][_0x87ad('0x4d')]({'plain':!![]});switch(_0x4e529f[_0x87ad('0x4e')]){case _0x87ad('0x59'):_0x4fb2d2[_0x87ad('0x4f')](db['sequelize']['query'](_0x38477a(_0x4e529f,_0x87ad('0x5a')))[_0x87ad('0x2d')](function(){})[_0x87ad('0x52')](_0x1daae7()));break;case'onlyIfOpen':_0x4fb2d2[_0x87ad('0x4f')](db['sequelize'][_0x87ad('0x54')](_0x14c346(_0x4e529f,_0x87ad('0x5a')))['then'](function(){})[_0x87ad('0x52')](_0x1daae7()));break;default:_0x4fb2d2[_0x87ad('0x4f')](db[_0x87ad('0x50')]['query'](_0x9bfa96(_0x4e529f,_0x87ad('0x5a')))[_0x87ad('0x2d')](function(){})[_0x87ad('0x52')](_0x1daae7()));}}}return _0x4fb2d2;})[_0x87ad('0x5b')]();})[_0x87ad('0x2d')](function(){return db[_0x87ad('0x58')][_0x87ad('0x56')]({'attributes':['id'],'include':[{'model':db[_0x87ad('0x4c')],'as':_0x87ad('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x2fdfea){var _0x441138=[];if(_0x2fdfea){for(var _0x62a911=0x0,_0xcab915;_0x62a911<_0x2fdfea[_0x87ad('0x27')];_0x62a911+=0x1){_0xcab915=_0x2fdfea[_0x62a911][_0x87ad('0x4d')]({'plain':!![]});_0x441138[_0x87ad('0x4f')](db[_0x87ad('0x50')][_0x87ad('0x54')](_0x248f81(_0xcab915,_0x87ad('0x5a')))[_0x87ad('0x2d')](function(){})[_0x87ad('0x52')](_0x1daae7()));}}return _0x441138;})[_0x87ad('0x5b')]();})[_0x87ad('0x52')](function(_0x293b68){logger[_0x87ad('0x12')]('cmContact,\x20%s,\x20%s',_0x87ad('0x5c'),_0x293b68['message']);});}var processPromises=function(_0x1254dc){return BPromise[_0x87ad('0x5b')](promises)[_0x87ad('0x2d')](function(_0x4a1686){})['catch'](function(_0x2a247b){logger[_0x87ad('0x12')](_0x87ad('0x5d'),JSON[_0x87ad('0x2f')](_0x2a247b));})['finally'](function(){socket[_0x87ad('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1254dc){return _0x1254dc[_0x87ad('0x5f')]();}});};var endCsv=function(){return BPromise[_0x87ad('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x87ad('0x2d')](function(){socket[_0x87ad('0x5e')](_0x87ad('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x87ad('0x62')](FILEPATH);}catch(_0x55682c){logger[_0x87ad('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x87ad('0x2f')](_0x55682c));}finally{process[_0x87ad('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0x87ad('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x87ad('0x60')]()[_0x87ad('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x87ad('0x65')](',');return db['CmContact'][_0x87ad('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x87ad('0x2d')](function(_0x3c9321){var _0x3b9763=fs[_0x87ad('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x87ad('0x67')](_0x3b9763,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2b29a3,_0x470799){total+=0x1;var _0x35bc12=total;promises[_0x87ad('0x4f')](checkRow(_0x2b29a3,_0x3c9321,_0x35bc12)[_0x87ad('0x2d')](function(){success+=0x1;})[_0x87ad('0x52')](function(_0x229f4a){if(_0x229f4a[_0x87ad('0x12')]){errors+=0x1;delete _0x229f4a['error'];}else if(_0x229f4a[_0x87ad('0x29')]){duplicates+=0x1;delete _0x229f4a['duplicate'];}rows['push'](_0x229f4a);}));if(total%0xc8===0x0){_0x470799[_0x87ad('0x68')]();return processPromises(_0x470799);}},'complete':function(){return processPromises()[_0x87ad('0x2d')](function(){logger[_0x87ad('0x64')](_0x87ad('0x69'));endCsv();});},'error':function(_0xaa777d,_0xe084be){logger[_0x87ad('0x64')](_0x87ad('0x6a'),JSON[_0x87ad('0x2f')](_0xaa777d));endCsv();}});})[_0x87ad('0x52')](function(_0x329c1c){logger['error'](_0x87ad('0x6b'),JSON[_0x87ad('0x2f')](_0x329c1c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 5197d23..ebdfa1b 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 _0xef25=['\x20not\x20specified','itemTypeId','replace','SystemRow','appendFileSync','rows','contact:import:','Abort\x20parser','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','contactId','orderBy','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','each','affectedRows','emit','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','push','split','length','all','filter','CmContactHasItem','findOne','update','updated','create','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.phone','cm_hopper_black','cm_contacts','.CmListId','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','toString','cm_hopper.id','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?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','info','Received\x20SIGINT','error','message','errors','code','sequelize','query','catch','campaigns.id','campaigns','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','spread','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','includes','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','find','hasOwnProperty','trim','isNaN','isNumber','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)'];(function(_0x4e0267,_0x30d7bc){var _0x515111=function(_0x4d8d11){while(--_0x4d8d11){_0x4e0267['push'](_0x4e0267['shift']());}};_0x515111(++_0x30d7bc);}(_0xef25,0x184));var _0x5ef2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xef25[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x5ef2('0x0'));var Papa=require(_0x5ef2('0x1'));var util=require(_0x5ef2('0x2'));var BPromise=require('bluebird');var moment=require(_0x5ef2('0x3'));var squel=require(_0x5ef2('0x4'));var Redis=require(_0x5ef2('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x5ef2('0x6'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0x5ef2('0x7'));config[_0x5ef2('0x8')]=_[_0x5ef2('0x9')](config[_0x5ef2('0x8')],{'host':_0x5ef2('0xa'),'port':0x18eb});var socket=require(_0x5ef2('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x5ef2('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5ef2('0xd')](_0x5ef2('0xc'));function isEmail(_0x3a1b1c){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'](_0x3a1b1c);}function selectNotIn(_0x3baa3e,_0x4374af,_0x1a683b,_0x2cdaeb,_0x23a5b4){return squel[_0x5ef2('0xe')]()[_0x5ef2('0xf')](_0x5ef2('0x10'))[_0x5ef2('0x11')](_0x2cdaeb)[_0x5ef2('0x12')](_0x4374af,null,_0x4374af+_0x5ef2('0x13')+_0x2cdaeb+'.'+_0x1a683b)[_0x5ef2('0x14')](_0x2cdaeb+'.'+_0x1a683b+'\x20=\x20'+_0x3baa3e+'.'+_0x1a683b)['where'](_0x4374af+_0x5ef2('0x15')+_0x23a5b4[_0x5ef2('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x548b18,_0x408aec){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x5ef2('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5ef2('0x17')](function(_0x346a3c){if(_0x346a3c!==null){var _0x7889d9=[];for(var _0x3a2107=0x0;_0x3a2107<_0x346a3c['length'];_0x3a2107++){var _0x346e95=_0x346a3c[_0x3a2107];_0x7889d9[_0x5ef2('0x18')](insertAdditionalPhones(_0x346e95));}}Promise['all'](_0x7889d9)['then'](function(){_0x548b18({'val':0x1});});});});}function insertAdditionalPhones(_0xafaf50){return new Promise(function(_0x46a704,_0x211139){var _0x2b801d=_0xafaf50['AdditionalPhones'];var _0x52a99a=_0x2b801d[_0x5ef2('0x19')](';');var _0x58514d=[];orderBy=0x0;for(var _0x159c34=0x0;_0x159c34<_0x52a99a[_0x5ef2('0x1a')];_0x159c34++){_0x58514d['push'](splitAdditionalPhone(_0xafaf50['id'],_0x52a99a[_0x159c34]));}Promise[_0x5ef2('0x1b')](_0x58514d)['then'](function(){_0x46a704({'val':_0x52a99a['length']});});});}function splitAdditionalPhone(_0xaddc3c,_0x1b451d){return new Promise(function(_0x21fc79,_0x4c92ef){var _0x299db5=_0x1b451d[_0x5ef2('0x19')](':');var _0x2a395d=_0x299db5[0x0];var _0x5ec2d3=_0x299db5[0x1];if(!_['isNil'](_0x5ec2d3)){var _0x5206e9=_0x5ec2d3[_0x5ef2('0x19')]('|');var _0x580edc=[];for(var _0x4bf2fc=0x0;_0x4bf2fc<_0x5206e9[_0x5ef2('0x1a')];_0x4bf2fc++){if(_0x5206e9[_0x4bf2fc]!==''){var _0x3c3530=_[_0x5ef2('0x1c')](promisesAdditionalPhones,{'contactId':_0xaddc3c,'phone':_0x5206e9[_0x4bf2fc]});if(_0x3c3530['length']==0x0){orderBy++;promisesAdditionalPhones[_0x5ef2('0x18')]({'contactId':_0xaddc3c,'contactTypeId':_0x2a395d,'phone':_0x5206e9[_0x4bf2fc],'orderBy':orderBy});}}}_0x21fc79({'ok':0x1});}else _0x21fc79({'res':0x0});});}function createAdditionalPhone(_0x58bba0,_0x43d972,_0x3573e8,_0xcdf2d4){var _0x148767='';var _0x4fe42a='';var _0x2e748b=_0x3573e8[_0x5ef2('0x19')]('§');_0x148767=_0x2e748b[0x0];if(_0x2e748b[_0x5ef2('0x1a')]==0x2)_0x4fe42a=_0x2e748b[0x1];return new Promise(function(_0x5d49b7,_0x2bacb4){return db[_0x5ef2('0x1d')][_0x5ef2('0x1e')]({'where':{'CmContactId':_0x58bba0,'item':_0x148767}})[_0x5ef2('0x17')](function(_0x52f43b){if(_0x52f43b){return db[_0x5ef2('0x1d')][_0x5ef2('0x1f')]({'ItemTypeId':_0x43d972,'description':_0x4fe42a,'OrderBy':_0xcdf2d4},{'where':{'CmContactId':_0x58bba0,'item':_0x148767}})['then'](function(_0x58b4f8){_0x5d49b7({'res':_0x5ef2('0x20')});});}else{return db['CmContactHasItem'][_0x5ef2('0x21')]({'CmContactId':_0x58bba0,'item':_0x148767,'description':_0x4fe42a,'ItemTypeId':_0x43d972,'OrderBy':_0xcdf2d4,'ItemClass':'PHONE'})[_0x5ef2('0x17')](function(_0x3df48e){_0x5d49b7({'res':'inserted'});});}});});}function insertCmHopper(_0x588db2,_0x407a01,_0x410ba7,_0x3497e5,_0x2951fc){var _0x1078b7=['cm_contacts.phone','cm_contacts.scheduledat',_0x5ef2('0x22'),_0x5ef2('0x23'),_0x407a01+'.'+_0x3497e5,_0x5ef2('0x24'),_0x5ef2('0x25'),_0x5ef2('0x26'),_0x5ef2('0x27'),'\x22'+_0x2951fc+'\x22'];return squel[_0x5ef2('0x28')]()[_0x5ef2('0x29')](_0x5ef2('0x2a'))[_0x5ef2('0x2b')](['phone',_0x5ef2('0x2c'),_0x5ef2('0x2d'),_0x5ef2('0x2e'),_0x3497e5,_0x5ef2('0x2f'),_0x5ef2('0x30'),_0x5ef2('0x31'),_0x5ef2('0x32'),'recallme'],squel[_0x5ef2('0xe')]()[_0x5ef2('0x33')](_0x1078b7)[_0x5ef2('0x11')](_0x407a01)[_0x5ef2('0x12')]('cm_contacts',null,_0x5ef2('0x34')+_0x407a01+'.CmListId')[_0x5ef2('0x12')](_0x410ba7,null,_0x410ba7+_0x5ef2('0x13')+_0x407a01+'.'+_0x3497e5)[_0x5ef2('0x14')](_0x407a01+_0x5ef2('0x35'),_0x588db2)[_0x5ef2('0x14')](_0x5ef2('0x36'),NOW)[_0x5ef2('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x407a01,_0x410ba7,_0x3497e5,_0x5ef2('0x2a'),[_0x5ef2('0x37'),_0x5ef2('0x38')]))[_0x5ef2('0x14')](_0x5ef2('0x39'),selectNotIn(_0x407a01,_0x410ba7,_0x3497e5,'cm_hopper',[_0x5ef2('0x37')])))['toString']();}function insertCmHopperBlack(_0x16e648,_0x544155,_0x38fbf1,_0x23c348){var _0x5172b0=[_0x5ef2('0x3a'),_0x5ef2('0x22'),_0x5ef2('0x23'),_0x544155+'.'+_0x23c348,_0x5ef2('0x24'),_0x5ef2('0x25')];return squel[_0x5ef2('0x28')]()[_0x5ef2('0x29')](_0x5ef2('0x3b'))[_0x5ef2('0x2b')](['phone',_0x5ef2('0x2d'),_0x5ef2('0x2e'),_0x23c348,'createdAt',_0x5ef2('0x30')],squel[_0x5ef2('0xe')]()[_0x5ef2('0x33')](_0x5172b0)['from'](_0x544155)[_0x5ef2('0x12')](_0x5ef2('0x3c'),null,_0x5ef2('0x34')+_0x544155+_0x5ef2('0x3d'))[_0x5ef2('0x12')](_0x38fbf1,null,_0x38fbf1+_0x5ef2('0x13')+_0x544155+'.'+_0x23c348)['where'](_0x544155+_0x5ef2('0x35'),_0x16e648)[_0x5ef2('0x14')](_0x5ef2('0x36'),NOW)['where'](_0x5ef2('0x39'),squel[_0x5ef2('0xe')]()[_0x5ef2('0xf')](_0x5ef2('0x10'))[_0x5ef2('0x11')](_0x5ef2('0x3b'))['where'](_0x5ef2('0x3e'),_0x16e648)[_0x5ef2('0x14')](_0x23c348+_0x5ef2('0x3f')+_0x544155+'.'+_0x23c348)))['toString']();}function insertTzCmHopper(_0x3b74cb,_0x572284,_0x173a7a,_0x5b8236,_0x10cb35,_0x16f671){var _0xf44e38=[_0x5ef2('0x3a'),_0x5ef2('0x40')+_0x16f671+'.offset-cm_contacts.utcOffset\x20minute)',_0x5ef2('0x22'),_0x5ef2('0x23'),_0x572284+'.'+_0x5b8236,_0x5ef2('0x24'),_0x5ef2('0x25'),_0x5ef2('0x26'),'cm_contacts.UserId','\x22'+_0x10cb35+'\x22'];var _0x33f76b=squel['insert']()['into'](_0x5ef2('0x2a'))[_0x5ef2('0x2b')]([_0x5ef2('0x10'),_0x5ef2('0x2c'),_0x5ef2('0x2d'),_0x5ef2('0x2e'),_0x5b8236,_0x5ef2('0x2f'),_0x5ef2('0x30'),_0x5ef2('0x31'),'UserId','recallme'],squel[_0x5ef2('0xe')]()[_0x5ef2('0x33')](_0xf44e38)[_0x5ef2('0x11')](_0x572284)[_0x5ef2('0x12')](_0x5ef2('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x572284+_0x5ef2('0x3d'))[_0x5ef2('0x12')](_0x173a7a,null,_0x173a7a+_0x5ef2('0x13')+_0x572284+'.'+_0x5b8236)['join'](_0x16f671,null,_0x16f671+_0x5ef2('0x13')+_0x572284+'.'+_0x5b8236)[_0x5ef2('0x14')](_0x572284+_0x5ef2('0x35'),_0x3b74cb)['where'](_0x5ef2('0x36'),NOW)[_0x5ef2('0x14')](_0x5ef2('0x39'),selectNotIn(_0x572284,_0x173a7a,_0x5b8236,_0x5ef2('0x2a'),[_0x5ef2('0x37'),_0x5ef2('0x38')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x572284,_0x173a7a,_0x5b8236,_0x5ef2('0x2a'),[_0x5ef2('0x37')])))[_0x5ef2('0x41')]();return _0x33f76b;}function insertTzCmHopperBlack(_0x575530,_0x5ec7d1,_0x1b4b2d,_0x539081){var _0x549450=['cm_contacts.phone',_0x5ef2('0x22'),'cm_contacts.ListId',_0x5ec7d1+'.'+_0x539081,_0x5ef2('0x24'),_0x5ef2('0x25')];return squel[_0x5ef2('0x28')]()['into'](_0x5ef2('0x3b'))[_0x5ef2('0x2b')]([_0x5ef2('0x10'),_0x5ef2('0x2d'),_0x5ef2('0x2e'),_0x539081,'createdAt',_0x5ef2('0x30')],squel['select']()[_0x5ef2('0x33')](_0x549450)[_0x5ef2('0x11')](_0x5ec7d1)[_0x5ef2('0x12')](_0x5ef2('0x3c'),null,_0x5ef2('0x34')+_0x5ec7d1+_0x5ef2('0x3d'))[_0x5ef2('0x12')](_0x1b4b2d,null,_0x1b4b2d+_0x5ef2('0x13')+_0x5ec7d1+'.'+_0x539081)[_0x5ef2('0x14')](_0x5ec7d1+_0x5ef2('0x35'),_0x575530)[_0x5ef2('0x14')](_0x5ef2('0x36'),NOW)[_0x5ef2('0x14')](_0x5ef2('0x39'),squel[_0x5ef2('0xe')]()[_0x5ef2('0xf')](_0x5ef2('0x10'))[_0x5ef2('0x11')]('cm_hopper_black')['where'](_0x5ef2('0x3e'),_0x575530)[_0x5ef2('0x14')](_0x539081+_0x5ef2('0x3f')+_0x5ec7d1+'.'+_0x539081)))['toString']();}function insertCmHopperAdditionalPhones(_0xa1c76f){var _0x2e16db=[_0x5ef2('0x42'),'cm_contact_has_items.item',_0x5ef2('0x43'),_0x5ef2('0x44'),_0x5ef2('0x45')];return squel[_0x5ef2('0x28')]()[_0x5ef2('0x29')](_0x5ef2('0x46'))['fromQuery']([_0x5ef2('0x47'),_0x5ef2('0x10'),_0x5ef2('0x48'),'createdAt',_0x5ef2('0x30')],squel[_0x5ef2('0xe')]()[_0x5ef2('0x33')](_0x2e16db)['from'](_0x5ef2('0x2a'))[_0x5ef2('0x12')]('cm_contacts',null,_0x5ef2('0x49'))[_0x5ef2('0x12')](_0x5ef2('0x4a'),null,_0x5ef2('0x4b'))[_0x5ef2('0x14')](_0x5ef2('0x4c'),_0xa1c76f)[_0x5ef2('0x14')](_0x5ef2('0x36'),NOW))[_0x5ef2('0x41')]();}function insertCmContact(_0x42fa15,_0x34d58c,_0x1c0a0a,_0x4b044d){var _0x294030=_[_0x5ef2('0x4d')](_[_0x5ef2('0x4e')](_0x4b044d),['ListId',_0x5ef2('0x4f'),_0x5ef2('0x2f'),'updatedAt',_0x5ef2('0x50')]);return squel[_0x5ef2('0x28')]()[_0x5ef2('0x29')](_0x5ef2('0x3c'))[_0x5ef2('0x2b')](_0x294030,squel[_0x5ef2('0xe')]()['fields'](_0x294030)[_0x5ef2('0x11')](_0x34d58c)['where']('('+_0x1c0a0a[_0x5ef2('0x12')](',')+_0x5ef2('0x51'),squel['select']()[_0x5ef2('0x33')](_0x1c0a0a)[_0x5ef2('0x11')](_0x5ef2('0x3c'))[_0x5ef2('0x14')](_0x5ef2('0x3e'),_0x42fa15)['where']('deletedAt\x20IS\x20NULL'))[_0x5ef2('0x14')](_0x5ef2('0x52'),squel[_0x5ef2('0xe')]()['field']('MIN(id)','min_id')[_0x5ef2('0x11')](_0x34d58c)[_0x5ef2('0x53')](_0x1c0a0a[_0x5ef2('0x12')](','))))['toString']();}function handleStop(){logger[_0x5ef2('0x54')](_0x5ef2('0x55'));stopped=!![];}function handleUncaughtException(_0x44270d){logger[_0x5ef2('0x56')](_0x44270d[_0x5ef2('0x57')]);process['exit'](0x1);}function handleError(_0x5ec810,_0x474701){stats[_0x5ef2('0x58')][_0x5ef2('0x18')]({'name':_0x474701[_0x5ef2('0x59')],'message':_0x474701[_0x5ef2('0x57')],'row':_0x5ec810});}function handleQuery(_0x137bf4){logger[_0x5ef2('0x54')](_0x137bf4);return db[_0x5ef2('0x5a')][_0x5ef2('0x5b')](_0x137bf4)['spread'](function(_0x1d4aa6){results[_0x5ef2('0x18')](_0x1d4aa6);})[_0x5ef2('0x5c')](function(_0x14aa29){logger[_0x5ef2('0x56')](_0x14aa29[_0x5ef2('0x57')]);});}function updateTzCampaigns(_0x3db55c){return new Promise(function(_0x44d243,_0x477630){var _0x462cc0=squel[_0x5ef2('0xe')]()['fields']([_0x5ef2('0x5d'),'campaigns.dialTimezone'])['from'](_0x5ef2('0x5e'))[_0x5ef2('0x12')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x5ef2('0x14')](_0x5ef2('0x5f')+_0x3db55c);db[_0x5ef2('0x5a')]['query'](_0x462cc0['toString']())['spread'](function(_0x28e80c){var _0x14747e=[];for(var _0x43d69a=0x0;_0x43d69a<_0x28e80c[_0x5ef2('0x1a')];_0x43d69a++){_0x14747e['push'](getTimezoneData(_0x28e80c[_0x43d69a],tmp_campaigns));}BPromise[_0x5ef2('0x1b')](_0x14747e)[_0x5ef2('0x17')](function(){_0x44d243({'val':0x1});});})[_0x5ef2('0x5c')](function(_0x18691f){logger[_0x5ef2('0x56')](_0x18691f[_0x5ef2('0x57')]);_0x44d243({'val':0x0});});});}function updateTzVoiceQueues(_0x5955c6){return new Promise(function(_0x3b2ff7,_0x3bfb17){var _0x5335c0=squel[_0x5ef2('0xe')]()[_0x5ef2('0x33')](['voice_queues.id',_0x5ef2('0x60')])[_0x5ef2('0x11')](_0x5ef2('0x61'))[_0x5ef2('0x12')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x5ef2('0x14')](_0x5ef2('0x62')+_0x5955c6);db[_0x5ef2('0x5a')][_0x5ef2('0x5b')](_0x5335c0['toString']())['spread'](function(_0x54c32a){var _0x49778e=[];for(var _0x497b1a=0x0;_0x497b1a<_0x54c32a[_0x5ef2('0x1a')];_0x497b1a++){_0x49778e[_0x5ef2('0x18')](getTimezoneData(_0x54c32a[_0x497b1a],tmp_voice_queues));}BPromise[_0x5ef2('0x1b')](_0x49778e)['then'](function(){_0x3b2ff7({'val':0x1});});})[_0x5ef2('0x5c')](function(_0x451d82){logger['error'](_0x451d82['message']);_0x3b2ff7({'val':0x0});});});}function getTimezoneData(_0x549ac5,_0x5700dd){return new Promise(function(_0x4a9ca5,_0x4621f7){var _0x2e83b0=shared['timezones'];var _0x515af4=_0x2e83b0[_0x549ac5[_0x5ef2('0x63')]];if(_[_0x5ef2('0x64')](_0x515af4)){_0x4a9ca5({'ret':0x1});}else{var _0x500904=_0x515af4[_0x5ef2('0x65')];var _0x2492b9=squel[_0x5ef2('0x28')]()['into'](_0x5700dd)[_0x5ef2('0x66')]('id',_0x549ac5['id'])[_0x5ef2('0x66')](_0x5ef2('0x67'),_0x500904)[_0x5ef2('0x66')]('dialTimezone',_0x549ac5[_0x5ef2('0x63')])[_0x5ef2('0x41')]();return db['sequelize'][_0x5ef2('0x5b')](_0x2492b9)['spread'](function(_0x1b25d8){_0x4a9ca5({'ret':0x1});})[_0x5ef2('0x5c')](function(_0x58a7cd){logger['error'](_0x58a7cd['message']);_0x4621f7({'ret':0x1});});}});}function handleTZQuery(_0x5c634b){logger[_0x5ef2('0x54')](_0x5c634b);return db['sequelize'][_0x5ef2('0x5b')](_0x5c634b)[_0x5ef2('0x68')](function(_0x2ec7bc){})[_0x5ef2('0x5c')](function(_0x237efb){logger[_0x5ef2('0x56')](_0x237efb[_0x5ef2('0x57')]);});}function main(_0x280e39,_0x58be4a,_0x1ef79a,_0x1ae278){logger[_0x5ef2('0x54')](_0x5ef2('0x69'),_0x280e39,JSON[_0x5ef2('0x6a')](_0x58be4a));process[_0x5ef2('0x6b')](_0x5ef2('0x6c'));var _0x3b5863=_0x58be4a[_0x5ef2('0x6d')];var _0x446659=_[_0x5ef2('0x6e')](_0x3b5863);var _0x2a6f60=_0x58be4a['socket_timestamp'];var _0x4ffe3e=path[_0x5ef2('0x12')](config[_0x5ef2('0x6f')],_0x5ef2('0x70'),_0x2a6f60+_0x5ef2('0x71'));hasTZ=_[_0x5ef2('0x4e')](_0x3b5863)[_0x5ef2('0x72')]('dialTimezone');var _0xc054da=_['keys'](_0x3b5863)['join']();logger[_0x5ef2('0x54')]('header',_0xc054da);db[_0x5ef2('0x73')][_0x5ef2('0x74')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x3cdc96){for(var _0x10107a=0x0;_0x10107a<_0x3cdc96[_0x5ef2('0x1a')];_0x10107a++){if(_0x3cdc96[_0x10107a][_0x5ef2('0x75')]in _0x3b5863){contactItemTypes['push'](_0x3cdc96[_0x10107a]);delete _0x446659[_0x3cdc96[_0x10107a][_0x5ef2('0x75')]];hasAdditionalPhones=!![];}for(var _0x5ae044 in _0x3b5863){if(_0x3cdc96[_0x10107a][_0x5ef2('0x75')]+_0x5ef2('0x76')===_0x5ae044){phoneDescriptions[_0x5ef2('0x18')]({'itemTypeId':_0x3cdc96[_0x10107a]['id'],'description':_0x5ae044});delete _0x446659[_0x5ae044];}}}if(hasAdditionalPhones)_0x446659['AdditionalPhones']='';var _0x1d2330=_[_0x5ef2('0x4e')](_0x446659)[_0x5ef2('0x12')]();logger[_0x5ef2('0x54')](_0x5ef2('0x77'),_0x1d2330);fs[_0x5ef2('0x78')](_0x4ffe3e,_0x1d2330+'\x0a');Papa[_0x5ef2('0x79')](fs[_0x5ef2('0x7a')](_0x280e39),{'header':!![],'skipEmptyLines':!![],'step':function(_0x53ad2e,_0x38e45c){try{for(var _0x506e97=0x0,_0x3454d3=[];_0x506e97<_0x53ad2e['data']['length'];_0x506e97++){stats['rows']+=0x1;if(_0x53ad2e[_0x5ef2('0x58')][_0x506e97]){handleError(_0x53ad2e[_0x5ef2('0x7b')][_0x506e97],_0x53ad2e[_0x5ef2('0x58')][_0x506e97]);}else{var _0x7f29a4=[];var _0x13d347=[];var _0x233356={};for(var _0x43a02d in _0x3b5863){let _0x3889d7=contactItemTypes[_0x5ef2('0x7c')](_0x52372a=>_0x52372a['name']===_0x43a02d);let _0x58a529=contactItemTypes[_0x5ef2('0x7c')](_0x4e58a9=>_0x4e58a9[_0x5ef2('0x75')]+_0x5ef2('0x76')===_0x43a02d);if(_[_0x5ef2('0x64')](_0x3889d7)&&_['isNil'](_0x58a529)){if(_0x3b5863[_0x5ef2('0x7d')](_0x43a02d)){if(_0x53ad2e[_0x5ef2('0x7b')][_0x506e97][_0x3b5863[_0x43a02d]]){var _0x338512=_[_0x5ef2('0x7e')](_0x53ad2e[_0x5ef2('0x7b')][_0x506e97][_0x3b5863[_0x43a02d]]['replace'](/"/g,'\x27'));switch(_0x43a02d){case _0x5ef2('0x2c'):var _0x2e6d15=moment(_0x338512,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2e6d15['isValid']()){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x5ef2('0x31'):var _0x36648e=parseInt(_0x338512);_0x338512=_[_0x5ef2('0x7f')](_0x36648e)||_0x36648e<0x0||_0x36648e>0x4?_0x1ae278?0x3:0x2:_0x36648e;_0x3454d3['push']('\x22'+_0x338512+'\x22');break;case'UserId':var _0x4d8e74=parseInt(_0x338512);if(_[_0x5ef2('0x80')](_0x4d8e74)&&_[_0x5ef2('0x72')](_0x1ef79a,_0x4d8e74)){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x4d8e74+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x338512)){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')](_0x5ef2('0x81'));}break;case _0x5ef2('0x82'):var _0x312879=moment(_0x338512,_0x5ef2('0x83'),!![]);if(_0x312879[_0x5ef2('0x84')]()){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}else{_0x7f29a4[_0x5ef2('0x18')](_0x5ef2('0x85'));}break;case'dialTimezone':var _0x524ef1=shared['timezones'];var _0x24a2f6=_0x524ef1[_0x338512];if(!_[_0x5ef2('0x64')](_0x24a2f6)){var _0x41ee85=_0x24a2f6[_0x5ef2('0x65')];_0x3454d3['push']('\x22'+_0x338512+'\x22');_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x41ee85+'\x22');}break;default:_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x338512+'\x22');}}else{switch(_0x43a02d){case'firstName':case'phone':_0x7f29a4[_0x5ef2('0x18')](_0x43a02d+_0x5ef2('0x86'));break;default:_0x3454d3[_0x5ef2('0x18')]('\x22\x22');}}}}else{var _0x1fa329='';if(!_[_0x5ef2('0x64')](_0x3889d7)){if(!_0x233356[_0x5ef2('0x7d')](_0x3889d7['id'])){if(!_[_0x5ef2('0x64')](_0x53ad2e['data'][_0x506e97][_0x3b5863[_0x43a02d]])){var _0x338512=_[_0x5ef2('0x7e')](_0x53ad2e['data'][_0x506e97][_0x3b5863[_0x43a02d]]['replace'](/"/g,'\x27'));var _0x4b41ab=phoneDescriptions[_0x5ef2('0x7c')](_0x14df8d=>_0x14df8d[_0x5ef2('0x87')]===_0x3889d7['id']);if(!_[_0x5ef2('0x64')](_0x4b41ab)){var _0x290dd8=_[_0x5ef2('0x7e')](_0x53ad2e[_0x5ef2('0x7b')][_0x506e97][_0x3b5863[_0x4b41ab['description']]][_0x5ef2('0x88')](/"/g,'\x27'));if(!_['isNil'](_0x290dd8))_0x338512=_0x338512+'§'+_0x290dd8;}if(_0x1fa329=='')_0x1fa329=_0x338512;else _0x1fa329+='|'+_0x338512;}_0x13d347[_0x5ef2('0x18')](_0x3889d7['id']+':'+_0x1fa329);_0x233356[_0x3889d7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3454d3[_0x5ef2('0x18')]('\x22'+_0x13d347[_0x5ef2('0x12')](';')+'\x22');}if(_0x7f29a4['length']){handleError(_0x53ad2e[_0x5ef2('0x7b')][_0x506e97],{'code':_0x5ef2('0x89'),'message':_0x7f29a4[_0x5ef2('0x12')]()});}else{fs[_0x5ef2('0x8a')](_0x4ffe3e,_0x3454d3[_0x5ef2('0x12')]()+'\x0a');}_0x3454d3=[];}if(!(stats[_0x5ef2('0x8b')]%0xc8)){socket['emit'](_0x5ef2('0x8c')+_0x2a6f60,stats);stats[_0x5ef2('0x58')]=[];}}if(stopped){logger[_0x5ef2('0x54')](_0x5ef2('0x8d'));_0x38e45c['abort']();}}catch(_0x385e0f){handleError(_0x53ad2e['data'][_0x506e97],{'code':_0x5ef2('0x8e'),'message':_0x385e0f[_0x5ef2('0x57')]});logger[_0x5ef2('0x56')]('step',_0x385e0f[_0x5ef2('0x57')]);}},'complete':function(){try{var _0x484095=[];var _0x54b179=[];var _0x1d577d=_0x5ef2('0x3c');if(_0x58be4a['duplicates']&&_0x58be4a[_0x5ef2('0x8f')]['length']){_0x1d577d=_0x5ef2('0x90')+_0x2a6f60;_0x484095[_0x5ef2('0x18')](_0x5ef2('0x91')+_0x1d577d+_0x5ef2('0x92'));}tmp_campaigns=_0x5ef2('0x93')+_0x2a6f60;tmp_voice_queues='voice_queues_'+_0x2a6f60;_0x54b179['push'](_0x5ef2('0x91')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x54b179[_0x5ef2('0x18')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x54b179,handleTZQuery)[_0x5ef2('0x17')](function(_0x18806e){updateTzCampaigns(_0x58be4a['ListId'])['then'](function(_0x33c8c6){updateTzVoiceQueues(_0x58be4a[_0x5ef2('0x2e')])[_0x5ef2('0x17')](function(_0x3eb472){if(hasTZ)_0x1d2330=_0x1d2330[_0x5ef2('0x88')](_0x5ef2('0x63'),'dialTimezone,utcOffset');var _0x438f90=util[_0x5ef2('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4ffe3e,_0x1d577d,_0x1d2330,_0x58be4a['ListId'],_0x58be4a[_0x5ef2('0x4f')]||null,NOW,NOW);if(_[_0x5ef2('0x64')](_0x3b5863[_0x5ef2('0x2c')])){_0x438f90+=',\x20scheduledAt\x20=\x20NOW()';}_0x484095[_0x5ef2('0x18')](_0x438f90);if(_0x58be4a['duplicates']&&_0x58be4a[_0x5ef2('0x8f')][_0x5ef2('0x1a')]){_0x484095['push'](insertCmContact(_0x58be4a[_0x5ef2('0x2e')],_0x1d577d,_0x58be4a[_0x5ef2('0x8f')],_0x3b5863));_0x484095['push']('DROP\x20TABLE\x20'+_0x1d577d+';');}BPromise['each'](_0x484095,handleQuery)['then'](function(_0x40c38d){BPromise[_0x5ef2('0x1b')]([handleAdditionalPhones()])[_0x5ef2('0x17')](function(){_0x484095=[];for(var _0x2eb460=0x0;_0x2eb460\x20\x20');}var _0x41d4a5=path[_0x5ef2('0x12')](config['root'],_0x5ef2('0x70'),process['argv'][0x2]);if(!fs[_0x5ef2('0xa3')](_0x41d4a5)){throw new Error(_0x5ef2('0xa4'));}var _0x585768={};try{_0x585768=JSON[_0x5ef2('0x79')](process['argv'][0x3]);if(!_0x585768[_0x5ef2('0x6d')]){throw new Error(_0x5ef2('0xa5'));}if(!_0x585768[_0x5ef2('0x6d')][_0x5ef2('0x10')]){throw new Error(_0x5ef2('0xa6'));}if(!_0x585768[_0x5ef2('0x6d')][_0x5ef2('0xa7')]){throw new Error(_0x5ef2('0xa8'));}var _0x27ce48=0x0;if(_0x585768[_0x5ef2('0x6d')]['UserId']){_0x27ce48=0x1;}if(!_0x585768[_0x5ef2('0x2e')]){throw new Error(_0x5ef2('0xa9'));}}catch(_0x2347f9){throw new Error('body\x20id\x20mandatory');}var _0x13c8ba=[];try{_0x13c8ba=_[_0x5ef2('0xaa')](JSON[_0x5ef2('0x79')](process[_0x5ef2('0xa2')][0x4]),'id');}catch(_0x5adb23){logger[_0x5ef2('0x54')](_0x5ef2('0xab'));}main(_0x41d4a5,_0x585768,_0x13c8ba,_0x27ce48);}validate();process['on'](_0x5ef2('0xac'),handleStop);process['on'](_0x5ef2('0xad'),handleUncaughtException); \ No newline at end of file +var _0xad0a=['phone','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','AdditionalPhones','then','all','split','length','isNil','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','fields','.CmListId\x20=\x20?','ListId\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','errors','push','code','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','timezones','dialTimezone','utcOffset','set','offset','main','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','hasOwnProperty','itemTypeId','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','orderBy','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field'];(function(_0xaba604,_0x2b0e6c){var _0x2fa656=function(_0x20c190){while(--_0x20c190){_0xaba604['push'](_0xaba604['shift']());}};_0x2fa656(++_0x2b0e6c);}(_0xad0a,0xa7));var _0xaad0=function(_0x350840,_0x12f8a0){_0x350840=_0x350840-0x0;var _0x3729e9=_0xad0a[_0x350840];return _0x3729e9;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xaad0('0x0'));var Papa=require(_0xaad0('0x1'));var util=require(_0xaad0('0x2'));var BPromise=require(_0xaad0('0x3'));var moment=require('moment');var squel=require(_0xaad0('0x4'));var Redis=require(_0xaad0('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xaad0('0x6'));var shared=require('../../../config/environment/shared');var logger=require(_0xaad0('0x7'))(_0xaad0('0x8'));config['redis']=_[_0xaad0('0x9')](config[_0xaad0('0xa')],{'host':_0xaad0('0xb'),'port':0x18eb});var socket=require(_0xaad0('0xc'))(new Redis(config[_0xaad0('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xaad0('0xd')](_0xaad0('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xaad0('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4a29bf){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))*$/[_0xaad0('0xf')](_0x4a29bf);}function selectNotIn(_0x29fb26,_0x3ccb78,_0x37a0b1,_0x2418e9,_0x16b44f){return squel[_0xaad0('0x10')]()[_0xaad0('0x11')](_0xaad0('0x12'))[_0xaad0('0x13')](_0x2418e9)['join'](_0x3ccb78,null,_0x3ccb78+_0xaad0('0x14')+_0x2418e9+'.'+_0x37a0b1)['where'](_0x2418e9+'.'+_0x37a0b1+_0xaad0('0x15')+_0x29fb26+'.'+_0x37a0b1)['where'](_0x3ccb78+_0xaad0('0x16')+_0x16b44f[_0xaad0('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4704fc,_0x4e2a42){promisesAdditionalPhones=[];return db[_0xaad0('0x18')]['findAll']({'raw':!![],'attributes':['id',_0xaad0('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xaad0('0x1a')](function(_0x1589ea){if(_0x1589ea!==null){var _0x462bc8=[];for(var _0x3f9203=0x0;_0x3f9203<_0x1589ea['length'];_0x3f9203++){var _0x900d61=_0x1589ea[_0x3f9203];_0x462bc8['push'](insertAdditionalPhones(_0x900d61));}}Promise[_0xaad0('0x1b')](_0x462bc8)['then'](function(){_0x4704fc({'val':0x1});});});});}function insertAdditionalPhones(_0x113284){return new Promise(function(_0x265523,_0x259c35){var _0x4cf54f=_0x113284[_0xaad0('0x19')];var _0x469571=_0x4cf54f[_0xaad0('0x1c')](';');var _0xd8574=[];orderBy=0x0;for(var _0x187925=0x0;_0x187925<_0x469571[_0xaad0('0x1d')];_0x187925++){_0xd8574['push'](splitAdditionalPhone(_0x113284['id'],_0x469571[_0x187925]));}Promise[_0xaad0('0x1b')](_0xd8574)[_0xaad0('0x1a')](function(){_0x265523({'val':_0x469571[_0xaad0('0x1d')]});});});}function splitAdditionalPhone(_0x2775db,_0x444e35){return new Promise(function(_0x4e6c7a,_0x38ace6){var _0x12ecb3=_0x444e35[_0xaad0('0x1c')](':');var _0x2af619=_0x12ecb3[0x0];var _0x22c22e=_0x12ecb3[0x1];if(!_[_0xaad0('0x1e')](_0x22c22e)){var _0x173b91=_0x22c22e[_0xaad0('0x1c')]('|');var _0x1dce41=[];for(var _0x136747=0x0;_0x136747<_0x173b91['length'];_0x136747++){if(_0x173b91[_0x136747]!==''){var _0x4fb72a=_['filter'](promisesAdditionalPhones,{'contactId':_0x2775db,'phone':_0x173b91[_0x136747]});if(_0x4fb72a['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2775db,'contactTypeId':_0x2af619,'phone':_0x173b91[_0x136747],'orderBy':orderBy});}}}_0x4e6c7a({'ok':0x1});}else _0x4e6c7a({'res':0x0});});}function createAdditionalPhone(_0x4a6602,_0x3570ee,_0x448293,_0x7741c1){var _0x18790b='';var _0x3e8744='';var _0x539eb6=_0x448293[_0xaad0('0x1c')]('§');_0x18790b=_0x539eb6[0x0];if(_0x539eb6[_0xaad0('0x1d')]==0x2)_0x3e8744=_0x539eb6[0x1];return new Promise(function(_0x35f108,_0x4cbaed){return db[_0xaad0('0x1f')][_0xaad0('0x20')]({'where':{'CmContactId':_0x4a6602,'item':_0x18790b}})[_0xaad0('0x1a')](function(_0x543a29){if(_0x543a29){return db[_0xaad0('0x1f')][_0xaad0('0x21')]({'ItemTypeId':_0x3570ee,'description':_0x3e8744,'OrderBy':_0x7741c1},{'where':{'CmContactId':_0x4a6602,'item':_0x18790b}})['then'](function(_0x5c209a){_0x35f108({'res':'updated'});});}else{return db[_0xaad0('0x1f')][_0xaad0('0x22')]({'CmContactId':_0x4a6602,'item':_0x18790b,'description':_0x3e8744,'ItemTypeId':_0x3570ee,'OrderBy':_0x7741c1,'ItemClass':_0xaad0('0x23')})[_0xaad0('0x1a')](function(_0x5b88ac){_0x35f108({'res':_0xaad0('0x24')});});}});});}function insertCmHopper(_0x2c2790,_0x336883,_0x24ac7e,_0x31c446,_0x2d09a5){var _0x2d498b=[_0xaad0('0x25'),_0xaad0('0x26'),_0xaad0('0x27'),_0xaad0('0x28'),_0x336883+'.'+_0x31c446,_0xaad0('0x29'),_0xaad0('0x2a'),_0xaad0('0x2b'),_0xaad0('0x2c'),'\x22'+_0x2d09a5+'\x22'];return squel[_0xaad0('0x2d')]()[_0xaad0('0x2e')](_0xaad0('0x2f'))[_0xaad0('0x30')]([_0xaad0('0x12'),'scheduledat',_0xaad0('0x31'),_0xaad0('0x32'),_0x31c446,_0xaad0('0x33'),_0xaad0('0x34'),_0xaad0('0x35'),_0xaad0('0x36'),_0xaad0('0x37')],squel['select']()['fields'](_0x2d498b)[_0xaad0('0x13')](_0x336883)[_0xaad0('0x17')](_0xaad0('0x38'),null,_0xaad0('0x39')+_0x336883+_0xaad0('0x3a'))[_0xaad0('0x17')](_0x24ac7e,null,_0x24ac7e+'.id\x20=\x20'+_0x336883+'.'+_0x31c446)[_0xaad0('0x3b')](_0x336883+'.CmListId\x20=\x20?',_0x2c2790)['where'](_0xaad0('0x3c'),NOW)[_0xaad0('0x3b')](_0xaad0('0x3d'),selectNotIn(_0x336883,_0x24ac7e,_0x31c446,_0xaad0('0x2f'),[_0xaad0('0x3e'),_0xaad0('0x3f')]))[_0xaad0('0x3b')](_0xaad0('0x3d'),selectNotIn(_0x336883,_0x24ac7e,_0x31c446,_0xaad0('0x2f'),[_0xaad0('0x3e')])))['toString']();}function insertCmHopperBlack(_0x226f4c,_0x142588,_0x4dc453,_0x2ab134){var _0xf7c3de=[_0xaad0('0x25'),_0xaad0('0x27'),_0xaad0('0x28'),_0x142588+'.'+_0x2ab134,_0xaad0('0x29'),'cm_contacts.updatedAt'];return squel['insert']()[_0xaad0('0x2e')](_0xaad0('0x40'))[_0xaad0('0x30')](['phone','ContactId','ListId',_0x2ab134,_0xaad0('0x33'),_0xaad0('0x34')],squel[_0xaad0('0x10')]()[_0xaad0('0x41')](_0xf7c3de)['from'](_0x142588)[_0xaad0('0x17')](_0xaad0('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x142588+'.CmListId')['join'](_0x4dc453,null,_0x4dc453+_0xaad0('0x14')+_0x142588+'.'+_0x2ab134)[_0xaad0('0x3b')](_0x142588+_0xaad0('0x42'),_0x226f4c)[_0xaad0('0x3b')](_0xaad0('0x3c'),NOW)[_0xaad0('0x3b')](_0xaad0('0x3d'),squel[_0xaad0('0x10')]()[_0xaad0('0x11')](_0xaad0('0x12'))[_0xaad0('0x13')](_0xaad0('0x40'))[_0xaad0('0x3b')](_0xaad0('0x43'),_0x226f4c)[_0xaad0('0x3b')](_0x2ab134+'\x20=\x20'+_0x142588+'.'+_0x2ab134)))[_0xaad0('0x44')]();}function insertTzCmHopper(_0x285aff,_0x521504,_0x1acf96,_0x566450,_0x258381,_0x2f115d){var _0xad0970=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x2f115d+'.offset-cm_contacts.utcOffset\x20minute)',_0xaad0('0x27'),_0xaad0('0x28'),_0x521504+'.'+_0x566450,'cm_contacts.createdAt',_0xaad0('0x2a'),_0xaad0('0x2b'),_0xaad0('0x2c'),'\x22'+_0x258381+'\x22'];var _0x499329=squel[_0xaad0('0x2d')]()['into'](_0xaad0('0x2f'))[_0xaad0('0x30')]([_0xaad0('0x12'),'scheduledat','ContactId',_0xaad0('0x32'),_0x566450,'createdAt','updatedAt','priority','UserId','recallme'],squel[_0xaad0('0x10')]()['fields'](_0xad0970)[_0xaad0('0x13')](_0x521504)[_0xaad0('0x17')](_0xaad0('0x38'),null,_0xaad0('0x39')+_0x521504+_0xaad0('0x3a'))['join'](_0x1acf96,null,_0x1acf96+'.id\x20=\x20'+_0x521504+'.'+_0x566450)[_0xaad0('0x17')](_0x2f115d,null,_0x2f115d+_0xaad0('0x14')+_0x521504+'.'+_0x566450)['where'](_0x521504+_0xaad0('0x42'),_0x285aff)['where'](_0xaad0('0x3c'),NOW)[_0xaad0('0x3b')](_0xaad0('0x3d'),selectNotIn(_0x521504,_0x1acf96,_0x566450,_0xaad0('0x2f'),[_0xaad0('0x3e'),_0xaad0('0x3f')]))[_0xaad0('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x521504,_0x1acf96,_0x566450,_0xaad0('0x2f'),[_0xaad0('0x3e')])))[_0xaad0('0x44')]();return _0x499329;}function insertTzCmHopperBlack(_0x509cf3,_0x52b24a,_0x5f3755,_0x427369){var _0x3d6ef9=[_0xaad0('0x25'),'cm_contacts.id',_0xaad0('0x28'),_0x52b24a+'.'+_0x427369,_0xaad0('0x29'),_0xaad0('0x2a')];return squel[_0xaad0('0x2d')]()[_0xaad0('0x2e')]('cm_hopper_black')[_0xaad0('0x30')](['phone',_0xaad0('0x31'),_0xaad0('0x32'),_0x427369,_0xaad0('0x33'),_0xaad0('0x34')],squel['select']()['fields'](_0x3d6ef9)[_0xaad0('0x13')](_0x52b24a)[_0xaad0('0x17')](_0xaad0('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x52b24a+'.CmListId')[_0xaad0('0x17')](_0x5f3755,null,_0x5f3755+_0xaad0('0x14')+_0x52b24a+'.'+_0x427369)[_0xaad0('0x3b')](_0x52b24a+_0xaad0('0x42'),_0x509cf3)['where'](_0xaad0('0x3c'),NOW)[_0xaad0('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xaad0('0x10')]()[_0xaad0('0x11')](_0xaad0('0x12'))[_0xaad0('0x13')]('cm_hopper_black')['where'](_0xaad0('0x43'),_0x509cf3)['where'](_0x427369+_0xaad0('0x15')+_0x52b24a+'.'+_0x427369)))[_0xaad0('0x44')]();}function insertCmHopperAdditionalPhones(_0x4af730){var _0x4f8c74=['cm_hopper.id',_0xaad0('0x45'),_0xaad0('0x46'),_0xaad0('0x47'),_0xaad0('0x48')];return squel[_0xaad0('0x2d')]()[_0xaad0('0x2e')]('cm_hopper_additional_phones')[_0xaad0('0x30')]([_0xaad0('0x49'),_0xaad0('0x12'),_0xaad0('0x4a'),_0xaad0('0x33'),_0xaad0('0x34')],squel['select']()['fields'](_0x4f8c74)[_0xaad0('0x13')]('cm_hopper')['join'](_0xaad0('0x38'),null,_0xaad0('0x4b'))[_0xaad0('0x17')]('cm_contact_has_items',null,_0xaad0('0x4c'))[_0xaad0('0x3b')](_0xaad0('0x4d'),_0x4af730)[_0xaad0('0x3b')](_0xaad0('0x3c'),NOW))['toString']();}function insertCmContact(_0x52206b,_0xfa7c2a,_0x78ea92,_0x3e4e19){var _0x400e75=_[_0xaad0('0x4e')](_[_0xaad0('0x4f')](_0x3e4e19),[_0xaad0('0x32'),_0xaad0('0x50'),_0xaad0('0x33'),_0xaad0('0x34'),'scheduledAt']);return squel[_0xaad0('0x2d')]()['into']('cm_contacts')[_0xaad0('0x30')](_0x400e75,squel['select']()[_0xaad0('0x41')](_0x400e75)['from'](_0xfa7c2a)[_0xaad0('0x3b')]('('+_0x78ea92[_0xaad0('0x17')](',')+_0xaad0('0x51'),squel[_0xaad0('0x10')]()['fields'](_0x78ea92)['from'](_0xaad0('0x38'))[_0xaad0('0x3b')](_0xaad0('0x43'),_0x52206b)[_0xaad0('0x3b')](_0xaad0('0x52')))['where'](_0xaad0('0x53'),squel[_0xaad0('0x10')]()[_0xaad0('0x11')](_0xaad0('0x54'),_0xaad0('0x55'))['from'](_0xfa7c2a)[_0xaad0('0x56')](_0x78ea92['join'](','))))['toString']();}function handleStop(){logger[_0xaad0('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2995f7){logger[_0xaad0('0x58')](_0x2995f7[_0xaad0('0x59')]);process['exit'](0x1);}function handleError(_0x46866c,_0x48a88c){stats[_0xaad0('0x5a')][_0xaad0('0x5b')]({'name':_0x48a88c[_0xaad0('0x5c')],'message':_0x48a88c[_0xaad0('0x59')],'row':_0x46866c});}function handleQuery(_0xe9b405){logger[_0xaad0('0x57')](_0xe9b405);return db[_0xaad0('0x5d')][_0xaad0('0x5e')](_0xe9b405)['spread'](function(_0x8d3a45){results[_0xaad0('0x5b')](_0x8d3a45);})[_0xaad0('0x5f')](function(_0x402050){logger['error'](_0x402050[_0xaad0('0x59')]);});}function updateTzCampaigns(_0x48b278){return new Promise(function(_0x45d05b,_0x5ddfa5){var _0x3e53ab=squel['select']()[_0xaad0('0x41')]([_0xaad0('0x60'),_0xaad0('0x61')])[_0xaad0('0x13')](_0xaad0('0x62'))[_0xaad0('0x17')](_0xaad0('0x63'),null,_0xaad0('0x64'))[_0xaad0('0x3b')](_0xaad0('0x65')+_0x48b278);db[_0xaad0('0x5d')][_0xaad0('0x5e')](_0x3e53ab['toString']())[_0xaad0('0x66')](function(_0x67fdc0){var _0x4a9a53=[];for(var _0x444672=0x0;_0x444672<_0x67fdc0['length'];_0x444672++){_0x4a9a53[_0xaad0('0x5b')](getTimezoneData(_0x67fdc0[_0x444672],tmp_campaigns));}BPromise['all'](_0x4a9a53)[_0xaad0('0x1a')](function(){_0x45d05b({'val':0x1});});})['catch'](function(_0x47f997){logger[_0xaad0('0x58')](_0x47f997['message']);_0x45d05b({'val':0x0});});});}function updateTzVoiceQueues(_0x3c7213){return new Promise(function(_0x41bd15,_0x18b476){var _0x288188=squel[_0xaad0('0x10')]()['fields']([_0xaad0('0x67'),_0xaad0('0x68')])['from']('voice_queues')[_0xaad0('0x17')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x3c7213);db['sequelize'][_0xaad0('0x5e')](_0x288188[_0xaad0('0x44')]())[_0xaad0('0x66')](function(_0x481827){var _0x5eceea=[];for(var _0x77317e=0x0;_0x77317e<_0x481827[_0xaad0('0x1d')];_0x77317e++){_0x5eceea['push'](getTimezoneData(_0x481827[_0x77317e],tmp_voice_queues));}BPromise['all'](_0x5eceea)[_0xaad0('0x1a')](function(){_0x41bd15({'val':0x1});});})[_0xaad0('0x5f')](function(_0x52b6cc){logger['error'](_0x52b6cc[_0xaad0('0x59')]);_0x41bd15({'val':0x0});});});}function getTimezoneData(_0x31bebd,_0x505d8d){return new Promise(function(_0x22efe6,_0x44403b){var _0x41fca8=shared[_0xaad0('0x69')];var _0x3d74b3=_0x41fca8[_0x31bebd[_0xaad0('0x6a')]];if(_[_0xaad0('0x1e')](_0x3d74b3)){_0x22efe6({'ret':0x1});}else{var _0x1b26f9=_0x3d74b3[_0xaad0('0x6b')];var _0xc3a6ae=squel['insert']()['into'](_0x505d8d)[_0xaad0('0x6c')]('id',_0x31bebd['id'])[_0xaad0('0x6c')](_0xaad0('0x6d'),_0x1b26f9)[_0xaad0('0x6c')](_0xaad0('0x6a'),_0x31bebd[_0xaad0('0x6a')])[_0xaad0('0x44')]();return db[_0xaad0('0x5d')]['query'](_0xc3a6ae)[_0xaad0('0x66')](function(_0x449c28){_0x22efe6({'ret':0x1});})['catch'](function(_0x2d53c4){logger[_0xaad0('0x58')](_0x2d53c4[_0xaad0('0x59')]);_0x44403b({'ret':0x1});});}});}function handleTZQuery(_0x261aac){logger[_0xaad0('0x57')](_0x261aac);return db[_0xaad0('0x5d')][_0xaad0('0x5e')](_0x261aac)[_0xaad0('0x66')](function(_0x344c4e){})[_0xaad0('0x5f')](function(_0x45f24f){logger[_0xaad0('0x58')](_0x45f24f[_0xaad0('0x59')]);});}function main(_0xa5a345,_0x3105ca,_0x2f8af5,_0x118429){logger[_0xaad0('0x57')](_0xaad0('0x6e'),_0xa5a345,JSON['stringify'](_0x3105ca));process[_0xaad0('0x6f')](_0xaad0('0x70'));var _0x441d24=_0x3105ca[_0xaad0('0x71')];var _0x46ed5e=_[_0xaad0('0x72')](_0x441d24);var _0x40e3ec=_0x3105ca[_0xaad0('0x73')];var _0x24595d=path[_0xaad0('0x17')](config['root'],_0xaad0('0x74'),_0x40e3ec+_0xaad0('0x75'));hasTZ=_[_0xaad0('0x4f')](_0x441d24)[_0xaad0('0x76')](_0xaad0('0x6a'));var _0x159e47=_[_0xaad0('0x4f')](_0x441d24)[_0xaad0('0x17')]();logger['info'](_0xaad0('0x77'),_0x159e47);db[_0xaad0('0x78')][_0xaad0('0x79')]({'raw':!![],'attributes':['id',_0xaad0('0x7a')]})[_0xaad0('0x1a')](function(_0x13bf8e){for(var _0x4bf69b=0x0;_0x4bf69b<_0x13bf8e['length'];_0x4bf69b++){if(_0x13bf8e[_0x4bf69b]['name']in _0x441d24){contactItemTypes[_0xaad0('0x5b')](_0x13bf8e[_0x4bf69b]);delete _0x46ed5e[_0x13bf8e[_0x4bf69b][_0xaad0('0x7a')]];hasAdditionalPhones=!![];}for(var _0x325afc in _0x441d24){if(_0x13bf8e[_0x4bf69b][_0xaad0('0x7a')]+_0xaad0('0x7b')===_0x325afc){phoneDescriptions['push']({'itemTypeId':_0x13bf8e[_0x4bf69b]['id'],'description':_0x325afc});delete _0x46ed5e[_0x325afc];}}}if(hasAdditionalPhones)_0x46ed5e[_0xaad0('0x19')]='';var _0x5532b3=_[_0xaad0('0x4f')](_0x46ed5e)['join']();logger[_0xaad0('0x57')](_0xaad0('0x77'),_0x5532b3);fs[_0xaad0('0x7c')](_0x24595d,_0x5532b3+'\x0a');Papa[_0xaad0('0x7d')](fs[_0xaad0('0x7e')](_0xa5a345),{'header':!![],'skipEmptyLines':!![],'step':function(_0x14fd0a,_0x2a1a0c){try{for(var _0x27f959=0x0,_0x5cdcea=[];_0x27f959<_0x14fd0a[_0xaad0('0x7f')][_0xaad0('0x1d')];_0x27f959++){stats[_0xaad0('0x80')]+=0x1;if(_0x14fd0a['errors'][_0x27f959]){handleError(_0x14fd0a[_0xaad0('0x7f')][_0x27f959],_0x14fd0a[_0xaad0('0x5a')][_0x27f959]);}else{var _0xe9e39e=[];var _0x115937=[];var _0x40084f={};for(var _0x6a03f8 in _0x441d24){let _0x509e2a=contactItemTypes[_0xaad0('0x81')](_0x791b11=>_0x791b11[_0xaad0('0x7a')]===_0x6a03f8);let _0x37445f=contactItemTypes['find'](_0x33782d=>_0x33782d[_0xaad0('0x7a')]+'_description'===_0x6a03f8);if(_[_0xaad0('0x1e')](_0x509e2a)&&_[_0xaad0('0x1e')](_0x37445f)){if(_0x441d24['hasOwnProperty'](_0x6a03f8)){if(_0x14fd0a[_0xaad0('0x7f')][_0x27f959][_0x441d24[_0x6a03f8]]){var _0x3fddac=_[_0xaad0('0x82')](_0x14fd0a[_0xaad0('0x7f')][_0x27f959][_0x441d24[_0x6a03f8]][_0xaad0('0x83')](/"/g,'\x27'));switch(_0x6a03f8){case _0xaad0('0x84'):var _0x1b2de0=moment(_0x3fddac,_0xaad0('0xe'),!![]);if(_0x1b2de0['isValid']()){_0x5cdcea[_0xaad0('0x5b')]('\x22'+_0x3fddac+'\x22');}else{_0xe9e39e[_0xaad0('0x5b')](_0xaad0('0x85'));}break;case _0xaad0('0x35'):var _0x56d7cf=parseInt(_0x3fddac);_0x3fddac=_['isNaN'](_0x56d7cf)||_0x56d7cf<0x0||_0x56d7cf>0x4?_0x118429?0x3:0x2:_0x56d7cf;_0x5cdcea[_0xaad0('0x5b')]('\x22'+_0x3fddac+'\x22');break;case _0xaad0('0x36'):var _0x4fa20d=parseInt(_0x3fddac);if(_[_0xaad0('0x86')](_0x4fa20d)&&_[_0xaad0('0x76')](_0x2f8af5,_0x4fa20d)){_0x5cdcea[_0xaad0('0x5b')]('\x22'+_0x4fa20d+'\x22');}else{_0xe9e39e[_0xaad0('0x5b')]('agent\x20not\x20exists');}break;case _0xaad0('0x87'):if(isEmail(_0x3fddac)){_0x5cdcea[_0xaad0('0x5b')]('\x22'+_0x3fddac+'\x22');}else{_0xe9e39e[_0xaad0('0x5b')](_0xaad0('0x88'));}break;case _0xaad0('0x89'):var _0x6ab7a5=moment(_0x3fddac,'YYYY-MM-DD',!![]);if(_0x6ab7a5[_0xaad0('0x8a')]()){_0x5cdcea['push']('\x22'+_0x3fddac+'\x22');}else{_0xe9e39e[_0xaad0('0x5b')](_0xaad0('0x8b'));}break;case _0xaad0('0x6a'):var _0x2a5351=shared[_0xaad0('0x69')];var _0x2bf7db=_0x2a5351[_0x3fddac];if(!_['isNil'](_0x2bf7db)){var _0x150093=_0x2bf7db['utcOffset'];_0x5cdcea['push']('\x22'+_0x3fddac+'\x22');_0x5cdcea[_0xaad0('0x5b')]('\x22'+_0x150093+'\x22');}break;default:_0x5cdcea[_0xaad0('0x5b')]('\x22'+_0x3fddac+'\x22');}}else{switch(_0x6a03f8){case'firstName':case'phone':_0xe9e39e[_0xaad0('0x5b')](_0x6a03f8+_0xaad0('0x8c'));break;default:_0x5cdcea[_0xaad0('0x5b')]('\x22\x22');}}}}else{var _0x2cb25c='';if(!_[_0xaad0('0x1e')](_0x509e2a)){if(!_0x40084f[_0xaad0('0x8d')](_0x509e2a['id'])){if(!_[_0xaad0('0x1e')](_0x14fd0a[_0xaad0('0x7f')][_0x27f959][_0x441d24[_0x6a03f8]])){var _0x3fddac=_['trim'](_0x14fd0a[_0xaad0('0x7f')][_0x27f959][_0x441d24[_0x6a03f8]][_0xaad0('0x83')](/"/g,'\x27'));var _0xaf2a73=phoneDescriptions[_0xaad0('0x81')](_0x555801=>_0x555801[_0xaad0('0x8e')]===_0x509e2a['id']);if(!_[_0xaad0('0x1e')](_0xaf2a73)){var _0x7fd979=_[_0xaad0('0x82')](_0x14fd0a['data'][_0x27f959][_0x441d24[_0xaf2a73['description']]][_0xaad0('0x83')](/"/g,'\x27'));if(!_[_0xaad0('0x1e')](_0x7fd979))_0x3fddac=_0x3fddac+'§'+_0x7fd979;}if(_0x2cb25c=='')_0x2cb25c=_0x3fddac;else _0x2cb25c+='|'+_0x3fddac;}_0x115937[_0xaad0('0x5b')](_0x509e2a['id']+':'+_0x2cb25c);_0x40084f[_0x509e2a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5cdcea[_0xaad0('0x5b')]('\x22'+_0x115937['join'](';')+'\x22');}if(_0xe9e39e['length']){handleError(_0x14fd0a[_0xaad0('0x7f')][_0x27f959],{'code':'SystemRow','message':_0xe9e39e[_0xaad0('0x17')]()});}else{fs[_0xaad0('0x8f')](_0x24595d,_0x5cdcea[_0xaad0('0x17')]()+'\x0a');}_0x5cdcea=[];}if(!(stats['rows']%0xc8)){socket[_0xaad0('0x90')](_0xaad0('0x91')+_0x40e3ec,stats);stats[_0xaad0('0x5a')]=[];}}if(stopped){logger['info'](_0xaad0('0x92'));_0x2a1a0c['abort']();}}catch(_0x1e862d){handleError(_0x14fd0a[_0xaad0('0x7f')][_0x27f959],{'code':_0xaad0('0x93'),'message':_0x1e862d[_0xaad0('0x59')]});logger[_0xaad0('0x58')](_0xaad0('0x94'),_0x1e862d[_0xaad0('0x59')]);}},'complete':function(){try{var _0x374f05=[];var _0x3ec2a6=[];var _0x1c07fa=_0xaad0('0x38');if(_0x3105ca[_0xaad0('0x95')]&&_0x3105ca[_0xaad0('0x95')][_0xaad0('0x1d')]){_0x1c07fa=_0xaad0('0x96')+_0x40e3ec;_0x374f05['push'](_0xaad0('0x97')+_0x1c07fa+_0xaad0('0x98'));}tmp_campaigns=_0xaad0('0x99')+_0x40e3ec;tmp_voice_queues=_0xaad0('0x9a')+_0x40e3ec;_0x3ec2a6[_0xaad0('0x5b')](_0xaad0('0x97')+tmp_campaigns+_0xaad0('0x9b'));_0x3ec2a6[_0xaad0('0x5b')](_0xaad0('0x97')+tmp_voice_queues+_0xaad0('0x9b'));BPromise['each'](_0x3ec2a6,handleTZQuery)[_0xaad0('0x1a')](function(_0xa87733){updateTzCampaigns(_0x3105ca[_0xaad0('0x32')])[_0xaad0('0x1a')](function(_0x1e3d33){updateTzVoiceQueues(_0x3105ca[_0xaad0('0x32')])[_0xaad0('0x1a')](function(_0x5aa446){if(hasTZ)_0x5532b3=_0x5532b3[_0xaad0('0x83')](_0xaad0('0x6a'),_0xaad0('0x9c'));var _0x55d80d=util[_0xaad0('0xd')](_0xaad0('0x9d'),_0x24595d,_0x1c07fa,_0x5532b3,_0x3105ca[_0xaad0('0x32')],_0x3105ca[_0xaad0('0x50')]||null,NOW,NOW);if(_['isNil'](_0x441d24['scheduledat'])){_0x55d80d+=_0xaad0('0x9e');}_0x374f05[_0xaad0('0x5b')](_0x55d80d);if(_0x3105ca[_0xaad0('0x95')]&&_0x3105ca[_0xaad0('0x95')][_0xaad0('0x1d')]){_0x374f05[_0xaad0('0x5b')](insertCmContact(_0x3105ca[_0xaad0('0x32')],_0x1c07fa,_0x3105ca[_0xaad0('0x95')],_0x441d24));_0x374f05['push'](_0xaad0('0x9f')+_0x1c07fa+';');}BPromise[_0xaad0('0xa0')](_0x374f05,handleQuery)[_0xaad0('0x1a')](function(_0x17da5f){BPromise[_0xaad0('0x1b')]([handleAdditionalPhones()])[_0xaad0('0x1a')](function(){_0x374f05=[];for(var _0xc7666c=0x0;_0xc7666c\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','message','split','findOne','CmContactHasItem','updated','PHONE','CmContact'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x117c,0x71));var _0xc117=function(_0x1ec3fe,_0x2bbc3d){_0x1ec3fe=_0x1ec3fe-0x0;var _0x23d25b=_0x117c[_0x1ec3fe];return _0x23d25b;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0xc117('0x0'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xc117('0x1'));var Redis=require(_0xc117('0x2'));var db=require(_0xc117('0x3'))['db'];var config=require(_0xc117('0x4'));var logger=require(_0xc117('0x5'))(_0xc117('0x6'));config['redis']=_[_0xc117('0x7')](config[_0xc117('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc117('0x9'))(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()[_0xc117('0xa')](_0xc117('0xb'));var tempTableName=_0xc117('0xc')+moment()[_0xc117('0xa')](_0xc117('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4a1e04){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))*$/[_0xc117('0xe')](_0x4a1e04);}function selectNotIn(_0x574c99,_0x44d812,_0x597df9,_0x41b20e,_0x25d4ff){return squel['select']()[_0xc117('0xf')]('phone')[_0xc117('0x10')](_0x41b20e)[_0xc117('0x11')](_0x44d812,null,_0x44d812+_0xc117('0x12')+_0x41b20e+'.'+_0x597df9)[_0xc117('0x13')](_0x41b20e+'.'+_0x597df9+'\x20=\x20'+_0x574c99+'.'+_0x597df9)[_0xc117('0x13')](_0x44d812+_0xc117('0x14')+_0x25d4ff[_0xc117('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x9dec18,_0x534955){promisesAdditionalPhones=[];promisesContact=[];return db[_0xc117('0x15')][_0xc117('0x16')](_0xc117('0x17')+tempTableName)[_0xc117('0x18')](function(_0x58bce8){if(_0x58bce8!==null){var _0x5350e9=[];for(var _0x1dfaa6=0x0;_0x1dfaa6<_0x58bce8[_0xc117('0x19')];_0x1dfaa6++){var _0x3eaf68=_0x58bce8[_0x1dfaa6];if(!_[_0xc117('0x1a')](_0x3eaf68[_0xc117('0x1b')])){if(!_[_0xc117('0x1a')](_0x3eaf68[_0xc117('0x1c')]))_0x5350e9[_0xc117('0x1d')](insertAdditionalPhones(_0x3eaf68));promisesContact[_0xc117('0x1d')]({'contact':_0x3eaf68});}}}Promise[_0xc117('0x1e')](_0x5350e9)[_0xc117('0x1f')](function(){_0x9dec18({'val':0x1});});})[_0xc117('0x20')](function(_0x547deb){logger[_0xc117('0x21')](_0x547deb[_0xc117('0x22')]);});});}function insertAdditionalPhones(_0xf5307f){return new Promise(function(_0x1a5ba0,_0x3946cb){var _0x37d9de=_0xf5307f[_0xc117('0x1c')];if(_['isNil'](_0x37d9de))_0x3946cb({'val':0x0});else{var _0x4f7594=_0x37d9de[_0xc117('0x23')](';');var _0x24bb40=[];orderBy=0x0;for(var _0x1492d0=0x0;_0x1492d0<_0x4f7594[_0xc117('0x19')];_0x1492d0++){_0x24bb40[_0xc117('0x1d')](splitAdditionalPhone(_0xf5307f['id'],_0x4f7594[_0x1492d0]));}Promise[_0xc117('0x1e')](_0x24bb40)['then'](function(){_0x1a5ba0({'val':_0x4f7594['length']});});}});}function splitAdditionalPhone(_0x3d670e,_0x481e10){return new Promise(function(_0xa0ee6b,_0x7545d){var _0x216370=_0x481e10['split'](':');var _0x3d71f8=_0x216370[0x0];var _0xfefce5=_0x216370[0x1];if(_0xfefce5!==''){var _0x41e376=_0xfefce5[_0xc117('0x23')]('|');var _0x2cc134=[];for(var _0x28575b=0x0;_0x28575b<_0x41e376['length'];_0x28575b++){if(_0x41e376[_0x28575b]!==''){var _0x334041=_['filter'](promisesAdditionalPhones,{'contactId':_0x3d670e,'phone':_0x41e376[_0x28575b]});if(_0x334041['length']==0x0){orderBy++;promisesAdditionalPhones[_0xc117('0x1d')]({'contactId':_0x3d670e,'contactTypeId':_0x3d71f8,'phone':_0x41e376[_0x28575b],'orderBy':orderBy});}}}_0xa0ee6b({'ok':0x1});}else _0xa0ee6b({'res':0x0});});}function createAdditionalPhone(_0x35efea,_0x280c72,_0x52c152,_0x211fb1){var _0x5db129='';var _0x4a2a10='';var _0x459b8a=_0x52c152[_0xc117('0x23')]('§');_0x5db129=_0x459b8a[0x0];if(_0x459b8a[_0xc117('0x19')]==0x2)_0x4a2a10=_0x459b8a[0x1];return new Promise(function(_0x4e8630,_0x416074){return db['CmContactHasItem'][_0xc117('0x24')]({'where':{'CmContactId':_0x35efea,'item':_0x5db129}})[_0xc117('0x1f')](function(_0x21eb0f){if(_0x21eb0f){return db[_0xc117('0x25')]['update']({'ItemTypeId':_0x280c72,'description':_0x4a2a10,'OrderBy':_0x211fb1},{'where':{'CmContactId':_0x35efea,'item':_0x5db129}})[_0xc117('0x1f')](function(_0x3aaf53){_0x4e8630({'res':_0xc117('0x26')});});}else{return db[_0xc117('0x25')]['create']({'CmContactId':_0x35efea,'item':_0x5db129,'ItemTypeId':_0x280c72,'description':_0x4a2a10,'OrderBy':_0x211fb1,'ItemClass':_0xc117('0x27')})['then'](function(_0x29ab11){_0x4e8630({'res':'inserted'});});}});});}function updateContact(_0x3e8ce7){return new Promise(function(_0x5a00ae,_0x450583){var _0x5ae0d6=_0x3e8ce7['id'];delete _0x3e8ce7['id'];return db[_0xc117('0x28')][_0xc117('0x29')](_0x3e8ce7,{'where':{'id':_0x5ae0d6}})[_0xc117('0x1f')](function(_0x4ede76){updatedRows+=0x1;return db[_0xc117('0x2a')][_0xc117('0x29')]({'phone':_0x3e8ce7[_0xc117('0x1b')]},{'where':{'ContactId':_0x5ae0d6}})[_0xc117('0x1f')](function(_0x44942a){_0x5a00ae({'ret':'OK'});});});});}function insertCmHopper(_0x31e654,_0x36cd65,_0x3302b9,_0x4c0135,_0x1222d6){var _0x15858e=[_0xc117('0x2b'),'cm_contacts.scheduledat',_0xc117('0x2c'),_0xc117('0x2d'),_0x36cd65+'.'+_0x4c0135,_0xc117('0x2e'),_0xc117('0x2f'),_0xc117('0x30'),_0xc117('0x31'),'\x22'+_0x1222d6+'\x22'];return squel[_0xc117('0x32')]()['into'](_0xc117('0x33'))[_0xc117('0x34')](['phone',_0xc117('0x35'),_0xc117('0x36'),_0xc117('0x37'),_0x4c0135,'createdAt','updatedAt','priority',_0xc117('0x38'),'recallme'],squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x15858e)[_0xc117('0x10')](_0x36cd65)[_0xc117('0x11')](_0xc117('0x3b'),null,_0xc117('0x3c')+_0x36cd65+'.CmListId')[_0xc117('0x11')](_0x3302b9,null,_0x3302b9+_0xc117('0x12')+_0x36cd65+'.'+_0x4c0135)['where'](_0x36cd65+_0xc117('0x3d'),_0x31e654)['where'](_0xc117('0x3e'),NOW)[_0xc117('0x13')](_0xc117('0x3f'),selectNotIn(_0x36cd65,_0x3302b9,_0x4c0135,'cm_hopper',[_0xc117('0x40'),_0xc117('0x41')]))[_0xc117('0x13')](_0xc117('0x3f'),selectNotIn(_0x36cd65,_0x3302b9,_0x4c0135,'cm_hopper',[_0xc117('0x40')])))[_0xc117('0x42')]();}function insertCmHopperBlack(_0x4e6c89,_0x2880b8,_0x2066cf,_0x5128ef){var _0x180af9=['cm_contacts.phone',_0xc117('0x2c'),_0xc117('0x2d'),_0x2880b8+'.'+_0x5128ef,_0xc117('0x2e'),_0xc117('0x2f')];return squel['insert']()['into']('cm_hopper_black')[_0xc117('0x34')]([_0xc117('0x1b'),'ContactId','ListId',_0x5128ef,'createdAt',_0xc117('0x43')],squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x180af9)[_0xc117('0x10')](_0x2880b8)[_0xc117('0x11')](_0xc117('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x2880b8+'.CmListId')[_0xc117('0x11')](_0x2066cf,null,_0x2066cf+_0xc117('0x12')+_0x2880b8+'.'+_0x5128ef)['where'](_0x2880b8+'.CmListId\x20=\x20?',_0x4e6c89)[_0xc117('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc117('0x13')](_0xc117('0x3f'),squel[_0xc117('0x39')]()[_0xc117('0xf')]('phone')[_0xc117('0x10')](_0xc117('0x44'))['where'](_0xc117('0x45'),_0x4e6c89)[_0xc117('0x13')](_0x5128ef+'\x20=\x20?',_0x2880b8+'.'+_0x5128ef)))['toString']();}function insertCmHopperAdditionalPhones(_0x4bb482){var _0x21d80e=[_0xc117('0x46'),_0xc117('0x47'),_0xc117('0x48'),_0xc117('0x49'),_0xc117('0x4a')];return squel['insert']()['into'](_0xc117('0x4b'))[_0xc117('0x34')]([_0xc117('0x4c'),_0xc117('0x1b'),_0xc117('0x4d'),_0xc117('0x4e'),'updatedAt'],squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x21d80e)[_0xc117('0x10')](_0xc117('0x33'))[_0xc117('0x11')](_0xc117('0x3b'),null,_0xc117('0x4f'))[_0xc117('0x11')](_0xc117('0x50'),null,_0xc117('0x51'))['where'](_0xc117('0x52'),_0x4bb482)['where'](_0xc117('0x3e'),NOW))['toString']();}function insertCmContact(_0x3e6ae5,_0x42b55b,_0x932653,_0xdca56a){var _0x3374fe=_['concat'](_[_0xc117('0x53')](_0xdca56a),[_0xc117('0x37'),'CompanyId',_0xc117('0x4e'),_0xc117('0x43')]);return squel['insert']()[_0xc117('0x54')]('cm_contacts')[_0xc117('0x34')](_0x3374fe,squel['select']()[_0xc117('0x3a')](_0x3374fe)['from'](_0x42b55b)[_0xc117('0x13')]('('+_0x932653[_0xc117('0x11')](',')+_0xc117('0x55'),squel[_0xc117('0x39')]()[_0xc117('0x3a')](_0x932653)[_0xc117('0x10')]('cm_contacts')['where'](_0xc117('0x45'),_0x3e6ae5))['where'](_0xc117('0x56'),squel[_0xc117('0x39')]()[_0xc117('0xf')]('MIN(id)',_0xc117('0x57'))[_0xc117('0x10')](_0x42b55b)['group'](_0x932653[_0xc117('0x11')](','))))[_0xc117('0x42')]();}function handleStop(){logger[_0xc117('0x58')](_0xc117('0x59'));stopped=!![];}function handleUncaughtException(_0x14529d){logger[_0xc117('0x21')](_0x14529d[_0xc117('0x22')]);process[_0xc117('0x5a')](0x1);}function handleError(_0x23c4b0,_0x26a8f5){stats[_0xc117('0x5b')][_0xc117('0x1d')]({'name':_0x26a8f5[_0xc117('0x5c')],'message':_0x26a8f5['message'],'row':_0x23c4b0});}function handleQuery(_0x56706a){logger[_0xc117('0x58')](_0x56706a);return db[_0xc117('0x15')]['query'](_0x56706a)[_0xc117('0x18')](function(_0x45d86e){results[_0xc117('0x1d')](_0x45d86e);})[_0xc117('0x20')](function(_0x21d5ac){logger[_0xc117('0x21')](_0x21d5ac[_0xc117('0x22')]);});}function main(_0x33587a,_0xf040d1,_0x7f7504,_0x25ff8c){logger['info'](_0xc117('0x5d'),_0x33587a,JSON[_0xc117('0x5e')](_0xf040d1));process[_0xc117('0x5f')](_0xc117('0x60'));var _0x31f81e=_0xf040d1[_0xc117('0x61')];var _0x28901b=_[_0xc117('0x62')](_0x31f81e);var _0x1a010e=_0xf040d1[_0xc117('0x63')];var _0x59df9f=path[_0xc117('0x11')](config['root'],_0xc117('0x64'),_0x1a010e+_0xc117('0x65'));logger[_0xc117('0x58')](_0xc117('0x66'),_0xf040d1);db[_0xc117('0x67')][_0xc117('0x68')]({'raw':!![],'attributes':['id','name']})[_0xc117('0x1f')](function(_0x45ea48){for(var _0xea89d2=0x0;_0xea89d2<_0x45ea48[_0xc117('0x19')];_0xea89d2++){if(_0x45ea48[_0xea89d2][_0xc117('0x69')]in _0x31f81e){contactItemTypes[_0xc117('0x1d')](_0x45ea48[_0xea89d2]);delete _0x28901b[_0x45ea48[_0xea89d2][_0xc117('0x69')]];hasAdditionalPhones=!![];}for(var _0xcdc443 in _0x31f81e){if(_0x45ea48[_0xea89d2][_0xc117('0x69')]+_0xc117('0x6a')===_0xcdc443){phoneDescriptions[_0xc117('0x1d')]({'itemTypeId':_0x45ea48[_0xea89d2]['id'],'description':_0xcdc443});delete _0x28901b[_0xcdc443];}}}if(hasAdditionalPhones)_0x28901b['AdditionalPhones']='';var _0x2aebbd=_[_0xc117('0x53')](_0x28901b)['join']();logger[_0xc117('0x58')]('header',_0x2aebbd);fs['writeFileSync'](_0x59df9f,_0x2aebbd+'\x0a');Papa[_0xc117('0x6b')](fs[_0xc117('0x6c')](_0x33587a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b45ba,_0x5e92ec){try{for(var _0x5300a0=0x0,_0x2b5061=[];_0x5300a0<_0x3b45ba[_0xc117('0x6d')]['length'];_0x5300a0++){stats[_0xc117('0x6e')]+=0x1;if(_0x3b45ba[_0xc117('0x5b')][_0x5300a0]){handleError(_0x3b45ba[_0xc117('0x6d')][_0x5300a0],_0x3b45ba['errors'][_0x5300a0]);}else{var _0x1bfc80=[];var _0x54100c=[];var _0x3a6327={};for(var _0x549690 in _0x31f81e){let _0x488f16=contactItemTypes[_0xc117('0x6f')](_0x120df9=>_0x120df9[_0xc117('0x69')]===_0x549690);let _0x24f523=contactItemTypes[_0xc117('0x6f')](_0x29e084=>_0x29e084[_0xc117('0x69')]+_0xc117('0x6a')===_0x549690);if(_[_0xc117('0x1a')](_0x488f16)&&_[_0xc117('0x1a')](_0x24f523)){if(_0x31f81e[_0xc117('0x70')](_0x549690)){if(_0x3b45ba[_0xc117('0x6d')][_0x5300a0][_0x31f81e[_0x549690]]){var _0x1466b9=_[_0xc117('0x71')](_0x3b45ba[_0xc117('0x6d')][_0x5300a0][_0x31f81e[_0x549690]][_0xc117('0x72')](/"/g,'\x27'));switch(_0x549690){case _0xc117('0x35'):var _0x1514b2=moment(_0x1466b9,_0xc117('0xb'),!![]);if(_0x1514b2[_0xc117('0x73')]()){_0x2b5061['push']('\x22'+_0x1466b9+'\x22');}else{_0x1bfc80[_0xc117('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xc117('0x74'):var _0x3aa02f=parseInt(_0x1466b9);_0x1466b9=_[_0xc117('0x75')](_0x3aa02f)||_0x3aa02f<0x0||_0x3aa02f>0x4?_0x25ff8c?0x3:0x2:_0x3aa02f;_0x2b5061[_0xc117('0x1d')]('\x22'+_0x1466b9+'\x22');break;case _0xc117('0x38'):var _0x2f7ac7=parseInt(_0x1466b9);if(_[_0xc117('0x76')](_0x2f7ac7)&&_[_0xc117('0x77')](_0x7f7504,_0x2f7ac7)){_0x2b5061['push']('\x22'+_0x2f7ac7+'\x22');}else{_0x1bfc80[_0xc117('0x1d')](_0xc117('0x78'));}break;case'email':if(isEmail(_0x1466b9)){_0x2b5061[_0xc117('0x1d')]('\x22'+_0x1466b9+'\x22');}else{_0x1bfc80['push'](_0xc117('0x79'));}break;case _0xc117('0x7a'):var _0x16f04e=moment(_0x1466b9,'YYYY-MM-DD',!![]);if(_0x16f04e['isValid']()){_0x2b5061[_0xc117('0x1d')]('\x22'+_0x1466b9+'\x22');}else{_0x1bfc80[_0xc117('0x1d')](_0xc117('0x7b'));}break;default:_0x2b5061['push']('\x22'+_0x1466b9+'\x22');}}else{switch(_0x549690){case _0xc117('0x7c'):case _0xc117('0x1b'):_0x1bfc80[_0xc117('0x1d')](_0x549690+'\x20not\x20specified');break;default:_0x2b5061['push']('\x22\x22');}}}}else{var _0x5edc3f='';if(!_[_0xc117('0x1a')](_0x488f16)){if(!_0x3a6327[_0xc117('0x70')](_0x488f16['id'])){for(var _0x278195=0x0;_0x278195<_0x31f81e[_0x549690][_0xc117('0x19')];_0x278195++){var _0x1466b9=_[_0xc117('0x71')](_0x3b45ba[_0xc117('0x6d')][_0x5300a0][_0x31f81e[_0x549690][_0x278195]][_0xc117('0x72')](/"/g,'\x27'));var _0x872ecb=phoneDescriptions['find'](_0x3b0d94=>_0x3b0d94[_0xc117('0x7d')]===_0x488f16['id']);if(!_[_0xc117('0x1a')](_0x872ecb)){var _0x406f9f=_[_0xc117('0x71')](_0x3b45ba['data'][_0x5300a0][_0x31f81e[_0x872ecb[_0xc117('0x7e')]][0x0]][_0xc117('0x72')](/"/g,'\x27'));if(!_[_0xc117('0x1a')](_0x406f9f))_0x1466b9=_0x1466b9+'§'+_0x406f9f;}if(_0x5edc3f=='')_0x5edc3f=_0x1466b9;else _0x5edc3f+='|'+_0x1466b9;}_0x54100c['push'](_0x488f16['id']+':'+_0x5edc3f);_0x3a6327[_0x488f16['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b5061[_0xc117('0x1d')]('\x22'+_0x54100c[_0xc117('0x11')](';')+'\x22');}if(_0x1bfc80[_0xc117('0x19')]){handleError(_0x3b45ba['data'][_0x5300a0],{'code':'SystemRow','message':_0x1bfc80[_0xc117('0x11')]()});}else{fs[_0xc117('0x7f')](_0x59df9f,_0x2b5061['join']()+'\x0a');}_0x2b5061=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x1a010e,stats);stats[_0xc117('0x5b')]=[];}}if(stopped){logger[_0xc117('0x58')](_0xc117('0x80'));_0x5e92ec['abort']();}}catch(_0x39d014){handleError(_0x3b45ba['data'][_0x5300a0],{'code':'SystemError','message':_0x39d014['message']});logger['error'](_0xc117('0x81'),_0x39d014[_0xc117('0x22')]);}},'complete':function(){try{var _0x9f271a=[];var _0x504f5c=tempTableName;_0x9f271a[_0xc117('0x1d')]('CREATE\x20TABLE\x20'+_0x504f5c+_0xc117('0x82'));logger['info'](_0xc117('0x83'),contactItemTypes[_0xc117('0x19')]);var _0x4bd6fa=util[_0xc117('0xa')](_0xc117('0x84'),_0x59df9f,_0x504f5c,_0x2aebbd,_0xf040d1['ListId'],_0xf040d1[_0xc117('0x85')]||null,NOW,NOW);if(_[_0xc117('0x1a')](_0x31f81e[_0xc117('0x35')])){_0x4bd6fa+=_0xc117('0x86');}_0x9f271a[_0xc117('0x1d')](_0x4bd6fa);BPromise[_0xc117('0x87')](_0x9f271a,handleQuery)[_0xc117('0x1f')](function(_0x284a87){BPromise[_0xc117('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x9f271a=[];for(var _0x4a7a81=0x0;_0x4a7a81\x20\x20','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','CmContactHasItem','findOne','update','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x56eb89,_0xa70f63){_0x56eb89=_0x56eb89-0x0;var _0x237f9d=_0x3d2f[_0x56eb89];return _0x237f9d;};'use strict';var fs=require('fs');var path=require(_0xf3d2('0x0'));var _=require(_0xf3d2('0x1'));var Papa=require('papaparse');var util=require(_0xf3d2('0x2'));var BPromise=require(_0xf3d2('0x3'));var moment=require(_0xf3d2('0x4'));var squel=require(_0xf3d2('0x5'));var Redis=require(_0xf3d2('0x6'));var db=require(_0xf3d2('0x7'))['db'];var config=require(_0xf3d2('0x8'));var logger=require('../../../config/logger')(_0xf3d2('0x9'));config[_0xf3d2('0xa')]=_[_0xf3d2('0xb')](config[_0xf3d2('0xa')],{'host':_0xf3d2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3d2('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()[_0xf3d2('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xf3d2('0xe')+moment()['format'](_0xf3d2('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xbff248){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))*$/[_0xf3d2('0x10')](_0xbff248);}function selectNotIn(_0x3b34c7,_0x3169f5,_0x820c61,_0x4d1252,_0x1c0472){return squel[_0xf3d2('0x11')]()['field'](_0xf3d2('0x12'))['from'](_0x4d1252)[_0xf3d2('0x13')](_0x3169f5,null,_0x3169f5+_0xf3d2('0x14')+_0x4d1252+'.'+_0x820c61)[_0xf3d2('0x15')](_0x4d1252+'.'+_0x820c61+'\x20=\x20'+_0x3b34c7+'.'+_0x820c61)[_0xf3d2('0x15')](_0x3169f5+_0xf3d2('0x16')+_0x1c0472[_0xf3d2('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x30b905,_0x1bf4c1){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf3d2('0x17')]['query'](_0xf3d2('0x18')+tempTableName)[_0xf3d2('0x19')](function(_0x3a43f6){if(_0x3a43f6!==null){var _0x24cfc1=[];for(var _0x92ba9c=0x0;_0x92ba9c<_0x3a43f6[_0xf3d2('0x1a')];_0x92ba9c++){var _0x3f66a2=_0x3a43f6[_0x92ba9c];if(!_[_0xf3d2('0x1b')](_0x3f66a2[_0xf3d2('0x12')])){if(!_['isNil'](_0x3f66a2[_0xf3d2('0x1c')]))_0x24cfc1[_0xf3d2('0x1d')](insertAdditionalPhones(_0x3f66a2));promisesContact['push']({'contact':_0x3f66a2});}}}Promise[_0xf3d2('0x1e')](_0x24cfc1)[_0xf3d2('0x1f')](function(){_0x30b905({'val':0x1});});})[_0xf3d2('0x20')](function(_0x5a6f51){logger[_0xf3d2('0x21')](_0x5a6f51[_0xf3d2('0x22')]);});});}function insertAdditionalPhones(_0xbc222e){return new Promise(function(_0x22eb78,_0x14c016){var _0x1c2b51=_0xbc222e[_0xf3d2('0x1c')];if(_[_0xf3d2('0x1b')](_0x1c2b51))_0x14c016({'val':0x0});else{var _0x12b0d3=_0x1c2b51[_0xf3d2('0x23')](';');var _0x5584ac=[];orderBy=0x0;for(var _0x12e0be=0x0;_0x12e0be<_0x12b0d3[_0xf3d2('0x1a')];_0x12e0be++){_0x5584ac[_0xf3d2('0x1d')](splitAdditionalPhone(_0xbc222e['id'],_0x12b0d3[_0x12e0be]));}Promise[_0xf3d2('0x1e')](_0x5584ac)[_0xf3d2('0x1f')](function(){_0x22eb78({'val':_0x12b0d3[_0xf3d2('0x1a')]});});}});}function splitAdditionalPhone(_0x1d1b44,_0x39f9a8){return new Promise(function(_0x11eed0,_0x5eadd6){var _0x140092=_0x39f9a8[_0xf3d2('0x23')](':');var _0x566ebd=_0x140092[0x0];var _0xab37c2=_0x140092[0x1];if(_0xab37c2!==''){var _0x5e3509=_0xab37c2[_0xf3d2('0x23')]('|');var _0x50e9e7=[];for(var _0x195973=0x0;_0x195973<_0x5e3509[_0xf3d2('0x1a')];_0x195973++){if(_0x5e3509[_0x195973]!==''){var _0x5d8319=_['filter'](promisesAdditionalPhones,{'contactId':_0x1d1b44,'phone':_0x5e3509[_0x195973]});if(_0x5d8319[_0xf3d2('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xf3d2('0x1d')]({'contactId':_0x1d1b44,'contactTypeId':_0x566ebd,'phone':_0x5e3509[_0x195973],'orderBy':orderBy});}}}_0x11eed0({'ok':0x1});}else _0x11eed0({'res':0x0});});}function createAdditionalPhone(_0x179e23,_0x51455d,_0x2ff7c5,_0x3cdb21){var _0x39e846='';var _0x5c866d='';var _0x3a2523=_0x2ff7c5[_0xf3d2('0x23')]('§');_0x39e846=_0x3a2523[0x0];if(_0x3a2523['length']==0x2)_0x5c866d=_0x3a2523[0x1];return new Promise(function(_0x4b28ba,_0x187c53){return db[_0xf3d2('0x24')][_0xf3d2('0x25')]({'where':{'CmContactId':_0x179e23,'item':_0x39e846}})['then'](function(_0x357e2f){if(_0x357e2f){return db[_0xf3d2('0x24')][_0xf3d2('0x26')]({'ItemTypeId':_0x51455d,'description':_0x5c866d,'OrderBy':_0x3cdb21},{'where':{'CmContactId':_0x179e23,'item':_0x39e846}})[_0xf3d2('0x1f')](function(_0x5df3a2){_0x4b28ba({'res':'updated'});});}else{return db[_0xf3d2('0x24')][_0xf3d2('0x27')]({'CmContactId':_0x179e23,'item':_0x39e846,'ItemTypeId':_0x51455d,'description':_0x5c866d,'OrderBy':_0x3cdb21,'ItemClass':'PHONE'})['then'](function(_0x20bc74){_0x4b28ba({'res':_0xf3d2('0x28')});});}});});}function updateContact(_0xda56df){return new Promise(function(_0x3e07f2,_0x25f13a){var _0xa17d5=_0xda56df['id'];delete _0xda56df['id'];return db[_0xf3d2('0x29')][_0xf3d2('0x26')](_0xda56df,{'where':{'id':_0xa17d5}})[_0xf3d2('0x1f')](function(_0x3ed66b){updatedRows+=0x1;return db[_0xf3d2('0x2a')]['update']({'phone':_0xda56df['phone']},{'where':{'ContactId':_0xa17d5}})[_0xf3d2('0x1f')](function(_0x4981b){_0x3e07f2({'ret':'OK'});});});});}function insertCmHopper(_0x257c63,_0x300709,_0x49160c,_0x23051e,_0x12be59){var _0x2c81b3=[_0xf3d2('0x2b'),_0xf3d2('0x2c'),_0xf3d2('0x2d'),_0xf3d2('0x2e'),_0x300709+'.'+_0x23051e,'cm_contacts.createdAt',_0xf3d2('0x2f'),_0xf3d2('0x30'),_0xf3d2('0x31'),'\x22'+_0x12be59+'\x22'];return squel['insert']()[_0xf3d2('0x32')](_0xf3d2('0x33'))['fromQuery'](['phone',_0xf3d2('0x34'),_0xf3d2('0x35'),_0xf3d2('0x36'),_0x23051e,_0xf3d2('0x37'),_0xf3d2('0x38'),_0xf3d2('0x39'),_0xf3d2('0x3a'),_0xf3d2('0x3b')],squel['select']()[_0xf3d2('0x3c')](_0x2c81b3)[_0xf3d2('0x3d')](_0x300709)[_0xf3d2('0x13')]('cm_contacts',null,_0xf3d2('0x3e')+_0x300709+_0xf3d2('0x3f'))['join'](_0x49160c,null,_0x49160c+_0xf3d2('0x14')+_0x300709+'.'+_0x23051e)['where'](_0x300709+'.CmListId\x20=\x20?',_0x257c63)[_0xf3d2('0x15')](_0xf3d2('0x40'),NOW)[_0xf3d2('0x15')](_0xf3d2('0x41'),selectNotIn(_0x300709,_0x49160c,_0x23051e,_0xf3d2('0x33'),['\x22always\x22',_0xf3d2('0x42')]))[_0xf3d2('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x300709,_0x49160c,_0x23051e,'cm_hopper',[_0xf3d2('0x43')])))[_0xf3d2('0x44')]();}function insertCmHopperBlack(_0x1984b8,_0x9669eb,_0x57dbb9,_0x53e460){var _0x9dce08=[_0xf3d2('0x2b'),_0xf3d2('0x2d'),_0xf3d2('0x2e'),_0x9669eb+'.'+_0x53e460,'cm_contacts.createdAt',_0xf3d2('0x2f')];return squel[_0xf3d2('0x45')]()['into']('cm_hopper_black')[_0xf3d2('0x46')]([_0xf3d2('0x12'),_0xf3d2('0x35'),_0xf3d2('0x36'),_0x53e460,_0xf3d2('0x37'),_0xf3d2('0x38')],squel[_0xf3d2('0x11')]()[_0xf3d2('0x3c')](_0x9dce08)[_0xf3d2('0x3d')](_0x9669eb)[_0xf3d2('0x13')]('cm_contacts',null,_0xf3d2('0x3e')+_0x9669eb+_0xf3d2('0x3f'))[_0xf3d2('0x13')](_0x57dbb9,null,_0x57dbb9+'.id\x20=\x20'+_0x9669eb+'.'+_0x53e460)[_0xf3d2('0x15')](_0x9669eb+_0xf3d2('0x47'),_0x1984b8)[_0xf3d2('0x15')](_0xf3d2('0x40'),NOW)['where'](_0xf3d2('0x41'),squel[_0xf3d2('0x11')]()[_0xf3d2('0x48')](_0xf3d2('0x12'))[_0xf3d2('0x3d')](_0xf3d2('0x49'))[_0xf3d2('0x15')](_0xf3d2('0x4a'),_0x1984b8)[_0xf3d2('0x15')](_0x53e460+_0xf3d2('0x4b'),_0x9669eb+'.'+_0x53e460)))[_0xf3d2('0x44')]();}function insertCmHopperAdditionalPhones(_0x401c2d){var _0x3ca666=[_0xf3d2('0x4c'),_0xf3d2('0x4d'),_0xf3d2('0x4e'),_0xf3d2('0x4f'),'cm_contact_has_items.updatedAt'];return squel[_0xf3d2('0x45')]()[_0xf3d2('0x32')](_0xf3d2('0x50'))[_0xf3d2('0x46')]([_0xf3d2('0x51'),_0xf3d2('0x12'),_0xf3d2('0x52'),'createdAt','updatedAt'],squel[_0xf3d2('0x11')]()[_0xf3d2('0x3c')](_0x3ca666)[_0xf3d2('0x3d')](_0xf3d2('0x33'))[_0xf3d2('0x13')](_0xf3d2('0x53'),null,_0xf3d2('0x54'))[_0xf3d2('0x13')]('cm_contact_has_items',null,_0xf3d2('0x55'))[_0xf3d2('0x15')](_0xf3d2('0x56'),_0x401c2d)[_0xf3d2('0x15')](_0xf3d2('0x40'),NOW))[_0xf3d2('0x44')]();}function insertCmContact(_0x11e190,_0x41ee21,_0x580fbf,_0x4da774){var _0x213b83=_[_0xf3d2('0x57')](_[_0xf3d2('0x58')](_0x4da774),[_0xf3d2('0x36'),'CompanyId','createdAt',_0xf3d2('0x38')]);return squel['insert']()[_0xf3d2('0x32')]('cm_contacts')[_0xf3d2('0x46')](_0x213b83,squel[_0xf3d2('0x11')]()[_0xf3d2('0x3c')](_0x213b83)['from'](_0x41ee21)[_0xf3d2('0x15')]('('+_0x580fbf[_0xf3d2('0x13')](',')+_0xf3d2('0x59'),squel[_0xf3d2('0x11')]()[_0xf3d2('0x3c')](_0x580fbf)[_0xf3d2('0x3d')]('cm_contacts')[_0xf3d2('0x15')](_0xf3d2('0x4a'),_0x11e190))[_0xf3d2('0x15')]('id\x20IN\x20?',squel[_0xf3d2('0x11')]()[_0xf3d2('0x48')](_0xf3d2('0x5a'),_0xf3d2('0x5b'))['from'](_0x41ee21)[_0xf3d2('0x5c')](_0x580fbf[_0xf3d2('0x13')](','))))[_0xf3d2('0x44')]();}function handleStop(){logger[_0xf3d2('0x5d')](_0xf3d2('0x5e'));stopped=!![];}function handleUncaughtException(_0xd7328b){logger[_0xf3d2('0x21')](_0xd7328b[_0xf3d2('0x22')]);process['exit'](0x1);}function handleError(_0x660b8b,_0x50eb62){stats['errors'][_0xf3d2('0x1d')]({'name':_0x50eb62[_0xf3d2('0x5f')],'message':_0x50eb62[_0xf3d2('0x22')],'row':_0x660b8b});}function handleQuery(_0xf413a1){logger[_0xf3d2('0x5d')](_0xf413a1);return db['sequelize'][_0xf3d2('0x60')](_0xf413a1)[_0xf3d2('0x19')](function(_0x2befce){results[_0xf3d2('0x1d')](_0x2befce);})[_0xf3d2('0x20')](function(_0x2ecbac){logger[_0xf3d2('0x21')](_0x2ecbac[_0xf3d2('0x22')]);});}function main(_0x586dee,_0x4c9552,_0x1d7c96,_0x5f58b3){logger[_0xf3d2('0x5d')](_0xf3d2('0x61'),_0x586dee,JSON['stringify'](_0x4c9552));process['send']('start');var _0x30d465=_0x4c9552[_0xf3d2('0x62')];var _0xcec9d7=_[_0xf3d2('0x63')](_0x30d465);var _0x4539be=_0x4c9552[_0xf3d2('0x64')];var _0x46773a=path['join'](config[_0xf3d2('0x65')],_0xf3d2('0x66'),_0x4539be+'.csv');logger[_0xf3d2('0x5d')]('body',_0x4c9552);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})[_0xf3d2('0x1f')](function(_0x19a614){for(var _0x46d4de=0x0;_0x46d4de<_0x19a614[_0xf3d2('0x1a')];_0x46d4de++){if(_0x19a614[_0x46d4de]['name']in _0x30d465){contactItemTypes['push'](_0x19a614[_0x46d4de]);delete _0xcec9d7[_0x19a614[_0x46d4de][_0xf3d2('0x67')]];hasAdditionalPhones=!![];}for(var _0x15ca80 in _0x30d465){if(_0x19a614[_0x46d4de]['name']+'_description'===_0x15ca80){phoneDescriptions['push']({'itemTypeId':_0x19a614[_0x46d4de]['id'],'description':_0x15ca80});delete _0xcec9d7[_0x15ca80];}}}if(hasAdditionalPhones)_0xcec9d7[_0xf3d2('0x1c')]='';var _0x4ca331=_[_0xf3d2('0x58')](_0xcec9d7)['join']();logger[_0xf3d2('0x5d')](_0xf3d2('0x68'),_0x4ca331);fs[_0xf3d2('0x69')](_0x46773a,_0x4ca331+'\x0a');Papa[_0xf3d2('0x6a')](fs[_0xf3d2('0x6b')](_0x586dee),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2cc5a3,_0xa06107){try{for(var _0x1ec9fd=0x0,_0x41e006=[];_0x1ec9fd<_0x2cc5a3[_0xf3d2('0x6c')][_0xf3d2('0x1a')];_0x1ec9fd++){stats[_0xf3d2('0x6d')]+=0x1;if(_0x2cc5a3[_0xf3d2('0x6e')][_0x1ec9fd]){handleError(_0x2cc5a3[_0xf3d2('0x6c')][_0x1ec9fd],_0x2cc5a3['errors'][_0x1ec9fd]);}else{var _0x54c46c=[];var _0x3d470c=[];var _0xd78412={};for(var _0x16f6d1 in _0x30d465){let _0x1742a5=contactItemTypes[_0xf3d2('0x6f')](_0x14267b=>_0x14267b[_0xf3d2('0x67')]===_0x16f6d1);let _0x1bebb4=contactItemTypes[_0xf3d2('0x6f')](_0x379d95=>_0x379d95[_0xf3d2('0x67')]+'_description'===_0x16f6d1);if(_[_0xf3d2('0x1b')](_0x1742a5)&&_[_0xf3d2('0x1b')](_0x1bebb4)){if(_0x30d465[_0xf3d2('0x70')](_0x16f6d1)){if(_0x2cc5a3[_0xf3d2('0x6c')][_0x1ec9fd][_0x30d465[_0x16f6d1]]){var _0x3522fd=_[_0xf3d2('0x71')](_0x2cc5a3[_0xf3d2('0x6c')][_0x1ec9fd][_0x30d465[_0x16f6d1]][_0xf3d2('0x72')](/"/g,'\x27'));switch(_0x16f6d1){case _0xf3d2('0x34'):var _0x3de47f=moment(_0x3522fd,_0xf3d2('0x73'),!![]);if(_0x3de47f[_0xf3d2('0x74')]()){_0x41e006[_0xf3d2('0x1d')]('\x22'+_0x3522fd+'\x22');}else{_0x54c46c[_0xf3d2('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xf3d2('0x39'):var _0x2a6834=parseInt(_0x3522fd);_0x3522fd=_[_0xf3d2('0x75')](_0x2a6834)||_0x2a6834<0x0||_0x2a6834>0x4?_0x5f58b3?0x3:0x2:_0x2a6834;_0x41e006[_0xf3d2('0x1d')]('\x22'+_0x3522fd+'\x22');break;case'UserId':var _0x496064=parseInt(_0x3522fd);if(_[_0xf3d2('0x76')](_0x496064)&&_['includes'](_0x1d7c96,_0x496064)){_0x41e006[_0xf3d2('0x1d')]('\x22'+_0x496064+'\x22');}else{_0x54c46c[_0xf3d2('0x1d')](_0xf3d2('0x77'));}break;case _0xf3d2('0x78'):if(isEmail(_0x3522fd)){_0x41e006[_0xf3d2('0x1d')]('\x22'+_0x3522fd+'\x22');}else{_0x54c46c[_0xf3d2('0x1d')](_0xf3d2('0x79'));}break;case _0xf3d2('0x7a'):var _0x291a97=moment(_0x3522fd,_0xf3d2('0x7b'),!![]);if(_0x291a97[_0xf3d2('0x74')]()){_0x41e006[_0xf3d2('0x1d')]('\x22'+_0x3522fd+'\x22');}else{_0x54c46c[_0xf3d2('0x1d')](_0xf3d2('0x7c'));}break;default:_0x41e006[_0xf3d2('0x1d')]('\x22'+_0x3522fd+'\x22');}}else{switch(_0x16f6d1){case _0xf3d2('0x7d'):case'phone':_0x54c46c[_0xf3d2('0x1d')](_0x16f6d1+_0xf3d2('0x7e'));break;default:_0x41e006[_0xf3d2('0x1d')]('\x22\x22');}}}}else{var _0x5b7b55='';if(!_[_0xf3d2('0x1b')](_0x1742a5)){if(!_0xd78412[_0xf3d2('0x70')](_0x1742a5['id'])){for(var _0x39561e=0x0;_0x39561e<_0x30d465[_0x16f6d1][_0xf3d2('0x1a')];_0x39561e++){var _0x3522fd=_[_0xf3d2('0x71')](_0x2cc5a3[_0xf3d2('0x6c')][_0x1ec9fd][_0x30d465[_0x16f6d1][_0x39561e]]['replace'](/"/g,'\x27'));var _0x5cb2a9=phoneDescriptions[_0xf3d2('0x6f')](_0x2bdd8e=>_0x2bdd8e[_0xf3d2('0x7f')]===_0x1742a5['id']);if(!_['isNil'](_0x5cb2a9)){var _0x1b4dec=_[_0xf3d2('0x71')](_0x2cc5a3[_0xf3d2('0x6c')][_0x1ec9fd][_0x30d465[_0x5cb2a9[_0xf3d2('0x80')]][0x0]][_0xf3d2('0x72')](/"/g,'\x27'));if(!_[_0xf3d2('0x1b')](_0x1b4dec))_0x3522fd=_0x3522fd+'§'+_0x1b4dec;}if(_0x5b7b55=='')_0x5b7b55=_0x3522fd;else _0x5b7b55+='|'+_0x3522fd;}_0x3d470c[_0xf3d2('0x1d')](_0x1742a5['id']+':'+_0x5b7b55);_0xd78412[_0x1742a5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x41e006[_0xf3d2('0x1d')]('\x22'+_0x3d470c[_0xf3d2('0x13')](';')+'\x22');}if(_0x54c46c[_0xf3d2('0x1a')]){handleError(_0x2cc5a3[_0xf3d2('0x6c')][_0x1ec9fd],{'code':_0xf3d2('0x81'),'message':_0x54c46c['join']()});}else{fs[_0xf3d2('0x82')](_0x46773a,_0x41e006[_0xf3d2('0x13')]()+'\x0a');}_0x41e006=[];}if(!(stats[_0xf3d2('0x6d')]%0xc8)){socket['emit']('contact:import:'+_0x4539be,stats);stats[_0xf3d2('0x6e')]=[];}}if(stopped){logger[_0xf3d2('0x5d')]('Abort\x20parser');_0xa06107[_0xf3d2('0x83')]();}}catch(_0x1c98a3){handleError(_0x2cc5a3[_0xf3d2('0x6c')][_0x1ec9fd],{'code':_0xf3d2('0x84'),'message':_0x1c98a3['message']});logger[_0xf3d2('0x21')]('step',_0x1c98a3[_0xf3d2('0x22')]);}},'complete':function(){try{var _0x4a7d55=[];var _0x48b06d=tempTableName;_0x4a7d55[_0xf3d2('0x1d')](_0xf3d2('0x85')+_0x48b06d+_0xf3d2('0x86'));logger[_0xf3d2('0x5d')](_0xf3d2('0x87'),contactItemTypes[_0xf3d2('0x1a')]);var _0x304610=util[_0xf3d2('0xd')](_0xf3d2('0x88'),_0x46773a,_0x48b06d,_0x4ca331,_0x4c9552['ListId'],_0x4c9552[_0xf3d2('0x89')]||null,NOW,NOW);if(_['isNil'](_0x30d465['scheduledat'])){_0x304610+=_0xf3d2('0x8a');}_0x4a7d55[_0xf3d2('0x1d')](_0x304610);BPromise[_0xf3d2('0x8b')](_0x4a7d55,handleQuery)[_0xf3d2('0x1f')](function(_0x54112b){BPromise[_0xf3d2('0x1e')]([handleAdditionalPhones()])[_0xf3d2('0x1f')](function(){_0x4a7d55=[];for(var _0x392e9b=0x0;_0x392e9b\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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?'];(function(_0x44b340,_0x312603){var _0x44878b=function(_0x3f1c8b){while(--_0x3f1c8b){_0x44b340['push'](_0x44b340['shift']());}};_0x44878b(++_0x312603);}(_0x0982,0x1ee));var _0x2098=function(_0x26c099,_0x1da185){_0x26c099=_0x26c099-0x0;var _0x42cb2e=_0x0982[_0x26c099];return _0x42cb2e;};'use strict';var _=require(_0x2098('0x0'));var squel=require(_0x2098('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x2098('0x2'));var updateInteraction=require(_0x2098('0x3'))[_0x2098('0x4')];var utils=require(_0x2098('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x8e0d99,_0x35d06e,_0x16f76d){var _0x345621=![];var _0x32adac=utils[_0x2098('0x6')](_0x8e0d99);if(_0x35d06e['role']===_0x2098('0x7')&&!_0x16f76d['search']&&!_0x16f76d[_0x32adac]){_0x345621=!![];}return _0x345621;}function getTagsQuery(){return squel[_0x2098('0x8')]()[_0x2098('0x9')]('id')['field']('name')[_0x2098('0x9')](_0x2098('0xa'))[_0x2098('0xb')](_0x2098('0xc'));}function getUsersQuery(_0x5ae2ee,_0x4c5d4d){var _0x41f8b5=utils[_0x2098('0xd')](_0x5ae2ee);var _0x59de5b=_0x2098('0xe')+_0x5ae2ee+_0x2098('0xf');var _0x5036b6=squel[_0x2098('0x8')]()[_0x2098('0x9')](_0x2098('0x10'))['field'](_0x2098('0x11'))[_0x2098('0x9')](_0x2098('0x12')+_0x41f8b5)[_0x2098('0xb')](_0x59de5b,'ui')[_0x2098('0x13')]('users','u','u.id\x20=\x20ui.UserId');if(_0x4c5d4d[_0x2098('0x14')]>0x0){_0x5036b6[_0x2098('0x15')]('ui.'+_0x41f8b5+'\x20IN\x20?',_[_0x2098('0x16')](_0x4c5d4d,'id'));}return _0x5036b6;}function getInteractionsQuery(_0x17b8f1){var _0x1f3a87=utils[_0x2098('0x17')](_0x17b8f1);var _0x589341=utils[_0x2098('0x6')](_0x17b8f1);var _0x505e34=utils['getInteractionFK'](_0x17b8f1);return squel[_0x2098('0x8')]()[_0x2098('0xb')](_0x1f3a87[_0x2098('0x18')],'i')[_0x2098('0x13')](_0x2098('0x19'),'c',_0x2098('0x1a'))[_0x2098('0x13')](_0x2098('0x1b'),'o',_0x2098('0x1c'))[_0x2098('0x13')](_0x1f3a87[_0x2098('0x1d')],'a',_0x2098('0x1e')+_0x589341)[_0x2098('0x13')](_0x1f3a87[_0x2098('0x1f')],'me','me.'+_0x505e34+_0x2098('0x20'))[_0x2098('0x13')](_0x1f3a87[_0x2098('0x21')],'it',_0x2098('0x22')+_0x505e34+_0x2098('0x20'))[_0x2098('0x13')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x149d41={'body':squel[_0x2098('0x23')](),'contact':squel[_0x2098('0x23')](),'default':squel[_0x2098('0x23')](),'fields':squel[_0x2098('0x23')](),'filter':squel['expr'](),'read':squel[_0x2098('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x149d41;}function parseTagParameter(_0x3313dc){var _0x5c955d=squel[_0x2098('0x23')]();if(_0x3313dc){var _0x139050=utils['getSelectedTags'](_0x3313dc);_0x139050[_0x2098('0x24')](function(_0x5394ce){_0x5c955d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5394ce+',%');});}return _0x5c955d;}function parseReadParameter(_0x2cb73f){var _0x44728b='';if(_0x2cb73f){_0x44728b=_0x2098('0x25');if(_0x2cb73f==='1'){_0x44728b=_0x44728b[_0x2098('0x26')](_0x2098('0x27'),'=');}else{_0x44728b=_0x44728b[_0x2098('0x26')](_0x2098('0x27'),'>');}}return _0x44728b;}function parseSearchFilter(_0x1edf3d,_0x31480e){var _0x18d648=squel[_0x2098('0x23')]();if(_0x31480e){var _0x35049f=_0x31480e[_0x2098('0x26')]('\x5c','\x5c\x5c')[_0x2098('0x26')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x35049f)){_0x18d648['or'](_0x2098('0x28'),_0x35049f+'%');if([_0x2098('0x29'),'whatsapp'][_0x2098('0x2a')](_0x1edf3d)){_0x18d648['or']('i.phone\x20LIKE\x20?',_0x35049f+'%');}else if(_0x1edf3d==='fax'){_0x18d648['or'](_0x2098('0x2b'),_0x35049f+'%');}else if(_0x1edf3d==='openchannel'){_0x18d648['or'](_0x2098('0x2c'),_0x35049f+'%');}}else if(_0x1edf3d===_0x2098('0x2d')&&qs[_0x2098('0x2e')](_0x35049f)){_0x18d648['or'](_0x2098('0x2f'),_0x35049f+'%');}else{if(_0x1edf3d===_0x2098('0x2d')){_0x18d648['or'](_0x2098('0x30'),qs[_0x2098('0x31')](_0x35049f,!![]))['or'](_0x2098('0x32'),qs[_0x2098('0x31')](_0x35049f));}else if(_0x1edf3d!==_0x2098('0x33')){_0x18d648['or'](_0x2098('0x34'),qs['getFullTextValue'](_0x35049f));}_0x18d648['or'](_0x2098('0x35'),qs[_0x2098('0x31')](_0x35049f,!![]),null);}}return _0x18d648;}function parseAdvancedSearchFilter(_0x4fa3fa,_0x2e3aec){var _0xcae40d=getSqlClauses();var _0x1a6131=as[_0x2098('0x36')](_0x4fa3fa);var _0x2433c5=_0x1a6131[_0x2098('0x37')];for(var _0x4121e7=0x0;_0x4121e7<_0x1a6131[_0x2098('0x38')][_0x2098('0x14')];_0x4121e7++){var _0x591b09=_0x1a6131['conditions'][_0x4121e7];var _0xd5c0f='i';var _0x6b26f2=_[_0x2098('0x39')](_0x2e3aec,[_0x2098('0x3a'),_0x591b09[_0x2098('0x9')]]);if(_0x6b26f2){var _0x32d72f=as['buildExpression'](_0xd5c0f,_0x6b26f2[_0x2098('0x3b')],_0x591b09);_0xcae40d[_0x2098('0x3c')][_0x2433c5](_0x32d72f['text'],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3f')]);}else{switch(_0x591b09[_0x2098('0x9')]){case _0x2098('0x40'):var _0x47d624=parseReadParameter(_0x591b09[_0x2098('0x3d')]);_0xcae40d[_0x2098('0x41')][_0x2098('0x42')](_0x47d624);break;case'Contact':if(_0x591b09[_0x2098('0x43')]===_0x2098('0x44')){if(_0x591b09[_0x2098('0x3d')]['split']('\x20')[_0x2098('0x14')]>0x1){_0xcae40d['contact'][_0x2433c5](_0x2098('0x35'),qs[_0x2098('0x31')](_0x591b09[_0x2098('0x3d')],!![]),null);}else{var _0x1563b7='%'+_0x591b09[_0x2098('0x3d')]+'%';_0xcae40d[_0x2098('0x45')][_0x2433c5](_0x2098('0x46'),_0x1563b7,_0x1563b7,_0x1563b7);}}else{_0x6b26f2=_[_0x2098('0x39')](_0x2e3aec,['name','ContactId']);_0x591b09[_0x2098('0x9')]=_0x2098('0x47');_0x32d72f=as[_0x2098('0x48')](_0xd5c0f,_0x6b26f2['type'],_0x591b09);_0xcae40d[_0x2098('0x45')][_0x2433c5](_0x32d72f[_0x2098('0x49')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f[_0x2098('0x3d')]['end']);}break;case _0x2098('0x4a'):var _0x4c98d7=_0x591b09['value'][_0x2098('0x4b')](',')[_0x2098('0x16')](function(_0x518973){return Number(_0x518973);});var _0x3696b0=parseTagParameter(_0x4c98d7);_0xcae40d[_0x2098('0x4c')]['clause'][_0x2098('0x42')](_0x3696b0);_0xcae40d['tags'][_0x2098('0x4d')]=_0x4c98d7;break;case _0x2098('0x4e'):if(_0x591b09[_0x2098('0x43')]===_0x2098('0x44')){_0xcae40d['user'][_0x2433c5](_0x2098('0x4f'),'%'+_0x591b09[_0x2098('0x3d')]+'%',null);}else{_0x6b26f2=_[_0x2098('0x39')](_0x2e3aec,['name',_0x2098('0x50')]);_0x591b09[_0x2098('0x9')]='UserId';_0x32d72f=as[_0x2098('0x48')](_0xd5c0f,_0x6b26f2[_0x2098('0x3b')],_0x591b09);_0xcae40d[_0x2098('0x51')][_0x2433c5](_0x32d72f[_0x2098('0x49')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3f')]);}break;case _0x2098('0x52'):case'plainBody':_0x32d72f=as[_0x2098('0x48')]('me',null,_0x591b09);_0xcae40d[_0x2098('0x52')][_0x2433c5](_0x32d72f[_0x2098('0x49')],_0x32d72f[_0x2098('0x3d')][_0x2098('0x3e')],_0x32d72f['value'][_0x2098('0x3f')]);break;}}}return _0xcae40d;}function parseModelFields(_0xc789ff,_0x59a874,_0x196144){var _0x57a2a1=utils[_0x2098('0x6')](_0xc789ff);var _0x2d0a0f=squel['expr']();var _0x1707c7=_(_0x59a874)[_0x2098('0x53')]()[_0x2098('0x16')](function(_0x110107){return _[_0x2098('0x54')](_0x196144,['name',_0x110107])?_0x110107:undefined;})['compact']()[_0x2098('0x3d')]();if(_0x1707c7[_0x2098('0x14')]>0x0){_0x1707c7[_0x2098('0x24')](function(_0x542b30){if(_0x542b30===_0x57a2a1){_0x2d0a0f[_0x2098('0x42')]('i.'+_0x57a2a1+_0x2098('0x55'),[][_0x2098('0x56')](_0x59a874[_0x542b30]));}else if(_0x542b30===_0x2098('0x57')){var _0x256f76=JSON['parse'](_0x59a874[_0x542b30])['$gte'];var _0x294168=JSON[_0x2098('0x58')](_0x59a874[_0x542b30])[_0x2098('0x59')];_0x2d0a0f[_0x2098('0x42')](_0x2098('0x5a'),_0x256f76,_0x294168);}else{if(_0x59a874[_0x542b30]===_0x2098('0x5b')){_0x2d0a0f[_0x2098('0x42')]('i.'+_0x542b30+'\x20IS\x20NULL');}else{_0x2d0a0f[_0x2098('0x42')]('i.'+_0x542b30+_0x2098('0x5c'),_0x59a874[_0x542b30]);}}});}return _0x2d0a0f;}function parseQueryParameters(_0x2359f5,_0xed053,_0x13423e){var _0x2fe7f8=getSqlClauses();return Promise[_0x2098('0x5d')]()['then'](function(){return parseModelFields(_0x2359f5,_0xed053,_0x13423e);})[_0x2098('0x5e')](function(_0x91e5a4){_0x2fe7f8['fields'][_0x2098('0x42')](_0x91e5a4);return parseReadParameter(_0xed053[_0x2098('0x41')]);})[_0x2098('0x5e')](function(_0x51ce3c){_0x2fe7f8['read'][_0x2098('0x42')](_0x51ce3c);return parseTagParameter(_0xed053[_0x2098('0x5f')]);})['then'](function(_0x15c246){_0x2fe7f8[_0x2098('0x4c')][_0x2098('0x60')][_0x2098('0x42')](_0x15c246);return parseSearchFilter(_0x2359f5,_0xed053['filter']);})[_0x2098('0x5e')](function(_0xef5dcc){_0x2fe7f8[_0x2098('0x61')]=_0xef5dcc;return _0x2fe7f8;});}function checkAccountsRestrictions(_0x4f0b56,_0x584ac2,_0x511e57){var _0x86cace=utils['getAccountFK'](_0x4f0b56);var _0x939ec2='get'+_[_0x2098('0x62')](_0x4f0b56)+(_0x4f0b56===_0x2098('0x63')?_0x2098('0x64'):_0x2098('0x65'));var _0x11c6cb=squel[_0x2098('0x23')]();return Promise[_0x2098('0x5d')]()[_0x2098('0x5e')](function(){if(_0x511e57[_0x2098('0x66')]&&_0x584ac2[_0x2098('0x67')]===_0x2098('0x7')){return _0x584ac2[_0x939ec2]({'attributes':['id'],'raw':!![]});}})[_0x2098('0x5e')](function(_0x3c1727){if(_0x3c1727){if(_0x3c1727[_0x2098('0x14')]===0x0){_0x11c6cb[_0x2098('0x42')]('i.'+_0x86cace+_0x2098('0x68'));}else{_0x11c6cb[_0x2098('0x42')]('i.'+_0x86cace+'\x20IN\x20?',_['map'](_0x3c1727,'id'));}}else if(!_0x511e57[_0x86cace]){_0x11c6cb[_0x2098('0x42')]('i.'+_0x86cace+_0x2098('0x69'));}})[_0x2098('0x5e')](function(){return _0x11c6cb;});}function getClosedOrderClause(_0x1f9b06,_0x27db3b){var _0x2abcfa='';var _0x2f10e7=['i.thirdDisposition',_0x2098('0x6a'),_0x2098('0x6b')];if(_0x1f9b06===_0x2098('0x2d')){_0x2f10e7[_0x2098('0x6c')](_0x2098('0x6d'));}if(_0x27db3b[_0x2098('0x6e')]==='0'&&_0x1f9b06===_0x2098('0x2d')){_0x2abcfa=_0x2098('0x6d');}else{if(_0x27db3b[_0x2098('0x6e')]==='1'){_0x2f10e7[_0x2098('0x6f')]();}_0x2abcfa=_0x2098('0x70')+_0x2f10e7[_0x2098('0x71')](',\x20')+')';}return _0x2abcfa;}function getFilteredInteractions(_0x39e8f3,_0x105d84,_0x4119ff,_0x298de1){var _0x48d1f3=utils[_0x2098('0xd')](_0x39e8f3);var _0x418f94=_[_0x2098('0x62')](_0x39e8f3)+'Interaction';var _0x5eac26=[];var _0x1262b0=getTagsQuery();var _0x2e2d50={'type':db[_0x2098('0x72')][_0x2098('0x73')]['SELECT'],'raw':!![]};var _0x5e9fbc=[];var _0x852248=[];return db[_0x2098('0x74')]['query'](_0x1262b0[_0x2098('0x75')](),_0x2e2d50)[_0x2098('0x5e')](function(_0x507880){_0x5eac26=_[_0x2098('0x76')](_0x507880,'id');_0x2e2d50=_['merge'](_0x2e2d50,{'model':db[_0x418f94],'mapToModel':!![],'nest':!![]});if(_0x4119ff[_0x2098('0x77')]){_0x298de1['attributes']['forEach'](function(_0x535021){_0x105d84[_0x2098('0x9')]('i.'+_0x535021);});}else{_0x105d84['field'](_0x2098('0x78'),'unreadMessages');_0x105d84[_0x2098('0x9')]('a.key',_0x2098('0x79'));_0x105d84[_0x2098('0x9')](_0x2098('0x7a'),_0x2098('0x7b'));if(_0x39e8f3===_0x2098('0x2d')){_0x105d84[_0x2098('0x9')](_0x2098('0x7c'),_0x2098('0x7d'));_0x105d84[_0x2098('0x9')]('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',_0x2098('0x7e'));_0x105d84[_0x2098('0x9')](_0x2098('0x7f'));_0x105d84['field'](_0x2098('0x80'));_0x105d84[_0x2098('0x9')](_0x2098('0x81'));_0x105d84[_0x2098('0x9')](_0x2098('0x82'));_0x105d84[_0x2098('0x9')](_0x2098('0x83'));_0x105d84[_0x2098('0x9')]('i.attach');_0x105d84[_0x2098('0x9')](_0x2098('0x84'));_0x105d84[_0x2098('0x9')]('i.lastMsgDirection');_0x105d84[_0x2098('0x9')](_0x2098('0x85'));_0x105d84[_0x2098('0x9')](_0x2098('0x6b'));_0x105d84[_0x2098('0x9')](_0x2098('0x6a'));_0x105d84[_0x2098('0x9')]('i.thirdDisposition');_0x105d84[_0x2098('0x9')](_0x2098('0x6d'));_0x105d84[_0x2098('0x9')](_0x2098('0x86'));_0x105d84[_0x2098('0x9')](_0x2098('0x87'));_0x105d84[_0x2098('0x9')]('i.MailAccountId');_0x105d84[_0x2098('0x9')](_0x2098('0x88'));}else if(_0x39e8f3==='openchannel'){_0x105d84['field'](_0x2098('0x89'),'contactName');}else{_0x105d84['field'](_0x2098('0x8a'),_0x2098('0x7e'));}if(_0x39e8f3!==_0x2098('0x2d')){_0x105d84['field'](_0x2098('0x8b'));}_0x105d84[_0x2098('0x9')](_0x2098('0x8c'),_0x2098('0x8d'));_0x105d84[_0x2098('0x9')](_0x2098('0x8e'),_0x2098('0x8f'));_0x105d84[_0x2098('0x9')](_0x2098('0x90'),_0x2098('0x91'));_0x105d84['field']('c.phone','Contact.phone');_0x105d84[_0x2098('0x9')](_0x2098('0x92'),_0x2098('0x93'));_0x105d84[_0x2098('0x9')](_0x2098('0x94'),'Contact.fax');_0x105d84[_0x2098('0x9')]('o.fullname','Owner.fullname');_0x105d84[_0x2098('0x9')](_0x2098('0x95'),_0x2098('0x96'));_0x105d84[_0x2098('0x9')](_0x2098('0x97'),_0x2098('0x98'));}if(_0x298de1['limit']){_0x105d84[_0x2098('0x99')](_0x298de1[_0x2098('0x99')]);}if(_0x298de1[_0x2098('0x9a')]){_0x105d84[_0x2098('0x9a')](_0x298de1['offset']);}return db[_0x2098('0x74')]['query'](_0x105d84[_0x2098('0x75')](),_0x2e2d50);})['then'](function(_0x4ad029){_0x5e9fbc=_0x4ad029;var _0x6656ea=getUsersQuery(_0x39e8f3,_0x5e9fbc);return db['sequelize'][_0x2098('0x9b')](_0x6656ea[_0x2098('0x75')](),_0x2e2d50);})[_0x2098('0x5e')](function(_0xa585cb){_0x852248=_[_0x2098('0x9c')](_0xa585cb,_0x48d1f3);if(_0x39e8f3===_0x2098('0x2d')){return db[_0x2098('0x9d')]['findOne']({'attributes':[_0x2098('0x9e')],'raw':!![]});}})['then'](function(_0x31942e){var _0x2bdf2c=_0x31942e?_0x31942e[_0x2098('0x9e')]:undefined;var _0x317ab7=_0x5e9fbc['map'](function(_0x306f60){return updateInteraction(_0x306f60,_0x5eac26,_0x852248,_0x2bdf2c);});return Promise['all'](_0x317ab7);});}function countFilteredInteractions(_0x1bb907,_0x13b9f3){var _0x34a6e2=_0x1bb907[_0x2098('0x9f')]();_0x34a6e2[_0x2098('0x9')](_0x2098('0xa0'));_0x34a6e2[_0x2098('0x9')](_0x2098('0x78'),_0x2098('0x40'));var _0x51ac08=utils['getSelectedTags'](_0x13b9f3);if(!_['isEmpty'](_0x51ac08)){_0x34a6e2[_0x2098('0x15')](_0x2098('0xa1'),_0x51ac08);}var _0x442a81={'type':db[_0x2098('0x72')][_0x2098('0x73')][_0x2098('0xa2')],'raw':!![]};return db['sequelize'][_0x2098('0x9b')](_0x34a6e2['toString'](),_0x442a81);}module[_0x2098('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xf33e=['i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.ContactId','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','i.*','Contact.firstName','c.lastName','c.email','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','groupBy','enableEmailPreview','all','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','QueryTypes','exports','squel','../parsers/advancedSearch','./update-interaction','./utils','getAccountFK','role','agent','search','select','field','name','color','tools_tags','user_has_','_interactions','u.fullname','ui.','from','users','length','where','map','getInteractionsTables','getInteractionFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','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','find','type','default','text','value','start','end','unreadMessages','read','and','$substring','split','contact','ContactId','tags','clause','ids','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','plainBody','keys','some','concat','parse','\x20=\x20?','resolve','then','fields','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NULL','\x20IN\x20?','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','sequelize','query','toString','merge','Account.key','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.attach'];(function(_0x3361bd,_0x3876c6){var _0x5c9e04=function(_0x493304){while(--_0x493304){_0x3361bd['push'](_0x3361bd['shift']());}};_0x5c9e04(++_0x3876c6);}(_0xf33e,0xb5));var _0xef33=function(_0x1ad931,_0x42ad8a){_0x1ad931=_0x1ad931-0x0;var _0x38eac1=_0xf33e[_0x1ad931];return _0x38eac1;};'use strict';var _=require('lodash');var squel=require(_0xef33('0x0'));var as=require(_0xef33('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0xef33('0x2'))['updateInteraction'];var utils=require(_0xef33('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x215b68,_0x41fc8e,_0x18e41c){var _0x373719=![];var _0x5979e1=utils[_0xef33('0x4')](_0x215b68);if(_0x41fc8e[_0xef33('0x5')]===_0xef33('0x6')&&!_0x18e41c[_0xef33('0x7')]&&!_0x18e41c[_0x5979e1]){_0x373719=!![];}return _0x373719;}function getTagsQuery(){return squel[_0xef33('0x8')]()[_0xef33('0x9')]('id')['field'](_0xef33('0xa'))['field'](_0xef33('0xb'))['from'](_0xef33('0xc'));}function getUsersQuery(_0x5ab16e,_0x183fbc){var _0x37b46c=utils['getInteractionFK'](_0x5ab16e);var _0x1d95de=_0xef33('0xd')+_0x5ab16e+_0xef33('0xe');var _0x3dbb13=squel[_0xef33('0x8')]()[_0xef33('0x9')]('u.id')[_0xef33('0x9')](_0xef33('0xf'))['field'](_0xef33('0x10')+_0x37b46c)[_0xef33('0x11')](_0x1d95de,'ui')['left_join'](_0xef33('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x183fbc[_0xef33('0x13')]>0x0){_0x3dbb13[_0xef33('0x14')]('ui.'+_0x37b46c+'\x20IN\x20?',_[_0xef33('0x15')](_0x183fbc,'id'));}return _0x3dbb13;}function getInteractionsQuery(_0x57e20e){var _0x3f8577=utils[_0xef33('0x16')](_0x57e20e);var _0xc3d9f9=utils[_0xef33('0x4')](_0x57e20e);var _0x7945e7=utils[_0xef33('0x17')](_0x57e20e);return squel['select']()[_0xef33('0x11')](_0x3f8577['interactions'],'i')['left_join'](_0xef33('0x18'),'c',_0xef33('0x19'))[_0xef33('0x1a')](_0xef33('0x12'),'o',_0xef33('0x1b'))[_0xef33('0x1a')](_0x3f8577[_0xef33('0x1c')],'a',_0xef33('0x1d')+_0xc3d9f9)[_0xef33('0x1a')](_0x3f8577[_0xef33('0x1e')],'me',_0xef33('0x1f')+_0x7945e7+_0xef33('0x20'))[_0xef33('0x1a')](_0x3f8577['interactionsTags'],'it',_0xef33('0x21')+_0x7945e7+_0xef33('0x20'))['left_join'](_0xef33('0xc'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3b1e47={'body':squel['expr'](),'contact':squel[_0xef33('0x22')](),'default':squel[_0xef33('0x22')](),'fields':squel[_0xef33('0x22')](),'filter':squel[_0xef33('0x22')](),'read':squel[_0xef33('0x22')](),'tags':{'clause':squel[_0xef33('0x22')](),'ids':null},'user':squel[_0xef33('0x22')]()};return _0x3b1e47;}function parseTagParameter(_0xf90f38){var _0x594f44=squel[_0xef33('0x22')]();if(_0xf90f38){var _0x40199b=utils[_0xef33('0x23')](_0xf90f38);_0x40199b[_0xef33('0x24')](function(_0x130243){_0x594f44['or'](_0xef33('0x25'),'%,'+_0x130243+',%');});}return _0x594f44;}function parseReadParameter(_0x30a412){var _0x20d4a1='';if(_0x30a412){_0x20d4a1=_0xef33('0x26');if(_0x30a412==='1'){_0x20d4a1=_0x20d4a1[_0xef33('0x27')](_0xef33('0x28'),'=');}else{_0x20d4a1=_0x20d4a1[_0xef33('0x27')](_0xef33('0x28'),'>');}}return _0x20d4a1;}function parseSearchFilter(_0x472673,_0x2d1772){var _0x481267=squel[_0xef33('0x22')]();if(_0x2d1772){var _0x24ebcf=_0x2d1772[_0xef33('0x27')]('\x5c','\x5c\x5c')[_0xef33('0x27')](/'/g,'\x27\x27');if(qs[_0xef33('0x29')](_0x24ebcf)){_0x481267['or'](_0xef33('0x2a'),_0x24ebcf+'%');if([_0xef33('0x2b'),_0xef33('0x2c')]['includes'](_0x472673)){_0x481267['or'](_0xef33('0x2d'),_0x24ebcf+'%');}else if(_0x472673===_0xef33('0x2e')){_0x481267['or']('i.fax\x20LIKE\x20?',_0x24ebcf+'%');}else if(_0x472673===_0xef33('0x2f')){_0x481267['or'](_0xef33('0x30'),_0x24ebcf+'%');}}else if(_0x472673===_0xef33('0x31')&&qs[_0xef33('0x32')](_0x24ebcf)){_0x481267['or'](_0xef33('0x33'),_0x24ebcf+'%');}else{if(_0x472673===_0xef33('0x31')){_0x481267['or'](_0xef33('0x34'),qs[_0xef33('0x35')](_0x24ebcf,!![]))['or'](_0xef33('0x36'),qs[_0xef33('0x35')](_0x24ebcf));}else if(_0x472673!==_0xef33('0x2e')){_0x481267['or'](_0xef33('0x37'),qs[_0xef33('0x35')](_0x24ebcf));}_0x481267['or'](_0xef33('0x38'),qs[_0xef33('0x35')](_0x24ebcf,!![]),null);}}return _0x481267;}function parseAdvancedSearchFilter(_0x3395a9,_0x4b7f6c){var _0x3ba55b=getSqlClauses();var _0xa36a20=as[_0xef33('0x39')](_0x3395a9);var _0x4615ed=_0xa36a20[_0xef33('0x3a')];for(var _0x262c4a=0x0;_0x262c4a<_0xa36a20[_0xef33('0x3b')][_0xef33('0x13')];_0x262c4a++){var _0x44eaa9=_0xa36a20[_0xef33('0x3b')][_0x262c4a];var _0x4c2180='i';var _0x14a105=_[_0xef33('0x3c')](_0x4b7f6c,[_0xef33('0xa'),_0x44eaa9['field']]);if(_0x14a105){var _0x33299a=as['buildExpression'](_0x4c2180,_0x14a105[_0xef33('0x3d')],_0x44eaa9);_0x3ba55b[_0xef33('0x3e')][_0x4615ed](_0x33299a[_0xef33('0x3f')],_0x33299a[_0xef33('0x40')][_0xef33('0x41')],_0x33299a[_0xef33('0x40')][_0xef33('0x42')]);}else{switch(_0x44eaa9[_0xef33('0x9')]){case _0xef33('0x43'):var _0x103033=parseReadParameter(_0x44eaa9['value']);_0x3ba55b[_0xef33('0x44')][_0xef33('0x45')](_0x103033);break;case'Contact':if(_0x44eaa9['operator']===_0xef33('0x46')){if(_0x44eaa9[_0xef33('0x40')][_0xef33('0x47')]('\x20')['length']>0x1){_0x3ba55b[_0xef33('0x48')][_0x4615ed](_0xef33('0x38'),qs[_0xef33('0x35')](_0x44eaa9[_0xef33('0x40')],!![]),null);}else{var _0x2d7a02='%'+_0x44eaa9[_0xef33('0x40')]+'%';_0x3ba55b[_0xef33('0x48')][_0x4615ed]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2d7a02,_0x2d7a02,_0x2d7a02);}}else{_0x14a105=_[_0xef33('0x3c')](_0x4b7f6c,[_0xef33('0xa'),'ContactId']);_0x44eaa9[_0xef33('0x9')]=_0xef33('0x49');_0x33299a=as['buildExpression'](_0x4c2180,_0x14a105[_0xef33('0x3d')],_0x44eaa9);_0x3ba55b['contact'][_0x4615ed](_0x33299a[_0xef33('0x3f')],_0x33299a[_0xef33('0x40')]['start'],_0x33299a[_0xef33('0x40')][_0xef33('0x42')]);}break;case'Tag':var _0x2837d6=_0x44eaa9[_0xef33('0x40')][_0xef33('0x47')](',')[_0xef33('0x15')](function(_0x208d6f){return Number(_0x208d6f);});var _0x4cce01=parseTagParameter(_0x2837d6);_0x3ba55b[_0xef33('0x4a')][_0xef33('0x4b')]['and'](_0x4cce01);_0x3ba55b['tags'][_0xef33('0x4c')]=_0x2837d6;break;case _0xef33('0x4d'):if(_0x44eaa9[_0xef33('0x4e')]===_0xef33('0x46')){_0x3ba55b[_0xef33('0x4f')][_0x4615ed](_0xef33('0x50'),'%'+_0x44eaa9[_0xef33('0x40')]+'%',null);}else{_0x14a105=_[_0xef33('0x3c')](_0x4b7f6c,[_0xef33('0xa'),_0xef33('0x51')]);_0x44eaa9[_0xef33('0x9')]=_0xef33('0x51');_0x33299a=as[_0xef33('0x52')](_0x4c2180,_0x14a105['type'],_0x44eaa9);_0x3ba55b[_0xef33('0x4f')][_0x4615ed](_0x33299a[_0xef33('0x3f')],_0x33299a['value']['start'],_0x33299a['value'][_0xef33('0x42')]);}break;case _0xef33('0x53'):case _0xef33('0x54'):_0x33299a=as['buildExpression']('me',null,_0x44eaa9);_0x3ba55b[_0xef33('0x53')][_0x4615ed](_0x33299a[_0xef33('0x3f')],_0x33299a['value'][_0xef33('0x41')],_0x33299a[_0xef33('0x40')][_0xef33('0x42')]);break;}}}return _0x3ba55b;}function parseModelFields(_0x17b5b3,_0x2c1bbf,_0x3b32bf){var _0x63f1ac=utils['getAccountFK'](_0x17b5b3);var _0x2702fe=squel[_0xef33('0x22')]();var _0x52fb98=_(_0x2c1bbf)[_0xef33('0x55')]()[_0xef33('0x15')](function(_0x4df7a3){return _[_0xef33('0x56')](_0x3b32bf,['name',_0x4df7a3])?_0x4df7a3:undefined;})['compact']()[_0xef33('0x40')]();if(_0x52fb98[_0xef33('0x13')]>0x0){_0x52fb98[_0xef33('0x24')](function(_0x2bc1f4){if(_0x2bc1f4===_0x63f1ac){_0x2702fe[_0xef33('0x45')]('i.'+_0x63f1ac+'\x20IN\x20?',[][_0xef33('0x57')](_0x2c1bbf[_0x2bc1f4]));}else if(_0x2bc1f4==='createdAt'){var _0x1521b1=JSON[_0xef33('0x58')](_0x2c1bbf[_0x2bc1f4])['$gte'];var _0x17fc4c=JSON[_0xef33('0x58')](_0x2c1bbf[_0x2bc1f4])['$lte'];_0x2702fe[_0xef33('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1521b1,_0x17fc4c);}else{if(_0x2c1bbf[_0x2bc1f4]==='null'){_0x2702fe[_0xef33('0x45')]('i.'+_0x2bc1f4+'\x20IS\x20NULL');}else{_0x2702fe['and']('i.'+_0x2bc1f4+_0xef33('0x59'),_0x2c1bbf[_0x2bc1f4]);}}});}return _0x2702fe;}function parseQueryParameters(_0x1dc6b7,_0x5bd56c,_0x4f3428){var _0x30ac85=getSqlClauses();return Promise[_0xef33('0x5a')]()[_0xef33('0x5b')](function(){return parseModelFields(_0x1dc6b7,_0x5bd56c,_0x4f3428);})[_0xef33('0x5b')](function(_0x57f012){_0x30ac85[_0xef33('0x5c')][_0xef33('0x45')](_0x57f012);return parseReadParameter(_0x5bd56c['read']);})['then'](function(_0x50cff2){_0x30ac85[_0xef33('0x44')][_0xef33('0x45')](_0x50cff2);return parseTagParameter(_0x5bd56c['tag']);})[_0xef33('0x5b')](function(_0x218d8a){_0x30ac85[_0xef33('0x4a')]['clause'][_0xef33('0x45')](_0x218d8a);return parseSearchFilter(_0x1dc6b7,_0x5bd56c['filter']);})[_0xef33('0x5b')](function(_0xc67d6c){_0x30ac85[_0xef33('0x5d')]=_0xc67d6c;return _0x30ac85;});}function checkAccountsRestrictions(_0x1889ff,_0x3abfcc,_0x5d5a7c){var _0x50283c=utils[_0xef33('0x4')](_0x1889ff);var _0x5836d0=_0xef33('0x5e')+_[_0xef33('0x5f')](_0x1889ff)+(_0x1889ff===_0xef33('0x60')?_0xef33('0x61'):_0xef33('0x62'));var _0x347b6d=squel[_0xef33('0x22')]();return Promise['resolve']()[_0xef33('0x5b')](function(){if(_0x5d5a7c[_0xef33('0x7')]&&_0x3abfcc[_0xef33('0x5')]===_0xef33('0x6')){return _0x3abfcc[_0x5836d0]({'attributes':['id'],'raw':!![]});}})[_0xef33('0x5b')](function(_0x4dde77){if(_0x4dde77){if(_0x4dde77['length']===0x0){_0x347b6d[_0xef33('0x45')]('i.'+_0x50283c+_0xef33('0x63'));}else{_0x347b6d['and']('i.'+_0x50283c+_0xef33('0x64'),_[_0xef33('0x15')](_0x4dde77,'id'));}}else if(!_0x5d5a7c[_0x50283c]){_0x347b6d[_0xef33('0x45')]('i.'+_0x50283c+'\x20IS\x20NOT\x20NULL');}})[_0xef33('0x5b')](function(){return _0x347b6d;});}function getClosedOrderClause(_0x258018,_0x3fb93d){var _0x1989c3='';var _0x2ac93b=[_0xef33('0x65'),'i.secondDisposition',_0xef33('0x66')];if(_0x258018===_0xef33('0x31')){_0x2ac93b[_0xef33('0x67')](_0xef33('0x68'));}if(_0x3fb93d[_0xef33('0x69')]==='0'&&_0x258018===_0xef33('0x31')){_0x1989c3='i.substatus';}else{if(_0x3fb93d[_0xef33('0x69')]==='1'){_0x2ac93b[_0xef33('0x6a')]();}_0x1989c3=_0xef33('0x6b')+_0x2ac93b['join'](',\x20')+')';}return _0x1989c3;}function getFilteredInteractions(_0x302a4c,_0x14b6b8,_0x48e4ae,_0x203f28){var _0x174a9b=utils[_0xef33('0x17')](_0x302a4c);var _0x3d022e=_['capitalize'](_0x302a4c)+_0xef33('0x6c');var _0x271a16=[];var _0x101e1d=getTagsQuery();var _0x396e00={'type':db[_0xef33('0x6d')]['QueryTypes']['SELECT'],'raw':!![]};var _0x413695=[];var _0x5a814e=[];return db[_0xef33('0x6e')][_0xef33('0x6f')](_0x101e1d[_0xef33('0x70')](),_0x396e00)[_0xef33('0x5b')](function(_0xbaefad){_0x271a16=_['keyBy'](_0xbaefad,'id');_0x396e00=_[_0xef33('0x71')](_0x396e00,{'model':db[_0x3d022e],'mapToModel':!![],'nest':!![]});if(_0x48e4ae[_0xef33('0x5c')]){_0x203f28['attributes'][_0xef33('0x24')](function(_0x3aea8a){_0x14b6b8[_0xef33('0x9')]('i.'+_0x3aea8a);});}else{_0x14b6b8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xef33('0x43'));_0x14b6b8['field']('a.key',_0xef33('0x72'));_0x14b6b8[_0xef33('0x9')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x302a4c==='mail'){_0x14b6b8['field'](_0xef33('0x73'),_0xef33('0x74'));_0x14b6b8[_0xef33('0x9')](_0xef33('0x75'),_0xef33('0x76'));_0x14b6b8[_0xef33('0x9')](_0xef33('0x77'));_0x14b6b8[_0xef33('0x9')](_0xef33('0x78'));_0x14b6b8[_0xef33('0x9')](_0xef33('0x79'));_0x14b6b8[_0xef33('0x9')]('i.closed');_0x14b6b8[_0xef33('0x9')]('i.closedAt');_0x14b6b8[_0xef33('0x9')](_0xef33('0x7a'));_0x14b6b8[_0xef33('0x9')]('i.lastMsgAt');_0x14b6b8[_0xef33('0x9')](_0xef33('0x7b'));_0x14b6b8[_0xef33('0x9')](_0xef33('0x7c'));_0x14b6b8['field'](_0xef33('0x66'));_0x14b6b8['field'](_0xef33('0x7d'));_0x14b6b8['field']('i.thirdDisposition');_0x14b6b8['field']('i.substatus');_0x14b6b8[_0xef33('0x9')](_0xef33('0x7e'));_0x14b6b8[_0xef33('0x9')](_0xef33('0x7f'));_0x14b6b8['field']('i.MailAccountId');_0x14b6b8[_0xef33('0x9')]('i.UserId');}else if(_0x302a4c==='openchannel'){_0x14b6b8[_0xef33('0x9')](_0xef33('0x80'),_0xef33('0x76'));}else{_0x14b6b8['field'](_0xef33('0x81'),_0xef33('0x76'));}if(_0x302a4c!==_0xef33('0x31')){_0x14b6b8[_0xef33('0x9')](_0xef33('0x82'));}_0x14b6b8[_0xef33('0x9')]('c.firstName',_0xef33('0x83'));_0x14b6b8[_0xef33('0x9')](_0xef33('0x84'),'Contact.lastName');_0x14b6b8[_0xef33('0x9')](_0xef33('0x85'),'Contact.email');_0x14b6b8[_0xef33('0x9')]('c.phone','Contact.phone');_0x14b6b8[_0xef33('0x9')](_0xef33('0x86'),'Contact.mobile');_0x14b6b8[_0xef33('0x9')](_0xef33('0x87'),_0xef33('0x88'));_0x14b6b8['field'](_0xef33('0x89'),_0xef33('0x8a'));_0x14b6b8['field'](_0xef33('0x8b'),_0xef33('0x8c'));_0x14b6b8[_0xef33('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xef33('0x8d'));}if(_0x203f28[_0xef33('0x8e')]){_0x14b6b8[_0xef33('0x8e')](_0x203f28[_0xef33('0x8e')]);}if(_0x203f28[_0xef33('0x8f')]){_0x14b6b8[_0xef33('0x8f')](_0x203f28['offset']);}return db['sequelize'][_0xef33('0x6f')](_0x14b6b8['toString'](),_0x396e00);})[_0xef33('0x5b')](function(_0x562af7){_0x413695=_0x562af7;var _0x32e5f3=getUsersQuery(_0x302a4c,_0x413695);return db[_0xef33('0x6e')][_0xef33('0x6f')](_0x32e5f3['toString'](),_0x396e00);})['then'](function(_0x50e437){_0x5a814e=_[_0xef33('0x90')](_0x50e437,_0x174a9b);if(_0x302a4c===_0xef33('0x31')){return db['Setting']['findOne']({'attributes':[_0xef33('0x91')],'raw':!![]});}})['then'](function(_0x5d2650){var _0x3f1ff1=_0x5d2650?_0x5d2650['enableEmailPreview']:undefined;var _0x38851c=_0x413695[_0xef33('0x15')](function(_0x1bfbec){return updateInteraction(_0x1bfbec,_0x271a16,_0x5a814e,_0x3f1ff1);});return Promise[_0xef33('0x92')](_0x38851c);});}function countFilteredInteractions(_0x1cb136,_0x23e7f7){var _0x518d6c=_0x1cb136[_0xef33('0x93')]();_0x518d6c[_0xef33('0x9')]('COUNT(*)');_0x518d6c[_0xef33('0x9')](_0xef33('0x94'),_0xef33('0x43'));var _0x306249=utils['getSelectedTags'](_0x23e7f7);if(!_['isEmpty'](_0x306249)){_0x518d6c[_0xef33('0x14')](_0xef33('0x95'),_0x306249);}var _0x1ed357={'type':db[_0xef33('0x6d')][_0xef33('0x96')]['SELECT'],'raw':!![]};return db[_0xef33('0x6e')][_0xef33('0x6f')](_0x518d6c['toString'](),_0x1ed357);}module[_0xef33('0x97')]={'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 8e556dc..2321f23 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 _0xb6b8=['push','waiting','answered','unmanaged','abandoned','total','closed','UserId','talking','MailMessage','findOne','out','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','lodash','../../mysqldb','fullname','split','forEach'];(function(_0x13e6ab,_0x5906d1){var _0x4d52ed=function(_0x5a0709){while(--_0x5a0709){_0x13e6ab['push'](_0x13e6ab['shift']());}};_0x4d52ed(++_0x5906d1);}(_0xb6b8,0x11b));var _0x8b6b=function(_0x3faad0,_0x19f136){_0x3faad0=_0x3faad0-0x0;var _0x3aaa10=_0xb6b8[_0x3faad0];return _0x3aaa10;};'use strict';var _=require(_0x8b6b('0x0'));var db=require(_0x8b6b('0x1'))['db'];function getInteractionUsers(_0x35487d,_0x43ccce){return new Promise(function(_0x764a87,_0x2731fc){try{var _0xa8a1bb=[];if(_0x43ccce[_0x35487d]){_0xa8a1bb=_0x43ccce[_0x35487d]['map'](function(_0x3cb2ef){return{'id':_0x3cb2ef['id'],'fullname':_0x3cb2ef[_0x8b6b('0x2')]};});}return _0x764a87(_0xa8a1bb);}catch(_0xd0048c){_0x2731fc(_0xd0048c);}});}function getInteractionTags(_0x4f4025,_0x2b24db){var _0x5dc958=[];if(_0x4f4025){_0x4f4025[_0x8b6b('0x3')](',')[_0x8b6b('0x4')](function(_0x2a1baa){_0x5dc958[_0x8b6b('0x5')](_0x2b24db[_0x2a1baa]);});}return _0x5dc958;}function updateWaitingCounter(_0x5097cc){if(_0x5097cc[_0x8b6b('0x6')]){_0x5097cc[_0x8b6b('0x6')]-=0x1;}}function updateInteractionCounters(_0x2548b6){_0x2548b6[_0x8b6b('0x6')]=0x0;_0x2548b6['talking']=0x0;_0x2548b6[_0x8b6b('0x7')]=0x0;_0x2548b6[_0x8b6b('0x8')]=0x0;_0x2548b6[_0x8b6b('0x9')]=0x0;_0x2548b6[_0x8b6b('0xa')]=0x0;if(_0x2548b6[_0x8b6b('0xb')]){if(_0x2548b6['disposition']===_0x8b6b('0x9')){_0x2548b6[_0x8b6b('0x9')]+=0x1;updateWaitingCounter(_0x2548b6);}if(_0x2548b6[_0x8b6b('0xc')]){_0x2548b6['answered']+=0x1;if(_0x2548b6[_0x8b6b('0xd')]){_0x2548b6['talking']-=0x1;}}else{if(_0x2548b6['disposition']){_0x2548b6[_0x8b6b('0x8')]+=0x1;updateWaitingCounter(_0x2548b6);}}}else{if(!_0x2548b6[_0x8b6b('0xc')]){_0x2548b6[_0x8b6b('0x6')]+=0x1;}if(_0x2548b6[_0x8b6b('0xc')]){_0x2548b6[_0x8b6b('0xd')]+=0x1;updateWaitingCounter(_0x2548b6);}}_0x2548b6[_0x8b6b('0xa')]+=0x1;return _0x2548b6;}function getLastMessageText(_0x611662){return db[_0x8b6b('0xe')][_0x8b6b('0xf')]({'where':{'$and':[{'MailInteractionId':_0x611662['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8b6b('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x47b71e){if(_0x47b71e&&_0x47b71e['plainBody']){_0x611662[_0x8b6b('0x11')]=_[_0x8b6b('0x12')](_0x47b71e['plainBody']);}return _0x611662;})[_0x8b6b('0x13')](function(_0xe03337){throw _0xe03337;});}exports[_0x8b6b('0x14')]=function(_0x32a859,_0x5c82f3,_0x440291,_0x1585bc){return new Promise(function(_0x3968b0,_0x595192){return getInteractionUsers(_0x32a859['id'],_0x440291)[_0x8b6b('0x15')](function(_0x1dcb45){_0x32a859[_0x8b6b('0x16')]=_0x1dcb45;return getInteractionTags(_0x32a859[_0x8b6b('0x17')],_0x5c82f3);})[_0x8b6b('0x15')](function(_0xf98703){_0x32a859['Tags']=_0xf98703;delete _0x32a859[_0x8b6b('0x17')];return updateInteractionCounters(_0x32a859);})['then'](function(_0x14e48f){if(_0x1585bc){return getLastMessageText(_0x14e48f);}else{return _0x14e48f;}})[_0x8b6b('0x15')](function(_0x1eab2a){_0x3968b0(_0x1eab2a);})[_0x8b6b('0x13')](function(_0x47bf02){_0x595192(_0x47bf02);});});}; \ No newline at end of file +var _0x4153=['TagIds','lodash','../../mysqldb','map','fullname','split','forEach','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','findOne','out','plainBody','-id','trimStart','catch','updateInteraction','then','Users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4153,0x12d));var _0x3415=function(_0x36ede6,_0x2da65e){_0x36ede6=_0x36ede6-0x0;var _0x93cc9f=_0x4153[_0x36ede6];return _0x93cc9f;};'use strict';var _=require(_0x3415('0x0'));var db=require(_0x3415('0x1'))['db'];function getInteractionUsers(_0x788722,_0x14f10){return new Promise(function(_0x354902,_0x5c0bce){try{var _0x3b1b06=[];if(_0x14f10[_0x788722]){_0x3b1b06=_0x14f10[_0x788722][_0x3415('0x2')](function(_0x56d600){return{'id':_0x56d600['id'],'fullname':_0x56d600[_0x3415('0x3')]};});}return _0x354902(_0x3b1b06);}catch(_0x385704){_0x5c0bce(_0x385704);}});}function getInteractionTags(_0x5aef03,_0x275280){var _0x337f09=[];if(_0x5aef03){_0x5aef03[_0x3415('0x4')](',')[_0x3415('0x5')](function(_0x1f3a92){_0x337f09['push'](_0x275280[_0x1f3a92]);});}return _0x337f09;}function updateWaitingCounter(_0x45e2d9){if(_0x45e2d9[_0x3415('0x6')]){_0x45e2d9[_0x3415('0x6')]-=0x1;}}function updateInteractionCounters(_0x27eebe){_0x27eebe[_0x3415('0x6')]=0x0;_0x27eebe['talking']=0x0;_0x27eebe[_0x3415('0x7')]=0x0;_0x27eebe[_0x3415('0x8')]=0x0;_0x27eebe[_0x3415('0x9')]=0x0;_0x27eebe[_0x3415('0xa')]=0x0;if(_0x27eebe[_0x3415('0xb')]){if(_0x27eebe[_0x3415('0xc')]===_0x3415('0x9')){_0x27eebe['abandoned']+=0x1;updateWaitingCounter(_0x27eebe);}if(_0x27eebe[_0x3415('0xd')]){_0x27eebe[_0x3415('0x7')]+=0x1;if(_0x27eebe['talking']){_0x27eebe[_0x3415('0xe')]-=0x1;}}else{if(_0x27eebe[_0x3415('0xc')]){_0x27eebe[_0x3415('0x8')]+=0x1;updateWaitingCounter(_0x27eebe);}}}else{if(!_0x27eebe[_0x3415('0xd')]){_0x27eebe[_0x3415('0x6')]+=0x1;}if(_0x27eebe[_0x3415('0xd')]){_0x27eebe[_0x3415('0xe')]+=0x1;updateWaitingCounter(_0x27eebe);}}_0x27eebe[_0x3415('0xa')]+=0x1;return _0x27eebe;}function getLastMessageText(_0x1024e3){return db['MailMessage'][_0x3415('0xf')]({'where':{'$and':[{'MailInteractionId':_0x1024e3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x3415('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x3415('0x11')],'order':_0x3415('0x12'),'raw':!![]})['then'](function(_0x554527){if(_0x554527&&_0x554527[_0x3415('0x11')]){_0x1024e3['lastMsgText']=_[_0x3415('0x13')](_0x554527[_0x3415('0x11')]);}return _0x1024e3;})[_0x3415('0x14')](function(_0x4c844c){throw _0x4c844c;});}exports[_0x3415('0x15')]=function(_0x1dff6d,_0x14da21,_0x58f037,_0x4d7464){return new Promise(function(_0x42cd6c,_0x1aacc7){return getInteractionUsers(_0x1dff6d['id'],_0x58f037)[_0x3415('0x16')](function(_0x478138){_0x1dff6d[_0x3415('0x17')]=_0x478138;return getInteractionTags(_0x1dff6d['TagIds'],_0x14da21);})['then'](function(_0x4a0b93){_0x1dff6d['Tags']=_0x4a0b93;delete _0x1dff6d[_0x3415('0x18')];return updateInteractionCounters(_0x1dff6d);})[_0x3415('0x16')](function(_0x4658d7){if(_0x4d7464){return getLastMessageText(_0x4658d7);}else{return _0x4658d7;}})[_0x3415('0x16')](function(_0x4bf460){_0x42cd6c(_0x4bf460);})['catch'](function(_0x27bfad){_0x1aacc7(_0x27bfad);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index d0f3ee0..e7e3cf4 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 _0x943d=['stringify','null','Interaction','findOne','then','update','info','catch','error','exports','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','Website','InteractionId','unknown','chat','websites','accounts','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x943d,0x19f));var _0xd943=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x943d[_0x52096b];return _0x2b1cc7;};'use strict';var _=require('lodash');var db=require(_0xd943('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xd943('0x1'))(_0xd943('0x2')),'fax':require(_0xd943('0x1'))(_0xd943('0x3')),'sms':require(_0xd943('0x1'))('sms-interactions'),'chat':require(_0xd943('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xd943('0x4'))};function getAccountFK(_0x1ba2fe){return _['capitalize'](_0x1ba2fe)+(_0x1ba2fe==='chat'?_0xd943('0x5'):'Account')+'Id';}function getInteractionFK(_0x4222cf){return _['capitalize'](_0x4222cf)+'InteractionId';}function getInteractionId(_0x4087b6,_0x34fd85,_0x58223f){if(_0x4087b6&&_0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')]){return _0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')];}else if(_0x4087b6&&_0x4087b6['id']){return _0x4087b6['id'];}else if(_0x34fd85&&_0x34fd85['id']){return _0x34fd85['id'];}else{return _0xd943('0x7');}}function getInteractionsTables(_0x3e6779){return{'accounts':_0x3e6779+'_'+(_0x3e6779===_0xd943('0x8')?_0xd943('0x9'):_0xd943('0xa')),'interactions':_0x3e6779+_0xd943('0xb'),'interactionsTags':_0x3e6779+'_interaction_has_tags','messages':_0x3e6779+_0xd943('0xc'),'userInteractions':'user_has_'+_0x3e6779+'_interactions'};}function getSelectedTags(_0x6e4d45){var _0x468c0a=[];if(_0x6e4d45){_0x468c0a=Array['isArray'](_0x6e4d45)?_0x6e4d45:[_0x6e4d45];}return _0x468c0a;}function log(_0xe175e8,_0xffb9e1,_0x1cf0a3,_0x5a0a9d,_0x7282bc,_0x31fcd9){loggers[_0x7282bc[_0xd943('0xd')]()][_0xe175e8](_0xd943('0xe'),_0x31fcd9[_0xd943('0xf')](),_0xffb9e1?_0xffb9e1['id']:null,_0xffb9e1?_0xffb9e1[_0xd943('0x10')]:null,_0xffb9e1?_0xffb9e1['role']:null,getInteractionId(_0x1cf0a3,_0x5a0a9d,_0x7282bc),_0x1cf0a3?JSON[_0xd943('0x11')](_0x1cf0a3):_0xd943('0x12'));}function updateUser(_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a){db[_['upperFirst'](_0xdbcb0e)+_0xd943('0x13')][_0xd943('0x14')]({'where':{'id':getInteractionId(_0x4f4bb3,_0x17180b,_0xdbcb0e)}})[_0xd943('0x15')](function(_0x1cd58f){if(_0x1cd58f){return _0x1cd58f[_0xd943('0x16')]({'UserId':_0x1ef714?_0x1ef714['id']:null});}})['then'](function(_0x40b1ff){if(_0x40b1ff){log(_0xd943('0x17'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);}})[_0xd943('0x18')](function(){log(_0xd943('0x19'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);});}module[_0xd943('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x8b1e=['findOne','then','update','info','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction'];(function(_0x35a565,_0x5d7425){var _0x1a9678=function(_0x2ee5f4){while(--_0x2ee5f4){_0x35a565['push'](_0x35a565['shift']());}};_0x1a9678(++_0x5d7425);}(_0x8b1e,0x166));var _0xe8b1=function(_0x3be2e2,_0x5df450){_0x3be2e2=_0x3be2e2-0x0;var _0x80469b=_0x8b1e[_0x3be2e2];return _0x80469b;};'use strict';var _=require('lodash');var db=require(_0xe8b1('0x0'))['db'];var loggers={'openchannel':require(_0xe8b1('0x1'))(_0xe8b1('0x2')),'mail':require(_0xe8b1('0x1'))(_0xe8b1('0x3')),'fax':require('../../config/logger')(_0xe8b1('0x4')),'sms':require(_0xe8b1('0x1'))(_0xe8b1('0x5')),'chat':require('../../config/logger')(_0xe8b1('0x6')),'whatsapp':require(_0xe8b1('0x1'))(_0xe8b1('0x7'))};function getAccountFK(_0xb39a72){return _[_0xe8b1('0x8')](_0xb39a72)+(_0xb39a72===_0xe8b1('0x9')?'Website':_0xe8b1('0xa'))+'Id';}function getInteractionFK(_0xcf0e88){return _[_0xe8b1('0x8')](_0xcf0e88)+_0xe8b1('0xb');}function getInteractionId(_0x1022fc,_0x51125c,_0x2d29f8){if(_0x1022fc&&_0x1022fc[_['upperFirst'](_0x2d29f8)+_0xe8b1('0xb')]){return _0x1022fc[_[_0xe8b1('0xc')](_0x2d29f8)+_0xe8b1('0xb')];}else if(_0x1022fc&&_0x1022fc['id']){return _0x1022fc['id'];}else if(_0x51125c&&_0x51125c['id']){return _0x51125c['id'];}else{return _0xe8b1('0xd');}}function getInteractionsTables(_0x314fce){return{'accounts':_0x314fce+'_'+(_0x314fce===_0xe8b1('0x9')?_0xe8b1('0xe'):'accounts'),'interactions':_0x314fce+_0xe8b1('0xf'),'interactionsTags':_0x314fce+_0xe8b1('0x10'),'messages':_0x314fce+_0xe8b1('0x11'),'userInteractions':_0xe8b1('0x12')+_0x314fce+_0xe8b1('0xf')};}function getSelectedTags(_0x4e2203){var _0xed46be=[];if(_0x4e2203){_0xed46be=Array[_0xe8b1('0x13')](_0x4e2203)?_0x4e2203:[_0x4e2203];}return _0xed46be;}function log(_0x31b7de,_0x5b1196,_0x230037,_0x5b2e12,_0x402463,_0x296a87){loggers[_0x402463[_0xe8b1('0x14')]()][_0x31b7de](_0xe8b1('0x15'),_0x296a87['toUpperCase'](),_0x5b1196?_0x5b1196['id']:null,_0x5b1196?_0x5b1196[_0xe8b1('0x16')]:null,_0x5b1196?_0x5b1196[_0xe8b1('0x17')]:null,getInteractionId(_0x230037,_0x5b2e12,_0x402463),_0x230037?JSON['stringify'](_0x230037):_0xe8b1('0x18'));}function updateUser(_0x203f11,_0x3a5578,_0x38e99c,_0x44fcf6,_0x372953){db[_[_0xe8b1('0xc')](_0x44fcf6)+_0xe8b1('0x19')][_0xe8b1('0x1a')]({'where':{'id':getInteractionId(_0x3a5578,_0x38e99c,_0x44fcf6)}})[_0xe8b1('0x1b')](function(_0x4f3c0f){if(_0x4f3c0f){return _0x4f3c0f[_0xe8b1('0x1c')]({'UserId':_0x203f11?_0x203f11['id']:null});}})[_0xe8b1('0x1b')](function(_0x5bae92){if(_0x5bae92){log(_0xe8b1('0x1d'),_0x203f11,_0x3a5578,_0x38e99c,_0x44fcf6,_0x372953);}})['catch'](function(){log(_0xe8b1('0x1e'),_0x203f11,_0x3a5578,_0x38e99c,_0x44fcf6,_0x372953);});}module[_0xe8b1('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 87f37b0..8c53f09 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 _0x3e03=['utf8','hasOwnProperty','use','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x3e03,0x160));var _0x33e0=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x3e03[_0x5d6270];return _0x168f26;};'use strict';var crypto=require(_0x33e0('0x0'));var util=require(_0x33e0('0x1'));var compose=require(_0x33e0('0x2'));var db=require(_0x33e0('0x3'))['db'];var config=require(_0x33e0('0x4'));function getValueFromLicense(_0x465d99,_0x48f029){if(_0x465d99&&_0x48f029){if(_0x48f029['data1']&&_0x48f029['license']){var _0xd1fc72=_0x48f029[_0x33e0('0x5')];var _0x55ed12=_0x48f029['license'];var _0x48aec2=_0xd1fc72[_0x33e0('0x6')]('-')[0x4];var _0x3b621a=_0xd1fc72[_0x33e0('0x6')]('-')[0x0];var _0x5916da=crypto[_0x33e0('0x7')](_0x33e0('0x8'),util['format'](_0x33e0('0x9'),_0x48aec2,_0xd1fc72,_0x3b621a));var _0x5e2b79=_0x5916da[_0x33e0('0xa')](_0x55ed12,_0x33e0('0xb'),_0x33e0('0xc'));_0x5e2b79+=_0x5916da['final']('utf8');var _0x2f5de2=JSON['parse'](_0x5e2b79);return _0x2f5de2[_0x33e0('0xd')](_0x465d99)?_0x2f5de2[_0x465d99]:null;}}return null;}function isLimit(_0x2386ec,_0xb65d1d,_0x46e85b,_0x32b333){var _0x5acd13=_0xb65d1d;return compose()[_0x33e0('0xe')](function(_0x31dcde,_0x924bfc,_0x5e0cac){return db[_0x33e0('0xf')][_0x33e0('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x174bfa){var _0x41d97a=getValueFromLicense(_0x2386ec,_0x174bfa);return _0x41d97a?_0x41d97a:_0x5acd13;})[_0x33e0('0x11')](function(_0x349573){_0x5acd13=_0x349573;return _0x46e85b[_0x33e0('0x12')](_0x32b333);})['then'](function(_0x5ea47e){if(_0x5ea47e>=_0x5acd13){return _0x924bfc[_0x33e0('0x13')](0x193)['json']({'message':util[_0x33e0('0x14')](_0x33e0('0x15'),_0x2386ec)});}_0x5e0cac();})[_0x33e0('0x16')](function(_0x155a47){_0x5e0cac(_0x155a47);});});}function isUserLimit(){return isLimit(_0x33e0('0x17'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x33e0('0x18')}]}});}exports[_0x33e0('0x19')]=isUserLimit; \ No newline at end of file +var _0x2529=['users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x2529,0x9b));var _0x9252=function(_0xf2c3cf,_0xee328){_0xf2c3cf=_0xf2c3cf-0x0;var _0x35b497=_0x2529[_0xf2c3cf];return _0x35b497;};'use strict';var crypto=require(_0x9252('0x0'));var util=require('util');var compose=require(_0x9252('0x1'));var db=require(_0x9252('0x2'))['db'];var config=require(_0x9252('0x3'));function getValueFromLicense(_0x58d37a,_0x564de0){if(_0x58d37a&&_0x564de0){if(_0x564de0[_0x9252('0x4')]&&_0x564de0['license']){var _0x222a98=_0x564de0[_0x9252('0x4')];var _0x22273d=_0x564de0[_0x9252('0x5')];var _0x35f9ed=_0x222a98['split']('-')[0x4];var _0x36b2ae=_0x222a98[_0x9252('0x6')]('-')[0x0];var _0x369d50=crypto[_0x9252('0x7')](_0x9252('0x8'),util[_0x9252('0x9')](_0x9252('0xa'),_0x35f9ed,_0x222a98,_0x36b2ae));var _0x1f2362=_0x369d50[_0x9252('0xb')](_0x22273d,_0x9252('0xc'),_0x9252('0xd'));_0x1f2362+=_0x369d50[_0x9252('0xe')](_0x9252('0xd'));var _0x10c79d=JSON[_0x9252('0xf')](_0x1f2362);return _0x10c79d[_0x9252('0x10')](_0x58d37a)?_0x10c79d[_0x58d37a]:null;}}return null;}function isLimit(_0x319785,_0x27775a,_0x43bb8a,_0x33cbd6){var _0x4fb067=_0x27775a;return compose()[_0x9252('0x11')](function(_0x483002,_0x27dd7e,_0x482f5a){return db[_0x9252('0x12')][_0x9252('0x13')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5c1468){var _0x261187=getValueFromLicense(_0x319785,_0x5c1468);return _0x261187?_0x261187:_0x4fb067;})[_0x9252('0x14')](function(_0x2cb9c9){_0x4fb067=_0x2cb9c9;return _0x43bb8a[_0x9252('0x15')](_0x33cbd6);})[_0x9252('0x14')](function(_0x5d5bc9){if(_0x5d5bc9>=_0x4fb067){return _0x27dd7e[_0x9252('0x16')](0x193)['json']({'message':util[_0x9252('0x9')](_0x9252('0x17'),_0x319785)});}_0x482f5a();})[_0x9252('0x18')](function(_0x408390){_0x482f5a(_0x408390);});});}function isUserLimit(){return isLimit(_0x9252('0x19'),0x1,db[_0x9252('0x1a')],{'where':{'$or':[{'role':_0x9252('0x1b')},{'role':_0x9252('0x1c')}]}});}exports[_0x9252('0x1d')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 124cd98..6ae4e8c 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 _0xb0d7=['moment','parseSearch','sqlOperator','startsWith','replace','length','split','slice','shift','match','forEach','filter','map','operator','$eq','value','$lte','add','format','castTo','text','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','DATE','utcOffset','hours','minutes','seconds'];(function(_0x3e6a06,_0x5ddcd6){var _0xcdc571=function(_0x5b0d06){while(--_0x5b0d06){_0x3e6a06['push'](_0x3e6a06['shift']());}};_0xcdc571(++_0x5ddcd6);}(_0xb0d7,0x132));var _0x7b0d=function(_0x383af0,_0x4f27b5){_0x383af0=_0x383af0-0x0;var _0x154aef=_0xb0d7[_0x383af0];return _0x154aef;};'use strict';var _=require('lodash');var moment=require(_0x7b0d('0x0'));exports[_0x7b0d('0x1')]=function(_0x54ea72){var _0x566f07={'conditions':[]};_0x566f07[_0x7b0d('0x2')]=_[_0x7b0d('0x3')](_0x54ea72,'[$or]')?'or':'and';var _0xcd6d09=_0x54ea72[_0x7b0d('0x4')]('[$and]','')[_0x7b0d('0x4')]('[$or]','')['split']('||');for(var _0x1beabd=0x0;_0x1beabd<_0xcd6d09[_0x7b0d('0x5')];_0x1beabd++){var _0x454683=_0xcd6d09[_0x1beabd][_0x7b0d('0x6')](':=');var _0x4ab3bc=_0x454683[0x0];var _0x1f24db=_0x454683[_0x7b0d('0x7')](0x1);_0x1f24db['forEach'](function(_0x2425e3){var _0x37e77b=_0x2425e3['split']('[')[_0x7b0d('0x8')]();var _0x975e9b=_0x2425e3[_0x7b0d('0x9')](/\[(.*?)\]/g);_0x975e9b[_0x7b0d('0xa')](function(_0x533934){var _0x38f9a9=_0x533934[_0x7b0d('0x6')]('[')[_0x7b0d('0xb')](function(_0x5dbf16){return _0x5dbf16['indexOf'](']')>-0x1;})[_0x7b0d('0xc')](function(_0x217ba5){return _0x217ba5[_0x7b0d('0x6')](']')[0x0];})[0x0];_0x566f07['conditions']['push']({'field':_0x4ab3bc,'operator':_0x37e77b,'value':_0x38f9a9});});});}return _0x566f07;};exports['buildExpression']=function(_0x3d7aaa,_0x4a9f42,_0x3f3fdf){var _0x3bfa25={};if(_0x4a9f42==='DATE'){if(_0x3f3fdf[_0x7b0d('0xd')]===_0x7b0d('0xe')){_0x3f3fdf[_0x7b0d('0xd')]='$between';_0x3f3fdf[_0x7b0d('0xf')]+=','+_0x3f3fdf[_0x7b0d('0xf')];}else if(_['includes'](['$gt',_0x7b0d('0x10')],_0x3f3fdf[_0x7b0d('0xd')])){_0x3f3fdf[_0x7b0d('0xf')]=moment(_0x3f3fdf['value'])[_0x7b0d('0x11')](0x1,'days')[_0x7b0d('0x12')]('YYYY-MM-DD');}}if(_0x3f3fdf[_0x7b0d('0x13')]){_0x4a9f42=_0x3f3fdf[_0x7b0d('0x13')];_0x3bfa25[_0x7b0d('0x14')]='CAST('+_0x3d7aaa+'.'+_0x3f3fdf['field']+_0x7b0d('0x15')+_0x3f3fdf[_0x7b0d('0x13')]+')\x20'+parseOperator(_0x3f3fdf['operator']);}else{_0x3bfa25['text']=_0x3d7aaa+'.'+_0x3f3fdf['field']+'\x20'+parseOperator(_0x3f3fdf[_0x7b0d('0xd')]);}if(_[_0x7b0d('0x16')]([_0x7b0d('0x17'),_0x7b0d('0x18')],_0x3f3fdf[_0x7b0d('0xd')]))_0x3bfa25[_0x7b0d('0x14')]='('+_0x3bfa25[_0x7b0d('0x14')]+_0x7b0d('0x19')+_0x3d7aaa+'.'+_0x3f3fdf[_0x7b0d('0x1a')]+_0x7b0d('0x1b');_0x3bfa25[_0x7b0d('0xf')]=parseValue(_0x4a9f42,_0x3f3fdf['operator'],_0x3f3fdf[_0x7b0d('0xf')]);return _0x3bfa25;};function parseOperator(_0x4c79dc){var _0x1d8924;switch(_0x4c79dc){case _0x7b0d('0x1c'):_0x1d8924=_0x7b0d('0x1d');break;case _0x7b0d('0x18'):_0x1d8924='NOT\x20IN\x20?';break;case'$eq':_0x1d8924=_0x7b0d('0x1e');break;case _0x7b0d('0x17'):_0x1d8924=_0x7b0d('0x1f');break;case _0x7b0d('0x20'):case _0x7b0d('0x21'):case _0x7b0d('0x22'):_0x1d8924=_0x7b0d('0x23');break;case _0x7b0d('0x24'):_0x1d8924=_0x7b0d('0x25');break;case _0x7b0d('0x26'):_0x1d8924=_0x7b0d('0x27');break;case _0x7b0d('0x10'):_0x1d8924=_0x7b0d('0x28');break;case _0x7b0d('0x29'):_0x1d8924=_0x7b0d('0x2a');break;case _0x7b0d('0x2b'):_0x1d8924=_0x7b0d('0x2c');break;}return _0x1d8924;}function parseValue(_0x288e8f,_0x20565f,_0x599464){var _0x2ee1c4={'start':undefined,'end':undefined};switch(_0x20565f){case _0x7b0d('0x1c'):case _0x7b0d('0x18'):_0x2ee1c4[_0x7b0d('0x2d')]=_0x599464[_0x7b0d('0x6')](',');break;case _0x7b0d('0x20'):_0x2ee1c4[_0x7b0d('0x2d')]='%'+_0x599464+'%';break;case _0x7b0d('0x21'):_0x2ee1c4[_0x7b0d('0x2d')]=_0x599464+'%';break;case _0x7b0d('0x22'):_0x2ee1c4[_0x7b0d('0x2d')]='%'+_0x599464;break;case _0x7b0d('0x2b'):var _0x7f1ee7=_0x599464[_0x7b0d('0x6')](',');var _0x599464=_0x7f1ee7[_0x7b0d('0x8')]();var _0x1bfd36=_0x7f1ee7['pop']();if(_0x288e8f===_0x7b0d('0x2e')){_0x599464=moment(_0x599464)[_0x7b0d('0x2f')](0x0,!![])[_0x7b0d('0x12')]();_0x1bfd36=moment(_0x1bfd36)[_0x7b0d('0x2f')](0x0,!![])[_0x7b0d('0x11')](0x17,_0x7b0d('0x30'))['add'](0x3b,_0x7b0d('0x31'))['add'](0x3b,_0x7b0d('0x32'))[_0x7b0d('0x12')]();}_0x2ee1c4={'start':_0x599464,'end':_0x1bfd36};break;default:_0x2ee1c4[_0x7b0d('0x2d')]=_0x599464;break;}return _0x2ee1c4;} \ No newline at end of file +var _0x7035=['start','$substring','pop','DATE','add','hours','minutes','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','split','slice','shift','match','forEach','push','buildExpression','operator','$eq','$between','value','includes','$gt','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','$notIn'];(function(_0x31e390,_0x1ac667){var _0x546ba2=function(_0x33bc64){while(--_0x33bc64){_0x31e390['push'](_0x31e390['shift']());}};_0x546ba2(++_0x1ac667);}(_0x7035,0xa6));var _0x5703=function(_0x3c4bb8,_0x3750de){_0x3c4bb8=_0x3c4bb8-0x0;var _0x3df67d=_0x7035[_0x3c4bb8];return _0x3df67d;};'use strict';var _=require('lodash');var moment=require(_0x5703('0x0'));exports[_0x5703('0x1')]=function(_0x202aaf){var _0xa04715={'conditions':[]};_0xa04715[_0x5703('0x2')]=_[_0x5703('0x3')](_0x202aaf,_0x5703('0x4'))?'or':'and';var _0xc3c775=_0x202aaf[_0x5703('0x5')](_0x5703('0x6'),'')['replace']('[$or]','')['split']('||');for(var _0x4018ca=0x0;_0x4018ca<_0xc3c775[_0x5703('0x7')];_0x4018ca++){var _0x546cdb=_0xc3c775[_0x4018ca][_0x5703('0x8')](':=');var _0x4ed5aa=_0x546cdb[0x0];var _0x3b0d4b=_0x546cdb[_0x5703('0x9')](0x1);_0x3b0d4b['forEach'](function(_0x1ff032){var _0x4795fe=_0x1ff032[_0x5703('0x8')]('[')[_0x5703('0xa')]();var _0x4ffcf6=_0x1ff032[_0x5703('0xb')](/\[(.*?)\]/g);_0x4ffcf6[_0x5703('0xc')](function(_0x32152f){var _0x474eac=_0x32152f[_0x5703('0x8')]('[')['filter'](function(_0x21e8fc){return _0x21e8fc['indexOf'](']')>-0x1;})['map'](function(_0x5bbc8c){return _0x5bbc8c['split'](']')[0x0];})[0x0];_0xa04715['conditions'][_0x5703('0xd')]({'field':_0x4ed5aa,'operator':_0x4795fe,'value':_0x474eac});});});}return _0xa04715;};exports[_0x5703('0xe')]=function(_0x5c6465,_0x22ca79,_0x41455f){var _0x452638={};if(_0x22ca79==='DATE'){if(_0x41455f[_0x5703('0xf')]===_0x5703('0x10')){_0x41455f[_0x5703('0xf')]=_0x5703('0x11');_0x41455f['value']+=','+_0x41455f[_0x5703('0x12')];}else if(_[_0x5703('0x13')]([_0x5703('0x14'),'$lte'],_0x41455f[_0x5703('0xf')])){_0x41455f[_0x5703('0x12')]=moment(_0x41455f[_0x5703('0x12')])['add'](0x1,_0x5703('0x15'))[_0x5703('0x16')](_0x5703('0x17'));}}if(_0x41455f[_0x5703('0x18')]){_0x22ca79=_0x41455f['castTo'];_0x452638[_0x5703('0x19')]=_0x5703('0x1a')+_0x5c6465+'.'+_0x41455f[_0x5703('0x1b')]+_0x5703('0x1c')+_0x41455f[_0x5703('0x18')]+')\x20'+parseOperator(_0x41455f['operator']);}else{_0x452638[_0x5703('0x19')]=_0x5c6465+'.'+_0x41455f[_0x5703('0x1b')]+'\x20'+parseOperator(_0x41455f['operator']);}if(_['includes']([_0x5703('0x1d'),'$notIn'],_0x41455f[_0x5703('0xf')]))_0x452638['text']='('+_0x452638[_0x5703('0x19')]+_0x5703('0x1e')+_0x5c6465+'.'+_0x41455f[_0x5703('0x1b')]+'\x20IS\x20NULL)';_0x452638[_0x5703('0x12')]=parseValue(_0x22ca79,_0x41455f[_0x5703('0xf')],_0x41455f[_0x5703('0x12')]);return _0x452638;};function parseOperator(_0x2142d2){var _0x45920b;switch(_0x2142d2){case'$in':_0x45920b=_0x5703('0x1f');break;case'$notIn':_0x45920b='NOT\x20IN\x20?';break;case _0x5703('0x10'):_0x45920b=_0x5703('0x20');break;case _0x5703('0x1d'):_0x45920b=_0x5703('0x21');break;case'$substring':case _0x5703('0x22'):case _0x5703('0x23'):_0x45920b=_0x5703('0x24');break;case _0x5703('0x25'):_0x45920b=_0x5703('0x26');break;case _0x5703('0x14'):_0x45920b=_0x5703('0x27');break;case _0x5703('0x28'):_0x45920b=_0x5703('0x29');break;case _0x5703('0x2a'):_0x45920b='>=\x20?';break;case _0x5703('0x11'):_0x45920b=_0x5703('0x2b');break;}return _0x45920b;}function parseValue(_0x331628,_0x48a08f,_0x1a969b){var _0x65e279={'start':undefined,'end':undefined};switch(_0x48a08f){case _0x5703('0x2c'):case _0x5703('0x2d'):_0x65e279[_0x5703('0x2e')]=_0x1a969b[_0x5703('0x8')](',');break;case _0x5703('0x2f'):_0x65e279['start']='%'+_0x1a969b+'%';break;case'$startsWith':_0x65e279[_0x5703('0x2e')]=_0x1a969b+'%';break;case'$endsWith':_0x65e279['start']='%'+_0x1a969b;break;case _0x5703('0x11'):var _0x4cce47=_0x1a969b[_0x5703('0x8')](',');var _0x1a969b=_0x4cce47[_0x5703('0xa')]();var _0x58672e=_0x4cce47[_0x5703('0x30')]();if(_0x331628===_0x5703('0x31')){_0x1a969b=moment(_0x1a969b)['utcOffset'](0x0,!![])[_0x5703('0x16')]();_0x58672e=moment(_0x58672e)['utcOffset'](0x0,!![])[_0x5703('0x32')](0x17,_0x5703('0x33'))[_0x5703('0x32')](0x3b,_0x5703('0x34'))[_0x5703('0x32')](0x3b,'seconds')[_0x5703('0x16')]();}_0x65e279={'start':_0x1a969b,'end':_0x58672e};break;default:_0x65e279[_0x5703('0x2e')]=_0x1a969b;break;}return _0x65e279;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 07694ec..366f700 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 _0x9dc0=['DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','sort','indexOf','priority','col','unsigned','length','omit','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','forEach','push','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','pick','filter','object','merge','map','VIRTUAL','lower','include','includeAll','moment','parse','keys','alias','fields','raw','split','filters','isEmpty','find'];(function(_0x7a9158,_0x5a0ec8){var _0x548348=function(_0x25c037){while(--_0x25c037){_0x7a9158['push'](_0x7a9158['shift']());}};_0x548348(++_0x5a0ec8);}(_0x9dc0,0xd6));var _0x09dc=function(_0x1e50fc,_0x3d2684){_0x1e50fc=_0x1e50fc-0x0;var _0x497f51=_0x9dc0[_0x1e50fc];return _0x497f51;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x09dc('0x0'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x31f3dc){var _0x402dc2=['ne'];try{var _0x2eba33=JSON[_0x09dc('0x1')](_0x31f3dc);var _0x5bac1e=Object[_0x09dc('0x2')](_0x2eba33)[0x0];return _0x402dc2['includes'](_0x5bac1e);}catch(_0xb95f64){return![];}}function getOperatorValue(_0x1e0784){var _0x1a4b66=JSON[_0x09dc('0x1')](_0x1e0784);var _0x5daeae=Object['keys'](_0x1a4b66)[0x0];var _0x5e3c5d=_0x1a4b66[_0x5daeae];return{['$'+_0x5daeae]:_0x5e3c5d};}function parseIncludeModel(_0x58b855){var _0x59682=JSON[_0x09dc('0x1')](_0x58b855);return{'model':db[_0x59682['model']],'as':_0x59682[_0x09dc('0x3')],'attributes':_0x59682[_0x09dc('0x4')],'raw':_0x59682[_0x09dc('0x5')]};}exports['fields']=function(_0x189b79){var _0x314f60=null;if(_0x189b79){_0x314f60=_0x189b79[_0x09dc('0x6')](',');}return _0x314f60;};exports[_0x09dc('0x7')]=function(_0x75b59a,_0xb8b6d1){var _0x1b1f78={};if(!_[_0x09dc('0x8')](_0x75b59a)){_['forOwn'](_0x75b59a,function(_0x260130,_0x489ee0){try{if(_0xb8b6d1){var _0x323d13=_[_0x09dc('0x9')](_0xb8b6d1,{'name':_0x489ee0})||{};if(hasSequelizeOperator(_0x260130)){_0x1b1f78[_0x489ee0]=getOperatorValue(_0x260130);}else if(_0x323d13['type']===_0x09dc('0xa')&&_[_0x09dc('0xb')](_0x260130)){var _0x1efe92=JSON['parse'](_0x260130);var _0x5e28a6={'$gte':moment(moment(_0x1efe92['$gte'])[_0x09dc('0xc')](_0x09dc('0xd')))[_0x09dc('0xe')]()['format'](),'$lte':moment(moment(_0x1efe92[_0x09dc('0xf')])[_0x09dc('0xc')]('YYYY-MM-DD'))[_0x09dc('0xe')]()[_0x09dc('0x10')](0x1,'s')[_0x09dc('0xc')]()};_0x1b1f78[_0x489ee0]=_0x5e28a6;}else if(_0x323d13[_0x09dc('0x11')]==='uniqueid'){_0x1b1f78[_0x489ee0]=_0x260130;}else{_0x1b1f78[_0x489ee0]=_[_0x09dc('0x12')](_0x260130)?_0x260130:JSON[_0x09dc('0x1')](_0x260130);}}else{_0x1b1f78[_0x489ee0]=_[_0x09dc('0x12')](_0x260130)?_0x260130:JSON[_0x09dc('0x1')](_0x260130);}}catch(_0x542960){_0x1b1f78[_0x489ee0]=_0x260130[_0x09dc('0x6')](',');}});}return _0x1b1f78;};exports[_0x09dc('0x13')]=function(_0x5382ad){_0x5382ad=parseInt(_0x5382ad,0xa);if(!_0x5382ad||_0x5382ad<0x0){_0x5382ad=LIMIT_VALUE;}return _0x5382ad;};exports[_0x09dc('0x14')]=function(_0x556669){_0x556669=parseInt(_0x556669,0xa);if(!_0x556669||_0x556669<0x0){_0x556669=0x0;}return _0x556669;};exports[_0x09dc('0x15')]=function(_0x37bc7b){var _0x6e8314,_0x27c68b=null;if(_0x37bc7b){_0x6e8314=_0x37bc7b['split'](',');_0x27c68b=_['map'](_0x6e8314,function(_0x16822a){if(_0x16822a[_0x09dc('0x16')]('-')===0x0){return[_0x16822a===_0x09dc('0x17')?sequelize['cast'](sequelize[_0x09dc('0x18')](_0x09dc('0x17')),_0x09dc('0x19')):_0x16822a['substr'](0x1),'DESC'];}else{return[_0x16822a==='priority'?sequelize['cast'](sequelize['col'](_0x09dc('0x17')),_0x09dc('0x19')):_0x16822a,'ASC'];}});}return _0x27c68b;};exports['omit']=function(_0xa405b9,_0x2e9bc5){if(_['isEmpty'](_0xa405b9)){return _0xa405b9;}if(_[_0x09dc('0x12')](_0xa405b9)){for(var _0x2bae56=0x0;_0x2bae56<_0xa405b9[_0x09dc('0x1a')];_0x2bae56+=0x1){_0xa405b9[_0x2bae56]=this[_0x09dc('0x1b')](_0xa405b9[_0x2bae56],_0x2e9bc5);}return _0xa405b9;}if(!_[_0x09dc('0x1c')](_0xa405b9)){return _0xa405b9;}if(_[_0x09dc('0x1d')](_0x2e9bc5)){_0x2e9bc5=[_0x2e9bc5];}if(!_['isArray'](_0x2e9bc5)){return _0xa405b9;}for(var _0x1b4a4a=0x0;_0x1b4a4a<_0x2e9bc5[_0x09dc('0x1a')];_0x1b4a4a+=0x1){_[_0x09dc('0x1e')](_0xa405b9,_0x2e9bc5[_0x1b4a4a]);}for(var _0x495ea4 in _0xa405b9){if(_0xa405b9['hasOwnProperty'](_0x495ea4)){_0xa405b9[_0x495ea4]=this[_0x09dc('0x1b')](_0xa405b9[_0x495ea4],_0x2e9bc5);}}return _0xa405b9;};exports[_0x09dc('0x1f')]=function(_0x577bba){return _0x577bba[_0x09dc('0x20')](RegExp(_0x09dc('0x21')))?!![]:![];};exports['isEmail']=function(_0x5d3450){return _0x5d3450[_0x09dc('0x20')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3df8cd,_0xfd361d){var _0x27ec2c=[];var _0x158c1c=/[ `!@#$%^&*()_\-?~]/;var _0x51a35e=_0xfd361d?_0x09dc('0x22'):_0x09dc('0x23');_0x3df8cd[_0x09dc('0x6')](/[ ,]+/)[_0x09dc('0x24')](function(_0x1f5057){_0x1f5057=_0x1f5057['replace'](/([^:]")"+/g,'$1');_0x1f5057='+'+_0x1f5057+'*';var _0xf8ea4=_0x1f5057[_0x09dc('0x20')](_0x158c1c);if(_0xf8ea4){_0x1f5057='\x22'+_0x1f5057+'\x22';}_0x27ec2c[_0x09dc('0x25')](_0x1f5057);});_0x51a35e=_0x51a35e['replace'](_0x09dc('0x23'),_0x27ec2c['join']('\x20'));return _0x51a35e;};exports[_0x09dc('0x26')]=function(_0x2c0468,_0x3e298b,_0x2e6809){var _0x336296={},_0x15233a={};if(_0x3e298b[_0x09dc('0x27')]['$id']){_0x3e298b[_0x09dc('0x27')]['id']=_0x3e298b['query'][_0x09dc('0x28')];delete _0x3e298b[_0x09dc('0x27')][_0x09dc('0x28')];}_0x336296[_0x09dc('0x29')]=_['map'](_0x2c0468,_0x09dc('0x11'));_0x336296['query']=_['keys'](_0x3e298b['query']);_0x336296[_0x09dc('0x7')]=_[_0x09dc('0x2a')](_0x336296[_0x09dc('0x29')],_0x336296[_0x09dc('0x27')]);_0x15233a[_0x09dc('0x2b')]=_['intersection'](_0x336296['model'],this['fields'](_0x3e298b['query'][_0x09dc('0x4')]));_0x15233a['attributes']=_0x15233a['attributes'][_0x09dc('0x1a')]?_0x15233a[_0x09dc('0x2b')]:_0x336296[_0x09dc('0x29')];if(!_0x3e298b[_0x09dc('0x27')]['hasOwnProperty'](_0x09dc('0x2c'))){_0x15233a[_0x09dc('0x13')]=this['limit'](_0x3e298b[_0x09dc('0x27')][_0x09dc('0x13')]);_0x15233a[_0x09dc('0x14')]=this[_0x09dc('0x14')](_0x3e298b[_0x09dc('0x27')][_0x09dc('0x14')]);}_0x15233a[_0x09dc('0x2d')]=this[_0x09dc('0x15')](_0x3e298b[_0x09dc('0x27')][_0x09dc('0x15')]);_0x15233a[_0x09dc('0x2e')]=this['filters'](_[_0x09dc('0x2f')](_0x3e298b[_0x09dc('0x27')],_0x336296[_0x09dc('0x7')]),_0x2c0468);if(_0x3e298b[_0x09dc('0x27')][_0x09dc('0x30')]){var _0x340358=_0x2c0468;var _0x15ac3c=_0x3e298b[_0x09dc('0x27')][_0x09dc('0x30')];if(typeof _0x15ac3c===_0x09dc('0x31')){_0x340358=_[_0x09dc('0x30')](_0x2c0468,function(_0x48adf5){return _['includes'](_0x15ac3c['columns'],_0x48adf5[_0x09dc('0x11')]);});_0x15ac3c=_0x15ac3c['value'];}_0x15233a[_0x09dc('0x2e')]=_[_0x09dc('0x32')](_0x15233a[_0x09dc('0x2e')],{'$or':_[_0x09dc('0x33')](_0x340358,function(_0x35b152){if(_0x35b152['type']!==_0x09dc('0x34')){if(_0x2e6809){return sequelize['where'](sequelize['fn'](_0x09dc('0x35'),sequelize[_0x09dc('0x18')](_0x35b152[_0x09dc('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x3e298b['query'][_0x09dc('0x30')]+'%')});}else{var _0x97404={};_0x97404[_0x35b152[_0x09dc('0x11')]]={'$like':'%'+_0x3e298b['query']['filter']+'%'};return _0x97404;}}})});}_0x15233a=_[_0x09dc('0x32')]({},_0x15233a,_0x3e298b['options']);return _0x15233a;};exports[_0x09dc('0x36')]=function(_0x358f28){var _0x871359=[];if(_0x358f28[_0x09dc('0x37')]){_0x871359[_0x09dc('0x25')]({'all':!![]});}else if(_0x358f28[_0x09dc('0x36')]){if(Array['isArray'](_0x358f28[_0x09dc('0x36')])){_0x871359=Object[_0x09dc('0x2')](_0x358f28[_0x09dc('0x36')])[_0x09dc('0x33')](function(_0x2518b6){return parseIncludeModel(_0x358f28[_0x09dc('0x36')][_0x2518b6]);});}else{var _0xe55175=parseIncludeModel(_0x358f28[_0x09dc('0x36')]);_0x871359[_0x09dc('0x25')](_0xe55175);}}return _0x871359;}; \ No newline at end of file +var _0xfcbe=['unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','nolimit','limit','order','pick','includes','where','merge','VIRTUAL','lower','filter','options','includeAll','push','include','sequelize','moment','../../mysqldb','keys','parse','alias','fields','split','filters','isEmpty','forOwn','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','DESC','unsigned','ASC','length','omit','isObject','isString'];(function(_0x5219e4,_0x19ffcf){var _0xcea20f=function(_0x1a0357){while(--_0x1a0357){_0x5219e4['push'](_0x5219e4['shift']());}};_0xcea20f(++_0x19ffcf);}(_0xfcbe,0x1b1));var _0xefcb=function(_0xade32c,_0x5693b6){_0xade32c=_0xade32c-0x0;var _0x15e6c3=_0xfcbe[_0xade32c];return _0x15e6c3;};'use strict';var _=require('lodash');var sequelize=require(_0xefcb('0x0'));var moment=require(_0xefcb('0x1'));var db=require(_0xefcb('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1d029d){var _0x752292=['ne'];try{var _0x11e156=JSON['parse'](_0x1d029d);var _0xbfb8c6=Object[_0xefcb('0x3')](_0x11e156)[0x0];return _0x752292['includes'](_0xbfb8c6);}catch(_0x58dda0){return![];}}function getOperatorValue(_0x50dcde){var _0x3f322c=JSON['parse'](_0x50dcde);var _0x4bacb4=Object[_0xefcb('0x3')](_0x3f322c)[0x0];var _0x55cad2=_0x3f322c[_0x4bacb4];return{['$'+_0x4bacb4]:_0x55cad2};}function parseIncludeModel(_0x100aa1){var _0x145119=JSON[_0xefcb('0x4')](_0x100aa1);return{'model':db[_0x145119['model']],'as':_0x145119[_0xefcb('0x5')],'attributes':_0x145119[_0xefcb('0x6')],'raw':_0x145119['raw']};}exports['fields']=function(_0x326270){var _0x3e42c7=null;if(_0x326270){_0x3e42c7=_0x326270[_0xefcb('0x7')](',');}return _0x3e42c7;};exports[_0xefcb('0x8')]=function(_0xe0d606,_0x247dcd){var _0x47d4e1={};if(!_[_0xefcb('0x9')](_0xe0d606)){_[_0xefcb('0xa')](_0xe0d606,function(_0x2c77dd,_0x30b31d){try{if(_0x247dcd){var _0x3bfbb3=_['find'](_0x247dcd,{'name':_0x30b31d})||{};if(hasSequelizeOperator(_0x2c77dd)){_0x47d4e1[_0x30b31d]=getOperatorValue(_0x2c77dd);}else if(_0x3bfbb3['type']===_0xefcb('0xb')&&_[_0xefcb('0xc')](_0x2c77dd)){var _0x586dce=JSON[_0xefcb('0x4')](_0x2c77dd);var _0x565c13={'$gte':moment(moment(_0x586dce[_0xefcb('0xd')])['format'](_0xefcb('0xe')))[_0xefcb('0xf')]()[_0xefcb('0x10')](),'$lte':moment(moment(_0x586dce[_0xefcb('0x11')])[_0xefcb('0x10')](_0xefcb('0xe')))['utc']()[_0xefcb('0x12')](0x1,'s')[_0xefcb('0x10')]()};_0x47d4e1[_0x30b31d]=_0x565c13;}else if(_0x3bfbb3[_0xefcb('0x13')]===_0xefcb('0x14')){_0x47d4e1[_0x30b31d]=_0x2c77dd;}else{_0x47d4e1[_0x30b31d]=_[_0xefcb('0x15')](_0x2c77dd)?_0x2c77dd:JSON[_0xefcb('0x4')](_0x2c77dd);}}else{_0x47d4e1[_0x30b31d]=_[_0xefcb('0x15')](_0x2c77dd)?_0x2c77dd:JSON['parse'](_0x2c77dd);}}catch(_0x39ab04){_0x47d4e1[_0x30b31d]=_0x2c77dd[_0xefcb('0x7')](',');}});}return _0x47d4e1;};exports['limit']=function(_0x12a93f){_0x12a93f=parseInt(_0x12a93f,0xa);if(!_0x12a93f||_0x12a93f<0x0){_0x12a93f=LIMIT_VALUE;}return _0x12a93f;};exports[_0xefcb('0x16')]=function(_0xea53e9){_0xea53e9=parseInt(_0xea53e9,0xa);if(!_0xea53e9||_0xea53e9<0x0){_0xea53e9=0x0;}return _0xea53e9;};exports[_0xefcb('0x17')]=function(_0x45f49b){var _0x4e13c0,_0x10c662=null;if(_0x45f49b){_0x4e13c0=_0x45f49b[_0xefcb('0x7')](',');_0x10c662=_[_0xefcb('0x18')](_0x4e13c0,function(_0x2444cf){if(_0x2444cf[_0xefcb('0x19')]('-')===0x0){return[_0x2444cf===_0xefcb('0x1a')?sequelize[_0xefcb('0x1b')](sequelize[_0xefcb('0x1c')]('priority'),'unsigned'):_0x2444cf['substr'](0x1),_0xefcb('0x1d')];}else{return[_0x2444cf===_0xefcb('0x1a')?sequelize[_0xefcb('0x1b')](sequelize[_0xefcb('0x1c')](_0xefcb('0x1a')),_0xefcb('0x1e')):_0x2444cf,_0xefcb('0x1f')];}});}return _0x10c662;};exports['omit']=function(_0x3029d1,_0x16f800){if(_[_0xefcb('0x9')](_0x3029d1)){return _0x3029d1;}if(_[_0xefcb('0x15')](_0x3029d1)){for(var _0x18f4ef=0x0;_0x18f4ef<_0x3029d1[_0xefcb('0x20')];_0x18f4ef+=0x1){_0x3029d1[_0x18f4ef]=this[_0xefcb('0x21')](_0x3029d1[_0x18f4ef],_0x16f800);}return _0x3029d1;}if(!_[_0xefcb('0x22')](_0x3029d1)){return _0x3029d1;}if(_[_0xefcb('0x23')](_0x16f800)){_0x16f800=[_0x16f800];}if(!_[_0xefcb('0x15')](_0x16f800)){return _0x3029d1;}for(var _0x124546=0x0;_0x124546<_0x16f800[_0xefcb('0x20')];_0x124546+=0x1){_[_0xefcb('0x24')](_0x3029d1,_0x16f800[_0x124546]);}for(var _0x43fb58 in _0x3029d1){if(_0x3029d1[_0xefcb('0x25')](_0x43fb58)){_0x3029d1[_0x43fb58]=this['omit'](_0x3029d1[_0x43fb58],_0x16f800);}}return _0x3029d1;};exports[_0xefcb('0x26')]=function(_0x3995cc){return _0x3995cc[_0xefcb('0x27')](RegExp(_0xefcb('0x28')))?!![]:![];};exports[_0xefcb('0x29')]=function(_0xc83f28){return _0xc83f28[_0xefcb('0x27')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4f2e1e,_0x350385){var _0x423589=[];var _0x494933=/[ `!@#$%^&*()_\-?~]/;var _0x24e58b=_0x350385?_0xefcb('0x2a'):_0xefcb('0x2b');_0x4f2e1e['split'](/[ ,]+/)[_0xefcb('0x2c')](function(_0x287386){_0x287386=_0x287386[_0xefcb('0x2d')](/([^:]")"+/g,'$1');_0x287386='+'+_0x287386+'*';var _0x58979b=_0x287386['match'](_0x494933);if(_0x58979b){_0x287386='\x22'+_0x287386+'\x22';}_0x423589['push'](_0x287386);});_0x24e58b=_0x24e58b['replace'](_0xefcb('0x2b'),_0x423589[_0xefcb('0x2e')]('\x20'));return _0x24e58b;};exports[_0xefcb('0x2f')]=function(_0x1e144c,_0x2b1759,_0x352db0){var _0x32562b={},_0x293176={};if(_0x2b1759[_0xefcb('0x30')][_0xefcb('0x31')]){_0x2b1759[_0xefcb('0x30')]['id']=_0x2b1759[_0xefcb('0x30')][_0xefcb('0x31')];delete _0x2b1759[_0xefcb('0x30')][_0xefcb('0x31')];}_0x32562b[_0xefcb('0x32')]=_['map'](_0x1e144c,_0xefcb('0x13'));_0x32562b[_0xefcb('0x30')]=_[_0xefcb('0x3')](_0x2b1759[_0xefcb('0x30')]);_0x32562b['filters']=_[_0xefcb('0x33')](_0x32562b['model'],_0x32562b[_0xefcb('0x30')]);_0x293176[_0xefcb('0x34')]=_[_0xefcb('0x33')](_0x32562b[_0xefcb('0x32')],this['fields'](_0x2b1759[_0xefcb('0x30')][_0xefcb('0x6')]));_0x293176[_0xefcb('0x34')]=_0x293176['attributes'][_0xefcb('0x20')]?_0x293176[_0xefcb('0x34')]:_0x32562b[_0xefcb('0x32')];if(!_0x2b1759['query']['hasOwnProperty'](_0xefcb('0x35'))){_0x293176['limit']=this['limit'](_0x2b1759[_0xefcb('0x30')][_0xefcb('0x36')]);_0x293176[_0xefcb('0x16')]=this['offset'](_0x2b1759['query']['offset']);}_0x293176[_0xefcb('0x37')]=this[_0xefcb('0x17')](_0x2b1759['query'][_0xefcb('0x17')]);_0x293176['where']=this[_0xefcb('0x8')](_[_0xefcb('0x38')](_0x2b1759[_0xefcb('0x30')],_0x32562b[_0xefcb('0x8')]),_0x1e144c);if(_0x2b1759[_0xefcb('0x30')]['filter']){var _0x594207=_0x1e144c;var _0x13dc1b=_0x2b1759[_0xefcb('0x30')]['filter'];if(typeof _0x13dc1b==='object'){_0x594207=_['filter'](_0x1e144c,function(_0x1f08ff){return _[_0xefcb('0x39')](_0x13dc1b['columns'],_0x1f08ff[_0xefcb('0x13')]);});_0x13dc1b=_0x13dc1b['value'];}_0x293176[_0xefcb('0x3a')]=_[_0xefcb('0x3b')](_0x293176[_0xefcb('0x3a')],{'$or':_[_0xefcb('0x18')](_0x594207,function(_0x2eb623){if(_0x2eb623['type']!==_0xefcb('0x3c')){if(_0x352db0){return sequelize['where'](sequelize['fn'](_0xefcb('0x3d'),sequelize['col'](_0x2eb623[_0xefcb('0x13')])),{'$like':sequelize['fn']('lower','%'+_0x2b1759[_0xefcb('0x30')]['filter']+'%')});}else{var _0x13766c={};_0x13766c[_0x2eb623[_0xefcb('0x13')]]={'$like':'%'+_0x2b1759[_0xefcb('0x30')][_0xefcb('0x3e')]+'%'};return _0x13766c;}}})});}_0x293176=_[_0xefcb('0x3b')]({},_0x293176,_0x2b1759[_0xefcb('0x3f')]);return _0x293176;};exports['include']=function(_0x2ead1){var _0x4ae563=[];if(_0x2ead1[_0xefcb('0x40')]){_0x4ae563[_0xefcb('0x41')]({'all':!![]});}else if(_0x2ead1[_0xefcb('0x42')]){if(Array[_0xefcb('0x15')](_0x2ead1[_0xefcb('0x42')])){_0x4ae563=Object[_0xefcb('0x3')](_0x2ead1['include'])[_0xefcb('0x18')](function(_0x1c9156){return parseIncludeModel(_0x2ead1[_0xefcb('0x42')][_0x1c9156]);});}else{var _0x53c7d6=parseIncludeModel(_0x2ead1['include']);_0x4ae563[_0xefcb('0x41')](_0x53c7d6);}}return _0x4ae563;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 2806984..39afefd 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 _0x46ed=['map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','pauseType','find','globalStatus','split','order','startsWith','DESC','ASC','fullname,internal','fullname','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','role','lastLoginAt','faxStatus','mailCurrentCapacity','smsCurrentCapacity','onhold','queue','routealias','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','idle','busy','isArray','startCase','Queue'];(function(_0xcee3a0,_0x5b6b04){var _0x39a43e=function(_0x3cfc09){while(--_0x3cfc09){_0xcee3a0['push'](_0xcee3a0['shift']());}};_0x39a43e(++_0x5b6b04);}(_0x46ed,0x168));var _0xd46e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46ed[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd46e('0x0'));var jayson=require(_0xd46e('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd46e('0x2')][_0xd46e('0x3')]({'port':0x232a});var routingClient=jayson[_0xd46e('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x2e6b84,_0x4518b8){var _0x54ef98=[_0x2e6b84[_0xd46e('0x4')],_0x2e6b84[_0xd46e('0x5')],_0x2e6b84[_0xd46e('0x6')],_0x2e6b84[_0xd46e('0x7')],_0x2e6b84[_0xd46e('0x8')],_0x2e6b84[_0xd46e('0x9')],_0x2e6b84[_0xd46e('0xa')]];if(!_0x4518b8)return _[_0xd46e('0xb')](_0x54ef98);var _0x31259b=_[_0xd46e('0xc')](_0x54ef98);return _0x31259b[_0xd46e('0xd')]>0x0&&_0x31259b['length']<_0x54ef98[_0xd46e('0xd')]?!![]:![];}function isIdle(_0x81235b){return _0x81235b==='idle'||_0x81235b===_0xd46e('0xe')||_0x81235b===_0xd46e('0xf')||_0x81235b===_0xd46e('0x10')||_[_0xd46e('0x11')](_0x81235b);}function isAgentIdle(_0x1ad723){if(_0x1ad723[_0xd46e('0x12')]!=='idle'&&_0x1ad723[_0xd46e('0x9')]){_0x1ad723['voiceStatus']='pause';return![];}return _[_0xd46e('0xb')]([_0x1ad723[_0xd46e('0x13')],_0x1ad723['faxStatus'],_0x1ad723['mailStatus'],_0x1ad723[_0xd46e('0x14')],_0x1ad723[_0xd46e('0x15')],_0x1ad723[_0xd46e('0x12')],_0x1ad723[_0xd46e('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xd46e('0x17'),{})[_0xd46e('0x18')](function(_0x417402){if(_0x417402[_0xd46e('0x19')]){throw new Error(_0xd46e('0x1a'));}var _0x47fa8f=_0x417402[_0xd46e('0x1b')];return routingClient[_0xd46e('0x1c')](_0xd46e('0x17'),{})['then'](function(_0x5ddd04){if(_0x5ddd04[_0xd46e('0x19')]){throw new Error(_0xd46e('0x1d'));}var _0x488690=_0x5ddd04['result'];return _[_0xd46e('0x1e')]({},_0x47fa8f,_0x488690);});})[_0xd46e('0x1f')](function(_0x362885){throw _0x362885;});}exports[_0xd46e('0x20')]=getRealtimeAgents;function getAgentStatus(_0x409010){var _0x312d6f=_0xd46e('0xe');if(isAgentPaused(_0x409010))_0x312d6f=_0xd46e('0x21');else if(isAgentPaused(_0x409010,!![]))_0x312d6f=_0xd46e('0x22');else if(isAgentIdle(_0x409010))_0x312d6f=_0xd46e('0x23');else _0x312d6f=_0xd46e('0x24');return _0x312d6f;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x259072,_0x1c83fa){var _0x79aa51=_[_0xd46e('0x25')](_0x259072)?_0x259072:[_0x259072];var _0x128246=_[_0xd46e('0x26')](_0x1c83fa)+_0xd46e('0x27');var _0x8a1be=_[_0xd46e('0x28')](_0x79aa51,function(_0x4cf899){return db[_0x128246][_0xd46e('0x29')]({'where':{'id':_0x4cf899}})['then'](function(_0x4b8f6a){if(!_0x4b8f6a)return[];return _0x4b8f6a[_0xd46e('0x2a')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd46e('0x2b')](_0x8a1be)[_0xd46e('0x18')](function(_0x42afc7){var _0x247b9f=_(_0x42afc7)[_0xd46e('0x2c')]()[_0xd46e('0x28')]('id')['uniq']()[_0xd46e('0x2d')]();return _0x247b9f;});}exports[_0xd46e('0x2e')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xddbce9,_0x17db79,_0x96f15c){try{if(_0x17db79[_0xd46e('0xd')]>0x0){_0xddbce9=_0xddbce9['filter'](function(_0x465d54){return _0x17db79[_0xd46e('0x2f')](_0x465d54['id']);});}var _0x2d1afe=_0xddbce9[_0xd46e('0xc')](function(_0x106edc){var _0x423ea3=_0xd46e('0x24');if(isAgentIdle(_0x106edc)){_0x423ea3=_0xd46e('0x23');}return _0x423ea3===_0x96f15c;});return _[_0xd46e('0x28')](_0x2d1afe,'id');}catch(_0x45ea47){throw _0x45ea47;}}exports[_0xd46e('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x504324,_0x2f4a1b,_0x5ed8dc){return Promise[_0xd46e('0x31')]()[_0xd46e('0x18')](function(){if(_0x2f4a1b[_0xd46e('0xd')]>0x0){_0x504324=_0x504324[_0xd46e('0xc')](function(_0x5ef248){return _0x2f4a1b[_0xd46e('0x2f')](_0x5ef248['id']);});}return _0x504324;})[_0xd46e('0x18')](function(){return db['User'][_0xd46e('0x32')]({'attributes':['id',_0xd46e('0x33'),'fullname',_0xd46e('0x4'),_0xd46e('0x5'),_0xd46e('0x6'),'openchannelPause','smsPause',_0xd46e('0x9'),_0xd46e('0xa'),_0xd46e('0x34')],'where':{'id':{'$in':_[_0xd46e('0x28')](_0x504324,'id')}},'raw':!![]});})[_0xd46e('0x18')](function(_0x423de9){return _0x423de9[_0xd46e('0x28')](function(_0xf8b746){var _0x527a2f=_[_0xd46e('0x35')](_0x504324,['id',_0xf8b746['id']]);var _0x1a1181=filterAgentAttributes(_0x527a2f);_[_0xd46e('0x1e')](_0xf8b746,_0x1a1181);_0xf8b746[_0xd46e('0x36')]=getAgentStatus(_0xf8b746);return _0xf8b746;});})[_0xd46e('0x18')](function(_0x1e0897){var _0x42ddde=sortAgentsByStatus(_0x1e0897,_0x5ed8dc);return _['map'](_0x42ddde,'id');})[_0xd46e('0x1f')](function(_0x357212){throw _0x357212;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x14447e){var _0x96b0f9={'fields':[],'order':null};var _0x12ccf8=_0x14447e[_0xd46e('0x37')](',');_0x96b0f9['fields']=_[_0xd46e('0xc')](_0x12ccf8,function(_0x3ecf34){if(!_0x3ecf34[_0xd46e('0x2f')](_0xd46e('0x36'))){return!![];}_0x96b0f9[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x3ecf34,'-')?_0xd46e('0x3a'):_0xd46e('0x3b');return![];});return _0x96b0f9;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x232e6f){if(!_0x232e6f){_0x232e6f=_0xd46e('0x3c');}if(_0x232e6f[_0xd46e('0x2f')](_0xd46e('0x3d'))&&!_0x232e6f[_0xd46e('0x2f')]('internal')){var _0x964c66=_0x232e6f['substring'](0x0,_0x232e6f['indexOf']('fullname'));_0x232e6f+=','+_0x964c66+'internal';}return _0x232e6f;}exports[_0xd46e('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x54949f,_0x3b76e0){var _0x40720e=_0x54949f['sort'](function(_0x462477,_0x4114e6){if(_0x462477[_0xd46e('0x36')]===_0x4114e6[_0xd46e('0x36')]){if(_0x462477[_0xd46e('0x36')]===_0xd46e('0x21')){if(_0x3b76e0===_0xd46e('0x3a')){return(_0x462477[_0xd46e('0x34')]||'')<(_0x4114e6[_0xd46e('0x34')]||'')||_0x462477[_0xd46e('0x3d')][_0xd46e('0x3f')]()>_0x4114e6['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x462477['pauseType']||'')<(_0x4114e6[_0xd46e('0x34')]||'')||_0x462477['fullname'][_0xd46e('0x3f')]()>_0x4114e6[_0xd46e('0x3d')][_0xd46e('0x3f')]()?-0x1:0x1;}}else{if(_0x3b76e0===_0xd46e('0x3a')){return _0x462477[_0xd46e('0x3d')][_0xd46e('0x3f')]()<_0x4114e6[_0xd46e('0x3d')][_0xd46e('0x3f')]()?0x1:-0x1;}else{return _0x462477['fullname'][_0xd46e('0x3f')]()<_0x4114e6['fullname'][_0xd46e('0x3f')]()?-0x1:0x1;}}}else{if(_0x3b76e0===_0xd46e('0x3a')){return _0x462477[_0xd46e('0x36')]<_0x4114e6[_0xd46e('0x36')]?0x1:-0x1;}else{return _0x462477[_0xd46e('0x36')]<_0x4114e6['globalStatus']?-0x1:0x1;}}});return _0x40720e;}exports[_0xd46e('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0xfcd7f9){var _0x2acb83=[_0xd46e('0x41'),_0xd46e('0x42'),'lastLoginAt',_0xd46e('0x43'),_0xd46e('0x34'),_0xd46e('0x43'),_0xd46e('0x44'),_0xd46e('0x45'),'chatPause',_0xd46e('0x7'),_0xd46e('0x6'),_0xd46e('0x8'),_0xd46e('0xa'),_0xd46e('0x5'),_0xd46e('0x9'),_0xd46e('0x46'),_0xd46e('0x47'),'mailCapacity',_0xd46e('0x48'),_0xd46e('0x49'),_0xd46e('0x4a'),_0xd46e('0x4b'),_0xd46e('0x4c'),'mailCurrentCapacity','smsCurrentCapacity',_0xd46e('0x4d'),_0xd46e('0x4e'),_0xd46e('0x13'),'openchannelStatus','mailStatus',_0xd46e('0x15'),_0xd46e('0x16'),'faxStatus',_0xd46e('0x12'),_0xd46e('0x4f'),_0xd46e('0x50'),_0xd46e('0x51'),_0xd46e('0x52'),_0xd46e('0x53'),_0xd46e('0x54'),_0xd46e('0x55'),'queue',_0xd46e('0x56'),_0xd46e('0x57'),_0xd46e('0x58'),_0xd46e('0x59'),'routealias'];var _0x56dd9a=[_0xd46e('0x4'),'openchannelPause',_0xd46e('0x6'),_0xd46e('0x8'),_0xd46e('0xa'),_0xd46e('0x5'),_0xd46e('0x9'),_0xd46e('0x42')];var _0x492329=_(_0xfcd7f9)[_0xd46e('0x5a')](_0x56dd9a)[_0xd46e('0x5b')](_0x2acb83)[_0xd46e('0x2d')]();return _0x492329;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xd46e('0x33'),_0xd46e('0x3d'),_0xd46e('0x5c'),_0xd46e('0x44'),_0xd46e('0x42'),_0xd46e('0x36'),_0xd46e('0x41'),_0xd46e('0x5d'),_0xd46e('0x34'),_0xd46e('0x43'),_0xd46e('0x5'),_0xd46e('0x4'),_0xd46e('0x6'),_0xd46e('0x7'),'smsPause',_0xd46e('0x9'),_0xd46e('0xa'),_0xd46e('0x13'),_0xd46e('0x5e'),'mailStatus',_0xd46e('0x14'),_0xd46e('0x15'),_0xd46e('0x12'),_0xd46e('0x16'),'chatStatusTime',_0xd46e('0x54'),_0xd46e('0x51'),'openchannelStatusTime','smsStatusTime',_0xd46e('0x55'),_0xd46e('0x53'),_0xd46e('0x46'),'faxCapacity','mailCapacity',_0xd46e('0x47'),_0xd46e('0x48'),_0xd46e('0x49'),_0xd46e('0x4b'),_0xd46e('0x4e'),_0xd46e('0x5f'),_0xd46e('0x4c'),_0xd46e('0x60'),_0xd46e('0x4d'),_0xd46e('0x58'),_0xd46e('0x59'),_0xd46e('0x56'),_0xd46e('0x61'),_0xd46e('0x62'),_0xd46e('0x63'),_0xd46e('0x57')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x6aa7=['getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','chatPause','pauseType','find','globalStatus','fields','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelPause','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','omit','pick','role','openchannelStatusTime','smsStatusTime','chatCurrentCapacity','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','mailPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','Agents','then','error','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value'];(function(_0x1f28bb,_0x263b59){var _0x4be47c=function(_0x1c3f3f){while(--_0x1c3f3f){_0x1f28bb['push'](_0x1f28bb['shift']());}};_0x4be47c(++_0x263b59);}(_0x6aa7,0x178));var _0x76aa=function(_0x3fc78f,_0x41eb4d){_0x3fc78f=_0x3fc78f-0x0;var _0x29330d=_0x6aa7[_0x3fc78f];return _0x29330d;};'use strict';var _=require(_0x76aa('0x0'));var jayson=require('jayson/promise');var db=require(_0x76aa('0x1'))['db'];var amiClient=jayson[_0x76aa('0x2')][_0x76aa('0x3')]({'port':0x232a});var routingClient=jayson[_0x76aa('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x13f62b,_0xef15ef){var _0x1d6e04=[_0x13f62b['chatPause'],_0x13f62b['faxPause'],_0x13f62b[_0x76aa('0x4')],_0x13f62b['openchannelPause'],_0x13f62b[_0x76aa('0x5')],_0x13f62b[_0x76aa('0x6')],_0x13f62b[_0x76aa('0x7')]];if(!_0xef15ef)return _['every'](_0x1d6e04);var _0x3dae33=_[_0x76aa('0x8')](_0x1d6e04);return _0x3dae33[_0x76aa('0x9')]>0x0&&_0x3dae33['length']<_0x1d6e04[_0x76aa('0x9')]?!![]:![];}function isIdle(_0x25856d){return _0x25856d===_0x76aa('0xa')||_0x25856d===_0x76aa('0xb')||_0x25856d===_0x76aa('0xc')||_0x25856d===_0x76aa('0xd')||_[_0x76aa('0xe')](_0x25856d);}function isAgentIdle(_0x8dc35c){if(_0x8dc35c[_0x76aa('0xf')]!==_0x76aa('0xa')&&_0x8dc35c['voicePause']){_0x8dc35c[_0x76aa('0xf')]='pause';return![];}return _[_0x76aa('0x10')]([_0x8dc35c[_0x76aa('0x11')],_0x8dc35c[_0x76aa('0x12')],_0x8dc35c[_0x76aa('0x13')],_0x8dc35c[_0x76aa('0x14')],_0x8dc35c['smsStatus'],_0x8dc35c['voiceStatus'],_0x8dc35c[_0x76aa('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x76aa('0x16'),{})[_0x76aa('0x17')](function(_0x5cf594){if(_0x5cf594[_0x76aa('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x328381=_0x5cf594['result'];return routingClient[_0x76aa('0x19')](_0x76aa('0x16'),{})[_0x76aa('0x17')](function(_0x21c16d){if(_0x21c16d[_0x76aa('0x18')]){throw new Error(_0x76aa('0x1a'));}var _0x496902=_0x21c16d['result'];return _[_0x76aa('0x1b')]({},_0x328381,_0x496902);});})[_0x76aa('0x1c')](function(_0xf0711){throw _0xf0711;});}exports[_0x76aa('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x15109b){var _0x191560=_0x76aa('0xb');if(isAgentPaused(_0x15109b))_0x191560=_0x76aa('0x1e');else if(isAgentPaused(_0x15109b,!![]))_0x191560=_0x76aa('0x1f');else if(isAgentIdle(_0x15109b))_0x191560='idle';else _0x191560=_0x76aa('0x20');return _0x191560;}exports[_0x76aa('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x338a6b,_0x5b3f55){var _0x41463a=_[_0x76aa('0x22')](_0x338a6b)?_0x338a6b:[_0x338a6b];var _0x31252f=_[_0x76aa('0x23')](_0x5b3f55)+_0x76aa('0x24');var _0xc1044c=_[_0x76aa('0x25')](_0x41463a,function(_0x3363b3){return db[_0x31252f][_0x76aa('0x26')]({'where':{'id':_0x3363b3}})[_0x76aa('0x17')](function(_0x37f1ab){if(!_0x37f1ab)return[];return _0x37f1ab[_0x76aa('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x76aa('0x28')](_0xc1044c)['then'](function(_0xb5e8a9){var _0x1d6d15=_(_0xb5e8a9)[_0x76aa('0x29')]()[_0x76aa('0x25')]('id')[_0x76aa('0x2a')]()[_0x76aa('0x2b')]();return _0x1d6d15;});}exports[_0x76aa('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x282d0a,_0xd12a99,_0x1bdc3d){try{if(_0xd12a99['length']>0x0){_0x282d0a=_0x282d0a[_0x76aa('0x8')](function(_0x5a8030){return _0xd12a99[_0x76aa('0x2d')](_0x5a8030['id']);});}var _0x365ff8=_0x282d0a[_0x76aa('0x8')](function(_0x1e90b9){var _0x1eecd9=_0x76aa('0x20');if(isAgentIdle(_0x1e90b9)){_0x1eecd9=_0x76aa('0xa');}return _0x1eecd9===_0x1bdc3d;});return _[_0x76aa('0x25')](_0x365ff8,'id');}catch(_0x19fd4f){throw _0x19fd4f;}}exports[_0x76aa('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5edcd8,_0x430ad6,_0x5532c7){return Promise[_0x76aa('0x2f')]()[_0x76aa('0x17')](function(){if(_0x430ad6[_0x76aa('0x9')]>0x0){_0x5edcd8=_0x5edcd8[_0x76aa('0x8')](function(_0x35a705){return _0x430ad6['includes'](_0x35a705['id']);});}return _0x5edcd8;})[_0x76aa('0x17')](function(){return db[_0x76aa('0x30')]['findAll']({'attributes':['id',_0x76aa('0x31'),'fullname',_0x76aa('0x32'),'faxPause',_0x76aa('0x4'),'openchannelPause','smsPause',_0x76aa('0x6'),_0x76aa('0x7'),_0x76aa('0x33')],'where':{'id':{'$in':_[_0x76aa('0x25')](_0x5edcd8,'id')}},'raw':!![]});})['then'](function(_0x592596){return _0x592596[_0x76aa('0x25')](function(_0x1c7b6f){var _0x58127c=_[_0x76aa('0x34')](_0x5edcd8,['id',_0x1c7b6f['id']]);var _0x23029e=filterAgentAttributes(_0x58127c);_['merge'](_0x1c7b6f,_0x23029e);_0x1c7b6f[_0x76aa('0x35')]=getAgentStatus(_0x1c7b6f);return _0x1c7b6f;});})['then'](function(_0x5086f5){var _0x4fdbde=sortAgentsByStatus(_0x5086f5,_0x5532c7);return _[_0x76aa('0x25')](_0x4fdbde,'id');})[_0x76aa('0x1c')](function(_0x127bc4){throw _0x127bc4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x401c07){var _0x1c22f7={'fields':[],'order':null};var _0x2eea79=_0x401c07['split'](',');_0x1c22f7[_0x76aa('0x36')]=_[_0x76aa('0x8')](_0x2eea79,function(_0x2f7726){if(!_0x2f7726[_0x76aa('0x2d')](_0x76aa('0x35'))){return!![];}_0x1c22f7[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x2f7726,'-')?_0x76aa('0x39'):_0x76aa('0x3a');return![];});return _0x1c22f7;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1525cb){if(!_0x1525cb){_0x1525cb=_0x76aa('0x3b');}if(_0x1525cb[_0x76aa('0x2d')](_0x76aa('0x3c'))&&!_0x1525cb[_0x76aa('0x2d')](_0x76aa('0x3d'))){var _0x572fdb=_0x1525cb['substring'](0x0,_0x1525cb[_0x76aa('0x3e')](_0x76aa('0x3c')));_0x1525cb+=','+_0x572fdb+_0x76aa('0x3d');}return _0x1525cb;}exports[_0x76aa('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x50599f,_0x174a14){var _0x403084=_0x50599f[_0x76aa('0x40')](function(_0x30cdcb,_0x1138b5){if(_0x30cdcb['globalStatus']===_0x1138b5[_0x76aa('0x35')]){if(_0x30cdcb['globalStatus']===_0x76aa('0x1e')){if(_0x174a14==='DESC'){return(_0x30cdcb['pauseType']||'')<(_0x1138b5['pauseType']||'')||_0x30cdcb[_0x76aa('0x3c')]['toLowerCase']()>_0x1138b5['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x30cdcb[_0x76aa('0x33')]||'')<(_0x1138b5[_0x76aa('0x33')]||'')||_0x30cdcb[_0x76aa('0x3c')][_0x76aa('0x41')]()>_0x1138b5[_0x76aa('0x3c')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x174a14===_0x76aa('0x39')){return _0x30cdcb[_0x76aa('0x3c')][_0x76aa('0x41')]()<_0x1138b5[_0x76aa('0x3c')][_0x76aa('0x41')]()?0x1:-0x1;}else{return _0x30cdcb['fullname'][_0x76aa('0x41')]()<_0x1138b5[_0x76aa('0x3c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x174a14===_0x76aa('0x39')){return _0x30cdcb['globalStatus']<_0x1138b5[_0x76aa('0x35')]?0x1:-0x1;}else{return _0x30cdcb[_0x76aa('0x35')]<_0x1138b5[_0x76aa('0x35')]?-0x1:0x1;}}});return _0x403084;}exports[_0x76aa('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x2d0bc4){var _0x3e0315=[_0x76aa('0x43'),_0x76aa('0x44'),_0x76aa('0x45'),_0x76aa('0x46'),'pauseType',_0x76aa('0x46'),'internal',_0x76aa('0x47'),_0x76aa('0x32'),_0x76aa('0x48'),_0x76aa('0x4'),'smsPause','whatsappPause',_0x76aa('0x49'),'voicePause',_0x76aa('0x4a'),_0x76aa('0x4b'),_0x76aa('0x4c'),_0x76aa('0x4d'),_0x76aa('0x4e'),_0x76aa('0x4f'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x76aa('0x50'),_0x76aa('0x51'),_0x76aa('0x52'),_0x76aa('0x53'),_0x76aa('0x11'),_0x76aa('0x14'),'mailStatus',_0x76aa('0x54'),_0x76aa('0x15'),_0x76aa('0x12'),'voiceStatus',_0x76aa('0x55'),'openchannelStatusTime',_0x76aa('0x56'),'smsStatusTime',_0x76aa('0x57'),_0x76aa('0x58'),_0x76aa('0x59'),_0x76aa('0x5a'),_0x76aa('0x5b'),_0x76aa('0x5c'),_0x76aa('0x5d'),'phoneBarEnableAutomaticScreenRecording',_0x76aa('0x5e')];var _0x5eeaa5=[_0x76aa('0x32'),_0x76aa('0x48'),_0x76aa('0x4'),_0x76aa('0x5'),_0x76aa('0x7'),_0x76aa('0x49'),_0x76aa('0x6'),'online'];var _0x333a3a=_(_0x2d0bc4)[_0x76aa('0x5f')](_0x5eeaa5)[_0x76aa('0x60')](_0x3e0315)[_0x76aa('0x2b')]();return _0x333a3a;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x76aa('0x31'),_0x76aa('0x3c'),_0x76aa('0x61'),_0x76aa('0x3d'),_0x76aa('0x44'),_0x76aa('0x35'),'userpic',_0x76aa('0x45'),_0x76aa('0x33'),_0x76aa('0x46'),_0x76aa('0x49'),_0x76aa('0x32'),_0x76aa('0x4'),_0x76aa('0x48'),'smsPause','voicePause',_0x76aa('0x7'),_0x76aa('0x11'),'faxStatus',_0x76aa('0x13'),_0x76aa('0x14'),'smsStatus',_0x76aa('0xf'),_0x76aa('0x15'),_0x76aa('0x55'),_0x76aa('0x58'),_0x76aa('0x56'),_0x76aa('0x62'),_0x76aa('0x63'),_0x76aa('0x59'),_0x76aa('0x57'),'chatCapacity',_0x76aa('0x4f'),'mailCapacity',_0x76aa('0x4b'),_0x76aa('0x4d'),_0x76aa('0x4e'),_0x76aa('0x64'),_0x76aa('0x53'),_0x76aa('0x50'),_0x76aa('0x65'),_0x76aa('0x51'),_0x76aa('0x52'),'phoneBarEnableScreenRecordingByAgent',_0x76aa('0x66'),_0x76aa('0x5b'),_0x76aa('0x67'),_0x76aa('0x5a'),_0x76aa('0x5e'),_0x76aa('0x5c')];}exports[_0x76aa('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 5a2668c..8a0236d 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 _0x11b3=['unknown','pTalking','originated','statusMessage','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','get','talking','busy','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','inUse','invalid','notInUse','ringing','ringInUse','unavailable'];(function(_0x146625,_0x35db16){var _0x44ac58=function(_0x595365){while(--_0x595365){_0x146625['push'](_0x146625['shift']());}};_0x44ac58(++_0x35db16);}(_0x11b3,0xe7));var _0x311b=function(_0x44351e,_0x3a1378){_0x44351e=_0x44351e-0x0;var _0x274ac3=_0x11b3[_0x44351e];return _0x274ac3;};'use strict';var _=require('lodash');var jayson=require(_0x311b('0x0'));var util=require(_0x311b('0x1'));var amiClient=jayson[_0x311b('0x2')][_0x311b('0x3')]({'port':0x232a});var routingClient=jayson[_0x311b('0x2')][_0x311b('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x311b('0x4'),_0x311b('0x5'),_0x311b('0x6'),_0x311b('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x311b('0x8'),_0x311b('0x9'),'loggedInDb',_0x311b('0xa'),'onHold',_0x311b('0xb'),_0x311b('0xc'),'talking',_0x311b('0xd'),_0x311b('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x311b('0xf'),_0x311b('0x10'),'message',_0x311b('0x11'),'dialActive','dialMethod',_0x311b('0x12'),_0x311b('0x13'),_0x311b('0x14'),_0x311b('0x15'),_0x311b('0x16'),_0x311b('0x17'),_0x311b('0x18'),_0x311b('0x19'),_0x311b('0x1a'),_0x311b('0x1b'),_0x311b('0x1c'),'predictiveIntervalTotalCalls',_0x311b('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0x311b('0x1e'),'predictiveIntervalAvgHoldtime',_0x311b('0x1f')];function getRealtimeQueues(_0xd6fd2f,_0x352e62){var _0x23871c=_0x352e62===_0x311b('0x20')?amiClient:routingClient;return _0x23871c[_0x311b('0x21')](_[_0x311b('0x22')](_0x352e62)+'Queues',_0xd6fd2f)[_0x311b('0x23')](function(_0x5d6e94){if(_0x5d6e94[_0x311b('0x24')])throw new Error(util['format'](_0x311b('0x25'),_0x352e62));return _0x5d6e94[_0x311b('0x26')];})[_0x311b('0x27')](function(_0x1174f2){throw _0x1174f2;});}exports[_0x311b('0x28')]=getRealtimeQueues;function initializeQueues(_0x2f0746,_0x27b06d,_0x496a22,_0x380e54){var _0x3b05bd=DEFAULT_QUEUE_ATTRIBUTES;if(_0x496a22===_0x311b('0x20')){if(_0x380e54===_0x311b('0x29')){_0x3b05bd=_0x3b05bd[_0x311b('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x380e54===_0x311b('0x2b')){_0x3b05bd=_0x3b05bd['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2f0746['map'](function(_0x3bceb6){var _0x44da51=_0x3bceb6[_0x311b('0x2c')]({'plain':!![]});_0x44da51[_0x311b('0x6')]=0x0;_0x44da51['loggedInDb']=0x0;_0x44da51[_0x311b('0x5')]=0x0;_0x44da51[_0x311b('0x4')]=0x0;_0x44da51['waiting']=0x0;if(_0x496a22===_0x311b('0x20')){_0x44da51[_0x311b('0x2d')]=0x0;_0x44da51[_0x311b('0x2e')]=0x0;if(_0x380e54===_0x311b('0x2b')){_0x44da51[_0x311b('0xf')]=0x0;_0x44da51[_0x311b('0x10')]=0x0;}}var _0x5c9113=_['find'](_0x27b06d,['id',_0x44da51['id']]);if(_0x5c9113){_['merge'](_0x44da51,_[_0x311b('0x2f')](_0x5c9113,_0x3b05bd));}return _0x44da51;});}exports[_0x311b('0x30')]=initializeQueues; \ No newline at end of file +var _0xa9df=['busy','invalid','loggedInDb','notInUse','ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','map','get','waiting','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused'];(function(_0x361557,_0x325ca6){var _0x42cc7a=function(_0x36e129){while(--_0x36e129){_0x361557['push'](_0x361557['shift']());}};_0x42cc7a(++_0x325ca6);}(_0xa9df,0x179));var _0xfa9d=function(_0x2325e2,_0x171526){_0x2325e2=_0x2325e2-0x0;var _0x2cf97e=_0xa9df[_0x2325e2];return _0x2cf97e;};'use strict';var _=require(_0xfa9d('0x0'));var jayson=require(_0xfa9d('0x1'));var util=require(_0xfa9d('0x2'));var amiClient=jayson[_0xfa9d('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xfa9d('0x3')][_0xfa9d('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xfa9d('0x5'),_0xfa9d('0x6'),_0xfa9d('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xfa9d('0x8'),'inUse',_0xfa9d('0x9'),_0xfa9d('0xa'),_0xfa9d('0xb'),'onHold',_0xfa9d('0xc'),_0xfa9d('0xd'),_0xfa9d('0xe'),'unavailable',_0xfa9d('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xfa9d('0x10'),_0xfa9d('0x11'),_0xfa9d('0x12'),_0xfa9d('0x13'),'dialActive',_0xfa9d('0x14'),'Trunk',_0xfa9d('0x15'),_0xfa9d('0x16'),_0xfa9d('0x17'),'erlangCallToSecond',_0xfa9d('0x18'),_0xfa9d('0x19'),_0xfa9d('0x1a'),_0xfa9d('0x1b'),_0xfa9d('0x1c'),_0xfa9d('0x1d'),_0xfa9d('0x1e'),_0xfa9d('0x1f'),_0xfa9d('0x20'),_0xfa9d('0x21'),_0xfa9d('0x22'),_0xfa9d('0x23')];function getRealtimeQueues(_0x140fb2,_0x29929f){var _0x41ca47=_0x29929f===_0xfa9d('0x24')?amiClient:routingClient;return _0x41ca47[_0xfa9d('0x25')](_['startCase'](_0x29929f)+_0xfa9d('0x26'),_0x140fb2)[_0xfa9d('0x27')](function(_0x2bc088){if(_0x2bc088[_0xfa9d('0x28')])throw new Error(util[_0xfa9d('0x29')](_0xfa9d('0x2a'),_0x29929f));return _0x2bc088[_0xfa9d('0x2b')];})[_0xfa9d('0x2c')](function(_0x2d8ab6){throw _0x2d8ab6;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x106628,_0x34db1d,_0x2af9e1,_0x125307){var _0x12deab=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2af9e1===_0xfa9d('0x24')){if(_0x125307===_0xfa9d('0x2d')){_0x12deab=_0x12deab[_0xfa9d('0x2e')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x125307===_0xfa9d('0x2f')){_0x12deab=_0x12deab['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x106628[_0xfa9d('0x30')](function(_0x351a9c){var _0x3c1338=_0x351a9c[_0xfa9d('0x31')]({'plain':!![]});_0x3c1338['paused']=0x0;_0x3c1338[_0xfa9d('0xa')]=0x0;_0x3c1338['loggedIn']=0x0;_0x3c1338['available']=0x0;_0x3c1338[_0xfa9d('0x32')]=0x0;if(_0x2af9e1===_0xfa9d('0x24')){_0x3c1338[_0xfa9d('0xe')]=0x0;_0x3c1338['busy']=0x0;if(_0x125307===_0xfa9d('0x2f')){_0x3c1338[_0xfa9d('0x10')]=0x0;_0x3c1338[_0xfa9d('0x11')]=0x0;}}var _0x2b2191=_[_0xfa9d('0x33')](_0x34db1d,['id',_0x3c1338['id']]);if(_0x2b2191){_[_0xfa9d('0x34')](_0x3c1338,_[_0xfa9d('0x35')](_0x2b2191,_0x12deab));}return _0x3c1338;});}exports[_0xfa9d('0x36')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0cc82c4..76caa41 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(_0x3b29d5,_0x12faa2){var _0x20b96d=function(_0x284207){while(--_0x284207){_0x3b29d5['push'](_0x3b29d5['shift']());}};_0x20b96d(++_0x12faa2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 0702ed8..4aa02e9 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 _0xbf63=['hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','getUuid','platform','test','licenseToken','win32','utf8','replace'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbf63,0x1d9));var _0x3bf6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf63[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3bf6('0x0'));var os=require('os');var crypto=require(_0x3bf6('0x1'));var machine=require(_0x3bf6('0x2'));var exec=require(_0x3bf6('0x3'))[_0x3bf6('0x4')];var config=require(_0x3bf6('0x5'));function getInterfaces(){var _0x2b73e2=[];var _0x4fcb89=os[_0x3bf6('0x6')]();var _0x1f95d8=_['orderBy'](_['keys'](_0x4fcb89));for(var _0x5498af=0x0;_0x5498af<_0x1f95d8['length'];_0x5498af++){var _0x8bedab=_0x4fcb89[_0x1f95d8[_0x5498af]]['filter'](function(_0x2c4a8f){return _0x2c4a8f[_0x3bf6('0x7')]===_0x3bf6('0x8')&&_0x2c4a8f['internal']===![];});_0x2b73e2=_0x2b73e2[_0x3bf6('0x9')](_0x8bedab);}return _0x2b73e2;}function getFirstInterface(){var _0x4ac603=_[_0x3bf6('0xa')](getInterfaces());return{'macAddress':_0x4ac603&&_0x4ac603[_0x3bf6('0xb')]?_0x4ac603['mac']:_0x3bf6('0xc'),'ipAddress':_0x4ac603&&_0x4ac603[_0x3bf6('0xd')]?_0x4ac603['address']:'127.0.0.1'};}exports[_0x3bf6('0xe')]=getFirstInterface;function getCPUhash(){var _0x1775f6=_[_0x3bf6('0xf')](os[_0x3bf6('0x10')]()[_0x3bf6('0x11')](function(_0x2e1ca3){return _0x2e1ca3[_0x3bf6('0x12')];}))[_0x3bf6('0x13')](':');return crypto[_0x3bf6('0x14')](_0x3bf6('0x15'))[_0x3bf6('0x16')](_0x1775f6)[_0x3bf6('0x17')]('hex');}exports[_0x3bf6('0x18')]=function(){var _0x909de4=os[_0x3bf6('0x19')]();var _0x22798f=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x22798f[_0x3bf6('0x1a')](config[_0x3bf6('0x1b')])){return config[_0x3bf6('0x1b')];}else if(_0x909de4===_0x3bf6('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3bf6('0x1d')})[_0x3bf6('0x1e')]('\x0d\x0a','');}else{var _0x5bdd90=getFirstInterface();var _0x45a33e=getCPUhash();var _0x4b5c8d=_0x45a33e+'|'+os[_0x3bf6('0x1f')]()+'|'+_0x5bdd90[_0x3bf6('0x20')]+'|'+_0x5bdd90[_0x3bf6('0x21')];var _0x1d4bcd=crypto['createHash'](_0x3bf6('0x15'))[_0x3bf6('0x16')](_0x4b5c8d)[_0x3bf6('0x17')](_0x3bf6('0x22'));return _0x1d4bcd[_0x3bf6('0x23')](0x0,0x8)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0x8,0xc)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0xc,0x10)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0x10,0x14)+'-'+_0x1d4bcd[_0x3bf6('0x23')](0x14);}}; \ No newline at end of file +var _0x3fe6=['platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','createHash','md5','update','digest','hex','getUuid'];(function(_0x12314f,_0x2ac7ae){var _0x3b6e61=function(_0x2b41b5){while(--_0x2b41b5){_0x12314f['push'](_0x12314f['shift']());}};_0x3b6e61(++_0x2ac7ae);}(_0x3fe6,0x196));var _0x63fe=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0x3fe6[_0x5d225a];return _0x1e7761;};'use strict';var _=require(_0x63fe('0x0'));var os=require('os');var crypto=require(_0x63fe('0x1'));var machine=require(_0x63fe('0x2'));var exec=require('child_process')[_0x63fe('0x3')];var config=require(_0x63fe('0x4'));function getInterfaces(){var _0x58662c=[];var _0x3de666=os[_0x63fe('0x5')]();var _0x54a10d=_[_0x63fe('0x6')](_[_0x63fe('0x7')](_0x3de666));for(var _0x2ceddf=0x0;_0x2ceddf<_0x54a10d['length'];_0x2ceddf++){var _0x3fc5a8=_0x3de666[_0x54a10d[_0x2ceddf]][_0x63fe('0x8')](function(_0x5dae31){return _0x5dae31[_0x63fe('0x9')]===_0x63fe('0xa')&&_0x5dae31[_0x63fe('0xb')]===![];});_0x58662c=_0x58662c['concat'](_0x3fc5a8);}return _0x58662c;}function getFirstInterface(){var _0x990759=_['head'](getInterfaces());return{'macAddress':_0x990759&&_0x990759['mac']?_0x990759[_0x63fe('0xc')]:_0x63fe('0xd'),'ipAddress':_0x990759&&_0x990759['address']?_0x990759[_0x63fe('0xe')]:_0x63fe('0xf')};}exports[_0x63fe('0x10')]=getFirstInterface;function getCPUhash(){var _0x5f2e38=_[_0x63fe('0x6')](os['cpus']()['map'](function(_0x33af7e){return _0x33af7e['model'];}))['join'](':');return crypto[_0x63fe('0x11')](_0x63fe('0x12'))[_0x63fe('0x13')](_0x5f2e38)[_0x63fe('0x14')](_0x63fe('0x15'));}exports[_0x63fe('0x16')]=function(){var _0x3dc8e0=os[_0x63fe('0x17')]();var _0x445ead=/[0-9a-f-]{36}/;if(config[_0x63fe('0x18')]&&_0x445ead[_0x63fe('0x19')](config[_0x63fe('0x18')])){return config[_0x63fe('0x18')];}else if(_0x3dc8e0===_0x63fe('0x1a')){return exec(_0x63fe('0x1b'),{'encoding':_0x63fe('0x1c')})[_0x63fe('0x1d')]('\x0d\x0a','');}else{var _0x554bf5=getFirstInterface();var _0x5f22dd=getCPUhash();var _0x28c138=_0x5f22dd+'|'+os[_0x63fe('0x1e')]()+'|'+_0x554bf5[_0x63fe('0x1f')]+'|'+_0x554bf5['ipAddress'];var _0x4b02b0=crypto[_0x63fe('0x11')](_0x63fe('0x12'))['update'](_0x28c138)['digest'](_0x63fe('0x15'));return _0x4b02b0[_0x63fe('0x20')](0x0,0x8)+'-'+_0x4b02b0[_0x63fe('0x20')](0x8,0xc)+'-'+_0x4b02b0['substring'](0xc,0x10)+'-'+_0x4b02b0[_0x63fe('0x20')](0x10,0x14)+'-'+_0x4b02b0[_0x63fe('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 34ead3a..77ec753 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 _0x51cf=['../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','version','format','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','pkginfo','../../mysqldb'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x51cf,0x11b));var _0xf51c=function(_0x34cdd0,_0x2c4759){_0x34cdd0=_0x34cdd0-0x0;var _0x5664b3=_0x51cf[_0x34cdd0];return _0x5664b3;};'use strict';var util=require('util');var moment=require(_0xf51c('0x0'));var rp=require(_0xf51c('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xf51c('0x2'))(module,'version');var db=require(_0xf51c('0x3'))['db'];var encryptor=require(_0xf51c('0x4'));var hardware=require(_0xf51c('0x5'));var logger=require(_0xf51c('0x6'))(_0xf51c('0x7'));var HOST=_0xf51c('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x35c3a0){return new BPromise(function(_0x14eb2e,_0x19c71c){var _0x5a62e8=util['format'](_0xf51c('0x9'),HOST,_0x35c3a0,module['exports'][_0xf51c('0xa')]);if(oldToken){_0x5a62e8=util[_0xf51c('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x35c3a0,module['exports'][_0xf51c('0xa')],oldToken);}var _0x31818a={'uri':_0x5a62e8,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x31818a)[_0xf51c('0xc')](function(_0x79258e){_0x14eb2e(_0x79258e);})[_0xf51c('0xd')](function(_0x137877){_0x19c71c(_0x137877);});});}function manageLicense(_0x7d3e4b,_0x4ab49d){var _0x58ae6f=_0x4ab49d[_0xf51c('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x58ae6f[_0xf51c('0xf')]!==_0x7d3e4b&&!_0x58ae6f[_0xf51c('0x10')]){oldToken=_0x58ae6f[_0xf51c('0xf')];}httpRequest(_0x7d3e4b)[_0xf51c('0xc')](function(_0x4a2ffd){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4a2ffd[_0xf51c('0x11')]){isOldTokenSent=![];if(!_0x58ae6f['license']&&_0x58ae6f[_0xf51c('0x7')]!=_0x4a2ffd[_0xf51c('0x7')]||_0x58ae6f[_0xf51c('0x7')]&&_0x58ae6f[_0xf51c('0x10')]){logger[_0xf51c('0x12')](_0xf51c('0x13'));}if(_0x58ae6f['license']&&!_0x58ae6f[_0xf51c('0x10')]&&_0x58ae6f[_0xf51c('0x7')]!=_0x4a2ffd[_0xf51c('0x7')]){logger[_0xf51c('0x12')](_0xf51c('0x14'));}if(_0x58ae6f[_0xf51c('0x7')]&&!_0x58ae6f[_0xf51c('0x10')]&&_0x58ae6f[_0xf51c('0x7')]==_0x4a2ffd[_0xf51c('0x7')]){return _0x4ab49d;}return _0x4ab49d[_0xf51c('0x15')]({'data1':_0x7d3e4b,'data2':null,'license':_0x4a2ffd[_0xf51c('0x7')]});}else{if(_0x4a2ffd[_0xf51c('0x7')]||_0x58ae6f[_0xf51c('0x7')]){if(!_0x58ae6f[_0xf51c('0x10')]){if(_0x58ae6f['data1']==_0x7d3e4b){GRAY_PERIOD_REASON=_0xf51c('0x16');logger[_0xf51c('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xf51c('0x17');logger[_0xf51c('0x12')](_0xf51c('0x18'),_0x58ae6f[_0xf51c('0xf')],_0x7d3e4b);}logger[_0xf51c('0x12')](_0xf51c('0x19'),GRAY_PERIOD_REASON[_0xf51c('0x1a')](),moment()['format'](_0xf51c('0x1b')));return _0x4ab49d['update']({'data2':encryptor[_0xf51c('0x1c')](moment()[_0xf51c('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xf51c('0x1d')](encryptor[_0xf51c('0x1e')](_0x58ae6f[_0xf51c('0x10')]),_0xf51c('0x1f'))>DAYS){logger['info'](_0xf51c('0x20'),moment()[_0xf51c('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4ab49d[_0xf51c('0x15')]({'data1':_0x7d3e4b,'data2':null,'license':null});}}}else{if(_0x58ae6f['data1']!=_0x7d3e4b){logger[_0xf51c('0x12')](_0xf51c('0x18'),_0x58ae6f[_0xf51c('0xf')],_0x7d3e4b);return _0x4ab49d[_0xf51c('0x15')]({'data1':_0x7d3e4b,'data2':null,'license':null});}}}return _0x4ab49d;})[_0xf51c('0xc')](function(_0x28242b){_0x4ab49d=_0x28242b;})[_0xf51c('0xd')](function(_0x4711b5){logger[_0xf51c('0x21')](_0x4711b5[_0xf51c('0x22')]);})[_0xf51c('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xf51c('0x24')](),_0x4ab49d);},TIME);});}function defaultLicense(){var _0xd82d45=hardware['getUuid']();if(_0xd82d45){return db[_0xf51c('0x25')][_0xf51c('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0xd82d45}})['spread'](function(_0x263c97,_0x590008){logger[_0xf51c('0x12')](_0xf51c('0x27'),_0xd82d45);manageLicense(_0xd82d45,_0x263c97);})['catch'](function(_0x59b3c8){logger[_0xf51c('0x21')](_0x59b3c8[_0xf51c('0x22')]);});}}exports[_0xf51c('0x28')]=defaultLicense; \ No newline at end of file +var _0x153f=['error','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s'];(function(_0x2c23c2,_0xf3874){var _0x26af60=function(_0x3f2743){while(--_0x3f2743){_0x2c23c2['push'](_0x2c23c2['shift']());}};_0x26af60(++_0xf3874);}(_0x153f,0x16e));var _0xf153=function(_0x2ad9d9,_0x4d88e2){_0x2ad9d9=_0x2ad9d9-0x0;var _0x2392a3=_0x153f[_0x2ad9d9];return _0x2392a3;};'use strict';var util=require('util');var moment=require(_0xf153('0x0'));var rp=require(_0xf153('0x1'));var BPromise=require(_0xf153('0x2'));var pkginfo=require(_0xf153('0x3'))(module,_0xf153('0x4'));var db=require(_0xf153('0x5'))['db'];var encryptor=require(_0xf153('0x6'));var hardware=require(_0xf153('0x7'));var logger=require(_0xf153('0x8'))(_0xf153('0x9'));var HOST=_0xf153('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5abc25){return new BPromise(function(_0x15fa51,_0x58d640){var _0x4bf9f2=util[_0xf153('0xb')](_0xf153('0xc'),HOST,_0x5abc25,module[_0xf153('0xd')]['version']);if(oldToken){_0x4bf9f2=util[_0xf153('0xb')](_0xf153('0xe'),HOST,_0x5abc25,module[_0xf153('0xd')][_0xf153('0x4')],oldToken);}var _0x450e69={'uri':_0x4bf9f2,'method':_0xf153('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x450e69)[_0xf153('0x10')](function(_0x8d7c00){_0x15fa51(_0x8d7c00);})[_0xf153('0x11')](function(_0x4e1a91){_0x58d640(_0x4e1a91);});});}function manageLicense(_0x515543,_0x2c1333){var _0x19242f=_0x2c1333[_0xf153('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x19242f[_0xf153('0x13')]!==_0x515543&&!_0x19242f[_0xf153('0x14')]){oldToken=_0x19242f['data1'];}httpRequest(_0x515543)['then'](function(_0x380d0c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x380d0c[_0xf153('0x15')]){isOldTokenSent=![];if(!_0x19242f['license']&&_0x19242f['license']!=_0x380d0c['license']||_0x19242f['license']&&_0x19242f['data2']){logger[_0xf153('0x16')](_0xf153('0x17'));}if(_0x19242f[_0xf153('0x9')]&&!_0x19242f['data2']&&_0x19242f['license']!=_0x380d0c[_0xf153('0x9')]){logger[_0xf153('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x19242f['license']&&!_0x19242f[_0xf153('0x14')]&&_0x19242f[_0xf153('0x9')]==_0x380d0c[_0xf153('0x9')]){return _0x2c1333;}return _0x2c1333[_0xf153('0x18')]({'data1':_0x515543,'data2':null,'license':_0x380d0c[_0xf153('0x9')]});}else{if(_0x380d0c[_0xf153('0x9')]||_0x19242f[_0xf153('0x9')]){if(!_0x19242f[_0xf153('0x14')]){if(_0x19242f[_0xf153('0x13')]==_0x515543){GRAY_PERIOD_REASON=_0xf153('0x19');logger[_0xf153('0x16')](_0xf153('0x1a'));}else{GRAY_PERIOD_REASON=_0xf153('0x1b');logger[_0xf153('0x16')](_0xf153('0x1c'),_0x19242f[_0xf153('0x13')],_0x515543);}logger[_0xf153('0x16')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xf153('0xb')](_0xf153('0x1d')));return _0x2c1333[_0xf153('0x18')]({'data2':encryptor[_0xf153('0x1e')](moment()['format'](_0xf153('0x1d')))});}else{if(moment()[_0xf153('0x1f')](encryptor['decryptString'](_0x19242f[_0xf153('0x14')]),_0xf153('0x20'))>DAYS){logger[_0xf153('0x16')](_0xf153('0x21'),moment()[_0xf153('0xb')](_0xf153('0x1d')));isOldTokenSent=![];return _0x2c1333[_0xf153('0x18')]({'data1':_0x515543,'data2':null,'license':null});}}}else{if(_0x19242f['data1']!=_0x515543){logger['info'](_0xf153('0x1c'),_0x19242f['data1'],_0x515543);return _0x2c1333[_0xf153('0x18')]({'data1':_0x515543,'data2':null,'license':null});}}}return _0x2c1333;})[_0xf153('0x10')](function(_0x379edf){_0x2c1333=_0x379edf;})['catch'](function(_0x432f98){logger[_0xf153('0x22')](_0x432f98[_0xf153('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xf153('0x24')](),_0x2c1333);},TIME);});}function defaultLicense(){var _0x43c8b5=hardware[_0xf153('0x24')]();if(_0x43c8b5){return db[_0xf153('0x25')][_0xf153('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x43c8b5}})['spread'](function(_0x499ed3,_0x160c9c){logger[_0xf153('0x16')](_0xf153('0x27'),_0x43c8b5);manageLicense(_0x43c8b5,_0x499ed3);})[_0xf153('0x11')](function(_0xa2a4ba){logger[_0xf153('0x22')](_0xa2a4ba[_0xf153('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 991bbb9..0d54190 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 _0x3cc8=['License','find','defaults','then','catch','uuid','license','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','parse','demo','gray','deadline','add','days','format','grayReason','machineUuid','disabled','message','User','findAll','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','role','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license'];(function(_0x379ee5,_0x336c42){var _0x114694=function(_0x55b2f5){while(--_0x55b2f5){_0x379ee5['push'](_0x379ee5['shift']());}};_0x114694(++_0x336c42);}(_0x3cc8,0xef));var _0x83cc=function(_0x2ea5b0,_0x29bf0a){_0x2ea5b0=_0x2ea5b0-0x0;var _0x16671e=_0x3cc8[_0x2ea5b0];return _0x16671e;};'use strict';var util=require(_0x83cc('0x0'));var _=require(_0x83cc('0x1'));var moment=require(_0x83cc('0x2'));var BPromise=require(_0x83cc('0x3'));var hardware=require(_0x83cc('0x4'));var encryptor=require(_0x83cc('0x5'));var db=require(_0x83cc('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x83cc('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x83cc('0x8'),'machineUuid':hardware[_0x83cc('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x83cc('0xa'),'machineUuid':hardware[_0x83cc('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x15e9ce){return new BPromise(function(_0x470d5f,_0x2a6b9b){return db[_0x83cc('0xb')][_0x83cc('0xc')](_[_0x83cc('0xd')](_0x15e9ce,{'raw':!![],'where':{'id':0x1}}))[_0x83cc('0xe')](function(_0x2ce1af){return checkLicense(_0x2ce1af,null);})[_0x83cc('0xe')](function(_0xd86df){_0x470d5f(_0xd86df);return;})[_0x83cc('0xf')](function(_0xc374d7){_0x2a6b9b(_0xc374d7);});});}function checkLicense(_0x171197,_0x202d73){if(!_0x171197){demoLicense[_0x83cc('0x10')]=_0x171197['data1'];return demoLicense;}try{var _0x264813=_0x202d73||_0x171197[_0x83cc('0x11')];if(_['isEmpty'](_0x264813)){throw new Error(_0x83cc('0x12'));}var _0x356ad2=_0x171197[_0x83cc('0x13')];var _0x4ff922=_0x171197[_0x83cc('0x14')];var _0xe88ea9=_0x356ad2[_0x83cc('0x15')]('-')[0x4];var _0x50c5cb=_0x356ad2[_0x83cc('0x15')]('-')[0x0];var _0x4645a1=encryptor[_0x83cc('0x16')](_0x264813,util['format']('%s:%s:%s',_0xe88ea9,_0x356ad2,_0x50c5cb));var _0x4d561e=JSON[_0x83cc('0x17')](_0x4645a1);_0x4d561e[_0x83cc('0x18')]=![];_0x4d561e[_0x83cc('0x10')]=_0x356ad2;_0x4d561e['machineUuid']=hardware[_0x83cc('0x9')]();if(_0x4ff922){var _0x3f3026=encryptor[_0x83cc('0x16')](_0x4ff922);_0x4d561e[_0x83cc('0x19')]=_0x3f3026;_0x4d561e[_0x83cc('0x1a')]=moment(_0x3f3026)[_0x83cc('0x1b')](0x7,_0x83cc('0x1c'))[_0x83cc('0x1d')]();_0x4d561e[_0x83cc('0x1e')]=_0x4d561e[_0x83cc('0x10')]!=_0x4d561e[_0x83cc('0x1f')]?'changed':_0x83cc('0x20');}return _0x4d561e;}catch(_0x118beb){breakingLicense[_0x83cc('0x10')]=_0x171197[_0x83cc('0x13')];breakingLicense[_0x83cc('0x21')]=_0x118beb[_0x83cc('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2b32c4,_0x141ffa){getLicense()[_0x83cc('0xe')](function(_0x15dbdb){return db[_0x83cc('0x22')][_0x83cc('0x23')]({'attributes':['role',[db[_0x83cc('0x24')]['fn'](_0x83cc('0x25'),db[_0x83cc('0x24')]['col']('role')),_0x83cc('0x26')]],'group':'role','where':{'role':{'$or':[_0x83cc('0x27'),_0x83cc('0x28'),_0x83cc('0x29')]}},'raw':!![]})[_0x83cc('0xe')](function(_0x41de43){var _0x29d6fb={'user':_0x15dbdb[_0x83cc('0x2a')]||0x0,'telephone':_0x15dbdb[_0x83cc('0x2b')]||0x0};_0x41de43[_0x83cc('0x2c')](function(_0x14f9bc){var _0x277b4a=_0x14f9bc[_0x83cc('0x2d')]===_0x83cc('0x27')?_0x83cc('0x28'):_0x14f9bc[_0x83cc('0x2d')];_0x29d6fb[_0x277b4a]-=_0x14f9bc[_0x83cc('0x26')];if(_0x29d6fb[_0x277b4a]<0x0)_0x29d6fb[_0x277b4a]=0x0;});_0x2b32c4(_0x29d6fb);return;});})[_0x83cc('0xf')](function(_0x56ef05){_0x141ffa(_0x56ef05);});});}function checkUserLimits(_0x37fa48){return new BPromise(function(_0x141a5a,_0xb36485){getLimits()['then'](function(_0x37f464){var _0x1cee46=_[_0x83cc('0x2e')](_[_0x83cc('0x2f')](_0x37fa48,'role'),[_0x83cc('0x27'),_0x83cc('0x28'),_0x83cc('0x29')]);var _0x2c081f=(_0x1cee46[_0x83cc('0x27')]||0x0)+(_0x1cee46['user']||0x0);var _0x56dbb8=_0x1cee46[_0x83cc('0x29')]||0x0;if(_0x2c081f>_0x37f464['user'])return _0xb36485('License\x20limit\x20reached\x20for\x20users');if(_0x56dbb8>_0x37f464[_0x83cc('0x29')])return _0xb36485(_0x83cc('0x30'));return _0x141a5a();})[_0x83cc('0xf')](function(_0x4371c2){_0xb36485(_0x4371c2);});});}module[_0x83cc('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7241=['2027-01-01T00:00:00.000Z','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','machineUuid','deadline','add','days','grayReason','changed','disabled','message','role','sequelize','COUNT','col','admin','user','telephone','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor'];(function(_0x42e2b6,_0x3e15f6){var _0x262389=function(_0x149a36){while(--_0x149a36){_0x42e2b6['push'](_0x42e2b6['shift']());}};_0x262389(++_0x3e15f6);}(_0x7241,0xd2));var _0x1724=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x7241[_0x32f7d7];return _0x133d09;};'use strict';var util=require(_0x1724('0x0'));var _=require(_0x1724('0x1'));var moment=require('moment');var BPromise=require(_0x1724('0x2'));var hardware=require(_0x1724('0x3'));var encryptor=require(_0x1724('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1724('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x1724('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1724('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x1724('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x489dbe){return new BPromise(function(_0x35392b,_0x5e3099){return db[_0x1724('0x7')][_0x1724('0x8')](_[_0x1724('0x9')](_0x489dbe,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x49fae0){return checkLicense(_0x49fae0,null);})[_0x1724('0xa')](function(_0x4c748c){_0x35392b(_0x4c748c);return;})[_0x1724('0xb')](function(_0x8c1ab7){_0x5e3099(_0x8c1ab7);});});}function checkLicense(_0x3c9dd5,_0x22f422){if(!_0x3c9dd5){demoLicense[_0x1724('0xc')]=_0x3c9dd5[_0x1724('0xd')];return demoLicense;}try{var _0x1fa021=_0x22f422||_0x3c9dd5[_0x1724('0xe')];if(_[_0x1724('0xf')](_0x1fa021)){throw new Error(_0x1724('0x10'));}var _0x2a2b04=_0x3c9dd5[_0x1724('0xd')];var _0x98ec50=_0x3c9dd5['data2'];var _0x3c0b82=_0x2a2b04[_0x1724('0x11')]('-')[0x4];var _0x37769c=_0x2a2b04[_0x1724('0x11')]('-')[0x0];var _0x51004d=encryptor[_0x1724('0x12')](_0x1fa021,util[_0x1724('0x13')]('%s:%s:%s',_0x3c0b82,_0x2a2b04,_0x37769c));var _0x22a36a=JSON[_0x1724('0x14')](_0x51004d);_0x22a36a['demo']=![];_0x22a36a[_0x1724('0xc')]=_0x2a2b04;_0x22a36a[_0x1724('0x15')]=hardware[_0x1724('0x6')]();if(_0x98ec50){var _0xe08d76=encryptor[_0x1724('0x12')](_0x98ec50);_0x22a36a['gray']=_0xe08d76;_0x22a36a[_0x1724('0x16')]=moment(_0xe08d76)[_0x1724('0x17')](0x7,_0x1724('0x18'))['format']();_0x22a36a[_0x1724('0x19')]=_0x22a36a[_0x1724('0xc')]!=_0x22a36a[_0x1724('0x15')]?_0x1724('0x1a'):_0x1724('0x1b');}return _0x22a36a;}catch(_0xdac5b3){breakingLicense[_0x1724('0xc')]=_0x3c9dd5[_0x1724('0xd')];breakingLicense[_0x1724('0x1c')]=_0xdac5b3['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x12245b,_0x1ace08){getLicense()[_0x1724('0xa')](function(_0x305014){return db['User']['findAll']({'attributes':[_0x1724('0x1d'),[db[_0x1724('0x1e')]['fn'](_0x1724('0x1f'),db['sequelize'][_0x1724('0x20')](_0x1724('0x1d'))),'count']],'group':_0x1724('0x1d'),'where':{'role':{'$or':[_0x1724('0x21'),_0x1724('0x22'),_0x1724('0x23')]}},'raw':!![]})['then'](function(_0x60fb23){var _0x24e10f={'user':_0x305014['users']||0x0,'telephone':_0x305014['telephones']||0x0};_0x60fb23[_0x1724('0x24')](function(_0x51bbeb){var _0x39382=_0x51bbeb['role']===_0x1724('0x21')?_0x1724('0x22'):_0x51bbeb[_0x1724('0x1d')];_0x24e10f[_0x39382]-=_0x51bbeb[_0x1724('0x25')];if(_0x24e10f[_0x39382]<0x0)_0x24e10f[_0x39382]=0x0;});_0x12245b(_0x24e10f);return;});})[_0x1724('0xb')](function(_0x27e140){_0x1ace08(_0x27e140);});});}function checkUserLimits(_0x56b32){return new BPromise(function(_0x766111,_0x57276b){getLimits()[_0x1724('0xa')](function(_0x2c0084){var _0x39d2ad=_[_0x1724('0x26')](_[_0x1724('0x27')](_0x56b32,_0x1724('0x1d')),[_0x1724('0x21'),_0x1724('0x22'),_0x1724('0x23')]);var _0x39db56=(_0x39d2ad[_0x1724('0x21')]||0x0)+(_0x39d2ad[_0x1724('0x22')]||0x0);var _0x537a1c=_0x39d2ad[_0x1724('0x23')]||0x0;if(_0x39db56>_0x2c0084[_0x1724('0x22')])return _0x57276b(_0x1724('0x28'));if(_0x537a1c>_0x2c0084[_0x1724('0x23')])return _0x57276b(_0x1724('0x29'));return _0x766111();})['catch'](function(_0x193d6){_0x57276b(_0x193d6);});});}module[_0x1724('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 44d5734..6241840 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 _0x02ce=['exports','http://localhost:9000','myappanuglar-secret','secret'];(function(_0x2e030e,_0x62bebe){var _0x219b15=function(_0x1300ef){while(--_0x1300ef){_0x2e030e['push'](_0x2e030e['shift']());}};_0x219b15(++_0x62bebe);}(_0x02ce,0x1ac));var _0xe02c=function(_0x33fe2f,_0x5e2a6c){_0x33fe2f=_0x33fe2f-0x0;var _0x3e559b=_0x02ce[_0x33fe2f];return _0x3e559b;};'use strict';module[_0xe02c('0x0')]={'DOMAIN':_0xe02c('0x1'),'SESSION_SECRET':_0xe02c('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe02c('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xdd4f=['exports','secret'];(function(_0x156939,_0x4aff35){var _0x5819ab=function(_0x46e4c1){while(--_0x46e4c1){_0x156939['push'](_0x156939['shift']());}};_0x5819ab(++_0x4aff35);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x204558,_0x13061f){_0x204558=_0x204558-0x0;var _0x1eef97=_0xdd4f[_0x204558];return _0x1eef97;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2652e16..5e8e28a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7685=['exports','../utils/loggers'];(function(_0x377e63,_0xd021b7){var _0x4b65af=function(_0x260035){while(--_0x260035){_0x377e63['push'](_0x377e63['shift']());}};_0x4b65af(++_0xd021b7);}(_0x7685,0x123));var _0x5768=function(_0x236ab2,_0x2e4675){_0x236ab2=_0x236ab2-0x0;var _0x54a047=_0x7685[_0x236ab2];return _0x54a047;};'use strict';var fileLogger=require(_0x5768('0x0'))['fileLogger'];module[_0x5768('0x1')]=fileLogger; \ No newline at end of file +var _0x301d=['exports','../utils/loggers','fileLogger'];(function(_0x4cab97,_0x16de8d){var _0x4ec5db=function(_0x3914bf){while(--_0x3914bf){_0x4cab97['push'](_0x4cab97['shift']());}};_0x4ec5db(++_0x16de8d);}(_0x301d,0x9a));var _0xd301=function(_0x148d51,_0x487ad9){_0x148d51=_0x148d51-0x0;var _0x58d99e=_0x301d[_0x148d51];return _0x58d99e;};'use strict';var fileLogger=require(_0xd301('0x0'))[_0xd301('0x1')];module[_0xd301('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2f0a695..6cebe51 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 _0xcc03=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','root','legacy-libs','express','../../services/express/index.js','join','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xcc03,0x1e0));var _0x3cc0=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xcc03[_0x507403];return _0x1327c;};'use strict';var path=require(_0x3cc0('0x0'));var cfg=require(_0x3cc0('0x1'));var env={'NODE_PATH':path[_0x3cc0('0x2')](path['join'](cfg[_0x3cc0('0x3')],_0x3cc0('0x4')))};var pm2config={'apps':[{'name':_0x3cc0('0x5'),'script':path['join'](__dirname,_0x3cc0('0x6')),'env':env},{'name':'ami','script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0x8')),'env':env},{'name':'agi','script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0x9')),'env':env},{'name':_0x3cc0('0xa'),'script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0xb')),'env':env},{'name':_0x3cc0('0xc'),'script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0xd')),'env':env},{'name':_0x3cc0('0xe'),'script':path[_0x3cc0('0x7')](__dirname,_0x3cc0('0xf')),'env':env}]};module[_0x3cc0('0x10')]=pm2config; \ No newline at end of file +var _0x4efe=['resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment'];(function(_0x194313,_0x45d02b){var _0x11f6fd=function(_0x31cac5){while(--_0x31cac5){_0x194313['push'](_0x194313['shift']());}};_0x11f6fd(++_0x45d02b);}(_0x4efe,0x17e));var _0xe4ef=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0x4efe[_0x838813];return _0x2bd32d;};'use strict';var path=require(_0xe4ef('0x0'));var cfg=require(_0xe4ef('0x1'));var env={'NODE_PATH':path[_0xe4ef('0x2')](path[_0xe4ef('0x3')](cfg[_0xe4ef('0x4')],_0xe4ef('0x5')))};var pm2config={'apps':[{'name':_0xe4ef('0x6'),'script':path['join'](__dirname,_0xe4ef('0x7')),'env':env},{'name':_0xe4ef('0x8'),'script':path[_0xe4ef('0x3')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xe4ef('0x9'),'script':path[_0xe4ef('0x3')](__dirname,_0xe4ef('0xa')),'env':env},{'name':_0xe4ef('0xb'),'script':path[_0xe4ef('0x3')](__dirname,_0xe4ef('0xc')),'env':env},{'name':'routing','script':path[_0xe4ef('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xe4ef('0xd'),'script':path[_0xe4ef('0x3')](__dirname,_0xe4ef('0xe')),'env':env}]};module[_0xe4ef('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 955bd33..fc8c35a 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 _0xd601=['connected','start','then','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x5460c1,_0x33a8e1){var _0x4ba58a=function(_0x16fe89){while(--_0x16fe89){_0x5460c1['push'](_0x5460c1['shift']());}};_0x4ba58a(++_0x33a8e1);}(_0xd601,0x17e));var _0x1d60=function(_0x204b4c,_0x24a4dd){_0x204b4c=_0x204b4c-0x0;var _0x4dcb77=_0xd601[_0x204b4c];return _0x4dcb77;};'use strict';var pm2=require(_0x1d60('0x0'));var BPromise=require(_0x1d60('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x22582e,_0x87b013){return pm2['connect'](function(_0x307b64){if(_0x307b64){return _0x87b013(_0x307b64);}return _0x22582e(_0x1d60('0x2'));});});};exports[_0x1d60('0x3')]=function(_0x3b9341){return connect()[_0x1d60('0x4')](function(){return new BPromise(function(_0x585914,_0x496a2a){return pm2[_0x1d60('0x3')](_0x3b9341,function(_0x5c2b5f,_0x247b81){if(_0x5c2b5f){return _0x496a2a(_0x5c2b5f);}pm2[_0x1d60('0x5')]();return _0x585914(_0x247b81);});});});};exports['stop']=function(_0xe69be7){return connect()['then'](function(){return new BPromise(function(_0x38388e,_0x5f46e4){return pm2['stop'](_0xe69be7,function(_0x2976d2,_0x4ecb5c){if(_0x2976d2){return _0x5f46e4(_0x2976d2);}pm2[_0x1d60('0x5')]();return _0x38388e(_0x4ecb5c);});});});};exports[_0x1d60('0x6')]=function(_0x3d9600){return connect()[_0x1d60('0x4')](function(){return new BPromise(function(_0x1e86f5,_0xb0ce0){return pm2[_0x1d60('0x6')](_0x3d9600,function(_0xbcb039,_0x19f51c){if(_0xbcb039){return _0xb0ce0(_0xbcb039);}pm2[_0x1d60('0x5')]();return _0x1e86f5(_0x19f51c);});});});};exports[_0x1d60('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x59ca88,_0x38d59b){return pm2[_0x1d60('0x7')](function(_0x201892,_0x11bd7a){if(_0x201892){return _0x38d59b(_0x201892);}pm2[_0x1d60('0x5')]();return _0x59ca88(_0x11bd7a);});});});};exports['describe']=function(_0x5e454d){return connect()['then'](function(){return new BPromise(function(_0x13c667,_0x48c8f8){return pm2[_0x1d60('0x8')](_0x5e454d,function(_0xdff446,_0x193b64){if(_0xdff446){return _0x48c8f8(_0xdff446);}pm2[_0x1d60('0x5')]();return _0x13c667(_0x193b64);});});});};exports[_0x1d60('0x9')]=function(_0x2696cb){return connect()['then'](function(){return new BPromise(function(_0x26b607,_0x14b8bf){return pm2[_0x1d60('0x9')](_0x2696cb,function(_0x4cf594,_0x3339c7){if(_0x4cf594){return _0x14b8bf(_0x4cf594);}pm2[_0x1d60('0x5')]();return _0x26b607(_0x3339c7);});});});};exports[_0x1d60('0xa')]=function(){return connect()[_0x1d60('0x4')](function(){return new BPromise(function(_0x3a1317,_0x3b2b64){return pm2[_0x1d60('0xa')](function(_0x137656){if(_0x137656){return _0x3b2b64(_0x137656);}return _0x3a1317(_0x1d60('0xb'));});});});}; \ No newline at end of file +var _0xf2a4=['restart','list','describe','delete','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop'];(function(_0xc74b73,_0x1d36f0){var _0x5dc563=function(_0x4e95ef){while(--_0x4e95ef){_0xc74b73['push'](_0xc74b73['shift']());}};_0x5dc563(++_0x1d36f0);}(_0xf2a4,0xd7));var _0x4f2a=function(_0x5cf2a0,_0x375b14){_0x5cf2a0=_0x5cf2a0-0x0;var _0x2f349b=_0xf2a4[_0x5cf2a0];return _0x2f349b;};'use strict';var pm2=require(_0x4f2a('0x0'));var BPromise=require(_0x4f2a('0x1'));var config=require(_0x4f2a('0x2'));function connect(){return new BPromise(function(_0x2b39f6,_0x2fd52b){return pm2[_0x4f2a('0x3')](function(_0x5ecbde){if(_0x5ecbde){return _0x2fd52b(_0x5ecbde);}return _0x2b39f6(_0x4f2a('0x4'));});});};exports[_0x4f2a('0x5')]=function(_0x6343f){return connect()[_0x4f2a('0x6')](function(){return new BPromise(function(_0x83e8fb,_0x2c99eb){return pm2['start'](_0x6343f,function(_0x5f37bc,_0x39fb7d){if(_0x5f37bc){return _0x2c99eb(_0x5f37bc);}pm2[_0x4f2a('0x7')]();return _0x83e8fb(_0x39fb7d);});});});};exports[_0x4f2a('0x8')]=function(_0x6c2fd1){return connect()[_0x4f2a('0x6')](function(){return new BPromise(function(_0xc43168,_0x1254ee){return pm2[_0x4f2a('0x8')](_0x6c2fd1,function(_0x170e96,_0x5d6a82){if(_0x170e96){return _0x1254ee(_0x170e96);}pm2[_0x4f2a('0x7')]();return _0xc43168(_0x5d6a82);});});});};exports[_0x4f2a('0x9')]=function(_0x3b9ed1){return connect()['then'](function(){return new BPromise(function(_0x454339,_0xa7d72){return pm2['restart'](_0x3b9ed1,function(_0x260b8c,_0x1c602b){if(_0x260b8c){return _0xa7d72(_0x260b8c);}pm2[_0x4f2a('0x7')]();return _0x454339(_0x1c602b);});});});};exports[_0x4f2a('0xa')]=function(){return connect()[_0x4f2a('0x6')](function(){return new BPromise(function(_0x441ea9,_0x17e207){return pm2[_0x4f2a('0xa')](function(_0x3d92ee,_0x128fa4){if(_0x3d92ee){return _0x17e207(_0x3d92ee);}pm2[_0x4f2a('0x7')]();return _0x441ea9(_0x128fa4);});});});};exports[_0x4f2a('0xb')]=function(_0x2aac74){return connect()[_0x4f2a('0x6')](function(){return new BPromise(function(_0x7d1feb,_0x472d4d){return pm2[_0x4f2a('0xb')](_0x2aac74,function(_0x471e21,_0x354f45){if(_0x471e21){return _0x472d4d(_0x471e21);}pm2[_0x4f2a('0x7')]();return _0x7d1feb(_0x354f45);});});});};exports[_0x4f2a('0xc')]=function(_0x48d5aa){return connect()['then'](function(){return new BPromise(function(_0x3a1797,_0x5ab32f){return pm2[_0x4f2a('0xc')](_0x48d5aa,function(_0x25b98c,_0x174f5f){if(_0x25b98c){return _0x5ab32f(_0x25b98c);}pm2[_0x4f2a('0x7')]();return _0x3a1797(_0x174f5f);});});});};exports['dump']=function(){return connect()[_0x4f2a('0x6')](function(){return new BPromise(function(_0x315360,_0x419321){return pm2['dump'](function(_0x48bda9){if(_0x48bda9){return _0x419321(_0x48bda9);}return _0x315360(_0x4f2a('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 16bd75e..45ed1f2 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 _0xa8bc=['error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','then','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xa8bc,0x100));var _0xca8b=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xa8bc[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0xca8b('0x0'));var moment=require(_0xca8b('0x1'));var Redis=require(_0xca8b('0x2'));var util=require(_0xca8b('0x3'));var config=require(_0xca8b('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xca8b('0x5'))(_0xca8b('0x6'));config[_0xca8b('0x7')]=_[_0xca8b('0x8')](config['redis'],{'host':_0xca8b('0x9'),'port':0x18eb});var io=require(_0xca8b('0xa'))(new Redis(config[_0xca8b('0x7')]));function closeInteractions(){var _0x1e3372=0x0;var _0x5332c7=[];return db[_0xca8b('0xb')][_0xca8b('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x15b626){_0x1e3372=_0x15b626[_0xca8b('0xd')];if(_0x1e3372){return db[_0xca8b('0xe')][_0xca8b('0xf')]({'raw':!![],'attributes':['id',_0xca8b('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xca8b('0x11')](_0x15b626[_0xca8b('0xd')],'minutes')}}});}else{return[];}})[_0xca8b('0x12')](function(_0x9806a8){if(_0x9806a8&&_0x9806a8['length']){_0x5332c7=_[_0xca8b('0x13')](_0x9806a8||[],'id');logger['info'](_0xca8b('0x14'),_0x5332c7[_0xca8b('0x15')]());return db[_0xca8b('0xe')]['update']({'closeReason':_0xca8b('0x16'),'disposition':_0xca8b('0x17'),'closed':!![],'closedAt':moment()[_0xca8b('0x18')](_0xca8b('0x19'))},{'where':{'id':_0x5332c7}});}})['then'](function(){if(_0x5332c7&&_0x5332c7[_0xca8b('0x1a')]){logger[_0xca8b('0x1b')](_0xca8b('0x1c'),_0x5332c7['join']());for(var _0x393f73=0x0;_0x393f73<_0x5332c7[_0xca8b('0x1a')];_0x393f73++){io[_0xca8b('0x1d')](_0xca8b('0x1e'),{'id':_0x5332c7[_0x393f73],'closed':!![]});}}})[_0xca8b('0x1f')](function(_0x588391){logger[_0xca8b('0x20')](_0xca8b('0x21'),_0x588391?util[_0xca8b('0x22')](_0x588391,{'showHidden':![],'depth':null}):'');});}exports[_0xca8b('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x90ec=['timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','localhost','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','length','info','update','system'];(function(_0x34ac0a,_0x4b1892){var _0x327d5a=function(_0x1b9b50){while(--_0x1b9b50){_0x34ac0a['push'](_0x34ac0a['shift']());}};_0x327d5a(++_0x4b1892);}(_0x90ec,0xe8));var _0xc90e=function(_0x272ad4,_0x2cc2b9){_0x272ad4=_0x272ad4-0x0;var _0x227fbb=_0x90ec[_0x272ad4];return _0x227fbb;};'use strict';var _=require(_0xc90e('0x0'));var moment=require(_0xc90e('0x1'));var Redis=require(_0xc90e('0x2'));var util=require(_0xc90e('0x3'));var config=require(_0xc90e('0x4'));var db=require(_0xc90e('0x5'))['db'];var logger=require('../logger')('schedule');config['redis']=_['defaults'](config[_0xc90e('0x6')],{'host':_0xc90e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc90e('0x6')]));function closeInteractions(){var _0x55b2b4=0x0;var _0x143f84=[];return db[_0xc90e('0x8')][_0xc90e('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xc90e('0xa')](function(_0x40d0a5){_0x55b2b4=_0x40d0a5[_0xc90e('0xb')];if(_0x55b2b4){return db[_0xc90e('0xc')][_0xc90e('0xd')]({'raw':!![],'attributes':['id',_0xc90e('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x40d0a5['chatTimeout'],_0xc90e('0xf'))}}});}else{return[];}})['then'](function(_0x4222ea){if(_0x4222ea&&_0x4222ea[_0xc90e('0x10')]){_0x143f84=_['map'](_0x4222ea||[],'id');logger[_0xc90e('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x143f84['join']());return db[_0xc90e('0xc')][_0xc90e('0x12')]({'closeReason':_0xc90e('0x13'),'disposition':_0xc90e('0x14'),'closed':!![],'closedAt':moment()[_0xc90e('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x143f84}});}})['then'](function(){if(_0x143f84&&_0x143f84['length']){logger[_0xc90e('0x11')](_0xc90e('0x16'),_0x143f84[_0xc90e('0x17')]());for(var _0x4a723d=0x0;_0x4a723d<_0x143f84['length'];_0x4a723d++){io[_0xc90e('0x18')]('chatInteraction:update',{'id':_0x143f84[_0x4a723d],'closed':!![]});}}})['catch'](function(_0x1d67bb){logger[_0xc90e('0x19')](_0xc90e('0x1a'),_0x1d67bb?util['inspect'](_0x1d67bb,{'showHidden':![],'depth':null}):'');});}exports[_0xc90e('0x1b')]=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 e362fa2..1559e83 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 _0x3646=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x2ddef8,_0x2675a4){var _0x38745d=function(_0x2d1f25){while(--_0x2d1f25){_0x2ddef8['push'](_0x2ddef8['shift']());}};_0x38745d(++_0x2675a4);}(_0x3646,0x7e));var _0x6364=function(_0xab992a,_0x5c91f2){_0xab992a=_0xab992a-0x0;var _0x358cfe=_0x3646[_0xab992a];return _0x358cfe;};'use strict';function start(){var _0x1eb3c7=require(_0x6364('0x0'));return _0x1eb3c7[_0x6364('0x1')]();}module[_0x6364('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x045b=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x045b,0x14f));var _0xb045=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0x045b[_0x591a90];return _0x551587;};'use strict';function start(){var _0xf01f38=require(_0xb045('0x0'));return _0xf01f38[_0xb045('0x1')]();}module[_0xb045('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 60c4ef0..effeb14 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 _0xfd4d=['exists','deleteJob','stop\x20cron','active','startAt','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','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','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','length','stop','delete\x20cron','index','my\x20id','resolve','cron','isBetween','endAt','add','start','add\x20cron'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xfd4d,0x167));var _0xdfd4=function(_0x224a98,_0x7d4589){_0x224a98=_0x224a98-0x0;var _0x462ed6=_0xfd4d[_0x224a98];return _0x462ed6;};'use strict';var fs=require('fs');var util=require(_0xdfd4('0x0'));var path=require(_0xdfd4('0x1'));var _=require(_0xdfd4('0x2'));var moment=require(_0xdfd4('0x3'));var CronJobManager=require(_0xdfd4('0x4'));var jayson=require(_0xdfd4('0x5'));var BPromise=require(_0xdfd4('0x6'));var logger=require('../logger')(_0xdfd4('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xdfd4('0x8'));var analyticDefaultReportController=require(_0xdfd4('0x9'));var client=jayson[_0xdfd4('0xa')][_0xdfd4('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x7ab167,_0x433d15){return function(){logger[_0xdfd4('0xc')](_0xdfd4('0xd'),_0x7ab167[_0xdfd4('0xe')]);var _0x16d7df=!![];var _0x3119ab=_0x7ab167['MailAccount'][_0xdfd4('0xf')]();var _0x5cd43b={'account':_0x3119ab,'message':{'from':util[_0xdfd4('0x10')]('\x22%s\x22\x20<%s>',_0x7ab167[_0xdfd4('0x11')][_0xdfd4('0x12')],_0x7ab167[_0xdfd4('0x11')][_0xdfd4('0xe')]||_0x7ab167[_0xdfd4('0x11')][_0xdfd4('0x13')][_0xdfd4('0x14')]),'to':_0x7ab167[_0xdfd4('0xe')],'cc':_0x7ab167['cc'],'bcc':_0x7ab167[_0xdfd4('0x15')],'subject':util[_0xdfd4('0x10')](_0xdfd4('0x16'),_0x433d15['name'],_0x7ab167['subtractNumber'],_0x7ab167[_0xdfd4('0x17')])}};var _0x36f99d=path[_0xdfd4('0x18')](__dirname,_0xdfd4('0x19'));var _0x52fedb=_0x433d15[_0xdfd4('0x1a')];var _0x4dde09=util[_0xdfd4('0x10')](_0xdfd4('0x1b'),path[_0xdfd4('0x1c')](_0x433d15['savename'],path[_0xdfd4('0x1d')](_0x433d15[_0xdfd4('0x1a')])),_0xdfd4('0x1e'));var _0x1591c7=path[_0xdfd4('0x18')](_0x36f99d,_0x52fedb);var _0xa2735d=path[_0xdfd4('0x18')](_0x36f99d,_0x4dde09);if(fs[_0xdfd4('0x1f')](_0x1591c7)){_0x433d15['status']=_0xdfd4('0x20');_0x5cd43b[_0xdfd4('0x21')][_0xdfd4('0x22')]=[{'filename':_0x52fedb,'path':_0x1591c7}];_0x5cd43b[_0xdfd4('0x21')][_0xdfd4('0x23')]=util['format'](_0xdfd4('0x24'),JSON[_0xdfd4('0x25')](_0x433d15,null,0x2));}else if(fs[_0xdfd4('0x1f')](_0xa2735d)){_0x433d15[_0xdfd4('0x26')]=_0xdfd4('0x20');_0x5cd43b[_0xdfd4('0x21')][_0xdfd4('0x22')]=[{'filename':_0x4dde09,'path':_0xa2735d}];}else{_0x5cd43b[_0xdfd4('0x21')]['text']=_0xdfd4('0x27');if(!_0x7ab167[_0xdfd4('0x28')]){_0x16d7df=![];logger[_0xdfd4('0xc')](_0xdfd4('0x29'));}}if(_0x16d7df){return client[_0xdfd4('0x2a')]('SendMail',_0x5cd43b)[_0xdfd4('0x2b')](function(_0x2566a0){if(_0x2566a0[_0xdfd4('0x2c')]){return logger[_0xdfd4('0x2c')](_0xdfd4('0x2d'),JSON[_0xdfd4('0x25')](_0x2566a0));}return logger['info'](_0xdfd4('0x2e'));})[_0xdfd4('0x2f')](function(_0x2d3dc2){return logger[_0xdfd4('0x2c')]('error\x20mail',JSON[_0xdfd4('0x25')](_0x2d3dc2));});}};}function handleError(){return function(_0xe77280){return logger[_0xdfd4('0x2c')](JSON[_0xdfd4('0x25')](_0xe77280));};}function handleResult(_0x4af4ba){return function(_0x4ec36c){logger[_0xdfd4('0xc')](_0xdfd4('0x30'),JSON['stringify'](_0x4ec36c));if(_0x4af4ba[_0xdfd4('0x11')]&&_0x4af4ba['MailAccount'][_0xdfd4('0x13')]&&!_[_0xdfd4('0x31')](_0x4af4ba[_0xdfd4('0xe')])){setTimeout(handleSendEmail(_0x4af4ba,_0x4ec36c),0x3c*0x3e8);}};}function handleJob(_0x45e45f){return function(){try{if(_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x32')])){return logger['info'](_0xdfd4('0x33'));}if(_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x17')])){return logger['info'](_0xdfd4('0x34'));}var _0x4602b8={'startDate':moment()[_0xdfd4('0x35')](_0x45e45f['subtractNumber'],_0x45e45f[_0xdfd4('0x17')])['format'](_0xdfd4('0x36')),'endDate':moment()[_0xdfd4('0x10')](_0xdfd4('0x36')),'type':'scheduled','output':_0x45e45f['output'],'name':_0x45e45f[_0xdfd4('0x12')]};if(!_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x37')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x45e45f[_0xdfd4('0x37')]);return analyticDefaultReportController[_0xdfd4('0x38')]({'id':_0x45e45f[_0xdfd4('0x37')]},_0x4602b8)['then'](handleResult(_0x45e45f))['catch'](handleError());}if(!_[_0xdfd4('0x31')](_0x45e45f[_0xdfd4('0x39')])){logger['info'](_0xdfd4('0x3a'),_0x45e45f[_0xdfd4('0x39')]);return analyticCustomReportController[_0xdfd4('0x38')]({'id':_0x45e45f['CustomReportId']},_0x4602b8)[_0xdfd4('0x2b')](handleResult(_0x45e45f))[_0xdfd4('0x2f')](handleError());}}catch(_0x4fde2d){logger[_0xdfd4('0x2c')](JSON[_0xdfd4('0x25')](_0x4fde2d));}return logger[_0xdfd4('0xc')](_0xdfd4('0x3b'));};}function getJobs(_0x2a134a){var _0x4c5221={};if(_0x2a134a){_0x4c5221['id']=_0x2a134a;}return db[_0xdfd4('0x3c')][_0xdfd4('0x3d')]({'where':_0x4c5221,'include':[{'model':db[_0xdfd4('0x11')],'attributes':['id',_0xdfd4('0x12'),_0xdfd4('0xe')],'include':[{'model':db[_0xdfd4('0x3e')],'as':'Smtp','include':[{'model':db[_0xdfd4('0x3f')],'as':_0xdfd4('0x3f')}]}]}]})[_0xdfd4('0x2b')](function(_0x344947){var _0x20cf09=_[_0xdfd4('0x40')](manager[_0xdfd4('0x41')]);var _0x3cb605=_['map'](_0x344947,function(_0x38ff8c){return _0x38ff8c['id'][_0xdfd4('0x42')]();});var _0x5a3c0a=_[_0xdfd4('0x43')](_0x344947,function(_0x58da98){return _0x58da98['id']['toString']();});var _0x41396a=_0x2a134a?_0x3cb605:_[_0xdfd4('0x44')](_0x3cb605,_0x20cf09);var _0x38dd08=_['intersection'](_0x3cb605,_0x20cf09);var _0x52bfb2=_['difference'](_0x20cf09,_0x3cb605);var _0x4b28d7;var _0x570289;for(_0x4b28d7=0x0;_0x4b28d7<_0x52bfb2[_0xdfd4('0x45')]&&!_0x2a134a;_0x4b28d7+=0x1){_0x570289=_0x52bfb2[_0x4b28d7]['toString']();if(manager['exists'](_0x570289)){manager[_0xdfd4('0x46')](_0x570289);manager['deleteJob'](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x47'),_0x570289);}}logger[_0xdfd4('0xc')]('toRun',JSON['stringify'](_0x41396a));for(_0x4b28d7=0x0;_0x4b28d7<_0x41396a[_0xdfd4('0x45')];_0x4b28d7+=0x1){_0x570289=_0x41396a[_0x4b28d7][_0xdfd4('0x42')]();logger['info'](_0xdfd4('0x48'),_0x570289);if(_0x2a134a){logger[_0xdfd4('0xc')](_0xdfd4('0x49'),_0x2a134a);logger[_0xdfd4('0xc')](JSON[_0xdfd4('0x25')](_0x5a3c0a[_0x570289]));BPromise[_0xdfd4('0x4a')]()[_0xdfd4('0x2b')](handleJob(_0x5a3c0a[_0x570289]));logger['info']('run\x20job',_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}else if(_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]&&_0x5a3c0a[_0x570289]['active']&&moment()[_0xdfd4('0x4c')](_0x5a3c0a[_0x570289]['startAt'],_0x5a3c0a[_0x570289][_0xdfd4('0x4d')])){manager[_0xdfd4('0x4e')](_0x570289,_0x5a3c0a[_0x570289][_0xdfd4('0x4b')],handleJob(_0x5a3c0a[_0x570289]));manager[_0xdfd4('0x4f')](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x50'),_0x5a3c0a[_0x570289]['name'],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}else if(manager[_0xdfd4('0x51')](_0x570289)){manager[_0xdfd4('0x46')](_0x570289);manager[_0xdfd4('0x52')](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x53'),_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}}for(_0x4b28d7=0x0,_0x570289;_0x4b28d7<_0x38dd08['length']&&!_0x2a134a;_0x4b28d7+=0x1){_0x570289=_0x38dd08[_0x4b28d7]['toString']();if(manager[_0xdfd4('0x51')](_0x570289)){if(_0x5a3c0a[_0x570289]['cron']&&_0x5a3c0a[_0x570289][_0xdfd4('0x54')]&&moment()[_0xdfd4('0x4c')](_0x5a3c0a[_0x570289][_0xdfd4('0x55')],_0x5a3c0a[_0x570289]['endAt'])){manager['update'](_0x570289,_0x5a3c0a[_0x570289][_0xdfd4('0x4b')],handleJob(_0x5a3c0a[_0x570289]));logger[_0xdfd4('0xc')](_0xdfd4('0x56'),_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}else{manager['stop'](_0x570289);manager['deleteJob'](_0x570289);logger[_0xdfd4('0xc')](_0xdfd4('0x53'),_0x5a3c0a[_0x570289][_0xdfd4('0x12')],_0x5a3c0a[_0x570289][_0xdfd4('0x4b')]);}}}})['catch'](function(_0x1b749d){logger[_0xdfd4('0x2c')](JSON['stringify'](_0x1b749d));});}exports[_0xdfd4('0x57')]=function(_0xa507a3){return getJobs(_0xa507a3);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x23d5=['stop\x20cron','exists','startAt','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','getSmtpOptions','format','MailAccount','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','map','keyBy','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add'];(function(_0x1e0478,_0x1554d9){var _0x49fcb4=function(_0x557ff4){while(--_0x557ff4){_0x1e0478['push'](_0x1e0478['shift']());}};_0x49fcb4(++_0x1554d9);}(_0x23d5,0xab));var _0x523d=function(_0x5010f5,_0x390b7b){_0x5010f5=_0x5010f5-0x0;var _0x332d02=_0x23d5[_0x5010f5];return _0x332d02;};'use strict';var fs=require('fs');var util=require(_0x523d('0x0'));var path=require(_0x523d('0x1'));var _=require(_0x523d('0x2'));var moment=require(_0x523d('0x3'));var CronJobManager=require(_0x523d('0x4'));var jayson=require(_0x523d('0x5'));var BPromise=require(_0x523d('0x6'));var logger=require('../logger')('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x523d('0x7'));var analyticDefaultReportController=require(_0x523d('0x8'));var client=jayson[_0x523d('0x9')][_0x523d('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x10190f,_0x2926b4){return function(){logger[_0x523d('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x10190f[_0x523d('0xc')]);var _0x13e35d=!![];var _0x1684e2=_0x10190f['MailAccount'][_0x523d('0xd')]();var _0x59eb41={'account':_0x1684e2,'message':{'from':util[_0x523d('0xe')]('\x22%s\x22\x20<%s>',_0x10190f[_0x523d('0xf')]['name'],_0x10190f[_0x523d('0xf')][_0x523d('0xc')]||_0x10190f[_0x523d('0xf')][_0x523d('0x10')][_0x523d('0x11')]),'to':_0x10190f[_0x523d('0xc')],'cc':_0x10190f['cc'],'bcc':_0x10190f[_0x523d('0x12')],'subject':util[_0x523d('0xe')](_0x523d('0x13'),_0x2926b4[_0x523d('0x14')],_0x10190f[_0x523d('0x15')],_0x10190f['subtractUnit'])}};var _0x544537=path[_0x523d('0x16')](__dirname,_0x523d('0x17'));var _0x453662=_0x2926b4[_0x523d('0x18')];var _0x40be0f=util['format'](_0x523d('0x19'),path[_0x523d('0x1a')](_0x2926b4['savename'],path[_0x523d('0x1b')](_0x2926b4['savename'])),'zip');var _0x42b703=path[_0x523d('0x16')](_0x544537,_0x453662);var _0x31da63=path[_0x523d('0x16')](_0x544537,_0x40be0f);if(fs[_0x523d('0x1c')](_0x42b703)){_0x2926b4['status']='Sent';_0x59eb41[_0x523d('0x1d')]['attachments']=[{'filename':_0x453662,'path':_0x42b703}];_0x59eb41[_0x523d('0x1d')][_0x523d('0x1e')]=util[_0x523d('0xe')](_0x523d('0x1f'),JSON[_0x523d('0x20')](_0x2926b4,null,0x2));}else if(fs[_0x523d('0x1c')](_0x31da63)){_0x2926b4[_0x523d('0x21')]=_0x523d('0x22');_0x59eb41[_0x523d('0x1d')]['attachments']=[{'filename':_0x40be0f,'path':_0x31da63}];}else{_0x59eb41[_0x523d('0x1d')][_0x523d('0x1e')]=_0x523d('0x23');if(!_0x10190f[_0x523d('0x24')]){_0x13e35d=![];logger['info'](_0x523d('0x25'));}}if(_0x13e35d){return client[_0x523d('0x26')](_0x523d('0x27'),_0x59eb41)[_0x523d('0x28')](function(_0x532bc3){if(_0x532bc3[_0x523d('0x29')]){return logger['error']('error\x20mail',JSON[_0x523d('0x20')](_0x532bc3));}return logger['info'](_0x523d('0x2a'));})[_0x523d('0x2b')](function(_0x3061bf){return logger[_0x523d('0x29')](_0x523d('0x2c'),JSON['stringify'](_0x3061bf));});}};}function handleError(){return function(_0x202678){return logger[_0x523d('0x29')](JSON[_0x523d('0x20')](_0x202678));};}function handleResult(_0x23a127){return function(_0x4aaa34){logger['info'](_0x523d('0x2d'),JSON[_0x523d('0x20')](_0x4aaa34));if(_0x23a127[_0x523d('0xf')]&&_0x23a127[_0x523d('0xf')][_0x523d('0x10')]&&!_[_0x523d('0x2e')](_0x23a127[_0x523d('0xc')])){setTimeout(handleSendEmail(_0x23a127,_0x4aaa34),0x3c*0x3e8);}};}function handleJob(_0x3a25ea){return function(){try{if(_['isNil'](_0x3a25ea[_0x523d('0x15')])){return logger[_0x523d('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x3a25ea['subtractUnit'])){return logger['info'](_0x523d('0x2f'));}var _0x144ea8={'startDate':moment()[_0x523d('0x30')](_0x3a25ea[_0x523d('0x15')],_0x3a25ea[_0x523d('0x31')])['format'](_0x523d('0x32')),'endDate':moment()[_0x523d('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x3a25ea[_0x523d('0x33')],'name':_0x3a25ea[_0x523d('0x14')]};if(!_[_0x523d('0x2e')](_0x3a25ea[_0x523d('0x34')])){logger['info'](_0x523d('0x35'),_0x3a25ea[_0x523d('0x34')]);return analyticDefaultReportController[_0x523d('0x36')]({'id':_0x3a25ea[_0x523d('0x34')]},_0x144ea8)[_0x523d('0x28')](handleResult(_0x3a25ea))[_0x523d('0x2b')](handleError());}if(!_[_0x523d('0x2e')](_0x3a25ea[_0x523d('0x37')])){logger[_0x523d('0xb')]('exec\x20custom\x20report\x20id:%s',_0x3a25ea[_0x523d('0x37')]);return analyticCustomReportController[_0x523d('0x36')]({'id':_0x3a25ea[_0x523d('0x37')]},_0x144ea8)[_0x523d('0x28')](handleResult(_0x3a25ea))[_0x523d('0x2b')](handleError());}}catch(_0x1f62f1){logger['error'](JSON[_0x523d('0x20')](_0x1f62f1));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x4a4a69){var _0xc30d93={};if(_0x4a4a69){_0xc30d93['id']=_0x4a4a69;}return db[_0x523d('0x38')][_0x523d('0x39')]({'where':_0xc30d93,'include':[{'model':db['MailAccount'],'attributes':['id',_0x523d('0x14'),_0x523d('0xc')],'include':[{'model':db[_0x523d('0x3a')],'as':'Smtp','include':[{'model':db[_0x523d('0x3b')],'as':'CloudProvider'}]}]}]})[_0x523d('0x28')](function(_0x564126){var _0x3d01d4=_[_0x523d('0x3c')](manager['jobs']);var _0x5d52d1=_[_0x523d('0x3d')](_0x564126,function(_0x341fc5){return _0x341fc5['id']['toString']();});var _0x4d5f59=_[_0x523d('0x3e')](_0x564126,function(_0x1e24d9){return _0x1e24d9['id'][_0x523d('0x3f')]();});var _0x392fe2=_0x4a4a69?_0x5d52d1:_[_0x523d('0x40')](_0x5d52d1,_0x3d01d4);var _0x30ecde=_[_0x523d('0x41')](_0x5d52d1,_0x3d01d4);var _0x1d3ef0=_[_0x523d('0x40')](_0x3d01d4,_0x5d52d1);var _0x31b588;var _0x414d23;for(_0x31b588=0x0;_0x31b588<_0x1d3ef0[_0x523d('0x42')]&&!_0x4a4a69;_0x31b588+=0x1){_0x414d23=_0x1d3ef0[_0x31b588][_0x523d('0x3f')]();if(manager['exists'](_0x414d23)){manager[_0x523d('0x43')](_0x414d23);manager[_0x523d('0x44')](_0x414d23);logger[_0x523d('0xb')](_0x523d('0x45'),_0x414d23);}}logger[_0x523d('0xb')]('toRun',JSON[_0x523d('0x20')](_0x392fe2));for(_0x31b588=0x0;_0x31b588<_0x392fe2[_0x523d('0x42')];_0x31b588+=0x1){_0x414d23=_0x392fe2[_0x31b588][_0x523d('0x3f')]();logger[_0x523d('0xb')](_0x523d('0x46'),_0x414d23);if(_0x4a4a69){logger[_0x523d('0xb')](_0x523d('0x47'),_0x4a4a69);logger[_0x523d('0xb')](JSON[_0x523d('0x20')](_0x4d5f59[_0x414d23]));BPromise[_0x523d('0x48')]()[_0x523d('0x28')](handleJob(_0x4d5f59[_0x414d23]));logger[_0x523d('0xb')](_0x523d('0x49'),_0x4d5f59[_0x414d23][_0x523d('0x14')],_0x4d5f59[_0x414d23][_0x523d('0x4a')]);}else if(_0x4d5f59[_0x414d23][_0x523d('0x4a')]&&_0x4d5f59[_0x414d23]['active']&&moment()[_0x523d('0x4b')](_0x4d5f59[_0x414d23]['startAt'],_0x4d5f59[_0x414d23][_0x523d('0x4c')])){manager[_0x523d('0x4d')](_0x414d23,_0x4d5f59[_0x414d23]['cron'],handleJob(_0x4d5f59[_0x414d23]));manager['start'](_0x414d23);logger[_0x523d('0xb')]('add\x20cron',_0x4d5f59[_0x414d23]['name'],_0x4d5f59[_0x414d23][_0x523d('0x4a')]);}else if(manager['exists'](_0x414d23)){manager[_0x523d('0x43')](_0x414d23);manager[_0x523d('0x44')](_0x414d23);logger['info'](_0x523d('0x4e'),_0x4d5f59[_0x414d23][_0x523d('0x14')],_0x4d5f59[_0x414d23][_0x523d('0x4a')]);}}for(_0x31b588=0x0,_0x414d23;_0x31b588<_0x30ecde[_0x523d('0x42')]&&!_0x4a4a69;_0x31b588+=0x1){_0x414d23=_0x30ecde[_0x31b588][_0x523d('0x3f')]();if(manager[_0x523d('0x4f')](_0x414d23)){if(_0x4d5f59[_0x414d23][_0x523d('0x4a')]&&_0x4d5f59[_0x414d23]['active']&&moment()[_0x523d('0x4b')](_0x4d5f59[_0x414d23][_0x523d('0x50')],_0x4d5f59[_0x414d23]['endAt'])){manager['update'](_0x414d23,_0x4d5f59[_0x414d23][_0x523d('0x4a')],handleJob(_0x4d5f59[_0x414d23]));logger[_0x523d('0xb')](_0x523d('0x51'),_0x4d5f59[_0x414d23][_0x523d('0x14')],_0x4d5f59[_0x414d23][_0x523d('0x4a')]);}else{manager['stop'](_0x414d23);manager['deleteJob'](_0x414d23);logger['info']('stop\x20cron',_0x4d5f59[_0x414d23][_0x523d('0x14')],_0x4d5f59[_0x414d23][_0x523d('0x4a')]);}}}})[_0x523d('0x2b')](function(_0x29e545){logger[_0x523d('0x29')](JSON[_0x523d('0x20')](_0x29e545));});}exports[_0x523d('0x52')]=function(_0x30ec18){return getJobs(_0x30ec18);};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 bca39d0..c035716 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 _0x1df7=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','all','catch','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1df7,0x6e));var _0x71df=function(_0x4585c8,_0xe158ee){_0x4585c8=_0x4585c8-0x0;var _0x50d4dc=_0x1df7[_0x4585c8];return _0x50d4dc;};var _=require('lodash');var AWS=require(_0x71df('0x0'));var rp=require(_0x71df('0x1'));var util=require(_0x71df('0x2'));var BPromise=require(_0x71df('0x3'));var db=require(_0x71df('0x4'))['db'];var logger=require(_0x71df('0x5'))(_0x71df('0x6'));function getTranscriptionJob(_0x3e3a06,_0x20c662,_0x2b8342,_0x343763){return new Promise(function(_0x4364ea,_0x481a2f){var _0x2fe258=new AWS['TranscribeService']({'accessKeyId':_0x20c662,'secretAccessKey':_0x3e3a06,'region':_0x2b8342});_0x2fe258[_0x71df('0x7')]({'TranscriptionJobName':_0x343763},function(_0x88acfd,_0x4a21c4){if(_0x88acfd){return _0x481a2f(_0x88acfd);}else{return _0x4364ea(_0x4a21c4);}});});}function sentiment(_0x32f8cd,_0x4a4575,_0x3cb3be,_0x58b68c,_0x50c892){return new Promise(function(_0x23bc36,_0x3515f5){var _0x6fa316=new AWS['Comprehend']({'accessKeyId':_0x4a4575,'secretAccessKey':_0x32f8cd,'region':_0x3cb3be});_0x6fa316[_0x71df('0x8')]({'Text':_0x58b68c,'LanguageCode':_0x50c892[_0x71df('0x9')](0x0,0x2)},function(_0x4aacdc,_0x2dbd3e){if(_0x4aacdc){return _0x3515f5(_0x4aacdc);}else{return _0x23bc36(_0x2dbd3e);}});});}function checkTranscribeJob(_0x349233,_0xca1e85,_0x5d5776){var _0x50de5b;return new BPromise(function(_0x43cae3,_0x1374cc){logger['info'](util[_0x71df('0xa')](_0x71df('0xb'),_0x349233['id'],_0x349233[_0x71df('0xc')]));return getTranscriptionJob(_0x5d5776[_0x71df('0xd')],_0x5d5776[_0x71df('0xe')],_0xca1e85[_0x71df('0xf')],_0x349233[_0x71df('0xc')])[_0x71df('0x10')](function(_0x20e521){logger[_0x71df('0x11')](util[_0x71df('0xa')](_0x71df('0x12'),_0x349233['id'],_0x349233['transcribeName'],_0x20e521[_0x71df('0x13')][_0x71df('0x14')]));if(!_0x349233[_0x71df('0x15')]){switch(_0x20e521[_0x71df('0x13')]['TranscriptionJobStatus']){case _0x71df('0x16'):var _0x414b70={'transcribeStatus':_0x20e521[_0x71df('0x13')][_0x71df('0x14')],'fileUri':_0x20e521[_0x71df('0x13')]['Transcript'][_0x71df('0x17')]};logger[_0x71df('0x11')](util[_0x71df('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x349233['id']));return rp({'uri':_0x20e521[_0x71df('0x13')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x71df('0x10')](function(_0x573738){logger['info'](util[_0x71df('0xa')](_0x71df('0x18'),_0x349233['id']));if(_0x573738&&_0x573738['results']&&_0x573738[_0x71df('0x19')][_0x71df('0x1a')]&&_0x573738['results'][_0x71df('0x1a')][_0x71df('0x1b')]){_0x414b70[_0x71df('0x15')]='';for(var _0xf59cdc=0x0;_0xf59cdc<_0x573738[_0x71df('0x19')]['transcripts'][_0x71df('0x1b')];_0xf59cdc++){_0x414b70[_0x71df('0x15')]+=_0x573738['results'][_0x71df('0x1a')][_0xf59cdc]['transcript']+'';}}return _0x349233[_0x71df('0x1c')](_0x414b70);})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x349233['id']));if(!_0x349233[_0x71df('0x1d')]){throw new db['Sequelize'][(_0x71df('0x1e'))](_0x71df('0x1f'));}if(!_0xca1e85[_0x71df('0x20')]||!_0xca1e85[_0x71df('0x21')]||!_0xca1e85[_0x71df('0x22')]||!_0xca1e85['language']||!_0xca1e85[_0x71df('0x23')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x25'));}if(!_0x414b70['fileText']){throw new Error(_0x71df('0x26'));}if(_0xca1e85['sentimentAccountId']===_0x5d5776['id']){return _0x5d5776;}else{return db[_0x71df('0x27')][_0x71df('0x28')]({'where':{'id':_settings[_0x71df('0x21')]}});}})[_0x71df('0x10')](function(_0x489fb7){if(!_0x489fb7){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x489fb7[_0x71df('0xd')]||!_0x489fb7[_0x71df('0xe')]){throw new db['Sequelize'][(_0x71df('0x1e'))](_0x71df('0x29'));}_0x50de5b=_0x489fb7;logger[_0x71df('0x11')](util[_0x71df('0xa')](_0x71df('0x2a'),_0x349233['id']));return sentiment(_0x50de5b[_0x71df('0xd')],_0x50de5b[_0x71df('0xe')],_0xca1e85[_0x71df('0x22')],_0x414b70[_0x71df('0x15')],_0xca1e85['language']);})[_0x71df('0x10')](function(_0x4c8552){logger[_0x71df('0x11')](util[_0x71df('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x349233['id']));return _0x349233[_0x71df('0x1c')]({'sentiment':_0x4c8552[_0x71df('0x2b')],'sPositive':_0x4c8552['SentimentScore']['Positive'],'sNegative':_0x4c8552[_0x71df('0x2c')][_0x71df('0x2d')],'sMixed':_0x4c8552[_0x71df('0x2c')][_0x71df('0x2e')],'sNeutral':_0x4c8552['SentimentScore'][_0x71df('0x2f')]});})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x349233['id']));_0x43cae3();});case'FAILED':return _0x349233['update']({'transcribeStatus':'FAILED','failureReason':_0x20e521[_0x71df('0x13')][_0x71df('0x30')]})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util['format'](_0x71df('0x31'),_0x349233['id']));_0x43cae3();});default:logger[_0x71df('0x11')](util[_0x71df('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x349233['id']));break;}}else{return BPromise[_0x71df('0x32')]()[_0x71df('0x10')](function(){if(!_0x349233[_0x71df('0x1d')]){throw new db[(_0x71df('0x24'))]['ValidationError'](_0x71df('0x1f'));}if(!_0xca1e85['sentiment']||!_0xca1e85[_0x71df('0x21')]||!_0xca1e85['sentimentRegion']||!_0xca1e85['language']||!_0xca1e85[_0x71df('0x23')]){throw new db[(_0x71df('0x24'))]['ValidationError'](_0x71df('0x25'));}if(!_0x349233['fileText']){throw new Error(_0x71df('0x26'));}if(_0xca1e85['sentimentAccountId']===_0x5d5776['id']){return _0x5d5776;}else{return db[_0x71df('0x27')][_0x71df('0x28')]({'where':{'id':_settings[_0x71df('0x21')]}});}})[_0x71df('0x10')](function(_0x57b975){if(!_0x57b975){throw new db['Sequelize'][(_0x71df('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x57b975[_0x71df('0xd')]||!_0x57b975[_0x71df('0xe')]){throw new db['Sequelize'][(_0x71df('0x1e'))](_0x71df('0x29'));}_0x50de5b=_0x57b975;logger['info'](util[_0x71df('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x349233['id']));return sentiment(_0x50de5b['data1'],_0x50de5b[_0x71df('0xe')],_0xca1e85[_0x71df('0x22')],_0x349233[_0x71df('0x15')],_0xca1e85[_0x71df('0x33')]);})[_0x71df('0x10')](function(_0x4e3f7b){logger[_0x71df('0x11')](util['format'](_0x71df('0x34'),_0x349233['id']));return _0x349233[_0x71df('0x1c')]({'sentiment':_0x4e3f7b[_0x71df('0x2b')],'sPositive':_0x4e3f7b[_0x71df('0x2c')][_0x71df('0x35')],'sNegative':_0x4e3f7b[_0x71df('0x2c')][_0x71df('0x2d')],'sMixed':_0x4e3f7b[_0x71df('0x2c')][_0x71df('0x2e')],'sNeutral':_0x4e3f7b[_0x71df('0x2c')]['Neutral'],'transcribeStatus':_0x71df('0x16')});})[_0x71df('0x10')](function(){logger[_0x71df('0x11')](util[_0x71df('0xa')](_0x71df('0x31'),_0x349233['id']));_0x43cae3();});}})['catch'](function(_0x4ce38c){if(_0x4ce38c){if(!_0x4ce38c[_0x71df('0x36')]||_0x4ce38c['name']!==_0x71df('0x37')){logger['error'](util[_0x71df('0xa')](_0x71df('0x38'),_0x349233['id']),util[_0x71df('0x39')](_0x4ce38c,{'showHidden':![],'depth':null}));}}_0x43cae3();});});}function checkTranscribe(){var _0x4e1bd7;var _0x31372d;var _0x10cd2f;return db[_0x71df('0x3a')]['findAll']({'where':{'transcribeStatus':_0x71df('0x3b')}})['then'](function(_0x3ca940){if(!_0x3ca940||!_0x3ca940[_0x71df('0x1b')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))]('No\x20transcribe\x20job\x20to\x20check');}_0x4e1bd7=_0x3ca940;return db['Setting'][_0x71df('0x28')]({'where':{'id':0x1}});})['then'](function(_0x146543){if(!_0x146543){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x3c'));}_0x31372d=_0x146543;if(!_0x31372d['transcribe']||!_0x31372d['transcribeAccountId']||!_0x31372d[_0x71df('0xf')]||!_0x31372d['language']||!_0x31372d[_0x71df('0x23')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x3d'));}return db[_0x71df('0x27')][_0x71df('0x28')]({'where':{'id':_0x31372d[_0x71df('0x3e')]}});})[_0x71df('0x10')](function(_0x253aab){if(!_0x253aab){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x253aab[_0x71df('0xd')]||!_0x253aab[_0x71df('0xe')]){throw new db[(_0x71df('0x24'))][(_0x71df('0x1e'))](_0x71df('0x29'));}_0x10cd2f=_0x253aab;var _0x3e9df3=[];_0x4e1bd7['forEach'](function(_0x1bb880){_0x3e9df3[_0x71df('0x3f')](checkTranscribeJob(_0x1bb880,_0x31372d,_0x10cd2f));});return BPromise[_0x71df('0x40')](_0x3e9df3);})[_0x71df('0x41')](function(_0x3722c8){if(_0x3722c8){if(!_0x3722c8[_0x71df('0x36')]||_0x3722c8[_0x71df('0x36')]!==_0x71df('0x37')){logger['error'](util[_0x71df('0x39')](_0x3722c8,{'showHidden':![],'depth':null}));}}});}exports[_0x71df('0x42')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc961=['Settings\x20not\x20available','Transcribe\x20not\x20configured','forEach','push','all','catch','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','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','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting'];(function(_0x9d58e0,_0x5ee515){var _0x5eab07=function(_0x177eb4){while(--_0x177eb4){_0x9d58e0['push'](_0x9d58e0['shift']());}};_0x5eab07(++_0x5ee515);}(_0xc961,0x17a));var _0x1c96=function(_0x5a3b09,_0x24a4a3){_0x5a3b09=_0x5a3b09-0x0;var _0x46298a=_0xc961[_0x5a3b09];return _0x46298a;};var _=require(_0x1c96('0x0'));var AWS=require(_0x1c96('0x1'));var rp=require(_0x1c96('0x2'));var util=require(_0x1c96('0x3'));var BPromise=require(_0x1c96('0x4'));var db=require(_0x1c96('0x5'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4e5884,_0x30d2e0,_0x494d92,_0x180969){return new Promise(function(_0x5594ee,_0x19d78b){var _0x2d4b23=new AWS[(_0x1c96('0x6'))]({'accessKeyId':_0x30d2e0,'secretAccessKey':_0x4e5884,'region':_0x494d92});_0x2d4b23[_0x1c96('0x7')]({'TranscriptionJobName':_0x180969},function(_0x2e4fa5,_0x473a4c){if(_0x2e4fa5){return _0x19d78b(_0x2e4fa5);}else{return _0x5594ee(_0x473a4c);}});});}function sentiment(_0x5523de,_0x360c75,_0x362e46,_0x691a95,_0x34497e){return new Promise(function(_0x11a521,_0x14ae4a){var _0x435739=new AWS[(_0x1c96('0x8'))]({'accessKeyId':_0x360c75,'secretAccessKey':_0x5523de,'region':_0x362e46});_0x435739[_0x1c96('0x9')]({'Text':_0x691a95,'LanguageCode':_0x34497e[_0x1c96('0xa')](0x0,0x2)},function(_0x262165,_0x26b8f3){if(_0x262165){return _0x14ae4a(_0x262165);}else{return _0x11a521(_0x26b8f3);}});});}function checkTranscribeJob(_0x5bb3c3,_0x1e0663,_0x3c9850){var _0x5a8f97;return new BPromise(function(_0x425345,_0x2d44f0){logger[_0x1c96('0xb')](util[_0x1c96('0xc')](_0x1c96('0xd'),_0x5bb3c3['id'],_0x5bb3c3[_0x1c96('0xe')]));return getTranscriptionJob(_0x3c9850[_0x1c96('0xf')],_0x3c9850[_0x1c96('0x10')],_0x1e0663[_0x1c96('0x11')],_0x5bb3c3[_0x1c96('0xe')])[_0x1c96('0x12')](function(_0x7cfdeb){logger[_0x1c96('0xb')](util['format'](_0x1c96('0x13'),_0x5bb3c3['id'],_0x5bb3c3['transcribeName'],_0x7cfdeb[_0x1c96('0x14')][_0x1c96('0x15')]));if(!_0x5bb3c3['fileText']){switch(_0x7cfdeb[_0x1c96('0x14')]['TranscriptionJobStatus']){case'COMPLETED':var _0x15b1de={'transcribeStatus':_0x7cfdeb[_0x1c96('0x14')][_0x1c96('0x15')],'fileUri':_0x7cfdeb['TranscriptionJob'][_0x1c96('0x16')]['TranscriptFileUri']};logger[_0x1c96('0xb')](util[_0x1c96('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x5bb3c3['id']));return rp({'uri':_0x7cfdeb[_0x1c96('0x14')]['Transcript'][_0x1c96('0x17')],'json':!![]})[_0x1c96('0x12')](function(_0x23722c){logger[_0x1c96('0xb')](util[_0x1c96('0xc')](_0x1c96('0x18'),_0x5bb3c3['id']));if(_0x23722c&&_0x23722c[_0x1c96('0x19')]&&_0x23722c[_0x1c96('0x19')][_0x1c96('0x1a')]&&_0x23722c[_0x1c96('0x19')]['transcripts'][_0x1c96('0x1b')]){_0x15b1de[_0x1c96('0x1c')]='';for(var _0x289ee5=0x0;_0x289ee5<_0x23722c['results']['transcripts'][_0x1c96('0x1b')];_0x289ee5++){_0x15b1de[_0x1c96('0x1c')]+=_0x23722c['results'][_0x1c96('0x1a')][_0x289ee5][_0x1c96('0x1d')]+'';}}return _0x5bb3c3[_0x1c96('0x1e')](_0x15b1de);})['then'](function(){logger['info'](util[_0x1c96('0xc')](_0x1c96('0x1f'),_0x5bb3c3['id']));if(!_0x5bb3c3['tempSentiment']){throw new db[(_0x1c96('0x20'))][(_0x1c96('0x21'))](_0x1c96('0x22'));}if(!_0x1e0663[_0x1c96('0x23')]||!_0x1e0663['sentimentAccountId']||!_0x1e0663['sentimentRegion']||!_0x1e0663[_0x1c96('0x24')]||!_0x1e0663['bucket']){throw new db[(_0x1c96('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x15b1de[_0x1c96('0x1c')]){throw new Error(_0x1c96('0x25'));}if(_0x1e0663[_0x1c96('0x26')]===_0x3c9850['id']){return _0x3c9850;}else{return db[_0x1c96('0x27')][_0x1c96('0x28')]({'where':{'id':_settings[_0x1c96('0x26')]}});}})['then'](function(_0x569dd9){if(!_0x569dd9){throw new db[(_0x1c96('0x20'))][(_0x1c96('0x21'))](_0x1c96('0x29'));}if(!_0x569dd9[_0x1c96('0xf')]||!_0x569dd9[_0x1c96('0x10')]){throw new db[(_0x1c96('0x20'))][(_0x1c96('0x21'))](_0x1c96('0x2a'));}_0x5a8f97=_0x569dd9;logger[_0x1c96('0xb')](util['format'](_0x1c96('0x2b'),_0x5bb3c3['id']));return sentiment(_0x5a8f97[_0x1c96('0xf')],_0x5a8f97[_0x1c96('0x10')],_0x1e0663[_0x1c96('0x2c')],_0x15b1de[_0x1c96('0x1c')],_0x1e0663[_0x1c96('0x24')]);})['then'](function(_0x353732){logger[_0x1c96('0xb')](util['format'](_0x1c96('0x2d'),_0x5bb3c3['id']));return _0x5bb3c3[_0x1c96('0x1e')]({'sentiment':_0x353732[_0x1c96('0x2e')],'sPositive':_0x353732[_0x1c96('0x2f')][_0x1c96('0x30')],'sNegative':_0x353732[_0x1c96('0x2f')][_0x1c96('0x31')],'sMixed':_0x353732['SentimentScore']['Mixed'],'sNeutral':_0x353732[_0x1c96('0x2f')][_0x1c96('0x32')]});})['then'](function(){logger[_0x1c96('0xb')](util['format'](_0x1c96('0x1f'),_0x5bb3c3['id']));_0x425345();});case _0x1c96('0x33'):return _0x5bb3c3['update']({'transcribeStatus':'FAILED','failureReason':_0x7cfdeb[_0x1c96('0x14')][_0x1c96('0x34')]})[_0x1c96('0x12')](function(){logger[_0x1c96('0xb')](util[_0x1c96('0xc')](_0x1c96('0x1f'),_0x5bb3c3['id']));_0x425345();});default:logger[_0x1c96('0xb')](util['format'](_0x1c96('0x35'),_0x5bb3c3['id']));break;}}else{return BPromise[_0x1c96('0x36')]()['then'](function(){if(!_0x5bb3c3[_0x1c96('0x37')]){throw new db['Sequelize'][(_0x1c96('0x21'))](_0x1c96('0x22'));}if(!_0x1e0663[_0x1c96('0x23')]||!_0x1e0663[_0x1c96('0x26')]||!_0x1e0663['sentimentRegion']||!_0x1e0663[_0x1c96('0x24')]||!_0x1e0663[_0x1c96('0x38')]){throw new db[(_0x1c96('0x20'))][(_0x1c96('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5bb3c3[_0x1c96('0x1c')]){throw new Error(_0x1c96('0x25'));}if(_0x1e0663['sentimentAccountId']===_0x3c9850['id']){return _0x3c9850;}else{return db[_0x1c96('0x27')][_0x1c96('0x28')]({'where':{'id':_settings[_0x1c96('0x26')]}});}})[_0x1c96('0x12')](function(_0x1ade48){if(!_0x1ade48){throw new db[(_0x1c96('0x20'))][(_0x1c96('0x21'))](_0x1c96('0x29'));}if(!_0x1ade48['data1']||!_0x1ade48[_0x1c96('0x10')]){throw new db[(_0x1c96('0x20'))][(_0x1c96('0x21'))](_0x1c96('0x2a'));}_0x5a8f97=_0x1ade48;logger[_0x1c96('0xb')](util[_0x1c96('0xc')](_0x1c96('0x2b'),_0x5bb3c3['id']));return sentiment(_0x5a8f97[_0x1c96('0xf')],_0x5a8f97[_0x1c96('0x10')],_0x1e0663['sentimentRegion'],_0x5bb3c3['fileText'],_0x1e0663[_0x1c96('0x24')]);})[_0x1c96('0x12')](function(_0xaf5b6f){logger[_0x1c96('0xb')](util[_0x1c96('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bb3c3['id']));return _0x5bb3c3['update']({'sentiment':_0xaf5b6f[_0x1c96('0x2e')],'sPositive':_0xaf5b6f[_0x1c96('0x2f')][_0x1c96('0x30')],'sNegative':_0xaf5b6f['SentimentScore'][_0x1c96('0x31')],'sMixed':_0xaf5b6f[_0x1c96('0x2f')]['Mixed'],'sNeutral':_0xaf5b6f[_0x1c96('0x2f')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x1c96('0x12')](function(){logger[_0x1c96('0xb')](util[_0x1c96('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5bb3c3['id']));_0x425345();});}})['catch'](function(_0x4fd7de){if(_0x4fd7de){if(!_0x4fd7de[_0x1c96('0x39')]||_0x4fd7de['name']!==_0x1c96('0x3a')){logger['error'](util[_0x1c96('0xc')](_0x1c96('0x3b'),_0x5bb3c3['id']),util[_0x1c96('0x3c')](_0x4fd7de,{'showHidden':![],'depth':null}));}}_0x425345();});});}function checkTranscribe(){var _0x1f0a98;var _0x5c7720;var _0x200fc9;return db[_0x1c96('0x3d')][_0x1c96('0x3e')]({'where':{'transcribeStatus':_0x1c96('0x3f')}})['then'](function(_0x271a10){if(!_0x271a10||!_0x271a10[_0x1c96('0x1b')]){throw new db[(_0x1c96('0x20'))][(_0x1c96('0x21'))](_0x1c96('0x40'));}_0x1f0a98=_0x271a10;return db[_0x1c96('0x41')][_0x1c96('0x28')]({'where':{'id':0x1}});})['then'](function(_0x2a4249){if(!_0x2a4249){throw new db['Sequelize'][(_0x1c96('0x21'))](_0x1c96('0x42'));}_0x5c7720=_0x2a4249;if(!_0x5c7720['transcribe']||!_0x5c7720['transcribeAccountId']||!_0x5c7720[_0x1c96('0x11')]||!_0x5c7720[_0x1c96('0x24')]||!_0x5c7720[_0x1c96('0x38')]){throw new db['Sequelize'][(_0x1c96('0x21'))](_0x1c96('0x43'));}return db[_0x1c96('0x27')]['findOne']({'where':{'id':_0x5c7720['transcribeAccountId']}});})[_0x1c96('0x12')](function(_0x534f61){if(!_0x534f61){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x534f61[_0x1c96('0xf')]||!_0x534f61['data2']){throw new db['Sequelize']['ValidationError'](_0x1c96('0x2a'));}_0x200fc9=_0x534f61;var _0x75d719=[];_0x1f0a98[_0x1c96('0x44')](function(_0x1630e){_0x75d719[_0x1c96('0x45')](checkTranscribeJob(_0x1630e,_0x5c7720,_0x200fc9));});return BPromise[_0x1c96('0x46')](_0x75d719);})[_0x1c96('0x47')](function(_0x365116){if(_0x365116){if(!_0x365116[_0x1c96('0x39')]||_0x365116['name']!==_0x1c96('0x3a')){logger[_0x1c96('0x48')](util[_0x1c96('0x3c')](_0x365116,{'showHidden':![],'depth':null}));}}});}exports[_0x1c96('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 07b0a2d..1ee1fba 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 _0xf7ec=['../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../../config/environment','../../mysqldb'];(function(_0x28ecad,_0x25fed2){var _0x5dd722=function(_0x5e9152){while(--_0x5e9152){_0x28ecad['push'](_0x28ecad['shift']());}};_0x5dd722(++_0x25fed2);}(_0xf7ec,0x1cc));var _0xcf7e=function(_0x26c55a,_0x3a8983){_0x26c55a=_0x26c55a-0x0;var _0x267a21=_0xf7ec[_0x26c55a];return _0x267a21;};'use strict';var _=require('lodash');var moment=require(_0xcf7e('0x0'));var Redis=require(_0xcf7e('0x1'));var util=require('util');var config=require(_0xcf7e('0x2'));var db=require(_0xcf7e('0x3'))['db'];var logger=require(_0xcf7e('0x4'))(_0xcf7e('0x5'));config[_0xcf7e('0x6')]=_['defaults'](config['redis'],{'host':_0xcf7e('0x7'),'port':0x18eb});var io=require(_0xcf7e('0x8'))(new Redis(config[_0xcf7e('0x6')]));function closeInteractions(){var _0x447bd5=[];return db[_0xcf7e('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xcf7e('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xcf7e('0xb'))}}})[_0xcf7e('0xc')](function(_0x2ea2b7){if(_0x2ea2b7&&_0x2ea2b7[_0xcf7e('0xd')]){_0x447bd5=_['map'](_0x2ea2b7||[],'id');logger[_0xcf7e('0xe')](_0xcf7e('0xf'),_0x447bd5[_0xcf7e('0x10')]());return db[_0xcf7e('0x9')][_0xcf7e('0x11')]({'closeReason':_0xcf7e('0x12'),'disposition':_0xcf7e('0x13'),'closed':!![],'closedAt':moment()[_0xcf7e('0x14')](_0xcf7e('0x15'))},{'where':{'id':_0x447bd5}});}})[_0xcf7e('0xc')](function(){if(_0x447bd5&&_0x447bd5['length']){logger[_0xcf7e('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x447bd5[_0xcf7e('0x10')]());for(var _0x324700=0x0;_0x324700<_0x447bd5[_0xcf7e('0xd')];_0x324700++){io[_0xcf7e('0x16')](_0xcf7e('0x17'),{'id':_0x447bd5[_0x324700],'closed':!![]});}}})[_0xcf7e('0x18')](function(_0x51e391){logger[_0xcf7e('0x19')](_0xcf7e('0x1a'),_0x51e391?util[_0xcf7e('0x1b')](_0x51e391,{'showHidden':![],'depth':null}):'');});}exports[_0xcf7e('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3024=['hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','join','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','schedule','defaults','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract'];(function(_0x4dc5f2,_0x5a2bd7){var _0x5f2c8e=function(_0x117454){while(--_0x117454){_0x4dc5f2['push'](_0x4dc5f2['shift']());}};_0x5f2c8e(++_0x5a2bd7);}(_0x3024,0x64));var _0x4302=function(_0x469e49,_0x224c6d){_0x469e49=_0x469e49-0x0;var _0x50f190=_0x3024[_0x469e49];return _0x50f190;};'use strict';var _=require(_0x4302('0x0'));var moment=require(_0x4302('0x1'));var Redis=require('ioredis');var util=require(_0x4302('0x2'));var config=require(_0x4302('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x4302('0x4'));config['redis']=_[_0x4302('0x5')](config[_0x4302('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4302('0x7'))(new Redis(config[_0x4302('0x6')]));function closeInteractions(){var _0x4c3983=[];return db[_0x4302('0x8')][_0x4302('0x9')]({'raw':!![],'attributes':['id',_0x4302('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4302('0xb')](0x18,_0x4302('0xc'))}}})[_0x4302('0xd')](function(_0x41580c){if(_0x41580c&&_0x41580c['length']){_0x4c3983=_[_0x4302('0xe')](_0x41580c||[],'id');logger[_0x4302('0xf')](_0x4302('0x10'),_0x4c3983['join']());return db[_0x4302('0x8')][_0x4302('0x11')]({'closeReason':'system','disposition':_0x4302('0x12'),'closed':!![],'closedAt':moment()[_0x4302('0x13')](_0x4302('0x14'))},{'where':{'id':_0x4c3983}});}})['then'](function(){if(_0x4c3983&&_0x4c3983[_0x4302('0x15')]){logger[_0x4302('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4c3983[_0x4302('0x16')]());for(var _0x41b495=0x0;_0x41b495<_0x4c3983[_0x4302('0x15')];_0x41b495++){io['emit'](_0x4302('0x17'),{'id':_0x4c3983[_0x41b495],'closed':!![]});}}})[_0x4302('0x18')](function(_0x5ab66e){logger[_0x4302('0x19')](_0x4302('0x1a'),_0x5ab66e?util['inspect'](_0x5ab66e,{'showHidden':![],'depth':null}):'');});}exports[_0x4302('0x1b')]=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 79c349b..fcc55df 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67d8=['destroy','bulkCreate','then','log','hopper1','contacts2','CmHopper','hopper2','util','push','innocenzo.biondo','now','Innocenzo','@xcally.com','CmContact'];(function(_0x544f22,_0x4d4ad8){var _0x47090b=function(_0x216ba5){while(--_0x216ba5){_0x544f22['push'](_0x544f22['shift']());}};_0x47090b(++_0x4d4ad8);}(_0x67d8,0x116));var _0x867d=function(_0x27cc66,_0x5d9e16){_0x27cc66=_0x27cc66-0x0;var _0x2c275e=_0x67d8[_0x27cc66];return _0x2c275e;};'use strict';var util=require(_0x867d('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x867d('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x867d('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x867d('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x867d('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x867d('0x4')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x867d('0x2')+i+_0x867d('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x867d('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x867d('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x867d('0x3')]()});}db[_0x867d('0x6')][_0x867d('0x7')]({'where':{}})['then'](function(){return db['CmContact'][_0x867d('0x8')](contacts);})[_0x867d('0x9')](function(){console[_0x867d('0xa')]('finished\x20populating','contacts1');return db['CmHopper'][_0x867d('0x7')]({'where':{}});})[_0x867d('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0x867d('0xa')]('finished\x20populating',_0x867d('0xb'));return db[_0x867d('0x6')][_0x867d('0x8')](contacts2);})['then'](function(){console[_0x867d('0xa')]('finished\x20populating',_0x867d('0xc'));return db[_0x867d('0xd')][_0x867d('0x8')](hopper2);})[_0x867d('0x9')](function(){console[_0x867d('0xa')]('finished\x20populating',_0x867d('0xe'));})['catch'](function(_0xbe4422){console[_0x867d('0xa')](_0xbe4422);}); \ No newline at end of file +var _0x47d8=['contacts2','hopper2','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','bulkCreate','then','finished\x20populating','contacts1','CmHopper','log'];(function(_0x4db37a,_0x13143b){var _0x5981f1=function(_0x57fd43){while(--_0x57fd43){_0x4db37a['push'](_0x4db37a['shift']());}};_0x5981f1(++_0x13143b);}(_0x47d8,0x17c));var _0x847d=function(_0x4f0078,_0x58c0e5){_0x4f0078=_0x4f0078-0x0;var _0x160aea=_0x47d8[_0x4f0078];return _0x160aea;};'use strict';var util=require(_0x847d('0x0'));var db=require(_0x847d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x847d('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x847d('0x3')+i,'phone':0xf879fb460+i,'email':_0x847d('0x4')+i+_0x847d('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x847d('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x847d('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x847d('0x2')]({'id':i,'firstName':_0x847d('0x7')+i,'lastName':_0x847d('0x3')+i,'phone':0xf879fb460+i,'email':_0x847d('0x4')+i+_0x847d('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x847d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x847d('0x6')](),'updatedAt':Date[_0x847d('0x6')]()});}db[_0x847d('0x8')][_0x847d('0x9')]({'where':{}})['then'](function(){return db[_0x847d('0x8')][_0x847d('0xa')](contacts);})[_0x847d('0xb')](function(){console['log'](_0x847d('0xc'),_0x847d('0xd'));return db[_0x847d('0xe')][_0x847d('0x9')]({'where':{}});})[_0x847d('0xb')](function(){return db[_0x847d('0xe')][_0x847d('0xa')](hopper);})['then'](function(){console[_0x847d('0xf')](_0x847d('0xc'),'hopper1');return db[_0x847d('0x8')][_0x847d('0xa')](contacts2);})[_0x847d('0xb')](function(){console['log'](_0x847d('0xc'),_0x847d('0x10'));return db[_0x847d('0xe')][_0x847d('0xa')](hopper2);})[_0x847d('0xb')](function(){console['log'](_0x847d('0xc'),_0x847d('0x11'));})['catch'](function(_0x1b2cf8){console['log'](_0x1b2cf8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 97754f3..25cc0bc 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e0d=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','%s%s','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','agent','format','friend','udp','wss','all'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x5e0d,0x19a));var _0xd5e0=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x5e0d[_0x2faddb];return _0x273c05;};'use strict';var util=require(_0xd5e0('0x0'));var db=require(_0xd5e0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0xd5e0('0x2'),i),'fullname':util['format']('%s%s',_0xd5e0('0x2'),i),'email':util[_0xd5e0('0x3')]('%s%s@xcally.com',_0xd5e0('0x2'),i),'role':_0xd5e0('0x2'),'password':'password','internal':0xfa0+i,'type':_0xd5e0('0x4'),'transport':[_0xd5e0('0x5'),'ws',_0xd5e0('0x6')],'disallow':[_0xd5e0('0x7')],'allow':['ulaw'],'defaultuser':util[_0xd5e0('0x3')]('%s%s',_0xd5e0('0x2'),i),'encryption':_0xd5e0('0x8'),'avpf':_0xd5e0('0x8'),'force_avp':_0xd5e0('0x8'),'icesupport':_0xd5e0('0x8'),'dtlsenable':_0xd5e0('0x8'),'dtlsverify':'no','dtlscertfile':_0xd5e0('0x9'),'dtlsprivatekey':_0xd5e0('0xa'),'dtlssetup':_0xd5e0('0xb'),'callerid':util[_0xd5e0('0x3')]('\x22%s\x22\x20<%s>',util['format'](_0xd5e0('0xc'),_0xd5e0('0x2'),i),0xfa0+i)});}db[_0xd5e0('0xd')][_0xd5e0('0xe')](users)[_0xd5e0('0xf')](function(){console[_0xd5e0('0x10')](_0xd5e0('0x11'));})[_0xd5e0('0x12')](function(_0x31696f){console[_0xd5e0('0x10')](_0x31696f);}); \ No newline at end of file +var _0x4cd0=['log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','bulkCreate','then'];(function(_0x495f0b,_0x499f83){var _0xef44be=function(_0xea90c){while(--_0xea90c){_0x495f0b['push'](_0x495f0b['shift']());}};_0xef44be(++_0x499f83);}(_0x4cd0,0xd4));var _0x04cd=function(_0x41a25e,_0x40bca7){_0x41a25e=_0x41a25e-0x0;var _0x21e3ab=_0x4cd0[_0x41a25e];return _0x21e3ab;};'use strict';var util=require(_0x04cd('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x04cd('0x1')]({'name':util[_0x04cd('0x2')](_0x04cd('0x3'),_0x04cd('0x4'),i),'fullname':util['format']('%s%s',_0x04cd('0x4'),i),'email':util[_0x04cd('0x2')](_0x04cd('0x5'),_0x04cd('0x4'),i),'role':'agent','password':_0x04cd('0x6'),'internal':0xfa0+i,'type':_0x04cd('0x7'),'transport':[_0x04cd('0x8'),'ws','wss'],'disallow':[_0x04cd('0x9')],'allow':[_0x04cd('0xa')],'defaultuser':util['format'](_0x04cd('0x3'),_0x04cd('0x4'),i),'encryption':_0x04cd('0xb'),'avpf':_0x04cd('0xb'),'force_avp':_0x04cd('0xb'),'icesupport':_0x04cd('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x04cd('0xc'),'callerid':util[_0x04cd('0x2')](_0x04cd('0xd'),util[_0x04cd('0x2')](_0x04cd('0x3'),_0x04cd('0x4'),i),0xfa0+i)});}db['User'][_0x04cd('0xe')](users)[_0x04cd('0xf')](function(){console[_0x04cd('0x10')](_0x04cd('0x11'));})[_0x04cd('0x12')](function(_0x14aeb8){console['log'](_0x14aeb8);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f7920ca..a61a166 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9416=['user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','ivr','format','length','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','userProfileId','SmsQueues','OpenchannelQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getMailQueues','all','voice','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x9416,0xde));var _0x6941=function(_0x9a9370,_0x25cd69){_0x9a9370=_0x9a9370-0x0;var _0x1418af=_0x9416[_0x9a9370];return _0x1418af;};'use strict';var _=require(_0x6941('0x0'));var util=require(_0x6941('0x1'));var BPromise=require(_0x6941('0x2'));var db=require(_0x6941('0x3'))['db'];var config=require(_0x6941('0x4'));var queryQueues={'attributes':['id',_0x6941('0x5')],'include':[{'as':_0x6941('0x6'),'model':db[_0x6941('0x7')],'attributes':['id',_0x6941('0x5'),_0x6941('0x8')],'raw':!![],'where':{'role':_0x6941('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6941('0x5')],'where':{'role':_0x6941('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6941('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x6941('0x5')],'where':{'role':_0x6941('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6941('0x5'),_0x6941('0xb')],'where':{'type':'ivr'}};function getAssociatedResources(_0x291004,_0x2762de,_0x15ba10){return db[_0x6941('0xc')][_0x6941('0xd')]({'where':{'name':_0x291004,'userProfileId':_0x2762de},'raw':!![]})[_0x6941('0xe')](function(_0x208d7d){if(_0x208d7d){if(_0x208d7d[_0x6941('0xf')]){switch(_0x291004){case _0x6941('0x10'):case'ChatQueues':case _0x6941('0x11'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x6941('0x12'):return db[_0x15ba10][_0x6941('0x13')](queryQueues);case _0x6941('0x14'):return db[_0x15ba10][_0x6941('0x13')](queryTelephones);case _0x6941('0x15'):return db[_0x15ba10][_0x6941('0x13')](queryTrunks);case _0x6941('0x16'):return db[_0x15ba10][_0x6941('0x13')](queryCampaigns);}}else{return db[_0x6941('0x17')][_0x6941('0x13')]({'attributes':[_0x6941('0x18')],'where':{'sectionId':_0x208d7d['id']},'raw':!![]})['then'](function(_0x4ce783){if(_0x4ce783){var _0x37bc45={'where':{'id':_[_0x6941('0x19')](_0x4ce783,_0x6941('0x18'))},'raw':!![]};switch(_0x15ba10){case _0x6941('0x7'):_0x37bc45[_0x6941('0x1a')][_0x6941('0x8')]=_0x6941('0xa');break;case'Campaign':_0x37bc45[_0x6941('0x1a')][_0x6941('0xb')]=_0x6941('0x1b');break;}return db[_0x15ba10][_0x6941('0x13')](_0x37bc45);}else{return[];}});}}else{return[];}})['then'](function(_0x2242d0){return _0x2242d0;});}function joinOrLeaveQueues(_0xe965,_0x473a6c,_0x336968,_0x165f9a){_0xe965[_0x473a6c](util[_0x6941('0x1c')]('%s:queue:%s',_0x336968,_0x165f9a[_0x6941('0x5')]));if(_0x165f9a['Agents']){for(var _0x4beff4=0x0;_0x4beff4<_0x165f9a[_0x6941('0x6')][_0x6941('0x1d')];_0x4beff4+=0x1){_0xe965[_0x473a6c](util['format'](_0x6941('0x1e'),_0x165f9a[_0x6941('0x6')][_0x4beff4]['name']));}}}function joinOrLeave(_0x54dd4c,_0x4572f5,_0x596211){var _0x1ab6dd;if(_0x54dd4c[_0x6941('0x1f')][_0x6941('0x20')]['id']){db[_0x6941('0x7')][_0x6941('0x21')]({'attributes':['id',_0x6941('0x5'),_0x6941('0x8'),'userProfileId'],'where':{'id':_0x54dd4c[_0x6941('0x1f')][_0x6941('0x20')]['id']},'include':[{'model':db[_0x6941('0x22')],'as':_0x6941('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6941('0x24')],'as':_0x6941('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6941('0x26')],'as':_0x6941('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x6941('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x6941('0x29')],'as':_0x6941('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x6941('0xe')](function(_0x5a1a15){if(_0x5a1a15){_0x1ab6dd=_0x5a1a15;_0x54dd4c[_0x4572f5](util['format']('user:%s',_0x5a1a15[_0x6941('0x5')]));var _0x441c9f=[];switch(_0x5a1a15[_0x6941('0x8')]){case _0x6941('0x2b'):_0x54dd4c[_0x4572f5](_0x6941('0x2c'));_0x54dd4c[_0x4572f5](_0x6941('0x2d'));if(queryQueues[_0x6941('0x2e')](_0x6941('0x2f'))){delete queryQueues[_0x6941('0x2f')];}_0x441c9f['push'](db[_0x6941('0x30')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db['ChatQueue'][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x32')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x33')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x34')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x35')][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db['WhatsappQueue'][_0x6941('0x13')](queryQueues));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x7')][_0x6941('0x13')](queryTelephones));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x36')]['findAll'](queryTrunks));_0x441c9f['push'](db[_0x6941('0x37')][_0x6941('0x13')](queryCampaigns));_0x441c9f[_0x6941('0x31')](db[_0x6941('0x7')][_0x6941('0x13')](queryAgents));break;case _0x6941('0x38'):_0x54dd4c[_0x4572f5](_0x6941('0x2c'));_0x54dd4c[_0x4572f5](_0x6941('0x2d'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x10'),_0x5a1a15[_0x6941('0x39')],_0x6941('0x30')));_0x441c9f[_0x6941('0x31')](getAssociatedResources('ChatQueues',_0x5a1a15[_0x6941('0x39')],'ChatQueue'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x11'),_0x5a1a15[_0x6941('0x39')],'FaxQueue'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x3a'),_0x5a1a15['userProfileId'],_0x6941('0x33')));_0x441c9f['push'](getAssociatedResources('MailQueues',_0x5a1a15['userProfileId'],_0x6941('0x34')));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x3b'),_0x5a1a15['userProfileId'],'OpenchannelQueue'));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x12'),_0x5a1a15['userProfileId'],_0x6941('0x3c')));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x14'),_0x5a1a15['userProfileId'],_0x6941('0x7')));_0x441c9f['push'](getAssociatedResources(_0x6941('0x15'),_0x5a1a15['userProfileId'],_0x6941('0x36')));_0x441c9f[_0x6941('0x31')](getAssociatedResources(_0x6941('0x16'),_0x5a1a15['userProfileId'],_0x6941('0x37')));_0x441c9f['push'](db['User'][_0x6941('0x13')](queryAgents));break;case'agent':_0x54dd4c[_0x4572f5]('voice:inbound');_0x54dd4c[_0x4572f5](_0x6941('0x2d'));_0x441c9f[_0x6941('0x31')](_0x5a1a15[_0x6941('0x3d')]({'attributes':['id',_0x6941('0x5')]}));_0x441c9f['push'](_0x5a1a15[_0x6941('0x3e')]({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15['getFaxQueues']({'attributes':['id',_0x6941('0x5')]}));_0x441c9f['push'](_0x5a1a15['getSmsQueues']({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15[_0x6941('0x3f')]({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15['getOpenchannelQueues']({'attributes':['id',_0x6941('0x5')]}));_0x441c9f[_0x6941('0x31')](_0x5a1a15['getWhatsappQueues']({'attributes':['id',_0x6941('0x5')]}));break;}return BPromise[_0x6941('0x40')](_0x441c9f);}})[_0x6941('0xe')](function(_0x1c193d){if(_0x1c193d&&_0x1c193d[_0x6941('0x1d')]){for(var _0x543673=0x0;_0x543673<_0x1c193d[_0x6941('0x1d')];_0x543673+=0x1){for(var _0x41c647=0x0;_0x41c647<_0x1c193d[_0x543673][_0x6941('0x1d')];_0x41c647+=0x1){switch(_0x543673){case 0x0:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x41'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x1:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,'chat',_0x1c193d[_0x543673][_0x41c647]);break;case 0x2:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x42'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x3:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,'sms',_0x1c193d[_0x543673][_0x41c647]);break;case 0x4:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x43'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x5:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,_0x6941('0x44'),_0x1c193d[_0x543673][_0x41c647]);break;case 0x6:joinOrLeaveQueues(_0x54dd4c,_0x4572f5,'whatsapp',_0x1c193d[_0x543673][_0x41c647]);break;case 0x7:if(_0x1ab6dd[_0x6941('0x8')]!==_0x6941('0x9'))_0x54dd4c[_0x4572f5](util[_0x6941('0x1c')](_0x6941('0x45'),_0x1c193d[_0x543673][_0x41c647]['name']));break;case 0x8:if(_0x1ab6dd[_0x6941('0x8')]!==_0x6941('0x9'))_0x54dd4c[_0x4572f5](util['format'](_0x6941('0x46'),_0x1c193d[_0x543673][_0x41c647]['name']));break;case 0x9:if(_0x1ab6dd['role']!==_0x6941('0x9'))_0x54dd4c[_0x4572f5](util[_0x6941('0x1c')](_0x6941('0x47'),_0x1c193d[_0x543673][_0x41c647][_0x6941('0xb')],_0x1c193d[_0x543673][_0x41c647][_0x6941('0x5')]));break;case 0xa:_0x54dd4c[_0x4572f5](util[_0x6941('0x1c')]('user:%s',_0x1c193d[_0x543673][_0x41c647][_0x6941('0x5')]));break;}}}}})[_0x6941('0xe')](function(){if(_0x4572f5===_0x6941('0x48')){var _0x3a4ab7=_[_0x6941('0x19')](_0x1ab6dd[_0x6941('0x23')],'id');return _0x1ab6dd[_0x6941('0x49')](_0x3a4ab7)[_0x6941('0xe')](function(){for(var _0x54b409=0x0;_0x54b409<_0x3a4ab7[_0x6941('0x1d')];_0x54b409+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x4b'),{'ChatInteractionId':Number(_0x3a4ab7[_0x54b409]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0x27e78f=_['map'](_0x1ab6dd[_0x6941('0x4c')],'id');return _0x1ab6dd[_0x6941('0x4d')](_0x27e78f)[_0x6941('0xe')](function(){for(var _0x3c37bd=0x0;_0x3c37bd<_0x27e78f[_0x6941('0x1d')];_0x3c37bd+=0x1){_0x596211['emit'](_0x6941('0x4e'),{'MailInteractionId':Number(_0x27e78f[_0x3c37bd]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0xb6bc05=_[_0x6941('0x19')](_0x1ab6dd['FaxInteractions'],'id');return _0x1ab6dd[_0x6941('0x4f')](_0xb6bc05)['then'](function(){for(var _0x53a301=0x0;_0x53a301<_0xb6bc05['length'];_0x53a301+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x50'),{'FaxInteractionId':Number(_0xb6bc05[_0x53a301]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0x2fd495=_[_0x6941('0x19')](_0x1ab6dd[_0x6941('0x27')],'id');return _0x1ab6dd[_0x6941('0x51')](_0x2fd495)['then'](function(){for(var _0x4e814e=0x0;_0x4e814e<_0x2fd495[_0x6941('0x1d')];_0x4e814e+=0x1){_0x596211['emit'](_0x6941('0x52'),{'SmsInteractionId':Number(_0x2fd495[_0x4e814e]),'UserId':Number(_0x1ab6dd['id'])});}});}})[_0x6941('0xe')](function(){if(_0x4572f5===_0x6941('0x48')){var _0x2138f5=_['map'](_0x1ab6dd[_0x6941('0x28')],'id');return _0x1ab6dd[_0x6941('0x53')](_0x2138f5)[_0x6941('0xe')](function(){for(var _0x577248=0x0;_0x577248<_0x2138f5[_0x6941('0x1d')];_0x577248+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x54'),{'OpenchannelInteractionId':Number(_0x2138f5[_0x577248]),'UserId':Number(_0x1ab6dd['id'])});}});}})['then'](function(){if(_0x4572f5===_0x6941('0x48')){var _0x31a9a0=_[_0x6941('0x19')](_0x1ab6dd['WhatsappInteractions'],'id');return _0x1ab6dd[_0x6941('0x55')](_0x31a9a0)['then'](function(){for(var _0x4a4634=0x0;_0x4a4634<_0x31a9a0[_0x6941('0x1d')];_0x4a4634+=0x1){_0x596211[_0x6941('0x4a')](_0x6941('0x56'),{'WhatsappInteractionId':Number(_0x31a9a0[_0x4a4634]),'UserId':Number(_0x1ab6dd['id'])});}});}})[_0x6941('0x57')](function(_0x30b6ad){_0x54dd4c[_0x6941('0x58')](_0x30b6ad);});}}function onDisconnect(_0x1eea76,_0x4ed6a9){joinOrLeave(_0x1eea76,'leave',_0x4ed6a9);}function onConnect(_0x3bdaf5){joinOrLeave(_0x3bdaf5,_0x6941('0x59'));}exports[_0x6941('0x5a')]=function(_0x1ed594){_0x1ed594['on'](_0x6941('0x5b'),function(_0x2baa24){_0x2baa24[_0x6941('0x5c')](0x0);_0x2baa24[_0x6941('0x5d')]=_0x2baa24['request']['connection'][_0x6941('0x5e')]+':'+_0x2baa24[_0x6941('0x5f')][_0x6941('0x5b')][_0x6941('0x60')];_0x2baa24['connectedAt']=new Date();_0x2baa24[_0x6941('0x58')]=function(_0x58edea){console[_0x6941('0x58')](_0x6941('0x61')+_0x2baa24[_0x6941('0x62')][_0x6941('0x5')]+'['+_0x2baa24['address']+']',_0x58edea);};_0x2baa24['on'](_0x6941('0x63'),function(){onDisconnect(_0x2baa24,_0x1ed594);_0x2baa24[_0x6941('0x58')](_0x6941('0x64'));});onConnect(_0x2baa24);_0x2baa24[_0x6941('0x58')](_0x6941('0x65'));});}; \ No newline at end of file +var _0x9931=['FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','setMaxListeners','request','connection','remotePort','connectedAt','SocketIO\x20','address','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','%s:queue:%s','length','format','user:%s','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','userProfileId','ChatQueue','MailQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','whatsapp','telephone:%s','trunk:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove'];(function(_0x503627,_0x5639fa){var _0x4b822c=function(_0x1f4ebd){while(--_0x1f4ebd){_0x503627['push'](_0x503627['shift']());}};_0x4b822c(++_0x5639fa);}(_0x9931,0x1b6));var _0x1993=function(_0x314974,_0x54dd7a){_0x314974=_0x314974-0x0;var _0x28497a=_0x9931[_0x314974];return _0x28497a;};'use strict';var _=require('lodash');var util=require(_0x1993('0x0'));var BPromise=require('bluebird');var db=require(_0x1993('0x1'))['db'];var config=require(_0x1993('0x2'));var queryQueues={'attributes':['id',_0x1993('0x3')],'include':[{'as':_0x1993('0x4'),'model':db[_0x1993('0x5')],'attributes':['id',_0x1993('0x3'),_0x1993('0x6')],'raw':!![],'where':{'role':_0x1993('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1993('0x3')],'where':{'role':_0x1993('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1993('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x1993('0x3')],'where':{'role':_0x1993('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1993('0x3'),_0x1993('0x9')],'where':{'type':_0x1993('0xa')}};function getAssociatedResources(_0x42ef8f,_0x5b6426,_0x58b0fe){return db[_0x1993('0xb')][_0x1993('0xc')]({'where':{'name':_0x42ef8f,'userProfileId':_0x5b6426},'raw':!![]})[_0x1993('0xd')](function(_0x372c71){if(_0x372c71){if(_0x372c71[_0x1993('0xe')]){switch(_0x42ef8f){case _0x1993('0xf'):case _0x1993('0x10'):case _0x1993('0x11'):case _0x1993('0x12'):case _0x1993('0x13'):case _0x1993('0x14'):case _0x1993('0x15'):return db[_0x58b0fe]['findAll'](queryQueues);case'Telephones':return db[_0x58b0fe][_0x1993('0x16')](queryTelephones);case _0x1993('0x17'):return db[_0x58b0fe][_0x1993('0x16')](queryTrunks);case _0x1993('0x18'):return db[_0x58b0fe]['findAll'](queryCampaigns);}}else{return db[_0x1993('0x19')][_0x1993('0x16')]({'attributes':[_0x1993('0x1a')],'where':{'sectionId':_0x372c71['id']},'raw':!![]})[_0x1993('0xd')](function(_0x306ce2){if(_0x306ce2){var _0x32b2cb={'where':{'id':_[_0x1993('0x1b')](_0x306ce2,'resourceId')},'raw':!![]};switch(_0x58b0fe){case _0x1993('0x5'):_0x32b2cb['where'][_0x1993('0x6')]=_0x1993('0x8');break;case'Campaign':_0x32b2cb[_0x1993('0x1c')][_0x1993('0x9')]=_0x1993('0xa');break;}return db[_0x58b0fe][_0x1993('0x16')](_0x32b2cb);}else{return[];}});}}else{return[];}})[_0x1993('0xd')](function(_0xeaba5e){return _0xeaba5e;});}function joinOrLeaveQueues(_0x4ee5b7,_0x2e714b,_0x13e96d,_0x404b8f){_0x4ee5b7[_0x2e714b](util['format'](_0x1993('0x1d'),_0x13e96d,_0x404b8f[_0x1993('0x3')]));if(_0x404b8f[_0x1993('0x4')]){for(var _0x314b3c=0x0;_0x314b3c<_0x404b8f['Agents'][_0x1993('0x1e')];_0x314b3c+=0x1){_0x4ee5b7[_0x2e714b](util[_0x1993('0x1f')](_0x1993('0x20'),_0x404b8f[_0x1993('0x4')][_0x314b3c][_0x1993('0x3')]));}}}function joinOrLeave(_0xb27d2e,_0x169b52,_0x467d9a){var _0x473599;if(_0xb27d2e[_0x1993('0x21')][_0x1993('0x22')]['id']){db['User']['find']({'attributes':['id',_0x1993('0x3'),_0x1993('0x6'),'userProfileId'],'where':{'id':_0xb27d2e['handshake'][_0x1993('0x22')]['id']},'include':[{'model':db[_0x1993('0x23')],'as':_0x1993('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1993('0x25')],'as':_0x1993('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1993('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x1993('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1993('0x29')],'as':_0x1993('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x1993('0x2b')],'as':_0x1993('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x1993('0xd')](function(_0x3fb166){if(_0x3fb166){_0x473599=_0x3fb166;_0xb27d2e[_0x169b52](util[_0x1993('0x1f')](_0x1993('0x20'),_0x3fb166[_0x1993('0x3')]));var _0x51ee82=[];switch(_0x3fb166[_0x1993('0x6')]){case _0x1993('0x2d'):_0xb27d2e[_0x169b52](_0x1993('0x2e'));_0xb27d2e[_0x169b52](_0x1993('0x2f'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x1993('0x30')];}_0x51ee82[_0x1993('0x31')](db[_0x1993('0x32')][_0x1993('0x16')](queryQueues));_0x51ee82[_0x1993('0x31')](db['ChatQueue']['findAll'](queryQueues));_0x51ee82['push'](db[_0x1993('0x33')][_0x1993('0x16')](queryQueues));_0x51ee82['push'](db[_0x1993('0x34')]['findAll'](queryQueues));_0x51ee82['push'](db['MailQueue']['findAll'](queryQueues));_0x51ee82[_0x1993('0x31')](db[_0x1993('0x35')][_0x1993('0x16')](queryQueues));_0x51ee82[_0x1993('0x31')](db[_0x1993('0x36')][_0x1993('0x16')](queryQueues));_0x51ee82[_0x1993('0x31')](db[_0x1993('0x5')][_0x1993('0x16')](queryTelephones));_0x51ee82[_0x1993('0x31')](db[_0x1993('0x37')][_0x1993('0x16')](queryTrunks));_0x51ee82[_0x1993('0x31')](db[_0x1993('0x38')][_0x1993('0x16')](queryCampaigns));_0x51ee82[_0x1993('0x31')](db[_0x1993('0x5')][_0x1993('0x16')](queryAgents));break;case _0x1993('0x39'):_0xb27d2e[_0x169b52](_0x1993('0x2e'));_0xb27d2e[_0x169b52](_0x1993('0x2f'));_0x51ee82[_0x1993('0x31')](getAssociatedResources('VoiceQueues',_0x3fb166['userProfileId'],'VoiceQueue'));_0x51ee82['push'](getAssociatedResources(_0x1993('0x10'),_0x3fb166[_0x1993('0x3a')],_0x1993('0x3b')));_0x51ee82[_0x1993('0x31')](getAssociatedResources(_0x1993('0x11'),_0x3fb166[_0x1993('0x3a')],_0x1993('0x33')));_0x51ee82[_0x1993('0x31')](getAssociatedResources('SmsQueues',_0x3fb166[_0x1993('0x3a')],'SmsQueue'));_0x51ee82[_0x1993('0x31')](getAssociatedResources(_0x1993('0x13'),_0x3fb166[_0x1993('0x3a')],_0x1993('0x3c')));_0x51ee82['push'](getAssociatedResources(_0x1993('0x14'),_0x3fb166[_0x1993('0x3a')],_0x1993('0x35')));_0x51ee82[_0x1993('0x31')](getAssociatedResources(_0x1993('0x15'),_0x3fb166[_0x1993('0x3a')],'WhatsappQueue'));_0x51ee82[_0x1993('0x31')](getAssociatedResources(_0x1993('0x3d'),_0x3fb166[_0x1993('0x3a')],'User'));_0x51ee82[_0x1993('0x31')](getAssociatedResources(_0x1993('0x17'),_0x3fb166['userProfileId'],_0x1993('0x37')));_0x51ee82[_0x1993('0x31')](getAssociatedResources(_0x1993('0x18'),_0x3fb166[_0x1993('0x3a')],_0x1993('0x38')));_0x51ee82[_0x1993('0x31')](db[_0x1993('0x5')][_0x1993('0x16')](queryAgents));break;case _0x1993('0x7'):_0xb27d2e[_0x169b52](_0x1993('0x2e'));_0xb27d2e[_0x169b52](_0x1993('0x2f'));_0x51ee82[_0x1993('0x31')](_0x3fb166[_0x1993('0x3e')]({'attributes':['id',_0x1993('0x3')]}));_0x51ee82[_0x1993('0x31')](_0x3fb166[_0x1993('0x3f')]({'attributes':['id',_0x1993('0x3')]}));_0x51ee82[_0x1993('0x31')](_0x3fb166[_0x1993('0x40')]({'attributes':['id','name']}));_0x51ee82[_0x1993('0x31')](_0x3fb166[_0x1993('0x41')]({'attributes':['id',_0x1993('0x3')]}));_0x51ee82['push'](_0x3fb166[_0x1993('0x42')]({'attributes':['id',_0x1993('0x3')]}));_0x51ee82['push'](_0x3fb166[_0x1993('0x43')]({'attributes':['id',_0x1993('0x3')]}));_0x51ee82[_0x1993('0x31')](_0x3fb166[_0x1993('0x44')]({'attributes':['id',_0x1993('0x3')]}));break;}return BPromise[_0x1993('0x45')](_0x51ee82);}})[_0x1993('0xd')](function(_0x48b0ed){if(_0x48b0ed&&_0x48b0ed[_0x1993('0x1e')]){for(var _0x20f95f=0x0;_0x20f95f<_0x48b0ed['length'];_0x20f95f+=0x1){for(var _0x5e2355=0x0;_0x5e2355<_0x48b0ed[_0x20f95f][_0x1993('0x1e')];_0x5e2355+=0x1){switch(_0x20f95f){case 0x0:joinOrLeaveQueues(_0xb27d2e,_0x169b52,_0x1993('0x46'),_0x48b0ed[_0x20f95f][_0x5e2355]);break;case 0x1:joinOrLeaveQueues(_0xb27d2e,_0x169b52,_0x1993('0x47'),_0x48b0ed[_0x20f95f][_0x5e2355]);break;case 0x2:joinOrLeaveQueues(_0xb27d2e,_0x169b52,'fax',_0x48b0ed[_0x20f95f][_0x5e2355]);break;case 0x3:joinOrLeaveQueues(_0xb27d2e,_0x169b52,_0x1993('0x48'),_0x48b0ed[_0x20f95f][_0x5e2355]);break;case 0x4:joinOrLeaveQueues(_0xb27d2e,_0x169b52,'mail',_0x48b0ed[_0x20f95f][_0x5e2355]);break;case 0x5:joinOrLeaveQueues(_0xb27d2e,_0x169b52,'openchannel',_0x48b0ed[_0x20f95f][_0x5e2355]);break;case 0x6:joinOrLeaveQueues(_0xb27d2e,_0x169b52,_0x1993('0x49'),_0x48b0ed[_0x20f95f][_0x5e2355]);break;case 0x7:if(_0x473599[_0x1993('0x6')]!==_0x1993('0x7'))_0xb27d2e[_0x169b52](util[_0x1993('0x1f')](_0x1993('0x4a'),_0x48b0ed[_0x20f95f][_0x5e2355][_0x1993('0x3')]));break;case 0x8:if(_0x473599[_0x1993('0x6')]!==_0x1993('0x7'))_0xb27d2e[_0x169b52](util[_0x1993('0x1f')](_0x1993('0x4b'),_0x48b0ed[_0x20f95f][_0x5e2355][_0x1993('0x3')]));break;case 0x9:if(_0x473599[_0x1993('0x6')]!==_0x1993('0x7'))_0xb27d2e[_0x169b52](util['format']('campaign:%s:%s',_0x48b0ed[_0x20f95f][_0x5e2355][_0x1993('0x9')],_0x48b0ed[_0x20f95f][_0x5e2355][_0x1993('0x3')]));break;case 0xa:_0xb27d2e[_0x169b52](util[_0x1993('0x1f')]('user:%s',_0x48b0ed[_0x20f95f][_0x5e2355]['name']));break;}}}}})[_0x1993('0xd')](function(){if(_0x169b52==='leave'){var _0x29116e=_['map'](_0x473599[_0x1993('0x24')],'id');return _0x473599[_0x1993('0x4c')](_0x29116e)[_0x1993('0xd')](function(){for(var _0x200675=0x0;_0x200675<_0x29116e[_0x1993('0x1e')];_0x200675+=0x1){_0x467d9a[_0x1993('0x4d')](_0x1993('0x4e'),{'ChatInteractionId':Number(_0x29116e[_0x200675]),'UserId':Number(_0x473599['id'])});}});}})[_0x1993('0xd')](function(){if(_0x169b52===_0x1993('0x4f')){var _0x2ad40b=_[_0x1993('0x1b')](_0x473599[_0x1993('0x26')],'id');return _0x473599[_0x1993('0x50')](_0x2ad40b)[_0x1993('0xd')](function(){for(var _0x9a0938=0x0;_0x9a0938<_0x2ad40b[_0x1993('0x1e')];_0x9a0938+=0x1){_0x467d9a[_0x1993('0x4d')](_0x1993('0x51'),{'MailInteractionId':Number(_0x2ad40b[_0x9a0938]),'UserId':Number(_0x473599['id'])});}});}})[_0x1993('0xd')](function(){if(_0x169b52===_0x1993('0x4f')){var _0x361a37=_[_0x1993('0x1b')](_0x473599[_0x1993('0x52')],'id');return _0x473599[_0x1993('0x53')](_0x361a37)[_0x1993('0xd')](function(){for(var _0x418928=0x0;_0x418928<_0x361a37[_0x1993('0x1e')];_0x418928+=0x1){_0x467d9a[_0x1993('0x4d')](_0x1993('0x54'),{'FaxInteractionId':Number(_0x361a37[_0x418928]),'UserId':Number(_0x473599['id'])});}});}})[_0x1993('0xd')](function(){if(_0x169b52===_0x1993('0x4f')){var _0x3c370f=_['map'](_0x473599[_0x1993('0x28')],'id');return _0x473599[_0x1993('0x55')](_0x3c370f)[_0x1993('0xd')](function(){for(var _0x46e179=0x0;_0x46e179<_0x3c370f['length'];_0x46e179+=0x1){_0x467d9a[_0x1993('0x4d')](_0x1993('0x56'),{'SmsInteractionId':Number(_0x3c370f[_0x46e179]),'UserId':Number(_0x473599['id'])});}});}})[_0x1993('0xd')](function(){if(_0x169b52==='leave'){var _0x13abbc=_[_0x1993('0x1b')](_0x473599[_0x1993('0x2a')],'id');return _0x473599[_0x1993('0x57')](_0x13abbc)[_0x1993('0xd')](function(){for(var _0x55cc11=0x0;_0x55cc11<_0x13abbc['length'];_0x55cc11+=0x1){_0x467d9a[_0x1993('0x4d')](_0x1993('0x58'),{'OpenchannelInteractionId':Number(_0x13abbc[_0x55cc11]),'UserId':Number(_0x473599['id'])});}});}})[_0x1993('0xd')](function(){if(_0x169b52==='leave'){var _0x48123c=_[_0x1993('0x1b')](_0x473599[_0x1993('0x2c')],'id');return _0x473599[_0x1993('0x59')](_0x48123c)['then'](function(){for(var _0x19c907=0x0;_0x19c907<_0x48123c[_0x1993('0x1e')];_0x19c907+=0x1){_0x467d9a[_0x1993('0x4d')](_0x1993('0x5a'),{'WhatsappInteractionId':Number(_0x48123c[_0x19c907]),'UserId':Number(_0x473599['id'])});}});}})[_0x1993('0x5b')](function(_0xee089e){_0xb27d2e[_0x1993('0x5c')](_0xee089e);});}}function onDisconnect(_0x1785a5,_0x652a5e){joinOrLeave(_0x1785a5,_0x1993('0x4f'),_0x652a5e);}function onConnect(_0x5dfa59){joinOrLeave(_0x5dfa59,'join');}exports[_0x1993('0x5d')]=function(_0x3b971c){_0x3b971c['on']('connection',function(_0x552666){_0x552666[_0x1993('0x5e')](0x0);_0x552666['address']=_0x552666[_0x1993('0x5f')]['connection']['remoteAddress']+':'+_0x552666[_0x1993('0x5f')][_0x1993('0x60')][_0x1993('0x61')];_0x552666[_0x1993('0x62')]=new Date();_0x552666[_0x1993('0x5c')]=function(_0x58ccba){console['log'](_0x1993('0x63')+_0x552666['nsp'][_0x1993('0x3')]+'['+_0x552666[_0x1993('0x64')]+']',_0x58ccba);};_0x552666['on'](_0x1993('0x65'),function(){onDisconnect(_0x552666,_0x3b971c);_0x552666[_0x1993('0x5c')](_0x1993('0x66'));});onConnect(_0x552666);_0x552666['log'](_0x1993('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ac1b7b1..3f72179 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 _0xd9fa=['motionChannel','then','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','format','SIP/%s','agent','incomingmessage','outgoingmessage','AfterCreateMessage','event','offlineMessage','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterCreate','changed','closed','substatus','interface','name','User','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','../../mysqldb','../logger','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','catch','get','channel'];(function(_0x32fb17,_0x10157b){var _0x161326=function(_0x5b23bf){while(--_0x5b23bf){_0x32fb17['push'](_0x32fb17['shift']());}};_0x161326(++_0x10157b);}(_0xd9fa,0x138));var _0xad9f=function(_0x4e4b71,_0x1e15f2){_0x4e4b71=_0x4e4b71-0x0;var _0x63ad89=_0xd9fa[_0x4e4b71];return _0x63ad89;};'use strict';var util=require('util');var db=require(_0xad9f('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0xad9f('0x1'))(_0xad9f('0x2'));var client=jayson[_0xad9f('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0xad9f('0x4'),'model':_0xad9f('0x5'),'event':_0xad9f('0x6'),'condition':_0xad9f('0x7'),'callback':afterCreate},{'channel':_0xad9f('0x4'),'model':'ChatInteraction','event':_0xad9f('0x8'),'condition':_0xad9f('0x9'),'callback':afterUpdate},{'channel':_0xad9f('0x4'),'model':_0xad9f('0xa'),'event':'afterCreate','condition':_0xad9f('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':_0xad9f('0x6'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xad9f('0xc'),'model':_0xad9f('0xd'),'event':_0xad9f('0x6'),'condition':_0xad9f('0x7'),'callback':afterCreate},{'channel':_0xad9f('0xc'),'model':_0xad9f('0xd'),'event':_0xad9f('0x8'),'condition':_0xad9f('0x9'),'callback':afterUpdate},{'channel':_0xad9f('0xc'),'model':_0xad9f('0xe'),'event':_0xad9f('0x6'),'condition':_0xad9f('0xb'),'callback':afterCreateMessage},{'channel':_0xad9f('0xf'),'model':_0xad9f('0x10'),'event':_0xad9f('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xad9f('0xf'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0xad9f('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xad9f('0x11'),'event':_0xad9f('0x6'),'condition':_0xad9f('0xb'),'callback':afterCreateMessage},{'channel':_0xad9f('0x12'),'model':_0xad9f('0x13'),'event':_0xad9f('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xad9f('0x12'),'model':_0xad9f('0x13'),'event':_0xad9f('0x8'),'condition':_0xad9f('0x9'),'callback':afterUpdate},{'channel':'Fax','model':_0xad9f('0x14'),'event':'afterCreate','condition':_0xad9f('0xb'),'callback':afterCreateMessage},{'channel':_0xad9f('0x15'),'model':_0xad9f('0x16'),'event':_0xad9f('0x6'),'condition':_0xad9f('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0xad9f('0x16'),'event':_0xad9f('0x8'),'condition':_0xad9f('0x9'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0xad9f('0x6'),'condition':_0xad9f('0xb'),'callback':afterCreateMessage},{'channel':_0xad9f('0x17'),'model':_0xad9f('0x18'),'event':_0xad9f('0x6'),'condition':_0xad9f('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0xad9f('0x18'),'event':_0xad9f('0x8'),'condition':_0xad9f('0x9'),'callback':afterUpdate},{'channel':_0xad9f('0x17'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0xad9f('0xb'),'callback':afterCreateMessage}];function request(_0x5a75d6){return client[_0xad9f('0x19')](_0xad9f('0x1a'),_0x5a75d6)['then'](function(_0x1ee6f8){logger[_0xad9f('0x1b')](_0xad9f('0x1c'),_0xad9f('0x1a'),_0x1ee6f8);if(_0x1ee6f8[_0xad9f('0x1d')]){if(_0x1ee6f8[_0xad9f('0x1d')]['code']===0x1f4){logger[_0xad9f('0x1d')](_0xad9f('0x1c'),_0xad9f('0x1a'),_0x1ee6f8[_0xad9f('0x1d')]);}}})[_0xad9f('0x1e')](function(_0x53d210){logger[_0xad9f('0x1d')]('Trigger,\x20%s',_0xad9f('0x1a'),_0x53d210);});}function afterCreateMessage(_0x5b0198){return function(_0x461067){_0x461067=_0x461067[_0xad9f('0x1f')]({'plain':!![]});_0x461067[_0xad9f('0x20')]=_0x5b0198;_0x461067[_0xad9f('0x21')]=_0x5b0198;_0x461067['event']=_0x461067['direction'];Promise['resolve']()[_0xad9f('0x22')](function(){if(typeof _0x461067['ContactId']==='undefined')return null;var _0x30de3c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x461067[_0xad9f('0x23')];return db[_0xad9f('0x24')][_0xad9f('0x25')](_0x30de3c,{'type':db[_0xad9f('0x26')][_0xad9f('0x27')][_0xad9f('0x28')],'raw':!![]});})[_0xad9f('0x22')](function(_0x1b1fd6){if(_0x1b1fd6){_0x461067[_0xad9f('0x29')]=_0x1b1fd6[0x0];}if(typeof _0x461067[_0xad9f('0x2a')]===_0xad9f('0x2b'))return;return getAgent(_0x461067[_0xad9f('0x2a')]);})[_0xad9f('0x22')](function(_0x4be97c){if(_0x4be97c){_0x461067['interface']=util[_0xad9f('0x2c')](_0xad9f('0x2d'),_0x4be97c['name']);_0x461067[_0xad9f('0x2e')]=_0x4be97c;_0x461067[_0xad9f('0x20')]=_0x5b0198;return request({'event':_0xad9f('0x2f'),'message':_0x461067});}else{return request({'event':_0xad9f('0x30'),'message':_0x461067});}})[_0xad9f('0x1e')](function(_0x56e0d8){logger[_0xad9f('0x1d')](_0xad9f('0x1c'),_0xad9f('0x31'),_0x56e0d8);});};}function afterCreateOfflineMessage(_0x27258e){return function(_0x4c16a5){_0x4c16a5=_0x4c16a5['get']({'plain':!![]});_0x4c16a5[_0xad9f('0x20')]=_0x27258e;_0x4c16a5[_0xad9f('0x21')]=_0x27258e;_0x4c16a5[_0xad9f('0x32')]=_0xad9f('0x33');return request({'event':_0x4c16a5[_0xad9f('0x32')],'message':_0x4c16a5});};}function afterCreate(_0x11dd17,_0x30cd9c){return function(_0x30abe9){_0x30abe9=_0x30abe9[_0xad9f('0x1f')]({'plain':!![]});_0x30abe9[_0xad9f('0x20')]=_0x11dd17;_0x30abe9[_0xad9f('0x21')]=_0x11dd17;_0x30abe9['event']=_0xad9f('0x34');Promise[_0xad9f('0x35')]()[_0xad9f('0x22')](function(){var _0x2f763f=_0xad9f('0x36')+_0x30abe9[_0xad9f('0x23')];return db['sequelize'][_0xad9f('0x25')](_0x2f763f,{'type':db[_0xad9f('0x26')][_0xad9f('0x27')][_0xad9f('0x28')],'raw':!![]});})['then'](function(_0x2e0273){if(_0x2e0273){_0x30abe9[_0xad9f('0x29')]=_0x2e0273[0x0];}if(typeof _0x30abe9['UserId']===_0xad9f('0x2b'))return;return getAgent(_0x30abe9['UserId']);})['then'](function(_0xd358b0){if(_0xd358b0){_0x30abe9['interface']=util['format'](_0xad9f('0x2d'),_0xd358b0['name']);_0x30abe9[_0xad9f('0x2e')]=_0xd358b0;}return request({'event':_0x30cd9c,'message':_0x30abe9});})[_0xad9f('0x1e')](function(_0x5c11ef){logger[_0xad9f('0x1d')](_0xad9f('0x1c'),_0xad9f('0x37'),_0x5c11ef);});};}function afterUpdate(_0x2c1fc0){return function(_0x2192e8){var _0x6b59cf=_0x2192e8[_0xad9f('0x38')](_0xad9f('0x39'))&&_0x2192e8[_0xad9f('0x39')];var _0x510bfe=_0x2192e8[_0xad9f('0x38')](_0xad9f('0x3a'));if(_0x6b59cf||_0x510bfe){var _0x441c8b=_0x6b59cf?_0xad9f('0x9'):_0xad9f('0x3a');var _0x7f8f05=_0x2192e8[_0xad9f('0x1f')]({'plain':!![]});_0x7f8f05[_0xad9f('0x20')]=_0x2c1fc0;_0x7f8f05[_0xad9f('0x21')]=_0x2c1fc0;_0x7f8f05[_0xad9f('0x32')]=_0x6b59cf?_0xad9f('0x39'):_0xad9f('0x3a');var _0x176f72='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7f8f05[_0xad9f('0x23')];return db[_0xad9f('0x24')][_0xad9f('0x25')](_0x176f72,{'type':db[_0xad9f('0x26')][_0xad9f('0x27')][_0xad9f('0x28')],'raw':!![]})[_0xad9f('0x22')](function(_0x5a6bce){if(_0x5a6bce){_0x7f8f05[_0xad9f('0x29')]=_0x5a6bce[0x0];}if(typeof _0x7f8f05[_0xad9f('0x2a')]===_0xad9f('0x2b'))return;return getAgent(_0x7f8f05[_0xad9f('0x2a')]);})[_0xad9f('0x22')](function(_0x495ad2){if(_0x495ad2){_0x7f8f05[_0xad9f('0x3b')]=util[_0xad9f('0x2c')](_0xad9f('0x2d'),_0x495ad2[_0xad9f('0x3c')]);_0x7f8f05[_0xad9f('0x2e')]=_0x495ad2;}return request({'event':_0x441c8b,'message':_0x7f8f05});})[_0xad9f('0x1e')](function(_0x591080){logger[_0xad9f('0x1d')]('Trigger,\x20%s','AfterUpdate',_0x591080);});}};}function getAgent(_0x4baf0d){return db[_0xad9f('0x3d')]['find']({'where':{'id':_0x4baf0d},'attributes':['id',_0xad9f('0x3c'),'fullname','email','internal'],'raw':!![]})[_0xad9f('0x22')](function(_0x9103f5){return _0x9103f5;});}exports[_0xad9f('0x3e')]=function(){for(var _0x4a552c=0x0;_0x4a552c=_0x4da01f['agents']){throw Error(_0x4aad('0x10'));}_0x3e6f10(_0x326b7c);})[_0x4aad('0x11')](function(_0x534d22){_0x4f8d88(_0x534d22);});});}; \ No newline at end of file +var _0xb744=['./license/util','voice','mail','chat','sms','whatsapp','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','agents','bluebird'];(function(_0x3652dc,_0x49b6dc){var _0x33dbcd=function(_0xac9af6){while(--_0xac9af6){_0x3652dc['push'](_0x3652dc['shift']());}};_0x33dbcd(++_0x49b6dc);}(_0xb744,0x1f3));var _0x4b74=function(_0x35843a,_0x4862aa){_0x35843a=_0x35843a-0x0;var _0x8b1f8e=_0xb744[_0x35843a];return _0x8b1f8e;};'use strict';var _=require('lodash');var BPromise=require(_0x4b74('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x4b74('0x1'));var channels=[_0x4b74('0x2'),_0x4b74('0x3'),_0x4b74('0x4'),'fax',_0x4b74('0x5'),_0x4b74('0x6'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0x4b74('0x7')]=function(_0x30984e){_0x30984e=_0x30984e[_0x4b74('0x8')]();return _[_0x4b74('0x9')](channels,_0x30984e);};exports[_0x4b74('0xa')]=function(_0x166a69,_0x5cd550,_0xf23eda,_0x1da376){var _0x33c37b={'loginAttempts':_0x5cd550,'blocked':_0xf23eda};if(!_[_0x4b74('0xb')](_0x1da376)){_0x33c37b[_0x4b74('0xc')]=_0x1da376;}return _0x166a69[_0x4b74('0xd')](_0x33c37b);};exports[_0x4b74('0xe')]=function(_0x3dc423){return new BPromise(function(_0x1e205f,_0x5f0dda){var _0x402946=0x0;if(_0x3dc423[_0x4b74('0xf')]!==_0x4b74('0x10')){_0x1e205f(_0x3dc423);}db[_0x4b74('0x11')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3dc423['id']}}})[_0x4b74('0x12')](function(_0x13cd4f){_0x402946=_0x13cd4f;return util[_0x4b74('0xe')]();})['then'](function(_0x266b65){if(_0x266b65&&_0x266b65[_0x4b74('0x13')]&&_0x402946>=_0x266b65['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1e205f(_0x3dc423);})['catch'](function(_0x511f94){_0x5f0dda(_0x511f94);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 40a6bfa..91fd685 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef96=['message','Error','Bad\x20Request','name','inherits','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','details','OutOfInterval','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','send','exports','util','../config/logger','api'];(function(_0x43ceb7,_0x20ed3c){var _0x4bfee7=function(_0x43f666){while(--_0x43f666){_0x43ceb7['push'](_0x43ceb7['shift']());}};_0x4bfee7(++_0x20ed3c);}(_0xef96,0x162));var _0x6ef9=function(_0x2d43c3,_0x1388b9){_0x2d43c3=_0x2d43c3-0x0;var _0x5dd447=_0xef96[_0x2d43c3];return _0x5dd447;};'use strict';var util=require(_0x6ef9('0x0'));var logger=require(_0x6ef9('0x1'))(_0x6ef9('0x2'));var APIError=function(_0x3e7456,_0x18a22e){this[_0x6ef9('0x3')]=_0x3e7456||'Internal\x20Server\x20Error';this['name']=_0x18a22e||_0x6ef9('0x4');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x500b0c){this[_0x6ef9('0x3')]=_0x500b0c||_0x6ef9('0x5');this[_0x6ef9('0x6')]='Bad\x20Request';util[_0x6ef9('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8945){this[_0x6ef9('0x3')]=_0x5c8945||_0x6ef9('0x8');this[_0x6ef9('0x6')]='Not\x20Found';util[_0x6ef9('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4ccb23){this[_0x6ef9('0x3')]=_0x4ccb23||_0x6ef9('0x9');this[_0x6ef9('0x6')]='Out\x20Of\x20Interval';this[_0x6ef9('0xa')]=0x193;this[_0x6ef9('0xb')]={'type':_0x6ef9('0xc')};util[_0x6ef9('0x7')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4f68f2){switch(_0x4f68f2){case _0x6ef9('0x5'):return 0x190;case _0x6ef9('0xd'),_0x6ef9('0xe'):return 0x193;case _0x6ef9('0xf'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2d26ac){if(_0x2d26ac===_0x6ef9('0xe'))return _0x2d26ac;return null;}function handleError(_0x41928e){return function(_0x5e2fc1){logger[_0x6ef9('0x10')](_0x5e2fc1[_0x6ef9('0x11')]);var _0x1f3793=getStatusCode(_0x5e2fc1[_0x6ef9('0x6')]);var _0xce5672=getCustomStatusMessage(_0x5e2fc1[_0x6ef9('0x6')]);if(_0x5e2fc1[_0x6ef9('0x6')]){delete _0x5e2fc1[_0x6ef9('0x6')];}if(_0xce5672){_0x41928e[_0x6ef9('0x12')]=_0xce5672;}return _0x41928e['status'](_0x1f3793)[_0x6ef9('0x13')](_0x5e2fc1);};}module[_0x6ef9('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'handleError':handleError}; \ No newline at end of file +var _0x3dba=['message','Bad\x20Request','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Forbidden','Not\x20Found','error','statusMessage','status','send','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x88cb5e,_0x97fdf1){var _0x6a0b8a=function(_0xe9e94b){while(--_0xe9e94b){_0x88cb5e['push'](_0x88cb5e['shift']());}};_0x6a0b8a(++_0x97fdf1);}(_0x3dba,0x73));var _0xa3db=function(_0x5525a7,_0x3437c2){_0x5525a7=_0x5525a7-0x0;var _0x3503dc=_0x3dba[_0x5525a7];return _0x3503dc;};'use strict';var util=require('util');var logger=require('../config/logger')('api');var APIError=function(_0x25003e,_0x182106){this['message']=_0x25003e||_0xa3db('0x0');this[_0xa3db('0x1')]=_0x182106||_0xa3db('0x2');util[_0xa3db('0x3')](APIError,Error);};var APIBadRequestError=function(_0x15fbf8){this[_0xa3db('0x4')]=_0x15fbf8||_0xa3db('0x5');this['name']='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x4f77df){this[_0xa3db('0x4')]=_0x4f77df||'Entity\x20not\x20found';this['name']='Not\x20Found';util[_0xa3db('0x3')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1d68f6){this[_0xa3db('0x4')]=_0x1d68f6||_0xa3db('0x6');this[_0xa3db('0x1')]=_0xa3db('0x7');this[_0xa3db('0x8')]=0x193;this[_0xa3db('0x9')]={'type':_0xa3db('0xa')};util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x401e9b){switch(_0x401e9b){case _0xa3db('0x5'):return 0x190;case _0xa3db('0xb'),_0xa3db('0x7'):return 0x193;case _0xa3db('0xc'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x38edf7){if(_0x38edf7==='Out\x20Of\x20Interval')return _0x38edf7;return null;}function handleError(_0x5a3c52){return function(_0x221695){logger[_0xa3db('0xd')](_0x221695['stack']);var _0x3da006=getStatusCode(_0x221695[_0xa3db('0x1')]);var _0xb75bcc=getCustomStatusMessage(_0x221695[_0xa3db('0x1')]);if(_0x221695[_0xa3db('0x1')]){delete _0x221695[_0xa3db('0x1')];}if(_0xb75bcc){_0x5a3c52[_0xa3db('0xe')]=_0xb75bcc;}return _0x5a3c52[_0xa3db('0xf')](_0x3da006)[_0xa3db('0x10')](_0x221695);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 682caec..510283c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2d0=['send','404','status','render','json'];(function(_0x208a85,_0x148862){var _0xe2cc29=function(_0x2171e1){while(--_0x2171e1){_0x208a85['push'](_0x208a85['shift']());}};_0xe2cc29(++_0x148862);}(_0xf2d0,0x137));var _0x0f2d=function(_0x5d79f7,_0x15cc21){_0x5d79f7=_0x5d79f7-0x0;var _0x30ec31=_0xf2d0[_0x5d79f7];return _0x30ec31;};'use strict';module['exports'][0x194]=function pageNotFound(_0x118153,_0x28a869){var _0x155898=_0x0f2d('0x0');var _0x19305c=0x194;var _0x444d5a={'status':_0x19305c};_0x28a869[_0x0f2d('0x1')](_0x444d5a[_0x0f2d('0x1')]);_0x28a869[_0x0f2d('0x2')](_0x155898,{},function(_0x57020c,_0x27e73f){if(_0x57020c){return _0x28a869[_0x0f2d('0x1')](_0x444d5a[_0x0f2d('0x1')])[_0x0f2d('0x3')](_0x444d5a);}_0x28a869[_0x0f2d('0x4')](_0x27e73f);});}; \ No newline at end of file +var _0xe84b=['json','send','exports','404','status'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xe84b,0x1ab));var _0xbe84=function(_0x514562,_0x8c8266){_0x514562=_0x514562-0x0;var _0x3da165=_0xe84b[_0x514562];return _0x3da165;};'use strict';module[_0xbe84('0x0')][0x194]=function pageNotFound(_0x551af5,_0x4a3a2b){var _0x33f059=_0xbe84('0x1');var _0x14918d=0x194;var _0x254ed9={'status':_0x14918d};_0x4a3a2b[_0xbe84('0x2')](_0x254ed9[_0xbe84('0x2')]);_0x4a3a2b['render'](_0x33f059,{},function(_0x1161ac,_0x3d3e9d){if(_0x1161ac){return _0x4a3a2b[_0xbe84('0x2')](_0x254ed9[_0xbe84('0x2')])[_0xbe84('0x3')](_0x254ed9);}_0x4a3a2b[_0xbe84('0x4')](_0x3d3e9d);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 7b7f281..679782d 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index aeda20f..9c8bdcd 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd032=['join','/demo','snippet','3.7.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./api/client-side-logs','default','then','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static'];(function(_0xce2442,_0xc56943){var _0x5d5f61=function(_0x343186){while(--_0x343186){_0xce2442['push'](_0xce2442['shift']());}};_0x5d5f61(++_0xc56943);}(_0xd032,0x113));var _0x2d03=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd032[_0x413feb];return _0x40ee88;};'use strict';var path=require(_0x2d03('0x0'));var express=require(_0x2d03('0x1'));var errors=require(_0x2d03('0x2'));var config=require(_0x2d03('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x2d03('0x4'));exports[_0x2d03('0x5')]=function(_0x1bddc2){return setupLoggers(_0x1bddc2)[_0x2d03('0x6')](function(){_0x1bddc2[_0x2d03('0x7')]('/api/users',require('./api/user'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8'),require(_0x2d03('0x9')));_0x1bddc2['use']('/api/voice/contexts',require(_0x2d03('0xa')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb'),require(_0x2d03('0xc')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xd'),require(_0x2d03('0xe')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf'),require('./api/voiceQueue'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x10'),require(_0x2d03('0x11')));_0x1bddc2['use'](_0x2d03('0x12'),require(_0x2d03('0x13')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x14'),require('./api/voiceMail'));_0x1bddc2[_0x2d03('0x7')]('/api/voice/mails/messages',require(_0x2d03('0x15')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x16'),require(_0x2d03('0x17')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x18'),require('./api/voiceDialReport'));_0x1bddc2['use'](_0x2d03('0x19'),require('./api/voiceAgentReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1a'),require(_0x2d03('0x1b')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1c'),require('./api/memberReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1d'),require(_0x2d03('0x1e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x1f'),require('./api/voiceTransferReport'));_0x1bddc2[_0x2d03('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x1bddc2[_0x2d03('0x7')]('/api/mail/accounts',require('./api/mailAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x20'),require(_0x2d03('0x21')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x22'),require(_0x2d03('0x23')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x24'),require(_0x2d03('0x25')));_0x1bddc2[_0x2d03('0x7')]('/api/mail/messages',require('./api/mailMessage'));_0x1bddc2[_0x2d03('0x7')]('/api/mail/applications',require(_0x2d03('0x26')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x27'),require(_0x2d03('0x28')));_0x1bddc2[_0x2d03('0x7')]('/api/dashboards',require(_0x2d03('0x29')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x2a'),require(_0x2d03('0x2b')));_0x1bddc2[_0x2d03('0x7')]('/api/fax/accounts',require(_0x2d03('0x2c')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x2d'),require(_0x2d03('0x2e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x2f'),require(_0x2d03('0x30')));_0x1bddc2['use'](_0x2d03('0x31'),require(_0x2d03('0x32')));_0x1bddc2['use'](_0x2d03('0x33'),require(_0x2d03('0x34')));_0x1bddc2[_0x2d03('0x7')]('/api/fax/reports/queue',require(_0x2d03('0x35')));_0x1bddc2[_0x2d03('0x7')]('/api/sms/accounts',require(_0x2d03('0x36')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x37'),require(_0x2d03('0x38')));_0x1bddc2[_0x2d03('0x7')]('/api/sms/interactions',require(_0x2d03('0x39')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x3a'),require('./api/smsMessage'));_0x1bddc2['use']('/api/sms/queues',require(_0x2d03('0x3b')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x3c'),require(_0x2d03('0x3d')));_0x1bddc2['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x3e'),require(_0x2d03('0x3f')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x40'),require(_0x2d03('0x41')));_0x1bddc2['use'](_0x2d03('0x42'),require(_0x2d03('0x43')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/websites',require(_0x2d03('0x44')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x45'),require(_0x2d03('0x46')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x1bddc2['use'](_0x2d03('0x47'),require(_0x2d03('0x48')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x49'),require(_0x2d03('0x4a')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/offline_messages',require(_0x2d03('0x4b')));_0x1bddc2[_0x2d03('0x7')]('/api/chat/queues',require(_0x2d03('0x4c')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x4d'),require(_0x2d03('0x4e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x4f'),require(_0x2d03('0x50')));_0x1bddc2['use'](_0x2d03('0x51'),require(_0x2d03('0x52')));_0x1bddc2['use'](_0x2d03('0x53'),require(_0x2d03('0x54')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x55'),require(_0x2d03('0x56')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x57'),require(_0x2d03('0x58')));_0x1bddc2['use'](_0x2d03('0x59'),require('./api/cmHopperFinal'));_0x1bddc2[_0x2d03('0x7')]('/api/cm/hopper_history',require(_0x2d03('0x5a')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x5b'),require(_0x2d03('0x5c')));_0x1bddc2[_0x2d03('0x7')]('/api/actions',require('./api/action'));_0x1bddc2['use']('/api/automations',require(_0x2d03('0x5d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x5e'),require(_0x2d03('0x5f')));_0x1bddc2['use'](_0x2d03('0x60'),require(_0x2d03('0x61')));_0x1bddc2[_0x2d03('0x7')]('/api/conditions',require(_0x2d03('0x62')));_0x1bddc2[_0x2d03('0x7')]('/api/intervals',require(_0x2d03('0x63')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x64'),require(_0x2d03('0x65')));_0x1bddc2['use'](_0x2d03('0x66'),require(_0x2d03('0x67')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x68'),require('./api/voiceQueuesLog'));_0x1bddc2['use'](_0x2d03('0x69'),require('./api/schedule'));_0x1bddc2['use']('/api/sounds',require('./api/sound'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6a'),require('./api/tag'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6b'),require('./api/contactItemType'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6c'),require(_0x2d03('0x6d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x6e'),require(_0x2d03('0x6f')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x70'),require(_0x2d03('0x71')));_0x1bddc2[_0x2d03('0x7')]('/api/triggers',require(_0x2d03('0x72')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x73'),require(_0x2d03('0x74')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x75'),require(_0x2d03('0x76')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x77'),require(_0x2d03('0x78')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x79'),require(_0x2d03('0x7a')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x7b'),require(_0x2d03('0x7c')));_0x1bddc2[_0x2d03('0x7')]('/api/analytics/extracted_reports',require(_0x2d03('0x7d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x7e'),require(_0x2d03('0x7f')));_0x1bddc2[_0x2d03('0x7')]('/api/analytics/field_reports',require(_0x2d03('0x80')));_0x1bddc2['use'](_0x2d03('0x81'),require(_0x2d03('0x82')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x83'),require(_0x2d03('0x84')));_0x1bddc2['use'](_0x2d03('0x85'),require(_0x2d03('0x86')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x87'),require(_0x2d03('0x88')));_0x1bddc2['use'](_0x2d03('0x89'),require(_0x2d03('0x8a')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8b'),require('./api/intSugarcrmConfiguration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8c'),require(_0x2d03('0x8d')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8e'),require('./api/intDeskAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x8f'),require('./api/intDeskConfiguration'));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/desk/fields',require(_0x2d03('0x90')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x91'),require(_0x2d03('0x92')));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/zoho/configurations',require(_0x2d03('0x93')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x94'),require('./api/intZohoField'));_0x1bddc2['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x95'),require(_0x2d03('0x96')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x97'),require(_0x2d03('0x98')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x99'),require(_0x2d03('0x9a')));_0x1bddc2['use']('/api/integrations/freshdesk/configurations',require(_0x2d03('0x9b')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x9c'),require('./api/intFreshdeskField'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x9d'),require(_0x2d03('0x9e')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x9f'),require('./api/intVtigerConfiguration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xa0'),require('./api/intVtigerField'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xa1'),require(_0x2d03('0xa2')));_0x1bddc2['use'](_0x2d03('0xa3'),require(_0x2d03('0xa4')));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x1bddc2['use'](_0x2d03('0xa5'),require(_0x2d03('0xa6')));_0x1bddc2[_0x2d03('0x7')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xa7'),require(_0x2d03('0xa8')));_0x1bddc2['use'](_0x2d03('0xa9'),require(_0x2d03('0xaa')));_0x1bddc2['use'](_0x2d03('0xab'),require('./api/intFreshsalesConfiguration'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xac'),require('./api/intFreshsalesField'));_0x1bddc2[_0x2d03('0x7')]('/api/networks',require(_0x2d03('0xad')));_0x1bddc2['use'](_0x2d03('0xae'),require('./api/chatQueueReport'));_0x1bddc2['use'](_0x2d03('0xaf'),require('./api/chatInternalMessage'));_0x1bddc2['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x1bddc2[_0x2d03('0x7')]('/api/jscripty/questions/reports',require(_0x2d03('0xb0')));_0x1bddc2[_0x2d03('0x7')]('/api/jscripty/sessions/reports',require(_0x2d03('0xb1')));_0x1bddc2[_0x2d03('0x7')]('/api/sms/reports/queue',require(_0x2d03('0xb2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb3'),require(_0x2d03('0xb4')));_0x1bddc2[_0x2d03('0x7')]('/api/square/details/reports',require(_0x2d03('0xb5')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb6'),require(_0x2d03('0xb7')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xb8'),require(_0x2d03('0xb9')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xba'),require(_0x2d03('0xbb')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xbc'),require('./api/squareProject'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xbd'),require(_0x2d03('0xbe')));_0x1bddc2[_0x2d03('0x7')]('/api/square/messages',require(_0x2d03('0xbf')));_0x1bddc2['use']('/api/teams',require(_0x2d03('0xc0')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc1'),require(_0x2d03('0xc2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc3'),require(_0x2d03('0xc4')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc5'),require(_0x2d03('0xc6')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xc7'),require(_0x2d03('0xc8')));_0x1bddc2[_0x2d03('0x7')]('/api/plugins',require(_0x2d03('0xc9')));_0x1bddc2['use'](_0x2d03('0xca'),require('./api/mailTransferReport'));_0x1bddc2['use'](_0x2d03('0xcb'),require('./api/chatTransferReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xcc'),require(_0x2d03('0xcd')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xce'),require('./api/openchannelTransferReport'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xcf'),require(_0x2d03('0xd0')));_0x1bddc2['use'](_0x2d03('0xd1'),require(_0x2d03('0xd2')));_0x1bddc2[_0x2d03('0x7')]('/api/voice/prefixes',require(_0x2d03('0xd3')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xd4'),require(_0x2d03('0xd5')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xd6'),require(_0x2d03('0xd7')));_0x1bddc2['use'](_0x2d03('0xd8'),require(_0x2d03('0xd9')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xda'),require(_0x2d03('0xdb')));_0x1bddc2[_0x2d03('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xdc'),require(_0x2d03('0xdd')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xde'),require(_0x2d03('0xdf')));_0x1bddc2[_0x2d03('0x7')]('/api/whatsapp/messages',require(_0x2d03('0xe0')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xe1'),require(_0x2d03('0xe2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xe3'),require(_0x2d03('0xe4')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xe5'),require('./api/whatsappQueue'));_0x1bddc2['use'](_0x2d03('0xe6'),require(_0x2d03('0xe7')));_0x1bddc2['use'](_0x2d03('0xe8'),require(_0x2d03('0xe9')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xea'),require(_0x2d03('0xeb')));_0x1bddc2['use']('/api/auth/local',require(_0x2d03('0xec')));_0x1bddc2[_0x2d03('0x7')]('/api/auth/google',require(_0x2d03('0xed')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xee'),require(_0x2d03('0xef')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf0'),require('./api/jira'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf1'),require(_0x2d03('0xf2')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf3'),require('./api/version'));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf4'),require(_0x2d03('0xf5')));_0x1bddc2[_0x2d03('0x7')]('/api/pm2',require(_0x2d03('0xf6')));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf7'),require(_0x2d03('0xf8')));_0x1bddc2['use']('/api/logs',clientSideLogs);_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xf9'),express['static'](path['join'](config[_0x2d03('0xfa')],_0x2d03('0xf9'))));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xfb'),express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0xfb'))));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0xfe'),express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0xfe'))));_0x1bddc2[_0x2d03('0x7')]('/snippet',express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0xff'),_0x2d03('0x100'))));_0x1bddc2[_0x2d03('0x7')](_0x2d03('0x101'),express[_0x2d03('0xfc')](path[_0x2d03('0xfd')](config[_0x2d03('0xfa')],_0x2d03('0x102'))));_0x1bddc2['route'](_0x2d03('0x103'))[_0x2d03('0x104')](errors[0x194]);_0x1bddc2['route']('/*')['get'](function(_0x27c3a8,_0x37e081){_0x37e081[_0x2d03('0x105')](path[_0x2d03('0x106')](_0x1bddc2[_0x2d03('0x104')]('appPath')+_0x2d03('0x107')));});return _0x1bddc2;});}; \ No newline at end of file +var _0xa8a2=['/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperHistory','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.7.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0xa8a2,0x1c8));var _0x2a8a=function(_0x27f515,_0x36ef6e){_0x27f515=_0x27f515-0x0;var _0x50c7d9=_0xa8a2[_0x27f515];return _0x50c7d9;};'use strict';var path=require(_0x2a8a('0x0'));var express=require(_0x2a8a('0x1'));var errors=require(_0x2a8a('0x2'));var config=require(_0x2a8a('0x3'));var setupLoggers=require(_0x2a8a('0x4'))['setupLoggers'];var clientSideLogs=require(_0x2a8a('0x5'));exports[_0x2a8a('0x6')]=function(_0x363ec4){return setupLoggers(_0x363ec4)[_0x2a8a('0x7')](function(){_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x9'),require('./api/user'));_0x363ec4['use'](_0x2a8a('0xa'),require(_0x2a8a('0xb')));_0x363ec4[_0x2a8a('0x8')]('/api/voice/contexts',require('./api/voiceContext'));_0x363ec4['use'](_0x2a8a('0xc'),require(_0x2a8a('0xd')));_0x363ec4['use'](_0x2a8a('0xe'),require(_0x2a8a('0xf')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x10'),require(_0x2a8a('0x11')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x12'),require(_0x2a8a('0x13')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x14'),require('./api/screenRecording'));_0x363ec4['use']('/api/voice/mails',require('./api/voiceMail'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x15'),require('./api/voiceMailMessage'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x16'),require('./api/voiceCallReport'));_0x363ec4[_0x2a8a('0x8')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x17'),require(_0x2a8a('0x18')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x19'),require(_0x2a8a('0x1a')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x1b'),require(_0x2a8a('0x1c')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x1d'),require(_0x2a8a('0x1e')));_0x363ec4['use'](_0x2a8a('0x1f'),require(_0x2a8a('0x20')));_0x363ec4['use'](_0x2a8a('0x21'),require(_0x2a8a('0x22')));_0x363ec4['use']('/api/mail/accounts',require('./api/mailAccount'));_0x363ec4['use'](_0x2a8a('0x23'),require('./api/mailQueue'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x24'),require(_0x2a8a('0x25')));_0x363ec4['use'](_0x2a8a('0x26'),require('./api/mailInteraction'));_0x363ec4[_0x2a8a('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x363ec4[_0x2a8a('0x8')]('/api/mail/applications',require(_0x2a8a('0x27')));_0x363ec4['use'](_0x2a8a('0x28'),require(_0x2a8a('0x29')));_0x363ec4[_0x2a8a('0x8')]('/api/dashboards',require(_0x2a8a('0x2a')));_0x363ec4['use'](_0x2a8a('0x2b'),require(_0x2a8a('0x2c')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x2d'),require(_0x2a8a('0x2e')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x2f'),require('./api/faxApplication'));_0x363ec4['use'](_0x2a8a('0x30'),require(_0x2a8a('0x31')));_0x363ec4['use'](_0x2a8a('0x32'),require(_0x2a8a('0x33')));_0x363ec4[_0x2a8a('0x8')]('/api/fax/queues',require(_0x2a8a('0x34')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x35'),require(_0x2a8a('0x36')));_0x363ec4[_0x2a8a('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x37'),require(_0x2a8a('0x38')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x39'),require('./api/smsInteraction'));_0x363ec4[_0x2a8a('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x3a'),require('./api/smsQueue'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x3b'),require(_0x2a8a('0x3c')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x3d'),require(_0x2a8a('0x3e')));_0x363ec4[_0x2a8a('0x8')]('/api/openchannel/interactions',require(_0x2a8a('0x3f')));_0x363ec4['use'](_0x2a8a('0x40'),require(_0x2a8a('0x41')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x42'),require('./api/openchannelQueue'));_0x363ec4['use'](_0x2a8a('0x43'),require(_0x2a8a('0x44')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x45'),require('./api/openchannelQueueReport'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x46'),require('./api/chatApplication'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x47'),require('./api/chatInteraction'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x48'),require(_0x2a8a('0x49')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x4a'),require(_0x2a8a('0x4b')));_0x363ec4['use'](_0x2a8a('0x4c'),require(_0x2a8a('0x4d')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x4e'),require(_0x2a8a('0x4f')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x50'),require(_0x2a8a('0x51')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x52'),require(_0x2a8a('0x53')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x54'),require(_0x2a8a('0x55')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x56'),require(_0x2a8a('0x57')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x58'),require(_0x2a8a('0x59')));_0x363ec4[_0x2a8a('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x363ec4['use']('/api/cm/hopper_history',require(_0x2a8a('0x5a')));_0x363ec4['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x5b'),require(_0x2a8a('0x5c')));_0x363ec4['use']('/api/automations',require('./api/automation'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x5d'),require(_0x2a8a('0x5e')));_0x363ec4['use']('/api/dispositions',require(_0x2a8a('0x5f')));_0x363ec4['use'](_0x2a8a('0x60'),require(_0x2a8a('0x61')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x62'),require(_0x2a8a('0x63')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x64'),require('./api/pause'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x65'),require('./api/cdr'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x66'),require('./api/voiceQueuesLog'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x67'),require(_0x2a8a('0x68')));_0x363ec4[_0x2a8a('0x8')]('/api/sounds',require(_0x2a8a('0x69')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x6a'),require('./api/tag'));_0x363ec4[_0x2a8a('0x8')]('/api/contact_item_types',require(_0x2a8a('0x6b')));_0x363ec4['use'](_0x2a8a('0x6c'),require(_0x2a8a('0x6d')));_0x363ec4['use'](_0x2a8a('0x6e'),require(_0x2a8a('0x6f')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x70'),require(_0x2a8a('0x71')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x72'),require(_0x2a8a('0x73')));_0x363ec4['use'](_0x2a8a('0x74'),require(_0x2a8a('0x75')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x76'),require(_0x2a8a('0x77')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x78'),require(_0x2a8a('0x79')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x7a'),require(_0x2a8a('0x7b')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x7c'),require('./api/analyticDefaultReport'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x7d'),require(_0x2a8a('0x7e')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x7f'),require(_0x2a8a('0x80')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x81'),require(_0x2a8a('0x82')));_0x363ec4['use'](_0x2a8a('0x83'),require('./api/analyticTreeReport'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x84'),require(_0x2a8a('0x85')));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/salesforce/configurations',require(_0x2a8a('0x86')));_0x363ec4['use'](_0x2a8a('0x87'),require(_0x2a8a('0x88')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x89'),require(_0x2a8a('0x8a')));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/sugarcrm/configurations',require(_0x2a8a('0x8b')));_0x363ec4['use'](_0x2a8a('0x8c'),require(_0x2a8a('0x8d')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x8e'),require('./api/intDeskAccount'));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/desk/configurations',require(_0x2a8a('0x8f')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x90'),require(_0x2a8a('0x91')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x92'),require(_0x2a8a('0x93')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x94'),require(_0x2a8a('0x95')));_0x363ec4['use'](_0x2a8a('0x96'),require(_0x2a8a('0x97')));_0x363ec4['use'](_0x2a8a('0x98'),require(_0x2a8a('0x99')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x9a'),require(_0x2a8a('0x9b')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x9c'),require('./api/intZendeskField'));_0x363ec4['use'](_0x2a8a('0x9d'),require(_0x2a8a('0x9e')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x9f'),require('./api/intFreshdeskConfiguration'));_0x363ec4['use']('/api/integrations/freshdesk/fields',require(_0x2a8a('0xa0')));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xa1'),require(_0x2a8a('0xa2')));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/vtiger/fields',require(_0x2a8a('0xa3')));_0x363ec4['use'](_0x2a8a('0xa4'),require(_0x2a8a('0xa5')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xa6'),require(_0x2a8a('0xa7')));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/dynamics365/accounts',require(_0x2a8a('0xa8')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xa9'),require(_0x2a8a('0xaa')));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/dynamics365/fields',require(_0x2a8a('0xab')));_0x363ec4[_0x2a8a('0x8')]('/api/integrations/freshsales/accounts',require(_0x2a8a('0xac')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xad'),require('./api/intFreshsalesConfiguration'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xae'),require(_0x2a8a('0xaf')));_0x363ec4['use'](_0x2a8a('0xb0'),require(_0x2a8a('0xb1')));_0x363ec4[_0x2a8a('0x8')]('/api/chat/reports/queue',require(_0x2a8a('0xb2')));_0x363ec4[_0x2a8a('0x8')]('/api/chat/internal/messages',require(_0x2a8a('0xb3')));_0x363ec4[_0x2a8a('0x8')]('/api/jscripty/answers/reports',require(_0x2a8a('0xb4')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xb5'),require(_0x2a8a('0xb6')));_0x363ec4['use'](_0x2a8a('0xb7'),require(_0x2a8a('0xb8')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xb9'),require(_0x2a8a('0xba')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xbb'),require('./api/squareReport'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xbc'),require(_0x2a8a('0xbd')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xbe'),require(_0x2a8a('0xbf')));_0x363ec4['use'](_0x2a8a('0xc0'),require(_0x2a8a('0xc1')));_0x363ec4['use'](_0x2a8a('0xc2'),require(_0x2a8a('0xc3')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xc4'),require(_0x2a8a('0xc5')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xc6'),require(_0x2a8a('0xc7')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xc8'),require(_0x2a8a('0xc9')));_0x363ec4[_0x2a8a('0x8')]('/api/teams',require('./api/team'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xca'),require(_0x2a8a('0xcb')));_0x363ec4['use'](_0x2a8a('0xcc'),require(_0x2a8a('0xcd')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xce'),require(_0x2a8a('0xcf')));_0x363ec4[_0x2a8a('0x8')]('/api/attachments',require(_0x2a8a('0xd0')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xd1'),require(_0x2a8a('0xd2')));_0x363ec4[_0x2a8a('0x8')]('/api/mail/reports/transfer',require(_0x2a8a('0xd3')));_0x363ec4['use'](_0x2a8a('0xd4'),require(_0x2a8a('0xd5')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xd6'),require('./api/faxTransferReport'));_0x363ec4[_0x2a8a('0x8')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xd7'),require(_0x2a8a('0xd8')));_0x363ec4[_0x2a8a('0x8')]('/api/cm/lists',require('./api/cmList'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xd9'),require(_0x2a8a('0xda')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xdb'),require(_0x2a8a('0xdc')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xdd'),require(_0x2a8a('0xde')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xdf'),require('./api/userProfileResource'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xe0'),require(_0x2a8a('0xe1')));_0x363ec4['use'](_0x2a8a('0xe2'),require(_0x2a8a('0xe3')));_0x363ec4['use'](_0x2a8a('0xe4'),require('./api/whatsappApplication'));_0x363ec4['use'](_0x2a8a('0xe5'),require('./api/whatsappInteraction'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xe6'),require('./api/whatsappMessage'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xe7'),require(_0x2a8a('0xe8')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xe9'),require(_0x2a8a('0xea')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xeb'),require(_0x2a8a('0xec')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xed'),require('./api/cloudProvider'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xee'),require(_0x2a8a('0xef')));_0x363ec4[_0x2a8a('0x8')]('/api/user-settings',require('./api/user-setting'));_0x363ec4[_0x2a8a('0x8')]('/api/auth/local',require('./api/authLocal'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xf0'),require('./api/authGoogle'));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xf1'),require(_0x2a8a('0xf2')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xf3'),require(_0x2a8a('0xf4')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xf5'),require(_0x2a8a('0xf6')));_0x363ec4[_0x2a8a('0x8')]('/api/version',require(_0x2a8a('0xf7')));_0x363ec4['use'](_0x2a8a('0xf8'),require(_0x2a8a('0xf9')));_0x363ec4[_0x2a8a('0x8')]('/api/pm2',require(_0x2a8a('0xfa')));_0x363ec4['use'](_0x2a8a('0xfb'),require(_0x2a8a('0xfc')));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0xfd'),clientSideLogs);_0x363ec4[_0x2a8a('0x8')]('/apidoc',express[_0x2a8a('0xfe')](path[_0x2a8a('0xff')](config[_0x2a8a('0x100')],_0x2a8a('0x101'))));_0x363ec4['use'](_0x2a8a('0x102'),express['static'](path[_0x2a8a('0xff')](config[_0x2a8a('0x100')],_0x2a8a('0x102'))));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x103'),express[_0x2a8a('0xfe')](path[_0x2a8a('0xff')](config[_0x2a8a('0x100')],'/demo')));_0x363ec4['use'](_0x2a8a('0x104'),express[_0x2a8a('0xfe')](path[_0x2a8a('0xff')](config[_0x2a8a('0x100')],_0x2a8a('0x105'),_0x2a8a('0x106'))));_0x363ec4[_0x2a8a('0x8')](_0x2a8a('0x107'),express[_0x2a8a('0xfe')](path['join'](config[_0x2a8a('0x100')],_0x2a8a('0x108'))));_0x363ec4[_0x2a8a('0x109')](_0x2a8a('0x10a'))[_0x2a8a('0x10b')](errors[0x194]);_0x363ec4[_0x2a8a('0x109')]('/*')[_0x2a8a('0x10b')](function(_0x106f68,_0x311fea){_0x311fea[_0x2a8a('0x10c')](path[_0x2a8a('0x10d')](_0x363ec4[_0x2a8a('0x10b')](_0x2a8a('0x10e'))+_0x2a8a('0x10f')));});return _0x363ec4;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index d99e277..0569c56 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x346e=['../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../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/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x346e,0x18f));var _0xe346=function(_0x2f482c,_0x243739){_0x2f482c=_0x2f482c-0x0;var _0x1ee791=_0x346e[_0x2f482c];return _0x1ee791;};'use strict';var jayson=require('jayson/promise');var _=require(_0xe346('0x0'));var config=require('../config/environment');exports[_0xe346('0x1')]=function(){return new Promise(function(_0x34468c,_0x29b43f){var _0x2208d7={};_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x3')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x4')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x5')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/voiceRecording/voiceRecording.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x6')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x7')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x8')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x9')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xa')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xb')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xc')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/mailAccount/mailAccount.rpc'));_0x2208d7=_['merge'](_0x2208d7,require('../api/mailQueue/mailQueue.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xd')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xe')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/mailApplication/mailApplication.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0xf')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/faxAccount/faxAccount.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x10')));_0x2208d7=_['merge'](_0x2208d7,require('../api/faxInteraction/faxInteraction.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/faxMessage/faxMessage.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x11')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x12')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsAccount/smsAccount.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsInteraction/smsInteraction.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x13')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsQueue/smsQueue.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x14')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x15')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x16')));_0x2208d7=_['merge'](_0x2208d7,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x17')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/chatInteraction/chatInteraction.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x18')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x19')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/cmContact/cmContact.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1a')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1b')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x1c')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x1d')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1e')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x1f')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x20')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x21')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x22')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x23')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x24')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x25')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x26')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x27')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x28')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x29')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2a')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2b')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2c')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2d')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x2e')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/squareReport/squareReport.rpc'));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x2f')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x30')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x31')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x32')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/squareRecording/squareRecording.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x33')));_0x2208d7=_['merge'](_0x2208d7,require('../api/campaign/campaign.rpc'));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x34')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x35')));_0x2208d7=_['merge'](_0x2208d7,require(_0xe346('0x36')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x37')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x38')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require(_0xe346('0x39')));_0x2208d7=_[_0xe346('0x2')](_0x2208d7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1b0e02=jayson['server'](_0x2208d7)[_0xe346('0x3a')]();var _0x499f1d=config[_0xe346('0x3b')]['port']||config[_0xe346('0x3c')]+0x1;var _0x215686=config['rpc']['ip']||_0xe346('0x3d');_0x1b0e02['on'](_0xe346('0x3e'),function(_0x128034){return _0x29b43f(_0x128034);});_0x1b0e02[_0xe346('0x1')](_0x499f1d,_0x215686,function(){console[_0xe346('0x3f')](_0xe346('0x40'),_0x215686,_0x499f1d);require(_0xe346('0x41'))[_0xe346('0x42')]();return _0x34468c(_0xe346('0x43')+_0x215686+':'+_0x499f1d);});});}; \ No newline at end of file +var _0x8585=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','listen','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc'];(function(_0x3dc3f3,_0x5f1626){var _0x15b010=function(_0x4ee2c4){while(--_0x4ee2c4){_0x3dc3f3['push'](_0x3dc3f3['shift']());}};_0x15b010(++_0x5f1626);}(_0x8585,0x64));var _0x5858=function(_0xc38a15,_0x43caf4){_0xc38a15=_0xc38a15-0x0;var _0x382392=_0x8585[_0xc38a15];return _0x382392;};'use strict';var jayson=require(_0x5858('0x0'));var _=require(_0x5858('0x1'));var config=require(_0x5858('0x2'));exports['listen']=function(){return new Promise(function(_0x2864b0,_0x294e8e){var _0x5739bc={};_0x5739bc=_['merge'](_0x5739bc,require('../api/user/user.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x4')));_0x5739bc=_['merge'](_0x5739bc,require('../api/voiceQueue/voiceQueue.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x5')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x6')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x7')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/memberReport/memberReport.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x8')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x9')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0xa')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0xb')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/mailAccount/mailAccount.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0xc')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/mailInteraction/mailInteraction.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0xd')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0xe')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0xf')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x10')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x11')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x12')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x13')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x14')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x15')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x16')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x17')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x18')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x19')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x1a')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x1b')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x1c')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x1d')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/chatInteraction/chatInteraction.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x1e')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x1f')));_0x5739bc=_['merge'](_0x5739bc,require('../api/cmContact/cmContact.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x20')));_0x5739bc=_['merge'](_0x5739bc,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x21')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x22')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x23')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x24')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x25')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x26')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x27')));_0x5739bc=_['merge'](_0x5739bc,require('../api/trigger/trigger.rpc'));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x28')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x29')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x2a')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x2b')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x2c')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x2d')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x2e')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x2f')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x30')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x31')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x32')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x33')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x34')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x35')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x36')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x37')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/squareMessage/squareMessage.rpc'));_0x5739bc=_['merge'](_0x5739bc,require('../api/campaign/campaign.rpc'));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x38')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x39')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x3a')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x3b')));_0x5739bc=_['merge'](_0x5739bc,require(_0x5858('0x3c')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require(_0x5858('0x3d')));_0x5739bc=_[_0x5858('0x3')](_0x5739bc,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x43263a=jayson['server'](_0x5739bc)[_0x5858('0x3e')]();var _0x4d42b1=config[_0x5858('0x3f')][_0x5858('0x40')]||config[_0x5858('0x40')]+0x1;var _0x2d22b3=config[_0x5858('0x3f')]['ip']||_0x5858('0x41');_0x43263a['on'](_0x5858('0x42'),function(_0x295cd2){return _0x294e8e(_0x295cd2);});_0x43263a[_0x5858('0x43')](_0x4d42b1,_0x2d22b3,function(){console[_0x5858('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x2d22b3,_0x4d42b1);require(_0x5858('0x45'))[_0x5858('0x46')]();return _0x2864b0(_0x5858('0x47')+_0x2d22b3+':'+_0x4d42b1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8fd1845..8a7f382 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 _0x5502=['HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','headers','emit','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s'];(function(_0x4a32bf,_0x17127b){var _0x309e43=function(_0x46a03c){while(--_0x46a03c){_0x4a32bf['push'](_0x4a32bf['shift']());}};_0x309e43(++_0x17127b);}(_0x5502,0x69));var _0x2550=function(_0x1d5ea8,_0x207732){_0x1d5ea8=_0x1d5ea8-0x0;var _0x42a9d6=_0x5502[_0x1d5ea8];return _0x42a9d6;};'use strict';var util=require(_0x2550('0x0'));var _=require(_0x2550('0x1'));var EventEmitter=require(_0x2550('0x2'))[_0x2550('0x3')];var AGIReply=require(_0x2550('0x4'));var AGIError=require(_0x2550('0x5'));function AGIChannel(_0x185ad3){var _0x2a80f8=this,_0x18739d=new AGIReply(),_0x30a166=![],_0x2dbee8={};EventEmitter[_0x2550('0x6')](_0x2a80f8);_0x185ad3[_0x2550('0x7')]('utf8');_0x185ad3[_0x2550('0x8')](0x8*0x3c*0x3c*0x3e8);_0x18739d['setEncoding']('utf8');_0x18739d['on'](_0x2550('0x9'),function(_0x40ead6){for(var _0x4fa582 in _0x40ead6){_0x2a80f8[_0x4fa582]=_0x40ead6[_0x4fa582];}_0x2a80f8[_0x2550('0xa')]('ready');});_0x18739d['on'](_0x2550('0xb'),function(_0xd9345){if(_0xd9345[_0x2550('0xc')]()==_0x2550('0xd')){_0x2a80f8[_0x2550('0xa')](_0x2550('0xd'));return;}if(_0xd9345['substring'](0x0,0xb)==_0x2550('0xe')){_0x30a166=!![];}if(_0x30a166){_0x2dbee8['rx']+=_0xd9345+'\x0a';if(_0xd9345[_0x2550('0xf')](_0x2550('0x10'))!=-0x1){_0x30a166=![];}}else{_0x2dbee8['rx']=_0xd9345;}if(_0x30a166){return;}if(typeof _0x2dbee8['cb']==_0x2550('0x11')){var _0x4ee238=_0x2dbee8['rx']['substring'](0x0,0x3),_0x3bc4f0=null,_0xcd1bbb=null;_0x4ee238=parseInt(_0x4ee238);if(isNaN(_0x4ee238)){_0x2dbee8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2550('0x12')});return;}if(_0x4ee238!=0xc8){_0x2dbee8['cb'](null,{'code':_0x4ee238,'result':-0x1,'extra':'KO'});return;}_0x3bc4f0=_0x2dbee8['rx'][_0x2550('0x13')](0x4)[_0x2550('0x14')](_0x2550('0x15'),'');if(_0x3bc4f0[_0x2550('0x16')]('\x20')!=-0x1){_0x3bc4f0=_0x3bc4f0[_0x2550('0x17')](0x0,_0x3bc4f0['indexOf']('\x20'));}if(_[_0x2550('0x18')](_0x3bc4f0,'-1')){_0x3bc4f0=parseInt(_0x3bc4f0);}_0xcd1bbb=_0x2dbee8['rx'][_0x2550('0x19')]('\x20');if(_0xcd1bbb[_0x2550('0x1a')]==0x3){_0xcd1bbb=_0xcd1bbb[0x2][_0x2550('0x13')](0x1,_0xcd1bbb[0x2][_0x2550('0x1a')]-0x1);}else if(_0xcd1bbb[_0x2550('0x1a')]>0x3){var _0x4fcabb=/\((.+)\)/;var _0x1aedfd=_0x2dbee8['rx'][_0x2550('0x1b')](_0x4fcabb);if(_0x1aedfd){_0xcd1bbb=_0x1aedfd[0x1];}else{_0xcd1bbb=null;}}else{_0xcd1bbb=null;}_0x2dbee8['cb'](null,{'code':_0x4ee238,'result':_0x3bc4f0,'extra':_0xcd1bbb});}});_0x185ad3['on'](_0x2550('0x1c'),function(_0x5c1bcb){_0x2a80f8[_0x2550('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x5c1bcb[_0x2550('0x1d')]));});_0x185ad3['on']('close',function(){_0x2a80f8[_0x2550('0xa')](_0x2550('0x1e'),new AGIError(_0x2550('0x1f')));});_0x185ad3['on'](_0x2550('0x20'),function(){_0x2a80f8[_0x2550('0xa')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x185ad3['destroy']();});_0x185ad3[_0x2550('0x21')](_0x18739d);this[_0x2550('0x22')]=function(_0x364568,_0x295f3b){var _0x364568=_0x364568||'',_0x295f3b=typeof _0x295f3b==_0x2550('0x11')?_0x295f3b:new Function();_0x2dbee8={'tx':_0x364568,'rx':'','cb':_0x295f3b};_0x185ad3[_0x2550('0x23')](_0x364568+'\x0a');},this[_0x2550('0x1e')]=function(){_0x185ad3['destroy']();};}util[_0x2550('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x2550('0x25')]['sendRequest']=function(_0x1adb08){return this[_0x2550('0x22')]['sync'](this,_0x1adb08);};AGIChannel[_0x2550('0x25')][_0x2550('0x26')]=function(){return this[_0x2550('0x27')](_0x2550('0x28'));};AGIChannel[_0x2550('0x25')][_0x2550('0x29')]=function(_0x66ac37,_0x46d52e,_0x2839f2){_0x66ac37=_0x66ac37===undefined?_0x2550('0x2a'):_0x66ac37;_0x46d52e=_0x46d52e===undefined?'5':_0x46d52e;_0x2839f2=_0x2839f2===undefined?'1':_0x2839f2;return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x2c'),_0x66ac37,_0x46d52e*0x3e8,_0x2839f2));};AGIChannel['prototype'][_0x2550('0x2d')]=function(_0x1f05d6){_0x1f05d6=_0x1f05d6||_0x2550('0x2e');return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x2f'),_0x1f05d6));};AGIChannel[_0x2550('0x25')][_0x2550('0x30')]=function(_0x2beed7,_0x256509){if(_[_0x2550('0x31')](_0x256509)){return this[_0x2550('0x27')](util['format'](_0x2550('0x32'),_0x2beed7,_0x256509[_0x2550('0x33')](',')));}return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x32'),_0x2beed7,_0x256509));};AGIChannel['prototype']['setContext']=function(_0x3504ed){return this[_0x2550('0x27')](util[_0x2550('0x2b')]('SET\x20CONTEXT\x20%s',_0x3504ed));};AGIChannel[_0x2550('0x25')][_0x2550('0x34')]=function(_0x1f331e){return this['sendRequest'](util[_0x2550('0x2b')](_0x2550('0x35'),_0x1f331e));};AGIChannel[_0x2550('0x25')]['setPriority']=function(_0x5303c6){return this['sendRequest'](util[_0x2550('0x2b')](_0x2550('0x36'),_0x5303c6));};AGIChannel[_0x2550('0x25')]['hangup']=function(){return this[_0x2550('0x27')](_0x2550('0x37'));};AGIChannel['prototype']['setVariable']=function(_0x2d782c,_0x40105b){var _0xe40e1c=_[_0x2550('0x38')](_0x40105b)||_[_0x2550('0x39')](_0x40105b)?_0x40105b[_0x2550('0x3a')]():_0x40105b;return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x3b'),_0x2d782c,_0xe40e1c?_0xe40e1c[_0x2550('0x3a')]()[_0x2550('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2550('0x25')][_0x2550('0x3c')]=function(_0x295625,_0x44127b){return this['sendRequest'](util['format'](_0x2550('0x3d'),_0x295625,_0x44127b));};AGIChannel['prototype'][_0x2550('0x3e')]=function(_0x4fb49d,_0x1d4b15){return this[_0x2550('0x27')](util[_0x2550('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x4fb49d,_0x1d4b15));};AGIChannel['prototype']['sayPhonetic']=function(_0x5ae274,_0x3ad5cd){return this['sendRequest'](util[_0x2550('0x2b')](_0x2550('0x3f'),_0x5ae274,_0x3ad5cd));};AGIChannel[_0x2550('0x25')][_0x2550('0x40')]=function(_0x87b5c0,_0x40f761,_0x57d7e4){_0x40f761=_0x40f761||this[_0x2550('0x41')];_0x57d7e4=_0x57d7e4||0x1;this[_0x2550('0x42')](_0x87b5c0);this[_0x2550('0x34')](_0x40f761);this['setPriority'](_0x57d7e4);return this[_0x2550('0x2d')](util['format'](_0x2550('0x43'),_0x87b5c0,_0x40f761,_0x57d7e4));};AGIChannel[_0x2550('0x25')][_0x2550('0x44')]=function(_0x31f3fa){return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x45'),_0x31f3fa));};AGIChannel[_0x2550('0x25')]['recordFile']=function(_0x4b4360,_0x145c65,_0x4131de,_0x4542e4,_0x40d2fb,_0x5cb562){_0x145c65=_0x145c65||'wav';_0x4131de=_0x4131de||'';_0x4542e4=_0x4542e4===undefined?-0x1:_0x4542e4==='-1'?-0x1:_0x4542e4*0x3e8;_0x40d2fb=_0x40d2fb===undefined?'':'s='+_0x40d2fb;_0x5cb562=_0x5cb562?_0x2550('0x46'):'';return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x47'),_0x4b4360,_0x145c65,_0x4131de,_0x4542e4,_0x5cb562,_0x40d2fb));};AGIChannel[_0x2550('0x25')][_0x2550('0x48')]=function(_0x4ada98,_0x4363d6){_0x4363d6=_0x4363d6||'';return this[_0x2550('0x27')](util[_0x2550('0x2b')](_0x2550('0x49'),_0x4ada98,_0x4363d6));};AGIChannel['prototype']['agi']=function(_0x5ea85f){return this['exec'](_0x2550('0x4a'),_0x5ea85f);};AGIChannel[_0x2550('0x25')][_0x2550('0x4b')]=function(_0x89e527){return this[_0x2550('0x30')](_0x2550('0x4c'),_0x89e527);};AGIChannel[_0x2550('0x25')][_0x2550('0x1c')]=function(_0x4b987b,_0x1d8cc0){this[_0x2550('0x2d')](util[_0x2550('0x2b')](_0x2550('0x4d'),_0x4b987b['id'],_0x4b987b[_0x2550('0x4e')],_0x1d8cc0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2550('0x4f')]=AGIChannel; \ No newline at end of file +var _0x2df6=['beep','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','line','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','inherits','prototype','sendRequest','sync','ANSWER','getData'];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0x2df6,0x6c));var _0x62df=function(_0x1348a1,_0x3e918e){_0x1348a1=_0x1348a1-0x0;var _0x48f062=_0x2df6[_0x1348a1];return _0x48f062;};'use strict';var util=require(_0x62df('0x0'));var _=require(_0x62df('0x1'));var EventEmitter=require(_0x62df('0x2'))[_0x62df('0x3')];var AGIReply=require(_0x62df('0x4'));var AGIError=require(_0x62df('0x5'));function AGIChannel(_0x1eb966){var _0x172765=this,_0x6cc9fe=new AGIReply(),_0x4370e3=![],_0x29ca96={};EventEmitter[_0x62df('0x6')](_0x172765);_0x1eb966[_0x62df('0x7')]('utf8');_0x1eb966[_0x62df('0x8')](0x8*0x3c*0x3c*0x3e8);_0x6cc9fe['setEncoding'](_0x62df('0x9'));_0x6cc9fe['on'](_0x62df('0xa'),function(_0x515213){for(var _0x1f4436 in _0x515213){_0x172765[_0x1f4436]=_0x515213[_0x1f4436];}_0x172765[_0x62df('0xb')]('ready');});_0x6cc9fe['on'](_0x62df('0xc'),function(_0xdfe051){if(_0xdfe051['toLowerCase']()==_0x62df('0xd')){_0x172765[_0x62df('0xb')](_0x62df('0xd'));return;}if(_0xdfe051[_0x62df('0xe')](0x0,0xb)==_0x62df('0xf')){_0x4370e3=!![];}if(_0x4370e3){_0x29ca96['rx']+=_0xdfe051+'\x0a';if(_0xdfe051['search'](_0x62df('0x10'))!=-0x1){_0x4370e3=![];}}else{_0x29ca96['rx']=_0xdfe051;}if(_0x4370e3){return;}if(typeof _0x29ca96['cb']==_0x62df('0x11')){var _0x6cd039=_0x29ca96['rx'][_0x62df('0xe')](0x0,0x3),_0x1c9c7d=null,_0x318d46=null;_0x6cd039=parseInt(_0x6cd039);if(isNaN(_0x6cd039)){_0x29ca96['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x62df('0x12')});return;}if(_0x6cd039!=0xc8){_0x29ca96['cb'](null,{'code':_0x6cd039,'result':-0x1,'extra':'KO'});return;}_0x1c9c7d=_0x29ca96['rx']['substring'](0x4)[_0x62df('0x13')](_0x62df('0x14'),'');if(_0x1c9c7d[_0x62df('0x15')]('\x20')!=-0x1){_0x1c9c7d=_0x1c9c7d[_0x62df('0x16')](0x0,_0x1c9c7d['indexOf']('\x20'));}if(_[_0x62df('0x17')](_0x1c9c7d,'-1')){_0x1c9c7d=parseInt(_0x1c9c7d);}_0x318d46=_0x29ca96['rx'][_0x62df('0x18')]('\x20');if(_0x318d46['length']==0x3){_0x318d46=_0x318d46[0x2][_0x62df('0xe')](0x1,_0x318d46[0x2]['length']-0x1);}else if(_0x318d46['length']>0x3){var _0x2dfa21=/\((.+)\)/;var _0x213dd3=_0x29ca96['rx'][_0x62df('0x19')](_0x2dfa21);if(_0x213dd3){_0x318d46=_0x213dd3[0x1];}else{_0x318d46=null;}}else{_0x318d46=null;}_0x29ca96['cb'](null,{'code':_0x6cd039,'result':_0x1c9c7d,'extra':_0x318d46});}});_0x1eb966['on'](_0x62df('0x1a'),function(_0x139496){_0x172765['emit'](_0x62df('0x1a'),new AGIError(_0x62df('0x1b'),_0x139496['code']));});_0x1eb966['on'](_0x62df('0x1c'),function(){_0x172765[_0x62df('0xb')](_0x62df('0x1c'),new AGIError(_0x62df('0x1d')));});_0x1eb966['on'](_0x62df('0x1e'),function(){_0x172765['emit'](_0x62df('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1eb966['destroy']();});_0x1eb966[_0x62df('0x1f')](_0x6cc9fe);this[_0x62df('0x20')]=function(_0x4f03d7,_0x338053){var _0x4f03d7=_0x4f03d7||'',_0x338053=typeof _0x338053==_0x62df('0x11')?_0x338053:new Function();_0x29ca96={'tx':_0x4f03d7,'rx':'','cb':_0x338053};_0x1eb966[_0x62df('0x21')](_0x4f03d7+'\x0a');},this['close']=function(){_0x1eb966['destroy']();};}util[_0x62df('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x62df('0x23')][_0x62df('0x24')]=function(_0x3afd53){return this['command'][_0x62df('0x25')](this,_0x3afd53);};AGIChannel[_0x62df('0x23')]['answer']=function(){return this[_0x62df('0x24')](_0x62df('0x26'));};AGIChannel[_0x62df('0x23')][_0x62df('0x27')]=function(_0x2027be,_0x2fe439,_0x5e3548){_0x2027be=_0x2027be===undefined?_0x62df('0x28'):_0x2027be;_0x2fe439=_0x2fe439===undefined?'5':_0x2fe439;_0x5e3548=_0x5e3548===undefined?'1':_0x5e3548;return this[_0x62df('0x24')](util[_0x62df('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2027be,_0x2fe439*0x3e8,_0x5e3548));};AGIChannel[_0x62df('0x23')]['noop']=function(_0x327d05){_0x327d05=_0x327d05||'NO\x20MESSAGE';return this[_0x62df('0x24')](util[_0x62df('0x29')](_0x62df('0x2a'),_0x327d05));};AGIChannel['prototype'][_0x62df('0x2b')]=function(_0xe667e6,_0x3de660){if(_[_0x62df('0x2c')](_0x3de660)){return this[_0x62df('0x24')](util[_0x62df('0x29')](_0x62df('0x2d'),_0xe667e6,_0x3de660[_0x62df('0x2e')](',')));}return this[_0x62df('0x24')](util[_0x62df('0x29')](_0x62df('0x2d'),_0xe667e6,_0x3de660));};AGIChannel[_0x62df('0x23')][_0x62df('0x2f')]=function(_0x1e889a){return this[_0x62df('0x24')](util[_0x62df('0x29')]('SET\x20CONTEXT\x20%s',_0x1e889a));};AGIChannel[_0x62df('0x23')][_0x62df('0x30')]=function(_0x4429e0){return this['sendRequest'](util['format'](_0x62df('0x31'),_0x4429e0));};AGIChannel['prototype'][_0x62df('0x32')]=function(_0x32774e){return this[_0x62df('0x24')](util['format']('SET\x20PRIORITY\x20%s',_0x32774e));};AGIChannel[_0x62df('0x23')]['hangup']=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x62df('0x23')][_0x62df('0x33')]=function(_0x578155,_0x1292b9){var _0x42c515=_['isBoolean'](_0x1292b9)||_[_0x62df('0x34')](_0x1292b9)?_0x1292b9[_0x62df('0x35')]():_0x1292b9;return this[_0x62df('0x24')](util[_0x62df('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x578155,_0x42c515?_0x42c515[_0x62df('0x35')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x62df('0x36')]=function(_0x5232b2,_0x2893b9){return this[_0x62df('0x24')](util[_0x62df('0x29')](_0x62df('0x37'),_0x5232b2,_0x2893b9));};AGIChannel['prototype'][_0x62df('0x38')]=function(_0x4558bc,_0x57825d){return this[_0x62df('0x24')](util[_0x62df('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x4558bc,_0x57825d));};AGIChannel[_0x62df('0x23')][_0x62df('0x39')]=function(_0x387d11,_0x487a8f){return this[_0x62df('0x24')](util[_0x62df('0x29')](_0x62df('0x3a'),_0x387d11,_0x487a8f));};AGIChannel[_0x62df('0x23')][_0x62df('0x3b')]=function(_0x1baac5,_0x2b9b78,_0x36089d){_0x2b9b78=_0x2b9b78||this[_0x62df('0x3c')];_0x36089d=_0x36089d||0x1;this['setContext'](_0x1baac5);this[_0x62df('0x30')](_0x2b9b78);this[_0x62df('0x32')](_0x36089d);return this['noop'](util[_0x62df('0x29')](_0x62df('0x3d'),_0x1baac5,_0x2b9b78,_0x36089d));};AGIChannel['prototype'][_0x62df('0x3e')]=function(_0x9b14a9){return this[_0x62df('0x24')](util[_0x62df('0x29')](_0x62df('0x3f'),_0x9b14a9));};AGIChannel[_0x62df('0x23')][_0x62df('0x40')]=function(_0x1ef0e0,_0x5561e9,_0x5090c7,_0x57e55a,_0x169240,_0x50e227){_0x5561e9=_0x5561e9||_0x62df('0x41');_0x5090c7=_0x5090c7||'';_0x57e55a=_0x57e55a===undefined?-0x1:_0x57e55a==='-1'?-0x1:_0x57e55a*0x3e8;_0x169240=_0x169240===undefined?'':'s='+_0x169240;_0x50e227=_0x50e227?_0x62df('0x42'):'';return this[_0x62df('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1ef0e0,_0x5561e9,_0x5090c7,_0x57e55a,_0x50e227,_0x169240));};AGIChannel['prototype']['streamFile']=function(_0x38af52,_0x5bcde6){_0x5bcde6=_0x5bcde6||'';return this['sendRequest'](util[_0x62df('0x29')](_0x62df('0x43'),_0x38af52,_0x5bcde6));};AGIChannel['prototype']['agi']=function(_0x9939ba){return this[_0x62df('0x2b')](_0x62df('0x44'),_0x9939ba);};AGIChannel[_0x62df('0x23')]['wait']=function(_0x215688){return this[_0x62df('0x2b')](_0x62df('0x45'),_0x215688);};AGIChannel[_0x62df('0x23')][_0x62df('0x1a')]=function(_0x301cef,_0x10963e){this[_0x62df('0x46')](util[_0x62df('0x29')](_0x62df('0x47'),_0x301cef['id'],_0x301cef[_0x62df('0x48')],_0x10963e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x62df('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index db1fbd7..a7e4c51 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 _0x470a=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','name','exports','util','Server\x20error.\x20Code:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x5cc860,_0x924d8d){var _0x15bef6=function(_0x4df6a9){while(--_0x4df6a9){_0x5cc860['push'](_0x5cc860['shift']());}};_0x15bef6(++_0x924d8d);}(_0x470a,0xf7));var _0xa470=function(_0x3c0fe4,_0x171061){_0x3c0fe4=_0x3c0fe4-0x0;var _0xb2d90f=_0x470a[_0x3c0fe4];return _0xb2d90f;};'use strict';var util=require(_0xa470('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xa470('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa470('0x2'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa470('0x3'),'E_AGI_COMMAND_EMPTY':_0xa470('0x4'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa470('0x5'),'E_AGI_IVR_ENTRY':_0xa470('0x6')};function AGIError(_0x34a86a){var _0x34a86a=_0x34a86a||null,_0x11fc84=_0x11fc84||[],_0x9940d0=0x1,_0x2f64f3='';if(!error[_0x34a86a]){_0x34a86a=_0xa470('0x7');}_0x11fc84[_0xa470('0x8')](error[_0x34a86a]);while(arguments[_0x9940d0]){_0x11fc84[_0xa470('0x8')](arguments[_0x9940d0]);_0x9940d0++;}_0x2f64f3=util['format']['apply'](util,_0x11fc84);this['message']=_0x2f64f3;this[_0xa470('0x9')]=_0x34a86a;}module[_0xa470('0xa')]=AGIError; \ No newline at end of file +var _0x1de9=['Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','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\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x1de9,0xa7));var _0x91de=function(_0x15aab9,_0x18369f){_0x15aab9=_0x15aab9-0x0;var _0x89889d=_0x1de9[_0x15aab9];return _0x89889d;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x91de('0x0'),'E_AGI_ARGUMENT_PORT':_0x91de('0x1'),'E_AGI_SERVER_ERROR':_0x91de('0x2'),'E_AGI_SERVER_CLOSE':_0x91de('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x91de('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x91de('0x5'),'E_AGI_SOCKET_ERROR':_0x91de('0x6'),'E_AGI_SOCKET_CLOSE':_0x91de('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x91de('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x91de('0x9')};function AGIError(_0x4dd088){var _0x4dd088=_0x4dd088||null,_0x1a2e8e=_0x1a2e8e||[],_0x1f4b78=0x1,_0x1381f3='';if(!error[_0x4dd088]){_0x4dd088='E_AGI_UNDEFINED';}_0x1a2e8e[_0x91de('0xa')](error[_0x4dd088]);while(arguments[_0x1f4b78]){_0x1a2e8e['push'](arguments[_0x1f4b78]);_0x1f4b78++;}_0x1381f3=util[_0x91de('0xb')][_0x91de('0xc')](util,_0x1a2e8e);this[_0x91de('0xd')]=_0x1381f3;this[_0x91de('0xe')]=_0x4dd088;}module[_0x91de('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 3949384..0f30ee2 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 _0xcf5b=['events','ioredis','../../config/environment','defaults','redis','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR','parse','emit','projectUpdate','lodash'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xcf5b,0x6f));var _0xbcf5=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0xcf5b[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0xbcf5('0x0'));var EventEmitter=require(_0xbcf5('0x1'))['EventEmitter'];var Redis=require(_0xbcf5('0x2'));var AGIError=require('./error');var config=require(_0xbcf5('0x3'));config['redis']=_[_0xbcf5('0x4')](config[_0xbcf5('0x5')],{'host':_0xbcf5('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xbcf5('0x5')]);sub[_0xbcf5('0x7')](_0xbcf5('0x8'),function(_0x415338){if(_0x415338)return eventEmitter['emit'](_0xbcf5('0x9'),new AGIError(_0xbcf5('0xa'),_0x415338));});sub['on']('message',function(_0x374a05,_0x26f740){if(_0x374a05!=='agi')return;try{var _0x4b7ee5=JSON[_0xbcf5('0xb')](_0x26f740);eventEmitter[_0xbcf5('0xc')](_0xbcf5('0xd'),_0x4b7ee5);}catch(_0x2aa4f8){eventEmitter[_0xbcf5('0xc')](_0xbcf5('0x9'),new AGIError(_0xbcf5('0xa'),_0x2aa4f8));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x5d3f=['error','exports','lodash','ioredis','./error','../../config/environment','defaults','localhost','redis','agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate'];(function(_0xa69733,_0x2aa122){var _0xca5645=function(_0x3a2729){while(--_0x3a2729){_0xa69733['push'](_0xa69733['shift']());}};_0xca5645(++_0x2aa122);}(_0x5d3f,0x1b5));var _0xf5d3=function(_0x9b1199,_0x19a08b){_0x9b1199=_0x9b1199-0x0;var _0xa3f8=_0x5d3f[_0x9b1199];return _0xa3f8;};'use strict';var _=require(_0xf5d3('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0xf5d3('0x1'));var AGIError=require(_0xf5d3('0x2'));var config=require(_0xf5d3('0x3'));config['redis']=_[_0xf5d3('0x4')](config['redis'],{'host':_0xf5d3('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xf5d3('0x6')]);sub['subscribe'](_0xf5d3('0x7'),function(_0xeb13b2){if(_0xeb13b2)return eventEmitter[_0xf5d3('0x8')]('error',new AGIError(_0xf5d3('0x9'),_0xeb13b2));});sub['on'](_0xf5d3('0xa'),function(_0x2f6aba,_0x4c29fc){if(_0x2f6aba!==_0xf5d3('0x7'))return;try{var _0x172713=JSON[_0xf5d3('0xb')](_0x4c29fc);eventEmitter[_0xf5d3('0x8')](_0xf5d3('0xc'),_0x172713);}catch(_0x2c9169){eventEmitter[_0xf5d3('0x8')](_0xf5d3('0xd'),new AGIError(_0xf5d3('0x9'),_0x2c9169));}});module[_0xf5d3('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 54530ad..8052049 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 _0x0d4f=['getdigits','edges','numberOfEdges','prototype','addVertex','vertices','size','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','target','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi'];(function(_0x47e67c,_0x5273fe){var _0x5ae27a=function(_0x1dd0e4){while(--_0x1dd0e4){_0x47e67c['push'](_0x47e67c['shift']());}};_0x5ae27a(++_0x5273fe);}(_0x0d4f,0x169));var _0xf0d4=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x0d4f[_0x4ad0f7];return _0x30f5c8;};'use strict';var _=require(_0xf0d4('0x0'));var logger=require(_0xf0d4('0x1'))(_0xf0d4('0x2'));var verticesWithRetry=['menu',_0xf0d4('0x3'),'getsecretdigits'];var Graph=function(){this['vertices']={};this[_0xf0d4('0x4')]={};this[_0xf0d4('0x5')]=0x0;};Graph[_0xf0d4('0x6')][_0xf0d4('0x7')]=function(_0x40b185){this[_0xf0d4('0x8')][_0x40b185['id']]=_0x40b185;this[_0xf0d4('0x4')][_0x40b185['id']]=[];};Graph[_0xf0d4('0x6')]['addEdge']=function(_0x5b2004,_0x22520b,_0x1f15a9){this[_0xf0d4('0x4')][_0x5b2004]['push']({'target':_0x22520b,'condition':_0x1f15a9});this[_0xf0d4('0x5')]+=0x1;};Graph[_0xf0d4('0x6')][_0xf0d4('0x9')]=function(){return _[_0xf0d4('0x9')](this['vertices']);};Graph['prototype']['relations']=function(){return this['numberOfEdges'];};Graph['prototype']['getVertex']=function(_0x22b0f0){return this['vertices'][_0x22b0f0];};Graph[_0xf0d4('0x6')][_0xf0d4('0xa')]=function(_0x5c0dc5,_0x3b3e13){if(!this['vertices'][_0x5c0dc5]){return logger[_0xf0d4('0xb')](_0xf0d4('0xc'));}var _0x565848=_0x3b3e13(this[_0xf0d4('0x8')][_0x5c0dc5]);if(!_0x565848){return logger[_0xf0d4('0xb')](_0xf0d4('0xd'));}if(this[_0xf0d4('0x4')][_0x5c0dc5][_0xf0d4('0xe')]===0x0){return logger['info'](_0xf0d4('0xf'));}for(var _0x330eef=0x0,_0x4e5be1=[],_0x48fa1a=![];_0x330eef\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','handleNotFound','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','connection','close','lodash','syncho','util','../../config/logger','./rpc','./events','EventEmitter','agi'];(function(_0x218e60,_0x1a0056){var _0x22615a=function(_0x3a221c){while(--_0x3a221c){_0x218e60['push'](_0x218e60['shift']());}};_0x22615a(++_0x1a0056);}(_0xb11c,0x15a));var _0xcb11=function(_0x24d3aa,_0x5ea498){_0x24d3aa=_0x24d3aa-0x0;var _0x55c360=_0xb11c[_0x24d3aa];return _0x55c360;};'use strict';var _=require(_0xcb11('0x0'));var syncho=require(_0xcb11('0x1'));var util=require(_0xcb11('0x2'));var config=require('../../config/environment');var logger=require(_0xcb11('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xcb11('0x4'));var Project=require('./project');var AGIEmitter=require(_0xcb11('0x5'))[_0xcb11('0x6')];var projects=[];config[_0xcb11('0x7')]=_[_0xcb11('0x8')](config['agi'],{'ip':_0xcb11('0x9'),'port':0x11dd});AGIEmitter['on'](_0xcb11('0xa'),projectUpdateHandler);function connectionHandler(_0x4c7354){process[_0xcb11('0xb')](function(){syncho(function(){try{setChannelVariables(_0x4c7354);agiHandler(_0x4c7354);}catch(_0x4a5eb2){logger[_0xcb11('0xc')](_0x4a5eb2[_0xcb11('0xd')]);}});});}function projectUpdateHandler(_0x340748){try{var _0x5d35cd=_[_0xcb11('0xe')](projects,['id',_0x340748['id']]);if(_0x5d35cd>-0x1){if(_0x340748[_0xcb11('0xf')]===!![]){projects[_0xcb11('0x10')](_0x5d35cd,0x1);}else{projects[_0x5d35cd]=_0x340748;}}else{projects['push'](_0x340748);}}catch(_0x56bdf6){logger[_0xcb11('0xc')](_0x56bdf6[_0xcb11('0xd')]);}}function listeningHandler(){console['log'](_0xcb11('0x11'),config['agi'][_0xcb11('0x12')]);logger[_0xcb11('0x13')](util[_0xcb11('0x14')](_0xcb11('0x15'),config[_0xcb11('0x7')]['ip'],config[_0xcb11('0x7')][_0xcb11('0x12')]));}function errorHandler(_0x23a74f){if(_0x23a74f&&_0x23a74f[_0xcb11('0x16')]&&_0x23a74f[_0xcb11('0x17')]){logger[_0xcb11('0xc')](util[_0xcb11('0x14')]('[%s]\x20%s',_0x23a74f[_0xcb11('0x16')],_0x23a74f[_0xcb11('0x17')]));}else{logger['error'](util[_0xcb11('0x14')](_0xcb11('0x18'),_0x23a74f[_0xcb11('0xd')]));}}function closeHandler(){logger[_0xcb11('0x13')](util['format'](_0xcb11('0x19'),this['arg_1'],this[_0xcb11('0x1a')],this[_0xcb11('0x1b')],this['dnid'],this[_0xcb11('0x1c')]));try{createSquareReport(this);}catch(_0x630116){logger['error'](_0x630116[_0xcb11('0xd')]);}}function timeoutHandler(){logger[_0xcb11('0x13')](util[_0xcb11('0x14')](_0xcb11('0x1d'),this[_0xcb11('0x1e')],this[_0xcb11('0x1a')],this[_0xcb11('0x1b')],this[_0xcb11('0x1f')],this[_0xcb11('0x1c')]));}function hangupHandler(){logger['info'](util[_0xcb11('0x14')](_0xcb11('0x20'),this[_0xcb11('0x1e')],this[_0xcb11('0x1a')],this['callerid'],this['dnid'],this[_0xcb11('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x263291,_0x4ac314){rpc[_0xcb11('0x21')](_0x263291)[_0xcb11('0x22')](function(_0x458eb9){if(_0x4ac314){_0x4ac314(null,_0x458eb9);}})[_0xcb11('0x23')](function(_0x457055){if(_0x4ac314){_0x4ac314(null,_0x457055);}});}function setChannelVariables(_0x4c09fa){for(var _0x4576ce in _0x4c09fa){if(_0x4c09fa[_0xcb11('0x24')](_0x4576ce)){if(_0x4576ce[_0xcb11('0x25')](_0xcb11('0x26'))===0x0){_0x4c09fa[_0x4576ce[_0xcb11('0x27')](0x4)]=_0x4c09fa[_0x4576ce];delete _0x4c09fa[_0x4576ce];}}}}function agiHandler(_0x285967){logger[_0xcb11('0x28')](_0xcb11('0x29'),JSON[_0xcb11('0x2a')](_0x285967,null,0x2));logger[_0xcb11('0x13')](util[_0xcb11('0x14')](_0xcb11('0x2b'),_0x285967[_0xcb11('0x1e')],_0x285967['calleridname'],_0x285967[_0xcb11('0x1b')],_0x285967['dnid'],_0x285967[_0xcb11('0x1c')]));_0x285967['on'](_0xcb11('0xc'),errorHandler);_0x285967['on']('close',closeHandler);_0x285967['on'](_0xcb11('0x2c'),timeoutHandler);_0x285967[_0xcb11('0x2d')]=![];_0x285967['on']('hangup',hangupHandler);var _0x1a5efd=_['find'](projects,[_0xcb11('0x16'),_0x285967[_0xcb11('0x1e')]]);if(!_0x1a5efd)return Project[_0xcb11('0x2e')](_0x285967);if(!_0x1a5efd['production'])return Project['handleUnpublished'](_0x285967);return Project[_0xcb11('0x2f')](_0x1a5efd,_0x285967);}function main(){var _0x16d091;return utilLicense[_0xcb11('0x30')]()[_0xcb11('0x22')](function(_0x127b60){if(!_0x127b60)return;if(_0x127b60['voice']){if(_0x127b60[_0xcb11('0x31')]&&_0x127b60[_0xcb11('0x31')]>0x0){logger[_0xcb11('0x13')](util['format'](_0xcb11('0x32'),_0x127b60[_0xcb11('0x31')]));_0x16d091=_0x127b60['callysquare'];}else{logger[_0xcb11('0x13')](_0xcb11('0x33'));}}else{logger[_0xcb11('0x13')](_0xcb11('0x34'));_0x16d091=-0x1;}})[_0xcb11('0x22')](function(){return Project[_0xcb11('0x35')]();})[_0xcb11('0x22')](function(_0x5e0994){projects=_0x5e0994;return;})[_0xcb11('0x23')](function(_0x11ccbd){logger[_0xcb11('0xc')](_0xcb11('0x36'),_0x11ccbd[_0xcb11('0xd')]);})['finally'](function(){var _0xdef914=require(_0xcb11('0x37'))(config[_0xcb11('0x7')][_0xcb11('0x12')],config[_0xcb11('0x7')]['ip'],_0x16d091);_0xdef914['on']('error',errorHandler);_0xdef914['on'](_0xcb11('0x38'),listeningHandler);_0xdef914['on'](_0xcb11('0x39'),connectionHandler);_0xdef914['on'](_0xcb11('0x3a'),closeHandler);});}main(); \ No newline at end of file +var _0xf9aa=['arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\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','dnid','evtHangup','createSquareReport','then','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','./server','connection','close','lodash','syncho','../../config/environment','./rpc','./project','agi','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xf9aa,0x179));var _0xaf9a=function(_0x3cff3a,_0x2dcc6b){_0x3cff3a=_0x3cff3a-0x0;var _0x31d709=_0xf9aa[_0x3cff3a];return _0x31d709;};'use strict';var _=require(_0xaf9a('0x0'));var syncho=require(_0xaf9a('0x1'));var util=require('util');var config=require(_0xaf9a('0x2'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xaf9a('0x3'));var Project=require(_0xaf9a('0x4'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0xaf9a('0x5')]=_['defaults'](config[_0xaf9a('0x5')],{'ip':_0xaf9a('0x6'),'port':0x11dd});AGIEmitter['on'](_0xaf9a('0x7'),projectUpdateHandler);function connectionHandler(_0x16c95f){process[_0xaf9a('0x8')](function(){syncho(function(){try{setChannelVariables(_0x16c95f);agiHandler(_0x16c95f);}catch(_0x41e4a0){logger[_0xaf9a('0x9')](_0x41e4a0[_0xaf9a('0xa')]);}});});}function projectUpdateHandler(_0x59eced){try{var _0x405963=_[_0xaf9a('0xb')](projects,['id',_0x59eced['id']]);if(_0x405963>-0x1){if(_0x59eced[_0xaf9a('0xc')]===!![]){projects['splice'](_0x405963,0x1);}else{projects[_0x405963]=_0x59eced;}}else{projects['push'](_0x59eced);}}catch(_0x1a60ff){logger['error'](_0x1a60ff[_0xaf9a('0xa')]);}}function listeningHandler(){console['log'](_0xaf9a('0xd'),config[_0xaf9a('0x5')][_0xaf9a('0xe')]);logger[_0xaf9a('0xf')](util[_0xaf9a('0x10')](_0xaf9a('0x11'),config[_0xaf9a('0x5')]['ip'],config[_0xaf9a('0x5')][_0xaf9a('0xe')]));}function errorHandler(_0x202ace){if(_0x202ace&&_0x202ace[_0xaf9a('0x12')]&&_0x202ace[_0xaf9a('0x13')]){logger[_0xaf9a('0x9')](util['format'](_0xaf9a('0x14'),_0x202ace[_0xaf9a('0x12')],_0x202ace[_0xaf9a('0x13')]));}else{logger[_0xaf9a('0x9')](util[_0xaf9a('0x10')](_0xaf9a('0x15'),_0x202ace[_0xaf9a('0xa')]));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xaf9a('0x16')],this['calleridname'],this[_0xaf9a('0x17')],this['dnid'],this[_0xaf9a('0x18')]));try{createSquareReport(this);}catch(_0x187b65){logger[_0xaf9a('0x9')](_0x187b65[_0xaf9a('0xa')]);}}function timeoutHandler(){logger[_0xaf9a('0xf')](util['format'](_0xaf9a('0x19'),this['arg_1'],this[_0xaf9a('0x1a')],this[_0xaf9a('0x17')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xaf9a('0x10')](_0xaf9a('0x1b'),this[_0xaf9a('0x16')],this[_0xaf9a('0x1a')],this[_0xaf9a('0x17')],this[_0xaf9a('0x1c')],this[_0xaf9a('0x18')]));this[_0xaf9a('0x1d')]=!![];}function createSquareReport(_0x5dc872,_0x3506d3){rpc[_0xaf9a('0x1e')](_0x5dc872)[_0xaf9a('0x1f')](function(_0x44b6ce){if(_0x3506d3){_0x3506d3(null,_0x44b6ce);}})['catch'](function(_0xb56c28){if(_0x3506d3){_0x3506d3(null,_0xb56c28);}});}function setChannelVariables(_0x52c017){for(var _0xa672a3 in _0x52c017){if(_0x52c017['hasOwnProperty'](_0xa672a3)){if(_0xa672a3[_0xaf9a('0x20')](_0xaf9a('0x21'))===0x0){_0x52c017[_0xa672a3[_0xaf9a('0x22')](0x4)]=_0x52c017[_0xa672a3];delete _0x52c017[_0xa672a3];}}}}function agiHandler(_0x892a4c){logger[_0xaf9a('0x23')](_0xaf9a('0x24'),JSON[_0xaf9a('0x25')](_0x892a4c,null,0x2));logger[_0xaf9a('0xf')](util[_0xaf9a('0x10')](_0xaf9a('0x26'),_0x892a4c[_0xaf9a('0x16')],_0x892a4c['calleridname'],_0x892a4c['callerid'],_0x892a4c[_0xaf9a('0x1c')],_0x892a4c['uniqueid']));_0x892a4c['on'](_0xaf9a('0x9'),errorHandler);_0x892a4c['on']('close',closeHandler);_0x892a4c['on'](_0xaf9a('0x27'),timeoutHandler);_0x892a4c['evtHangup']=![];_0x892a4c['on']('hangup',hangupHandler);var _0x566b97=_[_0xaf9a('0x28')](projects,[_0xaf9a('0x12'),_0x892a4c['arg_1']]);if(!_0x566b97)return Project[_0xaf9a('0x29')](_0x892a4c);if(!_0x566b97[_0xaf9a('0x2a')])return Project['handleUnpublished'](_0x892a4c);return Project[_0xaf9a('0x2b')](_0x566b97,_0x892a4c);}function main(){var _0x39313f;return utilLicense[_0xaf9a('0x2c')]()[_0xaf9a('0x1f')](function(_0x580600){if(!_0x580600)return;if(_0x580600[_0xaf9a('0x2d')]){if(_0x580600['callysquare']&&_0x580600[_0xaf9a('0x2e')]>0x0){logger[_0xaf9a('0xf')](util['format'](_0xaf9a('0x2f'),_0x580600[_0xaf9a('0x2e')]));_0x39313f=_0x580600[_0xaf9a('0x2e')];}else{logger[_0xaf9a('0xf')](_0xaf9a('0x30'));}}else{logger[_0xaf9a('0xf')](_0xaf9a('0x31'));_0x39313f=-0x1;}})[_0xaf9a('0x1f')](function(){return Project[_0xaf9a('0x32')]();})[_0xaf9a('0x1f')](function(_0x5479ee){projects=_0x5479ee;return;})[_0xaf9a('0x33')](function(_0x46be0a){logger[_0xaf9a('0x9')](_0xaf9a('0x34'),_0x46be0a[_0xaf9a('0xa')]);})[_0xaf9a('0x35')](function(){var _0x28dfa0=require(_0xaf9a('0x36'))(config[_0xaf9a('0x5')]['port'],config[_0xaf9a('0x5')]['ip'],_0x39313f);_0x28dfa0['on'](_0xaf9a('0x9'),errorHandler);_0x28dfa0['on']('listening',listeningHandler);_0x28dfa0['on'](_0xaf9a('0x37'),connectionHandler);_0x28dfa0['on'](_0xaf9a('0x38'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index cb9a5bc..e291395 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 _0x9d55=['catch','sendMailMessage','SendMail','client','http','then','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d55,0x1c5));var _0x59d5=function(_0xbaf35f,_0x48730e){_0xbaf35f=_0xbaf35f-0x0;var _0x3651d1=_0x9d55[_0xbaf35f];return _0x3651d1;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x59d5('0x0')][_0x59d5('0x1')]({'port':0x232b});function request(_0x1fdc8b,_0x262c49){return new BPromise(function(_0x3a2729,_0x4886d1){return client['request'](_0x1fdc8b,_0x262c49)[_0x59d5('0x2')](function(_0x567fef){if(_0x567fef[_0x59d5('0x3')]){return _0x4886d1(_0x567fef['error'][_0x59d5('0x4')]);}else{return _0x3a2729(_0x567fef[_0x59d5('0x5')]);}})[_0x59d5('0x6')](function(_0xe6aff6){return _0x4886d1(_0xe6aff6);});});}exports[_0x59d5('0x7')]=function(_0x457525,_0x4f8762){return request(_0x59d5('0x8'),{'account':_0x457525,'message':_0x4f8762});}; \ No newline at end of file +var _0x584f=['http','then','error','message','result','catch','SendMail','jayson/promise','client'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x584f,0x97));var _0xf584=function(_0x431807,_0x187385){_0x431807=_0x431807-0x0;var _0x51d062=_0x584f[_0x431807];return _0x51d062;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf584('0x0'));var client=jayson[_0xf584('0x1')][_0xf584('0x2')]({'port':0x232b});function request(_0x5eee14,_0x43ea27){return new BPromise(function(_0x34a9eb,_0x3ce7f8){return client['request'](_0x5eee14,_0x43ea27)[_0xf584('0x3')](function(_0x52a590){if(_0x52a590[_0xf584('0x4')]){return _0x3ce7f8(_0x52a590[_0xf584('0x4')][_0xf584('0x5')]);}else{return _0x34a9eb(_0x52a590[_0xf584('0x6')]);}})[_0xf584('0x7')](function(_0x5d6d8c){return _0x3ce7f8(_0x5d6d8c);});});}exports['sendMailMessage']=function(_0xe21b2c,_0x5bcacb){return request(_0xf584('0x8'),{'account':_0xe21b2c,'message':_0x5bcacb});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index e653651..83ccd07 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 _0x192b=['callerid','dnid','traverseBFS','clear','gotoc','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','vertex','[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','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','mxCell','isArray','target','addEdge','value','toJson','production','start','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname'];(function(_0x393733,_0x487cc9){var _0x400bce=function(_0x4a822e){while(--_0x4a822e){_0x393733['push'](_0x393733['shift']());}};_0x400bce(++_0x487cc9);}(_0x192b,0x1b5));var _0xb192=function(_0x1cb690,_0x5592e3){_0x1cb690=_0x1cb690-0x0;var _0x3bebd4=_0x192b[_0x1cb690];return _0x3bebd4;};'use strict';var _=require(_0xb192('0x0'));var moment=require(_0xb192('0x1'));var parser=require(_0xb192('0x2'));var util=require(_0xb192('0x3'));var logger=require(_0xb192('0x4'))(_0xb192('0x5'));var rpc=require(_0xb192('0x6'));var mailRpc=require(_0xb192('0x7'));var Graph=require(_0xb192('0x8'));var Vertices=require(_0xb192('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x2d2300){logger[_0xb192('0xa')](_0xb192('0xb'),_0x2d2300[_0xb192('0xc')]);return[];});}function addVertex(_0x3134af,_0x5ae090,_0x121f52){_0x5ae090[_0xb192('0xd')]=_0x121f52;if(_0x5ae090[_0xb192('0xe')]('retry')){_0x5ae090['maxRetry']=parseInt(_0x5ae090[_0xb192('0xf')],0xa);}_0x3134af['addVertex'](_[_0xb192('0x10')](_0x5ae090,_0xb192('0x11')));}function initGraph(_0x16c533,_0x3e56b7){var _0x131f43=new Graph();for(var _0x4c3fe6 in _0x16c533){if(_0x16c533[_0xb192('0xe')](_0x4c3fe6)){if(_[_0xb192('0x12')](_0x16c533[_0x4c3fe6])){for(var _0x3142c6=0x0;_0x3142c6<_0x16c533[_0x4c3fe6]['length'];_0x3142c6+=0x1){addVertex(_0x131f43,_0x16c533[_0x4c3fe6][_0x3142c6],_0x4c3fe6);}}else{addVertex(_0x131f43,_0x16c533[_0x4c3fe6],_0x4c3fe6);}}}for(var _0x45acbf=0x0;_0x45acbf<_0x3e56b7['length'];_0x45acbf+=0x1){if(_0x3e56b7[_0x45acbf]['source']&&_0x3e56b7[_0x45acbf][_0xb192('0x13')]){_0x131f43[_0xb192('0x14')](_0x3e56b7[_0x45acbf]['source'],_0x3e56b7[_0x45acbf][_0xb192('0x13')],_0x3e56b7[_0x45acbf][_0xb192('0x15')]);}}return _0x131f43;}function getRoot(_0x4ed894){return parser[_0xb192('0x16')](_0x4ed894,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x53b773){return util['inspect'](_0x53b773,{'showHidden':![],'depth':null});}function initialize(_0x5657f6,_0x5759c0){var _0x124504=getRoot(_0x5657f6[_0xb192('0x17')]);if(!_0x124504||!_0x124504[_0xb192('0x18')])return;var _0x3beb51,_0x18b802,_0x5de826;logger[_0xb192('0x19')](_0xb192('0x1a'),JSON[_0xb192('0x1b')](_0x124504,null,0x2));_0x5759c0[_0xb192('0x1c')]=moment()[_0xb192('0x1d')](_0xb192('0x1e'));_0x3beb51=initGraph(_[_0xb192('0x10')](_0x124504,'mxCell'),_0x124504[_0xb192('0x11')]);_0x18b802=new Vertices(_0x5759c0,rpc,mailRpc);logger[_0xb192('0x1f')](util['format'](_0xb192('0x20'),_0x5759c0[_0xb192('0x21')],_0x5759c0[_0xb192('0x22')],_0x5759c0[_0xb192('0x23')],_0x5759c0[_0xb192('0x24')],_0x5759c0['uniqueid']));_0x3beb51[_0xb192('0x25')](_0x124504[_0xb192('0x18')]['id'],function(_0xbcce63){try{_0xbcce63=_0x18b802[_0xb192('0x26')](_0xbcce63);logger[_0xb192('0x19')]('vertex',JSON[_0xb192('0x1b')](_0xbcce63,null,0x2));if(_0xbcce63[_0xb192('0xd')]===_0xb192('0x27')){logger[_0xb192('0x1f')](_0xb192('0x28'));_0x5759c0[_0xb192('0x29')]=_0xbcce63[_0xb192('0x29')]||_0x5759c0['context'];_0x5759c0[_0xb192('0x2a')]=_0xbcce63['extension'];_0x5759c0[_0xb192('0x2b')]=_0xbcce63[_0xb192('0x2b')]?_0xbcce63[_0xb192('0x2b')]-0x1:0x1;return null;}else if(_0xbcce63&&_0x18b802[_0xbcce63[_0xb192('0xd')]]){_0x5de826=_0x18b802[_0xbcce63[_0xb192('0xd')]](_0xbcce63);logger['info'](_0xb192('0x2c'),JSON[_0xb192('0x1b')](_0x5de826,null,0x2));if(_0x5de826&&_0x5de826['code']===AGI_CODE_SUCCESS&&_0x5de826[_0xb192('0x2d')]!==AGI_RESULT_ERROR&&!_0x5759c0[_0xb192('0x2e')]){logger[_0xb192('0x19')](_0xb192('0x2c'),inspect(_0x5de826));return _[_0xb192('0x2f')](_0x5de826[_0xb192('0x2d')])?null:_0x5de826[_0xb192('0x2d')][_0xb192('0x30')]();}else{logger[_0xb192('0xa')]('response',inspect(_0x5de826));return null;}}else{logger[_0xb192('0xa')](_0xb192('0x31'));return null;}}catch(_0x239418){logger[_0xb192('0xa')](_0x239418[_0xb192('0xc')]);return null;}});if(_0x124504[_0xb192('0x32')]){logger[_0xb192('0x1f')](util[_0xb192('0x1d')](_0xb192('0x33'),_0x5759c0[_0xb192('0x21')],_0x5759c0[_0xb192('0x22')],_0x5759c0[_0xb192('0x23')],_0x5759c0[_0xb192('0x24')],_0x5759c0['uniqueid']));_0x3beb51[_0xb192('0x25')](_0x124504['finally']['id'],function(_0x31e9ff){try{_0x31e9ff=_0x18b802[_0xb192('0x26')](_0x31e9ff);logger['debug'](_0xb192('0x34'),JSON[_0xb192('0x1b')](_0x31e9ff,null,0x2));if(_0x31e9ff&&_0x18b802[_0x31e9ff[_0xb192('0xd')]]){_0x5de826=_0x18b802[_0x31e9ff['agicommand']](_0x31e9ff);if(_0x5de826){logger[_0xb192('0x19')](_0xb192('0x2c'),inspect(_0x5de826));return _[_0xb192('0x2f')](_0x5de826[_0xb192('0x2d')])?null:_0x5de826['result'][_0xb192('0x30')]();}else{logger[_0xb192('0xa')](_0xb192('0x2c'),inspect(_0x5de826));return null;}}else{logger['error'](_0xb192('0x31'));return null;}}catch(_0x335c5c){logger['error'](_0x335c5c['stack']);return null;}});}logger[_0xb192('0x1f')](util[_0xb192('0x1d')](_0xb192('0x35'),_0x5759c0[_0xb192('0x21')],_0x5759c0[_0xb192('0x22')],_0x5759c0[_0xb192('0x23')],_0x5759c0['dnid'],_0x5759c0['uniqueid']));logger[_0xb192('0x1f')](util['format'](_0xb192('0x36'),_0x5759c0[_0xb192('0x29')],_0x5759c0[_0xb192('0x2a')],parseInt(_0x5759c0[_0xb192('0x2b')],0xa)+0x1));_0x5759c0[_0xb192('0x37')](_0x5759c0[_0xb192('0x29')],_0x5759c0['extension'],parseInt(_0x5759c0[_0xb192('0x2b')],0xa)+0x1);_0x5759c0['close']();}function handleNotFound(_0x5d3fb5){logger[_0xb192('0xa')](util[_0xb192('0x1d')](_0xb192('0x38'),_0x5d3fb5[_0xb192('0x21')]));_0x5d3fb5[_0xb192('0x37')](_0x5d3fb5[_0xb192('0x29')],_0x5d3fb5[_0xb192('0x2a')],parseInt(_0x5d3fb5[_0xb192('0x2b')],0xa)+0x1);_0x5d3fb5[_0xb192('0x39')]();}function handleUnpublished(_0x50e15c){logger[_0xb192('0xa')](util[_0xb192('0x1d')]('Project\x20%s\x20not\x20published',_0x50e15c['arg_1']));_0x50e15c[_0xb192('0x37')](_0x50e15c[_0xb192('0x29')],_0x50e15c[_0xb192('0x2a')],parseInt(_0x50e15c[_0xb192('0x2b')],0xa)+0x1);_0x50e15c[_0xb192('0x39')]();}module[_0xb192('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x8046=['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','uniqueid','start','clear','vertex','stringify','gotoc','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','traverseBFS','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./mailRpc','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','length','addEdge','source','target','toJson','root','inspect','production','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x8046,0x99));var _0x6804=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x8046[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x6804('0x0'));var moment=require(_0x6804('0x1'));var parser=require(_0x6804('0x2'));var util=require('util');var logger=require(_0x6804('0x3'))(_0x6804('0x4'));var rpc=require(_0x6804('0x5'));var mailRpc=require(_0x6804('0x6'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x6804('0x7')]()['catch'](function(_0x480f42){logger[_0x6804('0x8')](_0x6804('0x9'),_0x480f42[_0x6804('0xa')]);return[];});}function addVertex(_0x102f15,_0x38f0fb,_0x51dc26){_0x38f0fb[_0x6804('0xb')]=_0x51dc26;if(_0x38f0fb[_0x6804('0xc')]('retry')){_0x38f0fb['maxRetry']=parseInt(_0x38f0fb[_0x6804('0xd')],0xa);}_0x102f15['addVertex'](_[_0x6804('0xe')](_0x38f0fb,'mxCell'));}function initGraph(_0x12f10d,_0x3ebd8a){var _0x474549=new Graph();for(var _0x3f0f73 in _0x12f10d){if(_0x12f10d['hasOwnProperty'](_0x3f0f73)){if(_['isArray'](_0x12f10d[_0x3f0f73])){for(var _0x255edc=0x0;_0x255edc<_0x12f10d[_0x3f0f73][_0x6804('0xf')];_0x255edc+=0x1){addVertex(_0x474549,_0x12f10d[_0x3f0f73][_0x255edc],_0x3f0f73);}}else{addVertex(_0x474549,_0x12f10d[_0x3f0f73],_0x3f0f73);}}}for(var _0x476de2=0x0;_0x476de2<_0x3ebd8a[_0x6804('0xf')];_0x476de2+=0x1){if(_0x3ebd8a[_0x476de2]['source']&&_0x3ebd8a[_0x476de2]['target']){_0x474549[_0x6804('0x10')](_0x3ebd8a[_0x476de2][_0x6804('0x11')],_0x3ebd8a[_0x476de2][_0x6804('0x12')],_0x3ebd8a[_0x476de2]['value']);}}return _0x474549;}function getRoot(_0x210cf7){return parser[_0x6804('0x13')](_0x210cf7,{'object':!![]})['mxGraphModel'][_0x6804('0x14')];}function inspect(_0x5a55f8){return util[_0x6804('0x15')](_0x5a55f8,{'showHidden':![],'depth':null});}function initialize(_0x443f4b,_0x1dc4ca){var _0x12f70e=getRoot(_0x443f4b[_0x6804('0x16')]);if(!_0x12f70e||!_0x12f70e['start'])return;var _0x10455c,_0xe88eb9,_0x480660;logger[_0x6804('0x17')]('root',JSON['stringify'](_0x12f70e,null,0x2));_0x1dc4ca[_0x6804('0x18')]=moment()[_0x6804('0x19')](_0x6804('0x1a'));_0x10455c=initGraph(_[_0x6804('0xe')](_0x12f70e,_0x6804('0x1b')),_0x12f70e['mxCell']);_0xe88eb9=new Vertices(_0x1dc4ca,rpc,mailRpc);logger[_0x6804('0x1c')](util[_0x6804('0x19')](_0x6804('0x1d'),_0x1dc4ca[_0x6804('0x1e')],_0x1dc4ca[_0x6804('0x1f')],_0x1dc4ca['callerid'],_0x1dc4ca['dnid'],_0x1dc4ca[_0x6804('0x20')]));_0x10455c['traverseBFS'](_0x12f70e[_0x6804('0x21')]['id'],function(_0x2f4976){try{_0x2f4976=_0xe88eb9[_0x6804('0x22')](_0x2f4976);logger[_0x6804('0x17')](_0x6804('0x23'),JSON[_0x6804('0x24')](_0x2f4976,null,0x2));if(_0x2f4976[_0x6804('0xb')]===_0x6804('0x25')){logger[_0x6804('0x1c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1dc4ca['context']=_0x2f4976[_0x6804('0x26')]||_0x1dc4ca[_0x6804('0x26')];_0x1dc4ca[_0x6804('0x27')]=_0x2f4976[_0x6804('0x27')];_0x1dc4ca[_0x6804('0x28')]=_0x2f4976[_0x6804('0x28')]?_0x2f4976[_0x6804('0x28')]-0x1:0x1;return null;}else if(_0x2f4976&&_0xe88eb9[_0x2f4976[_0x6804('0xb')]]){_0x480660=_0xe88eb9[_0x2f4976[_0x6804('0xb')]](_0x2f4976);logger[_0x6804('0x1c')](_0x6804('0x29'),JSON[_0x6804('0x24')](_0x480660,null,0x2));if(_0x480660&&_0x480660[_0x6804('0x2a')]===AGI_CODE_SUCCESS&&_0x480660[_0x6804('0x2b')]!==AGI_RESULT_ERROR&&!_0x1dc4ca[_0x6804('0x2c')]){logger[_0x6804('0x17')](_0x6804('0x29'),inspect(_0x480660));return _[_0x6804('0x2d')](_0x480660[_0x6804('0x2b')])?null:_0x480660['result'][_0x6804('0x2e')]();}else{logger[_0x6804('0x8')](_0x6804('0x29'),inspect(_0x480660));return null;}}else{logger[_0x6804('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x246290){logger[_0x6804('0x8')](_0x246290[_0x6804('0xa')]);return null;}});if(_0x12f70e[_0x6804('0x2f')]){logger['info'](util[_0x6804('0x19')](_0x6804('0x30'),_0x1dc4ca['arg_1'],_0x1dc4ca[_0x6804('0x1f')],_0x1dc4ca[_0x6804('0x31')],_0x1dc4ca[_0x6804('0x32')],_0x1dc4ca[_0x6804('0x20')]));_0x10455c[_0x6804('0x33')](_0x12f70e[_0x6804('0x2f')]['id'],function(_0x3bc0da){try{_0x3bc0da=_0xe88eb9[_0x6804('0x22')](_0x3bc0da);logger['debug'](_0x6804('0x23'),JSON[_0x6804('0x24')](_0x3bc0da,null,0x2));if(_0x3bc0da&&_0xe88eb9[_0x3bc0da[_0x6804('0xb')]]){_0x480660=_0xe88eb9[_0x3bc0da['agicommand']](_0x3bc0da);if(_0x480660){logger[_0x6804('0x17')](_0x6804('0x29'),inspect(_0x480660));return _[_0x6804('0x2d')](_0x480660[_0x6804('0x2b')])?null:_0x480660[_0x6804('0x2b')]['toString']();}else{logger[_0x6804('0x8')](_0x6804('0x29'),inspect(_0x480660));return null;}}else{logger[_0x6804('0x8')](_0x6804('0x34'));return null;}}catch(_0x8ac415){logger['error'](_0x8ac415[_0x6804('0xa')]);return null;}});}logger['info'](util['format'](_0x6804('0x35'),_0x1dc4ca[_0x6804('0x1e')],_0x1dc4ca['calleridname'],_0x1dc4ca[_0x6804('0x31')],_0x1dc4ca[_0x6804('0x32')],_0x1dc4ca[_0x6804('0x20')]));logger['info'](util[_0x6804('0x19')](_0x6804('0x36'),_0x1dc4ca[_0x6804('0x26')],_0x1dc4ca[_0x6804('0x27')],parseInt(_0x1dc4ca[_0x6804('0x28')],0xa)+0x1));_0x1dc4ca[_0x6804('0x37')](_0x1dc4ca['context'],_0x1dc4ca[_0x6804('0x27')],parseInt(_0x1dc4ca[_0x6804('0x28')],0xa)+0x1);_0x1dc4ca[_0x6804('0x38')]();}function handleNotFound(_0x133a62){logger[_0x6804('0x8')](util[_0x6804('0x19')](_0x6804('0x39'),_0x133a62[_0x6804('0x1e')]));_0x133a62['continueAt'](_0x133a62[_0x6804('0x26')],_0x133a62['extension'],parseInt(_0x133a62[_0x6804('0x28')],0xa)+0x1);_0x133a62[_0x6804('0x38')]();}function handleUnpublished(_0x496df3){logger[_0x6804('0x8')](util[_0x6804('0x19')](_0x6804('0x3a'),_0x496df3[_0x6804('0x1e')]));_0x496df3['continueAt'](_0x496df3['context'],_0x496df3[_0x6804('0x27')],parseInt(_0x496df3[_0x6804('0x28')],0xa)+0x1);_0x496df3[_0x6804('0x38')]();}module[_0x6804('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index d20e532..ea649ab 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 _0xb1b9=['emit','headers','line','exports','util','Transform','_localBuffer','prototype','_transform','_inBody','indexOf','substring','length','split','slice','trim'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb1b9,0x64));var _0x9b1b=function(_0x38867f,_0x1e0ec7){_0x38867f=_0x38867f-0x0;var _0x41c3f0=_0xb1b9[_0x38867f];return _0x41c3f0;};'use strict';var util=require(_0x9b1b('0x0'));var Transform=require('stream')[_0x9b1b('0x1')];function AGIReply(_0x3e8c36){Transform['call'](this,_0x3e8c36);this[_0x9b1b('0x2')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x9b1b('0x3')][_0x9b1b('0x4')]=function(_0x19585c,_0x46ad0e,_0x50964e){var _0x48e807='\x0a',_0x28ec9d=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x4592bb=-0x1,_0x102890=-0x1,_0x2ad282='',_0x12246d=0x0,_0x186f6a='',_0x550b1f='';this['_localBuffer']+=_0x19585c['toString']();_0x186f6a=this[_0x9b1b('0x2')];if(!this[_0x9b1b('0x5')]){_0x12246d=0x0;while(_0x28ec9d[_0x12246d]){while((_0x102890=_0x186f6a[_0x9b1b('0x6')](_0x28ec9d[_0x12246d]))!=-0x1){_0x2ad282=_0x28ec9d[_0x12246d];_0x550b1f=_0x186f6a[_0x9b1b('0x7')](0x0,_0x102890);_0x186f6a=_0x186f6a['substring'](_0x102890+_0x2ad282[_0x9b1b('0x8')]);var _0x18c3ba=_0x550b1f[_0x9b1b('0x9')](_0x48e807),_0x49831f=0x0,_0x4d446c={},_0xbed86='',_0x4290e6='',_0x523323=-0x1;while(_0x18c3ba[_0x49831f]){_0x523323=_0x18c3ba[_0x49831f]['indexOf'](':');if(_0x523323!=-0x1){_0xbed86=_0x18c3ba[_0x49831f][_0x9b1b('0xa')](0x0,_0x523323)[_0x9b1b('0xb')]();_0x4290e6=_0x18c3ba[_0x49831f][_0x9b1b('0xa')](_0x523323+0x1)['trim']();if(_0xbed86[_0x9b1b('0x8')]>0x0){_0x4d446c[_0xbed86]=_0x4290e6;}}else{}_0x49831f++;}this[_0x9b1b('0xc')](_0x9b1b('0xd'),_0x4d446c);this[_0x9b1b('0x5')]=!![];}_0x12246d++;}this[_0x9b1b('0x2')]=_0x186f6a;}else{while((_0x4592bb=_0x186f6a[_0x9b1b('0x6')](_0x48e807))!=-0x1){_0x550b1f=_0x186f6a['substring'](0x0,_0x4592bb);this[_0x9b1b('0xc')](_0x9b1b('0xe'),_0x550b1f);_0x186f6a=_0x186f6a[_0x9b1b('0x7')](_0x4592bb+_0x48e807[_0x9b1b('0x8')]);}this[_0x9b1b('0x2')]=_0x186f6a;}_0x50964e();};module[_0x9b1b('0xf')]=AGIReply; \ No newline at end of file +var _0x008d=['substring','line','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','indexOf','length','split','slice','trim','emit','headers'];(function(_0x32d8f6,_0x153146){var _0x4d6740=function(_0x5e41a6){while(--_0x5e41a6){_0x32d8f6['push'](_0x32d8f6['shift']());}};_0x4d6740(++_0x153146);}(_0x008d,0x9b));var _0xd008=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x008d[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0xd008('0x0'));var Transform=require(_0xd008('0x1'))[_0xd008('0x2')];function AGIReply(_0xc5c8da){Transform[_0xd008('0x3')](this,_0xc5c8da);this[_0xd008('0x4')]='';this[_0xd008('0x5')]=![];}util[_0xd008('0x6')](AGIReply,Transform);AGIReply[_0xd008('0x7')]['_transform']=function(_0x373444,_0x3add07,_0x439a36){var _0x24b1ec='\x0a',_0x367e24=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x376da2=-0x1,_0xca4961=-0x1,_0xa4df7d='',_0x1f6a6d=0x0,_0x4fd4e3='',_0x39ec1a='';this[_0xd008('0x4')]+=_0x373444['toString']();_0x4fd4e3=this[_0xd008('0x4')];if(!this[_0xd008('0x5')]){_0x1f6a6d=0x0;while(_0x367e24[_0x1f6a6d]){while((_0xca4961=_0x4fd4e3[_0xd008('0x8')](_0x367e24[_0x1f6a6d]))!=-0x1){_0xa4df7d=_0x367e24[_0x1f6a6d];_0x39ec1a=_0x4fd4e3['substring'](0x0,_0xca4961);_0x4fd4e3=_0x4fd4e3['substring'](_0xca4961+_0xa4df7d[_0xd008('0x9')]);var _0x10d3fd=_0x39ec1a[_0xd008('0xa')](_0x24b1ec),_0xed62ca=0x0,_0x23fbee={},_0xf913da='',_0x5d6ea5='',_0x31930e=-0x1;while(_0x10d3fd[_0xed62ca]){_0x31930e=_0x10d3fd[_0xed62ca][_0xd008('0x8')](':');if(_0x31930e!=-0x1){_0xf913da=_0x10d3fd[_0xed62ca][_0xd008('0xb')](0x0,_0x31930e)['trim']();_0x5d6ea5=_0x10d3fd[_0xed62ca][_0xd008('0xb')](_0x31930e+0x1)[_0xd008('0xc')]();if(_0xf913da[_0xd008('0x9')]>0x0){_0x23fbee[_0xf913da]=_0x5d6ea5;}}else{}_0xed62ca++;}this[_0xd008('0xd')](_0xd008('0xe'),_0x23fbee);this['_inBody']=!![];}_0x1f6a6d++;}this['_localBuffer']=_0x4fd4e3;}else{while((_0x376da2=_0x4fd4e3[_0xd008('0x8')](_0x24b1ec))!=-0x1){_0x39ec1a=_0x4fd4e3[_0xd008('0xf')](0x0,_0x376da2);this[_0xd008('0xd')](_0xd008('0x10'),_0x39ec1a);_0x4fd4e3=_0x4fd4e3[_0xd008('0xf')](_0x376da2+_0x24b1ec['length']);}this[_0xd008('0x4')]=_0x4fd4e3;}_0x439a36();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9c94246..39d3bdc 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 _0x45d1=['getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','message','result','catch','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','getContactByPhone','GetContactByPhone'];(function(_0x36df24,_0x35e373){var _0x339584=function(_0x4b9097){while(--_0x4b9097){_0x36df24['push'](_0x36df24['shift']());}};_0x339584(++_0x35e373);}(_0x45d1,0x1cb));var _0x145d=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0x45d1[_0x1a7e4b];return _0x37a8fd;};'use strict';var _=require(_0x145d('0x0'));var moment=require(_0x145d('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x145d('0x2')][_0x145d('0x3')]({'port':0x2329});function request(_0x4f5dd4,_0x22f728){return new Promise(function(_0x55eb4e,_0x3076c2){return client[_0x145d('0x4')](_0x4f5dd4,_0x22f728)[_0x145d('0x5')](function(_0x211a9d){if(_0x211a9d[_0x145d('0x6')]){return _0x3076c2(_0x211a9d[_0x145d('0x6')][_0x145d('0x7')]);}else{return _0x55eb4e(_0x211a9d[_0x145d('0x8')]);}})[_0x145d('0x9')](function(_0x47eadc){return _0x3076c2(_0x47eadc);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x145d('0xa'),_0x145d('0xb')]}});};exports[_0x145d('0xc')]=function(_0x583865){return request(_0x145d('0xd'),{'options':{'raw':![],'where':{'name':_0x583865},'attributes':['production']}});};exports[_0x145d('0xe')]=function(_0x470c3e){return request(_0x145d('0xf'),{'options':{'raw':![],'where':{'id':_0x470c3e},'include':[{'model':_0x145d('0x10'),'as':'Smtp','include':[{'model':_0x145d('0x11'),'as':_0x145d('0x11')}]}],'attributes':['id','name',_0x145d('0x12')],'smtp':!![]}});};exports[_0x145d('0x13')]=function(_0x45577b){return request(_0x145d('0xd'),{'options':{'where':{'id':_0x45577b},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x100e7d){return request(_0x145d('0x14'),{'options':{'where':{'id':_0x100e7d},'attributes':[_0x145d('0xa')]}});};exports['getVariableById']=function(_0x24eaa2){return request(_0x145d('0x15'),{'options':{'where':{'id':_0x24eaa2},'attributes':[_0x145d('0xa')]}});};exports[_0x145d('0x16')]=function(_0xf4ff35){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xf4ff35},'attributes':[_0x145d('0x17')]}});};exports[_0x145d('0x18')]=function(_0x2f2353){return request('ShowUser',{'options':{'where':{'id':_0x2f2353},'attributes':[_0x145d('0xa')]}});};exports[_0x145d('0x19')]=function(_0x197b53){return request(_0x145d('0x1a'),{'options':{'where':{'phone':_0x197b53['phone']},'attributes':['id']}});};exports[_0x145d('0x1b')]=function(_0x295918){return request(_0x145d('0x1c'),{'options':{'where':{'id':_0x295918},'attributes':['name']}});};exports[_0x145d('0x1d')]=function(_0x46fbd8){return request('ShowSound',{'options':{'where':{'id':_0x46fbd8},'attributes':[_0x145d('0x1e')]}});};exports[_0x145d('0x1f')]=function(_0x21b57f){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x21b57f},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x145d('0x20')]=function(_0x11bf8b){return request(_0x145d('0x21'),{'options':{'where':{'id':_0x11bf8b},'attributes':['id',_0x145d('0xa')]}});};exports['createSmsMessage']=function(_0x1a6cd2){return request(_0x145d('0x22'),{'body':_0x1a6cd2});};exports['createSquareDetailsReport']=function(_0x869b49){return request('CreateSquareDetailsReport',{'body':_0x869b49});};exports['createSquareReport']=function(_0xe1390f){return request('CreateSquareReport',{'body':_[_0x145d('0x23')](_0xe1390f,{'project_name':_0xe1390f[_0x145d('0x24')],'prev_project_name':_0xe1390f[_0x145d('0x25')]||'','is_subproject':_0xe1390f[_0x145d('0x25')]?!![]:![],'leaveAt':moment()[_0x145d('0x26')](_0x145d('0x27'))})});};exports[_0x145d('0x28')]=function(_0x5dbccb){return request(_0x145d('0x29'),{'body':_0x5dbccb});};exports['createSquareMessage']=function(_0x1f1557){return request('CreateSquareMessage',{'body':_0x1f1557});};exports[_0x145d('0x2a')]=function(_0x571909){return request(_0x145d('0x2b'),{'options':{'raw':![],'where':{'phone':_0x571909[_0x145d('0x2c')],'ListId':_0x571909[_0x145d('0x2d')]}}})[_0x145d('0x5')](function(_0x19757f){if(_0x19757f){return _0x19757f;}return request(_0x145d('0x2e'),{'body':_0x571909});});};exports['getPauseById']=function(_0x5d73e5){return request('ShowPause',{'options':{'where':{'id':_0x5d73e5},'attributes':[_0x145d('0xa')]}});};exports[_0x145d('0x2f')]=function(_0x22ebaa,_0xac4fd4){return request(_0x145d('0x30'),{'body':{'interface':_0xac4fd4},'options':{'where':_0x22ebaa}});};exports['agentPause']=function(_0x5af47f,_0x50fb6c,_0x43ca25){return request(_0x145d('0x31'),{'body':{'type':_0x50fb6c,'uniqueid':_0x43ca25},'options':{'where':_0x5af47f}});};exports[_0x145d('0x32')]=function(_0x9d99fe){return request(_0x145d('0x33'),{'body':{},'options':{'where':_0x9d99fe}});};exports[_0x145d('0x34')]=function(_0x4546e4){return request(_0x145d('0x35'),{'body':{},'options':{'where':_0x4546e4}});}; \ No newline at end of file +var _0xeddd=['email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider'];(function(_0x2eb27e,_0x473f5e){var _0x2dfefc=function(_0x134bf7){while(--_0x134bf7){_0x2eb27e['push'](_0x2eb27e['shift']());}};_0x2dfefc(++_0x473f5e);}(_0xeddd,0x69));var _0xdedd=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xeddd[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xdedd('0x0'));var moment=require(_0xdedd('0x1'));var jayson=require(_0xdedd('0x2'));var client=jayson[_0xdedd('0x3')]['http']({'port':0x2329});function request(_0x3a53b4,_0x591965){return new Promise(function(_0x10de65,_0xd2ff49){return client['request'](_0x3a53b4,_0x591965)[_0xdedd('0x4')](function(_0x13563b){if(_0x13563b[_0xdedd('0x5')]){return _0xd2ff49(_0x13563b[_0xdedd('0x5')][_0xdedd('0x6')]);}else{return _0x10de65(_0x13563b[_0xdedd('0x7')]);}})[_0xdedd('0x8')](function(_0x260839){return _0xd2ff49(_0x260839);});});}exports[_0xdedd('0x9')]=function(){return request(_0xdedd('0xa'),{'options':{'raw':![],'attributes':['id',_0xdedd('0xb'),_0xdedd('0xc')]}});};exports['getSquareProject']=function(_0x3ef3d3){return request(_0xdedd('0xd'),{'options':{'raw':![],'where':{'name':_0x3ef3d3},'attributes':[_0xdedd('0xc')]}});};exports[_0xdedd('0xe')]=function(_0x5db016){return request(_0xdedd('0xf'),{'options':{'raw':![],'where':{'id':_0x5db016},'include':[{'model':_0xdedd('0x10'),'as':_0xdedd('0x11'),'include':[{'model':_0xdedd('0x12'),'as':_0xdedd('0x12')}]}],'attributes':['id',_0xdedd('0xb'),_0xdedd('0x13')],'smtp':!![]}});};exports[_0xdedd('0x14')]=function(_0x3680f4){return request(_0xdedd('0xd'),{'options':{'where':{'id':_0x3680f4},'attributes':[_0xdedd('0xb')]}});};exports[_0xdedd('0x15')]=function(_0x3b098a){return request(_0xdedd('0x16'),{'options':{'where':{'id':_0x3b098a},'attributes':[_0xdedd('0xb')]}});};exports[_0xdedd('0x17')]=function(_0x2de906){return request(_0xdedd('0x18'),{'options':{'where':{'id':_0x2de906},'attributes':[_0xdedd('0xb')]}});};exports['getSquareOdbcById']=function(_0x3cf7b6){return request(_0xdedd('0x19'),{'options':{'where':{'id':_0x3cf7b6},'attributes':['dsn']}});};exports[_0xdedd('0x1a')]=function(_0x114694){return request(_0xdedd('0x1b'),{'options':{'where':{'id':_0x114694},'attributes':['name']}});};exports[_0xdedd('0x1c')]=function(_0x24e331){return request(_0xdedd('0x1d'),{'options':{'where':{'phone':_0x24e331[_0xdedd('0x1e')]},'attributes':['id']}});};exports[_0xdedd('0x1f')]=function(_0x530faf){return request(_0xdedd('0x20'),{'options':{'where':{'id':_0x530faf},'attributes':[_0xdedd('0xb')]}});};exports[_0xdedd('0x21')]=function(_0x143c5f){return request(_0xdedd('0x22'),{'options':{'where':{'id':_0x143c5f},'attributes':[_0xdedd('0x23')]}});};exports[_0xdedd('0x24')]=function(_0x187487){return request(_0xdedd('0x25'),{'options':{'raw':![],'where':{'id':_0x187487},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x53b2b2){return request(_0xdedd('0x26'),{'options':{'where':{'id':_0x53b2b2},'attributes':['id',_0xdedd('0xb')]}});};exports[_0xdedd('0x27')]=function(_0x31b14f){return request(_0xdedd('0x28'),{'body':_0x31b14f});};exports['createSquareDetailsReport']=function(_0xce1515){return request(_0xdedd('0x29'),{'body':_0xce1515});};exports[_0xdedd('0x2a')]=function(_0x242b39){return request('CreateSquareReport',{'body':_[_0xdedd('0x2b')](_0x242b39,{'project_name':_0x242b39[_0xdedd('0x2c')],'prev_project_name':_0x242b39[_0xdedd('0x2d')]||'','is_subproject':_0x242b39[_0xdedd('0x2d')]?!![]:![],'leaveAt':moment()[_0xdedd('0x2e')](_0xdedd('0x2f'))})});};exports[_0xdedd('0x30')]=function(_0x29efe0){return request(_0xdedd('0x31'),{'body':_0x29efe0});};exports[_0xdedd('0x32')]=function(_0x269ded){return request(_0xdedd('0x33'),{'body':_0x269ded});};exports[_0xdedd('0x34')]=function(_0xa9b7ea){return request(_0xdedd('0x35'),{'options':{'raw':![],'where':{'phone':_0xa9b7ea['phone'],'ListId':_0xa9b7ea['ListId']}}})['then'](function(_0x235195){if(_0x235195){return _0x235195;}return request(_0xdedd('0x36'),{'body':_0xa9b7ea});});};exports[_0xdedd('0x37')]=function(_0x2b3094){return request(_0xdedd('0x38'),{'options':{'where':{'id':_0x2b3094},'attributes':[_0xdedd('0xb')]}});};exports[_0xdedd('0x39')]=function(_0x1419b5,_0x2ddda6){return request('LoginUser',{'body':{'interface':_0x2ddda6},'options':{'where':_0x1419b5}});};exports[_0xdedd('0x3a')]=function(_0x420ae2,_0x55a70c,_0x58a524){return request('PauseUser',{'body':{'type':_0x55a70c,'uniqueid':_0x58a524},'options':{'where':_0x420ae2}});};exports[_0xdedd('0x3b')]=function(_0x460f56){return request(_0xdedd('0x3c'),{'body':{},'options':{'where':_0x460f56}});};exports[_0xdedd('0x3d')]=function(_0x40ad67){return request('LogoutUser',{'body':{},'options':{'where':_0x40ad67}});}; \ 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 ac13b10..4038702 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 _0xbacd=['./lex','./polly'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xbacd,0x1c5));var _0xdbac=function(_0x2089ec,_0x57b828){_0x2089ec=_0x2089ec-0x0;var _0x5698b9=_0xbacd[_0x2089ec];return _0x5698b9;};var polly=require(_0xdbac('0x0'));var lex=require(_0xdbac('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x04e7=['exports','./polly','./lex'];(function(_0x5578ed,_0xb4bcc9){var _0x1bdb67=function(_0x1af359){while(--_0x1af359){_0x5578ed['push'](_0x5578ed['shift']());}};_0x1bdb67(++_0xb4bcc9);}(_0x04e7,0x121));var _0x704e=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x04e7[_0x33bc64];return _0x3fdd34;};var polly=require(_0x704e('0x0'));var lex=require(_0x704e('0x1'));module[_0x704e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ccba7a2..295ad45 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 _0x6c76=['./lib/api','exports'];(function(_0x41c96c,_0x5df7cb){var _0x5a2565=function(_0xa3d120){while(--_0xa3d120){_0x41c96c['push'](_0x41c96c['shift']());}};_0x5a2565(++_0x5df7cb);}(_0x6c76,0x184));var _0x66c7=function(_0x5971ca,_0x54b79a){_0x5971ca=_0x5971ca-0x0;var _0x46c0b6=_0x6c76[_0x5971ca];return _0x46c0b6;};'use strict';var lex=require(_0x66c7('0x0'));module[_0x66c7('0x1')]=function(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b){return lex(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b);}; \ No newline at end of file +var _0xb58b=['exports'];(function(_0x4a786f,_0xbf0030){var _0x5a7fd8=function(_0x5abcdd){while(--_0x5abcdd){_0x4a786f['push'](_0x4a786f['shift']());}};_0x5a7fd8(++_0xbf0030);}(_0xb58b,0x1f1));var _0xbb58=function(_0x40403d,_0x58deeb){_0x40403d=_0x40403d-0x0;var _0x13c2fa=_0xb58b[_0x40403d];return _0x13c2fa;};'use strict';var lex=require('./lib/api');module[_0xbb58('0x0')]=function(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5){return lex(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5);}; \ 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 44308b6..5094fde 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(_0x501265,_0x58d0bb){var _0x4b59b6=function(_0x1855f7){while(--_0x1855f7){_0x501265['push'](_0x501265['shift']());}};_0x4b59b6(++_0x58d0bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x508b38,_0x274e9b){var _0x502bf7=function(_0x3c3b4e){while(--_0x3c3b4e){_0x508b38['push'](_0x508b38['shift']());}};_0x502bf7(++_0x274e9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 f7f6417..6aedaf8 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 _0x81cc=['exports','./lib/api'];(function(_0xe26f14,_0x2c5710){var _0x204593=function(_0x49baa5){while(--_0x49baa5){_0xe26f14['push'](_0xe26f14['shift']());}};_0x204593(++_0x2c5710);}(_0x81cc,0x1d5));var _0xc81c=function(_0xb654c9,_0xa7baea){_0xb654c9=_0xb654c9-0x0;var _0x3c97bc=_0x81cc[_0xb654c9];return _0x3c97bc;};'use strict';var polly=require(_0xc81c('0x0'));module[_0xc81c('0x1')]=function(_0x3de810,_0x4c8b75,_0x1e3977,_0x1aac0b,_0x4e8aa2,_0x59ed9c,_0x1df51f){return polly(_0x3de810,_0x4c8b75,_0x1e3977,_0x1aac0b,_0x4e8aa2,_0x59ed9c,_0x1df51f);}; \ No newline at end of file +var _0x2adf=['exports'];(function(_0x12cd7b,_0x3f8e8d){var _0x4d14ad=function(_0x2661e0){while(--_0x2661e0){_0x12cd7b['push'](_0x12cd7b['shift']());}};_0x4d14ad(++_0x3f8e8d);}(_0x2adf,0xa8));var _0xf2ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2adf[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require('./lib/api');module[_0xf2ad('0x0')]=function(_0x1d09a9,_0x43b2b6,_0x1570d0,_0x1637ab,_0x164abc,_0x262caf,_0x27b673){return polly(_0x1d09a9,_0x43b2b6,_0x1570d0,_0x1637ab,_0x164abc,_0x262caf,_0x27b673);}; \ 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 63e8ec0..e67217a 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 _0x9594=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9594,0x8f));var _0x4959=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x9594[_0x298ed3];return _0x5aad28;};'use strict';var fs=require('fs');var path=require(_0x4959('0x0'));var BPromise=require(_0x4959('0x1'));var rs=require(_0x4959('0x2'));var AWS=require(_0x4959('0x3'));function pollyResult(_0x5a6cd8,_0x3d1e84,_0x133551){return new BPromise(function(_0x2e8ce8,_0x1b882e){_0x5a6cd8[_0x4959('0x4')](_0x3d1e84,function(_0x142746,_0x30ce09){if(_0x142746){_0x1b882e(_0x142746);}else if(_0x30ce09){if(_0x30ce09[_0x4959('0x5')]instanceof Buffer){fs[_0x4959('0x6')](_0x133551,_0x30ce09[_0x4959('0x5')],function(_0x252d8c){if(_0x252d8c){_0x1b882e(_0x252d8c);}else{_0x2e8ce8();}});}else{_0x1b882e(new Error(_0x4959('0x7')));}}else{_0x1b882e(new Error(_0x4959('0x8')));}});});}module[_0x4959('0x9')]=function(_0x48af17,_0x35fcf7,_0x348a0f,_0x3f8af7,_0x3fb9fb,_0xc09370,_0x215903){var _0x12c981=new AWS[(_0x4959('0xa'))]({'accessKeyId':_0x48af17,'secretAccessKey':_0x35fcf7,'region':_0x348a0f});var _0x26d179={'Text':_0x3fb9fb,'TextType':_0xc09370||_0x4959('0xb'),'OutputFormat':_0x4959('0xc'),'VoiceId':_0x3f8af7};return pollyResult(_0x12c981,_0x26d179,_0x215903);}; \ No newline at end of file +var _0x7d18=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','randomstring'];(function(_0x28f963,_0x49eea4){var _0x90a34e=function(_0xeb729b){while(--_0xeb729b){_0x28f963['push'](_0x28f963['shift']());}};_0x90a34e(++_0x49eea4);}(_0x7d18,0x1ad));var _0x87d1=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x7d18[_0x1030ce];return _0x3367fd;};'use strict';var fs=require('fs');var path=require(_0x87d1('0x0'));var BPromise=require(_0x87d1('0x1'));var rs=require(_0x87d1('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3408a7,_0x1489ea,_0x486703){return new BPromise(function(_0x47da5d,_0x4c1a08){_0x3408a7['synthesizeSpeech'](_0x1489ea,function(_0x1e9a0f,_0x162ed0){if(_0x1e9a0f){_0x4c1a08(_0x1e9a0f);}else if(_0x162ed0){if(_0x162ed0[_0x87d1('0x3')]instanceof Buffer){fs[_0x87d1('0x4')](_0x486703,_0x162ed0['AudioStream'],function(_0x72ec1a){if(_0x72ec1a){_0x4c1a08(_0x72ec1a);}else{_0x47da5d();}});}else{_0x4c1a08(new Error(_0x87d1('0x5')));}}else{_0x4c1a08(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x87d1('0x6')]=function(_0x2d971f,_0x34486a,_0x554cb5,_0x12b727,_0x56b997,_0x20fa54,_0xf95c72){var _0x2b6a66=new AWS[(_0x87d1('0x7'))]({'accessKeyId':_0x2d971f,'secretAccessKey':_0x34486a,'region':_0x554cb5});var _0x5019b2={'Text':_0x56b997,'TextType':_0x20fa54||'text','OutputFormat':'mp3','VoiceId':_0x12b727};return pollyResult(_0x2b6a66,_0x5019b2,_0xf95c72);}; \ 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 8c2d0c9..2ccc828 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 _0x4020=['exports','./lib/api'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x4020,0x123));var _0x0402=function(_0x55b6f8,_0x2e3831){_0x55b6f8=_0x55b6f8-0x0;var _0x2b52c4=_0x4020[_0x55b6f8];return _0x2b52c4;};'use strict';var asr=require(_0x0402('0x0'));module[_0x0402('0x1')]=function(_0x865435,_0x276b94,_0x310c78,_0x51cd72){return asr(_0x865435,_0x276b94,_0x310c78);}; \ No newline at end of file +var _0x8936=['./lib/api'];(function(_0x5bf40c,_0x552685){var _0x3c0ac6=function(_0x27617a){while(--_0x27617a){_0x5bf40c['push'](_0x5bf40c['shift']());}};_0x3c0ac6(++_0x552685);}(_0x8936,0x1f4));var _0x6893=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x8936[_0x3b0731];return _0x4204d7;};'use strict';var asr=require(_0x6893('0x0'));module['exports']=function(_0x87a752,_0x1e039d,_0x257b7b,_0x2e509a){return asr(_0x87a752,_0x1e039d,_0x257b7b);}; \ 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 9234fe2..ee68f78 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 _0x2dae=['https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2dae,0xc3));var _0xe2da=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x2dae[_0x2265da];return _0x430c2b;};'use strict';var url=require(_0xe2da('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe2da('0x1');module[_0xe2da('0x2')]=function(_0xcd0055,_0x167432,_0x99b46f){return new BPromise(function(_0x481d97,_0x25b9f2){var _0x439b5d;if(typeof _0xcd0055!==_0xe2da('0x3')||_0xcd0055[_0xe2da('0x4')]===0x0){return _0x25b9f2('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x167432!==_0xe2da('0x3')||_0x167432[_0xe2da('0x4')]===0x0){return _0x25b9f2(_0xe2da('0x5'));}if(typeof _0x99b46f!==_0xe2da('0x6')&&(typeof _0x99b46f!==_0xe2da('0x3')||_0x99b46f[_0xe2da('0x4')]===0x0)){return _0x25b9f2(_0xe2da('0x7'));}try{_0x439b5d=fs[_0xe2da('0x8')](_0xcd0055)[_0xe2da('0x9')]('base64');}catch(_0x52e650){return _0x25b9f2(_0x52e650);}return _0x481d97({'method':_0xe2da('0xa'),'uri':host+_0xe2da('0xb')+_0x167432,'body':{'config':{'encoding':_0xe2da('0xc'),'sampleRateHertz':_0xe2da('0xd'),'languageCode':_0x99b46f},'audio':{'content':_0x439b5d}},'json':!![]});});}; \ No newline at end of file +var _0x01fe=['exports','length','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x01fe,0x102));var _0xe01f=function(_0x5d4e14,_0x2f139b){_0x5d4e14=_0x5d4e14-0x0;var _0x1415f4=_0x01fe[_0x5d4e14];return _0x1415f4;};'use strict';var url=require(_0xe01f('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe01f('0x1');module[_0xe01f('0x2')]=function(_0x4a9e90,_0x577c82,_0x15f6ba){return new BPromise(function(_0x1212f6,_0x9505fa){var _0x92b885;if(typeof _0x4a9e90!=='string'||_0x4a9e90[_0xe01f('0x3')]===0x0){return _0x9505fa('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x577c82!==_0xe01f('0x4')||_0x577c82[_0xe01f('0x3')]===0x0){return _0x9505fa(_0xe01f('0x5'));}if(typeof _0x15f6ba!==_0xe01f('0x6')&&(typeof _0x15f6ba!==_0xe01f('0x4')||_0x15f6ba['length']===0x0)){return _0x9505fa(_0xe01f('0x7'));}try{_0x92b885=fs[_0xe01f('0x8')](_0x4a9e90)['toString'](_0xe01f('0x9'));}catch(_0x54334d){return _0x9505fa(_0x54334d);}return _0x1212f6({'method':_0xe01f('0xa'),'uri':host+_0xe01f('0xb')+_0x577c82,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xe01f('0xc'),'languageCode':_0x15f6ba},'audio':{'content':_0x92b885}},'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 921f998..1beb00d 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 _0xd108=['./asr'];(function(_0x34d3c3,_0x122bb9){var _0x19b256=function(_0x409be5){while(--_0x409be5){_0x34d3c3['push'](_0x34d3c3['shift']());}};_0x19b256(++_0x122bb9);}(_0xd108,0x1d4));var _0x8d10=function(_0x436bc5,_0x47b676){_0x436bc5=_0x436bc5-0x0;var _0x3795fc=_0xd108[_0x436bc5];return _0x3795fc;};var asr=require(_0x8d10('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x0ca4=['exports','./asr'];(function(_0x1a7ead,_0x55b7ff){var _0x4e072f=function(_0x42ec89){while(--_0x42ec89){_0x1a7ead['push'](_0x1a7ead['shift']());}};_0x4e072f(++_0x55b7ff);}(_0x0ca4,0x1ab));var _0x40ca=function(_0xbf5aff,_0x5e4145){_0xbf5aff=_0xbf5aff-0x0;var _0x5e4168=_0x0ca4[_0xbf5aff];return _0x5e4168;};var asr=require(_0x40ca('0x0'));module[_0x40ca('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 edf1226..5ae38dd 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 _0x8752=['unlink','chmodSync','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','from','audioContent','writeFile','generate','googleCloudTTS\x20path','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','action','fulfillment','speech','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','.mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','md5','path','request-promise','randomstring','parse','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','pipe','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8752,0xe7));var _0x2875=function(_0xe92745,_0x5ca465){_0xe92745=_0xe92745-0x0;var _0x5721d8=_0x8752[_0xe92745];return _0x5721d8;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x2875('0x0'));var fs=require('fs');var http=require(_0x2875('0x1'));var https=require(_0x2875('0x2'));var md5=require(_0x2875('0x3'));var path=require(_0x2875('0x4'));var querystring=require('querystring');var rp=require(_0x2875('0x5'));var rs=require(_0x2875('0x6'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require('url')[_0x2875('0x7')];var util=require('util');var aws=require(_0x2875('0x8'));var google=require(_0x2875('0x9'));var sestek=require(_0x2875('0xa'));var tilde=require(_0x2875('0xb'));var logger=require('../../../config/logger')(_0x2875('0xc'));var ISPEECH_API=_0x2875('0xd');function downloadFile(_0x2c7245,_0x1b26c9){return new BPromise(function(_0x10c752,_0x3df2e2){var _0x18e7a2=urlParse(_0x2c7245);var _0x159f8e=_0x18e7a2[_0x2875('0xe')]===_0x2875('0xf')?https:http;var _0x204f68={'host':_0x18e7a2[_0x2875('0x10')],'path':_0x18e7a2[_0x2875('0x4')],'headers':{'user-agent':_0x2875('0x11')}};_0x159f8e[_0x2875('0x12')](_0x204f68,function(_0x36e9d9){if(_0x36e9d9[_0x2875('0x13')]!==0xc8){logger[_0x2875('0x14')](_0x2875('0x15')+_0x2c7245+_0x2875('0x16')+_0x36e9d9['statusCode']+'\x20('+_0x36e9d9[_0x2875('0x17')]+')');_0x3df2e2(new Error(_0x2875('0x15')+_0x2c7245+_0x2875('0x16')+_0x36e9d9[_0x2875('0x13')]+'\x20('+_0x36e9d9[_0x2875('0x17')]+')'));return;}var _0x2a480a=fs['createWriteStream'](_0x1b26c9);_0x2a480a['on'](_0x2875('0x18'),function(){logger[_0x2875('0x19')](_0x2875('0x1a'));_0x2a480a[_0x2875('0x1b')](_0x10c752);});_0x2a480a['on'](_0x2875('0x14'),function(_0x1f36ae){fs['unlink'](_0x1b26c9);logger['error']('download\x20error',_0x1f36ae);_0x3df2e2(_0x1f36ae);});_0x36e9d9[_0x2875('0x1c')](_0x2a480a);})['on'](_0x2875('0x14'),function(_0x3aec2d){logger['error'](_0x3aec2d);_0x3df2e2(_0x3aec2d);})['end']();});}function uploadFile(_0x20ff2d){return new BPromise(function(_0x3ca49d,_0x485eb7){var _0x368819=urlParse(_0x20ff2d);var _0x5cccd0=_0x368819['protocol']===_0x2875('0xf')?https:http;var _0x18970f={'host':_0x368819[_0x2875('0x10')],'path':_0x368819[_0x2875('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x5cccd0[_0x2875('0x12')](_0x18970f,function(_0x583680){if(_0x583680[_0x2875('0x13')]!==0xc8){_0x485eb7(new Error('request\x20to\x20'+_0x20ff2d+_0x2875('0x16')+_0x583680['statusCode']+'\x20('+_0x583680[_0x2875('0x17')]+')'));return;}var _0x519431='';_0x583680['on']('data',function(_0x1532db){_0x519431+=_0x1532db;});_0x583680['on'](_0x2875('0x1d'),function(){_0x3ca49d(_0x519431);});})['on']('error',function(_0x43c41a){_0x485eb7(_0x43c41a);})[_0x2875('0x1d')]();});}function convertFile(_0x390d09,_0x4bd76b){return new BPromise(function(_0x163f93,_0x47057b){var _0xa060=sox[_0x2875('0x1e')](_0x390d09,_0x4bd76b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa060['on'](_0x2875('0x14'),function(_0x3f91dd){logger['error'](_0x2875('0x1f'),_0x3f91dd);_0x47057b(_0x3f91dd);});_0xa060['on']('end',function(){logger[_0x2875('0x19')](_0x2875('0x20'));_0x163f93();});_0xa060[_0x2875('0x21')]();});}function base64Decode(_0x294ac7,_0x2f9441){var _0xdc8a75=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs['generate'](0x4)+_0x2875('0x24'));fs[_0x2875('0x25')](_0xdc8a75,_0x294ac7,'base64');return convertFile(_0xdc8a75,_0x2f9441)[_0x2875('0x26')](function(){try{fs[_0x2875('0x27')](_0xdc8a75);fs[_0x2875('0x28')](_0x2f9441,_0x2875('0x29'));}catch(_0x29ded7){logger['error'](_0x29ded7);}return _0x2f9441[_0x2875('0x2a')]('.')[0x0];});}function base64Encode(_0x639e00){var _0x15e4e8=fs['readFileSync'](_0x639e00);return new Buffer(_0x15e4e8)[_0x2875('0x2b')](_0x2875('0x2c'));}exports[_0x2875('0x2d')]=function(_0x45062e,_0x41a714,_0x1d2e70,_0x32915,_0x42ea97,_0x29e34f){var _0x373c20,_0xc142;var _0x1651cf=_0x2875('0x2e');var _0x3289f6=_0x2875('0x2f')+_0x45062e;var _0x4a456f={};if(_0x41a714===_0x2875('0x30')){_0x4a456f[_0x2875('0x31')]={'ssml':_0x1d2e70};}else{_0x4a456f['input']={'text':_0x1d2e70};};_0x4a456f[_0x2875('0x32')]={'languageCode':_0x32915,'ssmlGender':_0x42ea97};_0x4a456f['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x154a78={'url':_0x1651cf+_0x2875('0x33')+_0x3289f6,'method':_0x2875('0x34'),'json':!![],'body':_0x4a456f};return rp(_0x154a78)[_0x2875('0x26')](function(_0x4653eb){return new BPromise(function(_0x513a2b,_0x13a620){_0x373c20=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs['generate'](0x4)+'.mp3');var _0x28c0cd=Buffer[_0x2875('0x35')](_0x4653eb[_0x2875('0x36')],_0x2875('0x2c'));return fs[_0x2875('0x37')](_0x373c20,_0x28c0cd,function(_0x370aa3){_0x13a620(_0x370aa3);},function(_0x548d96){fs['chmodSync'](_0x373c20,'777');_0x513a2b(_0x548d96);});});})[_0x2875('0x26')](function(_0x7ef56f){_0xc142=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+_0x2875('0x24'));return convertFile(_0x373c20,_0xc142);})['then'](function(){try{fs[_0x2875('0x27')](_0x373c20);fs['chmodSync'](_0xc142,'777');}catch(_0x22c49d){logger[_0x2875('0x14')](_0x22c49d);}logger[_0x2875('0x19')](_0x2875('0x39'),_0xc142['split']('.')[0x0]);return _0xc142[_0x2875('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x5388a9,_0x17f121){var _0x3e1e7a='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x345aa4,_0x1e05de;var _0x3ca01e;var _0x564940={'encoding':_0x2875('0x3a'),'method':_0x2875('0x34'),'timeout':0x2710,'url':_0x3e1e7a,'headers':{'Content-Type':_0x2875('0x3b')},'body':'f.req='+encodeURIComponent(JSON[_0x2875('0x3c')]([[[_0x2875('0x3d'),JSON[_0x2875('0x3c')]([_0x5388a9,_0x17f121||'en',![],_0x2875('0x3e')]),null,_0x2875('0x3f')]]]))};return rp(_0x564940)['then'](function(_0x3585d0){try{_0x3ca01e=eval(_0x3585d0[_0x2875('0x40')](0x5))[0x0][0x2];}catch(_0x4c5f01){throw new Error('parse\x20response\x20failed:\x0a'+_0x3585d0[_0x2875('0x41')]);}if(!_0x3ca01e){if(_0x5388a9[_0x2875('0x42')]>0xc8){throw new Error(_0x2875('0x43'));}else{throw new Error(_0x2875('0x44')+_0x17f121+'\x22\x20might\x20not\x20exist');}}try{_0x3ca01e=eval(_0x3ca01e)[0x0];}catch(_0x2f071c){throw new Error(_0x2875('0x45')+res[_0x2875('0x41')]);}const _0x368bb5=_0x3ca01e;_0x345aa4=path['resolve'](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+'.mp3');fs[_0x2875('0x25')](_0x345aa4,_0x3ca01e,{'encoding':'base64'});_0x1e05de=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+_0x2875('0x24'));return convertFile(_0x345aa4,_0x1e05de);})[_0x2875('0x26')](function(){try{fs[_0x2875('0x27')](_0x345aa4);fs[_0x2875('0x28')](_0x1e05de,_0x2875('0x29'));}catch(_0x15b203){logger[_0x2875('0x14')](_0x15b203);}logger[_0x2875('0x19')](_0x2875('0x46'),_0x1e05de[_0x2875('0x2a')]('.')[0x0]);return _0x1e05de[_0x2875('0x2a')]('.')[0x0];});};exports[_0x2875('0x47')]=function(_0x54b04f,_0x2dc7bc,_0x1fedac){return google[_0x2875('0x48')](_0x54b04f,_0x2dc7bc,_0x1fedac)['then'](function(_0x1078a3){logger[_0x2875('0x19')](_0x1078a3[_0x2875('0x49')]);return rp(_0x1078a3);})[_0x2875('0x26')](function(_0x362054){var _0x53ab20='';var _0x53bf0e=0x0;try{fs[_0x2875('0x27')](_0x54b04f);}catch(_0x59e72a){logger[_0x2875('0x14')](_0x59e72a);}if(_0x362054&&_0x362054[_0x2875('0x4a')]){_0x53ab20=_0x362054[_0x2875('0x4a')][_0x2875('0x4b')](function(_0x3779b6){return _0x3779b6&&_0x3779b6['alternatives'][0x0]&&_0x3779b6[_0x2875('0x4c')][0x0]['transcript']?_0x3779b6[_0x2875('0x4c')][0x0][_0x2875('0x4d')]:'';})[_0x2875('0x4e')]('\x0a');_0x53bf0e=_0x362054[_0x2875('0x4a')][_0x2875('0x4b')](function(_0x4af87c){return _0x4af87c&&_0x4af87c['alternatives'][0x0]&&_0x4af87c[_0x2875('0x4c')][0x0][_0x2875('0x4f')]?_0x4af87c[_0x2875('0x4c')][0x0][_0x2875('0x4f')]:0x0;})[_0x2875('0x4e')]('\x0a');}logger[_0x2875('0x19')](_0x2875('0x50'),_0x53ab20);logger[_0x2875('0x19')](_0x2875('0x51'),_0x53bf0e);return{'transcript':_0x53ab20,'confidence':_0x53bf0e};})[_0x2875('0x52')](function(_0x2e9c53){logger[_0x2875('0x14')]('[%s]\x20%s:%s',_0x2e9c53[_0x2875('0x13')],_0x2e9c53[_0x2875('0x53')],_0x2e9c53[_0x2875('0x54')]);});};exports[_0x2875('0x55')]=function(_0x40304b,_0x13097d,_0x2a7cf3,_0xaafbd7){var _0x1e81bd=apiai(_0x13097d,{'language':_0xaafbd7||'en'});return _0x1e81bd[_0x2875('0x56')](_0x2a7cf3,{'sessionId':md5(_0x40304b)})[_0x2875('0x26')](function(_0x6ab811){logger[_0x2875('0x19')](JSON[_0x2875('0x3c')](_0x6ab811));return{'source':_0x6ab811[_0x2875('0x57')][_0x2875('0x58')],'resolvedQuery':_0x6ab811[_0x2875('0x57')]['resolvedQuery'],'action':_0x6ab811[_0x2875('0x57')][_0x2875('0x59')],'actionIncomplete':_0x6ab811['result']['actionIncomplete'],'speech':_0x6ab811['result'][_0x2875('0x5a')][_0x2875('0x5b')],'score':_0x6ab811['result']['score'],'statusCode':_0x6ab811['status']['code'],'endConversation':_0x6ab811['result'][_0x2875('0x5c')][_0x2875('0x5d')]||![],'isFallbackIntent':_0x6ab811[_0x2875('0x57')][_0x2875('0x5c')][_0x2875('0x5e')]};});};exports['googleDialogflowV2']=function(_0x77dd17,_0xe25daa,_0x512ab5,_0x574735,_0x103986,_0x9a2c5d){var _0x6220ab=_0x574735[_0x2875('0x5f')](/\\n/g,'\x0a');var _0x59e8c4={'credentials':{'private_key':_0x6220ab,'client_email':_0x512ab5}};var _0x3944e4=new dialogflow[(_0x2875('0x60'))](_0x59e8c4);var _0x149f22=_0x3944e4[_0x2875('0x61')](_0xe25daa,md5(_0x77dd17));var _0x529ac1={'session':_0x149f22,'queryInput':{'text':{'text':_0x103986,'languageCode':_0x9a2c5d}}};return _0x3944e4[_0x2875('0x62')](_0x529ac1)[_0x2875('0x26')](function(_0x12c226){if(_0x12c226&&_0x12c226[_0x2875('0x42')]){logger[_0x2875('0x19')](_0x2875('0x63'),JSON[_0x2875('0x3c')](_0x12c226));var _0x400a15=_0x12c226[0x0];if(_0x400a15){var _0x4d4412={'action':_0x400a15[_0x2875('0x64')][_0x2875('0x59')],'allRequiredParamsPresent':_0x400a15[_0x2875('0x64')]['allRequiredParamsPresent'],'endConversation':_0x400a15['queryResult']['diagnosticInfo']&&_0x400a15[_0x2875('0x64')]['diagnosticInfo'][_0x2875('0x65')]?_0x400a15[_0x2875('0x64')][_0x2875('0x66')][_0x2875('0x65')][_0x2875('0x67')][_0x2875('0x68')]:![],'fulfillmentText':_0x400a15['queryResult'][_0x2875('0x69')],'intentName':_0x400a15[_0x2875('0x64')][_0x2875('0x6a')][_0x2875('0x53')],'intentDisplayName':_0x400a15['queryResult'][_0x2875('0x6a')][_0x2875('0x6b')],'isFallbackIntent':_0x400a15[_0x2875('0x64')][_0x2875('0x6a')][_0x2875('0x6c')],'languageCode':_0x400a15['queryResult']['languageCode'],'queryText':_0x400a15[_0x2875('0x64')][_0x2875('0x6d')],'responseId':_0x400a15[_0x2875('0x6e')],'score':_0x400a15['queryResult'][_0x2875('0x6f')],'speech':_0x400a15[_0x2875('0x64')][_0x2875('0x69')],'providerResponse':JSON['stringify'](_0x12c226)};return _0x4d4412;}}});};exports[_0x2875('0x70')]=function(_0x564f28,_0xda696e,_0x3587ba,_0x1a2eb0){return tilde[_0x2875('0x48')](_0x564f28,_0xda696e,_0x3587ba,_0x1a2eb0)['then'](function(_0x2a01d7){try{fs[_0x2875('0x27')](_0x564f28);}catch(_0x357327){logger[_0x2875('0x14')](_0x357327);}logger[_0x2875('0x19')](_0x2875('0x71'),_0x2a01d7[_0x2875('0x4d')]);logger[_0x2875('0x19')](_0x2875('0x72'),_0x2a01d7['confidence']);return _0x2a01d7;});};exports[_0x2875('0x73')]=function(_0x40e2cc,_0x1c96e9,_0x5c8a7a,_0x259ae5,_0x1a7c67,_0x243573){var _0x515542=path[_0x2875('0x22')](__dirname,'tmp',rs[_0x2875('0x38')](0x4)+'.mp3');var _0x494858;return aws[_0x2875('0x74')](_0x40e2cc,_0x1c96e9,_0x5c8a7a,_0x259ae5,_0x1a7c67,_0x243573,_0x515542)[_0x2875('0x26')](function(){_0x494858=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+'.wav');return convertFile(_0x515542,_0x494858);})[_0x2875('0x26')](function(){try{fs['unlink'](_0x515542);fs['chmodSync'](_0x494858,_0x2875('0x29'));}catch(_0x11fbe7){logger[_0x2875('0x14')](_0x11fbe7);}return _0x494858[_0x2875('0x2a')]('.')[0x0];});};exports[_0x2875('0x75')]=function(_0x98270d,_0x415ce5,_0x4c009e,_0x402836,_0x65f03,_0x9748e6){return aws[_0x2875('0x76')](_0x98270d,_0x415ce5,_0x4c009e,_0x402836,_0x65f03,_0x9748e6)[_0x2875('0x26')](function(_0x3958c6){logger['info'](JSON[_0x2875('0x3c')](_0x3958c6));return _0x3958c6;});};exports[_0x2875('0x77')]=function(_0x41c9a5,_0x5c6d82,_0x10a545,_0x526966){var _0x31b46f=util[_0x2875('0x78')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x41c9a5,encodeURIComponent(_0x5c6d82),_0x10a545,_0x526966);var _0x360abe=path[_0x2875('0x22')](__dirname,'tmp',rs[_0x2875('0x38')](0x4)+_0x2875('0x79'));var _0x47afe2;return downloadFile(_0x31b46f,_0x360abe)[_0x2875('0x26')](function(){_0x47afe2=path[_0x2875('0x22')](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+_0x2875('0x24'));return convertFile(_0x360abe,_0x47afe2);})[_0x2875('0x26')](function(){try{fs[_0x2875('0x27')](_0x360abe);fs[_0x2875('0x28')](_0x47afe2,'777');}catch(_0x5f37b3){logger[_0x2875('0x14')](_0x5f37b3);}return _0x47afe2['split']('.')[0x0];});};exports[_0x2875('0x7a')]=function(_0x39cc9f,_0x3308c3,_0x36d8ae,_0x5cee59){var _0x1851f1=util['format'](_0x2875('0x7b'),ISPEECH_API,_0x3308c3,_0x36d8ae,base64Encode(_0x39cc9f),_0x5cee59?util[_0x2875('0x78')](_0x2875('0x7c'),encodeURIComponent(_0x5cee59)):'freeform=3');return uploadFile(_0x1851f1)[_0x2875('0x26')](function(_0x2c8d){return querystring['parse'](_0x2c8d);});};exports[_0x2875('0x7d')]=function(_0xfe5529,_0x3b1de2){return sestek[_0x2875('0x7e')](_0xfe5529,_0x3b1de2)['then'](function(_0xd6cb45){logger['info'](JSON[_0x2875('0x3c')](_0xd6cb45));var _0x42f2ab={'speech':_0xd6cb45[_0x2875('0x7f')],'action':_0xd6cb45['channelData']?_0xd6cb45[_0x2875('0x80')][_0x2875('0x81')]:undefined,'actiondata':_0xd6cb45['channelData']?_0xd6cb45['channelData'][_0x2875('0x82')]:undefined};if(_0xd6cb45[_0x2875('0x80')]&&_0xd6cb45[_0x2875('0x80')]['AudioFromTts']){return base64Decode(_0xd6cb45['channelData'][_0x2875('0x83')][_0x2875('0x84')],path['resolve'](__dirname,_0x2875('0x23'),rs[_0x2875('0x38')](0x4)+'.wav'))[_0x2875('0x26')](function(_0x30496f){_0x42f2ab[_0x2875('0x85')]=_0x30496f;return _0x42f2ab;});}return _0x42f2ab;});};exports[_0x2875('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x4c3f=['Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','util','./google','./sestek','../../../config/logger','agi','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','https:','data','transcode','wav','resolve','generate','.wav','writeFileSync','then','chmodSync','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','tmp','.mp3','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','asr'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4c3f,0x1bd));var _0xf4c3=function(_0x1bb9c2,_0x137c51){_0x1bb9c2=_0x1bb9c2-0x0;var _0x514457=_0x4c3f[_0x1bb9c2];return _0x514457;};'use strict';var apiai=require(_0xf4c3('0x0'));var BPromise=require(_0xf4c3('0x1'));var dialogflow=require(_0xf4c3('0x2'));var fs=require('fs');var http=require(_0xf4c3('0x3'));var https=require(_0xf4c3('0x4'));var md5=require(_0xf4c3('0x5'));var path=require(_0xf4c3('0x6'));var querystring=require(_0xf4c3('0x7'));var rp=require(_0xf4c3('0x8'));var rs=require(_0xf4c3('0x9'));var sox=require(_0xf4c3('0xa'));var tts=require(_0xf4c3('0xb'));var urlParse=require('url')['parse'];var util=require(_0xf4c3('0xc'));var aws=require('./aws');var google=require(_0xf4c3('0xd'));var sestek=require(_0xf4c3('0xe'));var tilde=require('./tilde');var logger=require(_0xf4c3('0xf'))(_0xf4c3('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x52c7e5,_0x3ba539){return new BPromise(function(_0x204b92,_0x59fd2e){var _0x438469=urlParse(_0x52c7e5);var _0x23380b=_0x438469[_0xf4c3('0x11')]==='https:'?https:http;var _0x3911b1={'host':_0x438469[_0xf4c3('0x12')],'path':_0x438469['path'],'headers':{'user-agent':_0xf4c3('0x13')}};_0x23380b[_0xf4c3('0x14')](_0x3911b1,function(_0x4939de){if(_0x4939de[_0xf4c3('0x15')]!==0xc8){logger[_0xf4c3('0x16')](_0xf4c3('0x17')+_0x52c7e5+_0xf4c3('0x18')+_0x4939de[_0xf4c3('0x15')]+'\x20('+_0x4939de[_0xf4c3('0x19')]+')');_0x59fd2e(new Error(_0xf4c3('0x17')+_0x52c7e5+_0xf4c3('0x18')+_0x4939de[_0xf4c3('0x15')]+'\x20('+_0x4939de[_0xf4c3('0x19')]+')'));return;}var _0x22338e=fs[_0xf4c3('0x1a')](_0x3ba539);_0x22338e['on'](_0xf4c3('0x1b'),function(){logger[_0xf4c3('0x1c')](_0xf4c3('0x1d'));_0x22338e[_0xf4c3('0x1e')](_0x204b92);});_0x22338e['on'](_0xf4c3('0x16'),function(_0x2a0679){fs[_0xf4c3('0x1f')](_0x3ba539);logger[_0xf4c3('0x16')](_0xf4c3('0x20'),_0x2a0679);_0x59fd2e(_0x2a0679);});_0x4939de['pipe'](_0x22338e);})['on']('error',function(_0x3d4c05){logger[_0xf4c3('0x16')](_0x3d4c05);_0x59fd2e(_0x3d4c05);})[_0xf4c3('0x21')]();});}function uploadFile(_0x5128ce){return new BPromise(function(_0x5a649c,_0x703794){var _0x2ff121=urlParse(_0x5128ce);var _0x5d76a3=_0x2ff121[_0xf4c3('0x11')]===_0xf4c3('0x22')?https:http;var _0x4d906c={'host':_0x2ff121[_0xf4c3('0x12')],'path':_0x2ff121['path'],'headers':{'user-agent':_0xf4c3('0x13')}};_0x5d76a3['get'](_0x4d906c,function(_0x466ec8){if(_0x466ec8[_0xf4c3('0x15')]!==0xc8){_0x703794(new Error(_0xf4c3('0x17')+_0x5128ce+_0xf4c3('0x18')+_0x466ec8[_0xf4c3('0x15')]+'\x20('+_0x466ec8[_0xf4c3('0x19')]+')'));return;}var _0x37cb09='';_0x466ec8['on'](_0xf4c3('0x23'),function(_0x2f8330){_0x37cb09+=_0x2f8330;});_0x466ec8['on']('end',function(){_0x5a649c(_0x37cb09);});})['on'](_0xf4c3('0x16'),function(_0x16cc71){_0x703794(_0x16cc71);})[_0xf4c3('0x21')]();});}function convertFile(_0x1e4fdb,_0x2b0c04){return new BPromise(function(_0x28361e,_0x2e1478){var _0x2bc67a=sox[_0xf4c3('0x24')](_0x1e4fdb,_0x2b0c04,{'sampleRate':0x1f40,'format':_0xf4c3('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2bc67a['on'](_0xf4c3('0x16'),function(_0x59722a){logger['error']('error\x20convert',_0x59722a);_0x2e1478(_0x59722a);});_0x2bc67a['on'](_0xf4c3('0x21'),function(){logger['info']('finish\x20to\x20convert');_0x28361e();});_0x2bc67a['start']();});}function base64Decode(_0x494a34,_0x31b23c){var _0x4fee68=path[_0xf4c3('0x26')](__dirname,'tmp',rs[_0xf4c3('0x27')](0x4)+_0xf4c3('0x28'));fs[_0xf4c3('0x29')](_0x4fee68,_0x494a34,'base64');return convertFile(_0x4fee68,_0x31b23c)[_0xf4c3('0x2a')](function(){try{fs['unlink'](_0x4fee68);fs[_0xf4c3('0x2b')](_0x31b23c,'777');}catch(_0x92a846){logger[_0xf4c3('0x16')](_0x92a846);}return _0x31b23c[_0xf4c3('0x2c')]('.')[0x0];});}function base64Encode(_0x54e645){var _0x6f5eae=fs[_0xf4c3('0x2d')](_0x54e645);return new Buffer(_0x6f5eae)[_0xf4c3('0x2e')](_0xf4c3('0x2f'));}exports[_0xf4c3('0x30')]=function(_0x8488f8,_0x522a0f,_0x38377d,_0x199d93,_0x1b90fc,_0x2c5f0d){var _0x448b83,_0x388235;var _0x773634=_0xf4c3('0x31');var _0x263813=_0xf4c3('0x32')+_0x8488f8;var _0x28b368={};if(_0x522a0f===_0xf4c3('0x33')){_0x28b368[_0xf4c3('0x34')]={'ssml':_0x38377d};}else{_0x28b368[_0xf4c3('0x34')]={'text':_0x38377d};};_0x28b368[_0xf4c3('0x35')]={'languageCode':_0x199d93,'ssmlGender':_0x1b90fc};_0x28b368[_0xf4c3('0x36')]={'audioEncoding':_0xf4c3('0x37'),'sampleRateHertz':0x1f40};var _0x5dc05d={'url':_0x773634+'text:synthesize'+_0x263813,'method':_0xf4c3('0x38'),'json':!![],'body':_0x28b368};return rp(_0x5dc05d)['then'](function(_0x5e300c){return new BPromise(function(_0x1d2dd5,_0x552495){_0x448b83=path[_0xf4c3('0x26')](__dirname,_0xf4c3('0x39'),rs[_0xf4c3('0x27')](0x4)+_0xf4c3('0x3a'));var _0x4d2416=Buffer['from'](_0x5e300c[_0xf4c3('0x3b')],_0xf4c3('0x2f'));return fs[_0xf4c3('0x3c')](_0x448b83,_0x4d2416,function(_0x374cff){_0x552495(_0x374cff);},function(_0x5648c1){fs['chmodSync'](_0x448b83,_0xf4c3('0x3d'));_0x1d2dd5(_0x5648c1);});});})[_0xf4c3('0x2a')](function(_0x56ea88){_0x388235=path[_0xf4c3('0x26')](__dirname,_0xf4c3('0x39'),rs[_0xf4c3('0x27')](0x4)+_0xf4c3('0x28'));return convertFile(_0x448b83,_0x388235);})[_0xf4c3('0x2a')](function(){try{fs['unlink'](_0x448b83);fs['chmodSync'](_0x388235,_0xf4c3('0x3d'));}catch(_0x51e5fd){logger['error'](_0x51e5fd);}logger[_0xf4c3('0x1c')](_0xf4c3('0x3e'),_0x388235[_0xf4c3('0x2c')]('.')[0x0]);return _0x388235[_0xf4c3('0x2c')]('.')[0x0];});};exports[_0xf4c3('0x3f')]=function(_0x29a2b3,_0x5adad6){var _0x5f1744=_0xf4c3('0x40');var _0xff6d80,_0x2d7629;var _0x3b7695;var _0x1c374d={'encoding':_0xf4c3('0x41'),'method':'POST','timeout':0x2710,'url':_0x5f1744,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xf4c3('0x42'),JSON[_0xf4c3('0x43')]([_0x29a2b3,_0x5adad6||'en',![],_0xf4c3('0x44')]),null,_0xf4c3('0x45')]]]))};return rp(_0x1c374d)[_0xf4c3('0x2a')](function(_0x324e32){try{_0x3b7695=eval(_0x324e32[_0xf4c3('0x46')](0x5))[0x0][0x2];}catch(_0x50ce11){throw new Error(_0xf4c3('0x47')+_0x324e32[_0xf4c3('0x23')]);}if(!_0x3b7695){if(_0x29a2b3[_0xf4c3('0x48')]>0xc8){throw new Error(_0xf4c3('0x49'));}else{throw new Error(_0xf4c3('0x4a')+_0x5adad6+'\x22\x20might\x20not\x20exist');}}try{_0x3b7695=eval(_0x3b7695)[0x0];}catch(_0x44dd77){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x6c415e=_0x3b7695;_0xff6d80=path['resolve'](__dirname,'tmp',rs[_0xf4c3('0x27')](0x4)+_0xf4c3('0x3a'));fs[_0xf4c3('0x29')](_0xff6d80,_0x3b7695,{'encoding':_0xf4c3('0x2f')});_0x2d7629=path[_0xf4c3('0x26')](__dirname,_0xf4c3('0x39'),rs['generate'](0x4)+'.wav');return convertFile(_0xff6d80,_0x2d7629);})['then'](function(){try{fs[_0xf4c3('0x1f')](_0xff6d80);fs['chmodSync'](_0x2d7629,'777');}catch(_0x18c35a){logger[_0xf4c3('0x16')](_0x18c35a);}logger[_0xf4c3('0x1c')](_0xf4c3('0x4b'),_0x2d7629['split']('.')[0x0]);return _0x2d7629[_0xf4c3('0x2c')]('.')[0x0];});};exports[_0xf4c3('0x4c')]=function(_0x1ea383,_0x2927cc,_0x6efa40){return google['asr'](_0x1ea383,_0x2927cc,_0x6efa40)[_0xf4c3('0x2a')](function(_0x162b56){logger['info'](_0x162b56['uri']);return rp(_0x162b56);})[_0xf4c3('0x2a')](function(_0x18163b){var _0x4e4318='';var _0x12f708=0x0;try{fs['unlink'](_0x1ea383);}catch(_0x155690){logger[_0xf4c3('0x16')](_0x155690);}if(_0x18163b&&_0x18163b['results']){_0x4e4318=_0x18163b[_0xf4c3('0x4d')][_0xf4c3('0x4e')](function(_0x388cd0){return _0x388cd0&&_0x388cd0[_0xf4c3('0x4f')][0x0]&&_0x388cd0[_0xf4c3('0x4f')][0x0][_0xf4c3('0x50')]?_0x388cd0['alternatives'][0x0][_0xf4c3('0x50')]:'';})[_0xf4c3('0x51')]('\x0a');_0x12f708=_0x18163b['results'][_0xf4c3('0x4e')](function(_0x25472f){return _0x25472f&&_0x25472f[_0xf4c3('0x4f')][0x0]&&_0x25472f[_0xf4c3('0x4f')][0x0][_0xf4c3('0x52')]?_0x25472f[_0xf4c3('0x4f')][0x0]['confidence']:0x0;})[_0xf4c3('0x51')]('\x0a');}logger[_0xf4c3('0x1c')](_0xf4c3('0x53'),_0x4e4318);logger[_0xf4c3('0x1c')]('googleASR\x20confidence',_0x12f708);return{'transcript':_0x4e4318,'confidence':_0x12f708};})['catch'](function(_0x4ea0c3){logger[_0xf4c3('0x16')](_0xf4c3('0x54'),_0x4ea0c3['statusCode'],_0x4ea0c3['name'],_0x4ea0c3[_0xf4c3('0x55')]);});};exports[_0xf4c3('0x56')]=function(_0x57bf15,_0x13c3c5,_0x7115f6,_0x1c26a1){var _0x15711f=apiai(_0x13c3c5,{'language':_0x1c26a1||'en'});return _0x15711f[_0xf4c3('0x57')](_0x7115f6,{'sessionId':md5(_0x57bf15)})[_0xf4c3('0x2a')](function(_0x19badf){logger[_0xf4c3('0x1c')](JSON[_0xf4c3('0x43')](_0x19badf));return{'source':_0x19badf[_0xf4c3('0x58')][_0xf4c3('0x59')],'resolvedQuery':_0x19badf['result']['resolvedQuery'],'action':_0x19badf[_0xf4c3('0x58')][_0xf4c3('0x5a')],'actionIncomplete':_0x19badf[_0xf4c3('0x58')][_0xf4c3('0x5b')],'speech':_0x19badf[_0xf4c3('0x58')]['fulfillment'][_0xf4c3('0x5c')],'score':_0x19badf[_0xf4c3('0x58')][_0xf4c3('0x5d')],'statusCode':_0x19badf[_0xf4c3('0x5e')][_0xf4c3('0x5f')],'endConversation':_0x19badf[_0xf4c3('0x58')]['metadata'][_0xf4c3('0x60')]||![],'isFallbackIntent':_0x19badf[_0xf4c3('0x58')][_0xf4c3('0x61')][_0xf4c3('0x62')]};});};exports[_0xf4c3('0x63')]=function(_0x3f2ae5,_0x253411,_0x3d773b,_0x1dd8c2,_0x5c748c,_0x4a33f1){var _0x1e7aab=_0x1dd8c2[_0xf4c3('0x64')](/\\n/g,'\x0a');var _0x57e5d4={'credentials':{'private_key':_0x1e7aab,'client_email':_0x3d773b}};var _0x2b5d14=new dialogflow[(_0xf4c3('0x65'))](_0x57e5d4);var _0x5b8d5b=_0x2b5d14[_0xf4c3('0x66')](_0x253411,md5(_0x3f2ae5));var _0x2abee7={'session':_0x5b8d5b,'queryInput':{'text':{'text':_0x5c748c,'languageCode':_0x4a33f1}}};return _0x2b5d14[_0xf4c3('0x67')](_0x2abee7)[_0xf4c3('0x2a')](function(_0x28a232){if(_0x28a232&&_0x28a232[_0xf4c3('0x48')]){logger['info'](_0xf4c3('0x68'),JSON[_0xf4c3('0x43')](_0x28a232));var _0x505e4b=_0x28a232[0x0];if(_0x505e4b){var _0x326f02={'action':_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x5a')],'allRequiredParamsPresent':_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x6a')],'endConversation':_0x505e4b['queryResult'][_0xf4c3('0x6b')]&&_0x505e4b['queryResult'][_0xf4c3('0x6b')]['fields']?_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x6b')][_0xf4c3('0x6c')]['end_conversation'][_0xf4c3('0x6d')]:![],'fulfillmentText':_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x6e')],'intentName':_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x6f')]['name'],'intentDisplayName':_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x6f')][_0xf4c3('0x70')],'isFallbackIntent':_0x505e4b['queryResult'][_0xf4c3('0x6f')][_0xf4c3('0x71')],'languageCode':_0x505e4b[_0xf4c3('0x69')]['languageCode'],'queryText':_0x505e4b['queryResult'][_0xf4c3('0x72')],'responseId':_0x505e4b[_0xf4c3('0x73')],'score':_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x74')],'speech':_0x505e4b[_0xf4c3('0x69')][_0xf4c3('0x6e')],'providerResponse':JSON[_0xf4c3('0x43')](_0x28a232)};return _0x326f02;}}});};exports[_0xf4c3('0x75')]=function(_0x55e38a,_0x1af5dc,_0x49e3b6,_0x57c29b){return tilde[_0xf4c3('0x76')](_0x55e38a,_0x1af5dc,_0x49e3b6,_0x57c29b)[_0xf4c3('0x2a')](function(_0x24f6ed){try{fs['unlink'](_0x55e38a);}catch(_0x681dd5){logger['error'](_0x681dd5);}logger['info'](_0xf4c3('0x77'),_0x24f6ed[_0xf4c3('0x50')]);logger['info'](_0xf4c3('0x78'),_0x24f6ed[_0xf4c3('0x52')]);return _0x24f6ed;});};exports[_0xf4c3('0x79')]=function(_0x9395f9,_0x29d610,_0x18284c,_0x50bf86,_0x2a4676,_0x4e2a33){var _0x77a0ab=path[_0xf4c3('0x26')](__dirname,_0xf4c3('0x39'),rs['generate'](0x4)+_0xf4c3('0x3a'));var _0x57bd3c;return aws[_0xf4c3('0x7a')](_0x9395f9,_0x29d610,_0x18284c,_0x50bf86,_0x2a4676,_0x4e2a33,_0x77a0ab)[_0xf4c3('0x2a')](function(){_0x57bd3c=path[_0xf4c3('0x26')](__dirname,_0xf4c3('0x39'),rs[_0xf4c3('0x27')](0x4)+'.wav');return convertFile(_0x77a0ab,_0x57bd3c);})[_0xf4c3('0x2a')](function(){try{fs[_0xf4c3('0x1f')](_0x77a0ab);fs[_0xf4c3('0x2b')](_0x57bd3c,_0xf4c3('0x3d'));}catch(_0x207f73){logger['error'](_0x207f73);}return _0x57bd3c[_0xf4c3('0x2c')]('.')[0x0];});};exports[_0xf4c3('0x7b')]=function(_0x4c808c,_0x517b0d,_0x22a9b5,_0x307afe,_0x408e3e,_0x125462){return aws['lex'](_0x4c808c,_0x517b0d,_0x22a9b5,_0x307afe,_0x408e3e,_0x125462)['then'](function(_0x44c397){logger['info'](JSON[_0xf4c3('0x43')](_0x44c397));return _0x44c397;});};exports[_0xf4c3('0x7c')]=function(_0x350d51,_0x123d1c,_0x1b3252,_0x29635a){var _0xf7ad36=util[_0xf4c3('0x7d')](_0xf4c3('0x7e'),ISPEECH_API,_0x350d51,encodeURIComponent(_0x123d1c),_0x1b3252,_0x29635a);var _0x493e51=path[_0xf4c3('0x26')](__dirname,_0xf4c3('0x39'),rs['generate'](0x4)+_0xf4c3('0x3a'));var _0x239c0b;return downloadFile(_0xf7ad36,_0x493e51)[_0xf4c3('0x2a')](function(){_0x239c0b=path['resolve'](__dirname,'tmp',rs[_0xf4c3('0x27')](0x4)+_0xf4c3('0x28'));return convertFile(_0x493e51,_0x239c0b);})[_0xf4c3('0x2a')](function(){try{fs[_0xf4c3('0x1f')](_0x493e51);fs[_0xf4c3('0x2b')](_0x239c0b,_0xf4c3('0x3d'));}catch(_0xf8152a){logger[_0xf4c3('0x16')](_0xf8152a);}return _0x239c0b['split']('.')[0x0];});};exports[_0xf4c3('0x7f')]=function(_0x2d0214,_0x2c18c0,_0x4b7097,_0x5be9f9){var _0x1c5134=util['format'](_0xf4c3('0x80'),ISPEECH_API,_0x2c18c0,_0x4b7097,base64Encode(_0x2d0214),_0x5be9f9?util['format'](_0xf4c3('0x81'),encodeURIComponent(_0x5be9f9)):_0xf4c3('0x82'));return uploadFile(_0x1c5134)[_0xf4c3('0x2a')](function(_0x46aa67){return querystring[_0xf4c3('0x83')](_0x46aa67);});};exports[_0xf4c3('0x84')]=function(_0x2fd35d,_0x247e5d){return sestek['nda'](_0x2fd35d,_0x247e5d)[_0xf4c3('0x2a')](function(_0x225e5d){logger[_0xf4c3('0x1c')](JSON[_0xf4c3('0x43')](_0x225e5d));var _0x463976={'speech':_0x225e5d[_0xf4c3('0x85')],'action':_0x225e5d[_0xf4c3('0x86')]?_0x225e5d[_0xf4c3('0x86')][_0xf4c3('0x87')]:undefined,'actiondata':_0x225e5d['channelData']?_0x225e5d['channelData'][_0xf4c3('0x88')]:undefined};if(_0x225e5d['channelData']&&_0x225e5d[_0xf4c3('0x86')]['AudioFromTts']){return base64Decode(_0x225e5d[_0xf4c3('0x86')][_0xf4c3('0x89')][_0xf4c3('0x8a')],path[_0xf4c3('0x26')](__dirname,_0xf4c3('0x39'),rs[_0xf4c3('0x27')](0x4)+'.wav'))[_0xf4c3('0x2a')](function(_0x43e8a6){_0x463976[_0xf4c3('0x8b')]=_0x43e8a6;return _0x463976;});}return _0x463976;});};exports[_0xf4c3('0x8c')]=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 56fa018..28371fc 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 _0x7575=['exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7575,0x123));var _0x5757=function(_0x3a23c0,_0x1fb53d){_0x3a23c0=_0x3a23c0-0x0;var _0x400db1=_0x7575[_0x3a23c0];return _0x400db1;};var nda=require('./nda');module[_0x5757('0x0')]={'nda':nda}; \ No newline at end of file +var _0xef88=['exports'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xef88,0x9e));var _0x8ef8=function(_0x31d8ae,_0x41eb1f){_0x31d8ae=_0x31d8ae-0x0;var _0x4ec705=_0xef88[_0x31d8ae];return _0x4ec705;};var nda=require('./nda');module[_0x8ef8('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 874cef4..07c1df8 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 _0xb332=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','audio/wav','custom_action','custom_action_data','CustomActionData','request-promise','../../../../../config/logger','agi','resolve','/token','password','username'];(function(_0x1bda09,_0x1d8be5){var _0x17be2d=function(_0x637732){while(--_0x637732){_0x1bda09['push'](_0x1bda09['shift']());}};_0x17be2d(++_0x1d8be5);}(_0xb332,0xd9));var _0x2b33=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xb332[_0x770f7];return _0xe797c6;};'use strict';var rp=require(_0x2b33('0x0'));var url=require('url');var logger=require(_0x2b33('0x1'))(_0x2b33('0x2'));module['exports']=function(_0xf8c6a7,_0x548a70){var _0x1fe6b1={'method':'POST','uri':url[_0x2b33('0x3')](_0x548a70['ndauth_url'],_0x2b33('0x4')),'form':{'grant_type':_0x2b33('0x5'),'username':_0x548a70[_0x2b33('0x6')],'password':_0x548a70[_0x2b33('0x5')]},'json':!![]};return rp(_0x1fe6b1)['then'](function(_0x5ccf2d){var _0x4302b7={'method':'POST','uri':url[_0x2b33('0x3')](_0x548a70[_0x2b33('0x7')],_0x2b33('0x8')),'body':{'type':_0x548a70[_0x2b33('0x9')]||'message','channelId':_0x2b33('0xa'),'conversation':{'id':_0xf8c6a7[_0x2b33('0xb')]},'from':{'id':_0xf8c6a7[_0x2b33('0xc')],'name':_0xf8c6a7[_0x2b33('0xd')]},'recipient':{'id':_0xf8c6a7[_0x2b33('0xe')],'name':_0xf8c6a7[_0x2b33('0xf')]},'text':_0x548a70[_0x2b33('0x10')],'channelData':{}},'headers':{'Authorization':_0x2b33('0x11')+_0x5ccf2d[_0x2b33('0x12')]},'json':!![]};if(_0x548a70[_0x2b33('0x13')]){_0x4302b7[_0x2b33('0x14')]['channelData'][_0x2b33('0x15')]=_0x548a70[_0x2b33('0x13')];}if(_0x548a70[_0x2b33('0x16')]=='1'){_0x4302b7['body'][_0x2b33('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2b33('0x18')};}if(_0x548a70[_0x2b33('0x19')]){_0x4302b7[_0x2b33('0x14')]['channelData']['CustomAction']=_0x548a70[_0x2b33('0x19')];if(_0x548a70[_0x2b33('0x1a')]){_0x4302b7[_0x2b33('0x14')][_0x2b33('0x17')][_0x2b33('0x1b')]=_0x548a70['custom_action_data'];}}logger['info'](JSON['stringify'](_0x4302b7));return rp(_0x4302b7);});}; \ No newline at end of file +var _0xf151=['custom_action_data','info','stringify','../../../../../config/logger','agi','exports','POST','resolve','/token','then','ndassistant_url','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction'];(function(_0x539cf9,_0x533a04){var _0x68521c=function(_0x4a7a){while(--_0x4a7a){_0x539cf9['push'](_0x539cf9['shift']());}};_0x68521c(++_0x533a04);}(_0xf151,0xab));var _0x1f15=function(_0x2a57c3,_0xf13b44){_0x2a57c3=_0x2a57c3-0x0;var _0x4cf439=_0xf151[_0x2a57c3];return _0x4cf439;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x1f15('0x0'))(_0x1f15('0x1'));module[_0x1f15('0x2')]=function(_0x338be9,_0x24018f){var _0xcbca76={'method':_0x1f15('0x3'),'uri':url[_0x1f15('0x4')](_0x24018f['ndauth_url'],_0x1f15('0x5')),'form':{'grant_type':'password','username':_0x24018f['username'],'password':_0x24018f['password']},'json':!![]};return rp(_0xcbca76)[_0x1f15('0x6')](function(_0x166156){var _0xc7ae4b={'method':'POST','uri':url[_0x1f15('0x4')](_0x24018f[_0x1f15('0x7')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x24018f['ndaactivity_type']||_0x1f15('0x8'),'channelId':_0x1f15('0x9'),'conversation':{'id':_0x338be9[_0x1f15('0xa')]},'from':{'id':_0x338be9[_0x1f15('0xb')],'name':_0x338be9['calleridname']},'recipient':{'id':_0x338be9[_0x1f15('0xc')],'name':_0x338be9[_0x1f15('0xd')]},'text':_0x24018f[_0x1f15('0xe')],'channelData':{}},'headers':{'Authorization':_0x1f15('0xf')+_0x166156['access_token']},'json':!![]};if(_0x24018f['project']){_0xc7ae4b[_0x1f15('0x10')][_0x1f15('0x11')][_0x1f15('0x12')]=_0x24018f[_0x1f15('0x13')];}if(_0x24018f[_0x1f15('0x14')]=='1'){_0xc7ae4b[_0x1f15('0x10')]['channelData'][_0x1f15('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1f15('0x16')};}if(_0x24018f[_0x1f15('0x17')]){_0xc7ae4b[_0x1f15('0x10')]['channelData'][_0x1f15('0x18')]=_0x24018f['custom_action'];if(_0x24018f[_0x1f15('0x19')]){_0xc7ae4b[_0x1f15('0x10')][_0x1f15('0x11')]['CustomActionData']=_0x24018f['custom_action_data'];}}logger[_0x1f15('0x1a')](JSON[_0x1f15('0x1b')](_0xc7ae4b));return rp(_0xc7ae4b);});}; \ 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 32f12ce..a2b87c5 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 _0x4a4a=['exports','./lib/api'];(function(_0x44d809,_0x67e8da){var _0x28ce91=function(_0x5b5960){while(--_0x5b5960){_0x44d809['push'](_0x44d809['shift']());}};_0x28ce91(++_0x67e8da);}(_0x4a4a,0x147));var _0xa4a4=function(_0x47ba5d,_0x7e3870){_0x47ba5d=_0x47ba5d-0x0;var _0x54875e=_0x4a4a[_0x47ba5d];return _0x54875e;};'use strict';var asr=require(_0xa4a4('0x0'));module[_0xa4a4('0x1')]=function(_0x172328,_0x1c3826,_0x250c6c,_0x1688e3){return asr(_0x172328,_0x1c3826,_0x250c6c,_0x1688e3);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x5625c0,_0x47bd69,_0x6d1831,_0x2c2337){return asr(_0x5625c0,_0x47bd69,_0x6d1831,_0x2c2337);}; \ 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 de703ee..fe69272 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 _0xca18=['crypto','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','info','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','moment'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xca18,0x18e));var _0x8ca1=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xca18[_0x4bacb6];return _0x58c029;};'use strict';var BPromise=require('bluebird');var _=require(_0x8ca1('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8ca1('0x1'));var crypto=require(_0x8ca1('0x2'));var logger=require('../../../../../../config/logger')(_0x8ca1('0x3'));module[_0x8ca1('0x4')]=function(_0x11b246,_0x189e58,_0x5ca03f,_0x905eb6){return new BPromise(function(_0x52a36c,_0x43a052){logger['info'](_0x8ca1('0x5'),_0x905eb6||_0x8ca1('0x6'));var _0x340d2=new WebSocket(_0x905eb6||_0x8ca1('0x6'),{'perMessageDeflate':![]});var _0x648fc6='';var _0x25b4eb='0';var _0xae2b62='1';var _0x1a6cb8=_0x8ca1('0x7');function _0x3a2439(_0x5db3c9){var _0x49e7bb=crypto[_0x8ca1('0x8')](_0x8ca1('0x9'));_0x49e7bb['update'](_0x5db3c9);return _0x49e7bb[_0x8ca1('0xa')](_0x8ca1('0xb'));}function _0x7a59dc(){try{logger[_0x8ca1('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0x1093b0=moment()[_0x8ca1('0xd')]();var _0x4c324d=_0x3a2439(_0x1093b0+_0x189e58+_0x5ca03f);_0x340d2[_0x8ca1('0xe')](JSON[_0x8ca1('0xf')]({'appID':_0x189e58,'timestamp':_0x1093b0,'appKey':_0x4c324d}));var _0x389e01=fs[_0x8ca1('0x10')](_0x11b246);_0x389e01['on'](_0x8ca1('0x11'),function(_0x1aaa4c){_0x340d2[_0x8ca1('0xe')](_0x1aaa4c);});_0x389e01['on'](_0x8ca1('0x12'),function(){_0x340d2[_0x8ca1('0xe')](_0x8ca1('0x13'));});}catch(_0x3e3af2){logger[_0x8ca1('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x8ca1('0xf')](_0x3e3af2));_0x340d2[_0x8ca1('0x15')]();}}function _0x50fc82(_0x1b65b1){try{if(_0x1b65b1){var _0x1b76d5=JSON[_0x8ca1('0x16')](_0x1b65b1);switch(_0x1b76d5[_0x8ca1('0x17')]){case 0x0:if(_0x1b76d5[_0x8ca1('0x18')]){if(_0x1b76d5['result']['final']){logger[_0x8ca1('0xc')](_0x8ca1('0x19'),JSON[_0x8ca1('0xf')](_0x1b76d5['result'][_0x8ca1('0x1a')]));_0x648fc6=_0x1b76d5[_0x8ca1('0x18')][_0x8ca1('0x1a')][0x0][_0x8ca1('0x1b')];_0x25b4eb=_0x1b76d5[_0x8ca1('0x18')]['hypotheses'][0x0][_0x8ca1('0x1c')];_0xae2b62='0';_0x1a6cb8=_0x8ca1('0x1d');_0x340d2[_0x8ca1('0x15')]();}}break;case 0x1:logger[_0x8ca1('0xc')](_0x8ca1('0x7'));_0xae2b62='1';_0x1a6cb8=_0x8ca1('0x7');break;case 0x2:logger[_0x8ca1('0xc')](_0x8ca1('0x1e'));_0xae2b62='2';_0x1a6cb8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x8ca1('0xc')](_0x8ca1('0x1f'));_0xae2b62='9';_0x1a6cb8=_0x8ca1('0x1f');break;case 0xa:logger[_0x8ca1('0xc')](_0x8ca1('0x20'));_0xae2b62='10';_0x1a6cb8=_0x8ca1('0x20');break;case 0xb:logger[_0x8ca1('0xc')](_0x8ca1('0x21'));_0xae2b62='11';_0x1a6cb8=_0x8ca1('0x21');}}}catch(_0x2783e8){logger[_0x8ca1('0x14')](_0x8ca1('0x22'),JSON[_0x8ca1('0xf')](_0x2783e8));_0x340d2['terminate']();}}function _0x439ba9(){logger[_0x8ca1('0xc')](_0x8ca1('0x23'));_0x52a36c({'transcript':_0x648fc6,'confidence':_0x25b4eb,'status':_0xae2b62,'status_message':_0x1a6cb8});}function _0x33fa3d(_0x20231e){logger[_0x8ca1('0x14')](_0x8ca1('0x24'));if(!_['isNil'](_0x20231e)){logger['error'](_[_0x8ca1('0x25')](_0x20231e)?JSON[_0x8ca1('0xf')](_0x20231e):_0x20231e);}}_0x340d2['on'](_0x8ca1('0x26'),_0x7a59dc);_0x340d2['on'](_0x8ca1('0x27'),_0x50fc82);_0x340d2['on'](_0x8ca1('0x12'),_0x439ba9);_0x340d2['on']('error',_0x33fa3d);});}; \ No newline at end of file +var _0xf8e1=['stringify','createReadStream','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x5623ba,_0x2d3aa8){var _0xd8fb8f=function(_0x247e60){while(--_0x247e60){_0x5623ba['push'](_0x5623ba['shift']());}};_0xd8fb8f(++_0x2d3aa8);}(_0xf8e1,0x109));var _0x1f8e=function(_0xc12998,_0x4478e4){_0xc12998=_0xc12998-0x0;var _0x1e37b9=_0xf8e1[_0xc12998];return _0x1e37b9;};'use strict';var BPromise=require(_0x1f8e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1f8e('0x1'));var crypto=require(_0x1f8e('0x2'));var logger=require('../../../../../../config/logger')(_0x1f8e('0x3'));module[_0x1f8e('0x4')]=function(_0xe07c7f,_0x1bb0f7,_0x458cf3,_0x46ddf8){return new BPromise(function(_0x2a7a32,_0x2bd29d){logger[_0x1f8e('0x5')](_0x1f8e('0x6'),_0x46ddf8||_0x1f8e('0x7'));var _0x5710af=new WebSocket(_0x46ddf8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x452f5c='';var _0x15eea3='0';var _0x59c3b0='1';var _0x4f9d86=_0x1f8e('0x8');function _0x5367a0(_0x2007fc){var _0x3d1638=crypto[_0x1f8e('0x9')](_0x1f8e('0xa'));_0x3d1638[_0x1f8e('0xb')](_0x2007fc);return _0x3d1638['digest']('hex');}function _0x936a87(){try{logger[_0x1f8e('0x5')](_0x1f8e('0xc'));var _0x21fa3e=moment()[_0x1f8e('0xd')]();var _0x590d3c=_0x5367a0(_0x21fa3e+_0x1bb0f7+_0x458cf3);_0x5710af[_0x1f8e('0xe')](JSON[_0x1f8e('0xf')]({'appID':_0x1bb0f7,'timestamp':_0x21fa3e,'appKey':_0x590d3c}));var _0x10db92=fs[_0x1f8e('0x10')](_0xe07c7f);_0x10db92['on']('data',function(_0x9609c5){_0x5710af['send'](_0x9609c5);});_0x10db92['on'](_0x1f8e('0x11'),function(){_0x5710af[_0x1f8e('0xe')](_0x1f8e('0x12'));});}catch(_0x3c5725){logger['error'](_0x1f8e('0x13'),JSON['stringify'](_0x3c5725));_0x5710af[_0x1f8e('0x14')]();}}function _0x28a3b4(_0x17ac33){try{if(_0x17ac33){var _0x113659=JSON[_0x1f8e('0x15')](_0x17ac33);switch(_0x113659[_0x1f8e('0x16')]){case 0x0:if(_0x113659[_0x1f8e('0x17')]){if(_0x113659['result'][_0x1f8e('0x18')]){logger[_0x1f8e('0x5')](_0x1f8e('0x19'),JSON[_0x1f8e('0xf')](_0x113659['result'][_0x1f8e('0x1a')]));_0x452f5c=_0x113659[_0x1f8e('0x17')][_0x1f8e('0x1a')][0x0][_0x1f8e('0x1b')];_0x15eea3=_0x113659[_0x1f8e('0x17')]['hypotheses'][0x0][_0x1f8e('0x1c')];_0x59c3b0='0';_0x4f9d86='Success.';_0x5710af[_0x1f8e('0x14')]();}}break;case 0x1:logger[_0x1f8e('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x59c3b0='1';_0x4f9d86=_0x1f8e('0x8');break;case 0x2:logger[_0x1f8e('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x59c3b0='2';_0x4f9d86=_0x1f8e('0x1d');break;case 0x9:logger['info'](_0x1f8e('0x1e'));_0x59c3b0='9';_0x4f9d86='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x1f8e('0x5')](_0x1f8e('0x1f'));_0x59c3b0='10';_0x4f9d86=_0x1f8e('0x1f');break;case 0xb:logger[_0x1f8e('0x5')](_0x1f8e('0x20'));_0x59c3b0='11';_0x4f9d86=_0x1f8e('0x20');}}}catch(_0x51fa53){logger[_0x1f8e('0x21')](_0x1f8e('0x22'),JSON[_0x1f8e('0xf')](_0x51fa53));_0x5710af[_0x1f8e('0x14')]();}}function _0xdf3518(){logger[_0x1f8e('0x5')](_0x1f8e('0x23'));_0x2a7a32({'transcript':_0x452f5c,'confidence':_0x15eea3,'status':_0x59c3b0,'status_message':_0x4f9d86});}function _0x36b33b(_0x1c14f5){logger[_0x1f8e('0x21')](_0x1f8e('0x24'));if(!_['isNil'](_0x1c14f5)){logger[_0x1f8e('0x21')](_[_0x1f8e('0x25')](_0x1c14f5)?JSON[_0x1f8e('0xf')](_0x1c14f5):_0x1c14f5);}}_0x5710af['on'](_0x1f8e('0x26'),_0x936a87);_0x5710af['on'](_0x1f8e('0x27'),_0x28a3b4);_0x5710af['on'](_0x1f8e('0x11'),_0xdf3518);_0x5710af['on'](_0x1f8e('0x21'),_0x36b33b);});}; \ 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 72bd4a1..10cb4be 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 _0x879d=['./asr','exports'];(function(_0x3f1cd3,_0x23e4bb){var _0x27b27b=function(_0x283485){while(--_0x283485){_0x3f1cd3['push'](_0x3f1cd3['shift']());}};_0x27b27b(++_0x23e4bb);}(_0x879d,0x66));var _0xd879=function(_0x3eae3e,_0x57f222){_0x3eae3e=_0x3eae3e-0x0;var _0x4f732b=_0x879d[_0x3eae3e];return _0x4f732b;};var asr=require(_0xd879('0x0'));module[_0xd879('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 18dbf21..2346ed6 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x1bbda2,_0x3de852){var _0x4e59f6=function(_0x23b41b){while(--_0x23b41b){_0x1bbda2['push'](_0x1bbda2['shift']());}};_0x4e59f6(++_0x3de852);}(_0x34e8,0x12c));var _0x834e=function(_0x214af9,_0x18250d){_0x214af9=_0x214af9-0x0;var _0x14270f=_0x34e8[_0x214af9];return _0x14270f;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xe706,0xa3));var _0x6e70=function(_0x6ec1fe,_0x3e820c){_0x6ec1fe=_0x6ec1fe-0x0;var _0x16d021=_0xe706[_0x6ec1fe];return _0x16d021;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 87ea8c5..4f16b95 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 _0x1af3=['moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','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','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','gosub','position','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','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring'];(function(_0x31c2d1,_0x33007f){var _0xef604b=function(_0x740d31){while(--_0x740d31){_0x31c2d1['push'](_0x31c2d1['shift']());}};_0xef604b(++_0x33007f);}(_0x1af3,0x1ca));var _0x31af=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x1af3[_0x1caf6a];return _0x1bf493;};'use strict';var fs=require('fs');var util=require(_0x31af('0x0'));var _=require(_0x31af('0x1'));var sh=require(_0x31af('0x2'));var odbc=require(_0x31af('0x3'))();var rs=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var Mustache=require(_0x31af('0x6'));var rp=require(_0x31af('0x7'));var logger=require(_0x31af('0x8'))(_0x31af('0x9'));var config=require('../../config/environment');var scripts=require(_0x31af('0xa'));var FILES_PATH=_0x31af('0xb');var recursiveMapAttributes=[_0x31af('0xc'),_0x31af('0xd')];var verticesWithRetry=['menu',_0x31af('0xe'),_0x31af('0xf')];var AGIVertices=function(_0x406dd8,_0x524d00,_0x21c951){this[_0x31af('0x10')]=_0x406dd8;this[_0x31af('0x11')]=_0x524d00;this[_0x31af('0x12')]=_0x21c951;};AGIVertices[_0x31af('0x13')][_0x31af('0x14')]=function(_0x1fa064,_0x33b4a5){this['rpc'][_0x31af('0x15')](_0x1fa064)[_0x31af('0x16')](function(_0xc077e6){_0x33b4a5(null,_0xc077e6?_0xc077e6[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x481f20){_0x33b4a5(_0x481f20);});};AGIVertices[_0x31af('0x13')][_0x31af('0x19')]=function(_0x5c18b4,_0x4b801f){this[_0x31af('0x11')][_0x31af('0x1a')](_0x5c18b4)[_0x31af('0x16')](function(_0x10b9c6){_0x4b801f(null,_0x10b9c6?_0x10b9c6[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x369934){_0x4b801f(_0x369934);});};AGIVertices[_0x31af('0x13')][_0x31af('0x1b')]=function(_0x5a651f,_0x375ea2){this['rpc'][_0x31af('0x1c')](_0x5a651f)[_0x31af('0x16')](function(_0x3a2305){_0x375ea2(null,_0x3a2305?_0x3a2305[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x30a112){_0x375ea2(_0x30a112);});};AGIVertices[_0x31af('0x13')][_0x31af('0x1d')]=function(_0x3246c6,_0x550870){this[_0x31af('0x11')][_0x31af('0x1e')](_0x3246c6)[_0x31af('0x16')](function(_0x2ce4c2){_0x550870(null,_0x2ce4c2?_0x2ce4c2[_0x31af('0x1f')]:![]);})['catch'](function(_0x1a0bd0){_0x550870(_0x1a0bd0);});};AGIVertices[_0x31af('0x13')][_0x31af('0x20')]=function(_0x2e600a,_0x394d13){this[_0x31af('0x11')][_0x31af('0x21')](_0x2e600a)[_0x31af('0x16')](function(_0x3f673f){_0x394d13(null,_0x3f673f?_0x3f673f[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x1a67e3){_0x394d13(_0x1a67e3);});};AGIVertices[_0x31af('0x13')][_0x31af('0x22')]=function(_0x32f189,_0x5ae495){this['rpc']['getTrunkById'](_0x32f189)[_0x31af('0x16')](function(_0x2b3bad){_0x5ae495(null,_0x2b3bad?_0x2b3bad['name']:![]);})[_0x31af('0x18')](function(_0x8f9f60){_0x5ae495(_0x8f9f60);});};AGIVertices['prototype'][_0x31af('0x23')]=function(_0x21e227,_0x53b726){var _0x171b7f=this;this[_0x31af('0x11')][_0x31af('0x24')](_0x21e227)[_0x31af('0x16')](function(_0x3326a7){_0x53b726(null,_0x3326a7?_0x171b7f['getSoundPath'](_0x3326a7[_0x31af('0x25')]):![]);})[_0x31af('0x18')](function(_0x1e6df8){_0x53b726(_0x1e6df8);});};AGIVertices[_0x31af('0x13')][_0x31af('0x26')]=function(_0x3e885e,_0x149d01){this[_0x31af('0x11')][_0x31af('0x27')](_0x3e885e)[_0x31af('0x16')](function(_0x388e9c){_0x149d01(null,_0x388e9c?_0x388e9c:![]);})[_0x31af('0x18')](function(_0x57d570){_0x149d01(_0x57d570);});};AGIVertices[_0x31af('0x13')][_0x31af('0x28')]=function(_0x4d5166,_0x4cabed,_0x50dd99){this[_0x31af('0x12')]['sendMailMessage'](_0x4d5166,_0x4cabed)[_0x31af('0x16')](function(){_0x50dd99(null);})[_0x31af('0x18')](function(_0x2899a0){_0x50dd99(_0x2899a0);});};AGIVertices[_0x31af('0x13')][_0x31af('0x29')]=function(_0x4bfbe9,_0x52f251){this[_0x31af('0x11')][_0x31af('0x2a')](_0x4bfbe9)[_0x31af('0x16')](function(_0x7481ca){if(_0x7481ca){if(_0x7481ca[_0x31af('0x2b')]){_0x52f251(null,[_0x7481ca[_0x31af('0x2c')]]);}else{_0x52f251(null,_[_0x31af('0x2d')](_0x7481ca[_0x31af('0x2e')],'interval'));}}else{_0x52f251(null,![]);}})[_0x31af('0x18')](function(_0x57af86){_0x52f251(_0x57af86);});};AGIVertices[_0x31af('0x13')][_0x31af('0x2f')]=function(_0x254f1a){return util[_0x31af('0x30')](_0x31af('0x31'),FILES_PATH,_0x254f1a);};AGIVertices['prototype']['getQueryOdbc']=function(_0x53bb6d,_0x318005,_0x1ce300){odbc[_0x31af('0x32')](_0x53bb6d,function(_0x1cfdd3){if(_0x1cfdd3){logger[_0x31af('0x33')](_0x31af('0x34'),_0x1cfdd3);_0x1ce300(_0x1cfdd3);}else{logger[_0x31af('0x35')](_0x31af('0x36'));odbc['query'](_0x318005,function(_0x3d7cf2,_0x16f3e1){if(_0x3d7cf2){logger[_0x31af('0x35')](_0x31af('0x37'),_0x318005);_0x1ce300(_0x3d7cf2);}else{logger[_0x31af('0x35')](_0x31af('0x38'),_0x318005);odbc[_0x31af('0x39')](function(_0xe90ba9){if(_0xe90ba9){logger[_0x31af('0x33')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xe90ba9);}_0x1ce300(null,_0x16f3e1);});}});}});};AGIVertices[_0x31af('0x13')]['getSmsAccount']=function(_0x447a01,_0x5405e3){this['rpc'][_0x31af('0x3a')](_0x447a01)[_0x31af('0x16')](function(_0x110f38){_0x5405e3(null,_0x110f38?_0x110f38:![]);})[_0x31af('0x18')](function(_0x188e34){_0x5405e3(_0x188e34);});};AGIVertices[_0x31af('0x13')][_0x31af('0x3b')]=function(_0x4fd8c4,_0x33b1ea){this[_0x31af('0x11')][_0x31af('0x3b')](_0x4fd8c4)['then'](function(_0x44e10e){_0x33b1ea(null,_0x44e10e);})[_0x31af('0x18')](function(_0x1d8d27){_0x33b1ea(_0x1d8d27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x3c')]=function(_0x57da2c,_0x12357c,_0x3b10ef){this[_0x31af('0x11')][_0x31af('0x3c')]({'uniqueid':this['channel'][_0x31af('0x3d')],'node':_0x57da2c[_0x31af('0x3e')],'application':_0x57da2c['agicommand'],'data':_0x12357c||null,'project_name':this[_0x31af('0x10')][_0x31af('0x3f')],'callerid':this[_0x31af('0x10')][_0x31af('0x40')]})[_0x31af('0x16')](function(_0x334b95){if(_0x3b10ef){_0x3b10ef(null,_0x334b95);}})[_0x31af('0x18')](function(_0x3a349f){if(_0x3b10ef){_0x3b10ef(_0x3a349f);}});};AGIVertices[_0x31af('0x13')][_0x31af('0x41')]=function(_0x52a602,_0x48f7b4,_0x19cbc0,_0x492725){this[_0x31af('0x11')][_0x31af('0x41')]({'uniqueid':this[_0x31af('0x10')]['uniqueid'],'callerid':this['channel'][_0x31af('0x40')],'calleridname':this['channel'][_0x31af('0x42')],'context':this[_0x31af('0x10')][_0x31af('0x43')],'extension':this[_0x31af('0x10')]['extension'],'priority':this['channel'][_0x31af('0x44')],'accountcode':this[_0x31af('0x10')][_0x31af('0x45')],'dnid':this[_0x31af('0x10')]['dnid'],'projectName':this[_0x31af('0x10')][_0x31af('0x3f')],'saveName':_0x48f7b4,'filename':_0x52a602[_0x31af('0x46')]||_0x48f7b4,'savePath':_0x19cbc0})['then'](function(_0x5a1cbe){_0x492725(null,_0x5a1cbe);})[_0x31af('0x18')](function(_0xdccf27){_0x492725(_0xdccf27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x47')]=function(_0x2880f3,_0x198969,_0x39201e,_0x275780,_0x1ac4ae){this[_0x31af('0x11')]['createSquareMessage']({'uniqueid':this[_0x31af('0x10')][_0x31af('0x3d')],'body':_0x2880f3,'direction':_0x198969,'providerName':_0x39201e,'providerResponse':_0x275780})[_0x31af('0x16')](function(_0xe75210){if(_0x1ac4ae){_0x1ac4ae(null,_0xe75210);}})[_0x31af('0x18')](function(_0x896839){if(_0x1ac4ae){_0x1ac4ae(_0x896839);}});};AGIVertices[_0x31af('0x13')][_0x31af('0x48')]=function(_0x1a6438,_0x25369b){this[_0x31af('0x11')][_0x31af('0x48')]({'firstName':_[_0x31af('0x49')](_0x1a6438[_0x31af('0x17')])||_['isNil'](_0x1a6438[_0x31af('0x17')])?_0x31af('0x4a')+Math[_0x31af('0x4b')]():_0x1a6438['name'],'lastName':_[_0x31af('0x49')](_0x1a6438[_0x31af('0x4c')])||_[_0x31af('0x4d')](_0x1a6438['lastName'])?null:_0x1a6438[_0x31af('0x4c')],'phone':_0x1a6438[_0x31af('0x4e')],'ListId':_0x1a6438[_0x31af('0x4f')],'scheduledat':_0x1a6438[_0x31af('0x50')],'callbackUniqueid':this[_0x31af('0x10')][_0x31af('0x3d')],'tags':_0x31af('0x51'),'description':'Callback\x20scheduled\x20at\x20'+_0x1a6438[_0x31af('0x50')][_0x31af('0x52')](),'priority':_0x1a6438[_0x31af('0x53')]})[_0x31af('0x16')](function(_0x58c0ff){_0x25369b(null,_0x58c0ff);})['catch'](function(_0x4b57bc){_0x25369b(_0x4b57bc);});};AGIVertices['prototype'][_0x31af('0x54')]=function(_0x152e4f,_0x202634){this[_0x31af('0x11')][_0x31af('0x55')](_0x152e4f)[_0x31af('0x16')](function(_0x5cc45b){_0x202634(null,_0x5cc45b?_0x5cc45b[_0x31af('0x17')]:![]);})['catch'](function(_0x19015d){_0x202634(_0x19015d);});};AGIVertices[_0x31af('0x13')]['agentPause']=function(_0x439171,_0xc6511,_0x5c5834){var _0x820339={'role':_0x31af('0x56')};_0x820339[_0x439171]=this[_0x31af('0x10')][_0x31af('0x40')];this['rpc']['agentPause'](_0x820339,_0xc6511,this[_0x31af('0x10')][_0x31af('0x3d')])['then'](function(_0x345469){_0x5c5834(null,_[_0x31af('0x4d')](_0x345469)?![]:!![]);})[_0x31af('0x18')](function(_0x209038){logger[_0x31af('0x33')](_0x209038);_0x5c5834(null,![]);});};AGIVertices[_0x31af('0x13')]['agentUnpause']=function(_0x28f6ee,_0x45e195){var _0x453db0={'role':_0x31af('0x56')};_0x453db0[_0x28f6ee]=this[_0x31af('0x10')][_0x31af('0x40')];this[_0x31af('0x11')]['agentUnpause'](_0x453db0)[_0x31af('0x16')](function(_0x7e9169){_0x45e195(null,_[_0x31af('0x4d')](_0x7e9169)?![]:!![]);})[_0x31af('0x18')](function(_0x4b1d51){logger[_0x31af('0x33')](_0x4b1d51);_0x45e195(null,![]);});};AGIVertices['prototype'][_0x31af('0x57')]=function(_0x4c71b3,_0x3d3f66){var _0x441679={'role':_0x31af('0x56')};_0x441679[_0x4c71b3]=this[_0x31af('0x10')][_0x31af('0x40')];this[_0x31af('0x11')][_0x31af('0x57')](_0x441679)[_0x31af('0x16')](function(_0x107aba){_0x3d3f66(null,_[_0x31af('0x4d')](_0x107aba)?![]:!![]);})['catch'](function(_0x5d9c73){logger[_0x31af('0x33')](_0x5d9c73);_0x3d3f66(null,![]);});};AGIVertices[_0x31af('0x13')][_0x31af('0x58')]=function(_0x3610a8,_0x1de9ac){var _0x50d8f1={'role':_0x31af('0x56')};_0x50d8f1[_0x3610a8]=this[_0x31af('0x10')]['callerid'];var _0x172f45=_0x3610a8!=_0x31af('0x59')?util[_0x31af('0x30')]('%s/%s@from-sip/n',_0x31af('0x5a'),this[_0x31af('0x10')][_0x31af('0x40')]):undefined;this[_0x31af('0x11')][_0x31af('0x58')](_0x50d8f1,_0x172f45)[_0x31af('0x16')](function(_0x5cccfe){_0x1de9ac(null,_[_0x31af('0x4d')](_0x5cccfe)?![]:!![]);})['catch'](function(_0x4c833a){logger[_0x31af('0x33')](_0x4c833a);_0x1de9ac(null,![]);});};AGIVertices[_0x31af('0x13')][_0x31af('0x5b')]=function(_0x51a7dc,_0x1972c7){sh[_0x31af('0x5c')](_[_0x31af('0x5d')](_0x51a7dc),function(_0x27241d,_0x30e9b5){var _0x2a13d4=_0x30e9b5[_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'');_0x1972c7(null,_0x2a13d4);});};AGIVertices[_0x31af('0x13')][_0x31af('0x5f')]=function(_0x342426,_0x1dbc50){scripts[_0x31af('0x5f')](_0x342426[_0x31af('0x60')],_0x342426['google_cloud_tts_text_type']||_0x31af('0x61'),_0x342426[_0x31af('0x61')],_0x342426[_0x31af('0x62')]||_0x31af('0x63'),_0x342426[_0x31af('0x64')]||'MALE',_0x342426[_0x31af('0x65')]||_0x31af('0x66'))[_0x31af('0x16')](function(_0x52b54a){_0x1dbc50(null,_0x52b54a);})[_0x31af('0x18')](function(_0x4f6354){_0x1dbc50(_0x4f6354);});};AGIVertices['prototype']['googleTTS']=function(_0x26ddb0,_0x147a74){scripts[_0x31af('0x67')](_0x26ddb0[_0x31af('0x61')],_0x26ddb0[_0x31af('0x68')]||'en',0x1)[_0x31af('0x16')](function(_0x625679){_0x147a74(null,_0x625679);})[_0x31af('0x18')](function(_0x499b43){_0x147a74(_0x499b43);});};AGIVertices[_0x31af('0x13')]['restAPI']=function(_0x20ded5,_0x443ad5){var _0x251e98={'uri':_0x20ded5[_0x31af('0x69')],'method':_0x20ded5[_0x31af('0x6a')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x20ded5['timeout'])===_0x31af('0x6b')&&parseInt(_0x20ded5['timeout'])>=0x1?parseInt(_0x20ded5['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x31af('0x6c'),_0x31af('0x6d')],_0x251e98[_0x31af('0x6a')][_0x31af('0x6e')]())){try{_0x251e98[_0x31af('0x6f')]=_0x20ded5[_0x31af('0xd')]?JSON[_0x31af('0x70')](_0x20ded5['rawBody']):{};}catch(_0x20ce38){logger[_0x31af('0x33')](_0x31af('0x71'),_0x20ce38);}}try{_0x251e98[_0x31af('0x72')]=_0x20ded5[_0x31af('0xc')]?JSON[_0x31af('0x70')](_0x20ded5[_0x31af('0xc')]):{};}catch(_0x38943b){logger[_0x31af('0x33')](_0x31af('0x73'),_0x38943b);}if(_0x20ded5[_0x31af('0x74')]){try{var _0x39f7fd=require(_0x20ded5[_0x31af('0x74')])[_0x31af('0x75')](this,_0x251e98);_0x251e98['uri']=Mustache[_0x31af('0x76')](_0x20ded5['url'],_0x39f7fd,{},['$$','$$']);if(_0x251e98[_0x31af('0x72')]){_0x251e98['headers']=JSON[_0x31af('0x70')](Mustache['render'](JSON['stringify'](_0x251e98[_0x31af('0x72')]),_0x39f7fd,{},['$$','$$']));}if(_0x251e98[_0x31af('0x6f')]){_0x251e98[_0x31af('0x6f')]=JSON[_0x31af('0x70')](Mustache[_0x31af('0x76')](JSON[_0x31af('0x77')](_0x251e98[_0x31af('0x6f')]),_0x39f7fd,{},['$$','$$']));}}catch(_0x17a278){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x17a278);}}rp(_0x251e98)[_0x31af('0x16')](function(_0x2f308e){var _0x85ec13={'statusCode':_0x2f308e[_0x31af('0x78')]||0xc8,'statusMessage':_0x2f308e[_0x31af('0x79')]||'OK','headers':_0x2f308e[_0x31af('0x72')]||{},'body':_0x2f308e[_0x31af('0x6f')]||{}};_0x443ad5(null,_0x85ec13);})['catch'](function(_0xf1a1bf){var _0x2dd7ac={'statusCode':_0xf1a1bf[_0x31af('0x78')]||0x1f4,'statusMessage':_0xf1a1bf['message']||_0x31af('0x7a'),'headers':_0xf1a1bf[_0x31af('0x7b')]['headers']||{},'body':_0xf1a1bf[_0x31af('0x7b')][_0x31af('0x6f')]||{}};_0x443ad5(null,_0x2dd7ac);});};AGIVertices[_0x31af('0x13')]['googleDialogflow']=function(_0x58db8e,_0x68efb7){scripts[_0x31af('0x7c')](this['channel'][_0x31af('0x3d')],_0x58db8e[_0x31af('0x7d')],_0x58db8e['text'],_0x58db8e[_0x31af('0x7e')]||'en')['then'](function(_0x4c2512){_0x68efb7(null,_0x4c2512);})['catch'](function(_0x2f5a27){_0x68efb7(_0x2f5a27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x7f')]=function(_0x3dc355,_0x5bcd7b){scripts['googleDialogflowV2'](this[_0x31af('0x10')][_0x31af('0x3d')],_0x3dc355[_0x31af('0x80')],_0x3dc355['client_email'],_0x3dc355[_0x31af('0x81')],_0x3dc355['text'],_0x3dc355[_0x31af('0x82')]||'en')[_0x31af('0x16')](function(_0x5e10ec){_0x5bcd7b(null,_0x5e10ec);})[_0x31af('0x18')](function(_0x7105d4){_0x5bcd7b(_0x7105d4);});};AGIVertices[_0x31af('0x13')][_0x31af('0x83')]=function(_0x1b940a,_0xbf906e){scripts[_0x31af('0x83')](this[_0x31af('0x10')],_0x1b940a)['then'](function(_0x12810b){_0xbf906e(null,_0x12810b);})[_0x31af('0x18')](function(_0x108c5d){_0xbf906e(_0x108c5d);});};AGIVertices[_0x31af('0x13')][_0x31af('0x84')]=function(_0x1a2d1f,_0x3f3798){scripts[_0x31af('0x84')](_0x1a2d1f[_0x31af('0x7d')],_0x1a2d1f['text'],_0x1a2d1f[_0x31af('0x85')]||_0x31af('0x63'),_0x1a2d1f[_0x31af('0x86')])[_0x31af('0x16')](function(_0x53499f){_0x3f3798(null,_0x53499f);})[_0x31af('0x18')](function(_0x5c23ae){_0x3f3798(_0x5c23ae);});};AGIVertices[_0x31af('0x13')][_0x31af('0x87')]=function(_0x4e09db,_0x97e9d1,_0xb471ad){scripts[_0x31af('0x87')](_0x97e9d1,_0x4e09db[_0x31af('0x7d')],_0x4e09db[_0x31af('0x88')]||'en-US',this[_0x31af('0x89')](_0x4e09db[_0x31af('0x8a')])?_0x4e09db[_0x31af('0x8a')]:undefined)[_0x31af('0x16')](function(_0x23fca2){_0xb471ad(null,_0x23fca2);})[_0x31af('0x18')](function(_0x1e6afa){_0xb471ad(_0x1e6afa);});};AGIVertices[_0x31af('0x13')][_0x31af('0x8b')]=function(_0x473338,_0x650e83){scripts[_0x31af('0x8b')](_0x473338[_0x31af('0x8c')],_0x473338[_0x31af('0x8d')],_0x473338[_0x31af('0x8e')],_0x473338[_0x31af('0x8f')]||_0x31af('0x90'),_0x473338[_0x31af('0x61')],_0x473338['aws_text_type']||_0x31af('0x61'))[_0x31af('0x16')](function(_0x2a78a9){_0x650e83(null,_0x2a78a9);})[_0x31af('0x18')](function(_0x553442){_0x650e83(_0x553442);});};AGIVertices[_0x31af('0x13')][_0x31af('0x91')]=function(_0x4ffaa2,_0x402290){scripts[_0x31af('0x91')](this[_0x31af('0x10')][_0x31af('0x3d')],_0x4ffaa2[_0x31af('0x8c')],_0x4ffaa2['aws_secret_access_key'],_0x4ffaa2['aws_lex_region'],_0x4ffaa2[_0x31af('0x61')],_0x4ffaa2[_0x31af('0x92')])[_0x31af('0x16')](function(_0x2198d9){_0x402290(null,_0x2198d9);})[_0x31af('0x18')](function(_0x562e31){_0x402290(_0x562e31);});};AGIVertices[_0x31af('0x13')][_0x31af('0x93')]=function(_0x574d4a,_0x4a6833,_0x5a6cd5){scripts[_0x31af('0x93')](_0x4a6833,_0x574d4a[_0x31af('0x7d')],_0x574d4a[_0x31af('0x94')]||_0x31af('0x63'))['then'](function(_0x2ae2f0){_0x5a6cd5(null,_0x2ae2f0);})[_0x31af('0x18')](function(_0x58db7b){_0x5a6cd5(_0x58db7b);});};AGIVertices['prototype'][_0x31af('0x95')]=function(_0x1c6cb9,_0x5eff1f,_0x2ad67a){scripts[_0x31af('0x95')](_0x5eff1f,_0x1c6cb9[_0x31af('0x96')],_0x1c6cb9[_0x31af('0x97')],_0x1c6cb9[_0x31af('0x98')])[_0x31af('0x16')](function(_0x50a967){_0x2ad67a(null,_0x50a967);})['catch'](function(_0x436b7b){_0x2ad67a(_0x436b7b);});};AGIVertices[_0x31af('0x13')]['clear']=function(_0xb600ef){var _0x23792f=_[_0x31af('0x99')](verticesWithRetry,_0xb600ef[_0x31af('0x9a')])?_0xb600ef:_[_0x31af('0x9b')](_0xb600ef);for(var _0x758084 in _0x23792f){if(_0x23792f[_0x31af('0x9c')](_0x758084)){if(_0x23792f[_0x758084]&&_[_0x31af('0x9d')](_0x23792f[_0x758084])){if(_[_0x31af('0x99')](recursiveMapAttributes,_0x758084)){_0x23792f[_0x758084]=this[_0x31af('0x9e')](_0x23792f[_0x758084]);}else{_0x23792f[_0x758084]=this[_0x31af('0x9f')](_0x23792f[_0x758084]);}}}}return _0x23792f;};AGIVertices[_0x31af('0x13')][_0x31af('0xa0')]=function(_0x1035a0){for(var _0x3cc775 in _0x1035a0){if(_0x1035a0[_0x31af('0x9c')](_0x3cc775)){if(_[_0x31af('0xa1')](_0x1035a0[_0x3cc775])){this[_0x31af('0xa0')](_0x1035a0[_0x3cc775]);}else if(_['isArray'](_0x1035a0[_0x3cc775])){for(var _0x54d549=0x0;_0x54d549<_0x1035a0[_0x3cc775][_0x31af('0xa2')];_0x54d549++){this[_0x31af('0xa0')](_0x1035a0[_0x3cc775][_0x54d549]);}}else if(_[_0x31af('0x9d')](_0x1035a0[_0x3cc775])){_0x1035a0[_0x3cc775]=this[_0x31af('0x9f')](_0x1035a0[_0x3cc775]);}}}};AGIVertices[_0x31af('0x13')][_0x31af('0xa3')]=function(_0x580ad9,_0xcdbb6b){for(var _0x22de90 in _0x580ad9){if(_0x580ad9[_0x31af('0x9c')](_0x22de90)){if(_['isPlainObject'](_0x580ad9[_0x22de90])){if(!_[_0x31af('0x49')](_0x580ad9[_0x22de90])){this[_0x31af('0xa3')](_0x580ad9[_0x22de90],util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90));}}else if(_[_0x31af('0xa5')](_0x580ad9[_0x22de90])){for(var _0x1c254e=0x0;_0x1c254e<_0x580ad9[_0x22de90][_0x31af('0xa2')];_0x1c254e++){this[_0x31af('0xa3')](_0x580ad9[_0x22de90][_0x1c254e],util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90+'['+_0x1c254e+']'));}}else{if(!_['isNil'](_0x580ad9[_0x22de90])){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90),_0x580ad9[_0x22de90]);}}}}};AGIVertices[_0x31af('0x13')][_0x31af('0x9e')]=function(_0x429027){try{var _0x25ef0b=JSON['parse'](_0x429027);this['recursiveNodeIndex'](_0x25ef0b);return JSON[_0x31af('0x77')](_0x25ef0b);}catch(_0x287578){return this[_0x31af('0x9f')](_0x429027);}};AGIVertices[_0x31af('0x13')]['replaceAllVariables']=function(_0x56b4c1){var _0x537e5a=_0x56b4c1[_0x31af('0xa7')]('{');for(var _0x176686=0x1;_0x176686<_0x537e5a['length'];_0x176686+=0x1){var _0x454c6c=_0x537e5a[_0x176686][_0x31af('0xa7')]('}');if(_0x454c6c[_0x31af('0xa2')]>0x1){_0x56b4c1=_0x56b4c1[_0x31af('0xa8')]('{'+_0x454c6c[0x0]+'}',this[_0x31af('0x10')][_0x31af('0x14')](_0x454c6c[0x0])[_0x31af('0xa9')]||_0x454c6c[0x0]);}}if(_0x537e5a[_0x31af('0xa2')]===0x1){return _0x56b4c1['toString']();}return this[_0x31af('0x9f')](_0x56b4c1);};AGIVertices[_0x31af('0x13')]['getAndSetVariable']=function(_0x1a3aa6,_0x27834a){var _0x33cdac=this[_0x31af('0x10')]['getVariable'](_0x1a3aa6);if(_0x33cdac[_0x31af('0xaa')]===-0x1){return _0x33cdac;}logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xab'),_0x27834a,_0x33cdac[_0x31af('0xa9')]));return this['channel'][_0x31af('0xa6')](_0x27834a,_0x33cdac['extra']);};AGIVertices['prototype'][_0x31af('0x89')]=function(_0x2dfda4){return _0x2dfda4&&_0x2dfda4!=='0'&&_0x2dfda4!=='-1'&&_0x2dfda4!=='';};AGIVertices[_0x31af('0x13')][_0x31af('0xac')]=function(_0x759c19){this[_0x31af('0x3c')]['sync'](this,_0x759c19,'-');_0x759c19['retry']=_0x759c19[_0x31af('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x517893){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xad'),_0x517893[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x517893[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xaf'));}var _0x2823cb='\x22'+_0x517893[_0x31af('0x61')]+'\x22';if(this['isConfigured'](_0x517893[_0x31af('0x7b')])){_0x2823cb+=','+_0x517893[_0x31af('0x7b')];}var _0x42f5d3=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x2823cb);if(_0x42f5d3[_0x31af('0xaa')]===-0x1){return _0x42f5d3;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xb1'),_0x2823cb));};AGIVertices[_0x31af('0x13')][_0x31af('0xb2')]=function(_0x58a8f6){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x58a8f6[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x58a8f6[_0x31af('0xb3')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xb4'));}var _0x103a8e=_0x58a8f6[_0x31af('0xb3')];if(this[_0x31af('0x89')](_0x58a8f6[_0x31af('0x7b')])){_0x103a8e+=','+_0x58a8f6[_0x31af('0x7b')];}var _0x28ba13=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb5'),_0x103a8e);if(_0x28ba13['result']===-0x1){return _0x28ba13;}var _0x25ebed=this[_0x31af('0xb6')](_0x31af('0xb7'),_0x31af('0xb8'));if(_0x25ebed[_0x31af('0xaa')]===-0x1){return _0x25ebed;}var _0xa855d1=this['getAndSetVariable'](_0x31af('0xb9'),_0x31af('0xba'));if(_0xa855d1[_0x31af('0xaa')]===-0x1){return _0xa855d1;}var _0x5bf030=this[_0x31af('0xb6')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5bf030['result']===-0x1){return _0x5bf030;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x103a8e));};AGIVertices[_0x31af('0x13')][_0x31af('0x9')]=function(_0x4925c7){logger['info'](util[_0x31af('0x30')](_0x31af('0xbb'),_0x4925c7[_0x31af('0x3e')]));return this[_0x31af('0x10')]['agi']([_0x4925c7[_0x31af('0xbc')],_0x4925c7['args']]);};AGIVertices[_0x31af('0x13')][_0x31af('0xbd')]=function(_0x901ab3){logger['info'](util[_0x31af('0x30')](_0x31af('0xbe'),_0x901ab3[_0x31af('0x3e')]));if(this[_0x31af('0x89')](_0x901ab3[_0x31af('0xbf')])){logger['info'](util['format'](_0x31af('0xc0'),_0x901ab3['timeout']));var _0x11c047=this['channel'][_0x31af('0xc1')](_0x901ab3[_0x31af('0xbf')]);if(_0x11c047[_0x31af('0xaa')]===-0x1){return _0x11c047;}}return this[_0x31af('0x10')][_0x31af('0xbd')]();};AGIVertices['prototype'][_0x31af('0x51')]=function(_0x472ed9){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xc2'),_0x472ed9['label']));if(!this[_0x31af('0x89')](_0x472ed9['list_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x472ed9,'no\x20list\x20selected');}_0x472ed9['scheduledAt']=moment();if(this['isConfigured'](_0x472ed9[_0x31af('0xc3')])){_0x472ed9[_0x31af('0x50')]=moment()['add'](_0x472ed9[_0x31af('0xc3')],_0x31af('0xc4'));}if(!this['isConfigured'](_0x472ed9[_0x31af('0x53')])){_0x472ed9[_0x31af('0x53')]=0x2;}this[_0x31af('0x48')][_0x31af('0x75')](this,_0x472ed9);return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xc5'),_0x472ed9[_0x31af('0x4e')],_0x472ed9[_0x31af('0x4f')],_0x472ed9[_0x31af('0x50')]));};AGIVertices[_0x31af('0x13')][_0x31af('0xc6')]=function(_0x1a3049){logger['info'](util[_0x31af('0x30')](_0x31af('0xc7'),_0x1a3049[_0x31af('0x3e')]));var _0x2751d6=this[_0x31af('0x10')]['exec'](_0x1a3049['application'],_0x1a3049['options']);if(_0x2751d6['result']===-0x1){return _0x2751d6;}return this['channel'][_0x31af('0xae')](util['format']('Executed\x20command\x20%s\x20%s',_0x1a3049[_0x31af('0xc8')],_0x1a3049['options']));};AGIVertices['prototype'][_0x31af('0xc9')]=function(_0x55183d){logger['info'](util[_0x31af('0x30')](_0x31af('0xca'),_0x55183d[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x55183d[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xaf'));}var _0x1dccc5='\x22'+_0x55183d[_0x31af('0x61')]+'\x22';if(this[_0x31af('0x89')](_0x55183d[_0x31af('0x7b')])){_0x1dccc5+=','+_0x55183d[_0x31af('0x7b')];}var _0x398174=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x1dccc5);if(_0x398174[_0x31af('0xaa')]===-0x1){return _0x398174;}return this['channel'][_0x31af('0xae')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1dccc5));};AGIVertices[_0x31af('0x13')][_0x31af('0xcb')]=function(_0xae3285){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xcc'),_0xae3285[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xae3285[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20text\x20configured');}var _0x4607a2='\x22'+_0xae3285[_0x31af('0x61')]+'\x22';if(this[_0x31af('0x89')](_0xae3285[_0x31af('0x7b')])){_0x4607a2+=','+_0xae3285[_0x31af('0x7b')];}var _0x50ab11=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x4607a2);if(_0x50ab11[_0x31af('0xaa')]===-0x1){return _0x50ab11;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4607a2));};AGIVertices[_0x31af('0x13')]['lumenvoxasr']=function(_0xb69db4){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xcd'),_0xb69db4[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xb69db4[_0x31af('0xb3')])){return this[_0x31af('0x10')]['noop']('no\x20grammar\x20configured');}var _0x37cbda=_0xb69db4['grammar'];if(this[_0x31af('0x89')](_0xb69db4[_0x31af('0x7b')])){_0x37cbda+=','+_0xb69db4[_0x31af('0x7b')];}var _0xfc89a7=this['channel'][_0x31af('0x5c')]('MRCPRecog',_0x37cbda);if(_0xfc89a7['result']===-0x1){return _0xfc89a7;}var _0x226ae0=this['getAndSetVariable'](_0x31af('0xb7'),_0x31af('0xce'));if(_0x226ae0[_0x31af('0xaa')]===-0x1){return _0x226ae0;}var _0x583288=this[_0x31af('0xb6')](_0x31af('0xb9'),_0x31af('0xcf'));if(_0x583288[_0x31af('0xaa')]===-0x1){return _0x583288;}var _0x50f27c=this['getAndSetVariable'](_0x31af('0xd0'),_0x31af('0xd1'));if(_0x50f27c[_0x31af('0xaa')]===-0x1){return _0x50f27c;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x37cbda));};AGIVertices[_0x31af('0x13')]['sestekasr']=function(_0xec1a1e){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xd2'),_0xec1a1e[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xec1a1e[_0x31af('0xb3')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xb4'));}var _0x596c49=_0xec1a1e[_0x31af('0xb3')];if(this['isConfigured'](_0xec1a1e['options'])){_0x596c49+=','+_0xec1a1e[_0x31af('0x7b')];}var _0x261f0b=this['channel'][_0x31af('0x5c')](_0x31af('0xb5'),_0x596c49);if(_0x261f0b['result']===-0x1){return _0x261f0b;}var _0xa23096=this[_0x31af('0xb6')](_0x31af('0xb7'),_0x31af('0xd3'));if(_0xa23096[_0x31af('0xaa')]===-0x1){return _0xa23096;}var _0x39422f=this['getAndSetVariable'](_0x31af('0xb9'),_0x31af('0xd4'));if(_0x39422f['result']===-0x1){return _0x39422f;}var _0x2b6a24=this[_0x31af('0xb6')]('RECOG_INSTANCE()',_0x31af('0xd5'));if(_0x2b6a24[_0x31af('0xaa')]===-0x1){return _0x2b6a24;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x596c49));};AGIVertices['prototype'][_0x31af('0xd6')]=function(_0x5bee36){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5bee36[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x5bee36[_0x31af('0xd7')])){return this['channel'][_0x31af('0x33')](_0x5bee36,_0x31af('0xd8'));}var _0x2203c8=this[_0x31af('0x1d')]['sync'](this,_0x5bee36[_0x31af('0xd7')]);if(!_0x2203c8){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5bee36,_0x31af('0xd9'));}if(!this['isConfigured'](_0x5bee36[_0x31af('0xda')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5bee36,_0x31af('0xdb'));}var _0x59380d=_0x5bee36[_0x31af('0xda')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0xdc'),_0x59380d));var _0x550442=this[_0x31af('0xdd')][_0x31af('0x75')](this,_0x2203c8,_0x59380d);this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x5bee36,_0x59380d);if(!this[_0x31af('0x89')](_0x5bee36[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}var _0x49b136=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x5bee36[_0x31af('0xde')]);if(!_0x49b136){return this['channel']['error'](_0x5bee36,'no\x20variable\x20found');}var _0x422cfa=this;_0x550442[_0x31af('0xe0')](function(_0x2a7f25,_0x29691a){Object[_0x31af('0xe1')](_0x2a7f25)['forEach'](function(_0x2a3213){_0x422cfa[_0x31af('0x10')][_0x31af('0xa6')](util['format'](_0x31af('0xe2'),_0x49b136,_0x29691a,_0x2a3213),_0x2a7f25[_0x2a3213]);});});this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xe3'),_0x49b136),_0x550442[_0x31af('0xa2')]);return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0xe4'),_0x49b136));};AGIVertices[_0x31af('0x13')][_0x31af('0xe5')]=function(_0x2e8ffd){logger[_0x31af('0xe6')](util[_0x31af('0x30')](_0x31af('0xe7'),_0x2e8ffd['label']));if(!this['isConfigured'](_0x2e8ffd['sip_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2e8ffd,_0x31af('0xe8'));}var _0x132096=this[_0x31af('0x20')][_0x31af('0x75')](this,_0x2e8ffd[_0x31af('0xe9')]);if(!_0x132096){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2e8ffd,'no\x20user\x20found');}var _0x39a7f3=this['channel']['exec'](_0x31af('0xea'),[util['format'](_0x31af('0xeb'),_0x132096),_0x2e8ffd[_0x31af('0xbf')],_0x2e8ffd[_0x31af('0xec')],_0x2e8ffd[_0x31af('0x69')]]);if(_0x39a7f3[_0x31af('0xaa')]===-0x1){return _0x39a7f3;}return this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0xed'),_0x31af('0xea')));};AGIVertices['prototype'][_0x31af('0xee')]=function(_0x1d7815){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1d7815['label']));if(!this[_0x31af('0x89')](_0x1d7815['key'])){return this[_0x31af('0x10')]['noop'](_0x31af('0xef'));}if(!this[_0x31af('0x89')](_0x1d7815[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')]['bot']=!![];this[_0x31af('0x3c')](_0x1d7815);this[_0x31af('0x47')](_0x1d7815['text'],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0xf0'),_0x1d7815[_0x31af('0x61')]));var _0x4ca7e7=this[_0x31af('0x7c')]['sync'](this,_0x1d7815);if(_0x4ca7e7){for(var _0x398ac1 in _0x4ca7e7){if(_0x4ca7e7[_0x31af('0x9c')](_0x398ac1)){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xf1'),_0x398ac1[_0x31af('0x6e')]()),_0x4ca7e7[_0x398ac1]);}}this['createSquareMessage'](_0x4ca7e7[_0x31af('0xf2')],_0x31af('0xf3'),_0x31af('0xee'),'');return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Dialogflow\x20Result\x20%s',_0x4ca7e7[_0x31af('0xf2')]));}return this['channel'][_0x31af('0x33')](_0x1d7815,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')][_0x31af('0xf4')]=function(_0x7daa3a){logger['info'](util[_0x31af('0x30')](_0x31af('0xf5'),_0x7daa3a[_0x31af('0x3e')]));if(!this['isConfigured'](_0x7daa3a[_0x31af('0x80')])){return this['channel'][_0x31af('0xae')](_0x31af('0xf6'));}if(!this['isConfigured'](_0x7daa3a[_0x31af('0xf7')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xf8'));}if(!this[_0x31af('0x89')](_0x7daa3a['private_key'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20private_key\x20configured');}if(!this[_0x31af('0x89')](_0x7daa3a[_0x31af('0x82')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xf9'));}if(!this[_0x31af('0x89')](_0x7daa3a['text'])){return this['channel'][_0x31af('0xae')](_0x31af('0xaf'));}this[_0x31af('0x10')][_0x31af('0xfa')]=!![];this['createSquareDetailsReport'](_0x7daa3a);this['createSquareMessage'](_0x7daa3a[_0x31af('0x61')],'in','','');this['channel'][_0x31af('0xae')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x7daa3a[_0x31af('0x61')]));var _0x32f99c=this[_0x31af('0x7f')]['sync'](this,_0x7daa3a);if(_0x32f99c){for(var _0x5b9481 in _0x32f99c){if(_0x32f99c[_0x31af('0x9c')](_0x5b9481)){if(_0x5b9481!==_0x31af('0xfb')){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xf1'),_0x5b9481['toUpperCase']()),_0x32f99c[_0x5b9481]);}}}this[_0x31af('0x47')](_0x32f99c[_0x31af('0xf2')],_0x31af('0xf3'),'dialogflowV2',_0x32f99c[_0x31af('0xfb')]);return this['channel'][_0x31af('0xae')](util[_0x31af('0x30')]('DialogflowV2\x20Result\x20%s',_0x32f99c['speech']));}return this[_0x31af('0x10')][_0x31af('0x33')](_0x7daa3a,_0x31af('0xfc'));};AGIVertices[_0x31af('0x13')][_0x31af('0xfd')]=function(_0x4152ba){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xfe'),_0x4152ba[_0x31af('0x3e')]));if(!this['isConfigured'](_0x4152ba[_0x31af('0xff')])){return this['channel'][_0x31af('0xae')](_0x31af('0x100'));}if(!this[_0x31af('0x89')](_0x4152ba[_0x31af('0x101')])){return this['channel'][_0x31af('0xae')](_0x31af('0x102'));}if(!this['isConfigured'](_0x4152ba[_0x31af('0x103')])){return this['channel'][_0x31af('0xae')](_0x31af('0x104'));}if(!this[_0x31af('0x89')](_0x4152ba['ndassistant_url'])){return this['channel'][_0x31af('0xae')](_0x31af('0xaf'));}this['channel'][_0x31af('0xfa')]=!![];this[_0x31af('0x3c')](_0x4152ba);this[_0x31af('0x47')](_0x4152ba[_0x31af('0x61')],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x105'),_0x4152ba[_0x31af('0x61')]));var _0x245f0f=this['sestekNDA'][_0x31af('0x75')](this,_0x4152ba);if(_0x245f0f){for(var _0x54bd26 in _0x245f0f){if(_0x245f0f[_0x31af('0x9c')](_0x54bd26)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x106'),_0x54bd26['toUpperCase']()),_0x245f0f[_0x54bd26]);}}this[_0x31af('0x47')](_0x245f0f['speech'],_0x31af('0xf3'),_0x31af('0xfd'),'');if(_0x245f0f[_0x31af('0x107')]){this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x108'),_0x245f0f[_0x31af('0x107')]));var _0x5361d6=this['channel'][_0x31af('0x109')](_0x245f0f[_0x31af('0x107')]);try{fs[_0x31af('0x10a')](_0x245f0f[_0x31af('0x107')]+_0x31af('0x10b'));}catch(_0xca933f){logger[_0x31af('0x33')](_0xca933f);}return _0x5361d6;}else{return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x10c'),_0x245f0f[_0x31af('0xf2')]));}}return this['channel'][_0x31af('0x33')](_0x4152ba,_0x31af('0x10d'));};AGIVertices[_0x31af('0x13')][_0x31af('0x10e')]=function(_0x3d18e7){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x10f'),_0x3d18e7[_0x31af('0x3e')]));return this['channel'][_0x31af('0xae')](_0x31af('0x10e'));};AGIVertices[_0x31af('0x13')]['ext_dial']=function(_0x24c5d5){logger['info'](util[_0x31af('0x30')](_0x31af('0x110'),_0x24c5d5[_0x31af('0x3e')]));var _0x3c9dad='';if(_0x24c5d5['trunk_id']){if(!this[_0x31af('0x89')](_0x24c5d5['trunk_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x24c5d5,_0x31af('0x111'));}else{var _0x513617=parseInt(_0x24c5d5[_0x31af('0x112')],0xa);if(isNaN(_0x513617)){_0x3c9dad=_0x24c5d5[_0x31af('0x112')];}else{_0x3c9dad=this[_0x31af('0x22')][_0x31af('0x75')](this,_0x24c5d5[_0x31af('0x112')]);if(!_0x3c9dad){return this['channel'][_0x31af('0x33')](_0x24c5d5,_0x31af('0x113'));}}}}else if(_0x24c5d5[_0x31af('0x114')]){_0x3c9dad=_0x24c5d5[_0x31af('0x114')];}else{return this[_0x31af('0x10')][_0x31af('0x33')](_0x24c5d5,_0x31af('0x111'));}var _0x579c71=this[_0x31af('0x10')][_0x31af('0x5c')]('DIAL',[util[_0x31af('0x30')](_0x31af('0x115'),_0x3c9dad,_0x24c5d5[_0x31af('0x4e')]),_0x24c5d5['timeout'],_0x24c5d5['opts'],_0x24c5d5['url']]);if(_0x579c71[_0x31af('0xaa')]===-0x1){return _0x579c71;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xed'),_0x31af('0xea')));};AGIVertices[_0x31af('0x13')]['finally']=function(_0x210d4d){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x210d4d['label']));return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x116'));};AGIVertices[_0x31af('0x13')][_0x31af('0xe')]=function(_0xa48379){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x117'),_0xa48379[_0x31af('0x3e')]));if(_0xa48379[_0x31af('0x118')]===0x0){return this[_0x31af('0xac')](_0xa48379);}_0xa48379[_0x31af('0x118')]-=0x1;if(!this[_0x31af('0x89')](_0xa48379[_0x31af('0x119')])){return this[_0x31af('0x10')]['error'](_0xa48379,_0x31af('0x11a'));}var _0xb478f3=this[_0x31af('0x23')]['sync'](this,_0xa48379[_0x31af('0x119')]);if(!_0xb478f3){return this[_0x31af('0x10')]['error'](_0xa48379,_0x31af('0x11b'));}if(!this['isConfigured'](_0xa48379[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x31af('0xdf'));}var _0x4a149f=this[_0x31af('0x10')][_0x31af('0x11c')](_0xb478f3,_0xa48379['response'],_0xa48379[_0x31af('0x11d')]);var _0x2af1a9=_0x4a149f['result']?_0x4a149f[_0x31af('0xaa')][_0x31af('0x52')]():'';logger[_0x31af('0x35')](_0x31af('0x11e'),JSON['stringify'](_0x4a149f));if(_0x4a149f['result']===-0x1){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,_0x2af1a9);return _0x4a149f;}else if(_0x4a149f[_0x31af('0xa9')]===_0x31af('0xbf')){_0x4a149f[_0x31af('0xaa')]=_0x2af1a9[_0x31af('0xa2')]>=parseInt(_0xa48379[_0x31af('0x11f')])?'x':'i';}else{_0x4a149f[_0x31af('0xaa')]=_0x2af1a9['length']>=parseInt(_0xa48379[_0x31af('0x11f')])&&_0x2af1a9[_0x31af('0xa2')]<=parseInt(_0xa48379[_0x31af('0x11d')])?'x':'i';}var _0x3de225=this['getVariable'][_0x31af('0x75')](this,_0xa48379[_0x31af('0xde')]);if(!_0x3de225){return this[_0x31af('0x10')][_0x31af('0x33')](_0xa48379,_0x31af('0x120'));}this[_0x31af('0x10')][_0x31af('0xa6')](_0x3de225,_0x2af1a9);if(this[_0x31af('0x89')](_0xa48379[_0x31af('0x121')])){var _0x55d1fb=parseInt(_0xa48379[_0x31af('0x121')],0xa);var _0x1fa7e0=rs[_0x31af('0x122')]({'charset':'*','length':_0x55d1fb});var _0x1a09c6=_0x2af1a9[_0x31af('0xa2')];if(_0x1a09c6>0x0){if(_0x1a09c6>_0x55d1fb){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,_0xa48379[_0x31af('0x123')]===_0x31af('0x124')?_0x1fa7e0+_0x2af1a9['substr'](_0x55d1fb):_0x2af1a9[_0x31af('0x125')](0x0,_0x1a09c6-_0x55d1fb)+_0x1fa7e0);}else{this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,rs[_0x31af('0x122')]({'charset':'*','length':_0x1a09c6}));}}else{this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,'');}}else{this['createSquareDetailsReport'][_0x31af('0x75')](this,_0xa48379,_0x2af1a9);}return _0x4a149f;};AGIVertices[_0x31af('0x13')][_0x31af('0xf')]=function(_0x293f4a){logger['info'](util['format'](_0x31af('0x126'),_0x293f4a[_0x31af('0x3e')]));return this[_0x31af('0xe')](_0x293f4a);};AGIVertices['prototype']['goal']=function(_0x334c75){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x334c75['label']));this[_0x31af('0x3c')]['sync'](this,_0x334c75,_0x334c75[_0x31af('0x127')]);return this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x128'),_0x334c75[_0x31af('0x127')]));};AGIVertices[_0x31af('0x13')][_0x31af('0x129')]=function(_0x2ae295){logger[_0x31af('0x35')](util['format'](_0x31af('0x12a'),_0x2ae295[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x2ae295[_0x31af('0x8c')])||!this[_0x31af('0x89')](_0x2ae295[_0x31af('0x8d')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2ae295[_0x31af('0x61')])){return this['channel'][_0x31af('0xae')]('no\x20text\x20configured');}this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x12b'),_0x2ae295['text']));var _0x4136c0=this[_0x31af('0x8b')][_0x31af('0x75')](this,_0x2ae295);if(_0x4136c0){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x12c'),_0x4136c0));var _0x539ce3=this[_0x31af('0x10')][_0x31af('0x109')](_0x4136c0);try{fs['unlink'](_0x4136c0+_0x31af('0x10b'));}catch(_0x2ea778){logger[_0x31af('0x33')](_0x2ea778);}return _0x539ce3;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x2ae295,_0x31af('0x12d'));};AGIVertices['prototype']['awslex']=function(_0x378c06){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x378c06[_0x31af('0x3e')]));if(!this['isConfigured'](_0x378c06[_0x31af('0x8c')])||!this[_0x31af('0x89')](_0x378c06[_0x31af('0x8d')])){return this['channel']['noop'](_0x31af('0x12e'));}if(!this[_0x31af('0x89')](_0x378c06[_0x31af('0x92')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x12f'));}if(!this[_0x31af('0x89')](_0x378c06[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')][_0x31af('0xfa')]=!![];this[_0x31af('0x3c')](_0x378c06);this[_0x31af('0x47')](_0x378c06[_0x31af('0x61')],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x130'),_0x378c06[_0x31af('0x61')]));var _0x5cc479=this[_0x31af('0x91')][_0x31af('0x75')](this,_0x378c06);if(_0x5cc479){for(var _0x25e488 in _0x5cc479){if(_0x5cc479[_0x31af('0x9c')](_0x25e488)&&_['isString'](_0x5cc479[_0x25e488])){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')]('AWS_LEX_%s',_0x25e488[_0x31af('0x6e')]()),_0x5cc479[_0x25e488]);}}if(_[_0x31af('0x4d')](_0x5cc479[_0x31af('0x131')])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x31af('0x47')](_0x5cc479['message'],_0x31af('0xf3'),_0x31af('0x132'),'');return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x133'),_0x5cc479[_0x31af('0x131')]));}}return this['channel'][_0x31af('0x33')](_0x378c06,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')]['googleasr']=function(_0x5ee9c4){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x134'),_0x5ee9c4[_0x31af('0x3e')],_0x5ee9c4[_0x31af('0xbf')]));if(!this[_0x31af('0x89')](_0x5ee9c4[_0x31af('0x7d')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xef'));}var _0x369724=_0x31af('0x135');var _0x1244e2=util[_0x31af('0x30')](_0x31af('0x136'),FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x52dfb5=util[_0x31af('0x30')]('%s.%s',_0x1244e2,_0x369724);var _0x25fd41=!![];if(_0x5ee9c4[_0x31af('0x137')]==='NOBEEP'){_0x25fd41=![];}var _0x34f52d=this['channel'][_0x31af('0x138')](_0x1244e2,_0x369724,_0x5ee9c4[_0x31af('0x139')],_0x5ee9c4[_0x31af('0xbf')],undefined,_0x25fd41);if(_0x34f52d[_0x31af('0xaa')]!==-0x1){this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('google\x20%s\x20file\x20created',_0x52dfb5));var _0x47a056=this[_0x31af('0x93')][_0x31af('0x75')](this,_0x5ee9c4,_0x52dfb5);if(_0x47a056){for(var _0x1fdb84 in _0x47a056){if(_0x47a056[_0x31af('0x9c')](_0x1fdb84)){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x13a'),_0x1fdb84[_0x31af('0x6e')]()),_0x47a056[_0x1fdb84]);}}return this['channel']['noop'](util[_0x31af('0x30')](_0x31af('0x13b'),JSON[_0x31af('0x77')](_0x47a056)));}}return _0x34f52d;};AGIVertices['prototype'][_0x31af('0x13c')]=function(_0xdb4fe7){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x13d'),_0xdb4fe7[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xdb4fe7['appid'])){return this['channel']['noop'](_0x31af('0x13e'));}if(!this[_0x31af('0x89')](_0xdb4fe7[_0x31af('0x97')])){return this['channel'][_0x31af('0xae')](_0x31af('0x13f'));}var _0x3149f4=_0x31af('0x135');var _0x2ad480=util[_0x31af('0x30')]('%s/recordings/%s',FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x4d06f4=util['format']('%s.%s',_0x2ad480,_0x3149f4);var _0x139379=!![];if(_0xdb4fe7[_0x31af('0x137')]==='NOBEEP'){_0x139379=![];}var _0x1331be=this[_0x31af('0x10')][_0x31af('0x138')](_0x2ad480,_0x3149f4,_0xdb4fe7[_0x31af('0x139')],_0xdb4fe7[_0x31af('0xbf')],undefined,_0x139379);if(_0x1331be['result']!==-0x1){this[_0x31af('0x10')][_0x31af('0xae')](util['format']('tilde\x20%s\x20file\x20created',_0x4d06f4));var _0x209ed9=this[_0x31af('0x95')]['sync'](this,_0xdb4fe7,_0x4d06f4);if(_0x209ed9){for(var _0x3301f7 in _0x209ed9){if(_0x209ed9[_0x31af('0x9c')](_0x3301f7)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x140'),_0x3301f7['toUpperCase']()),_0x209ed9[_0x3301f7]);}}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x141'),JSON[_0x31af('0x77')](_0x209ed9)));}}return _0x1331be;};AGIVertices['prototype'][_0x31af('0x142')]=function(_0x4690e6){logger['info'](util[_0x31af('0x30')](_0x31af('0x143'),_0x4690e6[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x144')](_0x4690e6[_0x31af('0x43')],_0x4690e6['extension'],_0x4690e6[_0x31af('0x44')]);};AGIVertices[_0x31af('0x13')]['gotoif']=function(_0x2a7a52){logger['info'](util[_0x31af('0x30')](_0x31af('0x145'),_0x2a7a52[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x2a7a52[_0x31af('0x146')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2a7a52,_0x31af('0x147'));}try{var _0x38bb3b=eval(_0x2a7a52[_0x31af('0x146')])?_0x31af('0x148'):_0x31af('0x149');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x14a'),_0x2a7a52['condition'],_0x38bb3b));return{'code':0xc8,'result':_0x38bb3b};}catch(_0x5bf376){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x31af('0x13')][_0x31af('0x14b')]=function(_0x753a4b){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x753a4b[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x753a4b[_0x31af('0x14c')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x753a4b,'no\x20interval\x20configured');}var _0x4a4e13=this[_0x31af('0x29')][_0x31af('0x75')](this,_0x753a4b['interval_id']);if(!_0x4a4e13){return this[_0x31af('0x10')][_0x31af('0x33')](_0x753a4b,_0x31af('0x14d'));}for(var _0x441dd4=0x0;_0x441dd4<_0x4a4e13[_0x31af('0xa2')];_0x441dd4+=0x1){var _0x3c36aa=this[_0x31af('0x10')]['getVariable'](util[_0x31af('0x30')]('IFTIME(%s?true:false)',_0x4a4e13[_0x441dd4]));if(_0x3c36aa['result']===-0x1){return _0x3c36aa;}logger['info'](util[_0x31af('0x30')](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x3c36aa[_0x31af('0xa9')]));if(_0x3c36aa[_0x31af('0xa9')]===_0x31af('0x148')){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x31af('0x148')));this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x31af('0x148')));return{'code':0xc8,'result':_0x31af('0x148')};}else{logger[_0x31af('0x35')](util['format'](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],'false'));this['channel'][_0x31af('0xae')](util[_0x31af('0x30')]('IFTIME\x20%s\x20%s',_0x4a4e13[_0x441dd4],_0x31af('0x149')));}}return{'code':0xc8,'result':_0x31af('0x149')};};AGIVertices[_0x31af('0x13')][_0x31af('0x14f')]=function(_0xde04c6){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x150'),_0xde04c6[_0x31af('0x3e')]));return this['channel'][_0x31af('0x14f')]();};AGIVertices[_0x31af('0x13')][_0x31af('0x151')]=function(_0x101a60){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x152'),_0x101a60[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x101a60['key'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20key\x20configured');}var _0x31a7a1=_0x31af('0x135');var _0x37d651=util[_0x31af('0x30')](_0x31af('0x136'),FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x397951=util[_0x31af('0x30')](_0x31af('0xa4'),_0x37d651,_0x31a7a1);var _0x4914ae=!![];if(_0x101a60[_0x31af('0x137')]===_0x31af('0x153')){_0x4914ae=![];}var _0x31d544=this['channel']['recordFile'](_0x37d651,_0x31a7a1,_0x101a60[_0x31af('0x139')],_0x101a60[_0x31af('0xbf')],undefined,_0x4914ae);if(_0x31d544[_0x31af('0xaa')]!==-0x1){this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x154'),_0x397951));var _0x593a34=this['ispeechASR'][_0x31af('0x75')](this,_0x101a60,_0x397951);if(_0x593a34){for(var _0x2ee23d in _0x593a34){if(_0x593a34['hasOwnProperty'](_0x2ee23d)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x155'),_0x2ee23d[_0x31af('0x6e')]()),_0x593a34[_0x2ee23d]);}}return this['channel']['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x593a34)));}}return _0x31d544;};AGIVertices['prototype']['ispeechtts']=function(_0x321fde){logger['info'](util[_0x31af('0x30')](_0x31af('0x156'),_0x321fde[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x321fde[_0x31af('0x7d')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x321fde[_0x31af('0x61')])){return this['channel']['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x157'),_0x321fde[_0x31af('0x61')]));var _0xcd5d74=this[_0x31af('0x84')][_0x31af('0x75')](this,_0x321fde);if(_0xcd5d74){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('ispeech\x20%s\x20file\x20created',_0xcd5d74));var _0xc85309=this['channel']['streamFile'](_0xcd5d74,_0x321fde[_0x31af('0x139')]);try{fs['unlink'](_0xcd5d74+'.wav');}catch(_0x1247aa){logger[_0x31af('0x33')](_0x1247aa);}return _0xc85309;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x321fde,_0x31af('0x158'));};AGIVertices[_0x31af('0x13')][_0x31af('0x159')]=function(_0xa40daa){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xa40daa['label']));if(!this['isConfigured'](_0xa40daa[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0xa40daa,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format'](_0x31af('0x15c'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));var _0x27ac1d=this[_0x31af('0x58')][_0x31af('0x75')](this,_0xa40daa['findBy']);if(_0x27ac1d){logger['info'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel']['callerid'],_0xa40daa[_0x31af('0x15a')]));this['channel']['noop'](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));return{'code':0xc8,'result':_0x31af('0x15e')};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x31af('0x10')]['callerid'],_0xa40daa['findBy']));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices['prototype'][_0x31af('0x161')]=function(_0x37561d){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x162'),_0x37561d[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x37561d[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0x37561d,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format'](_0x31af('0x15c'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));var _0x41d55b=this['agentLogout'][_0x31af('0x75')](this,_0x37561d[_0x31af('0x15a')]);if(_0x41d55b){logger[_0x31af('0x35')](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x37561d['findBy']));return{'code':0xc8,'result':_0x31af('0x15e')};}else{logger[_0x31af('0x35')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices[_0x31af('0x13')][_0x31af('0x163')]=function(_0x5a9dfe){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5a9dfe[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x5a9dfe[_0x31af('0x164')])){return this[_0x31af('0x10')]['error'](_0x5a9dfe,_0x31af('0x165'));}this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x166'),_0x5a9dfe[_0x31af('0x164')]));var _0xb7714=eval(_0x5a9dfe[_0x31af('0x164')]);if(!this[_0x31af('0x89')](_0x5a9dfe[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}var _0x1384bd=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x5a9dfe[_0x31af('0xde')]);if(!_0x1384bd){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5a9dfe,_0x31af('0x120'));}if(_[_0x31af('0xa5')](_0xb7714)){var _0x5a7a9d=this;_0xb7714['forEach'](function(_0x2e7b87,_0xbc511b){_0x5a7a9d[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x167'),_0x1384bd,_0xbc511b),_0x2e7b87);});return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x168'),_0x1384bd));}else{return this[_0x31af('0x10')][_0x31af('0xa6')](_0x1384bd,_0xb7714);}};AGIVertices[_0x31af('0x13')][_0x31af('0x169')]=function(_0x3fecbf){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16a'),_0x3fecbf['label']));if(_0x3fecbf[_0x31af('0x118')]===0x0){return this[_0x31af('0xac')](_0x3fecbf);}_0x3fecbf['retry']-=0x1;if(!this[_0x31af('0x89')](_0x3fecbf[_0x31af('0x119')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x3fecbf,_0x31af('0x11a'));}var _0x3d50ef=this[_0x31af('0x23')]['sync'](this,_0x3fecbf['file_id']);if(!_0x3d50ef){return this[_0x31af('0x10')]['error'](_0x3fecbf,_0x31af('0x11b'));}var _0x34c65f=this[_0x31af('0x10')][_0x31af('0x11c')](_0x3d50ef,_0x3fecbf['response'],_0x3fecbf[_0x31af('0x16b')]);var _0x46fd42=_0x34c65f['result'];if(_0x34c65f[_0x31af('0xaa')]===-0x1){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x3fecbf,'-1');return _0x34c65f;}else if(_0x34c65f['extra']===_0x31af('0xbf')){_0x34c65f[_0x31af('0xaa')]=_0x34c65f['result'][_0x31af('0xa2')]>0x0?_0x34c65f['result']:'t';}else if(_[_0x31af('0x49')](_0x34c65f[_0x31af('0xaa')])){_0x34c65f[_0x31af('0xaa')]='#';_0x46fd42='#';}if(!this[_0x31af('0x89')](_0x3fecbf[_0x31af('0xde')])){this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}else{var _0x4b457e=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x3fecbf[_0x31af('0xde')]);if(!_0x4b457e){return this[_0x31af('0x10')]['error'](_0x3fecbf,_0x31af('0x120'));}this[_0x31af('0x10')]['setVariable'](_0x4b457e,_0x46fd42);}this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x3fecbf,_0x46fd42);return _0x34c65f;};AGIVertices[_0x31af('0x13')][_0x31af('0xae')]=function(_0x256514){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16c'),_0x256514[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0xae')](_0x256514[_0x31af('0x16d')]||_0x256514['label']);};AGIVertices[_0x31af('0x13')][_0x31af('0x16e')]=function(_0x4a69ce){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16f'),_0x4a69ce[_0x31af('0x3e')]));if(!this['isConfigured'](_0x4a69ce[_0x31af('0x15a')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x4a69ce,_0x31af('0x15b'));}logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15c'),this[_0x31af('0x10')]['callerid'],_0x4a69ce[_0x31af('0x15a')]));var _0x3db92e=this[_0x31af('0x54')][_0x31af('0x75')](this,_0x4a69ce[_0x31af('0x170')]);var _0x2b48d0=this['agentPause'][_0x31af('0x75')](this,_0x4a69ce[_0x31af('0x15a')],_0x3db92e);if(_0x2b48d0){logger[_0x31af('0x35')](util['format'](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')]['callerid'],_0x4a69ce[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices[_0x31af('0x13')]['playback']=function(_0x877523){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x877523[_0x31af('0x3e')]));if(!this['isConfigured'](_0x877523[_0x31af('0x119')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x877523,_0x31af('0x11a'));}var _0xed11e7=this['getSound'][_0x31af('0x75')](this,_0x877523[_0x31af('0x119')]);if(!_0xed11e7){return this[_0x31af('0x10')]['error'](_0x877523,_0x31af('0x11b'));}var _0x4902ed=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0x171'),[_0xed11e7,_0x877523[_0x31af('0xec')]]);if(_0x4902ed[_0x31af('0xaa')]===-0x1){return _0x4902ed;}return this['channel'][_0x31af('0xae')](util['format'](_0x31af('0x172'),'PLAYBACK',_0xed11e7));};AGIVertices[_0x31af('0x13')][_0x31af('0x173')]=function(_0x291870){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x291870['label']));if(!this[_0x31af('0x89')](_0x291870[_0x31af('0x174')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x291870,_0x31af('0x175'));}var _0x5508d1='';var _0x20a0b0=parseInt(_0x291870[_0x31af('0x174')],0xa);if(isNaN(_0x20a0b0)){_0x5508d1=_0x291870[_0x31af('0x174')];}else{_0x5508d1=this['getVoiceQueue'][_0x31af('0x75')](this,_0x291870[_0x31af('0x174')]);if(!_0x5508d1){return this[_0x31af('0x10')][_0x31af('0x33')](_0x291870,'no\x20queue\x20found');}}var _0x5ba987='';if(this[_0x31af('0x89')](_0x291870[_0x31af('0x119')])){var _0x5e2cdb=this['getSound'][_0x31af('0x75')](this,_0x291870[_0x31af('0x119')]);if(_0x5e2cdb){_0x5ba987=_0x5e2cdb;}}this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x291870,_0x5508d1);if(_0x291870[_0x31af('0xec')][_0x31af('0x176')]('x')<0x0){_0x291870[_0x31af('0xec')]+='x';}if(_0x291870['opts'][_0x31af('0x176')]('X')<0x0){_0x291870[_0x31af('0xec')]+='X';}this[_0x31af('0x10')][_0x31af('0xa6')](_0x31af('0x177'),_0x5508d1?_0x5508d1['toLowerCase']():'');var _0x22cffd=this['channel'][_0x31af('0x5c')](_0x31af('0x178'),[_0x5508d1,_0x291870[_0x31af('0xec')],_0x291870[_0x31af('0x69')],_0x5ba987,_0x291870[_0x31af('0xbf')],_0x291870[_0x31af('0x9')],_0x291870['macro'],_0x291870[_0x31af('0x179')],'',_0x291870[_0x31af('0x17a')]]);if(_0x22cffd[_0x31af('0xaa')]===-0x1){return _0x22cffd;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20%s\x20%s',_0x31af('0x178'),_0x5508d1));};AGIVertices[_0x31af('0x13')][_0x31af('0x17b')]=function(_0x3d261e){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x17c'),_0x3d261e[_0x31af('0x3e')]));var _0x5ab585=_0x3d261e['recordingFormat']||'wav';var _0x53ba59=util[_0x31af('0x30')](_0x31af('0x17d'),this[_0x31af('0x10')]['uniqueid'],rs['generate'](0x5));var _0x2a8d6b=util[_0x31af('0x30')](_0x31af('0x17e'),FILES_PATH,_0x53ba59,_0x5ab585);var _0x2842b3=util[_0x31af('0x30')]('%s/recordings/%s',FILES_PATH,_0x53ba59);this[_0x31af('0x41')][_0x31af('0x75')](this,_0x3d261e,_0x53ba59,_0x2a8d6b);this['channel'][_0x31af('0xa6')](_0x31af('0x17f'),_0x53ba59);logger[_0x31af('0x35')](_0x31af('0x180'),_0x2842b3,_0x5ab585,_0x3d261e[_0x31af('0x181')],_0x3d261e['timeout']);return this[_0x31af('0x10')][_0x31af('0x138')](_0x2842b3,_0x5ab585,_0x3d261e[_0x31af('0x181')],_0x3d261e[_0x31af('0xbf')],undefined,!![]);};AGIVertices[_0x31af('0x13')][_0x31af('0x182')]=function(_0x163f46){logger[_0x31af('0x35')](util['format'](_0x31af('0x183'),_0x163f46['label']));if(!this[_0x31af('0x89')](_0x163f46[_0x31af('0x69')])){return this['channel'][_0x31af('0xae')](_0x31af('0x184'));}var _0x112b0a=this[_0x31af('0x185')]['sync'](this,_0x163f46);logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x186'),util[_0x31af('0x187')](_0x112b0a,{'showHidden':![],'depth':null})));if(!this[_0x31af('0x89')](_0x163f46[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x188'));}var _0x3b39bf=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x163f46[_0x31af('0xde')]);if(!_0x3b39bf){return this[_0x31af('0x10')][_0x31af('0x33')](_0x163f46,_0x31af('0x120'));}this[_0x31af('0x10')]['setVariable'](util[_0x31af('0x30')](_0x31af('0x189'),_0x3b39bf),_0x112b0a[_0x31af('0x78')]?_0x112b0a[_0x31af('0x78')]:_0x31af('0x18a'));this['channel'][_0x31af('0xa6')](util['format']('%s_STATUS_MESSAGE',_0x3b39bf),_0x112b0a['statusMessage']?_0x112b0a['statusMessage']:'OK');if(_0x112b0a[_0x31af('0x6f')]){try{this[_0x31af('0xa3')](_0x112b0a['body'],_0x3b39bf);}catch(_0x134c24){logger[_0x31af('0x33')](util[_0x31af('0x30')](_0x31af('0x18b'),_0x3b39bf));}}return this['channel']['noop'](util[_0x31af('0x30')](_0x31af('0xe4'),_0x3b39bf));};AGIVertices[_0x31af('0x13')]['saydigits']=function(_0x1b6d93){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1b6d93[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x18c')](_0x1b6d93[_0x31af('0x18d')]['replace'](/\s+/g,''),_0x1b6d93[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x18e')]=function(_0x31d152){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x31d152[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x18f')](_0x31d152['number'][_0x31af('0x5e')](/\s+/g,''),_0x31d152[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x190')]=function(_0x49d166){logger['info'](util[_0x31af('0x30')](_0x31af('0x191'),_0x49d166['label']));return this[_0x31af('0x10')][_0x31af('0x192')](_0x49d166[_0x31af('0x61')],_0x49d166[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x193')]=function(_0xf76463){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x194'),_0xf76463[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xf76463[_0x31af('0x195')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x196'));}var _0x15cf7a=this[_0x31af('0x26')][_0x31af('0x75')](this,_0xf76463['account_id']);if(!_0x15cf7a||!_0x15cf7a[_0x31af('0x197')]){return this[_0x31af('0x10')][_0x31af('0x33')](_0xf76463,_0x31af('0x198'));}var _0x2ffa72={'from':util[_0x31af('0x30')](_0x31af('0x199'),_0x15cf7a['name'],_0x15cf7a[_0x31af('0x19a')]||_0x15cf7a[_0x31af('0x197')][_0x31af('0x19b')]),'to':_0xf76463['to']||'','cc':_0xf76463['cc']||'','bcc':_0xf76463[_0x31af('0x19c')]||'','subject':_0xf76463[_0x31af('0x19d')],'html':_0xf76463[_0x31af('0x61')],'text':_0xf76463[_0x31af('0x61')]};if(this[_0x31af('0x89')](_0xf76463[_0x31af('0x19e')])){}logger[_0x31af('0xe6')](_0x31af('0x19f'),JSON['stringify'](_0x2ffa72));this[_0x31af('0x3c')]['sync'](this,_0xf76463,_0xf76463[_0x31af('0x195')]);this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x1a0'),_0x15cf7a[_0x31af('0x17')]));this[_0x31af('0x28')][_0x31af('0x75')](this,_0x15cf7a[_0x31af('0x1a1')],_0x2ffa72);return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x1a2'));};AGIVertices[_0x31af('0x13')]['sendFax']=function(_0x4156ba){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x1a3'),_0x4156ba[_0x31af('0x3e')]));return this[_0x31af('0x10')]['noop'](_0x31af('0x1a4'));};AGIVertices['prototype']['sendSMS']=function(_0x38f1b0){logger['info'](util['format'](_0x31af('0x1a5'),_0x38f1b0[_0x31af('0x3e')]));if(!this['isConfigured'](_0x38f1b0['sms_account_id'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20sms\x20account\x20configured');}var _0x37ccbb=this[_0x31af('0x1a6')]['sync'](this,_0x38f1b0[_0x31af('0x1a7')]);if(!_0x37ccbb){return this['channel'][_0x31af('0x33')](_0x38f1b0,_0x31af('0x1a8'));}var _0x241971={'body':_0x38f1b0[_0x31af('0x1a9')],'phone':_0x38f1b0['to']||'','SmsAccountId':_0x37ccbb['id']};logger[_0x31af('0xe6')](_0x31af('0x1aa'),JSON['stringify'](_0x241971));this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x38f1b0,_0x38f1b0[_0x31af('0x1a7')]);this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1ab'),_0x37ccbb[_0x31af('0x17')]));this['createSmsMessage'][_0x31af('0x75')](this,_0x241971);return this[_0x31af('0x10')]['noop'](_0x31af('0x1ac'));};AGIVertices[_0x31af('0x13')][_0x31af('0x1ad')]=function(_0x49d9f2){logger[_0x31af('0x35')](util['format'](_0x31af('0x1ae'),_0x49d9f2['label']));if(!this[_0x31af('0x89')](_0x49d9f2[_0x31af('0xde')])){return this[_0x31af('0x10')]['error'](_0x49d9f2,_0x31af('0x1af'));}var _0x3fa16b=this['getVariable'][_0x31af('0x75')](this,_0x49d9f2[_0x31af('0xde')]);if(!_0x3fa16b){return this[_0x31af('0x10')][_0x31af('0x33')](_0x49d9f2,_0x31af('0x120'));}return this[_0x31af('0x10')][_0x31af('0xa6')](_0x3fa16b,_0x49d9f2[_0x31af('0x1b0')]);};AGIVertices[_0x31af('0x13')]['start']=function(_0x40184a){logger[_0x31af('0x35')](util['format'](_0x31af('0x1b1'),_0x40184a[_0x31af('0x3e')]));this['channel'][_0x31af('0xae')]('START\x20CALLY\x20SQUARE');var _0x2b95b0=this['channel'][_0x31af('0x14')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x2b95b0['extra'])){this[_0x31af('0x10')][_0x31af('0x3d')]=_0x2b95b0[_0x31af('0xa9')];}if(_0x40184a[_0x31af('0xbd')]===_0x31af('0x1b2')){this[_0x31af('0x10')][_0x31af('0xae')]('Answer');return this[_0x31af('0x10')][_0x31af('0xbd')]();}return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x1b3'));};AGIVertices[_0x31af('0x13')]['subproject']=function(_0x427f3a){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x427f3a[_0x31af('0x3e')]));if(!this['isConfigured'](_0x427f3a[_0x31af('0x1b4')])){return this['channel'][_0x31af('0x33')](_0x427f3a,_0x31af('0x1b5'));}var _0x17d8ab=this['getSquareProject'][_0x31af('0x75')](this,_0x427f3a[_0x31af('0x1b4')]);if(!this[_0x31af('0x89')](_0x17d8ab)){return this[_0x31af('0x10')][_0x31af('0x33')](_0x427f3a,util[_0x31af('0x30')](_0x31af('0x1b6'),_0x427f3a[_0x31af('0x1b4')]));}if(_0x17d8ab===this[_0x31af('0x10')][_0x31af('0x3f')]){return this[_0x31af('0x10')][_0x31af('0x33')](_0x427f3a,_0x31af('0x1b7'));}this['createSquareDetailsReport'][_0x31af('0x75')](this,_0x427f3a,_0x17d8ab);var _0x49885a=this[_0x31af('0x10')]['exec'](_0x31af('0x1b8'),util[_0x31af('0x30')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x31af('0x9')][_0x31af('0x1b9')]||_0x31af('0x1ba'),_0x17d8ab,this['channel'][_0x31af('0x3f')]));if(_0x49885a[_0x31af('0xaa')]===-0x1){return _0x49885a;}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x172'),_0x31af('0x1b8'),_0x17d8ab));};AGIVertices['prototype'][_0x31af('0x1bb')]=function(_0xf8a9de){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xf8a9de[_0x31af('0x3e')]));var _0x529d7e=this[_0x31af('0x5b')][_0x31af('0x75')](this,_0xf8a9de[_0x31af('0xbc')]);this['createSquareDetailsReport'][_0x31af('0x75')](this,_0xf8a9de,_0xf8a9de[_0x31af('0xbc')]);if(this[_0x31af('0x89')](_0xf8a9de[_0x31af('0xde')])){var _0x31d449=this[_0x31af('0x14')][_0x31af('0x75')](this,_0xf8a9de[_0x31af('0xde')]);if(_0x31d449){this[_0x31af('0x10')][_0x31af('0xa6')](_0x31d449,_0x529d7e);return this['channel'][_0x31af('0xae')](util['format'](_0x31af('0x1bc'),_0xf8a9de[_0x31af('0xbc')],_0x31d449));}}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xf8a9de[_0x31af('0xbc')]));};AGIVertices[_0x31af('0x13')][_0x31af('0x1bd')]=function(_0x3dc988){logger[_0x31af('0x35')](util['format'](_0x31af('0x1be'),_0x3dc988[_0x31af('0x3e')]));_0x3dc988['text']=_0x3dc988[_0x31af('0x61')][_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3dc988[_0x31af('0x60')])){return this[_0x31af('0x10')]['noop'](_0x31af('0x1bf'));}if(!this[_0x31af('0x89')](_0x3dc988[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c0'),_0x3dc988['text']));var _0x549ce0=this[_0x31af('0x5f')][_0x31af('0x75')](this,_0x3dc988);if(_0x549ce0){this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x549ce0));var _0x3e9d1c=this[_0x31af('0x10')][_0x31af('0x109')](_0x549ce0);try{fs[_0x31af('0x10a')](_0x549ce0+'.wav');}catch(_0xa26e2b){logger[_0x31af('0x33')](_0xa26e2b);}return _0x3e9d1c;}return this['channel'][_0x31af('0x33')](_0x3dc988,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')][_0x31af('0x1c1')]=function(_0x18e19b){logger['info'](util[_0x31af('0x30')](_0x31af('0x1c2'),_0x18e19b[_0x31af('0x3e')]));_0x18e19b[_0x31af('0x61')]=_0x18e19b[_0x31af('0x61')][_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x31af('0x89')](_0x18e19b[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20text\x20configured');}this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c3'),_0x18e19b[_0x31af('0x61')]));var _0x2e11ba=this['googleTTS'][_0x31af('0x75')](this,_0x18e19b);if(_0x2e11ba){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c4'),_0x2e11ba));var _0x133e7c=this[_0x31af('0x10')][_0x31af('0x109')](_0x2e11ba);try{fs['unlink'](_0x2e11ba+'.wav');}catch(_0x36bf8d){logger[_0x31af('0x33')](_0x36bf8d);}return _0x133e7c;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x18e19b,_0x31af('0x1c5'));};AGIVertices[_0x31af('0x13')][_0x31af('0x1c6')]=function(_0x351aa2){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x351aa2['label']));if(!this[_0x31af('0x89')](_0x351aa2[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0x351aa2,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2[_0x31af('0x15a')]));var _0x14bfb9=this[_0x31af('0x1c7')]['sync'](this,_0x351aa2[_0x31af('0x15a')]);if(_0x14bfb9){logger[_0x31af('0x35')](util[_0x31af('0x30')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x31af('0x10')]['callerid'],_0x351aa2['findBy']));this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2[_0x31af('0x15a')]));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')]['callerid'],_0x351aa2['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices['prototype'][_0x31af('0x1c8')]=function(_0x229aab){logger['info'](util['format'](_0x31af('0x1c9'),_0x229aab[_0x31af('0x3e')]));var _0x1f467d=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0x1ca'),[_0x229aab[_0x31af('0x1cb')],_0x229aab[_0x31af('0x7b')]]);if(_0x1f467d[_0x31af('0xaa')]===-0x1){return _0x1f467d;}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x172'),_0x31af('0x1ca'),_0x229aab['mailbox']));};AGIVertices[_0x31af('0x13')][_0x31af('0x1cc')]=function(_0x541be3){logger[_0x31af('0x35')](util['format'](_0x31af('0x1cd'),_0x541be3[_0x31af('0x3e')]));if(!this['isConfigured'](_0x541be3['variable_id'])){return this['channel'][_0x31af('0x33')](_0x541be3,'no\x20variable\x20selected');}var _0x23bf0d=this['getVariable']['sync'](this,_0x541be3[_0x31af('0xde')]);if(!_0x23bf0d){return this['channel'][_0x31af('0x33')](_0x541be3,'no\x20variable\x20found');}var _0x1a6c97=this['channel'][_0x31af('0x14')](_0x23bf0d);return{'code':0xc8,'result':_0x1a6c97[_0x31af('0xa9')]?_0x1a6c97[_0x31af('0xa9')]:'-'};};String['prototype'][_0x31af('0xa8')]=function(_0xf8daa4,_0xd25d4d){return this[_0x31af('0xa7')](_0xf8daa4)['join'](_0xd25d4d);};module[_0x31af('0x1ce')]=AGIVertices; \ No newline at end of file +var _0x4944=['failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','util','shelljs','odbc','randomstring','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareOdbc','dsn','getUser','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','callback_','isEmpty','lastName','isNil','phone','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','apiKey','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','text','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','isString','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','replaceObjectAllVariables','replaceAllVariables','replaceAll','getVariable','extra','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','scheduledAt','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','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','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','getSound','file_id','no\x20variable\x20selected\x20for\x20the\x20result','response','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY'];(function(_0x5cdc6,_0x27c3db){var _0x57ac87=function(_0x4ade62){while(--_0x4ade62){_0x5cdc6['push'](_0x5cdc6['shift']());}};_0x57ac87(++_0x27c3db);}(_0x4944,0x6d));var _0x4494=function(_0x1b0770,_0x5e0ac2){_0x1b0770=_0x1b0770-0x0;var _0x12602c=_0x4944[_0x1b0770];return _0x12602c;};'use strict';var fs=require('fs');var util=require(_0x4494('0x0'));var _=require('lodash');var sh=require(_0x4494('0x1'));var odbc=require(_0x4494('0x2'))();var rs=require(_0x4494('0x3'));var moment=require(_0x4494('0x4'));var Mustache=require(_0x4494('0x5'));var rp=require('request-promise');var logger=require(_0x4494('0x6'))('agi');var config=require(_0x4494('0x7'));var scripts=require(_0x4494('0x8'));var FILES_PATH=_0x4494('0x9');var recursiveMapAttributes=[_0x4494('0xa'),_0x4494('0xb')];var verticesWithRetry=[_0x4494('0xc'),_0x4494('0xd'),_0x4494('0xe')];var AGIVertices=function(_0x21098c,_0x5b14d5,_0x1b6476){this[_0x4494('0xf')]=_0x21098c;this[_0x4494('0x10')]=_0x5b14d5;this[_0x4494('0x11')]=_0x1b6476;};AGIVertices['prototype']['getVariable']=function(_0x461714,_0x3b1a11){this[_0x4494('0x10')]['getVariableById'](_0x461714)['then'](function(_0x3108b2){_0x3b1a11(null,_0x3108b2?_0x3108b2[_0x4494('0x12')]:![]);})[_0x4494('0x13')](function(_0x1c9750){_0x3b1a11(_0x1c9750);});};AGIVertices[_0x4494('0x14')][_0x4494('0x15')]=function(_0x50b102,_0x34959d){this[_0x4494('0x10')][_0x4494('0x16')](_0x50b102)[_0x4494('0x17')](function(_0x9e92d0){_0x34959d(null,_0x9e92d0?_0x9e92d0[_0x4494('0x12')]:![]);})[_0x4494('0x13')](function(_0x53fed5){_0x34959d(_0x53fed5);});};AGIVertices[_0x4494('0x14')]['getSquareProject']=function(_0x5570a4,_0x1a93bc){this[_0x4494('0x10')]['getSquareProjectById'](_0x5570a4)['then'](function(_0xcbe5a4){_0x1a93bc(null,_0xcbe5a4?_0xcbe5a4['name']:![]);})[_0x4494('0x13')](function(_0x42880b){_0x1a93bc(_0x42880b);});};AGIVertices['prototype'][_0x4494('0x18')]=function(_0x5e5806,_0x37d435){this[_0x4494('0x10')]['getSquareOdbcById'](_0x5e5806)['then'](function(_0x434e43){_0x37d435(null,_0x434e43?_0x434e43[_0x4494('0x19')]:![]);})[_0x4494('0x13')](function(_0x15d9d1){_0x37d435(_0x15d9d1);});};AGIVertices[_0x4494('0x14')][_0x4494('0x1a')]=function(_0x2c1b76,_0xae958d){this['rpc']['getUserById'](_0x2c1b76)['then'](function(_0x4d80c5){_0xae958d(null,_0x4d80c5?_0x4d80c5[_0x4494('0x12')]:![]);})[_0x4494('0x13')](function(_0x1b3630){_0xae958d(_0x1b3630);});};AGIVertices[_0x4494('0x14')]['getTrunk']=function(_0x10f7fe,_0xdd08b8){this['rpc'][_0x4494('0x1b')](_0x10f7fe)[_0x4494('0x17')](function(_0x87d98){_0xdd08b8(null,_0x87d98?_0x87d98['name']:![]);})[_0x4494('0x13')](function(_0x5926fc){_0xdd08b8(_0x5926fc);});};AGIVertices[_0x4494('0x14')]['getSound']=function(_0x29e625,_0x2fcc43){var _0xce3c8d=this;this['rpc'][_0x4494('0x1c')](_0x29e625)[_0x4494('0x17')](function(_0x491027){_0x2fcc43(null,_0x491027?_0xce3c8d[_0x4494('0x1d')](_0x491027[_0x4494('0x1e')]):![]);})[_0x4494('0x13')](function(_0x57c34f){_0x2fcc43(_0x57c34f);});};AGIVertices[_0x4494('0x14')][_0x4494('0x1f')]=function(_0x1273d7,_0x19f483){this[_0x4494('0x10')][_0x4494('0x20')](_0x1273d7)[_0x4494('0x17')](function(_0xcce4da){_0x19f483(null,_0xcce4da?_0xcce4da:![]);})['catch'](function(_0x1d47f6){_0x19f483(_0x1d47f6);});};AGIVertices[_0x4494('0x14')][_0x4494('0x21')]=function(_0x5d90e0,_0x209fe8,_0x1c93f0){this[_0x4494('0x11')][_0x4494('0x21')](_0x5d90e0,_0x209fe8)[_0x4494('0x17')](function(){_0x1c93f0(null);})[_0x4494('0x13')](function(_0x279631){_0x1c93f0(_0x279631);});};AGIVertices['prototype'][_0x4494('0x22')]=function(_0x1c6ff8,_0x2f4740){this[_0x4494('0x10')][_0x4494('0x23')](_0x1c6ff8)[_0x4494('0x17')](function(_0x5bba31){if(_0x5bba31){if(_0x5bba31[_0x4494('0x24')]){_0x2f4740(null,[_0x5bba31[_0x4494('0x25')]]);}else{_0x2f4740(null,_[_0x4494('0x26')](_0x5bba31[_0x4494('0x27')],_0x4494('0x25')));}}else{_0x2f4740(null,![]);}})['catch'](function(_0x11f55d){_0x2f4740(_0x11f55d);});};AGIVertices[_0x4494('0x14')]['getSoundPath']=function(_0x3660ea){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x3660ea);};AGIVertices['prototype'][_0x4494('0x28')]=function(_0x250a0b,_0x322748,_0x546133){odbc['open'](_0x250a0b,function(_0x28480a){if(_0x28480a){logger[_0x4494('0x29')](_0x4494('0x2a'),_0x28480a);_0x546133(_0x28480a);}else{logger[_0x4494('0x2b')](_0x4494('0x2c'));odbc[_0x4494('0x2d')](_0x322748,function(_0x9c1605,_0x45e88f){if(_0x9c1605){logger[_0x4494('0x2b')](_0x4494('0x2e'),_0x322748);_0x546133(_0x9c1605);}else{logger[_0x4494('0x2b')](_0x4494('0x2f'),_0x322748);odbc[_0x4494('0x30')](function(_0x4a8dc1){if(_0x4a8dc1){logger[_0x4494('0x29')](_0x4494('0x31'),_0x4a8dc1);}_0x546133(null,_0x45e88f);});}});}});};AGIVertices[_0x4494('0x14')][_0x4494('0x32')]=function(_0x20b267,_0x3cd671){this[_0x4494('0x10')][_0x4494('0x33')](_0x20b267)[_0x4494('0x17')](function(_0x47f55c){_0x3cd671(null,_0x47f55c?_0x47f55c:![]);})['catch'](function(_0x1620f6){_0x3cd671(_0x1620f6);});};AGIVertices['prototype'][_0x4494('0x34')]=function(_0x2df148,_0x28cb6c){this[_0x4494('0x10')][_0x4494('0x34')](_0x2df148)['then'](function(_0x4e9bac){_0x28cb6c(null,_0x4e9bac);})[_0x4494('0x13')](function(_0x579bb8){_0x28cb6c(_0x579bb8);});};AGIVertices[_0x4494('0x14')][_0x4494('0x35')]=function(_0x124d0a,_0x2d10f4,_0x2dd0e9){this[_0x4494('0x10')][_0x4494('0x35')]({'uniqueid':this['channel'][_0x4494('0x36')],'node':_0x124d0a[_0x4494('0x37')],'application':_0x124d0a['agicommand'],'data':_0x2d10f4||null,'project_name':this[_0x4494('0xf')][_0x4494('0x38')],'callerid':this[_0x4494('0xf')]['callerid']})[_0x4494('0x17')](function(_0x3f19b9){if(_0x2dd0e9){_0x2dd0e9(null,_0x3f19b9);}})[_0x4494('0x13')](function(_0x465f5e){if(_0x2dd0e9){_0x2dd0e9(_0x465f5e);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x392d96,_0x3b9995,_0xa057a3,_0x4c755d){this['rpc'][_0x4494('0x39')]({'uniqueid':this[_0x4494('0xf')][_0x4494('0x36')],'callerid':this['channel'][_0x4494('0x3a')],'calleridname':this[_0x4494('0xf')]['calleridname'],'context':this[_0x4494('0xf')][_0x4494('0x3b')],'extension':this[_0x4494('0xf')][_0x4494('0x3c')],'priority':this[_0x4494('0xf')]['priority'],'accountcode':this[_0x4494('0xf')][_0x4494('0x3d')],'dnid':this[_0x4494('0xf')][_0x4494('0x3e')],'projectName':this[_0x4494('0xf')][_0x4494('0x38')],'saveName':_0x3b9995,'filename':_0x392d96[_0x4494('0x3f')]||_0x3b9995,'savePath':_0xa057a3})[_0x4494('0x17')](function(_0x102010){_0x4c755d(null,_0x102010);})[_0x4494('0x13')](function(_0x4a2d84){_0x4c755d(_0x4a2d84);});};AGIVertices[_0x4494('0x14')]['createSquareMessage']=function(_0x1227e4,_0x3d90bc,_0x702ab7,_0x35071a,_0x473b00){this['rpc'][_0x4494('0x40')]({'uniqueid':this['channel']['uniqueid'],'body':_0x1227e4,'direction':_0x3d90bc,'providerName':_0x702ab7,'providerResponse':_0x35071a})['then'](function(_0x5bcbfb){if(_0x473b00){_0x473b00(null,_0x5bcbfb);}})['catch'](function(_0x2d3ec9){if(_0x473b00){_0x473b00(_0x2d3ec9);}});};AGIVertices[_0x4494('0x14')][_0x4494('0x41')]=function(_0x3ffea6,_0x1b76a4){this[_0x4494('0x10')][_0x4494('0x41')]({'firstName':_['isEmpty'](_0x3ffea6['name'])||_['isNil'](_0x3ffea6[_0x4494('0x12')])?_0x4494('0x42')+Math['random']():_0x3ffea6[_0x4494('0x12')],'lastName':_[_0x4494('0x43')](_0x3ffea6[_0x4494('0x44')])||_[_0x4494('0x45')](_0x3ffea6[_0x4494('0x44')])?null:_0x3ffea6['lastName'],'phone':_0x3ffea6[_0x4494('0x46')],'ListId':_0x3ffea6['list_id'],'scheduledat':_0x3ffea6['scheduledAt'],'callbackUniqueid':this[_0x4494('0xf')]['uniqueid'],'tags':_0x4494('0x47'),'description':_0x4494('0x48')+_0x3ffea6['scheduledAt']['toString'](),'priority':_0x3ffea6[_0x4494('0x49')]})[_0x4494('0x17')](function(_0xc32e50){_0x1b76a4(null,_0xc32e50);})['catch'](function(_0x2ea074){_0x1b76a4(_0x2ea074);});};AGIVertices[_0x4494('0x14')][_0x4494('0x4a')]=function(_0xfbb520,_0x282b45){this[_0x4494('0x10')]['getPauseById'](_0xfbb520)['then'](function(_0x5dc638){_0x282b45(null,_0x5dc638?_0x5dc638['name']:![]);})[_0x4494('0x13')](function(_0x3aff06){_0x282b45(_0x3aff06);});};AGIVertices[_0x4494('0x14')]['agentPause']=function(_0x4dd3af,_0x1e1ab4,_0x43bfba){var _0x4766dd={'role':_0x4494('0x4b')};_0x4766dd[_0x4dd3af]=this[_0x4494('0xf')][_0x4494('0x3a')];this[_0x4494('0x10')]['agentPause'](_0x4766dd,_0x1e1ab4,this[_0x4494('0xf')][_0x4494('0x36')])['then'](function(_0x414655){_0x43bfba(null,_[_0x4494('0x45')](_0x414655)?![]:!![]);})[_0x4494('0x13')](function(_0x470236){logger[_0x4494('0x29')](_0x470236);_0x43bfba(null,![]);});};AGIVertices[_0x4494('0x14')][_0x4494('0x4c')]=function(_0x43583a,_0x3a7d93){var _0x567269={'role':_0x4494('0x4b')};_0x567269[_0x43583a]=this['channel']['callerid'];this[_0x4494('0x10')][_0x4494('0x4c')](_0x567269)['then'](function(_0xc7e69a){_0x3a7d93(null,_[_0x4494('0x45')](_0xc7e69a)?![]:!![]);})[_0x4494('0x13')](function(_0x2a303a){logger[_0x4494('0x29')](_0x2a303a);_0x3a7d93(null,![]);});};AGIVertices['prototype'][_0x4494('0x4d')]=function(_0x266fdd,_0x33d976){var _0x299b8c={'role':_0x4494('0x4b')};_0x299b8c[_0x266fdd]=this[_0x4494('0xf')]['callerid'];this['rpc'][_0x4494('0x4d')](_0x299b8c)[_0x4494('0x17')](function(_0x3f62f4){_0x33d976(null,_[_0x4494('0x45')](_0x3f62f4)?![]:!![]);})[_0x4494('0x13')](function(_0x2f3e39){logger[_0x4494('0x29')](_0x2f3e39);_0x33d976(null,![]);});};AGIVertices[_0x4494('0x14')][_0x4494('0x4e')]=function(_0x11aba8,_0x508128){var _0x5562a3={'role':'agent'};_0x5562a3[_0x11aba8]=this[_0x4494('0xf')][_0x4494('0x3a')];var _0x5b7a0a=_0x11aba8!=_0x4494('0x4f')?util[_0x4494('0x50')](_0x4494('0x51'),_0x4494('0x52'),this[_0x4494('0xf')][_0x4494('0x3a')]):undefined;this[_0x4494('0x10')]['agentLogin'](_0x5562a3,_0x5b7a0a)[_0x4494('0x17')](function(_0x15a2c3){_0x508128(null,_[_0x4494('0x45')](_0x15a2c3)?![]:!![]);})[_0x4494('0x13')](function(_0x178f3e){logger[_0x4494('0x29')](_0x178f3e);_0x508128(null,![]);});};AGIVertices[_0x4494('0x14')][_0x4494('0x53')]=function(_0x51d709,_0xff46f3){sh['exec'](_['trim'](_0x51d709),function(_0x7654c6,_0x36714f){var _0x4c90e0=_0x36714f['replace'](/(\r\n|\n|\r)/gm,'');_0xff46f3(null,_0x4c90e0);});};AGIVertices[_0x4494('0x14')][_0x4494('0x54')]=function(_0x4f6387,_0x1a6c03){scripts[_0x4494('0x54')](_0x4f6387[_0x4494('0x55')],_0x4f6387['google_cloud_tts_text_type']||'text',_0x4f6387['text'],_0x4f6387[_0x4494('0x56')]||_0x4494('0x57'),_0x4f6387[_0x4494('0x58')]||_0x4494('0x59'),_0x4f6387[_0x4494('0x5a')]||'MP3')[_0x4494('0x17')](function(_0x5c1473){_0x1a6c03(null,_0x5c1473);})['catch'](function(_0x23cd7e){_0x1a6c03(_0x23cd7e);});};AGIVertices['prototype'][_0x4494('0x5b')]=function(_0x4c8b25,_0x5fc7d9){scripts['googleTTS'](_0x4c8b25['text'],_0x4c8b25['google_tts_language']||'en',0x1)['then'](function(_0x1be3af){_0x5fc7d9(null,_0x1be3af);})[_0x4494('0x13')](function(_0x161735){_0x5fc7d9(_0x161735);});};AGIVertices[_0x4494('0x14')][_0x4494('0x5c')]=function(_0x19daf1,_0x6131f6){var _0x46ec48={'uri':_0x19daf1[_0x4494('0x5d')],'method':_0x19daf1[_0x4494('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x19daf1['timeout'])==='number'&&parseInt(_0x19daf1['timeout'])>=0x1?parseInt(_0x19daf1[_0x4494('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0x4494('0x60')]([_0x4494('0x61'),'PUT'],_0x46ec48[_0x4494('0x5e')][_0x4494('0x62')]())){try{_0x46ec48[_0x4494('0x63')]=_0x19daf1[_0x4494('0xb')]?JSON[_0x4494('0x64')](_0x19daf1['rawBody']):{};}catch(_0x37d4f7){logger[_0x4494('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x37d4f7);}}try{_0x46ec48['headers']=_0x19daf1['rawHeaders']?JSON['parse'](_0x19daf1['rawHeaders']):{};}catch(_0x56594d){logger[_0x4494('0x29')](_0x4494('0x65'),_0x56594d);}if(_0x19daf1[_0x4494('0x66')]){try{var _0x25dc58=require(_0x19daf1[_0x4494('0x66')])[_0x4494('0x67')](this,_0x46ec48);_0x46ec48[_0x4494('0x68')]=Mustache['render'](_0x19daf1[_0x4494('0x5d')],_0x25dc58,{},['$$','$$']);if(_0x46ec48['headers']){_0x46ec48[_0x4494('0x69')]=JSON[_0x4494('0x64')](Mustache[_0x4494('0x6a')](JSON[_0x4494('0x6b')](_0x46ec48[_0x4494('0x69')]),_0x25dc58,{},['$$','$$']));}if(_0x46ec48['body']){_0x46ec48[_0x4494('0x63')]=JSON[_0x4494('0x64')](Mustache['render'](JSON['stringify'](_0x46ec48[_0x4494('0x63')]),_0x25dc58,{},['$$','$$']));}}catch(_0xe0e497){logger[_0x4494('0x29')](_0x4494('0x6c'),_0xe0e497);}}rp(_0x46ec48)[_0x4494('0x17')](function(_0xcc8382){var _0x3957ff={'statusCode':_0xcc8382[_0x4494('0x6d')]||0xc8,'statusMessage':_0xcc8382[_0x4494('0x6e')]||'OK','headers':_0xcc8382['headers']||{},'body':_0xcc8382[_0x4494('0x63')]||{}};_0x6131f6(null,_0x3957ff);})['catch'](function(_0x344817){var _0x9a945={'statusCode':_0x344817[_0x4494('0x6d')]||0x1f4,'statusMessage':_0x344817['message']||_0x4494('0x6f'),'headers':_0x344817['options'][_0x4494('0x69')]||{},'body':_0x344817[_0x4494('0x70')][_0x4494('0x63')]||{}};_0x6131f6(null,_0x9a945);});};AGIVertices[_0x4494('0x14')][_0x4494('0x71')]=function(_0x45b340,_0x4875ee){scripts[_0x4494('0x71')](this[_0x4494('0xf')]['uniqueid'],_0x45b340[_0x4494('0x72')],_0x45b340['text'],_0x45b340[_0x4494('0x73')]||'en')[_0x4494('0x17')](function(_0x33e790){_0x4875ee(null,_0x33e790);})[_0x4494('0x13')](function(_0x4ace35){_0x4875ee(_0x4ace35);});};AGIVertices[_0x4494('0x14')]['googleDialogflowV2']=function(_0x360c65,_0x1aa889){scripts[_0x4494('0x74')](this[_0x4494('0xf')][_0x4494('0x36')],_0x360c65['dialogflowV2_project_id'],_0x360c65['client_email'],_0x360c65[_0x4494('0x75')],_0x360c65[_0x4494('0x76')],_0x360c65['dialogflowV2_language']||'en')[_0x4494('0x17')](function(_0x29dfc3){_0x1aa889(null,_0x29dfc3);})[_0x4494('0x13')](function(_0x56fa0a){_0x1aa889(_0x56fa0a);});};AGIVertices[_0x4494('0x14')][_0x4494('0x77')]=function(_0x356ef6,_0x371cbd){scripts[_0x4494('0x77')](this['channel'],_0x356ef6)[_0x4494('0x17')](function(_0x47677d){_0x371cbd(null,_0x47677d);})[_0x4494('0x13')](function(_0x4a84e7){_0x371cbd(_0x4a84e7);});};AGIVertices['prototype'][_0x4494('0x78')]=function(_0x15c2d3,_0x2aa96c){scripts['ispeechTTS'](_0x15c2d3[_0x4494('0x72')],_0x15c2d3['text'],_0x15c2d3[_0x4494('0x79')]||_0x4494('0x57'),_0x15c2d3[_0x4494('0x7a')])[_0x4494('0x17')](function(_0x47547a){_0x2aa96c(null,_0x47547a);})[_0x4494('0x13')](function(_0x6aaf4c){_0x2aa96c(_0x6aaf4c);});};AGIVertices[_0x4494('0x14')][_0x4494('0x7b')]=function(_0xdf2114,_0x1083ea,_0x4f3b27){scripts[_0x4494('0x7b')](_0x1083ea,_0xdf2114[_0x4494('0x72')],_0xdf2114[_0x4494('0x7c')]||_0x4494('0x57'),this[_0x4494('0x7d')](_0xdf2114[_0x4494('0x7e')])?_0xdf2114[_0x4494('0x7e')]:undefined)[_0x4494('0x17')](function(_0x201cce){_0x4f3b27(null,_0x201cce);})['catch'](function(_0x5f589c){_0x4f3b27(_0x5f589c);});};AGIVertices[_0x4494('0x14')][_0x4494('0x7f')]=function(_0x1b5347,_0x32c5e7){scripts[_0x4494('0x7f')](_0x1b5347[_0x4494('0x80')],_0x1b5347[_0x4494('0x81')],_0x1b5347[_0x4494('0x82')],_0x1b5347[_0x4494('0x83')]||_0x4494('0x84'),_0x1b5347[_0x4494('0x76')],_0x1b5347[_0x4494('0x85')]||_0x4494('0x76'))[_0x4494('0x17')](function(_0x88cf8){_0x32c5e7(null,_0x88cf8);})[_0x4494('0x13')](function(_0x599c3e){_0x32c5e7(_0x599c3e);});};AGIVertices['prototype'][_0x4494('0x86')]=function(_0x219604,_0x471f5d){scripts['awsLex'](this[_0x4494('0xf')][_0x4494('0x36')],_0x219604['aws_access_key_id'],_0x219604[_0x4494('0x81')],_0x219604[_0x4494('0x87')],_0x219604[_0x4494('0x76')],_0x219604[_0x4494('0x88')])['then'](function(_0x31105a){_0x471f5d(null,_0x31105a);})[_0x4494('0x13')](function(_0x4fdaa6){_0x471f5d(_0x4fdaa6);});};AGIVertices[_0x4494('0x14')][_0x4494('0x89')]=function(_0x26ea75,_0x20dbdd,_0x56dc2b){scripts[_0x4494('0x89')](_0x20dbdd,_0x26ea75[_0x4494('0x72')],_0x26ea75[_0x4494('0x8a')]||_0x4494('0x57'))['then'](function(_0x80091b){_0x56dc2b(null,_0x80091b);})[_0x4494('0x13')](function(_0x19584b){_0x56dc2b(_0x19584b);});};AGIVertices[_0x4494('0x14')][_0x4494('0x8b')]=function(_0x3b8fed,_0x51c4c6,_0x2dfed2){scripts[_0x4494('0x8b')](_0x51c4c6,_0x3b8fed[_0x4494('0x8c')],_0x3b8fed[_0x4494('0x8d')],_0x3b8fed['uri'])[_0x4494('0x17')](function(_0x2dceeb){_0x2dfed2(null,_0x2dceeb);})[_0x4494('0x13')](function(_0x15baf1){_0x2dfed2(_0x15baf1);});};AGIVertices[_0x4494('0x14')][_0x4494('0x8e')]=function(_0x1b0f9d){var _0x4e6ab0=_[_0x4494('0x60')](verticesWithRetry,_0x1b0f9d['agicommand'])?_0x1b0f9d:_[_0x4494('0x8f')](_0x1b0f9d);for(var _0x5b073b in _0x4e6ab0){if(_0x4e6ab0['hasOwnProperty'](_0x5b073b)){if(_0x4e6ab0[_0x5b073b]&&_[_0x4494('0x90')](_0x4e6ab0[_0x5b073b])){if(_[_0x4494('0x60')](recursiveMapAttributes,_0x5b073b)){_0x4e6ab0[_0x5b073b]=this['replaceObjectAllVariables'](_0x4e6ab0[_0x5b073b]);}else{_0x4e6ab0[_0x5b073b]=this['replaceAllVariables'](_0x4e6ab0[_0x5b073b]);}}}}return _0x4e6ab0;};AGIVertices[_0x4494('0x14')][_0x4494('0x91')]=function(_0x6be397){for(var _0x4c5cee in _0x6be397){if(_0x6be397[_0x4494('0x92')](_0x4c5cee)){if(_[_0x4494('0x93')](_0x6be397[_0x4c5cee])){this[_0x4494('0x91')](_0x6be397[_0x4c5cee]);}else if(_[_0x4494('0x94')](_0x6be397[_0x4c5cee])){for(var _0xcfdb17=0x0;_0xcfdb17<_0x6be397[_0x4c5cee]['length'];_0xcfdb17++){this[_0x4494('0x91')](_0x6be397[_0x4c5cee][_0xcfdb17]);}}else if(_[_0x4494('0x90')](_0x6be397[_0x4c5cee])){_0x6be397[_0x4c5cee]=this['replaceAllVariables'](_0x6be397[_0x4c5cee]);}}}};AGIVertices[_0x4494('0x14')][_0x4494('0x95')]=function(_0x1d4b7f,_0x2abf92){for(var _0x189183 in _0x1d4b7f){if(_0x1d4b7f['hasOwnProperty'](_0x189183)){if(_[_0x4494('0x93')](_0x1d4b7f[_0x189183])){if(!_['isEmpty'](_0x1d4b7f[_0x189183])){this[_0x4494('0x95')](_0x1d4b7f[_0x189183],util[_0x4494('0x50')](_0x4494('0x96'),_0x2abf92,_0x189183));}}else if(_['isArray'](_0x1d4b7f[_0x189183])){for(var _0x4de911=0x0;_0x4de911<_0x1d4b7f[_0x189183][_0x4494('0x97')];_0x4de911++){this['saveRestApiResult'](_0x1d4b7f[_0x189183][_0x4de911],util[_0x4494('0x50')](_0x4494('0x96'),_0x2abf92,_0x189183+'['+_0x4de911+']'));}}else{if(!_['isNil'](_0x1d4b7f[_0x189183])){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('%s.%s',_0x2abf92,_0x189183),_0x1d4b7f[_0x189183]);}}}}};AGIVertices[_0x4494('0x14')][_0x4494('0x99')]=function(_0x302712){try{var _0x183bb2=JSON[_0x4494('0x64')](_0x302712);this['recursiveNodeIndex'](_0x183bb2);return JSON[_0x4494('0x6b')](_0x183bb2);}catch(_0x20b1b8){return this[_0x4494('0x9a')](_0x302712);}};AGIVertices[_0x4494('0x14')][_0x4494('0x9a')]=function(_0x5eb3da){var _0xa78aaf=_0x5eb3da['split']('{');for(var _0xb91080=0x1;_0xb91080<_0xa78aaf[_0x4494('0x97')];_0xb91080+=0x1){var _0x54d6a2=_0xa78aaf[_0xb91080]['split']('}');if(_0x54d6a2[_0x4494('0x97')]>0x1){_0x5eb3da=_0x5eb3da[_0x4494('0x9b')]('{'+_0x54d6a2[0x0]+'}',this['channel'][_0x4494('0x9c')](_0x54d6a2[0x0])[_0x4494('0x9d')]||_0x54d6a2[0x0]);}}if(_0xa78aaf[_0x4494('0x97')]===0x1){return _0x5eb3da[_0x4494('0x9e')]();}return this[_0x4494('0x9a')](_0x5eb3da);};AGIVertices[_0x4494('0x14')]['getAndSetVariable']=function(_0xab98b8,_0x3ccceb){var _0x1db7b8=this[_0x4494('0xf')][_0x4494('0x9c')](_0xab98b8);if(_0x1db7b8[_0x4494('0x9f')]===-0x1){return _0x1db7b8;}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xa0'),_0x3ccceb,_0x1db7b8[_0x4494('0x9d')]));return this['channel'][_0x4494('0x98')](_0x3ccceb,_0x1db7b8[_0x4494('0x9d')]);};AGIVertices[_0x4494('0x14')][_0x4494('0x7d')]=function(_0x14e312){return _0x14e312&&_0x14e312!=='0'&&_0x14e312!=='-1'&&_0x14e312!=='';};AGIVertices[_0x4494('0x14')][_0x4494('0xa1')]=function(_0x2348c7){this[_0x4494('0x35')]['sync'](this,_0x2348c7,'-');_0x2348c7['retry']=_0x2348c7[_0x4494('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4494('0x14')][_0x4494('0xa2')]=function(_0x53e6e4){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xa3'),_0x53e6e4[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x53e6e4['text'])){return this['channel'][_0x4494('0xa4')]('no\x20text\x20configured');}var _0x1db2a3='\x22'+_0x53e6e4['text']+'\x22';if(this[_0x4494('0x7d')](_0x53e6e4['options'])){_0x1db2a3+=','+_0x53e6e4[_0x4494('0x70')];}var _0x2575be=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xa6'),_0x1db2a3);if(_0x2575be['result']===-0x1){return _0x2575be;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xa7'),_0x1db2a3));};AGIVertices[_0x4494('0x14')][_0x4494('0xa8')]=function(_0x33d536){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x33d536[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x33d536[_0x4494('0xa9')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20grammar\x20configured');}var _0x2d0201=_0x33d536[_0x4494('0xa9')];if(this[_0x4494('0x7d')](_0x33d536[_0x4494('0x70')])){_0x2d0201+=','+_0x33d536[_0x4494('0x70')];}var _0x44a545=this[_0x4494('0xf')][_0x4494('0xa5')]('MRCPRecog',_0x2d0201);if(_0x44a545[_0x4494('0x9f')]===-0x1){return _0x44a545;}var _0x2a90fa=this['getAndSetVariable'](_0x4494('0xaa'),_0x4494('0xab'));if(_0x2a90fa[_0x4494('0x9f')]===-0x1){return _0x2a90fa;}var _0x59cc45=this[_0x4494('0xac')](_0x4494('0xad'),_0x4494('0xae'));if(_0x59cc45['result']===-0x1){return _0x59cc45;}var _0xb1acfb=this['getAndSetVariable'](_0x4494('0xaf'),_0x4494('0xb0'));if(_0xb1acfb[_0x4494('0x9f')]===-0x1){return _0xb1acfb;}return this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2d0201));};AGIVertices[_0x4494('0x14')]['agi']=function(_0x4455d0){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xb1'),_0x4455d0[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0xb2')]([_0x4455d0[_0x4494('0xb3')],_0x4455d0[_0x4494('0xb4')]]);};AGIVertices['prototype']['answer']=function(_0x2174c3){logger[_0x4494('0x2b')](util['format'](_0x4494('0xb5'),_0x2174c3['label']));if(this[_0x4494('0x7d')](_0x2174c3['timeout'])){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2174c3[_0x4494('0x5f')]));var _0x448773=this[_0x4494('0xf')][_0x4494('0xb6')](_0x2174c3['timeout']);if(_0x448773[_0x4494('0x9f')]===-0x1){return _0x448773;}}return this['channel'][_0x4494('0xb7')]();};AGIVertices[_0x4494('0x14')]['callback']=function(_0x6ee59f){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xb8'),_0x6ee59f[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x6ee59f[_0x4494('0xb9')])){return this[_0x4494('0xf')]['error'](_0x6ee59f,_0x4494('0xba'));}_0x6ee59f[_0x4494('0xbb')]=moment();if(this[_0x4494('0x7d')](_0x6ee59f[_0x4494('0xbc')])){_0x6ee59f['scheduledAt']=moment()[_0x4494('0xbd')](_0x6ee59f[_0x4494('0xbc')],_0x4494('0xbe'));}if(!this[_0x4494('0x7d')](_0x6ee59f[_0x4494('0x49')])){_0x6ee59f['callback_priority']=0x2;}this[_0x4494('0x41')][_0x4494('0x67')](this,_0x6ee59f);return this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0xbf'),_0x6ee59f['phone'],_0x6ee59f[_0x4494('0xb9')],_0x6ee59f[_0x4494('0xbb')]));};AGIVertices[_0x4494('0x14')][_0x4494('0xc0')]=function(_0x4ebbb7){logger[_0x4494('0x2b')](util['format'](_0x4494('0xc1'),_0x4ebbb7[_0x4494('0x37')]));var _0x5e833d=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4ebbb7[_0x4494('0xc2')],_0x4ebbb7['options']);if(_0x5e833d['result']===-0x1){return _0x5e833d;}return this[_0x4494('0xf')]['noop'](util['format'](_0x4494('0xc3'),_0x4ebbb7[_0x4494('0xc2')],_0x4ebbb7['options']));};AGIVertices[_0x4494('0x14')]['lumenvoxtts']=function(_0x1e2e43){logger[_0x4494('0x2b')](util['format'](_0x4494('0xc4'),_0x1e2e43[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x1e2e43[_0x4494('0x76')])){return this['channel'][_0x4494('0xa4')](_0x4494('0xc5'));}var _0x424d57='\x22'+_0x1e2e43[_0x4494('0x76')]+'\x22';if(this['isConfigured'](_0x1e2e43[_0x4494('0x70')])){_0x424d57+=','+_0x1e2e43[_0x4494('0x70')];}var _0x24e36e=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xa6'),_0x424d57);if(_0x24e36e[_0x4494('0x9f')]===-0x1){return _0x24e36e;}return this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0xa7'),_0x424d57));};AGIVertices[_0x4494('0x14')][_0x4494('0xc6')]=function(_0x562ce5){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x562ce5['label']));if(!this['isConfigured'](_0x562ce5[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}var _0x1f2558='\x22'+_0x562ce5[_0x4494('0x76')]+'\x22';if(this['isConfigured'](_0x562ce5['options'])){_0x1f2558+=','+_0x562ce5[_0x4494('0x70')];}var _0x23c1dd=this[_0x4494('0xf')][_0x4494('0xa5')]('MRCPSynth',_0x1f2558);if(_0x23c1dd[_0x4494('0x9f')]===-0x1){return _0x23c1dd;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1f2558));};AGIVertices[_0x4494('0x14')][_0x4494('0xc7')]=function(_0x466e98){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0xc8'),_0x466e98['label']));if(!this['isConfigured'](_0x466e98[_0x4494('0xa9')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc9'));}var _0x2251d8=_0x466e98[_0x4494('0xa9')];if(this[_0x4494('0x7d')](_0x466e98[_0x4494('0x70')])){_0x2251d8+=','+_0x466e98['options'];}var _0x33ee3a=this['channel'][_0x4494('0xa5')](_0x4494('0xca'),_0x2251d8);if(_0x33ee3a['result']===-0x1){return _0x33ee3a;}var _0x5b5001=this['getAndSetVariable'](_0x4494('0xaa'),_0x4494('0xcb'));if(_0x5b5001[_0x4494('0x9f')]===-0x1){return _0x5b5001;}var _0x4f8b34=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x4f8b34['result']===-0x1){return _0x4f8b34;}var _0x30ee59=this[_0x4494('0xac')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x30ee59['result']===-0x1){return _0x30ee59;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xcc'),_0x2251d8));};AGIVertices['prototype'][_0x4494('0xcd')]=function(_0x193268){logger['info'](util[_0x4494('0x50')](_0x4494('0xce'),_0x193268['label']));if(!this[_0x4494('0x7d')](_0x193268[_0x4494('0xa9')])){return this['channel'][_0x4494('0xa4')](_0x4494('0xc9'));}var _0x8430=_0x193268[_0x4494('0xa9')];if(this[_0x4494('0x7d')](_0x193268[_0x4494('0x70')])){_0x8430+=','+_0x193268[_0x4494('0x70')];}var _0xbb76b4=this[_0x4494('0xf')]['exec'](_0x4494('0xca'),_0x8430);if(_0xbb76b4[_0x4494('0x9f')]===-0x1){return _0xbb76b4;}var _0x23314a=this[_0x4494('0xac')]('RECOG_CONFIDENCE()',_0x4494('0xcf'));if(_0x23314a['result']===-0x1){return _0x23314a;}var _0x16b2fc=this[_0x4494('0xac')]('RECOG_INPUT()',_0x4494('0xd0'));if(_0x16b2fc[_0x4494('0x9f')]===-0x1){return _0x16b2fc;}var _0x96a784=this[_0x4494('0xac')](_0x4494('0xaf'),_0x4494('0xd1'));if(_0x96a784['result']===-0x1){return _0x96a784;}return this[_0x4494('0xf')]['noop'](util['format'](_0x4494('0xcc'),_0x8430));};AGIVertices['prototype'][_0x4494('0xd2')]=function(_0x516d87){logger['info'](util[_0x4494('0x50')](_0x4494('0xd3'),_0x516d87['label']));if(!this['isConfigured'](_0x516d87[_0x4494('0xd4')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x516d87,_0x4494('0xd5'));}var _0x45548e=this[_0x4494('0x18')][_0x4494('0x67')](this,_0x516d87[_0x4494('0xd4')]);if(!_0x45548e){return this[_0x4494('0xf')][_0x4494('0x29')](_0x516d87,_0x4494('0xd6'));}if(!this['isConfigured'](_0x516d87[_0x4494('0x2d')])){return this['channel'][_0x4494('0x29')](_0x516d87,_0x4494('0xd7'));}var _0x14f9c1=_0x516d87[_0x4494('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x4494('0xa4')](util['format'](_0x4494('0xd8'),_0x14f9c1));var _0x1936c9=this[_0x4494('0x28')][_0x4494('0x67')](this,_0x45548e,_0x14f9c1);this['createSquareDetailsReport']['sync'](this,_0x516d87,_0x14f9c1);if(!this[_0x4494('0x7d')](_0x516d87[_0x4494('0xd9')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x7a1277=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x516d87[_0x4494('0xd9')]);if(!_0x7a1277){return this['channel']['error'](_0x516d87,_0x4494('0xda'));}var _0x2dcb06=this;_0x1936c9[_0x4494('0xdb')](function(_0x1c00d6,_0x310711){Object[_0x4494('0xdc')](_0x1c00d6)[_0x4494('0xdb')](function(_0x28f032){_0x2dcb06[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('%s[%s][%s]',_0x7a1277,_0x310711,_0x28f032),_0x1c00d6[_0x28f032]);});});this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0xdd'),_0x7a1277),_0x1936c9[_0x4494('0x97')]);return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xde'),_0x7a1277));};AGIVertices[_0x4494('0x14')]['dial']=function(_0x5bad9d){logger[_0x4494('0xdf')](util[_0x4494('0x50')](_0x4494('0xe0'),_0x5bad9d[_0x4494('0x37')]));if(!this['isConfigured'](_0x5bad9d[_0x4494('0xe1')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x5bad9d,'no\x20user\x20selected');}var _0x190b80=this[_0x4494('0x1a')][_0x4494('0x67')](this,_0x5bad9d[_0x4494('0xe1')]);if(!_0x190b80){return this['channel'][_0x4494('0x29')](_0x5bad9d,_0x4494('0xe2'));}var _0x964835=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xe3'),[util[_0x4494('0x50')](_0x4494('0xe4'),_0x190b80),_0x5bad9d[_0x4494('0x5f')],_0x5bad9d[_0x4494('0xe5')],_0x5bad9d[_0x4494('0x5d')]]);if(_0x964835['result']===-0x1){return _0x964835;}return this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x4494('0x14')]['dialogflow']=function(_0x3c178f){logger[_0x4494('0x2b')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x3c178f['label']));if(!this[_0x4494('0x7d')](_0x3c178f[_0x4494('0x72')])){return this[_0x4494('0xf')]['noop'](_0x4494('0xe6'));}if(!this['isConfigured'](_0x3c178f[_0x4494('0x76')])){return this['channel']['noop'](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xe7')]=!![];this[_0x4494('0x35')](_0x3c178f);this[_0x4494('0x40')](_0x3c178f[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xe8'),_0x3c178f[_0x4494('0x76')]));var _0x5d7b29=this[_0x4494('0x71')][_0x4494('0x67')](this,_0x3c178f);if(_0x5d7b29){for(var _0x58ef6e in _0x5d7b29){if(_0x5d7b29[_0x4494('0x92')](_0x58ef6e)){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0xe9'),_0x58ef6e[_0x4494('0x62')]()),_0x5d7b29[_0x58ef6e]);}}this[_0x4494('0x40')](_0x5d7b29['speech'],_0x4494('0xea'),_0x4494('0xeb'),'');return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xec'),_0x5d7b29[_0x4494('0xed')]));}return this[_0x4494('0xf')]['error'](_0x3c178f,_0x4494('0xee'));};AGIVertices[_0x4494('0x14')]['dialogflowV2']=function(_0x46ac84){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x46ac84[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x46ac84[_0x4494('0xef')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xf0'));}if(!this[_0x4494('0x7d')](_0x46ac84['client_email'])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20client_email\x20configured');}if(!this[_0x4494('0x7d')](_0x46ac84['private_key'])){return this['channel'][_0x4494('0xa4')](_0x4494('0xf1'));}if(!this[_0x4494('0x7d')](_0x46ac84['dialogflowV2_language'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xf2'));}if(!this[_0x4494('0x7d')](_0x46ac84[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xe7')]=!![];this[_0x4494('0x35')](_0x46ac84);this[_0x4494('0x40')](_0x46ac84[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x46ac84[_0x4494('0x76')]));var _0x53c8f9=this[_0x4494('0x74')][_0x4494('0x67')](this,_0x46ac84);if(_0x53c8f9){for(var _0x1f1723 in _0x53c8f9){if(_0x53c8f9[_0x4494('0x92')](_0x1f1723)){if(_0x1f1723!=='providerResponse'){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('DIALOGFLOW_%s',_0x1f1723[_0x4494('0x62')]()),_0x53c8f9[_0x1f1723]);}}}this[_0x4494('0x40')](_0x53c8f9['speech'],_0x4494('0xea'),'dialogflowV2',_0x53c8f9[_0x4494('0xf3')]);return this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xf4'),_0x53c8f9[_0x4494('0xed')]));}return this[_0x4494('0xf')][_0x4494('0x29')](_0x46ac84,_0x4494('0xf5'));};AGIVertices[_0x4494('0x14')]['sesteknda']=function(_0x5ea66f){logger['info'](util['format'](_0x4494('0xf6'),_0x5ea66f[_0x4494('0x37')]));if(!this['isConfigured'](_0x5ea66f[_0x4494('0xf7')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xf8'));}if(!this[_0x4494('0x7d')](_0x5ea66f['username'])){return this['channel'][_0x4494('0xa4')](_0x4494('0xf9'));}if(!this[_0x4494('0x7d')](_0x5ea66f[_0x4494('0xfa')])){return this[_0x4494('0xf')]['noop'](_0x4494('0xfb'));}if(!this[_0x4494('0x7d')](_0x5ea66f['ndassistant_url'])){return this[_0x4494('0xf')]['noop'](_0x4494('0xc5'));}this[_0x4494('0xf')]['bot']=!![];this[_0x4494('0x35')](_0x5ea66f);this[_0x4494('0x40')](_0x5ea66f[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0xfc'),_0x5ea66f[_0x4494('0x76')]));var _0x1342b4=this[_0x4494('0x77')][_0x4494('0x67')](this,_0x5ea66f);if(_0x1342b4){for(var _0x3cd400 in _0x1342b4){if(_0x1342b4[_0x4494('0x92')](_0x3cd400)){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0xfd'),_0x3cd400[_0x4494('0x62')]()),_0x1342b4[_0x3cd400]);}}this[_0x4494('0x40')](_0x1342b4[_0x4494('0xed')],'out',_0x4494('0xfe'),'');if(_0x1342b4[_0x4494('0xff')]){this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x1342b4['audiofile']));var _0x5a50ff=this[_0x4494('0xf')][_0x4494('0x100')](_0x1342b4[_0x4494('0xff')]);try{fs[_0x4494('0x101')](_0x1342b4['audiofile']+_0x4494('0x102'));}catch(_0x53e309){logger[_0x4494('0x29')](_0x53e309);}return _0x5a50ff;}else{return this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')]('SestekNDA\x20Result\x20%s',_0x1342b4[_0x4494('0xed')]));}}return this[_0x4494('0xf')][_0x4494('0x29')](_0x5ea66f,_0x4494('0x103'));};AGIVertices[_0x4494('0x14')][_0x4494('0x104')]=function(_0x247d16){logger['info'](util[_0x4494('0x50')](_0x4494('0x105'),_0x247d16[_0x4494('0x37')]));return this['channel'][_0x4494('0xa4')](_0x4494('0x104'));};AGIVertices[_0x4494('0x14')][_0x4494('0x106')]=function(_0xf891d9){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xf891d9['label']));var _0x9db5a3='';if(_0xf891d9[_0x4494('0x107')]){if(!this[_0x4494('0x7d')](_0xf891d9[_0x4494('0x107')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0xf891d9,'no\x20trunk\x20selected');}else{var _0x5940b3=parseInt(_0xf891d9['trunk_id'],0xa);if(isNaN(_0x5940b3)){_0x9db5a3=_0xf891d9[_0x4494('0x107')];}else{_0x9db5a3=this['getTrunk'][_0x4494('0x67')](this,_0xf891d9[_0x4494('0x107')]);if(!_0x9db5a3){return this['channel'][_0x4494('0x29')](_0xf891d9,_0x4494('0x108'));}}}}else if(_0xf891d9['trunk_name']){_0x9db5a3=_0xf891d9[_0x4494('0x109')];}else{return this[_0x4494('0xf')][_0x4494('0x29')](_0xf891d9,_0x4494('0x10a'));}var _0x8b1590=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0xe3'),[util['format'](_0x4494('0x10b'),_0x9db5a3,_0xf891d9['phone']),_0xf891d9[_0x4494('0x5f')],_0xf891d9['opts'],_0xf891d9[_0x4494('0x5d')]]);if(_0x8b1590[_0x4494('0x9f')]===-0x1){return _0x8b1590;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s',_0x4494('0xe3')));};AGIVertices[_0x4494('0x14')][_0x4494('0x10c')]=function(_0x30df24){logger[_0x4494('0x2b')](util['format'](_0x4494('0x10d'),_0x30df24[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x10c'));};AGIVertices['prototype'][_0x4494('0xd')]=function(_0x199c52){logger[_0x4494('0x2b')](util['format'](_0x4494('0x10e'),_0x199c52[_0x4494('0x37')]));if(_0x199c52['retry']===0x0){return this[_0x4494('0xa1')](_0x199c52);}_0x199c52[_0x4494('0x10f')]-=0x1;if(!this[_0x4494('0x7d')](_0x199c52['file_id'])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x199c52,_0x4494('0x110'));}var _0x3412ca=this[_0x4494('0x111')][_0x4494('0x67')](this,_0x199c52[_0x4494('0x112')]);if(!_0x3412ca){return this[_0x4494('0xf')][_0x4494('0x29')](_0x199c52,'no\x20file\x20audio\x20found');}if(!this[_0x4494('0x7d')](_0x199c52['variable_id'])){return this['channel'][_0x4494('0x29')](_0x4494('0x113'));}var _0x26230f=this['channel']['getData'](_0x3412ca,_0x199c52[_0x4494('0x114')],_0x199c52['maxdigit']);var _0x59b28a=_0x26230f[_0x4494('0x9f')]?_0x26230f[_0x4494('0x9f')]['toString']():'';logger[_0x4494('0x2b')](_0x4494('0x115'),JSON[_0x4494('0x6b')](_0x26230f));if(_0x26230f['result']===-0x1){this[_0x4494('0x35')][_0x4494('0x67')](this,_0x199c52,_0x59b28a);return _0x26230f;}else if(_0x26230f[_0x4494('0x9d')]===_0x4494('0x5f')){_0x26230f[_0x4494('0x9f')]=_0x59b28a['length']>=parseInt(_0x199c52[_0x4494('0x116')])?'x':'i';}else{_0x26230f['result']=_0x59b28a[_0x4494('0x97')]>=parseInt(_0x199c52[_0x4494('0x116')])&&_0x59b28a['length']<=parseInt(_0x199c52[_0x4494('0x117')])?'x':'i';}var _0x2da9c3=this['getVariable'][_0x4494('0x67')](this,_0x199c52['variable_id']);if(!_0x2da9c3){return this['channel'][_0x4494('0x29')](_0x199c52,'no\x20variable\x20found');}this[_0x4494('0xf')][_0x4494('0x98')](_0x2da9c3,_0x59b28a);if(this[_0x4494('0x7d')](_0x199c52[_0x4494('0x118')])){var _0x51263=parseInt(_0x199c52['hiddendigitsnum'],0xa);var _0x124d27=rs[_0x4494('0x119')]({'charset':'*','length':_0x51263});var _0x55b685=_0x59b28a['length'];if(_0x55b685>0x0){if(_0x55b685>_0x51263){this[_0x4494('0x35')][_0x4494('0x67')](this,_0x199c52,_0x199c52['hiddendigitspos']===_0x4494('0x11a')?_0x124d27+_0x59b28a[_0x4494('0x11b')](_0x51263):_0x59b28a['substr'](0x0,_0x55b685-_0x51263)+_0x124d27);}else{this[_0x4494('0x35')][_0x4494('0x67')](this,_0x199c52,rs[_0x4494('0x119')]({'charset':'*','length':_0x55b685}));}}else{this['createSquareDetailsReport'][_0x4494('0x67')](this,_0x199c52,'');}}else{this[_0x4494('0x35')]['sync'](this,_0x199c52,_0x59b28a);}return _0x26230f;};AGIVertices[_0x4494('0x14')][_0x4494('0xe')]=function(_0xd10dda){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x11c'),_0xd10dda[_0x4494('0x37')]));return this['getdigits'](_0xd10dda);};AGIVertices[_0x4494('0x14')][_0x4494('0x11d')]=function(_0x385cd8){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x11e'),_0x385cd8['label']));this[_0x4494('0x35')][_0x4494('0x67')](this,_0x385cd8,_0x385cd8[_0x4494('0x11f')]);return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('GOAL\x20%s',_0x385cd8[_0x4494('0x11f')]));};AGIVertices[_0x4494('0x14')][_0x4494('0x120')]=function(_0x35b4ce){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x121'),_0x35b4ce[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x35b4ce['aws_access_key_id'])||!this[_0x4494('0x7d')](_0x35b4ce[_0x4494('0x81')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4494('0x7d')](_0x35b4ce[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x122'),_0x35b4ce[_0x4494('0x76')]));var _0x17bdb9=this[_0x4494('0x7f')][_0x4494('0x67')](this,_0x35b4ce);if(_0x17bdb9){this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x123'),_0x17bdb9));var _0x8ae25b=this['channel'][_0x4494('0x100')](_0x17bdb9);try{fs[_0x4494('0x101')](_0x17bdb9+_0x4494('0x102'));}catch(_0xb72327){logger['error'](_0xb72327);}return _0x8ae25b;}return this[_0x4494('0xf')][_0x4494('0x29')](_0x35b4ce,_0x4494('0x124'));};AGIVertices[_0x4494('0x14')][_0x4494('0x125')]=function(_0x1bee16){logger['info'](util['format'](_0x4494('0x126'),_0x1bee16[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x1bee16['aws_access_key_id'])||!this[_0x4494('0x7d')](_0x1bee16['aws_secret_access_key'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x127'));}if(!this[_0x4494('0x7d')](_0x1bee16['aws_bot_name'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x128'));}if(!this[_0x4494('0x7d')](_0x1bee16[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')][_0x4494('0xe7')]=!![];this[_0x4494('0x35')](_0x1bee16);this[_0x4494('0x40')](_0x1bee16[_0x4494('0x76')],'in','','');this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1bee16[_0x4494('0x76')]));var _0x21dc17=this[_0x4494('0x86')][_0x4494('0x67')](this,_0x1bee16);if(_0x21dc17){for(var _0x4d45b9 in _0x21dc17){if(_0x21dc17[_0x4494('0x92')](_0x4d45b9)&&_[_0x4494('0x90')](_0x21dc17[_0x4d45b9])){this['channel'][_0x4494('0x98')](util['format'](_0x4494('0x129'),_0x4d45b9[_0x4494('0x62')]()),_0x21dc17[_0x4d45b9]);}}if(_[_0x4494('0x45')](_0x21dc17['message'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x12a'));}else{this[_0x4494('0x40')](_0x21dc17[_0x4494('0x12b')],_0x4494('0xea'),_0x4494('0x12c'),'');return this['channel']['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x21dc17['message']));}}return this['channel'][_0x4494('0x29')](_0x1bee16,_0x4494('0x12d'));};AGIVertices['prototype'][_0x4494('0x12e')]=function(_0x1c340b){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x12f'),_0x1c340b[_0x4494('0x37')],_0x1c340b['timeout']));if(!this[_0x4494('0x7d')](_0x1c340b[_0x4494('0x72')])){return this['channel']['noop'](_0x4494('0xe6'));}var _0x39c50d=_0x4494('0x130');var _0x2ea3a8=util[_0x4494('0x50')](_0x4494('0x131'),FILES_PATH,rs[_0x4494('0x119')](0x4));var _0x41cbe3=util['format'](_0x4494('0x96'),_0x2ea3a8,_0x39c50d);var _0x41e6aa=!![];if(_0x1c340b[_0x4494('0x132')]===_0x4494('0x133')){_0x41e6aa=![];}var _0x515ef1=this[_0x4494('0xf')][_0x4494('0x134')](_0x2ea3a8,_0x39c50d,_0x1c340b['intKey'],_0x1c340b[_0x4494('0x5f')],undefined,_0x41e6aa);if(_0x515ef1['result']!==-0x1){this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x135'),_0x41cbe3));var _0x81428b=this[_0x4494('0x89')][_0x4494('0x67')](this,_0x1c340b,_0x41cbe3);if(_0x81428b){for(var _0x140bc4 in _0x81428b){if(_0x81428b[_0x4494('0x92')](_0x140bc4)){this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0x136'),_0x140bc4[_0x4494('0x62')]()),_0x81428b[_0x140bc4]);}}return this['channel']['noop'](util[_0x4494('0x50')](_0x4494('0x137'),JSON['stringify'](_0x81428b)));}}return _0x515ef1;};AGIVertices[_0x4494('0x14')][_0x4494('0x138')]=function(_0x14be39){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x139'),_0x14be39[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x14be39[_0x4494('0x8c')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20appid\x20configured');}if(!this[_0x4494('0x7d')](_0x14be39['appsecret'])){return this['channel']['noop'](_0x4494('0x13a'));}var _0x21c0ff=_0x4494('0x130');var _0x39c0da=util[_0x4494('0x50')](_0x4494('0x131'),FILES_PATH,rs[_0x4494('0x119')](0x4));var _0x4e14c5=util[_0x4494('0x50')](_0x4494('0x96'),_0x39c0da,_0x21c0ff);var _0x151054=!![];if(_0x14be39[_0x4494('0x132')]===_0x4494('0x133')){_0x151054=![];}var _0x4064ef=this[_0x4494('0xf')][_0x4494('0x134')](_0x39c0da,_0x21c0ff,_0x14be39['intKey'],_0x14be39[_0x4494('0x5f')],undefined,_0x151054);if(_0x4064ef[_0x4494('0x9f')]!==-0x1){this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x13b'),_0x4e14c5));var _0x4fdb6d=this[_0x4494('0x8b')][_0x4494('0x67')](this,_0x14be39,_0x4e14c5);if(_0x4fdb6d){for(var _0x1725f5 in _0x4fdb6d){if(_0x4fdb6d[_0x4494('0x92')](_0x1725f5)){this[_0x4494('0xf')][_0x4494('0x98')](util['format'](_0x4494('0x13c'),_0x1725f5[_0x4494('0x62')]()),_0x4fdb6d[_0x1725f5]);}}return this['channel']['noop'](util['format'](_0x4494('0x13d'),JSON[_0x4494('0x6b')](_0x4fdb6d)));}}return _0x4064ef;};AGIVertices[_0x4494('0x14')][_0x4494('0x13e')]=function(_0x5b1b92){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5b1b92[_0x4494('0x37')]));return this[_0x4494('0xf')]['continueAt'](_0x5b1b92[_0x4494('0x3b')],_0x5b1b92['extension'],_0x5b1b92['priority']);};AGIVertices[_0x4494('0x14')][_0x4494('0x13f')]=function(_0x51b967){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x51b967[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x51b967[_0x4494('0x140')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x51b967,_0x4494('0x141'));}try{var _0x2f4144=eval(_0x51b967[_0x4494('0x140')])?_0x4494('0x142'):_0x4494('0x143');this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x144'),_0x51b967[_0x4494('0x140')],_0x2f4144));return{'code':0xc8,'result':_0x2f4144};}catch(_0x18a01c){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x4494('0x14')][_0x4494('0x145')]=function(_0xeefb10){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xeefb10[_0x4494('0x37')]));if(!this['isConfigured'](_0xeefb10[_0x4494('0x146')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0xeefb10,_0x4494('0x147'));}var _0x1d84cb=this[_0x4494('0x22')][_0x4494('0x67')](this,_0xeefb10[_0x4494('0x146')]);if(!_0x1d84cb){return this[_0x4494('0xf')]['error'](_0xeefb10,_0x4494('0x148'));}for(var _0x6c687=0x0;_0x6c687<_0x1d84cb[_0x4494('0x97')];_0x6c687+=0x1){var _0x11a9a7=this[_0x4494('0xf')]['getVariable'](util[_0x4494('0x50')]('IFTIME(%s?true:false)',_0x1d84cb[_0x6c687]));if(_0x11a9a7[_0x4494('0x9f')]===-0x1){return _0x11a9a7;}logger['info'](util[_0x4494('0x50')]('IFTIME\x20%s\x20%s',_0x1d84cb[_0x6c687],_0x11a9a7[_0x4494('0x9d')]));if(_0x11a9a7[_0x4494('0x9d')]==='true'){logger['info'](util[_0x4494('0x50')](_0x4494('0x149'),_0x1d84cb[_0x6c687],_0x4494('0x142')));this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x149'),_0x1d84cb[_0x6c687],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x4494('0x2b')](util['format'](_0x4494('0x149'),_0x1d84cb[_0x6c687],_0x4494('0x143')));this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('IFTIME\x20%s\x20%s',_0x1d84cb[_0x6c687],_0x4494('0x143')));}}return{'code':0xc8,'result':_0x4494('0x143')};};AGIVertices[_0x4494('0x14')][_0x4494('0x14a')]=function(_0x15728a){logger[_0x4494('0x2b')](util['format'](_0x4494('0x14b'),_0x15728a['label']));return this['channel'][_0x4494('0x14a')]();};AGIVertices[_0x4494('0x14')][_0x4494('0x14c')]=function(_0x58ff54){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x14d'),_0x58ff54[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x58ff54['key'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xe6'));}var _0x2a37c5=_0x4494('0x130');var _0x1ed582=util['format'](_0x4494('0x131'),FILES_PATH,rs[_0x4494('0x119')](0x4));var _0x510990=util[_0x4494('0x50')]('%s.%s',_0x1ed582,_0x2a37c5);var _0x20074d=!![];if(_0x58ff54['beep']===_0x4494('0x133')){_0x20074d=![];}var _0x1b667f=this[_0x4494('0xf')][_0x4494('0x134')](_0x1ed582,_0x2a37c5,_0x58ff54[_0x4494('0x14e')],_0x58ff54['timeout'],undefined,_0x20074d);if(_0x1b667f['result']!==-0x1){this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('ispeech\x20%s\x20file\x20created',_0x510990));var _0xb70dd8=this[_0x4494('0x7b')][_0x4494('0x67')](this,_0x58ff54,_0x510990);if(_0xb70dd8){for(var _0x2ba86d in _0xb70dd8){if(_0xb70dd8[_0x4494('0x92')](_0x2ba86d)){this['channel'][_0x4494('0x98')](util[_0x4494('0x50')]('ISPEECH_ASR_%s',_0x2ba86d[_0x4494('0x62')]()),_0xb70dd8[_0x2ba86d]);}}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('IspeechASR\x20Result\x20%s',JSON[_0x4494('0x6b')](_0xb70dd8)));}}return _0x1b667f;};AGIVertices['prototype']['ispeechtts']=function(_0x4e40c1){logger['info'](util[_0x4494('0x50')](_0x4494('0x14f'),_0x4e40c1[_0x4494('0x37')]));if(!this['isConfigured'](_0x4e40c1[_0x4494('0x72')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20key\x20configured');}if(!this[_0x4494('0x7d')](_0x4e40c1[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0xc5'));}this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x150'),_0x4e40c1[_0x4494('0x76')]));var _0x106f7a=this[_0x4494('0x78')][_0x4494('0x67')](this,_0x4e40c1);if(_0x106f7a){this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x151'),_0x106f7a));var _0x3e435a=this[_0x4494('0xf')]['streamFile'](_0x106f7a,_0x4e40c1[_0x4494('0x14e')]);try{fs['unlink'](_0x106f7a+_0x4494('0x102'));}catch(_0x5a3cdc){logger[_0x4494('0x29')](_0x5a3cdc);}return _0x3e435a;}return this[_0x4494('0xf')][_0x4494('0x29')](_0x4e40c1,_0x4494('0x152'));};AGIVertices[_0x4494('0x14')][_0x4494('0x153')]=function(_0xb15eae){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x154'),_0xb15eae['label']));if(!this[_0x4494('0x7d')](_0xb15eae[_0x4494('0x155')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0xb15eae,'no\x20find\x20by\x20configured');}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this['channel'][_0x4494('0x3a')],_0xb15eae['findBy']));var _0x2173de=this[_0x4494('0x4e')][_0x4494('0x67')](this,_0xb15eae['findBy']);if(_0x2173de){logger['info'](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0xb15eae[_0x4494('0x155')]));this[_0x4494('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4494('0xf')][_0x4494('0x3a')],_0xb15eae[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x158')};}else{logger[_0x4494('0x2b')](util[_0x4494('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4494('0xf')]['callerid'],_0xb15eae[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0xb15eae[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x15a')};}};AGIVertices[_0x4494('0x14')]['logout']=function(_0x5cd61e){logger['info'](util['format'](_0x4494('0x15b'),_0x5cd61e[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x5cd61e[_0x4494('0x155')])){return this[_0x4494('0xf')]['error'](_0x5cd61e,_0x4494('0x15c'));}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e[_0x4494('0x155')]));var _0x1e52cc=this[_0x4494('0x4d')]['sync'](this,_0x5cd61e[_0x4494('0x155')]);if(_0x1e52cc){logger[_0x4494('0x2b')](util['format'](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e[_0x4494('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4494('0x50')](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x5cd61e['findBy']));this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x159'),this['channel']['callerid'],_0x5cd61e[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x15a')};}};AGIVertices[_0x4494('0x14')][_0x4494('0x15d')]=function(_0x3b9724){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x15e'),_0x3b9724[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x3b9724[_0x4494('0x15f')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x3b9724,'no\x20operation\x20configured');}this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')]('math\x20%s',_0x3b9724['operation']));var _0x5c792f=eval(_0x3b9724[_0x4494('0x15f')]);if(!this['isConfigured'](_0x3b9724[_0x4494('0xd9')])){return this['channel']['noop'](_0x4494('0x113'));}var _0xaf5459=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x3b9724['variable_id']);if(!_0xaf5459){return this[_0x4494('0xf')][_0x4494('0x29')](_0x3b9724,_0x4494('0xda'));}if(_[_0x4494('0x94')](_0x5c792f)){var _0x563db4=this;_0x5c792f[_0x4494('0xdb')](function(_0x3eda3a,_0x16c476){_0x563db4[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')](_0x4494('0x160'),_0xaf5459,_0x16c476),_0x3eda3a);});return this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('variable\x20%s[key]\x20set',_0xaf5459));}else{return this[_0x4494('0xf')]['setVariable'](_0xaf5459,_0x5c792f);}};AGIVertices[_0x4494('0x14')][_0x4494('0xc')]=function(_0x16ea41){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x161'),_0x16ea41[_0x4494('0x37')]));if(_0x16ea41['retry']===0x0){return this['maxRetry'](_0x16ea41);}_0x16ea41[_0x4494('0x10f')]-=0x1;if(!this[_0x4494('0x7d')](_0x16ea41[_0x4494('0x112')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x16ea41,_0x4494('0x110'));}var _0x3d2014=this['getSound'][_0x4494('0x67')](this,_0x16ea41[_0x4494('0x112')]);if(!_0x3d2014){return this[_0x4494('0xf')]['error'](_0x16ea41,_0x4494('0x162'));}var _0x5cbd1e=this[_0x4494('0xf')][_0x4494('0x163')](_0x3d2014,_0x16ea41['response'],_0x16ea41[_0x4494('0x164')]);var _0x3515fa=_0x5cbd1e[_0x4494('0x9f')];if(_0x5cbd1e[_0x4494('0x9f')]===-0x1){this[_0x4494('0x35')]['sync'](this,_0x16ea41,'-1');return _0x5cbd1e;}else if(_0x5cbd1e[_0x4494('0x9d')]===_0x4494('0x5f')){_0x5cbd1e['result']=_0x5cbd1e[_0x4494('0x9f')][_0x4494('0x97')]>0x0?_0x5cbd1e['result']:'t';}else if(_[_0x4494('0x43')](_0x5cbd1e['result'])){_0x5cbd1e['result']='#';_0x3515fa='#';}if(!this[_0x4494('0x7d')](_0x16ea41[_0x4494('0xd9')])){this['channel'][_0x4494('0xa4')](_0x4494('0x113'));}else{var _0x35fa7d=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x16ea41[_0x4494('0xd9')]);if(!_0x35fa7d){return this['channel'][_0x4494('0x29')](_0x16ea41,'no\x20variable\x20found');}this['channel'][_0x4494('0x98')](_0x35fa7d,_0x3515fa);}this['createSquareDetailsReport'][_0x4494('0x67')](this,_0x16ea41,_0x3515fa);return _0x5cbd1e;};AGIVertices['prototype']['noop']=function(_0x4d51e5){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x165'),_0x4d51e5[_0x4494('0x37')]));return this['channel'][_0x4494('0xa4')](_0x4d51e5['output']||_0x4d51e5[_0x4494('0x37')]);};AGIVertices[_0x4494('0x14')][_0x4494('0x166')]=function(_0x33cd7a){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x167'),_0x33cd7a['label']));if(!this[_0x4494('0x7d')](_0x33cd7a[_0x4494('0x155')])){return this['channel'][_0x4494('0x29')](_0x33cd7a,'no\x20find\x20by\x20configured');}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));var _0x1e1a71=this[_0x4494('0x4a')][_0x4494('0x67')](this,_0x33cd7a[_0x4494('0x168')]);var _0x48b640=this['agentPause'][_0x4494('0x67')](this,_0x33cd7a[_0x4494('0x155')],_0x1e1a71);if(_0x48b640){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));return{'code':0xc8,'result':_0x4494('0x158')};}else{logger[_0x4494('0x2b')](util['format'](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x33cd7a[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x157'),this[_0x4494('0xf')]['callerid'],_0x33cd7a['findBy']));return{'code':0xc8,'result':_0x4494('0x15a')};}};AGIVertices[_0x4494('0x14')][_0x4494('0x169')]=function(_0x313e3c){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x16a'),_0x313e3c['label']));if(!this[_0x4494('0x7d')](_0x313e3c['file_id'])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x313e3c,_0x4494('0x110'));}var _0x2be577=this[_0x4494('0x111')][_0x4494('0x67')](this,_0x313e3c[_0x4494('0x112')]);if(!_0x2be577){return this[_0x4494('0xf')][_0x4494('0x29')](_0x313e3c,_0x4494('0x162'));}var _0x5b9791=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0x16b'),[_0x2be577,_0x313e3c[_0x4494('0xe5')]]);if(_0x5b9791[_0x4494('0x9f')]===-0x1){return _0x5b9791;}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0xc3'),_0x4494('0x16b'),_0x2be577));};AGIVertices[_0x4494('0x14')][_0x4494('0x16c')]=function(_0x13c261){logger['info'](util['format'](_0x4494('0x16d'),_0x13c261[_0x4494('0x37')]));if(!this['isConfigured'](_0x13c261['queue_id'])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x13c261,_0x4494('0x16e'));}var _0x4c1f7e='';var _0x3e907b=parseInt(_0x13c261[_0x4494('0x16f')],0xa);if(isNaN(_0x3e907b)){_0x4c1f7e=_0x13c261[_0x4494('0x16f')];}else{_0x4c1f7e=this[_0x4494('0x15')][_0x4494('0x67')](this,_0x13c261[_0x4494('0x16f')]);if(!_0x4c1f7e){return this['channel'][_0x4494('0x29')](_0x13c261,_0x4494('0x170'));}}var _0x3995bd='';if(this['isConfigured'](_0x13c261['file_id'])){var _0x1af55b=this[_0x4494('0x111')]['sync'](this,_0x13c261[_0x4494('0x112')]);if(_0x1af55b){_0x3995bd=_0x1af55b;}}this[_0x4494('0x35')][_0x4494('0x67')](this,_0x13c261,_0x4c1f7e);if(_0x13c261[_0x4494('0xe5')][_0x4494('0x171')]('x')<0x0){_0x13c261['opts']+='x';}if(_0x13c261['opts'][_0x4494('0x171')]('X')<0x0){_0x13c261[_0x4494('0xe5')]+='X';}this[_0x4494('0xf')][_0x4494('0x98')](_0x4494('0x172'),_0x4c1f7e?_0x4c1f7e['toLowerCase']():'');var _0x12c081=this[_0x4494('0xf')]['exec'](_0x4494('0x173'),[_0x4c1f7e,_0x13c261[_0x4494('0xe5')],_0x13c261[_0x4494('0x5d')],_0x3995bd,_0x13c261[_0x4494('0x5f')],_0x13c261[_0x4494('0xb2')],_0x13c261[_0x4494('0x174')],_0x13c261['gosub'],'',_0x13c261[_0x4494('0x175')]]);if(_0x12c081['result']===-0x1){return _0x12c081;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x4494('0x173'),_0x4c1f7e));};AGIVertices[_0x4494('0x14')][_0x4494('0x176')]=function(_0x5316ea){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x177'),_0x5316ea[_0x4494('0x37')]));var _0x420d34=_0x5316ea[_0x4494('0x178')]||_0x4494('0x130');var _0x5bf29f=util[_0x4494('0x50')](_0x4494('0x179'),this[_0x4494('0xf')][_0x4494('0x36')],rs[_0x4494('0x119')](0x5));var _0x44bbd3=util[_0x4494('0x50')](_0x4494('0x17a'),FILES_PATH,_0x5bf29f,_0x420d34);var _0x4fae90=util[_0x4494('0x50')]('%s/recordings/%s',FILES_PATH,_0x5bf29f);this[_0x4494('0x39')]['sync'](this,_0x5316ea,_0x5bf29f,_0x44bbd3);this['channel'][_0x4494('0x98')](_0x4494('0x17b'),_0x5bf29f);logger[_0x4494('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x4fae90,_0x420d34,_0x5316ea[_0x4494('0x17c')],_0x5316ea[_0x4494('0x5f')]);return this[_0x4494('0xf')][_0x4494('0x134')](_0x4fae90,_0x420d34,_0x5316ea[_0x4494('0x17c')],_0x5316ea[_0x4494('0x5f')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x54184c){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x54184c[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x54184c['url'])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x17d'));}var _0x2bd5ab=this['restAPI'][_0x4494('0x67')](this,_0x54184c);logger[_0x4494('0x2b')](util['format']('Response:',util[_0x4494('0x17e')](_0x2bd5ab,{'showHidden':![],'depth':null})));if(!this[_0x4494('0x7d')](_0x54184c[_0x4494('0xd9')])){return this[_0x4494('0xf')]['noop'](_0x4494('0x17f'));}var _0x3fbabb=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x54184c[_0x4494('0xd9')]);if(!_0x3fbabb){return this[_0x4494('0xf')]['error'](_0x54184c,_0x4494('0xda'));}this[_0x4494('0xf')][_0x4494('0x98')](util[_0x4494('0x50')]('%s_STATUS_CODE',_0x3fbabb),_0x2bd5ab[_0x4494('0x6d')]?_0x2bd5ab[_0x4494('0x6d')]:_0x4494('0x180'));this[_0x4494('0xf')]['setVariable'](util[_0x4494('0x50')](_0x4494('0x181'),_0x3fbabb),_0x2bd5ab[_0x4494('0x6e')]?_0x2bd5ab[_0x4494('0x6e')]:'OK');if(_0x2bd5ab[_0x4494('0x63')]){try{this['saveRestApiResult'](_0x2bd5ab[_0x4494('0x63')],_0x3fbabb);}catch(_0x539210){logger['error'](util[_0x4494('0x50')](_0x4494('0x182'),_0x3fbabb));}}return this[_0x4494('0xf')][_0x4494('0xa4')](util['format']('variable\x20%s\x20set',_0x3fbabb));};AGIVertices[_0x4494('0x14')]['saydigits']=function(_0x328ea2){logger[_0x4494('0x2b')](util[_0x4494('0x50')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x328ea2[_0x4494('0x37')]));return this[_0x4494('0xf')]['sayDigits'](_0x328ea2[_0x4494('0x183')][_0x4494('0x184')](/\s+/g,''),_0x328ea2['escape_digits']);};AGIVertices[_0x4494('0x14')][_0x4494('0x185')]=function(_0x1ca7f0){logger['info'](util[_0x4494('0x50')](_0x4494('0x186'),_0x1ca7f0['label']));return this[_0x4494('0xf')]['sayNumber'](_0x1ca7f0[_0x4494('0x187')][_0x4494('0x184')](/\s+/g,''),_0x1ca7f0['escape_digits']);};AGIVertices[_0x4494('0x14')][_0x4494('0x188')]=function(_0x31fd10){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x189'),_0x31fd10[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0x18a')](_0x31fd10[_0x4494('0x76')],_0x31fd10['escape_digits']);};AGIVertices[_0x4494('0x14')][_0x4494('0x18b')]=function(_0x110a85){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x18c'),_0x110a85[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x110a85[_0x4494('0x18d')])){return this['channel'][_0x4494('0xa4')](_0x4494('0x18e'));}var _0x50f7ac=this[_0x4494('0x1f')][_0x4494('0x67')](this,_0x110a85[_0x4494('0x18d')]);if(!_0x50f7ac||!_0x50f7ac[_0x4494('0x18f')]){return this[_0x4494('0xf')][_0x4494('0x29')](_0x110a85,_0x4494('0x190'));}var _0x283cdf={'from':util[_0x4494('0x50')]('\x22%s\x22\x20<%s>',_0x50f7ac[_0x4494('0x12')],_0x50f7ac[_0x4494('0x191')]||_0x50f7ac['Smtp'][_0x4494('0x192')]),'to':_0x110a85['to']||'','cc':_0x110a85['cc']||'','bcc':_0x110a85[_0x4494('0x193')]||'','subject':_0x110a85[_0x4494('0x194')],'html':_0x110a85[_0x4494('0x76')],'text':_0x110a85[_0x4494('0x76')]};if(this['isConfigured'](_0x110a85[_0x4494('0x195')])){}logger[_0x4494('0xdf')]('sendMail\x20message',JSON['stringify'](_0x283cdf));this['createSquareDetailsReport']['sync'](this,_0x110a85,_0x110a85[_0x4494('0x18d')]);this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x196'),_0x50f7ac['name']));this[_0x4494('0x21')][_0x4494('0x67')](this,_0x50f7ac[_0x4494('0x197')],_0x283cdf);return this['channel'][_0x4494('0xa4')](_0x4494('0x198'));};AGIVertices[_0x4494('0x14')]['sendFax']=function(_0x3fbbd5){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x199'),_0x3fbbd5[_0x4494('0x37')]));return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x19a'));};AGIVertices[_0x4494('0x14')][_0x4494('0x19b')]=function(_0x2bf571){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2bf571[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x2bf571[_0x4494('0x19c')])){return this['channel']['noop'](_0x4494('0x19d'));}var _0x5689d6=this[_0x4494('0x32')][_0x4494('0x67')](this,_0x2bf571[_0x4494('0x19c')]);if(!_0x5689d6){return this[_0x4494('0xf')][_0x4494('0x29')](_0x2bf571,_0x4494('0x19e'));}var _0x4f3da9={'body':_0x2bf571[_0x4494('0x19f')],'phone':_0x2bf571['to']||'','SmsAccountId':_0x5689d6['id']};logger[_0x4494('0xdf')](_0x4494('0x1a0'),JSON[_0x4494('0x6b')](_0x4f3da9));this[_0x4494('0x35')][_0x4494('0x67')](this,_0x2bf571,_0x2bf571[_0x4494('0x19c')]);this[_0x4494('0xf')]['noop'](util['format'](_0x4494('0x1a1'),_0x5689d6[_0x4494('0x12')]));this[_0x4494('0x34')][_0x4494('0x67')](this,_0x4f3da9);return this[_0x4494('0xf')]['noop'](_0x4494('0x1a2'));};AGIVertices[_0x4494('0x14')]['set']=function(_0x468195){logger[_0x4494('0x2b')](util['format'](_0x4494('0x1a3'),_0x468195[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x468195['variable_id'])){return this['channel'][_0x4494('0x29')](_0x468195,_0x4494('0x1a4'));}var _0x26649b=this['getVariable'][_0x4494('0x67')](this,_0x468195[_0x4494('0xd9')]);if(!_0x26649b){return this[_0x4494('0xf')]['error'](_0x468195,_0x4494('0xda'));}return this[_0x4494('0xf')]['setVariable'](_0x26649b,_0x468195['variable_value']);};AGIVertices['prototype']['start']=function(_0x53c296){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x1a5'),_0x53c296[_0x4494('0x37')]));this['channel'][_0x4494('0xa4')](_0x4494('0x1a6'));var _0x228a00=this['channel']['getVariable'](_0x4494('0x1a7'));if(!_[_0x4494('0x43')](_0x228a00[_0x4494('0x9d')])){this[_0x4494('0xf')][_0x4494('0x36')]=_0x228a00[_0x4494('0x9d')];}if(_0x53c296[_0x4494('0xb7')]==='yes'){this['channel'][_0x4494('0xa4')](_0x4494('0x1a8'));return this[_0x4494('0xf')][_0x4494('0xb7')]();}return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x1a9'));};AGIVertices[_0x4494('0x14')][_0x4494('0x1aa')]=function(_0x5f5718){logger['info'](util[_0x4494('0x50')](_0x4494('0x1ab'),_0x5f5718[_0x4494('0x37')]));if(!this[_0x4494('0x7d')](_0x5f5718[_0x4494('0x1ac')])){return this[_0x4494('0xf')][_0x4494('0x29')](_0x5f5718,_0x4494('0x1ad'));}var _0x1701bc=this[_0x4494('0x1ae')][_0x4494('0x67')](this,_0x5f5718['project_id']);if(!this['isConfigured'](_0x1701bc)){return this[_0x4494('0xf')]['error'](_0x5f5718,util['format'](_0x4494('0x1af'),_0x5f5718[_0x4494('0x1ac')]));}if(_0x1701bc===this[_0x4494('0xf')]['arg_1']){return this['channel']['error'](_0x5f5718,_0x4494('0x1b0'));}this[_0x4494('0x35')][_0x4494('0x67')](this,_0x5f5718,_0x1701bc);var _0x4b9c06=this[_0x4494('0xf')][_0x4494('0xa5')](_0x4494('0x1b1'),util[_0x4494('0x50')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x4494('0xb2')][_0x4494('0x1b2')]||_0x4494('0x1b3'),_0x1701bc,this[_0x4494('0xf')]['arg_1']));if(_0x4b9c06[_0x4494('0x9f')]===-0x1){return _0x4b9c06;}return this['channel'][_0x4494('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0x4494('0x1b1'),_0x1701bc));};AGIVertices[_0x4494('0x14')]['system']=function(_0x2124bf){logger[_0x4494('0x2b')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2124bf['label']));var _0x182fdb=this[_0x4494('0x53')][_0x4494('0x67')](this,_0x2124bf[_0x4494('0xb3')]);this['createSquareDetailsReport'][_0x4494('0x67')](this,_0x2124bf,_0x2124bf[_0x4494('0xb3')]);if(this[_0x4494('0x7d')](_0x2124bf[_0x4494('0xd9')])){var _0x4b958a=this[_0x4494('0x9c')][_0x4494('0x67')](this,_0x2124bf[_0x4494('0xd9')]);if(_0x4b958a){this[_0x4494('0xf')][_0x4494('0x98')](_0x4b958a,_0x182fdb);return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1b4'),_0x2124bf[_0x4494('0xb3')],_0x4b958a));}}return this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1b5'),_0x2124bf['command']));};AGIVertices[_0x4494('0x14')][_0x4494('0x1b6')]=function(_0x278fa3){logger['info'](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x278fa3['label']));_0x278fa3['text']=_0x278fa3[_0x4494('0x76')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x278fa3[_0x4494('0x55')])){return this[_0x4494('0xf')][_0x4494('0xa4')](_0x4494('0x1b7'));}if(!this[_0x4494('0x7d')](_0x278fa3[_0x4494('0x76')])){return this[_0x4494('0xf')][_0x4494('0xa4')]('no\x20text\x20configured');}this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x1b8'),_0x278fa3[_0x4494('0x76')]));var _0x591fd7=this['googleCloudTTS']['sync'](this,_0x278fa3);if(_0x591fd7){this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1b9'),_0x591fd7));var _0x1c88f7=this[_0x4494('0xf')]['streamFile'](_0x591fd7);try{fs[_0x4494('0x101')](_0x591fd7+_0x4494('0x102'));}catch(_0x156d26){logger[_0x4494('0x29')](_0x156d26);}return _0x1c88f7;}return this[_0x4494('0xf')][_0x4494('0x29')](_0x278fa3,_0x4494('0x1ba'));};AGIVertices[_0x4494('0x14')][_0x4494('0x1bb')]=function(_0x106577){logger['info'](util[_0x4494('0x50')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x106577[_0x4494('0x37')]));_0x106577[_0x4494('0x76')]=_0x106577[_0x4494('0x76')][_0x4494('0x184')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x106577[_0x4494('0x76')])){return this[_0x4494('0xf')]['noop']('no\x20text\x20configured');}this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')](_0x4494('0x1bc'),_0x106577['text']));var _0x1a1a39=this[_0x4494('0x5b')][_0x4494('0x67')](this,_0x106577);if(_0x1a1a39){this[_0x4494('0xf')][_0x4494('0xa4')](util[_0x4494('0x50')](_0x4494('0x1bd'),_0x1a1a39));var _0x31a0eb=this[_0x4494('0xf')][_0x4494('0x100')](_0x1a1a39);try{fs[_0x4494('0x101')](_0x1a1a39+_0x4494('0x102'));}catch(_0x367f8d){logger[_0x4494('0x29')](_0x367f8d);}return _0x31a0eb;}return this['channel'][_0x4494('0x29')](_0x106577,_0x4494('0x1be'));};AGIVertices[_0x4494('0x14')]['unpause']=function(_0x48d15b){logger['info'](util[_0x4494('0x50')](_0x4494('0x1bf'),_0x48d15b['label']));if(!this[_0x4494('0x7d')](_0x48d15b[_0x4494('0x155')])){return this['channel'][_0x4494('0x29')](_0x48d15b,_0x4494('0x15c'));}logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x156'),this['channel']['callerid'],_0x48d15b[_0x4494('0x155')]));var _0x25912a=this[_0x4494('0x4c')][_0x4494('0x67')](this,_0x48d15b[_0x4494('0x155')]);if(_0x25912a){logger[_0x4494('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4494('0xf')][_0x4494('0x3a')],_0x48d15b[_0x4494('0x155')]));this[_0x4494('0xf')][_0x4494('0xa4')](util['format'](_0x4494('0x157'),this['channel'][_0x4494('0x3a')],_0x48d15b[_0x4494('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4494('0x50')](_0x4494('0x159'),this[_0x4494('0xf')][_0x4494('0x3a')],_0x48d15b[_0x4494('0x155')]));this[_0x4494('0xf')]['noop'](util[_0x4494('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x48d15b[_0x4494('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4494('0x14')][_0x4494('0x1c0')]=function(_0x181302){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x1c1'),_0x181302['label']));var _0x2172a1=this[_0x4494('0xf')]['exec'](_0x4494('0x1c2'),[_0x181302['mailbox'],_0x181302['options']]);if(_0x2172a1[_0x4494('0x9f')]===-0x1){return _0x2172a1;}return this['channel'][_0x4494('0xa4')](util[_0x4494('0x50')]('Executed\x20command\x20%s\x20%s',_0x4494('0x1c2'),_0x181302['mailbox']));};AGIVertices[_0x4494('0x14')][_0x4494('0x1c3')]=function(_0x404ad2){logger[_0x4494('0x2b')](util[_0x4494('0x50')](_0x4494('0x1c4'),_0x404ad2[_0x4494('0x37')]));if(!this['isConfigured'](_0x404ad2[_0x4494('0xd9')])){return this[_0x4494('0xf')]['error'](_0x404ad2,_0x4494('0x1a4'));}var _0xaec37d=this['getVariable'][_0x4494('0x67')](this,_0x404ad2[_0x4494('0xd9')]);if(!_0xaec37d){return this[_0x4494('0xf')][_0x4494('0x29')](_0x404ad2,_0x4494('0xda'));}var _0x579fcd=this[_0x4494('0xf')][_0x4494('0x9c')](_0xaec37d);return{'code':0xc8,'result':_0x579fcd['extra']?_0x579fcd[_0x4494('0x9d')]:'-'};};String['prototype'][_0x4494('0x9b')]=function(_0x4008fe,_0x182e49){return this[_0x4494('0x1c5')](_0x4008fe)[_0x4494('0x1c6')](_0x182e49);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3d7393b..b7f49a8 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 _0x2ef3=['transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','diff','seconds','prototype','updateAcw','timers','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','name','mandatoryDispositionPause','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x4cccae,_0x4b68a5){var _0x3833c3=function(_0x151ab3){while(--_0x151ab3){_0x4cccae['push'](_0x4cccae['shift']());}};_0x3833c3(++_0x4b68a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x36948a,_0xf70e7a){_0x36948a=_0x36948a-0x0;var _0x1d96e1=_0x2ef3[_0x36948a];return _0x1d96e1;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var ami=require(_0x32ef('0x2'));var logger=require(_0x32ef('0x3'))(_0x32ef('0x4'));var RpcUser=require(_0x32ef('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x38f865){this[_0x32ef('0x6')]=_0x38f865['voiceQueues'];this[_0x32ef('0x7')]=_0x38f865[_0x32ef('0x7')];this['timers']=_0x38f865['timers'];this[_0x32ef('0x8')]={};ami['on'](_0x32ef('0x9'),this[_0x32ef('0xa')][_0x32ef('0xb')](this));ami['on'](_0x32ef('0xc'),this[_0x32ef('0xd')][_0x32ef('0xb')](this));ami['on'](_0x32ef('0xe'),this[_0x32ef('0xf')][_0x32ef('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x32ef('0xb')](this));ami['on'](_0x32ef('0x10'),this[_0x32ef('0x11')][_0x32ef('0xb')](this));ami['on']('blindtransfer',this[_0x32ef('0x12')]['bind'](this));ami['on'](_0x32ef('0x13'),this['syncAgentConnectPreview'][_0x32ef('0xb')](this));}function getDiff(_0x1ef1ae){var _0x5c3eb9=moment()['milliseconds'](0x0);var _0x19ce1=moment(_0x1ef1ae)['milliseconds'](0x0);return _0x5c3eb9[_0x32ef('0x14')](_0x19ce1,_0x32ef('0x15'));}Acw[_0x32ef('0x16')][_0x32ef('0x17')]=function(_0x57aff1,_0x55bf0b){var _0x531e30=this;var _0x13db1a=getDiff(_0x531e30[_0x32ef('0x18')][_0x57aff1][_0x32ef('0x19')]);clearTimeout(_0x531e30['timers'][_0x57aff1]['timer']);_0x531e30[_0x32ef('0x18')][_0x57aff1][_0x32ef('0x1a')]=![];return RpcVoiceAgentReport[_0x32ef('0x1b')]({'acwtime':_0x13db1a},_0x531e30['timers'][_0x57aff1][_0x32ef('0x1c')],_0x57aff1)[_0x32ef('0x1d')](function(_0x4f4c98){logger[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x55bf0b,_0x13db1a,_0x4f4c98);})[_0x32ef('0x20')](function(_0x251084){logger[_0x32ef('0x21')](_0x32ef('0x22'),_0x55bf0b,_0x251084);})['finally'](function(){delete _0x531e30[_0x32ef('0x18')][_0x57aff1];});};Acw['prototype'][_0x32ef('0x23')]=function(_0x3a20ca){try{var _0x49f2d8=this;var _0x1af371=this[_0x32ef('0x8')][_0x3a20ca][_0x32ef('0x24')];var _0x55f7f2=this['channels'][_0x3a20ca][_0x32ef('0x25')];var _0xb30fab=this[_0x32ef('0x6')][_0x55f7f2];var _0x478bef=![];var _0x59585f=_0x32ef('0x26');if(_0xb30fab['mandatoryDisposition']&&_0xb30fab['mandatoryDispositionPause'][_0x32ef('0x27')]){_0x478bef=!![];_0x59585f=_0xb30fab[_0x32ef('0x28')][_0x32ef('0x27')];}if(!_0x49f2d8[_0x32ef('0x7')][_0x1af371]){return Promise[_0x32ef('0x29')]();}return RpcUser[_0x32ef('0x2a')](_0x49f2d8[_0x32ef('0x7')][_0x1af371]['id'])[_0x32ef('0x1d')](function(_0x338f19){if(!_0x338f19||_0x338f19[_0x32ef('0x2b')]){logger[_0x32ef('0x1e')](_0x32ef('0x2c'),_0x3a20ca,_0x1af371,_0x55f7f2);return;}logger['info'](_0x32ef('0x2d'),_0x3a20ca,_0x1af371,_0x55f7f2);var _0x2f5d06=_0x49f2d8['channels'][_0x3a20ca][_0x32ef('0x2e')]&&_0x49f2d8[_0x32ef('0x8')][_0x3a20ca][_0x32ef('0x2f')]?_0x49f2d8[_0x32ef('0x8')][_0x3a20ca]['destlinkedid']:_0x3a20ca;return RpcUser[_0x32ef('0x30')](_0x49f2d8[_0x32ef('0x7')][_0x1af371],_0x59585f,_0x2f5d06);})[_0x32ef('0x1d')](function(_0x2ac686){if(_0x478bef||!_0x2ac686){return;}_0x49f2d8[_0x32ef('0x18')][_0x1af371]={};logger[_0x32ef('0x1e')](_0x32ef('0x31'),_0x3a20ca,_0x49f2d8['voiceQueues'][_0x55f7f2][_0x32ef('0x32')],_0x1af371,_0x55f7f2);_0x49f2d8['timers'][_0x1af371][_0x32ef('0x1a')]=setTimeout(_0x49f2d8[_0x32ef('0x33')]['bind'](_0x49f2d8,_0x1af371),_0x49f2d8[_0x32ef('0x6')][_0x55f7f2][_0x32ef('0x32')]*0x3e8);_0x49f2d8[_0x32ef('0x18')][_0x1af371][_0x32ef('0x19')]=moment()[_0x32ef('0x34')]('YYYY-MM-DD\x20HH:mm:ss');_0x49f2d8['timers'][_0x1af371][_0x32ef('0x1c')]=_0x3a20ca;_0x49f2d8['timers'][_0x1af371][_0x32ef('0x25')]=_0x55f7f2;_0x49f2d8[_0x32ef('0x18')][_0x1af371][_0x32ef('0x17')]=_0x49f2d8[_0x32ef('0x17')][_0x32ef('0xb')](_0x49f2d8,_0x1af371,_0x3a20ca);})[_0x32ef('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3a20ca,_0x49f2d8['voiceQueues'][_0x55f7f2][_0x32ef('0x32')],_0x1af371,_0x55f7f2);})[_0x32ef('0x35')](function(){delete _0x49f2d8[_0x32ef('0x8')][_0x3a20ca];});}catch(_0x5f2443){logger['error'](_0x32ef('0x36'),_0x5f2443[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')]['stopAcw']=function(_0x4abbd6){try{var _0xcbdec8=this;if(_0xcbdec8[_0x32ef('0x18')][_0x4abbd6]){_0xcbdec8[_0x32ef('0x18')][_0x4abbd6][_0x32ef('0x1a')]=![];var _0x3a7c49=_0xcbdec8[_0x32ef('0x18')][_0x4abbd6][_0x32ef('0x1c')];var _0x21da90=_0xcbdec8[_0x32ef('0x18')][_0x4abbd6]['queue'];var _0x3a4a99=_0xcbdec8[_0x32ef('0x6')][_0x21da90][_0x32ef('0x32')];logger['info'](_0x32ef('0x38'),_0x3a7c49,_0x4abbd6);RpcUser[_0x32ef('0x39')](this[_0x32ef('0x7')][_0x4abbd6]);RpcVoiceAgentReport[_0x32ef('0x1b')]({'acwtime':_0x3a4a99,'agentacw':!![]},_0x3a7c49,_0x4abbd6)[_0x32ef('0x1d')](function(_0x33a0fb){logger[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x3a7c49,_0x3a4a99,_0x33a0fb);})[_0x32ef('0x20')](function(_0x57a3c0){logger[_0x32ef('0x21')](_0x32ef('0x22'),_0x3a7c49,_0x57a3c0);});}else{logger['error'](_0x32ef('0x3a'),_0x4abbd6);if(_0xcbdec8[_0x32ef('0x18')]){logger[_0x32ef('0x1e')](_0x32ef('0x3b'),JSON[_0x32ef('0x3c')](_0xcbdec8[_0x32ef('0x18')]));}}}catch(_0x3c0e44){logger['error']('[ACW][STOP]\x20%s',_0x3c0e44[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0xa')]=function(_0x765c63){try{if(this['voiceQueues'][_0x765c63[_0x32ef('0x25')]]&&(this[_0x32ef('0x6')][_0x765c63['queue']][_0x32ef('0x4')]||this['voiceQueues'][_0x765c63[_0x32ef('0x25')]][_0x32ef('0x3d')])){if(this[_0x32ef('0x7')][_0x765c63[_0x32ef('0x24')]]){this[_0x32ef('0x8')][_0x765c63[_0x32ef('0x1c')]]={'queue':_0x765c63[_0x32ef('0x25')],'interface':_0x765c63[_0x32ef('0x24')],'destlinkedid':_0x765c63[_0x32ef('0x2f')]};}}}catch(_0x37da36){logger['error'](_0x32ef('0x3e'),_0x37da36['message']);}};Acw[_0x32ef('0x16')][_0x32ef('0x3f')]=function(_0x2dd94f){try{if(this['voiceQueues'][_0x2dd94f[_0x32ef('0x25')]]&&(this[_0x32ef('0x6')][_0x2dd94f[_0x32ef('0x25')]][_0x32ef('0x4')]||this[_0x32ef('0x6')][_0x2dd94f[_0x32ef('0x25')]][_0x32ef('0x3d')])){if(this['agents'][_0x2dd94f['interface']]){this[_0x32ef('0x8')][_0x2dd94f[_0x32ef('0x1c')]]={'queue':_0x2dd94f[_0x32ef('0x25')],'interface':_0x2dd94f[_0x32ef('0x24')]};}}}catch(_0x209361){logger[_0x32ef('0x21')](_0x32ef('0x40'),_0x209361[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0xd')]=function(_0x35a294){try{if(this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x1c')]]&&_['isUndefined'](this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x1c')]][_0x32ef('0x2e')])){logger[_0x32ef('0x1e')](_0x32ef('0x41'),_0x35a294[_0x32ef('0x1c')]);this[_0x32ef('0x23')](_0x35a294[_0x32ef('0x1c')]);}else if(this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x42')]]&&_[_0x32ef('0x43')](this[_0x32ef('0x8')][_0x35a294[_0x32ef('0x42')]][_0x32ef('0x2e')])){logger[_0x32ef('0x1e')](_0x32ef('0x44'),_0x35a294[_0x32ef('0x42')]);this[_0x32ef('0x23')](_0x35a294['linkedid']);}}catch(_0x515ac9){logger[_0x32ef('0x21')](_0x32ef('0x45'),_0x515ac9[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0xf')]=function(_0x42fc82){try{if(this[_0x32ef('0x8')][_0x42fc82[_0x32ef('0x1c')]]&&this[_0x32ef('0x8')][_0x42fc82[_0x32ef('0x1c')]][_0x32ef('0x2e')]){logger['info'](_0x32ef('0x46'),_0x42fc82[_0x32ef('0x1c')]);this[_0x32ef('0x23')](_0x42fc82[_0x32ef('0x1c')]);}else if(this[_0x32ef('0x8')][_0x42fc82[_0x32ef('0x42')]]&&this['channels'][_0x42fc82[_0x32ef('0x42')]][_0x32ef('0x2e')]){logger[_0x32ef('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x42fc82[_0x32ef('0x42')]);this['startAcw'](_0x42fc82[_0x32ef('0x42')]);}}catch(_0xbe35b){logger['error'](_0x32ef('0x47'),_0xbe35b['message']);}};Acw[_0x32ef('0x16')][_0x32ef('0x11')]=function(_0x2bff39){try{if(!_[_0x32ef('0x48')](this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x49')]])){this[_0x32ef('0x23')](_0x2bff39['transfereeuniqueid']);if(this['channels'][_0x2bff39[_0x32ef('0x4a')]]){this['channels'][_0x2bff39['secondtransfereruniqueid']][_0x32ef('0x2e')]=!![];this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4b')]]=this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4a')]];delete this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4a')]];}}else if(!_[_0x32ef('0x48')](this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4b')]])){this['startAcw'](_0x2bff39['transfertargetuniqueid']);if(this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4c')]]){this['channels'][_0x2bff39[_0x32ef('0x4c')]][_0x32ef('0x2e')]=!![];this[_0x32ef('0x8')][_0x2bff39['transfereeuniqueid']]=this[_0x32ef('0x8')][_0x2bff39[_0x32ef('0x4c')]];delete this[_0x32ef('0x8')][_0x2bff39['origtransfereruniqueid']];}}}catch(_0x5e6030){logger[_0x32ef('0x21')]('[ACW][syncAttendedTransfer]\x20%s',_0x5e6030[_0x32ef('0x37')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x24cf09){try{if(this[_0x32ef('0x8')][_0x24cf09[_0x32ef('0x4d')]]){logger['info'](_0x32ef('0x4e'),JSON[_0x32ef('0x3c')](_0x24cf09[_0x32ef('0x4d')]));this['startAcw'](_0x24cf09[_0x32ef('0x4d')]);}else if(this[_0x32ef('0x8')][_0x24cf09['transfererlinkedid']]){logger['info'](_0x32ef('0x4f'),JSON[_0x32ef('0x3c')](_0x24cf09[_0x32ef('0x50')]));this[_0x32ef('0x23')](_0x24cf09[_0x32ef('0x50')]);}}catch(_0x40700e){logger['error'](_0x32ef('0x51'),_0x40700e[_0x32ef('0x37')]);}};Acw[_0x32ef('0x16')][_0x32ef('0x52')]=function(_0x21e930){try{if(this[_0x32ef('0x6')][_0x21e930[_0x32ef('0x25')]]&&this[_0x32ef('0x6')][_0x21e930[_0x32ef('0x25')]]['autopause']===_0x32ef('0x53')){if(this[_0x32ef('0x7')][_0x21e930[_0x32ef('0x24')]]){logger[_0x32ef('0x1e')](_0x32ef('0x54'),_0x21e930['uniqueid'],_0x21e930['interface'],_0x21e930[_0x32ef('0x25')]);return RpcUser[_0x32ef('0x30')](this[_0x32ef('0x7')][_0x21e930[_0x32ef('0x24')]],_0x32ef('0x55'),_0x21e930['uniqueid']);}}}catch(_0x3372d9){logger['error'](_0x32ef('0x56'),_0x3372d9[_0x32ef('0x37')]);}};module['exports']=Acw; \ No newline at end of file +var _0x82c4=['[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','syncHangupRequest','uniqueid','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','interface','queue','ACW','name','mandatoryDispositionPause','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message','saveUnpause'];(function(_0x21c601,_0x26f456){var _0xd423f=function(_0x52bc27){while(--_0x52bc27){_0x21c601['push'](_0x21c601['shift']());}};_0xd423f(++_0x26f456);}(_0x82c4,0x1ca));var _0x482c=function(_0x5f2f93,_0x1d772b){_0x5f2f93=_0x5f2f93-0x0;var _0x2a3d1b=_0x82c4[_0x5f2f93];return _0x2a3d1b;};'use strict';var _=require(_0x482c('0x0'));var moment=require(_0x482c('0x1'));var ami=require(_0x482c('0x2'));var logger=require(_0x482c('0x3'))(_0x482c('0x4'));var RpcUser=require(_0x482c('0x5'));var RpcVoiceAgentReport=require(_0x482c('0x6'));function Acw(_0x56de13){this[_0x482c('0x7')]=_0x56de13['voiceQueues'];this[_0x482c('0x8')]=_0x56de13['agents'];this[_0x482c('0x9')]=_0x56de13['timers'];this[_0x482c('0xa')]={};ami['on'](_0x482c('0xb'),this[_0x482c('0xc')][_0x482c('0xd')](this));ami['on'](_0x482c('0xe'),this['syncHangupRequest'][_0x482c('0xd')](this));ami['on'](_0x482c('0xf'),this[_0x482c('0x10')][_0x482c('0xd')](this));ami['on'](_0x482c('0x11'),this[_0x482c('0x12')]['bind'](this));ami['on'](_0x482c('0x13'),this[_0x482c('0x14')][_0x482c('0xd')](this));ami['on']('blindtransfer',this[_0x482c('0x15')][_0x482c('0xd')](this));ami['on'](_0x482c('0x16'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x7b12cf){var _0x30e02b=moment()['milliseconds'](0x0);var _0x56ee17=moment(_0x7b12cf)[_0x482c('0x17')](0x0);return _0x30e02b[_0x482c('0x18')](_0x56ee17,_0x482c('0x19'));}Acw[_0x482c('0x1a')][_0x482c('0x1b')]=function(_0x119635,_0x3beedb){var _0xf65563=this;var _0x3fc79c=getDiff(_0xf65563[_0x482c('0x9')][_0x119635][_0x482c('0x1c')]);clearTimeout(_0xf65563[_0x482c('0x9')][_0x119635]['timer']);_0xf65563[_0x482c('0x9')][_0x119635]['timer']=![];return RpcVoiceAgentReport[_0x482c('0x1d')]({'acwtime':_0x3fc79c},_0xf65563[_0x482c('0x9')][_0x119635]['uniqueid'],_0x119635)['then'](function(_0x357965){logger['info'](_0x482c('0x1e'),_0x3beedb,_0x3fc79c,_0x357965);})[_0x482c('0x1f')](function(_0x281c60){logger[_0x482c('0x20')]('[%s][UPDATE][ERRORS:%s]',_0x3beedb,_0x281c60);})[_0x482c('0x21')](function(){delete _0xf65563[_0x482c('0x9')][_0x119635];});};Acw[_0x482c('0x1a')][_0x482c('0x22')]=function(_0x14d832){try{var _0x58ed18=this;var _0x4afcd9=this[_0x482c('0xa')][_0x14d832][_0x482c('0x23')];var _0x180feb=this['channels'][_0x14d832][_0x482c('0x24')];var _0x579d2f=this[_0x482c('0x7')][_0x180feb];var _0xc2df7=![];var _0x4f1108=_0x482c('0x25');if(_0x579d2f['mandatoryDisposition']&&_0x579d2f['mandatoryDispositionPause'][_0x482c('0x26')]){_0xc2df7=!![];_0x4f1108=_0x579d2f[_0x482c('0x27')][_0x482c('0x26')];}if(!_0x58ed18[_0x482c('0x8')][_0x4afcd9]){return Promise[_0x482c('0x28')]();}return RpcUser[_0x482c('0x29')](_0x58ed18[_0x482c('0x8')][_0x4afcd9]['id'])['then'](function(_0xb65836){if(!_0xb65836||_0xb65836[_0x482c('0x2a')]){logger['info'](_0x482c('0x2b'),_0x14d832,_0x4afcd9,_0x180feb);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x14d832,_0x4afcd9,_0x180feb);var _0x207441=_0x58ed18['channels'][_0x14d832][_0x482c('0x2c')]&&_0x58ed18[_0x482c('0xa')][_0x14d832][_0x482c('0x2d')]?_0x58ed18[_0x482c('0xa')][_0x14d832][_0x482c('0x2d')]:_0x14d832;return RpcUser[_0x482c('0x2e')](_0x58ed18[_0x482c('0x8')][_0x4afcd9],_0x4f1108,_0x207441);})[_0x482c('0x2f')](function(_0x24b4df){if(_0xc2df7||!_0x24b4df){return;}_0x58ed18[_0x482c('0x9')][_0x4afcd9]={};logger[_0x482c('0x30')](_0x482c('0x31'),_0x14d832,_0x58ed18[_0x482c('0x7')][_0x180feb][_0x482c('0x32')],_0x4afcd9,_0x180feb);_0x58ed18[_0x482c('0x9')][_0x4afcd9][_0x482c('0x33')]=setTimeout(_0x58ed18[_0x482c('0x34')][_0x482c('0xd')](_0x58ed18,_0x4afcd9),_0x58ed18['voiceQueues'][_0x180feb]['acwTimeout']*0x3e8);_0x58ed18['timers'][_0x4afcd9][_0x482c('0x1c')]=moment()[_0x482c('0x35')](_0x482c('0x36'));_0x58ed18[_0x482c('0x9')][_0x4afcd9]['uniqueid']=_0x14d832;_0x58ed18[_0x482c('0x9')][_0x4afcd9]['queue']=_0x180feb;_0x58ed18[_0x482c('0x9')][_0x4afcd9][_0x482c('0x1b')]=_0x58ed18[_0x482c('0x1b')][_0x482c('0xd')](_0x58ed18,_0x4afcd9,_0x14d832);})[_0x482c('0x1f')](function(){logger[_0x482c('0x20')](_0x482c('0x31'),_0x14d832,_0x58ed18[_0x482c('0x7')][_0x180feb]['acwTimeout'],_0x4afcd9,_0x180feb);})['finally'](function(){delete _0x58ed18[_0x482c('0xa')][_0x14d832];});}catch(_0x4a4756){logger[_0x482c('0x20')](_0x482c('0x37'),_0x4a4756[_0x482c('0x38')]);}};Acw['prototype'][_0x482c('0x34')]=function(_0x2131a8){try{var _0x67cde9=this;if(_0x67cde9[_0x482c('0x9')][_0x2131a8]){_0x67cde9['timers'][_0x2131a8][_0x482c('0x33')]=![];var _0x52a610=_0x67cde9[_0x482c('0x9')][_0x2131a8]['uniqueid'];var _0x234bd2=_0x67cde9['timers'][_0x2131a8][_0x482c('0x24')];var _0x6778d5=_0x67cde9['voiceQueues'][_0x234bd2][_0x482c('0x32')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x52a610,_0x2131a8);RpcUser[_0x482c('0x39')](this['agents'][_0x2131a8]);RpcVoiceAgentReport['update']({'acwtime':_0x6778d5,'agentacw':!![]},_0x52a610,_0x2131a8)['then'](function(_0x581757){logger[_0x482c('0x30')](_0x482c('0x1e'),_0x52a610,_0x6778d5,_0x581757);})[_0x482c('0x1f')](function(_0x2fbcec){logger[_0x482c('0x20')]('[%s][UPDATE][ERRORS:%s]',_0x52a610,_0x2fbcec);});}else{logger[_0x482c('0x20')](_0x482c('0x3a'),_0x2131a8);if(_0x67cde9[_0x482c('0x9')]){logger[_0x482c('0x30')]('[ACW][TIMERS]',JSON['stringify'](_0x67cde9[_0x482c('0x9')]));}}}catch(_0x44bedf){logger[_0x482c('0x20')](_0x482c('0x3b'),_0x44bedf[_0x482c('0x38')]);}};Acw[_0x482c('0x1a')][_0x482c('0xc')]=function(_0x2cea98){try{if(this[_0x482c('0x7')][_0x2cea98[_0x482c('0x24')]]&&(this[_0x482c('0x7')][_0x2cea98['queue']][_0x482c('0x4')]||this[_0x482c('0x7')][_0x2cea98[_0x482c('0x24')]][_0x482c('0x3c')])){if(this[_0x482c('0x8')][_0x2cea98[_0x482c('0x23')]]){this[_0x482c('0xa')][_0x2cea98['uniqueid']]={'queue':_0x2cea98['queue'],'interface':_0x2cea98[_0x482c('0x23')],'destlinkedid':_0x2cea98[_0x482c('0x2d')]};}}}catch(_0xbece12){logger['error'](_0x482c('0x3d'),_0xbece12['message']);}};Acw[_0x482c('0x1a')][_0x482c('0x3e')]=function(_0x2538b3){try{if(this[_0x482c('0x7')][_0x2538b3['queue']]&&(this[_0x482c('0x7')][_0x2538b3[_0x482c('0x24')]][_0x482c('0x4')]||this['voiceQueues'][_0x2538b3[_0x482c('0x24')]][_0x482c('0x3c')])){if(this[_0x482c('0x8')][_0x2538b3['interface']]){this['channels'][_0x2538b3['uniqueid']]={'queue':_0x2538b3['queue'],'interface':_0x2538b3['interface']};}}}catch(_0x56b6c5){logger[_0x482c('0x20')]('[ACW][syncAgentConnectPreview]\x20%s',_0x56b6c5[_0x482c('0x38')]);}};Acw[_0x482c('0x1a')][_0x482c('0x3f')]=function(_0x2fa930){try{if(this[_0x482c('0xa')][_0x2fa930[_0x482c('0x40')]]&&_[_0x482c('0x41')](this[_0x482c('0xa')][_0x2fa930[_0x482c('0x40')]][_0x482c('0x2c')])){logger[_0x482c('0x30')](_0x482c('0x42'),_0x2fa930[_0x482c('0x40')]);this[_0x482c('0x22')](_0x2fa930[_0x482c('0x40')]);}else if(this[_0x482c('0xa')][_0x2fa930[_0x482c('0x43')]]&&_[_0x482c('0x41')](this[_0x482c('0xa')][_0x2fa930['linkedid']][_0x482c('0x2c')])){logger[_0x482c('0x30')]('[%s][HANGUP:LINKEDID]',_0x2fa930[_0x482c('0x43')]);this[_0x482c('0x22')](_0x2fa930[_0x482c('0x43')]);}}catch(_0x170310){logger[_0x482c('0x20')]('[ACW][syncHangupRequest]\x20%s',_0x170310['message']);}};Acw[_0x482c('0x1a')][_0x482c('0x10')]=function(_0x430a86){try{if(this[_0x482c('0xa')][_0x430a86[_0x482c('0x40')]]&&this[_0x482c('0xa')][_0x430a86[_0x482c('0x40')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x430a86[_0x482c('0x40')]);this[_0x482c('0x22')](_0x430a86[_0x482c('0x40')]);}else if(this[_0x482c('0xa')][_0x430a86[_0x482c('0x43')]]&&this[_0x482c('0xa')][_0x430a86[_0x482c('0x43')]][_0x482c('0x2c')]){logger[_0x482c('0x30')](_0x482c('0x44'),_0x430a86[_0x482c('0x43')]);this['startAcw'](_0x430a86[_0x482c('0x43')]);}}catch(_0x3e7c52){logger[_0x482c('0x20')](_0x482c('0x45'),_0x3e7c52[_0x482c('0x38')]);}};Acw[_0x482c('0x1a')][_0x482c('0x14')]=function(_0x273bf2){try{if(!_[_0x482c('0x46')](this[_0x482c('0xa')][_0x273bf2[_0x482c('0x47')]])){this[_0x482c('0x22')](_0x273bf2['transfereeuniqueid']);if(this['channels'][_0x273bf2[_0x482c('0x48')]]){this[_0x482c('0xa')][_0x273bf2[_0x482c('0x48')]][_0x482c('0x2c')]=!![];this[_0x482c('0xa')][_0x273bf2[_0x482c('0x49')]]=this['channels'][_0x273bf2[_0x482c('0x48')]];delete this[_0x482c('0xa')][_0x273bf2[_0x482c('0x48')]];}}else if(!_[_0x482c('0x46')](this[_0x482c('0xa')][_0x273bf2[_0x482c('0x49')]])){this[_0x482c('0x22')](_0x273bf2[_0x482c('0x49')]);if(this[_0x482c('0xa')][_0x273bf2[_0x482c('0x4a')]]){this[_0x482c('0xa')][_0x273bf2[_0x482c('0x4a')]]['attended']=!![];this[_0x482c('0xa')][_0x273bf2['transfereeuniqueid']]=this[_0x482c('0xa')][_0x273bf2[_0x482c('0x4a')]];delete this[_0x482c('0xa')][_0x273bf2[_0x482c('0x4a')]];}}}catch(_0x8db0fe){logger[_0x482c('0x20')]('[ACW][syncAttendedTransfer]\x20%s',_0x8db0fe[_0x482c('0x38')]);}};Acw[_0x482c('0x1a')]['syncBlindTransfer']=function(_0x49fb5f){try{if(this[_0x482c('0xa')][_0x49fb5f[_0x482c('0x4b')]]){logger['info'](_0x482c('0x4c'),JSON[_0x482c('0x4d')](_0x49fb5f[_0x482c('0x4b')]));this[_0x482c('0x22')](_0x49fb5f['transfereruniqueid']);}else if(this[_0x482c('0xa')][_0x49fb5f[_0x482c('0x4e')]]){logger[_0x482c('0x30')](_0x482c('0x4f'),JSON[_0x482c('0x4d')](_0x49fb5f[_0x482c('0x4e')]));this['startAcw'](_0x49fb5f['transfererlinkedid']);}}catch(_0x2cace1){logger[_0x482c('0x20')](_0x482c('0x50'),_0x2cace1['message']);}};Acw[_0x482c('0x1a')][_0x482c('0x12')]=function(_0x48724c){try{if(this[_0x482c('0x7')][_0x48724c[_0x482c('0x24')]]&&this[_0x482c('0x7')][_0x48724c[_0x482c('0x24')]][_0x482c('0x51')]===_0x482c('0x52')){if(this['agents'][_0x48724c['interface']]){logger[_0x482c('0x30')](_0x482c('0x53'),_0x48724c['uniqueid'],_0x48724c['interface'],_0x48724c[_0x482c('0x24')]);return RpcUser[_0x482c('0x2e')](this[_0x482c('0x8')][_0x48724c['interface']],'Auto-Pause',_0x48724c['uniqueid']);}}}catch(_0x64f27e){logger[_0x482c('0x20')](_0x482c('0x54'),_0x64f27e[_0x482c('0x38')]);}};module[_0x482c('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f3f828a..dfa2d3b 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 _0x6d78=['once','close','connect','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x24b131,_0x177a65){var _0x5e7699=function(_0x1897db){while(--_0x1897db){_0x24b131['push'](_0x24b131['shift']());}};_0x5e7699(++_0x177a65);}(_0x6d78,0x13e));var _0x86d7=function(_0x239eaf,_0x1968b4){_0x239eaf=_0x239eaf-0x0;var _0x8863f7=_0x6d78[_0x239eaf];return _0x8863f7;};'use strict';var Manager=require(_0x86d7('0x0'));var BPromise=require(_0x86d7('0x1'));var util=require(_0x86d7('0x2'));var logger=require(_0x86d7('0x3'))('ami');var config=require(_0x86d7('0x4'));var ami=new Manager(config[_0x86d7('0x5')][_0x86d7('0x6')],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')][_0x86d7('0x7')],config['asterisk'][_0x86d7('0x8')],!![]);ami[_0x86d7('0x9')]();ami[_0x86d7('0xa')]=BPromise[_0x86d7('0xb')](ami['action']);function error(_0x4c97e0){logger['error'](util[_0x86d7('0xc')](_0x86d7('0xd'),config[_0x86d7('0x5')][_0x86d7('0x7')],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')][_0x86d7('0x6')],util['inspect'](_0x4c97e0,![],null)));}function close(){logger[_0x86d7('0xe')](util[_0x86d7('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x86d7('0x5')]['username'],config['asterisk']['ip'],config[_0x86d7('0x5')][_0x86d7('0x6')]));}ami[_0x86d7('0xf')]=function(){return function(){return ami[_0x86d7('0xa')]({'action':_0x86d7('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x86d7('0x11')]=function(){return function(){return ami[_0x86d7('0xa')]({'action':_0x86d7('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x86d7('0xa')]({'action':'queuesummary'});};};ami[_0x86d7('0x13')]=function(){return function(){return ami[_0x86d7('0xa')]({'action':'coreshowchannels'});};};function connect(){logger[_0x86d7('0x14')](util[_0x86d7('0xc')](_0x86d7('0x15'),config[_0x86d7('0x5')]['username'],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')]['port']));ami[_0x86d7('0x16')](_0x86d7('0xe'),error);ami[_0x86d7('0x16')](_0x86d7('0x17'),close);}ami['on'](_0x86d7('0x18'),connect);ami['on'](_0x86d7('0x19'),function(_0x36f995){logger[_0x86d7('0x14')](util[_0x86d7('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x86d7('0x5')][_0x86d7('0x7')],config['asterisk']['ip'],config['asterisk'][_0x86d7('0x6')],util['inspect'](_0x36f995,![],null)));});ami['on']('fullybooted',function(){logger[_0x86d7('0x14')](util['format'](_0x86d7('0x1a'),config[_0x86d7('0x5')][_0x86d7('0x7')],config[_0x86d7('0x5')]['ip'],config[_0x86d7('0x5')][_0x86d7('0x6')]));return Promise[_0x86d7('0x1b')]()[_0x86d7('0x1c')](ami[_0x86d7('0xf')]())['then'](ami[_0x86d7('0x1d')]())['then'](ami[_0x86d7('0x11')]())[_0x86d7('0x1c')](ami[_0x86d7('0x1e')]())['then'](ami[_0x86d7('0x13')]())[_0x86d7('0x1f')](function(_0x55d546){logger[_0x86d7('0xe')](_0x86d7('0x20'),util['inspect'](_0x55d546,{'showHidden':![],'depth':null}));});});ami[_0x86d7('0x16')]('error',error);ami[_0x86d7('0x16')](_0x86d7('0x17'),close);module[_0x86d7('0x21')]=ami; \ No newline at end of file +var _0xcbba=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','shutdown','info','fullybooted','resolve','then','actionDeviceStateList','[ami.js][fullybooted]','once','asterisk-manager','bluebird','util','ami','port','asterisk','username','password','Action','promisify','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x213b74,_0x46786a){var _0x31a624=function(_0x1d7b7e){while(--_0x1d7b7e){_0x213b74['push'](_0x213b74['shift']());}};_0x31a624(++_0x46786a);}(_0xcbba,0x78));var _0xacbb=function(_0x465f9c,_0x3b6ab4){_0x465f9c=_0x465f9c-0x0;var _0x5e25b6=_0xcbba[_0x465f9c];return _0x5e25b6;};'use strict';var Manager=require(_0xacbb('0x0'));var BPromise=require(_0xacbb('0x1'));var util=require(_0xacbb('0x2'));var logger=require('../../config/logger')(_0xacbb('0x3'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0xacbb('0x4')],config[_0xacbb('0x5')]['ip'],config[_0xacbb('0x5')][_0xacbb('0x6')],config[_0xacbb('0x5')][_0xacbb('0x7')],!![]);ami['keepConnected']();ami[_0xacbb('0x8')]=BPromise[_0xacbb('0x9')](ami[_0xacbb('0xa')]);function error(_0x43985a){logger[_0xacbb('0xb')](util[_0xacbb('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xacbb('0x6')],config[_0xacbb('0x5')]['ip'],config[_0xacbb('0x5')]['port'],util[_0xacbb('0xd')](_0x43985a,![],null)));}function close(){logger['error'](util['format'](_0xacbb('0xe'),config['asterisk'][_0xacbb('0x6')],config[_0xacbb('0x5')]['ip'],config[_0xacbb('0x5')][_0xacbb('0x4')]));}ami[_0xacbb('0xf')]=function(){return function(){return ami[_0xacbb('0x8')]({'action':_0xacbb('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xacbb('0x8')]({'action':_0xacbb('0x11')});};};ami[_0xacbb('0x12')]=function(){return function(){return ami[_0xacbb('0x8')]({'action':_0xacbb('0x13')});};};ami[_0xacbb('0x14')]=function(){return function(){return ami[_0xacbb('0x8')]({'action':_0xacbb('0x15')});};};ami[_0xacbb('0x16')]=function(){return function(){return ami[_0xacbb('0x8')]({'action':_0xacbb('0x17')});};};function connect(){logger['info'](util['format'](_0xacbb('0x18'),config[_0xacbb('0x5')]['username'],config[_0xacbb('0x5')]['ip'],config[_0xacbb('0x5')][_0xacbb('0x4')]));ami['once'](_0xacbb('0xb'),error);ami['once'](_0xacbb('0x19'),close);}ami['on'](_0xacbb('0x1a'),connect);ami['on'](_0xacbb('0x1b'),function(_0x3ae68f){logger[_0xacbb('0x1c')](util[_0xacbb('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xacbb('0x6')],config[_0xacbb('0x5')]['ip'],config[_0xacbb('0x5')][_0xacbb('0x4')],util[_0xacbb('0xd')](_0x3ae68f,![],null)));});ami['on'](_0xacbb('0x1d'),function(){logger[_0xacbb('0x1c')](util[_0xacbb('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xacbb('0x6')],config['asterisk']['ip'],config[_0xacbb('0x5')][_0xacbb('0x4')]));return Promise[_0xacbb('0x1e')]()[_0xacbb('0x1f')](ami[_0xacbb('0xf')]())['then'](ami[_0xacbb('0x20')]())[_0xacbb('0x1f')](ami[_0xacbb('0x12')]())[_0xacbb('0x1f')](ami[_0xacbb('0x14')]())['then'](ami[_0xacbb('0x16')]())['catch'](function(_0x203727){logger[_0xacbb('0xb')](_0xacbb('0x21'),util['inspect'](_0x203727,{'showHidden':![],'depth':null}));});});ami[_0xacbb('0x22')](_0xacbb('0xb'),error);ami[_0xacbb('0x22')](_0xacbb('0x19'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index e1e43fc..0912be2 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb7e7[_0x36eaaa];return _0x461349;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x23cb8c,_0xc0e298){var _0x377f09=function(_0x3c9e9c){while(--_0x3c9e9c){_0x23cb8c['push'](_0x23cb8c['shift']());}};_0x377f09(++_0xc0e298);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4b1d57,_0x101d9e){_0x4b1d57=_0x4b1d57-0x0;var _0x290d23=_0x9ffd[_0x4b1d57];return _0x290d23;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 569b0aa..e8879cd 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 _0xd875=['setXMDContactVariables','Contact','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','erlangAbandonmentRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[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(','talking','predictiveIntervalHitRate','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','queueStatusComplete','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactEmpty','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','temp','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','[ifTime][Action]','stringify','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','timezones','then','content','indexOf','catch','command','true','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','resolve','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','dialPowerLevel','handlePower','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','syncAgentConnect','queue','uniqueid','updateOriginated','answertime','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','countdropretry','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','preview','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','syncVarSet','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','getVoiceQueueRtPauses','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','actionOriginate','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID'];(function(_0x5b593a,_0xdc32aa){var _0x494058=function(_0x928b59){while(--_0x928b59){_0x5b593a['push'](_0x5b593a['shift']());}};_0x494058(++_0xdc32aa);}(_0xd875,0xac));var _0x5d87=function(_0x4e8dfc,_0x448b97){_0x4e8dfc=_0x4e8dfc-0x0;var _0x3c47e0=_0xd875[_0x4e8dfc];return _0x3c47e0;};'use strict';var util=require(_0x5d87('0x0'));var _=require(_0x5d87('0x1'));var uuid=require(_0x5d87('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x5d87('0x3'));var utils=require(_0x5d87('0x4'));var hopperUtils=require(_0x5d87('0x5'));var ut=require(_0x5d87('0x6'));var config=require(_0x5d87('0x7'));var logger=require(_0x5d87('0x8'))(_0x5d87('0x9'));var loggerBooked=require(_0x5d87('0x8'))(_0x5d87('0xa'));var loggerPredictive=require(_0x5d87('0x8'))(_0x5d87('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x5d87('0xc'));var loggerSyncQueueSummary=require(_0x5d87('0x8'))(_0x5d87('0xd'));var ami=require('../ami');config[_0x5d87('0xe')]=_[_0x5d87('0xf')](config[_0x5d87('0xe')],{'host':_0x5d87('0x10'),'port':0x18eb});var io=require(_0x5d87('0x11'))(new Redis(config[_0x5d87('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x5d87('0x12'));var RpcSetting=require(_0x5d87('0x13'));var Interval=require(_0x5d87('0x14'));var Action=require('./models/action');var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x5d87('0x15'));var QueueCallerAbandon=require(_0x5d87('0x16'));var Hangup=require(_0x5d87('0x17'));var ipAgi=process[_0x5d87('0x18')][_0x5d87('0x19')]||_0x5d87('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5d87('0x1b')][_0x5d87('0x1c')]=function(_0x5445cc){this[_0x5d87('0x1d')]=this[_0x5d87('0x1d')]?this[_0x5d87('0x1d')][_0x5d87('0x1e')](_0x5445cc):_0x5445cc();};function Dialer(_0x1304cd,_0x492c93){this[_0x5d87('0x1f')]=new Sequence();this['preview']=_0x492c93;this[_0x5d87('0x20')]=_0x1304cd['voiceQueues'];this[_0x5d87('0x21')]=_0x1304cd[_0x5d87('0x21')];this[_0x5d87('0x22')]=_0x1304cd[_0x5d87('0x22')];this['trunks']=_0x1304cd[_0x5d87('0x23')];this[_0x5d87('0x24')]=config['maxNumberOriginate']||0x2;this[_0x5d87('0x25')]={};this[_0x5d87('0x26')]={};this['contactsId']={};this[_0x5d87('0x27')]={};this[_0x5d87('0x28')]={};this[_0x5d87('0x29')]={};this[_0x5d87('0x2a')]={};this[_0x5d87('0x2b')]={};this[_0x5d87('0x2c')]={};this['queueBookedRR']={};this[_0x5d87('0x2d')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x2f'),this[_0x5d87('0x30')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x31'),this[_0x5d87('0x32')][_0x5d87('0x2e')](this));ami['on']('agentcomplete',this[_0x5d87('0x33')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x34'),this[_0x5d87('0xd')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x35'),this[_0x5d87('0x36')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x37'),this[_0x5d87('0x38')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x39'),this[_0x5d87('0x3a')][_0x5d87('0x2e')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('queuemember',this[_0x5d87('0x3b')][_0x5d87('0x2e')](this));ami['on'](_0x5d87('0x3c'),this[_0x5d87('0x3d')][_0x5d87('0x2e')](this));this[_0x5d87('0x3e')]();this[_0x5d87('0x3f')]();RpcSetting[_0x5d87('0x40')]()['then'](function(_0x7c290f){previewRecallmeReminderInterval=_0x7c290f[_0x5d87('0x41')];});}function isNotNull(_0x1fbf7b){return _0x1fbf7b!==null&&!_[_0x5d87('0x42')](_0x1fbf7b);}function msgResponse(_0x3cd327,_0x1ef22f,_0x2c4376){return{'action':_0x3cd327,'response':_0x1ef22f,'message':_0x2c4376,'stack':_0x2c4376};}function emit(_0x108f89,_0x4603f2,_0x2825df){io['to'](_0x108f89)[_0x5d87('0x43')](_0x4603f2,_0x2825df);}function emitOutboundVoiceQueueSummary(_0x3223ea){if(_0x3223ea[_0x5d87('0x44')]===_0x5d87('0x45')){logger[_0x5d87('0x46')](_0x5d87('0x47'),util['inspect'](_0x3223ea,{'showHidden':![],'depth':null}));emit(util[_0x5d87('0x48')]('voice:queue:%s',_0x3223ea[_0x5d87('0x49')]),_0x5d87('0x4a'),_0x3223ea);}}function checkGetDataPredictive(_0x597a40){if(isNotNull(_0x597a40)&&!_[_0x5d87('0x4b')](_0x597a40)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x5d87('0x4c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597a40[_0x5d87('0x4d')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597a40[_0x5d87('0x4e')]);loggerPredictive['info'](_0x5d87('0x4f'),_0x597a40[_0x5d87('0x50')]);loggerPredictive[_0x5d87('0x4c')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597a40['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x51'),_0x597a40[_0x5d87('0x52')]);loggerPredictive['info'](_0x5d87('0x53'),_0x597a40[_0x5d87('0x54')]);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));if(_0x597a40[_0x5d87('0x4d')]>0x0){if(!_['isUndefined'](_0x597a40['predictiveIntervalAvgTalktime'])&&_0x597a40[_0x5d87('0x54')]>0x0){return!![];}loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x56'));if(!_[_0x5d87('0x42')](_0x597a40[_0x5d87('0x52')])&&_0x597a40[_0x5d87('0x52')]>0x0){return!![];}loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x57'));}else{loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x58'));}}else{loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x59'));}return![];}function mergeDataErlangB(_0xac1944){return function(_0x58a33a){loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x5a'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58a33a['erlangCalls']);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x5b'),_0x58a33a[_0x5d87('0x5c')]);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x5d'),_0x58a33a['erlangAbandonmentRate']);loggerPredictive['info'](_0x5d87('0x5e'),_0x58a33a[_0x5d87('0x5f')]);loggerPredictive[_0x5d87('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58a33a['erlangAbandonmentRate']);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));_[_0x5d87('0x60')](_0xac1944,_0x58a33a);};}function ifInterval(_0x16241d,_0x301d0d){if(_[_0x5d87('0x42')](_0x301d0d)){return![];}return utils[_0x5d87('0x61')](undefined,_0x301d0d)<_0x16241d*0x3c;}function clearPredictiveAttributes(_0x152233){if(_0x152233['startProgressive']){_0x152233['startProgressive']=undefined;loggerPredictive[_0x5d87('0x46')](_0x152233[_0x5d87('0x49')],'startProgressive\x20value\x20cleared');}if(_0x152233[_0x5d87('0x29')]){_0x152233[_0x5d87('0x29')]=undefined;loggerPredictive[_0x5d87('0x46')](_0x152233[_0x5d87('0x49')],_0x5d87('0x62'));}if(_0x152233[_0x5d87('0x63')]){clearInterval(_0x152233[_0x5d87('0x63')]);_0x152233[_0x5d87('0x63')]=undefined;loggerPredictive['debug'](_0x152233[_0x5d87('0x49')],_0x5d87('0x64'));}}function loggerCatchPredictive(_0x570549,_0x5e74bb){return function(_0x30280d){loggerPredictive[_0x5d87('0x65')](_0x5e74bb['name'],_0x570549);loggerPredictive[_0x5d87('0x65')](_0x30280d[_0x5d87('0x66')]);clearPredictiveAttributes(_0x5e74bb);};}function loggerCatch(_0xbb0d53){return function(_0x471c43){logger[_0x5d87('0x65')](_0xbb0d53,util['inspect'](_0x471c43,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x350ecc,_0xcec190,_0xcbb53a){return function(_0x1a0d35){utils['checkContactLowerLimitOriginate'](_0xcec190,_0xcbb53a,0x0);_0xcec190[_0x5d87('0x67')]=0x0;logger['error'](_0x350ecc,util[_0x5d87('0x68')](_0x1a0d35,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3d097d){return function(_0x1d9fbd){if(isNotNull(_0x1d9fbd)&&isNotNull(_0x1d9fbd[0x0])){if(_0x1d9fbd[0x0][_0x5d87('0x69')]>0x0){_0x3d097d[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x6c')];logger['info'](_0x5d87('0x6d')+_0x3d097d[_0x5d87('0x49')],_0x1d9fbd[0x0][_0x5d87('0x69')],'contacts');}else{_0x3d097d[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x6e')];logger[_0x5d87('0x4c')](_0x5d87('0x6f')+_0x3d097d[_0x5d87('0x49')]);}}};}function createObjHistory(_0x3db8a0,_0x35b85b,_0x1d309a,_0x24bb2a,_0x29a6dc){_0x3db8a0[_0x5d87('0x6a')]=_0x1d309a;var _0x5672d6=new Action(_0x3db8a0,_0x35b85b);var _0x3d4871=new History(_0x5672d6);_0x3d4871['state']=_0x24bb2a;_0x3d4871[_0x5d87('0x70')]=_0x29a6dc;_0x3d4871[_0x5d87('0x71')]=_0x5672d6[_0x5d87('0x72')];return _0x3d4871;}function unlockQueueStatus(_0x163af3,_0x43de3a){setTimeout(function(){if(_['isUndefined'](_0x163af3['queueStatusComplete'])){loggerBooked[_0x5d87('0x65')](_0x5d87('0x73'),_0x43de3a);}_0x163af3['queueStatusComplete']=!![];loggerBooked[_0x5d87('0x4c')](_0x5d87('0x74'),_0x43de3a,JSON['stringify'](_[_0x5d87('0x75')](_0x163af3,[_0x5d87('0x49'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x482074){return function(){if(!isNotNull(_0x482074[_0x5d87('0x76')])){_0x482074['message']=utils[_0x5d87('0x6b')][_0x5d87('0x77')];throw _0x482074[_0x5d87('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x482074[_0x5d87('0x76')][_0x5d87('0x78')])){_0x482074[_0x5d87('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5d87('0x77')];throw _0x482074[_0x5d87('0x49')]+_0x5d87('0x79');}if(!isNotNull(_[_0x5d87('0x4b')](_0x482074[_0x5d87('0x76')][_0x5d87('0x78')]))){_0x482074[_0x5d87('0x6a')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x482074[_0x5d87('0x49')]+_0x5d87('0x79');}};}function checkIsIVRCampaignActive(_0x5cffa8){return function(){if(!utils[_0x5d87('0x7a')](_0x5cffa8)){_0x5cffa8['message']=utils[_0x5d87('0x6b')][_0x5d87('0x7b')];throw _0x5cffa8[_0x5d87('0x49')]+_0x5d87('0x7c');}};}function emitCampaignSummary(_0x2273a9){if(utils[_0x5d87('0x7d')](_0x2273a9)){emit(util['format'](_0x5d87('0x7e'),_0x2273a9[_0x5d87('0x49')]),_0x5d87('0x7f'),_0x2273a9);}}function loggerCatchQueueSummary(_0x29131d,_0x3f9911){return function(_0x572606){clearPredictiveAttributes(_0x3f9911);emitCampaignSummary(_0x3f9911);loggerSyncQueueSummary['debug'](_0x29131d,util[_0x5d87('0x68')](_0x572606,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3e9fbe){if(_0x3e9fbe['sendMessageOneNotActive']){if(_0x3e9fbe[_0x5d87('0x80')]===0x0){_0x3e9fbe[_0x5d87('0x81')]=![];_0x3e9fbe['message']=utils[_0x5d87('0x6b')][_0x5d87('0x7b')];loggerSyncQueueSummary['debug'](_0x5d87('0x82'),_0x3e9fbe[_0x5d87('0x49')],_0x5d87('0x83'));}else{_0x3e9fbe['message']=utils[_0x5d87('0x6b')]['DISACTIVED'];loggerSyncQueueSummary[_0x5d87('0x46')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3e9fbe[_0x5d87('0x49')],'is\x20disactive');}emitCampaignSummary(_0x3e9fbe);}}function myreject(_0x3fc0e7){return function(_0x54d89c){return _0x3fc0e7(msgResponse(_0x5d87('0x84'),'Error',JSON[_0x5d87('0x85')](_0x54d89c)));};}Dialer[_0x5d87('0x1b')][_0x5d87('0x86')]=function(_0x49cb9f){return!_['isUndefined'](_0x49cb9f)&&_0x49cb9f&&!_[_0x5d87('0x42')](_0x49cb9f[_0x5d87('0x49')])&&!_[_0x5d87('0x42')](_0x49cb9f[_0x5d87('0x87')])&&_0x49cb9f['active']&&(this[_0x5d87('0x23')][util[_0x5d87('0x48')](_0x5d87('0x88'),_0x49cb9f[_0x5d87('0x49')])][_0x5d87('0x89')]===_0x5d87('0x8a')||this[_0x5d87('0x23')][util[_0x5d87('0x48')]('SIP/%s',_0x49cb9f[_0x5d87('0x49')])][_0x5d87('0x89')]==='unmonitored');};Dialer['prototype'][_0x5d87('0x8b')]=function(_0x14c3d6){var _0x24148b=this;return function(){if(!_0x24148b[_0x5d87('0x86')](_0x14c3d6[_0x5d87('0x8c')])){if(!_0x24148b['isTrunkReachable'](_0x14c3d6[_0x5d87('0x8d')])){_0x14c3d6[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x8e')];throw _0x14c3d6[_0x5d87('0x49')]+_0x5d87('0x8f');}}};};Dialer[_0x5d87('0x1b')][_0x5d87('0x90')]=function(_0xa46424,_0x25a4d9,_0xef8c22,_0xc879b1){var _0x4602dc=this;return function(){var _0x219dde=!![];return _0x4602dc['ifTimeIvr'](_0xa46424,_0x25a4d9,_0xef8c22,_0xc879b1,_0x219dde);};};Dialer['prototype'][_0x5d87('0x91')]=function(_0x47c52c,_0x227b0f,_0x4cfec8,_0x2cf3a0){var _0x4aac48=this;return function(){var _0x145d00=![];return _0x4aac48[_0x5d87('0x92')](_0x47c52c['Intervals'],_0x227b0f,_0x4cfec8,_0x2cf3a0,_0x145d00);};};Dialer['prototype'][_0x5d87('0x92')]=function(_0x260158,_0x3a0d3a,_0x49e485,_0xface77,_0x42fe11){var _0x234206=[];return new Promise(function(_0x2964d4,_0x8cd24f){if(!isNotNull(_0x260158)){_0xface77[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x77')];return _0x8cd24f(msgResponse(_0x5d87('0x93'),_0x5d87('0x94'),_0x49e485+_0x5d87('0x95')));}if(_[_0x5d87('0x4b')](_0x260158)){_0xface77[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x96')];return _0x8cd24f(msgResponse('ifTime',_0x5d87('0x94'),_0x49e485+'\x20Intervals\x20is\x20empty\x20'));}if(_0x3a0d3a&&_[_0x5d87('0x42')](config['timezones'][_0x3a0d3a])){_0xface77[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x97')];return _0x8cd24f(msgResponse(_0x5d87('0x93'),_0x5d87('0x94'),_0x49e485+_0x5d87('0x98')+_0x3a0d3a));}if(_[_0x5d87('0x99')](_0x260158)){for(var _0x5a651a=0x0;_0x5a651a<_0x260158[_0x5d87('0x9a')];_0x5a651a+=0x1){_0x234206[_0x5d87('0x9b')](ami[_0x5d87('0x9c')]({'action':'command','command':util['format'](_0x5d87('0x9d'),_0x260158[_0x5a651a]['interval'],!_[_0x5d87('0x42')](config[_0x5d87('0x9e')][_0x3a0d3a])?_0x3a0d3a:'')})[_0x5d87('0x9f')](function(_0x5be901){return _0x5be901[_0x5d87('0xa0')][_0x5d87('0xa1')]('true')>=0x0;})[_0x5d87('0xa2')](myreject(_0x8cd24f)));}}else{_0x234206[_0x5d87('0x9b')](ami[_0x5d87('0x9c')]({'action':_0x5d87('0xa3'),'command':util['format']('iftime\x20%s,%s',_0x260158,!_[_0x5d87('0x42')](config['timezones'][_0x3a0d3a])?_0x3a0d3a:'')})[_0x5d87('0x9f')](function(_0x9b319a){return _0x9b319a[_0x5d87('0xa0')][_0x5d87('0xa1')](_0x5d87('0xa4'))>=0x0;})[_0x5d87('0xa2')](myreject(_0x8cd24f)));}Promise['all'](_0x234206)[_0x5d87('0x9f')](function(_0x1275c2){var _0x3859b2=_[_0x5d87('0xa5')](_0x1275c2);if(_0x3859b2){return _0x2964d4(_0x3859b2);}else{_0xface77[_0x5d87('0x6a')]=_0x42fe11?utils[_0x5d87('0x6b')][_0x5d87('0xa6')]:utils[_0x5d87('0x6b')]['OVERTIME_INTERVAL'];return _0x8cd24f(msgResponse(_0x5d87('0xa7'),_0x5d87('0x94'),'Global:\x20'+_0x42fe11+'\x20'+_0x49e485+_0x5d87('0xa8')+util[_0x5d87('0x68')](_0x260158,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3a0d3a));}})[_0x5d87('0xa2')](function(_0x15c1bb){return _0x8cd24f(msgResponse('ifTime',_0x5d87('0x94'),JSON['stringify'](_0x15c1bb)));});});};Dialer[_0x5d87('0x1b')][_0x5d87('0x3e')]=function(){var _0x4929ae=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x5d87('0x9f')](function(){setInterval(function(){_0x4929ae[_0x5d87('0xa9')]();},0x3e8);});};Dialer[_0x5d87('0x1b')][_0x5d87('0xa9')]=function(){var _0x761549=this;var _0x3c44ec;for(var _0x272eac in this[_0x5d87('0x21')]){if(typeof this[_0x5d87('0x21')][_0x272eac]!=='undefined'){_0x3c44ec=this[_0x5d87('0x21')][_0x272eac];if(utils['isIVRCampaign'](_0x3c44ec)&&utils[_0x5d87('0x7a')](_0x3c44ec)){_0x3c44ec[_0x5d87('0x81')]=!![];Promise[_0x5d87('0xaa')]()['then'](checkIsIVRCampaignActive(_0x3c44ec))[_0x5d87('0x9f')](checkInterval(_0x3c44ec))['then'](_0x761549[_0x5d87('0x8b')](_0x3c44ec))[_0x5d87('0x9f')](_0x761549[_0x5d87('0x90')](_0x3c44ec[_0x5d87('0xab')],_0x3c44ec['dialTimezone'],_0x3c44ec['name'],_0x3c44ec))['then'](_0x761549[_0x5d87('0x91')](_0x3c44ec[_0x5d87('0x76')],_0x3c44ec['dialTimezone'],_0x3c44ec[_0x5d87('0x49')],_0x3c44ec))[_0x5d87('0x9f')](_0x761549[_0x5d87('0xac')](_0x3c44ec))['catch'](loggerCatchQueueSummary(_0x5d87('0xad'),_0x3c44ec));}else{notSendMessagesCampaign(_0x3c44ec);}}}};Dialer[_0x5d87('0x1b')][_0x5d87('0xae')]=function(_0x58d49d){if(_0x58d49d[_0x5d87('0xaf')]!==_0x5d87('0xb')){clearPredictiveAttributes(_0x58d49d);}switch(_0x58d49d[_0x5d87('0xaf')]){case _0x5d87('0xb0'):this['handlePower'](_0x58d49d,0x1);break;case _0x5d87('0xb1'):this['handlePower'](_0x58d49d,_0x58d49d[_0x5d87('0xb2')]);break;case _0x5d87('0xb'):this[_0x5d87('0xb')](_0x58d49d);break;case _0x5d87('0xa'):this[_0x5d87('0xb3')](_0x58d49d,0x1);break;default:logger[_0x5d87('0x65')]('Queue',_0x58d49d[_0x5d87('0x49')],_0x5d87('0xb4'));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x93')]=function(_0x746462,_0x41a9d7){var _0x4be582=_0x746462['dialTimezone'];var _0x1d992b=_0x41a9d7?_0x746462[_0x5d87('0xab')]:_0x746462[_0x5d87('0x76')]['Intervals'];logger[_0x5d87('0xb5')](_0x5d87('0xb6'),_0x1d992b,_0x4be582,_0x746462['name'],util[_0x5d87('0x48')]('Voice\x20Queue\x20%s\x20$s',_0x746462[_0x5d87('0x49')],_0x746462['id']));var _0x459910=null;return Interval[_0x5d87('0xb7')](_0x1d992b,_0x4be582)['then'](function(_0x4dadbd){if(_0x4dadbd===!![]){return _0x4dadbd;}else{_0x746462[_0x5d87('0x6a')]=_0x41a9d7?utils[_0x5d87('0x6b')][_0x5d87('0xa6')]:utils['CAMPAIGN_STATUS'][_0x5d87('0xb8')];_0x459910=msgResponse(_0x5d87('0xa7'),_0x5d87('0x94'),_0x5d87('0xb9')+_0x41a9d7+'\x20'+_0x746462['name']+_0x5d87('0xa8')+util[_0x5d87('0x68')](_0x1d992b,{'showHidden':![],'depth':null})+_0x5d87('0xba')+_0x4be582);}if(_0x459910!==null){logger['silly'](_0x5d87('0xbb'),_0x459910);_0x459910[_0x5d87('0xbc')]=_0x41a9d7;throw _0x459910;}})[_0x5d87('0xa2')](function(_0x556a6c){logger[_0x5d87('0x65')](_0x5d87('0xbd'),_0x556a6c);throw msgResponse(_0x5d87('0x84'),_0x5d87('0xbe'),util[_0x5d87('0x68')](_0x556a6c,{'showHidden':![],'depth':null}));});};Dialer[_0x5d87('0x1b')][_0x5d87('0xbf')]=function(_0x2f4aae){if(this[_0x5d87('0x20')][_0x2f4aae[_0x5d87('0xc0')]]){if(this[_0x5d87('0x27')][_0x2f4aae[_0x5d87('0xc1')]]&&this['uniqueId'][_0x2f4aae[_0x5d87('0xc1')]][_0x5d87('0x44')]!=='ivr'){this[_0x5d87('0xc2')](this[_0x5d87('0x20')][_0x2f4aae[_0x5d87('0xc0')]]);this[_0x5d87('0x27')][_0x2f4aae[_0x5d87('0xc1')]][_0x5d87('0xc3')]=moment()[_0x5d87('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5d87('0x1b')][_0x5d87('0x33')]=function(_0x12d485){var _0x16ed27=this['uniqueId'][_0x12d485['uniqueid']];if(this['voiceQueues'][_0x12d485[_0x5d87('0xc0')]]){if(_0x16ed27&&_0x16ed27[_0x5d87('0x44')]!==_0x5d87('0xc4')){delete this['uniqueId'][_0x12d485[_0x5d87('0xc1')]];this[_0x5d87('0x20')][_0x12d485[_0x5d87('0xc0')]][_0x5d87('0xc5')]+=0x1;var _0x5cfc84=new AgentComplete(_0x16ed27,_0x12d485);if(_0x12d485[_0x5d87('0xc6')]===_0x5d87('0xc7')){_0x5cfc84[_0x5d87('0xc8')]=this['voiceQueues'][_0x12d485['queue']][_0x5d87('0xc9')]&&this[_0x5d87('0x20')][_0x12d485[_0x5d87('0xc0')]]['dialAgiAfterHangupAgent']?moment()[_0x5d87('0x48')](_0x5d87('0xca')):undefined;}hopperUtils['createHistory'](_0x5cfc84)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x5d87('0xcb')](_0x5cfc84)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xcc')));}}};Dialer['prototype'][_0x5d87('0x30')]=function(_0x19788c){var _0x50091a=this['uniqueId'][_0x19788c[_0x5d87('0xc1')]];var _0x4ba29b=this;var _0x3b6e38=![];var _0x5ee047;var _0x24a6e9;if(this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]){if(_0x50091a&&_0x50091a[_0x5d87('0x44')]!==_0x5d87('0xc4')){delete this['uniqueId'][_0x19788c[_0x5d87('0xc1')]];this['updateOriginated'](this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]);_0x50091a['droptime']=moment()[_0x5d87('0x48')](_0x5d87('0xca'));var _0x7082a0=new QueueCallerAbandon(_0x50091a,_0x19788c);if(utils[_0x5d87('0x61')](_0x50091a[_0x5d87('0xcd')],_0x50091a[_0x5d87('0xce')])>=_0x50091a[_0x5d87('0xcf')]){this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0x50')]+=0x1;this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xd0')]+=0x1;_0x7082a0[_0x5d87('0xd1')]=0xa;_0x7082a0[_0x5d87('0x70')]=_0x5d87('0xd2');_0x7082a0[_0x5d87('0xd3')]=_0x5d87('0xd4');_0x7082a0[_0x5d87('0xc8')]=this['voiceQueues'][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xc9')]?moment()['format'](_0x5d87('0xca')):undefined;_0x7082a0['countdropretry']+=0x1;_0x7082a0[_0x5d87('0xd5')]+=0x1;_0x5ee047=this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xd6')];_0x24a6e9=this[_0x5d87('0x20')][_0x19788c['queue']][_0x5d87('0xd7')];hopperUtils[_0x5d87('0xd8')](_0x7082a0,_0x7082a0[_0x5d87('0xd1')],_0x50091a['voiceQueue'])[_0x5d87('0x9f')](function(_0x3facdc){_0x3b6e38=_0x3facdc[_0x5d87('0xd9')]==0x1;if(_0x7082a0['countdropretry']>=_0x4ba29b[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]['dialDropMaxRetry']){_0x4ba29b[_0x5d87('0xda')](_0x7082a0,_0x3facdc['additional']);}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countdropretry':_0x7082a0[_0x5d87('0xdc')],'scheduledat':moment()[_0x5d87('0xdd')](_0x4ba29b[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xd6')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x50091a[_0x5d87('0xdf')],'ListId':_0x50091a[_0x5d87('0xe0')],'VoiceQueueId':_0x50091a[_0x5d87('0xe1')]||undefined,'CampaignId':_0x50091a['CampaignId']||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xe2')));var _0x43c1e9=new History(_0x7082a0);_0x43c1e9['state']=0xa;_0x43c1e9[_0x5d87('0x70')]='Drop';_0x43c1e9[_0x5d87('0x72')]=moment()['format'](_0x5d87('0xca'));_0x43c1e9['endtime']=_0x43c1e9['starttime'];_0x43c1e9['calleridname']=_0x7082a0[_0x5d87('0xe3')];_0x43c1e9[_0x5d87('0xe4')]=_0x7082a0[_0x5d87('0xe4')];hopperUtils[_0x5d87('0xe5')](_0x43c1e9)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xe6')));}})[_0x5d87('0x9f')](function(){if(_0x3b6e38)hopperUtils[_0x5d87('0xe7')](_0x7082a0,_0x5ee047,_0x24a6e9)[_0x5d87('0x9f')](function(){return 0x1;});});}else{this['voiceQueues'][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xe8')]+=0x1;this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xe9')]+=0x1;_0x7082a0[_0x5d87('0xd1')]=0xb;_0x7082a0[_0x5d87('0x70')]='Abandoned';_0x7082a0[_0x5d87('0xd3')]=_0x5d87('0xea');_0x7082a0[_0x5d87('0xeb')]+=0x1;_0x7082a0[_0x5d87('0xd5')]+=0x1;_0x5ee047=this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xec')];_0x24a6e9=this[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x5d87('0xd8')](_0x7082a0,_0x7082a0[_0x5d87('0xd1')],_0x50091a[_0x5d87('0xed')])['then'](function(_0x32b831){if(_0x7082a0[_0x5d87('0xeb')]>=_0x4ba29b[_0x5d87('0x20')][_0x19788c[_0x5d87('0xc0')]][_0x5d87('0xee')]){_0x4ba29b[_0x5d87('0xda')](_0x7082a0,_0x32b831[_0x5d87('0xd9')]);}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countabandonedretry':_0x7082a0[_0x5d87('0xeb')],'scheduledat':moment()[_0x5d87('0xdd')](_0x4ba29b[_0x5d87('0x20')][_0x19788c['queue']][_0x5d87('0xec')],_0x5d87('0xde'))['format'](_0x5d87('0xca')),'ContactId':_0x50091a[_0x5d87('0xdf')],'ListId':_0x50091a['ListId'],'VoiceQueueId':_0x50091a[_0x5d87('0xe1')]||undefined,'CampaignId':_0x50091a[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xf0')));var _0x380fb7=new History(_0x7082a0);_0x380fb7[_0x5d87('0xd1')]=0xb;_0x380fb7['statedesc']=_0x5d87('0xf1');_0x380fb7[_0x5d87('0x72')]=moment()[_0x5d87('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x380fb7[_0x5d87('0x71')]=_0x380fb7[_0x5d87('0x72')];_0x380fb7[_0x5d87('0xe3')]=_0x7082a0[_0x5d87('0xe3')];_0x380fb7[_0x5d87('0xe4')]=_0x7082a0[_0x5d87('0xe4')];hopperUtils[_0x5d87('0xe5')](_0x380fb7)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xf2')));}})['then'](function(){if(_0x3b6e38)hopperUtils[_0x5d87('0xe7')](_0x7082a0,_0x5ee047,_0x24a6e9)[_0x5d87('0x9f')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x5d87('0x3a')]=function(_0x18491e){if(this[_0x5d87('0x26')][_0x18491e['uniqueid']]){this[_0x5d87('0x26')][_0x18491e[_0x5d87('0xc1')]]['channel']=_0x18491e['channel'];}if(this[_0x5d87('0x27')][_0x18491e[_0x5d87('0xc1')]]){this['uniqueId'][_0x18491e[_0x5d87('0xc1')]][_0x5d87('0xf3')]=_0x18491e['channel'];}};Dialer[_0x5d87('0x1b')][_0x5d87('0x3b')]=function(_0x387573){if(!this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]){return;}var _0xe96510=this[_0x5d87('0x20')][this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]['queue']][_0x5d87('0xf5')]||_0x5d87('0xf6');if(_0xe96510===_0x5d87('0xf7')){if(this[_0x5d87('0x26')][_0x387573['actionid']]&&_[_0x5d87('0xf8')](this['actions'][_0x387573[_0x5d87('0xf4')]][_0x5d87('0xf9')])&&_0x387573[_0x5d87('0x89')]==='1'&&_0x387573[_0x5d87('0xfa')]==='0'){if(this['agents'][_0x387573[_0x5d87('0xfb')]]){if(!this[_0x5d87('0x22')][_0x387573[_0x5d87('0xfb')]][_0x5d87('0xf9')]){this[_0x5d87('0x22')][_0x387573[_0x5d87('0xfb')]][_0x5d87('0xf9')]=!![];this[_0x5d87('0x26')][_0x387573['actionid']][_0x5d87('0xf9')]=!![];this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]][_0x5d87('0xfb')]=_0x387573[_0x5d87('0xfb')];}}}}else if(_0xe96510==='rrmemory'){if(this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]){if(this[_0x5d87('0x22')][_0x387573['stateinterface']]){this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]['stateinterface']=_0x387573[_0x5d87('0xfb')];if(_['isNil'](this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x387573['actionid']][_0x5d87('0xc0')]])){this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]]['queue']]=[];}this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]][_0x5d87('0xc0')]][_0x5d87('0x9b')](_[_0x5d87('0x60')](_[_0x5d87('0x75')](this[_0x5d87('0x26')][_0x387573[_0x5d87('0xf4')]],[_0x5d87('0xfc'),_0x5d87('0xfb')]),{'status':_0x387573['status'],'paused':_0x387573[_0x5d87('0xfa')]}));}}}};Dialer['prototype'][_0x5d87('0x3d')]=function(_0x3c8aef){if(!this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]){return;}var _0xb9946e=this;var _0xd296aa=this['voiceQueues'][this['actions'][_0x3c8aef['actionid']][_0x5d87('0xc0')]];var _0x414f58=_0xd296aa[_0x5d87('0xf5')]||'rrmemory';if(_0x414f58===_0x5d87('0xf7')){if(this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]&&this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xfb')]){this['preview']['run'](this['actions'][_0x3c8aef['actionid']][_0x5d87('0xfc')],this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xfb')])['catch'](function(_0x58e5e6){logger[_0x5d87('0x65')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x5d87('0x68')](_0x58e5e6,{'showHidden':![],'depth':null}));})[_0x5d87('0x1e')](function(){_0xb9946e[_0x5d87('0xc2')](_0xb9946e['voiceQueues'][_0xb9946e['actions'][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]]);_0xb9946e[_0x5d87('0x22')][_0xb9946e[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xfb')]][_0x5d87('0xf9')]=![];delete _0xb9946e[_0x5d87('0x26')][_0x3c8aef['actionid']];unlockQueueStatus(_0xd296aa);});}else{this[_0x5d87('0xc2')](this['voiceQueues'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['queue']]);hopperUtils[_0x5d87('0xdb')]({'active':![],'ContactId':this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xdf')],'ListId':this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xe0')],'VoiceQueueId':this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xe1')]||undefined,'CampaignId':this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['CampaignId']||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xfd')));delete this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]];unlockQueueStatus(_0xd296aa);}}else if(_0x414f58===_0x5d87('0xf6')){var _0x361017;if(this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]&&!_[_0x5d87('0x4b')](this[_0x5d87('0x2c')][this['actions'][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]])){if(this[_0x5d87('0xfe')][_0xb9946e[_0x5d87('0x26')][_0x3c8aef['actionid']]['queue']]){this[_0x5d87('0xfe')][_0xb9946e[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xc0')]]=this['queueBookedRR'][this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xc0')]]?this['queueBookedRR'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['queue']]:this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]]?this['queueBooked'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]][_0x5d87('0xc0')]][_0x5d87('0xff')]||0x0:0x0;}this[_0x5d87('0x2c')][this[_0x5d87('0x26')][_0x3c8aef['actionid']][_0x5d87('0xc0')]][_0x5d87('0xff')]=this['queueBookedRR'][this[_0x5d87('0x26')][_0x3c8aef[_0x5d87('0xf4')]]['queue']];for(var _0x1fbaa3=0x0;_0x1fbaa3=_0x20470e['dialGlobalMaxRetry']){_0x4bb33a['stateGlobal'](_0x434775,_0x1c0b06,_0xefcac6,_0x5d87('0x126'));}else{if(_0x434775[_0x5d87('0x121')]>=_0x20470e[_0x5d87('0x127')]){_0x4bb33a[_0x5d87('0x128')](_0x434775,_0x1c0b06,_0xefcac6,_0x5d87('0x129'));}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countmachineretry':_0x434775[_0x5d87('0x121')],'scheduledat':moment()[_0x5d87('0xdd')](_0x20470e['dialMachineRetryFrequency'],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x434775['ContactId'],'ListId':_0x434775[_0x5d87('0xe0')],'VoiceQueueId':_0x434775[_0x5d87('0xe1')]||undefined,'CampaignId':_0x434775[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x12a')));_0x1c0b06({'reschedule':0x1});}}});}if(_0x4671f5['type']===_0x5d87('0xc4')&&this[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0x113')]&&_0x4baa5f[_0x5d87('0x114')]===_0x5d87('0x115')){delete this['uniqueId'][_0x4baa5f[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this[_0x5d87('0x21')][_0x4671f5['queue']]);_0x54e0cc=new Hangup(_0x4671f5,_0x4baa5f);_0x54e0cc[_0x5d87('0xd1')]=0x12;_0x54e0cc[_0x5d87('0x70')]='HangupInAMD';_0x54e0cc['membername']=_0x5d87('0x119');ami[_0x5d87('0x43')](_0x5d87('0x11a'),ut[_0x5d87('0x11b')](_0x54e0cc,'amd'));this[_0x5d87('0x11d')](_0x54e0cc,_0x5d87('0x12b'),'[syncHangupInAMDIvr]');}if(_0x4671f5['type']===_0x5d87('0xc4')&&this[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0x113')]&&_0x4baa5f[_0x5d87('0x114')]===_0x5d87('0x12c')){return new Promise(function(_0x17f622,_0x2acb6e){delete _0x4bb33a[_0x5d87('0x27')][_0x4baa5f[_0x5d87('0xc1')]];_0x4bb33a[_0x5d87('0xc2')](_0x4bb33a['campaigns'][_0x4671f5[_0x5d87('0xc0')]]);_0x4bb33a[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0xc5')]+=0x1;_0x4bb33a[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]][_0x5d87('0x116')]+=0x1;var _0x339ff9=_0x4bb33a[_0x5d87('0x21')][_0x4671f5[_0x5d87('0xc0')]];var _0x373539=new Hangup(_0x4671f5,_0x4baa5f);_0x373539[_0x5d87('0xd1')]=0x13;_0x373539[_0x5d87('0x70')]=_0x5d87('0x120');_0x373539[_0x5d87('0x118')]='AMD';_0x373539['countmachineretry']+=0x1;_0x373539['countglobal']+=0x1;_0x373539[_0x5d87('0x11c')]=!![];ami[_0x5d87('0x43')](_0x5d87('0x11a'),ut[_0x5d87('0x11b')](_0x373539,'amd'));hopperUtils[_0x5d87('0xe5')](_0x373539)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x122')));if(_0x373539[_0x5d87('0x123')]+_0x373539[_0x5d87('0x12d')]+_0x373539[_0x5d87('0x124')]+_0x373539[_0x5d87('0x12e')]+_0x373539[_0x5d87('0xdc')]+_0x373539[_0x5d87('0xeb')]+_0x373539[_0x5d87('0x121')]+_0x373539[_0x5d87('0x125')]>=_0x339ff9[_0x5d87('0x12f')]){_0x4bb33a[_0x5d87('0x130')](_0x373539,_0x17f622,_0x2acb6e,'reason19\x20machine....');}else{if(_0x373539[_0x5d87('0x121')]>=_0x339ff9[_0x5d87('0x127')]){_0x4bb33a['createStateFinal'](_0x373539,_0x17f622,_0x2acb6e,'reason\x2019\x20machine....');}else{hopperUtils[_0x5d87('0xdb')]({'active':![],'countmachineretry':_0x373539[_0x5d87('0x121')],'scheduledat':moment()[_0x5d87('0xdd')](_0x339ff9[_0x5d87('0x131')],_0x5d87('0xde'))['format'](_0x5d87('0xca')),'ContactId':_0x373539[_0x5d87('0xdf')],'ListId':_0x373539[_0x5d87('0xe0')],'VoiceQueueId':_0x373539[_0x5d87('0xe1')]||undefined,'CampaignId':_0x373539[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x12a')));_0x17f622({'reschedule':0x1});}}});}}};Dialer[_0x5d87('0x1b')][_0x5d87('0x38')]=function(_0xc46d4e){var _0x756083=this['uniqueId'][_0xc46d4e[_0x5d87('0xc1')]];var _0x2a0145;if(_0x756083&&_0x756083[_0x5d87('0x44')]===_0x5d87('0xc4')){delete this[_0x5d87('0x27')][_0xc46d4e[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this[_0x5d87('0x21')][_0x756083['queue']]);this[_0x5d87('0x21')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x132')]+=0x1;_0x2a0145=new Hangup(_0x756083,_0xc46d4e);hopperUtils[_0x5d87('0xe5')](_0x2a0145)['catch'](loggerCatch(_0x5d87('0x133')));hopperUtils[_0x5d87('0xcb')](_0x2a0145)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x134')));}if(_0x756083&&_0x756083[_0x5d87('0x44')]!==_0x5d87('0xc4')&&isNotNull(this[_0x5d87('0x20')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x135')])){delete this[_0x5d87('0x27')][_0xc46d4e[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this['voiceQueues'][_0x756083[_0x5d87('0xc0')]]);this[_0x5d87('0x20')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0xc5')]+=0x1;this[_0x5d87('0x20')][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x116')]+=0x1;_0x2a0145=new Hangup(_0x756083,_0xc46d4e);_0x2a0145[_0x5d87('0xd1')]=0x10;_0x2a0145['statedesc']=_0x5d87('0x136');_0x2a0145[_0x5d87('0x118')]=_0x5d87('0x137');hopperUtils[_0x5d87('0xe5')](_0x2a0145)['catch'](loggerCatch(_0x5d87('0x133')));hopperUtils[_0x5d87('0xcb')](_0x2a0145)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x134')));}if(_0x756083&&_0x756083[_0x5d87('0x44')]!==_0x5d87('0xc4')&&!isNotNull(this[_0x5d87('0x20')][_0x756083['queue']]['dialQueueProject'])){delete this['uniqueId'][_0xc46d4e[_0x5d87('0xc1')]];this[_0x5d87('0xc2')](this[_0x5d87('0x20')][_0x756083['queue']]);this['voiceQueues'][_0x756083[_0x5d87('0xc0')]][_0x5d87('0x138')]+=0x1;_0x2a0145=new Hangup(_0x756083,_0xc46d4e);_0x2a0145[_0x5d87('0xd1')]=0xc;_0x2a0145[_0x5d87('0x70')]=_0xc46d4e[_0x5d87('0x139')];_0x2a0145[_0x5d87('0x118')]=_0x5d87('0x13a');hopperUtils[_0x5d87('0xe5')](_0x2a0145)['catch'](loggerCatch(_0x5d87('0x133')));hopperUtils['moveContactManagedDialer'](_0x2a0145)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x134')));}};Dialer[_0x5d87('0x1b')]['syncQueueSummary']=function(_0x5d67d6){var _0x3fbb50=this;if(!_0x3fbb50['queuesSummary'][_0x5d67d6['name']]){_0x3fbb50['queuesSummary'][_0x5d67d6[_0x5d87('0x49')]]={'running':![]};}else if(_0x3fbb50['queuesSummary'][_0x5d67d6['name']]['running']===!![]){return;}else if(_0x3fbb50[_0x5d87('0x2d')][_0x5d67d6[_0x5d87('0x49')]][_0x5d87('0x13b')]===![]){_0x3fbb50[_0x5d87('0x2d')][_0x5d67d6['name']][_0x5d87('0x13b')]=!![];}var _0x56a10c=_0x3fbb50[_0x5d87('0x20')][_0x5d67d6['name']];var _0x127ef2=_0x56a10c[_0x5d87('0x6a')]!==utils[_0x5d87('0x6b')]['INACTIVE'];var _0x4ba440=utils[_0x5d87('0x13c')](_0x56a10c);_0x56a10c[_0x5d87('0x13d')]=utils[_0x5d87('0x13e')](_0x56a10c,_0x3fbb50[_0x5d87('0x23')]);Promise[_0x5d87('0xaa')]()['then'](function(){if(_0x56a10c['statusMessage']===utils[_0x5d87('0x6b')][_0x5d87('0x7b')]){if(_0x127ef2){clearPredictiveAttributes(_0x56a10c);_0x5d67d6[_0x5d87('0x29')]=undefined;_0x5d67d6[_0x5d87('0x2a')]=undefined;}if(_0x56a10c[_0x5d87('0x13d')]===utils['CAMPAIGN_STATUS'][_0x5d87('0x7b')]){_0x5d67d6[_0x5d87('0x13f')]=0x0;_0x5d67d6['paused']=0x0;_0x5d67d6[_0x5d87('0x140')]=0x0;_0x5d67d6['talking']=0x0;_0x5d67d6[_0x5d87('0x141')]=0x0;}}else if(_0x56a10c['statusMessage']===utils[_0x5d87('0x6b')]['ACTIVE']&&!_0x4ba440){return _0x3fbb50[_0x5d87('0x93')](_0x56a10c,!![])['then'](function(){return _0x3fbb50['ifTime'](_0x56a10c,![]);})[_0x5d87('0x9f')](function(){return _0x3fbb50[_0x5d87('0xae')](_0x56a10c);})[_0x5d87('0xa2')](function(_0x4f6a95){loggerSyncQueueSummary['debug'](_0x5d87('0x142'),util[_0x5d87('0x68')](_0x4f6a95,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x56a10c);});}else{clearPredictiveAttributes(_0x56a10c);}})[_0x5d87('0x9f')](function(){var _0x6c2e02=_0x5d67d6['compareToOutboundQueue'](_0x56a10c);if(_0x6c2e02||_0x56a10c['queueSummaryCountersUpdated']){_0x56a10c[_0x5d87('0x143')]=![];_0x5d67d6[_0x5d87('0x144')](_0x56a10c);Object[_0x5d87('0x145')](_0x56a10c,_0x5d67d6);emitOutboundVoiceQueueSummary(_0x5d67d6);}_0x3fbb50['queuesSummary'][_0x56a10c[_0x5d87('0x49')]][_0x5d87('0x13b')]=![];})[_0x5d87('0xa2')](function(_0x51b5db){logger['error']('[syncQueueSummary]',util['inspect'](_0x51b5db,{'showHidden':![],'depth':null}));_0x3fbb50[_0x5d87('0x2d')][_0x56a10c[_0x5d87('0x49')]][_0x5d87('0x13b')]=![];});};Dialer['prototype'][_0x5d87('0x36')]=_[_0x5d87('0x146')](function(){var _0x54b797=_['filter'](this[_0x5d87('0x20')],function(_0x1b2b51){return _0x1b2b51[_0x5d87('0x147')];});var _0x310c43=_[_0x5d87('0x148')](this[_0x5d87('0x22')],function(_0xb0e1ff){return _0xb0e1ff[_0x5d87('0x149')]&&_0xb0e1ff[_0x5d87('0x89')]==='reachable';});if(_0x54b797['length']>0x0&&_0x310c43[_0x5d87('0x9a')]>0x0){return Promise[_0x5d87('0xaa')]()[_0x5d87('0x9f')](cmHopper['handlePreviewRecallNotifications'](_[_0x5d87('0x14a')](_0x54b797,'id'),previewRecallmeReminderInterval,_[_0x5d87('0x14a')](_0x310c43,'id')))[_0x5d87('0x9f')](function(_0x25fbb8){for(var _0x2a6a74=0x0;_0x2a6a74<_0x25fbb8[_0x5d87('0x9a')];_0x2a6a74++){var _0x29ddd0=_0x25fbb8[_0x2a6a74][_0x5d87('0x14b')][_0x5d87('0x49')];if(_0x29ddd0)io['to'](util[_0x5d87('0x48')](_0x5d87('0x14c'),_0x29ddd0))[_0x5d87('0x43')](_0x5d87('0x14d'),{'hopper':_0x25fbb8[_0x2a6a74]});}})[_0x5d87('0xa2')](function(_0x4542c7){logger[_0x5d87('0x65')](_0x5d87('0x14e'),_0x4542c7);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5d87('0x1b')][_0x5d87('0x3f')]=function(){var _0x37a638=this;setInterval(function(){_0x37a638[_0x5d87('0x14f')](_0x37a638['uniqueId'],_0x5d87('0x150'));_0x37a638[_0x5d87('0x14f')](_0x37a638[_0x5d87('0x26')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x1c54a1,_0xfed87c){var _0x512772=this;for(var _0x73c8ac in _0x1c54a1){if(typeof _0x1c54a1[_0x73c8ac]!=='undefined'){this[_0x5d87('0x1f')][_0x5d87('0x1c')](function(){if(!_['isNil'](_0x1c54a1[_0x73c8ac])){return ami[_0x5d87('0x9c')]({'action':'status','channel':_0x1c54a1[_0x73c8ac][_0x5d87('0xf3')]})[_0x5d87('0xa2')](function(_0x22d631){if(_0x22d631['message']===_0x5d87('0x151')){setTimeout(function(){if(_0x1c54a1[_0x73c8ac]&&_0x1c54a1[_0x73c8ac][_0x5d87('0x44')]!==_0x5d87('0xc4')){_0x512772[_0x5d87('0xc2')](_0x512772[_0x5d87('0x20')][_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]]);logger[_0x5d87('0x65')]('[Dialer][checkChannel]',_0xfed87c,_0x73c8ac,_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]);delete _0x1c54a1[_0x73c8ac];}if(_0x1c54a1[_0x73c8ac]&&_0x1c54a1[_0x73c8ac][_0x5d87('0x44')]===_0x5d87('0xc4')){_0x512772[_0x5d87('0xc2')](_0x512772[_0x5d87('0x21')][_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]]);logger[_0x5d87('0x65')]('[Dialer][checkChannel][ivr]',_0xfed87c,_0x73c8ac,_0x1c54a1[_0x73c8ac][_0x5d87('0xc0')]);delete _0x1c54a1[_0x73c8ac];}},0x2328);}});}});}}};Dialer[_0x5d87('0x1b')][_0x5d87('0x152')]=function(_0x216568){return Promise[_0x5d87('0xaa')]()[_0x5d87('0x9f')](voiceQueueRt[_0x5d87('0x152')](_0x216568))[_0x5d87('0xa2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x5d87('0x1b')][_0x5d87('0xc2')]=function(_0x5f322e){if(!_['isUndefined'](_0x5f322e)&&_0x5f322e!==null){if(typeof _0x5f322e['originated']!==_0x5d87('0x153')){if(_0x5f322e[_0x5d87('0x80')]>0x0){_0x5f322e['originated']-=0x1;}else{logger[_0x5d87('0x65')](_0x5d87('0x154'));}}}else{logger[_0x5d87('0x65')](_0x5d87('0x155'));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x156')]=function(_0x52004b,_0xf46247){var _0xabb888=this;return function(_0x283a12){_0xabb888[_0x5d87('0xc2')](_0xf46247);logger[_0x5d87('0x65')](_0x52004b,util[_0x5d87('0x68')](_0x283a12,{'showHidden':![],'depth':null}));};};Dialer[_0x5d87('0x1b')]['emptyContact']=function(_0x5d8e35,_0xac16ae,_0x480927){var _0x5d547f={'state':0x19,'statedesc':_0x5d87('0x157')};this[_0x5d87('0xc2')](_0xac16ae);this[_0x5d87('0x11d')](_[_0x5d87('0x60')](_0x5d547f,_[_0x5d87('0x75')](_0x480927,[_0x5d87('0xdf'),'ListId',_0x5d87('0x158'),_0x5d87('0xe1'),'CampaignId'])),_0x5d87('0x159'),_0x5d87('0x15a'));logger[_0x5d87('0x65')](_0x5d8e35);};Dialer[_0x5d87('0x1b')][_0x5d87('0x11d')]=function(_0x568048,_0x2220ef,_0x39ae09){hopperUtils[_0x5d87('0xe5')](_0x568048)[_0x5d87('0xa2')](loggerCatch(_0x2220ef));hopperUtils[_0x5d87('0xcb')](_0x568048)['catch'](loggerCatch(_0x39ae09));};Dialer[_0x5d87('0x1b')][_0x5d87('0xda')]=function(_0x48f3ed,_0xa58d9c){hopperUtils[_0x5d87('0xe5')](_0x48f3ed)['catch'](loggerCatch(_0x5d87('0x15b')));if(_0xa58d9c==0x0){hopperUtils[_0x5d87('0xcb')](_0x48f3ed)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x15c')));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x14e')]=function(_0xfff238){return Promise['resolve']()[_0x5d87('0x9f')](cmHopper[_0x5d87('0x15d')](_0xfff238['id'],previewRecallmeReminderInterval))[_0x5d87('0x9f')](function(_0x1bb209){for(var _0x34a437=0x0;_0x34a437<_0x1bb209[_0x5d87('0x9a')];_0x34a437++){var _0x47efa1=_0x1bb209[_0x34a437][_0x5d87('0x14b')][_0x5d87('0x49')];if(_0x47efa1)io['to'](util[_0x5d87('0x48')](_0x5d87('0x14c'),_0x47efa1))[_0x5d87('0x43')](_0x5d87('0x14d'),{'hopper':_0x1bb209[_0x34a437]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x204380){var _0x4b3e2a=this;return function(){_0x4b3e2a['handleIvr'](_0x204380);};};Dialer[_0x5d87('0x1b')][_0x5d87('0x15e')]=function(_0xecd07f,_0x450c34){var _0x5e43fe=this;var _0x55547e=uuid['v4']();this[_0x5d87('0x26')][_0x55547e]=new Action(_0xecd07f,_0x450c34,_0x55547e);return new Promise(function(_0x364b07,_0x3c0d31){if(_[_0x5d87('0x42')](_0xecd07f)&&typeof _0xecd07f!=='object'){return _0x3c0d31(msgResponse(_0x5d87('0x15f'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x5d87('0x42')](_0x450c34['phone'])||_0x450c34[_0x5d87('0x160')]===null){return _0x3c0d31(msgResponse(_0x5d87('0x15f'),'Failure',_0x5d87('0x161')));}var _0x3325c3={'XMD-CALLERID':_0x5e43fe[_0x5d87('0x26')][_0x55547e][_0x5d87('0x162')](),'XMD-AGI':_0xecd07f['dialQueueProject']?util[_0x5d87('0x48')](_0x5d87('0x163'),ipAgi,_0xecd07f[_0x5d87('0x135')]):'NONE','XMD-AGIAFTER':_0xecd07f[_0x5d87('0xc9')]?util[_0x5d87('0x48')](_0x5d87('0x163'),ipAgi,_0xecd07f[_0x5d87('0xc9')]):_0x5d87('0x164'),'XMD-QUEUE':utils[_0x5d87('0x165')](_0xecd07f)?util[_0x5d87('0x48')]('\x22%s,%s%s,,,%s\x22',_0xecd07f[_0x5d87('0x49')],_0xecd07f['dialQueueOptions']||'',_0xecd07f[_0x5d87('0x166')]?'c':'',_0xecd07f['dialQueueTimeout']||0x3):_0x5d87('0x164'),'XMD-CONTACTID':_0x450c34[_0x5d87('0xdf')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5e43fe[_0x5d87('0x26')][_0x55547e][_0x5d87('0x162')](),'XMD-AMD':_0xecd07f[_0x5d87('0x113')]?_0x5d87('0x167'):_0x5d87('0x164'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xecd07f[_0x5d87('0x113')]){_0x3325c3[_0x5d87('0x168')]=_0xecd07f[_0x5d87('0x169')]||0x9c4;_0x3325c3[_0x5d87('0x16a')]=_0xecd07f[_0x5d87('0x16b')]||0x5dc;_0x3325c3[_0x5d87('0x16c')]=_0xecd07f[_0x5d87('0x16d')]||0x320;_0x3325c3[_0x5d87('0x16e')]=_0xecd07f['dialAMDTotalAnalysisTime']||0x1388;_0x3325c3[_0x5d87('0x16f')]=_0xecd07f[_0x5d87('0x170')]||0x64;_0x3325c3[_0x5d87('0x171')]=_0xecd07f[_0x5d87('0x172')]||0x32;_0x3325c3['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xecd07f[_0x5d87('0x173')]||0x3;_0x3325c3[_0x5d87('0x174')]=_0xecd07f[_0x5d87('0x175')]||0x100;_0x3325c3['XMD-AMDMAXIMUMWORDLENGTH']=_0xecd07f['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0xecd07f)){_0x3325c3[_0x5d87('0x176')]=_0x450c34[_0x5d87('0xe1')];}else{_0x3325c3[_0x5d87('0x177')]=_0x450c34[_0x5d87('0xef')];}var _0x47f67b=utils[_0x5d87('0x178')](_0x450c34[_0x5d87('0x179')]);Object['assign'](_0x3325c3,_0x47f67b);var _0x574d64=_0x5e43fe[_0x5d87('0x86')](_0xecd07f[_0x5d87('0x8c')])?utils[_0x5d87('0x17a')](_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x17b')],_0xecd07f['dialOriginateCallerIdName'],_0xecd07f['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5d87('0x17c')](_0xecd07f[_0x5d87('0x17d')],_0xecd07f['dialRandomLastDigitCallerIdNumber']):_0xecd07f[_0x5d87('0x17d')]):utils[_0x5d87('0x17a')](_[_0x5d87('0xf8')](_0xecd07f['TrunkBackup'])?_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x17b')]:_0xecd07f[_0x5d87('0x8d')][_0x5d87('0x17b')],_0xecd07f[_0x5d87('0x17e')],_0xecd07f[_0x5d87('0x17f')]>0x0?utils[_0x5d87('0x17c')](_0xecd07f['dialOriginateCallerIdNumber'],_0xecd07f[_0x5d87('0x17f')]):_0xecd07f[_0x5d87('0x17d')]);if(_0x574d64){_0x3325c3['XMD-ORIGINATECALLERIDNAME']=_0x5e43fe[_0x5d87('0x26')][_0x55547e]['originatecalleridname']=utils[_0x5d87('0x180')](_0x574d64);_0x3325c3[_0x5d87('0x181')]=_0x450c34[_0x5d87('0x160')];}_0xecd07f[_0x5d87('0x182')]=_0x3325c3;return ami[_0x5d87('0x9c')]({'actionid':_0x55547e,'action':'originate','channel':_0x5e43fe['isTrunkReachable'](_0xecd07f[_0x5d87('0x8c')])?util[_0x5d87('0x48')](_0x5d87('0x183'),_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x49')],isNotNull(_0xecd07f[_0x5d87('0x184')])?_0xecd07f[_0x5d87('0x184')][_0x5d87('0x185')]()||'':'',_0xecd07f[_0x5d87('0x186')]>0x0?_0x450c34[_0x5d87('0x160')][_0x5d87('0x187')](_0xecd07f['dialCutDigit']):_0x450c34[_0x5d87('0x160')]):util[_0x5d87('0x48')](_0x5d87('0x183'),_['isNil'](_0xecd07f[_0x5d87('0x8d')])?_0xecd07f[_0x5d87('0x8c')][_0x5d87('0x49')]:_0xecd07f[_0x5d87('0x8d')]['name'],isNotNull(_0xecd07f[_0x5d87('0x184')])?_0xecd07f[_0x5d87('0x184')]['trim']()||'':'',_0xecd07f[_0x5d87('0x186')]>0x0?_0x450c34[_0x5d87('0x160')][_0x5d87('0x187')](_0xecd07f[_0x5d87('0x186')]):_0x450c34[_0x5d87('0x160')]),'callerid':_0x574d64,'Exten':'xcally-motion-dialer','Context':_0x5d87('0x188'),'Priority':'1','variable':_0x3325c3,'timeout':(_0xecd07f[_0x5d87('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55547e})[_0x5d87('0x9f')](function(_0x16380f){return _0x364b07(_0x16380f);})[_0x5d87('0xa2')](function(_0x163d1c){_0xecd07f['outboundOriginateFailureCallsDay']+=0x1;var _0x2f76fc=new History(_0x5e43fe[_0x5d87('0x26')][_0x55547e]);logger[_0x5d87('0x65')](util['format']('[originateError]:\x20%s',JSON['stringify'](_0x163d1c)));_0x2f76fc[_0x5d87('0xd1')]=0xe;_0x2f76fc[_0x5d87('0x70')]='OriginateError';_0x2f76fc[_0x5d87('0x72')]=moment()[_0x5d87('0x48')](_0x5d87('0xca'));_0x2f76fc['endtime']=_0x2f76fc['starttime'];hopperUtils[_0x5d87('0xe5')](_0x2f76fc)['catch'](loggerCatch(_0x5d87('0x18a')));_0x5e43fe[_0x5d87('0xcb')](_0x2f76fc)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x18a')))[_0x5d87('0x1e')](function(){delete _0x5e43fe[_0x5d87('0x26')][_0x55547e];return _0x3c0d31(msgResponse(_0x5d87('0x15f'),_0x5d87('0xbe'),'originate\x20action\x20Error'));});});});};Dialer[_0x5d87('0x1b')]['checkRetriveMax']=function(_0xabae60,_0x450be1,_0x49470d){var _0x1f7800=new History(_0x450be1);if(_0x1f7800['countbusyretry']+_0x1f7800['countcongestionretry']+_0x1f7800[_0x5d87('0x124')]+_0x1f7800['countnosuchnumberretry']+_0x1f7800[_0x5d87('0xdc')]+_0x1f7800[_0x5d87('0xeb')]+_0x1f7800[_0x5d87('0x121')]+_0x1f7800[_0x5d87('0x125')]>=_0x49470d[_0x5d87('0x12f')]-0x1){return!![];}switch(_0xabae60){case 0x3:if(_0x1f7800[_0x5d87('0x124')]>=_0x49470d[_0x5d87('0x18b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1f7800['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0x18c')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800['ContactId'],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x18d')));break;case 0x5:if(_0x1f7800[_0x5d87('0x123')]>=_0x49470d[_0x5d87('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1f7800['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x49470d[_0x5d87('0x18f')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800['ListId'],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x190')));break;case 0x8:if(_0x1f7800['countcongestionretry']>=_0x49470d[_0x5d87('0x191')]-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countcongestionretry':_0x1f7800['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x49470d[_0x5d87('0x192')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1f7800[_0x5d87('0x12e')]>=_0x49470d[_0x5d87('0x193')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1f7800[_0x5d87('0x12e')]+=0x1,'scheduledat':moment()['add'](_0x49470d[_0x5d87('0x194')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800['ListId'],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x195')));}break;case 0xa:if(_0x1f7800[_0x5d87('0xdc')]>=_0x49470d['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1f7800['countdropretry']+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0xd6')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800['ContactId'],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800['CampaignId']||undefined})['catch'](loggerCatch(_0x5d87('0xe2')));break;case 0xb:if(_0x1f7800[_0x5d87('0xeb')]>=_0x49470d[_0x5d87('0xee')]-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countabandonedretry':_0x1f7800[_0x5d87('0xeb')]+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0xec')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800['VoiceQueueId']||undefined,'CampaignId':_0x1f7800['CampaignId']||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0xf0')));break;case 0x13:if(_0x1f7800['countmachineretry']>=_0x49470d['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countmachineretry':_0x1f7800[_0x5d87('0x121')]+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d['dialMachineRetryFrequency'],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800[_0x5d87('0xe1')]||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x12a')));break;case 0x14:if(_0x1f7800[_0x5d87('0x125')]>=_0x49470d['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x5d87('0xdb')]({'active':![],'countagentrejectretry':_0x1f7800[_0x5d87('0x125')]+=0x1,'scheduledat':moment()[_0x5d87('0xdd')](_0x49470d[_0x5d87('0x196')],_0x5d87('0xde'))[_0x5d87('0x48')](_0x5d87('0xca')),'ContactId':_0x1f7800[_0x5d87('0xdf')],'ListId':_0x1f7800[_0x5d87('0xe0')],'VoiceQueueId':_0x1f7800['VoiceQueueId']||undefined,'CampaignId':_0x1f7800[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x197')));break;default:return!![];}};Dialer[_0x5d87('0x1b')][_0x5d87('0x10f')]=function(_0xb0a5bc,_0xe8dffb,_0x16c54f){var _0x4fae0b=this;var _0x427afa=new History(_0xb0a5bc);var _0x72c5e4=![];var _0x13048f;var _0x593870;return new Promise(function(_0x41c717,_0x47f668){if(_['isUndefined'](_0xe8dffb)&&typeof _0xe8dffb!==_0x5d87('0x198')){return _0x47f668(msgResponse('[callProgressDetecting]','Failure',_0x5d87('0x199')));}if(_[_0x5d87('0x42')](_0x16c54f)&&typeof _0x16c54f!==_0x5d87('0x198')){return _0x47f668(msgResponse(_0x5d87('0x19a'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x427afa,_0x16c54f[_0x5d87('0xc6')],_0xe8dffb)[_0x5d87('0x9f')](function(_0x41118a){if(_0x41118a[_0x5d87('0xd9')]==0x1)_0x72c5e4=!![];switch(_0x16c54f[_0x5d87('0xc6')]){case'0':_0xe8dffb[_0x5d87('0x19b')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0x0;_0x427afa[_0x5d87('0x70')]='NoSuchNumber';_0x427afa[_0x5d87('0x12e')]+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;ami[_0x5d87('0x43')](_0x5d87('0x19c'),ut[_0x5d87('0x11b')](_0xb0a5bc,_0x5d87('0x19d')));_0x13048f=_0xe8dffb[_0x5d87('0x194')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x122')));if(_0x4fae0b['checkRetriveMax'](0x0,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa['countnosuchnumberretry']>=_0xe8dffb['dialNoSuchNumberMaxRetry']){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,'reason\x200\x20no\x20such\x20number....');}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x19e'));}}break;case'3':_0xe8dffb[_0x5d87('0x19f')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0x3;_0x427afa[_0x5d87('0x70')]='NoAnswer';_0x427afa['countnoanswerretry']+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;var _0x2acbf1=ut[_0x5d87('0x1a0')](_0xb0a5bc,_0xe8dffb);ami[_0x5d87('0x43')](_0x5d87('0x1a1'),_0x2acbf1);_0x13048f=_0xe8dffb['dialNoAnswerRetryFrequency'];_0x593870=_0xe8dffb['callAdditionalPhoneAfterMin'];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4fae0b[_0x5d87('0x1a2')](0x3,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x124')]>=_0xe8dffb[_0x5d87('0x18b')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1a3'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xe8dffb[_0x5d87('0x1a4')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0x5;_0x427afa[_0x5d87('0x70')]='Busy';_0x427afa[_0x5d87('0x123')]+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;ami[_0x5d87('0x43')](_0x5d87('0x1a5'),ut[_0x5d87('0x11b')](_0xb0a5bc,_0x5d87('0x1a6')));_0x13048f=_0xe8dffb[_0x5d87('0x18f')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1a7')));if(_0x4fae0b[_0x5d87('0x1a2')](0x5,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa['countbusyretry']>=_0xe8dffb[_0x5d87('0x18e')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,'reason\x205\x20busy');}else{_0x4fae0b['stateGlobal'](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1a8'));}}break;case'8':_0xe8dffb['outboundCongestionCallsDay']+=0x1;_0x427afa[_0x5d87('0xd1')]=0x8;_0x427afa[_0x5d87('0x70')]=_0x5d87('0x1a9');_0x427afa['countcongestionretry']+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;_0x13048f=_0xe8dffb['dialCongestionRetryFrequency'];_0x593870=_0xe8dffb['callAdditionalPhoneAfterMin'];ami['emit'](_0x5d87('0x1aa'),ut[_0x5d87('0x11b')](_0xb0a5bc,_0x5d87('0x1ab')));hopperUtils['createHistory'](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1ac')));if(_0x4fae0b['checkRetriveMax'](0x8,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x12d')]>=_0xe8dffb['dialCongestionMaxRetry']){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1ad'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1ad'));}}break;case'11':_0xe8dffb[_0x5d87('0x1ae')]+=0x1;_0x427afa['state']=0xb;_0x427afa[_0x5d87('0x70')]='Abandoned';_0x427afa[_0x5d87('0xeb')]+=0x1;_0x427afa['countglobal']+=0x1;_0x13048f=_0xe8dffb[_0x5d87('0xec')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4fae0b[_0x5d87('0x1a2')](0xb,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0xeb')]>=_0xe8dffb[_0x5d87('0xee')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1af'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1af'));}}break;case'20':_0xe8dffb['outboundRejectCallsDay']+=0x1;_0x427afa[_0x5d87('0xd1')]=0x14;_0x427afa[_0x5d87('0x70')]=_0x5d87('0x1b0');_0x427afa[_0x5d87('0x125')]+=0x1;_0x427afa[_0x5d87('0xd5')]+=0x1;_0x13048f=_0xe8dffb[_0x5d87('0x196')];_0x593870=_0xe8dffb[_0x5d87('0xd7')];ami[_0x5d87('0x43')](_0x5d87('0x1b1'),ut[_0x5d87('0x11b')](_0xb0a5bc,'agentreject'));hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1b2')));if(_0x4fae0b[_0x5d87('0x1a2')](0x14,_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x125')]>=_0xe8dffb[_0x5d87('0x1b3')]){_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x5d87('0x1b4'));}else{_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,'reason\x2020\x20agentreject');}}break;default:_0xe8dffb[_0x5d87('0x138')]+=0x1;_0x427afa[_0x5d87('0xd1')]=0xc;_0x427afa['statedesc']=_0x16c54f[_0x5d87('0xc6')];_0x13048f=_0xe8dffb[_0x5d87('0x196')];_0x593870=_0xe8dffb['callAdditionalPhoneAfterMin'];hopperUtils[_0x5d87('0xe5')](_0x427afa)[_0x5d87('0xa2')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4fae0b[_0x5d87('0x1a2')](_0x16c54f['reason'],_0xb0a5bc,_0xe8dffb)&&!_0x72c5e4){if(_0x427afa[_0x5d87('0x123')]+_0x427afa[_0x5d87('0x12d')]+_0x427afa[_0x5d87('0x124')]+_0x427afa[_0x5d87('0x12e')]+_0x427afa['countdropretry']+_0x427afa['countabandonedretry']+_0x427afa[_0x5d87('0x121')]+_0x427afa['countagentrejectretry']>=_0xe8dffb['dialGlobalMaxRetry']){_0x4fae0b[_0x5d87('0x130')](_0x427afa,_0x41c717,_0x47f668,_0x16c54f['reason']);}else{_0x4fae0b[_0x5d87('0x128')](_0x427afa,_0x41c717,_0x47f668,_0x16c54f[_0x5d87('0xc6')]);}}}})[_0x5d87('0x9f')](function(){if(_0x72c5e4){hopperUtils[_0x5d87('0xe7')](_0x427afa,_0x13048f,_0x593870)[_0x5d87('0x9f')](function(){return _0x41c717(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x5af3db,_0x4e6202,_0x588c18,_0x1c42cc){var _0x1bd3be=new Final(_0x5af3db);_0x1bd3be[_0x5d87('0xd1')]=0xf;_0x1bd3be[_0x5d87('0x70')]=_0x5d87('0x1b5');this[_0x5d87('0x128')](_0x1bd3be,_0x4e6202,_0x588c18,_0x1c42cc);};Dialer[_0x5d87('0x1b')][_0x5d87('0x128')]=function(_0x21f052,_0x449aef,_0x23467d,_0x1452ac){hopperUtils[_0x5d87('0xcb')](_0x21f052)[_0x5d87('0x9f')](function(){return _0x449aef(msgResponse(_0x5d87('0x19a'),_0x5d87('0x1b6'),_0x1452ac));})[_0x5d87('0xa2')](function(){return _0x23467d(msgResponse(_0x5d87('0x1b7'),_0x5d87('0x94'),_0x5d87('0x1b8')));});};Dialer[_0x5d87('0x1b')][_0x5d87('0xb')]=function(_0x582f06){var _0x571183=_0x582f06[_0x5d87('0x1b9')]/0x64;var _0x2d13bc=_0x582f06[_0x5d87('0x1ba')]/(_0x582f06[_0x5d87('0x1ba')]+_0x582f06[_0x5d87('0xc5')]);var _0x250c73=Math['round'](_0x582f06[_0x5d87('0x1bb')]*(_0x582f06[_0x5d87('0x1bc')]/0x64));var _0x4bc36a=Math['round'](_0x582f06['predictiveIntervalAvailable']*(_0x582f06[_0x5d87('0x1bd')]/0x64));var _0x2241ce=_0x582f06[_0x5d87('0x13f')]+_0x582f06['talking'];var _0x4a046b=Math[_0x5d87('0x1be')](_0x582f06[_0x5d87('0x1bf')]*_0x582f06[_0x5d87('0x1c0')]*_0x582f06['predictiveIntervalHitRate']*_0x582f06[_0x5d87('0x1c1')]);if(_['isUndefined'](_0x582f06[_0x5d87('0x2a')])){if(!_['isUndefined'](_0x582f06['startPredictive'])){_0x582f06[_0x5d87('0x29')]=undefined;loggerPredictive[_0x5d87('0x65')](_0x5d87('0x1c2'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x582f06[_0x5d87('0x63')])){loggerPredictive[_0x5d87('0x65')](_0x5d87('0x1c2'),_0x5d87('0x1c3'));clearInterval(_0x582f06['handlePredictive']);_0x582f06[_0x5d87('0x63')]=undefined;}_0x582f06[_0x5d87('0x2a')]=moment()['format'](_0x5d87('0xca'));loggerPredictive[_0x5d87('0x4c')](_0x582f06[_0x5d87('0x49')],_0x5d87('0x1c4'),_0x582f06[_0x5d87('0x2a')]);this[_0x5d87('0xb3')](_0x582f06,0x1);}else if(ifInterval(_0x582f06[_0x5d87('0x1c5')],_0x582f06['startProgressive'])){this[_0x5d87('0xb3')](_0x582f06,0x1);loggerPredictiveCalls[_0x5d87('0x4c')](_0x5d87('0x1c6'),_0x582f06['startProgressive'],_0x582f06[_0x5d87('0x49')]);_0x582f06[_0x5d87('0x1bf')]=0x0;_0x582f06['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x571183<_0x2d13bc&&_0x582f06['dialPredictiveOptimization']===_0x5d87('0x1c7')){clearPredictiveAttributes(_0x582f06);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x1c8'),_0x5d87('0x1c9'),_0x2d13bc,_0x5d87('0x2a'),_0x582f06['name']);}else if(_0x4a046b<_0x582f06[_0x5d87('0xd0')]&&_0x582f06['dialPredictiveOptimization']===_0x5d87('0x1c7')){clearPredictiveAttributes(_0x582f06);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x1ca'),_0x5d87('0x1cb'),_0x4a046b,_0x5d87('0x1cc'),_0x582f06[_0x5d87('0xd0')],_0x5d87('0x2a'),_0x582f06[_0x5d87('0x49')]);}else if(!ifInterval(_0x582f06[_0x5d87('0x1c5')],_0x582f06[_0x5d87('0x2a')])&&_['isUndefined'](_0x582f06[_0x5d87('0x29')])&&!_[_0x5d87('0x42')](_0x582f06[_0x5d87('0x2a')])){_0x582f06[_0x5d87('0x29')]=moment()[_0x5d87('0x48')](_0x5d87('0xca'));loggerPredictive['info'](_0x582f06[_0x5d87('0x49')],'started\x20in\x20predictive\x20at',_0x582f06[_0x5d87('0x29')]);hopperUtils[_0x5d87('0x1cd')](_0x582f06['dialPredictiveInterval'])[_0x5d87('0x9f')](this[_0x5d87('0x1ce')](_0x582f06))[_0x5d87('0x9f')](mergeDataErlangB(_0x582f06))['then'](this[_0x5d87('0x1cf')](_0x582f06))[_0x5d87('0xa2')](loggerCatchPredictive(_0x5d87('0x1d0'),_0x582f06));}else if(!ifInterval(_0x582f06[_0x5d87('0x1c5')],_0x582f06[_0x5d87('0x29')])){_0x582f06[_0x5d87('0xd0')]=0x0;_0x582f06[_0x5d87('0x29')]=moment()[_0x5d87('0x48')](_0x5d87('0xca'));loggerPredictive[_0x5d87('0x4c')](_0x582f06[_0x5d87('0x49')],_0x5d87('0x1d1'),_0x582f06['startPredictive']);clearInterval(_0x582f06['handlePredictive']);_0x582f06['handlePredictive']=undefined;hopperUtils[_0x5d87('0x1cd')](_0x582f06['dialPredictiveInterval'])['then'](this[_0x5d87('0x1ce')](_0x582f06))['then'](mergeDataErlangB(_0x582f06))[_0x5d87('0x9f')](this[_0x5d87('0x1cf')](_0x582f06))['catch'](loggerCatchPredictive(_0x5d87('0x1d2'),_0x582f06));}else if(_0x582f06[_0x5d87('0x1bb')]&&_0x2241ce<_0x582f06[_0x5d87('0x1bb')]-_0x4bc36a){clearPredictiveAttributes(_0x582f06);loggerPredictive['info'](_0x582f06[_0x5d87('0x49')],_0x5d87('0x1d3'),_0x2241ce,_0x5d87('0x1d4'),_0x582f06[_0x5d87('0x1bb')],'-',_0x4bc36a,'=',_0x582f06[_0x5d87('0x1bb')]-_0x4bc36a,')');}else if(_0x582f06[_0x5d87('0x1bb')]&&_0x2241ce>_0x582f06[_0x5d87('0x1bb')]+_0x250c73){clearPredictiveAttributes(_0x582f06);loggerPredictive[_0x5d87('0x4c')](_0x582f06['name'],_0x5d87('0x1d3'),_0x2241ce,_0x5d87('0x1d5'),_0x582f06[_0x5d87('0x1bb')],'+',_0x250c73,'=',_0x582f06['predictiveIntervalAvailable']+_0x250c73,')');}};Dialer[_0x5d87('0x1b')][_0x5d87('0x1ce')]=function(_0x3ca2ec){var _0x2fe622=this;return function(_0xca3177){return new Promise(function(_0x591126,_0x3d5036){_['merge'](_0x3ca2ec,_0xca3177[0x0]);if(checkGetDataPredictive(_0xca3177[0x0])){var _0x446b40=_0x3ca2ec[_0x5d87('0x1bb')]=_0x3ca2ec[_0x5d87('0x1d6')]+_0x3ca2ec['available'];var _0x46e596=_0x3ca2ec[_0x5d87('0x1c5')]*0x3c;var _0x2549f1=_0xca3177[0x0][_0x5d87('0x54')]+_0xca3177[0x0][_0x5d87('0x52')];var _0x357f56=(_0xca3177[0x0][_0x5d87('0x4e')]+_0xca3177[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xca3177[0x0][_0x5d87('0xe8')])/_0xca3177[0x0][_0x5d87('0x4d')];_0x3ca2ec[_0x5d87('0x1d7')]=_0x357f56>0x0?_0x357f56:0x1;switch(_0x3ca2ec[_0x5d87('0x1d8')]){case _0x5d87('0x1c7'):var _0xf5dac9=_0x3ca2ec[_0x5d87('0x1b9')]/0x64;return _0x2fe622[_0x5d87('0x1d9')](_0x446b40,_0x46e596,_0x2549f1,_0x357f56,_0xf5dac9)[_0x5d87('0x9f')](function(_0x15aa2b){return _0x591126(_0x15aa2b);});case _0x5d87('0x1da'):var _0xf663a1=_0x3ca2ec[_0x5d87('0x1b9')]/0x64;return _0x2fe622['busyFactor'](_0x446b40,_0x46e596,_0x2549f1,_0x357f56,_0xf663a1)['then'](function(_0xf6a55b){return _0x591126(_0xf6a55b);});default:return _0x3d5036(msgResponse('[getDataPredictive]',_0x5d87('0x94'),_0x5d87('0x1db')));}}else{return _0x3d5036(msgResponse(_0x5d87('0x1dc'),_0x5d87('0x94'),_0x5d87('0x1dd')));}});};};Dialer[_0x5d87('0x1b')][_0x5d87('0x1de')]=function(_0x45c414){var _0x1a01aa=this;return function(_0x28f350){return new Promise(function(_0xbe5ce1,_0x45c87d){_[_0x5d87('0x60')](_0x45c414,_0x28f350[0x0]);if(checkGetDataPredictive(_0x28f350[0x0])){loggerPredictive[_0x5d87('0x4c')](JSON[_0x5d87('0x85')](_0x28f350[0x0]));if(_0x45c414['dialPredictiveOptimization']===_0x5d87('0x1c7')){return _0x1a01aa[_0x5d87('0x152')](_0x45c414['id'])['then'](function(_0x460258){var _0x5a8819=_0x45c414[_0x5d87('0x1df')]-_0x460258[0x0][_0x5d87('0x1e0')];var _0x1ef750=_0x45c414['dialPredictiveInterval']*0x3c;var _0x2ed785=_0x28f350[0x0][_0x5d87('0x54')]+_0x28f350[0x0]['predictiveIntervalAvgHoldtime'];var _0x25f30b=(_0x28f350[0x0]['predictiveIntervalAnsweredCalls']+_0x28f350[0x0][_0x5d87('0x50')]+_0x28f350[0x0][_0x5d87('0xe8')])/_0x28f350[0x0][_0x5d87('0x4d')];var _0x41f49b=_0x45c414[_0x5d87('0x1b9')]/0x64;_0x45c414['predictiveIntervalPauses']=_0x460258[0x0]['outboundQueuePauses']||0x0;_0x45c414[_0x5d87('0x1d7')]=_0x25f30b>0x0?_0x25f30b:0x1;return _0x1a01aa['abandonmentRate'](_0x5a8819,_0x1ef750,_0x2ed785,_0x25f30b,_0x41f49b);})['then'](function(_0x17f021){return _0xbe5ce1(_0x17f021);})[_0x5d87('0xa2')](function(_0x1fe378){return _0x45c87d(msgResponse(_0x5d87('0x1e1'),_0x5d87('0x94'),JSON[_0x5d87('0x85')](_0x1fe378)));});}if(_0x45c414[_0x5d87('0x1d8')]===_0x5d87('0x1da')){return _0x1a01aa[_0x5d87('0x152')](_0x45c414['id'])['then'](function(_0x2e9481){var _0x434a21=_0x45c414[_0x5d87('0x1df')]-_0x2e9481[0x0][_0x5d87('0x1e0')];var _0x2744ef=_0x45c414[_0x5d87('0x1c5')]*0x3c;var _0x45dbda=_0x28f350[0x0]['predictiveIntervalAvgTalktime']+_0x28f350[0x0][_0x5d87('0x52')];var _0x3d21e8=(_0x28f350[0x0][_0x5d87('0x4e')]+_0x28f350[0x0][_0x5d87('0x50')]+_0x28f350[0x0][_0x5d87('0xe8')])/_0x28f350[0x0][_0x5d87('0x4d')];var _0x32bdfd=_0x45c414[_0x5d87('0x1b9')]/0x64;_0x45c414[_0x5d87('0x1e2')]=_0x2e9481[0x0][_0x5d87('0x1e0')]||0x0;_0x45c414[_0x5d87('0x1d7')]=_0x3d21e8>0x0?_0x3d21e8:0x1;return _0x1a01aa['busyFactor'](_0x434a21,_0x2744ef,_0x45dbda,_0x3d21e8,_0x32bdfd);})['then'](function(_0x1141eb){return _0xbe5ce1(_0x1141eb);})['catch'](function(_0x552a03){return _0x45c87d(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x552a03)));});}}else{return _0x45c87d(msgResponse(_0x5d87('0x1dc'),'Failure',_0x5d87('0x1dd')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x124f01){var _0xb682c0=this;return function(){var _0x29acfd=0x0;var _0x2b00fb=Math['floor'](_0x124f01['erlangCallToSecond']*0x3e8);if(_0x2b00fb>0x0){_0x2b00fb=_0x2b00fb<0x64?0x64:_0x2b00fb;loggerPredictive[_0x5d87('0x4c')](_0x124f01[_0x5d87('0x49')],_0x5d87('0x1e3'),_0x2b00fb,_0x5d87('0x1e4'));_0x124f01['handlePredictive']=setInterval(function(){_0xb682c0['handlePredictive'](_0x124f01);loggerPredictiveCalls[_0x5d87('0x4c')]('[handlePredictive]',_0x29acfd+=0x1);},_0x2b00fb);}else{loggerPredictive['info'](_0x124f01[_0x5d87('0x49')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x5d87('0x1b')][_0x5d87('0x1e5')]=function(_0xfb07c3,_0x38d810){var _0x2a9f14=this;return function(_0x8a4fb9){if(_[_0x5d87('0x4b')](_0x8a4fb9)){if(_[_0x5d87('0xf8')](_0x38d810['UserId'])||!_0x38d810[_0x5d87('0x1e6')]){if(_0xfb07c3[_0x5d87('0xaf')]===_0x5d87('0xa')){_0xfb07c3['queueStatusComplete']=_['isUndefined'](_0xfb07c3[_0x5d87('0x1e7')])?!![]:_0xfb07c3[_0x5d87('0x1e7')];var _0x271220=uuid['v4']();_0x2a9f14['actions'][_0x271220]=new Action(_0xfb07c3,_0x38d810,_0x271220);loggerBooked[_0x5d87('0x4c')](_0x5d87('0x1e8'),_0x271220,_0x5d87('0x1e9'),JSON[_0x5d87('0x85')](_0xfb07c3[_0x5d87('0x1e7')]),'Queue:\x20',_0xfb07c3[_0x5d87('0x49')]);if(_0xfb07c3[_0x5d87('0x1e7')]){_0xfb07c3[_0x5d87('0x1e7')]=![];_0x2a9f14[_0x5d87('0x2c')][_0x2a9f14[_0x5d87('0x26')][_0x271220]['queue']]=[];ami[_0x5d87('0x9c')]({'actionid':_0x271220,'action':_0x5d87('0x1ea'),'queue':_0xfb07c3['name']})[_0x5d87('0xa2')](function(){_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2a9f14['actions'][_0x271220][_0x5d87('0xdf')],'ListId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe0')],'VoiceQueueId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe1')]||undefined,'CampaignId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2a9f14[_0x5d87('0x26')][_0x271220];});}else{loggerBooked['info'](_0x5d87('0x1eb'),JSON[_0x5d87('0x85')](_0xfb07c3[_0x5d87('0x1e7')]),_0x5d87('0x1ec'),_0xfb07c3['name']);_0x2a9f14['updateOriginated'](_0xfb07c3);hopperUtils[_0x5d87('0xdb')]({'active':![],'ContactId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xdf')],'ListId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe0')],'VoiceQueueId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xe1')]||undefined,'CampaignId':_0x2a9f14[_0x5d87('0x26')][_0x271220][_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1ed')));delete _0x2a9f14['actions'][_0x271220];}}else{return _0x2a9f14['actionOriginate'](_0xfb07c3,_0x38d810);}}else{if(utils[_0x5d87('0x61')](undefined,_0x38d810[_0x5d87('0x1ee')])<_0xfb07c3[_0x5d87('0x1ef')]*0x3c){if(_0x38d810['Agent']&&!_0x38d810['Agent'][_0x5d87('0x1f0')]){_0x2a9f14['preview'][_0x5d87('0x104')](_0x38d810['id'])[_0x5d87('0x1e')](function(){_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);});}else{hopperUtils[_0x5d87('0x1f1')]({'active':![]},_0x38d810['id'],0x1)['finally'](function(){_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);});}}else{_0xfb07c3[_0x5d87('0x1f2')]+=0x1;_0x2a9f14[_0x5d87('0xc2')](_0xfb07c3);if(_0xfb07c3[_0x5d87('0x1f3')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x38d810[_0x5d87('0xdf')],'ListId':_0x38d810['ListId'],'VoiceQueueId':_0x38d810['VoiceQueueId']||undefined,'CampaignId':_0x38d810[_0x5d87('0xef')]||undefined})[_0x5d87('0xa2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x5d87('0xe5')](createObjHistory(_0xfb07c3,_0x38d810,utils[_0x5d87('0x6b')][_0x5d87('0x1f4')],0x17,_0x5d87('0x1f5')))[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x1f6')));}else{_0x2a9f14[_0x5d87('0x11d')](createObjHistory(_0xfb07c3,_0x38d810,utils[_0x5d87('0x6b')]['RECALL_TIMEOUT'],0x16,_0x5d87('0x1f7')),'[Originate][HistoryRecallClose][historyCatch]',_0x5d87('0x1f8'));}}}}else{_0xfb07c3[_0x5d87('0x1f9')]+=0x1;_0x2a9f14[_0x5d87('0x11d')](createObjHistory(_0xfb07c3,_0x38d810,utils[_0x5d87('0x6b')][_0x5d87('0x1fa')],0xd,_0x5d87('0x1fb')),'[Originate][historyBlacklist]',_0x5d87('0x1fc'));throw _0x5d87('0x1fd');}};};Dialer[_0x5d87('0x1b')][_0x5d87('0x1fe')]=function(_0x549d19){var _0x1e7c32=this;var _0x3352e5=_0x549d19['limitCalls']-_0x549d19['originated'];emitCampaignSummary(_0x549d19);if(_0x3352e5>0x0&&_0x549d19[_0x5d87('0x67')]==0x0){if(_0x3352e5>this[_0x5d87('0x24')]){_0x3352e5=this['maxNumberOriginate'];}_0x549d19[_0x5d87('0x67')]=0x1;hopperUtils[_0x5d87('0x1ff')](_0x549d19,_0x3352e5)[_0x5d87('0x9f')](function(_0x22ec56){_0x549d19[_0x5d87('0x67')]=0x0;if(_0x22ec56){if(!utils['checkContactEmpty'](_0x22ec56)){_0x549d19[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')]['NO_AVAILABLE_CONTACTS'];logger[_0x5d87('0x4c')](_0x5d87('0x200')+_0x549d19['name']);}else{_0x549d19['originated']+=_0x22ec56['length'];_0x549d19[_0x5d87('0x6a')]=utils[_0x5d87('0x6b')][_0x5d87('0x201')];for(var _0xd65cee=0x0;_0xd65cee<_0x22ec56[_0x5d87('0x9a')];_0xd65cee+=0x1){_0x549d19[_0x5d87('0x202')]+=0x1;if(_[_0x5d87('0xf8')](_0x22ec56[_0xd65cee])||_[_0x5d87('0xf8')](_0x22ec56[_0xd65cee][_0x5d87('0x179')])||_['isNil'](_0x22ec56[_0xd65cee][_0x5d87('0x160')])){_0x1e7c32[_0x5d87('0x203')](_0x5d87('0x204'),_0x549d19,_0x22ec56[_0xd65cee]);}else{hopperUtils[_0x5d87('0x205')](_[_0x5d87('0x75')](_0x22ec56[_0xd65cee],['CampaignId','phone']))['then'](_0x1e7c32[_0x5d87('0x1e5')](_0x549d19,_0x22ec56[_0xd65cee]))['catch'](_0x1e7c32[_0x5d87('0x156')](_0x5d87('0x206'),_0x549d19));}}}}})[_0x5d87('0xa2')](loggerGetContactDialer(_0x5d87('0x207'),_0x549d19,_0x3352e5));}};Dialer[_0x5d87('0x1b')][_0x5d87('0xb3')]=function(_0x20d85c,_0x2b9f0a){var _0x3b823e=this;var _0x8799a9=[];if(_0x2b9f0a<0x1||_0x20d85c[_0x5d87('0xaf')]===_0x5d87('0xa')){_0x2b9f0a=0x1;}var _0x214567=Math[_0x5d87('0x1be')](_0x20d85c['available']*_0x2b9f0a)-_0x20d85c[_0x5d87('0x80')];if(_0x20d85c['dialLimitQueue']>0x0){var _0x3bf207=_0x20d85c[_0x5d87('0x208')]-_0x20d85c['originated']-_0x20d85c[_0x5d87('0x1d6')]-_0x20d85c[_0x5d87('0x141')];if(_0x214567>_0x3bf207){_0x214567=_0x3bf207;}}if(_0x214567>0x0&&_0x20d85c[_0x5d87('0x67')]==0x0){if(_0x20d85c[_0x5d87('0xaf')]===_0x5d87('0xa')){_0x214567=0x1;}if(_0x214567>this[_0x5d87('0x24')]){_0x214567=this[_0x5d87('0x24')];}for(var _0x4ce18b in this[_0x5d87('0x22')]){if(typeof this[_0x5d87('0x22')][_0x4ce18b]!==_0x5d87('0x153')){if(this[_0x5d87('0x22')][_0x4ce18b][_0x5d87('0xd1')]===_0x5d87('0x209')&&this[_0x5d87('0x22')][_0x4ce18b]['status']===_0x5d87('0x8a')){_0x8799a9[_0x5d87('0x9b')](this[_0x5d87('0x22')][_0x4ce18b]['id']);}}}_0x20d85c[_0x5d87('0x67')]=0x1;hopperUtils[_0x5d87('0x20a')](_0x20d85c,_0x8799a9,_0x214567)['then'](function(_0x1ded2f){_0x20d85c['temp']=0x0;if(_0x1ded2f){if(!utils['checkContactEmpty'](_0x1ded2f)){hopperUtils[_0x5d87('0x20b')](_0x20d85c)[_0x5d87('0x9f')](sendMessageReschedule(_0x20d85c))[_0x5d87('0xa2')](loggerCatch(_0x5d87('0x20c')));}else{_0x20d85c[_0x5d87('0x80')]+=_0x1ded2f['length'];_0x20d85c[_0x5d87('0x6a')]=_0x20d85c[_0x5d87('0xaf')]===_0x5d87('0xa')?utils[_0x5d87('0x6b')]['ACTIVE']:utils[_0x5d87('0x6b')][_0x5d87('0x201')];for(var _0x34c6f4=0x0;_0x34c6f4<_0x1ded2f['length'];_0x34c6f4+=0x1){if(_['isNil'](_0x1ded2f[_0x34c6f4])||_[_0x5d87('0xf8')](_0x1ded2f[_0x34c6f4]['Contact'])||_[_0x5d87('0xf8')](_0x1ded2f[_0x34c6f4][_0x5d87('0x160')])){_0x3b823e[_0x5d87('0x203')](_0x5d87('0x204'),_0x20d85c,_0x1ded2f[_0x34c6f4]);}else{hopperUtils[_0x5d87('0x20d')](_[_0x5d87('0x75')](_0x1ded2f[_0x34c6f4],[_0x5d87('0xe1'),_0x5d87('0x160')]))[_0x5d87('0x9f')](_0x3b823e[_0x5d87('0x1e5')](_0x20d85c,_0x1ded2f[_0x34c6f4]))[_0x5d87('0xa2')](_0x3b823e[_0x5d87('0x156')](_0x5d87('0x204'),_0x20d85c));}}}}})[_0x5d87('0xa2')](loggerGetContactDialer(_0x5d87('0x20e'),_0x20d85c,_0x214567));}};Dialer[_0x5d87('0x1b')][_0x5d87('0x63')]=function(_0x29bab8){if(_0x29bab8[_0x5d87('0x208')]>0x0){var _0x3d4793=_0x29bab8[_0x5d87('0x208')]-_0x29bab8[_0x5d87('0x80')]-_0x29bab8[_0x5d87('0x1d6')];if(_0x3d4793>0x0&&_0x29bab8[_0x5d87('0x67')]==0x0){this[_0x5d87('0x20f')](_0x29bab8);}else{loggerPredictiveCalls[_0x5d87('0x4c')](_0x5d87('0x210'));}}else{this['tryOriginatePredictive'](_0x29bab8);}};Dialer['prototype'][_0x5d87('0x20f')]=function(_0x1a0eff){var _0x1f1ab0=this;var _0x4a7d6e=[];_0x1a0eff['originated']+=0x1;for(var _0xfa0379 in this[_0x5d87('0x22')]){if(typeof this[_0x5d87('0x22')][_0xfa0379]!==_0x5d87('0x153')){if(this[_0x5d87('0x22')][_0xfa0379][_0x5d87('0xd1')]===_0x5d87('0x209')&&this[_0x5d87('0x22')][_0xfa0379][_0x5d87('0x89')]===_0x5d87('0x8a')){_0x4a7d6e[_0x5d87('0x9b')](this[_0x5d87('0x22')][_0xfa0379]['id']);}}}_0x1a0eff[_0x5d87('0x67')]=0x1;return this['getContactDialer'](_0x1a0eff['id'],_0x4a7d6e,0x1,_0x1a0eff['dialOrderByScheduledAt'],_0x1a0eff)['then'](function(_0x34be4d){_0x1a0eff[_0x5d87('0x67')]=0x1;if(_0x34be4d){if(!utils[_0x5d87('0x211')](_0x34be4d)){utils['checkContactLowerLimitOriginate'](_0x1a0eff,0x1,0x0);return hopperUtils[_0x5d87('0x20b')](_0x1a0eff)[_0x5d87('0x9f')](sendMessageReschedule(_0x1a0eff))[_0x5d87('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x1a0eff[_0x5d87('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5d87('0x201')];if(_[_0x5d87('0xf8')](_0x34be4d[0x0])||_[_0x5d87('0xf8')](_0x34be4d[0x0][_0x5d87('0x179')])||_[_0x5d87('0xf8')](_0x34be4d[0x0]['phone'])){_0x1f1ab0[_0x5d87('0x203')](_0x5d87('0x204'),_0x1a0eff,_0x34be4d[0x0]);}else{return hopperUtils[_0x5d87('0x20d')](_[_0x5d87('0x75')](_0x34be4d[0x0],[_0x5d87('0xe1'),_0x5d87('0x160')]))['then'](_0x1f1ab0['checkContactBlack'](_0x1a0eff,_0x34be4d[0x0]))[_0x5d87('0xa2')](_0x1f1ab0[_0x5d87('0x156')](_0x5d87('0x212'),_0x1a0eff));}}}})[_0x5d87('0xa2')](loggerGetContactDialer('[getContactDialerPredictive]',_0x1a0eff,0x1));};Dialer[_0x5d87('0x1b')][_0x5d87('0x1d9')]=function(_0x3951be,_0x1f14d4,_0x3adac6,_0x59da7c,_0x11ae07,_0x592e52){loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x213'));loggerPredictive['info'](_0x5d87('0x214'),_0x3951be);loggerPredictive[_0x5d87('0x4c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f14d4);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x215'),_0x3adac6);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x216'),_0x59da7c);loggerPredictive['info'](_0x5d87('0x217'),_0x11ae07);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));return new Promise(function(_0x38eb51,_0x1fcd56){if(_0x3951be<=0x0||isNaN(_0x3951be)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),'Error',_0x5d87('0x219')+_0x3951be));}if(_0x3adac6<=0x0||isNaN(_0x3adac6)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),_0x5d87('0xbe'),'Ts\x20=\x20'+_0x3adac6));}if(_0x59da7c<=0x0||isNaN(_0x59da7c)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),_0x5d87('0xbe'),_0x5d87('0x21a')+_0x59da7c));}if(_0x1f14d4<=0x0||isNaN(_0x1f14d4)){return _0x1fcd56(msgResponse(_0x5d87('0x218'),_0x5d87('0xbe'),_0x5d87('0x21b')+_0x1f14d4));}if(_0x11ae07<=0x0||isNaN(_0x11ae07)){return _0x1fcd56(msgResponse('[abandonmentRate]',_0x5d87('0xbe'),_0x5d87('0x21c')+_0x11ae07));}_0x592e52=_0x592e52||0x0;var _0x2fd8ce=0x1/_0x3adac6;var _0x5d0001=0x0;var _0x397076=0x0;var _0x16f8fc=0x0;var _0x35de1f=0x0;for(var _0x535700=0x0;_0x16f8fc<_0x11ae07;_0x535700+=0x1){_0x397076=_0x535700/_0x1f14d4;_0x5d0001=(_0x59da7c*_0x397076+_0x592e52)/_0x2fd8ce;_0x16f8fc=utils['erlangb'](_0x5d0001,_0x3951be);_0x35de1f=_0x5d0001/_0x3951be*(0x1-utils[_0x5d87('0x21d')](_0x5d0001,_0x3951be));}return _0x38eb51({'erlangCalls':_0x535700,'erlangCallToSecond':_0x1f14d4/_0x535700,'erlangAbandonmentRate':_0x16f8fc,'erlangBusyFactor':_0x35de1f});});};Dialer['prototype'][_0x5d87('0x21e')]=function(_0x972dc8,_0x14b6d4,_0x84ddc6,_0x477549,_0x830e7e,_0x1f2ffd){loggerPredictive[_0x5d87('0x4c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x214'),_0x972dc8);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x21f'),_0x14b6d4);loggerPredictive['info'](_0x5d87('0x215'),_0x84ddc6);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x216'),_0x477549);loggerPredictive[_0x5d87('0x4c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x830e7e);loggerPredictive[_0x5d87('0x4c')](_0x5d87('0x55'));return new Promise(function(_0x5e1356,_0x233432){if(_0x972dc8<=0x0||isNaN(_0x972dc8)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),_0x5d87('0x219')+_0x972dc8));}if(_0x84ddc6<=0x0||isNaN(_0x84ddc6)){return _0x233432(msgResponse('[busyFactor]',_0x5d87('0xbe'),_0x5d87('0x221')+_0x84ddc6));}if(_0x477549<=0x0||isNaN(_0x477549)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),'p\x20=\x20'+_0x477549));}if(_0x14b6d4<=0x0||isNaN(_0x14b6d4)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),'interval\x20=\x20'+_0x14b6d4));}if(_0x830e7e<=0x0||isNaN(_0x830e7e)){return _0x233432(msgResponse(_0x5d87('0x220'),_0x5d87('0xbe'),_0x5d87('0x222')+_0x830e7e));}_0x1f2ffd=_0x1f2ffd||0x0;var _0x31c8a5=0x1/_0x84ddc6;var _0x3b51b0=0x0;var _0x46fb52=0x0;var _0x14e882=0x0;var _0x1d8da2=0x0;for(var _0x11f46f=0x0;_0x1d8da2<_0x830e7e;_0x11f46f+=0x1){_0x46fb52=_0x11f46f/_0x14b6d4;_0x3b51b0=(_0x477549*_0x46fb52+_0x1f2ffd)/_0x31c8a5;_0x14e882=utils[_0x5d87('0x21d')](_0x3b51b0,_0x972dc8);_0x1d8da2=_0x3b51b0/_0x972dc8*(0x1-utils[_0x5d87('0x21d')](_0x3b51b0,_0x972dc8));}return _0x5e1356({'erlangCalls':_0x11f46f,'erlangCallToSecond':_0x14b6d4/_0x11f46f,'erlangAbandonmentRate':_0x14e882,'erlangBusyFactor':_0x1d8da2});});};module[_0x5d87('0x223')]=Dialer; \ No newline at end of file +var _0xce18=['SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','floor','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','dialMethod','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','preview','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','checkContactEmpty','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','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','m\x20=\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','inspect','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','iftime\x20%s,%s','interval','content','true','catch','indexOf','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','OVERTIME_INTERVAL','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','syncAgentConnect','uniqueid','ivr','updateOriginated','queue','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','voiceQueue','additional','dialDropMaxRetry','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','rescheduleContact','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','syncQueueMember','actionid','rrmemory','roundrobin','isNil','locked','paused','stateinterface','strategy','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','run','finally','pick','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','[syncQueueSummary]','filter','online','map','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables'];(function(_0x42c2a8,_0x5d0f53){var _0x413213=function(_0x24069b){while(--_0x24069b){_0x42c2a8['push'](_0x42c2a8['shift']());}};_0x413213(++_0x5d0f53);}(_0xce18,0x9b));var _0x8ce1=function(_0xd3e47a,_0x178e51){_0xd3e47a=_0xd3e47a-0x0;var _0x28af86=_0xce18[_0xd3e47a];return _0x28af86;};'use strict';var util=require(_0x8ce1('0x0'));var _=require(_0x8ce1('0x1'));var uuid=require(_0x8ce1('0x2'));var moment=require(_0x8ce1('0x3'));var rr=require('rr');var Redis=require(_0x8ce1('0x4'));var utils=require('./utils');var hopperUtils=require(_0x8ce1('0x5'));var ut=require(_0x8ce1('0x6'));var config=require('../../../config/environment/');var logger=require(_0x8ce1('0x7'))(_0x8ce1('0x8'));var loggerBooked=require(_0x8ce1('0x7'))(_0x8ce1('0x9'));var loggerPredictive=require(_0x8ce1('0x7'))(_0x8ce1('0xa'));var loggerPredictiveCalls=require(_0x8ce1('0x7'))(_0x8ce1('0xb'));var loggerSyncQueueSummary=require(_0x8ce1('0x7'))(_0x8ce1('0xc'));var ami=require(_0x8ce1('0xd'));config['redis']=_[_0x8ce1('0xe')](config[_0x8ce1('0xf')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x8ce1('0x10'));var voiceQueueRt=require(_0x8ce1('0x11'));var RpcSetting=require(_0x8ce1('0x12'));var Interval=require(_0x8ce1('0x13'));var Action=require(_0x8ce1('0x14'));var History=require('./models/history');var Final=require(_0x8ce1('0x15'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x8ce1('0x16'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x8ce1('0x17')]||_0x8ce1('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8ce1('0x19')][_0x8ce1('0x1a')]=function(_0x1365b6){this[_0x8ce1('0x1b')]=this[_0x8ce1('0x1b')]?this[_0x8ce1('0x1b')]['finally'](_0x1365b6):_0x1365b6();};function Dialer(_0x911bd5,_0x166972){this[_0x8ce1('0x1c')]=new Sequence();this['preview']=_0x166972;this[_0x8ce1('0x1d')]=_0x911bd5[_0x8ce1('0x1d')];this['campaigns']=_0x911bd5[_0x8ce1('0x1e')];this[_0x8ce1('0x1f')]=_0x911bd5[_0x8ce1('0x1f')];this[_0x8ce1('0x20')]=_0x911bd5['trunks'];this['maxNumberOriginate']=config[_0x8ce1('0x21')]||0x2;this[_0x8ce1('0x22')]={};this[_0x8ce1('0x23')]={};this[_0x8ce1('0x24')]={};this[_0x8ce1('0x25')]={};this[_0x8ce1('0x26')]={};this['startPredictive']={};this[_0x8ce1('0x27')]={};this[_0x8ce1('0x28')]={};this[_0x8ce1('0x29')]={};this[_0x8ce1('0x2a')]={};this[_0x8ce1('0x2b')]={};ami['on'](_0x8ce1('0x2c'),this['syncAgentConnect'][_0x8ce1('0x2d')](this));ami['on'](_0x8ce1('0x2e'),this['syncQueueCallerAbandon'][_0x8ce1('0x2d')](this));ami['on'](_0x8ce1('0x2f'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x8ce1('0x30'),this[_0x8ce1('0x31')][_0x8ce1('0x2d')](this));ami['on'](_0x8ce1('0x32'),this[_0x8ce1('0xc')][_0x8ce1('0x2d')](this));ami['on'](_0x8ce1('0x33'),this[_0x8ce1('0x34')][_0x8ce1('0x2d')](this));ami['on'](_0x8ce1('0x35'),this[_0x8ce1('0x36')]['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x8ce1('0x37'),this['syncVarSet'][_0x8ce1('0x2d')](this));ami['on'](_0x8ce1('0x38'),this['syncQueueMember']['bind'](this));ami['on'](_0x8ce1('0x39'),this[_0x8ce1('0x3a')][_0x8ce1('0x2d')](this));this['loopCampaigns']();this[_0x8ce1('0x3b')]();RpcSetting[_0x8ce1('0x3c')]()[_0x8ce1('0x3d')](function(_0xcf50e2){previewRecallmeReminderInterval=_0xcf50e2[_0x8ce1('0x3e')];});}function isNotNull(_0xef7607){return _0xef7607!==null&&!_[_0x8ce1('0x3f')](_0xef7607);}function msgResponse(_0x2848df,_0x245ff0,_0xf459f1){return{'action':_0x2848df,'response':_0x245ff0,'message':_0xf459f1,'stack':_0xf459f1};}function emit(_0x49c11f,_0x477e02,_0x3e8c4b){io['to'](_0x49c11f)[_0x8ce1('0x40')](_0x477e02,_0x3e8c4b);}function emitOutboundVoiceQueueSummary(_0xb5bc57){if(_0xb5bc57[_0x8ce1('0x41')]==='outbound'){logger[_0x8ce1('0x42')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x8ce1('0x43')](_0xb5bc57,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0xb5bc57[_0x8ce1('0x44')]),_0x8ce1('0x45'),_0xb5bc57);}}function checkGetDataPredictive(_0x3e5172){if(isNotNull(_0x3e5172)&&!_[_0x8ce1('0x46')](_0x3e5172)){loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x48'));loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x49'),_0x3e5172[_0x8ce1('0x4a')]);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x4b'),_0x3e5172[_0x8ce1('0x4c')]);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x4d'),_0x3e5172[_0x8ce1('0x4e')]);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x4f'),_0x3e5172[_0x8ce1('0x50')]);loggerPredictive['info'](_0x8ce1('0x51'),_0x3e5172[_0x8ce1('0x52')]);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x53'),_0x3e5172[_0x8ce1('0x54')]);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x55'));if(_0x3e5172[_0x8ce1('0x4a')]>0x0){if(!_[_0x8ce1('0x3f')](_0x3e5172['predictiveIntervalAvgTalktime'])&&_0x3e5172[_0x8ce1('0x54')]>0x0){return!![];}loggerPredictive[_0x8ce1('0x47')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x8ce1('0x3f')](_0x3e5172[_0x8ce1('0x52')])&&_0x3e5172['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x56'));}else{loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x57'));}}else{loggerPredictive['info'](_0x8ce1('0x58'));}return![];}function mergeDataErlangB(_0x1a0586){return function(_0x17d6a1){loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x59'));loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x5a'),_0x17d6a1['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17d6a1['erlangCallToSecond']);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x5b'),_0x17d6a1[_0x8ce1('0x5c')]);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x5d'),_0x17d6a1[_0x8ce1('0x5e')]);loggerPredictive[_0x8ce1('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17d6a1[_0x8ce1('0x5c')]);loggerPredictive[_0x8ce1('0x47')]('---------------------------');_[_0x8ce1('0x5f')](_0x1a0586,_0x17d6a1);};}function ifInterval(_0x491881,_0xd051c6){if(_[_0x8ce1('0x3f')](_0xd051c6)){return![];}return utils[_0x8ce1('0x60')](undefined,_0xd051c6)<_0x491881*0x3c;}function clearPredictiveAttributes(_0x1d2350){if(_0x1d2350[_0x8ce1('0x27')]){_0x1d2350[_0x8ce1('0x27')]=undefined;loggerPredictive[_0x8ce1('0x42')](_0x1d2350[_0x8ce1('0x44')],_0x8ce1('0x61'));}if(_0x1d2350[_0x8ce1('0x62')]){_0x1d2350[_0x8ce1('0x62')]=undefined;loggerPredictive['debug'](_0x1d2350[_0x8ce1('0x44')],_0x8ce1('0x63'));}if(_0x1d2350[_0x8ce1('0x64')]){clearInterval(_0x1d2350[_0x8ce1('0x64')]);_0x1d2350['handlePredictive']=undefined;loggerPredictive['debug'](_0x1d2350[_0x8ce1('0x44')],_0x8ce1('0x65'));}}function loggerCatchPredictive(_0x1d49ac,_0x2bccca){return function(_0x1a4b91){loggerPredictive[_0x8ce1('0x66')](_0x2bccca[_0x8ce1('0x44')],_0x1d49ac);loggerPredictive[_0x8ce1('0x66')](_0x1a4b91[_0x8ce1('0x67')]);clearPredictiveAttributes(_0x2bccca);};}function loggerCatch(_0x396cba){return function(_0x4c9444){logger[_0x8ce1('0x66')](_0x396cba,util[_0x8ce1('0x43')](_0x4c9444,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3b1b55,_0x2233fe,_0x36d023){return function(_0x180b15){utils[_0x8ce1('0x68')](_0x2233fe,_0x36d023,0x0);_0x2233fe[_0x8ce1('0x69')]=0x0;logger[_0x8ce1('0x66')](_0x3b1b55,util[_0x8ce1('0x43')](_0x180b15,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3078af){return function(_0xeceb16){if(isNotNull(_0xeceb16)&&isNotNull(_0xeceb16[0x0])){if(_0xeceb16[0x0]['contactsRescheduled']>0x0){_0x3078af[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x6c')];logger[_0x8ce1('0x47')](_0x8ce1('0x6d')+_0x3078af['name'],_0xeceb16[0x0][_0x8ce1('0x6e')],_0x8ce1('0x6f'));}else{_0x3078af[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x70')];logger[_0x8ce1('0x47')](_0x8ce1('0x71')+_0x3078af[_0x8ce1('0x44')]);}}};}function createObjHistory(_0x497fe7,_0x1c575d,_0x94525,_0x1ec79e,_0x7309cc){_0x497fe7['message']=_0x94525;var _0x17c8dc=new Action(_0x497fe7,_0x1c575d);var _0x182fc9=new History(_0x17c8dc);_0x182fc9[_0x8ce1('0x72')]=_0x1ec79e;_0x182fc9['statedesc']=_0x7309cc;_0x182fc9[_0x8ce1('0x73')]=_0x17c8dc[_0x8ce1('0x74')];return _0x182fc9;}function unlockQueueStatus(_0x56f257,_0x2e03e3){setTimeout(function(){if(_['isUndefined'](_0x56f257[_0x8ce1('0x75')])){loggerBooked[_0x8ce1('0x66')](_0x8ce1('0x76'),_0x2e03e3);}_0x56f257['queueStatusComplete']=!![];loggerBooked[_0x8ce1('0x47')]('[booked][unlockQueueStatus]',_0x2e03e3,JSON[_0x8ce1('0x77')](_['pick'](_0x56f257,[_0x8ce1('0x44'),_0x8ce1('0x75')])));},0x1f3);}function checkInterval(_0x5ac114){return function(){if(!isNotNull(_0x5ac114[_0x8ce1('0x78')])){_0x5ac114[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x79')];throw _0x5ac114[_0x8ce1('0x44')]+_0x8ce1('0x7a');}if(!isNotNull(_0x5ac114[_0x8ce1('0x78')][_0x8ce1('0x7b')])){_0x5ac114[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x79')];throw _0x5ac114[_0x8ce1('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x8ce1('0x46')](_0x5ac114[_0x8ce1('0x78')][_0x8ce1('0x7b')]))){_0x5ac114[_0x8ce1('0x6a')]=utils['CAMPAIGN_STATUS'][_0x8ce1('0x79')];throw _0x5ac114[_0x8ce1('0x44')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x1d9e2c){return function(){if(!utils[_0x8ce1('0x7c')](_0x1d9e2c)){_0x1d9e2c[_0x8ce1('0x6a')]=utils['CAMPAIGN_STATUS'][_0x8ce1('0x7d')];throw _0x1d9e2c['name']+_0x8ce1('0x7e');}};}function emitCampaignSummary(_0x323802){if(utils[_0x8ce1('0x7f')](_0x323802)){emit(util[_0x8ce1('0x80')](_0x8ce1('0x81'),_0x323802[_0x8ce1('0x44')]),_0x8ce1('0x82'),_0x323802);}}function loggerCatchQueueSummary(_0x171245,_0x3c6c6a){return function(_0x4a8324){clearPredictiveAttributes(_0x3c6c6a);emitCampaignSummary(_0x3c6c6a);loggerSyncQueueSummary['debug'](_0x171245,util['inspect'](_0x4a8324,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x53bb88){if(_0x53bb88[_0x8ce1('0x83')]){if(_0x53bb88[_0x8ce1('0x84')]===0x0){_0x53bb88['sendMessageOneNotActive']=![];_0x53bb88['message']=utils[_0x8ce1('0x6b')][_0x8ce1('0x7d')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x53bb88['name'],'is\x20not\x20active');}else{_0x53bb88[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x85')];loggerSyncQueueSummary[_0x8ce1('0x42')](_0x8ce1('0x86'),_0x53bb88['name'],_0x8ce1('0x87'));}emitCampaignSummary(_0x53bb88);}}function myreject(_0x25ff09){return function(_0x3d2997){return _0x25ff09(msgResponse(_0x8ce1('0x88'),_0x8ce1('0x89'),JSON[_0x8ce1('0x77')](_0x3d2997)));};}Dialer['prototype']['isTrunkReachable']=function(_0x284f0a){return!_[_0x8ce1('0x3f')](_0x284f0a)&&_0x284f0a&&!_[_0x8ce1('0x3f')](_0x284f0a[_0x8ce1('0x44')])&&!_[_0x8ce1('0x3f')](_0x284f0a[_0x8ce1('0x8a')])&&_0x284f0a[_0x8ce1('0x8a')]&&(this[_0x8ce1('0x20')][util[_0x8ce1('0x80')](_0x8ce1('0x8b'),_0x284f0a['name'])][_0x8ce1('0x8c')]===_0x8ce1('0x8d')||this[_0x8ce1('0x20')][util[_0x8ce1('0x80')](_0x8ce1('0x8b'),_0x284f0a[_0x8ce1('0x44')])]['status']===_0x8ce1('0x8e'));};Dialer[_0x8ce1('0x19')][_0x8ce1('0x8f')]=function(_0x20d6b5){var _0x2a7065=this;return function(){if(!_0x2a7065[_0x8ce1('0x90')](_0x20d6b5[_0x8ce1('0x91')])){if(!_0x2a7065[_0x8ce1('0x90')](_0x20d6b5[_0x8ce1('0x92')])){_0x20d6b5[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')]['TRUNK_NOT_REACHABLE'];throw _0x20d6b5[_0x8ce1('0x44')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x8ce1('0x19')]['checkIfTime']=function(_0x782b09,_0x115b2f,_0x1b227c,_0x311bea){var _0x45e2c2=this;return function(){var _0x1f6cd0=!![];return _0x45e2c2[_0x8ce1('0x93')](_0x782b09,_0x115b2f,_0x1b227c,_0x311bea,_0x1f6cd0);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x1968ba,_0xb1cffd,_0x38f326,_0x2a48d5){var _0x4ce650=this;return function(){var _0x1922e9=![];return _0x4ce650[_0x8ce1('0x93')](_0x1968ba[_0x8ce1('0x7b')],_0xb1cffd,_0x38f326,_0x2a48d5,_0x1922e9);};};Dialer['prototype'][_0x8ce1('0x93')]=function(_0x2ea65c,_0x5b6d57,_0x586542,_0x270150,_0x49c383){var _0x3dc8f1=[];return new Promise(function(_0x4ab69b,_0x184d11){if(!isNotNull(_0x2ea65c)){_0x270150[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')]['NULL_INTERVAL'];return _0x184d11(msgResponse(_0x8ce1('0x94'),_0x8ce1('0x95'),_0x586542+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x8ce1('0x46')](_0x2ea65c)){_0x270150[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x96')];return _0x184d11(msgResponse(_0x8ce1('0x94'),_0x8ce1('0x95'),_0x586542+_0x8ce1('0x97')));}if(_0x5b6d57&&_[_0x8ce1('0x3f')](config[_0x8ce1('0x98')][_0x5b6d57])){_0x270150[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x99')];return _0x184d11(msgResponse(_0x8ce1('0x94'),_0x8ce1('0x95'),_0x586542+'\x20Timezone\x20unknow\x20'+_0x5b6d57));}if(_[_0x8ce1('0x9a')](_0x2ea65c)){for(var _0x1f8c5a=0x0;_0x1f8c5a<_0x2ea65c[_0x8ce1('0x9b')];_0x1f8c5a+=0x1){_0x3dc8f1[_0x8ce1('0x9c')](ami[_0x8ce1('0x9d')]({'action':'command','command':util['format'](_0x8ce1('0x9e'),_0x2ea65c[_0x1f8c5a][_0x8ce1('0x9f')],!_[_0x8ce1('0x3f')](config[_0x8ce1('0x98')][_0x5b6d57])?_0x5b6d57:'')})[_0x8ce1('0x3d')](function(_0x388b27){return _0x388b27[_0x8ce1('0xa0')]['indexOf'](_0x8ce1('0xa1'))>=0x0;})[_0x8ce1('0xa2')](myreject(_0x184d11)));}}else{_0x3dc8f1['push'](ami['Action']({'action':'command','command':util[_0x8ce1('0x80')]('iftime\x20%s,%s',_0x2ea65c,!_[_0x8ce1('0x3f')](config['timezones'][_0x5b6d57])?_0x5b6d57:'')})['then'](function(_0x6e02de){return _0x6e02de[_0x8ce1('0xa0')][_0x8ce1('0xa3')](_0x8ce1('0xa1'))>=0x0;})[_0x8ce1('0xa2')](myreject(_0x184d11)));}Promise['all'](_0x3dc8f1)[_0x8ce1('0x3d')](function(_0x1abd75){var _0xbe9315=_[_0x8ce1('0xa4')](_0x1abd75);if(_0xbe9315){return _0x4ab69b(_0xbe9315);}else{_0x270150[_0x8ce1('0x6a')]=_0x49c383?utils[_0x8ce1('0x6b')][_0x8ce1('0xa5')]:utils[_0x8ce1('0x6b')]['OVERTIME_INTERVAL'];return _0x184d11(msgResponse(_0x8ce1('0xa6'),_0x8ce1('0x95'),'Global:\x20'+_0x49c383+'\x20'+_0x586542+_0x8ce1('0xa7')+util['inspect'](_0x2ea65c,{'showHidden':![],'depth':null})+_0x8ce1('0xa8')+_0x5b6d57));}})[_0x8ce1('0xa2')](function(_0x132e9d){return _0x184d11(msgResponse(_0x8ce1('0x94'),_0x8ce1('0x95'),JSON[_0x8ce1('0x77')](_0x132e9d)));});});};Dialer[_0x8ce1('0x19')][_0x8ce1('0xa9')]=function(){var _0x1e3da2=this;return cmHopper[_0x8ce1('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0x8ce1('0x3d')](function(){setInterval(function(){_0x1e3da2[_0x8ce1('0xab')]();},0x3e8);});};Dialer[_0x8ce1('0x19')][_0x8ce1('0xab')]=function(){var _0x15a0f4=this;var _0x11d49e;for(var _0x3623ea in this[_0x8ce1('0x1e')]){if(typeof this[_0x8ce1('0x1e')][_0x3623ea]!==_0x8ce1('0xac')){_0x11d49e=this[_0x8ce1('0x1e')][_0x3623ea];if(utils['isIVRCampaign'](_0x11d49e)&&utils[_0x8ce1('0x7c')](_0x11d49e)){_0x11d49e[_0x8ce1('0x83')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x11d49e))['then'](checkInterval(_0x11d49e))[_0x8ce1('0x3d')](_0x15a0f4[_0x8ce1('0x8f')](_0x11d49e))['then'](_0x15a0f4['checkIfTime'](_0x11d49e[_0x8ce1('0xad')],_0x11d49e[_0x8ce1('0xae')],_0x11d49e[_0x8ce1('0x44')],_0x11d49e))['then'](_0x15a0f4['checkIfTimeIntervals'](_0x11d49e['Interval'],_0x11d49e[_0x8ce1('0xae')],_0x11d49e[_0x8ce1('0x44')],_0x11d49e))[_0x8ce1('0x3d')](_0x15a0f4['launchHandleIvr'](_0x11d49e))[_0x8ce1('0xa2')](loggerCatchQueueSummary('[syncCampaigns]',_0x11d49e));}else{notSendMessagesCampaign(_0x11d49e);}}}};Dialer['prototype']['checkDialMethod']=function(_0x451bff){if(_0x451bff['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x451bff);}switch(_0x451bff['dialMethod']){case _0x8ce1('0xaf'):this[_0x8ce1('0xb0')](_0x451bff,0x1);break;case _0x8ce1('0xb1'):this['handlePower'](_0x451bff,_0x451bff[_0x8ce1('0xb2')]);break;case _0x8ce1('0xa'):this['predictive'](_0x451bff);break;case _0x8ce1('0x9'):this['handlePower'](_0x451bff,0x1);break;default:logger[_0x8ce1('0x66')](_0x8ce1('0xb3'),_0x451bff[_0x8ce1('0x44')],_0x8ce1('0xb4'));}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x94')]=function(_0x5bbe72,_0x369961){var _0x5a1e63=_0x5bbe72[_0x8ce1('0xae')];var _0x4e334d=_0x369961?_0x5bbe72[_0x8ce1('0xad')]:_0x5bbe72[_0x8ce1('0x78')][_0x8ce1('0x7b')];logger[_0x8ce1('0xb5')]('Dialer::ifTime()',_0x4e334d,_0x5a1e63,_0x5bbe72[_0x8ce1('0x44')],util['format'](_0x8ce1('0xb6'),_0x5bbe72['name'],_0x5bbe72['id']));var _0x10cc41=null;return Interval['intervalIftime'](_0x4e334d,_0x5a1e63)[_0x8ce1('0x3d')](function(_0x2b904c){if(_0x2b904c===!![]){return _0x2b904c;}else{_0x5bbe72[_0x8ce1('0x6a')]=_0x369961?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x8ce1('0x6b')][_0x8ce1('0xb7')];_0x10cc41=msgResponse(_0x8ce1('0xa6'),'Failure',_0x8ce1('0xb8')+_0x369961+'\x20'+_0x5bbe72['name']+_0x8ce1('0xa7')+util[_0x8ce1('0x43')](_0x4e334d,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5a1e63);}if(_0x10cc41!==null){logger[_0x8ce1('0xb5')](_0x8ce1('0xb9'),_0x10cc41);_0x10cc41['isGlobal']=_0x369961;throw _0x10cc41;}})[_0x8ce1('0xa2')](function(_0x18c282){logger[_0x8ce1('0x66')]('AMI\x20IfTime',_0x18c282);throw msgResponse('[ifTime][Action]',_0x8ce1('0x89'),util[_0x8ce1('0x43')](_0x18c282,{'showHidden':![],'depth':null}));});};Dialer[_0x8ce1('0x19')][_0x8ce1('0xba')]=function(_0x1b5ea4){if(this[_0x8ce1('0x1d')][_0x1b5ea4['queue']]){if(this[_0x8ce1('0x25')][_0x1b5ea4[_0x8ce1('0xbb')]]&&this[_0x8ce1('0x25')][_0x1b5ea4['uniqueid']]['type']!==_0x8ce1('0xbc')){this[_0x8ce1('0xbd')](this['voiceQueues'][_0x1b5ea4[_0x8ce1('0xbe')]]);this[_0x8ce1('0x25')][_0x1b5ea4[_0x8ce1('0xbb')]]['answertime']=moment()[_0x8ce1('0x80')](_0x8ce1('0xbf'));}}};Dialer['prototype'][_0x8ce1('0x31')]=function(_0x599972){var _0xf78d22=this[_0x8ce1('0x25')][_0x599972['uniqueid']];if(this[_0x8ce1('0x1d')][_0x599972[_0x8ce1('0xbe')]]){if(_0xf78d22&&_0xf78d22['type']!==_0x8ce1('0xbc')){delete this[_0x8ce1('0x25')][_0x599972[_0x8ce1('0xbb')]];this[_0x8ce1('0x1d')][_0x599972[_0x8ce1('0xbe')]][_0x8ce1('0xc0')]+=0x1;var _0x22506d=new AgentComplete(_0xf78d22,_0x599972);if(_0x599972[_0x8ce1('0xc1')]===_0x8ce1('0xc2')){_0x22506d['agiafterat']=this[_0x8ce1('0x1d')][_0x599972[_0x8ce1('0xbe')]][_0x8ce1('0xc3')]&&this['voiceQueues'][_0x599972[_0x8ce1('0xbe')]][_0x8ce1('0xc4')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x8ce1('0xc5')](_0x22506d)['catch'](loggerCatch(_0x8ce1('0xc6')));hopperUtils[_0x8ce1('0xc7')](_0x22506d)['catch'](loggerCatch(_0x8ce1('0xc8')));}}};Dialer[_0x8ce1('0x19')][_0x8ce1('0xc9')]=function(_0x21ef54){var _0x5e558e=this[_0x8ce1('0x25')][_0x21ef54['uniqueid']];var _0x35551a=this;var _0x1ed42b=![];var _0xe6930;var _0x17b4fc;if(this['voiceQueues'][_0x21ef54[_0x8ce1('0xbe')]]){if(_0x5e558e&&_0x5e558e['type']!==_0x8ce1('0xbc')){delete this[_0x8ce1('0x25')][_0x21ef54[_0x8ce1('0xbb')]];this[_0x8ce1('0xbd')](this[_0x8ce1('0x1d')][_0x21ef54['queue']]);_0x5e558e[_0x8ce1('0xca')]=moment()['format'](_0x8ce1('0xbf'));var _0x58b212=new QueueCallerAbandon(_0x5e558e,_0x21ef54);if(utils[_0x8ce1('0x60')](_0x5e558e[_0x8ce1('0xca')],_0x5e558e[_0x8ce1('0xcb')])>=_0x5e558e[_0x8ce1('0xcc')]){this['voiceQueues'][_0x21ef54['queue']][_0x8ce1('0x4e')]+=0x1;this[_0x8ce1('0x1d')][_0x21ef54[_0x8ce1('0xbe')]][_0x8ce1('0xcd')]+=0x1;this['voiceQueues'][_0x21ef54['queue']][_0x8ce1('0xce')]+=0x1;_0x58b212[_0x8ce1('0x72')]=0xa;_0x58b212[_0x8ce1('0xcf')]=_0x8ce1('0xd0');_0x58b212[_0x8ce1('0xd1')]='TIMEOUT';_0x58b212[_0x8ce1('0xd2')]=this[_0x8ce1('0x1d')][_0x21ef54[_0x8ce1('0xbe')]][_0x8ce1('0xc3')]?moment()[_0x8ce1('0x80')](_0x8ce1('0xbf')):undefined;_0x58b212[_0x8ce1('0xd3')]+=0x1;_0x58b212[_0x8ce1('0xd4')]+=0x1;_0xe6930=this['voiceQueues'][_0x21ef54[_0x8ce1('0xbe')]][_0x8ce1('0xd5')];_0x17b4fc=this['voiceQueues'][_0x21ef54['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x58b212,_0x58b212[_0x8ce1('0x72')],_0x5e558e[_0x8ce1('0xd6')])[_0x8ce1('0x3d')](function(_0x2e6d13){_0x1ed42b=_0x2e6d13[_0x8ce1('0xd7')]==0x1;if(_0x58b212[_0x8ce1('0xd3')]>=_0x35551a[_0x8ce1('0x1d')][_0x21ef54['queue']][_0x8ce1('0xd8')]){_0x35551a['queueCallerAbandonCreateState'](_0x58b212,_0x2e6d13[_0x8ce1('0xd7')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x58b212[_0x8ce1('0xd3')],'scheduledat':moment()[_0x8ce1('0xd9')](_0x35551a[_0x8ce1('0x1d')][_0x21ef54[_0x8ce1('0xbe')]][_0x8ce1('0xd5')],_0x8ce1('0xda'))['format'](_0x8ce1('0xbf')),'ContactId':_0x5e558e[_0x8ce1('0xdb')],'ListId':_0x5e558e[_0x8ce1('0xdc')],'VoiceQueueId':_0x5e558e[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x5e558e['CampaignId']||undefined})['catch'](loggerCatch(_0x8ce1('0xde')));var _0x2cbade=new History(_0x58b212);_0x2cbade[_0x8ce1('0x72')]=0xa;_0x2cbade[_0x8ce1('0xcf')]=_0x8ce1('0xd0');_0x2cbade[_0x8ce1('0x74')]=moment()[_0x8ce1('0x80')](_0x8ce1('0xbf'));_0x2cbade[_0x8ce1('0x73')]=_0x2cbade[_0x8ce1('0x74')];_0x2cbade['calleridname']=_0x58b212[_0x8ce1('0xdf')];_0x2cbade[_0x8ce1('0xe0')]=_0x58b212[_0x8ce1('0xe0')];hopperUtils[_0x8ce1('0xc5')](_0x2cbade)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0xe1')));}})['then'](function(){if(_0x1ed42b)hopperUtils[_0x8ce1('0xe2')](_0x58b212,_0xe6930,_0x17b4fc)[_0x8ce1('0x3d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x21ef54[_0x8ce1('0xbe')]][_0x8ce1('0x50')]+=0x1;this[_0x8ce1('0x1d')][_0x21ef54['queue']][_0x8ce1('0xe3')]+=0x1;_0x58b212[_0x8ce1('0x72')]=0xb;_0x58b212['statedesc']=_0x8ce1('0xe4');_0x58b212[_0x8ce1('0xd1')]=_0x8ce1('0xe5');_0x58b212[_0x8ce1('0xe6')]+=0x1;_0x58b212['countglobal']+=0x1;_0xe6930=this[_0x8ce1('0x1d')][_0x21ef54[_0x8ce1('0xbe')]][_0x8ce1('0xe7')];_0x17b4fc=this['voiceQueues'][_0x21ef54[_0x8ce1('0xbe')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x8ce1('0xe8')](_0x58b212,_0x58b212['state'],_0x5e558e[_0x8ce1('0xd6')])[_0x8ce1('0x3d')](function(_0x1dd67a){if(_0x58b212[_0x8ce1('0xe6')]>=_0x35551a['voiceQueues'][_0x21ef54[_0x8ce1('0xbe')]][_0x8ce1('0xe9')]){_0x35551a['queueCallerAbandonCreateState'](_0x58b212,_0x1dd67a[_0x8ce1('0xd7')]);}else{hopperUtils[_0x8ce1('0xea')]({'active':![],'countabandonedretry':_0x58b212[_0x8ce1('0xe6')],'scheduledat':moment()[_0x8ce1('0xd9')](_0x35551a['voiceQueues'][_0x21ef54['queue']]['dialAbandonedRetryFrequency'],_0x8ce1('0xda'))['format'](_0x8ce1('0xbf')),'ContactId':_0x5e558e[_0x8ce1('0xdb')],'ListId':_0x5e558e['ListId'],'VoiceQueueId':_0x5e558e[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x5e558e[_0x8ce1('0xeb')]||undefined})['catch'](loggerCatch(_0x8ce1('0xec')));var _0x217f69=new History(_0x58b212);_0x217f69[_0x8ce1('0x72')]=0xb;_0x217f69[_0x8ce1('0xcf')]=_0x8ce1('0xe4');_0x217f69[_0x8ce1('0x74')]=moment()[_0x8ce1('0x80')](_0x8ce1('0xbf'));_0x217f69[_0x8ce1('0x73')]=_0x217f69[_0x8ce1('0x74')];_0x217f69[_0x8ce1('0xdf')]=_0x58b212[_0x8ce1('0xdf')];_0x217f69[_0x8ce1('0xe0')]=_0x58b212[_0x8ce1('0xe0')];hopperUtils[_0x8ce1('0xc5')](_0x217f69)['catch'](loggerCatch(_0x8ce1('0xed')));}})[_0x8ce1('0x3d')](function(){if(_0x1ed42b)hopperUtils['swapAdditionalPhones'](_0x58b212,_0xe6930,_0x17b4fc)[_0x8ce1('0x3d')](function(){return 0x1;});});}}}};Dialer[_0x8ce1('0x19')][_0x8ce1('0xee')]=function(_0x685da){if(this[_0x8ce1('0x23')][_0x685da[_0x8ce1('0xbb')]]){this[_0x8ce1('0x23')][_0x685da['uniqueid']][_0x8ce1('0xef')]=_0x685da[_0x8ce1('0xef')];}if(this[_0x8ce1('0x25')][_0x685da[_0x8ce1('0xbb')]]){this[_0x8ce1('0x25')][_0x685da[_0x8ce1('0xbb')]][_0x8ce1('0xef')]=_0x685da[_0x8ce1('0xef')];}};Dialer[_0x8ce1('0x19')][_0x8ce1('0xf0')]=function(_0x39b9c5){if(!this[_0x8ce1('0x23')][_0x39b9c5[_0x8ce1('0xf1')]]){return;}var _0x4df4b7=this[_0x8ce1('0x1d')][this[_0x8ce1('0x23')][_0x39b9c5['actionid']][_0x8ce1('0xbe')]]['strategy']||_0x8ce1('0xf2');if(_0x4df4b7===_0x8ce1('0xf3')){if(this[_0x8ce1('0x23')][_0x39b9c5[_0x8ce1('0xf1')]]&&_[_0x8ce1('0xf4')](this['actions'][_0x39b9c5['actionid']][_0x8ce1('0xf5')])&&_0x39b9c5['status']==='1'&&_0x39b9c5[_0x8ce1('0xf6')]==='0'){if(this[_0x8ce1('0x1f')][_0x39b9c5[_0x8ce1('0xf7')]]){if(!this[_0x8ce1('0x1f')][_0x39b9c5[_0x8ce1('0xf7')]][_0x8ce1('0xf5')]){this[_0x8ce1('0x1f')][_0x39b9c5[_0x8ce1('0xf7')]]['locked']=!![];this[_0x8ce1('0x23')][_0x39b9c5[_0x8ce1('0xf1')]]['locked']=!![];this[_0x8ce1('0x23')][_0x39b9c5[_0x8ce1('0xf1')]][_0x8ce1('0xf7')]=_0x39b9c5['stateinterface'];}}}}else if(_0x4df4b7===_0x8ce1('0xf2')){if(this[_0x8ce1('0x23')][_0x39b9c5[_0x8ce1('0xf1')]]){if(this[_0x8ce1('0x1f')][_0x39b9c5['stateinterface']]){this[_0x8ce1('0x23')][_0x39b9c5[_0x8ce1('0xf1')]][_0x8ce1('0xf7')]=_0x39b9c5[_0x8ce1('0xf7')];if(_['isNil'](this[_0x8ce1('0x29')][this[_0x8ce1('0x23')][_0x39b9c5[_0x8ce1('0xf1')]][_0x8ce1('0xbe')]])){this[_0x8ce1('0x29')][this[_0x8ce1('0x23')][_0x39b9c5['actionid']]['queue']]=[];}this[_0x8ce1('0x29')][this['actions'][_0x39b9c5[_0x8ce1('0xf1')]][_0x8ce1('0xbe')]][_0x8ce1('0x9c')](_['merge'](_['pick'](this[_0x8ce1('0x23')][_0x39b9c5['actionid']],['idHopper',_0x8ce1('0xf7')]),{'status':_0x39b9c5[_0x8ce1('0x8c')],'paused':_0x39b9c5[_0x8ce1('0xf6')]}));}}}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x3a')]=function(_0x102689){if(!this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]]){return;}var _0x8edc98=this;var _0x391260=this[_0x8ce1('0x1d')][this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xbe')]];var _0x4be3b5=_0x391260[_0x8ce1('0xf8')]||_0x8ce1('0xf2');if(_0x4be3b5==='roundrobin'){if(this[_0x8ce1('0x23')][_0x102689['actionid']]&&this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xf7')]){this['preview']['run'](this['actions'][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xf9')],this['actions'][_0x102689[_0x8ce1('0xf1')]]['stateinterface'])['catch'](function(_0x429d50){logger[_0x8ce1('0x66')](_0x8ce1('0xfa'),util[_0x8ce1('0x43')](_0x429d50,{'showHidden':![],'depth':null}));})['finally'](function(){_0x8edc98['updateOriginated'](_0x8edc98['voiceQueues'][_0x8edc98[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xbe')]]);_0x8edc98[_0x8ce1('0x1f')][_0x8edc98['actions'][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xf7')]][_0x8ce1('0xf5')]=![];delete _0x8edc98['actions'][_0x102689[_0x8ce1('0xf1')]];unlockQueueStatus(_0x391260);});}else{this['updateOriginated'](this[_0x8ce1('0x1d')][this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xbe')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]]['ContactId'],'ListId':this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xdc')],'VoiceQueueId':this[_0x8ce1('0x23')][_0x102689['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]]['CampaignId']||undefined})[_0x8ce1('0xa2')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x102689['actionid']];unlockQueueStatus(_0x391260);}}else if(_0x4be3b5===_0x8ce1('0xf2')){var _0x4feca8;if(this['actions'][_0x102689['actionid']]&&!_[_0x8ce1('0x46')](this[_0x8ce1('0x29')][this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xbe')]])){if(this[_0x8ce1('0x2a')][_0x8edc98[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]][_0x8ce1('0xbe')]]){this[_0x8ce1('0x2a')][_0x8edc98[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]]['queue']]=this[_0x8ce1('0x2a')][this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]]['queue']]?this['queueBookedRR'][this[_0x8ce1('0x23')][_0x102689['actionid']][_0x8ce1('0xbe')]]:this[_0x8ce1('0x29')][this['actions'][_0x102689['actionid']][_0x8ce1('0xbe')]]?this['queueBooked'][this['actions'][_0x102689['actionid']]['queue']][_0x8ce1('0xfb')]||0x0:0x0;}this[_0x8ce1('0x29')][this[_0x8ce1('0x23')][_0x102689[_0x8ce1('0xf1')]]['queue']][_0x8ce1('0xfb')]=this[_0x8ce1('0x2a')][this['actions'][_0x102689['actionid']]['queue']];for(var _0x2ff949=0x0;_0x2ff949=_0x4b0913['dialGlobalMaxRetry']){_0x1c8661[_0x8ce1('0x122')](_0x53efa8,_0x51d962,_0xbaf399,'reason19\x20machine....');}else{if(_0x53efa8[_0x8ce1('0x11d')]>=_0x4b0913[_0x8ce1('0x123')]){_0x1c8661[_0x8ce1('0x124')](_0x53efa8,_0x51d962,_0xbaf399,'reason\x2019\x20machine....');}else{hopperUtils[_0x8ce1('0xea')]({'active':![],'countmachineretry':_0x53efa8[_0x8ce1('0x11d')],'scheduledat':moment()['add'](_0x4b0913['dialMachineRetryFrequency'],_0x8ce1('0xda'))[_0x8ce1('0x80')](_0x8ce1('0xbf')),'ContactId':_0x53efa8[_0x8ce1('0xdb')],'ListId':_0x53efa8[_0x8ce1('0xdc')],'VoiceQueueId':_0x53efa8[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x53efa8['CampaignId']||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x125')));_0x51d962({'reschedule':0x1});}}});}if(_0x1eae40[_0x8ce1('0x41')]==='ivr'&&this[_0x8ce1('0x1e')][_0x1eae40[_0x8ce1('0xbe')]]['dialAMDActive']&&_0x3a55ad[_0x8ce1('0x10f')]===_0x8ce1('0x110')){delete this['uniqueId'][_0x3a55ad['uniqueid']];this['updateOriginated'](this['campaigns'][_0x1eae40[_0x8ce1('0xbe')]]);_0x1d895a=new Hangup(_0x1eae40,_0x3a55ad);_0x1d895a['state']=0x12;_0x1d895a[_0x8ce1('0xcf')]=_0x8ce1('0x112');_0x1d895a[_0x8ce1('0x113')]=_0x8ce1('0x114');ami[_0x8ce1('0x40')](_0x8ce1('0x115'),ut[_0x8ce1('0x116')](_0x1d895a,_0x8ce1('0x117')));this['saveInDb'](_0x1d895a,_0x8ce1('0x126'),'[syncHangupInAMDIvr]');}if(_0x1eae40['type']===_0x8ce1('0xbc')&&this[_0x8ce1('0x1e')][_0x1eae40['queue']][_0x8ce1('0x10e')]&&_0x3a55ad[_0x8ce1('0x10f')]===_0x8ce1('0x11b')){return new Promise(function(_0x5ef068,_0x49cc00){delete _0x1c8661[_0x8ce1('0x25')][_0x3a55ad[_0x8ce1('0xbb')]];_0x1c8661[_0x8ce1('0xbd')](_0x1c8661[_0x8ce1('0x1e')][_0x1eae40[_0x8ce1('0xbe')]]);_0x1c8661['campaigns'][_0x1eae40[_0x8ce1('0xbe')]][_0x8ce1('0xc0')]+=0x1;_0x1c8661['campaigns'][_0x1eae40['queue']][_0x8ce1('0x111')]+=0x1;var _0x36999d=_0x1c8661['campaigns'][_0x1eae40[_0x8ce1('0xbe')]];var _0x3b9395=new Hangup(_0x1eae40,_0x3a55ad);_0x3b9395['state']=0x13;_0x3b9395[_0x8ce1('0xcf')]=_0x8ce1('0x11c');_0x3b9395[_0x8ce1('0x113')]=_0x8ce1('0x114');_0x3b9395[_0x8ce1('0x11d')]+=0x1;_0x3b9395[_0x8ce1('0xd4')]+=0x1;_0x3b9395[_0x8ce1('0x117')]=!![];ami['emit'](_0x8ce1('0x115'),ut[_0x8ce1('0x116')](_0x3b9395,_0x8ce1('0x117')));hopperUtils[_0x8ce1('0xc5')](_0x3b9395)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x11e')));if(_0x3b9395[_0x8ce1('0x11f')]+_0x3b9395[_0x8ce1('0x127')]+_0x3b9395[_0x8ce1('0x128')]+_0x3b9395['countnosuchnumberretry']+_0x3b9395[_0x8ce1('0xd3')]+_0x3b9395[_0x8ce1('0xe6')]+_0x3b9395[_0x8ce1('0x11d')]+_0x3b9395[_0x8ce1('0x121')]>=_0x36999d[_0x8ce1('0x129')]){_0x1c8661[_0x8ce1('0x122')](_0x3b9395,_0x5ef068,_0x49cc00,_0x8ce1('0x12a'));}else{if(_0x3b9395[_0x8ce1('0x11d')]>=_0x36999d[_0x8ce1('0x123')]){_0x1c8661['createStateFinal'](_0x3b9395,_0x5ef068,_0x49cc00,'reason\x2019\x20machine....');}else{hopperUtils[_0x8ce1('0xea')]({'active':![],'countmachineretry':_0x3b9395[_0x8ce1('0x11d')],'scheduledat':moment()['add'](_0x36999d[_0x8ce1('0x12b')],'minutes')[_0x8ce1('0x80')](_0x8ce1('0xbf')),'ContactId':_0x3b9395[_0x8ce1('0xdb')],'ListId':_0x3b9395[_0x8ce1('0xdc')],'VoiceQueueId':_0x3b9395[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x3b9395[_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x125')));_0x5ef068({'reschedule':0x1});}}});}}};Dialer[_0x8ce1('0x19')]['syncHangup']=function(_0x33e517){var _0x5073e9=this[_0x8ce1('0x25')][_0x33e517[_0x8ce1('0xbb')]];var _0x565ef5;if(_0x5073e9&&_0x5073e9[_0x8ce1('0x41')]===_0x8ce1('0xbc')){delete this[_0x8ce1('0x25')][_0x33e517['uniqueid']];this[_0x8ce1('0xbd')](this[_0x8ce1('0x1e')][_0x5073e9[_0x8ce1('0xbe')]]);this['campaigns'][_0x5073e9[_0x8ce1('0xbe')]][_0x8ce1('0x12c')]+=0x1;_0x565ef5=new Hangup(_0x5073e9,_0x33e517);hopperUtils[_0x8ce1('0xc5')](_0x565ef5)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x8ce1('0xc7')](_0x565ef5)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x12d')));}if(_0x5073e9&&_0x5073e9[_0x8ce1('0x41')]!==_0x8ce1('0xbc')&&isNotNull(this['voiceQueues'][_0x5073e9[_0x8ce1('0xbe')]][_0x8ce1('0x12e')])){delete this[_0x8ce1('0x25')][_0x33e517['uniqueid']];this[_0x8ce1('0xbd')](this[_0x8ce1('0x1d')][_0x5073e9[_0x8ce1('0xbe')]]);this[_0x8ce1('0x1d')][_0x5073e9[_0x8ce1('0xbe')]][_0x8ce1('0xc0')]+=0x1;this[_0x8ce1('0x1d')][_0x5073e9[_0x8ce1('0xbe')]][_0x8ce1('0x111')]+=0x1;_0x565ef5=new Hangup(_0x5073e9,_0x33e517);_0x565ef5['state']=0x10;_0x565ef5[_0x8ce1('0xcf')]=_0x8ce1('0x12f');_0x565ef5['membername']=_0x8ce1('0x130');hopperUtils[_0x8ce1('0xc5')](_0x565ef5)['catch'](loggerCatch(_0x8ce1('0x131')));hopperUtils[_0x8ce1('0xc7')](_0x565ef5)['catch'](loggerCatch(_0x8ce1('0x12d')));}if(_0x5073e9&&_0x5073e9[_0x8ce1('0x41')]!==_0x8ce1('0xbc')&&!isNotNull(this[_0x8ce1('0x1d')][_0x5073e9[_0x8ce1('0xbe')]]['dialQueueProject'])){delete this[_0x8ce1('0x25')][_0x33e517['uniqueid']];this['updateOriginated'](this[_0x8ce1('0x1d')][_0x5073e9[_0x8ce1('0xbe')]]);this[_0x8ce1('0x1d')][_0x5073e9[_0x8ce1('0xbe')]][_0x8ce1('0x132')]+=0x1;_0x565ef5=new Hangup(_0x5073e9,_0x33e517);_0x565ef5[_0x8ce1('0x72')]=0xc;_0x565ef5['statedesc']=_0x33e517[_0x8ce1('0x133')];_0x565ef5[_0x8ce1('0x113')]=_0x8ce1('0x134');hopperUtils[_0x8ce1('0xc5')](_0x565ef5)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x131')));hopperUtils[_0x8ce1('0xc7')](_0x565ef5)[_0x8ce1('0xa2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x8ce1('0x19')][_0x8ce1('0xc')]=function(_0x471cd0){var _0x5d56f7=this;if(!_0x5d56f7[_0x8ce1('0x2b')][_0x471cd0['name']]){_0x5d56f7['queuesSummary'][_0x471cd0[_0x8ce1('0x44')]]={'running':![]};}else if(_0x5d56f7[_0x8ce1('0x2b')][_0x471cd0['name']][_0x8ce1('0x135')]===!![]){return;}else if(_0x5d56f7['queuesSummary'][_0x471cd0['name']][_0x8ce1('0x135')]===![]){_0x5d56f7[_0x8ce1('0x2b')][_0x471cd0[_0x8ce1('0x44')]][_0x8ce1('0x135')]=!![];}var _0x28fb8c=_0x5d56f7[_0x8ce1('0x1d')][_0x471cd0[_0x8ce1('0x44')]];var _0x3cd614=_0x28fb8c[_0x8ce1('0x6a')]!==utils[_0x8ce1('0x6b')]['INACTIVE'];var _0x140da1=utils['isPreviewCampaign'](_0x28fb8c);_0x28fb8c[_0x8ce1('0x136')]=utils['getQueueCampaignStatusMessage'](_0x28fb8c,_0x5d56f7[_0x8ce1('0x20')]);Promise[_0x8ce1('0x137')]()[_0x8ce1('0x3d')](function(){if(_0x28fb8c[_0x8ce1('0x136')]===utils[_0x8ce1('0x6b')]['INACTIVE']){if(_0x3cd614){clearPredictiveAttributes(_0x28fb8c);_0x471cd0[_0x8ce1('0x62')]=undefined;_0x471cd0[_0x8ce1('0x27')]=undefined;}if(_0x28fb8c[_0x8ce1('0x136')]===utils[_0x8ce1('0x6b')]['INACTIVE']){_0x471cd0[_0x8ce1('0x138')]=0x0;_0x471cd0[_0x8ce1('0xf6')]=0x0;_0x471cd0[_0x8ce1('0x139')]=0x0;_0x471cd0[_0x8ce1('0x13a')]=0x0;_0x471cd0[_0x8ce1('0x13b')]=0x0;}}else if(_0x28fb8c[_0x8ce1('0x136')]===utils[_0x8ce1('0x6b')][_0x8ce1('0x13c')]&&!_0x140da1){return _0x5d56f7[_0x8ce1('0x94')](_0x28fb8c,!![])[_0x8ce1('0x3d')](function(){return _0x5d56f7['ifTime'](_0x28fb8c,![]);})['then'](function(){return _0x5d56f7[_0x8ce1('0x13d')](_0x28fb8c);})[_0x8ce1('0xa2')](function(_0x152b4e){loggerSyncQueueSummary[_0x8ce1('0x42')]('[syncQueueSummary]',util[_0x8ce1('0x43')](_0x152b4e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x28fb8c);});}else{clearPredictiveAttributes(_0x28fb8c);}})[_0x8ce1('0x3d')](function(){var _0x5e532e=_0x471cd0[_0x8ce1('0x13e')](_0x28fb8c);if(_0x5e532e||_0x28fb8c[_0x8ce1('0x13f')]){_0x28fb8c[_0x8ce1('0x13f')]=![];_0x471cd0['updateReportFromOutboundQueue'](_0x28fb8c);Object['assign'](_0x28fb8c,_0x471cd0);emitOutboundVoiceQueueSummary(_0x471cd0);}_0x5d56f7[_0x8ce1('0x2b')][_0x28fb8c[_0x8ce1('0x44')]][_0x8ce1('0x135')]=![];})[_0x8ce1('0xa2')](function(_0x4ded33){logger[_0x8ce1('0x66')](_0x8ce1('0x140'),util[_0x8ce1('0x43')](_0x4ded33,{'showHidden':![],'depth':null}));_0x5d56f7['queuesSummary'][_0x28fb8c[_0x8ce1('0x44')]]['running']=![];});};Dialer[_0x8ce1('0x19')][_0x8ce1('0x34')]=_['throttle'](function(){var _0x556e84=_[_0x8ce1('0x141')](this[_0x8ce1('0x1d')],function(_0x435ebb){return _0x435ebb['dialPreviewRecallmeReminder'];});var _0x18233a=_[_0x8ce1('0x141')](this[_0x8ce1('0x1f')],function(_0x6990cf){return _0x6990cf[_0x8ce1('0x142')]&&_0x6990cf['status']===_0x8ce1('0x8d');});if(_0x556e84['length']>0x0&&_0x18233a['length']>0x0){return Promise[_0x8ce1('0x137')]()[_0x8ce1('0x3d')](cmHopper['handlePreviewRecallNotifications'](_[_0x8ce1('0x143')](_0x556e84,'id'),previewRecallmeReminderInterval,_[_0x8ce1('0x143')](_0x18233a,'id')))['then'](function(_0x4f7693){for(var _0x93652d=0x0;_0x93652d<_0x4f7693[_0x8ce1('0x9b')];_0x93652d++){var _0x5a7756=_0x4f7693[_0x93652d]['Agent'][_0x8ce1('0x44')];if(_0x5a7756)io['to'](util[_0x8ce1('0x80')]('user:%s',_0x5a7756))['emit'](_0x8ce1('0x144'),{'hopper':_0x4f7693[_0x93652d]});}})[_0x8ce1('0xa2')](function(_0x1201a9){logger[_0x8ce1('0x66')]('checkPreviewRecallReminder',_0x1201a9);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8ce1('0x19')][_0x8ce1('0x3b')]=function(){var _0xac913=this;setInterval(function(){_0xac913[_0x8ce1('0x145')](_0xac913[_0x8ce1('0x25')],_0x8ce1('0x146'));_0xac913[_0x8ce1('0x145')](_0xac913['actions'],'[actions]');},0x32c8);};Dialer[_0x8ce1('0x19')][_0x8ce1('0x145')]=function(_0x5f26ab,_0x5a7d0e){var _0x39f4a0=this;for(var _0x35ae9f in _0x5f26ab){if(typeof _0x5f26ab[_0x35ae9f]!==_0x8ce1('0xac')){this[_0x8ce1('0x1c')][_0x8ce1('0x1a')](function(){if(!_[_0x8ce1('0xf4')](_0x5f26ab[_0x35ae9f])){return ami[_0x8ce1('0x9d')]({'action':_0x8ce1('0x8c'),'channel':_0x5f26ab[_0x35ae9f][_0x8ce1('0xef')]})[_0x8ce1('0xa2')](function(_0x3f2b71){if(_0x3f2b71[_0x8ce1('0x6a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5f26ab[_0x35ae9f]&&_0x5f26ab[_0x35ae9f]['type']!==_0x8ce1('0xbc')){_0x39f4a0[_0x8ce1('0xbd')](_0x39f4a0[_0x8ce1('0x1d')][_0x5f26ab[_0x35ae9f][_0x8ce1('0xbe')]]);logger[_0x8ce1('0x66')](_0x8ce1('0x147'),_0x5a7d0e,_0x35ae9f,_0x5f26ab[_0x35ae9f][_0x8ce1('0xbe')]);delete _0x5f26ab[_0x35ae9f];}if(_0x5f26ab[_0x35ae9f]&&_0x5f26ab[_0x35ae9f][_0x8ce1('0x41')]===_0x8ce1('0xbc')){_0x39f4a0['updateOriginated'](_0x39f4a0[_0x8ce1('0x1e')][_0x5f26ab[_0x35ae9f][_0x8ce1('0xbe')]]);logger[_0x8ce1('0x66')](_0x8ce1('0x148'),_0x5a7d0e,_0x35ae9f,_0x5f26ab[_0x35ae9f][_0x8ce1('0xbe')]);delete _0x5f26ab[_0x35ae9f];}},0x2328);}});}});}}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x149')]=function(_0x2470b4){return Promise[_0x8ce1('0x137')]()[_0x8ce1('0x3d')](voiceQueueRt[_0x8ce1('0x149')](_0x2470b4))[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x14a')));};Dialer['prototype'][_0x8ce1('0xbd')]=function(_0x495e38){if(!_[_0x8ce1('0x3f')](_0x495e38)&&_0x495e38!==null){if(typeof _0x495e38[_0x8ce1('0x84')]!==_0x8ce1('0xac')){if(_0x495e38['originated']>0x0){_0x495e38[_0x8ce1('0x84')]-=0x1;}else{logger[_0x8ce1('0x66')](_0x8ce1('0x14b'));}}}else{logger[_0x8ce1('0x66')](_0x8ce1('0x14c'));}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x14d')]=function(_0x4d1dc1,_0xd2e817){var _0xd349ae=this;return function(_0x3f0535){_0xd349ae['updateOriginated'](_0xd2e817);logger[_0x8ce1('0x66')](_0x4d1dc1,util[_0x8ce1('0x43')](_0x3f0535,{'showHidden':![],'depth':null}));};};Dialer[_0x8ce1('0x19')][_0x8ce1('0x14e')]=function(_0x3a0103,_0x201863,_0x2149b5){var _0x3ba3d1={'state':0x19,'statedesc':_0x8ce1('0x14f')};this[_0x8ce1('0xbd')](_0x201863);this[_0x8ce1('0x118')](_[_0x8ce1('0x5f')](_0x3ba3d1,_[_0x8ce1('0x100')](_0x2149b5,[_0x8ce1('0xdb'),_0x8ce1('0xdc'),'UserId',_0x8ce1('0xdd'),_0x8ce1('0xeb')])),_0x8ce1('0x150'),_0x8ce1('0x151'));logger[_0x8ce1('0x66')](_0x3a0103);};Dialer[_0x8ce1('0x19')]['saveInDb']=function(_0x573df0,_0xc4c236,_0x493ae6){hopperUtils[_0x8ce1('0xc5')](_0x573df0)[_0x8ce1('0xa2')](loggerCatch(_0xc4c236));hopperUtils[_0x8ce1('0xc7')](_0x573df0)[_0x8ce1('0xa2')](loggerCatch(_0x493ae6));};Dialer[_0x8ce1('0x19')][_0x8ce1('0x152')]=function(_0x4140c3,_0x8b75cd){hopperUtils[_0x8ce1('0xc5')](_0x4140c3)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x8b75cd==0x0){hopperUtils[_0x8ce1('0xc7')](_0x4140c3)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x153')));}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x154')]=function(_0x16c2fb){return Promise[_0x8ce1('0x137')]()[_0x8ce1('0x3d')](cmHopper[_0x8ce1('0x155')](_0x16c2fb['id'],previewRecallmeReminderInterval))['then'](function(_0x3e1427){for(var _0x5a9918=0x0;_0x5a9918<_0x3e1427[_0x8ce1('0x9b')];_0x5a9918++){var _0x398213=_0x3e1427[_0x5a9918]['Agent'][_0x8ce1('0x44')];if(_0x398213)io['to'](util[_0x8ce1('0x80')](_0x8ce1('0x156'),_0x398213))[_0x8ce1('0x40')](_0x8ce1('0x144'),{'hopper':_0x3e1427[_0x5a9918]});}})[_0x8ce1('0xa2')](function(){});};Dialer[_0x8ce1('0x19')][_0x8ce1('0x157')]=function(_0x5c5bf7){var _0x5d8c9a=this;return function(){_0x5d8c9a[_0x8ce1('0x158')](_0x5c5bf7);};};Dialer['prototype'][_0x8ce1('0x159')]=function(_0x46aa64,_0x2abd5b){var _0x11e412=this;var _0x102601=uuid['v4']();this[_0x8ce1('0x23')][_0x102601]=new Action(_0x46aa64,_0x2abd5b,_0x102601);return new Promise(function(_0x536c5f,_0xdfb34){if(_[_0x8ce1('0x3f')](_0x46aa64)&&typeof _0x46aa64!==_0x8ce1('0x15a')){return _0xdfb34(msgResponse(_0x8ce1('0x15b'),'Failure',_0x8ce1('0x15c')));}if(_[_0x8ce1('0x3f')](_0x2abd5b[_0x8ce1('0x15d')])||_0x2abd5b[_0x8ce1('0x15d')]===null){return _0xdfb34(msgResponse(_0x8ce1('0x15b'),_0x8ce1('0x95'),'contact\x20is\x20undefine'));}var _0x51bf00={'XMD-CALLERID':_0x11e412[_0x8ce1('0x23')][_0x102601]['getCaller'](),'XMD-AGI':_0x46aa64[_0x8ce1('0x12e')]?util[_0x8ce1('0x80')]('\x22agi://%s/square,%s\x22',ipAgi,_0x46aa64[_0x8ce1('0x12e')]):_0x8ce1('0x15e'),'XMD-AGIAFTER':_0x46aa64[_0x8ce1('0xc3')]?util[_0x8ce1('0x80')](_0x8ce1('0x15f'),ipAgi,_0x46aa64[_0x8ce1('0xc3')]):_0x8ce1('0x15e'),'XMD-QUEUE':utils[_0x8ce1('0x160')](_0x46aa64)?util[_0x8ce1('0x80')](_0x8ce1('0x161'),_0x46aa64['name'],_0x46aa64['dialQueueOptions']||'',_0x46aa64[_0x8ce1('0xc4')]?'c':'',_0x46aa64['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x2abd5b[_0x8ce1('0xdb')],'XMD-CDRTYPE':_0x8ce1('0x8'),'CALLERID(all)':_0x11e412[_0x8ce1('0x23')][_0x102601]['getCaller'](),'XMD-AMD':_0x46aa64[_0x8ce1('0x10e')]?'ACTIVE':_0x8ce1('0x15e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x46aa64['dialAMDActive']){_0x51bf00[_0x8ce1('0x162')]=_0x46aa64[_0x8ce1('0x163')]||0x9c4;_0x51bf00[_0x8ce1('0x164')]=_0x46aa64['dialAMDGreeting']||0x5dc;_0x51bf00[_0x8ce1('0x165')]=_0x46aa64[_0x8ce1('0x166')]||0x320;_0x51bf00[_0x8ce1('0x167')]=_0x46aa64[_0x8ce1('0x168')]||0x1388;_0x51bf00[_0x8ce1('0x169')]=_0x46aa64[_0x8ce1('0x16a')]||0x64;_0x51bf00['XMD-AMDBETWEENWORDSSILENCE']=_0x46aa64[_0x8ce1('0x16b')]||0x32;_0x51bf00['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x46aa64['dialAMDMaximumNumberOfWords']||0x3;_0x51bf00[_0x8ce1('0x16c')]=_0x46aa64[_0x8ce1('0x16d')]||0x100;_0x51bf00[_0x8ce1('0x16e')]=_0x46aa64[_0x8ce1('0x16f')]||0x1388;}if(utils['isOutboundQueue'](_0x46aa64)){_0x51bf00[_0x8ce1('0x170')]=_0x2abd5b[_0x8ce1('0xdd')];}else{_0x51bf00['XMD-CAMPAIGNID']=_0x2abd5b[_0x8ce1('0xeb')];}var _0x424656=utils[_0x8ce1('0x171')](_0x2abd5b[_0x8ce1('0x172')]);Object['assign'](_0x51bf00,_0x424656);var _0x568a4e=_0x11e412[_0x8ce1('0x90')](_0x46aa64['Trunk'])?utils[_0x8ce1('0x173')](_0x46aa64[_0x8ce1('0x91')]['callerid'],_0x46aa64['dialOriginateCallerIdName'],_0x46aa64[_0x8ce1('0x174')]>0x0?utils[_0x8ce1('0x175')](_0x46aa64[_0x8ce1('0x176')],_0x46aa64['dialRandomLastDigitCallerIdNumber']):_0x46aa64[_0x8ce1('0x176')]):utils[_0x8ce1('0x173')](_[_0x8ce1('0xf4')](_0x46aa64[_0x8ce1('0x92')])?_0x46aa64[_0x8ce1('0x91')]['callerid']:_0x46aa64[_0x8ce1('0x92')][_0x8ce1('0x177')],_0x46aa64[_0x8ce1('0x178')],_0x46aa64['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x8ce1('0x175')](_0x46aa64[_0x8ce1('0x176')],_0x46aa64[_0x8ce1('0x174')]):_0x46aa64[_0x8ce1('0x176')]);if(_0x568a4e){_0x51bf00[_0x8ce1('0x179')]=_0x11e412[_0x8ce1('0x23')][_0x102601]['originatecalleridname']=utils[_0x8ce1('0x17a')](_0x568a4e);_0x51bf00[_0x8ce1('0x17b')]=_0x2abd5b[_0x8ce1('0x15d')];}_0x46aa64[_0x8ce1('0x17c')]=_0x51bf00;return ami[_0x8ce1('0x9d')]({'actionid':_0x102601,'action':_0x8ce1('0x15b'),'channel':_0x11e412[_0x8ce1('0x90')](_0x46aa64[_0x8ce1('0x91')])?util[_0x8ce1('0x80')](_0x8ce1('0x17d'),_0x46aa64[_0x8ce1('0x91')][_0x8ce1('0x44')],isNotNull(_0x46aa64[_0x8ce1('0x17e')])?_0x46aa64[_0x8ce1('0x17e')][_0x8ce1('0x17f')]()||'':'',_0x46aa64['dialCutDigit']>0x0?_0x2abd5b[_0x8ce1('0x15d')]['substring'](_0x46aa64[_0x8ce1('0x180')]):_0x2abd5b[_0x8ce1('0x15d')]):util[_0x8ce1('0x80')]('SIP/%s/%s%s',_[_0x8ce1('0xf4')](_0x46aa64[_0x8ce1('0x92')])?_0x46aa64[_0x8ce1('0x91')][_0x8ce1('0x44')]:_0x46aa64[_0x8ce1('0x92')][_0x8ce1('0x44')],isNotNull(_0x46aa64['dialPrefix'])?_0x46aa64['dialPrefix'][_0x8ce1('0x17f')]()||'':'',_0x46aa64[_0x8ce1('0x180')]>0x0?_0x2abd5b[_0x8ce1('0x15d')][_0x8ce1('0x181')](_0x46aa64[_0x8ce1('0x180')]):_0x2abd5b[_0x8ce1('0x15d')]),'callerid':_0x568a4e,'Exten':'xcally-motion-dialer','Context':_0x8ce1('0x182'),'Priority':'1','variable':_0x51bf00,'timeout':(_0x46aa64[_0x8ce1('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x102601})[_0x8ce1('0x3d')](function(_0x367cf0){return _0x536c5f(_0x367cf0);})[_0x8ce1('0xa2')](function(_0xd87ae0){_0x46aa64[_0x8ce1('0x184')]+=0x1;var _0x5b7469=new History(_0x11e412[_0x8ce1('0x23')][_0x102601]);logger['error'](util[_0x8ce1('0x80')](_0x8ce1('0x185'),JSON['stringify'](_0xd87ae0)));_0x5b7469[_0x8ce1('0x72')]=0xe;_0x5b7469[_0x8ce1('0xcf')]=_0x8ce1('0x186');_0x5b7469[_0x8ce1('0x74')]=moment()[_0x8ce1('0x80')](_0x8ce1('0xbf'));_0x5b7469[_0x8ce1('0x73')]=_0x5b7469[_0x8ce1('0x74')];hopperUtils[_0x8ce1('0xc5')](_0x5b7469)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x187')));_0x11e412[_0x8ce1('0xc7')](_0x5b7469)[_0x8ce1('0xa2')](loggerCatch('[originate][error]'))[_0x8ce1('0xff')](function(){delete _0x11e412[_0x8ce1('0x23')][_0x102601];return _0xdfb34(msgResponse(_0x8ce1('0x15b'),_0x8ce1('0x89'),_0x8ce1('0x188')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x31ae2,_0x334992,_0x3759e2){var _0x32d7a0=new History(_0x334992);if(_0x32d7a0['countbusyretry']+_0x32d7a0[_0x8ce1('0x127')]+_0x32d7a0[_0x8ce1('0x128')]+_0x32d7a0[_0x8ce1('0x120')]+_0x32d7a0[_0x8ce1('0xd3')]+_0x32d7a0['countabandonedretry']+_0x32d7a0[_0x8ce1('0x11d')]+_0x32d7a0['countagentrejectretry']>=_0x3759e2[_0x8ce1('0x129')]-0x1){return!![];}switch(_0x31ae2){case 0x3:if(_0x32d7a0[_0x8ce1('0x128')]>=_0x3759e2['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x8ce1('0xea')]({'active':![],'countnoanswerretry':_0x32d7a0[_0x8ce1('0x128')]+=0x1,'scheduledat':moment()['add'](_0x3759e2['dialNoAnswerRetryFrequency'],_0x8ce1('0xda'))[_0x8ce1('0x80')](_0x8ce1('0xbf')),'ContactId':_0x32d7a0[_0x8ce1('0xdb')],'ListId':_0x32d7a0[_0x8ce1('0xdc')],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x189')));break;case 0x5:if(_0x32d7a0[_0x8ce1('0x11f')]>=_0x3759e2['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x8ce1('0xea')]({'active':![],'countbusyretry':_0x32d7a0[_0x8ce1('0x11f')]+=0x1,'scheduledat':moment()[_0x8ce1('0xd9')](_0x3759e2['dialBusyRetryFrequency'],_0x8ce1('0xda'))['format'](_0x8ce1('0xbf')),'ContactId':_0x32d7a0[_0x8ce1('0xdb')],'ListId':_0x32d7a0['ListId'],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x18a')));break;case 0x8:if(_0x32d7a0[_0x8ce1('0x127')]>=_0x3759e2[_0x8ce1('0x18b')]-0x1){return!![];}hopperUtils[_0x8ce1('0xea')]({'active':![],'countcongestionretry':_0x32d7a0[_0x8ce1('0x127')]+=0x1,'scheduledat':moment()['add'](_0x3759e2[_0x8ce1('0x18c')],'minutes')[_0x8ce1('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32d7a0[_0x8ce1('0xdb')],'ListId':_0x32d7a0[_0x8ce1('0xdc')],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})['catch'](loggerCatch(_0x8ce1('0x18d')));break;case 0x0:if(_0x32d7a0[_0x8ce1('0x120')]>=_0x3759e2[_0x8ce1('0x18e')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x32d7a0['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x8ce1('0xd9')](_0x3759e2['dialNoSuchNumberRetryFrequency'],_0x8ce1('0xda'))[_0x8ce1('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32d7a0[_0x8ce1('0xdb')],'ListId':_0x32d7a0[_0x8ce1('0xdc')],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})['catch'](loggerCatch(_0x8ce1('0x18f')));}break;case 0xa:if(_0x32d7a0['countdropretry']>=_0x3759e2['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x8ce1('0xea')]({'active':![],'countdropretry':_0x32d7a0[_0x8ce1('0xd3')]+=0x1,'scheduledat':moment()['add'](_0x3759e2['dialDropRetryFrequency'],_0x8ce1('0xda'))[_0x8ce1('0x80')](_0x8ce1('0xbf')),'ContactId':_0x32d7a0[_0x8ce1('0xdb')],'ListId':_0x32d7a0[_0x8ce1('0xdc')],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})['catch'](loggerCatch(_0x8ce1('0xde')));break;case 0xb:if(_0x32d7a0['countabandonedretry']>=_0x3759e2[_0x8ce1('0xe9')]-0x1){return!![];}hopperUtils[_0x8ce1('0xea')]({'active':![],'countabandonedretry':_0x32d7a0[_0x8ce1('0xe6')]+=0x1,'scheduledat':moment()[_0x8ce1('0xd9')](_0x3759e2[_0x8ce1('0xe7')],_0x8ce1('0xda'))[_0x8ce1('0x80')](_0x8ce1('0xbf')),'ContactId':_0x32d7a0[_0x8ce1('0xdb')],'ListId':_0x32d7a0['ListId'],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0xec')));break;case 0x13:if(_0x32d7a0['countmachineretry']>=_0x3759e2[_0x8ce1('0x123')]-0x1){return!![];}hopperUtils[_0x8ce1('0xea')]({'active':![],'countmachineretry':_0x32d7a0[_0x8ce1('0x11d')]+=0x1,'scheduledat':moment()[_0x8ce1('0xd9')](_0x3759e2[_0x8ce1('0x12b')],_0x8ce1('0xda'))[_0x8ce1('0x80')](_0x8ce1('0xbf')),'ContactId':_0x32d7a0['ContactId'],'ListId':_0x32d7a0[_0x8ce1('0xdc')],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x125')));break;case 0x14:if(_0x32d7a0[_0x8ce1('0x121')]>=_0x3759e2['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x8ce1('0xea')]({'active':![],'countagentrejectretry':_0x32d7a0[_0x8ce1('0x121')]+=0x1,'scheduledat':moment()[_0x8ce1('0xd9')](_0x3759e2[_0x8ce1('0x190')],_0x8ce1('0xda'))[_0x8ce1('0x80')](_0x8ce1('0xbf')),'ContactId':_0x32d7a0[_0x8ce1('0xdb')],'ListId':_0x32d7a0['ListId'],'VoiceQueueId':_0x32d7a0[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x32d7a0[_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x109')]=function(_0x55565b,_0x52de16,_0x359485){var _0x42c3bc=this;var _0x3cb3cc=new History(_0x55565b);var _0x6f278=![];var _0x5b14c9;var _0x2c346a;return new Promise(function(_0x18ceb3,_0x1cda99){if(_[_0x8ce1('0x3f')](_0x52de16)&&typeof _0x52de16!==_0x8ce1('0x15a')){return _0x1cda99(msgResponse(_0x8ce1('0x191'),_0x8ce1('0x95'),_0x8ce1('0x192')));}if(_[_0x8ce1('0x3f')](_0x359485)&&typeof _0x359485!=='object'){return _0x1cda99(msgResponse(_0x8ce1('0x191'),_0x8ce1('0x95'),_0x8ce1('0x193')));}hopperUtils['verifyAdditionalPhones'](_0x3cb3cc,_0x359485['reason'],_0x52de16)['then'](function(_0x504e93){if(_0x504e93[_0x8ce1('0xd7')]==0x1)_0x6f278=!![];switch(_0x359485[_0x8ce1('0xc1')]){case'0':_0x52de16[_0x8ce1('0x194')]+=0x1;_0x3cb3cc[_0x8ce1('0x72')]=0x0;_0x3cb3cc[_0x8ce1('0xcf')]=_0x8ce1('0x195');_0x3cb3cc[_0x8ce1('0x120')]+=0x1;_0x3cb3cc[_0x8ce1('0xd4')]+=0x1;ami[_0x8ce1('0x40')](_0x8ce1('0x196'),ut[_0x8ce1('0x116')](_0x55565b,_0x8ce1('0x197')));_0x5b14c9=_0x52de16[_0x8ce1('0x198')];_0x2c346a=_0x52de16['callAdditionalPhoneAfterMin'];hopperUtils[_0x8ce1('0xc5')](_0x3cb3cc)[_0x8ce1('0xa2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x42c3bc[_0x8ce1('0x199')](0x0,_0x55565b,_0x52de16)&&!_0x6f278){if(_0x3cb3cc['countnosuchnumberretry']>=_0x52de16[_0x8ce1('0x18e')]){_0x42c3bc[_0x8ce1('0x124')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x19a'));}else{_0x42c3bc[_0x8ce1('0x122')](_0x3cb3cc,_0x18ceb3,_0x1cda99,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x52de16[_0x8ce1('0x19b')]+=0x1;_0x3cb3cc['state']=0x3;_0x3cb3cc[_0x8ce1('0xcf')]=_0x8ce1('0x19c');_0x3cb3cc[_0x8ce1('0x128')]+=0x1;_0x3cb3cc['countglobal']+=0x1;var _0x515fee=ut['buildNoAnswerEventPayload'](_0x55565b,_0x52de16);ami['emit']('custom:agentnoanswer',_0x515fee);_0x5b14c9=_0x52de16['dialNoAnswerRetryFrequency'];_0x2c346a=_0x52de16['callAdditionalPhoneAfterMin'];hopperUtils[_0x8ce1('0xc5')](_0x3cb3cc)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x19d')));if(_0x42c3bc[_0x8ce1('0x199')](0x3,_0x55565b,_0x52de16)&&!_0x6f278){if(_0x3cb3cc['countnoanswerretry']>=_0x52de16[_0x8ce1('0x19e')]){_0x42c3bc[_0x8ce1('0x124')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x19f'));}else{_0x42c3bc['stateGlobal'](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x19f'));}}break;case'5':_0x52de16['outboundBusyCallsDay']+=0x1;_0x3cb3cc[_0x8ce1('0x72')]=0x5;_0x3cb3cc[_0x8ce1('0xcf')]='Busy';_0x3cb3cc[_0x8ce1('0x11f')]+=0x1;_0x3cb3cc[_0x8ce1('0xd4')]+=0x1;ami[_0x8ce1('0x40')](_0x8ce1('0x1a0'),ut[_0x8ce1('0x116')](_0x55565b,_0x8ce1('0x1a1')));_0x5b14c9=_0x52de16[_0x8ce1('0x1a2')];_0x2c346a=_0x52de16[_0x8ce1('0x1a3')];hopperUtils[_0x8ce1('0xc5')](_0x3cb3cc)[_0x8ce1('0xa2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x42c3bc[_0x8ce1('0x199')](0x5,_0x55565b,_0x52de16)&&!_0x6f278){if(_0x3cb3cc[_0x8ce1('0x11f')]>=_0x52de16[_0x8ce1('0x1a4')]){_0x42c3bc['createStateFinal'](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x1a5'));}else{_0x42c3bc[_0x8ce1('0x122')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x1a5'));}}break;case'8':_0x52de16[_0x8ce1('0x1a6')]+=0x1;_0x3cb3cc['state']=0x8;_0x3cb3cc[_0x8ce1('0xcf')]='Congestion';_0x3cb3cc[_0x8ce1('0x127')]+=0x1;_0x3cb3cc[_0x8ce1('0xd4')]+=0x1;_0x5b14c9=_0x52de16[_0x8ce1('0x18c')];_0x2c346a=_0x52de16[_0x8ce1('0x1a3')];ami[_0x8ce1('0x40')](_0x8ce1('0x1a7'),ut[_0x8ce1('0x116')](_0x55565b,_0x8ce1('0x1a8')));hopperUtils[_0x8ce1('0xc5')](_0x3cb3cc)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x1a9')));if(_0x42c3bc[_0x8ce1('0x199')](0x8,_0x55565b,_0x52de16)&&!_0x6f278){if(_0x3cb3cc[_0x8ce1('0x127')]>=_0x52de16[_0x8ce1('0x18b')]){_0x42c3bc[_0x8ce1('0x124')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x1aa'));}else{_0x42c3bc['stateGlobal'](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x1aa'));}}break;case'11':_0x52de16['outboundAbandonedCallsDay']+=0x1;_0x3cb3cc['state']=0xb;_0x3cb3cc[_0x8ce1('0xcf')]='Abandoned';_0x3cb3cc[_0x8ce1('0xe6')]+=0x1;_0x3cb3cc[_0x8ce1('0xd4')]+=0x1;_0x5b14c9=_0x52de16[_0x8ce1('0xe7')];_0x2c346a=_0x52de16[_0x8ce1('0x1a3')];hopperUtils['createHistory'](_0x3cb3cc)['catch'](loggerCatch(_0x8ce1('0xed')));if(_0x42c3bc['checkRetriveMax'](0xb,_0x55565b,_0x52de16)&&!_0x6f278){if(_0x3cb3cc[_0x8ce1('0xe6')]>=_0x52de16[_0x8ce1('0xe9')]){_0x42c3bc[_0x8ce1('0x124')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x1ab'));}else{_0x42c3bc['stateGlobal'](_0x3cb3cc,_0x18ceb3,_0x1cda99,'reason\x2011\x20abandoned');}}break;case'20':_0x52de16['outboundRejectCallsDay']+=0x1;_0x3cb3cc['state']=0x14;_0x3cb3cc[_0x8ce1('0xcf')]=_0x8ce1('0x1ac');_0x3cb3cc[_0x8ce1('0x121')]+=0x1;_0x3cb3cc['countglobal']+=0x1;_0x5b14c9=_0x52de16[_0x8ce1('0x190')];_0x2c346a=_0x52de16[_0x8ce1('0x1a3')];ami[_0x8ce1('0x40')]('custom:agentreject',ut[_0x8ce1('0x116')](_0x55565b,'agentreject'));hopperUtils[_0x8ce1('0xc5')](_0x3cb3cc)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x1ad')));if(_0x42c3bc[_0x8ce1('0x199')](0x14,_0x55565b,_0x52de16)&&!_0x6f278){if(_0x3cb3cc[_0x8ce1('0x121')]>=_0x52de16[_0x8ce1('0x1ae')]){_0x42c3bc[_0x8ce1('0x124')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x1af'));}else{_0x42c3bc[_0x8ce1('0x122')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x8ce1('0x1af'));}}break;default:_0x52de16[_0x8ce1('0x132')]+=0x1;_0x3cb3cc['state']=0xc;_0x3cb3cc[_0x8ce1('0xcf')]=_0x359485[_0x8ce1('0xc1')];_0x5b14c9=_0x52de16[_0x8ce1('0x190')];_0x2c346a=_0x52de16[_0x8ce1('0x1a3')];hopperUtils[_0x8ce1('0xc5')](_0x3cb3cc)[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x1b0')));if(_0x42c3bc[_0x8ce1('0x199')](_0x359485[_0x8ce1('0xc1')],_0x55565b,_0x52de16)&&!_0x6f278){if(_0x3cb3cc[_0x8ce1('0x11f')]+_0x3cb3cc['countcongestionretry']+_0x3cb3cc[_0x8ce1('0x128')]+_0x3cb3cc[_0x8ce1('0x120')]+_0x3cb3cc[_0x8ce1('0xd3')]+_0x3cb3cc[_0x8ce1('0xe6')]+_0x3cb3cc['countmachineretry']+_0x3cb3cc['countagentrejectretry']>=_0x52de16['dialGlobalMaxRetry']){_0x42c3bc[_0x8ce1('0x122')](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x359485[_0x8ce1('0xc1')]);}else{_0x42c3bc['createStateFinal'](_0x3cb3cc,_0x18ceb3,_0x1cda99,_0x359485[_0x8ce1('0xc1')]);}}}})[_0x8ce1('0x3d')](function(){if(_0x6f278){hopperUtils[_0x8ce1('0xe2')](_0x3cb3cc,_0x5b14c9,_0x2c346a)['then'](function(){return _0x18ceb3(0x1);});}});});};Dialer[_0x8ce1('0x19')][_0x8ce1('0x122')]=function(_0x3d93d3,_0x461bbb,_0x133586,_0x9b299d){var _0x176a96=new Final(_0x3d93d3);_0x176a96[_0x8ce1('0x72')]=0xf;_0x176a96[_0x8ce1('0xcf')]=_0x8ce1('0x1b1');this[_0x8ce1('0x124')](_0x176a96,_0x461bbb,_0x133586,_0x9b299d);};Dialer['prototype'][_0x8ce1('0x124')]=function(_0x3e8627,_0xe4162a,_0x4df11f,_0x28228d){hopperUtils[_0x8ce1('0xc7')](_0x3e8627)[_0x8ce1('0x3d')](function(){return _0xe4162a(msgResponse(_0x8ce1('0x191'),_0x8ce1('0x108'),_0x28228d));})[_0x8ce1('0xa2')](function(){return _0x4df11f(msgResponse(_0x8ce1('0x1b2'),_0x8ce1('0x95'),_0x8ce1('0x1b3')));});};Dialer[_0x8ce1('0x19')]['predictive']=function(_0x18f871){var _0x13d4d7=_0x18f871[_0x8ce1('0x1b4')]/0x64;var _0x5bd84d=_0x18f871['outboundDropCallsDayTimeout']/(_0x18f871['outboundDropCallsDayTimeout']+_0x18f871[_0x8ce1('0xc0')]);var _0x840dac=Math[_0x8ce1('0x1b5')](_0x18f871[_0x8ce1('0x1b6')]*(_0x18f871[_0x8ce1('0x1b7')]/0x64));var _0x1b7e0d=Math['round'](_0x18f871['predictiveIntervalAvailable']*(_0x18f871[_0x8ce1('0x1b8')]/0x64));var _0x341a06=_0x18f871['available']+_0x18f871['talking'];var _0x17ed8c=Math['floor'](_0x18f871['erlangCalls']*_0x18f871[_0x8ce1('0x5c')]*_0x18f871[_0x8ce1('0x1b9')]*_0x18f871[_0x8ce1('0x1ba')]);if(_['isUndefined'](_0x18f871['startProgressive'])){if(!_[_0x8ce1('0x3f')](_0x18f871[_0x8ce1('0x62')])){_0x18f871[_0x8ce1('0x62')]=undefined;loggerPredictive['error'](_0x8ce1('0x1bb'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x8ce1('0x3f')](_0x18f871['handlePredictive'])){loggerPredictive[_0x8ce1('0x66')]('[startMethodPredictive][StartProgressive]',_0x8ce1('0x1bc'));clearInterval(_0x18f871[_0x8ce1('0x64')]);_0x18f871[_0x8ce1('0x64')]=undefined;}_0x18f871['startProgressive']=moment()[_0x8ce1('0x80')](_0x8ce1('0xbf'));loggerPredictive[_0x8ce1('0x47')](_0x18f871[_0x8ce1('0x44')],_0x8ce1('0x1bd'),_0x18f871[_0x8ce1('0x27')]);this[_0x8ce1('0xb0')](_0x18f871,0x1);}else if(ifInterval(_0x18f871['dialPredictiveInterval'],_0x18f871[_0x8ce1('0x27')])){this[_0x8ce1('0xb0')](_0x18f871,0x1);loggerPredictiveCalls[_0x8ce1('0x47')](_0x8ce1('0x1be'),_0x18f871[_0x8ce1('0x27')],_0x18f871[_0x8ce1('0x44')]);_0x18f871[_0x8ce1('0x1bf')]=0x0;_0x18f871[_0x8ce1('0xce')]=0x0;}else if(_0x13d4d7<_0x5bd84d&&_0x18f871[_0x8ce1('0x1c0')]==='dropRate'){clearPredictiveAttributes(_0x18f871);loggerPredictive[_0x8ce1('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x5bd84d,_0x8ce1('0x27'),_0x18f871[_0x8ce1('0x44')]);}else if(_0x17ed8c<_0x18f871[_0x8ce1('0xce')]&&_0x18f871['dialPredictiveOptimization']===_0x8ce1('0x1c1')){clearPredictiveAttributes(_0x18f871);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x1c2'),_0x8ce1('0x1c3'),_0x17ed8c,_0x8ce1('0x1c4'),_0x18f871[_0x8ce1('0xce')],_0x8ce1('0x27'),_0x18f871[_0x8ce1('0x44')]);}else if(!ifInterval(_0x18f871['dialPredictiveInterval'],_0x18f871[_0x8ce1('0x27')])&&_[_0x8ce1('0x3f')](_0x18f871[_0x8ce1('0x62')])&&!_['isUndefined'](_0x18f871[_0x8ce1('0x27')])){_0x18f871['startPredictive']=moment()[_0x8ce1('0x80')](_0x8ce1('0xbf'));loggerPredictive[_0x8ce1('0x47')](_0x18f871[_0x8ce1('0x44')],_0x8ce1('0x1c5'),_0x18f871[_0x8ce1('0x62')]);hopperUtils[_0x8ce1('0x1c6')](_0x18f871[_0x8ce1('0x1c7')])[_0x8ce1('0x3d')](this[_0x8ce1('0x1c8')](_0x18f871))[_0x8ce1('0x3d')](mergeDataErlangB(_0x18f871))[_0x8ce1('0x3d')](this[_0x8ce1('0x1c9')](_0x18f871))[_0x8ce1('0xa2')](loggerCatchPredictive(_0x8ce1('0x1ca'),_0x18f871));}else if(!ifInterval(_0x18f871[_0x8ce1('0x1c7')],_0x18f871[_0x8ce1('0x62')])){_0x18f871['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x18f871['startPredictive']=moment()[_0x8ce1('0x80')](_0x8ce1('0xbf'));loggerPredictive[_0x8ce1('0x47')](_0x18f871[_0x8ce1('0x44')],_0x8ce1('0x1cb'),_0x18f871[_0x8ce1('0x62')]);clearInterval(_0x18f871[_0x8ce1('0x64')]);_0x18f871[_0x8ce1('0x64')]=undefined;hopperUtils[_0x8ce1('0x1c6')](_0x18f871[_0x8ce1('0x1c7')])[_0x8ce1('0x3d')](this['getDataPredictive'](_0x18f871))[_0x8ce1('0x3d')](mergeDataErlangB(_0x18f871))[_0x8ce1('0x3d')](this[_0x8ce1('0x1c9')](_0x18f871))[_0x8ce1('0xa2')](loggerCatchPredictive(_0x8ce1('0x1cc'),_0x18f871));}else if(_0x18f871[_0x8ce1('0x1b6')]&&_0x341a06<_0x18f871[_0x8ce1('0x1b6')]-_0x1b7e0d){clearPredictiveAttributes(_0x18f871);loggerPredictive[_0x8ce1('0x47')](_0x18f871['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x341a06,_0x8ce1('0x1cd'),_0x18f871['predictiveIntervalAvailable'],'-',_0x1b7e0d,'=',_0x18f871[_0x8ce1('0x1b6')]-_0x1b7e0d,')');}else if(_0x18f871[_0x8ce1('0x1b6')]&&_0x341a06>_0x18f871[_0x8ce1('0x1b6')]+_0x840dac){clearPredictiveAttributes(_0x18f871);loggerPredictive[_0x8ce1('0x47')](_0x18f871['name'],_0x8ce1('0x1ce'),_0x341a06,_0x8ce1('0x1cf'),_0x18f871[_0x8ce1('0x1b6')],'+',_0x840dac,'=',_0x18f871[_0x8ce1('0x1b6')]+_0x840dac,')');}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x1c8')]=function(_0x174db9){var _0x4a8ee7=this;return function(_0x299400){return new Promise(function(_0x3e1195,_0x51cde9){_[_0x8ce1('0x5f')](_0x174db9,_0x299400[0x0]);if(checkGetDataPredictive(_0x299400[0x0])){var _0x447d1f=_0x174db9[_0x8ce1('0x1b6')]=_0x174db9['talking']+_0x174db9[_0x8ce1('0x138')];var _0x271c3a=_0x174db9[_0x8ce1('0x1c7')]*0x3c;var _0x5c353e=_0x299400[0x0][_0x8ce1('0x54')]+_0x299400[0x0][_0x8ce1('0x52')];var _0x301281=(_0x299400[0x0][_0x8ce1('0x4c')]+_0x299400[0x0][_0x8ce1('0x4e')]+_0x299400[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x299400[0x0][_0x8ce1('0x4a')];_0x174db9[_0x8ce1('0x1b9')]=_0x301281>0x0?_0x301281:0x1;switch(_0x174db9[_0x8ce1('0x1c0')]){case _0x8ce1('0x1c1'):var _0x42d4f2=_0x174db9['dialPredictiveOptimizationPercentage']/0x64;return _0x4a8ee7[_0x8ce1('0x1d0')](_0x447d1f,_0x271c3a,_0x5c353e,_0x301281,_0x42d4f2)[_0x8ce1('0x3d')](function(_0x13ecde){return _0x3e1195(_0x13ecde);});case _0x8ce1('0x1d1'):var _0x544867=_0x174db9['dialPredictiveOptimizationPercentage']/0x64;return _0x4a8ee7[_0x8ce1('0x1d2')](_0x447d1f,_0x271c3a,_0x5c353e,_0x301281,_0x544867)[_0x8ce1('0x3d')](function(_0x24c514){return _0x3e1195(_0x24c514);});default:return _0x51cde9(msgResponse(_0x8ce1('0x1d3'),'Failure','Unknown\x20Predictive'));}}else{return _0x51cde9(msgResponse(_0x8ce1('0x1d3'),_0x8ce1('0x95'),'check\x20failure'));}});};};Dialer[_0x8ce1('0x19')]['getDataPredictiveOld']=function(_0x1d83a1){var _0x146d06=this;return function(_0x4be611){return new Promise(function(_0x434a9c,_0x19e8c0){_[_0x8ce1('0x5f')](_0x1d83a1,_0x4be611[0x0]);if(checkGetDataPredictive(_0x4be611[0x0])){loggerPredictive[_0x8ce1('0x47')](JSON[_0x8ce1('0x77')](_0x4be611[0x0]));if(_0x1d83a1[_0x8ce1('0x1c0')]===_0x8ce1('0x1c1')){return _0x146d06[_0x8ce1('0x149')](_0x1d83a1['id'])[_0x8ce1('0x3d')](function(_0x2281a2){var _0x4ebcd0=_0x1d83a1[_0x8ce1('0x1d4')]-_0x2281a2[0x0][_0x8ce1('0x1d5')];var _0x22ac18=_0x1d83a1[_0x8ce1('0x1c7')]*0x3c;var _0x42e807=_0x4be611[0x0][_0x8ce1('0x54')]+_0x4be611[0x0][_0x8ce1('0x52')];var _0x5e12e2=(_0x4be611[0x0][_0x8ce1('0x4c')]+_0x4be611[0x0][_0x8ce1('0x4e')]+_0x4be611[0x0][_0x8ce1('0x50')])/_0x4be611[0x0][_0x8ce1('0x4a')];var _0x54c730=_0x1d83a1[_0x8ce1('0x1b4')]/0x64;_0x1d83a1[_0x8ce1('0x1d6')]=_0x2281a2[0x0][_0x8ce1('0x1d5')]||0x0;_0x1d83a1['predictiveIntervalHitRate']=_0x5e12e2>0x0?_0x5e12e2:0x1;return _0x146d06['abandonmentRate'](_0x4ebcd0,_0x22ac18,_0x42e807,_0x5e12e2,_0x54c730);})[_0x8ce1('0x3d')](function(_0x4c9588){return _0x434a9c(_0x4c9588);})['catch'](function(_0x4c3c08){return _0x19e8c0(msgResponse(_0x8ce1('0x1d7'),_0x8ce1('0x95'),JSON['stringify'](_0x4c3c08)));});}if(_0x1d83a1[_0x8ce1('0x1c0')]===_0x8ce1('0x1d1')){return _0x146d06['getVoiceQueueRtPauses'](_0x1d83a1['id'])['then'](function(_0x205f42){var _0x563657=_0x1d83a1[_0x8ce1('0x1d4')]-_0x205f42[0x0][_0x8ce1('0x1d5')];var _0x3684b0=_0x1d83a1[_0x8ce1('0x1c7')]*0x3c;var _0x58a380=_0x4be611[0x0][_0x8ce1('0x54')]+_0x4be611[0x0][_0x8ce1('0x52')];var _0x16f432=(_0x4be611[0x0][_0x8ce1('0x4c')]+_0x4be611[0x0][_0x8ce1('0x4e')]+_0x4be611[0x0][_0x8ce1('0x50')])/_0x4be611[0x0][_0x8ce1('0x4a')];var _0x50f6b9=_0x1d83a1['dialPredictiveOptimizationPercentage']/0x64;_0x1d83a1[_0x8ce1('0x1d6')]=_0x205f42[0x0][_0x8ce1('0x1d5')]||0x0;_0x1d83a1[_0x8ce1('0x1b9')]=_0x16f432>0x0?_0x16f432:0x1;return _0x146d06[_0x8ce1('0x1d2')](_0x563657,_0x3684b0,_0x58a380,_0x16f432,_0x50f6b9);})[_0x8ce1('0x3d')](function(_0x48981f){return _0x434a9c(_0x48981f);})[_0x8ce1('0xa2')](function(_0x43c828){return _0x19e8c0(msgResponse(_0x8ce1('0x1d7'),_0x8ce1('0x95'),JSON[_0x8ce1('0x77')](_0x43c828)));});}}else{return _0x19e8c0(msgResponse(_0x8ce1('0x1d3'),_0x8ce1('0x95'),_0x8ce1('0x1d8')));}});};};Dialer[_0x8ce1('0x19')][_0x8ce1('0x1c9')]=function(_0xf1d4bf){var _0x713272=this;return function(){var _0x38b1fc=0x0;var _0x167fe0=Math[_0x8ce1('0x1d9')](_0xf1d4bf[_0x8ce1('0x1da')]*0x3e8);if(_0x167fe0>0x0){_0x167fe0=_0x167fe0<0x64?0x64:_0x167fe0;loggerPredictive[_0x8ce1('0x47')](_0xf1d4bf[_0x8ce1('0x44')],'one\x20call\x20every:',_0x167fe0,_0x8ce1('0x1db'));_0xf1d4bf[_0x8ce1('0x64')]=setInterval(function(){_0x713272[_0x8ce1('0x64')](_0xf1d4bf);loggerPredictiveCalls['info'](_0x8ce1('0x1dc'),_0x38b1fc+=0x1);},_0x167fe0);}else{loggerPredictive[_0x8ce1('0x47')](_0xf1d4bf['name'],_0x8ce1('0x1dd'));}};};Dialer[_0x8ce1('0x19')]['checkContactBlack']=function(_0x3dc886,_0x8f9fed){var _0x2029ae=this;return function(_0x163c6d){if(_[_0x8ce1('0x46')](_0x163c6d)){if(_[_0x8ce1('0xf4')](_0x8f9fed[_0x8ce1('0x1de')])||!_0x8f9fed[_0x8ce1('0x1df')]){if(_0x3dc886[_0x8ce1('0x1e0')]==='booked'){_0x3dc886[_0x8ce1('0x75')]=_[_0x8ce1('0x3f')](_0x3dc886[_0x8ce1('0x75')])?!![]:_0x3dc886[_0x8ce1('0x75')];var _0x11a117=uuid['v4']();_0x2029ae['actions'][_0x11a117]=new Action(_0x3dc886,_0x8f9fed,_0x11a117);loggerBooked[_0x8ce1('0x47')]('[booked][checkContactBlack]',_0x11a117,'queueStatusComplete:\x20',JSON[_0x8ce1('0x77')](_0x3dc886[_0x8ce1('0x75')]),'Queue:\x20',_0x3dc886[_0x8ce1('0x44')]);if(_0x3dc886[_0x8ce1('0x75')]){_0x3dc886['queueStatusComplete']=![];_0x2029ae[_0x8ce1('0x29')][_0x2029ae[_0x8ce1('0x23')][_0x11a117][_0x8ce1('0xbe')]]=[];ami[_0x8ce1('0x9d')]({'actionid':_0x11a117,'action':_0x8ce1('0x1e1'),'queue':_0x3dc886['name']})[_0x8ce1('0xa2')](function(){_0x2029ae[_0x8ce1('0xbd')](_0x3dc886);hopperUtils[_0x8ce1('0xea')]({'active':![],'ContactId':_0x2029ae[_0x8ce1('0x23')][_0x11a117][_0x8ce1('0xdb')],'ListId':_0x2029ae[_0x8ce1('0x23')][_0x11a117][_0x8ce1('0xdc')],'VoiceQueueId':_0x2029ae[_0x8ce1('0x23')][_0x11a117]['VoiceQueueId']||undefined,'CampaignId':_0x2029ae[_0x8ce1('0x23')][_0x11a117][_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2029ae[_0x8ce1('0x23')][_0x11a117];});}else{loggerBooked[_0x8ce1('0x47')](_0x8ce1('0x1e2'),JSON[_0x8ce1('0x77')](_0x3dc886[_0x8ce1('0x75')]),_0x8ce1('0x1e3'),_0x3dc886[_0x8ce1('0x44')]);_0x2029ae['updateOriginated'](_0x3dc886);hopperUtils[_0x8ce1('0xea')]({'active':![],'ContactId':_0x2029ae[_0x8ce1('0x23')][_0x11a117][_0x8ce1('0xdb')],'ListId':_0x2029ae[_0x8ce1('0x23')][_0x11a117]['ListId'],'VoiceQueueId':_0x2029ae[_0x8ce1('0x23')][_0x11a117][_0x8ce1('0xdd')]||undefined,'CampaignId':_0x2029ae[_0x8ce1('0x23')][_0x11a117][_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x1e4')));delete _0x2029ae[_0x8ce1('0x23')][_0x11a117];}}else{return _0x2029ae[_0x8ce1('0x159')](_0x3dc886,_0x8f9fed);}}else{if(utils[_0x8ce1('0x60')](undefined,_0x8f9fed[_0x8ce1('0x1e5')])<_0x3dc886[_0x8ce1('0x1e6')]*0x3c){if(_0x8f9fed[_0x8ce1('0x1e7')]&&!_0x8f9fed[_0x8ce1('0x1e7')][_0x8ce1('0x1e8')]){_0x2029ae[_0x8ce1('0x1e9')][_0x8ce1('0xfe')](_0x8f9fed['id'])['finally'](function(){_0x2029ae['updateOriginated'](_0x3dc886);});}else{hopperUtils['unlockContact']({'active':![]},_0x8f9fed['id'],0x1)['finally'](function(){_0x2029ae['updateOriginated'](_0x3dc886);});}}else{_0x3dc886[_0x8ce1('0x1ea')]+=0x1;_0x2029ae[_0x8ce1('0xbd')](_0x3dc886);if(_0x3dc886['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x8f9fed[_0x8ce1('0xdb')],'ListId':_0x8f9fed[_0x8ce1('0xdc')],'VoiceQueueId':_0x8f9fed[_0x8ce1('0xdd')]||undefined,'CampaignId':_0x8f9fed[_0x8ce1('0xeb')]||undefined})[_0x8ce1('0xa2')](loggerCatch(_0x8ce1('0x1eb')));hopperUtils[_0x8ce1('0xc5')](createObjHistory(_0x3dc886,_0x8f9fed,utils[_0x8ce1('0x6b')][_0x8ce1('0x1ec')],0x17,_0x8ce1('0x1ed')))['catch'](loggerCatch(_0x8ce1('0x1ee')));}else{_0x2029ae[_0x8ce1('0x118')](createObjHistory(_0x3dc886,_0x8f9fed,utils[_0x8ce1('0x6b')][_0x8ce1('0x1ef')],0x16,_0x8ce1('0x1f0')),_0x8ce1('0x1f1'),_0x8ce1('0x1f2'));}}}}else{_0x3dc886[_0x8ce1('0x1f3')]+=0x1;_0x2029ae['saveInDb'](createObjHistory(_0x3dc886,_0x8f9fed,utils[_0x8ce1('0x6b')][_0x8ce1('0x1f4')],0xd,'Blacklist'),_0x8ce1('0x1f5'),_0x8ce1('0x1f6'));throw'inBlackList';}};};Dialer['prototype'][_0x8ce1('0x158')]=function(_0x11fc1b){var _0xfc1a8e=this;var _0x512171=_0x11fc1b[_0x8ce1('0x1f7')]-_0x11fc1b[_0x8ce1('0x84')];emitCampaignSummary(_0x11fc1b);if(_0x512171>0x0&&_0x11fc1b['temp']==0x0){if(_0x512171>this[_0x8ce1('0x21')]){_0x512171=this[_0x8ce1('0x21')];}_0x11fc1b['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x11fc1b,_0x512171)[_0x8ce1('0x3d')](function(_0x3570ee){_0x11fc1b[_0x8ce1('0x69')]=0x0;if(_0x3570ee){if(!utils[_0x8ce1('0x1f8')](_0x3570ee)){_0x11fc1b[_0x8ce1('0x6a')]=utils['CAMPAIGN_STATUS'][_0x8ce1('0x70')];logger[_0x8ce1('0x47')]('[getContactCampaign2][Empty]'+_0x11fc1b[_0x8ce1('0x44')]);}else{_0x11fc1b[_0x8ce1('0x84')]+=_0x3570ee[_0x8ce1('0x9b')];_0x11fc1b[_0x8ce1('0x6a')]=utils[_0x8ce1('0x6b')][_0x8ce1('0x1f9')];for(var _0x5d8e18=0x0;_0x5d8e18<_0x3570ee[_0x8ce1('0x9b')];_0x5d8e18+=0x1){_0x11fc1b['ivrTotalCallsDays']+=0x1;if(_[_0x8ce1('0xf4')](_0x3570ee[_0x5d8e18])||_[_0x8ce1('0xf4')](_0x3570ee[_0x5d8e18][_0x8ce1('0x172')])||_[_0x8ce1('0xf4')](_0x3570ee[_0x5d8e18][_0x8ce1('0x15d')])){_0xfc1a8e[_0x8ce1('0x14e')](_0x8ce1('0x1fa'),_0x11fc1b,_0x3570ee[_0x5d8e18]);}else{hopperUtils[_0x8ce1('0x1fb')](_[_0x8ce1('0x100')](_0x3570ee[_0x5d8e18],[_0x8ce1('0xeb'),_0x8ce1('0x15d')]))[_0x8ce1('0x3d')](_0xfc1a8e[_0x8ce1('0x1fc')](_0x11fc1b,_0x3570ee[_0x5d8e18]))[_0x8ce1('0xa2')](_0xfc1a8e[_0x8ce1('0x14d')]('[actionOriginateIvr]\x20',_0x11fc1b));}}}}})[_0x8ce1('0xa2')](loggerGetContactDialer(_0x8ce1('0x1fd'),_0x11fc1b,_0x512171));}};Dialer['prototype'][_0x8ce1('0xb0')]=function(_0x4a1e39,_0x2ab717){var _0x591d25=this;var _0x48d7c6=[];if(_0x2ab717<0x1||_0x4a1e39[_0x8ce1('0x1e0')]===_0x8ce1('0x9')){_0x2ab717=0x1;}var _0x3d2384=Math[_0x8ce1('0x1d9')](_0x4a1e39[_0x8ce1('0x138')]*_0x2ab717)-_0x4a1e39[_0x8ce1('0x84')];if(_0x4a1e39['dialLimitQueue']>0x0){var _0x2e1152=_0x4a1e39[_0x8ce1('0x1fe')]-_0x4a1e39['originated']-_0x4a1e39[_0x8ce1('0x13a')]-_0x4a1e39[_0x8ce1('0x13b')];if(_0x3d2384>_0x2e1152){_0x3d2384=_0x2e1152;}}if(_0x3d2384>0x0&&_0x4a1e39['temp']==0x0){if(_0x4a1e39['dialMethod']===_0x8ce1('0x9')){_0x3d2384=0x1;}if(_0x3d2384>this[_0x8ce1('0x21')]){_0x3d2384=this['maxNumberOriginate'];}for(var _0x1f5636 in this[_0x8ce1('0x1f')]){if(typeof this[_0x8ce1('0x1f')][_0x1f5636]!==_0x8ce1('0xac')){if(this[_0x8ce1('0x1f')][_0x1f5636][_0x8ce1('0x72')]===_0x8ce1('0x1ff')&&this['agents'][_0x1f5636][_0x8ce1('0x8c')]===_0x8ce1('0x8d')){_0x48d7c6[_0x8ce1('0x9c')](this[_0x8ce1('0x1f')][_0x1f5636]['id']);}}}_0x4a1e39[_0x8ce1('0x69')]=0x1;hopperUtils[_0x8ce1('0x200')](_0x4a1e39,_0x48d7c6,_0x3d2384)[_0x8ce1('0x3d')](function(_0x23b566){_0x4a1e39[_0x8ce1('0x69')]=0x0;if(_0x23b566){if(!utils[_0x8ce1('0x1f8')](_0x23b566)){hopperUtils[_0x8ce1('0x201')](_0x4a1e39)['then'](sendMessageReschedule(_0x4a1e39))[_0x8ce1('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x4a1e39[_0x8ce1('0x84')]+=_0x23b566['length'];_0x4a1e39[_0x8ce1('0x6a')]=_0x4a1e39[_0x8ce1('0x1e0')]==='booked'?utils[_0x8ce1('0x6b')][_0x8ce1('0x13c')]:utils[_0x8ce1('0x6b')][_0x8ce1('0x1f9')];for(var _0x2514c7=0x0;_0x2514c7<_0x23b566['length'];_0x2514c7+=0x1){if(_['isNil'](_0x23b566[_0x2514c7])||_[_0x8ce1('0xf4')](_0x23b566[_0x2514c7][_0x8ce1('0x172')])||_[_0x8ce1('0xf4')](_0x23b566[_0x2514c7][_0x8ce1('0x15d')])){_0x591d25[_0x8ce1('0x14e')](_0x8ce1('0x1fa'),_0x4a1e39,_0x23b566[_0x2514c7]);}else{hopperUtils['checkIsBlackList'](_[_0x8ce1('0x100')](_0x23b566[_0x2514c7],[_0x8ce1('0xdd'),_0x8ce1('0x15d')]))[_0x8ce1('0x3d')](_0x591d25['checkContactBlack'](_0x4a1e39,_0x23b566[_0x2514c7]))[_0x8ce1('0xa2')](_0x591d25[_0x8ce1('0x14d')](_0x8ce1('0x1fa'),_0x4a1e39));}}}}})[_0x8ce1('0xa2')](loggerGetContactDialer(_0x8ce1('0x202'),_0x4a1e39,_0x3d2384));}};Dialer[_0x8ce1('0x19')]['handlePredictive']=function(_0x375f34){if(_0x375f34['dialLimitQueue']>0x0){var _0x1a1989=_0x375f34['dialLimitQueue']-_0x375f34[_0x8ce1('0x84')]-_0x375f34[_0x8ce1('0x13a')];if(_0x1a1989>0x0&&_0x375f34[_0x8ce1('0x69')]==0x0){this[_0x8ce1('0x203')](_0x375f34);}else{loggerPredictiveCalls[_0x8ce1('0x47')](_0x8ce1('0x204'));}}else{this[_0x8ce1('0x203')](_0x375f34);}};Dialer[_0x8ce1('0x19')][_0x8ce1('0x203')]=function(_0x5e6085){var _0x2189ee=this;var _0x1ada10=[];_0x5e6085[_0x8ce1('0x84')]+=0x1;for(var _0x32a2d3 in this[_0x8ce1('0x1f')]){if(typeof this['agents'][_0x32a2d3]!=='undefined'){if(this[_0x8ce1('0x1f')][_0x32a2d3][_0x8ce1('0x72')]==='not_inuse'&&this[_0x8ce1('0x1f')][_0x32a2d3][_0x8ce1('0x8c')]===_0x8ce1('0x8d')){_0x1ada10[_0x8ce1('0x9c')](this[_0x8ce1('0x1f')][_0x32a2d3]['id']);}}}_0x5e6085[_0x8ce1('0x69')]=0x1;return this[_0x8ce1('0x200')](_0x5e6085['id'],_0x1ada10,0x1,_0x5e6085[_0x8ce1('0x205')],_0x5e6085)[_0x8ce1('0x3d')](function(_0x4b7597){_0x5e6085[_0x8ce1('0x69')]=0x1;if(_0x4b7597){if(!utils['checkContactEmpty'](_0x4b7597)){utils['checkContactLowerLimitOriginate'](_0x5e6085,0x1,0x0);return hopperUtils['countReScheduled'](_0x5e6085)[_0x8ce1('0x3d')](sendMessageReschedule(_0x5e6085))[_0x8ce1('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x5e6085['message']=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0x8ce1('0xf4')](_0x4b7597[0x0])||_[_0x8ce1('0xf4')](_0x4b7597[0x0][_0x8ce1('0x172')])||_[_0x8ce1('0xf4')](_0x4b7597[0x0]['phone'])){_0x2189ee[_0x8ce1('0x14e')]('[actionOriginate]\x20',_0x5e6085,_0x4b7597[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x4b7597[0x0],[_0x8ce1('0xdd'),_0x8ce1('0x15d')]))[_0x8ce1('0x3d')](_0x2189ee[_0x8ce1('0x1fc')](_0x5e6085,_0x4b7597[0x0]))[_0x8ce1('0xa2')](_0x2189ee[_0x8ce1('0x14d')](_0x8ce1('0x206'),_0x5e6085));}}}})['catch'](loggerGetContactDialer(_0x8ce1('0x207'),_0x5e6085,0x1));};Dialer[_0x8ce1('0x19')][_0x8ce1('0x1d0')]=function(_0x1acea5,_0x32f93a,_0x575d8c,_0x44babf,_0x2a4c02,_0x5a80b0){loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x208'));loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x209'),_0x1acea5);loggerPredictive['info'](_0x8ce1('0x20a'),_0x32f93a);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x20b'),_0x575d8c);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x20c'),_0x44babf);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a4c02);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x55'));return new Promise(function(_0x5f7c2a,_0x330190){if(_0x1acea5<=0x0||isNaN(_0x1acea5)){return _0x330190(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x1acea5));}if(_0x575d8c<=0x0||isNaN(_0x575d8c)){return _0x330190(msgResponse(_0x8ce1('0x20d'),'Error','Ts\x20=\x20'+_0x575d8c));}if(_0x44babf<=0x0||isNaN(_0x44babf)){return _0x330190(msgResponse(_0x8ce1('0x20d'),_0x8ce1('0x89'),_0x8ce1('0x20e')+_0x44babf));}if(_0x32f93a<=0x0||isNaN(_0x32f93a)){return _0x330190(msgResponse(_0x8ce1('0x20d'),_0x8ce1('0x89'),_0x8ce1('0x20f')+_0x32f93a));}if(_0x2a4c02<=0x0||isNaN(_0x2a4c02)){return _0x330190(msgResponse(_0x8ce1('0x20d'),_0x8ce1('0x89'),_0x8ce1('0x210')+_0x2a4c02));}_0x5a80b0=_0x5a80b0||0x0;var _0x4bddaf=0x1/_0x575d8c;var _0x15935a=0x0;var _0x506620=0x0;var _0x46b1f9=0x0;var _0x50e7f3=0x0;for(var _0x57e5fc=0x0;_0x46b1f9<_0x2a4c02;_0x57e5fc+=0x1){_0x506620=_0x57e5fc/_0x32f93a;_0x15935a=(_0x44babf*_0x506620+_0x5a80b0)/_0x4bddaf;_0x46b1f9=utils[_0x8ce1('0x211')](_0x15935a,_0x1acea5);_0x50e7f3=_0x15935a/_0x1acea5*(0x1-utils[_0x8ce1('0x211')](_0x15935a,_0x1acea5));}return _0x5f7c2a({'erlangCalls':_0x57e5fc,'erlangCallToSecond':_0x32f93a/_0x57e5fc,'erlangAbandonmentRate':_0x46b1f9,'erlangBusyFactor':_0x50e7f3});});};Dialer[_0x8ce1('0x19')][_0x8ce1('0x1d2')]=function(_0x4ebaba,_0x17ac32,_0x3cefcc,_0x55f162,_0x56251a,_0x34aac2){loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x212'));loggerPredictive['info'](_0x8ce1('0x209'),_0x4ebaba);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x20a'),_0x17ac32);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x20b'),_0x3cefcc);loggerPredictive['info'](_0x8ce1('0x20c'),_0x55f162);loggerPredictive[_0x8ce1('0x47')](_0x8ce1('0x213'),_0x56251a);loggerPredictive['info'](_0x8ce1('0x55'));return new Promise(function(_0xbcd93b,_0x19bb4d){if(_0x4ebaba<=0x0||isNaN(_0x4ebaba)){return _0x19bb4d(msgResponse('[busyFactor]',_0x8ce1('0x89'),_0x8ce1('0x214')+_0x4ebaba));}if(_0x3cefcc<=0x0||isNaN(_0x3cefcc)){return _0x19bb4d(msgResponse(_0x8ce1('0x215'),'Error',_0x8ce1('0x216')+_0x3cefcc));}if(_0x55f162<=0x0||isNaN(_0x55f162)){return _0x19bb4d(msgResponse(_0x8ce1('0x215'),_0x8ce1('0x89'),_0x8ce1('0x20e')+_0x55f162));}if(_0x17ac32<=0x0||isNaN(_0x17ac32)){return _0x19bb4d(msgResponse(_0x8ce1('0x215'),_0x8ce1('0x89'),'interval\x20=\x20'+_0x17ac32));}if(_0x56251a<=0x0||isNaN(_0x56251a)){return _0x19bb4d(msgResponse(_0x8ce1('0x215'),_0x8ce1('0x89'),_0x8ce1('0x217')+_0x56251a));}_0x34aac2=_0x34aac2||0x0;var _0x1f511b=0x1/_0x3cefcc;var _0xa3b736=0x0;var _0x45aad3=0x0;var _0x306ffd=0x0;var _0x41c8e5=0x0;for(var _0x2ef537=0x0;_0x41c8e5<_0x56251a;_0x2ef537+=0x1){_0x45aad3=_0x2ef537/_0x17ac32;_0xa3b736=(_0x55f162*_0x45aad3+_0x34aac2)/_0x1f511b;_0x306ffd=utils[_0x8ce1('0x211')](_0xa3b736,_0x4ebaba);_0x41c8e5=_0xa3b736/_0x4ebaba*(0x1-utils[_0x8ce1('0x211')](_0xa3b736,_0x4ebaba));}return _0xbcd93b({'erlangCalls':_0x2ef537,'erlangCallToSecond':_0x17ac32/_0x2ef537,'erlangAbandonmentRate':_0x306ffd,'erlangBusyFactor':_0x41c8e5});});};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 02b6b89..d859d7e 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 _0xb9d0=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0x1e8bac,_0x26553c){var _0x2c8cdd=function(_0xd6dcca){while(--_0xd6dcca){_0x1e8bac['push'](_0x1e8bac['shift']());}};_0x2c8cdd(++_0x26553c);}(_0xb9d0,0x161));var _0x0b9d=function(_0x137d94,_0x264352){_0x137d94=_0x137d94-0x0;var _0x203863=_0xb9d0[_0x137d94];return _0x203863;};'use strict';var util=require('util');var _=require(_0x0b9d('0x0'));var moment=require(_0x0b9d('0x1'));function checkNameSurname(_0x42c179,_0x5dcd76,_0x33bc74){var _0x42a176='';if(!_[_0x0b9d('0x2')](_0x5dcd76)&&'string'===typeof _0x5dcd76){_0x42a176+=_0x5dcd76;}if(!_[_0x0b9d('0x2')](_0x33bc74)&&'string'===typeof _0x33bc74){_0x42a176+='\x20'+_0x33bc74;}if(_0x42a176!==''){return _0x42a176;}return _0x42c179;}function Action(_0x158e6f,_0x5ba78d,_0x32b050){this[_0x0b9d('0x3')]=_0x158e6f;this[_0x0b9d('0x4')]=_0x32b050||undefined;this[_0x0b9d('0x5')]=checkNameSurname(_0x5ba78d['Contact'][_0x0b9d('0x6')],_0x5ba78d[_0x0b9d('0x7')][_0x0b9d('0x8')],_0x5ba78d[_0x0b9d('0x7')][_0x0b9d('0x9')]);this[_0x0b9d('0xa')]=_0x5ba78d[_0x0b9d('0x6')];this[_0x0b9d('0xb')]=_0x158e6f['name'];this[_0x0b9d('0xc')]=_0x5ba78d[_0x0b9d('0xc')]||![];this['type']=_0x158e6f[_0x0b9d('0xd')];this[_0x0b9d('0xe')]=_0x158e6f[_0x0b9d('0xe')]||0x3;this[_0x0b9d('0xf')]=_0x5ba78d['scheduledat'];this[_0x0b9d('0x10')]=_0x5ba78d['countbusyretry'];this[_0x0b9d('0x11')]=_0x5ba78d[_0x0b9d('0x11')];this[_0x0b9d('0x12')]=_0x5ba78d[_0x0b9d('0x12')];this['countnosuchnumberretry']=_0x5ba78d[_0x0b9d('0x13')];this[_0x0b9d('0x14')]=_0x5ba78d[_0x0b9d('0x14')];this[_0x0b9d('0x15')]=_0x5ba78d[_0x0b9d('0x15')];this[_0x0b9d('0x16')]=_0x5ba78d[_0x0b9d('0x16')];this[_0x0b9d('0x17')]=_0x5ba78d[_0x0b9d('0x17')];this[_0x0b9d('0x18')]=_0x5ba78d[_0x0b9d('0x18')];this[_0x0b9d('0x19')]=_0x5ba78d[_0x0b9d('0x19')];this['UserId']=_0x5ba78d[_0x0b9d('0x1a')];this['VoiceQueueId']=_0x5ba78d[_0x0b9d('0x1b')];this['CampaignId']=_0x5ba78d[_0x0b9d('0x1c')];this[_0x0b9d('0x1d')]=_0x5ba78d['id'];this[_0x0b9d('0x1e')]=_0x5ba78d['Contact']['firstName']||'';this['starttime']=moment()[_0x0b9d('0x1f')](_0x0b9d('0x20'));this[_0x0b9d('0x21')]=_0x5ba78d['callback'];this[_0x0b9d('0x22')]=_0x5ba78d[_0x0b9d('0x22')];this[_0x0b9d('0x23')]=_0x5ba78d[_0x0b9d('0x23')];this['recallme']=_0x5ba78d[_0x0b9d('0x24')];this[_0x0b9d('0x25')]='';this[_0x0b9d('0x26')]='';}Action[_0x0b9d('0x27')][_0x0b9d('0x28')]=function(){return util['format'](_0x0b9d('0x29'),this[_0x0b9d('0x5')],this[_0x0b9d('0x3')]['dialCutDigit']>0x0?this[_0x0b9d('0xa')][_0x0b9d('0x2a')](this[_0x0b9d('0x3')][_0x0b9d('0x2b')]):this[_0x0b9d('0xa')]);};Action[_0x0b9d('0x27')][_0x0b9d('0x2c')]=function(){return this[_0x0b9d('0xb')];};module[_0x0b9d('0x2d')]=Action; \ No newline at end of file +var _0xe5a3=['phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','callback','callbackuniqueid','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','name','number','substring','dialCutDigit','exports','util','lodash','isNil','voiceQueue','uniqueid','Contact','firstName','lastName'];(function(_0x206386,_0x3bf8d2){var _0x58ec23=function(_0x472d38){while(--_0x472d38){_0x206386['push'](_0x206386['shift']());}};_0x58ec23(++_0x3bf8d2);}(_0xe5a3,0xc0));var _0x3e5a=function(_0x28b5e3,_0xa45531){_0x28b5e3=_0x28b5e3-0x0;var _0x199af8=_0xe5a3[_0x28b5e3];return _0x199af8;};'use strict';var util=require(_0x3e5a('0x0'));var _=require(_0x3e5a('0x1'));var moment=require('moment');function checkNameSurname(_0x49ca0e,_0x5ef398,_0x9c3349){var _0x797850='';if(!_[_0x3e5a('0x2')](_0x5ef398)&&'string'===typeof _0x5ef398){_0x797850+=_0x5ef398;}if(!_[_0x3e5a('0x2')](_0x9c3349)&&'string'===typeof _0x9c3349){_0x797850+='\x20'+_0x9c3349;}if(_0x797850!==''){return _0x797850;}return _0x49ca0e;}function Action(_0x479d6c,_0x3c9207,_0xd98b34){this[_0x3e5a('0x3')]=_0x479d6c;this[_0x3e5a('0x4')]=_0xd98b34||undefined;this['name']=checkNameSurname(_0x3c9207['Contact']['phone'],_0x3c9207[_0x3e5a('0x5')][_0x3e5a('0x6')],_0x3c9207[_0x3e5a('0x5')][_0x3e5a('0x7')]);this['number']=_0x3c9207[_0x3e5a('0x8')];this[_0x3e5a('0x9')]=_0x479d6c['name'];this[_0x3e5a('0xa')]=_0x3c9207[_0x3e5a('0xa')]||![];this[_0x3e5a('0xb')]=_0x479d6c[_0x3e5a('0xb')];this['dialQueueTimeout']=_0x479d6c[_0x3e5a('0xc')]||0x3;this['scheduledat']=_0x3c9207[_0x3e5a('0xd')];this[_0x3e5a('0xe')]=_0x3c9207['countbusyretry'];this['countcongestionretry']=_0x3c9207[_0x3e5a('0xf')];this[_0x3e5a('0x10')]=_0x3c9207['countnoanswerretry'];this['countnosuchnumberretry']=_0x3c9207['countnosuchnumberretry'];this[_0x3e5a('0x11')]=_0x3c9207[_0x3e5a('0x11')];this[_0x3e5a('0x12')]=_0x3c9207[_0x3e5a('0x12')];this[_0x3e5a('0x13')]=_0x3c9207[_0x3e5a('0x13')];this[_0x3e5a('0x14')]=_0x3c9207[_0x3e5a('0x14')];this[_0x3e5a('0x15')]=_0x3c9207[_0x3e5a('0x15')];this['ListId']=_0x3c9207['ListId'];this[_0x3e5a('0x16')]=_0x3c9207['UserId'];this['VoiceQueueId']=_0x3c9207[_0x3e5a('0x17')];this[_0x3e5a('0x18')]=_0x3c9207[_0x3e5a('0x18')];this['idHopper']=_0x3c9207['id'];this[_0x3e5a('0x19')]=_0x3c9207[_0x3e5a('0x5')][_0x3e5a('0x6')]||'';this[_0x3e5a('0x1a')]=moment()[_0x3e5a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3e5a('0x1c')]=_0x3c9207[_0x3e5a('0x1c')];this[_0x3e5a('0x1d')]=_0x3c9207[_0x3e5a('0x1d')];this['callbackat']=_0x3c9207['callbackat'];this['recallme']=_0x3c9207[_0x3e5a('0x1e')];this['originatecalleridnum']='';this[_0x3e5a('0x1f')]='';}Action[_0x3e5a('0x20')][_0x3e5a('0x21')]=function(){return util[_0x3e5a('0x1b')](_0x3e5a('0x22'),this[_0x3e5a('0x23')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x3e5a('0x24')][_0x3e5a('0x25')](this[_0x3e5a('0x3')][_0x3e5a('0x26')]):this[_0x3e5a('0x24')]);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0x3e5a('0x27')]=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 cff5337..37cb54d 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 _0x11e0=['countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','exports','moment','../utils','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x5a6e4c,_0x21e51d){var _0x20674b=function(_0x25582f){while(--_0x25582f){_0x5a6e4c['push'](_0x5a6e4c['shift']());}};_0x20674b(++_0x21e51d);}(_0x11e0,0x17a));var _0x011e=function(_0x53b0d1,_0xffa3c9){_0x53b0d1=_0x53b0d1-0x0;var _0x37bc3d=_0x11e0[_0x53b0d1];return _0x37bc3d;};'use strict';var moment=require(_0x011e('0x0'));var utils=require(_0x011e('0x1'));function AgentComplete(_0x2cb610,_0x191ccc){this['state']=0x4;this['statedesc']=_0x011e('0x2');this[_0x011e('0x3')]=_0x2cb610['scheduledat'];this[_0x011e('0x4')]=_0x2cb610[_0x011e('0x4')];this['campaigntype']=_0x2cb610[_0x011e('0x4')]===_0x011e('0x5')?_0x011e('0x6'):_0x2cb610['type'];this[_0x011e('0x7')]=_0x2cb610[_0x011e('0x7')];this[_0x011e('0x8')]=_0x2cb610[_0x011e('0x8')];this[_0x011e('0x9')]=_0x2cb610[_0x011e('0x9')];this[_0x011e('0xa')]=_0x2cb610['countbusyretry']+_0x2cb610[_0x011e('0x8')]+_0x2cb610[_0x011e('0x9')]+_0x2cb610['countnosuchnumberretry']+_0x2cb610[_0x011e('0xb')]+_0x2cb610['countabandonedretry']+_0x2cb610[_0x011e('0xc')]+_0x2cb610['countagentrejectretry'];this[_0x011e('0xd')]=_0x2cb610[_0x011e('0xd')];this[_0x011e('0xb')]=_0x2cb610[_0x011e('0xb')];this['countabandonedretry']=_0x2cb610[_0x011e('0xe')];this[_0x011e('0xc')]=_0x2cb610[_0x011e('0xc')];this[_0x011e('0xf')]=_0x2cb610[_0x011e('0xf')];this[_0x011e('0x10')]=_0x191ccc[_0x011e('0x10')];this[_0x011e('0x11')]=_0x2cb610['name'];this[_0x011e('0x12')]=_0x2cb610[_0x011e('0x13')];this[_0x011e('0x14')]=_0x2cb610[_0x011e('0x14')];this[_0x011e('0x15')]=_0x2cb610[_0x011e('0x15')];this[_0x011e('0x16')]=_0x2cb610[_0x011e('0x16')];this['endtime']=moment()[_0x011e('0x17')](_0x011e('0x18'));this['ringtime']=utils[_0x011e('0x19')](_0x2cb610[_0x011e('0x15')],_0x2cb610[_0x011e('0x14')]);this[_0x011e('0x1a')]=utils[_0x011e('0x19')](_0x2cb610[_0x011e('0x16')],_0x2cb610[_0x011e('0x15')]);this[_0x011e('0x1b')]=utils[_0x011e('0x19')](this[_0x011e('0x1c')],_0x2cb610[_0x011e('0x16')]);this['queue']=_0x191ccc[_0x011e('0x6')];this[_0x011e('0x1d')]=_0x191ccc[_0x011e('0x1d')];this[_0x011e('0x1e')]=_0x191ccc['reason'];this[_0x011e('0x1f')]=_0x2cb610[_0x011e('0x1f')];this[_0x011e('0x20')]=_0x2cb610[_0x011e('0x20')];this[_0x011e('0x21')]=_0x2cb610['callbackat'];this[_0x011e('0x22')]=_0x2cb610[_0x011e('0x22')];this[_0x011e('0x23')]=_0x2cb610[_0x011e('0x23')];this['ListId']=_0x2cb610[_0x011e('0x24')];this[_0x011e('0x25')]=_0x2cb610[_0x011e('0x25')];this[_0x011e('0x26')]=_0x2cb610[_0x011e('0x26')];this[_0x011e('0x27')]=_0x2cb610['CampaignId'];this[_0x011e('0x28')]=_0x2cb610[_0x011e('0x28')]||'';this['originatecalleridname']=_0x2cb610['originatecalleridname']||'';this[_0x011e('0x29')]=_0x2cb610[_0x011e('0x29')];}module[_0x011e('0x2a')]=AgentComplete; \ No newline at end of file +var _0x11ef=['ringtime','getSeconds','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0x11ef,0xcd));var _0xf11e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x11ef[_0x122ef9];return _0x42fba0;};'use strict';var moment=require('moment');var utils=require(_0xf11e('0x0'));function AgentComplete(_0x404e10,_0x25b320){this['state']=0x4;this[_0xf11e('0x1')]=_0xf11e('0x2');this['scheduledat']=_0x404e10[_0xf11e('0x3')];this[_0xf11e('0x4')]=_0x404e10[_0xf11e('0x4')];this[_0xf11e('0x5')]=_0x404e10[_0xf11e('0x4')]===_0xf11e('0x6')?'queue':_0x404e10[_0xf11e('0x4')];this[_0xf11e('0x7')]=_0x404e10[_0xf11e('0x7')];this[_0xf11e('0x8')]=_0x404e10[_0xf11e('0x8')];this[_0xf11e('0x9')]=_0x404e10['countnoanswerretry'];this[_0xf11e('0xa')]=_0x404e10[_0xf11e('0x7')]+_0x404e10[_0xf11e('0x8')]+_0x404e10[_0xf11e('0x9')]+_0x404e10['countnosuchnumberretry']+_0x404e10[_0xf11e('0xb')]+_0x404e10[_0xf11e('0xc')]+_0x404e10[_0xf11e('0xd')]+_0x404e10[_0xf11e('0xe')];this[_0xf11e('0xf')]=_0x404e10[_0xf11e('0xf')];this['countdropretry']=_0x404e10[_0xf11e('0xb')];this['countabandonedretry']=_0x404e10[_0xf11e('0xc')];this[_0xf11e('0xd')]=_0x404e10[_0xf11e('0xd')];this['countagentrejectretry']=_0x404e10[_0xf11e('0xe')];this[_0xf11e('0x10')]=_0x25b320[_0xf11e('0x10')];this[_0xf11e('0x11')]=_0x404e10[_0xf11e('0x12')];this['calleridnum']=_0x404e10[_0xf11e('0x13')];this['starttime']=_0x404e10[_0xf11e('0x14')];this[_0xf11e('0x15')]=_0x404e10[_0xf11e('0x15')];this['answertime']=_0x404e10[_0xf11e('0x16')];this['endtime']=moment()[_0xf11e('0x17')](_0xf11e('0x18'));this[_0xf11e('0x19')]=utils[_0xf11e('0x1a')](_0x404e10[_0xf11e('0x15')],_0x404e10[_0xf11e('0x14')]);this[_0xf11e('0x1b')]=utils[_0xf11e('0x1a')](_0x404e10[_0xf11e('0x16')],_0x404e10['responsetime']);this[_0xf11e('0x1c')]=utils[_0xf11e('0x1a')](this[_0xf11e('0x1d')],_0x404e10[_0xf11e('0x16')]);this[_0xf11e('0x1e')]=_0x25b320[_0xf11e('0x1e')];this[_0xf11e('0x1f')]=_0x25b320['membername'];this[_0xf11e('0x20')]=_0x25b320[_0xf11e('0x20')];this['callback']=_0x404e10[_0xf11e('0x21')];this[_0xf11e('0x22')]=_0x404e10[_0xf11e('0x22')];this['callbackat']=_0x404e10[_0xf11e('0x23')];this[_0xf11e('0x24')]=_0x404e10[_0xf11e('0x24')];this['ContactId']=_0x404e10[_0xf11e('0x25')];this[_0xf11e('0x26')]=_0x404e10[_0xf11e('0x26')];this['UserId']=_0x404e10[_0xf11e('0x27')];this[_0xf11e('0x28')]=_0x404e10[_0xf11e('0x28')];this[_0xf11e('0x29')]=_0x404e10['CampaignId'];this[_0xf11e('0x2a')]=_0x404e10[_0xf11e('0x2a')]||'';this[_0xf11e('0x2b')]=_0x404e10[_0xf11e('0x2b')]||'';this[_0xf11e('0x2c')]=_0x404e10[_0xf11e('0x2c')];}module[_0xf11e('0x2d')]=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 354ca3f..323b986 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 _0x96b6=['originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x7c3553,_0x58020e){var _0x3d2fc5=function(_0x1197d1){while(--_0x1197d1){_0x7c3553['push'](_0x7c3553['shift']());}};_0x3d2fc5(++_0x58020e);}(_0x96b6,0x1cb));var _0x696b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x96b6[_0x167cc1];return _0x10bc4b;};'use strict';function Final(_0x4d2480){this['uniqueid']=_0x4d2480[_0x696b('0x0')];this['scheduledat']=_0x4d2480[_0x696b('0x1')];this[_0x696b('0x2')]=_0x4d2480[_0x696b('0x2')];this[_0x696b('0x3')]=_0x4d2480['type']===_0x696b('0x4')?_0x696b('0x5'):_0x4d2480[_0x696b('0x2')];this[_0x696b('0x6')]=_0x4d2480[_0x696b('0x6')];this['countcongestionretry']=_0x4d2480[_0x696b('0x7')];this[_0x696b('0x8')]=_0x4d2480[_0x696b('0x8')];this[_0x696b('0x9')]=_0x4d2480[_0x696b('0x6')]+_0x4d2480['countcongestionretry']+_0x4d2480[_0x696b('0x8')]+_0x4d2480[_0x696b('0xa')]+_0x4d2480[_0x696b('0xb')]+_0x4d2480[_0x696b('0xc')]+_0x4d2480[_0x696b('0xd')]+_0x4d2480['countagentrejectretry'];this[_0x696b('0xa')]=_0x4d2480['countnosuchnumberretry'];this[_0x696b('0xb')]=_0x4d2480[_0x696b('0xb')];this['countabandonedretry']=_0x4d2480[_0x696b('0xc')];this[_0x696b('0xd')]=_0x4d2480[_0x696b('0xd')];this['countagentrejectretry']=_0x4d2480['countagentrejectretry'];this[_0x696b('0x5')]=_0x4d2480['queue'];this['calleridname']=_0x4d2480[_0x696b('0xe')];this[_0x696b('0xf')]=_0x4d2480['calleridnum'];this['starttime']=_0x4d2480[_0x696b('0x10')];this[_0x696b('0x11')]=_0x4d2480[_0x696b('0x11')];this[_0x696b('0x12')]=_0x4d2480['responsetime'];this[_0x696b('0x13')]=_0x4d2480['ringtime']||0x0;this[_0x696b('0x14')]=_0x4d2480[_0x696b('0x14')]||0x0;this[_0x696b('0x15')]=_0x4d2480[_0x696b('0x15')]||0x0;this[_0x696b('0x16')]=_0x4d2480['callback'];this[_0x696b('0x17')]=_0x4d2480[_0x696b('0x17')];this[_0x696b('0x18')]=_0x4d2480[_0x696b('0x18')];this['recallme']=_0x4d2480['recallme'];this['ContactId']=_0x4d2480[_0x696b('0x19')];this[_0x696b('0x1a')]=_0x4d2480[_0x696b('0x1a')];this[_0x696b('0x1b')]=_0x4d2480[_0x696b('0x1b')];this[_0x696b('0x1c')]=_0x4d2480['VoiceQueueId'];this[_0x696b('0x1d')]=_0x4d2480[_0x696b('0x1d')];this[_0x696b('0x1e')]=_0x4d2480['originatecalleridnum']||'';this[_0x696b('0x1f')]=_0x4d2480[_0x696b('0x1f')]||'';this[_0x696b('0x20')]=_0x4d2480[_0x696b('0x20')];this[_0x696b('0x21')]=_0x4d2480[_0x696b('0x21')];}module[_0x696b('0x22')]=Final; \ No newline at end of file +var _0x68d8=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callbackuniqueid','callbackat'];(function(_0x36ae87,_0x342809){var _0x4651b9=function(_0x57f523){while(--_0x57f523){_0x36ae87['push'](_0x36ae87['shift']());}};_0x4651b9(++_0x342809);}(_0x68d8,0x1af));var _0x868d=function(_0x5cae5c,_0x1ed548){_0x5cae5c=_0x5cae5c-0x0;var _0x303315=_0x68d8[_0x5cae5c];return _0x303315;};'use strict';function Final(_0x15a4ff){this[_0x868d('0x0')]=_0x15a4ff[_0x868d('0x0')];this[_0x868d('0x1')]=_0x15a4ff[_0x868d('0x1')];this[_0x868d('0x2')]=_0x15a4ff[_0x868d('0x2')];this[_0x868d('0x3')]=_0x15a4ff[_0x868d('0x2')]===_0x868d('0x4')?_0x868d('0x5'):_0x15a4ff[_0x868d('0x2')];this[_0x868d('0x6')]=_0x15a4ff[_0x868d('0x6')];this[_0x868d('0x7')]=_0x15a4ff['countcongestionretry'];this[_0x868d('0x8')]=_0x15a4ff[_0x868d('0x8')];this[_0x868d('0x9')]=_0x15a4ff[_0x868d('0x6')]+_0x15a4ff['countcongestionretry']+_0x15a4ff['countnoanswerretry']+_0x15a4ff[_0x868d('0xa')]+_0x15a4ff[_0x868d('0xb')]+_0x15a4ff[_0x868d('0xc')]+_0x15a4ff['countmachineretry']+_0x15a4ff['countagentrejectretry'];this['countnosuchnumberretry']=_0x15a4ff[_0x868d('0xa')];this[_0x868d('0xb')]=_0x15a4ff[_0x868d('0xb')];this[_0x868d('0xc')]=_0x15a4ff['countabandonedretry'];this[_0x868d('0xd')]=_0x15a4ff[_0x868d('0xd')];this[_0x868d('0xe')]=_0x15a4ff[_0x868d('0xe')];this['queue']=_0x15a4ff['queue'];this[_0x868d('0xf')]=_0x15a4ff[_0x868d('0xf')];this[_0x868d('0x10')]=_0x15a4ff['calleridnum'];this[_0x868d('0x11')]=_0x15a4ff[_0x868d('0x11')];this[_0x868d('0x12')]=_0x15a4ff[_0x868d('0x12')];this[_0x868d('0x13')]=_0x15a4ff['responsetime'];this['ringtime']=_0x15a4ff['ringtime']||0x0;this['holdtime']=_0x15a4ff[_0x868d('0x14')]||0x0;this[_0x868d('0x15')]=_0x15a4ff[_0x868d('0x15')]||0x0;this['callback']=_0x15a4ff['callback'];this[_0x868d('0x16')]=_0x15a4ff['callbackuniqueid'];this[_0x868d('0x17')]=_0x15a4ff[_0x868d('0x17')];this[_0x868d('0x18')]=_0x15a4ff[_0x868d('0x18')];this[_0x868d('0x19')]=_0x15a4ff[_0x868d('0x19')];this[_0x868d('0x1a')]=_0x15a4ff[_0x868d('0x1a')];this[_0x868d('0x1b')]=_0x15a4ff[_0x868d('0x1b')];this[_0x868d('0x1c')]=_0x15a4ff[_0x868d('0x1c')];this[_0x868d('0x1d')]=_0x15a4ff[_0x868d('0x1d')];this[_0x868d('0x1e')]=_0x15a4ff[_0x868d('0x1e')]||'';this[_0x868d('0x1f')]=_0x15a4ff['originatecalleridname']||'';this[_0x868d('0x20')]=_0x15a4ff[_0x868d('0x20')];this[_0x868d('0x21')]=_0x15a4ff[_0x868d('0x21')];}module[_0x868d('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 d547afc..812a774 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 _0xc569=['outbound','queue','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','scheduledat','type','campaigntype'];(function(_0x3b76ae,_0x1f110e){var _0x11ab0f=function(_0x3ebed0){while(--_0x3ebed0){_0x3b76ae['push'](_0x3b76ae['shift']());}};_0x11ab0f(++_0x1f110e);}(_0xc569,0x159));var _0x9c56=function(_0x41fe86,_0x474bdf){_0x41fe86=_0x41fe86-0x0;var _0xa62556=_0xc569[_0x41fe86];return _0xa62556;};'use strict';var moment=require(_0x9c56('0x0'));var utils=require(_0x9c56('0x1'));function Hangup(_0x78e9ad,_0x5e6b42){this[_0x9c56('0x2')]=0x4;this[_0x9c56('0x3')]='Answer';this[_0x9c56('0x4')]=_0x78e9ad[_0x9c56('0x4')];this[_0x9c56('0x5')]=_0x78e9ad['type'];this[_0x9c56('0x6')]=_0x78e9ad[_0x9c56('0x5')]===_0x9c56('0x7')?_0x9c56('0x8'):_0x78e9ad['type'];this[_0x9c56('0x9')]=_0x78e9ad[_0x9c56('0x9')]||![];this[_0x9c56('0xa')]=_0x78e9ad[_0x9c56('0xa')];this[_0x9c56('0xb')]=_0x78e9ad['countcongestionretry'];this['countnoanswerretry']=_0x78e9ad['countnoanswerretry'];this[_0x9c56('0xc')]=_0x78e9ad[_0x9c56('0xa')]+_0x78e9ad['countcongestionretry']+_0x78e9ad[_0x9c56('0xd')]+_0x78e9ad['countnosuchnumberretry']+_0x78e9ad[_0x9c56('0xe')]+_0x78e9ad[_0x9c56('0xf')]+_0x78e9ad[_0x9c56('0x10')]+_0x78e9ad[_0x9c56('0x11')];this[_0x9c56('0x12')]=_0x78e9ad[_0x9c56('0x12')];this[_0x9c56('0xe')]=_0x78e9ad['countdropretry'];this[_0x9c56('0xf')]=_0x78e9ad[_0x9c56('0xf')];this[_0x9c56('0x10')]=_0x78e9ad[_0x9c56('0x10')];this[_0x9c56('0x11')]=_0x78e9ad['countagentrejectretry'];this[_0x9c56('0x13')]=_0x5e6b42['uniqueid'];this[_0x9c56('0x14')]=_0x78e9ad[_0x9c56('0x15')];this[_0x9c56('0x16')]=_0x78e9ad[_0x9c56('0x17')];this[_0x9c56('0x18')]=_0x78e9ad[_0x9c56('0x18')];this[_0x9c56('0x19')]=_0x78e9ad[_0x9c56('0x19')];this[_0x9c56('0x1a')]=moment()[_0x9c56('0x1b')](_0x9c56('0x1c'));this[_0x9c56('0x1d')]=utils[_0x9c56('0x1e')](_0x78e9ad[_0x9c56('0x19')],_0x78e9ad[_0x9c56('0x18')]);this['holdtime']=0x0;this[_0x9c56('0x1f')]=utils[_0x9c56('0x1e')](this[_0x9c56('0x1a')],_0x78e9ad['responsetime']);this[_0x9c56('0x8')]=_0x78e9ad[_0x9c56('0x8')];this[_0x9c56('0x20')]=_0x9c56('0x21');this[_0x9c56('0x22')]=_0x5e6b42[_0x9c56('0x23')];this[_0x9c56('0x24')]=_0x78e9ad[_0x9c56('0x24')];this[_0x9c56('0x25')]=_0x78e9ad['callbackuniqueid'];this[_0x9c56('0x26')]=_0x78e9ad[_0x9c56('0x26')];this['recallme']=_0x78e9ad[_0x9c56('0x27')];this[_0x9c56('0x28')]=_0x78e9ad[_0x9c56('0x28')];this[_0x9c56('0x29')]=_0x78e9ad[_0x9c56('0x29')];this['UserId']=_0x78e9ad['UserId'];this[_0x9c56('0x2a')]=_0x78e9ad[_0x9c56('0x2a')];this['CampaignId']=_0x78e9ad[_0x9c56('0x2b')];}module['exports']=Hangup; \ No newline at end of file +var _0xe9c8=['number','starttime','responsetime','format','ringtime','getSeconds','talktime','endtime','IVR','reason','cause-txt','callback','callbackat','ContactId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum'];(function(_0x3b5a4a,_0x4096e5){var _0xaaec44=function(_0x30ca60){while(--_0x30ca60){_0x3b5a4a['push'](_0x3b5a4a['shift']());}};_0xaaec44(++_0x4096e5);}(_0xe9c8,0x131));var _0x8e9c=function(_0x68a802,_0x347f7e){_0x68a802=_0x68a802-0x0;var _0x3f4e02=_0xe9c8[_0x68a802];return _0x3f4e02;};'use strict';var moment=require(_0x8e9c('0x0'));var utils=require('../utils');function Hangup(_0x228008,_0x21661d){this[_0x8e9c('0x1')]=0x4;this[_0x8e9c('0x2')]=_0x8e9c('0x3');this[_0x8e9c('0x4')]=_0x228008['scheduledat'];this[_0x8e9c('0x5')]=_0x228008['type'];this[_0x8e9c('0x6')]=_0x228008['type']===_0x8e9c('0x7')?_0x8e9c('0x8'):_0x228008[_0x8e9c('0x5')];this[_0x8e9c('0x9')]=_0x228008[_0x8e9c('0x9')]||![];this['countbusyretry']=_0x228008[_0x8e9c('0xa')];this[_0x8e9c('0xb')]=_0x228008['countcongestionretry'];this['countnoanswerretry']=_0x228008[_0x8e9c('0xc')];this[_0x8e9c('0xd')]=_0x228008[_0x8e9c('0xa')]+_0x228008['countcongestionretry']+_0x228008[_0x8e9c('0xc')]+_0x228008['countnosuchnumberretry']+_0x228008['countdropretry']+_0x228008[_0x8e9c('0xe')]+_0x228008['countmachineretry']+_0x228008['countagentrejectretry'];this['countnosuchnumberretry']=_0x228008[_0x8e9c('0xf')];this[_0x8e9c('0x10')]=_0x228008[_0x8e9c('0x10')];this['countabandonedretry']=_0x228008['countabandonedretry'];this[_0x8e9c('0x11')]=_0x228008[_0x8e9c('0x11')];this['countagentrejectretry']=_0x228008[_0x8e9c('0x12')];this[_0x8e9c('0x13')]=_0x21661d[_0x8e9c('0x13')];this[_0x8e9c('0x14')]=_0x228008[_0x8e9c('0x15')];this[_0x8e9c('0x16')]=_0x228008[_0x8e9c('0x17')];this[_0x8e9c('0x18')]=_0x228008[_0x8e9c('0x18')];this[_0x8e9c('0x19')]=_0x228008[_0x8e9c('0x19')];this['endtime']=moment()[_0x8e9c('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8e9c('0x1b')]=utils[_0x8e9c('0x1c')](_0x228008['responsetime'],_0x228008[_0x8e9c('0x18')]);this['holdtime']=0x0;this[_0x8e9c('0x1d')]=utils['getSeconds'](this[_0x8e9c('0x1e')],_0x228008[_0x8e9c('0x19')]);this[_0x8e9c('0x8')]=_0x228008[_0x8e9c('0x8')];this['membername']=_0x8e9c('0x1f');this[_0x8e9c('0x20')]=_0x21661d[_0x8e9c('0x21')];this['callback']=_0x228008[_0x8e9c('0x22')];this['callbackuniqueid']=_0x228008['callbackuniqueid'];this[_0x8e9c('0x23')]=_0x228008[_0x8e9c('0x23')];this['recallme']=_0x228008['recallme'];this[_0x8e9c('0x24')]=_0x228008[_0x8e9c('0x24')];this['ListId']=_0x228008['ListId'];this[_0x8e9c('0x25')]=_0x228008[_0x8e9c('0x25')];this['VoiceQueueId']=_0x228008[_0x8e9c('0x26')];this[_0x8e9c('0x27')]=_0x228008[_0x8e9c('0x27')];}module[_0x8e9c('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index a20f1de..335c6c2 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 _0x72a8=['countnosuchnumberretry','countdropretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x72a8,0x66));var _0x872a=function(_0x295e6a,_0x32d249){_0x295e6a=_0x295e6a-0x0;var _0x5af7df=_0x72a8[_0x295e6a];return _0x5af7df;};'use strict';var utils=require('../utils');function History(_0x11bad9){this[_0x872a('0x0')]=_0x11bad9[_0x872a('0x0')];this[_0x872a('0x1')]=_0x11bad9['scheduledat']||undefined;this[_0x872a('0x2')]=_0x11bad9[_0x872a('0x2')];this[_0x872a('0x3')]=_0x11bad9[_0x872a('0x2')]===_0x872a('0x4')?'queue':_0x11bad9[_0x872a('0x2')];this[_0x872a('0x5')]=_0x11bad9[_0x872a('0x5')];this['countcongestionretry']=_0x11bad9['countcongestionretry'];this['countnoanswerretry']=_0x11bad9[_0x872a('0x6')];this[_0x872a('0x7')]=_0x11bad9[_0x872a('0x5')]+_0x11bad9[_0x872a('0x8')]+_0x11bad9[_0x872a('0x6')]+_0x11bad9['countnosuchnumberretry']+_0x11bad9['countdropretry']+_0x11bad9[_0x872a('0x9')]+_0x11bad9[_0x872a('0xa')]+_0x11bad9[_0x872a('0xb')];this[_0x872a('0xc')]=_0x11bad9[_0x872a('0xc')];this['countdropretry']=_0x11bad9[_0x872a('0xd')];this['countabandonedretry']=_0x11bad9[_0x872a('0x9')];this[_0x872a('0xa')]=_0x11bad9[_0x872a('0xa')];this[_0x872a('0xb')]=_0x11bad9['countagentrejectretry'];this['queue']=_0x11bad9[_0x872a('0xe')];this[_0x872a('0xf')]=_0x11bad9[_0x872a('0x10')];this[_0x872a('0x11')]=_0x11bad9[_0x872a('0x12')];this[_0x872a('0x13')]=_0x11bad9[_0x872a('0x13')];this[_0x872a('0x14')]=_0x11bad9[_0x872a('0x14')];this[_0x872a('0x15')]=_0x11bad9[_0x872a('0x14')];this['ringtime']=utils[_0x872a('0x16')](_0x11bad9['responsetime'],_0x11bad9[_0x872a('0x13')]);this[_0x872a('0x17')]=0x0;this[_0x872a('0x18')]=0x0;this[_0x872a('0x19')]=_0x11bad9[_0x872a('0x19')];this[_0x872a('0x1a')]=_0x11bad9['callbackuniqueid'];this[_0x872a('0x1b')]=_0x11bad9[_0x872a('0x1b')];this[_0x872a('0x1c')]=_0x11bad9[_0x872a('0x1c')];this[_0x872a('0x1d')]=_0x11bad9[_0x872a('0x1d')];this[_0x872a('0x1e')]=_0x11bad9[_0x872a('0x1e')];this['UserId']=_0x11bad9[_0x872a('0x1f')];this[_0x872a('0x20')]=_0x11bad9[_0x872a('0x20')];this[_0x872a('0x21')]=_0x11bad9['CampaignId'];this[_0x872a('0x22')]=_0x11bad9['originatecalleridnum']||'';this[_0x872a('0x23')]=_0x11bad9[_0x872a('0x23')]||'';this['state']=_0x11bad9['state'];this[_0x872a('0x24')]=_0x11bad9[_0x872a('0x24')];}module[_0x872a('0x25')]=History; \ No newline at end of file +var _0xdd4d=['scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','../utils','uniqueid'];(function(_0x3f1cea,_0xcd60bd){var _0x5d761a=function(_0x3f79c4){while(--_0x3f79c4){_0x3f1cea['push'](_0x3f1cea['shift']());}};_0x5d761a(++_0xcd60bd);}(_0xdd4d,0x17f));var _0xddd4=function(_0x2a2c55,_0x467318){_0x2a2c55=_0x2a2c55-0x0;var _0x294a1a=_0xdd4d[_0x2a2c55];return _0x294a1a;};'use strict';var utils=require(_0xddd4('0x0'));function History(_0x3ed1df){this['uniqueid']=_0x3ed1df[_0xddd4('0x1')];this[_0xddd4('0x2')]=_0x3ed1df[_0xddd4('0x2')]||undefined;this[_0xddd4('0x3')]=_0x3ed1df[_0xddd4('0x3')];this['campaigntype']=_0x3ed1df[_0xddd4('0x3')]===_0xddd4('0x4')?_0xddd4('0x5'):_0x3ed1df[_0xddd4('0x3')];this['countbusyretry']=_0x3ed1df[_0xddd4('0x6')];this[_0xddd4('0x7')]=_0x3ed1df[_0xddd4('0x7')];this[_0xddd4('0x8')]=_0x3ed1df[_0xddd4('0x8')];this['countglobal']=_0x3ed1df[_0xddd4('0x6')]+_0x3ed1df[_0xddd4('0x7')]+_0x3ed1df['countnoanswerretry']+_0x3ed1df[_0xddd4('0x9')]+_0x3ed1df['countdropretry']+_0x3ed1df[_0xddd4('0xa')]+_0x3ed1df[_0xddd4('0xb')]+_0x3ed1df[_0xddd4('0xc')];this[_0xddd4('0x9')]=_0x3ed1df[_0xddd4('0x9')];this[_0xddd4('0xd')]=_0x3ed1df[_0xddd4('0xd')];this[_0xddd4('0xa')]=_0x3ed1df[_0xddd4('0xa')];this[_0xddd4('0xb')]=_0x3ed1df[_0xddd4('0xb')];this[_0xddd4('0xc')]=_0x3ed1df[_0xddd4('0xc')];this[_0xddd4('0x5')]=_0x3ed1df[_0xddd4('0x5')];this['calleridname']=_0x3ed1df[_0xddd4('0xe')];this[_0xddd4('0xf')]=_0x3ed1df[_0xddd4('0x10')];this[_0xddd4('0x11')]=_0x3ed1df[_0xddd4('0x11')];this[_0xddd4('0x12')]=_0x3ed1df[_0xddd4('0x12')];this['endtime']=_0x3ed1df[_0xddd4('0x12')];this[_0xddd4('0x13')]=utils[_0xddd4('0x14')](_0x3ed1df[_0xddd4('0x12')],_0x3ed1df[_0xddd4('0x11')]);this[_0xddd4('0x15')]=0x0;this[_0xddd4('0x16')]=0x0;this['callback']=_0x3ed1df['callback'];this['callbackuniqueid']=_0x3ed1df[_0xddd4('0x17')];this[_0xddd4('0x18')]=_0x3ed1df[_0xddd4('0x18')];this[_0xddd4('0x19')]=_0x3ed1df['recallme'];this['ContactId']=_0x3ed1df[_0xddd4('0x1a')];this[_0xddd4('0x1b')]=_0x3ed1df['ListId'];this['UserId']=_0x3ed1df[_0xddd4('0x1c')];this[_0xddd4('0x1d')]=_0x3ed1df[_0xddd4('0x1d')];this[_0xddd4('0x1e')]=_0x3ed1df['CampaignId'];this[_0xddd4('0x1f')]=_0x3ed1df[_0xddd4('0x1f')]||'';this[_0xddd4('0x20')]=_0x3ed1df[_0xddd4('0x20')]||'';this['state']=_0x3ed1df['state'];this[_0xddd4('0x21')]=_0x3ed1df['statedesc'];}module[_0xddd4('0x22')]=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 3c8bd1b..7dbd9f3 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 _0x8017=['queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8017,0xb5));var _0x7801=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x8017[_0x9cfe28];return _0x54a1d0;};'use strict';var utils=require(_0x7801('0x0'));function QueueCallerAbandon(_0x749711,_0x474a7c){this['scheduledat']=_0x749711[_0x7801('0x1')];this[_0x7801('0x2')]=_0x749711[_0x7801('0x2')];this[_0x7801('0x3')]=_0x749711[_0x7801('0x2')]===_0x7801('0x4')?'queue':_0x749711[_0x7801('0x2')];this['countbusyretry']=_0x749711['countbusyretry'];this[_0x7801('0x5')]=_0x749711['countcongestionretry'];this[_0x7801('0x6')]=_0x749711[_0x7801('0x6')];this['countglobal']=_0x749711['countbusyretry']+_0x749711[_0x7801('0x5')]+_0x749711[_0x7801('0x6')]+_0x749711['countnosuchnumberretry']+_0x749711['countdropretry']+_0x749711[_0x7801('0x7')]+_0x749711['countmachineretry']+_0x749711[_0x7801('0x8')];this['countnosuchnumberretry']=_0x749711[_0x7801('0x9')];this['countdropretry']=_0x749711[_0x7801('0xa')];this[_0x7801('0x7')]=_0x749711[_0x7801('0x7')];this['countmachineretry']=_0x749711[_0x7801('0xb')];this[_0x7801('0x8')]=_0x749711['countagentrejectretry'];this[_0x7801('0xc')]=_0x474a7c[_0x7801('0xc')];this[_0x7801('0xd')]=_0x749711['name'];this['calleridnum']=_0x749711[_0x7801('0xe')];this[_0x7801('0xf')]=_0x749711['starttime'];this[_0x7801('0x10')]=_0x749711[_0x7801('0x10')];this[_0x7801('0x11')]=_0x749711[_0x7801('0x11')];this[_0x7801('0x12')]=_0x749711[_0x7801('0x12')];this[_0x7801('0x13')]=this[_0x7801('0x11')];this[_0x7801('0x14')]=utils[_0x7801('0x15')](_0x749711[_0x7801('0x10')],_0x749711['starttime']);this[_0x7801('0x16')]=utils[_0x7801('0x15')](this[_0x7801('0x11')],_0x749711['responsetime']);this[_0x7801('0x17')]=0x0;this[_0x7801('0x18')]=_0x474a7c[_0x7801('0x18')];this[_0x7801('0x19')]=_0x474a7c['connectedlinename'];this[_0x7801('0x1a')]=_0x474a7c['reason'];this['callback']=_0x749711[_0x7801('0x1b')];this[_0x7801('0x1c')]=_0x749711[_0x7801('0x1c')];this[_0x7801('0x1d')]=_0x749711[_0x7801('0x1d')];this[_0x7801('0x1e')]=_0x749711['recallme'];this[_0x7801('0x1f')]=_0x749711[_0x7801('0x1f')];this[_0x7801('0x20')]=_0x749711['ListId'];this[_0x7801('0x21')]=_0x749711[_0x7801('0x21')];this[_0x7801('0x22')]=_0x749711[_0x7801('0x22')];this[_0x7801('0x23')]=_0x749711[_0x7801('0x23')];this[_0x7801('0x24')]=_0x749711[_0x7801('0x24')]||'';this['originatecalleridname']=_0x749711[_0x7801('0x25')]||'';this[_0x7801('0x26')]=_0x749711[_0x7801('0x26')];this[_0x7801('0x27')]=_0x749711['state'];this['statedesc']=_0x749711[_0x7801('0x28')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x8624=['campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type'];(function(_0x223308,_0x30c420){var _0x4978f2=function(_0x57bc7f){while(--_0x57bc7f){_0x223308['push'](_0x223308['shift']());}};_0x4978f2(++_0x30c420);}(_0x8624,0x180));var _0x4862=function(_0x4f7a17,_0x237ece){_0x4f7a17=_0x4f7a17-0x0;var _0x459fae=_0x8624[_0x4f7a17];return _0x459fae;};'use strict';var utils=require(_0x4862('0x0'));function QueueCallerAbandon(_0x3397bc,_0x36a1e7){this[_0x4862('0x1')]=_0x3397bc[_0x4862('0x1')];this[_0x4862('0x2')]=_0x3397bc['type'];this[_0x4862('0x3')]=_0x3397bc[_0x4862('0x2')]==='outbound'?_0x4862('0x4'):_0x3397bc['type'];this[_0x4862('0x5')]=_0x3397bc[_0x4862('0x5')];this['countcongestionretry']=_0x3397bc[_0x4862('0x6')];this[_0x4862('0x7')]=_0x3397bc['countnoanswerretry'];this[_0x4862('0x8')]=_0x3397bc[_0x4862('0x5')]+_0x3397bc[_0x4862('0x6')]+_0x3397bc['countnoanswerretry']+_0x3397bc[_0x4862('0x9')]+_0x3397bc['countdropretry']+_0x3397bc[_0x4862('0xa')]+_0x3397bc[_0x4862('0xb')]+_0x3397bc[_0x4862('0xc')];this[_0x4862('0x9')]=_0x3397bc[_0x4862('0x9')];this[_0x4862('0xd')]=_0x3397bc[_0x4862('0xd')];this[_0x4862('0xa')]=_0x3397bc[_0x4862('0xa')];this[_0x4862('0xb')]=_0x3397bc[_0x4862('0xb')];this[_0x4862('0xc')]=_0x3397bc[_0x4862('0xc')];this[_0x4862('0xe')]=_0x36a1e7['uniqueid'];this['calleridname']=_0x3397bc[_0x4862('0xf')];this[_0x4862('0x10')]=_0x3397bc[_0x4862('0x11')];this[_0x4862('0x12')]=_0x3397bc[_0x4862('0x12')];this[_0x4862('0x13')]=_0x3397bc['responsetime'];this[_0x4862('0x14')]=_0x3397bc[_0x4862('0x14')];this['dropreason']=_0x3397bc[_0x4862('0x15')];this[_0x4862('0x16')]=this[_0x4862('0x14')];this[_0x4862('0x17')]=utils[_0x4862('0x18')](_0x3397bc[_0x4862('0x13')],_0x3397bc[_0x4862('0x12')]);this['holdtime']=utils[_0x4862('0x18')](this[_0x4862('0x14')],_0x3397bc[_0x4862('0x13')]);this[_0x4862('0x19')]=0x0;this[_0x4862('0x4')]=_0x36a1e7[_0x4862('0x4')];this[_0x4862('0x1a')]=_0x36a1e7[_0x4862('0x1b')];this[_0x4862('0x1c')]=_0x36a1e7['reason'];this[_0x4862('0x1d')]=_0x3397bc[_0x4862('0x1d')];this[_0x4862('0x1e')]=_0x3397bc[_0x4862('0x1e')];this['callbackat']=_0x3397bc[_0x4862('0x1f')];this['recallme']=_0x3397bc[_0x4862('0x20')];this[_0x4862('0x21')]=_0x3397bc[_0x4862('0x21')];this[_0x4862('0x22')]=_0x3397bc[_0x4862('0x22')];this[_0x4862('0x23')]=_0x3397bc[_0x4862('0x23')];this['VoiceQueueId']=_0x3397bc['VoiceQueueId'];this[_0x4862('0x24')]=_0x3397bc['CampaignId'];this[_0x4862('0x25')]=_0x3397bc[_0x4862('0x25')]||'';this[_0x4862('0x26')]=_0x3397bc[_0x4862('0x26')]||'';this['agiafterat']=_0x3397bc[_0x4862('0x27')];this[_0x4862('0x28')]=_0x3397bc[_0x4862('0x28')];this[_0x4862('0x29')]=_0x3397bc[_0x4862('0x29')];}module[_0x4862('0x2a')]=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 b9719c0..7d3b310 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 _0xb091=['swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x57c13b,_0x203d33){var _0x5d5346=function(_0x536f04){while(--_0x536f04){_0x57c13b['push'](_0x57c13b['shift']());}};_0x5d5346(++_0x203d33);}(_0xb091,0x16e));var _0x1b09=function(_0x54aa14,_0x5e2519){_0x54aa14=_0x54aa14-0x0;var _0x1e3f27=_0xb091[_0x54aa14];return _0x1e3f27;};'use strict';var util=require('util');var logger=require(_0x1b09('0x0'))(_0x1b09('0x1'));var cmHopper=require(_0x1b09('0x2'));var cmHopperAdditionalPhone=require(_0x1b09('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x1b09('0x4'));function inspectError(_0x59af61){return util['inspect'](_0x59af61,{'showHidden':![],'depth':null});}function getContactDialer(_0x295863,_0x24d22c,_0x4e252c){return cmHopper[_0x1b09('0x5')](_0x295863['id'],_0x24d22c,_0x4e252c,_0x295863[_0x1b09('0x6')])[_0x1b09('0x7')](function(_0x5ce726){_0x295863[_0x1b09('0x8')]=0x0;logger[_0x1b09('0x9')](_0x1b09('0xa'),inspectError(_0x5ce726));});}exports[_0x1b09('0x5')]=getContactDialer;function getContactDialerIvr(_0x159b95,_0x3362e4){return cmHopper[_0x1b09('0xb')](_0x159b95['id'],_0x3362e4,_0x159b95[_0x1b09('0x6')])[_0x1b09('0x7')](function(_0x36aa1b){_0x159b95[_0x1b09('0x8')]=0x0;logger['error'](_0x1b09('0xc'),inspectError(_0x36aa1b));});}exports[_0x1b09('0xb')]=getContactDialerIvr;function countReScheduled(_0x5690cb){return cmHopper['countReScheduled'](_0x5690cb)[_0x1b09('0x7')](function(_0x4284ad){logger[_0x1b09('0x9')](_0x1b09('0xd'),inspectError(_0x4284ad));});}exports[_0x1b09('0xe')]=countReScheduled;function rescheduleContact(_0x3a44f1){return cmHopper[_0x1b09('0xf')](_0x3a44f1)['catch'](function(_0x37fdb2){logger['error'](_0x1b09('0x10'),inspectError(_0x37fdb2));});}exports[_0x1b09('0xf')]=rescheduleContact;function unlockContact(_0x11ab46,_0x37673e,_0x10b7eb){return cmHopper[_0x1b09('0x11')](_0x11ab46,_0x37673e,_0x10b7eb)[_0x1b09('0x7')](function(_0x33129b){logger[_0x1b09('0x9')](_0x1b09('0x12'),inspectError(_0x33129b));});}exports[_0x1b09('0x11')]=unlockContact;function moveContactManagedDialer(_0x231ef6){return cmHopper[_0x1b09('0x13')](_0x231ef6)['catch'](function(_0x214c6b){logger[_0x1b09('0x9')]('[moveContactManagedDialer]',inspectError(_0x214c6b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xe93ac4){return cmHopperBlack['checkIsBlackList'](_0xe93ac4)[_0x1b09('0x7')](function(_0x5bb127){logger[_0x1b09('0x9')](_0x1b09('0x14'),inspectError(_0x5bb127));});}exports[_0x1b09('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x1e8f97){return cmHopperBlack[_0x1b09('0x16')](_0x1e8f97)[_0x1b09('0x7')](function(_0x363e78){logger[_0x1b09('0x9')]('[checkIsBlackListIvr]',inspectError(_0x363e78));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x27f4f5,_0x41c786,_0x4ce7dc){return cmHopperAdditionalPhone[_0x1b09('0x17')](_0x27f4f5,_0x41c786,_0x4ce7dc)[_0x1b09('0x7')](function(_0x6e132c){logger[_0x1b09('0x9')]('[verifyAdditionalPhone]',inspectError(_0x6e132c));});}exports[_0x1b09('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x15be49,_0x4936d0,_0x2d3b86){return cmHopperAdditionalPhone[_0x1b09('0x18')](_0x15be49,_0x4936d0,_0x2d3b86)['catch'](function(_0x13c89c){logger[_0x1b09('0x9')](_0x1b09('0x19'),inspectError(_0x13c89c));});}exports[_0x1b09('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x547fbb){return cmHopperHistory[_0x1b09('0x1a')](_0x547fbb)[_0x1b09('0x7')](function(_0x532589){logger[_0x1b09('0x9')](_0x1b09('0x1b'),inspectError(_0x532589));});}exports[_0x1b09('0x1a')]=avgHandleTime;function createHistory(_0x1cbbd5){return cmHopperHistory[_0x1b09('0x1c')](_0x1cbbd5)[_0x1b09('0x7')](function(_0x34620f){logger['error'](_0x1b09('0x1d'),inspectError(_0x34620f));});}exports[_0x1b09('0x1c')]=createHistory; \ No newline at end of file +var _0x3e24=['[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','temp','countReScheduled'];(function(_0x280a81,_0xbe23b8){var _0x46ba97=function(_0x494dc3){while(--_0x494dc3){_0x280a81['push'](_0x280a81['shift']());}};_0x46ba97(++_0xbe23b8);}(_0x3e24,0x167));var _0x43e2=function(_0x247b94,_0x57ed01){_0x247b94=_0x247b94-0x0;var _0x50029f=_0x3e24[_0x247b94];return _0x50029f;};'use strict';var util=require(_0x43e2('0x0'));var logger=require(_0x43e2('0x1'))(_0x43e2('0x2'));var cmHopper=require(_0x43e2('0x3'));var cmHopperAdditionalPhone=require(_0x43e2('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x43e2('0x5'));function inspectError(_0x1ff04b){return util['inspect'](_0x1ff04b,{'showHidden':![],'depth':null});}function getContactDialer(_0x1dd127,_0x18629c,_0x1a89fc){return cmHopper[_0x43e2('0x6')](_0x1dd127['id'],_0x18629c,_0x1a89fc,_0x1dd127[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x23b2d8){_0x1dd127['temp']=0x0;logger[_0x43e2('0x9')](_0x43e2('0xa'),inspectError(_0x23b2d8));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1c96f9,_0x2fdf85){return cmHopper['getContactDialerIvr'](_0x1c96f9['id'],_0x2fdf85,_0x1c96f9[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x52146c){_0x1c96f9[_0x43e2('0xb')]=0x0;logger['error']('[getContactDialerIvr]',inspectError(_0x52146c));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x103220){return cmHopper[_0x43e2('0xc')](_0x103220)[_0x43e2('0x8')](function(_0x44781a){logger[_0x43e2('0x9')](_0x43e2('0xd'),inspectError(_0x44781a));});}exports[_0x43e2('0xc')]=countReScheduled;function rescheduleContact(_0x802e2d){return cmHopper[_0x43e2('0xe')](_0x802e2d)[_0x43e2('0x8')](function(_0x377097){logger[_0x43e2('0x9')]('[rescheduleContact]',inspectError(_0x377097));});}exports[_0x43e2('0xe')]=rescheduleContact;function unlockContact(_0x40fb7b,_0xb929b5,_0x2a0fb0){return cmHopper['unlockContact'](_0x40fb7b,_0xb929b5,_0x2a0fb0)['catch'](function(_0x241da2){logger[_0x43e2('0x9')](_0x43e2('0xf'),inspectError(_0x241da2));});}exports[_0x43e2('0x10')]=unlockContact;function moveContactManagedDialer(_0x105cb8){return cmHopper[_0x43e2('0x11')](_0x105cb8)[_0x43e2('0x8')](function(_0x15ecb5){logger[_0x43e2('0x9')](_0x43e2('0x12'),inspectError(_0x15ecb5));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3ee34c){return cmHopperBlack[_0x43e2('0x13')](_0x3ee34c)['catch'](function(_0x115c0a){logger['error'](_0x43e2('0x14'),inspectError(_0x115c0a));});}exports[_0x43e2('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1fac53){return cmHopperBlack[_0x43e2('0x15')](_0x1fac53)[_0x43e2('0x8')](function(_0x5ae97b){logger[_0x43e2('0x9')](_0x43e2('0x16'),inspectError(_0x5ae97b));});}exports[_0x43e2('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x52e361,_0x234a1d,_0x32f048){return cmHopperAdditionalPhone[_0x43e2('0x17')](_0x52e361,_0x234a1d,_0x32f048)[_0x43e2('0x8')](function(_0x4f20e6){logger[_0x43e2('0x9')](_0x43e2('0x18'),inspectError(_0x4f20e6));});}exports[_0x43e2('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3b7b22,_0x178223,_0x2a593e){return cmHopperAdditionalPhone[_0x43e2('0x19')](_0x3b7b22,_0x178223,_0x2a593e)[_0x43e2('0x8')](function(_0xd29b7b){logger[_0x43e2('0x9')](_0x43e2('0x1a'),inspectError(_0xd29b7b));});}exports[_0x43e2('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x52ed49){return cmHopperHistory[_0x43e2('0x1b')](_0x52ed49)[_0x43e2('0x8')](function(_0x545246){logger[_0x43e2('0x9')](_0x43e2('0x1c'),inspectError(_0x545246));});}exports[_0x43e2('0x1b')]=avgHandleTime;function createHistory(_0x404483){return cmHopperHistory[_0x43e2('0x1d')](_0x404483)['catch'](function(_0x42f495){logger[_0x43e2('0x9')](_0x43e2('0x1e'),inspectError(_0x42f495));});}exports[_0x43e2('0x1d')]=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 dab925a..57639b9 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 _0x841d=['milliseconds','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','createdAt','description','tags','updatedAt','%s%s','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','dialActive'];(function(_0x18ae71,_0x3d7d6b){var _0x15381f=function(_0x55dda3){while(--_0x55dda3){_0x18ae71['push'](_0x18ae71['shift']());}};_0x15381f(++_0x3d7d6b);}(_0x841d,0x120));var _0xd841=function(_0x513021,_0x2342ea){_0x513021=_0x513021-0x0;var _0x5d27c2=_0x841d[_0x513021];return _0x5d27c2;};'use strict';var _=require('lodash');var moment=require(_0xd841('0x0'));var util=require(_0xd841('0x1'));var logger=require(_0xd841('0x2'))(_0xd841('0x3'));var timezones=require('../../../../config/environment/shared')[_0xd841('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xd841('0x5'),'BLACKLIST':_0xd841('0x6'),'CONTACTS_RESCHEDULED':_0xd841('0x7'),'DEACTIVATED':_0xd841('0x8'),'DISACTIVED':_0xd841('0x9'),'EMPTY_INTERVAL':_0xd841('0xa'),'INACTIVE':_0xd841('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xd841('0xc'),'OVERTIME_INTERVAL':_0xd841('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xd841('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xd841('0xf'),'RUNNING':_0xd841('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xd841('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x390666){return _0x390666[_0xd841('0x12')]===_0xd841('0x13');}exports[_0xd841('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x495d75){return _0x495d75[_0xd841('0x15')]===_0xd841('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x4f44fa){return _0x4f44fa[_0xd841('0x15')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0xafee69){return _0xafee69[_0xd841('0x17')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x239b77){return _0x239b77['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x30176a,_0x5209ae){var _0x31b1d7=moment(_0x30176a)['milliseconds'](0x0);var _0x35172b=moment(_0x5209ae)[_0xd841('0x18')](0x0);return _0x31b1d7['diff'](_0x35172b,_0xd841('0x19'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x3b98f8,_0x360b44){var _0x237e90=![];var _0x29b0b3=_0x3b98f8[_0xd841('0x12')]!==_0x360b44['dialMethod']||_0x3b98f8['dialActive']!==_0x360b44[_0xd841('0x17')]||_0x3b98f8[_0xd841('0x1a')]!==_0x360b44[_0xd841('0x1a')];var _0x55e0d8=_0x3b98f8[_0xd841('0x1b')]!==_0x360b44[_0xd841('0x1b')]||_0x3b98f8[_0xd841('0x1c')]!==_0x360b44[_0xd841('0x1c')]||_0x3b98f8[_0xd841('0x1d')]!==_0x360b44[_0xd841('0x1d')]||_0x3b98f8['paused']!==_0x360b44[_0xd841('0x1e')]||_0x3b98f8[_0xd841('0x1f')]!==_0x360b44[_0xd841('0x1f')]||_0x3b98f8[_0xd841('0x20')]!==_0x360b44[_0xd841('0x20')]||_0x3b98f8[_0xd841('0x21')]!==_0x360b44['waiting']||_0x3b98f8['inUse']!==_0x360b44[_0xd841('0x22')]||_0x3b98f8[_0xd841('0x23')]!==_0x360b44[_0xd841('0x23')];if(_0x3b98f8[_0xd841('0x24')]&&_0x360b44[_0xd841('0x24')]){_0x237e90=_0x3b98f8[_0xd841('0x24')][_0xd841('0x25')]!==_0x360b44[_0xd841('0x24')][_0xd841('0x25')]||_0x3b98f8['Trunk'][_0xd841('0x26')]!==_0x360b44[_0xd841('0x24')][_0xd841('0x26')];}return _0x29b0b3||_0x55e0d8||_0x237e90;}exports[_0xd841('0x27')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x335134){var _0x76186a=null;var _0x111b90=_0x335134['dialTimezone'];if(_['isNil'](_0x335134[_0xd841('0x28')])||_[_0xd841('0x29')](_0x335134[_0xd841('0x2a')])||_['isNil'](_0x335134[_0xd841('0x2a')][_0xd841('0x2b')])){_0x76186a=CAMPAIGN_STATUS[_0xd841('0x2c')];}else if(_[_0xd841('0x2d')](_0x335134[_0xd841('0x28')])||_[_0xd841('0x2d')](_0x335134[_0xd841('0x2a')][_0xd841('0x2b')])){_0x76186a=CAMPAIGN_STATUS[_0xd841('0x2e')];}else if(_0x111b90&&!timezones[_0x111b90]){_0x76186a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x76186a;}function checkAnyValidTrunk(_0x13b5b9,_0x2c4d87){var _0x474851=null;var _0x149316='SIP/';var _0x4720d7=[_0xd841('0x2f'),_0xd841('0x30')];var _0x13fd1c=!![];if(_0x13b5b9[_0xd841('0x24')]&&_0x13b5b9[_0xd841('0x24')][_0xd841('0x26')]){_0x149316+=_0x13b5b9[_0xd841('0x24')][_0xd841('0x25')];_0x474851=_0x2c4d87[_0x149316];_0x13fd1c=_0x4720d7[_0xd841('0x31')](_0x474851[_0xd841('0x32')]);}else if(_0x13b5b9[_0xd841('0x33')]&&_0x13b5b9[_0xd841('0x33')][_0xd841('0x26')]){_0x149316+=_0x13b5b9[_0xd841('0x33')][_0xd841('0x25')];_0x474851=_0x2c4d87[_0x149316];_0x13fd1c=_0x4720d7[_0xd841('0x31')](_0x474851[_0xd841('0x32')]);}return _0x13fd1c;}function getQueueCampaignStatusMessage(_0x200e77,_0x1e318c){var _0x2885ca=CAMPAIGN_STATUS[_0xd841('0x5')];var _0x158b44=isPreviewCampaign(_0x200e77);if(!isQueueCampaignActive(_0x200e77)){if(_0x158b44){_0x2885ca=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x200e77[_0xd841('0x23')]===0x0&&_0x200e77['talking']===0x0&&_0x200e77[_0xd841('0x21')]===0x0&&(_0x200e77[_0xd841('0x20')]||0x0)===0x0){_0x2885ca=CAMPAIGN_STATUS[_0xd841('0x34')];}else{_0x2885ca=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x200e77['loggedIn']===0x0){_0x2885ca=CAMPAIGN_STATUS[_0xd841('0x35')];}else if(!checkAnyValidTrunk(_0x200e77,_0x1e318c)){_0x2885ca=CAMPAIGN_STATUS[_0xd841('0x36')];}else if(!isPreviewCampaign(_0x200e77)){var _0x2dc2aa=checkAnyValidQueueCampaignInterval(_0x200e77);if(_0x2dc2aa){_0x2885ca=_0x2dc2aa;}}return _0x2885ca;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x409200){var _0x13cfae=CAMPAIGN_STATUS[_0xd841('0x37')];if(_0x409200[_0xd841('0x23')]===0x0&&_0x409200[_0xd841('0x1f')]===0x0&&_0x409200[_0xd841('0x21')]===0x0&&(_0x409200[_0xd841('0x20')]||0x0)===0x0){_0x13cfae=CAMPAIGN_STATUS['INACTIVE'];}return _0x13cfae;}exports[_0xd841('0x38')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2e7e27){var _0x4a5d71=_0x2e7e27[_0xd841('0x39')](/"(.*?)"/);return _0x4a5d71?_0x4a5d71[0x1]:_0x2e7e27;}exports[_0xd841('0x3a')]=extractCalleridName;function getCallerId(_0x10cc71,_0x316de2,_0x130f4f){if(!_[_0xd841('0x3b')](_0x130f4f)&&typeof _0x130f4f==='string'&&!_[_0xd841('0x2d')](_0x130f4f)){if(!_[_0xd841('0x3b')](_0x316de2)&&typeof _0x316de2===_0xd841('0x3c')&&!_[_0xd841('0x2d')](_0x316de2)){return util[_0xd841('0x3d')]('\x22%s\x22\x20<%s>',_0x316de2,_0x130f4f);}return util[_0xd841('0x3d')](_0xd841('0x3e'),_0x130f4f,_0x130f4f);}if(!_[_0xd841('0x3b')](_0x10cc71)&&typeof _0x10cc71===_0xd841('0x3c')&&!_['isEmpty'](_0x10cc71)){return _0x10cc71;}return _0xd841('0x3f');}exports[_0xd841('0x40')]=getCallerId;function getCallerIdRandom(_0x3d0426,_0x7d33da){var _0x28041a;var _0x2ed052;var _0xac810b;if(_0x7d33da<=0x0){_0x7d33da=0x1;}_0x28041a=new RegExp(_0xd841('0x41')+_0x7d33da+'}$');_0x2ed052=Math[_0xd841('0x42')](0xa,_0x7d33da-0x1);_0xac810b=Math[_0xd841('0x42')](0xa,_0x7d33da)-0x1;return util[_0xd841('0x3d')]('%s',_[_0xd841('0x43')](_0x3d0426,_0x28041a,_[_0xd841('0x44')](_0x2ed052,_0xac810b)['toString']()));}exports[_0xd841('0x45')]=getCallerIdRandom;function decrementOriginate(_0x30ddc4){if(_0x30ddc4[_0xd841('0x23')]&&_0x30ddc4[_0xd841('0x23')]>0x0){_0x30ddc4[_0xd841('0x23')]-=0x1;}else{logger['error'](_0xd841('0x46'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x11dc51){return _0x11dc51&&_0x11dc51[_0xd841('0x47')]>0x0;}exports[_0xd841('0x48')]=checkContactEmpty;function erlangb(_0x562cfd,_0x548e8c){if(_0x548e8c===0x0){return 0x0;}var _0x1db8d9=0x1;for(var _0xc82786=0x1;_0xc82786<=_0x548e8c;_0xc82786+=0x1){_0x1db8d9=0x1+_0x1db8d9*_0xc82786/_0x562cfd;}return 0x1/_0x1db8d9;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0xc0bc9d,_0x226e26,_0x2cd3e9){if(_0x226e26>_0x2cd3e9){for(var _0x481f51=0x0;_0x481f51<_0x226e26-_0x2cd3e9;_0x481f51+=0x1){decrementOriginate(_0xc0bc9d);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x466d79){var _0x17ada3={};var _0x53a2d6=['id',_0xd841('0x49'),_0xd841('0x4a'),_0xd841('0x4b'),_0xd841('0x4c')];if(_0x466d79){for(var _0x5b78c1 in _0x466d79){if(typeof _0x466d79[_0x5b78c1]!=='undefined'){if(!_[_0xd841('0x29')](_0x466d79[_0x5b78c1])&&!_0x53a2d6['includes'](_0x5b78c1)){_0x17ada3[util[_0xd841('0x3d')](_0xd841('0x4d'),'XMD-',_0x5b78c1['toUpperCase']())]=_0x466d79[_0x5b78c1];}}}}return _0x17ada3;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x2cdc=['Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2cdc,0x7c));var _0xc2cd=function(_0x92371c,_0x113062){_0x92371c=_0x92371c-0x0;var _0x2e71db=_0x2cdc[_0x92371c];return _0x2e71db;};'use strict';var _=require(_0xc2cd('0x0'));var moment=require('moment');var util=require(_0xc2cd('0x1'));var logger=require(_0xc2cd('0x2'))(_0xc2cd('0x3'));var timezones=require(_0xc2cd('0x4'))[_0xc2cd('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xc2cd('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xc2cd('0x7'),'DEACTIVATED':_0xc2cd('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xc2cd('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xc2cd('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xc2cd('0xb'),'QUEUE_RECALL':_0xc2cd('0xc'),'RECALL_TIMEOUT':_0xc2cd('0xd'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xc2cd('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1be6df){return _0x1be6df[_0xc2cd('0xf')]===_0xc2cd('0x10');}exports[_0xc2cd('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x553d0b){return _0x553d0b[_0xc2cd('0x12')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x3f2596){return _0x3f2596[_0xc2cd('0x12')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x751896){return _0x751896['dialActive'];}exports[_0xc2cd('0x13')]=isQueueCampaignActive;function isIVRCampaignActive(_0x476792){return _0x476792[_0xc2cd('0x14')];}exports[_0xc2cd('0x15')]=isIVRCampaignActive;function getSeconds(_0x5596b7,_0x4fee6b){var _0xbd553c=moment(_0x5596b7)[_0xc2cd('0x16')](0x0);var _0x44061d=moment(_0x4fee6b)['milliseconds'](0x0);return _0xbd553c[_0xc2cd('0x17')](_0x44061d,_0xc2cd('0x18'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x3ddde8,_0x2c62c0){var _0x24bd28=![];var _0x24b692=_0x3ddde8['dialMethod']!==_0x2c62c0['dialMethod']||_0x3ddde8['dialActive']!==_0x2c62c0[_0xc2cd('0x19')]||_0x3ddde8[_0xc2cd('0x1a')]!==_0x2c62c0[_0xc2cd('0x1a')];var _0x52c07f=_0x3ddde8[_0xc2cd('0x1b')]!==_0x2c62c0[_0xc2cd('0x1b')]||_0x3ddde8[_0xc2cd('0x1c')]!==_0x2c62c0['loggedIn']||_0x3ddde8[_0xc2cd('0x1d')]!==_0x2c62c0['loggedInDb']||_0x3ddde8['paused']!==_0x2c62c0[_0xc2cd('0x1e')]||_0x3ddde8['talking']!==_0x2c62c0[_0xc2cd('0x1f')]||_0x3ddde8[_0xc2cd('0x20')]!==_0x2c62c0[_0xc2cd('0x20')]||_0x3ddde8[_0xc2cd('0x21')]!==_0x2c62c0[_0xc2cd('0x21')]||_0x3ddde8[_0xc2cd('0x22')]!==_0x2c62c0['inUse']||_0x3ddde8[_0xc2cd('0x23')]!==_0x2c62c0[_0xc2cd('0x23')];if(_0x3ddde8['Trunk']&&_0x2c62c0[_0xc2cd('0x24')]){_0x24bd28=_0x3ddde8[_0xc2cd('0x24')]['name']!==_0x2c62c0[_0xc2cd('0x24')][_0xc2cd('0x25')]||_0x3ddde8[_0xc2cd('0x24')][_0xc2cd('0x14')]!==_0x2c62c0['Trunk'][_0xc2cd('0x14')];}return _0x24b692||_0x52c07f||_0x24bd28;}exports[_0xc2cd('0x26')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x776cc0){var _0x43002a=null;var _0x5c6b57=_0x776cc0[_0xc2cd('0x27')];if(_['isNil'](_0x776cc0[_0xc2cd('0x28')])||_[_0xc2cd('0x29')](_0x776cc0['Interval'])||_[_0xc2cd('0x29')](_0x776cc0[_0xc2cd('0x2a')][_0xc2cd('0x2b')])){_0x43002a=CAMPAIGN_STATUS[_0xc2cd('0x2c')];}else if(_[_0xc2cd('0x2d')](_0x776cc0[_0xc2cd('0x28')])||_[_0xc2cd('0x2d')](_0x776cc0[_0xc2cd('0x2a')][_0xc2cd('0x2b')])){_0x43002a=CAMPAIGN_STATUS[_0xc2cd('0x2e')];}else if(_0x5c6b57&&!timezones[_0x5c6b57]){_0x43002a=CAMPAIGN_STATUS[_0xc2cd('0x2f')];}return _0x43002a;}function checkAnyValidTrunk(_0x114ca1,_0x2dd1cb){var _0x2ddeef=null;var _0x3a5e07=_0xc2cd('0x30');var _0x5285ed=[_0xc2cd('0x31'),_0xc2cd('0x32')];var _0x58cfe6=!![];if(_0x114ca1[_0xc2cd('0x24')]&&_0x114ca1[_0xc2cd('0x24')][_0xc2cd('0x14')]){_0x3a5e07+=_0x114ca1[_0xc2cd('0x24')][_0xc2cd('0x25')];_0x2ddeef=_0x2dd1cb[_0x3a5e07];_0x58cfe6=_0x5285ed[_0xc2cd('0x33')](_0x2ddeef[_0xc2cd('0x34')]);}else if(_0x114ca1[_0xc2cd('0x35')]&&_0x114ca1[_0xc2cd('0x35')]['active']){_0x3a5e07+=_0x114ca1[_0xc2cd('0x35')][_0xc2cd('0x25')];_0x2ddeef=_0x2dd1cb[_0x3a5e07];_0x58cfe6=_0x5285ed['includes'](_0x2ddeef['status']);}return _0x58cfe6;}function getQueueCampaignStatusMessage(_0x1cc36e,_0xacff3d){var _0x36bed1=CAMPAIGN_STATUS[_0xc2cd('0x6')];var _0x42350c=isPreviewCampaign(_0x1cc36e);if(!isQueueCampaignActive(_0x1cc36e)){if(_0x42350c){_0x36bed1=CAMPAIGN_STATUS[_0xc2cd('0x36')];}else{if(_0x1cc36e[_0xc2cd('0x23')]===0x0&&_0x1cc36e[_0xc2cd('0x1f')]===0x0&&_0x1cc36e['waiting']===0x0&&(_0x1cc36e[_0xc2cd('0x20')]||0x0)===0x0){_0x36bed1=CAMPAIGN_STATUS[_0xc2cd('0x36')];}else{_0x36bed1=CAMPAIGN_STATUS[_0xc2cd('0x37')];}}}else if(_0x1cc36e[_0xc2cd('0x1c')]===0x0){_0x36bed1=CAMPAIGN_STATUS[_0xc2cd('0x38')];}else if(!checkAnyValidTrunk(_0x1cc36e,_0xacff3d)){_0x36bed1=CAMPAIGN_STATUS[_0xc2cd('0x39')];}else if(!isPreviewCampaign(_0x1cc36e)){var _0x32ce07=checkAnyValidQueueCampaignInterval(_0x1cc36e);if(_0x32ce07){_0x36bed1=_0x32ce07;}}return _0x36bed1;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3101c9){var _0x5bf308=CAMPAIGN_STATUS[_0xc2cd('0x37')];if(_0x3101c9[_0xc2cd('0x23')]===0x0&&_0x3101c9[_0xc2cd('0x1f')]===0x0&&_0x3101c9['waiting']===0x0&&(_0x3101c9[_0xc2cd('0x20')]||0x0)===0x0){_0x5bf308=CAMPAIGN_STATUS[_0xc2cd('0x36')];}return _0x5bf308;}exports[_0xc2cd('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x10104f){var _0x3f6a85=_0x10104f[_0xc2cd('0x3b')](/"(.*?)"/);return _0x3f6a85?_0x3f6a85[0x1]:_0x10104f;}exports[_0xc2cd('0x3c')]=extractCalleridName;function getCallerId(_0x11b0a8,_0x1cae63,_0x555631){if(!_['isUndefined'](_0x555631)&&typeof _0x555631==='string'&&!_[_0xc2cd('0x2d')](_0x555631)){if(!_[_0xc2cd('0x3d')](_0x1cae63)&&typeof _0x1cae63==='string'&&!_['isEmpty'](_0x1cae63)){return util[_0xc2cd('0x3e')](_0xc2cd('0x3f'),_0x1cae63,_0x555631);}return util[_0xc2cd('0x3e')](_0xc2cd('0x3f'),_0x555631,_0x555631);}if(!_['isUndefined'](_0x11b0a8)&&typeof _0x11b0a8==='string'&&!_[_0xc2cd('0x2d')](_0x11b0a8)){return _0x11b0a8;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x1bd8af,_0x45d4e1){var _0x40f728;var _0x3c2ae7;var _0x5255eb;if(_0x45d4e1<=0x0){_0x45d4e1=0x1;}_0x40f728=new RegExp(_0xc2cd('0x40')+_0x45d4e1+'}$');_0x3c2ae7=Math[_0xc2cd('0x41')](0xa,_0x45d4e1-0x1);_0x5255eb=Math['pow'](0xa,_0x45d4e1)-0x1;return util['format']('%s',_['replace'](_0x1bd8af,_0x40f728,_[_0xc2cd('0x42')](_0x3c2ae7,_0x5255eb)[_0xc2cd('0x43')]()));}exports[_0xc2cd('0x44')]=getCallerIdRandom;function decrementOriginate(_0x36e155){if(_0x36e155[_0xc2cd('0x23')]&&_0x36e155[_0xc2cd('0x23')]>0x0){_0x36e155[_0xc2cd('0x23')]-=0x1;}else{logger[_0xc2cd('0x45')](_0xc2cd('0x46'));}}exports[_0xc2cd('0x47')]=decrementOriginate;function checkContactEmpty(_0x3a843e){return _0x3a843e&&_0x3a843e['length']>0x0;}exports[_0xc2cd('0x48')]=checkContactEmpty;function erlangb(_0x264678,_0x318083){if(_0x318083===0x0){return 0x0;}var _0x56e9c1=0x1;for(var _0x435bbd=0x1;_0x435bbd<=_0x318083;_0x435bbd+=0x1){_0x56e9c1=0x1+_0x56e9c1*_0x435bbd/_0x264678;}return 0x1/_0x56e9c1;}exports[_0xc2cd('0x49')]=erlangb;function checkContactLowerLimitOriginate(_0x26c904,_0x4987a8,_0x176022){if(_0x4987a8>_0x176022){for(var _0xeeda63=0x0;_0xeeda63<_0x4987a8-_0x176022;_0xeeda63+=0x1){decrementOriginate(_0x26c904);}}}exports[_0xc2cd('0x4a')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x20f24f){var _0x365271={};var _0x267afc=['id',_0xc2cd('0x4b'),_0xc2cd('0x4c'),_0xc2cd('0x4d'),'updatedAt'];if(_0x20f24f){for(var _0x2fa164 in _0x20f24f){if(typeof _0x20f24f[_0x2fa164]!==_0xc2cd('0x4e')){if(!_['isNil'](_0x20f24f[_0x2fa164])&&!_0x267afc['includes'](_0x2fa164)){_0x365271[util[_0xc2cd('0x3e')](_0xc2cd('0x4f'),_0xc2cd('0x50'),_0x2fa164[_0xc2cd('0x51')]())]=_0x20f24f[_0x2fa164];}}}}return _0x365271;}exports[_0xc2cd('0x52')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7339518..c06b700 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(_0x1d4238,_0x3e09ce){var _0xaae823=function(_0x243b9f){while(--_0x243b9f){_0x1d4238['push'](_0x1d4238['shift']());}};_0xaae823(++_0x3e09ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0xf23690,_0x185dba){var _0x24231c=function(_0x504335){while(--_0x504335){_0xf23690['push'](_0xf23690['shift']());}};_0x24231c(++_0x185dba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 c8e39fe..ccd741f 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 _0xf614=['XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncVarSet','bind','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','prototype','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir'];(function(_0x54cf77,_0x29de53){var _0x38823c=function(_0x1a7ae1){while(--_0x1a7ae1){_0x54cf77['push'](_0x54cf77['shift']());}};_0x38823c(++_0x29de53);}(_0xf614,0x187));var _0x4f61=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0xf614[_0x59f0dc];return _0x5b5445;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x4f61('0x0'));var uuid=require(_0x4f61('0x1'));var moment=require('moment');var path=require(_0x4f61('0x2'));var tiff2pdf=require(_0x4f61('0x3'));var gs=require('./util/gs');var logger=require(_0x4f61('0x4'))('fax');var ami=require(_0x4f61('0x5'));var rpcDb=require(_0x4f61('0x6'));var Channel=require(_0x4f61('0x7'));var ut=require(_0x4f61('0x8'));var Action=require(_0x4f61('0x9'));var faxAccount=require(_0x4f61('0xa'));var attachment=require(_0x4f61('0xb'));var faxMessage=require(_0x4f61('0xc'));function Fax(_0x481b5c){this[_0x4f61('0xd')]={};this[_0x4f61('0xe')]=_0x481b5c[_0x4f61('0xe')];this[_0x4f61('0xf')]=_0x481b5c[_0x4f61('0xf')];this[_0x4f61('0x10')]={};ami['on'](_0x4f61('0x11'),this['syncNewchannel']['bind'](this));ami['on']('varset',this[_0x4f61('0x12')][_0x4f61('0x13')](this));ami['on']('newstate',this[_0x4f61('0x14')][_0x4f61('0x13')](this));ami['on']('newexten',this['syncNewExten'][_0x4f61('0x13')](this));ami['on'](_0x4f61('0x15'),this[_0x4f61('0x16')][_0x4f61('0x13')](this));ami['on'](_0x4f61('0x17'),this[_0x4f61('0x18')]['bind'](this));ami['on'](_0x4f61('0x19'),this[_0x4f61('0x1a')][_0x4f61('0x13')](this));ami['on']('originateresponse',this[_0x4f61('0x1b')]['bind'](this));}Fax['prototype'][_0x4f61('0x1c')]=function(_0x3815f4){if(_0x3815f4[_0x4f61('0x1d')]===_0x4f61('0x1e')){for(var _0x5ee7a3 in this['faxAccounts']){if(this[_0x4f61('0xe')]['hasOwnProperty'](_0x5ee7a3)){if(_0x3815f4[_0x4f61('0x1f')]===this['faxAccounts'][_0x5ee7a3][_0x4f61('0x20')]){this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]]={};this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]][_0x4f61('0x22')]=_0x3815f4[_0x4f61('0x22')];this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]]['id']=this[_0x4f61('0xe')][_0x5ee7a3]['id'];this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]][_0x4f61('0x23')]=this[_0x4f61('0xe')][_0x5ee7a3][_0x4f61('0x23')];logger[_0x4f61('0x24')](_0x3815f4[_0x4f61('0x21')],_0x4f61('0x25'));}}}}if(this[_0x4f61('0x10')][_0x3815f4[_0x4f61('0x21')]]){this[_0x4f61('0xd')][_0x3815f4[_0x4f61('0x21')]]={};this['channels'][_0x3815f4[_0x4f61('0x21')]]['channel']=_0x3815f4[_0x4f61('0x22')];logger[_0x4f61('0x24')](_0x3815f4['uniqueid'],_0x4f61('0x25'));}};Fax['prototype'][_0x4f61('0x12')]=function(_0x27b80c){if(this[_0x4f61('0xd')][_0x27b80c[_0x4f61('0x21')]]){for(var _0x152504 in _0x27b80c[_0x4f61('0x26')]){if(_0x27b80c[_0x4f61('0x26')][_0x4f61('0x27')](_0x152504)){this[_0x4f61('0xd')][_0x27b80c['uniqueid']][_0x152504]=_0x27b80c[_0x4f61('0x28')];}}}};Fax[_0x4f61('0x29')][_0x4f61('0x14')]=function(_0xb4163c){if(this[_0x4f61('0xd')][_0xb4163c[_0x4f61('0x21')]]){this['channels'][_0xb4163c[_0x4f61('0x21')]][_0x4f61('0x2a')]=_0xb4163c[_0x4f61('0x2a')];this[_0x4f61('0xd')][_0xb4163c[_0x4f61('0x21')]][_0x4f61('0x2b')]=_0xb4163c['channelstatedesc'];}};Fax[_0x4f61('0x29')][_0x4f61('0x2c')]=function(_0x2ccc46){if(this['channels'][_0x2ccc46[_0x4f61('0x21')]]){for(var _0xb45d47 in _0x2ccc46[_0x4f61('0x26')]){if(_0x2ccc46[_0x4f61('0x26')][_0x4f61('0x27')](_0xb45d47)){this['channels'][_0x2ccc46[_0x4f61('0x21')]][_0xb45d47]=_0x2ccc46[_0x4f61('0x28')];}}}};Fax[_0x4f61('0x29')][_0x4f61('0x16')]=function(_0x34244b){if(this[_0x4f61('0xd')][_0x34244b['uniqueid']]){this[_0x4f61('0xd')][_0x34244b[_0x4f61('0x21')]]['operation']=_0x34244b[_0x4f61('0x2d')];this[_0x4f61('0xd')][_0x34244b['uniqueid']][_0x4f61('0x2e')]=_0x34244b['status'];this[_0x4f61('0xd')][_0x34244b[_0x4f61('0x21')]]['localstationid']=_0x34244b[_0x4f61('0x20')];this[_0x4f61('0xd')][_0x34244b[_0x4f61('0x21')]][_0x4f61('0x2f')]=_0x34244b['filename'];logger[_0x4f61('0x24')](_0x34244b['uniqueid'],_0x4f61('0x30'));}};Fax[_0x4f61('0x29')][_0x4f61('0x18')]=function(_0x398eb8){var _0x1140dd=this;if(this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]]){var _0x52c1d4=this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]]['id'];this['channels'][_0x398eb8['uniqueid']][_0x4f61('0x31')]=_0x398eb8[_0x4f61('0x31')];this[_0x4f61('0xd')][_0x398eb8['uniqueid']][_0x4f61('0x32')]=_0x398eb8[_0x4f61('0x32')];this['channels'][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x20')]=_0x398eb8[_0x4f61('0x20')];this['channels'][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x33')]=_0x398eb8[_0x4f61('0x33')];this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x34')]=_0x398eb8[_0x4f61('0x34')];this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x2f')]=_0x398eb8[_0x4f61('0x2f')];this[_0x4f61('0xd')][_0x398eb8[_0x4f61('0x21')]][_0x4f61('0x35')]=_0x398eb8['calleridnum'];if(this['channels'][_0x398eb8['uniqueid']][_0x4f61('0x32')]>0x0){tiff2pdf(_0x398eb8[_0x4f61('0x2f')],_0x4f61('0x36'),function(_0x341150){logger[_0x4f61('0x24')](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x37'),_0x341150['message']);attachment[_0x4f61('0x38')]({'name':path['parse'](_0x398eb8[_0x4f61('0x2f')])[_0x4f61('0x23')],'basename':path[_0x4f61('0x39')](_0x398eb8[_0x4f61('0x2f')])[_0x4f61('0x23')]+_0x4f61('0x3a'),'type':_0x4f61('0x3b')})['then'](function(_0xad91fd){faxAccount[_0x4f61('0x3c')](_0x52c1d4,{'from':_0x398eb8[_0x4f61('0x35')],'mapKey':_0x4f61('0x3d'),'body':path[_0x4f61('0x39')](_0x398eb8['filename'])[_0x4f61('0x23')]+_0x4f61('0x3a'),'AttachmentId':_0xad91fd['id']})[_0x4f61('0x3e')](function(_0x343414){logger[_0x4f61('0x3f')](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x40'),JSON[_0x4f61('0x41')](_0x343414));});})[_0x4f61('0x3e')](function(_0x527313){logger['error'](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x42'),JSON[_0x4f61('0x41')](_0x527313));});});}logger[_0x4f61('0x24')](_0x398eb8[_0x4f61('0x21')],_0x4f61('0x42'));}};Fax[_0x4f61('0x29')]['syncOriginateResponse']=function(_0x44963e){if(this[_0x4f61('0x10')][_0x44963e[_0x4f61('0x21')]]){_[_0x4f61('0x43')](this[_0x4f61('0xd')][_0x44963e[_0x4f61('0x21')]],_[_0x4f61('0x44')](_0x44963e,['response',_0x4f61('0x45')]));}};function updateStatus(_0x8db6d){if(_0x8db6d[_0x4f61('0x46')]){faxMessage[_0x4f61('0x47')](_0x8db6d[_0x4f61('0x46')],{'failMessage':_0x4f61('0x48')})[_0x4f61('0x49')](function(_0x5dac9e){ut[_0x4f61('0x4a')](_0x4f61('0x4b'),_0x5dac9e);})['catch'](function(_0x4e10f9){ut['logger'](_0x4f61('0x4c'),_0x4e10f9);});}else{ut[_0x4f61('0x4a')](_0x4f61('0x4d'));}}Fax['prototype'][_0x4f61('0x4e')]=function(_0x46bd2b,_0x56fbab,_0xa97b68){var _0x45e51b=this;var _0x5aa91a={};if(_0x56fbab){_0x5aa91a={'read':_0x56fbab};}else{_0x5aa91a={'failMessage':_0xa97b68};}if(this[_0x4f61('0x10')][_0x46bd2b][_0x4f61('0x46')]){faxMessage[_0x4f61('0x47')](this[_0x4f61('0x10')][_0x46bd2b][_0x4f61('0x46')],_0x5aa91a)['then'](function(_0x176de6){ut[_0x4f61('0x4a')](_0x4f61('0x4f'),_0x176de6);})[_0x4f61('0x3e')](function(_0x13a786){ut[_0x4f61('0x4a')](_0x4f61('0x50'),_0x13a786);})['finally'](function(){delete _0x45e51b['channels'][_0x46bd2b];delete _0x45e51b[_0x4f61('0x10')][_0x46bd2b];});}else{ut['logger'](_0x4f61('0x51'));delete this['channels'][_0x46bd2b];delete this[_0x4f61('0x10')][_0x46bd2b];}};Fax[_0x4f61('0x29')][_0x4f61('0x1a')]=function(_0x62af7d){var _0xcffe9b=this;if(this[_0x4f61('0xd')][_0x62af7d['uniqueid']]){if(this[_0x4f61('0x10')][_0x62af7d[_0x4f61('0x21')]]){this[_0x4f61('0xd')][_0x62af7d[_0x4f61('0x21')]]['id']=this[_0x4f61('0x10')][_0x62af7d[_0x4f61('0x21')]]['id'];this[_0x4f61('0xd')][_0x62af7d['uniqueid']][_0x4f61('0x23')]=this[_0x4f61('0x10')][_0x62af7d['uniqueid']][_0x4f61('0x23')];}logger[_0x4f61('0x24')](_0x62af7d[_0x4f61('0x21')],this[_0x4f61('0x10')][_0x62af7d['uniqueid']]?_0x4f61('0x52'):_0x4f61('0x53'),JSON[_0x4f61('0x41')](this[_0x4f61('0xd')][_0x62af7d[_0x4f61('0x21')]]));if(this[_0x4f61('0x10')][_0x62af7d['uniqueid']]){if(this['channels'][_0x62af7d[_0x4f61('0x21')]][_0x4f61('0x54')]>0x0&&this['channels'][_0x62af7d['uniqueid']][_0x4f61('0x15')]===_0x4f61('0x55')){this[_0x4f61('0x4e')](_0x62af7d[_0x4f61('0x21')],!![]);}else{this[_0x4f61('0x4e')](_0x62af7d['uniqueid'],![],this[_0x4f61('0xd')][_0x62af7d[_0x4f61('0x21')]][_0x4f61('0x56')]?_0x4f61('0x57')+this['channels'][_0x62af7d[_0x4f61('0x21')]][_0x4f61('0x56')]:_0x4f61('0x58'));}}}};Fax[_0x4f61('0x29')][_0x4f61('0x59')]=function(_0x57dc90){var _0x3d105b=this;return new BPromise(function(_0x479d40,_0x461f60){_0x3d105b[_0x4f61('0x5a')](_0x57dc90,_0x3d105b[_0x4f61('0xe')][_0x57dc90[_0x4f61('0x5b')]])[_0x4f61('0x49')](function(_0x3e0aa8){ut['logger'](_0x4f61('0x5c'),_0x3e0aa8);_0x479d40(ut[_0x4f61('0x5d')](_0x4f61('0x5e')));})[_0x4f61('0x3e')](function(_0x463547){ut[_0x4f61('0x4a')]('[Fax][execOriginate][failure]',_0x463547);updateStatus(_0x57dc90);_0x461f60(ut[_0x4f61('0x5d')](_0x4f61('0x5f')));});});};Fax[_0x4f61('0x29')][_0x4f61('0x60')]=function(_0x2dfbe6){var _0x5dd0fd=this;return new BPromise(function(_0x520069,_0x4595c2){var _0x3d7582=_0x5dd0fd[_0x4f61('0x61')](_0x5dd0fd[_0x4f61('0xe')][_0x2dfbe6[_0x4f61('0x5b')]][_0x4f61('0x62')],_0x2dfbe6);if(_0x3d7582[_0x4f61('0x63')]){_0x520069(ut['message'](_0x4f61('0x64')));}else{_0x4595c2(ut[_0x4f61('0x5d')](_0x3d7582[_0x4f61('0x5d')]));}});};function originate(_0x4724f3,_0xe25a68,_0x1bd78d){return new BPromise(function(_0x353796,_0xa78ee4){if(_0x1bd78d){var _0x20d580=util[_0x4f61('0x65')]('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[_0x4f61('0x39')](_0x4724f3[_0x4f61('0x2')])[_0x4f61('0x23')],_0x4724f3[_0x4f61('0x2')]);gs[_0x4f61('0x66')](_0x20d580)[_0x4f61('0x49')](function(){_0x4724f3[_0x4f61('0x2')]=util[_0x4f61('0x65')](_0x4f61('0x67'),path[_0x4f61('0x39')](_0x4724f3['path'])[_0x4f61('0x68')],path[_0x4f61('0x39')](_0x4724f3[_0x4f61('0x2')])['name']);_0xe25a68[_0x4f61('0x69')]=_0x4724f3[_0x4f61('0x2')];ut[_0x4f61('0x4a')](_0x4f61('0x6a'),'');ami[_0x4f61('0x6b')](ut[_0x4f61('0x6c')](_0x4724f3,_0xe25a68))['then'](function(_0x3ac595){_0x353796(_0x3ac595);})[_0x4f61('0x3e')](function(_0x1e31df){_0xa78ee4(_0x1e31df);});})['catch'](function(_0x5ba984){_0xa78ee4(_0x5ba984);});}else{ami[_0x4f61('0x6b')](ut[_0x4f61('0x6c')](_0x4724f3,_0xe25a68))['then'](function(_0x2b52cb){_0x353796(_0x2b52cb);})[_0x4f61('0x3e')](function(_0x4c0605){_0xa78ee4(_0x4c0605);});}});}Fax[_0x4f61('0x29')][_0x4f61('0x5a')]=function(_0x541df2,_0x594489){var _0xdbf77e=this;return new BPromise(function(_0x112b13,_0x181819){var _0x238883=uuid['v4']();var _0x425e93=ut[_0x4f61('0x6d')](_0x541df2,_0x594489);_0xdbf77e[_0x4f61('0x10')][_0x238883]=new Action(_0x238883,_0x594489,_0x541df2);var _0x4b95eb=_0xdbf77e['actions'][_0x238883];if(path[_0x4f61('0x39')](_0x541df2['path'])[_0x4f61('0x6e')]==='.pdf'){originate(_0x4b95eb,_0x425e93,!![])[_0x4f61('0x49')](function(_0x18413e){_0x112b13(_0x18413e);})[_0x4f61('0x3e')](function(_0x721780){_0x181819(_0x721780);});}else{originate(_0x4b95eb,_0x425e93,![])[_0x4f61('0x49')](function(_0x164452){_0x112b13(_0x164452);})[_0x4f61('0x3e')](function(_0x5bac37){_0x181819(_0x5bac37);});}});};Fax[_0x4f61('0x29')][_0x4f61('0x6f')]=function(_0x3b767b){return!_[_0x4f61('0x70')](_0x3b767b)&&!_['isNil'](_0x3b767b[_0x4f61('0x23')])&&!_[_0x4f61('0x70')](_0x3b767b[_0x4f61('0x71')])&&_0x3b767b[_0x4f61('0x71')]&&!_[_0x4f61('0x70')](this[_0x4f61('0xf')][util['format'](_0x4f61('0x72'),_0x3b767b[_0x4f61('0x23')])])&&!_[_0x4f61('0x70')](this[_0x4f61('0xf')][util[_0x4f61('0x65')](_0x4f61('0x72'),_0x3b767b[_0x4f61('0x23')])]['status'])&&(this['trunks'][util[_0x4f61('0x65')](_0x4f61('0x72'),_0x3b767b[_0x4f61('0x23')])][_0x4f61('0x2e')]==='reachable'||this[_0x4f61('0xf')][util['format']('SIP/%s',_0x3b767b[_0x4f61('0x23')])][_0x4f61('0x2e')]===_0x4f61('0x73'));};Fax[_0x4f61('0x29')][_0x4f61('0x61')]=function(_0xd33f7a,_0x10086e){if(!this[_0x4f61('0x6f')](_0xd33f7a)){ut['logger'](_0x4f61('0x74'),_['isNil'](_0xd33f7a)?'':_0xd33f7a['name']+_0x4f61('0x75'));return{'isValid':![],'message':_0x4f61('0x76')};}if(_['isNil'](_0x10086e[_0x4f61('0x3d')])){ut['logger'](_0x4f61('0x77'),JSON[_0x4f61('0x41')](_0x10086e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4f61('0x70')](_0x10086e[_0x4f61('0x2')])){ut[_0x4f61('0x4a')](_0x4f61('0x78'),JSON['stringify'](_0x10086e));return{'isValid':![],'message':_0x4f61('0x79')};}return{'isValid':!![],'message':_0x4f61('0x7a')};};module[_0x4f61('0x7b')]=Fax; \ No newline at end of file +var _0xa1ec=['dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','syncFaxStatus','hangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0xa1ec,0x8e));var _0xca1e=function(_0x1739e0,_0x559f5c){_0x1739e0=_0x1739e0-0x0;var _0x2b5f13=_0xa1ec[_0x1739e0];return _0x2b5f13;};'use strict';var util=require(_0xca1e('0x0'));var _=require(_0xca1e('0x1'));var BPromise=require(_0xca1e('0x2'));var uuid=require('uuid');var moment=require(_0xca1e('0x3'));var path=require(_0xca1e('0x4'));var tiff2pdf=require(_0xca1e('0x5'));var gs=require(_0xca1e('0x6'));var logger=require(_0xca1e('0x7'))(_0xca1e('0x8'));var ami=require(_0xca1e('0x9'));var rpcDb=require(_0xca1e('0xa'));var Channel=require(_0xca1e('0xb'));var ut=require(_0xca1e('0xc'));var Action=require(_0xca1e('0xd'));var faxAccount=require(_0xca1e('0xe'));var attachment=require(_0xca1e('0xf'));var faxMessage=require(_0xca1e('0x10'));function Fax(_0x2dc390){this[_0xca1e('0x11')]={};this[_0xca1e('0x12')]=_0x2dc390['faxAccounts'];this[_0xca1e('0x13')]=_0x2dc390[_0xca1e('0x13')];this[_0xca1e('0x14')]={};ami['on']('newchannel',this['syncNewchannel'][_0xca1e('0x15')](this));ami['on'](_0xca1e('0x16'),this[_0xca1e('0x17')]['bind'](this));ami['on'](_0xca1e('0x18'),this[_0xca1e('0x19')][_0xca1e('0x15')](this));ami['on']('newexten',this[_0xca1e('0x1a')]['bind'](this));ami['on']('faxstatus',this[_0xca1e('0x1b')][_0xca1e('0x15')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xca1e('0x15')](this));ami['on'](_0xca1e('0x1c'),this['syncHangup'][_0xca1e('0x15')](this));ami['on'](_0xca1e('0x1d'),this[_0xca1e('0x1e')][_0xca1e('0x15')](this));}Fax[_0xca1e('0x1f')][_0xca1e('0x20')]=function(_0x17115b){if(_0x17115b[_0xca1e('0x21')]===_0xca1e('0x22')){for(var _0x260505 in this[_0xca1e('0x12')]){if(this[_0xca1e('0x12')][_0xca1e('0x23')](_0x260505)){if(_0x17115b[_0xca1e('0x24')]===this[_0xca1e('0x12')][_0x260505][_0xca1e('0x25')]){this[_0xca1e('0x11')][_0x17115b[_0xca1e('0x26')]]={};this[_0xca1e('0x11')][_0x17115b[_0xca1e('0x26')]][_0xca1e('0x27')]=_0x17115b[_0xca1e('0x27')];this['channels'][_0x17115b[_0xca1e('0x26')]]['id']=this[_0xca1e('0x12')][_0x260505]['id'];this[_0xca1e('0x11')][_0x17115b['uniqueid']]['name']=this[_0xca1e('0x12')][_0x260505][_0xca1e('0x28')];logger[_0xca1e('0x29')](_0x17115b[_0xca1e('0x26')],_0xca1e('0x2a'));}}}}if(this[_0xca1e('0x14')][_0x17115b['uniqueid']]){this['channels'][_0x17115b[_0xca1e('0x26')]]={};this['channels'][_0x17115b[_0xca1e('0x26')]][_0xca1e('0x27')]=_0x17115b[_0xca1e('0x27')];logger[_0xca1e('0x29')](_0x17115b['uniqueid'],_0xca1e('0x2a'));}};Fax[_0xca1e('0x1f')][_0xca1e('0x17')]=function(_0x1c4fc2){if(this[_0xca1e('0x11')][_0x1c4fc2['uniqueid']]){for(var _0x549f1f in _0x1c4fc2[_0xca1e('0x2b')]){if(_0x1c4fc2[_0xca1e('0x2b')][_0xca1e('0x23')](_0x549f1f)){this[_0xca1e('0x11')][_0x1c4fc2[_0xca1e('0x26')]][_0x549f1f]=_0x1c4fc2[_0xca1e('0x2c')];}}}};Fax[_0xca1e('0x1f')][_0xca1e('0x19')]=function(_0x524f0a){if(this[_0xca1e('0x11')][_0x524f0a[_0xca1e('0x26')]]){this[_0xca1e('0x11')][_0x524f0a[_0xca1e('0x26')]]['channelstate']=_0x524f0a['channelstate'];this[_0xca1e('0x11')][_0x524f0a[_0xca1e('0x26')]][_0xca1e('0x2d')]=_0x524f0a[_0xca1e('0x2d')];}};Fax['prototype'][_0xca1e('0x1a')]=function(_0x154d6b){if(this[_0xca1e('0x11')][_0x154d6b[_0xca1e('0x26')]]){for(var _0x70d03d in _0x154d6b[_0xca1e('0x2b')]){if(_0x154d6b['variable'][_0xca1e('0x23')](_0x70d03d)){this[_0xca1e('0x11')][_0x154d6b[_0xca1e('0x26')]][_0x70d03d]=_0x154d6b[_0xca1e('0x2c')];}}}};Fax[_0xca1e('0x1f')][_0xca1e('0x1b')]=function(_0x4180b0){if(this['channels'][_0x4180b0[_0xca1e('0x26')]]){this[_0xca1e('0x11')][_0x4180b0[_0xca1e('0x26')]]['operation']=_0x4180b0[_0xca1e('0x2e')];this[_0xca1e('0x11')][_0x4180b0[_0xca1e('0x26')]][_0xca1e('0x2f')]=_0x4180b0[_0xca1e('0x2f')];this['channels'][_0x4180b0[_0xca1e('0x26')]]['localstationid']=_0x4180b0[_0xca1e('0x25')];this[_0xca1e('0x11')][_0x4180b0[_0xca1e('0x26')]][_0xca1e('0x30')]=_0x4180b0[_0xca1e('0x30')];logger[_0xca1e('0x29')](_0x4180b0[_0xca1e('0x26')],_0xca1e('0x31'));}};Fax[_0xca1e('0x1f')][_0xca1e('0x32')]=function(_0xc7b372){var _0x51a1c6=this;if(this[_0xca1e('0x11')][_0xc7b372[_0xca1e('0x26')]]){var _0x37e5ca=this['channels'][_0xc7b372[_0xca1e('0x26')]]['id'];this[_0xca1e('0x11')][_0xc7b372[_0xca1e('0x26')]][_0xca1e('0x33')]=_0xc7b372[_0xca1e('0x33')];this[_0xca1e('0x11')][_0xc7b372[_0xca1e('0x26')]][_0xca1e('0x34')]=_0xc7b372[_0xca1e('0x34')];this[_0xca1e('0x11')][_0xc7b372[_0xca1e('0x26')]][_0xca1e('0x25')]=_0xc7b372['localstationid'];this['channels'][_0xc7b372[_0xca1e('0x26')]][_0xca1e('0x35')]=_0xc7b372['resolution'];this[_0xca1e('0x11')][_0xc7b372['uniqueid']]['transferrate']=_0xc7b372['transferrate'];this[_0xca1e('0x11')][_0xc7b372[_0xca1e('0x26')]][_0xca1e('0x30')]=_0xc7b372[_0xca1e('0x30')];this[_0xca1e('0x11')][_0xc7b372[_0xca1e('0x26')]][_0xca1e('0x36')]=_0xc7b372[_0xca1e('0x36')];if(this[_0xca1e('0x11')][_0xc7b372[_0xca1e('0x26')]][_0xca1e('0x34')]>0x0){tiff2pdf(_0xc7b372[_0xca1e('0x30')],_0xca1e('0x37'),function(_0x31ff76){logger[_0xca1e('0x29')](_0xc7b372[_0xca1e('0x26')],_0xca1e('0x38'),_0x31ff76[_0xca1e('0x39')]);attachment['create']({'name':path[_0xca1e('0x3a')](_0xc7b372[_0xca1e('0x30')])[_0xca1e('0x28')],'basename':path[_0xca1e('0x3a')](_0xc7b372[_0xca1e('0x30')])[_0xca1e('0x28')]+_0xca1e('0x3b'),'type':_0xca1e('0x3c')})[_0xca1e('0x3d')](function(_0x28a948){faxAccount[_0xca1e('0x3e')](_0x37e5ca,{'from':_0xc7b372['calleridnum'],'mapKey':_0xca1e('0x8'),'body':path[_0xca1e('0x3a')](_0xc7b372[_0xca1e('0x30')])[_0xca1e('0x28')]+_0xca1e('0x3b'),'AttachmentId':_0x28a948['id']})[_0xca1e('0x3f')](function(_0xf88168){logger['error'](_0xc7b372[_0xca1e('0x26')],_0xca1e('0x40'),JSON['stringify'](_0xf88168));});})['catch'](function(_0x96581c){logger[_0xca1e('0x41')](_0xc7b372['uniqueid'],_0xca1e('0x42'),JSON[_0xca1e('0x43')](_0x96581c));});});}logger[_0xca1e('0x29')](_0xc7b372[_0xca1e('0x26')],_0xca1e('0x42'));}};Fax['prototype'][_0xca1e('0x1e')]=function(_0x4feef2){if(this['actions'][_0x4feef2['uniqueid']]){_[_0xca1e('0x44')](this[_0xca1e('0x11')][_0x4feef2[_0xca1e('0x26')]],_[_0xca1e('0x45')](_0x4feef2,[_0xca1e('0x46'),'reason']));}};function updateStatus(_0x11af96){if(_0x11af96[_0xca1e('0x47')]){faxMessage[_0xca1e('0x48')](_0x11af96[_0xca1e('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xca1e('0x3d')](function(_0x1bf954){ut['logger']('[Fax][Message][Error][Updated]',_0x1bf954);})[_0xca1e('0x3f')](function(_0x47bee9){ut[_0xca1e('0x49')](_0xca1e('0x4a'),_0x47bee9);});}else{ut[_0xca1e('0x49')](_0xca1e('0x4b'));}}Fax[_0xca1e('0x1f')]['updateStatus']=function(_0x258234,_0x914d47,_0x167f19){var _0x1e7653=this;var _0x4d296c={};if(_0x914d47){_0x4d296c={'read':_0x914d47};}else{_0x4d296c={'failMessage':_0x167f19};}if(this[_0xca1e('0x14')][_0x258234][_0xca1e('0x47')]){faxMessage[_0xca1e('0x48')](this[_0xca1e('0x14')][_0x258234][_0xca1e('0x47')],_0x4d296c)['then'](function(_0xeb54bb){ut[_0xca1e('0x49')](_0xca1e('0x4c'),_0xeb54bb);})['catch'](function(_0x469e2a){ut[_0xca1e('0x49')](_0xca1e('0x4d'),_0x469e2a);})[_0xca1e('0x4e')](function(){delete _0x1e7653[_0xca1e('0x11')][_0x258234];delete _0x1e7653[_0xca1e('0x14')][_0x258234];});}else{ut[_0xca1e('0x49')](_0xca1e('0x4f'));delete this[_0xca1e('0x11')][_0x258234];delete this['actions'][_0x258234];}};Fax[_0xca1e('0x1f')][_0xca1e('0x50')]=function(_0x59c6b3){var _0x2a266c=this;if(this['channels'][_0x59c6b3[_0xca1e('0x26')]]){if(this[_0xca1e('0x14')][_0x59c6b3[_0xca1e('0x26')]]){this[_0xca1e('0x11')][_0x59c6b3[_0xca1e('0x26')]]['id']=this[_0xca1e('0x14')][_0x59c6b3[_0xca1e('0x26')]]['id'];this[_0xca1e('0x11')][_0x59c6b3[_0xca1e('0x26')]][_0xca1e('0x28')]=this[_0xca1e('0x14')][_0x59c6b3[_0xca1e('0x26')]][_0xca1e('0x28')];}logger['info'](_0x59c6b3[_0xca1e('0x26')],this[_0xca1e('0x14')][_0x59c6b3[_0xca1e('0x26')]]?_0xca1e('0x51'):_0xca1e('0x52'),JSON[_0xca1e('0x43')](this[_0xca1e('0x11')][_0x59c6b3['uniqueid']]));if(this[_0xca1e('0x14')][_0x59c6b3[_0xca1e('0x26')]]){if(this[_0xca1e('0x11')][_0x59c6b3[_0xca1e('0x26')]][_0xca1e('0x53')]>0x0&&this['channels'][_0x59c6b3[_0xca1e('0x26')]][_0xca1e('0x54')]===_0xca1e('0x55')){this[_0xca1e('0x56')](_0x59c6b3[_0xca1e('0x26')],!![]);}else{this[_0xca1e('0x56')](_0x59c6b3[_0xca1e('0x26')],![],this[_0xca1e('0x11')][_0x59c6b3['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x59c6b3[_0xca1e('0x26')]][_0xca1e('0x57')]:'SENDING\x20FAILED');}}}};Fax[_0xca1e('0x1f')][_0xca1e('0x58')]=function(_0x56f569){var _0x495254=this;return new BPromise(function(_0x48604f,_0x4e463a){_0x495254[_0xca1e('0x59')](_0x56f569,_0x495254[_0xca1e('0x12')][_0x56f569[_0xca1e('0x5a')]])[_0xca1e('0x3d')](function(_0xaa35df){ut[_0xca1e('0x49')](_0xca1e('0x5b'),_0xaa35df);_0x48604f(ut[_0xca1e('0x39')](_0xca1e('0x5c')));})[_0xca1e('0x3f')](function(_0x1b5d4a){ut[_0xca1e('0x49')](_0xca1e('0x5d'),_0x1b5d4a);updateStatus(_0x56f569);_0x4e463a(ut['message'](_0xca1e('0x5e')));});});};Fax['prototype']['checkAfterSend']=function(_0x317361){var _0x546cb0=this;return new BPromise(function(_0x376d81,_0xe1a91c){var _0x1c4f43=_0x546cb0['checkTrunk'](_0x546cb0[_0xca1e('0x12')][_0x317361[_0xca1e('0x5a')]][_0xca1e('0x5f')],_0x317361);if(_0x1c4f43[_0xca1e('0x60')]){_0x376d81(ut[_0xca1e('0x39')]('Trunk\x20Reachable'));}else{_0xe1a91c(ut[_0xca1e('0x39')](_0x1c4f43['message']));}});};function originate(_0x1bd4ed,_0x2f6224,_0x4fd4ec){return new BPromise(function(_0x1cc686,_0x177ef6){if(_0x4fd4ec){var _0x3db869=util[_0xca1e('0x61')](_0xca1e('0x62'),path[_0xca1e('0x3a')](_0x1bd4ed[_0xca1e('0x4')])['name'],_0x1bd4ed[_0xca1e('0x4')]);gs['execute'](_0x3db869)['then'](function(){_0x1bd4ed[_0xca1e('0x4')]=util[_0xca1e('0x61')](_0xca1e('0x63'),path[_0xca1e('0x3a')](_0x1bd4ed[_0xca1e('0x4')])[_0xca1e('0x64')],path[_0xca1e('0x3a')](_0x1bd4ed['path'])[_0xca1e('0x28')]);_0x2f6224[_0xca1e('0x65')]=_0x1bd4ed[_0xca1e('0x4')];ut[_0xca1e('0x49')](_0xca1e('0x66'),'');ami['Action'](ut[_0xca1e('0x67')](_0x1bd4ed,_0x2f6224))[_0xca1e('0x3d')](function(_0x2d5b34){_0x1cc686(_0x2d5b34);})['catch'](function(_0x1768d9){_0x177ef6(_0x1768d9);});})['catch'](function(_0x334685){_0x177ef6(_0x334685);});}else{ami['Action'](ut[_0xca1e('0x67')](_0x1bd4ed,_0x2f6224))[_0xca1e('0x3d')](function(_0x23fbc4){_0x1cc686(_0x23fbc4);})[_0xca1e('0x3f')](function(_0xb5f785){_0x177ef6(_0xb5f785);});}});}Fax[_0xca1e('0x1f')][_0xca1e('0x59')]=function(_0x892d75,_0x870cf6){var _0x132bdb=this;return new BPromise(function(_0x173c84,_0x4f3c97){var _0xa9aa5a=uuid['v4']();var _0x56cb41=ut[_0xca1e('0x68')](_0x892d75,_0x870cf6);_0x132bdb['actions'][_0xa9aa5a]=new Action(_0xa9aa5a,_0x870cf6,_0x892d75);var _0x2a6333=_0x132bdb[_0xca1e('0x14')][_0xa9aa5a];if(path[_0xca1e('0x3a')](_0x892d75[_0xca1e('0x4')])[_0xca1e('0x69')]==='.pdf'){originate(_0x2a6333,_0x56cb41,!![])[_0xca1e('0x3d')](function(_0x1a73d6){_0x173c84(_0x1a73d6);})[_0xca1e('0x3f')](function(_0x1d9d5f){_0x4f3c97(_0x1d9d5f);});}else{originate(_0x2a6333,_0x56cb41,![])[_0xca1e('0x3d')](function(_0x4564a7){_0x173c84(_0x4564a7);})['catch'](function(_0x12ac29){_0x4f3c97(_0x12ac29);});}});};Fax[_0xca1e('0x1f')][_0xca1e('0x6a')]=function(_0x220a00){return!_[_0xca1e('0x6b')](_0x220a00)&&!_[_0xca1e('0x6b')](_0x220a00[_0xca1e('0x28')])&&!_[_0xca1e('0x6b')](_0x220a00[_0xca1e('0x6c')])&&_0x220a00[_0xca1e('0x6c')]&&!_[_0xca1e('0x6b')](this[_0xca1e('0x13')][util[_0xca1e('0x61')]('SIP/%s',_0x220a00['name'])])&&!_[_0xca1e('0x6b')](this[_0xca1e('0x13')][util[_0xca1e('0x61')](_0xca1e('0x6d'),_0x220a00[_0xca1e('0x28')])]['status'])&&(this[_0xca1e('0x13')][util[_0xca1e('0x61')](_0xca1e('0x6d'),_0x220a00[_0xca1e('0x28')])][_0xca1e('0x2f')]===_0xca1e('0x6e')||this[_0xca1e('0x13')][util[_0xca1e('0x61')](_0xca1e('0x6d'),_0x220a00[_0xca1e('0x28')])][_0xca1e('0x2f')]==='unmonitored');};Fax[_0xca1e('0x1f')][_0xca1e('0x6f')]=function(_0xaffebd,_0x5b89f6){if(!this[_0xca1e('0x6a')](_0xaffebd)){ut['logger'](_0xca1e('0x70'),_[_0xca1e('0x6b')](_0xaffebd)?'':_0xaffebd[_0xca1e('0x28')]+_0xca1e('0x71'));return{'isValid':![],'message':_0xca1e('0x72')};}if(_[_0xca1e('0x6b')](_0x5b89f6[_0xca1e('0x8')])){ut[_0xca1e('0x49')](_0xca1e('0x73'),JSON[_0xca1e('0x43')](_0x5b89f6));return{'isValid':![],'message':_0xca1e('0x74')};}if(_[_0xca1e('0x6b')](_0x5b89f6[_0xca1e('0x4')])){ut[_0xca1e('0x49')](_0xca1e('0x75'),JSON[_0xca1e('0x43')](_0x5b89f6));return{'isValid':![],'message':_0xca1e('0x76')};}return{'isValid':!![],'message':_0xca1e('0x77')};};module[_0xca1e('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8c7217e..159ab9e 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 _0x77ba=['../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','preview','lodash'];(function(_0x98f43,_0x36258c){var _0x39e1fa=function(_0x204e2a){while(--_0x204e2a){_0x98f43['push'](_0x98f43['shift']());}};_0x39e1fa(++_0x36258c);}(_0x77ba,0x19e));var _0xa77b=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x77ba[_0x104a84];return _0x4973ff;};'use strict';var util=require(_0xa77b('0x0'));var BPromise=require(_0xa77b('0x1'));var logger=require('../../../config/logger')(_0xa77b('0x2'));var _=require(_0xa77b('0x3'));var faxAccount=require(_0xa77b('0x4'));function loggerCatch(_0x536349){return function(_0x4b0f06){logger[_0xa77b('0x5')](_0x536349,util['inspect'](_0x4b0f06,{'showHidden':![],'depth':null}));};}exports[_0xa77b('0x6')]=function(_0x526070,_0x383faf){return BPromise[_0xa77b('0x7')]()[_0xa77b('0x8')](faxAccount[_0xa77b('0x6')](_0x526070,_0x383faf))[_0xa77b('0x9')](loggerCatch(_0xa77b('0xa')));}; \ No newline at end of file +var _0xa046=['preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','util','bluebird','../../../config/logger'];(function(_0x49efce,_0x505e3f){var _0x469004=function(_0x4ccaa5){while(--_0x4ccaa5){_0x49efce['push'](_0x49efce['shift']());}};_0x469004(++_0x505e3f);}(_0xa046,0x1e1));var _0x6a04=function(_0xdae419,_0x3e8091){_0xdae419=_0xdae419-0x0;var _0x1b9075=_0xa046[_0xdae419];return _0x1b9075;};'use strict';var util=require(_0x6a04('0x0'));var BPromise=require(_0x6a04('0x1'));var logger=require(_0x6a04('0x2'))(_0x6a04('0x3'));var _=require(_0x6a04('0x4'));var faxAccount=require(_0x6a04('0x5'));function loggerCatch(_0x5133c5){return function(_0xf62dbc){logger[_0x6a04('0x6')](_0x5133c5,util[_0x6a04('0x7')](_0xf62dbc,{'showHidden':![],'depth':null}));};}exports[_0x6a04('0x8')]=function(_0x1c64f6,_0x4cdf2f){return BPromise[_0x6a04('0x9')]()[_0x6a04('0xa')](faxAccount[_0x6a04('0x8')](_0x1c64f6,_0x4cdf2f))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index dc309a2..143dcd9 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 _0xbf4f=['util','bluebird','info','inspect'];(function(_0x49392e,_0x441b28){var _0xe978bb=function(_0x4404d1){while(--_0x4404d1){_0x49392e['push'](_0x49392e['shift']());}};_0xe978bb(++_0x441b28);}(_0xbf4f,0xa0));var _0xfbf4=function(_0x4de5bc,_0x50fa9f){_0x4de5bc=_0x4de5bc-0x0;var _0x1d498c=_0xbf4f[_0x4de5bc];return _0x1d498c;};'use strict';var util=require(_0xfbf4('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xfbf4('0x1'));var exec=require('child_process')['exec'];exports['execute']=function(_0x405f57){return new BPromise(function(_0x366531,_0x356761){exec(_0x405f57,function(_0x3ed720,_0x6654a8,_0x292181){logger[_0xfbf4('0x2')]('Exec\x20gs',_0x6654a8);if(_0x3ed720){logger[_0xfbf4('0x2')]('Exec\x20gs','\x20Error\x20:',util[_0xfbf4('0x3')](_0x3ed720,{'showHidden':![],'depth':null}),_0x6654a8,_0x292181);_0x356761(_0x3ed720);}_0x366531(_0x6654a8);});});}; \ No newline at end of file +var _0xa639=['bluebird','exec','execute','info','Exec\x20gs'];(function(_0x355c28,_0x16ea44){var _0x3ba208=function(_0x2fc803){while(--_0x2fc803){_0x355c28['push'](_0x355c28['shift']());}};_0x3ba208(++_0x16ea44);}(_0xa639,0x91));var _0x9a63=function(_0x15f06b,_0x50a644){_0x15f06b=_0x15f06b-0x0;var _0x30dbe8=_0xa639[_0x15f06b];return _0x30dbe8;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x9a63('0x0'));var exec=require('child_process')[_0x9a63('0x1')];exports[_0x9a63('0x2')]=function(_0x9b7356){return new BPromise(function(_0x459c5c,_0x15204a){exec(_0x9b7356,function(_0x3a5ea1,_0x484fbe,_0x5d48fc){logger[_0x9a63('0x3')]('Exec\x20gs',_0x484fbe);if(_0x3a5ea1){logger[_0x9a63('0x3')](_0x9a63('0x4'),'\x20Error\x20:',util['inspect'](_0x3a5ea1,{'showHidden':![],'depth':null}),_0x484fbe,_0x5d48fc);_0x15204a(_0x3a5ea1);}_0x459c5c(_0x484fbe);});});}; \ 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 ae0e9ee..cf39f57 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 _0x3dc8=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','fax','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','t38timeout'];(function(_0x3b5ae0,_0xd04a45){var _0x24da45=function(_0x14c2cb){while(--_0x14c2cb){_0x3b5ae0['push'](_0x3b5ae0['shift']());}};_0x24da45(++_0xd04a45);}(_0x3dc8,0x82));var _0x83dc=function(_0x5463e6,_0x21bf14){_0x5463e6=_0x5463e6-0x0;var _0x2a6827=_0x3dc8[_0x5463e6];return _0x2a6827;};'use strict';var util=require(_0x83dc('0x0'));var _=require('lodash');var moment=require(_0x83dc('0x1'));var logger=require(_0x83dc('0x2'))(_0x83dc('0x3'));exports['message']=function(_0x1a9fd9){return{'message':_0x1a9fd9};};exports['logger']=function(_0x3f30dd,_0x1de141){logger[_0x83dc('0x4')](_0x3f30dd,util[_0x83dc('0x5')](_0x1de141,{'showHidden':![],'depth':null}));};exports[_0x83dc('0x6')]=function(_0x430ee7,_0x34780c){var _0x1354ec={'XMF-ECM':_0x34780c[_0x83dc('0x7')],'XMF-HEADERINFO':_0x34780c['headerinfo'],'XMF-MINRATE':_0x34780c[_0x83dc('0x8')],'XMF-MAXRATE':_0x34780c[_0x83dc('0x9')],'XMF-MODEM':util[_0x83dc('0xa')](_0x83dc('0xb'),_0x34780c[_0x83dc('0xc')]),'XMF-GATEWAY':_0x34780c['gateway'],'XMF-FAXDETECT':_0x34780c['faxdetect'],'XMF-T38TIMEOUT':_0x34780c[_0x83dc('0xd')],'XMF-LOCALSTATIONID':_0x34780c[_0x83dc('0xe')],'XMF-PATH':_0x430ee7[_0x83dc('0xf')]};return _0x1354ec;};exports[_0x83dc('0x10')]=function(_0x1385c0,_0xd3d811){return{'actionid':_0x1385c0[_0x83dc('0x11')],'action':_0x83dc('0x12'),'channel':_0x1385c0[_0x83dc('0x13')],'Exten':_0x83dc('0x14'),'Context':_0x83dc('0x15'),'Priority':'1','callerid':util['format'](_0x83dc('0x16'),_0x1385c0[_0x83dc('0x17')]?_0x1385c0[_0x83dc('0x17')]:'',_0x1385c0[_0x83dc('0xe')]),'variable':_0xd3d811,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1385c0['uniqueid']};}; \ No newline at end of file +var _0x9649=['t38timeout','localstationid','path','uniqueid','originate','channel','format','\x22%s\x22\x20<%s>','lodash','moment','fax','logger','info','inspect','ecm','headerinfo','minrate','modem','gateway','faxdetect'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x9649,0x1d4));var _0x9964=function(_0x2fcbbd,_0x45fa9b){_0x2fcbbd=_0x2fcbbd-0x0;var _0x32b51f=_0x9649[_0x2fcbbd];return _0x32b51f;};'use strict';var util=require('util');var _=require(_0x9964('0x0'));var moment=require(_0x9964('0x1'));var logger=require('../../../../config/logger')(_0x9964('0x2'));exports['message']=function(_0x382877){return{'message':_0x382877};};exports[_0x9964('0x3')]=function(_0x1e4457,_0x5264b4){logger[_0x9964('0x4')](_0x1e4457,util[_0x9964('0x5')](_0x5264b4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1d75d7,_0x275b00){var _0x1987f0={'XMF-ECM':_0x275b00[_0x9964('0x6')],'XMF-HEADERINFO':_0x275b00[_0x9964('0x7')],'XMF-MINRATE':_0x275b00[_0x9964('0x8')],'XMF-MAXRATE':_0x275b00['maxrate'],'XMF-MODEM':util['format']('\x22%s\x22',_0x275b00[_0x9964('0x9')]),'XMF-GATEWAY':_0x275b00[_0x9964('0xa')],'XMF-FAXDETECT':_0x275b00[_0x9964('0xb')],'XMF-T38TIMEOUT':_0x275b00[_0x9964('0xc')],'XMF-LOCALSTATIONID':_0x275b00[_0x9964('0xd')],'XMF-PATH':_0x1d75d7[_0x9964('0xe')]};return _0x1987f0;};exports['variablesAction']=function(_0x4ed6f2,_0x330835){return{'actionid':_0x4ed6f2[_0x9964('0xf')],'action':_0x9964('0x10'),'channel':_0x4ed6f2[_0x9964('0x11')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x9964('0x12')](_0x9964('0x13'),_0x4ed6f2[_0x9964('0x7')]?_0x4ed6f2[_0x9964('0x7')]:'',_0x4ed6f2['localstationid']),'variable':_0x330835,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4ed6f2['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0b954d4..477903b 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 _0x8887=['./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','sync','catch','util','moment','./server','./realtime','./report','./acw','./dialer','./preview'];(function(_0x2ee570,_0x19a04d){var _0x173c06=function(_0x5d33ee){while(--_0x5d33ee){_0x2ee570['push'](_0x2ee570['shift']());}};_0x173c06(++_0x19a04d);}(_0x8887,0x15b));var _0x7888=function(_0x2aaead,_0x2438c6){_0x2aaead=_0x2aaead-0x0;var _0x5bcc3c=_0x8887[_0x2aaead];return _0x5bcc3c;};'use strict';var util=require(_0x7888('0x0'));var moment=require(_0x7888('0x1'));var server=require(_0x7888('0x2'));var Realtime=require(_0x7888('0x3'));var Report=require(_0x7888('0x4'));var Acw=require(_0x7888('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x7888('0x6'));var Preview=require(_0x7888('0x7'));var Fax=require(_0x7888('0x8'));var user=require(_0x7888('0x9'));var voiceQueue=require(_0x7888('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x7888('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x7888('0xc'));var template=require(_0x7888('0xd'));var cmHopperHistory=require(_0x7888('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x7888('0xf'));var faxAccount=require(_0x7888('0x10'));var zendesk=require(_0x7888('0x11'));var salesforce=require(_0x7888('0x12'));var sugarcrm=require(_0x7888('0x13'));var freshdesk=require(_0x7888('0x14'));var desk=require(_0x7888('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7888('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x7888('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7888('0x18')](_0x7888('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7888('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7888('0x1a')]()[_0x7888('0x1b')](user[_0x7888('0x1c')]())[_0x7888('0x1b')](realtime[_0x7888('0x1d')]())['then'](user[_0x7888('0x1e')]())[_0x7888('0x1b')](realtime[_0x7888('0x1f')]())[_0x7888('0x1b')](trunk[_0x7888('0x20')]())['then'](realtime[_0x7888('0x21')]())[_0x7888('0x1b')](voiceQueue[_0x7888('0x22')]())['then'](realtime[_0x7888('0x23')]())[_0x7888('0x1b')](trigger['getTriggers']())[_0x7888('0x1b')](realtime[_0x7888('0x24')]())['then'](template[_0x7888('0x25')]())[_0x7888('0x1b')](realtime[_0x7888('0x26')]())[_0x7888('0x1b')](zendesk['getZendeskAccounts']())['then'](realtime[_0x7888('0x27')]())['then'](salesforce[_0x7888('0x28')]())[_0x7888('0x1b')](realtime[_0x7888('0x29')]())[_0x7888('0x1b')](sugarcrm[_0x7888('0x2a')]())[_0x7888('0x1b')](realtime[_0x7888('0x2b')]())[_0x7888('0x1b')](freshdesk[_0x7888('0x2c')]())[_0x7888('0x1b')](realtime[_0x7888('0x2d')]())[_0x7888('0x1b')](desk['getDeskAccounts']())[_0x7888('0x1b')](realtime[_0x7888('0x2e')]())[_0x7888('0x1b')](zoho[_0x7888('0x2f')]())['then'](realtime[_0x7888('0x30')]())[_0x7888('0x1b')](vtiger[_0x7888('0x31')]())[_0x7888('0x1b')](realtime[_0x7888('0x32')]())[_0x7888('0x1b')](freshsales[_0x7888('0x33')]())[_0x7888('0x1b')](realtime[_0x7888('0x34')]())[_0x7888('0x1b')](servicenow['getServicenowAccounts']())[_0x7888('0x1b')](realtime['initServicenowAccounts']())[_0x7888('0x1b')](dynamics365[_0x7888('0x35')]())[_0x7888('0x1b')](realtime[_0x7888('0x36')]())[_0x7888('0x1b')](campaign[_0x7888('0x37')]())['then'](realtime[_0x7888('0x38')]())[_0x7888('0x1b')](voiceExtension[_0x7888('0x39')]())[_0x7888('0x1b')](realtime[_0x7888('0x3a')]())['then'](faxAccount['getFaxAccounts']())[_0x7888('0x1b')](realtime[_0x7888('0x3b')]())[_0x7888('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x7888('0x1a')]()[_0x7888('0x1b')](voiceQueueReport[_0x7888('0x3c')]())[_0x7888('0x1b')](realtime[_0x7888('0x3d')]())[_0x7888('0x1b')](cmHopperHistory[_0x7888('0x3e')]())[_0x7888('0x1b')](realtime[_0x7888('0x3f')]())['then'](cmHopperHistory[_0x7888('0x40')]())[_0x7888('0x1b')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x7888('0x41')]())[_0x7888('0x1b')](realtime[_0x7888('0x42')]())['catch'](function(_0x2018bc){logger[_0x7888('0x43')](_0x7888('0x44'),util['inspect'](_0x2018bc,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x7888('0x1b')](function(){return initRealtime();})[_0x7888('0x1b')](function(){return initParams();})[_0x7888('0x1b')](function(){report[_0x7888('0x45')]();setInterval(initRealtime,0x1388);})[_0x7888('0x46')](function(_0x1c5a83){logger['error']('[index.js][main]',util['inspect'](_0x1c5a83,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x1924=['getZohoAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceCallReports','catch','error','inspect','sync','[index.js][main]','util','moment','./server','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts'];(function(_0x463183,_0x56bd4e){var _0xd5fe56=function(_0x55cb29){while(--_0x55cb29){_0x463183['push'](_0x463183['shift']());}};_0xd5fe56(++_0x56bd4e);}(_0x1924,0x126));var _0x4192=function(_0x4f71cb,_0x39d98e){_0x4f71cb=_0x4f71cb-0x0;var _0x3f9435=_0x1924[_0x4f71cb];return _0x3f9435;};'use strict';var util=require(_0x4192('0x0'));var moment=require(_0x4192('0x1'));var server=require(_0x4192('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x4192('0x3'));var Dialer=require(_0x4192('0x4'));var Preview=require(_0x4192('0x5'));var Fax=require(_0x4192('0x6'));var user=require(_0x4192('0x7'));var voiceQueue=require(_0x4192('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4192('0x9'));var trunk=require(_0x4192('0xa'));var trigger=require(_0x4192('0xb'));var template=require(_0x4192('0xc'));var cmHopperHistory=require(_0x4192('0xd'));var campaign=require(_0x4192('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x4192('0xf'));var zendesk=require(_0x4192('0x10'));var salesforce=require(_0x4192('0x11'));var sugarcrm=require(_0x4192('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x4192('0x13'));var servicenow=require(_0x4192('0x14'));var dynamics365=require(_0x4192('0x15'));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(_0x4192('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4192('0x17')](_0x4192('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4192('0x17')](_0x4192('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4192('0x19')]()[_0x4192('0x1a')](user[_0x4192('0x1b')]())['then'](realtime[_0x4192('0x1c')]())[_0x4192('0x1a')](user[_0x4192('0x1d')]())['then'](realtime[_0x4192('0x1e')]())[_0x4192('0x1a')](trunk[_0x4192('0x1f')]())[_0x4192('0x1a')](realtime[_0x4192('0x20')]())['then'](voiceQueue['getVoiceQueues']())[_0x4192('0x1a')](realtime[_0x4192('0x21')]())[_0x4192('0x1a')](trigger[_0x4192('0x22')]())['then'](realtime[_0x4192('0x23')]())[_0x4192('0x1a')](template[_0x4192('0x24')]())[_0x4192('0x1a')](realtime[_0x4192('0x25')]())[_0x4192('0x1a')](zendesk['getZendeskAccounts']())[_0x4192('0x1a')](realtime[_0x4192('0x26')]())[_0x4192('0x1a')](salesforce[_0x4192('0x27')]())['then'](realtime[_0x4192('0x28')]())[_0x4192('0x1a')](sugarcrm[_0x4192('0x29')]())[_0x4192('0x1a')](realtime[_0x4192('0x2a')]())[_0x4192('0x1a')](freshdesk[_0x4192('0x2b')]())[_0x4192('0x1a')](realtime['initFreshdeskAccounts']())[_0x4192('0x1a')](desk[_0x4192('0x2c')]())[_0x4192('0x1a')](realtime[_0x4192('0x2d')]())[_0x4192('0x1a')](zoho[_0x4192('0x2e')]())['then'](realtime[_0x4192('0x2f')]())[_0x4192('0x1a')](vtiger[_0x4192('0x30')]())[_0x4192('0x1a')](realtime['initVtigerAccounts']())[_0x4192('0x1a')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x4192('0x31')]())[_0x4192('0x1a')](servicenow[_0x4192('0x32')]())[_0x4192('0x1a')](realtime[_0x4192('0x33')]())[_0x4192('0x1a')](dynamics365[_0x4192('0x34')]())['then'](realtime[_0x4192('0x35')]())['then'](campaign[_0x4192('0x36')]())[_0x4192('0x1a')](realtime[_0x4192('0x37')]())[_0x4192('0x1a')](voiceExtension[_0x4192('0x38')]())['then'](realtime['initVoiceExtensions']())[_0x4192('0x1a')](faxAccount[_0x4192('0x39')]())['then'](realtime[_0x4192('0x3a')]())[_0x4192('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x4192('0x19')]()[_0x4192('0x1a')](voiceQueueReport[_0x4192('0x3b')]())[_0x4192('0x1a')](realtime[_0x4192('0x3c')]())[_0x4192('0x1a')](cmHopperHistory[_0x4192('0x3d')]())[_0x4192('0x1a')](realtime['initVoiceQueueHopperHistory']())[_0x4192('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x4192('0x1a')](realtime['initCampaignHopperHistory']())[_0x4192('0x1a')](voiceCallReport['getVoiceCallReports']())[_0x4192('0x1a')](realtime[_0x4192('0x3e')]())[_0x4192('0x3f')](function(_0x178836){logger[_0x4192('0x40')]('[index.js][initParams]',util[_0x4192('0x41')](_0x178836,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x4192('0x1a')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x4192('0x1a')](function(){report[_0x4192('0x42')]();setInterval(initRealtime,0x1388);})[_0x4192('0x3f')](function(_0x2d3803){logger[_0x4192('0x40')](_0x4192('0x43'),util['inspect'](_0x2d3803,{'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 2fb1d06..f7b7591 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 _0x4c6c=['talking','voiceStatus','statePause','toNumber','format','stateTime','address','voiceStatusQueue','stringify','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','localhost','redis','name','email','accountcode','fullname','state','status','unknown','phone','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','updateStatusRealtime','toLowerCase','idle','inuse'];(function(_0x3f4568,_0x9eb0ee){var _0xee2340=function(_0xdefabb){while(--_0xdefabb){_0x3f4568['push'](_0x3f4568['shift']());}};_0xee2340(++_0x9eb0ee);}(_0x4c6c,0xb7));var _0xc4c6=function(_0x3b2216,_0x806bce){_0x3b2216=_0x3b2216-0x0;var _0x3c15dc=_0x4c6c[_0x3b2216];return _0x3c15dc;};'use strict';var _=require(_0xc4c6('0x0'));var util=require(_0xc4c6('0x1'));var moment=require(_0xc4c6('0x2'));var md5=require(_0xc4c6('0x3'));var Redis=require(_0xc4c6('0x4'));var config=require(_0xc4c6('0x5'));config['redis']=_[_0xc4c6('0x6')](config['redis'],{'host':_0xc4c6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc4c6('0x8')]));function Agent(_0x3744a8){this['id']=_0x3744a8['id']||0x0;this['name']=_0x3744a8[_0xc4c6('0x9')]||'';this['email']=_0x3744a8[_0xc4c6('0xa')]||'';this[_0xc4c6('0xb')]=_0x3744a8[_0xc4c6('0xb')]||'';this[_0xc4c6('0xc')]=_0x3744a8['fullname']||'';this[_0xc4c6('0xd')]='unknown';this['stateTime']=0x0;this[_0xc4c6('0xe')]=_0xc4c6('0xf');this['address']='';this[_0xc4c6('0x10')]='';this['mobile']='';this[_0xc4c6('0x11')]='';this['online']=_0x3744a8[_0xc4c6('0x12')]||![];this['voiceStatus']='unknown';this[_0xc4c6('0x13')]=0x0;this[_0xc4c6('0x14')]='';this['voiceStatusQueue']='';this[_0xc4c6('0x15')]=![];this[_0xc4c6('0x16')]=![];this[_0xc4c6('0x3')]='';}Agent['prototype'][_0xc4c6('0x17')]=function(_0x545a00){var _0x4192a4;if(_0x545a00&&_0x545a00[_0xc4c6('0xd')]){_0x4192a4=_0x545a00[_0xc4c6('0xd')][_0xc4c6('0x18')]();switch(_0x4192a4){case'not_inuse':_0x4192a4=_0xc4c6('0x19');break;case _0xc4c6('0x1a'):_0x4192a4=_0xc4c6('0x1b');break;}}if(_0x4192a4&&this[_0xc4c6('0x1c')]!==_0x4192a4||_0x545a00[_0xc4c6('0x1d')]){this['voiceStatusTime']=_[_0xc4c6('0x1e')](moment()[_0xc4c6('0x1f')]('x'));}if(_0x4192a4){this[_0xc4c6('0x1c')]=_0x4192a4;}var _0x3f91cd={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0xc4c6('0xb')],'fullname':this[_0xc4c6('0xc')],'state':this[_0xc4c6('0xd')],'stateTime':this[_0xc4c6('0x20')],'status':this['status'],'address':this[_0xc4c6('0x21')],'online':this['online'],'voiceStatus':this[_0xc4c6('0x1c')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xc4c6('0x14')],'voiceStatusQueue':this[_0xc4c6('0x22')],'interface':this[_0xc4c6('0x11')],'onhold':this[_0xc4c6('0x15')]};var _0x2f3d6e=md5(JSON[_0xc4c6('0x23')](_0x3f91cd));if(this[_0xc4c6('0x3')]!==_0x2f3d6e){this[_0xc4c6('0x3')]=_0x2f3d6e;io['to'](util[_0xc4c6('0x1f')](_0xc4c6('0x24'),_0x3f91cd[_0xc4c6('0x9')]))[_0xc4c6('0x25')](_0xc4c6('0x26'),_[_0xc4c6('0x27')](_0x3f91cd,['online']));io[_0xc4c6('0x25')](_0xc4c6('0x28'),_0x3f91cd);}};module[_0xc4c6('0x29')]=Agent; \ No newline at end of file +var _0xbfaf=['ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking','format','stateTime','status','voiceStatusCallerIdNumber','interface','stringify','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','moment'];(function(_0x118922,_0x2a1c1d){var _0x5eaab1=function(_0x47a76d){while(--_0x47a76d){_0x118922['push'](_0x118922['shift']());}};_0x5eaab1(++_0x2a1c1d);}(_0xbfaf,0xcb));var _0xfbfa=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xbfaf[_0x4c7d8b];return _0x187158;};'use strict';var _=require(_0xfbfa('0x0'));var util=require('util');var moment=require(_0xfbfa('0x1'));var md5=require('md5');var Redis=require(_0xfbfa('0x2'));var config=require(_0xfbfa('0x3'));config['redis']=_[_0xfbfa('0x4')](config[_0xfbfa('0x5')],{'host':_0xfbfa('0x6'),'port':0x18eb});var io=require(_0xfbfa('0x7'))(new Redis(config[_0xfbfa('0x5')]));function Agent(_0x149875){this['id']=_0x149875['id']||0x0;this[_0xfbfa('0x8')]=_0x149875[_0xfbfa('0x8')]||'';this[_0xfbfa('0x9')]=_0x149875['email']||'';this[_0xfbfa('0xa')]=_0x149875['accountcode']||'';this[_0xfbfa('0xb')]=_0x149875['fullname']||'';this['state']='unknown';this['stateTime']=0x0;this['status']=_0xfbfa('0xc');this['address']='';this[_0xfbfa('0xd')]='';this[_0xfbfa('0xe')]='';this['interface']='';this[_0xfbfa('0xf')]=_0x149875[_0xfbfa('0xf')]||![];this[_0xfbfa('0x10')]=_0xfbfa('0xc');this[_0xfbfa('0x11')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xfbfa('0x12')]='';this[_0xfbfa('0x13')]=![];this[_0xfbfa('0x14')]=![];this[_0xfbfa('0x15')]='';}Agent[_0xfbfa('0x16')][_0xfbfa('0x17')]=function(_0x10b425){var _0x21b98f;if(_0x10b425&&_0x10b425[_0xfbfa('0x18')]){_0x21b98f=_0x10b425[_0xfbfa('0x18')][_0xfbfa('0x19')]();switch(_0x21b98f){case _0xfbfa('0x1a'):_0x21b98f='idle';break;case _0xfbfa('0x1b'):_0x21b98f=_0xfbfa('0x1c');break;}}if(_0x21b98f&&this[_0xfbfa('0x10')]!==_0x21b98f||_0x10b425['statePause']){this[_0xfbfa('0x11')]=_['toNumber'](moment()[_0xfbfa('0x1d')]('x'));}if(_0x21b98f){this[_0xfbfa('0x10')]=_0x21b98f;}var _0x1d8601={'id':this['id'],'name':this['name'],'email':this[_0xfbfa('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xfbfa('0xb')],'state':this[_0xfbfa('0x18')],'stateTime':this[_0xfbfa('0x1e')],'status':this[_0xfbfa('0x1f')],'address':this['address'],'online':this[_0xfbfa('0xf')],'voiceStatus':this[_0xfbfa('0x10')],'voiceStatusTime':this[_0xfbfa('0x11')],'voiceStatusCallerIdNumber':this[_0xfbfa('0x20')],'voiceStatusQueue':this[_0xfbfa('0x12')],'interface':this[_0xfbfa('0x21')],'onhold':this[_0xfbfa('0x13')]};var _0xa9df6b=md5(JSON[_0xfbfa('0x22')](_0x1d8601));if(this[_0xfbfa('0x15')]!==_0xa9df6b){this[_0xfbfa('0x15')]=_0xa9df6b;io['to'](util[_0xfbfa('0x1d')](_0xfbfa('0x23'),_0x1d8601[_0xfbfa('0x8')]))[_0xfbfa('0x24')](_0xfbfa('0x25'),_[_0xfbfa('0x26')](_0x1d8601,['online']));io[_0xfbfa('0x24')](_0xfbfa('0x27'),_0x1d8601);}};module[_0xfbfa('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5aee20a..944c25e 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 _0x4a9b=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x2cb8b9,_0x19cd8f){var _0x37bb76=function(_0x463433){while(--_0x463433){_0x2cb8b9['push'](_0x2cb8b9['shift']());}};_0x37bb76(++_0x19cd8f);}(_0x4a9b,0x7c));var _0xb4a9=function(_0x2307d3,_0x3743ed){_0x2307d3=_0x2307d3-0x0;var _0x5828df=_0x4a9b[_0x2307d3];return _0x5828df;};'use strict';function Campaign(_0x1076ca){this['id']=_0x1076ca['id']||0x0;this[_0xb4a9('0x0')]=_0x1076ca[_0xb4a9('0x0')]||'';this[_0xb4a9('0x1')]=_0x1076ca[_0xb4a9('0x1')]||_0xb4a9('0x2');this[_0xb4a9('0x3')]=0x0;this[_0xb4a9('0x4')]=0x0;this[_0xb4a9('0x5')]=0x0;this[_0xb4a9('0x6')]=0x0;this[_0xb4a9('0x7')]='';this[_0xb4a9('0x8')]=!![];this[_0xb4a9('0x9')]=_0x1076ca[_0xb4a9('0x9')];this[_0xb4a9('0xa')]=_0x1076ca[_0xb4a9('0xa')];this[_0xb4a9('0xb')]=_0x1076ca['dialTimezone']||null;this[_0xb4a9('0xc')]=_0x1076ca[_0xb4a9('0xc')]?_0x1076ca[_0xb4a9('0xc')]:null;this[_0xb4a9('0xd')]=_0x1076ca['dialOriginateCallerIdName'];this[_0xb4a9('0xe')]=_0x1076ca[_0xb4a9('0xe')];this['dialOriginateTimeout']=_0x1076ca[_0xb4a9('0xf')]||0x1e;this[_0xb4a9('0x10')]=_0x1076ca['dialCongestionMaxRetry'];this[_0xb4a9('0x11')]=_0x1076ca[_0xb4a9('0x11')];this[_0xb4a9('0x12')]=_0x1076ca['dialBusyMaxRetry'];this[_0xb4a9('0x13')]=_0x1076ca[_0xb4a9('0x13')];this[_0xb4a9('0x14')]=_0x1076ca['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x1076ca[_0xb4a9('0x15')];this['dialGlobalMaxRetry']=_0x1076ca['dialGlobalMaxRetry'];this[_0xb4a9('0x16')]=_0x1076ca[_0xb4a9('0x16')]||0x3;this[_0xb4a9('0x17')]=_0x1076ca['dialNoSuchNumberRetryFrequency']||0x96;this[_0xb4a9('0x18')]=_0x1076ca['dialDropMaxRetry']||0x3;this[_0xb4a9('0x19')]=_0x1076ca['dialDropRetryFrequency']||0x96;this[_0xb4a9('0x1a')]=_0x1076ca[_0xb4a9('0x1a')]||0x3;this[_0xb4a9('0x1b')]=_0x1076ca[_0xb4a9('0x1b')]||0x96;this[_0xb4a9('0x1c')]=_0x1076ca[_0xb4a9('0x1c')]||0x3;this[_0xb4a9('0x1d')]=_0x1076ca[_0xb4a9('0x1d')]||0x96;this[_0xb4a9('0x1e')]=_0x1076ca[_0xb4a9('0x1e')]||0x3;this[_0xb4a9('0x1f')]=_0x1076ca[_0xb4a9('0x1f')]||0x96;this[_0xb4a9('0x20')]=_0x1076ca[_0xb4a9('0x20')]||_0xb4a9('0x21');this[_0xb4a9('0x22')]=_0x1076ca[_0xb4a9('0x22')]||undefined;this[_0xb4a9('0x23')]=_0x1076ca[_0xb4a9('0x23')]||undefined;this[_0xb4a9('0x24')]=_0x1076ca[_0xb4a9('0x24')]||undefined;this['TrunkBackup']=_0x1076ca['TrunkBackup']?_0x1076ca['TrunkBackup']:undefined;this[_0xb4a9('0x25')]=_0x1076ca[_0xb4a9('0x25')]?_0x1076ca[_0xb4a9('0x25')]:undefined;this[_0xb4a9('0x26')]=_0x1076ca[_0xb4a9('0x26')]?_0x1076ca[_0xb4a9('0x26')]:undefined;this['SquareProject']=_0x1076ca['SquareProject']?_0x1076ca[_0xb4a9('0x27')]:undefined;this[_0xb4a9('0x28')]=_0x1076ca[_0xb4a9('0x27')]?_0x1076ca[_0xb4a9('0x27')]['name']:undefined;this[_0xb4a9('0x29')]=_0x1076ca[_0xb4a9('0x29')]||![];this[_0xb4a9('0x2a')]=_0x1076ca[_0xb4a9('0x2a')];this[_0xb4a9('0x2b')]=_0x1076ca[_0xb4a9('0x2b')];this['dialAMDAfterGreetingSilence']=_0x1076ca[_0xb4a9('0x2c')];this[_0xb4a9('0x2d')]=_0x1076ca[_0xb4a9('0x2d')];this[_0xb4a9('0x2e')]=_0x1076ca[_0xb4a9('0x2e')];this[_0xb4a9('0x2f')]=_0x1076ca['dialAMDBetweenWordsSilence'];this[_0xb4a9('0x30')]=_0x1076ca['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1076ca['dialAMDSilenceThreshold'];this[_0xb4a9('0x31')]=_0x1076ca[_0xb4a9('0x31')];}module[_0xb4a9('0x32')]=Campaign; \ No newline at end of file +var _0x10b2=['dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0xef322f,_0x1998fb){var _0x3d1a1e=function(_0x186c9a){while(--_0x186c9a){_0xef322f['push'](_0xef322f['shift']());}};_0x3d1a1e(++_0x1998fb);}(_0x10b2,0x134));var _0x210b=function(_0x23b0eb,_0x30ba3e){_0x23b0eb=_0x23b0eb-0x0;var _0x4d4e00=_0x10b2[_0x23b0eb];return _0x4d4e00;};'use strict';function Campaign(_0x1b1a63){this['id']=_0x1b1a63['id']||0x0;this[_0x210b('0x0')]=_0x1b1a63['name']||'';this[_0x210b('0x1')]=_0x1b1a63[_0x210b('0x1')]||'campaign';this[_0x210b('0x2')]=0x0;this[_0x210b('0x3')]=0x0;this[_0x210b('0x4')]=0x0;this[_0x210b('0x5')]=0x0;this[_0x210b('0x6')]='';this[_0x210b('0x7')]=!![];this['active']=_0x1b1a63['active'];this['limitCalls']=_0x1b1a63['limitCalls'];this[_0x210b('0x8')]=_0x1b1a63[_0x210b('0x8')]||null;this[_0x210b('0x9')]=_0x1b1a63['dialGlobalInterval']?_0x1b1a63[_0x210b('0x9')]:null;this[_0x210b('0xa')]=_0x1b1a63[_0x210b('0xa')];this[_0x210b('0xb')]=_0x1b1a63['dialOriginateCallerIdNumber'];this[_0x210b('0xc')]=_0x1b1a63['dialOriginateTimeout']||0x1e;this[_0x210b('0xd')]=_0x1b1a63[_0x210b('0xd')];this['dialCongestionRetryFrequency']=_0x1b1a63[_0x210b('0xe')];this[_0x210b('0xf')]=_0x1b1a63[_0x210b('0xf')];this[_0x210b('0x10')]=_0x1b1a63[_0x210b('0x10')];this[_0x210b('0x11')]=_0x1b1a63[_0x210b('0x11')];this[_0x210b('0x12')]=_0x1b1a63['dialNoAnswerRetryFrequency'];this[_0x210b('0x13')]=_0x1b1a63[_0x210b('0x13')];this[_0x210b('0x14')]=_0x1b1a63[_0x210b('0x14')]||0x3;this[_0x210b('0x15')]=_0x1b1a63['dialNoSuchNumberRetryFrequency']||0x96;this[_0x210b('0x16')]=_0x1b1a63['dialDropMaxRetry']||0x3;this[_0x210b('0x17')]=_0x1b1a63[_0x210b('0x17')]||0x96;this[_0x210b('0x18')]=_0x1b1a63[_0x210b('0x18')]||0x3;this[_0x210b('0x19')]=_0x1b1a63[_0x210b('0x19')]||0x96;this[_0x210b('0x1a')]=_0x1b1a63[_0x210b('0x1a')]||0x3;this[_0x210b('0x1b')]=_0x1b1a63[_0x210b('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x1b1a63[_0x210b('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1b1a63['dialAgentRejectRetryFrequency']||0x96;this[_0x210b('0x1d')]=_0x1b1a63[_0x210b('0x1d')]||_0x210b('0x1e');this[_0x210b('0x1f')]=_0x1b1a63[_0x210b('0x1f')]||undefined;this[_0x210b('0x20')]=_0x1b1a63[_0x210b('0x20')]||undefined;this['dialCutDigit']=_0x1b1a63[_0x210b('0x21')]||undefined;this[_0x210b('0x22')]=_0x1b1a63[_0x210b('0x22')]?_0x1b1a63[_0x210b('0x22')]:undefined;this[_0x210b('0x23')]=_0x1b1a63[_0x210b('0x23')]?_0x1b1a63['Trunk']:undefined;this[_0x210b('0x24')]=_0x1b1a63['Interval']?_0x1b1a63[_0x210b('0x24')]:undefined;this[_0x210b('0x25')]=_0x1b1a63[_0x210b('0x25')]?_0x1b1a63[_0x210b('0x25')]:undefined;this['dialQueueProject']=_0x1b1a63[_0x210b('0x25')]?_0x1b1a63[_0x210b('0x25')]['name']:undefined;this[_0x210b('0x26')]=_0x1b1a63[_0x210b('0x26')]||![];this[_0x210b('0x27')]=_0x1b1a63[_0x210b('0x27')];this[_0x210b('0x28')]=_0x1b1a63[_0x210b('0x28')];this[_0x210b('0x29')]=_0x1b1a63[_0x210b('0x29')];this[_0x210b('0x2a')]=_0x1b1a63[_0x210b('0x2a')];this['dialAMDMinWordLength']=_0x1b1a63[_0x210b('0x2b')];this[_0x210b('0x2c')]=_0x1b1a63[_0x210b('0x2c')];this[_0x210b('0x2d')]=_0x1b1a63['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1b1a63[_0x210b('0x2e')];this['dialAMDMaximumWordLength']=_0x1b1a63['dialAMDMaximumWordLength'];}module[_0x210b('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c7933bc..72c4197 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 _0xa67e=['disposition','monitor','monitorFilename','transferType','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','tag'];(function(_0x99882d,_0x274dbb){var _0x12a00c=function(_0x2672d8){while(--_0x2672d8){_0x99882d['push'](_0x99882d['shift']());}};_0x12a00c(++_0x274dbb);}(_0xa67e,0xce));var _0xea67=function(_0x1282d5,_0x3f4224){_0x1282d5=_0x1282d5-0x0;var _0x5590de=_0xa67e[_0x1282d5];return _0x5590de;};'use strict';function Channel(){this['starttime']=null;this[_0xea67('0x0')]='';this['destinationchannel']='';this[_0xea67('0x1')]=0x0;this[_0xea67('0x2')]='';this[_0xea67('0x3')]=undefined;this[_0xea67('0x4')]=undefined;this[_0xea67('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0xea67('0x6')]=0x0;this[_0xea67('0x7')]=0x0;this[_0xea67('0x8')]=![];this[_0xea67('0x9')]=null;this[_0xea67('0xa')]=null;this[_0xea67('0xb')]=![];this[_0xea67('0xc')]=![];this[_0xea67('0xd')]='';this[_0xea67('0xe')]='';this[_0xea67('0xf')]=0x0;this[_0xea67('0x10')]=0x0;this['holdtime']=0x0;this[_0xea67('0x11')]=null;this[_0xea67('0x12')]=null;this[_0xea67('0x13')]=null;this[_0xea67('0x14')]=![];this[_0xea67('0x15')]=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0xea67('0x16')]=undefined;this[_0xea67('0x17')]=0x0;}module[_0xea67('0x18')]=Channel; \ No newline at end of file +var _0xf55c=['exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','mohtime'];(function(_0x4ed621,_0x25371c){var _0x44b7d4=function(_0x1d637f){while(--_0x1d637f){_0x4ed621['push'](_0x4ed621['shift']());}};_0x44b7d4(++_0x25371c);}(_0xf55c,0x1e7));var _0xcf55=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xf55c[_0xa1e3e3];return _0xc980e9;};'use strict';function Channel(){this[_0xcf55('0x0')]=null;this['channel']='';this[_0xcf55('0x1')]='';this[_0xcf55('0x2')]=0x0;this[_0xcf55('0x3')]='';this[_0xcf55('0x4')]=undefined;this[_0xcf55('0x5')]=undefined;this[_0xcf55('0x6')]=0x0;this[_0xcf55('0x7')]='';this['uniqueid']=0x0;this[_0xcf55('0x8')]=0x0;this[_0xcf55('0x9')]=0x0;this[_0xcf55('0xa')]=![];this[_0xcf55('0xb')]=null;this['endtime']=null;this[_0xcf55('0xc')]=![];this[_0xcf55('0xd')]=![];this[_0xcf55('0xe')]='';this[_0xcf55('0xf')]='';this['duration']=0x0;this[_0xcf55('0x10')]=0x0;this[_0xcf55('0x11')]=0x0;this[_0xcf55('0x12')]=null;this[_0xcf55('0x13')]=null;this[_0xcf55('0x14')]=null;this[_0xcf55('0x15')]=![];this[_0xcf55('0x16')]=null;this['queue']=null;this[_0xcf55('0x17')]=[];this[_0xcf55('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0xcf55('0x19')]=0x0;}module[_0xcf55('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index adec288..f815fb2 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 _0x525b=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret'];(function(_0x19616a,_0x545c46){var _0x57bfb4=function(_0x9ab37b){while(--_0x9ab37b){_0x19616a['push'](_0x19616a['shift']());}};_0x57bfb4(++_0x545c46);}(_0x525b,0x64));var _0xb525=function(_0x3ebf8d,_0x2b0c31){_0x3ebf8d=_0x3ebf8d-0x0;var _0x59d8ae=_0x525b[_0x3ebf8d];return _0x59d8ae;};'use strict';function DeskAccount(_0x3741ac){this['id']=_0x3741ac['id']||0x0;this[_0xb525('0x0')]=_0x3741ac[_0xb525('0x0')]||'';this[_0xb525('0x1')]=_0x3741ac['username']||'';this[_0xb525('0x2')]=_0x3741ac[_0xb525('0x2')]||'';this['authType']=_0x3741ac[_0xb525('0x3')]||'';this[_0xb525('0x4')]=_0x3741ac[_0xb525('0x4')]||'';this['consumerKey']=_0x3741ac[_0xb525('0x5')]||'';this['consumerSecret']=_0x3741ac['consumerSecret']||'';this[_0xb525('0x6')]=_0x3741ac[_0xb525('0x6')]||'';this[_0xb525('0x7')]=_0x3741ac[_0xb525('0x7')]||'';this[_0xb525('0x8')]=_0x3741ac['type']||'';this['serverUrl']=_0x3741ac[_0xb525('0x9')]||'';this[_0xb525('0xa')]=_0x3741ac[_0xb525('0xa')]||{};}module[_0xb525('0xb')]=DeskAccount; \ No newline at end of file +var _0xd6f5=['token','tokenSecret','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x11911e,_0x18c680){var _0x24ffd3=function(_0x43d8a3){while(--_0x43d8a3){_0x11911e['push'](_0x11911e['shift']());}};_0x24ffd3(++_0x18c680);}(_0xd6f5,0x102));var _0x5d6f=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd6f5[_0x3ab9ee];return _0x82ee88;};'use strict';function DeskAccount(_0x56059d){this['id']=_0x56059d['id']||0x0;this[_0x5d6f('0x0')]=_0x56059d['name']||'';this['username']=_0x56059d['username']||'';this['remoteUri']=_0x56059d[_0x5d6f('0x1')]||'';this['authType']=_0x56059d[_0x5d6f('0x2')]||'';this[_0x5d6f('0x3')]=_0x56059d['password']||'';this['consumerKey']=_0x56059d[_0x5d6f('0x4')]||'';this[_0x5d6f('0x5')]=_0x56059d['consumerSecret']||'';this[_0x5d6f('0x6')]=_0x56059d[_0x5d6f('0x6')]||'';this['tokenSecret']=_0x56059d[_0x5d6f('0x7')]||'';this['type']=_0x56059d['type']||'';this[_0x5d6f('0x8')]=_0x56059d[_0x5d6f('0x8')]||'';this[_0x5d6f('0x9')]=_0x56059d[_0x5d6f('0x9')]||{};}module[_0x5d6f('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 51b7015..094c4f8 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 _0x5a70=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x23604f,_0xa8b11f){var _0x44f5fb=function(_0x244311){while(--_0x244311){_0x23604f['push'](_0x23604f['shift']());}};_0x44f5fb(++_0xa8b11f);}(_0x5a70,0x15c));var _0x05a7=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x5a70[_0x5275b8];return _0x568a9b;};'use strict';function Dynamics365Account(_0x1d67a4){this['id']=_0x1d67a4['id']||0x0;this[_0x05a7('0x0')]=_0x1d67a4['name']||'';this[_0x05a7('0x1')]=_0x1d67a4['username']||'';this['password']=_0x1d67a4[_0x05a7('0x2')]||'';this['remoteUri']=_0x1d67a4[_0x05a7('0x3')]||'';this[_0x05a7('0x4')]=_0x1d67a4[_0x05a7('0x4')]||'';this['clientId']=_0x1d67a4[_0x05a7('0x5')]||'';this['clientSecret']=_0x1d67a4[_0x05a7('0x6')]||{};this[_0x05a7('0x7')]=_0x1d67a4[_0x05a7('0x7')]||'';this['modernAuthentication']=_0x1d67a4[_0x05a7('0x8')]||![];this[_0x05a7('0x9')]=_0x1d67a4[_0x05a7('0x9')]||{};this[_0x05a7('0xa')]=_0x1d67a4[_0x05a7('0xa')]||{};}module[_0x05a7('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xb1df=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb1df,0xf4));var _0xfb1d=function(_0x4a84bf,_0x3fbfa5){_0x4a84bf=_0x4a84bf-0x0;var _0x3207fb=_0xb1df[_0x4a84bf];return _0x3207fb;};'use strict';function Dynamics365Account(_0x40c076){this['id']=_0x40c076['id']||0x0;this[_0xfb1d('0x0')]=_0x40c076[_0xfb1d('0x0')]||'';this['username']=_0x40c076[_0xfb1d('0x1')]||'';this[_0xfb1d('0x2')]=_0x40c076[_0xfb1d('0x2')]||'';this[_0xfb1d('0x3')]=_0x40c076[_0xfb1d('0x3')]||'';this[_0xfb1d('0x4')]=_0x40c076['tenantId']||'';this[_0xfb1d('0x5')]=_0x40c076[_0xfb1d('0x5')]||'';this['clientSecret']=_0x40c076[_0xfb1d('0x6')]||{};this['serverUrl']=_0x40c076[_0xfb1d('0x7')]||'';this['modernAuthentication']=_0x40c076[_0xfb1d('0x8')]||![];this[_0xfb1d('0x9')]=_0x40c076[_0xfb1d('0x9')]||{};this[_0xfb1d('0xa')]=_0x40c076[_0xfb1d('0xa')]||{};}module[_0xfb1d('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f2bcb55..65adb3d 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 _0x273e=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x3a903c,_0x3a6675){var _0x3889d7=function(_0x773810){while(--_0x773810){_0x3a903c['push'](_0x3a903c['shift']());}};_0x3889d7(++_0x3a6675);}(_0x273e,0x1b2));var _0xe273=function(_0x41b6c7,_0x1caccb){_0x41b6c7=_0x41b6c7-0x0;var _0x5787fa=_0x273e[_0x41b6c7];return _0x5787fa;};'use strict';function FaxAccount(_0x2c24d7){this['id']=_0x2c24d7['id']||0x0;this[_0xe273('0x0')]=_0x2c24d7['name']||'';this[_0xe273('0x1')]=_0x2c24d7['description'];this['ecm']=_0x2c24d7[_0xe273('0x2')];this[_0xe273('0x3')]=_0x2c24d7[_0xe273('0x3')];this[_0xe273('0x4')]=_0x2c24d7[_0xe273('0x4')];this[_0xe273('0x5')]=_0x2c24d7[_0xe273('0x5')]||0x960;this[_0xe273('0x6')]=_0x2c24d7[_0xe273('0x6')]||0x3840;this[_0xe273('0x7')]=_0x2c24d7[_0xe273('0x7')]||_0xe273('0x8');this[_0xe273('0x9')]=_0x2c24d7[_0xe273('0x9')]||'no';this[_0xe273('0xa')]=_0x2c24d7[_0xe273('0xa')]||'no';this[_0xe273('0xb')]=_0x2c24d7[_0xe273('0xb')]||0x1388;this[_0xe273('0xc')]=_0x2c24d7[_0xe273('0xc')]||_0xe273('0xd');this['Trunk']=_0x2c24d7['Trunk']?_0x2c24d7['Trunk']:undefined;this[_0xe273('0xe')]=_0x2c24d7[_0xe273('0xe')];this[_0xe273('0xf')]=_0x2c24d7[_0xe273('0xf')];}module[_0xe273('0x10')]=FaxAccount; \ No newline at end of file +var _0xddf8=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x1ee492,_0x23ea43){var _0x2ef645=function(_0x34ca1f){while(--_0x34ca1f){_0x1ee492['push'](_0x1ee492['shift']());}};_0x2ef645(++_0x23ea43);}(_0xddf8,0x7c));var _0x8ddf=function(_0x261b8f,_0x164a7e){_0x261b8f=_0x261b8f-0x0;var _0x396c92=_0xddf8[_0x261b8f];return _0x396c92;};'use strict';function FaxAccount(_0x235f1e){this['id']=_0x235f1e['id']||0x0;this[_0x8ddf('0x0')]=_0x235f1e[_0x8ddf('0x0')]||'';this[_0x8ddf('0x1')]=_0x235f1e['description'];this[_0x8ddf('0x2')]=_0x235f1e[_0x8ddf('0x2')];this[_0x8ddf('0x3')]=_0x235f1e[_0x8ddf('0x3')];this['localstationid']=_0x235f1e[_0x8ddf('0x4')];this[_0x8ddf('0x5')]=_0x235f1e['minrate']||0x960;this[_0x8ddf('0x6')]=_0x235f1e[_0x8ddf('0x6')]||0x3840;this[_0x8ddf('0x7')]=_0x235f1e[_0x8ddf('0x7')]||'v17,v27,v29';this[_0x8ddf('0x8')]=_0x235f1e['gateway']||'no';this[_0x8ddf('0x9')]=_0x235f1e[_0x8ddf('0x9')]||'no';this[_0x8ddf('0xa')]=_0x235f1e[_0x8ddf('0xa')]||0x1388;this['tech']=_0x235f1e['tech']||_0x8ddf('0xb');this[_0x8ddf('0xc')]=_0x235f1e['Trunk']?_0x235f1e[_0x8ddf('0xc')]:undefined;this[_0x8ddf('0xd')]=_0x235f1e['ListId'];this[_0x8ddf('0xe')]=_0x235f1e[_0x8ddf('0xe')];}module[_0x8ddf('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index fcb4b23..601c627 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 _0x8cf1=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1bc865,_0x3c4d88){var _0x572649=function(_0x3d74fa){while(--_0x3d74fa){_0x1bc865['push'](_0x1bc865['shift']());}};_0x572649(++_0x3c4d88);}(_0x8cf1,0x82));var _0x18cf=function(_0x220be9,_0x2701c8){_0x220be9=_0x220be9-0x0;var _0x2573c8=_0x8cf1[_0x220be9];return _0x2573c8;};'use strict';function FreshdeskAccount(_0x495da2){this['id']=_0x495da2['id']||0x0;this[_0x18cf('0x0')]=_0x495da2[_0x18cf('0x0')]||'';this['username']=_0x495da2[_0x18cf('0x1')]||'';this[_0x18cf('0x2')]=_0x495da2[_0x18cf('0x3')]||'';this[_0x18cf('0x4')]=_0x495da2[_0x18cf('0x4')]||'';this['serverUrl']=_0x495da2[_0x18cf('0x5')]||'';this['Configurations']=_0x495da2[_0x18cf('0x6')]||{};}module[_0x18cf('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x8efa=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4e5008,_0xf86183){var _0x298436=function(_0x44d584){while(--_0x44d584){_0x4e5008['push'](_0x4e5008['shift']());}};_0x298436(++_0xf86183);}(_0x8efa,0x1d4));var _0xa8ef=function(_0xd86dbd,_0x36f307){_0xd86dbd=_0xd86dbd-0x0;var _0x182e83=_0x8efa[_0xd86dbd];return _0x182e83;};'use strict';function FreshdeskAccount(_0xb8b58){this['id']=_0xb8b58['id']||0x0;this['name']=_0xb8b58[_0xa8ef('0x0')]||'';this[_0xa8ef('0x1')]=_0xb8b58[_0xa8ef('0x1')]||'';this[_0xa8ef('0x2')]=_0xb8b58[_0xa8ef('0x3')]||'';this['remoteUri']=_0xb8b58[_0xa8ef('0x4')]||'';this[_0xa8ef('0x5')]=_0xb8b58['serverUrl']||'';this[_0xa8ef('0x6')]=_0xb8b58[_0xa8ef('0x6')]||{};}module[_0xa8ef('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 57a82c0..7e21760 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 _0xe35c=['serverUrl','Configurations','name','username','apiKey','remoteUri'];(function(_0x55e840,_0x475895){var _0x1bebb4=function(_0x4b48b5){while(--_0x4b48b5){_0x55e840['push'](_0x55e840['shift']());}};_0x1bebb4(++_0x475895);}(_0xe35c,0x146));var _0xce35=function(_0x415819,_0x239f17){_0x415819=_0x415819-0x0;var _0x27fe93=_0xe35c[_0x415819];return _0x27fe93;};'use strict';function FreshsalesAccount(_0x4a3813){this['id']=_0x4a3813['id']||0x0;this[_0xce35('0x0')]=_0x4a3813[_0xce35('0x0')]||'';this[_0xce35('0x1')]=_0x4a3813[_0xce35('0x1')]||'';this[_0xce35('0x2')]=_0x4a3813['token']||'';this['remoteUri']=_0x4a3813[_0xce35('0x3')]||'';this['serverUrl']=_0x4a3813[_0xce35('0x4')]||'';this[_0xce35('0x5')]=_0x4a3813[_0xce35('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x2e8a=['exports','name','username','apiKey','remoteUri','Configurations'];(function(_0x2cea16,_0x1268cd){var _0x30a5ac=function(_0x316e56){while(--_0x316e56){_0x2cea16['push'](_0x2cea16['shift']());}};_0x30a5ac(++_0x1268cd);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x170cbb,_0x9093e){_0x170cbb=_0x170cbb-0x0;var _0x39fae4=_0x2e8a[_0x170cbb];return _0x39fae4;};'use strict';function FreshsalesAccount(_0x34856e){this['id']=_0x34856e['id']||0x0;this[_0xa2e8('0x0')]=_0x34856e[_0xa2e8('0x0')]||'';this['username']=_0x34856e[_0xa2e8('0x1')]||'';this[_0xa2e8('0x2')]=_0x34856e['token']||'';this[_0xa2e8('0x3')]=_0x34856e['remoteUri']||'';this['serverUrl']=_0x34856e['serverUrl']||'';this['Configurations']=_0x34856e[_0xa2e8('0x4')]||{};}module[_0xa2e8('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 78f1d95..26f6ca9 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 _0xa337=['lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','context','exten','priority','assigned'];(function(_0x4ac8df,_0xb279c7){var _0x3d4cf7=function(_0x3fc8ba){while(--_0x3fc8ba){_0x4ac8df['push'](_0x4ac8df['shift']());}};_0x3d4cf7(++_0xb279c7);}(_0xa337,0xe7));var _0x7a33=function(_0x5712a5,_0x2a12cb){_0x5712a5=_0x5712a5-0x0;var _0x521ca6=_0xa337[_0x5712a5];return _0x521ca6;};'use strict';function QueueReport(){this[_0x7a33('0x0')]='inbound';this[_0x7a33('0x1')]='';this[_0x7a33('0x2')]='';this[_0x7a33('0x3')]='';this[_0x7a33('0x4')]='';this[_0x7a33('0x5')]=null;this[_0x7a33('0x6')]=null;this[_0x7a33('0x7')]=0x1;this[_0x7a33('0x8')]=0x1;this[_0x7a33('0x9')]=![];this[_0x7a33('0xa')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x7a33('0xb')]=![];this[_0x7a33('0xc')]=null;this[_0x7a33('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x7a33('0xe')]='';this['accountcode']='';this[_0x7a33('0xf')]='';this[_0x7a33('0x10')]='';this[_0x7a33('0x11')]='';this['holdtime']=0x0;this[_0x7a33('0x12')]=![];this[_0x7a33('0x13')]='';this[_0x7a33('0x14')]=_0x7a33('0x15');this[_0x7a33('0x16')]=null;this[_0x7a33('0x17')]=0x0;this[_0x7a33('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x6b76=['queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','exten','holdtime','assigned','motionChannel','voice','routealias','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b76,0xa5));var _0x66b7=function(_0x52799a,_0x52d3a7){_0x52799a=_0x52799a-0x0;var _0xe68912=_0x6b76[_0x52799a];return _0xe68912;};'use strict';function QueueReport(){this[_0x66b7('0x0')]='inbound';this[_0x66b7('0x1')]='';this[_0x66b7('0x2')]='';this[_0x66b7('0x3')]='';this[_0x66b7('0x4')]='';this['queuecallerjoinAt']=null;this[_0x66b7('0x5')]=null;this[_0x66b7('0x6')]=0x1;this[_0x66b7('0x7')]=0x1;this[_0x66b7('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x66b7('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x66b7('0xa')]=![];this[_0x66b7('0xb')]=null;this['originalposition']=0x1;this[_0x66b7('0xc')]='';this[_0x66b7('0xd')]='';this[_0x66b7('0xe')]='';this[_0x66b7('0xf')]='';this['context']='';this[_0x66b7('0x10')]='';this['priority']='';this[_0x66b7('0x11')]=0x0;this[_0x66b7('0x12')]=![];this['lastAssignedTo']='';this[_0x66b7('0x13')]=_0x66b7('0x14');this[_0x66b7('0x15')]=null;this[_0x66b7('0x16')]=0x0;this[_0x66b7('0x17')]={};}module[_0x66b7('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8eee289..deaf69d 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 _0xd90d=['username','remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x3eb54d,_0x5364ff){var _0x2d7e00=function(_0x5c6b34){while(--_0x5c6b34){_0x3eb54d['push'](_0x3eb54d['shift']());}};_0x2d7e00(++_0x5364ff);}(_0xd90d,0x180));var _0xdd90=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xd90d[_0xdc37a1];return _0x99b4fe;};'use strict';function SalesforceAccount(_0x18c473){this['id']=_0x18c473['id']||0x0;this[_0xdd90('0x0')]=_0x18c473['name']||'';this[_0xdd90('0x1')]=_0x18c473[_0xdd90('0x1')]||'';this[_0xdd90('0x2')]=_0x18c473[_0xdd90('0x2')]||'';this[_0xdd90('0x3')]=_0x18c473[_0xdd90('0x3')]||'';this[_0xdd90('0x4')]=_0x18c473[_0xdd90('0x4')]||'';this[_0xdd90('0x5')]=_0x18c473[_0xdd90('0x5')]||'';this['securityToken']=_0x18c473['securityToken']||'';this['type']=_0x18c473[_0xdd90('0x6')]||_0xdd90('0x7');this[_0xdd90('0x8')]=_0x18c473[_0xdd90('0x8')]||'';this[_0xdd90('0x9')]=_0x18c473[_0xdd90('0x9')]||{};}module[_0xdd90('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xd4d1=['type','integrationTab','serverUrl','Configurations','name','username','password','clientId','clientSecret','securityToken'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4d1,0x86));var _0x1d4d=function(_0x4565cf,_0x467fef){_0x4565cf=_0x4565cf-0x0;var _0x24dba2=_0xd4d1[_0x4565cf];return _0x24dba2;};'use strict';function SalesforceAccount(_0x2c614f){this['id']=_0x2c614f['id']||0x0;this[_0x1d4d('0x0')]=_0x2c614f[_0x1d4d('0x0')]||'';this['username']=_0x2c614f[_0x1d4d('0x1')]||'';this['remoteUri']=_0x2c614f['remoteUri']||'';this[_0x1d4d('0x2')]=_0x2c614f[_0x1d4d('0x2')]||'';this['clientId']=_0x2c614f[_0x1d4d('0x3')]||'';this[_0x1d4d('0x4')]=_0x2c614f[_0x1d4d('0x4')]||'';this['securityToken']=_0x2c614f[_0x1d4d('0x5')]||'';this[_0x1d4d('0x6')]=_0x2c614f[_0x1d4d('0x6')]||_0x1d4d('0x7');this[_0x1d4d('0x8')]=_0x2c614f[_0x1d4d('0x8')]||'';this[_0x1d4d('0x9')]=_0x2c614f['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7ffcfd6..f71ad1d 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 _0x0432=['serverUrl','Configurations','username','password','remoteUri'];(function(_0x4de337,_0x5db3a4){var _0x1a2e95=function(_0xcb2526){while(--_0xcb2526){_0x4de337['push'](_0x4de337['shift']());}};_0x1a2e95(++_0x5db3a4);}(_0x0432,0x1ce));var _0x2043=function(_0x51de17,_0x7e9562){_0x51de17=_0x51de17-0x0;var _0x5429df=_0x0432[_0x51de17];return _0x5429df;};'use strict';function ServicenowAccount(_0x18eebb){this['id']=_0x18eebb['id']||0x0;this['name']=_0x18eebb['name']||'';this['username']=_0x18eebb[_0x2043('0x0')]||'';this[_0x2043('0x1')]=_0x18eebb['password']||'';this[_0x2043('0x2')]=_0x18eebb['remoteUri']||'';this[_0x2043('0x3')]=_0x18eebb['serverUrl']||'';this[_0x2043('0x4')]=_0x18eebb[_0x2043('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x3508=['exports','username','remoteUri','serverUrl','Configurations'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3508,0x164));var _0x8350=function(_0x4c5d91,_0x3653c7){_0x4c5d91=_0x4c5d91-0x0;var _0x1cfbf2=_0x3508[_0x4c5d91];return _0x1cfbf2;};'use strict';function ServicenowAccount(_0x3e0255){this['id']=_0x3e0255['id']||0x0;this['name']=_0x3e0255['name']||'';this['username']=_0x3e0255[_0x8350('0x0')]||'';this['password']=_0x3e0255['password']||'';this[_0x8350('0x1')]=_0x3e0255[_0x8350('0x1')]||'';this[_0x8350('0x2')]=_0x3e0255[_0x8350('0x2')]||'';this[_0x8350('0x3')]=_0x3e0255[_0x8350('0x3')]||{};}module[_0x8350('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index e504b20..368de4a 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 _0x57ef=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x8ba5d2,_0x22debd){var _0x5d53c1=function(_0x39b33c){while(--_0x39b33c){_0x8ba5d2['push'](_0x8ba5d2['shift']());}};_0x5d53c1(++_0x22debd);}(_0x57ef,0x1e5));var _0xf57e=function(_0x35924e,_0x5c7e7e){_0x35924e=_0x35924e-0x0;var _0x4dc17b=_0x57ef[_0x35924e];return _0x4dc17b;};'use strict';function SugarcrmAccount(_0x27e15d){this['id']=_0x27e15d['id']||0x0;this[_0xf57e('0x0')]=_0x27e15d['name']||'';this[_0xf57e('0x1')]=_0x27e15d[_0xf57e('0x1')]||'';this['password']=_0x27e15d[_0xf57e('0x2')]||'';this[_0xf57e('0x3')]=_0x27e15d['remoteUri']||'';this[_0xf57e('0x4')]=_0x27e15d[_0xf57e('0x4')]||'';this[_0xf57e('0x5')]=_0x27e15d[_0xf57e('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x619a=['username','password','remoteUri','Configurations'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x619a,0xb0));var _0xa619=function(_0x58be7b,_0x3b8252){_0x58be7b=_0x58be7b-0x0;var _0x4ef288=_0x619a[_0x58be7b];return _0x4ef288;};'use strict';function SugarcrmAccount(_0x806e95){this['id']=_0x806e95['id']||0x0;this['name']=_0x806e95['name']||'';this['username']=_0x806e95[_0xa619('0x0')]||'';this[_0xa619('0x1')]=_0x806e95[_0xa619('0x1')]||'';this[_0xa619('0x2')]=_0x806e95[_0xa619('0x2')]||'';this['serverUrl']=_0x806e95['serverUrl']||'';this[_0xa619('0x3')]=_0x806e95[_0xa619('0x3')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4e98478..47f2522 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 _0x7e7b=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x4f1f35,_0x357ae2){var _0x215471=function(_0x545af4){while(--_0x545af4){_0x4f1f35['push'](_0x4f1f35['shift']());}};_0x215471(++_0x357ae2);}(_0x7e7b,0x133));var _0xb7e7=function(_0x1b1eba,_0x71b70){_0x1b1eba=_0x1b1eba-0x0;var _0x2a59b7=_0x7e7b[_0x1b1eba];return _0x2a59b7;};'use strict';function Telephone(_0x3741bf){this['id']=_0x3741bf['id']||0x0;this[_0xb7e7('0x0')]=_0x3741bf['name']||'';this[_0xb7e7('0x1')]=_0x3741bf[_0xb7e7('0x1')]||'';this[_0xb7e7('0x2')]=_0xb7e7('0x3');this[_0xb7e7('0x4')]=0x0;this[_0xb7e7('0x5')]=_0xb7e7('0x3');this[_0xb7e7('0x6')]='';}module[_0xb7e7('0x7')]=Telephone; \ No newline at end of file +var _0x4bfb=['unknown','address','exports','name','accountcode','state','stateTime'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x4bfb,0x199));var _0xb4bf=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x4bfb[_0x3a9661];return _0x5bb119;};'use strict';function Telephone(_0x185f0d){this['id']=_0x185f0d['id']||0x0;this[_0xb4bf('0x0')]=_0x185f0d[_0xb4bf('0x0')]||'';this[_0xb4bf('0x1')]=_0x185f0d[_0xb4bf('0x1')]||'';this[_0xb4bf('0x2')]='unknown';this[_0xb4bf('0x3')]=0x0;this['status']=_0xb4bf('0x4');this[_0xb4bf('0x5')]='';}module[_0xb4bf('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 ee8eb5a..8fdfcc7 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x1db89b,_0x27f90b){var _0x5d9256=function(_0x290112){while(--_0x290112){_0x1db89b['push'](_0x1db89b['shift']());}};_0x5d9256(++_0x27f90b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x2123cf,_0xad135a){var _0x1bd165=function(_0x52397c){while(--_0x52397c){_0x2123cf['push'](_0x2123cf['shift']());}};_0x1bd165(++_0xad135a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 9eb09ac..425f969 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x0b0e[_0xa1e3ca];return _0x5005ab;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0xd6d333,_0x4bfd95){var _0x112efb=function(_0x3b02b5){while(--_0x3b02b5){_0xd6d333['push'](_0xd6d333['shift']());}};_0x112efb(++_0x4bfd95);}(_0x8603,0x190));var _0x3860=function(_0x4d52a5,_0x47a6ea){_0x4d52a5=_0x4d52a5-0x0;var _0xd0ac8d=_0x8603[_0x4d52a5];return _0xd0ac8d;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 30c19de..013e8b4 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 _0x856d=['stateRegistry','registrationtime','address','defaultuser','name','state','stateTime','unknown','registry','indexOf','host','port','domain','domainport','refresh'];(function(_0x4759ad,_0x478563){var _0x352621=function(_0x7565fb){while(--_0x7565fb){_0x4759ad['push'](_0x4759ad['shift']());}};_0x352621(++_0x478563);}(_0x856d,0x112));var _0xd856=function(_0x4a1efe,_0x42d252){_0x4a1efe=_0x4a1efe-0x0;var _0x2983e7=_0x856d[_0x4a1efe];return _0x2983e7;};'use strict';function Trunk(_0x524d65){this['id']=_0x524d65['id']||0x0;this['active']=_0x524d65['active']||![];this[_0xd856('0x0')]=_0x524d65[_0xd856('0x0')]||'';this[_0xd856('0x1')]='unknown';this[_0xd856('0x2')]=0x0;this['status']=_0xd856('0x3');this[_0xd856('0x4')]=_0x524d65['registry']&&_0x524d65[_0xd856('0x4')][_0xd856('0x5')](':')?_0x524d65[_0xd856('0x4')]['split'](':')[0x0]:'';this[_0xd856('0x6')]='';this[_0xd856('0x7')]='';this[_0xd856('0x8')]='';this[_0xd856('0x9')]='';this[_0xd856('0xa')]='';this[_0xd856('0xb')]=_0xd856('0x3');this[_0xd856('0xc')]='';this[_0xd856('0xd')]='';this[_0xd856('0xe')]=_0x524d65[_0xd856('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xfec3=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','port','domain'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0xfec3,0x170));var _0x3fec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xfec3[_0x19950b];return _0x3c6b41;};'use strict';function Trunk(_0x4d9da0){this['id']=_0x4d9da0['id']||0x0;this[_0x3fec('0x0')]=_0x4d9da0[_0x3fec('0x0')]||![];this[_0x3fec('0x1')]=_0x4d9da0[_0x3fec('0x1')]||'';this[_0x3fec('0x2')]='unknown';this[_0x3fec('0x3')]=0x0;this[_0x3fec('0x4')]=_0x3fec('0x5');this['registry']=_0x4d9da0[_0x3fec('0x6')]&&_0x4d9da0[_0x3fec('0x6')][_0x3fec('0x7')](':')?_0x4d9da0['registry'][_0x3fec('0x8')](':')[0x0]:'';this[_0x3fec('0x9')]='';this[_0x3fec('0xa')]='';this[_0x3fec('0xb')]='';this[_0x3fec('0xc')]='';this[_0x3fec('0xd')]='';this[_0x3fec('0xe')]=_0x3fec('0x5');this[_0x3fec('0xf')]='';this[_0x3fec('0x10')]='';this[_0x3fec('0x11')]=_0x4d9da0['defaultuser']||'';}module[_0x3fec('0x12')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8f390a5..dfad414 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 _0x05b3=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x37c309,_0x55978f){var _0x509c24=function(_0x12523d){while(--_0x12523d){_0x37c309['push'](_0x37c309['shift']());}};_0x509c24(++_0x55978f);}(_0x05b3,0x1ae));var _0x305b=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x05b3[_0x5751e6];return _0x4199e4;};'use strict';function voiceExtension(_0xa77798){this['id']=_0xa77798['id']||0x0;this[_0x305b('0x0')]=_0xa77798['exten']||'';this[_0x305b('0x1')]=_0xa77798['recordingFormat']||_0x305b('0x2');this[_0x305b('0x3')]=_0xa77798['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xe97a=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x8624b6,_0x3c920a){var _0x592ae1=function(_0x355484){while(--_0x355484){_0x8624b6['push'](_0x8624b6['shift']());}};_0x592ae1(++_0x3c920a);}(_0xe97a,0x195));var _0xae97=function(_0x7b6f59,_0x7cc38d){_0x7b6f59=_0x7b6f59-0x0;var _0x278caf=_0xe97a[_0x7b6f59];return _0x278caf;};'use strict';function voiceExtension(_0x484651){this['id']=_0x484651['id']||0x0;this[_0xae97('0x0')]=_0x484651[_0xae97('0x0')]||'';this[_0xae97('0x1')]=_0x484651[_0xae97('0x1')]||_0xae97('0x2');this[_0xae97('0x3')]=_0x484651[_0xae97('0x3')]||![];}module[_0xae97('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 8ca2074..215ecf9 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 _0xa786=['answered','sumDuration','sumBillable','unmanaged','abandoned','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total'];(function(_0x3b6abe,_0x543c02){var _0x122e98=function(_0x12bf9d){while(--_0x12bf9d){_0x3b6abe['push'](_0x3b6abe['shift']());}};_0x122e98(++_0x543c02);}(_0xa786,0x71));var _0x6a78=function(_0x472a38,_0x387db0){_0x472a38=_0x472a38-0x0;var _0x316440=_0xa786[_0x472a38];return _0x316440;};'use strict';var monitorFormat={'wav':_0x6a78('0x0'),'wav49':_0x6a78('0x1'),'gsm':_0x6a78('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x6a78('0x3'),'linear':'linear','random':'random','ringall':_0x6a78('0x4'),'rr':_0x6a78('0x5'),'rrmemory':_0x6a78('0x6'),'rrordered':_0x6a78('0x7'),'wrandom':_0x6a78('0x8')};function VoiceQueue(_0x112e35){this['id']=_0x112e35['id']||0x0;this[_0x6a78('0x9')]=_0x112e35['name']||'';this[_0x6a78('0xa')]=_0x112e35[_0x6a78('0xa')]||'';this[_0x6a78('0xb')]=_0x112e35[_0x6a78('0xb')]||_0x6a78('0xc');this[_0x6a78('0xd')]=0x0;this[_0x6a78('0xe')]=0x0;this[_0x6a78('0xf')]=0x0;this[_0x6a78('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x6a78('0x11')]=0x0;this[_0x6a78('0x12')]=0x0;this[_0x6a78('0x13')]=0x0;this['available']=0x0;this[_0x6a78('0x14')]=0x0;this[_0x6a78('0x15')]=0x0;this[_0x6a78('0x16')]=0x0;this[_0x6a78('0x17')]=0x0;this[_0x6a78('0x18')]=0x0;this['onHold']=0x0;this[_0x6a78('0x19')]=0x0;this[_0x6a78('0x1a')]=0x0;this[_0x6a78('0x1b')]=0x0;this['talking']=0x0;this[_0x6a78('0x1c')]=0x0;this[_0x6a78('0x1d')]=0x0;this['acw']=_0x112e35[_0x6a78('0x1e')]||![];this[_0x6a78('0x1f')]=_0x112e35[_0x6a78('0x1f')]||0xa;this[_0x6a78('0x20')]=_0x112e35[_0x6a78('0x20')]||'no';this[_0x6a78('0x21')]=!![];this['message']='';this[_0x6a78('0x22')]='';this[_0x6a78('0x23')]=0x0;this[_0x6a78('0x24')]=0x0;this[_0x6a78('0x25')]=_0x112e35['dialTimezone']||null;this['dialGlobalInterval']=_0x112e35[_0x6a78('0x26')]?_0x112e35['dialGlobalInterval']:null;this['dialActive']=_0x112e35['dialActive'];this[_0x6a78('0x27')]=_0x112e35[_0x6a78('0x27')]||_0x6a78('0x28');this['dialLimitChannel']=_0x112e35['dialLimitChannel']||0x0;this[_0x6a78('0x29')]=_0x112e35[_0x6a78('0x29')]||0x0;this[_0x6a78('0x2a')]=_0x112e35[_0x6a78('0x2a')]||0x1;this['dialPredictiveOptimization']=_0x112e35['dialPredictiveOptimization']||'dropRate';this[_0x6a78('0x2b')]=_0x112e35['dialPredictiveOptimizationPercentage']||0.03;this[_0x6a78('0x2c')]=_0x112e35[_0x6a78('0x2c')]||0x258;this[_0x6a78('0x2d')]=_0x112e35['dialOriginateCallerIdName']||_0x6a78('0x2e');this[_0x6a78('0x2f')]=_0x112e35[_0x6a78('0x2f')]||_0x6a78('0x2e');this[_0x6a78('0x30')]=_0x112e35[_0x6a78('0x30')]||0x1e;this[_0x6a78('0x31')]=_0x112e35[_0x6a78('0x31')]||'tTxX';this[_0x6a78('0x32')]=_0x112e35[_0x6a78('0x32')]||0x3;this[_0x6a78('0x33')]=_0x112e35['dialQueueProject']||undefined;this[_0x6a78('0x34')]=_0x112e35['dialCongestionMaxRetry']||0x3;this[_0x6a78('0x35')]=_0x112e35[_0x6a78('0x35')]||0x96;this['dialBusyMaxRetry']=_0x112e35[_0x6a78('0x36')]||0x3;this[_0x6a78('0x37')]=_0x112e35[_0x6a78('0x37')]||0x96;this[_0x6a78('0x38')]=_0x112e35['dialNoAnswerMaxRetry']||0x3;this[_0x6a78('0x39')]=_0x112e35[_0x6a78('0x39')]||0x96;this[_0x6a78('0x3a')]=_0x112e35[_0x6a78('0x3a')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x112e35[_0x6a78('0x3b')]||0x96;this[_0x6a78('0x3c')]=_0x112e35[_0x6a78('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x112e35[_0x6a78('0x3d')]||0x96;this[_0x6a78('0x3e')]=_0x112e35['dialAbandonedMaxRetry']||0x3;this[_0x6a78('0x3f')]=_0x112e35[_0x6a78('0x3f')]||0x96;this[_0x6a78('0x40')]=_0x112e35[_0x6a78('0x40')]||0x3;this[_0x6a78('0x41')]=_0x112e35['dialMachineRetryFrequency']||0x96;this[_0x6a78('0x42')]=_0x112e35[_0x6a78('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x112e35[_0x6a78('0x43')]||0x96;this[_0x6a78('0x44')]=_0x112e35[_0x6a78('0x44')]||0x3;this[_0x6a78('0x45')]=_0x112e35[_0x6a78('0x45')]||0x4;this[_0x6a78('0x46')]=_0x112e35['Trunk']?_0x112e35[_0x6a78('0x46')]:undefined;this['TrunkBackup']=_0x112e35[_0x6a78('0x47')]?_0x112e35[_0x6a78('0x47')]:undefined;this[_0x6a78('0x48')]=_0x112e35[_0x6a78('0x48')]||undefined;this[_0x6a78('0x49')]=_0x112e35[_0x6a78('0x49')]?_0x112e35[_0x6a78('0x49')]:undefined;this[_0x6a78('0x4a')]=_0x112e35[_0x6a78('0x4a')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x112e35[_0x6a78('0x4b')]||undefined;this['dialCutDigit']=_0x112e35[_0x6a78('0x4c')]||undefined;this[_0x6a78('0x4d')]=strategy[_0x112e35[_0x6a78('0x4d')]];this[_0x6a78('0x4e')]=!![];this[_0x6a78('0x4f')]=_0x112e35[_0x6a78('0x4f')]||![];this[_0x6a78('0x50')]=_0x112e35[_0x6a78('0x50')];this['dialAMDGreeting']=_0x112e35[_0x6a78('0x51')];this[_0x6a78('0x52')]=_0x112e35[_0x6a78('0x52')];this['dialAMDTotalAnalysisTime']=_0x112e35[_0x6a78('0x53')];this['dialAMDMinWordLength']=_0x112e35[_0x6a78('0x54')];this[_0x6a78('0x55')]=_0x112e35[_0x6a78('0x55')];this[_0x6a78('0x56')]=_0x112e35['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x112e35['dialAMDSilenceThreshold'];this[_0x6a78('0x57')]=_0x112e35[_0x6a78('0x57')];this['outboundRejectCallsDay']=0x0;this[_0x6a78('0x58')]=0x0;this[_0x6a78('0x59')]=_0x112e35[_0x6a78('0x59')];this[_0x6a78('0x5a')]=0x0;this[_0x6a78('0x5b')]=0x0;this[_0x6a78('0x5c')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6a78('0x5d')]=0x0;this[_0x6a78('0x5e')]=0x0;this[_0x6a78('0x5f')]=0x0;this[_0x6a78('0x60')]=0x0;this[_0x6a78('0x61')]=0x0;this[_0x6a78('0x62')]=0x0;this[_0x6a78('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6a78('0x64')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x6a78('0x65')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x6a78('0x66')]=1.05;this[_0x6a78('0x67')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x6a78('0x68')]=0x0;this[_0x6a78('0x69')]=0x0;this[_0x6a78('0x6a')]=0x0;this[_0x6a78('0x6b')]=0x0;this[_0x6a78('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x112e35[_0x6a78('0x6d')]||0x14;this[_0x6a78('0x6e')]=_0x112e35[_0x6a78('0x6d')]||0xa;this[_0x6a78('0x6f')]=0x0;this[_0x6a78('0x70')]=0x0;this[_0x6a78('0x71')]=0x1;this[_0x6a78('0x72')]=0x0;this['erlangCallToSecond']=0x0;this[_0x6a78('0x73')]=0x0;this[_0x6a78('0x74')]=0x0;this['dialRecallMeTimeout']=_0x112e35[_0x6a78('0x75')]||0x1e;this[_0x6a78('0x76')]=_0x112e35[_0x6a78('0x76')]||![];this[_0x6a78('0x77')]=!!_0x112e35[_0x6a78('0x77')]||![];this[_0x6a78('0x78')]=!!_0x112e35['dialPreviewRecallmeReminder']||![];this[_0x6a78('0x79')]=_0x112e35[_0x6a78('0x79')]||undefined;this[_0x6a78('0x7a')]=_0x112e35[_0x6a78('0x7a')]||![];this[_0x6a78('0x7b')]=_0x112e35['dialAgiAfterHangupAgent']||![];this[_0x6a78('0xa')]=monitorFormat[_0x112e35['monitor_format']]?monitorFormat[_0x112e35[_0x6a78('0xa')]]:undefined;this[_0x6a78('0x7c')]=_0x112e35['mandatoryDisposition']||![];this[_0x6a78('0x7d')]=_0x112e35['mandatoryDispositionPause']?_0x112e35[_0x6a78('0x7d')]:undefined;this[_0x6a78('0x7e')]=![];}module[_0x6a78('0x7f')]=VoiceQueue; \ No newline at end of file +var _0xd07e=['wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','abandoned','available','inUse','invalid','loggedIn','onHold','paused','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports'];(function(_0x2312c3,_0x55e913){var _0x308532=function(_0x505bbb){while(--_0x505bbb){_0x2312c3['push'](_0x2312c3['shift']());}};_0x308532(++_0x55e913);}(_0xd07e,0x10a));var _0xed07=function(_0x23fcad,_0x2b4c2e){_0x23fcad=_0x23fcad-0x0;var _0x3e4d60=_0xd07e[_0x23fcad];return _0x3e4d60;};'use strict';var monitorFormat={'wav':_0xed07('0x0'),'wav49':_0xed07('0x1'),'gsm':_0xed07('0x2')};var strategy={'fewestcalls':_0xed07('0x3'),'leastrecent':_0xed07('0x4'),'linear':_0xed07('0x5'),'random':_0xed07('0x6'),'ringall':_0xed07('0x7'),'rr':_0xed07('0x8'),'rrmemory':_0xed07('0x9'),'rrordered':_0xed07('0xa'),'wrandom':_0xed07('0xb')};function VoiceQueue(_0x3c1eec){this['id']=_0x3c1eec['id']||0x0;this[_0xed07('0xc')]=_0x3c1eec[_0xed07('0xc')]||'';this[_0xed07('0xd')]=_0x3c1eec[_0xed07('0xd')]||'';this['type']=_0x3c1eec[_0xed07('0xe')]||_0xed07('0xf');this[_0xed07('0x10')]=0x0;this[_0xed07('0x11')]=0x0;this[_0xed07('0x12')]=0x0;this[_0xed07('0x13')]=0x0;this[_0xed07('0x14')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xed07('0x15')]=0x0;this[_0xed07('0x16')]=0x0;this['busy']=0x0;this[_0xed07('0x17')]=0x0;this[_0xed07('0x18')]=0x0;this[_0xed07('0x19')]=0x0;this['notInUse']=0x0;this[_0xed07('0x1a')]=0x0;this[_0xed07('0x1b')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0xed07('0x1c')]=0x0;this[_0xed07('0x1d')]=0x0;this[_0xed07('0x1e')]=0x0;this['acw']=_0x3c1eec[_0xed07('0x1f')]||![];this[_0xed07('0x20')]=_0x3c1eec[_0xed07('0x20')]||0xa;this[_0xed07('0x21')]=_0x3c1eec[_0xed07('0x21')]||'no';this[_0xed07('0x22')]=!![];this[_0xed07('0x23')]='';this[_0xed07('0x24')]='';this[_0xed07('0x25')]=0x0;this[_0xed07('0x26')]=0x0;this[_0xed07('0x27')]=_0x3c1eec['dialTimezone']||null;this[_0xed07('0x28')]=_0x3c1eec['dialGlobalInterval']?_0x3c1eec[_0xed07('0x28')]:null;this[_0xed07('0x29')]=_0x3c1eec[_0xed07('0x29')];this['dialMethod']=_0x3c1eec['dialMethod']||_0xed07('0x2a');this[_0xed07('0x2b')]=_0x3c1eec[_0xed07('0x2b')]||0x0;this['dialLimitQueue']=_0x3c1eec[_0xed07('0x2c')]||0x0;this[_0xed07('0x2d')]=_0x3c1eec[_0xed07('0x2d')]||0x1;this[_0xed07('0x2e')]=_0x3c1eec[_0xed07('0x2e')]||_0xed07('0x2f');this[_0xed07('0x30')]=_0x3c1eec[_0xed07('0x30')]||0.03;this[_0xed07('0x31')]=_0x3c1eec[_0xed07('0x31')]||0x258;this['dialOriginateCallerIdName']=_0x3c1eec['dialOriginateCallerIdName']||_0xed07('0x32');this['dialOriginateCallerIdNumber']=_0x3c1eec[_0xed07('0x33')]||'anonymous';this[_0xed07('0x34')]=_0x3c1eec[_0xed07('0x34')]||0x1e;this[_0xed07('0x35')]=_0x3c1eec[_0xed07('0x35')]||_0xed07('0x36');this[_0xed07('0x37')]=_0x3c1eec[_0xed07('0x37')]||0x3;this[_0xed07('0x38')]=_0x3c1eec[_0xed07('0x38')]||undefined;this[_0xed07('0x39')]=_0x3c1eec[_0xed07('0x39')]||0x3;this[_0xed07('0x3a')]=_0x3c1eec[_0xed07('0x3a')]||0x96;this[_0xed07('0x3b')]=_0x3c1eec[_0xed07('0x3b')]||0x3;this[_0xed07('0x3c')]=_0x3c1eec[_0xed07('0x3c')]||0x96;this[_0xed07('0x3d')]=_0x3c1eec[_0xed07('0x3d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3c1eec['dialNoAnswerRetryFrequency']||0x96;this[_0xed07('0x3e')]=_0x3c1eec[_0xed07('0x3e')]||0x3;this[_0xed07('0x3f')]=_0x3c1eec[_0xed07('0x3f')]||0x96;this['dialDropMaxRetry']=_0x3c1eec[_0xed07('0x40')]||0x3;this[_0xed07('0x41')]=_0x3c1eec[_0xed07('0x41')]||0x96;this[_0xed07('0x42')]=_0x3c1eec['dialAbandonedMaxRetry']||0x3;this[_0xed07('0x43')]=_0x3c1eec[_0xed07('0x43')]||0x96;this['dialMachineMaxRetry']=_0x3c1eec['dialMachineMaxRetry']||0x3;this[_0xed07('0x44')]=_0x3c1eec[_0xed07('0x44')]||0x96;this[_0xed07('0x45')]=_0x3c1eec[_0xed07('0x45')]||0x3;this[_0xed07('0x46')]=_0x3c1eec[_0xed07('0x46')]||0x96;this[_0xed07('0x47')]=_0x3c1eec['callAdditionalPhoneAfterMin']||0x3;this[_0xed07('0x48')]=_0x3c1eec[_0xed07('0x48')]||0x4;this['Trunk']=_0x3c1eec[_0xed07('0x49')]?_0x3c1eec[_0xed07('0x49')]:undefined;this[_0xed07('0x4a')]=_0x3c1eec[_0xed07('0x4a')]?_0x3c1eec[_0xed07('0x4a')]:undefined;this[_0xed07('0x4b')]=_0x3c1eec['dialPrefix']||undefined;this[_0xed07('0x4c')]=_0x3c1eec['Interval']?_0x3c1eec[_0xed07('0x4c')]:undefined;this['dialOrderByScheduledAt']=_0x3c1eec[_0xed07('0x4d')]||_0xed07('0x4e');this[_0xed07('0x4f')]=_0x3c1eec[_0xed07('0x4f')]||undefined;this[_0xed07('0x50')]=_0x3c1eec[_0xed07('0x50')]||undefined;this[_0xed07('0x51')]=strategy[_0x3c1eec[_0xed07('0x51')]];this[_0xed07('0x52')]=!![];this[_0xed07('0x53')]=_0x3c1eec[_0xed07('0x53')]||![];this[_0xed07('0x54')]=_0x3c1eec['dialAMDInitialSilence'];this[_0xed07('0x55')]=_0x3c1eec[_0xed07('0x55')];this['dialAMDAfterGreetingSilence']=_0x3c1eec['dialAMDAfterGreetingSilence'];this[_0xed07('0x56')]=_0x3c1eec[_0xed07('0x56')];this[_0xed07('0x57')]=_0x3c1eec[_0xed07('0x57')];this['dialAMDBetweenWordsSilence']=_0x3c1eec[_0xed07('0x58')];this['dialAMDMaximumNumberOfWords']=_0x3c1eec['dialAMDMaximumNumberOfWords'];this[_0xed07('0x59')]=_0x3c1eec['dialAMDSilenceThreshold'];this[_0xed07('0x5a')]=_0x3c1eec[_0xed07('0x5a')];this[_0xed07('0x5b')]=0x0;this[_0xed07('0x5c')]=0x0;this[_0xed07('0x5d')]=_0x3c1eec[_0xed07('0x5d')];this['outboundAnswerCallsDay']=0x0;this[_0xed07('0x5e')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xed07('0x5f')]=0x0;this[_0xed07('0x60')]=0x0;this[_0xed07('0x61')]=0x0;this[_0xed07('0x62')]=0x0;this[_0xed07('0x63')]=0x0;this[_0xed07('0x64')]=0x0;this[_0xed07('0x65')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xed07('0x66')]=0x0;this[_0xed07('0x67')]=0x0;this[_0xed07('0x68')]=0x0;this[_0xed07('0x69')]=undefined;this['startPredictive']=undefined;this[_0xed07('0x6a')]=undefined;this[_0xed07('0x6b')]=1.05;this[_0xed07('0x6c')]=0x0;this[_0xed07('0x6d')]=0x0;this[_0xed07('0x6e')]=0x0;this[_0xed07('0x6f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xed07('0x70')]=0x0;this[_0xed07('0x71')]=0x0;this[_0xed07('0x72')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3c1eec[_0xed07('0x73')]||0x14;this[_0xed07('0x74')]=_0x3c1eec['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xed07('0x75')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xed07('0x76')]=0x1;this[_0xed07('0x77')]=0x0;this[_0xed07('0x78')]=0x0;this[_0xed07('0x79')]=0x0;this[_0xed07('0x7a')]=0x0;this[_0xed07('0x7b')]=_0x3c1eec['dialRecallMeTimeout']||0x1e;this[_0xed07('0x7c')]=_0x3c1eec[_0xed07('0x7c')]||![];this[_0xed07('0x7d')]=!!_0x3c1eec[_0xed07('0x7d')]||![];this[_0xed07('0x7e')]=!!_0x3c1eec[_0xed07('0x7e')]||![];this['dialQueueProject2']=_0x3c1eec[_0xed07('0x7f')]||undefined;this[_0xed07('0x80')]=_0x3c1eec[_0xed07('0x80')]||![];this[_0xed07('0x81')]=_0x3c1eec[_0xed07('0x81')]||![];this[_0xed07('0xd')]=monitorFormat[_0x3c1eec['monitor_format']]?monitorFormat[_0x3c1eec[_0xed07('0xd')]]:undefined;this[_0xed07('0x82')]=_0x3c1eec['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x3c1eec[_0xed07('0x83')]?_0x3c1eec[_0xed07('0x83')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xed07('0x84')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index fde6b9b..95c2b49 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 _0x3fc6=['exports','available','loggedIn','loggedInDb','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','incall','includes','booked','keys','queue','dialer','exten','prototype','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue'];(function(_0x29fbb7,_0x9a8ad){var _0x3153fe=function(_0x4fab0c){while(--_0x4fab0c){_0x29fbb7['push'](_0x29fbb7['shift']());}};_0x3153fe(++_0x9a8ad);}(_0x3fc6,0x159));var _0x63fc=function(_0x4e383d,_0x5c3e02){_0x4e383d=_0x4e383d-0x0;var _0x55bad4=_0x3fc6[_0x4e383d];return _0x55bad4;};'use strict';var INBOUND_COUNTERS=[_0x63fc('0x0'),_0x63fc('0x1'),_0x63fc('0x2'),'paused',_0x63fc('0x3'),_0x63fc('0x4'),_0x63fc('0x5')];var OUTBOUND_COUNTERS=[_0x63fc('0x0'),_0x63fc('0x6'),_0x63fc('0x7'),'loggedIn','loggedInDb',_0x63fc('0x8'),_0x63fc('0x9'),_0x63fc('0xa'),'outboundBlacklistCallsDay',_0x63fc('0xb'),_0x63fc('0xc'),'outboundNoAnswerCallsDay',_0x63fc('0xd'),_0x63fc('0xe'),_0x63fc('0xf'),_0x63fc('0x10'),_0x63fc('0x11'),_0x63fc('0x12'),_0x63fc('0x4'),_0x63fc('0x13'),_0x63fc('0x14'),_0x63fc('0x15'),'waiting'];function VoiceQueueSummary(_0x45d080){this['id']=_0x45d080['id'];this[_0x63fc('0x16')]=_0x45d080[_0x63fc('0x16')];this['strategy']=_0x45d080['strategy'];this[_0x63fc('0x17')]=_0x45d080[_0x63fc('0x17')]||0x0;this[_0x63fc('0x6')]=_0x45d080[_0x63fc('0x6')]||0x0;this[_0x63fc('0x0')]=_0x45d080[_0x63fc('0x0')]||0x0;this['busy']=_0x45d080[_0x63fc('0x18')]||0x0;this[_0x63fc('0x7')]=_0x45d080[_0x63fc('0x7')]||0x0;this[_0x63fc('0x19')]=_0x45d080['invalid']||0x0;this[_0x63fc('0x1')]=_0x45d080['loggedIn']||0x0;this[_0x63fc('0x2')]=_0x45d080[_0x63fc('0x2')]||0x0;this[_0x63fc('0x1a')]=_0x45d080[_0x63fc('0x1a')]||0x0;this[_0x63fc('0x1b')]=_0x45d080['notInUse']||0x0;this[_0x63fc('0x11')]=_0x45d080[_0x63fc('0x11')]||0x0;this[_0x63fc('0x3')]=_0x45d080['ringing']||0x0;this['ringInUse']=_0x45d080[_0x63fc('0x1c')];this[_0x63fc('0x13')]=_0x45d080['sumBillable'];this[_0x63fc('0x14')]=_0x45d080['sumDuration'];this[_0x63fc('0x1d')]=_0x45d080[_0x63fc('0x1d')]||0x0;this[_0x63fc('0x4')]=_0x45d080[_0x63fc('0x4')]||0x0;this[_0x63fc('0x15')]=_0x45d080[_0x63fc('0x15')]||0x0;this[_0x63fc('0x1e')]=_0x45d080['type'];this[_0x63fc('0x1f')]=_0x45d080[_0x63fc('0x1f')]||0x0;this[_0x63fc('0x20')]=_0x45d080[_0x63fc('0x20')]||0x0;this[_0x63fc('0x21')]=_0x45d080['unmanaged']||0x0;this['waiting']=_0x45d080[_0x63fc('0x5')]||0x0;if(_0x45d080[_0x63fc('0x1e')]===_0x63fc('0x22')){this[_0x63fc('0x12')]=_0x45d080['pTalking']||0x0;this[_0x63fc('0x23')]=_0x45d080[_0x63fc('0x23')];this[_0x63fc('0x24')]=_0x45d080[_0x63fc('0x24')];this[_0x63fc('0x25')]=_0x45d080[_0x63fc('0x25')];this[_0x63fc('0x26')]=_0x45d080[_0x63fc('0x26')];this['dialOriginateTimeout']=_0x45d080['dialOriginateTimeout'];this[_0x63fc('0x27')]=_0x45d080[_0x63fc('0x27')];this['temp']=_0x45d080['temp'];this['outboundAnswerAgiCallsDay']=_0x45d080[_0x63fc('0x28')];this[_0x63fc('0xa')]=_0x45d080[_0x63fc('0xa')];this[_0x63fc('0x29')]=_0x45d080[_0x63fc('0x29')];this[_0x63fc('0xb')]=_0x45d080[_0x63fc('0xb')];this['outboundCongestionCallsDay']=_0x45d080[_0x63fc('0xc')];this[_0x63fc('0x2a')]=_0x45d080['outboundDropCallsDayACS'];this[_0x63fc('0x2b')]=_0x45d080[_0x63fc('0x2b')];this[_0x63fc('0x2c')]=_0x45d080['outboundDropCallsDayTimeout'];this[_0x63fc('0x2d')]=_0x45d080['outboundNoAnswerCallsDay'];this[_0x63fc('0xd')]=_0x45d080[_0x63fc('0xd')];this[_0x63fc('0x2e')]=_0x45d080['outboundOriginateFailureCallsDay'];this[_0x63fc('0xe')]=_0x45d080[_0x63fc('0xe')];this[_0x63fc('0xf')]=_0x45d080['outboundRejectCallsDay'];this[_0x63fc('0x10')]=_0x45d080['outboundUnknownCallsDay'];this[_0x63fc('0x2f')]=_0x45d080[_0x63fc('0x2f')];this[_0x63fc('0x30')]=_0x45d080['predictiveIntervalAvgHoldtime'];this[_0x63fc('0x31')]=_0x45d080[_0x63fc('0x31')];this[_0x63fc('0x32')]=_0x45d080['predictiveIntervalDroppedCallsCallersExit'];this[_0x63fc('0x33')]=_0x45d080['predictiveIntervalDroppedCallsTimeout'];this[_0x63fc('0x34')]=_0x45d080[_0x63fc('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x45d080[_0x63fc('0x35')];this[_0x63fc('0x36')]=_0x45d080['predictiveIntervalHitRate'];this[_0x63fc('0x37')]=_0x45d080['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x45d080['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x45d080[_0x63fc('0x38')];this[_0x63fc('0x39')]=_0x45d080[_0x63fc('0x39')];this['originated']=_0x45d080[_0x63fc('0x8')];this[_0x63fc('0x3a')]=_0x45d080['erlangCalls'];this['erlangCallToSecond']=_0x45d080[_0x63fc('0x3b')];this[_0x63fc('0x3c')]=_0x45d080['erlangAbandonmentRate'];this[_0x63fc('0x3d')]=_0x45d080[_0x63fc('0x3d')];this['startPredictive']=_0x45d080['startPredictive'];this[_0x63fc('0x3e')]=_0x45d080[_0x63fc('0x3e')];this[_0x63fc('0x3f')]=_0x45d080[_0x63fc('0x3f')];this[_0x63fc('0x40')]=_0x45d080[_0x63fc('0x40')];}if(_0x45d080[_0x63fc('0x41')]){this[_0x63fc('0x41')]={'id':_0x45d080[_0x63fc('0x41')]['id'],'name':_0x45d080[_0x63fc('0x41')]['name'],'active':_0x45d080[_0x63fc('0x41')][_0x63fc('0x42')],'callerid':_0x45d080[_0x63fc('0x41')][_0x63fc('0x43')]};}}VoiceQueueSummary['prototype'][_0x63fc('0x44')]=function(_0x1a3f04,_0x282f7a,_0x3e6936,_0x2f2933){this[_0x63fc('0x2')]=0x0;this['talking']=0x0;this[_0x63fc('0x11')]=0x0;this[_0x63fc('0x20')]=0x0;this[_0x63fc('0x1b')]=0x0;this[_0x63fc('0x7')]=0x0;this[_0x63fc('0x18')]=0x0;this['invalid']=0x0;this[_0x63fc('0x1f')]=0x0;this[_0x63fc('0x3')]=0x0;this[_0x63fc('0x1c')]=0x0;this[_0x63fc('0x1a')]=0x0;if(_0x3e6936){if(_0x3e6936[_0x63fc('0x0')]){this[_0x63fc('0x0')]=Number(_0x3e6936[_0x63fc('0x0')]);}if(_0x3e6936[_0x63fc('0x45')]){this[_0x63fc('0x1')]=Number(_0x3e6936[_0x63fc('0x45')]);}if(_0x3e6936[_0x63fc('0x46')]){this['waiting']=Number(_0x3e6936[_0x63fc('0x46')]);}}for(var _0x5db4d2=0x0;_0x5db4d2<_0x1a3f04[_0x63fc('0x47')];_0x5db4d2++){var _0x59a993=_0x282f7a[_0x63fc('0x48')+_0x1a3f04[_0x5db4d2]['name']];if(_0x59a993&&_0x59a993['online']){this['loggedInDb']+=0x1;}if(_0x1a3f04[_0x5db4d2][_0x63fc('0x49')]==='1'){this['talking']+=0x1;}if(_0x1a3f04[_0x5db4d2]['paused']==='1'&&!['2','7','8'][_0x63fc('0x4a')](_0x1a3f04[_0x5db4d2]['status'])){this['paused']+=0x1;}switch(_0x1a3f04[_0x5db4d2]['status']){case'0':this[_0x63fc('0x20')]+=0x1;break;case'1':this[_0x63fc('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x63fc('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x63fc('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x63fc('0x1c')]+=0x1;break;case'8':this[_0x63fc('0x1a')]+=0x1;break;}}if(this[_0x63fc('0x24')]===_0x63fc('0x4b')){var _0x350257=Object[_0x63fc('0x4c')](_0x2f2933);for(var _0x5574e9=0x0;_0x5574e9<_0x350257[_0x63fc('0x47')];_0x5574e9++){var _0x1944d6=_0x350257[_0x5574e9];var _0x245a0c=_0x2f2933[_0x1944d6];if(_0x245a0c[_0x63fc('0x4d')]===this['name']&&_0x245a0c[_0x63fc('0x1e')]===_0x63fc('0x4e')&&_0x245a0c[_0x63fc('0x4f')]==='xcally-motion-preview'){this[_0x63fc('0x4')]+=0x1;}}if(this[_0x63fc('0x4')]>this[_0x63fc('0x7')]){this[_0x63fc('0x4')]=this[_0x63fc('0x7')];}this[_0x63fc('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x63fc('0x50')][_0x63fc('0x51')]=function(_0x8e86a2){var _0x28ee76=![];if(_0x8e86a2){_0x28ee76=INBOUND_COUNTERS[_0x63fc('0x52')](function(_0x2a7a59){return this[_0x2a7a59]!==_0x8e86a2[_0x2a7a59];},this);}return _0x28ee76;};VoiceQueueSummary[_0x63fc('0x50')][_0x63fc('0x53')]=function(_0x56d123){var _0x439167=![];var _0x13f902=![];var _0x35559b=![];if(_0x56d123){_0x439167=this['dialMethod']!==_0x56d123[_0x63fc('0x24')]||this[_0x63fc('0x23')]!==_0x56d123[_0x63fc('0x23')]||this[_0x63fc('0x3f')]!==_0x56d123[_0x63fc('0x3f')]||this[_0x63fc('0x40')]!==_0x56d123[_0x63fc('0x40')];_0x13f902=OUTBOUND_COUNTERS[_0x63fc('0x52')](function(_0x6ca2e8){return this[_0x6ca2e8]!==_0x56d123[_0x6ca2e8];},this);if(this[_0x63fc('0x41')]&&_0x56d123['Trunk']){_0x35559b=this[_0x63fc('0x41')][_0x63fc('0x16')]!==_0x56d123[_0x63fc('0x41')][_0x63fc('0x16')]||this[_0x63fc('0x41')][_0x63fc('0x42')]!==_0x56d123[_0x63fc('0x41')][_0x63fc('0x42')];}}return _0x439167||_0x13f902||_0x35559b;};VoiceQueueSummary[_0x63fc('0x50')][_0x63fc('0x54')]=function(_0x1a6fe8){this[_0x63fc('0x6')]=_0x1a6fe8[_0x63fc('0x6')];this[_0x63fc('0x3f')]=_0x1a6fe8[_0x63fc('0x3f')];this[_0x63fc('0x40')]=_0x1a6fe8['statusMessage'];this[_0x63fc('0x8')]=_0x1a6fe8[_0x63fc('0x8')];this['outboundAbandonedCallsDay']=_0x1a6fe8['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x1a6fe8['outboundAnswerCallsDay'];this[_0x63fc('0x29')]=_0x1a6fe8['outboundBlacklistCallsDay'];this[_0x63fc('0xb')]=_0x1a6fe8[_0x63fc('0xb')];this[_0x63fc('0xc')]=_0x1a6fe8['outboundCongestionCallsDay'];this[_0x63fc('0x2d')]=_0x1a6fe8[_0x63fc('0x2d')];this[_0x63fc('0xd')]=_0x1a6fe8[_0x63fc('0xd')];this[_0x63fc('0xe')]=_0x1a6fe8[_0x63fc('0xe')];this['outboundRejectCallsDay']=_0x1a6fe8['outboundRejectCallsDay'];this[_0x63fc('0x10')]=_0x1a6fe8[_0x63fc('0x10')];this[_0x63fc('0x13')]=_0x1a6fe8[_0x63fc('0x13')];this[_0x63fc('0x14')]=_0x1a6fe8['sumDuration'];this['total']=_0x1a6fe8['total'];if(this['dialMethod']==='preview'){this['pTalking']=_0x1a6fe8['pTalking'];}};module[_0x63fc('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0x25fa=['loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','ringing','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','ringInUse','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','exports','available','loggedInDb','paused','talking','waiting'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x25fa,0x109));var _0xa25f=function(_0x5e621b,_0x46c16c){_0x5e621b=_0x5e621b-0x0;var _0x574a8a=_0x25fa[_0x5e621b];return _0x574a8a;};'use strict';var INBOUND_COUNTERS=[_0xa25f('0x0'),'loggedIn',_0xa25f('0x1'),_0xa25f('0x2'),'ringing',_0xa25f('0x3'),_0xa25f('0x4')];var OUTBOUND_COUNTERS=[_0xa25f('0x0'),'answered','inUse',_0xa25f('0x5'),'loggedInDb',_0xa25f('0x6'),_0xa25f('0x7'),_0xa25f('0x8'),_0xa25f('0x9'),_0xa25f('0xa'),_0xa25f('0xb'),_0xa25f('0xc'),_0xa25f('0xd'),_0xa25f('0xe'),'outboundRejectCallsDay',_0xa25f('0xf'),_0xa25f('0x2'),'pTalking',_0xa25f('0x3'),_0xa25f('0x10'),_0xa25f('0x11'),_0xa25f('0x12'),'waiting'];function VoiceQueueSummary(_0x2f7fc5){this['id']=_0x2f7fc5['id'];this[_0xa25f('0x13')]=_0x2f7fc5['name'];this[_0xa25f('0x14')]=_0x2f7fc5[_0xa25f('0x14')];this['abandoned']=_0x2f7fc5[_0xa25f('0x15')]||0x0;this[_0xa25f('0x16')]=_0x2f7fc5[_0xa25f('0x16')]||0x0;this[_0xa25f('0x0')]=_0x2f7fc5[_0xa25f('0x0')]||0x0;this[_0xa25f('0x17')]=_0x2f7fc5[_0xa25f('0x17')]||0x0;this[_0xa25f('0x18')]=_0x2f7fc5[_0xa25f('0x18')]||0x0;this[_0xa25f('0x19')]=_0x2f7fc5[_0xa25f('0x19')]||0x0;this[_0xa25f('0x5')]=_0x2f7fc5['loggedIn']||0x0;this[_0xa25f('0x1')]=_0x2f7fc5[_0xa25f('0x1')]||0x0;this[_0xa25f('0x1a')]=_0x2f7fc5[_0xa25f('0x1a')]||0x0;this[_0xa25f('0x1b')]=_0x2f7fc5[_0xa25f('0x1b')]||0x0;this['paused']=_0x2f7fc5[_0xa25f('0x2')]||0x0;this['ringing']=_0x2f7fc5[_0xa25f('0x1c')]||0x0;this['ringInUse']=_0x2f7fc5['ringInUse'];this[_0xa25f('0x10')]=_0x2f7fc5['sumBillable'];this[_0xa25f('0x11')]=_0x2f7fc5[_0xa25f('0x11')];this[_0xa25f('0x1d')]=_0x2f7fc5[_0xa25f('0x1d')]||0x0;this[_0xa25f('0x3')]=_0x2f7fc5['talking']||0x0;this[_0xa25f('0x12')]=_0x2f7fc5[_0xa25f('0x12')]||0x0;this[_0xa25f('0x1e')]=_0x2f7fc5[_0xa25f('0x1e')];this['unavailable']=_0x2f7fc5[_0xa25f('0x1f')]||0x0;this[_0xa25f('0x20')]=_0x2f7fc5[_0xa25f('0x20')]||0x0;this[_0xa25f('0x21')]=_0x2f7fc5['unmanaged']||0x0;this[_0xa25f('0x4')]=_0x2f7fc5[_0xa25f('0x4')]||0x0;if(_0x2f7fc5[_0xa25f('0x1e')]===_0xa25f('0x22')){this['pTalking']=_0x2f7fc5[_0xa25f('0x23')]||0x0;this[_0xa25f('0x24')]=_0x2f7fc5['dialActive'];this[_0xa25f('0x25')]=_0x2f7fc5['dialMethod'];this[_0xa25f('0x26')]=_0x2f7fc5['dialOriginateCallerIdName'];this[_0xa25f('0x27')]=_0x2f7fc5[_0xa25f('0x27')];this['dialOriginateTimeout']=_0x2f7fc5[_0xa25f('0x28')];this[_0xa25f('0x29')]=_0x2f7fc5['dialPrefix'];this[_0xa25f('0x2a')]=_0x2f7fc5['temp'];this[_0xa25f('0x2b')]=_0x2f7fc5[_0xa25f('0x2b')];this[_0xa25f('0x8')]=_0x2f7fc5[_0xa25f('0x8')];this[_0xa25f('0x9')]=_0x2f7fc5['outboundBlacklistCallsDay'];this[_0xa25f('0xa')]=_0x2f7fc5[_0xa25f('0xa')];this[_0xa25f('0xb')]=_0x2f7fc5[_0xa25f('0xb')];this[_0xa25f('0x2c')]=_0x2f7fc5['outboundDropCallsDayACS'];this[_0xa25f('0x2d')]=_0x2f7fc5[_0xa25f('0x2d')];this[_0xa25f('0x2e')]=_0x2f7fc5[_0xa25f('0x2e')];this[_0xa25f('0xc')]=_0x2f7fc5[_0xa25f('0xc')];this[_0xa25f('0xd')]=_0x2f7fc5[_0xa25f('0xd')];this[_0xa25f('0x2f')]=_0x2f7fc5['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x2f7fc5['outboundReCallsDay'];this[_0xa25f('0x30')]=_0x2f7fc5[_0xa25f('0x30')];this[_0xa25f('0xf')]=_0x2f7fc5[_0xa25f('0xf')];this[_0xa25f('0x31')]=_0x2f7fc5[_0xa25f('0x31')];this[_0xa25f('0x32')]=_0x2f7fc5[_0xa25f('0x32')];this[_0xa25f('0x33')]=_0x2f7fc5[_0xa25f('0x33')];this[_0xa25f('0x34')]=_0x2f7fc5['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x2f7fc5[_0xa25f('0x35')];this[_0xa25f('0x36')]=_0x2f7fc5[_0xa25f('0x36')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x2f7fc5['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x2f7fc5[_0xa25f('0x37')];this[_0xa25f('0x38')]=_0x2f7fc5[_0xa25f('0x38')];this['predictiveIntervalPauses']=_0x2f7fc5['predictiveIntervalPauses'];this[_0xa25f('0x39')]=_0x2f7fc5[_0xa25f('0x39')];this['predictiveIntervalTotalCalls']=_0x2f7fc5['predictiveIntervalTotalCalls'];this[_0xa25f('0x6')]=_0x2f7fc5[_0xa25f('0x6')];this[_0xa25f('0x3a')]=_0x2f7fc5['erlangCalls'];this[_0xa25f('0x3b')]=_0x2f7fc5[_0xa25f('0x3b')];this[_0xa25f('0x3c')]=_0x2f7fc5['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x2f7fc5[_0xa25f('0x3d')];this[_0xa25f('0x3e')]=_0x2f7fc5[_0xa25f('0x3e')];this[_0xa25f('0x3f')]=_0x2f7fc5[_0xa25f('0x3f')];this[_0xa25f('0x40')]=_0x2f7fc5[_0xa25f('0x40')];this[_0xa25f('0x41')]=_0x2f7fc5['statusMessage'];}if(_0x2f7fc5[_0xa25f('0x42')]){this[_0xa25f('0x42')]={'id':_0x2f7fc5[_0xa25f('0x42')]['id'],'name':_0x2f7fc5[_0xa25f('0x42')][_0xa25f('0x13')],'active':_0x2f7fc5[_0xa25f('0x42')][_0xa25f('0x43')],'callerid':_0x2f7fc5[_0xa25f('0x42')][_0xa25f('0x44')]};}}VoiceQueueSummary[_0xa25f('0x45')][_0xa25f('0x46')]=function(_0x3267a0,_0x82ddbf,_0x593cee,_0x20400d){this['loggedInDb']=0x0;this[_0xa25f('0x3')]=0x0;this[_0xa25f('0x2')]=0x0;this[_0xa25f('0x20')]=0x0;this['notInUse']=0x0;this[_0xa25f('0x18')]=0x0;this[_0xa25f('0x17')]=0x0;this[_0xa25f('0x19')]=0x0;this[_0xa25f('0x1f')]=0x0;this['ringing']=0x0;this[_0xa25f('0x47')]=0x0;this[_0xa25f('0x1a')]=0x0;if(_0x593cee){if(_0x593cee[_0xa25f('0x0')]){this[_0xa25f('0x0')]=Number(_0x593cee[_0xa25f('0x0')]);}if(_0x593cee[_0xa25f('0x48')]){this['loggedIn']=Number(_0x593cee[_0xa25f('0x48')]);}if(_0x593cee[_0xa25f('0x49')]){this['waiting']=Number(_0x593cee[_0xa25f('0x49')]);}}for(var _0xd5321c=0x0;_0xd5321c<_0x3267a0[_0xa25f('0x4a')];_0xd5321c++){var _0x45ada3=_0x82ddbf[_0xa25f('0x4b')+_0x3267a0[_0xd5321c][_0xa25f('0x13')]];if(_0x45ada3&&_0x45ada3[_0xa25f('0x4c')]){this[_0xa25f('0x1')]+=0x1;}if(_0x3267a0[_0xd5321c][_0xa25f('0x4d')]==='1'){this[_0xa25f('0x3')]+=0x1;}if(_0x3267a0[_0xd5321c][_0xa25f('0x2')]==='1'&&!['2','7','8'][_0xa25f('0x4e')](_0x3267a0[_0xd5321c][_0xa25f('0x4f')])){this['paused']+=0x1;}switch(_0x3267a0[_0xd5321c][_0xa25f('0x4f')]){case'0':this[_0xa25f('0x20')]+=0x1;break;case'1':this[_0xa25f('0x1b')]+=0x1;break;case'2':this[_0xa25f('0x18')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xa25f('0x19')]+=0x1;break;case'5':this[_0xa25f('0x1f')]+=0x1;break;case'6':this[_0xa25f('0x1c')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xa25f('0x1a')]+=0x1;break;}}if(this[_0xa25f('0x25')]===_0xa25f('0x50')){var _0xd36140=Object[_0xa25f('0x51')](_0x20400d);for(var _0x3b6d34=0x0;_0x3b6d34<_0xd36140[_0xa25f('0x4a')];_0x3b6d34++){var _0x2a5848=_0xd36140[_0x3b6d34];var _0x573577=_0x20400d[_0x2a5848];if(_0x573577[_0xa25f('0x52')]===this[_0xa25f('0x13')]&&_0x573577[_0xa25f('0x1e')]===_0xa25f('0x53')&&_0x573577[_0xa25f('0x54')]===_0xa25f('0x55')){this[_0xa25f('0x3')]+=0x1;}}if(this[_0xa25f('0x3')]>this[_0xa25f('0x18')]){this[_0xa25f('0x3')]=this[_0xa25f('0x18')];}this[_0xa25f('0x23')]=0x0;}return this;};VoiceQueueSummary[_0xa25f('0x45')][_0xa25f('0x56')]=function(_0x8249db){var _0x22ab7f=![];if(_0x8249db){_0x22ab7f=INBOUND_COUNTERS[_0xa25f('0x57')](function(_0x2fedba){return this[_0x2fedba]!==_0x8249db[_0x2fedba];},this);}return _0x22ab7f;};VoiceQueueSummary[_0xa25f('0x45')][_0xa25f('0x58')]=function(_0x3469da){var _0x493834=![];var _0x52671e=![];var _0x1de4c4=![];if(_0x3469da){_0x493834=this[_0xa25f('0x25')]!==_0x3469da[_0xa25f('0x25')]||this[_0xa25f('0x24')]!==_0x3469da['dialActive']||this[_0xa25f('0x40')]!==_0x3469da['message']||this[_0xa25f('0x41')]!==_0x3469da['statusMessage'];_0x52671e=OUTBOUND_COUNTERS['some'](function(_0x5f9932){return this[_0x5f9932]!==_0x3469da[_0x5f9932];},this);if(this[_0xa25f('0x42')]&&_0x3469da[_0xa25f('0x42')]){_0x1de4c4=this[_0xa25f('0x42')][_0xa25f('0x13')]!==_0x3469da[_0xa25f('0x42')][_0xa25f('0x13')]||this[_0xa25f('0x42')][_0xa25f('0x43')]!==_0x3469da[_0xa25f('0x42')][_0xa25f('0x43')];}}return _0x493834||_0x52671e||_0x1de4c4;};VoiceQueueSummary[_0xa25f('0x45')]['updateReportFromOutboundQueue']=function(_0x2e10d0){this[_0xa25f('0x16')]=_0x2e10d0[_0xa25f('0x16')];this[_0xa25f('0x40')]=_0x2e10d0['message'];this[_0xa25f('0x41')]=_0x2e10d0['statusMessage'];this[_0xa25f('0x6')]=_0x2e10d0[_0xa25f('0x6')];this[_0xa25f('0x7')]=_0x2e10d0[_0xa25f('0x7')];this['outboundAnswerCallsDay']=_0x2e10d0[_0xa25f('0x8')];this[_0xa25f('0x9')]=_0x2e10d0[_0xa25f('0x9')];this['outboundBusyCallsDay']=_0x2e10d0[_0xa25f('0xa')];this['outboundCongestionCallsDay']=_0x2e10d0[_0xa25f('0xb')];this['outboundNoAnswerCallsDay']=_0x2e10d0[_0xa25f('0xc')];this[_0xa25f('0xd')]=_0x2e10d0[_0xa25f('0xd')];this[_0xa25f('0xe')]=_0x2e10d0[_0xa25f('0xe')];this[_0xa25f('0x30')]=_0x2e10d0['outboundRejectCallsDay'];this[_0xa25f('0xf')]=_0x2e10d0[_0xa25f('0xf')];this[_0xa25f('0x10')]=_0x2e10d0[_0xa25f('0x10')];this[_0xa25f('0x11')]=_0x2e10d0[_0xa25f('0x11')];this[_0xa25f('0x12')]=_0x2e10d0['total'];if(this['dialMethod']==='preview'){this[_0xa25f('0x23')]=_0x2e10d0[_0xa25f('0x23')];}};module[_0xa25f('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 85a3cd3..f40fbe7 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 _0x03f4=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x347a4a,_0x2b263d){var _0x35e2a8=function(_0x269b1c){while(--_0x269b1c){_0x347a4a['push'](_0x347a4a['shift']());}};_0x35e2a8(++_0x2b263d);}(_0x03f4,0xc9));var _0x403f=function(_0x506fd2,_0x27b863){_0x506fd2=_0x506fd2-0x0;var _0x3e0349=_0x03f4[_0x506fd2];return _0x3e0349;};'use strict';function VtigerAccount(_0x335bf8){this['id']=_0x335bf8['id']||0x0;this[_0x403f('0x0')]=_0x335bf8[_0x403f('0x0')]||'';this['username']=_0x335bf8[_0x403f('0x1')]||'';this[_0x403f('0x2')]=_0x335bf8['accessKey']||'';this[_0x403f('0x3')]=_0x335bf8['remoteUri']||'';this['serverUrl']=_0x335bf8[_0x403f('0x4')]||'';this['Configurations']=_0x335bf8[_0x403f('0x5')]||{};}module[_0x403f('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa046=['accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa046,0xc5));var _0x6a04=function(_0x3a153e,_0xb6f72b){_0x3a153e=_0x3a153e-0x0;var _0x551fe5=_0xa046[_0x3a153e];return _0x551fe5;};'use strict';function VtigerAccount(_0xef8063){this['id']=_0xef8063['id']||0x0;this[_0x6a04('0x0')]=_0xef8063[_0x6a04('0x0')]||'';this['username']=_0xef8063['username']||'';this[_0x6a04('0x1')]=_0xef8063[_0x6a04('0x1')]||'';this['remoteUri']=_0xef8063[_0x6a04('0x2')]||'';this[_0x6a04('0x3')]=_0xef8063[_0x6a04('0x3')]||'';this[_0x6a04('0x4')]=_0xef8063[_0x6a04('0x4')]||{};}module[_0x6a04('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c7d48d2..c64fef6 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 _0x9002=['serverUrl','exports','name','password','token','remoteUri','authType','type','integrationTab'];(function(_0x2a58aa,_0x87cb84){var _0x488e54=function(_0x4f907f){while(--_0x4f907f){_0x2a58aa['push'](_0x2a58aa['shift']());}};_0x488e54(++_0x87cb84);}(_0x9002,0xf5));var _0x2900=function(_0x1ade7a,_0x3085be){_0x1ade7a=_0x1ade7a-0x0;var _0x59c625=_0x9002[_0x1ade7a];return _0x59c625;};'use strict';function ZendeskAccount(_0x479f85){this['id']=_0x479f85['id']||0x0;this['name']=_0x479f85[_0x2900('0x0')]||'';this['username']=_0x479f85['username']||'';this[_0x2900('0x1')]=_0x479f85['password']||'';this[_0x2900('0x2')]=_0x479f85[_0x2900('0x2')]||'';this[_0x2900('0x3')]=_0x479f85[_0x2900('0x3')]||'';this[_0x2900('0x4')]=_0x479f85[_0x2900('0x4')]||'';this[_0x2900('0x5')]=_0x479f85[_0x2900('0x5')]||_0x2900('0x6');this[_0x2900('0x7')]=_0x479f85[_0x2900('0x7')]||'';this['Configurations']=_0x479f85['Configurations']||{};}module[_0x2900('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x1ef7=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1ef7,0x118));var _0x71ef=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x1ef7[_0x245afe];return _0x4eefde;};'use strict';function ZendeskAccount(_0x404d6d){this['id']=_0x404d6d['id']||0x0;this['name']=_0x404d6d[_0x71ef('0x0')]||'';this[_0x71ef('0x1')]=_0x404d6d[_0x71ef('0x1')]||'';this[_0x71ef('0x2')]=_0x404d6d[_0x71ef('0x2')]||'';this[_0x71ef('0x3')]=_0x404d6d[_0x71ef('0x3')]||'';this['remoteUri']=_0x404d6d[_0x71ef('0x4')]||'';this[_0x71ef('0x5')]=_0x404d6d[_0x71ef('0x5')]||'';this[_0x71ef('0x6')]=_0x404d6d['type']||'integrationTab';this['serverUrl']=_0x404d6d[_0x71ef('0x7')]||'';this[_0x71ef('0x8')]=_0x404d6d[_0x71ef('0x8')]||{};}module[_0x71ef('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a4f5b00..0a2fdbc 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 _0x3a51=['host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x114c1c,_0x5bfd6d){var _0x50a0a6=function(_0x4f97f0){while(--_0x4f97f0){_0x114c1c['push'](_0x114c1c['shift']());}};_0x50a0a6(++_0x5bfd6d);}(_0x3a51,0x17a));var _0x13a5=function(_0x40ce6e,_0x506035){_0x40ce6e=_0x40ce6e-0x0;var _0x5e6c0e=_0x3a51[_0x40ce6e];return _0x5e6c0e;};'use strict';function ZohoAccount(_0x104b88){this['id']=_0x104b88['id']||0x0;this[_0x13a5('0x0')]=_0x104b88[_0x13a5('0x0')]||'';this[_0x13a5('0x1')]=_0x104b88[_0x13a5('0x1')]||'';this['host']=_0x104b88[_0x13a5('0x2')]||'';this['zone']=_0x104b88['zone']||'';this[_0x13a5('0x3')]=_0x104b88[_0x13a5('0x3')]||'';this[_0x13a5('0x4')]=_0x104b88[_0x13a5('0x4')]||'';this[_0x13a5('0x5')]=_0x104b88[_0x13a5('0x5')]||'';this[_0x13a5('0x6')]=_0x104b88[_0x13a5('0x6')]||'';this[_0x13a5('0x7')]=_0x104b88['refreshToken']||'';this['Configurations']=_0x104b88[_0x13a5('0x8')]||{};}module[_0x13a5('0x9')]=ZohoAccount; \ No newline at end of file +var _0x3cbe=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x4bb7dc,_0x3ec998){var _0x2c4629=function(_0x732b19){while(--_0x732b19){_0x4bb7dc['push'](_0x4bb7dc['shift']());}};_0x2c4629(++_0x3ec998);}(_0x3cbe,0xde));var _0xe3cb=function(_0x12f4af,_0x4a2bb9){_0x12f4af=_0x12f4af-0x0;var _0x4c4d50=_0x3cbe[_0x12f4af];return _0x4c4d50;};'use strict';function ZohoAccount(_0x397f57){this['id']=_0x397f57['id']||0x0;this[_0xe3cb('0x0')]=_0x397f57['name']||'';this['description']=_0x397f57[_0xe3cb('0x1')]||'';this[_0xe3cb('0x2')]=_0x397f57['host']||'';this[_0xe3cb('0x3')]=_0x397f57[_0xe3cb('0x3')]||'';this['clientId']=_0x397f57[_0xe3cb('0x4')]||'';this[_0xe3cb('0x5')]=_0x397f57[_0xe3cb('0x5')]||'';this[_0xe3cb('0x6')]=_0x397f57[_0xe3cb('0x6')]||'';this[_0xe3cb('0x7')]=_0x397f57[_0xe3cb('0x7')]||'';this[_0xe3cb('0x8')]=_0x397f57[_0xe3cb('0x8')]||'';this[_0xe3cb('0x9')]=_0x397f57[_0xe3cb('0x9')]||{};}module[_0xe3cb('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index e65e5f3..e6e14b3 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 _0x1967=['type','campaigntype','queue','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','firstName','lastName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','exports','lodash','moment','isNil','string','uniqueid','idContact','name'];(function(_0x2e0854,_0x52544a){var _0x4d0ff9=function(_0x3647fb){while(--_0x3647fb){_0x2e0854['push'](_0x2e0854['shift']());}};_0x4d0ff9(++_0x52544a);}(_0x1967,0x173));var _0x7196=function(_0x16d346,_0x19111d){_0x16d346=_0x16d346-0x0;var _0x55f6f0=_0x1967[_0x16d346];return _0x55f6f0;};'use strict';var util=require('util');var _=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));function checkNameSurname(_0x4d0a98,_0x35803d,_0x3319fa){var _0xa80a3f='';if(!_[_0x7196('0x2')](_0x35803d)&&_0x7196('0x3')===typeof _0x35803d){_0xa80a3f+=_0x35803d;}if(!_[_0x7196('0x2')](_0x3319fa)&&_0x7196('0x3')===typeof _0x3319fa){_0xa80a3f+='\x20'+_0x3319fa;}if(_0xa80a3f!==''){return _0xa80a3f;}return _0x4d0a98;}function Action(_0x5c128f,_0x36b01e,_0x186175,_0x194746,_0x40e0af){this[_0x7196('0x4')]=_0x186175||undefined;this[_0x7196('0x5')]=_0x5c128f['id'];this['queue']=_0x36b01e[_0x7196('0x6')];this[_0x7196('0x7')]=_0x36b01e[_0x7196('0x7')];this[_0x7196('0x8')]=_0x7196('0x9');this['dialAnswer']=![];this['membername']=_[_0x7196('0x2')](_0x5c128f[_0x7196('0xa')])?undefined:_0x5c128f[_0x7196('0xa')][_0x7196('0x6')];this[_0x7196('0xb')]=this[_0x7196('0xc')]?util[_0x7196('0xd')](_0x7196('0xe'),this[_0x7196('0xc')]):_0x194746||undefined;this[_0x7196('0xf')]=checkNameSurname(_0x5c128f[_0x7196('0x10')]['phone'],_0x5c128f[_0x7196('0x10')][_0x7196('0x11')],_0x5c128f[_0x7196('0x10')][_0x7196('0x12')]);this['active']=_0x5c128f[_0x7196('0x13')]||![];this['calleridnum']=_0x5c128f[_0x7196('0x14')];this[_0x7196('0x15')]=_0x5c128f[_0x7196('0x15')];this[_0x7196('0x16')]=_0x5c128f[_0x7196('0x16')]||0x0;this[_0x7196('0x17')]=_0x5c128f[_0x7196('0x17')]||0x0;this[_0x7196('0x18')]=_0x5c128f[_0x7196('0x18')]||0x0;this[_0x7196('0x19')]=(_0x5c128f[_0x7196('0x16')]||0x0)+(_0x5c128f['countcongestionretry']||0x0)+(_0x5c128f['countnoanswerretry']||0x0)+(_0x5c128f[_0x7196('0x1a')]||0x0)+(_0x5c128f[_0x7196('0x1b')]||0x0)+(_0x5c128f[_0x7196('0x1c')]||0x0)+(_0x5c128f['countmachineretry']||0x0)+(_0x5c128f[_0x7196('0x1d')]||0x0);this['countnosuchnumberretry']=_0x5c128f['countnosuchnumberretry']||0x0;this[_0x7196('0x1b')]=_0x5c128f[_0x7196('0x1b')]||0x0;this[_0x7196('0x1c')]=_0x5c128f['countabandonedretry']||0x0;this['countmachineretry']=_0x5c128f[_0x7196('0x1e')]||0x0;this[_0x7196('0x1d')]=_0x5c128f['countagentrejectretry']||0x0;this[_0x7196('0x1f')]=_0x5c128f[_0x7196('0x1f')];this[_0x7196('0x20')]=_0x5c128f[_0x7196('0x20')];this[_0x7196('0x21')]=_0x5c128f['callbackat'];this[_0x7196('0x22')]=_0x5c128f['recallme'];this[_0x7196('0x23')]=_0x5c128f[_0x7196('0x23')];this[_0x7196('0x24')]=_0x5c128f[_0x7196('0x24')];this[_0x7196('0x25')]=_[_0x7196('0x2')](_0x5c128f['Agent'])?_0x5c128f['UserId']:_0x5c128f[_0x7196('0xa')]['id'];this[_0x7196('0x26')]=_0x5c128f[_0x7196('0x26')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x7196('0x27')][_0x7196('0x28')]=function(){return util[_0x7196('0xd')]('\x22%s\x22\x20<%s>',this[_0x7196('0xf')],this['number']);};module[_0x7196('0x29')]=Action; \ No newline at end of file +var _0xed3c=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','type','campaigntype','queue','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','Contact','phone'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xed3c,0x1a6));var _0xced3=function(_0x1876b2,_0x5d0225){_0x1876b2=_0x1876b2-0x0;var _0x9fb1e0=_0xed3c[_0x1876b2];return _0x9fb1e0;};'use strict';var util=require(_0xced3('0x0'));var _=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));function checkNameSurname(_0x3fb5e1,_0x558ee8,_0xfdc1ed){var _0x144d14='';if(!_[_0xced3('0x3')](_0x558ee8)&&'string'===typeof _0x558ee8){_0x144d14+=_0x558ee8;}if(!_['isNil'](_0xfdc1ed)&&_0xced3('0x4')===typeof _0xfdc1ed){_0x144d14+='\x20'+_0xfdc1ed;}if(_0x144d14!==''){return _0x144d14;}return _0x3fb5e1;}function Action(_0x1ada18,_0x2f92f8,_0x1cd694,_0x4795cd,_0x510164){this['uniqueid']=_0x1cd694||undefined;this[_0xced3('0x5')]=_0x1ada18['id'];this['queue']=_0x2f92f8['name'];this['type']=_0x2f92f8[_0xced3('0x6')];this[_0xced3('0x7')]=_0xced3('0x8');this[_0xced3('0x9')]=![];this[_0xced3('0xa')]=_['isNil'](_0x1ada18[_0xced3('0xb')])?undefined:_0x1ada18[_0xced3('0xb')][_0xced3('0xc')];this['channelAgent']=this[_0xced3('0xa')]?util[_0xced3('0xd')](_0xced3('0xe'),this[_0xced3('0xa')]):_0x4795cd||undefined;this[_0xced3('0xf')]=checkNameSurname(_0x1ada18[_0xced3('0x10')][_0xced3('0x11')],_0x1ada18['Contact'][_0xced3('0x12')],_0x1ada18['Contact'][_0xced3('0x13')]);this[_0xced3('0x14')]=_0x1ada18[_0xced3('0x14')]||![];this[_0xced3('0x15')]=_0x1ada18['phone'];this[_0xced3('0x16')]=_0x1ada18[_0xced3('0x16')];this['countbusyretry']=_0x1ada18[_0xced3('0x17')]||0x0;this[_0xced3('0x18')]=_0x1ada18[_0xced3('0x18')]||0x0;this[_0xced3('0x19')]=_0x1ada18['countnoanswerretry']||0x0;this[_0xced3('0x1a')]=(_0x1ada18['countbusyretry']||0x0)+(_0x1ada18[_0xced3('0x18')]||0x0)+(_0x1ada18[_0xced3('0x19')]||0x0)+(_0x1ada18[_0xced3('0x1b')]||0x0)+(_0x1ada18[_0xced3('0x1c')]||0x0)+(_0x1ada18[_0xced3('0x1d')]||0x0)+(_0x1ada18[_0xced3('0x1e')]||0x0)+(_0x1ada18[_0xced3('0x1f')]||0x0);this[_0xced3('0x1b')]=_0x1ada18[_0xced3('0x1b')]||0x0;this[_0xced3('0x1c')]=_0x1ada18[_0xced3('0x1c')]||0x0;this['countabandonedretry']=_0x1ada18['countabandonedretry']||0x0;this['countmachineretry']=_0x1ada18[_0xced3('0x1e')]||0x0;this[_0xced3('0x1f')]=_0x1ada18[_0xced3('0x1f')]||0x0;this['callback']=_0x1ada18[_0xced3('0x20')];this[_0xced3('0x21')]=_0x1ada18['callbackuniqueid'];this['callbackat']=_0x1ada18[_0xced3('0x22')];this[_0xced3('0x23')]=_0x1ada18[_0xced3('0x23')];this[_0xced3('0x24')]=_0x1ada18['ContactId'];this[_0xced3('0x25')]=_0x1ada18[_0xced3('0x25')];this['UserId']=_[_0xced3('0x3')](_0x1ada18['Agent'])?_0x1ada18[_0xced3('0x26')]:_0x1ada18[_0xced3('0xb')]['id'];this[_0xced3('0x27')]=_0x1ada18[_0xced3('0x27')];this[_0xced3('0x28')]='';this['originatecalleridname']='';}Action['prototype'][_0xced3('0x29')]=function(){return util['format'](_0xced3('0x2a'),this[_0xced3('0xf')],this['number']);};module[_0xced3('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 527eb26..2aef509 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 _0xc53e=['unmonitored','unlock','pick','execRun','recallme','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','execCall','SIP/%s/%s%s','dialPrefix','trim','phone','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','addVariables','Contact','assign','merge','toLowerVariables','variables','OriginateError','channel','syncOriginateResponse','logLookAgent','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','callProgressDetectingCustomer','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','filterKey','variable','addVariable','value','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','socket.io-emitter','tail','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','preview','dialMethod','booked','type','clearZombieChannels','outbound','setMessage','recallMe','enqueue','[clearZombieChannels][talking]','Queue','queue','dialAnswer','UserId','VoiceQueueId','Action','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','clearZombieChannel','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','[RecallMe]','catch','logger2','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','UNREACHABLE_TRUNK','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','countnosuchnumberretry','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','decrementTalkink','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','active','SIP/%s','status'];(function(_0x570602,_0x4878b4){var _0x5f4573=function(_0x5a1cf1){while(--_0x5a1cf1){_0x570602['push'](_0x570602['shift']());}};_0x5f4573(++_0x4878b4);}(_0xc53e,0x183));var _0xec53=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xc53e[_0x521929];return _0x632436;};'use strict';var util=require(_0xec53('0x0'));var _=require('lodash');var uuid=require(_0xec53('0x1'));var moment=require('moment');var Redis=require(_0xec53('0x2'));var config=require(_0xec53('0x3'));var logger=require(_0xec53('0x4'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0xec53('0x5'));var rpcDb=require(_0xec53('0x6'));var cmHopperAdditionalPhone=require(_0xec53('0x7'));var Action=require(_0xec53('0x8'));var ut=require(_0xec53('0x9'));var utils=require('../dialer/utils');config[_0xec53('0xa')]=_[_0xec53('0xb')](config[_0xec53('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xec53('0xc'))(new Redis(config[_0xec53('0xa')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2388a2){this[_0xec53('0xd')]=this[_0xec53('0xd')]?this[_0xec53('0xd')]['finally'](_0x2388a2):_0x2388a2();};function Preview(_0x2eb1b0){this[_0xec53('0xe')]=new Sequence();this['campaignsPreview']=_0x2eb1b0[_0xec53('0xf')];this[_0xec53('0x10')]=_0x2eb1b0[_0xec53('0x10')];this[_0xec53('0x11')]={};this['agents']=_0x2eb1b0[_0xec53('0x12')];this[_0xec53('0x13')]=0x0;ami['on'](_0xec53('0x14'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this[_0xec53('0x15')][_0xec53('0x16')](this));ami['on'](_0xec53('0x17'),this[_0xec53('0x18')][_0xec53('0x16')](this));ami['on'](_0xec53('0x19'),this['syncDialEnd'][_0xec53('0x16')](this));ami['on'](_0xec53('0x1a'),this[_0xec53('0x1b')]['bind'](this));ami['on'](_0xec53('0x1c'),this[_0xec53('0x1d')][_0xec53('0x16')](this));ami['on'](_0xec53('0x1e'),this['syncAttendedTransfer'][_0xec53('0x16')](this));ami['on']('blindtransfer',this[_0xec53('0x1f')]['bind'](this));this['loopCampaigns'](this[_0xec53('0x20')]);}function emit(_0x512c4b,_0x422270,_0x58ad73){io['to'](_0x512c4b)['emit'](_0x422270,_0x58ad73);}function emitVoiceQueueChannelRemove(_0x59c7af){logger[_0xec53('0x21')](_0xec53('0x22'),JSON[_0xec53('0x23')](_0x59c7af));emit(util[_0xec53('0x24')](_0xec53('0x25'),_0x59c7af[_0xec53('0x26')]),'voice_queue_channel:remove',_0x59c7af);io[_0xec53('0x27')](_0xec53('0x28'),_0x59c7af);}function notSendMessagesQueue(_0x3064aa){if(_0x3064aa[_0xec53('0x29')]){if(_0x3064aa[_0xec53('0x2a')]===0x0&&_0x3064aa[_0xec53('0x2b')]===0x0){_0x3064aa[_0xec53('0x29')]=![];_0x3064aa[_0xec53('0x2c')]=0x0;_0x3064aa[_0xec53('0x2d')]=0x0;_0x3064aa[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x30')];ut[_0xec53('0x31')](_0xec53('0x32'),_0x3064aa[_0xec53('0x26')]+_0xec53('0x33'));}else{_0x3064aa[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x34')];ut[_0xec53('0x31')](_0xec53('0x32'),_0x3064aa[_0xec53('0x26')]+_0xec53('0x35'));}}}Preview[_0xec53('0x36')][_0xec53('0x37')]=function(){var _0x366d30=this;setInterval(function(){_0x366d30['syncCampaigns']();},0x7cf);};Preview[_0xec53('0x36')][_0xec53('0x38')]=function(){var _0x3ef90a=this[_0xec53('0x20')];this[_0xec53('0x13')]+=0x1;for(var _0x46a682 in _0x3ef90a){if(_0x3ef90a[_0xec53('0x39')](_0x46a682)&&(_0x3ef90a[_0x46a682]['dialMethod']===_0xec53('0x3a')||_0x3ef90a[_0x46a682][_0xec53('0x3b')]===_0xec53('0x3c'))&&_0x3ef90a[_0x46a682][_0xec53('0x3d')]==='outbound'){if(this[_0xec53('0x13')]>0x7){this[_0xec53('0x13')]=0x0;this[_0xec53('0x3e')]();}}if(_0x3ef90a[_0xec53('0x39')](_0x46a682)&&_0x3ef90a[_0x46a682][_0xec53('0x3b')]==='preview'&&_0x3ef90a[_0x46a682][_0xec53('0x3d')]===_0xec53('0x3f')){if(_0x3ef90a[_0x46a682]['dialActive']){this[_0xec53('0x40')](_0x3ef90a[_0x46a682]);if(_0x3ef90a[_0x46a682]['dialPreviewAutoRecallMe'])this[_0xec53('0x41')](_0x3ef90a[_0x46a682]);}else{notSendMessagesQueue(_0x3ef90a[_0x46a682]);}}}};Preview[_0xec53('0x36')]['clearZombieChannel']=function(_0x364aca){var _0x43a9e3=this;this[_0xec53('0xe')][_0xec53('0x42')](function(){if(!_['isNil'](_0x43a9e3[_0xec53('0x11')][_0x364aca])){loggerAction[_0xec53('0x21')](_0xec53('0x43'),_0x364aca,_0xec53('0x44'),_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')],'originated:\x20',JSON['stringify'](_0x43a9e3[_0xec53('0x20')][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]][_0xec53('0x2a')]),'pTalking:\x20',JSON[_0xec53('0x23')](_0x43a9e3[_0xec53('0x20')][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]][_0xec53('0x2b')]),JSON[_0xec53('0x23')](_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x46')]),JSON['stringify'](_['pick'](_0x43a9e3[_0xec53('0x11')][_0x364aca],['contactId',_0xec53('0x47'),_0xec53('0x48'),'ListId'])));return ami[_0xec53('0x49')]({'action':'status','channel':_0x43a9e3[_0xec53('0x11')][_0x364aca]['channel']})['catch'](function(_0x3bb35c){if(_0x3bb35c[_0xec53('0x2e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x43a9e3['actions'][_0x364aca]){ut['updateOriginated'](_0x43a9e3['campaignsPreview'][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]],'[clearZombieChannel]');if(_0x43a9e3['actions'][_0x364aca][_0xec53('0x46')]===!![]){ut['decrementTalkink'](_0x43a9e3[_0xec53('0x20')][_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]],_0xec53('0x4a'));ut[_0xec53('0x4b')](_0xec53('0x4c')+_0x364aca,_0x43a9e3[_0xec53('0x11')][_0x364aca][_0xec53('0x45')]);}ut[_0xec53('0x4b')](_0xec53('0x4d')+_0x364aca,_0x43a9e3[_0xec53('0x11')][_0x364aca]['queue']);delete _0x43a9e3['actions'][_0x364aca];}},0x2328);}});}});};Preview[_0xec53('0x36')][_0xec53('0x3e')]=function(){var _0xd192df=this;loggerAction[_0xec53('0x21')](_0xec53('0x4e'),_['size'](this[_0xec53('0x11')]));for(var _0x1fb939 in this[_0xec53('0x11')]){if(_0xd192df[_0xec53('0x11')][_0xec53('0x39')](_0x1fb939)){_0xd192df[_0xec53('0x4f')](_0x1fb939);}}};Preview['prototype']['recallMe']=function(_0x127675){var _0x5bf7d1=this;rpcDb[_0xec53('0x50')](_0x127675['id'],ut[_0xec53('0x51')](this[_0xec53('0x12')]))[_0xec53('0x52')](function(_0x396587){if(!_[_0xec53('0x53')](_0x396587)){for(var _0x2af028=0x0;_0x2af028<_0x396587[_0xec53('0x54')];_0x2af028+=0x1){if(ut[_0xec53('0x55')](_0x396587[_0x2af028][_0xec53('0x56')])<_0x127675[_0xec53('0x57')]*0x3c){if(_0x396587[_0x2af028][_0xec53('0x58')]&&!_0x396587[_0x2af028][_0xec53('0x58')]['voicePause']){_0x5bf7d1[_0xec53('0x59')](_0x396587[_0x2af028]['id'])[_0xec53('0x52')](ut['logger2'](_0xec53('0x5a')))[_0xec53('0x5b')](ut[_0xec53('0x5c')](_0xec53('0x5a')));}else{rpcDb[_0xec53('0x5d')](_0x396587[_0x2af028]['id']);}}else{var _0x1b1dfb=new Action(_0x396587[_0x2af028],_0x127675);_0x1b1dfb[_0xec53('0x5e')]=moment()[_0xec53('0x24')]('YYYY-MM-DD\x20HH:mm:ss');_0x127675[_0xec53('0x5f')]+=0x1;ut[_0xec53('0x60')](_0x1b1dfb,0x17,_0xec53('0x61'));if(_0x127675[_0xec53('0x62')]){rpcDb[_0xec53('0x63')](ut['createBody'](_0x396587[_0x2af028]));rpcDb[_0xec53('0x64')](_0x1b1dfb,_0xec53('0x65'));}else{ut[_0xec53('0x60')](_0x1b1dfb,0x16,_0xec53('0x66'));rpcDb[_0xec53('0x64')](_0x1b1dfb,_0xec53('0x67'));rpcDb[_0xec53('0x68')](_0x1b1dfb,'[HistoryRecallClose]');}}}}})[_0xec53('0x5b')](ut[_0xec53('0x5c')]('[getContactRecallMe]'));};Preview[_0xec53('0x36')][_0xec53('0x40')]=function(_0x22404a){_0x22404a[_0xec53('0x29')]=!![];if(ut[_0xec53('0x69')](_0x22404a[_0xec53('0x6a')])){_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x6b')];}else if(!ut[_0xec53('0x6c')](_0x22404a[_0xec53('0x6d')])){_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')]['INACTIVE'];}else if(!this[_0xec53('0x6e')](_0x22404a['Trunk'])){if(!this[_0xec53('0x6e')](_0x22404a['TrunkBackup'])){_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0x6f')];}else{_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')]['ACTIVE'];}}else{_0x22404a[_0xec53('0x2e')]=utils[_0xec53('0x2f')]['ACTIVE'];}};Preview['prototype']['callProgressDetectingCustomer']=function(_0x115798,_0x212e72,_0x134053){var _0x291ab0=this;var _0x12f8ef=this[_0xec53('0x11')][_0x212e72];var _0x5432e1=this[_0xec53('0x20')][_0x12f8ef[_0xec53('0x45')]];var _0x1adf89;var _0x21c93f=![];var _0x135225=0x2;var _0x3440a5=0x3;if(_0x5432e1){switch(_0x134053){case'1':_0x5432e1[_0xec53('0x70')]+=0x1;_0x12f8ef['countnosuchnumberretry']+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x0,_0xec53('0x73'));ami[_0xec53('0x27')]('custom:agentnosuchnumber',ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x75')));rpcDb['createCustomerHistory'](_0x12f8ef,'[callProgressDetectingCustomer][logNoSuch]');_0x291ab0[_0xec53('0x76')](_0x12f8ef,'0',_0x5432e1)[_0xec53('0x52')](function(_0x1c8e52){_0x21c93f=_0x1c8e52[_0xec53('0x77')]==0x1;_0x135225=_0x5432e1[_0xec53('0x78')];_0x3440a5=_0x5432e1[_0xec53('0x79')];if(!_0x21c93f){if(ut['totalGlobal'](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0x7d'));}else{if(_0x12f8ef['countnosuchnumberretry']>=_0x5432e1[_0xec53('0x7e')]){rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0x7d'));}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,'countnosuchnumberretry',_0x5432e1[_0xec53('0x78')]),_0x12f8ef['unlockAgent'],_0x12f8ef[_0xec53('0x81')]);}}delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];}else{_0x12f8ef['countnosuchnumberretry']++;logger[_0xec53('0x21')]('actioncountonusuch',_0x12f8ef[_0xec53('0x83')]);logger['info']('id',_0x12f8ef[_0xec53('0x84')]);_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countnosuchnumberretry':_0x12f8ef['countnosuchnumberretry']}})[_0xec53('0x52')](function(){_0x291ab0['swapAdditionalPhones'](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0x86'):var _0x155f1f=moment()[_0xec53('0x24')](_0xec53('0x87'));_0x12f8ef[_0xec53('0x88')]=_0x155f1f;_0x12f8ef['answertime']=_0x155f1f;_0x12f8ef['dialAnswer']=!![];_0x5432e1[_0xec53('0x2b')]+=0x1;logger[_0xec53('0x21')]('[syncHangup][talking][increment]',_0x12f8ef['uniqueid'],'\x20Queue',_0x5432e1['name'],'pTalking:\x20',_0x5432e1[_0xec53('0x2b')]);ami[_0xec53('0x27')](_0xec53('0x89'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x8a'),this[_0xec53('0x20')][_0x12f8ef[_0xec53('0x45')]]));if(_0x5432e1['acw']){ami[_0xec53('0x27')](_0xec53('0x8b'),ut[_0xec53('0x8c')](_0x12f8ef));}break;case'16':ami['emit'](_0xec53('0x8d'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x8e'),this[_0xec53('0x20')][_0x12f8ef[_0xec53('0x45')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x12f8ef,_0xec53('0x8e')));_0x5432e1[_0xec53('0x8f')]+=0x1;_0x5432e1['total']+=0x1;_0x5432e1[_0xec53('0x90')]+=0x1;ut['decrementTalkink'](_0x5432e1,'[16]');_0x12f8ef['countglobal']=ut[_0xec53('0x72')](_0x12f8ef);ut['logCustomer'](_0x12f8ef,0x4,_0xec53('0x91'));rpcDb[_0xec53('0x64')](_0x12f8ef,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0x92'));rpcDb['crateCustomerReportQueue'](_0x12f8ef);_0x5432e1['sumDuration']+=_0x12f8ef[_0xec53('0x93')];_0x5432e1['sumBillable']+=_0x12f8ef[_0xec53('0x93')];logger[_0xec53('0x21')](_0xec53('0x94'),_0x12f8ef[_0xec53('0x95')],_0xec53('0x96'),_0x5432e1[_0xec53('0x26')],_0xec53('0x97'),_0x5432e1[_0xec53('0x2b')]);delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];break;case'BUSY':_0x5432e1[_0xec53('0x98')]+=0x1;_0x12f8ef[_0xec53('0x99')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x5,_0xec53('0x9a'));_0x135225=_0x5432e1['dialBusyRetryFrequency'];_0x3440a5=_0x5432e1[_0xec53('0x79')];ami[_0xec53('0x27')]('custom:agentbusy',ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0x9b')));rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0x9c'));_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'5',_0x5432e1)[_0xec53('0x52')](function(_0x50efa9){_0x21c93f=_0x50efa9[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut['cloneAction'](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x12f8ef[_0xec53('0x99')]>=_0x5432e1[_0xec53('0x9d')]){rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0x9c'));}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0x99'),_0x5432e1[_0xec53('0x9e')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef['activeContact']);}}}else{_0x12f8ef[_0xec53('0x99')]++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countbusyretry':_0x12f8ef[_0xec53('0x99')]}})[_0xec53('0x52')](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xa1'):_0x5432e1[_0xec53('0xa2')]+=0x1;_0x12f8ef[_0xec53('0xa3')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x3,_0xec53('0xa4'));_0x135225=_0x5432e1[_0xec53('0xa5')];_0x3440a5=_0x5432e1[_0xec53('0x79')];var _0x8e0d30=ut[_0xec53('0xa6')](_0x12f8ef,_0x5432e1);ami[_0xec53('0x27')](_0xec53('0xa7'),_0x8e0d30);rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0xa8'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'3',_0x5432e1)['then'](function(_0x486f42){_0x21c93f=_0x486f42['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb['createCustomerFinal'](_0x1adf89,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x12f8ef['countnoanswerretry']>=_0x5432e1[_0xec53('0xa9')]){rpcDb[_0xec53('0x68')](_0x12f8ef,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0xa3'),_0x5432e1[_0xec53('0xa5')]),_0x12f8ef['unlockAgent'],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef['countnoanswerretry']++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef['idContact'],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})['then'](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xaa'):_0x5432e1[_0xec53('0xab')]+=0x1;_0x12f8ef['countcongestionretry']+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut['logCustomer'](_0x12f8ef,0x8,_0xec53('0xac'));_0x135225=_0x5432e1[_0xec53('0xad')];_0x3440a5=_0x5432e1[_0xec53('0x79')];ami[_0xec53('0x27')](_0xec53('0xae'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0xaf')));rpcDb['createCustomerHistory'](_0x12f8ef,_0xec53('0xb0'));_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'8',_0x5432e1)[_0xec53('0x52')](function(_0x3c2311){_0x21c93f=_0x3c2311['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1['dialGlobalMaxRetry']){_0x1adf89=ut['cloneAction'](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xb1'));}else{if(_0x12f8ef[_0xec53('0xb2')]>=_0x5432e1['dialCongestionMaxRetry']){rpcDb[_0xec53('0x68')](_0x12f8ef,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,'countcongestionretry',_0x5432e1[_0xec53('0x9e')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef['countcongestionretry']++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countcongestionretry':_0x12f8ef['countcongestionretry']}})['then'](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xb3'):_0x5432e1['outboundRejectCallsDay']+=0x1;_0x12f8ef[_0xec53('0xb4')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x14,'AgentReject');_0x135225=_0x5432e1[_0xec53('0xb5')];_0x3440a5=_0x5432e1['callAdditionalPhoneAfterMin'];ami[_0xec53('0x27')](_0xec53('0xb6'),ut['buildObj'](_0x12f8ef,_0xec53('0xb7')));rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0xb8'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'20',_0x5432e1)[_0xec53('0x52')](function(_0x5f29c1){_0x21c93f=_0x5f29c1[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut['totalGlobal'](_0x12f8ef)>=_0x5432e1['dialGlobalMaxRetry']){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0x14,_0xec53('0xb9'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xba'));}else{if(_0x12f8ef[_0xec53('0xb4')]>=_0x5432e1[_0xec53('0xbb')]){rpcDb['createCustomerFinal'](_0x12f8ef,_0xec53('0xba'));}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0xb4'),_0x5432e1[_0xec53('0xb5')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef[_0xec53('0xa3')]++;_0x291ab0['incrementPreviewCounters']({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countnoanswerretry':_0x12f8ef['countnoanswerretry']}})[_0xec53('0x52')](function(){_0x291ab0['swapAdditionalPhones'](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case _0xec53('0xbc'):_0x5432e1['outboundAbandonedCallsDay']+=0x1;_0x12f8ef[_0xec53('0xbd')]+=0x1;_0x12f8ef['countglobal']=ut['totalGlobal'](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0xb,_0xec53('0xbe'));rpcDb['createCustomerHistory'](_0x12f8ef,_0xec53('0xbf'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'11',_0x5432e1)[_0xec53('0x52')](function(_0x1a774e){_0x21c93f=_0x1a774e[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,'Global');rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xbf'));}else{if(_0x12f8ef[_0xec53('0xc0')]>=_0x5432e1[_0xec53('0xc1')]){rpcDb['createCustomerFinal'](_0x12f8ef,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xec53('0x7f')](ut[_0xec53('0x80')](_0x12f8ef,_0xec53('0xbd'),_0x5432e1[_0xec53('0xc2')]),_0x12f8ef[_0xec53('0x9f')],_0x12f8ef[_0xec53('0x81')]);}}}else{_0x12f8ef[_0xec53('0xa3')]++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef[_0xec53('0x84')],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})[_0xec53('0x52')](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});break;case'18':_0x5432e1[_0xec53('0xc3')]+=0x1;_0x12f8ef[_0xec53('0xc4')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x12,_0x115798[_0xec53('0xc5')]||_0x115798[_0xec53('0xc6')]);ami[_0xec53('0x27')](_0xec53('0xc7'),ut['buildObj'](_0x12f8ef,_0xec53('0xc8')));rpcDb[_0xec53('0x64')](_0x12f8ef,_0xec53('0xc9'));_0x291ab0[_0xec53('0x76')](_0x12f8ef,'18',_0x5432e1)[_0xec53('0x52')](function(_0x1084cd){_0x21c93f=_0x1084cd[_0xec53('0x77')]==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0x12,_0xec53('0x7c'));rpcDb['createCustomerFinal'](_0x1adf89,_0xec53('0xc9'));}else{rpcDb[_0xec53('0x68')](_0x12f8ef,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x12f8ef['countnoanswerretry']++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef['idContact'],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})[_0xec53('0x52')](function(){_0x291ab0['swapAdditionalPhones'](_0x12f8ef,_0x135225,_0x3440a5)['then'](function(){});});}});delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];break;case'19':_0x5432e1[_0xec53('0xc3')]+=0x1;_0x12f8ef[_0xec53('0x71')]=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0x13,_0x115798[_0xec53('0xc5')]||_0x115798[_0xec53('0xc6')]);ami[_0xec53('0x27')](_0xec53('0xc7'),ut[_0xec53('0x74')](_0x12f8ef,_0xec53('0xc8')));rpcDb['createCustomerHistory'](_0x12f8ef,_0xec53('0xca'));_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'18',_0x5432e1)['then'](function(_0x254935){_0x21c93f=_0x254935['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut['cloneAction'](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xca'));}else{rpcDb['createCustomerFinal'](_0x12f8ef,'[callProgressDetectingCustomer][machine]');}}else{_0x12f8ef[_0xec53('0xa3')]++;_0x291ab0[_0xec53('0x85')]({'id':_0x12f8ef['idContact'],'field':{'countnoanswerretry':_0x12f8ef[_0xec53('0xa3')]}})[_0xec53('0x52')](function(){_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});});}});delete this[_0xec53('0x11')][_0x115798[_0xec53('0x82')]];break;default:if(_0x12f8ef['dialAnswer']){ut[_0xec53('0xcb')](_0x5432e1,_0xec53('0xcc'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5432e1[_0xec53('0x26')],_0x115798);}_0x5432e1[_0xec53('0xc3')]+=0x1;_0x12f8ef['countglobal']=ut[_0xec53('0x72')](_0x12f8ef);ut[_0xec53('0x60')](_0x12f8ef,0xc,_0x115798['cause-txt']||_0x115798[_0xec53('0xc6')]);_0x135225=_0x5432e1[_0xec53('0xb5')];_0x3440a5=_0x5432e1['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x12f8ef,'[callProgressDetectingCustomer][logUnknown]');_0x291ab0['verifyAdditionalPhones'](_0x12f8ef,'20',_0x5432e1)[_0xec53('0x52')](function(_0x2f3613){_0x21c93f=_0x2f3613['additional']==0x1;if(!_0x21c93f){if(ut[_0xec53('0x72')](_0x12f8ef)>=_0x5432e1[_0xec53('0x7a')]){_0x1adf89=ut[_0xec53('0x7b')](_0x12f8ef,0xf,_0xec53('0x7c'));rpcDb[_0xec53('0x68')](_0x1adf89,_0xec53('0xcd'));}else{rpcDb[_0xec53('0x68')](_0x12f8ef,_0xec53('0xcd'));}delete this['actions'][_0x115798['linkedid']];}else{_0x291ab0[_0xec53('0xa0')](_0x12f8ef,_0x135225,_0x3440a5)[_0xec53('0x52')](function(){});}});}if(!(_0x12f8ef[_0xec53('0x46')]&&_0x134053==='16')){ut[_0xec53('0xce')](_0x5432e1,'[callProgressDetectingCustomer]');logger[_0xec53('0x21')]('[originated][decrement][callProgressDetectingCustomer]',_0x12f8ef['uniqueid'],_0xec53('0x96'),_0x5432e1[_0xec53('0x26')],_0xec53('0xcf'),_0x5432e1['originated']);}if(_0x134053!==_0xec53('0x86')){delete this['actions'][_0x115798[_0xec53('0x82')]];delete this[_0xec53('0x11')][_0x115798[_0xec53('0xd0')]];}_0x5432e1[_0xec53('0xd1')]=!![];}};Preview['prototype'][_0xec53('0xd2')]=function(_0x17b482,_0x497f94,_0xd3cbb){if(_['isUndefined'](_0x497f94)&&_0xec53('0xd3')!==typeof _0x497f94){return;}if(_[_0xec53('0xd4')](_0xd3cbb)&&'object'!==typeof _0xd3cbb){return;}switch(_0xd3cbb[_0xec53('0xd5')]){case'0':ut[_0xec53('0xd6')](_0x17b482,0x0,'NoSuchNumber');rpcDb[_0xec53('0xd7')](_0x17b482,_0xec53('0xd8'));break;case'3':ut['logAgent'](_0x17b482,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x17b482,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xec53('0xd6')](_0x17b482,0x5,_0xec53('0x9a'));rpcDb[_0xec53('0xd7')](_0x17b482,_0xec53('0xd9'));break;case'8':ut['logAgent'](_0x17b482,0x8,_0xec53('0xac'));rpcDb['createAgentHistory'](_0x17b482,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xec53('0xd6')](_0x17b482,0x16,'AnswerAGI');rpcDb[_0xec53('0xd7')](_0x17b482,_0xec53('0xda'));break;default:ut['logAgent'](_0x17b482,0xc,_0xd3cbb[_0xec53('0xd5')]);rpcDb['createAgentHistory'](_0x17b482,_0xec53('0xdb'));}ut['updateOriginated'](_0x497f94,_0xec53('0xdc'));logger['info'](_0xec53('0xdd'),_0x17b482[_0xec53('0x95')],_0xec53('0x96'),_0x497f94[_0xec53('0x26')],_0xec53('0xcf'),_0x497f94['originated']);delete this['actions'][_0x17b482['uniqueid']];};Preview[_0xec53('0x36')][_0xec53('0x76')]=function(_0x2f425c,_0xd68563,_0x562caa){return cmHopperAdditionalPhone[_0xec53('0x76')](_0x2f425c,_0xd68563,_0x562caa)[_0xec53('0x5b')](logger[_0xec53('0x21')](_0xec53('0xde')));};Preview[_0xec53('0x36')]['swapAdditionalPhones']=function(_0x23378b,_0xaacf10,_0x1cece6){return cmHopperAdditionalPhone[_0xec53('0xa0')](_0x23378b,_0xaacf10,_0x1cece6)[_0xec53('0x5b')](logger[_0xec53('0x21')](_0xec53('0xdf')));};Preview['prototype'][_0xec53('0x85')]=function(_0x3b51eb){return Promise[_0xec53('0xe0')]()[_0xec53('0x52')](cmHopperAdditionalPhone[_0xec53('0x85')](_0x3b51eb))[_0xec53('0x5b')](logger[_0xec53('0x21')](_0xec53('0xe1')));};Preview['prototype']['checkInBlack']=function(_0x570326,_0x1bfe3f,_0x1516e3,_0x44d677,_0x3d0fe){var _0x5a6340=this;return new Promise(function(_0x137914,_0x3b9226){if(_[_0xec53('0x53')](_0x1bfe3f)||_[_0xec53('0x53')](_0x1bfe3f['Contact'])||_[_0xec53('0x53')](_0x1bfe3f['phone'])||_['isNil'](_0x1bfe3f['VoiceQueueId'])){_0x3b9226(ut[_0xec53('0x2e')](_0xec53('0xe2'),_0x44d677,_0x3d0fe));return;}var _0x4295c9=uuid['v4']();var _0x32ef05=_0x5a6340[_0xec53('0x20')][_0x1bfe3f[_0xec53('0x44')][_0xec53('0x26')]];var _0x392968=_0x1516e3?_0x5a6340['agents'][_0x1516e3]['id']:undefined;_0x5a6340[_0xec53('0x11')][_0x4295c9]=new Action(_0x1bfe3f,_0x32ef05,_0x4295c9,_0x1516e3,_0x392968);var _0x163b96=_0x5a6340['actions'][_0x4295c9];_0x163b96[_0xec53('0x9f')]=_0x44d677;_0x163b96[_0xec53('0x81')]=_0x3d0fe;_0x163b96[_0xec53('0xe3')]=_0x1516e3;if(_[_0xec53('0xe4')](_0x570326)){_0x5a6340['execCall'](_0x163b96,_0x32ef05,_0x1bfe3f,_0x1516e3)[_0xec53('0x52')](function(_0x9fcc1c){logger['info'](_0xec53('0xe5'),_0xec53('0xe6')+_0x163b96['queue']+_0xec53('0xe7')+_0x163b96['idContact'],JSON[_0xec53('0x23')](_0x9fcc1c));ami['emit'](_0xec53('0xe8'),ut[_0xec53('0x74')](_0x163b96,_0xec53('0xe9'),_0x5a6340[_0xec53('0x20')][_0x163b96[_0xec53('0x45')]]));_0x137914(ut[_0xec53('0x2e')](_0xec53('0xea')));})[_0xec53('0x5b')](function(_0xb3591){ut[_0xec53('0x31')](_0xec53('0xeb'),_0xb3591);_0x3b9226(ut[_0xec53('0x2e')](_0xec53('0xec'),_0x44d677,_0x3d0fe));});}else{_0x32ef05['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x163b96);rpcDb[_0xec53('0xed')](_0x163b96,'[Blacklist][error]');delete _0x5a6340[_0xec53('0x11')][_0x4295c9];_0x3b9226(ut[_0xec53('0x2e')]('Contact\x20in\x20black\x20List',_0x44d677,_0x3d0fe));}});};Preview[_0xec53('0x36')][_0xec53('0x6e')]=function(_0x215c7b){return!_[_0xec53('0x53')](_0x215c7b)&&!_[_0xec53('0x53')](_0x215c7b[_0xec53('0x26')])&&!_['isNil'](_0x215c7b[_0xec53('0xee')])&&_0x215c7b['active']&&!_['isNil'](this['trunks'][util['format'](_0xec53('0xef'),_0x215c7b[_0xec53('0x26')])])&&!_[_0xec53('0x53')](this[_0xec53('0x10')][util[_0xec53('0x24')]('SIP/%s',_0x215c7b[_0xec53('0x26')])]['status'])&&(this[_0xec53('0x10')][util['format'](_0xec53('0xef'),_0x215c7b['name'])]['status']==='reachable'||this[_0xec53('0x10')][util[_0xec53('0x24')](_0xec53('0xef'),_0x215c7b[_0xec53('0x26')])][_0xec53('0xf0')]===_0xec53('0xf1'));};Preview[_0xec53('0x36')][_0xec53('0x59')]=function(_0x5b5fe3,_0x327d4a){return this['execRun'](_0x5b5fe3,_0x327d4a)[_0xec53('0x52')](function(_0x3ee66a){return _['pick'](_0x3ee66a,[_0xec53('0x2e')]);})[_0xec53('0x5b')](function(_0x2a4a23){if(_0x2a4a23[_0xec53('0xf2')]){rpcDb['unlockContact'](_0x5b5fe3);}if(_0x2a4a23[_0xec53('0xee')]){rpcDb[_0xec53('0x5d')](_0x5b5fe3);}throw _[_0xec53('0xf3')](_0x2a4a23,[_0xec53('0x2e')]);});};Preview[_0xec53('0x36')][_0xec53('0xf4')]=function(_0x31cfb8,_0x366965){var _0x11fa68=this;var _0x5e53a7,_0x1e1a17;return rpcDb['getContactPreview'](_0x31cfb8)[_0xec53('0x52')](function(_0x2d37a3){if(!_[_0xec53('0x53')](_0x2d37a3[0x0])){_0x1e1a17=_0x2d37a3[0x0]['recallme']?![]:!![];_0x5e53a7=_0x2d37a3[0x0][_0xec53('0xf5')]?!![]:![];_0x5e53a7=_0x366965?!![]:_0x5e53a7;}var _0x45099f=_0x11fa68['validateContact'](_0x2d37a3);if(_0x45099f[_0xec53('0xf6')]){rpcDb[_0xec53('0xf7')](_[_0xec53('0xf3')](_0x2d37a3[0x0],[_0xec53('0x48'),'phone']))[_0xec53('0x52')](function(_0x79151){_0x11fa68[_0xec53('0xf8')](_0x79151,_0x2d37a3[0x0],_0x366965,_0x1e1a17,_0x5e53a7)[_0xec53('0x52')](function(_0xbc0f25){return _0xbc0f25;})[_0xec53('0x5b')](function(_0x449489){throw _0x449489;});})[_0xec53('0x5b')](function(_0x4df892){ut[_0xec53('0x31')](_0xec53('0xf9'),_0x4df892);throw ut[_0xec53('0x2e')](_0xec53('0xfa'),_0x1e1a17,_0x5e53a7);});}else{throw ut[_0xec53('0x2e')](_0x45099f[_0xec53('0x2e')],_0x1e1a17,_0x5e53a7);}})['catch'](function(_0x25b43d){ut['logger'](_0xec53('0xfb'),_0x25b43d);throw ut[_0xec53('0x2e')]('Call\x20unsuccessful',![],!![]);});};Preview['prototype'][_0xec53('0xfc')]=function(_0x3b8d5b){if(_[_0xec53('0x53')](_0x3b8d5b)||_['isEmpty'](_0x3b8d5b)||!_[_0xec53('0x53')](_0x3b8d5b[0x0][_0xec53('0x58')])&&_[_0xec53('0x53')](_0x3b8d5b[0x0]['Agent'][_0xec53('0x26')])){ut[_0xec53('0x31')](_0xec53('0xfd'),_0x3b8d5b);return{'isValid':![],'message':_0xec53('0xfe')};}var _0x25df5a=this[_0xec53('0x20')][_0x3b8d5b[0x0][_0xec53('0x44')][_0xec53('0x26')]];_0x25df5a[_0xec53('0x2e')]=utils[_0xec53('0x2f')][_0xec53('0xff')];if(_[_0xec53('0x53')](_0x25df5a)){ut[_0xec53('0x31')](_0xec53('0x100'),_0x25df5a);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x25df5a[_0xec53('0x101')])){ut['logger'](_0xec53('0x102'),'campaign\x20Name:\x20'+_0x25df5a['name']+_0xec53('0x103'));if(!this[_0xec53('0x6e')](_0x25df5a[_0xec53('0x104')])){ut[_0xec53('0x31')](_0xec53('0x102'),_0x25df5a[_0xec53('0x26')]+_0xec53('0x105'));return{'isValid':![],'message':_0xec53('0x106')};}}if(!ut[_0xec53('0x6c')](_0x25df5a[_0xec53('0x6d')])){ut[_0xec53('0x31')](_0xec53('0x107'),_0x25df5a[_0xec53('0x26')]+_0xec53('0x108'));return{'isValid':![],'message':_0xec53('0x109')+_0x25df5a[_0xec53('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xec53('0x36')][_0xec53('0x10a')]=function(_0x4ec7c8,_0x3b8b57,_0xb2659b,_0x535ece){var _0x45a633=this;return new Promise(function(_0x390117,_0x185f44){var _0x324b94=_0x4ec7c8[_0xec53('0x95')];var _0x282465=_0x45a633[_0xec53('0x6e')](_0x3b8b57[_0xec53('0x101')])?util[_0xec53('0x24')](_0xec53('0x10b'),_0x3b8b57[_0xec53('0x101')][_0xec53('0x26')],_[_0xec53('0x53')](_0x3b8b57[_0xec53('0x10c')])?'':_0x3b8b57[_0xec53('0x10c')][_0xec53('0x10d')]()||'',_0x3b8b57['dialCutDigit']>0x0?_0xb2659b[_0xec53('0x10e')]['substring'](_0x3b8b57[_0xec53('0x10f')]):_0xb2659b['phone']):util[_0xec53('0x24')](_0xec53('0x10b'),_[_0xec53('0x53')](_0x3b8b57[_0xec53('0x104')])?_0x3b8b57[_0xec53('0x101')][_0xec53('0x26')]:_0x3b8b57[_0xec53('0x104')]['name'],_['isNil'](_0x3b8b57[_0xec53('0x10c')])?'':_0x3b8b57[_0xec53('0x10c')][_0xec53('0x10d')]()||'',_0x3b8b57[_0xec53('0x10f')]>0x0?_0xb2659b['phone'][_0xec53('0x110')](_0x3b8b57[_0xec53('0x10f')]):_0xb2659b[_0xec53('0x10e')]);var _0x303932=_0x45a633[_0xec53('0x6e')](_0x3b8b57['Trunk'])?ut[_0xec53('0x111')](_0x3b8b57[_0xec53('0x101')][_0xec53('0x112')],_0x3b8b57[_0xec53('0x113')],_0x3b8b57['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xec53('0x114')](_0x3b8b57[_0xec53('0x115')],_0x3b8b57[_0xec53('0x116')]):_0x3b8b57[_0xec53('0x115')]):ut[_0xec53('0x111')](_[_0xec53('0x53')](_0x3b8b57['TrunkBackup'])?_0x3b8b57[_0xec53('0x101')][_0xec53('0x112')]:_0x3b8b57['TrunkBackup']['callerid'],_0x3b8b57['dialOriginateCallerIdName'],_0x3b8b57[_0xec53('0x116')]>0x0?ut[_0xec53('0x114')](_0x3b8b57[_0xec53('0x115')],_0x3b8b57[_0xec53('0x116')]):_0x3b8b57[_0xec53('0x115')]);if(_0x303932){_0x4ec7c8[_0xec53('0x117')]=ut['extractCalleridName'](_0x303932);_0x4ec7c8[_0xec53('0x118')]=ut['extractCalleridNumber'](_0x303932);}var _0x42bc2e=ut[_0xec53('0x119')](_0x3b8b57,_0xb2659b,_0x282465,_0x303932,_0x324b94,_0x4ec7c8);var _0x5d0346=utils['setXMDContactVariables'](_0xb2659b[_0xec53('0x11a')]);Object[_0xec53('0x11b')](_0x42bc2e,_0x5d0346);_[_0xec53('0x11c')](_0x4ec7c8,ut[_0xec53('0x11d')](_0x42bc2e));_0x4ec7c8[_0xec53('0x5e')]=moment()[_0xec53('0x24')](_0xec53('0x87'));_0x3b8b57[_0xec53('0x11e')]=_0x42bc2e;var _0x49cf28=ut['variablesAction'](_0x4ec7c8,_0x3b8b57,_0x42bc2e,_0x4ec7c8[_0xec53('0x81')],_0x535ece);return ami[_0xec53('0x49')](_0x49cf28)[_0xec53('0x52')](function(_0x1da10c){_0x3b8b57[_0xec53('0x2a')]+=0x1;logger[_0xec53('0x21')]('[originated][increment]',_0x324b94,_0xec53('0x96'),_0x3b8b57[_0xec53('0x26')],_0xec53('0xcf'),_0x3b8b57[_0xec53('0x2a')]);_0x390117(_0x1da10c);})[_0xec53('0x5b')](function(_0x170b64){ut[_0xec53('0xd6')](_0x4ec7c8,0xe,_0xec53('0x11f'));rpcDb[_0xec53('0xd7')](_0x4ec7c8,'[originateFailure][logOriginateFailure]');_0x185f44(_0x170b64);});});};Preview[_0xec53('0x36')]['syncNewExten']=function(_0x3524c5){if(this[_0xec53('0x11')][_0x3524c5[_0xec53('0x82')]]){this['actions'][_0x3524c5[_0xec53('0x82')]][_0xec53('0x120')]=_0x3524c5[_0xec53('0x120')];}};Preview[_0xec53('0x36')][_0xec53('0x121')]=function(_0x23940f){var _0x3874ae=this;var _0x54b7d2=this[_0xec53('0x11')][_0x23940f['actionid']];if(_0x54b7d2){if(_0x54b7d2[_0xec53('0xe3')]&&this[_0xec53('0x12')][_0x54b7d2['lookAgent']]){ut[_0xec53('0x122')](_0x54b7d2,this[_0xec53('0x12')][_0x54b7d2['lookAgent']][_0xec53('0x26')],this[_0xec53('0x12')][_0x54b7d2[_0xec53('0xe3')]]['id']);}var _0x38f427=_['clone'](_0x54b7d2);_0x38f427[_0xec53('0x88')]=moment()[_0xec53('0x24')](_0xec53('0x87'));var _0x57e91c=_0x3874ae[_0xec53('0x20')][_0x54b7d2[_0xec53('0x45')]];if(ut[_0xec53('0x123')](_0x23940f[_0xec53('0x124')])){if(_0x54b7d2[_0xec53('0x9f')]){rpcDb[_0xec53('0x125')](_0x54b7d2[_0xec53('0x84')]);}if(_0x54b7d2['activeContact']){rpcDb[_0xec53('0x5d')](_0x54b7d2[_0xec53('0x84')]);}ami[_0xec53('0x27')]('custom:agentringnoanswer',ut[_0xec53('0x74')](_0x54b7d2,_0xec53('0x126'),this[_0xec53('0x20')][_0x54b7d2[_0xec53('0x45')]]));this['callProgressDetectingAgent'](_0x38f427,_0x57e91c,_0x23940f);}else{_0x54b7d2[_0xec53('0x5e')]=moment()[_0xec53('0x24')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xec53('0xd6')](_0x38f427,0x4,_0xec53('0x91'));rpcDb[_0xec53('0xd7')](_0x38f427,_0xec53('0x127'));}}};Preview[_0xec53('0x36')][_0xec53('0x15')]=function(_0x59460b){var _0x4b978c=this[_0xec53('0x11')][_0x59460b['linkedid']];var _0x2b943e;if(_0x4b978c){_0x2b943e=this['campaignsPreview'][_0x4b978c[_0xec53('0x45')]];logger[_0xec53('0x21')]('[syncHangup][talking]',_0x59460b[_0xec53('0x82')],_0xec53('0x96'),_0x2b943e['name'],_0xec53('0x97'),_0x2b943e[_0xec53('0x2b')]);}if(this['actions'][_0x59460b[_0xec53('0x82')]]&&_0x59460b[_0xec53('0x82')]!==_0x59460b['uniqueid']){if(_0x59460b['cause']==='16'&&this['actions'][_0x59460b[_0xec53('0x82')]][_0xec53('0x46')]){this[_0xec53('0x128')](_0x59460b,_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')]);}else if(this[_0xec53('0x11')][_0x59460b[_0xec53('0x82')]][_0xec53('0x46')]){logger[_0xec53('0x21')]('[syncHangup][talking][cause]',_0x59460b[_0xec53('0x82')],_0x59460b['cause'],_0xec53('0x96'),_0x2b943e[_0xec53('0x26')],_0xec53('0x97'),_0x2b943e[_0xec53('0x2b')]);this['callProgressDetectingCustomer'](_0x59460b,_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')]);}}else if(_0x4b978c&&_[_0xec53('0x53')](_0x4b978c[_0xec53('0x12a')])&&_0x2b943e[_0xec53('0x12b')]&&_0x59460b[_0xec53('0x82')]===_0x59460b['uniqueid']&&_[_0xec53('0x53')](_0x59460b['reason'])&&_0x59460b['cause']==='16'&&_0x59460b[_0xec53('0x12c')]==='6'&&_[_0xec53('0xd4')](_0x4b978c[_0xec53('0x12d')])){if(_0x4b978c[_0xec53('0x9f')]){rpcDb['unlockContact'](_0x4b978c[_0xec53('0x84')]);}if(_0x4b978c[_0xec53('0x81')]){rpcDb[_0xec53('0x5d')](_0x4b978c[_0xec53('0x84')]);}_0x59460b[_0xec53('0xd5')]='22';this[_0xec53('0xd2')](_0x4b978c,_0x2b943e,_0x59460b);}else if(_0x4b978c&&_0x4b978c[_0xec53('0x12d')]){if(_0x59460b['cause']==='16'&&this[_0xec53('0x11')][_0x59460b['linkedid']][_0xec53('0x46')]){logger['info'](_0xec53('0x12e'),_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')],_0xec53('0x96'),_0x2b943e[_0xec53('0x26')],_0xec53('0x97'),_0x2b943e[_0xec53('0x2b')]);this[_0xec53('0x128')](_0x59460b,_0x59460b['linkedid'],_0x59460b[_0xec53('0x129')]);}else if(this[_0xec53('0x11')][_0x59460b['linkedid']][_0xec53('0x46')]){logger['info']('[syncHangup][talking][cause]',_0x59460b['linkedid'],_0x59460b[_0xec53('0x129')],_0xec53('0x96'),_0x2b943e[_0xec53('0x26')],'pTalking:\x20',_0x2b943e[_0xec53('0x2b')]);this[_0xec53('0x128')](_0x59460b,_0x59460b[_0xec53('0x82')],_0x59460b[_0xec53('0x129')]);}}};Preview['prototype'][_0xec53('0x12f')]=function(_0x500114){if(this[_0xec53('0x11')][_0x500114[_0xec53('0xd0')]]&&_0x500114['destlinkedid']!==_0x500114[_0xec53('0x130')]){this[_0xec53('0x128')](_0x500114,_0x500114[_0xec53('0xd0')],_0x500114[_0xec53('0xc6')]);}};Preview[_0xec53('0x36')]['syncHangupRequest']=function(_0x11c102){if(this[_0xec53('0x11')][_0x11c102[_0xec53('0x82')]]&&_0x11c102['linkedid']!==_0x11c102[_0xec53('0x95')]&&!this['actions'][_0x11c102[_0xec53('0x82')]][_0xec53('0x46')]){if(_0x11c102['cause']==='1'){this[_0xec53('0x128')](_0x11c102,_0x11c102[_0xec53('0x82')],_0x11c102[_0xec53('0x129')]);}}};Preview[_0xec53('0x36')]['addVariable']=function(_0x406183,_0x2ce925,_0x308835){if(this[_0xec53('0x11')][_0x406183]){if(_[_0xec53('0x53')](this[_0xec53('0x11')][_0x406183]['variables'])){this['actions'][_0x406183]['variables']={};}this['actions'][_0x406183][_0xec53('0x11e')][_0x2ce925]=_0x308835;}};Preview[_0xec53('0x36')][_0xec53('0x1d')]=function(_0x31699a){try{if(!_[_0xec53('0x53')](_0x31699a)){if(ut[_0xec53('0x131')](_['keys'](_0x31699a[_0xec53('0x132')])[0x0])){this[_0xec53('0x133')](_0x31699a['uniqueid'],_['keys'](_0x31699a[_0xec53('0x132')])[0x0],_0x31699a[_0xec53('0x134')]);}}}catch(_0x13d064){logger['error']('[syncVarSet][Preview]',util[_0xec53('0x135')](_0x13d064,{'showHidden':![],'depth':null}));}};Preview[_0xec53('0x36')][_0xec53('0x136')]=function(_0xe44663){if(_0xe44663){if(this[_0xec53('0x11')][_0xe44663[_0xec53('0x137')]]){this[_0xec53('0x11')][_0xe44663['transfertargetlinkedid']][_0xec53('0x12d')]=!![];}}};Preview[_0xec53('0x36')][_0xec53('0x1f')]=function(_0x52dbab){if(_0x52dbab){if(this[_0xec53('0x11')][_0x52dbab[_0xec53('0x138')]]){this[_0xec53('0x11')][_0x52dbab[_0xec53('0x138')]][_0xec53('0x12d')]=!![];}}};module[_0xec53('0x139')]=Preview; \ No newline at end of file +var _0x0f8a=['format','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','INACTIVE','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking:\x20','custom:agentconnect','connect','complete','total','answered','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','ANSWER','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','SIP/%s','status','reachable','unmonitored','disableContact','execRun','recallme','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','setXMDContactVariables','Contact','assign','merge','toLowerVariables','variables','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','filterKey','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','defaults','redis','localhost','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','stringify','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0f8a,0xd2));var _0xa0f8=function(_0x5f2f1f,_0x2cb37c){_0x5f2f1f=_0x5f2f1f-0x0;var _0x1903c7=_0x0f8a[_0x5f2f1f];return _0x1903c7;};'use strict';var util=require(_0xa0f8('0x0'));var _=require(_0xa0f8('0x1'));var uuid=require(_0xa0f8('0x2'));var moment=require(_0xa0f8('0x3'));var Redis=require('ioredis');var config=require(_0xa0f8('0x4'));var logger=require(_0xa0f8('0x5'))(_0xa0f8('0x6'));var loggerAction=require(_0xa0f8('0x5'))(_0xa0f8('0x7'));var ami=require(_0xa0f8('0x8'));var rpcDb=require(_0xa0f8('0x9'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xa0f8('0xa'));var ut=require(_0xa0f8('0xb'));var utils=require(_0xa0f8('0xc'));config['redis']=_[_0xa0f8('0xd')](config[_0xa0f8('0xe')],{'host':_0xa0f8('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa0f8('0x10')][_0xa0f8('0x11')]=function(_0x7ffaf1){this['tail']=this[_0xa0f8('0x12')]?this[_0xa0f8('0x12')]['finally'](_0x7ffaf1):_0x7ffaf1();};function Preview(_0x3a0306){this[_0xa0f8('0x13')]=new Sequence();this[_0xa0f8('0x14')]=_0x3a0306[_0xa0f8('0x15')];this[_0xa0f8('0x16')]=_0x3a0306[_0xa0f8('0x16')];this[_0xa0f8('0x17')]={};this[_0xa0f8('0x18')]=_0x3a0306[_0xa0f8('0x18')];this[_0xa0f8('0x19')]=0x0;ami['on']('originateresponse',this[_0xa0f8('0x1a')][_0xa0f8('0x1b')](this));ami['on'](_0xa0f8('0x1c'),this[_0xa0f8('0x1d')][_0xa0f8('0x1b')](this));ami['on'](_0xa0f8('0x1e'),this[_0xa0f8('0x1f')][_0xa0f8('0x1b')](this));ami['on']('dialend',this[_0xa0f8('0x20')][_0xa0f8('0x1b')](this));ami['on'](_0xa0f8('0x21'),this[_0xa0f8('0x22')][_0xa0f8('0x1b')](this));ami['on']('varset',this[_0xa0f8('0x23')][_0xa0f8('0x1b')](this));ami['on']('attendedtransfer',this[_0xa0f8('0x24')][_0xa0f8('0x1b')](this));ami['on'](_0xa0f8('0x25'),this[_0xa0f8('0x26')][_0xa0f8('0x1b')](this));this[_0xa0f8('0x27')](this['campaignsPreview']);}function emit(_0x4e3592,_0x477fb6,_0x4ad30a){io['to'](_0x4e3592)[_0xa0f8('0x28')](_0x477fb6,_0x4ad30a);}function emitVoiceQueueChannelRemove(_0x356a92){logger[_0xa0f8('0x29')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xa0f8('0x2a')](_0x356a92));emit(util['format'](_0xa0f8('0x2b'),_0x356a92[_0xa0f8('0x2c')]),_0xa0f8('0x2d'),_0x356a92);io[_0xa0f8('0x28')]('voice_queue_presence:remove',_0x356a92);}function notSendMessagesQueue(_0x527a12){if(_0x527a12[_0xa0f8('0x2e')]){if(_0x527a12[_0xa0f8('0x2f')]===0x0&&_0x527a12[_0xa0f8('0x30')]===0x0){_0x527a12['sendMessageOneNotActive']=![];_0x527a12[_0xa0f8('0x31')]=0x0;_0x527a12[_0xa0f8('0x32')]=0x0;_0x527a12[_0xa0f8('0x33')]=utils[_0xa0f8('0x34')]['INACTIVE'];ut[_0xa0f8('0x35')](_0xa0f8('0x36'),_0x527a12['name']+_0xa0f8('0x37'));}else{_0x527a12[_0xa0f8('0x33')]=utils[_0xa0f8('0x34')]['DEACTIVATED'];ut[_0xa0f8('0x35')](_0xa0f8('0x36'),_0x527a12[_0xa0f8('0x2c')]+_0xa0f8('0x38'));}}}Preview['prototype'][_0xa0f8('0x27')]=function(){var _0x44ebe2=this;setInterval(function(){_0x44ebe2[_0xa0f8('0x39')]();},0x7cf);};Preview[_0xa0f8('0x10')][_0xa0f8('0x39')]=function(){var _0x3136c7=this[_0xa0f8('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x55c9b2 in _0x3136c7){if(_0x3136c7[_0xa0f8('0x3a')](_0x55c9b2)&&(_0x3136c7[_0x55c9b2]['dialMethod']==='preview'||_0x3136c7[_0x55c9b2][_0xa0f8('0x3b')]===_0xa0f8('0x3c'))&&_0x3136c7[_0x55c9b2][_0xa0f8('0x3d')]===_0xa0f8('0x3e')){if(this[_0xa0f8('0x19')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x3136c7[_0xa0f8('0x3a')](_0x55c9b2)&&_0x3136c7[_0x55c9b2][_0xa0f8('0x3b')]==='preview'&&_0x3136c7[_0x55c9b2][_0xa0f8('0x3d')]==='outbound'){if(_0x3136c7[_0x55c9b2][_0xa0f8('0x3f')]){this[_0xa0f8('0x40')](_0x3136c7[_0x55c9b2]);if(_0x3136c7[_0x55c9b2][_0xa0f8('0x41')])this['recallMe'](_0x3136c7[_0x55c9b2]);}else{notSendMessagesQueue(_0x3136c7[_0x55c9b2]);}}}};Preview[_0xa0f8('0x10')][_0xa0f8('0x42')]=function(_0x4a2b09){var _0x25848b=this;this[_0xa0f8('0x13')][_0xa0f8('0x11')](function(){if(!_[_0xa0f8('0x43')](_0x25848b['actions'][_0x4a2b09])){loggerAction['info'](_0xa0f8('0x44'),_0x4a2b09,_0xa0f8('0x45'),_0x25848b['actions'][_0x4a2b09]['queue'],_0xa0f8('0x46'),JSON['stringify'](_0x25848b[_0xa0f8('0x14')][_0x25848b[_0xa0f8('0x17')][_0x4a2b09][_0xa0f8('0x47')]][_0xa0f8('0x2f')]),'pTalking:\x20',JSON['stringify'](_0x25848b[_0xa0f8('0x14')][_0x25848b[_0xa0f8('0x17')][_0x4a2b09][_0xa0f8('0x47')]][_0xa0f8('0x30')]),JSON[_0xa0f8('0x2a')](_0x25848b[_0xa0f8('0x17')][_0x4a2b09][_0xa0f8('0x48')]),JSON['stringify'](_[_0xa0f8('0x49')](_0x25848b[_0xa0f8('0x17')][_0x4a2b09],[_0xa0f8('0x4a'),_0xa0f8('0x4b'),_0xa0f8('0x4c'),_0xa0f8('0x4d')])));return ami[_0xa0f8('0x4e')]({'action':'status','channel':_0x25848b[_0xa0f8('0x17')][_0x4a2b09][_0xa0f8('0x4f')]})[_0xa0f8('0x50')](function(_0x3b6058){if(_0x3b6058[_0xa0f8('0x33')]===_0xa0f8('0x51')){setTimeout(function(){if(_0x25848b[_0xa0f8('0x17')][_0x4a2b09]){ut['updateOriginated'](_0x25848b[_0xa0f8('0x14')][_0x25848b[_0xa0f8('0x17')][_0x4a2b09][_0xa0f8('0x47')]],_0xa0f8('0x52'));if(_0x25848b[_0xa0f8('0x17')][_0x4a2b09][_0xa0f8('0x48')]===!![]){ut[_0xa0f8('0x53')](_0x25848b[_0xa0f8('0x14')][_0x25848b['actions'][_0x4a2b09][_0xa0f8('0x47')]],_0xa0f8('0x52'));ut[_0xa0f8('0x54')](_0xa0f8('0x55')+_0x4a2b09,_0x25848b['actions'][_0x4a2b09]['queue']);}ut[_0xa0f8('0x54')]('[Dialer][checkChannel][Preview]'+_0x4a2b09,_0x25848b[_0xa0f8('0x17')][_0x4a2b09][_0xa0f8('0x47')]);delete _0x25848b['actions'][_0x4a2b09];}},0x2328);}});}});};Preview[_0xa0f8('0x10')][_0xa0f8('0x56')]=function(){var _0x47114a=this;loggerAction['info']('[action]',_[_0xa0f8('0x57')](this[_0xa0f8('0x17')]));for(var _0x3ba1d2 in this[_0xa0f8('0x17')]){if(_0x47114a[_0xa0f8('0x17')][_0xa0f8('0x3a')](_0x3ba1d2)){_0x47114a['clearZombieChannel'](_0x3ba1d2);}}};Preview['prototype']['recallMe']=function(_0x59aa30){var _0x310f5d=this;rpcDb[_0xa0f8('0x58')](_0x59aa30['id'],ut[_0xa0f8('0x59')](this['agents']))[_0xa0f8('0x5a')](function(_0x587c27){if(!_[_0xa0f8('0x43')](_0x587c27)){for(var _0x417b8c=0x0;_0x417b8c<_0x587c27[_0xa0f8('0x5b')];_0x417b8c+=0x1){if(ut[_0xa0f8('0x5c')](_0x587c27[_0x417b8c][_0xa0f8('0x5d')])<_0x59aa30[_0xa0f8('0x5e')]*0x3c){if(_0x587c27[_0x417b8c][_0xa0f8('0x5f')]&&!_0x587c27[_0x417b8c][_0xa0f8('0x5f')][_0xa0f8('0x60')]){_0x310f5d[_0xa0f8('0x61')](_0x587c27[_0x417b8c]['id'])['then'](ut[_0xa0f8('0x62')]('[RecallMe]'))[_0xa0f8('0x50')](ut[_0xa0f8('0x62')](_0xa0f8('0x63')));}else{rpcDb['disableContact'](_0x587c27[_0x417b8c]['id']);}}else{var _0x594bb8=new Action(_0x587c27[_0x417b8c],_0x59aa30);_0x594bb8[_0xa0f8('0x64')]=moment()[_0xa0f8('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x59aa30['outboundReCallsDay']+=0x1;ut[_0xa0f8('0x66')](_0x594bb8,0x17,_0xa0f8('0x67'));if(_0x59aa30['dialRecallInQueue']){rpcDb[_0xa0f8('0x68')](ut[_0xa0f8('0x69')](_0x587c27[_0x417b8c]));rpcDb[_0xa0f8('0x6a')](_0x594bb8,_0xa0f8('0x6b'));}else{ut[_0xa0f8('0x66')](_0x594bb8,0x16,_0xa0f8('0x6c'));rpcDb[_0xa0f8('0x6a')](_0x594bb8,_0xa0f8('0x6d'));rpcDb['createCustomerFinal'](_0x594bb8,_0xa0f8('0x6d'));}}}}})[_0xa0f8('0x50')](ut[_0xa0f8('0x62')](_0xa0f8('0x6e')));};Preview['prototype'][_0xa0f8('0x40')]=function(_0x536544){_0x536544['sendMessageOneNotActive']=!![];if(ut[_0xa0f8('0x6f')](_0x536544['loggedIn'])){_0x536544[_0xa0f8('0x33')]=utils[_0xa0f8('0x34')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xa0f8('0x70')](_0x536544[_0xa0f8('0x3f')])){_0x536544[_0xa0f8('0x33')]=utils['CAMPAIGN_STATUS'][_0xa0f8('0x71')];}else if(!this['isTrunkReachable'](_0x536544[_0xa0f8('0x72')])){if(!this[_0xa0f8('0x73')](_0x536544[_0xa0f8('0x74')])){_0x536544['message']=utils[_0xa0f8('0x34')]['UNREACHABLE_TRUNK'];}else{_0x536544['message']=utils[_0xa0f8('0x34')]['ACTIVE'];}}else{_0x536544['message']=utils[_0xa0f8('0x34')][_0xa0f8('0x75')];}};Preview[_0xa0f8('0x10')][_0xa0f8('0x76')]=function(_0xc924f4,_0x2726df,_0x22715e){var _0x5e9503=this;var _0x44148d=this[_0xa0f8('0x17')][_0x2726df];var _0x192067=this['campaignsPreview'][_0x44148d[_0xa0f8('0x47')]];var _0x4eb284;var _0x5d9282=![];var _0x439ec3=0x2;var _0x57620d=0x3;if(_0x192067){switch(_0x22715e){case'1':_0x192067['outboundNoSuchCallsDay']+=0x1;_0x44148d[_0xa0f8('0x77')]+=0x1;_0x44148d['countglobal']=ut[_0xa0f8('0x78')](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0x0,_0xa0f8('0x79'));ami[_0xa0f8('0x28')](_0xa0f8('0x7a'),ut[_0xa0f8('0x7b')](_0x44148d,_0xa0f8('0x7c')));rpcDb[_0xa0f8('0x6a')](_0x44148d,'[callProgressDetectingCustomer][logNoSuch]');_0x5e9503[_0xa0f8('0x7d')](_0x44148d,'0',_0x192067)[_0xa0f8('0x5a')](function(_0x1b4bb7){_0x5d9282=_0x1b4bb7[_0xa0f8('0x7e')]==0x1;_0x439ec3=_0x192067[_0xa0f8('0x7f')];_0x57620d=_0x192067[_0xa0f8('0x80')];if(!_0x5d9282){if(ut['totalGlobal'](_0x44148d)>=_0x192067[_0xa0f8('0x81')]){_0x4eb284=ut[_0xa0f8('0x82')](_0x44148d,0xf,_0xa0f8('0x83'));rpcDb[_0xa0f8('0x84')](_0x4eb284,_0xa0f8('0x85'));}else{if(_0x44148d['countnosuchnumberretry']>=_0x192067[_0xa0f8('0x86')]){rpcDb[_0xa0f8('0x84')](_0x44148d,_0xa0f8('0x85'));}else{rpcDb[_0xa0f8('0x87')](ut['scheduledAt'](_0x44148d,_0xa0f8('0x77'),_0x192067[_0xa0f8('0x7f')]),_0x44148d[_0xa0f8('0x88')],_0x44148d[_0xa0f8('0x89')]);}}delete this[_0xa0f8('0x17')][_0xc924f4[_0xa0f8('0x8a')]];}else{_0x44148d[_0xa0f8('0x77')]++;logger[_0xa0f8('0x29')](_0xa0f8('0x8b'),_0x44148d[_0xa0f8('0x77')]);logger[_0xa0f8('0x29')]('id',_0x44148d['idContact']);_0x5e9503[_0xa0f8('0x8c')]({'id':_0x44148d[_0xa0f8('0x8d')],'field':{'countnosuchnumberretry':_0x44148d[_0xa0f8('0x77')]}})['then'](function(){_0x5e9503[_0xa0f8('0x8e')](_0x44148d,_0x439ec3,_0x57620d)[_0xa0f8('0x5a')](function(){});});}});break;case'ANSWER':var _0x1e7ba0=moment()['format'](_0xa0f8('0x8f'));_0x44148d[_0xa0f8('0x90')]=_0x1e7ba0;_0x44148d[_0xa0f8('0x91')]=_0x1e7ba0;_0x44148d[_0xa0f8('0x48')]=!![];_0x192067[_0xa0f8('0x30')]+=0x1;logger[_0xa0f8('0x29')]('[syncHangup][talking][increment]',_0x44148d['uniqueid'],'\x20Queue',_0x192067['name'],_0xa0f8('0x92'),_0x192067['pTalking']);ami['emit'](_0xa0f8('0x93'),ut[_0xa0f8('0x7b')](_0x44148d,_0xa0f8('0x94'),this[_0xa0f8('0x14')][_0x44148d[_0xa0f8('0x47')]]));if(_0x192067['acw']){ami[_0xa0f8('0x28')]('custom:agentConnectPreview',ut['buildAcw'](_0x44148d));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xa0f8('0x7b')](_0x44148d,_0xa0f8('0x95'),this[_0xa0f8('0x14')][_0x44148d[_0xa0f8('0x47')]]));emitVoiceQueueChannelRemove(ut[_0xa0f8('0x7b')](_0x44148d,_0xa0f8('0x95')));_0x192067['outboundAnswerCallsDay']+=0x1;_0x192067[_0xa0f8('0x96')]+=0x1;_0x192067[_0xa0f8('0x97')]+=0x1;ut['decrementTalkink'](_0x192067,'[16]');_0x44148d[_0xa0f8('0x98')]=ut[_0xa0f8('0x78')](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0x4,_0xa0f8('0x99'));rpcDb['createCustomerHistory'](_0x44148d,_0xa0f8('0x9a'));rpcDb[_0xa0f8('0x84')](_0x44148d,_0xa0f8('0x9b'));rpcDb[_0xa0f8('0x9c')](_0x44148d);_0x192067[_0xa0f8('0x9d')]+=_0x44148d[_0xa0f8('0x9e')];_0x192067['sumBillable']+=_0x44148d[_0xa0f8('0x9e')];logger[_0xa0f8('0x29')](_0xa0f8('0x9f'),_0x44148d[_0xa0f8('0xa0')],_0xa0f8('0xa1'),_0x192067[_0xa0f8('0x2c')],_0xa0f8('0x92'),_0x192067[_0xa0f8('0x30')]);delete this['actions'][_0xc924f4[_0xa0f8('0x8a')]];break;case _0xa0f8('0xa2'):_0x192067['outboundBusyCallsDay']+=0x1;_0x44148d[_0xa0f8('0xa3')]+=0x1;_0x44148d['countglobal']=ut['totalGlobal'](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0x5,_0xa0f8('0xa4'));_0x439ec3=_0x192067['dialBusyRetryFrequency'];_0x57620d=_0x192067[_0xa0f8('0x80')];ami['emit'](_0xa0f8('0xa5'),ut['buildObj'](_0x44148d,'busy'));rpcDb[_0xa0f8('0x6a')](_0x44148d,_0xa0f8('0xa6'));_0x5e9503[_0xa0f8('0x7d')](_0x44148d,'5',_0x192067)[_0xa0f8('0x5a')](function(_0x9304c6){_0x5d9282=_0x9304c6[_0xa0f8('0x7e')]==0x1;if(!_0x5d9282){if(ut[_0xa0f8('0x78')](_0x44148d)>=_0x192067[_0xa0f8('0x81')]){_0x4eb284=ut[_0xa0f8('0x82')](_0x44148d,0xf,_0xa0f8('0x83'));rpcDb[_0xa0f8('0x84')](_0x4eb284,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x44148d[_0xa0f8('0xa3')]>=_0x192067[_0xa0f8('0xa7')]){rpcDb[_0xa0f8('0x84')](_0x44148d,_0xa0f8('0xa6'));}else{rpcDb[_0xa0f8('0x87')](ut[_0xa0f8('0xa8')](_0x44148d,_0xa0f8('0xa3'),_0x192067['dialBusyRetryFrequency']),_0x44148d[_0xa0f8('0x88')],_0x44148d[_0xa0f8('0x89')]);}}}else{_0x44148d[_0xa0f8('0xa3')]++;_0x5e9503['incrementPreviewCounters']({'id':_0x44148d['idContact'],'field':{'countbusyretry':_0x44148d[_0xa0f8('0xa3')]}})[_0xa0f8('0x5a')](function(){_0x5e9503[_0xa0f8('0x8e')](_0x44148d,_0x439ec3,_0x57620d)[_0xa0f8('0x5a')](function(){});});}});break;case _0xa0f8('0xa9'):_0x192067[_0xa0f8('0xaa')]+=0x1;_0x44148d[_0xa0f8('0xab')]+=0x1;_0x44148d[_0xa0f8('0x98')]=ut[_0xa0f8('0x78')](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0x3,_0xa0f8('0xac'));_0x439ec3=_0x192067[_0xa0f8('0xad')];_0x57620d=_0x192067[_0xa0f8('0x80')];var _0x328928=ut[_0xa0f8('0xae')](_0x44148d,_0x192067);ami[_0xa0f8('0x28')]('custom:agentnoanswer',_0x328928);rpcDb[_0xa0f8('0x6a')](_0x44148d,_0xa0f8('0xaf'));_0x5e9503[_0xa0f8('0x7d')](_0x44148d,'3',_0x192067)['then'](function(_0x1244c7){_0x5d9282=_0x1244c7[_0xa0f8('0x7e')]==0x1;if(!_0x5d9282){if(ut[_0xa0f8('0x78')](_0x44148d)>=_0x192067[_0xa0f8('0x81')]){_0x4eb284=ut['cloneAction'](_0x44148d,0xf,_0xa0f8('0x83'));rpcDb[_0xa0f8('0x84')](_0x4eb284,_0xa0f8('0xb0'));}else{if(_0x44148d[_0xa0f8('0xab')]>=_0x192067[_0xa0f8('0xb1')]){rpcDb[_0xa0f8('0x84')](_0x44148d,_0xa0f8('0xaf'));}else{rpcDb[_0xa0f8('0x87')](ut[_0xa0f8('0xa8')](_0x44148d,_0xa0f8('0xab'),_0x192067['dialNoAnswerRetryFrequency']),_0x44148d[_0xa0f8('0x88')],_0x44148d[_0xa0f8('0x89')]);}}}else{_0x44148d[_0xa0f8('0xab')]++;_0x5e9503[_0xa0f8('0x8c')]({'id':_0x44148d[_0xa0f8('0x8d')],'field':{'countnoanswerretry':_0x44148d[_0xa0f8('0xab')]}})['then'](function(){_0x5e9503[_0xa0f8('0x8e')](_0x44148d,_0x439ec3,_0x57620d)[_0xa0f8('0x5a')](function(){});});}});break;case _0xa0f8('0xb2'):_0x192067[_0xa0f8('0xb3')]+=0x1;_0x44148d[_0xa0f8('0xb4')]+=0x1;_0x44148d['countglobal']=ut['totalGlobal'](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0x8,'Congestion');_0x439ec3=_0x192067['dialCongestionRetryFrequency'];_0x57620d=_0x192067[_0xa0f8('0x80')];ami[_0xa0f8('0x28')](_0xa0f8('0xb5'),ut[_0xa0f8('0x7b')](_0x44148d,'congestion'));rpcDb[_0xa0f8('0x6a')](_0x44148d,_0xa0f8('0xb6'));_0x5e9503['verifyAdditionalPhones'](_0x44148d,'8',_0x192067)[_0xa0f8('0x5a')](function(_0x16c74f){_0x5d9282=_0x16c74f[_0xa0f8('0x7e')]==0x1;if(!_0x5d9282){if(ut['totalGlobal'](_0x44148d)>=_0x192067[_0xa0f8('0x81')]){_0x4eb284=ut[_0xa0f8('0x82')](_0x44148d,0xf,_0xa0f8('0x83'));rpcDb[_0xa0f8('0x84')](_0x4eb284,_0xa0f8('0xb7'));}else{if(_0x44148d[_0xa0f8('0xb4')]>=_0x192067[_0xa0f8('0xb8')]){rpcDb['createCustomerFinal'](_0x44148d,_0xa0f8('0xb6'));}else{rpcDb[_0xa0f8('0x87')](ut[_0xa0f8('0xa8')](_0x44148d,_0xa0f8('0xb4'),_0x192067['dialBusyRetryFrequency']),_0x44148d['unlockAgent'],_0x44148d[_0xa0f8('0x89')]);}}}else{_0x44148d[_0xa0f8('0xb4')]++;_0x5e9503[_0xa0f8('0x8c')]({'id':_0x44148d[_0xa0f8('0x8d')],'field':{'countcongestionretry':_0x44148d[_0xa0f8('0xb4')]}})[_0xa0f8('0x5a')](function(){_0x5e9503[_0xa0f8('0x8e')](_0x44148d,_0x439ec3,_0x57620d)['then'](function(){});});}});break;case _0xa0f8('0xb9'):_0x192067[_0xa0f8('0xba')]+=0x1;_0x44148d[_0xa0f8('0xbb')]+=0x1;_0x44148d[_0xa0f8('0x98')]=ut[_0xa0f8('0x78')](_0x44148d);ut['logCustomer'](_0x44148d,0x14,_0xa0f8('0xbc'));_0x439ec3=_0x192067['dialAgentRejectRetryFrequency'];_0x57620d=_0x192067['callAdditionalPhoneAfterMin'];ami[_0xa0f8('0x28')]('custom:agentreject',ut[_0xa0f8('0x7b')](_0x44148d,'agentreject'));rpcDb[_0xa0f8('0x6a')](_0x44148d,_0xa0f8('0xbd'));_0x5e9503[_0xa0f8('0x7d')](_0x44148d,'20',_0x192067)[_0xa0f8('0x5a')](function(_0x1e746c){_0x5d9282=_0x1e746c[_0xa0f8('0x7e')]==0x1;if(!_0x5d9282){if(ut['totalGlobal'](_0x44148d)>=_0x192067[_0xa0f8('0x81')]){_0x4eb284=ut[_0xa0f8('0x82')](_0x44148d,0x14,_0xa0f8('0xbc'));rpcDb[_0xa0f8('0x84')](_0x4eb284,_0xa0f8('0xbe'));}else{if(_0x44148d[_0xa0f8('0xbb')]>=_0x192067[_0xa0f8('0xbf')]){rpcDb[_0xa0f8('0x84')](_0x44148d,_0xa0f8('0xbe'));}else{rpcDb[_0xa0f8('0x87')](ut['scheduledAt'](_0x44148d,'countagentrejectretry',_0x192067['dialAgentRejectRetryFrequency']),_0x44148d['unlockAgent'],_0x44148d[_0xa0f8('0x89')]);}}}else{_0x44148d[_0xa0f8('0xab')]++;_0x5e9503['incrementPreviewCounters']({'id':_0x44148d[_0xa0f8('0x8d')],'field':{'countnoanswerretry':_0x44148d[_0xa0f8('0xab')]}})[_0xa0f8('0x5a')](function(){_0x5e9503['swapAdditionalPhones'](_0x44148d,_0x439ec3,_0x57620d)['then'](function(){});});}});break;case _0xa0f8('0xc0'):_0x192067[_0xa0f8('0xc1')]+=0x1;_0x44148d[_0xa0f8('0xc2')]+=0x1;_0x44148d[_0xa0f8('0x98')]=ut['totalGlobal'](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0xb,_0xa0f8('0xc3'));rpcDb[_0xa0f8('0x6a')](_0x44148d,'[callProgressDetectingCustomer][logAbandoned]');_0x5e9503[_0xa0f8('0x7d')](_0x44148d,'11',_0x192067)[_0xa0f8('0x5a')](function(_0x5acaf7){_0x5d9282=_0x5acaf7[_0xa0f8('0x7e')]==0x1;if(!_0x5d9282){if(ut[_0xa0f8('0x78')](_0x44148d)>=_0x192067[_0xa0f8('0x81')]){_0x4eb284=ut[_0xa0f8('0x82')](_0x44148d,0xf,_0xa0f8('0x83'));rpcDb[_0xa0f8('0x84')](_0x4eb284,_0xa0f8('0xc4'));}else{if(_0x44148d[_0xa0f8('0xc5')]>=_0x192067[_0xa0f8('0xc6')]){rpcDb['createCustomerFinal'](_0x44148d,_0xa0f8('0xc4'));}else{rpcDb[_0xa0f8('0x87')](ut[_0xa0f8('0xa8')](_0x44148d,_0xa0f8('0xc2'),_0x192067[_0xa0f8('0xc7')]),_0x44148d[_0xa0f8('0x88')],_0x44148d['activeContact']);}}}else{_0x44148d['countnoanswerretry']++;_0x5e9503['incrementPreviewCounters']({'id':_0x44148d[_0xa0f8('0x8d')],'field':{'countnoanswerretry':_0x44148d[_0xa0f8('0xab')]}})[_0xa0f8('0x5a')](function(){_0x5e9503['swapAdditionalPhones'](_0x44148d,_0x439ec3,_0x57620d)[_0xa0f8('0x5a')](function(){});});}});break;case'18':_0x192067['outboundUnknownCallsDay']+=0x1;_0x44148d[_0xa0f8('0xc8')]+=0x1;_0x44148d['countglobal']=ut[_0xa0f8('0x78')](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0x12,_0xc924f4['cause-txt']||_0xc924f4['dialstatus']);ami[_0xa0f8('0x28')](_0xa0f8('0xc9'),ut[_0xa0f8('0x7b')](_0x44148d,_0xa0f8('0xca')));rpcDb['createCustomerHistory'](_0x44148d,_0xa0f8('0xcb'));_0x5e9503['verifyAdditionalPhones'](_0x44148d,'18',_0x192067)[_0xa0f8('0x5a')](function(_0x5d1dac){_0x5d9282=_0x5d1dac[_0xa0f8('0x7e')]==0x1;if(!_0x5d9282){if(ut[_0xa0f8('0x78')](_0x44148d)>=_0x192067['dialGlobalMaxRetry']){_0x4eb284=ut['cloneAction'](_0x44148d,0x12,_0xa0f8('0x83'));rpcDb['createCustomerFinal'](_0x4eb284,_0xa0f8('0xcb'));}else{rpcDb['createCustomerFinal'](_0x44148d,_0xa0f8('0xcb'));}}else{_0x44148d[_0xa0f8('0xab')]++;_0x5e9503[_0xa0f8('0x8c')]({'id':_0x44148d['idContact'],'field':{'countnoanswerretry':_0x44148d[_0xa0f8('0xab')]}})[_0xa0f8('0x5a')](function(){_0x5e9503[_0xa0f8('0x8e')](_0x44148d,_0x439ec3,_0x57620d)[_0xa0f8('0x5a')](function(){});});}});delete this[_0xa0f8('0x17')][_0xc924f4[_0xa0f8('0x8a')]];break;case'19':_0x192067['outboundUnknownCallsDay']+=0x1;_0x44148d[_0xa0f8('0x98')]=ut['totalGlobal'](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0x13,_0xc924f4[_0xa0f8('0xcc')]||_0xc924f4[_0xa0f8('0xcd')]);ami[_0xa0f8('0x28')](_0xa0f8('0xc9'),ut[_0xa0f8('0x7b')](_0x44148d,_0xa0f8('0xca')));rpcDb[_0xa0f8('0x6a')](_0x44148d,'[callProgressDetectingCustomer][machine]');_0x5e9503[_0xa0f8('0x7d')](_0x44148d,'18',_0x192067)[_0xa0f8('0x5a')](function(_0xf259df){_0x5d9282=_0xf259df[_0xa0f8('0x7e')]==0x1;if(!_0x5d9282){if(ut[_0xa0f8('0x78')](_0x44148d)>=_0x192067[_0xa0f8('0x81')]){_0x4eb284=ut['cloneAction'](_0x44148d,0xf,_0xa0f8('0x83'));rpcDb[_0xa0f8('0x84')](_0x4eb284,_0xa0f8('0xce'));}else{rpcDb['createCustomerFinal'](_0x44148d,'[callProgressDetectingCustomer][machine]');}}else{_0x44148d[_0xa0f8('0xab')]++;_0x5e9503[_0xa0f8('0x8c')]({'id':_0x44148d[_0xa0f8('0x8d')],'field':{'countnoanswerretry':_0x44148d[_0xa0f8('0xab')]}})['then'](function(){_0x5e9503[_0xa0f8('0x8e')](_0x44148d,_0x439ec3,_0x57620d)[_0xa0f8('0x5a')](function(){});});}});delete this[_0xa0f8('0x17')][_0xc924f4[_0xa0f8('0x8a')]];break;default:if(_0x44148d[_0xa0f8('0x48')]){ut[_0xa0f8('0x53')](_0x192067,_0xa0f8('0xcf'));ut[_0xa0f8('0x54')](_0xa0f8('0xd0')+_0x192067[_0xa0f8('0x2c')],_0xc924f4);}_0x192067['outboundUnknownCallsDay']+=0x1;_0x44148d[_0xa0f8('0x98')]=ut[_0xa0f8('0x78')](_0x44148d);ut[_0xa0f8('0x66')](_0x44148d,0xc,_0xc924f4[_0xa0f8('0xcc')]||_0xc924f4['dialstatus']);_0x439ec3=_0x192067[_0xa0f8('0xd1')];_0x57620d=_0x192067[_0xa0f8('0x80')];rpcDb[_0xa0f8('0x6a')](_0x44148d,_0xa0f8('0xd2'));_0x5e9503[_0xa0f8('0x7d')](_0x44148d,'20',_0x192067)[_0xa0f8('0x5a')](function(_0x938d72){_0x5d9282=_0x938d72['additional']==0x1;if(!_0x5d9282){if(ut[_0xa0f8('0x78')](_0x44148d)>=_0x192067['dialGlobalMaxRetry']){_0x4eb284=ut[_0xa0f8('0x82')](_0x44148d,0xf,_0xa0f8('0x83'));rpcDb[_0xa0f8('0x84')](_0x4eb284,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x44148d,_0xa0f8('0xd3'));}delete this[_0xa0f8('0x17')][_0xc924f4['linkedid']];}else{_0x5e9503['swapAdditionalPhones'](_0x44148d,_0x439ec3,_0x57620d)[_0xa0f8('0x5a')](function(){});}});}if(!(_0x44148d['dialAnswer']&&_0x22715e==='16')){ut[_0xa0f8('0xd4')](_0x192067,'[callProgressDetectingCustomer]');logger['info'](_0xa0f8('0xd5'),_0x44148d[_0xa0f8('0xa0')],_0xa0f8('0xa1'),_0x192067['name'],'originated:\x20',_0x192067['originated']);}if(_0x22715e!==_0xa0f8('0xd6')){delete this[_0xa0f8('0x17')][_0xc924f4[_0xa0f8('0x8a')]];delete this[_0xa0f8('0x17')][_0xc924f4['destlinkedid']];}_0x192067[_0xa0f8('0xd7')]=!![];}};Preview[_0xa0f8('0x10')][_0xa0f8('0xd8')]=function(_0x229aa3,_0x3f4ef2,_0x3e1909){if(_[_0xa0f8('0xd9')](_0x3f4ef2)&&_0xa0f8('0xda')!==typeof _0x3f4ef2){return;}if(_[_0xa0f8('0xd9')](_0x3e1909)&&_0xa0f8('0xda')!==typeof _0x3e1909){return;}switch(_0x3e1909['reason']){case'0':ut['logAgent'](_0x229aa3,0x0,_0xa0f8('0x79'));rpcDb[_0xa0f8('0xdb')](_0x229aa3,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xa0f8('0xdc')](_0x229aa3,0x3,_0xa0f8('0xac'));rpcDb['createAgentHistory'](_0x229aa3,_0xa0f8('0xdd'));break;case'5':ut[_0xa0f8('0xdc')](_0x229aa3,0x5,'Busy');rpcDb[_0xa0f8('0xdb')](_0x229aa3,_0xa0f8('0xde'));break;case'8':ut['logAgent'](_0x229aa3,0x8,_0xa0f8('0xdf'));rpcDb[_0xa0f8('0xdb')](_0x229aa3,_0xa0f8('0xe0'));break;case'22':ut[_0xa0f8('0xdc')](_0x229aa3,0x16,'AnswerAGI');rpcDb[_0xa0f8('0xdb')](_0x229aa3,_0xa0f8('0xe1'));break;default:ut[_0xa0f8('0xdc')](_0x229aa3,0xc,_0x3e1909[_0xa0f8('0xe2')]);rpcDb[_0xa0f8('0xdb')](_0x229aa3,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa0f8('0xd4')](_0x3f4ef2,_0xa0f8('0xe3'));logger[_0xa0f8('0x29')]('[originated][decrement][callProgressDetectingAgent]',_0x229aa3[_0xa0f8('0xa0')],_0xa0f8('0xa1'),_0x3f4ef2[_0xa0f8('0x2c')],_0xa0f8('0x46'),_0x3f4ef2['originated']);delete this[_0xa0f8('0x17')][_0x229aa3['uniqueid']];};Preview['prototype']['verifyAdditionalPhones']=function(_0x520f57,_0x29bdcd,_0x10000d){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x520f57,_0x29bdcd,_0x10000d)['catch'](logger[_0xa0f8('0x29')]('[verifyAdditionalPhone]\x20'));};Preview[_0xa0f8('0x10')][_0xa0f8('0x8e')]=function(_0x56ea77,_0x230b3d,_0x4cd83e){return cmHopperAdditionalPhone[_0xa0f8('0x8e')](_0x56ea77,_0x230b3d,_0x4cd83e)[_0xa0f8('0x50')](logger[_0xa0f8('0x29')](_0xa0f8('0xe4')));};Preview[_0xa0f8('0x10')][_0xa0f8('0x8c')]=function(_0x35e396){return Promise[_0xa0f8('0xe5')]()['then'](cmHopperAdditionalPhone[_0xa0f8('0x8c')](_0x35e396))[_0xa0f8('0x50')](logger['info']('[incrementPreviewCounters]\x20'));};Preview['prototype'][_0xa0f8('0xe6')]=function(_0x27b590,_0x2074c9,_0xa24e2c,_0x52c38d,_0x425d1d){var _0x333108=this;return new Promise(function(_0x59c93e,_0x2f1c08){if(_[_0xa0f8('0x43')](_0x2074c9)||_[_0xa0f8('0x43')](_0x2074c9['Contact'])||_['isNil'](_0x2074c9[_0xa0f8('0xe7')])||_[_0xa0f8('0x43')](_0x2074c9['VoiceQueueId'])){_0x2f1c08(ut[_0xa0f8('0x33')](_0xa0f8('0xe8'),_0x52c38d,_0x425d1d));return;}var _0x58f8a1=uuid['v4']();var _0xc0998=_0x333108['campaignsPreview'][_0x2074c9[_0xa0f8('0x45')][_0xa0f8('0x2c')]];var _0x4a60c4=_0xa24e2c?_0x333108['agents'][_0xa24e2c]['id']:undefined;_0x333108['actions'][_0x58f8a1]=new Action(_0x2074c9,_0xc0998,_0x58f8a1,_0xa24e2c,_0x4a60c4);var _0x19ff09=_0x333108[_0xa0f8('0x17')][_0x58f8a1];_0x19ff09[_0xa0f8('0x88')]=_0x52c38d;_0x19ff09['activeContact']=_0x425d1d;_0x19ff09[_0xa0f8('0xe9')]=_0xa24e2c;if(_[_0xa0f8('0xea')](_0x27b590)){_0x333108[_0xa0f8('0xeb')](_0x19ff09,_0xc0998,_0x2074c9,_0xa24e2c)[_0xa0f8('0x5a')](function(_0x3671d4){logger['info'](_0xa0f8('0xec'),_0xa0f8('0xed')+_0x19ff09[_0xa0f8('0x47')]+_0xa0f8('0xee')+_0x19ff09[_0xa0f8('0x8d')],JSON[_0xa0f8('0x2a')](_0x3671d4));ami[_0xa0f8('0x28')](_0xa0f8('0xef'),ut[_0xa0f8('0x7b')](_0x19ff09,'called',_0x333108[_0xa0f8('0x14')][_0x19ff09[_0xa0f8('0x47')]]));_0x59c93e(ut['message'](_0xa0f8('0xf0')));})[_0xa0f8('0x50')](function(_0x4d9a57){ut['logger'](_0xa0f8('0xf1'),_0x4d9a57);_0x2f1c08(ut['message'](_0xa0f8('0xf2'),_0x52c38d,_0x425d1d));});}else{_0xc0998[_0xa0f8('0xf3')]+=0x1;ut[_0xa0f8('0xf4')](_0x19ff09);rpcDb['createHistory'](_0x19ff09,'[Blacklist][error]');delete _0x333108[_0xa0f8('0x17')][_0x58f8a1];_0x2f1c08(ut[_0xa0f8('0x33')]('Contact\x20in\x20black\x20List',_0x52c38d,_0x425d1d));}});};Preview[_0xa0f8('0x10')][_0xa0f8('0x73')]=function(_0x28f997){return!_[_0xa0f8('0x43')](_0x28f997)&&!_[_0xa0f8('0x43')](_0x28f997[_0xa0f8('0x2c')])&&!_['isNil'](_0x28f997['active'])&&_0x28f997['active']&&!_[_0xa0f8('0x43')](this[_0xa0f8('0x16')][util[_0xa0f8('0x65')](_0xa0f8('0xf5'),_0x28f997[_0xa0f8('0x2c')])])&&!_[_0xa0f8('0x43')](this[_0xa0f8('0x16')][util[_0xa0f8('0x65')](_0xa0f8('0xf5'),_0x28f997[_0xa0f8('0x2c')])][_0xa0f8('0xf6')])&&(this['trunks'][util['format'](_0xa0f8('0xf5'),_0x28f997[_0xa0f8('0x2c')])][_0xa0f8('0xf6')]===_0xa0f8('0xf7')||this[_0xa0f8('0x16')][util['format']('SIP/%s',_0x28f997[_0xa0f8('0x2c')])]['status']===_0xa0f8('0xf8'));};Preview[_0xa0f8('0x10')][_0xa0f8('0x61')]=function(_0x33f7e1,_0x28ead4){return this['execRun'](_0x33f7e1,_0x28ead4)[_0xa0f8('0x5a')](function(_0x16a61e){return _[_0xa0f8('0x49')](_0x16a61e,[_0xa0f8('0x33')]);})[_0xa0f8('0x50')](function(_0x4feecb){if(_0x4feecb['unlock']){rpcDb['unlockContact'](_0x33f7e1);}if(_0x4feecb['active']){rpcDb[_0xa0f8('0xf9')](_0x33f7e1);}throw _[_0xa0f8('0x49')](_0x4feecb,[_0xa0f8('0x33')]);});};Preview[_0xa0f8('0x10')][_0xa0f8('0xfa')]=function(_0x2f7ee9,_0x16a7cd){var _0x2a79c0=this;var _0xc09aa3,_0x2a0a77;return rpcDb['getContactPreview'](_0x2f7ee9)['then'](function(_0x410104){if(!_[_0xa0f8('0x43')](_0x410104[0x0])){_0x2a0a77=_0x410104[0x0][_0xa0f8('0xfb')]?![]:!![];_0xc09aa3=_0x410104[0x0][_0xa0f8('0xfb')]?!![]:![];_0xc09aa3=_0x16a7cd?!![]:_0xc09aa3;}var _0x41fd54=_0x2a79c0['validateContact'](_0x410104);if(_0x41fd54['isValid']){rpcDb['checkIsBlackList'](_[_0xa0f8('0x49')](_0x410104[0x0],[_0xa0f8('0x4c'),_0xa0f8('0xe7')]))[_0xa0f8('0x5a')](function(_0x4bd206){_0x2a79c0[_0xa0f8('0xe6')](_0x4bd206,_0x410104[0x0],_0x16a7cd,_0x2a0a77,_0xc09aa3)[_0xa0f8('0x5a')](function(_0x1bf015){return _0x1bf015;})[_0xa0f8('0x50')](function(_0xa9cded){throw _0xa9cded;});})[_0xa0f8('0x50')](function(_0x102616){ut[_0xa0f8('0x35')](_0xa0f8('0xfc'),_0x102616);throw ut['message'](_0xa0f8('0xfd'),_0x2a0a77,_0xc09aa3);});}else{throw ut[_0xa0f8('0x33')](_0x41fd54['message'],_0x2a0a77,_0xc09aa3);}})[_0xa0f8('0x50')](function(_0x19d547){ut[_0xa0f8('0x35')](_0xa0f8('0xfe'),_0x19d547);throw ut[_0xa0f8('0x33')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xa0f8('0x10')][_0xa0f8('0xff')]=function(_0x3e633a){if(_[_0xa0f8('0x43')](_0x3e633a)||_['isEmpty'](_0x3e633a)||!_['isNil'](_0x3e633a[0x0][_0xa0f8('0x5f')])&&_[_0xa0f8('0x43')](_0x3e633a[0x0][_0xa0f8('0x5f')]['name'])){ut['logger'](_0xa0f8('0x100'),_0x3e633a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1a49ba=this[_0xa0f8('0x14')][_0x3e633a[0x0]['Queue']['name']];_0x1a49ba[_0xa0f8('0x33')]=utils[_0xa0f8('0x34')]['ACTIVE'];if(_[_0xa0f8('0x43')](_0x1a49ba)){ut['logger'](_0xa0f8('0x101'),_0x1a49ba);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa0f8('0x73')](_0x1a49ba[_0xa0f8('0x72')])){ut[_0xa0f8('0x35')](_0xa0f8('0x102'),_0xa0f8('0x103')+_0x1a49ba[_0xa0f8('0x2c')]+_0xa0f8('0x104'));if(!this[_0xa0f8('0x73')](_0x1a49ba[_0xa0f8('0x74')])){ut[_0xa0f8('0x35')](_0xa0f8('0x102'),_0x1a49ba['name']+_0xa0f8('0x105'));return{'isValid':![],'message':_0xa0f8('0x106')};}}if(!ut['isActive'](_0x1a49ba['dialActive'])){ut[_0xa0f8('0x35')]('[Preview][validateContact][Campaign\x20Active]',_0x1a49ba['name']+_0xa0f8('0x107'));return{'isValid':![],'message':_0xa0f8('0x103')+_0x1a49ba[_0xa0f8('0x2c')]+_0xa0f8('0x107')};}return{'isValid':!![],'message':_0xa0f8('0x108')};};Preview[_0xa0f8('0x10')][_0xa0f8('0xeb')]=function(_0x731bf9,_0xcf6a6b,_0x394b2b,_0x287592){var _0x1670e4=this;return new Promise(function(_0x5972e1,_0x5bfacf){var _0x224b63=_0x731bf9[_0xa0f8('0xa0')];var _0x251c59=_0x1670e4[_0xa0f8('0x73')](_0xcf6a6b[_0xa0f8('0x72')])?util[_0xa0f8('0x65')](_0xa0f8('0x109'),_0xcf6a6b[_0xa0f8('0x72')][_0xa0f8('0x2c')],_[_0xa0f8('0x43')](_0xcf6a6b['dialPrefix'])?'':_0xcf6a6b[_0xa0f8('0x10a')]['trim']()||'',_0xcf6a6b[_0xa0f8('0x10b')]>0x0?_0x394b2b[_0xa0f8('0xe7')][_0xa0f8('0x10c')](_0xcf6a6b[_0xa0f8('0x10b')]):_0x394b2b[_0xa0f8('0xe7')]):util[_0xa0f8('0x65')](_0xa0f8('0x109'),_[_0xa0f8('0x43')](_0xcf6a6b[_0xa0f8('0x74')])?_0xcf6a6b[_0xa0f8('0x72')][_0xa0f8('0x2c')]:_0xcf6a6b[_0xa0f8('0x74')][_0xa0f8('0x2c')],_['isNil'](_0xcf6a6b['dialPrefix'])?'':_0xcf6a6b['dialPrefix'][_0xa0f8('0x10d')]()||'',_0xcf6a6b['dialCutDigit']>0x0?_0x394b2b['phone'][_0xa0f8('0x10c')](_0xcf6a6b[_0xa0f8('0x10b')]):_0x394b2b[_0xa0f8('0xe7')]);var _0x29c070=_0x1670e4[_0xa0f8('0x73')](_0xcf6a6b[_0xa0f8('0x72')])?ut['getCallerId'](_0xcf6a6b[_0xa0f8('0x72')]['callerid'],_0xcf6a6b[_0xa0f8('0x10e')],_0xcf6a6b[_0xa0f8('0x10f')]>0x0?ut[_0xa0f8('0x110')](_0xcf6a6b[_0xa0f8('0x111')],_0xcf6a6b['dialRandomLastDigitCallerIdNumber']):_0xcf6a6b[_0xa0f8('0x111')]):ut['getCallerId'](_[_0xa0f8('0x43')](_0xcf6a6b[_0xa0f8('0x74')])?_0xcf6a6b[_0xa0f8('0x72')][_0xa0f8('0x112')]:_0xcf6a6b[_0xa0f8('0x74')][_0xa0f8('0x112')],_0xcf6a6b[_0xa0f8('0x10e')],_0xcf6a6b['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xa0f8('0x110')](_0xcf6a6b[_0xa0f8('0x111')],_0xcf6a6b[_0xa0f8('0x10f')]):_0xcf6a6b[_0xa0f8('0x111')]);if(_0x29c070){_0x731bf9[_0xa0f8('0x113')]=ut[_0xa0f8('0x114')](_0x29c070);_0x731bf9[_0xa0f8('0x115')]=ut['extractCalleridNumber'](_0x29c070);}var _0xc6b640=ut[_0xa0f8('0x116')](_0xcf6a6b,_0x394b2b,_0x251c59,_0x29c070,_0x224b63,_0x731bf9);var _0x17c481=utils[_0xa0f8('0x117')](_0x394b2b[_0xa0f8('0x118')]);Object[_0xa0f8('0x119')](_0xc6b640,_0x17c481);_[_0xa0f8('0x11a')](_0x731bf9,ut[_0xa0f8('0x11b')](_0xc6b640));_0x731bf9[_0xa0f8('0x64')]=moment()[_0xa0f8('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0xcf6a6b[_0xa0f8('0x11c')]=_0xc6b640;var _0x269cab=ut['variablesAction'](_0x731bf9,_0xcf6a6b,_0xc6b640,_0x731bf9['activeContact'],_0x287592);return ami[_0xa0f8('0x4e')](_0x269cab)[_0xa0f8('0x5a')](function(_0x16c333){_0xcf6a6b['originated']+=0x1;logger[_0xa0f8('0x29')]('[originated][increment]',_0x224b63,_0xa0f8('0xa1'),_0xcf6a6b[_0xa0f8('0x2c')],_0xa0f8('0x46'),_0xcf6a6b[_0xa0f8('0x2f')]);_0x5972e1(_0x16c333);})[_0xa0f8('0x50')](function(_0x458967){ut[_0xa0f8('0xdc')](_0x731bf9,0xe,_0xa0f8('0x11d'));rpcDb[_0xa0f8('0xdb')](_0x731bf9,_0xa0f8('0x11e'));_0x5bfacf(_0x458967);});});};Preview[_0xa0f8('0x10')][_0xa0f8('0x22')]=function(_0x2283ab){if(this[_0xa0f8('0x17')][_0x2283ab[_0xa0f8('0x8a')]]){this['actions'][_0x2283ab['linkedid']]['channel']=_0x2283ab['channel'];}};Preview[_0xa0f8('0x10')][_0xa0f8('0x1a')]=function(_0x4f7dd0){var _0x42cdae=this;var _0x313443=this[_0xa0f8('0x17')][_0x4f7dd0[_0xa0f8('0x11f')]];if(_0x313443){if(_0x313443[_0xa0f8('0xe9')]&&this[_0xa0f8('0x18')][_0x313443[_0xa0f8('0xe9')]]){ut[_0xa0f8('0x120')](_0x313443,this[_0xa0f8('0x18')][_0x313443[_0xa0f8('0xe9')]]['name'],this[_0xa0f8('0x18')][_0x313443[_0xa0f8('0xe9')]]['id']);}var _0x550b08=_['clone'](_0x313443);_0x550b08['responsetime']=moment()[_0xa0f8('0x65')]('YYYY-MM-DD\x20HH:mm:ss');var _0x56c32d=_0x42cdae[_0xa0f8('0x14')][_0x313443[_0xa0f8('0x47')]];if(ut[_0xa0f8('0x121')](_0x4f7dd0[_0xa0f8('0x122')])){if(_0x313443['unlockAgent']){rpcDb[_0xa0f8('0x123')](_0x313443[_0xa0f8('0x8d')]);}if(_0x313443['activeContact']){rpcDb[_0xa0f8('0xf9')](_0x313443[_0xa0f8('0x8d')]);}ami[_0xa0f8('0x28')]('custom:agentringnoanswer',ut[_0xa0f8('0x7b')](_0x313443,_0xa0f8('0x124'),this[_0xa0f8('0x14')][_0x313443[_0xa0f8('0x47')]]));this[_0xa0f8('0xd8')](_0x550b08,_0x56c32d,_0x4f7dd0);}else{_0x313443[_0xa0f8('0x64')]=moment()[_0xa0f8('0x65')](_0xa0f8('0x8f'));ut[_0xa0f8('0xdc')](_0x550b08,0x4,_0xa0f8('0x99'));rpcDb[_0xa0f8('0xdb')](_0x550b08,_0xa0f8('0x125'));}}};Preview[_0xa0f8('0x10')][_0xa0f8('0x1d')]=function(_0x372969){var _0x610d74=this[_0xa0f8('0x17')][_0x372969['linkedid']];var _0x36e469;if(_0x610d74){_0x36e469=this[_0xa0f8('0x14')][_0x610d74[_0xa0f8('0x47')]];logger['info']('[syncHangup][talking]',_0x372969[_0xa0f8('0x8a')],_0xa0f8('0xa1'),_0x36e469[_0xa0f8('0x2c')],'pTalking:\x20',_0x36e469[_0xa0f8('0x30')]);}if(this[_0xa0f8('0x17')][_0x372969[_0xa0f8('0x8a')]]&&_0x372969[_0xa0f8('0x8a')]!==_0x372969['uniqueid']){if(_0x372969[_0xa0f8('0x126')]==='16'&&this[_0xa0f8('0x17')][_0x372969[_0xa0f8('0x8a')]][_0xa0f8('0x48')]){this[_0xa0f8('0x76')](_0x372969,_0x372969[_0xa0f8('0x8a')],_0x372969['cause']);}else if(this['actions'][_0x372969[_0xa0f8('0x8a')]][_0xa0f8('0x48')]){logger['info'](_0xa0f8('0x127'),_0x372969[_0xa0f8('0x8a')],_0x372969[_0xa0f8('0x126')],_0xa0f8('0xa1'),_0x36e469[_0xa0f8('0x2c')],_0xa0f8('0x92'),_0x36e469[_0xa0f8('0x30')]);this['callProgressDetectingCustomer'](_0x372969,_0x372969[_0xa0f8('0x8a')],_0x372969[_0xa0f8('0x126')]);}}else if(_0x610d74&&_[_0xa0f8('0x43')](_0x610d74[_0xa0f8('0x128')])&&_0x36e469['dialQueueProject']&&_0x372969['linkedid']===_0x372969['uniqueid']&&_['isNil'](_0x372969['reason'])&&_0x372969['cause']==='16'&&_0x372969[_0xa0f8('0x129')]==='6'&&_[_0xa0f8('0xd9')](_0x610d74['transfer'])){if(_0x610d74[_0xa0f8('0x88')]){rpcDb[_0xa0f8('0x123')](_0x610d74[_0xa0f8('0x8d')]);}if(_0x610d74['activeContact']){rpcDb['disableContact'](_0x610d74[_0xa0f8('0x8d')]);}_0x372969['reason']='22';this['callProgressDetectingAgent'](_0x610d74,_0x36e469,_0x372969);}else if(_0x610d74&&_0x610d74[_0xa0f8('0x12a')]){if(_0x372969[_0xa0f8('0x126')]==='16'&&this['actions'][_0x372969['linkedid']]['dialAnswer']){logger[_0xa0f8('0x29')](_0xa0f8('0x12b'),_0x372969[_0xa0f8('0x8a')],_0x372969['cause'],_0xa0f8('0xa1'),_0x36e469['name'],_0xa0f8('0x92'),_0x36e469['pTalking']);this['callProgressDetectingCustomer'](_0x372969,_0x372969[_0xa0f8('0x8a')],_0x372969['cause']);}else if(this['actions'][_0x372969['linkedid']][_0xa0f8('0x48')]){logger[_0xa0f8('0x29')](_0xa0f8('0x127'),_0x372969[_0xa0f8('0x8a')],_0x372969[_0xa0f8('0x126')],_0xa0f8('0xa1'),_0x36e469[_0xa0f8('0x2c')],_0xa0f8('0x92'),_0x36e469[_0xa0f8('0x30')]);this[_0xa0f8('0x76')](_0x372969,_0x372969[_0xa0f8('0x8a')],_0x372969[_0xa0f8('0x126')]);}}};Preview[_0xa0f8('0x10')][_0xa0f8('0x20')]=function(_0xa9c2dc){if(this[_0xa0f8('0x17')][_0xa9c2dc[_0xa0f8('0x12c')]]&&_0xa9c2dc[_0xa0f8('0x12c')]!==_0xa9c2dc[_0xa0f8('0x12d')]){this[_0xa0f8('0x76')](_0xa9c2dc,_0xa9c2dc[_0xa0f8('0x12c')],_0xa9c2dc['dialstatus']);}};Preview[_0xa0f8('0x10')][_0xa0f8('0x1f')]=function(_0x1c118f){if(this[_0xa0f8('0x17')][_0x1c118f[_0xa0f8('0x8a')]]&&_0x1c118f[_0xa0f8('0x8a')]!==_0x1c118f[_0xa0f8('0xa0')]&&!this['actions'][_0x1c118f[_0xa0f8('0x8a')]][_0xa0f8('0x48')]){if(_0x1c118f[_0xa0f8('0x126')]==='1'){this[_0xa0f8('0x76')](_0x1c118f,_0x1c118f['linkedid'],_0x1c118f['cause']);}}};Preview[_0xa0f8('0x10')][_0xa0f8('0x12e')]=function(_0x1657e3,_0x53932c,_0x4ee76b){if(this[_0xa0f8('0x17')][_0x1657e3]){if(_[_0xa0f8('0x43')](this[_0xa0f8('0x17')][_0x1657e3][_0xa0f8('0x11c')])){this[_0xa0f8('0x17')][_0x1657e3][_0xa0f8('0x11c')]={};}this[_0xa0f8('0x17')][_0x1657e3]['variables'][_0x53932c]=_0x4ee76b;}};Preview[_0xa0f8('0x10')]['syncVarSet']=function(_0x299767){try{if(!_[_0xa0f8('0x43')](_0x299767)){if(ut[_0xa0f8('0x12f')](_['keys'](_0x299767[_0xa0f8('0x130')])[0x0])){this[_0xa0f8('0x12e')](_0x299767[_0xa0f8('0xa0')],_['keys'](_0x299767[_0xa0f8('0x130')])[0x0],_0x299767[_0xa0f8('0x131')]);}}}catch(_0x51ba60){logger[_0xa0f8('0x132')]('[syncVarSet][Preview]',util[_0xa0f8('0x133')](_0x51ba60,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0xf46cc2){if(_0xf46cc2){if(this[_0xa0f8('0x17')][_0xf46cc2[_0xa0f8('0x134')]]){this['actions'][_0xf46cc2[_0xa0f8('0x134')]]['transfer']=!![];}}};Preview[_0xa0f8('0x10')][_0xa0f8('0x26')]=function(_0x36517b){if(_0x36517b){if(this['actions'][_0x36517b[_0xa0f8('0x135')]]){this[_0xa0f8('0x17')][_0x36517b[_0xa0f8('0x135')]][_0xa0f8('0x12a')]=!![];}}};module[_0xa0f8('0x136')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c24fa2d..dea58f7 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 _0x36d7=['membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','error','inspect','createHistory','catch','then','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','disableContact','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename'];(function(_0x1586ee,_0x5dbc2d){var _0x44bfe=function(_0x4e114c){while(--_0x4e114c){_0x1586ee['push'](_0x1586ee['shift']());}};_0x44bfe(++_0x5dbc2d);}(_0x36d7,0xd0));var _0x736d=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x36d7[_0x4164f2];return _0x2575c7;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x736d('0x0'))(_0x736d('0x1'));var cmHopper=require(_0x736d('0x2'));var cmHopperHistory=require(_0x736d('0x3'));var cmHopperBlack=require(_0x736d('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5eaac7){return function(_0x509877){logger[_0x736d('0x5')](_0x5eaac7,util[_0x736d('0x6')](_0x509877,{'showHidden':![],'depth':null}));};}function create(_0x260cea){return cmHopperHistory[_0x736d('0x7')](_0x260cea)[_0x736d('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x56a929){return BPromise['resolve']()[_0x736d('0x9')](agentReportPreview[_0x736d('0x7')](_0x56a929))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0xb46417){return cmHopper['moveContactManagedDialer'](_0xb46417,!![])[_0x736d('0x8')](loggerCatch(_0x736d('0xa')));}exports[_0x736d('0xb')]=function(_0xc97c31){return cmHopperBlack['checkIsBlackList'](_0xc97c31)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x736d('0xc')]=function(_0x1be2a8){return BPromise[_0x736d('0xd')]()[_0x736d('0x9')](cmHopper[_0x736d('0xc')](_0x1be2a8))[_0x736d('0x8')](loggerCatch(_0x736d('0xe')));};exports[_0x736d('0x7')]=function(_0x36fb9e,_0x2165cc){create(_0x36fb9e)[_0x736d('0x8')](loggerCatch(_0x2165cc));moveContact(_0x36fb9e)[_0x736d('0x8')](loggerCatch(_0x2165cc));};exports[_0x736d('0xf')]=function(_0x3bdf17,_0x170c9c){createAgent(_0x3bdf17)[_0x736d('0x8')](loggerCatch(_0x170c9c));};exports[_0x736d('0x10')]=function(_0x275928,_0x576216){create(_0x275928)[_0x736d('0x8')](loggerCatch(_0x576216));};exports[_0x736d('0x11')]=function(_0x3a7209,_0x5e7c68){moveContact(_0x3a7209)[_0x736d('0x8')](loggerCatch(_0x5e7c68));};exports['rescheduleContact']=function(_0xcd0ffa,_0x153d78,_0x220cd2){if(_0x153d78){_0xcd0ffa[_0x736d('0x12')]=null;}if(_0x220cd2){_0xcd0ffa[_0x736d('0x13')]=![];}return cmHopper[_0x736d('0x14')](_0xcd0ffa)[_0x736d('0x8')](loggerCatch(_0x736d('0x15')));};exports[_0x736d('0x16')]=function(_0x3dca49){return cmHopper['countReScheduled'](_0x3dca49)[_0x736d('0x8')](loggerCatch(_0x736d('0x17')));};exports['unlockContact']=function(_0x2c72b9){return cmHopper['unlockContact']({'UserId':null},_0x2c72b9,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x736d('0x18')]=function(_0x38435e){return cmHopper[_0x736d('0x19')]({'active':![]},_0x38435e,0x1)[_0x736d('0x8')](loggerCatch('[activeContact]\x20'));};exports[_0x736d('0x1a')]=function(_0x41ec57){var _0x479641={};_0x479641[_0x736d('0x1b')]=_0x41ec57['type'];_0x479641['uniqueid']=_0x41ec57[_0x736d('0x1c')];_0x479641[_0x736d('0x1d')]=_0x41ec57[_0x736d('0x1d')];_0x479641['calleridname']=_0x41ec57['calleridname'];_0x479641[_0x736d('0x1e')]=_0x41ec57[_0x736d('0x1e')];_0x479641[_0x736d('0x1f')]=_0x41ec57[_0x736d('0x20')];_0x479641['queuecallerleaveAt']=_0x41ec57['answertime'];_0x479641[_0x736d('0x21')]=0x1;_0x479641[_0x736d('0x22')]=_0x41ec57[_0x736d('0x23')];_0x479641[_0x736d('0x24')]=_0x41ec57[_0x736d('0x25')];_0x479641[_0x736d('0x26')]=_0x736d('0x27');_0x479641['exten']=_0x736d('0x28');_0x479641['holdtime']=0x0;_0x479641[_0x736d('0x29')]=0x1;_0x479641[_0x736d('0x2a')]=_0x41ec57[_0x736d('0x25')];_0x479641[_0x736d('0x2b')]=_0x736d('0x2c');return BPromise[_0x736d('0xd')]()[_0x736d('0x9')](voiceQueueReport['create'](_0x479641))['catch'](loggerCatch(_0x736d('0x2d')));};exports['getContactRecallMe']=function(_0x3b47ad,_0x494bde){return BPromise[_0x736d('0xd')]()[_0x736d('0x9')](cmHopper[_0x736d('0x2e')](_0x3b47ad,_0x494bde))['catch'](loggerCatch(_0x736d('0x2f')));};exports['rescheduleContactInQueue']=function(_0x1bfc35){return cmHopper['rescheduleContact'](_0x1bfc35,!![],!![])[_0x736d('0x8')](loggerCatch(_0x736d('0x30')));}; \ No newline at end of file +var _0x621d=['[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','holdtime','assigned','lastAssignedTo','queuecallerexitreason'];(function(_0x41a20f,_0x1e32fd){var _0x422d13=function(_0x164fd8){while(--_0x164fd8){_0x41a20f['push'](_0x41a20f['shift']());}};_0x422d13(++_0x1e32fd);}(_0x621d,0xa1));var _0xd621=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x621d[_0x18a79d];return _0x4f8848;};'use strict';var util=require(_0xd621('0x0'));var BPromise=require(_0xd621('0x1'));var logger=require(_0xd621('0x2'))(_0xd621('0x3'));var cmHopper=require(_0xd621('0x4'));var cmHopperHistory=require(_0xd621('0x5'));var cmHopperBlack=require(_0xd621('0x6'));var agentReportPreview=require(_0xd621('0x7'));var voiceQueueReport=require(_0xd621('0x8'));function loggerCatch(_0x4b88b2){return function(_0x3519df){logger['error'](_0x4b88b2,util[_0xd621('0x9')](_0x3519df,{'showHidden':![],'depth':null}));};}function create(_0x17b4bf){return cmHopperHistory[_0xd621('0xa')](_0x17b4bf)[_0xd621('0xb')](loggerCatch(_0xd621('0xc')));}function createAgent(_0x3a5fd4){return BPromise[_0xd621('0xd')]()[_0xd621('0xe')](agentReportPreview[_0xd621('0xa')](_0x3a5fd4))['catch'](loggerCatch(_0xd621('0xc')));}function moveContact(_0x28b4cb){return cmHopper[_0xd621('0xf')](_0x28b4cb,!![])[_0xd621('0xb')](loggerCatch(_0xd621('0x10')));}exports['checkIsBlackList']=function(_0x14b0a2){return cmHopperBlack['checkIsBlackList'](_0x14b0a2)[_0xd621('0xb')](loggerCatch(_0xd621('0x11')));};exports['getContactPreview']=function(_0x4f8a18){return BPromise[_0xd621('0xd')]()['then'](cmHopper[_0xd621('0x12')](_0x4f8a18))[_0xd621('0xb')](loggerCatch(_0xd621('0x13')));};exports[_0xd621('0xa')]=function(_0x3a62ac,_0x41b768){create(_0x3a62ac)[_0xd621('0xb')](loggerCatch(_0x41b768));moveContact(_0x3a62ac)[_0xd621('0xb')](loggerCatch(_0x41b768));};exports[_0xd621('0x14')]=function(_0x406ed3,_0x25b63b){createAgent(_0x406ed3)[_0xd621('0xb')](loggerCatch(_0x25b63b));};exports[_0xd621('0x15')]=function(_0x1b39e0,_0x26c703){create(_0x1b39e0)[_0xd621('0xb')](loggerCatch(_0x26c703));};exports[_0xd621('0x16')]=function(_0x3e2bb8,_0x1d8649){moveContact(_0x3e2bb8)['catch'](loggerCatch(_0x1d8649));};exports[_0xd621('0x17')]=function(_0x2fb79e,_0x512ab6,_0x1e4419){if(_0x512ab6){_0x2fb79e['UserId']=null;}if(_0x1e4419){_0x2fb79e[_0xd621('0x18')]=![];}return cmHopper[_0xd621('0x17')](_0x2fb79e)[_0xd621('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xd621('0x19')]=function(_0x44ad68){return cmHopper[_0xd621('0x19')](_0x44ad68)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xd621('0x1a')]=function(_0x250b7f){return cmHopper['unlockContact']({'UserId':null},_0x250b7f,0x1)[_0xd621('0xb')](loggerCatch(_0xd621('0x1b')));};exports[_0xd621('0x1c')]=function(_0xa61df6){return cmHopper[_0xd621('0x1a')]({'active':![]},_0xa61df6,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xd621('0x1d')]=function(_0x5dff89){var _0x8d73a0={};_0x8d73a0[_0xd621('0x1e')]=_0x5dff89[_0xd621('0x1e')];_0x8d73a0[_0xd621('0x1f')]=_0x5dff89[_0xd621('0x1f')];_0x8d73a0[_0xd621('0x20')]=_0x5dff89['calleridnum'];_0x8d73a0[_0xd621('0x21')]=_0x5dff89['calleridname'];_0x8d73a0[_0xd621('0x22')]=_0x5dff89[_0xd621('0x22')];_0x8d73a0['queuecallerjoinAt']=_0x5dff89[_0xd621('0x23')];_0x8d73a0[_0xd621('0x24')]=_0x5dff89['answertime'];_0x8d73a0[_0xd621('0x25')]=0x1;_0x8d73a0[_0xd621('0x26')]=_0x5dff89[_0xd621('0x27')];_0x8d73a0[_0xd621('0x28')]=_0x5dff89[_0xd621('0x29')];_0x8d73a0[_0xd621('0x2a')]='from-sip';_0x8d73a0['exten']='xcally-motion-preview';_0x8d73a0[_0xd621('0x2b')]=0x0;_0x8d73a0[_0xd621('0x2c')]=0x1;_0x8d73a0[_0xd621('0x2d')]=_0x5dff89['membername'];_0x8d73a0[_0xd621('0x2e')]='COMPLETED';return BPromise[_0xd621('0xd')]()[_0xd621('0xe')](voiceQueueReport['create'](_0x8d73a0))[_0xd621('0xb')](loggerCatch(_0xd621('0x2f')));};exports[_0xd621('0x30')]=function(_0x2fc470,_0x122d94){return BPromise[_0xd621('0xd')]()['then'](cmHopper['getContactRecallMe'](_0x2fc470,_0x122d94))['catch'](loggerCatch(_0xd621('0x31')));};exports[_0xd621('0x32')]=function(_0x321c7c){return cmHopper[_0xd621('0x17')](_0x321c7c,!![],!![])[_0xd621('0xb')](loggerCatch(_0xd621('0x33')));}; \ 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 34613cf..c5b119c 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 _0x93e5=['rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','forEach','buildNoAnswerEventPayload','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','loggerError','info','message','getCallerId','isUndefined','string','\x22%s\x22\x20<%s>','format','isEmpty','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','endtime','talktime','answertime','isFailure','variablesAction','RECALL','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','reachable','push','milliseconds','diff','seconds','createBody','type','campaigntype','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x77186e,_0x15e210){var _0x4efd1a=function(_0x46c86b){while(--_0x46c86b){_0x77186e['push'](_0x77186e['shift']());}};_0x4efd1a(++_0x15e210);}(_0x93e5,0x1ac));var _0x593e=function(_0x2cf16f,_0x5899df){_0x2cf16f=_0x2cf16f-0x0;var _0xfb99c6=_0x93e5[_0x2cf16f];return _0xfb99c6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x593e('0x0'));var logger=require(_0x593e('0x1'))('preview');var ipAgi=process['env'][_0x593e('0x2')]||_0x593e('0x3');var utils=require('../../dialer/utils');exports[_0x593e('0x4')]=function(_0x24cb69){return function(_0x275e10){logger[_0x593e('0x5')](_0x24cb69,util[_0x593e('0x6')](_0x275e10,{'showHidden':![],'depth':null}));};};exports[_0x593e('0x7')]=function(_0x1cd46d,_0x471f97){logger['info'](_0x1cd46d,util[_0x593e('0x6')](_0x471f97,{'showHidden':![],'depth':null}));};exports[_0x593e('0x8')]=function(_0x4f62ab,_0x51f95e){logger[_0x593e('0x5')](_0x4f62ab,util[_0x593e('0x6')](_0x51f95e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xecf13f){return function(_0x4b7ccc){logger[_0x593e('0x9')](_0xecf13f,util[_0x593e('0x6')](_0x4b7ccc,{'showHidden':![],'depth':null}));};};exports[_0x593e('0xa')]=function(_0xb22ee8,_0x14d9c2,_0x1ae474){return{'message':_0xb22ee8,'unlock':_0x14d9c2,'active':_0x1ae474};};exports[_0x593e('0xb')]=function(_0x4e7970,_0x3d396f,_0x532051){if(!_[_0x593e('0xc')](_0x532051)&&_0x593e('0xd')===typeof _0x532051&&!_['isEmpty'](_0x532051)){if(!_[_0x593e('0xc')](_0x3d396f)&&_0x593e('0xd')===typeof _0x3d396f&&!_['isEmpty'](_0x3d396f)){return util['format'](_0x593e('0xe'),_0x3d396f,_0x532051);}return util[_0x593e('0xf')](_0x593e('0xe'),_0x532051,_0x532051);}if(!_['isUndefined'](_0x4e7970)&&'string'===typeof _0x4e7970&&!_[_0x593e('0x10')](_0x4e7970)){return _0x4e7970;}return'\x22\x22\x20<>';};exports[_0x593e('0x11')]=function(_0x55aa10){if(_['isNil'](_0x55aa10)){return![];}return _0x55aa10;};exports[_0x593e('0x12')]=function(_0x2b063d,_0x65365,_0x4b5323,_0x3aa14c,_0x28d9ea,_0x404fb0){var _0x518499={'XMD-QUEUE':_0x65365[_0x593e('0x13')]?_0x65365['Queue']['name']:'','XMD-CALLERID':_0x3aa14c,'XMD-CALLERID-PREVIEW':_0x404fb0?util[_0x593e('0xf')](_0x593e('0xe'),_0x404fb0[_0x593e('0x14')],_0x404fb0[_0x593e('0x15')]):_0x3aa14c,'XMD-DIALID':_0x28d9ea,'XMD-CONTACTID':_0x65365[_0x593e('0x16')],'XMD-CDRTYPE':_0x593e('0x17'),'CALLERID(all)':_0x3aa14c,'XMD-VOICEQUEUEID':_0x65365[_0x593e('0x18')],'XMD-DIALCHANNEL':_0x4b5323,'XMD-DIALTIMEOUT':_0x2b063d[_0x593e('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x593e('0xf')]('\x22rtTxX%s%s\x22',_0x2b063d[_0x593e('0x1a')]?'g':'',_[_0x593e('0x10')](_0x2b063d['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2b063d[_0x593e('0x1b')]||'','XMD-AGI':_0x2b063d[_0x593e('0x1c')]?util[_0x593e('0xf')](_0x593e('0x1d'),ipAgi,_0x2b063d[_0x593e('0x1c')]):_0x593e('0x1e'),'XMD-AGIAFTER':_0x2b063d[_0x593e('0x1a')]?util[_0x593e('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2b063d[_0x593e('0x1a')]):_0x593e('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x404fb0?_0x404fb0[_0x593e('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x404fb0?_0x404fb0[_0x593e('0x20')]:'','XMD-DESTINATION':_0x593e('0x21'),'SIPADDHEADER':_0x593e('0x22')};if(!_[_0x593e('0x10')](_0x2b063d[_0x593e('0x23')])){_0x518499[util[_0x593e('0xf')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2b063d['monitor_format'];_0x518499[util[_0x593e('0xf')]('%s',_0x593e('0x24'))]=_0x28d9ea;}return _0x518499;};exports[_0x593e('0x25')]=function(_0x21ac92){var _0x5dd4c3={};for(var _0x1676ff in _0x21ac92){if(_0x21ac92[_0x593e('0x26')](_0x1676ff)){_0x5dd4c3[util[_0x593e('0xf')]('%s',_[_0x593e('0x27')](_0x1676ff))]=_0x21ac92[_0x1676ff];}}return{'variables':_0x5dd4c3};};exports[_0x593e('0x28')]=function(_0x180239,_0x5d2863){if(!_[_0x593e('0x29')](_0x180239)){if(_0x180239[_0x593e('0x26')](_0x593e('0x2a'))){if(_0x180239[_0x593e('0x2a')]>0x0){_0x180239[_0x593e('0x2a')]-=0x1;}else{logger[_0x593e('0x5')](_0x593e('0x2b'),_0x5d2863);}}}else{logger[_0x593e('0x5')](_0x593e('0x2c'),_0x5d2863);}};exports[_0x593e('0x2d')]=function(_0x3531df){var _0x4be09b=moment()[_0x593e('0xf')](_0x593e('0x2e'));_0x3531df[_0x593e('0x2f')]=0xd;_0x3531df[_0x593e('0x30')]=_0x593e('0x31');_0x3531df[_0x593e('0x32')]=_0x4be09b;_0x3531df[_0x593e('0x33')]=_0x4be09b;_0x3531df['endtime']=_0x4be09b;};exports[_0x593e('0x34')]=function(_0x1c4113,_0x502565,_0xd6391){var _0x44bc8a=moment()['format'](_0x593e('0x2e'));_0x1c4113[_0x593e('0x2f')]=_0x502565;_0x1c4113[_0x593e('0x30')]=_0xd6391;_0x1c4113[_0x593e('0x33')]=_0x44bc8a;_0x1c4113[_0x593e('0x35')]=utils[_0x593e('0x36')](_0x1c4113[_0x593e('0x33')],_0x1c4113[_0x593e('0x32')]);};exports[_0x593e('0x37')]=function(_0x1bedbf,_0xbe4d99,_0x560093){_0x1bedbf[_0x593e('0x38')]=_0xbe4d99;_0x1bedbf[_0x593e('0x39')]=_0x560093;};exports['logCustomer']=function(_0x1403d2,_0x1436e8,_0x3f9e34){var _0x2a0567=moment()[_0x593e('0xf')](_0x593e('0x2e'));_0x1403d2['state']=_0x1436e8;_0x1403d2['statedesc']=_0x3f9e34;_0x1403d2[_0x593e('0x33')]=_0x1403d2['responsetime']?_0x1403d2[_0x593e('0x33')]:_0x2a0567;_0x1403d2['endtime']=_0x1403d2[_0x593e('0x3a')]?_0x1403d2[_0x593e('0x3a')]:_0x2a0567;_0x1403d2['ringtime']=utils[_0x593e('0x36')](_0x1403d2['responsetime']||0x0,_0x1403d2['starttime']||0x0);_0x1403d2[_0x593e('0x3b')]=_0x1403d2[_0x593e('0x3c')]?utils[_0x593e('0x36')](_0x1403d2[_0x593e('0x3a')],_0x1403d2[_0x593e('0x3c')]):0x0;};exports[_0x593e('0x3d')]=function(_0x1e6a84){return _0x1e6a84==='Failure';};exports[_0x593e('0x3e')]=function(_0x389457,_0x428cd5,_0x1f1b91,_0x45e3a2,_0x4db929){var _0x2e8593=_0x45e3a2?_0x593e('0x3f'):_0x389457[_0x593e('0x14')];_0x2e8593=_0x4db929?'BOOKED':_0x2e8593;return{'actionid':_0x389457[_0x593e('0x40')],'action':_0x593e('0x41'),'channel':_0x389457[_0x593e('0x42')],'callerid':util['format'](_0x593e('0xe'),_0x2e8593,_0x389457['calleridnum']),'Exten':_0x593e('0x21'),'Context':'from-sip','Priority':'1','variable':_0x1f1b91,'timeout':(_0x428cd5[_0x593e('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x389457[_0x593e('0x40')]};};exports[_0x593e('0x44')]=function(_0x1559f0){return _0x1559f0[_0x593e('0x45')]+_0x1559f0[_0x593e('0x46')]+_0x1559f0['countnoanswerretry']+_0x1559f0['countagentrejectretry']+_0x1559f0[_0x593e('0x47')];};exports[_0x593e('0x48')]=function(_0x27c9d2){var _0x2404f5=_[_0x593e('0x49')](_0x27c9d2);_0x2404f5[_0x593e('0x2f')]=0xf;_0x2404f5[_0x593e('0x30')]='Global';return _0x2404f5;};exports[_0x593e('0x4a')]=function(_0x4811ae,_0xc25f36,_0x3ba017){var _0x5ab961={};_0x5ab961[_0xc25f36]=_0x4811ae[_0xc25f36];_0x5ab961[_0x593e('0x4b')]=![];_0x5ab961[_0x593e('0x4c')]=moment()['add'](_0x3ba017,_0x593e('0x4d'))['format'](_0x593e('0x2e'));_0x5ab961[_0x593e('0x16')]=_0x4811ae[_0x593e('0x16')];_0x5ab961[_0x593e('0x4e')]=_0x4811ae[_0x593e('0x4e')];_0x5ab961['VoiceQueueId']=_0x4811ae['VoiceQueueId']||undefined;return _0x5ab961;};exports[_0x593e('0x4f')]=function(_0x5986d6,_0x16cbfa){if(!_[_0x593e('0x29')](_0x5986d6)){if(_0x5986d6[_0x593e('0x50')]>0x0){_0x5986d6[_0x593e('0x50')]-=0x1;}else{logger[_0x593e('0x5')](_0x16cbfa,_0x593e('0x51'));}}else{logger[_0x593e('0x5')](_0x16cbfa,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x593e('0x52')]=function(_0x2398f5){if(_0x2398f5<=0x0){return!![];}return![];};function buildObj(_0x44bc23,_0x3d663a,_0xd1b20a){_0x44bc23[_0x593e('0x53')]=_0x3d663a;_0x44bc23[_0x593e('0x54')]=_0x44bc23[_0x593e('0x55')];_0x44bc23[_0x593e('0x56')]=_0x44bc23[_0x593e('0x42')];_0x44bc23[_0x593e('0x57')]=_0x593e('0x58');if(_0xd1b20a){_0x44bc23[_0x593e('0x59')]=_0xd1b20a[_0x593e('0x59')];}return _0x44bc23;}exports[_0x593e('0x5a')]=buildObj;exports[_0x593e('0x5b')]=function(_0x3f2f40){var _0x547817={};_0x547817['queue']=_0x3f2f40[_0x593e('0x55')];_0x547817[_0x593e('0x56')]=_0x3f2f40[_0x593e('0x42')];_0x547817[_0x593e('0x40')]=_0x3f2f40[_0x593e('0x40')];return _0x547817;};exports[_0x593e('0x5c')]=function(_0x11ff66){var _0x3965f3=[];for(var _0x123c5f in _0x11ff66){if(_0x11ff66[_0x593e('0x26')](_0x123c5f)){if(!_['isNil'](_0x11ff66[_0x123c5f])&&_0x11ff66[_0x123c5f][_0x593e('0x2f')]===_0x593e('0x5d')&&_0x11ff66[_0x123c5f]['status']===_0x593e('0x5e')){_0x3965f3[_0x593e('0x5f')](_0x11ff66[_0x123c5f]['id']);}}}return _0x3965f3;};exports['getDiff']=function(_0x951b61){var _0x493b96=moment()[_0x593e('0x60')](0x0);var _0x5dc24c=moment(_0x951b61)[_0x593e('0x60')](0x0);return _0x493b96[_0x593e('0x61')](_0x5dc24c,_0x593e('0x62'));};exports[_0x593e('0x63')]=function(_0x19bbc2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x19bbc2['ContactId'],'ListId':_0x19bbc2[_0x593e('0x4e')],'VoiceQueueId':_0x19bbc2['VoiceQueueId']||undefined,'CampaignId':_0x19bbc2['CampaignId']||undefined};};exports['filterKey']=function(_0x58269a){if(_0x58269a===_0x593e('0x40')||_0x58269a==='idContact'||_0x58269a==='queue'||_0x58269a===_0x593e('0x64')||_0x58269a===_0x593e('0x65')||_0x58269a==='dialAnswer'||_0x58269a==='membername'||_0x58269a==='channelAgent'||_0x58269a===_0x593e('0x14')||_0x58269a===_0x593e('0x4b')||_0x58269a===_0x593e('0x15')||_0x58269a===_0x593e('0x4c')||_0x58269a==='countbusyretry'||_0x58269a===_0x593e('0x46')||_0x58269a===_0x593e('0x66')||_0x58269a===_0x593e('0x67')||_0x58269a===_0x593e('0x68')||_0x58269a===_0x593e('0x69')||_0x58269a==='callbackat'||_0x58269a===_0x593e('0x6a')||_0x58269a===_0x593e('0x16')||_0x58269a===_0x593e('0x4e')||_0x58269a===_0x593e('0x39')||_0x58269a==='VoiceQueueId'||_0x58269a==='sipcallid'||_0x58269a==='xmd-voicequeueid'||_0x58269a===_0x593e('0x6b')||_0x58269a===_0x593e('0x6c')||_0x58269a===_0x593e('0x6d')||_0x58269a===_0x593e('0x6e')||_0x58269a===_0x593e('0x6f')||_0x58269a===_0x593e('0x70')||_0x58269a==='xmd-dialid'||_0x58269a===_0x593e('0x71')||_0x58269a===_0x593e('0x72')||_0x58269a===_0x593e('0x73')||_0x58269a===_0x593e('0x74')||_0x58269a==='xmd-agiafter'||_0x58269a===_0x593e('0x75')||_0x58269a===_0x593e('0x76')||_0x58269a===_0x593e('0x77')||_0x58269a===_0x593e('0x78')||_0x58269a===_0x593e('0x79')||_0x58269a==='rtpaudioqosloss'||_0x58269a===_0x593e('0x7a')||_0x58269a===_0x593e('0x7b')||_0x58269a===_0x593e('0x7c')||_0x58269a==='rtpaudioqos'||_0x58269a===_0x593e('0x77')||_0x58269a==='rtpaudioqosjitter'||_0x58269a==='rtpaudioqosjitterbridged'||_0x58269a===_0x593e('0x7d')||_0x58269a==='rtpaudioqoslossbridged'||_0x58269a===_0x593e('0x7b')||_0x58269a==='rtpaudioqosrttbridged'||_0x58269a===_0x593e('0x7e')||_0x58269a===_0x593e('0x7f')||_0x58269a===_0x593e('0x2f')||_0x58269a===_0x593e('0x30')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5d1c6c,_0x38aa37){var _0x2792ca,_0x3c2e8d,_0x5653ec;if(_0x38aa37<=0x0){_0x38aa37=0x1;}_0x2792ca=new RegExp('\x5cw{0,'+_0x38aa37+'}$');_0x3c2e8d=Math[_0x593e('0x80')](0xa,_0x38aa37-0x1);_0x5653ec=Math['pow'](0xa,_0x38aa37)-0x1;return util[_0x593e('0xf')]('%s',_[_0x593e('0x81')](_0x5d1c6c,_0x2792ca,_[_0x593e('0x82')](_0x3c2e8d,_0x5653ec)));};exports[_0x593e('0x83')]=function(_0x541eea){var _0x577d6d=_0x541eea['match'](/"(.*?)"/);return _0x577d6d?_0x577d6d[0x1]:_0x541eea;};exports[_0x593e('0x84')]=function(_0x2d941e){var _0xb49a30=_0x2d941e[_0x593e('0x85')](/<(.*?)>/);return _0xb49a30?_0xb49a30[0x1]:_0x2d941e;};function buildNoAnswerEventPayload(_0x41ef89,_0x2bd401){var _0x4890f4=buildObj(_0x41ef89,_0x593e('0x86'));if(!_['isEmpty'](_0x2bd401[_0x593e('0x87')])){Object['keys'](_0x2bd401[_0x593e('0x87')])[_0x593e('0x88')](function(_0x44da46){_0x4890f4[_0x44da46['toLowerCase']()]=_0x2bd401[_0x593e('0x87')][_0x44da46];});}return _0x4890f4;}exports[_0x593e('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xa63a=['callback','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','XCALLY_IP_AGI','../../dialer/utils','error','inspect','info','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','endtime','logAgent','state','statedesc','logLookAgent','membername','UserId','logCustomer','ringtime','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','name','queue','interface','voice','buildObj','buildAcw','status','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','countnoanswerretry','countglobal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa63a,0xa4));var _0xaa63=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xa63a[_0x1bc0ae];return _0x501104;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xaa63('0x0'));var logger=require('../../../../config/logger')(_0xaa63('0x1'));var ipAgi=process['env'][_0xaa63('0x2')]||'127.0.0.1';var utils=require(_0xaa63('0x3'));exports['loggerCatch']=function(_0x3b3c84){return function(_0x1e28ae){logger[_0xaa63('0x4')](_0x3b3c84,util[_0xaa63('0x5')](_0x1e28ae,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x376d7f,_0x18f1b5){logger[_0xaa63('0x6')](_0x376d7f,util[_0xaa63('0x5')](_0x18f1b5,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4784da,_0x5852f4){logger['error'](_0x4784da,util['inspect'](_0x5852f4,{'showHidden':![],'depth':null}));};exports[_0xaa63('0x7')]=function(_0x10fe19){return function(_0x16334f){logger[_0xaa63('0x6')](_0x10fe19,util[_0xaa63('0x5')](_0x16334f,{'showHidden':![],'depth':null}));};};exports[_0xaa63('0x8')]=function(_0xcc0351,_0x5d6177,_0xe096a4){return{'message':_0xcc0351,'unlock':_0x5d6177,'active':_0xe096a4};};exports['getCallerId']=function(_0x5bf245,_0x1adc7e,_0x338959){if(!_[_0xaa63('0x9')](_0x338959)&&_0xaa63('0xa')===typeof _0x338959&&!_[_0xaa63('0xb')](_0x338959)){if(!_[_0xaa63('0x9')](_0x1adc7e)&&_0xaa63('0xa')===typeof _0x1adc7e&&!_[_0xaa63('0xb')](_0x1adc7e)){return util[_0xaa63('0xc')](_0xaa63('0xd'),_0x1adc7e,_0x338959);}return util[_0xaa63('0xc')](_0xaa63('0xd'),_0x338959,_0x338959);}if(!_[_0xaa63('0x9')](_0x5bf245)&&_0xaa63('0xa')===typeof _0x5bf245&&!_[_0xaa63('0xb')](_0x5bf245)){return _0x5bf245;}return'\x22\x22\x20<>';};exports[_0xaa63('0xe')]=function(_0x82a57a){if(_[_0xaa63('0xf')](_0x82a57a)){return![];}return _0x82a57a;};exports[_0xaa63('0x10')]=function(_0x3f8232,_0x5d5306,_0x3a7210,_0x5693f2,_0x184097,_0x29cd82){var _0x53cbaa={'XMD-QUEUE':_0x5d5306[_0xaa63('0x11')]?_0x5d5306['Queue']['name']:'','XMD-CALLERID':_0x5693f2,'XMD-CALLERID-PREVIEW':_0x29cd82?util['format'](_0xaa63('0xd'),_0x29cd82[_0xaa63('0x12')],_0x29cd82[_0xaa63('0x13')]):_0x5693f2,'XMD-DIALID':_0x184097,'XMD-CONTACTID':_0x5d5306[_0xaa63('0x14')],'XMD-CDRTYPE':_0xaa63('0x15'),'CALLERID(all)':_0x5693f2,'XMD-VOICEQUEUEID':_0x5d5306[_0xaa63('0x16')],'XMD-DIALCHANNEL':_0x3a7210,'XMD-DIALTIMEOUT':_0x3f8232[_0xaa63('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0xaa63('0xc')](_0xaa63('0x18'),_0x3f8232[_0xaa63('0x19')]?'g':'',_[_0xaa63('0xb')](_0x3f8232[_0xaa63('0x1a')])?'':_0xaa63('0x1b')),'XMD-DIALURL':_0x3f8232[_0xaa63('0x1c')]||'','XMD-AGI':_0x3f8232[_0xaa63('0x1d')]?util[_0xaa63('0xc')](_0xaa63('0x1e'),ipAgi,_0x3f8232[_0xaa63('0x1d')]):_0xaa63('0x1f'),'XMD-AGIAFTER':_0x3f8232['dialQueueProject2']?util[_0xaa63('0xc')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3f8232[_0xaa63('0x19')]):_0xaa63('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x29cd82?_0x29cd82[_0xaa63('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x29cd82?_0x29cd82[_0xaa63('0x21')]:'','XMD-DESTINATION':_0xaa63('0x22'),'SIPADDHEADER':_0xaa63('0x23')};if(!_[_0xaa63('0xb')](_0x3f8232['monitor_format'])){_0x53cbaa[util['format']('%s',_0xaa63('0x24'))]=_0x3f8232[_0xaa63('0x1a')];_0x53cbaa[util[_0xaa63('0xc')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x184097;}return _0x53cbaa;};exports[_0xaa63('0x25')]=function(_0x538439){var _0x588c92={};for(var _0x392558 in _0x538439){if(_0x538439[_0xaa63('0x26')](_0x392558)){_0x588c92[util['format']('%s',_[_0xaa63('0x27')](_0x392558))]=_0x538439[_0x392558];}}return{'variables':_0x588c92};};exports[_0xaa63('0x28')]=function(_0x3a98b9,_0x5852a6){if(!_[_0xaa63('0xf')](_0x3a98b9)){if(_0x3a98b9['hasOwnProperty']('originated')){if(_0x3a98b9['originated']>0x0){_0x3a98b9[_0xaa63('0x29')]-=0x1;}else{logger[_0xaa63('0x4')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5852a6);}}}else{logger[_0xaa63('0x4')](_0xaa63('0x2a'),_0x5852a6);}};exports[_0xaa63('0x2b')]=function(_0x5208a5){var _0x4ebcbc=moment()[_0xaa63('0xc')](_0xaa63('0x2c'));_0x5208a5['state']=0xd;_0x5208a5['statedesc']=_0xaa63('0x2d');_0x5208a5[_0xaa63('0x2e')]=_0x4ebcbc;_0x5208a5[_0xaa63('0x2f')]=_0x4ebcbc;_0x5208a5[_0xaa63('0x30')]=_0x4ebcbc;};exports[_0xaa63('0x31')]=function(_0xfe8c30,_0x469db0,_0x3b0a1e){var _0x351d62=moment()[_0xaa63('0xc')](_0xaa63('0x2c'));_0xfe8c30[_0xaa63('0x32')]=_0x469db0;_0xfe8c30[_0xaa63('0x33')]=_0x3b0a1e;_0xfe8c30['responsetime']=_0x351d62;_0xfe8c30['ringtime']=utils['getSeconds'](_0xfe8c30['responsetime'],_0xfe8c30[_0xaa63('0x2e')]);};exports[_0xaa63('0x34')]=function(_0x5675f7,_0x4d78d8,_0x1dc501){_0x5675f7[_0xaa63('0x35')]=_0x4d78d8;_0x5675f7[_0xaa63('0x36')]=_0x1dc501;};exports[_0xaa63('0x37')]=function(_0x57be1a,_0x1694c6,_0x8a303f){var _0x5e1507=moment()[_0xaa63('0xc')](_0xaa63('0x2c'));_0x57be1a[_0xaa63('0x32')]=_0x1694c6;_0x57be1a[_0xaa63('0x33')]=_0x8a303f;_0x57be1a[_0xaa63('0x2f')]=_0x57be1a[_0xaa63('0x2f')]?_0x57be1a[_0xaa63('0x2f')]:_0x5e1507;_0x57be1a[_0xaa63('0x30')]=_0x57be1a['endtime']?_0x57be1a[_0xaa63('0x30')]:_0x5e1507;_0x57be1a[_0xaa63('0x38')]=utils[_0xaa63('0x39')](_0x57be1a[_0xaa63('0x2f')]||0x0,_0x57be1a[_0xaa63('0x2e')]||0x0);_0x57be1a[_0xaa63('0x3a')]=_0x57be1a[_0xaa63('0x3b')]?utils[_0xaa63('0x39')](_0x57be1a['endtime'],_0x57be1a[_0xaa63('0x3b')]):0x0;};exports[_0xaa63('0x3c')]=function(_0x1dc8c3){return _0x1dc8c3===_0xaa63('0x3d');};exports[_0xaa63('0x3e')]=function(_0x4f421d,_0x315343,_0x55da6d,_0x51fed3,_0x469e42){var _0x20ae8c=_0x51fed3?'RECALL':_0x4f421d['calleridname'];_0x20ae8c=_0x469e42?_0xaa63('0x3f'):_0x20ae8c;return{'actionid':_0x4f421d[_0xaa63('0x40')],'action':_0xaa63('0x41'),'channel':_0x4f421d[_0xaa63('0x42')],'callerid':util[_0xaa63('0xc')](_0xaa63('0xd'),_0x20ae8c,_0x4f421d['calleridnum']),'Exten':_0xaa63('0x22'),'Context':_0xaa63('0x43'),'Priority':'1','variable':_0x55da6d,'timeout':(_0x315343[_0xaa63('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4f421d[_0xaa63('0x40')]};};exports[_0xaa63('0x45')]=function(_0x477913){return _0x477913[_0xaa63('0x46')]+_0x477913[_0xaa63('0x47')]+_0x477913['countnoanswerretry']+_0x477913[_0xaa63('0x48')]+_0x477913[_0xaa63('0x49')];};exports['cloneAction']=function(_0x1af5bb){var _0x4c45ad=_['clone'](_0x1af5bb);_0x4c45ad['state']=0xf;_0x4c45ad[_0xaa63('0x33')]='Global';return _0x4c45ad;};exports[_0xaa63('0x4a')]=function(_0x3f4f24,_0x51f51f,_0x5c85d5){var _0x14c70f={};_0x14c70f[_0x51f51f]=_0x3f4f24[_0x51f51f];_0x14c70f[_0xaa63('0x4b')]=![];_0x14c70f[_0xaa63('0x4c')]=moment()[_0xaa63('0x4d')](_0x5c85d5,_0xaa63('0x4e'))[_0xaa63('0xc')](_0xaa63('0x2c'));_0x14c70f[_0xaa63('0x14')]=_0x3f4f24[_0xaa63('0x14')];_0x14c70f['ListId']=_0x3f4f24[_0xaa63('0x4f')];_0x14c70f[_0xaa63('0x16')]=_0x3f4f24[_0xaa63('0x16')]||undefined;return _0x14c70f;};exports[_0xaa63('0x50')]=function(_0x1526fe,_0x11ee74){if(!_[_0xaa63('0xf')](_0x1526fe)){if(_0x1526fe['pTalking']>0x0){_0x1526fe[_0xaa63('0x51')]-=0x1;}else{logger[_0xaa63('0x4')](_0x11ee74,_0xaa63('0x52'));}}else{logger[_0xaa63('0x4')](_0x11ee74,_0xaa63('0x53'));}};exports[_0xaa63('0x54')]=function(_0x1b54e4){if(_0x1b54e4<=0x0){return!![];}return![];};function buildObj(_0x124640,_0x173597,_0x58fdd0){_0x124640['lastevent']=_0x173597;_0x124640[_0xaa63('0x55')]=_0x124640[_0xaa63('0x56')];_0x124640[_0xaa63('0x57')]=_0x124640[_0xaa63('0x42')];_0x124640['motionChannel']=_0xaa63('0x58');if(_0x58fdd0){_0x124640['mandatoryDisposition']=_0x58fdd0['mandatoryDisposition'];}return _0x124640;}exports[_0xaa63('0x59')]=buildObj;exports[_0xaa63('0x5a')]=function(_0x3fb342){var _0x514f93={};_0x514f93[_0xaa63('0x56')]=_0x3fb342[_0xaa63('0x56')];_0x514f93[_0xaa63('0x57')]=_0x3fb342['channelAgent'];_0x514f93[_0xaa63('0x40')]=_0x3fb342[_0xaa63('0x40')];return _0x514f93;};exports['agentReadyId']=function(_0x5f55bf){var _0x445fc6=[];for(var _0x1bce95 in _0x5f55bf){if(_0x5f55bf[_0xaa63('0x26')](_0x1bce95)){if(!_[_0xaa63('0xf')](_0x5f55bf[_0x1bce95])&&_0x5f55bf[_0x1bce95]['state']==='not_inuse'&&_0x5f55bf[_0x1bce95][_0xaa63('0x5b')]==='reachable'){_0x445fc6[_0xaa63('0x5c')](_0x5f55bf[_0x1bce95]['id']);}}}return _0x445fc6;};exports[_0xaa63('0x5d')]=function(_0x837e2f){var _0x4e9081=moment()[_0xaa63('0x5e')](0x0);var _0x3eecd0=moment(_0x837e2f)[_0xaa63('0x5e')](0x0);return _0x4e9081['diff'](_0x3eecd0,'seconds');};exports[_0xaa63('0x5f')]=function(_0x5604dd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5604dd['ContactId'],'ListId':_0x5604dd[_0xaa63('0x4f')],'VoiceQueueId':_0x5604dd[_0xaa63('0x16')]||undefined,'CampaignId':_0x5604dd[_0xaa63('0x60')]||undefined};};exports[_0xaa63('0x61')]=function(_0x69d8b5){if(_0x69d8b5===_0xaa63('0x40')||_0x69d8b5===_0xaa63('0x62')||_0x69d8b5==='queue'||_0x69d8b5===_0xaa63('0x63')||_0x69d8b5==='campaigntype'||_0x69d8b5==='dialAnswer'||_0x69d8b5==='membername'||_0x69d8b5===_0xaa63('0x42')||_0x69d8b5===_0xaa63('0x12')||_0x69d8b5==='active'||_0x69d8b5==='calleridnum'||_0x69d8b5===_0xaa63('0x4c')||_0x69d8b5===_0xaa63('0x46')||_0x69d8b5===_0xaa63('0x47')||_0x69d8b5===_0xaa63('0x64')||_0x69d8b5===_0xaa63('0x65')||_0x69d8b5===_0xaa63('0x66')||_0x69d8b5==='callbackuniqueid'||_0x69d8b5==='callbackat'||_0x69d8b5==='recallme'||_0x69d8b5==='ContactId'||_0x69d8b5===_0xaa63('0x4f')||_0x69d8b5===_0xaa63('0x36')||_0x69d8b5===_0xaa63('0x16')||_0x69d8b5===_0xaa63('0x67')||_0x69d8b5===_0xaa63('0x68')||_0x69d8b5===_0xaa63('0x69')||_0x69d8b5==='xmd-phone'||_0x69d8b5===_0xaa63('0x6a')||_0x69d8b5===_0xaa63('0x6b')||_0x69d8b5===_0xaa63('0x6c')||_0x69d8b5==='xmd-dialoptions'||_0x69d8b5==='xmd-dialid'||_0x69d8b5===_0xaa63('0x6d')||_0x69d8b5===_0xaa63('0x6e')||_0x69d8b5===_0xaa63('0x6f')||_0x69d8b5==='xmd-callerid'||_0x69d8b5===_0xaa63('0x70')||_0x69d8b5==='xmd-agi'||_0x69d8b5==='rtpaudioqos'||_0x69d8b5===_0xaa63('0x71')||_0x69d8b5===_0xaa63('0x72')||_0x69d8b5==='rtpaudioqosjitterbridged'||_0x69d8b5===_0xaa63('0x73')||_0x69d8b5==='rtpaudioqoslossbridged'||_0x69d8b5===_0xaa63('0x74')||_0x69d8b5==='rtpaudioqosrttbridged'||_0x69d8b5===_0xaa63('0x75')||_0x69d8b5===_0xaa63('0x71')||_0x69d8b5===_0xaa63('0x72')||_0x69d8b5===_0xaa63('0x76')||_0x69d8b5===_0xaa63('0x73')||_0x69d8b5===_0xaa63('0x77')||_0x69d8b5===_0xaa63('0x74')||_0x69d8b5===_0xaa63('0x78')||_0x69d8b5===_0xaa63('0x79')||_0x69d8b5===_0xaa63('0x7a')||_0x69d8b5==='state'||_0x69d8b5==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4644d6,_0x1b4899){var _0x4bac23,_0x8d2809,_0x50564d;if(_0x1b4899<=0x0){_0x1b4899=0x1;}_0x4bac23=new RegExp(_0xaa63('0x7b')+_0x1b4899+'}$');_0x8d2809=Math['pow'](0xa,_0x1b4899-0x1);_0x50564d=Math[_0xaa63('0x7c')](0xa,_0x1b4899)-0x1;return util[_0xaa63('0xc')]('%s',_['replace'](_0x4644d6,_0x4bac23,_['random'](_0x8d2809,_0x50564d)));};exports['extractCalleridName']=function(_0x2a7ec8){var _0x3cb8a1=_0x2a7ec8[_0xaa63('0x7d')](/"(.*?)"/);return _0x3cb8a1?_0x3cb8a1[0x1]:_0x2a7ec8;};exports[_0xaa63('0x7e')]=function(_0x5140a0){var _0x3b9c25=_0x5140a0[_0xaa63('0x7d')](/<(.*?)>/);return _0x3b9c25?_0x3b9c25[0x1]:_0x5140a0;};function buildNoAnswerEventPayload(_0x2dbdab,_0x5ec1ac){var _0x4044da=buildObj(_0x2dbdab,_0xaa63('0x7f'));if(!_[_0xaa63('0xb')](_0x5ec1ac[_0xaa63('0x80')])){Object[_0xaa63('0x81')](_0x5ec1ac[_0xaa63('0x80')])[_0xaa63('0x82')](function(_0x3f166a){_0x4044da[_0x3f166a[_0xaa63('0x83')]()]=_0x5ec1ac['variables'][_0x3f166a];});}return _0x4044da;}exports[_0xaa63('0x84')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 1257fb5..cb18979 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 _0x2c3a=['number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0x2c3a,0x1ed));var _0xa2c3=function(_0x2cf2a8,_0x45e93c){_0x2cf2a8=_0x2cf2a8-0x0;var _0x19c495=_0x2c3a[_0x2cf2a8];return _0x19c495;};'use strict';exports[_0xa2c3('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xa2c3('0x1'),'required':!![]},'membername':{'type':_0xa2c3('0x1'),'required':!![]},'penalty':{'type':_0xa2c3('0x2'),'required':![]},'paused':{'type':_0xa2c3('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xa2c3('0x1'),'required':!![]},'interface':{'type':_0xa2c3('0x1'),'required':!![]}};exports[_0xa2c3('0x4')]={'interface':{'type':_0xa2c3('0x1'),'required':!![]},'paused':{'type':_0xa2c3('0x3')},'reason':{'type':_0xa2c3('0x1'),'required':![]}};exports[_0xa2c3('0x5')]={'module':{'type':_0xa2c3('0x1'),'required':![]}};exports[_0xa2c3('0x6')]={'uniqueid':{'type':_0xa2c3('0x1'),'required':!![]}};exports[_0xa2c3('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xa2c3('0x1')},'format':{'type':_0xa2c3('0x1')},'mixmonitorid':{'type':_0xa2c3('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xa2c3('0x8')]={'uniqueid':{'type':_0xa2c3('0x1'),'required':!![]},'exten':{'type':_0xa2c3('0x1'),'required':!![]},'context':{'type':_0xa2c3('0x1')}}; \ No newline at end of file +var _0xd8f0=['queuepause','voicechannel','string','number','boolean','queueremove'];(function(_0x5c3021,_0x17409d){var _0x5a718a=function(_0x35a531){while(--_0x35a531){_0x5c3021['push'](_0x5c3021['shift']());}};_0x5a718a(++_0x17409d);}(_0xd8f0,0xaa));var _0x0d8f=function(_0x553a8e,_0x22f669){_0x553a8e=_0x553a8e-0x0;var _0x378498=_0xd8f0[_0x553a8e];return _0x378498;};'use strict';exports['queueadd']={'queue':{'type':_0x0d8f('0x0'),'required':!![]},'interface':{'type':_0x0d8f('0x0'),'required':!![]},'membername':{'type':_0x0d8f('0x0'),'required':!![]},'penalty':{'type':_0x0d8f('0x1'),'required':![]},'paused':{'type':_0x0d8f('0x2'),'required':![]}};exports[_0x0d8f('0x3')]={'queue':{'type':_0x0d8f('0x0'),'required':!![]},'interface':{'type':_0x0d8f('0x0'),'required':!![]}};exports[_0x0d8f('0x4')]={'interface':{'type':_0x0d8f('0x0'),'required':!![]},'paused':{'type':_0x0d8f('0x2')},'reason':{'type':_0x0d8f('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x0d8f('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0x0d8f('0x5')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x0d8f('0x0')},'format':{'type':_0x0d8f('0x0')},'mixmonitorid':{'type':_0x0d8f('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x0d8f('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index fe074a1..1344add 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 _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(_0x5ebe75,_0x178094){var _0x59ab2d=function(_0x35489d){while(--_0x35489d){_0x5ebe75['push'](_0x5ebe75['shift']());}};_0x59ab2d(++_0x178094);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0x5f2f[_0x3374fd];return _0xb10792;};'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 +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(_0x1df483,_0x340648){var _0x376fac=function(_0x1cc77f){while(--_0x1cc77f){_0x1df483['push'](_0x1df483['shift']());}};_0x376fac(++_0x340648);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5333d3,_0xff4d75){_0x5333d3=_0x5333d3-0x0;var _0x34421f=_0x5f2f[_0x5333d3];return _0x34421f;};'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 c19e36a..4ef4ec6 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 _0x8feb=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x8feb,0x1d5));var _0xb8fe=function(_0x51edc6,_0x289ff5){_0x51edc6=_0x51edc6-0x0;var _0xd0e23c=_0x8feb[_0x51edc6];return _0xd0e23c;};'use strict';function mergeDBDataToRealtime(_0x115015,_0xf59104){var _0x4aa2b1=Object[_0xb8fe('0x0')]({},_0x115015);for(var _0x1d371d in _0xf59104){if(_0x4aa2b1[_0xb8fe('0x1')](_0x1d371d)){_0x4aa2b1[_0x1d371d]=_0xf59104[_0x1d371d];}}return _0x4aa2b1;}exports[_0xb8fe('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x1227=['assign','hasOwnProperty'];(function(_0x2be3b1,_0x58685a){var _0x54dc5b=function(_0x56e6f2){while(--_0x56e6f2){_0x2be3b1['push'](_0x2be3b1['shift']());}};_0x54dc5b(++_0x58685a);}(_0x1227,0xe4));var _0x7122=function(_0x44a4f3,_0x57e709){_0x44a4f3=_0x44a4f3-0x0;var _0x44ce69=_0x1227[_0x44a4f3];return _0x44ce69;};'use strict';function mergeDBDataToRealtime(_0x1cd439,_0x22ebbb){var _0x74c9c4=Object[_0x7122('0x0')]({},_0x1cd439);for(var _0x128cde in _0x22ebbb){if(_0x74c9c4[_0x7122('0x1')](_0x128cde)){_0x74c9c4[_0x128cde]=_0x22ebbb[_0x128cde];}}return _0x74c9c4;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 49edfec..39a7cb2 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 _0xcc25=['linkedid','transfereelinkedid','uniqueid','type','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinenum','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','voiceDialReport','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','keys','getCallType','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','lastapplication','queue','context','from-voip-provider','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','calleridname','transfers'];(function(_0xfd917b,_0x5783a1){var _0x4202f5=function(_0x3cf391){while(--_0x3cf391){_0xfd917b['push'](_0xfd917b['shift']());}};_0x4202f5(++_0x5783a1);}(_0xcc25,0xd6));var _0x5cc2=function(_0x3898a4,_0x16e387){_0x3898a4=_0x3898a4-0x0;var _0x51a7ec=_0xcc25[_0x3898a4];return _0x51a7ec;};'use strict';var _=require(_0x5cc2('0x0'));var moment=require(_0x5cc2('0x1'));var util=require(_0x5cc2('0x2'));var config=require(_0x5cc2('0x3'));var ami=require(_0x5cc2('0x4'));var RpcVoiceAgentReport=require(_0x5cc2('0x5'));var RpcVoiceCallReport=require(_0x5cc2('0x6'));var RpcVoiceDialReport=require(_0x5cc2('0x7'));var RpcMemberReport=require(_0x5cc2('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x5cc2('0x9'));var RpcVoiceTransferReport=require(_0x5cc2('0xa'));var VoiceQueueReport=require(_0x5cc2('0xb'));var VoiceCallReport=require(_0x5cc2('0xc'));var VoiceAgentReport=require(_0x5cc2('0xd'));var VoiceDialReport=require(_0x5cc2('0xe'));var UserReport=require('./userReport');function Report(_0x3addbd){this[_0x5cc2('0xf')]=_0x3addbd;this[_0x5cc2('0x10')]=_0x3addbd['agents'];this[_0x5cc2('0x11')]=_0x3addbd[_0x5cc2('0x11')];}Report[_0x5cc2('0x12')]['sync']=function(_0x4e8830){var _0x391718=new VoiceQueueReport(this[_0x5cc2('0xf')]);var _0x1f80f3=new VoiceAgentReport(this[_0x5cc2('0xf')]);var _0x1e01ea=new VoiceDialReport(this[_0x5cc2('0xf')]);var _0x4b6d42=new VoiceCallReport(this[_0x5cc2('0xf')]);var _0x13838c=new UserReport(this['realtime']);if(config[_0x5cc2('0x13')]&&config[_0x5cc2('0x13')]['disabled']){ami['on'](_0x5cc2('0x14'),this[_0x5cc2('0x15')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x5cc2('0x16')]['bind'](this));ami['on'](_0x5cc2('0x17'),this[_0x5cc2('0x18')][_0x5cc2('0x19')](this));ami['on'](_0x5cc2('0x1a'),this['voiceDialReport'][_0x5cc2('0x19')](this));ami['on'](_0x5cc2('0x1b'),this[_0x5cc2('0x1c')][_0x5cc2('0x19')](this));ami['on']('attendedtransfer',this[_0x5cc2('0x1d')][_0x5cc2('0x19')](this));}};Report[_0x5cc2('0x12')][_0x5cc2('0x1e')]=function(_0x581f98){var _0x19adc7;_0x19adc7=_[_0x5cc2('0x1f')](this[_0x5cc2('0x10')],function(_0x31699c){return _0x31699c[_0x5cc2('0x20')]==_0x581f98||_0x31699c[_0x5cc2('0x21')]==_0x581f98;});if(_[_0x5cc2('0x22')](_0x19adc7)){var _0x2522a7=_[_0x5cc2('0x1f')](this['telephones'],function(_0x584cf7){return _0x584cf7['accountcode']==_0x581f98||_0x584cf7['name']==_0x581f98;});if(_0x2522a7){_0x19adc7=_[_0x5cc2('0x1f')](this[_0x5cc2('0x10')],function(_0x28134b){return _0x28134b[_0x5cc2('0x23')]==util[_0x5cc2('0x24')](_0x5cc2('0x25'),_0x2522a7['name']);});}}return _0x19adc7;};Report[_0x5cc2('0x12')][_0x5cc2('0x15')]=function(_0x21c53e){for(var _0x513072=0x0;_0x513072<_0x21c53e[_0x5cc2('0x26')];_0x513072+=0x1){var _0x3a1586=this[_0x5cc2('0x1e')](_0x21c53e[_0x513072]['connectedlinenum']);if(_0x3a1586){_0x21c53e[_0x513072][_0x5cc2('0x20')]=_0x3a1586[_0x5cc2('0x20')];_0x21c53e[_0x513072]['assigned']=!![];_0x21c53e[_0x513072]['lastAssignedTo']=_0x3a1586[_0x5cc2('0x21')];_0x21c53e[_0x513072][_0x5cc2('0x23')]=_[_0x5cc2('0x22')](_0x3a1586[_0x5cc2('0x23')])?util[_0x5cc2('0x24')](_0x5cc2('0x25'),_0x3a1586['name']):_0x3a1586[_0x5cc2('0x23')];if(_0x21c53e[_0x513072][_0x5cc2('0x27')]){_0x21c53e[_0x513072][_0x5cc2('0x28')]=moment()[_0x5cc2('0x24')](_0x5cc2('0x29'));}if(_0x21c53e[_0x513072][_0x5cc2('0x2a')]){_0x21c53e[_0x513072][_0x5cc2('0x2b')]=moment()[_0x5cc2('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x21c53e[_0x513072]);}RpcVoiceQueueReport['create'](_0x21c53e[_0x513072]);}};function extractCalleridNumber(_0x1d351d){var _0xe28da2=_0x1d351d[_0x5cc2('0x2c')](/<(.*?)>/);return _0xe28da2?_0xe28da2[0x1]:_0x1d351d;}Report['prototype']['getAgentByInternal']=function(_0x3b7648){for(var _0xc67b46=0x0;_0xc67b46',_0x4c3520[_0x5cc2('0x42')],_0x4c3520[_0x5cc2('0x31')]);}if(RpcVoiceTransferReport[_0x5cc2('0x43')][_0x4c3520['linkedid']]){var _0x4faebe=RpcVoiceTransferReport[_0x5cc2('0x43')][_0x4c3520[_0x5cc2('0x44')]];_0x4faebe[_0x5cc2('0x45')]=_0x4c3520[_0x5cc2('0x46')];RpcVoiceTransferReport[_0x5cc2('0x1c')](_0x4faebe);delete RpcVoiceTransferReport['transfers'][_0x4c3520[_0x5cc2('0x44')]];}if(_['isNil'](_0x4c3520[_0x5cc2('0x47')])){_0x4c3520[_0x5cc2('0x47')]=this[_0x5cc2('0x2e')](_0x4c3520);}if(_[_0x5cc2('0x22')](_0x4c3520['UserId'])){var _0x16822a=_0x4c3520[_0x5cc2('0x3e')][_0x5cc2('0x2f')]('-')[0x0];var _0x3d0c2e=this[_0x5cc2('0x10')][_0x16822a];if(!_0x3d0c2e)_0x3d0c2e=this[_0x5cc2('0x30')](_0x4c3520[_0x5cc2('0x20')]);if(_0x3d0c2e){_0x4c3520['UserId']=_0x3d0c2e['id'];_0x4c3520['membername']=_0x3d0c2e[_0x5cc2('0x21')];}}RpcVoiceCallReport[_0x5cc2('0x48')](_0x4c3520);if(_0x4c3520[_0x5cc2('0x49')]){for(var _0x5335f6=0x0;_0x5335f6<_0x4c3520[_0x5cc2('0x4a')][_0x5cc2('0x26')];_0x5335f6+=0x1){_0x4c3520[_0x5cc2('0x4b')]=_0x4c3520['monitors'][_0x5335f6][_0x5cc2('0x4c')];_0x4c3520[_0x5cc2('0x4d')]=_0x4c3520[_0x5cc2('0x4a')][_0x5335f6]['createdAt'];if(_0x4c3520[_0x5cc2('0x35')]==_0x5cc2('0x3b')){_0x4c3520[_0x5cc2('0x31')]=_0x4c3520[_0x5cc2('0x4e')];_0x4c3520[_0x5cc2('0x42')]=_0x4c3520[_0x5cc2('0x4f')];_0x4c3520[_0x5cc2('0x4e')]=_0x4c3520['accountcode'];_0x4c3520[_0x5cc2('0x4f')]=_0x4c3520[_0x5cc2('0x50')];_0x4c3520[_0x5cc2('0x35')]=_0x4c3520[_0x5cc2('0x3c')];}else if(_0x4c3520[_0x5cc2('0x35')]==_0x5cc2('0x51')){_0x4c3520[_0x5cc2('0x31')]=_0x4c3520[_0x5cc2('0x34')];_0x4c3520[_0x5cc2('0x35')]=_0x4c3520[_0x5cc2('0x3c')];}RpcVoiceRecording[_0x5cc2('0x48')](_0x4c3520);}}};Report[_0x5cc2('0x12')][_0x5cc2('0x18')]=function(_0x2763a1){if(_[_0x5cc2('0x52')](_0x2763a1)){_0x2763a1[_0x5cc2('0x53')](function(_0x2739d3){RpcVoiceAgentReport[_0x5cc2('0x48')](_0x2739d3);});}else{RpcVoiceAgentReport['create'](_0x2763a1);}};Report[_0x5cc2('0x12')]['voiceDialReport']=function(_0x432835){RpcVoiceDialReport['create'](_0x432835);var _0x35863e;var _0x379edf;var _0x12392b=_0x432835['channel'];if(_[_0x5cc2('0x54')](_0x12392b,_0x5cc2('0x55'))){_0x379edf=_0x12392b[_0x5cc2('0x56')](_0x12392b[_0x5cc2('0x57')]('/')+0x1,_0x12392b[_0x5cc2('0x57')]('@'));_0x35863e=_[_0x5cc2('0x1f')](this[_0x5cc2('0x10')],function(_0x582664){return _0x582664[_0x5cc2('0x58')]==_0x379edf||_0x582664[_0x5cc2('0x59')]==_0x379edf||_0x582664['accountcode']==_0x379edf;});}else{_0x379edf=_0x12392b['substring'](_0x12392b[_0x5cc2('0x57')]('/')+0x1,_0x12392b[_0x5cc2('0x5a')]('-'));_0x35863e=this[_0x5cc2('0x1e')](_0x379edf);}if(_0x35863e){_0x432835[_0x5cc2('0x23')]=_[_0x5cc2('0x22')](_0x35863e[_0x5cc2('0x23')])?util['format'](_0x5cc2('0x25'),_0x35863e[_0x5cc2('0x21')]):_0x35863e[_0x5cc2('0x23')];_0x432835[_0x5cc2('0x50')]=_0x35863e[_0x5cc2('0x21')];_0x432835[_0x5cc2('0x20')]=_0x35863e[_0x5cc2('0x20')];RpcMemberReport[_0x5cc2('0x5b')](_0x432835);}};Report[_0x5cc2('0x12')][_0x5cc2('0x1c')]=function(_0x2f791a){RpcVoiceTransferReport['transfers'][_0x2f791a[_0x5cc2('0x5c')]]=_0x2f791a;};Report[_0x5cc2('0x12')]['attendedTransfer']=function(_0x38fd4a){RpcVoiceTransferReport[_0x5cc2('0x1d')](_0x38fd4a);};module[_0x5cc2('0x5d')]=Report; \ No newline at end of file +var _0xd54f=['name','isNil','find','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','destination','exten','dialer','lastdata','queue','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','transfereelinkedid','uniqueid','blindTransfer','type','UserId','membername','filename','createdAt','monitors','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','accountcode'];(function(_0x37590e,_0x5d1390){var _0x2407f0=function(_0x8683df){while(--_0x8683df){_0x37590e['push'](_0x37590e['shift']());}};_0x2407f0(++_0x5d1390);}(_0xd54f,0x19e));var _0xfd54=function(_0x3f52a1,_0x1aaa20){_0x3f52a1=_0x3f52a1-0x0;var _0xf98fb7=_0xd54f[_0x3f52a1];return _0xf98fb7;};'use strict';var _=require(_0xfd54('0x0'));var moment=require('moment');var util=require(_0xfd54('0x1'));var config=require(_0xfd54('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xfd54('0x3'));var RpcVoiceCallReport=require(_0xfd54('0x4'));var RpcVoiceDialReport=require(_0xfd54('0x5'));var RpcMemberReport=require(_0xfd54('0x6'));var RpcVoiceQueueReport=require(_0xfd54('0x7'));var RpcVoiceRecording=require(_0xfd54('0x8'));var RpcVoiceTransferReport=require(_0xfd54('0x9'));var VoiceQueueReport=require(_0xfd54('0xa'));var VoiceCallReport=require(_0xfd54('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xfd54('0xc'));function Report(_0x35b512){this[_0xfd54('0xd')]=_0x35b512;this[_0xfd54('0xe')]=_0x35b512[_0xfd54('0xe')];this[_0xfd54('0xf')]=_0x35b512['telephones'];}Report[_0xfd54('0x10')][_0xfd54('0x11')]=function(_0x50895d){var _0x29e1dc=new VoiceQueueReport(this[_0xfd54('0xd')]);var _0x3685c7=new VoiceAgentReport(this[_0xfd54('0xd')]);var _0x1d9200=new VoiceDialReport(this[_0xfd54('0xd')]);var _0x20fd95=new VoiceCallReport(this[_0xfd54('0xd')]);var _0x127e94=new UserReport(this[_0xfd54('0xd')]);if(config[_0xfd54('0x12')]&&config[_0xfd54('0x12')]['disabled']){ami['on'](_0xfd54('0x13'),this[_0xfd54('0x14')][_0xfd54('0x15')](this));ami['on']('custom:voiceCallReport',this[_0xfd54('0x16')][_0xfd54('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0xfd54('0x17')][_0xfd54('0x15')](this));ami['on'](_0xfd54('0x18'),this[_0xfd54('0x19')][_0xfd54('0x15')](this));ami['on'](_0xfd54('0x1a'),this['blindTransfer'][_0xfd54('0x15')](this));ami['on'](_0xfd54('0x1b'),this[_0xfd54('0x1c')][_0xfd54('0x15')](this));}};Report[_0xfd54('0x10')][_0xfd54('0x1d')]=function(_0x496a9d){var _0x5860fc;_0x5860fc=_['find'](this['agents'],function(_0x3dd1a1){return _0x3dd1a1[_0xfd54('0x1e')]==_0x496a9d||_0x3dd1a1[_0xfd54('0x1f')]==_0x496a9d;});if(_[_0xfd54('0x20')](_0x5860fc)){var _0x5074bb=_[_0xfd54('0x21')](this[_0xfd54('0xf')],function(_0x99bcd3){return _0x99bcd3[_0xfd54('0x1e')]==_0x496a9d||_0x99bcd3[_0xfd54('0x1f')]==_0x496a9d;});if(_0x5074bb){_0x5860fc=_['find'](this[_0xfd54('0xe')],function(_0x2fe912){return _0x2fe912['interface']==util['format'](_0xfd54('0x22'),_0x5074bb['name']);});}}return _0x5860fc;};Report[_0xfd54('0x10')][_0xfd54('0x14')]=function(_0xe4621b){for(var _0x157d23=0x0;_0x157d23<_0xe4621b[_0xfd54('0x23')];_0x157d23+=0x1){var _0x1249b1=this[_0xfd54('0x1d')](_0xe4621b[_0x157d23][_0xfd54('0x24')]);if(_0x1249b1){_0xe4621b[_0x157d23][_0xfd54('0x1e')]=_0x1249b1[_0xfd54('0x1e')];_0xe4621b[_0x157d23][_0xfd54('0x25')]=!![];_0xe4621b[_0x157d23][_0xfd54('0x26')]=_0x1249b1[_0xfd54('0x1f')];_0xe4621b[_0x157d23][_0xfd54('0x27')]=_[_0xfd54('0x20')](_0x1249b1[_0xfd54('0x27')])?util['format'](_0xfd54('0x22'),_0x1249b1[_0xfd54('0x1f')]):_0x1249b1[_0xfd54('0x27')];if(_0xe4621b[_0x157d23][_0xfd54('0x28')]){_0xe4621b[_0x157d23][_0xfd54('0x29')]=moment()[_0xfd54('0x2a')](_0xfd54('0x2b'));}if(_0xe4621b[_0x157d23][_0xfd54('0x2c')]){_0xe4621b[_0x157d23]['queuecallerexitAt']=moment()[_0xfd54('0x2a')](_0xfd54('0x2b'));}RpcMemberReport[_0xfd54('0x14')](_0xe4621b[_0x157d23]);}RpcVoiceQueueReport[_0xfd54('0x2d')](_0xe4621b[_0x157d23]);}};function extractCalleridNumber(_0x3f6f71){var _0x41025c=_0x3f6f71[_0xfd54('0x2e')](/<(.*?)>/);return _0x41025c?_0x41025c[0x1]:_0x3f6f71;}Report[_0xfd54('0x10')][_0xfd54('0x2f')]=function(_0x524728){for(var _0x3780e8=0x0;_0x3780e80x0?!![]:![];if(!_0x197044){return this[_0x5f83('0x15')](this[_0x5f83('0x11')][_0x5f83('0x6f')]);}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x18')]=function(_0x20d61f){var _0x534766=this[_0x5f83('0x11')]['id'];if(this['summary'][_0x5f83('0x64')][_0x534766]&&this[_0x5f83('0x11')][_0x5f83('0x64')][_0x534766][_0x20d61f[_0x5f83('0x63')]]){this[_0x5f83('0x11')][_0x5f83('0x64')][_0x534766][_0x20d61f[_0x5f83('0x63')]][_0x5f83('0xe')][_0x5f83('0x70')](_0x20d61f);}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x13')]=function(_0x456482){var _0x350cfa=this;try{if(this['isNotNull'](_0x456482)&&this[_0x5f83('0x5d')](_0x456482[_0x5f83('0x50')])){logger[_0x5f83('0x4b')](_0x5f83('0x71'),util[_0x5f83('0x44')](_0x456482,{'showHidden':![],'depth':null}));var _0x42e130=this[_0x5f83('0xf')][_0x456482[_0x5f83('0x50')]];if(_0x42e130){logger['debug'](_0x5f83('0x72'),_0x42e130['name']);this['summary']['queues'][_0x42e130[_0x5f83('0x5b')]]={'summaryEvent':_0x456482};this[_0x5f83('0x11')][_0x5f83('0x6e')]+=0x1;return ami[_0x5f83('0x39')]({'action':_0x5f83('0x64'),'queue':_0x42e130[_0x5f83('0x5b')]})[_0x5f83('0x62')](function(_0x187474){if(!_0x350cfa[_0x5f83('0x11')]['queuestatus'][_0x456482['actionid']]){_0x350cfa[_0x5f83('0x11')]['queuestatus'][_0x456482['actionid']]={};}_0x350cfa[_0x5f83('0x11')]['queuestatus'][_0x456482[_0x5f83('0x63')]][_0x187474[_0x5f83('0x63')]]={'queue':_0x42e130[_0x5f83('0x5b')],'agents':[]};})[_0x5f83('0x3c')](function(_0x248270){throw _0x248270;});}}}catch(_0x45dc86){logger[_0x5f83('0x3f')](_0x5f83('0x73'),util['inspect'](_0x45dc86,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5f83('0x9')]['syncQueueSummaryComplete']=function(_0x4e0a17){if(this[_0x5f83('0x11')]['statusRequests']>0x0){this[_0x5f83('0x11')][_0x5f83('0x6f')]=_0x4e0a17;return;}logger['debug'](_0x5f83('0x74'),util[_0x5f83('0x44')](_0x4e0a17,{'showHidden':![],'depth':null}));this[_0x5f83('0x11')]=initializeSummary();ami[_0x5f83('0x49')](_0x5f83('0x75'),{});};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x1b')]=function(_0x2fbe68){try{if(this['isNotNull'](_0x2fbe68)){logger[_0x5f83('0x4b')](_0x5f83('0x76'),_0x2fbe68[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x2fbe68,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5f83('0xd')][_0x2fbe68[_0x5f83('0x4e')]])){this[_0x5f83('0xd')][_0x2fbe68['uniqueid']]=[];}if(_['isUndefined'](this[_0x5f83('0x37')][_0x2fbe68['uniqueid']])){this[_0x5f83('0x37')][_0x2fbe68[_0x5f83('0x4e')]]={};}var _0x2d9c7f=new QueueReport();_0x2d9c7f[_0x5f83('0x50')]=_0x2fbe68[_0x5f83('0x50')];_0x2d9c7f['type']=this[_0x5f83('0xf')][_0x2d9c7f[_0x5f83('0x50')]]&&this[_0x5f83('0xf')][_0x2d9c7f[_0x5f83('0x50')]]['type']?this[_0x5f83('0xf')][_0x2d9c7f[_0x5f83('0x50')]][_0x5f83('0x6a')]||_0x5f83('0x5a'):_0x5f83('0x5a');_0x2d9c7f[_0x5f83('0x77')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d9c7f[_0x5f83('0x78')]=_0x2fbe68['position'];_0x2d9c7f[_0x5f83('0x79')]=_0x2fbe68['count'];_0x2d9c7f['uniqueid']=_0x2fbe68[_0x5f83('0x4e')];_0x2d9c7f[_0x5f83('0x7a')]=this[_0x5f83('0x37')][_0x2fbe68[_0x5f83('0x4e')]][_0x5f83('0x7a')];logger[_0x5f83('0x7b')](_0x5f83('0x7c'),_0x2d9c7f['queue'],_0x2d9c7f[_0x5f83('0x6a')]);Object['assign'](_0x2d9c7f,_['pick'](_0x2fbe68,_['keys'](_0x2d9c7f)));this[_0x5f83('0xd')][_0x2fbe68['uniqueid']][_0x5f83('0x70')](_0x2d9c7f);this['channels'][_0x2fbe68[_0x5f83('0x4e')]]=_0x2d9c7f;this[_0x5f83('0x4a')](_0x2d9c7f,_0x5f83('0x7d'));}}catch(_0x158f84){logger[_0x5f83('0x3f')](_0x5f83('0x76'),_0x2fbe68[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x158f84,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x5e993e){try{if(this[_0x5f83('0x5d')](_0x5e993e)){logger['debug'](_0x5f83('0x7e'),_0x5e993e[_0x5f83('0x4e')],util['inspect'](_0x5e993e,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0x5e993e[_0x5f83('0x4e')]]){var _0x1b46fe=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5e993e[_0x5f83('0x4e')]]);_0x1b46fe[_0x5f83('0x35')]=![];_0x1b46fe[_0x5f83('0x80')]=null;_0x1b46fe['holdtime']=_0x5e993e[_0x5f83('0x81')];_0x1b46fe[_0x5f83('0x82')]=_0x5e993e[_0x5f83('0x82')];_0x1b46fe['queuecallerabandon']=!![];_0x1b46fe[_0x5f83('0x83')]=moment()['format'](_0x5f83('0x84'));_0x1b46fe[_0x5f83('0x54')]=_0x5f83('0x85');_0x1b46fe['lastAssignedTo']=null;logger[_0x5f83('0x7b')](_0x5f83('0x86'),_0x1b46fe[_0x5f83('0x50')],_0x1b46fe[_0x5f83('0x6a')]);this[_0x5f83('0x37')][_0x5e993e[_0x5f83('0x4e')]]=_0x1b46fe;this[_0x5f83('0x47')](_0x1b46fe,_0x5f83('0x1c'));}}}catch(_0x4b244d){logger[_0x5f83('0x3f')](_0x5f83('0x7e'),_0x5e993e[_0x5f83('0x4e')],util['inspect'](_0x4b244d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x1f')]=function(_0xb0691b){try{if(this[_0x5f83('0x5d')](_0xb0691b)){logger[_0x5f83('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0xb0691b['uniqueid'],util[_0x5f83('0x44')](_0xb0691b,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0xb0691b[_0x5f83('0x4e')]]){var _0x59c8bf=_['last'](this[_0x5f83('0xd')][_0xb0691b[_0x5f83('0x4e')]]);_0x59c8bf['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x59c8bf['connectedlinenum']=_0xb0691b[_0x5f83('0x87')];_0x59c8bf[_0x5f83('0x88')]=_0xb0691b[_0x5f83('0x88')];logger[_0x5f83('0x7b')](_0x5f83('0x89'),_0x59c8bf[_0x5f83('0x50')],_0x59c8bf[_0x5f83('0x6a')],_0xb0691b['connectedlinenum'],_0xb0691b[_0x5f83('0x88')]);this[_0x5f83('0x37')][_0xb0691b[_0x5f83('0x4e')]]=_0x59c8bf;this[_0x5f83('0x4a')](_0x59c8bf,_0x5f83('0x1e'));}}}catch(_0x5b4f59){logger[_0x5f83('0x3f')](_0x5f83('0x8a'),_0xb0691b[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x5b4f59,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5f83('0x22')]=function(_0x55ac44){try{if(this[_0x5f83('0x5d')](_0x55ac44)){logger['debug'](_0x5f83('0x8b'),_0x55ac44['uniqueid'],util[_0x5f83('0x44')](_0x55ac44,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0x55ac44[_0x5f83('0x4e')]]){var _0x3b3cd1=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x55ac44['uniqueid']]);_0x3b3cd1['queuecallercomplete']=!![];_0x3b3cd1['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x5f83('0x7b')](_0x5f83('0x8c'),_0x3b3cd1[_0x5f83('0x50')],_0x3b3cd1[_0x5f83('0x6a')]);}}}catch(_0x3d31b8){logger['error'](_0x5f83('0x8b'),_0x55ac44[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x3d31b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0x8d')]=function(_0x5c2c75){try{if(this[_0x5f83('0x5d')](_0x5c2c75)){logger['debug'](_0x5f83('0x8e'),_0x5c2c75[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x5c2c75,{'showHidden':![],'depth':null}));if(this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x4e')]]){var _0x4a668e=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5c2c75['uniqueid']]);_0x4a668e['queuecallerabandon']=![];_0x4a668e[_0x5f83('0x83')]=null;_0x4a668e[_0x5f83('0x8f')]=!![];_0x4a668e[_0x5f83('0x90')]=_0x5c2c75[_0x5f83('0x91')];_0x4a668e[_0x5f83('0x81')]=_0x5c2c75['holdtime'];_0x4a668e[_0x5f83('0x35')]=!![];_0x4a668e[_0x5f83('0x92')]=![];_0x4a668e[_0x5f83('0x93')]=null;if(!_0x4a668e['transfer']){if(_0x5c2c75[_0x5f83('0x94')]==_0x5f83('0x95')){_0x4a668e[_0x5f83('0x54')]='COMPLETED';logger[_0x5f83('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4a668e[_0x5f83('0x50')],_0x4a668e[_0x5f83('0x6a')]);}else{if(_[_0x5f83('0x96')](_0x5c2c75[_0x5f83('0x3b')][_0x5f83('0x97')](),_0x5f83('0x98'))){if(this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x99')]]){var _0x51a8da=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x99')]]);_0x51a8da[_0x5f83('0x35')]=![];_0x51a8da[_0x5f83('0x92')]=!![];_0x51a8da[_0x5f83('0x93')]=moment(_0x4a668e[_0x5f83('0x77')])['add'](_0x5c2c75[_0x5f83('0x81')],_0x5f83('0x9a'))[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x51a8da[_0x5f83('0x54')]='FORWARDTRANSFER';_0x51a8da[_0x5f83('0x95')]=!![];_0x51a8da[_0x5f83('0x9b')]='FORWARD';_0x51a8da[_0x5f83('0x9c')]=_0x5c2c75[_0x5f83('0x9d')];_0x51a8da[_0x5f83('0x9e')]=_0x5c2c75[_0x5f83('0x4e')];logger['info'](_0x5f83('0x9f'),_0x51a8da[_0x5f83('0x50')],_0x51a8da[_0x5f83('0x6a')]);var _0x4408e7=this[_0x5f83('0xd')][_0x5c2c75[_0x5f83('0x99')]];this['queueReports'][_0x5c2c75[_0x5f83('0x99')]]=this[_0x5f83('0xd')][_0x5c2c75['uniqueid']];this['queueReports'][_0x5c2c75[_0x5f83('0x4e')]]=_0x4408e7;}}else{_0x4a668e[_0x5f83('0x54')]=_0x5f83('0xa0')+_0x5c2c75[_0x5f83('0x94')][_0x5f83('0xa1')]();logger[_0x5f83('0x7b')](_0x5f83('0xa2'),_0x4a668e[_0x5f83('0x50')],_0x4a668e['type'],_0x4a668e['queuecallerexitreason']);}}}this[_0x5f83('0x37')][_0x5c2c75[_0x5f83('0x4e')]]=_0x4a668e;}}}catch(_0x53804c){logger[_0x5f83('0x3f')](_0x5f83('0x8e'),_0x5c2c75[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x53804c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5f83('0xa3')]=function(_0x5d13b4){try{if(this[_0x5f83('0x5d')](_0x5d13b4)){logger[_0x5f83('0x4b')]('[%s][voiceQueueReport][varset]',_0x5d13b4[_0x5f83('0x4e')],util[_0x5f83('0x44')](_0x5d13b4,{'showHidden':![],'depth':null}));this['addVariable'](_0x5d13b4[_0x5f83('0x4e')],_[_0x5f83('0xa4')](_0x5d13b4[_0x5f83('0xa5')])[0x0],_0x5d13b4[_0x5f83('0xa6')]);if(this[_0x5f83('0xd')][_0x5d13b4[_0x5f83('0x4e')]]){var _0x54bfad=_[_0x5f83('0x7f')](this[_0x5f83('0xd')][_0x5d13b4[_0x5f83('0x4e')]]);if(_0x54bfad){if(this[_0x5f83('0x5d')](_0x5d13b4['variable'])&&this['isNotNull'](_0x5d13b4[_0x5f83('0xa5')]['queuestatus'])){switch(_0x5d13b4[_0x5f83('0xa6')]){case _0x5f83('0xa7'):_0x54bfad[_0x5f83('0x92')]=![];_0x54bfad[_0x5f83('0x93')]=null;break;case'TIMEOUT':_0x54bfad[_0x5f83('0xa8')]=_0x5f83('0xa9');_0x54bfad[_0x5f83('0x92')]=!![];_0x54bfad[_0x5f83('0x93')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x54bfad['queuecallerleaveAt']=moment()[_0x5f83('0x56')](_0x5f83('0x84'));logger['debug'](_0x5f83('0xaa'),_0x5d13b4['uniqueid'],util['inspect'](_0x54bfad,{'showHidden':![],'depth':null}));ami[_0x5f83('0x49')](_0x5f83('0xab'),_0x54bfad);break;default:_0x54bfad[_0x5f83('0x92')]=!![];_0x54bfad[_0x5f83('0x93')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x54bfad[_0x5f83('0xac')]=moment()[_0x5f83('0x56')](_0x5f83('0x84'));}_0x54bfad[_0x5f83('0x1c')]=![];_0x54bfad['queuecallerabandonAt']=null;_0x54bfad[_0x5f83('0x54')]=_0x5d13b4[_0x5f83('0xa6')];this[_0x5f83('0x37')][_0x5d13b4[_0x5f83('0x4e')]]=_0x54bfad;this[_0x5f83('0x47')](_0x54bfad,_0x5f83('0x23'));}else if(this[_0x5f83('0x5d')](_0x5d13b4['variable'])&&this['isNotNull'](_0x5d13b4['variable'][_0x5f83('0xad')])){if(!_0x54bfad[_0x5f83('0x1c')]){_0x54bfad[_0x5f83('0x92')]=!![];_0x54bfad['queuecallerexitAt']=moment()['format'](_0x5f83('0x84'));_0x54bfad[_0x5f83('0x54')]=_0x5f83('0xae');_0x54bfad[_0x5f83('0xac')]=moment()[_0x5f83('0x56')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5d13b4['uniqueid']]=_0x54bfad;}}logger[_0x5f83('0x7b')](_0x5f83('0xaf'),_0x5d13b4[_0x5f83('0x4e')],_0x54bfad[_0x5f83('0x50')],_0x54bfad['type'],_[_0x5f83('0xa4')](_0x5d13b4[_0x5f83('0xa5')])[0x0],_0x5d13b4[_0x5f83('0xa6')]);_0x54bfad[_0x5f83('0x42')]=this[_0x5f83('0x42')][_0x5d13b4[_0x5f83('0x4e')]];}}}}catch(_0xe00ed3){logger['error'](_0x5f83('0xb0'),_0x5d13b4['uniqueid'],util[_0x5f83('0x44')](_0xe00ed3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5f83('0xb1')]=function(_0x4ea814,_0x3343f5,_0x17e11f){var _0x844000=[_0x5f83('0xb2'),'rtpaudioqosbridged',_0x5f83('0xb3'),_0x5f83('0xb4'),_0x5f83('0xb5'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x5f83('0xb6'),_0x5f83('0xb7'),_0x5f83('0xb8'),_0x5f83('0xb9'),_0x5f83('0xba'),_0x5f83('0xbb'),_0x5f83('0xbc'),_0x5f83('0xbd'),_0x5f83('0xbe'),_0x5f83('0x91'),_0x5f83('0xbf'),_0x5f83('0xc0')];if(!_['isNil'](_0x3343f5)&&!_[_0x5f83('0xc1')](_0x844000,_0x3343f5)){if(_[_0x5f83('0x5e')](this[_0x5f83('0x42')][_0x4ea814])){this[_0x5f83('0x42')][_0x4ea814]={};}this[_0x5f83('0x42')][_0x4ea814][_0x3343f5]=_0x17e11f;}};VoiceQueueReport[_0x5f83('0x9')][_0x5f83('0xc2')]=function(_0x16239d,_0x3bec4d,_0x5bd7c4){try{var _0x5f4c20={};if(this[_0x5f83('0xd')][_0x16239d]){for(var _0x47db33=0x0;_0x47db330x0?!![]:![];if(!_0x53f487){return this[_0x2f41('0x1c')](this[_0x2f41('0x17')]['completeEvent']);}};VoiceQueueReport[_0x2f41('0xb')][_0x2f41('0x1e')]=function(_0x2a02d2){var _0x5a14a7=this['summary']['id'];if(this['summary']['queuestatus'][_0x5a14a7]&&this[_0x2f41('0x17')][_0x2f41('0x66')][_0x5a14a7][_0x2a02d2[_0x2f41('0x5e')]]){this[_0x2f41('0x17')][_0x2f41('0x66')][_0x5a14a7][_0x2a02d2[_0x2f41('0x5e')]][_0x2f41('0x12')][_0x2f41('0x6b')](_0x2a02d2);}};VoiceQueueReport[_0x2f41('0xb')]['syncQueueSummary']=function(_0x32a60a){var _0xa72961=this;try{if(this['isNotNull'](_0x32a60a)&&this[_0x2f41('0x6c')](_0x32a60a[_0x2f41('0x4c')])){logger['debug'](_0x2f41('0x6d'),util[_0x2f41('0x41')](_0x32a60a,{'showHidden':![],'depth':null}));var _0x10f62e=this['voiceQueues'][_0x32a60a['queue']];if(_0x10f62e){logger[_0x2f41('0x49')](_0x2f41('0x6e'),_0x10f62e[_0x2f41('0x59')]);this['summary'][_0x2f41('0x5c')][_0x10f62e[_0x2f41('0x59')]]={'summaryEvent':_0x32a60a};this[_0x2f41('0x17')][_0x2f41('0x6a')]+=0x1;return ami[_0x2f41('0x3a')]({'action':_0x2f41('0x66'),'queue':_0x10f62e[_0x2f41('0x59')]})[_0x2f41('0x6f')](function(_0x4dfe5b){if(!_0xa72961['summary'][_0x2f41('0x66')][_0x32a60a[_0x2f41('0x5e')]]){_0xa72961['summary'][_0x2f41('0x66')][_0x32a60a['actionid']]={};}_0xa72961[_0x2f41('0x17')][_0x2f41('0x66')][_0x32a60a[_0x2f41('0x5e')]][_0x4dfe5b['actionid']]={'queue':_0x10f62e[_0x2f41('0x59')],'agents':[]};})[_0x2f41('0x3d')](function(_0x192cc7){throw _0x192cc7;});}}}catch(_0x1603ef){logger['error']('[voiceQueueReport][queuesummary]',util['inspect'](_0x1603ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f41('0xb')]['syncQueueSummaryComplete']=function(_0x28e14a){if(this[_0x2f41('0x17')][_0x2f41('0x6a')]>0x0){this['summary'][_0x2f41('0x70')]=_0x28e14a;return;}logger[_0x2f41('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x2f41('0x41')](_0x28e14a,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x2f41('0x47')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x2f41('0xb')][_0x2f41('0x71')]=function(_0x124418){try{if(this[_0x2f41('0x6c')](_0x124418)){logger[_0x2f41('0x49')](_0x2f41('0x72'),_0x124418[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x124418,{'showHidden':![],'depth':null}));if(_[_0x2f41('0x5b')](this[_0x2f41('0x10')][_0x124418[_0x2f41('0x50')]])){this['queueReports'][_0x124418['uniqueid']]=[];}if(_[_0x2f41('0x5b')](this[_0x2f41('0x13')][_0x124418['uniqueid']])){this[_0x2f41('0x13')][_0x124418[_0x2f41('0x50')]]={};}var _0x5eaf54=new QueueReport();_0x5eaf54[_0x2f41('0x4c')]=_0x124418[_0x2f41('0x4c')];_0x5eaf54[_0x2f41('0x55')]=this[_0x2f41('0x15')][_0x5eaf54[_0x2f41('0x4c')]]&&this['voiceQueues'][_0x5eaf54['queue']][_0x2f41('0x55')]?this[_0x2f41('0x15')][_0x5eaf54[_0x2f41('0x4c')]][_0x2f41('0x55')]||_0x2f41('0x56'):_0x2f41('0x56');_0x5eaf54['queuecallerjoinAt']=moment()[_0x2f41('0x58')](_0x2f41('0x73'));_0x5eaf54[_0x2f41('0x74')]=_0x124418[_0x2f41('0x74')];_0x5eaf54[_0x2f41('0x75')]=_0x124418['count'];_0x5eaf54[_0x2f41('0x50')]=_0x124418[_0x2f41('0x50')];_0x5eaf54[_0x2f41('0x76')]=this[_0x2f41('0x13')][_0x124418[_0x2f41('0x50')]][_0x2f41('0x76')];logger[_0x2f41('0x77')](_0x2f41('0x78'),_0x5eaf54[_0x2f41('0x4c')],_0x5eaf54[_0x2f41('0x55')]);Object[_0x2f41('0x65')](_0x5eaf54,_[_0x2f41('0x79')](_0x124418,_[_0x2f41('0x7a')](_0x5eaf54)));this['queueReports'][_0x124418[_0x2f41('0x50')]][_0x2f41('0x6b')](_0x5eaf54);this[_0x2f41('0x13')][_0x124418[_0x2f41('0x50')]]=_0x5eaf54;this[_0x2f41('0x48')](_0x5eaf54,_0x2f41('0x21'));}}catch(_0x2f7fa7){logger[_0x2f41('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x124418['uniqueid'],util['inspect'](_0x2f7fa7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f41('0xb')]['syncQueueCallerAbandon']=function(_0x1f799d){try{if(this[_0x2f41('0x6c')](_0x1f799d)){logger[_0x2f41('0x49')](_0x2f41('0x7b'),_0x1f799d[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x1f799d,{'showHidden':![],'depth':null}));if(this[_0x2f41('0x10')][_0x1f799d[_0x2f41('0x50')]]){var _0x3a454a=_[_0x2f41('0x7c')](this[_0x2f41('0x10')][_0x1f799d[_0x2f41('0x50')]]);_0x3a454a['queuecallercomplete']=![];_0x3a454a[_0x2f41('0x7d')]=null;_0x3a454a['holdtime']=_0x1f799d[_0x2f41('0x7e')];_0x3a454a['originalposition']=_0x1f799d['originalposition'];_0x3a454a[_0x2f41('0x36')]=!![];_0x3a454a[_0x2f41('0x7f')]=moment()[_0x2f41('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a454a[_0x2f41('0x51')]='ABANDONED';_0x3a454a['lastAssignedTo']=null;logger['info'](_0x2f41('0x80'),_0x3a454a['queue'],_0x3a454a[_0x2f41('0x55')]);this[_0x2f41('0x13')][_0x1f799d[_0x2f41('0x50')]]=_0x3a454a;this[_0x2f41('0x45')](_0x3a454a,'queuecallerabandon');}}}catch(_0x1a2705){logger[_0x2f41('0x3f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1f799d[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x1a2705,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f41('0xb')]['syncQueueCallerLeave']=function(_0x4a7c08){try{if(this[_0x2f41('0x6c')](_0x4a7c08)){logger[_0x2f41('0x49')](_0x2f41('0x81'),_0x4a7c08[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x4a7c08,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4a7c08['uniqueid']]){var _0xbe1f1a=_[_0x2f41('0x7c')](this[_0x2f41('0x10')][_0x4a7c08[_0x2f41('0x50')]]);_0xbe1f1a[_0x2f41('0x82')]=moment()[_0x2f41('0x58')](_0x2f41('0x73'));_0xbe1f1a[_0x2f41('0x83')]=_0x4a7c08[_0x2f41('0x83')];_0xbe1f1a[_0x2f41('0x84')]=_0x4a7c08['connectedlinename'];logger[_0x2f41('0x77')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xbe1f1a[_0x2f41('0x4c')],_0xbe1f1a[_0x2f41('0x55')],_0x4a7c08['connectedlinenum'],_0x4a7c08[_0x2f41('0x84')]);this[_0x2f41('0x13')][_0x4a7c08[_0x2f41('0x50')]]=_0xbe1f1a;this[_0x2f41('0x48')](_0xbe1f1a,_0x2f41('0x23'));}}}catch(_0x1503dd){logger[_0x2f41('0x3f')](_0x2f41('0x81'),_0x4a7c08[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x1503dd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f41('0xb')]['syncAgentConnect']=function(_0x3d58e3){try{if(this[_0x2f41('0x6c')](_0x3d58e3)){logger['debug'](_0x2f41('0x85'),_0x3d58e3['uniqueid'],util[_0x2f41('0x41')](_0x3d58e3,{'showHidden':![],'depth':null}));if(this[_0x2f41('0x10')][_0x3d58e3[_0x2f41('0x50')]]){var _0x204312=_[_0x2f41('0x7c')](this['queueReports'][_0x3d58e3[_0x2f41('0x50')]]);_0x204312[_0x2f41('0x37')]=!![];_0x204312[_0x2f41('0x51')]=_0x2f41('0x86');logger[_0x2f41('0x77')](_0x2f41('0x87'),_0x204312[_0x2f41('0x4c')],_0x204312['type']);}}}catch(_0xd5a693){logger[_0x2f41('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0x3d58e3[_0x2f41('0x50')],util[_0x2f41('0x41')](_0xd5a693,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f41('0xb')][_0x2f41('0x88')]=function(_0x3d51df){try{if(this[_0x2f41('0x6c')](_0x3d51df)){logger[_0x2f41('0x49')]('[%s][voiceQueueReport][agentcomplete]',_0x3d51df[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x3d51df,{'showHidden':![],'depth':null}));if(this[_0x2f41('0x10')][_0x3d51df[_0x2f41('0x50')]]){var _0x753edb=_['last'](this[_0x2f41('0x10')][_0x3d51df[_0x2f41('0x50')]]);_0x753edb[_0x2f41('0x36')]=![];_0x753edb[_0x2f41('0x7f')]=null;_0x753edb[_0x2f41('0x89')]=!![];_0x753edb['lastAssignedTo']=_0x3d51df[_0x2f41('0x8a')];_0x753edb[_0x2f41('0x7e')]=_0x3d51df[_0x2f41('0x7e')];_0x753edb[_0x2f41('0x37')]=!![];_0x753edb['queuecallerexit']=![];_0x753edb[_0x2f41('0x8b')]=null;if(!_0x753edb[_0x2f41('0x8c')]){if(_0x3d51df[_0x2f41('0x8d')]==_0x2f41('0x8c')){_0x753edb[_0x2f41('0x51')]='COMPLETED';logger['info'](_0x2f41('0x8e'),_0x753edb['queue'],_0x753edb[_0x2f41('0x55')]);}else{if(_[_0x2f41('0x8f')](_0x3d51df[_0x2f41('0x3c')][_0x2f41('0x90')](),_0x2f41('0x91'))){if(this[_0x2f41('0x10')][_0x3d51df['linkedid']]){var _0x5ddb77=_[_0x2f41('0x7c')](this[_0x2f41('0x10')][_0x3d51df['linkedid']]);_0x5ddb77[_0x2f41('0x37')]=![];_0x5ddb77[_0x2f41('0x35')]=!![];_0x5ddb77[_0x2f41('0x8b')]=moment(_0x753edb[_0x2f41('0x92')])[_0x2f41('0x93')](_0x3d51df[_0x2f41('0x7e')],_0x2f41('0x94'))['format'](_0x2f41('0x73'));_0x5ddb77[_0x2f41('0x51')]=_0x2f41('0x95');_0x5ddb77['transfer']=!![];_0x5ddb77[_0x2f41('0x96')]='FORWARD';_0x5ddb77['transferexten']=_0x3d51df[_0x2f41('0x97')];_0x5ddb77[_0x2f41('0x98')]=_0x3d51df['uniqueid'];logger[_0x2f41('0x77')](_0x2f41('0x99'),_0x5ddb77['queue'],_0x5ddb77[_0x2f41('0x55')]);var _0x1f44fd=this[_0x2f41('0x10')][_0x3d51df[_0x2f41('0x9a')]];this['queueReports'][_0x3d51df[_0x2f41('0x9a')]]=this['queueReports'][_0x3d51df[_0x2f41('0x50')]];this[_0x2f41('0x10')][_0x3d51df[_0x2f41('0x50')]]=_0x1f44fd;}}else{_0x753edb[_0x2f41('0x51')]=_0x2f41('0x9b')+_0x3d51df[_0x2f41('0x8d')]['toUpperCase']();logger[_0x2f41('0x77')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x753edb[_0x2f41('0x4c')],_0x753edb['type'],_0x753edb['queuecallerexitreason']);}}}this[_0x2f41('0x13')][_0x3d51df[_0x2f41('0x50')]]=_0x753edb;}}}catch(_0x44cd05){logger[_0x2f41('0x3f')](_0x2f41('0x9c'),_0x3d51df[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x44cd05,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2f41('0x27')]=function(_0x1b9d70){try{if(this[_0x2f41('0x6c')](_0x1b9d70)){logger[_0x2f41('0x49')](_0x2f41('0x9d'),_0x1b9d70['uniqueid'],util[_0x2f41('0x41')](_0x1b9d70,{'showHidden':![],'depth':null}));this[_0x2f41('0x9e')](_0x1b9d70[_0x2f41('0x50')],_[_0x2f41('0x7a')](_0x1b9d70[_0x2f41('0x9f')])[0x0],_0x1b9d70[_0x2f41('0xa0')]);if(this[_0x2f41('0x10')][_0x1b9d70['uniqueid']]){var _0x4f169b=_['last'](this[_0x2f41('0x10')][_0x1b9d70[_0x2f41('0x50')]]);if(_0x4f169b){if(this[_0x2f41('0x6c')](_0x1b9d70[_0x2f41('0x9f')])&&this[_0x2f41('0x6c')](_0x1b9d70[_0x2f41('0x9f')][_0x2f41('0x66')])){switch(_0x1b9d70[_0x2f41('0xa0')]){case _0x2f41('0xa1'):_0x4f169b[_0x2f41('0x35')]=![];_0x4f169b[_0x2f41('0x8b')]=null;break;case _0x2f41('0xa2'):_0x4f169b[_0x2f41('0xa3')]=_0x2f41('0xa4');_0x4f169b['queuecallerexit']=!![];_0x4f169b[_0x2f41('0x8b')]=moment()[_0x2f41('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f169b[_0x2f41('0x82')]=moment()['format'](_0x2f41('0x73'));logger[_0x2f41('0x49')](_0x2f41('0xa5'),_0x1b9d70[_0x2f41('0x50')],util[_0x2f41('0x41')](_0x4f169b,{'showHidden':![],'depth':null}));ami[_0x2f41('0x47')](_0x2f41('0xa6'),_0x4f169b);break;default:_0x4f169b[_0x2f41('0x35')]=!![];_0x4f169b['queuecallerexitAt']=moment()['format'](_0x2f41('0x73'));_0x4f169b[_0x2f41('0x82')]=moment()[_0x2f41('0x58')](_0x2f41('0x73'));}_0x4f169b['queuecallerabandon']=![];_0x4f169b['queuecallerabandonAt']=null;_0x4f169b[_0x2f41('0x51')]=_0x1b9d70[_0x2f41('0xa0')];this[_0x2f41('0x13')][_0x1b9d70[_0x2f41('0x50')]]=_0x4f169b;this[_0x2f41('0x45')](_0x4f169b,_0x2f41('0xa7'));}else if(this[_0x2f41('0x6c')](_0x1b9d70[_0x2f41('0x9f')])&&this[_0x2f41('0x6c')](_0x1b9d70[_0x2f41('0x9f')][_0x2f41('0xa8')])){if(!_0x4f169b['queuecallerabandon']){_0x4f169b[_0x2f41('0x35')]=!![];_0x4f169b[_0x2f41('0x8b')]=moment()[_0x2f41('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f169b['queuecallerexitreason']=_0x2f41('0xa9');_0x4f169b[_0x2f41('0x82')]=moment()[_0x2f41('0x58')](_0x2f41('0x73'));this[_0x2f41('0x13')][_0x1b9d70[_0x2f41('0x50')]]=_0x4f169b;}}logger['info'](_0x2f41('0xaa'),_0x1b9d70['uniqueid'],_0x4f169b[_0x2f41('0x4c')],_0x4f169b[_0x2f41('0x55')],_['keys'](_0x1b9d70[_0x2f41('0x9f')])[0x0],_0x1b9d70['value']);_0x4f169b[_0x2f41('0x18')]=this['variables'][_0x1b9d70[_0x2f41('0x50')]];}}}}catch(_0x3ead43){logger[_0x2f41('0x3f')](_0x2f41('0x9d'),_0x1b9d70[_0x2f41('0x50')],util['inspect'](_0x3ead43,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f41('0xb')][_0x2f41('0x9e')]=function(_0x340a66,_0x185b2a,_0x5fb66f){var _0x8bf411=[_0x2f41('0xab'),'rtpaudioqosbridged',_0x2f41('0xac'),'rtpaudioqosjitterbridged',_0x2f41('0xad'),'rtpaudioqoslossbridged',_0x2f41('0xae'),_0x2f41('0xaf'),'sipcallid',_0x2f41('0xb0'),_0x2f41('0xb1'),_0x2f41('0xb2'),_0x2f41('0xb3'),_0x2f41('0xb4'),_0x2f41('0xb5'),_0x2f41('0xb6'),_0x2f41('0x8a'),_0x2f41('0xb7'),'memberrealtime'];if(!_[_0x2f41('0xb8')](_0x185b2a)&&!_[_0x2f41('0xb9')](_0x8bf411,_0x185b2a)){if(_[_0x2f41('0x5b')](this['variables'][_0x340a66])){this[_0x2f41('0x18')][_0x340a66]={};}this['variables'][_0x340a66][_0x185b2a]=_0x5fb66f;}};VoiceQueueReport['prototype'][_0x2f41('0xba')]=function(_0x551c8e,_0xd1588b,_0x5f437e){try{var _0x305c3a={};if(this[_0x2f41('0x10')][_0x551c8e]){for(var _0x5575b9=0x0;_0x5575b9=0x0?moment(_0x46da9c[_0xa40d('0x1a')])[_0xa40d('0xf')](_0x46da9c['starttime'],_0xa40d('0x19')):null,'data1':_0xa40d('0x1b'),'data2':_0x46da9c[_0xa40d('0x14')],'data3':_0x46da9c['exten'],'data4':_0x46da9c['dialstring']||null,'role':_0xa40d('0x13'),'internal':_0x46da9c[_0xa40d('0x14')]?_[_0xa40d('0x1c')](_0x46da9c[_0xa40d('0x14')]):undefined,'uniqueid':_0x46da9c['uniqueid']},'log':_0xa40d('0x7')});}; \ No newline at end of file +var _0x9c5f=['queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','agent','toNumber','voiceDialReport','membername','starttime','endtime','accountcode','dialstring','uniqueid','CreateMemberReport','moment','lodash','util','../client','voiceQueueReport'];(function(_0x423d6c,_0x151111){var _0x2c7600=function(_0x40cd86){while(--_0x40cd86){_0x423d6c['push'](_0x423d6c['shift']());}};_0x2c7600(++_0x151111);}(_0x9c5f,0xaf));var _0xf9c5=function(_0x1a5968,_0x112eee){_0x1a5968=_0x1a5968-0x0;var _0x496e4c=_0x9c5f[_0x1a5968];return _0x496e4c;};'use strict';var moment=require(_0xf9c5('0x0'));var _=require(_0xf9c5('0x1'));var util=require(_0xf9c5('0x2'));var client=require(_0xf9c5('0x3'));exports[_0xf9c5('0x4')]=function(_0x2dc2e4){var _0x4ec967=_0x2dc2e4[_0xf9c5('0x5')]||_0x2dc2e4[_0xf9c5('0x6')];return client[_0xf9c5('0x7')]('CreateMemberReport',{'body':{'channel':_0xf9c5('0x8'),'membername':_0x2dc2e4[_0xf9c5('0x9')],'interface':_[_0xf9c5('0xa')](_0x2dc2e4[_0xf9c5('0xb')])?util[_0xf9c5('0xc')](_0xf9c5('0xd'),_0x2dc2e4[_0xf9c5('0x9')]):_0x2dc2e4[_0xf9c5('0xb')],'type':_0xf9c5('0xe'),'enterAt':_0x2dc2e4[_0xf9c5('0xf')],'exitAt':_0x4ec967,'duration':moment(_0x4ec967)[_0xf9c5('0x10')](_0x2dc2e4[_0xf9c5('0xf')],_0xf9c5('0x11')),'data1':'inbound','data2':_0x2dc2e4[_0xf9c5('0x12')],'data3':_0x2dc2e4[_0xf9c5('0x13')],'data4':null,'data5':_0x2dc2e4['queue'],'role':_0xf9c5('0x14'),'internal':_0x2dc2e4['accountcode']?_[_0xf9c5('0x15')](_0x2dc2e4['accountcode']):undefined,'uniqueid':_0x2dc2e4['uniqueid']},'log':'CreateMemberReport'});};exports[_0xf9c5('0x16')]=function(_0x4d4766){return client[_0xf9c5('0x7')]('CreateMemberReport',{'body':{'channel':_0xf9c5('0x8'),'membername':_0x4d4766[_0xf9c5('0x17')],'interface':_0x4d4766[_0xf9c5('0xb')],'type':_0xf9c5('0xe'),'enterAt':_0x4d4766[_0xf9c5('0x18')],'exitAt':_0x4d4766['endtime'],'duration':moment(_0x4d4766[_0xf9c5('0x19')])['diff'](_0x4d4766['starttime'],_0xf9c5('0x11'))>=0x0?moment(_0x4d4766[_0xf9c5('0x19')])[_0xf9c5('0x10')](_0x4d4766[_0xf9c5('0x18')],_0xf9c5('0x11')):null,'data1':'outbound','data2':_0x4d4766[_0xf9c5('0x1a')],'data3':_0x4d4766['exten'],'data4':_0x4d4766[_0xf9c5('0x1b')]||null,'role':'agent','internal':_0x4d4766['accountcode']?_[_0xf9c5('0x15')](_0x4d4766[_0xf9c5('0x1a')]):undefined,'uniqueid':_0x4d4766[_0xf9c5('0x1c')]},'log':_0xf9c5('0x1d')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 0dfe287..45bd987 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 _0x1b8e=['Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x25e680,_0x43ceeb){var _0x55a858=function(_0x1818c1){while(--_0x1818c1){_0x25e680['push'](_0x25e680['shift']());}};_0x55a858(++_0x43ceeb);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x527804,_0x276ced){_0x527804=_0x527804-0x0;var _0x5ebba9=_0x1b8e[_0x527804];return _0x5ebba9;};'use strict';var client=require(_0xe1b8('0x0'));exports[_0xe1b8('0x1')]=function(){return client[_0xe1b8('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe1b8('0x3'),_0xe1b8('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xdc25=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x2bb790,_0x2393ce){var _0x5c2fe5=function(_0x31f98a){while(--_0x31f98a){_0x2bb790['push'](_0x2bb790['shift']());}};_0x5c2fe5(++_0x2393ce);}(_0xdc25,0x128));var _0x5dc2=function(_0x48a119,_0x417474){_0x48a119=_0x48a119-0x0;var _0x11da90=_0xdc25[_0x48a119];return _0x11da90;};'use strict';var client=require(_0x5dc2('0x0'));exports[_0x5dc2('0x1')]=function(){return client[_0x5dc2('0x2')](_0x5dc2('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x5dc2('0x4')]},'log':_0x5dc2('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index dd8d624..fbf3fd0 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 _0x3353=['getTemplates','Request','GetTemplate','name','html'];(function(_0x571fd6,_0x5223fc){var _0x4d6af6=function(_0xfc2c26){while(--_0xfc2c26){_0x571fd6['push'](_0x571fd6['shift']());}};_0x4d6af6(++_0x5223fc);}(_0x3353,0x1ef));var _0x3335=function(_0x5f588a,_0x2268d5){_0x5f588a=_0x5f588a-0x0;var _0x34980d=_0x3353[_0x5f588a];return _0x34980d;};'use strict';var client=require('../client');exports[_0x3335('0x0')]=function(_0x2c8f16){return function(_0x4e67de){return client[_0x3335('0x1')](_0x3335('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3335('0x3'),_0x3335('0x4')]},'log':_0x3335('0x2')});};}; \ No newline at end of file +var _0x29e6=['GetTemplate','getTemplates','Request','name'];(function(_0x51f120,_0x380944){var _0x49f8ee=function(_0x5dc87f){while(--_0x5dc87f){_0x51f120['push'](_0x51f120['shift']());}};_0x49f8ee(++_0x380944);}(_0x29e6,0x189));var _0x629e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x29e6[_0x397e5f];return _0x5302b8;};'use strict';var client=require('../client');exports[_0x629e('0x0')]=function(_0x2e657a){return function(_0x20e367){return client[_0x629e('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x629e('0x2'),'html']},'log':_0x629e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 3607081..8ece3a2 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 _0x51d1=['AllConditions','field','value','AnyConditions','operator','Action','action','data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition'];(function(_0x1a1553,_0x108edd){var _0x54bbde=function(_0x5d441b){while(--_0x5d441b){_0x1a1553['push'](_0x1a1553['shift']());}};_0x54bbde(++_0x108edd);}(_0x51d1,0x188));var _0x151d=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x51d1[_0x46a38b];return _0x346e75;};'use strict';var client=require(_0x151d('0x0'));exports[_0x151d('0x1')]=function(_0x4664c0){return function(_0xdbe592){return client[_0x151d('0x2')](_0x151d('0x3'),{'options':{'raw':![],'attributes':['id',_0x151d('0x4'),_0x151d('0x5'),_0x151d('0x6')],'include':[{'model':_0x151d('0x7'),'as':_0x151d('0x8'),'attributes':['id',_0x151d('0x9'),'operator',_0x151d('0xa')]},{'model':_0x151d('0x7'),'as':_0x151d('0xb'),'attributes':['id','field',_0x151d('0xc'),_0x151d('0xa')]},{'model':_0x151d('0xd'),'as':'Actions','attributes':['id',_0x151d('0xe'),'data1',_0x151d('0xf'),'data3',_0x151d('0x10'),_0x151d('0x11'),_0x151d('0x12'),_0x151d('0x13')]}]},'log':_0x151d('0x3')});};}; \ No newline at end of file +var _0xe3c0=['getTriggers','Request','GetTrigger','channel','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client'];(function(_0x38be9f,_0x57104f){var _0xb0505f=function(_0x57387a){while(--_0x57387a){_0x38be9f['push'](_0x38be9f['shift']());}};_0xb0505f(++_0x57104f);}(_0xe3c0,0x92));var _0x0e3c=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xe3c0[_0x21aec3];return _0x288bbc;};'use strict';var client=require(_0x0e3c('0x0'));exports[_0x0e3c('0x1')]=function(_0x3ee76e){return function(_0x18f1c9){return client[_0x0e3c('0x2')](_0x0e3c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0e3c('0x4'),_0x0e3c('0x5')],'include':[{'model':_0x0e3c('0x6'),'as':'AllConditions','attributes':['id',_0x0e3c('0x7'),_0x0e3c('0x8'),_0x0e3c('0x9')]},{'model':_0x0e3c('0x6'),'as':_0x0e3c('0xa'),'attributes':['id',_0x0e3c('0x7'),_0x0e3c('0x8'),'value']},{'model':_0x0e3c('0xb'),'as':_0x0e3c('0xc'),'attributes':['id',_0x0e3c('0xd'),_0x0e3c('0xe'),_0x0e3c('0xf'),_0x0e3c('0x10'),_0x0e3c('0x11'),_0x0e3c('0x12'),_0x0e3c('0x13'),_0x0e3c('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a46c981..9d95dff 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 _0x528f=['getTrunks','Request','GetTrunk','registry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xf528('0x0')]=function(_0x27b610){return function(_0x303dad){return client[_0xf528('0x1')](_0xf528('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xf528('0x3'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x4bba=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x48f60a,_0x35416f){var _0x2a4b7f=function(_0x4e4949){while(--_0x4e4949){_0x48f60a['push'](_0x48f60a['shift']());}};_0x2a4b7f(++_0x35416f);}(_0x4bba,0x131));var _0xa4bb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4bba[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xa4bb('0x0'));exports[_0xa4bb('0x1')]=function(_0x248091){return function(_0x3a75f3){return client[_0xa4bb('0x2')](_0xa4bb('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa4bb('0x4'),_0xa4bb('0x5'),'defaultuser']},'log':_0xa4bb('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 0af57fd..dc1259e 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0xf05eb,_0x57ad53){var _0x431e68=function(_0x250d9e){while(--_0x250d9e){_0xf05eb['push'](_0xf05eb['shift']());}};_0x431e68(++_0x57ad53);}(_0x70e0,0x17b));var _0x070e=function(_0x5ef2f3,_0x5cfc83){_0x5ef2f3=_0x5ef2f3-0x0;var _0x2490b8=_0x70e0[_0x5ef2f3];return _0x2490b8;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x53b648,_0x282634){var _0x36ae41=function(_0x55e11b){while(--_0x55e11b){_0x53b648['push'](_0x53b648['shift']());}};_0x36ae41(++_0x282634);}(_0xedd9,0xfc));var _0x9edd=function(_0x12e15e,_0x270d4f){_0x12e15e=_0x12e15e-0x0;var _0x1d81bf=_0xedd9[_0x12e15e];return _0x1d81bf;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 59d76ed..df2f142 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 _0x6669=['CreateVoiceAgentReport','UpdateVoiceAgentReport','Request'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x6669,0x173));var _0x9666=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x6669[_0x51c819];return _0x15c5d2;};'use strict';var client=require('../client');exports['create']=function(_0x27ec38){return client[_0x9666('0x0')](_0x9666('0x1'),{'body':_0x27ec38,'log':_0x9666('0x1')});};exports['update']=function(_0x4d8443,_0x4a0e54,_0x47f77b){return client[_0x9666('0x0')]('UpdateVoiceAgentReport',{'body':_0x4d8443,'options':{'where':{'uniqueid':_0x4a0e54,'interface':_0x47f77b,'agentcomplete':!![]}},'log':_0x9666('0x2')});}; \ No newline at end of file +var _0xb834=['../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x3c3f11,_0x45368d){var _0x390f9d=function(_0x26a1e2){while(--_0x26a1e2){_0x3c3f11['push'](_0x3c3f11['shift']());}};_0x390f9d(++_0x45368d);}(_0xb834,0xc8));var _0x4b83=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0xb834[_0x404eed];return _0xd45887;};'use strict';var client=require(_0x4b83('0x0'));exports[_0x4b83('0x1')]=function(_0x4b8f23){return client[_0x4b83('0x2')]('CreateVoiceAgentReport',{'body':_0x4b8f23,'log':_0x4b83('0x3')});};exports[_0x4b83('0x4')]=function(_0x5497b7,_0x561943,_0x2da3d7){return client[_0x4b83('0x2')]('UpdateVoiceAgentReport',{'body':_0x5497b7,'options':{'where':{'uniqueid':_0x561943,'interface':_0x2da3d7,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a497edb..07af176 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 _0xaf27=['outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','GetVoiceCallReports','util','../client','create','Request','CreateVoiceCallReport','context','callerid','getVoiceCallReports'];(function(_0xc34cd4,_0x463064){var _0x128eaa=function(_0x221318){while(--_0x221318){_0xc34cd4['push'](_0xc34cd4['shift']());}};_0x128eaa(++_0x463064);}(_0xaf27,0x115));var _0x7af2=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xaf27[_0x1ddedd];return _0xa3e1ac;};'use strict';var moment=require('moment');var util=require(_0x7af2('0x0'));var _=require('lodash');var client=require(_0x7af2('0x1'));exports[_0x7af2('0x2')]=function(_0x40862f){return client[_0x7af2('0x3')](_0x7af2('0x4'),{'body':_['merge'](_0x40862f,{'source':_0x40862f['calleridnum'],'destinationcontext':_0x40862f[_0x7af2('0x5')],'callerid':_0x40862f[_0x7af2('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x7af2('0x4')});};exports[_0x7af2('0x7')]=function(){return function(){return client[_0x7af2('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x7af2('0x8')],'createdAt':{'$between':[moment()['startOf'](_0x7af2('0x9'))[_0x7af2('0xa')](_0x7af2('0xb')),moment()[_0x7af2('0xc')](_0x7af2('0x9'))[_0x7af2('0xa')](_0x7af2('0xb'))]}},'attributes':[_0x7af2('0xd'),'disposition','duration','billableseconds']},'log':_0x7af2('0xe')});};}; \ No newline at end of file +var _0x73d1=['../client','create','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','util','lodash'];(function(_0x154bde,_0x154bef){var _0x926d94=function(_0x1d2b72){while(--_0x1d2b72){_0x154bde['push'](_0x154bde['shift']());}};_0x926d94(++_0x154bef);}(_0x73d1,0x14d));var _0x173d=function(_0xbe7a14,_0x54aa7b){_0xbe7a14=_0xbe7a14-0x0;var _0x4d79d7=_0x73d1[_0xbe7a14];return _0x4d79d7;};'use strict';var moment=require(_0x173d('0x0'));var util=require(_0x173d('0x1'));var _=require(_0x173d('0x2'));var client=require(_0x173d('0x3'));exports[_0x173d('0x4')]=function(_0x17d74d){return client[_0x173d('0x5')](_0x173d('0x6'),{'body':_['merge'](_0x17d74d,{'source':_0x17d74d['calleridnum'],'destinationcontext':_0x17d74d[_0x173d('0x7')],'callerid':_0x17d74d[_0x173d('0x8')],'amaflags':_0x173d('0x9')}),'log':_0x173d('0x6')});};exports[_0x173d('0xa')]=function(){return function(){return client[_0x173d('0x5')](_0x173d('0xb'),{'options':{'where':{'type':[_0x173d('0xc')],'createdAt':{'$between':[moment()[_0x173d('0xd')](_0x173d('0xe'))[_0x173d('0xf')](_0x173d('0x10')),moment()['endOf'](_0x173d('0xe'))[_0x173d('0xf')](_0x173d('0x10'))]}},'attributes':[_0x173d('0x11'),_0x173d('0x12'),_0x173d('0x13'),_0x173d('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 721cc69..72b171e 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 _0x1951=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1ed7ac,_0x26b0aa){var _0x549644=function(_0x8669eb){while(--_0x8669eb){_0x1ed7ac['push'](_0x1ed7ac['shift']());}};_0x549644(++_0x26b0aa);}(_0x1951,0x124));var _0x1195=function(_0x1e48e7,_0xf3114b){_0x1e48e7=_0x1e48e7-0x0;var _0x3712d4=_0x1951[_0x1e48e7];return _0x3712d4;};'use strict';var client=require(_0x1195('0x0'));exports[_0x1195('0x1')]=function(_0x1f9ded){return client[_0x1195('0x2')](_0x1195('0x3'),{'body':_0x1f9ded,'log':_0x1195('0x3')});}; \ No newline at end of file +var _0xdc8d=['Request','CreateVoiceDialReport','../client','create'];(function(_0x325c1d,_0xaac33){var _0x41620d=function(_0x44e13c){while(--_0x44e13c){_0x325c1d['push'](_0x325c1d['shift']());}};_0x41620d(++_0xaac33);}(_0xdc8d,0x14a));var _0xddc8=function(_0x47aee3,_0xb0abfb){_0x47aee3=_0x47aee3-0x0;var _0x43dd2a=_0xdc8d[_0x47aee3];return _0x43dd2a;};'use strict';var client=require(_0xddc8('0x0'));exports[_0xddc8('0x1')]=function(_0x14593b){return client[_0xddc8('0x2')](_0xddc8('0x3'),{'body':_0x14593b,'log':_0xddc8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ce5870c..309241a 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 _0x3e5c=['getVoiceExtensions','Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x9e3b6d,_0x26891c){_0x9e3b6d=_0x9e3b6d-0x0;var _0x46a361=_0x3e5c[_0x9e3b6d];return _0x46a361;};'use strict';var client=require(_0xc3e5('0x0'));exports[_0xc3e5('0x1')]=function(){return function(){return client[_0xc3e5('0x2')](_0xc3e5('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xc3e5('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc3e5('0x1')});};}; \ No newline at end of file +var _0x8aa7=['exten','recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x8c6b98,_0x17d9ff){var _0x44d6fb=function(_0x1b74ec){while(--_0x1b74ec){_0x8c6b98['push'](_0x8c6b98['shift']());}};_0x44d6fb(++_0x17d9ff);}(_0x8aa7,0xb6));var _0x78aa=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x8aa7[_0x34021d];return _0x16597b;};'use strict';var client=require('../client');exports[_0x78aa('0x0')]=function(){return function(){return client[_0x78aa('0x1')](_0x78aa('0x2'),{'options':{'raw':!![],'attributes':['id',_0x78aa('0x3'),_0x78aa('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x78aa('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 165b51c..738def4 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 _0x4c31=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x3ec562,_0x458633){var _0x396681=function(_0x51dce8){while(--_0x51dce8){_0x3ec562['push'](_0x3ec562['shift']());}};_0x396681(++_0x458633);}(_0x4c31,0x95));var _0x14c3=function(_0x5a4dab,_0x525fd2){_0x5a4dab=_0x5a4dab-0x0;var _0x1112ed=_0x4c31[_0x5a4dab];return _0x1112ed;};'use strict';var client=require(_0x14c3('0x0'));exports[_0x14c3('0x1')]=function(){return function(){return client[_0x14c3('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x14c3('0x3'),'acwTimeout','autopause',_0x14c3('0x4'),_0x14c3('0x5'),_0x14c3('0x6'),_0x14c3('0x7'),_0x14c3('0x8'),_0x14c3('0x9'),_0x14c3('0xa'),_0x14c3('0xb'),_0x14c3('0xc'),_0x14c3('0xd'),_0x14c3('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x14c3('0xf'),_0x14c3('0x10'),_0x14c3('0x11'),_0x14c3('0x12'),_0x14c3('0x13'),_0x14c3('0x14'),_0x14c3('0x15'),_0x14c3('0x16'),_0x14c3('0x17'),_0x14c3('0x18'),_0x14c3('0x19'),_0x14c3('0x1a'),_0x14c3('0x1b'),_0x14c3('0x1c'),_0x14c3('0x1d'),_0x14c3('0x1e'),_0x14c3('0x1f'),_0x14c3('0x20'),_0x14c3('0x21'),_0x14c3('0x22'),_0x14c3('0x23'),_0x14c3('0x24'),_0x14c3('0x25'),'dialAMDMaximumWordLength',_0x14c3('0x26'),_0x14c3('0x27'),_0x14c3('0x28'),_0x14c3('0x29'),'dialAgiAfterHangupAgent',_0x14c3('0x2a'),_0x14c3('0x2b'),'monitor_format','strategy','dialRandomLastDigitCallerIdNumber',_0x14c3('0x2c'),_0x14c3('0x2d'),'dialNoSuchNumberRetryFrequency',_0x14c3('0x2e'),'dialDropRetryFrequency',_0x14c3('0x2f'),_0x14c3('0x30'),_0x14c3('0x31'),_0x14c3('0x32'),_0x14c3('0x33'),'dialAgentRejectRetryFrequency',_0x14c3('0x34'),_0x14c3('0x35'),_0x14c3('0x36'),_0x14c3('0x37'),_0x14c3('0x38')],'include':[{'model':_0x14c3('0x39'),'as':'Trunk','attributes':['id',_0x14c3('0x3a'),_0x14c3('0x3b'),_0x14c3('0x3c')]},{'model':_0x14c3('0x3d'),'as':_0x14c3('0x3e'),'attributes':['id',_0x14c3('0x3a')]},{'model':_0x14c3('0x39'),'as':_0x14c3('0x3f'),'attributes':['id',_0x14c3('0x3a'),_0x14c3('0x3b'),_0x14c3('0x3c')]},{'model':_0x14c3('0x40'),'as':_0x14c3('0x40'),'attributes':['id','name'],'include':[{'model':_0x14c3('0x40'),'as':'Intervals','attributes':['id',_0x14c3('0x3a'),_0x14c3('0x41')]}]}]},'log':_0x14c3('0x1')});};}; \ No newline at end of file +var _0xec75=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0xb62d3,_0x5a007a){var _0x1c5d67=function(_0x5cc911){while(--_0x5cc911){_0xb62d3['push'](_0xb62d3['shift']());}};_0x1c5d67(++_0x5a007a);}(_0xec75,0x1e3));var _0x5ec7=function(_0x4e5a2d,_0x37c6e2){_0x4e5a2d=_0x4e5a2d-0x0;var _0x37e9bf=_0xec75[_0x4e5a2d];return _0x37e9bf;};'use strict';var client=require(_0x5ec7('0x0'));exports[_0x5ec7('0x1')]=function(){return function(){return client[_0x5ec7('0x2')](_0x5ec7('0x3'),{'options':{'raw':![],'attributes':['id',_0x5ec7('0x4'),'acw',_0x5ec7('0x5'),'autopause',_0x5ec7('0x6'),_0x5ec7('0x7'),_0x5ec7('0x8'),_0x5ec7('0x9'),_0x5ec7('0xa'),_0x5ec7('0xb'),_0x5ec7('0xc'),_0x5ec7('0xd'),_0x5ec7('0xe'),_0x5ec7('0xf'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x5ec7('0x10'),'dialQueueOptions',_0x5ec7('0x11'),_0x5ec7('0x12'),_0x5ec7('0x13'),_0x5ec7('0x14'),_0x5ec7('0x15'),_0x5ec7('0x16'),'dialNoAnswerMaxRetry',_0x5ec7('0x17'),_0x5ec7('0x18'),_0x5ec7('0x19'),_0x5ec7('0x1a'),_0x5ec7('0x1b'),_0x5ec7('0x1c'),_0x5ec7('0x1d'),_0x5ec7('0x1e'),_0x5ec7('0x1f'),_0x5ec7('0x20'),_0x5ec7('0x21'),'dialAMDMinWordLength',_0x5ec7('0x22'),'dialAMDMaximumNumberOfWords',_0x5ec7('0x23'),_0x5ec7('0x24'),_0x5ec7('0x25'),_0x5ec7('0x26'),'dialRecallInQueue',_0x5ec7('0x27'),'dialAgiAfterHangupAgent',_0x5ec7('0x28'),_0x5ec7('0x29'),_0x5ec7('0x6'),'strategy',_0x5ec7('0x2a'),_0x5ec7('0x2b'),'dialNoSuchNumberMaxRetry',_0x5ec7('0x2c'),_0x5ec7('0x2d'),'dialDropRetryFrequency',_0x5ec7('0x2e'),_0x5ec7('0x2f'),_0x5ec7('0x30'),_0x5ec7('0x31'),'dialAgentRejectMaxRetry',_0x5ec7('0x32'),_0x5ec7('0x33'),_0x5ec7('0x34'),'dialPredictiveIntervalMinThreshold',_0x5ec7('0x35'),_0x5ec7('0x36')],'include':[{'model':'Trunk','as':_0x5ec7('0x37'),'attributes':['id',_0x5ec7('0x4'),_0x5ec7('0x38'),'active']},{'model':_0x5ec7('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x5ec7('0x4')]},{'model':_0x5ec7('0x37'),'as':_0x5ec7('0x3a'),'attributes':['id','name',_0x5ec7('0x38'),_0x5ec7('0x3b')]},{'model':'Interval','as':_0x5ec7('0x3c'),'attributes':['id',_0x5ec7('0x4')],'include':[{'model':_0x5ec7('0x3c'),'as':_0x5ec7('0x3d'),'attributes':['id',_0x5ec7('0x4'),_0x5ec7('0x3e')]}]}]},'log':_0x5ec7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d852ee5..3dcdbc9 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(_0x2c5eac,_0x319ede){var _0x13773d=function(_0xb912e4){while(--_0xb912e4){_0x2c5eac['push'](_0x2c5eac['shift']());}};_0x13773d(++_0x319ede);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0xb37e39,_0x27b4e4){var _0x4bdaa0=function(_0x3b3785){while(--_0x3b3785){_0xb37e39['push'](_0xb37e39['shift']());}};_0x4bdaa0(++_0x27b4e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 c0b88f4..ca2c9e2 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 _0xb258=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xb258,0x1dc));var _0x8b25=function(_0x387248,_0x287910){_0x387248=_0x387248-0x0;var _0x14a192=_0xb258[_0x387248];return _0x14a192;};'use strict';var client=require(_0x8b25('0x0'));exports[_0x8b25('0x1')]=function(_0x5ced89){return function(){return client[_0x8b25('0x2')](_0x8b25('0x3'),{'options':{'where':{'VoiceQueueId':_0x5ced89,'paused':!![]},'raw':!![]},'log':_0x8b25('0x1')});};}; \ No newline at end of file +var _0x057f=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x057f,0x17c));var _0xf057=function(_0x248ae7,_0x453d5f){_0x248ae7=_0x248ae7-0x0;var _0x1378a3=_0x057f[_0x248ae7];return _0x1378a3;};'use strict';var client=require(_0xf057('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4ce06f){return function(){return client[_0xf057('0x1')](_0xf057('0x2'),{'options':{'where':{'VoiceQueueId':_0x4ce06f,'paused':!![]},'raw':!![]},'log':_0xf057('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e4f9591..95d2d77 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3eb39a,_0x1ccf0e){var _0x407ef0=function(_0x416bb8){while(--_0x416bb8){_0x3eb39a['push'](_0x3eb39a['shift']());}};_0x407ef0(++_0x1ccf0e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x512729,_0x5788a8){var _0x3b5cb5=function(_0x1c59b5){while(--_0x1c59b5){_0x512729['push'](_0x512729['shift']());}};_0x3b5cb5(++_0x5788a8);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1855431..452697a 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 _0x8e3f=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x18d4ad,_0x552602){var _0x44ecd1=function(_0xbcc507){while(--_0xbcc507){_0x18d4ad['push'](_0x18d4ad['shift']());}};_0x44ecd1(++_0x552602);}(_0x8e3f,0xc0));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xf8e3('0x0'));exports[_0xf8e3('0x1')]={};exports[_0xf8e3('0x2')]=function(_0x3f5508){return client[_0xf8e3('0x3')](_0xf8e3('0x4'),{'body':{'result':_0x3f5508[_0xf8e3('0x5')],'transfererchannel':_0x3f5508[_0xf8e3('0x6')],'transferercalleridnum':_0x3f5508[_0xf8e3('0x7')],'transferercalleridname':_0x3f5508[_0xf8e3('0x8')],'transfererconnectedlinenum':_0x3f5508['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3f5508[_0xf8e3('0x9')],'transfereraccountcode':_0x3f5508['transfereraccountcode'],'transferercontext':_0x3f5508[_0xf8e3('0xa')],'transfererexten':_0x3f5508[_0xf8e3('0xb')],'transfererlinkedid':_0x3f5508['transfererlinkedid'],'transfereechannel':_0x3f5508['transfereechannel'],'transfereecalleridnum':_0x3f5508['transfereecalleridnum'],'transfereecalleridname':_0x3f5508[_0xf8e3('0xc')],'transfereeconnectedlinenum':_0x3f5508[_0xf8e3('0xd')],'transfereeconnectedlinename':_0x3f5508['transfereeconnectedlinename'],'transfereeaccountcode':_0x3f5508[_0xf8e3('0xe')],'transfereecontext':_0x3f5508[_0xf8e3('0xf')],'transfereeexten':_0x3f5508[_0xf8e3('0x10')],'transfereelinkedid':_0x3f5508[_0xf8e3('0x11')],'isexternal':_0x3f5508[_0xf8e3('0x12')],'context':_0x3f5508[_0xf8e3('0x13')],'extension':_0x3f5508['extension'],'type':'blind'},'log':_0xf8e3('0x4')});};exports[_0xf8e3('0x14')]=function(_0x5dbc2f){return client[_0xf8e3('0x3')](_0xf8e3('0x4'),{'body':{'result':_0x5dbc2f[_0xf8e3('0x5')],'transfererchannel':_0x5dbc2f[_0xf8e3('0x15')],'transferercalleridnum':_0x5dbc2f['origtransferercalleridnum'],'transferercalleridname':_0x5dbc2f[_0xf8e3('0x16')],'transfererconnectedlinenum':_0x5dbc2f[_0xf8e3('0x17')],'transfererconnectedlinename':_0x5dbc2f[_0xf8e3('0x18')],'transfereraccountcode':_0x5dbc2f[_0xf8e3('0x19')],'transferercontext':_0x5dbc2f['secondtransferercontext'],'transfererexten':_0x5dbc2f[_0xf8e3('0x1a')],'transfererlinkedid':_0x5dbc2f['origtransfererlinkedid'],'transfereechannel':_0x5dbc2f['transfertargetchannel'],'transfereecalleridnum':_0x5dbc2f[_0xf8e3('0x1b')],'transfereecalleridname':_0x5dbc2f[_0xf8e3('0x1c')],'transfereeconnectedlinenum':_0x5dbc2f[_0xf8e3('0x1d')],'transfereeconnectedlinename':_0x5dbc2f[_0xf8e3('0x1e')],'transfereeaccountcode':_0x5dbc2f[_0xf8e3('0x1f')],'transfereecontext':_0x5dbc2f[_0xf8e3('0x20')],'transfereeexten':_0x5dbc2f[_0xf8e3('0x21')],'transfereelinkedid':_0x5dbc2f[_0xf8e3('0x22')],'isexternal':_0x5dbc2f[_0xf8e3('0x12')],'context':_0x5dbc2f[_0xf8e3('0x23')],'extension':_0x5dbc2f[_0xf8e3('0x24')],'type':'attended'},'log':_0xf8e3('0x4')});}; \ No newline at end of file +var _0xf96b=['transfereechannel','transfereecalleridname','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode'];(function(_0x2664aa,_0x1cc6e9){var _0x459641=function(_0x1e1187){while(--_0x1e1187){_0x2664aa['push'](_0x2664aa['shift']());}};_0x459641(++_0x1cc6e9);}(_0xf96b,0x1d7));var _0xbf96=function(_0x3516b9,_0x57a2f8){_0x3516b9=_0x3516b9-0x0;var _0xaaadc8=_0xf96b[_0x3516b9];return _0xaaadc8;};'use strict';var client=require('../client');exports[_0xbf96('0x0')]={};exports[_0xbf96('0x1')]=function(_0x16a42d){return client[_0xbf96('0x2')](_0xbf96('0x3'),{'body':{'result':_0x16a42d[_0xbf96('0x4')],'transfererchannel':_0x16a42d['transfererchannel'],'transferercalleridnum':_0x16a42d[_0xbf96('0x5')],'transferercalleridname':_0x16a42d[_0xbf96('0x6')],'transfererconnectedlinenum':_0x16a42d[_0xbf96('0x7')],'transfererconnectedlinename':_0x16a42d['transfererconnectedlinename'],'transfereraccountcode':_0x16a42d[_0xbf96('0x8')],'transferercontext':_0x16a42d['transferercontext'],'transfererexten':_0x16a42d['transfererexten'],'transfererlinkedid':_0x16a42d['transfererlinkedid'],'transfereechannel':_0x16a42d[_0xbf96('0x9')],'transfereecalleridnum':_0x16a42d['transfereecalleridnum'],'transfereecalleridname':_0x16a42d[_0xbf96('0xa')],'transfereeconnectedlinenum':_0x16a42d['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x16a42d[_0xbf96('0xb')],'transfereeaccountcode':_0x16a42d['transfereeaccountcode'],'transfereecontext':_0x16a42d['transfereecontext'],'transfereeexten':_0x16a42d[_0xbf96('0xc')],'transfereelinkedid':_0x16a42d[_0xbf96('0xd')],'isexternal':_0x16a42d[_0xbf96('0xe')],'context':_0x16a42d[_0xbf96('0xf')],'extension':_0x16a42d['extension'],'type':_0xbf96('0x10')},'log':'CreateVoiceTransferReport'});};exports[_0xbf96('0x11')]=function(_0x2f74ca){return client['Request'](_0xbf96('0x3'),{'body':{'result':_0x2f74ca[_0xbf96('0x4')],'transfererchannel':_0x2f74ca[_0xbf96('0x12')],'transferercalleridnum':_0x2f74ca[_0xbf96('0x13')],'transferercalleridname':_0x2f74ca['origtransferercalleridname'],'transfererconnectedlinenum':_0x2f74ca['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2f74ca['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2f74ca[_0xbf96('0x14')],'transferercontext':_0x2f74ca['secondtransferercontext'],'transfererexten':_0x2f74ca[_0xbf96('0x15')],'transfererlinkedid':_0x2f74ca[_0xbf96('0x16')],'transfereechannel':_0x2f74ca[_0xbf96('0x17')],'transfereecalleridnum':_0x2f74ca[_0xbf96('0x18')],'transfereecalleridname':_0x2f74ca[_0xbf96('0x19')],'transfereeconnectedlinenum':_0x2f74ca[_0xbf96('0x1a')],'transfereeconnectedlinename':_0x2f74ca[_0xbf96('0x1b')],'transfereeaccountcode':_0x2f74ca['transfertargetaccountcode'],'transfereecontext':_0x2f74ca[_0xbf96('0x1c')],'transfereeexten':_0x2f74ca['transfertargetexten'],'transfereelinkedid':_0x2f74ca['transfertargetlinkedid'],'isexternal':_0x2f74ca[_0xbf96('0xe')],'context':_0x2f74ca[_0xbf96('0x1d')],'extension':_0x2f74ca[_0xbf96('0x1e')],'type':_0xbf96('0x1f')},'log':_0xbf96('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0f709fa..8131ed6 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 _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(_0x10404c,_0x363868){var _0x8665be=function(_0x288e65){while(--_0x288e65){_0x10404c['push'](_0x10404c['shift']());}};_0x8665be(++_0x363868);}(_0x7a54,0x106));var _0x47a5=function(_0x11f009,_0x3abb86){_0x11f009=_0x11f009-0x0;var _0x4583c5=_0x7a54[_0x11f009];return _0x4583c5;};'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 +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(_0x1e44d1,_0x340184){var _0x2ce560=function(_0x15751e){while(--_0x15751e){_0x1e44d1['push'](_0x1e44d1['shift']());}};_0x2ce560(++_0x340184);}(_0xb10b,0x12a));var _0xbb10=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0xb10b[_0x35fb56];return _0x2fd52c;};'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 diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 181e9d8..9c3f277 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 _0x011a=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','../../../../config/environment','trigger','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join'];(function(_0x5be7d2,_0xebc786){var _0x49a38d=function(_0x19aa83){while(--_0x19aa83){_0x5be7d2['push'](_0x5be7d2['shift']());}};_0x49a38d(++_0xebc786);}(_0x011a,0x16d));var _0xa011=function(_0x1accf6,_0x4a9854){_0x1accf6=_0x1accf6-0x0;var _0x24e446=_0x011a[_0x1accf6];return _0x24e446;};'use strict';var _=require(_0xa011('0x0'));var BPromise=require(_0xa011('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xa011('0x2'));var logger=require('../../../../config/logger')(_0xa011('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xa011('0x4')]=_['defaults'](config[_0xa011('0x4')],{'host':_0xa011('0x5'),'port':0x18eb});var io=require(_0xa011('0x6'))(new Redis(config['redis']));function emit(_0x53a950,_0x14bbed,_0x413a52,_0x327bb3,_0x834c76){logger[_0xa011('0x7')](_0xa011('0x8'),_0x53a950,_0x14bbed['id'],_0x413a52,_0x327bb3,JSON[_0xa011('0x9')](_0x834c76));io['to'](_0x413a52)[_0xa011('0xa')](_0x327bb3,_0x834c76);}exports[_0xa011('0xb')]=function(_0x510167,_0x1309f6,_0x5c1021,_0x394334){var _0x3c23d7,_0xbdaff3;var _0x32aed6={};var _0x4b84f3;var _0x2478af=Number(_0x5c1021[_0xa011('0xc')]);var _0x5e83b8=_0x5c1021[_0xa011('0xd')]?Boolean(Number(_0x5c1021['data2'])):![];var _0x4405ef;var _0x14e076=![];if(!_[_0xa011('0xe')](_0x5c1021[_0xa011('0xf')])){if(_0x5c1021[_0xa011('0xf')]=='1')_0x14e076=!![];}if(!_0x14e076){if(_0x394334['xmd-contactid']){_0x32aed6['id']=_0x394334[_0xa011('0x10')];}}if(!_0x32aed6['id']){_0x32aed6[_0xa011('0x11')]=_0x2478af;_0x4405ef=_0x5c1021[_0xa011('0x12')]&&_0x5c1021['data3']!=='0'?_0x5c1021[_0xa011('0x12')][_0xa011('0x13')](','):[_0xa011('0x14')];_0x32aed6[_0xa011('0x15')]=_[_0xa011('0x16')](_0x4405ef,function(_0x48cdf7){var _0x3132c0={};_0x3132c0[_0x48cdf7]=_0x394334[_0xa011('0x17')]?_0x394334[_0xa011('0x18')]:_0x394334[_0xa011('0x19')];return _0x3132c0;});_0x4b84f3=_0x394334['routeId']?_0x394334[_0xa011('0x18')]:_0x394334[_0xa011('0x19')];}var _0x3b9beb=['id',_0xa011('0x1a'),_0xa011('0x1b'),_0xa011('0x14'),_0xa011('0x1c'),'fax','ListId',_0xa011('0x1d'),_0xa011('0x1e'),'updatedAt'];var _0x360062=_[_0xa011('0x1f')](_0x3b9beb,_0x4405ef);BPromise[_0xa011('0x20')]()[_0xa011('0x21')](cmContactRpc[_0xa011('0x22')]({'attributes':_0x360062,'where':_0x32aed6,'phone':_0x4b84f3}))[_0xa011('0x21')](function(_0x1002e2){_0xbdaff3=_0x1002e2;if(!_[_0xa011('0x23')](_0xbdaff3)){if(_0xbdaff3[_0xa011('0x24')]===0x1){_0x3c23d7=_0xbdaff3[0x0];logger[_0xa011('0x7')](_0xa011('0x25'),_0x394334[_0xa011('0x26')],_0x1309f6['id'],_0x3c23d7['id']);}else{logger[_0xa011('0x7')](_0xa011('0x27'),_0x394334[_0xa011('0x26')],_0x1309f6['id'],_[_0xa011('0x16')](_0xbdaff3,'id')[_0xa011('0x28')](','));}return;}else{logger[_0xa011('0x7')](_0xa011('0x29'),_0x394334[_0xa011('0x26')],_0x1309f6['id']);var _0x5d5e27={'ListId':_0x2478af};var _0x47d849=_0x5c1021[_0xa011('0x2a')]&&_0x5c1021[_0xa011('0x2a')]!=='0'?_0x5c1021[_0xa011('0x2a')]:'phone';if(_0x5e83b8){logger[_0xa011('0x7')](_0xa011('0x2b'),_0x394334[_0xa011('0x26')],_0x1309f6['id']);_0x5d5e27[_0x47d849]=_['isNil'](_0x394334[_0xa011('0x17')])?_0x394334[_0xa011('0x19')]:_0x394334[_0xa011('0x18')];if(_[_0xa011('0xe')](_0x394334[_0xa011('0x17')])){_0x5d5e27['firstName']=_0x394334[_0xa011('0x2c')]&&_0x394334['calleridname']!==_0xa011('0x2d')?_0x394334['calleridname']:'Unknown';}else{_0x5d5e27[_0xa011('0x1a')]=_0x394334[_0xa011('0x2e')]&&_0x394334['destcalleridname']!==''?_0x394334[_0xa011('0x2e')]:_0xa011('0x2f');}return BPromise[_0xa011('0x20')]()[_0xa011('0x21')](cmContactRpc[_0xa011('0x30')](_0x5d5e27))['then'](function(_0x490daf){_0x3c23d7=_0x490daf;_0xbdaff3[_0xa011('0x31')](_0x490daf);if(_0x3c23d7){logger[_0xa011('0x7')](_0xa011('0x32'),_0x394334[_0xa011('0x26')],_0x1309f6['id'],_0x3c23d7['id']);}return;});}else{logger[_0xa011('0x7')](_0xa011('0x33'),_0x394334[_0xa011('0x26')],_0x1309f6['id']);_0x5d5e27[_0x47d849]=_['isNil'](_0x394334[_0xa011('0x17')])?_0x394334['calleridnum']:_0x394334[_0xa011('0x18')];if(_[_0xa011('0xe')](_0x394334[_0xa011('0x17')])){_0x5d5e27[_0xa011('0x1a')]=_0x394334['calleridname']&&_0x394334[_0xa011('0x2c')]!==_0xa011('0x2d')?_0x394334['calleridname']:_0xa011('0x2f');}else{_0x5d5e27[_0xa011('0x1a')]=_0x394334['destcalleridname']&&_0x394334[_0xa011('0x2e')]!==_0xa011('0x2d')?_0x394334[_0xa011('0x2e')]:'Unknown';}_0x3c23d7=_0x5d5e27;_0xbdaff3[_0xa011('0x31')](_0x5d5e27);return;}}})[_0xa011('0x21')](function(){if(_0x510167){emit(_0x394334['uniqueid'],_0x1309f6,util[_0xa011('0x34')](_0xa011('0x35'),_0x510167[_0xa011('0x36')]),util[_0xa011('0x34')](_0xa011('0x37'),_0x5c1021[_0xa011('0x38')][_0xa011('0x39')]()),{'evt':_['merge'](_0x394334,{'autoCreate':_0x5e83b8}),'contact':_0x3c23d7===undefined?{}:_0x3c23d7,'contacts':_0xbdaff3[_0xa011('0x24')]===0x0?undefined:_0xbdaff3});}});}; \ No newline at end of file +var _0x09ef=['data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','ListId','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1'];(function(_0x518749,_0x208de0){var _0x1032b3=function(_0x447b57){while(--_0x447b57){_0x518749['push'](_0x518749['shift']());}};_0x1032b3(++_0x208de0);}(_0x09ef,0x15e));var _0xf09e=function(_0x5cb141,_0x4ec145){_0x5cb141=_0x5cb141-0x0;var _0x1262e0=_0x09ef[_0x5cb141];return _0x1262e0;};'use strict';var _=require(_0xf09e('0x0'));var BPromise=require(_0xf09e('0x1'));var Redis=require(_0xf09e('0x2'));var util=require(_0xf09e('0x3'));var config=require(_0xf09e('0x4'));var logger=require(_0xf09e('0x5'))('trigger');var cmContactRpc=require(_0xf09e('0x6'));config['redis']=_[_0xf09e('0x7')](config[_0xf09e('0x8')],{'host':_0xf09e('0x9'),'port':0x18eb});var io=require(_0xf09e('0xa'))(new Redis(config[_0xf09e('0x8')]));function emit(_0x294258,_0x1d205f,_0x877574,_0x2e5a79,_0x2f28e1){logger['info'](_0xf09e('0xb'),_0x294258,_0x1d205f['id'],_0x877574,_0x2e5a79,JSON[_0xf09e('0xc')](_0x2f28e1));io['to'](_0x877574)[_0xf09e('0xd')](_0x2e5a79,_0x2f28e1);}exports[_0xf09e('0xe')]=function(_0x45da60,_0x5390e3,_0x4f0cbc,_0x1d0a27){var _0xc31fe1,_0x5cf330;var _0x144efb={};var _0x5580f5;var _0x3cc0e3=Number(_0x4f0cbc[_0xf09e('0xf')]);var _0x2d974f=_0x4f0cbc[_0xf09e('0x10')]?Boolean(Number(_0x4f0cbc[_0xf09e('0x10')])):![];var _0x1b0c0d;var _0x58760f=![];if(!_[_0xf09e('0x11')](_0x4f0cbc['data5'])){if(_0x4f0cbc[_0xf09e('0x12')]=='1')_0x58760f=!![];}if(!_0x58760f){if(_0x1d0a27[_0xf09e('0x13')]){_0x144efb['id']=_0x1d0a27[_0xf09e('0x13')];}}if(!_0x144efb['id']){_0x144efb['ListId']=_0x3cc0e3;_0x1b0c0d=_0x4f0cbc[_0xf09e('0x14')]&&_0x4f0cbc[_0xf09e('0x14')]!=='0'?_0x4f0cbc[_0xf09e('0x14')][_0xf09e('0x15')](','):[_0xf09e('0x16')];_0x144efb[_0xf09e('0x17')]=_[_0xf09e('0x18')](_0x1b0c0d,function(_0x3abeae){var _0x4ceb0a={};_0x4ceb0a[_0x3abeae]=_0x1d0a27[_0xf09e('0x19')]?_0x1d0a27[_0xf09e('0x1a')]:_0x1d0a27[_0xf09e('0x1b')];return _0x4ceb0a;});_0x5580f5=_0x1d0a27[_0xf09e('0x19')]?_0x1d0a27[_0xf09e('0x1a')]:_0x1d0a27[_0xf09e('0x1b')];}var _0x105934=['id',_0xf09e('0x1c'),_0xf09e('0x1d'),_0xf09e('0x16'),_0xf09e('0x1e'),'fax',_0xf09e('0x1f'),_0xf09e('0x20'),_0xf09e('0x21'),_0xf09e('0x22')];var _0x4b334c=_[_0xf09e('0x23')](_0x105934,_0x1b0c0d);BPromise['resolve']()[_0xf09e('0x24')](cmContactRpc[_0xf09e('0x25')]({'attributes':_0x4b334c,'where':_0x144efb,'phone':_0x5580f5}))[_0xf09e('0x24')](function(_0x1dea86){_0x5cf330=_0x1dea86;if(!_[_0xf09e('0x26')](_0x5cf330)){if(_0x5cf330[_0xf09e('0x27')]===0x1){_0xc31fe1=_0x5cf330[0x0];logger['info'](_0xf09e('0x28'),_0x1d0a27[_0xf09e('0x29')],_0x5390e3['id'],_0xc31fe1['id']);}else{logger[_0xf09e('0x2a')](_0xf09e('0x2b'),_0x1d0a27[_0xf09e('0x29')],_0x5390e3['id'],_['map'](_0x5cf330,'id')[_0xf09e('0x2c')](','));}return;}else{logger[_0xf09e('0x2a')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1d0a27[_0xf09e('0x29')],_0x5390e3['id']);var _0x454a3b={'ListId':_0x3cc0e3};var _0x57b8b3=_0x4f0cbc[_0xf09e('0x2d')]&&_0x4f0cbc[_0xf09e('0x2d')]!=='0'?_0x4f0cbc[_0xf09e('0x2d')]:'phone';if(_0x2d974f){logger[_0xf09e('0x2a')](_0xf09e('0x2e'),_0x1d0a27[_0xf09e('0x29')],_0x5390e3['id']);_0x454a3b[_0x57b8b3]=_[_0xf09e('0x11')](_0x1d0a27[_0xf09e('0x19')])?_0x1d0a27['calleridnum']:_0x1d0a27[_0xf09e('0x1a')];if(_[_0xf09e('0x11')](_0x1d0a27['routeId'])){_0x454a3b['firstName']=_0x1d0a27['calleridname']&&_0x1d0a27[_0xf09e('0x2f')]!==_0xf09e('0x30')?_0x1d0a27[_0xf09e('0x2f')]:_0xf09e('0x31');}else{_0x454a3b[_0xf09e('0x1c')]=_0x1d0a27['destcalleridname']&&_0x1d0a27[_0xf09e('0x32')]!==_0xf09e('0x30')?_0x1d0a27[_0xf09e('0x32')]:_0xf09e('0x31');}return BPromise[_0xf09e('0x33')]()[_0xf09e('0x24')](cmContactRpc[_0xf09e('0x34')](_0x454a3b))[_0xf09e('0x24')](function(_0x2cba4b){_0xc31fe1=_0x2cba4b;_0x5cf330[_0xf09e('0x35')](_0x2cba4b);if(_0xc31fe1){logger[_0xf09e('0x2a')](_0xf09e('0x36'),_0x1d0a27['uniqueid'],_0x5390e3['id'],_0xc31fe1['id']);}return;});}else{logger[_0xf09e('0x2a')](_0xf09e('0x37'),_0x1d0a27[_0xf09e('0x29')],_0x5390e3['id']);_0x454a3b[_0x57b8b3]=_[_0xf09e('0x11')](_0x1d0a27[_0xf09e('0x19')])?_0x1d0a27[_0xf09e('0x1b')]:_0x1d0a27['destcalleridnum'];if(_[_0xf09e('0x11')](_0x1d0a27['routeId'])){_0x454a3b['firstName']=_0x1d0a27[_0xf09e('0x2f')]&&_0x1d0a27['calleridname']!==_0xf09e('0x30')?_0x1d0a27[_0xf09e('0x2f')]:_0xf09e('0x31');}else{_0x454a3b[_0xf09e('0x1c')]=_0x1d0a27[_0xf09e('0x32')]&&_0x1d0a27['destcalleridname']!==_0xf09e('0x30')?_0x1d0a27['destcalleridname']:'Unknown';}_0xc31fe1=_0x454a3b;_0x5cf330['push'](_0x454a3b);return;}}})[_0xf09e('0x24')](function(){if(_0x45da60){emit(_0x1d0a27[_0xf09e('0x29')],_0x5390e3,util['format'](_0xf09e('0x38'),_0x45da60[_0xf09e('0x39')]),util[_0xf09e('0x3a')]('trigger:%s',_0x4f0cbc['action'][_0xf09e('0x3b')]()),{'evt':_[_0xf09e('0x3c')](_0x1d0a27,{'autoCreate':_0x2d974f}),'contact':_0xc31fe1===undefined?{}:_0xc31fe1,'contacts':_0x5cf330['length']===0x0?undefined:_0x5cf330});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 816934b..9911d02 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 _0xe16d=['queue','routeId','urlforward','script','buildUri','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','field','account','ChatWebsiteId','operator','upperFirst','AccountId','message','event','value','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','exports','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','popup','url','winapp','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','undefined','motionChannel','inspect','checkTriggers','agents','interface','hasOwnProperty','status','checkTrigger','merge','length','Actions','action','contactmanager','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winArguments','format','trigger:%s:%s','toLowerCase','jscripty','name','trigger:%s','user:%s','exec'];(function(_0x6cd1,_0x886adc){var _0x2a9138=function(_0x215bb7){while(--_0x215bb7){_0x6cd1['push'](_0x6cd1['shift']());}};_0x2a9138(++_0x886adc);}(_0xe16d,0x11d));var _0xde16=function(_0x5e1afd,_0x1719d8){_0x5e1afd=_0x5e1afd-0x0;var _0x54b097=_0xe16d[_0x5e1afd];return _0x54b097;};'use strict';var util=require(_0xde16('0x0'));var _=require(_0xde16('0x1'));var url=require('url');var Mustache=require(_0xde16('0x2'));var Redis=require(_0xde16('0x3'));var urlforward=require(_0xde16('0x4'));var integration=require(_0xde16('0x5'));var cmContact=require(_0xde16('0x6'));var script=require(_0xde16('0x7'));var config=require(_0xde16('0x8'));var logger=require(_0xde16('0x9'))('trigger');var ami=require(_0xde16('0xa'));config[_0xde16('0xb')]=_[_0xde16('0xc')](config[_0xde16('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xde16('0xb')]));var operators={'equals':function(_0x28913b,_0x12271f){return _0x28913b==_0x12271f;},'not_equals':function(_0x2f3f25,_0x3227f5){return _0x2f3f25!=_0x3227f5;}};var barAndWebActions=[_0xde16('0xd'),_0xde16('0xe'),_0xde16('0xf')];function Trigger(_0x3d2cbd){this['triggers']=_0x3d2cbd[_0xde16('0x10')];this['agents']=_0x3d2cbd['agents'];this[_0xde16('0x11')]=_0x3d2cbd[_0xde16('0x11')];this['templates']=_0x3d2cbd[_0xde16('0x12')];this[_0xde16('0x13')]=_0x3d2cbd[_0xde16('0x13')];this[_0xde16('0x14')]=_0x3d2cbd['zendeskAccounts'];this[_0xde16('0x15')]=_0x3d2cbd[_0xde16('0x15')];this[_0xde16('0x16')]=_0x3d2cbd[_0xde16('0x16')];this['sugarcrmAccounts']=_0x3d2cbd[_0xde16('0x17')];this[_0xde16('0x18')]=_0x3d2cbd[_0xde16('0x18')];this[_0xde16('0x19')]=_0x3d2cbd[_0xde16('0x19')];this['vtigerAccounts']=_0x3d2cbd[_0xde16('0x1a')];this[_0xde16('0x1b')]=_0x3d2cbd[_0xde16('0x1b')];this[_0xde16('0x1c')]=_0x3d2cbd[_0xde16('0x1c')];this['freshsalesAccounts']=_0x3d2cbd[_0xde16('0x1d')];this['accounts']={'zendesk':this[_0xde16('0x14')],'salesforce':this[_0xde16('0x16')],'freshdesk':this[_0xde16('0x15')],'sugarcrm':this[_0xde16('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xde16('0x19')],'vtiger':this[_0xde16('0x1a')],'dynamics365':this[_0xde16('0x1c')],'freshsales':this[_0xde16('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0xde16('0x1e'),this['syncCustomEvent'][_0xde16('0x1f')](this));ami['on'](_0xde16('0x20'),this[_0xde16('0x21')]['bind'](this));ami['on'](_0xde16('0x22'),this['syncCustomEvent'][_0xde16('0x1f')](this));ami['on'](_0xde16('0x23'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on']('custom:agentnosuchnumber',this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x24'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x25'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x26'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x27'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on']('custom:amd',this['syncCustomEvent'][_0xde16('0x1f')](this));ami['on']('custom:queuecallerabandon',this[_0xde16('0x21')]['bind'](this));ami['on'](_0xde16('0x28'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x29'),this[_0xde16('0x2a')]['bind'](this));ami['on'](_0xde16('0x2b'),this[_0xde16('0x2a')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x2c'),this[_0xde16('0x2a')]['bind'](this));ami['on']('custom:newinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0xde16('0x2d'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on']('custom:substatus',this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x2e'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on']('custom:outgoingmessage',this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on'](_0xde16('0x2f'),this['syncCustomEvent'][_0xde16('0x1f')](this));ami['on'](_0xde16('0x30'),this[_0xde16('0x21')][_0xde16('0x1f')](this));ami['on']('custom:offlineMessage',this['syncCustomEvent']['bind'](this));}Trigger[_0xde16('0x31')][_0xde16('0x32')]=function(_0x58e96d,_0x586f60,_0x160296){logger[_0xde16('0x33')](_0x58e96d,_0x586f60,JSON[_0xde16('0x34')](_0x160296));io['to'](_0x58e96d)[_0xde16('0x32')](_0x586f60,_0x160296);};Trigger[_0xde16('0x31')][_0xde16('0x21')]=function(_0x34cc8e){var _0x551d05=_['clone'](_0x34cc8e);if(typeof _0x551d05['motionChannel']===_0xde16('0x35')){_0x551d05[_0xde16('0x36')]='voice';}logger['debug']('syncCustomEvent',util[_0xde16('0x37')](_0x551d05,{'showHidden':!![],'depth':null}));this[_0xde16('0x38')](_0x551d05);};Trigger[_0xde16('0x31')][_0xde16('0x2a')]=function(_0x6d09ef){if(this[_0xde16('0x39')][_0x6d09ef[_0xde16('0x3a')]]){this['syncCustomEvent'](_0x6d09ef);}};Trigger[_0xde16('0x31')]['checkTriggers']=function(_0xf57aae){var _0x19cd76;for(var _0x102c8e in this[_0xde16('0x10')]){if(this[_0xde16('0x10')][_0xde16('0x3b')](_0x102c8e)){if(this[_0xde16('0x10')][_0x102c8e][_0xde16('0x3c')]){_0x19cd76=this[_0xde16('0x3d')](this['triggers'][_0x102c8e],_0xf57aae);if(_0x19cd76){_[_0xde16('0x3e')](_0xf57aae,_0xf57aae['variables']);for(var _0x55043a=0x0,_0x1e29dd,_0x496f24,_0x4a2a2f;_0x55043a0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x4d90e8,_0x32ad99){_0x4d90e8=_0x4d90e8-0x0;var _0x119b74=_0xe14b[_0x4d90e8];return _0x119b74;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index c6dcd80..13772ef 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 _0x67b5=['util','md5','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','data2','resolve','CloudProvider','data5','POST','clientId','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','outbound','destcalleridnum','calleridnum','contacts','headers','substring','lastIndexOf','enduserId','toLowerCase','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','customField','idField','indexOf','content','assign','getString','Subjects','/contacts(','/systemusers(','Fields','ticketType','queue','callDirection','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x67b5,0x197));var _0x567b=function(_0x53b071,_0x1e4fcf){_0x53b071=_0x53b071-0x0;var _0xf1c6c1=_0x67b5[_0x53b071];return _0xf1c6c1;};'use strict';var _=require(_0x567b('0x0'));var rp=require('request-promise');var util=require(_0x567b('0x1'));var intUtil=require('./util');var md5=require(_0x567b('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x567b('0x3'));var config=require(_0x567b('0x4'));config[_0x567b('0x5')]=_[_0x567b('0x6')](config[_0x567b('0x5')],{'host':_0x567b('0x7'),'port':0x18eb});var io=require(_0x567b('0x8'))(new Redis(config[_0x567b('0x5')]));function getAuthToken(_0x447cb5,_0x85b574,_0x2683aa){if(_0x447cb5[_0x567b('0x9')]){_0x447cb5[_0x567b('0xa')]=_0x447cb5['CloudProvider'][_0x567b('0xb')];_0x447cb5[_0x567b('0xc')]=_0x447cb5['CloudProvider'][_0x567b('0xd')];return Promise[_0x567b('0xe')](_0x447cb5[_0x567b('0xf')][_0x567b('0x10')]);}var _0x1b9509={'method':_0x567b('0x11'),'uri':_0x85b574,'form':{'client_id':_0x447cb5[_0x567b('0x12')],'resource':_0x447cb5['remoteUri'],'username':_0x447cb5[_0x567b('0x13')],'password':_0x447cb5[_0x567b('0x14')],'grant_type':_0x567b('0x14'),'client_secret':_0x447cb5[_0x567b('0x15')]},'json':!![]};return rp(_0x1b9509)['then'](function(_0x498176){return _0x498176['access_token'];})[_0x567b('0x16')](function(_0x5c24c2){logger[_0x567b('0x17')]('['+[_0x2683aa[_0x567b('0x18')]()]+_0x567b('0x19'));return _0x5c24c2[_0x567b('0x1a')];});}function getUser(_0x48e2fc,_0x5edaa1,_0x57fa28,_0x304e74,_0x1bd59a,_0x5b3f69){return new Promise(function(_0xd0938e,_0x1a78ad){return getAuthToken(_0x5edaa1,_0x304e74,_0x5b3f69)['then'](function(_0x417a2c){var _0x194df5={'method':_0x567b('0x1b'),'uri':_0x1bd59a+_0x567b('0x1c'),'headers':{'Authorization':_0x567b('0x1d')+_0x417a2c,'OData-Version':_0x567b('0x1e')},'json':!![]};return rp(_0x194df5);})[_0x567b('0x1f')](function(_0x255d3f){var _0x5e7c3b=_0x255d3f[_0x567b('0x20')];var _0x158682=![];var _0x34e231=null;if(!_[_0x567b('0x21')](_0x57fa28)){if(intUtil['validateEmail'](_0x57fa28[_0x567b('0x22')])){_0x48e2fc['userEmail']=_0x57fa28['email'];for(_0x34e231=0x0;_0x34e231<_0x5e7c3b[_0x567b('0x23')];_0x34e231++){if(_0x5e7c3b[_0x34e231][_0x567b('0x24')]===_0x57fa28[_0x567b('0x22')]&&!_0x5e7c3b[_0x34e231][_0x567b('0x25')]){_0x158682=!![];logger[_0x567b('0x26')]('['+[_0x5b3f69['toUpperCase']()]+_0x567b('0x27')+_0x5e7c3b[_0x34e231][_0x567b('0x28')]+'!');_0x48e2fc[_0x567b('0x29')]=_0x5e7c3b[_0x34e231][_0x567b('0x28')];}}}}if(!_0x158682){logger[_0x567b('0x26')]('['+[_0x5b3f69['toUpperCase']()]+_0x567b('0x2a'));_0x48e2fc[_0x567b('0x2b')]=_0x5edaa1['username'];for(_0x34e231=0x0;_0x34e231<_0x5e7c3b[_0x567b('0x23')];_0x34e231++){if(_0x5e7c3b[_0x34e231][_0x567b('0x24')]===_0x5edaa1[_0x567b('0x13')]){_0x48e2fc[_0x567b('0x29')]=_0x5e7c3b[_0x34e231][_0x567b('0x28')];}}}_0xd0938e(_0x48e2fc);})[_0x567b('0x16')](function(_0x186fd5){_0x1a78ad(_0x186fd5['message']);});});}function createEndUser(_0x6fe46f,_0x357631,_0x384014,_0x3dcd29,_0x2df0b3,_0x18b5e3,_0x1578da){return new Promise(function(_0x75b0e5,_0xf5e84d){return getAuthToken(_0x357631,_0x384014,_0x18b5e3)[_0x567b('0x1f')](function(_0x8a60bb){var _0x4cda7f=_0x18b5e3['toLowerCase']()===_0x567b('0x2c')?_0x2df0b3[_0x567b('0x2d')]:_0x2df0b3[_0x567b('0x2e')];var _0x368c64={'method':'POST','uri':_0x3dcd29+_0x567b('0x2f'),'body':{'fullname':_0x4cda7f,'firstname':_0x4cda7f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x6fe46f[_0x567b('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x8a60bb,'OData-Version':_0x567b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x368c64['body'][_0x1578da]=_0x4cda7f;return rp(_0x368c64);})[_0x567b('0x1f')](function(_0x3af2c0){var _0x3f89be=_0x3af2c0[_0x567b('0x30')]['odata-entityid'];var _0x279efa=_0x3f89be[_0x567b('0x31')](_0x3f89be[_0x567b('0x32')]('(')+0x1,_0x3f89be['lastIndexOf'](')'));_0x6fe46f[_0x567b('0x33')]=_0x279efa;_0x75b0e5(_0x6fe46f);})[_0x567b('0x16')](function(_0x178e58){_0xf5e84d(_0x178e58[_0x567b('0x1a')]);});});}function getEndUser(_0x37d651,_0x359243,_0x455b22,_0xa098b1,_0x575851,_0x4b1205,_0x4bdb36,_0x265bd8){var _0x3f3d1d=_0x4b1205[_0x567b('0x34')]()===_0x567b('0x2c')?_0x575851[_0x567b('0x2d')]:_0x575851[_0x567b('0x2e')];return getAuthToken(_0x359243,_0x455b22,_0x4b1205)['then'](function(_0x346727){_0x265bd8=_0x265bd8?_0x265bd8:_0x567b('0x35');var _0x35c979={'method':'GET','uri':_0xa098b1+'contacts?$select='+_0x265bd8+_0x567b('0x36')+_0x265bd8+_0x567b('0x37')+_0x3f3d1d[_0x567b('0x38')]('+',_0x567b('0x39'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x346727,'If-None-Match':null,'OData-Version':_0x567b('0x1e')},'json':!![]};return rp(_0x35c979);})[_0x567b('0x1f')](function(_0x25345b){var _0xbc92f9=![];if(!_0x25345b)return _0xbc92f9;var _0x4a3075=_0x25345b[_0x567b('0x20')];for(var _0x4aa1db=0x0;_0x4aa1db<_0x4a3075['length'];_0x4aa1db++){if(_0x4a3075[_0x4aa1db][_0x265bd8]===_0x3f3d1d){_0xbc92f9=!![];_0x37d651[_0x567b('0x33')]=_0x4a3075[_0x4aa1db][_0x567b('0x3a')];}}return _0xbc92f9;})[_0x567b('0x1f')](function(_0x5fa1e1){if(_0x5fa1e1)return _0x37d651;if(_0x4bdb36===_0x567b('0x3b')){logger[_0x567b('0x26')]('['+[_0x4b1205[_0x567b('0x18')]()]+_0x567b('0x3c'));return _0x37d651;}return createEndUser(_0x37d651,_0x359243,_0x455b22,_0xa098b1,_0x575851,_0x4b1205,_0x265bd8)[_0x567b('0x1f')](function(_0x4df12e){logger[_0x567b('0x26')]('['+[_0x4b1205[_0x567b('0x18')]()]+_0x567b('0x3d'),_0x4df12e['enduserId']);return _0x4df12e;});});}function getCustomFields(_0x4e20f4,_0x100624,_0x7f896d){var _0x5c88cf={};if(_0x4e20f4[_0x567b('0x23')]>0x0){_[_0x567b('0x3e')](_0x4e20f4,function(_0x31c593){if(_[_0x567b('0x3f')]([_0x567b('0x40'),_0x567b('0x41')],_0x31c593['type'])&&_0x31c593['nameField']&&!_0x31c593[_0x567b('0x42')]){var _0x3c42af=_0x31c593[_0x567b('0x43')][_0x567b('0x34')]();var _0x1b6c00=_0x3c42af['substring'](0x0,_0x3c42af[_0x567b('0x44')]('_'));var _0x39e156=_0x3c42af[_0x567b('0x31')](_0x3c42af[_0x567b('0x44')]('_')+0x1);if(_0x1b6c00===_0x7f896d){_0x5c88cf[_0x39e156]=_0x31c593[_0x567b('0x45')];}}});}return _0x5c88cf;}function getTicket(_0x553a4f,_0x2ea047,_0x196bfa,_0x3d78b2,_0x4ac635,_0x4d9d7c,_0x5f28cf){return new Promise(function(_0x6dd55f,_0x1cba59){var _0x28114a;return getAuthToken(_0x2ea047,_0x196bfa,_0x5f28cf)[_0x567b('0x1f')](function(_0x5c39bf){if(_0x4d9d7c['ticketType']==='incident'){_0x28114a={'method':_0x567b('0x11'),'uri':_0x3d78b2+'incidents','body':Object[_0x567b('0x46')]({},{'title':intUtil[_0x567b('0x47')](_0x4d9d7c[_0x567b('0x48')],_0x4ac635,'\x20'),'description':intUtil['getString'](_0x4d9d7c['Descriptions'],_0x4ac635,'\x0a'),'customerid_contact@odata.bind':_0x553a4f[_0x567b('0x33')]?_0x567b('0x49')+_0x553a4f[_0x567b('0x33')]+')':undefined,'ownerid@odata.bind':_0x567b('0x4a')+_0x553a4f[_0x567b('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x4d9d7c[_0x567b('0x4b')],_0x4ac635,_0x4d9d7c[_0x567b('0x4c')])),'headers':{'Authorization':'Bearer\x20'+_0x5c39bf,'OData-Version':_0x567b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4d9d7c[_0x567b('0x4c')]==='phonecall'){var _0x25ff69=_0x553a4f['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x553a4f['userId']+')','participationtypemask':_0x553a4f['callDirection']===_0x567b('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x567b('0x49')+_0x553a4f[_0x567b('0x33')]+')','participationtypemask':_0x553a4f[_0x567b('0x4e')]===_0x567b('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x567b('0x4a')+_0x553a4f[_0x567b('0x29')]+')','participationtypemask':_0x553a4f[_0x567b('0x4e')]===_0x567b('0x4d')?0x2:0x1}];_0x28114a={'method':_0x567b('0x11'),'uri':_0x3d78b2+'phonecalls','body':Object[_0x567b('0x46')]({},{'subject':intUtil['getString'](_0x4d9d7c[_0x567b('0x48')],_0x4ac635,'\x20'),'phonenumber':String(_0x4ac635['calleridnum']),'description':intUtil[_0x567b('0x47')](_0x4d9d7c[_0x567b('0x4f')],_0x4ac635,'\x0a'),'regardingobjectid_contact@odata.bind':_0x553a4f[_0x567b('0x33')]?_0x567b('0x49')+_0x553a4f[_0x567b('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x553a4f[_0x567b('0x29')]+')','directioncode':_0x553a4f[_0x567b('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x25ff69},getCustomFields(_0x4d9d7c[_0x567b('0x4b')],_0x4ac635,_0x4d9d7c[_0x567b('0x4c')])),'headers':{'Authorization':'Bearer\x20'+_0x5c39bf,'OData-Version':_0x567b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x28114a);})[_0x567b('0x1f')](function(_0x21d450){var _0x22335b=_0x21d450[_0x567b('0x30')][_0x567b('0x50')];var _0x2ce77d=_0x22335b[_0x567b('0x31')](_0x22335b[_0x567b('0x32')]('(')+0x1,_0x22335b[_0x567b('0x32')](')'));_0x553a4f[_0x567b('0x51')]=_0x2ce77d;_0x6dd55f(_0x553a4f);})[_0x567b('0x16')](function(_0x290130){_0x1cba59(_0x290130[_0x567b('0x1a')]);});});}function emit(_0x34cf4e,_0x2113f3,_0x30a2d3,_0x51e3df){var _0x62066d={'uri':util[_0x567b('0x52')](_0x567b('0x53'),_0x34cf4e,_0x30a2d3,_0x51e3df)};io['to'](util[_0x567b('0x52')](_0x567b('0x54'),_0x2113f3))[_0x567b('0x55')]('trigger:browser:url',_0x62066d);}exports['cs']=function(_0x4aecfe,_0x3abf2b,_0x1862f0,_0x37c4c6,_0x546724,_0x1cda03,_0x2a47b2,_0x1b0233){var _0x10b72d={};_0x1cda03['remoteUri']=_0x1cda03[_0x567b('0x9')]?intUtil['stripTrailingSlash'](_0x1cda03[_0x567b('0xf')][_0x567b('0xb')]):intUtil[_0x567b('0x56')](_0x1cda03[_0x567b('0xa')]);_0x1cda03[_0x567b('0x57')]=intUtil['stripTrailingSlash'](_0x1cda03[_0x567b('0x57')]);_0x10b72d[_0x567b('0x4e')]=_0x1b0233===_0x567b('0x4d')||_0x1b0233===_0x567b('0x58')?_0x567b('0x4d'):_0x567b('0x2c');var _0x40bee3=_0x1cda03[_0x567b('0x9')]?util[_0x567b('0x52')](_0x567b('0x59'),_0x1cda03[_0x567b('0xf')]['data7']):util['format'](_0x567b('0x59'),_0x1cda03[_0x567b('0xa')]);var _0x5c9d2b=util[_0x567b('0x52')](_0x567b('0x5a'),_0x1cda03[_0x567b('0xc')]);var _0x555d28=util[_0x567b('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cda03[_0x567b('0x57')],_0x3abf2b[_0x567b('0x5b')],md5(_0x3abf2b[_0x567b('0x5b')]));if(_0x546724&&_0x546724[_0x567b('0x5c')]){logger[_0x567b('0x26')]('[QUEUE]',_0x567b('0x5d'));_0x3abf2b[_0x567b('0x5e')]=_0x555d28;}else if(_0x2a47b2&&_0x2a47b2[_0x567b('0x5f')]&&_0x2a47b2[_0x567b('0x5f')]!==_0x567b('0x60')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3abf2b[_0x567b('0x5e')]=_0x555d28;}else{_0x3abf2b['recordingURL']='';}return getUser(_0x10b72d,_0x1cda03,_0x37c4c6,_0x5c9d2b,_0x40bee3,_0x1b0233)['then'](function(_0x2d561c){logger[_0x567b('0x26')]('['+_0x1b0233[_0x567b('0x18')]()+']\x20The\x20User\x20ID\x20is:',_0x2d561c[_0x567b('0x29')]);logger[_0x567b('0x26')]('['+_0x1b0233[_0x567b('0x18')]()+']\x20The\x20User\x20email\x20is:',_0x2d561c[_0x567b('0x2b')]);return getEndUser(_0x2d561c,_0x1cda03,_0x5c9d2b,_0x40bee3,_0x3abf2b,_0x1b0233,_0x1862f0['moduleCreate'],_0x1862f0['additionalSearchContact']);})[_0x567b('0x1f')](function(_0x19e892){logger['info']('['+_0x1b0233[_0x567b('0x18')]()+_0x567b('0x61'),_0x19e892[_0x567b('0x33')]);logger['info']('['+_0x1b0233['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x3abf2b[_0x567b('0x2e')]);return getTicket(_0x19e892,_0x1cda03,_0x5c9d2b,_0x40bee3,_0x3abf2b,_0x1862f0,_0x1b0233);})['then'](function(_0x10bdbf){logger[_0x567b('0x26')](util['format']('['+_0x1b0233[_0x567b('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1862f0['ticketType'],_0x10bdbf[_0x567b('0x51')]));logger[_0x567b('0x26')](util['format']('['+_0x1b0233[_0x567b('0x18')]()+_0x567b('0x62'),_0x1b0233));if(_0x1b0233!==_0x567b('0x58')&&_0x1862f0[_0x567b('0x63')]){logger[_0x567b('0x26')]('['+_0x1b0233['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1cda03[_0x567b('0xa')],_0x37c4c6['name'],_0x1862f0[_0x567b('0x4c')],_0x10bdbf['ticketId']);}})[_0x567b('0x16')](function(_0x38f1a2){logger['error']('['+_0x1b0233[_0x567b('0x18')]()+_0x567b('0x64'),_0x38f1a2['message']);console['error'](_0x567b('0x65'),_0x38f1a2);});}; \ No newline at end of file +var _0xdf85=['includes','string','picklist','customField','idField','indexOf','content','ticketType','incident','incidents','getString','/contacts(','Fields','/systemusers(','callDirection','queue','assign','Subjects','Descriptions','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','POST','clientId','username','password','clientSecret','access_token','error','toUpperCase','then','GET','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','message','toLowerCase','destcalleridnum','calleridnum','contacts','4.0','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','Bearer\x20','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf85,0x1e0));var _0x5df8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdf85[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5df8('0x0'));var rp=require(_0x5df8('0x1'));var util=require(_0x5df8('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x5df8('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x5df8('0x4'));config[_0x5df8('0x5')]=_['defaults'](config[_0x5df8('0x5')],{'host':_0x5df8('0x6'),'port':0x18eb});var io=require(_0x5df8('0x7'))(new Redis(config[_0x5df8('0x5')]));function getAuthToken(_0x504515,_0x55f198,_0x4a44a7){if(_0x504515['modernAuthentication']){_0x504515[_0x5df8('0x8')]=_0x504515[_0x5df8('0x9')][_0x5df8('0xa')];_0x504515[_0x5df8('0xb')]=_0x504515[_0x5df8('0x9')][_0x5df8('0xc')];return Promise[_0x5df8('0xd')](_0x504515['CloudProvider']['data5']);}var _0xa8066f={'method':_0x5df8('0xe'),'uri':_0x55f198,'form':{'client_id':_0x504515[_0x5df8('0xf')],'resource':_0x504515['remoteUri'],'username':_0x504515[_0x5df8('0x10')],'password':_0x504515['password'],'grant_type':_0x5df8('0x11'),'client_secret':_0x504515[_0x5df8('0x12')]},'json':!![]};return rp(_0xa8066f)['then'](function(_0xbd4781){return _0xbd4781[_0x5df8('0x13')];})['catch'](function(_0xba34cd){logger[_0x5df8('0x14')]('['+[_0x4a44a7[_0x5df8('0x15')]()]+']\x20Wrong\x20credentials!');return _0xba34cd['message'];});}function getUser(_0x545aa1,_0x5a11ff,_0x3e850f,_0x236780,_0x429e47,_0x39ac96){return new Promise(function(_0x373b65,_0x43f8fa){return getAuthToken(_0x5a11ff,_0x236780,_0x39ac96)[_0x5df8('0x16')](function(_0x30409a){var _0x226d6f={'method':_0x5df8('0x17'),'uri':_0x429e47+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x30409a,'OData-Version':'4.0'},'json':!![]};return rp(_0x226d6f);})[_0x5df8('0x16')](function(_0x27b564){var _0x4458d1=_0x27b564[_0x5df8('0x18')];var _0x562627=![];var _0x555345=null;if(!_[_0x5df8('0x19')](_0x3e850f)){if(intUtil[_0x5df8('0x1a')](_0x3e850f[_0x5df8('0x1b')])){_0x545aa1[_0x5df8('0x1c')]=_0x3e850f['email'];for(_0x555345=0x0;_0x555345<_0x4458d1[_0x5df8('0x1d')];_0x555345++){if(_0x4458d1[_0x555345][_0x5df8('0x1e')]===_0x3e850f[_0x5df8('0x1b')]&&!_0x4458d1[_0x555345][_0x5df8('0x1f')]){_0x562627=!![];logger[_0x5df8('0x20')]('['+[_0x39ac96[_0x5df8('0x15')]()]+']\x20Agent\x20found\x20'+_0x4458d1[_0x555345]['systemuserid']+'!');_0x545aa1['userId']=_0x4458d1[_0x555345][_0x5df8('0x21')];}}}}if(!_0x562627){logger[_0x5df8('0x20')]('['+[_0x39ac96[_0x5df8('0x15')]()]+_0x5df8('0x22'));_0x545aa1[_0x5df8('0x1c')]=_0x5a11ff[_0x5df8('0x10')];for(_0x555345=0x0;_0x555345<_0x4458d1[_0x5df8('0x1d')];_0x555345++){if(_0x4458d1[_0x555345][_0x5df8('0x1e')]===_0x5a11ff[_0x5df8('0x10')]){_0x545aa1[_0x5df8('0x23')]=_0x4458d1[_0x555345][_0x5df8('0x21')];}}}_0x373b65(_0x545aa1);})[_0x5df8('0x24')](function(_0x3e9013){_0x43f8fa(_0x3e9013[_0x5df8('0x25')]);});});}function createEndUser(_0x1ab5c7,_0x79bac3,_0xa7c4b,_0x510a6f,_0x98fc19,_0x3557b9,_0x58237f){return new Promise(function(_0x5af5ab,_0xa438c2){return getAuthToken(_0x79bac3,_0xa7c4b,_0x3557b9)[_0x5df8('0x16')](function(_0x13eefa){var _0x3d192b=_0x3557b9[_0x5df8('0x26')]()==='outbound'?_0x98fc19[_0x5df8('0x27')]:_0x98fc19[_0x5df8('0x28')];var _0xc7d87d={'method':_0x5df8('0xe'),'uri':_0x510a6f+_0x5df8('0x29'),'body':{'fullname':_0x3d192b,'firstname':_0x3d192b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x1ab5c7[_0x5df8('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x13eefa,'OData-Version':_0x5df8('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0xc7d87d[_0x5df8('0x2b')][_0x58237f]=_0x3d192b;return rp(_0xc7d87d);})['then'](function(_0x1cec82){var _0xb08f8c=_0x1cec82['headers'][_0x5df8('0x2c')];var _0x3ceb7b=_0xb08f8c[_0x5df8('0x2d')](_0xb08f8c[_0x5df8('0x2e')]('(')+0x1,_0xb08f8c[_0x5df8('0x2e')](')'));_0x1ab5c7[_0x5df8('0x2f')]=_0x3ceb7b;_0x5af5ab(_0x1ab5c7);})[_0x5df8('0x24')](function(_0x28f2f1){_0xa438c2(_0x28f2f1['message']);});});}function getEndUser(_0x16d5b8,_0x2ccb9d,_0x4ea144,_0x377d8f,_0x5969b8,_0x361797,_0xed6c14,_0x24ffee){var _0x27a32c=_0x361797[_0x5df8('0x26')]()==='outbound'?_0x5969b8[_0x5df8('0x27')]:_0x5969b8[_0x5df8('0x28')];return getAuthToken(_0x2ccb9d,_0x4ea144,_0x361797)['then'](function(_0x4d05dc){_0x24ffee=_0x24ffee?_0x24ffee:_0x5df8('0x30');var _0x43da17={'method':'GET','uri':_0x377d8f+_0x5df8('0x31')+_0x24ffee+_0x5df8('0x32')+_0x24ffee+_0x5df8('0x33')+_0x27a32c[_0x5df8('0x34')]('+',_0x5df8('0x35'))+'\x27','headers':{'Authorization':_0x5df8('0x36')+_0x4d05dc,'If-None-Match':null,'OData-Version':_0x5df8('0x2a')},'json':!![]};return rp(_0x43da17);})[_0x5df8('0x16')](function(_0x2d63ec){var _0x4892cd=![];if(!_0x2d63ec)return _0x4892cd;var _0x1ac8e0=_0x2d63ec['value'];for(var _0xed5fdb=0x0;_0xed5fdb<_0x1ac8e0[_0x5df8('0x1d')];_0xed5fdb++){if(_0x1ac8e0[_0xed5fdb][_0x24ffee]===_0x27a32c){_0x4892cd=!![];_0x16d5b8[_0x5df8('0x2f')]=_0x1ac8e0[_0xed5fdb][_0x5df8('0x37')];}}return _0x4892cd;})[_0x5df8('0x16')](function(_0x4bcaaf){if(_0x4bcaaf)return _0x16d5b8;if(_0xed6c14===_0x5df8('0x38')){logger[_0x5df8('0x20')]('['+[_0x361797[_0x5df8('0x15')]()]+_0x5df8('0x39'));return _0x16d5b8;}return createEndUser(_0x16d5b8,_0x2ccb9d,_0x4ea144,_0x377d8f,_0x5969b8,_0x361797,_0x24ffee)[_0x5df8('0x16')](function(_0x30a4d9){logger[_0x5df8('0x20')]('['+[_0x361797['toUpperCase']()]+_0x5df8('0x3a'),_0x30a4d9['enduserId']);return _0x30a4d9;});});}function getCustomFields(_0x48ac22,_0x417235,_0x3a1875){var _0x29fe29={};if(_0x48ac22[_0x5df8('0x1d')]>0x0){_[_0x5df8('0x3b')](_0x48ac22,function(_0x243346){if(_[_0x5df8('0x3c')]([_0x5df8('0x3d'),_0x5df8('0x3e')],_0x243346['type'])&&_0x243346['nameField']&&!_0x243346[_0x5df8('0x3f')]){var _0x1c7d43=_0x243346[_0x5df8('0x40')][_0x5df8('0x26')]();var _0xf9ddd2=_0x1c7d43[_0x5df8('0x2d')](0x0,_0x1c7d43[_0x5df8('0x41')]('_'));var _0x77c4e3=_0x1c7d43['substring'](_0x1c7d43['indexOf']('_')+0x1);if(_0xf9ddd2===_0x3a1875){_0x29fe29[_0x77c4e3]=_0x243346[_0x5df8('0x42')];}}});}return _0x29fe29;}function getTicket(_0x1eb19c,_0xe0b81,_0x4e2aa7,_0x1199f1,_0xbadb3e,_0x1c80c0,_0x239941){return new Promise(function(_0x263b25,_0x35b9ff){var _0x515b3d;return getAuthToken(_0xe0b81,_0x4e2aa7,_0x239941)[_0x5df8('0x16')](function(_0x45cd68){if(_0x1c80c0[_0x5df8('0x43')]===_0x5df8('0x44')){_0x515b3d={'method':_0x5df8('0xe'),'uri':_0x1199f1+_0x5df8('0x45'),'body':Object['assign']({},{'title':intUtil[_0x5df8('0x46')](_0x1c80c0['Subjects'],_0xbadb3e,'\x20'),'description':intUtil[_0x5df8('0x46')](_0x1c80c0['Descriptions'],_0xbadb3e,'\x0a'),'customerid_contact@odata.bind':_0x1eb19c[_0x5df8('0x2f')]?_0x5df8('0x47')+_0x1eb19c['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x1eb19c['userId']+')','caseorigincode':'1'},getCustomFields(_0x1c80c0[_0x5df8('0x48')],_0xbadb3e,_0x1c80c0['ticketType'])),'headers':{'Authorization':_0x5df8('0x36')+_0x45cd68,'OData-Version':_0x5df8('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1c80c0[_0x5df8('0x43')]==='phonecall'){var _0x5a790d=_0x1eb19c['enduserId']?[{'partyid_systemuser@odata.bind':_0x5df8('0x49')+_0x1eb19c['userId']+')','participationtypemask':_0x1eb19c[_0x5df8('0x4a')]===_0x5df8('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x5df8('0x47')+_0x1eb19c['enduserId']+')','participationtypemask':_0x1eb19c[_0x5df8('0x4a')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1eb19c['userId']+')','participationtypemask':_0x1eb19c[_0x5df8('0x4a')]===_0x5df8('0x4b')?0x2:0x1}];_0x515b3d={'method':_0x5df8('0xe'),'uri':_0x1199f1+'phonecalls','body':Object[_0x5df8('0x4c')]({},{'subject':intUtil[_0x5df8('0x46')](_0x1c80c0[_0x5df8('0x4d')],_0xbadb3e,'\x20'),'phonenumber':String(_0xbadb3e[_0x5df8('0x28')]),'description':intUtil[_0x5df8('0x46')](_0x1c80c0[_0x5df8('0x4e')],_0xbadb3e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1eb19c['enduserId']?'/contacts('+_0x1eb19c[_0x5df8('0x2f')]+')':undefined,'ownerid@odata.bind':_0x5df8('0x49')+_0x1eb19c[_0x5df8('0x23')]+')','directioncode':_0x1eb19c[_0x5df8('0x4a')]===_0x5df8('0x4b')?![]:!![],'phonecall_activity_parties':_0x5a790d},getCustomFields(_0x1c80c0['Fields'],_0xbadb3e,_0x1c80c0['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x45cd68,'OData-Version':_0x5df8('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x515b3d);})[_0x5df8('0x16')](function(_0x567011){var _0x7df0ea=_0x567011['headers']['odata-entityid'];var _0x18c497=_0x7df0ea[_0x5df8('0x2d')](_0x7df0ea[_0x5df8('0x2e')]('(')+0x1,_0x7df0ea[_0x5df8('0x2e')](')'));_0x1eb19c['ticketId']=_0x18c497;_0x263b25(_0x1eb19c);})['catch'](function(_0x1f6b1a){_0x35b9ff(_0x1f6b1a[_0x5df8('0x25')]);});});}function emit(_0x27224d,_0x2d3361,_0x56a4b7,_0x18798e){var _0x210580={'uri':util[_0x5df8('0x4f')](_0x5df8('0x50'),_0x27224d,_0x56a4b7,_0x18798e)};io['to'](util[_0x5df8('0x4f')](_0x5df8('0x51'),_0x2d3361))[_0x5df8('0x52')](_0x5df8('0x53'),_0x210580);}exports['cs']=function(_0x1b6f4c,_0x53a44b,_0x14e24a,_0x5d4d36,_0x27567a,_0x42134,_0x24df19,_0x41420e){var _0x409b6d={};_0x42134[_0x5df8('0x8')]=_0x42134[_0x5df8('0x54')]?intUtil['stripTrailingSlash'](_0x42134[_0x5df8('0x9')]['data7']):intUtil[_0x5df8('0x55')](_0x42134[_0x5df8('0x8')]);_0x42134[_0x5df8('0x56')]=intUtil['stripTrailingSlash'](_0x42134[_0x5df8('0x56')]);_0x409b6d[_0x5df8('0x4a')]=_0x41420e==='queue'||_0x41420e===_0x5df8('0x57')?_0x5df8('0x4b'):'outbound';var _0x3df7a0=_0x42134['modernAuthentication']?util['format'](_0x5df8('0x58'),_0x42134[_0x5df8('0x9')][_0x5df8('0xa')]):util[_0x5df8('0x4f')](_0x5df8('0x58'),_0x42134[_0x5df8('0x8')]);var _0x1dc484=util[_0x5df8('0x4f')](_0x5df8('0x59'),_0x42134[_0x5df8('0xb')]);var _0x536843=util[_0x5df8('0x4f')](_0x5df8('0x5a'),_0x42134[_0x5df8('0x56')],_0x53a44b[_0x5df8('0x5b')],md5(_0x53a44b[_0x5df8('0x5b')]));if(_0x27567a&&_0x27567a['monitor_format']){logger[_0x5df8('0x20')]('[QUEUE]','Recording\x20is\x20enabled!');_0x53a44b[_0x5df8('0x5c')]=_0x536843;}else if(_0x24df19&&_0x24df19['recordingFormat']&&_0x24df19[_0x5df8('0x5d')]!==_0x5df8('0x5e')){logger[_0x5df8('0x20')](_0x5df8('0x5f'),_0x5df8('0x60'));_0x53a44b[_0x5df8('0x5c')]=_0x536843;}else{_0x53a44b[_0x5df8('0x5c')]='';}return getUser(_0x409b6d,_0x42134,_0x5d4d36,_0x1dc484,_0x3df7a0,_0x41420e)[_0x5df8('0x16')](function(_0x518026){logger[_0x5df8('0x20')]('['+_0x41420e[_0x5df8('0x15')]()+_0x5df8('0x61'),_0x518026[_0x5df8('0x23')]);logger[_0x5df8('0x20')]('['+_0x41420e[_0x5df8('0x15')]()+']\x20The\x20User\x20email\x20is:',_0x518026[_0x5df8('0x1c')]);return getEndUser(_0x518026,_0x42134,_0x1dc484,_0x3df7a0,_0x53a44b,_0x41420e,_0x14e24a[_0x5df8('0x62')],_0x14e24a[_0x5df8('0x63')]);})['then'](function(_0x536f78){logger[_0x5df8('0x20')]('['+_0x41420e[_0x5df8('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x536f78['enduserId']);logger[_0x5df8('0x20')]('['+_0x41420e[_0x5df8('0x15')]()+_0x5df8('0x64'),_0x53a44b[_0x5df8('0x28')]);return getTicket(_0x536f78,_0x42134,_0x1dc484,_0x3df7a0,_0x53a44b,_0x14e24a,_0x41420e);})['then'](function(_0xcadb11){logger[_0x5df8('0x20')](util[_0x5df8('0x4f')]('['+_0x41420e['toUpperCase']()+_0x5df8('0x65'),_0x14e24a['ticketType'],_0xcadb11[_0x5df8('0x66')]));logger[_0x5df8('0x20')](util[_0x5df8('0x4f')]('['+_0x41420e[_0x5df8('0x15')]()+_0x5df8('0x67'),_0x41420e));if(_0x41420e!==_0x5df8('0x57')&&_0x14e24a['openNewTab']){logger['info']('['+_0x41420e[_0x5df8('0x15')]()+']',_0x5df8('0x68'));emit(_0x42134[_0x5df8('0x8')],_0x5d4d36[_0x5df8('0x69')],_0x14e24a['ticketType'],_0xcadb11[_0x5df8('0x66')]);}})[_0x5df8('0x24')](function(_0x2748d4){logger[_0x5df8('0x14')]('['+_0x41420e['toUpperCase']()+_0x5df8('0x6a'),_0x2748d4['message']);console['error'](_0x5df8('0x6b'),_0x2748d4);});}; \ 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 27f04a2..b19aa71 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 _0x2bd1=['nameField','toLowerCase','content','type','idField','variable','variableName','push','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','calleridnum','getString','Subjects','Descriptions','
','custom_fields','mapValues','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','debug','[HTTP]','defaults','GET','forEach','includes','string','picklist','customField'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2bd1,0x82));var _0x12bd=function(_0xd14582,_0x4dd7a7){_0xd14582=_0xd14582-0x0;var _0x3e2574=_0x2bd1[_0xd14582];return _0x3e2574;};'use strict';var _=require(_0x12bd('0x0'));var rp=require(_0x12bd('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x12bd('0x2'));var intUtil=require(_0x12bd('0x3'));var config=require(_0x12bd('0x4'));var logger=require(_0x12bd('0x5'))(_0x12bd('0x6'));config['redis']=_['defaults'](config[_0x12bd('0x7')],{'host':_0x12bd('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x12bd('0x7')]));var headers={'Content-Type':_0x12bd('0x9'),'Accept':'application/json'};function emit(_0x47aa9f,_0x13b8ce,_0x3bb303){io['to'](_0x47aa9f)[_0x12bd('0xa')](_0x13b8ce,_0x3bb303);}function getTicket(_0x521e01,_0x2f0e28,_0x257e83,_0x130ce6,_0x4a7b71){logger[_0x12bd('0xb')](_0x12bd('0xc'));var _0x129f30=_['merge']({'responder_id':_0x2f0e28['id'],'requester_id':_0x257e83['id'],'name':util['format']('Caller\x20-\x20%s',_0x4a7b71['calleridname']),'phone':_0x4a7b71[_0x12bd('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x12bd('0xe')](_0x130ce6[_0x12bd('0xf')],_0x4a7b71,'\x20'),'description':intUtil[_0x12bd('0xe')](_0x130ce6[_0x12bd('0x10')],_0x4a7b71,_0x12bd('0x11')),'tags':getTags(_0x130ce6['Tags'],'name')},getCustomFields(_0x130ce6['Fields'],_0x4a7b71));_0x129f30[_0x12bd('0x12')]=_[_0x12bd('0x13')](_['keyBy'](_0x129f30[_0x12bd('0x12')],'id'),_0x12bd('0x14'));return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x16'),_0x521e01[_0x12bd('0x17')]),'method':'POST','body':_0x129f30})[_0x12bd('0x18')](function(_0x2e8f5d){logger[_0x12bd('0xb')](_0x12bd('0x19'));return _0x2e8f5d;});}function getUser(_0x3afabb,_0x4c27f3){if(intUtil[_0x12bd('0x1a')](_0x4c27f3)){return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x1b'),_0x3afabb[_0x12bd('0x17')]),'qs':{'email':_0x4c27f3}})[_0x12bd('0x18')](function(_0x1983f7){if(_0x1983f7['length']){logger[_0x12bd('0xb')]('Agent\x20found!');return _[_0x12bd('0x1c')](_0x1983f7,function(_0x45a201){return _0x45a201[_0x12bd('0x1d')][_0x12bd('0x1e')]===_0x4c27f3;});}else{logger[_0x12bd('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x1f'),_0x3afabb['remoteUri'])})[_0x12bd('0x18')](function(_0x29377f){logger['info'](_0x12bd('0x20'));return _0x29377f;});}});}else{logger[_0x12bd('0xb')](_0x12bd('0x21'));return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x1f'),_0x3afabb[_0x12bd('0x17')])})[_0x12bd('0x18')](function(_0x4d1ccd){logger[_0x12bd('0xb')](_0x12bd('0x20'));return _0x4d1ccd;});}}function getEndUser(_0x5de3d4,_0x28e93a,_0x51e474){logger['info'](_0x12bd('0x22'),_0x51e474);return request({'uri':util[_0x12bd('0x15')]('%s/api/v2/contacts',_0x5de3d4[_0x12bd('0x17')]),'qs':{'phone':_0x51e474}})[_0x12bd('0x18')](function(_0x1e9084){if(_0x1e9084[_0x12bd('0x23')]){logger['info']('Enduser\x20found!');return _[_0x12bd('0x1c')](_0x1e9084,{'phone':_0x51e474});}else{logger[_0x12bd('0xb')](_0x12bd('0x24'));return request({'uri':util[_0x12bd('0x15')](_0x12bd('0x25'),_0x5de3d4['remoteUri']),'method':'POST','body':{'name':_0x28e93a,'phone':_0x51e474}})[_0x12bd('0x18')](function(_0x32bf02){logger[_0x12bd('0xb')](_0x12bd('0x26'));return _0x32bf02;});}});}function getAuth(_0x100831){return util[_0x12bd('0x15')]('Basic\x20%s',new Buffer(_0x100831[_0x12bd('0x27')]+':X')[_0x12bd('0x28')]('base64'));}function request(_0x146563){logger[_0x12bd('0x29')](_0x12bd('0x2a'),JSON['stringify'](_0x146563));return rp(_[_0x12bd('0x2b')](_0x146563,{'method':_0x12bd('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x21b774,_0x3eea58){var _0x446462=[];if(_0x21b774&&_0x21b774[_0x12bd('0x23')]>0x0){_0x446462=_['map'](_0x21b774,_0x3eea58);}return _0x446462;}function getCustomFields(_0x1729ba,_0x387343){var _0x211f49=[];var _0x443572={'custom_fields':[]};if(_0x1729ba[_0x12bd('0x23')]>0x0){_[_0x12bd('0x2d')](_0x1729ba,function(_0x10b694){if(_[_0x12bd('0x2e')]([_0x12bd('0x2f'),_0x12bd('0x30')],_0x10b694['type'])&&_0x10b694['nameField']&&!_0x10b694[_0x12bd('0x31')]){_0x443572[_0x10b694[_0x12bd('0x32')][_0x12bd('0x33')]()]=_0x10b694[_0x12bd('0x34')][_0x12bd('0x28')]();}else if(_[_0x12bd('0x2e')]([_0x12bd('0x2f'),_0x12bd('0x30')],_0x10b694[_0x12bd('0x35')])&&_0x10b694[_0x12bd('0x36')]&&_0x10b694[_0x12bd('0x31')]){_0x443572[_0x12bd('0x12')]['push']({'id':_0x10b694['idField'],'value':_0x10b694[_0x12bd('0x34')]['toString']()});}else if(_0x10b694[_0x12bd('0x35')]===_0x12bd('0x37')&&_0x10b694[_0x12bd('0x38')]&&_0x10b694[_0x12bd('0x36')]&&_0x10b694[_0x12bd('0x31')]){_0x387343[_0x10b694[_0x12bd('0x38')]]&&_0x443572['custom_fields'][_0x12bd('0x39')]({'id':_0x10b694[_0x12bd('0x36')],'value':_0x387343[_0x10b694[_0x12bd('0x38')]][_0x12bd('0x28')]()});}else if(_0x10b694[_0x12bd('0x35')]===_0x12bd('0x3a')&&_0x10b694['Variable']&&_0x10b694['Variable'][_0x12bd('0x3b')]&&_0x10b694[_0x12bd('0x36')]&&_0x10b694[_0x12bd('0x31')]){_0x387343[_0x10b694['Variable'][_0x12bd('0x3b')]['toLowerCase']()]&&_0x443572[_0x12bd('0x12')][_0x12bd('0x39')]({'id':_0x10b694[_0x12bd('0x36')],'value':_0x387343[_0x10b694[_0x12bd('0x3c')][_0x12bd('0x3b')]['toLowerCase']()][_0x12bd('0x28')]()});}});}return _0x443572;}exports[_0x12bd('0x3d')]=function(_0x4612d9,_0x52b196,_0x352ac1,_0x49a063,_0xfa5276,_0x20316a){var _0x4b2f87,_0x2e9399;_0x20316a['remoteUri']=intUtil[_0x12bd('0x3e')](_0x20316a[_0x12bd('0x17')]);_0x20316a[_0x12bd('0x3f')]=intUtil[_0x12bd('0x3e')](_0x20316a[_0x12bd('0x3f')]);if(_0xfa5276&&_0xfa5276['monitor_format']){logger[_0x12bd('0xb')](_0x12bd('0x40'),'Recording\x20is\x20enabled!');_0x52b196[_0x12bd('0x41')]=util[_0x12bd('0x15')](_0x12bd('0x42'),_0x20316a[_0x12bd('0x3f')],_0x52b196[_0x12bd('0x43')],md5(_0x52b196[_0x12bd('0x43')]));}else{_0x52b196[_0x12bd('0x41')]='';}headers[_0x12bd('0x44')]=getAuth(_0x20316a);return getUser(_0x20316a,_0x49a063[_0x12bd('0x1e')])[_0x12bd('0x18')](function(_0x379506){_0x4b2f87=_0x379506;logger[_0x12bd('0xb')]('The\x20User\x20ID\x20is:',_0x4b2f87['id']);return getEndUser(_0x20316a,_0x52b196[_0x12bd('0x45')],_0x52b196[_0x12bd('0xd')]);})[_0x12bd('0x18')](function(_0x1c02a9){_0x2e9399=_0x1c02a9;logger[_0x12bd('0xb')](_0x12bd('0x46'),_0x2e9399['id']);return getTicket(_0x20316a,_0x4b2f87,_0x2e9399,_0x352ac1,_0x52b196);})['then'](function(_0x5002ff){if(_0x5002ff&&_0x5002ff['id']){logger[_0x12bd('0xb')](_0x12bd('0x19'));logger['info'](_0x12bd('0x47'),_0x5002ff['id']);logger['info'](_0x12bd('0x40'),_0x12bd('0x48'));emit(util[_0x12bd('0x15')](_0x12bd('0x49'),_0x49a063['name']),_0x12bd('0x4a'),{'uri':util[_0x12bd('0x15')](_0x12bd('0x4b'),_0x20316a[_0x12bd('0x17')],_0x5002ff['id'])});}})[_0x12bd('0x4c')](function(_0x2eeadf){logger[_0x12bd('0x4d')](_0x12bd('0x40'),JSON[_0x12bd('0x4e')](_0x2eeadf));});};exports[_0x12bd('0x4f')]=function(_0x5934ce,_0x2c8177,_0x25a8fd,_0x211c90,_0x14fc27,_0x458b7f,_0x2b4865){var _0x4c7853,_0x19683b;_0x458b7f[_0x12bd('0x17')]=intUtil['stripTrailingSlash'](_0x458b7f[_0x12bd('0x17')]);_0x458b7f[_0x12bd('0x3f')]=intUtil[_0x12bd('0x3e')](_0x458b7f[_0x12bd('0x3f')]);if(_0x2b4865&&_0x2b4865[_0x12bd('0x50')]&&_0x2b4865[_0x12bd('0x50')]!=='none'){logger[_0x12bd('0xb')](_0x12bd('0x51'),_0x12bd('0x52'));_0x2c8177[_0x12bd('0x41')]=util['format'](_0x12bd('0x42'),_0x458b7f[_0x12bd('0x3f')],_0x2c8177[_0x12bd('0x43')],md5(_0x2c8177[_0x12bd('0x43')]));}headers[_0x12bd('0x44')]=getAuth(_0x458b7f);return getUser(_0x458b7f,_0x211c90[_0x12bd('0x1e')])[_0x12bd('0x18')](function(_0xeeb00b){_0x4c7853=_0xeeb00b;logger[_0x12bd('0xb')](_0x12bd('0x53'),_0x4c7853['id']);return getEndUser(_0x458b7f,_0x2c8177[_0x12bd('0x54')],_0x2c8177[_0x12bd('0x55')]);})[_0x12bd('0x18')](function(_0x2a2a68){_0x19683b=_0x2a2a68;logger['info'](_0x12bd('0x46'),_0x19683b['id']);return getTicket(_0x458b7f,_0x4c7853,_0x19683b,_0x25a8fd,_0x2c8177);})[_0x12bd('0x18')](function(_0x4adac0){if(_0x4adac0&&_0x4adac0['id']){logger[_0x12bd('0xb')](_0x12bd('0x19'));logger[_0x12bd('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4adac0['id']);logger[_0x12bd('0xb')]('[OUTBOUND]',_0x12bd('0x48'));emit(util[_0x12bd('0x15')](_0x12bd('0x49'),_0x211c90[_0x12bd('0x3b')]),_0x12bd('0x4a'),{'uri':util[_0x12bd('0x15')]('%s/helpdesk/tickets/%d',_0x458b7f[_0x12bd('0x17')],_0x4adac0['id'])});}})['catch'](function(_0x2e8184){logger[_0x12bd('0x4d')](_0x12bd('0x51'),JSON[_0x12bd('0x4e')](_0x2e8184));});};exports[_0x12bd('0x56')]=function(_0x419fa6,_0x4e8872,_0x24c7fe,_0x5958d6,_0x506791,_0x3dcd09){var _0x5deabd,_0x589143;_0x3dcd09[_0x12bd('0x17')]=intUtil[_0x12bd('0x3e')](_0x3dcd09[_0x12bd('0x17')]);_0x3dcd09[_0x12bd('0x3f')]=intUtil[_0x12bd('0x3e')](_0x3dcd09[_0x12bd('0x3f')]);if(_0x506791&&_0x506791[_0x12bd('0x57')]){logger[_0x12bd('0xb')]('['+_0x4e8872[_0x12bd('0x58')][_0x12bd('0x59')]()+']','Recording\x20is\x20enabled!');_0x4e8872['recordingURL']=util[_0x12bd('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3dcd09[_0x12bd('0x3f')],_0x4e8872[_0x12bd('0x43')],md5(_0x4e8872[_0x12bd('0x43')]));}else{_0x4e8872[_0x12bd('0x41')]='';}headers[_0x12bd('0x44')]=getAuth(_0x3dcd09);return getUser(_0x3dcd09,'')[_0x12bd('0x18')](function(_0x50558a){_0x5deabd=_0x50558a;logger[_0x12bd('0xb')](_0x12bd('0x53'),_0x5deabd['id']);return getEndUser(_0x3dcd09,_0x4e8872[_0x12bd('0x45')],_0x4e8872[_0x12bd('0xd')]);})['then'](function(_0x3050f2){_0x589143=_0x3050f2;logger[_0x12bd('0xb')](_0x12bd('0x46'),_0x589143['id']);return getTicket(_0x3dcd09,_0x5deabd,_0x589143,_0x24c7fe,_0x4e8872);})[_0x12bd('0x18')](function(_0x58f2fa){if(_0x58f2fa){logger[_0x12bd('0xb')](_0x12bd('0x19'));logger[_0x12bd('0xb')]('The\x20Ticket\x20ID\x20is:',_0x58f2fa['id']);}})[_0x12bd('0x4c')](function(_0x4bc709){logger[_0x12bd('0x4d')]('['+_0x4e8872[_0x12bd('0x58')][_0x12bd('0x59')]()+']',JSON[_0x12bd('0x4e')](_0x4bc709));});}; \ No newline at end of file +var _0x0ee7=['The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Ticket\x20created!','%s/helpdesk/tickets/%d','error','lastevent','toUpperCase','recordingURL','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','mapValues','format','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','base64','stringify','defaults','GET','forEach','type','nameField','toLowerCase','content','toString','includes','string','picklist','idField','customField','push','variable','variableName','custom_fields','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:'];(function(_0x377fcb,_0x180fd4){var _0x1272c3=function(_0x22d094){while(--_0x22d094){_0x377fcb['push'](_0x377fcb['shift']());}};_0x1272c3(++_0x180fd4);}(_0x0ee7,0xc4));var _0x70ee=function(_0xac9170,_0x5c4185){_0xac9170=_0xac9170-0x0;var _0x1b3c4b=_0x0ee7[_0xac9170];return _0x1b3c4b;};'use strict';var _=require('lodash');var rp=require(_0x70ee('0x0'));var md5=require(_0x70ee('0x1'));var util=require(_0x70ee('0x2'));var Redis=require(_0x70ee('0x3'));var intUtil=require(_0x70ee('0x4'));var config=require(_0x70ee('0x5'));var logger=require(_0x70ee('0x6'))('freshdesk');config[_0x70ee('0x7')]=_['defaults'](config[_0x70ee('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x70ee('0x8'),'Accept':_0x70ee('0x8')};function emit(_0x311e0b,_0x7d2ad3,_0x1ff8f4){io['to'](_0x311e0b)[_0x70ee('0x9')](_0x7d2ad3,_0x1ff8f4);}function getTicket(_0x31c7fe,_0x110f6d,_0xde068,_0x45bd14,_0x2a765a){logger[_0x70ee('0xa')](_0x70ee('0xb'));var _0x1ac7fa=_[_0x70ee('0xc')]({'responder_id':_0x110f6d['id'],'requester_id':_0xde068['id'],'name':util['format'](_0x70ee('0xd'),_0x2a765a['calleridname']),'phone':_0x2a765a[_0x70ee('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x70ee('0xf')](_0x45bd14[_0x70ee('0x10')],_0x2a765a,'\x20'),'description':intUtil[_0x70ee('0xf')](_0x45bd14[_0x70ee('0x11')],_0x2a765a,_0x70ee('0x12')),'tags':getTags(_0x45bd14[_0x70ee('0x13')],'name')},getCustomFields(_0x45bd14['Fields'],_0x2a765a));_0x1ac7fa['custom_fields']=_[_0x70ee('0x14')](_['keyBy'](_0x1ac7fa['custom_fields'],'id'),'value');return request({'uri':util[_0x70ee('0x15')](_0x70ee('0x16'),_0x31c7fe[_0x70ee('0x17')]),'method':_0x70ee('0x18'),'body':_0x1ac7fa})[_0x70ee('0x19')](function(_0x568a99){logger[_0x70ee('0xa')]('Ticket\x20created!');return _0x568a99;});}function getUser(_0x177976,_0x529fee){if(intUtil[_0x70ee('0x1a')](_0x529fee)){return request({'uri':util[_0x70ee('0x15')]('%s/api/v2/agents',_0x177976[_0x70ee('0x17')]),'qs':{'email':_0x529fee}})[_0x70ee('0x19')](function(_0x30b305){if(_0x30b305[_0x70ee('0x1b')]){logger[_0x70ee('0xa')](_0x70ee('0x1c'));return _[_0x70ee('0x1d')](_0x30b305,function(_0x33918d){return _0x33918d[_0x70ee('0x1e')][_0x70ee('0x1f')]===_0x529fee;});}else{logger[_0x70ee('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x70ee('0x15')](_0x70ee('0x20'),_0x177976['remoteUri'])})['then'](function(_0x53ef9d){logger[_0x70ee('0xa')](_0x70ee('0x21'));return _0x53ef9d;});}});}else{logger[_0x70ee('0xa')](_0x70ee('0x22'));return request({'uri':util[_0x70ee('0x15')](_0x70ee('0x20'),_0x177976[_0x70ee('0x17')])})['then'](function(_0x235030){logger[_0x70ee('0xa')](_0x70ee('0x21'));return _0x235030;});}}function getEndUser(_0x25737c,_0x1e84ee,_0x5be70e){logger['info'](_0x70ee('0x23'),_0x5be70e);return request({'uri':util['format'](_0x70ee('0x24'),_0x25737c[_0x70ee('0x17')]),'qs':{'phone':_0x5be70e}})[_0x70ee('0x19')](function(_0x57bdba){if(_0x57bdba[_0x70ee('0x1b')]){logger[_0x70ee('0xa')](_0x70ee('0x25'));return _[_0x70ee('0x1d')](_0x57bdba,{'phone':_0x5be70e});}else{logger[_0x70ee('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x70ee('0x15')](_0x70ee('0x24'),_0x25737c['remoteUri']),'method':'POST','body':{'name':_0x1e84ee,'phone':_0x5be70e}})['then'](function(_0x49126e){logger[_0x70ee('0xa')](_0x70ee('0x26'));return _0x49126e;});}});}function getAuth(_0x31ab10){return util[_0x70ee('0x15')](_0x70ee('0x27'),new Buffer(_0x31ab10[_0x70ee('0x28')]+':X')['toString'](_0x70ee('0x29')));}function request(_0x47f61a){logger['debug']('[HTTP]',JSON[_0x70ee('0x2a')](_0x47f61a));return rp(_[_0x70ee('0x2b')](_0x47f61a,{'method':_0x70ee('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x747ec,_0x103b8a){var _0x2a2381=[];if(_0x747ec&&_0x747ec[_0x70ee('0x1b')]>0x0){_0x2a2381=_['map'](_0x747ec,_0x103b8a);}return _0x2a2381;}function getCustomFields(_0x33b37d,_0x3486ba){var _0x56915b=[];var _0x19b4b7={'custom_fields':[]};if(_0x33b37d[_0x70ee('0x1b')]>0x0){_[_0x70ee('0x2d')](_0x33b37d,function(_0x191a60){if(_['includes'](['string','picklist'],_0x191a60[_0x70ee('0x2e')])&&_0x191a60[_0x70ee('0x2f')]&&!_0x191a60['customField']){_0x19b4b7[_0x191a60[_0x70ee('0x2f')][_0x70ee('0x30')]()]=_0x191a60[_0x70ee('0x31')][_0x70ee('0x32')]();}else if(_[_0x70ee('0x33')]([_0x70ee('0x34'),_0x70ee('0x35')],_0x191a60[_0x70ee('0x2e')])&&_0x191a60[_0x70ee('0x36')]&&_0x191a60[_0x70ee('0x37')]){_0x19b4b7['custom_fields'][_0x70ee('0x38')]({'id':_0x191a60['idField'],'value':_0x191a60['content'][_0x70ee('0x32')]()});}else if(_0x191a60[_0x70ee('0x2e')]===_0x70ee('0x39')&&_0x191a60['variableName']&&_0x191a60[_0x70ee('0x36')]&&_0x191a60['customField']){_0x3486ba[_0x191a60[_0x70ee('0x3a')]]&&_0x19b4b7[_0x70ee('0x3b')][_0x70ee('0x38')]({'id':_0x191a60[_0x70ee('0x36')],'value':_0x3486ba[_0x191a60[_0x70ee('0x3a')]][_0x70ee('0x32')]()});}else if(_0x191a60[_0x70ee('0x2e')]===_0x70ee('0x3c')&&_0x191a60['Variable']&&_0x191a60[_0x70ee('0x3d')][_0x70ee('0x3e')]&&_0x191a60[_0x70ee('0x36')]&&_0x191a60[_0x70ee('0x37')]){_0x3486ba[_0x191a60[_0x70ee('0x3d')]['name']['toLowerCase']()]&&_0x19b4b7[_0x70ee('0x3b')]['push']({'id':_0x191a60[_0x70ee('0x36')],'value':_0x3486ba[_0x191a60[_0x70ee('0x3d')][_0x70ee('0x3e')][_0x70ee('0x30')]()][_0x70ee('0x32')]()});}});}return _0x19b4b7;}exports[_0x70ee('0x3f')]=function(_0x309f76,_0x4582c2,_0x2c4dc5,_0x496037,_0x299d14,_0x29621d){var _0x6b8824,_0x4a7a69;_0x29621d[_0x70ee('0x17')]=intUtil['stripTrailingSlash'](_0x29621d[_0x70ee('0x17')]);_0x29621d[_0x70ee('0x40')]=intUtil[_0x70ee('0x41')](_0x29621d[_0x70ee('0x40')]);if(_0x299d14&&_0x299d14[_0x70ee('0x42')]){logger[_0x70ee('0xa')]('[QUEUE]',_0x70ee('0x43'));_0x4582c2['recordingURL']=util[_0x70ee('0x15')](_0x70ee('0x44'),_0x29621d[_0x70ee('0x40')],_0x4582c2['uniqueid'],md5(_0x4582c2[_0x70ee('0x45')]));}else{_0x4582c2['recordingURL']='';}headers[_0x70ee('0x46')]=getAuth(_0x29621d);return getUser(_0x29621d,_0x496037[_0x70ee('0x1f')])[_0x70ee('0x19')](function(_0x4fd774){_0x6b8824=_0x4fd774;logger[_0x70ee('0xa')](_0x70ee('0x47'),_0x6b8824['id']);return getEndUser(_0x29621d,_0x4582c2[_0x70ee('0x48')],_0x4582c2[_0x70ee('0xe')]);})[_0x70ee('0x19')](function(_0x55b0ca){_0x4a7a69=_0x55b0ca;logger[_0x70ee('0xa')](_0x70ee('0x49'),_0x4a7a69['id']);return getTicket(_0x29621d,_0x6b8824,_0x4a7a69,_0x2c4dc5,_0x4582c2);})[_0x70ee('0x19')](function(_0x4a469b){if(_0x4a469b&&_0x4a469b['id']){logger[_0x70ee('0xa')]('Ticket\x20created!');logger['info'](_0x70ee('0x4a'),_0x4a469b['id']);logger[_0x70ee('0xa')](_0x70ee('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x70ee('0x15')](_0x70ee('0x4c'),_0x496037[_0x70ee('0x3e')]),_0x70ee('0x4d'),{'uri':util[_0x70ee('0x15')]('%s/helpdesk/tickets/%d',_0x29621d[_0x70ee('0x17')],_0x4a469b['id'])});}})[_0x70ee('0x4e')](function(_0x5bc363){logger['error'](_0x70ee('0x4b'),JSON['stringify'](_0x5bc363));});};exports[_0x70ee('0x4f')]=function(_0x5df8b5,_0x3cab0f,_0x2d9ec0,_0x2ad924,_0x2ae637,_0x2eccbb,_0x2d5952){var _0x5e557c,_0x3005da;_0x2eccbb['remoteUri']=intUtil['stripTrailingSlash'](_0x2eccbb[_0x70ee('0x17')]);_0x2eccbb[_0x70ee('0x40')]=intUtil[_0x70ee('0x41')](_0x2eccbb[_0x70ee('0x40')]);if(_0x2d5952&&_0x2d5952['recordingFormat']&&_0x2d5952[_0x70ee('0x50')]!==_0x70ee('0x51')){logger[_0x70ee('0xa')](_0x70ee('0x52'),_0x70ee('0x43'));_0x3cab0f['recordingURL']=util[_0x70ee('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2eccbb[_0x70ee('0x40')],_0x3cab0f[_0x70ee('0x45')],md5(_0x3cab0f['uniqueid']));}headers[_0x70ee('0x46')]=getAuth(_0x2eccbb);return getUser(_0x2eccbb,_0x2ad924[_0x70ee('0x1f')])[_0x70ee('0x19')](function(_0x110501){_0x5e557c=_0x110501;logger['info'](_0x70ee('0x47'),_0x5e557c['id']);return getEndUser(_0x2eccbb,_0x3cab0f[_0x70ee('0x53')],_0x3cab0f['destcalleridnum']);})[_0x70ee('0x19')](function(_0x451a32){_0x3005da=_0x451a32;logger[_0x70ee('0xa')](_0x70ee('0x49'),_0x3005da['id']);return getTicket(_0x2eccbb,_0x5e557c,_0x3005da,_0x2d9ec0,_0x3cab0f);})[_0x70ee('0x19')](function(_0x5d3cba){if(_0x5d3cba&&_0x5d3cba['id']){logger[_0x70ee('0xa')](_0x70ee('0x54'));logger['info'](_0x70ee('0x4a'),_0x5d3cba['id']);logger['info'](_0x70ee('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x70ee('0x15')]('user:%s',_0x2ad924['name']),'trigger:browser:url',{'uri':util[_0x70ee('0x15')](_0x70ee('0x55'),_0x2eccbb[_0x70ee('0x17')],_0x5d3cba['id'])});}})[_0x70ee('0x4e')](function(_0x551d7c){logger[_0x70ee('0x56')](_0x70ee('0x52'),JSON[_0x70ee('0x2a')](_0x551d7c));});};exports['unmanaged']=function(_0x38dd6c,_0x4614d2,_0x46c4ea,_0x51f46e,_0x32f95f,_0x66b92c){var _0x54ebac,_0x1326a2;_0x66b92c[_0x70ee('0x17')]=intUtil[_0x70ee('0x41')](_0x66b92c[_0x70ee('0x17')]);_0x66b92c[_0x70ee('0x40')]=intUtil[_0x70ee('0x41')](_0x66b92c[_0x70ee('0x40')]);if(_0x32f95f&&_0x32f95f['monitor_format']){logger['info']('['+_0x4614d2[_0x70ee('0x57')][_0x70ee('0x58')]()+']',_0x70ee('0x43'));_0x4614d2[_0x70ee('0x59')]=util[_0x70ee('0x15')](_0x70ee('0x44'),_0x66b92c[_0x70ee('0x40')],_0x4614d2[_0x70ee('0x45')],md5(_0x4614d2[_0x70ee('0x45')]));}else{_0x4614d2[_0x70ee('0x59')]='';}headers[_0x70ee('0x46')]=getAuth(_0x66b92c);return getUser(_0x66b92c,'')[_0x70ee('0x19')](function(_0x3e10c3){_0x54ebac=_0x3e10c3;logger[_0x70ee('0xa')](_0x70ee('0x47'),_0x54ebac['id']);return getEndUser(_0x66b92c,_0x4614d2[_0x70ee('0x48')],_0x4614d2[_0x70ee('0xe')]);})[_0x70ee('0x19')](function(_0x2684c9){_0x1326a2=_0x2684c9;logger[_0x70ee('0xa')](_0x70ee('0x49'),_0x1326a2['id']);return getTicket(_0x66b92c,_0x54ebac,_0x1326a2,_0x46c4ea,_0x4614d2);})[_0x70ee('0x19')](function(_0x448709){if(_0x448709){logger['info'](_0x70ee('0x54'));logger['info'](_0x70ee('0x4a'),_0x448709['id']);}})[_0x70ee('0x4e')](function(_0x28a7ef){logger['error']('['+_0x4614d2[_0x70ee('0x57')][_0x70ee('0x58')]()+']',JSON[_0x70ee('0x2a')](_0x28a7ef));});}; \ 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 f95df59..9d25a11 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 _0x6eb8=['toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','error','/api/lookup?q=','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','then','endUserId','Contact\x20found\x20mobile_number:','work_number','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0x6eb8,0x148));var _0x86eb=function(_0x41358a,_0x322144){_0x41358a=_0x41358a-0x0;var _0x8c40ce=_0x6eb8[_0x41358a];return _0x8c40ce;};'use strict';var _=require(_0x86eb('0x0'));var rp=require(_0x86eb('0x1'));var md5=require(_0x86eb('0x2'));var util=require(_0x86eb('0x3'));var moment=require('moment');var Promise=require(_0x86eb('0x4'));var Redis=require('ioredis');var intUtil=require(_0x86eb('0x5'));var config=require('../../../../config/environment');var logger=require(_0x86eb('0x6'))(_0x86eb('0x7'));config[_0x86eb('0x8')]=_[_0x86eb('0x9')](config[_0x86eb('0x8')],{'host':_0x86eb('0xa'),'port':0x18eb});var io=require(_0x86eb('0xb'))(new Redis(config[_0x86eb('0x8')]));function getAdminId(_0x3db396,_0xf6e6e3,_0x23d2d3,_0x516ca7){return new Promise(function(_0x358142,_0x3ac4e2){var _0x17d29f=![];var _0x9fe622={'method':_0x86eb('0xc'),'uri':_0x516ca7+'/api/selector/owners','json':!![]};_0x9fe622[_0x86eb('0xd')]=_0x23d2d3;logger[_0x86eb('0xe')](_0x86eb('0xf'));return rp(_0x9fe622)['then'](function(_0x1510ac){if(_0x1510ac){var _0x5cfea1=_0x1510ac[_0x86eb('0x10')];var _0x21460a=null;for(_0x21460a=0x0;_0x21460a<_0x5cfea1[_0x86eb('0x11')];_0x21460a++){if(_0x5cfea1[_0x21460a][_0x86eb('0x12')]===_0x3db396[_0x86eb('0x13')]){_0x3db396[_0x86eb('0x14')]=_0x5cfea1[_0x21460a]['id'];_0x17d29f=!![];}}if(_0x17d29f){logger['info'](_0x86eb('0x15'),_0x3db396[_0x86eb('0x14')]);_0x358142(_0x3db396);}else{_0x3ac4e2({'statusCode':0x194,'message':_0x86eb('0x16')});}}else{_0x3ac4e2({'statusCode':0x194,'message':_0x86eb('0x16')});}})[_0x86eb('0x17')](function(_0x331d3a){logger['error']('['+[_0xf6e6e3[_0x86eb('0x18')]()]+']',_0x331d3a[_0x86eb('0x19')]);_0x3ac4e2(_0x331d3a);});});}function getUser(_0x574d83,_0x30bb4a,_0x261bba){return function(_0x22f733){return new Promise(function(_0x4f0ca5,_0x3fe4ce){var _0x5cd0a0={'method':_0x86eb('0xc'),'uri':_0x261bba+'/api/selector/owners','json':!![]};_0x5cd0a0[_0x86eb('0xd')]=_0x30bb4a;logger[_0x86eb('0xe')]('Getting\x20user\x20list');return rp(_0x5cd0a0)['then'](function(_0xfb0e7c){if(_0xfb0e7c){var _0x3ce614=_0xfb0e7c[_0x86eb('0x10')];var _0x28e7a1=![];var _0x3795f6=null;if(_0x22f733[_0x86eb('0x1a')]!==null){logger[_0x86eb('0xe')](_0x86eb('0x1b'),_0x22f733[_0x86eb('0x1a')]);_0x22f733['userEmail']=_0x22f733['agentEmail'];for(_0x3795f6=0x0;_0x3795f6<_0x3ce614['length'];_0x3795f6++){if(_0x3ce614[_0x3795f6][_0x86eb('0x12')]===_0x22f733['agentEmail']){_0x28e7a1=!![];_0x22f733[_0x86eb('0x1c')]=_0x3ce614[_0x3795f6]['id'];logger[_0x86eb('0xe')](_0x86eb('0x1d'),_0x22f733[_0x86eb('0x1c')]);}}}if(!_0x28e7a1){logger[_0x86eb('0xe')](_0x86eb('0x1e'));_0x22f733[_0x86eb('0x1f')]=_0x22f733[_0x86eb('0x13')];_0x22f733['userId']=_0x22f733[_0x86eb('0x14')];_0x28e7a1=!![];}if(_0x28e7a1){_0x4f0ca5(_0x22f733);}else{_0x3fe4ce({'statusCode':0x194,'message':_0x86eb('0x16')});}}else{_0x3fe4ce({'statusCode':0x194,'message':_0x86eb('0x16')});}})[_0x86eb('0x17')](function(_0x588dfc){logger[_0x86eb('0x20')]('['+[_0x574d83[_0x86eb('0x18')]()]+']',_0x588dfc[_0x86eb('0x19')]);_0x3fe4ce(_0x588dfc);});});};}function searchContact(_0x4e93aa,_0x9702f4,_0x1fe9f4,_0x430d0d){return new Promise(function(_0x483f71,_0x3462f1){var _0x4207b8={'method':'GET','headers':_0x9702f4,'uri':_0x4e93aa+_0x86eb('0x21')+_0x430d0d+_0x86eb('0x22')+_0x1fe9f4+'&entities=contact','json':!![]};rp(_0x4207b8)['then'](function(_0x2821f0){var _0x425ba4=_['find'](_0x2821f0[_0x86eb('0x23')][_0x86eb('0x23')],[_0x1fe9f4,_0x430d0d]);_0x483f71(_0x425ba4);})[_0x86eb('0x17')](function(_0x2b1d6c){_0x3462f1(_0x2b1d6c);});});}function getEndUser(_0x85849,_0x3e579d,_0x11cd7d){return function(_0x47a6c1){return new Promise(function(_0x16db31,_0x2b0d89){logger[_0x86eb('0xe')](util[_0x86eb('0x24')](_0x86eb('0x25'),_0x47a6c1['contactNumber']));searchContact(_0x11cd7d,_0x3e579d,_0x86eb('0x26'),_0x47a6c1['contactNumber'])[_0x86eb('0x27')](function(_0x1ce649){if(_0x1ce649){_0x47a6c1[_0x86eb('0x28')]=_0x1ce649['id'];logger[_0x86eb('0xe')](_0x86eb('0x29'),_0x47a6c1[_0x86eb('0x28')]);return _0x16db31(_0x47a6c1);}searchContact(_0x11cd7d,_0x3e579d,_0x86eb('0x2a'),_0x47a6c1[_0x86eb('0x2b')])[_0x86eb('0x27')](function(_0x33584b){if(_0x33584b){_0x47a6c1['endUserId']=_0x33584b['id'];logger[_0x86eb('0xe')](_0x86eb('0x2c'),_0x47a6c1[_0x86eb('0x28')]);return _0x16db31(_0x47a6c1);}createEndUser(_0x47a6c1,_0x85849,_0x3e579d,_0x11cd7d)[_0x86eb('0x27')](function(_0x5a0b72){logger['info'](_0x86eb('0x2d'),_0x5a0b72['endUserId']);return _0x16db31(_0x5a0b72);});});})[_0x86eb('0x17')](function(_0x59ebc7){_0x2b0d89(_0x59ebc7);});});};}function createEndUser(_0x3da510,_0x2a4d4,_0x4dceb7,_0x11cb01){return new Promise(function(_0x151d27,_0x59e601){var _0x365bd0=moment();var _0x112931={'method':_0x86eb('0x2e'),'uri':_0x11cb01+_0x86eb('0x2f'),'body':{'contact':{'last_name':_0x3da510[_0x86eb('0x2b')],'work_number':_0x3da510[_0x86eb('0x2b')],'mobile_number':_0x3da510['contactNumber'],'owner_id':_0x3da510[_0x86eb('0x1c')],'created_at':_0x365bd0[_0x86eb('0x24')](_0x86eb('0x30'))}},'json':!![]};_0x112931['headers']=_0x4dceb7;logger[_0x86eb('0xe')](_0x86eb('0x31'));return rp(_0x112931)[_0x86eb('0x27')](function(_0x2ae5cb){_0x3da510[_0x86eb('0x28')]=_0x2ae5cb[_0x86eb('0x32')]['id'];_0x151d27(_0x3da510);})[_0x86eb('0x17')](function(_0x1c8bf7){logger['error']('['+[_0x2a4d4[_0x86eb('0x18')]()]+']',_0x1c8bf7[_0x86eb('0x19')]);_0x59e601(_0x1c8bf7['message']);});});}function getTicket(_0x4d83f7,_0x383a9b,_0x526a32,_0x2ffee0,_0x5d8bd6){return function(_0x220a4c){logger['info'](_0x86eb('0x33'));return new Promise(function(_0x151f9d,_0x39f5be){var _0xba68c=moment();var _0x44dc08={'method':'POST','uri':_0x526a32+_0x86eb('0x34'),'body':{'title':intUtil[_0x86eb('0x35')](_0x2ffee0[_0x86eb('0x36')],_0x5d8bd6,'\x20'),'description':intUtil[_0x86eb('0x35')](_0x2ffee0['Descriptions'],_0x5d8bd6,'\x0a'),'owner_id':_0x220a4c['userId'],'creater_id':_0x220a4c[_0x86eb('0x14')],'targetable_id':_0x220a4c['endUserId'],'targetable_type':_0x86eb('0x37'),'created_at':_0xba68c[_0x86eb('0x24')](_0x86eb('0x30')),'due_date':_0xba68c[_0x86eb('0x38')](0x1e,'m')[_0x86eb('0x24')](_0x86eb('0x30'))},'json':!![]};_0x44dc08['headers']=_0x383a9b;return rp(_0x44dc08)[_0x86eb('0x27')](function(_0x43f105){_0x220a4c['ticketId']=_0x43f105[_0x86eb('0x39')]['id'];logger['info'](_0x86eb('0x3a'),_0x220a4c[_0x86eb('0x3b')]);_0x151f9d(_0x220a4c);})[_0x86eb('0x17')](function(_0x11af68){logger['error']('['+[_0x4d83f7[_0x86eb('0x18')]()]+']',_0x11af68[_0x86eb('0x19')]);_0x39f5be(_0x11af68[_0x86eb('0x19')]);});});};}function emit(_0x50560a,_0x48164d,_0xad7eff){var _0x3c50f2={'uri':_0x50560a+'/contacts/'+_0xad7eff};io['to'](util[_0x86eb('0x24')](_0x86eb('0x3c'),_0x48164d))[_0x86eb('0x3d')](_0x86eb('0x3e'),_0x3c50f2);}exports['cs']=function(_0x1d8a08,_0x1eeea6,_0x5cebf9,_0x4a964d,_0x348798,_0x4474f9,_0x6d84bc,_0x50871f){var _0x385a7f={};var _0x477dbc={'Authorization':_0x86eb('0x3f')+_0x4474f9[_0x86eb('0x40')]};_0x4474f9[_0x86eb('0x41')]=intUtil[_0x86eb('0x42')](_0x4474f9[_0x86eb('0x41')]);_0x4474f9[_0x86eb('0x43')]=intUtil['stripTrailingSlash'](_0x4474f9[_0x86eb('0x43')]);var _0x99f2f5=_0x4474f9[_0x86eb('0x41')];_0x385a7f['adminEmail']=_0x4474f9['username'];_0x385a7f['contactNumber']=_0x50871f[_0x86eb('0x44')]()===_0x86eb('0x45')?_0x1eeea6['destcalleridnum']:_0x1eeea6[_0x86eb('0x46')];_0x385a7f[_0x86eb('0x47')]=_0x50871f===_0x86eb('0x48')||_0x50871f===_0x86eb('0x49')?_0x86eb('0x48'):_0x86eb('0x45');if(_0x4a964d){_0x385a7f[_0x86eb('0x1a')]=_0x4a964d[_0x86eb('0x12')];}var _0x3df99a=util['format'](_0x86eb('0x4a'),_0x4474f9[_0x86eb('0x43')],_0x1eeea6[_0x86eb('0x4b')],md5(_0x1eeea6[_0x86eb('0x4b')]));if(_0x348798&&_0x348798[_0x86eb('0x4c')]){logger[_0x86eb('0xe')](_0x86eb('0x4d'),_0x86eb('0x4e'));_0x1eeea6[_0x86eb('0x4f')]=_0x3df99a;}else if(_0x6d84bc&&_0x6d84bc[_0x86eb('0x50')]&&_0x6d84bc[_0x86eb('0x50')]!==_0x86eb('0x51')){logger[_0x86eb('0xe')](_0x86eb('0x52'),_0x86eb('0x4e'));_0x1eeea6[_0x86eb('0x4f')]=_0x3df99a;}else{_0x1eeea6[_0x86eb('0x4f')]='';}return getAdminId(_0x385a7f,_0x50871f,_0x477dbc,_0x99f2f5)[_0x86eb('0x27')](getUser(_0x50871f,_0x477dbc,_0x99f2f5))['then'](getEndUser(_0x50871f,_0x477dbc,_0x99f2f5))['then'](getTicket(_0x50871f,_0x477dbc,_0x99f2f5,_0x5cebf9,_0x1eeea6))[_0x86eb('0x27')](function(_0xd7e308){logger['info'](util[_0x86eb('0x24')](_0x86eb('0x53'),_0xd7e308[_0x86eb('0x3b')]));if(_0x50871f!==_0x86eb('0x49')){logger[_0x86eb('0xe')]('['+[_0x50871f[_0x86eb('0x18')]()]+']',_0x86eb('0x54'));emit(_0x99f2f5,_0x4a964d[_0x86eb('0x55')],_0xd7e308[_0x86eb('0x28')]);}})[_0x86eb('0x17')](function(_0x52ae19){logger[_0x86eb('0x20')]('['+[_0x50871f[_0x86eb('0x18')]()]+_0x86eb('0x56'),util[_0x86eb('0x57')](_0x52ae19,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x625b=['queue','outbound','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','User\x20found:','userId','catch','GET','/api/lookup?q=','&f=','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error','Creating\x20new\x20task','/api/tasks','Subjects','add','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','destcalleridnum','calleridnum','callDirection'];(function(_0x17ea64,_0x48aac3){var _0x373f9f=function(_0x4488c5){while(--_0x4488c5){_0x17ea64['push'](_0x17ea64['shift']());}};_0x373f9f(++_0x48aac3);}(_0x625b,0xf8));var _0xb625=function(_0x4d6338,_0x2b44bb){_0x4d6338=_0x4d6338-0x0;var _0xbb9b7c=_0x625b[_0x4d6338];return _0xbb9b7c;};'use strict';var _=require(_0xb625('0x0'));var rp=require('request-promise');var md5=require(_0xb625('0x1'));var util=require(_0xb625('0x2'));var moment=require(_0xb625('0x3'));var Promise=require(_0xb625('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb625('0x5'))('freshsales');config[_0xb625('0x6')]=_[_0xb625('0x7')](config[_0xb625('0x6')],{'host':_0xb625('0x8'),'port':0x18eb});var io=require(_0xb625('0x9'))(new Redis(config[_0xb625('0x6')]));function getAdminId(_0x160e34,_0x34fbd0,_0x8a17eb,_0x1c8d04){return new Promise(function(_0x85c781,_0x1eefd9){var _0x56757a=![];var _0x592ee3={'method':'GET','uri':_0x1c8d04+_0xb625('0xa'),'json':!![]};_0x592ee3['headers']=_0x8a17eb;logger['info'](_0xb625('0xb'));return rp(_0x592ee3)[_0xb625('0xc')](function(_0x54def2){if(_0x54def2){var _0x2631f0=_0x54def2[_0xb625('0xd')];var _0x2d0287=null;for(_0x2d0287=0x0;_0x2d0287<_0x2631f0['length'];_0x2d0287++){if(_0x2631f0[_0x2d0287][_0xb625('0xe')]===_0x160e34[_0xb625('0xf')]){_0x160e34[_0xb625('0x10')]=_0x2631f0[_0x2d0287]['id'];_0x56757a=!![];}}if(_0x56757a){logger[_0xb625('0x11')](_0xb625('0x12'),_0x160e34[_0xb625('0x10')]);_0x85c781(_0x160e34);}else{_0x1eefd9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1eefd9({'statusCode':0x194,'message':_0xb625('0x13')});}})['catch'](function(_0x14ae5f){logger['error']('['+[_0x34fbd0[_0xb625('0x14')]()]+']',_0x14ae5f[_0xb625('0x15')]);_0x1eefd9(_0x14ae5f);});});}function getUser(_0x5bf47a,_0x4e965d,_0x146b65){return function(_0x4fcb3c){return new Promise(function(_0x16c153,_0x209a6c){var _0x2268cf={'method':'GET','uri':_0x146b65+_0xb625('0xa'),'json':!![]};_0x2268cf['headers']=_0x4e965d;logger[_0xb625('0x11')](_0xb625('0x16'));return rp(_0x2268cf)[_0xb625('0xc')](function(_0x5ea122){if(_0x5ea122){var _0x39dd07=_0x5ea122[_0xb625('0xd')];var _0x469552=![];var _0x11e5a1=null;if(_0x4fcb3c[_0xb625('0x17')]!==null){logger[_0xb625('0x11')](_0xb625('0x18'),_0x4fcb3c[_0xb625('0x17')]);_0x4fcb3c[_0xb625('0x19')]=_0x4fcb3c[_0xb625('0x17')];for(_0x11e5a1=0x0;_0x11e5a1<_0x39dd07[_0xb625('0x1a')];_0x11e5a1++){if(_0x39dd07[_0x11e5a1][_0xb625('0xe')]===_0x4fcb3c[_0xb625('0x17')]){_0x469552=!![];_0x4fcb3c['userId']=_0x39dd07[_0x11e5a1]['id'];logger[_0xb625('0x11')](_0xb625('0x1b'),_0x4fcb3c['userId']);}}}if(!_0x469552){logger['info']('Admin\x20selected');_0x4fcb3c[_0xb625('0x19')]=_0x4fcb3c[_0xb625('0xf')];_0x4fcb3c[_0xb625('0x1c')]=_0x4fcb3c[_0xb625('0x10')];_0x469552=!![];}if(_0x469552){_0x16c153(_0x4fcb3c);}else{_0x209a6c({'statusCode':0x194,'message':_0xb625('0x13')});}}else{_0x209a6c({'statusCode':0x194,'message':_0xb625('0x13')});}})[_0xb625('0x1d')](function(_0x4c027a){logger['error']('['+[_0x5bf47a['toUpperCase']()]+']',_0x4c027a[_0xb625('0x15')]);_0x209a6c(_0x4c027a);});});};}function searchContact(_0xac2080,_0x4e68f4,_0x45ae69,_0x3444d0){return new Promise(function(_0x32197b,_0x3925f9){var _0x1a07b5={'method':_0xb625('0x1e'),'headers':_0x4e68f4,'uri':_0xac2080+_0xb625('0x1f')+_0x3444d0+_0xb625('0x20')+_0x45ae69+'&entities=contact','json':!![]};rp(_0x1a07b5)[_0xb625('0xc')](function(_0x2aa5a0){var _0x1cb2d8=_['find'](_0x2aa5a0[_0xb625('0x21')]['contacts'],[_0x45ae69,_0x3444d0]);_0x32197b(_0x1cb2d8);})['catch'](function(_0x820cfe){_0x3925f9(_0x820cfe);});});}function getEndUser(_0x4559ce,_0x400080,_0x33f577){return function(_0xf82a09){return new Promise(function(_0x44c57c,_0x508d16){logger[_0xb625('0x11')](util['format'](_0xb625('0x22'),_0xf82a09[_0xb625('0x23')]));searchContact(_0x33f577,_0x400080,_0xb625('0x24'),_0xf82a09[_0xb625('0x23')])[_0xb625('0xc')](function(_0x251837){if(_0x251837){_0xf82a09[_0xb625('0x25')]=_0x251837['id'];logger['info']('Contact\x20found\x20mobile_number:',_0xf82a09[_0xb625('0x25')]);return _0x44c57c(_0xf82a09);}searchContact(_0x33f577,_0x400080,'work_number',_0xf82a09[_0xb625('0x23')])[_0xb625('0xc')](function(_0x155cf2){if(_0x155cf2){_0xf82a09[_0xb625('0x25')]=_0x155cf2['id'];logger[_0xb625('0x11')]('Contact\x20found\x20work_number:',_0xf82a09[_0xb625('0x25')]);return _0x44c57c(_0xf82a09);}createEndUser(_0xf82a09,_0x4559ce,_0x400080,_0x33f577)['then'](function(_0x33a9ba){logger[_0xb625('0x11')](_0xb625('0x26'),_0x33a9ba[_0xb625('0x25')]);return _0x44c57c(_0x33a9ba);});});})['catch'](function(_0x531052){_0x508d16(_0x531052);});});};}function createEndUser(_0x441e83,_0x4344eb,_0x47a429,_0x36eb7c){return new Promise(function(_0x2f8994,_0x328685){var _0x445932=moment();var _0x1925b1={'method':_0xb625('0x27'),'uri':_0x36eb7c+_0xb625('0x28'),'body':{'contact':{'last_name':_0x441e83[_0xb625('0x23')],'work_number':_0x441e83[_0xb625('0x23')],'mobile_number':_0x441e83[_0xb625('0x23')],'owner_id':_0x441e83['userId'],'created_at':_0x445932[_0xb625('0x29')](_0xb625('0x2a'))}},'json':!![]};_0x1925b1[_0xb625('0x2b')]=_0x47a429;logger[_0xb625('0x11')](_0xb625('0x2c'));return rp(_0x1925b1)[_0xb625('0xc')](function(_0x59e637){_0x441e83['endUserId']=_0x59e637[_0xb625('0x2d')]['id'];_0x2f8994(_0x441e83);})[_0xb625('0x1d')](function(_0x3f9127){logger[_0xb625('0x2e')]('['+[_0x4344eb[_0xb625('0x14')]()]+']',_0x3f9127[_0xb625('0x15')]);_0x328685(_0x3f9127['message']);});});}function getTicket(_0x31df58,_0x4442bc,_0x324318,_0x598a61,_0x549fbe){return function(_0xb1646d){logger['info'](_0xb625('0x2f'));return new Promise(function(_0x27e415,_0x109d48){var _0x1c353b=moment();var _0x151630={'method':_0xb625('0x27'),'uri':_0x324318+_0xb625('0x30'),'body':{'title':intUtil['getString'](_0x598a61[_0xb625('0x31')],_0x549fbe,'\x20'),'description':intUtil['getString'](_0x598a61['Descriptions'],_0x549fbe,'\x0a'),'owner_id':_0xb1646d[_0xb625('0x1c')],'creater_id':_0xb1646d['adminId'],'targetable_id':_0xb1646d[_0xb625('0x25')],'targetable_type':'Contact','created_at':_0x1c353b[_0xb625('0x29')](_0xb625('0x2a')),'due_date':_0x1c353b[_0xb625('0x32')](0x1e,'m')['format'](_0xb625('0x2a'))},'json':!![]};_0x151630[_0xb625('0x2b')]=_0x4442bc;return rp(_0x151630)[_0xb625('0xc')](function(_0xe88be6){_0xb1646d['ticketId']=_0xe88be6['task']['id'];logger[_0xb625('0x11')](_0xb625('0x33'),_0xb1646d['ticketId']);_0x27e415(_0xb1646d);})[_0xb625('0x1d')](function(_0x5fb910){logger['error']('['+[_0x31df58[_0xb625('0x14')]()]+']',_0x5fb910[_0xb625('0x15')]);_0x109d48(_0x5fb910[_0xb625('0x15')]);});});};}function emit(_0x41fc5e,_0x531eb1,_0x59b33d){var _0x2fbf7e={'uri':_0x41fc5e+_0xb625('0x34')+_0x59b33d};io['to'](util[_0xb625('0x29')]('user:%s',_0x531eb1))[_0xb625('0x35')](_0xb625('0x36'),_0x2fbf7e);}exports['cs']=function(_0xaaa5a6,_0x1ff66a,_0x107cf6,_0x36447b,_0x52ff47,_0x5325ba,_0x330ba9,_0x44d0c9){var _0x1a78e2={};var _0xef18db={'Authorization':_0xb625('0x37')+_0x5325ba[_0xb625('0x38')]};_0x5325ba[_0xb625('0x39')]=intUtil[_0xb625('0x3a')](_0x5325ba[_0xb625('0x39')]);_0x5325ba['serverUrl']=intUtil[_0xb625('0x3a')](_0x5325ba[_0xb625('0x3b')]);var _0x5acddf=_0x5325ba[_0xb625('0x39')];_0x1a78e2[_0xb625('0xf')]=_0x5325ba[_0xb625('0x3c')];_0x1a78e2[_0xb625('0x23')]=_0x44d0c9['toLowerCase']()==='outbound'?_0x1ff66a[_0xb625('0x3d')]:_0x1ff66a[_0xb625('0x3e')];_0x1a78e2[_0xb625('0x3f')]=_0x44d0c9===_0xb625('0x40')||_0x44d0c9==='unmanaged'?'queue':_0xb625('0x41');if(_0x36447b){_0x1a78e2[_0xb625('0x17')]=_0x36447b['email'];}var _0x92a7dc=util[_0xb625('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5325ba[_0xb625('0x3b')],_0x1ff66a['uniqueid'],md5(_0x1ff66a[_0xb625('0x42')]));if(_0x52ff47&&_0x52ff47['monitor_format']){logger[_0xb625('0x11')](_0xb625('0x43'),_0xb625('0x44'));_0x1ff66a[_0xb625('0x45')]=_0x92a7dc;}else if(_0x330ba9&&_0x330ba9[_0xb625('0x46')]&&_0x330ba9[_0xb625('0x46')]!==_0xb625('0x47')){logger[_0xb625('0x11')]('[OUTBOUND]',_0xb625('0x44'));_0x1ff66a[_0xb625('0x45')]=_0x92a7dc;}else{_0x1ff66a[_0xb625('0x45')]='';}return getAdminId(_0x1a78e2,_0x44d0c9,_0xef18db,_0x5acddf)[_0xb625('0xc')](getUser(_0x44d0c9,_0xef18db,_0x5acddf))[_0xb625('0xc')](getEndUser(_0x44d0c9,_0xef18db,_0x5acddf))[_0xb625('0xc')](getTicket(_0x44d0c9,_0xef18db,_0x5acddf,_0x107cf6,_0x1ff66a))[_0xb625('0xc')](function(_0x3d13ea){logger[_0xb625('0x11')](util[_0xb625('0x29')](_0xb625('0x48'),_0x3d13ea['ticketId']));if(_0x44d0c9!==_0xb625('0x49')){logger['info']('['+[_0x44d0c9[_0xb625('0x14')]()]+']',_0xb625('0x4a'));emit(_0x5acddf,_0x36447b[_0xb625('0x4b')],_0x3d13ea[_0xb625('0x25')]);}})[_0xb625('0x1d')](function(_0x187c1e){logger[_0xb625('0x2e')]('['+[_0x44d0c9[_0xb625('0x14')]()]+_0xb625('0x4c'),util[_0xb625('0x4d')](_0x187c1e,{'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 2950b92..1789801 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 _0x7cee=['sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce'];(function(_0x529bce,_0x9f1c4c){var _0x46920c=function(_0x24c213){while(--_0x24c213){_0x529bce['push'](_0x529bce['shift']());}};_0x46920c(++_0x9f1c4c);}(_0x7cee,0x15b));var _0xe7ce=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x7cee[_0x29c3b2];return _0x4b3aa7;};'use strict';var _=require(_0xe7ce('0x0'));var util=require(_0xe7ce('0x1'));var zendesk=require(_0xe7ce('0x2'));var salesforce=require(_0xe7ce('0x3'));var sugarcrm=require(_0xe7ce('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xe7ce('0x5'));var desk=require(_0xe7ce('0x6'));var vtiger=require(_0xe7ce('0x7'));var servicenow=require(_0xe7ce('0x8'));var dynamics365=require(_0xe7ce('0x9'));var freshsales=require(_0xe7ce('0xa'));var integrations=[_0xe7ce('0xb'),_0xe7ce('0xc'),_0xe7ce('0xd'),_0xe7ce('0xe'),_0xe7ce('0xf'),_0xe7ce('0x10'),_0xe7ce('0x11'),'dynamics365',_0xe7ce('0x12'),_0xe7ce('0x13')];exports[_0xe7ce('0x14')]=function(_0x1a0c89,_0x42a089,_0x1be863,_0x4ddc59,_0x55f4f6,_0x1daecb){if(_0x1be863){if(_[_0xe7ce('0x15')](integrations,_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')]())){try{var _0xdaba4f=null;var _0x72c206='';var _0xdfc19d=_0x1be863[_0x1a0c89['data1'][_0xe7ce('0x17')]()];if(_0xdfc19d){var _0x5d39f0=_0xdfc19d[_0x1a0c89['data2']];if(_0x5d39f0){var _0x3782c4=_[_0xe7ce('0x18')](_0x5d39f0[_0xe7ce('0x19')],{'id':parseInt(_0x1a0c89[_0xe7ce('0x1a')],0xa)});if(_0x3782c4){if(_0x4ddc59){if(_0x55f4f6&&_0x42a089[_0xe7ce('0x1b')]){_0x72c206=_0xe7ce('0x1b');}else if(_0x42a089[_0xe7ce('0x1c')]){_0x72c206='outbound';}else{console['log'](_0xe7ce('0x1d'),_0x42a089);}}else{_0x72c206=_0xe7ce('0x1e');}switch(_0x1a0c89['data1'][_0xe7ce('0x17')]()){case _0xe7ce('0xb'):zendesk[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0xc'):salesforce[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0xd'):sugarcrm[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case'freshdesk':freshdesk[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0xf'):zoho[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0x10'):desk[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0x11'):vtiger[_0x72c206](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb);break;case _0xe7ce('0x12'):freshsales['cs'](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb,_0x72c206);break;case'servicenow':servicenow['cs'](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb,_0x72c206);break;case'dynamics365':dynamics365['cs'](_0x1a0c89,_0x42a089,_0x3782c4,_0x4ddc59,_0x55f4f6,_0x5d39f0,_0x1daecb,_0x72c206);break;default:console['log'](_0xe7ce('0x1f'));}}else{_0xdaba4f=require(_0xe7ce('0x20'))(_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')]());_0xdaba4f[_0xe7ce('0x21')]('[EXEC]',util[_0xe7ce('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')](),_0x1a0c89[_0xe7ce('0x1a')]));}}else{_0xdaba4f=require(_0xe7ce('0x20'))(_0x1a0c89['data1']['toLowerCase']());_0xdaba4f['error'](_0xe7ce('0x23'),util[_0xe7ce('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x1a0c89[_0xe7ce('0x16')][_0xe7ce('0x17')](),_0x1a0c89['data2']));}}else{}}catch(_0x549a4a){console['error'](_0x549a4a);}}}}; \ No newline at end of file +var _0xef99=['servicenow','dynamics365','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','exec','includes','data1','toLowerCase','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN'];(function(_0x5da452,_0xd79045){var _0x32d260=function(_0x5ada46){while(--_0x5ada46){_0x5da452['push'](_0x5da452['shift']());}};_0x32d260(++_0xd79045);}(_0xef99,0xc7));var _0x9ef9=function(_0xfb0cf9,_0x46f937){_0xfb0cf9=_0xfb0cf9-0x0;var _0x2e5994=_0xef99[_0xfb0cf9];return _0x2e5994;};'use strict';var _=require(_0x9ef9('0x0'));var util=require(_0x9ef9('0x1'));var zendesk=require(_0x9ef9('0x2'));var salesforce=require(_0x9ef9('0x3'));var sugarcrm=require(_0x9ef9('0x4'));var freshdesk=require(_0x9ef9('0x5'));var zoho=require('./zoho');var desk=require(_0x9ef9('0x6'));var vtiger=require(_0x9ef9('0x7'));var servicenow=require(_0x9ef9('0x8'));var dynamics365=require(_0x9ef9('0x9'));var freshsales=require(_0x9ef9('0xa'));var integrations=[_0x9ef9('0xb'),_0x9ef9('0xc'),_0x9ef9('0xd'),_0x9ef9('0xe'),_0x9ef9('0xf'),_0x9ef9('0x10'),_0x9ef9('0x11'),'dynamics365',_0x9ef9('0x12'),'servicenow'];exports[_0x9ef9('0x13')]=function(_0xd178b6,_0x3824c6,_0x3f2b9f,_0xea9398,_0x320649,_0x4f874f){if(_0x3f2b9f){if(_[_0x9ef9('0x14')](integrations,_0xd178b6[_0x9ef9('0x15')][_0x9ef9('0x16')]())){try{var _0x2e71ca=null;var _0x2c27c7='';var _0x486d26=_0x3f2b9f[_0xd178b6['data1'][_0x9ef9('0x16')]()];if(_0x486d26){var _0x17ddf1=_0x486d26[_0xd178b6['data2']];if(_0x17ddf1){var _0x22af24=_['find'](_0x17ddf1[_0x9ef9('0x17')],{'id':parseInt(_0xd178b6['data3'],0xa)});if(_0x22af24){if(_0xea9398){if(_0x320649&&_0x3824c6[_0x9ef9('0x18')]){_0x2c27c7=_0x9ef9('0x18');}else if(_0x3824c6[_0x9ef9('0x19')]){_0x2c27c7=_0x9ef9('0x1a');}else{console[_0x9ef9('0x1b')](_0x9ef9('0x1c'),_0x3824c6);}}else{_0x2c27c7='unmanaged';}switch(_0xd178b6['data1']['toLowerCase']()){case'zendesk':zendesk[_0x2c27c7](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f);break;case _0x9ef9('0xc'):salesforce[_0x2c27c7](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f);break;case _0x9ef9('0xd'):sugarcrm[_0x2c27c7](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f);break;case _0x9ef9('0xe'):freshdesk[_0x2c27c7](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f);break;case'zoho':zoho[_0x2c27c7](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f);break;case _0x9ef9('0x10'):desk[_0x2c27c7](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f);break;case _0x9ef9('0x11'):vtiger[_0x2c27c7](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f);break;case _0x9ef9('0x12'):freshsales['cs'](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f,_0x2c27c7);break;case _0x9ef9('0x1d'):servicenow['cs'](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f,_0x2c27c7);break;case _0x9ef9('0x1e'):dynamics365['cs'](_0xd178b6,_0x3824c6,_0x22af24,_0xea9398,_0x320649,_0x17ddf1,_0x4f874f,_0x2c27c7);break;default:console['log']('unknown\x20integration');}}else{_0x2e71ca=require(_0x9ef9('0x1f'))(_0xd178b6[_0x9ef9('0x15')]['toLowerCase']());_0x2e71ca[_0x9ef9('0x20')](_0x9ef9('0x21'),util[_0x9ef9('0x22')](_0x9ef9('0x23'),_0xd178b6[_0x9ef9('0x15')]['toLowerCase'](),_0xd178b6[_0x9ef9('0x24')]));}}else{_0x2e71ca=require(_0x9ef9('0x1f'))(_0xd178b6[_0x9ef9('0x15')][_0x9ef9('0x16')]());_0x2e71ca[_0x9ef9('0x20')]('[EXEC]',util[_0x9ef9('0x22')](_0x9ef9('0x25'),_0xd178b6['data1'][_0x9ef9('0x16')](),_0xd178b6['data2']));}}else{}}catch(_0x394725){console[_0x9ef9('0x20')](_0x394725);}}}}; \ 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 2659686..83f1677 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 _0xea9b=['Contact','Lead','first','Name','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','Company','No\x20Company','','upperFirst','create','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','sobject','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','additionalSearchContact','merge','$or','length','cloneDeep','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xea9b,0xd4));var _0xbea9=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0xea9b[_0x5300b6];return _0x58980e;};'use strict';var _=require(_0xbea9('0x0'));var rp=require(_0xbea9('0x1'));var moment=require(_0xbea9('0x2'));var BPromise=require(_0xbea9('0x3'));var md5=require('md5');var jsforce=require(_0xbea9('0x4'));var util=require(_0xbea9('0x5'));var Redis=require(_0xbea9('0x6'));var intUtil=require(_0xbea9('0x7'));var config=require(_0xbea9('0x8'));var logger=require(_0xbea9('0x9'))(_0xbea9('0xa'));config[_0xbea9('0xb')]=_[_0xbea9('0xc')](config['redis'],{'host':_0xbea9('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbea9('0xb')]));function emit(_0x52ff40,_0x419da9,_0x3d0fa6){io['to'](_0x52ff40)[_0xbea9('0xe')](_0x419da9,_0x3d0fa6);}function getTicket(_0xfa7dbe,_0x666743,_0x1c6b84,_0x5e9a89,_0x1cfc7c,_0x4d4abd,_0x4b524f,_0xccbc2b){var _0x570f3e=Object[_0xbea9('0xf')]({},{'OwnerId':_0x666743['id'],'Subject':intUtil[_0xbea9('0x10')](_0x5e9a89[_0xbea9('0x11')],_0x1cfc7c,'\x20'),'Description':intUtil['getString'](_0x5e9a89[_0xbea9('0x12')],_0x1cfc7c,'\x0a')},getCustomFields(_0x4d4abd,_0x1cfc7c));if(_0x1c6b84){if(_0x5e9a89[_0xbea9('0x13')]==='Task'){_0x570f3e[_0xbea9('0x14')]=moment[_0xbea9('0x15')]();_0x570f3e['IsReminderSet']=![];_0x570f3e[_0xbea9('0x16')]=![];if(_0x1c6b84[_0xbea9('0x17')]===_0xbea9('0x18')||_0x1c6b84['endUserType']==='lead'){_0x570f3e[_0xbea9('0x19')]=_0x1c6b84['id'];}else if(_0x1c6b84['endUserType']===_0xbea9('0x1a')){_0x570f3e[_0xbea9('0x1b')]=_0x1c6b84['id'];}}else if(_0x5e9a89[_0xbea9('0x13')]===_0xbea9('0x1c')){if(_0x1c6b84['endUserType']===_0xbea9('0x18')){_0x570f3e[_0xbea9('0x1d')]=_0x1c6b84['id'];}else if(_0x1c6b84[_0xbea9('0x17')]===_0xbea9('0x1a')){_0x570f3e[_0xbea9('0x1e')]=_0x1c6b84['id'];}else if(_0x1c6b84[_0xbea9('0x17')]===_0xbea9('0x1f')&&_0x5e9a89[_0xbea9('0x20')]){_0x570f3e[_0x5e9a89[_0xbea9('0x20')]]=_0x1c6b84['id'];}else{logger[_0xbea9('0x21')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4b524f[_0xbea9('0x22')](_0x5e9a89[_0xbea9('0x13')])['create'](_0x570f3e);}function getUser(_0x2e090c,_0x5f04ac,_0x2d0f7a){if(!_['isNil'](_0x5f04ac)&&intUtil[_0xbea9('0x23')](_0x5f04ac)){var _0x480418={'Email':_0x5f04ac};var _0x46f7ea={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2d0f7a['sobject'](_0xbea9('0x24'))[_0xbea9('0x25')](_0x480418,_0x46f7ea)[_0xbea9('0x26')]()['then'](function(_0x56914b){if(_0x56914b['length']){var _0x282263=_['find'](_0x56914b,function(_0x22aee4){return _0x22aee4[_0xbea9('0x27')]===_0x5f04ac;});if(_0x282263){logger[_0xbea9('0x21')](_0xbea9('0x28'),_0x5f04ac);return BPromise[_0xbea9('0x29')]({'id':_0x282263['Id'],'name':_0x282263['Name']});}}else{logger['info'](_0xbea9('0x2a'),_0x5f04ac);return _0x2d0f7a[_0xbea9('0x2b')]()[_0xbea9('0x2c')](function(_0x4e3101){return BPromise[_0xbea9('0x29')]({'id':_0x4e3101[_0xbea9('0x2d')],'name':_0x4e3101[_0xbea9('0x2e')]});});}});}else{logger['info'](_0xbea9('0x2a'),_0x5f04ac);return _0x2d0f7a['identity']()['then'](function(_0x2488c0){return BPromise[_0xbea9('0x29')]({'id':_0x2488c0[_0xbea9('0x2d')],'name':_0x2488c0[_0xbea9('0x2e')]});});}}function getEndUser(_0x105c88,_0x3b1fc8,_0x4896c9,_0x6108b2,_0x42eece){var _0x37872c={'$or':{'Phone':_0x6108b2}};var _0x314953={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbea9('0x29')]()['then'](function(){logger[_0xbea9('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x6108b2,_0x3b1fc8['moduleSearch']);switch(_0x3b1fc8['moduleSearch']){case'contact_lead':var _0x309217=_['cloneDeep'](_0x37872c);if(_0x3b1fc8[_0xbea9('0x2f')]){var _0x58b787={};_0x58b787[_0x3b1fc8[_0xbea9('0x2f')]]=_0x6108b2;_[_0xbea9('0x30')](_0x309217[_0xbea9('0x31')],_0x58b787);}return _0x42eece['sobject']('Contact')[_0xbea9('0x25')](_0x309217,_0x314953)[_0xbea9('0x26')]()[_0xbea9('0x2c')](function(_0x4cc36f){if(_0x4cc36f&&_0x4cc36f[_0xbea9('0x32')]){return _0x4cc36f;}else{var _0x555445=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8['additionalSearchLead']){var _0x8adb6d={};_0x8adb6d[_0x3b1fc8[_0xbea9('0x34')]]=_0x6108b2;_['merge'](_0x555445['$or'],_0x8adb6d);}return _0x42eece[_0xbea9('0x22')]('Lead')[_0xbea9('0x25')](_0x555445,_0x314953);}});case _0xbea9('0x35'):var _0x2587fd=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x36')]){var _0x58b787={};_0x58b787[_0x3b1fc8['additionalSearchAccount']]=_0x6108b2;_[_0xbea9('0x30')](_0x2587fd[_0xbea9('0x31')],_0x58b787);}return _0x42eece[_0xbea9('0x22')](_0xbea9('0x37'))['find'](_0x2587fd,_0x314953)[_0xbea9('0x26')]()['then'](function(_0x19d1a8){if(_0x19d1a8&&_0x19d1a8[_0xbea9('0x32')]){return _0x19d1a8;}else{var _0x3a4a9b=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8['additionalSearchContact']){var _0x315cb0={};_0x315cb0[_0x3b1fc8['additionalSearchContact']]=_0x6108b2;_[_0xbea9('0x30')](_0x3a4a9b[_0xbea9('0x31')],_0x315cb0);}return _0x42eece['sobject'](_0xbea9('0x38'))[_0xbea9('0x25')](_0x3a4a9b,_0x314953)[_0xbea9('0x2c')](function(_0x370a30){if(_0x370a30&&_0x370a30[_0xbea9('0x32')]){return _0x370a30;}else{var _0x70de1=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x34')]){var _0x4ab968={};_0x4ab968[_0x3b1fc8['additionalSearchLead']]=_0x6108b2;_['merge'](_0x70de1['$or'],_0x4ab968);}return _0x42eece[_0xbea9('0x22')]('Lead')[_0xbea9('0x25')](_0x70de1,_0x314953);}});}});case _0xbea9('0x18'):var _0x309217=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x2f')]){var _0x58b787={};_0x58b787[_0x3b1fc8['additionalSearchContact']]=_0x6108b2;_[_0xbea9('0x30')](_0x309217['$or'],_0x58b787);}return _0x42eece[_0xbea9('0x22')]('Contact')[_0xbea9('0x25')](_0x309217,_0x314953)[_0xbea9('0x26')]();case _0xbea9('0x1f'):var _0x9109ce=_['cloneDeep'](_0x37872c);if(_0x3b1fc8['additionalSearchLead']){var _0x58b787={};_0x58b787[_0x3b1fc8[_0xbea9('0x34')]]=_0x6108b2;_[_0xbea9('0x30')](_0x9109ce['$or'],_0x58b787);}return _0x42eece['sobject'](_0xbea9('0x39'))[_0xbea9('0x25')](_0x9109ce,_0x314953);case'account':var _0x2587fd=_[_0xbea9('0x33')](_0x37872c);if(_0x3b1fc8[_0xbea9('0x36')]){var _0x58b787={};_0x58b787[_0x3b1fc8[_0xbea9('0x36')]]=_0x6108b2;_['merge'](_0x2587fd[_0xbea9('0x31')],_0x58b787);}return _0x42eece[_0xbea9('0x22')]('Account')[_0xbea9('0x25')](_0x2587fd,_0x314953);default:return null;}})['then'](function(_0x4602f3){if(_0x4602f3&&_0x4602f3[_0xbea9('0x32')]){var _0x4f2c52=_[_0xbea9('0x3a')](_0x4602f3);if(_0x4f2c52){return BPromise['resolve']({'id':_0x4f2c52['Id'],'name':_0x4f2c52[_0xbea9('0x3b')],'phone':_0x4f2c52[_0xbea9('0x3c')],'endUserType':_0x4f2c52[_0xbea9('0x3d')][_0xbea9('0x3e')][_0xbea9('0x3f')]()});}}})[_0xbea9('0x2c')](function(_0x136dee){if(_0x136dee){logger['info'](_0xbea9('0x40'),_0x136dee[_0xbea9('0x17')],_0x6108b2);return BPromise['resolve'](_0x136dee);}else{logger[_0xbea9('0x21')](_0xbea9('0x41'),_0x6108b2);var _0xd0cb4f={'Phone':_0x6108b2};if(_0x3b1fc8[_0xbea9('0x42')]){if(_0x3b1fc8[_0xbea9('0x42')]===_0xbea9('0x18')){logger[_0xbea9('0x21')](_0xbea9('0x43'),_0x6108b2,_0x3b1fc8['moduleCreate']);_0xd0cb4f[_0xbea9('0x44')]=_0x4896c9!==''?_0x4896c9:util[_0xbea9('0x45')](_0xbea9('0x46'),_0x6108b2);}else if(_0x3b1fc8[_0xbea9('0x42')]==='lead'){logger[_0xbea9('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x6108b2,_0x3b1fc8[_0xbea9('0x42')]);_0xd0cb4f[_0xbea9('0x44')]=_0x4896c9!==''?_0x4896c9:util[_0xbea9('0x45')](_0xbea9('0x46'),_0x6108b2);_0xd0cb4f[_0xbea9('0x47')]=_0xbea9('0x48');}else if(_0x3b1fc8[_0xbea9('0x42')]===_0xbea9('0x1a')){logger[_0xbea9('0x21')](_0xbea9('0x43'),_0x6108b2,_0x3b1fc8[_0xbea9('0x42')]);_0xd0cb4f[_0xbea9('0x3b')]=_0x4896c9!==_0xbea9('0x49')?_0x4896c9:util[_0xbea9('0x45')](_0xbea9('0x46'),_0x6108b2);}else{return null;}}return _0x42eece[_0xbea9('0x22')](_[_0xbea9('0x4a')](_0x3b1fc8['moduleCreate']))[_0xbea9('0x4b')](_0xd0cb4f)[_0xbea9('0x2c')](function(_0x7ce109){return BPromise['resolve']({'id':_0x7ce109['id'],'endUserType':_0x3b1fc8[_0xbea9('0x42')]});});}});}function getCustomFields(_0x35339e,_0x2f1a4d){var _0x2b5de1={};if(_0x35339e[_0xbea9('0x32')]>0x0){_[_0xbea9('0x4c')](_0x35339e,function(_0x4f727b){if(_[_0xbea9('0x4d')]([_0xbea9('0x4e'),'picklist'],_0x4f727b[_0xbea9('0x3e')])&&_0x4f727b[_0xbea9('0x4f')]){_0x2b5de1[_0x4f727b[_0xbea9('0x4f')]]=_0x4f727b[_0xbea9('0x50')][_0xbea9('0x51')]();}else if(_0x4f727b[_0xbea9('0x3e')]===_0xbea9('0x52')&&_0x4f727b[_0xbea9('0x53')]&&_0x4f727b[_0xbea9('0x4f')]){_0x2f1a4d[_0x4f727b[_0xbea9('0x53')]]&&(_0x2b5de1[_0x4f727b['idField']]=_0x2f1a4d[_0x4f727b['variableName']][_0xbea9('0x51')]());}else if(_0x4f727b['type']===_0xbea9('0x54')&&_0x4f727b[_0xbea9('0x55')]&&_0x4f727b['Variable']['name']&&_0x4f727b['idField']){_0x2f1a4d[_0x4f727b['Variable'][_0xbea9('0x56')]['toLowerCase']()]&&(_0x2b5de1[_0x4f727b[_0xbea9('0x4f')]]=_0x2f1a4d[_0x4f727b[_0xbea9('0x55')]['name'][_0xbea9('0x3f')]()][_0xbea9('0x51')]());}});}return _0x2b5de1;}function getConnection(_0x52eacd){var _0x3f3bcb=_0x52eacd[_0xbea9('0x57')][_0xbea9('0x58')](_0x52eacd[_0xbea9('0x59')]);var _0x1043f6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x52eacd[_0xbea9('0x5a')]||_0xbea9('0x5b'),'clientId':_0x52eacd[_0xbea9('0x5c')],'clientSecret':_0x52eacd['clientSecret']}});return _0x1043f6[_0xbea9('0x5d')](_0x52eacd[_0xbea9('0x5e')],_0x3f3bcb)[_0xbea9('0x2c')](function(){logger[_0xbea9('0x21')]('Connection\x20established.');return _0x1043f6;});}exports[_0xbea9('0x5f')]=function(_0x3d9501,_0x1f692c,_0xb01b18,_0x16bec9,_0x25a169,_0x339305){var _0x5a7917,_0x1875d9,_0x265f29,_0xf72e32;_0x339305[_0xbea9('0x60')]=intUtil[_0xbea9('0x61')](_0x339305[_0xbea9('0x60')]);_0x339305[_0xbea9('0x5a')]=intUtil[_0xbea9('0x61')](_0x339305[_0xbea9('0x5a')]);if(_0x25a169&&_0x25a169[_0xbea9('0x62')]){logger[_0xbea9('0x21')]('[QUEUE]',_0xbea9('0x63'));_0x1f692c[_0xbea9('0x64')]=util['format'](_0xbea9('0x65'),_0x339305['serverUrl'],_0x1f692c[_0xbea9('0x66')],md5(_0x1f692c[_0xbea9('0x66')]));}else{_0x1f692c[_0xbea9('0x64')]='';}return getConnection(_0x339305)[_0xbea9('0x2c')](function(_0x1d9150){_0xf72e32=_0x1d9150;return getUser(_0x339305,_0x16bec9[_0xbea9('0x67')],_0xf72e32);})[_0xbea9('0x2c')](function(_0x4795eb){_0x5a7917=_0x4795eb;return getEndUser(_0x339305,_0xb01b18,_0x1f692c[_0xbea9('0x68')],_0x1f692c['calleridnum'],_0xf72e32);})[_0xbea9('0x2c')](function(_0x1efd99){_0x1875d9=_0x1efd99;return getTicket(_0x339305,_0x5a7917,_0x1875d9,_0xb01b18,_0x1f692c,_0xb01b18['Fields'],_0xf72e32,_0xbea9('0x5f'));})[_0xbea9('0x2c')](function(_0x462928){_0x265f29=_0x462928;logger['info'](_0xbea9('0x69'),_0x265f29['id']);logger['info'](_0xbea9('0x6a'),_0x265f29['id'],_0x16bec9[_0xbea9('0x56')],_0x339305['type']);switch(_0x339305['type']){case _0xbea9('0x6b'):emit(util[_0xbea9('0x45')](_0xbea9('0x6c'),_0x16bec9[_0xbea9('0x56')]),_0xbea9('0x6d'),{'recordId':_0x265f29['id']});break;case'newTab':emit(util[_0xbea9('0x45')]('user:%s',_0x16bec9[_0xbea9('0x56')]),_0xbea9('0x6e'),{'uri':util[_0xbea9('0x45')](_0xbea9('0x6f'),_0xf72e32[_0xbea9('0x70')],_0x265f29['id'])});break;default:logger['error'](_0xbea9('0x71'));}})[_0xbea9('0x72')](function(_0x15be02){logger[_0xbea9('0x73')]('[QUEUE]',_0x15be02);});};exports[_0xbea9('0x74')]=function(_0x277fd6,_0x3bff61,_0x1dc84b,_0x5603cf,_0x980907,_0x3c37f2,_0x5e62f1){var _0x4d8072,_0x41322e,_0xc4251d,_0xec6ee8;_0x3c37f2[_0xbea9('0x60')]=intUtil[_0xbea9('0x61')](_0x3c37f2[_0xbea9('0x60')]);_0x3c37f2[_0xbea9('0x5a')]=intUtil[_0xbea9('0x61')](_0x3c37f2['remoteUri']);if(_0x5e62f1&&_0x5e62f1[_0xbea9('0x75')]&&_0x5e62f1[_0xbea9('0x75')]!==_0xbea9('0x76')){logger[_0xbea9('0x21')](_0xbea9('0x77'),'Recording\x20is\x20enabled!');_0x3bff61['recordingURL']=util['format'](_0xbea9('0x65'),_0x3c37f2[_0xbea9('0x60')],_0x3bff61[_0xbea9('0x66')],md5(_0x3bff61[_0xbea9('0x66')]));}return getConnection(_0x3c37f2)[_0xbea9('0x2c')](function(_0x217a54){_0xec6ee8=_0x217a54;return getUser(_0x3c37f2,_0x5603cf[_0xbea9('0x67')],_0xec6ee8);})[_0xbea9('0x2c')](function(_0x25503b){_0x4d8072=_0x25503b;return getEndUser(_0x3c37f2,_0x1dc84b,_0x3bff61[_0xbea9('0x78')],_0x3bff61[_0xbea9('0x79')],_0xec6ee8);})[_0xbea9('0x2c')](function(_0x4d3559){_0x41322e=_0x4d3559;return getTicket(_0x3c37f2,_0x4d8072,_0x41322e,_0x1dc84b,_0x3bff61,_0x1dc84b[_0xbea9('0x7a')],_0xec6ee8,'outbound');})['then'](function(_0x56a51c){_0xc4251d=_0x56a51c;logger['info'](_0xbea9('0x7b'),_0xc4251d['id']);logger[_0xbea9('0x21')](_0xbea9('0x7c'),_0xc4251d['id'],_0x5603cf[_0xbea9('0x56')],_0x3c37f2[_0xbea9('0x3e')]);switch(_0x3c37f2['type']){case _0xbea9('0x6b'):emit(util[_0xbea9('0x45')](_0xbea9('0x6c'),_0x5603cf[_0xbea9('0x56')]),_0xbea9('0x6d'),{'recordId':_0xc4251d['id']});break;case _0xbea9('0x7d'):emit(util[_0xbea9('0x45')](_0xbea9('0x6c'),_0x5603cf[_0xbea9('0x56')]),_0xbea9('0x6e'),{'uri':util[_0xbea9('0x45')](_0xbea9('0x6f'),_0xec6ee8[_0xbea9('0x70')],_0xc4251d['id'])});break;default:logger[_0xbea9('0x73')]('[OUTBOUND]',_0xbea9('0x7e'));}})[_0xbea9('0x72')](function(_0xa6d167){logger[_0xbea9('0x73')](_0xbea9('0x77'),_0xa6d167);});};exports[_0xbea9('0x7f')]=function(_0x57ee9e,_0x46465d,_0x576ae7,_0x1b7c3d,_0x252d91,_0x36d0d6){var _0x4fe4df,_0xd514f4,_0x368fdd,_0x349265;_0x36d0d6[_0xbea9('0x60')]=intUtil['stripTrailingSlash'](_0x36d0d6[_0xbea9('0x60')]);_0x36d0d6[_0xbea9('0x5a')]=intUtil[_0xbea9('0x61')](_0x36d0d6['remoteUri']);if(_0x252d91&&_0x252d91[_0xbea9('0x62')]){logger[_0xbea9('0x21')]('['+_0x46465d[_0xbea9('0x80')][_0xbea9('0x81')]()+']','Recording\x20is\x20enabled!');_0x46465d[_0xbea9('0x64')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36d0d6[_0xbea9('0x60')],_0x46465d[_0xbea9('0x66')],md5(_0x46465d[_0xbea9('0x66')]));}else{_0x46465d['recordingURL']='';}return getConnection(_0x36d0d6)[_0xbea9('0x2c')](function(_0x33b3fa){_0x349265=_0x33b3fa;if(!_[_0xbea9('0x82')](_0x1b7c3d)){return getUser(_0x36d0d6,_0x1b7c3d[_0xbea9('0x56')],_0x349265);}else{return getUser(_0x36d0d6,null,_0x349265);}})['then'](function(_0x10f867){_0x4fe4df=_0x10f867;return getEndUser(_0x36d0d6,_0x576ae7,_0x46465d[_0xbea9('0x68')],_0x46465d[_0xbea9('0x83')],_0x349265);})[_0xbea9('0x2c')](function(_0x37aaec){_0xd514f4=_0x37aaec;return getTicket(_0x36d0d6,_0x4fe4df,_0xd514f4,_0x576ae7,_0x46465d,_0x576ae7[_0xbea9('0x7a')],_0x349265);})[_0xbea9('0x2c')](function(_0x1188fd){_0x368fdd=_0x1188fd;logger[_0xbea9('0x21')]('['+_0x46465d[_0xbea9('0x80')][_0xbea9('0x81')]()+_0xbea9('0x84'),_0x368fdd['id']);logger['info']('['+_0x46465d[_0xbea9('0x80')]['toUpperCase']()+_0xbea9('0x85'),_0x36d0d6['type']);})['catch'](function(_0x2ec3ab){logger[_0xbea9('0x73')]('['+_0x46465d[_0xbea9('0x80')]['toUpperCase']()+']',_0x2ec3ab);});}; \ No newline at end of file +var _0x8307=['emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','includes','picklist','type','idField','content','toString','variable','variableName','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter'];(function(_0x2a6f81,_0x5e67b9){var _0x16e982=function(_0x5ad669){while(--_0x5ad669){_0x2a6f81['push'](_0x2a6f81['shift']());}};_0x16e982(++_0x5e67b9);}(_0x8307,0x72));var _0x7830=function(_0x110776,_0x1067ca){_0x110776=_0x110776-0x0;var _0x13c279=_0x8307[_0x110776];return _0x13c279;};'use strict';var _=require(_0x7830('0x0'));var rp=require(_0x7830('0x1'));var moment=require('moment');var BPromise=require(_0x7830('0x2'));var md5=require(_0x7830('0x3'));var jsforce=require(_0x7830('0x4'));var util=require(_0x7830('0x5'));var Redis=require(_0x7830('0x6'));var intUtil=require(_0x7830('0x7'));var config=require(_0x7830('0x8'));var logger=require(_0x7830('0x9'))('salesforce');config[_0x7830('0xa')]=_['defaults'](config[_0x7830('0xa')],{'host':_0x7830('0xb'),'port':0x18eb});var io=require(_0x7830('0xc'))(new Redis(config[_0x7830('0xa')]));function emit(_0x1b41f4,_0x537ae2,_0x20d261){io['to'](_0x1b41f4)[_0x7830('0xd')](_0x537ae2,_0x20d261);}function getTicket(_0x53f3ca,_0x54b9ca,_0x58037e,_0x2940d1,_0x7bafe9,_0x2e99b1,_0x27f1d6,_0x50acce){var _0x57911a=Object['assign']({},{'OwnerId':_0x54b9ca['id'],'Subject':intUtil[_0x7830('0xe')](_0x2940d1[_0x7830('0xf')],_0x7bafe9,'\x20'),'Description':intUtil[_0x7830('0xe')](_0x2940d1[_0x7830('0x10')],_0x7bafe9,'\x0a')},getCustomFields(_0x2e99b1,_0x7bafe9));if(_0x58037e){if(_0x2940d1[_0x7830('0x11')]===_0x7830('0x12')){_0x57911a[_0x7830('0x13')]=moment[_0x7830('0x14')]();_0x57911a['IsReminderSet']=![];_0x57911a['IsRecurrence']=![];if(_0x58037e[_0x7830('0x15')]===_0x7830('0x16')||_0x58037e['endUserType']===_0x7830('0x17')){_0x57911a[_0x7830('0x18')]=_0x58037e['id'];}else if(_0x58037e['endUserType']===_0x7830('0x19')){_0x57911a[_0x7830('0x1a')]=_0x58037e['id'];}}else if(_0x2940d1[_0x7830('0x11')]===_0x7830('0x1b')){if(_0x58037e['endUserType']===_0x7830('0x16')){_0x57911a[_0x7830('0x1c')]=_0x58037e['id'];}else if(_0x58037e['endUserType']===_0x7830('0x19')){_0x57911a[_0x7830('0x1d')]=_0x58037e['id'];}else if(_0x58037e[_0x7830('0x15')]===_0x7830('0x17')&&_0x2940d1[_0x7830('0x1e')]){_0x57911a[_0x2940d1[_0x7830('0x1e')]]=_0x58037e['id'];}else{logger['info'](_0x7830('0x1f'));}}}return _0x27f1d6[_0x7830('0x20')](_0x2940d1['ticketType'])[_0x7830('0x21')](_0x57911a);}function getUser(_0x2b34c3,_0x329f6c,_0x43bfc0){if(!_[_0x7830('0x22')](_0x329f6c)&&intUtil[_0x7830('0x23')](_0x329f6c)){var _0x556932={'Email':_0x329f6c};var _0x35530a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x43bfc0['sobject'](_0x7830('0x24'))[_0x7830('0x25')](_0x556932,_0x35530a)[_0x7830('0x26')]()['then'](function(_0x3f876c){if(_0x3f876c['length']){var _0x5714bf=_[_0x7830('0x25')](_0x3f876c,function(_0x5aef4d){return _0x5aef4d[_0x7830('0x27')]===_0x329f6c;});if(_0x5714bf){logger[_0x7830('0x28')](_0x7830('0x29'),_0x329f6c);return BPromise[_0x7830('0x2a')]({'id':_0x5714bf['Id'],'name':_0x5714bf[_0x7830('0x2b')]});}}else{logger[_0x7830('0x28')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x329f6c);return _0x43bfc0[_0x7830('0x2c')]()[_0x7830('0x2d')](function(_0x3d341e){return BPromise['resolve']({'id':_0x3d341e[_0x7830('0x2e')],'name':_0x3d341e[_0x7830('0x2f')]});});}});}else{logger[_0x7830('0x28')](_0x7830('0x30'),_0x329f6c);return _0x43bfc0[_0x7830('0x2c')]()[_0x7830('0x2d')](function(_0x413a39){return BPromise[_0x7830('0x2a')]({'id':_0x413a39[_0x7830('0x2e')],'name':_0x413a39[_0x7830('0x2f')]});});}}function getEndUser(_0x52700a,_0x49d6e4,_0x173fa6,_0xb817f7,_0x5746d0){var _0x33c39d={'$or':{'Phone':_0xb817f7}};var _0x3f1446={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7830('0x2a')]()[_0x7830('0x2d')](function(){logger[_0x7830('0x28')](_0x7830('0x31'),_0xb817f7,_0x49d6e4[_0x7830('0x32')]);switch(_0x49d6e4[_0x7830('0x32')]){case _0x7830('0x33'):var _0x81cf07=_[_0x7830('0x34')](_0x33c39d);if(_0x49d6e4[_0x7830('0x35')]){var _0x5ea569={};_0x5ea569[_0x49d6e4['additionalSearchContact']]=_0xb817f7;_[_0x7830('0x36')](_0x81cf07[_0x7830('0x37')],_0x5ea569);}return _0x5746d0['sobject'](_0x7830('0x38'))[_0x7830('0x25')](_0x81cf07,_0x3f1446)[_0x7830('0x26')]()[_0x7830('0x2d')](function(_0x39da36){if(_0x39da36&&_0x39da36[_0x7830('0x39')]){return _0x39da36;}else{var _0x516015=_[_0x7830('0x34')](_0x33c39d);if(_0x49d6e4[_0x7830('0x3a')]){var _0x31a757={};_0x31a757[_0x49d6e4[_0x7830('0x3a')]]=_0xb817f7;_['merge'](_0x516015[_0x7830('0x37')],_0x31a757);}return _0x5746d0['sobject']('Lead')[_0x7830('0x25')](_0x516015,_0x3f1446);}});case _0x7830('0x3b'):var _0x1a9c7d=_[_0x7830('0x34')](_0x33c39d);if(_0x49d6e4['additionalSearchAccount']){var _0x5ea569={};_0x5ea569[_0x49d6e4[_0x7830('0x3c')]]=_0xb817f7;_[_0x7830('0x36')](_0x1a9c7d[_0x7830('0x37')],_0x5ea569);}return _0x5746d0[_0x7830('0x20')](_0x7830('0x3d'))[_0x7830('0x25')](_0x1a9c7d,_0x3f1446)['execute']()[_0x7830('0x2d')](function(_0x170c0c){if(_0x170c0c&&_0x170c0c[_0x7830('0x39')]){return _0x170c0c;}else{var _0x34df20=_[_0x7830('0x34')](_0x33c39d);if(_0x49d6e4[_0x7830('0x35')]){var _0x5eef09={};_0x5eef09[_0x49d6e4[_0x7830('0x35')]]=_0xb817f7;_[_0x7830('0x36')](_0x34df20[_0x7830('0x37')],_0x5eef09);}return _0x5746d0[_0x7830('0x20')](_0x7830('0x38'))[_0x7830('0x25')](_0x34df20,_0x3f1446)[_0x7830('0x2d')](function(_0xe9dc0a){if(_0xe9dc0a&&_0xe9dc0a[_0x7830('0x39')]){return _0xe9dc0a;}else{var _0x54be0a=_[_0x7830('0x34')](_0x33c39d);if(_0x49d6e4[_0x7830('0x3a')]){var _0x3734c0={};_0x3734c0[_0x49d6e4[_0x7830('0x3a')]]=_0xb817f7;_[_0x7830('0x36')](_0x54be0a[_0x7830('0x37')],_0x3734c0);}return _0x5746d0['sobject']('Lead')['find'](_0x54be0a,_0x3f1446);}});}});case _0x7830('0x16'):var _0x81cf07=_['cloneDeep'](_0x33c39d);if(_0x49d6e4['additionalSearchContact']){var _0x5ea569={};_0x5ea569[_0x49d6e4[_0x7830('0x35')]]=_0xb817f7;_[_0x7830('0x36')](_0x81cf07[_0x7830('0x37')],_0x5ea569);}return _0x5746d0[_0x7830('0x20')](_0x7830('0x38'))[_0x7830('0x25')](_0x81cf07,_0x3f1446)[_0x7830('0x26')]();case _0x7830('0x17'):var _0x3a05fb=_[_0x7830('0x34')](_0x33c39d);if(_0x49d6e4[_0x7830('0x3a')]){var _0x5ea569={};_0x5ea569[_0x49d6e4['additionalSearchLead']]=_0xb817f7;_[_0x7830('0x36')](_0x3a05fb[_0x7830('0x37')],_0x5ea569);}return _0x5746d0[_0x7830('0x20')]('Lead')[_0x7830('0x25')](_0x3a05fb,_0x3f1446);case _0x7830('0x19'):var _0x1a9c7d=_[_0x7830('0x34')](_0x33c39d);if(_0x49d6e4[_0x7830('0x3c')]){var _0x5ea569={};_0x5ea569[_0x49d6e4[_0x7830('0x3c')]]=_0xb817f7;_['merge'](_0x1a9c7d[_0x7830('0x37')],_0x5ea569);}return _0x5746d0[_0x7830('0x20')](_0x7830('0x3d'))[_0x7830('0x25')](_0x1a9c7d,_0x3f1446);default:return null;}})['then'](function(_0x4843ac){if(_0x4843ac&&_0x4843ac[_0x7830('0x39')]){var _0x9dcd6b=_[_0x7830('0x3e')](_0x4843ac);if(_0x9dcd6b){return BPromise['resolve']({'id':_0x9dcd6b['Id'],'name':_0x9dcd6b[_0x7830('0x2b')],'phone':_0x9dcd6b['Phone'],'endUserType':_0x9dcd6b[_0x7830('0x3f')]['type'][_0x7830('0x40')]()});}}})['then'](function(_0x490d78){if(_0x490d78){logger['info'](_0x7830('0x41'),_0x490d78[_0x7830('0x15')],_0xb817f7);return BPromise[_0x7830('0x2a')](_0x490d78);}else{logger[_0x7830('0x28')](_0x7830('0x42'),_0xb817f7);var _0x97e945={'Phone':_0xb817f7};if(_0x49d6e4[_0x7830('0x43')]){if(_0x49d6e4[_0x7830('0x43')]===_0x7830('0x16')){logger[_0x7830('0x28')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xb817f7,_0x49d6e4[_0x7830('0x43')]);_0x97e945[_0x7830('0x44')]=_0x173fa6!==_0x7830('0x45')?_0x173fa6:util[_0x7830('0x46')](_0x7830('0x47'),_0xb817f7);}else if(_0x49d6e4[_0x7830('0x43')]==='lead'){logger[_0x7830('0x28')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xb817f7,_0x49d6e4[_0x7830('0x43')]);_0x97e945[_0x7830('0x44')]=_0x173fa6!==_0x7830('0x45')?_0x173fa6:util[_0x7830('0x46')]('Caller\x20-\x20%s',_0xb817f7);_0x97e945['Company']=_0x7830('0x48');}else if(_0x49d6e4[_0x7830('0x43')]===_0x7830('0x19')){logger[_0x7830('0x28')](_0x7830('0x49'),_0xb817f7,_0x49d6e4[_0x7830('0x43')]);_0x97e945[_0x7830('0x2b')]=_0x173fa6!==''?_0x173fa6:util[_0x7830('0x46')](_0x7830('0x47'),_0xb817f7);}else{return null;}}return _0x5746d0[_0x7830('0x20')](_[_0x7830('0x4a')](_0x49d6e4[_0x7830('0x43')]))[_0x7830('0x21')](_0x97e945)[_0x7830('0x2d')](function(_0x22ec1a){return BPromise[_0x7830('0x2a')]({'id':_0x22ec1a['id'],'endUserType':_0x49d6e4['moduleCreate']});});}});}function getCustomFields(_0x2d5903,_0x777bff){var _0x2398d6={};if(_0x2d5903[_0x7830('0x39')]>0x0){_['forEach'](_0x2d5903,function(_0x2e0477){if(_[_0x7830('0x4b')](['string',_0x7830('0x4c')],_0x2e0477[_0x7830('0x4d')])&&_0x2e0477[_0x7830('0x4e')]){_0x2398d6[_0x2e0477[_0x7830('0x4e')]]=_0x2e0477[_0x7830('0x4f')][_0x7830('0x50')]();}else if(_0x2e0477[_0x7830('0x4d')]===_0x7830('0x51')&&_0x2e0477[_0x7830('0x52')]&&_0x2e0477['idField']){_0x777bff[_0x2e0477['variableName']]&&(_0x2398d6[_0x2e0477[_0x7830('0x4e')]]=_0x777bff[_0x2e0477[_0x7830('0x52')]][_0x7830('0x50')]());}else if(_0x2e0477['type']==='customVariable'&&_0x2e0477[_0x7830('0x53')]&&_0x2e0477[_0x7830('0x53')]['name']&&_0x2e0477['idField']){_0x777bff[_0x2e0477['Variable'][_0x7830('0x54')][_0x7830('0x40')]()]&&(_0x2398d6[_0x2e0477[_0x7830('0x4e')]]=_0x777bff[_0x2e0477[_0x7830('0x53')][_0x7830('0x54')][_0x7830('0x40')]()][_0x7830('0x50')]());}});}return _0x2398d6;}function getConnection(_0x19f6c9){var _0x2d793f=_0x19f6c9[_0x7830('0x55')]['concat'](_0x19f6c9[_0x7830('0x56')]);var _0x4c9e26=new jsforce[(_0x7830('0x57'))]({'oauth2':{'loginUrl':_0x19f6c9[_0x7830('0x58')]||_0x7830('0x59'),'clientId':_0x19f6c9['clientId'],'clientSecret':_0x19f6c9[_0x7830('0x5a')]}});return _0x4c9e26['login'](_0x19f6c9[_0x7830('0x5b')],_0x2d793f)['then'](function(){logger[_0x7830('0x28')](_0x7830('0x5c'));return _0x4c9e26;});}exports[_0x7830('0x5d')]=function(_0x317729,_0x5b8bcb,_0x384097,_0x316a5d,_0x4a72e6,_0x57c2b7){var _0x1d2189,_0x583c36,_0xbd68fc,_0x337df9;_0x57c2b7[_0x7830('0x5e')]=intUtil[_0x7830('0x5f')](_0x57c2b7[_0x7830('0x5e')]);_0x57c2b7['remoteUri']=intUtil[_0x7830('0x5f')](_0x57c2b7[_0x7830('0x58')]);if(_0x4a72e6&&_0x4a72e6['monitor_format']){logger[_0x7830('0x28')](_0x7830('0x60'),'Recording\x20is\x20enabled!');_0x5b8bcb[_0x7830('0x61')]=util[_0x7830('0x46')](_0x7830('0x62'),_0x57c2b7['serverUrl'],_0x5b8bcb[_0x7830('0x63')],md5(_0x5b8bcb['uniqueid']));}else{_0x5b8bcb['recordingURL']='';}return getConnection(_0x57c2b7)['then'](function(_0x4c58d0){_0x337df9=_0x4c58d0;return getUser(_0x57c2b7,_0x316a5d['email'],_0x337df9);})[_0x7830('0x2d')](function(_0x4c4dc0){_0x1d2189=_0x4c4dc0;return getEndUser(_0x57c2b7,_0x384097,_0x5b8bcb[_0x7830('0x64')],_0x5b8bcb['calleridnum'],_0x337df9);})[_0x7830('0x2d')](function(_0x59bd17){_0x583c36=_0x59bd17;return getTicket(_0x57c2b7,_0x1d2189,_0x583c36,_0x384097,_0x5b8bcb,_0x384097['Fields'],_0x337df9,_0x7830('0x5d'));})[_0x7830('0x2d')](function(_0x3cf7ce){_0xbd68fc=_0x3cf7ce;logger[_0x7830('0x28')]('[QUEUE]\x20Ticket\x20%s\x20created',_0xbd68fc['id']);logger[_0x7830('0x28')](_0x7830('0x65'),_0xbd68fc['id'],_0x316a5d[_0x7830('0x54')],_0x57c2b7['type']);switch(_0x57c2b7[_0x7830('0x4d')]){case _0x7830('0x66'):emit(util[_0x7830('0x46')]('user:%s',_0x316a5d[_0x7830('0x54')]),_0x7830('0x67'),{'recordId':_0xbd68fc['id']});break;case _0x7830('0x68'):emit(util[_0x7830('0x46')](_0x7830('0x69'),_0x316a5d['name']),_0x7830('0x6a'),{'uri':util['format']('%s/%s/e',_0x337df9[_0x7830('0x6b')],_0xbd68fc['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x7830('0x6c')](function(_0x4e2e5a){logger[_0x7830('0x6d')](_0x7830('0x60'),_0x4e2e5a);});};exports[_0x7830('0x6e')]=function(_0x38ce34,_0x2a841f,_0x1b7832,_0x47c528,_0x5c7d41,_0x3c92e6,_0x200fbf){var _0x513e89,_0x398ecf,_0xf3381c,_0x22d018;_0x3c92e6[_0x7830('0x5e')]=intUtil['stripTrailingSlash'](_0x3c92e6[_0x7830('0x5e')]);_0x3c92e6[_0x7830('0x58')]=intUtil[_0x7830('0x5f')](_0x3c92e6[_0x7830('0x58')]);if(_0x200fbf&&_0x200fbf['recordingFormat']&&_0x200fbf[_0x7830('0x6f')]!==_0x7830('0x70')){logger['info']('[OUTBOUND]',_0x7830('0x71'));_0x2a841f[_0x7830('0x61')]=util[_0x7830('0x46')](_0x7830('0x62'),_0x3c92e6[_0x7830('0x5e')],_0x2a841f[_0x7830('0x63')],md5(_0x2a841f[_0x7830('0x63')]));}return getConnection(_0x3c92e6)[_0x7830('0x2d')](function(_0x1c42c7){_0x22d018=_0x1c42c7;return getUser(_0x3c92e6,_0x47c528['email'],_0x22d018);})['then'](function(_0x406f84){_0x513e89=_0x406f84;return getEndUser(_0x3c92e6,_0x1b7832,_0x2a841f[_0x7830('0x72')],_0x2a841f[_0x7830('0x73')],_0x22d018);})[_0x7830('0x2d')](function(_0x45ec1c){_0x398ecf=_0x45ec1c;return getTicket(_0x3c92e6,_0x513e89,_0x398ecf,_0x1b7832,_0x2a841f,_0x1b7832[_0x7830('0x74')],_0x22d018,'outbound');})[_0x7830('0x2d')](function(_0x3c7a3a){_0xf3381c=_0x3c7a3a;logger['info'](_0x7830('0x75'),_0xf3381c['id']);logger[_0x7830('0x28')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xf3381c['id'],_0x47c528[_0x7830('0x54')],_0x3c92e6['type']);switch(_0x3c92e6[_0x7830('0x4d')]){case _0x7830('0x66'):emit(util[_0x7830('0x46')]('user:%s',_0x47c528[_0x7830('0x54')]),_0x7830('0x67'),{'recordId':_0xf3381c['id']});break;case _0x7830('0x68'):emit(util[_0x7830('0x46')](_0x7830('0x69'),_0x47c528['name']),_0x7830('0x6a'),{'uri':util[_0x7830('0x46')](_0x7830('0x76'),_0x22d018[_0x7830('0x6b')],_0xf3381c['id'])});break;default:logger[_0x7830('0x6d')]('[OUTBOUND]',_0x7830('0x77'));}})['catch'](function(_0x5918c9){logger['error'](_0x7830('0x78'),_0x5918c9);});};exports[_0x7830('0x79')]=function(_0x56c49,_0xa79875,_0x46b3c2,_0x4318f1,_0x546338,_0x866ced){var _0x580e55,_0x189f17,_0x131509,_0x38a578;_0x866ced[_0x7830('0x5e')]=intUtil[_0x7830('0x5f')](_0x866ced[_0x7830('0x5e')]);_0x866ced[_0x7830('0x58')]=intUtil[_0x7830('0x5f')](_0x866ced[_0x7830('0x58')]);if(_0x546338&&_0x546338['monitor_format']){logger[_0x7830('0x28')]('['+_0xa79875['lastevent'][_0x7830('0x7a')]()+']',_0x7830('0x71'));_0xa79875[_0x7830('0x61')]=util[_0x7830('0x46')](_0x7830('0x62'),_0x866ced[_0x7830('0x5e')],_0xa79875['uniqueid'],md5(_0xa79875[_0x7830('0x63')]));}else{_0xa79875[_0x7830('0x61')]='';}return getConnection(_0x866ced)[_0x7830('0x2d')](function(_0x295e59){_0x38a578=_0x295e59;if(!_[_0x7830('0x22')](_0x4318f1)){return getUser(_0x866ced,_0x4318f1[_0x7830('0x54')],_0x38a578);}else{return getUser(_0x866ced,null,_0x38a578);}})[_0x7830('0x2d')](function(_0x3c6220){_0x580e55=_0x3c6220;return getEndUser(_0x866ced,_0x46b3c2,_0xa79875['calleridname'],_0xa79875[_0x7830('0x7b')],_0x38a578);})[_0x7830('0x2d')](function(_0x4a16fb){_0x189f17=_0x4a16fb;return getTicket(_0x866ced,_0x580e55,_0x189f17,_0x46b3c2,_0xa79875,_0x46b3c2[_0x7830('0x74')],_0x38a578);})[_0x7830('0x2d')](function(_0x49c58a){_0x131509=_0x49c58a;logger['info']('['+_0xa79875[_0x7830('0x7c')][_0x7830('0x7a')]()+_0x7830('0x7d'),_0x131509['id']);logger[_0x7830('0x28')]('['+_0xa79875[_0x7830('0x7c')][_0x7830('0x7a')]()+_0x7830('0x7e'),_0x866ced['type']);})['catch'](function(_0x3565e){logger[_0x7830('0x6d')]('['+_0xa79875[_0x7830('0x7c')]['toUpperCase']()+']',_0x3565e);});}; \ 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 47633ee..b4277d7 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 _0xcc02=['adminEmail','outbound','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','then','length','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','userId','adminId',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','variableName','toString','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email'];(function(_0x74d0bc,_0x308a3d){var _0x35b209=function(_0x58f9a9){while(--_0x58f9a9){_0x74d0bc['push'](_0x74d0bc['shift']());}};_0x35b209(++_0x308a3d);}(_0xcc02,0x159));var _0x2cc0=function(_0xf76a8a,_0x24d323){_0xf76a8a=_0xf76a8a-0x0;var _0x33df5f=_0xcc02[_0xf76a8a];return _0x33df5f;};'use strict';var _=require(_0x2cc0('0x0'));var Promise=require('bluebird');var rp=require(_0x2cc0('0x1'));var util=require(_0x2cc0('0x2'));var md5=require(_0x2cc0('0x3'));var Redis=require(_0x2cc0('0x4'));var intUtil=require(_0x2cc0('0x5'));var config=require(_0x2cc0('0x6'));var logger=require('../../../../config/logger')('servicenow');config[_0x2cc0('0x7')]=_[_0x2cc0('0x8')](config[_0x2cc0('0x7')],{'host':_0x2cc0('0x9'),'port':0x18eb});var io=require(_0x2cc0('0xa'))(new Redis(config['redis']));function getAdminUser(_0x45d62e,_0x444ee2,_0x492c22,_0x36bc1a,_0x414bf4,_0xf75b6a){return new Promise(function(_0x3f6bd8,_0x435cbe){var _0x357ce5={'method':'GET','uri':_0x36bc1a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x414bf4+'&'+_0xf75b6a,'auth':_0x444ee2,'json':!![]};return rp(_0x357ce5)[_0x2cc0('0xb')](function(_0x11b24a){if(_0x11b24a['result'][_0x2cc0('0xc')]>0x0){_0x492c22['adminId']=_0x11b24a['result'][0x0]['sys_id'];}logger[_0x2cc0('0xd')]('['+[_0x45d62e[_0x2cc0('0xe')]()]+_0x2cc0('0xf'),_0x492c22);_0x3f6bd8(_0x492c22);})[_0x2cc0('0x10')](function(_0x31ef7a){logger[_0x2cc0('0x11')]('['+[_0x45d62e[_0x2cc0('0xe')]()]+']',_0x31ef7a['message']);_0x435cbe(_0x31ef7a[_0x2cc0('0x12')]);});});}function getUser(_0x2a8c97,_0x46067b,_0x47412a,_0x41fed6,_0x490719){return function(_0x5f404f){logger[_0x2cc0('0xd')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+_0x2cc0('0x13'),_0x5f404f);return new Promise(function(_0x1aa205,_0x4b978){if(intUtil[_0x2cc0('0x14')](_0x5f404f[_0x2cc0('0x15')])){var _0x17e7ed={'method':_0x2cc0('0x16'),'uri':_0x47412a+_0x2cc0('0x17')+_0x5f404f[_0x2cc0('0x15')]+'&'+_0x41fed6+'&'+_0x490719,'auth':_0x46067b,'json':!![]};logger[_0x2cc0('0xd')]('['+[_0x2a8c97['toUpperCase']()]+_0x2cc0('0x18'),_0x17e7ed);return rp(_0x17e7ed)[_0x2cc0('0xb')](function(_0x579bc3){logger[_0x2cc0('0xd')]('['+[_0x2a8c97['toUpperCase']()]+_0x2cc0('0x19'),_0x579bc3);if(_0x579bc3[_0x2cc0('0x1a')]['length']>0x0&&String(_0x579bc3['result'][0x0][_0x2cc0('0x1b')])==='true'){_0x5f404f['userId']=_0x579bc3[_0x2cc0('0x1a')][0x0]['sys_id'];}else{_0x5f404f[_0x2cc0('0x1c')]=_0x5f404f[_0x2cc0('0x1d')];_0x5f404f['userEmail']=_0x5f404f['adminEmail'];}logger[_0x2cc0('0xd')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+'],\x20getUser\x20crm',_0x5f404f);_0x1aa205(_0x5f404f);})[_0x2cc0('0x10')](function(_0x3a7ab4){logger[_0x2cc0('0x11')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+']',_0x3a7ab4[_0x2cc0('0x12')]);_0x4b978(_0x3a7ab4[_0x2cc0('0x12')]);});}else{logger[_0x2cc0('0xd')]('['+[_0x2a8c97[_0x2cc0('0xe')]()]+_0x2cc0('0x1e'));_0x5f404f['userId']=_0x5f404f['adminId'];_0x5f404f[_0x2cc0('0x15')]=_0x5f404f['adminEmail'];_0x1aa205(_0x5f404f);}});};}function createEndUser(_0x318724,_0x6afcba,_0x2da6a8,_0x4b2f98,_0x49d445){logger[_0x2cc0('0xd')]('['+[_0x318724[_0x2cc0('0xe')]()]+_0x2cc0('0x1f'),_0x2da6a8);return new Promise(function(_0x1a988e,_0x3776fc){var _0x24896f={'method':'POST','uri':_0x4b2f98+_0x2cc0('0x20')+_0x49d445,'body':{'user_name':_0x2da6a8[_0x2cc0('0x21')],'roles':'user','first_name':_0x2da6a8['endUserNumber'],'active':_0x2cc0('0x22'),'date_format':_0x2cc0('0x23'),'phone':_0x2da6a8['endUserNumber']},'auth':_0x6afcba,'json':!![]};return rp(_0x24896f)[_0x2cc0('0xb')](function(_0x252bc0){logger['info']('['+[_0x318724[_0x2cc0('0xe')]()]+_0x2cc0('0x24'),_0x252bc0[_0x2cc0('0x1a')]);_0x2da6a8[_0x2cc0('0x25')]=_0x252bc0[_0x2cc0('0x1a')][_0x2cc0('0x26')];_0x1a988e(_0x2da6a8);})[_0x2cc0('0x10')](function(_0xb48ca1){logger[_0x2cc0('0x11')]('['+[_0x318724[_0x2cc0('0xe')]()]+']',_0xb48ca1[_0x2cc0('0x12')]);_0x3776fc(_0xb48ca1['message']);});});}function getEndUser(_0x1da876,_0x40eed1,_0x1238ee,_0x85b1d8,_0x64ebd4){return function(_0x4e3da9){logger['info']('['+[_0x1da876[_0x2cc0('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x4e3da9);return new Promise(function(_0xae80a9,_0x1a7bb2){var _0x42d3bb={'method':_0x2cc0('0x16'),'uri':_0x1238ee+'sys_user?sysparm_query=phone%3D'+_0x4e3da9[_0x2cc0('0x21')]+'&'+_0x85b1d8+'&'+_0x64ebd4,'auth':_0x40eed1,'json':!![]};return rp(_0x42d3bb)[_0x2cc0('0xb')](function(_0xaa742){if(_0xaa742[_0x2cc0('0x1a')][_0x2cc0('0xc')]>0x0){_0x4e3da9[_0x2cc0('0x25')]=_0xaa742[_0x2cc0('0x1a')][0x0][_0x2cc0('0x26')];logger[_0x2cc0('0xd')]('['+[_0x1da876[_0x2cc0('0xe')]()]+_0x2cc0('0x27'),_0x4e3da9);_0xae80a9(_0x4e3da9);}else{return createEndUser(_0x1da876,_0x40eed1,_0x4e3da9,_0x1238ee,_0x85b1d8)['then'](function(_0x4f0c44){logger[_0x2cc0('0xd')]('['+[_0x1da876[_0x2cc0('0xe')]()]+_0x2cc0('0x28'),_0x4f0c44);_0xae80a9(_0x4f0c44);});}})[_0x2cc0('0x10')](function(_0x26ce54){logger[_0x2cc0('0x11')]('['+[_0x1da876[_0x2cc0('0xe')]()]+']',_0x26ce54[_0x2cc0('0x12')]);_0x1a7bb2(_0x26ce54[_0x2cc0('0x12')]);});});};}function getCustomFields(_0x6a91d5,_0x33b0fc){var _0x2889e3={};if(_0x6a91d5[_0x2cc0('0xc')]>0x0){_[_0x2cc0('0x29')](_0x6a91d5,function(_0x183e96){if(_[_0x2cc0('0x2a')]([_0x2cc0('0x2b'),_0x2cc0('0x2c')],_0x183e96[_0x2cc0('0x2d')])&&_0x183e96['nameField']&&!_0x183e96[_0x2cc0('0x2e')]){_0x2889e3[_0x183e96[_0x2cc0('0x2f')][_0x2cc0('0x30')]()]=_0x183e96[_0x2cc0('0x31')]['toString']();}else if(_['includes']([_0x2cc0('0x2b'),_0x2cc0('0x2c')],_0x183e96[_0x2cc0('0x2d')])&&_0x183e96[_0x2cc0('0x32')]&&_0x183e96['customField']){_0x2889e3[_0x183e96[_0x2cc0('0x32')][_0x2cc0('0x30')]()]=_0x183e96[_0x2cc0('0x31')]['toString']();}else if(_0x183e96['type']==='variable'&&_0x183e96[_0x2cc0('0x33')]&&_0x183e96['idField']&&_0x183e96[_0x2cc0('0x2e')]){_0x2889e3[_0x183e96['idField'][_0x2cc0('0x30')]()]=_0x33b0fc[_0x183e96[_0x2cc0('0x33')]][_0x2cc0('0x34')]();}else if(_0x183e96[_0x2cc0('0x2d')]==='customVariable'&&_0x183e96[_0x2cc0('0x35')]&&_0x183e96[_0x2cc0('0x35')][_0x2cc0('0x36')]&&_0x183e96[_0x2cc0('0x32')]&&_0x183e96[_0x2cc0('0x2e')]){_0x2889e3[_0x183e96[_0x2cc0('0x32')][_0x2cc0('0x30')]()]=_0x33b0fc[_0x183e96['Variable'][_0x2cc0('0x36')][_0x2cc0('0x30')]()][_0x2cc0('0x34')]();}});}return _0x2889e3;}function getTicket(_0x3e92f7,_0x4e92fd,_0x23c278,_0x204bae,_0x68848d,_0x1e4a8a){return function(_0x233224){logger['info']('['+[_0x3e92f7[_0x2cc0('0xe')]()]+_0x2cc0('0x37'),_0x233224);return new Promise(function(_0x22c678,_0x5e96c8){var _0x512d0b=_0x3e92f7['toLowerCase']()==='outbound'?_0x233224['userId']:_0x233224[_0x2cc0('0x25')];var _0x34c421={'method':'POST','uri':_0x23c278+_0x2cc0('0x38')+'?'+_0x1e4a8a,'body':Object[_0x2cc0('0x39')]({},{'active':_0x2cc0('0x22'),'caller_id':_0x512d0b,'assigned_to':_0x233224[_0x2cc0('0x1c')],'short_description':intUtil[_0x2cc0('0x3a')](_0x204bae['Subjects'],_0x68848d,'\x20'),'description':intUtil[_0x2cc0('0x3a')](_0x204bae[_0x2cc0('0x3b')],_0x68848d,'\x0a')},getCustomFields(_0x204bae['Fields'],_0x68848d)),'auth':_0x4e92fd,'json':!![]};return rp(_0x34c421)['then'](function(_0x2f1785){logger[_0x2cc0('0xd')]('['+[_0x3e92f7['toUpperCase']()]+_0x2cc0('0x3c'),_0x2f1785[_0x2cc0('0x1a')]);_0x233224[_0x2cc0('0x3d')]=_0x2f1785[_0x2cc0('0x1a')][_0x2cc0('0x26')];_0x233224[_0x2cc0('0x3e')]=_0x2f1785[_0x2cc0('0x1a')][_0x2cc0('0x3f')];logger[_0x2cc0('0xd')]('['+[_0x3e92f7[_0x2cc0('0xe')]()]+_0x2cc0('0x40'),_0x233224);_0x22c678(_0x233224);})[_0x2cc0('0x10')](function(_0xf2d72a){logger[_0x2cc0('0x11')]('['+[_0x3e92f7['toUpperCase']()]+']',_0xf2d72a[_0x2cc0('0x12')]);_0x5e96c8(_0xf2d72a['message']);});});};}function createRemoteTag(_0x3ab7d0,_0x3feae5,_0x24fba8,_0x12e009){return new Promise(function(_0x5bbbad,_0x139ac7){var _0x5eb103={'method':_0x2cc0('0x41'),'uri':_0x24fba8+_0x2cc0('0x42')+'?'+_0x12e009,'body':{'short_description':_0x3ab7d0,'global':!![],'active':!![],'name':_0x3ab7d0},'auth':_0x3feae5,'json':!![]};return rp(_0x5eb103)['then'](function(_0x353550){var _0x15f3c5=_0x353550[_0x2cc0('0x1a')][_0x2cc0('0x26')];_0x5bbbad(_0x15f3c5);});});}function getRemoteTag(_0x568046,_0x13fc90,_0x375712,_0x580f41,_0x3f1429){return new Promise(function(_0x1c2984,_0x55e836){var _0xbdaf0d={'method':_0x2cc0('0x16'),'uri':_0x375712+_0x2cc0('0x42')+'?sysparm_query=name%3D'+_0x568046+'&'+_0x580f41,'auth':_0x13fc90,'json':!![]};return rp(_0xbdaf0d)['then'](function(_0x5676d4){if(_0x5676d4[_0x2cc0('0x1a')][_0x2cc0('0xc')]>0x0){var _0x3945bb=_0x5676d4[_0x2cc0('0x1a')][0x0][_0x2cc0('0x26')];_0x1c2984(_0x3945bb);}else{return createRemoteTag(_0x568046,_0x13fc90,_0x375712,_0x580f41)[_0x2cc0('0xb')](function(_0xd3134c){_0x1c2984(_0xd3134c);});}});});}function assignTagToIncident(_0x51b036,_0x5a7535,_0x3bdce6,_0x9fb8be,_0x354592){return new Promise(function(_0x2c21a7,_0x98935e){var _0x6406d={'method':_0x2cc0('0x41'),'uri':_0x3bdce6+_0x2cc0('0x43')+'?'+_0x354592,'body':{'label':_0x51b036,'table':_0x2cc0('0x38'),'id_type':_0x2cc0('0x44'),'table_key':_0x9fb8be[_0x2cc0('0x3d')],'title':_0x2cc0('0x45')+_0x9fb8be[_0x2cc0('0x3e')],'id_display':_0x9fb8be[_0x2cc0('0x3e')]},'auth':_0x5a7535,'json':!![]};return rp(_0x6406d)['then'](function(_0x48bd37){_0x2c21a7();})[_0x2cc0('0x10')](function(){_0x2c21a7();});});}function manageTags(_0x2e3338,_0x21efbc,_0x26dbba,_0x58186e,_0x9240e9,_0x23992f,_0x22253e){return new Promise(function(_0x21471e,_0xe1f02a){var _0x188ed0=[];_0x21efbc[_0x2cc0('0x29')](function(_0x345e47){_0x188ed0[_0x2cc0('0x46')](getRemoteTag(_0x345e47,_0x26dbba,_0x58186e,_0x23992f,_0x22253e));});return Promise[_0x2cc0('0x47')](_0x188ed0)[_0x2cc0('0xb')](function(_0x317e64){if(_0x317e64['length']){logger[_0x2cc0('0xd')]('['+[_0x2e3338[_0x2cc0('0xe')]()]+_0x2cc0('0x48'),_0x317e64);var _0x5807d6=[];_0x317e64[_0x2cc0('0x29')](function(_0x1957fe){_0x5807d6['push'](assignTagToIncident(_0x1957fe,_0x26dbba,_0x58186e,_0x9240e9,_0x23992f));});return Promise[_0x2cc0('0x47')](_0x5807d6)['then'](function(){_0x21471e();})[_0x2cc0('0x10')](function(){_0x21471e();});}else{_0x21471e();}});});}function getTags(_0xd93a6a,_0x20863e,_0xd2f978,_0x272ba5,_0x5c64cd,_0x241d67){return function(_0x26c5d7){return new Promise(function(_0x2b4e89,_0xfa21c9){var _0x53da42=[];var _0xa9901e=_0x272ba5['Tags'];if(_0xa9901e&&_0xa9901e['length']>0x0){_0x53da42=_[_0x2cc0('0x49')](_0xa9901e,_0x2cc0('0x36'));}if(_0x53da42[_0x2cc0('0xc')]>0x0){return manageTags(_0xd93a6a,_0x53da42,_0x20863e,_0xd2f978,_0x26c5d7,_0x5c64cd,_0x241d67)[_0x2cc0('0xb')](function(){_0x2b4e89(_0x26c5d7);});}else{_0x2b4e89(_0x26c5d7);}});};}function emit(_0x101c74,_0x36bd55,_0x181d9b){var _0x835008=_0x2cc0('0x4a')+_0x2cc0('0x4b')+_0x2cc0('0x4c')+_0x2cc0('0x4d');var _0x17c59f={'uri':_0x101c74+_0x2cc0('0x4e')+_0x181d9b+_0x835008};io['to'](util[_0x2cc0('0x4f')](_0x2cc0('0x50'),_0x36bd55))[_0x2cc0('0x51')](_0x2cc0('0x52'),_0x17c59f);}exports['cs']=function(_0x4f2343,_0x3086d8,_0x34feba,_0x156dfe,_0xe42601,_0x4e447e,_0x27fd2f,_0x2c05a3){var _0x42f289={};var _0x49cf4d={'user':_0x4e447e[_0x2cc0('0x53')],'pass':_0x4e447e['password']};var _0x46d8e1='sysparm_limit=1';var _0x1615fc=_0x2cc0('0x54');_0x4e447e[_0x2cc0('0x55')]=intUtil[_0x2cc0('0x56')](_0x4e447e['remoteUri']);_0x4e447e['serverUrl']=intUtil[_0x2cc0('0x56')](_0x4e447e[_0x2cc0('0x57')]);var _0x1009eb=util['format'](_0x2cc0('0x58'),_0x4e447e[_0x2cc0('0x55')]);_0x42f289['userEmail']=!_[_0x2cc0('0x59')](_0x156dfe)?_0x156dfe[_0x2cc0('0x5a')]:null;_0x42f289[_0x2cc0('0x5b')]=_0x4e447e[_0x2cc0('0x5a')];_0x42f289['endUserNumber']=_0x2c05a3['toLowerCase']()===_0x2cc0('0x5c')?_0x3086d8['destcalleridnum']:_0x3086d8['calleridnum'];_0x42f289[_0x2cc0('0x5d')]=_0x2c05a3==='queue'||_0x2c05a3===_0x2cc0('0x5e')?_0x2cc0('0x5f'):_0x2cc0('0x5c');var _0x5e6f3a=util['format'](_0x2cc0('0x60'),_0x4e447e[_0x2cc0('0x57')],_0x3086d8['uniqueid'],md5(_0x3086d8[_0x2cc0('0x61')]));if(_0xe42601&&_0xe42601[_0x2cc0('0x62')]){logger[_0x2cc0('0xd')](_0x2cc0('0x63'),_0x2cc0('0x64'));_0x3086d8[_0x2cc0('0x65')]=_0x5e6f3a;}else if(_0x27fd2f&&_0x27fd2f['recordingFormat']&&_0x27fd2f['recordingFormat']!==_0x2cc0('0x66')){logger[_0x2cc0('0xd')](_0x2cc0('0x67'),_0x2cc0('0x64'));_0x3086d8[_0x2cc0('0x65')]=_0x5e6f3a;}else{_0x3086d8[_0x2cc0('0x65')]='';}return getAdminUser(_0x2c05a3,_0x49cf4d,_0x42f289,_0x1009eb,_0x1615fc,_0x46d8e1)[_0x2cc0('0xb')](getUser(_0x2c05a3,_0x49cf4d,_0x1009eb,_0x1615fc,_0x46d8e1))[_0x2cc0('0xb')](getEndUser(_0x2c05a3,_0x49cf4d,_0x1009eb,_0x1615fc,_0x46d8e1))['then'](getTicket(_0x2c05a3,_0x49cf4d,_0x1009eb,_0x34feba,_0x3086d8,_0x1615fc))['then'](function(_0x59e1ef){logger['info'](util[_0x2cc0('0x4f')](_0x2cc0('0x68'),_0x59e1ef['ticketId']));logger[_0x2cc0('0xd')](util['format'](_0x2cc0('0x69'),_0x2c05a3));if(_0x2c05a3!==_0x2cc0('0x5e')){logger[_0x2cc0('0xd')]('['+[_0x2c05a3[_0x2cc0('0xe')]()]+']',_0x2cc0('0x6a'));emit(_0x4e447e['remoteUri'],_0x156dfe[_0x2cc0('0x36')],_0x59e1ef['ticketId']);}})['catch'](function(_0x5c0f12){logger[_0x2cc0('0x11')]('['+[_0x2c05a3[_0x2cc0('0xe')]()]+_0x2cc0('0x6b'),util[_0x2cc0('0x6c')](_0x5c0f12,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf80b=['stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','],\x20getAdminUser\x20crm','error','message','info','toUpperCase','GET','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','catch','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true'];(function(_0x4af7ae,_0x233895){var _0x5a1cd5=function(_0x350be8){while(--_0x350be8){_0x4af7ae['push'](_0x4af7ae['shift']());}};_0x5a1cd5(++_0x233895);}(_0xf80b,0xda));var _0xbf80=function(_0x3f9559,_0x15c4ec){_0x3f9559=_0x3f9559-0x0;var _0x5df9bf=_0xf80b[_0x3f9559];return _0x5df9bf;};'use strict';var _=require(_0xbf80('0x0'));var Promise=require(_0xbf80('0x1'));var rp=require(_0xbf80('0x2'));var util=require('util');var md5=require(_0xbf80('0x3'));var Redis=require(_0xbf80('0x4'));var intUtil=require(_0xbf80('0x5'));var config=require(_0xbf80('0x6'));var logger=require('../../../../config/logger')(_0xbf80('0x7'));config[_0xbf80('0x8')]=_[_0xbf80('0x9')](config[_0xbf80('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf80('0x8')]));function getAdminUser(_0x382e6e,_0x263a42,_0x4dc6eb,_0x38f026,_0x36c662,_0x4a2b98){return new Promise(function(_0x3b004b,_0x41f169){var _0xd82fe6={'method':'GET','uri':_0x38f026+_0xbf80('0xa')+'&'+_0x36c662+'&'+_0x4a2b98,'auth':_0x263a42,'json':!![]};return rp(_0xd82fe6)[_0xbf80('0xb')](function(_0x2970eb){if(_0x2970eb[_0xbf80('0xc')]['length']>0x0){_0x4dc6eb[_0xbf80('0xd')]=_0x2970eb[_0xbf80('0xc')][0x0][_0xbf80('0xe')];}logger['info']('['+[_0x382e6e['toUpperCase']()]+_0xbf80('0xf'),_0x4dc6eb);_0x3b004b(_0x4dc6eb);})['catch'](function(_0x26d8de){logger[_0xbf80('0x10')]('['+[_0x382e6e['toUpperCase']()]+']',_0x26d8de['message']);_0x41f169(_0x26d8de[_0xbf80('0x11')]);});});}function getUser(_0x3e3a95,_0x268d7b,_0x473a12,_0x9032cd,_0x185601){return function(_0x517f9a){logger[_0xbf80('0x12')]('['+[_0x3e3a95[_0xbf80('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x517f9a);return new Promise(function(_0x4f4600,_0xb50417){if(intUtil['validateEmail'](_0x517f9a['userEmail'])){var _0x507c21={'method':_0xbf80('0x14'),'uri':_0x473a12+_0xbf80('0x15')+_0x517f9a[_0xbf80('0x16')]+'&'+_0x9032cd+'&'+_0x185601,'auth':_0x268d7b,'json':!![]};logger[_0xbf80('0x12')]('['+[_0x3e3a95[_0xbf80('0x13')]()]+_0xbf80('0x17'),_0x507c21);return rp(_0x507c21)['then'](function(_0x34cca4){logger[_0xbf80('0x12')]('['+[_0x3e3a95[_0xbf80('0x13')]()]+'],\x20getUser\x20entity',_0x34cca4);if(_0x34cca4[_0xbf80('0xc')][_0xbf80('0x18')]>0x0&&String(_0x34cca4[_0xbf80('0xc')][0x0]['active'])==='true'){_0x517f9a[_0xbf80('0x19')]=_0x34cca4[_0xbf80('0xc')][0x0]['sys_id'];}else{_0x517f9a['userId']=_0x517f9a['adminId'];_0x517f9a[_0xbf80('0x16')]=_0x517f9a[_0xbf80('0x1a')];}logger[_0xbf80('0x12')]('['+[_0x3e3a95[_0xbf80('0x13')]()]+'],\x20getUser\x20crm',_0x517f9a);_0x4f4600(_0x517f9a);})[_0xbf80('0x1b')](function(_0x428983){logger[_0xbf80('0x10')]('['+[_0x3e3a95[_0xbf80('0x13')]()]+']',_0x428983['message']);_0xb50417(_0x428983[_0xbf80('0x11')]);});}else{logger[_0xbf80('0x12')]('['+[_0x3e3a95[_0xbf80('0x13')]()]+']\x20using\x20admin\x20profile');_0x517f9a[_0xbf80('0x19')]=_0x517f9a['adminId'];_0x517f9a['userEmail']=_0x517f9a[_0xbf80('0x1a')];_0x4f4600(_0x517f9a);}});};}function createEndUser(_0x268c7c,_0x1a93ac,_0x3614a4,_0x58b14b,_0x4d781a){logger[_0xbf80('0x12')]('['+[_0x268c7c[_0xbf80('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x3614a4);return new Promise(function(_0x42d4de,_0x16c5f2){var _0x2b1057={'method':_0xbf80('0x1c'),'uri':_0x58b14b+_0xbf80('0x1d')+_0x4d781a,'body':{'user_name':_0x3614a4[_0xbf80('0x1e')],'roles':_0xbf80('0x1f'),'first_name':_0x3614a4[_0xbf80('0x1e')],'active':_0xbf80('0x20'),'date_format':_0xbf80('0x21'),'phone':_0x3614a4[_0xbf80('0x1e')]},'auth':_0x1a93ac,'json':!![]};return rp(_0x2b1057)[_0xbf80('0xb')](function(_0x13b1b7){logger[_0xbf80('0x12')]('['+[_0x268c7c[_0xbf80('0x13')]()]+_0xbf80('0x22'),_0x13b1b7[_0xbf80('0xc')]);_0x3614a4[_0xbf80('0x23')]=_0x13b1b7['result'][_0xbf80('0xe')];_0x42d4de(_0x3614a4);})[_0xbf80('0x1b')](function(_0x2c6bd4){logger[_0xbf80('0x10')]('['+[_0x268c7c[_0xbf80('0x13')]()]+']',_0x2c6bd4['message']);_0x16c5f2(_0x2c6bd4[_0xbf80('0x11')]);});});}function getEndUser(_0x21f9ee,_0x56ed45,_0x511cec,_0x5c1f82,_0x417ef0){return function(_0x4ba459){logger[_0xbf80('0x12')]('['+[_0x21f9ee[_0xbf80('0x13')]()]+_0xbf80('0x24'),_0x4ba459);return new Promise(function(_0x900b33,_0x273260){var _0x407ad9={'method':_0xbf80('0x14'),'uri':_0x511cec+_0xbf80('0x25')+_0x4ba459[_0xbf80('0x1e')]+'&'+_0x5c1f82+'&'+_0x417ef0,'auth':_0x56ed45,'json':!![]};return rp(_0x407ad9)[_0xbf80('0xb')](function(_0x4e32f7){if(_0x4e32f7[_0xbf80('0xc')]['length']>0x0){_0x4ba459[_0xbf80('0x23')]=_0x4e32f7[_0xbf80('0xc')][0x0][_0xbf80('0xe')];logger[_0xbf80('0x12')]('['+[_0x21f9ee[_0xbf80('0x13')]()]+'],\x20getEndUser\x20crm',_0x4ba459);_0x900b33(_0x4ba459);}else{return createEndUser(_0x21f9ee,_0x56ed45,_0x4ba459,_0x511cec,_0x5c1f82)['then'](function(_0x1c69f5){logger[_0xbf80('0x12')]('['+[_0x21f9ee[_0xbf80('0x13')]()]+_0xbf80('0x26'),_0x1c69f5);_0x900b33(_0x1c69f5);});}})['catch'](function(_0x54b39c){logger[_0xbf80('0x10')]('['+[_0x21f9ee[_0xbf80('0x13')]()]+']',_0x54b39c['message']);_0x273260(_0x54b39c[_0xbf80('0x11')]);});});};}function getCustomFields(_0x36b6ff,_0x781449){var _0x4e1c56={};if(_0x36b6ff[_0xbf80('0x18')]>0x0){_['forEach'](_0x36b6ff,function(_0x522d0b){if(_['includes'](['string',_0xbf80('0x27')],_0x522d0b['type'])&&_0x522d0b[_0xbf80('0x28')]&&!_0x522d0b[_0xbf80('0x29')]){_0x4e1c56[_0x522d0b[_0xbf80('0x28')][_0xbf80('0x2a')]()]=_0x522d0b[_0xbf80('0x2b')][_0xbf80('0x2c')]();}else if(_['includes'](['string',_0xbf80('0x27')],_0x522d0b[_0xbf80('0x2d')])&&_0x522d0b[_0xbf80('0x2e')]&&_0x522d0b[_0xbf80('0x29')]){_0x4e1c56[_0x522d0b[_0xbf80('0x2e')][_0xbf80('0x2a')]()]=_0x522d0b[_0xbf80('0x2b')][_0xbf80('0x2c')]();}else if(_0x522d0b[_0xbf80('0x2d')]===_0xbf80('0x2f')&&_0x522d0b['variableName']&&_0x522d0b[_0xbf80('0x2e')]&&_0x522d0b[_0xbf80('0x29')]){_0x4e1c56[_0x522d0b[_0xbf80('0x2e')][_0xbf80('0x2a')]()]=_0x781449[_0x522d0b[_0xbf80('0x30')]][_0xbf80('0x2c')]();}else if(_0x522d0b[_0xbf80('0x2d')]==='customVariable'&&_0x522d0b[_0xbf80('0x31')]&&_0x522d0b[_0xbf80('0x31')][_0xbf80('0x32')]&&_0x522d0b[_0xbf80('0x2e')]&&_0x522d0b['customField']){_0x4e1c56[_0x522d0b[_0xbf80('0x2e')]['toLowerCase']()]=_0x781449[_0x522d0b['Variable'][_0xbf80('0x32')][_0xbf80('0x2a')]()][_0xbf80('0x2c')]();}});}return _0x4e1c56;}function getTicket(_0x2647f2,_0x33551d,_0x3ecc6a,_0xf014df,_0x20d965,_0x165f00){return function(_0x470cd5){logger[_0xbf80('0x12')]('['+[_0x2647f2[_0xbf80('0x13')]()]+_0xbf80('0x33'),_0x470cd5);return new Promise(function(_0x3cd823,_0x2e4557){var _0x329634=_0x2647f2[_0xbf80('0x2a')]()===_0xbf80('0x34')?_0x470cd5[_0xbf80('0x19')]:_0x470cd5[_0xbf80('0x23')];var _0x42b170={'method':_0xbf80('0x1c'),'uri':_0x3ecc6a+_0xbf80('0x35')+'?'+_0x165f00,'body':Object[_0xbf80('0x36')]({},{'active':'true','caller_id':_0x329634,'assigned_to':_0x470cd5['userId'],'short_description':intUtil[_0xbf80('0x37')](_0xf014df[_0xbf80('0x38')],_0x20d965,'\x20'),'description':intUtil['getString'](_0xf014df[_0xbf80('0x39')],_0x20d965,'\x0a')},getCustomFields(_0xf014df[_0xbf80('0x3a')],_0x20d965)),'auth':_0x33551d,'json':!![]};return rp(_0x42b170)[_0xbf80('0xb')](function(_0x4447a8){logger['info']('['+[_0x2647f2[_0xbf80('0x13')]()]+_0xbf80('0x3b'),_0x4447a8[_0xbf80('0xc')]);_0x470cd5[_0xbf80('0x3c')]=_0x4447a8['result'][_0xbf80('0xe')];_0x470cd5[_0xbf80('0x3d')]=_0x4447a8[_0xbf80('0xc')][_0xbf80('0x3e')];logger[_0xbf80('0x12')]('['+[_0x2647f2['toUpperCase']()]+']\x20getTicket\x20crm',_0x470cd5);_0x3cd823(_0x470cd5);})['catch'](function(_0x49bc14){logger[_0xbf80('0x10')]('['+[_0x2647f2['toUpperCase']()]+']',_0x49bc14['message']);_0x2e4557(_0x49bc14['message']);});});};}function createRemoteTag(_0x677e68,_0x4f064a,_0xe26ae8,_0x5a653b){return new Promise(function(_0x811535,_0x2f9a24){var _0x4bcd1c={'method':_0xbf80('0x1c'),'uri':_0xe26ae8+_0xbf80('0x3f')+'?'+_0x5a653b,'body':{'short_description':_0x677e68,'global':!![],'active':!![],'name':_0x677e68},'auth':_0x4f064a,'json':!![]};return rp(_0x4bcd1c)['then'](function(_0xe14b15){var _0x34f917=_0xe14b15[_0xbf80('0xc')][_0xbf80('0xe')];_0x811535(_0x34f917);});});}function getRemoteTag(_0x1ffebd,_0x4d5f55,_0x55cf05,_0x35e845,_0x155edb){return new Promise(function(_0x31379a,_0xc0f047){var _0x3cce3d={'method':_0xbf80('0x14'),'uri':_0x55cf05+'label'+_0xbf80('0x40')+_0x1ffebd+'&'+_0x35e845,'auth':_0x4d5f55,'json':!![]};return rp(_0x3cce3d)[_0xbf80('0xb')](function(_0x17e38d){if(_0x17e38d[_0xbf80('0xc')][_0xbf80('0x18')]>0x0){var _0x352526=_0x17e38d[_0xbf80('0xc')][0x0][_0xbf80('0xe')];_0x31379a(_0x352526);}else{return createRemoteTag(_0x1ffebd,_0x4d5f55,_0x55cf05,_0x35e845)[_0xbf80('0xb')](function(_0x1ef583){_0x31379a(_0x1ef583);});}});});}function assignTagToIncident(_0x1b8fc6,_0x273c55,_0xb1db91,_0x1e73d6,_0x1b9b27){return new Promise(function(_0x72c4fd,_0x160197){var _0xad4035={'method':'POST','uri':_0xb1db91+'label_entry'+'?'+_0x1b9b27,'body':{'label':_0x1b8fc6,'table':'incident','id_type':'Incident','table_key':_0x1e73d6[_0xbf80('0x3c')],'title':'Incident\x20-\x20'+_0x1e73d6['ticketNumber'],'id_display':_0x1e73d6[_0xbf80('0x3d')]},'auth':_0x273c55,'json':!![]};return rp(_0xad4035)['then'](function(_0x4198bd){_0x72c4fd();})[_0xbf80('0x1b')](function(){_0x72c4fd();});});}function manageTags(_0x3748f0,_0x1716de,_0x557b88,_0x19cf48,_0x54ab81,_0x1890b0,_0x2ec685){return new Promise(function(_0x4f4d4e,_0x359e78){var _0x44b12b=[];_0x1716de['forEach'](function(_0x138333){_0x44b12b[_0xbf80('0x41')](getRemoteTag(_0x138333,_0x557b88,_0x19cf48,_0x1890b0,_0x2ec685));});return Promise[_0xbf80('0x42')](_0x44b12b)[_0xbf80('0xb')](function(_0x936542){if(_0x936542[_0xbf80('0x18')]){logger[_0xbf80('0x12')]('['+[_0x3748f0['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x936542);var _0x2feafb=[];_0x936542['forEach'](function(_0x13c225){_0x2feafb[_0xbf80('0x41')](assignTagToIncident(_0x13c225,_0x557b88,_0x19cf48,_0x54ab81,_0x1890b0));});return Promise[_0xbf80('0x42')](_0x2feafb)[_0xbf80('0xb')](function(){_0x4f4d4e();})[_0xbf80('0x1b')](function(){_0x4f4d4e();});}else{_0x4f4d4e();}});});}function getTags(_0x449dff,_0xe07ee8,_0x7f65c8,_0xfdb2ff,_0x2d907e,_0x1b71ff){return function(_0x593e6e){return new Promise(function(_0x220eb4,_0x1eabd9){var _0x51d1a1=[];var _0x259a0a=_0xfdb2ff['Tags'];if(_0x259a0a&&_0x259a0a['length']>0x0){_0x51d1a1=_[_0xbf80('0x43')](_0x259a0a,_0xbf80('0x32'));}if(_0x51d1a1[_0xbf80('0x18')]>0x0){return manageTags(_0x449dff,_0x51d1a1,_0xe07ee8,_0x7f65c8,_0x593e6e,_0x2d907e,_0x1b71ff)[_0xbf80('0xb')](function(){_0x220eb4(_0x593e6e);});}else{_0x220eb4(_0x593e6e);}});};}function emit(_0x4dfe6b,_0x1dc78f,_0x48879f){var _0x3333f7=_0xbf80('0x44')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xbf80('0x45')+_0xbf80('0x46');var _0xa786e8={'uri':_0x4dfe6b+_0xbf80('0x47')+_0x48879f+_0x3333f7};io['to'](util[_0xbf80('0x48')](_0xbf80('0x49'),_0x1dc78f))[_0xbf80('0x4a')](_0xbf80('0x4b'),_0xa786e8);}exports['cs']=function(_0x3f3713,_0x119244,_0x230904,_0x35f5ad,_0x3bc916,_0x2981d8,_0x52f159,_0x39d91c){var _0x2d863a={};var _0x4551cb={'user':_0x2981d8[_0xbf80('0x4c')],'pass':_0x2981d8[_0xbf80('0x4d')]};var _0x4eb842='sysparm_limit=1';var _0x5b5866=_0xbf80('0x4e');_0x2981d8['remoteUri']=intUtil[_0xbf80('0x4f')](_0x2981d8[_0xbf80('0x50')]);_0x2981d8[_0xbf80('0x51')]=intUtil[_0xbf80('0x4f')](_0x2981d8[_0xbf80('0x51')]);var _0x2aaa53=util['format'](_0xbf80('0x52'),_0x2981d8[_0xbf80('0x50')]);_0x2d863a[_0xbf80('0x16')]=!_[_0xbf80('0x53')](_0x35f5ad)?_0x35f5ad[_0xbf80('0x54')]:null;_0x2d863a[_0xbf80('0x1a')]=_0x2981d8[_0xbf80('0x54')];_0x2d863a['endUserNumber']=_0x39d91c['toLowerCase']()===_0xbf80('0x34')?_0x119244['destcalleridnum']:_0x119244[_0xbf80('0x55')];_0x2d863a[_0xbf80('0x56')]=_0x39d91c===_0xbf80('0x57')||_0x39d91c===_0xbf80('0x58')?'queue':_0xbf80('0x34');var _0x402461=util[_0xbf80('0x48')](_0xbf80('0x59'),_0x2981d8[_0xbf80('0x51')],_0x119244[_0xbf80('0x5a')],md5(_0x119244[_0xbf80('0x5a')]));if(_0x3bc916&&_0x3bc916['monitor_format']){logger[_0xbf80('0x12')]('[QUEUE]',_0xbf80('0x5b'));_0x119244[_0xbf80('0x5c')]=_0x402461;}else if(_0x52f159&&_0x52f159[_0xbf80('0x5d')]&&_0x52f159[_0xbf80('0x5d')]!=='none'){logger['info'](_0xbf80('0x5e'),'Recording\x20is\x20enabled!');_0x119244[_0xbf80('0x5c')]=_0x402461;}else{_0x119244[_0xbf80('0x5c')]='';}return getAdminUser(_0x39d91c,_0x4551cb,_0x2d863a,_0x2aaa53,_0x5b5866,_0x4eb842)[_0xbf80('0xb')](getUser(_0x39d91c,_0x4551cb,_0x2aaa53,_0x5b5866,_0x4eb842))[_0xbf80('0xb')](getEndUser(_0x39d91c,_0x4551cb,_0x2aaa53,_0x5b5866,_0x4eb842))[_0xbf80('0xb')](getTicket(_0x39d91c,_0x4551cb,_0x2aaa53,_0x230904,_0x119244,_0x5b5866))[_0xbf80('0xb')](function(_0x4c601f){logger[_0xbf80('0x12')](util['format'](_0xbf80('0x5f'),_0x4c601f['ticketId']));logger['info'](util[_0xbf80('0x48')](_0xbf80('0x60'),_0x39d91c));if(_0x39d91c!=='unmanaged'){logger[_0xbf80('0x12')]('['+[_0x39d91c[_0xbf80('0x13')]()]+']',_0xbf80('0x61'));emit(_0x2981d8[_0xbf80('0x50')],_0x35f5ad[_0xbf80('0x32')],_0x4c601f[_0xbf80('0x3c')]);}})[_0xbf80('0x1b')](function(_0x98fd3d){logger[_0xbf80('0x10')]('['+[_0x39d91c[_0xbf80('0x13')]()]+_0xbf80('0x62'),util['inspect'](_0x98fd3d,{'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 c308a1a..dab8f77 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 _0x2c47=['first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toString','custom_fields','content','variable','customVariable','Variable','toLowerCase','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','isNil','lodash','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','format','apiKey','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','name','user_name','entry_list','find','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0x2c47,0xbf));var _0x72c4=function(_0x2fc12c,_0x51228e){_0x2fc12c=_0x2fc12c-0x0;var _0x120436=_0x2c47[_0x2fc12c];return _0x120436;};'use strict';var _=require(_0x72c4('0x0'));var rp=require('request-promise');var BPromise=require(_0x72c4('0x1'));var md5=require('md5');var util=require(_0x72c4('0x2'));var Redis=require(_0x72c4('0x3'));var intUtil=require(_0x72c4('0x4'));var config=require(_0x72c4('0x5'));var logger=require('../../../../config/logger')(_0x72c4('0x6'));config[_0x72c4('0x7')]=_[_0x72c4('0x8')](config[_0x72c4('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x72c4('0x9'))(new Redis(config[_0x72c4('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x5e3a21,_0x2e3e03,_0x2b6d44){io['to'](_0x5e3a21)[_0x72c4('0xa')](_0x2e3e03,_0x2b6d44);}function getTicket(_0x32f94d,_0x1fc98e,_0xab96d4,_0x471b09,_0x104237,_0x27e44a,_0x4b0285,_0x4c6a2c){logger[_0x72c4('0xb')](_0x72c4('0xc'));var _0x11d43d=new Date();var _0x4696e6=[{'name':'name','value':intUtil[_0x72c4('0xd')](_0x471b09[_0x72c4('0xe')],_0x104237,'\x20')},{'name':_0x72c4('0xf'),'value':_0x1fc98e['id']},{'name':'created_by','value':_0x1fc98e['id']},{'name':_0x72c4('0x10'),'value':intUtil['getString'](_0x471b09[_0x72c4('0x11')],_0x104237,'\x0a')},{'name':_0x72c4('0x12'),'value':_0x11d43d[_0x72c4('0x13')]()['slice'](0x0,0x13)[_0x72c4('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x72c4('0x15'),'value':'15'},{'name':_0x72c4('0x16'),'value':_0xab96d4['id']},{'name':_0x72c4('0x17'),'value':_0x72c4('0x18')},{'name':_0x72c4('0x19'),'value':_0xab96d4['name']},{'name':_0x72c4('0x1a'),'value':_0x4c6a2c}];if(_0x27e44a[_0x72c4('0x1b')]){_[_0x72c4('0x1c')](_0x27e44a,function(_0x45dfa7){if(_0x104237[_0x45dfa7['variableName']]){_0x4696e6[_0x72c4('0x1d')]({'name':_0x45dfa7[_0x72c4('0x1e')],'value':_0x104237[_0x45dfa7[_0x72c4('0x1f')]]});}});}return request({'form':{'method':_0x72c4('0x20'),'input_type':_0x72c4('0x21'),'response_type':'JSON','rest_data':JSON[_0x72c4('0x22')]({'session':_0x4b0285['id'],'module_name':_0x72c4('0x23'),'name_value_list':_0x4696e6})}});}function getAuth(_0x34fe79){return util[_0x72c4('0x24')]('Basic\x20%s',new Buffer(_0x34fe79[_0x72c4('0x25')]+':X')['toString'](_0x72c4('0x26')));}function getServerInfo(_0x497ce7){return request({'form':{'method':_0x72c4('0x27'),'input_type':_0x72c4('0x21'),'response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'session':_0x497ce7['id']})}});}function getUser(_0x4331c3,_0x393fb0,_0x59372e){if(!_['isNil'](_0x393fb0)){logger[_0x72c4('0xb')](_0x72c4('0x28'),_0x393fb0);return request({'form':{'method':_0x72c4('0x29'),'input_type':_0x72c4('0x21'),'response_type':'JSON','rest_data':JSON[_0x72c4('0x22')]({'session':_0x59372e['id'],'module_name':_0x72c4('0x2a'),'query':util[_0x72c4('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x393fb0),'order_by':'','offset':'0','select_fields':['id',_0x72c4('0x2b'),_0x72c4('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3e8487){if(_0x3e8487[_0x72c4('0x2d')][_0x72c4('0x1b')]){var _0x42bb8c=_[_0x72c4('0x2e')](_0x3e8487['entry_list'],function(_0x4128be){return _0x4128be['name_value_list'][_0x72c4('0x2c')]['value']===_0x393fb0;});if(_0x42bb8c){logger[_0x72c4('0xb')](_0x72c4('0x2f'));return BPromise[_0x72c4('0x30')]({'id':_0x42bb8c[_0x72c4('0x31')]['id']['value'],'name':_0x42bb8c['name_value_list'][_0x72c4('0x2b')][_0x72c4('0x32')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x72c4('0x30')]({'id':_0x59372e[_0x72c4('0x31')]['user_id'][_0x72c4('0x32')],'name':_0x59372e[_0x72c4('0x31')][_0x72c4('0x2c')][_0x72c4('0x32')]});});}else{logger[_0x72c4('0xb')](_0x72c4('0x33'));return BPromise[_0x72c4('0x30')]({'id':_0x59372e['name_value_list'][_0x72c4('0x34')][_0x72c4('0x32')],'name':_0x59372e[_0x72c4('0x31')]['user_name'][_0x72c4('0x32')]});}}function getEndUser(_0x149fcc,_0xa49c90,_0x31eef8,_0x598683){logger['info'](_0x72c4('0x35'),_0x31eef8);return request({'form':{'method':_0x72c4('0x29'),'input_type':_0x72c4('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x598683['id'],'module_name':'Contacts','query':util['format'](_0x72c4('0x36'),_0x31eef8),'order_by':'','offset':'0','select_fields':['id',_0x72c4('0x2b'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x72c4('0x37')](function(_0x42797a){if(_0x42797a[_0x72c4('0x2d')][_0x72c4('0x1b')]){var _0x39b41b=_[_0x72c4('0x2e')](_0x42797a['entry_list'],function(_0x58ed25){return _0x58ed25[_0x72c4('0x31')][_0x72c4('0x38')][_0x72c4('0x32')]===_0x31eef8;});if(_0x39b41b){logger[_0x72c4('0xb')](_0x72c4('0x39'));return BPromise[_0x72c4('0x30')]({'id':_0x39b41b['name_value_list']['id']['value'],'name':_0x39b41b[_0x72c4('0x31')][_0x72c4('0x2b')][_0x72c4('0x32')],'phone':_0x39b41b['name_value_list'][_0x72c4('0x38')]['value']});}}else{logger['info'](_0x72c4('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x72c4('0x21'),'response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'session':_0x598683['id'],'module_name':_0x72c4('0x18'),'name_value_list':[{'name':_0x72c4('0x3b'),'value':_0xa49c90!==''?_0xa49c90:util[_0x72c4('0x24')](_0x72c4('0x3c'),_0x31eef8)},{'name':_0x72c4('0x38'),'value':_0x31eef8}]})}})[_0x72c4('0x37')](function(_0x12652e){logger['info'](_0x72c4('0x3d'));return BPromise[_0x72c4('0x30')]({'id':_0x12652e['id'],'name':_0x12652e[_0x72c4('0x2d')]['first_name']['value'],'phone':_0x12652e[_0x72c4('0x2d')][_0x72c4('0x38')][_0x72c4('0x32')]});});}});}function request(_0x4cfda3){logger[_0x72c4('0x3e')](_0x72c4('0x3f'),JSON[_0x72c4('0x22')](_0x4cfda3));return rp(_[_0x72c4('0x40')](def,_0x4cfda3));}function getTags(_0x101e8a,_0x1634c1){var _0x5dfd5c=[];if(_0x101e8a&&_0x101e8a['length']>0x0){_0x5dfd5c=_[_0x72c4('0x41')](_0x101e8a,_0x1634c1);}return _0x5dfd5c;}function getCustomFields(_0x346a52,_0x48951d){var _0x2920d8=[];var _0x543b35={'custom_fields':[]};if(_0x346a52[_0x72c4('0x1b')]>0x0){_['forEach'](_0x346a52,function(_0x2c451d){if(_0x2c451d[_0x72c4('0x42')]==='string'&&_0x2c451d[_0x72c4('0x43')]&&!_0x2c451d[_0x72c4('0x44')]){_0x543b35[_0x2c451d[_0x72c4('0x43')]['toLowerCase']()]=_0x2c451d['content'][_0x72c4('0x45')]();}else if(_0x2c451d[_0x72c4('0x42')]==='string'&&_0x2c451d['idField']&&_0x2c451d[_0x72c4('0x44')]){_0x543b35[_0x72c4('0x46')]['push']({'id':_0x2c451d[_0x72c4('0x1e')],'value':_0x2c451d[_0x72c4('0x47')][_0x72c4('0x45')]()});}else if(_0x2c451d[_0x72c4('0x42')]===_0x72c4('0x48')&&_0x2c451d[_0x72c4('0x1f')]&&_0x2c451d[_0x72c4('0x1e')]&&_0x2c451d[_0x72c4('0x44')]){_0x48951d[_0x2c451d[_0x72c4('0x1f')]]&&_0x543b35[_0x72c4('0x46')][_0x72c4('0x1d')]({'id':_0x2c451d['idField'],'value':_0x48951d[_0x2c451d[_0x72c4('0x1f')]][_0x72c4('0x45')]()});}else if(_0x2c451d[_0x72c4('0x42')]===_0x72c4('0x49')&&_0x2c451d[_0x72c4('0x4a')]&&_0x2c451d[_0x72c4('0x4a')][_0x72c4('0x2b')]&&_0x2c451d[_0x72c4('0x1e')]&&_0x2c451d[_0x72c4('0x44')]){_0x48951d[_0x2c451d[_0x72c4('0x4a')][_0x72c4('0x2b')]['toLowerCase']()]&&_0x543b35[_0x72c4('0x46')][_0x72c4('0x1d')]({'id':_0x2c451d[_0x72c4('0x1e')],'value':_0x48951d[_0x2c451d[_0x72c4('0x4a')][_0x72c4('0x2b')][_0x72c4('0x4b')]()]['toString']()});}});}return _0x543b35;}function getConnection(_0x565868){return request({'method':_0x72c4('0x4c'),'form':{'method':'login','input_type':'JSON','response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'user_auth':{'user_name':_0x565868[_0x72c4('0x4d')],'password':_0x565868[_0x72c4('0x4e')],'encryption':_0x72c4('0x4f')},'application':_0x72c4('0x50')})}})[_0x72c4('0x37')](function(_0x4cb760){var _0x52e8ce=_0x4cb760;if(_0x52e8ce['id']){def[_0x72c4('0x51')]=_0x52e8ce['id'];return BPromise[_0x72c4('0x30')](_0x52e8ce);}else{throw new Error(util[_0x72c4('0x24')](_0x72c4('0x52'),_0x565868['id']));}});}function setRelationship(_0x1eec65,_0x51e7f2,_0x291a59,_0x1d2108){return request({'form':{'method':'set_relationship','input_type':_0x72c4('0x21'),'response_type':_0x72c4('0x21'),'rest_data':JSON[_0x72c4('0x22')]({'session':_0x1eec65['id'],'module_name':'Calls','module_id':_0x291a59['id'],'link_field_name':_0x1d2108,'related_ids':[_0x51e7f2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x72c4('0x53')]=function(_0x1b7bce,_0x43d089,_0x39cb49,_0x251513,_0xf98fd,_0x24ba23){var _0x398565,_0x2345b7,_0x1384a2,_0x3905d5;_0x24ba23[_0x72c4('0x54')]=intUtil[_0x72c4('0x55')](_0x24ba23[_0x72c4('0x54')]);_0x24ba23['serverUrl']=intUtil[_0x72c4('0x55')](_0x24ba23[_0x72c4('0x56')]);def[_0x72c4('0x57')]=util[_0x72c4('0x24')](_0x72c4('0x58'),_0x24ba23[_0x72c4('0x54')]);if(_0xf98fd&&_0xf98fd[_0x72c4('0x59')]){logger[_0x72c4('0xb')](_0x72c4('0x5a'),'Recording\x20is\x20enabled!');_0x43d089['recordingURL']=util[_0x72c4('0x24')](_0x72c4('0x5b'),_0x24ba23[_0x72c4('0x56')],_0x43d089['uniqueid'],md5(_0x43d089[_0x72c4('0x5c')]));}else{_0x43d089['recordingURL']='';}return getConnection(_0x24ba23)[_0x72c4('0x37')](function(_0x3c0180){_0x3905d5=_0x3c0180;return getUser(_0x24ba23,_0x251513[_0x72c4('0x2b')],_0x3905d5);})[_0x72c4('0x37')](function(_0x1b4b60){_0x398565=_0x1b4b60;logger[_0x72c4('0xb')](_0x72c4('0x5d'),_0x398565['id']);return getEndUser(_0x24ba23,_0x43d089[_0x72c4('0x5e')],_0x43d089[_0x72c4('0x5f')],_0x3905d5);})['then'](function(_0x2212c0){_0x2345b7=_0x2212c0;logger[_0x72c4('0xb')](_0x72c4('0x60'),_0x2345b7['id']);return getTicket(_0x24ba23,_0x398565,_0x2345b7,_0x39cb49,_0x43d089,_0x39cb49[_0x72c4('0x61')],_0x3905d5,_0x72c4('0x62'));})[_0x72c4('0x37')](function(_0x1ee738){_0x1384a2=_0x1ee738;logger['info'](_0x72c4('0x63'));logger['info'](_0x72c4('0x64'),_0x1384a2['id']);return setRelationship(_0x3905d5,_0x398565,_0x1384a2,_0x72c4('0x65'));})['then'](function(){return setRelationship(_0x3905d5,_0x2345b7,_0x1384a2,_0x72c4('0x66'));})[_0x72c4('0x37')](function(){return getServerInfo(_0x3905d5);})[_0x72c4('0x37')](function(_0x1da266){var _0x1b3772=parseInt(_0x1da266[_0x72c4('0x67')][_0x72c4('0x68')](0x0));var _0x1d05ee=util[_0x72c4('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x24ba23['remoteUri'],_0x1384a2['id']);if(_0x1b3772>0x6){_0x1d05ee=util['format'](_0x72c4('0x69'),_0x24ba23[_0x72c4('0x54')],_0x1384a2['id']);}logger[_0x72c4('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x72c4('0x6a'),_0x251513[_0x72c4('0x2b')]),'trigger:browser:url',{'uri':_0x1d05ee});})[_0x72c4('0x6b')](function(_0x49833f){logger['error'](_0x72c4('0x5a'),JSON[_0x72c4('0x22')](_0x49833f));});};exports[_0x72c4('0x6c')]=function(_0x208fcc,_0x42c9b4,_0x231017,_0x190783,_0x121cc4,_0x32f737,_0xf60395){var _0xe8d836,_0x2bfc11,_0x416efc,_0x453994;_0x32f737[_0x72c4('0x54')]=intUtil[_0x72c4('0x55')](_0x32f737['remoteUri']);_0x32f737[_0x72c4('0x56')]=intUtil[_0x72c4('0x55')](_0x32f737['serverUrl']);def[_0x72c4('0x57')]=util['format'](_0x72c4('0x58'),_0x32f737[_0x72c4('0x54')]);if(_0xf60395&&_0xf60395[_0x72c4('0x6d')]&&_0xf60395[_0x72c4('0x6d')]!==_0x72c4('0x6e')){logger[_0x72c4('0xb')](_0x72c4('0x6f'),_0x72c4('0x70'));_0x42c9b4[_0x72c4('0x71')]=util['format'](_0x72c4('0x5b'),_0x32f737[_0x72c4('0x56')],_0x42c9b4[_0x72c4('0x5c')],md5(_0x42c9b4[_0x72c4('0x5c')]));}return getConnection(_0x32f737)[_0x72c4('0x37')](function(_0x45e546){_0x453994=_0x45e546;return getUser(_0x32f737,_0x190783[_0x72c4('0x2b')],_0x453994);})[_0x72c4('0x37')](function(_0x47a431){_0xe8d836=_0x47a431;logger['info'](_0x72c4('0x5d'),_0xe8d836['id']);return getEndUser(_0x32f737,_0x42c9b4[_0x72c4('0x72')],_0x42c9b4[_0x72c4('0x73')],_0x453994);})[_0x72c4('0x37')](function(_0x280c52){_0x2bfc11=_0x280c52;logger['info'](_0x72c4('0x60'),_0x2bfc11['id']);return getTicket(_0x32f737,_0xe8d836,_0x2bfc11,_0x231017,_0x42c9b4,_0x231017['Fields'],_0x453994,_0x72c4('0x74'));})['then'](function(_0x891aaa){_0x416efc=_0x891aaa;logger[_0x72c4('0xb')](_0x72c4('0x63'));logger[_0x72c4('0xb')]('The\x20Ticket\x20ID\x20is:',_0x416efc['id']);return setRelationship(_0x453994,_0xe8d836,_0x416efc,_0x72c4('0x65'));})[_0x72c4('0x37')](function(){return setRelationship(_0x453994,_0x2bfc11,_0x416efc,_0x72c4('0x66'));})[_0x72c4('0x37')](function(){return getServerInfo(_0x453994);})['then'](function(_0x8a782a){var _0x3749e7=parseInt(_0x8a782a['version'][_0x72c4('0x68')](0x0));var _0x1885b2=util[_0x72c4('0x24')](_0x72c4('0x75'),_0x32f737['remoteUri'],_0x416efc['id']);if(_0x3749e7>0x6){_0x1885b2=util[_0x72c4('0x24')](_0x72c4('0x69'),_0x32f737['remoteUri'],_0x416efc['id']);}logger[_0x72c4('0xb')](_0x72c4('0x6f'),_0x72c4('0x76'));emit(util['format'](_0x72c4('0x6a'),_0x190783[_0x72c4('0x2b')]),_0x72c4('0x77'),{'uri':_0x1885b2});})['catch'](function(_0x27f1b2){logger[_0x72c4('0x78')]('[OUTBOUND]',JSON[_0x72c4('0x22')](_0x27f1b2));});};exports[_0x72c4('0x79')]=function(_0x56da03,_0x1bc9d3,_0x18683d,_0x35847e,_0x3af255,_0x230e3c){var _0xbd075e,_0x63b7db,_0x19b35f,_0x681f1e;_0x230e3c[_0x72c4('0x54')]=intUtil['stripTrailingSlash'](_0x230e3c[_0x72c4('0x54')]);_0x230e3c[_0x72c4('0x56')]=intUtil[_0x72c4('0x55')](_0x230e3c['serverUrl']);def[_0x72c4('0x57')]=util[_0x72c4('0x24')]('%s/service/v4_1/rest.php',_0x230e3c[_0x72c4('0x54')]);if(_0x3af255&&_0x3af255[_0x72c4('0x59')]){logger[_0x72c4('0xb')]('['+_0x1bc9d3[_0x72c4('0x7a')][_0x72c4('0x7b')]()+']',_0x72c4('0x70'));_0x1bc9d3[_0x72c4('0x71')]=util['format'](_0x72c4('0x5b'),_0x230e3c[_0x72c4('0x56')],_0x1bc9d3['uniqueid'],md5(_0x1bc9d3['uniqueid']));}else{_0x1bc9d3[_0x72c4('0x71')]='';}return getConnection(_0x230e3c)[_0x72c4('0x37')](function(_0x41c69d){_0x681f1e=_0x41c69d;if(!_[_0x72c4('0x7c')](_0x35847e)){return getUser(_0x230e3c,_0x35847e[_0x72c4('0x2b')],_0x681f1e);}else{return getUser(_0x230e3c,null,_0x681f1e);}})[_0x72c4('0x37')](function(_0x2ab877){_0xbd075e=_0x2ab877;logger[_0x72c4('0xb')](_0x72c4('0x5d'),_0xbd075e['id']);return getEndUser(_0x230e3c,_0x1bc9d3[_0x72c4('0x5e')],_0x1bc9d3[_0x72c4('0x5f')],_0x681f1e);})[_0x72c4('0x37')](function(_0x5cbce3){_0x63b7db=_0x5cbce3;logger[_0x72c4('0xb')]('The\x20Enduser\x20ID\x20is:',_0x63b7db['id']);return getTicket(_0x230e3c,_0xbd075e,_0x63b7db,_0x18683d,_0x1bc9d3,_0x18683d['Fields'],_0x681f1e,'Inbound');})[_0x72c4('0x37')](function(_0x50f797){_0x19b35f=_0x50f797;logger['info']('Ticket\x20created!');logger[_0x72c4('0xb')](_0x72c4('0x64'),_0x19b35f['id']);return setRelationship(_0x681f1e,_0xbd075e,_0x19b35f,_0x72c4('0x65'));})[_0x72c4('0x37')](function(){return setRelationship(_0x681f1e,_0x63b7db,_0x19b35f,_0x72c4('0x66'));})['then'](function(){return getServerInfo(_0x681f1e);})[_0x72c4('0x6b')](function(_0x39f906){logger['error']('['+_0x1bc9d3[_0x72c4('0x7a')][_0x72c4('0x7b')]()+']',JSON[_0x72c4('0x22')](_0x39f906));});}; \ No newline at end of file +var _0x47e4=['trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','lastevent','toUpperCase','calleridnum','request-promise','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x178fc3,_0x1f7882){var _0x3527a2=function(_0x142eec){while(--_0x142eec){_0x178fc3['push'](_0x178fc3['shift']());}};_0x3527a2(++_0x1f7882);}(_0x47e4,0x16b));var _0x447e=function(_0x16765f,_0x3dd736){_0x16765f=_0x16765f-0x0;var _0x1326d4=_0x47e4[_0x16765f];return _0x1326d4;};'use strict';var _=require('lodash');var rp=require(_0x447e('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x447e('0x1'));var intUtil=require(_0x447e('0x2'));var config=require(_0x447e('0x3'));var logger=require('../../../../config/logger')(_0x447e('0x4'));config[_0x447e('0x5')]=_[_0x447e('0x6')](config[_0x447e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x447e('0x7'))(new Redis(config[_0x447e('0x5')]));var def={'method':_0x447e('0x8'),'json':!![]};function emit(_0x11d9ca,_0x2ca1e3,_0x530c9a){io['to'](_0x11d9ca)[_0x447e('0x9')](_0x2ca1e3,_0x530c9a);}function getTicket(_0x1ba608,_0x7a3311,_0x328f3c,_0x3dd250,_0x579844,_0x3e04b,_0x33c794,_0x46dde7){logger[_0x447e('0xa')](_0x447e('0xb'));var _0x467b59=new Date();var _0x1914f5=[{'name':_0x447e('0xc'),'value':intUtil[_0x447e('0xd')](_0x3dd250[_0x447e('0xe')],_0x579844,'\x20')},{'name':_0x447e('0xf'),'value':_0x7a3311['id']},{'name':_0x447e('0x10'),'value':_0x7a3311['id']},{'name':'description','value':intUtil[_0x447e('0xd')](_0x3dd250['Descriptions'],_0x579844,'\x0a')},{'name':_0x447e('0x11'),'value':_0x467b59[_0x447e('0x12')]()[_0x447e('0x13')](0x0,0x13)[_0x447e('0x14')]('T','\x20')},{'name':_0x447e('0x15'),'value':'0'},{'name':_0x447e('0x16'),'value':'15'},{'name':'parent_id','value':_0x328f3c['id']},{'name':_0x447e('0x17'),'value':_0x447e('0x18')},{'name':_0x447e('0x19'),'value':_0x328f3c['name']},{'name':_0x447e('0x1a'),'value':_0x46dde7}];if(_0x3e04b[_0x447e('0x1b')]){_[_0x447e('0x1c')](_0x3e04b,function(_0x451bdd){if(_0x579844[_0x451bdd[_0x447e('0x1d')]]){_0x1914f5[_0x447e('0x1e')]({'name':_0x451bdd[_0x447e('0x1f')],'value':_0x579844[_0x451bdd[_0x447e('0x1d')]]});}});}return request({'form':{'method':_0x447e('0x20'),'input_type':_0x447e('0x21'),'response_type':_0x447e('0x21'),'rest_data':JSON[_0x447e('0x22')]({'session':_0x33c794['id'],'module_name':'Calls','name_value_list':_0x1914f5})}});}function getAuth(_0x4c0571){return util[_0x447e('0x23')](_0x447e('0x24'),new Buffer(_0x4c0571[_0x447e('0x25')]+':X')[_0x447e('0x26')](_0x447e('0x27')));}function getServerInfo(_0x48e0fc){return request({'form':{'method':_0x447e('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x447e('0x22')]({'session':_0x48e0fc['id']})}});}function getUser(_0x3c1e03,_0x5e7844,_0xc382d){if(!_[_0x447e('0x29')](_0x5e7844)){logger[_0x447e('0xa')](_0x447e('0x2a'),_0x5e7844);return request({'form':{'method':_0x447e('0x2b'),'input_type':_0x447e('0x21'),'response_type':_0x447e('0x21'),'rest_data':JSON[_0x447e('0x22')]({'session':_0xc382d['id'],'module_name':_0x447e('0x2c'),'query':util[_0x447e('0x23')](_0x447e('0x2d'),_0x5e7844),'order_by':'','offset':'0','select_fields':['id','name',_0x447e('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x447e('0x2f')](function(_0x5254dc){if(_0x5254dc[_0x447e('0x30')]['length']){var _0x1552e3=_[_0x447e('0x31')](_0x5254dc[_0x447e('0x30')],function(_0x52e6e6){return _0x52e6e6[_0x447e('0x32')]['user_name'][_0x447e('0x33')]===_0x5e7844;});if(_0x1552e3){logger['info'](_0x447e('0x34'));return BPromise[_0x447e('0x35')]({'id':_0x1552e3[_0x447e('0x32')]['id'][_0x447e('0x33')],'name':_0x1552e3[_0x447e('0x32')]['name'][_0x447e('0x33')]});}}logger[_0x447e('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xc382d['name_value_list']['user_id'][_0x447e('0x33')],'name':_0xc382d['name_value_list'][_0x447e('0x2e')][_0x447e('0x33')]});});}else{logger[_0x447e('0xa')](_0x447e('0x36'));return BPromise['resolve']({'id':_0xc382d[_0x447e('0x32')]['user_id'][_0x447e('0x33')],'name':_0xc382d[_0x447e('0x32')]['user_name'][_0x447e('0x33')]});}}function getEndUser(_0x1886a0,_0x5213d5,_0x12af56,_0x5cdc8c){logger[_0x447e('0xa')](_0x447e('0x37'),_0x12af56);return request({'form':{'method':_0x447e('0x2b'),'input_type':_0x447e('0x21'),'response_type':'JSON','rest_data':JSON[_0x447e('0x22')]({'session':_0x5cdc8c['id'],'module_name':_0x447e('0x18'),'query':util[_0x447e('0x23')](_0x447e('0x38'),_0x12af56),'order_by':'','offset':'0','select_fields':['id',_0x447e('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1291cc){if(_0x1291cc[_0x447e('0x30')][_0x447e('0x1b')]){var _0x2e874f=_['find'](_0x1291cc['entry_list'],function(_0x1b5b82){return _0x1b5b82[_0x447e('0x32')]['phone_home'][_0x447e('0x33')]===_0x12af56;});if(_0x2e874f){logger[_0x447e('0xa')](_0x447e('0x39'));return BPromise['resolve']({'id':_0x2e874f[_0x447e('0x32')]['id'][_0x447e('0x33')],'name':_0x2e874f[_0x447e('0x32')][_0x447e('0xc')][_0x447e('0x33')],'phone':_0x2e874f[_0x447e('0x32')][_0x447e('0x3a')][_0x447e('0x33')]});}}else{logger[_0x447e('0xa')](_0x447e('0x3b'));return request({'form':{'method':_0x447e('0x20'),'input_type':_0x447e('0x21'),'response_type':_0x447e('0x21'),'rest_data':JSON[_0x447e('0x22')]({'session':_0x5cdc8c['id'],'module_name':'Contacts','name_value_list':[{'name':_0x447e('0x3c'),'value':_0x5213d5!==_0x447e('0x3d')?_0x5213d5:util[_0x447e('0x23')](_0x447e('0x3e'),_0x12af56)},{'name':_0x447e('0x3a'),'value':_0x12af56}]})}})['then'](function(_0x5a3d76){logger['info'](_0x447e('0x3f'));return BPromise[_0x447e('0x35')]({'id':_0x5a3d76['id'],'name':_0x5a3d76[_0x447e('0x30')][_0x447e('0x3c')]['value'],'phone':_0x5a3d76[_0x447e('0x30')]['phone_home']['value']});});}});}function request(_0x29b7d4){logger[_0x447e('0x40')](_0x447e('0x41'),JSON[_0x447e('0x22')](_0x29b7d4));return rp(_[_0x447e('0x42')](def,_0x29b7d4));}function getTags(_0x3a48ec,_0x118398){var _0x42465b=[];if(_0x3a48ec&&_0x3a48ec[_0x447e('0x1b')]>0x0){_0x42465b=_[_0x447e('0x43')](_0x3a48ec,_0x118398);}return _0x42465b;}function getCustomFields(_0x98ee73,_0x45c023){var _0x4cf910=[];var _0x227a5c={'custom_fields':[]};if(_0x98ee73['length']>0x0){_[_0x447e('0x1c')](_0x98ee73,function(_0x200613){if(_0x200613[_0x447e('0x44')]===_0x447e('0x45')&&_0x200613[_0x447e('0x46')]&&!_0x200613[_0x447e('0x47')]){_0x227a5c[_0x200613[_0x447e('0x46')][_0x447e('0x48')]()]=_0x200613['content'][_0x447e('0x26')]();}else if(_0x200613[_0x447e('0x44')]==='string'&&_0x200613['idField']&&_0x200613['customField']){_0x227a5c[_0x447e('0x49')][_0x447e('0x1e')]({'id':_0x200613['idField'],'value':_0x200613[_0x447e('0x4a')][_0x447e('0x26')]()});}else if(_0x200613[_0x447e('0x44')]===_0x447e('0x4b')&&_0x200613['variableName']&&_0x200613[_0x447e('0x1f')]&&_0x200613[_0x447e('0x47')]){_0x45c023[_0x200613[_0x447e('0x1d')]]&&_0x227a5c[_0x447e('0x49')][_0x447e('0x1e')]({'id':_0x200613[_0x447e('0x1f')],'value':_0x45c023[_0x200613[_0x447e('0x1d')]]['toString']()});}else if(_0x200613[_0x447e('0x44')]==='customVariable'&&_0x200613[_0x447e('0x4c')]&&_0x200613[_0x447e('0x4c')][_0x447e('0xc')]&&_0x200613[_0x447e('0x1f')]&&_0x200613[_0x447e('0x47')]){_0x45c023[_0x200613['Variable'][_0x447e('0xc')][_0x447e('0x48')]()]&&_0x227a5c[_0x447e('0x49')][_0x447e('0x1e')]({'id':_0x200613[_0x447e('0x1f')],'value':_0x45c023[_0x200613['Variable'][_0x447e('0xc')][_0x447e('0x48')]()][_0x447e('0x26')]()});}});}return _0x227a5c;}function getConnection(_0x3c7bbb){return request({'method':'POST','form':{'method':_0x447e('0x4d'),'input_type':_0x447e('0x21'),'response_type':_0x447e('0x21'),'rest_data':JSON[_0x447e('0x22')]({'user_auth':{'user_name':_0x3c7bbb['username'],'password':_0x3c7bbb[_0x447e('0x4e')],'encryption':_0x447e('0x4f')},'application':_0x447e('0x50')})}})[_0x447e('0x2f')](function(_0x1be2a5){var _0x555669=_0x1be2a5;if(_0x555669['id']){def[_0x447e('0x51')]=_0x555669['id'];return BPromise[_0x447e('0x35')](_0x555669);}else{throw new Error(util[_0x447e('0x23')](_0x447e('0x52'),_0x3c7bbb['id']));}});}function setRelationship(_0x45a8e7,_0x14fadb,_0x1d685f,_0x231b0c){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x447e('0x21'),'rest_data':JSON[_0x447e('0x22')]({'session':_0x45a8e7['id'],'module_name':'Calls','module_id':_0x1d685f['id'],'link_field_name':_0x231b0c,'related_ids':[_0x14fadb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x447e('0x53')]=function(_0xc5dded,_0x9db416,_0x58161c,_0x5f3ae9,_0x23da06,_0x48940c){var _0x44736a,_0x1b9960,_0x1ede81,_0x1dec0d;_0x48940c['remoteUri']=intUtil[_0x447e('0x54')](_0x48940c[_0x447e('0x55')]);_0x48940c[_0x447e('0x56')]=intUtil[_0x447e('0x54')](_0x48940c[_0x447e('0x56')]);def[_0x447e('0x57')]=util[_0x447e('0x23')](_0x447e('0x58'),_0x48940c['remoteUri']);if(_0x23da06&&_0x23da06[_0x447e('0x59')]){logger[_0x447e('0xa')]('[QUEUE]',_0x447e('0x5a'));_0x9db416['recordingURL']=util[_0x447e('0x23')](_0x447e('0x5b'),_0x48940c[_0x447e('0x56')],_0x9db416[_0x447e('0x5c')],md5(_0x9db416[_0x447e('0x5c')]));}else{_0x9db416[_0x447e('0x5d')]='';}return getConnection(_0x48940c)[_0x447e('0x2f')](function(_0x174db3){_0x1dec0d=_0x174db3;return getUser(_0x48940c,_0x5f3ae9[_0x447e('0xc')],_0x1dec0d);})[_0x447e('0x2f')](function(_0x3e503d){_0x44736a=_0x3e503d;logger[_0x447e('0xa')](_0x447e('0x5e'),_0x44736a['id']);return getEndUser(_0x48940c,_0x9db416[_0x447e('0x5f')],_0x9db416['calleridnum'],_0x1dec0d);})[_0x447e('0x2f')](function(_0x279e9a){_0x1b9960=_0x279e9a;logger['info'](_0x447e('0x60'),_0x1b9960['id']);return getTicket(_0x48940c,_0x44736a,_0x1b9960,_0x58161c,_0x9db416,_0x58161c[_0x447e('0x61')],_0x1dec0d,_0x447e('0x62'));})[_0x447e('0x2f')](function(_0x2d6205){_0x1ede81=_0x2d6205;logger[_0x447e('0xa')](_0x447e('0x63'));logger[_0x447e('0xa')](_0x447e('0x64'),_0x1ede81['id']);return setRelationship(_0x1dec0d,_0x44736a,_0x1ede81,_0x447e('0x65'));})[_0x447e('0x2f')](function(){return setRelationship(_0x1dec0d,_0x1b9960,_0x1ede81,_0x447e('0x66'));})['then'](function(){return getServerInfo(_0x1dec0d);})[_0x447e('0x2f')](function(_0x5633f5){var _0x2b8703=parseInt(_0x5633f5[_0x447e('0x67')]['charAt'](0x0));var _0x453295=util['format'](_0x447e('0x68'),_0x48940c[_0x447e('0x55')],_0x1ede81['id']);if(_0x2b8703>0x6){_0x453295=util[_0x447e('0x23')](_0x447e('0x69'),_0x48940c[_0x447e('0x55')],_0x1ede81['id']);}logger[_0x447e('0xa')](_0x447e('0x6a'),_0x447e('0x6b'));emit(util[_0x447e('0x23')](_0x447e('0x6c'),_0x5f3ae9[_0x447e('0xc')]),_0x447e('0x6d'),{'uri':_0x453295});})[_0x447e('0x6e')](function(_0x507382){logger[_0x447e('0x6f')](_0x447e('0x6a'),JSON[_0x447e('0x22')](_0x507382));});};exports['outbound']=function(_0x233c93,_0x30af10,_0x373d65,_0x5da456,_0x3eed46,_0x1fc673,_0x4d61ea){var _0x3aac36,_0x2f5fd5,_0x31a6d4,_0x47a0ae;_0x1fc673[_0x447e('0x55')]=intUtil[_0x447e('0x54')](_0x1fc673[_0x447e('0x55')]);_0x1fc673['serverUrl']=intUtil[_0x447e('0x54')](_0x1fc673[_0x447e('0x56')]);def[_0x447e('0x57')]=util['format']('%s/service/v4_1/rest.php',_0x1fc673[_0x447e('0x55')]);if(_0x4d61ea&&_0x4d61ea[_0x447e('0x70')]&&_0x4d61ea[_0x447e('0x70')]!==_0x447e('0x71')){logger['info'](_0x447e('0x72'),_0x447e('0x5a'));_0x30af10['recordingURL']=util[_0x447e('0x23')](_0x447e('0x5b'),_0x1fc673[_0x447e('0x56')],_0x30af10['uniqueid'],md5(_0x30af10['uniqueid']));}return getConnection(_0x1fc673)[_0x447e('0x2f')](function(_0x1131d1){_0x47a0ae=_0x1131d1;return getUser(_0x1fc673,_0x5da456[_0x447e('0xc')],_0x47a0ae);})[_0x447e('0x2f')](function(_0x5b1817){_0x3aac36=_0x5b1817;logger['info']('The\x20User\x20ID\x20is:',_0x3aac36['id']);return getEndUser(_0x1fc673,_0x30af10['destcalleridname'],_0x30af10['destcalleridnum'],_0x47a0ae);})[_0x447e('0x2f')](function(_0x41aaff){_0x2f5fd5=_0x41aaff;logger[_0x447e('0xa')](_0x447e('0x60'),_0x2f5fd5['id']);return getTicket(_0x1fc673,_0x3aac36,_0x2f5fd5,_0x373d65,_0x30af10,_0x373d65[_0x447e('0x61')],_0x47a0ae,'Outbound');})[_0x447e('0x2f')](function(_0x542714){_0x31a6d4=_0x542714;logger['info'](_0x447e('0x63'));logger[_0x447e('0xa')](_0x447e('0x64'),_0x31a6d4['id']);return setRelationship(_0x47a0ae,_0x3aac36,_0x31a6d4,_0x447e('0x65'));})[_0x447e('0x2f')](function(){return setRelationship(_0x47a0ae,_0x2f5fd5,_0x31a6d4,'contacts');})['then'](function(){return getServerInfo(_0x47a0ae);})[_0x447e('0x2f')](function(_0x51e474){var _0x43c29c=parseInt(_0x51e474[_0x447e('0x67')]['charAt'](0x0));var _0x497645=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1fc673['remoteUri'],_0x31a6d4['id']);if(_0x43c29c>0x6){_0x497645=util[_0x447e('0x23')](_0x447e('0x69'),_0x1fc673[_0x447e('0x55')],_0x31a6d4['id']);}logger['info'](_0x447e('0x72'),_0x447e('0x6b'));emit(util[_0x447e('0x23')](_0x447e('0x6c'),_0x5da456[_0x447e('0xc')]),_0x447e('0x6d'),{'uri':_0x497645});})[_0x447e('0x6e')](function(_0x1a2408){logger[_0x447e('0x6f')](_0x447e('0x72'),JSON[_0x447e('0x22')](_0x1a2408));});};exports['unmanaged']=function(_0x2d58b5,_0x4e1812,_0x456072,_0x25bec0,_0x3b9d38,_0x376728){var _0x1f54da,_0x551fe6,_0xf7f561,_0x20ca0a;_0x376728[_0x447e('0x55')]=intUtil[_0x447e('0x54')](_0x376728[_0x447e('0x55')]);_0x376728[_0x447e('0x56')]=intUtil[_0x447e('0x54')](_0x376728['serverUrl']);def[_0x447e('0x57')]=util['format'](_0x447e('0x58'),_0x376728['remoteUri']);if(_0x3b9d38&&_0x3b9d38[_0x447e('0x59')]){logger[_0x447e('0xa')]('['+_0x4e1812[_0x447e('0x73')][_0x447e('0x74')]()+']',_0x447e('0x5a'));_0x4e1812['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x376728[_0x447e('0x56')],_0x4e1812[_0x447e('0x5c')],md5(_0x4e1812['uniqueid']));}else{_0x4e1812['recordingURL']='';}return getConnection(_0x376728)[_0x447e('0x2f')](function(_0x24b46d){_0x20ca0a=_0x24b46d;if(!_[_0x447e('0x29')](_0x25bec0)){return getUser(_0x376728,_0x25bec0[_0x447e('0xc')],_0x20ca0a);}else{return getUser(_0x376728,null,_0x20ca0a);}})[_0x447e('0x2f')](function(_0x317ea5){_0x1f54da=_0x317ea5;logger[_0x447e('0xa')](_0x447e('0x5e'),_0x1f54da['id']);return getEndUser(_0x376728,_0x4e1812[_0x447e('0x5f')],_0x4e1812[_0x447e('0x75')],_0x20ca0a);})[_0x447e('0x2f')](function(_0x190ef8){_0x551fe6=_0x190ef8;logger['info'](_0x447e('0x60'),_0x551fe6['id']);return getTicket(_0x376728,_0x1f54da,_0x551fe6,_0x456072,_0x4e1812,_0x456072[_0x447e('0x61')],_0x20ca0a,_0x447e('0x62'));})[_0x447e('0x2f')](function(_0x12d2f3){_0xf7f561=_0x12d2f3;logger[_0x447e('0xa')](_0x447e('0x63'));logger[_0x447e('0xa')]('The\x20Ticket\x20ID\x20is:',_0xf7f561['id']);return setRelationship(_0x20ca0a,_0x1f54da,_0xf7f561,_0x447e('0x65'));})[_0x447e('0x2f')](function(){return setRelationship(_0x20ca0a,_0x551fe6,_0xf7f561,_0x447e('0x66'));})[_0x447e('0x2f')](function(){return getServerInfo(_0x20ca0a);})[_0x447e('0x6e')](function(_0x282c36){logger[_0x447e('0x6f')]('['+_0x4e1812[_0x447e('0x73')]['toUpperCase']()+']',JSON[_0x447e('0x22')](_0x282c36));});}; \ 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 a35970a..c911038 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 _0x6da4=['type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','test','lodash','getString','length'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6da4,0x65));var _0x46da=function(_0x38bc1c,_0x4984f4){_0x38bc1c=_0x38bc1c-0x0;var _0x4fd39f=_0x6da4[_0x38bc1c];return _0x4fd39f;};'use strict';var _=require(_0x46da('0x0'));var util=require('util');exports[_0x46da('0x1')]=function(_0x3c9732,_0x19a970,_0x1d752b){var _0x388df4=[];if(_0x3c9732[_0x46da('0x2')]>0x0){var _0x545d18=_['sortBy'](_0x3c9732,['id']);for(var _0x18ad7c=0x0;_0x18ad7c<_0x545d18[_0x46da('0x2')];_0x18ad7c++){var _0x4a678e=_0x545d18[_0x18ad7c];if(_0x4a678e[_0x46da('0x3')]===_0x46da('0x4')){_0x388df4[_0x46da('0x5')](_0x4a678e[_0x46da('0x6')]);}else if(_0x4a678e[_0x46da('0x3')]===_0x46da('0x7')&&_0x4a678e['variableName']){_0x19a970[_0x4a678e[_0x46da('0x8')]]&&_0x388df4[_0x46da('0x5')](_0x19a970[_0x4a678e[_0x46da('0x8')]][_0x46da('0x9')]());}else if(_0x4a678e['type']===_0x46da('0xa')&&_0x4a678e[_0x46da('0xb')]&&_0x4a678e[_0x46da('0xb')][_0x46da('0xc')]){_0x19a970[_0x4a678e['Variable']['name'][_0x46da('0xd')]()]&&_0x388df4[_0x46da('0x5')](_0x19a970[_0x4a678e['Variable'][_0x46da('0xc')]['toLowerCase']()][_0x46da('0x9')]());}else if(_0x4a678e[_0x46da('0x3')]===_0x46da('0xe')){if(_0x4a678e[_0x46da('0xf')]===_0x46da('0x4')&&_0x4a678e[_0x46da('0x10')]){_0x388df4['push'](util[_0x46da('0x11')](_0x46da('0x12'),_0x4a678e[_0x46da('0x10')],_0x4a678e[_0x46da('0x13')]));}else if(_0x4a678e[_0x46da('0xf')]===_0x46da('0x7')&&_0x4a678e[_0x46da('0x8')]&&_0x4a678e[_0x46da('0x10')]){_0x19a970[_0x4a678e[_0x46da('0x8')]]&&_0x388df4[_0x46da('0x5')](util['format']('%s:\x20%s',_0x4a678e['key'],_0x19a970[_0x4a678e[_0x46da('0x8')]]));}else if(_0x4a678e[_0x46da('0xf')]===_0x46da('0xa')&&_0x4a678e[_0x46da('0xb')]&&_0x4a678e[_0x46da('0xb')][_0x46da('0xc')]&&_0x4a678e[_0x46da('0x10')]){_0x19a970[_0x4a678e[_0x46da('0xb')][_0x46da('0xc')][_0x46da('0xd')]()]&&_0x388df4[_0x46da('0x5')](util[_0x46da('0x11')](_0x46da('0x12'),_0x4a678e[_0x46da('0x10')],_0x19a970[_0x4a678e[_0x46da('0xb')]['name']['toLowerCase']()]));}}}}return _0x388df4[_0x46da('0x14')](_0x1d752b);};exports[_0x46da('0x15')]=function(_0x51b52a){var _0x126d2a=_0x51b52a[_0x46da('0x16')](-0x1);if(_0x126d2a==='/'){_0x51b52a=_0x51b52a[_0x46da('0x17')](0x0,_0x51b52a[_0x46da('0x18')](_0x126d2a));}return _0x51b52a;};exports['validateEmail']=function(_0x208653){if(!_['isNil'](_0x208653)&&_0x208653!==''){var _0xff750e=/^(([^<>()\[\]\\.,;:\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 _0xff750e[_0x46da('0x19')](String(_0x208653)[_0x46da('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x29ce=['toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','lodash','util','length','sortBy','type','string','push','content','variableName','Variable','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x29ce,0x121));var _0xe29c=function(_0x47c09c,_0x169721){_0x47c09c=_0x47c09c-0x0;var _0x40cf8c=_0x29ce[_0x47c09c];return _0x40cf8c;};'use strict';var _=require(_0xe29c('0x0'));var util=require(_0xe29c('0x1'));exports['getString']=function(_0x432e55,_0x37222b,_0x27f4be){var _0x150e06=[];if(_0x432e55[_0xe29c('0x2')]>0x0){var _0x2dfcbd=_[_0xe29c('0x3')](_0x432e55,['id']);for(var _0x12114c=0x0;_0x12114c<_0x2dfcbd[_0xe29c('0x2')];_0x12114c++){var _0x5d2dd8=_0x2dfcbd[_0x12114c];if(_0x5d2dd8[_0xe29c('0x4')]===_0xe29c('0x5')){_0x150e06[_0xe29c('0x6')](_0x5d2dd8[_0xe29c('0x7')]);}else if(_0x5d2dd8['type']==='variable'&&_0x5d2dd8['variableName']){_0x37222b[_0x5d2dd8[_0xe29c('0x8')]]&&_0x150e06['push'](_0x37222b[_0x5d2dd8[_0xe29c('0x8')]]['toString']());}else if(_0x5d2dd8[_0xe29c('0x4')]==='customVariable'&&_0x5d2dd8['Variable']&&_0x5d2dd8[_0xe29c('0x9')][_0xe29c('0xa')]){_0x37222b[_0x5d2dd8[_0xe29c('0x9')]['name'][_0xe29c('0xb')]()]&&_0x150e06[_0xe29c('0x6')](_0x37222b[_0x5d2dd8[_0xe29c('0x9')]['name'][_0xe29c('0xb')]()][_0xe29c('0xc')]());}else if(_0x5d2dd8[_0xe29c('0x4')]===_0xe29c('0xd')){if(_0x5d2dd8[_0xe29c('0xe')]==='string'&&_0x5d2dd8[_0xe29c('0xf')]){_0x150e06[_0xe29c('0x6')](util[_0xe29c('0x10')](_0xe29c('0x11'),_0x5d2dd8[_0xe29c('0xf')],_0x5d2dd8[_0xe29c('0x12')]));}else if(_0x5d2dd8[_0xe29c('0xe')]===_0xe29c('0x13')&&_0x5d2dd8['variableName']&&_0x5d2dd8[_0xe29c('0xf')]){_0x37222b[_0x5d2dd8['variableName']]&&_0x150e06['push'](util['format']('%s:\x20%s',_0x5d2dd8['key'],_0x37222b[_0x5d2dd8[_0xe29c('0x8')]]));}else if(_0x5d2dd8[_0xe29c('0xe')]==='customVariable'&&_0x5d2dd8[_0xe29c('0x9')]&&_0x5d2dd8[_0xe29c('0x9')][_0xe29c('0xa')]&&_0x5d2dd8[_0xe29c('0xf')]){_0x37222b[_0x5d2dd8[_0xe29c('0x9')][_0xe29c('0xa')]['toLowerCase']()]&&_0x150e06[_0xe29c('0x6')](util[_0xe29c('0x10')](_0xe29c('0x11'),_0x5d2dd8[_0xe29c('0xf')],_0x37222b[_0x5d2dd8[_0xe29c('0x9')]['name']['toLowerCase']()]));}}}}return _0x150e06[_0xe29c('0x14')](_0x27f4be);};exports[_0xe29c('0x15')]=function(_0x2fe904){var _0x417ad4=_0x2fe904['slice'](-0x1);if(_0x417ad4==='/'){_0x2fe904=_0x2fe904['substring'](0x0,_0x2fe904[_0xe29c('0x16')](_0x417ad4));}return _0x2fe904;};exports[_0xe29c('0x17')]=function(_0x1d1bfa){if(!_[_0xe29c('0x18')](_0x1d1bfa)&&_0x1d1bfa!==''){var _0x5e39b4=/^(([^<>()\[\]\\.,;:\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 _0x5e39b4['test'](String(_0x1d1bfa)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 07fa1fc..830b82c 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x598058,_0x193439){var _0x253c54=function(_0x251dcd){while(--_0x251dcd){_0x598058['push'](_0x598058['shift']());}};_0x253c54(++_0x193439);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x2374b3,_0x491c78){var _0x284db3=function(_0x8bca3a){while(--_0x8bca3a){_0x2374b3['push'](_0x2374b3['shift']());}};_0x284db3(++_0x491c78);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index a1e9be8..38f0259 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 _0xfc29=['request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','Tags','name','getString','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','string','picklist','type','nameField','content','includes','customField','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash'];(function(_0x33ed20,_0x5701d8){var _0x3913d5=function(_0x2ecb65){while(--_0x2ecb65){_0x33ed20['push'](_0x33ed20['shift']());}};_0x3913d5(++_0x5701d8);}(_0xfc29,0x1cb));var _0x9fc2=function(_0xde05fa,_0x40647f){_0xde05fa=_0xde05fa-0x0;var _0x3ab672=_0xfc29[_0xde05fa];return _0x3ab672;};'use strict';var _=require(_0x9fc2('0x0'));var rp=require(_0x9fc2('0x1'));var md5=require(_0x9fc2('0x2'));var util=require(_0x9fc2('0x3'));var Redis=require(_0x9fc2('0x4'));var intUtil=require('./util');var config=require(_0x9fc2('0x5'));var logger=require(_0x9fc2('0x6'))(_0x9fc2('0x7'));config[_0x9fc2('0x8')]=_[_0x9fc2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9fc2('0xa'))(new Redis(config[_0x9fc2('0x8')]));function emit(_0x133714,_0x38302e,_0x157437){io['to'](_0x133714)[_0x9fc2('0xb')](_0x38302e,_0x157437);}var headers={'Content-Type':_0x9fc2('0xc'),'Accept':_0x9fc2('0xc')};function getTicket(_0x5359b9,_0x7b07f4,_0x50adf3,_0x20d674,_0x30510b){logger[_0x9fc2('0xd')](_0x9fc2('0xe'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x10'),_0x5359b9['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x50adf3['id'],'submitter_id':_0x7b07f4?_0x7b07f4['id']:undefined,'assignee_id':_0x7b07f4?_0x7b07f4['id']:undefined,'tags':getTags(_0x20d674[_0x9fc2('0x11')],_0x9fc2('0x12')),'subject':intUtil['getString'](_0x20d674['Subjects'],_0x30510b,'\x20'),'description':intUtil[_0x9fc2('0x13')](_0x20d674[_0x9fc2('0x14')],_0x30510b,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x20d674[_0x9fc2('0x14')],_0x30510b,'\x0a')}},getCustomFields(_0x20d674['Fields'],_0x30510b))}})['then'](function(_0x77abd9){logger['info'](_0x9fc2('0x15'));return _0x77abd9[_0x9fc2('0x16')];});}function getUser(_0x5a622d,_0x1f0015){if(intUtil[_0x9fc2('0x17')](_0x1f0015)){logger[_0x9fc2('0xd')](_0x9fc2('0x18'),_0x1f0015);return request({'uri':util['format']('%s/search.json',_0x5a622d[_0x9fc2('0x19')]),'qs':{'query':util[_0x9fc2('0xf')](_0x9fc2('0x1a'),_0x1f0015)}})[_0x9fc2('0x1b')](function(_0x542377){if(_0x542377[_0x9fc2('0x1c')]){logger['info']('Agent\x20found!');return _[_0x9fc2('0x1d')](_0x542377[_0x9fc2('0x1e')],{'email':_0x1f0015,'role':_0x9fc2('0x1f')});}else{logger[_0x9fc2('0xd')](_0x9fc2('0x20'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x21'),_0x5a622d['remoteUri'])})[_0x9fc2('0x1b')](function(_0x1d4fc8){logger[_0x9fc2('0xd')](_0x9fc2('0x22'));return _0x1d4fc8[_0x9fc2('0x23')];});}});}else{logger[_0x9fc2('0xd')](_0x9fc2('0x20'));return request({'uri':util['format'](_0x9fc2('0x21'),_0x5a622d[_0x9fc2('0x19')])})[_0x9fc2('0x1b')](function(_0x336393){logger[_0x9fc2('0xd')]('Admin\x20account\x20selected.');return _0x336393[_0x9fc2('0x23')];});}}function getEndUser(_0x385cd9,_0x7685c7,_0x362951){logger[_0x9fc2('0xd')](_0x9fc2('0x24'),_0x362951);return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x25'),_0x385cd9[_0x9fc2('0x19')]),'qs':{'query':util[_0x9fc2('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x362951)}})[_0x9fc2('0x1b')](function(_0x526944){var _0x27da0e;if(_0x526944['results'][_0x9fc2('0x26')]){_0x526944[_0x9fc2('0x1e')]=_[_0x9fc2('0x27')](_0x526944[_0x9fc2('0x1e')],{'suspended':![],'role':_0x9fc2('0x28')});if(_0x526944[_0x9fc2('0x1e')][_0x9fc2('0x26')]){_0x27da0e=_[_0x9fc2('0x29')](_0x526944[_0x9fc2('0x1e')]);}}if(_0x27da0e){logger[_0x9fc2('0xd')](_0x9fc2('0x2a'));return _0x27da0e;}else{logger[_0x9fc2('0xd')](_0x9fc2('0x2b'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x2c'),_0x385cd9['remoteUri']),'method':_0x9fc2('0x2d'),'body':{'user':{'role':_0x9fc2('0x28'),'name':util['format'](_0x9fc2('0x2e'),_0x7685c7||_0x362951),'phone':_0x362951}}})[_0x9fc2('0x1b')](function(_0x89b013){logger[_0x9fc2('0xd')](_0x9fc2('0x2f'));return _0x89b013[_0x9fc2('0x23')];});}});}function getAuth(_0x262110){var _0x46f4ce;if(_0x262110[_0x9fc2('0x30')]==='password'){_0x46f4ce=util['format'](_0x9fc2('0x31'),_0x262110['username'],_0x262110[_0x9fc2('0x32')]);}else if(_0x262110[_0x9fc2('0x30')]===_0x9fc2('0x33')){_0x46f4ce=util[_0x9fc2('0xf')](_0x9fc2('0x34'),_0x262110[_0x9fc2('0x35')],_0x262110[_0x9fc2('0x33')]);}return util['format'](_0x9fc2('0x36'),new Buffer(_0x46f4ce)[_0x9fc2('0x37')](_0x9fc2('0x38')));}function request(_0x286955){logger[_0x9fc2('0x39')](_0x9fc2('0x3a'),JSON[_0x9fc2('0x3b')](_0x286955));return rp(_[_0x9fc2('0x9')](_0x286955,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x266511,_0x4bdadd){var _0x1f1c2e=[];if(_0x266511&&_0x266511[_0x9fc2('0x26')]>0x0){_0x1f1c2e=_[_0x9fc2('0x3c')](_0x266511,_0x4bdadd);}return _0x1f1c2e;}function getCustomFields(_0x13ae46,_0x17b137){var _0x18d4c2=[];var _0x61a594={'custom_fields':[]};if(_0x13ae46[_0x9fc2('0x26')]>0x0){_['forEach'](_0x13ae46,function(_0x45fc28){if(_['includes']([_0x9fc2('0x3d'),_0x9fc2('0x3e')],_0x45fc28[_0x9fc2('0x3f')])&&_0x45fc28[_0x9fc2('0x40')]&&!_0x45fc28['customField']){_0x61a594[_0x45fc28['nameField']['toLowerCase']()]=_0x45fc28[_0x9fc2('0x41')][_0x9fc2('0x37')]();}else if(_[_0x9fc2('0x42')]([_0x9fc2('0x3d'),'picklist'],_0x45fc28[_0x9fc2('0x3f')])&&_0x45fc28['idField']&&_0x45fc28[_0x9fc2('0x43')]){_0x61a594['custom_fields'][_0x9fc2('0x44')]({'id':_0x45fc28[_0x9fc2('0x45')],'value':_0x45fc28[_0x9fc2('0x41')]['toString']()});}else if(_0x45fc28[_0x9fc2('0x3f')]===_0x9fc2('0x46')&&_0x45fc28[_0x9fc2('0x47')]&&_0x45fc28['idField']&&_0x45fc28['customField']){_0x17b137[_0x45fc28[_0x9fc2('0x47')]]&&_0x61a594['custom_fields'][_0x9fc2('0x44')]({'id':_0x45fc28[_0x9fc2('0x45')],'value':_0x17b137[_0x45fc28['variableName']][_0x9fc2('0x37')]()});}else if(_0x45fc28[_0x9fc2('0x3f')]===_0x9fc2('0x48')&&_0x45fc28[_0x9fc2('0x49')]&&_0x45fc28[_0x9fc2('0x49')][_0x9fc2('0x12')]&&_0x45fc28[_0x9fc2('0x45')]&&_0x45fc28['customField']){_0x17b137[_0x45fc28['Variable'][_0x9fc2('0x12')][_0x9fc2('0x4a')]()]&&_0x61a594['custom_fields'][_0x9fc2('0x44')]({'id':_0x45fc28[_0x9fc2('0x45')],'value':_0x17b137[_0x45fc28[_0x9fc2('0x49')][_0x9fc2('0x12')]['toLowerCase']()][_0x9fc2('0x37')]()});}});}return _0x61a594;}exports[_0x9fc2('0x4b')]=function(_0x4bd528,_0x5ab63b,_0x284fe1,_0xc8eccb,_0x2336ef,_0x25fca3){var _0x1bf404,_0x32602e;_0x25fca3[_0x9fc2('0x19')]=intUtil[_0x9fc2('0x4c')](_0x25fca3['remoteUri']);_0x25fca3[_0x9fc2('0x4d')]=intUtil[_0x9fc2('0x4c')](_0x25fca3['serverUrl']);if(_0x2336ef&&_0x2336ef[_0x9fc2('0x4e')]){logger['info'](_0x9fc2('0x4f'),_0x9fc2('0x50'));_0x5ab63b[_0x9fc2('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25fca3[_0x9fc2('0x4d')],_0x5ab63b['uniqueid'],md5(_0x5ab63b[_0x9fc2('0x52')]));}else{_0x5ab63b['recordingURL']='';}headers['Authorization']=getAuth(_0x25fca3);return getUser(_0x25fca3,_0xc8eccb[_0x9fc2('0x53')])[_0x9fc2('0x1b')](function(_0xc5e845){_0x1bf404=_0xc5e845;logger[_0x9fc2('0xd')](_0x9fc2('0x54'),_0x1bf404['id']);return getEndUser(_0x25fca3,_0x5ab63b[_0x9fc2('0x55')],_0x5ab63b[_0x9fc2('0x56')]);})[_0x9fc2('0x1b')](function(_0x33cb7d){_0x32602e=_0x33cb7d;logger[_0x9fc2('0xd')](_0x9fc2('0x57'),_0x32602e['id']);return getTicket(_0x25fca3,_0x1bf404,_0x32602e,_0x284fe1,_0x5ab63b);})[_0x9fc2('0x1b')](function(_0x26af26){if(_0x26af26){logger[_0x9fc2('0xd')]('The\x20Ticket\x20ID\x20is:',_0x26af26['id']);switch(_0x25fca3[_0x9fc2('0x3f')]){case _0x9fc2('0x58'):logger[_0x9fc2('0xd')](_0x9fc2('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x59'),_0x25fca3[_0x9fc2('0x19')],_0x1bf404['id'],_0x26af26['id']),'method':_0x9fc2('0x2d')});case _0x9fc2('0x5a'):logger[_0x9fc2('0xd')](_0x9fc2('0x4f'),_0x9fc2('0x5b'));emit(util[_0x9fc2('0xf')](_0x9fc2('0x5c'),_0xc8eccb[_0x9fc2('0x12')]),_0x9fc2('0x5d'),{'uri':util[_0x9fc2('0xf')](_0x9fc2('0x5e'),_0x25fca3[_0x9fc2('0x19')][_0x9fc2('0x5f')](_0x9fc2('0x60'),''),_0x26af26['id'])});break;default:logger[_0x9fc2('0x61')](_0x9fc2('0x4f'),_0x9fc2('0x62'));}}})[_0x9fc2('0x63')](function(_0x2561f5){logger[_0x9fc2('0x61')](_0x9fc2('0x64'),util[_0x9fc2('0x65')](_0x2561f5,{'showHidden':!![],'depth':null}));});};exports[_0x9fc2('0x66')]=function(_0x445efa,_0x26bdfc,_0x47bfa9,_0x6489b,_0x1636fd,_0x2d5f72,_0x1614c2){var _0x5805b8,_0xfbf702;_0x2d5f72['remoteUri']=intUtil['stripTrailingSlash'](_0x2d5f72['remoteUri']);_0x2d5f72[_0x9fc2('0x4d')]=intUtil['stripTrailingSlash'](_0x2d5f72[_0x9fc2('0x4d')]);if(_0x1614c2&&_0x1614c2[_0x9fc2('0x67')]&&_0x1614c2['recordingFormat']!==_0x9fc2('0x68')){logger[_0x9fc2('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x26bdfc[_0x9fc2('0x51')]=util[_0x9fc2('0xf')](_0x9fc2('0x69'),_0x2d5f72[_0x9fc2('0x4d')],_0x26bdfc['uniqueid'],md5(_0x26bdfc['uniqueid']));}headers['Authorization']=getAuth(_0x2d5f72);return getUser(_0x2d5f72,_0x6489b[_0x9fc2('0x53')])[_0x9fc2('0x1b')](function(_0x39fe20){_0x5805b8=_0x39fe20;logger[_0x9fc2('0xd')](_0x9fc2('0x54'),_0x5805b8['id']);return getEndUser(_0x2d5f72,_0x26bdfc[_0x9fc2('0x6a')],_0x26bdfc[_0x9fc2('0x6b')]);})[_0x9fc2('0x1b')](function(_0x449387){_0xfbf702=_0x449387;logger['info'](_0x9fc2('0x57'),_0xfbf702['id']);return getTicket(_0x2d5f72,_0x5805b8,_0xfbf702,_0x47bfa9,_0x26bdfc);})[_0x9fc2('0x1b')](function(_0x79a102){if(_0x79a102){logger[_0x9fc2('0xd')](_0x9fc2('0x6c'),_0x79a102['id']);switch(_0x2d5f72[_0x9fc2('0x3f')]){case _0x9fc2('0x58'):logger['info'](_0x9fc2('0x6d'),_0x9fc2('0x6e'));return request({'uri':util[_0x9fc2('0xf')](_0x9fc2('0x59'),_0x2d5f72[_0x9fc2('0x19')],_0x5805b8['id'],_0x79a102['id']),'method':_0x9fc2('0x2d')});case _0x9fc2('0x5a'):logger['info'](_0x9fc2('0x6d'),_0x9fc2('0x5b'));emit(util[_0x9fc2('0xf')](_0x9fc2('0x5c'),_0x6489b[_0x9fc2('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x9fc2('0x5e'),_0x2d5f72[_0x9fc2('0x19')]['replace']('/api/v2',''),_0x79a102['id'])});break;default:logger[_0x9fc2('0x61')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x9fc2('0x63')](function(_0x248ce3){logger[_0x9fc2('0x61')](_0x9fc2('0x6f'),util[_0x9fc2('0x65')](_0x248ce3,{'showHidden':!![],'depth':null}));});};exports[_0x9fc2('0x70')]=function(_0x365be8,_0x135ec5,_0xaf5812,_0x2a9189,_0x2f52e1,_0x3e443d){var _0x558f60,_0x2af437;_0x3e443d[_0x9fc2('0x19')]=intUtil[_0x9fc2('0x4c')](_0x3e443d['remoteUri']);_0x3e443d[_0x9fc2('0x4d')]=intUtil['stripTrailingSlash'](_0x3e443d[_0x9fc2('0x4d')]);if(_0x2f52e1&&_0x2f52e1[_0x9fc2('0x4e')]){logger['info']('['+_0x135ec5[_0x9fc2('0x71')][_0x9fc2('0x72')]()+']',_0x9fc2('0x50'));_0x135ec5[_0x9fc2('0x51')]=util[_0x9fc2('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e443d[_0x9fc2('0x4d')],_0x135ec5[_0x9fc2('0x52')],md5(_0x135ec5[_0x9fc2('0x52')]));}else{_0x135ec5['recordingURL']='';}headers['Authorization']=getAuth(_0x3e443d);return getUser(_0x3e443d)[_0x9fc2('0x1b')](function(_0x27169b){_0x558f60=_0x27169b;logger[_0x9fc2('0xd')](_0x9fc2('0x54'),_0x558f60['id']);return getEndUser(_0x3e443d,_0x135ec5[_0x9fc2('0x55')],_0x135ec5[_0x9fc2('0x56')]);})[_0x9fc2('0x1b')](function(_0x7ad9fd){_0x2af437=_0x7ad9fd;logger[_0x9fc2('0xd')](_0x9fc2('0x57'),_0x2af437['id']);return getTicket(_0x3e443d,_0x558f60,_0x2af437,_0xaf5812,_0x135ec5);})['then'](function(_0x21ba3f){if(_0x21ba3f){logger[_0x9fc2('0xd')](_0x9fc2('0x6c'),_0x21ba3f['id']);}})[_0x9fc2('0x63')](function(_0x2eb20c){logger[_0x9fc2('0x61')]('['+_0x135ec5[_0x9fc2('0x71')][_0x9fc2('0x72')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2eb20c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe876=['The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','replace','error','[QUEUE]','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Descriptions','Fields','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email'];(function(_0x147278,_0x772fbd){var _0x4e4a74=function(_0x156b2b){while(--_0x156b2b){_0x147278['push'](_0x147278['shift']());}};_0x4e4a74(++_0x772fbd);}(_0xe876,0x177));var _0x6e87=function(_0x50cb69,_0x57b43f){_0x50cb69=_0x50cb69-0x0;var _0x145b45=_0xe876[_0x50cb69];return _0x145b45;};'use strict';var _=require(_0x6e87('0x0'));var rp=require(_0x6e87('0x1'));var md5=require('md5');var util=require(_0x6e87('0x2'));var Redis=require(_0x6e87('0x3'));var intUtil=require('./util');var config=require(_0x6e87('0x4'));var logger=require(_0x6e87('0x5'))(_0x6e87('0x6'));config[_0x6e87('0x7')]=_[_0x6e87('0x8')](config[_0x6e87('0x7')],{'host':_0x6e87('0x9'),'port':0x18eb});var io=require(_0x6e87('0xa'))(new Redis(config[_0x6e87('0x7')]));function emit(_0x4f922d,_0x378dc8,_0x1fea97){io['to'](_0x4f922d)[_0x6e87('0xb')](_0x378dc8,_0x1fea97);}var headers={'Content-Type':_0x6e87('0xc'),'Accept':_0x6e87('0xc')};function getTicket(_0x3d2181,_0x4cebf1,_0x5cbc5b,_0x2c7d34,_0x4264ac){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x6e87('0xd')](_0x6e87('0xe'),_0x3d2181[_0x6e87('0xf')]),'method':_0x6e87('0x10'),'body':{'ticket':_[_0x6e87('0x11')]({'requester_id':_0x5cbc5b['id'],'submitter_id':_0x4cebf1?_0x4cebf1['id']:undefined,'assignee_id':_0x4cebf1?_0x4cebf1['id']:undefined,'tags':getTags(_0x2c7d34['Tags'],_0x6e87('0x12')),'subject':intUtil['getString'](_0x2c7d34['Subjects'],_0x4264ac,'\x20'),'description':intUtil[_0x6e87('0x13')](_0x2c7d34[_0x6e87('0x14')],_0x4264ac,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6e87('0x13')](_0x2c7d34[_0x6e87('0x14')],_0x4264ac,'\x0a')}},getCustomFields(_0x2c7d34[_0x6e87('0x15')],_0x4264ac))}})['then'](function(_0x3f7750){logger[_0x6e87('0x16')](_0x6e87('0x17'));return _0x3f7750[_0x6e87('0x18')];});}function getUser(_0x559def,_0x293350){if(intUtil[_0x6e87('0x19')](_0x293350)){logger['info'](_0x6e87('0x1a'),_0x293350);return request({'uri':util['format'](_0x6e87('0x1b'),_0x559def['remoteUri']),'qs':{'query':util['format'](_0x6e87('0x1c'),_0x293350)}})[_0x6e87('0x1d')](function(_0x3e0dee){if(_0x3e0dee['count']){logger[_0x6e87('0x16')](_0x6e87('0x1e'));return _[_0x6e87('0x1f')](_0x3e0dee['results'],{'email':_0x293350,'role':_0x6e87('0x20')});}else{logger[_0x6e87('0x16')](_0x6e87('0x21'));return request({'uri':util[_0x6e87('0xd')](_0x6e87('0x22'),_0x559def[_0x6e87('0xf')])})['then'](function(_0x56897f){logger['info']('Admin\x20account\x20selected.');return _0x56897f[_0x6e87('0x23')];});}});}else{logger[_0x6e87('0x16')](_0x6e87('0x21'));return request({'uri':util[_0x6e87('0xd')](_0x6e87('0x22'),_0x559def[_0x6e87('0xf')])})['then'](function(_0xc8f31a){logger[_0x6e87('0x16')](_0x6e87('0x24'));return _0xc8f31a[_0x6e87('0x23')];});}}function getEndUser(_0x8270eb,_0xbc414c,_0x52b00d){logger[_0x6e87('0x16')]('Searching\x20enduser\x20with\x20phone',_0x52b00d);return request({'uri':util[_0x6e87('0xd')](_0x6e87('0x1b'),_0x8270eb[_0x6e87('0xf')]),'qs':{'query':util['format'](_0x6e87('0x25'),_0x52b00d)}})[_0x6e87('0x1d')](function(_0xdedb1c){var _0x17e7b7;if(_0xdedb1c[_0x6e87('0x26')]['length']){_0xdedb1c[_0x6e87('0x26')]=_[_0x6e87('0x27')](_0xdedb1c['results'],{'suspended':![],'role':_0x6e87('0x28')});if(_0xdedb1c['results'][_0x6e87('0x29')]){_0x17e7b7=_[_0x6e87('0x2a')](_0xdedb1c[_0x6e87('0x26')]);}}if(_0x17e7b7){logger[_0x6e87('0x16')](_0x6e87('0x2b'));return _0x17e7b7;}else{logger['info'](_0x6e87('0x2c'));return request({'uri':util[_0x6e87('0xd')](_0x6e87('0x2d'),_0x8270eb[_0x6e87('0xf')]),'method':'POST','body':{'user':{'role':_0x6e87('0x28'),'name':util[_0x6e87('0xd')](_0x6e87('0x2e'),_0xbc414c||_0x52b00d),'phone':_0x52b00d}}})[_0x6e87('0x1d')](function(_0x56f9e5){logger['info'](_0x6e87('0x2f'));return _0x56f9e5[_0x6e87('0x23')];});}});}function getAuth(_0x3e4d00){var _0x27a1ea;if(_0x3e4d00[_0x6e87('0x30')]===_0x6e87('0x31')){_0x27a1ea=util['format']('%s:%s',_0x3e4d00[_0x6e87('0x32')],_0x3e4d00[_0x6e87('0x31')]);}else if(_0x3e4d00[_0x6e87('0x30')]===_0x6e87('0x33')){_0x27a1ea=util[_0x6e87('0xd')](_0x6e87('0x34'),_0x3e4d00['username'],_0x3e4d00[_0x6e87('0x33')]);}return util[_0x6e87('0xd')](_0x6e87('0x35'),new Buffer(_0x27a1ea)[_0x6e87('0x36')]('base64'));}function request(_0x43542f){logger['debug'](_0x6e87('0x37'),JSON[_0x6e87('0x38')](_0x43542f));return rp(_['defaults'](_0x43542f,{'method':_0x6e87('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3a4f08,_0x358d8a){var _0x58638d=[];if(_0x3a4f08&&_0x3a4f08[_0x6e87('0x29')]>0x0){_0x58638d=_[_0x6e87('0x3a')](_0x3a4f08,_0x358d8a);}return _0x58638d;}function getCustomFields(_0x50089b,_0x105f9e){var _0xdd2f80=[];var _0x251c3c={'custom_fields':[]};if(_0x50089b['length']>0x0){_['forEach'](_0x50089b,function(_0x5ca157){if(_[_0x6e87('0x3b')]([_0x6e87('0x3c'),_0x6e87('0x3d')],_0x5ca157[_0x6e87('0x3e')])&&_0x5ca157[_0x6e87('0x3f')]&&!_0x5ca157[_0x6e87('0x40')]){_0x251c3c[_0x5ca157['nameField'][_0x6e87('0x41')]()]=_0x5ca157[_0x6e87('0x42')][_0x6e87('0x36')]();}else if(_[_0x6e87('0x3b')]([_0x6e87('0x3c'),_0x6e87('0x3d')],_0x5ca157['type'])&&_0x5ca157[_0x6e87('0x43')]&&_0x5ca157[_0x6e87('0x40')]){_0x251c3c[_0x6e87('0x44')][_0x6e87('0x45')]({'id':_0x5ca157[_0x6e87('0x43')],'value':_0x5ca157[_0x6e87('0x42')][_0x6e87('0x36')]()});}else if(_0x5ca157[_0x6e87('0x3e')]===_0x6e87('0x46')&&_0x5ca157[_0x6e87('0x47')]&&_0x5ca157['idField']&&_0x5ca157[_0x6e87('0x40')]){_0x105f9e[_0x5ca157[_0x6e87('0x47')]]&&_0x251c3c[_0x6e87('0x44')][_0x6e87('0x45')]({'id':_0x5ca157[_0x6e87('0x43')],'value':_0x105f9e[_0x5ca157[_0x6e87('0x47')]]['toString']()});}else if(_0x5ca157[_0x6e87('0x3e')]==='customVariable'&&_0x5ca157[_0x6e87('0x48')]&&_0x5ca157[_0x6e87('0x48')][_0x6e87('0x12')]&&_0x5ca157[_0x6e87('0x43')]&&_0x5ca157['customField']){_0x105f9e[_0x5ca157[_0x6e87('0x48')]['name']['toLowerCase']()]&&_0x251c3c[_0x6e87('0x44')][_0x6e87('0x45')]({'id':_0x5ca157[_0x6e87('0x43')],'value':_0x105f9e[_0x5ca157[_0x6e87('0x48')]['name'][_0x6e87('0x41')]()][_0x6e87('0x36')]()});}});}return _0x251c3c;}exports['queue']=function(_0x56666f,_0x4e5ffe,_0x5c93fa,_0x38a045,_0x4c7b06,_0x58681d){var _0x317431,_0x28d0a3;_0x58681d[_0x6e87('0xf')]=intUtil[_0x6e87('0x49')](_0x58681d['remoteUri']);_0x58681d[_0x6e87('0x4a')]=intUtil[_0x6e87('0x49')](_0x58681d[_0x6e87('0x4a')]);if(_0x4c7b06&&_0x4c7b06[_0x6e87('0x4b')]){logger[_0x6e87('0x16')]('[QUEUE]',_0x6e87('0x4c'));_0x4e5ffe[_0x6e87('0x4d')]=util[_0x6e87('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58681d[_0x6e87('0x4a')],_0x4e5ffe['uniqueid'],md5(_0x4e5ffe[_0x6e87('0x4e')]));}else{_0x4e5ffe['recordingURL']='';}headers[_0x6e87('0x4f')]=getAuth(_0x58681d);return getUser(_0x58681d,_0x38a045[_0x6e87('0x50')])[_0x6e87('0x1d')](function(_0x2dc525){_0x317431=_0x2dc525;logger['info'](_0x6e87('0x51'),_0x317431['id']);return getEndUser(_0x58681d,_0x4e5ffe[_0x6e87('0x52')],_0x4e5ffe[_0x6e87('0x53')]);})[_0x6e87('0x1d')](function(_0x10cc62){_0x28d0a3=_0x10cc62;logger[_0x6e87('0x16')]('The\x20Enduser\x20ID\x20is:',_0x28d0a3['id']);return getTicket(_0x58681d,_0x317431,_0x28d0a3,_0x5c93fa,_0x4e5ffe);})['then'](function(_0x10e0c3){if(_0x10e0c3){logger['info'](_0x6e87('0x54'),_0x10e0c3['id']);switch(_0x58681d[_0x6e87('0x3e')]){case _0x6e87('0x55'):logger[_0x6e87('0x16')]('[QUEUE]',_0x6e87('0x56'));return request({'uri':util[_0x6e87('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x58681d[_0x6e87('0xf')],_0x317431['id'],_0x10e0c3['id']),'method':'POST'});case _0x6e87('0x57'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6e87('0xd')](_0x6e87('0x58'),_0x38a045[_0x6e87('0x12')]),_0x6e87('0x59'),{'uri':util[_0x6e87('0xd')]('%s/agent/tickets/%s',_0x58681d[_0x6e87('0xf')][_0x6e87('0x5a')]('/api/v2',''),_0x10e0c3['id'])});break;default:logger[_0x6e87('0x5b')](_0x6e87('0x5c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x6e87('0x5d')](function(_0x15c3f6){logger[_0x6e87('0x5b')](_0x6e87('0x5e'),util[_0x6e87('0x5f')](_0x15c3f6,{'showHidden':!![],'depth':null}));});};exports[_0x6e87('0x60')]=function(_0x3c7434,_0x38781f,_0x4d92c3,_0x3cbb1d,_0x593b25,_0xf68bb7,_0x495b64){var _0x295ed6,_0x3aaeb8;_0xf68bb7['remoteUri']=intUtil['stripTrailingSlash'](_0xf68bb7[_0x6e87('0xf')]);_0xf68bb7[_0x6e87('0x4a')]=intUtil['stripTrailingSlash'](_0xf68bb7[_0x6e87('0x4a')]);if(_0x495b64&&_0x495b64[_0x6e87('0x61')]&&_0x495b64[_0x6e87('0x61')]!==_0x6e87('0x62')){logger[_0x6e87('0x16')](_0x6e87('0x63'),_0x6e87('0x4c'));_0x38781f[_0x6e87('0x4d')]=util[_0x6e87('0xd')](_0x6e87('0x64'),_0xf68bb7['serverUrl'],_0x38781f[_0x6e87('0x4e')],md5(_0x38781f['uniqueid']));}headers['Authorization']=getAuth(_0xf68bb7);return getUser(_0xf68bb7,_0x3cbb1d[_0x6e87('0x50')])[_0x6e87('0x1d')](function(_0x34d1ee){_0x295ed6=_0x34d1ee;logger['info'](_0x6e87('0x51'),_0x295ed6['id']);return getEndUser(_0xf68bb7,_0x38781f[_0x6e87('0x65')],_0x38781f[_0x6e87('0x66')]);})[_0x6e87('0x1d')](function(_0x3f9aff){_0x3aaeb8=_0x3f9aff;logger[_0x6e87('0x16')](_0x6e87('0x67'),_0x3aaeb8['id']);return getTicket(_0xf68bb7,_0x295ed6,_0x3aaeb8,_0x4d92c3,_0x38781f);})[_0x6e87('0x1d')](function(_0x157367){if(_0x157367){logger[_0x6e87('0x16')]('The\x20Ticket\x20ID\x20is:',_0x157367['id']);switch(_0xf68bb7['type']){case _0x6e87('0x55'):logger[_0x6e87('0x16')](_0x6e87('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x6e87('0x68'),_0xf68bb7[_0x6e87('0xf')],_0x295ed6['id'],_0x157367['id']),'method':'POST'});case _0x6e87('0x57'):logger['info']('[OUTBOUND]',_0x6e87('0x69'));emit(util[_0x6e87('0xd')](_0x6e87('0x58'),_0x3cbb1d[_0x6e87('0x12')]),_0x6e87('0x59'),{'uri':util['format'](_0x6e87('0x6a'),_0xf68bb7['remoteUri']['replace'](_0x6e87('0x6b'),''),_0x157367['id'])});break;default:logger[_0x6e87('0x5b')](_0x6e87('0x63'),_0x6e87('0x6c'));}}})[_0x6e87('0x5d')](function(_0x37ac4c){logger[_0x6e87('0x5b')](_0x6e87('0x6d'),util[_0x6e87('0x5f')](_0x37ac4c,{'showHidden':!![],'depth':null}));});};exports[_0x6e87('0x6e')]=function(_0x29fdb9,_0x336f8e,_0x493e95,_0x3c2853,_0x581325,_0x1788da){var _0x305c15,_0x3f8bdf;_0x1788da['remoteUri']=intUtil[_0x6e87('0x49')](_0x1788da[_0x6e87('0xf')]);_0x1788da[_0x6e87('0x4a')]=intUtil[_0x6e87('0x49')](_0x1788da['serverUrl']);if(_0x581325&&_0x581325['monitor_format']){logger['info']('['+_0x336f8e[_0x6e87('0x6f')][_0x6e87('0x70')]()+']',_0x6e87('0x4c'));_0x336f8e['recordingURL']=util[_0x6e87('0xd')](_0x6e87('0x64'),_0x1788da[_0x6e87('0x4a')],_0x336f8e[_0x6e87('0x4e')],md5(_0x336f8e[_0x6e87('0x4e')]));}else{_0x336f8e[_0x6e87('0x4d')]='';}headers[_0x6e87('0x4f')]=getAuth(_0x1788da);return getUser(_0x1788da)[_0x6e87('0x1d')](function(_0x35d620){_0x305c15=_0x35d620;logger['info'](_0x6e87('0x51'),_0x305c15['id']);return getEndUser(_0x1788da,_0x336f8e[_0x6e87('0x52')],_0x336f8e[_0x6e87('0x53')]);})[_0x6e87('0x1d')](function(_0x59c2c7){_0x3f8bdf=_0x59c2c7;logger[_0x6e87('0x16')]('The\x20Enduser\x20ID\x20is:',_0x3f8bdf['id']);return getTicket(_0x1788da,_0x305c15,_0x3f8bdf,_0x493e95,_0x336f8e);})[_0x6e87('0x1d')](function(_0x33b705){if(_0x33b705){logger[_0x6e87('0x16')]('The\x20Ticket\x20ID\x20is:',_0x33b705['id']);}})[_0x6e87('0x5d')](function(_0x7f5760){logger[_0x6e87('0x5b')]('['+_0x336f8e[_0x6e87('0x6f')][_0x6e87('0x70')]()+']'+_0x6e87('0x71'),util[_0x6e87('0x5f')](_0x7f5760,{'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 3942556..5d8b6ec 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 _0x0442=['Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','zoho.eu','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','variableName','toString','customVariable','Variable','name','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientSecret','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','data','code','SUCCESS','details','startCase','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Owner','profile','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0442,0x1e2));var _0x2044=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x0442[_0x2a55f8];return _0x245efd;};'use strict';var _=require(_0x2044('0x0'));var rp=require(_0x2044('0x1'));var md5=require(_0x2044('0x2'));var util=require('util');var intUtil=require(_0x2044('0x3'));var moment=require(_0x2044('0x4'));var Redis=require('ioredis');var BPromise=require(_0x2044('0x5'));var config=require(_0x2044('0x6'));var logger=require(_0x2044('0x7'))('zoho');config[_0x2044('0x8')]=_['defaults'](config[_0x2044('0x8')],{'host':_0x2044('0x9'),'port':0x18eb});var io=require(_0x2044('0xa'))(new Redis(config[_0x2044('0x8')]));function emit(_0x215138,_0x3c4680,_0x3fd1a3){io['to'](_0x215138)[_0x2044('0xb')](_0x3c4680,_0x3fd1a3);}function request(_0x3abf0b){logger[_0x2044('0xc')](_0x2044('0xd'),JSON['stringify'](_0x3abf0b));return rp(_0x3abf0b);}function getCustomFields(_0x2e996f,_0x2c5c9f){var _0x507a2e={};if(_0x2e996f[_0x2044('0xe')]>0x0){_[_0x2044('0xf')](_0x2e996f,function(_0x3adf97){if(_[_0x2044('0x10')]([_0x2044('0x11'),_0x2044('0x12')],_0x3adf97[_0x2044('0x13')])&&_0x3adf97[_0x2044('0x14')]){_0x507a2e[_0x3adf97[_0x2044('0x14')]]=_0x3adf97['content']['toString']();}else if(_0x3adf97[_0x2044('0x13')]==='variable'&&_0x3adf97['variableName']&&_0x3adf97[_0x2044('0x14')]&&_0x2c5c9f[_0x3adf97[_0x2044('0x15')]]){_0x507a2e[_0x3adf97[_0x2044('0x14')]]=_0x2c5c9f[_0x3adf97['variableName']][_0x2044('0x16')]();}else if(_0x3adf97[_0x2044('0x13')]===_0x2044('0x17')&&_0x3adf97[_0x2044('0x18')]&&_0x3adf97[_0x2044('0x18')][_0x2044('0x19')]&&_0x3adf97[_0x2044('0x14')]&&_0x2c5c9f[_0x3adf97[_0x2044('0x18')][_0x2044('0x19')]['toLowerCase']()]){_0x507a2e[_0x3adf97[_0x2044('0x14')]]=_0x2c5c9f[_0x3adf97[_0x2044('0x18')][_0x2044('0x19')]['toLowerCase']()][_0x2044('0x16')]();}});}return _0x507a2e;}function getName(_0x5083d6){if(_0x5083d6[_0x2044('0x1a')]('\x20')>0x0){var _0x2ad5dc=_0x5083d6[_0x2044('0x1b')](/ (.+)/);if(_0x2ad5dc[0x1]){return _0x2ad5dc;}}return[_0x5083d6,_0x5083d6];}var accountsTokens={};function getAccessToken(_0x1ce6b7){return new Promise(function(_0x51a970,_0xb1c945){if(!_[_0x2044('0x1c')](accountsTokens[_0x1ce6b7['id']])&&!_[_0x2044('0x1c')](accountsTokens[_0x1ce6b7['id']][_0x2044('0x1d')])){if(moment()[_0x2044('0x1e')](accountsTokens[_0x1ce6b7['id']][_0x2044('0x1f')])){_0x51a970(accountsTokens[_0x1ce6b7['id']][_0x2044('0x1d')]);}}var _0x47594b;switch(_0x1ce6b7[_0x2044('0x20')]){case'US':_0x47594b=_0x2044('0x21');break;case'AU':_0x47594b=_0x2044('0x22');break;case'EU':_0x47594b=_0x2044('0x23');break;case'IN':_0x47594b=_0x2044('0x24');break;case'CN':_0x47594b='https://accounts.zoho.com.cn';break;default:_0x47594b=_0x2044('0x23');break;}var _0x363d59={'method':'POST','uri':_0x47594b+'/oauth/v2/token','qs':{'refresh_token':_0x1ce6b7[_0x2044('0x25')],'client_id':_0x1ce6b7['clientId'],'client_secret':_0x1ce6b7[_0x2044('0x26')],'grant_type':_0x2044('0x27')},'json':!![]};return rp(_0x363d59)['then'](function(_0x2ca1e8){accountsTokens[_0x1ce6b7['id']]={'access_token':_0x2ca1e8[_0x2044('0x1d')],'expires_in':moment()['add'](_0x2ca1e8[_0x2044('0x1f')],_0x2044('0x28'))};_0x51a970(_0x2ca1e8[_0x2044('0x1d')]);})[_0x2044('0x29')](function(_0x401166){logger[_0x2044('0x2a')](_0x2044('0x2b'),_0x401166[_0x2044('0x2c')]);_0xb1c945(_0x401166);});});}function getUser(_0x360972,_0x107e85,_0x4cf908,_0xe3ac1c){logger[_0x2044('0x2d')](_0x2044('0x2e'));return request({'method':_0x2044('0x2f'),'uri':util[_0x2044('0x30')](_0x2044('0x31'),_0x107e85),'qs':{'type':_0x2044('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x360972},'json':!![]})[_0x2044('0x33')](function(_0xd9fff){if(_0xd9fff['users']){var _0x395009=-0x1;if(_[_0x2044('0x34')](_0xd9fff[_0x2044('0x35')])){if(!_[_0x2044('0x1c')](_0xe3ac1c)){_0x395009=_[_0x2044('0x36')](_0xd9fff[_0x2044('0x35')],function(_0x587620){return _0x587620[_0x2044('0x37')]===_0xe3ac1c;});}if(_0x395009>=0x0){logger[_0x2044('0x2d')](_0x2044('0x38'));}else{logger[_0x2044('0x2d')](_0x2044('0x39'));_0x395009=_[_0x2044('0x36')](_0xd9fff[_0x2044('0x35')],function(_0x2a8610){return _0x2a8610['profile'][_0x2044('0x19')]===_0x2044('0x3a');});}return _0xd9fff[_0x2044('0x35')][_0x395009];}else{if(_0xd9fff['user']['profile'][_0x2044('0x19')]===_0x2044('0x3a')){logger['info'](_0x2044('0x39'));user=_0xd9fff[_0x2044('0x3b')];return user;}else{logger[_0x2044('0x2a')](_0x2044('0x3c'),JSON[_0x2044('0x3d')](_0xd9fff));throw new Error(_0x2044('0x3e')+JSON[_0x2044('0x3d')](_0xd9fff));}}}else{logger[_0x2044('0x2a')](_0x2044('0x3c'),JSON[_0x2044('0x3d')](_0xd9fff));throw new Error(_0x2044('0x3e')+JSON[_0x2044('0x3d')](_0xd9fff));}})[_0x2044('0x29')](function(_0x1ada19){console[_0x2044('0x2a')](_0x1ada19);});}function getZohoUser(_0x40f598,_0x365fda){return new BPromise(function(_0x64cbb9,_0x2586af){request(_0x40f598)['then'](function(_0x46fae9){var _0xcdee72=null;if(_0x46fae9){_0xcdee72=_0x46fae9['data'][0x0];_0xcdee72[_0x2044('0x3f')]=_0x365fda;}_0x64cbb9(_0xcdee72);})[_0x2044('0x29')](function(_0xac2175){_0x2586af(_0xac2175);});});}function createEndUser(_0x389cee,_0x5240d9,_0x940789,_0x238971,_0x202e02,_0x3c99cc){var _0x940789=getName(_0x940789);return request({'method':'POST','uri':_0x2044('0x40')+_0x5240d9+_0x2044('0x41')+_['startCase'](_0x3c99cc['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x940789[0x1],'First_Name':_0x940789[0x0],'Phone':_0x238971,'Owner':{'name':!_['isNil'](_0x202e02[_0x2044('0x42')][_0x2044('0x19')])?_0x202e02[_0x2044('0x42')][_0x2044('0x19')]:!_[_0x2044('0x1c')](_0x202e02[_0x2044('0x43')])?_0x202e02[_0x2044('0x43')]+'\x20'+_0x202e02['last_name']:_0x202e02[_0x2044('0x44')],'id':_0x202e02['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x389cee},'json':!![]})[_0x2044('0x33')](function(_0x57eefa){if(_0x57eefa&&_0x57eefa[_0x2044('0x45')][0x0][_0x2044('0x46')]===_0x2044('0x47')){var _0x1969e5=_0x57eefa[_0x2044('0x45')][0x0][_0x2044('0x48')];_0x1969e5[_0x2044('0x3f')]=_[_0x2044('0x49')](_0x3c99cc[_0x2044('0x4a')])+'s';return _0x1969e5;}logger['error'](_0x2044('0x3c'),JSON[_0x2044('0x3d')](data));throw new Error(_0x2044('0x4b')+JSON[_0x2044('0x3d')](data));})[_0x2044('0x29')](function(_0x313278){console['log'](_0x2044('0x4c'),_0x313278);});}function getEndUser(_0x3be161,_0x4c0f37,_0x4f886a,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2){var _0x2c72e3={'method':_0x2044('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3be161},'json':!![]};switch(_0x19c2d2[_0x2044('0x4d')]){case _0x2044('0x4e'):_0x2c72e3[_0x2044('0x4f')]=_0x2044('0x40')+_0x4c0f37+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x50'))[_0x2044('0x33')](function(_0x4c49c6){if(_0x4c49c6)return _0x4c49c6;_0x2c72e3['uri']=_0x2044('0x40')+_0x4c0f37+_0x2044('0x51')+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x52'))[_0x2044('0x33')](function(_0x45d871){if(_0x45d871)return _0x45d871;if(_0x19c2d2[_0x2044('0x4a')]!='nothing'){return createEndUser(_0x3be161,_0x4c0f37,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2);}else{return{};}});});break;case'contact':_0x2c72e3[_0x2044('0x4f')]=_0x2044('0x40')+_0x4c0f37+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x50'))[_0x2044('0x33')](function(_0x331b21){if(_0x331b21)return _0x331b21;if(_0x19c2d2[_0x2044('0x4a')]!=_0x2044('0x53')){return createEndUser(_0x3be161,_0x4c0f37,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2);}else{return{};}});break;case _0x2044('0x54'):_0x2c72e3[_0x2044('0x4f')]=_0x2044('0x40')+_0x4c0f37+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x37f9b6+'))';return getZohoUser(_0x2c72e3,_0x2044('0x52'))[_0x2044('0x33')](function(_0x137d68){if(_0x137d68)return _0x137d68;if(_0x19c2d2[_0x2044('0x4a')]!='nothing'){return createEndUser(_0x3be161,_0x4c0f37,_0x274e74,_0x37f9b6,_0x4f384c,_0x19c2d2);}else{return{};}});break;}}function getCall(_0x405773,_0x222fc7,_0x3e80d0,_0xadbbfc,_0xce479c,_0x219422,_0x25e12d,_0x3805d7){logger[_0x2044('0x2d')]('Creating\x20new\x20call...');var _0x2a99e4={};_0x2a99e4[_0x2044('0x55')]={'name':!_[_0x2044('0x1c')](_0xadbbfc[_0x2044('0x42')][_0x2044('0x19')])&&!_[_0x2044('0x1c')](_0xadbbfc[_0x2044('0x56')][_0x2044('0x19')])&&_0xadbbfc[_0x2044('0x56')][_0x2044('0x19')]==='administrator'?_0xadbbfc[_0x2044('0x42')][_0x2044('0x19')]:!_[_0x2044('0x1c')](_0xadbbfc[_0x2044('0x43')])?_0xadbbfc[_0x2044('0x43')]+'\x20'+_0xadbbfc[_0x2044('0x44')]:_0xadbbfc[_0x2044('0x44')],'id':_0xadbbfc['id']};_0x2a99e4[_0x2044('0x57')]=intUtil[_0x2044('0x58')](_0x219422[_0x2044('0x59')],_0x25e12d,'\x20');_0x2a99e4[_0x2044('0x5a')]=intUtil[_0x2044('0x58')](_0x219422[_0x2044('0x5b')],_0x25e12d,'\x0a');if(_0xce479c['enduserType']===_0x2044('0x50')){_0x2a99e4[_0x2044('0x5c')]={'name':!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5d')])?_0xce479c['Full_Name']:!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5e')])?_0xce479c[_0x2044('0x5e')]+'\x20'+_0xce479c['Last_Name']:_0xce479c[_0x2044('0x5f')],'id':_0xce479c['id']};}if(_0xce479c['enduserType']==='Leads'){_0x2a99e4[_0x2044('0x60')]={'name':!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5d')])?_0xce479c['Full_Name']:!_[_0x2044('0x1c')](_0xce479c[_0x2044('0x5e')])?_0xce479c[_0x2044('0x5e')]+'\x20'+_0xce479c[_0x2044('0x5f')]:_0xce479c[_0x2044('0x5f')],'id':_0xce479c['id']};_0x2a99e4[_0x2044('0x61')]=_['startCase'](_0xce479c[_0x2044('0x3f')]);}if(_0x25e12d[_0x2044('0x62')]){_0x2a99e4[_0x2044('0x63')]=moment[_0x2044('0x64')](parseInt(_0x25e12d['talktime'])*0x3e8)['format'](_0x2044('0x65'));}else if(_0x25e12d[_0x2044('0x66')]&&_0x25e12d['endtime']){_0x2a99e4[_0x2044('0x63')]=moment['utc'](moment(_0x25e12d['endtime'],_0x2044('0x67'))[_0x2044('0x68')](moment(_0x25e12d[_0x2044('0x69')],_0x2044('0x67'))))[_0x2044('0x30')](_0x2044('0x65'));}switch(_0x25e12d[_0x2044('0x6a')]){case _0x2044('0x6b'):_0x2a99e4[_0x2044('0x6c')]='Called';break;case _0x2044('0x6d'):case _0x2044('0x6e'):_0x2a99e4[_0x2044('0x6c')]=_0x2044('0x6f');break;case'rejected':_0x2a99e4[_0x2044('0x6c')]=_0x2044('0x70');break;case _0x2044('0x71'):_0x2a99e4['Call_Result']=_0x2044('0x72');break;case _0x2044('0x73'):_0x2a99e4[_0x2044('0x6c')]=_0x2044('0x74');default:}_0x2a99e4[_0x2044('0x75')]=(_0x3805d7===_0x2044('0x76')?moment(_0x25e12d['starttime'])[_0x2044('0x30')](_0x2044('0x67')):moment(_0x25e12d[_0x2044('0x77')])['format'](_0x2044('0x67')))||moment()['format'](_0x2044('0x67'));_0x2a99e4[_0x2044('0x78')]=_0x3805d7||_0x2044('0x79');_0x2a99e4=_[_0x2044('0x7a')](_0x2a99e4,getCustomFields(_0x219422[_0x2044('0x7b')],_0x25e12d));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x222fc7+_0x2044('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x405773},'body':{'data':[_0x2a99e4]},'json':!![]})[_0x2044('0x33')](function(_0xf7dfdf){if(_0xf7dfdf&&_0xf7dfdf[_0x2044('0x45')][0x0]['code']===_0x2044('0x47')){logger[_0x2044('0x2d')](_0x2044('0x7d'));return{'id':_0xf7dfdf['data'][0x0]['details']['id']};}})[_0x2044('0x29')](function(_0x249337){logger[_0x2044('0x2d')](_0x2044('0x7e'),_0x249337[_0x2044('0x2c')]);console[_0x2044('0x7f')](_0x2044('0x7e'),_0x249337);});}exports[_0x2044('0x80')]=function(_0x2295eb,_0x574243,_0x28e2ad,_0x2c7403,_0x3993bc,_0xf43acf){var _0x42c6fd,_0xda5836,_0x46287d;_0xf43acf[_0x2044('0x81')]=intUtil[_0x2044('0x82')](_0xf43acf['host']);_0xf43acf[_0x2044('0x83')]=intUtil[_0x2044('0x82')](_0xf43acf['serverUrl']);if(_0x3993bc&&_0x3993bc[_0x2044('0x84')]){logger[_0x2044('0x2d')](_0x2044('0x85'),_0x2044('0x86'));_0x574243['recordingURL']=_0xf43acf[_0x2044('0x83')]+_0x2044('0x87')+_0x574243[_0x2044('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x574243[_0x2044('0x88')]);}else{_0x574243[_0x2044('0x89')]='';}var _0x5ea99f=_0xf43acf[_0x2044('0x81')]==='zoho.eu'?'eu':_0x2044('0x8a');return getAccessToken(_0xf43acf)['then'](function(_0x4f87b8){_0x46287d=_0x4f87b8;return getUser(_0x46287d,_0x5ea99f,_0xf43acf,_0x2c7403['email']);})[_0x2044('0x33')](function(_0x300d53){_0x42c6fd=_0x300d53;logger[_0x2044('0x2d')]('The\x20User\x20ID\x20is:',_0x42c6fd['id']);return getEndUser(_0x46287d,_0x5ea99f,_0xf43acf,_0x574243[_0x2044('0x8b')],_0x574243[_0x2044('0x8c')],_0x42c6fd,_0x28e2ad);})[_0x2044('0x33')](function(_0x1039ff){_0xda5836=_0x1039ff;return getCall(_0x46287d,_0x5ea99f,_0xf43acf,_0x42c6fd,_0xda5836,_0x28e2ad,_0x574243,_0x2044('0x79'));})[_0x2044('0x33')](function(_0x56e338){if(_0x56e338){logger['info']('The\x20Call\x20ID\x20is:',_0x56e338['id']);logger['info'](_0x2044('0x85'),_0x2044('0x8d'));emit(util[_0x2044('0x30')](_0x2044('0x8e'),_0x2c7403['name']),_0x2044('0x8f'),{'uri':'https://crm.'+_0xf43acf[_0x2044('0x81')]+_0x2044('0x90')+_0x56e338['id']});}})[_0x2044('0x29')](function(_0x2d5888){logger[_0x2044('0x2a')](_0x2044('0x85'),JSON[_0x2044('0x3d')](_0x2d5888));});};exports[_0x2044('0x76')]=function(_0xc111a5,_0x532f57,_0x435064,_0x35d22f,_0x3fa5fb,_0x889d93,_0x4ee6c7){var _0x5c42bd,_0x16610b,_0x68dfcf;_0x889d93['host']=intUtil[_0x2044('0x82')](_0x889d93[_0x2044('0x81')]);_0x889d93[_0x2044('0x83')]=intUtil[_0x2044('0x82')](_0x889d93[_0x2044('0x83')]);if(_0x4ee6c7&&_0x4ee6c7[_0x2044('0x91')]&&_0x4ee6c7[_0x2044('0x91')]!=='none'){logger[_0x2044('0x2d')]('[OUTBOUND]',_0x2044('0x86'));_0x532f57[_0x2044('0x89')]=_0x889d93['serverUrl']+'/api/voice/recordings/'+_0x532f57[_0x2044('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x532f57['uniqueid']);}var _0x249e15=_0x889d93['host']==='zoho.eu'?'eu':_0x2044('0x8a');return getAccessToken(_0x889d93)[_0x2044('0x33')](function(_0x3816d5){_0x68dfcf=_0x3816d5;return getUser(_0x68dfcf,_0x249e15,_0x889d93,_0x35d22f[_0x2044('0x37')]);})[_0x2044('0x33')](function(_0x31f9da){_0x5c42bd=_0x31f9da;logger[_0x2044('0x2d')](_0x2044('0x92'),_0x5c42bd['id']);return getEndUser(_0x68dfcf,_0x249e15,_0x889d93,_0x532f57[_0x2044('0x93')],_0x532f57['destcalleridnum'],_0x5c42bd,_0x435064);})[_0x2044('0x33')](function(_0xfd31dc){_0x16610b=_0xfd31dc;return getCall(_0x68dfcf,_0x249e15,_0x889d93,_0x5c42bd,_0x16610b,_0x435064,_0x532f57,_0x2044('0x94'));})['then'](function(_0x3a9c22){if(_0x3a9c22){logger[_0x2044('0x2d')](_0x2044('0x95'),_0x3a9c22['id']);logger[_0x2044('0x2d')](_0x2044('0x96'),_0x2044('0x8d'));emit(util[_0x2044('0x30')]('user:%s',_0x35d22f['name']),_0x2044('0x8f'),{'uri':'https://crm.'+_0x889d93[_0x2044('0x81')]+_0x2044('0x90')+_0x3a9c22['id']});}})['catch'](function(_0x46e997){logger[_0x2044('0x2a')](_0x2044('0x96'),JSON['stringify'](_0x46e997));});};exports[_0x2044('0x97')]=function(_0x173ee2,_0x221ace,_0x30f60f,_0x491915,_0x1658b3,_0x22c0ba){var _0x161d0e,_0x59a3e1,_0x5b5cbd;_0x22c0ba[_0x2044('0x81')]=intUtil[_0x2044('0x82')](_0x22c0ba[_0x2044('0x81')]);_0x22c0ba[_0x2044('0x83')]=intUtil[_0x2044('0x82')](_0x22c0ba[_0x2044('0x83')]);if(_0x1658b3&&_0x1658b3[_0x2044('0x84')]){logger['info']('['+_0x221ace[_0x2044('0x6a')][_0x2044('0x98')]()+']','Recording\x20is\x20enabled!');_0x221ace[_0x2044('0x89')]=_0x22c0ba[_0x2044('0x83')]+'/api/voice/recordings/'+_0x221ace[_0x2044('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x221ace[_0x2044('0x88')]);}else{_0x221ace['recordingURL']='';}var _0x4aa065=_0x22c0ba['host']===_0x2044('0x99')?'eu':_0x2044('0x8a');return getAccessToken(_0x22c0ba)[_0x2044('0x33')](function(_0x27457a){_0x5b5cbd=_0x27457a;return getUser(_0x5b5cbd,_0x4aa065,_0x22c0ba);})[_0x2044('0x33')](function(_0x4aa130){_0x161d0e=_0x4aa130;logger[_0x2044('0x2d')](_0x2044('0x92'),_0x161d0e['id']);return getEndUser(_0x5b5cbd,_0x4aa065,_0x22c0ba,_0x221ace[_0x2044('0x8b')],_0x221ace[_0x2044('0x8c')],_0x161d0e,_0x30f60f);})['then'](function(_0xa9abf8){_0x59a3e1=_0xa9abf8;return getCall(_0x5b5cbd,_0x4aa065,_0x22c0ba,_0x161d0e,_0x59a3e1,_0x30f60f,_0x221ace,_0x2044('0x79'));})[_0x2044('0x33')](function(_0x3f2337){if(_0x3f2337){logger[_0x2044('0x2d')](_0x2044('0x95'),_0x3f2337['id']);}})[_0x2044('0x29')](function(_0x3cb7de){logger[_0x2044('0x2a')]('['+_0x221ace[_0x2044('0x6a')][_0x2044('0x98')]()+']',JSON[_0x2044('0x3d')](_0x3cb7de));});}; \ No newline at end of file +var _0xda3f=['isNil','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Answered','rejected','Call_Result','Rejected','Abandoned','timeout','Call_Start_Time','outbound','merge','Fields','/crm/v2/Calls','err','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','zoho.eu','destcalleridnum','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','toUpperCase','lodash','request-promise','./util','moment','../../../../config/environment','zoho','redis','defaults','localhost','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','split','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users'];(function(_0x23e897,_0x52360b){var _0x58b359=function(_0x4b56d1){while(--_0x4b56d1){_0x23e897['push'](_0x23e897['shift']());}};_0x58b359(++_0x52360b);}(_0xda3f,0x18b));var _0xfda3=function(_0x5c77c7,_0x3f941a){_0x5c77c7=_0x5c77c7-0x0;var _0x4138c1=_0xda3f[_0x5c77c7];return _0x4138c1;};'use strict';var _=require(_0xfda3('0x0'));var rp=require(_0xfda3('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0xfda3('0x2'));var moment=require(_0xfda3('0x3'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xfda3('0x4'));var logger=require('../../../../config/logger')(_0xfda3('0x5'));config[_0xfda3('0x6')]=_[_0xfda3('0x7')](config['redis'],{'host':_0xfda3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfda3('0x6')]));function emit(_0x26594a,_0xa0e84,_0x308dac){io['to'](_0x26594a)['emit'](_0xa0e84,_0x308dac);}function request(_0x23fac8){logger[_0xfda3('0x9')](_0xfda3('0xa'),JSON[_0xfda3('0xb')](_0x23fac8));return rp(_0x23fac8);}function getCustomFields(_0x22e825,_0x37a670){var _0x4263ed={};if(_0x22e825[_0xfda3('0xc')]>0x0){_[_0xfda3('0xd')](_0x22e825,function(_0x181ebd){if(_[_0xfda3('0xe')]([_0xfda3('0xf'),_0xfda3('0x10')],_0x181ebd[_0xfda3('0x11')])&&_0x181ebd[_0xfda3('0x12')]){_0x4263ed[_0x181ebd[_0xfda3('0x12')]]=_0x181ebd[_0xfda3('0x13')][_0xfda3('0x14')]();}else if(_0x181ebd[_0xfda3('0x11')]==='variable'&&_0x181ebd[_0xfda3('0x15')]&&_0x181ebd[_0xfda3('0x12')]&&_0x37a670[_0x181ebd[_0xfda3('0x15')]]){_0x4263ed[_0x181ebd[_0xfda3('0x12')]]=_0x37a670[_0x181ebd[_0xfda3('0x15')]][_0xfda3('0x14')]();}else if(_0x181ebd[_0xfda3('0x11')]===_0xfda3('0x16')&&_0x181ebd[_0xfda3('0x17')]&&_0x181ebd[_0xfda3('0x17')][_0xfda3('0x18')]&&_0x181ebd[_0xfda3('0x12')]&&_0x37a670[_0x181ebd[_0xfda3('0x17')][_0xfda3('0x18')][_0xfda3('0x19')]()]){_0x4263ed[_0x181ebd[_0xfda3('0x12')]]=_0x37a670[_0x181ebd[_0xfda3('0x17')][_0xfda3('0x18')][_0xfda3('0x19')]()][_0xfda3('0x14')]();}});}return _0x4263ed;}function getName(_0x1cf876){if(_0x1cf876['indexOf']('\x20')>0x0){var _0x214952=_0x1cf876[_0xfda3('0x1a')](/ (.+)/);if(_0x214952[0x1]){return _0x214952;}}return[_0x1cf876,_0x1cf876];}var accountsTokens={};function getAccessToken(_0x25cbc4){return new Promise(function(_0x5788fb,_0x265ce9){if(!_['isNil'](accountsTokens[_0x25cbc4['id']])&&!_['isNil'](accountsTokens[_0x25cbc4['id']][_0xfda3('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x25cbc4['id']][_0xfda3('0x1c')])){_0x5788fb(accountsTokens[_0x25cbc4['id']][_0xfda3('0x1b')]);}}var _0x2a6af6;switch(_0x25cbc4[_0xfda3('0x1d')]){case'US':_0x2a6af6='https://accounts.zoho.com';break;case'AU':_0x2a6af6=_0xfda3('0x1e');break;case'EU':_0x2a6af6='https://accounts.zoho.eu';break;case'IN':_0x2a6af6=_0xfda3('0x1f');break;case'CN':_0x2a6af6=_0xfda3('0x20');break;default:_0x2a6af6=_0xfda3('0x21');break;}var _0x1508f1={'method':_0xfda3('0x22'),'uri':_0x2a6af6+_0xfda3('0x23'),'qs':{'refresh_token':_0x25cbc4[_0xfda3('0x24')],'client_id':_0x25cbc4[_0xfda3('0x25')],'client_secret':_0x25cbc4[_0xfda3('0x26')],'grant_type':_0xfda3('0x27')},'json':!![]};return rp(_0x1508f1)[_0xfda3('0x28')](function(_0x51f324){accountsTokens[_0x25cbc4['id']]={'access_token':_0x51f324[_0xfda3('0x1b')],'expires_in':moment()[_0xfda3('0x29')](_0x51f324[_0xfda3('0x1c')],_0xfda3('0x2a'))};_0x5788fb(_0x51f324[_0xfda3('0x1b')]);})[_0xfda3('0x2b')](function(_0x4ff76f){logger['error'](_0xfda3('0x2c'),_0x4ff76f[_0xfda3('0x2d')]);_0x265ce9(_0x4ff76f);});});}function getUser(_0x3e3cc2,_0x18ace4,_0x3df53e,_0x6b2b69){logger[_0xfda3('0x2e')]('Search\x20user');return request({'method':_0xfda3('0x2f'),'uri':util['format'](_0xfda3('0x30'),_0x18ace4),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xfda3('0x31')+_0x3e3cc2},'json':!![]})['then'](function(_0x4719f7){if(_0x4719f7['users']){var _0x7dfa2c=-0x1;if(_[_0xfda3('0x32')](_0x4719f7[_0xfda3('0x33')])){if(!_[_0xfda3('0x34')](_0x6b2b69)){_0x7dfa2c=_[_0xfda3('0x35')](_0x4719f7['users'],function(_0x2c32b6){return _0x2c32b6[_0xfda3('0x36')]===_0x6b2b69;});}if(_0x7dfa2c>=0x0){logger[_0xfda3('0x2e')]('Agent\x20found!');}else{logger[_0xfda3('0x2e')](_0xfda3('0x37'));_0x7dfa2c=_[_0xfda3('0x35')](_0x4719f7['users'],function(_0x337835){return _0x337835[_0xfda3('0x38')][_0xfda3('0x18')]===_0xfda3('0x39');});}return _0x4719f7[_0xfda3('0x33')][_0x7dfa2c];}else{if(_0x4719f7[_0xfda3('0x3a')][_0xfda3('0x38')]['name']===_0xfda3('0x39')){logger[_0xfda3('0x2e')](_0xfda3('0x37'));user=_0x4719f7[_0xfda3('0x3a')];return user;}else{logger[_0xfda3('0x3b')](_0xfda3('0x3c'),JSON[_0xfda3('0xb')](_0x4719f7));throw new Error(_0xfda3('0x3d')+JSON[_0xfda3('0xb')](_0x4719f7));}}}else{logger[_0xfda3('0x3b')](_0xfda3('0x3c'),JSON[_0xfda3('0xb')](_0x4719f7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfda3('0xb')](_0x4719f7));}})[_0xfda3('0x2b')](function(_0x1c6e26){console['error'](_0x1c6e26);});}function getZohoUser(_0x35ebb9,_0x4bb7ea){return new BPromise(function(_0x1a0601,_0x43edfb){request(_0x35ebb9)[_0xfda3('0x28')](function(_0x4b57e6){var _0x3c21b3=null;if(_0x4b57e6){_0x3c21b3=_0x4b57e6[_0xfda3('0x3e')][0x0];_0x3c21b3[_0xfda3('0x3f')]=_0x4bb7ea;}_0x1a0601(_0x3c21b3);})[_0xfda3('0x2b')](function(_0x4c89fe){_0x43edfb(_0x4c89fe);});});}function createEndUser(_0x5c3e14,_0x5aa1e8,_0x470e68,_0x2710bb,_0x2ea8d2,_0x14ab80){var _0x470e68=getName(_0x470e68);return request({'method':'POST','uri':_0xfda3('0x40')+_0x5aa1e8+_0xfda3('0x41')+_[_0xfda3('0x42')](_0x14ab80[_0xfda3('0x43')])+'s','body':{'data':[{'Last_Name':_0x470e68[0x1],'First_Name':_0x470e68[0x0],'Phone':_0x2710bb,'Owner':{'name':!_[_0xfda3('0x34')](_0x2ea8d2[_0xfda3('0x44')][_0xfda3('0x18')])?_0x2ea8d2[_0xfda3('0x44')][_0xfda3('0x18')]:!_[_0xfda3('0x34')](_0x2ea8d2[_0xfda3('0x45')])?_0x2ea8d2[_0xfda3('0x45')]+'\x20'+_0x2ea8d2['last_name']:_0x2ea8d2[_0xfda3('0x46')],'id':_0x2ea8d2['id']}}]},'headers':{'Authorization':_0xfda3('0x31')+_0x5c3e14},'json':!![]})[_0xfda3('0x28')](function(_0x1a9bba){if(_0x1a9bba&&_0x1a9bba[_0xfda3('0x3e')][0x0][_0xfda3('0x47')]===_0xfda3('0x48')){var _0x50b357=_0x1a9bba['data'][0x0][_0xfda3('0x49')];_0x50b357[_0xfda3('0x3f')]=_['startCase'](_0x14ab80[_0xfda3('0x43')])+'s';return _0x50b357;}logger[_0xfda3('0x3b')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})['catch'](function(_0x35fc41){console[_0xfda3('0x4a')](_0xfda3('0x4b'),_0x35fc41);});}function getEndUser(_0x53876e,_0x2e3c3b,_0x107eac,_0x593aa1,_0x444b6d,_0x504d9d,_0x21710e){var _0x1bbabb={'method':'GET','uri':'','headers':{'Authorization':_0xfda3('0x31')+_0x53876e},'json':!![]};switch(_0x21710e[_0xfda3('0x4c')]){case _0xfda3('0x4d'):_0x1bbabb[_0xfda3('0x4e')]=_0xfda3('0x40')+_0x2e3c3b+_0xfda3('0x4f')+_0x444b6d+'))';return getZohoUser(_0x1bbabb,_0xfda3('0x50'))[_0xfda3('0x28')](function(_0x28acc6){if(_0x28acc6)return _0x28acc6;_0x1bbabb['uri']=_0xfda3('0x40')+_0x2e3c3b+_0xfda3('0x51')+_0x444b6d+'))';return getZohoUser(_0x1bbabb,_0xfda3('0x52'))[_0xfda3('0x28')](function(_0x5064a8){if(_0x5064a8)return _0x5064a8;if(_0x21710e[_0xfda3('0x43')]!=_0xfda3('0x53')){return createEndUser(_0x53876e,_0x2e3c3b,_0x593aa1,_0x444b6d,_0x504d9d,_0x21710e);}else{return{};}});});break;case _0xfda3('0x54'):_0x1bbabb[_0xfda3('0x4e')]='https://www.zohoapis.'+_0x2e3c3b+_0xfda3('0x4f')+_0x444b6d+'))';return getZohoUser(_0x1bbabb,_0xfda3('0x50'))[_0xfda3('0x28')](function(_0x2e952d){if(_0x2e952d)return _0x2e952d;if(_0x21710e[_0xfda3('0x43')]!=_0xfda3('0x53')){return createEndUser(_0x53876e,_0x2e3c3b,_0x593aa1,_0x444b6d,_0x504d9d,_0x21710e);}else{return{};}});break;case _0xfda3('0x55'):_0x1bbabb[_0xfda3('0x4e')]='https://www.zohoapis.'+_0x2e3c3b+_0xfda3('0x51')+_0x444b6d+'))';return getZohoUser(_0x1bbabb,_0xfda3('0x52'))[_0xfda3('0x28')](function(_0x3a5ad9){if(_0x3a5ad9)return _0x3a5ad9;if(_0x21710e[_0xfda3('0x43')]!=_0xfda3('0x53')){return createEndUser(_0x53876e,_0x2e3c3b,_0x593aa1,_0x444b6d,_0x504d9d,_0x21710e);}else{return{};}});break;}}function getCall(_0x2d8f88,_0x5d3f8c,_0x513e07,_0x3ccd1f,_0xd886ce,_0x2f0491,_0x323ba5,_0x55f0da){logger[_0xfda3('0x2e')](_0xfda3('0x56'));var _0x1088cc={};_0x1088cc['Owner']={'name':!_['isNil'](_0x3ccd1f['role'][_0xfda3('0x18')])&&!_[_0xfda3('0x34')](_0x3ccd1f[_0xfda3('0x38')]['name'])&&_0x3ccd1f['profile'][_0xfda3('0x18')]==='administrator'?_0x3ccd1f['role']['name']:!_['isNil'](_0x3ccd1f['first_name'])?_0x3ccd1f['first_name']+'\x20'+_0x3ccd1f[_0xfda3('0x46')]:_0x3ccd1f['last_name'],'id':_0x3ccd1f['id']};_0x1088cc[_0xfda3('0x57')]=intUtil[_0xfda3('0x58')](_0x2f0491[_0xfda3('0x59')],_0x323ba5,'\x20');_0x1088cc[_0xfda3('0x5a')]=intUtil[_0xfda3('0x58')](_0x2f0491[_0xfda3('0x5b')],_0x323ba5,'\x0a');if(_0xd886ce[_0xfda3('0x3f')]===_0xfda3('0x50')){_0x1088cc[_0xfda3('0x5c')]={'name':!_[_0xfda3('0x34')](_0xd886ce[_0xfda3('0x5d')])?_0xd886ce[_0xfda3('0x5d')]:!_[_0xfda3('0x34')](_0xd886ce[_0xfda3('0x5e')])?_0xd886ce[_0xfda3('0x5e')]+'\x20'+_0xd886ce[_0xfda3('0x5f')]:_0xd886ce[_0xfda3('0x5f')],'id':_0xd886ce['id']};}if(_0xd886ce[_0xfda3('0x3f')]==='Leads'){_0x1088cc[_0xfda3('0x60')]={'name':!_[_0xfda3('0x34')](_0xd886ce[_0xfda3('0x5d')])?_0xd886ce[_0xfda3('0x5d')]:!_[_0xfda3('0x34')](_0xd886ce[_0xfda3('0x5e')])?_0xd886ce[_0xfda3('0x5e')]+'\x20'+_0xd886ce[_0xfda3('0x5f')]:_0xd886ce['Last_Name'],'id':_0xd886ce['id']};_0x1088cc[_0xfda3('0x61')]=_[_0xfda3('0x42')](_0xd886ce[_0xfda3('0x3f')]);}if(_0x323ba5['talktime']){_0x1088cc[_0xfda3('0x62')]=moment['utc'](parseInt(_0x323ba5[_0xfda3('0x63')])*0x3e8)[_0xfda3('0x64')](_0xfda3('0x65'));}else if(_0x323ba5[_0xfda3('0x66')]&&_0x323ba5[_0xfda3('0x67')]){_0x1088cc[_0xfda3('0x62')]=moment['utc'](moment(_0x323ba5['endtime'],_0xfda3('0x68'))[_0xfda3('0x69')](moment(_0x323ba5[_0xfda3('0x6a')],_0xfda3('0x68'))))['format'](_0xfda3('0x65'));}switch(_0x323ba5[_0xfda3('0x6b')]){case _0xfda3('0x6c'):_0x1088cc['Call_Result']='Called';break;case'complete':case'connect':_0x1088cc['Call_Result']=_0xfda3('0x6d');break;case _0xfda3('0x6e'):_0x1088cc[_0xfda3('0x6f')]=_0xfda3('0x70');break;case'abandoned':_0x1088cc[_0xfda3('0x6f')]=_0xfda3('0x71');break;case _0xfda3('0x72'):_0x1088cc['Call_Result']='Timeout';default:}_0x1088cc[_0xfda3('0x73')]=(_0x55f0da===_0xfda3('0x74')?moment(_0x323ba5[_0xfda3('0x6a')])[_0xfda3('0x64')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x323ba5['agentcalledAt'])['format'](_0xfda3('0x68')))||moment()['format'](_0xfda3('0x68'));_0x1088cc['Call_Type']=_0x55f0da||'Inbound';_0x1088cc=_[_0xfda3('0x75')](_0x1088cc,getCustomFields(_0x2f0491[_0xfda3('0x76')],_0x323ba5));return request({'method':'POST','uri':_0xfda3('0x40')+_0x5d3f8c+_0xfda3('0x77'),'headers':{'Authorization':_0xfda3('0x31')+_0x2d8f88},'body':{'data':[_0x1088cc]},'json':!![]})[_0xfda3('0x28')](function(_0x268321){if(_0x268321&&_0x268321[_0xfda3('0x3e')][0x0][_0xfda3('0x47')]===_0xfda3('0x48')){logger[_0xfda3('0x2e')]('Call\x20created!');return{'id':_0x268321['data'][0x0][_0xfda3('0x49')]['id']};}})[_0xfda3('0x2b')](function(_0x2440a5){logger[_0xfda3('0x2e')](_0xfda3('0x78'),_0x2440a5[_0xfda3('0x2d')]);console[_0xfda3('0x4a')](_0xfda3('0x78'),_0x2440a5);});}exports[_0xfda3('0x79')]=function(_0x44bd,_0x2ea996,_0x2860f8,_0x47db4e,_0x48eb5f,_0x466407){var _0x340164,_0x2dcc7a,_0x3fee12;_0x466407['host']=intUtil[_0xfda3('0x7a')](_0x466407['host']);_0x466407[_0xfda3('0x7b')]=intUtil[_0xfda3('0x7a')](_0x466407['serverUrl']);if(_0x48eb5f&&_0x48eb5f[_0xfda3('0x7c')]){logger[_0xfda3('0x2e')](_0xfda3('0x7d'),'Recording\x20is\x20enabled!');_0x2ea996[_0xfda3('0x7e')]=_0x466407[_0xfda3('0x7b')]+_0xfda3('0x7f')+_0x2ea996[_0xfda3('0x80')]+_0xfda3('0x81')+md5(_0x2ea996[_0xfda3('0x80')]);}else{_0x2ea996[_0xfda3('0x7e')]='';}var _0x4d9794=_0x466407[_0xfda3('0x82')]==='zoho.eu'?'eu':_0xfda3('0x83');return getAccessToken(_0x466407)[_0xfda3('0x28')](function(_0x370f8d){_0x3fee12=_0x370f8d;return getUser(_0x3fee12,_0x4d9794,_0x466407,_0x47db4e[_0xfda3('0x36')]);})['then'](function(_0x1a84ff){_0x340164=_0x1a84ff;logger['info'](_0xfda3('0x84'),_0x340164['id']);return getEndUser(_0x3fee12,_0x4d9794,_0x466407,_0x2ea996[_0xfda3('0x85')],_0x2ea996[_0xfda3('0x86')],_0x340164,_0x2860f8);})['then'](function(_0x149f90){_0x2dcc7a=_0x149f90;return getCall(_0x3fee12,_0x4d9794,_0x466407,_0x340164,_0x2dcc7a,_0x2860f8,_0x2ea996,_0xfda3('0x87'));})[_0xfda3('0x28')](function(_0xfe8ac3){if(_0xfe8ac3){logger[_0xfda3('0x2e')](_0xfda3('0x88'),_0xfe8ac3['id']);logger[_0xfda3('0x2e')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfda3('0x64')]('user:%s',_0x47db4e['name']),_0xfda3('0x89'),{'uri':_0xfda3('0x8a')+_0x466407['host']+_0xfda3('0x8b')+_0xfe8ac3['id']});}})[_0xfda3('0x2b')](function(_0x52c0e5){logger[_0xfda3('0x3b')](_0xfda3('0x7d'),JSON[_0xfda3('0xb')](_0x52c0e5));});};exports[_0xfda3('0x74')]=function(_0x478c7f,_0x377228,_0x433e8f,_0xe883d0,_0x3c4b0e,_0x46501a,_0x220ce7){var _0x2c00b2,_0x19f263,_0x306890;_0x46501a[_0xfda3('0x82')]=intUtil[_0xfda3('0x7a')](_0x46501a[_0xfda3('0x82')]);_0x46501a[_0xfda3('0x7b')]=intUtil[_0xfda3('0x7a')](_0x46501a['serverUrl']);if(_0x220ce7&&_0x220ce7[_0xfda3('0x8c')]&&_0x220ce7[_0xfda3('0x8c')]!==_0xfda3('0x8d')){logger[_0xfda3('0x2e')]('[OUTBOUND]',_0xfda3('0x8e'));_0x377228[_0xfda3('0x7e')]=_0x46501a[_0xfda3('0x7b')]+_0xfda3('0x7f')+_0x377228[_0xfda3('0x80')]+_0xfda3('0x81')+md5(_0x377228[_0xfda3('0x80')]);}var _0x2ba86c=_0x46501a[_0xfda3('0x82')]===_0xfda3('0x8f')?'eu':_0xfda3('0x83');return getAccessToken(_0x46501a)[_0xfda3('0x28')](function(_0x4db45a){_0x306890=_0x4db45a;return getUser(_0x306890,_0x2ba86c,_0x46501a,_0xe883d0['email']);})[_0xfda3('0x28')](function(_0x5ed612){_0x2c00b2=_0x5ed612;logger[_0xfda3('0x2e')]('The\x20User\x20ID\x20is:',_0x2c00b2['id']);return getEndUser(_0x306890,_0x2ba86c,_0x46501a,_0x377228['destcalleridname'],_0x377228[_0xfda3('0x90')],_0x2c00b2,_0x433e8f);})[_0xfda3('0x28')](function(_0x3f759f){_0x19f263=_0x3f759f;return getCall(_0x306890,_0x2ba86c,_0x46501a,_0x2c00b2,_0x19f263,_0x433e8f,_0x377228,'Outbound');})[_0xfda3('0x28')](function(_0x59d8cd){if(_0x59d8cd){logger['info']('The\x20Call\x20ID\x20is:',_0x59d8cd['id']);logger[_0xfda3('0x2e')](_0xfda3('0x91'),_0xfda3('0x92'));emit(util[_0xfda3('0x64')](_0xfda3('0x93'),_0xe883d0[_0xfda3('0x18')]),_0xfda3('0x89'),{'uri':_0xfda3('0x8a')+_0x46501a[_0xfda3('0x82')]+'/crm/EntityInfo.do?module=Calls&id='+_0x59d8cd['id']});}})['catch'](function(_0x2a9d70){logger[_0xfda3('0x3b')]('[OUTBOUND]',JSON[_0xfda3('0xb')](_0x2a9d70));});};exports['unmanaged']=function(_0x256814,_0x13112d,_0x1912f9,_0x4f7f08,_0x318e1f,_0x497cea){var _0x168423,_0x4170da,_0x8b2190;_0x497cea[_0xfda3('0x82')]=intUtil[_0xfda3('0x7a')](_0x497cea[_0xfda3('0x82')]);_0x497cea[_0xfda3('0x7b')]=intUtil[_0xfda3('0x7a')](_0x497cea[_0xfda3('0x7b')]);if(_0x318e1f&&_0x318e1f[_0xfda3('0x7c')]){logger['info']('['+_0x13112d[_0xfda3('0x6b')][_0xfda3('0x94')]()+']',_0xfda3('0x8e'));_0x13112d[_0xfda3('0x7e')]=_0x497cea['serverUrl']+'/api/voice/recordings/'+_0x13112d[_0xfda3('0x80')]+_0xfda3('0x81')+md5(_0x13112d[_0xfda3('0x80')]);}else{_0x13112d['recordingURL']='';}var _0x45827b=_0x497cea['host']===_0xfda3('0x8f')?'eu':_0xfda3('0x83');return getAccessToken(_0x497cea)[_0xfda3('0x28')](function(_0xd8cc0b){_0x8b2190=_0xd8cc0b;return getUser(_0x8b2190,_0x45827b,_0x497cea);})[_0xfda3('0x28')](function(_0x67d75f){_0x168423=_0x67d75f;logger[_0xfda3('0x2e')](_0xfda3('0x84'),_0x168423['id']);return getEndUser(_0x8b2190,_0x45827b,_0x497cea,_0x13112d[_0xfda3('0x85')],_0x13112d[_0xfda3('0x86')],_0x168423,_0x1912f9);})[_0xfda3('0x28')](function(_0x238502){_0x4170da=_0x238502;return getCall(_0x8b2190,_0x45827b,_0x497cea,_0x168423,_0x4170da,_0x1912f9,_0x13112d,'Inbound');})[_0xfda3('0x28')](function(_0xea308f){if(_0xea308f){logger[_0xfda3('0x2e')](_0xfda3('0x88'),_0xea308f['id']);}})[_0xfda3('0x2b')](function(_0x13254b){logger[_0xfda3('0x3b')]('['+_0x13112d[_0xfda3('0x6b')]['toUpperCase']()+']',JSON[_0xfda3('0xb')](_0x13254b));});}; \ 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 a10ec2f..6cd00c9 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 _0x80d6=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','render','data3','error','format'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x80d6,0x1ee));var _0x680d=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x80d6[_0x2fdce0];return _0x36f07e;};'use strict';var util=require(_0x680d('0x0'));var sh=require(_0x680d('0x1'));var Mustache=require(_0x680d('0x2'));var logger=require(_0x680d('0x3'))('trigger');exports[_0x680d('0x4')]=function(_0x4cf709,_0xfa0bd1){var _0x48d112=_0x4cf709[_0x680d('0x5')]?_0x4cf709[_0x680d('0x5')]:'Script';var _0x495fc8=_0x4cf709['data3']?Mustache[_0x680d('0x6')](_0x4cf709[_0x680d('0x7')],_0xfa0bd1):_0xfa0bd1;sh[_0x680d('0x4')](_0x495fc8,function(_0x458d4f,_0x3ab2e0,_0x2c1ac1){if(_0x458d4f!==0x0){logger[_0x680d('0x8')](util[_0x680d('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x48d112,_0x495fc8,_0x458d4f,_0x2c1ac1));}else{logger[_0x680d('0xa')](util['format'](_0x680d('0xb'),_0x48d112,_0x495fc8,_0x3ab2e0));}});}; \ No newline at end of file +var _0x066a=['trigger','data2','Script','data3','exec','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger'];(function(_0x506a86,_0x41e1c9){var _0x5e1960=function(_0xbc7559){while(--_0xbc7559){_0x506a86['push'](_0x506a86['shift']());}};_0x5e1960(++_0x41e1c9);}(_0x066a,0x111));var _0xa066=function(_0x46891b,_0x3222bb){_0x46891b=_0x46891b-0x0;var _0x444cdc=_0x066a[_0x46891b];return _0x444cdc;};'use strict';var util=require(_0xa066('0x0'));var sh=require('shelljs');var Mustache=require(_0xa066('0x1'));var logger=require(_0xa066('0x2'))(_0xa066('0x3'));exports['exec']=function(_0x283e4e,_0x12817b){var _0x3bd833=_0x283e4e[_0xa066('0x4')]?_0x283e4e['data2']:_0xa066('0x5');var _0x402ac1=_0x283e4e[_0xa066('0x6')]?Mustache['render'](_0x283e4e[_0xa066('0x6')],_0x12817b):_0x12817b;sh[_0xa066('0x7')](_0x402ac1,function(_0xff82ee,_0x1aa75b,_0xc85502){if(_0xff82ee!==0x0){logger[_0xa066('0x8')](util[_0xa066('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x3bd833,_0x402ac1,_0xff82ee,_0xc85502));}else{logger[_0xa066('0xa')](util[_0xa066('0x9')](_0xa066('0xb'),_0x3bd833,_0x402ac1,_0x1aa75b));}});}; \ 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 fcdde7d..831b67b 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 _0xed1e=['parse','error','GET','DELETE','POST','PUT','data7','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','body','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6'];(function(_0xc5fcc4,_0x2f2c74){var _0x5502f4=function(_0x55c5d7){while(--_0x55c5d7){_0xc5fcc4['push'](_0xc5fcc4['shift']());}};_0x5502f4(++_0x2f2c74);}(_0xed1e,0x1e3));var _0xeed1=function(_0xdeffe6,_0x198150){_0xdeffe6=_0xdeffe6-0x0;var _0x5baeb=_0xed1e[_0xdeffe6];return _0x5baeb;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xeed1('0x0'));var Mustache=require(_0xeed1('0x1'));var logger=require(_0xeed1('0x2'))(_0xeed1('0x3'));exports[_0xeed1('0x4')]=function(_0x151082,_0x2d66a3){var _0x4bee5f,_0x260050;var _0x331db1={'method':_0x151082[_0xeed1('0x5')][_0xeed1('0x6')](),'uri':Mustache['render'](_0x151082[_0xeed1('0x7')],_0x2d66a3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x151082[_0xeed1('0x8')])===_0xeed1('0x9')&&parseInt(_0x151082[_0xeed1('0x8')])>=0x1&&parseInt(_0x151082[_0xeed1('0x8')])<=0xa?parseInt(_0x151082[_0xeed1('0x8')])*0x3e8:0x5*0x3e8};try{_0x331db1[_0xeed1('0xa')]=_0x151082[_0xeed1('0xb')]?JSON[_0xeed1('0xc')](Mustache['render'](_0x151082[_0xeed1('0xb')],_0x2d66a3)):{};}catch(_0x5ab51a){logger[_0xeed1('0xd')](_0x5ab51a['stack']);}switch(_0x151082['data1']['toUpperCase']()){case _0xeed1('0xe'):case _0xeed1('0xf'):_0x4bee5f=null;_0x331db1['qs']=_0x2d66a3;break;case _0xeed1('0x10'):case _0xeed1('0x11'):if(_0x151082[_0xeed1('0x12')]){try{_0x4bee5f=JSON['parse'](Mustache['render'](_0x151082[_0xeed1('0x12')],_0x2d66a3));_0x331db1['body']=_0x4bee5f;}catch(_0x387587){logger[_0xeed1('0xd')](_0x387587[_0xeed1('0x13')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4bee5f=_0x2d66a3;_0x331db1['body']=_0x4bee5f;}break;}logger[_0xeed1('0x14')](util[_0xeed1('0x15')](_0xeed1('0x16'),_0x151082[_0xeed1('0x5')],_0x151082['data2'],JSON['stringify'](_0x331db1)));rp(_0x331db1)[_0xeed1('0x17')](function(_0x5e0187){_0x4bee5f=!_['isNil'](_0x4bee5f)?_0xeed1('0x18')+_0x4bee5f:'';_0x260050=typeof _0x5e0187[_0xeed1('0x19')]===_0xeed1('0x1a')?JSON[_0xeed1('0x1b')](_0x5e0187[_0xeed1('0x19')]):_0x5e0187['body'];logger['info'](util[_0xeed1('0x15')](_0xeed1('0x1c'),_0x151082[_0xeed1('0x5')],_0x151082[_0xeed1('0x7')],_0x5e0187[_0xeed1('0x1d')],_0x260050));})['catch'](function(_0x13a1b7){logger[_0xeed1('0xd')](util['format'](_0xeed1('0x1e'),_0x151082[_0xeed1('0x5')],_0x151082[_0xeed1('0x7')],_0x13a1b7['statusCode'],_0x13a1b7[_0xeed1('0x1f')],_0x13a1b7[_0xeed1('0x20')]));});}; \ No newline at end of file +var _0x9780=['parse','render','data6','stack','GET','DELETE','PUT','data7','error','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','stringify','then','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','lodash','../../../../config/logger','trigger','exec','toUpperCase','data2','data5','number','headers'];(function(_0x6bf3bc,_0x2d4abb){var _0x5352fd=function(_0x379c6c){while(--_0x379c6c){_0x6bf3bc['push'](_0x6bf3bc['shift']());}};_0x5352fd(++_0x2d4abb);}(_0x9780,0xdd));var _0x0978=function(_0x6f8972,_0x343da7){_0x6f8972=_0x6f8972-0x0;var _0x5677d9=_0x9780[_0x6f8972];return _0x5677d9;};'use strict';var rp=require(_0x0978('0x0'));var util=require('util');var _=require(_0x0978('0x1'));var Mustache=require('mustache');var logger=require(_0x0978('0x2'))(_0x0978('0x3'));exports[_0x0978('0x4')]=function(_0x4d4b3c,_0x53d1c1){var _0x2982f6,_0x7192a8;var _0x3fe60f={'method':_0x4d4b3c['data1'][_0x0978('0x5')](),'uri':Mustache['render'](_0x4d4b3c[_0x0978('0x6')],_0x53d1c1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4d4b3c[_0x0978('0x7')])===_0x0978('0x8')&&parseInt(_0x4d4b3c[_0x0978('0x7')])>=0x1&&parseInt(_0x4d4b3c[_0x0978('0x7')])<=0xa?parseInt(_0x4d4b3c[_0x0978('0x7')])*0x3e8:0x5*0x3e8};try{_0x3fe60f[_0x0978('0x9')]=_0x4d4b3c['data6']?JSON[_0x0978('0xa')](Mustache[_0x0978('0xb')](_0x4d4b3c[_0x0978('0xc')],_0x53d1c1)):{};}catch(_0x22e4ae){logger['error'](_0x22e4ae[_0x0978('0xd')]);}switch(_0x4d4b3c['data1']['toUpperCase']()){case _0x0978('0xe'):case _0x0978('0xf'):_0x2982f6=null;_0x3fe60f['qs']=_0x53d1c1;break;case'POST':case _0x0978('0x10'):if(_0x4d4b3c[_0x0978('0x11')]){try{_0x2982f6=JSON[_0x0978('0xa')](Mustache[_0x0978('0xb')](_0x4d4b3c[_0x0978('0x11')],_0x53d1c1));_0x3fe60f['body']=_0x2982f6;}catch(_0x250ff6){logger[_0x0978('0x12')](_0x250ff6['stack']);logger[_0x0978('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2982f6=_0x53d1c1;_0x3fe60f[_0x0978('0x13')]=_0x2982f6;}break;}logger[_0x0978('0x14')](util['format'](_0x0978('0x15'),_0x4d4b3c[_0x0978('0x16')],_0x4d4b3c[_0x0978('0x6')],JSON[_0x0978('0x17')](_0x3fe60f)));rp(_0x3fe60f)[_0x0978('0x18')](function(_0x25cf96){_0x2982f6=!_[_0x0978('0x19')](_0x2982f6)?_0x0978('0x1a')+_0x2982f6:'';_0x7192a8=typeof _0x25cf96['body']===_0x0978('0x1b')?JSON[_0x0978('0x17')](_0x25cf96['body']):_0x25cf96[_0x0978('0x13')];logger['info'](util[_0x0978('0x1c')](_0x0978('0x1d'),_0x4d4b3c[_0x0978('0x16')],_0x4d4b3c[_0x0978('0x6')],_0x25cf96[_0x0978('0x1e')],_0x7192a8));})[_0x0978('0x1f')](function(_0x4e82b6){logger['error'](util[_0x0978('0x1c')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4d4b3c[_0x0978('0x16')],_0x4d4b3c[_0x0978('0x6')],_0x4e82b6[_0x0978('0x1e')],_0x4e82b6[_0x0978('0x20')],_0x4e82b6['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 13852c7..b3f8b93 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 _0x4c75=['routing','client','http','Request','request','then','debug','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x495002,_0x1aad30){var _0xbc360e=function(_0x295d72){while(--_0x295d72){_0x495002['push'](_0x495002['shift']());}};_0xbc360e(++_0x1aad30);}(_0x4c75,0x138));var _0x54c7=function(_0x1b1ed8,_0x2b0f38){_0x1b1ed8=_0x1b1ed8-0x0;var _0x33e1d6=_0x4c75[_0x1b1ed8];return _0x33e1d6;};'use strict';var jayson=require(_0x54c7('0x0'));var BPromise=require(_0x54c7('0x1'));var logger=require(_0x54c7('0x2'))(_0x54c7('0x3'));var client=jayson[_0x54c7('0x4')][_0x54c7('0x5')]({'port':0x2329});client[_0x54c7('0x6')]=function(_0xa0f0d2,_0x4d20be){return new BPromise(function(_0xfd21a5,_0x30e0cc){return client[_0x54c7('0x7')](_0xa0f0d2,_0x4d20be)[_0x54c7('0x8')](function(_0x4d8298){logger[_0x54c7('0x9')]('rpc',_0x54c7('0x3'),_0xa0f0d2,_0x4d20be,_0x4d8298);if(_0x4d8298[_0x54c7('0xa')]){logger[_0x54c7('0xa')]('rpc','routing',_0xa0f0d2,_0x4d8298[_0x54c7('0xa')][_0x54c7('0xb')],_0x4d20be);return _0x30e0cc(_0x4d8298[_0x54c7('0xa')][_0x54c7('0xb')]);}else{return _0xfd21a5(_0x4d8298[_0x54c7('0xc')]);}})[_0x54c7('0xd')](function(_0x5f0d8f){logger[_0x54c7('0xa')](_0x54c7('0xe'),_0x54c7('0x3'),_0xa0f0d2,_0x5f0d8f,_0x4d20be);return _0x30e0cc(_0x5f0d8f);});});};module['exports']=client; \ No newline at end of file +var _0x36fe=['jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch'];(function(_0x475f93,_0x31affe){var _0xf1e953=function(_0xde6038){while(--_0xde6038){_0x475f93['push'](_0x475f93['shift']());}};_0xf1e953(++_0x31affe);}(_0x36fe,0x1ea));var _0xe36f=function(_0x129479,_0x256c7e){_0x129479=_0x129479-0x0;var _0x3fa0ce=_0x36fe[_0x129479];return _0x3fa0ce;};'use strict';var jayson=require(_0xe36f('0x0'));var BPromise=require(_0xe36f('0x1'));var logger=require('../../config/logger')(_0xe36f('0x2'));var client=jayson[_0xe36f('0x3')][_0xe36f('0x4')]({'port':0x2329});client[_0xe36f('0x5')]=function(_0x3c862c,_0x2cec7f){return new BPromise(function(_0x344fe7,_0x4aa734){return client[_0xe36f('0x6')](_0x3c862c,_0x2cec7f)[_0xe36f('0x7')](function(_0x202453){logger[_0xe36f('0x8')](_0xe36f('0x9'),_0xe36f('0x2'),_0x3c862c,_0x2cec7f,_0x202453);if(_0x202453[_0xe36f('0xa')]){logger[_0xe36f('0xa')]('rpc',_0xe36f('0x2'),_0x3c862c,_0x202453[_0xe36f('0xa')][_0xe36f('0xb')],_0x2cec7f);return _0x4aa734(_0x202453[_0xe36f('0xa')][_0xe36f('0xb')]);}else{return _0x344fe7(_0x202453[_0xe36f('0xc')]);}})[_0xe36f('0xd')](function(_0x1ffeb5){logger['error'](_0xe36f('0x9'),_0xe36f('0x2'),_0x3c862c,_0x1ffeb5,_0x2cec7f);return _0x4aa734(_0x1ffeb5);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ca2a82d..c01acb6 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 _0xa84d=['mailAccounts','listen','loginMailFrequency','Email\x20service\x20initialization','./server','./lib/email','../../config/logger','email','then','getMailAccounts','refresh'];(function(_0x560ca4,_0x12c750){var _0x4432af=function(_0x50a176){while(--_0x50a176){_0x560ca4['push'](_0x560ca4['shift']());}};_0x4432af(++_0x12c750);}(_0xa84d,0x1d2));var _0xda84=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa84d[_0x14add3];return _0x4a174f;};'use strict';var server=require(_0xda84('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xda84('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xda84('0x2'))(_0xda84('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xda84('0x4')](mailAccount[_0xda84('0x5')]())['then'](realtime['initMailAccounts']())[_0xda84('0x4')](function(){email[_0xda84('0x6')](realtime[_0xda84('0x7')]);return realtime;});}function main(){return server[_0xda84('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xda84('0x4')](function(_0x347915){return setInterval(initRealtime,_0x347915[_0xda84('0x9')]*0x3e8);})['catch'](function(_0x528c88){logger['error'](_0xda84('0xa'),_0x528c88);});}main(); \ No newline at end of file +var _0x2706=['email','resolve','then','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0x2706,0x18b));var _0x6270=function(_0x49a728,_0x1ceb3c){_0x49a728=_0x49a728-0x0;var _0x39bd5d=_0x2706[_0x49a728];return _0x39bd5d;};'use strict';var server=require(_0x6270('0x0'));var Realtime=require(_0x6270('0x1'));var EmailChannel=require(_0x6270('0x2'));var mailAccount=require(_0x6270('0x3'));var setting=require('./rpc/setting');var logger=require(_0x6270('0x4'))(_0x6270('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6270('0x6')]()['then'](mailAccount['getMailAccounts']())[_0x6270('0x7')](realtime[_0x6270('0x8')]())[_0x6270('0x7')](function(){email[_0x6270('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x6270('0xa')](realtime,email)[_0x6270('0x7')](function(){return initRealtime();})[_0x6270('0x7')](function(){return setting[_0x6270('0xb')]();})[_0x6270('0x7')](function(_0x1753ab){return setInterval(initRealtime,_0x1753ab[_0x6270('0xc')]*0x3e8);})[_0x6270('0xd')](function(_0xdd945b){logger[_0x6270('0xe')](_0x6270('0xf'),_0xdd945b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index bba81dc..f5a11ad 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 _0xaf62=['custom','imapAccounts','box','bind','handleImapEmail','end','handleImapEnd','handleImapError','handleImapBox','connected','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','error','sendMail','smtp','send','Smtp','lastSync','verify','verified','exports','lodash','md5','ioredis','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','prototype','emit','name','key','active','status','Imap','total','isNil','mailAccount:update','refresh','hasOwnProperty','service','provider'];(function(_0x40dc99,_0x2718d0){var _0x490087=function(_0x3b4c9f){while(--_0x3b4c9f){_0x40dc99['push'](_0x40dc99['shift']());}};_0x490087(++_0x2718d0);}(_0xaf62,0x1e6));var _0x2af6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xaf62[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x2af6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x2af6('0x1'));var Redis=require(_0x2af6('0x2'));var config=require('../../../config/environment');var logger=require(_0x2af6('0x3'))(_0x2af6('0x4'));config['redis']=_[_0x2af6('0x5')](config[_0x2af6('0x6')],{'host':_0x2af6('0x7'),'port':0x18eb});var io=require(_0x2af6('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x2af6('0x9'));var EmailSmtp=require(_0x2af6('0xa'));var mailAccount=require(_0x2af6('0xb'));var md5Accounts={};function EmailChannel(_0x29e5e0){logger['info']('start\x20email\x20channel');this[_0x2af6('0xc')]=_0x29e5e0['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x2af6('0xd')][_0x2af6('0xe')]=function(_0x545201){var _0x436572=this[_0x2af6('0xc')][_0x545201];var _0x54c2d2={'id':_0x436572['id'],'name':_0x436572[_0x2af6('0xf')],'key':_0x436572[_0x2af6('0x10')],'active':_0x436572[_0x2af6('0x11')],'Imap':{'status':_0x436572['Imap'][_0x2af6('0x12')],'messageStatus':_0x436572['Imap']['messageStatus'],'total':_0x436572[_0x2af6('0x13')][_0x2af6('0x14')]}};if(_[_0x2af6('0x15')](md5Accounts[_0x545201])){md5Accounts[_0x545201]={};}var _0x411292=md5(JSON['stringify'](_0x54c2d2));if(md5Accounts[_0x545201][_0x2af6('0x1')]!==_0x411292){md5Accounts[_0x545201][_0x2af6('0x1')]=_0x411292;io[_0x2af6('0xe')](_0x2af6('0x16'),_0x54c2d2);}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x17')]=function(_0x2ce2a6){for(var _0xf1687c in _0x2ce2a6){if(_0x2ce2a6[_0x2af6('0x18')](_0xf1687c)){if(_0x2ce2a6[_0xf1687c][_0x2af6('0x13')]&&_0x2ce2a6[_0xf1687c]['active']){var _0x232649=_0x2ce2a6[_0xf1687c][_0x2af6('0x13')];if(!_0x232649[_0x2af6('0x19')]&&_0x2ce2a6[_0xf1687c][_0x2af6('0x1a')]!==_0x2af6('0x1b'))_0x232649[_0x2af6('0x19')]=_0x2ce2a6[_0xf1687c][_0x2af6('0x1a')];if(!this[_0x2af6('0x1c')]['hasOwnProperty'](_0x232649['id'])){this[_0x2af6('0x1c')][_0x232649['id']]=new EmailImap(_0x232649,_0x2ce2a6[_0xf1687c][_0x2af6('0x4')]);this[_0x2af6('0x1c')][_0x232649['id']]['on'](_0x2af6('0x1d'),this['handleImapBox'][_0x2af6('0x1e')](this,_0xf1687c));this[_0x2af6('0x1c')][_0x232649['id']]['on'](_0x2af6('0x4'),this[_0x2af6('0x1f')][_0x2af6('0x1e')](this,_0xf1687c));this[_0x2af6('0x1c')][_0x232649['id']]['on'](_0x2af6('0x20'),this[_0x2af6('0x21')][_0x2af6('0x1e')](this,_0xf1687c));this[_0x2af6('0x1c')][_0x232649['id']]['on']('error',this[_0x2af6('0x22')][_0x2af6('0x1e')](this,_0xf1687c));}}else{if(_['isNil'](this[_0x2af6('0xc')][_0xf1687c]['Imap'])){this['mailAccounts'][_0xf1687c][_0x2af6('0x13')]={};}this[_0x2af6('0xc')][_0xf1687c][_0x2af6('0x13')][_0x2af6('0x12')]='disabled';this['mailAccounts'][_0xf1687c]['Imap']['messageStatus']='';this[_0x2af6('0xe')](_0xf1687c);}}}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x23')]=function(_0x51ac90,_0x16a33b){if(this[_0x2af6('0xc')][_0x51ac90]){this[_0x2af6('0xc')][_0x51ac90][_0x2af6('0x13')][_0x2af6('0x12')]=_0x2af6('0x24');this[_0x2af6('0xc')][_0x51ac90][_0x2af6('0x13')][_0x2af6('0x25')]=_0x16a33b[_0x2af6('0xf')];if(_0x16a33b['messages']){this[_0x2af6('0xc')][_0x51ac90][_0x2af6('0x13')][_0x2af6('0x14')]=_0x16a33b[_0x2af6('0x26')][_0x2af6('0x14')];}return this[_0x2af6('0xe')](_0x51ac90);}};EmailChannel[_0x2af6('0xd')]['handleImapEmail']=function(_0x55f763,_0x86781c){logger['info'](_0x2af6('0x27'),_0x86781c[_0x2af6('0x28')],_0x86781c[_0x2af6('0x29')],_0x86781c[_0x2af6('0x2a')],_0x55f763);if(this['mailAccounts'][_0x55f763]){return mailAccount['notify'](_0x55f763,_0x86781c)['then'](function(_0x42e6dd){if(_0x42e6dd){logger[_0x2af6('0x2b')](_0x2af6('0x2c'));}})[_0x2af6('0x2d')](function(_0x10a986){logger['error'](_0x2af6('0x2e'),JSON[_0x2af6('0x2f')](_0x10a986));});}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x21')]=function(_0x24f651){if(this['mailAccounts'][_0x24f651]&&this[_0x2af6('0xc')][_0x24f651][_0x2af6('0x13')]){if(this[_0x2af6('0x1c')][this[_0x2af6('0xc')][_0x24f651]['Imap']['id']]){delete this[_0x2af6('0x1c')][this['mailAccounts'][_0x24f651][_0x2af6('0x13')]['id']];}this[_0x2af6('0xc')][_0x24f651][_0x2af6('0x13')]['lastSync']=moment();this[_0x2af6('0xe')](_0x24f651);}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x22')]=function(_0x283c02,_0x5a9a2a){if(this[_0x2af6('0xc')][_0x283c02]){this[_0x2af6('0xc')][_0x283c02]['Imap'][_0x2af6('0x12')]=_0x2af6('0x30');this[_0x2af6('0xc')][_0x283c02]['Imap'][_0x2af6('0x25')]=_0x5a9a2a;return this[_0x2af6('0xe')](_0x283c02);}};EmailChannel[_0x2af6('0xd')][_0x2af6('0x31')]=function(_0x168382,_0x533963){return this[_0x2af6('0x32')][_0x2af6('0x33')](_0x168382,_0x533963);};EmailChannel[_0x2af6('0xd')]['verifySmtp']=function(_0x1e9342){var _0x4d8fa4=this;if(this[_0x2af6('0xc')][_0x1e9342['id']]){if(_[_0x2af6('0x15')](this[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')])){this[_0x2af6('0xc')][_0x1e9342['id']]['Smtp']={};}this[_0x2af6('0xc')][_0x1e9342['id']]['Smtp'][_0x2af6('0x35')]=moment();return new BPromise(function(_0x269701,_0x4e3eca){return _0x4d8fa4[_0x2af6('0x32')][_0x2af6('0x36')](_0x1e9342)['then'](function(_0x421eff){_0x4d8fa4['mailAccounts'][_0x1e9342['id']][_0x2af6('0x34')][_0x2af6('0x12')]=_0x2af6('0x37');_0x4d8fa4[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')][_0x2af6('0x25')]='';_0x4d8fa4[_0x2af6('0xe')](_0x1e9342['id']);_0x269701(_0x421eff);})[_0x2af6('0x2d')](function(_0x3774aa){_0x4d8fa4[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')]['status']='error';_0x4d8fa4[_0x2af6('0xc')][_0x1e9342['id']][_0x2af6('0x34')][_0x2af6('0x25')]=_0x3774aa;_0x4d8fa4[_0x2af6('0xe')](_0x1e9342['id']);_0x4e3eca(_0x3774aa);});});}return this[_0x2af6('0x32')]['verify'](_0x1e9342);};module[_0x2af6('0x38')]=EmailChannel; \ No newline at end of file +var _0x6c93=['messageStatus','isNil','stringify','md5','emit','mailAccount:update','service','custom','provider','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','name','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','sendMail','smtp','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','key','active','Imap','status'];(function(_0x40681c,_0x463705){var _0x2dfb00=function(_0x2755a3){while(--_0x2755a3){_0x40681c['push'](_0x40681c['shift']());}};_0x2dfb00(++_0x463705);}(_0x6c93,0xd5));var _0x36c9=function(_0x4ad922,_0x1538f6){_0x4ad922=_0x4ad922-0x0;var _0x3c0eef=_0x6c93[_0x4ad922];return _0x3c0eef;};'use strict';var _=require(_0x36c9('0x0'));var moment=require('moment');var BPromise=require(_0x36c9('0x1'));var md5=require('md5');var Redis=require(_0x36c9('0x2'));var config=require(_0x36c9('0x3'));var logger=require(_0x36c9('0x4'))(_0x36c9('0x5'));config[_0x36c9('0x6')]=_[_0x36c9('0x7')](config[_0x36c9('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x36c9('0x6')]));var EmailImap=require(_0x36c9('0x8'));var EmailSmtp=require(_0x36c9('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x389d93){logger[_0x36c9('0xa')](_0x36c9('0xb'));this['mailAccounts']=_0x389d93[_0x36c9('0xc')];this[_0x36c9('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x36c9('0xe')]['emit']=function(_0x4684a3){var _0x2898ea=this[_0x36c9('0xc')][_0x4684a3];var _0x5c9f58={'id':_0x2898ea['id'],'name':_0x2898ea['name'],'key':_0x2898ea[_0x36c9('0xf')],'active':_0x2898ea[_0x36c9('0x10')],'Imap':{'status':_0x2898ea[_0x36c9('0x11')][_0x36c9('0x12')],'messageStatus':_0x2898ea[_0x36c9('0x11')][_0x36c9('0x13')],'total':_0x2898ea[_0x36c9('0x11')]['total']}};if(_[_0x36c9('0x14')](md5Accounts[_0x4684a3])){md5Accounts[_0x4684a3]={};}var _0x543abb=md5(JSON[_0x36c9('0x15')](_0x5c9f58));if(md5Accounts[_0x4684a3][_0x36c9('0x16')]!==_0x543abb){md5Accounts[_0x4684a3][_0x36c9('0x16')]=_0x543abb;io[_0x36c9('0x17')](_0x36c9('0x18'),_0x5c9f58);}};EmailChannel['prototype']['refresh']=function(_0xe8a935){for(var _0x29aee0 in _0xe8a935){if(_0xe8a935['hasOwnProperty'](_0x29aee0)){if(_0xe8a935[_0x29aee0][_0x36c9('0x11')]&&_0xe8a935[_0x29aee0][_0x36c9('0x10')]){var _0x18b12a=_0xe8a935[_0x29aee0][_0x36c9('0x11')];if(!_0x18b12a[_0x36c9('0x19')]&&_0xe8a935[_0x29aee0]['provider']!==_0x36c9('0x1a'))_0x18b12a[_0x36c9('0x19')]=_0xe8a935[_0x29aee0][_0x36c9('0x1b')];if(!this[_0x36c9('0xd')][_0x36c9('0x1c')](_0x18b12a['id'])){this[_0x36c9('0xd')][_0x18b12a['id']]=new EmailImap(_0x18b12a,_0xe8a935[_0x29aee0][_0x36c9('0x5')]);this[_0x36c9('0xd')][_0x18b12a['id']]['on'](_0x36c9('0x1d'),this['handleImapBox'][_0x36c9('0x1e')](this,_0x29aee0));this[_0x36c9('0xd')][_0x18b12a['id']]['on'](_0x36c9('0x5'),this[_0x36c9('0x1f')][_0x36c9('0x1e')](this,_0x29aee0));this[_0x36c9('0xd')][_0x18b12a['id']]['on'](_0x36c9('0x20'),this[_0x36c9('0x21')][_0x36c9('0x1e')](this,_0x29aee0));this[_0x36c9('0xd')][_0x18b12a['id']]['on'](_0x36c9('0x22'),this[_0x36c9('0x23')][_0x36c9('0x1e')](this,_0x29aee0));}}else{if(_[_0x36c9('0x14')](this[_0x36c9('0xc')][_0x29aee0]['Imap'])){this[_0x36c9('0xc')][_0x29aee0][_0x36c9('0x11')]={};}this[_0x36c9('0xc')][_0x29aee0][_0x36c9('0x11')][_0x36c9('0x12')]=_0x36c9('0x24');this['mailAccounts'][_0x29aee0][_0x36c9('0x11')][_0x36c9('0x13')]='';this[_0x36c9('0x17')](_0x29aee0);}}}};EmailChannel['prototype'][_0x36c9('0x25')]=function(_0x489c01,_0x4506c3){if(this[_0x36c9('0xc')][_0x489c01]){this[_0x36c9('0xc')][_0x489c01]['Imap'][_0x36c9('0x12')]=_0x36c9('0x26');this[_0x36c9('0xc')][_0x489c01]['Imap']['messageStatus']=_0x4506c3[_0x36c9('0x27')];if(_0x4506c3[_0x36c9('0x28')]){this[_0x36c9('0xc')][_0x489c01][_0x36c9('0x11')][_0x36c9('0x29')]=_0x4506c3['messages'][_0x36c9('0x29')];}return this[_0x36c9('0x17')](_0x489c01);}};EmailChannel[_0x36c9('0xe')][_0x36c9('0x1f')]=function(_0x1ed818,_0x3197d1){logger[_0x36c9('0xa')](_0x36c9('0x2a'),_0x3197d1[_0x36c9('0x2b')],_0x3197d1[_0x36c9('0x2c')],_0x3197d1['from'],_0x1ed818);if(this['mailAccounts'][_0x1ed818]){return mailAccount[_0x36c9('0x2d')](_0x1ed818,_0x3197d1)[_0x36c9('0x2e')](function(_0x41d1ec){if(_0x41d1ec){logger[_0x36c9('0xa')](_0x36c9('0x2f'));}})[_0x36c9('0x30')](function(_0x701729){logger[_0x36c9('0x22')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x701729));});}};EmailChannel['prototype'][_0x36c9('0x21')]=function(_0x4015e4){if(this['mailAccounts'][_0x4015e4]&&this[_0x36c9('0xc')][_0x4015e4][_0x36c9('0x11')]){if(this['imapAccounts'][this[_0x36c9('0xc')][_0x4015e4]['Imap']['id']]){delete this[_0x36c9('0xd')][this[_0x36c9('0xc')][_0x4015e4][_0x36c9('0x11')]['id']];}this['mailAccounts'][_0x4015e4][_0x36c9('0x11')]['lastSync']=moment();this[_0x36c9('0x17')](_0x4015e4);}};EmailChannel['prototype'][_0x36c9('0x23')]=function(_0x4c6e9d,_0x29c63b){if(this['mailAccounts'][_0x4c6e9d]){this[_0x36c9('0xc')][_0x4c6e9d][_0x36c9('0x11')][_0x36c9('0x12')]='error';this[_0x36c9('0xc')][_0x4c6e9d][_0x36c9('0x11')][_0x36c9('0x13')]=_0x29c63b;return this[_0x36c9('0x17')](_0x4c6e9d);}};EmailChannel[_0x36c9('0xe')][_0x36c9('0x31')]=function(_0x4574e5,_0x1caf9d){return this[_0x36c9('0x32')][_0x36c9('0x33')](_0x4574e5,_0x1caf9d);};EmailChannel['prototype'][_0x36c9('0x34')]=function(_0x197191){var _0x3c2cdb=this;if(this[_0x36c9('0xc')][_0x197191['id']]){if(_[_0x36c9('0x14')](this[_0x36c9('0xc')][_0x197191['id']][_0x36c9('0x35')])){this['mailAccounts'][_0x197191['id']][_0x36c9('0x35')]={};}this[_0x36c9('0xc')][_0x197191['id']][_0x36c9('0x35')][_0x36c9('0x36')]=moment();return new BPromise(function(_0x26ff8a,_0x164b10){return _0x3c2cdb['smtp'][_0x36c9('0x37')](_0x197191)[_0x36c9('0x2e')](function(_0x5d7272){_0x3c2cdb[_0x36c9('0xc')][_0x197191['id']][_0x36c9('0x35')][_0x36c9('0x12')]=_0x36c9('0x38');_0x3c2cdb[_0x36c9('0xc')][_0x197191['id']][_0x36c9('0x35')][_0x36c9('0x13')]='';_0x3c2cdb[_0x36c9('0x17')](_0x197191['id']);_0x26ff8a(_0x5d7272);})[_0x36c9('0x30')](function(_0x4749ea){_0x3c2cdb[_0x36c9('0xc')][_0x197191['id']][_0x36c9('0x35')]['status']=_0x36c9('0x22');_0x3c2cdb[_0x36c9('0xc')][_0x197191['id']][_0x36c9('0x35')][_0x36c9('0x13')]=_0x4749ea;_0x3c2cdb[_0x36c9('0x17')](_0x197191['id']);_0x164b10(_0x4749ea);});});}return this[_0x36c9('0x32')]['verify'](_0x197191);};module[_0x36c9('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3a25774..d7d6c4a 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 _0x4e48=['EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','end','handleEnd','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','imap','mailparser','iconv'];(function(_0x46d041,_0x4b80db){var _0x294f8a=function(_0x3ba9f4){while(--_0x3ba9f4){_0x46d041['push'](_0x46d041['shift']());}};_0x294f8a(++_0x4b80db);}(_0x4e48,0x193));var _0x84e4=function(_0x44c24a,_0x239f71){_0x44c24a=_0x44c24a-0x0;var _0x10f256=_0x4e48[_0x44c24a];return _0x10f256;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0x84e4('0x0'));var simpleParser=require(_0x84e4('0x1'))['simpleParser'];var Iconv=require(_0x84e4('0x2'))['Iconv'];var EventEmitter=require('events')[_0x84e4('0x3')];var utils=require(_0x84e4('0x4'));var logger=require(_0x84e4('0x5'))(_0x84e4('0x6'));function EmailImap(_0x2b895e,_0x181874){this[_0x84e4('0x7')]=_0x2b895e[_0x84e4('0x7')];this[_0x84e4('0x8')]=this['getAccount'](_0x2b895e,_0x181874);this[_0x84e4('0x0')]=new Imap(this[_0x84e4('0x8')]);this[_0x84e4('0x0')][_0x84e4('0x9')](_0x84e4('0xa'),this[_0x84e4('0xb')]['bind'](this));this[_0x84e4('0x0')][_0x84e4('0x9')](_0x84e4('0xc'),this[_0x84e4('0xd')]['bind'](this));this['imap']['on'](_0x84e4('0xe'),this[_0x84e4('0xf')][_0x84e4('0x10')](this));this[_0x84e4('0x0')][_0x84e4('0x11')]();}util[_0x84e4('0x12')](EmailImap,EventEmitter);EmailImap[_0x84e4('0x13')]['getAccount']=function(_0x4187b5,_0x1aa9e0){var _0xc70b3f={'connTimeout':_0x4187b5[_0x84e4('0x14')]?_0x4187b5[_0x84e4('0x14')]*0x3e8:0x2710,'authTimeout':_0x4187b5['authTimeout']?_0x4187b5[_0x84e4('0x15')]*0x3e8:0x1388};if(_0x4187b5[_0x84e4('0x16')]){_0xc70b3f[_0x84e4('0x17')]=_0x4187b5['user'];if(_0x4187b5['modernAuthentication']){_0xc70b3f[_0x84e4('0x18')]=utils[_0x84e4('0x19')](_0x4187b5[_0x84e4('0x1a')][_0x84e4('0x1b')],_0x4187b5[_0x84e4('0x17')]);}else{_0xc70b3f[_0x84e4('0x1c')]=_0x4187b5[_0x84e4('0x1c')];}}else{if(_0x4187b5[_0x84e4('0x1d')]){_0xc70b3f['user']=_0x4187b5['user'];_0xc70b3f[_0x84e4('0x1c')]=_0x4187b5[_0x84e4('0x1c')];}}_0xc70b3f['email']=_0x1aa9e0||_0x4187b5['user']||'anonymous@xcally.com';_0xc70b3f[_0x84e4('0x1e')]=_0x4187b5[_0x84e4('0x1e')];_0xc70b3f['port']=_0x4187b5[_0x84e4('0x1f')]||0x3e1;if(_0x4187b5['tls']){_0xc70b3f[_0x84e4('0x20')]=!![];}else{_0xc70b3f[_0x84e4('0x20')]=![];_0xc70b3f[_0x84e4('0x21')]=_0x84e4('0x22');}return _0xc70b3f;};EmailImap[_0x84e4('0x13')]['handleReady']=function(){this[_0x84e4('0x0')]['openBox'](this['mailbox'],![],this[_0x84e4('0x23')]['bind'](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0x23')]=function(_0x47ae9e,_0x422e7e){if(_0x47ae9e){this[_0x84e4('0xf')](_0x47ae9e,!![]);}else{this[_0x84e4('0x24')](_0x84e4('0x25'),_0x422e7e);this[_0x84e4('0x26')]();}};EmailImap[_0x84e4('0x13')][_0x84e4('0x27')]=function(_0x1d609c){if(_0x1d609c){this[_0x84e4('0xf')](_0x1d609c,!![]);}else{this[_0x84e4('0x0')][_0x84e4('0xc')]();}};EmailImap['prototype'][_0x84e4('0x26')]=function(){this[_0x84e4('0x0')][_0x84e4('0x28')]([_0x84e4('0x29')],this[_0x84e4('0x2a')][_0x84e4('0x10')](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0x2a')]=function(_0x3b72f1,_0x1634a6){if(_0x3b72f1){this[_0x84e4('0xf')](_0x3b72f1,!![]);}else{if(_0x1634a6['length']){try{var _0x42eb7c=this[_0x84e4('0x0')][_0x84e4('0x2b')](_0x1634a6,{'bodies':'','markSeen':!![]});_0x42eb7c['on'](_0x84e4('0x2c'),this['handleFetchMessage']['bind'](this));_0x42eb7c[_0x84e4('0x9')]('error',this[_0x84e4('0x2d')]['bind'](this));_0x42eb7c['once'](_0x84e4('0xc'),this[_0x84e4('0x2e')][_0x84e4('0x10')](this));}catch(_0x1aea7f){logger['error'](_0x1aea7f);}}else{this[_0x84e4('0x0')][_0x84e4('0x2f')](!![],this[_0x84e4('0x27')][_0x84e4('0x10')](this));}}};EmailImap['prototype'][_0x84e4('0x30')]=function(_0x3eadcf){_0x3eadcf['on'](_0x84e4('0x31'),this['handleMessageBody'][_0x84e4('0x10')](this));_0x3eadcf[_0x84e4('0x9')](_0x84e4('0x32'),this[_0x84e4('0x33')][_0x84e4('0x10')](this));_0x3eadcf[_0x84e4('0x9')](_0x84e4('0xc'),this[_0x84e4('0x34')][_0x84e4('0x10')](this));};EmailImap[_0x84e4('0x13')]['handleMessageBody']=function(_0x3381ba){simpleParser(_0x3381ba,{'Iconv':Iconv},this[_0x84e4('0x35')][_0x84e4('0x10')](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0x33')]=function(){};EmailImap[_0x84e4('0x13')][_0x84e4('0x34')]=function(){};EmailImap[_0x84e4('0x13')][_0x84e4('0x35')]=function(_0xf751f7,_0x1ae91d){if(_0xf751f7){logger[_0x84e4('0xe')](_0xf751f7);}else{var _0x334391=this;utils[_0x84e4('0x36')](this[_0x84e4('0x8')],_0x1ae91d,function(_0x7da2c8){_0x334391['emit'](_0x84e4('0x6'),_0x7da2c8);});}};EmailImap[_0x84e4('0x13')][_0x84e4('0x2e')]=function(){this[_0x84e4('0x0')][_0x84e4('0x2f')](!![],this[_0x84e4('0x27')]['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x309b0d){this[_0x84e4('0xf')](_0x309b0d);this[_0x84e4('0x0')]['closeBox'](!![],this[_0x84e4('0x27')]['bind'](this));};EmailImap[_0x84e4('0x13')][_0x84e4('0xd')]=function(){this[_0x84e4('0x24')](_0x84e4('0xc'));};EmailImap[_0x84e4('0x13')]['handleError']=function(_0xe64f1e,_0x50c703){logger[_0x84e4('0xe')](_0x84e4('0xf'),this[_0x84e4('0x8')]['email'],JSON['stringify'](_0xe64f1e));var _0x84cabd='';if(_0xe64f1e){if(_0xe64f1e[_0x84e4('0x37')]){_0x84cabd=_0xe64f1e['textCode'];}else{for(var _0x19b2b0 in _0xe64f1e){if(_0xe64f1e[_0x84e4('0x38')](_0x19b2b0)){_0x84cabd+=_[_0x84e4('0x39')](_0x19b2b0)+':\x20'+_0xe64f1e[_0x19b2b0]+'\x0a';}}}}if(_0x50c703){this[_0x84e4('0x0')][_0x84e4('0xc')]();}else{this[_0x84e4('0x24')](_0x84e4('0xe'),_0x84cabd);this[_0x84e4('0x24')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0xd697=['user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','handleError','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','prototype','connTimeout','authTimeout'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0xd697,0x11b));var _0x7d69=function(_0x1311a4,_0x471534){_0x1311a4=_0x1311a4-0x0;var _0x2640c3=_0xd697[_0x1311a4];return _0x2640c3;};'use strict';var _=require(_0x7d69('0x0'));var util=require('util');var Imap=require(_0x7d69('0x1'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x7d69('0x2'))[_0x7d69('0x3')];var EventEmitter=require(_0x7d69('0x4'))[_0x7d69('0x5')];var utils=require('./utils');var logger=require(_0x7d69('0x6'))(_0x7d69('0x7'));function EmailImap(_0x38edf6,_0x8f69c){this[_0x7d69('0x8')]=_0x38edf6[_0x7d69('0x8')];this[_0x7d69('0x9')]=this[_0x7d69('0xa')](_0x38edf6,_0x8f69c);this[_0x7d69('0x1')]=new Imap(this[_0x7d69('0x9')]);this[_0x7d69('0x1')][_0x7d69('0xb')](_0x7d69('0xc'),this[_0x7d69('0xd')][_0x7d69('0xe')](this));this['imap'][_0x7d69('0xb')](_0x7d69('0xf'),this[_0x7d69('0x10')][_0x7d69('0xe')](this));this[_0x7d69('0x1')]['on'](_0x7d69('0x11'),this['handleError'][_0x7d69('0xe')](this));this[_0x7d69('0x1')][_0x7d69('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x7d69('0x13')][_0x7d69('0xa')]=function(_0x290568,_0x25c3be){var _0x1c7fd0={'connTimeout':_0x290568[_0x7d69('0x14')]?_0x290568['connTimeout']*0x3e8:0x2710,'authTimeout':_0x290568[_0x7d69('0x15')]?_0x290568['authTimeout']*0x3e8:0x1388};if(_0x290568['service']){_0x1c7fd0[_0x7d69('0x16')]=_0x290568['user'];if(_0x290568[_0x7d69('0x17')]){_0x1c7fd0['xoauth2']=utils[_0x7d69('0x18')](_0x290568[_0x7d69('0x19')][_0x7d69('0x1a')],_0x290568[_0x7d69('0x16')]);}else{_0x1c7fd0[_0x7d69('0x1b')]=_0x290568[_0x7d69('0x1b')];}}else{if(_0x290568[_0x7d69('0x1c')]){_0x1c7fd0[_0x7d69('0x16')]=_0x290568[_0x7d69('0x16')];_0x1c7fd0[_0x7d69('0x1b')]=_0x290568[_0x7d69('0x1b')];}}_0x1c7fd0[_0x7d69('0x7')]=_0x25c3be||_0x290568[_0x7d69('0x16')]||_0x7d69('0x1d');_0x1c7fd0['host']=_0x290568[_0x7d69('0x1e')];_0x1c7fd0[_0x7d69('0x1f')]=_0x290568[_0x7d69('0x1f')]||0x3e1;if(_0x290568[_0x7d69('0x20')]){_0x1c7fd0[_0x7d69('0x20')]=!![];}else{_0x1c7fd0[_0x7d69('0x20')]=![];_0x1c7fd0['autotls']=_0x7d69('0x21');}return _0x1c7fd0;};EmailImap[_0x7d69('0x13')][_0x7d69('0xd')]=function(){this[_0x7d69('0x1')][_0x7d69('0x22')](this[_0x7d69('0x8')],![],this[_0x7d69('0x23')][_0x7d69('0xe')](this));};EmailImap[_0x7d69('0x13')][_0x7d69('0x23')]=function(_0x5dd47b,_0xe4d328){if(_0x5dd47b){this['handleError'](_0x5dd47b,!![]);}else{this[_0x7d69('0x24')]('box',_0xe4d328);this[_0x7d69('0x25')]();}};EmailImap[_0x7d69('0x13')][_0x7d69('0x26')]=function(_0x3b54da){if(_0x3b54da){this[_0x7d69('0x27')](_0x3b54da,!![]);}else{this['imap'][_0x7d69('0xf')]();}};EmailImap[_0x7d69('0x13')][_0x7d69('0x25')]=function(){this[_0x7d69('0x1')][_0x7d69('0x28')]([_0x7d69('0x29')],this[_0x7d69('0x2a')][_0x7d69('0xe')](this));};EmailImap[_0x7d69('0x13')][_0x7d69('0x2a')]=function(_0x418c2a,_0x4cd02b){if(_0x418c2a){this[_0x7d69('0x27')](_0x418c2a,!![]);}else{if(_0x4cd02b['length']){try{var _0x359c53=this[_0x7d69('0x1')][_0x7d69('0x2b')](_0x4cd02b,{'bodies':'','markSeen':!![]});_0x359c53['on'](_0x7d69('0x2c'),this[_0x7d69('0x2d')]['bind'](this));_0x359c53[_0x7d69('0xb')](_0x7d69('0x11'),this[_0x7d69('0x2e')][_0x7d69('0xe')](this));_0x359c53[_0x7d69('0xb')]('end',this[_0x7d69('0x2f')][_0x7d69('0xe')](this));}catch(_0x573417){logger['error'](_0x573417);}}else{this[_0x7d69('0x1')]['closeBox'](!![],this[_0x7d69('0x26')][_0x7d69('0xe')](this));}}};EmailImap[_0x7d69('0x13')][_0x7d69('0x2d')]=function(_0x2c8b4d){_0x2c8b4d['on'](_0x7d69('0x30'),this[_0x7d69('0x31')][_0x7d69('0xe')](this));_0x2c8b4d['once'](_0x7d69('0x32'),this[_0x7d69('0x33')][_0x7d69('0xe')](this));_0x2c8b4d[_0x7d69('0xb')](_0x7d69('0xf'),this[_0x7d69('0x34')][_0x7d69('0xe')](this));};EmailImap[_0x7d69('0x13')]['handleMessageBody']=function(_0x246d67){simpleParser(_0x246d67,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x7d69('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x7d69('0x13')][_0x7d69('0x34')]=function(){};EmailImap['prototype'][_0x7d69('0x35')]=function(_0x576dde,_0x3a17c5){if(_0x576dde){logger[_0x7d69('0x11')](_0x576dde);}else{var _0x24f204=this;utils[_0x7d69('0x36')](this[_0x7d69('0x9')],_0x3a17c5,function(_0x3cd675){_0x24f204[_0x7d69('0x24')](_0x7d69('0x7'),_0x3cd675);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x7d69('0x1')][_0x7d69('0x37')](!![],this[_0x7d69('0x26')][_0x7d69('0xe')](this));};EmailImap[_0x7d69('0x13')][_0x7d69('0x2e')]=function(_0x46cdfb){this[_0x7d69('0x27')](_0x46cdfb);this[_0x7d69('0x1')]['closeBox'](!![],this[_0x7d69('0x26')][_0x7d69('0xe')](this));};EmailImap[_0x7d69('0x13')]['handleEnd']=function(){this['emit'](_0x7d69('0xf'));};EmailImap[_0x7d69('0x13')]['handleError']=function(_0x3b919e,_0x1849fb){logger[_0x7d69('0x11')](_0x7d69('0x27'),this['account'][_0x7d69('0x7')],JSON[_0x7d69('0x38')](_0x3b919e));var _0x200ca3='';if(_0x3b919e){if(_0x3b919e[_0x7d69('0x39')]){_0x200ca3=_0x3b919e['textCode'];}else{for(var _0x562d04 in _0x3b919e){if(_0x3b919e[_0x7d69('0x3a')](_0x562d04)){_0x200ca3+=_[_0x7d69('0x3b')](_0x562d04)+':\x20'+_0x3b919e[_0x562d04]+'\x0a';}}}}if(_0x1849fb){this[_0x7d69('0x1')]['end']();}else{this[_0x7d69('0x24')](_0x7d69('0x11'),_0x200ca3);this[_0x7d69('0x24')](_0x7d69('0xf'));}};module[_0x7d69('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 0288b8a..ebe9e14 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 _0xed0c=['nodemailer-plugin-inline-base64','prototype','send','createTransport','toString','verify','exports','nodemailer'];(function(_0x52c30a,_0x40107d){var _0x33a05b=function(_0x404d55){while(--_0x404d55){_0x52c30a['push'](_0x52c30a['shift']());}};_0x33a05b(++_0x40107d);}(_0xed0c,0x87));var _0xced0=function(_0x3e0f94,_0x21dc2d){_0x3e0f94=_0x3e0f94-0x0;var _0x17c6ad=_0xed0c[_0x3e0f94];return _0x17c6ad;};'use strict';var nodemailer=require(_0xced0('0x0'));var inlineBase64=require(_0xced0('0x1'));function EmailSmtp(){}EmailSmtp[_0xced0('0x2')][_0xced0('0x3')]=function(_0x160922,_0x4faf92){return new Promise(function(_0x4230e7,_0x2e5bd1){var _0x278f39=nodemailer[_0xced0('0x4')](_0x160922);_0x278f39['use']('compile',inlineBase64());_0x278f39['sendMail'](_0x4faf92,function(_0x19c56e,_0x19689b){if(_0x19c56e){_0x2e5bd1(_0x19c56e[_0xced0('0x5')]());}else{_0x4230e7(_0x19689b);}});});};EmailSmtp[_0xced0('0x2')][_0xced0('0x6')]=function(_0x5c0903){return new Promise(function(_0x5a9820,_0x10a26d){var _0x2ab862=nodemailer['createTransport'](_0x5c0903);_0x2ab862['verify'](function(_0x123b2c,_0x8eb288){if(_0x123b2c){_0x10a26d(_0x123b2c[_0xced0('0x5')]());}else{if(_0x8eb288){_0x5a9820(_0x8eb288);}else{_0x10a26d('Not\x20verifired');}}});});};module[_0xced0('0x7')]=EmailSmtp; \ No newline at end of file +var _0x004d=['prototype','send','use','sendMail','toString','verify','Not\x20verifired','nodemailer-plugin-inline-base64'];(function(_0x227e0f,_0x48d6ff){var _0x109ee0=function(_0x4e4886){while(--_0x4e4886){_0x227e0f['push'](_0x227e0f['shift']());}};_0x109ee0(++_0x48d6ff);}(_0x004d,0xa7));var _0xd004=function(_0x33e12a,_0xc4e85){_0x33e12a=_0x33e12a-0x0;var _0x5a5d49=_0x004d[_0x33e12a];return _0x5a5d49;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xd004('0x0'));function EmailSmtp(){}EmailSmtp[_0xd004('0x1')][_0xd004('0x2')]=function(_0x2ebf5c,_0x3c85a5){return new Promise(function(_0x17b051,_0x46e820){var _0x6b68c0=nodemailer['createTransport'](_0x2ebf5c);_0x6b68c0[_0xd004('0x3')]('compile',inlineBase64());_0x6b68c0[_0xd004('0x4')](_0x3c85a5,function(_0x10753b,_0x416e7f){if(_0x10753b){_0x46e820(_0x10753b[_0xd004('0x5')]());}else{_0x17b051(_0x416e7f);}});});};EmailSmtp[_0xd004('0x1')][_0xd004('0x6')]=function(_0x170da6){return new Promise(function(_0x10c58c,_0x23fa39){var _0x289b7c=nodemailer['createTransport'](_0x170da6);_0x289b7c[_0xd004('0x6')](function(_0x3527fb,_0x5e9509){if(_0x3527fb){_0x23fa39(_0x3527fb[_0xd004('0x5')]());}else{if(_0x5e9509){_0x10c58c(_0x5e9509);}else{_0x23fa39(_0xd004('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b3b469a..ebc6c9c 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 _0x7999=['parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','@xcally.com','value','substring','name','indexOf','split','length','slice','join','Anonymous','isEmpty','generate','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20]','body','0x1?_0x423e91[_0x9799('0x13')](0x0,-0x1)[_0x9799('0x14')]('\x20'):_0x5f0d25['name'];}return _0x9799('0x15');}function getLastName(_0x1fad28){var _0x25b584=_[_0x9799('0x9')](_0x1fad28[_0x9799('0xd')]);if(_0x25b584&&_0x25b584['name']){var _0x1aa76e=_0x25b584[_0x9799('0xf')]['split'](/\s+/);return _0x1aa76e[_0x9799('0x12')]>0x1?_0x1aa76e['pop']():'';}return'';}function getMails(_0x175563,_0x5ebaac){var _0x2e308b='';for(var _0x863cbe=0x0;_0x863cbe<_0x5ebaac[_0x9799('0xd')]['length'];_0x863cbe+=0x1){if(_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xa')]!==_0x175563){if(!_[_0x9799('0x16')](_0x2e308b)){_0x2e308b+=',';}_0x2e308b+=_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xf')]||_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xa')]||'';_0x2e308b+='\x20<';_0x2e308b+=_0x5ebaac['value'][_0x863cbe][_0x9799('0xa')]?_0x5ebaac[_0x9799('0xd')][_0x863cbe][_0x9799('0xa')]:_0x9799('0xb')+random[_0x9799('0x17')](0x6)+'@xcally.com';_0x2e308b+='>';}}return _0x2e308b;}function parseEmail(_0x54db05,_0x376227,_0x456571){if(_0x376227[_0x9799('0x18')]){var _0x4b7935=/)<[^<]*)*<\/script>/gi;while(_0x4b7935[_0x9799('0x19')](_0x376227[_0x9799('0x18')])){_0x376227[_0x9799('0x18')]=_0x376227['html'][_0x9799('0x1a')](_0x4b7935,'');}if(_0x376227[_0x9799('0x18')][_0x9799('0x1b')]('{_0x3a6484[_0x9799('0x1e')](_0x104889[_0x9799('0x1f')]);});var _0x43cc33=/]+>/g;var _0x25db7d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x51823f=_0x376227[_0x9799('0x18')][_0x9799('0x1a')](_0x25db7d,_0x9799('0x20'));var _0x34e41f=_0x51823f['replace'](_0x43cc33,'_IMG');for(let _0xf8f01=0x0;_0xf8f01<_0x3a6484[_0x9799('0x12')];_0xf8f01++){var _0x3f5644=_0x34e41f[_0x9799('0x1a')](_0x9799('0x21'),'\x20[Attachment:\x20'+_0x3a6484[_0xf8f01]+_0x9799('0x22'));_0x34e41f=_0x3f5644;}_0x376227[_0x9799('0x18')]=_0x34e41f;}_0x456571[_0x9799('0x23')]=_0x376227[_0x9799('0x18')];}else{_0x456571['body']=_0x376227['textAsHtml'];}if(_0x456571[_0x9799('0x23')]){_0x456571[_0x9799('0x23')]=_0x456571[_0x9799('0x23')][_0x9799('0x1a')](/0x0){var _0x2b127f=[_0x9799('0x34'),_0x9799('0x35'),'Precedence:\x20auto_reply'];for(var _0x4ccb1e=0x0;_0x4ccb1e<_0x376227['headerLines'][_0x9799('0x12')];_0x4ccb1e++){var _0x1cebbd=_[_0x9799('0x10')](_0x2b127f,_0x376227[_0x9799('0x33')][_0x4ccb1e][_0x9799('0x36')]);if(_0x1cebbd>=0x0){_0x456571['isAutoreply']=!![];}}}return _0x456571;}exports[_0x9799('0x37')]=function(_0x4e3cab,_0x2a0bc0,_0x8a761f){var _0x459e34={'from':getAddress(_0x2a0bc0[_0x9799('0x38')]),'firstName':getFirstName(_0x2a0bc0[_0x9799('0x38')]),'lastName':getLastName(_0x2a0bc0[_0x9799('0x38')]),'mapKey':_0x9799('0x7'),'message':{'from':getMails(_0x4e3cab['email'],_0x2a0bc0[_0x9799('0x38')]),'to':_0x4e3cab[_0x9799('0x7')],'cc':'','subject':_0x2a0bc0[_0x9799('0x39')]||'','messageId':_0x2a0bc0[_0x9799('0x3a')],'inReplyTo':_0x2a0bc0[_0x9799('0x3b')],'sentAt':moment(_0x2a0bc0['date'])[_0x9799('0x2c')](_0x9799('0x3c')),'attach':![],'attachments':[]}};if(!_0x2a0bc0['html']&&!_0x2a0bc0[_0x9799('0x3d')]){var _0x4975dd=_[_0x9799('0x3e')](_0x2a0bc0['attachments'],{'contentType':_0x9799('0x3f')});if(_0x4975dd['length']){logger['info'](util[_0x9799('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x2a0bc0[_0x9799('0x3a')]));tnef[_0x9799('0x40')](_[_0x9799('0x41')](_0x4975dd)[_0x9799('0x31')],function(_0xc0362f,_0x30d871){if(_0x30d871){_0x2a0bc0[_0x9799('0x18')]=_0x30d871[_0x9799('0x42')]||'

Empty\x20message

';if(_0x30d871[_0x9799('0x43')]){for(var _0x5ccb54=0x0;_0x5ccb54<_0x30d871[_0x9799('0x43')][_0x9799('0x12')];_0x5ccb54++){var _0x577418=_0x30d871[_0x9799('0x43')][_0x5ccb54];_0x459e34[_0x9799('0x26')][_0x9799('0x1c')][_0x9799('0x1e')]({'filename':_0x577418[_0x9799('0x44')],'content':Buffer[_0x9799('0x38')](_0x577418[_0x9799('0x45')])});}}}_0x8a761f(parseEmail(_0x4e3cab,_0x2a0bc0,_0x459e34));});}else{_0x2a0bc0['html']=_0x9799('0x46');_0x8a761f(parseEmail(_0x4e3cab,_0x2a0bc0,_0x459e34));}}else{_0x8a761f(parseEmail(_0x4e3cab,_0x2a0bc0,_0x459e34));}};exports[_0x9799('0x47')]=function(_0x52be69,_0x312655){var _0x218563=[_0x9799('0x48')+(_0x312655||''),_0x9799('0x49')+_0x52be69,'',''];return Buffer[_0x9799('0x38')](_0x218563[_0x9799('0x14')](''),_0x9799('0x4a'))['toString']('base64');}; \ No newline at end of file +var _0x647b=['Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','

Empty\x20message

','Attachments','Title','Data','auth=Bearer\x20','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x31fefd[_0xb647('0x13')](0x0,-0x1)[_0xb647('0x14')]('\x20'):_0xd77d44[_0xb647('0xe')];}return _0xb647('0x15');}function getLastName(_0x5621a9){var _0x5e1470=_[_0xb647('0x9')](_0x5621a9[_0xb647('0xa')]);if(_0x5e1470&&_0x5e1470[_0xb647('0xe')]){var _0x4e46d2=_0x5e1470[_0xb647('0xe')][_0xb647('0x11')](/\s+/);return _0x4e46d2[_0xb647('0x12')]>0x1?_0x4e46d2[_0xb647('0x16')]():'';}return'';}function getMails(_0x40d6e8,_0x1516a0){var _0x2ba345='';for(var _0x288233=0x0;_0x288233<_0x1516a0[_0xb647('0xa')][_0xb647('0x12')];_0x288233+=0x1){if(_0x1516a0['value'][_0x288233][_0xb647('0xb')]!==_0x40d6e8){if(!_[_0xb647('0x17')](_0x2ba345)){_0x2ba345+=',';}_0x2ba345+=_0x1516a0[_0xb647('0xa')][_0x288233]['name']||_0x1516a0[_0xb647('0xa')][_0x288233][_0xb647('0xb')]||'';_0x2ba345+='\x20<';_0x2ba345+=_0x1516a0[_0xb647('0xa')][_0x288233][_0xb647('0xb')]?_0x1516a0[_0xb647('0xa')][_0x288233]['address']:_0xb647('0xc')+random[_0xb647('0x18')](0x6)+_0xb647('0xd');_0x2ba345+='>';}}return _0x2ba345;}function parseEmail(_0x2e60e7,_0x3567c6,_0x497d8f){if(_0x3567c6[_0xb647('0x19')]){var _0xc87b97=/)<[^<]*)*<\/script>/gi;while(_0xc87b97[_0xb647('0x1a')](_0x3567c6[_0xb647('0x19')])){_0x3567c6[_0xb647('0x19')]=_0x3567c6[_0xb647('0x19')][_0xb647('0x1b')](_0xc87b97,'');}if(_0x3567c6[_0xb647('0x19')][_0xb647('0x1c')](_0xb647('0x1d'))){var _0x5c1ce0=[];_0x3567c6['attachments'][_0xb647('0x1e')](_0x173a03=>{_0x5c1ce0['push'](_0x173a03[_0xb647('0x1f')]);});var _0x12fb30=/]+>/g;var _0x1720fa=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2bdd3d=_0x3567c6['html'][_0xb647('0x1b')](_0x1720fa,'_SRC');var _0x5a5d31=_0x2bdd3d[_0xb647('0x1b')](_0x12fb30,_0xb647('0x20'));for(let _0x358905=0x0;_0x358905<_0x5c1ce0['length'];_0x358905++){var _0x19459f=_0x5a5d31[_0xb647('0x1b')]('_IMG',_0xb647('0x21')+_0x5c1ce0[_0x358905]+_0xb647('0x22'));_0x5a5d31=_0x19459f;}_0x3567c6[_0xb647('0x19')]=_0x5a5d31;}_0x497d8f[_0xb647('0x23')]=_0x3567c6[_0xb647('0x19')];}else{_0x497d8f[_0xb647('0x23')]=_0x3567c6[_0xb647('0x24')];}if(_0x497d8f[_0xb647('0x23')]){_0x497d8f[_0xb647('0x23')]=_0x497d8f[_0xb647('0x23')][_0xb647('0x1b')](/0x0){var _0x409ca2=[_0xb647('0x37'),'X-Auto-Response-Suppress:\x20All',_0xb647('0x38')];for(var _0x54b9be=0x0;_0x54b9be<_0x3567c6[_0xb647('0x36')][_0xb647('0x12')];_0x54b9be++){var _0x14f069=_[_0xb647('0x10')](_0x409ca2,_0x3567c6[_0xb647('0x36')][_0x54b9be][_0xb647('0x39')]);if(_0x14f069>=0x0){_0x497d8f[_0xb647('0x3a')]=!![];}}}return _0x497d8f;}exports[_0xb647('0x3b')]=function(_0x3f1364,_0x30f0f2,_0x240ad9){var _0x36a5be={'from':getAddress(_0x30f0f2['from']),'firstName':getFirstName(_0x30f0f2[_0xb647('0x3c')]),'lastName':getLastName(_0x30f0f2[_0xb647('0x3c')]),'mapKey':_0xb647('0x7'),'message':{'from':getMails(_0x3f1364[_0xb647('0x7')],_0x30f0f2[_0xb647('0x3c')]),'to':_0x3f1364['email'],'cc':'','subject':_0x30f0f2[_0xb647('0x3d')]||'','messageId':_0x30f0f2[_0xb647('0x3e')],'inReplyTo':_0x30f0f2['inReplyTo'],'sentAt':moment(_0x30f0f2['date'])[_0xb647('0x2e')](_0xb647('0x3f')),'attach':![],'attachments':[]}};if(!_0x30f0f2[_0xb647('0x19')]&&!_0x30f0f2[_0xb647('0x24')]){var _0x2506e7=_['filter'](_0x30f0f2['attachments'],{'contentType':'application/ms-tnef'});if(_0x2506e7[_0xb647('0x12')]){logger['info'](util['format'](_0xb647('0x40'),_0x30f0f2['messageId']));tnef[_0xb647('0x41')](_[_0xb647('0x42')](_0x2506e7)[_0xb647('0x43')],function(_0x425128,_0x40ba49){if(_0x40ba49){_0x30f0f2['html']=_0x40ba49['BodyHTML']||_0xb647('0x44');if(_0x40ba49[_0xb647('0x45')]){for(var _0xb63852=0x0;_0xb63852<_0x40ba49[_0xb647('0x45')][_0xb647('0x12')];_0xb63852++){var _0x109ccc=_0x40ba49[_0xb647('0x45')][_0xb63852];_0x36a5be[_0xb647('0x26')]['attachments'][_0xb647('0x34')]({'filename':_0x109ccc[_0xb647('0x46')],'content':Buffer[_0xb647('0x3c')](_0x109ccc[_0xb647('0x47')])});}}}_0x240ad9(parseEmail(_0x3f1364,_0x30f0f2,_0x36a5be));});}else{_0x30f0f2[_0xb647('0x19')]=_0xb647('0x44');_0x240ad9(parseEmail(_0x3f1364,_0x30f0f2,_0x36a5be));}}else{_0x240ad9(parseEmail(_0x3f1364,_0x30f0f2,_0x36a5be));}};exports['generateXOAuth2Token']=function(_0x488dea,_0x459753){var _0x307849=['user='+(_0x459753||''),_0xb647('0x48')+_0x488dea,'',''];return Buffer['from'](_0x307849['join'](''),'utf-8')['toString'](_0xb647('0x49'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 0c4f4b5..2a4c1c2 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 _0xf64d=['SERV','active','Imap','Smtp','exports','lodash','Service','key'];(function(_0x38553b,_0x1ee976){var _0x54d386=function(_0x3fe9d6){while(--_0x3fe9d6){_0x38553b['push'](_0x38553b['shift']());}};_0x54d386(++_0x1ee976);}(_0xf64d,0x1a5));var _0xdf64=function(_0x491c1e,_0x32710a){_0x491c1e=_0x491c1e-0x0;var _0x30d20b=_0xf64d[_0x491c1e];return _0x30d20b;};'use strict';var _=require(_0xdf64('0x0'));function MailAccount(_0x46baa8){this['id']=_0x46baa8['id']||0x0;this['name']=_0x46baa8['name']||_0xdf64('0x1');this[_0xdf64('0x2')]=_0x46baa8[_0xdf64('0x2')]||_0xdf64('0x3');this[_0xdf64('0x4')]=_0x46baa8[_0xdf64('0x4')]||![];this['Imap']=_0x46baa8[_0xdf64('0x5')]||[];this[_0xdf64('0x6')]=_0x46baa8['Smtp']||[];}module[_0xdf64('0x7')]=MailAccount; \ No newline at end of file +var _0x49fe=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x88281e,_0x502f0b){var _0x4c8edf=function(_0x1d8afc){while(--_0x1d8afc){_0x88281e['push'](_0x88281e['shift']());}};_0x4c8edf(++_0x502f0b);}(_0x49fe,0xa0));var _0xe49f=function(_0x4dd273,_0x40741e){_0x4dd273=_0x4dd273-0x0;var _0x4bd225=_0x49fe[_0x4dd273];return _0x4bd225;};'use strict';var _=require(_0xe49f('0x0'));function MailAccount(_0x4930e7){this['id']=_0x4930e7['id']||0x0;this['name']=_0x4930e7[_0xe49f('0x1')]||_0xe49f('0x2');this['key']=_0x4930e7[_0xe49f('0x3')]||'SERV';this[_0xe49f('0x4')]=_0x4930e7['active']||![];this[_0xe49f('0x5')]=_0x4930e7[_0xe49f('0x5')]||[];this[_0xe49f('0x6')]=_0x4930e7[_0xe49f('0x6')]||[];}module[_0xe49f('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 2c9c19c..bc7cd37 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 _0x11ac=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','length','isUndefined'];(function(_0x20c0af,_0x5d2561){var _0x5b8435=function(_0x391a1d){while(--_0x391a1d){_0x20c0af['push'](_0x20c0af['shift']());}};_0x5b8435(++_0x5d2561);}(_0x11ac,0x10f));var _0xc11a=function(_0x49cf92,_0x1fd227){_0x49cf92=_0x49cf92-0x0;var _0x54da82=_0x11ac[_0x49cf92];return _0x54da82;};'use strict';var _=require(_0xc11a('0x0'));var MailAccount=require(_0xc11a('0x1'));var Realtime=function(){this[_0xc11a('0x2')]={};};function freeIsNotKey(_0xafe7bc,_0x5c61f8,_0x45b808){var _0x4df26b=_[_0xc11a('0x3')](_0xafe7bc,function(_0x445336,_0x87dd97){return _0x445336[_0x45b808];});for(var _0x24198e in _0x5c61f8){if(_0x5c61f8[_0xc11a('0x4')](_0x24198e)){if(!_0x4df26b[_0x24198e]){delete _0x5c61f8[_0x24198e];}}}}Realtime[_0xc11a('0x5')]['mergeFromDatabase']=function(_0x2f7b21,_0x3e767d){for(var _0x48fadf in _0x3e767d){if(_0x2f7b21['hasOwnProperty'](_0x48fadf)){_0x2f7b21[_0x48fadf]=_0x3e767d[_0x48fadf];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x17fe74=this;return function(_0x4ecbd2){if(_0x4ecbd2){freeIsNotKey(_0x4ecbd2,_0x17fe74['mailAccounts'],'id');for(var _0x400920=0x0,_0x352b97={},_0x59a157={};_0x400920<_0x4ecbd2[_0xc11a('0x6')];_0x400920+=0x1){_0x352b97=_0x4ecbd2[_0x400920];if(_[_0xc11a('0x7')](_0x17fe74[_0xc11a('0x2')][_0x352b97['id']])){_0x17fe74['mailAccounts'][_0x352b97['id']]=new MailAccount(_0x352b97);}else{_['merge'](_0x17fe74[_0xc11a('0x2')][_0x352b97['id']],_0x352b97);}}}return _0x17fe74['mailAccounts'];};};module[_0xc11a('0x8')]=Realtime; \ No newline at end of file +var _0xe5ea=['mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','exports'];(function(_0x2cd5de,_0x375f28){var _0x44d34e=function(_0x44aa82){while(--_0x44aa82){_0x2cd5de['push'](_0x2cd5de['shift']());}};_0x44d34e(++_0x375f28);}(_0xe5ea,0xe8));var _0xae5e=function(_0x10e9e2,_0x5e9dba){_0x10e9e2=_0x10e9e2-0x0;var _0x44f5b8=_0xe5ea[_0x10e9e2];return _0x44f5b8;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xae5e('0x0')]={};};function freeIsNotKey(_0x4ddde6,_0x3a46fa,_0x19ffc9){var _0x17a0ac=_[_0xae5e('0x1')](_0x4ddde6,function(_0xd9d2c5,_0x3f9de3){return _0xd9d2c5[_0x19ffc9];});for(var _0x121828 in _0x3a46fa){if(_0x3a46fa['hasOwnProperty'](_0x121828)){if(!_0x17a0ac[_0x121828]){delete _0x3a46fa[_0x121828];}}}}Realtime['prototype'][_0xae5e('0x2')]=function(_0xab7577,_0x37c9f3){for(var _0x1f669b in _0x37c9f3){if(_0xab7577[_0xae5e('0x3')](_0x1f669b)){_0xab7577[_0x1f669b]=_0x37c9f3[_0x1f669b];}}};Realtime['prototype'][_0xae5e('0x4')]=function(){var _0x103410=this;return function(_0x30c55d){if(_0x30c55d){freeIsNotKey(_0x30c55d,_0x103410[_0xae5e('0x0')],'id');for(var _0x3cb749=0x0,_0x43c822={},_0x12126e={};_0x3cb749<_0x30c55d[_0xae5e('0x5')];_0x3cb749+=0x1){_0x43c822=_0x30c55d[_0x3cb749];if(_[_0xae5e('0x6')](_0x103410[_0xae5e('0x0')][_0x43c822['id']])){_0x103410[_0xae5e('0x0')][_0x43c822['id']]=new MailAccount(_0x43c822);}else{_['merge'](_0x103410['mailAccounts'][_0x43c822['id']],_0x43c822);}}}return _0x103410[_0xae5e('0x0')];};};module[_0xae5e('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 6433c0f..a2ee899 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 _0x3c36=['getMailAccount','notify','Request','GetMailAccount','name','service','email','active','ListId','TemplateId','type','CloudProvider','MailServerOut','Smtp'];(function(_0x3e56ab,_0x4c50df){var _0x1e204f=function(_0x3186cf){while(--_0x3186cf){_0x3e56ab['push'](_0x3e56ab['shift']());}};_0x1e204f(++_0x4c50df);}(_0x3c36,0x10c));var _0x63c3=function(_0x55f3a8,_0x360d39){_0x55f3a8=_0x55f3a8-0x0;var _0x33886b=_0x3c36[_0x55f3a8];return _0x33886b;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x63c3('0x0')](_0x63c3('0x1'),{'options':{'attributes':['id',_0x63c3('0x2'),'provider',_0x63c3('0x3'),_0x63c3('0x4'),_0x63c3('0x5'),'key',_0x63c3('0x6'),_0x63c3('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x63c3('0x2'),'service',_0x63c3('0x8'),'data5'],'as':_0x63c3('0x9')}]},{'model':_0x63c3('0xa'),'as':_0x63c3('0xb'),'include':[{'model':_0x63c3('0x9'),'attributes':['id','name',_0x63c3('0x3'),'type','data5'],'as':_0x63c3('0x9')}]}]},'log':_0x63c3('0xc')});};};exports[_0x63c3('0xd')]=function(_0x211adc,_0xcf3381){return client[_0x63c3('0x0')]('NotifyMailAccount',{'account':{'id':_0x211adc},'body':_0xcf3381,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xbb6b=['Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','key','ListId','TemplateId','MailServerIn'];(function(_0x22205c,_0x473493){var _0x3f5efe=function(_0x153dbb){while(--_0x153dbb){_0x22205c['push'](_0x22205c['shift']());}};_0x3f5efe(++_0x473493);}(_0xbb6b,0xa9));var _0xbbb6=function(_0x3a6c69,_0x3c1e13){_0x3a6c69=_0x3a6c69-0x0;var _0x26fd6a=_0xbb6b[_0x3a6c69];return _0x26fd6a;};'use strict';var client=require(_0xbbb6('0x0'));exports[_0xbbb6('0x1')]=function(){return function(){return client[_0xbbb6('0x2')](_0xbbb6('0x3'),{'options':{'attributes':['id',_0xbbb6('0x4'),'provider',_0xbbb6('0x5'),_0xbbb6('0x6'),'active',_0xbbb6('0x7'),_0xbbb6('0x8'),_0xbbb6('0x9')],'raw':![],'include':[{'model':_0xbbb6('0xa'),'as':_0xbbb6('0xb'),'include':[{'model':_0xbbb6('0xc'),'attributes':['id','name','service',_0xbbb6('0xd'),_0xbbb6('0xe')],'as':_0xbbb6('0xc')}]},{'model':_0xbbb6('0xf'),'as':_0xbbb6('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0xbbb6('0x4'),_0xbbb6('0x5'),_0xbbb6('0xd'),_0xbbb6('0xe')],'as':_0xbbb6('0xc')}]}]},'log':_0xbbb6('0x11')});};};exports[_0xbbb6('0x12')]=function(_0x3b36bb,_0x5a71ef){return client[_0xbbb6('0x2')](_0xbbb6('0x13'),{'account':{'id':_0x3b36bb},'body':_0x5a71ef,'log':_0xbbb6('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1a5d4fb..719dd51 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 _0x27c5=['GetSettings','../client','getSettings','Request'];(function(_0x150f94,_0x4f83cf){var _0x2e0fb6=function(_0x48b09e){while(--_0x48b09e){_0x150f94['push'](_0x150f94['shift']());}};_0x2e0fb6(++_0x4f83cf);}(_0x27c5,0x151));var _0x527c=function(_0x175a8c,_0x2d9212){_0x175a8c=_0x175a8c-0x0;var _0x37b0b0=_0x27c5[_0x175a8c];return _0x37b0b0;};'use strict';var client=require(_0x527c('0x0'));exports[_0x527c('0x1')]=function(){return client[_0x527c('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x527c('0x3')});}; \ No newline at end of file +var _0xc505=['ShowSetting','loginMailFrequency','../client','getSettings','Request'];(function(_0x5cd0c2,_0x532cb9){var _0x2b6710=function(_0x16e2d0){while(--_0x16e2d0){_0x5cd0c2['push'](_0x5cd0c2['shift']());}};_0x2b6710(++_0x532cb9);}(_0xc505,0x124));var _0x5c50=function(_0x4d8293,_0x58efa8){_0x4d8293=_0x4d8293-0x0;var _0x6a7fec=_0xc505[_0x4d8293];return _0x6a7fec;};'use strict';var client=require(_0x5c50('0x0'));exports[_0x5c50('0x1')]=function(){return client[_0x5c50('0x2')](_0x5c50('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5c50('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 98bdd5f..c31a1d7 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 4aaf77c..614c204 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 _0xf566=['defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','createServer','timeout','listen','socket.io','websocket','polling','redis'];(function(_0x3306e4,_0x59c279){var _0x18a107=function(_0x263f1b){while(--_0x263f1b){_0x3306e4['push'](_0x3306e4['shift']());}};_0x18a107(++_0x59c279);}(_0xf566,0x1ac));var _0x6f56=function(_0xe36749,_0x2a45c8){_0xe36749=_0xe36749-0x0;var _0x5d86b7=_0xf566[_0xe36749];return _0x5d86b7;};'use strict';var _=require('lodash');var http=require(_0x6f56('0x0'));var express=require(_0x6f56('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x6f56('0x2')](app);server[_0x6f56('0x3')]=0xdbba0;if(sticky[_0x6f56('0x4')](server,config['port'])){var socketio=require(_0x6f56('0x5'))(server,{'transports':[_0x6f56('0x6'),_0x6f56('0x7')]});config[_0x6f56('0x8')]=_[_0x6f56('0x9')](config[_0x6f56('0x8')],{'host':_0x6f56('0xa'),'port':0x18eb});socketio[_0x6f56('0xb')](require(_0x6f56('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x6f56('0x8')])}));require(_0x6f56('0xd'))[_0x6f56('0xe')]();require(_0x6f56('0xf'))[_0x6f56('0xe')](socketio);require(_0x6f56('0x10'))['default'](app);require('../../routes')['default'](app);}else{server[_0x6f56('0x11')](_0x6f56('0x12'),function(){console[_0x6f56('0x13')](_0x6f56('0x14'),config[_0x6f56('0x15')]);});}exports=module[_0x6f56('0x16')]=app; \ No newline at end of file +var _0x6e18=['sticky-session','ioredis','../../config/environment','timeout','listen','port','websocket','defaults','localhost','adapter','redis','../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express'];(function(_0x155da7,_0x583327){var _0x1396f6=function(_0x437f46){while(--_0x437f46){_0x155da7['push'](_0x155da7['shift']());}};_0x1396f6(++_0x583327);}(_0x6e18,0xd9));var _0x86e1=function(_0x129f50,_0x531151){_0x129f50=_0x129f50-0x0;var _0x4bd705=_0x6e18[_0x129f50];return _0x4bd705;};'use strict';var _=require(_0x86e1('0x0'));var http=require(_0x86e1('0x1'));var express=require(_0x86e1('0x2'));var sticky=require(_0x86e1('0x3'));var Redis=require(_0x86e1('0x4'));var config=require(_0x86e1('0x5'));var app=express();var server=http['createServer'](app);server[_0x86e1('0x6')]=0xdbba0;if(sticky[_0x86e1('0x7')](server,config[_0x86e1('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x86e1('0x9'),'polling']});config['redis']=_[_0x86e1('0xa')](config['redis'],{'host':_0x86e1('0xb'),'port':0x18eb});socketio[_0x86e1('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x86e1('0xd')]),'subClient':new Redis(config['redis'])}));require(_0x86e1('0xe'))['default']();require('../../config/socketio')[_0x86e1('0xf')](socketio);require(_0x86e1('0x10'))['default'](app);require(_0x86e1('0x11'))['default'](app);}else{server[_0x86e1('0x12')](_0x86e1('0x13'),function(){console[_0x86e1('0x14')](_0x86e1('0x15'),config[_0x86e1('0x8')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 80d2f48..9e832db 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 _0xe000=['then','error','rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','Request','request'];(function(_0x3a6db0,_0x29e872){var _0x492cf8=function(_0x4fa05c){while(--_0x4fa05c){_0x3a6db0['push'](_0x3a6db0['shift']());}};_0x492cf8(++_0x29e872);}(_0xe000,0x10e));var _0x0e00=function(_0x488447,_0x48e0c7){_0x488447=_0x488447-0x0;var _0x1816cb=_0xe000[_0x488447];return _0x1816cb;};'use strict';var jayson=require(_0x0e00('0x0'));var BPromise=require(_0x0e00('0x1'));var logger=require(_0x0e00('0x2'))(_0x0e00('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x0e00('0x4')]=function(_0xca9fa0,_0x511574){return new BPromise(function(_0x53b1b1,_0x134cd2){return client[_0x0e00('0x5')](_0xca9fa0,_0x511574)[_0x0e00('0x6')](function(_0x476e46){logger['debug']('rpc',_0x0e00('0x3'),_0xca9fa0,_0x511574,_0x476e46);if(_0x476e46[_0x0e00('0x7')]){logger['error'](_0x0e00('0x8'),_0x0e00('0x3'),_0xca9fa0,_0x476e46[_0x0e00('0x7')][_0x0e00('0x9')],_0x511574);return _0x134cd2(_0x476e46['error']['message']);}else{return _0x53b1b1(_0x476e46['result']);}})[_0x0e00('0xa')](function(_0x354acd){logger['error'](_0x0e00('0x8'),'routing',_0xca9fa0,_0x354acd,_0x511574);return _0x134cd2(_0x354acd);});});};module[_0x0e00('0xb')]=client; \ No newline at end of file +var _0x4e5d=['debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','Request','request'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x4e5d,0x120));var _0xd4e5=function(_0x4fabbe,_0xc514f3){_0x4fabbe=_0x4fabbe-0x0;var _0x5510dd=_0x4e5d[_0x4fabbe];return _0x5510dd;};'use strict';var jayson=require(_0xd4e5('0x0'));var BPromise=require(_0xd4e5('0x1'));var logger=require(_0xd4e5('0x2'))('routing');var client=jayson[_0xd4e5('0x3')]['http']({'port':0x2329});client[_0xd4e5('0x4')]=function(_0x343676,_0x322884){return new BPromise(function(_0x50c7f0,_0x17e0b0){return client[_0xd4e5('0x5')](_0x343676,_0x322884)['then'](function(_0x132653){logger[_0xd4e5('0x6')](_0xd4e5('0x7'),_0xd4e5('0x8'),_0x343676,_0x322884,_0x132653);if(_0x132653[_0xd4e5('0x9')]){logger[_0xd4e5('0x9')]('rpc',_0xd4e5('0x8'),_0x343676,_0x132653[_0xd4e5('0x9')][_0xd4e5('0xa')],_0x322884);return _0x17e0b0(_0x132653['error']['message']);}else{return _0x50c7f0(_0x132653[_0xd4e5('0xb')]);}})[_0xd4e5('0xc')](function(_0x4e1890){logger[_0xd4e5('0x9')](_0xd4e5('0x7'),_0xd4e5('0x8'),_0x343676,_0x4e1890,_0x322884);return _0x17e0b0(_0x4e1890);});});};module[_0xd4e5('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 11c870f..95ac63d 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 _0xeab9=['initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x2587ca,_0x231303){var _0x5aada1=function(_0x2d21e1){while(--_0x2d21e1){_0x2587ca['push'](_0x2587ca['shift']());}};_0x5aada1(++_0x231303);}(_0xeab9,0x147));var _0x9eab=function(_0x3062da,_0x352b8f){_0x3062da=_0x3062da-0x0;var _0x1c95ba=_0xeab9[_0x3062da];return _0x1c95ba;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x9eab('0x0'));var user=require('./rpc/user');var interval=require(_0x9eab('0x1'));var openchannelQueue=require(_0x9eab('0x2'));var chatQueue=require(_0x9eab('0x3'));var smsQueue=require(_0x9eab('0x4'));var mailQueue=require(_0x9eab('0x5'));var faxQueue=require(_0x9eab('0x6'));var whatsappQueue=require(_0x9eab('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x9eab('0x8')]()[_0x9eab('0x9')](user[_0x9eab('0xa')]())['then'](realtime['initAgents']())[_0x9eab('0x9')](interval[_0x9eab('0xb')]())[_0x9eab('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x9eab('0xc')]())[_0x9eab('0x9')](realtime[_0x9eab('0xd')]())['then'](chatQueue['getChatQueues']())['then'](realtime[_0x9eab('0xe')]())[_0x9eab('0x9')](smsQueue[_0x9eab('0xf')]())['then'](realtime[_0x9eab('0x10')]())[_0x9eab('0x9')](mailQueue[_0x9eab('0x11')]())['then'](realtime[_0x9eab('0x12')]())[_0x9eab('0x9')](faxQueue['getFaxQueues']())[_0x9eab('0x9')](realtime['initFaxQueues']())['then'](whatsappQueue[_0x9eab('0x13')]())[_0x9eab('0x9')](realtime[_0x9eab('0x14')]())[_0x9eab('0x9')](function(){return realtime;});}function main(){return server[_0x9eab('0x15')](realtime)['then'](function(_0x4f96e3){return initRealtime();})[_0x9eab('0x9')](function(_0x4526ee){return setInterval(initRealtime,0x1388);})[_0x9eab('0x16')](function(_0x23a17b){console['log'](_0x23a17b);});}main(); \ No newline at end of file +var _0x9b58=['./server','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird'];(function(_0x1e52cb,_0x1f9dc4){var _0x259b73=function(_0x1c3c6c){while(--_0x1c3c6c){_0x1e52cb['push'](_0x1e52cb['shift']());}};_0x259b73(++_0x1f9dc4);}(_0x9b58,0x1a3));var _0x89b5=function(_0x4039e7,_0x1dbd5a){_0x4039e7=_0x4039e7-0x0;var _0x2a2a4f=_0x9b58[_0x4039e7];return _0x2a2a4f;};'use strict';var BPromise=require(_0x89b5('0x0'));var server=require(_0x89b5('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x89b5('0x2'));var openchannelQueue=require(_0x89b5('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x89b5('0x4'));var mailQueue=require(_0x89b5('0x5'));var faxQueue=require(_0x89b5('0x6'));var whatsappQueue=require(_0x89b5('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x89b5('0x8')]()[_0x89b5('0x9')](user[_0x89b5('0xa')]())[_0x89b5('0x9')](realtime[_0x89b5('0xb')]())[_0x89b5('0x9')](interval[_0x89b5('0xc')]())[_0x89b5('0x9')](realtime[_0x89b5('0xd')]())[_0x89b5('0x9')](openchannelQueue[_0x89b5('0xe')]())[_0x89b5('0x9')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x89b5('0xf')]())[_0x89b5('0x9')](realtime[_0x89b5('0x10')]())[_0x89b5('0x9')](smsQueue[_0x89b5('0x11')]())['then'](realtime[_0x89b5('0x12')]())[_0x89b5('0x9')](mailQueue[_0x89b5('0x13')]())[_0x89b5('0x9')](realtime[_0x89b5('0x14')]())[_0x89b5('0x9')](faxQueue[_0x89b5('0x15')]())['then'](realtime[_0x89b5('0x16')]())[_0x89b5('0x9')](whatsappQueue[_0x89b5('0x17')]())[_0x89b5('0x9')](realtime[_0x89b5('0x18')]())[_0x89b5('0x9')](function(){return realtime;});}function main(){return server[_0x89b5('0x19')](realtime)[_0x89b5('0x9')](function(_0x4f7ee2){return initRealtime();})[_0x89b5('0x9')](function(_0x2e59bb){return setInterval(initRealtime,0x1388);})[_0x89b5('0x1a')](function(_0x3a8db7){console[_0x89b5('0x1b')](_0x3a8db7);});}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 252c893..4e7edb5 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x34aca7,_0xba0d8e){var _0x379749=function(_0x22452d){while(--_0x22452d){_0x34aca7['push'](_0x34aca7['shift']());}};_0x379749(++_0xba0d8e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _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(_0x53bceb,_0x2ccfd6){var _0x28c536=function(_0x24be4c){while(--_0x24be4c){_0x53bceb['push'](_0x53bceb['shift']());}};_0x28c536(++_0x2ccfd6);}(_0xe14b,0x93));var _0xbe14=function(_0x410319,_0x23577e){_0x410319=_0x410319-0x0;var _0x57dbce=_0xe14b[_0x410319];return _0x57dbce;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e49229d..2b71ec2 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 _0xbdcf=['client','http','request','then','error','message','result','catch','sendMailMessage','bluebird','jayson/promise'];(function(_0x3ca16b,_0x1fd2bc){var _0xe23b9b=function(_0x2c5711){while(--_0x2c5711){_0x3ca16b['push'](_0x3ca16b['shift']());}};_0xe23b9b(++_0x1fd2bc);}(_0xbdcf,0x1e2));var _0xfbdc=function(_0x42e894,_0x46cdb5){_0x42e894=_0x42e894-0x0;var _0xc2a6a1=_0xbdcf[_0x42e894];return _0xc2a6a1;};'use strict';var BPromise=require(_0xfbdc('0x0'));var jayson=require(_0xfbdc('0x1'));var client=jayson[_0xfbdc('0x2')][_0xfbdc('0x3')]({'port':0x232b});function request(_0x124b82,_0xdd8948){return new BPromise(function(_0x538462,_0x3c954f){return client[_0xfbdc('0x4')](_0x124b82,_0xdd8948)[_0xfbdc('0x5')](function(_0x3fb230){if(_0x3fb230[_0xfbdc('0x6')]){return _0x3c954f(_0x3fb230['error'][_0xfbdc('0x7')]);}else{return _0x538462(_0x3fb230[_0xfbdc('0x8')]);}})[_0xfbdc('0x9')](function(_0x30bbd9){return _0x3c954f(_0x30bbd9);});});}exports[_0xfbdc('0xa')]=function(_0x89e62b,_0xd6c9d6){return request('SendMail',{'account':_0x89e62b,'message':_0xd6c9d6});}; \ No newline at end of file +var _0x7048=['jayson/promise','client','http','request','error','message','result','catch','sendMailMessage','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7048,0x1c1));var _0x8704=function(_0x4b6191,_0x5d36fa){_0x4b6191=_0x4b6191-0x0;var _0x511b1e=_0x7048[_0x4b6191];return _0x511b1e;};'use strict';var BPromise=require(_0x8704('0x0'));var jayson=require(_0x8704('0x1'));var client=jayson[_0x8704('0x2')][_0x8704('0x3')]({'port':0x232b});function request(_0x47720b,_0x328ad3){return new BPromise(function(_0x48198f,_0x597fd6){return client[_0x8704('0x4')](_0x47720b,_0x328ad3)['then'](function(_0x100f40){if(_0x100f40['error']){return _0x597fd6(_0x100f40[_0x8704('0x5')][_0x8704('0x6')]);}else{return _0x48198f(_0x100f40[_0x8704('0x7')]);}})[_0x8704('0x8')](function(_0x28e93b){return _0x597fd6(_0x28e93b);});});}exports[_0x8704('0x9')]=function(_0x5f24e0,_0x50be86){return request('SendMail',{'account':_0x5f24e0,'message':_0x50be86});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 8cfa264..bc46b9a 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 _0x5464=['chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxCurrentCapacity','whatsappStatusTime','whatsappCapacity','chatWaitingInteractions','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment','../../../config/environment','defaults','localhost','socket.io-emitter','redis','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','length','Status','StatusTime','format','name'];(function(_0x5826ea,_0x16788d){var _0x1ea289=function(_0x2d40be){while(--_0x2d40be){_0x5826ea['push'](_0x5826ea['shift']());}};_0x1ea289(++_0x16788d);}(_0x5464,0x15d));var _0x4546=function(_0x562a50,_0x244d79){_0x562a50=_0x562a50-0x0;var _0x27baa6=_0x5464[_0x562a50];return _0x27baa6;};'use strict';var _=require(_0x4546('0x0'));var md5=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var Redis=require('ioredis');var config=require(_0x4546('0x3'));config['redis']=_[_0x4546('0x4')](config['redis'],{'host':_0x4546('0x5'),'port':0x18eb});var io=require(_0x4546('0x6'))(new Redis(config[_0x4546('0x7')]));function Agent(_0x2b1a9b){this['id']=_0x2b1a9b['id']||0x0;this['name']=_0x2b1a9b['name']||'';this['online']=_0x2b1a9b[_0x4546('0x8')]||!![];this[_0x4546('0x9')]=_0x2b1a9b[_0x4546('0x9')]||![];this[_0x4546('0xa')]=_0x2b1a9b[_0x4546('0xa')]||![];this[_0x4546('0xb')]=_0x2b1a9b[_0x4546('0xb')]||![];this[_0x4546('0xc')]=_0x2b1a9b[_0x4546('0xc')]||![];this['smsPause']=_0x2b1a9b[_0x4546('0xd')]||![];this[_0x4546('0xe')]=_0x2b1a9b[_0x4546('0xe')]||![];this['chatStatus']=_0x4546('0xf');this[_0x4546('0x10')]=0x0;this[_0x4546('0x11')]=_0x2b1a9b[_0x4546('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x4546('0xf');this['mailStatusTime']=0x0;this['mailCapacity']=_0x2b1a9b['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0x4546('0x12')]=0x0;this['faxCapacity']=_0x2b1a9b[_0x4546('0x13')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x4546('0x14')]='unknown';this[_0x4546('0x15')]=0x0;this[_0x4546('0x16')]=_0x2b1a9b[_0x4546('0x16')]||0x0;this[_0x4546('0x17')]=0x0;this[_0x4546('0x18')]=_0x4546('0xf');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x2b1a9b['whatsappCapacity']||0x0;this[_0x4546('0x19')]=0x0;this[_0x4546('0x1a')]=_0x4546('0xf');this[_0x4546('0x1b')]=0x0;this[_0x4546('0x1c')]=_0x2b1a9b[_0x4546('0x1c')]||0x0;this[_0x4546('0x1d')]=0x0;this[_0x4546('0x1e')]=![];this[_0x4546('0x1f')]=undefined;this[_0x4546('0x1')]='';this['chatWaitingInteractions']={};this[_0x4546('0x20')]={};this[_0x4546('0x21')]={};this['openchannelWaitingInteractions']={};this[_0x4546('0x22')]={};this[_0x4546('0x23')]={};this[_0x4546('0x24')]();}Agent[_0x4546('0x25')][_0x4546('0x26')]=function(_0x15b013){if(this[_0x15b013+'CurrentCapacity']>0x0){if(this[_0x15b013+_0x4546('0x27')]>0x0&&this[_0x15b013+_0x4546('0x28')]>=this[_0x15b013+'Capacity']){return _0x4546('0x29');}else{return _0x4546('0x2a');}}else{return _0x4546('0x2b');}};Agent[_0x4546('0x25')][_0x4546('0x24')]=function(){var _0x53ae5e=[_0x4546('0x2c'),_0x4546('0x2d'),_0x4546('0x2e'),'fax','sms',_0x4546('0x2f')];for(var _0x166d6f=0x0;_0x166d6f<_0x53ae5e[_0x4546('0x30')];_0x166d6f+=0x1){var _0x114963=this[_0x4546('0x26')](_0x53ae5e[_0x166d6f]);if(this[_0x53ae5e[_0x166d6f]+_0x4546('0x31')]!==_0x114963){this[_0x53ae5e[_0x166d6f]+_0x4546('0x32')]=_['toNumber'](moment()[_0x4546('0x33')]('x'));}this[_0x53ae5e[_0x166d6f]+'Status']=_0x114963;}var _0x3a2d12={'id':this['id'],'name':this[_0x4546('0x34')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x4546('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x4546('0xd')],'faxPause':this[_0x4546('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x4546('0x10')],'chatCapacity':this[_0x4546('0x11')],'chatCurrentCapacity':this[_0x4546('0x35')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4546('0x36')],'mailCapacity':this[_0x4546('0x37')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x4546('0x38')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x4546('0x13')],'faxCurrentCapacity':this[_0x4546('0x39')],'smsStatus':this[_0x4546('0x14')],'smsStatusTime':this[_0x4546('0x15')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x4546('0x17')],'whatsappStatus':this[_0x4546('0x18')],'whatsappStatusTime':this[_0x4546('0x3a')],'whatsappCapacity':this[_0x4546('0x3b')],'whatsappCurrentCapacity':this[_0x4546('0x19')],'openchannelStatus':this[_0x4546('0x1a')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x4546('0x1c')],'openchannelCurrentCapacity':this[_0x4546('0x1d')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x4546('0x3c')],'faxWaitingInteractions':this[_0x4546('0x20')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x4546('0x3d')],'smsWaitingInteractions':this[_0x4546('0x22')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x5acdc0=md5(JSON[_0x4546('0x3e')](_0x3a2d12));if(this[_0x4546('0x1')]!==_0x5acdc0){this[_0x4546('0x1')]=_0x5acdc0;io[_0x4546('0x3f')](_0x4546('0x40'),_[_0x4546('0x41')](_0x3a2d12,['online']));}};module[_0x4546('0x42')]=Agent; \ No newline at end of file +var _0x1967=['chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','chatWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','openchannel','fax','sms','length','StatusTime','format','smsPause','faxStatusTime','whatsappCurrentCapacity','openchannelCurrentCapacity','faxWaitingInteractions','mailWaitingInteractions','stringify','emit','user:routing:update','omit','exports','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity'];(function(_0x2fce68,_0x37c6eb){var _0x3f9b71=function(_0x435737){while(--_0x435737){_0x2fce68['push'](_0x2fce68['shift']());}};_0x3f9b71(++_0x37c6eb);}(_0x1967,0x173));var _0x7196=function(_0x5b60ea,_0x51a884){_0x5b60ea=_0x5b60ea-0x0;var _0x2a0dba=_0x1967[_0x5b60ea];return _0x2a0dba;};'use strict';var _=require('lodash');var md5=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var Redis=require(_0x7196('0x2'));var config=require(_0x7196('0x3'));config[_0x7196('0x4')]=_[_0x7196('0x5')](config[_0x7196('0x4')],{'host':_0x7196('0x6'),'port':0x18eb});var io=require(_0x7196('0x7'))(new Redis(config[_0x7196('0x4')]));function Agent(_0x5c128f){this['id']=_0x5c128f['id']||0x0;this[_0x7196('0x8')]=_0x5c128f[_0x7196('0x8')]||'';this[_0x7196('0x9')]=_0x5c128f[_0x7196('0x9')]||!![];this[_0x7196('0xa')]=_0x5c128f[_0x7196('0xa')]||![];this['chatPause']=_0x5c128f[_0x7196('0xb')]||![];this[_0x7196('0xc')]=_0x5c128f[_0x7196('0xc')]||![];this[_0x7196('0xd')]=_0x5c128f[_0x7196('0xd')]||![];this['smsPause']=_0x5c128f['smsPause']||![];this[_0x7196('0xe')]=_0x5c128f[_0x7196('0xe')]||![];this[_0x7196('0xf')]=_0x7196('0x10');this[_0x7196('0x11')]=0x0;this[_0x7196('0x12')]=_0x5c128f[_0x7196('0x12')]||0x0;this[_0x7196('0x13')]=0x0;this[_0x7196('0x14')]=_0x7196('0x10');this[_0x7196('0x15')]=0x0;this['mailCapacity']=_0x5c128f[_0x7196('0x16')]||0x0;this[_0x7196('0x17')]=0x0;this[_0x7196('0x18')]=_0x7196('0x10');this['faxStatusTime']=0x0;this[_0x7196('0x19')]=_0x5c128f['faxCapacity']||0x0;this[_0x7196('0x1a')]=0x0;this[_0x7196('0x1b')]=_0x7196('0x10');this[_0x7196('0x1c')]=0x0;this[_0x7196('0x1d')]=_0x5c128f[_0x7196('0x1d')]||0x0;this[_0x7196('0x1e')]=0x0;this[_0x7196('0x1f')]=_0x7196('0x10');this[_0x7196('0x20')]=0x0;this[_0x7196('0x21')]=_0x5c128f['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x7196('0x22')]=_0x7196('0x10');this[_0x7196('0x23')]=0x0;this['openchannelCapacity']=_0x5c128f[_0x7196('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x7196('0x25')]=undefined;this[_0x7196('0x0')]='';this[_0x7196('0x26')]={};this['faxWaitingInteractions']={};this['mailWaitingInteractions']={};this[_0x7196('0x27')]={};this[_0x7196('0x28')]={};this['whatsappWaitingInteractions']={};this[_0x7196('0x29')]();}Agent[_0x7196('0x2a')][_0x7196('0x2b')]=function(_0x18d389){if(this[_0x18d389+_0x7196('0x2c')]>0x0){if(this[_0x18d389+'Capacity']>0x0&&this[_0x18d389+_0x7196('0x2c')]>=this[_0x18d389+'Capacity']){return _0x7196('0x2d');}else{return _0x7196('0x2e');}}else{return _0x7196('0x2f');}};Agent[_0x7196('0x2a')][_0x7196('0x29')]=function(){var _0x43f6a2=['mail','chat',_0x7196('0x30'),_0x7196('0x31'),_0x7196('0x32'),'whatsapp'];for(var _0x5aa538=0x0;_0x5aa538<_0x43f6a2[_0x7196('0x33')];_0x5aa538+=0x1){var _0x162cfc=this[_0x7196('0x2b')](_0x43f6a2[_0x5aa538]);if(this[_0x43f6a2[_0x5aa538]+'Status']!==_0x162cfc){this[_0x43f6a2[_0x5aa538]+_0x7196('0x34')]=_['toNumber'](moment()[_0x7196('0x35')]('x'));}this[_0x43f6a2[_0x5aa538]+'Status']=_0x162cfc;}var _0x30151f={'id':this['id'],'name':this[_0x7196('0x8')],'online':this[_0x7196('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x7196('0xb')],'mailPause':this[_0x7196('0xc')],'smsPause':this[_0x7196('0x36')],'faxPause':this[_0x7196('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x7196('0xf')],'chatStatusTime':this[_0x7196('0x11')],'chatCapacity':this[_0x7196('0x12')],'chatCurrentCapacity':this[_0x7196('0x13')],'mailStatus':this[_0x7196('0x14')],'mailStatusTime':this[_0x7196('0x15')],'mailCapacity':this[_0x7196('0x16')],'mailCurrentCapacity':this[_0x7196('0x17')],'faxStatus':this[_0x7196('0x18')],'faxStatusTime':this[_0x7196('0x37')],'faxCapacity':this[_0x7196('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7196('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x7196('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x7196('0x1f')],'whatsappStatusTime':this[_0x7196('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x7196('0x38')],'openchannelStatus':this[_0x7196('0x22')],'openchannelStatusTime':this[_0x7196('0x23')],'openchannelCapacity':this[_0x7196('0x24')],'openchannelCurrentCapacity':this[_0x7196('0x39')],'busy':this['busy'],'busyQueue':this[_0x7196('0x25')],'chatWaitingInteractions':this[_0x7196('0x26')],'faxWaitingInteractions':this[_0x7196('0x3a')],'mailWaitingInteractions':this[_0x7196('0x3b')],'openchannelWaitingInteractions':this[_0x7196('0x27')],'smsWaitingInteractions':this[_0x7196('0x28')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x23d7aa=md5(JSON[_0x7196('0x3c')](_0x30151f));if(this[_0x7196('0x0')]!==_0x23d7aa){this['md5']=_0x23d7aa;io[_0x7196('0x3d')](_0x7196('0x3e'),_[_0x7196('0x3f')](_0x30151f,[_0x7196('0x9')]));}};module[_0x7196('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fc05c5a..8b42d7b 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 _0x33a4=['online','loggedIn','chatPause','paused','available','stringify','emit','exports','lodash','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','length'];(function(_0x1afea4,_0x106601){var _0x3df48a=function(_0x597a7a){while(--_0x597a7a){_0x1afea4['push'](_0x1afea4['shift']());}};_0x3df48a(++_0x106601);}(_0x33a4,0x74));var _0x433a=function(_0x2c4fd0,_0x2c8f5f){_0x2c4fd0=_0x2c4fd0-0x0;var _0x7db72b=_0x33a4[_0x2c4fd0];return _0x7db72b;};'use strict';var _=require(_0x433a('0x0'));var md5=require(_0x433a('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x433a('0x2'));config[_0x433a('0x3')]=_[_0x433a('0x4')](config[_0x433a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x433a('0x5'))(new Redis(config[_0x433a('0x3')]));function ChatQueue(_0x5d3c73){this['id']=_0x5d3c73['id']||0x0;this[_0x433a('0x6')]=_0x5d3c73['name']||'';this[_0x433a('0x7')]=_0x5d3c73[_0x433a('0x7')]||0xa;this[_0x433a('0x8')]=_0x5d3c73[_0x433a('0x8')]||_0x433a('0x9');this[_0x433a('0xa')]=_0x5d3c73[_0x433a('0xa')];this['mapAgentsId']={};this[_0x433a('0xb')]=0x0;this[_0x433a('0x1')]='';this[_0x433a('0xc')]();this[_0x433a('0xd')]();}ChatQueue[_0x433a('0xe')][_0x433a('0xc')]=function(){var _0x467582=this['mapAgentsId'][_0x433a('0xf')];this[_0x433a('0x10')]=_[_0x433a('0x11')](this[_0x433a('0xa')],'id');this[_0x433a('0x10')][_0x433a('0xf')]=_0x467582;};ChatQueue[_0x433a('0xe')][_0x433a('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2a326b=0x0;_0x2a326b=0x0?this[_0x433a('0x17')]:0x0;var _0x5cecd9={'id':this['id'],'available':this[_0x433a('0x17')],'loggedIn':this[_0x433a('0x14')],'name':this[_0x433a('0x6')],'paused':this['paused'],'waiting':this[_0x433a('0xb')]};var _0x1b4f37=md5(JSON[_0x433a('0x18')](_0x5cecd9));if(this[_0x433a('0x1')]!==_0x1b4f37){this[_0x433a('0x1')]=_0x1b4f37;io['to'](util['format']('chat:queue:%s',_0x5cecd9[_0x433a('0x6')]))[_0x433a('0x19')]('chat_queue:save',_0x5cecd9);}};module[_0x433a('0x1a')]=ChatQueue; \ No newline at end of file +var _0x381b=['mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','loggedIn','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x381b,0x144));var _0xb381=function(_0x30b057,_0x1d1505){_0x30b057=_0x30b057-0x0;var _0x331671=_0x381b[_0x30b057];return _0x331671;};'use strict';var _=require(_0xb381('0x0'));var md5=require(_0xb381('0x1'));var util=require(_0xb381('0x2'));var Redis=require(_0xb381('0x3'));var config=require(_0xb381('0x4'));config[_0xb381('0x5')]=_['defaults'](config[_0xb381('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xb381('0x6'))(new Redis(config[_0xb381('0x5')]));function ChatQueue(_0x496488){this['id']=_0x496488['id']||0x0;this['name']=_0x496488[_0xb381('0x7')]||'';this[_0xb381('0x8')]=_0x496488[_0xb381('0x8')]||0xa;this[_0xb381('0x9')]=_0x496488['strategy']||_0xb381('0xa');this[_0xb381('0xb')]=_0x496488[_0xb381('0xb')];this[_0xb381('0xc')]={};this['waiting']=0x0;this[_0xb381('0x1')]='';this[_0xb381('0xd')]();this[_0xb381('0xe')]();}ChatQueue[_0xb381('0xf')][_0xb381('0xd')]=function(){var _0x2f70d5=this[_0xb381('0xc')][_0xb381('0x10')];this['mapAgentsId']=_[_0xb381('0x11')](this[_0xb381('0xb')],'id');this[_0xb381('0xc')]['_rr']=_0x2f70d5;};ChatQueue[_0xb381('0xf')][_0xb381('0xe')]=function(){this['loggedIn']=0x0;this[_0xb381('0x12')]=0x0;for(var _0x1e97fb=0x0;_0x1e97fb=0x0?this[_0xb381('0x14')]:0x0;var _0x158b2b={'id':this['id'],'available':this[_0xb381('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xb381('0x7')],'paused':this['paused'],'waiting':this[_0xb381('0x15')]};var _0x3beadc=md5(JSON[_0xb381('0x16')](_0x158b2b));if(this['md5']!==_0x3beadc){this[_0xb381('0x1')]=_0x3beadc;io['to'](util[_0xb381('0x17')](_0xb381('0x18'),_0x158b2b[_0xb381('0x7')]))[_0xb381('0x19')](_0xb381('0x1a'),_0x158b2b);}};module[_0xb381('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 2d234e1..ae47ffd 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 _0xbadc=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xbadc,0x18e));var _0xcbad=function(_0x1ccd8a,_0x5bf417){_0x1ccd8a=_0x1ccd8a-0x0;var _0x5a69d8=_0xbadc[_0x1ccd8a];return _0x5a69d8;};'use strict';var _=require(_0xcbad('0x0'));var md5=require(_0xcbad('0x1'));var util=require(_0xcbad('0x2'));var Redis=require(_0xcbad('0x3'));var config=require(_0xcbad('0x4'));config['redis']=_['defaults'](config[_0xcbad('0x5')],{'host':_0xcbad('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcbad('0x5')]));function FaxQueue(_0x2c787e){this['id']=_0x2c787e['id']||0x0;this[_0xcbad('0x7')]=_0x2c787e[_0xcbad('0x7')]||'';this[_0xcbad('0x8')]=_0x2c787e[_0xcbad('0x8')]||0xa;this[_0xcbad('0x9')]=_0x2c787e[_0xcbad('0x9')]||_0xcbad('0xa');this['Agents']=_0x2c787e[_0xcbad('0xb')];this[_0xcbad('0xc')]={};this[_0xcbad('0xd')]=0x0;this['md5']='';this[_0xcbad('0xe')]();this[_0xcbad('0xf')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x25e739=this[_0xcbad('0xc')][_0xcbad('0x10')];this[_0xcbad('0xc')]=_['map'](this[_0xcbad('0xb')],'id');this[_0xcbad('0xc')][_0xcbad('0x10')]=_0x25e739;};FaxQueue[_0xcbad('0x11')]['updateRealtime']=function(){this[_0xcbad('0x12')]=0x0;this[_0xcbad('0x13')]=0x0;for(var _0x4d6559=0x0;_0x4d6559=0x0?this[_0xcbad('0x17')]:0x0;var _0x372dd3={'id':this['id'],'available':this[_0xcbad('0x17')],'loggedIn':this[_0xcbad('0x12')],'name':this[_0xcbad('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x8161b5=md5(JSON[_0xcbad('0x18')](_0x372dd3));if(this['md5']!==_0x8161b5){this[_0xcbad('0x1')]=_0x8161b5;io['to'](util[_0xcbad('0x19')](_0xcbad('0x1a'),_0x372dd3['name']))[_0xcbad('0x1b')]('fax_queue:save',_0x372dd3);}};module[_0xcbad('0x1c')]=FaxQueue; \ No newline at end of file +var _0x68f7=['exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save'];(function(_0x4e9ca6,_0x2f1c42){var _0x3732be=function(_0xbc0338){while(--_0xbc0338){_0x4e9ca6['push'](_0x4e9ca6['shift']());}};_0x3732be(++_0x2f1c42);}(_0x68f7,0x7d));var _0x768f=function(_0x162454,_0x5b2281){_0x162454=_0x162454-0x0;var _0x11fb3f=_0x68f7[_0x162454];return _0x11fb3f;};'use strict';var _=require('lodash');var md5=require(_0x768f('0x0'));var util=require(_0x768f('0x1'));var Redis=require(_0x768f('0x2'));var config=require(_0x768f('0x3'));config[_0x768f('0x4')]=_[_0x768f('0x5')](config['redis'],{'host':_0x768f('0x6'),'port':0x18eb});var io=require(_0x768f('0x7'))(new Redis(config[_0x768f('0x4')]));function FaxQueue(_0x425d24){this['id']=_0x425d24['id']||0x0;this[_0x768f('0x8')]=_0x425d24[_0x768f('0x8')]||'';this[_0x768f('0x9')]=_0x425d24[_0x768f('0x9')]||0xa;this[_0x768f('0xa')]=_0x425d24[_0x768f('0xa')]||_0x768f('0xb');this[_0x768f('0xc')]=_0x425d24[_0x768f('0xc')];this[_0x768f('0xd')]={};this[_0x768f('0xe')]=0x0;this['md5']='';this[_0x768f('0xf')]();this[_0x768f('0x10')]();}FaxQueue[_0x768f('0x11')][_0x768f('0xf')]=function(){var _0x3962b3=this[_0x768f('0xd')][_0x768f('0x12')];this['mapAgentsId']=_[_0x768f('0x13')](this[_0x768f('0xc')],'id');this['mapAgentsId'][_0x768f('0x12')]=_0x3962b3;};FaxQueue['prototype'][_0x768f('0x10')]=function(){this['loggedIn']=0x0;this[_0x768f('0x14')]=0x0;for(var _0x24c4af=0x0;_0x24c4af=0x0?this[_0x768f('0x19')]:0x0;var _0x48db21={'id':this['id'],'available':this[_0x768f('0x19')],'loggedIn':this[_0x768f('0x17')],'name':this[_0x768f('0x8')],'paused':this[_0x768f('0x14')],'waiting':this[_0x768f('0xe')]};var _0x47b82f=md5(JSON[_0x768f('0x1a')](_0x48db21));if(this[_0x768f('0x0')]!==_0x47b82f){this[_0x768f('0x0')]=_0x47b82f;io['to'](util['format'](_0x768f('0x1b'),_0x48db21[_0x768f('0x8')]))[_0x768f('0x1c')](_0x768f('0x1d'),_0x48db21);}};module[_0x768f('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 3ee41e4..7590db0 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 _0x7303=['Intervals','exports'];(function(_0x21b898,_0x3a681b){var _0x4411a7=function(_0x2a55fe){while(--_0x2a55fe){_0x21b898['push'](_0x21b898['shift']());}};_0x4411a7(++_0x3a681b);}(_0x7303,0x8e));var _0x3730=function(_0x1dce75,_0x5b532d){_0x1dce75=_0x1dce75-0x0;var _0x28c901=_0x7303[_0x1dce75];return _0x28c901;};'use strict';function Interval(_0x474c95){this['id']=_0x474c95['id']||0x0;this['name']=_0x474c95['name']||'';this[_0x3730('0x0')]=_0x474c95[_0x3730('0x0')]||{};}module[_0x3730('0x1')]=Interval; \ No newline at end of file +var _0xa35c=['name','Intervals'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xa35c,0x158));var _0xca35=function(_0x363b87,_0x4a2a95){_0x363b87=_0x363b87-0x0;var _0x17388f=_0xa35c[_0x363b87];return _0x17388f;};'use strict';function Interval(_0x1e7c2c){this['id']=_0x1e7c2c['id']||0x0;this[_0xca35('0x0')]=_0x1e7c2c[_0xca35('0x0')]||'';this[_0xca35('0x1')]=_0x1e7c2c[_0xca35('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 7b3916a..8175803 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 _0xb227=['_rr','loggedIn','paused','length','online','available','stringify','mail:queue:%s','emit','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map'];(function(_0x29732d,_0x15eed2){var _0x466071=function(_0x552bdb){while(--_0x552bdb){_0x29732d['push'](_0x29732d['shift']());}};_0x466071(++_0x15eed2);}(_0xb227,0xb8));var _0x7b22=function(_0x501bfc,_0x561e33){_0x501bfc=_0x501bfc-0x0;var _0x4f8add=_0xb227[_0x501bfc];return _0x4f8add;};'use strict';var _=require('lodash');var md5=require(_0x7b22('0x0'));var util=require(_0x7b22('0x1'));var Redis=require(_0x7b22('0x2'));var config=require('../../../config/environment');config[_0x7b22('0x3')]=_[_0x7b22('0x4')](config[_0x7b22('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x7b22('0x5'))(new Redis(config[_0x7b22('0x3')]));function MailQueue(_0x3ad594){this['id']=_0x3ad594['id']||0x0;this[_0x7b22('0x6')]=_0x3ad594['name']||'';this[_0x7b22('0x7')]=_0x3ad594['timeout']||0xa;this[_0x7b22('0x8')]=_0x3ad594['strategy']||_0x7b22('0x9');this['Agents']=_0x3ad594[_0x7b22('0xa')];this[_0x7b22('0xb')]={};this['waiting']=0x0;this[_0x7b22('0x0')]='';this[_0x7b22('0xc')]();this[_0x7b22('0xd')]();}MailQueue[_0x7b22('0xe')][_0x7b22('0xc')]=function(){var _0x5041e3=this['mapAgentsId']['_rr'];this[_0x7b22('0xb')]=_[_0x7b22('0xf')](this[_0x7b22('0xa')],'id');this[_0x7b22('0xb')][_0x7b22('0x10')]=_0x5041e3;};MailQueue['prototype'][_0x7b22('0xd')]=function(){this[_0x7b22('0x11')]=0x0;this[_0x7b22('0x12')]=0x0;for(var _0x375aae=0x0;_0x375aae=0x0?this[_0x7b22('0x15')]:0x0;var _0xabd10f={'id':this['id'],'available':this[_0x7b22('0x15')],'loggedIn':this[_0x7b22('0x11')],'name':this['name'],'paused':this[_0x7b22('0x12')],'waiting':this['waiting']};var _0xeddf90=md5(JSON[_0x7b22('0x16')](_0xabd10f));if(this['md5']!==_0xeddf90){this[_0x7b22('0x0')]=_0xeddf90;io['to'](util['format'](_0x7b22('0x17'),_0xabd10f['name']))[_0x7b22('0x18')]('mail_queue:save',_0xabd10f);}};module['exports']=MailQueue; \ No newline at end of file +var _0x89cc=['available','stringify','format','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','loggedIn','length','online','mailPause','paused'];(function(_0x1b4183,_0x166e0a){var _0x1b3b00=function(_0x2b0af7){while(--_0x2b0af7){_0x1b4183['push'](_0x1b4183['shift']());}};_0x1b3b00(++_0x166e0a);}(_0x89cc,0xb3));var _0xc89c=function(_0x270fa4,_0x1f8546){_0x270fa4=_0x270fa4-0x0;var _0x1239df=_0x89cc[_0x270fa4];return _0x1239df;};'use strict';var _=require(_0xc89c('0x0'));var md5=require(_0xc89c('0x1'));var util=require(_0xc89c('0x2'));var Redis=require(_0xc89c('0x3'));var config=require(_0xc89c('0x4'));config[_0xc89c('0x5')]=_[_0xc89c('0x6')](config[_0xc89c('0x5')],{'host':_0xc89c('0x7'),'port':0x18eb});var io=require(_0xc89c('0x8'))(new Redis(config['redis']));function MailQueue(_0x2ce4f9){this['id']=_0x2ce4f9['id']||0x0;this['name']=_0x2ce4f9[_0xc89c('0x9')]||'';this[_0xc89c('0xa')]=_0x2ce4f9[_0xc89c('0xa')]||0xa;this[_0xc89c('0xb')]=_0x2ce4f9[_0xc89c('0xb')]||_0xc89c('0xc');this['Agents']=_0x2ce4f9[_0xc89c('0xd')];this[_0xc89c('0xe')]={};this[_0xc89c('0xf')]=0x0;this[_0xc89c('0x1')]='';this['updateRouting']();this[_0xc89c('0x10')]();}MailQueue['prototype'][_0xc89c('0x11')]=function(){var _0x32f881=this[_0xc89c('0xe')][_0xc89c('0x12')];this['mapAgentsId']=_['map'](this[_0xc89c('0xd')],'id');this[_0xc89c('0xe')][_0xc89c('0x12')]=_0x32f881;};MailQueue['prototype'][_0xc89c('0x10')]=function(){this[_0xc89c('0x13')]=0x0;this['paused']=0x0;for(var _0x185e3d=0x0;_0x185e3d=0x0?this[_0xc89c('0x18')]:0x0;var _0x135927={'id':this['id'],'available':this[_0xc89c('0x18')],'loggedIn':this[_0xc89c('0x13')],'name':this[_0xc89c('0x9')],'paused':this[_0xc89c('0x17')],'waiting':this['waiting']};var _0xe4a68a=md5(JSON[_0xc89c('0x19')](_0x135927));if(this['md5']!==_0xe4a68a){this[_0xc89c('0x1')]=_0xe4a68a;io['to'](util[_0xc89c('0x1a')]('mail:queue:%s',_0x135927['name']))[_0xc89c('0x1b')](_0xc89c('0x1c'),_0x135927);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index bb84801..7f5157c 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1261,0x144));var _0x1126=function(_0x1392c4,_0x5a51c6){_0x1392c4=_0x1392c4-0x0;var _0x179f77=_0x1261[_0x1392c4];return _0x179f77;};'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 _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x3dff0d,_0x4d59ff){var _0x352383=function(_0x46e5ef){while(--_0x46e5ef){_0x3dff0d['push'](_0x3dff0d['shift']());}};_0x352383(++_0x4d59ff);}(_0xadb5,0xad));var _0x5adb=function(_0x58ba37,_0x50b0b5){_0x58ba37=_0x58ba37-0x0;var _0x10f135=_0xadb5[_0x58ba37];return _0x10f135;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 81dd827..cb14ece 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 _0x630e=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','md5','format','sms:queue:%s','emit','sms_queue:save','lodash','util','redis','defaults'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x630e,0x1af));var _0xe630=function(_0xa28740,_0x56facc){_0xa28740=_0xa28740-0x0;var _0x561194=_0x630e[_0xa28740];return _0x561194;};'use strict';var _=require(_0xe630('0x0'));var md5=require('md5');var util=require(_0xe630('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe630('0x2')]=_[_0xe630('0x3')](config[_0xe630('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xe630('0x4'))(new Redis(config[_0xe630('0x2')]));function SmsQueue(_0xacb786){this['id']=_0xacb786['id']||0x0;this[_0xe630('0x5')]=_0xacb786[_0xe630('0x5')]||'';this['timeout']=_0xacb786[_0xe630('0x6')]||0xa;this[_0xe630('0x7')]=_0xacb786['strategy']||_0xe630('0x8');this['Agents']=_0xacb786[_0xe630('0x9')];this[_0xe630('0xa')]={};this[_0xe630('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0xe630('0xc')]();}SmsQueue[_0xe630('0xd')][_0xe630('0xe')]=function(){var _0x270d96=this['mapAgentsId'][_0xe630('0xf')];this[_0xe630('0xa')]=_[_0xe630('0x10')](this[_0xe630('0x9')],'id');this[_0xe630('0xa')][_0xe630('0xf')]=_0x270d96;};SmsQueue[_0xe630('0xd')][_0xe630('0xc')]=function(){this[_0xe630('0x11')]=0x0;this[_0xe630('0x12')]=0x0;for(var _0xe92984=0x0;_0xe92984=0x0?this[_0xe630('0x16')]:0x0;var _0x9721fa={'id':this['id'],'available':this[_0xe630('0x16')],'loggedIn':this[_0xe630('0x11')],'name':this[_0xe630('0x5')],'paused':this[_0xe630('0x12')],'waiting':this[_0xe630('0xb')]};var _0x29a67f=md5(JSON[_0xe630('0x17')](_0x9721fa));if(this[_0xe630('0x18')]!==_0x29a67f){this[_0xe630('0x18')]=_0x29a67f;io['to'](util[_0xe630('0x19')](_0xe630('0x1a'),_0x9721fa[_0xe630('0x5')]))[_0xe630('0x1b')](_0xe630('0x1c'),_0x9721fa);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x7119=['ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','paused','length','loggedIn','smsPause','available','stringify','emit','sms_queue:save','md5'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7119,0x1c7));var _0x9711=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x7119[_0x1e500e];return _0x10dc5e;};'use strict';var _=require('lodash');var md5=require(_0x9711('0x0'));var util=require('util');var Redis=require(_0x9711('0x1'));var config=require('../../../config/environment');config[_0x9711('0x2')]=_[_0x9711('0x3')](config[_0x9711('0x2')],{'host':_0x9711('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9711('0x2')]));function SmsQueue(_0x39ca84){this['id']=_0x39ca84['id']||0x0;this[_0x9711('0x5')]=_0x39ca84[_0x9711('0x5')]||'';this[_0x9711('0x6')]=_0x39ca84['timeout']||0xa;this[_0x9711('0x7')]=_0x39ca84[_0x9711('0x7')]||_0x9711('0x8');this['Agents']=_0x39ca84[_0x9711('0x9')];this['mapAgentsId']={};this[_0x9711('0xa')]=0x0;this[_0x9711('0x0')]='';this[_0x9711('0xb')]();this['updateRealtime']();}SmsQueue[_0x9711('0xc')][_0x9711('0xb')]=function(){var _0x25dbf6=this[_0x9711('0xd')][_0x9711('0xe')];this[_0x9711('0xd')]=_[_0x9711('0xf')](this[_0x9711('0x9')],'id');this[_0x9711('0xd')][_0x9711('0xe')]=_0x25dbf6;};SmsQueue[_0x9711('0xc')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x9711('0x10')]=0x0;for(var _0x38d721=0x0;_0x38d721=0x0?this[_0x9711('0x14')]:0x0;var _0x3615c9={'id':this['id'],'available':this[_0x9711('0x14')],'loggedIn':this[_0x9711('0x12')],'name':this[_0x9711('0x5')],'paused':this['paused'],'waiting':this[_0x9711('0xa')]};var _0x31e19f=md5(JSON[_0x9711('0x15')](_0x3615c9));if(this[_0x9711('0x0')]!==_0x31e19f){this['md5']=_0x31e19f;io['to'](util['format']('sms:queue:%s',_0x3615c9[_0x9711('0x5')]))[_0x9711('0x16')](_0x9711('0x17'),_0x3615c9);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 290ae90..ca5b6ca 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 _0x30af=['redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','paused','loggedIn','available','format','whatsapp:queue:%s','lodash','md5','util'];(function(_0x892a59,_0x3a2efe){var _0xdeb8f=function(_0x543bdd){while(--_0x543bdd){_0x892a59['push'](_0x892a59['shift']());}};_0xdeb8f(++_0x3a2efe);}(_0x30af,0x1cb));var _0xf30a=function(_0x175866,_0x1e48a6){_0x175866=_0x175866-0x0;var _0x4a561b=_0x30af[_0x175866];return _0x4a561b;};'use strict';var _=require(_0xf30a('0x0'));var md5=require(_0xf30a('0x1'));var util=require(_0xf30a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xf30a('0x3')]=_['defaults'](config[_0xf30a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xf30a('0x4'))(new Redis(config[_0xf30a('0x3')]));function WhatsappQueue(_0x2f69f5){this['id']=_0x2f69f5['id']||0x0;this[_0xf30a('0x5')]=_0x2f69f5[_0xf30a('0x5')]||'';this[_0xf30a('0x6')]=_0x2f69f5[_0xf30a('0x6')]||0xa;this['strategy']=_0x2f69f5[_0xf30a('0x7')]||_0xf30a('0x8');this[_0xf30a('0x9')]=_0x2f69f5[_0xf30a('0x9')];this[_0xf30a('0xa')]={};this[_0xf30a('0xb')]=0x0;this[_0xf30a('0x1')]='';this['updateRouting']();this[_0xf30a('0xc')]();}WhatsappQueue[_0xf30a('0xd')][_0xf30a('0xe')]=function(){var _0x507bc7=this[_0xf30a('0xa')]['_rr'];this[_0xf30a('0xa')]=_[_0xf30a('0xf')](this[_0xf30a('0x9')],'id');this[_0xf30a('0xa')][_0xf30a('0x10')]=_0x507bc7;};WhatsappQueue[_0xf30a('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xf30a('0x11')]=0x0;for(var _0x45ad31=0x0;_0x45ad31=0x0?this['available']:0x0;var _0x1f68a7={'id':this['id'],'available':this[_0xf30a('0x13')],'loggedIn':this[_0xf30a('0x12')],'name':this[_0xf30a('0x5')],'paused':this[_0xf30a('0x11')],'waiting':this['waiting']};var _0x197e24=md5(JSON['stringify'](_0x1f68a7));if(this[_0xf30a('0x1')]!==_0x197e24){this[_0xf30a('0x1')]=_0x197e24;io['to'](util[_0xf30a('0x14')](_0xf30a('0x15'),_0x1f68a7['name']))['emit']('whatsapp_queue:save',_0x1f68a7);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xd7a1=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','paused','online','available','loggedIn','waiting','format','emit','exports','lodash','md5','../../../config/environment','redis','defaults','localhost'];(function(_0x31f403,_0x52681d){var _0x5bfb47=function(_0x291849){while(--_0x291849){_0x31f403['push'](_0x31f403['shift']());}};_0x5bfb47(++_0x52681d);}(_0xd7a1,0x180));var _0x1d7a=function(_0x3cbba7,_0x23b17c){_0x3cbba7=_0x3cbba7-0x0;var _0x512e9b=_0xd7a1[_0x3cbba7];return _0x512e9b;};'use strict';var _=require(_0x1d7a('0x0'));var md5=require(_0x1d7a('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x1d7a('0x2'));config[_0x1d7a('0x3')]=_[_0x1d7a('0x4')](config[_0x1d7a('0x3')],{'host':_0x1d7a('0x5'),'port':0x18eb});var io=require(_0x1d7a('0x6'))(new Redis(config[_0x1d7a('0x3')]));function WhatsappQueue(_0x3d0b3e){this['id']=_0x3d0b3e['id']||0x0;this[_0x1d7a('0x7')]=_0x3d0b3e[_0x1d7a('0x7')]||'';this[_0x1d7a('0x8')]=_0x3d0b3e['timeout']||0xa;this[_0x1d7a('0x9')]=_0x3d0b3e[_0x1d7a('0x9')]||_0x1d7a('0xa');this[_0x1d7a('0xb')]=_0x3d0b3e[_0x1d7a('0xb')];this[_0x1d7a('0xc')]={};this['waiting']=0x0;this[_0x1d7a('0x1')]='';this[_0x1d7a('0xd')]();this[_0x1d7a('0xe')]();}WhatsappQueue['prototype'][_0x1d7a('0xd')]=function(){var _0x47a910=this[_0x1d7a('0xc')][_0x1d7a('0xf')];this[_0x1d7a('0xc')]=_[_0x1d7a('0x10')](this[_0x1d7a('0xb')],'id');this['mapAgentsId'][_0x1d7a('0xf')]=_0x47a910;};WhatsappQueue[_0x1d7a('0x11')][_0x1d7a('0xe')]=function(){this['loggedIn']=0x0;this[_0x1d7a('0x12')]=0x0;for(var _0x18d90e=0x0;_0x18d90e=0x0?this[_0x1d7a('0x14')]:0x0;var _0x2950e5={'id':this['id'],'available':this[_0x1d7a('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x1d7a('0x7')],'paused':this['paused'],'waiting':this[_0x1d7a('0x16')]};var _0x4165e2=md5(JSON['stringify'](_0x2950e5));if(this[_0x1d7a('0x1')]!==_0x4165e2){this['md5']=_0x4165e2;io['to'](util[_0x1d7a('0x17')]('whatsapp:queue:%s',_0x2950e5[_0x1d7a('0x7')]))[_0x1d7a('0x18')]('whatsapp_queue:save',_0x2950e5);}};module[_0x1d7a('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 612132c..83428a8 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(_0x5e5123,_0x23b9c9){var _0xea709f=function(_0x2d1259){while(--_0x2d1259){_0x5e5123['push'](_0x5e5123['shift']());}};_0xea709f(++_0x23b9c9);}(_0xb10b,0x12a));var _0xbb10=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xb10b[_0xc55d64];return _0x4194f6;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 81e49bc..6e488f7 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 _0x85d7=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','addTags'];(function(_0x575cfd,_0x47ec81){var _0xd863ad=function(_0x53c291){while(--_0x53c291){_0x575cfd['push'](_0x575cfd['shift']());}};_0xd863ad(++_0x47ec81);}(_0x85d7,0xa4));var _0x785d=function(_0x9c3c94,_0x296e5a){_0x9c3c94=_0x9c3c94-0x0;var _0x598937=_0x85d7[_0x9c3c94];return _0x598937;};'use strict';var client=require(_0x785d('0x0'));exports[_0x785d('0x1')]=function(_0x3fb143,_0x18cd63){return client[_0x785d('0x2')]('UpdateChatInteraction',{'body':_0x18cd63,'options':{'where':{'id':_0x3fb143}},'log':'updateChatInteraction'});};exports[_0x785d('0x3')]=function(_0x3b9990,_0x6ce4b5){return client['Request'](_0x785d('0x4'),{'body':_0x6ce4b5,'options':{'where':{'id':_0x3b9990}},'log':_0x785d('0x5')});}; \ No newline at end of file +var _0xb7ed=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2cfc63,_0x2f2d2f){var _0x1cef43=function(_0x4c079a){while(--_0x4c079a){_0x2cfc63['push'](_0x2cfc63['shift']());}};_0x1cef43(++_0x2f2d2f);}(_0xb7ed,0x172));var _0xdb7e=function(_0x76fea7,_0x164167){_0x76fea7=_0x76fea7-0x0;var _0x3183c0=_0xb7ed[_0x76fea7];return _0x3183c0;};'use strict';var client=require(_0xdb7e('0x0'));exports['update']=function(_0xd1fa38,_0xe43143){return client[_0xdb7e('0x1')](_0xdb7e('0x2'),{'body':_0xe43143,'options':{'where':{'id':_0xd1fa38}},'log':_0xdb7e('0x3')});};exports[_0xdb7e('0x4')]=function(_0x39778a,_0x43dbe1){return client[_0xdb7e('0x1')](_0xdb7e('0x5'),{'body':_0x43dbe1,'options':{'where':{'id':_0x39778a}},'log':_0xdb7e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a29de90..90eed7b 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 _0x1d3e=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x39874d,_0x5d4904){var _0x3fdb62=function(_0x2e2313){while(--_0x2e2313){_0x39874d['push'](_0x39874d['shift']());}};_0x3fdb62(++_0x5d4904);}(_0x1d3e,0x118));var _0xe1d3=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0x1d3e[_0x466a1a];return _0x577165;};'use strict';var client=require('../client');exports[_0xe1d3('0x0')]=function(_0x1c1791){return client[_0xe1d3('0x1')](_0xe1d3('0x2'),{'body':_0x1c1791,'log':_0xe1d3('0x3')});}; \ No newline at end of file +var _0x53db=['../client','create','Request','CreateChatMessage'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x53db,0xa8));var _0xb53d=function(_0x2aa620,_0x31c491){_0x2aa620=_0x2aa620-0x0;var _0x13cd0c=_0x53db[_0x2aa620];return _0x13cd0c;};'use strict';var client=require(_0xb53d('0x0'));exports[_0xb53d('0x1')]=function(_0x2f3fdf){return client[_0xb53d('0x2')](_0xb53d('0x3'),{'body':_0x2f3fdf,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 34019dd..64b2bfc 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 _0xb76d=['online','chatPause','../client','Request','GetChatQueue','name','strategy','User','Agents'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xb76d,0x119));var _0xdb76=function(_0x2a1994,_0x1261dc){_0x2a1994=_0x2a1994-0x0;var _0x5371a6=_0xb76d[_0x2a1994];return _0x5371a6;};'use strict';var client=require(_0xdb76('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xdb76('0x1')](_0xdb76('0x2'),{'options':{'raw':![],'attributes':['id',_0xdb76('0x3'),'timeout',_0xdb76('0x4')],'include':[{'model':_0xdb76('0x5'),'as':_0xdb76('0x6'),'attributes':['id',_0xdb76('0x3'),_0xdb76('0x7'),_0xdb76('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x1247=['name','timeout','strategy','Agents','online','chatPause','../client','getChatQueues'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1247,0xb6));var _0x7124=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x1247[_0x648163];return _0x199d4d;};'use strict';var client=require(_0x7124('0x0'));exports[_0x7124('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x7124('0x2'),_0x7124('0x3'),_0x7124('0x4')],'include':[{'model':'User','as':_0x7124('0x5'),'attributes':['id',_0x7124('0x2'),_0x7124('0x6'),_0x7124('0x7')]}]},'log':_0x7124('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 442d474..81908e5 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 _0x0207=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','create'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x0207,0x162));var _0x7020=function(_0x391c19,_0xc66a61){_0x391c19=_0x391c19-0x0;var _0x2e6856=_0x0207[_0x391c19];return _0x2e6856;};'use strict';var client=require('../client');exports[_0x7020('0x0')]=function(_0x4a5f80){return client['Request'](_0x7020('0x1'),{'body':_0x4a5f80,'log':_0x7020('0x1')});};exports[_0x7020('0x2')]=function(_0x15db09,_0x2e62fd){return client[_0x7020('0x3')](_0x7020('0x4'),{'body':_0x2e62fd,'options':{'where':{'uniqueid':_0x15db09},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x9f62=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x19a9fa,_0x174540){var _0x40a47f=function(_0x340721){while(--_0x340721){_0x19a9fa['push'](_0x19a9fa['shift']());}};_0x40a47f(++_0x174540);}(_0x9f62,0x154));var _0x29f6=function(_0x49b2e9,_0xd66b2e){_0x49b2e9=_0x49b2e9-0x0;var _0x59cec5=_0x9f62[_0x49b2e9];return _0x59cec5;};'use strict';var client=require('../client');exports[_0x29f6('0x0')]=function(_0x4ce7cb){return client[_0x29f6('0x1')](_0x29f6('0x2'),{'body':_0x4ce7cb,'log':_0x29f6('0x2')});};exports['update']=function(_0x54d164,_0x258ddd){return client[_0x29f6('0x1')](_0x29f6('0x3'),{'body':_0x258ddd,'options':{'where':{'uniqueid':_0x54d164},'order':[['id',_0x29f6('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 34d84cc..5ef4c8b 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2e7dd0,_0x2e0016){var _0x5699e4=function(_0x13c379){while(--_0x13c379){_0x2e7dd0['push'](_0x2e7dd0['shift']());}};_0x5699e4(++_0x2e0016);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0x7c9ce1,_0x1922df){_0x7c9ce1=_0x7c9ce1-0x0;var _0x28d090=_0x7a54[_0x7c9ce1];return _0x28d090;};'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 719313b..fd68151 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 _0x2121=['../client','create','Request','CreateFaxMessage'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x2121,0xc4));var _0x1212=function(_0x4c7132,_0x170300){_0x4c7132=_0x4c7132-0x0;var _0x488368=_0x2121[_0x4c7132];return _0x488368;};'use strict';var client=require(_0x1212('0x0'));exports[_0x1212('0x1')]=function(_0x5855a9){return client[_0x1212('0x2')](_0x1212('0x3'),{'body':_0x5855a9,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x2236=['create','Request','createFaxMessage','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2236,0x11b));var _0x6223=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2236[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x6223('0x0'));exports[_0x6223('0x1')]=function(_0x4e3ab0){return client[_0x6223('0x2')]('CreateFaxMessage',{'body':_0x4e3ab0,'log':_0x6223('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b3050e2..96e9f50 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 _0x31b1=['timeout','strategy','User','online','getFaxQueues','../client','Request','GetFaxQueue','name'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x31b1,0xdd));var _0x131b=function(_0x4f1546,_0x2682b7){_0x4f1546=_0x4f1546-0x0;var _0x577c49=_0x31b1[_0x4f1546];return _0x577c49;};'use strict';var client=require(_0x131b('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x131b('0x1')](_0x131b('0x2'),{'options':{'raw':![],'attributes':['id',_0x131b('0x3'),_0x131b('0x4'),_0x131b('0x5')],'include':[{'model':_0x131b('0x6'),'as':'Agents','attributes':['id',_0x131b('0x3'),_0x131b('0x7'),'faxPause']}]},'log':_0x131b('0x8')});};}; \ No newline at end of file +var _0x01f3=['User','Agents','faxPause','getFaxQueues','name','timeout','strategy'];(function(_0x10eb37,_0x30573c){var _0x29d03b=function(_0x57e1ea){while(--_0x57e1ea){_0x10eb37['push'](_0x10eb37['shift']());}};_0x29d03b(++_0x30573c);}(_0x01f3,0xdd));var _0x301f=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x01f3[_0x5805d7];return _0x170fe4;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x301f('0x0'),_0x301f('0x1'),_0x301f('0x2')],'include':[{'model':_0x301f('0x3'),'as':_0x301f('0x4'),'attributes':['id',_0x301f('0x0'),'online',_0x301f('0x5')]}]},'log':_0x301f('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 86ea8ee..dad4ce3 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 _0xe92e=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x543491,_0x1197dc){var _0x4410b5=function(_0x432503){while(--_0x432503){_0x543491['push'](_0x543491['shift']());}};_0x4410b5(++_0x1197dc);}(_0xe92e,0x15f));var _0xee92=function(_0x4fd7ac,_0x1b5de5){_0x4fd7ac=_0x4fd7ac-0x0;var _0x8673e1=_0xe92e[_0x4fd7ac];return _0x8673e1;};'use strict';var client=require(_0xee92('0x0'));exports[_0xee92('0x1')]=function(_0xb92b8d){return client[_0xee92('0x2')](_0xee92('0x3'),{'body':_0xb92b8d,'log':'CreateFaxQueueReport'});};exports[_0xee92('0x4')]=function(_0x4b6bcf,_0x991a8a){return client['Request'](_0xee92('0x5'),{'body':_0x991a8a,'options':{'where':{'uniqueid':_0x4b6bcf},'order':[['id',_0xee92('0x6')]],'limit':0x1},'log':_0xee92('0x5')});}; \ No newline at end of file +var _0x5fd6=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x36d25e,_0x1a047d){var _0x4b95b8=function(_0x74da3){while(--_0x74da3){_0x36d25e['push'](_0x36d25e['shift']());}};_0x4b95b8(++_0x1a047d);}(_0x5fd6,0xb9));var _0x65fd=function(_0x1fe5ee,_0x919a9f){_0x1fe5ee=_0x1fe5ee-0x0;var _0x7685a9=_0x5fd6[_0x1fe5ee];return _0x7685a9;};'use strict';var client=require(_0x65fd('0x0'));exports[_0x65fd('0x1')]=function(_0x37e32a){return client[_0x65fd('0x2')](_0x65fd('0x3'),{'body':_0x37e32a,'log':_0x65fd('0x3')});};exports[_0x65fd('0x4')]=function(_0x1a83e0,_0x532ace){return client[_0x65fd('0x2')](_0x65fd('0x5'),{'body':_0x532ace,'options':{'where':{'uniqueid':_0x1a83e0},'order':[['id',_0x65fd('0x6')]],'limit':0x1},'log':_0x65fd('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6cdb45f..3fc91f7 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 _0x5268=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x5268,0xef));var _0x8526=function(_0x360f2,_0x260602){_0x360f2=_0x360f2-0x0;var _0x55e69b=_0x5268[_0x360f2];return _0x55e69b;};'use strict';var client=require(_0x8526('0x0'));exports[_0x8526('0x1')]=function(){return function(){return client[_0x8526('0x2')](_0x8526('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8526('0x4')],'include':[{'model':_0x8526('0x5'),'as':_0x8526('0x6'),'attributes':['id',_0x8526('0x4'),_0x8526('0x7')]}]},'log':_0x8526('0x1')});};}; \ No newline at end of file +var _0x6b4a=['../client','getIntervals','GetInterval','name','Interval','Intervals','interval'];(function(_0x1b0d7e,_0x5c0237){var _0x5064ad=function(_0x5c26ae){while(--_0x5c26ae){_0x1b0d7e['push'](_0x1b0d7e['shift']());}};_0x5064ad(++_0x5c0237);}(_0x6b4a,0xa8));var _0xa6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa6b4('0x0'));exports[_0xa6b4('0x1')]=function(){return function(){return client['Request'](_0xa6b4('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa6b4('0x3')],'include':[{'model':_0xa6b4('0x4'),'as':_0xa6b4('0x5'),'attributes':['id',_0xa6b4('0x3'),_0xa6b4('0x6')]}]},'log':_0xa6b4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 197f019..5df935d 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 _0xe5af=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x2fb50a,_0x2ca9bb){var _0x226504=function(_0x1c5ef1){while(--_0x1c5ef1){_0x2fb50a['push'](_0x2fb50a['shift']());}};_0x226504(++_0x2ca9bb);}(_0xe5af,0x9c));var _0xfe5a=function(_0x43d10f,_0x41d6cd){_0x43d10f=_0x43d10f-0x0;var _0x1d5c30=_0xe5af[_0x43d10f];return _0x1d5c30;};'use strict';var client=require('../client');exports[_0xfe5a('0x0')]=function(_0x189c37,_0x4b1845){return client[_0xfe5a('0x1')](_0xfe5a('0x2'),{'body':_0x4b1845,'options':{'where':{'id':_0x189c37}},'log':_0xfe5a('0x3')});};exports['addTags']=function(_0x1165e3,_0x48e3a7){return client['Request'](_0xfe5a('0x4'),{'body':_0x48e3a7,'options':{'where':{'id':_0x1165e3}},'log':_0xfe5a('0x5')});}; \ No newline at end of file +var _0x4888=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x1c7204,_0x5beddf){var _0x5b9c1d=function(_0x2ff5d8){while(--_0x2ff5d8){_0x1c7204['push'](_0x1c7204['shift']());}};_0x5b9c1d(++_0x5beddf);}(_0x4888,0x198));var _0x8488=function(_0x233811,_0x1283e9){_0x233811=_0x233811-0x0;var _0x292f41=_0x4888[_0x233811];return _0x292f41;};'use strict';var client=require('../client');exports[_0x8488('0x0')]=function(_0x1f0e53,_0x2af900){return client[_0x8488('0x1')](_0x8488('0x2'),{'body':_0x2af900,'options':{'where':{'id':_0x1f0e53}},'log':_0x8488('0x3')});};exports[_0x8488('0x4')]=function(_0x571e4b,_0x267093){return client[_0x8488('0x1')](_0x8488('0x5'),{'body':_0x267093,'options':{'where':{'id':_0x571e4b}},'log':_0x8488('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e7f6696..5c79d41 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 _0x3de0=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x141be4,_0x1b4b69){var _0x504186=function(_0x5b97ad){while(--_0x5b97ad){_0x141be4['push'](_0x141be4['shift']());}};_0x504186(++_0x1b4b69);}(_0x3de0,0xac));var _0x03de=function(_0x1bfe5b,_0x1a0da5){_0x1bfe5b=_0x1bfe5b-0x0;var _0x7a4f77=_0x3de0[_0x1bfe5b];return _0x7a4f77;};'use strict';var client=require(_0x03de('0x0'));exports[_0x03de('0x1')]=function(_0x11c8ce){return client[_0x03de('0x2')](_0x03de('0x3'),{'body':_0x11c8ce,'log':_0x03de('0x4')});}; \ No newline at end of file +var _0xb454=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0x3fc241,_0x113a9e){var _0x23b9b6=function(_0x451e1f){while(--_0x451e1f){_0x3fc241['push'](_0x3fc241['shift']());}};_0x23b9b6(++_0x113a9e);}(_0xb454,0x7a));var _0x4b45=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0xb454[_0x1529a3];return _0x1a0d4b;};'use strict';var client=require(_0x4b45('0x0'));exports['create']=function(_0x10b394){return client[_0x4b45('0x1')](_0x4b45('0x2'),{'body':_0x10b394,'log':_0x4b45('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 917869f..003ef12 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 _0xcab2=['../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcab2,0x160));var _0x2cab=function(_0x18a2e4,_0x506e95){_0x18a2e4=_0x18a2e4-0x0;var _0x2c39eb=_0xcab2[_0x18a2e4];return _0x2c39eb;};'use strict';var client=require(_0x2cab('0x0'));exports[_0x2cab('0x1')]=function(){return function(){return client[_0x2cab('0x2')](_0x2cab('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cab('0x4'),_0x2cab('0x5'),_0x2cab('0x6')],'include':[{'model':_0x2cab('0x7'),'as':_0x2cab('0x8'),'attributes':['id',_0x2cab('0x4'),_0x2cab('0x9'),_0x2cab('0xa')]}]},'log':_0x2cab('0x1')});};}; \ No newline at end of file +var _0x16ec=['../client','getMailQueues','Request','GetMailQueue','strategy','Agents','name','online'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x16ec,0x190));var _0xc16e=function(_0x4ccb3b,_0x5d5997){_0x4ccb3b=_0x4ccb3b-0x0;var _0x36a99a=_0x16ec[_0x4ccb3b];return _0x36a99a;};'use strict';var client=require(_0xc16e('0x0'));exports[_0xc16e('0x1')]=function(){return function(){return client[_0xc16e('0x2')](_0xc16e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc16e('0x4')],'include':[{'model':'User','as':_0xc16e('0x5'),'attributes':['id',_0xc16e('0x6'),_0xc16e('0x7'),'mailPause']}]},'log':_0xc16e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a7944c2..41c3fe7 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 _0x2309=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x1c31ff,_0x4d7927){var _0x1c657a=function(_0x46a4e8){while(--_0x46a4e8){_0x1c31ff['push'](_0x1c31ff['shift']());}};_0x1c657a(++_0x4d7927);}(_0x2309,0x100));var _0x9230=function(_0x1da73b,_0x23ed6d){_0x1da73b=_0x1da73b-0x0;var _0x1fcb69=_0x2309[_0x1da73b];return _0x1fcb69;};'use strict';var client=require(_0x9230('0x0'));exports[_0x9230('0x1')]=function(_0x32ccbb){return client[_0x9230('0x2')](_0x9230('0x3'),{'body':_0x32ccbb,'log':_0x9230('0x3')});};exports[_0x9230('0x4')]=function(_0x1f02a4,_0x4c51e6){return client[_0x9230('0x2')](_0x9230('0x5'),{'body':_0x4c51e6,'options':{'where':{'uniqueid':_0x1f02a4},'order':[['id',_0x9230('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x4c61=['Request','CreateMailQueueReport','UpdateMailQueueReport','create'];(function(_0x56c5f8,_0x2294ec){var _0x1b5ea3=function(_0x146668){while(--_0x146668){_0x56c5f8['push'](_0x56c5f8['shift']());}};_0x1b5ea3(++_0x2294ec);}(_0x4c61,0x14f));var _0x14c6=function(_0x14dcd1,_0x76fa3c){_0x14dcd1=_0x14dcd1-0x0;var _0x4b2e4c=_0x4c61[_0x14dcd1];return _0x4b2e4c;};'use strict';var client=require('../client');exports[_0x14c6('0x0')]=function(_0x1046b2){return client[_0x14c6('0x1')](_0x14c6('0x2'),{'body':_0x1046b2,'log':_0x14c6('0x2')});};exports['update']=function(_0x42c523,_0x56684d){return client['Request']('UpdateMailQueueReport',{'body':_0x56684d,'options':{'where':{'uniqueid':_0x42c523},'order':[['id','DESC']],'limit':0x1},'log':_0x14c6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index cac4200..0bdc732 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 _0xf43c=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x35bffb,_0x2853eb){var _0x3505e7=function(_0x40d875){while(--_0x40d875){_0x35bffb['push'](_0x35bffb['shift']());}};_0x3505e7(++_0x2853eb);}(_0xf43c,0x75));var _0xcf43=function(_0x322510,_0x4522ed){_0x322510=_0x322510-0x0;var _0xbcaa29=_0xf43c[_0x322510];return _0xbcaa29;};'use strict';var client=require(_0xcf43('0x0'));exports[_0xcf43('0x1')]=function(_0x49c0e7,_0x5e410f){return client[_0xcf43('0x2')](_0xcf43('0x3'),{'body':_0x5e410f,'options':{'where':{'id':_0x49c0e7}},'log':_0xcf43('0x4')});};exports[_0xcf43('0x5')]=function(_0x36cce1,_0x3daf8e){return client[_0xcf43('0x2')](_0xcf43('0x6'),{'body':_0x3daf8e,'options':{'where':{'id':_0x36cce1}},'log':_0xcf43('0x7')});}; \ No newline at end of file +var _0xbe09=['addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe09,0x119));var _0x9be0=function(_0xcae378,_0x810fa4){_0xcae378=_0xcae378-0x0;var _0x26ecaa=_0xbe09[_0xcae378];return _0x26ecaa;};'use strict';var client=require('../client');exports[_0x9be0('0x0')]=function(_0x4ca608,_0x3e53fd){return client[_0x9be0('0x1')](_0x9be0('0x2'),{'body':_0x3e53fd,'options':{'where':{'id':_0x4ca608}},'log':'updateOpenchannelInteraction'});};exports[_0x9be0('0x3')]=function(_0x2d6411,_0x267123){return client[_0x9be0('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x267123,'options':{'where':{'id':_0x2d6411}},'log':_0x9be0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3b1742e..801cdb3 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 _0x51d2=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x51d2,0xf0));var _0x251d=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x51d2[_0x2468b5];return _0x1056e4;};'use strict';var client=require(_0x251d('0x0'));exports[_0x251d('0x1')]=function(_0x53e494){return client[_0x251d('0x2')](_0x251d('0x3'),{'body':_0x53e494,'log':_0x251d('0x4')});}; \ No newline at end of file +var _0x4c18=['createOpenchannelMessage','../client','create','CreateOpenchannelMessage'];(function(_0x485ec4,_0x31d5e4){var _0x297566=function(_0x3179bc){while(--_0x3179bc){_0x485ec4['push'](_0x485ec4['shift']());}};_0x297566(++_0x31d5e4);}(_0x4c18,0xb5));var _0x84c1=function(_0x323438,_0x151479){_0x323438=_0x323438-0x0;var _0x4a4bf2=_0x4c18[_0x323438];return _0x4a4bf2;};'use strict';var client=require(_0x84c1('0x0'));exports[_0x84c1('0x1')]=function(_0x104ca1){return client['Request'](_0x84c1('0x2'),{'body':_0x104ca1,'log':_0x84c1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index a17590a..58794af 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 _0xa415=['timeout','strategy','User','Agents','name','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xa415,0x18e));var _0x5a41=function(_0x539ded,_0x53e10f){_0x539ded=_0x539ded-0x0;var _0x440387=_0xa415[_0x539ded];return _0x440387;};'use strict';var client=require('../client');exports[_0x5a41('0x0')]=function(){return function(){return client['Request'](_0x5a41('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x5a41('0x2'),_0x5a41('0x3')],'include':[{'model':_0x5a41('0x4'),'as':_0x5a41('0x5'),'attributes':['id',_0x5a41('0x6'),'online',_0x5a41('0x7')]}]},'log':_0x5a41('0x0')});};}; \ No newline at end of file +var _0x4852=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','Agents','online'];(function(_0x1e1867,_0x5f19b9){var _0x40d021=function(_0x130a0c){while(--_0x130a0c){_0x1e1867['push'](_0x1e1867['shift']());}};_0x40d021(++_0x5f19b9);}(_0x4852,0xc8));var _0x2485=function(_0x357771,_0x38fe2b){_0x357771=_0x357771-0x0;var _0x5bd387=_0x4852[_0x357771];return _0x5bd387;};'use strict';var client=require(_0x2485('0x0'));exports[_0x2485('0x1')]=function(){return function(){return client[_0x2485('0x2')](_0x2485('0x3'),{'options':{'raw':![],'attributes':['id',_0x2485('0x4'),'timeout',_0x2485('0x5')],'include':[{'model':'User','as':_0x2485('0x6'),'attributes':['id',_0x2485('0x4'),_0x2485('0x7'),'openchannelPause']}]},'log':_0x2485('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 659b69f..6e82a1f 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 _0x57c3=['create','update','Request','DESC','../client'];(function(_0x33c682,_0x455b22){var _0x440d86=function(_0x3df7dc){while(--_0x3df7dc){_0x33c682['push'](_0x33c682['shift']());}};_0x440d86(++_0x455b22);}(_0x57c3,0xc2));var _0x357c=function(_0x4259ca,_0x6d2aaf){_0x4259ca=_0x4259ca-0x0;var _0x34c0d3=_0x57c3[_0x4259ca];return _0x34c0d3;};'use strict';var client=require(_0x357c('0x0'));exports[_0x357c('0x1')]=function(_0x453ad9){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x453ad9,'log':'CreateOpenchannelQueueReport'});};exports[_0x357c('0x2')]=function(_0x1b6624,_0x2aef77){return client[_0x357c('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x2aef77,'options':{'where':{'uniqueid':_0x1b6624},'order':[['id',_0x357c('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xe42a=['DESC','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x25ee9e,_0x17d6e3){var _0x568996=function(_0x227248){while(--_0x227248){_0x25ee9e['push'](_0x25ee9e['shift']());}};_0x568996(++_0x17d6e3);}(_0xe42a,0x193));var _0xae42=function(_0x3cc800,_0x480ded){_0x3cc800=_0x3cc800-0x0;var _0x14ccea=_0xe42a[_0x3cc800];return _0x14ccea;};'use strict';var client=require('../client');exports[_0xae42('0x0')]=function(_0x1a3436){return client[_0xae42('0x1')](_0xae42('0x2'),{'body':_0x1a3436,'log':'CreateOpenchannelQueueReport'});};exports[_0xae42('0x3')]=function(_0x2a83a3,_0x50126b){return client[_0xae42('0x1')](_0xae42('0x4'),{'body':_0x50126b,'options':{'where':{'uniqueid':_0x2a83a3},'order':[['id',_0xae42('0x5')]],'limit':0x1},'log':_0xae42('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 549d18b..e1138bf 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 _0x6658=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x41f0de,_0x43c369){var _0x1765e0=function(_0x566298){while(--_0x566298){_0x41f0de['push'](_0x41f0de['shift']());}};_0x1765e0(++_0x43c369);}(_0x6658,0x198));var _0x8665=function(_0x147571,_0x3f2960){_0x147571=_0x147571-0x0;var _0x275681=_0x6658[_0x147571];return _0x275681;};'use strict';var client=require(_0x8665('0x0'));exports[_0x8665('0x1')]=function(_0x2d027a,_0x1a6b0b){return client[_0x8665('0x2')](_0x8665('0x3'),{'body':_0x1a6b0b,'options':{'where':{'id':_0x2d027a}},'log':_0x8665('0x4')});};exports[_0x8665('0x5')]=function(_0x4f1343,_0xf643d8){return client[_0x8665('0x2')]('AddTagsToSmsInteraction',{'body':_0xf643d8,'options':{'where':{'id':_0x4f1343}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x1666=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update'];(function(_0x19ca86,_0x143022){var _0x171a85=function(_0x47be1e){while(--_0x47be1e){_0x19ca86['push'](_0x19ca86['shift']());}};_0x171a85(++_0x143022);}(_0x1666,0x75));var _0x6166=function(_0xd30664,_0x1ff743){_0xd30664=_0xd30664-0x0;var _0x53013b=_0x1666[_0xd30664];return _0x53013b;};'use strict';var client=require(_0x6166('0x0'));exports[_0x6166('0x1')]=function(_0x4f60ad,_0x18af67){return client[_0x6166('0x2')](_0x6166('0x3'),{'body':_0x18af67,'options':{'where':{'id':_0x4f60ad}},'log':_0x6166('0x4')});};exports[_0x6166('0x5')]=function(_0x15afdd,_0x597cf2){return client[_0x6166('0x2')]('AddTagsToSmsInteraction',{'body':_0x597cf2,'options':{'where':{'id':_0x15afdd}},'log':_0x6166('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index fed23a9..a967163 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 _0x5319=['CreateSmsMessage','createSmsMessage','../client'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x5319,0x15e));var _0x9531=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x5319[_0x4e8401];return _0x17269f;};'use strict';var client=require(_0x9531('0x0'));exports['create']=function(_0x629166){return client['Request'](_0x9531('0x1'),{'body':_0x629166,'log':_0x9531('0x2')});}; \ No newline at end of file +var _0x3c32=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3c32,0x132));var _0x23c3=function(_0x4007b5,_0x419cf2){_0x4007b5=_0x4007b5-0x0;var _0x49d21a=_0x3c32[_0x4007b5];return _0x49d21a;};'use strict';var client=require(_0x23c3('0x0'));exports[_0x23c3('0x1')]=function(_0x2f0d05){return client[_0x23c3('0x2')](_0x23c3('0x3'),{'body':_0x2f0d05,'log':_0x23c3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 6a10c30..12cd7fc 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0xce5279,_0x189fbe){var _0xa250a2=function(_0x56f73f){while(--_0x56f73f){_0xce5279['push'](_0xce5279['shift']());}};_0xa250a2(++_0x189fbe);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x3cd3f1,_0x7cb74e){var _0x285e4c=function(_0x4bb3d6){while(--_0x4bb3d6){_0x3cd3f1['push'](_0x3cd3f1['shift']());}};_0x285e4c(++_0x7cb74e);}(_0xe706,0xa3));var _0x6e70=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xe706[_0x5ac84c];return _0x3c53d2;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 49ac93e..e25f2ab 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x45758a,_0x2fb199){var _0x4aa216=function(_0x49cb64){while(--_0x49cb64){_0x45758a['push'](_0x45758a['shift']());}};_0x4aa216(++_0x2fb199);}(_0x70e0,0x17b));var _0x070e=function(_0x48a253,_0x198542){_0x48a253=_0x48a253-0x0;var _0x22fb5a=_0x70e0[_0x48a253];return _0x22fb5a;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x599f72,_0x527cd3){var _0x334254=function(_0x440343){while(--_0x440343){_0x599f72['push'](_0x599f72['shift']());}};_0x334254(++_0x527cd3);}(_0x55ca,0x126));var _0xa55c=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x55ca[_0x2e3107];return _0x833d69;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b23f5f1..4d2853d 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(_0x574fab,_0x358a29){var _0x333c88=function(_0x19eb73){while(--_0x19eb73){_0x574fab['push'](_0x574fab['shift']());}};_0x333c88(++_0x358a29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x509245,_0xdef2a3){var _0x5569a0=function(_0x16dd11){while(--_0x16dd11){_0x509245['push'](_0x509245['shift']());}};_0x5569a0(++_0xdef2a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 23c2dfe..ee5c9d1 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 _0x1228=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1228,0x12f));var _0x8122=function(_0x110cdc,_0x245a35){_0x110cdc=_0x110cdc-0x0;var _0x4ed9e7=_0x1228[_0x110cdc];return _0x4ed9e7;};'use strict';var client=require(_0x8122('0x0'));exports['update']=function(_0x1e4b58,_0x57c278){return client[_0x8122('0x1')](_0x8122('0x2'),{'body':_0x57c278,'options':{'where':{'id':_0x1e4b58}},'log':_0x8122('0x3')});};exports['addTags']=function(_0x762ce4,_0xf4d3e5){return client['Request'](_0x8122('0x4'),{'body':_0xf4d3e5,'options':{'where':{'id':_0x762ce4}},'log':_0x8122('0x5')});}; \ No newline at end of file +var _0xd8fb=['addTags','Request','AddTagsToWhatsappInteraction','../client','update'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xd8fb,0x99));var _0xbd8f=function(_0xf13bfa,_0x878dc9){_0xf13bfa=_0xf13bfa-0x0;var _0x2f2c76=_0xd8fb[_0xf13bfa];return _0x2f2c76;};'use strict';var client=require(_0xbd8f('0x0'));exports[_0xbd8f('0x1')]=function(_0x1024c1,_0x2bd369){return client['Request']('UpdateWhatsappInteraction',{'body':_0x2bd369,'options':{'where':{'id':_0x1024c1}},'log':'updateWhatsappInteraction'});};exports[_0xbd8f('0x2')]=function(_0x43d177,_0x53cccc){return client[_0xbd8f('0x3')](_0xbd8f('0x4'),{'body':_0x53cccc,'options':{'where':{'id':_0x43d177}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 7eba4fa..97bd1ee 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 _0xfe81=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x535106,_0x256145){var _0x387f18=function(_0x467871){while(--_0x467871){_0x535106['push'](_0x535106['shift']());}};_0x387f18(++_0x256145);}(_0xfe81,0xa3));var _0x1fe8=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xfe81[_0x39cf70];return _0x580424;};'use strict';var client=require('../client');exports[_0x1fe8('0x0')]=function(_0x1014e7){return client[_0x1fe8('0x1')](_0x1fe8('0x2'),{'body':_0x1014e7,'log':_0x1fe8('0x3')});}; \ No newline at end of file +var _0x4f93=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x4f93,0x19a));var _0x34f9=function(_0x2c76b2,_0x35fa8b){_0x2c76b2=_0x2c76b2-0x0;var _0x11b6f4=_0x4f93[_0x2c76b2];return _0x11b6f4;};'use strict';var client=require(_0x34f9('0x0'));exports[_0x34f9('0x1')]=function(_0x2b93ab){return client[_0x34f9('0x2')](_0x34f9('0x3'),{'body':_0x2b93ab,'log':_0x34f9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1e6dee2..ec1740e 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 _0x5519=['strategy','User','Agents','name','online','getWhatsappQueues','Request'];(function(_0x4a6f48,_0x4d8c76){var _0x316207=function(_0x33ab4c){while(--_0x33ab4c){_0x4a6f48['push'](_0x4a6f48['shift']());}};_0x316207(++_0x4d8c76);}(_0x5519,0x75));var _0x9551=function(_0x4d9e69,_0x40c6cc){_0x4d9e69=_0x4d9e69-0x0;var _0x3ad920=_0x5519[_0x4d9e69];return _0x3ad920;};'use strict';var client=require('../client');exports[_0x9551('0x0')]=function(){return function(){return client[_0x9551('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x9551('0x2')],'include':[{'model':_0x9551('0x3'),'as':_0x9551('0x4'),'attributes':['id',_0x9551('0x5'),_0x9551('0x6'),'whatsappPause']}]},'log':_0x9551('0x0')});};}; \ No newline at end of file +var _0x0ee7=['Agents','online','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ee7,0xa5));var _0x70ee=function(_0x3d85ec,_0x529b95){_0x3d85ec=_0x3d85ec-0x0;var _0x196465=_0x0ee7[_0x3d85ec];return _0x196465;};'use strict';var client=require(_0x70ee('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x70ee('0x1')](_0x70ee('0x2'),{'options':{'raw':![],'attributes':['id',_0x70ee('0x3'),_0x70ee('0x4'),_0x70ee('0x5')],'include':[{'model':'User','as':_0x70ee('0x6'),'attributes':['id',_0x70ee('0x3'),_0x70ee('0x7'),'whatsappPause']}]},'log':_0x70ee('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 8c07702..0ac39d5 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 _0xace5=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','Request'];(function(_0x3d80bc,_0x235837){var _0x10c590=function(_0x58606e){while(--_0x58606e){_0x3d80bc['push'](_0x3d80bc['shift']());}};_0x10c590(++_0x235837);}(_0xace5,0x18e));var _0x5ace=function(_0x203dcd,_0x5bb31d){_0x203dcd=_0x203dcd-0x0;var _0xd4312f=_0xace5[_0x203dcd];return _0xd4312f;};'use strict';var client=require(_0x5ace('0x0'));exports['create']=function(_0x5964fd){return client[_0x5ace('0x1')](_0x5ace('0x2'),{'body':_0x5964fd,'log':'CreateWhatsappQueueReport'});};exports[_0x5ace('0x3')]=function(_0x45f9ed,_0x1adf5f){return client[_0x5ace('0x1')](_0x5ace('0x4'),{'body':_0x1adf5f,'options':{'where':{'uniqueid':_0x45f9ed},'order':[['id','DESC']],'limit':0x1},'log':_0x5ace('0x4')});}; \ No newline at end of file +var _0x9536=['create','CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x2341b9,_0x277774){var _0x4aa7dd=function(_0x9b0d43){while(--_0x9b0d43){_0x2341b9['push'](_0x2341b9['shift']());}};_0x4aa7dd(++_0x277774);}(_0x9536,0x16d));var _0x6953=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x9536[_0xc77819];return _0x1c9434;};'use strict';var client=require('../client');exports[_0x6953('0x0')]=function(_0x3529f1){return client['Request'](_0x6953('0x1'),{'body':_0x3529f1,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x269b54,_0xc0912a){return client[_0x6953('0x2')](_0x6953('0x3'),{'body':_0xc0912a,'options':{'where':{'uniqueid':_0x269b54},'order':[['id',_0x6953('0x4')]],'limit':0x1},'log':_0x6953('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 7f1da9d..1452800 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 _0xa2be=['complete','next','agent','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x46d816,_0x303f7e){var _0x5c20e0=function(_0x22fff8){while(--_0x22fff8){_0x46d816['push'](_0x46d816['shift']());}};_0x5c20e0(++_0x303f7e);}(_0xa2be,0x1ef));var _0xea2b=function(_0x35289d,_0x230ce7){_0x35289d=_0x35289d-0x0;var _0x2dec71=_0xa2be[_0x35289d];return _0x2dec71;};'use strict';var schema=require(_0xea2b('0x0'));var _=require(_0xea2b('0x1'));var util=require(_0xea2b('0x2'));var seqqueue=require(_0xea2b('0x3'));var logger=require(_0xea2b('0x4'))(_0xea2b('0x5'));var strategy=require(_0xea2b('0x6'));var queue=schema({'name':{'type':_0xea2b('0x7'),'required':!![],'message':_0xea2b('0x8')},'timeout':{'type':'number','message':_0xea2b('0x9')}});function writeLog(_0x137760,_0x6c66df,_0x595079){return logger[_0xea2b('0xa')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x137760,_0x6c66df[_0xea2b('0xb')],_0x595079));}function handleFindAgent(_0x4c7ee7){return function(_0x7c92ab){return _0x7c92ab['name']['toLowerCase']()===_0x4c7ee7[_0xea2b('0xc')]();};}exports[_0xea2b('0xd')]=function(_0x2c9dcc,_0x29e6a2,_0x3960c1,_0x457037){return function(_0x5ddbf1){try{var _0x353ff6={'name':_0x29e6a2[0x0],'timeout':_0x29e6a2[0x1]};var _0x44e610=queue[_0xea2b('0x0')](_0x353ff6,{'typecast':!![]});if(_0x44e610['length']){logger[_0xea2b('0xe')](_0xea2b('0xf'),_0x2c9dcc,_['map'](_0x44e610,_0xea2b('0x10'))[_0xea2b('0x11')](',\x20'));_0x5ddbf1[_0xea2b('0x12')]();}else{var _0x362215=_[_0xea2b('0x13')](_0x3960c1[_0xea2b('0x14')],handleFindAgent(_0x353ff6['name']));if(_0x362215){var _0x8e87cb=(_0x353ff6[_0xea2b('0x15')]||0xa)*0x3e8;var _0x2437e8,_0x581587;var _0xc0ade1=seqqueue[_0xea2b('0x16')](_0x8e87cb);_0xc0ade1['id']=_0x2c9dcc;_0xc0ade1[_0xea2b('0x17')]=_0x8e87cb;_0xc0ade1[_0xea2b('0x18')]=_0x457037[_0xea2b('0x18')];writeLog(_0x2c9dcc,_0x362215,util[_0xea2b('0x19')](_0xea2b('0x1a'),_0x8e87cb));_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]['on']('end',function(){logger[_0xea2b('0xa')](_0xea2b('0x1c'),_0x2c9dcc);clearTimeout(_0x581587);_0x581587=undefined;_0xc0ade1[_0xea2b('0x1d')]();if(_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]){delete _0x3960c1['rules'][_0x2c9dcc];}_0x5ddbf1[_0xea2b('0x12')]();});_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]['on'](_0xea2b('0x1e'),function(){if(_0x3960c1[_0xea2b('0x1b')][_0x2c9dcc]){delete _0x3960c1[_0xea2b('0x1b')][_0x2c9dcc];}});_0x581587=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x2c9dcc);clearTimeout(_0x581587);_0xc0ade1[_0xea2b('0x1d')]();_0x5ddbf1[_0xea2b('0x1f')]();},_0x8e87cb);strategy[_0xea2b('0x20')](_0xc0ade1,_0x362215,_0x3960c1,_0x457037);}else{logger[_0xea2b('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2c9dcc,_0x353ff6[_0xea2b('0xb')]);_0x5ddbf1[_0xea2b('0x12')]();}}}catch(_0x293055){console[_0xea2b('0x21')](_0x293055);logger[_0xea2b('0xe')]('[%s][QUEUE]\x20%s',_0x2c9dcc,_0x293055[_0xea2b('0x22')]);_0x5ddbf1[_0xea2b('0x12')]();}};}; \ No newline at end of file +var _0x310a=['log','[%s][QUEUE]\x20%s','validate','../../../../config/logger','routing','./strategy','string','number','format','name','toLowerCase','consequence','length','error','map','message','join','stop','find','agents','timeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x57beaf,_0x165fb5){var _0x1f23c6=function(_0x240790){while(--_0x240790){_0x57beaf['push'](_0x57beaf['shift']());}};_0x1f23c6(++_0x165fb5);}(_0x310a,0x9d));var _0xa310=function(_0x5be299,_0x55cbca){_0x5be299=_0x5be299-0x0;var _0x56e979=_0x310a[_0x5be299];return _0x56e979;};'use strict';var schema=require(_0xa310('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xa310('0x1'))(_0xa310('0x2'));var strategy=require(_0xa310('0x3'));var queue=schema({'name':{'type':_0xa310('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa310('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1c9166,_0x1bfe54,_0x115ae7){return logger['info'](util[_0xa310('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1c9166,_0x1bfe54['name'],_0x115ae7));}function handleFindAgent(_0x2b3957){return function(_0x4abc85){return _0x4abc85[_0xa310('0x7')][_0xa310('0x8')]()===_0x2b3957['toLowerCase']();};}exports[_0xa310('0x9')]=function(_0x49ff82,_0x3fc488,_0x1c3622,_0x16022d){return function(_0x31f0c0){try{var _0x2e138f={'name':_0x3fc488[0x0],'timeout':_0x3fc488[0x1]};var _0x57f352=queue[_0xa310('0x0')](_0x2e138f,{'typecast':!![]});if(_0x57f352[_0xa310('0xa')]){logger[_0xa310('0xb')]('[%s][AGENT]\x20%s',_0x49ff82,_[_0xa310('0xc')](_0x57f352,_0xa310('0xd'))[_0xa310('0xe')](',\x20'));_0x31f0c0[_0xa310('0xf')]();}else{var _0x1ed5d2=_[_0xa310('0x10')](_0x1c3622[_0xa310('0x11')],handleFindAgent(_0x2e138f[_0xa310('0x7')]));if(_0x1ed5d2){var _0x1ef09f=(_0x2e138f[_0xa310('0x12')]||0xa)*0x3e8;var _0x36e9f1,_0x422526;var _0x35a5e1=seqqueue['createQueue'](_0x1ef09f);_0x35a5e1['id']=_0x49ff82;_0x35a5e1['atimeout']=_0x1ef09f;_0x35a5e1[_0xa310('0x13')]=_0x16022d[_0xa310('0x13')];writeLog(_0x49ff82,_0x1ed5d2,util[_0xa310('0x6')](_0xa310('0x14'),_0x1ef09f));_0x1c3622[_0xa310('0x15')][_0x49ff82]['on'](_0xa310('0x16'),function(){logger[_0xa310('0x17')](_0xa310('0x18'),_0x49ff82);clearTimeout(_0x422526);_0x422526=undefined;_0x35a5e1['close']();if(_0x1c3622[_0xa310('0x15')][_0x49ff82]){delete _0x1c3622['rules'][_0x49ff82];}_0x31f0c0[_0xa310('0xf')]();});_0x1c3622[_0xa310('0x15')][_0x49ff82]['on'](_0xa310('0x19'),function(){if(_0x1c3622[_0xa310('0x15')][_0x49ff82]){delete _0x1c3622['rules'][_0x49ff82];}});_0x422526=setTimeout(function(){logger[_0xa310('0x17')]('[%s][AGENT]\x20ROUTING\x20END',_0x49ff82);clearTimeout(_0x422526);_0x35a5e1['close']();_0x31f0c0[_0xa310('0x1a')]();},_0x1ef09f);strategy[_0xa310('0x1b')](_0x35a5e1,_0x1ed5d2,_0x1c3622,_0x16022d);}else{logger[_0xa310('0xb')](_0xa310('0x1c'),_0x49ff82,_0x2e138f['name']);_0x31f0c0[_0xa310('0xf')]();}}}catch(_0x2ff63b){console[_0xa310('0x1d')](_0x2ff63b);logger[_0xa310('0xb')](_0xa310('0x1e'),_0x49ff82,_0x2ff63b['stack']);_0x31f0c0[_0xa310('0xf')]();}};}; \ 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 eb0379f..9233402 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 _0x35e2=['Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','isEmpty','body'];(function(_0x49bebf,_0x5e486b){var _0x1a914e=function(_0x1e4b38){while(--_0x1e4b38){_0x49bebf['push'](_0x49bebf['shift']());}};_0x1a914e(++_0x5e486b);}(_0x35e2,0xa6));var _0x235e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x35e2[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x235e('0x0'));var moment=require('moment');var AWS=require(_0x235e('0x1'));var utils=require(_0x235e('0x2'));var logger=require(_0x235e('0x3'))(_0x235e('0x4'));var rpc={'chatMessage':require(_0x235e('0x5')),'openchannelMessage':require(_0x235e('0x6')),'mailMessage':require(_0x235e('0x7')),'smsMessage':require(_0x235e('0x8')),'faxMessage':require(_0x235e('0x9')),'whatsappMessage':require(_0x235e('0xa'))};exports['consequence']=function(_0x38deae,_0x46d7c9){return function(_0x111ab4){try{if(!_['isNil'](this[_0x235e('0xb')][_0x235e('0xc')])){logger[_0x235e('0xd')](_0x235e('0xe'),_0x38deae,_0x235e('0xf'));return _0x111ab4[_0x235e('0x10')]();}var _0x36b59={'ContactId':this[_0x235e('0x11')]['id'],'sentAt':moment()['format'](_0x235e('0x12')),'direction':'out'};if(this['channel']===_0x235e('0x13')||this[_0x235e('0x14')]===_0x235e('0x15')){_0x36b59[_0x235e('0x16')]=this[_0x235e('0xb')]['phone'];}var _0x2263bd=this[_0x235e('0x14')];if(_0x2263bd===_0x235e('0x17')){_0x36b59['ChatWebsiteId']=this[_0x235e('0x18')]['id'];}else{_0x36b59[_[_0x235e('0x19')](_0x2263bd)+_0x235e('0x1a')]=this['account']['id'];}_0x36b59[_[_0x235e('0x19')](_0x2263bd)+_0x235e('0x1b')]=this[_0x235e('0xb')]['id'];if(this['interaction']['created']){var _0x1501d2=_0x46d7c9[0x4];if(!_[_0x235e('0x1c')](_0x1501d2)){_0x36b59[_0x235e('0x1d')]=utils['getMustacheRender'](_0x1501d2,this);return rpc[_0x2263bd+_0x235e('0x1e')][_0x235e('0x1f')](_0x36b59)[_0x235e('0x20')](function(_0x27316a){logger[_0x235e('0xd')](_0x235e('0xe'),_0x38deae,_0x36b59['body']);})[_0x235e('0x21')](function(_0x264e6c){logger[_0x235e('0x22')](_0x235e('0xe'),_0x38deae,JSON[_0x235e('0x23')](_0x264e6c));})[_0x235e('0x24')](function(){logger[_0x235e('0xd')](_0x235e('0x25'),_0x38deae);_0x111ab4[_0x235e('0x26')]();});}else{logger[_0x235e('0xd')](_0x235e('0x27'),_0x38deae);_0x111ab4[_0x235e('0x26')]();}}else{var _0x37eacc=this;var _0x19d84e=new AWS[(_0x235e('0x28'))]({'accessKeyId':_0x46d7c9[0x0],'secretAccessKey':_0x46d7c9[0x1],'region':_0x46d7c9[0x2]});var _0x4b4962={'botAlias':_0x235e('0x29'),'botName':_0x46d7c9[0x3],'inputText':this[_0x235e('0x2a')][_0x235e('0x1d')],'userId':this[_0x235e('0x14')]+':'+this[_0x235e('0xb')]['id'][_0x235e('0x2b')]()};_0x19d84e[_0x235e('0x2c')](_0x4b4962,function(_0x315e26,_0xd050cd){if(_0x315e26){logger[_0x235e('0x22')]('[%s][AMAZONLEX]\x20%s',_0x38deae,_0x315e26[_0x235e('0x2a')]);_0x111ab4[_0x235e('0x10')]();}else if(_0xd050cd&&_0xd050cd['message']){_0x37eacc['body'][_0x235e('0x2d')]=_0xd050cd;_0x36b59['body']=_0xd050cd['message'];_0x36b59[_0x235e('0x2e')]='amazonlex';_0x36b59[_0x235e('0x2f')]=JSON[_0x235e('0x23')](_0xd050cd);return rpc[_0x2263bd+_0x235e('0x1e')]['create'](_0x36b59)['then'](function(_0x4dc6b3){logger[_0x235e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x38deae,_0x36b59[_0x235e('0x1d')]);if(_0xd050cd[_0x235e('0x30')]=='Failed'){_0x111ab4['next']();}else{_0x111ab4[_0x235e('0x26')]();}})[_0x235e('0x21')](function(_0x5c8c3e){logger['error']('[%s][AMAZONLEX]\x20%s',_0x38deae,JSON[_0x235e('0x23')](_0x5c8c3e));_0x111ab4[_0x235e('0x10')]();});}else{_0x111ab4['next']();}});}}catch(_0x107ac9){logger[_0x235e('0x22')](_0x235e('0xe'),_0x38deae,JSON['stringify'](_0x107ac9));_0x111ab4['stop']();}};}; \ No newline at end of file +var _0x40e0=['created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x4a886a,_0x3ff060){var _0x311070=function(_0x127712){while(--_0x127712){_0x4a886a['push'](_0x4a886a['shift']());}};_0x311070(++_0x3ff060);}(_0x40e0,0x12a));var _0x040e=function(_0x174851,_0x16eadb){_0x174851=_0x174851-0x0;var _0x53cf35=_0x40e0[_0x174851];return _0x53cf35;};'use strict';var _=require(_0x040e('0x0'));var moment=require('moment');var AWS=require(_0x040e('0x1'));var utils=require(_0x040e('0x2'));var logger=require(_0x040e('0x3'))(_0x040e('0x4'));var rpc={'chatMessage':require(_0x040e('0x5')),'openchannelMessage':require(_0x040e('0x6')),'mailMessage':require(_0x040e('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x040e('0x8')),'whatsappMessage':require(_0x040e('0x9'))};exports[_0x040e('0xa')]=function(_0xf9b447,_0x41f9ae){return function(_0x28e3f4){try{if(!_[_0x040e('0xb')](this[_0x040e('0xc')]['UserId'])){logger[_0x040e('0xd')]('[%s][AMAZONLEX]\x20%s',_0xf9b447,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x28e3f4[_0x040e('0xe')]();}var _0xbc00e5={'ContactId':this[_0x040e('0xf')]['id'],'sentAt':moment()['format'](_0x040e('0x10')),'direction':'out'};if(this[_0x040e('0x11')]===_0x040e('0x12')||this[_0x040e('0x11')]==='whatsapp'){_0xbc00e5['phone']=this[_0x040e('0xc')][_0x040e('0x13')];}var _0x3487cd=this[_0x040e('0x11')];if(_0x3487cd==='chat'){_0xbc00e5[_0x040e('0x14')]=this[_0x040e('0x15')]['id'];}else{_0xbc00e5[_[_0x040e('0x16')](_0x3487cd)+_0x040e('0x17')]=this[_0x040e('0x15')]['id'];}_0xbc00e5[_[_0x040e('0x16')](_0x3487cd)+'InteractionId']=this[_0x040e('0xc')]['id'];if(this['interaction'][_0x040e('0x18')]){var _0x141782=_0x41f9ae[0x4];if(!_[_0x040e('0x19')](_0x141782)){_0xbc00e5[_0x040e('0x1a')]=utils[_0x040e('0x1b')](_0x141782,this);return rpc[_0x3487cd+_0x040e('0x1c')][_0x040e('0x1d')](_0xbc00e5)[_0x040e('0x1e')](function(_0x138afe){logger['info'](_0x040e('0x1f'),_0xf9b447,_0xbc00e5[_0x040e('0x1a')]);})[_0x040e('0x20')](function(_0x217740){logger[_0x040e('0x21')]('[%s][AMAZONLEX]\x20%s',_0xf9b447,JSON[_0x040e('0x22')](_0x217740));})['finally'](function(){logger[_0x040e('0xd')](_0x040e('0x23'),_0xf9b447);_0x28e3f4[_0x040e('0x24')]();});}else{logger[_0x040e('0xd')](_0x040e('0x25'),_0xf9b447);_0x28e3f4[_0x040e('0x24')]();}}else{var _0x39cd1c=this;var _0x4cb1f2=new AWS['LexRuntime']({'accessKeyId':_0x41f9ae[0x0],'secretAccessKey':_0x41f9ae[0x1],'region':_0x41f9ae[0x2]});var _0x25746f={'botAlias':_0x040e('0x26'),'botName':_0x41f9ae[0x3],'inputText':this[_0x040e('0x27')][_0x040e('0x1a')],'userId':this['channel']+':'+this[_0x040e('0xc')]['id'][_0x040e('0x28')]()};_0x4cb1f2['postText'](_0x25746f,function(_0xc08244,_0x1c9599){if(_0xc08244){logger['error']('[%s][AMAZONLEX]\x20%s',_0xf9b447,_0xc08244[_0x040e('0x27')]);_0x28e3f4[_0x040e('0xe')]();}else if(_0x1c9599&&_0x1c9599['message']){_0x39cd1c[_0x040e('0x1a')][_0x040e('0x29')]=_0x1c9599;_0xbc00e5[_0x040e('0x1a')]=_0x1c9599['message'];_0xbc00e5[_0x040e('0x2a')]=_0x040e('0x29');_0xbc00e5[_0x040e('0x2b')]=JSON[_0x040e('0x22')](_0x1c9599);return rpc[_0x3487cd+_0x040e('0x1c')]['create'](_0xbc00e5)[_0x040e('0x1e')](function(_0x519d4c){logger[_0x040e('0xd')]('[%s][AMAZONLEX]\x20%s',_0xf9b447,_0xbc00e5[_0x040e('0x1a')]);if(_0x1c9599[_0x040e('0x2c')]==_0x040e('0x2d')){_0x28e3f4[_0x040e('0xe')]();}else{_0x28e3f4[_0x040e('0x24')]();}})[_0x040e('0x20')](function(_0x1ce86c){logger[_0x040e('0x21')](_0x040e('0x1f'),_0xf9b447,JSON[_0x040e('0x22')](_0x1ce86c));_0x28e3f4[_0x040e('0xe')]();});}else{_0x28e3f4['next']();}});}}catch(_0x40a662){logger[_0x040e('0x21')]('[%s][AMAZONLEX]\x20%s',_0xf9b447,JSON['stringify'](_0x40a662));_0x28e3f4[_0x040e('0x24')]();}};}; \ 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 70a8126..732dd57 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 _0x361f=['from','mail','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../mailRpc','consequence','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','channel','getMustacheRender','message'];(function(_0x4d9323,_0x1e62f9){var _0x4ef329=function(_0x5103b0){while(--_0x5103b0){_0x4d9323['push'](_0x4d9323['shift']());}};_0x4ef329(++_0x1e62f9);}(_0x361f,0xb3));var _0xf361=function(_0x436ec2,_0x24e06c){_0x436ec2=_0x436ec2-0x0;var _0x534231=_0x361f[_0x436ec2];return _0x534231;};'use strict';var _=require('lodash');var moment=require(_0xf361('0x0'));var utils=require(_0xf361('0x1'));var logger=require('../../../../config/logger')(_0xf361('0x2'));var rpc={'chatMessage':require(_0xf361('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf361('0x4')),'smsMessage':require(_0xf361('0x5')),'faxMessage':require(_0xf361('0x6')),'whatsappMessage':require(_0xf361('0x7')),'chatInteraction':require(_0xf361('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xf361('0x9')),'smsInteraction':require(_0xf361('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xf361('0xb'));exports[_0xf361('0xc')]=function(_0x2fb992,_0x4363a2,_0x292301,_0x5e687f){return function(_0xd79363){try{var _0x3a7907=this['channel'];if(_0x3a7907==='mail'&&_0x5e687f[_0xf361('0xd')][_0xf361('0xe')]){logger[_0xf361('0xf')](_0xf361('0x10'),_0x2fb992,_0xf361('0x11'));return _0xd79363[_0xf361('0x12')]();}if(_0x4363a2[0x0]==='1'&&(_['isNil'](this['interaction']['created'])||!this['interaction'][_0xf361('0x13')])){logger[_0xf361('0xf')](_0xf361('0x10'),_0x2fb992,_0xf361('0x14'));return _0xd79363['next']();}if(_0x4363a2[0x0]==='2'&&this['interaction'][_0xf361('0x15')]){logger[_0xf361('0xf')](_0xf361('0x16'),_0x2fb992,_0xf361('0x17'));return _0xd79363[_0xf361('0x12')]();}var _0x275cb2={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xf361('0x18')),'direction':'out'};if(this[_0xf361('0x19')]==='mail'){_0x275cb2['body']=utils[_0xf361('0x1a')](_0x4363a2[0x2],this);}else{_0x275cb2[_0xf361('0xd')]=utils[_0xf361('0x1a')](_0x4363a2[0x1],this);}if(this[_0xf361('0x1b')]){_0x275cb2['to']=this[_0xf361('0x1b')][_0xf361('0x1c')]||'';if(this[_0xf361('0x19')]===_0xf361('0x1d')&&_0x4363a2[0x1]==='1'){_0x275cb2['cc']=this[_0xf361('0x1b')]['cc']||'';}_0x275cb2[_0xf361('0x1c')]=this['message']['to']||'';_0x275cb2[_0xf361('0x1e')]=this[_0xf361('0x1b')][_0xf361('0x1e')]||'';_0x275cb2[_0xf361('0x1f')]=!![];if(this[_0xf361('0x1b')]['subject']){_0x275cb2[_0xf361('0x20')]='';_0x275cb2[_0xf361('0x20')]+=_[_0xf361('0x21')](this[_0xf361('0x1b')]['subject'],'Re:')?'':_0xf361('0x22');_0x275cb2['subject']+=this[_0xf361('0x1b')][_0xf361('0x20')];}}if(this[_0xf361('0x19')]===_0xf361('0x23')){_0x275cb2[_0xf361('0x24')]=this['account']['id'];}else{_0x275cb2[_[_0xf361('0x25')](this[_0xf361('0x19')])+_0xf361('0x26')]=this[_0xf361('0x27')]['id'];}_0x275cb2[_[_0xf361('0x25')](this['channel'])+_0xf361('0x28')]=this[_0xf361('0x29')]['id'];var _0x344624=this[_0xf361('0x29')];if(rpc[this['channel']+_0xf361('0x2a')]){if(this[_0xf361('0x19')]===_0xf361('0x1d')){_0x275cb2[_0xf361('0x2b')]=this[_0xf361('0x1b')][_0xf361('0x2c')];_0x275cb2[_0xf361('0x2d')]=_0xf361('0x2e')+_[_0xf361('0x2f')](_0x275cb2[_0xf361('0xd')],_0xf361('0x30'),'','replace','','headers','auto-replied','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','Interaction','update','error','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','messageId','html'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0xe0e9,0x138));var _0x9e0e=function(_0x2621cf,_0x87b931){_0x2621cf=_0x2621cf-0x0;var _0x1cbe64=_0xe0e9[_0x2621cf];return _0x1cbe64;};'use strict';var _=require(_0x9e0e('0x0'));var moment=require(_0x9e0e('0x1'));var utils=require(_0x9e0e('0x2'));var logger=require(_0x9e0e('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9e0e('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9e0e('0x5')),'faxMessage':require(_0x9e0e('0x6')),'whatsappMessage':require(_0x9e0e('0x7')),'chatInteraction':require(_0x9e0e('0x8')),'openchannelInteraction':require(_0x9e0e('0x9')),'mailInteraction':require(_0x9e0e('0xa')),'smsInteraction':require(_0x9e0e('0xb')),'faxInteraction':require(_0x9e0e('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x9e0e('0xd'));exports[_0x9e0e('0xe')]=function(_0x161957,_0x5ab0d6,_0x2abadc,_0x27a3cc){return function(_0x774e7e){try{var _0x25eaf0=this[_0x9e0e('0xf')];if(_0x25eaf0===_0x9e0e('0x10')&&_0x27a3cc[_0x9e0e('0x11')][_0x9e0e('0x12')]){logger[_0x9e0e('0x13')](_0x9e0e('0x14'),_0x161957,_0x9e0e('0x15'));return _0x774e7e[_0x9e0e('0x16')]();}if(_0x5ab0d6[0x0]==='1'&&(_[_0x9e0e('0x17')](this[_0x9e0e('0x18')][_0x9e0e('0x19')])||!this[_0x9e0e('0x18')][_0x9e0e('0x19')])){logger[_0x9e0e('0x13')](_0x9e0e('0x14'),_0x161957,_0x9e0e('0x1a'));return _0x774e7e['next']();}if(_0x5ab0d6[0x0]==='2'&&this[_0x9e0e('0x18')]['autoreplyExecuted']){logger[_0x9e0e('0x13')](_0x9e0e('0x1b'),_0x161957,_0x9e0e('0x1c'));return _0x774e7e[_0x9e0e('0x16')]();}var _0x2a68fa={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x9e0e('0x1d')),'direction':_0x9e0e('0x1e')};if(this[_0x9e0e('0xf')]==='mail'){_0x2a68fa['body']=utils[_0x9e0e('0x1f')](_0x5ab0d6[0x2],this);}else{_0x2a68fa[_0x9e0e('0x11')]=utils['getMustacheRender'](_0x5ab0d6[0x1],this);}if(this[_0x9e0e('0x20')]){_0x2a68fa['to']=this[_0x9e0e('0x20')][_0x9e0e('0x21')]||'';if(this[_0x9e0e('0xf')]===_0x9e0e('0x10')&&_0x5ab0d6[0x1]==='1'){_0x2a68fa['cc']=this[_0x9e0e('0x20')]['cc']||'';}_0x2a68fa[_0x9e0e('0x21')]=this[_0x9e0e('0x20')]['to']||'';_0x2a68fa['phone']=this['message'][_0x9e0e('0x22')]||'';_0x2a68fa[_0x9e0e('0x23')]=!![];if(this[_0x9e0e('0x20')][_0x9e0e('0x24')]){_0x2a68fa[_0x9e0e('0x24')]='';_0x2a68fa[_0x9e0e('0x24')]+=_[_0x9e0e('0x25')](this[_0x9e0e('0x20')][_0x9e0e('0x24')],_0x9e0e('0x26'))?'':_0x9e0e('0x27');_0x2a68fa['subject']+=this[_0x9e0e('0x20')]['subject'];}}if(this[_0x9e0e('0xf')]===_0x9e0e('0x28')){_0x2a68fa[_0x9e0e('0x29')]=this[_0x9e0e('0x2a')]['id'];}else{_0x2a68fa[_[_0x9e0e('0x2b')](this[_0x9e0e('0xf')])+_0x9e0e('0x2c')]=this[_0x9e0e('0x2a')]['id'];}_0x2a68fa[_[_0x9e0e('0x2b')](this[_0x9e0e('0xf')])+_0x9e0e('0x2d')]=this[_0x9e0e('0x18')]['id'];var _0x525a54=this[_0x9e0e('0x18')];if(rpc[this[_0x9e0e('0xf')]+'Message']){if(this[_0x9e0e('0xf')]===_0x9e0e('0x10')){_0x2a68fa['inReplyTo']=this[_0x9e0e('0x20')][_0x9e0e('0x2e')];_0x2a68fa[_0x9e0e('0x2f')]=_0x9e0e('0x30')+_[_0x9e0e('0x31')](_0x2a68fa['body'],_0x9e0e('0x32'),_0x9e0e('0x33'))+_0x9e0e('0x34');_0x2a68fa[_0x9e0e('0x35')]={'Auto-Submitted':_0x9e0e('0x36'),'X-Auto-Response-Suppress':_0x9e0e('0x37'),'Precedence':_0x9e0e('0x38')};return mailRpc['sendMailMessage'](this['account'][_0x9e0e('0x39')],_0x2a68fa)[_0x9e0e('0x3a')](function(_0x5795ac){logger[_0x9e0e('0x13')](_0x9e0e('0x3b'),_0x161957);_0x2a68fa['messageId']=_0x5795ac[_0x9e0e('0x20')][_0x9e0e('0x2e')];return rpc[_0x25eaf0+'Message'][_0x9e0e('0x3c')](_0x2a68fa);})[_0x9e0e('0x3a')](function(_0x58b9d1){logger['info']('[%s][AUTOREPLY]\x20%s',_0x161957,JSON[_0x9e0e('0x3d')](_0x58b9d1));})[_0x9e0e('0x3e')](function(_0x1ffd13){logger['error'](_0x9e0e('0x3f'),_0x161957,JSON[_0x9e0e('0x3d')](_0x1ffd13));})['finally'](function(){Promise[_0x9e0e('0x40')]()[_0x9e0e('0x3a')](function(){if(_0x5ab0d6[0x0]!=='2'||_0x525a54[_0x9e0e('0x41')])return;return rpc[_0x25eaf0+'Interaction']['update'](_0x525a54['id'],{'autoreplyExecuted':!![]})[_0x9e0e('0x3a')](function(_0x50dacd){logger['info'](_0x9e0e('0x1b'),_0x161957,JSON[_0x9e0e('0x3d')](_0x50dacd));})[_0x9e0e('0x3e')](function(_0x330c32){logger['error'](_0x9e0e('0x42'),_0x161957,JSON[_0x9e0e('0x3d')](_0x330c32));});})[_0x9e0e('0x3a')](function(){_0x774e7e[_0x9e0e('0x16')]();});});}else{return rpc[this[_0x9e0e('0xf')]+_0x9e0e('0x43')][_0x9e0e('0x3c')](_0x2a68fa)[_0x9e0e('0x3a')](function(){logger[_0x9e0e('0x13')]('[%s][AUTOREPLY]\x20%s',_0x161957,_0x2a68fa[_0x9e0e('0x11')]);})[_0x9e0e('0x3e')](function(_0x2afe8c){logger['error'](_0x9e0e('0x14'),_0x161957,JSON[_0x9e0e('0x3d')](_0x2afe8c));})['finally'](function(){Promise[_0x9e0e('0x40')]()[_0x9e0e('0x3a')](function(){if(_0x5ab0d6[0x0]!=='2'||_0x525a54['autoreplyExecuted'])return;return rpc[_0x25eaf0+_0x9e0e('0x44')][_0x9e0e('0x45')](_0x525a54['id'],{'autoreplyExecuted':!![]})['then'](function(_0x56129a){logger[_0x9e0e('0x13')](_0x9e0e('0x1b'),_0x161957,JSON['stringify'](_0x56129a));})[_0x9e0e('0x3e')](function(_0x23cb19){logger[_0x9e0e('0x46')](_0x9e0e('0x42'),_0x161957,JSON[_0x9e0e('0x3d')](_0x23cb19));});})[_0x9e0e('0x3a')](function(){_0x774e7e['next']();});});}}}catch(_0x4cff27){logger['error'](_0x9e0e('0x14'),_0x161957,JSON[_0x9e0e('0x3d')](_0x4cff27));_0x774e7e[_0x9e0e('0x47')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index de4eff1..600a54e 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 _0xa0c6=['../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','[%s][CLOSE]\x20%s','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction'];(function(_0x5b5dfc,_0x166385){var _0x2879d2=function(_0x312793){while(--_0x312793){_0x5b5dfc['push'](_0x5b5dfc['shift']());}};_0x2879d2(++_0x166385);}(_0xa0c6,0x16b));var _0x6a0c=function(_0xbee68f,_0x281e1c){_0xbee68f=_0xbee68f-0x0;var _0x2de3e2=_0xa0c6[_0xbee68f];return _0x2de3e2;};'use strict';var moment=require('moment');var logger=require(_0x6a0c('0x0'))(_0x6a0c('0x1'));var rpc={'chatInteraction':require(_0x6a0c('0x2')),'openchannelInteraction':require(_0x6a0c('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x6a0c('0x4')),'whatsappInteraction':require(_0x6a0c('0x5'))};exports[_0x6a0c('0x6')]=function(_0x2c4e77,_0x5f3ea1,_0x263de3,_0x5dca54){return function(_0xd99261){try{logger[_0x6a0c('0x7')](_0x6a0c('0x8'),_0x2c4e77,_0x5f3ea1[0x0]);var _0x15ce4c={'closed':0x1,'closedAt':moment()[_0x6a0c('0x9')](_0x6a0c('0xa')),'closeReason':_0x6a0c('0xb'),'disposition':_0x5f3ea1[0x0]};if(rpc[_0x5dca54[_0x6a0c('0xc')]+_0x6a0c('0xd')]){rpc[_0x5dca54['channel']+'Interaction']['update'](_0x5dca54[_0x6a0c('0xe')]['id'],_0x15ce4c)[_0x6a0c('0xf')](function(_0x19b4af){logger['info'](_0x6a0c('0x10'),_0x2c4e77,_0x5dca54['interaction']['id']);})[_0x6a0c('0x11')](function(_0x2163a7){logger[_0x6a0c('0x12')]('[%s][CLOSE]\x20%s',_0x2c4e77,JSON[_0x6a0c('0x13')](_0x2163a7));})[_0x6a0c('0x14')](function(){_0xd99261['stop']();});}}catch(_0x5e046f){logger[_0x6a0c('0x12')](_0x6a0c('0x15'),_0x2c4e77,JSON[_0x6a0c('0x13')](_0x5e046f));_0xd99261[_0x6a0c('0x16')]();}};}; \ No newline at end of file +var _0x1c61=['finally','stop','[%s][CLOSE]\x20%s','stringify','moment','routing','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x71213e,_0x154aa1){var _0x4f464d=function(_0x361de5){while(--_0x361de5){_0x71213e['push'](_0x71213e['shift']());}};_0x4f464d(++_0x154aa1);}(_0x1c61,0x121));var _0x11c6=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x1c61[_0x1bfe2b];return _0x1477d4;};'use strict';var moment=require(_0x11c6('0x0'));var logger=require('../../../../config/logger')(_0x11c6('0x1'));var rpc={'chatInteraction':require(_0x11c6('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x11c6('0x3')),'whatsappInteraction':require(_0x11c6('0x4'))};exports[_0x11c6('0x5')]=function(_0x4fb47c,_0x1a483d,_0x15de2e,_0x522c89){return function(_0x33d9f7){try{logger[_0x11c6('0x6')](_0x11c6('0x7'),_0x4fb47c,_0x1a483d[0x0]);var _0x2c4b12={'closed':0x1,'closedAt':moment()[_0x11c6('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x11c6('0x9'),'disposition':_0x1a483d[0x0]};if(rpc[_0x522c89['channel']+_0x11c6('0xa')]){rpc[_0x522c89['channel']+_0x11c6('0xa')][_0x11c6('0xb')](_0x522c89['interaction']['id'],_0x2c4b12)['then'](function(_0x474553){logger[_0x11c6('0x6')](_0x11c6('0xc'),_0x4fb47c,_0x522c89['interaction']['id']);})[_0x11c6('0xd')](function(_0x4fd2f7){logger[_0x11c6('0xe')]('[%s][CLOSE]\x20%s',_0x4fb47c,JSON['stringify'](_0x4fd2f7));})[_0x11c6('0xf')](function(){_0x33d9f7[_0x11c6('0x10')]();});}}catch(_0x39dc78){logger[_0x11c6('0xe')](_0x11c6('0x11'),_0x4fb47c,JSON[_0x11c6('0x12')](_0x39dc78));_0x33d9f7[_0x11c6('0x10')]();}};}; \ 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 322c3c5..1ae98a3 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 _0x714c=['InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','speech','providerName','providerResponse','endConversation','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','account','upperFirst','AccountId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x714c,0x18d));var _0xc714=function(_0x1e896c,_0x3f9948){_0x1e896c=_0x1e896c-0x0;var _0xd149d9=_0x714c[_0x1e896c];return _0xd149d9;};'use strict';var _=require('lodash');var moment=require(_0xc714('0x0'));var apiai=require(_0xc714('0x1'));var md5=require(_0xc714('0x2'));var utils=require(_0xc714('0x3'));var logger=require(_0xc714('0x4'))('routing');var rpc={'chatMessage':require(_0xc714('0x5')),'openchannelMessage':require(_0xc714('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc714('0x7')),'whatsappMessage':require(_0xc714('0x8'))};exports[_0xc714('0x9')]=function(_0xd2aa0d,_0x4a2dd9){return function(_0x56327c){try{if(!_[_0xc714('0xa')](this[_0xc714('0xb')][_0xc714('0xc')])){logger[_0xc714('0xd')](_0xc714('0xe'),_0xd2aa0d,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x56327c[_0xc714('0xf')]();}var _0x34a03f={'ContactId':this[_0xc714('0x10')]['id'],'sentAt':moment()[_0xc714('0x11')](_0xc714('0x12')),'direction':'out'};if(this[_0xc714('0x13')]===_0xc714('0x14')||this['channel']==='whatsapp'){_0x34a03f[_0xc714('0x15')]=this['interaction'][_0xc714('0x15')];}var _0x4462fe=this[_0xc714('0x13')];if(_0x4462fe===_0xc714('0x16')){_0x34a03f['ChatWebsiteId']=this[_0xc714('0x17')]['id'];}else{_0x34a03f[_[_0xc714('0x18')](_0x4462fe)+_0xc714('0x19')]=this[_0xc714('0x17')]['id'];}_0x34a03f[_[_0xc714('0x18')](_0x4462fe)+_0xc714('0x1a')]=this[_0xc714('0xb')]['id'];if(this[_0xc714('0xb')]['created']){var _0x4b2f57=_0x4a2dd9[0x2];if(!_[_0xc714('0x1b')](_0x4b2f57)){_0x34a03f[_0xc714('0x1c')]=utils[_0xc714('0x1d')](_0x4b2f57,this);return rpc[_0x4462fe+_0xc714('0x1e')][_0xc714('0x1f')](_0x34a03f)[_0xc714('0x20')](function(_0x598821){logger[_0xc714('0xd')]('[%s][DIALOGFLOW]\x20%s',_0xd2aa0d,_0x34a03f[_0xc714('0x1c')]);})[_0xc714('0x21')](function(_0x303b58){logger[_0xc714('0x22')]('[%s][DIALOGFLOW]\x20%s',_0xd2aa0d,JSON[_0xc714('0x23')](_0x303b58));})[_0xc714('0x24')](function(){logger[_0xc714('0xd')](_0xc714('0x25'),_0xd2aa0d);_0x56327c[_0xc714('0x26')]();});}else{logger['info'](_0xc714('0x27'),_0xd2aa0d);_0x56327c['stop']();}}else{var _0x35133e=this;var _0x379127=apiai(_0x4a2dd9[0x0],{'language':_0x4a2dd9[0x1]||'en'});return _0x379127[_0xc714('0x28')](this[_0xc714('0x29')][_0xc714('0x1c')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x2bc48c){_0x35133e['body'][_0xc714('0x2a')]=_0x2bc48c;_0x34a03f[_0xc714('0x1c')]=_0x2bc48c['result']['fulfillment'][_0xc714('0x2b')];_0x34a03f[_0xc714('0x2c')]=_0xc714('0x2a');_0x34a03f[_0xc714('0x2d')]=JSON[_0xc714('0x23')](_0x2bc48c);return rpc[_0x4462fe+'Message'][_0xc714('0x1f')](_0x34a03f)[_0xc714('0x20')](function(_0x56d3c8){logger[_0xc714('0xd')](_0xc714('0xe'),_0xd2aa0d,_0x34a03f[_0xc714('0x1c')]);if(_0x2bc48c['result']['metadata'][_0xc714('0x2e')]){_0x56327c['next']();}else{_0x56327c[_0xc714('0x26')]();}})[_0xc714('0x21')](function(_0x480758){logger[_0xc714('0x22')](_0xc714('0xe'),_0xd2aa0d,JSON['stringify'](_0x480758));_0x56327c[_0xc714('0xf')]();});})[_0xc714('0x21')](function(_0x4a947c){logger[_0xc714('0x22')](_0xc714('0xe'),_0xd2aa0d,_0x4a947c[_0xc714('0x29')]);_0x56327c[_0xc714('0xf')]();});}}catch(_0x392a47){logger[_0xc714('0x22')](_0xc714('0xe'),_0xd2aa0d,JSON['stringify'](_0x392a47));_0x56327c[_0xc714('0x26')]();}};}; \ No newline at end of file +var _0x9a6b=['channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','Message','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','result','fulfillment','speech','dialogflow','providerResponse','stringify','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','sms','whatsapp','phone'];(function(_0x343a31,_0x2072b5){var _0x1c68b4=function(_0x7154cb){while(--_0x7154cb){_0x343a31['push'](_0x343a31['shift']());}};_0x1c68b4(++_0x2072b5);}(_0x9a6b,0x77));var _0xb9a6=function(_0x39e28a,_0xfd84d1){_0x39e28a=_0x39e28a-0x0;var _0x26e2e3=_0x9a6b[_0x39e28a];return _0x26e2e3;};'use strict';var _=require(_0xb9a6('0x0'));var moment=require(_0xb9a6('0x1'));var apiai=require(_0xb9a6('0x2'));var md5=require(_0xb9a6('0x3'));var utils=require(_0xb9a6('0x4'));var logger=require(_0xb9a6('0x5'))('routing');var rpc={'chatMessage':require(_0xb9a6('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb9a6('0x7')),'smsMessage':require(_0xb9a6('0x8')),'faxMessage':require(_0xb9a6('0x9')),'whatsappMessage':require(_0xb9a6('0xa'))};exports[_0xb9a6('0xb')]=function(_0x555d54,_0x1b85cc){return function(_0x2afba5){try{if(!_[_0xb9a6('0xc')](this[_0xb9a6('0xd')]['UserId'])){logger[_0xb9a6('0xe')](_0xb9a6('0xf'),_0x555d54,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2afba5[_0xb9a6('0x10')]();}var _0x13f166={'ContactId':this[_0xb9a6('0x11')]['id'],'sentAt':moment()[_0xb9a6('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0xb9a6('0x13')||this['channel']===_0xb9a6('0x14')){_0x13f166['phone']=this[_0xb9a6('0xd')][_0xb9a6('0x15')];}var _0x200bd6=this[_0xb9a6('0x16')];if(_0x200bd6===_0xb9a6('0x17')){_0x13f166[_0xb9a6('0x18')]=this[_0xb9a6('0x19')]['id'];}else{_0x13f166[_[_0xb9a6('0x1a')](_0x200bd6)+_0xb9a6('0x1b')]=this['account']['id'];}_0x13f166[_[_0xb9a6('0x1a')](_0x200bd6)+_0xb9a6('0x1c')]=this[_0xb9a6('0xd')]['id'];if(this[_0xb9a6('0xd')]['created']){var _0x10761b=_0x1b85cc[0x2];if(!_[_0xb9a6('0x1d')](_0x10761b)){_0x13f166[_0xb9a6('0x1e')]=utils['getMustacheRender'](_0x10761b,this);return rpc[_0x200bd6+_0xb9a6('0x1f')][_0xb9a6('0x20')](_0x13f166)[_0xb9a6('0x21')](function(_0x1843e2){logger[_0xb9a6('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x555d54,_0x13f166[_0xb9a6('0x1e')]);})[_0xb9a6('0x22')](function(_0x305234){logger[_0xb9a6('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x555d54,JSON['stringify'](_0x305234));})[_0xb9a6('0x24')](function(){logger[_0xb9a6('0xe')](_0xb9a6('0x25'),_0x555d54);_0x2afba5['stop']();});}else{logger[_0xb9a6('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x555d54);_0x2afba5[_0xb9a6('0x26')]();}}else{var _0x36c6c1=this;var _0x50d3d4=apiai(_0x1b85cc[0x0],{'language':_0x1b85cc[0x1]||'en'});return _0x50d3d4[_0xb9a6('0x27')](this['message']['body'],{'sessionId':md5(this[_0xb9a6('0xd')]['id'])})[_0xb9a6('0x21')](function(_0x73dee3){_0x36c6c1[_0xb9a6('0x1e')]['dialogflow']=_0x73dee3;_0x13f166[_0xb9a6('0x1e')]=_0x73dee3[_0xb9a6('0x28')][_0xb9a6('0x29')][_0xb9a6('0x2a')];_0x13f166['providerName']=_0xb9a6('0x2b');_0x13f166[_0xb9a6('0x2c')]=JSON[_0xb9a6('0x2d')](_0x73dee3);return rpc[_0x200bd6+_0xb9a6('0x1f')][_0xb9a6('0x20')](_0x13f166)[_0xb9a6('0x21')](function(_0xce91fb){logger['info'](_0xb9a6('0xf'),_0x555d54,_0x13f166[_0xb9a6('0x1e')]);if(_0x73dee3['result'][_0xb9a6('0x2e')]['endConversation']){_0x2afba5[_0xb9a6('0x10')]();}else{_0x2afba5['stop']();}})[_0xb9a6('0x22')](function(_0x288111){logger['error'](_0xb9a6('0xf'),_0x555d54,JSON[_0xb9a6('0x2d')](_0x288111));_0x2afba5[_0xb9a6('0x10')]();});})[_0xb9a6('0x22')](function(_0x33f33a){logger[_0xb9a6('0x23')](_0xb9a6('0xf'),_0x555d54,_0x33f33a['message']);_0x2afba5[_0xb9a6('0x10')]();});}}catch(_0xff1edb){logger[_0xb9a6('0x23')](_0xb9a6('0xf'),_0x555d54,JSON['stringify'](_0xff1edb));_0x2afba5[_0xb9a6('0x26')]();}};}; \ 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 bea8a4b..2b6ab59 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 _0xb81c=['InteractionId','created','isEmpty','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','sessionPath','message','detectIntent','length','diagnosticInfo','queryResult','fields','end_conversation','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','next','stack','md5','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','UserId','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','interaction','chat','account','upperFirst','AccountId'];(function(_0x70a770,_0x56f8b9){var _0x1de850=function(_0x39f1b8){while(--_0x39f1b8){_0x70a770['push'](_0x70a770['shift']());}};_0x1de850(++_0x56f8b9);}(_0xb81c,0xa3));var _0xcb81=function(_0x563104,_0x290cb9){_0x563104=_0x563104-0x0;var _0x16a2ed=_0xb81c[_0x563104];return _0x16a2ed;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0xcb81('0x0'));var moment=require('moment');var Promise=require(_0xcb81('0x1'));var logger=require(_0xcb81('0x2'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xcb81('0x3')),'openchannelMessage':require(_0xcb81('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xcb81('0x5')),'faxMessage':require(_0xcb81('0x6')),'whatsappMessage':require(_0xcb81('0x7'))};function createMessage(_0x1f96e4,_0x2bdb8f,_0x5d64a8,_0x244cd5){return new Promise(function(_0x2039a3,_0x3c1e46){var _0x49d904=_[_0xcb81('0x8')](_0x5d64a8);_0x49d904[_0xcb81('0x9')]=_0x244cd5;return rpc[_0x2bdb8f+_0xcb81('0xa')][_0xcb81('0xb')](_0x49d904)[_0xcb81('0xc')](function(){logger[_0xcb81('0xd')](_0xcb81('0xe'),_0x1f96e4,_0x49d904['body']);_0x2039a3();})[_0xcb81('0xf')](function(_0x958164){logger[_0xcb81('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1f96e4,JSON['stringify'](_0x958164));_0x3c1e46(_0x958164);});});}exports[_0xcb81('0x11')]=function(_0x4ca5ed,_0x532469){return function(_0x4c5b16){try{if(!_[_0xcb81('0x12')](this['interaction'][_0xcb81('0x13')])){logger['info'](_0xcb81('0xe'),_0x4ca5ed,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4c5b16['next']();}var _0x28a93d={'ContactId':this[_0xcb81('0x14')]['id'],'sentAt':moment()['format'](_0xcb81('0x15')),'direction':_0xcb81('0x16')};if(this['channel']==='sms'||this[_0xcb81('0x17')]==='whatsapp'){_0x28a93d['phone']=this[_0xcb81('0x18')]['phone'];}var _0x26cf81=this[_0xcb81('0x17')];if(_0x26cf81===_0xcb81('0x19')){_0x28a93d['ChatWebsiteId']=this[_0xcb81('0x1a')]['id'];}else{_0x28a93d[_[_0xcb81('0x1b')](_0x26cf81)+_0xcb81('0x1c')]=this[_0xcb81('0x1a')]['id'];}_0x28a93d[_[_0xcb81('0x1b')](_0x26cf81)+_0xcb81('0x1d')]=this[_0xcb81('0x18')]['id'];if(this[_0xcb81('0x18')][_0xcb81('0x1e')]){var _0x33482c=_0x532469[0x4];if(!_[_0xcb81('0x1f')](_0x33482c)){_0x28a93d['body']=utils[_0xcb81('0x20')](_0x33482c,this);return rpc[_0x26cf81+_0xcb81('0xa')][_0xcb81('0xb')](_0x28a93d)['then'](function(_0x330a03){logger[_0xcb81('0xd')](_0xcb81('0xe'),_0x4ca5ed,_0x28a93d['body']);})['catch'](function(_0x2dfa40){logger[_0xcb81('0x10')](_0xcb81('0xe'),_0x4ca5ed,JSON[_0xcb81('0x21')](_0x2dfa40));})[_0xcb81('0x22')](function(){logger['info'](_0xcb81('0x23'),_0x4ca5ed);_0x4c5b16[_0xcb81('0x24')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4ca5ed);_0x4c5b16['stop']();}}else{var _0x2f19a1=this;var _0x4f8900=_0x532469[0x2][_0xcb81('0x25')](/\\n/g,'\x0a');var _0x19121d={'credentials':{'private_key':_0x4f8900,'client_email':_0x532469[0x1]}};var _0x218b45=new dialogflow['SessionsClient'](_0x19121d);var _0x421c85=_0x218b45[_0xcb81('0x26')](_0x532469[0x0],md5(_0x2f19a1[_0xcb81('0x18')]['id']));var _0x8e7235={'session':_0x421c85,'queryInput':{'text':{'text':_0x2f19a1[_0xcb81('0x27')][_0xcb81('0x9')],'languageCode':_0x532469[0x3]||'en'}}};return _0x218b45[_0xcb81('0x28')](_0x8e7235)['then'](function(_0x574b2d){if(_0x574b2d&&_0x574b2d[_0xcb81('0x29')]){_0x2f19a1[_0xcb81('0x9')]['dialogflowV2']=_0x574b2d;var _0x4bbb6a=_0x574b2d[0x0];var _0x434db8=_0x4bbb6a['queryResult'][_0xcb81('0x2a')]&&_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x2a')][_0xcb81('0x2c')]?_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x2a')][_0xcb81('0x2c')][_0xcb81('0x2d')]['boolValue']:![];_0x2f19a1[_0xcb81('0x9')][_0xcb81('0x2e')]=_0x4bbb6a[_0xcb81('0x2b')]['action'];_0x2f19a1[_0xcb81('0x9')][_0xcb81('0x2f')]=_0x4bbb6a['queryResult'][_0xcb81('0x30')];_0x2f19a1[_0xcb81('0x9')][_0xcb81('0x31')]=_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x2a')]&&_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x2a')][_0xcb81('0x2c')]?_0x4bbb6a[_0xcb81('0x2b')]['diagnosticInfo'][_0xcb81('0x2c')][_0xcb81('0x2d')][_0xcb81('0x32')]:![];_0x2f19a1[_0xcb81('0x9')][_0xcb81('0x33')]=_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x34')][_0xcb81('0x35')];_0x2f19a1[_0xcb81('0x9')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x34')][_0xcb81('0x36')];_0x2f19a1['body'][_0xcb81('0x37')]=_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x34')]['isFallback'];_0x2f19a1[_0xcb81('0x9')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4bbb6a[_0xcb81('0x2b')][_0xcb81('0x38')];_0x2f19a1['body'][_0xcb81('0x39')]=_0x4bbb6a[_0xcb81('0x2b')]['queryText'];_0x2f19a1[_0xcb81('0x9')][_0xcb81('0x3a')]=_0x4bbb6a['queryResult'][_0xcb81('0x3b')];_0x28a93d['providerName']='dialogflowV2';_0x28a93d[_0xcb81('0x3c')]=JSON[_0xcb81('0x21')](_0x574b2d);var _0x4c2c32=[];for(var _0x140fd9=0x0;_0x140fd9<_0x574b2d[_0xcb81('0x29')];_0x140fd9++){var _0x49de3a=_0x574b2d[_0x140fd9];if(_0x49de3a&&_0x49de3a[_0xcb81('0x2b')]&&_0x49de3a['queryResult']['fulfillmentText']){_0x4c2c32['push'](createMessage(_0x4ca5ed,_0x26cf81,_0x28a93d,_0x49de3a['queryResult'][_0xcb81('0x3d')]));}}return Promise['all'](_0x4c2c32)[_0xcb81('0xc')](function(){if(_0x434db8){_0x4c5b16[_0xcb81('0x3e')]();}else{_0x4c5b16[_0xcb81('0x24')]();}})['catch'](function(_0x448161){logger[_0xcb81('0x10')](_0xcb81('0xe'),_0x4ca5ed,JSON[_0xcb81('0x21')](_0x448161));_0x4c5b16['next']();});}})[_0xcb81('0xf')](function(_0x576a58){logger[_0xcb81('0x10')](_0xcb81('0xe'),_0x4ca5ed,_0x576a58[_0xcb81('0x27')],_0x576a58[_0xcb81('0x3f')]);_0x4c5b16[_0xcb81('0x3e')]();});}}catch(_0x470fd8){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x4ca5ed,JSON[_0xcb81('0x21')](_0x470fd8));_0x4c5b16[_0xcb81('0x24')]();}};}; \ No newline at end of file +var _0x829b=['DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','message','stack','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION'];(function(_0x456b15,_0x3d5e86){var _0xe8c31f=function(_0x124410){while(--_0x124410){_0x456b15['push'](_0x456b15['shift']());}};_0xe8c31f(++_0x3d5e86);}(_0x829b,0xe6));var _0xb829=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x829b[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var dialogflow=require(_0xb829('0x0'));var md5=require('md5');var moment=require(_0xb829('0x1'));var Promise=require('bluebird');var logger=require(_0xb829('0x2'))(_0xb829('0x3'));var utils=require(_0xb829('0x4'));var rpc={'chatMessage':require(_0xb829('0x5')),'openchannelMessage':require(_0xb829('0x6')),'mailMessage':require(_0xb829('0x7')),'smsMessage':require(_0xb829('0x8')),'faxMessage':require(_0xb829('0x9')),'whatsappMessage':require(_0xb829('0xa'))};function createMessage(_0x5c6a68,_0x5a4bc8,_0x19ad8a,_0x2f6ce8){return new Promise(function(_0x50a00f,_0x4e466a){var _0x2b364f=_[_0xb829('0xb')](_0x19ad8a);_0x2b364f[_0xb829('0xc')]=_0x2f6ce8;return rpc[_0x5a4bc8+_0xb829('0xd')][_0xb829('0xe')](_0x2b364f)['then'](function(){logger[_0xb829('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x5c6a68,_0x2b364f['body']);_0x50a00f();})[_0xb829('0x10')](function(_0x5afb52){logger[_0xb829('0x11')](_0xb829('0x12'),_0x5c6a68,JSON[_0xb829('0x13')](_0x5afb52));_0x4e466a(_0x5afb52);});});}exports[_0xb829('0x14')]=function(_0x2a424e,_0x27915e){return function(_0x3d0a47){try{if(!_[_0xb829('0x15')](this[_0xb829('0x16')][_0xb829('0x17')])){logger['info'](_0xb829('0x12'),_0x2a424e,_0xb829('0x18'));return _0x3d0a47[_0xb829('0x19')]();}var _0x2a9899={'ContactId':this[_0xb829('0x1a')]['id'],'sentAt':moment()[_0xb829('0x1b')](_0xb829('0x1c')),'direction':'out'};if(this[_0xb829('0x1d')]==='sms'||this['channel']===_0xb829('0x1e')){_0x2a9899['phone']=this[_0xb829('0x16')]['phone'];}var _0x5952c2=this[_0xb829('0x1d')];if(_0x5952c2===_0xb829('0x1f')){_0x2a9899[_0xb829('0x20')]=this[_0xb829('0x21')]['id'];}else{_0x2a9899[_[_0xb829('0x22')](_0x5952c2)+_0xb829('0x23')]=this[_0xb829('0x21')]['id'];}_0x2a9899[_[_0xb829('0x22')](_0x5952c2)+_0xb829('0x24')]=this[_0xb829('0x16')]['id'];if(this[_0xb829('0x16')]['created']){var _0x5d514c=_0x27915e[0x4];if(!_['isEmpty'](_0x5d514c)){_0x2a9899[_0xb829('0xc')]=utils['getMustacheRender'](_0x5d514c,this);return rpc[_0x5952c2+_0xb829('0xd')]['create'](_0x2a9899)[_0xb829('0x25')](function(_0x9ea953){logger[_0xb829('0xf')](_0xb829('0x12'),_0x2a424e,_0x2a9899[_0xb829('0xc')]);})[_0xb829('0x10')](function(_0x18afbf){logger[_0xb829('0x11')](_0xb829('0x12'),_0x2a424e,JSON[_0xb829('0x13')](_0x18afbf));})[_0xb829('0x26')](function(){logger[_0xb829('0xf')](_0xb829('0x27'),_0x2a424e);_0x3d0a47['stop']();});}else{logger[_0xb829('0xf')](_0xb829('0x28'),_0x2a424e);_0x3d0a47[_0xb829('0x29')]();}}else{var _0x5a79a8=this;var _0x4fdee2=_0x27915e[0x2][_0xb829('0x2a')](/\\n/g,'\x0a');var _0x10faf4={'credentials':{'private_key':_0x4fdee2,'client_email':_0x27915e[0x1]}};var _0x352f3a=new dialogflow[(_0xb829('0x2b'))](_0x10faf4);var _0x527399=_0x352f3a['sessionPath'](_0x27915e[0x0],md5(_0x5a79a8['interaction']['id']));var _0x33c16e={'session':_0x527399,'queryInput':{'text':{'text':_0x5a79a8['message'][_0xb829('0xc')],'languageCode':_0x27915e[0x3]||'en'}}};return _0x352f3a[_0xb829('0x2c')](_0x33c16e)[_0xb829('0x25')](function(_0x5796ce){if(_0x5796ce&&_0x5796ce['length']){_0x5a79a8['body'][_0xb829('0x2d')]=_0x5796ce;var _0x58f1ff=_0x5796ce[0x0];var _0x3cebd5=_0x58f1ff[_0xb829('0x2e')][_0xb829('0x2f')]&&_0x58f1ff[_0xb829('0x2e')][_0xb829('0x2f')][_0xb829('0x30')]?_0x58f1ff[_0xb829('0x2e')]['diagnosticInfo']['fields'][_0xb829('0x31')][_0xb829('0x32')]:![];_0x5a79a8[_0xb829('0xc')]['DIALOGFLOWV2_ACTION']=_0x58f1ff[_0xb829('0x2e')]['action'];_0x5a79a8[_0xb829('0xc')][_0xb829('0x33')]=_0x58f1ff[_0xb829('0x2e')][_0xb829('0x34')];_0x5a79a8[_0xb829('0xc')][_0xb829('0x35')]=_0x58f1ff[_0xb829('0x2e')][_0xb829('0x2f')]&&_0x58f1ff['queryResult'][_0xb829('0x2f')]['fields']?_0x58f1ff[_0xb829('0x2e')]['diagnosticInfo']['fields'][_0xb829('0x31')][_0xb829('0x32')]:![];_0x5a79a8[_0xb829('0xc')][_0xb829('0x36')]=_0x58f1ff['queryResult'][_0xb829('0x37')][_0xb829('0x38')];_0x5a79a8[_0xb829('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x58f1ff[_0xb829('0x2e')][_0xb829('0x37')]['displayName'];_0x5a79a8['body'][_0xb829('0x39')]=_0x58f1ff[_0xb829('0x2e')][_0xb829('0x37')]['isFallback'];_0x5a79a8[_0xb829('0xc')][_0xb829('0x3a')]=_0x58f1ff[_0xb829('0x2e')]['languageCode'];_0x5a79a8[_0xb829('0xc')][_0xb829('0x3b')]=_0x58f1ff[_0xb829('0x2e')][_0xb829('0x3c')];_0x5a79a8[_0xb829('0xc')][_0xb829('0x3d')]=_0x58f1ff['queryResult'][_0xb829('0x3e')];_0x2a9899[_0xb829('0x3f')]=_0xb829('0x2d');_0x2a9899[_0xb829('0x40')]=JSON['stringify'](_0x5796ce);var _0x1e4e04=[];for(var _0x48e8cd=0x0;_0x48e8cd<_0x5796ce[_0xb829('0x41')];_0x48e8cd++){var _0x2c6680=_0x5796ce[_0x48e8cd];if(_0x2c6680&&_0x2c6680[_0xb829('0x2e')]&&_0x2c6680['queryResult'][_0xb829('0x42')]){_0x1e4e04[_0xb829('0x43')](createMessage(_0x2a424e,_0x5952c2,_0x2a9899,_0x2c6680[_0xb829('0x2e')][_0xb829('0x42')]));}}return Promise[_0xb829('0x44')](_0x1e4e04)['then'](function(){if(_0x3cebd5){_0x3d0a47[_0xb829('0x19')]();}else{_0x3d0a47[_0xb829('0x29')]();}})[_0xb829('0x10')](function(_0x26622f){logger['error'](_0xb829('0x12'),_0x2a424e,JSON[_0xb829('0x13')](_0x26622f));_0x3d0a47[_0xb829('0x19')]();});}})[_0xb829('0x10')](function(_0x1671e6){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x2a424e,_0x1671e6[_0xb829('0x45')],_0x1671e6[_0xb829('0x46')]);_0x3d0a47[_0xb829('0x19')]();});}}catch(_0x13aa49){logger[_0xb829('0x11')](_0xb829('0x12'),_0x2a424e,JSON[_0xb829('0x13')](_0x13aa49));_0x3d0a47['stop']();}};}; \ 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 b8bd4f6..8aa8ff7 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 _0xee55=['message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','map'];(function(_0x24af18,_0x132dc4){var _0x47e20d=function(_0xad4bf1){while(--_0xad4bf1){_0x24af18['push'](_0x24af18['shift']());}};_0x47e20d(++_0x132dc4);}(_0xee55,0x105));var _0x5ee5=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0xee55[_0x28a5ad];return _0x176b8a;};'use strict';var schema=require('validate');var _=require(_0x5ee5('0x0'));var htmlToText=require(_0x5ee5('0x1'));var utils=require(_0x5ee5('0x2'));var logger=require(_0x5ee5('0x3'))(_0x5ee5('0x4'));var gotoif=schema({'condition':{'type':_0x5ee5('0x5'),'required':!![],'message':_0x5ee5('0x6')},'priorityTrue':{'type':_0x5ee5('0x7'),'message':_0x5ee5('0x8')},'priorityFalse':{'type':_0x5ee5('0x7'),'message':_0x5ee5('0x9')}});exports[_0x5ee5('0xa')]=function(_0x243f5f,_0x3a85e3){return function(_0x2e8503){try{var _0x4b88a8={'condition':htmlToText[_0x5ee5('0xb')](utils[_0x5ee5('0xc')](_0x3a85e3[0x0],this),{'wordwrap':![]})[_0x5ee5('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3a85e3[0x1],'priorityFalse':_0x3a85e3[0x2]};var _0x4ce1b0=gotoif[_0x5ee5('0xe')](_0x4b88a8,{'typecast':!![]});if(_0x4ce1b0[_0x5ee5('0xf')]){logger[_0x5ee5('0x10')]('[%s][GOTOIF]\x20%s',_0x243f5f,_[_0x5ee5('0x11')](_0x4ce1b0,_0x5ee5('0x12'))[_0x5ee5('0x13')](',\x20'));_0x2e8503[_0x5ee5('0x14')]();}else{try{var _0x36632e=eval('('+_0x4b88a8[_0x5ee5('0x15')]+')');var _0xc3e874=_0x36632e?_0x4b88a8[_0x5ee5('0x16')]:_0x4b88a8['priorityFalse'];logger[_0x5ee5('0x17')](_0x5ee5('0x18'),_0x243f5f,_0x4b88a8['condition'],_0x36632e,_0xc3e874||'next');if(_0xc3e874){var _0x38b716=_[_0x5ee5('0x19')](_0x2e8503[_0x5ee5('0x1a')](),{'p':_0xc3e874});if(_0x38b716>=0x0){logger[_0x5ee5('0x17')](_0x5ee5('0x1b'),_0x243f5f,_0xc3e874||_0x5ee5('0x1c'),_0x38b716);_0x2e8503['next'](_0x38b716);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x243f5f,_0xc3e874||'next');_0x2e8503[_0x5ee5('0x14')]();}}else{_0x2e8503[_0x5ee5('0x1c')]();}}catch(_0x4bf9a8){logger[_0x5ee5('0x10')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x243f5f,_0x4bf9a8[_0x5ee5('0x12')]);_0x2e8503[_0x5ee5('0x14')]();}}}catch(_0x514c26){logger[_0x5ee5('0x10')](_0x5ee5('0x1d'),_0x243f5f,JSON[_0x5ee5('0x1e')](_0x514c26));_0x2e8503['stop']();}};}; \ No newline at end of file +var _0x1e98=['priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','replace','error','[%s][GOTOIF]\x20%s','map','join','stop','condition'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x1e98,0x1ef));var _0x81e9=function(_0x3abe6a,_0xdd7b1a){_0x3abe6a=_0x3abe6a-0x0;var _0x2fc39e=_0x1e98[_0x3abe6a];return _0x2fc39e;};'use strict';var schema=require(_0x81e9('0x0'));var _=require(_0x81e9('0x1'));var htmlToText=require(_0x81e9('0x2'));var utils=require(_0x81e9('0x3'));var logger=require(_0x81e9('0x4'))(_0x81e9('0x5'));var gotoif=schema({'condition':{'type':_0x81e9('0x6'),'required':!![],'message':_0x81e9('0x7')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x81e9('0x8'),'message':_0x81e9('0x9')}});exports['consequence']=function(_0x47d132,_0x1571d8){return function(_0x4f5144){try{var _0x41d921={'condition':htmlToText[_0x81e9('0xa')](utils['getMustacheRender'](_0x1571d8[0x0],this),{'wordwrap':![]})[_0x81e9('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1571d8[0x1],'priorityFalse':_0x1571d8[0x2]};var _0x5c2269=gotoif[_0x81e9('0x0')](_0x41d921,{'typecast':!![]});if(_0x5c2269['length']){logger[_0x81e9('0xc')](_0x81e9('0xd'),_0x47d132,_[_0x81e9('0xe')](_0x5c2269,'message')[_0x81e9('0xf')](',\x20'));_0x4f5144[_0x81e9('0x10')]();}else{try{var _0x5491f5=eval('('+_0x41d921[_0x81e9('0x11')]+')');var _0x4ed6d2=_0x5491f5?_0x41d921[_0x81e9('0x12')]:_0x41d921[_0x81e9('0x13')];logger[_0x81e9('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x47d132,_0x41d921[_0x81e9('0x11')],_0x5491f5,_0x4ed6d2||_0x81e9('0x15'));if(_0x4ed6d2){var _0x107b6a=_[_0x81e9('0x16')](_0x4f5144[_0x81e9('0x17')](),{'p':_0x4ed6d2});if(_0x107b6a>=0x0){logger['info'](_0x81e9('0x18'),_0x47d132,_0x4ed6d2||_0x81e9('0x15'),_0x107b6a);_0x4f5144[_0x81e9('0x15')](_0x107b6a);}else{logger[_0x81e9('0x14')](_0x81e9('0x19'),_0x47d132,_0x4ed6d2||'next');_0x4f5144[_0x81e9('0x10')]();}}else{_0x4f5144[_0x81e9('0x15')]();}}catch(_0x2e9971){logger[_0x81e9('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x47d132,_0x2e9971['message']);_0x4f5144[_0x81e9('0x10')]();}}}catch(_0x48bb86){logger['error'](_0x81e9('0xd'),_0x47d132,JSON[_0x81e9('0x1a')](_0x48bb86));_0x4f5144['stop']();}};}; \ 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 4fcc340..523538a 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 _0xa3c3=['consequence','length','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x271697,_0x6897d6){var _0x426093=function(_0x4d4dfe){while(--_0x4d4dfe){_0x271697['push'](_0x271697['shift']());}};_0x426093(++_0x6897d6);}(_0xa3c3,0x1b2));var _0x3a3c=function(_0x33dbbf,_0x24622b){_0x33dbbf=_0x33dbbf-0x0;var _0x14ee42=_0xa3c3[_0x33dbbf];return _0x14ee42;};'use strict';var schema=require(_0x3a3c('0x0'));var _=require(_0x3a3c('0x1'));var logger=require(_0x3a3c('0x2'))(_0x3a3c('0x3'));var gotop=schema({'priority':{'type':_0x3a3c('0x4'),'required':!![],'message':_0x3a3c('0x5')}});exports[_0x3a3c('0x6')]=function(_0x4c3faf,_0x58d92e){return function(_0x3c4035){try{var _0x309f70={'priority':_0x58d92e[0x0]};var _0x3a2ad7=gotop['validate'](_0x309f70,{'typecast':!![]});if(_0x3a2ad7[_0x3a3c('0x7')]){logger['error']('[%s][GOTOP]\x20%s',_0x4c3faf,_[_0x3a3c('0x8')](_0x3a2ad7,_0x3a3c('0x9'))[_0x3a3c('0xa')](',\x20'));_0x3c4035['stop']();}else{logger[_0x3a3c('0xb')](_0x3a3c('0xc'),_0x4c3faf,_0x309f70['priority']);if(_0x309f70[_0x3a3c('0xd')]){var _0x4bf4f0=_['findIndex'](_0x3c4035[_0x3a3c('0xe')](),{'p':_0x309f70[_0x3a3c('0xd')]});if(_0x4bf4f0>=0x0){logger[_0x3a3c('0xb')](_0x3a3c('0xf'),_0x4c3faf,_0x309f70[_0x3a3c('0xd')]||_0x3a3c('0x10'),_0x4bf4f0);_0x3c4035[_0x3a3c('0x10')](_0x4bf4f0);}else{logger[_0x3a3c('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4c3faf,_0x309f70[_0x3a3c('0xd')]||_0x3a3c('0x10'));_0x3c4035[_0x3a3c('0x11')]();}}else{_0x3c4035['next']();}}}catch(_0x2303f1){logger[_0x3a3c('0x12')]('[%s][GOTOP]\x20%s',_0x4c3faf,JSON[_0x3a3c('0x13')](_0x2303f1));_0x3c4035['stop']();}};}; \ No newline at end of file +var _0x90f1=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','next'];(function(_0x5bc18d,_0x4a1372){var _0x32a08e=function(_0x22d348){while(--_0x22d348){_0x5bc18d['push'](_0x5bc18d['shift']());}};_0x32a08e(++_0x4a1372);}(_0x90f1,0xa3));var _0x190f=function(_0x470ddc,_0x562e73){_0x470ddc=_0x470ddc-0x0;var _0x52c863=_0x90f1[_0x470ddc];return _0x52c863;};'use strict';var schema=require(_0x190f('0x0'));var _=require(_0x190f('0x1'));var logger=require(_0x190f('0x2'))(_0x190f('0x3'));var gotop=schema({'priority':{'type':_0x190f('0x4'),'required':!![],'message':_0x190f('0x5')}});exports['consequence']=function(_0x37334b,_0x1b1404){return function(_0x58412f){try{var _0x5a779d={'priority':_0x1b1404[0x0]};var _0x51040e=gotop[_0x190f('0x0')](_0x5a779d,{'typecast':!![]});if(_0x51040e[_0x190f('0x6')]){logger['error'](_0x190f('0x7'),_0x37334b,_[_0x190f('0x8')](_0x51040e,_0x190f('0x9'))[_0x190f('0xa')](',\x20'));_0x58412f[_0x190f('0xb')]();}else{logger['info'](_0x190f('0xc'),_0x37334b,_0x5a779d[_0x190f('0xd')]);if(_0x5a779d['priority']){var _0x446277=_['findIndex'](_0x58412f[_0x190f('0xe')](),{'p':_0x5a779d['priority']});if(_0x446277>=0x0){logger[_0x190f('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x37334b,_0x5a779d[_0x190f('0xd')]||_0x190f('0x10'),_0x446277);_0x58412f[_0x190f('0x10')](_0x446277);}else{logger[_0x190f('0xf')](_0x190f('0x11'),_0x37334b,_0x5a779d[_0x190f('0xd')]||'next');_0x58412f['stop']();}}else{_0x58412f[_0x190f('0x10')]();}}}catch(_0x2e1247){logger[_0x190f('0x12')](_0x190f('0x7'),_0x37334b,JSON[_0x190f('0x13')](_0x2e1247));_0x58412f[_0x190f('0xb')]();}};}; \ 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 ea669ac..c9455f7 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 _0x9ab9=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','chat','ChatWebsiteId','upperFirst','channel','AccountId','account','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','lodash','./utils','../../../../config/logger'];(function(_0x58a364,_0x3439f6){var _0x409b74=function(_0xff5c15){while(--_0xff5c15){_0x58a364['push'](_0x58a364['shift']());}};_0x409b74(++_0x3439f6);}(_0x9ab9,0x19d));var _0x99ab=function(_0x30a5a5,_0x18255e){_0x30a5a5=_0x30a5a5-0x0;var _0x10e17e=_0x9ab9[_0x30a5a5];return _0x10e17e;};'use strict';var _=require(_0x99ab('0x0'));var utils=require(_0x99ab('0x1'));var logger=require(_0x99ab('0x2'))(_0x99ab('0x3'));var rpc={'chatMessage':require(_0x99ab('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x99ab('0x5')),'smsMessage':require(_0x99ab('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x99ab('0x7'))};exports['consequence']=function(_0x442e8c,_0x1042a3){return function(_0x390d41){try{var _0x249c1f={'body':utils[_0x99ab('0x8')](_0x1042a3[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x99ab('0x9')){_0x249c1f[_0x99ab('0xa')]=this['account']['id'];}else{_0x249c1f[_[_0x99ab('0xb')](this[_0x99ab('0xc')])+_0x99ab('0xd')]=this[_0x99ab('0xe')]['id'];}_0x249c1f[_[_0x99ab('0xb')](this[_0x99ab('0xc')])+'InteractionId']=this[_0x99ab('0xf')]['id'];if(rpc[this[_0x99ab('0xc')]+_0x99ab('0x10')]){return rpc[this['channel']+'Message'][_0x99ab('0x11')](_0x249c1f)[_0x99ab('0x12')](function(_0x3739fb){logger[_0x99ab('0x13')](_0x99ab('0x14'),_0x442e8c,_0x249c1f[_0x99ab('0x15')]);_0x390d41['next']();})[_0x99ab('0x16')](function(_0x5bf382){logger['error'](_0x99ab('0x14'),_0x442e8c,JSON[_0x99ab('0x17')](_0x5bf382));_0x390d41[_0x99ab('0x18')]();});}}catch(_0x4b11f1){logger[_0x99ab('0x19')](_0x99ab('0x14'),_0x442e8c,JSON[_0x99ab('0x17')](_0x4b11f1));_0x390d41[_0x99ab('0x18')]();}};}; \ No newline at end of file +var _0xa56c=['lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','upperFirst','AccountId','account','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','error','stringify'];(function(_0x441f06,_0x285125){var _0x5584d1=function(_0x16e226){while(--_0x16e226){_0x441f06['push'](_0x441f06['shift']());}};_0x5584d1(++_0x285125);}(_0xa56c,0x1f4));var _0xca56=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xa56c[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0xca56('0x0'));var utils=require(_0xca56('0x1'));var logger=require('../../../../config/logger')(_0xca56('0x2'));var rpc={'chatMessage':require(_0xca56('0x3')),'openchannelMessage':require(_0xca56('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xca56('0x5')),'faxMessage':require(_0xca56('0x6')),'whatsappMessage':require(_0xca56('0x7'))};exports[_0xca56('0x8')]=function(_0x1b2815,_0x613e75){return function(_0x5d2108){try{var _0x3366cc={'body':utils[_0xca56('0x9')](_0x613e75[0x0],this),'ContactId':this[_0xca56('0xa')]['id']};if(this[_0xca56('0xb')]===_0xca56('0xc')){_0x3366cc['ChatWebsiteId']=this['account']['id'];}else{_0x3366cc[_[_0xca56('0xd')](this['channel'])+_0xca56('0xe')]=this[_0xca56('0xf')]['id'];}_0x3366cc[_[_0xca56('0xd')](this[_0xca56('0xb')])+_0xca56('0x10')]=this[_0xca56('0x11')]['id'];if(rpc[this['channel']+_0xca56('0x12')]){return rpc[this[_0xca56('0xb')]+_0xca56('0x12')][_0xca56('0x13')](_0x3366cc)['then'](function(_0xcddbc3){logger['info'](_0xca56('0x14'),_0x1b2815,_0x3366cc[_0xca56('0x15')]);_0x5d2108[_0xca56('0x16')]();})['catch'](function(_0x467442){logger[_0xca56('0x17')](_0xca56('0x14'),_0x1b2815,JSON['stringify'](_0x467442));_0x5d2108['stop']();});}}catch(_0x454320){logger[_0xca56('0x17')](_0xca56('0x14'),_0x1b2815,JSON[_0xca56('0x18')](_0x454320));_0x5d2108['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 4a4894b..96aa86e 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 _0x7f17=['getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','./utils','routing','consequence'];(function(_0x297524,_0x39b73c){var _0x3444a1=function(_0xeea7cc){while(--_0xeea7cc){_0x297524['push'](_0x297524['shift']());}};_0x3444a1(++_0x39b73c);}(_0x7f17,0xbd));var _0x77f1=function(_0x292f35,_0x72e859){_0x292f35=_0x292f35-0x0;var _0x288e75=_0x7f17[_0x292f35];return _0x288e75;};'use strict';var utils=require(_0x77f1('0x0'));var logger=require('../../../../config/logger')(_0x77f1('0x1'));exports[_0x77f1('0x2')]=function(_0x3a1660,_0x579ec5){return function(_0x4c7662){try{logger['info']('[%s][NOOP]\x20%s',_0x3a1660,utils[_0x77f1('0x3')](_0x579ec5[0x0],this));_0x4c7662['next']();}catch(_0x5a1d37){logger[_0x77f1('0x4')](_0x77f1('0x5'),_0x3a1660,JSON[_0x77f1('0x6')](_0x5a1d37));_0x4c7662[_0x77f1('0x7')]();}};}; \ No newline at end of file +var _0x8fce=['../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','./utils'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x8fce,0x1b7));var _0xe8fc=function(_0x4b318e,_0x15fe4f){_0x4b318e=_0x4b318e-0x0;var _0x3b6a2f=_0x8fce[_0x4b318e];return _0x3b6a2f;};'use strict';var utils=require(_0xe8fc('0x0'));var logger=require(_0xe8fc('0x1'))('routing');exports[_0xe8fc('0x2')]=function(_0x5e8689,_0xbe65d5){return function(_0x3d019d){try{logger[_0xe8fc('0x3')](_0xe8fc('0x4'),_0x5e8689,utils[_0xe8fc('0x5')](_0xbe65d5[0x0],this));_0x3d019d['next']();}catch(_0x397c5a){logger[_0xe8fc('0x6')]('[%s][NOOP]\x20%s',_0x5e8689,JSON[_0xe8fc('0x7')](_0x397c5a));_0x3d019d['stop']();}};}; \ 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 358116c..c78c0bb 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 _0x0866=['stop','find','Queues','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','InteractionId','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','update','then','update\x20queue\x20report','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','join'];(function(_0x4b7661,_0x4374a2){var _0x335762=function(_0x1d8744){while(--_0x1d8744){_0x4b7661['push'](_0x4b7661['shift']());}};_0x335762(++_0x4374a2);}(_0x0866,0x1f4));var _0x6086=function(_0x3937fb,_0x3fb0ee){_0x3937fb=_0x3937fb-0x0;var _0x568a9f=_0x0866[_0x3937fb];return _0x568a9f;};'use strict';var schema=require(_0x6086('0x0'));var _=require(_0x6086('0x1'));var util=require(_0x6086('0x2'));var seqqueue=require(_0x6086('0x3'));var moment=require('moment');var Redis=require(_0x6086('0x4'));var config=require(_0x6086('0x5'));var logger=require(_0x6086('0x6'))(_0x6086('0x7'));var strategy=require('./strategy');config[_0x6086('0x8')]=_[_0x6086('0x9')](config[_0x6086('0x8')],{'host':_0x6086('0xa'),'port':0x18eb});var io=require(_0x6086('0xb'))(new Redis(config['redis']));var attributes=['id',_0x6086('0xc'),_0x6086('0xd'),_0x6086('0xe'),_0x6086('0xf'),_0x6086('0x10')];function emit(_0x58d3c8,_0x5f44c2,_0x5c1aea){io['to'](_0x58d3c8)[_0x6086('0x11')](_0x5f44c2,_0x5c1aea);}function emitChannelQueueInteraction(_0x5ce855,_0x39e376,_0x541020,_0x11104a,_0x36a358,_0x14b369,_0x33367c,_0x45147c){var _0x238719=_['clone'](_0x541020);_0x238719[_0x6086('0xc')]=_0x45147c;_0x238719[_0x6086('0xe')]=_0x39e376;_0x238719['account']=_0x11104a;_0x238719['id']=_0x36a358;if(_0x14b369){attributes['push'](_['capitalize'](_0x5ce855)+_0x6086('0x12'));_0x33367c[util[_0x6086('0x13')]('%sQueuesWaitingInteractions',_0x5ce855)][_0x36a358]=_[_0x6086('0x14')](_0x238719,attributes);}else{delete _0x33367c[util['format']('%sQueuesWaitingInteractions',_0x5ce855)][_0x36a358];}emit(util['format'](_0x6086('0x15'),_0x5ce855,_0x39e376),util[_0x6086('0x13')](_0x6086('0x16'),_0x5ce855,_0x14b369?_0x6086('0x17'):'remove'),_[_0x6086('0x14')](_0x238719,attributes));}var rpc={'openchannelQueueReport':require(_0x6086('0x18')),'mailQueueReport':require(_0x6086('0x19')),'chatQueueReport':require(_0x6086('0x1a')),'smsQueueReport':require(_0x6086('0x1b')),'faxQueueReport':require(_0x6086('0x1c')),'whatsappQueueReport':require(_0x6086('0x1d')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x6086('0x1e')),'mailInteraction':require(_0x6086('0x1f')),'openchannelInteraction':require(_0x6086('0x20')),'smsInteraction':require(_0x6086('0x21')),'whatsappInteraction':require(_0x6086('0x22'))};var queue=schema({'name':{'type':_0x6086('0x23'),'required':!![],'message':_0x6086('0x24')},'timeout':{'type':_0x6086('0x25'),'message':_0x6086('0x26')}});function startRouting(_0x2fd7b2,_0x2c52b9,_0x1eedaf,_0x356301){if(_0x2fd7b2&&_0x2c52b9&&_0x1eedaf){_0x2c52b9[_0x6086('0x27')]+=0x1;var _0x5a258a={'uniqueid':_0x2fd7b2,'from':_0x1eedaf[_0x6086('0x28')]?_0x1eedaf[_0x6086('0x28')][_0x6086('0xf')]:'','joinAt':moment()[_0x6086('0x13')](_0x6086('0x29')),'ContactId':_0x1eedaf[_0x6086('0x2a')]?_0x1eedaf[_0x6086('0x2a')]['id']:null,'ListId':_0x1eedaf['list']?_0x1eedaf[_0x6086('0x2b')]['id']:null};_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+_0x6086('0x2e')]=_0x2c52b9['id']||null;_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+'InteractionId']=_0x1eedaf[_0x6086('0x2f')]?_0x1eedaf['interaction']['id']:null;_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+_0x6086('0x30')]=_0x1eedaf[_0x6086('0x31')]?_0x1eedaf[_0x6086('0x31')]['id']:null;_0x5a258a[_[_0x6086('0x2c')](_0x1eedaf[_0x6086('0x2d')])+(_0x1eedaf['channel']!=='chat'?'AccountId':_0x6086('0x32'))]=_0x1eedaf['account']?_0x1eedaf[_0x6086('0xd')]['id']:null;logger[_0x6086('0x33')](util['format'](_0x6086('0x34'),_0x2fd7b2,_0x2c52b9['name']));emitChannelQueueInteraction(_0x1eedaf[_0x6086('0x2d')],_0x2c52b9[_0x6086('0x35')],_0x5a258a,_0x1eedaf[_0x6086('0xd')]['name'],_0x1eedaf['message']['id'],!![],_0x356301,_0x2c52b9['id']);if(rpc[_0x1eedaf[_0x6086('0x2d')]+_0x6086('0x36')]){return rpc[_0x1eedaf[_0x6086('0x2d')]+_0x6086('0x36')][_0x6086('0x37')](_0x5a258a)[_0x6086('0x38')](function(_0x1790d2){logger[_0x6086('0x39')](_0x6086('0x3a'),_0x1790d2);});}}}function stopRouting(_0x561807,_0x3edfa4,_0x4d00ef,_0xa9413a){if(_0x561807&&_0x3edfa4){_0x3edfa4[_0x6086('0x27')]-=0x1;var _0x5e97eb={'leaveAt':moment()[_0x6086('0x13')](_0x6086('0x29')),'acceptAt':moment()['format'](_0x6086('0x29')),'reason':'accepted'};logger[_0x6086('0x33')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x561807,_0x3edfa4[_0x6086('0x35')]));emitChannelQueueInteraction(_0x4d00ef[_0x6086('0x2d')],_0x3edfa4['name'],_0x4d00ef[_0x6086('0x28')],_0x4d00ef[_0x6086('0xd')][_0x6086('0x35')],_0x4d00ef['message']['id'],![],_0xa9413a,_0x3edfa4['id']);return rpc[_0x4d00ef[_0x6086('0x2d')]+'Interaction'][_0x6086('0x3b')](_0x4d00ef[_0x6086('0x2f')]['id'],{'queueId':_0x3edfa4['id']})[_0x6086('0x3c')](function(){if(rpc[_0x4d00ef[_0x6086('0x2d')]+_0x6086('0x36')]){return rpc[_0x4d00ef['channel']+_0x6086('0x36')][_0x6086('0x3b')](_0x561807,_0x5e97eb)['catch'](function(_0x91b03c){logger[_0x6086('0x39')](_0x6086('0x3d'),_0x91b03c);});}});}}function endRouting(_0x1bebf9,_0x5bce5d,_0x3b4310,_0x18e372){if(_0x1bebf9&&_0x5bce5d){_0x5bce5d['waiting']-=0x1;var _0x5d0c3b={'leaveAt':moment()[_0x6086('0x13')](_0x6086('0x29')),'exitAt':moment()[_0x6086('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6086('0x3e')};logger['info'](util['format']('[%s][END:QUEUE][NAME:%s]',_0x1bebf9,_0x5bce5d['name']));emitChannelQueueInteraction(_0x3b4310[_0x6086('0x2d')],_0x5bce5d[_0x6086('0x35')],_0x3b4310[_0x6086('0x28')],_0x3b4310[_0x6086('0xd')][_0x6086('0x35')],_0x3b4310[_0x6086('0x31')]['id'],![],_0x18e372);if(rpc[_0x3b4310[_0x6086('0x2d')]+_0x6086('0x36')]){return rpc[_0x3b4310[_0x6086('0x2d')]+'QueueReport'][_0x6086('0x3b')](_0x1bebf9,_0x5d0c3b)[_0x6086('0x38')](function(_0x11d5ae){logger[_0x6086('0x39')](_0x6086('0x3d'),_0x11d5ae);});}}}function handleFindQueue(_0x27c6a2){return function(_0x2ea47e){return _0x2ea47e['name'][_0x6086('0x3f')]()===_0x27c6a2[_0x6086('0x3f')]();};}exports[_0x6086('0x40')]=function(_0x3e14d9,_0x30a207,_0x158a63,_0x592c79){return function(_0x321483){try{var _0x418e32={'name':_0x30a207[0x0],'timeout':_0x30a207[0x1]};var _0x1e1668=queue[_0x6086('0x0')](_0x418e32,{'typecast':!![]});if(_0x1e1668['length']){logger[_0x6086('0x39')](_0x6086('0x41'),_0x3e14d9,_['map'](_0x1e1668,_0x6086('0x31'))[_0x6086('0x42')](',\x20'));_0x321483[_0x6086('0x43')]();}else{var _0x1c7ee5=_[_0x6086('0x44')](_0x158a63[_0x592c79[_0x6086('0x2d')]+_0x6086('0x45')],handleFindQueue(_0x418e32[_0x6086('0x35')]));if(_0x1c7ee5){startRouting(_0x3e14d9,_0x1c7ee5,_0x592c79,_0x158a63);var _0x4b1dec=(_0x1c7ee5['timeout']||0xa)*0x3e8;var _0x18354a=(_0x418e32['timeout']||0x14)*0x3e8;var _0x43a77e;if(_0x4b1dec>_0x18354a){_0x18354a=_0x4b1dec;}var _0x11ed88=seqqueue['createQueue'](_0x4b1dec);_0x11ed88['id']=_0x3e14d9;_0x11ed88['atimeout']=_0x4b1dec;_0x11ed88['qtimeout']=_0x18354a;_0x11ed88[_0x6086('0x2d')]=_0x592c79[_0x6086('0x2d')];_0x158a63[_0x6086('0x46')][_0x3e14d9]['on'](_0x6086('0x47'),function(){logger[_0x6086('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3e14d9);stopRouting(_0x3e14d9,_0x1c7ee5,_0x592c79,_0x158a63);clearTimeout(_0x43a77e);_0x43a77e=undefined;_0x11ed88['close'](!![]);if(_0x158a63[_0x6086('0x46')][_0x3e14d9]){delete _0x158a63[_0x6086('0x46')][_0x3e14d9];}_0x321483[_0x6086('0x43')]();});_0x158a63['rules'][_0x3e14d9]['on'](_0x6086('0x48'),function(){if(_0x158a63['rules'][_0x3e14d9]){delete _0x158a63['rules'][_0x3e14d9];}});_0x43a77e=setTimeout(function(){logger['info'](_0x6086('0x49'),_0x3e14d9);endRouting(_0x3e14d9,_0x1c7ee5,_0x592c79,_0x158a63);clearTimeout(_0x43a77e);_0x11ed88[_0x6086('0x4a')](!![]);_0x321483[_0x6086('0x4b')]();},_0x18354a);switch(_0x1c7ee5[_0x6086('0x4c')]){case _0x6086('0x4d'):strategy[_0x6086('0x4d')](_0x11ed88,_0x1c7ee5,_0x158a63,_0x592c79);break;default:strategy[_0x6086('0x4e')](_0x11ed88,_0x1c7ee5,_0x158a63,_0x592c79);}}else{logger[_0x6086('0x39')](_0x6086('0x4f'),_0x3e14d9,_0x418e32['name']);_0x321483[_0x6086('0x43')]();}}}catch(_0x5ec384){logger[_0x6086('0x39')](_0x6086('0x41'),_0x3e14d9,_0x5ec384[_0x6086('0x50')]);_0x321483[_0x6086('0x43')]();}};}; \ No newline at end of file +var _0x4cb1=['push','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','from','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','Interaction','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','stop','find','Queues','timeout','createQueue','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit'];(function(_0x980038,_0x543c9b){var _0x34ee15=function(_0xf1c006){while(--_0xf1c006){_0x980038['push'](_0x980038['shift']());}};_0x34ee15(++_0x543c9b);}(_0x4cb1,0x144));var _0x14cb=function(_0x949b8f,_0x141f2d){_0x949b8f=_0x949b8f-0x0;var _0x20e3d6=_0x4cb1[_0x949b8f];return _0x20e3d6;};'use strict';var schema=require('validate');var _=require(_0x14cb('0x0'));var util=require(_0x14cb('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x14cb('0x2'));var Redis=require(_0x14cb('0x3'));var config=require(_0x14cb('0x4'));var logger=require(_0x14cb('0x5'))('routing');var strategy=require(_0x14cb('0x6'));config[_0x14cb('0x7')]=_[_0x14cb('0x8')](config['redis'],{'host':_0x14cb('0x9'),'port':0x18eb});var io=require(_0x14cb('0xa'))(new Redis(config[_0x14cb('0x7')]));var attributes=['id',_0x14cb('0xb'),_0x14cb('0xc'),_0x14cb('0xd'),'from',_0x14cb('0xe')];function emit(_0x1cddfd,_0x45f27b,_0x17a7a9){io['to'](_0x1cddfd)[_0x14cb('0xf')](_0x45f27b,_0x17a7a9);}function emitChannelQueueInteraction(_0x4dce62,_0x3e3a50,_0x3c6b3f,_0x18fa97,_0x3d2c34,_0x2c46b0,_0x5e0ac3,_0x483b18){var _0x3e0e93=_['clone'](_0x3c6b3f);_0x3e0e93[_0x14cb('0xb')]=_0x483b18;_0x3e0e93[_0x14cb('0xd')]=_0x3e3a50;_0x3e0e93[_0x14cb('0xc')]=_0x18fa97;_0x3e0e93['id']=_0x3d2c34;if(_0x2c46b0){attributes[_0x14cb('0x10')](_['capitalize'](_0x4dce62)+'InteractionId');_0x5e0ac3[util['format']('%sQueuesWaitingInteractions',_0x4dce62)][_0x3d2c34]=_[_0x14cb('0x11')](_0x3e0e93,attributes);}else{delete _0x5e0ac3[util[_0x14cb('0x12')](_0x14cb('0x13'),_0x4dce62)][_0x3d2c34];}emit(util['format'](_0x14cb('0x14'),_0x4dce62,_0x3e3a50),util['format']('%s_queue_waiting_interaction:%s',_0x4dce62,_0x2c46b0?_0x14cb('0x15'):_0x14cb('0x16')),_['pick'](_0x3e0e93,attributes));}var rpc={'openchannelQueueReport':require(_0x14cb('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x14cb('0x18')),'smsQueueReport':require(_0x14cb('0x19')),'faxQueueReport':require(_0x14cb('0x1a')),'whatsappQueueReport':require(_0x14cb('0x1b')),'chatInteraction':require(_0x14cb('0x1c')),'faxInteraction':require(_0x14cb('0x1d')),'mailInteraction':require(_0x14cb('0x1e')),'openchannelInteraction':require(_0x14cb('0x1f')),'smsInteraction':require(_0x14cb('0x20')),'whatsappInteraction':require(_0x14cb('0x21'))};var queue=schema({'name':{'type':_0x14cb('0x22'),'required':!![],'message':_0x14cb('0x23')},'timeout':{'type':_0x14cb('0x24'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x1df53b,_0x2618b5,_0x5c4cef,_0x56f646){if(_0x1df53b&&_0x2618b5&&_0x5c4cef){_0x2618b5[_0x14cb('0x25')]+=0x1;var _0xde6886={'uniqueid':_0x1df53b,'from':_0x5c4cef[_0x14cb('0x26')]?_0x5c4cef[_0x14cb('0x26')][_0x14cb('0x27')]:'','joinAt':moment()[_0x14cb('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c4cef['contact']?_0x5c4cef[_0x14cb('0x28')]['id']:null,'ListId':_0x5c4cef['list']?_0x5c4cef[_0x14cb('0x29')]['id']:null};_0xde6886[_[_0x14cb('0x2a')](_0x5c4cef['channel'])+_0x14cb('0x2b')]=_0x2618b5['id']||null;_0xde6886[_[_0x14cb('0x2a')](_0x5c4cef[_0x14cb('0x2c')])+_0x14cb('0x2d')]=_0x5c4cef['interaction']?_0x5c4cef[_0x14cb('0x2e')]['id']:null;_0xde6886[_[_0x14cb('0x2a')](_0x5c4cef['channel'])+_0x14cb('0x2f')]=_0x5c4cef[_0x14cb('0x30')]?_0x5c4cef[_0x14cb('0x30')]['id']:null;_0xde6886[_[_0x14cb('0x2a')](_0x5c4cef[_0x14cb('0x2c')])+(_0x5c4cef['channel']!==_0x14cb('0x31')?_0x14cb('0x32'):_0x14cb('0x33'))]=_0x5c4cef[_0x14cb('0xc')]?_0x5c4cef[_0x14cb('0xc')]['id']:null;logger[_0x14cb('0x34')](util[_0x14cb('0x12')](_0x14cb('0x35'),_0x1df53b,_0x2618b5[_0x14cb('0x36')]));emitChannelQueueInteraction(_0x5c4cef[_0x14cb('0x2c')],_0x2618b5[_0x14cb('0x36')],_0xde6886,_0x5c4cef['account']['name'],_0x5c4cef[_0x14cb('0x30')]['id'],!![],_0x56f646,_0x2618b5['id']);if(rpc[_0x5c4cef[_0x14cb('0x2c')]+'QueueReport']){return rpc[_0x5c4cef['channel']+_0x14cb('0x37')][_0x14cb('0x38')](_0xde6886)[_0x14cb('0x39')](function(_0x548a5b){logger[_0x14cb('0x3a')]('create\x20queue\x20report',_0x548a5b);});}}}function stopRouting(_0xc49d1a,_0x4c7fbf,_0x2e903a,_0x535429){if(_0xc49d1a&&_0x4c7fbf){_0x4c7fbf[_0x14cb('0x25')]-=0x1;var _0x3eb734={'leaveAt':moment()[_0x14cb('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x14cb('0x12')](_0x14cb('0x3b')),'reason':_0x14cb('0x3c')};logger[_0x14cb('0x34')](util[_0x14cb('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0xc49d1a,_0x4c7fbf[_0x14cb('0x36')]));emitChannelQueueInteraction(_0x2e903a[_0x14cb('0x2c')],_0x4c7fbf[_0x14cb('0x36')],_0x2e903a[_0x14cb('0x26')],_0x2e903a['account']['name'],_0x2e903a[_0x14cb('0x30')]['id'],![],_0x535429,_0x4c7fbf['id']);return rpc[_0x2e903a[_0x14cb('0x2c')]+_0x14cb('0x3d')][_0x14cb('0x3e')](_0x2e903a[_0x14cb('0x2e')]['id'],{'queueId':_0x4c7fbf['id']})['then'](function(){if(rpc[_0x2e903a['channel']+_0x14cb('0x37')]){return rpc[_0x2e903a[_0x14cb('0x2c')]+_0x14cb('0x37')][_0x14cb('0x3e')](_0xc49d1a,_0x3eb734)[_0x14cb('0x39')](function(_0xe3d7d3){logger[_0x14cb('0x3a')](_0x14cb('0x3f'),_0xe3d7d3);});}});}}function endRouting(_0x5fba5,_0x8866ae,_0x42d961,_0xb47ce3){if(_0x5fba5&&_0x8866ae){_0x8866ae[_0x14cb('0x25')]-=0x1;var _0x32fe6c={'leaveAt':moment()['format'](_0x14cb('0x3b')),'exitAt':moment()['format'](_0x14cb('0x3b')),'reason':'timeout'};logger[_0x14cb('0x34')](util[_0x14cb('0x12')](_0x14cb('0x40'),_0x5fba5,_0x8866ae[_0x14cb('0x36')]));emitChannelQueueInteraction(_0x42d961[_0x14cb('0x2c')],_0x8866ae['name'],_0x42d961[_0x14cb('0x26')],_0x42d961['account']['name'],_0x42d961[_0x14cb('0x30')]['id'],![],_0xb47ce3);if(rpc[_0x42d961[_0x14cb('0x2c')]+_0x14cb('0x37')]){return rpc[_0x42d961[_0x14cb('0x2c')]+_0x14cb('0x37')]['update'](_0x5fba5,_0x32fe6c)['catch'](function(_0x31a576){logger[_0x14cb('0x3a')](_0x14cb('0x3f'),_0x31a576);});}}}function handleFindQueue(_0x272991){return function(_0x6b418c){return _0x6b418c[_0x14cb('0x36')][_0x14cb('0x41')]()===_0x272991[_0x14cb('0x41')]();};}exports[_0x14cb('0x42')]=function(_0x42128b,_0x38e774,_0x1dee5d,_0x972dfe){return function(_0x108dca){try{var _0x966cc5={'name':_0x38e774[0x0],'timeout':_0x38e774[0x1]};var _0x434414=queue[_0x14cb('0x43')](_0x966cc5,{'typecast':!![]});if(_0x434414['length']){logger['error'](_0x14cb('0x44'),_0x42128b,_[_0x14cb('0x45')](_0x434414,_0x14cb('0x30'))['join'](',\x20'));_0x108dca[_0x14cb('0x46')]();}else{var _0x1e9f60=_[_0x14cb('0x47')](_0x1dee5d[_0x972dfe[_0x14cb('0x2c')]+_0x14cb('0x48')],handleFindQueue(_0x966cc5[_0x14cb('0x36')]));if(_0x1e9f60){startRouting(_0x42128b,_0x1e9f60,_0x972dfe,_0x1dee5d);var _0x2e55b9=(_0x1e9f60[_0x14cb('0x49')]||0xa)*0x3e8;var _0xd82eed=(_0x966cc5[_0x14cb('0x49')]||0x14)*0x3e8;var _0x129a35;if(_0x2e55b9>_0xd82eed){_0xd82eed=_0x2e55b9;}var _0x3cb655=seqqueue[_0x14cb('0x4a')](_0x2e55b9);_0x3cb655['id']=_0x42128b;_0x3cb655[_0x14cb('0x4b')]=_0x2e55b9;_0x3cb655['qtimeout']=_0xd82eed;_0x3cb655[_0x14cb('0x2c')]=_0x972dfe['channel'];_0x1dee5d[_0x14cb('0x4c')][_0x42128b]['on']('end',function(){logger[_0x14cb('0x34')](_0x14cb('0x4d'),_0x42128b);stopRouting(_0x42128b,_0x1e9f60,_0x972dfe,_0x1dee5d);clearTimeout(_0x129a35);_0x129a35=undefined;_0x3cb655[_0x14cb('0x4e')](!![]);if(_0x1dee5d[_0x14cb('0x4c')][_0x42128b]){delete _0x1dee5d['rules'][_0x42128b];}_0x108dca[_0x14cb('0x46')]();});_0x1dee5d[_0x14cb('0x4c')][_0x42128b]['on']('complete',function(){if(_0x1dee5d['rules'][_0x42128b]){delete _0x1dee5d['rules'][_0x42128b];}});_0x129a35=setTimeout(function(){logger['info'](_0x14cb('0x4f'),_0x42128b);endRouting(_0x42128b,_0x1e9f60,_0x972dfe,_0x1dee5d);clearTimeout(_0x129a35);_0x3cb655[_0x14cb('0x4e')](!![]);_0x108dca[_0x14cb('0x50')]();},_0xd82eed);switch(_0x1e9f60[_0x14cb('0x51')]){case _0x14cb('0x52'):strategy[_0x14cb('0x52')](_0x3cb655,_0x1e9f60,_0x1dee5d,_0x972dfe);break;default:strategy[_0x14cb('0x53')](_0x3cb655,_0x1e9f60,_0x1dee5d,_0x972dfe);}}else{logger[_0x14cb('0x3a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x42128b,_0x966cc5[_0x14cb('0x36')]);_0x108dca['stop']();}}}catch(_0x54f17c){logger['error'](_0x14cb('0x44'),_0x42128b,_0x54f17c[_0x14cb('0x54')]);_0x108dca[_0x14cb('0x46')]();}};}; \ 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 bc4f38c..9650909 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 _0x9b9b=['hideNotification','busyQueue','removeWaitingNotification','writeLog','STOP','exports','uuid','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','channel','busy','saveWaitingNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x473a29,_0x2cd27c){var _0x1a17a0=function(_0x1cfcd6){while(--_0x1cfcd6){_0x473a29['push'](_0x473a29['shift']());}};_0x1a17a0(++_0x2cd27c);}(_0x9b9b,0x114));var _0xb9b9=function(_0x5d660b,_0x2b6023){_0x5d660b=_0x5d660b-0x0;var _0x29263a=_0x9b9b[_0x5d660b];return _0x29263a;};'use strict';var _=require('lodash');var uuid=require(_0xb9b9('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xb9b9('0x1'));var Agent=function(_0x153734,_0x1adf50,_0x1f6fea,_0x1d6ab6){this[_0xb9b9('0x2')]=uuid['v4']();this[_0xb9b9('0x3')]=_0x153734;this[_0xb9b9('0x4')]=_0x1adf50;this[_0xb9b9('0x5')]=_0x1f6fea;this[_0xb9b9('0x1')]=_0x1d6ab6;this[_0xb9b9('0x3')][_0xb9b9('0x6')](this[_0xb9b9('0x7')][_0xb9b9('0x8')](this),this[_0xb9b9('0x9')][_0xb9b9('0x8')](this));this['squeue']['on']('timeout',this[_0xb9b9('0x9')][_0xb9b9('0x8')](this));this[_0xb9b9('0x3')]['on']('drained',this[_0xb9b9('0xa')][_0xb9b9('0x8')](this));};Agent[_0xb9b9('0xb')]['push']=function(){this[_0xb9b9('0x3')][_0xb9b9('0x6')](this[_0xb9b9('0x7')][_0xb9b9('0x8')](this),this[_0xb9b9('0x9')][_0xb9b9('0x8')](this));};Agent['prototype']['handleDrained']=function(){this[_0xb9b9('0x9')](!![]);};Agent['prototype'][_0xb9b9('0x7')]=function(){logger['debug'](_0xb9b9('0xc'),this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x4')]['id']);if(_[_0xb9b9('0xd')](this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']])){logger[_0xb9b9('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb9b9('0x3')]['id'],this['agent']['id']);setTimeout(this[_0xb9b9('0x6')][_0xb9b9('0x8')](this),0x3e8);}else{if(this[_0xb9b9('0x1')][_0xb9b9('0x10')]||util['isAgentAvailable'](this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']],this[_0xb9b9('0x3')][_0xb9b9('0x11')],![])){this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']][_0xb9b9('0x12')]=!![];this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']]['busyQueue']=undefined;util[_0xb9b9('0x13')](this[_0xb9b9('0x5')],this[_0xb9b9('0x1')],this['agent'],this[_0xb9b9('0x3')][_0xb9b9('0x11')]);util['showNotification'](this[_0xb9b9('0x2')],this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']],null,this['routing']);util['writeLog'](this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')]['agents'][this[_0xb9b9('0x4')]['id']],_0xb9b9('0x14')+(this[_0xb9b9('0x1')][_0xb9b9('0x10')]?_0xb9b9('0x15'):''));}else{logger['debug'](_0xb9b9('0x16'),this['squeue']['id'],this[_0xb9b9('0x4')]['id']);setTimeout(this[_0xb9b9('0x6')]['bind'](this),0x3e8);}}};Agent[_0xb9b9('0xb')][_0xb9b9('0x9')]=function(_0x17a6f6){if(_['isNil'](this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']])){return logger[_0xb9b9('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x4')]['id']);}else{logger['debug'](_0xb9b9('0x17'),this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x4')]['id']);util[_0xb9b9('0x18')](this['notificationId'],this[_0xb9b9('0x3')]['id'],this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']],null,this['routing']);this[_0xb9b9('0x5')][_0xb9b9('0xe')][this['agent']['id']][_0xb9b9('0x12')]=![];this[_0xb9b9('0x5')][_0xb9b9('0xe')][this[_0xb9b9('0x4')]['id']][_0xb9b9('0x19')]=undefined;util[_0xb9b9('0x1a')](this['realtime'],this[_0xb9b9('0x1')],this[_0xb9b9('0x4')],this['squeue'][_0xb9b9('0x11')]);util[_0xb9b9('0x1b')](this[_0xb9b9('0x3')]['id'],this['realtime'][_0xb9b9('0xe')][this['agent']['id']],_0x17a6f6?_0xb9b9('0x1c'):'TIMEOUT');}if(!_0x17a6f6){setTimeout(this[_0xb9b9('0x6')][_0xb9b9('0x8')](this),0x3e8);}};function agent(_0x22b567,_0x1f1faf,_0x3dd3fe,_0x76f4d4){return new Agent(_0x22b567,_0x1f1faf,_0x3dd3fe,_0x76f4d4);}module[_0xb9b9('0x1d')]=agent; \ No newline at end of file +var _0xcca7=['busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel'];(function(_0x803a97,_0x4cbf73){var _0x4de619=function(_0x540dc8){while(--_0x540dc8){_0x803a97['push'](_0x803a97['shift']());}};_0x4de619(++_0x4cbf73);}(_0xcca7,0x1aa));var _0x7cca=function(_0x3c1b09,_0x2f3a4c){_0x3c1b09=_0x3c1b09-0x0;var _0x2e9c72=_0xcca7[_0x3c1b09];return _0x2e9c72;};'use strict';var _=require(_0x7cca('0x0'));var uuid=require(_0x7cca('0x1'));var util=require(_0x7cca('0x2'));var logger=require(_0x7cca('0x3'))('routing');var Agent=function(_0x4c311e,_0x30823f,_0x533b00,_0x3b86a4){this[_0x7cca('0x4')]=uuid['v4']();this[_0x7cca('0x5')]=_0x4c311e;this[_0x7cca('0x6')]=_0x30823f;this[_0x7cca('0x7')]=_0x533b00;this[_0x7cca('0x8')]=_0x3b86a4;this['squeue']['push'](this[_0x7cca('0x9')][_0x7cca('0xa')](this),this[_0x7cca('0xb')][_0x7cca('0xa')](this));this[_0x7cca('0x5')]['on'](_0x7cca('0xc'),this[_0x7cca('0xb')][_0x7cca('0xa')](this));this[_0x7cca('0x5')]['on'](_0x7cca('0xd'),this['handleDrained'][_0x7cca('0xa')](this));};Agent[_0x7cca('0xe')][_0x7cca('0xf')]=function(){this[_0x7cca('0x5')][_0x7cca('0xf')](this['handleRun'][_0x7cca('0xa')](this),this[_0x7cca('0xb')][_0x7cca('0xa')](this));};Agent['prototype']['handleDrained']=function(){this[_0x7cca('0xb')](!![]);};Agent[_0x7cca('0xe')][_0x7cca('0x9')]=function(){logger[_0x7cca('0x10')](_0x7cca('0x11'),this[_0x7cca('0x5')]['id'],this[_0x7cca('0x6')]['id']);if(_['isNil'](this[_0x7cca('0x7')]['agents'][this['agent']['id']])){logger['debug'](_0x7cca('0x12'),this[_0x7cca('0x5')]['id'],this[_0x7cca('0x6')]['id']);setTimeout(this[_0x7cca('0xf')][_0x7cca('0xa')](this),0x3e8);}else{if(this['routing'][_0x7cca('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0x7cca('0x14')][this[_0x7cca('0x6')]['id']],this[_0x7cca('0x5')][_0x7cca('0x15')],![])){this[_0x7cca('0x7')][_0x7cca('0x14')][this[_0x7cca('0x6')]['id']][_0x7cca('0x16')]=!![];this['realtime'][_0x7cca('0x14')][this[_0x7cca('0x6')]['id']][_0x7cca('0x17')]=undefined;util[_0x7cca('0x18')](this['realtime'],this[_0x7cca('0x8')],this[_0x7cca('0x6')],this[_0x7cca('0x5')][_0x7cca('0x15')]);util[_0x7cca('0x19')](this[_0x7cca('0x4')],this[_0x7cca('0x5')]['id'],this[_0x7cca('0x7')]['agents'][this[_0x7cca('0x6')]['id']],null,this[_0x7cca('0x8')]);util[_0x7cca('0x1a')](this[_0x7cca('0x5')]['id'],this[_0x7cca('0x7')][_0x7cca('0x14')][this[_0x7cca('0x6')]['id']],_0x7cca('0x1b')+(this['routing'][_0x7cca('0x13')]?':FORCED':''));}else{logger[_0x7cca('0x10')](_0x7cca('0x1c'),this['squeue']['id'],this[_0x7cca('0x6')]['id']);setTimeout(this[_0x7cca('0xf')]['bind'](this),0x3e8);}}};Agent[_0x7cca('0xe')][_0x7cca('0xb')]=function(_0x100061){if(_['isNil'](this['realtime'][_0x7cca('0x14')][this[_0x7cca('0x6')]['id']])){return logger[_0x7cca('0x10')](_0x7cca('0x12'),this[_0x7cca('0x5')]['id'],this[_0x7cca('0x6')]['id']);}else{logger[_0x7cca('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x7cca('0x6')]['id']);util[_0x7cca('0x1d')](this[_0x7cca('0x4')],this['squeue']['id'],this[_0x7cca('0x7')]['agents'][this[_0x7cca('0x6')]['id']],null,this[_0x7cca('0x8')]);this[_0x7cca('0x7')][_0x7cca('0x14')][this['agent']['id']][_0x7cca('0x16')]=![];this[_0x7cca('0x7')][_0x7cca('0x14')][this['agent']['id']]['busyQueue']=undefined;util['removeWaitingNotification'](this[_0x7cca('0x7')],this[_0x7cca('0x8')],this['agent'],this[_0x7cca('0x5')][_0x7cca('0x15')]);util[_0x7cca('0x1a')](this[_0x7cca('0x5')]['id'],this[_0x7cca('0x7')][_0x7cca('0x14')][this[_0x7cca('0x6')]['id']],_0x100061?'STOP':_0x7cca('0x1e'));}if(!_0x100061){setTimeout(this[_0x7cca('0xf')][_0x7cca('0xa')](this),0x3e8);}};function agent(_0x147cf8,_0x4f28ac,_0x213e4f,_0x387287){return new Agent(_0x147cf8,_0x4f28ac,_0x213e4f,_0x387287);}module[_0x7cca('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 6aacee0..7c221de 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 _0x5725=['push','prototype','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','agents','RINGING','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busyQueue','exports','lodash','uuid','./util','notificationId','squeue','queue','realtime','routing','handleRun','bind','handleTimeout','drained'];(function(_0x49d9f6,_0x1ba179){var _0x40e9b7=function(_0x35a8bd){while(--_0x35a8bd){_0x49d9f6['push'](_0x49d9f6['shift']());}};_0x40e9b7(++_0x1ba179);}(_0x5725,0x1d0));var _0x5572=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5725[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x5572('0x0'));var uuid=require(_0x5572('0x1'));var util=require(_0x5572('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x5036be,_0x2d0c4f,_0x5ea693,_0x30ae58){this[_0x5572('0x3')]=uuid['v4']();this[_0x5572('0x4')]=_0x5036be;this[_0x5572('0x5')]=_0x2d0c4f;this[_0x5572('0x6')]=_0x5ea693;this[_0x5572('0x7')]=_0x30ae58;this[_0x5572('0x4')]['push'](this[_0x5572('0x8')][_0x5572('0x9')](this),this[_0x5572('0xa')]['bind'](this));this['squeue']['on']('timeout',this[_0x5572('0xa')][_0x5572('0x9')](this));this['squeue']['on'](_0x5572('0xb'),this['handleDrained'][_0x5572('0x9')](this));};Beepall['prototype']['push']=function(){this['squeue'][_0x5572('0xc')](this[_0x5572('0x8')][_0x5572('0x9')](this),this[_0x5572('0xa')]['bind'](this));};Beepall['prototype']['handleDrained']=function(){this[_0x5572('0xa')](!![]);};Beepall[_0x5572('0xd')][_0x5572('0x8')]=function(){var _0x1a6616=!![];if(!_[_0x5572('0xe')](this['queue'])&&!_[_0x5572('0xe')](this['queue'][_0x5572('0xf')])&&this['queue'][_0x5572('0xf')]['length']>0x0){for(var _0x142451=0x0,_0x4cd5b5;_0x1424510x0){for(var _0xa9ec89=0x0,_0x885b4b;_0xa9ec890x0&&_0x1925cd[_0x408d12+'CurrentCapacity']>=_0x1925cd[_0x408d12+_0xea1a('0x22')]){writeLog(_0x2cc04a,_0x1925cd,_0x408d12[_0xea1a('0x23')]()+_0xea1a('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x514e4d,_0x34e8f8,_0x29dc15,_0x579cd5,_0xd839b0){return sendNotification(!![],_0x514e4d,_0x34e8f8,_0x29dc15,_0x579cd5,_0xd839b0);};exports[_0xea1a('0x25')]=function(_0x2c4279,_0x20c878,_0x5cf6b8,_0x103021,_0x457a10){return sendNotification(![],_0x2c4279,_0x20c878,_0x5cf6b8,_0x103021,_0x457a10);};exports['checkWaitingNotifications']=function(_0x414a25,_0x4f900f,_0x577e92){var _0x1c655c=_0x4f900f[_0xea1a('0x26')][_0xea1a('0x27')];if(!_0x1c655c&&_0x577e92){_0x1c655c=_0x577e92['id'];}var _0x4f6a56=_[_0xea1a('0x28')](_0x414a25[_0x4f900f[_0xea1a('0x29')]+_0xea1a('0x2a')],function(_0x5ce00a){var _0x1075a4=_[_0xea1a('0x2b')](_0x4f900f[_0xea1a('0x29')])+'InteractionId';return _0x5ce00a[_0x1075a4]===_0x4f900f[_0xea1a('0x26')]['id'];});if(!_0x4f6a56&&_0x1c655c&&_0x414a25[_0xea1a('0x2c')][_0x1c655c]){_0x4f6a56=_[_0xea1a('0x28')](_0x414a25[_0xea1a('0x2c')][_0x1c655c][_0x4f900f[_0xea1a('0x29')]+_0xea1a('0x2d')],function(_0x2a792d){return _0x2a792d['id']===_0x4f900f[_0xea1a('0x26')]['id'];});}return _0x4f6a56;};exports[_0xea1a('0x2e')]=function(_0x2dafb2,_0x1c793f,_0x45b008,_0x5a823e){if(_0x45b008&&_0x45b008['id']&&_0x2dafb2[_0xea1a('0x2c')]&&_0x2dafb2['agents'][_0x45b008['id']]){_0x2dafb2['agents'][_0x45b008['id']][_0x5a823e+_0xea1a('0x2d')][_0x1c793f[_0xea1a('0x15')]['id']]={'id':_0x1c793f[_0xea1a('0x26')]['id']};}};exports[_0xea1a('0x2f')]=function(_0x2b63d8,_0x663623,_0x1508e9,_0x575bc8){if(_0x1508e9&&_0x1508e9['id']&&_0x2b63d8[_0xea1a('0x2c')]&&_0x2b63d8[_0xea1a('0x2c')][_0x1508e9['id']]){delete _0x2b63d8[_0xea1a('0x2c')][_0x1508e9['id']][_0x575bc8+_0xea1a('0x2d')][_0x663623[_0xea1a('0x15')]['id']];}};exports[_0xea1a('0x30')]=writeLog; \ No newline at end of file +var _0xed3c=['online','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','emit','format','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable'];(function(_0x4f9e63,_0x4d6bf9){var _0x2dfd77=function(_0xfe67e4){while(--_0xfe67e4){_0x4f9e63['push'](_0x4f9e63['shift']());}};_0x2dfd77(++_0x4d6bf9);}(_0xed3c,0x1a6));var _0xced3=function(_0x54d486,_0x193223){_0x54d486=_0x54d486-0x0;var _0x3a639e=_0xed3c[_0x54d486];return _0x3a639e;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var utils=require(_0xced3('0x2'));var Redis=require(_0xced3('0x3'));var config=require('../../../../../config/environment');var logger=require(_0xced3('0x4'))(_0xced3('0x5'));config[_0xced3('0x6')]=_['defaults'](config['redis'],{'host':_0xced3('0x7'),'port':0x18eb});var io=require(_0xced3('0x8'))(new Redis(config[_0xced3('0x6')]));function sendNotification(_0x1cd694,_0x4795cd,_0x510164,_0x5ca701,_0x851bd3,_0x5f2f90){var _0x5bc7a7=_0x5f2f90||{};var _0x4be020=_0x510164[_0xced3('0x9')]('.');var _0x321c42={'uniqueid':_0x4795cd,'channel':_0x4be020[0x0],'id':_0x4be020[0x1],'title':_0x4be020[0x0]+_0xced3('0xa'),'interactionId':_0x4be020[0x2],'queue':_0x851bd3?_0x851bd3[_0xced3('0xb')]:null,'sound':_0x5bc7a7[_0xced3('0xc')]['notificationSound'],'shake':_0x5bc7a7[_0xced3('0xc')][_0xced3('0xd')]};try{if(!_0x5bc7a7[_0xced3('0xe')]){_0x5bc7a7['body']={};}if(_0x851bd3){_0x5bc7a7[_0xced3('0xe')][_0xced3('0xf')]=_0x851bd3;}else if(_0x5bc7a7[_0xced3('0xe')][_0xced3('0xf')]){delete _0x5bc7a7[_0xced3('0xe')][_0xced3('0xf')];}_0x321c42[_0xced3('0x10')]=utils['getMustacheRender'](_0x5bc7a7[_0xced3('0xc')]['notificationTemplate'],_0x5bc7a7);}catch(_0xf2db6f){_0x321c42[_0xced3('0x10')]=_0xced3('0x11');logger[_0xced3('0x12')](util['format'](_0xced3('0x13'),_0x4795cd,_0xf2db6f[_0xced3('0x14')]));}io['to'](util['format'](_0xced3('0x15'),_0x5ca701[_0xced3('0xb')]))[_0xced3('0x16')](util[_0xced3('0x17')]('notification:%s',_0x1cd694?_0xced3('0x18'):'remove'),_0x321c42);}function writeLog(_0x353580,_0x4480a6,_0x32c402){return logger[_0xced3('0x19')](util[_0xced3('0x17')](_0xced3('0x1a'),_0x353580,_0x4480a6[_0xced3('0xb')],_0x32c402));}exports[_0xced3('0x1b')]=function(_0x3f688c,_0x17c011,_0x2008f2,_0x59dc83){if(_0x17c011['busy']){writeLog(_0x3f688c,_0x17c011,'BUSY');return![];}if(!_0x17c011[_0xced3('0x1c')]){writeLog(_0x3f688c,_0x17c011,_0xced3('0x1d'));return![];}if(_0x17c011[_0x2008f2+_0xced3('0x1e')]){writeLog(_0x3f688c,_0x17c011,'PAUSE');return![];}if(_0x59dc83&&_0x17c011[_0xced3('0x1f')](_0x2008f2+_0xced3('0x20'))&&_0x17c011['hasOwnProperty'](_0x2008f2+'CurrentCapacity')){if(_0x17c011[_0x2008f2+_0xced3('0x20')]>0x0&&_0x17c011[_0x2008f2+_0xced3('0x21')]>=_0x17c011[_0x2008f2+_0xced3('0x20')]){writeLog(_0x3f688c,_0x17c011,_0x2008f2[_0xced3('0x22')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xced3('0x23')]=function(_0x23f92b,_0x4fc285,_0x3fb4f9,_0x4da7ce,_0x1dcc52){return sendNotification(!![],_0x23f92b,_0x4fc285,_0x3fb4f9,_0x4da7ce,_0x1dcc52);};exports[_0xced3('0x24')]=function(_0x3b728d,_0x23a570,_0x2ec2c4,_0x502cf1,_0x5454c0){return sendNotification(![],_0x3b728d,_0x23a570,_0x2ec2c4,_0x502cf1,_0x5454c0);};exports[_0xced3('0x25')]=function(_0x5bb425,_0x2ab8a8,_0x1e6923){var _0x4a8e85=_0x2ab8a8[_0xced3('0x26')][_0xced3('0x27')];if(!_0x4a8e85&&_0x1e6923){_0x4a8e85=_0x1e6923['id'];}var _0x196956=_[_0xced3('0x28')](_0x5bb425[_0x2ab8a8[_0xced3('0x29')]+_0xced3('0x2a')],function(_0x895a32){var _0x41d003=_[_0xced3('0x2b')](_0x2ab8a8['channel'])+_0xced3('0x2c');return _0x895a32[_0x41d003]===_0x2ab8a8[_0xced3('0x26')]['id'];});if(!_0x196956&&_0x4a8e85&&_0x5bb425[_0xced3('0x2d')][_0x4a8e85]){_0x196956=_[_0xced3('0x28')](_0x5bb425[_0xced3('0x2d')][_0x4a8e85][_0x2ab8a8[_0xced3('0x29')]+_0xced3('0x2e')],function(_0x4f2439){return _0x4f2439['id']===_0x2ab8a8[_0xced3('0x26')]['id'];});}return _0x196956;};exports[_0xced3('0x2f')]=function(_0x385074,_0x2aa88b,_0x12d4a5,_0x407a24){if(_0x12d4a5&&_0x12d4a5['id']&&_0x385074[_0xced3('0x2d')]&&_0x385074[_0xced3('0x2d')][_0x12d4a5['id']]){_0x385074[_0xced3('0x2d')][_0x12d4a5['id']][_0x407a24+_0xced3('0x2e')][_0x2aa88b[_0xced3('0x14')]['id']]={'id':_0x2aa88b[_0xced3('0x26')]['id']};}};exports[_0xced3('0x30')]=function(_0x565e70,_0x5b92fc,_0x55e3ac,_0x457d38){if(_0x55e3ac&&_0x55e3ac['id']&&_0x565e70[_0xced3('0x2d')]&&_0x565e70[_0xced3('0x2d')][_0x55e3ac['id']]){delete _0x565e70[_0xced3('0x2d')][_0x55e3ac['id']][_0x457d38+_0xced3('0x2e')][_0x5b92fc[_0xced3('0x14')]['id']];}};exports[_0xced3('0x31')]=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 23b4bfa..1db6c41 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 _0x2b51=['next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x16ee72,_0x7ab5c7){var _0x1a8d8c=function(_0x16bdfe){while(--_0x16bdfe){_0x16ee72['push'](_0x16ee72['shift']());}};_0x1a8d8c(++_0x7ab5c7);}(_0x2b51,0x1c5));var _0x12b5=function(_0x558714,_0x2ab091){_0x558714=_0x558714-0x0;var _0x388578=_0x2b51[_0x558714];return _0x388578;};'use strict';var schema=require(_0x12b5('0x0'));var sh=require(_0x12b5('0x1'));var _=require(_0x12b5('0x2'));var utils=require(_0x12b5('0x3'));var logger=require(_0x12b5('0x4'))(_0x12b5('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x12b5('0x6')}});exports['consequence']=function(_0x5b65f8,_0x15c5da){return function(_0x2275d8){try{var _0x38a245={'command':_0x15c5da[0x0]};var _0x3fa276=system[_0x12b5('0x0')](_0x38a245,{'typecast':!![]});if(_0x3fa276[_0x12b5('0x7')]){logger[_0x12b5('0x8')](_0x12b5('0x9'),_0x5b65f8,_['map'](_0x3fa276,'message')[_0x12b5('0xa')](',\x20'));logger['info'](_0x12b5('0xb'),_0x5b65f8);_0x2275d8['next']();}else{var _0x80d981=this;var _0x127cb7=utils[_0x12b5('0xc')](_0x15c5da[0x0],this);logger[_0x12b5('0xd')](_0x12b5('0xe'),_0x5b65f8,_0x127cb7);sh[_0x12b5('0xf')](_[_0x12b5('0x10')](_0x127cb7),function(_0x2f2027,_0x48a910){logger['info'](_0x12b5('0x11'),_0x5b65f8,_0x2f2027);if(_0x2f2027==0x0){var _0x18b765=_0x48a910[_0x12b5('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x12b5('0x13')](_0x15c5da[0x1])||_[_0x12b5('0x14')](_0x15c5da[0x1])){logger[_0x12b5('0xd')](_0x12b5('0x15'),_0x5b65f8);_0x80d981['body'][_0x15c5da[0x1]]=_0x18b765;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5b65f8,_0x15c5da[0x1],_0x18b765);_0x80d981['body'][_0x15c5da[0x1]]=_0x18b765;}}_0x2275d8[_0x12b5('0x16')]();});}}catch(_0x2c75dd){logger[_0x12b5('0x8')](_0x12b5('0x9'),_0x5b65f8,_[_0x12b5('0x17')](_0x2c75dd)?JSON[_0x12b5('0x18')](_0x2c75dd):_0x2c75dd);logger[_0x12b5('0xd')](_0x12b5('0xb'),_0x5b65f8);_0x2275d8['next']();}};}; \ No newline at end of file +var _0x1fc9=['[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x2b883a,_0x3f89b2){var _0x21405d=function(_0x5bdbc8){while(--_0x5bdbc8){_0x2b883a['push'](_0x2b883a['shift']());}};_0x21405d(++_0x3f89b2);}(_0x1fc9,0xfb));var _0x91fc=function(_0x5f3ba6,_0x298d60){_0x5f3ba6=_0x5f3ba6-0x0;var _0x5b6951=_0x1fc9[_0x5f3ba6];return _0x5b6951;};'use strict';var schema=require(_0x91fc('0x0'));var sh=require(_0x91fc('0x1'));var _=require(_0x91fc('0x2'));var utils=require(_0x91fc('0x3'));var logger=require(_0x91fc('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x91fc('0x5')}});exports[_0x91fc('0x6')]=function(_0x7669e4,_0x47c486){return function(_0x1ccdc6){try{var _0x2f32d8={'command':_0x47c486[0x0]};var _0x40b48f=system[_0x91fc('0x0')](_0x2f32d8,{'typecast':!![]});if(_0x40b48f['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x7669e4,_['map'](_0x40b48f,_0x91fc('0x7'))[_0x91fc('0x8')](',\x20'));logger[_0x91fc('0x9')](_0x91fc('0xa'),_0x7669e4);_0x1ccdc6[_0x91fc('0xb')]();}else{var _0x2d5508=this;var _0xa45c29=utils[_0x91fc('0xc')](_0x47c486[0x0],this);logger[_0x91fc('0x9')](_0x91fc('0xd'),_0x7669e4,_0xa45c29);sh[_0x91fc('0xe')](_['trim'](_0xa45c29),function(_0x130c18,_0x3561e0){logger[_0x91fc('0x9')](_0x91fc('0xf'),_0x7669e4,_0x130c18);if(_0x130c18==0x0){var _0x3db2af=_0x3561e0[_0x91fc('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x91fc('0x11')](_0x47c486[0x1])||_['isEmpty'](_0x47c486[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x7669e4);_0x2d5508[_0x91fc('0x12')][_0x47c486[0x1]]=_0x3db2af;}else{logger[_0x91fc('0x9')](_0x91fc('0x13'),_0x7669e4,_0x47c486[0x1],_0x3db2af);_0x2d5508[_0x91fc('0x12')][_0x47c486[0x1]]=_0x3db2af;}}_0x1ccdc6['next']();});}}catch(_0x210d0a){logger[_0x91fc('0x14')](_0x91fc('0x15'),_0x7669e4,_[_0x91fc('0x16')](_0x210d0a)?JSON[_0x91fc('0x17')](_0x210d0a):_0x210d0a);logger['info'](_0x91fc('0xa'),_0x7669e4);_0x1ccdc6[_0x91fc('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 7e6c72e..0bef6b9 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 _0x2464=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0xe7b9f,_0x14e885){var _0x20bc26=function(_0x2739e5){while(--_0x2739e5){_0xe7b9f['push'](_0xe7b9f['shift']());}};_0x20bc26(++_0x14e885);}(_0x2464,0x75));var _0x4246=function(_0xe0822a,_0x1c5686){_0xe0822a=_0xe0822a-0x0;var _0x3219a3=_0x2464[_0xe0822a];return _0x3219a3;};'use strict';var schema=require('validate');var _=require(_0x4246('0x0'));var rpc={'chatInteraction':require(_0x4246('0x1')),'openchannelInteraction':require(_0x4246('0x2')),'smsInteraction':require(_0x4246('0x3')),'mailInteraction':require(_0x4246('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4246('0x5'))};var logger=require(_0x4246('0x6'))('routing');var tag=schema({'tag':{'type':_0x4246('0x7'),'required':!![],'message':_0x4246('0x8')}});exports['consequence']=function(_0x39a3c1,_0x1a5ba9,_0x1c20c8,_0x11e120){return function(_0xc8a0e1){try{var _0x50f952={'tag':_0x1a5ba9[0x0]};var _0x1e8732=tag[_0x4246('0x9')](_0x50f952,{'typecast':!![]});if(_0x1e8732['length']){logger['error']('[%s][TAG]\x20%s',_0x39a3c1,_[_0x4246('0xa')](_0x1e8732,_0x4246('0xb'))[_0x4246('0xc')](',\x20'));logger['info'](_0x4246('0xd'),_0x39a3c1);_0xc8a0e1[_0x4246('0xe')]();}else{var _0x3e7590={'ids':[_0x1a5ba9[0x0]]};if(rpc[_0x11e120['channel']+_0x4246('0xf')]){rpc[_0x11e120[_0x4246('0x10')]+_0x4246('0xf')]['addTags'](_0x11e120[_0x4246('0x11')]['id'],_0x3e7590)[_0x4246('0x12')](function(_0x5bbfd7){logger['info'](_0x4246('0x13'),_0x39a3c1,_0x1a5ba9[0x1],_0x11e120[_0x4246('0x10')],_0x11e120[_0x4246('0x11')]['id']);})['catch'](function(_0x166245){logger['error'](_0x4246('0x14'),_0x39a3c1,JSON[_0x4246('0x15')](_0x166245));logger['info'](_0x4246('0xd'),_0x39a3c1);})[_0x4246('0x16')](function(){_0xc8a0e1[_0x4246('0xe')]();});}}}catch(_0x505438){logger['error'](_0x4246('0x14'),_0x39a3c1,_[_0x4246('0x17')](_0x505438)?JSON[_0x4246('0x15')](_0x505438):_0x505438);logger['info'](_0x4246('0xd'),_0x39a3c1);_0xc8a0e1['next']();}};}; \ No newline at end of file +var _0xb53f=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','error','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][TAG]\x20%s','message','join','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb53f,0xf9));var _0xfb53=function(_0x6499b5,_0x5f4ef8){_0x6499b5=_0x6499b5-0x0;var _0x17cda2=_0xb53f[_0x6499b5];return _0x17cda2;};'use strict';var schema=require('validate');var _=require(_0xfb53('0x0'));var rpc={'chatInteraction':require(_0xfb53('0x1')),'openchannelInteraction':require(_0xfb53('0x2')),'smsInteraction':require(_0xfb53('0x3')),'mailInteraction':require(_0xfb53('0x4')),'faxInteraction':require(_0xfb53('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xfb53('0x6'),'required':!![],'message':_0xfb53('0x7')}});exports[_0xfb53('0x8')]=function(_0x50ed91,_0x4a3cb1,_0xf4455,_0x1824e2){return function(_0x6b6cde){try{var _0xf39c63={'tag':_0x4a3cb1[0x0]};var _0x4a7044=tag[_0xfb53('0x9')](_0xf39c63,{'typecast':!![]});if(_0x4a7044[_0xfb53('0xa')]){logger['error'](_0xfb53('0xb'),_0x50ed91,_['map'](_0x4a7044,_0xfb53('0xc'))[_0xfb53('0xd')](',\x20'));logger[_0xfb53('0xe')](_0xfb53('0xf'),_0x50ed91);_0x6b6cde[_0xfb53('0x10')]();}else{var _0x411b2d={'ids':[_0x4a3cb1[0x0]]};if(rpc[_0x1824e2[_0xfb53('0x11')]+_0xfb53('0x12')]){rpc[_0x1824e2[_0xfb53('0x11')]+_0xfb53('0x12')]['addTags'](_0x1824e2[_0xfb53('0x13')]['id'],_0x411b2d)['then'](function(_0x20bda6){logger[_0xfb53('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x50ed91,_0x4a3cb1[0x1],_0x1824e2['channel'],_0x1824e2[_0xfb53('0x13')]['id']);})['catch'](function(_0x2008e8){logger[_0xfb53('0x14')](_0xfb53('0xb'),_0x50ed91,JSON[_0xfb53('0x15')](_0x2008e8));logger['info'](_0xfb53('0xf'),_0x50ed91);})['finally'](function(){_0x6b6cde[_0xfb53('0x10')]();});}}}catch(_0x552774){logger[_0xfb53('0x14')](_0xfb53('0xb'),_0x50ed91,_['isObject'](_0x552774)?JSON[_0xfb53('0x15')](_0x552774):_0x552774);logger[_0xfb53('0xe')](_0xfb53('0xf'),_0x50ed91);_0x6b6cde['next']();}};}; \ 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 75c1bf4..b6a34ab 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 _0xb086=['request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','method','login','stringify','utf8','POST','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x4ded52,_0xa1fc39){var _0x5af77c=function(_0x1271fd){while(--_0x1271fd){_0x4ded52['push'](_0x4ded52['shift']());}};_0x5af77c(++_0xa1fc39);}(_0xb086,0xe0));var _0x6b08=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb086[_0x4565bf];return _0x5610ba;};'use strict';var rp=require(_0x6b08('0x0'));var logger=require(_0x6b08('0x1'))('routing');var _=require(_0x6b08('0x2'));var arr=[];exports[_0x6b08('0x3')]=function(_0x533855,_0x4b11df){return function(_0x14fe99){var _0x40f813=_0x4b11df[0xa];var _0x6e94c1=_0x4b11df[0xb];var _0x1c3ea8=_0x4b11df[0xc];var _0x4e2496=_0x4b11df[0xd];var _0x4e6888=_0x4b11df[0xe];var _0xecdb81=_0x4b11df[0xf][_0x6b08('0x4')](/\n/g,_0x6b08('0x5'));var _0x550475=_0x4b11df[0x10][_0x6b08('0x4')](/\n/g,'\x20');if(!arr[_0x6b08('0x6')](_0x6e94c1)){arr[_0x6b08('0x7')](_0x6e94c1);var _0x3b68e8=_0x4b11df[0x3];var _0x5b766b=_0x4b11df[0x4];var _0x342084=_0x4b11df[0x1];var _0x1d27db=_0x4b11df[0x0];var _0x1a549b={};_0x1a549b[_0x6b08('0x8')]=_0x4b11df[0x8]+_0x6b08('0x9')+_0x1c3ea8+'|'+_0x40f813+'|'+_0x4e2496+'|'+_0x6e94c1+'|'+_0x4e6888;_0x1a549b['urlOnRing']=_0x4b11df[0x7]+_0x6b08('0x9')+_0x1c3ea8+'|'+_0x40f813+'|'+_0x4e2496+'|'+_0x6e94c1+'|'+_0x4e6888+'|'+_0xecdb81+'|'+_0x550475;_0x1a549b[_0x6b08('0xa')]=_0x4b11df[0x9];var _0x262ea8={};_0x262ea8[_0x6b08('0xb')]='2.0';_0x262ea8[_0x6b08('0xc')]=_0x6b08('0xd');var _0x42f3f9=[];_0x42f3f9[_0x6b08('0x7')](_0x4b11df[0x2]);_0x42f3f9[_0x6b08('0x7')](_0x4b11df[0x5]);_0x42f3f9[_0x6b08('0x7')](_0x4b11df[0x6]);_0x262ea8['params']=_0x42f3f9;_0x262ea8['id']=0x1;var _0x2997e9=JSON[_0x6b08('0xe')](_0x262ea8);var _0xdd3b5f={'encoding':_0x6b08('0xf'),'method':_0x6b08('0x10'),'timeout':0x2710,'url':_0x3b68e8,'headers':{'Content-Type':'application/json-rpc'},'body':_0x2997e9};return rp(_0xdd3b5f)[_0x6b08('0x11')](function(_0x4cee0f){const _0x531a7b=JSON['parse'](_0x4cee0f);if(!_0x531a7b[_0x6b08('0x12')][_0x6b08('0x13')]){throw new Error(_0x6b08('0x14'));}var _0x2c0e88=_0x6e94c1;var _0x27b279=_0x6b08('0x15')+_0x342084+_0x6b08('0x16')+_0x1d27db+_0x6b08('0x17')+_0x2c0e88+_0x6b08('0x18')+JSON['stringify'](_0x1a549b);var _0x14c50d=_0x5b766b+'?'+_0x27b279;return rp(_0x14c50d);})[_0x6b08('0x11')](function(_0x4c7615){logger['info'](_0x6b08('0x19'),_0x533855,_0x4c7615);_0x14fe99['stop']();})['catch'](function(_0xac6210){logger[_0x6b08('0x1a')](_0x6b08('0x1b'),_0x533855,_[_0x6b08('0x1c')](_0xac6210)?JSON['stringify'](_0xac6210):_0xac6210);_0x14fe99[_0x6b08('0x1d')]();});}else{logger['info'](_0x6b08('0x1e'),_0x533855);_0x14fe99[_0x6b08('0x1f')]();}};}; \ No newline at end of file +var _0xab6b=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','push','params','stringify','utf8','application/json-rpc','parse','result'];(function(_0x4eb029,_0x75ab7e){var _0x7691f6=function(_0x4df03d){while(--_0x4df03d){_0x4eb029['push'](_0x4eb029['shift']());}};_0x7691f6(++_0x75ab7e);}(_0xab6b,0xb7));var _0xbab6=function(_0x29835c,_0x3504c2){_0x29835c=_0x29835c-0x0;var _0x3c4ac0=_0xab6b[_0x29835c];return _0x3c4ac0;};'use strict';var rp=require(_0xbab6('0x0'));var logger=require(_0xbab6('0x1'))(_0xbab6('0x2'));var _=require(_0xbab6('0x3'));var arr=[];exports[_0xbab6('0x4')]=function(_0x5690c2,_0x2abe63){return function(_0x14baa3){var _0x51bf4b=_0x2abe63[0xa];var _0x5ad59a=_0x2abe63[0xb];var _0x1bba12=_0x2abe63[0xc];var _0x149d8a=_0x2abe63[0xd];var _0x5bad2c=_0x2abe63[0xe];var _0x198620=_0x2abe63[0xf][_0xbab6('0x5')](/\n/g,'\x20-\x20');var _0x1c43bb=_0x2abe63[0x10][_0xbab6('0x5')](/\n/g,'\x20');if(!arr[_0xbab6('0x6')](_0x5ad59a)){arr['push'](_0x5ad59a);var _0x2a2c4e=_0x2abe63[0x3];var _0x41855e=_0x2abe63[0x4];var _0x16695a=_0x2abe63[0x1];var _0x284504=_0x2abe63[0x0];var _0x533a86={};_0x533a86[_0xbab6('0x7')]=_0x2abe63[0x8]+_0xbab6('0x8')+_0x1bba12+'|'+_0x51bf4b+'|'+_0x149d8a+'|'+_0x5ad59a+'|'+_0x5bad2c;_0x533a86[_0xbab6('0x9')]=_0x2abe63[0x7]+_0xbab6('0x8')+_0x1bba12+'|'+_0x51bf4b+'|'+_0x149d8a+'|'+_0x5ad59a+'|'+_0x5bad2c+'|'+_0x198620+'|'+_0x1c43bb;_0x533a86[_0xbab6('0xa')]=_0x2abe63[0x9];var _0x539cdc={};_0x539cdc[_0xbab6('0xb')]=_0xbab6('0xc');_0x539cdc[_0xbab6('0xd')]='login';var _0x1b73dd=[];_0x1b73dd[_0xbab6('0xe')](_0x2abe63[0x2]);_0x1b73dd[_0xbab6('0xe')](_0x2abe63[0x5]);_0x1b73dd[_0xbab6('0xe')](_0x2abe63[0x6]);_0x539cdc[_0xbab6('0xf')]=_0x1b73dd;_0x539cdc['id']=0x1;var _0x4462c1=JSON[_0xbab6('0x10')](_0x539cdc);var _0x4b8956={'encoding':_0xbab6('0x11'),'method':'POST','timeout':0x2710,'url':_0x2a2c4e,'headers':{'Content-Type':_0xbab6('0x12')},'body':_0x4462c1};return rp(_0x4b8956)['then'](function(_0xc0b6ff){const _0x2c9670=JSON[_0xbab6('0x13')](_0xc0b6ff);if(!_0x2c9670[_0xbab6('0x14')][_0xbab6('0x15')]){throw new Error(_0xbab6('0x16'));}var _0x92fe86=_0x5ad59a;var _0x5826ae=_0xbab6('0x17')+_0x16695a+_0xbab6('0x18')+_0x284504+_0xbab6('0x19')+_0x92fe86+'&data='+JSON[_0xbab6('0x10')](_0x533a86);var _0x70e5d8=_0x41855e+'?'+_0x5826ae;return rp(_0x70e5d8);})[_0xbab6('0x1a')](function(_0x47db81){logger[_0xbab6('0x1b')](_0xbab6('0x1c'),_0x5690c2,_0x47db81);_0x14baa3[_0xbab6('0x1d')]();})['catch'](function(_0x4a2549){logger[_0xbab6('0x1e')](_0xbab6('0x1f'),_0x5690c2,_[_0xbab6('0x20')](_0x4a2549)?JSON[_0xbab6('0x10')](_0x4a2549):_0x4a2549);_0x14baa3[_0xbab6('0x1d')]();});}else{logger[_0xbab6('0x1b')](_0xbab6('0x21'),_0x5690c2);_0x14baa3['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 afa85a4..0c85885 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1fd469,_0x13b443){var _0x25bb14=function(_0x32b812){while(--_0x32b812){_0x1fd469['push'](_0x1fd469['shift']());}};_0x25bb14(++_0x13b443);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x26012e,_0x2a3de5){var _0x4e1e7d=function(_0x3ff9dc){while(--_0x3ff9dc){_0x26012e['push'](_0x26012e['shift']());}};_0x4e1e7d(++_0x2a3de5);}(_0xe706,0xa3));var _0x6e70=function(_0x157ce5,_0xfa6b87){_0x157ce5=_0x157ce5-0x0;var _0x359c0c=_0xe706[_0x157ce5];return _0x359c0c;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 615010e..533b5a7 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 _0x3ace=['busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','util','path','jayson/promise','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','transfer','isArray','applications','length','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','split','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3ace,0xda));var _0xe3ac=function(_0x20fcef,_0x436624){_0x20fcef=_0x20fcef-0x0;var _0x23b642=_0x3ace[_0x20fcef];return _0x23b642;};'use strict';var _=require('lodash');var util=require(_0xe3ac('0x0'));var path=require(_0xe3ac('0x1'));var fs=require('fs');var jayson=require(_0xe3ac('0x2'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0xe3ac('0x3'));var logger=require(_0xe3ac('0x4'))(_0xe3ac('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe3ac('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe3ac('0x7')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xe3ac('0x8'));function getId(_0x5c181d,_0x345e51,_0x26eeed){return util[_0xe3ac('0x9')](_0xe3ac('0xa'),_0x5c181d,_0x345e51||0x0,_0x26eeed||0x0);}function getIntervals(_0x29ba64,_0x4fc0b7){var _0x184032=[];if(!_[_0xe3ac('0xb')](_0x4fc0b7[_0xe3ac('0xc')])&&!_['isNil'](_0x29ba64[_0x4fc0b7[_0xe3ac('0xc')]])&&!_[_0xe3ac('0xb')](_0x29ba64[_0x4fc0b7[_0xe3ac('0xc')]][_0xe3ac('0xd')])){_0x184032=_[_0xe3ac('0xe')](_0x29ba64[_0x4fc0b7[_0xe3ac('0xc')]][_0xe3ac('0xd')],_0xe3ac('0xf'));}else if(!_[_0xe3ac('0xb')](_0x4fc0b7[_0xe3ac('0xf')])){_0x184032=[_0x4fc0b7[_0xe3ac('0xf')]];}return _0x184032;}exports[_0xe3ac('0x10')]=function(_0x44f99f){_0x44f99f[_0xe3ac('0x11')]={};return new BPromise(function(_0x28e237,_0x42c914){var _0x443994={'Start':function(_0x4c69c6){var _0x1e4109=this;return new Promise(function(_0xd8ccd8,_0x3d8377){if(_0x4c69c6){try{var _0x5a5ecc=[];var _0x4fd50a=getId(_0x4c69c6[_0xe3ac('0x12')],_0x4c69c6['message']?_0x4c69c6[_0xe3ac('0x13')]['id']:0x0,_0x4c69c6[_0xe3ac('0x14')]?_0x4c69c6['interaction']['id']:0x0);var _0x2ad6fc=sUtils['checkWaitingNotifications'](_0x44f99f,_0x4c69c6);if(_0x4c69c6[_0xe3ac('0x15')]||!_0x2ad6fc&&_0x4c69c6['applications']&&_[_0xe3ac('0x16')](_0x4c69c6[_0xe3ac('0x17')])&&_0x4c69c6[_0xe3ac('0x17')][_0xe3ac('0x18')]){for(var _0x3834f9=0x0;_0x3834f9<_0x4c69c6[_0xe3ac('0x17')]['length'];_0x3834f9+=0x1){var _0x383395=_0x4c69c6[_0xe3ac('0x17')][_0x3834f9];if(fs['existsSync'](path[_0xe3ac('0x19')](__dirname,_0xe3ac('0x17'),_0x383395[_0xe3ac('0x1a')]+_0xe3ac('0x1b')))){var _0x36bb0a=[];switch(_0x383395['app'][_0xe3ac('0x1c')]()){case _0xe3ac('0x1d'):var _0x32d011=_0x383395[_0xe3ac('0x1e')]['split'](',');if(_0x4c69c6[_0xe3ac('0x12')]===_0xe3ac('0x1f')){_0x36bb0a['push'](_0x32d011[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x32d011[0x1]);_0x36bb0a['push'](_0x32d011[_0xe3ac('0x21')](0x2,_0x32d011[_0xe3ac('0x18')])[_0xe3ac('0x19')](','));}else{_0x36bb0a[_0xe3ac('0x20')](_0x32d011[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x32d011[_0xe3ac('0x21')](0x1,_0x32d011['length'])[_0xe3ac('0x19')](','));}break;case'dialogflow':var _0x3ab2ec=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a['push'](_0x3ab2ec[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x3ab2ec[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x3ab2ec[_0xe3ac('0x21')](0x2,_0x3ab2ec[_0xe3ac('0x18')])[_0xe3ac('0x19')](','));break;case'dialogflowv2':var _0x151a5e=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a['push'](_0x151a5e[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x151a5e[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x151a5e[0x2]);_0x36bb0a['push'](_0x151a5e[0x3]);_0x36bb0a[_0xe3ac('0x20')](_0x151a5e[_0xe3ac('0x21')](0x4,_0x151a5e[_0xe3ac('0x18')])['join'](','));break;case'amazonlex':var _0x3a8d8f=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x0]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x2]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[0x3]);_0x36bb0a[_0xe3ac('0x20')](_0x3a8d8f[_0xe3ac('0x21')](0x4,_0x3a8d8f['length'])[_0xe3ac('0x19')](','));break;case _0xe3ac('0x13'):_0x36bb0a[_0xe3ac('0x20')](_0x383395[_0xe3ac('0x1e')]);break;case _0xe3ac('0x23'):_0x36bb0a[_0xe3ac('0x20')](_0x383395['TagId']);_0x36bb0a[_0xe3ac('0x20')](_0x383395[_0xe3ac('0x1e')]);break;case _0xe3ac('0x24'):var _0x2b68bf=utils[_0xe3ac('0x25')](_0x4c69c6[_0xe3ac('0x26')][_0xe3ac('0x27')],_0x4c69c6);var _0x4f68a8=_0x383395[_0xe3ac('0x1e')][_0xe3ac('0x22')](',');_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x0]);_0x36bb0a['push'](_0x4f68a8[0x1]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x2]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x3]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x4]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x5]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x6]);_0x36bb0a['push'](_0x4f68a8[0x7]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0x8]);_0x36bb0a['push'](_0x4f68a8[0x9]);_0x36bb0a[_0xe3ac('0x20')](_0x4f68a8[0xa]);_0x36bb0a[_0xe3ac('0x20')](_0x4c69c6[_0xe3ac('0x14')]['id']);_0x36bb0a[_0xe3ac('0x20')](_0x4c69c6[_0xe3ac('0x13')]['id']);_0x36bb0a[_0xe3ac('0x20')](_0x383395[_0xe3ac('0x28')]);_0x36bb0a['push'](_0x4c69c6[_0xe3ac('0x14')][_0xe3ac('0x29')]);_0x36bb0a['push'](_0x4c69c6[_0xe3ac('0x2a')][_0xe3ac('0x2a')]);_0x36bb0a['push'](_0x2b68bf);break;default:_0x36bb0a=_[_0xe3ac('0xb')](_0x383395[_0xe3ac('0x1e')])?[]:_0x383395['appdata'][_0xe3ac('0x22')](',');}var _0x4b9bd9={'id':util['format'](_0xe3ac('0x2b'),_0x4fd50a,_0x383395['id'],_0x383395[_0xe3ac('0x1a')]),'condition':require(_0xe3ac('0x2c'))['condition'](_0x4fd50a,getIntervals(_0x44f99f[_0xe3ac('0x2d')],_0x383395),_0x44f99f),'consequence':require(_0xe3ac('0x2e')+_0x383395[_0xe3ac('0x1a')])[_0xe3ac('0x2f')](_0x4fd50a,_0x36bb0a,_0x44f99f,_0x4c69c6),'p':_0x383395[_0xe3ac('0x30')]||0x0};logger[_0xe3ac('0x31')](_0xe3ac('0x32'),_0x4b9bd9['id'],'on\x20interval',getIntervals(_0x44f99f[_0xe3ac('0x2d')],_0x383395)['join'](_0xe3ac('0x33')));_0x5a5ecc[_0xe3ac('0x20')](_0x4b9bd9);}else{logger[_0xe3ac('0x34')](_0xe3ac('0x35'),path[_0xe3ac('0x19')](__dirname,_0xe3ac('0x17'),_0x383395[_0xe3ac('0x1a')]+_0xe3ac('0x1b')));}}_0x44f99f['rules'][_0x4fd50a]=new RuleEngine(_0x5a5ecc);_0x44f99f[_0xe3ac('0x11')][_0x4fd50a][_0xe3ac('0x36')](_0x4c69c6,function(_0x36e6c0){logger['info'](_0xe3ac('0x37'),JSON[_0xe3ac('0x38')](_0x36e6c0['matchPath']));if(_0x44f99f['rules'][_0x4fd50a]){_0x44f99f[_0xe3ac('0x11')][_0x4fd50a][_0xe3ac('0x39')](_0xe3ac('0x3a'));}});return _0xd8ccd8({'code':0xc8,'message':_0x4c69c6});}else{if(_0x2ad6fc){logger[_0xe3ac('0x31')](util['format']('Skipped\x20routing\x20for\x20%s',_0x4fd50a));}else{logger[_0xe3ac('0x31')](_0xe3ac('0x3b'));}return _0xd8ccd8({'code':0xc8,'message':_0x4c69c6});}}catch(_0x5b6f18){logger[_0xe3ac('0x34')](_0x5b6f18[_0xe3ac('0x3c')]);return _0x3d8377(_0x1e4109['error'](0x1f4,_0x5b6f18));}}return _0x3d8377(_0xe3ac('0x3d'));});},'AcceptMessage':function(_0x1b60e5){var _0x24462b=this;return new Promise(function(_0x44bc58,_0x146e09){if(_0x1b60e5[_0xe3ac('0x3e')]&&_0x1b60e5[_0xe3ac('0x3e')]['id']){if(_0x44f99f['agents'][_0x1b60e5[_0xe3ac('0x3e')]['id']]){_0x44f99f[_0xe3ac('0x3f')][_0x1b60e5[_0xe3ac('0x3e')]['id']][_0xe3ac('0x40')]=![];_0x44f99f[_0xe3ac('0x3f')][_0x1b60e5[_0xe3ac('0x3e')]['id']][_0xe3ac('0x41')]=undefined;}}if(_0x1b60e5['message']&&_0x1b60e5['message']['id']){try{var _0x57b882=getId(_0x1b60e5[_0xe3ac('0x12')],_0x1b60e5[_0xe3ac('0x13')]?_0x1b60e5[_0xe3ac('0x13')]['id']:0x0,_0x1b60e5[_0xe3ac('0x14')]?_0x1b60e5[_0xe3ac('0x14')]['id']:0x0);if(_0x44f99f[_0xe3ac('0x11')][_0x57b882]){_0x44f99f['rules'][_0x57b882]['emit'](_0xe3ac('0x42'));if(rpc[_0x1b60e5['channel']+'QueueReport']){rpc[_0x1b60e5[_0xe3ac('0x12')]+_0xe3ac('0x43')]['update'](_0x57b882,{'UserId':_0x1b60e5[_0xe3ac('0x13')][_0xe3ac('0x44')]})[_0xe3ac('0x45')](function(){logger[_0xe3ac('0x34')](_0xe3ac('0x46'));});}}return _0x44bc58({'code':0xc8,'message':_0x1b60e5});}catch(_0x2ab8b4){logger['error'](_0x2ab8b4[_0xe3ac('0x3c')]);return _0x146e09(_0x24462b['error'](0x1f4,_0x2ab8b4));}}logger[_0xe3ac('0x34')](_0xe3ac('0x47'));return _0x146e09(_0x24462b[_0xe3ac('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5a2680){var _0x493f50=this;return new Promise(function(_0x2f0e49,_0x1a12c4){if(_0x5a2680[_0xe3ac('0x3e')]&&_0x5a2680[_0xe3ac('0x3e')]['id']){try{if(_0x44f99f['agents'][_0x5a2680[_0xe3ac('0x3e')]['id']]){_0x44f99f[_0xe3ac('0x3f')][_0x5a2680['agent']['id']][_0xe3ac('0x40')]=![];_0x44f99f[_0xe3ac('0x3f')][_0x5a2680[_0xe3ac('0x3e')]['id']][_0xe3ac('0x41')]=undefined;}return _0x2f0e49({'code':0xc8,'message':_0x5a2680});}catch(_0x560848){logger['error'](_0x560848[_0xe3ac('0x3c')]);return _0x1a12c4(_0x493f50['error'](0x1f4,_0x560848));}}logger['error'](_0xe3ac('0x47'));return _0x1a12c4(_0x493f50[_0xe3ac('0x34')](0x1f4,_0xe3ac('0x47')));});},'AbandonInteraction':function(_0x48d9f6){var _0x37366e=this;return new Promise(function(_0x5f24d9,_0x221e3c){if(_0x48d9f6[_0xe3ac('0x12')]&&_0x48d9f6[_0xe3ac('0x14')]&&_0x48d9f6['interaction']['id']){try{var _0x22089a=getId(_0x48d9f6['channel'],_0x48d9f6[_0xe3ac('0x13')]?_0x48d9f6[_0xe3ac('0x13')]['id']:0x0,_0x48d9f6[_0xe3ac('0x14')]?_0x48d9f6[_0xe3ac('0x14')]['id']:0x0);if(_0x44f99f[_0xe3ac('0x11')][_0x22089a]){_0x44f99f['rules'][_0x22089a]['emit'](_0xe3ac('0x42'));}return _0x5f24d9({'code':0xc8,'message':_0x48d9f6});}catch(_0x4e0b82){logger[_0xe3ac('0x34')](_0x4e0b82[_0xe3ac('0x3c')]);return _0x221e3c(_0x37366e[_0xe3ac('0x34')](0x1f4,_0x4e0b82));}}logger['error'](_0xe3ac('0x47'));return _0x221e3c(_0x37366e[_0xe3ac('0x34')](0x1f4,_0xe3ac('0x47')));});},'AgentCapacity':function(_0x2f4177){var _0x2e51b7=this;return new Promise(function(_0x391656,_0x125963){if(_0x44f99f[_0xe3ac('0x3f')][_0xe3ac('0x48')](_0x2f4177['id'])){for(var _0xe632dd in _0x2f4177[_0xe3ac('0x49')]){if(_0x2f4177[_0xe3ac('0x49')][_0xe3ac('0x48')](_0xe632dd)){if(_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']][_0xe3ac('0x48')](_0xe632dd+_0xe3ac('0x4a'))){_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']][_0xe632dd+_0xe3ac('0x4a')]=parseInt(_0x2f4177[_0xe3ac('0x49')][_0xe632dd],0xa);}}}_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']]['updateRealtime']();return _0x391656({'code':0xc8,'message':_0x44f99f[_0xe3ac('0x3f')][_0x2f4177['id']]});}else{return _0x125963(_0x2e51b7['error'](0x1f4,_0xe3ac('0x4b')));}});},'Agents':function(_0x258ed8){return new Promise(function(_0x5042d5){var _0x10a07c=_[_0xe3ac('0x4c')](_0x44f99f[_0xe3ac('0x3f')]);if(_0x258ed8&&_0x258ed8['id']){var _0x498c05=_['find'](_0x10a07c,function(_0x5e6ca7){return _0x5e6ca7['id']===_0x258ed8['id'];});_0x5042d5(_0x498c05);}else{_0x5042d5({'count':_0x10a07c[_0xe3ac('0x18')],'rows':_0x10a07c});}});},'ChatQueues':function(){return new Promise(function(_0x4ad637){var _0x25b710=[];for(var _0x224c33 in _0x44f99f[_0xe3ac('0x4d')]){if(_0x44f99f['chatQueues'][_0xe3ac('0x48')](_0x224c33)){var _0xd2e16c=_0x44f99f[_0xe3ac('0x4d')][_0x224c33];var _0x4a951d={'id':_0xd2e16c['id'],'available':_0xd2e16c[_0xe3ac('0x4e')],'loggedIn':_0xd2e16c[_0xe3ac('0x4f')],'name':_0xd2e16c[_0xe3ac('0x50')],'paused':_0xd2e16c[_0xe3ac('0x51')],'waiting':_0xd2e16c[_0xe3ac('0x52')]};_0x25b710['push'](_0x4a951d);}}_0x4ad637({'count':_0x25b710[_0xe3ac('0x18')],'rows':_0x25b710});});},'MailQueues':function(){return new Promise(function(_0x278196){var _0x51ad88=[];for(var _0x35371f in _0x44f99f[_0xe3ac('0x53')]){if(_0x44f99f[_0xe3ac('0x53')][_0xe3ac('0x48')](_0x35371f)){var _0xf19056=_0x44f99f['mailQueues'][_0x35371f];var _0x4c9055={'id':_0xf19056['id'],'available':_0xf19056[_0xe3ac('0x4e')],'loggedIn':_0xf19056['loggedIn'],'name':_0xf19056[_0xe3ac('0x50')],'paused':_0xf19056['paused'],'waiting':_0xf19056[_0xe3ac('0x52')]};_0x51ad88[_0xe3ac('0x20')](_0x4c9055);}}_0x278196({'count':_0x51ad88[_0xe3ac('0x18')],'rows':_0x51ad88});});},'OpenchannelQueues':function(){return new Promise(function(_0x5100e1){var _0x1a43cc=[];for(var _0x246192 in _0x44f99f['openchannelQueues']){if(_0x44f99f['openchannelQueues']['hasOwnProperty'](_0x246192)){var _0x5484ae=_0x44f99f[_0xe3ac('0x54')][_0x246192];var _0x2d24f9={'id':_0x5484ae['id'],'available':_0x5484ae[_0xe3ac('0x4e')],'loggedIn':_0x5484ae[_0xe3ac('0x4f')],'name':_0x5484ae[_0xe3ac('0x50')],'paused':_0x5484ae[_0xe3ac('0x51')],'waiting':_0x5484ae[_0xe3ac('0x52')]};_0x1a43cc[_0xe3ac('0x20')](_0x2d24f9);}}_0x5100e1({'count':_0x1a43cc[_0xe3ac('0x18')],'rows':_0x1a43cc});});},'SmsQueues':function(){return new Promise(function(_0x392ef9){var _0x48f432=[];for(var _0x2848a0 in _0x44f99f[_0xe3ac('0x55')]){if(_0x44f99f['smsQueues'][_0xe3ac('0x48')](_0x2848a0)){var _0x281bdd=_0x44f99f[_0xe3ac('0x55')][_0x2848a0];var _0x2d1957={'id':_0x281bdd['id'],'available':_0x281bdd['available'],'loggedIn':_0x281bdd['loggedIn'],'name':_0x281bdd['name'],'paused':_0x281bdd['paused'],'waiting':_0x281bdd[_0xe3ac('0x52')]};_0x48f432['push'](_0x2d1957);}}_0x392ef9({'count':_0x48f432[_0xe3ac('0x18')],'rows':_0x48f432});});},'FaxQueues':function(){return new Promise(function(_0x3c7ad9){var _0x3f490d=[];for(var _0x28a4a3 in _0x44f99f[_0xe3ac('0x56')]){if(_0x44f99f[_0xe3ac('0x56')][_0xe3ac('0x48')](_0x28a4a3)){var _0x47b55e=_0x44f99f[_0xe3ac('0x56')][_0x28a4a3];var _0x549aaa={'id':_0x47b55e['id'],'available':_0x47b55e['available'],'loggedIn':_0x47b55e[_0xe3ac('0x4f')],'name':_0x47b55e['name'],'paused':_0x47b55e['paused'],'waiting':_0x47b55e[_0xe3ac('0x52')]};_0x3f490d[_0xe3ac('0x20')](_0x549aaa);}}_0x3c7ad9({'count':_0x3f490d[_0xe3ac('0x18')],'rows':_0x3f490d});});},'WhatsappQueues':function(){return new Promise(function(_0x35f2c9){var _0x29e0d3=[];for(var _0x230f6d in _0x44f99f['whatsappQueues']){if(_0x44f99f['whatsappQueues'][_0xe3ac('0x48')](_0x230f6d)){var _0x593686=_0x44f99f[_0xe3ac('0x57')][_0x230f6d];var _0x1f4f72={'id':_0x593686['id'],'available':_0x593686[_0xe3ac('0x4e')],'loggedIn':_0x593686[_0xe3ac('0x4f')],'name':_0x593686[_0xe3ac('0x50')],'paused':_0x593686[_0xe3ac('0x51')],'waiting':_0x593686[_0xe3ac('0x52')]};_0x29e0d3[_0xe3ac('0x20')](_0x1f4f72);}}_0x35f2c9({'count':_0x29e0d3[_0xe3ac('0x18')],'rows':_0x29e0d3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ecf9b){var _0x5c10f7=_['values'](_0x44f99f[_0xe3ac('0x58')]);_0x3ecf9b({'count':_0x5c10f7[_0xe3ac('0x18')],'rows':_0x5c10f7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x31d16f){var _0x443e64=_[_0xe3ac('0x4c')](_0x44f99f[_0xe3ac('0x59')]);_0x31d16f({'count':_0x443e64[_0xe3ac('0x18')],'rows':_0x443e64});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x40788b){var _0x1055b6=_[_0xe3ac('0x4c')](_0x44f99f['openchannelQueuesWaitingInteractions']);_0x40788b({'count':_0x1055b6['length'],'rows':_0x1055b6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x590e3b){var _0x35df28=_[_0xe3ac('0x4c')](_0x44f99f['smsQueuesWaitingInteractions']);_0x590e3b({'count':_0x35df28[_0xe3ac('0x18')],'rows':_0x35df28});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3e77fc){var _0xbc4092=_[_0xe3ac('0x4c')](_0x44f99f[_0xe3ac('0x5a')]);_0x3e77fc({'count':_0xbc4092[_0xe3ac('0x18')],'rows':_0xbc4092});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x47c673){var _0x45919b=_[_0xe3ac('0x4c')](_0x44f99f['whatsappQueuesWaitingInteractions']);_0x47c673({'count':_0x45919b[_0xe3ac('0x18')],'rows':_0x45919b});});}};var _0x124b75=jayson[_0xe3ac('0x5b')](_0x443994)[_0xe3ac('0x5c')]();_0x124b75['on'](_0xe3ac('0x34'),function(_0x452017){logger[_0xe3ac('0x34')](JSON[_0xe3ac('0x38')](_0x452017));return _0x42c914(_0x452017);});_0x124b75[_0xe3ac('0x10')](0x232c,_0xe3ac('0x5d'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x28e237('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xbf25=['../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','join','.js','app','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','format','%s:%s:%s','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','name','paused','waiting','mailQueues','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','lodash','util','jayson/promise','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0xbf25,0x12d));var _0x5bf2=function(_0x5a375b,_0x1bf1ee){_0x5a375b=_0x5a375b-0x0;var _0x32ca87=_0xbf25[_0x5a375b];return _0x32ca87;};'use strict';var _=require(_0x5bf2('0x0'));var util=require(_0x5bf2('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x5bf2('0x2'));var BPromise=require(_0x5bf2('0x3'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0x5bf2('0x4'))(_0x5bf2('0x5'));var rpc={'openchannelQueueReport':require(_0x5bf2('0x6')),'mailQueueReport':require(_0x5bf2('0x7')),'chatQueueReport':require(_0x5bf2('0x8')),'smsQueueReport':require(_0x5bf2('0x9')),'faxQueueReport':require(_0x5bf2('0xa')),'whatsappQueueReport':require(_0x5bf2('0xb'))};var RuleEngine=require(_0x5bf2('0xc'));function getId(_0x3a74ea,_0x436f14,_0xfa03aa){return util['format']('%s.%s.%s',_0x3a74ea,_0x436f14||0x0,_0xfa03aa||0x0);}function getIntervals(_0x4e0d68,_0x44a6b6){var _0x559b4c=[];if(!_[_0x5bf2('0xd')](_0x44a6b6[_0x5bf2('0xe')])&&!_[_0x5bf2('0xd')](_0x4e0d68[_0x44a6b6[_0x5bf2('0xe')]])&&!_[_0x5bf2('0xd')](_0x4e0d68[_0x44a6b6[_0x5bf2('0xe')]][_0x5bf2('0xf')])){_0x559b4c=_[_0x5bf2('0x10')](_0x4e0d68[_0x44a6b6['IntervalId']][_0x5bf2('0xf')],_0x5bf2('0x11'));}else if(!_[_0x5bf2('0xd')](_0x44a6b6[_0x5bf2('0x11')])){_0x559b4c=[_0x44a6b6['interval']];}return _0x559b4c;}exports[_0x5bf2('0x12')]=function(_0x387d14){_0x387d14[_0x5bf2('0x13')]={};return new BPromise(function(_0x231e51,_0x73c35a){var _0x1eae9e={'Start':function(_0x24d5bf){var _0x47ce50=this;return new Promise(function(_0x5d2d80,_0x1fd79f){if(_0x24d5bf){try{var _0x588a15=[];var _0x253552=getId(_0x24d5bf[_0x5bf2('0x14')],_0x24d5bf[_0x5bf2('0x15')]?_0x24d5bf[_0x5bf2('0x15')]['id']:0x0,_0x24d5bf['interaction']?_0x24d5bf[_0x5bf2('0x16')]['id']:0x0);var _0x3a7594=sUtils[_0x5bf2('0x17')](_0x387d14,_0x24d5bf);if(_0x24d5bf[_0x5bf2('0x18')]||!_0x3a7594&&_0x24d5bf[_0x5bf2('0x19')]&&_[_0x5bf2('0x1a')](_0x24d5bf[_0x5bf2('0x19')])&&_0x24d5bf['applications'][_0x5bf2('0x1b')]){for(var _0x18f8a0=0x0;_0x18f8a0<_0x24d5bf['applications'][_0x5bf2('0x1b')];_0x18f8a0+=0x1){var _0x3fe970=_0x24d5bf[_0x5bf2('0x19')][_0x18f8a0];if(fs['existsSync'](path[_0x5bf2('0x1c')](__dirname,_0x5bf2('0x19'),_0x3fe970['app']+_0x5bf2('0x1d')))){var _0x255449=[];switch(_0x3fe970[_0x5bf2('0x1e')][_0x5bf2('0x1f')]()){case _0x5bf2('0x20'):var _0x5a8897=_0x3fe970[_0x5bf2('0x21')]['split'](',');if(_0x24d5bf[_0x5bf2('0x14')]===_0x5bf2('0x22')){_0x255449[_0x5bf2('0x23')](_0x5a8897[0x0]);_0x255449[_0x5bf2('0x23')](_0x5a8897[0x1]);_0x255449[_0x5bf2('0x23')](_0x5a8897[_0x5bf2('0x24')](0x2,_0x5a8897[_0x5bf2('0x1b')])['join'](','));}else{_0x255449['push'](_0x5a8897[0x0]);_0x255449[_0x5bf2('0x23')](_0x5a8897[_0x5bf2('0x24')](0x1,_0x5a8897[_0x5bf2('0x1b')])['join'](','));}break;case _0x5bf2('0x25'):var _0x769472=_0x3fe970[_0x5bf2('0x21')][_0x5bf2('0x26')](',');_0x255449[_0x5bf2('0x23')](_0x769472[0x0]);_0x255449['push'](_0x769472[0x1]);_0x255449[_0x5bf2('0x23')](_0x769472[_0x5bf2('0x24')](0x2,_0x769472[_0x5bf2('0x1b')])[_0x5bf2('0x1c')](','));break;case'dialogflowv2':var _0x2b7429=_0x3fe970[_0x5bf2('0x21')]['split'](',');_0x255449[_0x5bf2('0x23')](_0x2b7429[0x0]);_0x255449[_0x5bf2('0x23')](_0x2b7429[0x1]);_0x255449[_0x5bf2('0x23')](_0x2b7429[0x2]);_0x255449[_0x5bf2('0x23')](_0x2b7429[0x3]);_0x255449[_0x5bf2('0x23')](_0x2b7429[_0x5bf2('0x24')](0x4,_0x2b7429['length'])['join'](','));break;case _0x5bf2('0x27'):var _0x253206=_0x3fe970[_0x5bf2('0x21')][_0x5bf2('0x26')](',');_0x255449[_0x5bf2('0x23')](_0x253206[0x0]);_0x255449[_0x5bf2('0x23')](_0x253206[0x1]);_0x255449[_0x5bf2('0x23')](_0x253206[0x2]);_0x255449[_0x5bf2('0x23')](_0x253206[0x3]);_0x255449[_0x5bf2('0x23')](_0x253206['slice'](0x4,_0x253206[_0x5bf2('0x1b')])[_0x5bf2('0x1c')](','));break;case _0x5bf2('0x15'):_0x255449[_0x5bf2('0x23')](_0x3fe970[_0x5bf2('0x21')]);break;case _0x5bf2('0x28'):_0x255449[_0x5bf2('0x23')](_0x3fe970['TagId']);_0x255449[_0x5bf2('0x23')](_0x3fe970[_0x5bf2('0x21')]);break;case _0x5bf2('0x29'):var _0x1f243d=utils[_0x5bf2('0x2a')](_0x24d5bf[_0x5bf2('0x2b')][_0x5bf2('0x2c')],_0x24d5bf);var _0x36287c=_0x3fe970[_0x5bf2('0x21')]['split'](',');_0x255449[_0x5bf2('0x23')](_0x36287c[0x0]);_0x255449['push'](_0x36287c[0x1]);_0x255449[_0x5bf2('0x23')](_0x36287c[0x2]);_0x255449[_0x5bf2('0x23')](_0x36287c[0x3]);_0x255449[_0x5bf2('0x23')](_0x36287c[0x4]);_0x255449['push'](_0x36287c[0x5]);_0x255449['push'](_0x36287c[0x6]);_0x255449['push'](_0x36287c[0x7]);_0x255449[_0x5bf2('0x23')](_0x36287c[0x8]);_0x255449[_0x5bf2('0x23')](_0x36287c[0x9]);_0x255449[_0x5bf2('0x23')](_0x36287c[0xa]);_0x255449[_0x5bf2('0x23')](_0x24d5bf[_0x5bf2('0x16')]['id']);_0x255449['push'](_0x24d5bf[_0x5bf2('0x15')]['id']);_0x255449[_0x5bf2('0x23')](_0x3fe970['ChatWebsiteId']);_0x255449[_0x5bf2('0x23')](_0x24d5bf[_0x5bf2('0x16')][_0x5bf2('0x2d')]);_0x255449[_0x5bf2('0x23')](_0x24d5bf[_0x5bf2('0x2e')]['body']);_0x255449[_0x5bf2('0x23')](_0x1f243d);break;default:_0x255449=_['isNil'](_0x3fe970['appdata'])?[]:_0x3fe970[_0x5bf2('0x21')]['split'](',');}var _0x25fa7e={'id':util[_0x5bf2('0x2f')](_0x5bf2('0x30'),_0x253552,_0x3fe970['id'],_0x3fe970['app']),'condition':require('./interval')[_0x5bf2('0x31')](_0x253552,getIntervals(_0x387d14[_0x5bf2('0x32')],_0x3fe970),_0x387d14),'consequence':require('./applications/'+_0x3fe970[_0x5bf2('0x1e')])[_0x5bf2('0x33')](_0x253552,_0x255449,_0x387d14,_0x24d5bf),'p':_0x3fe970[_0x5bf2('0x34')]||0x0};logger[_0x5bf2('0x35')](_0x5bf2('0x36'),_0x25fa7e['id'],_0x5bf2('0x37'),getIntervals(_0x387d14['intervals'],_0x3fe970)[_0x5bf2('0x1c')](_0x5bf2('0x38')));_0x588a15[_0x5bf2('0x23')](_0x25fa7e);}else{logger['error'](_0x5bf2('0x39'),path['join'](__dirname,'applications',_0x3fe970['app']+_0x5bf2('0x1d')));}}_0x387d14[_0x5bf2('0x13')][_0x253552]=new RuleEngine(_0x588a15);_0x387d14['rules'][_0x253552]['execute'](_0x24d5bf,function(_0x3d7a54){logger[_0x5bf2('0x35')](_0x5bf2('0x3a'),JSON['stringify'](_0x3d7a54['matchPath']));if(_0x387d14[_0x5bf2('0x13')][_0x253552]){_0x387d14[_0x5bf2('0x13')][_0x253552][_0x5bf2('0x3b')]('complete');}});return _0x5d2d80({'code':0xc8,'message':_0x24d5bf});}else{if(_0x3a7594){logger[_0x5bf2('0x35')](util[_0x5bf2('0x2f')](_0x5bf2('0x3c'),_0x253552));}else{logger['info'](_0x5bf2('0x3d'));}return _0x5d2d80({'code':0xc8,'message':_0x24d5bf});}}catch(_0x293c4d){logger[_0x5bf2('0x3e')](_0x293c4d[_0x5bf2('0x3f')]);return _0x1fd79f(_0x47ce50['error'](0x1f4,_0x293c4d));}}return _0x1fd79f(_0x5bf2('0x40'));});},'AcceptMessage':function(_0x2e6d71){var _0x5ec8f6=this;return new Promise(function(_0x4ac78e,_0x41fe1b){if(_0x2e6d71[_0x5bf2('0x41')]&&_0x2e6d71[_0x5bf2('0x41')]['id']){if(_0x387d14[_0x5bf2('0x42')][_0x2e6d71[_0x5bf2('0x41')]['id']]){_0x387d14[_0x5bf2('0x42')][_0x2e6d71[_0x5bf2('0x41')]['id']][_0x5bf2('0x43')]=![];_0x387d14['agents'][_0x2e6d71[_0x5bf2('0x41')]['id']][_0x5bf2('0x44')]=undefined;}}if(_0x2e6d71['message']&&_0x2e6d71[_0x5bf2('0x15')]['id']){try{var _0x34f656=getId(_0x2e6d71[_0x5bf2('0x14')],_0x2e6d71[_0x5bf2('0x15')]?_0x2e6d71['message']['id']:0x0,_0x2e6d71[_0x5bf2('0x16')]?_0x2e6d71[_0x5bf2('0x16')]['id']:0x0);if(_0x387d14[_0x5bf2('0x13')][_0x34f656]){_0x387d14['rules'][_0x34f656][_0x5bf2('0x3b')](_0x5bf2('0x45'));if(rpc[_0x2e6d71[_0x5bf2('0x14')]+_0x5bf2('0x46')]){rpc[_0x2e6d71[_0x5bf2('0x14')]+_0x5bf2('0x46')][_0x5bf2('0x47')](_0x34f656,{'UserId':_0x2e6d71[_0x5bf2('0x15')][_0x5bf2('0x48')]})[_0x5bf2('0x49')](function(){logger[_0x5bf2('0x3e')](_0x5bf2('0x4a'));});}}return _0x4ac78e({'code':0xc8,'message':_0x2e6d71});}catch(_0x1e9189){logger['error'](_0x1e9189[_0x5bf2('0x3f')]);return _0x41fe1b(_0x5ec8f6[_0x5bf2('0x3e')](0x1f4,_0x1e9189));}}logger['error'](_0x5bf2('0x4b'));return _0x41fe1b(_0x5ec8f6[_0x5bf2('0x3e')](0x1f4,_0x5bf2('0x4b')));});},'RejectMessage':function(_0x8e1ff){var _0x56a953=this;return new Promise(function(_0x498cf6,_0x3d755f){if(_0x8e1ff[_0x5bf2('0x41')]&&_0x8e1ff[_0x5bf2('0x41')]['id']){try{if(_0x387d14[_0x5bf2('0x42')][_0x8e1ff['agent']['id']]){_0x387d14['agents'][_0x8e1ff[_0x5bf2('0x41')]['id']][_0x5bf2('0x43')]=![];_0x387d14[_0x5bf2('0x42')][_0x8e1ff[_0x5bf2('0x41')]['id']][_0x5bf2('0x44')]=undefined;}return _0x498cf6({'code':0xc8,'message':_0x8e1ff});}catch(_0x36d116){logger['error'](_0x36d116[_0x5bf2('0x3f')]);return _0x3d755f(_0x56a953[_0x5bf2('0x3e')](0x1f4,_0x36d116));}}logger[_0x5bf2('0x3e')]('message\x20is\x20empty');return _0x3d755f(_0x56a953['error'](0x1f4,_0x5bf2('0x4b')));});},'AbandonInteraction':function(_0x331a46){var _0x5a229a=this;return new Promise(function(_0x5382bf,_0xb42a52){if(_0x331a46[_0x5bf2('0x14')]&&_0x331a46[_0x5bf2('0x16')]&&_0x331a46[_0x5bf2('0x16')]['id']){try{var _0x5b63e2=getId(_0x331a46[_0x5bf2('0x14')],_0x331a46[_0x5bf2('0x15')]?_0x331a46[_0x5bf2('0x15')]['id']:0x0,_0x331a46[_0x5bf2('0x16')]?_0x331a46['interaction']['id']:0x0);if(_0x387d14['rules'][_0x5b63e2]){_0x387d14[_0x5bf2('0x13')][_0x5b63e2]['emit'](_0x5bf2('0x45'));}return _0x5382bf({'code':0xc8,'message':_0x331a46});}catch(_0x1ab7bb){logger[_0x5bf2('0x3e')](_0x1ab7bb[_0x5bf2('0x3f')]);return _0xb42a52(_0x5a229a[_0x5bf2('0x3e')](0x1f4,_0x1ab7bb));}}logger[_0x5bf2('0x3e')](_0x5bf2('0x4b'));return _0xb42a52(_0x5a229a[_0x5bf2('0x3e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x19d8fb){var _0x5eb8d7=this;return new Promise(function(_0x13c218,_0x3bc8a0){if(_0x387d14[_0x5bf2('0x42')][_0x5bf2('0x4c')](_0x19d8fb['id'])){for(var _0x453645 in _0x19d8fb[_0x5bf2('0x4d')]){if(_0x19d8fb[_0x5bf2('0x4d')][_0x5bf2('0x4c')](_0x453645)){if(_0x387d14[_0x5bf2('0x42')][_0x19d8fb['id']][_0x5bf2('0x4c')](_0x453645+_0x5bf2('0x4e'))){_0x387d14[_0x5bf2('0x42')][_0x19d8fb['id']][_0x453645+'CurrentCapacity']=parseInt(_0x19d8fb[_0x5bf2('0x4d')][_0x453645],0xa);}}}_0x387d14[_0x5bf2('0x42')][_0x19d8fb['id']][_0x5bf2('0x4f')]();return _0x13c218({'code':0xc8,'message':_0x387d14[_0x5bf2('0x42')][_0x19d8fb['id']]});}else{return _0x3bc8a0(_0x5eb8d7[_0x5bf2('0x3e')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1af55d){return new Promise(function(_0x42b8fe){var _0x32b4bb=_[_0x5bf2('0x50')](_0x387d14[_0x5bf2('0x42')]);if(_0x1af55d&&_0x1af55d['id']){var _0x5911e7=_[_0x5bf2('0x51')](_0x32b4bb,function(_0x1a21ee){return _0x1a21ee['id']===_0x1af55d['id'];});_0x42b8fe(_0x5911e7);}else{_0x42b8fe({'count':_0x32b4bb['length'],'rows':_0x32b4bb});}});},'ChatQueues':function(){return new Promise(function(_0x2b0d45){var _0x12c5e9=[];for(var _0x408efd in _0x387d14['chatQueues']){if(_0x387d14[_0x5bf2('0x52')]['hasOwnProperty'](_0x408efd)){var _0x4af4d2=_0x387d14[_0x5bf2('0x52')][_0x408efd];var _0x23b72f={'id':_0x4af4d2['id'],'available':_0x4af4d2[_0x5bf2('0x53')],'loggedIn':_0x4af4d2['loggedIn'],'name':_0x4af4d2[_0x5bf2('0x54')],'paused':_0x4af4d2[_0x5bf2('0x55')],'waiting':_0x4af4d2[_0x5bf2('0x56')]};_0x12c5e9[_0x5bf2('0x23')](_0x23b72f);}}_0x2b0d45({'count':_0x12c5e9[_0x5bf2('0x1b')],'rows':_0x12c5e9});});},'MailQueues':function(){return new Promise(function(_0xf37225){var _0x3a1caf=[];for(var _0x5efe73 in _0x387d14[_0x5bf2('0x57')]){if(_0x387d14[_0x5bf2('0x57')]['hasOwnProperty'](_0x5efe73)){var _0x295710=_0x387d14[_0x5bf2('0x57')][_0x5efe73];var _0x19800f={'id':_0x295710['id'],'available':_0x295710['available'],'loggedIn':_0x295710['loggedIn'],'name':_0x295710[_0x5bf2('0x54')],'paused':_0x295710[_0x5bf2('0x55')],'waiting':_0x295710[_0x5bf2('0x56')]};_0x3a1caf[_0x5bf2('0x23')](_0x19800f);}}_0xf37225({'count':_0x3a1caf[_0x5bf2('0x1b')],'rows':_0x3a1caf});});},'OpenchannelQueues':function(){return new Promise(function(_0x500105){var _0x4f0e3b=[];for(var _0x3b6a55 in _0x387d14[_0x5bf2('0x58')]){if(_0x387d14['openchannelQueues'][_0x5bf2('0x4c')](_0x3b6a55)){var _0x16d98d=_0x387d14[_0x5bf2('0x58')][_0x3b6a55];var _0x36e2e7={'id':_0x16d98d['id'],'available':_0x16d98d['available'],'loggedIn':_0x16d98d[_0x5bf2('0x59')],'name':_0x16d98d['name'],'paused':_0x16d98d[_0x5bf2('0x55')],'waiting':_0x16d98d[_0x5bf2('0x56')]};_0x4f0e3b[_0x5bf2('0x23')](_0x36e2e7);}}_0x500105({'count':_0x4f0e3b[_0x5bf2('0x1b')],'rows':_0x4f0e3b});});},'SmsQueues':function(){return new Promise(function(_0x533f41){var _0x9df48b=[];for(var _0xa3bbc2 in _0x387d14['smsQueues']){if(_0x387d14['smsQueues']['hasOwnProperty'](_0xa3bbc2)){var _0x4851f4=_0x387d14[_0x5bf2('0x5a')][_0xa3bbc2];var _0xa4918f={'id':_0x4851f4['id'],'available':_0x4851f4[_0x5bf2('0x53')],'loggedIn':_0x4851f4['loggedIn'],'name':_0x4851f4[_0x5bf2('0x54')],'paused':_0x4851f4['paused'],'waiting':_0x4851f4[_0x5bf2('0x56')]};_0x9df48b['push'](_0xa4918f);}}_0x533f41({'count':_0x9df48b[_0x5bf2('0x1b')],'rows':_0x9df48b});});},'FaxQueues':function(){return new Promise(function(_0x432dbc){var _0x258001=[];for(var _0x2de1a6 in _0x387d14[_0x5bf2('0x5b')]){if(_0x387d14['faxQueues'][_0x5bf2('0x4c')](_0x2de1a6)){var _0x40b955=_0x387d14['faxQueues'][_0x2de1a6];var _0xe02ada={'id':_0x40b955['id'],'available':_0x40b955['available'],'loggedIn':_0x40b955[_0x5bf2('0x59')],'name':_0x40b955[_0x5bf2('0x54')],'paused':_0x40b955[_0x5bf2('0x55')],'waiting':_0x40b955['waiting']};_0x258001[_0x5bf2('0x23')](_0xe02ada);}}_0x432dbc({'count':_0x258001[_0x5bf2('0x1b')],'rows':_0x258001});});},'WhatsappQueues':function(){return new Promise(function(_0x48ba31){var _0x10b48d=[];for(var _0x3fff58 in _0x387d14[_0x5bf2('0x5c')]){if(_0x387d14[_0x5bf2('0x5c')][_0x5bf2('0x4c')](_0x3fff58)){var _0x43c4b0=_0x387d14[_0x5bf2('0x5c')][_0x3fff58];var _0x37cad4={'id':_0x43c4b0['id'],'available':_0x43c4b0[_0x5bf2('0x53')],'loggedIn':_0x43c4b0[_0x5bf2('0x59')],'name':_0x43c4b0['name'],'paused':_0x43c4b0[_0x5bf2('0x55')],'waiting':_0x43c4b0[_0x5bf2('0x56')]};_0x10b48d['push'](_0x37cad4);}}_0x48ba31({'count':_0x10b48d['length'],'rows':_0x10b48d});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x29fce0){var _0x5b5708=_[_0x5bf2('0x50')](_0x387d14[_0x5bf2('0x5d')]);_0x29fce0({'count':_0x5b5708[_0x5bf2('0x1b')],'rows':_0x5b5708});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5061f3){var _0xa493d5=_['values'](_0x387d14[_0x5bf2('0x5e')]);_0x5061f3({'count':_0xa493d5[_0x5bf2('0x1b')],'rows':_0xa493d5});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3ce64d){var _0x1d37e4=_['values'](_0x387d14[_0x5bf2('0x5f')]);_0x3ce64d({'count':_0x1d37e4[_0x5bf2('0x1b')],'rows':_0x1d37e4});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3d72fe){var _0xcf0b6d=_[_0x5bf2('0x50')](_0x387d14[_0x5bf2('0x60')]);_0x3d72fe({'count':_0xcf0b6d[_0x5bf2('0x1b')],'rows':_0xcf0b6d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5c867f){var _0x3d67e5=_[_0x5bf2('0x50')](_0x387d14[_0x5bf2('0x61')]);_0x5c867f({'count':_0x3d67e5[_0x5bf2('0x1b')],'rows':_0x3d67e5});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5cc915){var _0x36484b=_[_0x5bf2('0x50')](_0x387d14[_0x5bf2('0x62')]);_0x5cc915({'count':_0x36484b[_0x5bf2('0x1b')],'rows':_0x36484b});});}};var _0x5907d4=jayson[_0x5bf2('0x63')](_0x1eae9e)['http']();_0x5907d4['on']('error',function(_0x1894fa){logger[_0x5bf2('0x3e')](JSON[_0x5bf2('0x64')](_0x1894fa));return _0x73c35a(_0x1894fa);});_0x5907d4[_0x5bf2('0x12')](0x232c,_0x5bf2('0x65'),function(){console[_0x5bf2('0x66')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x231e51('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e47dd14..81446c0 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 _0x6247=['condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','[%s][INTERVAL\x20VALID]\x20%s\x20%s','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','\x20|\x20','lodash','../../../utils/iftime','iftime','../../../config/logger','routing'];(function(_0x1282dc,_0x1cf453){var _0x37d4f2=function(_0x4dbc49){while(--_0x4dbc49){_0x1282dc['push'](_0x1282dc['shift']());}};_0x37d4f2(++_0x1cf453);}(_0x6247,0x19f));var _0x7624=function(_0x2aa20a,_0x5e7be1){_0x2aa20a=_0x2aa20a-0x0;var _0x2e8b56=_0x6247[_0x2aa20a];return _0x2e8b56;};'use strict';var _=require(_0x7624('0x0'));var iftime=require(_0x7624('0x1'))[_0x7624('0x2')];var logger=require(_0x7624('0x3'))(_0x7624('0x4'));exports[_0x7624('0x5')]=function(_0x1d59db,_0x197b08,_0x210e70){return function(_0x47531b){if(_0x210e70[_0x7624('0x6')]&&!_0x210e70['rules'][_0x1d59db]){logger[_0x7624('0x7')](_0x7624('0x8'),_0x1d59db);return _0x47531b[_0x7624('0x9')]();}var _0x504a74=_0x197b08[_0x7624('0xa')](function(_0x218199){return iftime(_0x218199);});var _0x5a397c=_['some'](_0x504a74);if(_0x5a397c){logger[_0x7624('0x7')](_0x7624('0xb'),_0x1d59db,_0x197b08['join']('\x20|\x20'),_0x5a397c);_0x47531b['when'](_0x5a397c);}else{logger['info'](_0x7624('0xc'),_0x1d59db,_0x197b08[_0x7624('0xd')](_0x7624('0xe')));_0x47531b[_0x7624('0x9')]();}};}; \ No newline at end of file +var _0x6f74=['some','info','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','when','\x20|\x20','stop','lodash','../../../utils/iftime','../../../config/logger','routing','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','map'];(function(_0x3a3a6a,_0x5eb6a9){var _0xa89294=function(_0x55d78c){while(--_0x55d78c){_0x3a3a6a['push'](_0x3a3a6a['shift']());}};_0xa89294(++_0x5eb6a9);}(_0x6f74,0x16f));var _0x46f7=function(_0x46c6b7,_0x48f8bb){_0x46c6b7=_0x46c6b7-0x0;var _0x561506=_0x6f74[_0x46c6b7];return _0x561506;};'use strict';var _=require(_0x46f7('0x0'));var iftime=require(_0x46f7('0x1'))['iftime'];var logger=require(_0x46f7('0x2'))(_0x46f7('0x3'));exports[_0x46f7('0x4')]=function(_0x4af6fe,_0x1f51f5,_0x83b2e7){return function(_0x5f12b4){if(_0x83b2e7[_0x46f7('0x5')]&&!_0x83b2e7[_0x46f7('0x5')][_0x4af6fe]){logger['info'](_0x46f7('0x6'),_0x4af6fe);return _0x5f12b4['stop']();}var _0x3dc19b=_0x1f51f5[_0x46f7('0x7')](function(_0x466acb){return iftime(_0x466acb);});var _0x3f56ad=_[_0x46f7('0x8')](_0x3dc19b);if(_0x3f56ad){logger[_0x46f7('0x9')](_0x46f7('0xa'),_0x4af6fe,_0x1f51f5[_0x46f7('0xb')]('\x20|\x20'),_0x3f56ad);_0x5f12b4[_0x46f7('0xc')](_0x3f56ad);}else{logger[_0x46f7('0x9')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x4af6fe,_0x1f51f5[_0x46f7('0xb')](_0x46f7('0xd')));_0x5f12b4[_0x46f7('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7f41489..f705d78 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 _0x9348=['clone','calleridname','transfer','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agentcomplete','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','uniqueid','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid'];(function(_0x350387,_0x475458){var _0x15ff04=function(_0x6f47ae){while(--_0x6f47ae){_0x350387['push'](_0x350387['shift']());}};_0x15ff04(++_0x475458);}(_0x9348,0x10d));var _0x8934=function(_0x430f87,_0x31ec33){_0x430f87=_0x430f87-0x0;var _0x412dc7=_0x9348[_0x430f87];return _0x412dc7;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var utils=require(_0x8934('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x135b2c,_0x46a231){utils['info'](util[_0x8934('0x3')](_0x8934('0x4'),_0x135b2c['uniqueid'],_0x135b2c[_0x8934('0x5')],_0x135b2c[_0x8934('0x6')],_0x135b2c[_0x8934('0x7')],_0x135b2c[_0x8934('0x8')],_0x135b2c[_0x8934('0x9')],_0x135b2c[_0x8934('0xa')],_0x135b2c['lastevent']));if(_0x135b2c[_0x8934('0x6')]){utils[_0x8934('0xb')](_0x135b2c[_0x8934('0x6')])['then'](function(_0x4b470d){if(_0x4b470d){_0x135b2c['type']=_0x4b470d['type'];_0x135b2c[_0x8934('0xc')]=_0x135b2c['agentcomplete']?_0x4b470d[_0x8934('0xd')]:![];_0x135b2c[_0x8934('0xe')]=_0x135b2c[_0x8934('0xc')]?_0x4b470d[_0x8934('0xf')]:0x0;}utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);});}else{utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);}if(_0x46a231){delete transfers[_0x135b2c['uniqueid']];}else{delete agents[_0x135b2c[_0x8934('0x12')]];}}exports[_0x8934('0x13')]=function(_0x46bca5){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0x46bca5);agents[_0x46bca5[_0x8934('0x12')]]=_0x46bca5;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x19');agents[_0x46bca5[_0x8934('0x12')]]['connectedlinenum']=null;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x1a')]=null;utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x46bca5['uniqueid'],agents[_0x46bca5[_0x8934('0x12')]]['membername'],_0x46bca5[_0x8934('0x12')]));}catch(_0xa9c394){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0xa9c394);}};exports[_0x8934('0x1d')]=function(_0x5ae49f){try{if(!_[_0x8934('0x1e')](agents[_0x5ae49f[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x5ae49f);utils[_0x8934('0x1b')](util['format'](_0x8934('0x21'),_0x5ae49f[_0x8934('0x20')],agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x7')],_0x5ae49f[_0x8934('0x12')]));agents[_0x5ae49f['destuniqueid']][_0x8934('0x1d')]=!![];agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x22')]=utils['now']();agents[_0x5ae49f[_0x8934('0x12')]]['lastevent']=_0x8934('0x23');agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x24')]='timeout';agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x25')]=_0x5ae49f[_0x8934('0x26')]?parseInt(_0x5ae49f[_0x8934('0x26')])/0x3e8:0x0;agents[_0x5ae49f['destuniqueid']][_0x8934('0x27')]=0x0;unanswered[_0x8934('0x28')](_0x5ae49f[_0x8934('0x12')]);}}catch(_0x3d93c7){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x3d93c7);}};exports[_0x8934('0x29')]=function(_0x18938a){try{_['forIn'](agents,function(_0x1d068c,_0x3e973e){if(_0x1d068c['uniqueid']==_0x18938a[_0x8934('0x20')]&&!_[_0x8934('0x2a')](unanswered,_0x1d068c[_0x8934('0x12')])){utils[_0x8934('0x14')](util['format'](_0x8934('0x2b'),_0x18938a[_0x8934('0x20')]),_0x18938a);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2c'),_0x18938a['uniqueid'],_0x1d068c[_0x8934('0x7')],_0x1d068c['destuniqueid']));_0x1d068c['agentringnoanswer']=!![];_0x1d068c[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x1d068c[_0x8934('0x18')]=_0x8934('0x2d');_0x1d068c['reason']=_0x8934('0x2d');_0x1d068c[_0x8934('0x25')]=_0x18938a[_0x8934('0x25')];_0x1d068c[_0x8934('0x27')]=0x0;writeDB(_0x1d068c);}});}catch(_0x7b2a1c){utils['error'](util[_0x8934('0x3')](_0x8934('0x2b'),_0x18938a['uniqueid']),_0x7b2a1c);}};exports['agentconnect']=function(_0x845028){try{if(agents[_0x845028[_0x8934('0x12')]]){utils['debug'](util['format'](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x845028);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2f'),_0x845028[_0x8934('0x20')],agents[_0x845028[_0x8934('0x12')]][_0x8934('0x7')],_0x845028[_0x8934('0x12')]));agents[_0x845028[_0x8934('0x12')]][_0x8934('0x30')]=utils['now']();agents[_0x845028[_0x8934('0x12')]][_0x8934('0xa')]=_0x845028['connectedlinenum'];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x1a')]=_0x845028[_0x8934('0x1a')];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x25')]=_0x845028['ringtime'];agents[_0x845028['destuniqueid']]['lastevent']=_0x8934('0x31');_[_0x8934('0x32')](agents,function(_0x8814f6,_0x53581b){if(_0x8814f6[_0x8934('0x12')]!=_0x845028['destuniqueid']&&_0x8814f6['uniqueid']==_0x845028[_0x8934('0x20')]){_0x8814f6[_0x8934('0x27')]=0x0;_0x8814f6['holdtime']=_0x845028['ringtime'];_0x8814f6[_0x8934('0x1d')]=!![];_0x8814f6[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x8814f6['lastevent']=_0x8934('0x33');_0x8814f6['reason']=_0x8934('0x33');_0x8814f6['answeredelsewheredestinationuniqueid']=_0x845028[_0x8934('0x12')];_0x8814f6[_0x8934('0x34')]=_0x845028[_0x8934('0x7')];writeDB(_0x8814f6);}});}}catch(_0x566d67){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x566d67);}};exports['agentcomplete']=function(_0x2182db){try{if(!_[_0x8934('0x1e')](agents[_0x2182db[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0x2182db);utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2182db['uniqueid'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x7')],_0x2182db['destuniqueid']));agents[_0x2182db[_0x8934('0x12')]]['agentcomplete']=!![];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x36')]=utils['now']();agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x2182db[_0x8934('0x12')]]['agentcompleteAt'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x30')]);agents[_0x2182db['destuniqueid']][_0x8934('0x24')]=_0x2182db[_0x8934('0x24')];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x38');writeDB(agents[_0x2182db[_0x8934('0x12')]]);}}catch(_0xa45543){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0xa45543);}};exports[_0x8934('0x39')]=function(_0x2c322d){try{if(!_[_0x8934('0x1e')](agents[_0x2c322d[_0x8934('0x3a')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x3b'),_0x2c322d['uniqueid']),_0x2c322d);utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c322d['uniqueid'],agents[_0x2c322d['transfereruniqueid']]['membername'],agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')]));agents[_0x2c322d[_0x8934('0x3a')]]['transfer']=!![];agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3c')]='blind';agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3d')]=_0x2c322d[_0x8934('0x3e')];agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x3f')]=agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')];}}catch(_0x3902fb){utils['error'](util[_0x8934('0x3')]('[%s][agents][blindtransfer]',_0x2c322d[_0x8934('0x20')]),_0x3902fb);}};exports[_0x8934('0x40')]=function(_0x2d776a){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x41'),_0x2d776a[_0x8934('0x42')]),_0x2d776a);if(_0x2d776a[_0x8934('0x42')]==_0x2d776a['origtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x43')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a['origtransfereruniqueid'],agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x7')]));agents[_0x2d776a[_0x8934('0x43')]]['transfer']=!![];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a['secondtransfereruniqueid']]['transferexten']=_0x2d776a['origtransfererexten'];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x42')];}if(_0x2d776a['transfereeuniqueid']&&agents[_0x2d776a[_0x8934('0x46')]]){agents[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x1;transfers[_0x2d776a['transfereeuniqueid']]=_[_0x8934('0x47')](agents[_0x2d776a[_0x8934('0x46')]]);transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x9')]=agents[_0x2d776a['secondtransfereruniqueid']]['calleridnum'];transfers[_0x2d776a['transfereeuniqueid']]['calleridname']=agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['agentconnectAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x2;}}else if(_0x2d776a[_0x8934('0x43')]==_0x2d776a['secondtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x42')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a[_0x8934('0x42')],agents[_0x2d776a[_0x8934('0x42')]]['membername']));agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x49')]=!![];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3d')]=_0x2d776a[_0x8934('0x4a')];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x43')];}if(_0x2d776a[_0x8934('0x4b')]&&agents[_0x2d776a[_0x8934('0x4b')]]){agents[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x1;transfers[_0x2d776a['transfertargetuniqueid']]=_['clone'](agents[_0x2d776a[_0x8934('0x4b')]]);transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x9')]=agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x9')];transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x48')]=agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x4b')]]['agentcalledAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a['transfertargetuniqueid']][_0x8934('0x30')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x4b')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x2;}}}catch(_0x544fa7){utils[_0x8934('0x1c')](util['format'](_0x8934('0x41'),_0x2d776a['origtransfereruniqueid']),_0x544fa7);}};exports[_0x8934('0x4d')]=function(_0x6b3376){try{utils[_0x8934('0x14')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x6b3376);if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]]['reason']===_0x8934('0x23')){if(_0x6b3376['cause']==='21'){agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=_0x8934('0x4f');agents[_0x6b3376[_0x8934('0x20')]]['lastevent']=_0x8934('0x4f');}utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376['uniqueid']]['reason'],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);var _0x1efd58=unanswered[_0x8934('0x50')](_0x6b3376[_0x8934('0x20')]);if(_0x1efd58>-0x1){unanswered[_0x8934('0x51')](_0x1efd58,0x1);}}if(transfers[_0x6b3376[_0x8934('0x20')]]){transfers[_0x6b3376[_0x8934('0x20')]]['agentcomplete']=!![];transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils['diffTime'](transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')],transfers[_0x6b3376['uniqueid']][_0x8934('0x30')]);transfers[_0x6b3376['uniqueid']]['reason']='agent';transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]=_0x8934('0x38');utils['info'](util[_0x8934('0x3')](_0x8934('0x52'),_0x6b3376['uniqueid'],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(transfers[_0x6b3376[_0x8934('0x20')]],!![]);}if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]){agents[_0x6b3376['uniqueid']][_0x8934('0x53')]=!![];agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x6b3376['uniqueid']][_0x8934('0x36')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]);agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x49')]?_0x8934('0x49'):_0x8934('0x54');agents[_0x6b3376['uniqueid']]['lastevent']=_0x8934('0x38');utils[_0x8934('0x1b')](util['format'](_0x8934('0x52'),_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);}}catch(_0x2d094e){utils[_0x8934('0x1c')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x2d094e);}}; \ No newline at end of file +var _0xd404=['channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned','agentconnect','info','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','secondtransfererlinkedid','transfertargetuniqueid','calleridname','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','diffTime','agent','complete','[%s][agents][hangup]','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd404,0x15b));var _0x4d40=function(_0x150b9b,_0x553afd){_0x150b9b=_0x150b9b-0x0;var _0x61b861=_0xd404[_0x150b9b];return _0x61b861;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xb6576c,_0x2322e5){utils['info'](util[_0x4d40('0x2')](_0x4d40('0x3'),_0xb6576c[_0x4d40('0x4')],_0xb6576c[_0x4d40('0x5')],_0xb6576c[_0x4d40('0x6')],_0xb6576c[_0x4d40('0x7')],_0xb6576c[_0x4d40('0x8')],_0xb6576c[_0x4d40('0x9')],_0xb6576c[_0x4d40('0xa')],_0xb6576c['lastevent']));if(_0xb6576c[_0x4d40('0x6')]){utils[_0x4d40('0xb')](_0xb6576c['queue'])[_0x4d40('0xc')](function(_0x5e31bc){if(_0x5e31bc){_0xb6576c['type']=_0x5e31bc[_0x4d40('0xd')];_0xb6576c[_0x4d40('0xe')]=_0xb6576c[_0x4d40('0xf')]?_0x5e31bc[_0x4d40('0x10')]:![];_0xb6576c[_0x4d40('0x11')]=_0xb6576c[_0x4d40('0xe')]?_0x5e31bc[_0x4d40('0x12')]:0x0;}utils[_0x4d40('0x13')](_0x4d40('0x14'),_0xb6576c);});}else{utils[_0x4d40('0x13')](_0x4d40('0x14'),_0xb6576c);}if(_0x2322e5){delete transfers[_0xb6576c[_0x4d40('0x4')]];}else{delete agents[_0xb6576c[_0x4d40('0x15')]];}}exports[_0x4d40('0x16')]=function(_0x5162f9){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x18'),_0x5162f9[_0x4d40('0x4')]),_0x5162f9);agents[_0x5162f9[_0x4d40('0x15')]]=_0x5162f9;agents[_0x5162f9['destuniqueid']][_0x4d40('0x19')]=utils[_0x4d40('0x1a')]();agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0x1b')]=_0x4d40('0x1c');agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0xa')]=null;agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0x1d')]=null;utils['info'](util['format'](_0x4d40('0x1e'),_0x5162f9[_0x4d40('0x4')],agents[_0x5162f9['destuniqueid']][_0x4d40('0x7')],_0x5162f9[_0x4d40('0x15')]));}catch(_0x4eec1d){utils[_0x4d40('0x1f')](util['format'](_0x4d40('0x18'),_0x5162f9[_0x4d40('0x4')]),_0x4eec1d);}};exports['agentringnoanswer']=function(_0x57c997){try{if(!_[_0x4d40('0x20')](agents[_0x57c997[_0x4d40('0x15')]])){utils['debug'](util[_0x4d40('0x2')](_0x4d40('0x21'),_0x57c997[_0x4d40('0x4')]),_0x57c997);utils['info'](util[_0x4d40('0x2')](_0x4d40('0x22'),_0x57c997[_0x4d40('0x4')],agents[_0x57c997['destuniqueid']]['membername'],_0x57c997[_0x4d40('0x15')]));agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x23')]=!![];agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x24')]=utils['now']();agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x1b')]='timeout';agents[_0x57c997['destuniqueid']][_0x4d40('0x25')]=_0x4d40('0x26');agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x27')]=_0x57c997[_0x4d40('0x28')]?parseInt(_0x57c997[_0x4d40('0x28')])/0x3e8:0x0;agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x29')]=0x0;unanswered[_0x4d40('0x2a')](_0x57c997[_0x4d40('0x15')]);}}catch(_0x1c0fcf){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x57c997[_0x4d40('0x4')]),_0x1c0fcf);}};exports[_0x4d40('0x2b')]=function(_0x1ac240){try{_[_0x4d40('0x2c')](agents,function(_0x598ca9,_0x18e601){if(_0x598ca9[_0x4d40('0x4')]==_0x1ac240[_0x4d40('0x4')]&&!_['includes'](unanswered,_0x598ca9[_0x4d40('0x15')])){utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x2d'),_0x1ac240[_0x4d40('0x4')]),_0x1ac240);utils['info'](util[_0x4d40('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ac240[_0x4d40('0x4')],_0x598ca9[_0x4d40('0x7')],_0x598ca9[_0x4d40('0x15')]));_0x598ca9[_0x4d40('0x23')]=!![];_0x598ca9['agentringnoanswerAt']=utils['now']();_0x598ca9[_0x4d40('0x1b')]=_0x4d40('0x2e');_0x598ca9[_0x4d40('0x25')]=_0x4d40('0x2e');_0x598ca9['holdtime']=_0x1ac240[_0x4d40('0x27')];_0x598ca9['talktime']=0x0;writeDB(_0x598ca9);}});}catch(_0x2fde16){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')](_0x4d40('0x2d'),_0x1ac240[_0x4d40('0x4')]),_0x2fde16);}};exports[_0x4d40('0x2f')]=function(_0x1d1ba9){try{if(agents[_0x1d1ba9[_0x4d40('0x15')]]){utils[_0x4d40('0x17')](util[_0x4d40('0x2')]('[%s][agents][agentconnect]',_0x1d1ba9[_0x4d40('0x4')]),_0x1d1ba9);utils[_0x4d40('0x30')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1d1ba9['uniqueid'],agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x7')],_0x1d1ba9['destuniqueid']));agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x31')]=utils[_0x4d40('0x1a')]();agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0xa')]=_0x1d1ba9['connectedlinenum'];agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x1d')]=_0x1d1ba9['connectedlinename'];agents[_0x1d1ba9['destuniqueid']][_0x4d40('0x27')]=_0x1d1ba9[_0x4d40('0x28')];agents[_0x1d1ba9['destuniqueid']][_0x4d40('0x1b')]=_0x4d40('0x32');_['forIn'](agents,function(_0x1e8427,_0x1a9586){if(_0x1e8427['destuniqueid']!=_0x1d1ba9[_0x4d40('0x15')]&&_0x1e8427[_0x4d40('0x4')]==_0x1d1ba9['uniqueid']){_0x1e8427[_0x4d40('0x29')]=0x0;_0x1e8427['holdtime']=_0x1d1ba9[_0x4d40('0x28')];_0x1e8427[_0x4d40('0x23')]=!![];_0x1e8427[_0x4d40('0x24')]=utils[_0x4d40('0x1a')]();_0x1e8427[_0x4d40('0x1b')]=_0x4d40('0x33');_0x1e8427[_0x4d40('0x25')]=_0x4d40('0x33');_0x1e8427[_0x4d40('0x34')]=_0x1d1ba9['destuniqueid'];_0x1e8427[_0x4d40('0x35')]=_0x1d1ba9[_0x4d40('0x7')];writeDB(_0x1e8427);}});}}catch(_0x1c2fa8){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')]('[%s][agents][agentconnect]',_0x1d1ba9[_0x4d40('0x4')]),_0x1c2fa8);}};exports['agentcomplete']=function(_0x2e7f75){try{if(!_[_0x4d40('0x20')](agents[_0x2e7f75[_0x4d40('0x15')]])){utils[_0x4d40('0x17')](util['format'](_0x4d40('0x36'),_0x2e7f75[_0x4d40('0x4')]),_0x2e7f75);utils['info'](util[_0x4d40('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2e7f75[_0x4d40('0x4')],agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x7')],_0x2e7f75[_0x4d40('0x15')]));agents[_0x2e7f75['destuniqueid']][_0x4d40('0xf')]=!![];agents[_0x2e7f75['destuniqueid']][_0x4d40('0x37')]=utils[_0x4d40('0x1a')]();agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x29')]=utils['diffTime'](agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x37')],agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x31')]);agents[_0x2e7f75['destuniqueid']][_0x4d40('0x25')]=_0x2e7f75[_0x4d40('0x25')];agents[_0x2e7f75['destuniqueid']][_0x4d40('0x1b')]='complete';writeDB(agents[_0x2e7f75[_0x4d40('0x15')]]);}}catch(_0x1777e8){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')](_0x4d40('0x36'),_0x2e7f75[_0x4d40('0x4')]),_0x1777e8);}};exports[_0x4d40('0x38')]=function(_0x37b6bf){try{if(!_[_0x4d40('0x20')](agents[_0x37b6bf['transfereruniqueid']])){utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x39'),_0x37b6bf[_0x4d40('0x4')]),_0x37b6bf);utils[_0x4d40('0x30')](util['format'](_0x4d40('0x3a'),_0x37b6bf[_0x4d40('0x4')],agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x7')],agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x4')]));agents[_0x37b6bf[_0x4d40('0x3b')]][_0x4d40('0x3c')]=!![];agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x3d')]=_0x4d40('0x3e');agents[_0x37b6bf[_0x4d40('0x3b')]][_0x4d40('0x3f')]=_0x37b6bf[_0x4d40('0x40')];agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x41')]=agents[_0x37b6bf[_0x4d40('0x3b')]]['uniqueid'];}}catch(_0x1000f4){utils['error'](util[_0x4d40('0x2')]('[%s][agents][blindtransfer]',_0x37b6bf[_0x4d40('0x4')]),_0x1000f4);}};exports[_0x4d40('0x42')]=function(_0x539df4){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x43'),_0x539df4[_0x4d40('0x44')]),_0x539df4);if(_0x539df4[_0x4d40('0x44')]==_0x539df4[_0x4d40('0x45')]){if(!_[_0x4d40('0x20')](agents[_0x539df4[_0x4d40('0x46')]])){utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x47'),_0x539df4[_0x4d40('0x44')],agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x7')]));agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x3c')]=!![];agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x3d')]=_0x4d40('0x48');agents[_0x539df4['secondtransfereruniqueid']][_0x4d40('0x3f')]=_0x539df4[_0x4d40('0x49')];agents[_0x539df4['secondtransfereruniqueid']]['transferuniqueid']=_0x539df4[_0x4d40('0x44')];}if(_0x539df4[_0x4d40('0x4a')]&&agents[_0x539df4['transfereeuniqueid']]){agents[_0x539df4['transfereeuniqueid']][_0x4d40('0x4b')]=0x1;transfers[_0x539df4['transfereeuniqueid']]=_[_0x4d40('0x4c')](agents[_0x539df4['transfereeuniqueid']]);transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x9')]=agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x9')];transfers[_0x539df4[_0x4d40('0x4a')]]['calleridname']=agents[_0x539df4['secondtransfereruniqueid']]['calleridname'];transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x19')]=utils[_0x4d40('0x1a')]();transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x31')]=utils['now']();transfers[_0x539df4[_0x4d40('0x4a')]]['holdtime']=0x0;transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x4b')]=0x2;}}else if(_0x539df4[_0x4d40('0x46')]==_0x539df4[_0x4d40('0x4d')]){if(!_[_0x4d40('0x20')](agents[_0x539df4[_0x4d40('0x44')]])){utils['info'](util['format'](_0x4d40('0x47'),_0x539df4[_0x4d40('0x44')],agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x7')]));agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x3c')]=!![];agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x3d')]='ATTENDED';agents[_0x539df4[_0x4d40('0x44')]]['transferexten']=_0x539df4['secondtransfererexten'];agents[_0x539df4['origtransfereruniqueid']][_0x4d40('0x41')]=_0x539df4[_0x4d40('0x46')];}if(_0x539df4[_0x4d40('0x4e')]&&agents[_0x539df4[_0x4d40('0x4e')]]){agents[_0x539df4['transfertargetuniqueid']][_0x4d40('0x4b')]=0x1;transfers[_0x539df4[_0x4d40('0x4e')]]=_[_0x4d40('0x4c')](agents[_0x539df4[_0x4d40('0x4e')]]);transfers[_0x539df4[_0x4d40('0x4e')]]['calleridnum']=agents[_0x539df4['origtransfereruniqueid']][_0x4d40('0x9')];transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x4f')]=agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x4f')];transfers[_0x539df4['transfertargetuniqueid']]['agentcalledAt']=utils[_0x4d40('0x1a')]();transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x31')]=utils[_0x4d40('0x1a')]();transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x27')]=0x0;transfers[_0x539df4[_0x4d40('0x4e')]][_0x4d40('0x4b')]=0x2;}}}catch(_0x3bce3d){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')]('[%s][agents][attendedtransfer]',_0x539df4['origtransfereruniqueid']),_0x3bce3d);}};exports['hangup']=function(_0x13872b){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')]('[%s][agents][hangup]',_0x13872b[_0x4d40('0x4')]),_0x13872b);if(agents[_0x13872b[_0x4d40('0x4')]]&&agents[_0x13872b['uniqueid']]['reason']===_0x4d40('0x26')){if(_0x13872b[_0x4d40('0x50')]==='21'){agents[_0x13872b['uniqueid']][_0x4d40('0x25')]=_0x4d40('0x51');agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]=_0x4d40('0x51');}utils[_0x4d40('0x30')](util['format'](_0x4d40('0x52'),_0x13872b['uniqueid'],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x7')],agents[_0x13872b['uniqueid']][_0x4d40('0x25')],agents[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(agents[_0x13872b[_0x4d40('0x4')]]);var _0x7df23=unanswered['indexOf'](_0x13872b[_0x4d40('0x4')]);if(_0x7df23>-0x1){unanswered[_0x4d40('0x53')](_0x7df23,0x1);}}if(transfers[_0x13872b[_0x4d40('0x4')]]){transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0xf')]=!![];transfers[_0x13872b['uniqueid']][_0x4d40('0x37')]=utils[_0x4d40('0x1a')]();transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x29')]=utils[_0x4d40('0x54')](transfers[_0x13872b[_0x4d40('0x4')]]['agentcompleteAt'],transfers[_0x13872b[_0x4d40('0x4')]]['agentconnectAt']);transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x25')]=_0x4d40('0x55');transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]='complete';utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x52'),_0x13872b[_0x4d40('0x4')],transfers[_0x13872b['uniqueid']][_0x4d40('0x7')],transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x25')],transfers[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(transfers[_0x13872b[_0x4d40('0x4')]],!![]);}if(agents[_0x13872b['uniqueid']]&&agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x31')]){agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0xf')]=!![];agents[_0x13872b['uniqueid']]['agentcompleteAt']=utils[_0x4d40('0x1a')]();agents[_0x13872b[_0x4d40('0x4')]]['talktime']=utils[_0x4d40('0x54')](agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x37')],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x31')]);agents[_0x13872b['uniqueid']][_0x4d40('0x25')]=agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x3c')]?_0x4d40('0x3c'):_0x4d40('0x55');agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]=_0x4d40('0x56');utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x52'),_0x13872b['uniqueid'],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x7')],agents[_0x13872b['uniqueid']][_0x4d40('0x25')],agents[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(agents[_0x13872b['uniqueid']]);}}catch(_0x33b8f3){utils[_0x4d40('0x1f')](util['format'](_0x4d40('0x57'),_0x13872b[_0x4d40('0x4')]),_0x33b8f3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 27ccd04..419fe46 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 _0x37d1=['channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','error','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','variable','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid'];(function(_0x596680,_0x4e883a){var _0xc7c907=function(_0x7fa9b8){while(--_0x7fa9b8){_0x596680['push'](_0x596680['shift']());}};_0xc7c907(++_0x4e883a);}(_0x37d1,0xd8));var _0x137d=function(_0x52afd3,_0x2ee6ed){_0x52afd3=_0x52afd3-0x0;var _0x480668=_0x37d1[_0x52afd3];return _0x480668;};'use strict';var _=require(_0x137d('0x0'));var util=require(_0x137d('0x1'));var utils=require('./utils');var dispositions=[_0x137d('0x2'),'FAILED',_0x137d('0x3'),_0x137d('0x2'),'NO\x20ANSWER',_0x137d('0x2'),_0x137d('0x4'),'BUSY',_0x137d('0x3'),_0x137d('0x3'),_0x137d('0x3')];var channels={};function writeDB(_0x515f6b){utils['info'](util[_0x137d('0x5')](_0x137d('0x6'),_0x515f6b[_0x137d('0x7')],_0x515f6b[_0x137d('0x8')],_0x515f6b[_0x137d('0x9')],_0x515f6b[_0x137d('0xa')],_0x515f6b[_0x137d('0xb')],_0x515f6b[_0x137d('0xc')],_0x515f6b[_0x137d('0xd')],_0x515f6b[_0x137d('0xe')]));if(_0x515f6b[_0x137d('0xf')]){utils[_0x137d('0x10')](_0x515f6b[_0x137d('0xf')])[_0x137d('0x11')](function(_0xfaad6c){if(_0xfaad6c){_0x515f6b[_0x137d('0x12')]=_0xfaad6c['id'];}utils['request'](_0x137d('0x13'),_0x515f6b);});}else{utils[_0x137d('0x14')](_0x137d('0x13'),_0x515f6b);}if(channels[_0x515f6b[_0x137d('0x7')]]){delete channels[_0x515f6b['uniqueid']];}}exports[_0x137d('0x15')]=function(_0x471d2d){try{utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x17'),_0x471d2d[_0x137d('0x7')]),_0x471d2d);if(_0x471d2d[_0x137d('0x7')]==_0x471d2d[_0x137d('0x18')]&&_0x471d2d['channel']!=_0x137d('0x19')){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x1b'),_0x471d2d[_0x137d('0x7')],_0x471d2d['context'],_0x471d2d[_0x137d('0x1c')]));channels[_0x471d2d[_0x137d('0x7')]]={'uniqueid':_0x471d2d['uniqueid'],'accountcode':_0x471d2d[_0x137d('0xf')],'source':_0x471d2d['calleridnum'],'destination':_0x471d2d[_0x137d('0x1c')],'destinationcontext':_0x471d2d[_0x137d('0x1d')],'channel':_0x471d2d['channel'],'starttime':utils[_0x137d('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x137d('0x2'),'amaflags':_0x137d('0x1f')};}}catch(_0x3e8814){utils['error'](util[_0x137d('0x5')](_0x137d('0x17'),_0x471d2d['uniqueid']),_0x3e8814);}};exports[_0x137d('0x20')]=function(_0x2d0be9){try{utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x21'),_0x2d0be9['uniqueid']),_0x2d0be9);if(!_[_0x137d('0x22')](channels[_0x2d0be9['uniqueid']])&&_0x2d0be9[_0x137d('0x23')]==0x6){utils[_0x137d('0x1a')](util['format'](_0x137d('0x24'),_0x2d0be9['uniqueid'],_0x2d0be9['context'],_0x2d0be9[_0x137d('0x8')]));if(_[_0x137d('0x22')](channels[_0x2d0be9[_0x137d('0x7')]]['systemanswertime'])){channels[_0x2d0be9[_0x137d('0x7')]][_0x137d('0x25')]=utils[_0x137d('0x1e')]();}}else if(!_['isNil'](channels[_0x2d0be9[_0x137d('0x18')]])&&_0x2d0be9[_0x137d('0x23')]==0x6&&_0x2d0be9[_0x137d('0x1d')]!=_0x137d('0x26')){utils[_0x137d('0x1a')](util['format'](_0x137d('0x27'),_0x2d0be9[_0x137d('0x7')],_0x2d0be9[_0x137d('0x18')],_0x2d0be9[_0x137d('0x1d')],_0x2d0be9[_0x137d('0x8')]));channels[_0x2d0be9[_0x137d('0x18')]][_0x137d('0xf')]=_0x2d0be9[_0x137d('0xf')];channels[_0x2d0be9[_0x137d('0x18')]][_0x137d('0x28')]=_0x2d0be9[_0x137d('0x8')];if(_['isNil'](channels[_0x2d0be9[_0x137d('0x18')]][_0x137d('0x29')])){channels[_0x2d0be9[_0x137d('0x18')]]['answertime']=utils['now']();}channels[_0x2d0be9[_0x137d('0x18')]]['disposition']=dispositions[_[_0x137d('0x2a')](_0x2d0be9['channelstate'])]||_0x137d('0x4');}}catch(_0x29dfef){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x21'),_0x2d0be9['uniqueid']),_0x29dfef);}};exports['hangup']=function(_0x58fc63){try{if(!_[_0x137d('0x22')](channels[_0x58fc63[_0x137d('0x7')]])){utils['debug'](util[_0x137d('0x5')]('[%s][calls][hangup]',_0x58fc63[_0x137d('0x7')]),_0x58fc63);if(_[_0x137d('0x22')](channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2c')])){channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2c')]=_0x58fc63[_0x137d('0x2d')]+'\x20<'+_0x58fc63[_0x137d('0xc')]+'>';}utils[_0x137d('0x1a')](util[_0x137d('0x5')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x58fc63[_0x137d('0x7')],channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2c')],_0x58fc63[_0x137d('0x2e')]));channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x2f')]=utils[_0x137d('0x1e')]();channels[_0x58fc63['uniqueid']][_0x137d('0x30')]=utils[_0x137d('0x31')](channels[_0x58fc63[_0x137d('0x7')]]['endtime'],channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x32')]);channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x33')]=channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x29')]?utils['diffTime'](channels[_0x58fc63[_0x137d('0x7')]]['endtime'],channels[_0x58fc63[_0x137d('0x7')]][_0x137d('0x29')]):0x0;writeDB(channels[_0x58fc63['uniqueid']]);}}catch(_0x47ea1f){utils[_0x137d('0x2b')](util['format'](_0x137d('0x34'),_0x58fc63[_0x137d('0x7')]),_0x47ea1f);}};exports[_0x137d('0x35')]=function(_0xa87abb){try{if(!_[_0x137d('0x22')](channels[_0xa87abb['localtwolinkedid']])){utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x36'),_0xa87abb[_0x137d('0x37')]),_0xa87abb);if(channels[_0xa87abb[_0x137d('0x38')]][_0x137d('0x8')]==_0xa87abb[_0x137d('0x39')]){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x3a'),_0xa87abb['origtransfereruniqueid'],_0xa87abb[_0x137d('0x38')],_0xa87abb[_0x137d('0x3b')]));channels[_0xa87abb['localtwolinkedid']][_0x137d('0x28')]=_0xa87abb[_0x137d('0x3b')];channels[_0xa87abb['localtwolinkedid']]['userfield']=_0x137d('0x3c');}else if(channels[_0xa87abb[_0x137d('0x38')]]['channel']=_0xa87abb[_0x137d('0x3d')]){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x3a'),_0xa87abb[_0x137d('0x37')],_0xa87abb[_0x137d('0x38')],_0xa87abb[_0x137d('0x3e')]));channels[_0xa87abb[_0x137d('0x38')]][_0x137d('0x28')]=_0xa87abb[_0x137d('0x3e')];channels[_0xa87abb[_0x137d('0x38')]][_0x137d('0x3f')]=_0x137d('0x3c');}}}catch(_0x2f730d){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x36'),_0xa87abb[_0x137d('0x37')]),_0x2f730d);}};exports[_0x137d('0x40')]=function(_0x2e3e38){try{if(!_[_0x137d('0x22')](channels[_0x2e3e38[_0x137d('0x7')]])){utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x41'),_0x2e3e38['uniqueid']),_0x2e3e38);channels[_0x2e3e38[_0x137d('0x7')]][_0x137d('0x42')]=utils[_0x137d('0x1e')]();utils[_0x137d('0x1a')](util['format'](_0x137d('0x43'),_0x2e3e38[_0x137d('0x7')],channels[_0x2e3e38[_0x137d('0x7')]][_0x137d('0x42')]));}}catch(_0x49ae2b){utils['error'](util[_0x137d('0x5')](_0x137d('0x41'),_0x2e3e38['uniqueid']),_0x49ae2b);}};exports[_0x137d('0x44')]=function(_0x119307){try{if(!_['isNil'](channels[_0x119307['uniqueid']])){utils[_0x137d('0x16')](util[_0x137d('0x5')](_0x137d('0x45'),_0x119307['uniqueid']),_0x119307);if(!_[_0x137d('0x22')](channels[_0x119307[_0x137d('0x7')]][_0x137d('0x42')])){channels[_0x119307[_0x137d('0x7')]][_0x137d('0x46')]+=utils[_0x137d('0x31')](utils[_0x137d('0x1e')](),channels[_0x119307[_0x137d('0x7')]][_0x137d('0x42')]);utils[_0x137d('0x1a')](util['format'](_0x137d('0x47'),_0x119307[_0x137d('0x7')],channels[_0x119307[_0x137d('0x7')]][_0x137d('0x46')]));delete channels[_0x119307[_0x137d('0x7')]]['musiconholdstartAt'];}}}catch(_0x2f1db2){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x45'),_0x119307['uniqueid']),_0x2f1db2);}};exports[_0x137d('0x48')]=function(_0x33feee){try{if(!_[_0x137d('0x22')](channels[_0x33feee['uniqueid']])){utils['debug'](util['format'](_0x137d('0x49'),_0x33feee[_0x137d('0x7')]),_0x33feee);if(!_[_0x137d('0x22')](_0x33feee['variable'][_0x137d('0x4a')])){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x4b'),_0x33feee['uniqueid'],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x4d')]=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee['variable']['xmd-phone'])){utils[_0x137d('0x1a')](util['format'](_0x137d('0x4e'),_0x33feee[_0x137d('0x7')],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee[_0x137d('0x7')]]['destination']=_0x33feee[_0x137d('0x4c')];channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x2c')]='\x22'+_0x33feee[_0x137d('0x4c')]+_0x137d('0x4f')+_0x33feee['value']+'>';}if(!_['isNil'](_0x33feee[_0x137d('0x50')]['xmd-callerid-preview'])||!_['isNil'](_0x33feee[_0x137d('0x50')]['xmd-callerid'])){utils[_0x137d('0x1a')](util['format'](_0x137d('0x51'),_0x33feee[_0x137d('0x7')],!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x52')])?_0x137d('0x52'):_0x137d('0x53'),_0x33feee['value']));channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x2c')]=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x54')])||!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')]['xmcs-queue'])){utils['info'](util[_0x137d('0x5')](_0x137d('0x51'),_0x33feee[_0x137d('0x7')],!_[_0x137d('0x22')](_0x33feee['variable'][_0x137d('0x54')])?'xmd-queue':'xmcs-queue',_0x33feee[_0x137d('0x4c')]));channels[_0x33feee['uniqueid']][_0x137d('0x55')]=_0x137d('0x56');channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x57')]=_0x33feee[_0x137d('0x4c')];channels[_0x33feee['uniqueid']][_0x137d('0x9')]=!![];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')]['xmd-contactid'])){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x58'),_0x33feee[_0x137d('0x7')],_0x33feee['value']));channels[_0x33feee[_0x137d('0x7')]]['ContactId']=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x59')])){utils['info'](util[_0x137d('0x5')](_0x137d('0x5a'),_0x33feee['uniqueid'],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee[_0x137d('0x7')]]['type']=_0x33feee[_0x137d('0x4c')];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x5b')])){utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x5c'),_0x33feee['uniqueid'],_0x33feee[_0x137d('0x4c')]));channels[_0x33feee['uniqueid']][_0x137d('0x5d')]=_0x33feee['value'];}if(!_[_0x137d('0x22')](_0x33feee[_0x137d('0x50')][_0x137d('0x5e')])){utils[_0x137d('0x1a')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x33feee[_0x137d('0x7')],_0x33feee['value']));channels[_0x33feee[_0x137d('0x7')]][_0x137d('0x5e')]=_0x33feee[_0x137d('0x4c')];}}}catch(_0x323c41){utils[_0x137d('0x2b')](util[_0x137d('0x5')](_0x137d('0x49'),_0x33feee[_0x137d('0x7')]),_0x323c41);}};exports[_0x137d('0x5f')]=function(_0x5c2fe3){try{if(!_[_0x137d('0x22')](channels[_0x5c2fe3['uniqueid']])){utils[_0x137d('0x16')](util[_0x137d('0x5')]('[%s][calls][newexten]',_0x5c2fe3[_0x137d('0x7')]),_0x5c2fe3);utils[_0x137d('0x1a')](util[_0x137d('0x5')](_0x137d('0x60'),_0x5c2fe3['uniqueid'],_0x5c2fe3[_0x137d('0x61')],_0x5c2fe3['appdata']));if(_0x5c2fe3['application'][_0x137d('0x62')]()==_0x137d('0x63')&&_[_0x137d('0x64')](_0x5c2fe3[_0x137d('0x65')]['toLowerCase'](),_0x137d('0x66'))){var _0x5cb61a=_0x5c2fe3[_0x137d('0x65')][_0x137d('0x67')]('=');var _0x598d5a=_0x5cb61a[0x0][_0x137d('0x68')](_0x5cb61a[0x0]['lastIndexOf']('(')+0x1,_0x5cb61a[0x0][_0x137d('0x69')](')'));var _0x161d53=_0x5cb61a[0x1];channels[_0x5c2fe3[_0x137d('0x7')]][_0x598d5a]=_0x161d53;}if(!_[_0x137d('0x6a')]([_0x137d('0x6b'),_0x137d('0x6c'),_0x137d('0x6d'),_0x137d('0x63'),_0x137d('0x6e')],_0x5c2fe3[_0x137d('0x61')][_0x137d('0x62')]())){channels[_0x5c2fe3[_0x137d('0x7')]][_0x137d('0x55')]=_0x5c2fe3[_0x137d('0x61')];channels[_0x5c2fe3[_0x137d('0x7')]][_0x137d('0x57')]=_0x5c2fe3[_0x137d('0x65')];}}}catch(_0x48a3f8){utils[_0x137d('0x2b')](util['format'](_0x137d('0x6f'),_0x5c2fe3['uniqueid']),_0x48a3f8);}}; \ No newline at end of file +var _0xd378=['variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','execif','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','xmd-phone','destination','\x22\x20<'];(function(_0xee7e65,_0x4fb2aa){var _0x3dfe75=function(_0x3a0d2c){while(--_0x3a0d2c){_0xee7e65['push'](_0xee7e65['shift']());}};_0x3dfe75(++_0x4fb2aa);}(_0xd378,0x89));var _0x8d37=function(_0x5cc459,_0x314c93){_0x5cc459=_0x5cc459-0x0;var _0x273970=_0xd378[_0x5cc459];return _0x273970;};'use strict';var _=require(_0x8d37('0x0'));var util=require('util');var utils=require(_0x8d37('0x1'));var dispositions=[_0x8d37('0x2'),_0x8d37('0x3'),_0x8d37('0x3'),'NO\x20ANSWER',_0x8d37('0x2'),'NO\x20ANSWER',_0x8d37('0x4'),_0x8d37('0x5'),'FAILED',_0x8d37('0x3'),'FAILED'];var channels={};function writeDB(_0x26fc64){utils[_0x8d37('0x6')](util[_0x8d37('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x26fc64[_0x8d37('0x8')],_0x26fc64[_0x8d37('0x9')],_0x26fc64['queue'],_0x26fc64[_0x8d37('0xa')],_0x26fc64['interface'],_0x26fc64[_0x8d37('0xb')],_0x26fc64[_0x8d37('0xc')],_0x26fc64[_0x8d37('0xd')]));if(_0x26fc64['accountcode']){utils[_0x8d37('0xe')](_0x26fc64['accountcode'])[_0x8d37('0xf')](function(_0x3249bb){if(_0x3249bb){_0x26fc64[_0x8d37('0x10')]=_0x3249bb['id'];}utils[_0x8d37('0x11')](_0x8d37('0x12'),_0x26fc64);});}else{utils['request'](_0x8d37('0x12'),_0x26fc64);}if(channels[_0x26fc64[_0x8d37('0x8')]]){delete channels[_0x26fc64[_0x8d37('0x8')]];}}exports[_0x8d37('0x13')]=function(_0x3531ed){try{utils['debug'](util['format'](_0x8d37('0x14'),_0x3531ed['uniqueid']),_0x3531ed);if(_0x3531ed[_0x8d37('0x8')]==_0x3531ed[_0x8d37('0x15')]&&_0x3531ed[_0x8d37('0x9')]!='OutgoingSpoolFailed'){utils['info'](util['format'](_0x8d37('0x16'),_0x3531ed['uniqueid'],_0x3531ed[_0x8d37('0x17')],_0x3531ed[_0x8d37('0x18')]));channels[_0x3531ed[_0x8d37('0x8')]]={'uniqueid':_0x3531ed[_0x8d37('0x8')],'accountcode':_0x3531ed['accountcode'],'source':_0x3531ed[_0x8d37('0xb')],'destination':_0x3531ed[_0x8d37('0x18')],'destinationcontext':_0x3531ed[_0x8d37('0x17')],'channel':_0x3531ed['channel'],'starttime':utils[_0x8d37('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x8d37('0x2'),'amaflags':_0x8d37('0x1a')};}}catch(_0x16b932){utils['error'](util[_0x8d37('0x7')]('[%s][calls][newchannel]',_0x3531ed[_0x8d37('0x8')]),_0x16b932);}};exports[_0x8d37('0x1b')]=function(_0x4734f5){try{utils[_0x8d37('0x1c')](util['format'](_0x8d37('0x1d'),_0x4734f5[_0x8d37('0x8')]),_0x4734f5);if(!_[_0x8d37('0x1e')](channels[_0x4734f5[_0x8d37('0x8')]])&&_0x4734f5[_0x8d37('0x1f')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x4734f5['uniqueid'],_0x4734f5[_0x8d37('0x17')],_0x4734f5[_0x8d37('0x9')]));if(_['isNil'](channels[_0x4734f5[_0x8d37('0x8')]]['systemanswertime'])){channels[_0x4734f5[_0x8d37('0x8')]][_0x8d37('0x20')]=utils[_0x8d37('0x19')]();}}else if(!_['isNil'](channels[_0x4734f5['linkedid']])&&_0x4734f5[_0x8d37('0x1f')]==0x6&&_0x4734f5[_0x8d37('0x17')]!='transfer'){utils[_0x8d37('0x6')](util[_0x8d37('0x7')](_0x8d37('0x21'),_0x4734f5['uniqueid'],_0x4734f5['linkedid'],_0x4734f5[_0x8d37('0x17')],_0x4734f5[_0x8d37('0x9')]));channels[_0x4734f5[_0x8d37('0x15')]]['accountcode']=_0x4734f5['accountcode'];channels[_0x4734f5['linkedid']][_0x8d37('0x22')]=_0x4734f5[_0x8d37('0x9')];if(_[_0x8d37('0x1e')](channels[_0x4734f5['linkedid']]['answertime'])){channels[_0x4734f5[_0x8d37('0x15')]][_0x8d37('0x23')]=utils[_0x8d37('0x19')]();}channels[_0x4734f5[_0x8d37('0x15')]][_0x8d37('0x24')]=dispositions[_[_0x8d37('0x25')](_0x4734f5['channelstate'])]||_0x8d37('0x4');}}catch(_0x280f48){utils[_0x8d37('0x26')](util[_0x8d37('0x7')](_0x8d37('0x1d'),_0x4734f5['uniqueid']),_0x280f48);}};exports[_0x8d37('0x27')]=function(_0x37d35e){try{if(!_[_0x8d37('0x1e')](channels[_0x37d35e[_0x8d37('0x8')]])){utils[_0x8d37('0x1c')](util[_0x8d37('0x7')](_0x8d37('0x28'),_0x37d35e[_0x8d37('0x8')]),_0x37d35e);if(_[_0x8d37('0x1e')](channels[_0x37d35e[_0x8d37('0x8')]][_0x8d37('0x29')])){channels[_0x37d35e['uniqueid']][_0x8d37('0x29')]=_0x37d35e[_0x8d37('0x2a')]+'\x20<'+_0x37d35e[_0x8d37('0xb')]+'>';}utils[_0x8d37('0x6')](util[_0x8d37('0x7')](_0x8d37('0x2b'),_0x37d35e[_0x8d37('0x8')],channels[_0x37d35e['uniqueid']]['callerid'],_0x37d35e[_0x8d37('0x2c')]));channels[_0x37d35e['uniqueid']]['endtime']=utils['now']();channels[_0x37d35e[_0x8d37('0x8')]][_0x8d37('0x2d')]=utils[_0x8d37('0x2e')](channels[_0x37d35e[_0x8d37('0x8')]][_0x8d37('0x2f')],channels[_0x37d35e[_0x8d37('0x8')]]['starttime']);channels[_0x37d35e[_0x8d37('0x8')]][_0x8d37('0x30')]=channels[_0x37d35e[_0x8d37('0x8')]]['answertime']?utils[_0x8d37('0x2e')](channels[_0x37d35e[_0x8d37('0x8')]]['endtime'],channels[_0x37d35e[_0x8d37('0x8')]][_0x8d37('0x23')]):0x0;writeDB(channels[_0x37d35e[_0x8d37('0x8')]]);}}catch(_0x1e8850){utils[_0x8d37('0x26')](util['format']('[%s][calls][hangup]',_0x37d35e[_0x8d37('0x8')]),_0x1e8850);}};exports[_0x8d37('0x31')]=function(_0x305461){try{if(!_['isNil'](channels[_0x305461[_0x8d37('0x32')]])){utils[_0x8d37('0x1c')](util[_0x8d37('0x7')](_0x8d37('0x33'),_0x305461['origtransfereruniqueid']),_0x305461);if(channels[_0x305461[_0x8d37('0x32')]][_0x8d37('0x9')]==_0x305461[_0x8d37('0x34')]){utils[_0x8d37('0x6')](util[_0x8d37('0x7')](_0x8d37('0x35'),_0x305461['origtransfereruniqueid'],_0x305461[_0x8d37('0x32')],_0x305461[_0x8d37('0x36')]));channels[_0x305461[_0x8d37('0x32')]][_0x8d37('0x22')]=_0x305461[_0x8d37('0x36')];channels[_0x305461['localtwolinkedid']][_0x8d37('0x37')]=_0x8d37('0x38');}else if(channels[_0x305461['localtwolinkedid']][_0x8d37('0x9')]=_0x305461[_0x8d37('0x39')]){utils[_0x8d37('0x6')](util['format'](_0x8d37('0x35'),_0x305461['origtransfereruniqueid'],_0x305461['localtwolinkedid'],_0x305461[_0x8d37('0x3a')]));channels[_0x305461[_0x8d37('0x32')]][_0x8d37('0x22')]=_0x305461['origtransfererchannel'];channels[_0x305461[_0x8d37('0x32')]][_0x8d37('0x37')]=_0x8d37('0x38');}}}catch(_0x1346e3){utils[_0x8d37('0x26')](util['format'](_0x8d37('0x33'),_0x305461['origtransfereruniqueid']),_0x1346e3);}};exports[_0x8d37('0x3b')]=function(_0x5eb58e){try{if(!_['isNil'](channels[_0x5eb58e[_0x8d37('0x8')]])){utils[_0x8d37('0x1c')](util[_0x8d37('0x7')]('[%s][calls][musiconholdstart]',_0x5eb58e[_0x8d37('0x8')]),_0x5eb58e);channels[_0x5eb58e[_0x8d37('0x8')]][_0x8d37('0x3c')]=utils[_0x8d37('0x19')]();utils['info'](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5eb58e['uniqueid'],channels[_0x5eb58e[_0x8d37('0x8')]][_0x8d37('0x3c')]));}}catch(_0x30d0dd){utils[_0x8d37('0x26')](util['format'](_0x8d37('0x3d'),_0x5eb58e['uniqueid']),_0x30d0dd);}};exports[_0x8d37('0x3e')]=function(_0x42ed80){try{if(!_[_0x8d37('0x1e')](channels[_0x42ed80['uniqueid']])){utils['debug'](util[_0x8d37('0x7')]('[%s][calls][musiconholdstop]',_0x42ed80[_0x8d37('0x8')]),_0x42ed80);if(!_[_0x8d37('0x1e')](channels[_0x42ed80['uniqueid']][_0x8d37('0x3c')])){channels[_0x42ed80[_0x8d37('0x8')]][_0x8d37('0x3f')]+=utils[_0x8d37('0x2e')](utils[_0x8d37('0x19')](),channels[_0x42ed80['uniqueid']][_0x8d37('0x3c')]);utils[_0x8d37('0x6')](util[_0x8d37('0x7')](_0x8d37('0x40'),_0x42ed80['uniqueid'],channels[_0x42ed80[_0x8d37('0x8')]][_0x8d37('0x3f')]));delete channels[_0x42ed80[_0x8d37('0x8')]]['musiconholdstartAt'];}}}catch(_0x2d10d6){utils[_0x8d37('0x26')](util[_0x8d37('0x7')]('[%s][calls][musiconholdstop]',_0x42ed80[_0x8d37('0x8')]),_0x2d10d6);}};exports[_0x8d37('0x41')]=function(_0x4c1d6f){try{if(!_[_0x8d37('0x1e')](channels[_0x4c1d6f['uniqueid']])){utils[_0x8d37('0x1c')](util[_0x8d37('0x7')](_0x8d37('0x42'),_0x4c1d6f['uniqueid']),_0x4c1d6f);if(!_[_0x8d37('0x1e')](_0x4c1d6f['variable'][_0x8d37('0x43')])){utils[_0x8d37('0x6')](util[_0x8d37('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4c1d6f[_0x8d37('0x8')],_0x4c1d6f[_0x8d37('0x44')]));channels[_0x4c1d6f[_0x8d37('0x8')]][_0x8d37('0x45')]=_0x4c1d6f[_0x8d37('0x44')];}if(!_[_0x8d37('0x1e')](_0x4c1d6f['variable'][_0x8d37('0x46')])){utils[_0x8d37('0x6')](util[_0x8d37('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4c1d6f[_0x8d37('0x8')],_0x4c1d6f[_0x8d37('0x44')]));channels[_0x4c1d6f['uniqueid']][_0x8d37('0x47')]=_0x4c1d6f['value'];channels[_0x4c1d6f[_0x8d37('0x8')]]['callerid']='\x22'+_0x4c1d6f[_0x8d37('0x44')]+_0x8d37('0x48')+_0x4c1d6f[_0x8d37('0x44')]+'>';}if(!_[_0x8d37('0x1e')](_0x4c1d6f[_0x8d37('0x49')][_0x8d37('0x4a')])||!_[_0x8d37('0x1e')](_0x4c1d6f['variable']['xmd-callerid'])){utils['info'](util[_0x8d37('0x7')](_0x8d37('0x4b'),_0x4c1d6f[_0x8d37('0x8')],!_['isNil'](_0x4c1d6f[_0x8d37('0x49')][_0x8d37('0x4a')])?_0x8d37('0x4a'):_0x8d37('0x4c'),_0x4c1d6f[_0x8d37('0x44')]));channels[_0x4c1d6f[_0x8d37('0x8')]][_0x8d37('0x29')]=_0x4c1d6f[_0x8d37('0x44')];}if(!_[_0x8d37('0x1e')](_0x4c1d6f['variable'][_0x8d37('0x4d')])||!_['isNil'](_0x4c1d6f['variable'][_0x8d37('0x4e')])){utils[_0x8d37('0x6')](util[_0x8d37('0x7')](_0x8d37('0x4b'),_0x4c1d6f[_0x8d37('0x8')],!_[_0x8d37('0x1e')](_0x4c1d6f[_0x8d37('0x49')][_0x8d37('0x4d')])?_0x8d37('0x4d'):'xmcs-queue',_0x4c1d6f['value']));channels[_0x4c1d6f['uniqueid']][_0x8d37('0x4f')]=_0x8d37('0x50');channels[_0x4c1d6f[_0x8d37('0x8')]][_0x8d37('0x51')]=_0x4c1d6f[_0x8d37('0x44')];channels[_0x4c1d6f[_0x8d37('0x8')]][_0x8d37('0x52')]=!![];}if(!_[_0x8d37('0x1e')](_0x4c1d6f[_0x8d37('0x49')][_0x8d37('0x53')])){utils['info'](util[_0x8d37('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4c1d6f[_0x8d37('0x8')],_0x4c1d6f[_0x8d37('0x44')]));channels[_0x4c1d6f[_0x8d37('0x8')]][_0x8d37('0x54')]=_0x4c1d6f[_0x8d37('0x44')];}if(!_['isNil'](_0x4c1d6f[_0x8d37('0x49')][_0x8d37('0x55')])){utils[_0x8d37('0x6')](util['format'](_0x8d37('0x56'),_0x4c1d6f[_0x8d37('0x8')],_0x4c1d6f[_0x8d37('0x44')]));channels[_0x4c1d6f[_0x8d37('0x8')]]['type']=_0x4c1d6f['value'];}if(!_['isNil'](_0x4c1d6f[_0x8d37('0x49')][_0x8d37('0x57')])){utils[_0x8d37('0x6')](util[_0x8d37('0x7')](_0x8d37('0x58'),_0x4c1d6f[_0x8d37('0x8')],_0x4c1d6f[_0x8d37('0x44')]));channels[_0x4c1d6f[_0x8d37('0x8')]][_0x8d37('0x59')]=_0x4c1d6f[_0x8d37('0x44')];}if(!_[_0x8d37('0x1e')](_0x4c1d6f['variable'][_0x8d37('0x5a')])){utils['info'](util[_0x8d37('0x7')](_0x8d37('0x5b'),_0x4c1d6f['uniqueid'],_0x4c1d6f[_0x8d37('0x44')]));channels[_0x4c1d6f['uniqueid']][_0x8d37('0x5a')]=_0x4c1d6f[_0x8d37('0x44')];}}}catch(_0x4ec993){utils[_0x8d37('0x26')](util[_0x8d37('0x7')]('[%s][calls][varset]',_0x4c1d6f['uniqueid']),_0x4ec993);}};exports[_0x8d37('0x5c')]=function(_0x5bf7a3){try{if(!_[_0x8d37('0x1e')](channels[_0x5bf7a3[_0x8d37('0x8')]])){utils['debug'](util[_0x8d37('0x7')](_0x8d37('0x5d'),_0x5bf7a3[_0x8d37('0x8')]),_0x5bf7a3);utils[_0x8d37('0x6')](util[_0x8d37('0x7')](_0x8d37('0x5e'),_0x5bf7a3[_0x8d37('0x8')],_0x5bf7a3[_0x8d37('0x5f')],_0x5bf7a3[_0x8d37('0x60')]));if(_0x5bf7a3['application'][_0x8d37('0x61')]()==_0x8d37('0x62')&&_[_0x8d37('0x63')](_0x5bf7a3['appdata'][_0x8d37('0x61')](),_0x8d37('0x64'))){var _0x418d1b=_0x5bf7a3[_0x8d37('0x60')]['split']('=');var _0x4e1112=_0x418d1b[0x0][_0x8d37('0x65')](_0x418d1b[0x0][_0x8d37('0x66')]('(')+0x1,_0x418d1b[0x0][_0x8d37('0x66')](')'));var _0x385865=_0x418d1b[0x1];channels[_0x5bf7a3[_0x8d37('0x8')]][_0x4e1112]=_0x385865;}if(!_['includes']([_0x8d37('0x27'),'noop',_0x8d37('0x67'),'set',_0x8d37('0x68')],_0x5bf7a3[_0x8d37('0x5f')][_0x8d37('0x61')]())){channels[_0x5bf7a3[_0x8d37('0x8')]]['lastapplication']=_0x5bf7a3[_0x8d37('0x5f')];channels[_0x5bf7a3[_0x8d37('0x8')]][_0x8d37('0x51')]=_0x5bf7a3[_0x8d37('0x60')];}}}catch(_0xa78bd5){utils[_0x8d37('0x26')](util[_0x8d37('0x7')]('[%s][calls][newexten]',_0x5bf7a3[_0x8d37('0x8')]),_0xa78bd5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index f6b9d92..86871ba 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 _0x2731=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent'];(function(_0x13915f,_0x3d90c6){var _0x373181=function(_0x66a7b4){while(--_0x66a7b4){_0x13915f['push'](_0x13915f['shift']());}};_0x373181(++_0x3d90c6);}(_0x2731,0xbb));var _0x1273=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2731[_0x4565bf];return _0x5610ba;};'use strict';var utils=require(_0x1273('0x0'));exports['connect']=function(){utils[_0x1273('0x1')](_0x1273('0x2'));};exports[_0x1273('0x3')]=function(){utils[_0x1273('0x1')](_0x1273('0x4'));};exports[_0x1273('0x5')]=function(){utils[_0x1273('0x1')](_0x1273('0x6'));};exports[_0x1273('0x7')]=function(_0x3b1e91){utils[_0x1273('0x7')]('[core]\x20error',_0x3b1e91);};exports[_0x1273('0x8')]=function(){utils[_0x1273('0x1')](_0x1273('0x9'));};exports[_0x1273('0xa')]=function(_0x49e46d){}; \ No newline at end of file +var _0x2112=['[core]\x20error','close','info','managerevent','./utils','connect','[core]\x20shutdown','fullybooted','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2112,0x1bd));var _0x2211=function(_0x202676,_0x486d3c){_0x202676=_0x202676-0x0;var _0x525c2c=_0x2112[_0x202676];return _0x525c2c;};'use strict';var utils=require(_0x2211('0x0'));exports[_0x2211('0x1')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils['info'](_0x2211('0x2'));};exports[_0x2211('0x3')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x2211('0x4')]=function(_0x4fa030){utils[_0x2211('0x4')](_0x2211('0x5'),_0x4fa030);};exports[_0x2211('0x6')]=function(){utils[_0x2211('0x7')]('[core]\x20close');};exports[_0x2211('0x8')]=function(_0x4fbe73){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3b743a0..01243e4 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 _0xe32b=['dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','[%s][dials][newexten]','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]'];(function(_0x479dcd,_0x4cbb00){var _0x14ede8=function(_0x2767e5){while(--_0x2767e5){_0x479dcd['push'](_0x479dcd['shift']());}};_0x14ede8(++_0x4cbb00);}(_0xe32b,0x10e));var _0xbe32=function(_0x27d1e3,_0x3169b2){_0x27d1e3=_0x27d1e3-0x0;var _0x58049c=_0xe32b[_0x27d1e3];return _0x58049c;};'use strict';var _=require('lodash');var util=require(_0xbe32('0x0'));var utils=require('./utils');var dials={};function writeDB(_0xe32495){utils[_0xbe32('0x1')](util[_0xbe32('0x2')](_0xbe32('0x3'),_0xe32495['uniqueid'],_0xe32495[_0xbe32('0x4')],_0xe32495[_0xbe32('0x5')],_0xe32495[_0xbe32('0x6')],_0xe32495[_0xbe32('0x7')],_0xe32495[_0xbe32('0x8')]));utils[_0xbe32('0x9')](_0xbe32('0xa'),_0xe32495);delete dials[_0xe32495[_0xbe32('0xb')]];}exports[_0xbe32('0xc')]=function(_0x4df7ad){try{utils[_0xbe32('0xd')](util[_0xbe32('0x2')]('[%s][dials][newexten]',_0x4df7ad['uniqueid']),_0x4df7ad);utils[_0xbe32('0x1')](util[_0xbe32('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4df7ad[_0xbe32('0xb')],_0x4df7ad[_0xbe32('0xe')],_0x4df7ad[_0xbe32('0xf')]));if(_0x4df7ad[_0xbe32('0xe')][_0xbe32('0x10')]()==_0xbe32('0x11')&&_[_0xbe32('0x12')](_0x4df7ad['appdata'][_0xbe32('0x10')](),_0xbe32('0x13'))){var _0x4e6694=_0x4df7ad[_0xbe32('0xf')]['split']('=');dials[_0x4df7ad[_0xbe32('0xb')]]={'routeId':_0x4e6694[0x1]};}}catch(_0x432b00){utils[_0xbe32('0x14')](util[_0xbe32('0x2')](_0xbe32('0x15'),_0x4df7ad['uniqueid']),_0x432b00);}};exports['varset']=function(_0x5ad470){try{utils[_0xbe32('0xd')](util[_0xbe32('0x2')](_0xbe32('0x16'),_0x5ad470[_0xbe32('0xb')]),_0x5ad470);if(!_[_0xbe32('0x17')](_0x5ad470[_0xbe32('0x18')][_0xbe32('0x19')])){utils[_0xbe32('0x1')](util[_0xbe32('0x2')](_0xbe32('0x1a'),_0x5ad470[_0xbe32('0xb')],_0x5ad470[_0xbe32('0x1b')]));dials[_0x5ad470['uniqueid']]={'routeId':_0x5ad470['value']};}}catch(_0x4ee639){utils['error'](util[_0xbe32('0x2')](_0xbe32('0x16'),_0x5ad470[_0xbe32('0xb')]),_0x4ee639);}};exports[_0xbe32('0x1c')]=function(_0x3f00bc){try{if(!_[_0xbe32('0x17')](dials[_0x3f00bc[_0xbe32('0xb')]])){utils[_0xbe32('0xd')](util[_0xbe32('0x2')]('[%s][dials][dialbegin]',_0x3f00bc[_0xbe32('0xb')]),_0x3f00bc);dials[_0x3f00bc[_0xbe32('0xb')]]=_[_0xbe32('0x1d')](dials[_0x3f00bc[_0xbe32('0xb')]],_0x3f00bc);dials[_0x3f00bc[_0xbe32('0xb')]][_0xbe32('0x1e')]=utils[_0xbe32('0x1f')]();dials[_0x3f00bc[_0xbe32('0xb')]][_0xbe32('0x20')]=_0xbe32('0x21');utils[_0xbe32('0x1')](util['format'](_0xbe32('0x22'),_0x3f00bc[_0xbe32('0xb')],dials[_0x3f00bc['uniqueid']][_0xbe32('0x1e')]));}}catch(_0x824268){utils['error'](util[_0xbe32('0x2')](_0xbe32('0x23'),_0x3f00bc[_0xbe32('0xb')]),_0x824268);}};exports[_0xbe32('0x24')]=function(_0x511848){try{if(!_[_0xbe32('0x17')](dials[_0x511848[_0xbe32('0xb')]])){utils[_0xbe32('0xd')](util[_0xbe32('0x2')](_0xbe32('0x25'),_0x511848[_0xbe32('0xb')]),_0x511848);dials[_0x511848['uniqueid']]['dialstatus']=_0x511848[_0xbe32('0x8')];if(_0x511848['dialstatus']==_0xbe32('0x26')){dials[_0x511848[_0xbe32('0xb')]]=_[_0xbe32('0x1d')](dials[_0x511848[_0xbe32('0xb')]],_0x511848);dials[_0x511848[_0xbe32('0xb')]]['answertime']=utils[_0xbe32('0x1f')]();dials[_0x511848[_0xbe32('0xb')]][_0xbe32('0x20')]=_0xbe32('0x27');utils[_0xbe32('0x1')](util[_0xbe32('0x2')](_0xbe32('0x28'),_0x511848[_0xbe32('0xb')],_0x511848[_0xbe32('0x8')],dials[_0x511848[_0xbe32('0xb')]][_0xbe32('0x29')]));}else{utils[_0xbe32('0x1')](util[_0xbe32('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x511848[_0xbe32('0xb')],_0x511848['dialstatus']));}}}catch(_0x7b0ea3){utils['error'](util[_0xbe32('0x2')](_0xbe32('0x25'),_0x511848['uniqueid']),_0x7b0ea3);}};exports['hangup']=function(_0x5c5259){try{if(!_['isNil'](dials[_0x5c5259[_0xbe32('0xb')]])){utils['debug'](util[_0xbe32('0x2')](_0xbe32('0x2a'),_0x5c5259['uniqueid']),_0x5c5259);utils[_0xbe32('0x1')](util[_0xbe32('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5c5259['uniqueid'],_0x5c5259[_0xbe32('0x6')],_0x5c5259[_0xbe32('0x2b')],_0x5c5259[_0xbe32('0x2c')]));dials[_0x5c5259['uniqueid']]=_[_0xbe32('0x1d')](dials[_0x5c5259[_0xbe32('0xb')]],{'endtime':utils['now'](),'lastevent':_0xbe32('0x2d')});dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x2e')]=utils['diffTime'](dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x2f')],dials[_0x5c5259['uniqueid']][_0xbe32('0x1e')]);dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x30')]=utils[_0xbe32('0x31')](dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x29')]||dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x2f')],dials[_0x5c5259['uniqueid']][_0xbe32('0x1e')]);dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x32')]=dials[_0x5c5259['uniqueid']][_0xbe32('0x29')]?utils[_0xbe32('0x31')](dials[_0x5c5259[_0xbe32('0xb')]]['endtime'],dials[_0x5c5259[_0xbe32('0xb')]][_0xbe32('0x29')]):0x0;writeDB(dials[_0x5c5259[_0xbe32('0xb')]]);}}catch(_0x599c92){utils[_0xbe32('0x14')](util[_0xbe32('0x2')](_0xbe32('0x2a'),_0x5c5259[_0xbe32('0xb')]),_0x599c92);}}; \ No newline at end of file +var _0x514a=['uniqueid','calleridnum','connectedlinenum','dialstatus','newexten','debug','[%s][dials][newexten]','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','isNil','value','[%s][dials][varset]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','assign','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x54fba8,_0x40b4c6){var _0x467c7d=function(_0xf67cca){while(--_0xf67cca){_0x54fba8['push'](_0x54fba8['shift']());}};_0x467c7d(++_0x40b4c6);}(_0x514a,0xae));var _0xa514=function(_0x182688,_0xa51c58){_0x182688=_0x182688-0x0;var _0x2daf05=_0x514a[_0x182688];return _0x2daf05;};'use strict';var _=require(_0xa514('0x0'));var util=require(_0xa514('0x1'));var utils=require(_0xa514('0x2'));var dials={};function writeDB(_0x4cbc6f){utils[_0xa514('0x3')](util[_0xa514('0x4')](_0xa514('0x5'),_0x4cbc6f[_0xa514('0x6')],_0x4cbc6f['channel'],_0x4cbc6f['dialstring'],_0x4cbc6f[_0xa514('0x7')],_0x4cbc6f[_0xa514('0x8')],_0x4cbc6f[_0xa514('0x9')]));utils['request']('CreateVoiceDialReport',_0x4cbc6f);delete dials[_0x4cbc6f[_0xa514('0x6')]];}exports[_0xa514('0xa')]=function(_0x29a8ed){try{utils[_0xa514('0xb')](util[_0xa514('0x4')](_0xa514('0xc'),_0x29a8ed[_0xa514('0x6')]),_0x29a8ed);utils[_0xa514('0x3')](util[_0xa514('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x29a8ed[_0xa514('0x6')],_0x29a8ed['application'],_0x29a8ed[_0xa514('0xd')]));if(_0x29a8ed['application'][_0xa514('0xe')]()=='set'&&_[_0xa514('0xf')](_0x29a8ed['appdata']['toLowerCase'](),_0xa514('0x10'))){var _0x3c4fe2=_0x29a8ed[_0xa514('0xd')][_0xa514('0x11')]('=');dials[_0x29a8ed['uniqueid']]={'routeId':_0x3c4fe2[0x1]};}}catch(_0x3b7c67){utils[_0xa514('0x12')](util[_0xa514('0x4')](_0xa514('0xc'),_0x29a8ed[_0xa514('0x6')]),_0x3b7c67);}};exports[_0xa514('0x13')]=function(_0xabfa3a){try{utils['debug'](util[_0xa514('0x4')]('[%s][dials][varset]',_0xabfa3a[_0xa514('0x6')]),_0xabfa3a);if(!_[_0xa514('0x14')](_0xabfa3a['variable']['outboundrouteid'])){utils['info'](util[_0xa514('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xabfa3a[_0xa514('0x6')],_0xabfa3a[_0xa514('0x15')]));dials[_0xabfa3a[_0xa514('0x6')]]={'routeId':_0xabfa3a[_0xa514('0x15')]};}}catch(_0x578839){utils['error'](util['format'](_0xa514('0x16'),_0xabfa3a[_0xa514('0x6')]),_0x578839);}};exports['dialbegin']=function(_0x4dee0c){try{if(!_[_0xa514('0x14')](dials[_0x4dee0c[_0xa514('0x6')]])){utils[_0xa514('0xb')](util[_0xa514('0x4')]('[%s][dials][dialbegin]',_0x4dee0c['uniqueid']),_0x4dee0c);dials[_0x4dee0c[_0xa514('0x6')]]=_['assign'](dials[_0x4dee0c[_0xa514('0x6')]],_0x4dee0c);dials[_0x4dee0c[_0xa514('0x6')]][_0xa514('0x17')]=utils[_0xa514('0x18')]();dials[_0x4dee0c[_0xa514('0x6')]][_0xa514('0x19')]=_0xa514('0x1a');utils[_0xa514('0x3')](util[_0xa514('0x4')](_0xa514('0x1b'),_0x4dee0c['uniqueid'],dials[_0x4dee0c[_0xa514('0x6')]][_0xa514('0x17')]));}}catch(_0x474225){utils[_0xa514('0x12')](util[_0xa514('0x4')]('[%s][dials][dialbegin]',_0x4dee0c[_0xa514('0x6')]),_0x474225);}};exports[_0xa514('0x1c')]=function(_0x13b7bc){try{if(!_[_0xa514('0x14')](dials[_0x13b7bc[_0xa514('0x6')]])){utils[_0xa514('0xb')](util[_0xa514('0x4')]('[%s][dials][dialend]',_0x13b7bc[_0xa514('0x6')]),_0x13b7bc);dials[_0x13b7bc[_0xa514('0x6')]]['dialstatus']=_0x13b7bc['dialstatus'];if(_0x13b7bc['dialstatus']==_0xa514('0x1d')){dials[_0x13b7bc[_0xa514('0x6')]]=_['assign'](dials[_0x13b7bc[_0xa514('0x6')]],_0x13b7bc);dials[_0x13b7bc[_0xa514('0x6')]][_0xa514('0x1e')]=utils[_0xa514('0x18')]();dials[_0x13b7bc[_0xa514('0x6')]][_0xa514('0x19')]=_0xa514('0x1f');utils[_0xa514('0x3')](util['format'](_0xa514('0x20'),_0x13b7bc[_0xa514('0x6')],_0x13b7bc[_0xa514('0x9')],dials[_0x13b7bc[_0xa514('0x6')]]['answertime']));}else{utils[_0xa514('0x3')](util[_0xa514('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x13b7bc[_0xa514('0x6')],_0x13b7bc['dialstatus']));}}}catch(_0x37cb8d){utils[_0xa514('0x12')](util[_0xa514('0x4')](_0xa514('0x21'),_0x13b7bc['uniqueid']),_0x37cb8d);}};exports[_0xa514('0x22')]=function(_0x1125e5){try{if(!_['isNil'](dials[_0x1125e5['uniqueid']])){utils[_0xa514('0xb')](util['format'](_0xa514('0x23'),_0x1125e5[_0xa514('0x6')]),_0x1125e5);utils['info'](util[_0xa514('0x4')](_0xa514('0x24'),_0x1125e5[_0xa514('0x6')],_0x1125e5['calleridnum'],_0x1125e5[_0xa514('0x25')],_0x1125e5[_0xa514('0x26')]));dials[_0x1125e5['uniqueid']]=_[_0xa514('0x27')](dials[_0x1125e5['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xa514('0x28')});dials[_0x1125e5[_0xa514('0x6')]][_0xa514('0x29')]=utils[_0xa514('0x2a')](dials[_0x1125e5[_0xa514('0x6')]][_0xa514('0x2b')],dials[_0x1125e5[_0xa514('0x6')]][_0xa514('0x17')]);dials[_0x1125e5[_0xa514('0x6')]]['holdtime']=utils[_0xa514('0x2a')](dials[_0x1125e5['uniqueid']][_0xa514('0x1e')]||dials[_0x1125e5[_0xa514('0x6')]][_0xa514('0x2b')],dials[_0x1125e5['uniqueid']]['starttime']);dials[_0x1125e5[_0xa514('0x6')]][_0xa514('0x2c')]=dials[_0x1125e5[_0xa514('0x6')]][_0xa514('0x1e')]?utils[_0xa514('0x2a')](dials[_0x1125e5[_0xa514('0x6')]]['endtime'],dials[_0x1125e5[_0xa514('0x6')]][_0xa514('0x1e')]):0x0;writeDB(dials[_0x1125e5[_0xa514('0x6')]]);}}catch(_0x5d45fa){utils[_0xa514('0x12')](util[_0xa514('0x4')]('[%s][dials][hangup]',_0x1125e5[_0xa514('0x6')]),_0x5d45fa);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0476b2c..da9c5d3 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 _0x2abe=['device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','password','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]'];(function(_0x56260c,_0x3594bc){var _0x3293b9=function(_0x3e1744){while(--_0x3e1744){_0x56260c['push'](_0x56260c['shift']());}};_0x3293b9(++_0x3594bc);}(_0x2abe,0xaf));var _0xe2ab=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2abe[_0x4b369d];return _0x571a98;};var AsteriskManager=require(_0xe2ab('0x0'));var config=require(_0xe2ab('0x1'));var utils=require(_0xe2ab('0x2'));var util=require(_0xe2ab('0x3'));var isXDREnabled=config[_0xe2ab('0x4')]&&config[_0xe2ab('0x4')]['disabled']?!config[_0xe2ab('0x4')][_0xe2ab('0x5')]:!![];var isProduction=config['env']===_0xe2ab('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0xe2ab('0x4')][_0xe2ab('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xe2ab('0x8')][_0xe2ab('0x9')],config['asterisk']['ip'],config[_0xe2ab('0x8')]['username'],config['asterisk'][_0xe2ab('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0xe2ab('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xe2ab('0xc'));}else{var agents=require(_0xe2ab('0xd'));var calls=require(_0xe2ab('0xe'));var queues=require('./queues.controller');var recordings=require(_0xe2ab('0xf'));var members=require(_0xe2ab('0x10'));var dials=require(_0xe2ab('0x11'));var transfers=require(_0xe2ab('0x12'));var core=require('./core.controller');ami['on']('connect',core[_0xe2ab('0x13')]);ami['on'](_0xe2ab('0x14'),core[_0xe2ab('0x14')]);ami['on'](_0xe2ab('0x15'),core[_0xe2ab('0x15')]);ami['on'](_0xe2ab('0x16'),core['error']);ami['on'](_0xe2ab('0x17'),core[_0xe2ab('0x17')]);ami['on'](_0xe2ab('0x18'),core[_0xe2ab('0x18')]);ami['on'](_0xe2ab('0x19'),function(_0xca31a){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x1c'),_0xca31a[_0xe2ab('0x1d')]),_0xca31a);members['devicestatechange'](_0xca31a);}catch(_0x479ab4){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x1c'),_0xca31a[_0xe2ab('0x1d')]),_0x479ab4);}});ami['on'](_0xe2ab('0x1e'),function(_0x8adeae){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x1f'),_0x8adeae[_0xe2ab('0x20')]),_0x8adeae);agents[_0xe2ab('0x1e')](_0x8adeae);}catch(_0x5e067a){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x1f'),_0x8adeae[_0xe2ab('0x20')]),_0x5e067a);}});ami['on']('agentringnoanswer',function(_0x339d9d){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x21'),_0x339d9d['uniqueid']),_0x339d9d);agents[_0xe2ab('0x22')](_0x339d9d);}catch(_0x3adc19){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x21'),_0x339d9d[_0xe2ab('0x20')]),_0x3adc19);}});ami['on']('agentconnect',function(_0x4e26eb){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x23'),_0x4e26eb[_0xe2ab('0x20')]),_0x4e26eb);agents[_0xe2ab('0x24')](_0x4e26eb);queues['agentconnect'](_0x4e26eb);}catch(_0x5bc0c3){utils['error'](util[_0xe2ab('0x1b')](_0xe2ab('0x23'),_0x4e26eb['uniqueid']),_0x5bc0c3);}});ami['on']('agentcomplete',function(_0x2363e3){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x25'),_0x2363e3[_0xe2ab('0x20')]),_0x2363e3);agents[_0xe2ab('0x26')](_0x2363e3);queues[_0xe2ab('0x26')](_0x2363e3);members[_0xe2ab('0x26')](_0x2363e3);}catch(_0x25573a){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x25'),_0x2363e3[_0xe2ab('0x20')]),_0x25573a);}});ami['on'](_0xe2ab('0x27'),function(_0x541c5d){try{utils['debug'](util['format'](_0xe2ab('0x28'),_0x541c5d['uniqueid']),_0x541c5d);agents[_0xe2ab('0x27')](_0x541c5d);queues[_0xe2ab('0x27')](_0x541c5d);}catch(_0xdf88af){utils[_0xe2ab('0x16')](util['format'](_0xe2ab('0x28'),_0x541c5d[_0xe2ab('0x20')]),_0xdf88af);}});ami['on']('queuecallerjoin',function(_0x2e4804){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')]('[%s][index][queuecallerjoin]',_0x2e4804['uniqueid']),_0x2e4804);queues[_0xe2ab('0x29')](_0x2e4804);recordings['queuecallerjoin'](_0x2e4804);}catch(_0x23bcfe){utils[_0xe2ab('0x16')](util['format']('[%s][index][queuecallerjoin]',_0x2e4804['uniqueid']),_0x23bcfe);}});ami['on']('queuecallerleave',function(_0x128ce3){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x2a'),_0x128ce3['uniqueid']),_0x128ce3);queues['queuecallerleave'](_0x128ce3);}catch(_0x34f341){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x2a'),_0x128ce3[_0xe2ab('0x20')]),_0x34f341);}});ami['on'](_0xe2ab('0x2b'),function(_0x3cd942){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x2c'),_0x3cd942['uniqueid']),_0x3cd942);queues[_0xe2ab('0x2b')](_0x3cd942);calls[_0xe2ab('0x2b')](_0x3cd942);}catch(_0x4a10ce){utils[_0xe2ab('0x16')](util['format']('[%s][index][musiconholdstart]',_0x3cd942['uniqueid']),_0x4a10ce);}});ami['on'](_0xe2ab('0x2d'),function(_0x3ad3b9){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x2e'),_0x3ad3b9['uniqueid']),_0x3ad3b9);queues[_0xe2ab('0x2d')](_0x3ad3b9);calls[_0xe2ab('0x2d')](_0x3ad3b9);}catch(_0x4992b0){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')]('[%s][index][musiconholdstop]',_0x3ad3b9[_0xe2ab('0x20')]),_0x4992b0);}});ami['on']('newstate',function(_0x445bcc){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x2f'),_0x445bcc[_0xe2ab('0x20')]),_0x445bcc);calls[_0xe2ab('0x30')](_0x445bcc);recordings[_0xe2ab('0x30')](_0x445bcc);}catch(_0x1e8570){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x2f'),_0x445bcc[_0xe2ab('0x20')]),_0x1e8570);}});ami['on']('hangup',function(_0x16fe6b){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x31'),_0x16fe6b[_0xe2ab('0x20')]),_0x16fe6b);calls[_0xe2ab('0x32')](_0x16fe6b);recordings['hangup'](_0x16fe6b);dials[_0xe2ab('0x32')](_0x16fe6b);agents[_0xe2ab('0x32')](_0x16fe6b);queues['hangup'](_0x16fe6b);}catch(_0x202d71){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')]('[%s][index][hangup]',_0x16fe6b['uniqueid']),_0x202d71);}});ami['on'](_0xe2ab('0x33'),function(_0x5964d2){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x34'),_0x5964d2['uniqueid']),_0x5964d2);members['cdr'](_0x5964d2);}catch(_0x52a669){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x34'),_0x5964d2[_0xe2ab('0x20')]),_0x52a669);}});ami['on'](_0xe2ab('0x35'),function(_0x85b46){try{utils['debug'](util[_0xe2ab('0x1b')](_0xe2ab('0x36'),_0x85b46[_0xe2ab('0x20')]),_0x85b46);queues['blindtransfer'](_0x85b46);agents[_0xe2ab('0x35')](_0x85b46);transfers[_0xe2ab('0x35')](_0x85b46);}catch(_0x1fc366){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x36'),_0x85b46[_0xe2ab('0x20')]),_0x1fc366);}});ami['on'](_0xe2ab('0x37'),function(_0x3660c2){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')]('[%s][index][attendedtransfer]',_0x3660c2[_0xe2ab('0x38')]),_0x3660c2);queues[_0xe2ab('0x37')](_0x3660c2);transfers['attendedtransfer'](_0x3660c2);agents['attendedtransfer'](_0x3660c2);calls[_0xe2ab('0x37')](_0x3660c2);}catch(_0x385210){utils[_0xe2ab('0x16')](util['format'](_0xe2ab('0x39'),_0x3660c2[_0xe2ab('0x38')]),_0x385210);}});ami['on']('varset',function(_0x557174){try{utils[_0xe2ab('0x1a')](util['format'](_0xe2ab('0x3a'),_0x557174[_0xe2ab('0x20')]),_0x557174);queues['varset'](_0x557174);recordings[_0xe2ab('0x3b')](_0x557174);calls[_0xe2ab('0x3b')](_0x557174);dials['varset'](_0x557174);}catch(_0xeffbf3){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x3a'),_0x557174[_0xe2ab('0x20')]),_0xeffbf3);}});ami['on']('newexten',function(_0xa7e68f){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')](_0xe2ab('0x3c'),_0xa7e68f[_0xe2ab('0x20')]),_0xa7e68f);calls[_0xe2ab('0x3d')](_0xa7e68f);recordings[_0xe2ab('0x3d')](_0xa7e68f);dials[_0xe2ab('0x3d')](_0xa7e68f);}catch(_0x20c5fa){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x3c'),_0xa7e68f[_0xe2ab('0x20')]),_0x20c5fa);}});ami['on'](_0xe2ab('0x3e'),function(_0x1fdd1d){try{utils[_0xe2ab('0x1a')](util['format']('[%s][index][newchannel]',_0x1fdd1d[_0xe2ab('0x20')]),_0x1fdd1d);calls['newchannel'](_0x1fdd1d);recordings[_0xe2ab('0x3e')](_0x1fdd1d);}catch(_0xe5be44){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')](_0xe2ab('0x3f'),_0x1fdd1d['uniqueid']),_0xe5be44);}});ami['on'](_0xe2ab('0x40'),function(_0x3a6822){try{utils['debug'](util['format'](_0xe2ab('0x41'),_0x3a6822['uniqueid']),_0x3a6822);dials[_0xe2ab('0x40')](_0x3a6822);}catch(_0x148122){utils[_0xe2ab('0x16')](util['format'](_0xe2ab('0x42'),_0x3a6822[_0xe2ab('0x20')]),_0x148122);}});ami['on'](_0xe2ab('0x43'),function(_0x2491cc){try{utils[_0xe2ab('0x1a')](util[_0xe2ab('0x1b')]('[%s][index][dialend]',_0x2491cc[_0xe2ab('0x20')]),_0x2491cc);dials[_0xe2ab('0x43')](_0x2491cc);}catch(_0x28d45c){utils[_0xe2ab('0x16')](util[_0xe2ab('0x1b')]('[%s][index][dialend]',_0x2491cc[_0xe2ab('0x20')]),_0x28d45c);}});} \ No newline at end of file +var _0x2dda=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0x50cecf,_0x1d15b6){var _0x31e8ac=function(_0x2e25cb){while(--_0x2e25cb){_0x50cecf['push'](_0x50cecf['shift']());}};_0x31e8ac(++_0x1d15b6);}(_0x2dda,0x1b7));var _0xa2dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dda[_0xa464c9];return _0x3d73c4;};var AsteriskManager=require(_0xa2dd('0x0'));var config=require(_0xa2dd('0x1'));var utils=require(_0xa2dd('0x2'));var util=require(_0xa2dd('0x3'));var isXDREnabled=config['xdr']&&config[_0xa2dd('0x4')][_0xa2dd('0x5')]?!config['xdr'][_0xa2dd('0x5')]:!![];var isProduction=config['env']===_0xa2dd('0x6')||![];var isLocalAsterisk=config[_0xa2dd('0x4')]&&config[_0xa2dd('0x4')][_0xa2dd('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xa2dd('0x8')][_0xa2dd('0x9')],config[_0xa2dd('0x8')]['ip'],config[_0xa2dd('0x8')][_0xa2dd('0xa')],config['asterisk']['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xa2dd('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xa2dd('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xa2dd('0xc'));var calls=require(_0xa2dd('0xd'));var queues=require(_0xa2dd('0xe'));var recordings=require(_0xa2dd('0xf'));var members=require(_0xa2dd('0x10'));var dials=require(_0xa2dd('0x11'));var transfers=require(_0xa2dd('0x12'));var core=require('./core.controller');ami['on']('connect',core[_0xa2dd('0x13')]);ami['on'](_0xa2dd('0x14'),core[_0xa2dd('0x14')]);ami['on']('fullybooted',core[_0xa2dd('0x15')]);ami['on']('error',core[_0xa2dd('0x16')]);ami['on'](_0xa2dd('0x17'),core[_0xa2dd('0x17')]);ami['on']('managerevent',core[_0xa2dd('0x18')]);ami['on'](_0xa2dd('0x19'),function(_0x41aef1){try{utils['debug'](util[_0xa2dd('0x1a')](_0xa2dd('0x1b'),_0x41aef1[_0xa2dd('0x1c')]),_0x41aef1);members[_0xa2dd('0x19')](_0x41aef1);}catch(_0x43bdf4){utils[_0xa2dd('0x16')](util['format'](_0xa2dd('0x1b'),_0x41aef1[_0xa2dd('0x1c')]),_0x43bdf4);}});ami['on']('agentcalled',function(_0x34717e){try{utils[_0xa2dd('0x1d')](util[_0xa2dd('0x1a')](_0xa2dd('0x1e'),_0x34717e['uniqueid']),_0x34717e);agents[_0xa2dd('0x1f')](_0x34717e);}catch(_0x5d65f1){utils[_0xa2dd('0x16')](util['format'](_0xa2dd('0x1e'),_0x34717e[_0xa2dd('0x20')]),_0x5d65f1);}});ami['on'](_0xa2dd('0x21'),function(_0x38b155){try{utils[_0xa2dd('0x1d')](util[_0xa2dd('0x1a')](_0xa2dd('0x22'),_0x38b155[_0xa2dd('0x20')]),_0x38b155);agents['agentringnoanswer'](_0x38b155);}catch(_0x34fa81){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x22'),_0x38b155[_0xa2dd('0x20')]),_0x34fa81);}});ami['on'](_0xa2dd('0x23'),function(_0x593afa){try{utils['debug'](util[_0xa2dd('0x1a')]('[%s][index][agentconnect]',_0x593afa['uniqueid']),_0x593afa);agents[_0xa2dd('0x23')](_0x593afa);queues[_0xa2dd('0x23')](_0x593afa);}catch(_0x4be5d6){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x24'),_0x593afa[_0xa2dd('0x20')]),_0x4be5d6);}});ami['on'](_0xa2dd('0x25'),function(_0x328fb3){try{utils[_0xa2dd('0x1d')](util['format']('[%s][index][agentcomplete]',_0x328fb3[_0xa2dd('0x20')]),_0x328fb3);agents['agentcomplete'](_0x328fb3);queues[_0xa2dd('0x25')](_0x328fb3);members[_0xa2dd('0x25')](_0x328fb3);}catch(_0x616d6c){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x26'),_0x328fb3[_0xa2dd('0x20')]),_0x616d6c);}});ami['on'](_0xa2dd('0x27'),function(_0x5ef9c3){try{utils[_0xa2dd('0x1d')](util['format']('[%s][index][queuecallerabandon]',_0x5ef9c3[_0xa2dd('0x20')]),_0x5ef9c3);agents[_0xa2dd('0x27')](_0x5ef9c3);queues[_0xa2dd('0x27')](_0x5ef9c3);}catch(_0x7925c8){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x28'),_0x5ef9c3[_0xa2dd('0x20')]),_0x7925c8);}});ami['on'](_0xa2dd('0x29'),function(_0x3b73ea){try{utils[_0xa2dd('0x1d')](util['format'](_0xa2dd('0x2a'),_0x3b73ea[_0xa2dd('0x20')]),_0x3b73ea);queues['queuecallerjoin'](_0x3b73ea);recordings[_0xa2dd('0x29')](_0x3b73ea);}catch(_0x1938a4){utils[_0xa2dd('0x16')](util['format'](_0xa2dd('0x2a'),_0x3b73ea[_0xa2dd('0x20')]),_0x1938a4);}});ami['on']('queuecallerleave',function(_0x479033){try{utils[_0xa2dd('0x1d')](util['format'](_0xa2dd('0x2b'),_0x479033[_0xa2dd('0x20')]),_0x479033);queues['queuecallerleave'](_0x479033);}catch(_0x3e6dfe){utils['error'](util[_0xa2dd('0x1a')](_0xa2dd('0x2b'),_0x479033['uniqueid']),_0x3e6dfe);}});ami['on'](_0xa2dd('0x2c'),function(_0x414e33){try{utils[_0xa2dd('0x1d')](util[_0xa2dd('0x1a')]('[%s][index][musiconholdstart]',_0x414e33['uniqueid']),_0x414e33);queues[_0xa2dd('0x2c')](_0x414e33);calls[_0xa2dd('0x2c')](_0x414e33);}catch(_0x56dddc){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x2d'),_0x414e33['uniqueid']),_0x56dddc);}});ami['on']('musiconholdstop',function(_0x2deee6){try{utils[_0xa2dd('0x1d')](util['format'](_0xa2dd('0x2e'),_0x2deee6['uniqueid']),_0x2deee6);queues[_0xa2dd('0x2f')](_0x2deee6);calls['musiconholdstop'](_0x2deee6);}catch(_0x16d566){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')]('[%s][index][musiconholdstop]',_0x2deee6[_0xa2dd('0x20')]),_0x16d566);}});ami['on'](_0xa2dd('0x30'),function(_0x38906e){try{utils['debug'](util[_0xa2dd('0x1a')](_0xa2dd('0x31'),_0x38906e[_0xa2dd('0x20')]),_0x38906e);calls[_0xa2dd('0x30')](_0x38906e);recordings[_0xa2dd('0x30')](_0x38906e);}catch(_0x3b2057){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x31'),_0x38906e[_0xa2dd('0x20')]),_0x3b2057);}});ami['on']('hangup',function(_0x3d96eb){try{utils[_0xa2dd('0x1d')](util[_0xa2dd('0x1a')](_0xa2dd('0x32'),_0x3d96eb[_0xa2dd('0x20')]),_0x3d96eb);calls[_0xa2dd('0x33')](_0x3d96eb);recordings[_0xa2dd('0x33')](_0x3d96eb);dials[_0xa2dd('0x33')](_0x3d96eb);agents[_0xa2dd('0x33')](_0x3d96eb);queues[_0xa2dd('0x33')](_0x3d96eb);}catch(_0x5f427a){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x32'),_0x3d96eb[_0xa2dd('0x20')]),_0x5f427a);}});ami['on'](_0xa2dd('0x34'),function(_0x34772a){try{utils[_0xa2dd('0x1d')](util[_0xa2dd('0x1a')](_0xa2dd('0x35'),_0x34772a[_0xa2dd('0x20')]),_0x34772a);members[_0xa2dd('0x34')](_0x34772a);}catch(_0x1ea519){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x35'),_0x34772a[_0xa2dd('0x20')]),_0x1ea519);}});ami['on'](_0xa2dd('0x36'),function(_0x33dd7b){try{utils[_0xa2dd('0x1d')](util[_0xa2dd('0x1a')](_0xa2dd('0x37'),_0x33dd7b[_0xa2dd('0x20')]),_0x33dd7b);queues['blindtransfer'](_0x33dd7b);agents[_0xa2dd('0x36')](_0x33dd7b);transfers[_0xa2dd('0x36')](_0x33dd7b);}catch(_0x519959){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x37'),_0x33dd7b[_0xa2dd('0x20')]),_0x519959);}});ami['on'](_0xa2dd('0x38'),function(_0x2dc739){try{utils[_0xa2dd('0x1d')](util['format'](_0xa2dd('0x39'),_0x2dc739['origtransfereruniqueid']),_0x2dc739);queues[_0xa2dd('0x38')](_0x2dc739);transfers[_0xa2dd('0x38')](_0x2dc739);agents['attendedtransfer'](_0x2dc739);calls[_0xa2dd('0x38')](_0x2dc739);}catch(_0x1158ee){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x39'),_0x2dc739['origtransfereruniqueid']),_0x1158ee);}});ami['on'](_0xa2dd('0x3a'),function(_0x20dfe7){try{utils[_0xa2dd('0x1d')](util['format'](_0xa2dd('0x3b'),_0x20dfe7[_0xa2dd('0x20')]),_0x20dfe7);queues[_0xa2dd('0x3a')](_0x20dfe7);recordings['varset'](_0x20dfe7);calls['varset'](_0x20dfe7);dials['varset'](_0x20dfe7);}catch(_0x50dee5){utils[_0xa2dd('0x16')](util['format'](_0xa2dd('0x3b'),_0x20dfe7[_0xa2dd('0x20')]),_0x50dee5);}});ami['on'](_0xa2dd('0x3c'),function(_0x50f167){try{utils['debug'](util['format'](_0xa2dd('0x3d'),_0x50f167[_0xa2dd('0x20')]),_0x50f167);calls[_0xa2dd('0x3c')](_0x50f167);recordings[_0xa2dd('0x3c')](_0x50f167);dials[_0xa2dd('0x3c')](_0x50f167);}catch(_0x10fd10){utils[_0xa2dd('0x16')](util['format']('[%s][index][newexten]',_0x50f167[_0xa2dd('0x20')]),_0x10fd10);}});ami['on']('newchannel',function(_0x594707){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x594707[_0xa2dd('0x20')]),_0x594707);calls[_0xa2dd('0x3e')](_0x594707);recordings[_0xa2dd('0x3e')](_0x594707);}catch(_0x7af66a){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')](_0xa2dd('0x3f'),_0x594707[_0xa2dd('0x20')]),_0x7af66a);}});ami['on'](_0xa2dd('0x40'),function(_0x176c7e){try{utils[_0xa2dd('0x1d')](util['format'](_0xa2dd('0x41'),_0x176c7e[_0xa2dd('0x20')]),_0x176c7e);dials['dialbegin'](_0x176c7e);}catch(_0xaa68f2){utils[_0xa2dd('0x16')](util['format']('[%s]dialbegin',_0x176c7e[_0xa2dd('0x20')]),_0xaa68f2);}});ami['on']('dialend',function(_0x3de584){try{utils[_0xa2dd('0x1d')](util[_0xa2dd('0x1a')](_0xa2dd('0x42'),_0x3de584[_0xa2dd('0x20')]),_0x3de584);dials[_0xa2dd('0x43')](_0x3de584);}catch(_0x102491){utils[_0xa2dd('0x16')](util[_0xa2dd('0x1a')]('[%s][index][dialend]',_0x3de584[_0xa2dd('0x20')]),_0x102491);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 62595b8..52a4f89 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 _0xe148=['isNil','exitAt','now','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','split','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','data2','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','type','then','membername','name','internal','request','CreateMemberReport','getUserByName','catch','error','some','startsWith','debug','[%s][members][devicestatechange]','device','info','state','voice','TALKING','NOT_INUSE'];(function(_0x1567c8,_0x5d128e){var _0x2df2b4=function(_0x10b27f){while(--_0x10b27f){_0x1567c8['push'](_0x1567c8['shift']());}};_0x2df2b4(++_0x5d128e);}(_0xe148,0x109));var _0x8e14=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0xe148[_0xac56ce];return _0x5105e1;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var utils=require(_0x8e14('0x2'));var members={};var exclude=[_0x8e14('0x3'),_0x8e14('0x4')];function writeDB(_0x47eef0){utils['info'](util[_0x8e14('0x5')](_0x8e14('0x6'),_0x47eef0[_0x8e14('0x7')],_0x47eef0[_0x8e14('0x8')],_0x47eef0['channel'],_0x47eef0['data2'],_0x47eef0['membername'],_0x47eef0[_0x8e14('0x9')]));if(_0x47eef0[_0x8e14('0x8')]){utils['getUserByInterface'](_0x47eef0['interface'])[_0x8e14('0xa')](function(_0x532665){if(_0x532665){_0x47eef0[_0x8e14('0xb')]=_0x532665[_0x8e14('0xc')];_0x47eef0[_0x8e14('0xd')]=_0x532665[_0x8e14('0xd')];utils[_0x8e14('0xe')](_0x8e14('0xf'),_0x47eef0);}else{utils[_0x8e14('0x10')](_0x47eef0[_0x8e14('0x8')]['split']('/')[0x1])[_0x8e14('0xa')](function(_0x5dc2a5){if(_0x5dc2a5){_0x47eef0[_0x8e14('0xb')]=_0x5dc2a5[_0x8e14('0xc')];_0x47eef0[_0x8e14('0xd')]=_0x5dc2a5[_0x8e14('0xd')];utils[_0x8e14('0xe')]('CreateMemberReport',_0x47eef0);}});}})[_0x8e14('0x11')](function(_0x1992b7){utils[_0x8e14('0x12')](util[_0x8e14('0x5')]('[%s][members][writeDB]',_0x47eef0[_0x8e14('0x7')]),_0x1992b7);});}delete members[_0x47eef0['interface']];}function startsWith(_0x2f4ee6,_0xd963c){return _[_0x8e14('0x13')](_0x2f4ee6,function(_0x358f5c){return _[_0x8e14('0x14')](_0xd963c,_0x358f5c);});}exports['devicestatechange']=function(_0x4af728){try{utils[_0x8e14('0x15')](util['format'](_0x8e14('0x16'),members[_0x4af728['device']]?members[_0x4af728['device']][_0x8e14('0x7')]:_0x4af728[_0x8e14('0x17')]),_0x4af728);utils[_0x8e14('0x18')](util[_0x8e14('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4af728[_0x8e14('0x17')]]?members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x7')]:_0x4af728['device'],_0x4af728['state'],_0x4af728['device']));switch(_0x4af728[_0x8e14('0x19')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x4af728[_0x8e14('0x17')])){members[_0x4af728[_0x8e14('0x17')]]={'channel':_0x8e14('0x1a'),'interface':_0x4af728[_0x8e14('0x17')],'type':_0x8e14('0x1b'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x8e14('0x1c'):if(!_[_0x8e14('0x1d')](members[_0x4af728[_0x8e14('0x17')]])){members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x1e')]=utils[_0x8e14('0x1f')]();members[_0x4af728[_0x8e14('0x17')]]['duration']=utils[_0x8e14('0x20')](members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x1e')],members[_0x4af728['device']][_0x8e14('0x21')]);if(members[_0x4af728[_0x8e14('0x17')]][_0x8e14('0x7')]){writeDB(members[_0x4af728[_0x8e14('0x17')]]);}}break;default:break;}}catch(_0x96c66d){utils['error'](util['format'](_0x8e14('0x16'),members[_0x4af728[_0x8e14('0x17')]]?members[_0x4af728['device']][_0x8e14('0x7')]:_0x4af728[_0x8e14('0x17')]),_0x96c66d);}};exports['agentcomplete']=function(_0x563249){try{if(!_[_0x8e14('0x1d')](members[_0x563249['interface']])){utils[_0x8e14('0x15')](util[_0x8e14('0x5')](_0x8e14('0x22'),_0x563249[_0x8e14('0x7')]),_0x563249);utils[_0x8e14('0x18')](util[_0x8e14('0x5')](_0x8e14('0x23'),_0x563249[_0x8e14('0x7')],_0x563249[_0x8e14('0x8')],_0x563249[_0x8e14('0x24')]));members[_0x563249[_0x8e14('0x8')]]=_[_0x8e14('0x25')](members[_0x563249[_0x8e14('0x8')]],{'data4':_0x563249[_0x8e14('0x24')],'uniqueid':_0x563249[_0x8e14('0x7')]});}}catch(_0x190bfc){utils['error'](util[_0x8e14('0x5')](_0x8e14('0x22'),_0x563249['uniqueid']),_0x190bfc);}};exports[_0x8e14('0x26')]=function(_0x28182b){try{utils[_0x8e14('0x15')](util[_0x8e14('0x5')](_0x8e14('0x27'),_0x28182b[_0x8e14('0x7')]),_0x28182b);if(_0x28182b[_0x8e14('0x28')]){var _0x4f8f18=_0x28182b[_0x8e14('0x28')][_0x8e14('0x29')]('-')[0x0];if(!_['isNil'](members[_0x4f8f18])){members[_0x4f8f18]=_[_0x8e14('0x25')](members[_0x4f8f18],{'data1':members[_0x4f8f18]['data1']||_0x28182b[_0x8e14('0x9')],'data2':members[_0x4f8f18]['data2']||_0x28182b[_0x8e14('0x2a')],'data3':members[_0x4f8f18][_0x8e14('0x2b')]||_0x28182b[_0x8e14('0x2c')],'uniqueid':members[_0x4f8f18][_0x8e14('0x7')]||_0x28182b[_0x8e14('0x7')]});utils[_0x8e14('0x18')](util[_0x8e14('0x5')](_0x8e14('0x2d'),_0x28182b[_0x8e14('0x7')],members[_0x4f8f18][_0x8e14('0x2e')],members[_0x4f8f18]['data2'],members[_0x4f8f18][_0x8e14('0x2b')]));if(members[_0x4f8f18]['exitAt']){writeDB(members[_0x4f8f18]);}}}if(_0x28182b[_0x8e14('0x2f')]){var _0x14fc4a=_0x28182b[_0x8e14('0x2f')][_0x8e14('0x29')]('-')[0x0];if(!_[_0x8e14('0x1d')](members[_0x14fc4a])){members[_0x14fc4a]=_[_0x8e14('0x25')](members[_0x14fc4a],{'data1':members[_0x14fc4a][_0x8e14('0x2e')]||_0x28182b[_0x8e14('0x9')],'data2':members[_0x14fc4a]['data2']||_0x28182b[_0x8e14('0x2a')],'data3':members[_0x14fc4a][_0x8e14('0x2b')]||_0x28182b[_0x8e14('0x2c')],'uniqueid':members[_0x14fc4a]['uniqueid']||_0x28182b[_0x8e14('0x7')]});utils[_0x8e14('0x18')](util[_0x8e14('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x28182b['uniqueid'],members[_0x14fc4a][_0x8e14('0x2e')],members[_0x14fc4a][_0x8e14('0x30')],members[_0x14fc4a][_0x8e14('0x2b')]));if(members[_0x14fc4a][_0x8e14('0x1e')]){writeDB(members[_0x14fc4a]);}}}}catch(_0x341db5){utils[_0x8e14('0x12')](util['format'](_0x8e14('0x27'),_0x28182b[_0x8e14('0x7')]),_0x341db5);}}; \ No newline at end of file +var _0xe1a8=['data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','membername','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source'];(function(_0x130599,_0x1e7822){var _0x30b1ac=function(_0x69287c){while(--_0x69287c){_0x130599['push'](_0x130599['shift']());}};_0x30b1ac(++_0x1e7822);}(_0xe1a8,0x6f));var _0x8e1a=function(_0x23cc76,_0x9c756b){_0x23cc76=_0x23cc76-0x0;var _0x2f5c13=_0xe1a8[_0x23cc76];return _0x2f5c13;};'use strict';var _=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var utils=require(_0x8e1a('0x2'));var members={};var exclude=[_0x8e1a('0x3'),_0x8e1a('0x4')];function writeDB(_0x334ee3){utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x334ee3[_0x8e1a('0x7')],_0x334ee3['interface'],_0x334ee3[_0x8e1a('0x8')],_0x334ee3['data2'],_0x334ee3[_0x8e1a('0x9')],_0x334ee3['type']));if(_0x334ee3[_0x8e1a('0xa')]){utils[_0x8e1a('0xb')](_0x334ee3[_0x8e1a('0xa')])[_0x8e1a('0xc')](function(_0x1bda81){if(_0x1bda81){_0x334ee3[_0x8e1a('0x9')]=_0x1bda81['name'];_0x334ee3[_0x8e1a('0xd')]=_0x1bda81[_0x8e1a('0xd')];utils[_0x8e1a('0xe')](_0x8e1a('0xf'),_0x334ee3);}else{utils[_0x8e1a('0x10')](_0x334ee3['interface'][_0x8e1a('0x11')]('/')[0x1])[_0x8e1a('0xc')](function(_0x39efbb){if(_0x39efbb){_0x334ee3[_0x8e1a('0x9')]=_0x39efbb['name'];_0x334ee3[_0x8e1a('0xd')]=_0x39efbb[_0x8e1a('0xd')];utils['request']('CreateMemberReport',_0x334ee3);}});}})[_0x8e1a('0x12')](function(_0x2cf927){utils[_0x8e1a('0x13')](util[_0x8e1a('0x6')](_0x8e1a('0x14'),_0x334ee3[_0x8e1a('0x7')]),_0x2cf927);});}delete members[_0x334ee3[_0x8e1a('0xa')]];}function startsWith(_0x2df86d,_0x27b822){return _['some'](_0x2df86d,function(_0x2a6a5c){return _[_0x8e1a('0x15')](_0x27b822,_0x2a6a5c);});}exports[_0x8e1a('0x16')]=function(_0x34c777){try{utils[_0x8e1a('0x17')](util['format'](_0x8e1a('0x18'),members[_0x34c777[_0x8e1a('0x19')]]?members[_0x34c777['device']][_0x8e1a('0x7')]:_0x34c777[_0x8e1a('0x19')]),_0x34c777);utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x34c777['device']]?members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x7')]:_0x34c777['device'],_0x34c777[_0x8e1a('0x1a')],_0x34c777[_0x8e1a('0x19')]));switch(_0x34c777[_0x8e1a('0x1a')]){case _0x8e1a('0x1b'):case'BUSY':if(!startsWith(exclude,_0x34c777[_0x8e1a('0x19')])){members[_0x34c777[_0x8e1a('0x19')]]={'channel':_0x8e1a('0x1c'),'interface':_0x34c777['device'],'type':_0x8e1a('0x1d'),'enterAt':utils[_0x8e1a('0x1e')](),'role':_0x8e1a('0x1f')};}break;case _0x8e1a('0x20'):if(!_['isNil'](members[_0x34c777[_0x8e1a('0x19')]])){members[_0x34c777[_0x8e1a('0x19')]]['exitAt']=utils['now']();members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x21')]=utils[_0x8e1a('0x22')](members[_0x34c777['device']][_0x8e1a('0x23')],members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x24')]);if(members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x7')]){writeDB(members[_0x34c777[_0x8e1a('0x19')]]);}}break;default:break;}}catch(_0x4b501d){utils[_0x8e1a('0x13')](util[_0x8e1a('0x6')](_0x8e1a('0x18'),members[_0x34c777['device']]?members[_0x34c777[_0x8e1a('0x19')]]['uniqueid']:_0x34c777[_0x8e1a('0x19')]),_0x4b501d);}};exports[_0x8e1a('0x25')]=function(_0x5d104c){try{if(!_[_0x8e1a('0x26')](members[_0x5d104c[_0x8e1a('0xa')]])){utils[_0x8e1a('0x17')](util[_0x8e1a('0x6')](_0x8e1a('0x27'),_0x5d104c[_0x8e1a('0x7')]),_0x5d104c);utils[_0x8e1a('0x5')](util['format'](_0x8e1a('0x28'),_0x5d104c['uniqueid'],_0x5d104c[_0x8e1a('0xa')],_0x5d104c[_0x8e1a('0x29')]));members[_0x5d104c[_0x8e1a('0xa')]]=_[_0x8e1a('0x2a')](members[_0x5d104c[_0x8e1a('0xa')]],{'data4':_0x5d104c[_0x8e1a('0x29')],'uniqueid':_0x5d104c[_0x8e1a('0x7')]});}}catch(_0x980070){utils[_0x8e1a('0x13')](util[_0x8e1a('0x6')](_0x8e1a('0x27'),_0x5d104c['uniqueid']),_0x980070);}};exports[_0x8e1a('0x2b')]=function(_0x49a6c3){try{utils['debug'](util[_0x8e1a('0x6')](_0x8e1a('0x2c'),_0x49a6c3[_0x8e1a('0x7')]),_0x49a6c3);if(_0x49a6c3[_0x8e1a('0x8')]){var _0x42d22a=_0x49a6c3[_0x8e1a('0x8')][_0x8e1a('0x11')]('-')[0x0];if(!_[_0x8e1a('0x26')](members[_0x42d22a])){members[_0x42d22a]=_[_0x8e1a('0x2a')](members[_0x42d22a],{'data1':members[_0x42d22a][_0x8e1a('0x2d')]||_0x49a6c3['type'],'data2':members[_0x42d22a][_0x8e1a('0x2e')]||_0x49a6c3[_0x8e1a('0x2f')],'data3':members[_0x42d22a][_0x8e1a('0x30')]||_0x49a6c3[_0x8e1a('0x31')],'uniqueid':members[_0x42d22a]['uniqueid']||_0x49a6c3[_0x8e1a('0x7')]});utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')](_0x8e1a('0x32'),_0x49a6c3['uniqueid'],members[_0x42d22a][_0x8e1a('0x2d')],members[_0x42d22a][_0x8e1a('0x2e')],members[_0x42d22a]['data3']));if(members[_0x42d22a][_0x8e1a('0x23')]){writeDB(members[_0x42d22a]);}}}if(_0x49a6c3[_0x8e1a('0x33')]){var _0x4f241f=_0x49a6c3[_0x8e1a('0x33')]['split']('-')[0x0];if(!_[_0x8e1a('0x26')](members[_0x4f241f])){members[_0x4f241f]=_[_0x8e1a('0x2a')](members[_0x4f241f],{'data1':members[_0x4f241f][_0x8e1a('0x2d')]||_0x49a6c3[_0x8e1a('0x34')],'data2':members[_0x4f241f][_0x8e1a('0x2e')]||_0x49a6c3[_0x8e1a('0x2f')],'data3':members[_0x4f241f][_0x8e1a('0x30')]||_0x49a6c3[_0x8e1a('0x31')],'uniqueid':members[_0x4f241f][_0x8e1a('0x7')]||_0x49a6c3[_0x8e1a('0x7')]});utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x49a6c3['uniqueid'],members[_0x4f241f][_0x8e1a('0x2d')],members[_0x4f241f][_0x8e1a('0x2e')],members[_0x4f241f][_0x8e1a('0x30')]));if(members[_0x4f241f][_0x8e1a('0x23')]){writeDB(members[_0x4f241f]);}}}}catch(_0x58ded5){utils[_0x8e1a('0x13')](util['format'](_0x8e1a('0x2c'),_0x49a6c3[_0x8e1a('0x7')]),_0x58ded5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index dae30be..38ee849 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 _0x4b54=['count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','channel','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime'];(function(_0x2a359f,_0x3549c1){var _0x275672=function(_0x4ef4be){while(--_0x4ef4be){_0x2a359f['push'](_0x2a359f['shift']());}};_0x275672(++_0x3549c1);}(_0x4b54,0x103));var _0x44b5=function(_0x41b840,_0x1a3baf){_0x41b840=_0x41b840-0x0;var _0x2a0adf=_0x4b54[_0x41b840];return _0x2a0adf;};'use strict';var _=require(_0x44b5('0x0'));var util=require(_0x44b5('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1f407c){utils[_0x44b5('0x2')](util[_0x44b5('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1f407c['uniqueid'],_0x1f407c[_0x44b5('0x4')],_0x1f407c['queue'],_0x1f407c[_0x44b5('0x5')],_0x1f407c[_0x44b5('0x6')],_0x1f407c['accountcode'],_0x1f407c[_0x44b5('0x7')]));if(_0x1f407c[_0x44b5('0x8')]){utils[_0x44b5('0x9')](_0x1f407c['queue'])[_0x44b5('0xa')](function(_0x9ce582){if(_0x9ce582){_0x1f407c['type']=_0x9ce582[_0x44b5('0xb')];}utils[_0x44b5('0xc')](_0x44b5('0xd'),_0x1f407c);});}else{utils[_0x44b5('0xc')](_0x44b5('0xd'),_0x1f407c);}if(_0x1f407c[_0x44b5('0xe')]){delete queues[_0x1f407c[_0x44b5('0xe')]];}else{delete queues[_0x1f407c[_0x44b5('0xf')]];}}exports[_0x44b5('0x10')]=function(_0x2e68c4){try{utils[_0x44b5('0x11')](util['format'](_0x44b5('0x12'),_0x2e68c4[_0x44b5('0xf')]),_0x2e68c4);utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x13'),_0x2e68c4[_0x44b5('0xf')],_0x2e68c4[_0x44b5('0x8')],_0x2e68c4[_0x44b5('0x14')]));queues[_0x2e68c4[_0x44b5('0xf')]]=_['assign'](_0x2e68c4,{'originalposition':_0x2e68c4['position'],'queuecallerjoinAt':utils[_0x44b5('0x15')](),'mohtime':0x0});}catch(_0x13b194){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x2e68c4[_0x44b5('0xf')]),_0x13b194);}};exports[_0x44b5('0x16')]=function(_0x545270){try{if(!_[_0x44b5('0x17')](queues[_0x545270[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util['format'](_0x44b5('0x18'),_0x545270[_0x44b5('0xf')]),_0x545270);if(queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x19')]){if(!queues[_0x545270[_0x44b5('0xf')]]['queuecallerabandon']&&!queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x1a')]){queues[_0x545270['uniqueid']][_0x44b5('0x1b')]=!![];queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x1c')]=utils[_0x44b5('0x15')]();queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x7')]=_0x44b5('0x1d');}utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x1e'),_0x545270[_0x44b5('0xf')],queues[_0x545270[_0x44b5('0xf')]]['name'],queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x7')]));writeDB(queues[_0x545270[_0x44b5('0xf')]]);}else if(queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]){utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x1f'),_0x545270[_0x44b5('0xf')],queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0x20')],queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]));queues[queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]]=queues[_0x545270['uniqueid']];queues[queues[_0x545270[_0x44b5('0xf')]][_0x44b5('0xe')]][_0x44b5('0x21')]=0x2;delete queues[_0x545270[_0x44b5('0xf')]];}}}catch(_0x5e04b8){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][hangup]',_0x545270[_0x44b5('0xf')]),_0x5e04b8);}};exports[_0x44b5('0x23')]=function(_0x5e5687){try{utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x24'),_0x5e5687['uniqueid']),_0x5e5687);if(!_[_0x44b5('0x17')](_0x5e5687[_0x44b5('0x25')][_0x44b5('0x26')])&&_0x5e5687[_0x44b5('0x27')][_0x44b5('0x28')]()!==_0x44b5('0x29')){if(!_['isNil'](queues[_0x5e5687[_0x44b5('0xf')]])){queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2b')]=null;queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x1a')]=!![];queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2c')]=utils['now']();queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x7')]=_0x5e5687['value'][_0x44b5('0x28')]();utils[_0x44b5('0x2')](util['format'](_0x44b5('0x2d'),_0x5e5687['uniqueid'],queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x20')],_0x5e5687['value'],queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x7')]));writeDB(queues[_0x5e5687[_0x44b5('0xf')]]);}}else if(!_['isNil'](_0x5e5687[_0x44b5('0x25')][_0x44b5('0x2e')])){if(!_[_0x44b5('0x17')](queues[_0x5e5687[_0x44b5('0xf')]])&&!queues[_0x5e5687[_0x44b5('0xf')]]['queuecallerabandon']){queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x5e5687['uniqueid']][_0x44b5('0x2b')]=null;queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x1a')]=!![];queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x2c')]=utils[_0x44b5('0x15')]();queues[_0x5e5687['uniqueid']][_0x44b5('0x7')]='EXITWITHKEY';utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x2f'),_0x5e5687[_0x44b5('0xf')],queues[_0x5e5687['uniqueid']][_0x44b5('0x20')],_0x5e5687['value'],queues[_0x5e5687[_0x44b5('0xf')]][_0x44b5('0x7')]));}}}catch(_0x8819a4){utils['error'](util[_0x44b5('0x3')](_0x44b5('0x24'),_0x5e5687[_0x44b5('0xf')]),_0x8819a4);}};exports[_0x44b5('0x2a')]=function(_0x2e57be){try{if(!_[_0x44b5('0x17')](queues[_0x2e57be[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x30'),_0x2e57be[_0x44b5('0xf')]),_0x2e57be);queues[_0x2e57be[_0x44b5('0xf')]]['queuecallerexit']=![];queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x2c')]=null;queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x2a')]=!![];queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x2b')]=utils[_0x44b5('0x15')]();queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x7')]=_0x44b5('0x31');utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x32'),_0x2e57be[_0x44b5('0xf')],queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x20')],queues[_0x2e57be[_0x44b5('0xf')]][_0x44b5('0x7')]));}}catch(_0xca4493){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][queuecallerabandon]',_0x2e57be[_0x44b5('0xf')]),_0xca4493);}};exports[_0x44b5('0x33')]=function(_0x3ea5d3){try{if(!_[_0x44b5('0x17')](queues[_0x3ea5d3[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')]('[%s][queues][queuecallerleave]',_0x3ea5d3['uniqueid']),_0x3ea5d3);utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x34'),_0x3ea5d3['uniqueid'],queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x20')],_0x3ea5d3[_0x44b5('0x35')],_0x3ea5d3['connectedlinename']));queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x33')]=!![];queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x19')]=utils['now']();queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x36')]=utils[_0x44b5('0x37')](queues[_0x3ea5d3['uniqueid']]['queuecallerleaveAt'],queues[_0x3ea5d3[_0x44b5('0xf')]]['queuecallerjoinAt']);queues[_0x3ea5d3['uniqueid']][_0x44b5('0x14')]=_0x3ea5d3[_0x44b5('0x14')];queues[_0x3ea5d3[_0x44b5('0xf')]][_0x44b5('0x38')]=_0x3ea5d3[_0x44b5('0x38')];queues[_0x3ea5d3['uniqueid']][_0x44b5('0x35')]=_0x3ea5d3[_0x44b5('0x35')];queues[_0x3ea5d3['uniqueid']][_0x44b5('0x39')]=_0x3ea5d3[_0x44b5('0x39')];}}catch(_0x5e0f6f){utils[_0x44b5('0x22')](util[_0x44b5('0x3')](_0x44b5('0x3a'),_0x3ea5d3[_0x44b5('0xf')]),_0x5e0f6f);}};exports[_0x44b5('0x3b')]=function(_0x1f73b0){try{if(!_[_0x44b5('0x17')](queues[_0x1f73b0[_0x44b5('0xf')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x3c'),_0x1f73b0[_0x44b5('0xf')]),_0x1f73b0);utils['info'](util[_0x44b5('0x3')](_0x44b5('0x3d'),_0x1f73b0[_0x44b5('0xf')],queues[_0x1f73b0['uniqueid']]['name'],_0x1f73b0['membername'],_0x1f73b0[_0x44b5('0x3e')]));queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x1f73b0[_0x44b5('0xf')]]['queuecallerabandon']=![];queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x2b')]=null;queues[_0x1f73b0[_0x44b5('0xf')]]['queuecallerexit']=![];queues[_0x1f73b0[_0x44b5('0xf')]]['queuecallerexitreason']=null;queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x2c')]=null;queues[_0x1f73b0[_0x44b5('0xf')]]['assigned']=!![];queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x3f')]=_0x1f73b0[_0x44b5('0x3e')];queues[_0x1f73b0[_0x44b5('0xf')]][_0x44b5('0x5')]=_0x1f73b0[_0x44b5('0x40')];}}catch(_0x45acb1){utils['error'](util[_0x44b5('0x3')]('[%s][queues][agentconnect]',_0x1f73b0[_0x44b5('0xf')]),_0x45acb1);}};exports[_0x44b5('0x41')]=function(_0x550dbb){try{if(!_[_0x44b5('0x17')](queues[_0x550dbb[_0x44b5('0xf')]])){if(queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x19')]){utils[_0x44b5('0x11')](util['format'](_0x44b5('0x42'),_0x550dbb['uniqueid']),_0x550dbb);queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x2a')]=![];queues[_0x550dbb['uniqueid']]['queuecallerabandonAt']=null;queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x1a')]=![];queues[_0x550dbb[_0x44b5('0xf')]]['queuecallerexitAt']=null;queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x43')]=!![];queues[_0x550dbb[_0x44b5('0xf')]]['lastAssignedTo']=_0x550dbb[_0x44b5('0x40')];queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x1b')]=!![];queues[_0x550dbb['uniqueid']][_0x44b5('0x1c')]=utils[_0x44b5('0x15')]();if(_0x550dbb['reason']==_0x44b5('0x44')){if(!queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x44')]){queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x7')]='TRANSFER';}}else{queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x7')]='COMPLETEDBY'+_0x550dbb['reason']['toUpperCase']();}utils['info'](util['format'](_0x44b5('0x45'),_0x550dbb[_0x44b5('0xf')],queues[_0x550dbb['uniqueid']]['name'],_0x550dbb['membername'],queues[_0x550dbb[_0x44b5('0xf')]][_0x44b5('0x7')]));writeDB(queues[_0x550dbb['uniqueid']]);}}}catch(_0x37224a){utils['error'](util[_0x44b5('0x3')]('[%s][queues][agentcomplete]',_0x550dbb[_0x44b5('0xf')]),_0x37224a);}};exports[_0x44b5('0x46')]=function(_0x58a700){try{if(!_[_0x44b5('0x17')](queues[_0x58a700[_0x44b5('0x47')]])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x48'),_0x58a700[_0x44b5('0xf')]),_0x58a700);queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x44')]=!![];queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x49')]='BLIND';queues[_0x58a700['transfereeuniqueid']][_0x44b5('0x4a')]=_0x58a700[_0x44b5('0x4b')];queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x4c')]=_0x58a700[_0x44b5('0x47')];queues[_0x58a700[_0x44b5('0x47')]][_0x44b5('0x7')]=_0x44b5('0x4d');utils['info'](util[_0x44b5('0x3')](_0x44b5('0x4e'),_0x58a700['uniqueid'],queues[_0x58a700[_0x44b5('0x47')]]['name'],_0x58a700[_0x44b5('0x47')],_0x58a700[_0x44b5('0x4b')]));}}catch(_0x4dc841){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][blindtransfer]',_0x58a700[_0x44b5('0xf')]),_0x4dc841);}};exports[_0x44b5('0x4f')]=function(_0x53c573){try{utils[_0x44b5('0x11')](util[_0x44b5('0x3')](_0x44b5('0x50'),_0x53c573[_0x44b5('0x51')]),_0x53c573);if(_0x53c573['origtransfereruniqueid']==_0x53c573[_0x44b5('0x52')]){if(!_['isNil'](queues[_0x53c573['secondtransfererlinkedid']])){utils[_0x44b5('0x2')](util['format'](_0x44b5('0x53'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573['secondtransfererlinkedid']][_0x44b5('0x20')],_0x53c573[_0x44b5('0x54')]));queues[_0x53c573['secondtransfererlinkedid']][_0x44b5('0x44')]=!![];queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x49')]=_0x44b5('0x56');queues[_0x53c573['secondtransfererlinkedid']][_0x44b5('0x4a')]=_0x53c573['origtransfererexten'];queues[_0x53c573[_0x44b5('0x55')]]['transferuniqueid']=_0x53c573[_0x44b5('0x51')];queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x7')]=_0x44b5('0x57');}if(!_['isNil'](queues[_0x53c573[_0x44b5('0x52')]])){if(_0x53c573[_0x44b5('0x58')]&&queues[_0x53c573[_0x44b5('0x58')]]){queues[_0x53c573['transfereelinkedid']][_0x44b5('0x21')]=0x1;queues[_0x53c573[_0x44b5('0x47')]]=_[_0x44b5('0x59')](queues[_0x53c573['transfereelinkedid']]);queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0xe')]=_0x53c573[_0x44b5('0x5a')];queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x21')]=0x2;queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x6')]=queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x6')];queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5b')]=queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x5b')];queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5c')]=utils[_0x44b5('0x15')]();queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x19')]=utils[_0x44b5('0x15')]();queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x36')]=0x0;queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5d')]=0x0;utils['info'](util[_0x44b5('0x3')](_0x44b5('0x5e'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x20')],queues[_0x53c573[_0x44b5('0x47')]][_0x44b5('0x6')],queues[_0x53c573['transfereeuniqueid']][_0x44b5('0x5b')]));}else{utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x5f'),_0x53c573['origtransfereruniqueid'],queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x20')],_0x53c573[_0x44b5('0x55')]));queues[_0x53c573[_0x44b5('0x52')]]['transfereduniqueid']=_0x53c573[_0x44b5('0x55')];}}}else if(_0x53c573[_0x44b5('0x60')]==_0x53c573[_0x44b5('0x55')]){if(!_[_0x44b5('0x17')](queues[_0x53c573[_0x44b5('0x52')]])){utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x61'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573['origtransfererlinkedid']][_0x44b5('0x20')],_0x53c573[_0x44b5('0x60')],_0x53c573[_0x44b5('0x62')]));queues[_0x53c573['origtransfererlinkedid']][_0x44b5('0x44')]=!![];queues[_0x53c573['origtransfererlinkedid']]['transfertype']=_0x44b5('0x56');queues[_0x53c573['origtransfererlinkedid']][_0x44b5('0x4a')]=_0x53c573[_0x44b5('0x62')];queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x4c')]=_0x53c573[_0x44b5('0x60')];queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x7')]=_0x44b5('0x57');}if(!_[_0x44b5('0x17')](queues[_0x53c573[_0x44b5('0x55')]])){if(_0x53c573['transfertargetlinkedid']&&queues[_0x53c573[_0x44b5('0x63')]]){queues[_0x53c573[_0x44b5('0x63')]][_0x44b5('0x21')]=0x1;queues[_0x53c573[_0x44b5('0x5a')]]=_[_0x44b5('0x59')](queues[_0x53c573[_0x44b5('0x63')]]);queues[_0x53c573[_0x44b5('0x5a')]]['transfereduniqueid']=_0x53c573[_0x44b5('0x5a')];queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x21')]=0x2;queues[_0x53c573['transfertargetuniqueid']]['calleridnum']=queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x6')];queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x5b')]=queues[_0x53c573[_0x44b5('0x52')]][_0x44b5('0x5b')];queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x5c')]=utils[_0x44b5('0x15')]();queues[_0x53c573['transfertargetuniqueid']][_0x44b5('0x19')]=utils['now']();queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x36')]=0x0;queues[_0x53c573[_0x44b5('0x5a')]]['mohtime']=0x0;utils[_0x44b5('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x53c573['origtransfereruniqueid'],queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0x20')],queues[_0x53c573[_0x44b5('0x5a')]][_0x44b5('0xe')],queues[_0x53c573['transfertargetuniqueid']][_0x44b5('0x6')],queues[_0x53c573[_0x44b5('0x5a')]]['calleridname']));}else{utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x5f'),_0x53c573[_0x44b5('0x51')],queues[_0x53c573[_0x44b5('0x55')]][_0x44b5('0x20')],_0x53c573[_0x44b5('0x52')]));queues[_0x53c573['secondtransfererlinkedid']]['transfereduniqueid']=_0x53c573['origtransfererlinkedid'];}}}}catch(_0x2d8a39){utils[_0x44b5('0x22')](util[_0x44b5('0x3')](_0x44b5('0x50'),_0x53c573[_0x44b5('0x51')]),_0x2d8a39);}};exports[_0x44b5('0x64')]=function(_0x37f770){try{if(!_[_0x44b5('0x17')](queues[_0x37f770[_0x44b5('0xf')]])){utils['debug'](util['format'](_0x44b5('0x65'),_0x37f770[_0x44b5('0xf')]),_0x37f770);queues[_0x37f770[_0x44b5('0xf')]][_0x44b5('0x66')]=utils[_0x44b5('0x15')]();utils[_0x44b5('0x2')](util['format'](_0x44b5('0x67'),_0x37f770[_0x44b5('0xf')],queues[_0x37f770[_0x44b5('0xf')]]['name'],queues[_0x37f770[_0x44b5('0xf')]][_0x44b5('0x66')]));}}catch(_0x26078e){utils[_0x44b5('0x22')](util[_0x44b5('0x3')](_0x44b5('0x65'),_0x37f770[_0x44b5('0xf')]),_0x26078e);}};exports['musiconholdstop']=function(_0x669c42){try{if(!_[_0x44b5('0x17')](queues[_0x669c42[_0x44b5('0xf')]])){if(!_['isNil'](queues[_0x669c42[_0x44b5('0xf')]][_0x44b5('0x66')])){utils[_0x44b5('0x11')](util[_0x44b5('0x3')]('[%s][queues][musiconholdstop]',_0x669c42[_0x44b5('0xf')]),_0x669c42);queues[_0x669c42['uniqueid']][_0x44b5('0x5d')]+=utils[_0x44b5('0x37')](utils[_0x44b5('0x15')](),queues[_0x669c42[_0x44b5('0xf')]]['musiconholdstartAt']);utils[_0x44b5('0x2')](util[_0x44b5('0x3')](_0x44b5('0x68'),_0x669c42['uniqueid'],queues[_0x669c42['uniqueid']]['name'],queues[_0x669c42[_0x44b5('0xf')]]['mohtime']));delete queues[_0x669c42['uniqueid']][_0x44b5('0x66')];}}}catch(_0x2c375f){utils[_0x44b5('0x22')](util[_0x44b5('0x3')]('[%s][queues][musiconholdstop]',_0x669c42['uniqueid']),_0x2c375f);}}; \ No newline at end of file +var _0x9fd9=['[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridnum','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','position','assign','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','isNil','variable','value','CONTINUE','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid'];(function(_0x1dd9c0,_0x49a35f){var _0x1f8a71=function(_0x141cbe){while(--_0x141cbe){_0x1dd9c0['push'](_0x1dd9c0['shift']());}};_0x1f8a71(++_0x49a35f);}(_0x9fd9,0x1c3));var _0x99fd=function(_0x3968b4,_0x1dcec0){_0x3968b4=_0x3968b4-0x0;var _0x6e4318=_0x9fd9[_0x3968b4];return _0x6e4318;};'use strict';var _=require('lodash');var util=require(_0x99fd('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x26d6b5){utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x3'),_0x26d6b5[_0x99fd('0x4')],_0x26d6b5['channel'],_0x26d6b5[_0x99fd('0x5')],_0x26d6b5[_0x99fd('0x6')],_0x26d6b5['calleridnum'],_0x26d6b5['accountcode'],_0x26d6b5[_0x99fd('0x7')]));if(_0x26d6b5[_0x99fd('0x5')]){utils[_0x99fd('0x8')](_0x26d6b5['queue'])[_0x99fd('0x9')](function(_0x1159e4){if(_0x1159e4){_0x26d6b5[_0x99fd('0xa')]=_0x1159e4['type'];}utils[_0x99fd('0xb')](_0x99fd('0xc'),_0x26d6b5);});}else{utils[_0x99fd('0xb')]('CreateVoiceQueueReport',_0x26d6b5);}if(_0x26d6b5['transfereduniqueid']){delete queues[_0x26d6b5[_0x99fd('0xd')]];}else{delete queues[_0x26d6b5[_0x99fd('0x4')]];}}exports['queuecallerjoin']=function(_0xcf0b56){try{utils[_0x99fd('0xe')](util['format']('[%s][queues][queuecallerjoin]',_0xcf0b56[_0x99fd('0x4')]),_0xcf0b56);utils[_0x99fd('0x1')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xcf0b56[_0x99fd('0x4')],_0xcf0b56[_0x99fd('0x5')],_0xcf0b56[_0x99fd('0xf')]));queues[_0xcf0b56[_0x99fd('0x4')]]=_[_0x99fd('0x10')](_0xcf0b56,{'originalposition':_0xcf0b56['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4ba442){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x12'),_0xcf0b56['uniqueid']),_0x4ba442);}};exports[_0x99fd('0x13')]=function(_0x76f831){try{if(!_['isNil'](queues[_0x76f831['uniqueid']])){utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x14'),_0x76f831[_0x99fd('0x4')]),_0x76f831);if(queues[_0x76f831[_0x99fd('0x4')]][_0x99fd('0x15')]){if(!queues[_0x76f831[_0x99fd('0x4')]][_0x99fd('0x16')]&&!queues[_0x76f831[_0x99fd('0x4')]][_0x99fd('0x17')]){queues[_0x76f831[_0x99fd('0x4')]][_0x99fd('0x18')]=!![];queues[_0x76f831['uniqueid']][_0x99fd('0x19')]=utils[_0x99fd('0x1a')]();queues[_0x76f831['uniqueid']]['queuecallerexitreason']=_0x99fd('0x1b');}utils[_0x99fd('0x1')](util['format'](_0x99fd('0x1c'),_0x76f831[_0x99fd('0x4')],queues[_0x76f831['uniqueid']]['name'],queues[_0x76f831['uniqueid']][_0x99fd('0x7')]));writeDB(queues[_0x76f831[_0x99fd('0x4')]]);}else if(queues[_0x76f831['uniqueid']]['transfereduniqueid']){utils[_0x99fd('0x1')](util['format'](_0x99fd('0x1d'),_0x76f831['uniqueid'],queues[_0x76f831[_0x99fd('0x4')]][_0x99fd('0x1e')],queues[_0x76f831[_0x99fd('0x4')]]['transfereduniqueid']));queues[queues[_0x76f831[_0x99fd('0x4')]]['transfereduniqueid']]=queues[_0x76f831[_0x99fd('0x4')]];queues[queues[_0x76f831[_0x99fd('0x4')]][_0x99fd('0xd')]][_0x99fd('0x1f')]=0x2;delete queues[_0x76f831[_0x99fd('0x4')]];}}}catch(_0x4432a6){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x14'),_0x76f831[_0x99fd('0x4')]),_0x4432a6);}};exports[_0x99fd('0x20')]=function(_0x3ce0b7){try{utils[_0x99fd('0xe')](util[_0x99fd('0x2')]('[%s][queues][varset]',_0x3ce0b7['uniqueid']),_0x3ce0b7);if(!_[_0x99fd('0x21')](_0x3ce0b7[_0x99fd('0x22')]['queuestatus'])&&_0x3ce0b7[_0x99fd('0x23')]['toUpperCase']()!==_0x99fd('0x24')){if(!_[_0x99fd('0x21')](queues[_0x3ce0b7['uniqueid']])){queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x16')]=![];queues[_0x3ce0b7[_0x99fd('0x4')]]['queuecallerabandonAt']=null;queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x17')]=!![];queues[_0x3ce0b7['uniqueid']][_0x99fd('0x25')]=utils['now']();queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x7')]=_0x3ce0b7[_0x99fd('0x23')][_0x99fd('0x26')]();utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x27'),_0x3ce0b7['uniqueid'],queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x1e')],_0x3ce0b7['value'],queues[_0x3ce0b7[_0x99fd('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x3ce0b7[_0x99fd('0x4')]]);}}else if(!_[_0x99fd('0x21')](_0x3ce0b7[_0x99fd('0x22')][_0x99fd('0x28')])){if(!_[_0x99fd('0x21')](queues[_0x3ce0b7[_0x99fd('0x4')]])&&!queues[_0x3ce0b7[_0x99fd('0x4')]]['queuecallerabandon']){queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x16')]=![];queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x29')]=null;queues[_0x3ce0b7['uniqueid']]['queuecallerexit']=!![];queues[_0x3ce0b7[_0x99fd('0x4')]]['queuecallerexitAt']=utils[_0x99fd('0x1a')]();queues[_0x3ce0b7['uniqueid']][_0x99fd('0x7')]='EXITWITHKEY';utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x2a'),_0x3ce0b7[_0x99fd('0x4')],queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x1e')],_0x3ce0b7['value'],queues[_0x3ce0b7[_0x99fd('0x4')]][_0x99fd('0x7')]));}}}catch(_0x3ccc03){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x2b'),_0x3ce0b7[_0x99fd('0x4')]),_0x3ccc03);}};exports['queuecallerabandon']=function(_0x2110a3){try{if(!_[_0x99fd('0x21')](queues[_0x2110a3['uniqueid']])){utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x2c'),_0x2110a3[_0x99fd('0x4')]),_0x2110a3);queues[_0x2110a3['uniqueid']]['queuecallerexit']=![];queues[_0x2110a3[_0x99fd('0x4')]][_0x99fd('0x25')]=null;queues[_0x2110a3[_0x99fd('0x4')]]['queuecallerabandon']=!![];queues[_0x2110a3[_0x99fd('0x4')]][_0x99fd('0x29')]=utils['now']();queues[_0x2110a3[_0x99fd('0x4')]]['queuecallerexitreason']=_0x99fd('0x2d');utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x2e'),_0x2110a3[_0x99fd('0x4')],queues[_0x2110a3[_0x99fd('0x4')]]['name'],queues[_0x2110a3['uniqueid']][_0x99fd('0x7')]));}}catch(_0x23073b){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x2c'),_0x2110a3[_0x99fd('0x4')]),_0x23073b);}};exports[_0x99fd('0x2f')]=function(_0x242fb7){try{if(!_[_0x99fd('0x21')](queues[_0x242fb7[_0x99fd('0x4')]])){utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x30'),_0x242fb7[_0x99fd('0x4')]),_0x242fb7);utils[_0x99fd('0x1')](util['format'](_0x99fd('0x31'),_0x242fb7[_0x99fd('0x4')],queues[_0x242fb7['uniqueid']][_0x99fd('0x1e')],_0x242fb7['connectedlinenum'],_0x242fb7[_0x99fd('0x32')]));queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0x2f')]=!![];queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0x15')]=utils[_0x99fd('0x1a')]();queues[_0x242fb7['uniqueid']][_0x99fd('0x33')]=utils[_0x99fd('0x34')](queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0x15')],queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0x35')]);queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0xf')]=_0x242fb7[_0x99fd('0xf')];queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0x36')]=_0x242fb7['count'];queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0x37')]=_0x242fb7[_0x99fd('0x37')];queues[_0x242fb7[_0x99fd('0x4')]][_0x99fd('0x32')]=_0x242fb7['connectedlinename'];}}catch(_0x5a34e5){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x30'),_0x242fb7[_0x99fd('0x4')]),_0x5a34e5);}};exports['agentconnect']=function(_0x317caf){try{if(!_[_0x99fd('0x21')](queues[_0x317caf[_0x99fd('0x4')]])){utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x38'),_0x317caf[_0x99fd('0x4')]),_0x317caf);utils['info'](util[_0x99fd('0x2')](_0x99fd('0x39'),_0x317caf[_0x99fd('0x4')],queues[_0x317caf['uniqueid']][_0x99fd('0x1e')],_0x317caf['membername'],_0x317caf[_0x99fd('0x3a')]));queues[_0x317caf['uniqueid']][_0x99fd('0x16')]=![];queues[_0x317caf[_0x99fd('0x4')]][_0x99fd('0x16')]=![];queues[_0x317caf[_0x99fd('0x4')]][_0x99fd('0x29')]=null;queues[_0x317caf[_0x99fd('0x4')]][_0x99fd('0x17')]=![];queues[_0x317caf[_0x99fd('0x4')]][_0x99fd('0x7')]=null;queues[_0x317caf['uniqueid']][_0x99fd('0x25')]=null;queues[_0x317caf[_0x99fd('0x4')]][_0x99fd('0x3b')]=!![];queues[_0x317caf[_0x99fd('0x4')]][_0x99fd('0x3c')]=_0x317caf[_0x99fd('0x3a')];queues[_0x317caf[_0x99fd('0x4')]][_0x99fd('0x6')]=_0x317caf[_0x99fd('0x3d')];}}catch(_0x8daf0f){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x38'),_0x317caf['uniqueid']),_0x8daf0f);}};exports[_0x99fd('0x3e')]=function(_0x3c917e){try{if(!_['isNil'](queues[_0x3c917e['uniqueid']])){if(queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x15')]){utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x3f'),_0x3c917e[_0x99fd('0x4')]),_0x3c917e);queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x16')]=![];queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x16')]=![];queues[_0x3c917e['uniqueid']][_0x99fd('0x29')]=null;queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x17')]=![];queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x25')]=null;queues[_0x3c917e['uniqueid']][_0x99fd('0x3b')]=!![];queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x6')]=_0x3c917e[_0x99fd('0x3d')];queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x18')]=!![];queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x19')]=utils['now']();if(_0x3c917e[_0x99fd('0x40')]==_0x99fd('0x41')){if(!queues[_0x3c917e['uniqueid']][_0x99fd('0x41')]){queues[_0x3c917e[_0x99fd('0x4')]]['queuecallerexitreason']=_0x99fd('0x42');}}else{queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x7')]=_0x99fd('0x43')+_0x3c917e[_0x99fd('0x40')][_0x99fd('0x26')]();}utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x44'),_0x3c917e[_0x99fd('0x4')],queues[_0x3c917e['uniqueid']][_0x99fd('0x1e')],_0x3c917e['membername'],queues[_0x3c917e[_0x99fd('0x4')]][_0x99fd('0x7')]));writeDB(queues[_0x3c917e[_0x99fd('0x4')]]);}}}catch(_0x4a5fb0){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x3f'),_0x3c917e[_0x99fd('0x4')]),_0x4a5fb0);}};exports[_0x99fd('0x45')]=function(_0x3135fe){try{if(!_[_0x99fd('0x21')](queues[_0x3135fe[_0x99fd('0x46')]])){utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x47'),_0x3135fe[_0x99fd('0x4')]),_0x3135fe);queues[_0x3135fe[_0x99fd('0x46')]]['transfer']=!![];queues[_0x3135fe[_0x99fd('0x46')]]['transfertype']='BLIND';queues[_0x3135fe[_0x99fd('0x46')]]['transferexten']=_0x3135fe[_0x99fd('0x48')];queues[_0x3135fe[_0x99fd('0x46')]]['transferuniqueid']=_0x3135fe[_0x99fd('0x46')];queues[_0x3135fe['transfereeuniqueid']][_0x99fd('0x7')]='BLINDTRANSFER';utils['info'](util[_0x99fd('0x2')](_0x99fd('0x49'),_0x3135fe[_0x99fd('0x4')],queues[_0x3135fe[_0x99fd('0x46')]][_0x99fd('0x1e')],_0x3135fe[_0x99fd('0x46')],_0x3135fe['extension']));}}catch(_0x4284a5){utils[_0x99fd('0x11')](util[_0x99fd('0x2')]('[%s][queues][blindtransfer]',_0x3135fe['uniqueid']),_0x4284a5);}};exports[_0x99fd('0x4a')]=function(_0x4e74a8){try{utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x4b'),_0x4e74a8[_0x99fd('0x4c')]),_0x4e74a8);if(_0x4e74a8[_0x99fd('0x4c')]==_0x4e74a8[_0x99fd('0x4d')]){if(!_[_0x99fd('0x21')](queues[_0x4e74a8[_0x99fd('0x4e')]])){utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x4f'),_0x4e74a8[_0x99fd('0x4c')],queues[_0x4e74a8['secondtransfererlinkedid']][_0x99fd('0x1e')],_0x4e74a8[_0x99fd('0x50')]));queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0x41')]=!![];queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0x51')]=_0x99fd('0x52');queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0x53')]=_0x4e74a8[_0x99fd('0x50')];queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0x54')]=_0x4e74a8[_0x99fd('0x4c')];queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0x7')]=_0x99fd('0x55');}if(!_['isNil'](queues[_0x4e74a8['origtransfererlinkedid']])){if(_0x4e74a8[_0x99fd('0x56')]&&queues[_0x4e74a8[_0x99fd('0x56')]]){queues[_0x4e74a8[_0x99fd('0x56')]]['queuecallerenterreason']=0x1;queues[_0x4e74a8[_0x99fd('0x46')]]=_[_0x99fd('0x57')](queues[_0x4e74a8[_0x99fd('0x56')]]);queues[_0x4e74a8[_0x99fd('0x46')]]['transfereduniqueid']=_0x4e74a8[_0x99fd('0x58')];queues[_0x4e74a8[_0x99fd('0x46')]]['queuecallerenterreason']=0x2;queues[_0x4e74a8[_0x99fd('0x46')]]['calleridnum']=queues[_0x4e74a8[_0x99fd('0x4e')]]['calleridnum'];queues[_0x4e74a8[_0x99fd('0x46')]][_0x99fd('0x59')]=queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0x59')];queues[_0x4e74a8['transfereeuniqueid']][_0x99fd('0x35')]=utils[_0x99fd('0x1a')]();queues[_0x4e74a8[_0x99fd('0x46')]]['queuecallerleaveAt']=utils[_0x99fd('0x1a')]();queues[_0x4e74a8[_0x99fd('0x46')]][_0x99fd('0x33')]=0x0;queues[_0x4e74a8[_0x99fd('0x46')]][_0x99fd('0x5a')]=0x0;utils[_0x99fd('0x1')](util['format'](_0x99fd('0x5b'),_0x4e74a8[_0x99fd('0x4c')],queues[_0x4e74a8[_0x99fd('0x46')]][_0x99fd('0x1e')],queues[_0x4e74a8[_0x99fd('0x46')]][_0x99fd('0x5c')],queues[_0x4e74a8['transfereeuniqueid']]['calleridname']));}else{utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x5d'),_0x4e74a8[_0x99fd('0x4c')],queues[_0x4e74a8[_0x99fd('0x4d')]][_0x99fd('0x1e')],_0x4e74a8[_0x99fd('0x4e')]));queues[_0x4e74a8[_0x99fd('0x4d')]][_0x99fd('0xd')]=_0x4e74a8[_0x99fd('0x4e')];}}}else if(_0x4e74a8[_0x99fd('0x5e')]==_0x4e74a8['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x4e74a8[_0x99fd('0x4d')]])){utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x5f'),_0x4e74a8['origtransfereruniqueid'],queues[_0x4e74a8[_0x99fd('0x4d')]]['name'],_0x4e74a8['secondtransfereruniqueid'],_0x4e74a8[_0x99fd('0x60')]));queues[_0x4e74a8['origtransfererlinkedid']][_0x99fd('0x41')]=!![];queues[_0x4e74a8[_0x99fd('0x4d')]][_0x99fd('0x51')]='ATTENDED';queues[_0x4e74a8['origtransfererlinkedid']][_0x99fd('0x53')]=_0x4e74a8[_0x99fd('0x60')];queues[_0x4e74a8[_0x99fd('0x4d')]][_0x99fd('0x54')]=_0x4e74a8[_0x99fd('0x5e')];queues[_0x4e74a8[_0x99fd('0x4d')]]['queuecallerexitreason']=_0x99fd('0x55');}if(!_[_0x99fd('0x21')](queues[_0x4e74a8[_0x99fd('0x4e')]])){if(_0x4e74a8['transfertargetlinkedid']&&queues[_0x4e74a8[_0x99fd('0x61')]]){queues[_0x4e74a8[_0x99fd('0x61')]][_0x99fd('0x1f')]=0x1;queues[_0x4e74a8[_0x99fd('0x58')]]=_[_0x99fd('0x57')](queues[_0x4e74a8[_0x99fd('0x61')]]);queues[_0x4e74a8[_0x99fd('0x58')]]['transfereduniqueid']=_0x4e74a8['transfertargetuniqueid'];queues[_0x4e74a8[_0x99fd('0x58')]][_0x99fd('0x1f')]=0x2;queues[_0x4e74a8[_0x99fd('0x58')]]['calleridnum']=queues[_0x4e74a8['origtransfererlinkedid']]['calleridnum'];queues[_0x4e74a8[_0x99fd('0x58')]][_0x99fd('0x59')]=queues[_0x4e74a8[_0x99fd('0x4d')]][_0x99fd('0x59')];queues[_0x4e74a8[_0x99fd('0x58')]][_0x99fd('0x35')]=utils[_0x99fd('0x1a')]();queues[_0x4e74a8['transfertargetuniqueid']][_0x99fd('0x15')]=utils[_0x99fd('0x1a')]();queues[_0x4e74a8['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x4e74a8[_0x99fd('0x58')]][_0x99fd('0x5a')]=0x0;utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x62'),_0x4e74a8['origtransfereruniqueid'],queues[_0x4e74a8[_0x99fd('0x58')]][_0x99fd('0x1e')],queues[_0x4e74a8[_0x99fd('0x58')]][_0x99fd('0xd')],queues[_0x4e74a8['transfertargetuniqueid']][_0x99fd('0x5c')],queues[_0x4e74a8[_0x99fd('0x58')]]['calleridname']));}else{utils[_0x99fd('0x1')](util['format'](_0x99fd('0x5d'),_0x4e74a8['origtransfereruniqueid'],queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0x1e')],_0x4e74a8[_0x99fd('0x4d')]));queues[_0x4e74a8[_0x99fd('0x4e')]][_0x99fd('0xd')]=_0x4e74a8['origtransfererlinkedid'];}}}}catch(_0x42edae){utils[_0x99fd('0x11')](util[_0x99fd('0x2')](_0x99fd('0x4b'),_0x4e74a8[_0x99fd('0x4c')]),_0x42edae);}};exports[_0x99fd('0x63')]=function(_0xd1ffc4){try{if(!_[_0x99fd('0x21')](queues[_0xd1ffc4[_0x99fd('0x4')]])){utils[_0x99fd('0xe')](util[_0x99fd('0x2')]('[%s][queues][musiconholdstart]',_0xd1ffc4[_0x99fd('0x4')]),_0xd1ffc4);queues[_0xd1ffc4[_0x99fd('0x4')]][_0x99fd('0x64')]=utils[_0x99fd('0x1a')]();utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x65'),_0xd1ffc4['uniqueid'],queues[_0xd1ffc4[_0x99fd('0x4')]][_0x99fd('0x1e')],queues[_0xd1ffc4['uniqueid']][_0x99fd('0x64')]));}}catch(_0x4d85ff){utils['error'](util[_0x99fd('0x2')](_0x99fd('0x66'),_0xd1ffc4[_0x99fd('0x4')]),_0x4d85ff);}};exports[_0x99fd('0x67')]=function(_0x57750c){try{if(!_[_0x99fd('0x21')](queues[_0x57750c[_0x99fd('0x4')]])){if(!_[_0x99fd('0x21')](queues[_0x57750c[_0x99fd('0x4')]]['musiconholdstartAt'])){utils[_0x99fd('0xe')](util[_0x99fd('0x2')](_0x99fd('0x68'),_0x57750c['uniqueid']),_0x57750c);queues[_0x57750c[_0x99fd('0x4')]][_0x99fd('0x5a')]+=utils[_0x99fd('0x34')](utils['now'](),queues[_0x57750c[_0x99fd('0x4')]]['musiconholdstartAt']);utils[_0x99fd('0x1')](util[_0x99fd('0x2')](_0x99fd('0x69'),_0x57750c[_0x99fd('0x4')],queues[_0x57750c['uniqueid']][_0x99fd('0x1e')],queues[_0x57750c[_0x99fd('0x4')]][_0x99fd('0x5a')]));delete queues[_0x57750c[_0x99fd('0x4')]][_0x99fd('0x64')];}}}catch(_0x3170ce){utils['error'](util[_0x99fd('0x2')](_0x99fd('0x68'),_0x57750c[_0x99fd('0x4')]),_0x3170ce);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 674cf8a..684a62d 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 _0x70ff=['set','cdr','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','then','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application'];(function(_0x2c4d60,_0x35fd6e){var _0xca32f9=function(_0x5b34a7){while(--_0x5b34a7){_0x2c4d60['push'](_0x2c4d60['shift']());}};_0xca32f9(++_0x35fd6e);}(_0x70ff,0x1e7));var _0xf70f=function(_0x221c0e,_0x1cf4e5){_0x221c0e=_0x221c0e-0x0;var _0x1ffc3a=_0x70ff[_0x221c0e];return _0x1ffc3a;};'use strict';var _=require(_0xf70f('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x429b50){utils[_0xf70f('0x1')](util[_0xf70f('0x2')](_0xf70f('0x3'),_0x429b50[_0xf70f('0x4')]));if(_0x429b50['accountcode']){utils[_0xf70f('0x5')](_0x429b50['accountcode'])[_0xf70f('0x6')](function(_0x9ef029){if(_0x9ef029){_0x429b50['membername']=_0x9ef029['name'];_0x429b50[_0xf70f('0x7')]=_0x9ef029['id'];}utils[_0xf70f('0x8')]('CreateVoiceRecording',_0x429b50);});}else{utils[_0xf70f('0x8')](_0xf70f('0x9'),_0x429b50);}}exports['newchannel']=function(_0x389464){try{utils[_0xf70f('0xa')](util[_0xf70f('0x2')]('[%s][recordings][newchannel]',_0x389464[_0xf70f('0x4')]),_0x389464);if(_0x389464[_0xf70f('0x4')]==_0x389464['linkedid']){utils[_0xf70f('0x1')](util['format'](_0xf70f('0xb'),_0x389464[_0xf70f('0x4')],_0x389464[_0xf70f('0xc')],_0x389464[_0xf70f('0xd')]));recordings[_0x389464[_0xf70f('0x4')]]={'uniqueid':_0x389464['uniqueid'],'accountcode':_0x389464[_0xf70f('0xe')],'exten':_0x389464[_0xf70f('0xd')],'context':_0x389464[_0xf70f('0xc')],'channel':_0x389464[_0xf70f('0xf')],'monitors':[]};}}catch(_0x246f6c){utils[_0xf70f('0x10')](util[_0xf70f('0x2')](_0xf70f('0x11'),_0x389464[_0xf70f('0x4')]),_0x246f6c);}};exports[_0xf70f('0x12')]=function(_0x3b071d){try{utils[_0xf70f('0xa')](util['format'](_0xf70f('0x13'),_0x3b071d[_0xf70f('0x4')]),_0x3b071d);if(!_[_0xf70f('0x14')](recordings[_0x3b071d[_0xf70f('0x4')]])&&_0x3b071d[_0xf70f('0x15')]==0x6){utils['info'](util[_0xf70f('0x2')](_0xf70f('0x16'),_0x3b071d[_0xf70f('0x4')],_0x3b071d[_0xf70f('0xc')],_0x3b071d[_0xf70f('0xf')]));}else if(!_[_0xf70f('0x14')](recordings[_0x3b071d[_0xf70f('0x17')]])&&_0x3b071d['channelstate']==0x6&&_0x3b071d[_0xf70f('0xc')]!=_0xf70f('0x18')){utils[_0xf70f('0x1')](util[_0xf70f('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3b071d[_0xf70f('0x4')],_0x3b071d[_0xf70f('0x17')],_0x3b071d[_0xf70f('0xc')],_0x3b071d[_0xf70f('0xf')]));recordings[_0x3b071d[_0xf70f('0x17')]]['accountcode']=_0x3b071d[_0xf70f('0xe')];}}catch(_0xcb8a44){utils['error'](util[_0xf70f('0x2')](_0xf70f('0x13'),_0x3b071d[_0xf70f('0x4')]),_0xcb8a44);}};exports[_0xf70f('0x19')]=function(_0x1ac0cd){try{if(!_[_0xf70f('0x14')](_0x1ac0cd[_0xf70f('0x1a')])&&!_[_0xf70f('0x14')](_0x1ac0cd[_0xf70f('0x1a')][_0xf70f('0x1b')])){utils[_0xf70f('0xa')](util[_0xf70f('0x2')](_0xf70f('0x1c'),_0x1ac0cd['uniqueid']),_0x1ac0cd);utils['info'](util[_0xf70f('0x2')](_0xf70f('0x1d'),_0x1ac0cd[_0xf70f('0x4')],_0x1ac0cd['variable'],_0x1ac0cd['value']));if(_['endsWith'](_0x1ac0cd[_0xf70f('0x1e')],_0xf70f('0x1f'))){_0x1ac0cd['value']=_0x1ac0cd[_0xf70f('0x1e')][_0xf70f('0x20')]('.wav49',_0xf70f('0x21'));}if(recordings[_0x1ac0cd[_0xf70f('0x17')]]){var _0x413e90=_[_0xf70f('0x22')](recordings[_0x1ac0cd['linkedid']][_0xf70f('0x23')],{'value':_0x1ac0cd[_0xf70f('0x1e')]});if(_[_0xf70f('0x14')](_0x413e90)){recordings[_0x1ac0cd['linkedid']][_0xf70f('0x23')][_0xf70f('0x24')]({'value':_0x1ac0cd['value']});}}}}catch(_0x5f10db){utils[_0xf70f('0x10')](util[_0xf70f('0x2')]('[%s][recordings][varset]',_0x1ac0cd['uniqueid']),_0x5f10db);}};exports[_0xf70f('0x25')]=function(_0x373ea9){try{if(!_[_0xf70f('0x14')](recordings[_0x373ea9[_0xf70f('0x4')]])){utils['debug'](util[_0xf70f('0x2')](_0xf70f('0x26'),_0x373ea9[_0xf70f('0x4')]),_0x373ea9);utils['info'](util[_0xf70f('0x2')](_0xf70f('0x27'),_0x373ea9[_0xf70f('0x4')],_0x373ea9[_0xf70f('0x28')],_0x373ea9[_0xf70f('0x29')],_0x373ea9[_0xf70f('0x2a')]));recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x28')]=_0x373ea9[_0xf70f('0x28')];recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x29')]=_0x373ea9[_0xf70f('0x29')];recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x2b')]=_0x373ea9[_0xf70f('0x2b')];recordings[_0x373ea9[_0xf70f('0x4')]]['connectedlinename']=_0x373ea9[_0xf70f('0x2c')];if(recordings[_0x373ea9[_0xf70f('0x4')]]['type']==_0xf70f('0x2d')&&recordings[_0x373ea9[_0xf70f('0x4')]]['accountcode']){recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x2b')]=recordings[_0x373ea9['uniqueid']][_0xf70f('0xe')];recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x2c')]='';}recordings[_0x373ea9[_0xf70f('0x4')]][_0xf70f('0x23')][_0xf70f('0x2e')](function(_0x48559b){var _0x50878a=_[_0xf70f('0x2f')](recordings[_0x373ea9[_0xf70f('0x4')]]);_0x50878a[_0xf70f('0x1e')]=_0x48559b[_0xf70f('0x1e')];writeDB(_0x50878a);});delete recordings[_0x373ea9[_0xf70f('0x4')]];}}catch(_0x3d74ae){utils[_0xf70f('0x10')](util[_0xf70f('0x2')](_0xf70f('0x26'),_0x373ea9[_0xf70f('0x4')]),_0x3d74ae);}};exports[_0xf70f('0x30')]=function(_0x38c4b8){try{if(!_[_0xf70f('0x14')](recordings[_0x38c4b8[_0xf70f('0x4')]])){utils[_0xf70f('0xa')](util[_0xf70f('0x2')](_0xf70f('0x31'),_0x38c4b8[_0xf70f('0x4')]),_0x38c4b8);utils[_0xf70f('0x1')](util['format'](_0xf70f('0x32'),_0x38c4b8[_0xf70f('0x4')],_0x38c4b8['application'],_0x38c4b8[_0xf70f('0x33')]));if(_0x38c4b8[_0xf70f('0x34')]['toLowerCase']()==_0xf70f('0x35')&&_['startsWith'](_0x38c4b8[_0xf70f('0x33')]['toLowerCase'](),_0xf70f('0x36'))){var _0x4a7ad1=_0x38c4b8[_0xf70f('0x33')]['split']('=');var _0x5059a6=_0x4a7ad1[0x0][_0xf70f('0x37')](_0x4a7ad1[0x0]['lastIndexOf']('(')+0x1,_0x4a7ad1[0x0]['lastIndexOf'](')'));var _0x122638=_0x4a7ad1[0x1];recordings[_0x38c4b8['uniqueid']][_0x5059a6]=_0x122638;}}}catch(_0x39c558){utils[_0xf70f('0x10')](util[_0xf70f('0x2')](_0xf70f('0x31'),_0x38c4b8[_0xf70f('0x4')]),_0x39c558);}};exports[_0xf70f('0x38')]=function(_0x51b9a4){try{if(!_[_0xf70f('0x14')](recordings[_0x51b9a4['uniqueid']])){utils[_0xf70f('0xa')](util[_0xf70f('0x2')](_0xf70f('0x39'),_0x51b9a4[_0xf70f('0x4')]),_0x51b9a4);utils[_0xf70f('0x1')](util['format'](_0xf70f('0x3a'),_0x51b9a4[_0xf70f('0x4')],_0x51b9a4[_0xf70f('0x3b')]));recordings[_0x51b9a4[_0xf70f('0x4')]][_0xf70f('0x3b')]=_0x51b9a4['queue'];}}catch(_0x1157b0){utils['error'](util[_0xf70f('0x2')]('[%s][recordings][queuecallerjoin]',_0x51b9a4['uniqueid']),_0x1157b0);}}; \ No newline at end of file +var _0x52c2=['newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error'];(function(_0x19c0df,_0x37c9e6){var _0x25096f=function(_0x366ec6){while(--_0x366ec6){_0x19c0df['push'](_0x19c0df['shift']());}};_0x25096f(++_0x37c9e6);}(_0x52c2,0x1eb));var _0x252c=function(_0x562aea,_0xb4a3e0){_0x562aea=_0x562aea-0x0;var _0x12e09f=_0x52c2[_0x562aea];return _0x12e09f;};'use strict';var _=require(_0x252c('0x0'));var util=require(_0x252c('0x1'));var utils=require(_0x252c('0x2'));var recordings={};function writeDB(_0x8a8eeb){utils[_0x252c('0x3')](util[_0x252c('0x4')]('[%s][recordings][writeDB]',_0x8a8eeb[_0x252c('0x5')]));if(_0x8a8eeb[_0x252c('0x6')]){utils[_0x252c('0x7')](_0x8a8eeb[_0x252c('0x6')])[_0x252c('0x8')](function(_0x5ac92f){if(_0x5ac92f){_0x8a8eeb[_0x252c('0x9')]=_0x5ac92f['name'];_0x8a8eeb[_0x252c('0xa')]=_0x5ac92f['id'];}utils[_0x252c('0xb')](_0x252c('0xc'),_0x8a8eeb);});}else{utils['request'](_0x252c('0xc'),_0x8a8eeb);}}exports[_0x252c('0xd')]=function(_0x583884){try{utils[_0x252c('0xe')](util[_0x252c('0x4')](_0x252c('0xf'),_0x583884[_0x252c('0x5')]),_0x583884);if(_0x583884[_0x252c('0x5')]==_0x583884['linkedid']){utils[_0x252c('0x3')](util[_0x252c('0x4')](_0x252c('0x10'),_0x583884[_0x252c('0x5')],_0x583884[_0x252c('0x11')],_0x583884[_0x252c('0x12')]));recordings[_0x583884[_0x252c('0x5')]]={'uniqueid':_0x583884[_0x252c('0x5')],'accountcode':_0x583884[_0x252c('0x6')],'exten':_0x583884[_0x252c('0x12')],'context':_0x583884[_0x252c('0x11')],'channel':_0x583884[_0x252c('0x13')],'monitors':[]};}}catch(_0x4db5cf){utils[_0x252c('0x14')](util[_0x252c('0x4')]('[%s][recordings][newchannel]',_0x583884[_0x252c('0x5')]),_0x4db5cf);}};exports[_0x252c('0x15')]=function(_0x2fd6bd){try{utils[_0x252c('0xe')](util[_0x252c('0x4')](_0x252c('0x16'),_0x2fd6bd[_0x252c('0x5')]),_0x2fd6bd);if(!_[_0x252c('0x17')](recordings[_0x2fd6bd[_0x252c('0x5')]])&&_0x2fd6bd[_0x252c('0x18')]==0x6){utils[_0x252c('0x3')](util[_0x252c('0x4')](_0x252c('0x19'),_0x2fd6bd[_0x252c('0x5')],_0x2fd6bd[_0x252c('0x11')],_0x2fd6bd[_0x252c('0x13')]));}else if(!_[_0x252c('0x17')](recordings[_0x2fd6bd[_0x252c('0x1a')]])&&_0x2fd6bd[_0x252c('0x18')]==0x6&&_0x2fd6bd[_0x252c('0x11')]!=_0x252c('0x1b')){utils[_0x252c('0x3')](util[_0x252c('0x4')](_0x252c('0x1c'),_0x2fd6bd[_0x252c('0x5')],_0x2fd6bd[_0x252c('0x1a')],_0x2fd6bd[_0x252c('0x11')],_0x2fd6bd[_0x252c('0x13')]));recordings[_0x2fd6bd[_0x252c('0x1a')]][_0x252c('0x6')]=_0x2fd6bd['accountcode'];}}catch(_0x5dc05f){utils[_0x252c('0x14')](util['format']('[%s][recordings][newstate]',_0x2fd6bd[_0x252c('0x5')]),_0x5dc05f);}};exports[_0x252c('0x1d')]=function(_0x56cc71){try{if(!_[_0x252c('0x17')](_0x56cc71[_0x252c('0x1e')])&&!_[_0x252c('0x17')](_0x56cc71[_0x252c('0x1e')][_0x252c('0x1f')])){utils[_0x252c('0xe')](util[_0x252c('0x4')]('[%s][recordings][varset]',_0x56cc71['uniqueid']),_0x56cc71);utils[_0x252c('0x3')](util[_0x252c('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x56cc71['uniqueid'],_0x56cc71[_0x252c('0x1e')],_0x56cc71[_0x252c('0x20')]));if(_[_0x252c('0x21')](_0x56cc71[_0x252c('0x20')],_0x252c('0x22'))){_0x56cc71[_0x252c('0x20')]=_0x56cc71[_0x252c('0x20')]['replace'](_0x252c('0x22'),_0x252c('0x23'));}if(recordings[_0x56cc71['linkedid']]){var _0x5b51cb=_[_0x252c('0x24')](recordings[_0x56cc71[_0x252c('0x1a')]][_0x252c('0x25')],{'value':_0x56cc71['value']});if(_[_0x252c('0x17')](_0x5b51cb)){recordings[_0x56cc71['linkedid']][_0x252c('0x25')][_0x252c('0x26')]({'value':_0x56cc71[_0x252c('0x20')]});}}}}catch(_0x41fcb5){utils[_0x252c('0x14')](util['format'](_0x252c('0x27'),_0x56cc71[_0x252c('0x5')]),_0x41fcb5);}};exports['hangup']=function(_0x339197){try{if(!_['isNil'](recordings[_0x339197[_0x252c('0x5')]])){utils['debug'](util[_0x252c('0x4')](_0x252c('0x28'),_0x339197[_0x252c('0x5')]),_0x339197);utils[_0x252c('0x3')](util[_0x252c('0x4')](_0x252c('0x29'),_0x339197[_0x252c('0x5')],_0x339197[_0x252c('0x2a')],_0x339197[_0x252c('0x2b')],_0x339197[_0x252c('0x2c')]));recordings[_0x339197[_0x252c('0x5')]][_0x252c('0x2a')]=_0x339197[_0x252c('0x2a')];recordings[_0x339197['uniqueid']][_0x252c('0x2b')]=_0x339197[_0x252c('0x2b')];recordings[_0x339197[_0x252c('0x5')]][_0x252c('0x2d')]=_0x339197[_0x252c('0x2d')];recordings[_0x339197[_0x252c('0x5')]][_0x252c('0x2e')]=_0x339197['connectedlinename'];if(recordings[_0x339197[_0x252c('0x5')]][_0x252c('0x2f')]==_0x252c('0x30')&&recordings[_0x339197[_0x252c('0x5')]][_0x252c('0x6')]){recordings[_0x339197[_0x252c('0x5')]]['connectedlinenum']=recordings[_0x339197[_0x252c('0x5')]][_0x252c('0x6')];recordings[_0x339197[_0x252c('0x5')]]['connectedlinename']='';}recordings[_0x339197[_0x252c('0x5')]][_0x252c('0x25')][_0x252c('0x31')](function(_0x539080){var _0x31acf6=_[_0x252c('0x32')](recordings[_0x339197[_0x252c('0x5')]]);_0x31acf6[_0x252c('0x20')]=_0x539080[_0x252c('0x20')];writeDB(_0x31acf6);});delete recordings[_0x339197[_0x252c('0x5')]];}}catch(_0x34f684){utils[_0x252c('0x14')](util[_0x252c('0x4')](_0x252c('0x28'),_0x339197[_0x252c('0x5')]),_0x34f684);}};exports['newexten']=function(_0x8b76f0){try{if(!_['isNil'](recordings[_0x8b76f0['uniqueid']])){utils[_0x252c('0xe')](util[_0x252c('0x4')](_0x252c('0x33'),_0x8b76f0[_0x252c('0x5')]),_0x8b76f0);utils[_0x252c('0x3')](util[_0x252c('0x4')](_0x252c('0x34'),_0x8b76f0['uniqueid'],_0x8b76f0['application'],_0x8b76f0[_0x252c('0x35')]));if(_0x8b76f0[_0x252c('0x36')][_0x252c('0x37')]()==_0x252c('0x38')&&_[_0x252c('0x39')](_0x8b76f0['appdata'][_0x252c('0x37')](),'cdr')){var _0x4cb961=_0x8b76f0[_0x252c('0x35')][_0x252c('0x3a')]('=');var _0x3eefe4=_0x4cb961[0x0][_0x252c('0x3b')](_0x4cb961[0x0][_0x252c('0x3c')]('(')+0x1,_0x4cb961[0x0][_0x252c('0x3c')](')'));var _0x439d1d=_0x4cb961[0x1];recordings[_0x8b76f0[_0x252c('0x5')]][_0x3eefe4]=_0x439d1d;}}}catch(_0x1646f4){utils[_0x252c('0x14')](util[_0x252c('0x4')](_0x252c('0x33'),_0x8b76f0[_0x252c('0x5')]),_0x1646f4);}};exports[_0x252c('0x3d')]=function(_0x9920e4){try{if(!_[_0x252c('0x17')](recordings[_0x9920e4[_0x252c('0x5')]])){utils[_0x252c('0xe')](util[_0x252c('0x4')](_0x252c('0x3e'),_0x9920e4[_0x252c('0x5')]),_0x9920e4);utils[_0x252c('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x9920e4[_0x252c('0x5')],_0x9920e4[_0x252c('0x3f')]));recordings[_0x9920e4[_0x252c('0x5')]][_0x252c('0x3f')]=_0x9920e4[_0x252c('0x3f')];}}catch(_0x18eba4){utils['error'](util[_0x252c('0x4')](_0x252c('0x3e'),_0x9920e4[_0x252c('0x5')]),_0x18eba4);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 94a1436..cba5d6e 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 _0x5aff=['origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x3da26c,_0x401133){var _0x470b27=function(_0x19a824){while(--_0x19a824){_0x3da26c['push'](_0x3da26c['shift']());}};_0x470b27(++_0x401133);}(_0x5aff,0xc0));var _0xf5af=function(_0x1b2baf,_0x5e2a94){_0x1b2baf=_0x1b2baf-0x0;var _0x3d25a4=_0x5aff[_0x1b2baf];return _0x3d25a4;};'use strict';var _=require('lodash');var util=require(_0xf5af('0x0'));var utils=require(_0xf5af('0x1'));function writeDB(_0x3475f2){utils[_0xf5af('0x2')](util[_0xf5af('0x3')](_0xf5af('0x4'),_0x3475f2['type']===_0xf5af('0x5')?_0x3475f2[_0xf5af('0x6')]:_0x3475f2[_0xf5af('0x7')],_0x3475f2[_0xf5af('0x8')]));utils[_0xf5af('0x9')](_0xf5af('0xa'),_0x3475f2);}exports[_0xf5af('0xb')]=function(_0x159c26){try{utils['debug'](util[_0xf5af('0x3')](_0xf5af('0xc'),_0x159c26[_0xf5af('0x7')]),_0x159c26);utils[_0xf5af('0x2')](util[_0xf5af('0x3')](_0xf5af('0xd'),_0x159c26[_0xf5af('0x7')],_0x159c26[_0xf5af('0xe')],_0x159c26['transferercalleridname'],_0x159c26[_0xf5af('0xf')],_0x159c26[_0xf5af('0x10')]));_0x159c26[_0xf5af('0x8')]=_0xf5af('0x11');writeDB(_0x159c26);}catch(_0x5204a7){utils[_0xf5af('0x12')](util[_0xf5af('0x3')](_0xf5af('0xc'),_0x159c26[_0xf5af('0x7')]),_0x5204a7);}};exports[_0xf5af('0x13')]=function(_0x5ee57c){try{utils[_0xf5af('0x14')](util['format'](_0xf5af('0x15'),_0x5ee57c[_0xf5af('0x6')]),_0x5ee57c);utils[_0xf5af('0x2')](util[_0xf5af('0x3')](_0xf5af('0x16'),_0x5ee57c[_0xf5af('0x6')],_0x5ee57c[_0xf5af('0x17')],_0x5ee57c[_0xf5af('0x18')],_0x5ee57c[_0xf5af('0x19')],_0x5ee57c['transfertargetcalleridname']));_0x5ee57c=_[_0xf5af('0x1a')](_0x5ee57c,{'transfererchannel':_0x5ee57c[_0xf5af('0x1b')],'transferercalleridnum':_0x5ee57c[_0xf5af('0x17')],'transferercalleridname':_0x5ee57c[_0xf5af('0x18')],'transfererconnectedlinenum':_0x5ee57c[_0xf5af('0x1c')],'transfererconnectedlinename':_0x5ee57c[_0xf5af('0x1d')],'transfereraccountcode':_0x5ee57c[_0xf5af('0x1e')],'transferercontext':_0x5ee57c[_0xf5af('0x1f')],'transfererexten':_0x5ee57c[_0xf5af('0x20')],'transfererlinkedid':_0x5ee57c[_0xf5af('0x21')],'context':_0x5ee57c[_0xf5af('0x22')],'extension':_0x5ee57c[_0xf5af('0x23')],'type':'attended'});if(_[_0xf5af('0x24')](_0x5ee57c[_0xf5af('0x25')])){_0x5ee57c=_[_0xf5af('0x1a')](_0x5ee57c,{'transfereechannel':_0x5ee57c[_0xf5af('0x26')],'transfereecalleridnum':_0x5ee57c[_0xf5af('0x19')],'transfereecalleridname':_0x5ee57c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5ee57c[_0xf5af('0x27')],'transfereeconnectedlinename':_0x5ee57c[_0xf5af('0x28')],'transfereeaccountcode':_0x5ee57c[_0xf5af('0x29')],'transfereecontext':_0x5ee57c[_0xf5af('0x2a')],'transfereeexten':_0x5ee57c[_0xf5af('0x2b')],'transfereelinkedid':_0x5ee57c[_0xf5af('0x2c')]});}writeDB(_0x5ee57c);}catch(_0x8140ae){utils[_0xf5af('0x12')](util[_0xf5af('0x3')]('[%s][transfers][attendedtransfer]',_0x5ee57c[_0xf5af('0x6')]),_0x8140ae);}}; \ No newline at end of file +var _0x18b7=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum'];(function(_0x16f77c,_0x5256b1){var _0x78986e=function(_0x10430){while(--_0x10430){_0x16f77c['push'](_0x16f77c['shift']());}};_0x78986e(++_0x5256b1);}(_0x18b7,0x155));var _0x718b=function(_0x4b568c,_0x5a8791){_0x4b568c=_0x4b568c-0x0;var _0x2d0f97=_0x18b7[_0x4b568c];return _0x2d0f97;};'use strict';var _=require(_0x718b('0x0'));var util=require(_0x718b('0x1'));var utils=require(_0x718b('0x2'));function writeDB(_0x2e0829){utils[_0x718b('0x3')](util[_0x718b('0x4')](_0x718b('0x5'),_0x2e0829[_0x718b('0x6')]===_0x718b('0x7')?_0x2e0829[_0x718b('0x8')]:_0x2e0829[_0x718b('0x9')],_0x2e0829[_0x718b('0x6')]));utils['request']('CreateVoiceTransferReport',_0x2e0829);}exports[_0x718b('0xa')]=function(_0x2299dd){try{utils[_0x718b('0xb')](util[_0x718b('0x4')](_0x718b('0xc'),_0x2299dd[_0x718b('0x9')]),_0x2299dd);utils[_0x718b('0x3')](util['format'](_0x718b('0xd'),_0x2299dd['uniqueid'],_0x2299dd[_0x718b('0xe')],_0x2299dd['transferercalleridname'],_0x2299dd['transfereecalleridnum'],_0x2299dd[_0x718b('0xf')]));_0x2299dd[_0x718b('0x6')]=_0x718b('0x10');writeDB(_0x2299dd);}catch(_0x1ac94a){utils[_0x718b('0x11')](util[_0x718b('0x4')](_0x718b('0xc'),_0x2299dd[_0x718b('0x9')]),_0x1ac94a);}};exports[_0x718b('0x12')]=function(_0x3f74ac){try{utils[_0x718b('0xb')](util[_0x718b('0x4')](_0x718b('0x13'),_0x3f74ac[_0x718b('0x8')]),_0x3f74ac);utils[_0x718b('0x3')](util[_0x718b('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3f74ac[_0x718b('0x8')],_0x3f74ac[_0x718b('0x14')],_0x3f74ac[_0x718b('0x15')],_0x3f74ac[_0x718b('0x16')],_0x3f74ac[_0x718b('0x17')]));_0x3f74ac=_[_0x718b('0x18')](_0x3f74ac,{'transfererchannel':_0x3f74ac['origtransfererchannel'],'transferercalleridnum':_0x3f74ac[_0x718b('0x14')],'transferercalleridname':_0x3f74ac[_0x718b('0x15')],'transfererconnectedlinenum':_0x3f74ac[_0x718b('0x19')],'transfererconnectedlinename':_0x3f74ac[_0x718b('0x1a')],'transfereraccountcode':_0x3f74ac[_0x718b('0x1b')],'transferercontext':_0x3f74ac[_0x718b('0x1c')],'transfererexten':_0x3f74ac[_0x718b('0x1d')],'transfererlinkedid':_0x3f74ac[_0x718b('0x1e')],'context':_0x3f74ac[_0x718b('0x1f')],'extension':_0x3f74ac[_0x718b('0x20')],'type':_0x718b('0x7')});if(_[_0x718b('0x21')](_0x3f74ac[_0x718b('0x22')])){_0x3f74ac=_['assign'](_0x3f74ac,{'transfereechannel':_0x3f74ac[_0x718b('0x23')],'transfereecalleridnum':_0x3f74ac[_0x718b('0x16')],'transfereecalleridname':_0x3f74ac[_0x718b('0x17')],'transfereeconnectedlinenum':_0x3f74ac[_0x718b('0x24')],'transfereeconnectedlinename':_0x3f74ac[_0x718b('0x25')],'transfereeaccountcode':_0x3f74ac[_0x718b('0x26')],'transfereecontext':_0x3f74ac[_0x718b('0x27')],'transfereeexten':_0x3f74ac[_0x718b('0x28')],'transfereelinkedid':_0x3f74ac[_0x718b('0x29')]});}writeDB(_0x3f74ac);}catch(_0xa55b6c){utils[_0x718b('0x11')](util[_0x718b('0x4')](_0x718b('0x13'),_0x3f74ac[_0x718b('0x8')]),_0xa55b6c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2e97802..ffdc167 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 _0xf4b7=['request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','client','../../config/logger','xdr','info','inspect','debug','error'];(function(_0x4acd65,_0x193e16){var _0x1e7c1d=function(_0x49ee80){while(--_0x49ee80){_0x4acd65['push'](_0x4acd65['shift']());}};_0x1e7c1d(++_0x193e16);}(_0xf4b7,0x85));var _0x7f4b=function(_0xf4cfd9,_0xf5f6fa){_0xf4cfd9=_0xf4cfd9-0x0;var _0x394a32=_0xf4b7[_0xf4cfd9];return _0x394a32;};'use strict';var BPromise=require(_0x7f4b('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0x7f4b('0x1')]['http']({'port':0x2329});var logger=require(_0x7f4b('0x2'))(_0x7f4b('0x3'));exports[_0x7f4b('0x4')]=function(_0x4a2a42,_0x555db6){logger['info'](_0x4a2a42,_0x555db6?util[_0x7f4b('0x5')](_0x555db6,{'showHidden':![],'depth':null}):'');};exports[_0x7f4b('0x6')]=function(_0x3ef3d2,_0x5594d1){logger[_0x7f4b('0x6')](_0x3ef3d2,_0x5594d1?util[_0x7f4b('0x5')](_0x5594d1,{'showHidden':![],'depth':null}):'');};exports[_0x7f4b('0x7')]=function(_0x1cac66,_0x1122a0){logger['error'](_0x1cac66,_0x1122a0?util[_0x7f4b('0x5')](_0x1122a0,{'showHidden':![],'depth':null}):'');};exports[_0x7f4b('0x8')]=function(_0x227155,_0x169394){return client[_0x7f4b('0x8')](_0x227155,{'body':_0x169394})['then'](function(_0x644387){logger[_0x7f4b('0x6')](_0x7f4b('0x9'),_0x227155,_0x644387?util[_0x7f4b('0x5')](_0x644387,{'showHidden':![],'depth':null}):'');})[_0x7f4b('0xa')](function(_0x223d60){logger['error'](_0x7f4b('0x9'),_0x227155,_0x223d60?util[_0x7f4b('0x5')](_0x223d60,{'showHidden':![],'depth':null}):'');});};function getUser(_0x20e0a4){return client[_0x7f4b('0x8')](_0x7f4b('0xb'),{'options':{'raw':!![],'attributes':['id',_0x7f4b('0xc'),_0x7f4b('0xd'),_0x7f4b('0xe')],'where':_0x20e0a4,'limit':0x1}})[_0x7f4b('0xf')](function(_0xc4cdbe){logger[_0x7f4b('0x6')](_0x7f4b('0x10'),JSON[_0x7f4b('0x11')](_0x20e0a4),_0xc4cdbe?util[_0x7f4b('0x5')](_0xc4cdbe,{'showHidden':![],'depth':null}):'');return _0xc4cdbe[_0x7f4b('0x12')][_0x7f4b('0x13')]?_0xc4cdbe[_0x7f4b('0x12')][0x0]:null;});}exports[_0x7f4b('0x14')]=function(_0x6c79e2){return new BPromise(function(_0x397988,_0x4dc166){if(_0x6c79e2){return getUser({'internal':_0x6c79e2})[_0x7f4b('0xf')](function(_0x14a6db){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x6c79e2,_0x14a6db?_0x7f4b('0x15'):_0x7f4b('0x16'));return _0x397988(_0x14a6db);})[_0x7f4b('0xa')](function(_0x4afb6d){logger[_0x7f4b('0x7')](_0x7f4b('0x17'),_0x4afb6d?util[_0x7f4b('0x5')](_0x4afb6d,{'showHidden':![],'depth':null}):'');return _0x397988(null);});}return _0x397988(null);});};exports[_0x7f4b('0x18')]=function(_0x1564de){return new BPromise(function(_0x42e0a0,_0xa31aea){if(_0x1564de){return getUser({'interface':_0x1564de})['then'](function(_0x287012){logger['info'](_0x7f4b('0x19'),_0x1564de,_0x287012?'found':_0x7f4b('0x16'));return _0x42e0a0(_0x287012);})['catch'](function(_0x2e46e3){logger[_0x7f4b('0x7')](_0x7f4b('0x1a'),_0x2e46e3?util[_0x7f4b('0x5')](_0x2e46e3,{'showHidden':![],'depth':null}):'');return _0x42e0a0(null);});}return _0x42e0a0(null);});};exports[_0x7f4b('0x1b')]=function(_0x19af06){return new BPromise(function(_0x284372,_0x54b559){if(_0x19af06){return getUser({'name':_0x19af06})[_0x7f4b('0xf')](function(_0x124754){logger[_0x7f4b('0x4')](_0x7f4b('0x1c'),_0x19af06,_0x124754?_0x7f4b('0x15'):'notfound');return _0x284372(_0x124754);})[_0x7f4b('0xa')](function(_0xa0124f){logger['error'](_0x7f4b('0x1d'),_0xa0124f?util[_0x7f4b('0x5')](_0xa0124f,{'showHidden':![],'depth':null}):'');return _0x284372(null);});}return _0x284372(null);});};exports[_0x7f4b('0x1e')]=function(_0x418e6e){return new BPromise(function(_0x353565,_0x381c7a){if(_0x418e6e){return client['request'](_0x7f4b('0x1f'),{'options':{'raw':!![],'attributes':['id','name',_0x7f4b('0x20'),_0x7f4b('0x21'),_0x7f4b('0x22')],'where':{'name':_0x418e6e},'limit':0x1}})[_0x7f4b('0xf')](function(_0x358953){logger[_0x7f4b('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x418e6e,_0x358953?util[_0x7f4b('0x5')](_0x358953,{'showHidden':![],'depth':null}):'');logger[_0x7f4b('0x4')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x418e6e,_0x358953?_0x7f4b('0x15'):_0x7f4b('0x16'));return _0x353565(_0x358953['result'][_0x7f4b('0x13')]?_0x358953[_0x7f4b('0x12')][0x0]:null);})[_0x7f4b('0xa')](function(_0x27b144){logger['error']('[utils][getVoiceQueueByName]',_0x27b144?util[_0x7f4b('0x5')](_0x27b144,{'showHidden':![],'depth':null}):'');return _0x353565(null);});}return _0x353565(null);});};exports[_0x7f4b('0x23')]=function(_0x4c1b66,_0xb395c3){return moment(_0x4c1b66)[_0x7f4b('0x24')](_0xb395c3,_0x7f4b('0x25'))[_0x7f4b('0x26')](_0x7f4b('0x27'));};exports[_0x7f4b('0x28')]=function(_0xff90fa,_0x594a88){return moment(_0xff90fa)[_0x7f4b('0x29')](_0x594a88,_0x7f4b('0x25'))[_0x7f4b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7f4b('0x2a')]=function(_0x1503f8,_0x53c58e){return moment(_0x1503f8)[_0x7f4b('0x2b')](moment(_0x53c58e),_0x7f4b('0x25'));};exports[_0x7f4b('0x2c')]=function(_0x1d4c31,_0x1a36c3){return parseInt(_0x1d4c31,0xa)+parseInt(_0x1a36c3,0xa);};exports['now']=function(){return moment()[_0x7f4b('0x26')](_0x7f4b('0x27'));};exports[_0x7f4b('0x2d')]=function(_0x57a662,_0x2da765){if(_0x2da765){return moment(_0x57a662)[_0x7f4b('0x2d')](_0x2da765);}return!![];};exports[_0x7f4b('0x2e')]=function(_0x2a507,_0xf5c804){if(_0xf5c804){return moment(_0x2a507)[_0x7f4b('0x2e')](_0xf5c804);}else if(_0x2a507){return!![];}return![];}; \ No newline at end of file +var _0x5ceb=['[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','bluebird','util','client','http','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s'];(function(_0x363b17,_0x335474){var _0x4e3543=function(_0x2f54e4){while(--_0x2f54e4){_0x363b17['push'](_0x363b17['shift']());}};_0x4e3543(++_0x335474);}(_0x5ceb,0x90));var _0xb5ce=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x5ceb[_0x1a9204];return _0x17ca68;};'use strict';var BPromise=require(_0xb5ce('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0xb5ce('0x1'));var client=jayson[_0xb5ce('0x2')][_0xb5ce('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xb5ce('0x4')]=function(_0x163d7a,_0x204119){logger[_0xb5ce('0x4')](_0x163d7a,_0x204119?util['inspect'](_0x204119,{'showHidden':![],'depth':null}):'');};exports[_0xb5ce('0x5')]=function(_0x87b008,_0x3cb0ab){logger[_0xb5ce('0x5')](_0x87b008,_0x3cb0ab?util[_0xb5ce('0x6')](_0x3cb0ab,{'showHidden':![],'depth':null}):'');};exports[_0xb5ce('0x7')]=function(_0x4161d8,_0x13d309){logger[_0xb5ce('0x7')](_0x4161d8,_0x13d309?util['inspect'](_0x13d309,{'showHidden':![],'depth':null}):'');};exports[_0xb5ce('0x8')]=function(_0x3c6565,_0x2ea6ab){return client[_0xb5ce('0x8')](_0x3c6565,{'body':_0x2ea6ab})[_0xb5ce('0x9')](function(_0x6bbd51){logger[_0xb5ce('0x5')](_0xb5ce('0xa'),_0x3c6565,_0x6bbd51?util[_0xb5ce('0x6')](_0x6bbd51,{'showHidden':![],'depth':null}):'');})[_0xb5ce('0xb')](function(_0x3cb314){logger[_0xb5ce('0x7')]('[utils][request]\x20name:%s',_0x3c6565,_0x3cb314?util[_0xb5ce('0x6')](_0x3cb314,{'showHidden':![],'depth':null}):'');});};function getUser(_0x33a41d){return client[_0xb5ce('0x8')](_0xb5ce('0xc'),{'options':{'raw':!![],'attributes':['id',_0xb5ce('0xd'),_0xb5ce('0xe'),_0xb5ce('0xf')],'where':_0x33a41d,'limit':0x1}})[_0xb5ce('0x9')](function(_0x59e0e0){logger[_0xb5ce('0x5')](_0xb5ce('0x10'),JSON[_0xb5ce('0x11')](_0x33a41d),_0x59e0e0?util[_0xb5ce('0x6')](_0x59e0e0,{'showHidden':![],'depth':null}):'');return _0x59e0e0[_0xb5ce('0x12')][_0xb5ce('0x13')]?_0x59e0e0[_0xb5ce('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x270137){return new BPromise(function(_0x122b18,_0xafa279){if(_0x270137){return getUser({'internal':_0x270137})[_0xb5ce('0x9')](function(_0x54cd83){logger[_0xb5ce('0x4')](_0xb5ce('0x14'),_0x270137,_0x54cd83?_0xb5ce('0x15'):_0xb5ce('0x16'));return _0x122b18(_0x54cd83);})['catch'](function(_0x4ad7c8){logger[_0xb5ce('0x7')](_0xb5ce('0x17'),_0x4ad7c8?util[_0xb5ce('0x6')](_0x4ad7c8,{'showHidden':![],'depth':null}):'');return _0x122b18(null);});}return _0x122b18(null);});};exports['getUserByInterface']=function(_0x36a0a9){return new BPromise(function(_0x3a7c24,_0x3c5e2a){if(_0x36a0a9){return getUser({'interface':_0x36a0a9})[_0xb5ce('0x9')](function(_0x1b398c){logger[_0xb5ce('0x4')](_0xb5ce('0x18'),_0x36a0a9,_0x1b398c?_0xb5ce('0x15'):_0xb5ce('0x16'));return _0x3a7c24(_0x1b398c);})[_0xb5ce('0xb')](function(_0xc8bce1){logger[_0xb5ce('0x7')](_0xb5ce('0x19'),_0xc8bce1?util[_0xb5ce('0x6')](_0xc8bce1,{'showHidden':![],'depth':null}):'');return _0x3a7c24(null);});}return _0x3a7c24(null);});};exports[_0xb5ce('0x1a')]=function(_0x1046c2){return new BPromise(function(_0x22d928,_0x4f44fe){if(_0x1046c2){return getUser({'name':_0x1046c2})['then'](function(_0x1fb5af){logger[_0xb5ce('0x4')](_0xb5ce('0x1b'),_0x1046c2,_0x1fb5af?_0xb5ce('0x15'):'notfound');return _0x22d928(_0x1fb5af);})[_0xb5ce('0xb')](function(_0x47ce73){logger['error'](_0xb5ce('0x1c'),_0x47ce73?util[_0xb5ce('0x6')](_0x47ce73,{'showHidden':![],'depth':null}):'');return _0x22d928(null);});}return _0x22d928(null);});};exports[_0xb5ce('0x1d')]=function(_0x2e2cb9){return new BPromise(function(_0x33e551,_0x456d75){if(_0x2e2cb9){return client[_0xb5ce('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xb5ce('0xe'),'type','acw',_0xb5ce('0x1e')],'where':{'name':_0x2e2cb9},'limit':0x1}})[_0xb5ce('0x9')](function(_0x47cdfc){logger[_0xb5ce('0x5')](_0xb5ce('0x1f'),_0x2e2cb9,_0x47cdfc?util[_0xb5ce('0x6')](_0x47cdfc,{'showHidden':![],'depth':null}):'');logger[_0xb5ce('0x4')](_0xb5ce('0x20'),_0x2e2cb9,_0x47cdfc?_0xb5ce('0x15'):'notfound');return _0x33e551(_0x47cdfc[_0xb5ce('0x12')][_0xb5ce('0x13')]?_0x47cdfc[_0xb5ce('0x12')][0x0]:null);})[_0xb5ce('0xb')](function(_0x822438){logger['error'](_0xb5ce('0x21'),_0x822438?util[_0xb5ce('0x6')](_0x822438,{'showHidden':![],'depth':null}):'');return _0x33e551(null);});}return _0x33e551(null);});};exports[_0xb5ce('0x22')]=function(_0x4d5745,_0x9fed76){return moment(_0x4d5745)[_0xb5ce('0x23')](_0x9fed76,_0xb5ce('0x24'))[_0xb5ce('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x2166f6,_0x4c0d3f){return moment(_0x2166f6)[_0xb5ce('0x26')](_0x4c0d3f,_0xb5ce('0x24'))['format'](_0xb5ce('0x27'));};exports[_0xb5ce('0x28')]=function(_0x54675d,_0x54abfe){return moment(_0x54675d)['diff'](moment(_0x54abfe),_0xb5ce('0x24'));};exports[_0xb5ce('0x29')]=function(_0x3ea0a1,_0x4d55a0){return parseInt(_0x3ea0a1,0xa)+parseInt(_0x4d55a0,0xa);};exports[_0xb5ce('0x2a')]=function(){return moment()['format'](_0xb5ce('0x27'));};exports[_0xb5ce('0x2b')]=function(_0x1fcc4d,_0x222197){if(_0x222197){return moment(_0x1fcc4d)[_0xb5ce('0x2b')](_0x222197);}return!![];};exports['isBefore']=function(_0x320f19,_0x175562){if(_0x175562){return moment(_0x320f19)['isBefore'](_0x175562);}else if(_0x320f19){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 57649ea..fe61006 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 _0xbb46=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','responseTime','agent_name','test','setupLoggers','fs-extra','lodash','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','join','client','catch','then','user','no-user','error','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','name','role','use','device'];(function(_0x2c5ea7,_0x40133b){var _0x2f1615=function(_0x5ebcc6){while(--_0x5ebcc6){_0x2c5ea7['push'](_0x2c5ea7['shift']());}};_0x2f1615(++_0x40133b);}(_0xbb46,0x135));var _0x6bb4=function(_0x18f1a4,_0x518167){_0x18f1a4=_0x18f1a4-0x0;var _0x51b492=_0xbb46[_0x18f1a4];return _0x51b492;};var fs=require(_0x6bb4('0x0'));var _=require(_0x6bb4('0x1'));var ewinston=require('express-winston');var path=require(_0x6bb4('0x2'));var util=require(_0x6bb4('0x3'));var fileLogger=require('./loggers')[_0x6bb4('0x4')];var safeTemplate=require('./safe-template')[_0x6bb4('0x5')];var maskSensitiveData=require(_0x6bb4('0x6'))[_0x6bb4('0x7')];function ClientSideLogger(){function _0x33dbd5(_0x8f3e3a){var _0x561ccb=path['join'](_0x6bb4('0x8'),_0x6bb4('0x9'),'xcally');var _0x31ee11=path[_0x6bb4('0xa')](_0x6bb4('0xb'),_0x8f3e3a['role']+'-'+_0x8f3e3a['name']);return fs['ensureDir'](path[_0x6bb4('0xa')](_0x561ccb,_0x31ee11))['then'](function(){var _0x1d1da8=fileLogger(_0x6bb4('0xb'),path[_0x6bb4('0xa')](_0x561ccb,_0x31ee11));return _0x1d1da8;})[_0x6bb4('0xc')](function(_0x2dfb9e){throw _0x2dfb9e;});}this[_0x6bb4('0x9')]=function(_0x3a1366,_0x510430,_0x170f06,_0x581ad2){return _0x33dbd5(_0x3a1366['user'])[_0x6bb4('0xd')](function(_0x588975){var _0xd7090=_0x588975[_0x510430];return _0xd7090;})['then'](function(_0x9c59a2){var _0x48efcd=_0x3a1366[_0x6bb4('0xe')]?_0x3a1366[_0x6bb4('0xe')]['id']:_0x6bb4('0xf');var _0x341ff0=_0x581ad2['data'];var _0x1e49c3=_0x581ad2['timestamp'];var _0x454838=new Date(Number(_0x1e49c3));return _0x9c59a2(_0x48efcd,_0x454838,_0x170f06,_0x341ff0);})['catch'](function(_0x1be690){fileLogger('client')[_0x6bb4('0x10')](_0x1be690);});};}function setupLoggers(_0x37bbfe){return new Promise(function(_0x2e2b1d){var _0x3dbb14=new ClientSideLogger();var _0x5d4d27=fileLogger(_0x6bb4('0x11'));var _0x114f54=fileLogger(_0x6bb4('0x12'));_0x37bbfe[_0x6bb4('0x13')](_0x6bb4('0x14'),_0x3dbb14);_0x37bbfe['use'](ewinston[_0x6bb4('0x15')]({'winstonInstance':_0x5d4d27,'meta':![],'statusLevels':!![],'msg':function(_0x3a7066,_0x44c56f){var _0x149b61=_0x6bb4('0x16');if(!_['isEmpty'](_0x3a7066['body'])){_0x149b61+=_0x6bb4('0x17');var _0x4acc2b=_0x3a7066[_0x6bb4('0x18')];maskSensitiveData(_0x4acc2b);}return safeTemplate(util['format'](_0x149b61,_0x3a7066[_0x6bb4('0x19')],_0x3a7066[_0x6bb4('0x1a')][_0x6bb4('0x1b')]?_0x3a7066['headers']['x-forwarded-for']:_0x3a7066[_0x6bb4('0x1c')][_0x6bb4('0x1d')]||_0x3a7066['ip'],_0x3a7066['url'],_0x44c56f[_0x6bb4('0x1e')],_0x44c56f['responseTime'],_0x3a7066[_0x6bb4('0xe')]?_0x3a7066[_0x6bb4('0xe')]['id']:null,_0x3a7066[_0x6bb4('0xe')]?_0x3a7066[_0x6bb4('0xe')][_0x6bb4('0x1f')]:null,_0x3a7066[_0x6bb4('0xe')]?_0x3a7066[_0x6bb4('0xe')][_0x6bb4('0x20')]:null,_0x4acc2b?util['inspect'](_0x4acc2b,![],null):''));}}));_0x37bbfe[_0x6bb4('0x21')](ewinston[_0x6bb4('0x15')]({'winstonInstance':_0x114f54,'meta':![],'statusLevels':!![],'msg':function(_0x21a51d,_0x4fdf2b){var _0x2d698f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x21a51d[_0x6bb4('0x18')]&&_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x22')]&&_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x23')]){_0x2d698f=_0x6bb4('0x24');}return util[_0x6bb4('0x25')](_0x2d698f,_0x21a51d[_0x6bb4('0x19')],_0x21a51d[_0x6bb4('0x1a')][_0x6bb4('0x1b')]?_0x21a51d[_0x6bb4('0x1a')][_0x6bb4('0x1b')]:_0x21a51d[_0x6bb4('0x1c')]['remoteAddress']||_0x21a51d['ip'],_0x21a51d[_0x6bb4('0x26')],_0x4fdf2b[_0x6bb4('0x1e')],_0x4fdf2b[_0x6bb4('0x27')],_0x21a51d['user']?_0x21a51d[_0x6bb4('0xe')]['id']:null,_0x21a51d[_0x6bb4('0xe')]?_0x21a51d[_0x6bb4('0xe')][_0x6bb4('0x1f')]:null,_0x21a51d[_0x6bb4('0xe')]?_0x21a51d['user'][_0x6bb4('0x20')]:null,_0x21a51d[_0x6bb4('0x18')]&&_0x21a51d['body'][_0x6bb4('0x22')]?_0x21a51d['body'][_0x6bb4('0x22')]:'other',_0x21a51d[_0x6bb4('0x18')]&&_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x23')]?_0x21a51d['body'][_0x6bb4('0x23')]:'',_0x21a51d['body']&&_0x21a51d['body'][_0x6bb4('0x28')]?_0x21a51d[_0x6bb4('0x18')][_0x6bb4('0x28')]:'');},'ignoreRoute':function(_0x3c6d05){var _0x288fbc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x288fbc[_0x6bb4('0x29')](_0x3c6d05['url']);}}));return _0x2e2b1d();});}exports[_0x6bb4('0x2a')]=setupLoggers; \ No newline at end of file +var _0x05d6=['inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','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)','statusCode','responseTime','other','agent_name','setupLoggers','fs-extra','express-winston','path','./loggers','./safe-template','safeTemplate','/var','log','xcally','join','role','ensureDir','then','client','user','no-user','catch','error','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','name'];(function(_0x5e17d1,_0x1ab1c9){var _0x2c7746=function(_0x4821d7){while(--_0x4821d7){_0x5e17d1['push'](_0x5e17d1['shift']());}};_0x2c7746(++_0x1ab1c9);}(_0x05d6,0x164));var _0x605d=function(_0x487a89,_0x318bc5){_0x487a89=_0x487a89-0x0;var _0x5ef9ea=_0x05d6[_0x487a89];return _0x5ef9ea;};var fs=require(_0x605d('0x0'));var _=require('lodash');var ewinston=require(_0x605d('0x1'));var path=require(_0x605d('0x2'));var util=require('util');var fileLogger=require(_0x605d('0x3'))['fileLogger'];var safeTemplate=require(_0x605d('0x4'))[_0x605d('0x5')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x3b76ad(_0x5b21c4){var _0x3534a8=path['join'](_0x605d('0x6'),_0x605d('0x7'),_0x605d('0x8'));var _0x40b485=path[_0x605d('0x9')]('client',_0x5b21c4[_0x605d('0xa')]+'-'+_0x5b21c4['name']);return fs[_0x605d('0xb')](path[_0x605d('0x9')](_0x3534a8,_0x40b485))[_0x605d('0xc')](function(){var _0x29a646=fileLogger(_0x605d('0xd'),path[_0x605d('0x9')](_0x3534a8,_0x40b485));return _0x29a646;})['catch'](function(_0x3a5214){throw _0x3a5214;});}this[_0x605d('0x7')]=function(_0x206565,_0x2b11b6,_0x128e4b,_0x5766d0){return _0x3b76ad(_0x206565[_0x605d('0xe')])[_0x605d('0xc')](function(_0x33541c){var _0x5f1f7a=_0x33541c[_0x2b11b6];return _0x5f1f7a;})['then'](function(_0x52aeb7){var _0x748c27=_0x206565['user']?_0x206565[_0x605d('0xe')]['id']:_0x605d('0xf');var _0x48e300=_0x5766d0['data'];var _0x49f4a7=_0x5766d0['timestamp'];var _0x411f78=new Date(Number(_0x49f4a7));return _0x52aeb7(_0x748c27,_0x411f78,_0x128e4b,_0x48e300);})[_0x605d('0x10')](function(_0x4fc6e9){fileLogger(_0x605d('0xd'))[_0x605d('0x11')](_0x4fc6e9);});};}function setupLoggers(_0x38b627){return new Promise(function(_0x3869d2){var _0x25234d=new ClientSideLogger();var _0x7a6630=fileLogger(_0x605d('0x12'));var _0x1d7674=fileLogger(_0x605d('0x13'));_0x38b627[_0x605d('0x14')]('client-side-logger',_0x25234d);_0x38b627[_0x605d('0x15')](ewinston['logger']({'winstonInstance':_0x7a6630,'meta':![],'statusLevels':!![],'msg':function(_0xe915cd,_0x21314c){var _0x42f391=_0x605d('0x16');if(!_['isEmpty'](_0xe915cd['body'])){_0x42f391+=_0x605d('0x17');var _0x5db1a3=_0xe915cd['body'];maskSensitiveData(_0x5db1a3);}return safeTemplate(util[_0x605d('0x18')](_0x42f391,_0xe915cd[_0x605d('0x19')],_0xe915cd[_0x605d('0x1a')][_0x605d('0x1b')]?_0xe915cd['headers'][_0x605d('0x1b')]:_0xe915cd[_0x605d('0x1c')]['remoteAddress']||_0xe915cd['ip'],_0xe915cd[_0x605d('0x1d')],_0x21314c['statusCode'],_0x21314c['responseTime'],_0xe915cd[_0x605d('0xe')]?_0xe915cd[_0x605d('0xe')]['id']:null,_0xe915cd[_0x605d('0xe')]?_0xe915cd['user'][_0x605d('0x1e')]:null,_0xe915cd[_0x605d('0xe')]?_0xe915cd[_0x605d('0xe')][_0x605d('0xa')]:null,_0x5db1a3?util[_0x605d('0x1f')](_0x5db1a3,![],null):''));}}));_0x38b627['use'](ewinston[_0x605d('0x20')]({'winstonInstance':_0x1d7674,'meta':![],'statusLevels':!![],'msg':function(_0x51e952,_0x5d962f){var _0x16fd76=_0x605d('0x21');if(_0x51e952[_0x605d('0x22')]&&_0x51e952[_0x605d('0x22')][_0x605d('0x23')]&&_0x51e952[_0x605d('0x22')][_0x605d('0x24')]){_0x16fd76=_0x605d('0x25');}return util[_0x605d('0x18')](_0x16fd76,_0x51e952[_0x605d('0x19')],_0x51e952[_0x605d('0x1a')][_0x605d('0x1b')]?_0x51e952[_0x605d('0x1a')][_0x605d('0x1b')]:_0x51e952[_0x605d('0x1c')]['remoteAddress']||_0x51e952['ip'],_0x51e952[_0x605d('0x1d')],_0x5d962f[_0x605d('0x26')],_0x5d962f[_0x605d('0x27')],_0x51e952['user']?_0x51e952[_0x605d('0xe')]['id']:null,_0x51e952[_0x605d('0xe')]?_0x51e952[_0x605d('0xe')][_0x605d('0x1e')]:null,_0x51e952[_0x605d('0xe')]?_0x51e952[_0x605d('0xe')][_0x605d('0xa')]:null,_0x51e952['body']&&_0x51e952[_0x605d('0x22')]['device']?_0x51e952[_0x605d('0x22')][_0x605d('0x23')]:_0x605d('0x28'),_0x51e952[_0x605d('0x22')]&&_0x51e952['body'][_0x605d('0x24')]?_0x51e952['body'][_0x605d('0x24')]:'',_0x51e952[_0x605d('0x22')]&&_0x51e952[_0x605d('0x22')]['agent_name']?_0x51e952[_0x605d('0x22')][_0x605d('0x29')]:'');},'ignoreRoute':function(_0x56d341){var _0x1c0037=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c0037['test'](_0x56d341[_0x605d('0x1d')]);}}));return _0x3869d2();});}exports[_0x605d('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index f6a838c..afe0f67 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ecc=['padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','isBetween','format','ddd','includes','dowCompare','date','daysInMonth','max','min','monthCompare','guess','test','isMoment'];(function(_0x2f154a,_0x3064f0){var _0x1197ed=function(_0x1f7b08){while(--_0x1f7b08){_0x2f154a['push'](_0x2f154a['shift']());}};_0x1197ed(++_0x3064f0);}(_0x3ecc,0x17f));var _0xc3ec=function(_0x300b81,_0x3b8e83){_0x300b81=_0x300b81-0x0;var _0x36c624=_0x3ecc[_0x300b81];return _0x36c624;};var _=require(_0xc3ec('0x0'));var moment=require(_0xc3ec('0x1'));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][_0xc3ec('0x2')](function(_0x20c758){return _0x20c758[_0xc3ec('0x3')];})[_0xc3ec('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc3ec('0x5');var EINVALID_DATE=_0xc3ec('0x6');function throwIfDateNotValid(_0x35eb2b){if(!_0x35eb2b['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4605f4){var _0x10e52b=_0x4605f4[_0xc3ec('0x7')](':')[_0xc3ec('0x2')](function(_0x2975fc){return parseInt(_0x2975fc,0xa);});var _0xb19dae=_0x10e52b[0x0];var _0x2301af=_0x10e52b[0x1];if(_0xb19dae<0x0||_0xb19dae>0x17||_0x2301af<0x0||_0x2301af>0x3b){throw new Error(EINVALID_DATE);}return[_0xb19dae,_0x2301af];}function circularDoWInterval(_0x687124,_0xeedc84){if(_0x687124===_0xeedc84){return[_0x687124];}else{var _0x1a7c54=moment['locale']();moment[_0xc3ec('0x8')]('en');var _0x239d5a=moment[_0xc3ec('0x9')]()[_0xc3ec('0x2')](function(_0x240a14){return _0x240a14[_0xc3ec('0xa')]();});moment[_0xc3ec('0x8')](_0x1a7c54);var _0x4a1101=_0x239d5a['indexOf'](_0x687124);var _0x39beda=_0x239d5a[_0xc3ec('0xb')](_0xeedc84);if(_0x39beda>_0x4a1101){return _0x239d5a[_0xc3ec('0xc')](_0x4a1101,_0x39beda+0x1);}else{var _0x3a921e=_0x239d5a[_0xc3ec('0xc')](0x0,_0x39beda+0x1);var _0x3f36ae=_0x239d5a['slice'](_0x4a1101);return _0x3f36ae[_0xc3ec('0xd')](_0x3a921e);}}}module[_0xc3ec('0xe')][_0xc3ec('0xf')]=circularDoWInterval;function circularMonthInterval(_0x5090f9,_0x1681fe){if(_0x5090f9===_0x1681fe){return[_0x5090f9];}else{var _0x218bed=moment[_0xc3ec('0x8')]();moment[_0xc3ec('0x8')]('en');var _0xcc52a2=moment[_0xc3ec('0x10')]()[_0xc3ec('0x2')](function(_0x47d322){return _0x47d322['toLowerCase']();});moment[_0xc3ec('0x8')](_0x218bed);var _0x4859aa=_0xcc52a2[_0xc3ec('0xb')](_0x5090f9);var _0x465acd=_0xcc52a2['indexOf'](_0x1681fe);if(_0x465acd>_0x4859aa){return _0xcc52a2[_0xc3ec('0xc')](_0x4859aa,_0x465acd+0x1);}else{var _0x2dbe11=_0xcc52a2[_0xc3ec('0xc')](0x0,_0x465acd+0x1);var _0xb6a67f=_0xcc52a2[_0xc3ec('0xc')](_0x4859aa);return _0xb6a67f[_0xc3ec('0xd')](_0x2dbe11);}}}module[_0xc3ec('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x3a4c61){var _0x5516d8=parseInt(_0x3a4c61,0xa);if(_0x5516d8<0x1||_0x5516d8>0x1f){throw new Error(EINVALID_DATE);}return _0x5516d8;}function timeCompare(_0x43c1e1,_0x2f4040,_0x2abfed){var _0x217246=_0x43c1e1[_0xc3ec('0x11')]();var _0x59b9f4=extractTime(_0x2f4040);var _0x40e470=_0x59b9f4[0x0];var _0x357af0=_0x59b9f4[0x1];var _0x422270=_0x43c1e1[_0xc3ec('0x11')]()[_0xc3ec('0x12')](_0x40e470)['minutes'](_0x357af0);throwIfDateNotValid(_0x422270);var _0x8eb71b=extractTime(_0x2abfed);var _0x3c32d4=_0x8eb71b[0x0];var _0x32398a=_0x8eb71b[0x1];var _0x16e6cc=_0x43c1e1['clone']()['hours'](_0x3c32d4)[_0xc3ec('0x13')](_0x32398a);throwIfDateNotValid(_0x16e6cc);if(_0x16e6cc[_0xc3ec('0x14')](_0x422270)){var _0x1f01b9=_0x217246['clone']()[_0xc3ec('0x15')]('day');var _0x4ff5bd=_0x217246[_0xc3ec('0x11')]()['endOf']('day');return _0x217246['isBetween'](_0x422270,_0x4ff5bd,undefined,'[]')||_0x217246[_0xc3ec('0x16')](_0x1f01b9,_0x16e6cc,undefined,'[]');}else{return _0x217246['isBetween'](_0x422270,_0x16e6cc,undefined,'[]');}}module[_0xc3ec('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x43f447,_0x2af2a8,_0x4aca92){var _0x79f9b7=_0x43f447['locale']('en')[_0xc3ec('0x17')](_0xc3ec('0x18'))[_0xc3ec('0xa')]();return circularDoWInterval(_0x2af2a8,_0x4aca92)[_0xc3ec('0x19')](_0x79f9b7);}module[_0xc3ec('0xe')][_0xc3ec('0x1a')]=dowCompare;function domCompare(_0x1939ed,_0x54145d,_0x33e3fc){var _0xf6d677=_0x1939ed[_0xc3ec('0x1b')]();if(_0x54145d===_0x33e3fc){return _0xf6d677===_0x54145d;}else{var _0x21150f=_0x1939ed[_0xc3ec('0x1c')]();var _0x2ddb64=_0x54145d<_0x33e3fc;let _0x3b814a=![];var _0x1df365=0x0;var _0x3f5f9e=0x0;if(_0x2ddb64){_0x1df365=Math[_0xc3ec('0x1d')](0x1,_0x54145d);_0x3f5f9e=Math['min'](_0x33e3fc,_0x21150f);_0x3b814a=_0xf6d677>=_0x1df365&&_0xf6d677<=_0x3f5f9e;}else{_0x1df365=Math[_0xc3ec('0x1e')](_0x54145d,_0x21150f);_0x3f5f9e=Math[_0xc3ec('0x1d')](0x1,_0x33e3fc);_0x3b814a=_0xf6d677>=_0x1df365||_0xf6d677<=_0x3f5f9e;}return _0x3b814a;}}module[_0xc3ec('0xe')]['domCompare']=domCompare;function monthCompare(_0x5993c3,_0x100c12,_0x1126ee){var _0x385bda=_0x5993c3[_0xc3ec('0x8')]('en')['format']('MMM')[_0xc3ec('0xa')]();return circularMonthInterval(_0x100c12,_0x1126ee)['includes'](_0x385bda);}module[_0xc3ec('0xe')][_0xc3ec('0x1f')]=monthCompare;function iftime(_0x30dc18,_0x9fa08e=moment['tz'][_0xc3ec('0x20')](),_0x19856b=moment()){if(!validateRx[_0xc3ec('0x21')](_0x30dc18)){throw new Error(EINVALID_STRING);}else{var _0x5c3ab8=(moment[_0xc3ec('0x22')](_0x19856b)?_0x19856b[_0xc3ec('0x11')]():moment(_0x19856b))['tz'](_0x9fa08e)[_0xc3ec('0x8')]('en');throwIfDateNotValid(_0x5c3ab8);var _0x314ccf=_0x30dc18['split'](',');var _0x111df2=_0x314ccf[0x0];var _0x1d94d6=_0x314ccf[0x1];var _0xbcb2bf=_0x314ccf[0x2];var _0x41b7d1=_0x314ccf[0x3];let _0x1960ff=!![];if(_0x111df2!=='*'){var _0x1c4146=_0x111df2['split']('-');var _0x1e9f0d=_[_0xc3ec('0x23')](_0x1c4146[0x0],0x5,'0');var _0x19fa82=_0x1c4146['length']===0x2?_[_0xc3ec('0x23')](_0x1c4146[0x1],0x5,'0'):_0x1e9f0d;_0x1960ff=timeCompare(_0x5c3ab8,_0x1e9f0d,_0x19fa82);}let _0xa0fdad=!![];if(_0x1d94d6!=='*'){var _0x41a31e=_0x1d94d6[_0xc3ec('0x7')]('-');var _0xf76fec=_0x41a31e[0x0];var _0x427456=_0x41a31e[_0xc3ec('0x24')]===0x2?_0x41a31e[0x1]:_0xf76fec;_0xa0fdad=dowCompare(_0x5c3ab8,_0xf76fec,_0x427456);}let _0x173896=!![];if(_0xbcb2bf!=='*'){var _0xe1302a=_0xbcb2bf['split']('-');var _0x1db142=parseDom(_0xe1302a[0x0]);var _0x290aea=_0xe1302a[_0xc3ec('0x24')]===0x2?parseDom(_0xe1302a[0x1]):_0x1db142;_0x173896=domCompare(_0x5c3ab8,_0x1db142,_0x290aea);}let _0x38d9d8=!![];if(_0x41b7d1!=='*'){var _0x960a76=_0x41b7d1[_0xc3ec('0x7')]('-');var _0x20112b=_0x960a76[0x0];var _0x4e4c54=_0x960a76['length']===0x2?_0x960a76[0x1]:_0x960a76[0x0];_0x38d9d8=monthCompare(_0x5c3ab8,_0x20112b,_0x4e4c54);}return _0x1960ff&&_0xa0fdad&&_0x173896&&_0x38d9d8;}}module[_0xc3ec('0xe')][_0xc3ec('0x25')]=iftime; \ No newline at end of file +var _0x06dd=['Date\x20not\x20valid','isValid','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','split','length','padStart','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid'];(function(_0xdaaee5,_0x53465f){var _0x20a57d=function(_0x972aa4){while(--_0x972aa4){_0xdaaee5['push'](_0xdaaee5['shift']());}};_0x20a57d(++_0x53465f);}(_0x06dd,0x120));var _0xd06d=function(_0x441a91,_0x1a55e3){_0x441a91=_0x441a91-0x0;var _0x1c3bff=_0x06dd[_0x441a91];return _0x1c3bff;};var _=require(_0xd06d('0x0'));var moment=require(_0xd06d('0x1'));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][_0xd06d('0x2')](function(_0x5b5c66){return _0x5b5c66[_0xd06d('0x3')];})[_0xd06d('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xd06d('0x5');var EINVALID_DATE=_0xd06d('0x6');function throwIfDateNotValid(_0x538c17){if(!_0x538c17[_0xd06d('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5022d8){var _0x3ac04c=_0x5022d8['split'](':')[_0xd06d('0x2')](function(_0x41cbff){return parseInt(_0x41cbff,0xa);});var _0x53c94b=_0x3ac04c[0x0];var _0x5daeee=_0x3ac04c[0x1];if(_0x53c94b<0x0||_0x53c94b>0x17||_0x5daeee<0x0||_0x5daeee>0x3b){throw new Error(EINVALID_DATE);}return[_0x53c94b,_0x5daeee];}function circularDoWInterval(_0x18a90a,_0x4e6b03){if(_0x18a90a===_0x4e6b03){return[_0x18a90a];}else{var _0x26cc2e=moment['locale']();moment[_0xd06d('0x8')]('en');var _0x4303c2=moment[_0xd06d('0x9')]()[_0xd06d('0x2')](function(_0x24ef96){return _0x24ef96['toLowerCase']();});moment[_0xd06d('0x8')](_0x26cc2e);var _0x16f679=_0x4303c2['indexOf'](_0x18a90a);var _0x41eb13=_0x4303c2[_0xd06d('0xa')](_0x4e6b03);if(_0x41eb13>_0x16f679){return _0x4303c2[_0xd06d('0xb')](_0x16f679,_0x41eb13+0x1);}else{var _0x5c62b2=_0x4303c2[_0xd06d('0xb')](0x0,_0x41eb13+0x1);var _0x29f90f=_0x4303c2[_0xd06d('0xb')](_0x16f679);return _0x29f90f[_0xd06d('0xc')](_0x5c62b2);}}}module[_0xd06d('0xd')][_0xd06d('0xe')]=circularDoWInterval;function circularMonthInterval(_0x456ec3,_0x171257){if(_0x456ec3===_0x171257){return[_0x456ec3];}else{var _0x108943=moment[_0xd06d('0x8')]();moment[_0xd06d('0x8')]('en');var _0x1d3950=moment[_0xd06d('0xf')]()[_0xd06d('0x2')](function(_0x4663ad){return _0x4663ad[_0xd06d('0x10')]();});moment[_0xd06d('0x8')](_0x108943);var _0x3643a1=_0x1d3950['indexOf'](_0x456ec3);var _0x40e542=_0x1d3950[_0xd06d('0xa')](_0x171257);if(_0x40e542>_0x3643a1){return _0x1d3950[_0xd06d('0xb')](_0x3643a1,_0x40e542+0x1);}else{var _0x5c06b0=_0x1d3950[_0xd06d('0xb')](0x0,_0x40e542+0x1);var _0x447fa9=_0x1d3950[_0xd06d('0xb')](_0x3643a1);return _0x447fa9[_0xd06d('0xc')](_0x5c06b0);}}}module[_0xd06d('0xd')][_0xd06d('0x11')]=circularMonthInterval;function parseDom(_0x330541){var _0x2c7493=parseInt(_0x330541,0xa);if(_0x2c7493<0x1||_0x2c7493>0x1f){throw new Error(EINVALID_DATE);}return _0x2c7493;}function timeCompare(_0x47b32e,_0x2c74fc,_0xb25635){var _0x417495=_0x47b32e[_0xd06d('0x12')]();var _0x3a9379=extractTime(_0x2c74fc);var _0x3f140e=_0x3a9379[0x0];var _0x54172b=_0x3a9379[0x1];var _0x4fe64d=_0x47b32e[_0xd06d('0x12')]()[_0xd06d('0x13')](_0x3f140e)['minutes'](_0x54172b);throwIfDateNotValid(_0x4fe64d);var _0xfb0dde=extractTime(_0xb25635);var _0x49b847=_0xfb0dde[0x0];var _0x2fca07=_0xfb0dde[0x1];var _0x4f5456=_0x47b32e[_0xd06d('0x12')]()[_0xd06d('0x13')](_0x49b847)[_0xd06d('0x14')](_0x2fca07);throwIfDateNotValid(_0x4f5456);if(_0x4f5456[_0xd06d('0x15')](_0x4fe64d)){var _0x313d9b=_0x417495['clone']()[_0xd06d('0x16')](_0xd06d('0x17'));var _0x6fc48a=_0x417495['clone']()['endOf'](_0xd06d('0x17'));return _0x417495['isBetween'](_0x4fe64d,_0x6fc48a,undefined,'[]')||_0x417495[_0xd06d('0x18')](_0x313d9b,_0x4f5456,undefined,'[]');}else{return _0x417495[_0xd06d('0x18')](_0x4fe64d,_0x4f5456,undefined,'[]');}}module[_0xd06d('0xd')][_0xd06d('0x19')]=timeCompare;function dowCompare(_0x559553,_0x457303,_0x31cf65){var _0x284f91=_0x559553[_0xd06d('0x8')]('en')[_0xd06d('0x1a')]('ddd')[_0xd06d('0x10')]();return circularDoWInterval(_0x457303,_0x31cf65)[_0xd06d('0x1b')](_0x284f91);}module['exports'][_0xd06d('0x1c')]=dowCompare;function domCompare(_0x216060,_0x115aea,_0x524549){var _0x522cce=_0x216060['date']();if(_0x115aea===_0x524549){return _0x522cce===_0x115aea;}else{var _0x472502=_0x216060[_0xd06d('0x1d')]();var _0x2c97a1=_0x115aea<_0x524549;let _0x27d262=![];var _0x4166be=0x0;var _0x1d4c54=0x0;if(_0x2c97a1){_0x4166be=Math[_0xd06d('0x1e')](0x1,_0x115aea);_0x1d4c54=Math['min'](_0x524549,_0x472502);_0x27d262=_0x522cce>=_0x4166be&&_0x522cce<=_0x1d4c54;}else{_0x4166be=Math[_0xd06d('0x1f')](_0x115aea,_0x472502);_0x1d4c54=Math[_0xd06d('0x1e')](0x1,_0x524549);_0x27d262=_0x522cce>=_0x4166be||_0x522cce<=_0x1d4c54;}return _0x27d262;}}module[_0xd06d('0xd')][_0xd06d('0x20')]=domCompare;function monthCompare(_0x192824,_0x2ee420,_0x14ab98){var _0x548d33=_0x192824['locale']('en')[_0xd06d('0x1a')](_0xd06d('0x21'))[_0xd06d('0x10')]();return circularMonthInterval(_0x2ee420,_0x14ab98)['includes'](_0x548d33);}module[_0xd06d('0xd')][_0xd06d('0x22')]=monthCompare;function iftime(_0x66fdbe,_0xef26e1=moment['tz'][_0xd06d('0x23')](),_0x5a756d=moment()){if(!validateRx[_0xd06d('0x24')](_0x66fdbe)){throw new Error(EINVALID_STRING);}else{var _0x49bcdb=(moment[_0xd06d('0x25')](_0x5a756d)?_0x5a756d[_0xd06d('0x12')]():moment(_0x5a756d))['tz'](_0xef26e1)[_0xd06d('0x8')]('en');throwIfDateNotValid(_0x49bcdb);var _0x521f06=_0x66fdbe[_0xd06d('0x26')](',');var _0x317281=_0x521f06[0x0];var _0x4100a3=_0x521f06[0x1];var _0x1ff1f9=_0x521f06[0x2];var _0x4a6a37=_0x521f06[0x3];let _0x18a71b=!![];if(_0x317281!=='*'){var _0x104deb=_0x317281[_0xd06d('0x26')]('-');var _0x3c8558=_['padStart'](_0x104deb[0x0],0x5,'0');var _0x32bab9=_0x104deb[_0xd06d('0x27')]===0x2?_[_0xd06d('0x28')](_0x104deb[0x1],0x5,'0'):_0x3c8558;_0x18a71b=timeCompare(_0x49bcdb,_0x3c8558,_0x32bab9);}let _0x1c216b=!![];if(_0x4100a3!=='*'){var _0x27bede=_0x4100a3[_0xd06d('0x26')]('-');var _0x3cfc07=_0x27bede[0x0];var _0x442f5c=_0x27bede[_0xd06d('0x27')]===0x2?_0x27bede[0x1]:_0x3cfc07;_0x1c216b=dowCompare(_0x49bcdb,_0x3cfc07,_0x442f5c);}let _0x15c036=!![];if(_0x1ff1f9!=='*'){var _0x8473c7=_0x1ff1f9['split']('-');var _0xe2820f=parseDom(_0x8473c7[0x0]);var _0x2452e3=_0x8473c7['length']===0x2?parseDom(_0x8473c7[0x1]):_0xe2820f;_0x15c036=domCompare(_0x49bcdb,_0xe2820f,_0x2452e3);}let _0x267ba1=!![];if(_0x4a6a37!=='*'){var _0x526a51=_0x4a6a37[_0xd06d('0x26')]('-');var _0x5d5960=_0x526a51[0x0];var _0x1c596a=_0x526a51['length']===0x2?_0x526a51[0x1]:_0x526a51[0x0];_0x267ba1=monthCompare(_0x49bcdb,_0x5d5960,_0x1c596a);}return _0x18a71b&&_0x1c216b&&_0x15c036&&_0x267ba1;}}module[_0xd06d('0xd')][_0xd06d('0x29')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b3a2423..be5931a 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb56a=['error','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','red','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s'];(function(_0x365d7c,_0x42935d){var _0x1f0ffc=function(_0x3670d3){while(--_0x3670d3){_0x365d7c['push'](_0x365d7c['shift']());}};_0x1f0ffc(++_0x42935d);}(_0xb56a,0x16b));var _0xab56=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xb56a[_0x59d89e];return _0x554e93;};'use strict';var path=require(_0xab56('0x0'));var util=require(_0xab56('0x1'));var moment=require(_0xab56('0x2'));var winston=require('winston');var config=require(_0xab56('0x3'));var debugLevel=config[_0xab56('0x4')]?config[_0xab56('0x4')][_0xab56('0x5')]():_0xab56('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':'redBG\x20white','error':_0xab56('0x7'),'warn':'bold\x20yellow','info':'white','print':_0xab56('0x8'),'success':_0xab56('0x9'),'http':_0xab56('0xa'),'verbose':_0xab56('0xb'),'debug':_0xab56('0xc'),'silly':'bold\x20cyan'};winston[_0xab56('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1381ce,_0x2b9ccd,_0x16c204){var _0x5eac7f=_0x1381ce||_0xab56('0xe');return path[_0xab56('0xf')](_0x5eac7f,util['format'](_0xab56('0x10'),_0x2b9ccd,_0x16c204));}function formatter(_0x296986,_0x5529ca){_0x5529ca[_0xab56('0x11')]=_0x5529ca[_0xab56('0x11')]['replace'](/@@{/g,_0xab56('0x12'))[_0xab56('0x13')](/}@@/g,_0xab56('0x14'))['replace'](/@{/g,'{{')[_0xab56('0x13')](/}@/g,'}}');return util['format'](_0xab56('0x15'),moment()[_0xab56('0x16')](_0xab56('0x17')),_0x5529ca[_0xab56('0x18')][_0xab56('0x19')](),_0x296986,_0x5529ca[_0xab56('0x11')]);}function fileFormat(_0x2fc97e,_0x5d97a8){_0x5d97a8[_0xab56('0x11')]=_0x5d97a8['message'][_0xab56('0x13')](/@@{/g,'{{{')[_0xab56('0x13')](/}@@/g,_0xab56('0x14'))[_0xab56('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x127d53=_0x5d97a8[_0xab56('0x1a')]&&Object[_0xab56('0x1b')](_0x5d97a8[_0xab56('0x1a')])[_0xab56('0x1c')]?'\x0a\x09'+JSON[_0xab56('0x1d')](_0x5d97a8['meta']):'';return util[_0xab56('0x16')](_0xab56('0x1e'),moment()[_0xab56('0x16')](_0xab56('0x17')),_0x5d97a8['level']['toUpperCase'](),_0x2fc97e,_0x5d97a8[_0xab56('0x11')],_0x127d53);}function consoleLogger(){var _0x32eaba=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xab56('0x1f'))][(_0xab56('0x20'))]({'level':_0xab56('0x21'),'json':![],'formatter':function(_0x36a172){return formatter('',_0x36a172);}})]});return _0x32eaba;}function fileLogger(_0x3ff1bd,_0x5ca9be){var _0x43fcd7=new winston[(_0xab56('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xab56('0x23'))]({'name':util[_0xab56('0x16')](_0xab56('0x24'),_0x3ff1bd,_0xab56('0x25')),'filename':getLogFileName(_0x5ca9be,_0x3ff1bd,'error'),'level':_0xab56('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xd0974){return fileFormat(_0x3ff1bd,_0xd0974);}}),new winston[(_0xab56('0x1f'))][(_0xab56('0x23'))]({'name':util[_0xab56('0x16')]('%s-%s',_0x3ff1bd,debugLevel),'filename':getLogFileName(_0x5ca9be,_0x3ff1bd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x191764){return fileFormat(_0x3ff1bd,_0x191764);}}),new winston['transports'][(_0xab56('0x20'))]({'level':_0xab56('0x21'),'json':![],'formatter':function(_0x31524b){return fileFormat(_0x3ff1bd,_0x31524b);}})]});return _0x43fcd7;}exports[_0xab56('0x26')]=consoleLogger;exports[_0xab56('0x27')]=fileLogger; \ No newline at end of file +var _0xdb72=['winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','length','stringify','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','moment'];(function(_0x455afa,_0x235bfc){var _0x46ee43=function(_0x26de4a){while(--_0x26de4a){_0x455afa['push'](_0x455afa['shift']());}};_0x46ee43(++_0x235bfc);}(_0xdb72,0xe3));var _0x2db7=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0xdb72[_0xd3b0ac];return _0x3d773e;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x2db7('0x0'));var winston=require(_0x2db7('0x1'));var config=require(_0x2db7('0x2'));var debugLevel=config[_0x2db7('0x3')]?config['debugLevel']['toLowerCase']():_0x2db7('0x4');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':_0x2db7('0x5'),'error':_0x2db7('0x6'),'warn':_0x2db7('0x7'),'info':_0x2db7('0x8'),'print':_0x2db7('0x9'),'success':_0x2db7('0xa'),'http':_0x2db7('0xb'),'verbose':_0x2db7('0xc'),'debug':_0x2db7('0xd'),'silly':_0x2db7('0xe')};winston[_0x2db7('0xf')](XC_LOG_COLORS);function getLogFileName(_0x19d6bf,_0x17fc92,_0x42bd64){var _0x496c8d=_0x19d6bf||_0x2db7('0x10');return path['join'](_0x496c8d,util[_0x2db7('0x11')](_0x2db7('0x12'),_0x17fc92,_0x42bd64));}function formatter(_0x169eed,_0x481367){_0x481367[_0x2db7('0x13')]=_0x481367[_0x2db7('0x13')]['replace'](/@@{/g,_0x2db7('0x14'))['replace'](/}@@/g,_0x2db7('0x15'))[_0x2db7('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x2db7('0x17'),moment()['format'](_0x2db7('0x18')),_0x481367['level'][_0x2db7('0x19')](),_0x169eed,_0x481367[_0x2db7('0x13')]);}function fileFormat(_0x1b01b4,_0x160f3e){_0x160f3e[_0x2db7('0x13')]=_0x160f3e['message'][_0x2db7('0x16')](/@@{/g,'{{{')[_0x2db7('0x16')](/}@@/g,_0x2db7('0x15'))['replace'](/@{/g,'{{')[_0x2db7('0x16')](/}@/g,'}}');var _0x109a60=_0x160f3e['meta']&&Object['keys'](_0x160f3e[_0x2db7('0x1a')])[_0x2db7('0x1b')]?'\x0a\x09'+JSON[_0x2db7('0x1c')](_0x160f3e['meta']):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x2db7('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x160f3e['level'][_0x2db7('0x19')](),_0x1b01b4,_0x160f3e[_0x2db7('0x13')],_0x109a60);}function consoleLogger(){var _0xcc61fc=new winston[(_0x2db7('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2db7('0x1e'))][(_0x2db7('0x1f'))]({'level':_0x2db7('0x20'),'json':![],'formatter':function(_0x6a6998){return formatter('',_0x6a6998);}})]});return _0xcc61fc;}function fileLogger(_0x571165,_0x3b4989){var _0x45eabe=new winston[(_0x2db7('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2db7('0x1e'))][(_0x2db7('0x21'))]({'name':util[_0x2db7('0x11')](_0x2db7('0x22'),_0x571165,'error'),'filename':getLogFileName(_0x3b4989,_0x571165,_0x2db7('0x23')),'level':_0x2db7('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a7e8e){return fileFormat(_0x571165,_0x4a7e8e);}}),new winston[(_0x2db7('0x1e'))]['File']({'name':util['format'](_0x2db7('0x22'),_0x571165,debugLevel),'filename':getLogFileName(_0x3b4989,_0x571165,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x39cf23){return fileFormat(_0x571165,_0x39cf23);}}),new winston[(_0x2db7('0x1e'))][(_0x2db7('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x417fd2){return fileFormat(_0x571165,_0x417fd2);}})]});return _0x45eabe;}exports[_0x2db7('0x24')]=consoleLogger;exports[_0x2db7('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index a429fe8..89d791e 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 _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x2efc19,_0xff8642){var _0x50c1f3=function(_0x377b87){while(--_0x377b87){_0x2efc19['push'](_0x2efc19['shift']());}};_0x50c1f3(++_0xff8642);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4edbbe,_0x1f98ed){_0x4edbbe=_0x4edbbe-0x0;var _0x38a79e=_0x5f2f[_0x4edbbe];return _0x38a79e;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x479016,_0x4b4fe3){var _0x44ad49=function(_0x27090a){while(--_0x27090a){_0x479016['push'](_0x479016['shift']());}};_0x44ad49(++_0x4b4fe3);}(_0x1261,0x144));var _0x1126=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x1261[_0x347399];return _0x24e7be;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index af7179b..07d33fd 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 _0x4cf8=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','exports'];(function(_0x9dd803,_0x325cf5){var _0xc0110b=function(_0x18f72d){while(--_0x18f72d){_0x9dd803['push'](_0x9dd803['shift']());}};_0xc0110b(++_0x325cf5);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x4cf8[_0x284bc3];return _0x41ac81;};var _=require(_0x84cf('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2d03b6){return _0x2d03b6==='{{'?_0x84cf('0x1'):_0x84cf('0x2');}function safeTemplate(_0xae953){var _0x28455b=_0xae953;if(typeof _0xae953===_0x84cf('0x3')){_0x28455b=_0xae953[_0x84cf('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x84cf('0x5')](_0xae953)){_0x28455b=_0xae953[_0x84cf('0x6')](function(_0x5844d7){return safeTemplate(_0x5844d7);});}else if(_[_0x84cf('0x7')](_0xae953)){_0x28455b=Object['keys'](_0xae953)['reduce'](function(_0x455345,_0x56c5cc){_0x455345[_0x56c5cc]=safeTemplate(_0xae953[_0x56c5cc]);return _0x455345;},{});}return _0x28455b;}module[_0x84cf('0x8')][_0x84cf('0x9')]=safeTemplate; \ No newline at end of file +var _0x5c00=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','string'];(function(_0x42892a,_0x4e0efe){var _0x5ea5a9=function(_0xaf0c76){while(--_0xaf0c76){_0x42892a['push'](_0x42892a['shift']());}};_0x5ea5a9(++_0x4e0efe);}(_0x5c00,0x17e));var _0x05c0=function(_0x3d0c0a,_0x569519){_0x3d0c0a=_0x3d0c0a-0x0;var _0x338e0e=_0x5c00[_0x3d0c0a];return _0x338e0e;};var _=require(_0x05c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x7f1364){return _0x7f1364==='{{'?_0x05c0('0x1'):'\x20}\x20}';}function safeTemplate(_0x1e76da){var _0x5859bc=_0x1e76da;if(typeof _0x1e76da===_0x05c0('0x2')){_0x5859bc=_0x1e76da[_0x05c0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x05c0('0x4')](_0x1e76da)){_0x5859bc=_0x1e76da[_0x05c0('0x5')](function(_0x565efc){return safeTemplate(_0x565efc);});}else if(_[_0x05c0('0x6')](_0x1e76da)){_0x5859bc=Object[_0x05c0('0x7')](_0x1e76da)[_0x05c0('0x8')](function(_0x27dc10,_0x5b9f09){_0x27dc10[_0x5b9f09]=safeTemplate(_0x1e76da[_0x5b9f09]);return _0x27dc10;},{});}return _0x5859bc;}module[_0x05c0('0x9')][_0x05c0('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index e845296..cf210c2 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 _0xb821=['string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH'];(function(_0x139d3a,_0x23931e){var _0x345d6b=function(_0x3b1433){while(--_0x3b1433){_0x139d3a['push'](_0x139d3a['shift']());}};_0x345d6b(++_0x23931e);}(_0xb821,0xef));var _0x1b82=function(_0x2048ee,_0x2fe036){_0x2048ee=_0x2048ee-0x0;var _0x3182c0=_0xb821[_0x2048ee];return _0x3182c0;};var fs=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var config=require(_0x1b82('0x2'));var root=config[_0x1b82('0x3')];var APP_JSON_PATH=path[_0x1b82('0x4')](root,_0x1b82('0x5'));var NODEPATH=path['resolve'](root,_0x1b82('0x6'));function setLegacyLibsNodeEnvPath(_0x2111b1){let _0x270664=![];if(Array[_0x1b82('0x7')](_0x2111b1[_0x1b82('0x8')])){var _0x49733b=_0x2111b1[_0x1b82('0x8')][_0x1b82('0x9')](function(_0xac383a){return _0xac383a[_0x1b82('0xa')]===_0x1b82('0xb');});if(_0x49733b>-0x1){var _0x493bc=_0x2111b1[_0x1b82('0x8')][_0x49733b];if(typeof _0x493bc[_0x1b82('0xc')][_0x1b82('0xd')]!==_0x1b82('0xe')){_0x493bc[_0x1b82('0xc')][_0x1b82('0xd')]=NODEPATH;_0x270664=!![];}}return{'appConfig':_0x2111b1,'updated':_0x270664};}}function updateAppConfig(_0x23abeb){return fs[_0x1b82('0xf')](APP_JSON_PATH)[_0x1b82('0x10')](function(_0x1b9d04){if(_0x1b9d04){return fs[_0x1b82('0x11')](APP_JSON_PATH)[_0x1b82('0x10')](function(_0x36204d){var _0x10bd15=setLegacyLibsNodeEnvPath(_0x36204d);if(_0x10bd15[_0x1b82('0x12')]){_0x23abeb[_0x1b82('0x13')](_0x1b82('0x14'));return fs[_0x1b82('0x15')](APP_JSON_PATH,_0x36204d,{'spaces':0x2});}else{return Promise[_0x1b82('0x4')]();}});}else{return Promise[_0x1b82('0x4')]();}});}module[_0x1b82('0x16')]=updateAppConfig; \ No newline at end of file +var _0x5ed1=['string','pathExists','then','updated','info','Updating\x20app.json','writeJSON','resolve','fs-extra','../config/environment','root','server/app.json','isArray','apps','name','motion2','env','NODE_PATH'];(function(_0x23d167,_0x1affb6){var _0x25beb2=function(_0x235d82){while(--_0x235d82){_0x23d167['push'](_0x23d167['shift']());}};_0x25beb2(++_0x1affb6);}(_0x5ed1,0x13a));var _0x15ed=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x5ed1[_0x18ab2a];return _0x16dcee;};var fs=require(_0x15ed('0x0'));var path=require('path');var config=require(_0x15ed('0x1'));var root=config[_0x15ed('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x15ed('0x3'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x253863){let _0x5a1dbe=![];if(Array[_0x15ed('0x4')](_0x253863[_0x15ed('0x5')])){var _0x593a6c=_0x253863[_0x15ed('0x5')]['findIndex'](function(_0x54829c){return _0x54829c[_0x15ed('0x6')]===_0x15ed('0x7');});if(_0x593a6c>-0x1){var _0x3360b7=_0x253863[_0x15ed('0x5')][_0x593a6c];if(typeof _0x3360b7[_0x15ed('0x8')][_0x15ed('0x9')]!==_0x15ed('0xa')){_0x3360b7[_0x15ed('0x8')][_0x15ed('0x9')]=NODEPATH;_0x5a1dbe=!![];}}return{'appConfig':_0x253863,'updated':_0x5a1dbe};}}function updateAppConfig(_0x46c380){return fs[_0x15ed('0xb')](APP_JSON_PATH)['then'](function(_0x86bc75){if(_0x86bc75){return fs['readJSON'](APP_JSON_PATH)[_0x15ed('0xc')](function(_0x5cd796){var _0x2a8405=setLegacyLibsNodeEnvPath(_0x5cd796);if(_0x2a8405[_0x15ed('0xd')]){_0x46c380[_0x15ed('0xe')](_0x15ed('0xf'));return fs[_0x15ed('0x10')](APP_JSON_PATH,_0x5cd796,{'spaces':0x2});}else{return Promise[_0x15ed('0x11')]();}});}else{return Promise[_0x15ed('0x11')]();}});}module['exports']=updateAppConfig; \ No newline at end of file